From: support Date: Fri, 20 Jan 2023 10:06:55 +0000 (+0000) Subject: Built motion from commit 6f14c8ba.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=7f0621eff70afe3819793a54441bb1adf9d2cf44;p=motion2.git Built motion from commit 6f14c8ba.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b473114..f73231f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.28", + "version": "2.6.29", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-19T16:17:14.316Z", + "time": "2023-01-20T09:58:30.833Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3c188a4..7623dec 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.28", + "version": "2.6.29", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-19T16:17:14.316Z", + "time": "2023-01-20T09:58:30.833Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 1b847b4..bec345e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.28", + "version": "2.6.29", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 5371a30..c430d50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.28", + "version": "2.6.29", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 7ff55fd..f597d88 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 _0x87fa=['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]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','getDataValue','action','STRING','contactManager','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x2f8c05,_0x551e3d){var _0x14cfde=function(_0x282d66){while(--_0x282d66){_0x2f8c05['push'](_0x2f8c05['shift']());}};_0x14cfde(++_0x551e3d);}(_0x87fa,0xf6));var _0xa87f=function(_0x505e73,_0x533864){_0x505e73=_0x505e73-0x0;var _0x2ac5b6=_0x87fa[_0x505e73];return _0x2ac5b6;};'use strict';var Sequelize=require(_0xa87f('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a3085){return this[_0xa87f('0x1')](_0xa87f('0x2'));}},'action':{'type':Sequelize[_0xa87f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa87f('0x4'),'integration','motionbar','jscripty','urlForward',_0xa87f('0x5'),_0xa87f('0x6'),_0xa87f('0x7')]],'msg':_0xa87f('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xa87f('0x3')](0x1000),'comment':_0xa87f('0x9')},'data2':{'type':Sequelize[_0xa87f('0x3')](0x1000),'comment':_0xa87f('0xa')},'data3':{'type':Sequelize[_0xa87f('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xa87f('0x3')](0x1000),'comments':_0xa87f('0xb')},'data6':{'type':Sequelize[_0xa87f('0x3')],'comments':_0xa87f('0xc')},'data7':{'type':Sequelize[_0xa87f('0xd')],'comments':_0xa87f('0xe')}}; \ No newline at end of file +var _0x9efe=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x9efe,0xca));var _0xe9ef=function(_0x530455,_0x41da2d){_0x530455=_0x530455-0x0;var _0x128a27=_0x9efe[_0x530455];return _0x128a27;};'use strict';var Sequelize=require('sequelize');module[_0xe9ef('0x0')]={'name':{'type':Sequelize[_0xe9ef('0x1')],'get':function(_0xb0e89c){return this[_0xe9ef('0x2')](_0xe9ef('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xe9ef('0x4'),_0xe9ef('0x5'),_0xe9ef('0x6'),_0xe9ef('0x7'),_0xe9ef('0x8'),_0xe9ef('0x9'),_0xe9ef('0xa'),'script']],'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[_0xe9ef('0xb')](0x1000),'comment':_0xe9ef('0xc')},'data2':{'type':Sequelize[_0xe9ef('0xb')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xe9ef('0xd')},'data5':{'type':Sequelize[_0xe9ef('0xb')](0x1000),'comments':_0xe9ef('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0xe9ef('0xf')},'data7':{'type':Sequelize[_0xe9ef('0x10')],'comments':_0xe9ef('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4893755..fe35464 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 _0xfda9=['json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xfda9,0x15d));var _0x9fda=function(_0x29be5a,_0x33a386){_0x29be5a=_0x29be5a-0x0;var _0x4fe55e=_0xfda9[_0x29be5a];return _0x4fe55e;};'use strict';var emlformat=require(_0x9fda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fda('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9fda('0x2'));var util=require(_0x9fda('0x3'));var path=require(_0x9fda('0x4'));var sox=require(_0x9fda('0x5'));var csv=require('to-csv');var ejs=require(_0x9fda('0x6'));var fs=require('fs');var fs_extra=require(_0x9fda('0x7'));var _=require(_0x9fda('0x8'));var squel=require(_0x9fda('0x9'));var crypto=require(_0x9fda('0xa'));var jsforce=require(_0x9fda('0xb'));var deskjs=require(_0x9fda('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9fda('0xd'));var Redis=require(_0x9fda('0xe'));var authService=require(_0x9fda('0xf'));var qs=require(_0x9fda('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fda('0x11'));var logger=require(_0x9fda('0x12'))(_0x9fda('0x13'));var utils=require(_0x9fda('0x14'));var config=require(_0x9fda('0x15'));var licenseUtil=require(_0x9fda('0x16'));var db=require(_0x9fda('0x17'))['db'];function respondWithStatusCode(_0x20837b,_0x16cd68){_0x16cd68=_0x16cd68||0xcc;return function(_0x42c318){if(_0x42c318){return _0x20837b[_0x9fda('0x18')](_0x16cd68);}return _0x20837b['status'](_0x16cd68)[_0x9fda('0x19')]();};}function respondWithResult(_0x54d804,_0x18c6b6){_0x18c6b6=_0x18c6b6||0xc8;return function(_0x14fbb4){if(_0x14fbb4){return _0x54d804[_0x9fda('0x1a')](_0x18c6b6)[_0x9fda('0x1b')](_0x14fbb4);}};}function respondWithFilteredResult(_0x129af5,_0x10f337){return function(_0x5d7cbc){if(_0x5d7cbc){var _0x3d8221=typeof _0x10f337[_0x9fda('0x1c')]===_0x9fda('0x1d')&&typeof _0x10f337[_0x9fda('0x1e')]===_0x9fda('0x1d');var _0x2b29b6=_0x5d7cbc['count'];var _0x317290=_0x3d8221?0x0:_0x10f337[_0x9fda('0x1c')];var _0x13e933=_0x3d8221?_0x5d7cbc[_0x9fda('0x1f')]:_0x10f337['offset']+_0x10f337['limit'];var _0x2e0f7c;if(_0x13e933>=_0x2b29b6){_0x13e933=_0x2b29b6;_0x2e0f7c=0xc8;}else{_0x2e0f7c=0xce;}_0x129af5[_0x9fda('0x1a')](_0x2e0f7c);return _0x129af5['set']('Content-Range',_0x317290+'-'+_0x13e933+'/'+_0x2b29b6)['json'](_0x5d7cbc);}return null;};}function patchUpdates(_0x2c5771){return function(_0x164f63){try{jsonpatch[_0x9fda('0x20')](_0x164f63,_0x2c5771,!![]);}catch(_0xd5fa0c){return BPromise[_0x9fda('0x21')](_0xd5fa0c);}return _0x164f63[_0x9fda('0x22')]();};}function saveUpdates(_0x59da93,_0x4d8bad){return function(_0x10cc3c){if(_0x10cc3c){return _0x10cc3c[_0x9fda('0x23')](_0x59da93)[_0x9fda('0x24')](function(_0x338fd7){return _0x338fd7;});}return null;};}function removeEntity(_0x3159ad,_0x1f8c24){return function(_0x4342e7){if(_0x4342e7){return _0x4342e7[_0x9fda('0x25')]()['then'](function(){_0x3159ad[_0x9fda('0x1a')](0xcc)[_0x9fda('0x19')]();});}};}function handleEntityNotFound(_0xc2efd3,_0x5ba132){return function(_0x1d4f51){if(!_0x1d4f51){_0xc2efd3['sendStatus'](0x194);}return _0x1d4f51;};}function handleError(_0x1cfd7a,_0x2750dc){_0x2750dc=_0x2750dc||0x1f4;return function(_0x2f26b1){logger[_0x9fda('0x26')](_0x2f26b1[_0x9fda('0x27')]);if(_0x2f26b1[_0x9fda('0x28')]){delete _0x2f26b1['name'];}_0x1cfd7a[_0x9fda('0x1a')](_0x2750dc)[_0x9fda('0x29')](_0x2f26b1);};}exports['update']=function(_0xfd1789,_0x1fc7e5){if(_0xfd1789[_0x9fda('0x2a')]['id']){delete _0xfd1789['body']['id'];}return db[_0x9fda('0x2b')][_0x9fda('0x2c')]({'where':{'id':_0xfd1789[_0x9fda('0x2d')]['id']}})[_0x9fda('0x24')](handleEntityNotFound(_0x1fc7e5,null))['then'](saveUpdates(_0xfd1789[_0x9fda('0x2a')],null))['then'](respondWithResult(_0x1fc7e5,null))['catch'](handleError(_0x1fc7e5,null));};exports[_0x9fda('0x25')]=function(_0x12cf18,_0x518933){return db[_0x9fda('0x2b')][_0x9fda('0x2c')]({'where':{'id':_0x12cf18[_0x9fda('0x2d')]['id']}})[_0x9fda('0x24')](handleEntityNotFound(_0x518933,null))[_0x9fda('0x24')](removeEntity(_0x518933,null))[_0x9fda('0x2e')](handleError(_0x518933,null));}; \ No newline at end of file +var _0xa427=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','name','update','body','Action','params','catch','find','eml-format','zip-dir'];(function(_0x30ccbc,_0xa15176){var _0x28efee=function(_0xa0e41){while(--_0xa0e41){_0x30ccbc['push'](_0x30ccbc['shift']());}};_0x28efee(++_0xa15176);}(_0xa427,0xdf));var _0x7a42=function(_0x6aae3b,_0x1f366f){_0x6aae3b=_0x6aae3b-0x0;var _0x24d8b3=_0xa427[_0x6aae3b];return _0x24d8b3;};'use strict';var emlformat=require(_0x7a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a42('0x1'));var jsonpatch=require(_0x7a42('0x2'));var rp=require(_0x7a42('0x3'));var moment=require(_0x7a42('0x4'));var BPromise=require(_0x7a42('0x5'));var Mustache=require(_0x7a42('0x6'));var util=require(_0x7a42('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7a42('0x8'));var ejs=require(_0x7a42('0x9'));var fs=require('fs');var fs_extra=require(_0x7a42('0xa'));var _=require(_0x7a42('0xb'));var squel=require(_0x7a42('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a42('0xd'));var deskjs=require(_0x7a42('0xe'));var toCsv=require(_0x7a42('0x8'));var querystring=require('querystring');var Papa=require(_0x7a42('0xf'));var Redis=require(_0x7a42('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7a42('0x11'));var as=require(_0x7a42('0x12'));var hardwareService=require(_0x7a42('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7a42('0x14'));var config=require(_0x7a42('0x15'));var licenseUtil=require(_0x7a42('0x16'));var db=require(_0x7a42('0x17'))['db'];function respondWithStatusCode(_0x73d2d5,_0x4407a2){_0x4407a2=_0x4407a2||0xcc;return function(_0x39b99f){if(_0x39b99f){return _0x73d2d5[_0x7a42('0x18')](_0x4407a2);}return _0x73d2d5[_0x7a42('0x19')](_0x4407a2)[_0x7a42('0x1a')]();};}function respondWithResult(_0x4f8528,_0x592215){_0x592215=_0x592215||0xc8;return function(_0x553100){if(_0x553100){return _0x4f8528[_0x7a42('0x19')](_0x592215)[_0x7a42('0x1b')](_0x553100);}};}function respondWithFilteredResult(_0x26b0a6,_0x566ea7){return function(_0x12cdf7){if(_0x12cdf7){var _0xa5bb93=typeof _0x566ea7[_0x7a42('0x1c')]==='undefined'&&typeof _0x566ea7[_0x7a42('0x1d')]===_0x7a42('0x1e');var _0x29d792=_0x12cdf7[_0x7a42('0x1f')];var _0x220491=_0xa5bb93?0x0:_0x566ea7[_0x7a42('0x1c')];var _0x368525=_0xa5bb93?_0x12cdf7['count']:_0x566ea7[_0x7a42('0x1c')]+_0x566ea7[_0x7a42('0x1d')];var _0x4477fb;if(_0x368525>=_0x29d792){_0x368525=_0x29d792;_0x4477fb=0xc8;}else{_0x4477fb=0xce;}_0x26b0a6[_0x7a42('0x19')](_0x4477fb);return _0x26b0a6['set'](_0x7a42('0x20'),_0x220491+'-'+_0x368525+'/'+_0x29d792)[_0x7a42('0x1b')](_0x12cdf7);}return null;};}function patchUpdates(_0x19a1b4){return function(_0x59e614){try{jsonpatch['apply'](_0x59e614,_0x19a1b4,!![]);}catch(_0x35d699){return BPromise[_0x7a42('0x21')](_0x35d699);}return _0x59e614[_0x7a42('0x22')]();};}function saveUpdates(_0x42e662,_0x488ec4){return function(_0x57b2e9){if(_0x57b2e9){return _0x57b2e9['update'](_0x42e662)[_0x7a42('0x23')](function(_0x118ed0){return _0x118ed0;});}return null;};}function removeEntity(_0x55f8d6,_0x19664e){return function(_0x58c143){if(_0x58c143){return _0x58c143[_0x7a42('0x24')]()[_0x7a42('0x23')](function(){_0x55f8d6[_0x7a42('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3476ac,_0x51dae8){return function(_0x2e3103){if(!_0x2e3103){_0x3476ac[_0x7a42('0x18')](0x194);}return _0x2e3103;};}function handleError(_0x5095a2,_0x150b88){_0x150b88=_0x150b88||0x1f4;return function(_0x220a98){logger[_0x7a42('0x25')](_0x220a98['stack']);if(_0x220a98[_0x7a42('0x26')]){delete _0x220a98[_0x7a42('0x26')];}_0x5095a2[_0x7a42('0x19')](_0x150b88)['send'](_0x220a98);};}exports[_0x7a42('0x27')]=function(_0x1c6e23,_0x44b67c){if(_0x1c6e23['body']['id']){delete _0x1c6e23[_0x7a42('0x28')]['id'];}return db[_0x7a42('0x29')]['find']({'where':{'id':_0x1c6e23[_0x7a42('0x2a')]['id']}})[_0x7a42('0x23')](handleEntityNotFound(_0x44b67c,null))[_0x7a42('0x23')](saveUpdates(_0x1c6e23[_0x7a42('0x28')],null))[_0x7a42('0x23')](respondWithResult(_0x44b67c,null))[_0x7a42('0x2b')](handleError(_0x44b67c,null));};exports[_0x7a42('0x24')]=function(_0x316ecc,_0x2d33e6){return db[_0x7a42('0x29')][_0x7a42('0x2c')]({'where':{'id':_0x316ecc[_0x7a42('0x2a')]['id']}})[_0x7a42('0x23')](handleEntityNotFound(_0x2d33e6,null))[_0x7a42('0x23')](removeEntity(_0x2d33e6,null))[_0x7a42('0x2b')](handleError(_0x2d33e6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d845b43..1531542 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 _0xfa46=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa46,0x17f));var _0x6fa4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfa46[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6fa4('0x0'));var util=require(_0x6fa4('0x1'));var logger=require(_0x6fa4('0x2'))(_0x6fa4('0x3'));var moment=require('moment');var BPromise=require(_0x6fa4('0x4'));var rp=require(_0x6fa4('0x5'));var fs=require('fs');var path=require(_0x6fa4('0x6'));var rimraf=require(_0x6fa4('0x7'));var config=require(_0x6fa4('0x8'));var attributes=require(_0x6fa4('0x9'));module['exports']=function(_0xbb693c,_0x4a5b45){return _0xbb693c[_0x6fa4('0xa')](_0x6fa4('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa222=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger'];(function(_0x14218e,_0x399ea2){var _0x2bbf30=function(_0x1d0361){while(--_0x1d0361){_0x14218e['push'](_0x14218e['shift']());}};_0x2bbf30(++_0x399ea2);}(_0xa222,0x1b7));var _0x2a22=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xa222[_0x11ba83];return _0x3f3925;};'use strict';var _=require(_0x2a22('0x0'));var util=require(_0x2a22('0x1'));var logger=require(_0x2a22('0x2'))(_0x2a22('0x3'));var moment=require(_0x2a22('0x4'));var BPromise=require(_0x2a22('0x5'));var rp=require(_0x2a22('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a22('0x7'));var config=require(_0x2a22('0x8'));var attributes=require(_0x2a22('0x9'));module['exports']=function(_0x131132,_0x2f2ace){return _0x131132[_0x2a22('0xa')](_0x2a22('0xb'),attributes,{'tableName':_0x2a22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3cd5083..d2b3c46 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 _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x814b,0x1a2));var _0xb814=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x814b[_0x308dcc];return _0x361717;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1cb9,0x14e));var _0x91cb=function(_0x533860,_0x4c625a){_0x533860=_0x533860-0x0;var _0x345815=_0x1cb9[_0x533860];return _0x345815;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4ea4ecf..80af3a2 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 _0xf8d8=['../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x693a6f,_0x3aac6f){var _0x4b9313=function(_0x4d920a){while(--_0x4d920a){_0x693a6f['push'](_0x693a6f['shift']());}};_0x4b9313(++_0x3aac6f);}(_0xf8d8,0x1a1));var _0x8f8d=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xf8d8[_0x4b4277];return _0x1ff405;};'use strict';var multer=require(_0x8f8d('0x0'));var util=require(_0x8f8d('0x1'));var path=require(_0x8f8d('0x2'));var timeout=require(_0x8f8d('0x3'));var express=require(_0x8f8d('0x4'));var router=express[_0x8f8d('0x5')]();var fs_extra=require(_0x8f8d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8f8d('0x7'));var config=require(_0x8f8d('0x8'));var controller=require(_0x8f8d('0x9'));router[_0x8f8d('0xa')](_0x8f8d('0xb'),auth[_0x8f8d('0xc')](),controller[_0x8f8d('0xd')]);router[_0x8f8d('0xe')](_0x8f8d('0xb'),auth['isAuthenticated'](),controller[_0x8f8d('0xf')]);module[_0x8f8d('0x10')]=router; \ No newline at end of file +var _0x7863=['update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x2fafa5,_0x1ef53c){var _0x78aa81=function(_0x4836c5){while(--_0x4836c5){_0x2fafa5['push'](_0x2fafa5['shift']());}};_0x78aa81(++_0x1ef53c);}(_0x7863,0x11c));var _0x3786=function(_0x4fc4e7,_0x16bfc4){_0x4fc4e7=_0x4fc4e7-0x0;var _0x297133=_0x7863[_0x4fc4e7];return _0x297133;};'use strict';var multer=require(_0x3786('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3786('0x1'));var express=require(_0x3786('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3786('0x3'));var interaction=require(_0x3786('0x4'));var config=require(_0x3786('0x5'));var controller=require(_0x3786('0x6'));router[_0x3786('0x7')](_0x3786('0x8'),auth[_0x3786('0x9')](),controller[_0x3786('0xa')]);router[_0x3786('0xb')](_0x3786('0x8'),auth[_0x3786('0x9')](),controller[_0x3786('0xc')]);module[_0x3786('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 818cc0f..4a392aa 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x515ee4,_0x436b6b){_0x515ee4=_0x515ee4-0x0;var _0xe82fcb=_0x1cb9[_0x515ee4];return _0xe82fcb;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x214c71,_0x531fb8){_0x214c71=_0x214c71-0x0;var _0x23141b=_0xdc97[_0x214c71];return _0x23141b;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5da9466..0591871 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 _0xcfcb=['custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','countTable','run','COUNT(DISTINCT\x20%s)','MIN(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','CustomReports','UserProfileResource','destroy','stack','name','map','AnalyticCustomReport','fieldName','model','query','keys','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','replace','function','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ValidationErrorItem','from','metric','groupBy','output','web','fullPath','randomstring','csv'];(function(_0x2bc44d,_0x286b2b){var _0x4df179=function(_0x3ae279){while(--_0x3ae279){_0x2bc44d['push'](_0x2bc44d['shift']());}};_0x4df179(++_0x286b2b);}(_0xcfcb,0x1f1));var _0xbcfc=function(_0x37bb40,_0x259deb){_0x37bb40=_0x37bb40-0x0;var _0x598fb0=_0xcfcb[_0x37bb40];return _0x598fb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcfc('0x0'));var zipdir=require(_0xbcfc('0x1'));var jsonpatch=require(_0xbcfc('0x2'));var rp=require(_0xbcfc('0x3'));var moment=require('moment');var BPromise=require(_0xbcfc('0x4'));var Mustache=require(_0xbcfc('0x5'));var util=require(_0xbcfc('0x6'));var path=require('path');var sox=require(_0xbcfc('0x7'));var csv=require(_0xbcfc('0x8'));var ejs=require(_0xbcfc('0x9'));var fs=require('fs');var fs_extra=require(_0xbcfc('0xa'));var _=require('lodash');var squel=require(_0xbcfc('0xb'));var crypto=require(_0xbcfc('0xc'));var jsforce=require(_0xbcfc('0xd'));var deskjs=require(_0xbcfc('0xe'));var toCsv=require(_0xbcfc('0x8'));var querystring=require(_0xbcfc('0xf'));var Papa=require(_0xbcfc('0x10'));var Redis=require(_0xbcfc('0x11'));var authService=require(_0xbcfc('0x12'));var qs=require(_0xbcfc('0x13'));var as=require(_0xbcfc('0x14'));var hardwareService=require(_0xbcfc('0x15'));var logger=require(_0xbcfc('0x16'))(_0xbcfc('0x17'));var utils=require(_0xbcfc('0x18'));var config=require(_0xbcfc('0x19'));var licenseUtil=require(_0xbcfc('0x1a'));var db=require(_0xbcfc('0x1b'))['db'];var dbH=require(_0xbcfc('0x1b'))['dbH'];function respondWithStatusCode(_0x32d260,_0x35511a){_0x35511a=_0x35511a||0xcc;return function(_0x4219f1){if(_0x4219f1){return _0x32d260['sendStatus'](_0x35511a);}return _0x32d260[_0xbcfc('0x1c')](_0x35511a)[_0xbcfc('0x1d')]();};}function respondWithResult(_0x27ba31,_0x6e2c68){_0x6e2c68=_0x6e2c68||0xc8;return function(_0x57baca){if(_0x57baca){return _0x27ba31[_0xbcfc('0x1c')](_0x6e2c68)[_0xbcfc('0x1e')](_0x57baca);}};}function respondWithFilteredResult(_0x4b8a0e,_0xcb19dd){return function(_0x319d90){if(_0x319d90){var _0x346555=typeof _0xcb19dd[_0xbcfc('0x1f')]===_0xbcfc('0x20')&&typeof _0xcb19dd[_0xbcfc('0x21')]===_0xbcfc('0x20');var _0x3c6b7a=_0x319d90[_0xbcfc('0x22')];var _0x5d80b8=_0x346555?0x0:_0xcb19dd[_0xbcfc('0x1f')];var _0x30997c=_0x346555?_0x319d90[_0xbcfc('0x22')]:_0xcb19dd[_0xbcfc('0x1f')]+_0xcb19dd[_0xbcfc('0x21')];var _0x1af8d4;if(_0x30997c>=_0x3c6b7a){_0x30997c=_0x3c6b7a;_0x1af8d4=0xc8;}else{_0x1af8d4=0xce;}_0x4b8a0e[_0xbcfc('0x1c')](_0x1af8d4);return _0x4b8a0e[_0xbcfc('0x23')](_0xbcfc('0x24'),_0x5d80b8+'-'+_0x30997c+'/'+_0x3c6b7a)[_0xbcfc('0x1e')](_0x319d90);}return null;};}function patchUpdates(_0x473e81){return function(_0x11ab21){try{jsonpatch[_0xbcfc('0x25')](_0x11ab21,_0x473e81,!![]);}catch(_0x521ad0){return BPromise['reject'](_0x521ad0);}return _0x11ab21['save']();};}function saveUpdates(_0x11a2b0,_0x126e35){return function(_0x555b14){if(_0x555b14){return _0x555b14['update'](_0x11a2b0)['then'](function(_0x12ec39){return _0x12ec39;});}return null;};}function removeEntity(_0xc1b55b,_0x334dae){return function(_0xb57db4){if(_0xb57db4){return _0xb57db4['destroy']()[_0xbcfc('0x26')](function(){var _0x49ec58=_0xb57db4[_0xbcfc('0x27')]({'plain':!![]});var _0x332229=_0xbcfc('0x28');return db[_0xbcfc('0x29')][_0xbcfc('0x2a')]({'where':{'type':_0x332229,'resourceId':_0x49ec58['id']}})[_0xbcfc('0x26')](function(){return _0xb57db4;});})[_0xbcfc('0x26')](function(){_0xc1b55b[_0xbcfc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ac48,_0x4deba6){return function(_0x2ae5b5){if(!_0x2ae5b5){_0x32ac48['sendStatus'](0x194);}return _0x2ae5b5;};}function handleError(_0x49b9d4,_0x4faf1c){_0x4faf1c=_0x4faf1c||0x1f4;return function(_0x1bbffd){logger['error'](_0x1bbffd[_0xbcfc('0x2b')]);if(_0x1bbffd['name']){delete _0x1bbffd[_0xbcfc('0x2c')];}_0x49b9d4[_0xbcfc('0x1c')](_0x4faf1c)['send'](_0x1bbffd);};}exports['index']=function(_0x3c2061,_0x5b7ed6){var _0x464309={},_0x36e897={},_0x3e6e70={'count':0x0,'rows':[]};var _0x517a71=_[_0xbcfc('0x2d')](db[_0xbcfc('0x2e')]['rawAttributes'],function(_0x303808){return{'name':_0x303808[_0xbcfc('0x2f')],'type':_0x303808['type']['key']};});_0x36e897[_0xbcfc('0x30')]=_['map'](_0x517a71,_0xbcfc('0x2c'));_0x36e897[_0xbcfc('0x31')]=_[_0xbcfc('0x32')](_0x3c2061['query']);_0x36e897['filters']=_['intersection'](_0x36e897[_0xbcfc('0x30')],_0x36e897[_0xbcfc('0x31')]);_0x464309[_0xbcfc('0x33')]=_[_0xbcfc('0x34')](_0x36e897['model'],qs['fields'](_0x3c2061['query']['fields']));_0x464309[_0xbcfc('0x33')]=_0x464309['attributes'][_0xbcfc('0x35')]?_0x464309['attributes']:_0x36e897[_0xbcfc('0x30')];if(!_0x3c2061[_0xbcfc('0x31')][_0xbcfc('0x36')]('nolimit')){_0x464309['limit']=qs[_0xbcfc('0x21')](_0x3c2061[_0xbcfc('0x31')]['limit']);_0x464309['offset']=qs[_0xbcfc('0x1f')](_0x3c2061[_0xbcfc('0x31')][_0xbcfc('0x1f')]);}_0x464309[_0xbcfc('0x37')]=qs[_0xbcfc('0x38')](_0x3c2061[_0xbcfc('0x31')][_0xbcfc('0x38')]);_0x464309[_0xbcfc('0x39')]=qs[_0xbcfc('0x3a')](_[_0xbcfc('0x3b')](_0x3c2061['query'],_0x36e897['filters']),_0x517a71);if(_0x3c2061[_0xbcfc('0x31')][_0xbcfc('0x3c')]){_0x464309[_0xbcfc('0x39')]=_[_0xbcfc('0x3d')](_0x464309[_0xbcfc('0x39')],{'$or':_[_0xbcfc('0x2d')](_0x517a71,function(_0x461314){if(_0x461314[_0xbcfc('0x3e')]!==_0xbcfc('0x3f')){var _0x44fce9={};_0x44fce9[_0x461314[_0xbcfc('0x2c')]]={'$like':'%'+_0x3c2061['query'][_0xbcfc('0x3c')]+'%'};return _0x44fce9;}})});}_0x464309=_[_0xbcfc('0x3d')]({},_0x464309,_0x3c2061[_0xbcfc('0x40')]);var _0x18bdaa={'where':_0x464309[_0xbcfc('0x39')]};return db[_0xbcfc('0x2e')][_0xbcfc('0x22')](_0x18bdaa)[_0xbcfc('0x26')](function(_0x496759){_0x3e6e70[_0xbcfc('0x22')]=_0x496759;if(_0x3c2061[_0xbcfc('0x31')][_0xbcfc('0x41')]){_0x464309[_0xbcfc('0x42')]=[{'all':!![]}];}return db[_0xbcfc('0x2e')][_0xbcfc('0x43')](_0x464309);})[_0xbcfc('0x26')](function(_0x44cc35){_0x3e6e70[_0xbcfc('0x44')]=_0x44cc35;return _0x3e6e70;})[_0xbcfc('0x26')](respondWithFilteredResult(_0x5b7ed6,_0x464309))['catch'](handleError(_0x5b7ed6,null));};exports['show']=function(_0x3f54c7,_0x57afd8){var _0x359e3b={'raw':![],'where':{'id':_0x3f54c7[_0xbcfc('0x45')]['id']}},_0x13d823={};_0x13d823[_0xbcfc('0x30')]=_[_0xbcfc('0x32')](db[_0xbcfc('0x2e')][_0xbcfc('0x46')]);_0x13d823['query']=_['keys'](_0x3f54c7[_0xbcfc('0x31')]);_0x13d823[_0xbcfc('0x3a')]=_['intersection'](_0x13d823['model'],_0x13d823['query']);_0x359e3b[_0xbcfc('0x33')]=_[_0xbcfc('0x34')](_0x13d823[_0xbcfc('0x30')],qs[_0xbcfc('0x47')](_0x3f54c7[_0xbcfc('0x31')][_0xbcfc('0x47')]));_0x359e3b[_0xbcfc('0x33')]=_0x359e3b[_0xbcfc('0x33')][_0xbcfc('0x35')]?_0x359e3b[_0xbcfc('0x33')]:_0x13d823[_0xbcfc('0x30')];if(_0x3f54c7[_0xbcfc('0x31')][_0xbcfc('0x41')]){_0x359e3b[_0xbcfc('0x42')]=[{'all':!![]}];}_0x359e3b=_['merge']({},_0x359e3b,_0x3f54c7[_0xbcfc('0x40')]);return db['AnalyticCustomReport'][_0xbcfc('0x48')](_0x359e3b)[_0xbcfc('0x26')](handleEntityNotFound(_0x57afd8,null))['then'](respondWithResult(_0x57afd8,null))['catch'](handleError(_0x57afd8,null));};exports[_0xbcfc('0x49')]=function(_0x2a5d1d,_0x296cc8){return db[_0xbcfc('0x2e')][_0xbcfc('0x49')](_0x2a5d1d['body'],{})['then'](function(_0x458def){var _0x4093c1=_0x2a5d1d['user'][_0xbcfc('0x27')]({'plain':!![]});if(!_0x4093c1)throw new Error(_0xbcfc('0x4a'));if(_0x4093c1[_0xbcfc('0x4b')]===_0xbcfc('0x4c')){var _0x56dfa2=_0x458def['get']({'plain':!![]});var _0x37902b='Reports';return db[_0xbcfc('0x4d')][_0xbcfc('0x48')]({'where':{'name':_0x37902b,'userProfileId':_0x4093c1['userProfileId']},'raw':!![]})[_0xbcfc('0x26')](function(_0x35987f){if(_0x35987f&&_0x35987f['autoAssociation']===0x0){return db[_0xbcfc('0x29')][_0xbcfc('0x49')]({'name':_0x56dfa2[_0xbcfc('0x2c')],'resourceId':_0x56dfa2['id'],'type':_0xbcfc('0x28'),'sectionId':_0x35987f['id']},{})['then'](function(){return _0x458def;});}else{return _0x458def;}})[_0xbcfc('0x4e')](function(_0x211c9f){logger['error'](_0xbcfc('0x4f'),_0x211c9f);throw _0x211c9f;});}return _0x458def;})[_0xbcfc('0x26')](respondWithResult(_0x296cc8,0xc9))['catch'](handleError(_0x296cc8,null));};exports[_0xbcfc('0x50')]=function(_0x3a816c,_0x151a4b){if(_0x3a816c[_0xbcfc('0x51')]['id']){delete _0x3a816c[_0xbcfc('0x51')]['id'];}return db[_0xbcfc('0x2e')][_0xbcfc('0x48')]({'where':{'id':_0x3a816c['params']['id']}})[_0xbcfc('0x26')](handleEntityNotFound(_0x151a4b,null))[_0xbcfc('0x26')](saveUpdates(_0x3a816c['body'],null))[_0xbcfc('0x26')](respondWithResult(_0x151a4b,null))[_0xbcfc('0x4e')](handleError(_0x151a4b,null));};exports[_0xbcfc('0x2a')]=function(_0x413483,_0xbe3ee3){return db[_0xbcfc('0x2e')][_0xbcfc('0x48')]({'where':{'id':_0x413483[_0xbcfc('0x45')]['id']}})[_0xbcfc('0x26')](handleEntityNotFound(_0xbe3ee3,null))[_0xbcfc('0x26')](removeEntity(_0xbe3ee3,null))[_0xbcfc('0x4e')](handleError(_0xbe3ee3,null));};exports[_0xbcfc('0x52')]=function(_0x48fb8f,_0x412dc0){var _0xfab25d=0xa;var _0x364036=[_0xbcfc('0x53'),_0xbcfc('0x54'),'right_join',_0xbcfc('0x55')];var _0x5d89c9={'SUM':_0xbcfc('0x56'),'COUNT':_0xbcfc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xbcfc('0x58'),'GROUP_CONCAT':_0xbcfc('0x59'),'GROUP_CONCAT ASC':_0xbcfc('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x213576={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbcfc('0x5b'),'HOUR':_0xbcfc('0x5c'),'ROUND':_0xbcfc('0x5d'),'UNIX_TIMESTAMP':_0xbcfc('0x5e')};var _0xeeb5eb=function(_0x4b6d11){return!_['includes']([_0xbcfc('0x5f'),_0xbcfc('0x60'),_0xbcfc('0x61'),'IS\x20NOT\x20EMPTY'],_0x4b6d11);};var _0x51ea89=function(_0x282460){if(!_0x282460||!_0x282460['rules']['length']){return'';}for(var _0x5bb98c='(',_0x5f08ab=0x0;_0x5f08ab<_0x282460['rules'][_0xbcfc('0x35')];_0x5f08ab+=0x1){_0x5f08ab>0x0&&(_0x5bb98c+='\x20'+_0x282460[_0xbcfc('0x62')]+'\x20');_0x5bb98c+=_0x282460[_0xbcfc('0x63')][_0x5f08ab][_0xbcfc('0x64')]?_0x51ea89(_0x282460[_0xbcfc('0x63')][_0x5f08ab][_0xbcfc('0x64')]):_0x282460[_0xbcfc('0x63')][_0x5f08ab][_0xbcfc('0x65')]+'\x20'+_0x282460['rules'][_0x5f08ab]['condition']+(_0xeeb5eb(_0x282460[_0xbcfc('0x63')][_0x5f08ab][_0xbcfc('0x66')])?'\x20'+_0x282460[_0xbcfc('0x63')][_0x5f08ab][_0xbcfc('0x67')]:'');}return _0x5bb98c+')';};var _0xe2d6b={'where':{'id':_0x48fb8f[_0xbcfc('0x45')]['id']}},_0x28e5fc,_0x56ad92,_0x4cb7dc,_0x31633e,_0x35863a;_0xe2d6b=_[_0xbcfc('0x3d')]({},_0xe2d6b,_0x48fb8f[_0xbcfc('0x40')]);return db[_0xbcfc('0x2e')][_0xbcfc('0x48')](_0xe2d6b)[_0xbcfc('0x26')](function(_0x2c754c){if(_0x2c754c){_0x28e5fc=_0x2c754c;return _0x2c754c[_0xbcfc('0x68')]();}return null;})[_0xbcfc('0x26')](function(_0x4f64d9){if(_0x4f64d9){if(!_0x4f64d9[_0xbcfc('0x35')]){throw new db[(_0xbcfc('0x69'))]['ValidationErrorItem'](_0xbcfc('0x6a'),0x193);}_0x56ad92=_0x4f64d9;return db[_0xbcfc('0x6b')][_0xbcfc('0x43')]({'raw':!![]});}return null;})[_0xbcfc('0x26')](function(_0x1b5eca){if(_0x1b5eca){_0x4cb7dc=_[_0xbcfc('0x6c')](_0x1b5eca,'id');var _0x580c43;var _0x564ebc=squel[_0xbcfc('0x6d')]();_0x564ebc['from'](_0x28e5fc[_0xbcfc('0x6e')]);for(var _0xf41b2e=0x0;_0xf41b2e<_0x56ad92[_0xbcfc('0x35')];_0xf41b2e+=0x1){_0x580c43=_0x56ad92[_0xf41b2e][_0xbcfc('0x6f')]?_0x4cb7dc[_0x56ad92[_0xf41b2e][_0xbcfc('0x6f')]]['metric']:_0x56ad92[_0xf41b2e][_0xbcfc('0x65')];_0x580c43=_0x56ad92[_0xf41b2e]['function']?_[_0xbcfc('0x70')](_0x5d89c9[_0x56ad92[_0xf41b2e][_0xbcfc('0x71')]],'%s',_0x580c43):_0x580c43;_0x580c43=_0x56ad92[_0xf41b2e][_0xbcfc('0x72')]?_[_0xbcfc('0x70')](_0x213576[_0x56ad92[_0xf41b2e]['format']],'%s',_0x580c43):_0x580c43;if(_0x56ad92[_0xf41b2e]['groupBy']){_0x564ebc[_0xbcfc('0x64')](_0x580c43);}_0x56ad92[_0xf41b2e][_0xbcfc('0x73')]&&_0x564ebc[_0xbcfc('0x37')](_0x580c43,_0x56ad92[_0xf41b2e]['orderBy']===_0xbcfc('0x74')?![]:!![]);_0x564ebc[_0xbcfc('0x65')](_0x580c43,_0x56ad92[_0xf41b2e][_0xbcfc('0x75')]||_0x580c43);}if(_0x28e5fc[_0xbcfc('0x76')]){_0x28e5fc['joins']=JSON[_0xbcfc('0x77')](_0x28e5fc[_0xbcfc('0x76')]);for(var _0x16b1de=0x0;_0x16b1de<_0x28e5fc['joins'][_0xbcfc('0x35')];_0x16b1de+=0x1){if(_0x28e5fc[_0xbcfc('0x76')][_0x16b1de][_0xbcfc('0x3e')]&&_[_0xbcfc('0x78')](_0x364036,_0x28e5fc[_0xbcfc('0x76')][_0x16b1de][_0xbcfc('0x3e')])&&_0x28e5fc['joins'][_0x16b1de][_0xbcfc('0x79')]&&_0x28e5fc[_0xbcfc('0x76')][_0x16b1de][_0xbcfc('0x7a')]&&_0x28e5fc[_0xbcfc('0x76')][_0x16b1de]['foreignKey']){_0x564ebc[_0x28e5fc[_0xbcfc('0x76')][_0x16b1de]['type']](_0x28e5fc[_0xbcfc('0x76')][_0x16b1de]['foreignTable'],null,util[_0xbcfc('0x72')](_0xbcfc('0x7b'),_0x28e5fc[_0xbcfc('0x6e')],_0x28e5fc[_0xbcfc('0x76')][_0x16b1de][_0xbcfc('0x79')],_0x28e5fc[_0xbcfc('0x76')][_0x16b1de][_0xbcfc('0x7a')],_0x28e5fc['joins'][_0x16b1de][_0xbcfc('0x7c')]));}}}if(_0x28e5fc[_0xbcfc('0x7d')]){_0x28e5fc[_0xbcfc('0x7d')]=JSON[_0xbcfc('0x77')](_0x28e5fc['conditions']);_0x564ebc[_0xbcfc('0x39')](_0x51ea89(_0x28e5fc[_0xbcfc('0x7d')][_0xbcfc('0x64')]));}_0x35863a=_0x564ebc[_0xbcfc('0x7e')]();_0x564ebc['limit'](_0xfab25d);_0x564ebc['offset'](0x0);logger[_0xbcfc('0x7f')]('Limited\x20Query:',_0x564ebc[_0xbcfc('0x80')]());return dbH['sequelize'][_0xbcfc('0x31')](_0x564ebc[_0xbcfc('0x80')](),{'type':dbH[_0xbcfc('0x81')][_0xbcfc('0x82')][_0xbcfc('0x83')]});}})[_0xbcfc('0x26')](respondWithResult(_0x412dc0,null))[_0xbcfc('0x4e')](handleError(_0x412dc0,null));};function runReport(_0x2632f3,_0x210aa6,_0xbf0c8c){var _0x1060b2=_0x210aa6['name'];var _0x53a7d7=0xa;var _0xa3c639=[_0xbcfc('0x53'),_0xbcfc('0x54'),_0xbcfc('0x84'),'cross_join'];var _0x301de5={'SUM':_0xbcfc('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xbcfc('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbcfc('0x5a'),'GROUP_CONCAT DESC':_0xbcfc('0x85')};var _0xd0787f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbcfc('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xbcfc('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1acc69=function(_0x3a685f){return!_[_0xbcfc('0x78')]([_0xbcfc('0x5f'),_0xbcfc('0x60'),_0xbcfc('0x61'),'IS\x20NOT\x20EMPTY'],_0x3a685f);};var _0x19e8ef=function(_0x24fa11){if(!_0x24fa11||!_0x24fa11['rules'][_0xbcfc('0x35')]){return'';}for(var _0x4fcd6d='(',_0x40644a=0x0;_0x40644a<_0x24fa11[_0xbcfc('0x63')][_0xbcfc('0x35')];_0x40644a+=0x1){_0x40644a>0x0&&(_0x4fcd6d+='\x20'+_0x24fa11[_0xbcfc('0x62')]+'\x20');_0x4fcd6d+=_0x24fa11['rules'][_0x40644a]['group']?_0x19e8ef(_0x24fa11[_0xbcfc('0x63')][_0x40644a][_0xbcfc('0x64')]):_0x24fa11[_0xbcfc('0x63')][_0x40644a][_0xbcfc('0x65')]+'\x20'+_0x24fa11['rules'][_0x40644a][_0xbcfc('0x66')]+(_0x1acc69(_0x24fa11['rules'][_0x40644a][_0xbcfc('0x66')])?'\x20'+_0x24fa11[_0xbcfc('0x63')][_0x40644a][_0xbcfc('0x67')]:'');}return _0x4fcd6d+')';};var _0x14cb47={'where':{'id':_0x2632f3['id']}},_0x1a86e7,_0xb744f1,_0x44be96,_0x4255c4,_0x33521f;_0x14cb47=_[_0xbcfc('0x3d')]({},_0x14cb47,_0xbf0c8c);return db[_0xbcfc('0x2e')]['find'](_0x14cb47)[_0xbcfc('0x26')](function(_0x38ea37){if(_0x38ea37){_0x1a86e7=_0x38ea37;return _0x38ea37['getFields']();}return null;})[_0xbcfc('0x26')](function(_0x517aaa){if(_0x517aaa){if(!_0x517aaa[_0xbcfc('0x35')]){throw new db[(_0xbcfc('0x69'))][(_0xbcfc('0x86'))](_0xbcfc('0x6a'),0x193);}_0xb744f1=_0x517aaa;return db[_0xbcfc('0x6b')][_0xbcfc('0x43')]({'raw':!![]});}return null;})[_0xbcfc('0x26')](function(_0x39d47c){if(_0x39d47c){_0x44be96=_[_0xbcfc('0x6c')](_0x39d47c,'id');var _0x51cc13;var _0x46a37e=squel[_0xbcfc('0x6d')]();_0x46a37e[_0xbcfc('0x87')](_0x1a86e7['table']);for(var _0x18472d=0x0;_0x18472d<_0xb744f1[_0xbcfc('0x35')];_0x18472d+=0x1){_0x51cc13=_0xb744f1[_0x18472d][_0xbcfc('0x6f')]?_0x44be96[_0xb744f1[_0x18472d][_0xbcfc('0x6f')]][_0xbcfc('0x88')]:_0xb744f1[_0x18472d][_0xbcfc('0x65')];_0x51cc13=_0xb744f1[_0x18472d][_0xbcfc('0x71')]?_[_0xbcfc('0x70')](_0x301de5[_0xb744f1[_0x18472d][_0xbcfc('0x71')]],'%s',_0x51cc13):_0x51cc13;_0x51cc13=_0xb744f1[_0x18472d][_0xbcfc('0x72')]?_[_0xbcfc('0x70')](_0xd0787f[_0xb744f1[_0x18472d][_0xbcfc('0x72')]],'%s',_0x51cc13):_0x51cc13;if(_0xb744f1[_0x18472d][_0xbcfc('0x89')]){_0x46a37e[_0xbcfc('0x64')](_0x51cc13);}_0xb744f1[_0x18472d][_0xbcfc('0x73')]&&_0x46a37e[_0xbcfc('0x37')](_0x51cc13,_0xb744f1[_0x18472d][_0xbcfc('0x73')]===_0xbcfc('0x74')?![]:!![]);_0x46a37e['field'](_0x51cc13,_0xb744f1[_0x18472d][_0xbcfc('0x75')]||_0x51cc13);}if(_0x1a86e7[_0xbcfc('0x76')]){_0x1a86e7[_0xbcfc('0x76')]=JSON[_0xbcfc('0x77')](_0x1a86e7['joins']);for(var _0x2786e9=0x0;_0x2786e9<_0x1a86e7[_0xbcfc('0x76')][_0xbcfc('0x35')];_0x2786e9+=0x1){if(_0x1a86e7['joins'][_0x2786e9][_0xbcfc('0x3e')]&&_[_0xbcfc('0x78')](_0xa3c639,_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x3e')])&&_0x1a86e7['joins'][_0x2786e9]['parentKey']&&_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x7a')]&&_0x1a86e7['joins'][_0x2786e9][_0xbcfc('0x7c')]){_0x46a37e[_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x3e')]](_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x7a')],null,util[_0xbcfc('0x72')](_0xbcfc('0x7b'),_0x1a86e7[_0xbcfc('0x6e')],_0x1a86e7['joins'][_0x2786e9][_0xbcfc('0x79')],_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x7a')],_0x1a86e7[_0xbcfc('0x76')][_0x2786e9][_0xbcfc('0x7c')]));}}}if(_0x1a86e7[_0xbcfc('0x7d')]){_0x1a86e7[_0xbcfc('0x7d')]=JSON[_0xbcfc('0x77')](_0x1a86e7[_0xbcfc('0x7d')]);_0x46a37e[_0xbcfc('0x39')](_0x19e8ef(_0x1a86e7['conditions']['group']));}_0x33521f=_0x46a37e[_0xbcfc('0x7e')]();_0x46a37e[_0xbcfc('0x21')](_0x53a7d7);_0x46a37e[_0xbcfc('0x1f')](0x0);return;}})[_0xbcfc('0x26')](function(){if(_0x210aa6[_0xbcfc('0x8a')]===_0xbcfc('0x8b')){return null;}var _0x33bf35=_['merge'](_0x210aa6,{'name':_0x210aa6[_0xbcfc('0x8c')]||_0x210aa6[_0xbcfc('0x2c')]||_0x1a86e7[_0xbcfc('0x2c')],'basename':_0x1060b2,'savename':util[_0xbcfc('0x72')]('%s-%s.%s',_0x210aa6[_0xbcfc('0x2c')]||_0x1a86e7[_0xbcfc('0x2c')],require(_0xbcfc('0x8d'))['generate'](0x4),_0x210aa6[_0xbcfc('0x8a')]||_0xbcfc('0x8e')),'reportId':_0x1a86e7['id'],'reportType':_0xbcfc('0x8f')});return db[_0xbcfc('0x90')]['create'](_0x33bf35,{'raw':!![]});})[_0xbcfc('0x26')](function(_0x28a1dd){if(_0x1a86e7[_0xbcfc('0x6e')]===_0xbcfc('0x91')){_0x33521f[_0xbcfc('0x39')](_0x1a86e7[_0xbcfc('0x6e')]+_0xbcfc('0x92'),_0x210aa6[_0xbcfc('0x93')],_0x210aa6['endDate']);}else{_0x33521f[_0xbcfc('0x39')](_0x1a86e7[_0xbcfc('0x6e')]+_0xbcfc('0x94'),_0x210aa6['startDate'],_0x210aa6['endDate']);}if(_0x28a1dd){logger['info'](_0xbcfc('0x95'),_0x33521f['toString']());require(_0xbcfc('0x96'))['fork'](path[_0xbcfc('0x53')](__dirname,_0xbcfc('0x97'),_0x28a1dd['output']),[_0x28a1dd['id'],_0x33521f[_0xbcfc('0x80')](),path[_0xbcfc('0x53')](__dirname,_0xbcfc('0x98'),_0x28a1dd['savename']),_0x1060b2]);return _0x28a1dd;}else{var _0x4bd85a=squel[_0xbcfc('0x6d')]();_0x4bd85a['from']('('+_0x33521f[_0xbcfc('0x80')]()+')',_0xbcfc('0x99'));_0x4bd85a[_0xbcfc('0x65')]('COUNT(*)',_0xbcfc('0x22'));_0x33521f[_0xbcfc('0x21')](_0x210aa6['limit']||_0x53a7d7);_0x33521f[_0xbcfc('0x1f')](_0x210aa6[_0xbcfc('0x1f')]||0x0);return dbH['sequelize'][_0xbcfc('0x31')](_0x4bd85a[_0xbcfc('0x80')](),{'type':dbH['sequelize'][_0xbcfc('0x82')][_0xbcfc('0x83')]})[_0xbcfc('0x26')](function(_0x297669){if(!_0x297669[_0xbcfc('0x35')]){_0x4255c4=0x0;}else{_0x4255c4=_0x297669[0x0][_0xbcfc('0x22')]||0x0;}return dbH[_0xbcfc('0x81')][_0xbcfc('0x31')](_0x33521f[_0xbcfc('0x80')](),{'type':dbH[_0xbcfc('0x81')][_0xbcfc('0x82')][_0xbcfc('0x83')]});})[_0xbcfc('0x26')](function(_0x587fcb){return{'rows':_0x587fcb||[],'count':_0x4255c4};});}});}exports[_0xbcfc('0x9a')]=function(_0x5658ff,_0xd92d37){return runReport(_0x5658ff['params'],_0x5658ff[_0xbcfc('0x31')],_0x5658ff[_0xbcfc('0x40')])[_0xbcfc('0x26')](respondWithResult(_0xd92d37,null))[_0xbcfc('0x4e')](handleError(_0xd92d37,null));};exports['runReport']=runReport;exports[_0xbcfc('0x31')]=function(_0x347606,_0x2eabe4){var _0x5ddd60=0xa;var _0x3e7d8f=[_0xbcfc('0x53'),_0xbcfc('0x54'),'right_join','cross_join'];var _0x5a89ea={'SUM':_0xbcfc('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbcfc('0x9b'),'MAX':'MAX(%s)','MIN':_0xbcfc('0x9c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbcfc('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5edba5={'SEC_TO_TIME':_0xbcfc('0x9d'),'DATE':'DATE(%s)','HOUR':_0xbcfc('0x5c'),'ROUND':_0xbcfc('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4fc773=function(_0x3de9a0){return!_[_0xbcfc('0x78')](['IS\x20NULL',_0xbcfc('0x60'),_0xbcfc('0x61'),_0xbcfc('0x9e')],_0x3de9a0);};var _0x1ddda5=function(_0x304f67){if(!_0x304f67||!_0x304f67[_0xbcfc('0x63')][_0xbcfc('0x35')]){return'';}for(var _0x1348f3='(',_0x85641d=0x0;_0x85641d<_0x304f67[_0xbcfc('0x63')][_0xbcfc('0x35')];_0x85641d+=0x1){_0x85641d>0x0&&(_0x1348f3+='\x20'+_0x304f67[_0xbcfc('0x62')]+'\x20');_0x1348f3+=_0x304f67[_0xbcfc('0x63')][_0x85641d][_0xbcfc('0x64')]?_0x1ddda5(_0x304f67[_0xbcfc('0x63')][_0x85641d]['group']):_0x304f67[_0xbcfc('0x63')][_0x85641d][_0xbcfc('0x65')]+'\x20'+_0x304f67[_0xbcfc('0x63')][_0x85641d][_0xbcfc('0x66')]+(_0x4fc773(_0x304f67['rules'][_0x85641d][_0xbcfc('0x66')])?'\x20'+_0x304f67['rules'][_0x85641d]['value']:'');}return _0x1348f3+')';};var _0x1e3636={'where':{'id':_0x347606[_0xbcfc('0x45')]['id']}},_0xe2f605,_0x2ba7ad,_0x3c2517,_0x250b4c,_0x3cdef1;_0x1e3636=_[_0xbcfc('0x3d')]({},_0x1e3636,_0x347606[_0xbcfc('0x40')]);return db[_0xbcfc('0x2e')][_0xbcfc('0x48')](_0x1e3636)[_0xbcfc('0x26')](function(_0x4c91d6){if(_0x4c91d6){_0xe2f605=_0x4c91d6;return _0x4c91d6[_0xbcfc('0x68')]();}return null;})['then'](function(_0x4fda2d){if(_0x4fda2d){if(!_0x4fda2d['length']){throw new db[(_0xbcfc('0x69'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ba7ad=_0x4fda2d;return db[_0xbcfc('0x6b')][_0xbcfc('0x43')]({'raw':!![]});}return null;})[_0xbcfc('0x26')](function(_0x586ee3){if(_0x586ee3){_0x3c2517=_[_0xbcfc('0x6c')](_0x586ee3,'id');var _0x1a46a3;var _0x3336fe=squel[_0xbcfc('0x6d')]();_0x3336fe[_0xbcfc('0x87')](_0xe2f605['table']);for(var _0x6d53e7=0x0;_0x6d53e7<_0x2ba7ad['length'];_0x6d53e7+=0x1){_0x1a46a3=_0x2ba7ad[_0x6d53e7]['MetricId']?_0x3c2517[_0x2ba7ad[_0x6d53e7][_0xbcfc('0x6f')]][_0xbcfc('0x88')]:_0x2ba7ad[_0x6d53e7][_0xbcfc('0x65')];_0x1a46a3=_0x2ba7ad[_0x6d53e7][_0xbcfc('0x71')]?_['replace'](_0x5a89ea[_0x2ba7ad[_0x6d53e7]['function']],'%s',_0x1a46a3):_0x1a46a3;_0x1a46a3=_0x2ba7ad[_0x6d53e7][_0xbcfc('0x72')]?_[_0xbcfc('0x70')](_0x5edba5[_0x2ba7ad[_0x6d53e7][_0xbcfc('0x72')]],'%s',_0x1a46a3):_0x1a46a3;if(_0x2ba7ad[_0x6d53e7]['groupBy']){_0x3336fe[_0xbcfc('0x64')](_0x1a46a3);}_0x2ba7ad[_0x6d53e7][_0xbcfc('0x73')]&&_0x3336fe[_0xbcfc('0x37')](_0x1a46a3,_0x2ba7ad[_0x6d53e7][_0xbcfc('0x73')]===_0xbcfc('0x74')?![]:!![]);_0x3336fe[_0xbcfc('0x65')](_0x1a46a3,_0x2ba7ad[_0x6d53e7]['alias']||_0x1a46a3);}if(_0xe2f605[_0xbcfc('0x76')]){_0xe2f605[_0xbcfc('0x76')]=JSON[_0xbcfc('0x77')](_0xe2f605[_0xbcfc('0x76')]);for(var _0x2b9b32=0x0;_0x2b9b32<_0xe2f605[_0xbcfc('0x76')]['length'];_0x2b9b32+=0x1){if(_0xe2f605[_0xbcfc('0x76')][_0x2b9b32]['type']&&_[_0xbcfc('0x78')](_0x3e7d8f,_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x3e')])&&_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x79')]&&_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x7a')]&&_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x7c')]){_0x3336fe[_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x3e')]](_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x7a')],null,util[_0xbcfc('0x72')](_0xbcfc('0x7b'),_0xe2f605['table'],_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x79')],_0xe2f605[_0xbcfc('0x76')][_0x2b9b32]['foreignTable'],_0xe2f605[_0xbcfc('0x76')][_0x2b9b32][_0xbcfc('0x7c')]));}}}if(_0xe2f605[_0xbcfc('0x7d')]){_0xe2f605['conditions']=JSON[_0xbcfc('0x77')](_0xe2f605['conditions']);_0x3336fe[_0xbcfc('0x39')](_0x1ddda5(_0xe2f605[_0xbcfc('0x7d')]['group']));}_0x3cdef1=_0x3336fe['clone']();_0x3336fe[_0xbcfc('0x21')](_0x5ddd60);_0x3336fe['offset'](0x0);logger[_0xbcfc('0x7f')](_0xbcfc('0x9f'),_0x3336fe[_0xbcfc('0x80')]());return dbH[_0xbcfc('0x81')][_0xbcfc('0x31')](_0x3336fe['toString'](),{'type':dbH[_0xbcfc('0x81')][_0xbcfc('0x82')]['SELECT']});}})[_0xbcfc('0x26')](function(){return{'sql':_0x3cdef1[_0xbcfc('0x80')]()};})[_0xbcfc('0x26')](respondWithResult(_0x2eabe4,null))[_0xbcfc('0x4e')](handleError(_0x2eabe4,null));}; \ No newline at end of file +var _0x44d4=['then','destroy','CustomReports','UserProfileResource','error','stack','map','AnalyticCustomReport','rawAttributes','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','options','include','findAll','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Reports','UserProfileSection','autoAssociation','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','field','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','SELECT','right_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','AnalyticMetric','MetricId','format','clone','output','web','fullPath','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','save','update'];(function(_0x279994,_0x582317){var _0x353d7a=function(_0x2c101f){while(--_0x2c101f){_0x279994['push'](_0x279994['shift']());}};_0x353d7a(++_0x582317);}(_0x44d4,0x7c));var _0x444d=function(_0xc2b3ce,_0x533dfd){_0xc2b3ce=_0xc2b3ce-0x0;var _0x30e6bb=_0x44d4[_0xc2b3ce];return _0x30e6bb;};'use strict';var emlformat=require(_0x444d('0x0'));var rimraf=require(_0x444d('0x1'));var zipdir=require(_0x444d('0x2'));var jsonpatch=require(_0x444d('0x3'));var rp=require(_0x444d('0x4'));var moment=require(_0x444d('0x5'));var BPromise=require(_0x444d('0x6'));var Mustache=require(_0x444d('0x7'));var util=require('util');var path=require(_0x444d('0x8'));var sox=require(_0x444d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x444d('0xa'));var _=require('lodash');var squel=require(_0x444d('0xb'));var crypto=require(_0x444d('0xc'));var jsforce=require(_0x444d('0xd'));var deskjs=require(_0x444d('0xe'));var toCsv=require(_0x444d('0xf'));var querystring=require(_0x444d('0x10'));var Papa=require(_0x444d('0x11'));var Redis=require(_0x444d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x444d('0x13'));var hardwareService=require(_0x444d('0x14'));var logger=require(_0x444d('0x15'))(_0x444d('0x16'));var utils=require(_0x444d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x444d('0x18'));var db=require(_0x444d('0x19'))['db'];var dbH=require(_0x444d('0x19'))[_0x444d('0x1a')];function respondWithStatusCode(_0x4a2c3c,_0x43a01f){_0x43a01f=_0x43a01f||0xcc;return function(_0x3bae26){if(_0x3bae26){return _0x4a2c3c[_0x444d('0x1b')](_0x43a01f);}return _0x4a2c3c[_0x444d('0x1c')](_0x43a01f)[_0x444d('0x1d')]();};}function respondWithResult(_0x8e8e1e,_0x17bdc1){_0x17bdc1=_0x17bdc1||0xc8;return function(_0xe3c153){if(_0xe3c153){return _0x8e8e1e[_0x444d('0x1c')](_0x17bdc1)[_0x444d('0x1e')](_0xe3c153);}};}function respondWithFilteredResult(_0xb85618,_0x1c6c55){return function(_0x5c2192){if(_0x5c2192){var _0x29d6b3=typeof _0x1c6c55['offset']==='undefined'&&typeof _0x1c6c55[_0x444d('0x1f')]===_0x444d('0x20');var _0x5baa24=_0x5c2192[_0x444d('0x21')];var _0x5b3683=_0x29d6b3?0x0:_0x1c6c55['offset'];var _0x83b7a9=_0x29d6b3?_0x5c2192[_0x444d('0x21')]:_0x1c6c55['offset']+_0x1c6c55[_0x444d('0x1f')];var _0x1cf5a2;if(_0x83b7a9>=_0x5baa24){_0x83b7a9=_0x5baa24;_0x1cf5a2=0xc8;}else{_0x1cf5a2=0xce;}_0xb85618[_0x444d('0x1c')](_0x1cf5a2);return _0xb85618['set'](_0x444d('0x22'),_0x5b3683+'-'+_0x83b7a9+'/'+_0x5baa24)[_0x444d('0x1e')](_0x5c2192);}return null;};}function patchUpdates(_0x521dc2){return function(_0x57a3b5){try{jsonpatch[_0x444d('0x23')](_0x57a3b5,_0x521dc2,!![]);}catch(_0x1b9c5e){return BPromise[_0x444d('0x24')](_0x1b9c5e);}return _0x57a3b5[_0x444d('0x25')]();};}function saveUpdates(_0x52e33e,_0x177b57){return function(_0x1976d3){if(_0x1976d3){return _0x1976d3[_0x444d('0x26')](_0x52e33e)[_0x444d('0x27')](function(_0x18885f){return _0x18885f;});}return null;};}function removeEntity(_0x3127d6,_0x3cb14b){return function(_0x34502e){if(_0x34502e){return _0x34502e[_0x444d('0x28')]()[_0x444d('0x27')](function(){var _0x206c44=_0x34502e['get']({'plain':!![]});var _0x4c7898=_0x444d('0x29');return db[_0x444d('0x2a')][_0x444d('0x28')]({'where':{'type':_0x4c7898,'resourceId':_0x206c44['id']}})[_0x444d('0x27')](function(){return _0x34502e;});})['then'](function(){_0x3127d6[_0x444d('0x1c')](0xcc)[_0x444d('0x1d')]();});}};}function handleEntityNotFound(_0x1589a2,_0xe7fd54){return function(_0x17ad90){if(!_0x17ad90){_0x1589a2[_0x444d('0x1b')](0x194);}return _0x17ad90;};}function handleError(_0x52636c,_0x42106f){_0x42106f=_0x42106f||0x1f4;return function(_0x4a3d32){logger[_0x444d('0x2b')](_0x4a3d32[_0x444d('0x2c')]);if(_0x4a3d32['name']){delete _0x4a3d32['name'];}_0x52636c[_0x444d('0x1c')](_0x42106f)['send'](_0x4a3d32);};}exports['index']=function(_0x41f8f8,_0x46a2c1){var _0x23497c={},_0x5f5691={},_0x16e1f0={'count':0x0,'rows':[]};var _0x1a9d94=_[_0x444d('0x2d')](db[_0x444d('0x2e')][_0x444d('0x2f')],function(_0x46729c){return{'name':_0x46729c['fieldName'],'type':_0x46729c[_0x444d('0x30')][_0x444d('0x31')]};});_0x5f5691['model']=_['map'](_0x1a9d94,_0x444d('0x32'));_0x5f5691[_0x444d('0x33')]=_[_0x444d('0x34')](_0x41f8f8[_0x444d('0x33')]);_0x5f5691[_0x444d('0x35')]=_['intersection'](_0x5f5691[_0x444d('0x36')],_0x5f5691['query']);_0x23497c[_0x444d('0x37')]=_[_0x444d('0x38')](_0x5f5691[_0x444d('0x36')],qs['fields'](_0x41f8f8[_0x444d('0x33')][_0x444d('0x39')]));_0x23497c['attributes']=_0x23497c[_0x444d('0x37')][_0x444d('0x3a')]?_0x23497c[_0x444d('0x37')]:_0x5f5691[_0x444d('0x36')];if(!_0x41f8f8[_0x444d('0x33')][_0x444d('0x3b')](_0x444d('0x3c'))){_0x23497c[_0x444d('0x1f')]=qs[_0x444d('0x1f')](_0x41f8f8[_0x444d('0x33')][_0x444d('0x1f')]);_0x23497c['offset']=qs[_0x444d('0x3d')](_0x41f8f8[_0x444d('0x33')][_0x444d('0x3d')]);}_0x23497c[_0x444d('0x3e')]=qs['sort'](_0x41f8f8[_0x444d('0x33')]['sort']);_0x23497c[_0x444d('0x3f')]=qs['filters'](_[_0x444d('0x40')](_0x41f8f8[_0x444d('0x33')],_0x5f5691['filters']),_0x1a9d94);if(_0x41f8f8[_0x444d('0x33')][_0x444d('0x41')]){_0x23497c[_0x444d('0x3f')]=_[_0x444d('0x42')](_0x23497c[_0x444d('0x3f')],{'$or':_[_0x444d('0x2d')](_0x1a9d94,function(_0x7c86c9){if(_0x7c86c9[_0x444d('0x30')]!=='VIRTUAL'){var _0x26e792={};_0x26e792[_0x7c86c9[_0x444d('0x32')]]={'$like':'%'+_0x41f8f8[_0x444d('0x33')][_0x444d('0x41')]+'%'};return _0x26e792;}})});}_0x23497c=_[_0x444d('0x42')]({},_0x23497c,_0x41f8f8[_0x444d('0x43')]);var _0x56c34f={'where':_0x23497c[_0x444d('0x3f')]};return db[_0x444d('0x2e')][_0x444d('0x21')](_0x56c34f)[_0x444d('0x27')](function(_0xdbbdde){_0x16e1f0[_0x444d('0x21')]=_0xdbbdde;if(_0x41f8f8[_0x444d('0x33')]['includeAll']){_0x23497c[_0x444d('0x44')]=[{'all':!![]}];}return db[_0x444d('0x2e')][_0x444d('0x45')](_0x23497c);})[_0x444d('0x27')](function(_0x4d1c8c){_0x16e1f0['rows']=_0x4d1c8c;return _0x16e1f0;})['then'](respondWithFilteredResult(_0x46a2c1,_0x23497c))[_0x444d('0x46')](handleError(_0x46a2c1,null));};exports['show']=function(_0x44f6d1,_0x1dbda9){var _0x157f7c={'raw':![],'where':{'id':_0x44f6d1[_0x444d('0x47')]['id']}},_0x2753b9={};_0x2753b9[_0x444d('0x36')]=_[_0x444d('0x34')](db['AnalyticCustomReport']['rawAttributes']);_0x2753b9[_0x444d('0x33')]=_[_0x444d('0x34')](_0x44f6d1[_0x444d('0x33')]);_0x2753b9[_0x444d('0x35')]=_[_0x444d('0x38')](_0x2753b9['model'],_0x2753b9[_0x444d('0x33')]);_0x157f7c[_0x444d('0x37')]=_[_0x444d('0x38')](_0x2753b9[_0x444d('0x36')],qs[_0x444d('0x39')](_0x44f6d1[_0x444d('0x33')][_0x444d('0x39')]));_0x157f7c[_0x444d('0x37')]=_0x157f7c[_0x444d('0x37')]['length']?_0x157f7c[_0x444d('0x37')]:_0x2753b9[_0x444d('0x36')];if(_0x44f6d1[_0x444d('0x33')][_0x444d('0x48')]){_0x157f7c[_0x444d('0x44')]=[{'all':!![]}];}_0x157f7c=_['merge']({},_0x157f7c,_0x44f6d1['options']);return db['AnalyticCustomReport'][_0x444d('0x49')](_0x157f7c)[_0x444d('0x27')](handleEntityNotFound(_0x1dbda9,null))[_0x444d('0x27')](respondWithResult(_0x1dbda9,null))['catch'](handleError(_0x1dbda9,null));};exports[_0x444d('0x4a')]=function(_0x54b0f4,_0x13c04e){return db[_0x444d('0x2e')]['create'](_0x54b0f4[_0x444d('0x4b')],{})[_0x444d('0x27')](function(_0x109930){var _0x24e3b8=_0x54b0f4[_0x444d('0x4c')]['get']({'plain':!![]});if(!_0x24e3b8)throw new Error(_0x444d('0x4d'));if(_0x24e3b8[_0x444d('0x4e')]===_0x444d('0x4c')){var _0x3718c7=_0x109930[_0x444d('0x4f')]({'plain':!![]});var _0x202475=_0x444d('0x50');return db[_0x444d('0x51')][_0x444d('0x49')]({'where':{'name':_0x202475,'userProfileId':_0x24e3b8['userProfileId']},'raw':!![]})['then'](function(_0x21ff13){if(_0x21ff13&&_0x21ff13[_0x444d('0x52')]===0x0){return db['UserProfileResource'][_0x444d('0x4a')]({'name':_0x3718c7['name'],'resourceId':_0x3718c7['id'],'type':'CustomReports','sectionId':_0x21ff13['id']},{})['then'](function(){return _0x109930;});}else{return _0x109930;}})['catch'](function(_0x3e201a){logger[_0x444d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e201a);throw _0x3e201a;});}return _0x109930;})[_0x444d('0x27')](respondWithResult(_0x13c04e,0xc9))[_0x444d('0x46')](handleError(_0x13c04e,null));};exports[_0x444d('0x26')]=function(_0x43a494,_0x134663){if(_0x43a494['body']['id']){delete _0x43a494['body']['id'];}return db[_0x444d('0x2e')]['find']({'where':{'id':_0x43a494[_0x444d('0x47')]['id']}})[_0x444d('0x27')](handleEntityNotFound(_0x134663,null))[_0x444d('0x27')](saveUpdates(_0x43a494[_0x444d('0x4b')],null))['then'](respondWithResult(_0x134663,null))[_0x444d('0x46')](handleError(_0x134663,null));};exports[_0x444d('0x28')]=function(_0x4fef04,_0x29efd7){return db['AnalyticCustomReport'][_0x444d('0x49')]({'where':{'id':_0x4fef04[_0x444d('0x47')]['id']}})['then'](handleEntityNotFound(_0x29efd7,null))[_0x444d('0x27')](removeEntity(_0x29efd7,null))['catch'](handleError(_0x29efd7,null));};exports[_0x444d('0x53')]=function(_0x573f56,_0x434076){var _0x26b3be=0xa;var _0x152526=[_0x444d('0x54'),_0x444d('0x55'),'right_join',_0x444d('0x56')];var _0x38b718={'SUM':_0x444d('0x57'),'COUNT':_0x444d('0x58'),'COUNT DISTINCT':_0x444d('0x59'),'MAX':'MAX(%s)','MIN':_0x444d('0x5a'),'AVG':_0x444d('0x5b'),'GROUP_CONCAT':_0x444d('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x528dd={'SEC_TO_TIME':_0x444d('0x5d'),'DATE':_0x444d('0x5e'),'HOUR':_0x444d('0x5f'),'ROUND':_0x444d('0x60'),'UNIX_TIMESTAMP':_0x444d('0x61')};var _0x25aa30=function(_0x28b24c){return!_[_0x444d('0x62')]([_0x444d('0x63'),_0x444d('0x64'),_0x444d('0x65'),_0x444d('0x66')],_0x28b24c);};var _0x4dbe0c=function(_0x4f879b){if(!_0x4f879b||!_0x4f879b[_0x444d('0x67')][_0x444d('0x3a')]){return'';}for(var _0x4dd1dc='(',_0x3fca71=0x0;_0x3fca71<_0x4f879b[_0x444d('0x67')][_0x444d('0x3a')];_0x3fca71+=0x1){_0x3fca71>0x0&&(_0x4dd1dc+='\x20'+_0x4f879b[_0x444d('0x68')]+'\x20');_0x4dd1dc+=_0x4f879b['rules'][_0x3fca71][_0x444d('0x69')]?_0x4dbe0c(_0x4f879b[_0x444d('0x67')][_0x3fca71]['group']):_0x4f879b[_0x444d('0x67')][_0x3fca71]['field']+'\x20'+_0x4f879b[_0x444d('0x67')][_0x3fca71][_0x444d('0x6a')]+(_0x25aa30(_0x4f879b['rules'][_0x3fca71][_0x444d('0x6a')])?'\x20'+_0x4f879b['rules'][_0x3fca71][_0x444d('0x6b')]:'');}return _0x4dd1dc+')';};var _0xd1428c={'where':{'id':_0x573f56[_0x444d('0x47')]['id']}},_0x49d75c,_0x4acf7e,_0x34abc3,_0x46ece9,_0x405618;_0xd1428c=_[_0x444d('0x42')]({},_0xd1428c,_0x573f56[_0x444d('0x43')]);return db[_0x444d('0x2e')][_0x444d('0x49')](_0xd1428c)[_0x444d('0x27')](function(_0x4ce784){if(_0x4ce784){_0x49d75c=_0x4ce784;return _0x4ce784[_0x444d('0x6c')]();}return null;})[_0x444d('0x27')](function(_0x12e295){if(_0x12e295){if(!_0x12e295[_0x444d('0x3a')]){throw new db[(_0x444d('0x6d'))][(_0x444d('0x6e'))](_0x444d('0x6f'),0x193);}_0x4acf7e=_0x12e295;return db['AnalyticMetric'][_0x444d('0x45')]({'raw':!![]});}return null;})[_0x444d('0x27')](function(_0x20a837){if(_0x20a837){_0x34abc3=_[_0x444d('0x70')](_0x20a837,'id');var _0x17094f;var _0x40e83c=squel[_0x444d('0x71')]();_0x40e83c[_0x444d('0x72')](_0x49d75c[_0x444d('0x73')]);for(var _0x455f4d=0x0;_0x455f4d<_0x4acf7e[_0x444d('0x3a')];_0x455f4d+=0x1){_0x17094f=_0x4acf7e[_0x455f4d]['MetricId']?_0x34abc3[_0x4acf7e[_0x455f4d]['MetricId']][_0x444d('0x74')]:_0x4acf7e[_0x455f4d][_0x444d('0x75')];_0x17094f=_0x4acf7e[_0x455f4d][_0x444d('0x76')]?_['replace'](_0x38b718[_0x4acf7e[_0x455f4d][_0x444d('0x76')]],'%s',_0x17094f):_0x17094f;_0x17094f=_0x4acf7e[_0x455f4d]['format']?_[_0x444d('0x77')](_0x528dd[_0x4acf7e[_0x455f4d]['format']],'%s',_0x17094f):_0x17094f;if(_0x4acf7e[_0x455f4d][_0x444d('0x78')]){_0x40e83c[_0x444d('0x69')](_0x17094f);}_0x4acf7e[_0x455f4d][_0x444d('0x79')]&&_0x40e83c['order'](_0x17094f,_0x4acf7e[_0x455f4d][_0x444d('0x79')]===_0x444d('0x7a')?![]:!![]);_0x40e83c['field'](_0x17094f,_0x4acf7e[_0x455f4d][_0x444d('0x7b')]||_0x17094f);}if(_0x49d75c[_0x444d('0x7c')]){_0x49d75c[_0x444d('0x7c')]=JSON[_0x444d('0x7d')](_0x49d75c['joins']);for(var _0x10d685=0x0;_0x10d685<_0x49d75c['joins']['length'];_0x10d685+=0x1){if(_0x49d75c[_0x444d('0x7c')][_0x10d685][_0x444d('0x30')]&&_[_0x444d('0x62')](_0x152526,_0x49d75c['joins'][_0x10d685][_0x444d('0x30')])&&_0x49d75c['joins'][_0x10d685][_0x444d('0x7e')]&&_0x49d75c[_0x444d('0x7c')][_0x10d685]['foreignTable']&&_0x49d75c['joins'][_0x10d685][_0x444d('0x7f')]){_0x40e83c[_0x49d75c[_0x444d('0x7c')][_0x10d685][_0x444d('0x30')]](_0x49d75c[_0x444d('0x7c')][_0x10d685][_0x444d('0x80')],null,util['format'](_0x444d('0x81'),_0x49d75c[_0x444d('0x73')],_0x49d75c[_0x444d('0x7c')][_0x10d685][_0x444d('0x7e')],_0x49d75c['joins'][_0x10d685][_0x444d('0x80')],_0x49d75c['joins'][_0x10d685][_0x444d('0x7f')]));}}}if(_0x49d75c[_0x444d('0x82')]){_0x49d75c['conditions']=JSON[_0x444d('0x7d')](_0x49d75c[_0x444d('0x82')]);_0x40e83c[_0x444d('0x3f')](_0x4dbe0c(_0x49d75c[_0x444d('0x82')][_0x444d('0x69')]));}_0x405618=_0x40e83c['clone']();_0x40e83c[_0x444d('0x1f')](_0x26b3be);_0x40e83c['offset'](0x0);logger[_0x444d('0x83')]('Limited\x20Query:',_0x40e83c[_0x444d('0x84')]());return dbH['sequelize'][_0x444d('0x33')](_0x40e83c['toString'](),{'type':dbH[_0x444d('0x85')][_0x444d('0x86')][_0x444d('0x87')]});}})[_0x444d('0x27')](respondWithResult(_0x434076,null))[_0x444d('0x46')](handleError(_0x434076,null));};function runReport(_0x459309,_0x308603,_0x5d8b98){var _0x404709=_0x308603[_0x444d('0x32')];var _0x5adc1b=0xa;var _0x403382=[_0x444d('0x54'),_0x444d('0x55'),_0x444d('0x88'),_0x444d('0x56')];var _0x2db404={'SUM':'SUM(%s)','COUNT':_0x444d('0x58'),'COUNT DISTINCT':_0x444d('0x59'),'MAX':_0x444d('0x89'),'MIN':_0x444d('0x5a'),'AVG':_0x444d('0x5b'),'GROUP_CONCAT':_0x444d('0x5c'),'GROUP_CONCAT ASC':_0x444d('0x8a'),'GROUP_CONCAT DESC':_0x444d('0x8b')};var _0x59ddc0={'SEC_TO_TIME':_0x444d('0x5d'),'DATE':_0x444d('0x5e'),'HOUR':_0x444d('0x5f'),'ROUND':_0x444d('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x253638=function(_0x5a0f0a){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x444d('0x65'),_0x444d('0x66')],_0x5a0f0a);};var _0x2a5a6d=function(_0x532ec7){if(!_0x532ec7||!_0x532ec7[_0x444d('0x67')]['length']){return'';}for(var _0x792814='(',_0x4ef915=0x0;_0x4ef915<_0x532ec7['rules']['length'];_0x4ef915+=0x1){_0x4ef915>0x0&&(_0x792814+='\x20'+_0x532ec7[_0x444d('0x68')]+'\x20');_0x792814+=_0x532ec7[_0x444d('0x67')][_0x4ef915][_0x444d('0x69')]?_0x2a5a6d(_0x532ec7[_0x444d('0x67')][_0x4ef915][_0x444d('0x69')]):_0x532ec7[_0x444d('0x67')][_0x4ef915]['field']+'\x20'+_0x532ec7['rules'][_0x4ef915][_0x444d('0x6a')]+(_0x253638(_0x532ec7[_0x444d('0x67')][_0x4ef915]['condition'])?'\x20'+_0x532ec7[_0x444d('0x67')][_0x4ef915][_0x444d('0x6b')]:'');}return _0x792814+')';};var _0x489a27={'where':{'id':_0x459309['id']}},_0x8b089e,_0x5a1b03,_0x566168,_0x3b1342,_0x57e678;_0x489a27=_[_0x444d('0x42')]({},_0x489a27,_0x5d8b98);return db[_0x444d('0x2e')]['find'](_0x489a27)[_0x444d('0x27')](function(_0xe5385){if(_0xe5385){_0x8b089e=_0xe5385;return _0xe5385[_0x444d('0x6c')]();}return null;})[_0x444d('0x27')](function(_0x4e24f9){if(_0x4e24f9){if(!_0x4e24f9['length']){throw new db[(_0x444d('0x6d'))][(_0x444d('0x6e'))](_0x444d('0x6f'),0x193);}_0x5a1b03=_0x4e24f9;return db[_0x444d('0x8c')][_0x444d('0x45')]({'raw':!![]});}return null;})[_0x444d('0x27')](function(_0x558cfe){if(_0x558cfe){_0x566168=_['keyBy'](_0x558cfe,'id');var _0x5397f7;var _0x55db10=squel[_0x444d('0x71')]();_0x55db10[_0x444d('0x72')](_0x8b089e[_0x444d('0x73')]);for(var _0x1e557c=0x0;_0x1e557c<_0x5a1b03[_0x444d('0x3a')];_0x1e557c+=0x1){_0x5397f7=_0x5a1b03[_0x1e557c]['MetricId']?_0x566168[_0x5a1b03[_0x1e557c][_0x444d('0x8d')]][_0x444d('0x74')]:_0x5a1b03[_0x1e557c]['field'];_0x5397f7=_0x5a1b03[_0x1e557c][_0x444d('0x76')]?_[_0x444d('0x77')](_0x2db404[_0x5a1b03[_0x1e557c][_0x444d('0x76')]],'%s',_0x5397f7):_0x5397f7;_0x5397f7=_0x5a1b03[_0x1e557c]['format']?_[_0x444d('0x77')](_0x59ddc0[_0x5a1b03[_0x1e557c][_0x444d('0x8e')]],'%s',_0x5397f7):_0x5397f7;if(_0x5a1b03[_0x1e557c][_0x444d('0x78')]){_0x55db10[_0x444d('0x69')](_0x5397f7);}_0x5a1b03[_0x1e557c][_0x444d('0x79')]&&_0x55db10[_0x444d('0x3e')](_0x5397f7,_0x5a1b03[_0x1e557c][_0x444d('0x79')]==='DESC'?![]:!![]);_0x55db10[_0x444d('0x75')](_0x5397f7,_0x5a1b03[_0x1e557c][_0x444d('0x7b')]||_0x5397f7);}if(_0x8b089e['joins']){_0x8b089e[_0x444d('0x7c')]=JSON[_0x444d('0x7d')](_0x8b089e[_0x444d('0x7c')]);for(var _0x15fc8f=0x0;_0x15fc8f<_0x8b089e['joins']['length'];_0x15fc8f+=0x1){if(_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x30')]&&_[_0x444d('0x62')](_0x403382,_0x8b089e['joins'][_0x15fc8f][_0x444d('0x30')])&&_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x7e')]&&_0x8b089e['joins'][_0x15fc8f][_0x444d('0x80')]&&_0x8b089e['joins'][_0x15fc8f][_0x444d('0x7f')]){_0x55db10[_0x8b089e[_0x444d('0x7c')][_0x15fc8f]['type']](_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x80')],null,util['format'](_0x444d('0x81'),_0x8b089e['table'],_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x7e')],_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x80')],_0x8b089e[_0x444d('0x7c')][_0x15fc8f][_0x444d('0x7f')]));}}}if(_0x8b089e['conditions']){_0x8b089e[_0x444d('0x82')]=JSON['parse'](_0x8b089e['conditions']);_0x55db10[_0x444d('0x3f')](_0x2a5a6d(_0x8b089e['conditions'][_0x444d('0x69')]));}_0x57e678=_0x55db10[_0x444d('0x8f')]();_0x55db10[_0x444d('0x1f')](_0x5adc1b);_0x55db10[_0x444d('0x3d')](0x0);return;}})['then'](function(){if(_0x308603[_0x444d('0x90')]===_0x444d('0x91')){return null;}var _0x4f2d48=_[_0x444d('0x42')](_0x308603,{'name':_0x308603[_0x444d('0x92')]||_0x308603['name']||_0x8b089e[_0x444d('0x32')],'basename':_0x404709,'savename':util[_0x444d('0x8e')]('%s-%s.%s',_0x308603[_0x444d('0x32')]||_0x8b089e[_0x444d('0x32')],require(_0x444d('0x93'))['generate'](0x4),_0x308603[_0x444d('0x90')]||'csv'),'reportId':_0x8b089e['id'],'reportType':_0x444d('0x94')});return db[_0x444d('0x95')][_0x444d('0x4a')](_0x4f2d48,{'raw':!![]});})[_0x444d('0x27')](function(_0x2aefa5){if(_0x8b089e[_0x444d('0x73')]===_0x444d('0x96')){_0x57e678[_0x444d('0x3f')](_0x8b089e['table']+_0x444d('0x97'),_0x308603['startDate'],_0x308603[_0x444d('0x98')]);}else{_0x57e678[_0x444d('0x3f')](_0x8b089e[_0x444d('0x73')]+_0x444d('0x99'),_0x308603[_0x444d('0x9a')],_0x308603[_0x444d('0x98')]);}if(_0x2aefa5){logger[_0x444d('0x9b')](_0x444d('0x9c'),_0x57e678[_0x444d('0x84')]());require(_0x444d('0x9d'))[_0x444d('0x9e')](path['join'](__dirname,_0x444d('0x9f'),_0x2aefa5[_0x444d('0x90')]),[_0x2aefa5['id'],_0x57e678['toString'](),path[_0x444d('0x54')](__dirname,_0x444d('0xa0'),_0x2aefa5['savename']),_0x404709]);return _0x2aefa5;}else{var _0x14da3e=squel[_0x444d('0x71')]();_0x14da3e[_0x444d('0x72')]('('+_0x57e678[_0x444d('0x84')]()+')','countTable');_0x14da3e[_0x444d('0x75')](_0x444d('0xa1'),_0x444d('0x21'));_0x57e678[_0x444d('0x1f')](_0x308603['limit']||_0x5adc1b);_0x57e678['offset'](_0x308603[_0x444d('0x3d')]||0x0);return dbH[_0x444d('0x85')][_0x444d('0x33')](_0x14da3e['toString'](),{'type':dbH[_0x444d('0x85')][_0x444d('0x86')][_0x444d('0x87')]})[_0x444d('0x27')](function(_0x25a218){if(!_0x25a218[_0x444d('0x3a')]){_0x3b1342=0x0;}else{_0x3b1342=_0x25a218[0x0][_0x444d('0x21')]||0x0;}return dbH[_0x444d('0x85')][_0x444d('0x33')](_0x57e678[_0x444d('0x84')](),{'type':dbH['sequelize'][_0x444d('0x86')][_0x444d('0x87')]});})['then'](function(_0xd35932){return{'rows':_0xd35932||[],'count':_0x3b1342};});}});}exports['run']=function(_0x4df55c,_0x13264f){return runReport(_0x4df55c[_0x444d('0x47')],_0x4df55c[_0x444d('0x33')],_0x4df55c[_0x444d('0x43')])[_0x444d('0x27')](respondWithResult(_0x13264f,null))[_0x444d('0x46')](handleError(_0x13264f,null));};exports[_0x444d('0xa2')]=runReport;exports[_0x444d('0x33')]=function(_0xa6006f,_0x5cd6ff){var _0x55ef0c=0xa;var _0x247cb2=[_0x444d('0x54'),_0x444d('0x55'),_0x444d('0x88'),_0x444d('0x56')];var _0x1ad6e0={'SUM':'SUM(%s)','COUNT':_0x444d('0x58'),'COUNT DISTINCT':_0x444d('0x59'),'MAX':_0x444d('0x89'),'MIN':'MIN(%s)','AVG':_0x444d('0x5b'),'GROUP_CONCAT':_0x444d('0x5c'),'GROUP_CONCAT ASC':_0x444d('0x8a'),'GROUP_CONCAT DESC':_0x444d('0x8b')};var _0xdb6384={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x444d('0x5e'),'HOUR':_0x444d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x444d('0x61')};var _0x4c9190=function(_0x5a3ce5){return!_[_0x444d('0x62')](['IS\x20NULL',_0x444d('0x64'),'IS\x20EMPTY',_0x444d('0x66')],_0x5a3ce5);};var _0x548807=function(_0x46dc4c){if(!_0x46dc4c||!_0x46dc4c[_0x444d('0x67')][_0x444d('0x3a')]){return'';}for(var _0x2e263f='(',_0x37b716=0x0;_0x37b716<_0x46dc4c[_0x444d('0x67')][_0x444d('0x3a')];_0x37b716+=0x1){_0x37b716>0x0&&(_0x2e263f+='\x20'+_0x46dc4c[_0x444d('0x68')]+'\x20');_0x2e263f+=_0x46dc4c[_0x444d('0x67')][_0x37b716][_0x444d('0x69')]?_0x548807(_0x46dc4c[_0x444d('0x67')][_0x37b716][_0x444d('0x69')]):_0x46dc4c[_0x444d('0x67')][_0x37b716]['field']+'\x20'+_0x46dc4c[_0x444d('0x67')][_0x37b716][_0x444d('0x6a')]+(_0x4c9190(_0x46dc4c['rules'][_0x37b716][_0x444d('0x6a')])?'\x20'+_0x46dc4c[_0x444d('0x67')][_0x37b716][_0x444d('0x6b')]:'');}return _0x2e263f+')';};var _0x2ee9c0={'where':{'id':_0xa6006f[_0x444d('0x47')]['id']}},_0x46f42d,_0xe31d04,_0x35db50,_0x32fd3a,_0x255958;_0x2ee9c0=_[_0x444d('0x42')]({},_0x2ee9c0,_0xa6006f[_0x444d('0x43')]);return db[_0x444d('0x2e')][_0x444d('0x49')](_0x2ee9c0)[_0x444d('0x27')](function(_0x2762af){if(_0x2762af){_0x46f42d=_0x2762af;return _0x2762af[_0x444d('0x6c')]();}return null;})['then'](function(_0x583ae4){if(_0x583ae4){if(!_0x583ae4['length']){throw new db['Sequelize'][(_0x444d('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe31d04=_0x583ae4;return db[_0x444d('0x8c')][_0x444d('0x45')]({'raw':!![]});}return null;})['then'](function(_0x9b4938){if(_0x9b4938){_0x35db50=_['keyBy'](_0x9b4938,'id');var _0x45b873;var _0x42cbf7=squel['select']();_0x42cbf7[_0x444d('0x72')](_0x46f42d['table']);for(var _0x2ff438=0x0;_0x2ff438<_0xe31d04[_0x444d('0x3a')];_0x2ff438+=0x1){_0x45b873=_0xe31d04[_0x2ff438][_0x444d('0x8d')]?_0x35db50[_0xe31d04[_0x2ff438][_0x444d('0x8d')]]['metric']:_0xe31d04[_0x2ff438][_0x444d('0x75')];_0x45b873=_0xe31d04[_0x2ff438]['function']?_[_0x444d('0x77')](_0x1ad6e0[_0xe31d04[_0x2ff438][_0x444d('0x76')]],'%s',_0x45b873):_0x45b873;_0x45b873=_0xe31d04[_0x2ff438][_0x444d('0x8e')]?_[_0x444d('0x77')](_0xdb6384[_0xe31d04[_0x2ff438][_0x444d('0x8e')]],'%s',_0x45b873):_0x45b873;if(_0xe31d04[_0x2ff438][_0x444d('0x78')]){_0x42cbf7[_0x444d('0x69')](_0x45b873);}_0xe31d04[_0x2ff438]['orderBy']&&_0x42cbf7[_0x444d('0x3e')](_0x45b873,_0xe31d04[_0x2ff438][_0x444d('0x79')]===_0x444d('0x7a')?![]:!![]);_0x42cbf7[_0x444d('0x75')](_0x45b873,_0xe31d04[_0x2ff438]['alias']||_0x45b873);}if(_0x46f42d[_0x444d('0x7c')]){_0x46f42d[_0x444d('0x7c')]=JSON[_0x444d('0x7d')](_0x46f42d[_0x444d('0x7c')]);for(var _0x306774=0x0;_0x306774<_0x46f42d[_0x444d('0x7c')][_0x444d('0x3a')];_0x306774+=0x1){if(_0x46f42d[_0x444d('0x7c')][_0x306774][_0x444d('0x30')]&&_[_0x444d('0x62')](_0x247cb2,_0x46f42d[_0x444d('0x7c')][_0x306774][_0x444d('0x30')])&&_0x46f42d['joins'][_0x306774][_0x444d('0x7e')]&&_0x46f42d['joins'][_0x306774][_0x444d('0x80')]&&_0x46f42d[_0x444d('0x7c')][_0x306774]['foreignKey']){_0x42cbf7[_0x46f42d[_0x444d('0x7c')][_0x306774]['type']](_0x46f42d['joins'][_0x306774][_0x444d('0x80')],null,util[_0x444d('0x8e')](_0x444d('0x81'),_0x46f42d[_0x444d('0x73')],_0x46f42d[_0x444d('0x7c')][_0x306774][_0x444d('0x7e')],_0x46f42d[_0x444d('0x7c')][_0x306774]['foreignTable'],_0x46f42d['joins'][_0x306774][_0x444d('0x7f')]));}}}if(_0x46f42d[_0x444d('0x82')]){_0x46f42d[_0x444d('0x82')]=JSON[_0x444d('0x7d')](_0x46f42d['conditions']);_0x42cbf7[_0x444d('0x3f')](_0x548807(_0x46f42d[_0x444d('0x82')]['group']));}_0x255958=_0x42cbf7['clone']();_0x42cbf7[_0x444d('0x1f')](_0x55ef0c);_0x42cbf7[_0x444d('0x3d')](0x0);logger[_0x444d('0x83')]('Limited\x20Query:',_0x42cbf7[_0x444d('0x84')]());return dbH['sequelize'][_0x444d('0x33')](_0x42cbf7[_0x444d('0x84')](),{'type':dbH[_0x444d('0x85')][_0x444d('0x86')][_0x444d('0x87')]});}})[_0x444d('0x27')](function(){return{'sql':_0x255958[_0x444d('0x84')]()};})[_0x444d('0x27')](respondWithResult(_0x5cd6ff,null))[_0x444d('0x46')](handleError(_0x5cd6ff,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fe9d1f1..e0933cc 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 _0xff74=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x158fd8,_0x21b479){var _0x1ef75c=function(_0x1a3633){while(--_0x1a3633){_0x158fd8['push'](_0x158fd8['shift']());}};_0x1ef75c(++_0x21b479);}(_0xff74,0x178));var _0x4ff7=function(_0x8f82df,_0x4ad0e9){_0x8f82df=_0x8f82df-0x0;var _0x19212a=_0xff74[_0x8f82df];return _0x19212a;};'use strict';var _=require('lodash');var util=require(_0x4ff7('0x0'));var logger=require(_0x4ff7('0x1'))(_0x4ff7('0x2'));var moment=require(_0x4ff7('0x3'));var BPromise=require(_0x4ff7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ff7('0x5'));var rimraf=require(_0x4ff7('0x6'));var config=require(_0x4ff7('0x7'));var attributes=require(_0x4ff7('0x8'));module['exports']=function(_0x321750,_0x2483b8){return _0x321750['define'](_0x4ff7('0x9'),attributes,{'tableName':_0x4ff7('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfad7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x3e7b2e,_0x520f36){var _0x5e7c72=function(_0x338de2){while(--_0x338de2){_0x3e7b2e['push'](_0x3e7b2e['shift']());}};_0x5e7c72(++_0x520f36);}(_0xfad7,0x1a0));var _0x7fad=function(_0x22f5cf,_0x48b3b9){_0x22f5cf=_0x22f5cf-0x0;var _0x1606e5=_0xfad7[_0x22f5cf];return _0x1606e5;};'use strict';var _=require(_0x7fad('0x0'));var util=require(_0x7fad('0x1'));var logger=require(_0x7fad('0x2'))(_0x7fad('0x3'));var moment=require(_0x7fad('0x4'));var BPromise=require(_0x7fad('0x5'));var rp=require(_0x7fad('0x6'));var fs=require('fs');var path=require(_0x7fad('0x7'));var rimraf=require(_0x7fad('0x8'));var config=require('../../config/environment');var attributes=require(_0x7fad('0x9'));module[_0x7fad('0xa')]=function(_0xdf9302,_0x2fc5f2){return _0xdf9302[_0x7fad('0xb')](_0x7fad('0xc'),attributes,{'tableName':'analytics_custom_reports','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 dacdcc2..d5e28d9 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 _0x3649=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3649,0xf5));var _0x9364=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3649[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9364('0x0'));var util=require(_0x9364('0x1'));var moment=require(_0x9364('0x2'));var BPromise=require(_0x9364('0x3'));var rs=require(_0x9364('0x4'));var fs=require('fs');var Redis=require(_0x9364('0x5'));var db=require(_0x9364('0x6'))['db'];var utils=require(_0x9364('0x7'));var logger=require(_0x9364('0x8'))('rpc');var config=require(_0x9364('0x9'));var jayson=require(_0x9364('0xa'));var client=jayson[_0x9364('0xb')][_0x9364('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b5165,_0x53ae8d,_0x586a29){return new BPromise(function(_0x37ef35,_0xba43d7){return client[_0x9364('0xd')](_0x1b5165,_0x586a29)[_0x9364('0xe')](function(_0x9dda0e){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x53ae8d,_0x9364('0xf'));logger[_0x9364('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x53ae8d,_0x9364('0xf'),JSON['stringify'](_0x9dda0e));if(_0x9dda0e[_0x9364('0x11')]){if(_0x9dda0e['error'][_0x9364('0x12')]===0x1f4){logger[_0x9364('0x11')](_0x9364('0x13'),_0x53ae8d,_0x9dda0e[_0x9364('0x11')][_0x9364('0x14')]);return _0xba43d7(_0x9dda0e['error']['message']);}logger[_0x9364('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x53ae8d,_0x9dda0e[_0x9364('0x11')][_0x9364('0x14')]);return _0x37ef35(_0x9dda0e[_0x9364('0x11')]['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x53ae8d,_0x9364('0xf'));_0x37ef35(_0x9dda0e[_0x9364('0x15')]['message']);}})[_0x9364('0x16')](function(_0x4b496d){logger[_0x9364('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x53ae8d,_0x4b496d);_0xba43d7(_0x4b496d);});});} \ No newline at end of file +var _0xf9aa=['stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x5c619e,_0xd5d312){var _0x4e4572=function(_0x467172){while(--_0x467172){_0x5c619e['push'](_0x5c619e['shift']());}};_0x4e4572(++_0xd5d312);}(_0xf9aa,0xc2));var _0xaf9a=function(_0x2d90cc,_0x45bb4e){_0x2d90cc=_0x2d90cc-0x0;var _0x227a99=_0xf9aa[_0x2d90cc];return _0x227a99;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var moment=require(_0xaf9a('0x2'));var BPromise=require(_0xaf9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf9a('0x4'));var db=require(_0xaf9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf9a('0x6'))(_0xaf9a('0x7'));var config=require(_0xaf9a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaf9a('0x9')][_0xaf9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e28b,_0x579fc9,_0x322400){return new BPromise(function(_0x3fbcbb,_0xc88e8f){return client[_0xaf9a('0xb')](_0x27e28b,_0x322400)[_0xaf9a('0xc')](function(_0x283877){logger[_0xaf9a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x579fc9,_0xaf9a('0xe'));logger['debug'](_0xaf9a('0xf'),_0x579fc9,'request\x20sent',JSON[_0xaf9a('0x10')](_0x283877));if(_0x283877['error']){if(_0x283877[_0xaf9a('0x11')][_0xaf9a('0x12')]===0x1f4){logger[_0xaf9a('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x579fc9,_0x283877[_0xaf9a('0x11')][_0xaf9a('0x13')]);return _0xc88e8f(_0x283877[_0xaf9a('0x11')]['message']);}logger['error'](_0xaf9a('0x14'),_0x579fc9,_0x283877['error'][_0xaf9a('0x13')]);return _0x3fbcbb(_0x283877[_0xaf9a('0x11')][_0xaf9a('0x13')]);}else{logger[_0xaf9a('0xd')](_0xaf9a('0x14'),_0x579fc9,_0xaf9a('0xe'));_0x3fbcbb(_0x283877['result']['message']);}})['catch'](function(_0x459a35){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x579fc9,_0x459a35);_0xc88e8f(_0x459a35);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 00efdad..60858b6 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 _0x5eb3=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0xc4a42e,_0x116839){var _0x1c456b=function(_0xd3f9c){while(--_0xd3f9c){_0xc4a42e['push'](_0xc4a42e['shift']());}};_0x1c456b(++_0x116839);}(_0x5eb3,0x113));var _0x35eb=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x5eb3[_0x286bfb];return _0x52b683;};'use strict';var multer=require(_0x35eb('0x0'));var util=require(_0x35eb('0x1'));var path=require(_0x35eb('0x2'));var timeout=require(_0x35eb('0x3'));var express=require(_0x35eb('0x4'));var router=express['Router']();var fs_extra=require(_0x35eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x35eb('0x6'));var config=require(_0x35eb('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x35eb('0x8')](),controller[_0x35eb('0x9')]);router[_0x35eb('0xa')](_0x35eb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x35eb('0xa')]('/:id/preview',auth[_0x35eb('0x8')](),controller[_0x35eb('0xc')]);router[_0x35eb('0xa')]('/:id/run',auth[_0x35eb('0x8')](),controller[_0x35eb('0xd')]);router[_0x35eb('0xa')](_0x35eb('0xe'),auth[_0x35eb('0x8')](),controller[_0x35eb('0xf')]);router[_0x35eb('0x10')]('/',auth['isAuthenticated'](),controller[_0x35eb('0x11')]);router[_0x35eb('0x12')](_0x35eb('0xb'),auth[_0x35eb('0x8')](),controller[_0x35eb('0x13')]);router[_0x35eb('0x14')]('/:id',auth[_0x35eb('0x8')](),controller[_0x35eb('0x15')]);module[_0x35eb('0x16')]=router; \ No newline at end of file +var _0x75d9=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','multer','util','path'];(function(_0x8f4ea1,_0x51080c){var _0x3a293c=function(_0x5bab0c){while(--_0x5bab0c){_0x8f4ea1['push'](_0x8f4ea1['shift']());}};_0x3a293c(++_0x51080c);}(_0x75d9,0xad));var _0x975d=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x75d9[_0x2053ea];return _0x2232c4;};'use strict';var multer=require(_0x975d('0x0'));var util=require(_0x975d('0x1'));var path=require(_0x975d('0x2'));var timeout=require(_0x975d('0x3'));var express=require(_0x975d('0x4'));var router=express[_0x975d('0x5')]();var fs_extra=require(_0x975d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x975d('0x7'));var config=require(_0x975d('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x975d('0x9')]('/',auth[_0x975d('0xa')](),controller['index']);router[_0x975d('0x9')](_0x975d('0xb'),auth['isAuthenticated'](),controller[_0x975d('0xc')]);router[_0x975d('0x9')](_0x975d('0xd'),auth[_0x975d('0xa')](),controller[_0x975d('0xe')]);router[_0x975d('0x9')](_0x975d('0xf'),auth[_0x975d('0xa')](),controller[_0x975d('0x10')]);router[_0x975d('0x9')](_0x975d('0x11'),auth[_0x975d('0xa')](),controller[_0x975d('0x12')]);router[_0x975d('0x13')]('/',auth[_0x975d('0xa')](),controller[_0x975d('0x14')]);router[_0x975d('0x15')](_0x975d('0xb'),auth[_0x975d('0xa')](),controller['update']);router['delete'](_0x975d('0xb'),auth[_0x975d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9a4e542..612aa51 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x5eaefa,_0x24341a){var _0x11b447=function(_0x584abd){while(--_0x584abd){_0x5eaefa['push'](_0x5eaefa['shift']());}};_0x11b447(++_0x24341a);}(_0x98a8,0x12c));var _0x898a=function(_0x5a65a1,_0x3ff9bf){_0x5a65a1=_0x5a65a1-0x0;var _0x48f47e=_0x98a8[_0x5a65a1];return _0x48f47e;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x24b83f,_0x46fefb){var _0x5163cc=function(_0x188235){while(--_0x188235){_0x24b83f['push'](_0x24b83f['shift']());}};_0x5163cc(++_0x46fefb);}(_0x6f47,0xc7));var _0x76f4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6f47[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'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 838f9bf..77edc0a 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 _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x17457c,_0x5c874d){var _0x18a702=function(_0x2be3e4){while(--_0x2be3e4){_0x17457c['push'](_0x17457c['shift']());}};_0x18a702(++_0x5c874d);}(_0xf494,0x1c6));var _0x4f49=function(_0x4603a3,_0x260168){_0x4603a3=_0x4603a3-0x0;var _0x532cbe=_0xf494[_0x4603a3];return _0x532cbe;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file +var _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x641afe,_0x22d726){var _0x2dfe9a=function(_0x33a370){while(--_0x33a370){_0x641afe['push'](_0x641afe['shift']());}};_0x2dfe9a(++_0x22d726);}(_0x0295,0x1f0));var _0x5029=function(_0x5e2eb5,_0x3f4e6c){_0x5e2eb5=_0x5e2eb5-0x0;var _0x180baf=_0x0295[_0x5e2eb5];return _0x180baf;};'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'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f1243ee..01dee0e 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 _0x231c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x1ebfa0,_0x5c4047){var _0x4fd00c=function(_0x574d19){while(--_0x574d19){_0x1ebfa0['push'](_0x1ebfa0['shift']());}};_0x4fd00c(++_0x5c4047);}(_0x231c,0x197));var _0xc231=function(_0x4683ba,_0x2e8b9e){_0x4683ba=_0x4683ba-0x0;var _0x1e060e=_0x231c[_0x4683ba];return _0x1e060e;};'use strict';var _=require(_0xc231('0x0'));var util=require('util');var logger=require(_0xc231('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc231('0x2'));var rp=require(_0xc231('0x3'));var fs=require('fs');var path=require(_0xc231('0x4'));var rimraf=require(_0xc231('0x5'));var config=require(_0xc231('0x6'));var attributes=require(_0xc231('0x7'));module[_0xc231('0x8')]=function(_0x2b6060,_0x22129a){return _0x2b6060[_0xc231('0x9')](_0xc231('0xa'),attributes,{'tableName':_0xc231('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc647=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x1972e6,_0x19b7ae){var _0x31da35=function(_0x131336){while(--_0x131336){_0x1972e6['push'](_0x1972e6['shift']());}};_0x31da35(++_0x19b7ae);}(_0xc647,0x1ba));var _0x7c64=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc647[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x7c64('0x0'));var logger=require('../../config/logger')(_0x7c64('0x1'));var moment=require(_0x7c64('0x2'));var BPromise=require(_0x7c64('0x3'));var rp=require(_0x7c64('0x4'));var fs=require('fs');var path=require(_0x7c64('0x5'));var rimraf=require(_0x7c64('0x6'));var config=require(_0x7c64('0x7'));var attributes=require(_0x7c64('0x8'));module[_0x7c64('0x9')]=function(_0xbd2e5,_0x107211){return _0xbd2e5[_0x7c64('0xa')](_0x7c64('0xb'),attributes,{'tableName':_0x7c64('0xc'),'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 d420789..223a034 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 _0x7c0f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x1e9810,_0x31acc9){var _0x52a26d=function(_0x92b7e3){while(--_0x92b7e3){_0x1e9810['push'](_0x1e9810['shift']());}};_0x52a26d(++_0x31acc9);}(_0x7c0f,0x187));var _0xf7c0=function(_0x4bde24,_0x91cda4){_0x4bde24=_0x4bde24-0x0;var _0x2efb95=_0x7c0f[_0x4bde24];return _0x2efb95;};'use strict';var _=require(_0xf7c0('0x0'));var util=require('util');var moment=require(_0xf7c0('0x1'));var BPromise=require(_0xf7c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7c0('0x4'));var logger=require(_0xf7c0('0x5'))(_0xf7c0('0x6'));var config=require(_0xf7c0('0x7'));var jayson=require(_0xf7c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d90d9,_0x3ea663,_0x360cfb){return new BPromise(function(_0x109574,_0x587c22){return client[_0xf7c0('0x9')](_0x4d90d9,_0x360cfb)[_0xf7c0('0xa')](function(_0x141550){logger[_0xf7c0('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3ea663,_0xf7c0('0xc'));logger[_0xf7c0('0xd')](_0xf7c0('0xe'),_0x3ea663,_0xf7c0('0xc'),JSON[_0xf7c0('0xf')](_0x141550));if(_0x141550['error']){if(_0x141550[_0xf7c0('0x10')][_0xf7c0('0x11')]===0x1f4){logger[_0xf7c0('0x10')](_0xf7c0('0x12'),_0x3ea663,_0x141550[_0xf7c0('0x10')][_0xf7c0('0x13')]);return _0x587c22(_0x141550[_0xf7c0('0x10')]['message']);}logger[_0xf7c0('0x10')](_0xf7c0('0x12'),_0x3ea663,_0x141550[_0xf7c0('0x10')][_0xf7c0('0x13')]);return _0x109574(_0x141550[_0xf7c0('0x10')][_0xf7c0('0x13')]);}else{logger[_0xf7c0('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3ea663,_0xf7c0('0xc'));_0x109574(_0x141550[_0xf7c0('0x14')]['message']);}})[_0xf7c0('0x15')](function(_0x4989dc){logger[_0xf7c0('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3ea663,_0x4989dc);_0x587c22(_0x4989dc);});});} \ No newline at end of file +var _0xa124=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x5847af,_0x20ec5a){var _0x388b22=function(_0x35ceb4){while(--_0x35ceb4){_0x5847af['push'](_0x5847af['shift']());}};_0x388b22(++_0x20ec5a);}(_0xa124,0x1cd));var _0x4a12=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xa124[_0x470f24];return _0x2c6fc8;};'use strict';var _=require('lodash');var util=require(_0x4a12('0x0'));var moment=require(_0x4a12('0x1'));var BPromise=require(_0x4a12('0x2'));var rs=require(_0x4a12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a12('0x4'))['db'];var utils=require(_0x4a12('0x5'));var logger=require(_0x4a12('0x6'))(_0x4a12('0x7'));var config=require(_0x4a12('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a12('0x9')][_0x4a12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x645ac8,_0x570641,_0xa4ee12){return new BPromise(function(_0x10f0f1,_0x2a01c0){return client[_0x4a12('0xb')](_0x645ac8,_0xa4ee12)['then'](function(_0x2b31a8){logger[_0x4a12('0xc')](_0x4a12('0xd'),_0x570641,'request\x20sent');logger[_0x4a12('0xe')](_0x4a12('0xf'),_0x570641,'request\x20sent',JSON[_0x4a12('0x10')](_0x2b31a8));if(_0x2b31a8['error']){if(_0x2b31a8[_0x4a12('0x11')][_0x4a12('0x12')]===0x1f4){logger['error'](_0x4a12('0xd'),_0x570641,_0x2b31a8[_0x4a12('0x11')][_0x4a12('0x13')]);return _0x2a01c0(_0x2b31a8[_0x4a12('0x11')]['message']);}logger[_0x4a12('0x11')](_0x4a12('0xd'),_0x570641,_0x2b31a8[_0x4a12('0x11')]['message']);return _0x10f0f1(_0x2b31a8['error'][_0x4a12('0x13')]);}else{logger[_0x4a12('0xc')](_0x4a12('0xd'),_0x570641,_0x4a12('0x14'));_0x10f0f1(_0x2b31a8[_0x4a12('0x15')][_0x4a12('0x13')]);}})[_0x4a12('0x16')](function(_0x403d18){logger[_0x4a12('0x11')](_0x4a12('0xd'),_0x570641,_0x403d18);_0x2a01c0(_0x403d18);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4a07ba7..4a434b2 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 _0xf8ae=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xf8ae,0x168));var _0xef8a=function(_0x2b719f,_0x532745){_0x2b719f=_0x2b719f-0x0;var _0x37c8e8=_0xf8ae[_0x2b719f];return _0x37c8e8;};'use strict';var multer=require(_0xef8a('0x0'));var util=require(_0xef8a('0x1'));var path=require('path');var timeout=require(_0xef8a('0x2'));var express=require(_0xef8a('0x3'));var router=express[_0xef8a('0x4')]();var fs_extra=require(_0xef8a('0x5'));var auth=require(_0xef8a('0x6'));var interaction=require(_0xef8a('0x7'));var config=require(_0xef8a('0x8'));var controller=require(_0xef8a('0x9'));router[_0xef8a('0xa')]('/',auth[_0xef8a('0xb')](),controller[_0xef8a('0xc')]);router[_0xef8a('0xa')](_0xef8a('0xd'),auth[_0xef8a('0xb')](),controller['show']);router['get'](_0xef8a('0xe'),auth[_0xef8a('0xb')](),controller[_0xef8a('0xf')]);router['get'](_0xef8a('0x10'),auth[_0xef8a('0xb')](),controller[_0xef8a('0x11')]);router['get']('/:id/query',auth[_0xef8a('0xb')](),controller[_0xef8a('0x12')]);router[_0xef8a('0x13')]('/',auth[_0xef8a('0xb')](),controller[_0xef8a('0x14')]);router[_0xef8a('0x15')]('/:id',auth[_0xef8a('0xb')](),controller[_0xef8a('0x16')]);router[_0xef8a('0x17')](_0xef8a('0xd'),auth['isAuthenticated'](),controller[_0xef8a('0x18')]);module[_0xef8a('0x19')]=router; \ No newline at end of file +var _0x4644=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4644,0x176));var _0x4464=function(_0x254899,_0x31bcde){_0x254899=_0x254899-0x0;var _0x7dd7b4=_0x4644[_0x254899];return _0x7dd7b4;};'use strict';var multer=require(_0x4464('0x0'));var util=require(_0x4464('0x1'));var path=require('path');var timeout=require(_0x4464('0x2'));var express=require(_0x4464('0x3'));var router=express[_0x4464('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4464('0x5'));var config=require(_0x4464('0x6'));var controller=require(_0x4464('0x7'));router[_0x4464('0x8')]('/',auth[_0x4464('0x9')](),controller[_0x4464('0xa')]);router[_0x4464('0x8')](_0x4464('0xb'),auth[_0x4464('0x9')](),controller[_0x4464('0xc')]);router['get'](_0x4464('0xd'),auth[_0x4464('0x9')](),controller[_0x4464('0xe')]);router['get'](_0x4464('0xf'),auth[_0x4464('0x9')](),controller[_0x4464('0x10')]);router['get'](_0x4464('0x11'),auth['isAuthenticated'](),controller['query']);router[_0x4464('0x12')]('/',auth[_0x4464('0x9')](),controller[_0x4464('0x13')]);router[_0x4464('0x14')](_0x4464('0xb'),auth[_0x4464('0x9')](),controller[_0x4464('0x15')]);router['delete'](_0x4464('0xb'),auth['isAuthenticated'](),controller[_0x4464('0x16')]);module[_0x4464('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0871923..103c0b4 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 _0xd526=['csv','pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','moment','STRING','ENUM'];(function(_0x222df7,_0x3e073f){var _0x2cceae=function(_0x5e69ef){while(--_0x5e69ef){_0x222df7['push'](_0x222df7['shift']());}};_0x2cceae(++_0x3e073f);}(_0xd526,0xce));var _0x6d52=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd526[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6d52('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x6d52('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x6d52('0x2')](_0x6d52('0x3'),_0x6d52('0x4'),_0x6d52('0x5')),'allowNull':![],'defaultValue':_0x6d52('0x3')},'savename':{'type':Sequelize[_0x6d52('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6d52('0x6')]},'endDate':{'type':Sequelize[_0x6d52('0x6')]},'status':{'type':Sequelize[_0x6d52('0x1')],'defaultValue':_0x6d52('0x7')},'type':{'type':Sequelize[_0x6d52('0x2')](_0x6d52('0x8'),_0x6d52('0x9')),'allowNull':![],'defaultValue':_0x6d52('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6d52('0xa')]},'reportType':{'type':Sequelize[_0x6d52('0x1')]}}; \ No newline at end of file +var _0xd8c5=['STRING','csv','xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','moment','exports'];(function(_0x396533,_0x53e4ac){var _0x2c4c93=function(_0x3fcb9b){while(--_0x3fcb9b){_0x396533['push'](_0x396533['shift']());}};_0x2c4c93(++_0x53e4ac);}(_0xd8c5,0x1d7));var _0x5d8c=function(_0x435953,_0x4b6280){_0x435953=_0x435953-0x0;var _0x78e0c=_0xd8c5[_0x435953];return _0x78e0c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5d8c('0x0'));module[_0x5d8c('0x1')]={'name':{'type':Sequelize[_0x5d8c('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x5d8c('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x5d8c('0x3'),'pdf',_0x5d8c('0x4')),'allowNull':![],'defaultValue':_0x5d8c('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x5d8c('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5d8c('0x2')],'defaultValue':_0x5d8c('0x6')},'type':{'type':Sequelize[_0x5d8c('0x7')](_0x5d8c('0x8'),_0x5d8c('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x5d8c('0xa')]},'reportType':{'type':Sequelize[_0x5d8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fc0764b..0fcb08a 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 _0xa6ea=['savename','output','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','params','destroy','download','basename'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa6ea,0xc1));var _0xaa6e=function(_0x43bd81,_0x141189){_0x43bd81=_0x43bd81-0x0;var _0x5f0148=_0xa6ea[_0x43bd81];return _0x5f0148;};'use strict';var emlformat=require(_0xaa6e('0x0'));var rimraf=require(_0xaa6e('0x1'));var zipdir=require(_0xaa6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa6e('0x3'));var BPromise=require(_0xaa6e('0x4'));var Mustache=require(_0xaa6e('0x5'));var util=require(_0xaa6e('0x6'));var path=require(_0xaa6e('0x7'));var sox=require(_0xaa6e('0x8'));var csv=require(_0xaa6e('0x9'));var ejs=require(_0xaa6e('0xa'));var fs=require('fs');var fs_extra=require(_0xaa6e('0xb'));var _=require(_0xaa6e('0xc'));var squel=require(_0xaa6e('0xd'));var crypto=require('crypto');var jsforce=require(_0xaa6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa6e('0xf'));var Papa=require(_0xaa6e('0x10'));var Redis=require('ioredis');var authService=require(_0xaa6e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa6e('0x12'));var hardwareService=require(_0xaa6e('0x13'));var logger=require('../../config/logger')(_0xaa6e('0x14'));var utils=require('../../config/utils');var config=require(_0xaa6e('0x15'));var licenseUtil=require(_0xaa6e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7881c2,_0x48625c){_0x48625c=_0x48625c||0xcc;return function(_0x409830){if(_0x409830){return _0x7881c2[_0xaa6e('0x17')](_0x48625c);}return _0x7881c2[_0xaa6e('0x18')](_0x48625c)['end']();};}function respondWithResult(_0x13fd6f,_0x59a129){_0x59a129=_0x59a129||0xc8;return function(_0x25f44f){if(_0x25f44f){return _0x13fd6f[_0xaa6e('0x18')](_0x59a129)[_0xaa6e('0x19')](_0x25f44f);}};}function respondWithFilteredResult(_0x109c76,_0x5f4762){return function(_0x4ae8eb){if(_0x4ae8eb){var _0x533029=typeof _0x5f4762[_0xaa6e('0x1a')]===_0xaa6e('0x1b')&&typeof _0x5f4762[_0xaa6e('0x1c')]===_0xaa6e('0x1b');var _0x265908=_0x4ae8eb[_0xaa6e('0x1d')];var _0x48f044=_0x533029?0x0:_0x5f4762[_0xaa6e('0x1a')];var _0x579510=_0x533029?_0x4ae8eb[_0xaa6e('0x1d')]:_0x5f4762['offset']+_0x5f4762['limit'];var _0x3f8f4b;if(_0x579510>=_0x265908){_0x579510=_0x265908;_0x3f8f4b=0xc8;}else{_0x3f8f4b=0xce;}_0x109c76[_0xaa6e('0x18')](_0x3f8f4b);return _0x109c76[_0xaa6e('0x1e')](_0xaa6e('0x1f'),_0x48f044+'-'+_0x579510+'/'+_0x265908)['json'](_0x4ae8eb);}return null;};}function patchUpdates(_0x392413){return function(_0x3c41b1){try{jsonpatch[_0xaa6e('0x20')](_0x3c41b1,_0x392413,!![]);}catch(_0x3644f7){return BPromise[_0xaa6e('0x21')](_0x3644f7);}return _0x3c41b1[_0xaa6e('0x22')]();};}function saveUpdates(_0x52c89f,_0x49b465){return function(_0x46e6b7){if(_0x46e6b7){return _0x46e6b7[_0xaa6e('0x23')](_0x52c89f)[_0xaa6e('0x24')](function(_0x1d5c59){return _0x1d5c59;});}return null;};}function removeEntity(_0xa25acb,_0x5b0bca){return function(_0x5b2140){if(_0x5b2140){return _0x5b2140['destroy']()[_0xaa6e('0x24')](function(){var _0x3e8e35=_0x5b2140[_0xaa6e('0x25')]({'plain':!![]});var _0x49bc47='ExtractedReports';return db[_0xaa6e('0x26')]['destroy']({'where':{'type':_0x49bc47,'resourceId':_0x3e8e35['id']}})['then'](function(){return _0x5b2140;});})[_0xaa6e('0x24')](function(){_0xa25acb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c6eee,_0x2ce130){return function(_0x491f18){if(!_0x491f18){_0x5c6eee[_0xaa6e('0x17')](0x194);}return _0x491f18;};}function handleError(_0x2ec4fa,_0x4209e5){_0x4209e5=_0x4209e5||0x1f4;return function(_0x121ecf){logger['error'](_0x121ecf['stack']);if(_0x121ecf[_0xaa6e('0x27')]){delete _0x121ecf['name'];}_0x2ec4fa[_0xaa6e('0x18')](_0x4209e5)[_0xaa6e('0x28')](_0x121ecf);};}exports[_0xaa6e('0x29')]=function(_0x3accd9,_0x5d8db1){var _0x745b80={},_0x293d0e={},_0x442f45={'count':0x0,'rows':[]};var _0x405556=_['map'](db[_0xaa6e('0x2a')][_0xaa6e('0x2b')],function(_0x4dce89){return{'name':_0x4dce89[_0xaa6e('0x2c')],'type':_0x4dce89[_0xaa6e('0x2d')]['key']};});_0x293d0e[_0xaa6e('0x2e')]=_[_0xaa6e('0x2f')](_0x405556,_0xaa6e('0x27'));_0x293d0e['query']=_[_0xaa6e('0x30')](_0x3accd9[_0xaa6e('0x31')]);_0x293d0e[_0xaa6e('0x32')]=_[_0xaa6e('0x33')](_0x293d0e[_0xaa6e('0x2e')],_0x293d0e[_0xaa6e('0x31')]);_0x745b80[_0xaa6e('0x34')]=_[_0xaa6e('0x33')](_0x293d0e[_0xaa6e('0x2e')],qs[_0xaa6e('0x35')](_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x35')]));_0x745b80[_0xaa6e('0x34')]=_0x745b80[_0xaa6e('0x34')][_0xaa6e('0x36')]?_0x745b80[_0xaa6e('0x34')]:_0x293d0e[_0xaa6e('0x2e')];if(!_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x37')]('nolimit')){_0x745b80['limit']=qs['limit'](_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x1c')]);_0x745b80['offset']=qs['offset'](_0x3accd9['query'][_0xaa6e('0x1a')]);}_0x745b80[_0xaa6e('0x38')]=qs[_0xaa6e('0x39')](_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x39')]);_0x745b80[_0xaa6e('0x3a')]=qs[_0xaa6e('0x32')](_['pick'](_0x3accd9[_0xaa6e('0x31')],_0x293d0e['filters']),_0x405556);if(_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x3b')]){_0x745b80[_0xaa6e('0x3a')]=_[_0xaa6e('0x3c')](_0x745b80[_0xaa6e('0x3a')],{'$or':_[_0xaa6e('0x2f')](_0x405556,function(_0x6bd6b6){if(_0x6bd6b6[_0xaa6e('0x2d')]!==_0xaa6e('0x3d')){var _0xf13f28={};_0xf13f28[_0x6bd6b6[_0xaa6e('0x27')]]={'$like':'%'+_0x3accd9[_0xaa6e('0x31')][_0xaa6e('0x3b')]+'%'};return _0xf13f28;}})});}_0x745b80=_[_0xaa6e('0x3c')]({},_0x745b80,_0x3accd9[_0xaa6e('0x3e')]);var _0x4866a5={'where':_0x745b80['where']};return db[_0xaa6e('0x2a')][_0xaa6e('0x1d')](_0x4866a5)[_0xaa6e('0x24')](function(_0x25ac16){_0x442f45[_0xaa6e('0x1d')]=_0x25ac16;if(_0x3accd9['query'][_0xaa6e('0x3f')]){_0x745b80[_0xaa6e('0x40')]=[{'all':!![]}];}return db[_0xaa6e('0x2a')][_0xaa6e('0x41')](_0x745b80);})[_0xaa6e('0x24')](function(_0x185411){_0x442f45[_0xaa6e('0x42')]=_0x185411;return _0x442f45;})[_0xaa6e('0x24')](respondWithFilteredResult(_0x5d8db1,_0x745b80))[_0xaa6e('0x43')](handleError(_0x5d8db1,null));};exports[_0xaa6e('0x44')]=function(_0x499ca5,_0x4e9633){var _0x21d716={'raw':!![],'where':{'id':_0x499ca5['params']['id']}},_0x23703c={};_0x23703c[_0xaa6e('0x2e')]=_[_0xaa6e('0x30')](db[_0xaa6e('0x2a')]['rawAttributes']);_0x23703c['query']=_['keys'](_0x499ca5[_0xaa6e('0x31')]);_0x23703c['filters']=_[_0xaa6e('0x33')](_0x23703c[_0xaa6e('0x2e')],_0x23703c[_0xaa6e('0x31')]);_0x21d716['attributes']=_[_0xaa6e('0x33')](_0x23703c[_0xaa6e('0x2e')],qs[_0xaa6e('0x35')](_0x499ca5[_0xaa6e('0x31')]['fields']));_0x21d716[_0xaa6e('0x34')]=_0x21d716[_0xaa6e('0x34')][_0xaa6e('0x36')]?_0x21d716[_0xaa6e('0x34')]:_0x23703c['model'];if(_0x499ca5[_0xaa6e('0x31')]['includeAll']){_0x21d716[_0xaa6e('0x40')]=[{'all':!![]}];}_0x21d716=_[_0xaa6e('0x3c')]({},_0x21d716,_0x499ca5[_0xaa6e('0x3e')]);return db[_0xaa6e('0x2a')][_0xaa6e('0x45')](_0x21d716)[_0xaa6e('0x24')](handleEntityNotFound(_0x4e9633,null))['then'](respondWithResult(_0x4e9633,null))['catch'](handleError(_0x4e9633,null));};exports[_0xaa6e('0x46')]=function(_0x5ed2e5,_0x35d7f0){return db[_0xaa6e('0x2a')][_0xaa6e('0x46')](_0x5ed2e5[_0xaa6e('0x47')],{})['then'](function(_0x59c79f){var _0x572b3a=_0x5ed2e5[_0xaa6e('0x48')][_0xaa6e('0x25')]({'plain':!![]});if(!_0x572b3a)throw new Error(_0xaa6e('0x49'));if(_0x572b3a[_0xaa6e('0x4a')]===_0xaa6e('0x48')){var _0x17427f=_0x59c79f[_0xaa6e('0x25')]({'plain':!![]});var _0x20aafe=_0xaa6e('0x4b');return db[_0xaa6e('0x4c')]['find']({'where':{'name':_0x20aafe,'userProfileId':_0x572b3a[_0xaa6e('0x4d')]},'raw':!![]})[_0xaa6e('0x24')](function(_0x5ec41b){if(_0x5ec41b&&_0x5ec41b[_0xaa6e('0x4e')]===0x0){return db[_0xaa6e('0x26')][_0xaa6e('0x46')]({'name':_0x17427f[_0xaa6e('0x27')],'resourceId':_0x17427f['id'],'type':_0x5ec41b[_0xaa6e('0x27')],'sectionId':_0x5ec41b['id']},{})['then'](function(){return _0x59c79f;});}else{return _0x59c79f;}})[_0xaa6e('0x43')](function(_0xf046ed){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf046ed);throw _0xf046ed;});}return _0x59c79f;})['then'](respondWithResult(_0x35d7f0,0xc9))['catch'](handleError(_0x35d7f0,null));};exports[_0xaa6e('0x23')]=function(_0x6013e5,_0x241fb5){if(_0x6013e5['body']['id']){delete _0x6013e5[_0xaa6e('0x47')]['id'];}return db[_0xaa6e('0x2a')][_0xaa6e('0x45')]({'where':{'id':_0x6013e5[_0xaa6e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x241fb5,null))['then'](saveUpdates(_0x6013e5['body'],null))[_0xaa6e('0x24')](respondWithResult(_0x241fb5,null))['catch'](handleError(_0x241fb5,null));};exports[_0xaa6e('0x50')]=function(_0x85ca37,_0x1be362){return db[_0xaa6e('0x2a')][_0xaa6e('0x45')]({'where':{'id':_0x85ca37['params']['id']}})[_0xaa6e('0x24')](handleEntityNotFound(_0x1be362,null))[_0xaa6e('0x24')](removeEntity(_0x1be362,null))[_0xaa6e('0x43')](handleError(_0x1be362,null));};exports[_0xaa6e('0x51')]=function(_0x4f38ab,_0x217f94,_0x2629f8){return db[_0xaa6e('0x2a')][_0xaa6e('0x45')]({'where':{'id':_0x4f38ab[_0xaa6e('0x4f')]['id']},'attributes':['name',_0xaa6e('0x52'),_0xaa6e('0x53'),_0xaa6e('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x217f94,null))['then'](function(_0x22ac28){if(_0x22ac28){if(!fs['existsSync'](path[_0xaa6e('0x55')](config['root'],'server/files/reports',_0x22ac28['savename']))){throw new db[(_0xaa6e('0x56'))][(_0xaa6e('0x57'))](_0xaa6e('0x58'));}if(_0x4f38ab[_0xaa6e('0x31')][_0xaa6e('0x59')]){return _0x217f94[_0xaa6e('0x17')](0xc8);}return _0x217f94[_0xaa6e('0x51')](path[_0xaa6e('0x55')](config['root'],'server/files/reports',_0x22ac28[_0xaa6e('0x53')]),util[_0xaa6e('0x5a')](_0xaa6e('0x5b'),_0x22ac28['basename']||_0x22ac28[_0xaa6e('0x27')],_0x22ac28[_0xaa6e('0x54')]['toLowerCase']()));}})['catch'](handleError(_0x217f94,null));}; \ No newline at end of file +var _0x7300=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','ExtractedReports','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x92706d,_0x5e096c){var _0x15a7eb=function(_0x621d78){while(--_0x621d78){_0x92706d['push'](_0x92706d['shift']());}};_0x15a7eb(++_0x5e096c);}(_0x7300,0x14d));var _0x0730=function(_0x3abc16,_0x241b20){_0x3abc16=_0x3abc16-0x0;var _0x1c834f=_0x7300[_0x3abc16];return _0x1c834f;};'use strict';var emlformat=require(_0x0730('0x0'));var rimraf=require(_0x0730('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0730('0x2'));var rp=require(_0x0730('0x3'));var moment=require(_0x0730('0x4'));var BPromise=require(_0x0730('0x5'));var Mustache=require(_0x0730('0x6'));var util=require(_0x0730('0x7'));var path=require(_0x0730('0x8'));var sox=require('sox');var csv=require(_0x0730('0x9'));var ejs=require(_0x0730('0xa'));var fs=require('fs');var fs_extra=require(_0x0730('0xb'));var _=require(_0x0730('0xc'));var squel=require(_0x0730('0xd'));var crypto=require(_0x0730('0xe'));var jsforce=require(_0x0730('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0730('0x9'));var querystring=require(_0x0730('0x10'));var Papa=require('papaparse');var Redis=require(_0x0730('0x11'));var authService=require(_0x0730('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0730('0x13'));var hardwareService=require(_0x0730('0x14'));var logger=require(_0x0730('0x15'))(_0x0730('0x16'));var utils=require(_0x0730('0x17'));var config=require(_0x0730('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21a553,_0x45c920){_0x45c920=_0x45c920||0xcc;return function(_0x4e4a87){if(_0x4e4a87){return _0x21a553[_0x0730('0x19')](_0x45c920);}return _0x21a553[_0x0730('0x1a')](_0x45c920)['end']();};}function respondWithResult(_0x106cb7,_0xd0a885){_0xd0a885=_0xd0a885||0xc8;return function(_0xc09d19){if(_0xc09d19){return _0x106cb7[_0x0730('0x1a')](_0xd0a885)[_0x0730('0x1b')](_0xc09d19);}};}function respondWithFilteredResult(_0x3ff557,_0x1c9154){return function(_0xca3eb6){if(_0xca3eb6){var _0x2ca670=typeof _0x1c9154[_0x0730('0x1c')]===_0x0730('0x1d')&&typeof _0x1c9154[_0x0730('0x1e')]==='undefined';var _0x2c4211=_0xca3eb6[_0x0730('0x1f')];var _0x2b2738=_0x2ca670?0x0:_0x1c9154[_0x0730('0x1c')];var _0x35ade7=_0x2ca670?_0xca3eb6[_0x0730('0x1f')]:_0x1c9154['offset']+_0x1c9154[_0x0730('0x1e')];var _0x127b86;if(_0x35ade7>=_0x2c4211){_0x35ade7=_0x2c4211;_0x127b86=0xc8;}else{_0x127b86=0xce;}_0x3ff557[_0x0730('0x1a')](_0x127b86);return _0x3ff557[_0x0730('0x20')](_0x0730('0x21'),_0x2b2738+'-'+_0x35ade7+'/'+_0x2c4211)[_0x0730('0x1b')](_0xca3eb6);}return null;};}function patchUpdates(_0x1c30a4){return function(_0x42d171){try{jsonpatch['apply'](_0x42d171,_0x1c30a4,!![]);}catch(_0x1c6b95){return BPromise[_0x0730('0x22')](_0x1c6b95);}return _0x42d171['save']();};}function saveUpdates(_0x2c2917,_0x51dc27){return function(_0x1df631){if(_0x1df631){return _0x1df631[_0x0730('0x23')](_0x2c2917)['then'](function(_0x184848){return _0x184848;});}return null;};}function removeEntity(_0x27b09b,_0x698344){return function(_0x1cd1b2){if(_0x1cd1b2){return _0x1cd1b2[_0x0730('0x24')]()[_0x0730('0x25')](function(){var _0x49db7b=_0x1cd1b2['get']({'plain':!![]});var _0x1d2ab7=_0x0730('0x26');return db['UserProfileResource'][_0x0730('0x24')]({'where':{'type':_0x1d2ab7,'resourceId':_0x49db7b['id']}})['then'](function(){return _0x1cd1b2;});})[_0x0730('0x25')](function(){_0x27b09b[_0x0730('0x1a')](0xcc)[_0x0730('0x27')]();});}};}function handleEntityNotFound(_0x5f4d8e,_0x3ad95f){return function(_0x518376){if(!_0x518376){_0x5f4d8e[_0x0730('0x19')](0x194);}return _0x518376;};}function handleError(_0x1d775a,_0x17d146){_0x17d146=_0x17d146||0x1f4;return function(_0xc767f){logger[_0x0730('0x28')](_0xc767f[_0x0730('0x29')]);if(_0xc767f[_0x0730('0x2a')]){delete _0xc767f[_0x0730('0x2a')];}_0x1d775a[_0x0730('0x1a')](_0x17d146)[_0x0730('0x2b')](_0xc767f);};}exports['index']=function(_0x45b24f,_0x35f615){var _0x3170ad={},_0x57eda1={},_0x3083f3={'count':0x0,'rows':[]};var _0x2c6b07=_[_0x0730('0x2c')](db[_0x0730('0x2d')][_0x0730('0x2e')],function(_0x9197af){return{'name':_0x9197af[_0x0730('0x2f')],'type':_0x9197af[_0x0730('0x30')][_0x0730('0x31')]};});_0x57eda1[_0x0730('0x32')]=_[_0x0730('0x2c')](_0x2c6b07,_0x0730('0x2a'));_0x57eda1[_0x0730('0x33')]=_[_0x0730('0x34')](_0x45b24f[_0x0730('0x33')]);_0x57eda1[_0x0730('0x35')]=_[_0x0730('0x36')](_0x57eda1[_0x0730('0x32')],_0x57eda1[_0x0730('0x33')]);_0x3170ad['attributes']=_[_0x0730('0x36')](_0x57eda1[_0x0730('0x32')],qs[_0x0730('0x37')](_0x45b24f[_0x0730('0x33')]['fields']));_0x3170ad[_0x0730('0x38')]=_0x3170ad[_0x0730('0x38')]['length']?_0x3170ad[_0x0730('0x38')]:_0x57eda1['model'];if(!_0x45b24f[_0x0730('0x33')][_0x0730('0x39')](_0x0730('0x3a'))){_0x3170ad['limit']=qs[_0x0730('0x1e')](_0x45b24f['query'][_0x0730('0x1e')]);_0x3170ad[_0x0730('0x1c')]=qs[_0x0730('0x1c')](_0x45b24f['query'][_0x0730('0x1c')]);}_0x3170ad[_0x0730('0x3b')]=qs[_0x0730('0x3c')](_0x45b24f[_0x0730('0x33')][_0x0730('0x3c')]);_0x3170ad[_0x0730('0x3d')]=qs['filters'](_[_0x0730('0x3e')](_0x45b24f[_0x0730('0x33')],_0x57eda1['filters']),_0x2c6b07);if(_0x45b24f[_0x0730('0x33')][_0x0730('0x3f')]){_0x3170ad[_0x0730('0x3d')]=_['merge'](_0x3170ad[_0x0730('0x3d')],{'$or':_['map'](_0x2c6b07,function(_0x4afd7d){if(_0x4afd7d['type']!==_0x0730('0x40')){var _0x35177d={};_0x35177d[_0x4afd7d[_0x0730('0x2a')]]={'$like':'%'+_0x45b24f['query'][_0x0730('0x3f')]+'%'};return _0x35177d;}})});}_0x3170ad=_[_0x0730('0x41')]({},_0x3170ad,_0x45b24f[_0x0730('0x42')]);var _0xacf5ca={'where':_0x3170ad['where']};return db[_0x0730('0x2d')][_0x0730('0x1f')](_0xacf5ca)['then'](function(_0x164a72){_0x3083f3[_0x0730('0x1f')]=_0x164a72;if(_0x45b24f['query'][_0x0730('0x43')]){_0x3170ad[_0x0730('0x44')]=[{'all':!![]}];}return db[_0x0730('0x2d')]['findAll'](_0x3170ad);})['then'](function(_0x6dc19d){_0x3083f3[_0x0730('0x45')]=_0x6dc19d;return _0x3083f3;})[_0x0730('0x25')](respondWithFilteredResult(_0x35f615,_0x3170ad))[_0x0730('0x46')](handleError(_0x35f615,null));};exports[_0x0730('0x47')]=function(_0x51098f,_0x47387b){var _0xdb7142={'raw':!![],'where':{'id':_0x51098f['params']['id']}},_0x403050={};_0x403050['model']=_[_0x0730('0x34')](db[_0x0730('0x2d')]['rawAttributes']);_0x403050[_0x0730('0x33')]=_['keys'](_0x51098f['query']);_0x403050[_0x0730('0x35')]=_[_0x0730('0x36')](_0x403050['model'],_0x403050[_0x0730('0x33')]);_0xdb7142[_0x0730('0x38')]=_['intersection'](_0x403050[_0x0730('0x32')],qs[_0x0730('0x37')](_0x51098f['query'][_0x0730('0x37')]));_0xdb7142[_0x0730('0x38')]=_0xdb7142[_0x0730('0x38')][_0x0730('0x48')]?_0xdb7142[_0x0730('0x38')]:_0x403050[_0x0730('0x32')];if(_0x51098f[_0x0730('0x33')][_0x0730('0x43')]){_0xdb7142[_0x0730('0x44')]=[{'all':!![]}];}_0xdb7142=_[_0x0730('0x41')]({},_0xdb7142,_0x51098f['options']);return db[_0x0730('0x2d')][_0x0730('0x49')](_0xdb7142)['then'](handleEntityNotFound(_0x47387b,null))[_0x0730('0x25')](respondWithResult(_0x47387b,null))[_0x0730('0x46')](handleError(_0x47387b,null));};exports[_0x0730('0x4a')]=function(_0x40abdc,_0x2ca559){return db[_0x0730('0x2d')][_0x0730('0x4a')](_0x40abdc[_0x0730('0x4b')],{})[_0x0730('0x25')](function(_0x2e7197){var _0x4c2520=_0x40abdc[_0x0730('0x4c')][_0x0730('0x4d')]({'plain':!![]});if(!_0x4c2520)throw new Error(_0x0730('0x4e'));if(_0x4c2520[_0x0730('0x4f')]===_0x0730('0x4c')){var _0xffc871=_0x2e7197[_0x0730('0x4d')]({'plain':!![]});var _0x288163=_0x0730('0x26');return db[_0x0730('0x50')][_0x0730('0x49')]({'where':{'name':_0x288163,'userProfileId':_0x4c2520[_0x0730('0x51')]},'raw':!![]})[_0x0730('0x25')](function(_0xa3aa9b){if(_0xa3aa9b&&_0xa3aa9b['autoAssociation']===0x0){return db['UserProfileResource'][_0x0730('0x4a')]({'name':_0xffc871[_0x0730('0x2a')],'resourceId':_0xffc871['id'],'type':_0xa3aa9b[_0x0730('0x2a')],'sectionId':_0xa3aa9b['id']},{})[_0x0730('0x25')](function(){return _0x2e7197;});}else{return _0x2e7197;}})[_0x0730('0x46')](function(_0x282d33){logger[_0x0730('0x28')](_0x0730('0x52'),_0x282d33);throw _0x282d33;});}return _0x2e7197;})[_0x0730('0x25')](respondWithResult(_0x2ca559,0xc9))[_0x0730('0x46')](handleError(_0x2ca559,null));};exports[_0x0730('0x23')]=function(_0x582681,_0x26d240){if(_0x582681[_0x0730('0x4b')]['id']){delete _0x582681[_0x0730('0x4b')]['id'];}return db[_0x0730('0x2d')]['find']({'where':{'id':_0x582681['params']['id']}})[_0x0730('0x25')](handleEntityNotFound(_0x26d240,null))['then'](saveUpdates(_0x582681[_0x0730('0x4b')],null))[_0x0730('0x25')](respondWithResult(_0x26d240,null))[_0x0730('0x46')](handleError(_0x26d240,null));};exports[_0x0730('0x24')]=function(_0x4d28e6,_0x1558e1){return db['AnalyticExtractedReport'][_0x0730('0x49')]({'where':{'id':_0x4d28e6[_0x0730('0x53')]['id']}})['then'](handleEntityNotFound(_0x1558e1,null))['then'](removeEntity(_0x1558e1,null))[_0x0730('0x46')](handleError(_0x1558e1,null));};exports['download']=function(_0x3d0357,_0x739519,_0x28d44d){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3d0357['params']['id']},'attributes':[_0x0730('0x2a'),_0x0730('0x54'),_0x0730('0x55'),_0x0730('0x56')],'raw':!![]})[_0x0730('0x25')](handleEntityNotFound(_0x739519,null))[_0x0730('0x25')](function(_0x38cb74){if(_0x38cb74){if(!fs[_0x0730('0x57')](path[_0x0730('0x58')](config[_0x0730('0x59')],_0x0730('0x5a'),_0x38cb74['savename']))){throw new db[(_0x0730('0x5b'))]['ValidationError'](_0x0730('0x5c'));}if(_0x3d0357[_0x0730('0x33')]['exists']){return _0x739519['sendStatus'](0xc8);}return _0x739519[_0x0730('0x5d')](path[_0x0730('0x58')](config['root'],_0x0730('0x5a'),_0x38cb74[_0x0730('0x55')]),util[_0x0730('0x5e')](_0x0730('0x5f'),_0x38cb74[_0x0730('0x54')]||_0x38cb74[_0x0730('0x2a')],_0x38cb74[_0x0730('0x56')][_0x0730('0x60')]()));}})[_0x0730('0x46')](handleError(_0x739519,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 796e56e..d3f3016 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 _0x882b=['analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x1d18f8,_0x2ba9d2){var _0x29865b=function(_0x10ab45){while(--_0x10ab45){_0x1d18f8['push'](_0x1d18f8['shift']());}};_0x29865b(++_0x2ba9d2);}(_0x882b,0x64));var _0xb882=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x882b[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xb882('0x0'));var util=require('util');var logger=require(_0xb882('0x1'))(_0xb882('0x2'));var moment=require(_0xb882('0x3'));var BPromise=require(_0xb882('0x4'));var rp=require(_0xb882('0x5'));var fs=require('fs');var path=require(_0xb882('0x6'));var rimraf=require(_0xb882('0x7'));var config=require('../../config/environment');var attributes=require(_0xb882('0x8'));module[_0xb882('0x9')]=function(_0x27073d,_0x2a97d5){return _0x27073d['define']('AnalyticExtractedReport',attributes,{'tableName':_0xb882('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc0=['./analyticExtractedReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5015ed,_0x2a7e06){var _0x247709=function(_0x24081d){while(--_0x24081d){_0x5015ed['push'](_0x5015ed['shift']());}};_0x247709(++_0x2a7e06);}(_0x0fc0,0x100));var _0x00fc=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x0fc0[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x00fc('0x0'));var util=require(_0x00fc('0x1'));var logger=require(_0x00fc('0x2'))(_0x00fc('0x3'));var moment=require(_0x00fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x00fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00fc('0x6'));var config=require(_0x00fc('0x7'));var attributes=require(_0x00fc('0x8'));module[_0x00fc('0x9')]=function(_0x478adf,_0x2cb748){return _0x478adf[_0x00fc('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 24c573d..e6acd7e 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 _0xe097=['request','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xe097,0x186));var _0x7e09=function(_0x28ded1,_0x6c21ef){_0x28ded1=_0x28ded1-0x0;var _0x3ea86e=_0xe097[_0x28ded1];return _0x3ea86e;};'use strict';var _=require(_0x7e09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e09('0x1'));var rs=require(_0x7e09('0x2'));var fs=require('fs');var Redis=require(_0x7e09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e09('0x4'));var logger=require(_0x7e09('0x5'))(_0x7e09('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e09('0x7'));var client=jayson[_0x7e09('0x8')][_0x7e09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216fc0,_0x2f2698,_0x11bd93){return new BPromise(function(_0x49cac2,_0x50c0da){return client[_0x7e09('0xa')](_0x216fc0,_0x11bd93)['then'](function(_0x35c1af){logger['info'](_0x7e09('0xb'),_0x2f2698,'request\x20sent');logger['debug'](_0x7e09('0xc'),_0x2f2698,_0x7e09('0xd'),JSON[_0x7e09('0xe')](_0x35c1af));if(_0x35c1af[_0x7e09('0xf')]){if(_0x35c1af[_0x7e09('0xf')][_0x7e09('0x10')]===0x1f4){logger[_0x7e09('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f2698,_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);return _0x50c0da(_0x35c1af[_0x7e09('0xf')]['message']);}logger[_0x7e09('0xf')](_0x7e09('0xb'),_0x2f2698,_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);return _0x49cac2(_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);}else{logger[_0x7e09('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f2698,'request\x20sent');_0x49cac2(_0x35c1af[_0x7e09('0x13')][_0x7e09('0x11')]);}})['catch'](function(_0x51737a){logger['error'](_0x7e09('0xb'),_0x2f2698,_0x51737a);_0x50c0da(_0x51737a);});});} \ No newline at end of file +var _0x95e4=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x95e4,0xb1));var _0x495e=function(_0x1d19e0,_0x2b106f){_0x1d19e0=_0x1d19e0-0x0;var _0x10a66d=_0x95e4[_0x1d19e0];return _0x10a66d;};'use strict';var _=require(_0x495e('0x0'));var util=require(_0x495e('0x1'));var moment=require(_0x495e('0x2'));var BPromise=require(_0x495e('0x3'));var rs=require(_0x495e('0x4'));var fs=require('fs');var Redis=require(_0x495e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x495e('0x6'));var logger=require(_0x495e('0x7'))('rpc');var config=require(_0x495e('0x8'));var jayson=require(_0x495e('0x9'));var client=jayson[_0x495e('0xa')][_0x495e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x502bb1,_0x373fb3,_0x2721c9){return new BPromise(function(_0x3bead3,_0x184b71){return client[_0x495e('0xc')](_0x502bb1,_0x2721c9)[_0x495e('0xd')](function(_0x531ba6){logger[_0x495e('0xe')](_0x495e('0xf'),_0x373fb3,_0x495e('0x10'));logger[_0x495e('0x11')](_0x495e('0x12'),_0x373fb3,'request\x20sent',JSON['stringify'](_0x531ba6));if(_0x531ba6[_0x495e('0x13')]){if(_0x531ba6['error'][_0x495e('0x14')]===0x1f4){logger[_0x495e('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x373fb3,_0x531ba6[_0x495e('0x13')][_0x495e('0x15')]);return _0x184b71(_0x531ba6['error'][_0x495e('0x15')]);}logger[_0x495e('0x13')](_0x495e('0xf'),_0x373fb3,_0x531ba6['error'][_0x495e('0x15')]);return _0x3bead3(_0x531ba6[_0x495e('0x13')][_0x495e('0x15')]);}else{logger[_0x495e('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x373fb3,_0x495e('0x10'));_0x3bead3(_0x531ba6['result'][_0x495e('0x15')]);}})[_0x495e('0x16')](function(_0x107be9){logger[_0x495e('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x373fb3,_0x107be9);_0x184b71(_0x107be9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c69289b..0bd70ee 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 _0x6e20=['index','isAuthenticated','show','/:id/download','download','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x5098f3,_0x32a027){var _0x28557e=function(_0x43aeca){while(--_0x43aeca){_0x5098f3['push'](_0x5098f3['shift']());}};_0x28557e(++_0x32a027);}(_0x6e20,0xac));var _0x06e2=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x6e20[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0x06e2('0x0'));var util=require(_0x06e2('0x1'));var path=require(_0x06e2('0x2'));var timeout=require(_0x06e2('0x3'));var express=require(_0x06e2('0x4'));var router=express[_0x06e2('0x5')]();var fs_extra=require(_0x06e2('0x6'));var auth=require(_0x06e2('0x7'));var interaction=require(_0x06e2('0x8'));var config=require(_0x06e2('0x9'));var controller=require(_0x06e2('0xa'));router[_0x06e2('0xb')]('/',auth['isAuthenticated'](),controller[_0x06e2('0xc')]);router['get']('/:id',auth[_0x06e2('0xd')](),controller[_0x06e2('0xe')]);router[_0x06e2('0xb')](_0x06e2('0xf'),auth['isAuthenticated'](),controller[_0x06e2('0x10')]);router[_0x06e2('0x11')]('/',auth[_0x06e2('0xd')](),controller[_0x06e2('0x12')]);router['put'](_0x06e2('0x13'),auth['isAuthenticated'](),controller[_0x06e2('0x14')]);router[_0x06e2('0x15')]('/:id',auth[_0x06e2('0xd')](),controller['destroy']);module[_0x06e2('0x16')]=router; \ No newline at end of file +var _0x3e0b=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','put','update'];(function(_0x8de422,_0x58b3f6){var _0x48f5d2=function(_0x3304e4){while(--_0x3304e4){_0x8de422['push'](_0x8de422['shift']());}};_0x48f5d2(++_0x58b3f6);}(_0x3e0b,0xa3));var _0xb3e0=function(_0x12b464,_0x466d77){_0x12b464=_0x12b464-0x0;var _0x4804e9=_0x3e0b[_0x12b464];return _0x4804e9;};'use strict';var multer=require(_0xb3e0('0x0'));var util=require(_0xb3e0('0x1'));var path=require(_0xb3e0('0x2'));var timeout=require(_0xb3e0('0x3'));var express=require('express');var router=express[_0xb3e0('0x4')]();var fs_extra=require(_0xb3e0('0x5'));var auth=require(_0xb3e0('0x6'));var interaction=require(_0xb3e0('0x7'));var config=require(_0xb3e0('0x8'));var controller=require(_0xb3e0('0x9'));router[_0xb3e0('0xa')]('/',auth['isAuthenticated'](),controller[_0xb3e0('0xb')]);router[_0xb3e0('0xa')](_0xb3e0('0xc'),auth['isAuthenticated'](),controller[_0xb3e0('0xd')]);router[_0xb3e0('0xa')](_0xb3e0('0xe'),auth[_0xb3e0('0xf')](),controller[_0xb3e0('0x10')]);router[_0xb3e0('0x11')]('/',auth[_0xb3e0('0xf')](),controller[_0xb3e0('0x12')]);router[_0xb3e0('0x13')](_0xb3e0('0xc'),auth[_0xb3e0('0xf')](),controller[_0xb3e0('0x14')]);router['delete']('/:id',auth[_0xb3e0('0xf')](),controller[_0xb3e0('0x15')]);module[_0xb3e0('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index edc622e..1f067a9 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 _0xcf71=['TEXT','STRING','BOOLEAN'];(function(_0x5b7cb5,_0x2dc0bd){var _0x34985b=function(_0x489e3d){while(--_0x489e3d){_0x5b7cb5['push'](_0x5b7cb5['shift']());}};_0x34985b(++_0x2dc0bd);}(_0xcf71,0x7e));var _0x1cf7=function(_0xdbbb14,_0x140263){_0xdbbb14=_0xdbbb14-0x0;var _0x3c3585=_0xcf71[_0xdbbb14];return _0x3c3585;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x1cf7('0x0')]},'alias':{'type':Sequelize[_0x1cf7('0x1')]},'function':{'type':Sequelize[_0x1cf7('0x1')]},'format':{'type':Sequelize[_0x1cf7('0x1')]},'groupBy':{'type':Sequelize[_0x1cf7('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1cf7('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4592=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x4592,0x133));var _0x2459=function(_0x4b7bd8,_0x2513ad){_0x4b7bd8=_0x4b7bd8-0x0;var _0x4fa530=_0x4592[_0x4b7bd8];return _0x4fa530;};'use strict';var Sequelize=require(_0x2459('0x0'));module[_0x2459('0x1')]={'field':{'type':Sequelize[_0x2459('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x2459('0x3')]},'format':{'type':Sequelize[_0x2459('0x3')]},'groupBy':{'type':Sequelize[_0x2459('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2459('0x3')]},'custom':{'type':Sequelize[_0x2459('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 491bf94..cfe6b4f 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 _0x87de=['length','options','create','body','bulkCreate','find','bulkDestroy','ids','addFields','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x3a72a3,_0x5679ee){var _0x5588bb=function(_0x4eb76d){while(--_0x4eb76d){_0x3a72a3['push'](_0x3a72a3['shift']());}};_0x5588bb(++_0x5679ee);}(_0x87de,0xf9));var _0xe87d=function(_0x10c358,_0x76c981){_0x10c358=_0x10c358-0x0;var _0x40c343=_0x87de[_0x10c358];return _0x40c343;};'use strict';var emlformat=require(_0xe87d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe87d('0x1'));var jsonpatch=require(_0xe87d('0x2'));var rp=require(_0xe87d('0x3'));var moment=require(_0xe87d('0x4'));var BPromise=require(_0xe87d('0x5'));var Mustache=require(_0xe87d('0x6'));var util=require(_0xe87d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe87d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe87d('0x9'));var _=require(_0xe87d('0xa'));var squel=require(_0xe87d('0xb'));var crypto=require('crypto');var jsforce=require(_0xe87d('0xc'));var deskjs=require(_0xe87d('0xd'));var toCsv=require(_0xe87d('0x8'));var querystring=require(_0xe87d('0xe'));var Papa=require(_0xe87d('0xf'));var Redis=require(_0xe87d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe87d('0x11'));var logger=require(_0xe87d('0x12'))(_0xe87d('0x13'));var utils=require('../../config/utils');var config=require(_0xe87d('0x14'));var licenseUtil=require(_0xe87d('0x15'));var db=require(_0xe87d('0x16'))['db'];function respondWithStatusCode(_0x4b3b87,_0x175f81){_0x175f81=_0x175f81||0xcc;return function(_0x428a14){if(_0x428a14){return _0x4b3b87[_0xe87d('0x17')](_0x175f81);}return _0x4b3b87['status'](_0x175f81)['end']();};}function respondWithResult(_0x576e2e,_0x2dfb50){_0x2dfb50=_0x2dfb50||0xc8;return function(_0x226447){if(_0x226447){return _0x576e2e[_0xe87d('0x18')](_0x2dfb50)['json'](_0x226447);}};}function respondWithFilteredResult(_0x4fc9a2,_0x21802d){return function(_0x36fa7a){if(_0x36fa7a){var _0x31a813=typeof _0x21802d[_0xe87d('0x19')]==='undefined'&&typeof _0x21802d[_0xe87d('0x1a')]===_0xe87d('0x1b');var _0x516b9d=_0x36fa7a[_0xe87d('0x1c')];var _0x1ed3a=_0x31a813?0x0:_0x21802d['offset'];var _0x5833cf=_0x31a813?_0x36fa7a['count']:_0x21802d[_0xe87d('0x19')]+_0x21802d[_0xe87d('0x1a')];var _0x54bd8a;if(_0x5833cf>=_0x516b9d){_0x5833cf=_0x516b9d;_0x54bd8a=0xc8;}else{_0x54bd8a=0xce;}_0x4fc9a2[_0xe87d('0x18')](_0x54bd8a);return _0x4fc9a2[_0xe87d('0x1d')](_0xe87d('0x1e'),_0x1ed3a+'-'+_0x5833cf+'/'+_0x516b9d)[_0xe87d('0x1f')](_0x36fa7a);}return null;};}function patchUpdates(_0xbf99bd){return function(_0x183e4d){try{jsonpatch[_0xe87d('0x20')](_0x183e4d,_0xbf99bd,!![]);}catch(_0x10259a){return BPromise['reject'](_0x10259a);}return _0x183e4d[_0xe87d('0x21')]();};}function saveUpdates(_0x1fc19b,_0x23c4c8){return function(_0x175031){if(_0x175031){return _0x175031[_0xe87d('0x22')](_0x1fc19b)[_0xe87d('0x23')](function(_0x2ff5bf){return _0x2ff5bf;});}return null;};}function removeEntity(_0x39edc0,_0x2b7449){return function(_0x298662){if(_0x298662){return _0x298662[_0xe87d('0x24')]()[_0xe87d('0x23')](function(){_0x39edc0[_0xe87d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c3228,_0x5cbccd){return function(_0x223f41){if(!_0x223f41){_0x8c3228[_0xe87d('0x17')](0x194);}return _0x223f41;};}function handleError(_0x3e0c3c,_0x229048){_0x229048=_0x229048||0x1f4;return function(_0x541110){logger['error'](_0x541110['stack']);if(_0x541110['name']){delete _0x541110[_0xe87d('0x25')];}_0x3e0c3c['status'](_0x229048)['send'](_0x541110);};}exports['index']=function(_0x201fa3,_0x16462c){var _0x36d252={},_0x43c748={},_0x15d418={'count':0x0,'rows':[]};var _0x3b9c36=_[_0xe87d('0x26')](db[_0xe87d('0x27')][_0xe87d('0x28')],function(_0x4e5acf){return{'name':_0x4e5acf[_0xe87d('0x29')],'type':_0x4e5acf[_0xe87d('0x2a')][_0xe87d('0x2b')]};});_0x43c748[_0xe87d('0x2c')]=_[_0xe87d('0x26')](_0x3b9c36,'name');_0x43c748['query']=_['keys'](_0x201fa3[_0xe87d('0x2d')]);_0x43c748[_0xe87d('0x2e')]=_[_0xe87d('0x2f')](_0x43c748['model'],_0x43c748['query']);_0x36d252[_0xe87d('0x30')]=_[_0xe87d('0x2f')](_0x43c748[_0xe87d('0x2c')],qs['fields'](_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x31')]));_0x36d252['attributes']=_0x36d252[_0xe87d('0x30')]['length']?_0x36d252[_0xe87d('0x30')]:_0x43c748[_0xe87d('0x2c')];if(!_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x32')](_0xe87d('0x33'))){_0x36d252[_0xe87d('0x1a')]=qs[_0xe87d('0x1a')](_0x201fa3[_0xe87d('0x2d')]['limit']);_0x36d252[_0xe87d('0x19')]=qs[_0xe87d('0x19')](_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x19')]);}_0x36d252[_0xe87d('0x34')]=qs[_0xe87d('0x35')](_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x35')]);_0x36d252[_0xe87d('0x36')]=qs['filters'](_[_0xe87d('0x37')](_0x201fa3[_0xe87d('0x2d')],_0x43c748[_0xe87d('0x2e')]),_0x3b9c36);if(_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x38')]){_0x36d252[_0xe87d('0x36')]=_[_0xe87d('0x39')](_0x36d252[_0xe87d('0x36')],{'$or':_[_0xe87d('0x26')](_0x3b9c36,function(_0x109bf0){if(_0x109bf0['type']!==_0xe87d('0x3a')){var _0x9c4ed3={};_0x9c4ed3[_0x109bf0[_0xe87d('0x25')]]={'$like':'%'+_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x38')]+'%'};return _0x9c4ed3;}})});}_0x36d252=_['merge']({},_0x36d252,_0x201fa3['options']);var _0x1b763b={'where':_0x36d252[_0xe87d('0x36')]};return db[_0xe87d('0x27')][_0xe87d('0x1c')](_0x1b763b)['then'](function(_0xf108ae){_0x15d418[_0xe87d('0x1c')]=_0xf108ae;if(_0x201fa3[_0xe87d('0x2d')][_0xe87d('0x3b')]){_0x36d252[_0xe87d('0x3c')]=[{'all':!![]}];}return db[_0xe87d('0x27')][_0xe87d('0x3d')](_0x36d252);})[_0xe87d('0x23')](function(_0x254d87){_0x15d418[_0xe87d('0x3e')]=_0x254d87;return _0x15d418;})['then'](respondWithFilteredResult(_0x16462c,_0x36d252))[_0xe87d('0x3f')](handleError(_0x16462c,null));};exports[_0xe87d('0x40')]=function(_0x41086e,_0x3424a4){var _0x26ab89={'raw':![],'where':{'id':_0x41086e[_0xe87d('0x41')]['id']}},_0x4bbbba={};_0x4bbbba[_0xe87d('0x2c')]=_[_0xe87d('0x42')](db[_0xe87d('0x27')][_0xe87d('0x28')]);_0x4bbbba[_0xe87d('0x2d')]=_['keys'](_0x41086e['query']);_0x4bbbba[_0xe87d('0x2e')]=_[_0xe87d('0x2f')](_0x4bbbba['model'],_0x4bbbba[_0xe87d('0x2d')]);_0x26ab89[_0xe87d('0x30')]=_[_0xe87d('0x2f')](_0x4bbbba[_0xe87d('0x2c')],qs[_0xe87d('0x31')](_0x41086e['query'][_0xe87d('0x31')]));_0x26ab89['attributes']=_0x26ab89['attributes'][_0xe87d('0x43')]?_0x26ab89[_0xe87d('0x30')]:_0x4bbbba['model'];if(_0x41086e['query']['includeAll']){_0x26ab89[_0xe87d('0x3c')]=[{'all':!![]}];}_0x26ab89=_[_0xe87d('0x39')]({},_0x26ab89,_0x41086e[_0xe87d('0x44')]);return db[_0xe87d('0x27')]['find'](_0x26ab89)[_0xe87d('0x23')](handleEntityNotFound(_0x3424a4,null))[_0xe87d('0x23')](respondWithResult(_0x3424a4,null))[_0xe87d('0x3f')](handleError(_0x3424a4,null));};exports[_0xe87d('0x45')]=function(_0x1dca58,_0x4d3299){return db['AnalyticFieldReport'][_0xe87d('0x45')](_0x1dca58[_0xe87d('0x46')],{})['then'](respondWithResult(_0x4d3299,0xc9))[_0xe87d('0x3f')](handleError(_0x4d3299,null));};exports[_0xe87d('0x47')]=function(_0xaf587,_0x350108){return db[_0xe87d('0x27')][_0xe87d('0x47')](_0xaf587[_0xe87d('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x350108,0xc9))[_0xe87d('0x3f')](handleError(_0x350108,null));};exports['update']=function(_0x592eaf,_0x4629d8){if(_0x592eaf[_0xe87d('0x46')]['id']){delete _0x592eaf['body']['id'];}return db[_0xe87d('0x27')][_0xe87d('0x48')]({'where':{'id':_0x592eaf[_0xe87d('0x41')]['id']}})[_0xe87d('0x23')](handleEntityNotFound(_0x4629d8,null))['then'](saveUpdates(_0x592eaf['body'],null))[_0xe87d('0x23')](respondWithResult(_0x4629d8,null))['catch'](handleError(_0x4629d8,null));};exports[_0xe87d('0x24')]=function(_0x2ce2c8,_0x1d9d0b){return db[_0xe87d('0x27')][_0xe87d('0x48')]({'where':{'id':_0x2ce2c8[_0xe87d('0x41')]['id']}})[_0xe87d('0x23')](handleEntityNotFound(_0x1d9d0b,null))[_0xe87d('0x23')](removeEntity(_0x1d9d0b,null))['catch'](handleError(_0x1d9d0b,null));};exports[_0xe87d('0x49')]=function(_0x8bdfc6,_0x383de7){return db['AnalyticFieldReport'][_0xe87d('0x24')]({'where':{'id':_0x8bdfc6[_0xe87d('0x2d')][_0xe87d('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe87d('0x23')](respondWithResult(_0x383de7,0xcc))['catch'](handleError(_0x383de7,null));};exports[_0xe87d('0x4b')]=function(_0x2bf5ad,_0x16ab9e,_0x5c101f){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x2bf5ad[_0xe87d('0x41')]['id']}})[_0xe87d('0x23')](handleEntityNotFound(_0x16ab9e,null))[_0xe87d('0x23')](function(_0x4e2a9e){if(_0x4e2a9e){return db[_0xe87d('0x4c')][_0xe87d('0x4d')](function(_0x31fde0){return db['AnalyticFieldReport'][_0xe87d('0x24')]({'where':{'CustomReportId':_0x2bf5ad[_0xe87d('0x41')]['id']},'transaction':_0x31fde0})[_0xe87d('0x23')](function(_0x4079b9){var _0x2eb7f1=_['map'](_0x2bf5ad[_0xe87d('0x46')],function(_0x555445){delete _0x555445['id'];_0x555445[_0xe87d('0x4e')]=_0x2bf5ad['params']['id'];return _0x555445;});return db[_0xe87d('0x27')][_0xe87d('0x47')](_0x2eb7f1,{'transaction':_0x31fde0});});})[_0xe87d('0x23')](function(){return db['AnalyticFieldReport'][_0xe87d('0x3d')]({'where':{'CustomReportId':_0x2bf5ad['params']['id']}});});}})['then'](respondWithResult(_0x16ab9e,null))['catch'](handleError(_0x16ab9e,null));}; \ No newline at end of file +var _0xfa15=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2845d7,_0xd09cb1){var _0x147181=function(_0x5c3b4a){while(--_0x5c3b4a){_0x2845d7['push'](_0x2845d7['shift']());}};_0x147181(++_0xd09cb1);}(_0xfa15,0x189));var _0x5fa1=function(_0x92ad86,_0x3c09c3){_0x92ad86=_0x92ad86-0x0;var _0x188fbb=_0xfa15[_0x92ad86];return _0x188fbb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fa1('0x0'));var zipdir=require(_0x5fa1('0x1'));var jsonpatch=require(_0x5fa1('0x2'));var rp=require(_0x5fa1('0x3'));var moment=require(_0x5fa1('0x4'));var BPromise=require(_0x5fa1('0x5'));var Mustache=require(_0x5fa1('0x6'));var util=require('util');var path=require(_0x5fa1('0x7'));var sox=require('sox');var csv=require(_0x5fa1('0x8'));var ejs=require(_0x5fa1('0x9'));var fs=require('fs');var fs_extra=require(_0x5fa1('0xa'));var _=require('lodash');var squel=require(_0x5fa1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fa1('0xc'));var toCsv=require(_0x5fa1('0x8'));var querystring=require(_0x5fa1('0xd'));var Papa=require(_0x5fa1('0xe'));var Redis=require(_0x5fa1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fa1('0x10'));var as=require(_0x5fa1('0x11'));var hardwareService=require(_0x5fa1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5fa1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5fa1('0x14'));var db=require(_0x5fa1('0x15'))['db'];function respondWithStatusCode(_0x24fe7d,_0x4808c6){_0x4808c6=_0x4808c6||0xcc;return function(_0x2e8da0){if(_0x2e8da0){return _0x24fe7d[_0x5fa1('0x16')](_0x4808c6);}return _0x24fe7d[_0x5fa1('0x17')](_0x4808c6)[_0x5fa1('0x18')]();};}function respondWithResult(_0x2e2a3d,_0x29e3a1){_0x29e3a1=_0x29e3a1||0xc8;return function(_0x22127b){if(_0x22127b){return _0x2e2a3d[_0x5fa1('0x17')](_0x29e3a1)[_0x5fa1('0x19')](_0x22127b);}};}function respondWithFilteredResult(_0x1d6491,_0x42c8b2){return function(_0xab0d6f){if(_0xab0d6f){var _0x54ada3=typeof _0x42c8b2[_0x5fa1('0x1a')]===_0x5fa1('0x1b')&&typeof _0x42c8b2[_0x5fa1('0x1c')]===_0x5fa1('0x1b');var _0x2f122a=_0xab0d6f[_0x5fa1('0x1d')];var _0xfd39f1=_0x54ada3?0x0:_0x42c8b2[_0x5fa1('0x1a')];var _0xda3180=_0x54ada3?_0xab0d6f[_0x5fa1('0x1d')]:_0x42c8b2[_0x5fa1('0x1a')]+_0x42c8b2[_0x5fa1('0x1c')];var _0x34860a;if(_0xda3180>=_0x2f122a){_0xda3180=_0x2f122a;_0x34860a=0xc8;}else{_0x34860a=0xce;}_0x1d6491[_0x5fa1('0x17')](_0x34860a);return _0x1d6491[_0x5fa1('0x1e')](_0x5fa1('0x1f'),_0xfd39f1+'-'+_0xda3180+'/'+_0x2f122a)['json'](_0xab0d6f);}return null;};}function patchUpdates(_0x17f1e8){return function(_0x5e4090){try{jsonpatch[_0x5fa1('0x20')](_0x5e4090,_0x17f1e8,!![]);}catch(_0x1e05e6){return BPromise[_0x5fa1('0x21')](_0x1e05e6);}return _0x5e4090['save']();};}function saveUpdates(_0x442d0c,_0x834005){return function(_0x548036){if(_0x548036){return _0x548036[_0x5fa1('0x22')](_0x442d0c)['then'](function(_0xbd74a5){return _0xbd74a5;});}return null;};}function removeEntity(_0x45d170,_0x69c79){return function(_0x56b8b2){if(_0x56b8b2){return _0x56b8b2[_0x5fa1('0x23')]()[_0x5fa1('0x24')](function(){_0x45d170[_0x5fa1('0x17')](0xcc)[_0x5fa1('0x18')]();});}};}function handleEntityNotFound(_0x5d1b51,_0x433ccb){return function(_0x2a9c4f){if(!_0x2a9c4f){_0x5d1b51[_0x5fa1('0x16')](0x194);}return _0x2a9c4f;};}function handleError(_0x1493c2,_0xa110cf){_0xa110cf=_0xa110cf||0x1f4;return function(_0x13c0bb){logger[_0x5fa1('0x25')](_0x13c0bb[_0x5fa1('0x26')]);if(_0x13c0bb[_0x5fa1('0x27')]){delete _0x13c0bb[_0x5fa1('0x27')];}_0x1493c2[_0x5fa1('0x17')](_0xa110cf)[_0x5fa1('0x28')](_0x13c0bb);};}exports[_0x5fa1('0x29')]=function(_0x4b69a1,_0x56981b){var _0x3d0e51={},_0x1adf6a={},_0x4296cd={'count':0x0,'rows':[]};var _0x5b7baf=_[_0x5fa1('0x2a')](db[_0x5fa1('0x2b')][_0x5fa1('0x2c')],function(_0x5aef7a){return{'name':_0x5aef7a['fieldName'],'type':_0x5aef7a[_0x5fa1('0x2d')]['key']};});_0x1adf6a['model']=_[_0x5fa1('0x2a')](_0x5b7baf,_0x5fa1('0x27'));_0x1adf6a[_0x5fa1('0x2e')]=_[_0x5fa1('0x2f')](_0x4b69a1[_0x5fa1('0x2e')]);_0x1adf6a[_0x5fa1('0x30')]=_[_0x5fa1('0x31')](_0x1adf6a[_0x5fa1('0x32')],_0x1adf6a[_0x5fa1('0x2e')]);_0x3d0e51[_0x5fa1('0x33')]=_[_0x5fa1('0x31')](_0x1adf6a[_0x5fa1('0x32')],qs[_0x5fa1('0x34')](_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x34')]));_0x3d0e51[_0x5fa1('0x33')]=_0x3d0e51['attributes'][_0x5fa1('0x35')]?_0x3d0e51[_0x5fa1('0x33')]:_0x1adf6a['model'];if(!_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x36')](_0x5fa1('0x37'))){_0x3d0e51['limit']=qs[_0x5fa1('0x1c')](_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x1c')]);_0x3d0e51[_0x5fa1('0x1a')]=qs['offset'](_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x1a')]);}_0x3d0e51[_0x5fa1('0x38')]=qs['sort'](_0x4b69a1['query'][_0x5fa1('0x39')]);_0x3d0e51[_0x5fa1('0x3a')]=qs[_0x5fa1('0x30')](_[_0x5fa1('0x3b')](_0x4b69a1[_0x5fa1('0x2e')],_0x1adf6a[_0x5fa1('0x30')]),_0x5b7baf);if(_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x3c')]){_0x3d0e51[_0x5fa1('0x3a')]=_[_0x5fa1('0x3d')](_0x3d0e51[_0x5fa1('0x3a')],{'$or':_[_0x5fa1('0x2a')](_0x5b7baf,function(_0x3a69b0){if(_0x3a69b0['type']!==_0x5fa1('0x3e')){var _0x24d3d7={};_0x24d3d7[_0x3a69b0[_0x5fa1('0x27')]]={'$like':'%'+_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x3c')]+'%'};return _0x24d3d7;}})});}_0x3d0e51=_[_0x5fa1('0x3d')]({},_0x3d0e51,_0x4b69a1[_0x5fa1('0x3f')]);var _0x4680b9={'where':_0x3d0e51[_0x5fa1('0x3a')]};return db[_0x5fa1('0x2b')][_0x5fa1('0x1d')](_0x4680b9)[_0x5fa1('0x24')](function(_0x41c6b6){_0x4296cd[_0x5fa1('0x1d')]=_0x41c6b6;if(_0x4b69a1[_0x5fa1('0x2e')][_0x5fa1('0x40')]){_0x3d0e51[_0x5fa1('0x41')]=[{'all':!![]}];}return db[_0x5fa1('0x2b')]['findAll'](_0x3d0e51);})[_0x5fa1('0x24')](function(_0x16760e){_0x4296cd[_0x5fa1('0x42')]=_0x16760e;return _0x4296cd;})['then'](respondWithFilteredResult(_0x56981b,_0x3d0e51))[_0x5fa1('0x43')](handleError(_0x56981b,null));};exports[_0x5fa1('0x44')]=function(_0x1c6409,_0x4dc3d4){var _0xa4d9e3={'raw':![],'where':{'id':_0x1c6409['params']['id']}},_0x186b1f={};_0x186b1f[_0x5fa1('0x32')]=_[_0x5fa1('0x2f')](db[_0x5fa1('0x2b')][_0x5fa1('0x2c')]);_0x186b1f[_0x5fa1('0x2e')]=_[_0x5fa1('0x2f')](_0x1c6409['query']);_0x186b1f[_0x5fa1('0x30')]=_['intersection'](_0x186b1f['model'],_0x186b1f[_0x5fa1('0x2e')]);_0xa4d9e3['attributes']=_[_0x5fa1('0x31')](_0x186b1f['model'],qs[_0x5fa1('0x34')](_0x1c6409[_0x5fa1('0x2e')]['fields']));_0xa4d9e3[_0x5fa1('0x33')]=_0xa4d9e3[_0x5fa1('0x33')]['length']?_0xa4d9e3[_0x5fa1('0x33')]:_0x186b1f['model'];if(_0x1c6409['query']['includeAll']){_0xa4d9e3[_0x5fa1('0x41')]=[{'all':!![]}];}_0xa4d9e3=_[_0x5fa1('0x3d')]({},_0xa4d9e3,_0x1c6409['options']);return db[_0x5fa1('0x2b')][_0x5fa1('0x45')](_0xa4d9e3)['then'](handleEntityNotFound(_0x4dc3d4,null))[_0x5fa1('0x24')](respondWithResult(_0x4dc3d4,null))[_0x5fa1('0x43')](handleError(_0x4dc3d4,null));};exports['create']=function(_0xe27449,_0x48b104){return db[_0x5fa1('0x2b')][_0x5fa1('0x46')](_0xe27449[_0x5fa1('0x47')],{})[_0x5fa1('0x24')](respondWithResult(_0x48b104,0xc9))[_0x5fa1('0x43')](handleError(_0x48b104,null));};exports[_0x5fa1('0x48')]=function(_0x33b0db,_0x3f75f0){return db['AnalyticFieldReport'][_0x5fa1('0x48')](_0x33b0db[_0x5fa1('0x47')],{'raw':![],'individualHooks':!![]})[_0x5fa1('0x24')](respondWithResult(_0x3f75f0,0xc9))[_0x5fa1('0x43')](handleError(_0x3f75f0,null));};exports[_0x5fa1('0x22')]=function(_0x1731bf,_0x31f351){if(_0x1731bf[_0x5fa1('0x47')]['id']){delete _0x1731bf['body']['id'];}return db[_0x5fa1('0x2b')]['find']({'where':{'id':_0x1731bf[_0x5fa1('0x49')]['id']}})[_0x5fa1('0x24')](handleEntityNotFound(_0x31f351,null))['then'](saveUpdates(_0x1731bf[_0x5fa1('0x47')],null))[_0x5fa1('0x24')](respondWithResult(_0x31f351,null))[_0x5fa1('0x43')](handleError(_0x31f351,null));};exports[_0x5fa1('0x23')]=function(_0x256dd9,_0x1074c5){return db[_0x5fa1('0x2b')][_0x5fa1('0x45')]({'where':{'id':_0x256dd9[_0x5fa1('0x49')]['id']}})[_0x5fa1('0x24')](handleEntityNotFound(_0x1074c5,null))[_0x5fa1('0x24')](removeEntity(_0x1074c5,null))[_0x5fa1('0x43')](handleError(_0x1074c5,null));};exports[_0x5fa1('0x4a')]=function(_0x56f1db,_0x3af007){return db['AnalyticFieldReport'][_0x5fa1('0x23')]({'where':{'id':_0x56f1db['query'][_0x5fa1('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x5fa1('0x24')](respondWithResult(_0x3af007,0xcc))[_0x5fa1('0x43')](handleError(_0x3af007,null));};exports[_0x5fa1('0x4c')]=function(_0x56191a,_0x48aeb4,_0x5bdb69){return db[_0x5fa1('0x4d')][_0x5fa1('0x4e')]({'where':{'id':_0x56191a['params']['id']}})[_0x5fa1('0x24')](handleEntityNotFound(_0x48aeb4,null))[_0x5fa1('0x24')](function(_0x1f7ae3){if(_0x1f7ae3){return db[_0x5fa1('0x4f')]['transaction'](function(_0x2ff0a0){return db[_0x5fa1('0x2b')][_0x5fa1('0x23')]({'where':{'CustomReportId':_0x56191a[_0x5fa1('0x49')]['id']},'transaction':_0x2ff0a0})[_0x5fa1('0x24')](function(_0x305dd8){var _0x2c458e=_[_0x5fa1('0x2a')](_0x56191a[_0x5fa1('0x47')],function(_0xc64431){delete _0xc64431['id'];_0xc64431[_0x5fa1('0x50')]=_0x56191a[_0x5fa1('0x49')]['id'];return _0xc64431;});return db[_0x5fa1('0x2b')][_0x5fa1('0x48')](_0x2c458e,{'transaction':_0x2ff0a0});});})['then'](function(){return db[_0x5fa1('0x2b')][_0x5fa1('0x51')]({'where':{'CustomReportId':_0x56191a['params']['id']}});});}})[_0x5fa1('0x24')](respondWithResult(_0x48aeb4,null))[_0x5fa1('0x43')](handleError(_0x48aeb4,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 66ac96a..f84dbdf 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 _0x8aa6=['path','rimraf','../../config/environment','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment','request-promise'];(function(_0x46ddd3,_0x2f4887){var _0x3f7c8c=function(_0x44bec2){while(--_0x44bec2){_0x46ddd3['push'](_0x46ddd3['shift']());}};_0x3f7c8c(++_0x2f4887);}(_0x8aa6,0xe2));var _0x68aa=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x8aa6[_0x47df54];return _0x261b87;};'use strict';var _=require(_0x68aa('0x0'));var util=require(_0x68aa('0x1'));var logger=require('../../config/logger')(_0x68aa('0x2'));var moment=require(_0x68aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x68aa('0x4'));var fs=require('fs');var path=require(_0x68aa('0x5'));var rimraf=require(_0x68aa('0x6'));var config=require(_0x68aa('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x68aa('0x8')]=function(_0x538992,_0x5b60fd){return _0x538992['define'](_0x68aa('0x9'),attributes,{'tableName':_0x68aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f77=['rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','api','moment','path'];(function(_0x4271f1,_0xdbdc80){var _0x1bc9c9=function(_0x463d31){while(--_0x463d31){_0x4271f1['push'](_0x4271f1['shift']());}};_0x1bc9c9(++_0xdbdc80);}(_0x9f77,0x1c8));var _0x79f7=function(_0x10309d,_0x226b6c){_0x10309d=_0x10309d-0x0;var _0x5e1e70=_0x9f77[_0x10309d];return _0x5e1e70;};'use strict';var _=require(_0x79f7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x79f7('0x1'));var moment=require(_0x79f7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x79f7('0x3'));var rimraf=require(_0x79f7('0x4'));var config=require(_0x79f7('0x5'));var attributes=require('./analyticFieldReport.attributes');module[_0x79f7('0x6')]=function(_0x1ce1cc,_0x1bc93d){return _0x1ce1cc[_0x79f7('0x7')](_0x79f7('0x8'),attributes,{'tableName':_0x79f7('0x9'),'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 bae1418..55a0a2b 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 _0x6404=['code','message','result','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x389971,_0x3c6bf8){var _0x347a60=function(_0xbf68eb){while(--_0xbf68eb){_0x389971['push'](_0x389971['shift']());}};_0x347a60(++_0x3c6bf8);}(_0x6404,0x1a7));var _0x4640=function(_0x3ec323,_0x5aa147){_0x3ec323=_0x3ec323-0x0;var _0x3261c6=_0x6404[_0x3ec323];return _0x3261c6;};'use strict';var _=require('lodash');var util=require(_0x4640('0x0'));var moment=require(_0x4640('0x1'));var BPromise=require(_0x4640('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4640('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4640('0x4'));var logger=require('../../config/logger')(_0x4640('0x5'));var config=require(_0x4640('0x6'));var jayson=require(_0x4640('0x7'));var client=jayson[_0x4640('0x8')][_0x4640('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e1b6,_0x5cfd18,_0x583454){return new BPromise(function(_0xb9524e,_0x4ed004){return client[_0x4640('0xa')](_0x48e1b6,_0x583454)[_0x4640('0xb')](function(_0x4411eb){logger[_0x4640('0xc')](_0x4640('0xd'),_0x5cfd18,_0x4640('0xe'));logger[_0x4640('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5cfd18,_0x4640('0xe'),JSON[_0x4640('0x10')](_0x4411eb));if(_0x4411eb['error']){if(_0x4411eb[_0x4640('0x11')][_0x4640('0x12')]===0x1f4){logger[_0x4640('0x11')](_0x4640('0xd'),_0x5cfd18,_0x4411eb[_0x4640('0x11')][_0x4640('0x13')]);return _0x4ed004(_0x4411eb[_0x4640('0x11')]['message']);}logger[_0x4640('0x11')](_0x4640('0xd'),_0x5cfd18,_0x4411eb[_0x4640('0x11')][_0x4640('0x13')]);return _0xb9524e(_0x4411eb[_0x4640('0x11')][_0x4640('0x13')]);}else{logger[_0x4640('0xc')](_0x4640('0xd'),_0x5cfd18,_0x4640('0xe'));_0xb9524e(_0x4411eb[_0x4640('0x14')]['message']);}})['catch'](function(_0xa0804){logger[_0x4640('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5cfd18,_0xa0804);_0x4ed004(_0xa0804);});});} \ No newline at end of file +var _0xd79d=['rpc','../../config/environment','client','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf4d811,_0x11d532){var _0x1677f9=function(_0x55208f){while(--_0x55208f){_0xf4d811['push'](_0xf4d811['shift']());}};_0x1677f9(++_0x11d532);}(_0xd79d,0xf7));var _0xdd79=function(_0x58c608,_0x16f6df){_0x58c608=_0x58c608-0x0;var _0x4fb8aa=_0xd79d[_0x58c608];return _0x4fb8aa;};'use strict';var _=require(_0xdd79('0x0'));var util=require(_0xdd79('0x1'));var moment=require(_0xdd79('0x2'));var BPromise=require(_0xdd79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd79('0x4'));var db=require(_0xdd79('0x5'))['db'];var utils=require(_0xdd79('0x6'));var logger=require(_0xdd79('0x7'))(_0xdd79('0x8'));var config=require(_0xdd79('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdd79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8fe4,_0xcf50f8,_0x374fcb){return new BPromise(function(_0x1c5a95,_0x19ca9a){return client[_0xdd79('0xb')](_0x3c8fe4,_0x374fcb)['then'](function(_0x42c343){logger['info'](_0xdd79('0xc'),_0xcf50f8,_0xdd79('0xd'));logger[_0xdd79('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xcf50f8,_0xdd79('0xd'),JSON['stringify'](_0x42c343));if(_0x42c343['error']){if(_0x42c343[_0xdd79('0xf')]['code']===0x1f4){logger[_0xdd79('0xf')](_0xdd79('0xc'),_0xcf50f8,_0x42c343[_0xdd79('0xf')][_0xdd79('0x10')]);return _0x19ca9a(_0x42c343[_0xdd79('0xf')][_0xdd79('0x10')]);}logger[_0xdd79('0xf')](_0xdd79('0xc'),_0xcf50f8,_0x42c343[_0xdd79('0xf')][_0xdd79('0x10')]);return _0x1c5a95(_0x42c343[_0xdd79('0xf')][_0xdd79('0x10')]);}else{logger['info'](_0xdd79('0xc'),_0xcf50f8,_0xdd79('0xd'));_0x1c5a95(_0x42c343['result'][_0xdd79('0x10')]);}})['catch'](function(_0x12a804){logger[_0xdd79('0xf')](_0xdd79('0xc'),_0xcf50f8,_0x12a804);_0x19ca9a(_0x12a804);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 88bae48..e8d8d18 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(_0xf62d77,_0x21dbc9){var _0x5f28c5=function(_0x509777){while(--_0x509777){_0xf62d77['push'](_0xf62d77['shift']());}};_0x5f28c5(++_0x21dbc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x4fec6a,_0x385d3b){var _0x471be2=function(_0x5b8c11){while(--_0x5b8c11){_0x4fec6a['push'](_0x4fec6a['shift']());}};_0x471be2(++_0x385d3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 7c1be9f..6c751db 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 _0x1bd1=['sequelize','exports','STRING'];(function(_0x5c2050,_0x5bbe89){var _0x13a867=function(_0x21c4d8){while(--_0x21c4d8){_0x5c2050['push'](_0x5c2050['shift']());}};_0x13a867(++_0x5bbe89);}(_0x1bd1,0x123));var _0x11bd=function(_0x558222,_0x105cdb){_0x558222=_0x558222-0x0;var _0x4e1044=_0x1bd1[_0x558222];return _0x4e1044;};'use strict';var Sequelize=require(_0x11bd('0x0'));module[_0x11bd('0x1')]={'name':{'type':Sequelize[_0x11bd('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x11bd('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa3b9=['exports','STRING','name','TEXT','sequelize'];(function(_0x5b5ae3,_0xff9830){var _0x242c57=function(_0x1f63ab){while(--_0x1f63ab){_0x5b5ae3['push'](_0x5b5ae3['shift']());}};_0x242c57(++_0xff9830);}(_0xa3b9,0x112));var _0x9a3b=function(_0x241489,_0x30de1c){_0x241489=_0x241489-0x0;var _0x359dc5=_0xa3b9[_0x241489];return _0x359dc5;};'use strict';var Sequelize=require(_0x9a3b('0x0'));module[_0x9a3b('0x1')]={'name':{'type':Sequelize[_0x9a3b('0x2')],'allowNull':![],'unique':_0x9a3b('0x3')},'table':{'type':Sequelize[_0x9a3b('0x2')]},'metric':{'type':Sequelize[_0x9a3b('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fd20dd1..c68c502 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x25b9e7,_0x63bd23){var _0x3aa8a2=function(_0x57ee77){while(--_0x57ee77){_0x25b9e7['push'](_0x25b9e7['shift']());}};_0x3aa8a2(++_0x63bd23);}(_0xdc97,0x13b));var _0x7dc9=function(_0x418ffa,_0x23a8b0){_0x418ffa=_0x418ffa-0x0;var _0x4064d8=_0xdc97[_0x418ffa];return _0x4064d8;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x5a91f6,_0x25bb7a){var _0x2b3e71=function(_0x207fd8){while(--_0x207fd8){_0x5a91f6['push'](_0x5a91f6['shift']());}};_0x2b3e71(++_0x25bb7a);}(_0xe14b,0x93));var _0xbe14=function(_0x177e71,_0x4158be){_0x177e71=_0x177e71-0x0;var _0x20143d=_0xe14b[_0x177e71];return _0x20143d;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 3ab4192..40a0c54 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 _0x5398=['request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric','util','../../config/logger','api','moment','bluebird'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x5398,0xe2));var _0x8539=function(_0x121027,_0x37547f){_0x121027=_0x121027-0x0;var _0x4eaded=_0x5398[_0x121027];return _0x4eaded;};'use strict';var _=require('lodash');var util=require(_0x8539('0x0'));var logger=require(_0x8539('0x1'))(_0x8539('0x2'));var moment=require(_0x8539('0x3'));var BPromise=require(_0x8539('0x4'));var rp=require(_0x8539('0x5'));var fs=require('fs');var path=require(_0x8539('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8539('0x7'));module[_0x8539('0x8')]=function(_0x14ddc9,_0xcca1c0){return _0x14ddc9[_0x8539('0x9')](_0x8539('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b3d=['moment','request-promise','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','lodash','../../config/logger'];(function(_0x1271e0,_0x1e479d){var _0x445023=function(_0x56b6c7){while(--_0x56b6c7){_0x1271e0['push'](_0x1271e0['shift']());}};_0x445023(++_0x1e479d);}(_0x0b3d,0x76));var _0xd0b3=function(_0xe336e0,_0x18f796){_0xe336e0=_0xe336e0-0x0;var _0x19d2c6=_0x0b3d[_0xe336e0];return _0x19d2c6;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var logger=require(_0xd0b3('0x1'))('api');var moment=require(_0xd0b3('0x2'));var BPromise=require('bluebird');var rp=require(_0xd0b3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0b3('0x4'));var config=require('../../config/environment');var attributes=require(_0xd0b3('0x5'));module[_0xd0b3('0x6')]=function(_0x5b80df,_0x2968c9){return _0x5b80df['define'](_0xd0b3('0x7'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4808d80..a07c4ca 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 _0x5785=['error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x3d94cb,_0x41d809){var _0x1e093d=function(_0x14fd5b){while(--_0x14fd5b){_0x3d94cb['push'](_0x3d94cb['shift']());}};_0x1e093d(++_0x41d809);}(_0x5785,0x124));var _0x5578=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x5785[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var moment=require(_0x5578('0x2'));var BPromise=require(_0x5578('0x3'));var rs=require(_0x5578('0x4'));var fs=require('fs');var Redis=require(_0x5578('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5578('0x6'))('rpc');var config=require(_0x5578('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5578('0x8')][_0x5578('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405c04,_0x4906d6,_0xd994f){return new BPromise(function(_0x5b2e9a,_0x36d5b1){return client[_0x5578('0xa')](_0x405c04,_0xd994f)[_0x5578('0xb')](function(_0x3bb7dd){logger[_0x5578('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x4906d6,_0x5578('0xd'));logger[_0x5578('0xe')](_0x5578('0xf'),_0x4906d6,_0x5578('0xd'),JSON['stringify'](_0x3bb7dd));if(_0x3bb7dd['error']){if(_0x3bb7dd[_0x5578('0x10')][_0x5578('0x11')]===0x1f4){logger[_0x5578('0x10')](_0x5578('0x12'),_0x4906d6,_0x3bb7dd[_0x5578('0x10')][_0x5578('0x13')]);return _0x36d5b1(_0x3bb7dd[_0x5578('0x10')][_0x5578('0x13')]);}logger[_0x5578('0x10')](_0x5578('0x12'),_0x4906d6,_0x3bb7dd[_0x5578('0x10')][_0x5578('0x13')]);return _0x5b2e9a(_0x3bb7dd[_0x5578('0x10')]['message']);}else{logger[_0x5578('0xc')](_0x5578('0x12'),_0x4906d6,'request\x20sent');_0x5b2e9a(_0x3bb7dd[_0x5578('0x14')][_0x5578('0x13')]);}})[_0x5578('0x15')](function(_0x2a1030){logger[_0x5578('0x10')](_0x5578('0x12'),_0x4906d6,_0x2a1030);_0x36d5b1(_0x2a1030);});});} \ No newline at end of file +var _0x06ec=['http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x584683,_0x46a0a4){var _0x57bbf4=function(_0x3180c6){while(--_0x3180c6){_0x584683['push'](_0x584683['shift']());}};_0x57bbf4(++_0x46a0a4);}(_0x06ec,0xf4));var _0xc06e=function(_0x184966,_0x456a47){_0x184966=_0x184966-0x0;var _0x4c2820=_0x06ec[_0x184966];return _0x4c2820;};'use strict';var _=require(_0xc06e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc06e('0x1'));var rs=require(_0xc06e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc06e('0x3'));var logger=require('../../config/logger')(_0xc06e('0x4'));var config=require(_0xc06e('0x5'));var jayson=require(_0xc06e('0x6'));var client=jayson[_0xc06e('0x7')][_0xc06e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44fa2f,_0x6c1faf,_0x23a112){return new BPromise(function(_0x598358,_0x568589){return client['request'](_0x44fa2f,_0x23a112)[_0xc06e('0x9')](function(_0x3b6092){logger[_0xc06e('0xa')](_0xc06e('0xb'),_0x6c1faf,_0xc06e('0xc'));logger[_0xc06e('0xd')](_0xc06e('0xe'),_0x6c1faf,_0xc06e('0xc'),JSON[_0xc06e('0xf')](_0x3b6092));if(_0x3b6092[_0xc06e('0x10')]){if(_0x3b6092['error'][_0xc06e('0x11')]===0x1f4){logger['error'](_0xc06e('0xb'),_0x6c1faf,_0x3b6092['error'][_0xc06e('0x12')]);return _0x568589(_0x3b6092['error'][_0xc06e('0x12')]);}logger[_0xc06e('0x10')](_0xc06e('0xb'),_0x6c1faf,_0x3b6092[_0xc06e('0x10')][_0xc06e('0x12')]);return _0x598358(_0x3b6092[_0xc06e('0x10')][_0xc06e('0x12')]);}else{logger[_0xc06e('0xa')](_0xc06e('0xb'),_0x6c1faf,_0xc06e('0xc'));_0x598358(_0x3b6092[_0xc06e('0x13')]['message']);}})[_0xc06e('0x14')](function(_0x8b62d){logger['error'](_0xc06e('0xb'),_0x6c1faf,_0x8b62d);_0x568589(_0x8b62d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2fb3e09..d594626 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 _0x6bb4=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','multer','util'];(function(_0x115b39,_0x2dfdbe){var _0x32e700=function(_0x4c0dd0){while(--_0x4c0dd0){_0x115b39['push'](_0x115b39['shift']());}};_0x32e700(++_0x2dfdbe);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x17ef56,_0x374f14){_0x17ef56=_0x17ef56-0x0;var _0xf75b6f=_0x6bb4[_0x17ef56];return _0xf75b6f;};'use strict';var multer=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var path=require(_0x46bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x46bb('0x3'));var router=express[_0x46bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46bb('0x5'));var interaction=require(_0x46bb('0x6'));var config=require(_0x46bb('0x7'));var controller=require(_0x46bb('0x8'));router[_0x46bb('0x9')]('/',auth[_0x46bb('0xa')](),controller['index']);router['get'](_0x46bb('0xb'),auth[_0x46bb('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x46bb('0xc')]);router[_0x46bb('0xd')]('/:id',auth[_0x46bb('0xa')](),controller[_0x46bb('0xe')]);router[_0x46bb('0xf')]('/:id',auth[_0x46bb('0xa')](),controller[_0x46bb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1f75=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1f75,0x12c));var _0x51f7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1f75[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x51f7('0x0'));var util=require(_0x51f7('0x1'));var path=require(_0x51f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x51f7('0x3'));var router=express[_0x51f7('0x4')]();var fs_extra=require(_0x51f7('0x5'));var auth=require(_0x51f7('0x6'));var interaction=require(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var controller=require(_0x51f7('0x9'));router[_0x51f7('0xa')]('/',auth[_0x51f7('0xb')](),controller[_0x51f7('0xc')]);router[_0x51f7('0xa')](_0x51f7('0xd'),auth['isAuthenticated'](),controller[_0x51f7('0xe')]);router[_0x51f7('0xf')]('/',auth[_0x51f7('0xb')](),controller['create']);router['put'](_0x51f7('0xd'),auth[_0x51f7('0xb')](),controller['update']);router[_0x51f7('0x10')](_0x51f7('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x51f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4dd3ad5..7c9c811 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 _0xc1df=['exports','TEXT','sequelize'];(function(_0x2185fd,_0x123181){var _0x1eec9b=function(_0x4d0bd4){while(--_0x4d0bd4){_0x2185fd['push'](_0x2185fd['shift']());}};_0x1eec9b(++_0x123181);}(_0xc1df,0x15b));var _0xfc1d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc1df[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xfc1d('0x0'));module[_0xfc1d('0x1')]={'tree':{'type':Sequelize[_0xfc1d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x724c=['sequelize','exports'];(function(_0x5dbeee,_0x2620ef){var _0x25f820=function(_0x57d990){while(--_0x57d990){_0x5dbeee['push'](_0x5dbeee['shift']());}};_0x25f820(++_0x2620ef);}(_0x724c,0x10a));var _0xc724=function(_0x4aaab1,_0x452f18){_0x4aaab1=_0x4aaab1-0x0;var _0x5604e8=_0x724c[_0x4aaab1];return _0x5604e8;};'use strict';var Sequelize=require(_0xc724('0x0'));module[_0xc724('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d69e77c..9fc6087 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 _0x5354=['fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','error','stack','name','index','AnalyticTreeReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5354,0xb0));var _0x4535=function(_0x396457,_0xaaf513){_0x396457=_0x396457-0x0;var _0x130a1c=_0x5354[_0x396457];return _0x130a1c;};'use strict';var emlformat=require(_0x4535('0x0'));var rimraf=require(_0x4535('0x1'));var zipdir=require(_0x4535('0x2'));var jsonpatch=require(_0x4535('0x3'));var rp=require(_0x4535('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4535('0x5'));var util=require('util');var path=require(_0x4535('0x6'));var sox=require('sox');var csv=require(_0x4535('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4535('0x8'));var _=require(_0x4535('0x9'));var squel=require('squel');var crypto=require(_0x4535('0xa'));var jsforce=require(_0x4535('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4535('0x7'));var querystring=require(_0x4535('0xc'));var Papa=require(_0x4535('0xd'));var Redis=require(_0x4535('0xe'));var authService=require(_0x4535('0xf'));var qs=require(_0x4535('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4535('0x11'));var logger=require(_0x4535('0x12'))(_0x4535('0x13'));var utils=require('../../config/utils');var config=require(_0x4535('0x14'));var licenseUtil=require(_0x4535('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x491859,_0x3d885b){_0x3d885b=_0x3d885b||0xcc;return function(_0x26fca6){if(_0x26fca6){return _0x491859[_0x4535('0x16')](_0x3d885b);}return _0x491859[_0x4535('0x17')](_0x3d885b)[_0x4535('0x18')]();};}function respondWithResult(_0x2bb086,_0x546c58){_0x546c58=_0x546c58||0xc8;return function(_0x79fd2c){if(_0x79fd2c){return _0x2bb086['status'](_0x546c58)[_0x4535('0x19')](_0x79fd2c);}};}function respondWithFilteredResult(_0x24b691,_0x440276){return function(_0x5f2765){if(_0x5f2765){var _0x21e612=typeof _0x440276['offset']===_0x4535('0x1a')&&typeof _0x440276[_0x4535('0x1b')]==='undefined';var _0x14030b=_0x5f2765['count'];var _0x2642cb=_0x21e612?0x0:_0x440276[_0x4535('0x1c')];var _0x51ab8c=_0x21e612?_0x5f2765[_0x4535('0x1d')]:_0x440276[_0x4535('0x1c')]+_0x440276[_0x4535('0x1b')];var _0x1d11a0;if(_0x51ab8c>=_0x14030b){_0x51ab8c=_0x14030b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x24b691[_0x4535('0x17')](_0x1d11a0);return _0x24b691['set'](_0x4535('0x1e'),_0x2642cb+'-'+_0x51ab8c+'/'+_0x14030b)[_0x4535('0x19')](_0x5f2765);}return null;};}function patchUpdates(_0x560f9e){return function(_0x353e13){try{jsonpatch[_0x4535('0x1f')](_0x353e13,_0x560f9e,!![]);}catch(_0x9c9729){return BPromise['reject'](_0x9c9729);}return _0x353e13[_0x4535('0x20')]();};}function saveUpdates(_0x3b44d8,_0x290e23){return function(_0x339c79){if(_0x339c79){return _0x339c79[_0x4535('0x21')](_0x3b44d8)[_0x4535('0x22')](function(_0x3aa816){return _0x3aa816;});}return null;};}function removeEntity(_0x25c45b,_0x10836b){return function(_0x473e6f){if(_0x473e6f){return _0x473e6f['destroy']()[_0x4535('0x22')](function(){_0x25c45b[_0x4535('0x17')](0xcc)[_0x4535('0x18')]();});}};}function handleEntityNotFound(_0x5ef96a,_0x40be67){return function(_0x315532){if(!_0x315532){_0x5ef96a[_0x4535('0x16')](0x194);}return _0x315532;};}function handleError(_0x5b8157,_0x39f759){_0x39f759=_0x39f759||0x1f4;return function(_0x369c79){logger[_0x4535('0x23')](_0x369c79[_0x4535('0x24')]);if(_0x369c79[_0x4535('0x25')]){delete _0x369c79[_0x4535('0x25')];}_0x5b8157['status'](_0x39f759)['send'](_0x369c79);};}exports[_0x4535('0x26')]=function(_0x1d02cb,_0x5afbb5){var _0x3204a2={},_0x277e79={},_0x1255b9={'count':0x0,'rows':[]};var _0x427926=_['map'](db[_0x4535('0x27')]['rawAttributes'],function(_0x4331d6){return{'name':_0x4331d6[_0x4535('0x28')],'type':_0x4331d6['type'][_0x4535('0x29')]};});_0x277e79[_0x4535('0x2a')]=_[_0x4535('0x2b')](_0x427926,_0x4535('0x25'));_0x277e79[_0x4535('0x2c')]=_[_0x4535('0x2d')](_0x1d02cb[_0x4535('0x2c')]);_0x277e79[_0x4535('0x2e')]=_['intersection'](_0x277e79[_0x4535('0x2a')],_0x277e79[_0x4535('0x2c')]);_0x3204a2[_0x4535('0x2f')]=_[_0x4535('0x30')](_0x277e79[_0x4535('0x2a')],qs[_0x4535('0x31')](_0x1d02cb['query']['fields']));_0x3204a2[_0x4535('0x2f')]=_0x3204a2[_0x4535('0x2f')][_0x4535('0x32')]?_0x3204a2[_0x4535('0x2f')]:_0x277e79[_0x4535('0x2a')];if(!_0x1d02cb[_0x4535('0x2c')][_0x4535('0x33')](_0x4535('0x34'))){_0x3204a2[_0x4535('0x1b')]=qs[_0x4535('0x1b')](_0x1d02cb[_0x4535('0x2c')][_0x4535('0x1b')]);_0x3204a2[_0x4535('0x1c')]=qs[_0x4535('0x1c')](_0x1d02cb[_0x4535('0x2c')][_0x4535('0x1c')]);}_0x3204a2[_0x4535('0x35')]=qs[_0x4535('0x36')](_0x1d02cb[_0x4535('0x2c')][_0x4535('0x36')]);_0x3204a2['where']=qs[_0x4535('0x2e')](_['pick'](_0x1d02cb[_0x4535('0x2c')],_0x277e79[_0x4535('0x2e')]),_0x427926);if(_0x1d02cb['query']['filter']){_0x3204a2[_0x4535('0x37')]=_[_0x4535('0x38')](_0x3204a2[_0x4535('0x37')],{'$or':_[_0x4535('0x2b')](_0x427926,function(_0x4b884b){if(_0x4b884b[_0x4535('0x39')]!==_0x4535('0x3a')){var _0xcb0e7f={};_0xcb0e7f[_0x4b884b[_0x4535('0x25')]]={'$like':'%'+_0x1d02cb[_0x4535('0x2c')]['filter']+'%'};return _0xcb0e7f;}})});}_0x3204a2=_[_0x4535('0x38')]({},_0x3204a2,_0x1d02cb[_0x4535('0x3b')]);var _0xe28605={'where':_0x3204a2['where']};return db[_0x4535('0x27')][_0x4535('0x1d')](_0xe28605)['then'](function(_0x3ac05c){_0x1255b9[_0x4535('0x1d')]=_0x3ac05c;if(_0x1d02cb[_0x4535('0x2c')][_0x4535('0x3c')]){_0x3204a2[_0x4535('0x3d')]=[{'all':!![]}];}return db[_0x4535('0x27')][_0x4535('0x3e')](_0x3204a2);})[_0x4535('0x22')](function(_0x554ab4){_0x1255b9[_0x4535('0x3f')]=_0x554ab4;return _0x1255b9;})['then'](respondWithFilteredResult(_0x5afbb5,_0x3204a2))[_0x4535('0x40')](handleError(_0x5afbb5,null));};exports[_0x4535('0x41')]=function(_0x10256c,_0x893ddf){var _0x13c4e1={'raw':!![],'where':{'id':_0x10256c[_0x4535('0x42')]['id']}},_0xf9e814={};_0xf9e814[_0x4535('0x2a')]=_[_0x4535('0x2d')](db['AnalyticTreeReport'][_0x4535('0x43')]);_0xf9e814[_0x4535('0x2c')]=_[_0x4535('0x2d')](_0x10256c[_0x4535('0x2c')]);_0xf9e814['filters']=_[_0x4535('0x30')](_0xf9e814[_0x4535('0x2a')],_0xf9e814[_0x4535('0x2c')]);_0x13c4e1[_0x4535('0x2f')]=_['intersection'](_0xf9e814['model'],qs[_0x4535('0x31')](_0x10256c[_0x4535('0x2c')][_0x4535('0x31')]));_0x13c4e1[_0x4535('0x2f')]=_0x13c4e1['attributes'][_0x4535('0x32')]?_0x13c4e1['attributes']:_0xf9e814[_0x4535('0x2a')];if(_0x10256c['query'][_0x4535('0x3c')]){_0x13c4e1[_0x4535('0x3d')]=[{'all':!![]}];}_0x13c4e1=_['merge']({},_0x13c4e1,_0x10256c[_0x4535('0x3b')]);return db[_0x4535('0x27')][_0x4535('0x44')](_0x13c4e1)[_0x4535('0x22')](handleEntityNotFound(_0x893ddf,null))['then'](respondWithResult(_0x893ddf,null))['catch'](handleError(_0x893ddf,null));};exports[_0x4535('0x45')]=function(_0x3458aa,_0x3bcfbb){return db[_0x4535('0x27')][_0x4535('0x45')](_0x3458aa[_0x4535('0x46')],{})[_0x4535('0x22')](respondWithResult(_0x3bcfbb,0xc9))[_0x4535('0x40')](handleError(_0x3bcfbb,null));};exports[_0x4535('0x21')]=function(_0x5580db,_0x3c2543){if(_0x5580db[_0x4535('0x46')]['id']){delete _0x5580db['body']['id'];}return db[_0x4535('0x27')][_0x4535('0x44')]({'where':{'id':_0x5580db[_0x4535('0x42')]['id']}})[_0x4535('0x22')](handleEntityNotFound(_0x3c2543,null))['then'](saveUpdates(_0x5580db[_0x4535('0x46')],null))[_0x4535('0x22')](respondWithResult(_0x3c2543,null))['catch'](handleError(_0x3c2543,null));};exports[_0x4535('0x47')]=function(_0x599698,_0x4cd3ee){return db['AnalyticTreeReport'][_0x4535('0x44')]({'where':{'id':_0x599698[_0x4535('0x42')]['id']}})[_0x4535('0x22')](handleEntityNotFound(_0x4cd3ee,null))[_0x4535('0x22')](removeEntity(_0x4cd3ee,null))[_0x4535('0x40')](handleError(_0x4cd3ee,null));}; \ No newline at end of file +var _0xb4b7=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../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','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','map','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','rawAttributes','find','create','catch','body','params','eml-format','zip-dir'];(function(_0x11f523,_0x5326b5){var _0x5c1012=function(_0x190e79){while(--_0x190e79){_0x11f523['push'](_0x11f523['shift']());}};_0x5c1012(++_0x5326b5);}(_0xb4b7,0xd9));var _0x7b4b=function(_0x37b744,_0x5e8e01){_0x37b744=_0x37b744-0x0;var _0x1634a6=_0xb4b7[_0x37b744];return _0x1634a6;};'use strict';var emlformat=require(_0x7b4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b4b('0x1'));var jsonpatch=require(_0x7b4b('0x2'));var rp=require(_0x7b4b('0x3'));var moment=require('moment');var BPromise=require(_0x7b4b('0x4'));var Mustache=require(_0x7b4b('0x5'));var util=require(_0x7b4b('0x6'));var path=require(_0x7b4b('0x7'));var sox=require(_0x7b4b('0x8'));var csv=require(_0x7b4b('0x9'));var ejs=require(_0x7b4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b4b('0xb'));var squel=require(_0x7b4b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b4b('0xd'));var toCsv=require(_0x7b4b('0x9'));var querystring=require(_0x7b4b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b4b('0xf'));var qs=require(_0x7b4b('0x10'));var as=require(_0x7b4b('0x11'));var hardwareService=require(_0x7b4b('0x12'));var logger=require(_0x7b4b('0x13'))('api');var utils=require(_0x7b4b('0x14'));var config=require(_0x7b4b('0x15'));var licenseUtil=require(_0x7b4b('0x16'));var db=require(_0x7b4b('0x17'))['db'];function respondWithStatusCode(_0x3be6f0,_0x1bba62){_0x1bba62=_0x1bba62||0xcc;return function(_0x58dbd2){if(_0x58dbd2){return _0x3be6f0[_0x7b4b('0x18')](_0x1bba62);}return _0x3be6f0[_0x7b4b('0x19')](_0x1bba62)[_0x7b4b('0x1a')]();};}function respondWithResult(_0x1946e1,_0x1911f6){_0x1911f6=_0x1911f6||0xc8;return function(_0x5cb297){if(_0x5cb297){return _0x1946e1[_0x7b4b('0x19')](_0x1911f6)['json'](_0x5cb297);}};}function respondWithFilteredResult(_0x25b45d,_0x5a4376){return function(_0x3d9349){if(_0x3d9349){var _0x4053bb=typeof _0x5a4376[_0x7b4b('0x1b')]===_0x7b4b('0x1c')&&typeof _0x5a4376[_0x7b4b('0x1d')]===_0x7b4b('0x1c');var _0x345429=_0x3d9349['count'];var _0x451dd5=_0x4053bb?0x0:_0x5a4376[_0x7b4b('0x1b')];var _0x25cfcc=_0x4053bb?_0x3d9349[_0x7b4b('0x1e')]:_0x5a4376[_0x7b4b('0x1b')]+_0x5a4376[_0x7b4b('0x1d')];var _0xec8171;if(_0x25cfcc>=_0x345429){_0x25cfcc=_0x345429;_0xec8171=0xc8;}else{_0xec8171=0xce;}_0x25b45d[_0x7b4b('0x19')](_0xec8171);return _0x25b45d['set'](_0x7b4b('0x1f'),_0x451dd5+'-'+_0x25cfcc+'/'+_0x345429)['json'](_0x3d9349);}return null;};}function patchUpdates(_0x4ded2c){return function(_0x4dcd57){try{jsonpatch[_0x7b4b('0x20')](_0x4dcd57,_0x4ded2c,!![]);}catch(_0x543163){return BPromise[_0x7b4b('0x21')](_0x543163);}return _0x4dcd57[_0x7b4b('0x22')]();};}function saveUpdates(_0x4c1612,_0x483a6e){return function(_0x558bad){if(_0x558bad){return _0x558bad['update'](_0x4c1612)[_0x7b4b('0x23')](function(_0x53f4c7){return _0x53f4c7;});}return null;};}function removeEntity(_0x40d8e1,_0x21c2e8){return function(_0x5787e0){if(_0x5787e0){return _0x5787e0[_0x7b4b('0x24')]()['then'](function(){_0x40d8e1[_0x7b4b('0x19')](0xcc)[_0x7b4b('0x1a')]();});}};}function handleEntityNotFound(_0x475499,_0x3bd146){return function(_0x263f0a){if(!_0x263f0a){_0x475499['sendStatus'](0x194);}return _0x263f0a;};}function handleError(_0x46f485,_0x21ef47){_0x21ef47=_0x21ef47||0x1f4;return function(_0x5b9de7){logger[_0x7b4b('0x25')](_0x5b9de7[_0x7b4b('0x26')]);if(_0x5b9de7[_0x7b4b('0x27')]){delete _0x5b9de7[_0x7b4b('0x27')];}_0x46f485[_0x7b4b('0x19')](_0x21ef47)['send'](_0x5b9de7);};}exports[_0x7b4b('0x28')]=function(_0x257597,_0x42c672){var _0x1043b6={},_0x5d3edc={},_0x520237={'count':0x0,'rows':[]};var _0x4ee0c3=_['map'](db['AnalyticTreeReport']['rawAttributes'],function(_0x195792){return{'name':_0x195792[_0x7b4b('0x29')],'type':_0x195792[_0x7b4b('0x2a')][_0x7b4b('0x2b')]};});_0x5d3edc[_0x7b4b('0x2c')]=_['map'](_0x4ee0c3,_0x7b4b('0x27'));_0x5d3edc[_0x7b4b('0x2d')]=_[_0x7b4b('0x2e')](_0x257597[_0x7b4b('0x2d')]);_0x5d3edc['filters']=_[_0x7b4b('0x2f')](_0x5d3edc[_0x7b4b('0x2c')],_0x5d3edc['query']);_0x1043b6['attributes']=_[_0x7b4b('0x2f')](_0x5d3edc['model'],qs[_0x7b4b('0x30')](_0x257597['query']['fields']));_0x1043b6[_0x7b4b('0x31')]=_0x1043b6[_0x7b4b('0x31')][_0x7b4b('0x32')]?_0x1043b6[_0x7b4b('0x31')]:_0x5d3edc[_0x7b4b('0x2c')];if(!_0x257597[_0x7b4b('0x2d')]['hasOwnProperty'](_0x7b4b('0x33'))){_0x1043b6[_0x7b4b('0x1d')]=qs[_0x7b4b('0x1d')](_0x257597[_0x7b4b('0x2d')][_0x7b4b('0x1d')]);_0x1043b6[_0x7b4b('0x1b')]=qs[_0x7b4b('0x1b')](_0x257597[_0x7b4b('0x2d')][_0x7b4b('0x1b')]);}_0x1043b6[_0x7b4b('0x34')]=qs[_0x7b4b('0x35')](_0x257597[_0x7b4b('0x2d')]['sort']);_0x1043b6['where']=qs[_0x7b4b('0x36')](_['pick'](_0x257597['query'],_0x5d3edc['filters']),_0x4ee0c3);if(_0x257597[_0x7b4b('0x2d')][_0x7b4b('0x37')]){_0x1043b6[_0x7b4b('0x38')]=_[_0x7b4b('0x39')](_0x1043b6[_0x7b4b('0x38')],{'$or':_[_0x7b4b('0x3a')](_0x4ee0c3,function(_0x250bd1){if(_0x250bd1[_0x7b4b('0x2a')]!==_0x7b4b('0x3b')){var _0x1617bd={};_0x1617bd[_0x250bd1['name']]={'$like':'%'+_0x257597['query'][_0x7b4b('0x37')]+'%'};return _0x1617bd;}})});}_0x1043b6=_[_0x7b4b('0x39')]({},_0x1043b6,_0x257597[_0x7b4b('0x3c')]);var _0xc29bc={'where':_0x1043b6[_0x7b4b('0x38')]};return db[_0x7b4b('0x3d')][_0x7b4b('0x1e')](_0xc29bc)[_0x7b4b('0x23')](function(_0x147afc){_0x520237[_0x7b4b('0x1e')]=_0x147afc;if(_0x257597[_0x7b4b('0x2d')][_0x7b4b('0x3e')]){_0x1043b6[_0x7b4b('0x3f')]=[{'all':!![]}];}return db[_0x7b4b('0x3d')][_0x7b4b('0x40')](_0x1043b6);})['then'](function(_0x2189e5){_0x520237[_0x7b4b('0x41')]=_0x2189e5;return _0x520237;})['then'](respondWithFilteredResult(_0x42c672,_0x1043b6))['catch'](handleError(_0x42c672,null));};exports[_0x7b4b('0x42')]=function(_0x773e6d,_0x83eda8){var _0x4a3723={'raw':!![],'where':{'id':_0x773e6d['params']['id']}},_0x23aacd={};_0x23aacd['model']=_['keys'](db[_0x7b4b('0x3d')][_0x7b4b('0x43')]);_0x23aacd[_0x7b4b('0x2d')]=_[_0x7b4b('0x2e')](_0x773e6d[_0x7b4b('0x2d')]);_0x23aacd[_0x7b4b('0x36')]=_[_0x7b4b('0x2f')](_0x23aacd[_0x7b4b('0x2c')],_0x23aacd[_0x7b4b('0x2d')]);_0x4a3723[_0x7b4b('0x31')]=_['intersection'](_0x23aacd[_0x7b4b('0x2c')],qs['fields'](_0x773e6d[_0x7b4b('0x2d')]['fields']));_0x4a3723['attributes']=_0x4a3723['attributes'][_0x7b4b('0x32')]?_0x4a3723[_0x7b4b('0x31')]:_0x23aacd[_0x7b4b('0x2c')];if(_0x773e6d[_0x7b4b('0x2d')][_0x7b4b('0x3e')]){_0x4a3723[_0x7b4b('0x3f')]=[{'all':!![]}];}_0x4a3723=_[_0x7b4b('0x39')]({},_0x4a3723,_0x773e6d[_0x7b4b('0x3c')]);return db[_0x7b4b('0x3d')][_0x7b4b('0x44')](_0x4a3723)['then'](handleEntityNotFound(_0x83eda8,null))[_0x7b4b('0x23')](respondWithResult(_0x83eda8,null))['catch'](handleError(_0x83eda8,null));};exports[_0x7b4b('0x45')]=function(_0x9cca88,_0x3afb08){return db[_0x7b4b('0x3d')][_0x7b4b('0x45')](_0x9cca88['body'],{})[_0x7b4b('0x23')](respondWithResult(_0x3afb08,0xc9))[_0x7b4b('0x46')](handleError(_0x3afb08,null));};exports['update']=function(_0x475568,_0x5e5d3f){if(_0x475568['body']['id']){delete _0x475568[_0x7b4b('0x47')]['id'];}return db[_0x7b4b('0x3d')][_0x7b4b('0x44')]({'where':{'id':_0x475568[_0x7b4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e5d3f,null))[_0x7b4b('0x23')](saveUpdates(_0x475568['body'],null))[_0x7b4b('0x23')](respondWithResult(_0x5e5d3f,null))['catch'](handleError(_0x5e5d3f,null));};exports['destroy']=function(_0x5d10ba,_0x566562){return db['AnalyticTreeReport'][_0x7b4b('0x44')]({'where':{'id':_0x5d10ba[_0x7b4b('0x48')]['id']}})[_0x7b4b('0x23')](handleEntityNotFound(_0x566562,null))['then'](removeEntity(_0x566562,null))[_0x7b4b('0x46')](handleError(_0x566562,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 67e30c2..0500fe7 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 _0x894f=['exports','analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x8e1290,_0x4afa81){var _0x17e43b=function(_0x16bacf){while(--_0x16bacf){_0x8e1290['push'](_0x8e1290['shift']());}};_0x17e43b(++_0x4afa81);}(_0x894f,0xf4));var _0xf894=function(_0xf9e9af,_0x385820){_0xf9e9af=_0xf9e9af-0x0;var _0x527419=_0x894f[_0xf9e9af];return _0x527419;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var logger=require(_0xf894('0x2'))(_0xf894('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf894('0x4'));var fs=require('fs');var path=require(_0xf894('0x5'));var rimraf=require(_0xf894('0x6'));var config=require(_0xf894('0x7'));var attributes=require(_0xf894('0x8'));module[_0xf894('0x9')]=function(_0x1b6732,_0x22f3d7){return _0x1b6732['define']('AnalyticTreeReport',attributes,{'tableName':_0xf894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe2f=['./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbe2f,0x72));var _0xfbe2=function(_0x15294b,_0x508f63){_0x15294b=_0x15294b-0x0;var _0x1b8041=_0xbe2f[_0x15294b];return _0x1b8041;};'use strict';var _=require(_0xfbe2('0x0'));var util=require(_0xfbe2('0x1'));var logger=require(_0xfbe2('0x2'))(_0xfbe2('0x3'));var moment=require('moment');var BPromise=require(_0xfbe2('0x4'));var rp=require(_0xfbe2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbe2('0x6'));var config=require('../../config/environment');var attributes=require(_0xfbe2('0x7'));module['exports']=function(_0x54b706,_0x4558fb){return _0x54b706[_0xfbe2('0x8')](_0xfbe2('0x9'),attributes,{'tableName':_0xfbe2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index e371eca..0f0b500 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5f3a24,_0x3ec2fa){var _0x24ac1d=function(_0xa56db2){while(--_0xa56db2){_0x5f3a24['push'](_0x5f3a24['shift']());}};_0x24ac1d(++_0x3ec2fa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32c037,_0x7bda34){_0x32c037=_0x32c037-0x0;var _0x3e1f71=_0x5f2f[_0x32c037];return _0x3e1f71;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x28d06c,_0xf80378){var _0x594317=function(_0x4f0187){while(--_0x4f0187){_0x28d06c['push'](_0x28d06c['shift']());}};_0x594317(++_0xf80378);}(_0xadb5,0xad));var _0x5adb=function(_0x1b42b4,_0x5a58db){_0x1b42b4=_0x1b42b4-0x0;var _0x40a7be=_0xadb5[_0x1b42b4];return _0x40a7be;};'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']('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b13de24..6c6902e 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 _0xac9b=['show','post','create','put','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x7782d7,_0xce2d0e){var _0x881ef7=function(_0x14cb6d){while(--_0x14cb6d){_0x7782d7['push'](_0x7782d7['shift']());}};_0x881ef7(++_0xce2d0e);}(_0xac9b,0xc1));var _0xbac9=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xac9b[_0x4704dc];return _0x254d81;};'use strict';var multer=require(_0xbac9('0x0'));var util=require(_0xbac9('0x1'));var path=require(_0xbac9('0x2'));var timeout=require('connect-timeout');var express=require(_0xbac9('0x3'));var router=express[_0xbac9('0x4')]();var fs_extra=require(_0xbac9('0x5'));var auth=require(_0xbac9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbac9('0x7'));var controller=require(_0xbac9('0x8'));router[_0xbac9('0x9')]('/',auth[_0xbac9('0xa')](),controller['index']);router[_0xbac9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbac9('0xb')]);router[_0xbac9('0xc')]('/',auth[_0xbac9('0xa')](),controller[_0xbac9('0xd')]);router[_0xbac9('0xe')](_0xbac9('0xf'),auth[_0xbac9('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbac9('0x10')]=router; \ No newline at end of file +var _0xae7a=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x5cb537,_0x574c06){var _0x4eb6ec=function(_0x4a1885){while(--_0x4a1885){_0x5cb537['push'](_0x5cb537['shift']());}};_0x4eb6ec(++_0x574c06);}(_0xae7a,0xcb));var _0xaae7=function(_0x5e8398,_0x1b4120){_0x5e8398=_0x5e8398-0x0;var _0x192dc6=_0xae7a[_0x5e8398];return _0x192dc6;};'use strict';var multer=require(_0xaae7('0x0'));var util=require(_0xaae7('0x1'));var path=require(_0xaae7('0x2'));var timeout=require(_0xaae7('0x3'));var express=require(_0xaae7('0x4'));var router=express['Router']();var fs_extra=require(_0xaae7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaae7('0x6'));var config=require(_0xaae7('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xaae7('0x8')]('/',auth[_0xaae7('0x9')](),controller['index']);router['get'](_0xaae7('0xa'),auth[_0xaae7('0x9')](),controller[_0xaae7('0xb')]);router['post']('/',auth[_0xaae7('0x9')](),controller[_0xaae7('0xc')]);router[_0xaae7('0xd')](_0xaae7('0xa'),auth[_0xaae7('0x9')](),controller[_0xaae7('0xe')]);router['delete'](_0xaae7('0xa'),auth['isAuthenticated'](),controller[_0xaae7('0xf')]);module[_0xaae7('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2d2a020..97f4068 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 _0x1280=['sequelize','exports','STRING'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x1280,0xba));var _0x0128=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0x1280[_0x3cbe3a];return _0x24ffc1;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'name':{'type':Sequelize[_0x0128('0x2')]},'basename':{'type':Sequelize[_0x0128('0x2')]},'type':{'type':Sequelize[_0x0128('0x2')]}}; \ No newline at end of file +var _0x32ef=['sequelize','exports','STRING'];(function(_0xb2443d,_0x1617e1){var _0x227b2f=function(_0x4661d2){while(--_0x4661d2){_0xb2443d['push'](_0xb2443d['shift']());}};_0x227b2f(++_0x1617e1);}(_0x32ef,0xf9));var _0xf32e=function(_0x900479,_0x1e5efc){_0x900479=_0x900479-0x0;var _0x5d44c2=_0x32ef[_0x900479];return _0x5d44c2;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'name':{'type':Sequelize[_0xf32e('0x2')]},'basename':{'type':Sequelize[_0xf32e('0x2')]},'type':{'type':Sequelize[_0xf32e('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e6bacdd..5a8645f 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 _0x84f9=['attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','clone','get','omit','updatedAt','body','createdAt','create','find','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Attachment','key','model','query','keys','filters','intersection'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x84f9,0xde));var _0x984f=function(_0xf67f9a,_0x164ef4){_0xf67f9a=_0xf67f9a-0x0;var _0xdd0dc3=_0x84f9[_0xf67f9a];return _0xdd0dc3;};'use strict';var emlformat=require(_0x984f('0x0'));var rimraf=require(_0x984f('0x1'));var zipdir=require(_0x984f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x984f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x984f('0x4'));var util=require(_0x984f('0x5'));var path=require(_0x984f('0x6'));var sox=require('sox');var csv=require(_0x984f('0x7'));var ejs=require(_0x984f('0x8'));var fs=require('fs');var fs_extra=require(_0x984f('0x9'));var _=require(_0x984f('0xa'));var squel=require(_0x984f('0xb'));var crypto=require(_0x984f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x984f('0xd'));var toCsv=require(_0x984f('0x7'));var querystring=require(_0x984f('0xe'));var Papa=require(_0x984f('0xf'));var Redis=require(_0x984f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x984f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x984f('0x12'));var licenseUtil=require(_0x984f('0x13'));var db=require(_0x984f('0x14'))['db'];function respondWithStatusCode(_0x40e63a,_0x3de318){_0x3de318=_0x3de318||0xcc;return function(_0x14e90c){if(_0x14e90c){return _0x40e63a[_0x984f('0x15')](_0x3de318);}return _0x40e63a[_0x984f('0x16')](_0x3de318)[_0x984f('0x17')]();};}function respondWithResult(_0x2dd5de,_0x32f9eb){_0x32f9eb=_0x32f9eb||0xc8;return function(_0xdafeb7){if(_0xdafeb7){return _0x2dd5de['status'](_0x32f9eb)[_0x984f('0x18')](_0xdafeb7);}};}function respondWithFilteredResult(_0x5092df,_0x2e7caa){return function(_0x19685f){if(_0x19685f){var _0x40b887=typeof _0x2e7caa[_0x984f('0x19')]==='undefined'&&typeof _0x2e7caa[_0x984f('0x1a')]===_0x984f('0x1b');var _0x443638=_0x19685f['count'];var _0xe0f4b7=_0x40b887?0x0:_0x2e7caa[_0x984f('0x19')];var _0x533887=_0x40b887?_0x19685f[_0x984f('0x1c')]:_0x2e7caa[_0x984f('0x19')]+_0x2e7caa[_0x984f('0x1a')];var _0x779125;if(_0x533887>=_0x443638){_0x533887=_0x443638;_0x779125=0xc8;}else{_0x779125=0xce;}_0x5092df[_0x984f('0x16')](_0x779125);return _0x5092df[_0x984f('0x1d')](_0x984f('0x1e'),_0xe0f4b7+'-'+_0x533887+'/'+_0x443638)[_0x984f('0x18')](_0x19685f);}return null;};}function patchUpdates(_0x443727){return function(_0xc8610f){try{jsonpatch[_0x984f('0x1f')](_0xc8610f,_0x443727,!![]);}catch(_0x1a0db0){return BPromise[_0x984f('0x20')](_0x1a0db0);}return _0xc8610f['save']();};}function saveUpdates(_0x113cc9,_0x2c5a0d){return function(_0x11b865){if(_0x11b865){return _0x11b865[_0x984f('0x21')](_0x113cc9)[_0x984f('0x22')](function(_0x67d58c){return _0x67d58c;});}return null;};}function removeEntity(_0x224b51,_0x31dcaa){return function(_0x46647a){if(_0x46647a){return _0x46647a['destroy']()[_0x984f('0x22')](function(){_0x224b51[_0x984f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbacc9b,_0x7f7349){return function(_0x2fdbb3){if(!_0x2fdbb3){_0xbacc9b[_0x984f('0x15')](0x194);}return _0x2fdbb3;};}function handleError(_0x4a6691,_0x28332d){_0x28332d=_0x28332d||0x1f4;return function(_0x33439d){logger[_0x984f('0x23')](_0x33439d[_0x984f('0x24')]);if(_0x33439d[_0x984f('0x25')]){delete _0x33439d[_0x984f('0x25')];}_0x4a6691[_0x984f('0x16')](_0x28332d)[_0x984f('0x26')](_0x33439d);};}exports[_0x984f('0x27')]=function(_0x313d0c,_0x56d71d){var _0x53d93f={},_0x1bf5dd={},_0x41d740={'count':0x0,'rows':[]};var _0x425e35=_[_0x984f('0x28')](db[_0x984f('0x29')]['rawAttributes'],function(_0x48c906){return{'name':_0x48c906['fieldName'],'type':_0x48c906['type'][_0x984f('0x2a')]};});_0x1bf5dd[_0x984f('0x2b')]=_[_0x984f('0x28')](_0x425e35,_0x984f('0x25'));_0x1bf5dd[_0x984f('0x2c')]=_[_0x984f('0x2d')](_0x313d0c[_0x984f('0x2c')]);_0x1bf5dd[_0x984f('0x2e')]=_[_0x984f('0x2f')](_0x1bf5dd[_0x984f('0x2b')],_0x1bf5dd[_0x984f('0x2c')]);_0x53d93f[_0x984f('0x30')]=_[_0x984f('0x2f')](_0x1bf5dd[_0x984f('0x2b')],qs[_0x984f('0x31')](_0x313d0c[_0x984f('0x2c')]['fields']));_0x53d93f['attributes']=_0x53d93f[_0x984f('0x30')]['length']?_0x53d93f['attributes']:_0x1bf5dd[_0x984f('0x2b')];if(!_0x313d0c[_0x984f('0x2c')]['hasOwnProperty'](_0x984f('0x32'))){_0x53d93f[_0x984f('0x1a')]=qs[_0x984f('0x1a')](_0x313d0c[_0x984f('0x2c')][_0x984f('0x1a')]);_0x53d93f[_0x984f('0x19')]=qs[_0x984f('0x19')](_0x313d0c[_0x984f('0x2c')][_0x984f('0x19')]);}_0x53d93f[_0x984f('0x33')]=qs[_0x984f('0x34')](_0x313d0c[_0x984f('0x2c')][_0x984f('0x34')]);_0x53d93f[_0x984f('0x35')]=qs[_0x984f('0x2e')](_[_0x984f('0x36')](_0x313d0c['query'],_0x1bf5dd['filters']),_0x425e35);if(_0x313d0c[_0x984f('0x2c')][_0x984f('0x37')]){_0x53d93f[_0x984f('0x35')]=_[_0x984f('0x38')](_0x53d93f[_0x984f('0x35')],{'$or':_[_0x984f('0x28')](_0x425e35,function(_0x557287){if(_0x557287[_0x984f('0x39')]!==_0x984f('0x3a')){var _0x5ca913={};_0x5ca913[_0x557287[_0x984f('0x25')]]={'$like':'%'+_0x313d0c[_0x984f('0x2c')][_0x984f('0x37')]+'%'};return _0x5ca913;}})});}_0x53d93f=_[_0x984f('0x38')]({},_0x53d93f,_0x313d0c[_0x984f('0x3b')]);var _0x3f2111={'where':_0x53d93f['where']};return db['Attachment'][_0x984f('0x1c')](_0x3f2111)[_0x984f('0x22')](function(_0xb1a230){_0x41d740['count']=_0xb1a230;if(_0x313d0c[_0x984f('0x2c')][_0x984f('0x3c')]){_0x53d93f[_0x984f('0x3d')]=[{'all':!![]}];}return db[_0x984f('0x29')][_0x984f('0x3e')](_0x53d93f);})[_0x984f('0x22')](function(_0x1e6d19){_0x41d740[_0x984f('0x3f')]=_0x1e6d19;return _0x41d740;})[_0x984f('0x22')](respondWithFilteredResult(_0x56d71d,_0x53d93f))[_0x984f('0x40')](handleError(_0x56d71d,null));};exports[_0x984f('0x41')]=function(_0x1c76ef,_0x4a92aa){var _0x45321b={'raw':!![],'where':{'id':_0x1c76ef[_0x984f('0x42')]['id']}},_0x9e082b={};_0x9e082b[_0x984f('0x2b')]=_[_0x984f('0x2d')](db[_0x984f('0x29')][_0x984f('0x43')]);_0x9e082b[_0x984f('0x2c')]=_['keys'](_0x1c76ef[_0x984f('0x2c')]);_0x9e082b[_0x984f('0x2e')]=_[_0x984f('0x2f')](_0x9e082b['model'],_0x9e082b['query']);_0x45321b[_0x984f('0x30')]=_[_0x984f('0x2f')](_0x9e082b[_0x984f('0x2b')],qs['fields'](_0x1c76ef[_0x984f('0x2c')][_0x984f('0x31')]));_0x45321b[_0x984f('0x30')]=_0x45321b[_0x984f('0x30')][_0x984f('0x44')]?_0x45321b[_0x984f('0x30')]:_0x9e082b[_0x984f('0x2b')];if(_0x1c76ef['query']['includeAll']){_0x45321b[_0x984f('0x3d')]=[{'all':!![]}];}_0x45321b=_[_0x984f('0x38')]({},_0x45321b,_0x1c76ef['options']);return db[_0x984f('0x29')]['find'](_0x45321b)[_0x984f('0x22')](handleEntityNotFound(_0x4a92aa,null))[_0x984f('0x22')](respondWithResult(_0x4a92aa,null))[_0x984f('0x40')](handleError(_0x4a92aa,null));};exports[_0x984f('0x45')]=function(_0x4fe305,_0x3f0215){var _0x20a3bc={'where':{'id':_0x4fe305[_0x984f('0x42')]['id']}},_0x33ed43={};_0x33ed43[_0x984f('0x2b')]=_[_0x984f('0x2d')](db[_0x984f('0x29')][_0x984f('0x43')]);_0x20a3bc[_0x984f('0x30')]=_[_0x984f('0x2f')](_0x33ed43[_0x984f('0x2b')],qs[_0x984f('0x31')](_0x4fe305['query']['fields']));_0x20a3bc[_0x984f('0x30')]=_0x20a3bc[_0x984f('0x30')][_0x984f('0x44')]?_0x20a3bc[_0x984f('0x30')]:_0x33ed43[_0x984f('0x2b')];if(_0x4fe305['query']['includeAll']){_0x20a3bc[_0x984f('0x3d')]=[{'all':!![]}];}_0x20a3bc=_[_0x984f('0x38')]({},_0x20a3bc,_0x4fe305[_0x984f('0x3b')]);return db[_0x984f('0x29')]['find'](_0x20a3bc)[_0x984f('0x22')](handleEntityNotFound(_0x3f0215,null))['then'](function(_0x117557){if(_0x117557){var _0x1131d1=_0x117557[_0x984f('0x46')]({'plain':!![]});_0x1131d1=qs[_0x984f('0x47')](_0x1131d1,['id','createdAt',_0x984f('0x48')]);_0x4fe305[_0x984f('0x49')]=_['omit'](_0x4fe305['body'],['id',_0x984f('0x4a'),'updatedAt']);return db[_0x984f('0x29')][_0x984f('0x4b')](_['merge'](_0x1131d1,_0x4fe305[_0x984f('0x49')]),{'include':_0x4fe305[_0x984f('0x2c')][_0x984f('0x3c')]?[{'all':!![]}]:undefined});}})[_0x984f('0x22')](respondWithResult(_0x3f0215,0xc9))[_0x984f('0x40')](handleError(_0x3f0215,null));};exports[_0x984f('0x21')]=function(_0x113584,_0x5c6c87){if(_0x113584[_0x984f('0x49')]['id']){delete _0x113584[_0x984f('0x49')]['id'];}return db[_0x984f('0x29')][_0x984f('0x4c')]({'where':{'id':_0x113584['params']['id']}})[_0x984f('0x22')](handleEntityNotFound(_0x5c6c87,null))['then'](saveUpdates(_0x113584[_0x984f('0x49')],null))[_0x984f('0x22')](respondWithResult(_0x5c6c87,null))[_0x984f('0x40')](handleError(_0x5c6c87,null));};exports[_0x984f('0x4d')]=function(_0x363814,_0x57de31){return db[_0x984f('0x29')][_0x984f('0x4c')]({'where':{'id':_0x363814[_0x984f('0x42')]['id']}})['then'](handleEntityNotFound(_0x57de31,null))['then'](removeEntity(_0x57de31,null))['catch'](handleError(_0x57de31,null));};exports[_0x984f('0x4b')]=function(_0x42363f,_0xba30dd,_0x26a1c9){_0x42363f[_0x984f('0x49')][_0x984f('0x25')]=_0x42363f[_0x984f('0x4e')][_0x984f('0x4f')];_0x42363f['body'][_0x984f('0x50')]=_0x42363f[_0x984f('0x4e')][_0x984f('0x51')];_0x42363f[_0x984f('0x49')][_0x984f('0x39')]=_0x42363f[_0x984f('0x4e')][_0x984f('0x52')];return db[_0x984f('0x29')][_0x984f('0x4b')](_0x42363f[_0x984f('0x49')])[_0x984f('0x22')](respondWithResult(_0xba30dd,0xc9))[_0x984f('0x40')](handleError(_0xba30dd,null));};exports[_0x984f('0x53')]=function(_0x3bc29f,_0x5b12c9,_0x2be444){return db[_0x984f('0x29')][_0x984f('0x54')]({'where':{'id':_0x3bc29f['params']['id']},'raw':!![]})[_0x984f('0x22')](handleEntityNotFound(_0x5b12c9,null))[_0x984f('0x22')](function(_0x52f460){if(_0x52f460){var _0x530010=_0x52f460[_0x984f('0x55')]!==null;var _0x52ecf3=path[_0x984f('0x56')](config[_0x984f('0x57')],_0x984f('0x58'));if(_0x530010){_0x52ecf3=path[_0x984f('0x56')](_0x52ecf3,_0x984f('0x59'));}var _0x4d33f7=path[_0x984f('0x56')](_0x52ecf3,_0x52f460[_0x984f('0x50')]);return _0x5b12c9[_0x984f('0x53')](_0x4d33f7);}})[_0x984f('0x40')](handleError(_0x5b12c9,null));}; \ No newline at end of file +var _0xb2f8=['then','destroy','error','stack','name','send','index','Attachment','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','clone','get','createdAt','updatedAt','omit','body','update','create','originalname','basename','file','filename','mimetype','download','findOne','join','server/files/attachments/','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x5af95b,_0x4ea204){var _0x57c65f=function(_0x379139){while(--_0x379139){_0x5af95b['push'](_0x5af95b['shift']());}};_0x57c65f(++_0x4ea204);}(_0xb2f8,0x145));var _0x8b2f=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xb2f8[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require(_0x8b2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b2f('0x1'));var rp=require(_0x8b2f('0x2'));var moment=require('moment');var BPromise=require(_0x8b2f('0x3'));var Mustache=require(_0x8b2f('0x4'));var util=require(_0x8b2f('0x5'));var path=require(_0x8b2f('0x6'));var sox=require('sox');var csv=require(_0x8b2f('0x7'));var ejs=require(_0x8b2f('0x8'));var fs=require('fs');var fs_extra=require(_0x8b2f('0x9'));var _=require('lodash');var squel=require(_0x8b2f('0xa'));var crypto=require(_0x8b2f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b2f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8b2f('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b2f('0xe'));var authService=require(_0x8b2f('0xf'));var qs=require(_0x8b2f('0x10'));var as=require(_0x8b2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b2f('0x12'));var utils=require(_0x8b2f('0x13'));var config=require(_0x8b2f('0x14'));var licenseUtil=require(_0x8b2f('0x15'));var db=require(_0x8b2f('0x16'))['db'];function respondWithStatusCode(_0x26bf2d,_0x5b086e){_0x5b086e=_0x5b086e||0xcc;return function(_0x252353){if(_0x252353){return _0x26bf2d[_0x8b2f('0x17')](_0x5b086e);}return _0x26bf2d[_0x8b2f('0x18')](_0x5b086e)[_0x8b2f('0x19')]();};}function respondWithResult(_0x51cdb7,_0x548751){_0x548751=_0x548751||0xc8;return function(_0x3be344){if(_0x3be344){return _0x51cdb7[_0x8b2f('0x18')](_0x548751)[_0x8b2f('0x1a')](_0x3be344);}};}function respondWithFilteredResult(_0x5637ab,_0x234a4b){return function(_0x33c0a8){if(_0x33c0a8){var _0x302dc1=typeof _0x234a4b[_0x8b2f('0x1b')]===_0x8b2f('0x1c')&&typeof _0x234a4b[_0x8b2f('0x1d')]===_0x8b2f('0x1c');var _0x40eac3=_0x33c0a8[_0x8b2f('0x1e')];var _0x1be94c=_0x302dc1?0x0:_0x234a4b[_0x8b2f('0x1b')];var _0x1b7a4c=_0x302dc1?_0x33c0a8['count']:_0x234a4b[_0x8b2f('0x1b')]+_0x234a4b[_0x8b2f('0x1d')];var _0x41b271;if(_0x1b7a4c>=_0x40eac3){_0x1b7a4c=_0x40eac3;_0x41b271=0xc8;}else{_0x41b271=0xce;}_0x5637ab[_0x8b2f('0x18')](_0x41b271);return _0x5637ab[_0x8b2f('0x1f')](_0x8b2f('0x20'),_0x1be94c+'-'+_0x1b7a4c+'/'+_0x40eac3)['json'](_0x33c0a8);}return null;};}function patchUpdates(_0x3f0017){return function(_0x83c992){try{jsonpatch[_0x8b2f('0x21')](_0x83c992,_0x3f0017,!![]);}catch(_0x11d8e7){return BPromise[_0x8b2f('0x22')](_0x11d8e7);}return _0x83c992['save']();};}function saveUpdates(_0x3b4f81,_0x2bef90){return function(_0x17fef3){if(_0x17fef3){return _0x17fef3['update'](_0x3b4f81)[_0x8b2f('0x23')](function(_0x5c81a4){return _0x5c81a4;});}return null;};}function removeEntity(_0x56cb03,_0x5ac304){return function(_0x5a69e0){if(_0x5a69e0){return _0x5a69e0[_0x8b2f('0x24')]()['then'](function(){_0x56cb03['status'](0xcc)[_0x8b2f('0x19')]();});}};}function handleEntityNotFound(_0x2ac6c9,_0x462b0f){return function(_0x4f23d2){if(!_0x4f23d2){_0x2ac6c9['sendStatus'](0x194);}return _0x4f23d2;};}function handleError(_0x23f5e3,_0x21fc57){_0x21fc57=_0x21fc57||0x1f4;return function(_0x3d79d3){logger[_0x8b2f('0x25')](_0x3d79d3[_0x8b2f('0x26')]);if(_0x3d79d3[_0x8b2f('0x27')]){delete _0x3d79d3['name'];}_0x23f5e3[_0x8b2f('0x18')](_0x21fc57)[_0x8b2f('0x28')](_0x3d79d3);};}exports[_0x8b2f('0x29')]=function(_0x38857e,_0x1021d6){var _0x52fbe3={},_0x7543c6={},_0x246095={'count':0x0,'rows':[]};var _0x398587=_['map'](db[_0x8b2f('0x2a')]['rawAttributes'],function(_0x3dc404){return{'name':_0x3dc404[_0x8b2f('0x2b')],'type':_0x3dc404[_0x8b2f('0x2c')][_0x8b2f('0x2d')]};});_0x7543c6[_0x8b2f('0x2e')]=_[_0x8b2f('0x2f')](_0x398587,_0x8b2f('0x27'));_0x7543c6[_0x8b2f('0x30')]=_['keys'](_0x38857e[_0x8b2f('0x30')]);_0x7543c6[_0x8b2f('0x31')]=_[_0x8b2f('0x32')](_0x7543c6['model'],_0x7543c6[_0x8b2f('0x30')]);_0x52fbe3[_0x8b2f('0x33')]=_[_0x8b2f('0x32')](_0x7543c6[_0x8b2f('0x2e')],qs[_0x8b2f('0x34')](_0x38857e[_0x8b2f('0x30')][_0x8b2f('0x34')]));_0x52fbe3['attributes']=_0x52fbe3[_0x8b2f('0x33')][_0x8b2f('0x35')]?_0x52fbe3[_0x8b2f('0x33')]:_0x7543c6[_0x8b2f('0x2e')];if(!_0x38857e['query'][_0x8b2f('0x36')](_0x8b2f('0x37'))){_0x52fbe3[_0x8b2f('0x1d')]=qs[_0x8b2f('0x1d')](_0x38857e['query']['limit']);_0x52fbe3[_0x8b2f('0x1b')]=qs[_0x8b2f('0x1b')](_0x38857e[_0x8b2f('0x30')][_0x8b2f('0x1b')]);}_0x52fbe3[_0x8b2f('0x38')]=qs[_0x8b2f('0x39')](_0x38857e[_0x8b2f('0x30')]['sort']);_0x52fbe3[_0x8b2f('0x3a')]=qs['filters'](_[_0x8b2f('0x3b')](_0x38857e['query'],_0x7543c6[_0x8b2f('0x31')]),_0x398587);if(_0x38857e[_0x8b2f('0x30')][_0x8b2f('0x3c')]){_0x52fbe3[_0x8b2f('0x3a')]=_[_0x8b2f('0x3d')](_0x52fbe3[_0x8b2f('0x3a')],{'$or':_[_0x8b2f('0x2f')](_0x398587,function(_0x371fe4){if(_0x371fe4[_0x8b2f('0x2c')]!=='VIRTUAL'){var _0x13071d={};_0x13071d[_0x371fe4[_0x8b2f('0x27')]]={'$like':'%'+_0x38857e[_0x8b2f('0x30')][_0x8b2f('0x3c')]+'%'};return _0x13071d;}})});}_0x52fbe3=_['merge']({},_0x52fbe3,_0x38857e[_0x8b2f('0x3e')]);var _0x52b324={'where':_0x52fbe3[_0x8b2f('0x3a')]};return db[_0x8b2f('0x2a')][_0x8b2f('0x1e')](_0x52b324)['then'](function(_0x187ab6){_0x246095['count']=_0x187ab6;if(_0x38857e['query'][_0x8b2f('0x3f')]){_0x52fbe3[_0x8b2f('0x40')]=[{'all':!![]}];}return db[_0x8b2f('0x2a')][_0x8b2f('0x41')](_0x52fbe3);})[_0x8b2f('0x23')](function(_0x228d0){_0x246095[_0x8b2f('0x42')]=_0x228d0;return _0x246095;})[_0x8b2f('0x23')](respondWithFilteredResult(_0x1021d6,_0x52fbe3))[_0x8b2f('0x43')](handleError(_0x1021d6,null));};exports[_0x8b2f('0x44')]=function(_0x419d21,_0x12e4c4){var _0x2bb63a={'raw':!![],'where':{'id':_0x419d21[_0x8b2f('0x45')]['id']}},_0x29e095={};_0x29e095[_0x8b2f('0x2e')]=_[_0x8b2f('0x46')](db[_0x8b2f('0x2a')][_0x8b2f('0x47')]);_0x29e095[_0x8b2f('0x30')]=_[_0x8b2f('0x46')](_0x419d21[_0x8b2f('0x30')]);_0x29e095[_0x8b2f('0x31')]=_['intersection'](_0x29e095[_0x8b2f('0x2e')],_0x29e095['query']);_0x2bb63a[_0x8b2f('0x33')]=_[_0x8b2f('0x32')](_0x29e095[_0x8b2f('0x2e')],qs['fields'](_0x419d21[_0x8b2f('0x30')]['fields']));_0x2bb63a['attributes']=_0x2bb63a['attributes']['length']?_0x2bb63a['attributes']:_0x29e095[_0x8b2f('0x2e')];if(_0x419d21[_0x8b2f('0x30')][_0x8b2f('0x3f')]){_0x2bb63a[_0x8b2f('0x40')]=[{'all':!![]}];}_0x2bb63a=_['merge']({},_0x2bb63a,_0x419d21[_0x8b2f('0x3e')]);return db[_0x8b2f('0x2a')][_0x8b2f('0x48')](_0x2bb63a)[_0x8b2f('0x23')](handleEntityNotFound(_0x12e4c4,null))[_0x8b2f('0x23')](respondWithResult(_0x12e4c4,null))['catch'](handleError(_0x12e4c4,null));};exports[_0x8b2f('0x49')]=function(_0x3636b6,_0x3f45fb){var _0x779464={'where':{'id':_0x3636b6[_0x8b2f('0x45')]['id']}},_0x5de2fb={};_0x5de2fb['model']=_[_0x8b2f('0x46')](db['Attachment'][_0x8b2f('0x47')]);_0x779464[_0x8b2f('0x33')]=_[_0x8b2f('0x32')](_0x5de2fb[_0x8b2f('0x2e')],qs[_0x8b2f('0x34')](_0x3636b6[_0x8b2f('0x30')][_0x8b2f('0x34')]));_0x779464[_0x8b2f('0x33')]=_0x779464[_0x8b2f('0x33')][_0x8b2f('0x35')]?_0x779464['attributes']:_0x5de2fb[_0x8b2f('0x2e')];if(_0x3636b6[_0x8b2f('0x30')][_0x8b2f('0x3f')]){_0x779464[_0x8b2f('0x40')]=[{'all':!![]}];}_0x779464=_[_0x8b2f('0x3d')]({},_0x779464,_0x3636b6[_0x8b2f('0x3e')]);return db[_0x8b2f('0x2a')][_0x8b2f('0x48')](_0x779464)[_0x8b2f('0x23')](handleEntityNotFound(_0x3f45fb,null))[_0x8b2f('0x23')](function(_0x1c61b7){if(_0x1c61b7){var _0x56196d=_0x1c61b7[_0x8b2f('0x4a')]({'plain':!![]});_0x56196d=qs['omit'](_0x56196d,['id',_0x8b2f('0x4b'),_0x8b2f('0x4c')]);_0x3636b6['body']=_[_0x8b2f('0x4d')](_0x3636b6['body'],['id',_0x8b2f('0x4b'),'updatedAt']);return db[_0x8b2f('0x2a')]['create'](_['merge'](_0x56196d,_0x3636b6[_0x8b2f('0x4e')]),{'include':_0x3636b6[_0x8b2f('0x30')][_0x8b2f('0x3f')]?[{'all':!![]}]:undefined});}})[_0x8b2f('0x23')](respondWithResult(_0x3f45fb,0xc9))[_0x8b2f('0x43')](handleError(_0x3f45fb,null));};exports[_0x8b2f('0x4f')]=function(_0x39732b,_0x57e999){if(_0x39732b[_0x8b2f('0x4e')]['id']){delete _0x39732b[_0x8b2f('0x4e')]['id'];}return db[_0x8b2f('0x2a')]['find']({'where':{'id':_0x39732b['params']['id']}})[_0x8b2f('0x23')](handleEntityNotFound(_0x57e999,null))['then'](saveUpdates(_0x39732b[_0x8b2f('0x4e')],null))[_0x8b2f('0x23')](respondWithResult(_0x57e999,null))[_0x8b2f('0x43')](handleError(_0x57e999,null));};exports[_0x8b2f('0x24')]=function(_0x52b63e,_0x4bfc62){return db[_0x8b2f('0x2a')][_0x8b2f('0x48')]({'where':{'id':_0x52b63e[_0x8b2f('0x45')]['id']}})[_0x8b2f('0x23')](handleEntityNotFound(_0x4bfc62,null))[_0x8b2f('0x23')](removeEntity(_0x4bfc62,null))[_0x8b2f('0x43')](handleError(_0x4bfc62,null));};exports[_0x8b2f('0x50')]=function(_0x1a48b2,_0x4305a6,_0x142d42){_0x1a48b2[_0x8b2f('0x4e')][_0x8b2f('0x27')]=_0x1a48b2['file'][_0x8b2f('0x51')];_0x1a48b2[_0x8b2f('0x4e')][_0x8b2f('0x52')]=_0x1a48b2[_0x8b2f('0x53')][_0x8b2f('0x54')];_0x1a48b2[_0x8b2f('0x4e')][_0x8b2f('0x2c')]=_0x1a48b2[_0x8b2f('0x53')][_0x8b2f('0x55')];return db[_0x8b2f('0x2a')]['create'](_0x1a48b2['body'])[_0x8b2f('0x23')](respondWithResult(_0x4305a6,0xc9))[_0x8b2f('0x43')](handleError(_0x4305a6,null));};exports[_0x8b2f('0x56')]=function(_0x582f61,_0x48dbe4,_0x30b555){return db['Attachment'][_0x8b2f('0x57')]({'where':{'id':_0x582f61[_0x8b2f('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x48dbe4,null))[_0x8b2f('0x23')](function(_0x5ccce9){if(_0x5ccce9){var _0x23cacf=_0x5ccce9['ChatOfflineMessageId']!==null;var _0x25bfde=path[_0x8b2f('0x58')](config['root'],_0x8b2f('0x59'));if(_0x23cacf){_0x25bfde=path[_0x8b2f('0x58')](_0x25bfde,'offline-chat/');}var _0xd100e7=path[_0x8b2f('0x58')](_0x25bfde,_0x5ccce9[_0x8b2f('0x52')]);return _0x48dbe4['download'](_0xd100e7);}})[_0x8b2f('0x43')](handleError(_0x48dbe4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a72196c..fdd407c 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 _0xe6d3=['request-promise','path','rimraf','exports','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0xe6d3,0xf6));var _0x3e6d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe6d3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x3e6d('0x0'));var util=require(_0x3e6d('0x1'));var logger=require(_0x3e6d('0x2'))(_0x3e6d('0x3'));var moment=require(_0x3e6d('0x4'));var BPromise=require(_0x3e6d('0x5'));var rp=require(_0x3e6d('0x6'));var fs=require('fs');var path=require(_0x3e6d('0x7'));var rimraf=require(_0x3e6d('0x8'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x3e6d('0x9')]=function(_0x42cadc,_0x527676){return _0x42cadc['define'](_0x3e6d('0xa'),attributes,{'tableName':_0x3e6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b8b=['rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger','api','moment','request-promise'];(function(_0x34c886,_0x546999){var _0x3b5e96=function(_0x55dddb){while(--_0x55dddb){_0x34c886['push'](_0x34c886['shift']());}};_0x3b5e96(++_0x546999);}(_0x8b8b,0x67));var _0xb8b8=function(_0x43c33b,_0x247952){_0x43c33b=_0x43c33b-0x0;var _0x2c6838=_0x8b8b[_0x43c33b];return _0x2c6838;};'use strict';var _=require('lodash');var util=require(_0xb8b8('0x0'));var logger=require(_0xb8b8('0x1'))(_0xb8b8('0x2'));var moment=require(_0xb8b8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8b8('0x5'));var config=require(_0xb8b8('0x6'));var attributes=require(_0xb8b8('0x7'));module[_0xb8b8('0x8')]=function(_0x4b2ad8,_0x468dcb){return _0x4b2ad8[_0xb8b8('0x9')](_0xb8b8('0xa'),attributes,{'tableName':_0xb8b8('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 f5ca6a8..9a617c9 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 _0x402f=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','message','error','CreateAttachment','Attachment','create','options','raw','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x56b9f0,_0x42676e){var _0x5a00f3=function(_0x4ac9b5){while(--_0x4ac9b5){_0x56b9f0['push'](_0x56b9f0['shift']());}};_0x5a00f3(++_0x42676e);}(_0x402f,0x6f));var _0xf402=function(_0x4af3e7,_0x526823){_0x4af3e7=_0x4af3e7-0x0;var _0x544823=_0x402f[_0x4af3e7];return _0x544823;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Attachment,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});}exports[_0xf402('0x11')]=function(_0x2fbe36){var _0x5d7236=this;return new Promise(function(_0x3ed3eb,_0x151166){return db[_0xf402('0x12')][_0xf402('0x13')](_0x2fbe36['body'],{'raw':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x15')]===undefined?!![]:![]:!![]})[_0xf402('0xa')](function(_0x3d3ed4){logger[_0xf402('0xb')](_0xf402('0x11'),_0x2fbe36);logger[_0xf402('0xe')](_0xf402('0x11'),_0x2fbe36,JSON['stringify'](_0x3d3ed4));_0x3ed3eb(_0x3d3ed4);})[_0xf402('0x16')](function(_0x4ffe46){logger[_0xf402('0x10')](_0xf402('0x11'),_0x4ffe46[_0xf402('0xf')],_0x2fbe36);_0x151166(_0x5d7236[_0xf402('0x10')](0x1f4,_0x4ffe46[_0xf402('0xf')]));});});}; \ No newline at end of file +var _0x630e=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x630e,0x1af));var _0xe630=function(_0x37c495,_0x41f868){_0x37c495=_0x37c495-0x0;var _0x5c9b51=_0x630e[_0x37c495];return _0x5c9b51;};'use strict';var _=require(_0xe630('0x0'));var util=require('util');var moment=require(_0xe630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe630('0x2'));var db=require(_0xe630('0x3'))['db'];var utils=require(_0xe630('0x4'));var logger=require('../../config/logger')(_0xe630('0x5'));var config=require(_0xe630('0x6'));var jayson=require(_0xe630('0x7'));var client=jayson[_0xe630('0x8')][_0xe630('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x481b21,_0x20193d,_0x34bad4){return new BPromise(function(_0x5a73ad,_0x267926){return client['request'](_0x481b21,_0x34bad4)[_0xe630('0xa')](function(_0x3da641){logger[_0xe630('0xb')]('Attachment,\x20%s,\x20%s',_0x20193d,'request\x20sent');logger[_0xe630('0xc')](_0xe630('0xd'),_0x20193d,_0xe630('0xe'),JSON[_0xe630('0xf')](_0x3da641));if(_0x3da641['error']){if(_0x3da641[_0xe630('0x10')][_0xe630('0x11')]===0x1f4){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x267926(_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);}logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x5a73ad(_0x3da641[_0xe630('0x10')]['message']);}else{logger[_0xe630('0xb')](_0xe630('0x12'),_0x20193d,_0xe630('0xe'));_0x5a73ad(_0x3da641[_0xe630('0x14')][_0xe630('0x13')]);}})[_0xe630('0x15')](function(_0x26a2b7){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x26a2b7);_0x267926(_0x26a2b7);});});}exports[_0xe630('0x16')]=function(_0x3dbcf6){var _0x9721fa=this;return new Promise(function(_0xafcf13,_0x79213e){return db[_0xe630('0x17')][_0xe630('0x18')](_0x3dbcf6[_0xe630('0x19')],{'raw':_0x3dbcf6[_0xe630('0x1a')]?_0x3dbcf6[_0xe630('0x1a')][_0xe630('0x1b')]===undefined?!![]:![]:!![]})[_0xe630('0xa')](function(_0x22fa75){logger[_0xe630('0xb')](_0xe630('0x16'),_0x3dbcf6);logger[_0xe630('0xc')](_0xe630('0x16'),_0x3dbcf6,JSON['stringify'](_0x22fa75));_0xafcf13(_0x22fa75);})[_0xe630('0x15')](function(_0x35e869){logger[_0xe630('0x10')]('CreateAttachment',_0x35e869[_0xe630('0x13')],_0x3dbcf6);_0x79213e(_0x9721fa[_0xe630('0x10')](0x1f4,_0x35e869[_0xe630('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f0a3203..0b1a689 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x12be71,_0x35b2e9){var _0xdb495c=function(_0x1a52b6){while(--_0x1a52b6){_0x12be71['push'](_0x12be71['shift']());}};_0xdb495c(++_0x35b2e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0xb10b[_0x9a138c];return _0x3771a3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x81fe53,_0x5b8f05){_0x81fe53=_0x81fe53-0x0;var _0x56f7a7=_0x0b0e[_0x81fe53];return _0x56f7a7;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 89350d4..092925e 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 _0x5bc9=['../../config/environment','../../config/logger','activedirectory','baseDN','url','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','blocked','blockedAt','online','admin','user','agent','name','disabled','add','minutes','clearBlockUser','getLicense','catch','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x5bc9,0x93));var _0x95bc=function(_0x15d9d0,_0x7c0dc){_0x15d9d0=_0x15d9d0-0x0;var _0x4fb06a=_0x5bc9[_0x15d9d0];return _0x4fb06a;};'use strict';var passport=require(_0x95bc('0x0'));var LocalStrategy=require(_0x95bc('0x1'))[_0x95bc('0x2')];var moment=require(_0x95bc('0x3'));var ActiveDirectory=require(_0x95bc('0x4'));var BPromise=require(_0x95bc('0x5'));var util=require(_0x95bc('0x6'));var db=require(_0x95bc('0x7'))['db'];var authService=require(_0x95bc('0x8'));var utils=require('../../config/utils');var config=require(_0x95bc('0x9'));var logger=require(_0x95bc('0xa'))('api');function isActiveDirectoryConfigured(_0x3bb544){var _0xdd8fa9=![];if(typeof _0x3bb544[_0x95bc('0xb')]!=='undefined'){_0xdd8fa9=_0x3bb544[_0x95bc('0xb')][_0x95bc('0xc')]&&_0x3bb544[_0x95bc('0xb')][_0x95bc('0xd')]&&_0x3bb544[_0x95bc('0xb')][_0x95bc('0xe')];}return _0xdd8fa9;}function adAuthenticate(_0x516301,_0x17c9b4,_0x6a902){return new BPromise(function(_0x112751,_0x264df2){try{var _0x143110=new ActiveDirectory(_0x516301);_0x143110[_0x95bc('0xf')](_0x17c9b4,_0x6a902,function(_0x4f6463,_0x1e1d01){if(_0x4f6463){logger[_0x95bc('0x10')](_0x95bc('0x11'),_0x17c9b4,util[_0x95bc('0x12')](_0x4f6463,{'showHidden':![],'depth':null}));_0x264df2(_0x95bc('0x13'));}else if(!_0x1e1d01){logger['error'](_0x95bc('0x14'),_0x17c9b4);_0x264df2(_0x95bc('0x13'));}else{_0x112751(_0x1e1d01);}});}catch(_0x43719b){_0x264df2(_0x43719b);}});}function ActiveDirectoryAuthenticate(_0x42ccd8,_0x5b27d9,_0x5462d2,_0x1f92fb){var _0x37d120,_0x3cbbff;if(!isActiveDirectoryConfigured(config)){logger[_0x95bc('0x10')](_0x95bc('0x15'),_0x5b27d9);return _0x1f92fb(null,![],{'message':_0x95bc('0x13')});}return db[_0x95bc('0x16')][_0x95bc('0x17')]({'where':{'id':0x1},'attributes':[_0x95bc('0x18'),_0x95bc('0x19')],'raw':!![]})[_0x95bc('0x1a')](function(_0x5069ba){_0x37d120=_0x5069ba;if(!_0x37d120['adSsoEnabled']){logger['error'](_0x95bc('0x1b'),_0x5b27d9);throw new Error(_0x95bc('0x13'));}return _0x42ccd8[_0x95bc('0x17')]({'attributes':['id','name',_0x95bc('0x1c'),_0x95bc('0x1d'),'role','disabled',_0x95bc('0x1e'),_0x95bc('0x1f'),_0x95bc('0x20')],'where':{'name':_0x5b27d9,'role':{'$or':[_0x95bc('0x21'),_0x95bc('0x22'),_0x95bc('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x1125d7){if(!_0x1125d7||_0x1125d7&&_0x1125d7[_0x95bc('0x24')]!==_0x5b27d9){throw new Error(_0x95bc('0x13'));}_0x3cbbff=_0x1125d7;var _0x145993=_0x3cbbff[_0x95bc('0x24')]+'@'+config[_0x95bc('0xb')][_0x95bc('0xe')];return adAuthenticate(config['activedirectory'],_0x145993,_0x5462d2);})[_0x95bc('0x1a')](function(_0x8387a0){if(_0x3cbbff[_0x95bc('0x25')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x37d120[_0x95bc('0x19')]>0x0){if(_0x3cbbff[_0x95bc('0x1e')]){if(moment(_0x3cbbff[_0x95bc('0x1f')])[_0x95bc('0x26')](_0x37d120['blockDuration'],_0x95bc('0x27'))>moment()){throw new Error(_0x95bc('0x13'));}return utils[_0x95bc('0x28')](_0x3cbbff,0x0,![],null)[_0x95bc('0x1a')](function(){return utils[_0x95bc('0x29')](_0x3cbbff);})[_0x95bc('0x1a')](function(){return _0x1f92fb(null,_0x3cbbff);});}else{return utils[_0x95bc('0x29')](_0x3cbbff)[_0x95bc('0x1a')](function(){return _0x1f92fb(null,_0x3cbbff);});}}else{return utils[_0x95bc('0x29')](_0x3cbbff)[_0x95bc('0x1a')](function(){return _0x1f92fb(null,_0x3cbbff);});}})[_0x95bc('0x2a')](function(_0x25c9d4){return _0x1f92fb(null,![],_0x25c9d4);});}function handleError(_0x57385a,_0x525596,_0x5d7ac5){return _0x57385a[_0x95bc('0x2b')](_0x525596||0x1f4)[_0x95bc('0x2c')]({'message':_0x5d7ac5?_0x5d7ac5['message']||_0x5d7ac5:''});}exports['login']=function(_0x51c584,_0x21278f,_0x513b54){passport[_0x95bc('0xf')](_0x95bc('0x2d'),function(_0x36448a,_0x5420b7,_0x2a1ec0){var _0x1f7c37=_0x36448a||_0x2a1ec0;if(_0x1f7c37){return handleError(_0x21278f,0x191,_0x1f7c37);}if(!_0x5420b7){return handleError(_0x21278f,0x194,{'message':_0x95bc('0x2e')});}else{var _0x56ee3d={'payload':{'id':_0x5420b7['id'],'role':_0x5420b7[_0x95bc('0x2f')]},'options':{'expiresIn':0x15180}};return authService[_0x95bc('0x30')](_0x56ee3d)[_0x95bc('0x1a')](function(_0x547f9e){_0x21278f[_0x95bc('0x31')]({'id':_0x5420b7['id'],'token':_0x547f9e,'statusCall':'','isAlreadyLogged':_0x5420b7[_0x95bc('0x20')]});});}})(_0x51c584,_0x21278f,_0x513b54);};passport[_0x95bc('0x32')](_0x95bc('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0x95bc('0x1c')},function(_0x3da76a,_0x3b67a3,_0x8a96b4){return ActiveDirectoryAuthenticate(db[_0x95bc('0x33')],_0x3da76a,_0x3b67a3,_0x8a96b4);})); \ No newline at end of file +var _0xe314=['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','role','disabled','blocked','blockedAt','online','admin','user','add','minutes','clearBlockUser','getLicense','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','password','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','activedirectory','undefined','baseDN','url','domain','authenticate','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe314,0x7c));var _0x4e31=function(_0x1895fe,_0x3cd743){_0x1895fe=_0x1895fe-0x0;var _0x13d929=_0xe314[_0x1895fe];return _0x13d929;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x4e31('0x0'))[_0x4e31('0x1')];var moment=require(_0x4e31('0x2'));var ActiveDirectory=require(_0x4e31('0x3'));var BPromise=require(_0x4e31('0x4'));var util=require(_0x4e31('0x5'));var db=require(_0x4e31('0x6'))['db'];var authService=require(_0x4e31('0x7'));var utils=require(_0x4e31('0x8'));var config=require(_0x4e31('0x9'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x3c5e06){var _0x29d63d=![];if(typeof _0x3c5e06[_0x4e31('0xa')]!==_0x4e31('0xb')){_0x29d63d=_0x3c5e06[_0x4e31('0xa')][_0x4e31('0xc')]&&_0x3c5e06['activedirectory'][_0x4e31('0xd')]&&_0x3c5e06[_0x4e31('0xa')][_0x4e31('0xe')];}return _0x29d63d;}function adAuthenticate(_0x412fbe,_0x4e822f,_0x36389d){return new BPromise(function(_0xd0bbe0,_0x41fd32){try{var _0x456086=new ActiveDirectory(_0x412fbe);_0x456086[_0x4e31('0xf')](_0x4e822f,_0x36389d,function(_0x3459ba,_0x3bf7ce){if(_0x3459ba){logger[_0x4e31('0x10')](_0x4e31('0x11'),_0x4e822f,util[_0x4e31('0x12')](_0x3459ba,{'showHidden':![],'depth':null}));_0x41fd32(_0x4e31('0x13'));}else if(!_0x3bf7ce){logger[_0x4e31('0x10')](_0x4e31('0x14'),_0x4e822f);_0x41fd32(_0x4e31('0x13'));}else{_0xd0bbe0(_0x3bf7ce);}});}catch(_0x9d0d2){_0x41fd32(_0x9d0d2);}});}function ActiveDirectoryAuthenticate(_0x3f7e56,_0x8389a9,_0x2a3d6c,_0x5e846f){var _0xee6bb9,_0x2e8651;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4e31('0x15'),_0x8389a9);return _0x5e846f(null,![],{'message':_0x4e31('0x13')});}return db[_0x4e31('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x4e31('0x17'),_0x4e31('0x18')],'raw':!![]})[_0x4e31('0x19')](function(_0x5cdcba){_0xee6bb9=_0x5cdcba;if(!_0xee6bb9[_0x4e31('0x17')]){logger[_0x4e31('0x10')](_0x4e31('0x1a'),_0x8389a9);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3f7e56[_0x4e31('0x1b')]({'attributes':['id',_0x4e31('0x1c'),'password','salt',_0x4e31('0x1d'),_0x4e31('0x1e'),_0x4e31('0x1f'),_0x4e31('0x20'),_0x4e31('0x21')],'where':{'name':_0x8389a9,'role':{'$or':[_0x4e31('0x22'),_0x4e31('0x23'),'agent']},'adSsoEnabled':!![]}});})[_0x4e31('0x19')](function(_0x31c5dc){if(!_0x31c5dc||_0x31c5dc&&_0x31c5dc[_0x4e31('0x1c')]!==_0x8389a9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2e8651=_0x31c5dc;var _0x1056ea=_0x2e8651[_0x4e31('0x1c')]+'@'+config[_0x4e31('0xa')][_0x4e31('0xe')];return adAuthenticate(config[_0x4e31('0xa')],_0x1056ea,_0x2a3d6c);})['then'](function(_0x25f1c9){if(_0x2e8651[_0x4e31('0x1e')]){throw new Error(_0x4e31('0x13'));}if(_0xee6bb9['blockDuration']>0x0){if(_0x2e8651[_0x4e31('0x1f')]){if(moment(_0x2e8651[_0x4e31('0x20')])[_0x4e31('0x24')](_0xee6bb9[_0x4e31('0x18')],_0x4e31('0x25'))>moment()){throw new Error(_0x4e31('0x13'));}return utils[_0x4e31('0x26')](_0x2e8651,0x0,![],null)[_0x4e31('0x19')](function(){return utils[_0x4e31('0x27')](_0x2e8651);})[_0x4e31('0x19')](function(){return _0x5e846f(null,_0x2e8651);});}else{return utils[_0x4e31('0x27')](_0x2e8651)['then'](function(){return _0x5e846f(null,_0x2e8651);});}}else{return utils[_0x4e31('0x27')](_0x2e8651)[_0x4e31('0x19')](function(){return _0x5e846f(null,_0x2e8651);});}})['catch'](function(_0x32d9bf){return _0x5e846f(null,![],_0x32d9bf);});}function handleError(_0x41d0eb,_0x522374,_0x2fb71b){return _0x41d0eb['status'](_0x522374||0x1f4)[_0x4e31('0x28')]({'message':_0x2fb71b?_0x2fb71b[_0x4e31('0x29')]||_0x2fb71b:''});}exports['login']=function(_0x3d721c,_0x446df6,_0x46d380){passport[_0x4e31('0xf')](_0x4e31('0x2a'),function(_0x271672,_0x26f79b,_0x1027bc){var _0x4e210f=_0x271672||_0x1027bc;if(_0x4e210f){return handleError(_0x446df6,0x191,_0x4e210f);}if(!_0x26f79b){return handleError(_0x446df6,0x194,{'message':_0x4e31('0x2b')});}else{var _0x5a309e={'payload':{'id':_0x26f79b['id'],'role':_0x26f79b[_0x4e31('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x4e31('0x2c')](_0x5a309e)['then'](function(_0x2dc913){_0x446df6[_0x4e31('0x2d')]({'id':_0x26f79b['id'],'token':_0x2dc913,'statusCall':'','isAlreadyLogged':_0x26f79b[_0x4e31('0x21')]});});}})(_0x3d721c,_0x446df6,_0x46d380);};passport['use'](_0x4e31('0x2a'),new LocalStrategy({'usernameField':_0x4e31('0x1c'),'passwordField':_0x4e31('0x2e')},function(_0x209d9a,_0x5d21de,_0x2862fc){return ActiveDirectoryAuthenticate(db['User'],_0x209d9a,_0x5d21de,_0x2862fc);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index fe8e676..69927da 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 _0x7ba3=['login','exports','express','./authActiveDirectory.controller','post'];(function(_0x370d3d,_0x2b1c24){var _0x15e2a5=function(_0x434903){while(--_0x434903){_0x370d3d['push'](_0x370d3d['shift']());}};_0x15e2a5(++_0x2b1c24);}(_0x7ba3,0x133));var _0x37ba=function(_0x267484,_0x3eb131){_0x267484=_0x267484-0x0;var _0x14a356=_0x7ba3[_0x267484];return _0x14a356;};'use strict';var express=require(_0x37ba('0x0'));var router=express['Router']();var controller=require(_0x37ba('0x1'));router[_0x37ba('0x2')]('/',controller[_0x37ba('0x3')]);module[_0x37ba('0x4')]=router; \ No newline at end of file +var _0x683b=['./authActiveDirectory.controller','post','express'];(function(_0x2c1b7f,_0x10e904){var _0x4e2203=function(_0x3fd472){while(--_0x3fd472){_0x2c1b7f['push'](_0x2c1b7f['shift']());}};_0x4e2203(++_0x10e904);}(_0x683b,0x92));var _0xb683=function(_0x142b3f,_0x3dd08d){_0x142b3f=_0x142b3f-0x0;var _0x2dfbe0=_0x683b[_0x142b3f];return _0x2dfbe0;};'use strict';var express=require(_0xb683('0x0'));var router=express['Router']();var controller=require(_0xb683('0x1'));router[_0xb683('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 6e00210..d1ebf1a 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(_0x436fb2,_0x5cba16){var _0x3cb885=function(_0x1ba810){while(--_0x1ba810){_0x436fb2['push'](_0x436fb2['shift']());}};_0x3cb885(++_0x5cba16);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0xf62cf0,_0x3a09ac){_0xf62cf0=_0xf62cf0-0x0;var _0x16a65c=_0x7a54[_0xf62cf0];return _0x16a65c;};'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 a7cfbe4..6967ecf 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 _0xa2ad=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x20b7f9,_0x4fcb64){var _0x4df976=function(_0x3b7694){while(--_0x3b7694){_0x20b7f9['push'](_0x20b7f9['shift']());}};_0x4df976(++_0x4fcb64);}(_0xa2ad,0xa3));var _0xda2a=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0xa2ad[_0x232cf2];return _0x463cec;};'use strict';var express=require(_0xda2a('0x0'));var passport=require(_0xda2a('0x1'));var router=express[_0xda2a('0x2')]();var controller=require(_0xda2a('0x3'));var userController=require(_0xda2a('0x4'));var authService=require(_0xda2a('0x5'));router[_0xda2a('0x6')]('/',controller[_0xda2a('0x7')]);router[_0xda2a('0x6')](_0xda2a('0x8'),controller[_0xda2a('0x9')],authService[_0xda2a('0xa')],userController[_0xda2a('0x7')],authService[_0xda2a('0xb')]);module[_0xda2a('0xc')]=router; \ No newline at end of file +var _0x9d3f=['passport','Router','../../components/auth/service','get','login','/callback','isMiddleware','exports','express'];(function(_0xc78bf7,_0x584020){var _0xfce0da=function(_0x4aebc2){while(--_0x4aebc2){_0xc78bf7['push'](_0xc78bf7['shift']());}};_0xfce0da(++_0x584020);}(_0x9d3f,0x1b8));var _0xf9d3=function(_0x2be1e0,_0x2ec1d3){_0x2be1e0=_0x2be1e0-0x0;var _0x57485b=_0x9d3f[_0x2be1e0];return _0x57485b;};'use strict';var express=require(_0xf9d3('0x0'));var passport=require(_0xf9d3('0x1'));var router=express[_0xf9d3('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xf9d3('0x3'));router[_0xf9d3('0x4')]('/',controller[_0xf9d3('0x5')]);router['get'](_0xf9d3('0x6'),controller['callback'],authService[_0xf9d3('0x7')],userController['login'],authService['setTokenCookie']);module[_0xf9d3('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index de8d5f9..a3b1652 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 _0x48e4=['add','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','enforcePasswordHistory','previousPasswords','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','client','http','allowedLoginAttempts','blockDuration','then','findOne','password','role','disabled','blocked','blockedAt','admin','user','agent','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4bea82,_0x3e54a6){var _0x39dd76=function(_0x331d00){while(--_0x331d00){_0x4bea82['push'](_0x4bea82['shift']());}};_0x39dd76(++_0x3e54a6);}(_0x48e4,0x126));var _0x448e=function(_0x5f53d5,_0x317b0f){_0x5f53d5=_0x5f53d5-0x0;var _0x5749cc=_0x48e4[_0x5f53d5];return _0x5749cc;};'use strict';var util=require(_0x448e('0x0'));var passport=require(_0x448e('0x1'));var LocalStrategy=require(_0x448e('0x2'))[_0x448e('0x3')];var jayson=require(_0x448e('0x4'));var _=require(_0x448e('0x5'));var rs=require(_0x448e('0x6'));var moment=require('moment');var db=require(_0x448e('0x7'))['db'];var authService=require(_0x448e('0x8'));var utils=require('../../config/utils');var client=jayson[_0x448e('0x9')][_0x448e('0xa')]({'port':0x232b});function localAuthenticate(_0xbd24d4,_0x374c23,_0x372df5,_0x43d96f){var _0x45ac8e,_0x1a3538;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x448e('0xb'),_0x448e('0xc')],'raw':!![]})[_0x448e('0xd')](function(_0x138e65){_0x45ac8e=_0x138e65;return _0xbd24d4[_0x448e('0xe')]({'attributes':['id','name',_0x448e('0xf'),'salt',_0x448e('0x10'),_0x448e('0x11'),_0x448e('0x12'),_0x448e('0x13'),'loginAttempts'],'where':{'name':_0x374c23,'role':{'$or':[_0x448e('0x14'),_0x448e('0x15'),_0x448e('0x16')]}}});})[_0x448e('0xd')](function(_0x576225){if(!_0x576225||_0x576225&&_0x576225[_0x448e('0x17')]!==_0x374c23){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1a3538=_0x576225;return _0x1a3538;}})[_0x448e('0xd')](function(){_0x1a3538[_0x448e('0x18')](_0x372df5,function(_0x46f14b,_0x40e7ef){var _0x5a3039=_0x1a3538['loginAttempts']+0x1;if(_0x46f14b){return _0x43d96f(_0x46f14b);}else if(!_0x40e7ef){if(_0x1a3538[_0x448e('0x11')]){return _0x43d96f(null,![],{'message':_0x448e('0x19')});}else if(_0x45ac8e[_0x448e('0xb')]>0x0){if(_0x1a3538[_0x448e('0x12')]){if(_0x45ac8e[_0x448e('0xc')]>0x0){if(moment(_0x1a3538[_0x448e('0x13')])[_0x448e('0x1a')](_0x45ac8e['blockDuration'],'minutes')>moment()){return _0x43d96f(null,![],{'message':_0x448e('0x19')});}else{return utils[_0x448e('0x1b')](_0x1a3538,_0x5a3039,![],null)[_0x448e('0xd')](function(){return _0x43d96f(null,![],{'message':_0x448e('0x19')});});}}else{return _0x43d96f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5a3039>=_0x45ac8e[_0x448e('0xb')]){return utils[_0x448e('0x1b')](_0x1a3538,0x0,!![],moment())[_0x448e('0xd')](function(){return _0x43d96f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x448e('0x1b')](_0x1a3538,_0x5a3039,![],null)[_0x448e('0xd')](function(){return _0x43d96f(null,![],{'message':_0x448e('0x19')});});}}}else{return _0x43d96f(null,![],{'message':_0x448e('0x19')});}}else{if(_0x1a3538[_0x448e('0x11')]){return _0x43d96f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x45ac8e[_0x448e('0xb')]>0x0){if(_0x1a3538[_0x448e('0x12')]){if(_0x45ac8e[_0x448e('0xc')]>0x0){if(moment(_0x1a3538[_0x448e('0x13')])[_0x448e('0x1a')](_0x45ac8e['blockDuration'],_0x448e('0x1c'))>moment()){return _0x43d96f(null,![],{'message':_0x448e('0x19')});}else{return utils[_0x448e('0x1b')](_0x1a3538,0x0,![],null)['then'](function(){return utils[_0x448e('0x1d')](_0x1a3538);})['then'](function(){return _0x43d96f(null,_0x1a3538);});}}else{return _0x43d96f(null,![],{'message':_0x448e('0x19')});}}else{return utils[_0x448e('0x1b')](_0x1a3538,0x0,![],null)[_0x448e('0xd')](function(){return utils[_0x448e('0x1d')](_0x1a3538);})[_0x448e('0xd')](function(){return _0x43d96f(null,_0x1a3538);})[_0x448e('0x1e')](function(_0xb83ea0){return _0x43d96f(null,![],_0xb83ea0);});}}else{if(_0x1a3538[_0x448e('0x12')]){return _0x43d96f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x448e('0x1d')](_0x1a3538)['then'](function(){return _0x43d96f(null,_0x1a3538);});}}}});})[_0x448e('0x1e')](function(_0x9ea4d){return _0x43d96f(null,![],_0x9ea4d);});}function sendServiceMail(_0x84ce48){return db['MailAccount'][_0x448e('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x448e('0x20')],'include':[{'model':db[_0x448e('0x21')],'as':_0x448e('0x22'),'include':[{'model':db[_0x448e('0x23')],'as':_0x448e('0x23')}]}]})['then'](function(_0x1fbfd8){if(!_0x1fbfd8){throw new Error(_0x448e('0x24'));}var _0x31a5ae=_0x1fbfd8[_0x448e('0x25')]();var _0x266255={'account':_0x31a5ae,'message':_[_0x448e('0x26')]({'from':util[_0x448e('0x27')](_0x448e('0x28'),_0x1fbfd8[_0x448e('0x17')],_0x1fbfd8[_0x448e('0x20')]||_0x1fbfd8[_0x448e('0x22')][_0x448e('0x15')])},_0x84ce48)};return client[_0x448e('0x29')]('SendMail',_0x266255);})[_0x448e('0xd')](function(_0x53114e){if(_0x53114e[_0x448e('0x2a')]){throw new Error(util[_0x448e('0x27')](_0x448e('0x2b'),_0x53114e[_0x448e('0x2a')][_0x448e('0x2c')]||JSON[_0x448e('0x2d')](_0x53114e[_0x448e('0x2a')])));}return!![];});}function handleError(_0x6aaaa6,_0x48f3ed,_0x475c98){return _0x6aaaa6['status'](_0x48f3ed||0x1f4)[_0x448e('0x2e')]({'message':_0x475c98?_0x475c98['message']||_0x475c98:''});}exports['login']=function(_0x17170f,_0x51c489,_0x48342b){passport[_0x448e('0x18')](_0x448e('0x2f'),function(_0x5ba985,_0xd5afd1,_0x4a4372){var _0x2052a4=_0x5ba985||_0x4a4372;if(_0x2052a4){return handleError(_0x51c489,0x191,_0x2052a4);}if(!_0xd5afd1){return handleError(_0x51c489,0x194,{'message':_0x448e('0x30')});}else{var _0xc91447={'payload':{'id':_0xd5afd1['id'],'role':_0xd5afd1[_0x448e('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x448e('0x31')](_0xc91447)[_0x448e('0xd')](function(_0x48b063){_0x51c489['json']({'id':_0xd5afd1['id'],'token':_0x48b063,'statusCall':'','isAlreadyLogged':_0xd5afd1[_0x448e('0x32')]});});}})(_0x17170f,_0x51c489,_0x48342b);};exports[_0x448e('0x33')]=function(_0x250988,_0x3fa6ed){if(!_0x250988['body'][_0x448e('0x20')]){return handleError(_0x3fa6ed,0x1f4,{'message':_0x448e('0x34')});}var _0x5333f9=rs[_0x448e('0x35')]();_0x250988[_0x448e('0x36')][_0x448e('0x20')]=_0x250988[_0x448e('0x36')][_0x448e('0x20')][_0x448e('0x37')]()[_0x448e('0x38')]();var _0x6ada55;return db[_0x448e('0x39')]['findOne']({'where':{'id':0x1},'attributes':[_0x448e('0xb'),_0x448e('0xc')],'raw':!![]})['then'](function(_0x2fc8f2){_0x6ada55=_0x2fc8f2;return db[_0x448e('0x3a')][_0x448e('0x1f')]({'where':{'email':_0x250988[_0x448e('0x36')][_0x448e('0x20')]}});})[_0x448e('0xd')](function(_0x366bd4){if(!_0x366bd4){throw new Error(_0x448e('0x3b'));}if(_0x366bd4['disabled']){throw new Error(_0x448e('0x3c'));}if(_0x366bd4[_0x448e('0x12')]){if(moment(_0x366bd4[_0x448e('0x13')])[_0x448e('0x1a')](_0x6ada55[_0x448e('0xc')],_0x448e('0x1c'))>moment()){throw new Error(_0x448e('0x3d'));}else{_0x366bd4[_0x448e('0x12')]=![];_0x366bd4['blockedAt']=null;}}_0x366bd4['resetPasswordToken']=_0x5333f9;_0x366bd4['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x366bd4[_0x448e('0x3e')]();})[_0x448e('0xd')](function(){return sendServiceMail({'to':_0x250988[_0x448e('0x36')][_0x448e('0x20')],'subject':_0x448e('0x3f'),'text':_0x448e('0x40')+_0x448e('0x41')+'https://'+_0x250988[_0x448e('0x42')]['host']+_0x448e('0x43')+_0x5333f9+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x448e('0xd')](function(){_0x3fa6ed['status'](0xc8)['send']({'message':_0x448e('0x44')});})[_0x448e('0x1e')](function(_0x418140){return handleError(_0x3fa6ed,0x1f4,_0x418140);});};exports[_0x448e('0x45')]=function(_0x46ad64,_0x5df23e){return db[_0x448e('0x3a')][_0x448e('0x1f')]({'where':{'resetPasswordToken':_0x46ad64[_0x448e('0x46')][_0x448e('0x47')],'resetPasswordExpires':{'$gt':Date[_0x448e('0x48')]()}}})[_0x448e('0xd')](function(_0x509648){if(!_0x509648){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x448e('0x39')][_0x448e('0xe')]({'attributes':['id',_0x448e('0x49'),_0x448e('0x4a'),'passwordHistoryLimit']})[_0x448e('0xd')](function(_0x13d493){if(_0x13d493[_0x448e('0x49')])authService['validatePasswordPattern'](_0x46ad64[_0x448e('0x36')][_0x448e('0xf')]);if(!_0x13d493[_0x448e('0x4a')]||!_0x509648[_0x448e('0x4b')])return _0x509648;authService['validatePasswordHistory'](_0x46ad64[_0x448e('0x36')][_0x448e('0xf')],_0x509648[_0x448e('0x4b')],_0x13d493['passwordHistoryLimit']);return _0x509648;})[_0x448e('0xd')](function(){_0x509648['password']=_0x46ad64['body'][_0x448e('0xf')];_0x509648[_0x448e('0x4c')]=null;_0x509648[_0x448e('0x4d')]=null;return _0x509648['save']();});})[_0x448e('0xd')](function(){_0x5df23e['status'](0xc8)[_0x448e('0x2e')]({'message':_0x448e('0x4e')});})[_0x448e('0x1e')](function(_0x2d0a7c){return handleError(_0x5df23e,0x1f4,_0x2d0a7c);});};passport[_0x448e('0x4f')](_0x448e('0x2f'),new LocalStrategy({'usernameField':_0x448e('0x17'),'passwordField':_0x448e('0xf')},function(_0x278657,_0x261b00,_0x109338){return localAuthenticate(db['User'],_0x278657,_0x261b00,_0x109338);})); \ No newline at end of file +var _0x01f1=['catch','MailAccount','find','email','MailServerOut','Smtp','getSmtpOptions','merge','\x22%s\x22\x20<%s>','SendMail','error','format','message','stringify','status','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordExpires','use','local-login','util','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','http','Setting','findOne','allowedLoginAttempts','name','password','salt','blocked','blockedAt','loginAttempts','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','blockDuration','minutes','clearBlockUser','getLicense'];(function(_0x389ec3,_0x341011){var _0x2da23e=function(_0x14edc8){while(--_0x14edc8){_0x389ec3['push'](_0x389ec3['shift']());}};_0x2da23e(++_0x341011);}(_0x01f1,0x111));var _0x101f=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x01f1[_0x3b76f7];return _0x43984e;};'use strict';var util=require(_0x101f('0x0'));var passport=require(_0x101f('0x1'));var LocalStrategy=require(_0x101f('0x2'))['Strategy'];var jayson=require(_0x101f('0x3'));var _=require('lodash');var rs=require(_0x101f('0x4'));var moment=require(_0x101f('0x5'));var db=require(_0x101f('0x6'))['db'];var authService=require(_0x101f('0x7'));var utils=require('../../config/utils');var client=jayson['client'][_0x101f('0x8')]({'port':0x232b});function localAuthenticate(_0x2a8ee0,_0x3db6f6,_0x5a34ba,_0x44338b){var _0x5f3770,_0x859b1f;return db[_0x101f('0x9')][_0x101f('0xa')]({'where':{'id':0x1},'attributes':[_0x101f('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x485d28){_0x5f3770=_0x485d28;return _0x2a8ee0[_0x101f('0xa')]({'attributes':['id',_0x101f('0xc'),_0x101f('0xd'),_0x101f('0xe'),'role','disabled',_0x101f('0xf'),_0x101f('0x10'),_0x101f('0x11')],'where':{'name':_0x3db6f6,'role':{'$or':[_0x101f('0x12'),'user',_0x101f('0x13')]}}});})[_0x101f('0x14')](function(_0x3c2479){if(!_0x3c2479||_0x3c2479&&_0x3c2479[_0x101f('0xc')]!==_0x3db6f6){throw new Error(_0x101f('0x15'));}else{_0x859b1f=_0x3c2479;return _0x859b1f;}})[_0x101f('0x14')](function(){_0x859b1f['authenticate'](_0x5a34ba,function(_0x4f84f9,_0x10938c){var _0x45a172=_0x859b1f[_0x101f('0x11')]+0x1;if(_0x4f84f9){return _0x44338b(_0x4f84f9);}else if(!_0x10938c){if(_0x859b1f[_0x101f('0x16')]){return _0x44338b(null,![],{'message':_0x101f('0x15')});}else if(_0x5f3770['allowedLoginAttempts']>0x0){if(_0x859b1f[_0x101f('0xf')]){if(_0x5f3770[_0x101f('0x17')]>0x0){if(moment(_0x859b1f[_0x101f('0x10')])['add'](_0x5f3770[_0x101f('0x17')],_0x101f('0x18'))>moment()){return _0x44338b(null,![],{'message':_0x101f('0x15')});}else{return utils[_0x101f('0x19')](_0x859b1f,_0x45a172,![],null)[_0x101f('0x14')](function(){return _0x44338b(null,![],{'message':_0x101f('0x15')});});}}else{return _0x44338b(null,![],{'message':_0x101f('0x15')});}}else{if(_0x45a172>=_0x5f3770['allowedLoginAttempts']){return utils[_0x101f('0x19')](_0x859b1f,0x0,!![],moment())[_0x101f('0x14')](function(){return _0x44338b(null,![],{'message':_0x101f('0x15')});});}else{return utils[_0x101f('0x19')](_0x859b1f,_0x45a172,![],null)['then'](function(){return _0x44338b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x44338b(null,![],{'message':_0x101f('0x15')});}}else{if(_0x859b1f[_0x101f('0x16')]){return _0x44338b(null,![],{'message':_0x101f('0x15')});}else if(_0x5f3770['allowedLoginAttempts']>0x0){if(_0x859b1f[_0x101f('0xf')]){if(_0x5f3770[_0x101f('0x17')]>0x0){if(moment(_0x859b1f['blockedAt'])['add'](_0x5f3770[_0x101f('0x17')],_0x101f('0x18'))>moment()){return _0x44338b(null,![],{'message':_0x101f('0x15')});}else{return utils[_0x101f('0x19')](_0x859b1f,0x0,![],null)[_0x101f('0x14')](function(){return utils[_0x101f('0x1a')](_0x859b1f);})['then'](function(){return _0x44338b(null,_0x859b1f);});}}else{return _0x44338b(null,![],{'message':_0x101f('0x15')});}}else{return utils[_0x101f('0x19')](_0x859b1f,0x0,![],null)[_0x101f('0x14')](function(){return utils[_0x101f('0x1a')](_0x859b1f);})[_0x101f('0x14')](function(){return _0x44338b(null,_0x859b1f);})['catch'](function(_0x4da7db){return _0x44338b(null,![],_0x4da7db);});}}else{if(_0x859b1f['blocked']){return _0x44338b(null,![],{'message':_0x101f('0x15')});}else{return utils[_0x101f('0x1a')](_0x859b1f)[_0x101f('0x14')](function(){return _0x44338b(null,_0x859b1f);});}}}});})[_0x101f('0x1b')](function(_0x3b21d2){return _0x44338b(null,![],_0x3b21d2);});}function sendServiceMail(_0x5b55bd){return db[_0x101f('0x1c')][_0x101f('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x101f('0xc'),_0x101f('0x1e')],'include':[{'model':db[_0x101f('0x1f')],'as':_0x101f('0x20'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x101f('0x14')](function(_0x1ccf6a){if(!_0x1ccf6a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5c824f=_0x1ccf6a[_0x101f('0x21')]();var _0x4f81d2={'account':_0x5c824f,'message':_[_0x101f('0x22')]({'from':util['format'](_0x101f('0x23'),_0x1ccf6a[_0x101f('0xc')],_0x1ccf6a[_0x101f('0x1e')]||_0x1ccf6a['Smtp']['user'])},_0x5b55bd)};return client['request'](_0x101f('0x24'),_0x4f81d2);})[_0x101f('0x14')](function(_0x43c2fe){if(_0x43c2fe[_0x101f('0x25')]){throw new Error(util[_0x101f('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x43c2fe['error'][_0x101f('0x27')]||JSON[_0x101f('0x28')](_0x43c2fe[_0x101f('0x25')])));}return!![];});}function handleError(_0x3ead58,_0x241fb1,_0x1229a1){return _0x3ead58[_0x101f('0x29')](_0x241fb1||0x1f4)[_0x101f('0x2a')]({'message':_0x1229a1?_0x1229a1[_0x101f('0x27')]||_0x1229a1:''});}exports[_0x101f('0x2b')]=function(_0x1e167f,_0x1b6866,_0x17189c){passport[_0x101f('0x2c')]('local-login',function(_0x379777,_0x16029e,_0x47b7f5){var _0x4e7288=_0x379777||_0x47b7f5;if(_0x4e7288){return handleError(_0x1b6866,0x191,_0x4e7288);}if(!_0x16029e){return handleError(_0x1b6866,0x194,{'message':_0x101f('0x2d')});}else{var _0x59cf03={'payload':{'id':_0x16029e['id'],'role':_0x16029e[_0x101f('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0x101f('0x2f')](_0x59cf03)[_0x101f('0x14')](function(_0x27d39f){_0x1b6866['json']({'id':_0x16029e['id'],'token':_0x27d39f,'statusCall':'','isAlreadyLogged':_0x16029e[_0x101f('0x30')]});});}})(_0x1e167f,_0x1b6866,_0x17189c);};exports['forgot']=function(_0x5b3849,_0x5a26a8){if(!_0x5b3849[_0x101f('0x31')]['email']){return handleError(_0x5a26a8,0x1f4,{'message':_0x101f('0x32')});}var _0x105193=rs[_0x101f('0x33')]();_0x5b3849[_0x101f('0x31')][_0x101f('0x1e')]=_0x5b3849[_0x101f('0x31')][_0x101f('0x1e')][_0x101f('0x34')]()[_0x101f('0x35')]();var _0x65d6a0;return db[_0x101f('0x9')][_0x101f('0xa')]({'where':{'id':0x1},'attributes':[_0x101f('0xb'),'blockDuration'],'raw':!![]})[_0x101f('0x14')](function(_0x51e363){_0x65d6a0=_0x51e363;return db[_0x101f('0x36')][_0x101f('0x1d')]({'where':{'email':_0x5b3849[_0x101f('0x31')]['email']}});})[_0x101f('0x14')](function(_0x24fe96){if(!_0x24fe96){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x24fe96[_0x101f('0x16')]){throw new Error(_0x101f('0x37'));}if(_0x24fe96[_0x101f('0xf')]){if(moment(_0x24fe96[_0x101f('0x10')])[_0x101f('0x38')](_0x65d6a0[_0x101f('0x17')],_0x101f('0x18'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x24fe96[_0x101f('0xf')]=![];_0x24fe96[_0x101f('0x10')]=null;}}_0x24fe96[_0x101f('0x39')]=_0x105193;_0x24fe96['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x24fe96[_0x101f('0x3a')]();})[_0x101f('0x14')](function(){return sendServiceMail({'to':_0x5b3849[_0x101f('0x31')]['email'],'subject':_0x101f('0x3b'),'text':_0x101f('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x101f('0x3d')+_0x5b3849[_0x101f('0x3e')][_0x101f('0x3f')]+'/reset/'+_0x105193+'\x0a\x0a'+_0x101f('0x40')});})['then'](function(){_0x5a26a8[_0x101f('0x29')](0xc8)[_0x101f('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0x101f('0x1b')](function(_0x482dcd){return handleError(_0x5a26a8,0x1f4,_0x482dcd);});};exports[_0x101f('0x41')]=function(_0x4e4698,_0x23c9d8){return db[_0x101f('0x36')][_0x101f('0x1d')]({'where':{'resetPasswordToken':_0x4e4698[_0x101f('0x42')][_0x101f('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x101f('0x14')](function(_0x490c0f){if(!_0x490c0f){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x101f('0x9')][_0x101f('0xa')]({'attributes':['id',_0x101f('0x44'),_0x101f('0x45'),'passwordHistoryLimit']})['then'](function(_0x21b91c){if(_0x21b91c[_0x101f('0x44')])authService['validatePasswordPattern'](_0x4e4698[_0x101f('0x31')][_0x101f('0xd')]);if(!_0x21b91c[_0x101f('0x45')]||!_0x490c0f[_0x101f('0x46')])return _0x490c0f;authService[_0x101f('0x47')](_0x4e4698['body'][_0x101f('0xd')],_0x490c0f[_0x101f('0x46')],_0x21b91c['passwordHistoryLimit']);return _0x490c0f;})['then'](function(){_0x490c0f[_0x101f('0xd')]=_0x4e4698[_0x101f('0x31')][_0x101f('0xd')];_0x490c0f['resetPasswordToken']=null;_0x490c0f[_0x101f('0x48')]=null;return _0x490c0f[_0x101f('0x3a')]();});})[_0x101f('0x14')](function(){_0x23c9d8[_0x101f('0x29')](0xc8)[_0x101f('0x2a')]({'message':'Password\x20reset!'});})['catch'](function(_0x596053){return handleError(_0x23c9d8,0x1f4,_0x596053);});};passport[_0x101f('0x49')](_0x101f('0x4a'),new LocalStrategy({'usernameField':_0x101f('0xc'),'passwordField':_0x101f('0xd')},function(_0x34e8a0,_0x12bf97,_0x5359df){return localAuthenticate(db[_0x101f('0x36')],_0x34e8a0,_0x12bf97,_0x5359df);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4e600fb..9f86a4b 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 _0x35ac=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','Router'];(function(_0x2febd4,_0x28a82d){var _0x3c9b77=function(_0x1412c8){while(--_0x1412c8){_0x2febd4['push'](_0x2febd4['shift']());}};_0x3c9b77(++_0x28a82d);}(_0x35ac,0x167));var _0xc35a=function(_0x30deed,_0x1825f0){_0x30deed=_0x30deed-0x0;var _0x217863=_0x35ac[_0x30deed];return _0x217863;};'use strict';var express=require('express');var router=express[_0xc35a('0x0')]();var controller=require(_0xc35a('0x1'));router[_0xc35a('0x2')]('/',controller[_0xc35a('0x3')]);router['post'](_0xc35a('0x4'),controller[_0xc35a('0x5')]);router[_0xc35a('0x2')](_0xc35a('0x6'),controller[_0xc35a('0x7')]);module[_0xc35a('0x8')]=router; \ No newline at end of file +var _0x5e1d=['post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x282731,_0x4dc6b6){var _0x53c281=function(_0x48d343){while(--_0x48d343){_0x282731['push'](_0x282731['shift']());}};_0x53c281(++_0x4dc6b6);}(_0x5e1d,0xf1));var _0xd5e1=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x5e1d[_0x4283c0];return _0x6b47ab;};'use strict';var express=require(_0xd5e1('0x0'));var router=express[_0xd5e1('0x1')]();var controller=require('./authLocal.controller');router[_0xd5e1('0x2')]('/',controller[_0xd5e1('0x3')]);router[_0xd5e1('0x2')](_0xd5e1('0x4'),controller[_0xd5e1('0x5')]);router[_0xd5e1('0x2')](_0xd5e1('0x6'),controller[_0xd5e1('0x7')]);module[_0xd5e1('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 456d260..b819448 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 _0xc7b7=['STRING','BOOLEAN','sequelize','exports'];(function(_0xc36fe1,_0x4e8695){var _0x48ce2a=function(_0x59d307){while(--_0x59d307){_0xc36fe1['push'](_0xc36fe1['shift']());}};_0x48ce2a(++_0x4e8695);}(_0xc7b7,0x6a));var _0x7c7b=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0xc7b7[_0x28111f];return _0x5203e6;};'use strict';var Sequelize=require(_0x7c7b('0x0'));module[_0x7c7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7c7b('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7c7b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xabdb=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xabdb,0x14c));var _0xbabd=function(_0x3e19ef,_0x3ebb39){_0x3e19ef=_0x3e19ef-0x0;var _0xc087e7=_0xabdb[_0x3e19ef];return _0xc087e7;};'use strict';var Sequelize=require(_0xbabd('0x0'));module['exports']={'name':{'type':Sequelize[_0xbabd('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xbabd('0x1')]},'description':{'type':Sequelize[_0xbabd('0x1')]},'status':{'type':Sequelize[_0xbabd('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbabd('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index be5941f..b8e4517 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 _0x9e6e=['set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','addConditions','Condition','ids','getConditions','sort','hasOwnProperty','Action','omit','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x9e6e,0x12e));var _0xe9e6=function(_0x479dfd,_0x47ff77){_0x479dfd=_0x479dfd-0x0;var _0x5b82b4=_0x9e6e[_0x479dfd];return _0x5b82b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9e6('0x0'));var zipdir=require(_0xe9e6('0x1'));var jsonpatch=require(_0xe9e6('0x2'));var rp=require(_0xe9e6('0x3'));var moment=require(_0xe9e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e6('0x5'));var util=require(_0xe9e6('0x6'));var path=require(_0xe9e6('0x7'));var sox=require(_0xe9e6('0x8'));var csv=require(_0xe9e6('0x9'));var ejs=require(_0xe9e6('0xa'));var fs=require('fs');var fs_extra=require(_0xe9e6('0xb'));var _=require('lodash');var squel=require(_0xe9e6('0xc'));var crypto=require(_0xe9e6('0xd'));var jsforce=require(_0xe9e6('0xe'));var deskjs=require(_0xe9e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe9e6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9e6('0x13'))(_0xe9e6('0x14'));var utils=require('../../config/utils');var config=require(_0xe9e6('0x15'));var licenseUtil=require(_0xe9e6('0x16'));var db=require(_0xe9e6('0x17'))['db'];function respondWithStatusCode(_0x4c4671,_0x3a2af7){_0x3a2af7=_0x3a2af7||0xcc;return function(_0x52bfaf){if(_0x52bfaf){return _0x4c4671['sendStatus'](_0x3a2af7);}return _0x4c4671[_0xe9e6('0x18')](_0x3a2af7)['end']();};}function respondWithResult(_0x5bfe18,_0x2d34ea){_0x2d34ea=_0x2d34ea||0xc8;return function(_0x116967){if(_0x116967){return _0x5bfe18[_0xe9e6('0x18')](_0x2d34ea)[_0xe9e6('0x19')](_0x116967);}};}function respondWithFilteredResult(_0x2ca322,_0x28cea7){return function(_0x491e56){if(_0x491e56){var _0x14a56d=typeof _0x28cea7['offset']===_0xe9e6('0x1a')&&typeof _0x28cea7[_0xe9e6('0x1b')]==='undefined';var _0x104d7c=_0x491e56[_0xe9e6('0x1c')];var _0x34bfc4=_0x14a56d?0x0:_0x28cea7[_0xe9e6('0x1d')];var _0x5874c1=_0x14a56d?_0x491e56[_0xe9e6('0x1c')]:_0x28cea7[_0xe9e6('0x1d')]+_0x28cea7[_0xe9e6('0x1b')];var _0x173c26;if(_0x5874c1>=_0x104d7c){_0x5874c1=_0x104d7c;_0x173c26=0xc8;}else{_0x173c26=0xce;}_0x2ca322[_0xe9e6('0x18')](_0x173c26);return _0x2ca322[_0xe9e6('0x1e')]('Content-Range',_0x34bfc4+'-'+_0x5874c1+'/'+_0x104d7c)['json'](_0x491e56);}return null;};}function patchUpdates(_0xd69fa6){return function(_0x1e7160){try{jsonpatch[_0xe9e6('0x1f')](_0x1e7160,_0xd69fa6,!![]);}catch(_0x176b2c){return BPromise['reject'](_0x176b2c);}return _0x1e7160[_0xe9e6('0x20')]();};}function saveUpdates(_0x45dd61,_0x2b5ea5){return function(_0x19a179){if(_0x19a179){return _0x19a179[_0xe9e6('0x21')](_0x45dd61)[_0xe9e6('0x22')](function(_0x59a29d){return _0x59a29d;});}return null;};}function removeEntity(_0x26a47f,_0x494639){return function(_0x3b5e36){if(_0x3b5e36){return _0x3b5e36[_0xe9e6('0x23')]()[_0xe9e6('0x22')](function(){_0x26a47f[_0xe9e6('0x18')](0xcc)[_0xe9e6('0x24')]();});}};}function handleEntityNotFound(_0x207b43,_0x565e63){return function(_0x274cc5){if(!_0x274cc5){_0x207b43[_0xe9e6('0x25')](0x194);}return _0x274cc5;};}function handleError(_0x97217,_0x223e84){_0x223e84=_0x223e84||0x1f4;return function(_0x22e7f3){logger[_0xe9e6('0x26')](_0x22e7f3[_0xe9e6('0x27')]);if(_0x22e7f3[_0xe9e6('0x28')]){delete _0x22e7f3[_0xe9e6('0x28')];}_0x97217['status'](_0x223e84)[_0xe9e6('0x29')](_0x22e7f3);};}exports['index']=function(_0x35cffd,_0x2ae056){var _0x5ac634={},_0x45848c={},_0x1ce18b={'count':0x0,'rows':[]};var _0x1e6560=_[_0xe9e6('0x2a')](db[_0xe9e6('0x2b')][_0xe9e6('0x2c')],function(_0x4f150b){return{'name':_0x4f150b[_0xe9e6('0x2d')],'type':_0x4f150b[_0xe9e6('0x2e')][_0xe9e6('0x2f')]};});_0x45848c[_0xe9e6('0x30')]=_['map'](_0x1e6560,_0xe9e6('0x28'));_0x45848c['query']=_[_0xe9e6('0x31')](_0x35cffd[_0xe9e6('0x32')]);_0x45848c[_0xe9e6('0x33')]=_[_0xe9e6('0x34')](_0x45848c[_0xe9e6('0x30')],_0x45848c[_0xe9e6('0x32')]);_0x5ac634[_0xe9e6('0x35')]=_['intersection'](_0x45848c[_0xe9e6('0x30')],qs[_0xe9e6('0x36')](_0x35cffd[_0xe9e6('0x32')]['fields']));_0x5ac634[_0xe9e6('0x35')]=_0x5ac634[_0xe9e6('0x35')][_0xe9e6('0x37')]?_0x5ac634[_0xe9e6('0x35')]:_0x45848c[_0xe9e6('0x30')];if(!_0x35cffd[_0xe9e6('0x32')]['hasOwnProperty'](_0xe9e6('0x38'))){_0x5ac634[_0xe9e6('0x1b')]=qs[_0xe9e6('0x1b')](_0x35cffd[_0xe9e6('0x32')][_0xe9e6('0x1b')]);_0x5ac634[_0xe9e6('0x1d')]=qs[_0xe9e6('0x1d')](_0x35cffd[_0xe9e6('0x32')][_0xe9e6('0x1d')]);}_0x5ac634[_0xe9e6('0x39')]=qs['sort'](_0x35cffd[_0xe9e6('0x32')]['sort']);_0x5ac634[_0xe9e6('0x3a')]=qs[_0xe9e6('0x33')](_[_0xe9e6('0x3b')](_0x35cffd[_0xe9e6('0x32')],_0x45848c[_0xe9e6('0x33')]),_0x1e6560);if(_0x35cffd[_0xe9e6('0x32')][_0xe9e6('0x3c')]){_0x5ac634[_0xe9e6('0x3a')]=_[_0xe9e6('0x3d')](_0x5ac634['where'],{'$or':_[_0xe9e6('0x2a')](_0x1e6560,function(_0x29eb40){if(_0x29eb40[_0xe9e6('0x2e')]!==_0xe9e6('0x3e')){var _0x5b2bbf={};_0x5b2bbf[_0x29eb40[_0xe9e6('0x28')]]={'$like':'%'+_0x35cffd['query']['filter']+'%'};return _0x5b2bbf;}})});}_0x5ac634=_[_0xe9e6('0x3d')]({},_0x5ac634,_0x35cffd[_0xe9e6('0x3f')]);var _0xcff5bd={'where':_0x5ac634[_0xe9e6('0x3a')]};return db[_0xe9e6('0x2b')]['count'](_0xcff5bd)['then'](function(_0x3d13fb){_0x1ce18b[_0xe9e6('0x1c')]=_0x3d13fb;if(_0x35cffd[_0xe9e6('0x32')][_0xe9e6('0x40')]){_0x5ac634[_0xe9e6('0x41')]=[{'all':!![]}];}return db[_0xe9e6('0x2b')][_0xe9e6('0x42')](_0x5ac634);})[_0xe9e6('0x22')](function(_0x1ecbe0){_0x1ce18b[_0xe9e6('0x43')]=_0x1ecbe0;return _0x1ce18b;})['then'](respondWithFilteredResult(_0x2ae056,_0x5ac634))['catch'](handleError(_0x2ae056,null));};exports['show']=function(_0x2a66d6,_0x30457f){var _0x52796c={'raw':![],'where':{'id':_0x2a66d6['params']['id']}},_0x242323={};_0x242323[_0xe9e6('0x30')]=_[_0xe9e6('0x31')](db[_0xe9e6('0x2b')]['rawAttributes']);_0x242323[_0xe9e6('0x32')]=_[_0xe9e6('0x31')](_0x2a66d6['query']);_0x242323[_0xe9e6('0x33')]=_['intersection'](_0x242323[_0xe9e6('0x30')],_0x242323[_0xe9e6('0x32')]);_0x52796c[_0xe9e6('0x35')]=_[_0xe9e6('0x34')](_0x242323[_0xe9e6('0x30')],qs[_0xe9e6('0x36')](_0x2a66d6[_0xe9e6('0x32')][_0xe9e6('0x36')]));_0x52796c[_0xe9e6('0x35')]=_0x52796c[_0xe9e6('0x35')][_0xe9e6('0x37')]?_0x52796c[_0xe9e6('0x35')]:_0x242323[_0xe9e6('0x30')];if(_0x2a66d6['query'][_0xe9e6('0x40')]){_0x52796c['include']=[{'all':!![]}];}_0x52796c=_['merge']({},_0x52796c,_0x2a66d6['options']);return db[_0xe9e6('0x2b')][_0xe9e6('0x44')](_0x52796c)[_0xe9e6('0x22')](handleEntityNotFound(_0x30457f,null))[_0xe9e6('0x22')](respondWithResult(_0x30457f,null))[_0xe9e6('0x45')](handleError(_0x30457f,null));};exports[_0xe9e6('0x46')]=function(_0x465c79,_0x3e8c7d){return db[_0xe9e6('0x2b')][_0xe9e6('0x46')](_0x465c79[_0xe9e6('0x47')],{})[_0xe9e6('0x22')](respondWithResult(_0x3e8c7d,0xc9))[_0xe9e6('0x45')](handleError(_0x3e8c7d,null));};exports[_0xe9e6('0x21')]=function(_0x4cae64,_0x309cca){if(_0x4cae64[_0xe9e6('0x47')]['id']){delete _0x4cae64['body']['id'];}return db['Automation']['find']({'where':{'id':_0x4cae64['params']['id']}})[_0xe9e6('0x22')](handleEntityNotFound(_0x309cca,null))[_0xe9e6('0x22')](saveUpdates(_0x4cae64[_0xe9e6('0x47')],null))[_0xe9e6('0x22')](respondWithResult(_0x309cca,null))[_0xe9e6('0x45')](handleError(_0x309cca,null));};exports[_0xe9e6('0x23')]=function(_0x165b43,_0x197fdc){return db[_0xe9e6('0x2b')][_0xe9e6('0x44')]({'where':{'id':_0x165b43[_0xe9e6('0x48')]['id']}})['then'](handleEntityNotFound(_0x197fdc,null))['then'](removeEntity(_0x197fdc,null))[_0xe9e6('0x45')](handleError(_0x197fdc,null));};exports[_0xe9e6('0x49')]=function(_0x271075,_0x2741e0,_0x3a4b6f){return db[_0xe9e6('0x4a')][_0xe9e6('0x44')]({'where':{'id':_0x271075[_0xe9e6('0x48')]['id']}})[_0xe9e6('0x22')](handleEntityNotFound(_0x2741e0,null))[_0xe9e6('0x22')](function(_0x3d6197){if(_0x3d6197){return _0x3d6197[_0xe9e6('0x49')](_0x271075[_0xe9e6('0x47')][_0xe9e6('0x4b')],_['omit'](_0x271075['body'],[_0xe9e6('0x4b'),'id'])||{});}})[_0xe9e6('0x22')](respondWithResult(_0x2741e0,null))['catch'](handleError(_0x2741e0,null));};exports[_0xe9e6('0x4c')]=function(_0x511309,_0x183af5,_0x2a9fc2){var _0x59e49f={};var _0x50d9ca={};var _0x547d9e;var _0x4d8da6;return db[_0xe9e6('0x2b')]['findOne']({'where':{'id':_0x511309[_0xe9e6('0x48')]['id']}})[_0xe9e6('0x22')](handleEntityNotFound(_0x183af5,null))['then'](function(_0x305ecc){if(_0x305ecc){_0x547d9e=_0x305ecc;_0x50d9ca[_0xe9e6('0x30')]=_[_0xe9e6('0x31')](db[_0xe9e6('0x4a')][_0xe9e6('0x2c')]);_0x50d9ca[_0xe9e6('0x32')]=_[_0xe9e6('0x31')](_0x511309[_0xe9e6('0x32')]);_0x50d9ca['filters']=_[_0xe9e6('0x34')](_0x50d9ca[_0xe9e6('0x30')],_0x50d9ca[_0xe9e6('0x32')]);_0x59e49f[_0xe9e6('0x35')]=_['intersection'](_0x50d9ca[_0xe9e6('0x30')],qs['fields'](_0x511309[_0xe9e6('0x32')][_0xe9e6('0x36')]));_0x59e49f[_0xe9e6('0x35')]=_0x59e49f['attributes']['length']?_0x59e49f[_0xe9e6('0x35')]:_0x50d9ca['model'];_0x59e49f['order']=qs[_0xe9e6('0x4d')](_0x511309[_0xe9e6('0x32')][_0xe9e6('0x4d')]);_0x59e49f[_0xe9e6('0x3a')]=qs[_0xe9e6('0x33')](_[_0xe9e6('0x3b')](_0x511309[_0xe9e6('0x32')],_0x50d9ca[_0xe9e6('0x33')]));if(_0x511309[_0xe9e6('0x32')]['filter']){_0x59e49f[_0xe9e6('0x3a')]=_[_0xe9e6('0x3d')](_0x59e49f[_0xe9e6('0x3a')],{'$or':_[_0xe9e6('0x2a')](_0x59e49f[_0xe9e6('0x35')],function(_0x19f827){var _0x25b205={};_0x25b205[_0x19f827]={'$like':'%'+_0x511309[_0xe9e6('0x32')][_0xe9e6('0x3c')]+'%'};return _0x25b205;})});}_0x59e49f=_[_0xe9e6('0x3d')]({},_0x59e49f,_0x511309['options']);return _0x547d9e['getConditions'](_0x59e49f);}})[_0xe9e6('0x22')](function(_0x306a07){if(_0x306a07){_0x4d8da6=_0x306a07[_0xe9e6('0x37')];if(!_0x511309[_0xe9e6('0x32')][_0xe9e6('0x4e')]('nolimit')){_0x59e49f[_0xe9e6('0x1b')]=qs['limit'](_0x511309[_0xe9e6('0x32')]['limit']);_0x59e49f[_0xe9e6('0x1d')]=qs[_0xe9e6('0x1d')](_0x511309[_0xe9e6('0x32')]['offset']);}return _0x547d9e[_0xe9e6('0x4c')](_0x59e49f);}})[_0xe9e6('0x22')](function(_0x2bc01d){if(_0x2bc01d){return _0x2bc01d?{'count':_0x4d8da6,'rows':_0x2bc01d}:null;}})[_0xe9e6('0x22')](respondWithResult(_0x183af5,null))[_0xe9e6('0x45')](handleError(_0x183af5,null));};exports['addActions']=function(_0x36b547,_0x228453,_0x1c0e1b){return db[_0xe9e6('0x4f')]['find']({'where':{'id':_0x36b547[_0xe9e6('0x48')]['id']}})[_0xe9e6('0x22')](handleEntityNotFound(_0x228453,null))[_0xe9e6('0x22')](function(_0xdf54e2){if(_0xdf54e2){return _0xdf54e2['addActions'](_0x36b547[_0xe9e6('0x47')]['ids'],_[_0xe9e6('0x50')](_0x36b547['body'],[_0xe9e6('0x4b'),'id'])||{});}})[_0xe9e6('0x22')](respondWithResult(_0x228453,null))[_0xe9e6('0x45')](handleError(_0x228453,null));};exports[_0xe9e6('0x51')]=function(_0x3de6a1,_0x3bfee2,_0x322a64){var _0x1be6bb={};var _0x560299={};var _0x3a7abf;var _0x417b76;return db[_0xe9e6('0x2b')][_0xe9e6('0x52')]({'where':{'id':_0x3de6a1[_0xe9e6('0x48')]['id']}})[_0xe9e6('0x22')](handleEntityNotFound(_0x3bfee2,null))[_0xe9e6('0x22')](function(_0x56f782){if(_0x56f782){_0x3a7abf=_0x56f782;_0x560299['model']=_[_0xe9e6('0x31')](db[_0xe9e6('0x4f')][_0xe9e6('0x2c')]);_0x560299[_0xe9e6('0x32')]=_['keys'](_0x3de6a1[_0xe9e6('0x32')]);_0x560299[_0xe9e6('0x33')]=_[_0xe9e6('0x34')](_0x560299[_0xe9e6('0x30')],_0x560299['query']);_0x1be6bb[_0xe9e6('0x35')]=_[_0xe9e6('0x34')](_0x560299[_0xe9e6('0x30')],qs['fields'](_0x3de6a1[_0xe9e6('0x32')][_0xe9e6('0x36')]));_0x1be6bb[_0xe9e6('0x35')]=_0x1be6bb[_0xe9e6('0x35')]['length']?_0x1be6bb[_0xe9e6('0x35')]:_0x560299['model'];_0x1be6bb[_0xe9e6('0x39')]=qs['sort'](_0x3de6a1[_0xe9e6('0x32')][_0xe9e6('0x4d')]);_0x1be6bb[_0xe9e6('0x3a')]=qs['filters'](_[_0xe9e6('0x3b')](_0x3de6a1[_0xe9e6('0x32')],_0x560299[_0xe9e6('0x33')]));if(_0x3de6a1[_0xe9e6('0x32')][_0xe9e6('0x3c')]){_0x1be6bb[_0xe9e6('0x3a')]=_[_0xe9e6('0x3d')](_0x1be6bb['where'],{'$or':_['map'](_0x1be6bb[_0xe9e6('0x35')],function(_0x1e64e1){var _0xf2b8a7={};_0xf2b8a7[_0x1e64e1]={'$like':'%'+_0x3de6a1[_0xe9e6('0x32')][_0xe9e6('0x3c')]+'%'};return _0xf2b8a7;})});}_0x1be6bb=_['merge']({},_0x1be6bb,_0x3de6a1[_0xe9e6('0x3f')]);return _0x3a7abf[_0xe9e6('0x51')](_0x1be6bb);}})['then'](function(_0x32460b){if(_0x32460b){_0x417b76=_0x32460b[_0xe9e6('0x37')];if(!_0x3de6a1[_0xe9e6('0x32')][_0xe9e6('0x4e')](_0xe9e6('0x38'))){_0x1be6bb['limit']=qs[_0xe9e6('0x1b')](_0x3de6a1['query']['limit']);_0x1be6bb[_0xe9e6('0x1d')]=qs[_0xe9e6('0x1d')](_0x3de6a1[_0xe9e6('0x32')]['offset']);}return _0x3a7abf[_0xe9e6('0x51')](_0x1be6bb);}})['then'](function(_0x479ef0){if(_0x479ef0){return _0x479ef0?{'count':_0x417b76,'rows':_0x479ef0}:null;}})[_0xe9e6('0x22')](respondWithResult(_0x3bfee2,null))[_0xe9e6('0x45')](handleError(_0x3bfee2,null));}; \ No newline at end of file +var _0xbf82=['where','filters','pick','filter','merge','VIRTUAL','options','count','rows','catch','params','keys','length','includeAll','include','find','create','body','addConditions','Condition','omit','getConditions','findOne','addActions','Action','ids','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x377a55,_0x9545a6){var _0x44f60d=function(_0xbf8aed){while(--_0xbf8aed){_0x377a55['push'](_0x377a55['shift']());}};_0x44f60d(++_0x9545a6);}(_0xbf82,0xbf));var _0x2bf8=function(_0x3433c8,_0x42f4dd){_0x3433c8=_0x3433c8-0x0;var _0x56edc3=_0xbf82[_0x3433c8];return _0x56edc3;};'use strict';var emlformat=require(_0x2bf8('0x0'));var rimraf=require(_0x2bf8('0x1'));var zipdir=require(_0x2bf8('0x2'));var jsonpatch=require(_0x2bf8('0x3'));var rp=require(_0x2bf8('0x4'));var moment=require(_0x2bf8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2bf8('0x6'));var util=require('util');var path=require(_0x2bf8('0x7'));var sox=require(_0x2bf8('0x8'));var csv=require(_0x2bf8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bf8('0xa'));var _=require(_0x2bf8('0xb'));var squel=require(_0x2bf8('0xc'));var crypto=require(_0x2bf8('0xd'));var jsforce=require(_0x2bf8('0xe'));var deskjs=require(_0x2bf8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2bf8('0x10'));var Papa=require(_0x2bf8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2bf8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bf8('0x13'));var utils=require(_0x2bf8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2bf8('0x15'));var db=require(_0x2bf8('0x16'))['db'];function respondWithStatusCode(_0x3f1a57,_0x118c35){_0x118c35=_0x118c35||0xcc;return function(_0x364682){if(_0x364682){return _0x3f1a57[_0x2bf8('0x17')](_0x118c35);}return _0x3f1a57[_0x2bf8('0x18')](_0x118c35)[_0x2bf8('0x19')]();};}function respondWithResult(_0x43bedf,_0x432f0c){_0x432f0c=_0x432f0c||0xc8;return function(_0x304e5c){if(_0x304e5c){return _0x43bedf[_0x2bf8('0x18')](_0x432f0c)[_0x2bf8('0x1a')](_0x304e5c);}};}function respondWithFilteredResult(_0x3cda98,_0xb9ceb0){return function(_0x18b3cf){if(_0x18b3cf){var _0x481055=typeof _0xb9ceb0[_0x2bf8('0x1b')]==='undefined'&&typeof _0xb9ceb0[_0x2bf8('0x1c')]===_0x2bf8('0x1d');var _0x5d2899=_0x18b3cf['count'];var _0x1646a5=_0x481055?0x0:_0xb9ceb0[_0x2bf8('0x1b')];var _0x3ef40a=_0x481055?_0x18b3cf['count']:_0xb9ceb0['offset']+_0xb9ceb0['limit'];var _0x10b07a;if(_0x3ef40a>=_0x5d2899){_0x3ef40a=_0x5d2899;_0x10b07a=0xc8;}else{_0x10b07a=0xce;}_0x3cda98[_0x2bf8('0x18')](_0x10b07a);return _0x3cda98[_0x2bf8('0x1e')](_0x2bf8('0x1f'),_0x1646a5+'-'+_0x3ef40a+'/'+_0x5d2899)[_0x2bf8('0x1a')](_0x18b3cf);}return null;};}function patchUpdates(_0x38b743){return function(_0x5c6497){try{jsonpatch['apply'](_0x5c6497,_0x38b743,!![]);}catch(_0x7f867a){return BPromise['reject'](_0x7f867a);}return _0x5c6497['save']();};}function saveUpdates(_0x56c9c5,_0x5ae37c){return function(_0x47a276){if(_0x47a276){return _0x47a276[_0x2bf8('0x20')](_0x56c9c5)[_0x2bf8('0x21')](function(_0x5cd5d1){return _0x5cd5d1;});}return null;};}function removeEntity(_0x1a488f,_0x19410f){return function(_0x231eb8){if(_0x231eb8){return _0x231eb8[_0x2bf8('0x22')]()['then'](function(){_0x1a488f[_0x2bf8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9a9e,_0xf1b7dc){return function(_0x1586a1){if(!_0x1586a1){_0x4a9a9e[_0x2bf8('0x17')](0x194);}return _0x1586a1;};}function handleError(_0x5ce628,_0x113acb){_0x113acb=_0x113acb||0x1f4;return function(_0x2143a3){logger[_0x2bf8('0x23')](_0x2143a3[_0x2bf8('0x24')]);if(_0x2143a3[_0x2bf8('0x25')]){delete _0x2143a3[_0x2bf8('0x25')];}_0x5ce628[_0x2bf8('0x18')](_0x113acb)[_0x2bf8('0x26')](_0x2143a3);};}exports[_0x2bf8('0x27')]=function(_0x58f915,_0x7e368c){var _0x1c0f77={},_0x45e9d2={},_0x1fa1db={'count':0x0,'rows':[]};var _0x44f8aa=_[_0x2bf8('0x28')](db[_0x2bf8('0x29')][_0x2bf8('0x2a')],function(_0xbec4cd){return{'name':_0xbec4cd[_0x2bf8('0x2b')],'type':_0xbec4cd[_0x2bf8('0x2c')][_0x2bf8('0x2d')]};});_0x45e9d2['model']=_[_0x2bf8('0x28')](_0x44f8aa,'name');_0x45e9d2[_0x2bf8('0x2e')]=_['keys'](_0x58f915[_0x2bf8('0x2e')]);_0x45e9d2['filters']=_[_0x2bf8('0x2f')](_0x45e9d2['model'],_0x45e9d2['query']);_0x1c0f77[_0x2bf8('0x30')]=_['intersection'](_0x45e9d2[_0x2bf8('0x31')],qs[_0x2bf8('0x32')](_0x58f915[_0x2bf8('0x2e')][_0x2bf8('0x32')]));_0x1c0f77['attributes']=_0x1c0f77[_0x2bf8('0x30')]['length']?_0x1c0f77[_0x2bf8('0x30')]:_0x45e9d2[_0x2bf8('0x31')];if(!_0x58f915['query'][_0x2bf8('0x33')](_0x2bf8('0x34'))){_0x1c0f77[_0x2bf8('0x1c')]=qs['limit'](_0x58f915[_0x2bf8('0x2e')][_0x2bf8('0x1c')]);_0x1c0f77['offset']=qs[_0x2bf8('0x1b')](_0x58f915[_0x2bf8('0x2e')]['offset']);}_0x1c0f77[_0x2bf8('0x35')]=qs[_0x2bf8('0x36')](_0x58f915['query'][_0x2bf8('0x36')]);_0x1c0f77[_0x2bf8('0x37')]=qs[_0x2bf8('0x38')](_[_0x2bf8('0x39')](_0x58f915[_0x2bf8('0x2e')],_0x45e9d2['filters']),_0x44f8aa);if(_0x58f915['query'][_0x2bf8('0x3a')]){_0x1c0f77[_0x2bf8('0x37')]=_[_0x2bf8('0x3b')](_0x1c0f77[_0x2bf8('0x37')],{'$or':_['map'](_0x44f8aa,function(_0x10ae89){if(_0x10ae89[_0x2bf8('0x2c')]!==_0x2bf8('0x3c')){var _0xb4209a={};_0xb4209a[_0x10ae89['name']]={'$like':'%'+_0x58f915[_0x2bf8('0x2e')][_0x2bf8('0x3a')]+'%'};return _0xb4209a;}})});}_0x1c0f77=_[_0x2bf8('0x3b')]({},_0x1c0f77,_0x58f915[_0x2bf8('0x3d')]);var _0x1dc095={'where':_0x1c0f77[_0x2bf8('0x37')]};return db[_0x2bf8('0x29')][_0x2bf8('0x3e')](_0x1dc095)['then'](function(_0x3ab3c8){_0x1fa1db[_0x2bf8('0x3e')]=_0x3ab3c8;if(_0x58f915[_0x2bf8('0x2e')]['includeAll']){_0x1c0f77['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x1c0f77);})['then'](function(_0x4128f8){_0x1fa1db[_0x2bf8('0x3f')]=_0x4128f8;return _0x1fa1db;})['then'](respondWithFilteredResult(_0x7e368c,_0x1c0f77))[_0x2bf8('0x40')](handleError(_0x7e368c,null));};exports['show']=function(_0x1667d8,_0x12aa2d){var _0x2c06d2={'raw':![],'where':{'id':_0x1667d8[_0x2bf8('0x41')]['id']}},_0x314274={};_0x314274[_0x2bf8('0x31')]=_[_0x2bf8('0x42')](db[_0x2bf8('0x29')][_0x2bf8('0x2a')]);_0x314274['query']=_[_0x2bf8('0x42')](_0x1667d8[_0x2bf8('0x2e')]);_0x314274[_0x2bf8('0x38')]=_[_0x2bf8('0x2f')](_0x314274['model'],_0x314274['query']);_0x2c06d2[_0x2bf8('0x30')]=_[_0x2bf8('0x2f')](_0x314274['model'],qs[_0x2bf8('0x32')](_0x1667d8[_0x2bf8('0x2e')][_0x2bf8('0x32')]));_0x2c06d2[_0x2bf8('0x30')]=_0x2c06d2[_0x2bf8('0x30')][_0x2bf8('0x43')]?_0x2c06d2[_0x2bf8('0x30')]:_0x314274[_0x2bf8('0x31')];if(_0x1667d8[_0x2bf8('0x2e')][_0x2bf8('0x44')]){_0x2c06d2[_0x2bf8('0x45')]=[{'all':!![]}];}_0x2c06d2=_[_0x2bf8('0x3b')]({},_0x2c06d2,_0x1667d8[_0x2bf8('0x3d')]);return db[_0x2bf8('0x29')][_0x2bf8('0x46')](_0x2c06d2)['then'](handleEntityNotFound(_0x12aa2d,null))[_0x2bf8('0x21')](respondWithResult(_0x12aa2d,null))['catch'](handleError(_0x12aa2d,null));};exports[_0x2bf8('0x47')]=function(_0x45e5f7,_0x2043af){return db[_0x2bf8('0x29')][_0x2bf8('0x47')](_0x45e5f7[_0x2bf8('0x48')],{})['then'](respondWithResult(_0x2043af,0xc9))[_0x2bf8('0x40')](handleError(_0x2043af,null));};exports[_0x2bf8('0x20')]=function(_0x4212e5,_0x2dab0a){if(_0x4212e5['body']['id']){delete _0x4212e5[_0x2bf8('0x48')]['id'];}return db[_0x2bf8('0x29')][_0x2bf8('0x46')]({'where':{'id':_0x4212e5['params']['id']}})[_0x2bf8('0x21')](handleEntityNotFound(_0x2dab0a,null))[_0x2bf8('0x21')](saveUpdates(_0x4212e5['body'],null))['then'](respondWithResult(_0x2dab0a,null))['catch'](handleError(_0x2dab0a,null));};exports[_0x2bf8('0x22')]=function(_0x4109a1,_0x3ee7ad){return db['Automation'][_0x2bf8('0x46')]({'where':{'id':_0x4109a1[_0x2bf8('0x41')]['id']}})[_0x2bf8('0x21')](handleEntityNotFound(_0x3ee7ad,null))[_0x2bf8('0x21')](removeEntity(_0x3ee7ad,null))[_0x2bf8('0x40')](handleError(_0x3ee7ad,null));};exports[_0x2bf8('0x49')]=function(_0x557b34,_0x36de37,_0x229263){return db[_0x2bf8('0x4a')]['find']({'where':{'id':_0x557b34[_0x2bf8('0x41')]['id']}})['then'](handleEntityNotFound(_0x36de37,null))['then'](function(_0xf4a030){if(_0xf4a030){return _0xf4a030['addConditions'](_0x557b34[_0x2bf8('0x48')]['ids'],_[_0x2bf8('0x4b')](_0x557b34[_0x2bf8('0x48')],['ids','id'])||{});}})[_0x2bf8('0x21')](respondWithResult(_0x36de37,null))[_0x2bf8('0x40')](handleError(_0x36de37,null));};exports[_0x2bf8('0x4c')]=function(_0x14034b,_0x4bb71d,_0x96bbe2){var _0x1517d6={};var _0x44f888={};var _0x210cc7;var _0x313bcb;return db[_0x2bf8('0x29')][_0x2bf8('0x4d')]({'where':{'id':_0x14034b[_0x2bf8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bb71d,null))['then'](function(_0x33804f){if(_0x33804f){_0x210cc7=_0x33804f;_0x44f888[_0x2bf8('0x31')]=_[_0x2bf8('0x42')](db[_0x2bf8('0x4a')][_0x2bf8('0x2a')]);_0x44f888['query']=_['keys'](_0x14034b['query']);_0x44f888[_0x2bf8('0x38')]=_['intersection'](_0x44f888[_0x2bf8('0x31')],_0x44f888[_0x2bf8('0x2e')]);_0x1517d6[_0x2bf8('0x30')]=_[_0x2bf8('0x2f')](_0x44f888['model'],qs[_0x2bf8('0x32')](_0x14034b['query'][_0x2bf8('0x32')]));_0x1517d6['attributes']=_0x1517d6[_0x2bf8('0x30')]['length']?_0x1517d6[_0x2bf8('0x30')]:_0x44f888[_0x2bf8('0x31')];_0x1517d6['order']=qs[_0x2bf8('0x36')](_0x14034b[_0x2bf8('0x2e')][_0x2bf8('0x36')]);_0x1517d6[_0x2bf8('0x37')]=qs[_0x2bf8('0x38')](_[_0x2bf8('0x39')](_0x14034b[_0x2bf8('0x2e')],_0x44f888[_0x2bf8('0x38')]));if(_0x14034b['query']['filter']){_0x1517d6[_0x2bf8('0x37')]=_[_0x2bf8('0x3b')](_0x1517d6[_0x2bf8('0x37')],{'$or':_[_0x2bf8('0x28')](_0x1517d6[_0x2bf8('0x30')],function(_0x555d0a){var _0x4898cf={};_0x4898cf[_0x555d0a]={'$like':'%'+_0x14034b[_0x2bf8('0x2e')][_0x2bf8('0x3a')]+'%'};return _0x4898cf;})});}_0x1517d6=_['merge']({},_0x1517d6,_0x14034b['options']);return _0x210cc7['getConditions'](_0x1517d6);}})['then'](function(_0x421d05){if(_0x421d05){_0x313bcb=_0x421d05[_0x2bf8('0x43')];if(!_0x14034b[_0x2bf8('0x2e')][_0x2bf8('0x33')]('nolimit')){_0x1517d6['limit']=qs[_0x2bf8('0x1c')](_0x14034b[_0x2bf8('0x2e')]['limit']);_0x1517d6['offset']=qs[_0x2bf8('0x1b')](_0x14034b[_0x2bf8('0x2e')][_0x2bf8('0x1b')]);}return _0x210cc7[_0x2bf8('0x4c')](_0x1517d6);}})[_0x2bf8('0x21')](function(_0x2e2ff0){if(_0x2e2ff0){return _0x2e2ff0?{'count':_0x313bcb,'rows':_0x2e2ff0}:null;}})[_0x2bf8('0x21')](respondWithResult(_0x4bb71d,null))['catch'](handleError(_0x4bb71d,null));};exports[_0x2bf8('0x4e')]=function(_0x2177d8,_0x2e20e3,_0x2bfce9){return db[_0x2bf8('0x4f')]['find']({'where':{'id':_0x2177d8[_0x2bf8('0x41')]['id']}})[_0x2bf8('0x21')](handleEntityNotFound(_0x2e20e3,null))[_0x2bf8('0x21')](function(_0x2accc7){if(_0x2accc7){return _0x2accc7[_0x2bf8('0x4e')](_0x2177d8[_0x2bf8('0x48')][_0x2bf8('0x50')],_[_0x2bf8('0x4b')](_0x2177d8[_0x2bf8('0x48')],[_0x2bf8('0x50'),'id'])||{});}})['then'](respondWithResult(_0x2e20e3,null))[_0x2bf8('0x40')](handleError(_0x2e20e3,null));};exports[_0x2bf8('0x51')]=function(_0x56cb71,_0x59d88a,_0x5e8a3a){var _0x5ac76a={};var _0x5cd366={};var _0x3c7993;var _0x53b090;return db[_0x2bf8('0x29')][_0x2bf8('0x4d')]({'where':{'id':_0x56cb71[_0x2bf8('0x41')]['id']}})[_0x2bf8('0x21')](handleEntityNotFound(_0x59d88a,null))['then'](function(_0x1a63ce){if(_0x1a63ce){_0x3c7993=_0x1a63ce;_0x5cd366['model']=_[_0x2bf8('0x42')](db['Action'][_0x2bf8('0x2a')]);_0x5cd366[_0x2bf8('0x2e')]=_[_0x2bf8('0x42')](_0x56cb71[_0x2bf8('0x2e')]);_0x5cd366[_0x2bf8('0x38')]=_[_0x2bf8('0x2f')](_0x5cd366[_0x2bf8('0x31')],_0x5cd366[_0x2bf8('0x2e')]);_0x5ac76a[_0x2bf8('0x30')]=_[_0x2bf8('0x2f')](_0x5cd366['model'],qs[_0x2bf8('0x32')](_0x56cb71[_0x2bf8('0x2e')][_0x2bf8('0x32')]));_0x5ac76a[_0x2bf8('0x30')]=_0x5ac76a[_0x2bf8('0x30')]['length']?_0x5ac76a[_0x2bf8('0x30')]:_0x5cd366['model'];_0x5ac76a[_0x2bf8('0x35')]=qs['sort'](_0x56cb71[_0x2bf8('0x2e')][_0x2bf8('0x36')]);_0x5ac76a[_0x2bf8('0x37')]=qs[_0x2bf8('0x38')](_[_0x2bf8('0x39')](_0x56cb71[_0x2bf8('0x2e')],_0x5cd366['filters']));if(_0x56cb71['query'][_0x2bf8('0x3a')]){_0x5ac76a[_0x2bf8('0x37')]=_[_0x2bf8('0x3b')](_0x5ac76a[_0x2bf8('0x37')],{'$or':_['map'](_0x5ac76a[_0x2bf8('0x30')],function(_0x4751dc){var _0x297f3c={};_0x297f3c[_0x4751dc]={'$like':'%'+_0x56cb71['query'][_0x2bf8('0x3a')]+'%'};return _0x297f3c;})});}_0x5ac76a=_[_0x2bf8('0x3b')]({},_0x5ac76a,_0x56cb71[_0x2bf8('0x3d')]);return _0x3c7993['getActions'](_0x5ac76a);}})[_0x2bf8('0x21')](function(_0x20bbe5){if(_0x20bbe5){_0x53b090=_0x20bbe5['length'];if(!_0x56cb71[_0x2bf8('0x2e')]['hasOwnProperty'](_0x2bf8('0x34'))){_0x5ac76a[_0x2bf8('0x1c')]=qs[_0x2bf8('0x1c')](_0x56cb71['query'][_0x2bf8('0x1c')]);_0x5ac76a[_0x2bf8('0x1b')]=qs[_0x2bf8('0x1b')](_0x56cb71[_0x2bf8('0x2e')]['offset']);}return _0x3c7993[_0x2bf8('0x51')](_0x5ac76a);}})[_0x2bf8('0x21')](function(_0x28cd49){if(_0x28cd49){return _0x28cd49?{'count':_0x53b090,'rows':_0x28cd49}:null;}})['then'](respondWithResult(_0x59d88a,null))[_0x2bf8('0x40')](handleError(_0x59d88a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fcf3f17..2f4ef2a 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 _0x77dd=['../../config/logger','api','moment','request-promise','path','rimraf','./automation.attributes','tools_automations','lodash','util'];(function(_0xc92336,_0x23849f){var _0x57b44d=function(_0xf99d63){while(--_0xf99d63){_0xc92336['push'](_0xc92336['shift']());}};_0x57b44d(++_0x23849f);}(_0x77dd,0x15c));var _0xd77d=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x77dd[_0x14a0a0];return _0x56b651;};'use strict';var _=require(_0xd77d('0x0'));var util=require(_0xd77d('0x1'));var logger=require(_0xd77d('0x2'))(_0xd77d('0x3'));var moment=require(_0xd77d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd77d('0x5'));var fs=require('fs');var path=require(_0xd77d('0x6'));var rimraf=require(_0xd77d('0x7'));var config=require('../../config/environment');var attributes=require(_0xd77d('0x8'));module['exports']=function(_0x2ce7a5,_0x232a6b){return _0x2ce7a5['define']('Automation',attributes,{'tableName':_0xd77d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x588a=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','../../config/logger','api'];(function(_0x5f5495,_0x30d087){var _0x14d8a3=function(_0x40e773){while(--_0x40e773){_0x5f5495['push'](_0x5f5495['shift']());}};_0x14d8a3(++_0x30d087);}(_0x588a,0x19f));var _0xa588=function(_0x2ef586,_0x17cc0c){_0x2ef586=_0x2ef586-0x0;var _0x2bf324=_0x588a[_0x2ef586];return _0x2bf324;};'use strict';var _=require(_0xa588('0x0'));var util=require('util');var logger=require(_0xa588('0x1'))(_0xa588('0x2'));var moment=require('moment');var BPromise=require(_0xa588('0x3'));var rp=require(_0xa588('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa588('0x5'));var config=require(_0xa588('0x6'));var attributes=require(_0xa588('0x7'));module[_0xa588('0x8')]=function(_0x2edab6,_0x1644cc){return _0x2edab6[_0xa588('0x9')](_0xa588('0xa'),attributes,{'tableName':'tools_automations','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 7cd85a7..5cf1cb0 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 _0x404d=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x28b7f1,_0x4c6a8e){var _0x4f79d4=function(_0x337526){while(--_0x337526){_0x28b7f1['push'](_0x28b7f1['shift']());}};_0x4f79d4(++_0x4c6a8e);}(_0x404d,0x1e9));var _0xd404=function(_0x24558f,_0x5f2233){_0x24558f=_0x24558f-0x0;var _0x514db8=_0x404d[_0x24558f];return _0x514db8;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7faf39,_0x5da99f,_0x5c335f){return new BPromise(function(_0x10021a,_0x3d7e8a){return client['request'](_0x7faf39,_0x5c335f)['then'](function(_0x3096f0){logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x5da99f,_0xd404('0xe'),JSON[_0xd404('0xf')](_0x3096f0));if(_0x3096f0['error']){if(_0x3096f0[_0xd404('0x10')][_0xd404('0x11')]===0x1f4){logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x3d7e8a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x10021a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}else{logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));_0x10021a(_0x3096f0[_0xd404('0x13')][_0xd404('0x12')]);}})[_0xd404('0x14')](function(_0x155186){logger['error'](_0xd404('0xd'),_0x5da99f,_0x155186);_0x3d7e8a(_0x155186);});});} \ No newline at end of file +var _0x6302=['moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x20593e,_0x2f8bde){var _0x4f8546=function(_0x41cac5){while(--_0x41cac5){_0x20593e['push'](_0x20593e['shift']());}};_0x4f8546(++_0x2f8bde);}(_0x6302,0x109));var _0x2630=function(_0x4e9d06,_0x41825e){_0x4e9d06=_0x4e9d06-0x0;var _0xdea836=_0x6302[_0x4e9d06];return _0xdea836;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2867f8,_0x19231a,_0x2e1867){return new BPromise(function(_0x353f73,_0x581f4d){return client['request'](_0x2867f8,_0x2e1867)[_0x2630('0x9')](function(_0x10ffdf){logger['info'](_0x2630('0xa'),_0x19231a,'request\x20sent');logger[_0x2630('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x19231a,_0x2630('0xc'),JSON[_0x2630('0xd')](_0x10ffdf));if(_0x10ffdf[_0x2630('0xe')]){if(_0x10ffdf[_0x2630('0xe')][_0x2630('0xf')]===0x1f4){logger[_0x2630('0xe')]('Automation,\x20%s,\x20%s',_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x581f4d(_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);}logger['error'](_0x2630('0xa'),_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x353f73(_0x10ffdf['error'][_0x2630('0x10')]);}else{logger['info'](_0x2630('0xa'),_0x19231a,_0x2630('0xc'));_0x353f73(_0x10ffdf[_0x2630('0x11')][_0x2630('0x10')]);}})[_0x2630('0x12')](function(_0x18b2b0){logger[_0x2630('0xe')](_0x2630('0xa'),_0x19231a,_0x18b2b0);_0x581f4d(_0x18b2b0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ce117a7..e712289 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 _0x57cf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/conditions','/:id/actions','getActions','create','post','addActions','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x28236f,_0x313b4a){var _0x578bdf=function(_0xd18fc2){while(--_0xd18fc2){_0x28236f['push'](_0x28236f['shift']());}};_0x578bdf(++_0x313b4a);}(_0x57cf,0x11b));var _0xf57c=function(_0x3d11be,_0x1b9a8c){_0x3d11be=_0x3d11be-0x0;var _0x4b657b=_0x57cf[_0x3d11be];return _0x4b657b;};'use strict';var multer=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var path=require(_0xf57c('0x2'));var timeout=require(_0xf57c('0x3'));var express=require(_0xf57c('0x4'));var router=express[_0xf57c('0x5')]();var fs_extra=require(_0xf57c('0x6'));var auth=require(_0xf57c('0x7'));var interaction=require(_0xf57c('0x8'));var config=require(_0xf57c('0x9'));var controller=require('./automation.controller');router[_0xf57c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf57c('0xb')]);router['get']('/:id',auth[_0xf57c('0xc')](),controller['show']);router[_0xf57c('0xa')](_0xf57c('0xd'),auth['isAuthenticated'](),controller['getConditions']);router[_0xf57c('0xa')](_0xf57c('0xe'),auth[_0xf57c('0xc')](),controller[_0xf57c('0xf')]);router['post']('/',auth[_0xf57c('0xc')](),controller[_0xf57c('0x10')]);router[_0xf57c('0x11')]('/:id/conditions',auth[_0xf57c('0xc')](),controller['addConditions']);router[_0xf57c('0x11')](_0xf57c('0xe'),auth['isAuthenticated'](),controller[_0xf57c('0x12')]);router['put'](_0xf57c('0x13'),auth['isAuthenticated'](),controller[_0xf57c('0x14')]);router[_0xf57c('0x15')](_0xf57c('0x13'),auth[_0xf57c('0xc')](),controller[_0xf57c('0x16')]);module[_0xf57c('0x17')]=router; \ No newline at end of file +var _0x0eec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x3303ff,_0x29549a){var _0x32270a=function(_0x3ac1eb){while(--_0x3ac1eb){_0x3303ff['push'](_0x3303ff['shift']());}};_0x32270a(++_0x29549a);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc0ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc0ee('0x1'));var express=require(_0xc0ee('0x2'));var router=express[_0xc0ee('0x3')]();var fs_extra=require(_0xc0ee('0x4'));var auth=require(_0xc0ee('0x5'));var interaction=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var controller=require('./automation.controller');router[_0xc0ee('0x8')]('/',auth['isAuthenticated'](),controller[_0xc0ee('0x9')]);router[_0xc0ee('0x8')](_0xc0ee('0xa'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0xc')]);router[_0xc0ee('0x8')](_0xc0ee('0xd'),auth['isAuthenticated'](),controller[_0xc0ee('0xe')]);router[_0xc0ee('0x8')](_0xc0ee('0xf'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0x10')]);router[_0xc0ee('0x11')]('/',auth[_0xc0ee('0xb')](),controller['create']);router[_0xc0ee('0x11')](_0xc0ee('0xd'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0x12')]);router[_0xc0ee('0x11')](_0xc0ee('0xf'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0x13')]);router[_0xc0ee('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc0ee('0x15')]);router[_0xc0ee('0x16')](_0xc0ee('0xa'),auth['isAuthenticated'](),controller[_0xc0ee('0x17')]);module[_0xc0ee('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index cd09c90..fb9d62f 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 _0x0055=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','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','#AMD\x20Maximum\x20Word\x20Length','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','STRING','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x34a9d4,_0x8839c8){var _0x35f05c=function(_0x534b30){while(--_0x534b30){_0x34a9d4['push'](_0x34a9d4['shift']());}};_0x35f05c(++_0x8839c8);}(_0x0055,0x1ed));var _0x5005=function(_0x2656e0,_0x2d9a12){_0x2656e0=_0x2656e0-0x0;var _0x10fe8c=_0x0055[_0x2656e0];return _0x10fe8c;};'use strict';var Sequelize=require(_0x5005('0x0'));module[_0x5005('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5005('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5005('0x3')](_0x5005('0x4')),'allowNull':![],'defaultValue':_0x5005('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5005('0x5')],'defaultValue':0x0,'comment':_0x5005('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5005('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5005('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5005('0x8')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5005('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5005('0xb')](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x5005('0xb')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5005('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5005('0xb')](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5005('0x11')},'dialTimezone':{'type':Sequelize[_0x5005('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5005('0x8')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5005('0x12'),_0x5005('0x13'),'onlyIfOpen'),'defaultValue':_0x5005('0x12')},'dialAMDActive':{'type':Sequelize[_0x5005('0x5')],'defaultValue':0x0,'comment':_0x5005('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x5005('0xb')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5005('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x5005('0xb')](0x9)[_0x5005('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5005('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5005('0xb')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5005('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5005('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5005('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x5005('0xb')](0x9)[_0x5005('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5005('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5005('0xb')](0x9)[_0x5005('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5005('0xb')](0x9)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5005('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5005('0xb')](0x5)[_0x5005('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5005('0xb')](0x9)[_0x5005('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5005('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5005('0x3')]('DESC',_0x5005('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x5005('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5005('0xb')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5005('0x1d')},'dialCutDigit':{'type':Sequelize[_0x5005('0xb')](0x3)[_0x5005('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5005('0xb')](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5005('0xb')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x5005('0xb')](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5005('0xb')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5005('0xb')](0x3)[_0x5005('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5005('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5005('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5005('0x26')}}; \ No newline at end of file +var _0x7425=['UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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,*,*,*','never','onlyIfOpen','always','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','INTEGER'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x7425,0x10b));var _0x5742=function(_0x338378,_0x14c014){_0x338378=_0x338378-0x0;var _0x395bf7=_0x7425[_0x338378];return _0x395bf7;};'use strict';var Sequelize=require(_0x5742('0x0'));module[_0x5742('0x1')]={'name':{'type':Sequelize[_0x5742('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5742('0x3')](_0x5742('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5742('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5742('0x5')](0x4)[_0x5742('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5742('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5742('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5742('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x5742('0x5')](0x3)[_0x5742('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5742('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5742('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5742('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5742('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5742('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5742('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5742('0x3')]('always',_0x5742('0xf'),_0x5742('0x10')),'defaultValue':_0x5742('0x11')},'dialAMDActive':{'type':Sequelize[_0x5742('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5742('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5742('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x5742('0x5')](0x9)[_0x5742('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5742('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5742('0x5')](0x9)[_0x5742('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5742('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5742('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5742('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5742('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5742('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5742('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5742('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5742('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5742('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5742('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5742('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5742('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5742('0x3')]('DESC',_0x5742('0x1c')),'defaultValue':_0x5742('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5742('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5742('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5742('0x5')](0x3)[_0x5742('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5742('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x5742('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5742('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5742('0x5')](0x3)[_0x5742('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5742('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5742('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5742('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5742('0x5')](0x5)[_0x5742('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5742('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c13372b..60e2821 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 _0x8978=['h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','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','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','error','getHoppers','CmHopper','pick','CampaignId','filter','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','hasOwnProperty','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','into','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?'];(function(_0x13da85,_0x1fd5b5){var _0x54be2c=function(_0x31faaa){while(--_0x31faaa){_0x13da85['push'](_0x13da85['shift']());}};_0x54be2c(++_0x1fd5b5);}(_0x8978,0x1cc));var _0x8897=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8978[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8897('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8897('0x1'));var moment=require('moment');var BPromise=require(_0x8897('0x2'));var Mustache=require(_0x8897('0x3'));var util=require(_0x8897('0x4'));var path=require(_0x8897('0x5'));var sox=require(_0x8897('0x6'));var csv=require('to-csv');var ejs=require(_0x8897('0x7'));var fs=require('fs');var fs_extra=require(_0x8897('0x8'));var _=require('lodash');var squel=require(_0x8897('0x9'));var crypto=require(_0x8897('0xa'));var jsforce=require(_0x8897('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8897('0xc'));var querystring=require('querystring');var Papa=require(_0x8897('0xd'));var Redis=require('ioredis');var authService=require(_0x8897('0xe'));var qs=require(_0x8897('0xf'));var as=require(_0x8897('0x10'));var hardwareService=require(_0x8897('0x11'));var logger=require('../../config/logger')(_0x8897('0x12'));var utils=require(_0x8897('0x13'));var config=require(_0x8897('0x14'));var licenseUtil=require(_0x8897('0x15'));var db=require(_0x8897('0x16'))['db'];function respondWithStatusCode(_0xd9bb97,_0x294348){_0x294348=_0x294348||0xcc;return function(_0x487eae){if(_0x487eae){return _0xd9bb97[_0x8897('0x17')](_0x294348);}return _0xd9bb97['status'](_0x294348)['end']();};}function respondWithResult(_0x550559,_0x4a5070){_0x4a5070=_0x4a5070||0xc8;return function(_0x490a9a){if(_0x490a9a){return _0x550559[_0x8897('0x18')](_0x4a5070)[_0x8897('0x19')](_0x490a9a);}};}function respondWithFilteredResult(_0x3cc0e9,_0x14383b){return function(_0x2528e3){if(_0x2528e3){var _0x28e689=typeof _0x14383b[_0x8897('0x1a')]===_0x8897('0x1b')&&typeof _0x14383b[_0x8897('0x1c')]==='undefined';var _0x5044dc=_0x2528e3['count'];var _0x3603a8=_0x28e689?0x0:_0x14383b['offset'];var _0x44fa9f=_0x28e689?_0x2528e3['count']:_0x14383b['offset']+_0x14383b[_0x8897('0x1c')];var _0x5d0353;if(_0x44fa9f>=_0x5044dc){_0x44fa9f=_0x5044dc;_0x5d0353=0xc8;}else{_0x5d0353=0xce;}_0x3cc0e9[_0x8897('0x18')](_0x5d0353);return _0x3cc0e9[_0x8897('0x1d')](_0x8897('0x1e'),_0x3603a8+'-'+_0x44fa9f+'/'+_0x5044dc)['json'](_0x2528e3);}return null;};}function patchUpdates(_0x72b5b3){return function(_0x9139a7){try{jsonpatch[_0x8897('0x1f')](_0x9139a7,_0x72b5b3,!![]);}catch(_0x27ba89){return BPromise[_0x8897('0x20')](_0x27ba89);}return _0x9139a7[_0x8897('0x21')]();};}function saveUpdates(_0x5d81c1,_0x2bf87d){return function(_0x70b9f9){if(_0x70b9f9){return _0x70b9f9[_0x8897('0x22')](_0x5d81c1)[_0x8897('0x23')](function(_0x4d329c){return _0x4d329c;});}return null;};}function removeEntity(_0x42f426,_0x3aa1d1){return function(_0x328c88){if(_0x328c88){return _0x328c88[_0x8897('0x24')]()['then'](function(){var _0x2bd4c3=_0x328c88[_0x8897('0x25')]({'plain':!![]});var _0x2816f2=_0x8897('0x26');return db[_0x8897('0x27')]['destroy']({'where':{'type':_0x2816f2,'resourceId':_0x2bd4c3['id']}})[_0x8897('0x23')](function(){return _0x328c88;});})[_0x8897('0x23')](function(){_0x42f426[_0x8897('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55bfa4,_0x190e5c){return function(_0x52fb49){if(!_0x52fb49){_0x55bfa4[_0x8897('0x17')](0x194);}return _0x52fb49;};}function handleError(_0xdc1a23,_0x1773a3){_0x1773a3=_0x1773a3||0x1f4;return function(_0x37e290){logger['error'](_0x37e290[_0x8897('0x28')]);if(_0x37e290[_0x8897('0x29')]){delete _0x37e290[_0x8897('0x29')];}_0xdc1a23[_0x8897('0x18')](_0x1773a3)[_0x8897('0x2a')](_0x37e290);};}exports[_0x8897('0x2b')]=function(_0x2190b6,_0x1915ec){var _0x5a3f6e={},_0xbf004c={},_0x548896={'count':0x0,'rows':[]};var _0x216b0c=_[_0x8897('0x2c')](db[_0x8897('0x2d')]['rawAttributes'],function(_0x3bb20e){return{'name':_0x3bb20e[_0x8897('0x2e')],'type':_0x3bb20e[_0x8897('0x2f')][_0x8897('0x30')]};});_0xbf004c[_0x8897('0x31')]=_[_0x8897('0x2c')](_0x216b0c,_0x8897('0x29'));_0xbf004c[_0x8897('0x32')]=_[_0x8897('0x33')](_0x2190b6[_0x8897('0x32')]);_0xbf004c['filters']=_[_0x8897('0x34')](_0xbf004c[_0x8897('0x31')],_0xbf004c[_0x8897('0x32')]);_0x5a3f6e[_0x8897('0x35')]=_[_0x8897('0x34')](_0xbf004c[_0x8897('0x31')],qs['fields'](_0x2190b6[_0x8897('0x32')][_0x8897('0x36')]));_0x5a3f6e[_0x8897('0x35')]=_0x5a3f6e[_0x8897('0x35')][_0x8897('0x37')]?_0x5a3f6e['attributes']:_0xbf004c[_0x8897('0x31')];if(!_0x2190b6['query']['hasOwnProperty'](_0x8897('0x38'))){_0x5a3f6e[_0x8897('0x1c')]=qs['limit'](_0x2190b6[_0x8897('0x32')][_0x8897('0x1c')]);_0x5a3f6e[_0x8897('0x1a')]=qs['offset'](_0x2190b6[_0x8897('0x32')][_0x8897('0x1a')]);}_0x5a3f6e[_0x8897('0x39')]=qs[_0x8897('0x3a')](_0x2190b6[_0x8897('0x32')]['sort']);_0x5a3f6e[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_['pick'](_0x2190b6['query'],_0xbf004c['filters']),_0x216b0c);if(_0x2190b6['query']['filter']){_0x5a3f6e[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x5a3f6e['where'],{'$or':_[_0x8897('0x2c')](_0x216b0c,function(_0x8e6377){if(_0x8e6377['type']!==_0x8897('0x3e')){var _0x48eb00={};_0x48eb00[_0x8e6377[_0x8897('0x29')]]={'$like':'%'+_0x2190b6[_0x8897('0x32')]['filter']+'%'};return _0x48eb00;}})});}_0x5a3f6e=_[_0x8897('0x3d')]({},_0x5a3f6e,_0x2190b6['options']);var _0xe763a3={'where':_0x5a3f6e[_0x8897('0x3b')]};return db[_0x8897('0x2d')]['count'](_0xe763a3)[_0x8897('0x23')](function(_0x5028dc){_0x548896[_0x8897('0x3f')]=_0x5028dc;if(_0x2190b6[_0x8897('0x32')][_0x8897('0x40')]){_0x5a3f6e[_0x8897('0x41')]=[{'all':!![]}];}return db[_0x8897('0x2d')][_0x8897('0x42')](_0x5a3f6e);})['then'](function(_0x24a72b){_0x548896[_0x8897('0x43')]=_0x24a72b;return _0x548896;})[_0x8897('0x23')](respondWithFilteredResult(_0x1915ec,_0x5a3f6e))[_0x8897('0x44')](handleError(_0x1915ec,null));};exports[_0x8897('0x45')]=function(_0x14ac70,_0x5478e0){var _0x2c35d5={'raw':![],'where':{'id':_0x14ac70[_0x8897('0x46')]['id']}},_0x335f6b={};_0x335f6b[_0x8897('0x31')]=_[_0x8897('0x33')](db[_0x8897('0x2d')][_0x8897('0x47')]);_0x335f6b[_0x8897('0x32')]=_[_0x8897('0x33')](_0x14ac70[_0x8897('0x32')]);_0x335f6b[_0x8897('0x3c')]=_[_0x8897('0x34')](_0x335f6b[_0x8897('0x31')],_0x335f6b['query']);_0x2c35d5[_0x8897('0x35')]=_[_0x8897('0x34')](_0x335f6b[_0x8897('0x31')],qs[_0x8897('0x36')](_0x14ac70['query'][_0x8897('0x36')]));_0x2c35d5[_0x8897('0x35')]=_0x2c35d5[_0x8897('0x35')][_0x8897('0x37')]?_0x2c35d5[_0x8897('0x35')]:_0x335f6b['model'];if(_0x14ac70[_0x8897('0x32')]['includeAll']){_0x2c35d5[_0x8897('0x41')]=[{'all':!![]}];}_0x2c35d5=_[_0x8897('0x3d')]({},_0x2c35d5,_0x14ac70[_0x8897('0x48')]);return db[_0x8897('0x2d')][_0x8897('0x49')](_0x2c35d5)[_0x8897('0x23')](handleEntityNotFound(_0x5478e0,null))[_0x8897('0x23')](respondWithResult(_0x5478e0,null))[_0x8897('0x44')](handleError(_0x5478e0,null));};exports[_0x8897('0x4a')]=function(_0x1d753f,_0x1daa1d){return db[_0x8897('0x2d')][_0x8897('0x4a')](_0x1d753f['body'],{})['then'](function(_0xba406c){var _0x2ee5cc=_0x1d753f[_0x8897('0x4b')]['get']({'plain':!![]});if(!_0x2ee5cc)throw new Error(_0x8897('0x4c'));if(_0x2ee5cc[_0x8897('0x4d')]===_0x8897('0x4b')){var _0x3e8001=_0xba406c['get']({'plain':!![]});var _0x4312aa=_0x8897('0x26');return db[_0x8897('0x4e')][_0x8897('0x49')]({'where':{'name':_0x4312aa,'userProfileId':_0x2ee5cc[_0x8897('0x4f')]},'raw':!![]})[_0x8897('0x23')](function(_0x22f3e2){if(_0x22f3e2&&_0x22f3e2[_0x8897('0x50')]===0x0){return db[_0x8897('0x27')][_0x8897('0x4a')]({'name':_0x3e8001[_0x8897('0x29')],'resourceId':_0x3e8001['id'],'type':_0x22f3e2[_0x8897('0x29')],'sectionId':_0x22f3e2['id']},{})[_0x8897('0x23')](function(){return _0xba406c;});}else{return _0xba406c;}})[_0x8897('0x44')](function(_0x47487a){logger['error'](_0x8897('0x51'),_0x47487a);throw _0x47487a;});}return _0xba406c;})[_0x8897('0x23')](respondWithResult(_0x1daa1d,0xc9))[_0x8897('0x44')](handleError(_0x1daa1d,null));};exports[_0x8897('0x52')]=function(_0x47b8dc,_0xf63a2b){var _0x1f3ea8={'where':{'id':_0x47b8dc[_0x8897('0x46')]['id']}},_0x3cc500={};_0x3cc500[_0x8897('0x31')]=_[_0x8897('0x33')](db[_0x8897('0x2d')]['rawAttributes']);_0x1f3ea8['attributes']=_[_0x8897('0x34')](_0x3cc500[_0x8897('0x31')],qs[_0x8897('0x36')](_0x47b8dc[_0x8897('0x32')][_0x8897('0x36')]));_0x1f3ea8[_0x8897('0x35')]=_0x1f3ea8[_0x8897('0x35')][_0x8897('0x37')]?_0x1f3ea8['attributes']:_0x3cc500[_0x8897('0x31')];if(_0x47b8dc[_0x8897('0x32')]['includeAll']){_0x1f3ea8['include']=[{'all':!![]}];}_0x1f3ea8=_['merge']({},_0x1f3ea8,_0x47b8dc['options']);return db['Campaign'][_0x8897('0x49')](_0x1f3ea8)[_0x8897('0x23')](handleEntityNotFound(_0xf63a2b,null))[_0x8897('0x23')](function(_0x7066da){if(_0x7066da){var _0x29400e=_0x7066da['get']({'plain':!![]});_0x29400e=qs[_0x8897('0x53')](_0x29400e,['id',_0x8897('0x54'),'updatedAt']);_0x47b8dc[_0x8897('0x55')]=_['omit'](_0x47b8dc[_0x8897('0x55')],['id',_0x8897('0x54'),_0x8897('0x56')]);return db['Campaign'][_0x8897('0x4a')](_[_0x8897('0x3d')](_0x29400e,_0x47b8dc[_0x8897('0x55')]),{'include':_0x47b8dc[_0x8897('0x32')][_0x8897('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x3b5dbd){var _0x541260=_0x47b8dc[_0x8897('0x4b')][_0x8897('0x25')]({'plain':!![]});if(!_0x541260)throw new Error(_0x8897('0x4c'));if(_0x541260[_0x8897('0x4d')]===_0x8897('0x4b')){var _0x3af18a=_0x3b5dbd[_0x8897('0x25')]({'plain':!![]});var _0x45cf0d=_0x8897('0x26');return db[_0x8897('0x4e')]['find']({'where':{'name':_0x45cf0d,'userProfileId':_0x541260[_0x8897('0x4f')]},'raw':!![]})[_0x8897('0x23')](function(_0xa46650){if(_0xa46650&&_0xa46650['autoAssociation']===0x0){return db[_0x8897('0x27')][_0x8897('0x4a')]({'name':_0x3af18a[_0x8897('0x29')],'resourceId':_0x3af18a['id'],'type':_0xa46650[_0x8897('0x29')],'sectionId':_0xa46650['id']},{})[_0x8897('0x23')](function(){return _0x3b5dbd;});}else{return _0x3b5dbd;}})[_0x8897('0x44')](function(_0x10c7e2){logger[_0x8897('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10c7e2);throw _0x10c7e2;});}return _0x3b5dbd;});}})[_0x8897('0x23')](respondWithResult(_0xf63a2b,0xc9))[_0x8897('0x44')](handleError(_0xf63a2b,null));};exports[_0x8897('0x22')]=function(_0x544d2a,_0x29a02c){if(_0x544d2a[_0x8897('0x55')]['id']){delete _0x544d2a[_0x8897('0x55')]['id'];}return db['Campaign'][_0x8897('0x49')]({'where':{'id':_0x544d2a[_0x8897('0x46')]['id']}})['then'](handleEntityNotFound(_0x29a02c,null))['then'](saveUpdates(_0x544d2a[_0x8897('0x55')],null))[_0x8897('0x23')](respondWithResult(_0x29a02c,null))[_0x8897('0x44')](handleError(_0x29a02c,null));};exports[_0x8897('0x24')]=function(_0x8b2e6,_0xcc0bd3){return db[_0x8897('0x2d')][_0x8897('0x49')]({'where':{'id':_0x8b2e6[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0xcc0bd3,null))[_0x8897('0x23')](removeEntity(_0xcc0bd3,null))['catch'](handleError(_0xcc0bd3,null));};exports[_0x8897('0x58')]=function(_0x57fca5,_0x52141a,_0x4218e3){var _0xd0c2b7={'raw':!![],'where':{}};var _0x352fcb={};var _0x2a051c={'count':0x0,'rows':[]};return db[_0x8897('0x2d')]['findOne']({'where':{'id':_0x57fca5[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x52141a,null))[_0x8897('0x23')](function(_0x4554b9){if(_0x4554b9){_0x352fcb[_0x8897('0x31')]=_[_0x8897('0x33')](db[_0x8897('0x59')][_0x8897('0x47')]);_0x352fcb['query']=_[_0x8897('0x33')](_0x57fca5['query']);_0x352fcb['filters']=_['intersection'](_0x352fcb[_0x8897('0x31')],_0x352fcb[_0x8897('0x32')]);_0xd0c2b7[_0x8897('0x35')]=_['intersection'](_0x352fcb['model'],qs[_0x8897('0x36')](_0x57fca5[_0x8897('0x32')][_0x8897('0x36')]));_0xd0c2b7['attributes']=_0xd0c2b7[_0x8897('0x35')]['length']?_0xd0c2b7[_0x8897('0x35')]:_0x352fcb['model'];if(!_0x57fca5[_0x8897('0x32')]['hasOwnProperty'](_0x8897('0x38'))){_0xd0c2b7['limit']=qs[_0x8897('0x1c')](_0x57fca5[_0x8897('0x32')][_0x8897('0x1c')]);_0xd0c2b7[_0x8897('0x1a')]=qs[_0x8897('0x1a')](_0x57fca5[_0x8897('0x32')]['offset']);}_0xd0c2b7[_0x8897('0x39')]=qs[_0x8897('0x3a')](_0x57fca5[_0x8897('0x32')][_0x8897('0x3a')]);_0xd0c2b7[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_[_0x8897('0x5a')](_0x57fca5[_0x8897('0x32')],_0x352fcb[_0x8897('0x3c')]));_0xd0c2b7[_0x8897('0x3b')][_0x8897('0x5b')]=_0x4554b9['id'];if(_0x57fca5[_0x8897('0x32')]['filter']){_0xd0c2b7[_0x8897('0x3b')]=_['merge'](_0xd0c2b7['where'],{'$or':_[_0x8897('0x2c')](_0xd0c2b7['attributes'],function(_0x4ac2cf){var _0x3a3cc2={};_0x3a3cc2[_0x4ac2cf]={'$like':'%'+_0x57fca5['query'][_0x8897('0x5c')]+'%'};return _0x3a3cc2;})});}_0xd0c2b7=_['merge']({},_0xd0c2b7,_0x57fca5['options']);return db[_0x8897('0x59')]['count']({'where':_0xd0c2b7[_0x8897('0x3b')]})[_0x8897('0x23')](function(_0x10ab07){_0x2a051c['count']=_0x10ab07;if(_0x57fca5[_0x8897('0x32')][_0x8897('0x40')]){_0xd0c2b7['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xd0c2b7);})[_0x8897('0x23')](function(_0x475e82){_0x2a051c[_0x8897('0x43')]=_0x475e82;return _0x2a051c;});}})['then'](respondWithFilteredResult(_0x52141a,_0xd0c2b7))['catch'](handleError(_0x52141a,null));};exports[_0x8897('0x5d')]=function(_0x163045,_0x154ed6,_0x546821){var _0x129cbe={'raw':!![],'where':{}};var _0x273030={};var _0x5e8fc4={'count':0x0,'rows':[]};return db[_0x8897('0x2d')][_0x8897('0x5e')]({'where':{'id':_0x163045[_0x8897('0x46')]['id']}})['then'](handleEntityNotFound(_0x154ed6,null))[_0x8897('0x23')](function(_0x3bebf0){if(_0x3bebf0){_0x273030[_0x8897('0x31')]=_[_0x8897('0x33')](db['CmHopperHistory'][_0x8897('0x47')]);_0x273030['query']=_['keys'](_0x163045['query']);_0x273030['filters']=_['intersection'](_0x273030[_0x8897('0x31')],_0x273030['query']);_0x129cbe[_0x8897('0x35')]=_[_0x8897('0x34')](_0x273030[_0x8897('0x31')],qs[_0x8897('0x36')](_0x163045['query']['fields']));_0x129cbe[_0x8897('0x35')]=_0x129cbe['attributes'][_0x8897('0x37')]?_0x129cbe[_0x8897('0x35')]:_0x273030[_0x8897('0x31')];if(!_0x163045[_0x8897('0x32')]['hasOwnProperty'](_0x8897('0x38'))){_0x129cbe[_0x8897('0x1c')]=qs[_0x8897('0x1c')](_0x163045[_0x8897('0x32')]['limit']);_0x129cbe[_0x8897('0x1a')]=qs[_0x8897('0x1a')](_0x163045[_0x8897('0x32')]['offset']);}_0x129cbe['order']=qs[_0x8897('0x3a')](_0x163045[_0x8897('0x32')][_0x8897('0x3a')]);_0x129cbe[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_[_0x8897('0x5a')](_0x163045[_0x8897('0x32')],_0x273030['filters']));_0x129cbe[_0x8897('0x3b')]['CampaignId']=_0x3bebf0['id'];if(_0x163045[_0x8897('0x32')][_0x8897('0x5c')]){_0x129cbe[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x129cbe['where'],{'$or':_[_0x8897('0x2c')](_0x129cbe[_0x8897('0x35')],function(_0x4c7e21){var _0x1e08d7={};_0x1e08d7[_0x4c7e21]={'$like':'%'+_0x163045[_0x8897('0x32')][_0x8897('0x5c')]+'%'};return _0x1e08d7;})});}_0x129cbe=_[_0x8897('0x3d')]({},_0x129cbe,_0x163045[_0x8897('0x48')]);return db[_0x8897('0x5f')][_0x8897('0x3f')]({'where':_0x129cbe[_0x8897('0x3b')]})[_0x8897('0x23')](function(_0x4cc314){_0x5e8fc4[_0x8897('0x3f')]=_0x4cc314;if(_0x163045[_0x8897('0x32')]['includeAll']){_0x129cbe[_0x8897('0x41')]=[{'all':!![]}];}return db[_0x8897('0x5f')][_0x8897('0x42')](_0x129cbe);})[_0x8897('0x23')](function(_0x2b095b){_0x5e8fc4[_0x8897('0x43')]=_0x2b095b;return _0x5e8fc4;});}})['then'](respondWithFilteredResult(_0x154ed6,_0x129cbe))[_0x8897('0x44')](handleError(_0x154ed6,null));};exports[_0x8897('0x60')]=function(_0x3f52af,_0x3a46b5,_0x58ae92){var _0x77577e={'raw':!![],'where':{}};var _0x430e52={};var _0x2d153e={'count':0x0,'rows':[]};return db[_0x8897('0x2d')]['findOne']({'where':{'id':_0x3f52af[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x3a46b5,null))[_0x8897('0x23')](function(_0x8a2b5c){if(_0x8a2b5c){_0x430e52[_0x8897('0x31')]=_[_0x8897('0x33')](db[_0x8897('0x61')][_0x8897('0x47')]);_0x430e52[_0x8897('0x32')]=_[_0x8897('0x33')](_0x3f52af[_0x8897('0x32')]);_0x430e52[_0x8897('0x3c')]=_['intersection'](_0x430e52[_0x8897('0x31')],_0x430e52[_0x8897('0x32')]);_0x77577e['attributes']=_[_0x8897('0x34')](_0x430e52['model'],qs[_0x8897('0x36')](_0x3f52af['query'][_0x8897('0x36')]));_0x77577e[_0x8897('0x35')]=_0x77577e[_0x8897('0x35')][_0x8897('0x37')]?_0x77577e[_0x8897('0x35')]:_0x430e52[_0x8897('0x31')];if(!_0x3f52af[_0x8897('0x32')][_0x8897('0x62')](_0x8897('0x38'))){_0x77577e[_0x8897('0x1c')]=qs[_0x8897('0x1c')](_0x3f52af[_0x8897('0x32')][_0x8897('0x1c')]);_0x77577e[_0x8897('0x1a')]=qs[_0x8897('0x1a')](_0x3f52af[_0x8897('0x32')][_0x8897('0x1a')]);}_0x77577e[_0x8897('0x39')]=qs['sort'](_0x3f52af[_0x8897('0x32')]['sort']);_0x77577e[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_[_0x8897('0x5a')](_0x3f52af['query'],_0x430e52[_0x8897('0x3c')]));_0x77577e[_0x8897('0x3b')]['CampaignId']=_0x8a2b5c['id'];if(_0x3f52af[_0x8897('0x32')][_0x8897('0x5c')]){_0x77577e[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x77577e['where'],{'$or':_['map'](_0x77577e[_0x8897('0x35')],function(_0x6ad77f){var _0x29eca1={};_0x29eca1[_0x6ad77f]={'$like':'%'+_0x3f52af[_0x8897('0x32')][_0x8897('0x5c')]+'%'};return _0x29eca1;})});}_0x77577e=_['merge']({},_0x77577e,_0x3f52af[_0x8897('0x48')]);return db[_0x8897('0x61')][_0x8897('0x3f')]({'where':_0x77577e[_0x8897('0x3b')]})[_0x8897('0x23')](function(_0x2cabf0){_0x2d153e[_0x8897('0x3f')]=_0x2cabf0;if(_0x3f52af[_0x8897('0x32')]['includeAll']){_0x77577e[_0x8897('0x41')]=[{'all':!![]}];}return db[_0x8897('0x61')][_0x8897('0x42')](_0x77577e);})[_0x8897('0x23')](function(_0x427de2){_0x2d153e['rows']=_0x427de2;return _0x2d153e;});}})[_0x8897('0x23')](respondWithFilteredResult(_0x3a46b5,_0x77577e))[_0x8897('0x44')](handleError(_0x3a46b5,null));};exports['getHopperBlacks']=function(_0x36479e,_0x465cd2,_0x489b9d){var _0x4e4de3={'raw':!![],'where':{}};var _0x5b3f22={};var _0x5707ab={'count':0x0,'rows':[]};return db[_0x8897('0x2d')]['findOne']({'where':{'id':_0x36479e[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x465cd2,null))[_0x8897('0x23')](function(_0x29ef59){if(_0x29ef59){_0x5b3f22['model']=_[_0x8897('0x33')](db['CmHopperBlack']['rawAttributes']);_0x5b3f22[_0x8897('0x32')]=_[_0x8897('0x33')](_0x36479e[_0x8897('0x32')]);_0x5b3f22[_0x8897('0x3c')]=_[_0x8897('0x34')](_0x5b3f22['model'],_0x5b3f22['query']);_0x4e4de3[_0x8897('0x35')]=_['intersection'](_0x5b3f22[_0x8897('0x31')],qs[_0x8897('0x36')](_0x36479e[_0x8897('0x32')][_0x8897('0x36')]));_0x4e4de3[_0x8897('0x35')]=_0x4e4de3[_0x8897('0x35')][_0x8897('0x37')]?_0x4e4de3[_0x8897('0x35')]:_0x5b3f22[_0x8897('0x31')];if(!_0x36479e['query'][_0x8897('0x62')](_0x8897('0x38'))){_0x4e4de3[_0x8897('0x1c')]=qs[_0x8897('0x1c')](_0x36479e[_0x8897('0x32')][_0x8897('0x1c')]);_0x4e4de3[_0x8897('0x1a')]=qs[_0x8897('0x1a')](_0x36479e[_0x8897('0x32')][_0x8897('0x1a')]);}_0x4e4de3[_0x8897('0x39')]=qs[_0x8897('0x3a')](_0x36479e['query']['sort']);_0x4e4de3[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_[_0x8897('0x5a')](_0x36479e[_0x8897('0x32')],_0x5b3f22[_0x8897('0x3c')]));_0x4e4de3[_0x8897('0x3b')][_0x8897('0x5b')]=_0x29ef59['id'];if(_0x36479e[_0x8897('0x32')][_0x8897('0x5c')]){_0x4e4de3[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x4e4de3[_0x8897('0x3b')],{'$or':_[_0x8897('0x2c')](_0x4e4de3[_0x8897('0x35')],function(_0x148da3){var _0x3a93b1={};_0x3a93b1[_0x148da3]={'$like':'%'+_0x36479e[_0x8897('0x32')][_0x8897('0x5c')]+'%'};return _0x3a93b1;})});}_0x4e4de3=_[_0x8897('0x3d')]({},_0x4e4de3,_0x36479e['options']);return db[_0x8897('0x63')][_0x8897('0x3f')]({'where':_0x4e4de3[_0x8897('0x3b')]})[_0x8897('0x23')](function(_0x4dd361){_0x5707ab[_0x8897('0x3f')]=_0x4dd361;if(_0x36479e[_0x8897('0x32')][_0x8897('0x40')]){_0x4e4de3[_0x8897('0x41')]=[{'all':!![]}];}return db[_0x8897('0x63')][_0x8897('0x42')](_0x4e4de3);})[_0x8897('0x23')](function(_0x3e84ef){_0x5707ab['rows']=_0x3e84ef;return _0x5707ab;});}})['then'](respondWithFilteredResult(_0x465cd2,_0x4e4de3))[_0x8897('0x44')](handleError(_0x465cd2,null));};exports[_0x8897('0x64')]=function(_0x5b3b3c,_0x7cf32f,_0x525591){var _0x138a2c={};var _0x1bf8f4={};var _0x543dfc;var _0x3ed31e;return db[_0x8897('0x2d')][_0x8897('0x5e')]({'where':{'id':_0x5b3b3c[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x7cf32f,null))[_0x8897('0x23')](function(_0x1b4c25){if(_0x1b4c25){_0x543dfc=_0x1b4c25;_0x1bf8f4['model']=_[_0x8897('0x33')](db[_0x8897('0x65')]['rawAttributes']);_0x1bf8f4[_0x8897('0x32')]=_[_0x8897('0x33')](_0x5b3b3c[_0x8897('0x32')]);_0x1bf8f4[_0x8897('0x3c')]=_[_0x8897('0x34')](_0x1bf8f4[_0x8897('0x31')],_0x1bf8f4['query']);_0x138a2c[_0x8897('0x35')]=_[_0x8897('0x34')](_0x1bf8f4[_0x8897('0x31')],qs['fields'](_0x5b3b3c[_0x8897('0x32')][_0x8897('0x36')]));_0x138a2c[_0x8897('0x35')]=_0x138a2c[_0x8897('0x35')]['length']?_0x138a2c['attributes']:_0x1bf8f4[_0x8897('0x31')];_0x138a2c[_0x8897('0x39')]=qs[_0x8897('0x3a')](_0x5b3b3c['query']['sort']);_0x138a2c[_0x8897('0x3b')]=qs['filters'](_['pick'](_0x5b3b3c[_0x8897('0x32')],_0x1bf8f4[_0x8897('0x3c')]));if(_0x5b3b3c[_0x8897('0x32')]['filter']){_0x138a2c[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x138a2c[_0x8897('0x3b')],{'$or':_[_0x8897('0x2c')](_0x138a2c[_0x8897('0x35')],function(_0x2d4008){var _0x55b014={};_0x55b014[_0x2d4008]={'$like':'%'+_0x5b3b3c[_0x8897('0x32')]['filter']+'%'};return _0x55b014;})});}_0x138a2c=_[_0x8897('0x3d')]({},_0x138a2c,_0x5b3b3c[_0x8897('0x48')]);return _0x543dfc[_0x8897('0x64')](_0x138a2c);}})[_0x8897('0x23')](function(_0x499d83){if(_0x499d83){_0x3ed31e=_0x499d83[_0x8897('0x37')];if(!_0x5b3b3c[_0x8897('0x32')]['hasOwnProperty'](_0x8897('0x38'))){_0x138a2c[_0x8897('0x1c')]=qs[_0x8897('0x1c')](_0x5b3b3c['query']['limit']);_0x138a2c[_0x8897('0x1a')]=qs[_0x8897('0x1a')](_0x5b3b3c[_0x8897('0x32')][_0x8897('0x1a')]);}return _0x543dfc[_0x8897('0x64')](_0x138a2c);}})[_0x8897('0x23')](function(_0x441d9e){if(_0x441d9e){return _0x441d9e?{'count':_0x3ed31e,'rows':_0x441d9e}:null;}})[_0x8897('0x23')](respondWithResult(_0x7cf32f,null))['catch'](handleError(_0x7cf32f,null));};exports['addLists']=function(_0x40b13f,_0x4d9c0b,_0x1027b6){var _0x277c68,_0x2db80f;var _0x2f708f=[];var _0x1b7c82=moment()[_0x8897('0x66')](_0x8897('0x67'));return db['Campaign']['find']({'where':{'id':_0x40b13f[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x4d9c0b,null))[_0x8897('0x23')](function(_0x2866f9){if(_0x2866f9){_0x2db80f=_0x2866f9;return _0x2866f9['addLists'](_0x40b13f[_0x8897('0x55')]['ids'],_[_0x8897('0x53')](_0x40b13f[_0x8897('0x55')],['ids','id'])||{});}return null;})[_0x8897('0x68')](function(_0x903564){var _0x23c25b;var _0xed6491;_0x277c68=_0x903564||[];var _0x87f7aa=[];if(_0x903564){for(var _0x31eae5=0x0;_0x31eae5<_0x903564[_0x8897('0x37')];_0x31eae5+=0x1){var _0x49b892=_0x903564[_0x31eae5][_0x8897('0x25')]({'plain':!![]});_0x2db80f['dialCheckDuplicateType']=_0x40b13f[_0x8897('0x55')][_0x8897('0x69')]?_0x40b13f['body'][_0x8897('0x69')]:_0x2db80f[_0x8897('0x69')];switch(_0x2db80f[_0x8897('0x69')]){case _0x8897('0x6a'):_0x23c25b=squel['insert']()[_0x8897('0x6b')]('cm_hopper')[_0x8897('0x6c')]([_0x8897('0x6d'),'scheduledAt',_0x8897('0x6e'),_0x8897('0x6f'),_0x8897('0x5b'),_0x8897('0x54'),_0x8897('0x56')],squel['select']()[_0x8897('0x70')](_0x8897('0x6d'),_0x8897('0x6d'))[_0x8897('0x70')](_0x8897('0x71'),_0x8897('0x72'))[_0x8897('0x70')]('id',_0x8897('0x6e'))[_0x8897('0x70')](_0x49b892[_0x8897('0x73')][_0x8897('0x74')](),_0x8897('0x6f'))['field'](_0x40b13f[_0x8897('0x46')]['id'][_0x8897('0x74')](),_0x8897('0x5b'))['field']('\x27'+_0x1b7c82+'\x27',_0x8897('0x54'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x56'))[_0x8897('0x75')](_0x8897('0x76'))[_0x8897('0x3b')](_0x8897('0x77'))[_0x8897('0x3b')]('ListId\x20=\x20?',_0x49b892[_0x8897('0x73')][_0x8897('0x74')]())[_0x8897('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x8897('0x3b')](_0x8897('0x78'),squel[_0x8897('0x79')]()[_0x8897('0x70')](_0x8897('0x7a'))[_0x8897('0x75')](_0x8897('0x7b'))[_0x8897('0x3b')](_0x8897('0x7c'),_0x40b13f[_0x8897('0x46')]['id'][_0x8897('0x74')]()))[_0x8897('0x3b')](_0x8897('0x78'),squel[_0x8897('0x79')]()[_0x8897('0x70')](_0x8897('0x7d'))['from']('cm_hopper')[_0x8897('0x3b')](_0x8897('0x7c'),_0x40b13f['params']['id'][_0x8897('0x74')]())))['toString']();break;case _0x8897('0x7e'):_0x23c25b=squel[_0x8897('0x7f')]()[_0x8897('0x6b')](_0x8897('0x80'))[_0x8897('0x6c')]([_0x8897('0x6d'),'scheduledAt','ContactId','ListId',_0x8897('0x5b'),_0x8897('0x54'),'updatedAt'],squel[_0x8897('0x79')]()[_0x8897('0x70')]('phone',_0x8897('0x6d'))[_0x8897('0x70')](_0x8897('0x71'),'scheduledAt')['field']('id',_0x8897('0x6e'))['field'](_0x49b892[_0x8897('0x73')]['toString'](),'ListId')['field'](_0x40b13f['params']['id'][_0x8897('0x74')](),_0x8897('0x5b'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x54'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27','updatedAt')[_0x8897('0x75')](_0x8897('0x76'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x8897('0x81'),_0x49b892[_0x8897('0x73')][_0x8897('0x74')]())['where'](_0x8897('0x82'))[_0x8897('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8897('0x79')]()[_0x8897('0x70')]('COALESCE(phone,\x27\x27)')[_0x8897('0x75')](_0x8897('0x80'))[_0x8897('0x3b')](_0x8897('0x7c'),_0x40b13f[_0x8897('0x46')]['id'][_0x8897('0x74')]())))[_0x8897('0x74')]();break;default:_0x23c25b=squel[_0x8897('0x7f')]()[_0x8897('0x6b')]('cm_hopper')[_0x8897('0x6c')](['phone',_0x8897('0x72'),_0x8897('0x6e'),'ListId',_0x8897('0x5b'),'createdAt',_0x8897('0x56')],squel[_0x8897('0x79')]()[_0x8897('0x70')](_0x8897('0x6d'),_0x8897('0x6d'))[_0x8897('0x70')]('NOW()',_0x8897('0x72'))['field']('id',_0x8897('0x6e'))['field'](_0x49b892['CmListId']['toString'](),'ListId')[_0x8897('0x70')](_0x40b13f[_0x8897('0x46')]['id']['toString'](),_0x8897('0x5b'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x54'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x56'))[_0x8897('0x75')](_0x8897('0x76'))[_0x8897('0x3b')](_0x8897('0x77'))[_0x8897('0x3b')](_0x8897('0x81'),_0x49b892[_0x8897('0x73')]['toString']())[_0x8897('0x3b')](_0x8897('0x82')))['toString']();}_0xed6491=squel[_0x8897('0x7f')]()['into'](_0x8897('0x83'))[_0x8897('0x6c')](['cmHopperId',_0x8897('0x72'),'phone','OrderBy',_0x8897('0x54'),_0x8897('0x56')],squel['select']()[_0x8897('0x70')](_0x8897('0x84'),'id')[_0x8897('0x70')](_0x8897('0x71'),_0x8897('0x72'))['field'](_0x8897('0x85'),_0x8897('0x6d'))['field'](_0x8897('0x86'),_0x8897('0x87'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x54'))[_0x8897('0x70')]('\x27'+_0x1b7c82+'\x27',_0x8897('0x56'))[_0x8897('0x75')](_0x8897('0x88'),'ci')[_0x8897('0x89')](_0x8897('0x80'),'h',_0x8897('0x8a'))[_0x8897('0x3b')]('h.ListId\x20=\x20?',_0x49b892['CmListId']['toString']())[_0x8897('0x3b')](_0x8897('0x8b'),_0x40b13f[_0x8897('0x46')]['id'][_0x8897('0x74')]())[_0x8897('0x3b')](_0x8897('0x8c'),_0x1b7c82))[_0x8897('0x74')]();_0x87f7aa[_0x8897('0x8d')](db[_0x8897('0x8e')][_0x8897('0x32')](_0x23c25b));_0x2f708f[_0x8897('0x8d')](db[_0x8897('0x8e')][_0x8897('0x32')](_0xed6491));}return BPromise['all'](_0x87f7aa);}})['then'](function(){return BPromise[_0x8897('0x8f')](_0x2f708f);})[_0x8897('0x23')](function(){return _0x277c68;})['then'](respondWithResult(_0x4d9c0b,null))[_0x8897('0x44')](handleError(_0x4d9c0b,null));};exports[_0x8897('0x90')]=function(_0x29bff6,_0x1783fa,_0x3ce812){return db[_0x8897('0x2d')][_0x8897('0x49')]({'where':{'id':_0x29bff6['params']['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x1783fa,null))['then'](function(_0x6076b8){if(_0x6076b8){return _0x6076b8[_0x8897('0x90')](_0x29bff6[_0x8897('0x32')][_0x8897('0x91')]);}})[_0x8897('0x23')](function(_0x14524c){if(_0x14524c){return db[_0x8897('0x59')]['destroy']({'where':{'ListId':_0x29bff6[_0x8897('0x32')]['ids'],'CampaignId':_0x29bff6[_0x8897('0x46')]['id']}})[_0x8897('0x23')](function(){return _0x14524c;});}})[_0x8897('0x23')](respondWithStatusCode(_0x1783fa,null))[_0x8897('0x44')](handleError(_0x1783fa,null));};exports[_0x8897('0x92')]=function(_0x55437c,_0x459d1a,_0xab977e){var _0x357b06={};var _0x4256ee={};var _0x55b845;var _0x22a5e9;return db[_0x8897('0x2d')]['findOne']({'where':{'id':_0x55437c[_0x8897('0x46')]['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x459d1a,null))[_0x8897('0x23')](function(_0x87634){if(_0x87634){_0x55b845=_0x87634;_0x4256ee[_0x8897('0x31')]=_[_0x8897('0x33')](db['CmList'][_0x8897('0x47')]);_0x4256ee[_0x8897('0x32')]=_[_0x8897('0x33')](_0x55437c[_0x8897('0x32')]);_0x4256ee[_0x8897('0x3c')]=_[_0x8897('0x34')](_0x4256ee[_0x8897('0x31')],_0x4256ee['query']);_0x357b06[_0x8897('0x35')]=_['intersection'](_0x4256ee[_0x8897('0x31')],qs['fields'](_0x55437c[_0x8897('0x32')][_0x8897('0x36')]));_0x357b06[_0x8897('0x35')]=_0x357b06['attributes'][_0x8897('0x37')]?_0x357b06['attributes']:_0x4256ee['model'];_0x357b06[_0x8897('0x39')]=qs[_0x8897('0x3a')](_0x55437c['query'][_0x8897('0x3a')]);_0x357b06[_0x8897('0x3b')]=qs[_0x8897('0x3c')](_['pick'](_0x55437c[_0x8897('0x32')],_0x4256ee[_0x8897('0x3c')]));if(_0x55437c[_0x8897('0x32')][_0x8897('0x5c')]){_0x357b06[_0x8897('0x3b')]=_[_0x8897('0x3d')](_0x357b06[_0x8897('0x3b')],{'$or':_[_0x8897('0x2c')](_0x357b06['attributes'],function(_0x51bd6d){var _0xccef7f={};_0xccef7f[_0x51bd6d]={'$like':'%'+_0x55437c[_0x8897('0x32')][_0x8897('0x5c')]+'%'};return _0xccef7f;})});}_0x357b06=_[_0x8897('0x3d')]({},_0x357b06,_0x55437c[_0x8897('0x48')]);return _0x55b845[_0x8897('0x92')](_0x357b06);}})['then'](function(_0x586c72){if(_0x586c72){_0x22a5e9=_0x586c72[_0x8897('0x37')];if(!_0x55437c[_0x8897('0x32')]['hasOwnProperty'](_0x8897('0x38'))){_0x357b06['limit']=qs[_0x8897('0x1c')](_0x55437c[_0x8897('0x32')][_0x8897('0x1c')]);_0x357b06[_0x8897('0x1a')]=qs['offset'](_0x55437c[_0x8897('0x32')]['offset']);}return _0x55b845[_0x8897('0x92')](_0x357b06);}})[_0x8897('0x23')](function(_0x12d801){if(_0x12d801){return _0x12d801?{'count':_0x22a5e9,'rows':_0x12d801}:null;}})[_0x8897('0x23')](respondWithResult(_0x459d1a,null))['catch'](handleError(_0x459d1a,null));};exports[_0x8897('0x93')]=function(_0x35ac01,_0x84b127,_0x5e2c9a){var _0x1020d4,_0x20cc7d;var _0x581507=[];var _0x55aef4=moment()['format'](_0x8897('0x67'));return db[_0x8897('0x2d')][_0x8897('0x49')]({'where':{'id':_0x35ac01['params']['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x84b127,null))[_0x8897('0x23')](function(_0x4a3e8d){if(_0x4a3e8d){_0x20cc7d=_0x4a3e8d;return _0x4a3e8d[_0x8897('0x93')](_0x35ac01[_0x8897('0x55')][_0x8897('0x91')],_[_0x8897('0x53')](_0x35ac01[_0x8897('0x55')],[_0x8897('0x91'),'id'])||{});}return null;})[_0x8897('0x68')](function(_0x5126f0){var _0x1e67f4;var _0x5ecabc;_0x1020d4=_0x5126f0||[];var _0x429f7f=[];if(_0x5126f0){for(var _0x21d0bc=0x0;_0x21d0bc<_0x5126f0['length'];_0x21d0bc+=0x1){var _0x269f6a=_0x5126f0[_0x21d0bc][_0x8897('0x25')]({'plain':!![]});_0x1e67f4=squel[_0x8897('0x7f')]()[_0x8897('0x6b')](_0x8897('0x94'))['fromQuery']([_0x8897('0x6d'),_0x8897('0x6e'),_0x8897('0x6f'),_0x8897('0x5b'),'createdAt',_0x8897('0x56')],squel[_0x8897('0x79')]()['field'](_0x8897('0x6d'),_0x8897('0x6d'))[_0x8897('0x70')]('id',_0x8897('0x6e'))['field'](_0x269f6a[_0x8897('0x73')][_0x8897('0x74')](),_0x8897('0x6f'))[_0x8897('0x70')](_0x35ac01[_0x8897('0x46')]['id'][_0x8897('0x74')](),'CampaignId')['field'](_0x8897('0x71'),_0x8897('0x54'))[_0x8897('0x70')]('NOW()',_0x8897('0x56'))[_0x8897('0x75')](_0x8897('0x76'))[_0x8897('0x3b')](_0x8897('0x77'))[_0x8897('0x3b')]('ListId\x20=\x20?',_0x269f6a['CmListId'][_0x8897('0x74')]())[_0x8897('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x8897('0x74')]();_0x429f7f[_0x8897('0x8d')](db[_0x8897('0x8e')][_0x8897('0x32')](_0x1e67f4));}return BPromise['all'](_0x429f7f);}})[_0x8897('0x23')](function(){return _0x1020d4;})['then'](respondWithResult(_0x84b127,null))[_0x8897('0x44')](handleError(_0x84b127,null));};exports[_0x8897('0x95')]=function(_0xa56a56,_0x108364,_0x3bf4f7){return db[_0x8897('0x2d')][_0x8897('0x49')]({'where':{'id':_0xa56a56['params']['id']}})[_0x8897('0x23')](handleEntityNotFound(_0x108364,null))[_0x8897('0x23')](function(_0x47e67b){if(_0x47e67b){return _0x47e67b[_0x8897('0x95')](_0xa56a56[_0x8897('0x32')][_0x8897('0x91')]);}})['then'](function(_0xdf5b91){if(_0xdf5b91){return db[_0x8897('0x63')][_0x8897('0x24')]({'where':{'ListId':_0xa56a56[_0x8897('0x32')][_0x8897('0x91')],'CampaignId':_0xa56a56[_0x8897('0x46')]['id']}})['then'](function(){return _0xdf5b91;});}})['then'](respondWithStatusCode(_0x108364,null))[_0x8897('0x44')](handleError(_0x108364,null));}; \ No newline at end of file +var _0x77f4=['../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','IvrCampaigns','UserProfileResource','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','Campaign','includeAll','include','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','findAll','rows','CmHopperHistory','sort','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','fromQuery','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x77f4,0x1a1));var _0x477f=function(_0x2a1461,_0x38448e){_0x2a1461=_0x2a1461-0x0;var _0x288523=_0x77f4[_0x2a1461];return _0x288523;};'use strict';var emlformat=require(_0x477f('0x0'));var rimraf=require(_0x477f('0x1'));var zipdir=require(_0x477f('0x2'));var jsonpatch=require(_0x477f('0x3'));var rp=require(_0x477f('0x4'));var moment=require(_0x477f('0x5'));var BPromise=require(_0x477f('0x6'));var Mustache=require(_0x477f('0x7'));var util=require('util');var path=require(_0x477f('0x8'));var sox=require('sox');var csv=require(_0x477f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x477f('0xa'));var squel=require('squel');var crypto=require(_0x477f('0xb'));var jsforce=require(_0x477f('0xc'));var deskjs=require(_0x477f('0xd'));var toCsv=require(_0x477f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x477f('0xe'));var authService=require(_0x477f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x477f('0x10'));var hardwareService=require(_0x477f('0x11'));var logger=require(_0x477f('0x12'))(_0x477f('0x13'));var utils=require(_0x477f('0x14'));var config=require(_0x477f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x477f('0x16'))['db'];function respondWithStatusCode(_0x5b4fac,_0x4860b9){_0x4860b9=_0x4860b9||0xcc;return function(_0x1d2556){if(_0x1d2556){return _0x5b4fac['sendStatus'](_0x4860b9);}return _0x5b4fac['status'](_0x4860b9)[_0x477f('0x17')]();};}function respondWithResult(_0x42b6b9,_0x343671){_0x343671=_0x343671||0xc8;return function(_0x3d184c){if(_0x3d184c){return _0x42b6b9[_0x477f('0x18')](_0x343671)[_0x477f('0x19')](_0x3d184c);}};}function respondWithFilteredResult(_0x4b184a,_0x2b1a0c){return function(_0x321b59){if(_0x321b59){var _0x4e0268=typeof _0x2b1a0c[_0x477f('0x1a')]===_0x477f('0x1b')&&typeof _0x2b1a0c[_0x477f('0x1c')]==='undefined';var _0x18bef6=_0x321b59[_0x477f('0x1d')];var _0x1f92cc=_0x4e0268?0x0:_0x2b1a0c[_0x477f('0x1a')];var _0x48fe64=_0x4e0268?_0x321b59[_0x477f('0x1d')]:_0x2b1a0c[_0x477f('0x1a')]+_0x2b1a0c[_0x477f('0x1c')];var _0x1d7039;if(_0x48fe64>=_0x18bef6){_0x48fe64=_0x18bef6;_0x1d7039=0xc8;}else{_0x1d7039=0xce;}_0x4b184a[_0x477f('0x18')](_0x1d7039);return _0x4b184a[_0x477f('0x1e')](_0x477f('0x1f'),_0x1f92cc+'-'+_0x48fe64+'/'+_0x18bef6)[_0x477f('0x19')](_0x321b59);}return null;};}function patchUpdates(_0x2c125e){return function(_0x1b5d2d){try{jsonpatch['apply'](_0x1b5d2d,_0x2c125e,!![]);}catch(_0x473317){return BPromise['reject'](_0x473317);}return _0x1b5d2d['save']();};}function saveUpdates(_0x5d2767,_0x396276){return function(_0x2df32a){if(_0x2df32a){return _0x2df32a['update'](_0x5d2767)['then'](function(_0x3fd20f){return _0x3fd20f;});}return null;};}function removeEntity(_0x5a2acf,_0x28a355){return function(_0x145a79){if(_0x145a79){return _0x145a79[_0x477f('0x20')]()['then'](function(){var _0x3300c0=_0x145a79[_0x477f('0x21')]({'plain':!![]});var _0x296347=_0x477f('0x22');return db[_0x477f('0x23')]['destroy']({'where':{'type':_0x296347,'resourceId':_0x3300c0['id']}})[_0x477f('0x24')](function(){return _0x145a79;});})['then'](function(){_0x5a2acf['status'](0xcc)[_0x477f('0x17')]();});}};}function handleEntityNotFound(_0x47d23a,_0x4a86a0){return function(_0x52f4ed){if(!_0x52f4ed){_0x47d23a[_0x477f('0x25')](0x194);}return _0x52f4ed;};}function handleError(_0x338e21,_0x101716){_0x101716=_0x101716||0x1f4;return function(_0x31cc66){logger[_0x477f('0x26')](_0x31cc66[_0x477f('0x27')]);if(_0x31cc66[_0x477f('0x28')]){delete _0x31cc66[_0x477f('0x28')];}_0x338e21[_0x477f('0x18')](_0x101716)[_0x477f('0x29')](_0x31cc66);};}exports[_0x477f('0x2a')]=function(_0x2a58b7,_0x4d65f2){var _0x432170={},_0x3cb99f={},_0x47b20a={'count':0x0,'rows':[]};var _0x57ec38=_['map'](db['Campaign'][_0x477f('0x2b')],function(_0x23d17c){return{'name':_0x23d17c[_0x477f('0x2c')],'type':_0x23d17c['type'][_0x477f('0x2d')]};});_0x3cb99f['model']=_[_0x477f('0x2e')](_0x57ec38,'name');_0x3cb99f[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x2a58b7[_0x477f('0x2f')]);_0x3cb99f['filters']=_['intersection'](_0x3cb99f[_0x477f('0x31')],_0x3cb99f[_0x477f('0x2f')]);_0x432170[_0x477f('0x32')]=_[_0x477f('0x33')](_0x3cb99f[_0x477f('0x31')],qs['fields'](_0x2a58b7[_0x477f('0x2f')][_0x477f('0x34')]));_0x432170[_0x477f('0x32')]=_0x432170[_0x477f('0x32')][_0x477f('0x35')]?_0x432170[_0x477f('0x32')]:_0x3cb99f[_0x477f('0x31')];if(!_0x2a58b7[_0x477f('0x2f')][_0x477f('0x36')](_0x477f('0x37'))){_0x432170['limit']=qs[_0x477f('0x1c')](_0x2a58b7[_0x477f('0x2f')][_0x477f('0x1c')]);_0x432170[_0x477f('0x1a')]=qs[_0x477f('0x1a')](_0x2a58b7[_0x477f('0x2f')][_0x477f('0x1a')]);}_0x432170[_0x477f('0x38')]=qs['sort'](_0x2a58b7[_0x477f('0x2f')]['sort']);_0x432170[_0x477f('0x39')]=qs[_0x477f('0x3a')](_[_0x477f('0x3b')](_0x2a58b7['query'],_0x3cb99f[_0x477f('0x3a')]),_0x57ec38);if(_0x2a58b7['query'][_0x477f('0x3c')]){_0x432170['where']=_[_0x477f('0x3d')](_0x432170[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0x57ec38,function(_0x123058){if(_0x123058[_0x477f('0x3e')]!==_0x477f('0x3f')){var _0x32b3b1={};_0x32b3b1[_0x123058[_0x477f('0x28')]]={'$like':'%'+_0x2a58b7[_0x477f('0x2f')][_0x477f('0x3c')]+'%'};return _0x32b3b1;}})});}_0x432170=_['merge']({},_0x432170,_0x2a58b7[_0x477f('0x40')]);var _0x1c9760={'where':_0x432170['where']};return db[_0x477f('0x41')][_0x477f('0x1d')](_0x1c9760)[_0x477f('0x24')](function(_0xf7881b){_0x47b20a['count']=_0xf7881b;if(_0x2a58b7['query'][_0x477f('0x42')]){_0x432170[_0x477f('0x43')]=[{'all':!![]}];}return db[_0x477f('0x41')]['findAll'](_0x432170);})[_0x477f('0x24')](function(_0x9dadc0){_0x47b20a['rows']=_0x9dadc0;return _0x47b20a;})[_0x477f('0x24')](respondWithFilteredResult(_0x4d65f2,_0x432170))['catch'](handleError(_0x4d65f2,null));};exports[_0x477f('0x44')]=function(_0x13be6c,_0x1db340){var _0x56fefb={'raw':![],'where':{'id':_0x13be6c[_0x477f('0x45')]['id']}},_0x29e3ef={};_0x29e3ef[_0x477f('0x31')]=_['keys'](db[_0x477f('0x41')][_0x477f('0x2b')]);_0x29e3ef[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x13be6c['query']);_0x29e3ef['filters']=_[_0x477f('0x33')](_0x29e3ef['model'],_0x29e3ef[_0x477f('0x2f')]);_0x56fefb[_0x477f('0x32')]=_[_0x477f('0x33')](_0x29e3ef[_0x477f('0x31')],qs['fields'](_0x13be6c[_0x477f('0x2f')]['fields']));_0x56fefb[_0x477f('0x32')]=_0x56fefb[_0x477f('0x32')]['length']?_0x56fefb[_0x477f('0x32')]:_0x29e3ef['model'];if(_0x13be6c[_0x477f('0x2f')][_0x477f('0x42')]){_0x56fefb[_0x477f('0x43')]=[{'all':!![]}];}_0x56fefb=_[_0x477f('0x3d')]({},_0x56fefb,_0x13be6c[_0x477f('0x40')]);return db[_0x477f('0x41')][_0x477f('0x46')](_0x56fefb)[_0x477f('0x24')](handleEntityNotFound(_0x1db340,null))[_0x477f('0x24')](respondWithResult(_0x1db340,null))[_0x477f('0x47')](handleError(_0x1db340,null));};exports['create']=function(_0x5c30c1,_0x2fa9e0){return db[_0x477f('0x41')][_0x477f('0x48')](_0x5c30c1[_0x477f('0x49')],{})[_0x477f('0x24')](function(_0x2a3695){var _0x59f17c=_0x5c30c1[_0x477f('0x4a')][_0x477f('0x21')]({'plain':!![]});if(!_0x59f17c)throw new Error(_0x477f('0x4b'));if(_0x59f17c[_0x477f('0x4c')]===_0x477f('0x4a')){var _0x4b4071=_0x2a3695[_0x477f('0x21')]({'plain':!![]});var _0x41f3f9=_0x477f('0x22');return db[_0x477f('0x4d')][_0x477f('0x46')]({'where':{'name':_0x41f3f9,'userProfileId':_0x59f17c[_0x477f('0x4e')]},'raw':!![]})[_0x477f('0x24')](function(_0x191100){if(_0x191100&&_0x191100[_0x477f('0x4f')]===0x0){return db[_0x477f('0x23')]['create']({'name':_0x4b4071[_0x477f('0x28')],'resourceId':_0x4b4071['id'],'type':_0x191100['name'],'sectionId':_0x191100['id']},{})['then'](function(){return _0x2a3695;});}else{return _0x2a3695;}})[_0x477f('0x47')](function(_0x52ef69){logger['error'](_0x477f('0x50'),_0x52ef69);throw _0x52ef69;});}return _0x2a3695;})['then'](respondWithResult(_0x2fa9e0,0xc9))[_0x477f('0x47')](handleError(_0x2fa9e0,null));};exports[_0x477f('0x51')]=function(_0x501b7e,_0x28b9d6){var _0x57f366={'where':{'id':_0x501b7e[_0x477f('0x45')]['id']}},_0x52fafc={};_0x52fafc[_0x477f('0x31')]=_[_0x477f('0x30')](db[_0x477f('0x41')]['rawAttributes']);_0x57f366[_0x477f('0x32')]=_[_0x477f('0x33')](_0x52fafc[_0x477f('0x31')],qs[_0x477f('0x34')](_0x501b7e[_0x477f('0x2f')][_0x477f('0x34')]));_0x57f366['attributes']=_0x57f366['attributes'][_0x477f('0x35')]?_0x57f366[_0x477f('0x32')]:_0x52fafc[_0x477f('0x31')];if(_0x501b7e[_0x477f('0x2f')][_0x477f('0x42')]){_0x57f366[_0x477f('0x43')]=[{'all':!![]}];}_0x57f366=_[_0x477f('0x3d')]({},_0x57f366,_0x501b7e[_0x477f('0x40')]);return db[_0x477f('0x41')][_0x477f('0x46')](_0x57f366)[_0x477f('0x24')](handleEntityNotFound(_0x28b9d6,null))['then'](function(_0x140c93){if(_0x140c93){var _0x522baa=_0x140c93[_0x477f('0x21')]({'plain':!![]});_0x522baa=qs[_0x477f('0x52')](_0x522baa,['id',_0x477f('0x53'),_0x477f('0x54')]);_0x501b7e[_0x477f('0x49')]=_['omit'](_0x501b7e[_0x477f('0x49')],['id',_0x477f('0x53'),_0x477f('0x54')]);return db[_0x477f('0x41')][_0x477f('0x48')](_[_0x477f('0x3d')](_0x522baa,_0x501b7e[_0x477f('0x49')]),{'include':_0x501b7e[_0x477f('0x2f')][_0x477f('0x42')]?[{'all':!![]}]:undefined})[_0x477f('0x24')](function(_0x433bbd){var _0x4463c6=_0x501b7e[_0x477f('0x4a')][_0x477f('0x21')]({'plain':!![]});if(!_0x4463c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4463c6[_0x477f('0x4c')]==='user'){var _0x40eb86=_0x433bbd[_0x477f('0x21')]({'plain':!![]});var _0x540b26=_0x477f('0x22');return db[_0x477f('0x4d')]['find']({'where':{'name':_0x540b26,'userProfileId':_0x4463c6[_0x477f('0x4e')]},'raw':!![]})['then'](function(_0x33ec9d){if(_0x33ec9d&&_0x33ec9d[_0x477f('0x4f')]===0x0){return db['UserProfileResource'][_0x477f('0x48')]({'name':_0x40eb86[_0x477f('0x28')],'resourceId':_0x40eb86['id'],'type':_0x33ec9d['name'],'sectionId':_0x33ec9d['id']},{})[_0x477f('0x24')](function(){return _0x433bbd;});}else{return _0x433bbd;}})[_0x477f('0x47')](function(_0x1882a9){logger[_0x477f('0x26')](_0x477f('0x50'),_0x1882a9);throw _0x1882a9;});}return _0x433bbd;});}})[_0x477f('0x24')](respondWithResult(_0x28b9d6,0xc9))[_0x477f('0x47')](handleError(_0x28b9d6,null));};exports['update']=function(_0x27737f,_0x398696){if(_0x27737f['body']['id']){delete _0x27737f[_0x477f('0x49')]['id'];}return db[_0x477f('0x41')][_0x477f('0x46')]({'where':{'id':_0x27737f[_0x477f('0x45')]['id']}})['then'](handleEntityNotFound(_0x398696,null))[_0x477f('0x24')](saveUpdates(_0x27737f['body'],null))['then'](respondWithResult(_0x398696,null))[_0x477f('0x47')](handleError(_0x398696,null));};exports[_0x477f('0x20')]=function(_0x4405d3,_0xf55191){return db[_0x477f('0x41')][_0x477f('0x46')]({'where':{'id':_0x4405d3['params']['id']}})[_0x477f('0x24')](handleEntityNotFound(_0xf55191,null))[_0x477f('0x24')](removeEntity(_0xf55191,null))[_0x477f('0x47')](handleError(_0xf55191,null));};exports[_0x477f('0x55')]=function(_0x2aeaa6,_0x27a093,_0x553724){var _0xaf6099={'raw':!![],'where':{}};var _0x97a9ef={};var _0x99b156={'count':0x0,'rows':[]};return db[_0x477f('0x41')][_0x477f('0x56')]({'where':{'id':_0x2aeaa6[_0x477f('0x45')]['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x27a093,null))[_0x477f('0x24')](function(_0x1881df){if(_0x1881df){_0x97a9ef[_0x477f('0x31')]=_['keys'](db[_0x477f('0x57')][_0x477f('0x2b')]);_0x97a9ef[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x2aeaa6[_0x477f('0x2f')]);_0x97a9ef[_0x477f('0x3a')]=_['intersection'](_0x97a9ef[_0x477f('0x31')],_0x97a9ef[_0x477f('0x2f')]);_0xaf6099[_0x477f('0x32')]=_[_0x477f('0x33')](_0x97a9ef[_0x477f('0x31')],qs[_0x477f('0x34')](_0x2aeaa6[_0x477f('0x2f')][_0x477f('0x34')]));_0xaf6099[_0x477f('0x32')]=_0xaf6099[_0x477f('0x32')][_0x477f('0x35')]?_0xaf6099[_0x477f('0x32')]:_0x97a9ef[_0x477f('0x31')];if(!_0x2aeaa6[_0x477f('0x2f')]['hasOwnProperty'](_0x477f('0x37'))){_0xaf6099['limit']=qs['limit'](_0x2aeaa6['query'][_0x477f('0x1c')]);_0xaf6099[_0x477f('0x1a')]=qs[_0x477f('0x1a')](_0x2aeaa6['query']['offset']);}_0xaf6099[_0x477f('0x38')]=qs['sort'](_0x2aeaa6[_0x477f('0x2f')]['sort']);_0xaf6099[_0x477f('0x39')]=qs[_0x477f('0x3a')](_[_0x477f('0x3b')](_0x2aeaa6[_0x477f('0x2f')],_0x97a9ef[_0x477f('0x3a')]));_0xaf6099[_0x477f('0x39')][_0x477f('0x58')]=_0x1881df['id'];if(_0x2aeaa6[_0x477f('0x2f')][_0x477f('0x3c')]){_0xaf6099[_0x477f('0x39')]=_[_0x477f('0x3d')](_0xaf6099[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0xaf6099[_0x477f('0x32')],function(_0x3ab630){var _0x5df0e3={};_0x5df0e3[_0x3ab630]={'$like':'%'+_0x2aeaa6[_0x477f('0x2f')]['filter']+'%'};return _0x5df0e3;})});}_0xaf6099=_['merge']({},_0xaf6099,_0x2aeaa6[_0x477f('0x40')]);return db[_0x477f('0x57')][_0x477f('0x1d')]({'where':_0xaf6099[_0x477f('0x39')]})['then'](function(_0x4cd461){_0x99b156[_0x477f('0x1d')]=_0x4cd461;if(_0x2aeaa6[_0x477f('0x2f')]['includeAll']){_0xaf6099[_0x477f('0x43')]=[{'all':!![]}];}return db[_0x477f('0x57')][_0x477f('0x59')](_0xaf6099);})['then'](function(_0x43d220){_0x99b156[_0x477f('0x5a')]=_0x43d220;return _0x99b156;});}})[_0x477f('0x24')](respondWithFilteredResult(_0x27a093,_0xaf6099))['catch'](handleError(_0x27a093,null));};exports['getHopperHistories']=function(_0x4377be,_0x3d8cb8,_0x170c42){var _0x32620f={'raw':!![],'where':{}};var _0x1ba8bd={};var _0x179c96={'count':0x0,'rows':[]};return db[_0x477f('0x41')][_0x477f('0x56')]({'where':{'id':_0x4377be[_0x477f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d8cb8,null))['then'](function(_0x48e786){if(_0x48e786){_0x1ba8bd[_0x477f('0x31')]=_['keys'](db[_0x477f('0x5b')]['rawAttributes']);_0x1ba8bd[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x4377be[_0x477f('0x2f')]);_0x1ba8bd[_0x477f('0x3a')]=_['intersection'](_0x1ba8bd[_0x477f('0x31')],_0x1ba8bd[_0x477f('0x2f')]);_0x32620f['attributes']=_[_0x477f('0x33')](_0x1ba8bd[_0x477f('0x31')],qs['fields'](_0x4377be[_0x477f('0x2f')][_0x477f('0x34')]));_0x32620f[_0x477f('0x32')]=_0x32620f['attributes'][_0x477f('0x35')]?_0x32620f[_0x477f('0x32')]:_0x1ba8bd[_0x477f('0x31')];if(!_0x4377be[_0x477f('0x2f')][_0x477f('0x36')](_0x477f('0x37'))){_0x32620f[_0x477f('0x1c')]=qs[_0x477f('0x1c')](_0x4377be[_0x477f('0x2f')]['limit']);_0x32620f[_0x477f('0x1a')]=qs['offset'](_0x4377be[_0x477f('0x2f')][_0x477f('0x1a')]);}_0x32620f[_0x477f('0x38')]=qs[_0x477f('0x5c')](_0x4377be[_0x477f('0x2f')]['sort']);_0x32620f[_0x477f('0x39')]=qs['filters'](_[_0x477f('0x3b')](_0x4377be[_0x477f('0x2f')],_0x1ba8bd[_0x477f('0x3a')]));_0x32620f[_0x477f('0x39')][_0x477f('0x58')]=_0x48e786['id'];if(_0x4377be[_0x477f('0x2f')][_0x477f('0x3c')]){_0x32620f[_0x477f('0x39')]=_[_0x477f('0x3d')](_0x32620f['where'],{'$or':_[_0x477f('0x2e')](_0x32620f['attributes'],function(_0x477246){var _0x537fa2={};_0x537fa2[_0x477246]={'$like':'%'+_0x4377be[_0x477f('0x2f')]['filter']+'%'};return _0x537fa2;})});}_0x32620f=_['merge']({},_0x32620f,_0x4377be['options']);return db[_0x477f('0x5b')][_0x477f('0x1d')]({'where':_0x32620f['where']})['then'](function(_0xd6ac28){_0x179c96[_0x477f('0x1d')]=_0xd6ac28;if(_0x4377be['query'][_0x477f('0x42')]){_0x32620f['include']=[{'all':!![]}];}return db[_0x477f('0x5b')]['findAll'](_0x32620f);})['then'](function(_0x520507){_0x179c96[_0x477f('0x5a')]=_0x520507;return _0x179c96;});}})['then'](respondWithFilteredResult(_0x3d8cb8,_0x32620f))[_0x477f('0x47')](handleError(_0x3d8cb8,null));};exports[_0x477f('0x5d')]=function(_0x1607ab,_0x2e5ade,_0x3a6f4c){var _0x2ea14f={'raw':!![],'where':{}};var _0x4db972={};var _0x42d51d={'count':0x0,'rows':[]};return db[_0x477f('0x41')]['findOne']({'where':{'id':_0x1607ab[_0x477f('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e5ade,null))[_0x477f('0x24')](function(_0x1e4907){if(_0x1e4907){_0x4db972['model']=_[_0x477f('0x30')](db[_0x477f('0x5e')][_0x477f('0x2b')]);_0x4db972[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x1607ab[_0x477f('0x2f')]);_0x4db972['filters']=_[_0x477f('0x33')](_0x4db972['model'],_0x4db972['query']);_0x2ea14f[_0x477f('0x32')]=_['intersection'](_0x4db972[_0x477f('0x31')],qs[_0x477f('0x34')](_0x1607ab[_0x477f('0x2f')]['fields']));_0x2ea14f[_0x477f('0x32')]=_0x2ea14f['attributes'][_0x477f('0x35')]?_0x2ea14f['attributes']:_0x4db972[_0x477f('0x31')];if(!_0x1607ab['query'][_0x477f('0x36')]('nolimit')){_0x2ea14f[_0x477f('0x1c')]=qs[_0x477f('0x1c')](_0x1607ab[_0x477f('0x2f')][_0x477f('0x1c')]);_0x2ea14f[_0x477f('0x1a')]=qs[_0x477f('0x1a')](_0x1607ab[_0x477f('0x2f')][_0x477f('0x1a')]);}_0x2ea14f[_0x477f('0x38')]=qs[_0x477f('0x5c')](_0x1607ab[_0x477f('0x2f')]['sort']);_0x2ea14f[_0x477f('0x39')]=qs[_0x477f('0x3a')](_['pick'](_0x1607ab[_0x477f('0x2f')],_0x4db972[_0x477f('0x3a')]));_0x2ea14f[_0x477f('0x39')][_0x477f('0x58')]=_0x1e4907['id'];if(_0x1607ab[_0x477f('0x2f')][_0x477f('0x3c')]){_0x2ea14f[_0x477f('0x39')]=_[_0x477f('0x3d')](_0x2ea14f[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0x2ea14f['attributes'],function(_0xcf7d28){var _0x90f66={};_0x90f66[_0xcf7d28]={'$like':'%'+_0x1607ab['query']['filter']+'%'};return _0x90f66;})});}_0x2ea14f=_[_0x477f('0x3d')]({},_0x2ea14f,_0x1607ab['options']);return db['CmHopperFinal'][_0x477f('0x1d')]({'where':_0x2ea14f[_0x477f('0x39')]})[_0x477f('0x24')](function(_0x2c391b){_0x42d51d[_0x477f('0x1d')]=_0x2c391b;if(_0x1607ab[_0x477f('0x2f')][_0x477f('0x42')]){_0x2ea14f[_0x477f('0x43')]=[{'all':!![]}];}return db[_0x477f('0x5e')][_0x477f('0x59')](_0x2ea14f);})[_0x477f('0x24')](function(_0x586501){_0x42d51d['rows']=_0x586501;return _0x42d51d;});}})[_0x477f('0x24')](respondWithFilteredResult(_0x2e5ade,_0x2ea14f))[_0x477f('0x47')](handleError(_0x2e5ade,null));};exports[_0x477f('0x5f')]=function(_0x1fe95a,_0x5f05d8,_0x36b9ab){var _0x2e6d19={'raw':!![],'where':{}};var _0x5c7307={};var _0x258b09={'count':0x0,'rows':[]};return db[_0x477f('0x41')][_0x477f('0x56')]({'where':{'id':_0x1fe95a[_0x477f('0x45')]['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x5f05d8,null))['then'](function(_0x547c6a){if(_0x547c6a){_0x5c7307[_0x477f('0x31')]=_[_0x477f('0x30')](db[_0x477f('0x60')][_0x477f('0x2b')]);_0x5c7307['query']=_['keys'](_0x1fe95a[_0x477f('0x2f')]);_0x5c7307[_0x477f('0x3a')]=_['intersection'](_0x5c7307[_0x477f('0x31')],_0x5c7307[_0x477f('0x2f')]);_0x2e6d19['attributes']=_[_0x477f('0x33')](_0x5c7307[_0x477f('0x31')],qs['fields'](_0x1fe95a[_0x477f('0x2f')][_0x477f('0x34')]));_0x2e6d19['attributes']=_0x2e6d19['attributes'][_0x477f('0x35')]?_0x2e6d19[_0x477f('0x32')]:_0x5c7307[_0x477f('0x31')];if(!_0x1fe95a[_0x477f('0x2f')][_0x477f('0x36')](_0x477f('0x37'))){_0x2e6d19[_0x477f('0x1c')]=qs['limit'](_0x1fe95a[_0x477f('0x2f')]['limit']);_0x2e6d19['offset']=qs[_0x477f('0x1a')](_0x1fe95a[_0x477f('0x2f')][_0x477f('0x1a')]);}_0x2e6d19[_0x477f('0x38')]=qs[_0x477f('0x5c')](_0x1fe95a[_0x477f('0x2f')][_0x477f('0x5c')]);_0x2e6d19['where']=qs['filters'](_['pick'](_0x1fe95a[_0x477f('0x2f')],_0x5c7307['filters']));_0x2e6d19['where']['CampaignId']=_0x547c6a['id'];if(_0x1fe95a['query']['filter']){_0x2e6d19[_0x477f('0x39')]=_['merge'](_0x2e6d19[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0x2e6d19['attributes'],function(_0x796dd){var _0x49803e={};_0x49803e[_0x796dd]={'$like':'%'+_0x1fe95a[_0x477f('0x2f')]['filter']+'%'};return _0x49803e;})});}_0x2e6d19=_['merge']({},_0x2e6d19,_0x1fe95a[_0x477f('0x40')]);return db['CmHopperBlack'][_0x477f('0x1d')]({'where':_0x2e6d19[_0x477f('0x39')]})[_0x477f('0x24')](function(_0x3aef1c){_0x258b09[_0x477f('0x1d')]=_0x3aef1c;if(_0x1fe95a[_0x477f('0x2f')][_0x477f('0x42')]){_0x2e6d19[_0x477f('0x43')]=[{'all':!![]}];}return db[_0x477f('0x60')][_0x477f('0x59')](_0x2e6d19);})[_0x477f('0x24')](function(_0x363702){_0x258b09[_0x477f('0x5a')]=_0x363702;return _0x258b09;});}})[_0x477f('0x24')](respondWithFilteredResult(_0x5f05d8,_0x2e6d19))[_0x477f('0x47')](handleError(_0x5f05d8,null));};exports['getLists']=function(_0x86c749,_0x547773,_0x391ba9){var _0x348c9d={};var _0x29470e={};var _0x5ecb4a;var _0x3baf6a;return db[_0x477f('0x41')][_0x477f('0x56')]({'where':{'id':_0x86c749['params']['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x547773,null))[_0x477f('0x24')](function(_0x6f7a53){if(_0x6f7a53){_0x5ecb4a=_0x6f7a53;_0x29470e[_0x477f('0x31')]=_[_0x477f('0x30')](db['CmList'][_0x477f('0x2b')]);_0x29470e['query']=_[_0x477f('0x30')](_0x86c749['query']);_0x29470e[_0x477f('0x3a')]=_[_0x477f('0x33')](_0x29470e[_0x477f('0x31')],_0x29470e[_0x477f('0x2f')]);_0x348c9d[_0x477f('0x32')]=_[_0x477f('0x33')](_0x29470e[_0x477f('0x31')],qs[_0x477f('0x34')](_0x86c749['query'][_0x477f('0x34')]));_0x348c9d[_0x477f('0x32')]=_0x348c9d['attributes'][_0x477f('0x35')]?_0x348c9d[_0x477f('0x32')]:_0x29470e['model'];_0x348c9d['order']=qs['sort'](_0x86c749[_0x477f('0x2f')][_0x477f('0x5c')]);_0x348c9d[_0x477f('0x39')]=qs['filters'](_['pick'](_0x86c749[_0x477f('0x2f')],_0x29470e[_0x477f('0x3a')]));if(_0x86c749[_0x477f('0x2f')]['filter']){_0x348c9d[_0x477f('0x39')]=_[_0x477f('0x3d')](_0x348c9d[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0x348c9d['attributes'],function(_0x3108fb){var _0xa21787={};_0xa21787[_0x3108fb]={'$like':'%'+_0x86c749[_0x477f('0x2f')][_0x477f('0x3c')]+'%'};return _0xa21787;})});}_0x348c9d=_['merge']({},_0x348c9d,_0x86c749[_0x477f('0x40')]);return _0x5ecb4a[_0x477f('0x61')](_0x348c9d);}})['then'](function(_0x548afd){if(_0x548afd){_0x3baf6a=_0x548afd[_0x477f('0x35')];if(!_0x86c749['query']['hasOwnProperty']('nolimit')){_0x348c9d[_0x477f('0x1c')]=qs[_0x477f('0x1c')](_0x86c749[_0x477f('0x2f')]['limit']);_0x348c9d[_0x477f('0x1a')]=qs[_0x477f('0x1a')](_0x86c749[_0x477f('0x2f')][_0x477f('0x1a')]);}return _0x5ecb4a[_0x477f('0x61')](_0x348c9d);}})[_0x477f('0x24')](function(_0x2d68f8){if(_0x2d68f8){return _0x2d68f8?{'count':_0x3baf6a,'rows':_0x2d68f8}:null;}})[_0x477f('0x24')](respondWithResult(_0x547773,null))[_0x477f('0x47')](handleError(_0x547773,null));};exports['addLists']=function(_0x17c9a1,_0x265c8d,_0x588f70){var _0x1d4134,_0x210112;var _0x55f76a=[];var _0x5f1d21=moment()[_0x477f('0x62')](_0x477f('0x63'));return db['Campaign'][_0x477f('0x46')]({'where':{'id':_0x17c9a1['params']['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x265c8d,null))[_0x477f('0x24')](function(_0x164ba5){if(_0x164ba5){_0x210112=_0x164ba5;return _0x164ba5[_0x477f('0x64')](_0x17c9a1['body'][_0x477f('0x65')],_['omit'](_0x17c9a1[_0x477f('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0xd596dc){var _0x1ddc2c;var _0x1da91;_0x1d4134=_0xd596dc||[];var _0x4a9143=[];if(_0xd596dc){for(var _0x74340d=0x0;_0x74340d<_0xd596dc[_0x477f('0x35')];_0x74340d+=0x1){var _0x787a74=_0xd596dc[_0x74340d][_0x477f('0x21')]({'plain':!![]});_0x210112[_0x477f('0x66')]=_0x17c9a1['body'][_0x477f('0x66')]?_0x17c9a1['body']['dialCheckDuplicateType']:_0x210112[_0x477f('0x66')];switch(_0x210112[_0x477f('0x66')]){case _0x477f('0x67'):_0x1ddc2c=squel[_0x477f('0x68')]()[_0x477f('0x69')](_0x477f('0x6a'))['fromQuery']([_0x477f('0x6b'),_0x477f('0x6c'),_0x477f('0x6d'),_0x477f('0x6e'),_0x477f('0x58'),_0x477f('0x53'),'updatedAt'],squel[_0x477f('0x6f')]()[_0x477f('0x70')]('phone',_0x477f('0x6b'))[_0x477f('0x70')](_0x477f('0x71'),'scheduledAt')[_0x477f('0x70')]('id','ContactId')[_0x477f('0x70')](_0x787a74[_0x477f('0x72')][_0x477f('0x73')](),_0x477f('0x6e'))[_0x477f('0x70')](_0x17c9a1[_0x477f('0x45')]['id'][_0x477f('0x73')](),_0x477f('0x58'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x53'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x54'))[_0x477f('0x74')](_0x477f('0x75'))[_0x477f('0x39')](_0x477f('0x76'))[_0x477f('0x39')](_0x477f('0x77'),_0x787a74[_0x477f('0x72')]['toString']())['where'](_0x477f('0x78'))[_0x477f('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x477f('0x6f')]()[_0x477f('0x70')](_0x477f('0x79'))['from']('cm_hopper_final')[_0x477f('0x39')]('CampaignId\x20=\x20?',_0x17c9a1[_0x477f('0x45')]['id'][_0x477f('0x73')]()))[_0x477f('0x39')](_0x477f('0x7a'),squel[_0x477f('0x6f')]()[_0x477f('0x70')](_0x477f('0x7b'))[_0x477f('0x74')](_0x477f('0x6a'))[_0x477f('0x39')](_0x477f('0x7c'),_0x17c9a1[_0x477f('0x45')]['id'][_0x477f('0x73')]())))[_0x477f('0x73')]();break;case'onlyIfOpen':_0x1ddc2c=squel['insert']()[_0x477f('0x69')](_0x477f('0x6a'))[_0x477f('0x7d')]([_0x477f('0x6b'),_0x477f('0x6c'),_0x477f('0x6d'),_0x477f('0x6e'),_0x477f('0x58'),_0x477f('0x53'),_0x477f('0x54')],squel[_0x477f('0x6f')]()[_0x477f('0x70')]('phone',_0x477f('0x6b'))[_0x477f('0x70')](_0x477f('0x71'),_0x477f('0x6c'))[_0x477f('0x70')]('id',_0x477f('0x6d'))[_0x477f('0x70')](_0x787a74['CmListId'][_0x477f('0x73')](),_0x477f('0x6e'))[_0x477f('0x70')](_0x17c9a1[_0x477f('0x45')]['id']['toString'](),_0x477f('0x58'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x53'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27','updatedAt')[_0x477f('0x74')](_0x477f('0x75'))['where']('deletedAt\x20IS\x20NULL')[_0x477f('0x39')](_0x477f('0x77'),_0x787a74[_0x477f('0x72')][_0x477f('0x73')]())[_0x477f('0x39')](_0x477f('0x78'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x477f('0x6f')]()[_0x477f('0x70')]('COALESCE(phone,\x27\x27)')[_0x477f('0x74')](_0x477f('0x6a'))[_0x477f('0x39')](_0x477f('0x7c'),_0x17c9a1[_0x477f('0x45')]['id'][_0x477f('0x73')]())))[_0x477f('0x73')]();break;default:_0x1ddc2c=squel[_0x477f('0x68')]()[_0x477f('0x69')](_0x477f('0x6a'))[_0x477f('0x7d')]([_0x477f('0x6b'),_0x477f('0x6c'),_0x477f('0x6d'),_0x477f('0x6e'),'CampaignId',_0x477f('0x53'),_0x477f('0x54')],squel['select']()[_0x477f('0x70')](_0x477f('0x6b'),'phone')[_0x477f('0x70')]('NOW()',_0x477f('0x6c'))[_0x477f('0x70')]('id',_0x477f('0x6d'))['field'](_0x787a74[_0x477f('0x72')][_0x477f('0x73')](),_0x477f('0x6e'))[_0x477f('0x70')](_0x17c9a1['params']['id'][_0x477f('0x73')](),_0x477f('0x58'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x53'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x54'))[_0x477f('0x74')](_0x477f('0x75'))['where'](_0x477f('0x76'))[_0x477f('0x39')](_0x477f('0x77'),_0x787a74['CmListId'][_0x477f('0x73')]())[_0x477f('0x39')](_0x477f('0x78')))[_0x477f('0x73')]();}_0x1da91=squel[_0x477f('0x68')]()[_0x477f('0x69')](_0x477f('0x7e'))[_0x477f('0x7d')]([_0x477f('0x7f'),_0x477f('0x6c'),_0x477f('0x6b'),_0x477f('0x80'),'createdAt','updatedAt'],squel['select']()[_0x477f('0x70')](_0x477f('0x81'),'id')['field'](_0x477f('0x71'),_0x477f('0x6c'))[_0x477f('0x70')](_0x477f('0x82'),_0x477f('0x6b'))['field'](_0x477f('0x83'),_0x477f('0x80'))[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27','createdAt')[_0x477f('0x70')]('\x27'+_0x5f1d21+'\x27',_0x477f('0x54'))['from'](_0x477f('0x84'),'ci')[_0x477f('0x85')]('cm_hopper','h',_0x477f('0x86'))[_0x477f('0x39')](_0x477f('0x87'),_0x787a74[_0x477f('0x72')][_0x477f('0x73')]())[_0x477f('0x39')](_0x477f('0x88'),_0x17c9a1[_0x477f('0x45')]['id']['toString']())['where']('h.createdAt\x20=\x20?',_0x5f1d21))[_0x477f('0x73')]();_0x4a9143[_0x477f('0x89')](db[_0x477f('0x8a')]['query'](_0x1ddc2c));_0x55f76a[_0x477f('0x89')](db[_0x477f('0x8a')][_0x477f('0x2f')](_0x1da91));}return BPromise[_0x477f('0x8b')](_0x4a9143);}})[_0x477f('0x24')](function(){return BPromise[_0x477f('0x8b')](_0x55f76a);})['then'](function(){return _0x1d4134;})[_0x477f('0x24')](respondWithResult(_0x265c8d,null))[_0x477f('0x47')](handleError(_0x265c8d,null));};exports['removeLists']=function(_0xe9dcc1,_0xe86e97,_0x1c3a68){return db[_0x477f('0x41')][_0x477f('0x46')]({'where':{'id':_0xe9dcc1[_0x477f('0x45')]['id']}})['then'](handleEntityNotFound(_0xe86e97,null))[_0x477f('0x24')](function(_0x3e82df){if(_0x3e82df){return _0x3e82df[_0x477f('0x8c')](_0xe9dcc1[_0x477f('0x2f')][_0x477f('0x65')]);}})[_0x477f('0x24')](function(_0x2e0d8f){if(_0x2e0d8f){return db['CmHopper'][_0x477f('0x20')]({'where':{'ListId':_0xe9dcc1[_0x477f('0x2f')][_0x477f('0x65')],'CampaignId':_0xe9dcc1['params']['id']}})[_0x477f('0x24')](function(){return _0x2e0d8f;});}})[_0x477f('0x24')](respondWithStatusCode(_0xe86e97,null))[_0x477f('0x47')](handleError(_0xe86e97,null));};exports[_0x477f('0x8d')]=function(_0x59c23b,_0x17a62a,_0x133b48){var _0x170f18={};var _0x361c36={};var _0x427517;var _0x3caea4;return db[_0x477f('0x41')][_0x477f('0x56')]({'where':{'id':_0x59c23b['params']['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x17a62a,null))['then'](function(_0x15f818){if(_0x15f818){_0x427517=_0x15f818;_0x361c36[_0x477f('0x31')]=_['keys'](db[_0x477f('0x8e')]['rawAttributes']);_0x361c36[_0x477f('0x2f')]=_[_0x477f('0x30')](_0x59c23b[_0x477f('0x2f')]);_0x361c36[_0x477f('0x3a')]=_[_0x477f('0x33')](_0x361c36[_0x477f('0x31')],_0x361c36[_0x477f('0x2f')]);_0x170f18[_0x477f('0x32')]=_[_0x477f('0x33')](_0x361c36['model'],qs['fields'](_0x59c23b['query'][_0x477f('0x34')]));_0x170f18[_0x477f('0x32')]=_0x170f18['attributes']['length']?_0x170f18[_0x477f('0x32')]:_0x361c36[_0x477f('0x31')];_0x170f18[_0x477f('0x38')]=qs['sort'](_0x59c23b[_0x477f('0x2f')][_0x477f('0x5c')]);_0x170f18[_0x477f('0x39')]=qs[_0x477f('0x3a')](_[_0x477f('0x3b')](_0x59c23b[_0x477f('0x2f')],_0x361c36[_0x477f('0x3a')]));if(_0x59c23b[_0x477f('0x2f')][_0x477f('0x3c')]){_0x170f18[_0x477f('0x39')]=_['merge'](_0x170f18[_0x477f('0x39')],{'$or':_[_0x477f('0x2e')](_0x170f18[_0x477f('0x32')],function(_0x291110){var _0x5657b9={};_0x5657b9[_0x291110]={'$like':'%'+_0x59c23b[_0x477f('0x2f')][_0x477f('0x3c')]+'%'};return _0x5657b9;})});}_0x170f18=_[_0x477f('0x3d')]({},_0x170f18,_0x59c23b[_0x477f('0x40')]);return _0x427517[_0x477f('0x8d')](_0x170f18);}})[_0x477f('0x24')](function(_0x2ecc31){if(_0x2ecc31){_0x3caea4=_0x2ecc31[_0x477f('0x35')];if(!_0x59c23b['query']['hasOwnProperty'](_0x477f('0x37'))){_0x170f18[_0x477f('0x1c')]=qs[_0x477f('0x1c')](_0x59c23b[_0x477f('0x2f')][_0x477f('0x1c')]);_0x170f18[_0x477f('0x1a')]=qs['offset'](_0x59c23b['query'][_0x477f('0x1a')]);}return _0x427517[_0x477f('0x8d')](_0x170f18);}})[_0x477f('0x24')](function(_0xc329b1){if(_0xc329b1){return _0xc329b1?{'count':_0x3caea4,'rows':_0xc329b1}:null;}})[_0x477f('0x24')](respondWithResult(_0x17a62a,null))[_0x477f('0x47')](handleError(_0x17a62a,null));};exports[_0x477f('0x8f')]=function(_0x2f9299,_0x454450,_0xf24a7b){var _0x310861,_0x16cb5e;var _0x153b86=[];var _0x1f2ce6=moment()[_0x477f('0x62')](_0x477f('0x63'));return db['Campaign'][_0x477f('0x46')]({'where':{'id':_0x2f9299['params']['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x454450,null))['then'](function(_0x5db7af){if(_0x5db7af){_0x16cb5e=_0x5db7af;return _0x5db7af[_0x477f('0x8f')](_0x2f9299[_0x477f('0x49')][_0x477f('0x65')],_['omit'](_0x2f9299[_0x477f('0x49')],[_0x477f('0x65'),'id'])||{});}return null;})['spread'](function(_0x5af7d8){var _0x4227d7;var _0x30bc0d;_0x310861=_0x5af7d8||[];var _0x200bff=[];if(_0x5af7d8){for(var _0xaa954b=0x0;_0xaa954b<_0x5af7d8[_0x477f('0x35')];_0xaa954b+=0x1){var _0x272b62=_0x5af7d8[_0xaa954b]['get']({'plain':!![]});_0x4227d7=squel[_0x477f('0x68')]()[_0x477f('0x69')](_0x477f('0x90'))['fromQuery']([_0x477f('0x6b'),'ContactId',_0x477f('0x6e'),_0x477f('0x58'),_0x477f('0x53'),_0x477f('0x54')],squel[_0x477f('0x6f')]()[_0x477f('0x70')](_0x477f('0x6b'),'phone')[_0x477f('0x70')]('id',_0x477f('0x6d'))[_0x477f('0x70')](_0x272b62[_0x477f('0x72')][_0x477f('0x73')](),'ListId')[_0x477f('0x70')](_0x2f9299[_0x477f('0x45')]['id'][_0x477f('0x73')](),_0x477f('0x58'))['field'](_0x477f('0x71'),'createdAt')[_0x477f('0x70')](_0x477f('0x71'),'updatedAt')[_0x477f('0x74')](_0x477f('0x75'))['where']('deletedAt\x20IS\x20NULL')[_0x477f('0x39')](_0x477f('0x77'),_0x272b62['CmListId'][_0x477f('0x73')]())[_0x477f('0x39')](_0x477f('0x78')))['toString']();_0x200bff[_0x477f('0x89')](db['sequelize']['query'](_0x4227d7));}return BPromise[_0x477f('0x8b')](_0x200bff);}})[_0x477f('0x24')](function(){return _0x310861;})[_0x477f('0x24')](respondWithResult(_0x454450,null))[_0x477f('0x47')](handleError(_0x454450,null));};exports[_0x477f('0x91')]=function(_0x51d469,_0x4baa80,_0x31ecb2){return db[_0x477f('0x41')][_0x477f('0x46')]({'where':{'id':_0x51d469[_0x477f('0x45')]['id']}})[_0x477f('0x24')](handleEntityNotFound(_0x4baa80,null))['then'](function(_0x30cc2b){if(_0x30cc2b){return _0x30cc2b[_0x477f('0x91')](_0x51d469[_0x477f('0x2f')]['ids']);}})['then'](function(_0x3bba46){if(_0x3bba46){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x51d469['query'][_0x477f('0x65')],'CampaignId':_0x51d469['params']['id']}})[_0x477f('0x24')](function(){return _0x3bba46;});}})[_0x477f('0x24')](respondWithStatusCode(_0x4baa80,null))[_0x477f('0x47')](handleError(_0x4baa80,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f4df359..6e56022 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3d977be..ced9d11 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 _0x136c=['include','map','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','options','raw','where','attributes','limit'];(function(_0x54f609,_0x50b70d){var _0x13522e=function(_0x27546c){while(--_0x27546c){_0x54f609['push'](_0x54f609['shift']());}};_0x13522e(++_0x50b70d);}(_0x136c,0x1d2));var _0xc136=function(_0x7b203c,_0x4db126){_0x7b203c=_0x7b203c-0x0;var _0x26098b=_0x136c[_0x7b203c];return _0x26098b;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var moment=require('moment');var BPromise=require(_0xc136('0x2'));var rs=require(_0xc136('0x3'));var fs=require('fs');var Redis=require(_0xc136('0x4'));var db=require(_0xc136('0x5'))['db'];var utils=require(_0xc136('0x6'));var logger=require(_0xc136('0x7'))(_0xc136('0x8'));var config=require(_0xc136('0x9'));var jayson=require(_0xc136('0xa'));var client=jayson['client'][_0xc136('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594112,_0x361a52,_0x3993f2){return new BPromise(function(_0x1804c1,_0x500376){return client[_0xc136('0xc')](_0x594112,_0x3993f2)['then'](function(_0x1ea07d){logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,_0xc136('0xf'));logger[_0xc136('0x10')](_0xc136('0x11'),_0x361a52,_0xc136('0xf'),JSON[_0xc136('0x12')](_0x1ea07d));if(_0x1ea07d[_0xc136('0x13')]){if(_0x1ea07d['error']['code']===0x1f4){logger[_0xc136('0x13')]('Campaign,\x20%s,\x20%s',_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x500376(_0x1ea07d[_0xc136('0x13')]['message']);}logger['error'](_0xc136('0xe'),_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x1804c1(_0x1ea07d['error']['message']);}else{logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,'request\x20sent');_0x1804c1(_0x1ea07d['result']['message']);}})[_0xc136('0x15')](function(_0x3daf55){logger[_0xc136('0x13')](_0xc136('0xe'),_0x361a52,_0x3daf55);_0x500376(_0x3daf55);});});}exports[_0xc136('0x16')]=function(_0x1ccf5f){var _0x59503b=this;return new Promise(function(_0x5df9b7,_0x4d56cb){return db[_0xc136('0x17')]['findAll']({'raw':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f[_0xc136('0x18')][_0xc136('0x19')]===undefined?!![]:![]:!![],'where':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1a')]||null:null,'attributes':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1b')]||null:null,'limit':_0x1ccf5f['options']?_0x1ccf5f['options'][_0xc136('0x1c')]||null:null,'include':_0x1ccf5f[_0xc136('0x18')]?_0x1ccf5f['options'][_0xc136('0x1d')]?_[_0xc136('0x1e')](_0x1ccf5f[_0xc136('0x18')][_0xc136('0x1d')],function(_0x5d8300){return{'model':db[_0x5d8300[_0xc136('0x1f')]],'as':_0x5d8300['as'],'attributes':_0x5d8300[_0xc136('0x1b')],'include':_0x5d8300['include']?_[_0xc136('0x1e')](_0x5d8300['include'],function(_0x21a163){return{'model':db[_0x21a163[_0xc136('0x1f')]],'as':_0x21a163['as'],'attributes':_0x21a163['attributes'],'include':_0x21a163['include']?_[_0xc136('0x1e')](_0x21a163[_0xc136('0x1d')],function(_0x549a60){return{'model':db[_0x549a60[_0xc136('0x1f')]],'as':_0x549a60['as'],'attributes':_0x549a60[_0xc136('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc136('0x20')](function(_0x2608b8){logger[_0xc136('0xd')](_0xc136('0x16'),_0x1ccf5f);logger[_0xc136('0x10')]('GetCampaign',_0x1ccf5f,JSON[_0xc136('0x12')](_0x2608b8));_0x5df9b7(_0x2608b8);})[_0xc136('0x15')](function(_0x1ad50f){logger[_0xc136('0x13')](_0xc136('0x16'),_0x1ad50f[_0xc136('0x14')],_0x1ccf5f);_0x4d56cb(_0x59503b[_0xc136('0x13')](0x1f4,_0x1ad50f[_0xc136('0x14')]));});});}; \ No newline at end of file +var _0x8b29=['GetCampaign','findAll','options','raw','where','attributes','map','include','model','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x310b61,_0x17e19c){var _0x426630=function(_0x26b871){while(--_0x26b871){_0x310b61['push'](_0x310b61['shift']());}};_0x426630(++_0x17e19c);}(_0x8b29,0xbe));var _0x98b2=function(_0x3e850c,_0x1e5575){_0x3e850c=_0x3e850c-0x0;var _0x912b2=_0x8b29[_0x3e850c];return _0x912b2;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ef5,_0x221cee,_0x2cd0cb){return new BPromise(function(_0x417ca6,_0x388827){return client[_0x98b2('0x9')](_0x3e7ef5,_0x2cd0cb)[_0x98b2('0xa')](function(_0x501b51){logger['info'](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));logger[_0x98b2('0xd')](_0x98b2('0xe'),_0x221cee,_0x98b2('0xc'),JSON[_0x98b2('0xf')](_0x501b51));if(_0x501b51['error']){if(_0x501b51[_0x98b2('0x10')][_0x98b2('0x11')]===0x1f4){logger['error'](_0x98b2('0xb'),_0x221cee,_0x501b51[_0x98b2('0x10')][_0x98b2('0x12')]);return _0x388827(_0x501b51['error']['message']);}logger[_0x98b2('0x10')]('Campaign,\x20%s,\x20%s',_0x221cee,_0x501b51[_0x98b2('0x10')]['message']);return _0x417ca6(_0x501b51['error']['message']);}else{logger[_0x98b2('0x13')](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));_0x417ca6(_0x501b51['result']['message']);}})['catch'](function(_0x389d22){logger[_0x98b2('0x10')](_0x98b2('0xb'),_0x221cee,_0x389d22);_0x388827(_0x389d22);});});}exports[_0x98b2('0x14')]=function(_0x4b9f2c){var _0x1cd8c6=this;return new Promise(function(_0x588837,_0x989082){return db['Campaign'][_0x98b2('0x15')]({'raw':_0x4b9f2c[_0x98b2('0x16')]?_0x4b9f2c[_0x98b2('0x16')][_0x98b2('0x17')]===undefined?!![]:![]:!![],'where':_0x4b9f2c['options']?_0x4b9f2c[_0x98b2('0x16')][_0x98b2('0x18')]||null:null,'attributes':_0x4b9f2c['options']?_0x4b9f2c['options'][_0x98b2('0x19')]||null:null,'limit':_0x4b9f2c[_0x98b2('0x16')]?_0x4b9f2c['options']['limit']||null:null,'include':_0x4b9f2c[_0x98b2('0x16')]?_0x4b9f2c[_0x98b2('0x16')]['include']?_[_0x98b2('0x1a')](_0x4b9f2c[_0x98b2('0x16')][_0x98b2('0x1b')],function(_0x4f33d8){return{'model':db[_0x4f33d8[_0x98b2('0x1c')]],'as':_0x4f33d8['as'],'attributes':_0x4f33d8['attributes'],'include':_0x4f33d8[_0x98b2('0x1b')]?_['map'](_0x4f33d8['include'],function(_0x7b6ebc){return{'model':db[_0x7b6ebc[_0x98b2('0x1c')]],'as':_0x7b6ebc['as'],'attributes':_0x7b6ebc[_0x98b2('0x19')],'include':_0x7b6ebc['include']?_['map'](_0x7b6ebc['include'],function(_0x11c6aa){return{'model':db[_0x11c6aa[_0x98b2('0x1c')]],'as':_0x11c6aa['as'],'attributes':_0x11c6aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x98b2('0xa')](function(_0x28db65){logger[_0x98b2('0x13')]('GetCampaign',_0x4b9f2c);logger[_0x98b2('0xd')](_0x98b2('0x14'),_0x4b9f2c,JSON[_0x98b2('0xf')](_0x28db65));_0x588837(_0x28db65);})[_0x98b2('0x1d')](function(_0x25393d){logger['error'](_0x98b2('0x14'),_0x25393d['message'],_0x4b9f2c);_0x989082(_0x1cd8c6[_0x98b2('0x10')](0x1f4,_0x25393d[_0x98b2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 90f8e08..e960084 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 _0xa884=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','clone','addLists','addBlackLists','put','update','/:id/lists','removeLists','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show'];(function(_0x33d8a9,_0x4d0f1a){var _0x19894c=function(_0x591b78){while(--_0x591b78){_0x33d8a9['push'](_0x33d8a9['shift']());}};_0x19894c(++_0x4d0f1a);}(_0xa884,0x15a));var _0x4a88=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xa884[_0x32c012];return _0x48562e;};'use strict';var multer=require(_0x4a88('0x0'));var util=require(_0x4a88('0x1'));var path=require(_0x4a88('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a88('0x3'));var router=express[_0x4a88('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a88('0x5'));var interaction=require(_0x4a88('0x6'));var config=require(_0x4a88('0x7'));var controller=require(_0x4a88('0x8'));router[_0x4a88('0x9')]('/',auth['isAuthenticated'](),controller[_0x4a88('0xa')]);router['get'](_0x4a88('0xb'),auth[_0x4a88('0xc')](),controller[_0x4a88('0xd')]);router[_0x4a88('0x9')](_0x4a88('0xe'),auth['isAuthenticated'](),controller[_0x4a88('0xf')]);router['get'](_0x4a88('0x10'),auth[_0x4a88('0xc')](),controller[_0x4a88('0x11')]);router[_0x4a88('0x9')](_0x4a88('0x12'),auth['isAuthenticated'](),controller[_0x4a88('0x13')]);router[_0x4a88('0x9')](_0x4a88('0x14'),auth[_0x4a88('0xc')](),controller[_0x4a88('0x15')]);router[_0x4a88('0x9')]('/:id/lists',auth[_0x4a88('0xc')](),controller[_0x4a88('0x16')]);router[_0x4a88('0x9')](_0x4a88('0x17'),auth[_0x4a88('0xc')](),controller[_0x4a88('0x18')]);router['post']('/',auth[_0x4a88('0xc')](),controller[_0x4a88('0x19')]);router[_0x4a88('0x1a')]('/:id/clone',auth[_0x4a88('0xc')](),controller[_0x4a88('0x1b')]);router[_0x4a88('0x1a')]('/:id/lists',auth['isAuthenticated'](),controller[_0x4a88('0x1c')]);router[_0x4a88('0x1a')]('/:id/blacklists',auth[_0x4a88('0xc')](),controller[_0x4a88('0x1d')]);router[_0x4a88('0x1e')]('/:id',auth[_0x4a88('0xc')](),controller[_0x4a88('0x1f')]);router['delete']('/:id',auth[_0x4a88('0xc')](),controller['destroy']);router['delete'](_0x4a88('0x20'),auth[_0x4a88('0xc')](),controller[_0x4a88('0x21')]);router[_0x4a88('0x22')](_0x4a88('0x17'),auth[_0x4a88('0xc')](),controller['removeBlackLists']);module[_0x4a88('0x23')]=router; \ No newline at end of file +var _0xc3b0=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getLists','/:id/blacklists','getBlackLists','/:id/clone','clone','post','/:id/lists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id','/:id/hoppers','isAuthenticated','getHoppers'];(function(_0x11cc64,_0x16499f){var _0x5ae080=function(_0x4335b3){while(--_0x4335b3){_0x11cc64['push'](_0x11cc64['shift']());}};_0x5ae080(++_0x16499f);}(_0xc3b0,0x166));var _0x0c3b=function(_0x1d6ece,_0x177a0e){_0x1d6ece=_0x1d6ece-0x0;var _0x5f2ea3=_0xc3b0[_0x1d6ece];return _0x5f2ea3;};'use strict';var multer=require(_0x0c3b('0x0'));var util=require(_0x0c3b('0x1'));var path=require(_0x0c3b('0x2'));var timeout=require(_0x0c3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c3b('0x4'));var auth=require(_0x0c3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0c3b('0x6'));var controller=require(_0x0c3b('0x7'));router[_0x0c3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c3b('0x9')]);router[_0x0c3b('0x8')](_0x0c3b('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0c3b('0xb'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0xd')]);router[_0x0c3b('0x8')](_0x0c3b('0xe'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0xf')]);router[_0x0c3b('0x8')](_0x0c3b('0x10'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x11')]);router[_0x0c3b('0x8')]('/:id/hopper_black',auth[_0x0c3b('0xc')](),controller['getHopperBlacks']);router[_0x0c3b('0x8')]('/:id/lists',auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x12')]);router[_0x0c3b('0x8')](_0x0c3b('0x13'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x14')]);router['post']('/',auth[_0x0c3b('0xc')](),controller['create']);router['post'](_0x0c3b('0x15'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x16')]);router[_0x0c3b('0x17')](_0x0c3b('0x18'),auth['isAuthenticated'](),controller['addLists']);router[_0x0c3b('0x17')](_0x0c3b('0x13'),auth[_0x0c3b('0xc')](),controller['addBlackLists']);router[_0x0c3b('0x19')](_0x0c3b('0xa'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x1a')]);router[_0x0c3b('0x1b')](_0x0c3b('0xa'),auth[_0x0c3b('0xc')](),controller['destroy']);router[_0x0c3b('0x1b')]('/:id/lists',auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x1c')]);router[_0x0c3b('0x1b')](_0x0c3b('0x13'),auth[_0x0c3b('0xc')](),controller[_0x0c3b('0x1d')]);module[_0x0c3b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f0c8327..2aa316a 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 _0xb9f7=['key','sequelize','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x3909ae,_0x3183c7){var _0x15000b=function(_0x591ff5){while(--_0x591ff5){_0x3909ae['push'](_0x3909ae['shift']());}};_0x15000b(++_0x3183c7);}(_0xb9f7,0xf6));var _0x7b9f=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb9f7[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0x7b9f('0x0'));module['exports']={'key':{'type':Sequelize[_0x7b9f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7b9f('0x2')],'length':_0x7b9f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7b9f('0x1')]},'name':{'type':Sequelize[_0x7b9f('0x4')],'get':function(){return this[_0x7b9f('0x5')](_0x7b9f('0x6'));}}}; \ No newline at end of file +var _0x3f1b=['medium','VIRTUAL','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x75fa10,_0x3f6194){var _0x2bbb6b=function(_0x29aa77){while(--_0x29aa77){_0x75fa10['push'](_0x75fa10['shift']());}};_0x2bbb6b(++_0x3f6194);}(_0x3f1b,0x6d));var _0xb3f1=function(_0xfcb4af,_0x294f24){_0xfcb4af=_0xfcb4af-0x0;var _0x5cba4b=_0x3f1b[_0xfcb4af];return _0x5cba4b;};'use strict';var Sequelize=require(_0xb3f1('0x0'));module['exports']={'key':{'type':Sequelize[_0xb3f1('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb3f1('0x2')],'length':_0xb3f1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb3f1('0x1')]},'name':{'type':Sequelize[_0xb3f1('0x4')],'get':function(){return this[_0xb3f1('0x5')](_0xb3f1('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 291896a..0641dce 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 _0x86bf=['includeAll','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x54a3ed,_0x18d540){var _0xb20ccc=function(_0x3475af){while(--_0x3475af){_0x54a3ed['push'](_0x54a3ed['shift']());}};_0xb20ccc(++_0x18d540);}(_0x86bf,0xc4));var _0xf86b=function(_0x426086,_0x4cf84c){_0x426086=_0x426086-0x0;var _0xaecb04=_0x86bf[_0x426086];return _0xaecb04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf86b('0x0'));var zipdir=require(_0xf86b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf86b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf86b('0x3'));var path=require('path');var sox=require(_0xf86b('0x4'));var csv=require('to-csv');var ejs=require(_0xf86b('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf86b('0x6'));var squel=require(_0xf86b('0x7'));var crypto=require(_0xf86b('0x8'));var jsforce=require(_0xf86b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf86b('0xa'));var querystring=require(_0xf86b('0xb'));var Papa=require(_0xf86b('0xc'));var Redis=require(_0xf86b('0xd'));var authService=require(_0xf86b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf86b('0xf'));var hardwareService=require(_0xf86b('0x10'));var logger=require(_0xf86b('0x11'))('api');var utils=require(_0xf86b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf86b('0x13'))['db'];function respondWithStatusCode(_0x5f05db,_0x30f340){_0x30f340=_0x30f340||0xcc;return function(_0x16bc10){if(_0x16bc10){return _0x5f05db[_0xf86b('0x14')](_0x30f340);}return _0x5f05db[_0xf86b('0x15')](_0x30f340)[_0xf86b('0x16')]();};}function respondWithResult(_0xb01d48,_0xf371ea){_0xf371ea=_0xf371ea||0xc8;return function(_0x3190b6){if(_0x3190b6){return _0xb01d48[_0xf86b('0x15')](_0xf371ea)[_0xf86b('0x17')](_0x3190b6);}};}function respondWithFilteredResult(_0x223453,_0x559a84){return function(_0x581044){if(_0x581044){var _0x30ff01=typeof _0x559a84[_0xf86b('0x18')]===_0xf86b('0x19')&&typeof _0x559a84[_0xf86b('0x1a')]==='undefined';var _0x10b060=_0x581044['count'];var _0x4e2223=_0x30ff01?0x0:_0x559a84[_0xf86b('0x18')];var _0x45e92c=_0x30ff01?_0x581044[_0xf86b('0x1b')]:_0x559a84[_0xf86b('0x18')]+_0x559a84[_0xf86b('0x1a')];var _0x35e079;if(_0x45e92c>=_0x10b060){_0x45e92c=_0x10b060;_0x35e079=0xc8;}else{_0x35e079=0xce;}_0x223453[_0xf86b('0x15')](_0x35e079);return _0x223453[_0xf86b('0x1c')](_0xf86b('0x1d'),_0x4e2223+'-'+_0x45e92c+'/'+_0x10b060)[_0xf86b('0x17')](_0x581044);}return null;};}function patchUpdates(_0x111f68){return function(_0x31026d){try{jsonpatch[_0xf86b('0x1e')](_0x31026d,_0x111f68,!![]);}catch(_0x46024e){return BPromise[_0xf86b('0x1f')](_0x46024e);}return _0x31026d['save']();};}function saveUpdates(_0x492439,_0x16782e){return function(_0x198460){if(_0x198460){return _0x198460[_0xf86b('0x20')](_0x492439)[_0xf86b('0x21')](function(_0xf1cdfc){return _0xf1cdfc;});}return null;};}function removeEntity(_0x72749e,_0x31bb05){return function(_0xd9bdba){if(_0xd9bdba){return _0xd9bdba[_0xf86b('0x22')]()[_0xf86b('0x21')](function(){var _0x39a8bc=_0xd9bdba[_0xf86b('0x23')]({'plain':!![]});var _0x4a8e75=_0xf86b('0x24');return db[_0xf86b('0x25')]['destroy']({'where':{'type':_0x4a8e75,'resourceId':_0x39a8bc['id']}})['then'](function(){return _0xd9bdba;});})[_0xf86b('0x21')](function(){_0x72749e['status'](0xcc)[_0xf86b('0x16')]();});}};}function handleEntityNotFound(_0x5b19c5,_0x286118){return function(_0x5730d4){if(!_0x5730d4){_0x5b19c5[_0xf86b('0x14')](0x194);}return _0x5730d4;};}function handleError(_0x20b615,_0x212c28){_0x212c28=_0x212c28||0x1f4;return function(_0x26247d){logger['error'](_0x26247d['stack']);if(_0x26247d['name']){delete _0x26247d[_0xf86b('0x26')];}_0x20b615['status'](_0x212c28)[_0xf86b('0x27')](_0x26247d);};}exports[_0xf86b('0x28')]=function(_0x1733be,_0x470459){var _0xc5da82={},_0x44b40a={},_0x5c01b7={'count':0x0,'rows':[]};var _0x196855=_[_0xf86b('0x29')](db[_0xf86b('0x2a')][_0xf86b('0x2b')],function(_0x206e33){return{'name':_0x206e33[_0xf86b('0x2c')],'type':_0x206e33[_0xf86b('0x2d')][_0xf86b('0x2e')]};});_0x44b40a[_0xf86b('0x2f')]=_[_0xf86b('0x29')](_0x196855,_0xf86b('0x26'));_0x44b40a[_0xf86b('0x30')]=_[_0xf86b('0x31')](_0x1733be['query']);_0x44b40a[_0xf86b('0x32')]=_[_0xf86b('0x33')](_0x44b40a[_0xf86b('0x2f')],_0x44b40a[_0xf86b('0x30')]);_0xc5da82[_0xf86b('0x34')]=_['intersection'](_0x44b40a[_0xf86b('0x2f')],qs['fields'](_0x1733be['query'][_0xf86b('0x35')]));_0xc5da82['attributes']=_0xc5da82[_0xf86b('0x34')][_0xf86b('0x36')]?_0xc5da82[_0xf86b('0x34')]:_0x44b40a[_0xf86b('0x2f')];if(!_0x1733be[_0xf86b('0x30')]['hasOwnProperty'](_0xf86b('0x37'))){_0xc5da82[_0xf86b('0x1a')]=qs[_0xf86b('0x1a')](_0x1733be['query'][_0xf86b('0x1a')]);_0xc5da82[_0xf86b('0x18')]=qs[_0xf86b('0x18')](_0x1733be[_0xf86b('0x30')][_0xf86b('0x18')]);}_0xc5da82[_0xf86b('0x38')]=qs[_0xf86b('0x39')](_0x1733be[_0xf86b('0x30')][_0xf86b('0x39')]);_0xc5da82[_0xf86b('0x3a')]=qs[_0xf86b('0x32')](_[_0xf86b('0x3b')](_0x1733be['query'],_0x44b40a[_0xf86b('0x32')]),_0x196855);if(_0x1733be[_0xf86b('0x30')][_0xf86b('0x3c')]){_0xc5da82['where']=_[_0xf86b('0x3d')](_0xc5da82[_0xf86b('0x3a')],{'$or':[{'key':{'$like':'%'+_0x1733be[_0xf86b('0x30')][_0xf86b('0x3c')]+'%'}},{'value':{'$like':'%'+_0x1733be['query'][_0xf86b('0x3c')]+'%'}}]});}_0xc5da82=_[_0xf86b('0x3d')]({},_0xc5da82,_0x1733be['options']);var _0x48c41b={'where':_0xc5da82['where']};return db[_0xf86b('0x2a')][_0xf86b('0x1b')](_0x48c41b)[_0xf86b('0x21')](function(_0x9b89e){_0x5c01b7[_0xf86b('0x1b')]=_0x9b89e;if(_0x1733be['query'][_0xf86b('0x3e')]){_0xc5da82[_0xf86b('0x3f')]=[{'all':!![]}];}return db[_0xf86b('0x2a')][_0xf86b('0x40')](_0xc5da82);})[_0xf86b('0x21')](function(_0xd04210){_0x5c01b7[_0xf86b('0x41')]=_0xd04210;return _0x5c01b7;})['then'](respondWithFilteredResult(_0x470459,_0xc5da82))[_0xf86b('0x42')](handleError(_0x470459,null));};exports[_0xf86b('0x43')]=function(_0x4a2cc1,_0x58e9dc){var _0x549d43={'raw':!![],'where':{'id':_0x4a2cc1[_0xf86b('0x44')]['id']}},_0x3ee9ff={};_0x3ee9ff[_0xf86b('0x2f')]=_['keys'](db[_0xf86b('0x2a')]['rawAttributes']);_0x3ee9ff[_0xf86b('0x30')]=_['keys'](_0x4a2cc1[_0xf86b('0x30')]);_0x3ee9ff[_0xf86b('0x32')]=_[_0xf86b('0x33')](_0x3ee9ff[_0xf86b('0x2f')],_0x3ee9ff['query']);_0x549d43[_0xf86b('0x34')]=_['intersection'](_0x3ee9ff['model'],qs['fields'](_0x4a2cc1[_0xf86b('0x30')][_0xf86b('0x35')]));_0x549d43[_0xf86b('0x34')]=_0x549d43[_0xf86b('0x34')]['length']?_0x549d43[_0xf86b('0x34')]:_0x3ee9ff['model'];if(_0x4a2cc1[_0xf86b('0x30')][_0xf86b('0x3e')]){_0x549d43['include']=[{'all':!![]}];}_0x549d43=_['merge']({},_0x549d43,_0x4a2cc1['options']);return db[_0xf86b('0x2a')][_0xf86b('0x45')](_0x549d43)[_0xf86b('0x21')](handleEntityNotFound(_0x58e9dc,null))['then'](respondWithResult(_0x58e9dc,null))[_0xf86b('0x42')](handleError(_0x58e9dc,null));};exports[_0xf86b('0x20')]=function(_0x30275b,_0x34cdc7){if(_0x30275b[_0xf86b('0x46')]['id']){delete _0x30275b[_0xf86b('0x46')]['id'];}return db[_0xf86b('0x2a')][_0xf86b('0x45')]({'where':{'id':_0x30275b['params']['id']}})[_0xf86b('0x21')](handleEntityNotFound(_0x34cdc7,null))[_0xf86b('0x21')](saveUpdates(_0x30275b[_0xf86b('0x46')],null))[_0xf86b('0x21')](respondWithResult(_0x34cdc7,null))['catch'](handleError(_0x34cdc7,null));};exports[_0xf86b('0x22')]=function(_0x3b6c63,_0x3fe320){return db[_0xf86b('0x2a')][_0xf86b('0x45')]({'where':{'id':_0x3b6c63['params']['id']}})[_0xf86b('0x21')](handleEntityNotFound(_0x3fe320,null))[_0xf86b('0x21')](removeEntity(_0x3fe320,null))['catch'](handleError(_0x3fe320,null));};exports[_0xf86b('0x47')]=function(_0x76a847,_0x3a8a0d){var _0xb93a4c={'key':_0x76a847[_0xf86b('0x46')][_0xf86b('0x2e')]};if(_0x76a847[_0xf86b('0x46')][_0xf86b('0x48')]){_0xb93a4c['MailAccountId']=_0x76a847[_0xf86b('0x46')][_0xf86b('0x48')];}else if(_0x76a847[_0xf86b('0x46')][_0xf86b('0x49')]){_0xb93a4c[_0xf86b('0x49')]=_0x76a847['body'][_0xf86b('0x49')];}else if(_0x76a847[_0xf86b('0x46')][_0xf86b('0x4a')]){_0xb93a4c[_0xf86b('0x4a')]=_0x76a847[_0xf86b('0x46')]['OpenchannelAccountId'];}else if(_0x76a847[_0xf86b('0x46')][_0xf86b('0x4b')]){_0xb93a4c[_0xf86b('0x4b')]=_0x76a847[_0xf86b('0x46')][_0xf86b('0x4b')];}return db[_0xf86b('0x2a')][_0xf86b('0x45')]({'where':_0xb93a4c})[_0xf86b('0x21')](function(_0x2968ba){if(_0x2968ba){throw new db[(_0xf86b('0x4c'))][(_0xf86b('0x4d'))](_0xf86b('0x4e'));}return db[_0xf86b('0x2a')][_0xf86b('0x47')](_0x76a847[_0xf86b('0x46')]);})[_0xf86b('0x21')](function(_0x5d534f){var _0x45f478=_0x76a847[_0xf86b('0x4f')][_0xf86b('0x23')]({'plain':!![]});if(!_0x45f478)throw new Error(_0xf86b('0x50'));if(_0x45f478[_0xf86b('0x51')]===_0xf86b('0x4f')){var _0x4003e7=_0x5d534f[_0xf86b('0x23')]({'plain':!![]});return db[_0xf86b('0x52')]['find']({'where':{'name':_0xf86b('0x24'),'userProfileId':_0x45f478[_0xf86b('0x53')]},'raw':!![]})[_0xf86b('0x21')](function(_0x597745){if(_0x597745&&_0x597745['autoAssociation']===0x0){return db[_0xf86b('0x25')][_0xf86b('0x47')]({'name':_0x4003e7['name'],'resourceId':_0x4003e7['id'],'type':_0x597745[_0xf86b('0x26')],'sectionId':_0x597745['id']},{})[_0xf86b('0x21')](function(){return _0x5d534f;});}else{return _0x5d534f;}})[_0xf86b('0x42')](function(_0x5be4ac){logger[_0xf86b('0x54')](_0xf86b('0x55'),_0x5be4ac);throw _0x5be4ac;});}return _0x5d534f;})['then'](respondWithResult(_0x3a8a0d,0xc9))['catch'](handleError(_0x3a8a0d,null));}; \ No newline at end of file +var _0x9f43=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','intersection','find','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters'];(function(_0x436d7a,_0x4bcaf0){var _0x32003b=function(_0x5db190){while(--_0x5db190){_0x436d7a['push'](_0x436d7a['shift']());}};_0x32003b(++_0x4bcaf0);}(_0x9f43,0xd9));var _0x39f4=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9f43[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39f4('0x0'));var zipdir=require(_0x39f4('0x1'));var jsonpatch=require(_0x39f4('0x2'));var rp=require(_0x39f4('0x3'));var moment=require(_0x39f4('0x4'));var BPromise=require(_0x39f4('0x5'));var Mustache=require('mustache');var util=require(_0x39f4('0x6'));var path=require(_0x39f4('0x7'));var sox=require(_0x39f4('0x8'));var csv=require(_0x39f4('0x9'));var ejs=require(_0x39f4('0xa'));var fs=require('fs');var fs_extra=require(_0x39f4('0xb'));var _=require(_0x39f4('0xc'));var squel=require(_0x39f4('0xd'));var crypto=require(_0x39f4('0xe'));var jsforce=require(_0x39f4('0xf'));var deskjs=require(_0x39f4('0x10'));var toCsv=require(_0x39f4('0x9'));var querystring=require(_0x39f4('0x11'));var Papa=require('papaparse');var Redis=require(_0x39f4('0x12'));var authService=require(_0x39f4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x39f4('0x14'));var hardwareService=require(_0x39f4('0x15'));var logger=require(_0x39f4('0x16'))(_0x39f4('0x17'));var utils=require(_0x39f4('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x39f4('0x19'))['db'];function respondWithStatusCode(_0x2acbc2,_0xe2b53b){_0xe2b53b=_0xe2b53b||0xcc;return function(_0x1c946f){if(_0x1c946f){return _0x2acbc2[_0x39f4('0x1a')](_0xe2b53b);}return _0x2acbc2[_0x39f4('0x1b')](_0xe2b53b)['end']();};}function respondWithResult(_0x18a85a,_0x1171fe){_0x1171fe=_0x1171fe||0xc8;return function(_0x4128b5){if(_0x4128b5){return _0x18a85a[_0x39f4('0x1b')](_0x1171fe)[_0x39f4('0x1c')](_0x4128b5);}};}function respondWithFilteredResult(_0x18327c,_0x36eea4){return function(_0x4c334e){if(_0x4c334e){var _0x3f5f73=typeof _0x36eea4[_0x39f4('0x1d')]==='undefined'&&typeof _0x36eea4[_0x39f4('0x1e')]===_0x39f4('0x1f');var _0x4e2e3b=_0x4c334e['count'];var _0x23d2cf=_0x3f5f73?0x0:_0x36eea4['offset'];var _0x5b3bde=_0x3f5f73?_0x4c334e[_0x39f4('0x20')]:_0x36eea4[_0x39f4('0x1d')]+_0x36eea4[_0x39f4('0x1e')];var _0x3738ab;if(_0x5b3bde>=_0x4e2e3b){_0x5b3bde=_0x4e2e3b;_0x3738ab=0xc8;}else{_0x3738ab=0xce;}_0x18327c[_0x39f4('0x1b')](_0x3738ab);return _0x18327c[_0x39f4('0x21')](_0x39f4('0x22'),_0x23d2cf+'-'+_0x5b3bde+'/'+_0x4e2e3b)[_0x39f4('0x1c')](_0x4c334e);}return null;};}function patchUpdates(_0x55caf3){return function(_0x35fe6d){try{jsonpatch[_0x39f4('0x23')](_0x35fe6d,_0x55caf3,!![]);}catch(_0x117ff9){return BPromise[_0x39f4('0x24')](_0x117ff9);}return _0x35fe6d['save']();};}function saveUpdates(_0x28819e,_0x5c5ca1){return function(_0x46c3e4){if(_0x46c3e4){return _0x46c3e4[_0x39f4('0x25')](_0x28819e)[_0x39f4('0x26')](function(_0x21f430){return _0x21f430;});}return null;};}function removeEntity(_0x2713d3,_0x198267){return function(_0x5243a9){if(_0x5243a9){return _0x5243a9['destroy']()[_0x39f4('0x26')](function(){var _0x48e2ac=_0x5243a9['get']({'plain':!![]});var _0x17d301=_0x39f4('0x27');return db[_0x39f4('0x28')][_0x39f4('0x29')]({'where':{'type':_0x17d301,'resourceId':_0x48e2ac['id']}})[_0x39f4('0x26')](function(){return _0x5243a9;});})[_0x39f4('0x26')](function(){_0x2713d3[_0x39f4('0x1b')](0xcc)[_0x39f4('0x2a')]();});}};}function handleEntityNotFound(_0x2f270d,_0x552ed8){return function(_0x3d929e){if(!_0x3d929e){_0x2f270d[_0x39f4('0x1a')](0x194);}return _0x3d929e;};}function handleError(_0x40b1a8,_0x553dc6){_0x553dc6=_0x553dc6||0x1f4;return function(_0x1764d0){logger[_0x39f4('0x2b')](_0x1764d0[_0x39f4('0x2c')]);if(_0x1764d0[_0x39f4('0x2d')]){delete _0x1764d0['name'];}_0x40b1a8['status'](_0x553dc6)['send'](_0x1764d0);};}exports[_0x39f4('0x2e')]=function(_0xc01795,_0x385c4a){var _0x4d1f81={},_0x124c8c={},_0x56abbe={'count':0x0,'rows':[]};var _0x5e2313=_[_0x39f4('0x2f')](db['CannedAnswer'][_0x39f4('0x30')],function(_0x3d7265){return{'name':_0x3d7265[_0x39f4('0x31')],'type':_0x3d7265['type']['key']};});_0x124c8c['model']=_['map'](_0x5e2313,_0x39f4('0x2d'));_0x124c8c[_0x39f4('0x32')]=_[_0x39f4('0x33')](_0xc01795[_0x39f4('0x32')]);_0x124c8c[_0x39f4('0x34')]=_['intersection'](_0x124c8c[_0x39f4('0x35')],_0x124c8c[_0x39f4('0x32')]);_0x4d1f81[_0x39f4('0x36')]=_['intersection'](_0x124c8c[_0x39f4('0x35')],qs[_0x39f4('0x37')](_0xc01795[_0x39f4('0x32')]['fields']));_0x4d1f81['attributes']=_0x4d1f81[_0x39f4('0x36')][_0x39f4('0x38')]?_0x4d1f81[_0x39f4('0x36')]:_0x124c8c[_0x39f4('0x35')];if(!_0xc01795[_0x39f4('0x32')][_0x39f4('0x39')](_0x39f4('0x3a'))){_0x4d1f81[_0x39f4('0x1e')]=qs[_0x39f4('0x1e')](_0xc01795[_0x39f4('0x32')][_0x39f4('0x1e')]);_0x4d1f81[_0x39f4('0x1d')]=qs[_0x39f4('0x1d')](_0xc01795[_0x39f4('0x32')]['offset']);}_0x4d1f81[_0x39f4('0x3b')]=qs[_0x39f4('0x3c')](_0xc01795[_0x39f4('0x32')][_0x39f4('0x3c')]);_0x4d1f81['where']=qs[_0x39f4('0x34')](_['pick'](_0xc01795[_0x39f4('0x32')],_0x124c8c[_0x39f4('0x34')]),_0x5e2313);if(_0xc01795['query']['filter']){_0x4d1f81[_0x39f4('0x3d')]=_[_0x39f4('0x3e')](_0x4d1f81[_0x39f4('0x3d')],{'$or':[{'key':{'$like':'%'+_0xc01795[_0x39f4('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0xc01795[_0x39f4('0x32')][_0x39f4('0x3f')]+'%'}}]});}_0x4d1f81=_[_0x39f4('0x3e')]({},_0x4d1f81,_0xc01795['options']);var _0x47e572={'where':_0x4d1f81[_0x39f4('0x3d')]};return db[_0x39f4('0x40')][_0x39f4('0x20')](_0x47e572)[_0x39f4('0x26')](function(_0xb94238){_0x56abbe[_0x39f4('0x20')]=_0xb94238;if(_0xc01795[_0x39f4('0x32')][_0x39f4('0x41')]){_0x4d1f81[_0x39f4('0x42')]=[{'all':!![]}];}return db[_0x39f4('0x40')][_0x39f4('0x43')](_0x4d1f81);})['then'](function(_0x568bb1){_0x56abbe[_0x39f4('0x44')]=_0x568bb1;return _0x56abbe;})[_0x39f4('0x26')](respondWithFilteredResult(_0x385c4a,_0x4d1f81))[_0x39f4('0x45')](handleError(_0x385c4a,null));};exports[_0x39f4('0x46')]=function(_0x213bff,_0x1446c6){var _0x2e30ac={'raw':!![],'where':{'id':_0x213bff[_0x39f4('0x47')]['id']}},_0x528183={};_0x528183['model']=_[_0x39f4('0x33')](db[_0x39f4('0x40')]['rawAttributes']);_0x528183[_0x39f4('0x32')]=_['keys'](_0x213bff[_0x39f4('0x32')]);_0x528183[_0x39f4('0x34')]=_[_0x39f4('0x48')](_0x528183['model'],_0x528183['query']);_0x2e30ac[_0x39f4('0x36')]=_[_0x39f4('0x48')](_0x528183[_0x39f4('0x35')],qs[_0x39f4('0x37')](_0x213bff[_0x39f4('0x32')][_0x39f4('0x37')]));_0x2e30ac['attributes']=_0x2e30ac[_0x39f4('0x36')]['length']?_0x2e30ac[_0x39f4('0x36')]:_0x528183[_0x39f4('0x35')];if(_0x213bff[_0x39f4('0x32')][_0x39f4('0x41')]){_0x2e30ac[_0x39f4('0x42')]=[{'all':!![]}];}_0x2e30ac=_['merge']({},_0x2e30ac,_0x213bff['options']);return db[_0x39f4('0x40')][_0x39f4('0x49')](_0x2e30ac)[_0x39f4('0x26')](handleEntityNotFound(_0x1446c6,null))['then'](respondWithResult(_0x1446c6,null))['catch'](handleError(_0x1446c6,null));};exports[_0x39f4('0x25')]=function(_0x3638e6,_0x38a850){if(_0x3638e6[_0x39f4('0x4a')]['id']){delete _0x3638e6[_0x39f4('0x4a')]['id'];}return db[_0x39f4('0x40')][_0x39f4('0x49')]({'where':{'id':_0x3638e6[_0x39f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x38a850,null))[_0x39f4('0x26')](saveUpdates(_0x3638e6['body'],null))['then'](respondWithResult(_0x38a850,null))[_0x39f4('0x45')](handleError(_0x38a850,null));};exports[_0x39f4('0x29')]=function(_0xf5e0cd,_0x178967){return db[_0x39f4('0x40')]['find']({'where':{'id':_0xf5e0cd[_0x39f4('0x47')]['id']}})[_0x39f4('0x26')](handleEntityNotFound(_0x178967,null))[_0x39f4('0x26')](removeEntity(_0x178967,null))[_0x39f4('0x45')](handleError(_0x178967,null));};exports['create']=function(_0x23092a,_0x4fee1b){var _0x54bcc5={'key':_0x23092a['body'][_0x39f4('0x4b')]};if(_0x23092a['body'][_0x39f4('0x4c')]){_0x54bcc5[_0x39f4('0x4c')]=_0x23092a[_0x39f4('0x4a')][_0x39f4('0x4c')];}else if(_0x23092a[_0x39f4('0x4a')]['SmsAccountId']){_0x54bcc5[_0x39f4('0x4d')]=_0x23092a['body'][_0x39f4('0x4d')];}else if(_0x23092a['body'][_0x39f4('0x4e')]){_0x54bcc5['OpenchannelAccountId']=_0x23092a['body']['OpenchannelAccountId'];}else if(_0x23092a[_0x39f4('0x4a')]['ChatWebsiteId']){_0x54bcc5[_0x39f4('0x4f')]=_0x23092a[_0x39f4('0x4a')][_0x39f4('0x4f')];}return db[_0x39f4('0x40')][_0x39f4('0x49')]({'where':_0x54bcc5})[_0x39f4('0x26')](function(_0x4dd26f){if(_0x4dd26f){throw new db[(_0x39f4('0x50'))]['ValidationError'](_0x39f4('0x51'));}return db['CannedAnswer']['create'](_0x23092a[_0x39f4('0x4a')]);})['then'](function(_0xb831c8){var _0xd15be=_0x23092a[_0x39f4('0x52')][_0x39f4('0x53')]({'plain':!![]});if(!_0xd15be)throw new Error(_0x39f4('0x54'));if(_0xd15be['role']==='user'){var _0x43e8a0=_0xb831c8['get']({'plain':!![]});return db[_0x39f4('0x55')][_0x39f4('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0xd15be[_0x39f4('0x56')]},'raw':!![]})[_0x39f4('0x26')](function(_0x390b83){if(_0x390b83&&_0x390b83[_0x39f4('0x57')]===0x0){return db[_0x39f4('0x28')][_0x39f4('0x58')]({'name':_0x43e8a0['name'],'resourceId':_0x43e8a0['id'],'type':_0x390b83[_0x39f4('0x2d')],'sectionId':_0x390b83['id']},{})[_0x39f4('0x26')](function(){return _0xb831c8;});}else{return _0xb831c8;}})[_0x39f4('0x45')](function(_0x1916c1){logger[_0x39f4('0x2b')](_0x39f4('0x59'),_0x1916c1);throw _0x1916c1;});}return _0xb831c8;})[_0x39f4('0x26')](respondWithResult(_0x4fee1b,0xc9))[_0x39f4('0x45')](handleError(_0x4fee1b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 235e8e4..1e3266a 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 _0xf44f=['define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x5c2e64,_0x4f9d84){var _0x1ed606=function(_0x1e478b){while(--_0x1e478b){_0x5c2e64['push'](_0x5c2e64['shift']());}};_0x1ed606(++_0x4f9d84);}(_0xf44f,0x138));var _0xff44=function(_0x11dfc1,_0x20d24b){_0x11dfc1=_0x11dfc1-0x0;var _0x2f056e=_0xf44f[_0x11dfc1];return _0x2f056e;};'use strict';var _=require(_0xff44('0x0'));var util=require(_0xff44('0x1'));var logger=require(_0xff44('0x2'))(_0xff44('0x3'));var moment=require(_0xff44('0x4'));var BPromise=require(_0xff44('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff44('0x6'));var rimraf=require(_0xff44('0x7'));var config=require(_0xff44('0x8'));var attributes=require(_0xff44('0x9'));module['exports']=function(_0x20411d,_0x19ef4d){return _0x20411d[_0xff44('0xa')]('CannedAnswer',attributes,{'tableName':_0xff44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff44('0xc'),'collate':_0xff44('0xd')});}; \ No newline at end of file +var _0x2c31=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c31,0xee));var _0x12c3=function(_0x7a8884,_0x3bf33c){_0x7a8884=_0x7a8884-0x0;var _0xe75372=_0x2c31[_0x7a8884];return _0xe75372;};'use strict';var _=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var logger=require(_0x12c3('0x2'))(_0x12c3('0x3'));var moment=require(_0x12c3('0x4'));var BPromise=require(_0x12c3('0x5'));var rp=require(_0x12c3('0x6'));var fs=require('fs');var path=require(_0x12c3('0x7'));var rimraf=require('rimraf');var config=require(_0x12c3('0x8'));var attributes=require(_0x12c3('0x9'));module['exports']=function(_0x25585c,_0x173947){return _0x25585c[_0x12c3('0xa')]('CannedAnswer',attributes,{'tableName':_0x12c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12c3('0xc'),'collate':_0x12c3('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 82d87e9..59f0d24 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(_0x21f4b4,_0x236672){var _0x4f945c=function(_0xe3676a){while(--_0xe3676a){_0x21f4b4['push'](_0x21f4b4['shift']());}};_0x4f945c(++_0x236672);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x1cdc9b,_0x4dcceb){var _0x30333f=function(_0x51a802){while(--_0x51a802){_0x1cdc9b['push'](_0x1cdc9b['shift']());}};_0x30333f(++_0x4dcceb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 94e3dc8..295f8e8 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 _0x304f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x346044,_0x522b93){var _0x2d8d01=function(_0x436ed0){while(--_0x436ed0){_0x346044['push'](_0x346044['shift']());}};_0x2d8d01(++_0x522b93);}(_0x304f,0x177));var _0xf304=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x304f[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xf304('0x0'));var util=require(_0xf304('0x1'));var path=require('path');var timeout=require(_0xf304('0x2'));var express=require(_0xf304('0x3'));var router=express[_0xf304('0x4')]();var fs_extra=require(_0xf304('0x5'));var auth=require(_0xf304('0x6'));var interaction=require(_0xf304('0x7'));var config=require(_0xf304('0x8'));var controller=require(_0xf304('0x9'));router[_0xf304('0xa')]('/',auth[_0xf304('0xb')](),controller['index']);router['get'](_0xf304('0xc'),auth[_0xf304('0xb')](),controller[_0xf304('0xd')]);router['post']('/',auth[_0xf304('0xb')](),controller[_0xf304('0xe')]);router[_0xf304('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf304('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf304('0x11')]);module[_0xf304('0x12')]=router; \ No newline at end of file +var _0xb125=['put','update','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x396152,_0x25d180){var _0x2db4ea=function(_0x2839b3){while(--_0x2839b3){_0x396152['push'](_0x396152['shift']());}};_0x2db4ea(++_0x25d180);}(_0xb125,0xd5));var _0x5b12=function(_0x42e722,_0x5c0998){_0x42e722=_0x42e722-0x0;var _0x5efcd9=_0xb125[_0x42e722];return _0x5efcd9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5b12('0x0'));var timeout=require(_0x5b12('0x1'));var express=require(_0x5b12('0x2'));var router=express[_0x5b12('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b12('0x4'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x5b12('0x5')]('/',auth[_0x5b12('0x6')](),controller[_0x5b12('0x7')]);router[_0x5b12('0x5')](_0x5b12('0x8'),auth[_0x5b12('0x6')](),controller[_0x5b12('0x9')]);router[_0x5b12('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b12('0xb')]);router[_0x5b12('0xc')](_0x5b12('0x8'),auth[_0x5b12('0x6')](),controller[_0x5b12('0xd')]);router['delete'](_0x5b12('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b12('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 42348a5..e20c851 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 _0x7008=['DATE','STRING','INTEGER'];(function(_0x3c5432,_0x4e13dc){var _0x20c67d=function(_0xd828fd){while(--_0xd828fd){_0x3c5432['push'](_0x3c5432['shift']());}};_0x20c67d(++_0x4e13dc);}(_0x7008,0x1ec));var _0x8700=function(_0x3e06bd,_0x421610){_0x3e06bd=_0x3e06bd-0x0;var _0x1f7f2b=_0x7008[_0x3e06bd];return _0x1f7f2b;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x8700('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8700('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8700('0x1')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8700('0x1')]},'dstchannel':{'type':Sequelize[_0x8700('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8700('0x1')]},'duration':{'type':Sequelize[_0x8700('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8700('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8700('0x1')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8700('0x1')]},'userfield':{'type':Sequelize[_0x8700('0x1')]},'uniqueid':{'type':Sequelize[_0x8700('0x1')]},'linkedid':{'type':Sequelize[_0x8700('0x1')]},'sequence':{'type':Sequelize[_0x8700('0x1')]},'peeraccount':{'type':Sequelize[_0x8700('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4065=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4065,0xdc));var _0x5406=function(_0x5f2772,_0x373a47){_0x5f2772=_0x5f2772-0x0;var _0xc83e16=_0x4065[_0x5f2772];return _0xc83e16;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x5406('0x0')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5406('0x1')]},'dst':{'type':Sequelize[_0x5406('0x1')]},'dcontext':{'type':Sequelize[_0x5406('0x1')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x5406('0x1')]},'lastapp':{'type':Sequelize[_0x5406('0x1')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5406('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5406('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5406('0x1')]},'amaflags':{'type':Sequelize[_0x5406('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5406('0x1')]},'userfield':{'type':Sequelize[_0x5406('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5406('0x1')]},'sequence':{'type':Sequelize[_0x5406('0x1')]},'peeraccount':{'type':Sequelize[_0x5406('0x1')]},'type':{'type':Sequelize[_0x5406('0x1')]},'tag':{'type':Sequelize[_0x5406('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a8f6f21..0b2aa63 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 _0x3c17=['apply','reject','save','update','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','then','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json'];(function(_0x5f57b1,_0x546449){var _0xf31a3=function(_0x3acd0c){while(--_0x3acd0c){_0x5f57b1['push'](_0x5f57b1['shift']());}};_0xf31a3(++_0x546449);}(_0x3c17,0x1a1));var _0x73c1=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3c17[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x73c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c1('0x2'));var moment=require(_0x73c1('0x3'));var BPromise=require(_0x73c1('0x4'));var Mustache=require('mustache');var util=require(_0x73c1('0x5'));var path=require(_0x73c1('0x6'));var sox=require(_0x73c1('0x7'));var csv=require(_0x73c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73c1('0x9'));var _=require('lodash');var squel=require(_0x73c1('0xa'));var crypto=require(_0x73c1('0xb'));var jsforce=require(_0x73c1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x73c1('0xd'));var Papa=require(_0x73c1('0xe'));var Redis=require(_0x73c1('0xf'));var authService=require(_0x73c1('0x10'));var qs=require(_0x73c1('0x11'));var as=require(_0x73c1('0x12'));var hardwareService=require(_0x73c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x73c1('0x14'));var config=require(_0x73c1('0x15'));var licenseUtil=require(_0x73c1('0x16'));var db=require(_0x73c1('0x17'))['db'];function respondWithStatusCode(_0x592a6a,_0x2b77bc){_0x2b77bc=_0x2b77bc||0xcc;return function(_0x5e6b55){if(_0x5e6b55){return _0x592a6a[_0x73c1('0x18')](_0x2b77bc);}return _0x592a6a['status'](_0x2b77bc)[_0x73c1('0x19')]();};}function respondWithResult(_0x3ecf5a,_0x57cb11){_0x57cb11=_0x57cb11||0xc8;return function(_0x537965){if(_0x537965){return _0x3ecf5a[_0x73c1('0x1a')](_0x57cb11)['json'](_0x537965);}};}function respondWithFilteredResult(_0x72a36,_0x52d0ff){return function(_0xe5d5c8){if(_0xe5d5c8){var _0x47d81e=typeof _0x52d0ff[_0x73c1('0x1b')]===_0x73c1('0x1c')&&typeof _0x52d0ff[_0x73c1('0x1d')]===_0x73c1('0x1c');var _0x8c0803=_0xe5d5c8[_0x73c1('0x1e')];var _0x16deb6=_0x47d81e?0x0:_0x52d0ff[_0x73c1('0x1b')];var _0x1ce19e=_0x47d81e?_0xe5d5c8['count']:_0x52d0ff[_0x73c1('0x1b')]+_0x52d0ff[_0x73c1('0x1d')];var _0x28df60;if(_0x1ce19e>=_0x8c0803){_0x1ce19e=_0x8c0803;_0x28df60=0xc8;}else{_0x28df60=0xce;}_0x72a36[_0x73c1('0x1a')](_0x28df60);return _0x72a36['set'](_0x73c1('0x1f'),_0x16deb6+'-'+_0x1ce19e+'/'+_0x8c0803)[_0x73c1('0x20')](_0xe5d5c8);}return null;};}function patchUpdates(_0x344fb5){return function(_0x2e17e5){try{jsonpatch[_0x73c1('0x21')](_0x2e17e5,_0x344fb5,!![]);}catch(_0x2aa7df){return BPromise[_0x73c1('0x22')](_0x2aa7df);}return _0x2e17e5[_0x73c1('0x23')]();};}function saveUpdates(_0x49b817,_0x2eba51){return function(_0x32b379){if(_0x32b379){return _0x32b379[_0x73c1('0x24')](_0x49b817)['then'](function(_0x10254c){return _0x10254c;});}return null;};}function removeEntity(_0x2ebfda,_0x1125ff){return function(_0x3abaab){if(_0x3abaab){return _0x3abaab[_0x73c1('0x25')]()['then'](function(){_0x2ebfda[_0x73c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54feeb,_0x2301b7){return function(_0x1c567d){if(!_0x1c567d){_0x54feeb[_0x73c1('0x18')](0x194);}return _0x1c567d;};}function handleError(_0x1c54aa,_0x123cc0){_0x123cc0=_0x123cc0||0x1f4;return function(_0x30ec73){logger[_0x73c1('0x26')](_0x30ec73[_0x73c1('0x27')]);if(_0x30ec73[_0x73c1('0x28')]){delete _0x30ec73[_0x73c1('0x28')];}_0x1c54aa[_0x73c1('0x1a')](_0x123cc0)[_0x73c1('0x29')](_0x30ec73);};}exports[_0x73c1('0x2a')]=function(_0x240137,_0x5bf2b1){var _0x2b2996={},_0x9050fd={},_0x33b5bc={'count':0x0,'rows':[]};var _0x153141=_[_0x73c1('0x2b')](db[_0x73c1('0x2c')][_0x73c1('0x2d')],function(_0x45c411){return{'name':_0x45c411[_0x73c1('0x2e')],'type':_0x45c411['type']['key']};});_0x9050fd[_0x73c1('0x2f')]=_[_0x73c1('0x2b')](_0x153141,_0x73c1('0x28'));_0x9050fd[_0x73c1('0x30')]=_['keys'](_0x240137[_0x73c1('0x30')]);_0x9050fd[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x9050fd['model'],_0x9050fd[_0x73c1('0x30')]);_0x2b2996[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x9050fd[_0x73c1('0x2f')],qs[_0x73c1('0x34')](_0x240137[_0x73c1('0x30')]['fields']));_0x2b2996[_0x73c1('0x33')]=_0x2b2996[_0x73c1('0x33')][_0x73c1('0x35')]?_0x2b2996[_0x73c1('0x33')]:_0x9050fd[_0x73c1('0x2f')];if(!_0x240137[_0x73c1('0x30')][_0x73c1('0x36')](_0x73c1('0x37'))){_0x2b2996[_0x73c1('0x1d')]=qs[_0x73c1('0x1d')](_0x240137['query'][_0x73c1('0x1d')]);_0x2b2996['offset']=qs[_0x73c1('0x1b')](_0x240137[_0x73c1('0x30')][_0x73c1('0x1b')]);}_0x2b2996[_0x73c1('0x38')]=qs['sort'](_0x240137['query']['sort']);_0x2b2996[_0x73c1('0x39')]=qs['filters'](_[_0x73c1('0x3a')](_0x240137[_0x73c1('0x30')],_0x9050fd[_0x73c1('0x31')]),_0x153141);if(_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]){_0x2b2996[_0x73c1('0x39')]=_[_0x73c1('0x3c')](_0x2b2996[_0x73c1('0x39')],{'$or':_[_0x73c1('0x2b')](_0x153141,function(_0x304c2b){if(_0x304c2b[_0x73c1('0x3d')]!=='VIRTUAL'){var _0x2bb535={};_0x2bb535[_0x304c2b[_0x73c1('0x28')]]={'$like':'%'+_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]+'%'};return _0x2bb535;}})});}_0x2b2996=_[_0x73c1('0x3c')]({},_0x2b2996,_0x240137[_0x73c1('0x3e')]);var _0x5a8c11={'where':_0x2b2996[_0x73c1('0x39')]};return db[_0x73c1('0x2c')][_0x73c1('0x1e')](_0x5a8c11)[_0x73c1('0x3f')](function(_0x21feb9){_0x33b5bc[_0x73c1('0x1e')]=_0x21feb9;if(_0x240137['query'][_0x73c1('0x40')]){_0x2b2996['include']=[{'all':!![]}];}return db[_0x73c1('0x2c')][_0x73c1('0x41')](_0x2b2996);})['then'](function(_0x57d843){_0x33b5bc[_0x73c1('0x42')]=_0x57d843;return _0x33b5bc;})[_0x73c1('0x3f')](respondWithFilteredResult(_0x5bf2b1,_0x2b2996))[_0x73c1('0x43')](handleError(_0x5bf2b1,null));};exports[_0x73c1('0x44')]=function(_0x689ca5,_0x282b73){var _0x515a52={'raw':!![],'where':{'id':_0x689ca5[_0x73c1('0x45')]['id']}},_0x5c70b9={};_0x5c70b9[_0x73c1('0x2f')]=_['keys'](db['Cdr'][_0x73c1('0x2d')]);_0x5c70b9['query']=_[_0x73c1('0x46')](_0x689ca5[_0x73c1('0x30')]);_0x5c70b9[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x5c70b9[_0x73c1('0x2f')],_0x5c70b9[_0x73c1('0x30')]);_0x515a52[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x5c70b9['model'],qs['fields'](_0x689ca5[_0x73c1('0x30')][_0x73c1('0x34')]));_0x515a52[_0x73c1('0x33')]=_0x515a52['attributes'][_0x73c1('0x35')]?_0x515a52[_0x73c1('0x33')]:_0x5c70b9[_0x73c1('0x2f')];if(_0x689ca5[_0x73c1('0x30')][_0x73c1('0x40')]){_0x515a52[_0x73c1('0x47')]=[{'all':!![]}];}_0x515a52=_[_0x73c1('0x3c')]({},_0x515a52,_0x689ca5[_0x73c1('0x3e')]);return db[_0x73c1('0x2c')][_0x73c1('0x48')](_0x515a52)[_0x73c1('0x3f')](handleEntityNotFound(_0x282b73,null))[_0x73c1('0x3f')](respondWithResult(_0x282b73,null))['catch'](handleError(_0x282b73,null));};exports[_0x73c1('0x49')]=function(_0x512295,_0x1a681c){return db[_0x73c1('0x2c')][_0x73c1('0x49')](_0x512295[_0x73c1('0x4a')],{})[_0x73c1('0x3f')](respondWithResult(_0x1a681c,0xc9))[_0x73c1('0x43')](handleError(_0x1a681c,null));};exports['update']=function(_0x34093c,_0x2ccd11){if(_0x34093c[_0x73c1('0x4a')]['id']){delete _0x34093c['body']['id'];}return db[_0x73c1('0x2c')][_0x73c1('0x48')]({'where':{'id':_0x34093c[_0x73c1('0x45')]['id']}})[_0x73c1('0x3f')](handleEntityNotFound(_0x2ccd11,null))[_0x73c1('0x3f')](saveUpdates(_0x34093c[_0x73c1('0x4a')],null))[_0x73c1('0x3f')](respondWithResult(_0x2ccd11,null))[_0x73c1('0x43')](handleError(_0x2ccd11,null));};exports[_0x73c1('0x25')]=function(_0x53d491,_0x3291db){return db['Cdr']['find']({'where':{'id':_0x53d491['params']['id']}})['then'](handleEntityNotFound(_0x3291db,null))['then'](removeEntity(_0x3291db,null))[_0x73c1('0x43')](handleError(_0x3291db,null));};exports['describe']=function(_0x3c31e8,_0x47e3ca){return db['Cdr']['describe']()[_0x73c1('0x3f')](respondWithResult(_0x47e3ca,null))['catch'](handleError(_0x47e3ca,null));}; \ No newline at end of file +var _0x1cb9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','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','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr'];(function(_0x100987,_0x25a1bd){var _0x2c982e=function(_0x1c5fdc){while(--_0x1c5fdc){_0x100987['push'](_0x100987['shift']());}};_0x2c982e(++_0x25a1bd);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3ab30d,_0x4da38f){_0x3ab30d=_0x3ab30d-0x0;var _0xdd820b=_0x1cb9[_0x3ab30d];return _0xdd820b;};'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'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29'));_0x504275[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x3b3ee6[_0x91cb('0x33')]);_0x504275['filters']=_[_0x91cb('0x35')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x33')]);_0x468908[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x504275['model'],qs[_0x91cb('0x37')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x37')]));_0x468908[_0x91cb('0x36')]=_0x468908[_0x91cb('0x36')]['length']?_0x468908[_0x91cb('0x36')]:_0x504275['model'];if(!_0x3b3ee6['query']['hasOwnProperty'](_0x91cb('0x38'))){_0x468908['limit']=qs[_0x91cb('0x1d')](_0x3b3ee6['query']['limit']);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x1f')]);}_0x468908[_0x91cb('0x39')]=qs['sort'](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3a')]);_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_['pick'](_0x3b3ee6['query'],_0x504275[_0x91cb('0x3c')]),_0x52670a);if(_0x3b3ee6[_0x91cb('0x33')]['filter']){_0x468908[_0x91cb('0x3b')]=_[_0x91cb('0x3d')](_0x468908['where'],{'$or':_[_0x91cb('0x2c')](_0x52670a,function(_0xddc409){if(_0xddc409['type']!==_0x91cb('0x3e')){var _0x545687={};_0x545687[_0xddc409[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3f')]+'%'};return _0x545687;}})});}_0x468908=_[_0x91cb('0x3d')]({},_0x468908,_0x3b3ee6[_0x91cb('0x40')]);var _0x20bf50={'where':_0x468908['where']};return db[_0x91cb('0x2d')][_0x91cb('0x1e')](_0x20bf50)['then'](function(_0x312581){_0x2f04a3['count']=_0x312581;if(_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x41')]){_0x468908[_0x91cb('0x42')]=[{'all':!![]}];}return db[_0x91cb('0x2d')]['findAll'](_0x468908);})[_0x91cb('0x25')](function(_0x5af0e6){_0x2f04a3[_0x91cb('0x43')]=_0x5af0e6;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x44')](handleError(_0x2fb473,null));};exports[_0x91cb('0x45')]=function(_0x451463,_0x111cc0){var _0x325dca={'raw':!![],'where':{'id':_0x451463['params']['id']}},_0x3cc4c1={};_0x3cc4c1[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x3cc4c1[_0x91cb('0x33')]=_['keys'](_0x451463[_0x91cb('0x33')]);_0x3cc4c1[_0x91cb('0x3c')]=_[_0x91cb('0x35')](_0x3cc4c1[_0x91cb('0x32')],_0x3cc4c1['query']);_0x325dca[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x3cc4c1['model'],qs[_0x91cb('0x37')](_0x451463[_0x91cb('0x33')][_0x91cb('0x37')]));_0x325dca[_0x91cb('0x36')]=_0x325dca[_0x91cb('0x36')][_0x91cb('0x46')]?_0x325dca[_0x91cb('0x36')]:_0x3cc4c1[_0x91cb('0x32')];if(_0x451463[_0x91cb('0x33')]['includeAll']){_0x325dca[_0x91cb('0x42')]=[{'all':!![]}];}_0x325dca=_[_0x91cb('0x3d')]({},_0x325dca,_0x451463[_0x91cb('0x40')]);return db[_0x91cb('0x2d')][_0x91cb('0x47')](_0x325dca)[_0x91cb('0x25')](handleEntityNotFound(_0x111cc0,null))[_0x91cb('0x25')](respondWithResult(_0x111cc0,null))[_0x91cb('0x44')](handleError(_0x111cc0,null));};exports['create']=function(_0x348d78,_0x46caf1){return db[_0x91cb('0x2d')][_0x91cb('0x48')](_0x348d78['body'],{})[_0x91cb('0x25')](respondWithResult(_0x46caf1,0xc9))[_0x91cb('0x44')](handleError(_0x46caf1,null));};exports['update']=function(_0x212473,_0x47cdb7){if(_0x212473[_0x91cb('0x49')]['id']){delete _0x212473['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x212473[_0x91cb('0x4a')]['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0x25')](saveUpdates(_0x212473[_0x91cb('0x49')],null))[_0x91cb('0x25')](respondWithResult(_0x47cdb7,null))['catch'](handleError(_0x47cdb7,null));};exports['destroy']=function(_0x1d26b8,_0xfe6692){return db[_0x91cb('0x2d')][_0x91cb('0x47')]({'where':{'id':_0x1d26b8['params']['id']}})['then'](handleEntityNotFound(_0xfe6692,null))['then'](removeEntity(_0xfe6692,null))[_0x91cb('0x44')](handleError(_0xfe6692,null));};exports['describe']=function(_0x3f22a1,_0x4aa670){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]()[_0x91cb('0x25')](respondWithResult(_0x4aa670,null))[_0x91cb('0x44')](handleError(_0x4aa670,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8452ca4..fdf1730 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x52a750,_0x7f9968){var _0x56eeab=function(_0x27fe53){while(--_0x27fe53){_0x52a750['push'](_0x52a750['shift']());}};_0x56eeab(++_0x7f9968);}(_0x7a54,0x106));var _0x47a5=function(_0x3c6425,_0xb0376c){_0x3c6425=_0x3c6425-0x0;var _0x37931b=_0x7a54[_0x3c6425];return _0x37931b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xf03956,_0x3a3e8e){var _0x43d7f1=function(_0x180c71){while(--_0x180c71){_0xf03956['push'](_0xf03956['shift']());}};_0x43d7f1(++_0x3a3e8e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 9d1c53b..5f490ff 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 _0x7a53=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info'];(function(_0x9a88cc,_0x44328f){var _0x5e9985=function(_0x1f9250){while(--_0x1f9250){_0x9a88cc['push'](_0x9a88cc['shift']());}};_0x5e9985(++_0x44328f);}(_0x7a53,0xa1));var _0x37a5=function(_0x5696f0,_0x4c5bf7){_0x5696f0=_0x5696f0-0x0;var _0x2b4584=_0x7a53[_0x5696f0];return _0x2b4584;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37a5('0x0'));var BPromise=require(_0x37a5('0x1'));var rs=require(_0x37a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37a5('0x3'))['db'];var utils=require(_0x37a5('0x4'));var logger=require(_0x37a5('0x5'))(_0x37a5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a232e,_0x49f520,_0x12d678){return new BPromise(function(_0x330cef,_0x5513b1){return client[_0x37a5('0x7')](_0x3a232e,_0x12d678)[_0x37a5('0x8')](function(_0x2543f2){logger[_0x37a5('0x9')](_0x37a5('0xa'),_0x49f520,_0x37a5('0xb'));logger[_0x37a5('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x49f520,_0x37a5('0xb'),JSON[_0x37a5('0xd')](_0x2543f2));if(_0x2543f2['error']){if(_0x2543f2[_0x37a5('0xe')][_0x37a5('0xf')]===0x1f4){logger[_0x37a5('0xe')](_0x37a5('0xa'),_0x49f520,_0x2543f2[_0x37a5('0xe')][_0x37a5('0x10')]);return _0x5513b1(_0x2543f2[_0x37a5('0xe')][_0x37a5('0x10')]);}logger[_0x37a5('0xe')](_0x37a5('0xa'),_0x49f520,_0x2543f2[_0x37a5('0xe')][_0x37a5('0x10')]);return _0x330cef(_0x2543f2[_0x37a5('0xe')][_0x37a5('0x10')]);}else{logger['info'](_0x37a5('0xa'),_0x49f520,_0x37a5('0xb'));_0x330cef(_0x2543f2[_0x37a5('0x11')][_0x37a5('0x10')]);}})[_0x37a5('0x12')](function(_0x55490d){logger[_0x37a5('0xe')]('Cdr,\x20%s,\x20%s',_0x49f520,_0x55490d);_0x5513b1(_0x55490d);});});} \ No newline at end of file +var _0x1ec0=['error','Cdr,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3e1fd,_0x23c726){var _0x1d7c98=function(_0x106d5f){while(--_0x106d5f){_0x3e1fd['push'](_0x3e1fd['shift']());}};_0x1d7c98(++_0x23c726);}(_0x1ec0,0x11b));var _0x01ec=function(_0x7ec229,_0x45291f){_0x7ec229=_0x7ec229-0x0;var _0x332ac1=_0x1ec0[_0x7ec229];return _0x332ac1;};'use strict';var _=require(_0x01ec('0x0'));var util=require('util');var moment=require(_0x01ec('0x1'));var BPromise=require(_0x01ec('0x2'));var rs=require(_0x01ec('0x3'));var fs=require('fs');var Redis=require(_0x01ec('0x4'));var db=require(_0x01ec('0x5'))['db'];var utils=require(_0x01ec('0x6'));var logger=require('../../config/logger')(_0x01ec('0x7'));var config=require(_0x01ec('0x8'));var jayson=require(_0x01ec('0x9'));var client=jayson['client'][_0x01ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494686,_0x5373a4,_0x3b7ee3){return new BPromise(function(_0x42da39,_0x237cae){return client[_0x01ec('0xb')](_0x494686,_0x3b7ee3)[_0x01ec('0xc')](function(_0x398b68){logger[_0x01ec('0xd')]('Cdr,\x20%s,\x20%s',_0x5373a4,'request\x20sent');logger['debug'](_0x01ec('0xe'),_0x5373a4,_0x01ec('0xf'),JSON[_0x01ec('0x10')](_0x398b68));if(_0x398b68[_0x01ec('0x11')]){if(_0x398b68['error']['code']===0x1f4){logger[_0x01ec('0x11')](_0x01ec('0x12'),_0x5373a4,_0x398b68['error']['message']);return _0x237cae(_0x398b68[_0x01ec('0x11')][_0x01ec('0x13')]);}logger[_0x01ec('0x11')](_0x01ec('0x12'),_0x5373a4,_0x398b68[_0x01ec('0x11')][_0x01ec('0x13')]);return _0x42da39(_0x398b68[_0x01ec('0x11')][_0x01ec('0x13')]);}else{logger[_0x01ec('0xd')](_0x01ec('0x12'),_0x5373a4,_0x01ec('0xf'));_0x42da39(_0x398b68['result'][_0x01ec('0x13')]);}})['catch'](function(_0x29ad5f){logger['error'](_0x01ec('0x12'),_0x5373a4,_0x29ad5f);_0x237cae(_0x29ad5f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index affd1c5..a6abebe 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(_0x5ed7af,_0x422676){var _0x29a495=function(_0x4dd4b6){while(--_0x4dd4b6){_0x5ed7af['push'](_0x5ed7af['shift']());}};_0x29a495(++_0x422676);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1933196..fe56a9d 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 _0xde69=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x422d6a,_0x20d24f){var _0x3bff4b=function(_0x3789a8){while(--_0x3789a8){_0x422d6a['push'](_0x422d6a['shift']());}};_0x3bff4b(++_0x20d24f);}(_0xde69,0xab));var _0x9de6=function(_0x2a0765,_0x3ae964){_0x2a0765=_0x2a0765-0x0;var _0x547461=_0xde69[_0x2a0765];return _0x547461;};'use strict';var Sequelize=require(_0x9de6('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9de6('0x1')],'allowNull':![],'defaultValue':_0x9de6('0x2')},'appdata':{'type':Sequelize[_0x9de6('0x3')]()},'description':{'type':Sequelize[_0x9de6('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9de6('0x4')}}; \ No newline at end of file +var _0xd460=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3d43f1,_0x44fed2){var _0x587dba=function(_0x16788a){while(--_0x16788a){_0x3d43f1['push'](_0x3d43f1['shift']());}};_0x587dba(++_0x44fed2);}(_0xd460,0x79));var _0x0d46=function(_0x5304c0,_0x240d71){_0x5304c0=_0x5304c0-0x0;var _0x11d983=_0xd460[_0x5304c0];return _0x11d983;};'use strict';var Sequelize=require(_0x0d46('0x0'));module[_0x0d46('0x1')]={'priority':{'type':Sequelize[_0x0d46('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d46('0x3')],'allowNull':![],'defaultValue':_0x0d46('0x4')},'appdata':{'type':Sequelize[_0x0d46('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0d46('0x3')],'defaultValue':_0x0d46('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fc6ace6..babdb06 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 _0x1bd1=['then','destroy','name','send','show','params','keys','ChatApplication','query','filters','intersection','model','attributes','fields','length','include','merge','find','update','body','catch','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject'];(function(_0x244cfb,_0x23385d){var _0x477a8b=function(_0x1f3902){while(--_0x1f3902){_0x244cfb['push'](_0x244cfb['shift']());}};_0x477a8b(++_0x23385d);}(_0x1bd1,0x123));var _0x11bd=function(_0x26f657,_0x418743){_0x26f657=_0x26f657-0x0;var _0x1cca33=_0x1bd1[_0x26f657];return _0x1cca33;};'use strict';var emlformat=require(_0x11bd('0x0'));var rimraf=require(_0x11bd('0x1'));var zipdir=require(_0x11bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x11bd('0x4'));var sox=require(_0x11bd('0x5'));var csv=require(_0x11bd('0x6'));var ejs=require(_0x11bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11bd('0x8'));var squel=require(_0x11bd('0x9'));var crypto=require(_0x11bd('0xa'));var jsforce=require(_0x11bd('0xb'));var deskjs=require(_0x11bd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x11bd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x11bd('0xe'));var qs=require(_0x11bd('0xf'));var as=require(_0x11bd('0x10'));var hardwareService=require(_0x11bd('0x11'));var logger=require(_0x11bd('0x12'))(_0x11bd('0x13'));var utils=require(_0x11bd('0x14'));var config=require(_0x11bd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x11bd('0x16'))['db'];function respondWithStatusCode(_0x1afe14,_0x2ceee2){_0x2ceee2=_0x2ceee2||0xcc;return function(_0x39b6b9){if(_0x39b6b9){return _0x1afe14[_0x11bd('0x17')](_0x2ceee2);}return _0x1afe14[_0x11bd('0x18')](_0x2ceee2)[_0x11bd('0x19')]();};}function respondWithResult(_0x4d6ebe,_0x5e4cc4){_0x5e4cc4=_0x5e4cc4||0xc8;return function(_0x1c832b){if(_0x1c832b){return _0x4d6ebe[_0x11bd('0x18')](_0x5e4cc4)[_0x11bd('0x1a')](_0x1c832b);}};}function respondWithFilteredResult(_0x5ca6bb,_0x384144){return function(_0x5b78cc){if(_0x5b78cc){var _0x59978e=typeof _0x384144[_0x11bd('0x1b')]===_0x11bd('0x1c')&&typeof _0x384144[_0x11bd('0x1d')]===_0x11bd('0x1c');var _0xd04657=_0x5b78cc['count'];var _0x904980=_0x59978e?0x0:_0x384144[_0x11bd('0x1b')];var _0x39de22=_0x59978e?_0x5b78cc[_0x11bd('0x1e')]:_0x384144[_0x11bd('0x1b')]+_0x384144[_0x11bd('0x1d')];var _0xd2ca8a;if(_0x39de22>=_0xd04657){_0x39de22=_0xd04657;_0xd2ca8a=0xc8;}else{_0xd2ca8a=0xce;}_0x5ca6bb[_0x11bd('0x18')](_0xd2ca8a);return _0x5ca6bb['set']('Content-Range',_0x904980+'-'+_0x39de22+'/'+_0xd04657)[_0x11bd('0x1a')](_0x5b78cc);}return null;};}function patchUpdates(_0x232811){return function(_0x19176e){try{jsonpatch[_0x11bd('0x1f')](_0x19176e,_0x232811,!![]);}catch(_0x5d0f2b){return BPromise[_0x11bd('0x20')](_0x5d0f2b);}return _0x19176e['save']();};}function saveUpdates(_0x232f11,_0x104357){return function(_0x1d7984){if(_0x1d7984){return _0x1d7984['update'](_0x232f11)[_0x11bd('0x21')](function(_0x40c7d2){return _0x40c7d2;});}return null;};}function removeEntity(_0x1c0522,_0x27c98c){return function(_0x3343da){if(_0x3343da){return _0x3343da[_0x11bd('0x22')]()[_0x11bd('0x21')](function(){_0x1c0522[_0x11bd('0x18')](0xcc)[_0x11bd('0x19')]();});}};}function handleEntityNotFound(_0x39fbf9,_0x344826){return function(_0x3c6dab){if(!_0x3c6dab){_0x39fbf9['sendStatus'](0x194);}return _0x3c6dab;};}function handleError(_0x255365,_0xfbe811){_0xfbe811=_0xfbe811||0x1f4;return function(_0xa08420){logger['error'](_0xa08420['stack']);if(_0xa08420['name']){delete _0xa08420[_0x11bd('0x23')];}_0x255365[_0x11bd('0x18')](_0xfbe811)[_0x11bd('0x24')](_0xa08420);};}exports[_0x11bd('0x25')]=function(_0x39c2e3,_0x4312b3){var _0x3cc87b={'raw':!![],'where':{'id':_0x39c2e3[_0x11bd('0x26')]['id']}},_0x599f40={};_0x599f40['model']=_[_0x11bd('0x27')](db[_0x11bd('0x28')]['rawAttributes']);_0x599f40[_0x11bd('0x29')]=_[_0x11bd('0x27')](_0x39c2e3[_0x11bd('0x29')]);_0x599f40[_0x11bd('0x2a')]=_[_0x11bd('0x2b')](_0x599f40[_0x11bd('0x2c')],_0x599f40[_0x11bd('0x29')]);_0x3cc87b[_0x11bd('0x2d')]=_['intersection'](_0x599f40[_0x11bd('0x2c')],qs[_0x11bd('0x2e')](_0x39c2e3[_0x11bd('0x29')][_0x11bd('0x2e')]));_0x3cc87b[_0x11bd('0x2d')]=_0x3cc87b[_0x11bd('0x2d')][_0x11bd('0x2f')]?_0x3cc87b[_0x11bd('0x2d')]:_0x599f40[_0x11bd('0x2c')];if(_0x39c2e3[_0x11bd('0x29')]['includeAll']){_0x3cc87b[_0x11bd('0x30')]=[{'all':!![]}];}_0x3cc87b=_[_0x11bd('0x31')]({},_0x3cc87b,_0x39c2e3['options']);return db[_0x11bd('0x28')][_0x11bd('0x32')](_0x3cc87b)[_0x11bd('0x21')](handleEntityNotFound(_0x4312b3,null))[_0x11bd('0x21')](respondWithResult(_0x4312b3,null))['catch'](handleError(_0x4312b3,null));};exports[_0x11bd('0x33')]=function(_0x485915,_0x3dc82f){if(_0x485915[_0x11bd('0x34')]['id']){delete _0x485915[_0x11bd('0x34')]['id'];}return db[_0x11bd('0x28')][_0x11bd('0x32')]({'where':{'id':_0x485915[_0x11bd('0x26')]['id']}})[_0x11bd('0x21')](handleEntityNotFound(_0x3dc82f,null))[_0x11bd('0x21')](saveUpdates(_0x485915[_0x11bd('0x34')],null))[_0x11bd('0x21')](respondWithResult(_0x3dc82f,null))[_0x11bd('0x35')](handleError(_0x3dc82f,null));};exports[_0x11bd('0x22')]=function(_0x12c1f4,_0x234a4b){return db['ChatApplication']['find']({'where':{'id':_0x12c1f4['params']['id']}})[_0x11bd('0x21')](handleEntityNotFound(_0x234a4b,null))[_0x11bd('0x21')](removeEntity(_0x234a4b,null))['catch'](handleError(_0x234a4b,null));}; \ No newline at end of file +var _0xfecd=['undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xfecd,0x107));var _0xdfec=function(_0x559378,_0x3ae562){_0x559378=_0x559378-0x0;var _0x34eab2=_0xfecd[_0x559378];return _0x34eab2;};'use strict';var emlformat=require(_0xdfec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfec('0x1'));var jsonpatch=require(_0xdfec('0x2'));var rp=require('request-promise');var moment=require(_0xdfec('0x3'));var BPromise=require(_0xdfec('0x4'));var Mustache=require('mustache');var util=require(_0xdfec('0x5'));var path=require('path');var sox=require(_0xdfec('0x6'));var csv=require(_0xdfec('0x7'));var ejs=require(_0xdfec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfec('0x9'));var squel=require(_0xdfec('0xa'));var crypto=require(_0xdfec('0xb'));var jsforce=require(_0xdfec('0xc'));var deskjs=require(_0xdfec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfec('0xe'));var Papa=require(_0xdfec('0xf'));var Redis=require(_0xdfec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdfec('0x11'));var hardwareService=require(_0xdfec('0x12'));var logger=require('../../config/logger')(_0xdfec('0x13'));var utils=require(_0xdfec('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdfec('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21371b,_0x367a3c){_0x367a3c=_0x367a3c||0xcc;return function(_0x2384f5){if(_0x2384f5){return _0x21371b[_0xdfec('0x16')](_0x367a3c);}return _0x21371b[_0xdfec('0x17')](_0x367a3c)[_0xdfec('0x18')]();};}function respondWithResult(_0x28ef24,_0x2ccc89){_0x2ccc89=_0x2ccc89||0xc8;return function(_0x4d7c6e){if(_0x4d7c6e){return _0x28ef24[_0xdfec('0x17')](_0x2ccc89)[_0xdfec('0x19')](_0x4d7c6e);}};}function respondWithFilteredResult(_0x493d12,_0x420e3b){return function(_0x53ef23){if(_0x53ef23){var _0x2fbbbb=typeof _0x420e3b[_0xdfec('0x1a')]===_0xdfec('0x1b')&&typeof _0x420e3b[_0xdfec('0x1c')]==='undefined';var _0x443d2f=_0x53ef23[_0xdfec('0x1d')];var _0x336abf=_0x2fbbbb?0x0:_0x420e3b[_0xdfec('0x1a')];var _0x10c44c=_0x2fbbbb?_0x53ef23['count']:_0x420e3b['offset']+_0x420e3b[_0xdfec('0x1c')];var _0x171377;if(_0x10c44c>=_0x443d2f){_0x10c44c=_0x443d2f;_0x171377=0xc8;}else{_0x171377=0xce;}_0x493d12[_0xdfec('0x17')](_0x171377);return _0x493d12['set']('Content-Range',_0x336abf+'-'+_0x10c44c+'/'+_0x443d2f)['json'](_0x53ef23);}return null;};}function patchUpdates(_0x4b9614){return function(_0xce9faf){try{jsonpatch[_0xdfec('0x1e')](_0xce9faf,_0x4b9614,!![]);}catch(_0x577a69){return BPromise[_0xdfec('0x1f')](_0x577a69);}return _0xce9faf[_0xdfec('0x20')]();};}function saveUpdates(_0x58f088,_0x23c8fd){return function(_0x4fb633){if(_0x4fb633){return _0x4fb633[_0xdfec('0x21')](_0x58f088)[_0xdfec('0x22')](function(_0x43d004){return _0x43d004;});}return null;};}function removeEntity(_0x1e1c81,_0x405aae){return function(_0x3e29aa){if(_0x3e29aa){return _0x3e29aa[_0xdfec('0x23')]()[_0xdfec('0x22')](function(){_0x1e1c81[_0xdfec('0x17')](0xcc)[_0xdfec('0x18')]();});}};}function handleEntityNotFound(_0x488212,_0x16c6a7){return function(_0x511574){if(!_0x511574){_0x488212[_0xdfec('0x16')](0x194);}return _0x511574;};}function handleError(_0x21722a,_0x314f98){_0x314f98=_0x314f98||0x1f4;return function(_0x3b96f1){logger[_0xdfec('0x24')](_0x3b96f1[_0xdfec('0x25')]);if(_0x3b96f1[_0xdfec('0x26')]){delete _0x3b96f1['name'];}_0x21722a[_0xdfec('0x17')](_0x314f98)[_0xdfec('0x27')](_0x3b96f1);};}exports['show']=function(_0x19a66a,_0x58c46b){var _0x5051bd={'raw':!![],'where':{'id':_0x19a66a[_0xdfec('0x28')]['id']}},_0x71aeae={};_0x71aeae[_0xdfec('0x29')]=_[_0xdfec('0x2a')](db[_0xdfec('0x2b')][_0xdfec('0x2c')]);_0x71aeae[_0xdfec('0x2d')]=_[_0xdfec('0x2a')](_0x19a66a[_0xdfec('0x2d')]);_0x71aeae[_0xdfec('0x2e')]=_[_0xdfec('0x2f')](_0x71aeae[_0xdfec('0x29')],_0x71aeae['query']);_0x5051bd[_0xdfec('0x30')]=_[_0xdfec('0x2f')](_0x71aeae[_0xdfec('0x29')],qs[_0xdfec('0x31')](_0x19a66a[_0xdfec('0x2d')][_0xdfec('0x31')]));_0x5051bd[_0xdfec('0x30')]=_0x5051bd[_0xdfec('0x30')][_0xdfec('0x32')]?_0x5051bd['attributes']:_0x71aeae['model'];if(_0x19a66a[_0xdfec('0x2d')][_0xdfec('0x33')]){_0x5051bd[_0xdfec('0x34')]=[{'all':!![]}];}_0x5051bd=_[_0xdfec('0x35')]({},_0x5051bd,_0x19a66a[_0xdfec('0x36')]);return db[_0xdfec('0x2b')]['find'](_0x5051bd)['then'](handleEntityNotFound(_0x58c46b,null))[_0xdfec('0x22')](respondWithResult(_0x58c46b,null))[_0xdfec('0x37')](handleError(_0x58c46b,null));};exports[_0xdfec('0x21')]=function(_0x399bcf,_0x2cbc61){if(_0x399bcf[_0xdfec('0x38')]['id']){delete _0x399bcf[_0xdfec('0x38')]['id'];}return db[_0xdfec('0x2b')][_0xdfec('0x39')]({'where':{'id':_0x399bcf[_0xdfec('0x28')]['id']}})[_0xdfec('0x22')](handleEntityNotFound(_0x2cbc61,null))['then'](saveUpdates(_0x399bcf[_0xdfec('0x38')],null))[_0xdfec('0x22')](respondWithResult(_0x2cbc61,null))[_0xdfec('0x37')](handleError(_0x2cbc61,null));};exports['destroy']=function(_0x2971a1,_0x515be2){return db[_0xdfec('0x2b')][_0xdfec('0x39')]({'where':{'id':_0x2971a1['params']['id']}})[_0xdfec('0x22')](handleEntityNotFound(_0x515be2,null))[_0xdfec('0x22')](removeEntity(_0x515be2,null))[_0xdfec('0x37')](handleError(_0x515be2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 39c920a..dca2ac2 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 _0x8ba1=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x4e768b,_0x1143ec){var _0x4c5165=function(_0x3dd5e0){while(--_0x3dd5e0){_0x4e768b['push'](_0x4e768b['shift']());}};_0x4c5165(++_0x1143ec);}(_0x8ba1,0x19e));var _0x18ba=function(_0x299e65,_0x195479){_0x299e65=_0x299e65-0x0;var _0x1c1167=_0x8ba1[_0x299e65];return _0x1c1167;};'use strict';var _=require('lodash');var util=require(_0x18ba('0x0'));var logger=require(_0x18ba('0x1'))('api');var moment=require(_0x18ba('0x2'));var BPromise=require(_0x18ba('0x3'));var rp=require(_0x18ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ba('0x5'));var config=require(_0x18ba('0x6'));var attributes=require('./chatApplication.attributes');module[_0x18ba('0x7')]=function(_0x475280,_0x20ee68){return _0x475280[_0x18ba('0x8')](_0x18ba('0x9'),attributes,{'tableName':_0x18ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18ba('0xb'),'collate':_0x18ba('0xc')});}; \ No newline at end of file +var _0xb619=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb619,0x12a));var _0x9b61=function(_0x269d0a,_0x528d16){_0x269d0a=_0x269d0a-0x0;var _0x1be160=_0xb619[_0x269d0a];return _0x1be160;};'use strict';var _=require(_0x9b61('0x0'));var util=require(_0x9b61('0x1'));var logger=require(_0x9b61('0x2'))(_0x9b61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b61('0x4'));var fs=require('fs');var path=require(_0x9b61('0x5'));var rimraf=require(_0x9b61('0x6'));var config=require(_0x9b61('0x7'));var attributes=require(_0x9b61('0x8'));module['exports']=function(_0x2efc64,_0x4c2553){return _0x2efc64[_0x9b61('0x9')](_0x9b61('0xa'),attributes,{'tableName':_0x9b61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b61('0xc'),'collate':_0x9b61('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fdb34f9..e99b3c9 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 _0x8ad7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27637c,_0x281c79){var _0x409a6f=function(_0x4a4a6d){while(--_0x4a4a6d){_0x27637c['push'](_0x27637c['shift']());}};_0x409a6f(++_0x281c79);}(_0x8ad7,0x128));var _0x78ad=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8ad7[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x78ad('0x0'));var util=require(_0x78ad('0x1'));var moment=require(_0x78ad('0x2'));var BPromise=require(_0x78ad('0x3'));var rs=require(_0x78ad('0x4'));var fs=require('fs');var Redis=require(_0x78ad('0x5'));var db=require(_0x78ad('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x78ad('0x7'));var config=require('../../config/environment');var jayson=require(_0x78ad('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeac313,_0x18ec24,_0x37cefc){return new BPromise(function(_0x1e53d4,_0x322dcf){return client['request'](_0xeac313,_0x37cefc)[_0x78ad('0x9')](function(_0x52f0ee){logger[_0x78ad('0xa')](_0x78ad('0xb'),_0x18ec24,_0x78ad('0xc'));logger[_0x78ad('0xd')](_0x78ad('0xe'),_0x18ec24,_0x78ad('0xc'),JSON[_0x78ad('0xf')](_0x52f0ee));if(_0x52f0ee[_0x78ad('0x10')]){if(_0x52f0ee['error'][_0x78ad('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x18ec24,_0x52f0ee[_0x78ad('0x10')][_0x78ad('0x12')]);return _0x322dcf(_0x52f0ee[_0x78ad('0x10')][_0x78ad('0x12')]);}logger[_0x78ad('0x10')](_0x78ad('0xb'),_0x18ec24,_0x52f0ee[_0x78ad('0x10')][_0x78ad('0x12')]);return _0x1e53d4(_0x52f0ee[_0x78ad('0x10')][_0x78ad('0x12')]);}else{logger[_0x78ad('0xa')](_0x78ad('0xb'),_0x18ec24,_0x78ad('0xc'));_0x1e53d4(_0x52f0ee[_0x78ad('0x13')][_0x78ad('0x12')]);}})[_0x78ad('0x14')](function(_0x27e095){logger[_0x78ad('0x10')](_0x78ad('0xb'),_0x18ec24,_0x27e095);_0x322dcf(_0x27e095);});});} \ No newline at end of file +var _0xe451=['../../config/environment','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xe451,0xcb));var _0x1e45=function(_0x1c3eb3,_0x5440a){_0x1c3eb3=_0x1c3eb3-0x0;var _0x12efae=_0xe451[_0x1c3eb3];return _0x12efae;};'use strict';var _=require(_0x1e45('0x0'));var util=require(_0x1e45('0x1'));var moment=require(_0x1e45('0x2'));var BPromise=require(_0x1e45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e45('0x4'))['db'];var utils=require(_0x1e45('0x5'));var logger=require(_0x1e45('0x6'))('rpc');var config=require(_0x1e45('0x7'));var jayson=require(_0x1e45('0x8'));var client=jayson[_0x1e45('0x9')][_0x1e45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb43dac,_0x1182c4,_0x6998ae){return new BPromise(function(_0x265b14,_0xb30251){return client['request'](_0xb43dac,_0x6998ae)[_0x1e45('0xb')](function(_0xea4b85){logger[_0x1e45('0xc')](_0x1e45('0xd'),_0x1182c4,_0x1e45('0xe'));logger[_0x1e45('0xf')](_0x1e45('0x10'),_0x1182c4,_0x1e45('0xe'),JSON[_0x1e45('0x11')](_0xea4b85));if(_0xea4b85['error']){if(_0xea4b85[_0x1e45('0x12')]['code']===0x1f4){logger[_0x1e45('0x12')]('ChatApplication,\x20%s,\x20%s',_0x1182c4,_0xea4b85[_0x1e45('0x12')][_0x1e45('0x13')]);return _0xb30251(_0xea4b85[_0x1e45('0x12')][_0x1e45('0x13')]);}logger[_0x1e45('0x12')]('ChatApplication,\x20%s,\x20%s',_0x1182c4,_0xea4b85['error'][_0x1e45('0x13')]);return _0x265b14(_0xea4b85[_0x1e45('0x12')][_0x1e45('0x13')]);}else{logger[_0x1e45('0xc')](_0x1e45('0xd'),_0x1182c4,_0x1e45('0xe'));_0x265b14(_0xea4b85[_0x1e45('0x14')][_0x1e45('0x13')]);}})['catch'](function(_0x7f25b){logger[_0x1e45('0x12')](_0x1e45('0xd'),_0x1182c4,_0x7f25b);_0xb30251(_0x7f25b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0196f02..b126f86 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 _0xe483=['delete','/:id','isAuthenticated','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','update'];(function(_0x2de76b,_0x1c9dde){var _0x315ba7=function(_0x230a62){while(--_0x230a62){_0x2de76b['push'](_0x2de76b['shift']());}};_0x315ba7(++_0x1c9dde);}(_0xe483,0x18b));var _0x3e48=function(_0x535db5,_0x18ed2c){_0x535db5=_0x535db5-0x0;var _0x3a1a5c=_0xe483[_0x535db5];return _0x3a1a5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e48('0x0'));var timeout=require('connect-timeout');var express=require(_0x3e48('0x1'));var router=express[_0x3e48('0x2')]();var fs_extra=require(_0x3e48('0x3'));var auth=require(_0x3e48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3e48('0x5'));var controller=require(_0x3e48('0x6'));router[_0x3e48('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3e48('0x8')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3e48('0x9')]);router[_0x3e48('0xa')](_0x3e48('0xb'),auth[_0x3e48('0xc')](),controller[_0x3e48('0xd')]);module[_0x3e48('0xe')]=router; \ No newline at end of file +var _0x155a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x155a,0x1d1));var _0xa155=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x155a[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xa155('0x0'));var util=require(_0xa155('0x1'));var path=require(_0xa155('0x2'));var timeout=require('connect-timeout');var express=require(_0xa155('0x3'));var router=express[_0xa155('0x4')]();var fs_extra=require(_0xa155('0x5'));var auth=require(_0xa155('0x6'));var interaction=require(_0xa155('0x7'));var config=require(_0xa155('0x8'));var controller=require(_0xa155('0x9'));router[_0xa155('0xa')](_0xa155('0xb'),auth[_0xa155('0xc')](),controller[_0xa155('0xd')]);router['put'](_0xa155('0xb'),auth[_0xa155('0xc')](),controller[_0xa155('0xe')]);router[_0xa155('0xf')](_0xa155('0xb'),auth[_0xa155('0xc')](),controller[_0xa155('0x10')]);module[_0xa155('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 769a05e..64bddda 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 _0xe5e3=['exports','STRING'];(function(_0x279940,_0x536361){var _0x2ae662=function(_0x1cd48f){while(--_0x1cd48f){_0x279940['push'](_0x279940['shift']());}};_0x2ae662(++_0x536361);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x3ab721,_0x4a7ca6){_0x3ab721=_0x3ab721-0x0;var _0x324091=_0xe5e3[_0x3ab721];return _0x324091;};'use strict';var Sequelize=require('sequelize');module[_0x3e5e('0x0')]={'name':{'type':Sequelize[_0x3e5e('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd3e3=['exports','STRING','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x3cf89d,_0x5c6c79){_0x3cf89d=_0x3cf89d-0x0;var _0x237ccf=_0xd3e3[_0x3cf89d];return _0x237ccf;};'use strict';var Sequelize=require(_0x3d3e('0x0'));module[_0x3d3e('0x1')]={'name':{'type':Sequelize[_0x3d3e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3d3e('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 95db781..e46f3cb 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 _0xcf9d=['ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','pick','nolimit','removeMembers','addMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','./chatGroup.socket','register','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','ChatGroup','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','getUnread'];(function(_0x33ab3d,_0x4fa0ce){var _0x5c418b=function(_0x786bb8){while(--_0x786bb8){_0x33ab3d['push'](_0x33ab3d['shift']());}};_0x5c418b(++_0x4fa0ce);}(_0xcf9d,0x134));var _0xdcf9=function(_0x44dbbc,_0x1d18a8){_0x44dbbc=_0x44dbbc-0x0;var _0x1cbf30=_0xcf9d[_0x44dbbc];return _0x1cbf30;};'use strict';var emlformat=require(_0xdcf9('0x0'));var rimraf=require(_0xdcf9('0x1'));var zipdir=require(_0xdcf9('0x2'));var jsonpatch=require(_0xdcf9('0x3'));var rp=require(_0xdcf9('0x4'));var moment=require(_0xdcf9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdcf9('0x6'));var util=require('util');var path=require(_0xdcf9('0x7'));var sox=require(_0xdcf9('0x8'));var csv=require(_0xdcf9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf9('0xa'));var squel=require('squel');var crypto=require(_0xdcf9('0xb'));var jsforce=require(_0xdcf9('0xc'));var deskjs=require(_0xdcf9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdcf9('0xe'));var Papa=require('papaparse');var Redis=require(_0xdcf9('0xf'));var authService=require(_0xdcf9('0x10'));var qs=require(_0xdcf9('0x11'));var as=require(_0xdcf9('0x12'));var hardwareService=require(_0xdcf9('0x13'));var logger=require(_0xdcf9('0x14'))(_0xdcf9('0x15'));var utils=require(_0xdcf9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdcf9('0x17'))['db'];config['redis']=_[_0xdcf9('0x18')](config['redis'],{'host':_0xdcf9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcf9('0x1a')]));require(_0xdcf9('0x1b'))[_0xdcf9('0x1c')](socket);function respondWithStatusCode(_0x583e93,_0x198f1a){_0x198f1a=_0x198f1a||0xcc;return function(_0x5885f1){if(_0x5885f1){return _0x583e93['sendStatus'](_0x198f1a);}return _0x583e93[_0xdcf9('0x1d')](_0x198f1a)['end']();};}function respondWithResult(_0x4e5537,_0x97d28e){_0x97d28e=_0x97d28e||0xc8;return function(_0x513d52){if(_0x513d52){return _0x4e5537[_0xdcf9('0x1d')](_0x97d28e)[_0xdcf9('0x1e')](_0x513d52);}};}function respondWithFilteredResult(_0x24cb91,_0x3d6064){return function(_0x3067ea){if(_0x3067ea){var _0x2a39ae=typeof _0x3d6064[_0xdcf9('0x1f')]===_0xdcf9('0x20')&&typeof _0x3d6064['limit']===_0xdcf9('0x20');var _0x57f822=_0x3067ea[_0xdcf9('0x21')];var _0x5ee72d=_0x2a39ae?0x0:_0x3d6064[_0xdcf9('0x1f')];var _0x4605e5=_0x2a39ae?_0x3067ea[_0xdcf9('0x21')]:_0x3d6064['offset']+_0x3d6064['limit'];var _0x23d13f;if(_0x4605e5>=_0x57f822){_0x4605e5=_0x57f822;_0x23d13f=0xc8;}else{_0x23d13f=0xce;}_0x24cb91[_0xdcf9('0x1d')](_0x23d13f);return _0x24cb91['set'](_0xdcf9('0x22'),_0x5ee72d+'-'+_0x4605e5+'/'+_0x57f822)[_0xdcf9('0x1e')](_0x3067ea);}return null;};}function patchUpdates(_0x33c6ed){return function(_0x6ae050){try{jsonpatch[_0xdcf9('0x23')](_0x6ae050,_0x33c6ed,!![]);}catch(_0x46d55f){return BPromise['reject'](_0x46d55f);}return _0x6ae050[_0xdcf9('0x24')]();};}function saveUpdates(_0x56e3dd,_0x148062){return function(_0x4e8da6){if(_0x4e8da6){return _0x4e8da6[_0xdcf9('0x25')](_0x56e3dd)[_0xdcf9('0x26')](function(_0x55532e){return _0x55532e;});}return null;};}function removeEntity(_0xfe08b2,_0x310363){return function(_0x345a2c){if(_0x345a2c){return _0x345a2c[_0xdcf9('0x27')]()[_0xdcf9('0x26')](function(){_0xfe08b2[_0xdcf9('0x1d')](0xcc)[_0xdcf9('0x28')]();});}};}function handleEntityNotFound(_0x2fa1f3,_0x420602){return function(_0x2a3421){if(!_0x2a3421){_0x2fa1f3[_0xdcf9('0x29')](0x194);}return _0x2a3421;};}function handleError(_0x492673,_0x463bf4){_0x463bf4=_0x463bf4||0x1f4;return function(_0x31a9b4){logger[_0xdcf9('0x2a')](_0x31a9b4[_0xdcf9('0x2b')]);if(_0x31a9b4[_0xdcf9('0x2c')]){delete _0x31a9b4[_0xdcf9('0x2c')];}_0x492673['status'](_0x463bf4)['send'](_0x31a9b4);};}exports[_0xdcf9('0x2d')]=function(_0x513365,_0x3236a9){var _0x1165a6={},_0x17e682={},_0x211684={'count':0x0,'rows':[]};var _0xe521b8=_[_0xdcf9('0x2e')](db[_0xdcf9('0x2f')]['rawAttributes'],function(_0x2d3c9a){return{'name':_0x2d3c9a[_0xdcf9('0x30')],'type':_0x2d3c9a[_0xdcf9('0x31')][_0xdcf9('0x32')]};});_0x17e682[_0xdcf9('0x33')]=_['map'](_0xe521b8,_0xdcf9('0x2c'));_0x17e682['query']=_[_0xdcf9('0x34')](_0x513365[_0xdcf9('0x35')]);_0x17e682[_0xdcf9('0x36')]=_[_0xdcf9('0x37')](_0x17e682[_0xdcf9('0x33')],_0x17e682[_0xdcf9('0x35')]);_0x1165a6[_0xdcf9('0x38')]=_['intersection'](_0x17e682[_0xdcf9('0x33')],qs['fields'](_0x513365[_0xdcf9('0x35')][_0xdcf9('0x39')]));_0x1165a6[_0xdcf9('0x38')]=_0x1165a6[_0xdcf9('0x38')][_0xdcf9('0x3a')]?_0x1165a6[_0xdcf9('0x38')]:_0x17e682[_0xdcf9('0x33')];if(!_0x513365[_0xdcf9('0x35')][_0xdcf9('0x3b')]('nolimit')){_0x1165a6['limit']=qs[_0xdcf9('0x3c')](_0x513365[_0xdcf9('0x35')][_0xdcf9('0x3c')]);_0x1165a6[_0xdcf9('0x1f')]=qs['offset'](_0x513365[_0xdcf9('0x35')][_0xdcf9('0x1f')]);}_0x1165a6[_0xdcf9('0x3d')]=qs[_0xdcf9('0x3e')](_0x513365[_0xdcf9('0x35')][_0xdcf9('0x3e')]);_0x1165a6['where']=qs[_0xdcf9('0x36')](_['pick'](_0x513365[_0xdcf9('0x35')],_0x17e682['filters']),_0xe521b8);if(_0x513365[_0xdcf9('0x35')][_0xdcf9('0x3f')]){_0x1165a6['where']=_[_0xdcf9('0x40')](_0x1165a6['where'],{'$or':_['map'](_0xe521b8,function(_0xcf9d9a){if(_0xcf9d9a[_0xdcf9('0x31')]!==_0xdcf9('0x41')){var _0x85d4b6={};_0x85d4b6[_0xcf9d9a[_0xdcf9('0x2c')]]={'$like':'%'+_0x513365['query'][_0xdcf9('0x3f')]+'%'};return _0x85d4b6;}})});}_0x1165a6=_[_0xdcf9('0x40')]({},_0x1165a6,_0x513365[_0xdcf9('0x42')]);var _0x1d977f={'where':_0x1165a6[_0xdcf9('0x43')]};return db[_0xdcf9('0x2f')][_0xdcf9('0x21')](_0x1d977f)[_0xdcf9('0x26')](function(_0x14b87e){_0x211684[_0xdcf9('0x21')]=_0x14b87e;if(_0x513365[_0xdcf9('0x35')][_0xdcf9('0x44')]){_0x1165a6['include']=[{'all':!![]}];}return db[_0xdcf9('0x2f')][_0xdcf9('0x45')](_0x1165a6);})['then'](function(_0x34cb9d){_0x211684[_0xdcf9('0x46')]=_0x34cb9d;return _0x211684;})[_0xdcf9('0x26')](respondWithFilteredResult(_0x3236a9,_0x1165a6))['catch'](handleError(_0x3236a9,null));};exports[_0xdcf9('0x47')]=function(_0x5677fc,_0x1e3afb){var _0x808df9={'raw':!![],'where':{'id':_0x5677fc[_0xdcf9('0x48')]['id']}},_0x103b25={};_0x103b25[_0xdcf9('0x33')]=_[_0xdcf9('0x34')](db['ChatGroup']['rawAttributes']);_0x103b25[_0xdcf9('0x35')]=_[_0xdcf9('0x34')](_0x5677fc[_0xdcf9('0x35')]);_0x103b25[_0xdcf9('0x36')]=_['intersection'](_0x103b25[_0xdcf9('0x33')],_0x103b25[_0xdcf9('0x35')]);_0x808df9['attributes']=_[_0xdcf9('0x37')](_0x103b25[_0xdcf9('0x33')],qs['fields'](_0x5677fc[_0xdcf9('0x35')]['fields']));_0x808df9[_0xdcf9('0x38')]=_0x808df9[_0xdcf9('0x38')][_0xdcf9('0x3a')]?_0x808df9[_0xdcf9('0x38')]:_0x103b25['model'];if(_0x5677fc['query'][_0xdcf9('0x44')]){_0x808df9[_0xdcf9('0x49')]=[{'all':!![]}];}_0x808df9=_[_0xdcf9('0x40')]({},_0x808df9,_0x5677fc[_0xdcf9('0x42')]);return db[_0xdcf9('0x2f')]['find'](_0x808df9)[_0xdcf9('0x26')](handleEntityNotFound(_0x1e3afb,null))[_0xdcf9('0x26')](respondWithResult(_0x1e3afb,null))[_0xdcf9('0x4a')](handleError(_0x1e3afb,null));};exports['create']=function(_0xc36e57,_0x173348){return db[_0xdcf9('0x2f')][_0xdcf9('0x4b')](_0xc36e57['body'],{})[_0xdcf9('0x26')](respondWithResult(_0x173348,0xc9))[_0xdcf9('0x4a')](handleError(_0x173348,null));};exports[_0xdcf9('0x25')]=function(_0x47b5db,_0x45c18e){if(_0x47b5db[_0xdcf9('0x4c')]['id']){delete _0x47b5db[_0xdcf9('0x4c')]['id'];}return db['ChatGroup'][_0xdcf9('0x4d')]({'where':{'id':_0x47b5db['params']['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x45c18e,null))[_0xdcf9('0x26')](saveUpdates(_0x47b5db[_0xdcf9('0x4c')],null))['then'](respondWithResult(_0x45c18e,null))['catch'](handleError(_0x45c18e,null));};exports[_0xdcf9('0x27')]=function(_0x16ab18,_0x116be4){return db[_0xdcf9('0x2f')]['find']({'where':{'id':_0x16ab18[_0xdcf9('0x48')]['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x116be4,null))['then'](removeEntity(_0x116be4,null))[_0xdcf9('0x4a')](handleError(_0x116be4,null));};exports[_0xdcf9('0x4e')]=function(_0x1053fb,_0x3851c2){return db[_0xdcf9('0x2f')][_0xdcf9('0x4e')]()[_0xdcf9('0x26')](respondWithResult(_0x3851c2,null))['catch'](handleError(_0x3851c2,null));};exports[_0xdcf9('0x4f')]=function(_0x4f3fba,_0x3f0a1e,_0x3c91cc){return db[_0xdcf9('0x50')]['count']({'where':{'ChatGroupId':_0x4f3fba[_0xdcf9('0x48')]['id'],'ToId':_0x4f3fba[_0xdcf9('0x51')]['id'],'read':![]}})[_0xdcf9('0x26')](function(_0x503226){return{'id':_['toInteger'](_0x4f3fba[_0xdcf9('0x48')]['id']),'count':_0x503226};})[_0xdcf9('0x26')](respondWithResult(_0x3f0a1e,null))[_0xdcf9('0x4a')](handleError(_0x3f0a1e,null));};exports[_0xdcf9('0x52')]=function(_0x43391c,_0x1f0af2,_0x3e5c32){return db[_0xdcf9('0x2f')][_0xdcf9('0x4d')]({'where':{'id':_0x43391c['params']['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x1f0af2,null))[_0xdcf9('0x26')](function(_0x192466){if(_0x192466){return _0x192466[_0xdcf9('0x52')](_0x43391c['body'][_0xdcf9('0x53')],_[_0xdcf9('0x54')](_0x43391c[_0xdcf9('0x4c')],['ids','id'])||{});}})[_0xdcf9('0x26')](respondWithResult(_0x1f0af2,null))[_0xdcf9('0x4a')](handleError(_0x1f0af2,null));};exports[_0xdcf9('0x55')]=function(_0x4043e2,_0x37790c,_0x202c57){var _0x1a202f={};var _0x53455a={};var _0x3bf079;var _0x344b7c;return db[_0xdcf9('0x2f')][_0xdcf9('0x56')]({'where':{'id':_0x4043e2['params']['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x37790c,null))['then'](function(_0x113317){if(_0x113317){_0x3bf079=_0x113317;_0x53455a[_0xdcf9('0x33')]=_[_0xdcf9('0x34')](db[_0xdcf9('0x57')]['rawAttributes']);_0x53455a['query']=_['keys'](_0x4043e2[_0xdcf9('0x35')]);_0x53455a[_0xdcf9('0x36')]=_['intersection'](_0x53455a[_0xdcf9('0x33')],_0x53455a[_0xdcf9('0x35')]);_0x1a202f['attributes']=_['intersection'](_0x53455a[_0xdcf9('0x33')],qs['fields'](_0x4043e2[_0xdcf9('0x35')]['fields']));_0x1a202f['attributes']=_0x1a202f[_0xdcf9('0x38')][_0xdcf9('0x3a')]?_0x1a202f[_0xdcf9('0x38')]:_0x53455a[_0xdcf9('0x33')];_0x1a202f[_0xdcf9('0x3d')]=qs[_0xdcf9('0x3e')](_0x4043e2['query']['sort']);_0x1a202f[_0xdcf9('0x43')]=qs['filters'](_[_0xdcf9('0x58')](_0x4043e2['query'],_0x53455a[_0xdcf9('0x36')]));if(_0x4043e2[_0xdcf9('0x35')][_0xdcf9('0x3f')]){_0x1a202f[_0xdcf9('0x43')]=_[_0xdcf9('0x40')](_0x1a202f[_0xdcf9('0x43')],{'$or':_[_0xdcf9('0x2e')](_0x1a202f['attributes'],function(_0x371750){var _0x25d5ef={};_0x25d5ef[_0x371750]={'$like':'%'+_0x4043e2['query']['filter']+'%'};return _0x25d5ef;})});}_0x1a202f=_[_0xdcf9('0x40')]({},_0x1a202f,_0x4043e2['options']);return _0x3bf079[_0xdcf9('0x55')](_0x1a202f);}})[_0xdcf9('0x26')](function(_0x28d3d5){if(_0x28d3d5){_0x344b7c=_0x28d3d5[_0xdcf9('0x3a')];if(!_0x4043e2[_0xdcf9('0x35')][_0xdcf9('0x3b')](_0xdcf9('0x59'))){_0x1a202f['limit']=qs['limit'](_0x4043e2['query'][_0xdcf9('0x3c')]);_0x1a202f['offset']=qs[_0xdcf9('0x1f')](_0x4043e2[_0xdcf9('0x35')][_0xdcf9('0x1f')]);}return _0x3bf079['getMembers'](_0x1a202f);}})[_0xdcf9('0x26')](function(_0x4f77eb){if(_0x4f77eb){return _0x4f77eb?{'count':_0x344b7c,'rows':_0x4f77eb}:null;}})[_0xdcf9('0x26')](respondWithResult(_0x37790c,null))[_0xdcf9('0x4a')](handleError(_0x37790c,null));};exports[_0xdcf9('0x5a')]=function(_0x5df34f,_0x1ba8fe,_0x1b69f3){return db[_0xdcf9('0x2f')][_0xdcf9('0x4d')]({'where':{'id':_0x5df34f['params']['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x1ba8fe,null))[_0xdcf9('0x26')](function(_0x678fce){if(_0x678fce){return _0x678fce[_0xdcf9('0x5a')](_0x5df34f[_0xdcf9('0x35')]['ids']);}})[_0xdcf9('0x26')](respondWithStatusCode(_0x1ba8fe,null))[_0xdcf9('0x4a')](handleError(_0x1ba8fe,null));};exports[_0xdcf9('0x5b')]=function(_0x212238,_0x385289,_0x4b83d0){if(_0x212238[_0xdcf9('0x4c')]['id']){delete _0x212238['body']['id'];}return db[_0xdcf9('0x2f')][_0xdcf9('0x4d')]({'where':{'id':_0x212238[_0xdcf9('0x48')]['id']}})['then'](handleEntityNotFound(_0x385289,null))['then'](function(_0xba9080){if(_0xba9080){_0x212238[_0xdcf9('0x4c')]['ChatGroupId']=_0xba9080['id'];return db['ChatInternalMessage']['create'](_0x212238['body']);}})[_0xdcf9('0x26')](respondWithResult(_0x385289,null))['catch'](handleError(_0x385289,null));};exports['getMessages']=function(_0x163315,_0x4263b5,_0x20f879){var _0x1bf8ee={};var _0x1016e5={};var _0x582b4b;var _0x2f38b6;return db[_0xdcf9('0x2f')]['findOne']({'where':{'id':_0x163315[_0xdcf9('0x48')]['id']}})[_0xdcf9('0x26')](handleEntityNotFound(_0x4263b5,null))[_0xdcf9('0x26')](function(_0x4031b7){if(_0x4031b7){_0x582b4b=_0x4031b7;_0x1016e5[_0xdcf9('0x33')]=_[_0xdcf9('0x34')](db[_0xdcf9('0x50')]['rawAttributes']);_0x1016e5[_0xdcf9('0x35')]=_[_0xdcf9('0x34')](_0x163315[_0xdcf9('0x35')]);_0x1016e5['filters']=_[_0xdcf9('0x37')](_0x1016e5[_0xdcf9('0x33')],_0x1016e5[_0xdcf9('0x35')]);_0x1bf8ee[_0xdcf9('0x38')]=_['intersection'](_0x1016e5['model'],qs[_0xdcf9('0x39')](_0x163315[_0xdcf9('0x35')][_0xdcf9('0x39')]));_0x1bf8ee[_0xdcf9('0x38')]=_0x1bf8ee['attributes'][_0xdcf9('0x3a')]?_0x1bf8ee[_0xdcf9('0x38')]:_0x1016e5[_0xdcf9('0x33')];_0x1bf8ee['order']=qs[_0xdcf9('0x3e')](_0x163315['query']['sort']);_0x1bf8ee['where']=qs[_0xdcf9('0x36')](_['pick'](_0x163315[_0xdcf9('0x35')],_0x1016e5[_0xdcf9('0x36')]));if(_0x163315['query']['filter']){_0x1bf8ee[_0xdcf9('0x43')]=_[_0xdcf9('0x40')](_0x1bf8ee[_0xdcf9('0x43')],{'$or':_[_0xdcf9('0x2e')](_0x1bf8ee[_0xdcf9('0x38')],function(_0x1b666b){var _0x141756={};_0x141756[_0x1b666b]={'$like':'%'+_0x163315[_0xdcf9('0x35')][_0xdcf9('0x3f')]+'%'};return _0x141756;})});}if(_0x163315[_0xdcf9('0x35')][_0xdcf9('0x5c')]){var _0x3024e9=_0x163315[_0xdcf9('0x35')][_0xdcf9('0x5c')][_0xdcf9('0x5d')](',');var _0x46ceb1={};_0x46ceb1[_0x3024e9[0x0]]={'$gte':moment(_0x3024e9[0x1])[_0xdcf9('0x5e')](_0xdcf9('0x5f'))};_0x1bf8ee[_0xdcf9('0x43')]=_['merge'](_0x1bf8ee[_0xdcf9('0x43')],_0x46ceb1);}_0x1bf8ee=_[_0xdcf9('0x40')]({},_0x1bf8ee,_0x163315[_0xdcf9('0x42')]);return _0x582b4b['getMessages'](_0x1bf8ee);}})[_0xdcf9('0x26')](function(_0x411ce5){if(_0x411ce5){_0x2f38b6=_0x411ce5[_0xdcf9('0x3a')];if(!_0x163315[_0xdcf9('0x35')][_0xdcf9('0x3b')](_0xdcf9('0x59'))){_0x1bf8ee[_0xdcf9('0x3c')]=qs['limit'](_0x163315[_0xdcf9('0x35')][_0xdcf9('0x3c')]);_0x1bf8ee[_0xdcf9('0x1f')]=qs[_0xdcf9('0x1f')](_0x163315[_0xdcf9('0x35')][_0xdcf9('0x1f')]);}return _0x582b4b[_0xdcf9('0x60')](_0x1bf8ee);}})[_0xdcf9('0x26')](function(_0x2ff0a3){if(_0x2ff0a3){return _0x2ff0a3?{'count':_0x2f38b6,'rows':_0x2ff0a3}:null;}})[_0xdcf9('0x26')](respondWithResult(_0x4263b5,null))[_0xdcf9('0x4a')](handleError(_0x4263b5,null));}; \ No newline at end of file +var _0x494d=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getUnread','user','toInteger','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','rawAttributes','$gte','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0x494d,0x141));var _0xd494=function(_0x57a6b7,_0x28f887){_0x57a6b7=_0x57a6b7-0x0;var _0x59b063=_0x494d[_0x57a6b7];return _0x59b063;};'use strict';var emlformat=require(_0xd494('0x0'));var rimraf=require(_0xd494('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd494('0x2'));var rp=require(_0xd494('0x3'));var moment=require(_0xd494('0x4'));var BPromise=require(_0xd494('0x5'));var Mustache=require('mustache');var util=require(_0xd494('0x6'));var path=require(_0xd494('0x7'));var sox=require(_0xd494('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd494('0x9'));var _=require(_0xd494('0xa'));var squel=require('squel');var crypto=require(_0xd494('0xb'));var jsforce=require(_0xd494('0xc'));var deskjs=require(_0xd494('0xd'));var toCsv=require(_0xd494('0xe'));var querystring=require(_0xd494('0xf'));var Papa=require(_0xd494('0x10'));var Redis=require(_0xd494('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd494('0x12'));var as=require(_0xd494('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd494('0x14'))(_0xd494('0x15'));var utils=require(_0xd494('0x16'));var config=require(_0xd494('0x17'));var licenseUtil=require(_0xd494('0x18'));var db=require(_0xd494('0x19'))['db'];config[_0xd494('0x1a')]=_[_0xd494('0x1b')](config[_0xd494('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd494('0x1c'))(new Redis(config[_0xd494('0x1a')]));require(_0xd494('0x1d'))['register'](socket);function respondWithStatusCode(_0xb641c8,_0x1a8ca0){_0x1a8ca0=_0x1a8ca0||0xcc;return function(_0x4f4e1a){if(_0x4f4e1a){return _0xb641c8[_0xd494('0x1e')](_0x1a8ca0);}return _0xb641c8[_0xd494('0x1f')](_0x1a8ca0)[_0xd494('0x20')]();};}function respondWithResult(_0x1d8a6f,_0x335b6a){_0x335b6a=_0x335b6a||0xc8;return function(_0x5616c2){if(_0x5616c2){return _0x1d8a6f[_0xd494('0x1f')](_0x335b6a)[_0xd494('0x21')](_0x5616c2);}};}function respondWithFilteredResult(_0x398380,_0x131daf){return function(_0x22a20d){if(_0x22a20d){var _0x1bee06=typeof _0x131daf[_0xd494('0x22')]==='undefined'&&typeof _0x131daf[_0xd494('0x23')]==='undefined';var _0x3e8519=_0x22a20d[_0xd494('0x24')];var _0x3f1866=_0x1bee06?0x0:_0x131daf[_0xd494('0x22')];var _0x5cb0cf=_0x1bee06?_0x22a20d[_0xd494('0x24')]:_0x131daf['offset']+_0x131daf[_0xd494('0x23')];var _0x477493;if(_0x5cb0cf>=_0x3e8519){_0x5cb0cf=_0x3e8519;_0x477493=0xc8;}else{_0x477493=0xce;}_0x398380[_0xd494('0x1f')](_0x477493);return _0x398380[_0xd494('0x25')](_0xd494('0x26'),_0x3f1866+'-'+_0x5cb0cf+'/'+_0x3e8519)[_0xd494('0x21')](_0x22a20d);}return null;};}function patchUpdates(_0xa4468b){return function(_0x44786b){try{jsonpatch['apply'](_0x44786b,_0xa4468b,!![]);}catch(_0x5e31ff){return BPromise[_0xd494('0x27')](_0x5e31ff);}return _0x44786b[_0xd494('0x28')]();};}function saveUpdates(_0x233013,_0x2360f5){return function(_0x3089ab){if(_0x3089ab){return _0x3089ab[_0xd494('0x29')](_0x233013)[_0xd494('0x2a')](function(_0x3d0d90){return _0x3d0d90;});}return null;};}function removeEntity(_0x4c6672,_0x5296d1){return function(_0x1b6a55){if(_0x1b6a55){return _0x1b6a55[_0xd494('0x2b')]()[_0xd494('0x2a')](function(){_0x4c6672[_0xd494('0x1f')](0xcc)[_0xd494('0x20')]();});}};}function handleEntityNotFound(_0x394f39,_0x56e22c){return function(_0x27c2b2){if(!_0x27c2b2){_0x394f39[_0xd494('0x1e')](0x194);}return _0x27c2b2;};}function handleError(_0x17e12e,_0x4a2897){_0x4a2897=_0x4a2897||0x1f4;return function(_0x33c4ae){logger[_0xd494('0x2c')](_0x33c4ae[_0xd494('0x2d')]);if(_0x33c4ae[_0xd494('0x2e')]){delete _0x33c4ae[_0xd494('0x2e')];}_0x17e12e['status'](_0x4a2897)['send'](_0x33c4ae);};}exports[_0xd494('0x2f')]=function(_0x25a6d5,_0x47897d){var _0xf72e8c={},_0x12471d={},_0x5d1354={'count':0x0,'rows':[]};var _0x53d17c=_[_0xd494('0x30')](db[_0xd494('0x31')]['rawAttributes'],function(_0x1176ea){return{'name':_0x1176ea[_0xd494('0x32')],'type':_0x1176ea[_0xd494('0x33')][_0xd494('0x34')]};});_0x12471d[_0xd494('0x35')]=_[_0xd494('0x30')](_0x53d17c,'name');_0x12471d['query']=_['keys'](_0x25a6d5[_0xd494('0x36')]);_0x12471d[_0xd494('0x37')]=_['intersection'](_0x12471d[_0xd494('0x35')],_0x12471d[_0xd494('0x36')]);_0xf72e8c['attributes']=_[_0xd494('0x38')](_0x12471d[_0xd494('0x35')],qs['fields'](_0x25a6d5[_0xd494('0x36')][_0xd494('0x39')]));_0xf72e8c['attributes']=_0xf72e8c['attributes'][_0xd494('0x3a')]?_0xf72e8c[_0xd494('0x3b')]:_0x12471d[_0xd494('0x35')];if(!_0x25a6d5[_0xd494('0x36')][_0xd494('0x3c')](_0xd494('0x3d'))){_0xf72e8c['limit']=qs[_0xd494('0x23')](_0x25a6d5[_0xd494('0x36')][_0xd494('0x23')]);_0xf72e8c[_0xd494('0x22')]=qs[_0xd494('0x22')](_0x25a6d5[_0xd494('0x36')][_0xd494('0x22')]);}_0xf72e8c[_0xd494('0x3e')]=qs[_0xd494('0x3f')](_0x25a6d5['query']['sort']);_0xf72e8c[_0xd494('0x40')]=qs['filters'](_[_0xd494('0x41')](_0x25a6d5['query'],_0x12471d[_0xd494('0x37')]),_0x53d17c);if(_0x25a6d5[_0xd494('0x36')][_0xd494('0x42')]){_0xf72e8c[_0xd494('0x40')]=_[_0xd494('0x43')](_0xf72e8c[_0xd494('0x40')],{'$or':_[_0xd494('0x30')](_0x53d17c,function(_0x8582bd){if(_0x8582bd[_0xd494('0x33')]!==_0xd494('0x44')){var _0x445f6e={};_0x445f6e[_0x8582bd[_0xd494('0x2e')]]={'$like':'%'+_0x25a6d5['query'][_0xd494('0x42')]+'%'};return _0x445f6e;}})});}_0xf72e8c=_[_0xd494('0x43')]({},_0xf72e8c,_0x25a6d5[_0xd494('0x45')]);var _0x3c9da1={'where':_0xf72e8c['where']};return db[_0xd494('0x31')][_0xd494('0x24')](_0x3c9da1)[_0xd494('0x2a')](function(_0x5c29fc){_0x5d1354[_0xd494('0x24')]=_0x5c29fc;if(_0x25a6d5[_0xd494('0x36')][_0xd494('0x46')]){_0xf72e8c['include']=[{'all':!![]}];}return db[_0xd494('0x31')][_0xd494('0x47')](_0xf72e8c);})[_0xd494('0x2a')](function(_0x19d673){_0x5d1354[_0xd494('0x48')]=_0x19d673;return _0x5d1354;})[_0xd494('0x2a')](respondWithFilteredResult(_0x47897d,_0xf72e8c))[_0xd494('0x49')](handleError(_0x47897d,null));};exports[_0xd494('0x4a')]=function(_0x1d1eec,_0x42a16f){var _0x1cad9d={'raw':!![],'where':{'id':_0x1d1eec[_0xd494('0x4b')]['id']}},_0x93f18d={};_0x93f18d[_0xd494('0x35')]=_[_0xd494('0x4c')](db[_0xd494('0x31')]['rawAttributes']);_0x93f18d[_0xd494('0x36')]=_[_0xd494('0x4c')](_0x1d1eec[_0xd494('0x36')]);_0x93f18d['filters']=_['intersection'](_0x93f18d[_0xd494('0x35')],_0x93f18d['query']);_0x1cad9d[_0xd494('0x3b')]=_[_0xd494('0x38')](_0x93f18d[_0xd494('0x35')],qs['fields'](_0x1d1eec[_0xd494('0x36')][_0xd494('0x39')]));_0x1cad9d[_0xd494('0x3b')]=_0x1cad9d[_0xd494('0x3b')][_0xd494('0x3a')]?_0x1cad9d['attributes']:_0x93f18d[_0xd494('0x35')];if(_0x1d1eec['query'][_0xd494('0x46')]){_0x1cad9d[_0xd494('0x4d')]=[{'all':!![]}];}_0x1cad9d=_[_0xd494('0x43')]({},_0x1cad9d,_0x1d1eec['options']);return db[_0xd494('0x31')][_0xd494('0x4e')](_0x1cad9d)[_0xd494('0x2a')](handleEntityNotFound(_0x42a16f,null))[_0xd494('0x2a')](respondWithResult(_0x42a16f,null))[_0xd494('0x49')](handleError(_0x42a16f,null));};exports[_0xd494('0x4f')]=function(_0x4a751b,_0x216dcd){return db[_0xd494('0x31')][_0xd494('0x4f')](_0x4a751b[_0xd494('0x50')],{})['then'](respondWithResult(_0x216dcd,0xc9))[_0xd494('0x49')](handleError(_0x216dcd,null));};exports['update']=function(_0x56fd85,_0xccbda0){if(_0x56fd85[_0xd494('0x50')]['id']){delete _0x56fd85[_0xd494('0x50')]['id'];}return db[_0xd494('0x31')]['find']({'where':{'id':_0x56fd85[_0xd494('0x4b')]['id']}})['then'](handleEntityNotFound(_0xccbda0,null))[_0xd494('0x2a')](saveUpdates(_0x56fd85[_0xd494('0x50')],null))['then'](respondWithResult(_0xccbda0,null))[_0xd494('0x49')](handleError(_0xccbda0,null));};exports['destroy']=function(_0x589e32,_0x3b0697){return db[_0xd494('0x31')]['find']({'where':{'id':_0x589e32['params']['id']}})[_0xd494('0x2a')](handleEntityNotFound(_0x3b0697,null))[_0xd494('0x2a')](removeEntity(_0x3b0697,null))[_0xd494('0x49')](handleError(_0x3b0697,null));};exports['describe']=function(_0x34f767,_0x40cb2b){return db[_0xd494('0x31')]['describe']()[_0xd494('0x2a')](respondWithResult(_0x40cb2b,null))[_0xd494('0x49')](handleError(_0x40cb2b,null));};exports[_0xd494('0x51')]=function(_0x944916,_0x781085,_0x4b259d){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x944916['params']['id'],'ToId':_0x944916[_0xd494('0x52')]['id'],'read':![]}})[_0xd494('0x2a')](function(_0xa2f2e5){return{'id':_[_0xd494('0x53')](_0x944916[_0xd494('0x4b')]['id']),'count':_0xa2f2e5};})[_0xd494('0x2a')](respondWithResult(_0x781085,null))[_0xd494('0x49')](handleError(_0x781085,null));};exports['addMembers']=function(_0x18e45d,_0x3c9f96,_0x4e8dfc){return db[_0xd494('0x31')][_0xd494('0x4e')]({'where':{'id':_0x18e45d[_0xd494('0x4b')]['id']}})[_0xd494('0x2a')](handleEntityNotFound(_0x3c9f96,null))[_0xd494('0x2a')](function(_0x23debb){if(_0x23debb){return _0x23debb['addMembers'](_0x18e45d[_0xd494('0x50')][_0xd494('0x54')],_[_0xd494('0x55')](_0x18e45d['body'],[_0xd494('0x54'),'id'])||{});}})[_0xd494('0x2a')](respondWithResult(_0x3c9f96,null))[_0xd494('0x49')](handleError(_0x3c9f96,null));};exports[_0xd494('0x56')]=function(_0x13146f,_0x46f6c1,_0x448ed8){var _0x3bce81={};var _0x2c0a57={};var _0x2fc7e0;var _0x1915c6;return db[_0xd494('0x31')][_0xd494('0x57')]({'where':{'id':_0x13146f[_0xd494('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46f6c1,null))[_0xd494('0x2a')](function(_0xbe8c19){if(_0xbe8c19){_0x2fc7e0=_0xbe8c19;_0x2c0a57[_0xd494('0x35')]=_[_0xd494('0x4c')](db[_0xd494('0x58')]['rawAttributes']);_0x2c0a57[_0xd494('0x36')]=_[_0xd494('0x4c')](_0x13146f[_0xd494('0x36')]);_0x2c0a57[_0xd494('0x37')]=_['intersection'](_0x2c0a57[_0xd494('0x35')],_0x2c0a57[_0xd494('0x36')]);_0x3bce81[_0xd494('0x3b')]=_[_0xd494('0x38')](_0x2c0a57[_0xd494('0x35')],qs[_0xd494('0x39')](_0x13146f[_0xd494('0x36')][_0xd494('0x39')]));_0x3bce81['attributes']=_0x3bce81['attributes'][_0xd494('0x3a')]?_0x3bce81[_0xd494('0x3b')]:_0x2c0a57[_0xd494('0x35')];_0x3bce81[_0xd494('0x3e')]=qs[_0xd494('0x3f')](_0x13146f[_0xd494('0x36')][_0xd494('0x3f')]);_0x3bce81[_0xd494('0x40')]=qs[_0xd494('0x37')](_[_0xd494('0x41')](_0x13146f[_0xd494('0x36')],_0x2c0a57[_0xd494('0x37')]));if(_0x13146f['query']['filter']){_0x3bce81['where']=_[_0xd494('0x43')](_0x3bce81[_0xd494('0x40')],{'$or':_[_0xd494('0x30')](_0x3bce81['attributes'],function(_0x13f0dc){var _0x1b7d1a={};_0x1b7d1a[_0x13f0dc]={'$like':'%'+_0x13146f[_0xd494('0x36')][_0xd494('0x42')]+'%'};return _0x1b7d1a;})});}_0x3bce81=_['merge']({},_0x3bce81,_0x13146f[_0xd494('0x45')]);return _0x2fc7e0[_0xd494('0x56')](_0x3bce81);}})[_0xd494('0x2a')](function(_0x54f9d6){if(_0x54f9d6){_0x1915c6=_0x54f9d6['length'];if(!_0x13146f[_0xd494('0x36')]['hasOwnProperty'](_0xd494('0x3d'))){_0x3bce81[_0xd494('0x23')]=qs[_0xd494('0x23')](_0x13146f[_0xd494('0x36')][_0xd494('0x23')]);_0x3bce81[_0xd494('0x22')]=qs['offset'](_0x13146f[_0xd494('0x36')][_0xd494('0x22')]);}return _0x2fc7e0[_0xd494('0x56')](_0x3bce81);}})[_0xd494('0x2a')](function(_0x38330e){if(_0x38330e){return _0x38330e?{'count':_0x1915c6,'rows':_0x38330e}:null;}})[_0xd494('0x2a')](respondWithResult(_0x46f6c1,null))[_0xd494('0x49')](handleError(_0x46f6c1,null));};exports[_0xd494('0x59')]=function(_0x489c4f,_0x470e83,_0x26ce1e){return db[_0xd494('0x31')][_0xd494('0x4e')]({'where':{'id':_0x489c4f[_0xd494('0x4b')]['id']}})[_0xd494('0x2a')](handleEntityNotFound(_0x470e83,null))[_0xd494('0x2a')](function(_0x29efc7){if(_0x29efc7){return _0x29efc7[_0xd494('0x59')](_0x489c4f[_0xd494('0x36')]['ids']);}})[_0xd494('0x2a')](respondWithStatusCode(_0x470e83,null))[_0xd494('0x49')](handleError(_0x470e83,null));};exports[_0xd494('0x5a')]=function(_0x3f82b8,_0x1cbb4f,_0x57ab03){if(_0x3f82b8[_0xd494('0x50')]['id']){delete _0x3f82b8[_0xd494('0x50')]['id'];}return db['ChatGroup'][_0xd494('0x4e')]({'where':{'id':_0x3f82b8[_0xd494('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cbb4f,null))[_0xd494('0x2a')](function(_0x24173c){if(_0x24173c){_0x3f82b8[_0xd494('0x50')][_0xd494('0x5b')]=_0x24173c['id'];return db[_0xd494('0x5c')][_0xd494('0x4f')](_0x3f82b8[_0xd494('0x50')]);}})[_0xd494('0x2a')](respondWithResult(_0x1cbb4f,null))[_0xd494('0x49')](handleError(_0x1cbb4f,null));};exports[_0xd494('0x5d')]=function(_0x189298,_0x3e1430,_0x14b0ce){var _0x13dcf8={};var _0x53f53a={};var _0x49774b;var _0x2d85ee;return db[_0xd494('0x31')][_0xd494('0x57')]({'where':{'id':_0x189298[_0xd494('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e1430,null))['then'](function(_0x314647){if(_0x314647){_0x49774b=_0x314647;_0x53f53a['model']=_[_0xd494('0x4c')](db[_0xd494('0x5c')][_0xd494('0x5e')]);_0x53f53a[_0xd494('0x36')]=_[_0xd494('0x4c')](_0x189298[_0xd494('0x36')]);_0x53f53a[_0xd494('0x37')]=_[_0xd494('0x38')](_0x53f53a[_0xd494('0x35')],_0x53f53a[_0xd494('0x36')]);_0x13dcf8[_0xd494('0x3b')]=_[_0xd494('0x38')](_0x53f53a['model'],qs['fields'](_0x189298[_0xd494('0x36')]['fields']));_0x13dcf8[_0xd494('0x3b')]=_0x13dcf8['attributes'][_0xd494('0x3a')]?_0x13dcf8[_0xd494('0x3b')]:_0x53f53a['model'];_0x13dcf8[_0xd494('0x3e')]=qs['sort'](_0x189298['query'][_0xd494('0x3f')]);_0x13dcf8[_0xd494('0x40')]=qs[_0xd494('0x37')](_['pick'](_0x189298[_0xd494('0x36')],_0x53f53a['filters']));if(_0x189298[_0xd494('0x36')]['filter']){_0x13dcf8[_0xd494('0x40')]=_[_0xd494('0x43')](_0x13dcf8[_0xd494('0x40')],{'$or':_[_0xd494('0x30')](_0x13dcf8['attributes'],function(_0x11ab8a){var _0x486944={};_0x486944[_0x11ab8a]={'$like':'%'+_0x189298[_0xd494('0x36')][_0xd494('0x42')]+'%'};return _0x486944;})});}if(_0x189298[_0xd494('0x36')]['$gte']){var _0x36ef9f=_0x189298[_0xd494('0x36')][_0xd494('0x5f')]['split'](',');var _0x3c57d9={};_0x3c57d9[_0x36ef9f[0x0]]={'$gte':moment(_0x36ef9f[0x1])[_0xd494('0x60')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13dcf8['where']=_[_0xd494('0x43')](_0x13dcf8[_0xd494('0x40')],_0x3c57d9);}_0x13dcf8=_[_0xd494('0x43')]({},_0x13dcf8,_0x189298[_0xd494('0x45')]);return _0x49774b[_0xd494('0x5d')](_0x13dcf8);}})[_0xd494('0x2a')](function(_0x3dced9){if(_0x3dced9){_0x2d85ee=_0x3dced9['length'];if(!_0x189298[_0xd494('0x36')][_0xd494('0x3c')]('nolimit')){_0x13dcf8[_0xd494('0x23')]=qs[_0xd494('0x23')](_0x189298[_0xd494('0x36')][_0xd494('0x23')]);_0x13dcf8[_0xd494('0x22')]=qs[_0xd494('0x22')](_0x189298['query'][_0xd494('0x22')]);}return _0x49774b[_0xd494('0x5d')](_0x13dcf8);}})[_0xd494('0x2a')](function(_0x2f9332){if(_0x2f9332){return _0x2f9332?{'count':_0x2d85ee,'rows':_0x2f9332}:null;}})[_0xd494('0x2a')](respondWithResult(_0x3e1430,null))[_0xd494('0x49')](handleError(_0x3e1430,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fcf2c7f..82abe47 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 _0xcaf1=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0xcaf1,0x82));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x1caf('0x0'))['db'][_0x1caf('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1caf('0x2')](0x0);var events={'afterCreate':_0x1caf('0x3'),'afterUpdate':_0x1caf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56a487){return function(_0x238dc4,_0xb5de2b,_0x249f41){ChatGroupEvents[_0x1caf('0x5')](_0x56a487+':'+_0x238dc4['id'],_0x238dc4);ChatGroupEvents[_0x1caf('0x5')](_0x56a487,_0x238dc4);_0x249f41(null);};}for(var e in events){if(events[_0x1caf('0x6')](e)){var event=events[e];ChatGroup[_0x1caf('0x7')](e,emitEvent(event));}}module[_0x1caf('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x4325=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x5432('0x0'));var ChatGroup=require(_0x5432('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5432('0x2')](0x0);var events={'afterCreate':_0x5432('0x3'),'afterUpdate':_0x5432('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fc4e9){return function(_0x20f704,_0x36ce53,_0xad26e9){ChatGroupEvents['emit'](_0x4fc4e9+':'+_0x20f704['id'],_0x20f704);ChatGroupEvents[_0x5432('0x5')](_0x4fc4e9,_0x20f704);_0xad26e9(null);};}for(var e in events){if(events[_0x5432('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5432('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 44569cb..89451ce 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 _0x84fb=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fc7fc,_0x5d6d06){var _0x5e945e=function(_0x1bb78d){while(--_0x1bb78d){_0x4fc7fc['push'](_0x4fc7fc['shift']());}};_0x5e945e(++_0x5d6d06);}(_0x84fb,0x156));var _0xb84f=function(_0x5cedd4,_0xa8a678){_0x5cedd4=_0x5cedd4-0x0;var _0x2867e4=_0x84fb[_0x5cedd4];return _0x2867e4;};'use strict';var _=require(_0xb84f('0x0'));var util=require('util');var logger=require(_0xb84f('0x1'))(_0xb84f('0x2'));var moment=require(_0xb84f('0x3'));var BPromise=require(_0xb84f('0x4'));var rp=require(_0xb84f('0x5'));var fs=require('fs');var path=require(_0xb84f('0x6'));var rimraf=require(_0xb84f('0x7'));var config=require(_0xb84f('0x8'));var attributes=require(_0xb84f('0x9'));module[_0xb84f('0xa')]=function(_0x45230d,_0x117ff4){return _0x45230d[_0xb84f('0xb')](_0xb84f('0xc'),attributes,{'tableName':_0xb84f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcc8=['bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','util','../../config/logger'];(function(_0x3a6614,_0x223d00){var _0x2f4156=function(_0x4b222c){while(--_0x4b222c){_0x3a6614['push'](_0x3a6614['shift']());}};_0x2f4156(++_0x223d00);}(_0xfcc8,0x1d4));var _0x8fcc=function(_0x3acbb7,_0x232526){_0x3acbb7=_0x3acbb7-0x0;var _0x4681f8=_0xfcc8[_0x3acbb7];return _0x4681f8;};'use strict';var _=require('lodash');var util=require(_0x8fcc('0x0'));var logger=require(_0x8fcc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8fcc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fcc('0x3'));var rimraf=require(_0x8fcc('0x4'));var config=require(_0x8fcc('0x5'));var attributes=require(_0x8fcc('0x6'));module[_0x8fcc('0x7')]=function(_0x2d84c6,_0x1b743d){return _0x2d84c6[_0x8fcc('0x8')](_0x8fcc('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 560b83a..7a1bfd7 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 _0x7d86=['./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x125358,_0xdcae13){var _0x55fe56=function(_0x3db609){while(--_0x3db609){_0x125358['push'](_0x125358['shift']());}};_0x55fe56(++_0xdcae13);}(_0x7d86,0x86));var _0x67d8=function(_0x28b720,_0x501c54){_0x28b720=_0x28b720-0x0;var _0x1e5657=_0x7d86[_0x28b720];return _0x1e5657;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var moment=require(_0x67d8('0x1'));var BPromise=require(_0x67d8('0x2'));var rs=require(_0x67d8('0x3'));var fs=require('fs');var Redis=require(_0x67d8('0x4'));var db=require(_0x67d8('0x5'))['db'];var utils=require(_0x67d8('0x6'));var logger=require(_0x67d8('0x7'))('rpc');var config=require(_0x67d8('0x8'));var jayson=require(_0x67d8('0x9'));var client=jayson[_0x67d8('0xa')][_0x67d8('0xb')]({'port':0x232a});config[_0x67d8('0xc')]=_[_0x67d8('0xd')](config[_0x67d8('0xc')],{'host':_0x67d8('0xe'),'port':0x18eb});var socket=require(_0x67d8('0xf'))(new Redis(config[_0x67d8('0xc')]));require(_0x67d8('0x10'))[_0x67d8('0x11')](socket);function respondWithRpcPromise(_0x243de2,_0x265552,_0x2b1fe6){return new BPromise(function(_0x47382c,_0x2e5a0f){return client[_0x67d8('0x12')](_0x243de2,_0x2b1fe6)[_0x67d8('0x13')](function(_0x46b7f8){logger[_0x67d8('0x14')]('ChatGroup,\x20%s,\x20%s',_0x265552,_0x67d8('0x15'));logger[_0x67d8('0x16')](_0x67d8('0x17'),_0x265552,'request\x20sent',JSON[_0x67d8('0x18')](_0x46b7f8));if(_0x46b7f8[_0x67d8('0x19')]){if(_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1a')]===0x1f4){logger[_0x67d8('0x19')](_0x67d8('0x1b'),_0x265552,_0x46b7f8[_0x67d8('0x19')]['message']);return _0x2e5a0f(_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1c')]);}logger[_0x67d8('0x19')]('ChatGroup,\x20%s,\x20%s',_0x265552,_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1c')]);return _0x47382c(_0x46b7f8['error'][_0x67d8('0x1c')]);}else{logger[_0x67d8('0x14')](_0x67d8('0x1b'),_0x265552,_0x67d8('0x15'));_0x47382c(_0x46b7f8[_0x67d8('0x1d')][_0x67d8('0x1c')]);}})['catch'](function(_0x3de8d1){logger[_0x67d8('0x19')](_0x67d8('0x1b'),_0x265552,_0x3de8d1);_0x2e5a0f(_0x3de8d1);});});} \ No newline at end of file +var _0x24e2=['./chatGroup.socket','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x237299,_0x3a8fa2){var _0x3b67b3=function(_0x2f2473){while(--_0x2f2473){_0x237299['push'](_0x237299['shift']());}};_0x3b67b3(++_0x3a8fa2);}(_0x24e2,0x1c1));var _0x224e=function(_0x257449,_0x81fb2e){_0x257449=_0x257449-0x0;var _0x364642=_0x24e2[_0x257449];return _0x364642;};'use strict';var _=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var moment=require('moment');var BPromise=require(_0x224e('0x2'));var rs=require(_0x224e('0x3'));var fs=require('fs');var Redis=require(_0x224e('0x4'));var db=require(_0x224e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x224e('0x6'))(_0x224e('0x7'));var config=require(_0x224e('0x8'));var jayson=require(_0x224e('0x9'));var client=jayson['client'][_0x224e('0xa')]({'port':0x232a});config[_0x224e('0xb')]=_[_0x224e('0xc')](config['redis'],{'host':_0x224e('0xd'),'port':0x18eb});var socket=require(_0x224e('0xe'))(new Redis(config[_0x224e('0xb')]));require(_0x224e('0xf'))['register'](socket);function respondWithRpcPromise(_0x265f5f,_0x4a38a1,_0xaad45e){return new BPromise(function(_0x386aaa,_0x5dd71d){return client[_0x224e('0x10')](_0x265f5f,_0xaad45e)[_0x224e('0x11')](function(_0x91afc3){logger[_0x224e('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4a38a1,'request\x20sent');logger[_0x224e('0x13')](_0x224e('0x14'),_0x4a38a1,_0x224e('0x15'),JSON[_0x224e('0x16')](_0x91afc3));if(_0x91afc3[_0x224e('0x17')]){if(_0x91afc3[_0x224e('0x17')][_0x224e('0x18')]===0x1f4){logger[_0x224e('0x17')](_0x224e('0x19'),_0x4a38a1,_0x91afc3[_0x224e('0x17')][_0x224e('0x1a')]);return _0x5dd71d(_0x91afc3[_0x224e('0x17')][_0x224e('0x1a')]);}logger['error'](_0x224e('0x19'),_0x4a38a1,_0x91afc3['error'][_0x224e('0x1a')]);return _0x386aaa(_0x91afc3[_0x224e('0x17')][_0x224e('0x1a')]);}else{logger[_0x224e('0x12')](_0x224e('0x19'),_0x4a38a1,_0x224e('0x15'));_0x386aaa(_0x91afc3[_0x224e('0x1b')][_0x224e('0x1a')]);}})[_0x224e('0x1c')](function(_0x1876a7){logger[_0x224e('0x17')](_0x224e('0x19'),_0x4a38a1,_0x1876a7);_0x5dd71d(_0x1876a7);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bfbe3e4..fb41fe5 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 _0x271c=['removeListener','length','chatGroup:','./chatGroup.events','save','remove','emit'];(function(_0x244a18,_0x48c537){var _0x56975a=function(_0x19f7f5){while(--_0x19f7f5){_0x244a18['push'](_0x244a18['shift']());}};_0x56975a(++_0x48c537);}(_0x271c,0x6c));var _0xc271=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x271c[_0x21a9d9];return _0x46adce;};'use strict';var ChatGroupEvents=require(_0xc271('0x0'));var events=[_0xc271('0x1'),_0xc271('0x2'),'update'];function createListener(_0x21c1e3,_0x14de30){return function(_0x3004b1){_0x14de30[_0xc271('0x3')](_0x21c1e3,_0x3004b1);};}function removeListener(_0x91c3f1,_0x1a7e71){return function(){ChatGroupEvents[_0xc271('0x4')](_0x91c3f1,_0x1a7e71);};}exports['register']=function(_0x13612f){for(var _0x4eb96a=0x0,_0x1ac247=events[_0xc271('0x5')];_0x4eb96a<_0x1ac247;_0x4eb96a++){var _0x280a1c=events[_0x4eb96a];var _0x3fec59=createListener(_0xc271('0x6')+_0x280a1c,_0x13612f);ChatGroupEvents['on'](_0x280a1c,_0x3fec59);}}; \ No newline at end of file +var _0xe661=['remove','update','chatGroup:','save'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xe661,0x1d3));var _0x1e66=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe661[_0x1facfa];return _0x9ec701;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x1e66('0x0'),_0x1e66('0x1'),_0x1e66('0x2')];function createListener(_0x324978,_0x5689c4){return function(_0x16b1ee){_0x5689c4['emit'](_0x324978,_0x16b1ee);};}function removeListener(_0x103efd,_0x2d1576){return function(){ChatGroupEvents['removeListener'](_0x103efd,_0x2d1576);};}exports['register']=function(_0x449e09){for(var _0x126bba=0x0,_0x56e541=events['length'];_0x126bba<_0x56e541;_0x126bba++){var _0x4da776=events[_0x126bba];var _0x40497f=createListener(_0x1e66('0x3')+_0x4da776,_0x449e09);ChatGroupEvents['on'](_0x4da776,_0x40497f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 034937e..bd9b94e 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 _0x691a=['index','isAuthenticated','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0xe45e25,_0x34c0de){var _0x117a58=function(_0x3d6237){while(--_0x3d6237){_0xe45e25['push'](_0xe45e25['shift']());}};_0x117a58(++_0x34c0de);}(_0x691a,0x1c2));var _0xa691=function(_0x512842,_0x1ca79c){_0x512842=_0x512842-0x0;var _0x471291=_0x691a[_0x512842];return _0x471291;};'use strict';var multer=require(_0xa691('0x0'));var util=require('util');var path=require(_0xa691('0x1'));var timeout=require(_0xa691('0x2'));var express=require(_0xa691('0x3'));var router=express[_0xa691('0x4')]();var fs_extra=require(_0xa691('0x5'));var auth=require(_0xa691('0x6'));var interaction=require(_0xa691('0x7'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xa691('0x8')]('/',auth['isAuthenticated'](),controller[_0xa691('0x9')]);router['get']('/describe',auth[_0xa691('0xa')](),controller['describe']);router[_0xa691('0x8')](_0xa691('0xb'),auth[_0xa691('0xa')](),controller['show']);router[_0xa691('0x8')](_0xa691('0xc'),auth[_0xa691('0xa')](),controller[_0xa691('0xd')]);router[_0xa691('0x8')](_0xa691('0xe'),auth[_0xa691('0xa')](),controller[_0xa691('0xf')]);router['get'](_0xa691('0x10'),auth[_0xa691('0xa')](),controller[_0xa691('0x11')]);router[_0xa691('0x12')]('/',auth[_0xa691('0xa')](),controller[_0xa691('0x13')]);router[_0xa691('0x12')](_0xa691('0xe'),auth['isAuthenticated'](),controller[_0xa691('0x14')]);router[_0xa691('0x12')](_0xa691('0x10'),auth[_0xa691('0xa')](),controller[_0xa691('0x15')]);router[_0xa691('0x16')](_0xa691('0xb'),auth['isAuthenticated'](),controller[_0xa691('0x17')]);router[_0xa691('0x18')]('/:id',auth[_0xa691('0xa')](),controller[_0xa691('0x19')]);router[_0xa691('0x18')](_0xa691('0xe'),auth[_0xa691('0xa')](),controller['removeMembers']);module[_0xa691('0x1a')]=router; \ No newline at end of file +var _0x7c6b=['getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x7c6b,0x13d));var _0xb7c6=function(_0x184abd,_0x3bf822){_0x184abd=_0x184abd-0x0;var _0x48e2e0=_0x7c6b[_0x184abd];return _0x48e2e0;};'use strict';var multer=require('multer');var util=require(_0xb7c6('0x0'));var path=require(_0xb7c6('0x1'));var timeout=require(_0xb7c6('0x2'));var express=require('express');var router=express[_0xb7c6('0x3')]();var fs_extra=require(_0xb7c6('0x4'));var auth=require(_0xb7c6('0x5'));var interaction=require(_0xb7c6('0x6'));var config=require(_0xb7c6('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x9')]);router['get'](_0xb7c6('0xa'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0xb')]);router[_0xb7c6('0xc')](_0xb7c6('0xd'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0xe')]);router[_0xb7c6('0xc')](_0xb7c6('0xf'),auth[_0xb7c6('0x8')](),controller['getUnread']);router[_0xb7c6('0xc')](_0xb7c6('0x10'),auth['isAuthenticated'](),controller[_0xb7c6('0x11')]);router[_0xb7c6('0xc')](_0xb7c6('0x12'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x13')]);router[_0xb7c6('0x14')]('/',auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x15')]);router[_0xb7c6('0x14')](_0xb7c6('0x10'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x16')]);router['post'](_0xb7c6('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0xb7c6('0x17')](_0xb7c6('0xd'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x18')]);router[_0xb7c6('0x19')](_0xb7c6('0xd'),auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x1a')]);router[_0xb7c6('0x19')]('/:id/members',auth[_0xb7c6('0x8')](),controller[_0xb7c6('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1fba060..c02b8ee 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 _0xdf8b=['INTEGER','sequelize','exports','BOOLEAN','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xdf8b,0x1af));var _0xbdf8=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xdf8b[_0x209ec9];return _0x129b1b;};'use strict';var Sequelize=require(_0xbdf8('0x0'));module[_0xbdf8('0x1')]={'closed':{'type':Sequelize[_0xbdf8('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xbdf8('0x3')]('star','thumb'),'defaultValue':_0xbdf8('0x4')},'ratingMessage':{'type':Sequelize[_0xbdf8('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xbdf8('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbdf8('0x7')]},'disposition':{'type':Sequelize[_0xbdf8('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbdf8('0x6')]},'note':{'type':Sequelize[_0xbdf8('0x6')]},'browserName':{'type':Sequelize[_0xbdf8('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xbdf8('0x5')]},'customerIp':{'type':Sequelize[_0xbdf8('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xbdf8('0x8'))},'read1stAt':{'type':Sequelize[_0xbdf8('0x7')]},'lastMsgAt':{'type':Sequelize[_0xbdf8('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbdf8('0x6')]},'customerPort':{'type':Sequelize[_0xbdf8('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xbdf8('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xbdf8('0x9')]}}; \ No newline at end of file +var _0xab55=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','exports','BOOLEAN'];(function(_0x356596,_0x1a1a8c){var _0x231fa9=function(_0x2b0a09){while(--_0x2b0a09){_0x356596['push'](_0x356596['shift']());}};_0x231fa9(++_0x1a1a8c);}(_0xab55,0xda));var _0x5ab5=function(_0x1863b7,_0x5dbb7d){_0x1863b7=_0x1863b7-0x0;var _0xf1cbbc=_0xab55[_0x1863b7];return _0xf1cbbc;};'use strict';var Sequelize=require('sequelize');module[_0x5ab5('0x0')]={'closed':{'type':Sequelize[_0x5ab5('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5ab5('0x2')]},'ratingType':{'type':Sequelize[_0x5ab5('0x3')](_0x5ab5('0x4'),_0x5ab5('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x5ab5('0x6')]},'mailTranscript':{'type':Sequelize[_0x5ab5('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5ab5('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5ab5('0x7')]},'thirdDisposition':{'type':Sequelize[_0x5ab5('0x7')]},'note':{'type':Sequelize[_0x5ab5('0x7')]},'browserName':{'type':Sequelize[_0x5ab5('0x7')]},'browserVersion':{'type':Sequelize[_0x5ab5('0x7')]},'osName':{'type':Sequelize[_0x5ab5('0x7')]},'osVersion':{'type':Sequelize[_0x5ab5('0x7')]},'deviceModel':{'type':Sequelize[_0x5ab5('0x7')]},'deviceVendor':{'type':Sequelize[_0x5ab5('0x7')]},'deviceType':{'type':Sequelize[_0x5ab5('0x7')]},'referer':{'type':Sequelize[_0x5ab5('0x6')]},'customerIp':{'type':Sequelize[_0x5ab5('0x7')]},'formData':{'type':Sequelize[_0x5ab5('0x6')](_0x5ab5('0x9'))},'read1stAt':{'type':Sequelize[_0x5ab5('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5ab5('0x7')]},'customerPort':{'type':Sequelize[_0x5ab5('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a1b36d2..c78d35e 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 _0xa567=['file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','basename','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','ContactId','%s%d','System','Visitor','agentIdentifier','agentAlias','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','push','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','files','server','transcript-%d-%s.zip','Contact','lastName','attachments','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','ChatInteraction,\x20%s,\x20%s','result','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','stack','name','merge','body','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','user','catch','show','params','model','keys','filters','intersection','attributes','fields','query','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','contact','account','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload'];(function(_0x116549,_0x210e8b){var _0x1321e5=function(_0x413542){while(--_0x413542){_0x116549['push'](_0x116549['shift']());}};_0x1321e5(++_0x210e8b);}(_0xa567,0x6b));var _0x7a56=function(_0x26601b,_0x154b3a){_0x26601b=_0x26601b-0x0;var _0x518c0c=_0xa567[_0x26601b];return _0x518c0c;};'use strict';var rimraf=require(_0x7a56('0x0'));var zipdir=require('zip-dir');var rp=require(_0x7a56('0x1'));var moment=require(_0x7a56('0x2'));var BPromise=require(_0x7a56('0x3'));var Mustache=require(_0x7a56('0x4'));var util=require(_0x7a56('0x5'));var path=require(_0x7a56('0x6'));var ejs=require(_0x7a56('0x7'));var fs=require('fs');var _=require(_0x7a56('0x8'));var Redis=require(_0x7a56('0x9'));var interaction=require(_0x7a56('0xa'));var qs=require(_0x7a56('0xb'));var pdf=require(_0x7a56('0xc'));var logger=require('../../config/logger')(_0x7a56('0xd'));var config=require(_0x7a56('0xe'));var db=require(_0x7a56('0xf'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a56('0x10'))[_0x7a56('0x11')](socket);var jayson=require(_0x7a56('0x12'));var client=jayson[_0x7a56('0x13')][_0x7a56('0x14')]({'port':0x232b});var client9004=jayson[_0x7a56('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2406ed,_0x1c98cd,_0x26de36,_0x5bf243){return new BPromise(function(_0x544242,_0x415989){var _0x39f953=_0x5bf243||client;return _0x39f953[_0x7a56('0x15')](_0x2406ed,_0x26de36)[_0x7a56('0x16')](function(_0x41c8d3){logger[_0x7a56('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x1c98cd,'request\x20sent');logger[_0x7a56('0x18')](_0x7a56('0x19'),_0x1c98cd,_0x7a56('0x1a'),JSON[_0x7a56('0x1b')](_0x41c8d3));if(_0x41c8d3['error']){if(_0x41c8d3['error'][_0x7a56('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1c98cd,_0x41c8d3['error'][_0x7a56('0x1d')]);return _0x415989(_0x41c8d3[_0x7a56('0x1e')][_0x7a56('0x1d')]);}logger[_0x7a56('0x1e')](_0x7a56('0x1f'),_0x1c98cd,_0x41c8d3[_0x7a56('0x1e')][_0x7a56('0x1d')]);return _0x544242(_0x41c8d3['error'][_0x7a56('0x1d')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x1c98cd,_0x7a56('0x1a'));_0x544242(_0x41c8d3[_0x7a56('0x20')][_0x7a56('0x1d')]);}})['catch'](function(_0x500b02){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1c98cd,_0x500b02);_0x415989(_0x500b02);});});}function respondWithStatusCode(_0x4b6ab7,_0x16ac83){_0x16ac83=_0x16ac83||0xcc;return function(_0x547848){if(_0x547848){return _0x4b6ab7['sendStatus'](_0x16ac83);}return _0x4b6ab7[_0x7a56('0x21')](_0x16ac83)[_0x7a56('0x22')]();};}function respondWithResult(_0x15fe58,_0x44f2a9){_0x44f2a9=_0x44f2a9||0xc8;return function(_0x5bdac5){if(_0x5bdac5){return _0x15fe58[_0x7a56('0x21')](_0x44f2a9)[_0x7a56('0x23')](_0x5bdac5);}};}function respondWithFilteredResult(_0x488d4a,_0x13bdbe){return function(_0x54b8b4){if(_0x54b8b4){var _0x59e173=typeof _0x13bdbe[_0x7a56('0x24')]===_0x7a56('0x25')&&typeof _0x13bdbe['limit']===_0x7a56('0x25');var _0x446e89=_0x54b8b4[_0x7a56('0x26')];var _0xe4b56=_0x59e173?0x0:_0x13bdbe[_0x7a56('0x24')];var _0x5a92b8=_0x59e173?_0x54b8b4[_0x7a56('0x26')]:_0x13bdbe['offset']+_0x13bdbe['limit'];var _0x5acb05;if(_0x5a92b8>=_0x446e89){_0x5a92b8=_0x446e89;_0x5acb05=0xc8;}else{_0x5acb05=0xce;}_0x488d4a['status'](_0x5acb05);return _0x488d4a[_0x7a56('0x27')](_0x7a56('0x28'),_0xe4b56+'-'+_0x5a92b8+'/'+_0x446e89)[_0x7a56('0x23')](_0x54b8b4);}return null;};}function saveUpdates(_0x2a3630){return function(_0xd9a257){if(_0xd9a257){return _0xd9a257[_0x7a56('0x29')](_0x2a3630)['then'](function(_0x27b99a){return _0x27b99a;});}return null;};}function removeEntity(_0x4e7828){return function(_0x5182f8){if(_0x5182f8){return _0x5182f8[_0x7a56('0x2a')]()[_0x7a56('0x16')](function(){_0x4e7828['status'](0xcc)[_0x7a56('0x22')]();});}};}function handleEntityNotFound(_0x5a6719){return function(_0x244455){if(!_0x244455){_0x5a6719['sendStatus'](0x194);}return _0x244455;};}function handleError(_0x21e22d,_0x4a9f40){_0x4a9f40=_0x4a9f40||0x1f4;return function(_0x301c53){logger[_0x7a56('0x1e')](_0x301c53[_0x7a56('0x2b')]);if(_0x301c53[_0x7a56('0x2c')]){delete _0x301c53[_0x7a56('0x2c')];}_0x21e22d['status'](_0x4a9f40)['send'](_0x301c53);};}function getMustacheRender(_0x3c336d,_0x5e1baf){return Mustache['render'](_0x3c336d,_[_0x7a56('0x2d')](_0x5e1baf[_0x7a56('0x2e')],{'contact':_0x5e1baf['contact'],'message':_0x5e1baf[_0x7a56('0x1d')],'agent':_0x5e1baf[_0x7a56('0x2f')],'interaction':_0x5e1baf[_0x7a56('0x30')],'account':_0x5e1baf['account']}))||'';}exports[_0x7a56('0x31')]=function(_0x4cb8b4,_0x31e5e5){var _0x5245b9={};var _0x25b0c8=_[_0x7a56('0x32')](db[_0x7a56('0x33')][_0x7a56('0x34')],function(_0x3bd6e2){return{'name':_0x3bd6e2[_0x7a56('0x35')],'type':_0x3bd6e2[_0x7a56('0x36')][_0x7a56('0x37')]};});_0x5245b9=qs['getOptions'](_0x25b0c8,_0x4cb8b4);return interaction['findAll']('chat',_0x4cb8b4['query'],_0x4cb8b4[_0x7a56('0x38')],_0x5245b9,_0x25b0c8)[_0x7a56('0x16')](respondWithFilteredResult(_0x31e5e5,_0x5245b9))[_0x7a56('0x39')](handleError(_0x31e5e5,null));};exports[_0x7a56('0x3a')]=function(_0x1962d5,_0x258bc6){var _0xc43a1b={'raw':![],'where':{'id':_0x1962d5[_0x7a56('0x3b')]['id']}},_0x223e00={};_0x223e00[_0x7a56('0x3c')]=_[_0x7a56('0x3d')](db[_0x7a56('0x33')][_0x7a56('0x34')]);_0x223e00['query']=_['keys'](_0x1962d5['query']);_0x223e00[_0x7a56('0x3e')]=_[_0x7a56('0x3f')](_0x223e00[_0x7a56('0x3c')],_0x223e00['query']);_0xc43a1b[_0x7a56('0x40')]=_[_0x7a56('0x3f')](_0x223e00[_0x7a56('0x3c')],qs[_0x7a56('0x41')](_0x1962d5[_0x7a56('0x42')][_0x7a56('0x41')]));_0xc43a1b['attributes']=_0xc43a1b['attributes']['length']?_0xc43a1b[_0x7a56('0x40')]:_0x223e00['model'];if(_0x1962d5['query'][_0x7a56('0x43')]){_0xc43a1b[_0x7a56('0x44')]=[{'all':!![]}];}_0xc43a1b=_[_0x7a56('0x2d')]({},_0xc43a1b,_0x1962d5[_0x7a56('0x45')]);return db[_0x7a56('0x33')][_0x7a56('0x46')](_0xc43a1b)[_0x7a56('0x16')](handleEntityNotFound(_0x258bc6,null))[_0x7a56('0x16')](respondWithResult(_0x258bc6,null))[_0x7a56('0x39')](handleError(_0x258bc6,null));};exports[_0x7a56('0x47')]=function(_0x2ab914,_0x6b2e49){return db[_0x7a56('0x33')][_0x7a56('0x47')](_0x2ab914[_0x7a56('0x2e')],{})[_0x7a56('0x16')](respondWithResult(_0x6b2e49,0xc9))[_0x7a56('0x39')](handleError(_0x6b2e49,null));};exports[_0x7a56('0x29')]=function(_0x469178,_0x1dab28){if(_0x469178[_0x7a56('0x2e')]['id']){delete _0x469178[_0x7a56('0x2e')]['id'];}return db[_0x7a56('0x33')][_0x7a56('0x46')]({'where':{'id':_0x469178['params']['id']}})['then'](handleEntityNotFound(_0x1dab28,null))[_0x7a56('0x16')](saveUpdates(_0x469178['body'],null))['then'](respondWithResult(_0x1dab28,null))['catch'](handleError(_0x1dab28,null));};exports[_0x7a56('0x2a')]=function(_0x5e4379,_0x504330){return db[_0x7a56('0x33')]['find']({'where':{'id':_0x5e4379['params']['id']}})[_0x7a56('0x16')](handleEntityNotFound(_0x504330,null))[_0x7a56('0x16')](removeEntity(_0x504330,null))[_0x7a56('0x39')](handleError(_0x504330,null));};exports['describe']=function(_0x13f388,_0x1a6ecf){return db['ChatInteraction'][_0x7a56('0x48')]()[_0x7a56('0x16')](respondWithResult(_0x1a6ecf,null))[_0x7a56('0x39')](handleError(_0x1a6ecf,null));};exports[_0x7a56('0x49')]=function(_0x17081f,_0x5e7316){var _0x55f47b=_0x17081f[_0x7a56('0x3b')]['id'];var _0x120b8a;var _0x37fe97;var _0x29a536;return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x55f47b}})[_0x7a56('0x16')](function(_0x3bfc05){_0x120b8a=_0x3bfc05;return db[_0x7a56('0x4b')][_0x7a56('0x4a')]({'where':{'id':_0x3bfc05[_0x7a56('0x4c')]},'attributes':['id',_0x7a56('0x4d'),_0x7a56('0x4e'),_0x7a56('0x4f'),_0x7a56('0x50'),_0x7a56('0x51')],'raw':!![]});})['then'](function(_0x3e025d){if(_0x3e025d&&_0x3e025d['vidaooApiKey']&&_0x3e025d['vidaooEscalation']){_0x37fe97=_0x3e025d;var _0x35f8aa={'interaction':{'id':_0x55f47b},'agent':{'id':_0x17081f[_0x7a56('0x38')]['id'],'name':_0x17081f[_0x7a56('0x38')]['name'],'fullname':_0x17081f['user']['fullname'],'email':_0x17081f[_0x7a56('0x38')]['email']},'contact':_0x17081f[_0x7a56('0x2e')][_0x7a56('0x52')],'account':_0x17081f[_0x7a56('0x2e')][_0x7a56('0x53')]};var _0x1f1688={'rejectUnauthorized':![],'method':'POST','url':_0x7a56('0x54'),'headers':{'X-APIKEY':_0x3e025d[_0x7a56('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x17081f['user']['email']],'buttons':null,'topic':_0x37fe97[_0x7a56('0x4f')],'note':_['isNull'](_0x37fe97['vidaooNote'])?null:getMustacheRender(_0x37fe97['vidaooNote'],_0x35f8aa),'metadata':null},'redirect':_0x7a56('0x55'),'json':!![]};try{if(!_[_0x7a56('0x56')](_0x37fe97[_0x7a56('0x51')])){var _0x9b37dd=getMustacheRender(_0x37fe97[_0x7a56('0x51')],_0x35f8aa);var _0x184454=JSON['parse'](_0x9b37dd);_0x1f1688['body'][_0x7a56('0x57')]=_0x184454;}}catch(_0x4489fc){throw new db[(_0x7a56('0x58'))][(_0x7a56('0x59'))](_0x7a56('0x5a'));}return rp(_0x1f1688);}else{throw new db[(_0x7a56('0x58'))]['ValidationError'](_0x7a56('0x5b'));}})[_0x7a56('0x16')](function(_0x104a7e){_0x29a536=_0x104a7e;if(_0x29a536['id']){var _0x15d6a7={'body':_0x29a536[_0x7a56('0x5c')],'ChatWebsiteId':_0x37fe97['id'],'ChatInteractionId':_0x120b8a['id'],'direction':_0x7a56('0x5d'),'UserId':_0x17081f[_0x7a56('0x38')]['id']};return db[_0x7a56('0x5e')][_0x7a56('0x47')](_0x15d6a7,{});}else{throw new db['Sequelize'][(_0x7a56('0x59'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7a56('0x16')](function(){return _0x120b8a['updateAttributes']({'vidaooSessionId':_0x29a536['id']});})[_0x7a56('0x16')](respondWithResult(_0x5e7316,null))[_0x7a56('0x39')](handleError(_0x5e7316,null));};exports['customUpdate']=function(_0x9923ad,_0x9aaf05){if(_0x9923ad[_0x7a56('0x2e')]['id']){delete _0x9923ad[_0x7a56('0x2e')]['id'];}return db[_0x7a56('0x33')][_0x7a56('0x46')]({'where':{'id':_0x9923ad[_0x7a56('0x3b')]['id']},'include':[{'model':db[_0x7a56('0x5f')],'as':'Contact'}]})[_0x7a56('0x16')](handleEntityNotFound(_0x9aaf05,null))[_0x7a56('0x16')](saveUpdates(_0x9923ad[_0x7a56('0x2e')],null))[_0x7a56('0x16')](respondWithResult(_0x9aaf05,null))[_0x7a56('0x39')](handleError(_0x9aaf05,null));};exports[_0x7a56('0x60')]=function(_0x26d991,_0x1cf277){if(_0x26d991[_0x7a56('0x2e')]['id']){delete _0x26d991[_0x7a56('0x2e')]['id'];}return db[_0x7a56('0x33')]['find']({'where':{'id':_0x26d991[_0x7a56('0x3b')]['id']}})[_0x7a56('0x16')](function(_0x153fd3){if(!_0x153fd3){logger[_0x7a56('0x1e')](_0x7a56('0x61'),'abandon',0x194,'entity\x20not\x20found');_0x1cf277[_0x7a56('0x62')](0x194);}else{if(_0x153fd3[_0x7a56('0x63')]){throw new db[(_0x7a56('0x58'))][(_0x7a56('0x59'))](_0x7a56('0x64'));}}return _0x153fd3;})[_0x7a56('0x16')](function(_0x30d3b6){if(_0x30d3b6){return _0x30d3b6[_0x7a56('0x29')]({'closed':_0x26d991[_0x7a56('0x2e')][_0x7a56('0x65')],'disposition':_0x26d991[_0x7a56('0x2e')][_0x7a56('0x66')]})[_0x7a56('0x16')](function(_0x1f1bd0){return _0x1f1bd0;});}})['then'](function(){return respondWithRpcPromise(_0x7a56('0x67'),_0x7a56('0x60'),_0x26d991[_0x7a56('0x2e')],client9004);})[_0x7a56('0x16')](respondWithResult(_0x1cf277,null))[_0x7a56('0x39')](handleError(_0x1cf277,null));};exports[_0x7a56('0x68')]=function(_0x4e8045,_0x1f673c){_0x4e8045[_0x7a56('0x2e')]['name']=_0x4e8045['file']['originalname'];_0x4e8045[_0x7a56('0x2e')]['basename']=_0x4e8045['file']['filename'];_0x4e8045[_0x7a56('0x2e')][_0x7a56('0x36')]=_0x4e8045[_0x7a56('0x69')][_0x7a56('0x6a')];return db[_0x7a56('0x6b')][_0x7a56('0x47')](_0x4e8045[_0x7a56('0x2e')])[_0x7a56('0x16')](respondWithResult(_0x1f673c,0xc9))[_0x7a56('0x39')](handleError(_0x1f673c,null));};exports[_0x7a56('0x6c')]=function(_0x342e93,_0x28a508){return db[_0x7a56('0x33')]['findOne']({'where':{'id':_0x342e93[_0x7a56('0x3b')]['id']},'raw':!![]})[_0x7a56('0x16')](handleEntityNotFound(_0x28a508,null))[_0x7a56('0x16')](function(_0x4ee802){if(_0x4ee802){if(_0x4ee802[_0x7a56('0x65')]){return _0x28a508[_0x7a56('0x21')](0x193)[_0x7a56('0x23')]({'status':0x193,'message':_0x7a56('0x6d')});}return db['Attachment'][_0x7a56('0x4a')]({'where':{'id':_0x342e93[_0x7a56('0x42')][_0x7a56('0x6e')]},'raw':!![]})['then'](handleEntityNotFound(_0x28a508,null));}})[_0x7a56('0x16')](function(_0x5cfb44){if(_0x5cfb44){var _0x7f6b29=_0x5cfb44['ChatOfflineMessageId']!==null;var _0x4dca5b=path[_0x7a56('0x6f')](config[_0x7a56('0x70')],_0x7a56('0x71'));if(_0x7f6b29){_0x4dca5b=path[_0x7a56('0x6f')](_0x4dca5b,'offline-chat/');}var _0x11cc9a=path[_0x7a56('0x6f')](_0x4dca5b,_0x5cfb44[_0x7a56('0x72')]);return _0x28a508['download'](_0x11cc9a);}})[_0x7a56('0x39')](handleError(_0x28a508,null));};exports[_0x7a56('0x73')]=function(_0x1494cf,_0x5a841a){var _0x3c9621=null;var _0x1ad117=null;var _0x5392e3=null;if(_0x1494cf[_0x7a56('0x2e')]['id']){delete _0x1494cf[_0x7a56('0x2e')]['id'];}if(_0x1494cf[_0x7a56('0x2e')][_0x7a56('0x74')]){_0x5392e3=path[_0x7a56('0x6f')](config['root'],_0x7a56('0x75'),util[_0x7a56('0x76')](_0x7a56('0x77'),Date['now']()));_0x1494cf['body']['pathTranscript']=_0x5392e3;}return db[_0x7a56('0x33')][_0x7a56('0x46')]({'where':{'id':_0x1494cf[_0x7a56('0x3b')]['id']},'include':[{'model':db[_0x7a56('0x5e')],'as':_0x7a56('0x78'),'include':[{'model':db[_0x7a56('0x79')],'as':_0x7a56('0x79')}]}]})['then'](handleEntityNotFound(_0x5a841a,null))['then'](saveUpdates(_0x1494cf['body'],null))[_0x7a56('0x16')](function(_0x2b10d4){if(_0x2b10d4){_0x3c9621=_0x2b10d4;return db['ChatWebsite'][_0x7a56('0x46')]({'where':{'id':_0x3c9621[_0x7a56('0x4c')]}});}})[_0x7a56('0x16')](function(_0xc3e0f){if(_0xc3e0f){_0x1ad117=_0xc3e0f;return db[_0x7a56('0x5f')][_0x7a56('0x46')]({'where':{'id':_0x3c9621[_0x7a56('0x7a')]}});}})['then'](function(_0x1abdf8){if(_0x1abdf8){if(_0x5392e3){var _0x2bdefb=null;for(var _0x3dcb91=0x1;_0x3dcb91<_0x3c9621[_0x7a56('0x78')]['length'];++_0x3dcb91){_0x2bdefb=_0x3c9621['Messages'][_0x3dcb91];var _0x11aa1e=_0x2bdefb[_0x7a56('0x63')]?util['format'](_0x7a56('0x7b'),_0x1ad117['agentAlias'],_0x2bdefb['UserId']):_0x7a56('0x7c');var _0x4b4c34=_0x1494cf[_0x7a56('0x2e')]['customer']||util['format'](_0x7a56('0x7b'),_0x7a56('0x7d'),_0x2bdefb[_0x7a56('0x7a')]);switch(_0x1ad117[_0x7a56('0x7e')]){case'website_alias':_0x11aa1e=_0x2bdefb[_0x7a56('0x63')]?util[_0x7a56('0x76')](_0x7a56('0x7b'),_0x1ad117[_0x7a56('0x7f')],_0x2bdefb[_0x7a56('0x63')]):'System';break;case _0x7a56('0x80'):_0x11aa1e=_0x2bdefb[_0x7a56('0x63')]?_0x2bdefb['User']['alias']||_0x2bdefb[_0x7a56('0x79')][_0x7a56('0x81')]:_0x7a56('0x7c');break;case _0x7a56('0x82'):_0x11aa1e=_0x2bdefb[_0x7a56('0x63')]?_0x2bdefb[_0x7a56('0x79')][_0x7a56('0x81')]:'System';break;default:_0x11aa1e=_0x2bdefb[_0x7a56('0x63')]?util['format'](_0x7a56('0x7b'),_0x1ad117['agentAlias'],_0x2bdefb['UserId']):_0x7a56('0x7c');}var _0x204349=util[_0x7a56('0x76')](_0x7a56('0x83'),moment(_0x2bdefb[_0x7a56('0x84')])[_0x7a56('0x76')](_0x7a56('0x85')),_0x2bdefb[_0x7a56('0x86')]==='in'?_0x4b4c34:_0x11aa1e,_0x2bdefb[_0x7a56('0x2e')]);if(!_0x2bdefb[_0x7a56('0x87')]){fs[_0x7a56('0x88')](_0x5392e3,_0x204349);}}return db[_0x7a56('0x89')][_0x7a56('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x7a56('0x8a')],'as':_0x7a56('0x8b'),'raw':!![],'include':[{'model':db[_0x7a56('0x8c')],'as':_0x7a56('0x8c'),'raw':!![]}]}]});}}})[_0x7a56('0x16')](function(_0x34688a){if(!_0x34688a||!_0x34688a[_0x7a56('0x8b')]||!_0x1494cf[_0x7a56('0x2e')])return _0x3c9621;var _0x194cd9=_0x34688a[_0x7a56('0x8d')]();return respondWithRpcPromise(_0x7a56('0x8e'),_0x7a56('0x8f'),{'account':_0x194cd9,'message':{'from':util[_0x7a56('0x76')](_0x7a56('0x90'),_0x34688a['name'],_0x34688a[_0x7a56('0x91')]||_0x34688a[_0x7a56('0x8b')]['user']),'to':_0x1494cf['body'][_0x7a56('0x74')],'subject':_0x7a56('0x92'),'text':util[_0x7a56('0x76')](_0x7a56('0x93'),_0x1494cf[_0x7a56('0x2e')][_0x7a56('0x74')]),'attachments':[{'path':_0x5392e3}]}})[_0x7a56('0x16')](function(){return _0x3c9621;})['catch'](function(_0x44f1a7){logger[_0x7a56('0x1e')](_0x44f1a7);});})['then'](respondWithStatusCode(_0x5a841a,0xc8))[_0x7a56('0x39')](handleError(_0x5a841a,null));};exports[_0x7a56('0x94')]=function(_0x43f585,_0x2408b9){return db['ChatMessage'][_0x7a56('0x46')]({'where':{'id':_0x43f585[_0x7a56('0x3b')]['id']}})[_0x7a56('0x16')](handleEntityNotFound(_0x2408b9,null))[_0x7a56('0x16')](function(_0x20468a){if(_0x20468a){return _0x20468a[_0x7a56('0x94')](_0x43f585[_0x7a56('0x2e')][_0x7a56('0x95')],_[_0x7a56('0x96')](_0x43f585[_0x7a56('0x2e')],[_0x7a56('0x95'),'id'])||{});}})[_0x7a56('0x16')](respondWithResult(_0x2408b9,null))[_0x7a56('0x39')](handleError(_0x2408b9,null));};exports[_0x7a56('0x97')]=function(_0x5b08fc,_0x2ca99c){var _0x46d401={'raw':![],'where':{}};var _0x3e9380={};var _0x13af8a={'count':0x0,'rows':[]};return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x5b08fc[_0x7a56('0x3b')]['id']}})[_0x7a56('0x16')](handleEntityNotFound(_0x2ca99c,null))['then'](function(_0x10e30c){if(_0x10e30c){_0x3e9380['model']=_[_0x7a56('0x3d')](db[_0x7a56('0x5e')][_0x7a56('0x34')]);_0x3e9380[_0x7a56('0x42')]=_[_0x7a56('0x3d')](_0x5b08fc[_0x7a56('0x42')]);_0x3e9380[_0x7a56('0x3e')]=_[_0x7a56('0x3f')](_0x3e9380[_0x7a56('0x3c')],_0x3e9380[_0x7a56('0x42')]);_0x46d401[_0x7a56('0x40')]=_[_0x7a56('0x3f')](_0x3e9380[_0x7a56('0x3c')],qs[_0x7a56('0x41')](_0x5b08fc[_0x7a56('0x42')][_0x7a56('0x41')]));_0x46d401[_0x7a56('0x40')]=_0x46d401['attributes'][_0x7a56('0x98')]?_0x46d401[_0x7a56('0x40')]:_0x3e9380[_0x7a56('0x3c')];if(!_0x5b08fc['query'][_0x7a56('0x99')](_0x7a56('0x9a'))){_0x46d401[_0x7a56('0x9b')]=qs['limit'](_0x5b08fc['query']['limit']);_0x46d401[_0x7a56('0x24')]=qs['offset'](_0x5b08fc[_0x7a56('0x42')][_0x7a56('0x24')]);}_0x46d401[_0x7a56('0x9c')]=qs[_0x7a56('0x9d')](_0x5b08fc[_0x7a56('0x42')]['sort']);_0x46d401[_0x7a56('0x9e')]=qs[_0x7a56('0x3e')](_[_0x7a56('0x9f')](_0x5b08fc['query'],_0x3e9380[_0x7a56('0x3e')]));_0x46d401[_0x7a56('0x9e')][_0x7a56('0xa0')]=_0x10e30c['id'];if(_0x5b08fc['query']['filter']){_0x46d401['where']=_['merge'](_0x46d401[_0x7a56('0x9e')],{'$or':_[_0x7a56('0x32')](_0x46d401[_0x7a56('0x40')],function(_0x5697db){var _0x14536e={};_0x14536e[_0x5697db]={'$like':'%'+_0x5b08fc[_0x7a56('0x42')][_0x7a56('0xa1')]+'%'};return _0x14536e;})});}if(_0x5b08fc[_0x7a56('0x42')][_0x7a56('0xa2')]){var _0x3a4f2e=_0x5b08fc[_0x7a56('0x42')][_0x7a56('0xa2')][_0x7a56('0xa3')](',');var _0x36616d={};_0x36616d[_0x3a4f2e[0x0]]={'$gte':moment(_0x3a4f2e[0x1])[_0x7a56('0x76')](_0x7a56('0xa4'))};_0x46d401['where']=_['merge'](_0x46d401[_0x7a56('0x9e')],_0x36616d);}_0x46d401=_[_0x7a56('0x2d')]({},_0x46d401,_0x5b08fc[_0x7a56('0x45')]);return db[_0x7a56('0x5e')][_0x7a56('0x26')]({'where':_0x46d401[_0x7a56('0x9e')]})[_0x7a56('0x16')](function(_0x291bb3){_0x13af8a[_0x7a56('0x26')]=_0x291bb3;if(_0x5b08fc['query'][_0x7a56('0x43')]){_0x46d401[_0x7a56('0x44')]=[{'all':!![]}];}return db[_0x7a56('0x5e')][_0x7a56('0xa5')](_0x46d401);})[_0x7a56('0x16')](function(_0x232a3b){_0x13af8a['rows']=_0x232a3b;return _0x13af8a;});}})[_0x7a56('0x16')](respondWithFilteredResult(_0x2ca99c,_0x46d401))[_0x7a56('0x39')](handleError(_0x2ca99c,null));};exports[_0x7a56('0xa6')]=function(_0x326e3f,_0xa1e0e9){var _0x1c2e4d={'where':{}},_0x168ec9={},_0x2b350f={'count':0x0,'rows':[]};return db[_0x7a56('0x33')][_0x7a56('0x4a')]({'where':{'id':_0x326e3f[_0x7a56('0x3b')]['id']}})['then'](handleEntityNotFound(_0xa1e0e9,null))[_0x7a56('0x16')](function(_0x3ae504){if(_0x3ae504){_0x168ec9[_0x7a56('0x3c')]=_['keys'](db[_0x7a56('0x5e')][_0x7a56('0x34')]);_0x168ec9[_0x7a56('0x42')]=_[_0x7a56('0x3d')](_0x326e3f[_0x7a56('0x42')]);_0x168ec9['filters']=_['intersection'](_0x168ec9[_0x7a56('0x3c')],_0x168ec9[_0x7a56('0x42')]);_0x1c2e4d['attributes']=_[_0x7a56('0x3f')](_0x168ec9[_0x7a56('0x3c')],qs[_0x7a56('0x41')](_0x326e3f['query'][_0x7a56('0x41')]));_0x1c2e4d[_0x7a56('0x40')]=_0x1c2e4d[_0x7a56('0x40')]['length']?_0x1c2e4d[_0x7a56('0x40')]:_0x168ec9[_0x7a56('0x3c')];if(!_0x326e3f['query'][_0x7a56('0x99')](_0x7a56('0x9a'))){_0x1c2e4d[_0x7a56('0x9b')]=qs[_0x7a56('0x9b')](_0x326e3f[_0x7a56('0x42')][_0x7a56('0x9b')]);_0x1c2e4d[_0x7a56('0x24')]=qs[_0x7a56('0x24')](_0x326e3f[_0x7a56('0x42')]['offset']);}_0x1c2e4d[_0x7a56('0x9c')]=qs[_0x7a56('0x9d')](_0x326e3f[_0x7a56('0x42')]['sort']);_0x1c2e4d[_0x7a56('0x9e')]=qs[_0x7a56('0x3e')](_[_0x7a56('0x9f')](_0x326e3f[_0x7a56('0x42')],_0x168ec9['filters']));_0x1c2e4d[_0x7a56('0x9e')][_0x7a56('0xa0')]=_0x3ae504['id'];if(_0x326e3f[_0x7a56('0x42')][_0x7a56('0xa1')]){_0x1c2e4d[_0x7a56('0x9e')]=_['merge'](_0x1c2e4d[_0x7a56('0x9e')],{'$or':_[_0x7a56('0x32')](_0x1c2e4d['attributes'],function(_0x3e7f3c){var _0x48c7b1={};_0x48c7b1[_0x3e7f3c]={'$like':'%'+_0x326e3f[_0x7a56('0x42')][_0x7a56('0xa1')]+'%'};return _0x48c7b1;})});}_0x1c2e4d[_0x7a56('0x9e')][_0x7a56('0x87')]=![];if(_0x326e3f[_0x7a56('0x42')]['id']){_0x1c2e4d[_0x7a56('0x9e')]['id']={'$gt':_0x326e3f['query']['id']};}_0x1c2e4d=_[_0x7a56('0x2d')]({},_0x1c2e4d,_0x326e3f[_0x7a56('0x45')]);return db[_0x7a56('0x5e')][_0x7a56('0x26')]({'where':_0x1c2e4d[_0x7a56('0x9e')]})['then'](function(_0x2c6e29){_0x2b350f[_0x7a56('0x26')]=_0x2c6e29;_0x1c2e4d[_0x7a56('0x44')]=[];if(_0x326e3f[_0x7a56('0x42')]['includeAgent']){_0x1c2e4d[_0x7a56('0x44')][_0x7a56('0xa7')]({'model':db[_0x7a56('0x79')],'as':_0x7a56('0x79'),'attributes':['id','fullname','alias']});}if(_0x326e3f[_0x7a56('0x42')][_0x7a56('0x43')]){_0x1c2e4d['include']=[{'all':!![]}];}return db[_0x7a56('0x5e')][_0x7a56('0xa5')](_0x1c2e4d);})['then'](function(_0x18cb7f){_0x2b350f[_0x7a56('0xa8')]=_0x18cb7f;return _0x2b350f;});}})['then'](respondWithFilteredResult(_0xa1e0e9,_0x1c2e4d))['catch'](handleError(_0xa1e0e9,null));};exports[_0x7a56('0xa9')]=function(_0x58bd9d,_0x19cf9d){return db[_0x7a56('0x33')][_0x7a56('0x46')]({'where':{'id':_0x58bd9d['params']['id']}})['then'](handleEntityNotFound(_0x19cf9d,null))['then'](function(_0x500187){if(_0x500187){return _0x500187[_0x7a56('0xaa')](_0x58bd9d['body'][_0x7a56('0x95')],_[_0x7a56('0x96')](_0x58bd9d['body'],[_0x7a56('0x95'),'id'])||{})[_0x7a56('0xab')](function(){return db[_0x7a56('0xac')]['findAll']({'attributes':['id','name',_0x7a56('0xad')],'where':{'id':_0x58bd9d[_0x7a56('0x2e')]['ids']}});})['then'](function(_0x5aaaa0){socket[_0x7a56('0xae')]('chatInteractionTags:save',{'id':Number(_0x58bd9d['params']['id']),'tags':_0x5aaaa0||[]});return{'id':Number(_0x58bd9d['params']['id']),'tags':_0x5aaaa0||[]};});}})[_0x7a56('0x16')](respondWithResult(_0x19cf9d,null))['catch'](handleError(_0x19cf9d,null));};exports['removeTags']=function(_0x164b00,_0x419cda){return db['ChatInteraction']['find']({'where':{'id':_0x164b00[_0x7a56('0x3b')]['id']}})[_0x7a56('0x16')](handleEntityNotFound(_0x419cda,null))[_0x7a56('0x16')](function(_0x210e28){if(_0x210e28){return _0x210e28[_0x7a56('0xaf')](_0x164b00['query'][_0x7a56('0x95')]);}})[_0x7a56('0x16')](respondWithStatusCode(_0x419cda,null))[_0x7a56('0x39')](handleError(_0x419cda,null));};exports[_0x7a56('0xb0')]=function(_0x4d74bb,_0x2636f9){var _0x1921d8=moment()[_0x7a56('0xb1')]()[_0x7a56('0xb2')]();var _0x51f4e8=path['join'](config[_0x7a56('0x70')],'server',_0x7a56('0xb3'),'tmp');var _0x221974=path['join'](config[_0x7a56('0x70')],_0x7a56('0xb4'),_0x7a56('0xb3'),'attachments');var _0x273a64=path[_0x7a56('0x6f')](_0x51f4e8,_0x1921d8);var _0x8de210=util[_0x7a56('0x76')](_0x7a56('0xb5'),_0x4d74bb[_0x7a56('0x3b')]['id'],_0x1921d8);var _0x43b1ea=path[_0x7a56('0x6f')](_0x51f4e8,_0x8de210);var _0x2fb364=[];_0x2fb364[_0x7a56('0xa7')]({'model':db[_0x7a56('0x79')],'as':_0x7a56('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x2fb364[_0x7a56('0xa7')]({'model':db[_0x7a56('0x5f')],'as':_0x7a56('0xb6'),'attributes':['id','firstName',_0x7a56('0xb7')],'raw':!![]});if(_0x4d74bb[_0x7a56('0x42')][_0x7a56('0xb8')]){_0x2fb364[_0x7a56('0xa7')]({'model':db['Attachment'],'as':_0x7a56('0x6b'),'raw':!![]});}var _0x1d319e=[{'model':db[_0x7a56('0x5e')],'as':_0x7a56('0x78'),'attributes':['id',_0x7a56('0x2e'),'createdAt',_0x7a56('0x86'),'secret',_0x7a56('0xb9')],'include':_0x2fb364}];_0x1d319e['push']({'model':db[_0x7a56('0x4b')],'as':_0x7a56('0xba'),'attributes':['id','name']});_0x1d319e[_0x7a56('0xa7')]({'model':db['User'],'as':_0x7a56('0xbb'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x7a56('0x46')]({'where':{'id':_0x4d74bb[_0x7a56('0x3b')]['id']},'include':_0x1d319e})['then'](handleEntityNotFound(_0x2636f9,null))['then'](function(_0x46f700){if(_0x46f700){var _0x43de21=_0x46f700[_0x7a56('0xbc')]({'plain':!![]});fs[_0x7a56('0xbd')](_0x273a64);var _0xa1cc28={'channel':_0x7a56('0xbe'),'account':_0x43de21['Account'][_0x7a56('0x2c')],'agent':_0x43de21['Owner']?_0x43de21[_0x7a56('0xbb')]['fullname']:_0x7a56('0xbf'),'createdAt':moment(_0x43de21[_0x7a56('0x84')])[_0x7a56('0x76')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7a56('0xb2')](),'closedAt':_0x43de21[_0x7a56('0x65')]?moment(_0x43de21[_0x7a56('0xc0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7a56('0xb2')]():'','disposition':_0x43de21[_0x7a56('0x66')],'chatInfo':{'browser':_0x43de21[_0x7a56('0xc1')],'os':_0x43de21[_0x7a56('0xc2')],'referer':_0x43de21[_0x7a56('0xc3')],'customerIp':_0x43de21[_0x7a56('0xc4')],'customerPort':_0x43de21['customerPort']?_0x43de21[_0x7a56('0xc5')]:_0x7a56('0xbf')},'messages':_(_0x43de21['Messages'])['tail']()[_0x7a56('0xa1')]({'secret':![]})[_0x7a56('0x32')](function(_0x20e369){if(_0x20e369[_0x7a56('0x6b')]){var _0x1ae8b1=path[_0x7a56('0x6f')](_0x221974,_0x20e369[_0x7a56('0x6b')][_0x7a56('0x72')]);if(fs[_0x7a56('0xc6')](_0x1ae8b1)){fs[_0x7a56('0xc7')](_0x1ae8b1)[_0x7a56('0xc8')](fs[_0x7a56('0xc9')](path[_0x7a56('0x6f')](_0x273a64,_0x20e369['Attachment'][_0x7a56('0x72')])));}}return{'date':moment(_0x20e369[_0x7a56('0x84')])[_0x7a56('0x76')](_0x7a56('0xa4'))['toString'](),'sender':_0x20e369[_0x7a56('0x86')]===_0x7a56('0x5d')?_0x20e369[_0x7a56('0x79')]?_0x20e369[_0x7a56('0x79')]['fullname']:_0x7a56('0x7c'):_0x20e369[_0x7a56('0xb6')][_0x7a56('0xca')]+(_0x20e369[_0x7a56('0xb6')]['lastName']?'\x20'+_0x20e369[_0x7a56('0xb6')]['lastName']:''),'body':_0x20e369[_0x7a56('0x6b')]?_0x20e369['Attachment'][_0x7a56('0x72')]:_0x20e369['body'],'direction':_0x20e369['direction']===_0x7a56('0x5d')?'A':'C','secret':_0x20e369[_0x7a56('0x87')],'read':_0x20e369[_0x7a56('0xb9')],'attachment':_0x20e369[_0x7a56('0x6b')]};})[_0x7a56('0xcb')]()};return ejs[_0x7a56('0xcc')](path['join'](config['root'],_0x7a56('0xb4'),_0x7a56('0xcd'),_0x7a56('0xce')),{'interaction':_0xa1cc28})['then'](function(_0x3f659a){var _0x11eccb=path[_0x7a56('0x6f')](_0x273a64,_0x7a56('0xcf')+_0x43de21['id']+'-'+_0x1921d8+_0x7a56('0xd0'));var _0x2dc08c={'path':_0x11eccb,'channel':'Chat','interactionId':_0x43de21['id']};return pdf[_0x7a56('0xd1')](_0x3f659a,_0x2dc08c);})['then'](function(){return new Promise(function(_0x4908b7,_0x1e537e){zipdir(_0x273a64,{'saveTo':_0x43b1ea},function(_0x41d606,_0x757ec){if(_0x41d606)return _0x1e537e(_0x41d606);return _0x4908b7(_0x757ec);});})[_0x7a56('0x16')](function(){return new BPromise(function(_0x484345,_0x26f445){rimraf(_0x273a64,function(_0x4fccfe){if(_0x4fccfe)_0x26f445(_0x4fccfe);return _0x484345();});});})[_0x7a56('0x16')](function(){return _0x2636f9[_0x7a56('0xb0')](_0x43b1ea,_0x8de210,function(_0x3d04a9){if(_0x3d04a9){logger['error'](_0x7a56('0xd2'),_0x3d04a9);}else{fs[_0x7a56('0xd3')](_0x43b1ea);}});});});}else{return _0x2636f9[_0x7a56('0x62')](0xc8);}})[_0x7a56('0x39')](handleError(_0x2636f9,null));}; \ No newline at end of file +var _0xf499=['bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','catch','keys','intersection','model','attributes','fields','length','includeAll','include','options','find','create','update','describe','createVidaooSession','params','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','filename','file','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','System','customer','%s%d','ContactId','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','filters','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','getMyMessages','hasOwnProperty','secret','fullname','rows','setTags','spread','Tag','color','emit','chatInteractionTags:save','unix','toString','server','tmp','attachments','transcript-%d-%s.zip','push','lastName','createdAt','read','Owner','mkdirSync','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','firstName','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','request-promise'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf499,0x19c));var _0x9f49=function(_0x34b292,_0x1057d1){_0x34b292=_0x34b292-0x0;var _0x39f677=_0xf499[_0x34b292];return _0x39f677;};'use strict';var rimraf=require(_0x9f49('0x0'));var zipdir=require('zip-dir');var rp=require(_0x9f49('0x1'));var moment=require('moment');var BPromise=require(_0x9f49('0x2'));var Mustache=require('mustache');var util=require(_0x9f49('0x3'));var path=require(_0x9f49('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f49('0x5'));var Redis=require(_0x9f49('0x6'));var interaction=require(_0x9f49('0x7'));var qs=require(_0x9f49('0x8'));var pdf=require(_0x9f49('0x9'));var logger=require(_0x9f49('0xa'))('api');var config=require(_0x9f49('0xb'));var db=require(_0x9f49('0xc'))['db'];config[_0x9f49('0xd')]=_[_0x9f49('0xe')](config['redis'],{'host':_0x9f49('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f49('0xd')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9f49('0x10')][_0x9f49('0x11')]({'port':0x232b});var client9004=jayson[_0x9f49('0x10')][_0x9f49('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x22faec,_0x3dd283,_0x1d8dc8,_0x29d769){return new BPromise(function(_0x3a3315,_0x2900a0){var _0x51488f=_0x29d769||client;return _0x51488f[_0x9f49('0x12')](_0x22faec,_0x1d8dc8)['then'](function(_0x273453){logger[_0x9f49('0x13')](_0x9f49('0x14'),_0x3dd283,_0x9f49('0x15'));logger[_0x9f49('0x16')](_0x9f49('0x17'),_0x3dd283,_0x9f49('0x15'),JSON[_0x9f49('0x18')](_0x273453));if(_0x273453[_0x9f49('0x19')]){if(_0x273453[_0x9f49('0x19')][_0x9f49('0x1a')]===0x1f4){logger[_0x9f49('0x19')](_0x9f49('0x14'),_0x3dd283,_0x273453[_0x9f49('0x19')][_0x9f49('0x1b')]);return _0x2900a0(_0x273453[_0x9f49('0x19')][_0x9f49('0x1b')]);}logger[_0x9f49('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x3dd283,_0x273453[_0x9f49('0x19')][_0x9f49('0x1b')]);return _0x3a3315(_0x273453[_0x9f49('0x19')]['message']);}else{logger[_0x9f49('0x13')](_0x9f49('0x14'),_0x3dd283,_0x9f49('0x15'));_0x3a3315(_0x273453[_0x9f49('0x1c')][_0x9f49('0x1b')]);}})['catch'](function(_0x3e375f){logger[_0x9f49('0x19')](_0x9f49('0x14'),_0x3dd283,_0x3e375f);_0x2900a0(_0x3e375f);});});}function respondWithStatusCode(_0x5f060d,_0x43ea73){_0x43ea73=_0x43ea73||0xcc;return function(_0x113edf){if(_0x113edf){return _0x5f060d[_0x9f49('0x1d')](_0x43ea73);}return _0x5f060d[_0x9f49('0x1e')](_0x43ea73)[_0x9f49('0x1f')]();};}function respondWithResult(_0x5861b6,_0x545c92){_0x545c92=_0x545c92||0xc8;return function(_0x589e43){if(_0x589e43){return _0x5861b6['status'](_0x545c92)[_0x9f49('0x20')](_0x589e43);}};}function respondWithFilteredResult(_0x423ae5,_0x315833){return function(_0x1068fd){if(_0x1068fd){var _0x535ef1=typeof _0x315833[_0x9f49('0x21')]===_0x9f49('0x22')&&typeof _0x315833[_0x9f49('0x23')]==='undefined';var _0x252a73=_0x1068fd[_0x9f49('0x24')];var _0x4cd305=_0x535ef1?0x0:_0x315833['offset'];var _0x3c9880=_0x535ef1?_0x1068fd[_0x9f49('0x24')]:_0x315833[_0x9f49('0x21')]+_0x315833[_0x9f49('0x23')];var _0x3c2a75;if(_0x3c9880>=_0x252a73){_0x3c9880=_0x252a73;_0x3c2a75=0xc8;}else{_0x3c2a75=0xce;}_0x423ae5[_0x9f49('0x1e')](_0x3c2a75);return _0x423ae5[_0x9f49('0x25')]('Content-Range',_0x4cd305+'-'+_0x3c9880+'/'+_0x252a73)['json'](_0x1068fd);}return null;};}function saveUpdates(_0x237c2f){return function(_0x232745){if(_0x232745){return _0x232745['update'](_0x237c2f)[_0x9f49('0x26')](function(_0x2dc186){return _0x2dc186;});}return null;};}function removeEntity(_0x2463f8){return function(_0x367ec0){if(_0x367ec0){return _0x367ec0[_0x9f49('0x27')]()['then'](function(){_0x2463f8[_0x9f49('0x1e')](0xcc)[_0x9f49('0x1f')]();});}};}function handleEntityNotFound(_0xd8641b){return function(_0x19b6ad){if(!_0x19b6ad){_0xd8641b['sendStatus'](0x194);}return _0x19b6ad;};}function handleError(_0x4630d9,_0x3f1783){_0x3f1783=_0x3f1783||0x1f4;return function(_0x247eed){logger[_0x9f49('0x19')](_0x247eed[_0x9f49('0x28')]);if(_0x247eed[_0x9f49('0x29')]){delete _0x247eed['name'];}_0x4630d9[_0x9f49('0x1e')](_0x3f1783)[_0x9f49('0x2a')](_0x247eed);};}function getMustacheRender(_0x2078e8,_0x336d15){return Mustache[_0x9f49('0x2b')](_0x2078e8,_[_0x9f49('0x2c')](_0x336d15[_0x9f49('0x2d')],{'contact':_0x336d15[_0x9f49('0x2e')],'message':_0x336d15[_0x9f49('0x1b')],'agent':_0x336d15[_0x9f49('0x2f')],'interaction':_0x336d15[_0x9f49('0x30')],'account':_0x336d15[_0x9f49('0x31')]}))||'';}exports[_0x9f49('0x32')]=function(_0x5767ee,_0x4910e9){var _0x4861e7={};var _0x5389cd=_[_0x9f49('0x33')](db[_0x9f49('0x34')][_0x9f49('0x35')],function(_0x4c7c71){return{'name':_0x4c7c71[_0x9f49('0x36')],'type':_0x4c7c71[_0x9f49('0x37')][_0x9f49('0x38')]};});_0x4861e7=qs[_0x9f49('0x39')](_0x5389cd,_0x5767ee);return interaction[_0x9f49('0x3a')](_0x9f49('0x3b'),_0x5767ee[_0x9f49('0x3c')],_0x5767ee[_0x9f49('0x3d')],_0x4861e7,_0x5389cd)['then'](respondWithFilteredResult(_0x4910e9,_0x4861e7))[_0x9f49('0x3e')](handleError(_0x4910e9,null));};exports['show']=function(_0x37ff08,_0x462815){var _0x78ea79={'raw':![],'where':{'id':_0x37ff08['params']['id']}},_0xc164c4={};_0xc164c4['model']=_[_0x9f49('0x3f')](db[_0x9f49('0x34')][_0x9f49('0x35')]);_0xc164c4[_0x9f49('0x3c')]=_[_0x9f49('0x3f')](_0x37ff08[_0x9f49('0x3c')]);_0xc164c4['filters']=_[_0x9f49('0x40')](_0xc164c4[_0x9f49('0x41')],_0xc164c4[_0x9f49('0x3c')]);_0x78ea79[_0x9f49('0x42')]=_[_0x9f49('0x40')](_0xc164c4[_0x9f49('0x41')],qs['fields'](_0x37ff08['query'][_0x9f49('0x43')]));_0x78ea79[_0x9f49('0x42')]=_0x78ea79[_0x9f49('0x42')][_0x9f49('0x44')]?_0x78ea79[_0x9f49('0x42')]:_0xc164c4[_0x9f49('0x41')];if(_0x37ff08[_0x9f49('0x3c')][_0x9f49('0x45')]){_0x78ea79[_0x9f49('0x46')]=[{'all':!![]}];}_0x78ea79=_[_0x9f49('0x2c')]({},_0x78ea79,_0x37ff08[_0x9f49('0x47')]);return db[_0x9f49('0x34')][_0x9f49('0x48')](_0x78ea79)[_0x9f49('0x26')](handleEntityNotFound(_0x462815,null))[_0x9f49('0x26')](respondWithResult(_0x462815,null))[_0x9f49('0x3e')](handleError(_0x462815,null));};exports['create']=function(_0x1ae8be,_0x39a61e){return db[_0x9f49('0x34')][_0x9f49('0x49')](_0x1ae8be[_0x9f49('0x2d')],{})[_0x9f49('0x26')](respondWithResult(_0x39a61e,0xc9))['catch'](handleError(_0x39a61e,null));};exports[_0x9f49('0x4a')]=function(_0x497004,_0x322279){if(_0x497004[_0x9f49('0x2d')]['id']){delete _0x497004[_0x9f49('0x2d')]['id'];}return db['ChatInteraction'][_0x9f49('0x48')]({'where':{'id':_0x497004['params']['id']}})['then'](handleEntityNotFound(_0x322279,null))[_0x9f49('0x26')](saveUpdates(_0x497004[_0x9f49('0x2d')],null))[_0x9f49('0x26')](respondWithResult(_0x322279,null))['catch'](handleError(_0x322279,null));};exports[_0x9f49('0x27')]=function(_0x10904e,_0x37bb84){return db[_0x9f49('0x34')][_0x9f49('0x48')]({'where':{'id':_0x10904e['params']['id']}})[_0x9f49('0x26')](handleEntityNotFound(_0x37bb84,null))[_0x9f49('0x26')](removeEntity(_0x37bb84,null))['catch'](handleError(_0x37bb84,null));};exports[_0x9f49('0x4b')]=function(_0x1148de,_0x200b61){return db[_0x9f49('0x34')][_0x9f49('0x4b')]()[_0x9f49('0x26')](respondWithResult(_0x200b61,null))[_0x9f49('0x3e')](handleError(_0x200b61,null));};exports[_0x9f49('0x4c')]=function(_0x49fbd7,_0x4c18cb){var _0x11c295=_0x49fbd7[_0x9f49('0x4d')]['id'];var _0x59ffbf;var _0x463f0e;var _0x3ec50c;return db[_0x9f49('0x34')]['findOne']({'where':{'id':_0x11c295}})['then'](function(_0xf14786){_0x59ffbf=_0xf14786;return db[_0x9f49('0x4e')][_0x9f49('0x4f')]({'where':{'id':_0xf14786[_0x9f49('0x50')]},'attributes':['id','vidaooApiKey',_0x9f49('0x51'),_0x9f49('0x52'),_0x9f49('0x53'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x5a4e38){if(_0x5a4e38&&_0x5a4e38['vidaooApiKey']&&_0x5a4e38[_0x9f49('0x51')]){_0x463f0e=_0x5a4e38;var _0x34a4a5={'interaction':{'id':_0x11c295},'agent':{'id':_0x49fbd7['user']['id'],'name':_0x49fbd7[_0x9f49('0x3d')]['name'],'fullname':_0x49fbd7[_0x9f49('0x3d')]['fullname'],'email':_0x49fbd7[_0x9f49('0x3d')][_0x9f49('0x54')]},'contact':_0x49fbd7[_0x9f49('0x2d')]['contact'],'account':_0x49fbd7[_0x9f49('0x2d')][_0x9f49('0x31')]};var _0x2d043a={'rejectUnauthorized':![],'method':_0x9f49('0x55'),'url':_0x9f49('0x56'),'headers':{'X-APIKEY':_0x5a4e38[_0x9f49('0x57')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49fbd7[_0x9f49('0x3d')][_0x9f49('0x54')]],'buttons':null,'topic':_0x463f0e[_0x9f49('0x52')],'note':_['isNull'](_0x463f0e[_0x9f49('0x53')])?null:getMustacheRender(_0x463f0e[_0x9f49('0x53')],_0x34a4a5),'metadata':null},'redirect':_0x9f49('0x58'),'json':!![]};try{if(!_['isNull'](_0x463f0e[_0x9f49('0x59')])){var _0x1c54c9=getMustacheRender(_0x463f0e['vidaooMetadata'],_0x34a4a5);var _0x4441ab=JSON[_0x9f49('0x5a')](_0x1c54c9);_0x2d043a[_0x9f49('0x2d')][_0x9f49('0x5b')]=_0x4441ab;}}catch(_0x3c3dad){throw new db[(_0x9f49('0x5c'))][(_0x9f49('0x5d'))](_0x9f49('0x5e'));}return rp(_0x2d043a);}else{throw new db[(_0x9f49('0x5c'))][(_0x9f49('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x9f49('0x26')](function(_0x18e783){_0x3ec50c=_0x18e783;if(_0x3ec50c['id']){var _0x47b0bf={'body':_0x3ec50c['join_url'],'ChatWebsiteId':_0x463f0e['id'],'ChatInteractionId':_0x59ffbf['id'],'direction':_0x9f49('0x5f'),'UserId':_0x49fbd7['user']['id']};return db[_0x9f49('0x60')][_0x9f49('0x49')](_0x47b0bf,{});}else{throw new db['Sequelize'][(_0x9f49('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x9f49('0x26')](function(){return _0x59ffbf[_0x9f49('0x61')]({'vidaooSessionId':_0x3ec50c['id']});})[_0x9f49('0x26')](respondWithResult(_0x4c18cb,null))[_0x9f49('0x3e')](handleError(_0x4c18cb,null));};exports[_0x9f49('0x62')]=function(_0x3c55fa,_0x57e7f9){if(_0x3c55fa[_0x9f49('0x2d')]['id']){delete _0x3c55fa[_0x9f49('0x2d')]['id'];}return db[_0x9f49('0x34')]['find']({'where':{'id':_0x3c55fa[_0x9f49('0x4d')]['id']},'include':[{'model':db[_0x9f49('0x63')],'as':_0x9f49('0x64')}]})[_0x9f49('0x26')](handleEntityNotFound(_0x57e7f9,null))[_0x9f49('0x26')](saveUpdates(_0x3c55fa[_0x9f49('0x2d')],null))['then'](respondWithResult(_0x57e7f9,null))[_0x9f49('0x3e')](handleError(_0x57e7f9,null));};exports[_0x9f49('0x65')]=function(_0x9ac3e,_0x5a0c8b){if(_0x9ac3e[_0x9f49('0x2d')]['id']){delete _0x9ac3e['body']['id'];}return db[_0x9f49('0x34')]['find']({'where':{'id':_0x9ac3e[_0x9f49('0x4d')]['id']}})[_0x9f49('0x26')](function(_0x2b801f){if(!_0x2b801f){logger[_0x9f49('0x19')](_0x9f49('0x66'),_0x9f49('0x65'),0x194,_0x9f49('0x67'));_0x5a0c8b[_0x9f49('0x1d')](0x194);}else{if(_0x2b801f[_0x9f49('0x68')]){throw new db['Sequelize'][(_0x9f49('0x5d'))](_0x9f49('0x69'));}}return _0x2b801f;})['then'](function(_0x432b86){if(_0x432b86){return _0x432b86[_0x9f49('0x4a')]({'closed':_0x9ac3e['body'][_0x9f49('0x6a')],'disposition':_0x9ac3e[_0x9f49('0x2d')]['disposition']})[_0x9f49('0x26')](function(_0x343f1f){return _0x343f1f;});}})[_0x9f49('0x26')](function(){return respondWithRpcPromise(_0x9f49('0x6b'),_0x9f49('0x65'),_0x9ac3e['body'],client9004);})[_0x9f49('0x26')](respondWithResult(_0x5a0c8b,null))['catch'](handleError(_0x5a0c8b,null));};exports[_0x9f49('0x6c')]=function(_0x5d0091,_0x1ef838){_0x5d0091[_0x9f49('0x2d')][_0x9f49('0x29')]=_0x5d0091['file'][_0x9f49('0x6d')];_0x5d0091[_0x9f49('0x2d')][_0x9f49('0x6e')]=_0x5d0091['file'][_0x9f49('0x6f')];_0x5d0091[_0x9f49('0x2d')][_0x9f49('0x37')]=_0x5d0091[_0x9f49('0x70')][_0x9f49('0x71')];return db['Attachment'][_0x9f49('0x49')](_0x5d0091['body'])[_0x9f49('0x26')](respondWithResult(_0x1ef838,0xc9))[_0x9f49('0x3e')](handleError(_0x1ef838,null));};exports[_0x9f49('0x72')]=function(_0x327b70,_0x197faa){return db[_0x9f49('0x34')][_0x9f49('0x4f')]({'where':{'id':_0x327b70[_0x9f49('0x4d')]['id']},'raw':!![]})[_0x9f49('0x26')](handleEntityNotFound(_0x197faa,null))[_0x9f49('0x26')](function(_0x5d40f1){if(_0x5d40f1){if(_0x5d40f1[_0x9f49('0x6a')]){return _0x197faa[_0x9f49('0x1e')](0x193)[_0x9f49('0x20')]({'status':0x193,'message':_0x9f49('0x73')});}return db[_0x9f49('0x74')][_0x9f49('0x4f')]({'where':{'id':_0x327b70['query'][_0x9f49('0x75')]},'raw':!![]})[_0x9f49('0x26')](handleEntityNotFound(_0x197faa,null));}})[_0x9f49('0x26')](function(_0x1b30d9){if(_0x1b30d9){var _0x345b6d=_0x1b30d9[_0x9f49('0x76')]!==null;var _0x1eb54a=path['join'](config[_0x9f49('0x77')],_0x9f49('0x78'));if(_0x345b6d){_0x1eb54a=path[_0x9f49('0x79')](_0x1eb54a,_0x9f49('0x7a'));}var _0x39fe70=path[_0x9f49('0x79')](_0x1eb54a,_0x1b30d9[_0x9f49('0x6e')]);return _0x197faa[_0x9f49('0x7b')](_0x39fe70);}})[_0x9f49('0x3e')](handleError(_0x197faa,null));};exports[_0x9f49('0x7c')]=function(_0x26d17f,_0xbed905){var _0x466084=null;var _0x130fea=null;var _0x3a1003=null;if(_0x26d17f[_0x9f49('0x2d')]['id']){delete _0x26d17f[_0x9f49('0x2d')]['id'];}if(_0x26d17f[_0x9f49('0x2d')][_0x9f49('0x7d')]){_0x3a1003=path[_0x9f49('0x79')](config[_0x9f49('0x77')],_0x9f49('0x7e'),util[_0x9f49('0x7f')](_0x9f49('0x80'),Date['now']()));_0x26d17f[_0x9f49('0x2d')][_0x9f49('0x81')]=_0x3a1003;}return db[_0x9f49('0x34')][_0x9f49('0x48')]({'where':{'id':_0x26d17f['params']['id']},'include':[{'model':db[_0x9f49('0x60')],'as':_0x9f49('0x82'),'include':[{'model':db[_0x9f49('0x83')],'as':_0x9f49('0x83')}]}]})[_0x9f49('0x26')](handleEntityNotFound(_0xbed905,null))[_0x9f49('0x26')](saveUpdates(_0x26d17f[_0x9f49('0x2d')],null))['then'](function(_0x3b16d4){if(_0x3b16d4){_0x466084=_0x3b16d4;return db[_0x9f49('0x4e')][_0x9f49('0x48')]({'where':{'id':_0x466084[_0x9f49('0x50')]}});}})[_0x9f49('0x26')](function(_0x11061e){if(_0x11061e){_0x130fea=_0x11061e;return db[_0x9f49('0x63')][_0x9f49('0x48')]({'where':{'id':_0x466084['ContactId']}});}})[_0x9f49('0x26')](function(_0x4eb550){if(_0x4eb550){if(_0x3a1003){var _0x445fa7=null;for(var _0x22ee11=0x1;_0x22ee11<_0x466084['Messages'][_0x9f49('0x44')];++_0x22ee11){_0x445fa7=_0x466084[_0x9f49('0x82')][_0x22ee11];var _0x55f334=_0x445fa7[_0x9f49('0x68')]?util[_0x9f49('0x7f')]('%s%d',_0x130fea['agentAlias'],_0x445fa7[_0x9f49('0x68')]):_0x9f49('0x84');var _0xeaa7bd=_0x26d17f[_0x9f49('0x2d')][_0x9f49('0x85')]||util[_0x9f49('0x7f')](_0x9f49('0x86'),'Visitor',_0x445fa7[_0x9f49('0x87')]);switch(_0x130fea[_0x9f49('0x88')]){case _0x9f49('0x89'):_0x55f334=_0x445fa7[_0x9f49('0x68')]?util['format']('%s%d',_0x130fea[_0x9f49('0x8a')],_0x445fa7[_0x9f49('0x68')]):_0x9f49('0x84');break;case _0x9f49('0x8b'):_0x55f334=_0x445fa7[_0x9f49('0x68')]?_0x445fa7['User'][_0x9f49('0x8c')]||_0x445fa7[_0x9f49('0x83')]['fullname']:_0x9f49('0x84');break;case _0x9f49('0x8d'):_0x55f334=_0x445fa7[_0x9f49('0x68')]?_0x445fa7[_0x9f49('0x83')]['fullname']:_0x9f49('0x84');break;default:_0x55f334=_0x445fa7[_0x9f49('0x68')]?util[_0x9f49('0x7f')](_0x9f49('0x86'),_0x130fea[_0x9f49('0x8a')],_0x445fa7[_0x9f49('0x68')]):'System';}var _0x159875=util[_0x9f49('0x7f')](_0x9f49('0x8e'),moment(_0x445fa7['createdAt'])['format'](_0x9f49('0x8f')),_0x445fa7[_0x9f49('0x90')]==='in'?_0xeaa7bd:_0x55f334,_0x445fa7[_0x9f49('0x2d')]);if(!_0x445fa7['secret']){fs[_0x9f49('0x91')](_0x3a1003,_0x159875);}}return db['MailAccount'][_0x9f49('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0x9f49('0x92')],'as':_0x9f49('0x93'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x9f49('0x26')](function(_0x334209){if(!_0x334209||!_0x334209['Smtp']||!_0x26d17f[_0x9f49('0x2d')])return _0x466084;var _0x4cecfe=_0x334209[_0x9f49('0x94')]();return respondWithRpcPromise(_0x9f49('0x95'),_0x9f49('0x96'),{'account':_0x4cecfe,'message':{'from':util[_0x9f49('0x7f')](_0x9f49('0x97'),_0x334209[_0x9f49('0x29')],_0x334209['email']||_0x334209[_0x9f49('0x93')]['user']),'to':_0x26d17f['body'][_0x9f49('0x7d')],'subject':_0x9f49('0x98'),'text':util[_0x9f49('0x7f')](_0x9f49('0x99'),_0x26d17f['body']['mailTranscript']),'attachments':[{'path':_0x3a1003}]}})[_0x9f49('0x26')](function(){return _0x466084;})[_0x9f49('0x3e')](function(_0x5445c0){logger[_0x9f49('0x19')](_0x5445c0);});})[_0x9f49('0x26')](respondWithStatusCode(_0xbed905,0xc8))[_0x9f49('0x3e')](handleError(_0xbed905,null));};exports['addMessage']=function(_0x247b4b,_0x8c6a87){return db['ChatMessage'][_0x9f49('0x48')]({'where':{'id':_0x247b4b[_0x9f49('0x4d')]['id']}})[_0x9f49('0x26')](handleEntityNotFound(_0x8c6a87,null))[_0x9f49('0x26')](function(_0x274035){if(_0x274035){return _0x274035[_0x9f49('0x9a')](_0x247b4b[_0x9f49('0x2d')][_0x9f49('0x9b')],_[_0x9f49('0x9c')](_0x247b4b[_0x9f49('0x2d')],[_0x9f49('0x9b'),'id'])||{});}})['then'](respondWithResult(_0x8c6a87,null))['catch'](handleError(_0x8c6a87,null));};exports['getMessages']=function(_0x14f3a5,_0x564604){var _0xcfea5e={'raw':![],'where':{}};var _0x36b073={};var _0x418aba={'count':0x0,'rows':[]};return db[_0x9f49('0x34')][_0x9f49('0x4f')]({'where':{'id':_0x14f3a5[_0x9f49('0x4d')]['id']}})[_0x9f49('0x26')](handleEntityNotFound(_0x564604,null))[_0x9f49('0x26')](function(_0x13faf5){if(_0x13faf5){_0x36b073[_0x9f49('0x41')]=_[_0x9f49('0x3f')](db[_0x9f49('0x60')]['rawAttributes']);_0x36b073['query']=_[_0x9f49('0x3f')](_0x14f3a5['query']);_0x36b073[_0x9f49('0x9d')]=_[_0x9f49('0x40')](_0x36b073[_0x9f49('0x41')],_0x36b073[_0x9f49('0x3c')]);_0xcfea5e['attributes']=_[_0x9f49('0x40')](_0x36b073[_0x9f49('0x41')],qs['fields'](_0x14f3a5['query'][_0x9f49('0x43')]));_0xcfea5e['attributes']=_0xcfea5e[_0x9f49('0x42')][_0x9f49('0x44')]?_0xcfea5e['attributes']:_0x36b073[_0x9f49('0x41')];if(!_0x14f3a5['query']['hasOwnProperty'](_0x9f49('0x9e'))){_0xcfea5e[_0x9f49('0x23')]=qs[_0x9f49('0x23')](_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0x23')]);_0xcfea5e['offset']=qs[_0x9f49('0x21')](_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0x21')]);}_0xcfea5e[_0x9f49('0x9f')]=qs[_0x9f49('0xa0')](_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0xa0')]);_0xcfea5e[_0x9f49('0xa1')]=qs[_0x9f49('0x9d')](_[_0x9f49('0xa2')](_0x14f3a5[_0x9f49('0x3c')],_0x36b073[_0x9f49('0x9d')]));_0xcfea5e['where'][_0x9f49('0xa3')]=_0x13faf5['id'];if(_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0xa4')]){_0xcfea5e['where']=_[_0x9f49('0x2c')](_0xcfea5e['where'],{'$or':_[_0x9f49('0x33')](_0xcfea5e[_0x9f49('0x42')],function(_0x47b463){var _0x10a859={};_0x10a859[_0x47b463]={'$like':'%'+_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0xa4')]+'%'};return _0x10a859;})});}if(_0x14f3a5[_0x9f49('0x3c')][_0x9f49('0xa5')]){var _0x2218a1=_0x14f3a5['query'][_0x9f49('0xa5')]['split'](',');var _0x1c257b={};_0x1c257b[_0x2218a1[0x0]]={'$gte':moment(_0x2218a1[0x1])[_0x9f49('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')};_0xcfea5e[_0x9f49('0xa1')]=_[_0x9f49('0x2c')](_0xcfea5e[_0x9f49('0xa1')],_0x1c257b);}_0xcfea5e=_[_0x9f49('0x2c')]({},_0xcfea5e,_0x14f3a5[_0x9f49('0x47')]);return db['ChatMessage']['count']({'where':_0xcfea5e[_0x9f49('0xa1')]})[_0x9f49('0x26')](function(_0x2bc1df){_0x418aba['count']=_0x2bc1df;if(_0x14f3a5[_0x9f49('0x3c')]['includeAll']){_0xcfea5e[_0x9f49('0x46')]=[{'all':!![]}];}return db[_0x9f49('0x60')]['findAll'](_0xcfea5e);})[_0x9f49('0x26')](function(_0x53f6f2){_0x418aba['rows']=_0x53f6f2;return _0x418aba;});}})[_0x9f49('0x26')](respondWithFilteredResult(_0x564604,_0xcfea5e))['catch'](handleError(_0x564604,null));};exports[_0x9f49('0xa6')]=function(_0x271fe2,_0x562cb7){var _0x4a59db={'where':{}},_0x2050aa={},_0x3545ac={'count':0x0,'rows':[]};return db[_0x9f49('0x34')][_0x9f49('0x4f')]({'where':{'id':_0x271fe2[_0x9f49('0x4d')]['id']}})[_0x9f49('0x26')](handleEntityNotFound(_0x562cb7,null))[_0x9f49('0x26')](function(_0x413072){if(_0x413072){_0x2050aa['model']=_[_0x9f49('0x3f')](db[_0x9f49('0x60')][_0x9f49('0x35')]);_0x2050aa[_0x9f49('0x3c')]=_['keys'](_0x271fe2[_0x9f49('0x3c')]);_0x2050aa[_0x9f49('0x9d')]=_['intersection'](_0x2050aa['model'],_0x2050aa[_0x9f49('0x3c')]);_0x4a59db[_0x9f49('0x42')]=_['intersection'](_0x2050aa[_0x9f49('0x41')],qs[_0x9f49('0x43')](_0x271fe2[_0x9f49('0x3c')][_0x9f49('0x43')]));_0x4a59db[_0x9f49('0x42')]=_0x4a59db[_0x9f49('0x42')][_0x9f49('0x44')]?_0x4a59db['attributes']:_0x2050aa['model'];if(!_0x271fe2[_0x9f49('0x3c')][_0x9f49('0xa7')](_0x9f49('0x9e'))){_0x4a59db[_0x9f49('0x23')]=qs[_0x9f49('0x23')](_0x271fe2['query']['limit']);_0x4a59db[_0x9f49('0x21')]=qs['offset'](_0x271fe2['query']['offset']);}_0x4a59db['order']=qs['sort'](_0x271fe2['query'][_0x9f49('0xa0')]);_0x4a59db[_0x9f49('0xa1')]=qs['filters'](_[_0x9f49('0xa2')](_0x271fe2['query'],_0x2050aa['filters']));_0x4a59db[_0x9f49('0xa1')][_0x9f49('0xa3')]=_0x413072['id'];if(_0x271fe2['query']['filter']){_0x4a59db[_0x9f49('0xa1')]=_[_0x9f49('0x2c')](_0x4a59db[_0x9f49('0xa1')],{'$or':_[_0x9f49('0x33')](_0x4a59db[_0x9f49('0x42')],function(_0x1fc4b3){var _0x28fee4={};_0x28fee4[_0x1fc4b3]={'$like':'%'+_0x271fe2[_0x9f49('0x3c')]['filter']+'%'};return _0x28fee4;})});}_0x4a59db[_0x9f49('0xa1')][_0x9f49('0xa8')]=![];if(_0x271fe2[_0x9f49('0x3c')]['id']){_0x4a59db[_0x9f49('0xa1')]['id']={'$gt':_0x271fe2[_0x9f49('0x3c')]['id']};}_0x4a59db=_[_0x9f49('0x2c')]({},_0x4a59db,_0x271fe2['options']);return db[_0x9f49('0x60')][_0x9f49('0x24')]({'where':_0x4a59db[_0x9f49('0xa1')]})[_0x9f49('0x26')](function(_0x4171a5){_0x3545ac[_0x9f49('0x24')]=_0x4171a5;_0x4a59db[_0x9f49('0x46')]=[];if(_0x271fe2[_0x9f49('0x3c')]['includeAgent']){_0x4a59db[_0x9f49('0x46')]['push']({'model':db[_0x9f49('0x83')],'as':_0x9f49('0x83'),'attributes':['id',_0x9f49('0xa9'),_0x9f49('0x8c')]});}if(_0x271fe2[_0x9f49('0x3c')][_0x9f49('0x45')]){_0x4a59db[_0x9f49('0x46')]=[{'all':!![]}];}return db[_0x9f49('0x60')][_0x9f49('0x3a')](_0x4a59db);})[_0x9f49('0x26')](function(_0x5221f3){_0x3545ac[_0x9f49('0xaa')]=_0x5221f3;return _0x3545ac;});}})[_0x9f49('0x26')](respondWithFilteredResult(_0x562cb7,_0x4a59db))[_0x9f49('0x3e')](handleError(_0x562cb7,null));};exports['addTags']=function(_0x49c2f8,_0xa5fe62){return db[_0x9f49('0x34')][_0x9f49('0x48')]({'where':{'id':_0x49c2f8['params']['id']}})[_0x9f49('0x26')](handleEntityNotFound(_0xa5fe62,null))[_0x9f49('0x26')](function(_0x4780a0){if(_0x4780a0){return _0x4780a0[_0x9f49('0xab')](_0x49c2f8[_0x9f49('0x2d')][_0x9f49('0x9b')],_[_0x9f49('0x9c')](_0x49c2f8[_0x9f49('0x2d')],[_0x9f49('0x9b'),'id'])||{})[_0x9f49('0xac')](function(){return db[_0x9f49('0xad')][_0x9f49('0x3a')]({'attributes':['id',_0x9f49('0x29'),_0x9f49('0xae')],'where':{'id':_0x49c2f8[_0x9f49('0x2d')][_0x9f49('0x9b')]}});})[_0x9f49('0x26')](function(_0x451f7a){socket[_0x9f49('0xaf')](_0x9f49('0xb0'),{'id':Number(_0x49c2f8[_0x9f49('0x4d')]['id']),'tags':_0x451f7a||[]});return{'id':Number(_0x49c2f8['params']['id']),'tags':_0x451f7a||[]};});}})[_0x9f49('0x26')](respondWithResult(_0xa5fe62,null))['catch'](handleError(_0xa5fe62,null));};exports['removeTags']=function(_0x40d377,_0x516804){return db[_0x9f49('0x34')][_0x9f49('0x48')]({'where':{'id':_0x40d377[_0x9f49('0x4d')]['id']}})['then'](handleEntityNotFound(_0x516804,null))['then'](function(_0x5d4bcf){if(_0x5d4bcf){return _0x5d4bcf['removeTags'](_0x40d377[_0x9f49('0x3c')]['ids']);}})[_0x9f49('0x26')](respondWithStatusCode(_0x516804,null))['catch'](handleError(_0x516804,null));};exports[_0x9f49('0x7b')]=function(_0x5e6261,_0x2874a3){var _0x22a0ac=moment()[_0x9f49('0xb1')]()[_0x9f49('0xb2')]();var _0x42383e=path[_0x9f49('0x79')](config[_0x9f49('0x77')],_0x9f49('0xb3'),'files',_0x9f49('0xb4'));var _0x3f17a9=path[_0x9f49('0x79')](config[_0x9f49('0x77')],'server','files',_0x9f49('0xb5'));var _0x220edf=path[_0x9f49('0x79')](_0x42383e,_0x22a0ac);var _0x986f3d=util[_0x9f49('0x7f')](_0x9f49('0xb6'),_0x5e6261[_0x9f49('0x4d')]['id'],_0x22a0ac);var _0x30e28b=path[_0x9f49('0x79')](_0x42383e,_0x986f3d);var _0x4e0fb4=[];_0x4e0fb4[_0x9f49('0xb7')]({'model':db['User'],'as':_0x9f49('0x83'),'attributes':['id',_0x9f49('0xa9')],'raw':!![]});_0x4e0fb4['push']({'model':db[_0x9f49('0x63')],'as':_0x9f49('0x64'),'attributes':['id','firstName',_0x9f49('0xb8')],'raw':!![]});if(_0x5e6261[_0x9f49('0x3c')]['attachments']){_0x4e0fb4[_0x9f49('0xb7')]({'model':db[_0x9f49('0x74')],'as':_0x9f49('0x74'),'raw':!![]});}var _0x5a787f=[{'model':db[_0x9f49('0x60')],'as':_0x9f49('0x82'),'attributes':['id',_0x9f49('0x2d'),_0x9f49('0xb9'),_0x9f49('0x90'),'secret',_0x9f49('0xba')],'include':_0x4e0fb4}];_0x5a787f[_0x9f49('0xb7')]({'model':db[_0x9f49('0x4e')],'as':'Account','attributes':['id',_0x9f49('0x29')]});_0x5a787f[_0x9f49('0xb7')]({'model':db[_0x9f49('0x83')],'as':_0x9f49('0xbb'),'attributes':['id',_0x9f49('0xa9')]});return db[_0x9f49('0x34')][_0x9f49('0x48')]({'where':{'id':_0x5e6261[_0x9f49('0x4d')]['id']},'include':_0x5a787f})['then'](handleEntityNotFound(_0x2874a3,null))['then'](function(_0x41779e){if(_0x41779e){var _0x2b03fa=_0x41779e['get']({'plain':!![]});fs[_0x9f49('0xbc')](_0x220edf);var _0x34c744={'channel':_0x9f49('0xbd'),'account':_0x2b03fa[_0x9f49('0xbe')][_0x9f49('0x29')],'agent':_0x2b03fa['Owner']?_0x2b03fa['Owner'][_0x9f49('0xa9')]:_0x9f49('0xbf'),'createdAt':moment(_0x2b03fa[_0x9f49('0xb9')])[_0x9f49('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9f49('0xb2')](),'closedAt':_0x2b03fa[_0x9f49('0x6a')]?moment(_0x2b03fa['closedAt'])['format'](_0x9f49('0xc0'))[_0x9f49('0xb2')]():'','disposition':_0x2b03fa[_0x9f49('0xc1')],'chatInfo':{'browser':_0x2b03fa['browserName'],'os':_0x2b03fa[_0x9f49('0xc2')],'referer':_0x2b03fa[_0x9f49('0xc3')],'customerIp':_0x2b03fa[_0x9f49('0xc4')],'customerPort':_0x2b03fa['customerPort']?_0x2b03fa[_0x9f49('0xc5')]:_0x9f49('0xbf')},'messages':_(_0x2b03fa['Messages'])[_0x9f49('0xc6')]()['filter']({'secret':![]})[_0x9f49('0x33')](function(_0x5f37c8){if(_0x5f37c8[_0x9f49('0x74')]){var _0x5bcb23=path[_0x9f49('0x79')](_0x3f17a9,_0x5f37c8[_0x9f49('0x74')][_0x9f49('0x6e')]);if(fs['existsSync'](_0x5bcb23)){fs[_0x9f49('0xc7')](_0x5bcb23)['pipe'](fs[_0x9f49('0xc8')](path[_0x9f49('0x79')](_0x220edf,_0x5f37c8[_0x9f49('0x74')]['basename'])));}}return{'date':moment(_0x5f37c8[_0x9f49('0xb9')])[_0x9f49('0x7f')](_0x9f49('0xc0'))[_0x9f49('0xb2')](),'sender':_0x5f37c8[_0x9f49('0x90')]==='out'?_0x5f37c8[_0x9f49('0x83')]?_0x5f37c8[_0x9f49('0x83')][_0x9f49('0xa9')]:_0x9f49('0x84'):_0x5f37c8[_0x9f49('0x64')][_0x9f49('0xc9')]+(_0x5f37c8[_0x9f49('0x64')]['lastName']?'\x20'+_0x5f37c8[_0x9f49('0x64')][_0x9f49('0xb8')]:''),'body':_0x5f37c8[_0x9f49('0x74')]?_0x5f37c8[_0x9f49('0x74')][_0x9f49('0x6e')]:_0x5f37c8[_0x9f49('0x2d')],'direction':_0x5f37c8[_0x9f49('0x90')]===_0x9f49('0x5f')?'A':'C','secret':_0x5f37c8[_0x9f49('0xa8')],'read':_0x5f37c8[_0x9f49('0xba')],'attachment':_0x5f37c8[_0x9f49('0x74')]};})['value']()};return ejs['renderFile'](path[_0x9f49('0x79')](config['root'],'server',_0x9f49('0xca'),_0x9f49('0xcb')),{'interaction':_0x34c744})[_0x9f49('0x26')](function(_0x22ac33){var _0x1fdd54=path[_0x9f49('0x79')](_0x220edf,_0x9f49('0xcc')+_0x2b03fa['id']+'-'+_0x22a0ac+_0x9f49('0xcd'));var _0x268a64={'path':_0x1fdd54,'channel':_0x9f49('0xbd'),'interactionId':_0x2b03fa['id']};return pdf['createPdfFromHTML'](_0x22ac33,_0x268a64);})['then'](function(){return new Promise(function(_0x7aeb26,_0x2b2d7c){zipdir(_0x220edf,{'saveTo':_0x30e28b},function(_0x297bb2,_0x4a9b1f){if(_0x297bb2)return _0x2b2d7c(_0x297bb2);return _0x7aeb26(_0x4a9b1f);});})[_0x9f49('0x26')](function(){return new BPromise(function(_0x108c19,_0x15f893){rimraf(_0x220edf,function(_0x101945){if(_0x101945)_0x15f893(_0x101945);return _0x108c19();});});})[_0x9f49('0x26')](function(){return _0x2874a3[_0x9f49('0x7b')](_0x30e28b,_0x986f3d,function(_0x19f2c5){if(_0x19f2c5){logger[_0x9f49('0x19')]('err',_0x19f2c5);}else{fs[_0x9f49('0xce')](_0x30e28b);}});});});}else{return _0x2874a3[_0x9f49('0x1d')](0xc8);}})['catch'](handleError(_0x2874a3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a7a272b..856877b 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 _0x7872=['save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x5403f5,_0x5b5030){var _0xfd371c=function(_0x49fdaa){while(--_0x49fdaa){_0x5403f5['push'](_0x5403f5['shift']());}};_0xfd371c(++_0x5b5030);}(_0x7872,0x11d));var _0x2787=function(_0x20065b,_0x74d1ad){_0x20065b=_0x20065b-0x0;var _0x513277=_0x7872[_0x20065b];return _0x513277;};'use strict';var EventEmitter=require(_0x2787('0x0'));var ChatInteraction=require(_0x2787('0x1'))['db'][_0x2787('0x2')];var ChatMessage=require(_0x2787('0x1'))['db'][_0x2787('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2787('0x4'),'afterUpdate':_0x2787('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2dc006){return function(_0x525c99,_0x535b51,_0x257eaf){_0x525c99[_0x2787('0x6')]({'attributes':['id'],'raw':!![]})[_0x2787('0x7')](function(_0x575e01){_0x525c99[_0x2787('0x8')](_0x2787('0x9'),_0x575e01[_0x2787('0xa')](function(_0x5bbbfb){return{'id':_0x5bbbfb['id']};}));return ChatMessage[_0x2787('0xb')]({'where':{'ChatInteractionId':_0x525c99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2787('0x7')](function(_0x31de16){_0x525c99[_0x2787('0x8')](_0x2787('0xc'),_0x31de16[_0x2787('0xd')]);ChatInteractionEvents['emit'](_0x2dc006+':'+_0x525c99['id'],_0x525c99);ChatInteractionEvents['emit'](_0x2dc006,_0x525c99);_0x257eaf(null);})['catch'](_0x257eaf(null));};}for(var e in events){if(events[_0x2787('0xe')](e)){var event=events[e];ChatInteraction[_0x2787('0xf')](e,emitEvent(event));}}module[_0x2787('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x1574=['events','ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','exports'];(function(_0x2c7226,_0x29e306){var _0x7853d8=function(_0x569660){while(--_0x569660){_0x2c7226['push'](_0x2c7226['shift']());}};_0x7853d8(++_0x29e306);}(_0x1574,0x70));var _0x4157=function(_0x34be0c,_0x5ca776){_0x34be0c=_0x34be0c-0x0;var _0x5b47c6=_0x1574[_0x34be0c];return _0x5b47c6;};'use strict';var EventEmitter=require(_0x4157('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4157('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x4157('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4157('0x3')](0x0);var events={'afterCreate':_0x4157('0x4'),'afterUpdate':_0x4157('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41f331){return function(_0xdd4e2b,_0x5c7d11,_0x56f05d){_0xdd4e2b[_0x4157('0x6')]({'attributes':['id'],'raw':!![]})[_0x4157('0x7')](function(_0x16bf9d){_0xdd4e2b[_0x4157('0x8')](_0x4157('0x9'),_0x16bf9d['map'](function(_0x56a87e){return{'id':_0x56a87e['id']};}));return ChatMessage[_0x4157('0xa')]({'where':{'ChatInteractionId':_0xdd4e2b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43ff3f){_0xdd4e2b[_0x4157('0x8')]('unreadMessages',_0x43ff3f[_0x4157('0xb')]);ChatInteractionEvents[_0x4157('0xc')](_0x41f331+':'+_0xdd4e2b['id'],_0xdd4e2b);ChatInteractionEvents[_0x4157('0xc')](_0x41f331,_0xdd4e2b);_0x56f05d(null);})['catch'](_0x56f05d(null));};}for(var e in events){if(events[_0x4157('0xd')](e)){var event=events[e];ChatInteraction[_0x4157('0xe')](e,emitEvent(event));}}module[_0x4157('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 53d8a48..98a6d2f 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 _0x6fd5=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions','changed'];(function(_0x1b4ef6,_0x5a5199){var _0x39539e=function(_0x3a0b95){while(--_0x3a0b95){_0x1b4ef6['push'](_0x1b4ef6['shift']());}};_0x39539e(++_0x5a5199);}(_0x6fd5,0x19d));var _0x56fd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6fd5[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x56fd('0x0'));var util=require(_0x56fd('0x1'));var logger=require(_0x56fd('0x2'))('api');var moment=require(_0x56fd('0x3'));var BPromise=require(_0x56fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56fd('0x5'));var rimraf=require(_0x56fd('0x6'));var config=require(_0x56fd('0x7'));var attributes=require(_0x56fd('0x8'));module['exports']=function(_0x26a3aa,_0x1404e0){return _0x26a3aa[_0x56fd('0x9')]('ChatInteraction',attributes,{'tableName':_0x56fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28a2f6,_0x397a9d,_0x28538e){if(_0x28a2f6[_0x56fd('0xb')](_0x56fd('0xc'))){_0x28a2f6[_0x56fd('0xd')]=moment()[_0x56fd('0xe')](_0x56fd('0xf'));}_0x28538e(null,_0x28a2f6);}},'charset':_0x56fd('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf593=['request-promise','path','rimraf','../../config/environment','changed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1fa44b,_0x3f06d0){var _0x2f999f=function(_0x41c389){while(--_0x41c389){_0x1fa44b['push'](_0x1fa44b['shift']());}};_0x2f999f(++_0x3f06d0);}(_0xf593,0xb1));var _0x3f59=function(_0x50b867,_0x58a9b3){_0x50b867=_0x50b867-0x0;var _0x392636=_0xf593[_0x50b867];return _0x392636;};'use strict';var _=require(_0x3f59('0x0'));var util=require(_0x3f59('0x1'));var logger=require(_0x3f59('0x2'))(_0x3f59('0x3'));var moment=require(_0x3f59('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f59('0x5'));var fs=require('fs');var path=require(_0x3f59('0x6'));var rimraf=require(_0x3f59('0x7'));var config=require(_0x3f59('0x8'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x20c7d0,_0x2498dc){return _0x20c7d0['define']('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25ae03,_0xa67639,_0x25f11a){if(_0x25ae03[_0x3f59('0x9')]('closed')){_0x25ae03['closedAt']=moment()[_0x3f59('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25f11a(null,_0x25ae03);}},'charset':_0x3f59('0xb'),'collate':_0x3f59('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6cf6164..3d5a8cf 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 _0x5eaa=['ChatInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','UpdateChatInteraction','body','options','raw','attributes','limit','info','AddTagsToChatInteraction'];(function(_0x460423,_0x46c773){var _0x3c65f3=function(_0x11dbf7){while(--_0x11dbf7){_0x460423['push'](_0x460423['shift']());}};_0x3c65f3(++_0x46c773);}(_0x5eaa,0x13f));var _0xa5ea=function(_0x1f1de6,_0x257813){_0x1f1de6=_0x1f1de6-0x0;var _0x1a74cd=_0x5eaa[_0x1f1de6];return _0x1a74cd;};'use strict';var _=require(_0xa5ea('0x0'));var util=require(_0xa5ea('0x1'));var moment=require('moment');var BPromise=require(_0xa5ea('0x2'));var rs=require(_0xa5ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5ea('0x4'))['db'];var utils=require(_0xa5ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa5ea('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa5ea('0x7')]({'port':0x232a});config[_0xa5ea('0x8')]=_[_0xa5ea('0x9')](config[_0xa5ea('0x8')],{'host':_0xa5ea('0xa'),'port':0x18eb});var socket=require(_0xa5ea('0xb'))(new Redis(config['redis']));require(_0xa5ea('0xc'))[_0xa5ea('0xd')](socket);function respondWithRpcPromise(_0x58d20d,_0x29972b,_0x332f0a){return new BPromise(function(_0x39a801,_0x3baf6d){return client[_0xa5ea('0xe')](_0x58d20d,_0x332f0a)[_0xa5ea('0xf')](function(_0x4629cd){logger['info'](_0xa5ea('0x10'),_0x29972b,'request\x20sent');logger[_0xa5ea('0x11')](_0xa5ea('0x12'),_0x29972b,'request\x20sent',JSON[_0xa5ea('0x13')](_0x4629cd));if(_0x4629cd[_0xa5ea('0x14')]){if(_0x4629cd['error']['code']===0x1f4){logger[_0xa5ea('0x14')](_0xa5ea('0x10'),_0x29972b,_0x4629cd['error'][_0xa5ea('0x15')]);return _0x3baf6d(_0x4629cd[_0xa5ea('0x14')]['message']);}logger[_0xa5ea('0x14')](_0xa5ea('0x10'),_0x29972b,_0x4629cd[_0xa5ea('0x14')][_0xa5ea('0x15')]);return _0x39a801(_0x4629cd[_0xa5ea('0x14')]['message']);}else{logger['info'](_0xa5ea('0x10'),_0x29972b,_0xa5ea('0x16'));_0x39a801(_0x4629cd['result'][_0xa5ea('0x15')]);}})[_0xa5ea('0x17')](function(_0x18b586){logger[_0xa5ea('0x14')](_0xa5ea('0x10'),_0x29972b,_0x18b586);_0x3baf6d(_0x18b586);});});}exports[_0xa5ea('0x18')]=function(_0x2f95d8){var _0x32cb84=this;return new Promise(function(_0x5e7e49,_0xde5196){return db['ChatInteraction']['update'](_0x2f95d8[_0xa5ea('0x19')],{'raw':_0x2f95d8[_0xa5ea('0x1a')]?_0x2f95d8[_0xa5ea('0x1a')][_0xa5ea('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f95d8[_0xa5ea('0x1a')]?_0x2f95d8[_0xa5ea('0x1a')]['where']||null:null,'attributes':_0x2f95d8['options']?_0x2f95d8['options'][_0xa5ea('0x1c')]||null:null,'limit':_0x2f95d8['options']?_0x2f95d8['options'][_0xa5ea('0x1d')]||null:null})[_0xa5ea('0xf')](function(_0x2b51eb){logger[_0xa5ea('0x1e')](_0xa5ea('0x18'),_0x2f95d8);logger[_0xa5ea('0x11')](_0xa5ea('0x18'),_0x2f95d8,JSON[_0xa5ea('0x13')](_0x2b51eb));_0x5e7e49(_0x2b51eb);})[_0xa5ea('0x17')](function(_0x203971){logger[_0xa5ea('0x14')](_0xa5ea('0x18'),_0x203971[_0xa5ea('0x15')],_0x2f95d8);_0xde5196(_0x32cb84[_0xa5ea('0x14')](0x1f4,_0x203971[_0xa5ea('0x15')]));});});};exports[_0xa5ea('0x1f')]=function(_0xc18f90){return new Promise(function(_0x2c1155,_0x5d958b){return db[_0xa5ea('0x20')][_0xa5ea('0x21')]({'where':_0xc18f90[_0xa5ea('0x1a')]?_0xc18f90[_0xa5ea('0x1a')][_0xa5ea('0x22')]||null:null})[_0xa5ea('0xf')](function(_0x188b63){if(_0x188b63){return _0x188b63[_0xa5ea('0x23')](_0xc18f90[_0xa5ea('0x19')]['ids'],_['omit'](_0xc18f90['body'],[_0xa5ea('0x24'),'id'])||{});}})[_0xa5ea('0x25')](function(_0x47cc66){logger['info'](_0xa5ea('0x26'),_0xc18f90);logger[_0xa5ea('0x11')](_0xa5ea('0x26'),_0xc18f90,JSON['stringify'](_0x47cc66));_0x2c1155(_0x47cc66);})[_0xa5ea('0x17')](function(_0x1de26e){logger[_0xa5ea('0x14')](_0xa5ea('0x26'),_0x1de26e[_0xa5ea('0x15')],_0xc18f90);_0x5d958b(_this[_0xa5ea('0x14')](0x1f4,_0x1de26e[_0xa5ea('0x15')]));});});}; \ No newline at end of file +var _0x924c=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','addTags','omit','ids','spread','AddTags'];(function(_0x5906ab,_0x1defc2){var _0x2dc711=function(_0x518a15){while(--_0x518a15){_0x5906ab['push'](_0x5906ab['shift']());}};_0x2dc711(++_0x1defc2);}(_0x924c,0x9c));var _0xc924=function(_0x533245,_0x1c1b71){_0x533245=_0x533245-0x0;var _0x27e99d=_0x924c[_0x533245];return _0x27e99d;};'use strict';var _=require(_0xc924('0x0'));var util=require(_0xc924('0x1'));var moment=require(_0xc924('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc924('0x3'));var db=require(_0xc924('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc924('0x5'))('rpc');var config=require(_0xc924('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc924('0x7')][_0xc924('0x8')]({'port':0x232a});config[_0xc924('0x9')]=_[_0xc924('0xa')](config[_0xc924('0x9')],{'host':_0xc924('0xb'),'port':0x18eb});var socket=require(_0xc924('0xc'))(new Redis(config[_0xc924('0x9')]));require(_0xc924('0xd'))['register'](socket);function respondWithRpcPromise(_0x41427f,_0x5d7399,_0x145fb3){return new BPromise(function(_0x17097a,_0x16cc40){return client['request'](_0x41427f,_0x145fb3)[_0xc924('0xe')](function(_0x547021){logger['info'](_0xc924('0xf'),_0x5d7399,'request\x20sent');logger[_0xc924('0x10')](_0xc924('0x11'),_0x5d7399,'request\x20sent',JSON[_0xc924('0x12')](_0x547021));if(_0x547021[_0xc924('0x13')]){if(_0x547021[_0xc924('0x13')]['code']===0x1f4){logger[_0xc924('0x13')](_0xc924('0xf'),_0x5d7399,_0x547021[_0xc924('0x13')][_0xc924('0x14')]);return _0x16cc40(_0x547021[_0xc924('0x13')]['message']);}logger[_0xc924('0x13')](_0xc924('0xf'),_0x5d7399,_0x547021[_0xc924('0x13')][_0xc924('0x14')]);return _0x17097a(_0x547021[_0xc924('0x13')][_0xc924('0x14')]);}else{logger[_0xc924('0x15')](_0xc924('0xf'),_0x5d7399,_0xc924('0x16'));_0x17097a(_0x547021[_0xc924('0x17')][_0xc924('0x14')]);}})[_0xc924('0x18')](function(_0x47ddf1){logger['error'](_0xc924('0xf'),_0x5d7399,_0x47ddf1);_0x16cc40(_0x47ddf1);});});}exports['UpdateChatInteraction']=function(_0x478daf){var _0x335313=this;return new Promise(function(_0x5c5f31,_0x5586fa){return db[_0xc924('0x19')][_0xc924('0x1a')](_0x478daf[_0xc924('0x1b')],{'raw':_0x478daf[_0xc924('0x1c')]?_0x478daf[_0xc924('0x1c')][_0xc924('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x478daf[_0xc924('0x1c')]?_0x478daf[_0xc924('0x1c')][_0xc924('0x1e')]||null:null,'attributes':_0x478daf[_0xc924('0x1c')]?_0x478daf[_0xc924('0x1c')][_0xc924('0x1f')]||null:null,'limit':_0x478daf['options']?_0x478daf[_0xc924('0x1c')][_0xc924('0x20')]||null:null})['then'](function(_0x5a5532){logger[_0xc924('0x15')]('UpdateChatInteraction',_0x478daf);logger['debug'](_0xc924('0x21'),_0x478daf,JSON[_0xc924('0x12')](_0x5a5532));_0x5c5f31(_0x5a5532);})[_0xc924('0x18')](function(_0x4ca29a){logger['error'](_0xc924('0x21'),_0x4ca29a['message'],_0x478daf);_0x5586fa(_0x335313[_0xc924('0x13')](0x1f4,_0x4ca29a[_0xc924('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x39fa38){return new Promise(function(_0x2637ae,_0x9cbe44){return db[_0xc924('0x19')]['find']({'where':_0x39fa38['options']?_0x39fa38['options'][_0xc924('0x1e')]||null:null})[_0xc924('0xe')](function(_0xb655ff){if(_0xb655ff){return _0xb655ff[_0xc924('0x22')](_0x39fa38[_0xc924('0x1b')]['ids'],_[_0xc924('0x23')](_0x39fa38[_0xc924('0x1b')],[_0xc924('0x24'),'id'])||{});}})[_0xc924('0x25')](function(_0x12548f){logger[_0xc924('0x15')](_0xc924('0x26'),_0x39fa38);logger['debug'](_0xc924('0x26'),_0x39fa38,JSON[_0xc924('0x12')](_0x12548f));_0x2637ae(_0x12548f);})[_0xc924('0x18')](function(_0x1614fc){logger['error'](_0xc924('0x26'),_0x1614fc[_0xc924('0x14')],_0x39fa38);_0x9cbe44(_this[_0xc924('0x13')](0x1f4,_0x1614fc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f0d67d7..c2c0d26 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 _0x0b35=['chatInteraction:','update','emit','removeListener','length'];(function(_0x40a4c2,_0x5a72c6){var _0x4d0d44=function(_0xf66afe){while(--_0xf66afe){_0x40a4c2['push'](_0x40a4c2['shift']());}};_0x4d0d44(++_0x5a72c6);}(_0x0b35,0xbf));var _0x50b3=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0x0b35[_0x3d66f0];return _0x4164f3;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x50b3('0x0')];function createListener(_0x58e7d4,_0x4cd749){return function(_0x56066b){_0x4cd749[_0x50b3('0x1')](_0x58e7d4,_0x56066b);};}function removeListener(_0xf7bdd8,_0x5da979){return function(){ChatInteractionEvents[_0x50b3('0x2')](_0xf7bdd8,_0x5da979);};}exports['register']=function(_0x3b0056){for(var _0x226ea7=0x0,_0x11d586=events[_0x50b3('0x3')];_0x226ea7<_0x11d586;_0x226ea7++){var _0x2cb610=events[_0x226ea7];var _0x578326=createListener(_0x50b3('0x4')+_0x2cb610,_0x3b0056);ChatInteractionEvents['on'](_0x2cb610,_0x578326);}}; \ No newline at end of file +var _0xce56=['save','remove','update','register','length','./chatInteraction.events'];(function(_0x1cc470,_0x1fcd2e){var _0x116514=function(_0x502566){while(--_0x502566){_0x1cc470['push'](_0x1cc470['shift']());}};_0x116514(++_0x1fcd2e);}(_0xce56,0x173));var _0x6ce5=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xce56[_0x490be3];return _0x3f5140;};'use strict';var ChatInteractionEvents=require(_0x6ce5('0x0'));var events=[_0x6ce5('0x1'),_0x6ce5('0x2'),_0x6ce5('0x3')];function createListener(_0x5be08d,_0xc4ce7d){return function(_0x5a22d7){_0xc4ce7d['emit'](_0x5be08d,_0x5a22d7);};}function removeListener(_0x538356,_0x36185f){return function(){ChatInteractionEvents['removeListener'](_0x538356,_0x36185f);};}exports[_0x6ce5('0x4')]=function(_0x2ebd64){for(var _0x4f1fbd=0x0,_0xa19152=events[_0x6ce5('0x5')];_0x4f1fbd<_0xa19152;_0x4f1fbd++){var _0x4ab62f=events[_0x4f1fbd];var _0x212a77=createListener('chatInteraction:'+_0x4ab62f,_0x2ebd64);ChatInteractionEvents['on'](_0x4ab62f,_0x212a77);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index dc2e428..4205aaf 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 _0x7788=['format','now','originalname','replace','single','file','attachmentUpload','/:id/tags','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','tracked','chatinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','server/files/attachments/'];(function(_0x10f32d,_0x1235af){var _0x5684a9=function(_0x48167b){while(--_0x48167b){_0x10f32d['push'](_0x10f32d['shift']());}};_0x5684a9(++_0x1235af);}(_0x7788,0x1da));var _0x8778=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x7788[_0x5c2a2b];return _0x19921f;};'use strict';var multer=require(_0x8778('0x0'));var util=require(_0x8778('0x1'));var path=require(_0x8778('0x2'));var timeout=require(_0x8778('0x3'));var express=require(_0x8778('0x4'));var router=express[_0x8778('0x5')]();var fs_extra=require(_0x8778('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8778('0x7'));var config=require(_0x8778('0x8'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x8778('0x9')](),controller['index']);router[_0x8778('0xa')](_0x8778('0xb'),auth[_0x8778('0x9')](),controller[_0x8778('0xc')]);router[_0x8778('0xa')](_0x8778('0xd'),auth[_0x8778('0xe')](),controller['show']);router['get'](_0x8778('0xf'),auth[_0x8778('0xe')](),controller['attachmentDownload']);router['get'](_0x8778('0x10'),auth[_0x8778('0x9')](),controller['getMessages']);router[_0x8778('0xa')](_0x8778('0x11'),auth[_0x8778('0xe')](),controller['getMyMessages']);router[_0x8778('0xa')](_0x8778('0x12'),auth[_0x8778('0x9')](),controller[_0x8778('0x13')]);router[_0x8778('0x14')]('/',auth['isAuthenticated'](),controller[_0x8778('0x15')]);router['post'](_0x8778('0x16'),auth['isAuthenticated'](),controller[_0x8778('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12d567,_0x567042,_0x4b5d79){_0x4b5d79(null,path[_0x8778('0x18')](config['root'],_0x8778('0x19')));},'filename':function(_0x5923e7,_0x3b8fb0,_0x1391e9){_0x1391e9(null,util[_0x8778('0x1a')]('%s-%s',Date[_0x8778('0x1b')](),_0x3b8fb0[_0x8778('0x1c')][_0x8778('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8778('0x14')]('/:id/attachment_upload',upload[_0x8778('0x1e')](_0x8778('0x1f')),controller[_0x8778('0x20')]);router[_0x8778('0x14')](_0x8778('0x10'),auth[_0x8778('0xe')](),controller['addMessage']);router[_0x8778('0x14')](_0x8778('0x21'),auth[_0x8778('0x9')](),interaction['tracked']('chat',_0x8778('0x22')),controller[_0x8778('0x23')]);router[_0x8778('0x24')](_0x8778('0xd'),auth[_0x8778('0x9')](),interaction['tracked'](_0x8778('0x25'),_0x8778('0x26')),controller[_0x8778('0x27')]);router[_0x8778('0x24')](_0x8778('0x28'),controller[_0x8778('0x29')]);router[_0x8778('0x24')](_0x8778('0x2a'),auth[_0x8778('0xe')](),controller[_0x8778('0x2b')]);router[_0x8778('0x24')]('/:id/close',controller[_0x8778('0x2c')]);router['delete'](_0x8778('0xd'),auth[_0x8778('0x9')](),interaction[_0x8778('0x2d')](_0x8778('0x25'),_0x8778('0x2e')),controller[_0x8778('0x2f')]);router[_0x8778('0x30')](_0x8778('0x21'),auth[_0x8778('0x9')](),controller['removeTags']);module[_0x8778('0x31')]=router; \ No newline at end of file +var _0x8cf0=['tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','multer','util','path','express','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','addMessage'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x8cf0,0x182));var _0x08cf=function(_0x146bdd,_0x12dac4){_0x146bdd=_0x146bdd-0x0;var _0x32dbb5=_0x8cf0[_0x146bdd];return _0x32dbb5;};'use strict';var multer=require(_0x08cf('0x0'));var util=require(_0x08cf('0x1'));var path=require(_0x08cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x08cf('0x3'));var router=express[_0x08cf('0x4')]();var fs_extra=require(_0x08cf('0x5'));var auth=require(_0x08cf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x08cf('0x7'));router[_0x08cf('0x8')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0xa')]);router[_0x08cf('0x8')](_0x08cf('0xb'),auth[_0x08cf('0x9')](),controller[_0x08cf('0xc')]);router[_0x08cf('0x8')](_0x08cf('0xd'),auth[_0x08cf('0xe')](),controller[_0x08cf('0xf')]);router[_0x08cf('0x8')](_0x08cf('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x08cf('0x11')]);router[_0x08cf('0x8')](_0x08cf('0x12'),auth['isAuthenticated'](),controller[_0x08cf('0x13')]);router[_0x08cf('0x8')](_0x08cf('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x08cf('0x15')]);router[_0x08cf('0x8')](_0x08cf('0x16'),auth[_0x08cf('0x9')](),controller[_0x08cf('0x17')]);router[_0x08cf('0x18')]('/',auth[_0x08cf('0x9')](),controller[_0x08cf('0x19')]);router['post'](_0x08cf('0x1a'),auth[_0x08cf('0x9')](),controller[_0x08cf('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c704a,_0x281883,_0x558278){_0x558278(null,path['join'](config[_0x08cf('0x1c')],_0x08cf('0x1d')));},'filename':function(_0xb0e967,_0x25fef4,_0x387cbd){_0x387cbd(null,util[_0x08cf('0x1e')](_0x08cf('0x1f'),Date[_0x08cf('0x20')](),_0x25fef4[_0x08cf('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x08cf('0x18')](_0x08cf('0x22'),upload[_0x08cf('0x23')](_0x08cf('0x24')),controller['attachmentUpload']);router[_0x08cf('0x18')](_0x08cf('0x12'),auth[_0x08cf('0xe')](),controller[_0x08cf('0x25')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x08cf('0x26')](_0x08cf('0x27'),_0x08cf('0x28')),controller[_0x08cf('0x29')]);router['put'](_0x08cf('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x08cf('0x27'),_0x08cf('0x2a')),controller[_0x08cf('0x2b')]);router['put'](_0x08cf('0x2c'),controller[_0x08cf('0x2d')]);router[_0x08cf('0x2e')](_0x08cf('0x2f'),auth[_0x08cf('0xe')](),controller['abandon']);router[_0x08cf('0x2e')](_0x08cf('0x30'),controller['close']);router[_0x08cf('0x31')]('/:id',auth['isAuthenticated'](),interaction[_0x08cf('0x26')](_0x08cf('0x27'),_0x08cf('0x32')),controller[_0x08cf('0x33')]);router[_0x08cf('0x31')](_0x08cf('0x34'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4d0f122..39e37e6 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 _0x907e=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0xc500e9,_0x3f8a77){var _0x45facb=function(_0x3f33b6){while(--_0x3f33b6){_0xc500e9['push'](_0xc500e9['shift']());}};_0x45facb(++_0x3f8a77);}(_0x907e,0x1a7));var _0xe907=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x907e[_0x53bcc3];return _0x47c959;};'use strict';var Sequelize=require(_0xe907('0x0'));module[_0xe907('0x1')]={'body':{'type':Sequelize[_0xe907('0x2')](_0xe907('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe907('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe907('0x5')]}}; \ No newline at end of file +var _0xd3d9=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x1c577c,_0x36e313){var _0x503a89=function(_0x144b8f){while(--_0x144b8f){_0x1c577c['push'](_0x1c577c['shift']());}};_0x503a89(++_0x36e313);}(_0xd3d9,0xd2));var _0x9d3d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd3d9[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x9d3d('0x0'));module[_0x9d3d('0x1')]={'body':{'type':Sequelize[_0x9d3d('0x2')](_0x9d3d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9d3d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9d3d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 96f8757..8e65d38 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 _0x2559=['register','sendStatus','status','limit','undefined','count','offset','Content-Range','json','reject','save','update','destroy','then','end','error','stack','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','name','query','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','attributes','find','body','describe','get','messages','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','findAll','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','createdAt','ToId','read','all','eml-format','rimraf','fast-json-patch','moment','mustache','sox','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x5ba749,_0x1e29f3){var _0x47732e=function(_0x3b6717){while(--_0x3b6717){_0x5ba749['push'](_0x5ba749['shift']());}};_0x47732e(++_0x1e29f3);}(_0x2559,0x127));var _0x9255=function(_0x18ff90,_0x3bc7ce){_0x18ff90=_0x18ff90-0x0;var _0x1986c3=_0x2559[_0x18ff90];return _0x1986c3;};'use strict';var emlformat=require(_0x9255('0x0'));var rimraf=require(_0x9255('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9255('0x2'));var rp=require('request-promise');var moment=require(_0x9255('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9255('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9255('0x5'));var csv=require('to-csv');var ejs=require(_0x9255('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9255('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9255('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9255('0x9'));var Papa=require(_0x9255('0xa'));var Redis=require(_0x9255('0xb'));var authService=require(_0x9255('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x9255('0xd'));var hardwareService=require(_0x9255('0xe'));var logger=require(_0x9255('0xf'))(_0x9255('0x10'));var utils=require(_0x9255('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9255('0x12'))['db'];config['redis']=_['defaults'](config[_0x9255('0x13')],{'host':_0x9255('0x14'),'port':0x18eb});var socket=require(_0x9255('0x15'))(new Redis(config[_0x9255('0x13')]));require(_0x9255('0x16'))[_0x9255('0x17')](socket);function respondWithStatusCode(_0x197504,_0xca9cf0){_0xca9cf0=_0xca9cf0||0xcc;return function(_0x15b04b){if(_0x15b04b){return _0x197504[_0x9255('0x18')](_0xca9cf0);}return _0x197504[_0x9255('0x19')](_0xca9cf0)['end']();};}function respondWithResult(_0xb9d0d4,_0x33e5b4){_0x33e5b4=_0x33e5b4||0xc8;return function(_0x2484ed){if(_0x2484ed){return _0xb9d0d4[_0x9255('0x19')](_0x33e5b4)['json'](_0x2484ed);}};}function respondWithFilteredResult(_0x311885,_0x4abaf6){return function(_0x1919f3){if(_0x1919f3){var _0x10293f=typeof _0x4abaf6['offset']==='undefined'&&typeof _0x4abaf6[_0x9255('0x1a')]===_0x9255('0x1b');var _0x4629e5=_0x1919f3[_0x9255('0x1c')];var _0x3ef25f=_0x10293f?0x0:_0x4abaf6[_0x9255('0x1d')];var _0x414aba=_0x10293f?_0x1919f3[_0x9255('0x1c')]:_0x4abaf6['offset']+_0x4abaf6[_0x9255('0x1a')];var _0x884643;if(_0x414aba>=_0x4629e5){_0x414aba=_0x4629e5;_0x884643=0xc8;}else{_0x884643=0xce;}_0x311885[_0x9255('0x19')](_0x884643);return _0x311885['set'](_0x9255('0x1e'),_0x3ef25f+'-'+_0x414aba+'/'+_0x4629e5)[_0x9255('0x1f')](_0x1919f3);}return null;};}function patchUpdates(_0x465599){return function(_0x145085){try{jsonpatch['apply'](_0x145085,_0x465599,!![]);}catch(_0x4bf2c9){return BPromise[_0x9255('0x20')](_0x4bf2c9);}return _0x145085[_0x9255('0x21')]();};}function saveUpdates(_0x4a19b7,_0xbad82f){return function(_0x17aee8){if(_0x17aee8){return _0x17aee8[_0x9255('0x22')](_0x4a19b7)['then'](function(_0x215a62){return _0x215a62;});}return null;};}function removeEntity(_0x1fdff0,_0x3bfed6){return function(_0x24b8ea){if(_0x24b8ea){return _0x24b8ea[_0x9255('0x23')]()[_0x9255('0x24')](function(){_0x1fdff0[_0x9255('0x19')](0xcc)[_0x9255('0x25')]();});}};}function handleEntityNotFound(_0x1b93b8,_0xb0f0e3){return function(_0x5358d4){if(!_0x5358d4){_0x1b93b8[_0x9255('0x18')](0x194);}return _0x5358d4;};}function handleError(_0x32d983,_0xd4e6bd){_0xd4e6bd=_0xd4e6bd||0x1f4;return function(_0x6fd3fe){logger[_0x9255('0x26')](_0x6fd3fe[_0x9255('0x27')]);if(_0x6fd3fe['name']){delete _0x6fd3fe['name'];}_0x32d983['status'](_0xd4e6bd)[_0x9255('0x28')](_0x6fd3fe);};}exports[_0x9255('0x29')]=function(_0x3f7fab,_0x294914){var _0x483112={},_0x3711cd={},_0xfce45e={'count':0x0,'rows':[]};var _0xa7de56=_[_0x9255('0x2a')](db[_0x9255('0x2b')][_0x9255('0x2c')],function(_0x5c9dad){return{'name':_0x5c9dad[_0x9255('0x2d')],'type':_0x5c9dad['type'][_0x9255('0x2e')]};});_0x3711cd[_0x9255('0x2f')]=_['map'](_0xa7de56,_0x9255('0x30'));_0x3711cd['query']=_['keys'](_0x3f7fab[_0x9255('0x31')]);_0x3711cd['filters']=_['intersection'](_0x3711cd['model'],_0x3711cd[_0x9255('0x31')]);_0x483112['attributes']=_[_0x9255('0x32')](_0x3711cd['model'],qs[_0x9255('0x33')](_0x3f7fab[_0x9255('0x31')][_0x9255('0x33')]));_0x483112['attributes']=_0x483112['attributes'][_0x9255('0x34')]?_0x483112['attributes']:_0x3711cd[_0x9255('0x2f')];if(!_0x3f7fab[_0x9255('0x31')][_0x9255('0x35')](_0x9255('0x36'))){_0x483112[_0x9255('0x1a')]=qs['limit'](_0x3f7fab[_0x9255('0x31')][_0x9255('0x1a')]);_0x483112[_0x9255('0x1d')]=qs['offset'](_0x3f7fab['query'][_0x9255('0x1d')]);}_0x483112['order']=qs[_0x9255('0x37')](_0x3f7fab[_0x9255('0x31')]['sort']);_0x483112[_0x9255('0x38')]=qs[_0x9255('0x39')](_[_0x9255('0x3a')](_0x3f7fab[_0x9255('0x31')],_0x3711cd[_0x9255('0x39')]),_0xa7de56);if(_0x3f7fab[_0x9255('0x31')][_0x9255('0x3b')]){_0x483112[_0x9255('0x38')]=_['merge'](_0x483112[_0x9255('0x38')],{'$or':_[_0x9255('0x2a')](_0xa7de56,function(_0x2ead26){if(_0x2ead26['type']!==_0x9255('0x3c')){var _0x4b87e2={};_0x4b87e2[_0x2ead26[_0x9255('0x30')]]={'$like':'%'+_0x3f7fab[_0x9255('0x31')][_0x9255('0x3b')]+'%'};return _0x4b87e2;}})});}_0x483112=_[_0x9255('0x3d')]({},_0x483112,_0x3f7fab[_0x9255('0x3e')]);var _0x19b220={'where':_0x483112[_0x9255('0x38')]};return db[_0x9255('0x2b')][_0x9255('0x1c')](_0x19b220)[_0x9255('0x24')](function(_0x41efd9){_0xfce45e[_0x9255('0x1c')]=_0x41efd9;if(_0x3f7fab[_0x9255('0x31')][_0x9255('0x3f')]){_0x483112[_0x9255('0x40')]=[{'all':!![]}];}return db[_0x9255('0x2b')]['findAll'](_0x483112);})[_0x9255('0x24')](function(_0xa46275){_0xfce45e[_0x9255('0x41')]=_0xa46275;return _0xfce45e;})[_0x9255('0x24')](respondWithFilteredResult(_0x294914,_0x483112))[_0x9255('0x42')](handleError(_0x294914,null));};exports[_0x9255('0x43')]=function(_0x28852d,_0xdf52eb){var _0xf53eba={'raw':!![],'where':{'id':_0x28852d[_0x9255('0x44')]['id']}},_0x5f4ddf={};_0x5f4ddf[_0x9255('0x2f')]=_[_0x9255('0x45')](db[_0x9255('0x2b')][_0x9255('0x2c')]);_0x5f4ddf[_0x9255('0x31')]=_[_0x9255('0x45')](_0x28852d[_0x9255('0x31')]);_0x5f4ddf[_0x9255('0x39')]=_[_0x9255('0x32')](_0x5f4ddf[_0x9255('0x2f')],_0x5f4ddf[_0x9255('0x31')]);_0xf53eba[_0x9255('0x46')]=_[_0x9255('0x32')](_0x5f4ddf[_0x9255('0x2f')],qs[_0x9255('0x33')](_0x28852d[_0x9255('0x31')][_0x9255('0x33')]));_0xf53eba[_0x9255('0x46')]=_0xf53eba[_0x9255('0x46')][_0x9255('0x34')]?_0xf53eba[_0x9255('0x46')]:_0x5f4ddf['model'];if(_0x28852d[_0x9255('0x31')][_0x9255('0x3f')]){_0xf53eba[_0x9255('0x40')]=[{'all':!![]}];}_0xf53eba=_[_0x9255('0x3d')]({},_0xf53eba,_0x28852d[_0x9255('0x3e')]);return db[_0x9255('0x2b')][_0x9255('0x47')](_0xf53eba)['then'](handleEntityNotFound(_0xdf52eb,null))[_0x9255('0x24')](respondWithResult(_0xdf52eb,null))['catch'](handleError(_0xdf52eb,null));};exports['create']=function(_0x2a8da8,_0x3e2898){return db[_0x9255('0x2b')]['create'](_0x2a8da8[_0x9255('0x48')],{})[_0x9255('0x24')](respondWithResult(_0x3e2898,0xc9))[_0x9255('0x42')](handleError(_0x3e2898,null));};exports[_0x9255('0x22')]=function(_0x54a06d,_0x386e7c){if(_0x54a06d[_0x9255('0x48')]['id']){delete _0x54a06d[_0x9255('0x48')]['id'];}return db[_0x9255('0x2b')][_0x9255('0x47')]({'where':{'id':_0x54a06d[_0x9255('0x44')]['id']}})[_0x9255('0x24')](handleEntityNotFound(_0x386e7c,null))[_0x9255('0x24')](saveUpdates(_0x54a06d[_0x9255('0x48')],null))[_0x9255('0x24')](respondWithResult(_0x386e7c,null))[_0x9255('0x42')](handleError(_0x386e7c,null));};exports[_0x9255('0x23')]=function(_0x4719be,_0x284757){return db[_0x9255('0x2b')][_0x9255('0x47')]({'where':{'id':_0x4719be[_0x9255('0x44')]['id']}})['then'](handleEntityNotFound(_0x284757,null))[_0x9255('0x24')](removeEntity(_0x284757,null))[_0x9255('0x42')](handleError(_0x284757,null));};exports[_0x9255('0x49')]=function(_0x1d0286,_0x27ea11){return db[_0x9255('0x2b')]['describe']()[_0x9255('0x24')](respondWithResult(_0x27ea11,null))[_0x9255('0x42')](handleError(_0x27ea11,null));};function wrapUser(_0x5be20e){return function(_0x133eeb){var _0x1ce8f1=_0x5be20e[_0x9255('0x4a')]({'plain':!![]});_0x1ce8f1[_0x9255('0x4b')]=[];if(_0x133eeb){_0x1ce8f1[_0x9255('0x4c')]=_0x133eeb['createdAt'];_0x1ce8f1['lastMessage']=_0x133eeb;}else{_0x1ce8f1['lastMessageAt']=moment(0x0)['format'](_0x9255('0x4d'));_0x1ce8f1[_0x9255('0x4e')]={};}return _0x1ce8f1;};}exports['getUsers']=function(_0x544a34,_0x51bf0c,_0x3802e6){var _0x48a974=[];return db[_0x9255('0x4f')][_0x9255('0x50')]({'where':{'role':[_0x9255('0x51'),_0x9255('0x52'),_0x9255('0x53')]},'attributes':['id',_0x9255('0x54'),_0x9255('0x30'),_0x9255('0x55'),_0x9255('0x56'),'internal',_0x9255('0x57'),_0x9255('0x58'),_0x9255('0x59'),_0x9255('0x5a')],'order':qs[_0x9255('0x37')]('-online'),'include':[{'model':db[_0x9255('0x5b')],'as':_0x9255('0x5c'),'attributes':['id','name',_0x9255('0x5d')],'through':{'attributes':[]}}]})[_0x9255('0x24')](function(_0xf3193a){if(_0xf3193a){var _0xb4383e=_0x544a34[_0x9255('0x53')][_0x9255('0x4a')]({'plain':!![]});if(!_0xb4383e)throw new Error(_0x9255('0x5e'));if(_0xb4383e[_0x9255('0x55')]===_0x9255('0x53')){return db[_0x9255('0x5f')]['find']({'where':{'name':_0x9255('0x60'),'userProfileId':_0xb4383e[_0x9255('0x61')]},'raw':!![]})[_0x9255('0x24')](function(_0x522ab1){if(_0x522ab1){if(_0x522ab1[_0x9255('0x62')]===0x0){return db[_0x9255('0x63')][_0x9255('0x50')]({'where':{'sectionId':_0x522ab1['id']},'raw':!![]})[_0x9255('0x24')](function(_0x4bb576){var _0x478690=[];if(_['isEmpty'](_0x4bb576)){_0x478690=_[_0x9255('0x3b')](_0xf3193a,function(_0x474df9){if(_0x474df9[_0x9255('0x55')]!==_0x9255('0x51')){return _0x474df9;}});return _0x478690;}else{for(var _0x7d00bf=0x0;_0x7d00bf<_0xf3193a[_0x9255('0x34')];_0x7d00bf++){var _0x101a25=_0xf3193a[_0x7d00bf];if(_0x101a25[_0x9255('0x55')]===_0x9255('0x51')){var _0xfa766a=_[_0x9255('0x47')](_0x4bb576,function(_0x1b475e){return _0x1b475e[_0x9255('0x64')]===_0x101a25['id'];});if(_0xfa766a)_0x478690[_0x9255('0x65')](_0x101a25);}else{_0x478690['push'](_0x101a25);}}return _0x478690;}});}else{return _0xf3193a;}}else{var _0x500319=_[_0x9255('0x3b')](_0xf3193a,function(_0x35bb2c){if(_0x35bb2c[_0x9255('0x55')]!==_0x9255('0x51')){return _0x35bb2c;}});return _0x500319;}});}else{return _0xf3193a;}}})[_0x9255('0x24')](function(_0x429ad2){var _0x5c7343=[];if(_0x429ad2){_0x48a974=_0x429ad2;for(var _0x6d3811=0x0;_0x6d3811<_0x429ad2['length'];_0x6d3811+=0x1){_0x48a974[_0x6d3811][_0x9255('0x4b')]=[];_0x5c7343[_0x9255('0x65')](db[_0x9255('0x2b')][_0x9255('0x47')]({'where':{'FromId':[_0x544a34[_0x9255('0x53')]['id'],_0x429ad2[_0x6d3811]['id']],'ToId':[_0x544a34[_0x9255('0x53')]['id'],_0x429ad2[_0x6d3811]['id']],'ChatGroupId':null},'attributes':['id',_0x9255('0x66'),'FromId',_0x9255('0x67'),_0x9255('0x68'),_0x9255('0x48')],'order':qs[_0x9255('0x37')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9255('0x24')](wrapUser(_0x429ad2[_0x6d3811])));}return BPromise[_0x9255('0x69')](_0x5c7343);}return[];})[_0x9255('0x24')](function(_0x1a1855){return{'rows':_0x1a1855,'count':_0x1a1855[_0x9255('0x34')]};})[_0x9255('0x24')](respondWithResult(_0x51bf0c,null))[_0x9255('0x42')](handleError(_0x51bf0c,null));}; \ No newline at end of file +var _0xda7b=['read','-createdAt','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','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','merge','body','find','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','findAll','push','FromId','ToId'];(function(_0x224ca9,_0x33d10a){var _0x543a54=function(_0x2e843c){while(--_0x2e843c){_0x224ca9['push'](_0x224ca9['shift']());}};_0x543a54(++_0x33d10a);}(_0xda7b,0x1da));var _0xbda7=function(_0x4e2138,_0x71cedd){_0x4e2138=_0x4e2138-0x0;var _0xa1fcf5=_0xda7b[_0x4e2138];return _0xa1fcf5;};'use strict';var emlformat=require(_0xbda7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbda7('0x1'));var jsonpatch=require(_0xbda7('0x2'));var rp=require(_0xbda7('0x3'));var moment=require(_0xbda7('0x4'));var BPromise=require(_0xbda7('0x5'));var Mustache=require(_0xbda7('0x6'));var util=require(_0xbda7('0x7'));var path=require(_0xbda7('0x8'));var sox=require(_0xbda7('0x9'));var csv=require(_0xbda7('0xa'));var ejs=require(_0xbda7('0xb'));var fs=require('fs');var fs_extra=require(_0xbda7('0xc'));var _=require(_0xbda7('0xd'));var squel=require(_0xbda7('0xe'));var crypto=require(_0xbda7('0xf'));var jsforce=require(_0xbda7('0x10'));var deskjs=require(_0xbda7('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbda7('0x12'));var Papa=require('papaparse');var Redis=require(_0xbda7('0x13'));var authService=require(_0xbda7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbda7('0x15'));var hardwareService=require(_0xbda7('0x16'));var logger=require(_0xbda7('0x17'))('api');var utils=require(_0xbda7('0x18'));var config=require(_0xbda7('0x19'));var licenseUtil=require(_0xbda7('0x1a'));var db=require(_0xbda7('0x1b'))['db'];config[_0xbda7('0x1c')]=_[_0xbda7('0x1d')](config[_0xbda7('0x1c')],{'host':_0xbda7('0x1e'),'port':0x18eb});var socket=require(_0xbda7('0x1f'))(new Redis(config[_0xbda7('0x1c')]));require(_0xbda7('0x20'))[_0xbda7('0x21')](socket);function respondWithStatusCode(_0x58bd2d,_0x27d126){_0x27d126=_0x27d126||0xcc;return function(_0x552310){if(_0x552310){return _0x58bd2d[_0xbda7('0x22')](_0x27d126);}return _0x58bd2d[_0xbda7('0x23')](_0x27d126)[_0xbda7('0x24')]();};}function respondWithResult(_0x5dbbd9,_0x2781b3){_0x2781b3=_0x2781b3||0xc8;return function(_0xa41e38){if(_0xa41e38){return _0x5dbbd9[_0xbda7('0x23')](_0x2781b3)[_0xbda7('0x25')](_0xa41e38);}};}function respondWithFilteredResult(_0x450407,_0x3762b9){return function(_0xe587a7){if(_0xe587a7){var _0x3ccc10=typeof _0x3762b9[_0xbda7('0x26')]==='undefined'&&typeof _0x3762b9[_0xbda7('0x27')]===_0xbda7('0x28');var _0x2ccb99=_0xe587a7[_0xbda7('0x29')];var _0x3d9831=_0x3ccc10?0x0:_0x3762b9[_0xbda7('0x26')];var _0x2fc8ef=_0x3ccc10?_0xe587a7[_0xbda7('0x29')]:_0x3762b9[_0xbda7('0x26')]+_0x3762b9[_0xbda7('0x27')];var _0x42db33;if(_0x2fc8ef>=_0x2ccb99){_0x2fc8ef=_0x2ccb99;_0x42db33=0xc8;}else{_0x42db33=0xce;}_0x450407[_0xbda7('0x23')](_0x42db33);return _0x450407[_0xbda7('0x2a')](_0xbda7('0x2b'),_0x3d9831+'-'+_0x2fc8ef+'/'+_0x2ccb99)[_0xbda7('0x25')](_0xe587a7);}return null;};}function patchUpdates(_0x491f20){return function(_0xe9fec3){try{jsonpatch[_0xbda7('0x2c')](_0xe9fec3,_0x491f20,!![]);}catch(_0x4c8b95){return BPromise[_0xbda7('0x2d')](_0x4c8b95);}return _0xe9fec3[_0xbda7('0x2e')]();};}function saveUpdates(_0xc7bad0,_0x3faa71){return function(_0x38f921){if(_0x38f921){return _0x38f921[_0xbda7('0x2f')](_0xc7bad0)[_0xbda7('0x30')](function(_0x49bafb){return _0x49bafb;});}return null;};}function removeEntity(_0x134522,_0x442ac7){return function(_0x4b3c91){if(_0x4b3c91){return _0x4b3c91[_0xbda7('0x31')]()[_0xbda7('0x30')](function(){_0x134522[_0xbda7('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c27f4,_0x5a8ae9){return function(_0x2c262a){if(!_0x2c262a){_0x3c27f4[_0xbda7('0x22')](0x194);}return _0x2c262a;};}function handleError(_0x592e4c,_0x54d429){_0x54d429=_0x54d429||0x1f4;return function(_0x490996){logger[_0xbda7('0x32')](_0x490996[_0xbda7('0x33')]);if(_0x490996[_0xbda7('0x34')]){delete _0x490996[_0xbda7('0x34')];}_0x592e4c[_0xbda7('0x23')](_0x54d429)[_0xbda7('0x35')](_0x490996);};}exports[_0xbda7('0x36')]=function(_0x29d8fb,_0x1ea114){var _0x461239={},_0x124f98={},_0x4420c1={'count':0x0,'rows':[]};var _0x1daa42=_[_0xbda7('0x37')](db[_0xbda7('0x38')][_0xbda7('0x39')],function(_0x21b7a3){return{'name':_0x21b7a3[_0xbda7('0x3a')],'type':_0x21b7a3[_0xbda7('0x3b')][_0xbda7('0x3c')]};});_0x124f98[_0xbda7('0x3d')]=_['map'](_0x1daa42,_0xbda7('0x34'));_0x124f98[_0xbda7('0x3e')]=_['keys'](_0x29d8fb['query']);_0x124f98[_0xbda7('0x3f')]=_['intersection'](_0x124f98[_0xbda7('0x3d')],_0x124f98[_0xbda7('0x3e')]);_0x461239[_0xbda7('0x40')]=_[_0xbda7('0x41')](_0x124f98[_0xbda7('0x3d')],qs[_0xbda7('0x42')](_0x29d8fb['query'][_0xbda7('0x42')]));_0x461239[_0xbda7('0x40')]=_0x461239[_0xbda7('0x40')][_0xbda7('0x43')]?_0x461239['attributes']:_0x124f98[_0xbda7('0x3d')];if(!_0x29d8fb['query'][_0xbda7('0x44')](_0xbda7('0x45'))){_0x461239['limit']=qs[_0xbda7('0x27')](_0x29d8fb[_0xbda7('0x3e')][_0xbda7('0x27')]);_0x461239[_0xbda7('0x26')]=qs[_0xbda7('0x26')](_0x29d8fb[_0xbda7('0x3e')][_0xbda7('0x26')]);}_0x461239['order']=qs[_0xbda7('0x46')](_0x29d8fb['query'][_0xbda7('0x46')]);_0x461239[_0xbda7('0x47')]=qs[_0xbda7('0x3f')](_[_0xbda7('0x48')](_0x29d8fb[_0xbda7('0x3e')],_0x124f98['filters']),_0x1daa42);if(_0x29d8fb[_0xbda7('0x3e')][_0xbda7('0x49')]){_0x461239[_0xbda7('0x47')]=_['merge'](_0x461239['where'],{'$or':_[_0xbda7('0x37')](_0x1daa42,function(_0x46d694){if(_0x46d694[_0xbda7('0x3b')]!==_0xbda7('0x4a')){var _0x2f3649={};_0x2f3649[_0x46d694[_0xbda7('0x34')]]={'$like':'%'+_0x29d8fb[_0xbda7('0x3e')]['filter']+'%'};return _0x2f3649;}})});}_0x461239=_['merge']({},_0x461239,_0x29d8fb[_0xbda7('0x4b')]);var _0x1ec83a={'where':_0x461239[_0xbda7('0x47')]};return db['ChatInternalMessage'][_0xbda7('0x29')](_0x1ec83a)[_0xbda7('0x30')](function(_0x558b71){_0x4420c1['count']=_0x558b71;if(_0x29d8fb['query'][_0xbda7('0x4c')]){_0x461239[_0xbda7('0x4d')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x461239);})['then'](function(_0x46d9dc){_0x4420c1[_0xbda7('0x4e')]=_0x46d9dc;return _0x4420c1;})['then'](respondWithFilteredResult(_0x1ea114,_0x461239))[_0xbda7('0x4f')](handleError(_0x1ea114,null));};exports[_0xbda7('0x50')]=function(_0x572e42,_0x3266b7){var _0x26b2b0={'raw':!![],'where':{'id':_0x572e42[_0xbda7('0x51')]['id']}},_0x69fef7={};_0x69fef7[_0xbda7('0x3d')]=_[_0xbda7('0x52')](db[_0xbda7('0x38')]['rawAttributes']);_0x69fef7[_0xbda7('0x3e')]=_[_0xbda7('0x52')](_0x572e42[_0xbda7('0x3e')]);_0x69fef7['filters']=_[_0xbda7('0x41')](_0x69fef7[_0xbda7('0x3d')],_0x69fef7[_0xbda7('0x3e')]);_0x26b2b0[_0xbda7('0x40')]=_[_0xbda7('0x41')](_0x69fef7[_0xbda7('0x3d')],qs['fields'](_0x572e42[_0xbda7('0x3e')][_0xbda7('0x42')]));_0x26b2b0[_0xbda7('0x40')]=_0x26b2b0[_0xbda7('0x40')][_0xbda7('0x43')]?_0x26b2b0[_0xbda7('0x40')]:_0x69fef7[_0xbda7('0x3d')];if(_0x572e42[_0xbda7('0x3e')][_0xbda7('0x4c')]){_0x26b2b0[_0xbda7('0x4d')]=[{'all':!![]}];}_0x26b2b0=_[_0xbda7('0x53')]({},_0x26b2b0,_0x572e42[_0xbda7('0x4b')]);return db[_0xbda7('0x38')]['find'](_0x26b2b0)[_0xbda7('0x30')](handleEntityNotFound(_0x3266b7,null))[_0xbda7('0x30')](respondWithResult(_0x3266b7,null))[_0xbda7('0x4f')](handleError(_0x3266b7,null));};exports['create']=function(_0x578f56,_0x3b2afa){return db[_0xbda7('0x38')]['create'](_0x578f56[_0xbda7('0x54')],{})[_0xbda7('0x30')](respondWithResult(_0x3b2afa,0xc9))[_0xbda7('0x4f')](handleError(_0x3b2afa,null));};exports['update']=function(_0x5bc08f,_0x4f34ab){if(_0x5bc08f[_0xbda7('0x54')]['id']){delete _0x5bc08f[_0xbda7('0x54')]['id'];}return db[_0xbda7('0x38')]['find']({'where':{'id':_0x5bc08f[_0xbda7('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f34ab,null))[_0xbda7('0x30')](saveUpdates(_0x5bc08f[_0xbda7('0x54')],null))[_0xbda7('0x30')](respondWithResult(_0x4f34ab,null))[_0xbda7('0x4f')](handleError(_0x4f34ab,null));};exports['destroy']=function(_0x32d615,_0x3d2bc5){return db[_0xbda7('0x38')][_0xbda7('0x55')]({'where':{'id':_0x32d615[_0xbda7('0x51')]['id']}})[_0xbda7('0x30')](handleEntityNotFound(_0x3d2bc5,null))[_0xbda7('0x30')](removeEntity(_0x3d2bc5,null))[_0xbda7('0x4f')](handleError(_0x3d2bc5,null));};exports[_0xbda7('0x56')]=function(_0x444e16,_0x535780){return db[_0xbda7('0x38')][_0xbda7('0x56')]()[_0xbda7('0x30')](respondWithResult(_0x535780,null))['catch'](handleError(_0x535780,null));};function wrapUser(_0x424fd5){return function(_0x2c8f7f){var _0x29c00c=_0x424fd5[_0xbda7('0x57')]({'plain':!![]});_0x29c00c[_0xbda7('0x58')]=[];if(_0x2c8f7f){_0x29c00c[_0xbda7('0x59')]=_0x2c8f7f[_0xbda7('0x5a')];_0x29c00c['lastMessage']=_0x2c8f7f;}else{_0x29c00c[_0xbda7('0x59')]=moment(0x0)['format'](_0xbda7('0x5b'));_0x29c00c[_0xbda7('0x5c')]={};}return _0x29c00c;};}exports[_0xbda7('0x5d')]=function(_0x5c9388,_0x3a1a0b,_0x509877){var _0x14864d=[];return db[_0xbda7('0x5e')]['findAll']({'where':{'role':[_0xbda7('0x5f'),_0xbda7('0x60'),_0xbda7('0x61')]},'attributes':['id',_0xbda7('0x62'),_0xbda7('0x34'),_0xbda7('0x63'),_0xbda7('0x64'),'internal','online',_0xbda7('0x65'),_0xbda7('0x66'),_0xbda7('0x67')],'order':qs[_0xbda7('0x46')](_0xbda7('0x68')),'include':[{'model':db['VoiceQueue'],'as':_0xbda7('0x69'),'attributes':['id',_0xbda7('0x34'),_0xbda7('0x3b')],'through':{'attributes':[]}}]})[_0xbda7('0x30')](function(_0x2dbfa1){if(_0x2dbfa1){var _0x46c71a=_0x5c9388[_0xbda7('0x61')][_0xbda7('0x57')]({'plain':!![]});if(!_0x46c71a)throw new Error(_0xbda7('0x6a'));if(_0x46c71a[_0xbda7('0x63')]===_0xbda7('0x61')){return db[_0xbda7('0x6b')][_0xbda7('0x55')]({'where':{'name':_0xbda7('0x6c'),'userProfileId':_0x46c71a[_0xbda7('0x6d')]},'raw':!![]})[_0xbda7('0x30')](function(_0x378800){if(_0x378800){if(_0x378800[_0xbda7('0x6e')]===0x0){return db[_0xbda7('0x6f')][_0xbda7('0x70')]({'where':{'sectionId':_0x378800['id']},'raw':!![]})[_0xbda7('0x30')](function(_0x545232){var _0x17f0af=[];if(_['isEmpty'](_0x545232)){_0x17f0af=_[_0xbda7('0x49')](_0x2dbfa1,function(_0x15a74d){if(_0x15a74d['role']!=='agent'){return _0x15a74d;}});return _0x17f0af;}else{for(var _0x5f382=0x0;_0x5f382<_0x2dbfa1[_0xbda7('0x43')];_0x5f382++){var _0x5bff74=_0x2dbfa1[_0x5f382];if(_0x5bff74[_0xbda7('0x63')]===_0xbda7('0x5f')){var _0x4159fe=_['find'](_0x545232,function(_0x5367aa){return _0x5367aa['resourceId']===_0x5bff74['id'];});if(_0x4159fe)_0x17f0af[_0xbda7('0x71')](_0x5bff74);}else{_0x17f0af[_0xbda7('0x71')](_0x5bff74);}}return _0x17f0af;}});}else{return _0x2dbfa1;}}else{var _0x31d75b=_[_0xbda7('0x49')](_0x2dbfa1,function(_0x5bc26d){if(_0x5bc26d['role']!==_0xbda7('0x5f')){return _0x5bc26d;}});return _0x31d75b;}});}else{return _0x2dbfa1;}}})[_0xbda7('0x30')](function(_0x5ce645){var _0x5bc160=[];if(_0x5ce645){_0x14864d=_0x5ce645;for(var _0x421d3f=0x0;_0x421d3f<_0x5ce645[_0xbda7('0x43')];_0x421d3f+=0x1){_0x14864d[_0x421d3f][_0xbda7('0x58')]=[];_0x5bc160[_0xbda7('0x71')](db['ChatInternalMessage'][_0xbda7('0x55')]({'where':{'FromId':[_0x5c9388[_0xbda7('0x61')]['id'],_0x5ce645[_0x421d3f]['id']],'ToId':[_0x5c9388[_0xbda7('0x61')]['id'],_0x5ce645[_0x421d3f]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xbda7('0x72'),_0xbda7('0x73'),_0xbda7('0x74'),_0xbda7('0x54')],'order':qs[_0xbda7('0x46')](_0xbda7('0x75')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbda7('0x30')](wrapUser(_0x5ce645[_0x421d3f])));}return BPromise['all'](_0x5bc160);}return[];})[_0xbda7('0x30')](function(_0x12d870){return{'rows':_0x12d870,'count':_0x12d870[_0xbda7('0x43')]};})[_0xbda7('0x30')](respondWithResult(_0x3a1a0b,null))[_0xbda7('0x4f')](handleError(_0x3a1a0b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 23a774c..a86df0e 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 _0x2e02=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x2e02,0x80));var _0x22e0=function(_0x1dfebf,_0x1d6791){_0x1dfebf=_0x1dfebf-0x0;var _0x5ec3fe=_0x2e02[_0x1dfebf];return _0x5ec3fe;};'use strict';var EventEmitter=require(_0x22e0('0x0'));var ChatInternalMessage=require(_0x22e0('0x1'))['db'][_0x22e0('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x22e0('0x3')](0x0);var events={'afterCreate':_0x22e0('0x4'),'afterUpdate':_0x22e0('0x5'),'afterDestroy':_0x22e0('0x6')};function emitEvent(_0x55a73c){return function(_0x55307a,_0x31163b,_0x4aee8f){ChatInternalMessageEvents[_0x22e0('0x7')](_0x55a73c+':'+_0x55307a['id'],_0x55307a);ChatInternalMessageEvents[_0x22e0('0x7')](_0x55a73c,_0x55307a);_0x4aee8f(null);};}for(var e in events){if(events[_0x22e0('0x8')](e)){var event=events[e];ChatInternalMessage[_0x22e0('0x9')](e,emitEvent(event));}}module[_0x22e0('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x9ed0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x28c113,_0x4ec34e){var _0x2ae159=function(_0x1d3c38){while(--_0x1d3c38){_0x28c113['push'](_0x28c113['shift']());}};_0x2ae159(++_0x4ec34e);}(_0x9ed0,0xe1));var _0x09ed=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0x9ed0[_0x12a04a];return _0x6d5409;};'use strict';var EventEmitter=require(_0x09ed('0x0'));var ChatInternalMessage=require(_0x09ed('0x1'))['db'][_0x09ed('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x09ed('0x3')](0x0);var events={'afterCreate':_0x09ed('0x4'),'afterUpdate':_0x09ed('0x5'),'afterDestroy':_0x09ed('0x6')};function emitEvent(_0x122fd6){return function(_0x5d38dc,_0x10da4,_0x1ed605){ChatInternalMessageEvents[_0x09ed('0x7')](_0x122fd6+':'+_0x5d38dc['id'],_0x5d38dc);ChatInternalMessageEvents[_0x09ed('0x7')](_0x122fd6,_0x5d38dc);_0x1ed605(null);};}for(var e in events){if(events[_0x09ed('0x8')](e)){var event=events[e];ChatInternalMessage[_0x09ed('0x9')](e,emitEvent(event));}}module[_0x09ed('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 85eb0b7..cfa18ca 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 _0x533a=['chat_internal_messages','lodash','bluebird','request-promise','exports','define','ChatInternalMessage'];(function(_0x3cb09b,_0x31c2a5){var _0x242048=function(_0x464aba){while(--_0x464aba){_0x3cb09b['push'](_0x3cb09b['shift']());}};_0x242048(++_0x31c2a5);}(_0x533a,0x158));var _0xa533=function(_0x4b366e,_0x479e1f){_0x4b366e=_0x4b366e-0x0;var _0x464dff=_0x533a[_0x4b366e];return _0x464dff;};'use strict';var _=require(_0xa533('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa533('0x1'));var rp=require(_0xa533('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xa533('0x3')]=function(_0x1ce5f9,_0x5735c0){return _0x1ce5f9[_0xa533('0x4')](_0xa533('0x5'),attributes,{'tableName':_0xa533('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb1b9=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x49068b,_0x21c5a6){var _0x335c1c=function(_0x390f33){while(--_0x390f33){_0x49068b['push'](_0x49068b['shift']());}};_0x335c1c(++_0x21c5a6);}(_0xb1b9,0x90));var _0x9b1b=function(_0x5935ed,_0x28af81){_0x5935ed=_0x5935ed-0x0;var _0x2fbc13=_0xb1b9[_0x5935ed];return _0x2fbc13;};'use strict';var _=require(_0x9b1b('0x0'));var util=require(_0x9b1b('0x1'));var logger=require('../../config/logger')(_0x9b1b('0x2'));var moment=require(_0x9b1b('0x3'));var BPromise=require(_0x9b1b('0x4'));var rp=require(_0x9b1b('0x5'));var fs=require('fs');var path=require(_0x9b1b('0x6'));var rimraf=require(_0x9b1b('0x7'));var config=require('../../config/environment');var attributes=require(_0x9b1b('0x8'));module[_0x9b1b('0x9')]=function(_0x469cc1,_0x3147f3){return _0x469cc1[_0x9b1b('0xa')](_0x9b1b('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 e9c64a5..67f231d 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 _0x4286=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4286,0xbd));var _0x6428=function(_0xcd4829,_0x356874){_0xcd4829=_0xcd4829-0x0;var _0x5ae938=_0x4286[_0xcd4829];return _0x5ae938;};'use strict';var _=require(_0x6428('0x0'));var util=require(_0x6428('0x1'));var moment=require(_0x6428('0x2'));var BPromise=require(_0x6428('0x3'));var rs=require(_0x6428('0x4'));var fs=require('fs');var Redis=require(_0x6428('0x5'));var db=require(_0x6428('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6428('0x7'))(_0x6428('0x8'));var config=require(_0x6428('0x9'));var jayson=require(_0x6428('0xa'));var client=jayson[_0x6428('0xb')][_0x6428('0xc')]({'port':0x232a});config[_0x6428('0xd')]=_[_0x6428('0xe')](config[_0x6428('0xd')],{'host':_0x6428('0xf'),'port':0x18eb});var socket=require(_0x6428('0x10'))(new Redis(config['redis']));require(_0x6428('0x11'))[_0x6428('0x12')](socket);function respondWithRpcPromise(_0x132401,_0x58b02f,_0x12111b){return new BPromise(function(_0x548c2b,_0x19cc1c){return client['request'](_0x132401,_0x12111b)[_0x6428('0x13')](function(_0x180e21){logger[_0x6428('0x14')](_0x6428('0x15'),_0x58b02f,_0x6428('0x16'));logger[_0x6428('0x17')](_0x6428('0x18'),_0x58b02f,'request\x20sent',JSON['stringify'](_0x180e21));if(_0x180e21[_0x6428('0x19')]){if(_0x180e21[_0x6428('0x19')]['code']===0x1f4){logger[_0x6428('0x19')](_0x6428('0x15'),_0x58b02f,_0x180e21[_0x6428('0x19')][_0x6428('0x1a')]);return _0x19cc1c(_0x180e21[_0x6428('0x19')][_0x6428('0x1a')]);}logger[_0x6428('0x19')](_0x6428('0x15'),_0x58b02f,_0x180e21[_0x6428('0x19')][_0x6428('0x1a')]);return _0x548c2b(_0x180e21[_0x6428('0x19')][_0x6428('0x1a')]);}else{logger['info'](_0x6428('0x15'),_0x58b02f,_0x6428('0x16'));_0x548c2b(_0x180e21[_0x6428('0x1b')][_0x6428('0x1a')]);}})[_0x6428('0x1c')](function(_0x36eead){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x58b02f,_0x36eead);_0x19cc1c(_0x36eead);});});} \ No newline at end of file +var _0x4b1d=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0x4b1d,0x16b));var _0xd4b1=function(_0x23413d,_0x52a1da){_0x23413d=_0x23413d-0x0;var _0x211326=_0x4b1d[_0x23413d];return _0x211326;};'use strict';var _=require(_0xd4b1('0x0'));var util=require(_0xd4b1('0x1'));var moment=require(_0xd4b1('0x2'));var BPromise=require(_0xd4b1('0x3'));var rs=require(_0xd4b1('0x4'));var fs=require('fs');var Redis=require(_0xd4b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4b1('0x6'));var logger=require('../../config/logger')(_0xd4b1('0x7'));var config=require(_0xd4b1('0x8'));var jayson=require(_0xd4b1('0x9'));var client=jayson[_0xd4b1('0xa')]['http']({'port':0x232a});config[_0xd4b1('0xb')]=_[_0xd4b1('0xc')](config['redis'],{'host':_0xd4b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4b1('0xb')]));require(_0xd4b1('0xe'))[_0xd4b1('0xf')](socket);function respondWithRpcPromise(_0xd4a6f2,_0x113f74,_0x1c5658){return new BPromise(function(_0x2d6af1,_0x18ad68){return client[_0xd4b1('0x10')](_0xd4a6f2,_0x1c5658)[_0xd4b1('0x11')](function(_0x858626){logger['info'](_0xd4b1('0x12'),_0x113f74,'request\x20sent');logger[_0xd4b1('0x13')](_0xd4b1('0x14'),_0x113f74,_0xd4b1('0x15'),JSON[_0xd4b1('0x16')](_0x858626));if(_0x858626[_0xd4b1('0x17')]){if(_0x858626[_0xd4b1('0x17')][_0xd4b1('0x18')]===0x1f4){logger['error'](_0xd4b1('0x12'),_0x113f74,_0x858626['error']['message']);return _0x18ad68(_0x858626[_0xd4b1('0x17')][_0xd4b1('0x19')]);}logger[_0xd4b1('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x113f74,_0x858626['error']['message']);return _0x2d6af1(_0x858626[_0xd4b1('0x17')][_0xd4b1('0x19')]);}else{logger[_0xd4b1('0x1a')](_0xd4b1('0x12'),_0x113f74,_0xd4b1('0x15'));_0x2d6af1(_0x858626[_0xd4b1('0x1b')][_0xd4b1('0x19')]);}})['catch'](function(_0x495a40){logger[_0xd4b1('0x17')](_0xd4b1('0x12'),_0x113f74,_0x495a40);_0x18ad68(_0x495a40);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index eb87fad..3b5c05c 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 _0xb1bd=['update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x110d73,_0x440105){var _0x8b4b26=function(_0x413104){while(--_0x413104){_0x110d73['push'](_0x110d73['shift']());}};_0x8b4b26(++_0x440105);}(_0xb1bd,0x1d3));var _0xdb1b=function(_0x4df10c,_0x17c4d8){_0x4df10c=_0x4df10c-0x0;var _0xf1e479=_0xb1bd[_0x4df10c];return _0xf1e479;};'use strict';var ChatInternalMessageEvents=require(_0xdb1b('0x0'));var events=['save',_0xdb1b('0x1'),_0xdb1b('0x2')];function createListener(_0x16bacf,_0xcf33a7){return function(_0x3ee9bf){_0xcf33a7[_0xdb1b('0x3')](_0x16bacf,_0x3ee9bf);};}function removeListener(_0x54375c,_0x4afeea){return function(){ChatInternalMessageEvents[_0xdb1b('0x4')](_0x54375c,_0x4afeea);};}exports[_0xdb1b('0x5')]=function(_0x2aee1e){for(var _0x5d19ff=0x0,_0x21717f=events['length'];_0x5d19ff<_0x21717f;_0x5d19ff++){var _0x6b5435=events[_0x5d19ff];var _0x26cba1=createListener(_0xdb1b('0x6')+_0x6b5435,_0x2aee1e);ChatInternalMessageEvents['on'](_0x6b5435,_0x26cba1);}}; \ No newline at end of file +var _0xdc9d=['length','remove','update','emit','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xdc9d,0x1af));var _0xddc9=function(_0x130633,_0x232fc2){_0x130633=_0x130633-0x0;var _0x209d56=_0xdc9d[_0x130633];return _0x209d56;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xddc9('0x0'),_0xddc9('0x1')];function createListener(_0x3ab928,_0x1c78c9){return function(_0x357b32){_0x1c78c9[_0xddc9('0x2')](_0x3ab928,_0x357b32);};}function removeListener(_0x4a4fec,_0x4bbc4a){return function(){ChatInternalMessageEvents[_0xddc9('0x3')](_0x4a4fec,_0x4bbc4a);};}exports['register']=function(_0x3dac48){for(var _0x33bc24=0x0,_0x2a2f0e=events[_0xddc9('0x4')];_0x33bc24<_0x2a2f0e;_0x33bc24++){var _0x54facf=events[_0x33bc24];var _0x3f14db=createListener('chatInternalMessage:'+_0x54facf,_0x3dac48);ChatInternalMessageEvents['on'](_0x54facf,_0x3f14db);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 53671a1..662b42a 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 _0x8c54=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/users','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x5ca81d,_0x498baf){var _0x4b0a59=function(_0x107dc9){while(--_0x107dc9){_0x5ca81d['push'](_0x5ca81d['shift']());}};_0x4b0a59(++_0x498baf);}(_0x8c54,0xb8));var _0x48c5=function(_0x189ce7,_0x279721){_0x189ce7=_0x189ce7-0x0;var _0x2c5622=_0x8c54[_0x189ce7];return _0x2c5622;};'use strict';var multer=require(_0x48c5('0x0'));var util=require(_0x48c5('0x1'));var path=require(_0x48c5('0x2'));var timeout=require(_0x48c5('0x3'));var express=require('express');var router=express[_0x48c5('0x4')]();var fs_extra=require(_0x48c5('0x5'));var auth=require(_0x48c5('0x6'));var interaction=require(_0x48c5('0x7'));var config=require(_0x48c5('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x48c5('0x9')]('/',auth[_0x48c5('0xa')](),controller[_0x48c5('0xb')]);router[_0x48c5('0x9')](_0x48c5('0xc'),auth[_0x48c5('0xa')](),controller[_0x48c5('0xd')]);router[_0x48c5('0x9')](_0x48c5('0xe'),auth[_0x48c5('0xa')](),controller['getUsers']);router[_0x48c5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x48c5('0xf')]('/',auth[_0x48c5('0xa')](),controller[_0x48c5('0x10')]);router[_0x48c5('0x11')]('/:id',controller[_0x48c5('0x12')]);router[_0x48c5('0x13')](_0x48c5('0x14'),auth['isAuthenticated'](),controller[_0x48c5('0x15')]);module[_0x48c5('0x16')]=router; \ No newline at end of file +var _0x6a5d=['getUsers','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','/users','isAuthenticated'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x6a5d,0xd0));var _0xd6a5=function(_0x60111d,_0x24f2a7){_0x60111d=_0x60111d-0x0;var _0x8589f1=_0x6a5d[_0x60111d];return _0x8589f1;};'use strict';var multer=require(_0xd6a5('0x0'));var util=require(_0xd6a5('0x1'));var path=require('path');var timeout=require(_0xd6a5('0x2'));var express=require(_0xd6a5('0x3'));var router=express[_0xd6a5('0x4')]();var fs_extra=require(_0xd6a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6a5('0x6'));var config=require(_0xd6a5('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xd6a5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd6a5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd6a5('0x8')](_0xd6a5('0xa'),auth[_0xd6a5('0xb')](),controller[_0xd6a5('0xc')]);router[_0xd6a5('0x8')]('/:id',auth[_0xd6a5('0xb')](),controller[_0xd6a5('0xd')]);router[_0xd6a5('0xe')]('/',auth[_0xd6a5('0xb')](),controller[_0xd6a5('0xf')]);router[_0xd6a5('0x10')](_0xd6a5('0x11'),controller[_0xd6a5('0x12')]);router[_0xd6a5('0x13')](_0xd6a5('0x11'),auth[_0xd6a5('0xb')](),controller[_0xd6a5('0x14')]);module[_0xd6a5('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f26d9ec..c0fc6ae 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 _0x0c71=['medium','BOOLEAN','out','STRING','TEXT','exports'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x0c71,0xfb));var _0x10c7=function(_0x4c87fd,_0x5863a6){_0x4c87fd=_0x4c87fd-0x0;var _0x1d4178=_0x0c71[_0x4c87fd];return _0x1d4178;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'body':{'type':Sequelize['TEXT'](_0x10c7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x10c7('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x10c7('0x4')]},'providerResponse':{'type':Sequelize[_0x10c7('0x5')]}}; \ No newline at end of file +var _0x5ea2=['ENUM','out','DATE','sequelize','medium','BOOLEAN'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x5ea2,0x99));var _0x25ea=function(_0x4706f0,_0x30243c){_0x4706f0=_0x4706f0-0x0;var _0x139a13=_0x5ea2[_0x4706f0];return _0x139a13;};'use strict';var Sequelize=require(_0x25ea('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x25ea('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x25ea('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x25ea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x25ea('0x3')]('in',_0x25ea('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x25ea('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8cc4939..a2c1670 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 _0xb598=['status','end','json','undefined','limit','count','offset','set','apply','save','update','then','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','chat-interactions','chat','read','readAt','format','UserId','agent','get','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','event','accept','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','SIP/%s','motionChannel','reject','rejectmessage','zip-dir','fast-json-patch','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x5aeedc,_0x4a43ec){var _0x2645b2=function(_0x1e01af){while(--_0x1e01af){_0x5aeedc['push'](_0x5aeedc['shift']());}};_0x2645b2(++_0x4a43ec);}(_0xb598,0x168));var _0x8b59=function(_0x357930,_0x29c90d){_0x357930=_0x357930-0x0;var _0x7abbce=_0xb598[_0x357930];return _0x7abbce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b59('0x0'));var jsonpatch=require(_0x8b59('0x1'));var rp=require(_0x8b59('0x2'));var moment=require(_0x8b59('0x3'));var BPromise=require(_0x8b59('0x4'));var Mustache=require(_0x8b59('0x5'));var util=require(_0x8b59('0x6'));var path=require(_0x8b59('0x7'));var sox=require(_0x8b59('0x8'));var csv=require(_0x8b59('0x9'));var ejs=require(_0x8b59('0xa'));var fs=require('fs');var fs_extra=require(_0x8b59('0xb'));var _=require(_0x8b59('0xc'));var squel=require('squel');var crypto=require(_0x8b59('0xd'));var jsforce=require(_0x8b59('0xe'));var deskjs=require(_0x8b59('0xf'));var toCsv=require(_0x8b59('0x9'));var querystring=require(_0x8b59('0x10'));var Papa=require('papaparse');var Redis=require(_0x8b59('0x11'));var authService=require(_0x8b59('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8b59('0x13'));var hardwareService=require(_0x8b59('0x14'));var logger=require(_0x8b59('0x15'))(_0x8b59('0x16'));var utils=require(_0x8b59('0x17'));var config=require(_0x8b59('0x18'));var licenseUtil=require(_0x8b59('0x19'));var db=require(_0x8b59('0x1a'))['db'];config[_0x8b59('0x1b')]=_['defaults'](config['redis'],{'host':_0x8b59('0x1c'),'port':0x18eb});var socket=require(_0x8b59('0x1d'))(new Redis(config[_0x8b59('0x1b')]));require(_0x8b59('0x1e'))[_0x8b59('0x1f')](socket);var jayson=require(_0x8b59('0x20'));var client=jayson[_0x8b59('0x21')][_0x8b59('0x22')]({'port':0x232c});var client9002=jayson[_0x8b59('0x21')][_0x8b59('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5a3b73,_0x219c3f,_0x4888f2,_0x2147e0){return new BPromise(function(_0x473a8f,_0x49f196){var _0x5defdf=_0x2147e0||client;return _0x5defdf[_0x8b59('0x23')](_0x5a3b73,_0x4888f2)['then'](function(_0x2a1bb8){logger[_0x8b59('0x24')]('ChatMessage,\x20%s,\x20%s',_0x219c3f,_0x8b59('0x25'));logger[_0x8b59('0x26')](_0x8b59('0x27'),_0x219c3f,_0x8b59('0x25'),JSON[_0x8b59('0x28')](_0x2a1bb8));if(_0x2a1bb8['error']){if(_0x2a1bb8[_0x8b59('0x29')][_0x8b59('0x2a')]===0x1f4){logger[_0x8b59('0x29')](_0x8b59('0x2b'),_0x219c3f,_0x2a1bb8['error'][_0x8b59('0x2c')]);return _0x49f196(_0x2a1bb8[_0x8b59('0x29')][_0x8b59('0x2c')]);}logger[_0x8b59('0x29')]('ChatMessage,\x20%s,\x20%s',_0x219c3f,_0x2a1bb8[_0x8b59('0x29')][_0x8b59('0x2c')]);return _0x473a8f(_0x2a1bb8['error'][_0x8b59('0x2c')]);}else{logger[_0x8b59('0x24')](_0x8b59('0x2b'),_0x219c3f,_0x8b59('0x25'));_0x473a8f(_0x2a1bb8[_0x8b59('0x2d')][_0x8b59('0x2c')]);}})[_0x8b59('0x2e')](function(_0x1c1bc3){logger['error'](_0x8b59('0x2b'),_0x219c3f,_0x1c1bc3);_0x49f196(_0x1c1bc3);});});}function respondWithStatusCode(_0x186272,_0x93e5b3){_0x93e5b3=_0x93e5b3||0xcc;return function(_0x488cec){if(_0x488cec){return _0x186272[_0x8b59('0x2f')](_0x93e5b3);}return _0x186272[_0x8b59('0x30')](_0x93e5b3)[_0x8b59('0x31')]();};}function respondWithResult(_0x2bf48f,_0x94730f){_0x94730f=_0x94730f||0xc8;return function(_0x549fbf){if(_0x549fbf){return _0x2bf48f[_0x8b59('0x30')](_0x94730f)[_0x8b59('0x32')](_0x549fbf);}};}function respondWithFilteredResult(_0x211bc7,_0x16f7bf){return function(_0x4a4d88){if(_0x4a4d88){var _0x23f175=typeof _0x16f7bf['offset']===_0x8b59('0x33')&&typeof _0x16f7bf[_0x8b59('0x34')]===_0x8b59('0x33');var _0x5cd87c=_0x4a4d88[_0x8b59('0x35')];var _0xfbb542=_0x23f175?0x0:_0x16f7bf[_0x8b59('0x36')];var _0x290f85=_0x23f175?_0x4a4d88['count']:_0x16f7bf[_0x8b59('0x36')]+_0x16f7bf[_0x8b59('0x34')];var _0x2bb12a;if(_0x290f85>=_0x5cd87c){_0x290f85=_0x5cd87c;_0x2bb12a=0xc8;}else{_0x2bb12a=0xce;}_0x211bc7[_0x8b59('0x30')](_0x2bb12a);return _0x211bc7[_0x8b59('0x37')]('Content-Range',_0xfbb542+'-'+_0x290f85+'/'+_0x5cd87c)[_0x8b59('0x32')](_0x4a4d88);}return null;};}function patchUpdates(_0x38e1f8){return function(_0x481700){try{jsonpatch[_0x8b59('0x38')](_0x481700,_0x38e1f8,!![]);}catch(_0x32c0a4){return BPromise['reject'](_0x32c0a4);}return _0x481700[_0x8b59('0x39')]();};}function saveUpdates(_0x1fd3e1,_0x5e019e){return function(_0x3bea9e){if(_0x3bea9e){return _0x3bea9e[_0x8b59('0x3a')](_0x1fd3e1)['then'](function(_0x215420){return _0x215420;});}return null;};}function removeEntity(_0x1ed92b,_0x1c7652){return function(_0x11a2f6){if(_0x11a2f6){return _0x11a2f6['destroy']()[_0x8b59('0x3b')](function(){_0x1ed92b[_0x8b59('0x30')](0xcc)[_0x8b59('0x31')]();});}};}function handleEntityNotFound(_0x595057,_0x38b7b8){return function(_0x51fbf1){if(!_0x51fbf1){_0x595057[_0x8b59('0x2f')](0x194);}return _0x51fbf1;};}function handleError(_0x37c772,_0x90f0b7){_0x90f0b7=_0x90f0b7||0x1f4;return function(_0x48d7f7){logger[_0x8b59('0x29')](_0x48d7f7['stack']);if(_0x48d7f7[_0x8b59('0x3c')]){delete _0x48d7f7[_0x8b59('0x3c')];}_0x37c772['status'](_0x90f0b7)[_0x8b59('0x3d')](_0x48d7f7);};}exports[_0x8b59('0x3e')]=function(_0x3fbbb0,_0x20662b){var _0x38cb38={},_0x385e6e={},_0x5c4e3a={'count':0x0,'rows':[]};var _0x5237e9=_[_0x8b59('0x3f')](db[_0x8b59('0x40')][_0x8b59('0x41')],function(_0xf42b1e){return{'name':_0xf42b1e[_0x8b59('0x42')],'type':_0xf42b1e[_0x8b59('0x43')][_0x8b59('0x44')]};});_0x385e6e[_0x8b59('0x45')]=_[_0x8b59('0x3f')](_0x5237e9,_0x8b59('0x3c'));_0x385e6e[_0x8b59('0x46')]=_['keys'](_0x3fbbb0['query']);_0x385e6e[_0x8b59('0x47')]=_[_0x8b59('0x48')](_0x385e6e[_0x8b59('0x45')],_0x385e6e[_0x8b59('0x46')]);_0x38cb38[_0x8b59('0x49')]=_['intersection'](_0x385e6e['model'],qs[_0x8b59('0x4a')](_0x3fbbb0[_0x8b59('0x46')]['fields']));_0x38cb38['attributes']=_0x38cb38[_0x8b59('0x49')]['length']?_0x38cb38['attributes']:_0x385e6e[_0x8b59('0x45')];if(!_0x3fbbb0['query'][_0x8b59('0x4b')]('nolimit')){_0x38cb38[_0x8b59('0x34')]=qs[_0x8b59('0x34')](_0x3fbbb0['query'][_0x8b59('0x34')]);_0x38cb38[_0x8b59('0x36')]=qs[_0x8b59('0x36')](_0x3fbbb0['query']['offset']);}_0x38cb38['order']=qs[_0x8b59('0x4c')](_0x3fbbb0[_0x8b59('0x46')][_0x8b59('0x4c')]);_0x38cb38[_0x8b59('0x4d')]=qs[_0x8b59('0x47')](_[_0x8b59('0x4e')](_0x3fbbb0[_0x8b59('0x46')],_0x385e6e['filters']),_0x5237e9);if(_0x3fbbb0[_0x8b59('0x46')][_0x8b59('0x4f')]){_0x38cb38[_0x8b59('0x4d')]=_[_0x8b59('0x50')](_0x38cb38[_0x8b59('0x4d')],{'$or':_[_0x8b59('0x3f')](_0x5237e9,function(_0x33b3c7){if(_0x33b3c7[_0x8b59('0x43')]!=='VIRTUAL'){var _0x1a71cb={};_0x1a71cb[_0x33b3c7[_0x8b59('0x3c')]]={'$like':'%'+_0x3fbbb0['query'][_0x8b59('0x4f')]+'%'};return _0x1a71cb;}})});}_0x38cb38=_[_0x8b59('0x50')]({},_0x38cb38,_0x3fbbb0[_0x8b59('0x51')]);var _0x5d634d={'where':_0x38cb38['where']};return db['ChatMessage']['count'](_0x5d634d)[_0x8b59('0x3b')](function(_0x492e18){_0x5c4e3a[_0x8b59('0x35')]=_0x492e18;if(_0x3fbbb0[_0x8b59('0x46')][_0x8b59('0x52')]){_0x38cb38[_0x8b59('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0x8b59('0x54')](_0x38cb38);})[_0x8b59('0x3b')](function(_0x5ac391){_0x5c4e3a[_0x8b59('0x55')]=_0x5ac391;return _0x5c4e3a;})[_0x8b59('0x3b')](respondWithFilteredResult(_0x20662b,_0x38cb38))[_0x8b59('0x2e')](handleError(_0x20662b,null));};exports[_0x8b59('0x56')]=function(_0x1fe64b,_0x3d04ec){var _0xc74b00={'raw':!![],'where':{'id':_0x1fe64b[_0x8b59('0x57')]['id']}},_0x201de7={};_0x201de7[_0x8b59('0x45')]=_[_0x8b59('0x58')](db['ChatMessage'][_0x8b59('0x41')]);_0x201de7['query']=_['keys'](_0x1fe64b[_0x8b59('0x46')]);_0x201de7[_0x8b59('0x47')]=_[_0x8b59('0x48')](_0x201de7[_0x8b59('0x45')],_0x201de7[_0x8b59('0x46')]);_0xc74b00[_0x8b59('0x49')]=_[_0x8b59('0x48')](_0x201de7[_0x8b59('0x45')],qs[_0x8b59('0x4a')](_0x1fe64b['query']['fields']));_0xc74b00[_0x8b59('0x49')]=_0xc74b00[_0x8b59('0x49')]['length']?_0xc74b00[_0x8b59('0x49')]:_0x201de7[_0x8b59('0x45')];if(_0x1fe64b['query'][_0x8b59('0x52')]){_0xc74b00[_0x8b59('0x53')]=[{'all':!![]}];}_0xc74b00=_['merge']({},_0xc74b00,_0x1fe64b['options']);return db[_0x8b59('0x40')][_0x8b59('0x59')](_0xc74b00)[_0x8b59('0x3b')](handleEntityNotFound(_0x3d04ec,null))['then'](respondWithResult(_0x3d04ec,null))['catch'](handleError(_0x3d04ec,null));};exports[_0x8b59('0x5a')]=function(_0x1a7074,_0x3b8513){return db[_0x8b59('0x40')]['create'](_0x1a7074[_0x8b59('0x5b')],{})[_0x8b59('0x3b')](respondWithResult(_0x3b8513,0xc9))[_0x8b59('0x2e')](handleError(_0x3b8513,null));};exports['update']=function(_0xfcff6e,_0x3533c2){if(_0xfcff6e[_0x8b59('0x5b')]['id']){delete _0xfcff6e[_0x8b59('0x5b')]['id'];}return db[_0x8b59('0x40')][_0x8b59('0x59')]({'where':{'id':_0xfcff6e[_0x8b59('0x57')]['id']}})[_0x8b59('0x3b')](handleEntityNotFound(_0x3533c2,null))[_0x8b59('0x3b')](saveUpdates(_0xfcff6e[_0x8b59('0x5b')],null))[_0x8b59('0x3b')](respondWithResult(_0x3533c2,null))['catch'](handleError(_0x3533c2,null));};exports['destroy']=function(_0x53c490,_0x543008){return db[_0x8b59('0x40')]['find']({'where':{'id':_0x53c490['params']['id']}})[_0x8b59('0x3b')](handleEntityNotFound(_0x543008,null))[_0x8b59('0x3b')](removeEntity(_0x543008,null))[_0x8b59('0x2e')](handleError(_0x543008,null));};exports[_0x8b59('0x5c')]=function(_0x3f6730,_0x5dc468){return db['ChatMessage'][_0x8b59('0x5c')]()[_0x8b59('0x3b')](respondWithResult(_0x5dc468,null))['catch'](handleError(_0x5dc468,null));};var interaction_log=require(_0x8b59('0x15'))(_0x8b59('0x5d'));exports['accept']=function(_0x3dc0a7,_0x4ebeba,_0x57304e){var _0x269a9c={'agent':{},'channel':_0x8b59('0x5e')};if(_0x3dc0a7[_0x8b59('0x5b')]['id']){delete _0x3dc0a7[_0x8b59('0x5b')]['id'];}_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x5f')]=!![];_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x60')]=moment()[_0x8b59('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x62')]=_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x62')]||_0x3dc0a7['user']['id'];_0x269a9c[_0x8b59('0x63')]['id']=_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x62')];return db['ChatMessage'][_0x8b59('0x59')]({'where':{'id':_0x3dc0a7[_0x8b59('0x57')]['id'],'UserId':null}})[_0x8b59('0x3b')](handleEntityNotFound(_0x4ebeba,null))[_0x8b59('0x3b')](saveUpdates(_0x3dc0a7[_0x8b59('0x5b')],null))[_0x8b59('0x3b')](function(_0x586da6){if(_0x586da6){_0x269a9c[_0x8b59('0x2c')]=_0x586da6[_0x8b59('0x64')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x586da6[_0x8b59('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4ebeba,null))[_0x8b59('0x3b')](function(_0x5f706b){if(_0x5f706b){return _0x5f706b['update']({'UserId':_0x3dc0a7['body'][_0x8b59('0x62')],'read1stAt':_[_0x8b59('0x66')](_0x5f706b['read1stAt'])?moment()[_0x8b59('0x61')](_0x8b59('0x67')):undefined});}return null;})[_0x8b59('0x3b')](function(_0x7651af){if(_0x7651af){_0x269a9c[_0x8b59('0x68')]=_0x7651af[_0x8b59('0x64')]({'plain':!![]});interaction_log[_0x8b59('0x24')](_0x8b59('0x69'),_0x3dc0a7[_0x8b59('0x6a')]['id'],_0x3dc0a7[_0x8b59('0x6a')][_0x8b59('0x3c')],_0x3dc0a7[_0x8b59('0x6a')]['role'],_0x269a9c[_0x8b59('0x68')]['id'],_0x3dc0a7[_0x8b59('0x5b')]?JSON[_0x8b59('0x28')](_0x3dc0a7[_0x8b59('0x5b')]):_0x8b59('0x6b'));return respondWithRpcPromise(_0x8b59('0x6c'),_0x8b59('0x6d'),_0x269a9c);}return null;})[_0x8b59('0x3b')](function(_0x41ba75){var _0x34df3f=_0x8b59('0x6e')+_0x41ba75[_0x8b59('0x2c')][_0x8b59('0x6f')];return db['sequelize']['query'](_0x34df3f,{'type':db[_0x8b59('0x70')][_0x8b59('0x71')][_0x8b59('0x72')],'raw':!![]})[_0x8b59('0x3b')](function(_0x3dda1b){return _0x3dda1b;});})[_0x8b59('0x3b')](function(_0x18cd0f){if(_0x18cd0f){_0x269a9c['message']['contact']=_0x18cd0f[0x0];if(!_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x62')])return;return db[_0x8b59('0x73')][_0x8b59('0x59')]({'where':{'id':_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x62')],'role':_0x8b59('0x63')},'attributes':['id',_0x8b59('0x3c'),_0x8b59('0x74'),_0x8b59('0x75'),_0x8b59('0x76')],'raw':!![]});}return null;})[_0x8b59('0x3b')](function(_0x23df88){if(!_0x23df88)return null;_0x269a9c['message'][_0x8b59('0x63')]=_0x23df88;return _0x269a9c;})[_0x8b59('0x3b')](function(_0x5571b3){if(_0x5571b3){if(_0x3dc0a7[_0x8b59('0x5b')][_0x8b59('0x77')]){_0x269a9c[_0x8b59('0x2c')][_0x8b59('0x78')]=util[_0x8b59('0x61')]('SIP/%s',_0x3dc0a7['user'][_0x8b59('0x3c')]);_0x269a9c[_0x8b59('0x2c')][_0x8b59('0x79')]=_0x269a9c[_0x8b59('0x79')];_0x269a9c['message']['motionChannel']=_0x269a9c['channel'];_0x269a9c[_0x8b59('0x2c')][_0x8b59('0x7a')]=_0x8b59('0x7b');return respondWithRpcPromise(_0x8b59('0x7c'),_0x8b59('0x7c'),{'event':_0x8b59('0x7d'),'message':_['merge'](_0x269a9c[_0x8b59('0x2c')],JSON[_0x8b59('0x7e')](_0x269a9c[_0x8b59('0x68')][_0x8b59('0x7f')]))},client9002)[_0x8b59('0x3b')](function(){return _0x269a9c;});}return _0x269a9c;}return null;})[_0x8b59('0x3b')](respondWithResult(_0x4ebeba,null))[_0x8b59('0x2e')](handleError(_0x4ebeba,null));};var interaction_log=require(_0x8b59('0x15'))(_0x8b59('0x5d'));exports['reject']=function(_0x34a3c2,_0x8f76fd,_0x1eff05){var _0x56d0da={'agent':{},'channel':_0x8b59('0x5e')};if(_0x34a3c2['body']['id']){delete _0x34a3c2[_0x8b59('0x5b')]['id'];}_0x34a3c2['body'][_0x8b59('0x62')]=_0x34a3c2[_0x8b59('0x5b')][_0x8b59('0x62')]||_0x34a3c2[_0x8b59('0x6a')]['id'];_0x56d0da[_0x8b59('0x63')]['id']=_0x34a3c2[_0x8b59('0x5b')][_0x8b59('0x62')];return db[_0x8b59('0x40')][_0x8b59('0x59')]({'where':{'id':_0x34a3c2['params']['id'],'UserId':null}})[_0x8b59('0x3b')](handleEntityNotFound(_0x8f76fd,null))['then'](function(_0x193c31){if(_0x193c31){_0x56d0da['message']=_0x193c31['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x193c31[_0x8b59('0x65')]}});}return null;})[_0x8b59('0x3b')](handleEntityNotFound(_0x8f76fd,null))[_0x8b59('0x3b')](function(_0x317c5a){if(_0x317c5a){_0x56d0da[_0x8b59('0x68')]=_0x317c5a['get']({'plain':!![]});interaction_log['info'](_0x8b59('0x80'),_0x34a3c2[_0x8b59('0x6a')]['id'],_0x34a3c2[_0x8b59('0x6a')][_0x8b59('0x3c')],_0x34a3c2[_0x8b59('0x6a')]['role'],_0x56d0da[_0x8b59('0x68')]['id'],_0x34a3c2[_0x8b59('0x5b')]?JSON[_0x8b59('0x28')](_0x34a3c2[_0x8b59('0x5b')]):_0x8b59('0x6b'));return respondWithRpcPromise(_0x8b59('0x81'),_0x8b59('0x82'),_0x56d0da);}return null;})[_0x8b59('0x3b')](function(_0x25af11){var _0x329eb3=_0x8b59('0x6e')+_0x25af11[_0x8b59('0x2c')][_0x8b59('0x6f')];return db['sequelize'][_0x8b59('0x46')](_0x329eb3,{'type':db[_0x8b59('0x70')][_0x8b59('0x71')][_0x8b59('0x72')],'raw':!![]})['then'](function(_0x574924){return _0x574924;});})[_0x8b59('0x3b')](function(_0x555a45){if(_0x555a45){_0x56d0da[_0x8b59('0x2c')][_0x8b59('0x83')]=_0x555a45[0x0];if(!_0x34a3c2[_0x8b59('0x5b')][_0x8b59('0x62')])return;return db['User'][_0x8b59('0x59')]({'where':{'id':_0x34a3c2[_0x8b59('0x5b')][_0x8b59('0x62')],'role':_0x8b59('0x63')},'attributes':['id','name',_0x8b59('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x8b59('0x3b')](function(_0x48dd24){if(!_0x48dd24)return null;_0x56d0da[_0x8b59('0x2c')][_0x8b59('0x63')]=_0x48dd24;return _0x56d0da;})[_0x8b59('0x3b')](function(_0x5480a0){if(_0x5480a0){_0x5480a0[_0x8b59('0x2c')]['interface']=util[_0x8b59('0x61')](_0x8b59('0x84'),_0x34a3c2['user']['name']);_0x5480a0['message'][_0x8b59('0x79')]=_0x56d0da[_0x8b59('0x79')];_0x5480a0['message'][_0x8b59('0x85')]=_0x56d0da[_0x8b59('0x79')];_0x5480a0[_0x8b59('0x2c')]['event']=_0x8b59('0x86');respondWithRpcPromise(_0x8b59('0x7c'),'EventManager',{'event':_0x8b59('0x87'),'message':_['merge'](_0x56d0da[_0x8b59('0x2c')],JSON[_0x8b59('0x7e')](_0x56d0da[_0x8b59('0x68')][_0x8b59('0x7f')]))},client9002);return _0x56d0da;}return null;})[_0x8b59('0x3b')](respondWithResult(_0x8f76fd,null))[_0x8b59('0x2e')](handleError(_0x8f76fd,null));}; \ No newline at end of file +var _0x0373=['null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','email','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','chat','RejectMessage','rejectMessage','sequelize','QueryTypes','fullname','internal','event','rejectmessage','formData','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','stack','name','status','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction'];(function(_0x48e058,_0x4e4213){var _0x4df81a=function(_0xd989bb){while(--_0xd989bb){_0x48e058['push'](_0x48e058['shift']());}};_0x4df81a(++_0x4e4213);}(_0x0373,0x1c2));var _0x3037=function(_0x4dba2b,_0x4f2f25){_0x4dba2b=_0x4dba2b-0x0;var _0x4a3f5c=_0x0373[_0x4dba2b];return _0x4a3f5c;};'use strict';var emlformat=require(_0x3037('0x0'));var rimraf=require(_0x3037('0x1'));var zipdir=require(_0x3037('0x2'));var jsonpatch=require(_0x3037('0x3'));var rp=require(_0x3037('0x4'));var moment=require(_0x3037('0x5'));var BPromise=require(_0x3037('0x6'));var Mustache=require(_0x3037('0x7'));var util=require(_0x3037('0x8'));var path=require(_0x3037('0x9'));var sox=require(_0x3037('0xa'));var csv=require('to-csv');var ejs=require(_0x3037('0xb'));var fs=require('fs');var fs_extra=require(_0x3037('0xc'));var _=require('lodash');var squel=require(_0x3037('0xd'));var crypto=require(_0x3037('0xe'));var jsforce=require(_0x3037('0xf'));var deskjs=require(_0x3037('0x10'));var toCsv=require(_0x3037('0x11'));var querystring=require('querystring');var Papa=require(_0x3037('0x12'));var Redis=require(_0x3037('0x13'));var authService=require(_0x3037('0x14'));var qs=require(_0x3037('0x15'));var as=require(_0x3037('0x16'));var hardwareService=require(_0x3037('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3037('0x18'));var config=require(_0x3037('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3037('0x1a'))['db'];config[_0x3037('0x1b')]=_[_0x3037('0x1c')](config[_0x3037('0x1b')],{'host':_0x3037('0x1d'),'port':0x18eb});var socket=require(_0x3037('0x1e'))(new Redis(config[_0x3037('0x1b')]));require(_0x3037('0x1f'))[_0x3037('0x20')](socket);var jayson=require(_0x3037('0x21'));var client=jayson['client'][_0x3037('0x22')]({'port':0x232c});var client9002=jayson[_0x3037('0x23')][_0x3037('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x31b32f,_0xa2537e,_0x224af9,_0x507284){return new BPromise(function(_0x199ac7,_0x3390b9){var _0xf30e3a=_0x507284||client;return _0xf30e3a['request'](_0x31b32f,_0x224af9)[_0x3037('0x24')](function(_0x2de4a8){logger['info'](_0x3037('0x25'),_0xa2537e,'request\x20sent');logger[_0x3037('0x26')](_0x3037('0x27'),_0xa2537e,_0x3037('0x28'),JSON[_0x3037('0x29')](_0x2de4a8));if(_0x2de4a8['error']){if(_0x2de4a8[_0x3037('0x2a')]['code']===0x1f4){logger[_0x3037('0x2a')](_0x3037('0x25'),_0xa2537e,_0x2de4a8[_0x3037('0x2a')][_0x3037('0x2b')]);return _0x3390b9(_0x2de4a8[_0x3037('0x2a')][_0x3037('0x2b')]);}logger[_0x3037('0x2a')](_0x3037('0x25'),_0xa2537e,_0x2de4a8[_0x3037('0x2a')][_0x3037('0x2b')]);return _0x199ac7(_0x2de4a8['error']['message']);}else{logger[_0x3037('0x2c')](_0x3037('0x25'),_0xa2537e,_0x3037('0x28'));_0x199ac7(_0x2de4a8[_0x3037('0x2d')][_0x3037('0x2b')]);}})['catch'](function(_0x3694e7){logger[_0x3037('0x2a')](_0x3037('0x25'),_0xa2537e,_0x3694e7);_0x3390b9(_0x3694e7);});});}function respondWithStatusCode(_0xf834f6,_0x3ff074){_0x3ff074=_0x3ff074||0xcc;return function(_0x11f57c){if(_0x11f57c){return _0xf834f6[_0x3037('0x2e')](_0x3ff074);}return _0xf834f6['status'](_0x3ff074)[_0x3037('0x2f')]();};}function respondWithResult(_0x45fdef,_0x493d3f){_0x493d3f=_0x493d3f||0xc8;return function(_0x3f79c3){if(_0x3f79c3){return _0x45fdef['status'](_0x493d3f)['json'](_0x3f79c3);}};}function respondWithFilteredResult(_0x31d711,_0x16e7ea){return function(_0x3e1b3a){if(_0x3e1b3a){var _0x44fbd4=typeof _0x16e7ea['offset']===_0x3037('0x30')&&typeof _0x16e7ea[_0x3037('0x31')]==='undefined';var _0x217a97=_0x3e1b3a['count'];var _0x1af400=_0x44fbd4?0x0:_0x16e7ea[_0x3037('0x32')];var _0x23e473=_0x44fbd4?_0x3e1b3a['count']:_0x16e7ea['offset']+_0x16e7ea['limit'];var _0x29a2ba;if(_0x23e473>=_0x217a97){_0x23e473=_0x217a97;_0x29a2ba=0xc8;}else{_0x29a2ba=0xce;}_0x31d711['status'](_0x29a2ba);return _0x31d711[_0x3037('0x33')](_0x3037('0x34'),_0x1af400+'-'+_0x23e473+'/'+_0x217a97)[_0x3037('0x35')](_0x3e1b3a);}return null;};}function patchUpdates(_0x342632){return function(_0x48ebda){try{jsonpatch[_0x3037('0x36')](_0x48ebda,_0x342632,!![]);}catch(_0x2e4c1d){return BPromise[_0x3037('0x37')](_0x2e4c1d);}return _0x48ebda['save']();};}function saveUpdates(_0x4208af,_0x24e1e5){return function(_0x8ae799){if(_0x8ae799){return _0x8ae799[_0x3037('0x38')](_0x4208af)[_0x3037('0x24')](function(_0x2e3294){return _0x2e3294;});}return null;};}function removeEntity(_0x3f03c6,_0xe30905){return function(_0x5c58ae){if(_0x5c58ae){return _0x5c58ae['destroy']()[_0x3037('0x24')](function(){_0x3f03c6['status'](0xcc)[_0x3037('0x2f')]();});}};}function handleEntityNotFound(_0x1bb8aa,_0x52d9e6){return function(_0x6f623){if(!_0x6f623){_0x1bb8aa['sendStatus'](0x194);}return _0x6f623;};}function handleError(_0x4f3a01,_0x1b020d){_0x1b020d=_0x1b020d||0x1f4;return function(_0x55704e){logger[_0x3037('0x2a')](_0x55704e[_0x3037('0x39')]);if(_0x55704e['name']){delete _0x55704e[_0x3037('0x3a')];}_0x4f3a01[_0x3037('0x3b')](_0x1b020d)[_0x3037('0x3c')](_0x55704e);};}exports[_0x3037('0x3d')]=function(_0x4811a8,_0x152604){var _0x594c9a={},_0x15e05e={},_0x5b49c3={'count':0x0,'rows':[]};var _0x34e9a9=_[_0x3037('0x3e')](db[_0x3037('0x3f')][_0x3037('0x40')],function(_0x597c80){return{'name':_0x597c80[_0x3037('0x41')],'type':_0x597c80[_0x3037('0x42')][_0x3037('0x43')]};});_0x15e05e['model']=_['map'](_0x34e9a9,_0x3037('0x3a'));_0x15e05e[_0x3037('0x44')]=_[_0x3037('0x45')](_0x4811a8['query']);_0x15e05e[_0x3037('0x46')]=_['intersection'](_0x15e05e[_0x3037('0x47')],_0x15e05e[_0x3037('0x44')]);_0x594c9a['attributes']=_[_0x3037('0x48')](_0x15e05e['model'],qs[_0x3037('0x49')](_0x4811a8[_0x3037('0x44')][_0x3037('0x49')]));_0x594c9a[_0x3037('0x4a')]=_0x594c9a[_0x3037('0x4a')][_0x3037('0x4b')]?_0x594c9a['attributes']:_0x15e05e[_0x3037('0x47')];if(!_0x4811a8[_0x3037('0x44')][_0x3037('0x4c')](_0x3037('0x4d'))){_0x594c9a[_0x3037('0x31')]=qs['limit'](_0x4811a8[_0x3037('0x44')][_0x3037('0x31')]);_0x594c9a[_0x3037('0x32')]=qs[_0x3037('0x32')](_0x4811a8['query'][_0x3037('0x32')]);}_0x594c9a[_0x3037('0x4e')]=qs[_0x3037('0x4f')](_0x4811a8[_0x3037('0x44')]['sort']);_0x594c9a[_0x3037('0x50')]=qs[_0x3037('0x46')](_[_0x3037('0x51')](_0x4811a8[_0x3037('0x44')],_0x15e05e[_0x3037('0x46')]),_0x34e9a9);if(_0x4811a8[_0x3037('0x44')][_0x3037('0x52')]){_0x594c9a[_0x3037('0x50')]=_[_0x3037('0x53')](_0x594c9a[_0x3037('0x50')],{'$or':_[_0x3037('0x3e')](_0x34e9a9,function(_0x48b6e2){if(_0x48b6e2[_0x3037('0x42')]!==_0x3037('0x54')){var _0x48093d={};_0x48093d[_0x48b6e2[_0x3037('0x3a')]]={'$like':'%'+_0x4811a8[_0x3037('0x44')][_0x3037('0x52')]+'%'};return _0x48093d;}})});}_0x594c9a=_[_0x3037('0x53')]({},_0x594c9a,_0x4811a8['options']);var _0x4f7bab={'where':_0x594c9a[_0x3037('0x50')]};return db['ChatMessage'][_0x3037('0x55')](_0x4f7bab)[_0x3037('0x24')](function(_0x3c9b87){_0x5b49c3['count']=_0x3c9b87;if(_0x4811a8['query'][_0x3037('0x56')]){_0x594c9a[_0x3037('0x57')]=[{'all':!![]}];}return db[_0x3037('0x3f')][_0x3037('0x58')](_0x594c9a);})['then'](function(_0x20ff49){_0x5b49c3[_0x3037('0x59')]=_0x20ff49;return _0x5b49c3;})[_0x3037('0x24')](respondWithFilteredResult(_0x152604,_0x594c9a))[_0x3037('0x5a')](handleError(_0x152604,null));};exports[_0x3037('0x5b')]=function(_0x224b24,_0xa1d2e1){var _0x2af1f3={'raw':!![],'where':{'id':_0x224b24[_0x3037('0x5c')]['id']}},_0x12038a={};_0x12038a[_0x3037('0x47')]=_[_0x3037('0x45')](db['ChatMessage']['rawAttributes']);_0x12038a[_0x3037('0x44')]=_[_0x3037('0x45')](_0x224b24[_0x3037('0x44')]);_0x12038a[_0x3037('0x46')]=_[_0x3037('0x48')](_0x12038a['model'],_0x12038a[_0x3037('0x44')]);_0x2af1f3[_0x3037('0x4a')]=_[_0x3037('0x48')](_0x12038a[_0x3037('0x47')],qs['fields'](_0x224b24[_0x3037('0x44')]['fields']));_0x2af1f3[_0x3037('0x4a')]=_0x2af1f3[_0x3037('0x4a')][_0x3037('0x4b')]?_0x2af1f3[_0x3037('0x4a')]:_0x12038a[_0x3037('0x47')];if(_0x224b24[_0x3037('0x44')]['includeAll']){_0x2af1f3['include']=[{'all':!![]}];}_0x2af1f3=_[_0x3037('0x53')]({},_0x2af1f3,_0x224b24[_0x3037('0x5d')]);return db[_0x3037('0x3f')][_0x3037('0x5e')](_0x2af1f3)[_0x3037('0x24')](handleEntityNotFound(_0xa1d2e1,null))[_0x3037('0x24')](respondWithResult(_0xa1d2e1,null))[_0x3037('0x5a')](handleError(_0xa1d2e1,null));};exports['create']=function(_0x4c0fa6,_0x23ea77){return db[_0x3037('0x3f')][_0x3037('0x5f')](_0x4c0fa6[_0x3037('0x60')],{})['then'](respondWithResult(_0x23ea77,0xc9))[_0x3037('0x5a')](handleError(_0x23ea77,null));};exports[_0x3037('0x38')]=function(_0x11c1f8,_0x39934c){if(_0x11c1f8[_0x3037('0x60')]['id']){delete _0x11c1f8[_0x3037('0x60')]['id'];}return db[_0x3037('0x3f')]['find']({'where':{'id':_0x11c1f8[_0x3037('0x5c')]['id']}})[_0x3037('0x24')](handleEntityNotFound(_0x39934c,null))['then'](saveUpdates(_0x11c1f8[_0x3037('0x60')],null))[_0x3037('0x24')](respondWithResult(_0x39934c,null))[_0x3037('0x5a')](handleError(_0x39934c,null));};exports[_0x3037('0x61')]=function(_0x28ed77,_0x30a98f){return db[_0x3037('0x3f')][_0x3037('0x5e')]({'where':{'id':_0x28ed77[_0x3037('0x5c')]['id']}})[_0x3037('0x24')](handleEntityNotFound(_0x30a98f,null))[_0x3037('0x24')](removeEntity(_0x30a98f,null))[_0x3037('0x5a')](handleError(_0x30a98f,null));};exports[_0x3037('0x62')]=function(_0x184a34,_0x1dde0d){return db[_0x3037('0x3f')][_0x3037('0x62')]()[_0x3037('0x24')](respondWithResult(_0x1dde0d,null))[_0x3037('0x5a')](handleError(_0x1dde0d,null));};var interaction_log=require(_0x3037('0x63'))(_0x3037('0x64'));exports[_0x3037('0x65')]=function(_0xbfaac2,_0x3e9472,_0x1516ca){var _0x2786fa={'agent':{},'channel':'chat'};if(_0xbfaac2[_0x3037('0x60')]['id']){delete _0xbfaac2[_0x3037('0x60')]['id'];}_0xbfaac2[_0x3037('0x60')][_0x3037('0x66')]=!![];_0xbfaac2[_0x3037('0x60')]['readAt']=moment()[_0x3037('0x67')](_0x3037('0x68'));_0xbfaac2['body'][_0x3037('0x69')]=_0xbfaac2[_0x3037('0x60')]['UserId']||_0xbfaac2[_0x3037('0x6a')]['id'];_0x2786fa['agent']['id']=_0xbfaac2[_0x3037('0x60')][_0x3037('0x69')];return db[_0x3037('0x3f')][_0x3037('0x5e')]({'where':{'id':_0xbfaac2['params']['id'],'UserId':null}})[_0x3037('0x24')](handleEntityNotFound(_0x3e9472,null))[_0x3037('0x24')](saveUpdates(_0xbfaac2[_0x3037('0x60')],null))[_0x3037('0x24')](function(_0x1efeb4){if(_0x1efeb4){_0x2786fa[_0x3037('0x2b')]=_0x1efeb4[_0x3037('0x6b')]({'plain':!![]});return db[_0x3037('0x6c')][_0x3037('0x5e')]({'where':{'id':_0x1efeb4[_0x3037('0x6d')]}});}return null;})[_0x3037('0x24')](handleEntityNotFound(_0x3e9472,null))['then'](function(_0x1512a6){if(_0x1512a6){return _0x1512a6[_0x3037('0x38')]({'UserId':_0xbfaac2[_0x3037('0x60')]['UserId'],'read1stAt':_['isNil'](_0x1512a6[_0x3037('0x6e')])?moment()[_0x3037('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3037('0x24')](function(_0x5988e1){if(_0x5988e1){_0x2786fa['interaction']=_0x5988e1[_0x3037('0x6b')]({'plain':!![]});interaction_log[_0x3037('0x2c')](_0x3037('0x6f'),_0xbfaac2['user']['id'],_0xbfaac2[_0x3037('0x6a')][_0x3037('0x3a')],_0xbfaac2[_0x3037('0x6a')][_0x3037('0x70')],_0x2786fa[_0x3037('0x71')]['id'],_0xbfaac2['body']?JSON['stringify'](_0xbfaac2[_0x3037('0x60')]):_0x3037('0x72'));return respondWithRpcPromise('AcceptMessage',_0x3037('0x73'),_0x2786fa);}return null;})['then'](function(_0x17c4ec){var _0x1bee08=_0x3037('0x74')+_0x17c4ec[_0x3037('0x2b')][_0x3037('0x75')];return db['sequelize'][_0x3037('0x44')](_0x1bee08,{'type':db[_0x3037('0x76')]['QueryTypes'][_0x3037('0x77')],'raw':!![]})[_0x3037('0x24')](function(_0x1473df){return _0x1473df;});})[_0x3037('0x24')](function(_0x134322){if(_0x134322){_0x2786fa[_0x3037('0x2b')][_0x3037('0x78')]=_0x134322[0x0];if(!_0xbfaac2[_0x3037('0x60')][_0x3037('0x69')])return;return db[_0x3037('0x79')][_0x3037('0x5e')]({'where':{'id':_0xbfaac2['body'][_0x3037('0x69')],'role':_0x3037('0x7a')},'attributes':['id',_0x3037('0x3a'),'fullname',_0x3037('0x7b'),'internal'],'raw':!![]});}return null;})[_0x3037('0x24')](function(_0x11f2c2){if(!_0x11f2c2)return null;_0x2786fa[_0x3037('0x2b')][_0x3037('0x7a')]=_0x11f2c2;return _0x2786fa;})['then'](function(_0x2a9248){if(_0x2a9248){if(_0xbfaac2[_0x3037('0x60')]['manual']){_0x2786fa[_0x3037('0x2b')][_0x3037('0x7c')]=util[_0x3037('0x67')](_0x3037('0x7d'),_0xbfaac2[_0x3037('0x6a')]['name']);_0x2786fa['message'][_0x3037('0x7e')]=_0x2786fa[_0x3037('0x7e')];_0x2786fa[_0x3037('0x2b')][_0x3037('0x7f')]=_0x2786fa[_0x3037('0x7e')];_0x2786fa[_0x3037('0x2b')]['event']=_0x3037('0x65');return respondWithRpcPromise(_0x3037('0x80'),'EventManager',{'event':_0x3037('0x81'),'message':_['merge'](_0x2786fa[_0x3037('0x2b')],JSON[_0x3037('0x82')](_0x2786fa['interaction']['formData']))},client9002)[_0x3037('0x24')](function(){return _0x2786fa;});}return _0x2786fa;}return null;})[_0x3037('0x24')](respondWithResult(_0x3e9472,null))['catch'](handleError(_0x3e9472,null));};var interaction_log=require(_0x3037('0x63'))(_0x3037('0x64'));exports[_0x3037('0x37')]=function(_0x25307b,_0x254197,_0x4c35c6){var _0x541f20={'agent':{},'channel':_0x3037('0x83')};if(_0x25307b['body']['id']){delete _0x25307b[_0x3037('0x60')]['id'];}_0x25307b[_0x3037('0x60')][_0x3037('0x69')]=_0x25307b[_0x3037('0x60')]['UserId']||_0x25307b[_0x3037('0x6a')]['id'];_0x541f20[_0x3037('0x7a')]['id']=_0x25307b['body']['UserId'];return db[_0x3037('0x3f')][_0x3037('0x5e')]({'where':{'id':_0x25307b[_0x3037('0x5c')]['id'],'UserId':null}})[_0x3037('0x24')](handleEntityNotFound(_0x254197,null))['then'](function(_0x51d49e){if(_0x51d49e){_0x541f20[_0x3037('0x2b')]=_0x51d49e[_0x3037('0x6b')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x51d49e['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x254197,null))['then'](function(_0x4f02d8){if(_0x4f02d8){_0x541f20[_0x3037('0x71')]=_0x4f02d8['get']({'plain':!![]});interaction_log[_0x3037('0x2c')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25307b[_0x3037('0x6a')]['id'],_0x25307b[_0x3037('0x6a')]['name'],_0x25307b[_0x3037('0x6a')][_0x3037('0x70')],_0x541f20[_0x3037('0x71')]['id'],_0x25307b[_0x3037('0x60')]?JSON[_0x3037('0x29')](_0x25307b[_0x3037('0x60')]):_0x3037('0x72'));return respondWithRpcPromise(_0x3037('0x84'),_0x3037('0x85'),_0x541f20);}return null;})[_0x3037('0x24')](function(_0x105b2d){var _0x5a4aa4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x105b2d[_0x3037('0x2b')][_0x3037('0x75')];return db[_0x3037('0x86')][_0x3037('0x44')](_0x5a4aa4,{'type':db[_0x3037('0x76')][_0x3037('0x87')]['SELECT'],'raw':!![]})['then'](function(_0x3f9f56){return _0x3f9f56;});})['then'](function(_0x23f654){if(_0x23f654){_0x541f20[_0x3037('0x2b')]['contact']=_0x23f654[0x0];if(!_0x25307b[_0x3037('0x60')][_0x3037('0x69')])return;return db[_0x3037('0x79')][_0x3037('0x5e')]({'where':{'id':_0x25307b['body']['UserId'],'role':_0x3037('0x7a')},'attributes':['id',_0x3037('0x3a'),_0x3037('0x88'),_0x3037('0x7b'),_0x3037('0x89')],'raw':!![]});}return null;})[_0x3037('0x24')](function(_0x41bf54){if(!_0x41bf54)return null;_0x541f20['message'][_0x3037('0x7a')]=_0x41bf54;return _0x541f20;})[_0x3037('0x24')](function(_0x330eb7){if(_0x330eb7){_0x330eb7[_0x3037('0x2b')][_0x3037('0x7c')]=util[_0x3037('0x67')](_0x3037('0x7d'),_0x25307b[_0x3037('0x6a')][_0x3037('0x3a')]);_0x330eb7[_0x3037('0x2b')]['channel']=_0x541f20[_0x3037('0x7e')];_0x330eb7[_0x3037('0x2b')][_0x3037('0x7f')]=_0x541f20[_0x3037('0x7e')];_0x330eb7[_0x3037('0x2b')][_0x3037('0x8a')]=_0x3037('0x37');respondWithRpcPromise(_0x3037('0x80'),_0x3037('0x80'),{'event':_0x3037('0x8b'),'message':_[_0x3037('0x53')](_0x541f20[_0x3037('0x2b')],JSON['parse'](_0x541f20['interaction'][_0x3037('0x8c')]))},client9002);return _0x541f20;}return null;})[_0x3037('0x24')](respondWithResult(_0x254197,null))['catch'](handleError(_0x254197,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d6351d7..a995e90 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 _0x26e2=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x26e2,0xe5));var _0x226e=function(_0x31cd5a,_0x453c74){_0x31cd5a=_0x31cd5a-0x0;var _0x354584=_0x26e2[_0x31cd5a];return _0x354584;};'use strict';var EventEmitter=require(_0x226e('0x0'));var ChatMessage=require(_0x226e('0x1'))['db'][_0x226e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x226e('0x3')](0x0);var events={'afterCreate':_0x226e('0x4'),'afterUpdate':_0x226e('0x5'),'afterDestroy':_0x226e('0x6')};function emitEvent(_0x52387c){return function(_0x142e6c,_0xa46b28,_0x627b7b){ChatMessageEvents[_0x226e('0x7')](_0x52387c+':'+_0x142e6c['id'],_0x142e6c);ChatMessageEvents[_0x226e('0x7')](_0x52387c,_0x142e6c);_0x627b7b(null);};}for(var e in events){if(events[_0x226e('0x8')](e)){var event=events[e];ChatMessage[_0x226e('0x9')](e,emitEvent(event));}}module[_0x226e('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x66f9=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4ce6f2,_0x43c09b){var _0x4336d9=function(_0x42439c){while(--_0x42439c){_0x4ce6f2['push'](_0x4ce6f2['shift']());}};_0x4336d9(++_0x43c09b);}(_0x66f9,0xa1));var _0x966f=function(_0x392e93,_0x2aebd1){_0x392e93=_0x392e93-0x0;var _0x31d2f6=_0x66f9[_0x392e93];return _0x31d2f6;};'use strict';var EventEmitter=require(_0x966f('0x0'));var ChatMessage=require(_0x966f('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x966f('0x2'),'afterUpdate':_0x966f('0x3'),'afterDestroy':_0x966f('0x4')};function emitEvent(_0x3e78a3){return function(_0x6d4dc3,_0x3d7d3a,_0x4e3278){ChatMessageEvents[_0x966f('0x5')](_0x3e78a3+':'+_0x6d4dc3['id'],_0x6d4dc3);ChatMessageEvents[_0x966f('0x5')](_0x3e78a3,_0x6d4dc3);_0x4e3278(null);};}for(var e in events){if(events[_0x966f('0x6')](e)){var event=events[e];ChatMessage[_0x966f('0x7')](e,emitEvent(event));}}module[_0x966f('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 20a1b1e..3ba4591 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 _0x057f=['moment','request-promise','path','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','util','../../config/logger'];(function(_0x31b5cd,_0x196e6a){var _0x242d1e=function(_0x30d929){while(--_0x30d929){_0x31b5cd['push'](_0x31b5cd['shift']());}};_0x242d1e(++_0x196e6a);}(_0x057f,0x85));var _0xf057=function(_0x405461,_0x17d34b){_0x405461=_0x405461-0x0;var _0x116438=_0x057f[_0x405461];return _0x116438;};'use strict';var _=require('lodash');var util=require(_0xf057('0x0'));var logger=require(_0xf057('0x1'))('api');var moment=require(_0xf057('0x2'));var BPromise=require('bluebird');var rp=require(_0xf057('0x3'));var fs=require('fs');var path=require(_0xf057('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf057('0x5'));module['exports']=function(_0x4f8620,_0x36cf9c){return _0x4f8620[_0xf057('0x6')](_0xf057('0x7'),attributes,{'tableName':_0xf057('0x8'),'paranoid':![],'indexes':[{'name':_0xf057('0x9'),'fields':[_0xf057('0xa')],'type':_0xf057('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x354a8d,_0x2d97e6,_0x2300ed){var _0x57aed1=_0x4f8620[_0xf057('0xc')];var _0x1cfe39=_0x354a8d[_0xf057('0xd')]({'plain':!![]});if(_0x1cfe39[_0xf057('0xe')][_0xf057('0xf')]()==='in'||_0x1cfe39[_0xf057('0xe')][_0xf057('0xf')]()===_0xf057('0x10')&&!_0x1cfe39[_0xf057('0x11')]&&!_[_0xf057('0x12')](_0x1cfe39['UserId'])){_0x57aed1[_0xf057('0x13')][_0xf057('0x14')]({'where':{'id':_0x1cfe39[_0xf057('0x15')]}})[_0xf057('0x16')](function(_0x149e73){if(_0x149e73){_0x149e73['update']({'lastMsgAt':_0x1cfe39[_0xf057('0x17')],'lastMsgDirection':_0x1cfe39[_0xf057('0xe')]['toLowerCase']()});}})[_0xf057('0x18')](function(_0xa183de){console[_0xf057('0x19')](_0xa183de);});}_0x2300ed();}},'charset':_0xf057('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x34c3=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','then','error','utf8mb4'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x34c3,0x1e1));var _0x334c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x34c3[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x334c('0x0'));var util=require(_0x334c('0x1'));var logger=require(_0x334c('0x2'))(_0x334c('0x3'));var moment=require(_0x334c('0x4'));var BPromise=require(_0x334c('0x5'));var rp=require(_0x334c('0x6'));var fs=require('fs');var path=require(_0x334c('0x7'));var rimraf=require(_0x334c('0x8'));var config=require(_0x334c('0x9'));var attributes=require(_0x334c('0xa'));module[_0x334c('0xb')]=function(_0x3cd037,_0x270906){return _0x3cd037[_0x334c('0xc')](_0x334c('0xd'),attributes,{'tableName':_0x334c('0xe'),'paranoid':![],'indexes':[{'name':_0x334c('0xf'),'fields':[_0x334c('0x10')],'type':_0x334c('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x440a37,_0x332bb2,_0x127c22){var _0x15184e=_0x3cd037[_0x334c('0x12')];var _0x4b216d=_0x440a37['get']({'plain':!![]});if(_0x4b216d[_0x334c('0x13')]['toLowerCase']()==='in'||_0x4b216d[_0x334c('0x13')][_0x334c('0x14')]()===_0x334c('0x15')&&!_0x4b216d[_0x334c('0x16')]&&!_[_0x334c('0x17')](_0x4b216d[_0x334c('0x18')])){_0x15184e[_0x334c('0x19')]['findOne']({'where':{'id':_0x4b216d['ChatInteractionId']}})[_0x334c('0x1a')](function(_0x203ab7){if(_0x203ab7){_0x203ab7['update']({'lastMsgAt':_0x4b216d['createdAt'],'lastMsgDirection':_0x4b216d['direction'][_0x334c('0x14')]()});}})['catch'](function(_0x509352){console[_0x334c('0x1b')](_0x509352);});}_0x127c22();}},'charset':_0x334c('0x1c'),'collate':_0x334c('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1e1230f..17c513a 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 _0x238f=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatMessage','body','options','raw','CreateChatMessage','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x238f,0xad));var _0xf238=function(_0x580d0e,_0x108e68){_0x580d0e=_0x580d0e-0x0;var _0x18ac4b=_0x238f[_0x580d0e];return _0x18ac4b;};'use strict';var _=require('lodash');var util=require(_0xf238('0x0'));var moment=require(_0xf238('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf238('0x2'));var db=require(_0xf238('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf238('0x4'))(_0xf238('0x5'));var config=require(_0xf238('0x6'));var jayson=require(_0xf238('0x7'));var client=jayson[_0xf238('0x8')][_0xf238('0x9')]({'port':0x232a});config[_0xf238('0xa')]=_[_0xf238('0xb')](config[_0xf238('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf238('0xc'))(new Redis(config[_0xf238('0xa')]));require('./chatMessage.socket')[_0xf238('0xd')](socket);function respondWithRpcPromise(_0x57b078,_0x1ff7c8,_0x1db8a9){return new BPromise(function(_0x33a1b6,_0x4e1c21){return client[_0xf238('0xe')](_0x57b078,_0x1db8a9)[_0xf238('0xf')](function(_0x21092d){logger[_0xf238('0x10')](_0xf238('0x11'),_0x1ff7c8,'request\x20sent');logger[_0xf238('0x12')](_0xf238('0x13'),_0x1ff7c8,'request\x20sent',JSON[_0xf238('0x14')](_0x21092d));if(_0x21092d[_0xf238('0x15')]){if(_0x21092d[_0xf238('0x15')][_0xf238('0x16')]===0x1f4){logger['error'](_0xf238('0x11'),_0x1ff7c8,_0x21092d[_0xf238('0x15')]['message']);return _0x4e1c21(_0x21092d[_0xf238('0x15')][_0xf238('0x17')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x1ff7c8,_0x21092d['error'][_0xf238('0x17')]);return _0x33a1b6(_0x21092d[_0xf238('0x15')][_0xf238('0x17')]);}else{logger[_0xf238('0x10')](_0xf238('0x11'),_0x1ff7c8,_0xf238('0x18'));_0x33a1b6(_0x21092d[_0xf238('0x19')][_0xf238('0x17')]);}})[_0xf238('0x1a')](function(_0x5413ed){logger[_0xf238('0x15')](_0xf238('0x11'),_0x1ff7c8,_0x5413ed);_0x4e1c21(_0x5413ed);});});}exports['CreateChatMessage']=function(_0x1020e8){var _0x52a48b=this;return new Promise(function(_0x27a7c9,_0x224992){return db[_0xf238('0x1b')]['create'](_0x1020e8[_0xf238('0x1c')],{'raw':_0x1020e8[_0xf238('0x1d')]?_0x1020e8[_0xf238('0x1d')][_0xf238('0x1e')]===undefined?!![]:![]:!![]})[_0xf238('0xf')](function(_0x64476e){logger[_0xf238('0x10')](_0xf238('0x1f'),_0x1020e8);logger[_0xf238('0x12')](_0xf238('0x1f'),_0x1020e8,JSON[_0xf238('0x14')](_0x64476e));_0x27a7c9(_0x64476e);})[_0xf238('0x1a')](function(_0x68a9bf){logger[_0xf238('0x15')](_0xf238('0x1f'),_0x68a9bf[_0xf238('0x17')],_0x1020e8);_0x224992(_0x52a48b[_0xf238('0x15')](0x1f4,_0x68a9bf[_0xf238('0x17')]));});});}; \ No newline at end of file +var _0x4886=['socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','body','options','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x48b85c,_0x466989){var _0xe3335d=function(_0x2276b4){while(--_0x2276b4){_0x48b85c['push'](_0x48b85c['shift']());}};_0xe3335d(++_0x466989);}(_0x4886,0x122));var _0x6488=function(_0x1f3baa,_0x165669){_0x1f3baa=_0x1f3baa-0x0;var _0xc0dc6f=_0x4886[_0x1f3baa];return _0xc0dc6f;};'use strict';var _=require(_0x6488('0x0'));var util=require('util');var moment=require(_0x6488('0x1'));var BPromise=require(_0x6488('0x2'));var rs=require(_0x6488('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6488('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6488('0x5'))(_0x6488('0x6'));var config=require(_0x6488('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6488('0x8')]['http']({'port':0x232a});config[_0x6488('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6488('0xa'))(new Redis(config[_0x6488('0x9')]));require(_0x6488('0xb'))[_0x6488('0xc')](socket);function respondWithRpcPromise(_0x1b8f73,_0x1d5df9,_0x4aeb1e){return new BPromise(function(_0x758d48,_0x41bd86){return client[_0x6488('0xd')](_0x1b8f73,_0x4aeb1e)['then'](function(_0x435a82){logger[_0x6488('0xe')]('ChatMessage,\x20%s,\x20%s',_0x1d5df9,_0x6488('0xf'));logger[_0x6488('0x10')](_0x6488('0x11'),_0x1d5df9,_0x6488('0xf'),JSON[_0x6488('0x12')](_0x435a82));if(_0x435a82[_0x6488('0x13')]){if(_0x435a82[_0x6488('0x13')][_0x6488('0x14')]===0x1f4){logger[_0x6488('0x13')](_0x6488('0x15'),_0x1d5df9,_0x435a82['error'][_0x6488('0x16')]);return _0x41bd86(_0x435a82['error'][_0x6488('0x16')]);}logger[_0x6488('0x13')](_0x6488('0x15'),_0x1d5df9,_0x435a82[_0x6488('0x13')][_0x6488('0x16')]);return _0x758d48(_0x435a82['error']['message']);}else{logger['info'](_0x6488('0x15'),_0x1d5df9,'request\x20sent');_0x758d48(_0x435a82[_0x6488('0x17')][_0x6488('0x16')]);}})[_0x6488('0x18')](function(_0x254747){logger['error'](_0x6488('0x15'),_0x1d5df9,_0x254747);_0x41bd86(_0x254747);});});}exports[_0x6488('0x19')]=function(_0x4100eb){var _0x3674d6=this;return new Promise(function(_0x3dd294,_0x1217e0){return db[_0x6488('0x1a')]['create'](_0x4100eb[_0x6488('0x1b')],{'raw':_0x4100eb[_0x6488('0x1c')]?_0x4100eb[_0x6488('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x6488('0x1d')](function(_0x2c1ab7){logger['info'](_0x6488('0x19'),_0x4100eb);logger['debug'](_0x6488('0x19'),_0x4100eb,JSON[_0x6488('0x12')](_0x2c1ab7));_0x3dd294(_0x2c1ab7);})[_0x6488('0x18')](function(_0x4c66e7){logger[_0x6488('0x13')](_0x6488('0x19'),_0x4c66e7['message'],_0x4100eb);_0x1217e0(_0x3674d6[_0x6488('0x13')](0x1f4,_0x4c66e7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 58a523a..d437b32 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 _0x448b=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x33beba,_0x39ceff){var _0x35ab5a=function(_0x4e1fcb){while(--_0x4e1fcb){_0x33beba['push'](_0x33beba['shift']());}};_0x35ab5a(++_0x39ceff);}(_0x448b,0x125));var _0xb448=function(_0x9a9f76,_0x33ed7f){_0x9a9f76=_0x9a9f76-0x0;var _0x1fb5b2=_0x448b[_0x9a9f76];return _0x1fb5b2;};'use strict';var ChatMessageEvents=require(_0xb448('0x0'));var events=[_0xb448('0x1'),_0xb448('0x2'),_0xb448('0x3')];function createListener(_0x422fa2,_0x51583a){return function(_0x5bf7db){_0x51583a[_0xb448('0x4')](_0x422fa2,_0x5bf7db);};}function removeListener(_0x32bcae,_0x172a89){return function(){ChatMessageEvents[_0xb448('0x5')](_0x32bcae,_0x172a89);};}exports[_0xb448('0x6')]=function(_0x276466){for(var _0x3670cb=0x0,_0x5993ad=events[_0xb448('0x7')];_0x3670cb<_0x5993ad;_0x3670cb++){var _0x2f6f82=events[_0x3670cb];var _0x2c2bdd=createListener(_0xb448('0x8')+_0x2f6f82,_0x276466);ChatMessageEvents['on'](_0x2f6f82,_0x2c2bdd);}}; \ No newline at end of file +var _0x8ba0=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x2ad2ad,_0x4a1254){var _0x73089a=function(_0x32c78f){while(--_0x32c78f){_0x2ad2ad['push'](_0x2ad2ad['shift']());}};_0x73089a(++_0x4a1254);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x93f1ca,_0x4bdf53){_0x93f1ca=_0x93f1ca-0x0;var _0x31c2c2=_0x8ba0[_0x93f1ca];return _0x31c2c2;};'use strict';var ChatMessageEvents=require(_0x08ba('0x0'));var events=[_0x08ba('0x1'),_0x08ba('0x2'),_0x08ba('0x3')];function createListener(_0x43ffb6,_0x5684f1){return function(_0x5e182a){_0x5684f1[_0x08ba('0x4')](_0x43ffb6,_0x5e182a);};}function removeListener(_0x802b7e,_0x3defcd){return function(){ChatMessageEvents[_0x08ba('0x5')](_0x802b7e,_0x3defcd);};}exports[_0x08ba('0x6')]=function(_0x161a9d){for(var _0x5f29fa=0x0,_0x235354=events[_0x08ba('0x7')];_0x5f29fa<_0x235354;_0x5f29fa++){var _0x37bcdf=events[_0x5f29fa];var _0x451f15=createListener(_0x08ba('0x8')+_0x37bcdf,_0x161a9d);ChatMessageEvents['on'](_0x37bcdf,_0x451f15);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ec4e384..41df606 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 _0x0278=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chatmessage:create','put','/:id','accept','/:id/reject','delete','exports','multer'];(function(_0x120c37,_0x183682){var _0x19dd4b=function(_0x2a3905){while(--_0x2a3905){_0x120c37['push'](_0x120c37['shift']());}};_0x19dd4b(++_0x183682);}(_0x0278,0x110));var _0x8027=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0278[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x8027('0x0'));var util=require('util');var path=require(_0x8027('0x1'));var timeout=require(_0x8027('0x2'));var express=require('express');var router=express[_0x8027('0x3')]();var fs_extra=require(_0x8027('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8027('0x5'));var config=require('../../config/environment');var controller=require(_0x8027('0x6'));router[_0x8027('0x7')]('/',auth[_0x8027('0x8')](),controller['index']);router['get'](_0x8027('0x9'),auth[_0x8027('0x8')](),controller[_0x8027('0xa')]);router['get']('/:id',auth[_0x8027('0x8')](),controller[_0x8027('0xb')]);router[_0x8027('0xc')]('/',auth['isAuthenticated'](),interaction[_0x8027('0xd')]('chat',_0x8027('0xe')),controller['create']);router[_0x8027('0xf')](_0x8027('0x10'),controller['update']);router[_0x8027('0xf')]('/:id/accept',auth[_0x8027('0x8')](),controller[_0x8027('0x11')]);router['put'](_0x8027('0x12'),auth[_0x8027('0x8')](),controller['reject']);router[_0x8027('0x13')](_0x8027('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x8027('0x14')]=router; \ No newline at end of file +var _0xc544=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4dc3b9,_0x29f0d3){var _0x162e7a=function(_0x1e4eea){while(--_0x1e4eea){_0x4dc3b9['push'](_0x4dc3b9['shift']());}};_0x162e7a(++_0x29f0d3);}(_0xc544,0xdf));var _0x4c54=function(_0x4eb288,_0x2bece5){_0x4eb288=_0x4eb288-0x0;var _0xf0f5d4=_0xc544[_0x4eb288];return _0xf0f5d4;};'use strict';var multer=require(_0x4c54('0x0'));var util=require(_0x4c54('0x1'));var path=require(_0x4c54('0x2'));var timeout=require(_0x4c54('0x3'));var express=require(_0x4c54('0x4'));var router=express[_0x4c54('0x5')]();var fs_extra=require(_0x4c54('0x6'));var auth=require(_0x4c54('0x7'));var interaction=require(_0x4c54('0x8'));var config=require(_0x4c54('0x9'));var controller=require('./chatMessage.controller');router[_0x4c54('0xa')]('/',auth['isAuthenticated'](),controller[_0x4c54('0xb')]);router['get'](_0x4c54('0xc'),auth[_0x4c54('0xd')](),controller[_0x4c54('0xe')]);router[_0x4c54('0xa')](_0x4c54('0xf'),auth[_0x4c54('0xd')](),controller[_0x4c54('0x10')]);router[_0x4c54('0x11')]('/',auth['isAuthenticated'](),interaction[_0x4c54('0x12')](_0x4c54('0x13'),_0x4c54('0x14')),controller[_0x4c54('0x15')]);router[_0x4c54('0x16')](_0x4c54('0xf'),controller[_0x4c54('0x17')]);router[_0x4c54('0x16')](_0x4c54('0x18'),auth[_0x4c54('0xd')](),controller[_0x4c54('0x19')]);router[_0x4c54('0x16')](_0x4c54('0x1a'),auth[_0x4c54('0xd')](),controller['reject']);router[_0x4c54('0x1b')](_0x4c54('0xf'),auth[_0x4c54('0xd')](),controller['destroy']);module[_0x4c54('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ea5dc7d..c158ece 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x59b48b,_0x584733){_0x59b48b=_0x59b48b-0x0;var _0x4c3f79=_0x0b0e[_0x59b48b];return _0x4c3f79;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x17c840,_0x13dbfe){var _0x3cd8f5=function(_0x38b565){while(--_0x38b565){_0x17c840['push'](_0x17c840['shift']());}};_0x3cd8f5(++_0x13dbfe);}(_0xdb28,0x106));var _0x8db2=function(_0x4c21fc,_0x2fa72c){_0x4c21fc=_0x4c21fc-0x0;var _0x51a541=_0xdb28[_0x4c21fc];return _0x51a541;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b40f1d1..13b1b31 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x527c5e,_0x36da9e){var _0x1ac69d=function(_0x23b137){while(--_0x23b137){_0x527c5e['push'](_0x527c5e['shift']());}};_0x1ac69d(++_0x36da9e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x55de9d,_0x410c83){var _0xb81146=function(_0x1d0443){while(--_0x1d0443){_0x55de9d['push'](_0x55de9d['shift']());}};_0xb81146(++_0x410c83);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 05ca2ff..e9740ed 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 _0x1509=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1509,0x15c));var _0x9150=function(_0x1b3812,_0x4f9418){_0x1b3812=_0x1b3812-0x0;var _0x450c01=_0x1509[_0x1b3812];return _0x450c01;};'use strict';var EventEmitter=require(_0x9150('0x0'));var ChatOfflineMessage=require(_0x9150('0x1'))['db'][_0x9150('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9150('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9150('0x4'),'afterDestroy':_0x9150('0x5')};function emitEvent(_0x601dd5){return function(_0x13d2ec,_0x39c42d,_0x3d1a63){ChatOfflineMessageEvents['emit'](_0x601dd5+':'+_0x13d2ec['id'],_0x13d2ec);ChatOfflineMessageEvents[_0x9150('0x6')](_0x601dd5,_0x13d2ec);_0x3d1a63(null);};}for(var e in events){if(events[_0x9150('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x9150('0x8')](e,emitEvent(event));}}module[_0x9150('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xda1f=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5459b0,_0x4d2ef8){var _0x675a35=function(_0x538e11){while(--_0x538e11){_0x5459b0['push'](_0x5459b0['shift']());}};_0x675a35(++_0x4d2ef8);}(_0xda1f,0x18a));var _0xfda1=function(_0x5b27b9,_0x3f3943){_0x5b27b9=_0x5b27b9-0x0;var _0x3cb03e=_0xda1f[_0x5b27b9];return _0x3cb03e;};'use strict';var EventEmitter=require(_0xfda1('0x0'));var ChatOfflineMessage=require(_0xfda1('0x1'))['db'][_0xfda1('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xfda1('0x3')](0x0);var events={'afterCreate':_0xfda1('0x4'),'afterUpdate':_0xfda1('0x5'),'afterDestroy':_0xfda1('0x6')};function emitEvent(_0x4fedce){return function(_0x3c2f4b,_0x3437ca,_0x2d4d73){ChatOfflineMessageEvents[_0xfda1('0x7')](_0x4fedce+':'+_0x3c2f4b['id'],_0x3c2f4b);ChatOfflineMessageEvents[_0xfda1('0x7')](_0x4fedce,_0x3c2f4b);_0x2d4d73(null);};}for(var e in events){if(events[_0xfda1('0x8')](e)){var event=events[e];ChatOfflineMessage[_0xfda1('0x9')](e,emitEvent(event));}}module[_0xfda1('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 591d358..e160427 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 _0xdc1e=['chat_offline_messages','utf8mb4','exports','define'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xdc1e,0xa6));var _0xedc1=function(_0x571e79,_0x58e770){_0x571e79=_0x571e79-0x0;var _0x36b13b=_0xdc1e[_0x571e79];return _0x36b13b;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xedc1('0x0')]=function(_0x25f89d){return _0x25f89d[_0xedc1('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0xedc1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedc1('0x3'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x741a=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage'];(function(_0x2bc3d2,_0x386d17){var _0x3b7dfe=function(_0x1b74d1){while(--_0x1b74d1){_0x2bc3d2['push'](_0x2bc3d2['shift']());}};_0x3b7dfe(++_0x386d17);}(_0x741a,0x135));var _0xa741=function(_0x2cde51,_0x41b85c){_0x2cde51=_0x2cde51-0x0;var _0x37177e=_0x741a[_0x2cde51];return _0x37177e;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xa741('0x0')]=function(_0x52a40c){return _0x52a40c[_0xa741('0x1')](_0xa741('0x2'),attributes,{'tableName':_0xa741('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa741('0x4'),'collate':_0xa741('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bc278cb..6b81c0a 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 _0x76e4=['message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x20ae15,_0x1828f5){var _0xc19495=function(_0x4d102a){while(--_0x4d102a){_0x20ae15['push'](_0x20ae15['shift']());}};_0xc19495(++_0x1828f5);}(_0x76e4,0x12d));var _0x476e=function(_0x70381f,_0x3ce152){_0x70381f=_0x70381f-0x0;var _0xc650ea=_0x76e4[_0x70381f];return _0xc650ea;};'use strict';var _=require(_0x476e('0x0'));var util=require('util');var moment=require(_0x476e('0x1'));var BPromise=require(_0x476e('0x2'));var rs=require(_0x476e('0x3'));var fs=require('fs');var Redis=require(_0x476e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x476e('0x5'));var logger=require(_0x476e('0x6'))('rpc');var config=require(_0x476e('0x7'));var jayson=require(_0x476e('0x8'));var client=jayson[_0x476e('0x9')][_0x476e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6a8bc,_0x182cfc,_0x2a0f81){return new BPromise(function(_0x3f26eb,_0x18f94c){return client[_0x476e('0xb')](_0xe6a8bc,_0x2a0f81)[_0x476e('0xc')](function(_0x31e8e5){logger[_0x476e('0xd')](_0x476e('0xe'),_0x182cfc,_0x476e('0xf'));logger['debug'](_0x476e('0x10'),_0x182cfc,_0x476e('0xf'),JSON['stringify'](_0x31e8e5));if(_0x31e8e5['error']){if(_0x31e8e5[_0x476e('0x11')][_0x476e('0x12')]===0x1f4){logger[_0x476e('0x11')](_0x476e('0xe'),_0x182cfc,_0x31e8e5[_0x476e('0x11')][_0x476e('0x13')]);return _0x18f94c(_0x31e8e5[_0x476e('0x11')][_0x476e('0x13')]);}logger[_0x476e('0x11')](_0x476e('0xe'),_0x182cfc,_0x31e8e5['error'][_0x476e('0x13')]);return _0x3f26eb(_0x31e8e5[_0x476e('0x11')]['message']);}else{logger['info'](_0x476e('0xe'),_0x182cfc,_0x476e('0xf'));_0x3f26eb(_0x31e8e5['result'][_0x476e('0x13')]);}})['catch'](function(_0x2e8237){logger['error'](_0x476e('0xe'),_0x182cfc,_0x2e8237);_0x18f94c(_0x2e8237);});});} \ No newline at end of file +var _0x6170=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x4c632b,_0x3496bc){var _0x131619=function(_0x1c80f8){while(--_0x1c80f8){_0x4c632b['push'](_0x4c632b['shift']());}};_0x131619(++_0x3496bc);}(_0x6170,0x1d5));var _0x0617=function(_0x208c19,_0x3942a2){_0x208c19=_0x208c19-0x0;var _0x2d75c5=_0x6170[_0x208c19];return _0x2d75c5;};'use strict';var _=require(_0x0617('0x0'));var util=require('util');var moment=require(_0x0617('0x1'));var BPromise=require(_0x0617('0x2'));var rs=require(_0x0617('0x3'));var fs=require('fs');var Redis=require(_0x0617('0x4'));var db=require(_0x0617('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0617('0x6'))(_0x0617('0x7'));var config=require(_0x0617('0x8'));var jayson=require(_0x0617('0x9'));var client=jayson[_0x0617('0xa')][_0x0617('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b49be,_0x1324b4,_0x39d9ee){return new BPromise(function(_0x4eb881,_0x25f482){return client['request'](_0x1b49be,_0x39d9ee)[_0x0617('0xc')](function(_0x2a84d9){logger['info'](_0x0617('0xd'),_0x1324b4,'request\x20sent');logger[_0x0617('0xe')](_0x0617('0xf'),_0x1324b4,_0x0617('0x10'),JSON[_0x0617('0x11')](_0x2a84d9));if(_0x2a84d9['error']){if(_0x2a84d9['error'][_0x0617('0x12')]===0x1f4){logger[_0x0617('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1324b4,_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);return _0x25f482(_0x2a84d9['error'][_0x0617('0x14')]);}logger[_0x0617('0x13')](_0x0617('0xd'),_0x1324b4,_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);return _0x4eb881(_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);}else{logger['info'](_0x0617('0xd'),_0x1324b4,_0x0617('0x10'));_0x4eb881(_0x2a84d9[_0x0617('0x15')]['message']);}})[_0x0617('0x16')](function(_0x517ae3){logger['error'](_0x0617('0xd'),_0x1324b4,_0x517ae3);_0x25f482(_0x517ae3);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index abb6b78..4baa76f 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 _0xfd54=['/describe','isAuthenticated','describe','show','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xfd54,0x1ad));var _0x4fd5=function(_0x452fde,_0x50be29){_0x452fde=_0x452fde-0x0;var _0x533b5e=_0xfd54[_0x452fde];return _0x533b5e;};'use strict';var multer=require(_0x4fd5('0x0'));var util=require(_0x4fd5('0x1'));var path=require(_0x4fd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x4fd5('0x3'));var router=express[_0x4fd5('0x4')]();var fs_extra=require(_0x4fd5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4fd5('0x6'));var config=require(_0x4fd5('0x7'));var controller=require(_0x4fd5('0x8'));router[_0x4fd5('0x9')]('/',auth['isAuthenticated'](),controller[_0x4fd5('0xa')]);router['get'](_0x4fd5('0xb'),auth[_0x4fd5('0xc')](),controller[_0x4fd5('0xd')]);router[_0x4fd5('0x9')]('/:id',auth[_0x4fd5('0xc')](),controller[_0x4fd5('0xe')]);router[_0x4fd5('0xf')]('/',auth[_0x4fd5('0xc')](),controller[_0x4fd5('0x10')]);router[_0x4fd5('0x11')]('/:id',auth[_0x4fd5('0xc')](),controller['update']);router[_0x4fd5('0x12')]('/:id',auth[_0x4fd5('0xc')](),controller[_0x4fd5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x91a0=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x231486,_0xc3f646){var _0x1226f4=function(_0xc86f69){while(--_0xc86f69){_0x231486['push'](_0x231486['shift']());}};_0x1226f4(++_0xc3f646);}(_0x91a0,0xad));var _0x091a=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x91a0[_0x557fd2];return _0x1b54a2;};'use strict';var multer=require(_0x091a('0x0'));var util=require(_0x091a('0x1'));var path=require(_0x091a('0x2'));var timeout=require('connect-timeout');var express=require(_0x091a('0x3'));var router=express[_0x091a('0x4')]();var fs_extra=require(_0x091a('0x5'));var auth=require(_0x091a('0x6'));var interaction=require(_0x091a('0x7'));var config=require(_0x091a('0x8'));var controller=require(_0x091a('0x9'));router[_0x091a('0xa')]('/',auth[_0x091a('0xb')](),controller[_0x091a('0xc')]);router['get']('/describe',auth[_0x091a('0xb')](),controller['describe']);router[_0x091a('0xa')](_0x091a('0xd'),auth[_0x091a('0xb')](),controller[_0x091a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x091a('0xf')]);router[_0x091a('0x10')](_0x091a('0xd'),auth['isAuthenticated'](),controller[_0x091a('0x11')]);router['delete'](_0x091a('0xd'),auth['isAuthenticated'](),controller[_0x091a('0x12')]);module[_0x091a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9feee52..3f4d3cb 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 _0x590e=['timeout','INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x137625,_0x8ba94){var _0x3b9212=function(_0xa26ad9){while(--_0xa26ad9){_0x137625['push'](_0x137625['shift']());}};_0x3b9212(++_0x8ba94);}(_0x590e,0x1b8));var _0xe590=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x590e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xe590('0x0')]={'name':{'type':Sequelize[_0xe590('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe590('0x2')](_0xe590('0x3'),_0xe590('0x4')),'defaultValue':_0xe590('0x3')},'selector':{'type':Sequelize[_0xe590('0x1')]},'timeout':{'type':Sequelize[_0xe590('0x5')]}}; \ No newline at end of file +var _0x56df=['exports','STRING','mouseOver','INTEGER','sequelize'];(function(_0x21b2e5,_0x57ed16){var _0x1d456b=function(_0x5a2260){while(--_0x5a2260){_0x21b2e5['push'](_0x21b2e5['shift']());}};_0x1d456b(++_0x57ed16);}(_0x56df,0xf4));var _0xf56d=function(_0x3fad0f,_0xc7abd7){_0x3fad0f=_0x3fad0f-0x0;var _0x5e13dd=_0x56df[_0x3fad0f];return _0x5e13dd;};'use strict';var Sequelize=require(_0xf56d('0x0'));module[_0xf56d('0x1')]={'name':{'type':Sequelize[_0xf56d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf56d('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf56d('0x2')]},'timeout':{'type':Sequelize[_0xf56d('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 724d85d..3b55165 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 _0xa261=['limit','Content-Range','apply','save','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','filters','intersection','query','attributes','fields','length','includeAll','options','find','create','body','update','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0xa261,0x1a3));var _0x1a26=function(_0x18341d,_0x39b468){_0x18341d=_0x18341d-0x0;var _0x4a69ea=_0xa261[_0x18341d];return _0x4a69ea;};'use strict';var emlformat=require(_0x1a26('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a26('0x1'));var jsonpatch=require(_0x1a26('0x2'));var rp=require(_0x1a26('0x3'));var moment=require(_0x1a26('0x4'));var BPromise=require(_0x1a26('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a26('0x6'));var csv=require(_0x1a26('0x7'));var ejs=require(_0x1a26('0x8'));var fs=require('fs');var fs_extra=require(_0x1a26('0x9'));var _=require(_0x1a26('0xa'));var squel=require('squel');var crypto=require(_0x1a26('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1a26('0xc'));var toCsv=require(_0x1a26('0x7'));var querystring=require(_0x1a26('0xd'));var Papa=require('papaparse');var Redis=require(_0x1a26('0xe'));var authService=require(_0x1a26('0xf'));var qs=require(_0x1a26('0x10'));var as=require(_0x1a26('0x11'));var hardwareService=require(_0x1a26('0x12'));var logger=require('../../config/logger')(_0x1a26('0x13'));var utils=require(_0x1a26('0x14'));var config=require(_0x1a26('0x15'));var licenseUtil=require(_0x1a26('0x16'));var db=require(_0x1a26('0x17'))['db'];function respondWithStatusCode(_0x36f211,_0x4db24e){_0x4db24e=_0x4db24e||0xcc;return function(_0x3396bf){if(_0x3396bf){return _0x36f211['sendStatus'](_0x4db24e);}return _0x36f211[_0x1a26('0x18')](_0x4db24e)[_0x1a26('0x19')]();};}function respondWithResult(_0xd3aede,_0x49398e){_0x49398e=_0x49398e||0xc8;return function(_0x2e5e02){if(_0x2e5e02){return _0xd3aede[_0x1a26('0x18')](_0x49398e)[_0x1a26('0x1a')](_0x2e5e02);}};}function respondWithFilteredResult(_0x354e7d,_0x1153ad){return function(_0x5a2d74){if(_0x5a2d74){var _0x30dd04=typeof _0x1153ad[_0x1a26('0x1b')]===_0x1a26('0x1c')&&typeof _0x1153ad[_0x1a26('0x1d')]===_0x1a26('0x1c');var _0x344c79=_0x5a2d74['count'];var _0x2f82a0=_0x30dd04?0x0:_0x1153ad['offset'];var _0x5ef863=_0x30dd04?_0x5a2d74['count']:_0x1153ad[_0x1a26('0x1b')]+_0x1153ad[_0x1a26('0x1d')];var _0x1ba20a;if(_0x5ef863>=_0x344c79){_0x5ef863=_0x344c79;_0x1ba20a=0xc8;}else{_0x1ba20a=0xce;}_0x354e7d[_0x1a26('0x18')](_0x1ba20a);return _0x354e7d['set'](_0x1a26('0x1e'),_0x2f82a0+'-'+_0x5ef863+'/'+_0x344c79)['json'](_0x5a2d74);}return null;};}function patchUpdates(_0x42c8af){return function(_0x2f7801){try{jsonpatch[_0x1a26('0x1f')](_0x2f7801,_0x42c8af,!![]);}catch(_0x2f4378){return BPromise['reject'](_0x2f4378);}return _0x2f7801[_0x1a26('0x20')]();};}function saveUpdates(_0x26a427,_0x28f7ae){return function(_0x4d76ad){if(_0x4d76ad){return _0x4d76ad['update'](_0x26a427)['then'](function(_0x4e67d6){return _0x4e67d6;});}return null;};}function removeEntity(_0x6550ee,_0x43fe62){return function(_0x128c00){if(_0x128c00){return _0x128c00['destroy']()[_0x1a26('0x21')](function(){_0x6550ee[_0x1a26('0x18')](0xcc)[_0x1a26('0x19')]();});}};}function handleEntityNotFound(_0x53eeb1,_0x3409bc){return function(_0x221643){if(!_0x221643){_0x53eeb1['sendStatus'](0x194);}return _0x221643;};}function handleError(_0x12a925,_0x24cfc9){_0x24cfc9=_0x24cfc9||0x1f4;return function(_0x7ac183){logger[_0x1a26('0x22')](_0x7ac183[_0x1a26('0x23')]);if(_0x7ac183[_0x1a26('0x24')]){delete _0x7ac183[_0x1a26('0x24')];}_0x12a925[_0x1a26('0x18')](_0x24cfc9)[_0x1a26('0x25')](_0x7ac183);};}exports[_0x1a26('0x26')]=function(_0x405cec,_0x58c63d){var _0x256226={'raw':!![],'where':{'id':_0x405cec[_0x1a26('0x27')]['id']}},_0x34e63e={};_0x34e63e[_0x1a26('0x28')]=_[_0x1a26('0x29')](db[_0x1a26('0x2a')]['rawAttributes']);_0x34e63e['query']=_['keys'](_0x405cec['query']);_0x34e63e[_0x1a26('0x2b')]=_[_0x1a26('0x2c')](_0x34e63e['model'],_0x34e63e[_0x1a26('0x2d')]);_0x256226[_0x1a26('0x2e')]=_[_0x1a26('0x2c')](_0x34e63e[_0x1a26('0x28')],qs[_0x1a26('0x2f')](_0x405cec[_0x1a26('0x2d')][_0x1a26('0x2f')]));_0x256226['attributes']=_0x256226['attributes'][_0x1a26('0x30')]?_0x256226[_0x1a26('0x2e')]:_0x34e63e[_0x1a26('0x28')];if(_0x405cec[_0x1a26('0x2d')][_0x1a26('0x31')]){_0x256226['include']=[{'all':!![]}];}_0x256226=_['merge']({},_0x256226,_0x405cec[_0x1a26('0x32')]);return db['ChatProactiveAction'][_0x1a26('0x33')](_0x256226)[_0x1a26('0x21')](handleEntityNotFound(_0x58c63d,null))[_0x1a26('0x21')](respondWithResult(_0x58c63d,null))['catch'](handleError(_0x58c63d,null));};exports[_0x1a26('0x34')]=function(_0x40a9f9,_0x1134d9){return db['ChatProactiveAction'][_0x1a26('0x34')](_0x40a9f9[_0x1a26('0x35')],{})[_0x1a26('0x21')](respondWithResult(_0x1134d9,0xc9))['catch'](handleError(_0x1134d9,null));};exports[_0x1a26('0x36')]=function(_0x25308c,_0x374d17){if(_0x25308c['body']['id']){delete _0x25308c[_0x1a26('0x35')]['id'];}return db[_0x1a26('0x2a')][_0x1a26('0x33')]({'where':{'id':_0x25308c[_0x1a26('0x27')]['id']}})[_0x1a26('0x21')](handleEntityNotFound(_0x374d17,null))[_0x1a26('0x21')](saveUpdates(_0x25308c[_0x1a26('0x35')],null))['then'](respondWithResult(_0x374d17,null))[_0x1a26('0x37')](handleError(_0x374d17,null));};exports['destroy']=function(_0x139600,_0xe3a339){return db['ChatProactiveAction'][_0x1a26('0x33')]({'where':{'id':_0x139600['params']['id']}})['then'](handleEntityNotFound(_0xe3a339,null))[_0x1a26('0x21')](removeEntity(_0xe3a339,null))[_0x1a26('0x37')](handleError(_0xe3a339,null));}; \ No newline at end of file +var _0x455d=['save','update','then','end','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','create','ChatProactiveAction','body','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply'];(function(_0x596a5b,_0x51af41){var _0x1b7e71=function(_0x37cb7d){while(--_0x37cb7d){_0x596a5b['push'](_0x596a5b['shift']());}};_0x1b7e71(++_0x51af41);}(_0x455d,0x190));var _0xd455=function(_0x4a88b5,_0x5aba47){_0x4a88b5=_0x4a88b5-0x0;var _0x4e8aa0=_0x455d[_0x4a88b5];return _0x4e8aa0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd455('0x0'));var jsonpatch=require(_0xd455('0x1'));var rp=require(_0xd455('0x2'));var moment=require('moment');var BPromise=require(_0xd455('0x3'));var Mustache=require(_0xd455('0x4'));var util=require(_0xd455('0x5'));var path=require(_0xd455('0x6'));var sox=require(_0xd455('0x7'));var csv=require(_0xd455('0x8'));var ejs=require(_0xd455('0x9'));var fs=require('fs');var fs_extra=require(_0xd455('0xa'));var _=require(_0xd455('0xb'));var squel=require('squel');var crypto=require(_0xd455('0xc'));var jsforce=require(_0xd455('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd455('0x8'));var querystring=require(_0xd455('0xe'));var Papa=require(_0xd455('0xf'));var Redis=require(_0xd455('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd455('0x11'));var as=require(_0xd455('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd455('0x13'))(_0xd455('0x14'));var utils=require(_0xd455('0x15'));var config=require(_0xd455('0x16'));var licenseUtil=require(_0xd455('0x17'));var db=require(_0xd455('0x18'))['db'];function respondWithStatusCode(_0x4cc3c1,_0x488c4b){_0x488c4b=_0x488c4b||0xcc;return function(_0x272ce4){if(_0x272ce4){return _0x4cc3c1[_0xd455('0x19')](_0x488c4b);}return _0x4cc3c1[_0xd455('0x1a')](_0x488c4b)['end']();};}function respondWithResult(_0x2ec160,_0x39fa8b){_0x39fa8b=_0x39fa8b||0xc8;return function(_0xca260c){if(_0xca260c){return _0x2ec160[_0xd455('0x1a')](_0x39fa8b)[_0xd455('0x1b')](_0xca260c);}};}function respondWithFilteredResult(_0x1958ca,_0xbcde64){return function(_0x28b621){if(_0x28b621){var _0x205f3b=typeof _0xbcde64['offset']===_0xd455('0x1c')&&typeof _0xbcde64[_0xd455('0x1d')]===_0xd455('0x1c');var _0x33e2ad=_0x28b621[_0xd455('0x1e')];var _0x1408a3=_0x205f3b?0x0:_0xbcde64[_0xd455('0x1f')];var _0x4c0bbb=_0x205f3b?_0x28b621[_0xd455('0x1e')]:_0xbcde64['offset']+_0xbcde64[_0xd455('0x1d')];var _0x43d85b;if(_0x4c0bbb>=_0x33e2ad){_0x4c0bbb=_0x33e2ad;_0x43d85b=0xc8;}else{_0x43d85b=0xce;}_0x1958ca[_0xd455('0x1a')](_0x43d85b);return _0x1958ca[_0xd455('0x20')]('Content-Range',_0x1408a3+'-'+_0x4c0bbb+'/'+_0x33e2ad)['json'](_0x28b621);}return null;};}function patchUpdates(_0x636ec3){return function(_0xfb071c){try{jsonpatch[_0xd455('0x21')](_0xfb071c,_0x636ec3,!![]);}catch(_0x219c58){return BPromise['reject'](_0x219c58);}return _0xfb071c[_0xd455('0x22')]();};}function saveUpdates(_0x2bafc4,_0x518e5c){return function(_0x25d7ad){if(_0x25d7ad){return _0x25d7ad[_0xd455('0x23')](_0x2bafc4)[_0xd455('0x24')](function(_0x349313){return _0x349313;});}return null;};}function removeEntity(_0x4becf3,_0x27d526){return function(_0x5341be){if(_0x5341be){return _0x5341be['destroy']()['then'](function(){_0x4becf3[_0xd455('0x1a')](0xcc)[_0xd455('0x25')]();});}};}function handleEntityNotFound(_0x4fd832,_0x20b320){return function(_0x3dd015){if(!_0x3dd015){_0x4fd832[_0xd455('0x19')](0x194);}return _0x3dd015;};}function handleError(_0x40c0fe,_0x26a9f4){_0x26a9f4=_0x26a9f4||0x1f4;return function(_0x2a5652){logger['error'](_0x2a5652[_0xd455('0x26')]);if(_0x2a5652[_0xd455('0x27')]){delete _0x2a5652[_0xd455('0x27')];}_0x40c0fe[_0xd455('0x1a')](_0x26a9f4)[_0xd455('0x28')](_0x2a5652);};}exports[_0xd455('0x29')]=function(_0x30eff6,_0x1cc374){var _0xc417f1={'raw':!![],'where':{'id':_0x30eff6[_0xd455('0x2a')]['id']}},_0x5ec076={};_0x5ec076['model']=_[_0xd455('0x2b')](db['ChatProactiveAction'][_0xd455('0x2c')]);_0x5ec076[_0xd455('0x2d')]=_[_0xd455('0x2b')](_0x30eff6['query']);_0x5ec076[_0xd455('0x2e')]=_[_0xd455('0x2f')](_0x5ec076[_0xd455('0x30')],_0x5ec076['query']);_0xc417f1['attributes']=_[_0xd455('0x2f')](_0x5ec076['model'],qs['fields'](_0x30eff6[_0xd455('0x2d')][_0xd455('0x31')]));_0xc417f1[_0xd455('0x32')]=_0xc417f1[_0xd455('0x32')][_0xd455('0x33')]?_0xc417f1[_0xd455('0x32')]:_0x5ec076[_0xd455('0x30')];if(_0x30eff6[_0xd455('0x2d')][_0xd455('0x34')]){_0xc417f1[_0xd455('0x35')]=[{'all':!![]}];}_0xc417f1=_[_0xd455('0x36')]({},_0xc417f1,_0x30eff6[_0xd455('0x37')]);return db['ChatProactiveAction'][_0xd455('0x38')](_0xc417f1)[_0xd455('0x24')](handleEntityNotFound(_0x1cc374,null))[_0xd455('0x24')](respondWithResult(_0x1cc374,null))[_0xd455('0x39')](handleError(_0x1cc374,null));};exports[_0xd455('0x3a')]=function(_0xd292f4,_0x3f3d7c){return db[_0xd455('0x3b')][_0xd455('0x3a')](_0xd292f4[_0xd455('0x3c')],{})[_0xd455('0x24')](respondWithResult(_0x3f3d7c,0xc9))[_0xd455('0x39')](handleError(_0x3f3d7c,null));};exports[_0xd455('0x23')]=function(_0xd7d621,_0x44e8c0){if(_0xd7d621[_0xd455('0x3c')]['id']){delete _0xd7d621[_0xd455('0x3c')]['id'];}return db[_0xd455('0x3b')][_0xd455('0x38')]({'where':{'id':_0xd7d621[_0xd455('0x2a')]['id']}})[_0xd455('0x24')](handleEntityNotFound(_0x44e8c0,null))[_0xd455('0x24')](saveUpdates(_0xd7d621[_0xd455('0x3c')],null))[_0xd455('0x24')](respondWithResult(_0x44e8c0,null))[_0xd455('0x39')](handleError(_0x44e8c0,null));};exports[_0xd455('0x3d')]=function(_0x116b28,_0x469b88){return db[_0xd455('0x3b')][_0xd455('0x38')]({'where':{'id':_0x116b28[_0xd455('0x2a')]['id']}})[_0xd455('0x24')](handleEntityNotFound(_0x469b88,null))[_0xd455('0x24')](removeEntity(_0x469b88,null))['catch'](handleError(_0x469b88,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 27afae9..1dd2635 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 _0xe7c1=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x489f00,_0x2c890d){var _0x1a1d35=function(_0x58f62f){while(--_0x58f62f){_0x489f00['push'](_0x489f00['shift']());}};_0x1a1d35(++_0x2c890d);}(_0xe7c1,0x148));var _0x1e7c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe7c1[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1e7c('0x0'));var util=require(_0x1e7c('0x1'));var logger=require(_0x1e7c('0x2'))(_0x1e7c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e7c('0x4'));var fs=require('fs');var path=require(_0x1e7c('0x5'));var rimraf=require('rimraf');var config=require(_0x1e7c('0x6'));var attributes=require(_0x1e7c('0x7'));module[_0x1e7c('0x8')]=function(_0x553ee0,_0x413897){return _0x553ee0[_0x1e7c('0x9')](_0x1e7c('0xa'),attributes,{'tableName':_0x1e7c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51cc=['ChatProactiveAction','lodash','util','../../config/logger','api','bluebird','path','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x51cc,0x85));var _0xc51c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x51cc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc51c('0x0'));var util=require(_0xc51c('0x1'));var logger=require(_0xc51c('0x2'))(_0xc51c('0x3'));var moment=require('moment');var BPromise=require(_0xc51c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc51c('0x5'));var rimraf=require(_0xc51c('0x6'));var config=require('../../config/environment');var attributes=require(_0xc51c('0x7'));module[_0xc51c('0x8')]=function(_0x45fac7,_0x1a601b){return _0x45fac7[_0xc51c('0x9')](_0xc51c('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d6538ad..5191233 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 _0x3dc9=['randomstring','../../config/utils','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x3dc9,0xa7));var _0x93dc=function(_0x3d9796,_0x24b5bd){_0x3d9796=_0x3d9796-0x0;var _0x553455=_0x3dc9[_0x3d9796];return _0x553455;};'use strict';var _=require(_0x93dc('0x0'));var util=require(_0x93dc('0x1'));var moment=require(_0x93dc('0x2'));var BPromise=require(_0x93dc('0x3'));var rs=require(_0x93dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x93dc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x93dc('0x6'));var jayson=require(_0x93dc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec3d7,_0x2e4a60,_0x3b4d55){return new BPromise(function(_0x120cd7,_0x5dded5){return client[_0x93dc('0x8')](_0x3ec3d7,_0x3b4d55)[_0x93dc('0x9')](function(_0x5446ed){logger[_0x93dc('0xa')](_0x93dc('0xb'),_0x2e4a60,_0x93dc('0xc'));logger['debug'](_0x93dc('0xd'),_0x2e4a60,'request\x20sent',JSON[_0x93dc('0xe')](_0x5446ed));if(_0x5446ed[_0x93dc('0xf')]){if(_0x5446ed['error'][_0x93dc('0x10')]===0x1f4){logger['error'](_0x93dc('0xb'),_0x2e4a60,_0x5446ed['error'][_0x93dc('0x11')]);return _0x5dded5(_0x5446ed[_0x93dc('0xf')][_0x93dc('0x11')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2e4a60,_0x5446ed['error'][_0x93dc('0x11')]);return _0x120cd7(_0x5446ed['error'][_0x93dc('0x11')]);}else{logger[_0x93dc('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x2e4a60,'request\x20sent');_0x120cd7(_0x5446ed[_0x93dc('0x12')][_0x93dc('0x11')]);}})['catch'](function(_0x2ea1d5){logger['error'](_0x93dc('0xb'),_0x2e4a60,_0x2ea1d5);_0x5dded5(_0x2ea1d5);});});} \ No newline at end of file +var _0x64c2=['client','http','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x302d62,_0x1159b5){var _0xec9d70=function(_0x5d6c67){while(--_0x5d6c67){_0x302d62['push'](_0x302d62['shift']());}};_0xec9d70(++_0x1159b5);}(_0x64c2,0x194));var _0x264c=function(_0x1bb1f6,_0x38709d){_0x1bb1f6=_0x1bb1f6-0x0;var _0x5698d8=_0x64c2[_0x1bb1f6];return _0x5698d8;};'use strict';var _=require(_0x264c('0x0'));var util=require(_0x264c('0x1'));var moment=require(_0x264c('0x2'));var BPromise=require('bluebird');var rs=require(_0x264c('0x3'));var fs=require('fs');var Redis=require(_0x264c('0x4'));var db=require(_0x264c('0x5'))['db'];var utils=require(_0x264c('0x6'));var logger=require(_0x264c('0x7'))(_0x264c('0x8'));var config=require(_0x264c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x264c('0xa')][_0x264c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54df58,_0x388487,_0x44cde4){return new BPromise(function(_0x20b0ab,_0x4bc271){return client['request'](_0x54df58,_0x44cde4)[_0x264c('0xc')](function(_0x1cc3e2){logger[_0x264c('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x388487,_0x264c('0xe'));logger[_0x264c('0xf')](_0x264c('0x10'),_0x388487,_0x264c('0xe'),JSON[_0x264c('0x11')](_0x1cc3e2));if(_0x1cc3e2['error']){if(_0x1cc3e2[_0x264c('0x12')][_0x264c('0x13')]===0x1f4){logger[_0x264c('0x12')](_0x264c('0x14'),_0x388487,_0x1cc3e2[_0x264c('0x12')][_0x264c('0x15')]);return _0x4bc271(_0x1cc3e2['error'][_0x264c('0x15')]);}logger[_0x264c('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x388487,_0x1cc3e2[_0x264c('0x12')][_0x264c('0x15')]);return _0x20b0ab(_0x1cc3e2[_0x264c('0x12')][_0x264c('0x15')]);}else{logger['info'](_0x264c('0x14'),_0x388487,'request\x20sent');_0x20b0ab(_0x1cc3e2['result'][_0x264c('0x15')]);}})[_0x264c('0x16')](function(_0x1ec561){logger['error'](_0x264c('0x14'),_0x388487,_0x1ec561);_0x4bc271(_0x1ec561);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 285a230..cfd992b 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 _0x9957=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/',auth['isAuthenticated'](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0x12')]);module[_0x7995('0x13')]=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xeff8,0x186));var _0x8eff=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xeff8[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 29e62b3..f8b0a6f 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 _0x45d0=['name','ENUM','rrmemory','beepall','sequelize','STRING'];(function(_0xbb9a63,_0x5ee35b){var _0x281450=function(_0x44c275){while(--_0x44c275){_0xbb9a63['push'](_0xbb9a63['shift']());}};_0x281450(++_0x5ee35b);}(_0x45d0,0x1d2));var _0x045d=function(_0x29042c,_0x5f355f){_0x29042c=_0x29042c-0x0;var _0xfccd0=_0x45d0[_0x29042c];return _0xfccd0;};'use strict';var Sequelize=require(_0x045d('0x0'));module['exports']={'name':{'type':Sequelize[_0x045d('0x1')],'unique':_0x045d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x045d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x045d('0x3')](_0x045d('0x4'),_0x045d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb2d2=['STRING','name','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb2d2,0x7c));var _0x2b2d=function(_0x3e9096,_0x517618){_0x3e9096=_0x3e9096-0x0;var _0x18210f=_0xb2d2[_0x3e9096];return _0x18210f;};'use strict';var Sequelize=require(_0x2b2d('0x0'));module[_0x2b2d('0x1')]={'name':{'type':Sequelize[_0x2b2d('0x2')],'unique':_0x2b2d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2b2d('0x4')]('rrmemory',_0x2b2d('0x5'),_0x2b2d('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4893ed5..3aaa8d9 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 _0x3443=['limit','count','Content-Range','update','then','ChatQueues','destroy','sendStatus','error','name','send','index','ChatQueue','fieldName','type','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','filters','hasOwnProperty','offset','order','sort','where','pick','map','filter','User','agent','chatPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','nolimit','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','includes','all','isEmpty','removeAgents','userChatQueue:remove','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','localhost','./chatQueue.socket','register','status','end','json'];(function(_0x5a5651,_0x2b60b0){var _0x2582c5=function(_0x52bb86){while(--_0x52bb86){_0x5a5651['push'](_0x5a5651['shift']());}};_0x2582c5(++_0x2b60b0);}(_0x3443,0x1b1));var _0x3344=function(_0x3f2454,_0x34e0ff){_0x3f2454=_0x3f2454-0x0;var _0x29231b=_0x3443[_0x3f2454];return _0x29231b;};'use strict';var BPromise=require(_0x3344('0x0'));var util=require(_0x3344('0x1'));var _=require(_0x3344('0x2'));var squel=require(_0x3344('0x3'));var Redis=require(_0x3344('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x3344('0x5'))(_0x3344('0x6'));var config=require('../../config/environment');var db=require(_0x3344('0x7'))['db'];config[_0x3344('0x8')]=_['defaults'](config[_0x3344('0x8')],{'host':_0x3344('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3344('0x8')]));require(_0x3344('0xa'))[_0x3344('0xb')](socket);function respondWithStatusCode(_0x44c840,_0x4aca79){_0x4aca79=_0x4aca79||0xcc;return function(_0x5b7fa5){if(_0x5b7fa5){return _0x44c840['sendStatus'](_0x4aca79);}return _0x44c840[_0x3344('0xc')](_0x4aca79)[_0x3344('0xd')]();};}function respondWithResult(_0x215e8f,_0x325f01){_0x325f01=_0x325f01||0xc8;return function(_0x5adddf){if(_0x5adddf){return _0x215e8f[_0x3344('0xc')](_0x325f01)[_0x3344('0xe')](_0x5adddf);}};}function respondWithFilteredResult(_0x5bba34,_0x51d312){return function(_0x41f571){if(_0x41f571){var _0x49d8dc=typeof _0x51d312['offset']==='undefined'&&typeof _0x51d312[_0x3344('0xf')]==='undefined';var _0x34d157=_0x41f571[_0x3344('0x10')];var _0x221ef9=_0x49d8dc?0x0:_0x51d312['offset'];var _0x39cc81=_0x49d8dc?_0x41f571[_0x3344('0x10')]:_0x51d312['offset']+_0x51d312[_0x3344('0xf')];var _0x444068;if(_0x39cc81>=_0x34d157){_0x39cc81=_0x34d157;_0x444068=0xc8;}else{_0x444068=0xce;}_0x5bba34[_0x3344('0xc')](_0x444068);return _0x5bba34['set'](_0x3344('0x11'),_0x221ef9+'-'+_0x39cc81+'/'+_0x34d157)[_0x3344('0xe')](_0x41f571);}return null;};}function saveUpdates(_0x4bbf7e){return function(_0x2c828e){if(_0x2c828e){return _0x2c828e[_0x3344('0x12')](_0x4bbf7e)[_0x3344('0x13')](function(_0x1fb2e3){return _0x1fb2e3;});}return null;};}function removeEntity(_0x1e2e9a){return function(_0x4149d5){if(_0x4149d5){return _0x4149d5['destroy']()[_0x3344('0x13')](function(){var _0x3628d3=_0x4149d5['get']({'plain':!![]});var _0x233451=_0x3344('0x14');return db['UserProfileResource'][_0x3344('0x15')]({'where':{'type':_0x233451,'resourceId':_0x3628d3['id']}})[_0x3344('0x13')](function(){return _0x4149d5;});})[_0x3344('0x13')](function(){_0x1e2e9a[_0x3344('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b186a){return function(_0x1003ea){if(!_0x1003ea){_0x5b186a[_0x3344('0x16')](0x194);}return _0x1003ea;};}function handleError(_0x42428d,_0x3ab3b5){_0x3ab3b5=_0x3ab3b5||0x1f4;return function(_0x447cbf){logger[_0x3344('0x17')](_0x447cbf['stack']);if(_0x447cbf[_0x3344('0x18')]){delete _0x447cbf[_0x3344('0x18')];}_0x42428d[_0x3344('0xc')](_0x3ab3b5)[_0x3344('0x19')](_0x447cbf);};}exports[_0x3344('0x1a')]=function(_0x36de1a,_0x263b43){var _0x1e9471={};var _0x17b0a4={'count':0x0,'rows':[]};var _0x26dd46=_['map'](db[_0x3344('0x1b')]['rawAttributes'],function(_0x169e8a){return{'name':_0x169e8a[_0x3344('0x1c')],'type':_0x169e8a[_0x3344('0x1d')]['key']};});_0x1e9471=qs['getOptions'](_0x26dd46,_0x36de1a);var _0x1ea29f={'where':_0x1e9471['where']};return db[_0x3344('0x1b')][_0x3344('0x10')](_0x1ea29f)['then'](function(_0x111569){_0x17b0a4['count']=_0x111569;_0x1e9471['include']=qs[_0x3344('0x1e')](_0x36de1a[_0x3344('0x1f')]);return db[_0x3344('0x1b')][_0x3344('0x20')](_0x1e9471);})['then'](function(_0x523bcd){_0x17b0a4[_0x3344('0x21')]=_0x523bcd;return _0x17b0a4;})[_0x3344('0x13')](respondWithFilteredResult(_0x263b43,_0x1e9471))[_0x3344('0x22')](handleError(_0x263b43,null));};exports[_0x3344('0x23')]=function(_0xa8b4d4,_0x570eec){var _0x3db7a7={'raw':!![],'where':{'id':_0xa8b4d4[_0x3344('0x24')]['id']}},_0x3c50f5={};_0x3c50f5[_0x3344('0x25')]=_[_0x3344('0x26')](db['ChatQueue'][_0x3344('0x27')]);_0x3c50f5[_0x3344('0x1f')]=_[_0x3344('0x26')](_0xa8b4d4[_0x3344('0x1f')]);_0x3c50f5['filters']=_[_0x3344('0x28')](_0x3c50f5[_0x3344('0x25')],_0x3c50f5[_0x3344('0x1f')]);_0x3db7a7[_0x3344('0x29')]=_[_0x3344('0x28')](_0x3c50f5['model'],qs[_0x3344('0x2a')](_0xa8b4d4[_0x3344('0x1f')]['fields']));_0x3db7a7[_0x3344('0x29')]=_0x3db7a7[_0x3344('0x29')][_0x3344('0x2b')]?_0x3db7a7[_0x3344('0x29')]:_0x3c50f5[_0x3344('0x25')];if(_0xa8b4d4[_0x3344('0x1f')][_0x3344('0x2c')]){_0x3db7a7[_0x3344('0x1e')]=[{'all':!![]}];}_0x3db7a7=_[_0x3344('0x2d')]({},_0x3db7a7,_0xa8b4d4[_0x3344('0x2e')]);return db[_0x3344('0x1b')][_0x3344('0x2f')](_0x3db7a7)[_0x3344('0x13')](handleEntityNotFound(_0x570eec,null))[_0x3344('0x13')](respondWithResult(_0x570eec,null))['catch'](handleError(_0x570eec,null));};exports[_0x3344('0x30')]=function(_0x7f0c31,_0x337af9){return db[_0x3344('0x1b')][_0x3344('0x30')](_0x7f0c31[_0x3344('0x31')],{})['then'](function(_0xe5858){var _0xd5ee07=_0x7f0c31['user'][_0x3344('0x32')]({'plain':!![]});if(!_0xd5ee07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd5ee07['role']===_0x3344('0x33')){var _0x301898=_0xe5858[_0x3344('0x32')]({'plain':!![]});var _0x257dc6=_0x3344('0x14');return db[_0x3344('0x34')]['find']({'where':{'name':_0x257dc6,'userProfileId':_0xd5ee07[_0x3344('0x35')]},'raw':!![]})[_0x3344('0x13')](function(_0x5b4912){if(_0x5b4912&&_0x5b4912[_0x3344('0x36')]===0x0){return db[_0x3344('0x37')][_0x3344('0x30')]({'name':_0x301898['name'],'resourceId':_0x301898['id'],'type':_0x5b4912['name'],'sectionId':_0x5b4912['id']},{})[_0x3344('0x13')](function(){return _0xe5858;});}else{return _0xe5858;}})[_0x3344('0x22')](function(_0x25a5b6){logger[_0x3344('0x17')](_0x3344('0x38'),_0x25a5b6);throw _0x25a5b6;});}return _0xe5858;})[_0x3344('0x13')](respondWithResult(_0x337af9,0xc9))['catch'](handleError(_0x337af9,null));};exports['update']=function(_0x114841,_0x468fdf){if(_0x114841[_0x3344('0x31')]['id']){delete _0x114841[_0x3344('0x31')]['id'];}return db[_0x3344('0x1b')][_0x3344('0x2f')]({'where':{'id':_0x114841[_0x3344('0x24')]['id']}})['then'](handleEntityNotFound(_0x468fdf,null))['then'](saveUpdates(_0x114841[_0x3344('0x31')],null))['then'](respondWithResult(_0x468fdf,null))[_0x3344('0x22')](handleError(_0x468fdf,null));};exports[_0x3344('0x15')]=function(_0x2fc8eb,_0x2d3b5e){return db[_0x3344('0x1b')][_0x3344('0x2f')]({'where':{'id':_0x2fc8eb[_0x3344('0x24')]['id']}})[_0x3344('0x13')](handleEntityNotFound(_0x2d3b5e,null))[_0x3344('0x13')](removeEntity(_0x2d3b5e,null))['catch'](handleError(_0x2d3b5e,null));};exports[_0x3344('0x39')]=function(_0x3f76ec,_0x402328){return db[_0x3344('0x1b')][_0x3344('0x39')]()['then'](respondWithResult(_0x402328,null))['catch'](handleError(_0x402328,null));};exports['getMembers']=function(_0x539b67,_0x47e744){var _0x171c18={'raw':!![],'where':{}},_0x3dc241={},_0x4547fe;return db[_0x3344('0x1b')][_0x3344('0x3a')]({'where':{'id':_0x539b67[_0x3344('0x24')]['id']}})['then'](handleEntityNotFound(_0x47e744,null))[_0x3344('0x13')](function(_0x5d04f9){if(_0x5d04f9){_0x4547fe=_0x5d04f9['get']({'plain':!![]});_0x3dc241['model']=_[_0x3344('0x26')](db[_0x3344('0x3b')][_0x3344('0x27')]);_0x3dc241[_0x3344('0x1f')]=_[_0x3344('0x26')](_0x539b67[_0x3344('0x1f')]);_0x3dc241[_0x3344('0x3c')]=_[_0x3344('0x28')](_0x3dc241['model'],_0x3dc241['query']);_0x171c18[_0x3344('0x29')]=_[_0x3344('0x28')](_0x3dc241[_0x3344('0x25')],qs['fields'](_0x539b67[_0x3344('0x1f')][_0x3344('0x2a')]));_0x171c18[_0x3344('0x29')]=_0x171c18[_0x3344('0x29')][_0x3344('0x2b')]?_0x171c18[_0x3344('0x29')]:_0x3dc241['model'];if(!_0x539b67[_0x3344('0x1f')][_0x3344('0x3d')]('nolimit')){_0x171c18[_0x3344('0xf')]=qs[_0x3344('0xf')](_0x539b67['query'][_0x3344('0xf')]);_0x171c18['offset']=qs[_0x3344('0x3e')](_0x539b67[_0x3344('0x1f')][_0x3344('0x3e')]);}_0x171c18[_0x3344('0x3f')]=qs[_0x3344('0x40')](_0x539b67[_0x3344('0x1f')]['sort']);_0x171c18[_0x3344('0x41')]=qs['filters'](_[_0x3344('0x42')](_0x539b67[_0x3344('0x1f')],_0x3dc241['filters']));_0x171c18[_0x3344('0x41')]['ChatQueueId']=_0x5d04f9['id'];if(_0x539b67[_0x3344('0x1f')]['filter']){_0x171c18['where']=_[_0x3344('0x2d')](_0x171c18['where'],{'$or':_[_0x3344('0x43')](_0x171c18['attributes'],function(_0x340948){var _0x4e1399={};_0x4e1399[_0x340948]={'$like':'%'+_0x539b67[_0x3344('0x1f')][_0x3344('0x44')]+'%'};return _0x4e1399;})});}_0x171c18=_[_0x3344('0x2d')]({},_0x171c18,_0x539b67[_0x3344('0x2e')]);return db[_0x3344('0x3b')][_0x3344('0x20')](_0x171c18);}})['then'](function(_0x5a2615){if(_0x5a2615){return db[_0x3344('0x45')]['findAndCountAll']({'where':{'id':_[_0x3344('0x43')](_0x5a2615,'UserId'),'role':_0x3344('0x46')},'attributes':['id',_0x3344('0x18'),_0x3344('0x47'),'updatedAt','createdAt']});}})[_0x3344('0x13')](function(_0x2c16e2){if(_0x2c16e2){return{'count':_0x2c16e2[_0x3344('0x10')],'rows':_[_0x3344('0x43')](_0x2c16e2[_0x3344('0x21')],function(_0x5e730b){return{'membername':_0x5e730b['name'],'UserId':_0x5e730b['id'],'queue_name':_0x4547fe[_0x3344('0x18')],'ChatQueueId':_0x4547fe['id'],'interface':util[_0x3344('0x48')](_0x3344('0x49'),_0x3344('0x4a'),_0x5e730b[_0x3344('0x18')]),'penalty':0x0,'paused':_0x5e730b[_0x3344('0x47')],'createdAt':_0x5e730b[_0x3344('0x4b')],'updatedAt':_0x5e730b[_0x3344('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3344('0x13')](respondWithFilteredResult(_0x47e744,_0x171c18))[_0x3344('0x22')](handleError(_0x47e744,null));};exports[_0x3344('0x4d')]=function(_0x12ed59,_0x13fe30){var _0xbb5c54={};var _0x4cafe2={};var _0x10c316;var _0x52f092;return db[_0x3344('0x1b')][_0x3344('0x3a')]({'where':{'id':_0x12ed59['params']['id']}})[_0x3344('0x13')](handleEntityNotFound(_0x13fe30,null))[_0x3344('0x13')](function(_0x667468){if(_0x667468){_0x10c316=_0x667468;_0x4cafe2['model']=_[_0x3344('0x26')](db[_0x3344('0x4e')][_0x3344('0x27')]);_0x4cafe2[_0x3344('0x1f')]=_[_0x3344('0x26')](_0x12ed59[_0x3344('0x1f')]);_0x4cafe2[_0x3344('0x3c')]=_['intersection'](_0x4cafe2['model'],_0x4cafe2['query']);_0xbb5c54['attributes']=_[_0x3344('0x28')](_0x4cafe2[_0x3344('0x25')],qs[_0x3344('0x2a')](_0x12ed59[_0x3344('0x1f')][_0x3344('0x2a')]));_0xbb5c54[_0x3344('0x29')]=_0xbb5c54[_0x3344('0x29')][_0x3344('0x2b')]?_0xbb5c54[_0x3344('0x29')]:_0x4cafe2['model'];_0xbb5c54['order']=qs[_0x3344('0x40')](_0x12ed59[_0x3344('0x1f')][_0x3344('0x40')]);_0xbb5c54['where']=qs[_0x3344('0x3c')](_[_0x3344('0x42')](_0x12ed59[_0x3344('0x1f')],_0x4cafe2[_0x3344('0x3c')]));if(_0x12ed59[_0x3344('0x1f')][_0x3344('0x44')]){_0xbb5c54[_0x3344('0x41')]=_[_0x3344('0x2d')](_0xbb5c54[_0x3344('0x41')],{'$or':_[_0x3344('0x43')](_0xbb5c54[_0x3344('0x29')],function(_0x1f1094){var _0x16b842={};_0x16b842[_0x1f1094]={'$like':'%'+_0x12ed59['query'][_0x3344('0x44')]+'%'};return _0x16b842;})});}_0xbb5c54=_[_0x3344('0x2d')]({},_0xbb5c54,_0x12ed59[_0x3344('0x2e')]);return _0x10c316['getTeams'](_0xbb5c54);}})[_0x3344('0x13')](function(_0x311d34){if(_0x311d34){_0x52f092=_0x311d34['length'];if(!_0x12ed59[_0x3344('0x1f')][_0x3344('0x3d')](_0x3344('0x4f'))){_0xbb5c54[_0x3344('0xf')]=qs[_0x3344('0xf')](_0x12ed59[_0x3344('0x1f')][_0x3344('0xf')]);_0xbb5c54['offset']=qs[_0x3344('0x3e')](_0x12ed59[_0x3344('0x1f')]['offset']);}return _0x10c316[_0x3344('0x4d')](_0xbb5c54);}})[_0x3344('0x13')](function(_0xc4466c){if(_0xc4466c){return _0xc4466c?{'count':_0x52f092,'rows':_0xc4466c}:null;}})['then'](respondWithResult(_0x13fe30,null))[_0x3344('0x22')](handleError(_0x13fe30,null));};exports[_0x3344('0x50')]=function(_0x5679b8,_0x926f8b){var _0x241fd4=_0x5679b8['body'][_0x3344('0x51')];return db[_0x3344('0x4e')][_0x3344('0x20')]({'where':{'id':_0x241fd4},'attributes':['id'],'include':[{'model':db[_0x3344('0x45')],'as':_0x3344('0x52'),'attributes':['id','name','online',_0x3344('0x53'),'interface'],'raw':!![]}]})[_0x3344('0x13')](function(_0x5a3a40){if(_0x5a3a40){var _0x4d363c=_[_0x3344('0x54')](_0x5a3a40,function(_0x215f94){var _0x3302ee=_0x215f94[_0x3344('0x32')]({'plain':!![]});return _0x3302ee[_0x3344('0x52')];});return db[_0x3344('0x1b')][_0x3344('0x2f')]({'where':{'id':_0x5679b8[_0x3344('0x24')]['id']}})[_0x3344('0x13')](function(_0x2f211b){return db[_0x3344('0x55')][_0x3344('0x56')](function(_0x2e268a){return _0x2f211b[_0x3344('0x50')](_0x241fd4,{'transaction':_0x2e268a})['then'](function(){return BPromise[_0x3344('0x57')](_0x4d363c,function(_0x24b25e){return db[_0x3344('0x3b')][_0x3344('0x58')]({'where':{'UserId':_0x24b25e['id'],'ChatQueueId':_0x5679b8[_0x3344('0x24')]['id']},'transaction':_0x2e268a});});})['then'](function(){_0x4d363c[_0x3344('0x59')](function(_0x199645){socket[_0x3344('0x5a')](_0x3344('0x5b'),{'UserId':_0x199645['id'],'ChatQueueId':_0x2f211b['id']});});});});});}})['then'](respondWithStatusCode(_0x926f8b,null))[_0x3344('0x22')](handleError(_0x926f8b,null));};exports[_0x3344('0x5c')]=function(_0xbfda64,_0x557ea8){return db['Team'][_0x3344('0x20')]({'where':{'id':_0xbfda64['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3344('0x52'),'attributes':['id'],'raw':!![]}]})[_0x3344('0x13')](handleEntityNotFound(_0x557ea8,null))[_0x3344('0x13')](function(_0x3892e9){var _0x290faa=_[_0x3344('0x43')](_0x3892e9,'id');var _0x18cad3=[];var _0x23d7d8=[];var _0x33083b=squel['select']();_0x33083b['field'](_0x3344('0x5d'))['from']('team_has_chat_queues','tq')[_0x3344('0x5e')](_0x3344('0x5f'),'ut',_0x3344('0x60'))['where'](_0x3344('0x61'),_0xbfda64[_0x3344('0x24')]['id']);for(var _0x22f8d4=0x0;_0x22f8d4<_0x3892e9['length'];_0x22f8d4+=0x1){let _0x2a6540=_0x3892e9[_0x22f8d4];for(var _0x33ce18=0x0;_0x33ce18<_0x2a6540[_0x3344('0x52')][_0x3344('0x2b')];_0x33ce18+=0x1){let _0x83fc04=_0x2a6540[_0x3344('0x52')][_0x33ce18];var _0x40a829=_0x33083b[_0x3344('0x62')]();_0x40a829[_0x3344('0x41')]('ut.UserId\x20=\x20?',_0x83fc04['id']);_0x23d7d8['push'](db['sequelize'][_0x3344('0x1f')](_0x40a829['toString'](),{'type':db['sequelize'][_0x3344('0x63')][_0x3344('0x64')]})[_0x3344('0x13')](function(_0x5ab369){if(_0x5ab369[_0x3344('0x2b')]===0x1){return _0x83fc04['id'];}else{var _0xf29c11=_[_0x3344('0x65')](_[_0x3344('0x43')](_0x5ab369,_0x3344('0x66')),function(_0x17c227){return _[_0x3344('0x67')](_0x290faa,_0x17c227);});if(_0xf29c11){return _0x83fc04['id'];}}}));}}return BPromise[_0x3344('0x68')](_0x23d7d8)['then'](function(_0x198bc2){_0x18cad3=_(_0x18cad3)['union'](_0x198bc2)['compact']()['value']();return db[_0x3344('0x1b')][_0x3344('0x2f')]({'where':{'id':_0xbfda64[_0x3344('0x24')]['id']}})[_0x3344('0x13')](function(_0x41f087){return db['sequelize']['transaction'](function(_0x2c68b2){return _0x41f087[_0x3344('0x5c')](_0xbfda64[_0x3344('0x1f')]['ids'],{'transaction':_0x2c68b2})['then'](function(){if(!_[_0x3344('0x69')](_0x18cad3)){return _0x41f087[_0x3344('0x6a')](_0x18cad3,{'transaction':_0x2c68b2});}})[_0x3344('0x13')](function(){_0x18cad3[_0x3344('0x59')](function(_0x42a344){socket[_0x3344('0x5a')](_0x3344('0x6b'),{'UserId':_0x42a344,'ChatQueueId':_0x41f087['id']});});});});});});})[_0x3344('0x13')](respondWithStatusCode(_0x557ea8,null))[_0x3344('0x22')](handleError(_0x557ea8,null));};exports['addAgents']=function(_0x18e9bf,_0x744478){return db[_0x3344('0x1b')]['find']({'where':{'id':_0x18e9bf[_0x3344('0x24')]['id']}})[_0x3344('0x13')](handleEntityNotFound(_0x744478,null))[_0x3344('0x13')](function(_0x3ba6fb){if(_0x3ba6fb){return _0x3ba6fb['addAgents'](_0x18e9bf[_0x3344('0x31')]['ids'],_[_0x3344('0x6c')](_0x18e9bf[_0x3344('0x31')],[_0x3344('0x51'),'id'])||{})[_0x3344('0x6d')](function(_0x2b4da2){for(var _0x3ea322=0x0;_0x3ea322<_0x18e9bf['body']['ids'][_0x3344('0x2b')];_0x3ea322+=0x1){socket['emit'](_0x3344('0x5b'),{'UserId':Number(_0x18e9bf[_0x3344('0x31')]['ids'][_0x3ea322]),'ChatQueueId':Number(_0x18e9bf[_0x3344('0x24')]['id'])});}return _0x2b4da2;});}})[_0x3344('0x13')](respondWithResult(_0x744478,null))[_0x3344('0x22')](handleError(_0x744478,null));};exports['removeAgents']=function(_0x3a1426,_0xda02fe){return db[_0x3344('0x1b')][_0x3344('0x2f')]({'where':{'id':_0x3a1426[_0x3344('0x24')]['id']}})[_0x3344('0x13')](handleEntityNotFound(_0xda02fe,null))[_0x3344('0x13')](function(_0x1d1226){if(_0x1d1226){return _0x1d1226[_0x3344('0x6a')](_0x3a1426[_0x3344('0x1f')]['ids'])[_0x3344('0x13')](function(){if(_[_0x3344('0x6e')](_0x3a1426['query'][_0x3344('0x51')])){for(var _0x1b181c=0x0;_0x1b181c<_0x3a1426[_0x3344('0x1f')]['ids'][_0x3344('0x2b')];_0x1b181c+=0x1){socket[_0x3344('0x5a')](_0x3344('0x6b'),{'UserId':Number(_0x3a1426[_0x3344('0x1f')][_0x3344('0x51')][_0x1b181c]),'ChatQueueId':Number(_0x3a1426[_0x3344('0x24')]['id'])});}}else{socket[_0x3344('0x5a')](_0x3344('0x6b'),{'UserId':Number(_0x3a1426[_0x3344('0x1f')]['ids']),'ChatQueueId':Number(_0x3a1426[_0x3344('0x24')]['id'])});}});}})[_0x3344('0x13')](respondWithStatusCode(_0xda02fe,null))[_0x3344('0x22')](handleError(_0xda02fe,null));};exports[_0x3344('0x6f')]=function(_0x4af34f,_0x5efa00){var _0x162ead={};var _0xacc607={};var _0x5fab5d;var _0x1058a5;return db['ChatQueue'][_0x3344('0x3a')]({'where':{'id':_0x4af34f[_0x3344('0x24')]['id']}})['then'](handleEntityNotFound(_0x5efa00,null))[_0x3344('0x13')](function(_0x1fe196){if(_0x1fe196){_0x5fab5d=_0x1fe196;_0xacc607['model']=_[_0x3344('0x26')](db['User'][_0x3344('0x27')]);_0xacc607['query']=_[_0x3344('0x26')](_0x4af34f[_0x3344('0x1f')]);_0xacc607[_0x3344('0x3c')]=_[_0x3344('0x28')](_0xacc607['model'],_0xacc607['query']);_0x162ead['attributes']=_[_0x3344('0x28')](_0xacc607[_0x3344('0x25')],qs['fields'](_0x4af34f[_0x3344('0x1f')][_0x3344('0x2a')]));_0x162ead[_0x3344('0x29')]=_0x162ead[_0x3344('0x29')][_0x3344('0x2b')]?_0x162ead[_0x3344('0x29')]:_0xacc607[_0x3344('0x25')];_0x162ead[_0x3344('0x3f')]=qs[_0x3344('0x40')](_0x4af34f[_0x3344('0x1f')]['sort']);_0x162ead[_0x3344('0x41')]=qs[_0x3344('0x3c')](_['pick'](_0x4af34f[_0x3344('0x1f')],_0xacc607[_0x3344('0x3c')]));if(_0x4af34f[_0x3344('0x1f')]['filter']){_0x162ead[_0x3344('0x41')]=_[_0x3344('0x2d')](_0x162ead[_0x3344('0x41')],{'$or':_[_0x3344('0x43')](_0x162ead[_0x3344('0x29')],function(_0x377e73){var _0x1135a3={};_0x1135a3[_0x377e73]={'$like':'%'+_0x4af34f[_0x3344('0x1f')][_0x3344('0x44')]+'%'};return _0x1135a3;})});}_0x162ead=_[_0x3344('0x2d')]({},_0x162ead,_0x4af34f[_0x3344('0x2e')]);return _0x5fab5d[_0x3344('0x6f')](_0x162ead);}})[_0x3344('0x13')](function(_0x294a98){if(_0x294a98){_0x1058a5=_0x294a98[_0x3344('0x2b')];if(!_0x4af34f[_0x3344('0x1f')][_0x3344('0x3d')](_0x3344('0x4f'))){_0x162ead[_0x3344('0xf')]=qs[_0x3344('0xf')](_0x4af34f[_0x3344('0x1f')][_0x3344('0xf')]);_0x162ead[_0x3344('0x3e')]=qs[_0x3344('0x3e')](_0x4af34f[_0x3344('0x1f')][_0x3344('0x3e')]);}return _0x5fab5d[_0x3344('0x6f')](_0x162ead);}})[_0x3344('0x13')](function(_0x3221a0){if(_0x3221a0){return _0x3221a0?{'count':_0x1058a5,'rows':_0x3221a0}:null;}})[_0x3344('0x13')](respondWithResult(_0x5efa00,null))[_0x3344('0x22')](handleError(_0x5efa00,null));}; \ No newline at end of file +var _0x17ad=['hasOwnProperty','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','userChatQueue:save','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','include','findAll','catch','show','params','model','keys','query','filters','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','getMembers','UserChatQueue','intersection','nolimit','order','sort','where','pick','ChatQueueId','filter','User','UserId','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams'];(function(_0x32359e,_0x493d21){var _0x2a6741=function(_0x145004){while(--_0x145004){_0x32359e['push'](_0x32359e['shift']());}};_0x2a6741(++_0x493d21);}(_0x17ad,0xa1));var _0xd17a=function(_0xdbbc03,_0x5170df){_0xdbbc03=_0xdbbc03-0x0;var _0x2e573d=_0x17ad[_0xdbbc03];return _0x2e573d;};'use strict';var BPromise=require(_0xd17a('0x0'));var util=require(_0xd17a('0x1'));var _=require('lodash');var squel=require(_0xd17a('0x2'));var Redis=require(_0xd17a('0x3'));var qs=require(_0xd17a('0x4'));var logger=require(_0xd17a('0x5'))(_0xd17a('0x6'));var config=require(_0xd17a('0x7'));var db=require('../../mysqldb')['db'];config[_0xd17a('0x8')]=_[_0xd17a('0x9')](config[_0xd17a('0x8')],{'host':_0xd17a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd17a('0x8')]));require(_0xd17a('0xb'))[_0xd17a('0xc')](socket);function respondWithStatusCode(_0x1766c5,_0xe78234){_0xe78234=_0xe78234||0xcc;return function(_0x1e7a29){if(_0x1e7a29){return _0x1766c5[_0xd17a('0xd')](_0xe78234);}return _0x1766c5[_0xd17a('0xe')](_0xe78234)[_0xd17a('0xf')]();};}function respondWithResult(_0x2d3902,_0xaa0053){_0xaa0053=_0xaa0053||0xc8;return function(_0x4b57d6){if(_0x4b57d6){return _0x2d3902['status'](_0xaa0053)[_0xd17a('0x10')](_0x4b57d6);}};}function respondWithFilteredResult(_0x2fe2a7,_0x463bec){return function(_0x35e31c){if(_0x35e31c){var _0x1f669e=typeof _0x463bec['offset']===_0xd17a('0x11')&&typeof _0x463bec['limit']===_0xd17a('0x11');var _0x1d1551=_0x35e31c['count'];var _0x250cbd=_0x1f669e?0x0:_0x463bec[_0xd17a('0x12')];var _0x56503=_0x1f669e?_0x35e31c[_0xd17a('0x13')]:_0x463bec[_0xd17a('0x12')]+_0x463bec[_0xd17a('0x14')];var _0xe5795f;if(_0x56503>=_0x1d1551){_0x56503=_0x1d1551;_0xe5795f=0xc8;}else{_0xe5795f=0xce;}_0x2fe2a7['status'](_0xe5795f);return _0x2fe2a7[_0xd17a('0x15')](_0xd17a('0x16'),_0x250cbd+'-'+_0x56503+'/'+_0x1d1551)[_0xd17a('0x10')](_0x35e31c);}return null;};}function saveUpdates(_0x4bf9fc){return function(_0xab838e){if(_0xab838e){return _0xab838e[_0xd17a('0x17')](_0x4bf9fc)[_0xd17a('0x18')](function(_0x53571d){return _0x53571d;});}return null;};}function removeEntity(_0x479c12){return function(_0xb2aa76){if(_0xb2aa76){return _0xb2aa76[_0xd17a('0x19')]()[_0xd17a('0x18')](function(){var _0x49fd10=_0xb2aa76[_0xd17a('0x1a')]({'plain':!![]});var _0xff9e23=_0xd17a('0x1b');return db[_0xd17a('0x1c')][_0xd17a('0x19')]({'where':{'type':_0xff9e23,'resourceId':_0x49fd10['id']}})[_0xd17a('0x18')](function(){return _0xb2aa76;});})[_0xd17a('0x18')](function(){_0x479c12[_0xd17a('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27fa2b){return function(_0x3e0f65){if(!_0x3e0f65){_0x27fa2b[_0xd17a('0xd')](0x194);}return _0x3e0f65;};}function handleError(_0x1cd0ba,_0x37d9e5){_0x37d9e5=_0x37d9e5||0x1f4;return function(_0x66919e){logger[_0xd17a('0x1d')](_0x66919e[_0xd17a('0x1e')]);if(_0x66919e[_0xd17a('0x1f')]){delete _0x66919e['name'];}_0x1cd0ba[_0xd17a('0xe')](_0x37d9e5)[_0xd17a('0x20')](_0x66919e);};}exports[_0xd17a('0x21')]=function(_0x5af9e2,_0x4f48ce){var _0x1187f8={};var _0xb8c5b8={'count':0x0,'rows':[]};var _0x280e61=_[_0xd17a('0x22')](db[_0xd17a('0x23')][_0xd17a('0x24')],function(_0x5afb0f){return{'name':_0x5afb0f[_0xd17a('0x25')],'type':_0x5afb0f[_0xd17a('0x26')][_0xd17a('0x27')]};});_0x1187f8=qs['getOptions'](_0x280e61,_0x5af9e2);var _0x21b98e={'where':_0x1187f8['where']};return db[_0xd17a('0x23')]['count'](_0x21b98e)[_0xd17a('0x18')](function(_0x33b36f){_0xb8c5b8[_0xd17a('0x13')]=_0x33b36f;_0x1187f8[_0xd17a('0x28')]=qs[_0xd17a('0x28')](_0x5af9e2['query']);return db[_0xd17a('0x23')][_0xd17a('0x29')](_0x1187f8);})[_0xd17a('0x18')](function(_0x2d9859){_0xb8c5b8['rows']=_0x2d9859;return _0xb8c5b8;})[_0xd17a('0x18')](respondWithFilteredResult(_0x4f48ce,_0x1187f8))[_0xd17a('0x2a')](handleError(_0x4f48ce,null));};exports[_0xd17a('0x2b')]=function(_0x1ec7d3,_0x3e2b5){var _0x2daaba={'raw':!![],'where':{'id':_0x1ec7d3[_0xd17a('0x2c')]['id']}},_0x50b6b1={};_0x50b6b1[_0xd17a('0x2d')]=_[_0xd17a('0x2e')](db[_0xd17a('0x23')][_0xd17a('0x24')]);_0x50b6b1['query']=_[_0xd17a('0x2e')](_0x1ec7d3[_0xd17a('0x2f')]);_0x50b6b1[_0xd17a('0x30')]=_['intersection'](_0x50b6b1[_0xd17a('0x2d')],_0x50b6b1[_0xd17a('0x2f')]);_0x2daaba[_0xd17a('0x31')]=_['intersection'](_0x50b6b1['model'],qs[_0xd17a('0x32')](_0x1ec7d3[_0xd17a('0x2f')][_0xd17a('0x32')]));_0x2daaba[_0xd17a('0x31')]=_0x2daaba[_0xd17a('0x31')][_0xd17a('0x33')]?_0x2daaba['attributes']:_0x50b6b1[_0xd17a('0x2d')];if(_0x1ec7d3[_0xd17a('0x2f')][_0xd17a('0x34')]){_0x2daaba[_0xd17a('0x28')]=[{'all':!![]}];}_0x2daaba=_[_0xd17a('0x35')]({},_0x2daaba,_0x1ec7d3[_0xd17a('0x36')]);return db['ChatQueue'][_0xd17a('0x37')](_0x2daaba)[_0xd17a('0x18')](handleEntityNotFound(_0x3e2b5,null))[_0xd17a('0x18')](respondWithResult(_0x3e2b5,null))[_0xd17a('0x2a')](handleError(_0x3e2b5,null));};exports[_0xd17a('0x38')]=function(_0x597ca8,_0x1eb2e4){return db[_0xd17a('0x23')][_0xd17a('0x38')](_0x597ca8[_0xd17a('0x39')],{})[_0xd17a('0x18')](function(_0x4b7839){var _0x1ee0e7=_0x597ca8['user'][_0xd17a('0x1a')]({'plain':!![]});if(!_0x1ee0e7)throw new Error(_0xd17a('0x3a'));if(_0x1ee0e7[_0xd17a('0x3b')]===_0xd17a('0x3c')){var _0x178cd2=_0x4b7839[_0xd17a('0x1a')]({'plain':!![]});var _0x583ab5=_0xd17a('0x1b');return db['UserProfileSection']['find']({'where':{'name':_0x583ab5,'userProfileId':_0x1ee0e7[_0xd17a('0x3d')]},'raw':!![]})[_0xd17a('0x18')](function(_0x9cd795){if(_0x9cd795&&_0x9cd795[_0xd17a('0x3e')]===0x0){return db[_0xd17a('0x1c')][_0xd17a('0x38')]({'name':_0x178cd2['name'],'resourceId':_0x178cd2['id'],'type':_0x9cd795[_0xd17a('0x1f')],'sectionId':_0x9cd795['id']},{})[_0xd17a('0x18')](function(){return _0x4b7839;});}else{return _0x4b7839;}})['catch'](function(_0x3221b2){logger[_0xd17a('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3221b2);throw _0x3221b2;});}return _0x4b7839;})['then'](respondWithResult(_0x1eb2e4,0xc9))['catch'](handleError(_0x1eb2e4,null));};exports[_0xd17a('0x17')]=function(_0x41977c,_0x494821){if(_0x41977c['body']['id']){delete _0x41977c[_0xd17a('0x39')]['id'];}return db[_0xd17a('0x23')][_0xd17a('0x37')]({'where':{'id':_0x41977c[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x494821,null))[_0xd17a('0x18')](saveUpdates(_0x41977c[_0xd17a('0x39')],null))[_0xd17a('0x18')](respondWithResult(_0x494821,null))[_0xd17a('0x2a')](handleError(_0x494821,null));};exports[_0xd17a('0x19')]=function(_0x2abf7b,_0x32cc01){return db['ChatQueue'][_0xd17a('0x37')]({'where':{'id':_0x2abf7b[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x32cc01,null))[_0xd17a('0x18')](removeEntity(_0x32cc01,null))[_0xd17a('0x2a')](handleError(_0x32cc01,null));};exports['describe']=function(_0x47860f,_0x38427d){return db[_0xd17a('0x23')]['describe']()[_0xd17a('0x18')](respondWithResult(_0x38427d,null))[_0xd17a('0x2a')](handleError(_0x38427d,null));};exports[_0xd17a('0x3f')]=function(_0x941f5c,_0x56167f){var _0x22f7fd={'raw':!![],'where':{}},_0x354597={},_0x20e293;return db['ChatQueue']['findOne']({'where':{'id':_0x941f5c[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x56167f,null))[_0xd17a('0x18')](function(_0x172d57){if(_0x172d57){_0x20e293=_0x172d57[_0xd17a('0x1a')]({'plain':!![]});_0x354597[_0xd17a('0x2d')]=_[_0xd17a('0x2e')](db[_0xd17a('0x40')][_0xd17a('0x24')]);_0x354597[_0xd17a('0x2f')]=_[_0xd17a('0x2e')](_0x941f5c[_0xd17a('0x2f')]);_0x354597[_0xd17a('0x30')]=_[_0xd17a('0x41')](_0x354597[_0xd17a('0x2d')],_0x354597[_0xd17a('0x2f')]);_0x22f7fd['attributes']=_[_0xd17a('0x41')](_0x354597[_0xd17a('0x2d')],qs[_0xd17a('0x32')](_0x941f5c['query']['fields']));_0x22f7fd[_0xd17a('0x31')]=_0x22f7fd[_0xd17a('0x31')][_0xd17a('0x33')]?_0x22f7fd['attributes']:_0x354597[_0xd17a('0x2d')];if(!_0x941f5c[_0xd17a('0x2f')]['hasOwnProperty'](_0xd17a('0x42'))){_0x22f7fd[_0xd17a('0x14')]=qs[_0xd17a('0x14')](_0x941f5c['query'][_0xd17a('0x14')]);_0x22f7fd[_0xd17a('0x12')]=qs[_0xd17a('0x12')](_0x941f5c['query'][_0xd17a('0x12')]);}_0x22f7fd[_0xd17a('0x43')]=qs[_0xd17a('0x44')](_0x941f5c['query'][_0xd17a('0x44')]);_0x22f7fd[_0xd17a('0x45')]=qs[_0xd17a('0x30')](_[_0xd17a('0x46')](_0x941f5c['query'],_0x354597['filters']));_0x22f7fd[_0xd17a('0x45')][_0xd17a('0x47')]=_0x172d57['id'];if(_0x941f5c[_0xd17a('0x2f')]['filter']){_0x22f7fd[_0xd17a('0x45')]=_[_0xd17a('0x35')](_0x22f7fd[_0xd17a('0x45')],{'$or':_[_0xd17a('0x22')](_0x22f7fd['attributes'],function(_0x393340){var _0x28314e={};_0x28314e[_0x393340]={'$like':'%'+_0x941f5c[_0xd17a('0x2f')][_0xd17a('0x48')]+'%'};return _0x28314e;})});}_0x22f7fd=_[_0xd17a('0x35')]({},_0x22f7fd,_0x941f5c['options']);return db['UserChatQueue'][_0xd17a('0x29')](_0x22f7fd);}})['then'](function(_0x477d3e){if(_0x477d3e){return db[_0xd17a('0x49')]['findAndCountAll']({'where':{'id':_[_0xd17a('0x22')](_0x477d3e,_0xd17a('0x4a')),'role':'agent'},'attributes':['id','name',_0xd17a('0x4b'),_0xd17a('0x4c'),_0xd17a('0x4d')]});}})[_0xd17a('0x18')](function(_0x3da51a){if(_0x3da51a){return{'count':_0x3da51a['count'],'rows':_[_0xd17a('0x22')](_0x3da51a[_0xd17a('0x4e')],function(_0x543609){return{'membername':_0x543609[_0xd17a('0x1f')],'UserId':_0x543609['id'],'queue_name':_0x20e293[_0xd17a('0x1f')],'ChatQueueId':_0x20e293['id'],'interface':util[_0xd17a('0x4f')](_0xd17a('0x50'),_0xd17a('0x51'),_0x543609[_0xd17a('0x1f')]),'penalty':0x0,'paused':_0x543609[_0xd17a('0x4b')],'createdAt':_0x543609[_0xd17a('0x4d')],'updatedAt':_0x543609[_0xd17a('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd17a('0x18')](respondWithFilteredResult(_0x56167f,_0x22f7fd))[_0xd17a('0x2a')](handleError(_0x56167f,null));};exports[_0xd17a('0x52')]=function(_0x5623b0,_0x43756a){var _0x8fce54={};var _0x3582a6={};var _0x1cda37;var _0x2cfe19;return db[_0xd17a('0x23')]['findOne']({'where':{'id':_0x5623b0[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x43756a,null))[_0xd17a('0x18')](function(_0x3e568e){if(_0x3e568e){_0x1cda37=_0x3e568e;_0x3582a6[_0xd17a('0x2d')]=_['keys'](db['Team'][_0xd17a('0x24')]);_0x3582a6['query']=_['keys'](_0x5623b0['query']);_0x3582a6['filters']=_[_0xd17a('0x41')](_0x3582a6[_0xd17a('0x2d')],_0x3582a6[_0xd17a('0x2f')]);_0x8fce54[_0xd17a('0x31')]=_[_0xd17a('0x41')](_0x3582a6[_0xd17a('0x2d')],qs[_0xd17a('0x32')](_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x32')]));_0x8fce54[_0xd17a('0x31')]=_0x8fce54['attributes'][_0xd17a('0x33')]?_0x8fce54[_0xd17a('0x31')]:_0x3582a6[_0xd17a('0x2d')];_0x8fce54[_0xd17a('0x43')]=qs[_0xd17a('0x44')](_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x44')]);_0x8fce54['where']=qs[_0xd17a('0x30')](_['pick'](_0x5623b0[_0xd17a('0x2f')],_0x3582a6[_0xd17a('0x30')]));if(_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x48')]){_0x8fce54[_0xd17a('0x45')]=_[_0xd17a('0x35')](_0x8fce54[_0xd17a('0x45')],{'$or':_[_0xd17a('0x22')](_0x8fce54[_0xd17a('0x31')],function(_0x3f1b04){var _0xe7847c={};_0xe7847c[_0x3f1b04]={'$like':'%'+_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x48')]+'%'};return _0xe7847c;})});}_0x8fce54=_[_0xd17a('0x35')]({},_0x8fce54,_0x5623b0[_0xd17a('0x36')]);return _0x1cda37[_0xd17a('0x52')](_0x8fce54);}})['then'](function(_0x3f422d){if(_0x3f422d){_0x2cfe19=_0x3f422d[_0xd17a('0x33')];if(!_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x53')](_0xd17a('0x42'))){_0x8fce54['limit']=qs[_0xd17a('0x14')](_0x5623b0[_0xd17a('0x2f')][_0xd17a('0x14')]);_0x8fce54[_0xd17a('0x12')]=qs[_0xd17a('0x12')](_0x5623b0[_0xd17a('0x2f')]['offset']);}return _0x1cda37['getTeams'](_0x8fce54);}})[_0xd17a('0x18')](function(_0x1727fb){if(_0x1727fb){return _0x1727fb?{'count':_0x2cfe19,'rows':_0x1727fb}:null;}})['then'](respondWithResult(_0x43756a,null))[_0xd17a('0x2a')](handleError(_0x43756a,null));};exports[_0xd17a('0x54')]=function(_0x3b7bd2,_0x49aae6){var _0x56510d=_0x3b7bd2['body'][_0xd17a('0x55')];return db[_0xd17a('0x56')][_0xd17a('0x29')]({'where':{'id':_0x56510d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd17a('0x1f'),_0xd17a('0x57'),_0xd17a('0x58'),_0xd17a('0x59')],'raw':!![]}]})[_0xd17a('0x18')](function(_0xcaaffd){if(_0xcaaffd){var _0x4a4dd5=_[_0xd17a('0x5a')](_0xcaaffd,function(_0x1a78ef){var _0x2c5d59=_0x1a78ef[_0xd17a('0x1a')]({'plain':!![]});return _0x2c5d59[_0xd17a('0x5b')];});return db['ChatQueue'][_0xd17a('0x37')]({'where':{'id':_0x3b7bd2[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](function(_0xa6a89a){return db[_0xd17a('0x5c')][_0xd17a('0x5d')](function(_0x1177ea){return _0xa6a89a['addTeams'](_0x56510d,{'transaction':_0x1177ea})[_0xd17a('0x18')](function(){return BPromise['each'](_0x4a4dd5,function(_0x4115df){return db[_0xd17a('0x40')][_0xd17a('0x5e')]({'where':{'UserId':_0x4115df['id'],'ChatQueueId':_0x3b7bd2[_0xd17a('0x2c')]['id']},'transaction':_0x1177ea});});})[_0xd17a('0x18')](function(){_0x4a4dd5['forEach'](function(_0x4b65b2){socket['emit']('userChatQueue:save',{'UserId':_0x4b65b2['id'],'ChatQueueId':_0xa6a89a['id']});});});});});}})[_0xd17a('0x18')](respondWithStatusCode(_0x49aae6,null))['catch'](handleError(_0x49aae6,null));};exports['removeTeams']=function(_0xbd6340,_0x427b36){return db['Team'][_0xd17a('0x29')]({'where':{'id':_0xbd6340[_0xd17a('0x2f')][_0xd17a('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd17a('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xd17a('0x18')](handleEntityNotFound(_0x427b36,null))[_0xd17a('0x18')](function(_0x1f6e26){var _0x20aff3=_[_0xd17a('0x22')](_0x1f6e26,'id');var _0x3ee88d=[];var _0x547104=[];var _0x2523a7=squel[_0xd17a('0x5f')]();_0x2523a7[_0xd17a('0x60')]('tq.TeamId')[_0xd17a('0x61')](_0xd17a('0x62'),'tq')[_0xd17a('0x63')](_0xd17a('0x64'),'ut',_0xd17a('0x65'))[_0xd17a('0x45')](_0xd17a('0x66'),_0xbd6340[_0xd17a('0x2c')]['id']);for(var _0x4587a8=0x0;_0x4587a8<_0x1f6e26['length'];_0x4587a8+=0x1){let _0x15e602=_0x1f6e26[_0x4587a8];for(var _0x16a16a=0x0;_0x16a16a<_0x15e602[_0xd17a('0x5b')][_0xd17a('0x33')];_0x16a16a+=0x1){let _0x3e6ae9=_0x15e602[_0xd17a('0x5b')][_0x16a16a];var _0x5e0eef=_0x2523a7[_0xd17a('0x67')]();_0x5e0eef[_0xd17a('0x45')](_0xd17a('0x68'),_0x3e6ae9['id']);_0x547104['push'](db['sequelize']['query'](_0x5e0eef['toString'](),{'type':db[_0xd17a('0x5c')][_0xd17a('0x69')][_0xd17a('0x6a')]})[_0xd17a('0x18')](function(_0x5ada51){if(_0x5ada51[_0xd17a('0x33')]===0x1){return _0x3e6ae9['id'];}else{var _0x298452=_[_0xd17a('0x6b')](_[_0xd17a('0x22')](_0x5ada51,_0xd17a('0x6c')),function(_0x4c4c63){return _['includes'](_0x20aff3,_0x4c4c63);});if(_0x298452){return _0x3e6ae9['id'];}}}));}}return BPromise[_0xd17a('0x6d')](_0x547104)[_0xd17a('0x18')](function(_0x1027ff){_0x3ee88d=_(_0x3ee88d)['union'](_0x1027ff)[_0xd17a('0x6e')]()[_0xd17a('0x6f')]();return db['ChatQueue'][_0xd17a('0x37')]({'where':{'id':_0xbd6340[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](function(_0x56e20d){return db['sequelize'][_0xd17a('0x5d')](function(_0x509cd6){return _0x56e20d[_0xd17a('0x70')](_0xbd6340[_0xd17a('0x2f')][_0xd17a('0x55')],{'transaction':_0x509cd6})[_0xd17a('0x18')](function(){if(!_[_0xd17a('0x71')](_0x3ee88d)){return _0x56e20d[_0xd17a('0x72')](_0x3ee88d,{'transaction':_0x509cd6});}})[_0xd17a('0x18')](function(){_0x3ee88d[_0xd17a('0x73')](function(_0x36a6ac){socket[_0xd17a('0x74')](_0xd17a('0x75'),{'UserId':_0x36a6ac,'ChatQueueId':_0x56e20d['id']});});});});});});})[_0xd17a('0x18')](respondWithStatusCode(_0x427b36,null))[_0xd17a('0x2a')](handleError(_0x427b36,null));};exports[_0xd17a('0x76')]=function(_0x4d1081,_0x23909a){return db[_0xd17a('0x23')]['find']({'where':{'id':_0x4d1081['params']['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x23909a,null))[_0xd17a('0x18')](function(_0x3006eb){if(_0x3006eb){return _0x3006eb[_0xd17a('0x76')](_0x4d1081[_0xd17a('0x39')][_0xd17a('0x55')],_[_0xd17a('0x77')](_0x4d1081[_0xd17a('0x39')],[_0xd17a('0x55'),'id'])||{})['spread'](function(_0x33883d){for(var _0x439105=0x0;_0x439105<_0x4d1081[_0xd17a('0x39')][_0xd17a('0x55')][_0xd17a('0x33')];_0x439105+=0x1){socket[_0xd17a('0x74')](_0xd17a('0x78'),{'UserId':Number(_0x4d1081['body'][_0xd17a('0x55')][_0x439105]),'ChatQueueId':Number(_0x4d1081[_0xd17a('0x2c')]['id'])});}return _0x33883d;});}})['then'](respondWithResult(_0x23909a,null))[_0xd17a('0x2a')](handleError(_0x23909a,null));};exports[_0xd17a('0x72')]=function(_0x25e17c,_0x3366af){return db[_0xd17a('0x23')][_0xd17a('0x37')]({'where':{'id':_0x25e17c[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0x3366af,null))['then'](function(_0x295b1d){if(_0x295b1d){return _0x295b1d[_0xd17a('0x72')](_0x25e17c[_0xd17a('0x2f')][_0xd17a('0x55')])['then'](function(){if(_['isArray'](_0x25e17c[_0xd17a('0x2f')][_0xd17a('0x55')])){for(var _0x1107f8=0x0;_0x1107f8<_0x25e17c['query'][_0xd17a('0x55')][_0xd17a('0x33')];_0x1107f8+=0x1){socket[_0xd17a('0x74')](_0xd17a('0x75'),{'UserId':Number(_0x25e17c[_0xd17a('0x2f')]['ids'][_0x1107f8]),'ChatQueueId':Number(_0x25e17c['params']['id'])});}}else{socket[_0xd17a('0x74')](_0xd17a('0x75'),{'UserId':Number(_0x25e17c[_0xd17a('0x2f')]['ids']),'ChatQueueId':Number(_0x25e17c[_0xd17a('0x2c')]['id'])});}});}})[_0xd17a('0x18')](respondWithStatusCode(_0x3366af,null))[_0xd17a('0x2a')](handleError(_0x3366af,null));};exports[_0xd17a('0x79')]=function(_0x5b6f21,_0xc3312f){var _0x3d106d={};var _0x22ed26={};var _0x6dd81e;var _0x8a1ae7;return db[_0xd17a('0x23')]['findOne']({'where':{'id':_0x5b6f21[_0xd17a('0x2c')]['id']}})[_0xd17a('0x18')](handleEntityNotFound(_0xc3312f,null))['then'](function(_0x23e9b0){if(_0x23e9b0){_0x6dd81e=_0x23e9b0;_0x22ed26[_0xd17a('0x2d')]=_['keys'](db['User'][_0xd17a('0x24')]);_0x22ed26['query']=_[_0xd17a('0x2e')](_0x5b6f21[_0xd17a('0x2f')]);_0x22ed26['filters']=_[_0xd17a('0x41')](_0x22ed26['model'],_0x22ed26[_0xd17a('0x2f')]);_0x3d106d['attributes']=_[_0xd17a('0x41')](_0x22ed26['model'],qs['fields'](_0x5b6f21[_0xd17a('0x2f')][_0xd17a('0x32')]));_0x3d106d[_0xd17a('0x31')]=_0x3d106d[_0xd17a('0x31')][_0xd17a('0x33')]?_0x3d106d['attributes']:_0x22ed26[_0xd17a('0x2d')];_0x3d106d[_0xd17a('0x43')]=qs['sort'](_0x5b6f21['query'][_0xd17a('0x44')]);_0x3d106d['where']=qs[_0xd17a('0x30')](_[_0xd17a('0x46')](_0x5b6f21[_0xd17a('0x2f')],_0x22ed26[_0xd17a('0x30')]));if(_0x5b6f21['query'][_0xd17a('0x48')]){_0x3d106d[_0xd17a('0x45')]=_['merge'](_0x3d106d['where'],{'$or':_[_0xd17a('0x22')](_0x3d106d[_0xd17a('0x31')],function(_0x2330e6){var _0x3e1b56={};_0x3e1b56[_0x2330e6]={'$like':'%'+_0x5b6f21[_0xd17a('0x2f')]['filter']+'%'};return _0x3e1b56;})});}_0x3d106d=_[_0xd17a('0x35')]({},_0x3d106d,_0x5b6f21[_0xd17a('0x36')]);return _0x6dd81e[_0xd17a('0x79')](_0x3d106d);}})['then'](function(_0xf9ec6e){if(_0xf9ec6e){_0x8a1ae7=_0xf9ec6e[_0xd17a('0x33')];if(!_0x5b6f21[_0xd17a('0x2f')][_0xd17a('0x53')]('nolimit')){_0x3d106d[_0xd17a('0x14')]=qs[_0xd17a('0x14')](_0x5b6f21[_0xd17a('0x2f')][_0xd17a('0x14')]);_0x3d106d[_0xd17a('0x12')]=qs[_0xd17a('0x12')](_0x5b6f21['query'][_0xd17a('0x12')]);}return _0x6dd81e[_0xd17a('0x79')](_0x3d106d);}})[_0xd17a('0x18')](function(_0x5f1a0c){if(_0x5f1a0c){return _0x5f1a0c?{'count':_0x8a1ae7,'rows':_0x5f1a0c}:null;}})[_0xd17a('0x18')](respondWithResult(_0xc3312f,null))[_0xd17a('0x2a')](handleError(_0xc3312f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 000b286..5cceb8d 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 _0x2e30=['emit','hasOwnProperty','exports','update','remove'];(function(_0xbe809,_0x1cf5da){var _0x5b6ef0=function(_0x1e568a){while(--_0x1e568a){_0xbe809['push'](_0xbe809['shift']());}};_0x5b6ef0(++_0x1cf5da);}(_0x2e30,0x1e3));var _0x02e3=function(_0x2779fb,_0x4ffc56){_0x2779fb=_0x2779fb-0x0;var _0x3d63f3=_0x2e30[_0x2779fb];return _0x3d63f3;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x02e3('0x0'),'afterDestroy':_0x02e3('0x1')};function emitEvent(_0xc85bb0){return function(_0x235d0f,_0x290f55,_0x4e04e4){ChatQueueEvents[_0x02e3('0x2')](_0xc85bb0+':'+_0x235d0f['id'],_0x235d0f);ChatQueueEvents['emit'](_0xc85bb0,_0x235d0f);_0x4e04e4(null);};}for(var e in events){if(events[_0x02e3('0x3')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x02e3('0x4')]=ChatQueueEvents; \ No newline at end of file +var _0xf83c=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hook'];(function(_0x575aed,_0x166a90){var _0x50e743=function(_0x171f68){while(--_0x171f68){_0x575aed['push'](_0x575aed['shift']());}};_0x50e743(++_0x166a90);}(_0xf83c,0x78));var _0xcf83=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xf83c[_0x5d9867];return _0x7d2118;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xcf83('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcf83('0x1')](0x0);var events={'afterCreate':_0xcf83('0x2'),'afterUpdate':'update','afterDestroy':_0xcf83('0x3')};function emitEvent(_0x3ab731){return function(_0x484a2a,_0x459149,_0x3b25bb){ChatQueueEvents['emit'](_0x3ab731+':'+_0x484a2a['id'],_0x484a2a);ChatQueueEvents[_0xcf83('0x4')](_0x3ab731,_0x484a2a);_0x3b25bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xcf83('0x5')](e,emitEvent(event));}}module[_0xcf83('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8fbb4d2..9ec7478 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 _0xbc4e=['chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','ChatQueue'];(function(_0x4df076,_0x482da3){var _0x5e8fed=function(_0x1d0eba){while(--_0x1d0eba){_0x4df076['push'](_0x4df076['shift']());}};_0x5e8fed(++_0x482da3);}(_0xbc4e,0xdd));var _0xebc4=function(_0x3845c1,_0x5090a2){_0x3845c1=_0x3845c1-0x0;var _0x4222f5=_0xbc4e[_0x3845c1];return _0x4222f5;};'use strict';var _=require('lodash');var util=require(_0xebc4('0x0'));var logger=require(_0xebc4('0x1'))(_0xebc4('0x2'));var moment=require('moment');var BPromise=require(_0xebc4('0x3'));var rp=require(_0xebc4('0x4'));var fs=require('fs');var path=require(_0xebc4('0x5'));var rimraf=require(_0xebc4('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0xebc4('0x7')]=function(_0x5c45e5,_0x5a4756){return _0x5c45e5['define'](_0xebc4('0x8'),attributes,{'tableName':_0xebc4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d76=['../../config/environment','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f9313,_0x134148){var _0x148fe2=function(_0x4e3ba8){while(--_0x4e3ba8){_0x3f9313['push'](_0x3f9313['shift']());}};_0x148fe2(++_0x134148);}(_0x6d76,0x16c));var _0x66d7=function(_0x3f5e14,_0x7b142a){_0x3f5e14=_0x3f5e14-0x0;var _0x516814=_0x6d76[_0x3f5e14];return _0x516814;};'use strict';var _=require(_0x66d7('0x0'));var util=require(_0x66d7('0x1'));var logger=require(_0x66d7('0x2'))(_0x66d7('0x3'));var moment=require(_0x66d7('0x4'));var BPromise=require(_0x66d7('0x5'));var rp=require(_0x66d7('0x6'));var fs=require('fs');var path=require(_0x66d7('0x7'));var rimraf=require('rimraf');var config=require(_0x66d7('0x8'));var attributes=require('./chatQueue.attributes');module[_0x66d7('0x9')]=function(_0x2833f6,_0x2c0a1f){return _0x2833f6['define'](_0x66d7('0xa'),attributes,{'tableName':_0x66d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index de429f6..9fb99d2 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 _0x9fda=['request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowChatQueue','ChatQueue','find','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x44b7e7,_0x5b9902){var _0x11ed08=function(_0x3dc71c){while(--_0x3dc71c){_0x44b7e7['push'](_0x44b7e7['shift']());}};_0x11ed08(++_0x5b9902);}(_0x9fda,0x8c));var _0xa9fd=function(_0x1482b5,_0x259774){_0x1482b5=_0x1482b5-0x0;var _0x464db2=_0x9fda[_0x1482b5];return _0x464db2;};'use strict';var _=require(_0xa9fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa9fd('0x1'));var rs=require(_0xa9fd('0x2'));var fs=require('fs');var Redis=require(_0xa9fd('0x3'));var db=require(_0xa9fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9fd('0x5'))(_0xa9fd('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9fd('0x7'));var client=jayson[_0xa9fd('0x8')]['http']({'port':0x232a});config['redis']=_[_0xa9fd('0x9')](config[_0xa9fd('0xa')],{'host':_0xa9fd('0xb'),'port':0x18eb});var socket=require(_0xa9fd('0xc'))(new Redis(config[_0xa9fd('0xa')]));require('./chatQueue.socket')[_0xa9fd('0xd')](socket);function respondWithRpcPromise(_0x17c068,_0x32c4d2,_0x5d7915){return new BPromise(function(_0xe1b24b,_0x4a850d){return client['request'](_0x17c068,_0x5d7915)[_0xa9fd('0xe')](function(_0xa68009){logger[_0xa9fd('0xf')]('ChatQueue,\x20%s,\x20%s',_0x32c4d2,_0xa9fd('0x10'));logger[_0xa9fd('0x11')](_0xa9fd('0x12'),_0x32c4d2,_0xa9fd('0x10'),JSON['stringify'](_0xa68009));if(_0xa68009[_0xa9fd('0x13')]){if(_0xa68009[_0xa9fd('0x13')][_0xa9fd('0x14')]===0x1f4){logger[_0xa9fd('0x13')](_0xa9fd('0x15'),_0x32c4d2,_0xa68009[_0xa9fd('0x13')][_0xa9fd('0x16')]);return _0x4a850d(_0xa68009[_0xa9fd('0x13')]['message']);}logger[_0xa9fd('0x13')](_0xa9fd('0x15'),_0x32c4d2,_0xa68009['error']['message']);return _0xe1b24b(_0xa68009[_0xa9fd('0x13')][_0xa9fd('0x16')]);}else{logger[_0xa9fd('0xf')](_0xa9fd('0x15'),_0x32c4d2,_0xa9fd('0x10'));_0xe1b24b(_0xa68009[_0xa9fd('0x17')][_0xa9fd('0x16')]);}})['catch'](function(_0x48bb74){logger[_0xa9fd('0x13')](_0xa9fd('0x15'),_0x32c4d2,_0x48bb74);_0x4a850d(_0x48bb74);});});}exports[_0xa9fd('0x18')]=function(_0x3247ac){var _0x3940e3=this;return new Promise(function(_0x3560b6,_0x7c1572){return db['ChatQueue'][_0xa9fd('0x19')]({'raw':_0x3247ac['options']?_0x3247ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x3247ac['options']?_0x3247ac[_0xa9fd('0x1a')][_0xa9fd('0x1b')]||null:null,'attributes':_0x3247ac[_0xa9fd('0x1a')]?_0x3247ac[_0xa9fd('0x1a')][_0xa9fd('0x1c')]||null:null,'limit':_0x3247ac['options']?_0x3247ac[_0xa9fd('0x1a')][_0xa9fd('0x1d')]||null:null,'include':_0x3247ac['options']?_0x3247ac[_0xa9fd('0x1a')][_0xa9fd('0x1e')]?_[_0xa9fd('0x1f')](_0x3247ac[_0xa9fd('0x1a')][_0xa9fd('0x1e')],function(_0x177eba){return{'model':db[_0x177eba[_0xa9fd('0x20')]],'as':_0x177eba['as'],'attributes':_0x177eba[_0xa9fd('0x1c')],'include':_0x177eba[_0xa9fd('0x1e')]?_[_0xa9fd('0x1f')](_0x177eba[_0xa9fd('0x1e')],function(_0x31c216){return{'model':db[_0x31c216[_0xa9fd('0x20')]],'as':_0x31c216['as'],'attributes':_0x31c216[_0xa9fd('0x1c')],'include':_0x31c216[_0xa9fd('0x1e')]?_[_0xa9fd('0x1f')](_0x31c216[_0xa9fd('0x1e')],function(_0x517a16){return{'model':db[_0x517a16[_0xa9fd('0x20')]],'as':_0x517a16['as'],'attributes':_0x517a16[_0xa9fd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa9fd('0xe')](function(_0x5cb7b4){logger[_0xa9fd('0xf')](_0xa9fd('0x18'),_0x3247ac);logger[_0xa9fd('0x11')](_0xa9fd('0x18'),_0x3247ac,JSON[_0xa9fd('0x21')](_0x5cb7b4));_0x3560b6(_0x5cb7b4);})[_0xa9fd('0x22')](function(_0x34480a){logger['error'](_0xa9fd('0x18'),_0x34480a[_0xa9fd('0x16')],_0x3247ac);_0x7c1572(_0x3940e3[_0xa9fd('0x13')](0x1f4,_0x34480a['message']));});});};exports[_0xa9fd('0x23')]=function(_0x151ee8){var _0x45d0fd=this;return new Promise(function(_0x189b77,_0x4e7608){return db[_0xa9fd('0x24')][_0xa9fd('0x25')]({'raw':_0x151ee8[_0xa9fd('0x1a')]?_0x151ee8[_0xa9fd('0x1a')][_0xa9fd('0x26')]===undefined?!![]:![]:!![],'where':_0x151ee8[_0xa9fd('0x1a')]?_0x151ee8['options']['where']||null:null,'attributes':_0x151ee8[_0xa9fd('0x1a')]?_0x151ee8[_0xa9fd('0x1a')][_0xa9fd('0x1c')]||null:null,'include':_0x151ee8[_0xa9fd('0x1a')]?_0x151ee8['options'][_0xa9fd('0x1e')]?_['map'](_0x151ee8['options']['include'],function(_0x1c8989){return{'model':db[_0x1c8989[_0xa9fd('0x20')]],'as':_0x1c8989['as'],'attributes':_0x1c8989['attributes'],'include':_0x1c8989[_0xa9fd('0x1e')]?_[_0xa9fd('0x1f')](_0x1c8989[_0xa9fd('0x1e')],function(_0x469c8a){return{'model':db[_0x469c8a[_0xa9fd('0x20')]],'as':_0x469c8a['as'],'attributes':_0x469c8a['attributes'],'include':_0x469c8a['include']?_['map'](_0x469c8a[_0xa9fd('0x1e')],function(_0x1def7e){return{'model':db[_0x1def7e['model']],'as':_0x1def7e['as'],'attributes':_0x1def7e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9fd('0xe')](function(_0x16d098){logger[_0xa9fd('0xf')](_0xa9fd('0x23'),_0x151ee8);logger[_0xa9fd('0x11')](_0xa9fd('0x23'),_0x151ee8,JSON[_0xa9fd('0x21')](_0x16d098));_0x189b77(_0x16d098);})[_0xa9fd('0x22')](function(_0x379afd){logger[_0xa9fd('0x13')](_0xa9fd('0x23'),_0x379afd[_0xa9fd('0x16')],_0x151ee8);_0x4e7608(_0x45d0fd['error'](0x1f4,_0x379afd[_0xa9fd('0x16')]));});});}; \ No newline at end of file +var _0x48ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','include','map','model','ShowChatQueue','find','util','bluebird','randomstring','ioredis'];(function(_0x15d913,_0x51cf7a){var _0x4ae65e=function(_0x2f39a1){while(--_0x2f39a1){_0x15d913['push'](_0x15d913['shift']());}};_0x4ae65e(++_0x51cf7a);}(_0x48ac,0xe0));var _0xc48a=function(_0x415430,_0x3f8a8a){_0x415430=_0x415430-0x0;var _0x5605b1=_0x48ac[_0x415430];return _0x5605b1;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc48a('0x9')],{'host':_0xc48a('0xa'),'port':0x18eb});var socket=require(_0xc48a('0xb'))(new Redis(config['redis']));require(_0xc48a('0xc'))[_0xc48a('0xd')](socket);function respondWithRpcPromise(_0xca2440,_0xcefd1e,_0x3ec348){return new BPromise(function(_0x1c96ae,_0x1c4ce9){return client[_0xc48a('0xe')](_0xca2440,_0x3ec348)[_0xc48a('0xf')](function(_0x6d74f3){logger[_0xc48a('0x10')]('ChatQueue,\x20%s,\x20%s',_0xcefd1e,_0xc48a('0x11'));logger[_0xc48a('0x12')](_0xc48a('0x13'),_0xcefd1e,'request\x20sent',JSON[_0xc48a('0x14')](_0x6d74f3));if(_0x6d74f3[_0xc48a('0x15')]){if(_0x6d74f3['error'][_0xc48a('0x16')]===0x1f4){logger[_0xc48a('0x15')](_0xc48a('0x17'),_0xcefd1e,_0x6d74f3['error'][_0xc48a('0x18')]);return _0x1c4ce9(_0x6d74f3[_0xc48a('0x15')][_0xc48a('0x18')]);}logger['error'](_0xc48a('0x17'),_0xcefd1e,_0x6d74f3[_0xc48a('0x15')]['message']);return _0x1c96ae(_0x6d74f3['error'][_0xc48a('0x18')]);}else{logger['info'](_0xc48a('0x17'),_0xcefd1e,_0xc48a('0x11'));_0x1c96ae(_0x6d74f3[_0xc48a('0x19')][_0xc48a('0x18')]);}})[_0xc48a('0x1a')](function(_0x2deee6){logger[_0xc48a('0x15')]('ChatQueue,\x20%s,\x20%s',_0xcefd1e,_0x2deee6);_0x1c4ce9(_0x2deee6);});});}exports[_0xc48a('0x1b')]=function(_0x438b69){var _0x5b750c=this;return new Promise(function(_0x259bc2,_0x4e6e15){return db[_0xc48a('0x1c')]['findAll']({'raw':_0x438b69[_0xc48a('0x1d')]?_0x438b69[_0xc48a('0x1d')][_0xc48a('0x1e')]===undefined?!![]:![]:!![],'where':_0x438b69[_0xc48a('0x1d')]?_0x438b69[_0xc48a('0x1d')][_0xc48a('0x1f')]||null:null,'attributes':_0x438b69[_0xc48a('0x1d')]?_0x438b69[_0xc48a('0x1d')][_0xc48a('0x20')]||null:null,'limit':_0x438b69[_0xc48a('0x1d')]?_0x438b69[_0xc48a('0x1d')]['limit']||null:null,'include':_0x438b69['options']?_0x438b69[_0xc48a('0x1d')][_0xc48a('0x21')]?_[_0xc48a('0x22')](_0x438b69[_0xc48a('0x1d')]['include'],function(_0x5c5d61){return{'model':db[_0x5c5d61[_0xc48a('0x23')]],'as':_0x5c5d61['as'],'attributes':_0x5c5d61[_0xc48a('0x20')],'include':_0x5c5d61[_0xc48a('0x21')]?_['map'](_0x5c5d61[_0xc48a('0x21')],function(_0x4077f7){return{'model':db[_0x4077f7[_0xc48a('0x23')]],'as':_0x4077f7['as'],'attributes':_0x4077f7[_0xc48a('0x20')],'include':_0x4077f7[_0xc48a('0x21')]?_[_0xc48a('0x22')](_0x4077f7[_0xc48a('0x21')],function(_0x335532){return{'model':db[_0x335532[_0xc48a('0x23')]],'as':_0x335532['as'],'attributes':_0x335532[_0xc48a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf78a){logger[_0xc48a('0x10')]('GetChatQueue',_0x438b69);logger[_0xc48a('0x12')](_0xc48a('0x1b'),_0x438b69,JSON['stringify'](_0x5bf78a));_0x259bc2(_0x5bf78a);})[_0xc48a('0x1a')](function(_0x2ab3e1){logger[_0xc48a('0x15')]('GetChatQueue',_0x2ab3e1[_0xc48a('0x18')],_0x438b69);_0x4e6e15(_0x5b750c[_0xc48a('0x15')](0x1f4,_0x2ab3e1['message']));});});};exports[_0xc48a('0x24')]=function(_0x3f1bef){var _0x14bdfc=this;return new Promise(function(_0x4db7e2,_0x28a7f9){return db['ChatQueue'][_0xc48a('0x25')]({'raw':_0x3f1bef[_0xc48a('0x1d')]?_0x3f1bef[_0xc48a('0x1d')][_0xc48a('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f1bef[_0xc48a('0x1d')]?_0x3f1bef[_0xc48a('0x1d')][_0xc48a('0x1f')]||null:null,'attributes':_0x3f1bef[_0xc48a('0x1d')]?_0x3f1bef['options'][_0xc48a('0x20')]||null:null,'include':_0x3f1bef[_0xc48a('0x1d')]?_0x3f1bef[_0xc48a('0x1d')][_0xc48a('0x21')]?_[_0xc48a('0x22')](_0x3f1bef[_0xc48a('0x1d')][_0xc48a('0x21')],function(_0x52b449){return{'model':db[_0x52b449[_0xc48a('0x23')]],'as':_0x52b449['as'],'attributes':_0x52b449[_0xc48a('0x20')],'include':_0x52b449[_0xc48a('0x21')]?_[_0xc48a('0x22')](_0x52b449['include'],function(_0x36378a){return{'model':db[_0x36378a[_0xc48a('0x23')]],'as':_0x36378a['as'],'attributes':_0x36378a['attributes'],'include':_0x36378a[_0xc48a('0x21')]?_['map'](_0x36378a[_0xc48a('0x21')],function(_0x53671c){return{'model':db[_0x53671c['model']],'as':_0x53671c['as'],'attributes':_0x53671c[_0xc48a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc48a('0xf')](function(_0x4cfd00){logger[_0xc48a('0x10')](_0xc48a('0x24'),_0x3f1bef);logger[_0xc48a('0x12')](_0xc48a('0x24'),_0x3f1bef,JSON['stringify'](_0x4cfd00));_0x4db7e2(_0x4cfd00);})[_0xc48a('0x1a')](function(_0x3e747a){logger[_0xc48a('0x15')](_0xc48a('0x24'),_0x3e747a['message'],_0x3f1bef);_0x28a7f9(_0x14bdfc[_0xc48a('0x15')](0x1f4,_0x3e747a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 083010e..cb99caa 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 _0x34e8=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x34e8,0x12c));var _0x834e=function(_0x30ca15,_0x5e4f04){_0x30ca15=_0x30ca15-0x0;var _0x30ed77=_0x34e8[_0x30ca15];return _0x30ed77;};'use strict';var ChatQueueEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){ChatQueueEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);ChatQueueEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file +var _0xa37e=['chatQueue:','remove','update','emit','removeListener','register'];(function(_0x231c9c,_0x5a3ce2){var _0xb28752=function(_0x4389a4){while(--_0x4389a4){_0x231c9c['push'](_0x231c9c['shift']());}};_0xb28752(++_0x5a3ce2);}(_0xa37e,0x97));var _0xea37=function(_0x545fdb,_0x37c361){_0x545fdb=_0x545fdb-0x0;var _0x4afd8e=_0xa37e[_0x545fdb];return _0x4afd8e;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){ChatQueueEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);ChatQueueEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 715e2b3..4b5461e 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3de556,_0x4151ae){var _0x48302d=function(_0x30fd38){while(--_0x30fd38){_0x3de556['push'](_0x3de556['shift']());}};_0x48302d(++_0x4151ae);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe7e72,_0x3e6f42){var _0x594f9d=function(_0x280e38){while(--_0x280e38){_0xe7e72['push'](_0xe7e72['shift']());}};_0x594f9d(++_0x3e6f42);}(_0x008c,0x188));var _0xc008=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0x008c[_0xe1f858];return _0x367af6;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ad7fbdd..f85332d 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 _0xcc0e=['moment','exports','STRING','DATE'];(function(_0x501e90,_0x1e8f51){var _0x5dd09c=function(_0x5f3072){while(--_0x5f3072){_0x501e90['push'](_0x501e90['shift']());}};_0x5dd09c(++_0x1e8f51);}(_0xcc0e,0x8c));var _0xecc0=function(_0x17eb18,_0x927702){_0x17eb18=_0x17eb18-0x0;var _0x46516f=_0xcc0e[_0x17eb18];return _0x46516f;};'use strict';var moment=require(_0xecc0('0x0'));var Sequelize=require('sequelize');module[_0xecc0('0x1')]={'uniqueid':{'type':Sequelize[_0xecc0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xecc0('0x2')]},'joinAt':{'type':Sequelize[_0xecc0('0x3')]},'leaveAt':{'type':Sequelize[_0xecc0('0x3')]},'acceptAt':{'type':Sequelize[_0xecc0('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xecc0('0x2')]}}; \ No newline at end of file +var _0x4215=['sequelize','STRING','DATE','moment'];(function(_0x55fb18,_0x22ca43){var _0x4c7217=function(_0x3bac21){while(--_0x3bac21){_0x55fb18['push'](_0x55fb18['shift']());}};_0x4c7217(++_0x22ca43);}(_0x4215,0x19f));var _0x5421=function(_0x3372ec,_0x5445e9){_0x3372ec=_0x3372ec-0x0;var _0x4b076c=_0x4215[_0x3372ec];return _0x4b076c;};'use strict';var moment=require(_0x5421('0x0'));var Sequelize=require(_0x5421('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5421('0x2')]},'joinAt':{'type':Sequelize[_0x5421('0x3')]},'leaveAt':{'type':Sequelize[_0x5421('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5421('0x3')]},'reason':{'type':Sequelize[_0x5421('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2dc1f68..4e6dbfb 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 _0xee9c=['rawAttributes','create','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','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','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xee9c,0x1e6));var _0xcee9=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xee9c[_0x457b64];return _0x437111;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcee9('0x0'));var zipdir=require(_0xcee9('0x1'));var jsonpatch=require(_0xcee9('0x2'));var rp=require(_0xcee9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcee9('0x4'));var util=require(_0xcee9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcee9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcee9('0x7'));var _=require(_0xcee9('0x8'));var squel=require(_0xcee9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcee9('0xa'));var toCsv=require(_0xcee9('0x6'));var querystring=require('querystring');var Papa=require(_0xcee9('0xb'));var Redis=require(_0xcee9('0xc'));var authService=require(_0xcee9('0xd'));var qs=require(_0xcee9('0xe'));var as=require(_0xcee9('0xf'));var hardwareService=require(_0xcee9('0x10'));var logger=require('../../config/logger')(_0xcee9('0x11'));var utils=require(_0xcee9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcee9('0x13'));var db=require(_0xcee9('0x14'))['db'];function respondWithStatusCode(_0x2df879,_0x562f74){_0x562f74=_0x562f74||0xcc;return function(_0x1ed4fc){if(_0x1ed4fc){return _0x2df879[_0xcee9('0x15')](_0x562f74);}return _0x2df879[_0xcee9('0x16')](_0x562f74)[_0xcee9('0x17')]();};}function respondWithResult(_0x1d93a2,_0x4a0125){_0x4a0125=_0x4a0125||0xc8;return function(_0x5e9930){if(_0x5e9930){return _0x1d93a2[_0xcee9('0x16')](_0x4a0125)[_0xcee9('0x18')](_0x5e9930);}};}function respondWithFilteredResult(_0x2558a2,_0x1eb62c){return function(_0x3a513f){if(_0x3a513f){var _0x1e3790=typeof _0x1eb62c[_0xcee9('0x19')]===_0xcee9('0x1a')&&typeof _0x1eb62c[_0xcee9('0x1b')]===_0xcee9('0x1a');var _0x1eec39=_0x3a513f[_0xcee9('0x1c')];var _0x552ca1=_0x1e3790?0x0:_0x1eb62c[_0xcee9('0x19')];var _0x414032=_0x1e3790?_0x3a513f[_0xcee9('0x1c')]:_0x1eb62c[_0xcee9('0x19')]+_0x1eb62c[_0xcee9('0x1b')];var _0x492fd6;if(_0x414032>=_0x1eec39){_0x414032=_0x1eec39;_0x492fd6=0xc8;}else{_0x492fd6=0xce;}_0x2558a2[_0xcee9('0x16')](_0x492fd6);return _0x2558a2[_0xcee9('0x1d')](_0xcee9('0x1e'),_0x552ca1+'-'+_0x414032+'/'+_0x1eec39)[_0xcee9('0x18')](_0x3a513f);}return null;};}function patchUpdates(_0x580b06){return function(_0x932166){try{jsonpatch[_0xcee9('0x1f')](_0x932166,_0x580b06,!![]);}catch(_0x4e5a1a){return BPromise['reject'](_0x4e5a1a);}return _0x932166[_0xcee9('0x20')]();};}function saveUpdates(_0x1c90b2,_0x146018){return function(_0x49afe8){if(_0x49afe8){return _0x49afe8[_0xcee9('0x21')](_0x1c90b2)[_0xcee9('0x22')](function(_0x39956f){return _0x39956f;});}return null;};}function removeEntity(_0x57b548,_0x2c219){return function(_0x5c1250){if(_0x5c1250){return _0x5c1250[_0xcee9('0x23')]()[_0xcee9('0x22')](function(){_0x57b548[_0xcee9('0x16')](0xcc)[_0xcee9('0x17')]();});}};}function handleEntityNotFound(_0xef4b0a,_0x3ce813){return function(_0x1c8d26){if(!_0x1c8d26){_0xef4b0a[_0xcee9('0x15')](0x194);}return _0x1c8d26;};}function handleError(_0x26d277,_0x2ec6ca){_0x2ec6ca=_0x2ec6ca||0x1f4;return function(_0x4cc9a1){logger['error'](_0x4cc9a1[_0xcee9('0x24')]);if(_0x4cc9a1['name']){delete _0x4cc9a1[_0xcee9('0x25')];}_0x26d277[_0xcee9('0x16')](_0x2ec6ca)[_0xcee9('0x26')](_0x4cc9a1);};}exports[_0xcee9('0x27')]=function(_0x5911bf,_0x277262){var _0x22efee={},_0x3e88cd={},_0x4c4d51={'count':0x0,'rows':[]};var _0x3d3027=_[_0xcee9('0x28')](db[_0xcee9('0x29')]['rawAttributes'],function(_0x6a9aa8){return{'name':_0x6a9aa8[_0xcee9('0x2a')],'type':_0x6a9aa8[_0xcee9('0x2b')][_0xcee9('0x2c')]};});_0x3e88cd['model']=_[_0xcee9('0x28')](_0x3d3027,_0xcee9('0x25'));_0x3e88cd['query']=_[_0xcee9('0x2d')](_0x5911bf[_0xcee9('0x2e')]);_0x3e88cd[_0xcee9('0x2f')]=_[_0xcee9('0x30')](_0x3e88cd['model'],_0x3e88cd['query']);_0x22efee[_0xcee9('0x31')]=_[_0xcee9('0x30')](_0x3e88cd[_0xcee9('0x32')],qs[_0xcee9('0x33')](_0x5911bf[_0xcee9('0x2e')][_0xcee9('0x33')]));_0x22efee[_0xcee9('0x31')]=_0x22efee['attributes'][_0xcee9('0x34')]?_0x22efee[_0xcee9('0x31')]:_0x3e88cd[_0xcee9('0x32')];if(!_0x5911bf['query'][_0xcee9('0x35')](_0xcee9('0x36'))){_0x22efee[_0xcee9('0x1b')]=qs[_0xcee9('0x1b')](_0x5911bf[_0xcee9('0x2e')]['limit']);_0x22efee['offset']=qs[_0xcee9('0x19')](_0x5911bf[_0xcee9('0x2e')][_0xcee9('0x19')]);}_0x22efee['order']=qs[_0xcee9('0x37')](_0x5911bf[_0xcee9('0x2e')][_0xcee9('0x37')]);_0x22efee[_0xcee9('0x38')]=qs[_0xcee9('0x2f')](_[_0xcee9('0x39')](_0x5911bf['query'],_0x3e88cd[_0xcee9('0x2f')]),_0x3d3027);if(_0x5911bf[_0xcee9('0x2e')][_0xcee9('0x3a')]){_0x22efee[_0xcee9('0x38')]=_['merge'](_0x22efee['where'],{'$or':_[_0xcee9('0x28')](_0x3d3027,function(_0x15b3a2){if(_0x15b3a2['type']!=='VIRTUAL'){var _0x192589={};_0x192589[_0x15b3a2[_0xcee9('0x25')]]={'$like':'%'+_0x5911bf['query'][_0xcee9('0x3a')]+'%'};return _0x192589;}})});}_0x22efee=_[_0xcee9('0x3b')]({},_0x22efee,_0x5911bf[_0xcee9('0x3c')]);var _0x5e6628={'where':_0x22efee['where']};return db[_0xcee9('0x29')][_0xcee9('0x1c')](_0x5e6628)[_0xcee9('0x22')](function(_0xe0ba07){_0x4c4d51[_0xcee9('0x1c')]=_0xe0ba07;if(_0x5911bf[_0xcee9('0x2e')][_0xcee9('0x3d')]){_0x22efee[_0xcee9('0x3e')]=[{'all':!![]}];}return db[_0xcee9('0x29')][_0xcee9('0x3f')](_0x22efee);})[_0xcee9('0x22')](function(_0x5827ae){_0x4c4d51['rows']=_0x5827ae;return _0x4c4d51;})[_0xcee9('0x22')](respondWithFilteredResult(_0x277262,_0x22efee))[_0xcee9('0x40')](handleError(_0x277262,null));};exports['show']=function(_0x33c17b,_0x11efe2){var _0x292645={'raw':!![],'where':{'id':_0x33c17b[_0xcee9('0x41')]['id']}},_0x53409e={};_0x53409e['model']=_[_0xcee9('0x2d')](db[_0xcee9('0x29')][_0xcee9('0x42')]);_0x53409e['query']=_[_0xcee9('0x2d')](_0x33c17b[_0xcee9('0x2e')]);_0x53409e[_0xcee9('0x2f')]=_['intersection'](_0x53409e[_0xcee9('0x32')],_0x53409e['query']);_0x292645[_0xcee9('0x31')]=_[_0xcee9('0x30')](_0x53409e[_0xcee9('0x32')],qs[_0xcee9('0x33')](_0x33c17b[_0xcee9('0x2e')][_0xcee9('0x33')]));_0x292645[_0xcee9('0x31')]=_0x292645[_0xcee9('0x31')][_0xcee9('0x34')]?_0x292645[_0xcee9('0x31')]:_0x53409e[_0xcee9('0x32')];if(_0x33c17b[_0xcee9('0x2e')]['includeAll']){_0x292645['include']=[{'all':!![]}];}_0x292645=_[_0xcee9('0x3b')]({},_0x292645,_0x33c17b[_0xcee9('0x3c')]);return db[_0xcee9('0x29')]['find'](_0x292645)['then'](handleEntityNotFound(_0x11efe2,null))['then'](respondWithResult(_0x11efe2,null))[_0xcee9('0x40')](handleError(_0x11efe2,null));};exports[_0xcee9('0x43')]=function(_0x1792af,_0x30976b){return db['ChatQueueReport'][_0xcee9('0x43')](_0x1792af['body'],{})[_0xcee9('0x22')](respondWithResult(_0x30976b,0xc9))[_0xcee9('0x40')](handleError(_0x30976b,null));};exports[_0xcee9('0x21')]=function(_0x315446,_0x499152){if(_0x315446['body']['id']){delete _0x315446['body']['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x315446['params']['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0x499152,null))[_0xcee9('0x22')](saveUpdates(_0x315446['body'],null))[_0xcee9('0x22')](respondWithResult(_0x499152,null))[_0xcee9('0x40')](handleError(_0x499152,null));};exports[_0xcee9('0x23')]=function(_0x5d4448,_0x370f43){return db['ChatQueueReport'][_0xcee9('0x44')]({'where':{'id':_0x5d4448[_0xcee9('0x41')]['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0x370f43,null))[_0xcee9('0x22')](removeEntity(_0x370f43,null))[_0xcee9('0x40')](handleError(_0x370f43,null));};exports['describe']=function(_0xcc2c79,_0x23c598){return db[_0xcee9('0x29')]['describe']()['then'](respondWithResult(_0x23c598,null))[_0xcee9('0x40')](handleError(_0x23c598,null));}; \ No newline at end of file +var _0x0b78=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xb6afe,_0x38671f){var _0x335218=function(_0x325284){while(--_0x325284){_0xb6afe['push'](_0xb6afe['shift']());}};_0x335218(++_0x38671f);}(_0x0b78,0x1d6));var _0x80b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0b78[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80b7('0x0'));var zipdir=require(_0x80b7('0x1'));var jsonpatch=require(_0x80b7('0x2'));var rp=require('request-promise');var moment=require(_0x80b7('0x3'));var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x80b7('0x5'));var csv=require(_0x80b7('0x6'));var ejs=require(_0x80b7('0x7'));var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require(_0x80b7('0x9'));var squel=require(_0x80b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require(_0x80b7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0xe'));var as=require(_0x80b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80b7('0x10'))(_0x80b7('0x11'));var utils=require(_0x80b7('0x12'));var config=require(_0x80b7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac007,_0x1bbe9f){_0x1bbe9f=_0x1bbe9f||0xcc;return function(_0x16976c){if(_0x16976c){return _0x3ac007[_0x80b7('0x14')](_0x1bbe9f);}return _0x3ac007[_0x80b7('0x15')](_0x1bbe9f)[_0x80b7('0x16')]();};}function respondWithResult(_0x3d71a0,_0x32cecc){_0x32cecc=_0x32cecc||0xc8;return function(_0x416d32){if(_0x416d32){return _0x3d71a0['status'](_0x32cecc)['json'](_0x416d32);}};}function respondWithFilteredResult(_0x5c64df,_0x57e428){return function(_0x2c6bff){if(_0x2c6bff){var _0x459f67=typeof _0x57e428[_0x80b7('0x17')]===_0x80b7('0x18')&&typeof _0x57e428[_0x80b7('0x19')]===_0x80b7('0x18');var _0x262cd5=_0x2c6bff[_0x80b7('0x1a')];var _0x22abaa=_0x459f67?0x0:_0x57e428[_0x80b7('0x17')];var _0x25b5e9=_0x459f67?_0x2c6bff[_0x80b7('0x1a')]:_0x57e428[_0x80b7('0x17')]+_0x57e428['limit'];var _0x2165df;if(_0x25b5e9>=_0x262cd5){_0x25b5e9=_0x262cd5;_0x2165df=0xc8;}else{_0x2165df=0xce;}_0x5c64df[_0x80b7('0x15')](_0x2165df);return _0x5c64df[_0x80b7('0x1b')](_0x80b7('0x1c'),_0x22abaa+'-'+_0x25b5e9+'/'+_0x262cd5)[_0x80b7('0x1d')](_0x2c6bff);}return null;};}function patchUpdates(_0x3ebdd6){return function(_0x220133){try{jsonpatch[_0x80b7('0x1e')](_0x220133,_0x3ebdd6,!![]);}catch(_0x3da240){return BPromise[_0x80b7('0x1f')](_0x3da240);}return _0x220133[_0x80b7('0x20')]();};}function saveUpdates(_0x1ef249,_0x53046f){return function(_0x55bf6e){if(_0x55bf6e){return _0x55bf6e[_0x80b7('0x21')](_0x1ef249)[_0x80b7('0x22')](function(_0x158b65){return _0x158b65;});}return null;};}function removeEntity(_0x5e8093,_0x9fccdc){return function(_0x390d8a){if(_0x390d8a){return _0x390d8a[_0x80b7('0x23')]()[_0x80b7('0x22')](function(){_0x5e8093[_0x80b7('0x15')](0xcc)[_0x80b7('0x16')]();});}};}function handleEntityNotFound(_0x44ab49,_0xea1ea0){return function(_0x23a876){if(!_0x23a876){_0x44ab49[_0x80b7('0x14')](0x194);}return _0x23a876;};}function handleError(_0x1221c7,_0x4cb8c9){_0x4cb8c9=_0x4cb8c9||0x1f4;return function(_0x328c15){logger[_0x80b7('0x24')](_0x328c15[_0x80b7('0x25')]);if(_0x328c15[_0x80b7('0x26')]){delete _0x328c15[_0x80b7('0x26')];}_0x1221c7[_0x80b7('0x15')](_0x4cb8c9)[_0x80b7('0x27')](_0x328c15);};}exports[_0x80b7('0x28')]=function(_0x479335,_0x42e7a6){var _0x23958b={},_0x1dc2df={},_0x396144={'count':0x0,'rows':[]};var _0x46b76b=_['map'](db[_0x80b7('0x29')][_0x80b7('0x2a')],function(_0x2cc6f7){return{'name':_0x2cc6f7[_0x80b7('0x2b')],'type':_0x2cc6f7[_0x80b7('0x2c')][_0x80b7('0x2d')]};});_0x1dc2df[_0x80b7('0x2e')]=_['map'](_0x46b76b,_0x80b7('0x26'));_0x1dc2df[_0x80b7('0x2f')]=_['keys'](_0x479335[_0x80b7('0x2f')]);_0x1dc2df[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1dc2df[_0x80b7('0x2e')],_0x1dc2df[_0x80b7('0x2f')]);_0x23958b[_0x80b7('0x32')]=_['intersection'](_0x1dc2df[_0x80b7('0x2e')],qs[_0x80b7('0x33')](_0x479335[_0x80b7('0x2f')]['fields']));_0x23958b[_0x80b7('0x32')]=_0x23958b[_0x80b7('0x32')][_0x80b7('0x34')]?_0x23958b['attributes']:_0x1dc2df[_0x80b7('0x2e')];if(!_0x479335[_0x80b7('0x2f')][_0x80b7('0x35')](_0x80b7('0x36'))){_0x23958b[_0x80b7('0x19')]=qs[_0x80b7('0x19')](_0x479335[_0x80b7('0x2f')][_0x80b7('0x19')]);_0x23958b['offset']=qs['offset'](_0x479335[_0x80b7('0x2f')][_0x80b7('0x17')]);}_0x23958b[_0x80b7('0x37')]=qs[_0x80b7('0x38')](_0x479335['query']['sort']);_0x23958b[_0x80b7('0x39')]=qs[_0x80b7('0x30')](_[_0x80b7('0x3a')](_0x479335[_0x80b7('0x2f')],_0x1dc2df['filters']),_0x46b76b);if(_0x479335[_0x80b7('0x2f')][_0x80b7('0x3b')]){_0x23958b['where']=_[_0x80b7('0x3c')](_0x23958b['where'],{'$or':_[_0x80b7('0x3d')](_0x46b76b,function(_0x490b91){if(_0x490b91['type']!==_0x80b7('0x3e')){var _0x76ffba={};_0x76ffba[_0x490b91[_0x80b7('0x26')]]={'$like':'%'+_0x479335[_0x80b7('0x2f')]['filter']+'%'};return _0x76ffba;}})});}_0x23958b=_['merge']({},_0x23958b,_0x479335[_0x80b7('0x3f')]);var _0x4f50ca={'where':_0x23958b[_0x80b7('0x39')]};return db[_0x80b7('0x29')]['count'](_0x4f50ca)['then'](function(_0x15fe0d){_0x396144[_0x80b7('0x1a')]=_0x15fe0d;if(_0x479335[_0x80b7('0x2f')]['includeAll']){_0x23958b[_0x80b7('0x40')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x23958b);})[_0x80b7('0x22')](function(_0x1b2fda){_0x396144[_0x80b7('0x41')]=_0x1b2fda;return _0x396144;})[_0x80b7('0x22')](respondWithFilteredResult(_0x42e7a6,_0x23958b))[_0x80b7('0x42')](handleError(_0x42e7a6,null));};exports[_0x80b7('0x43')]=function(_0xa12f05,_0x2070fc){var _0xa5d1bf={'raw':!![],'where':{'id':_0xa12f05[_0x80b7('0x44')]['id']}},_0x190d41={};_0x190d41[_0x80b7('0x2e')]=_['keys'](db[_0x80b7('0x29')][_0x80b7('0x2a')]);_0x190d41[_0x80b7('0x2f')]=_[_0x80b7('0x45')](_0xa12f05[_0x80b7('0x2f')]);_0x190d41[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x190d41[_0x80b7('0x2e')],_0x190d41[_0x80b7('0x2f')]);_0xa5d1bf[_0x80b7('0x32')]=_[_0x80b7('0x31')](_0x190d41['model'],qs[_0x80b7('0x33')](_0xa12f05['query'][_0x80b7('0x33')]));_0xa5d1bf[_0x80b7('0x32')]=_0xa5d1bf[_0x80b7('0x32')][_0x80b7('0x34')]?_0xa5d1bf['attributes']:_0x190d41[_0x80b7('0x2e')];if(_0xa12f05[_0x80b7('0x2f')]['includeAll']){_0xa5d1bf[_0x80b7('0x40')]=[{'all':!![]}];}_0xa5d1bf=_[_0x80b7('0x3c')]({},_0xa5d1bf,_0xa12f05['options']);return db[_0x80b7('0x29')][_0x80b7('0x46')](_0xa5d1bf)['then'](handleEntityNotFound(_0x2070fc,null))['then'](respondWithResult(_0x2070fc,null))[_0x80b7('0x42')](handleError(_0x2070fc,null));};exports[_0x80b7('0x47')]=function(_0xb75a61,_0x29bee7){return db[_0x80b7('0x29')][_0x80b7('0x47')](_0xb75a61[_0x80b7('0x48')],{})['then'](respondWithResult(_0x29bee7,0xc9))['catch'](handleError(_0x29bee7,null));};exports['update']=function(_0x599205,_0x52fd0b){if(_0x599205['body']['id']){delete _0x599205[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x29')][_0x80b7('0x46')]({'where':{'id':_0x599205['params']['id']}})[_0x80b7('0x22')](handleEntityNotFound(_0x52fd0b,null))[_0x80b7('0x22')](saveUpdates(_0x599205[_0x80b7('0x48')],null))['then'](respondWithResult(_0x52fd0b,null))[_0x80b7('0x42')](handleError(_0x52fd0b,null));};exports['destroy']=function(_0x1e7536,_0x2a642e){return db[_0x80b7('0x29')]['find']({'where':{'id':_0x1e7536[_0x80b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a642e,null))['then'](removeEntity(_0x2a642e,null))[_0x80b7('0x42')](handleError(_0x2a642e,null));};exports[_0x80b7('0x49')]=function(_0x3d327d,_0xb9170b){return db[_0x80b7('0x29')][_0x80b7('0x49')]()[_0x80b7('0x22')](respondWithResult(_0xb9170b,null))[_0x80b7('0x42')](handleError(_0xb9170b,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 6efc10a..3a8942f 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x424d0c,_0x17e32e){var _0x3e1135=function(_0xa0e55f){while(--_0xa0e55f){_0x424d0c['push'](_0x424d0c['shift']());}};_0x3e1135(++_0x17e32e);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 130d56b..7a3821b 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 _0x47a1=['code','message','result','catch','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x47a1,0x179));var _0x147a=function(_0x8365cd,_0x3c72a1){_0x8365cd=_0x8365cd-0x0;var _0x16c08c=_0x47a1[_0x8365cd];return _0x16c08c;};'use strict';var _=require('lodash');var util=require(_0x147a('0x0'));var moment=require(_0x147a('0x1'));var BPromise=require('bluebird');var rs=require(_0x147a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x147a('0x3'))['db'];var utils=require(_0x147a('0x4'));var logger=require('../../config/logger')(_0x147a('0x5'));var config=require(_0x147a('0x6'));var jayson=require(_0x147a('0x7'));var client=jayson[_0x147a('0x8')][_0x147a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x575604,_0x3d39e3,_0x3ed04b){return new BPromise(function(_0x23ca54,_0x557edf){return client[_0x147a('0xa')](_0x575604,_0x3ed04b)[_0x147a('0xb')](function(_0x20178e){logger[_0x147a('0xc')](_0x147a('0xd'),_0x3d39e3,_0x147a('0xe'));logger[_0x147a('0xf')](_0x147a('0x10'),_0x3d39e3,_0x147a('0xe'),JSON[_0x147a('0x11')](_0x20178e));if(_0x20178e[_0x147a('0x12')]){if(_0x20178e[_0x147a('0x12')][_0x147a('0x13')]===0x1f4){logger[_0x147a('0x12')](_0x147a('0xd'),_0x3d39e3,_0x20178e[_0x147a('0x12')][_0x147a('0x14')]);return _0x557edf(_0x20178e['error'][_0x147a('0x14')]);}logger['error'](_0x147a('0xd'),_0x3d39e3,_0x20178e[_0x147a('0x12')][_0x147a('0x14')]);return _0x23ca54(_0x20178e['error'][_0x147a('0x14')]);}else{logger[_0x147a('0xc')](_0x147a('0xd'),_0x3d39e3,'request\x20sent');_0x23ca54(_0x20178e[_0x147a('0x15')][_0x147a('0x14')]);}})[_0x147a('0x16')](function(_0x58f49a){logger[_0x147a('0x12')](_0x147a('0xd'),_0x3d39e3,_0x58f49a);_0x557edf(_0x58f49a);});});}exports['CreateChatQueueReport']=function(_0x3afb93){var _0x11838a=this;return new Promise(function(_0x17f4da,_0x477e4e){return db['ChatQueueReport'][_0x147a('0x17')](_0x3afb93[_0x147a('0x18')],{'raw':_0x3afb93[_0x147a('0x19')]?_0x3afb93['options'][_0x147a('0x1a')]===undefined?!![]:![]:!![]})[_0x147a('0xb')](function(_0x5490b4){logger[_0x147a('0xc')](_0x147a('0x1b'),_0x3afb93);logger[_0x147a('0xf')](_0x147a('0x1b'),_0x3afb93,JSON[_0x147a('0x11')](_0x5490b4));_0x17f4da(_0x5490b4);})[_0x147a('0x16')](function(_0x2f37dc){logger[_0x147a('0x12')](_0x147a('0x1b'),_0x2f37dc[_0x147a('0x14')],_0x3afb93);_0x477e4e(_0x11838a[_0x147a('0x12')](0x1f4,_0x2f37dc[_0x147a('0x14')]));});});};exports[_0x147a('0x1c')]=function(_0x59d552){var _0x9c1f70=this;return new Promise(function(_0x5107c2,_0x34a6fd){return db[_0x147a('0x1d')][_0x147a('0x1e')](_0x59d552[_0x147a('0x18')],{'raw':_0x59d552['options']?_0x59d552['options'][_0x147a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d552[_0x147a('0x19')]?_0x59d552[_0x147a('0x19')]['where']||null:null,'attributes':_0x59d552[_0x147a('0x19')]?_0x59d552[_0x147a('0x19')][_0x147a('0x1f')]||null:null,'limit':_0x59d552[_0x147a('0x19')]?_0x59d552[_0x147a('0x19')][_0x147a('0x20')]||null:null})[_0x147a('0xb')](function(_0x1a3cb2){logger[_0x147a('0xc')](_0x147a('0x1c'),_0x59d552);logger[_0x147a('0xf')](_0x147a('0x1c'),_0x59d552,JSON['stringify'](_0x1a3cb2));_0x5107c2(_0x1a3cb2);})[_0x147a('0x16')](function(_0x11c8df){logger['error']('UpdateChatQueueReport',_0x11c8df[_0x147a('0x14')],_0x59d552);_0x34a6fd(_0x9c1f70[_0x147a('0x12')](0x1f4,_0x11c8df[_0x147a('0x14')]));});});}; \ No newline at end of file +var _0xda44=['attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','catch','update','where'];(function(_0x578a73,_0x1cbfb4){var _0x2e3780=function(_0x3a76c3){while(--_0x3a76c3){_0x578a73['push'](_0x578a73['shift']());}};_0x2e3780(++_0x1cbfb4);}(_0xda44,0x175));var _0x4da4=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xda44[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x4da4('0x0'));var util=require(_0x4da4('0x1'));var moment=require(_0x4da4('0x2'));var BPromise=require(_0x4da4('0x3'));var rs=require(_0x4da4('0x4'));var fs=require('fs');var Redis=require(_0x4da4('0x5'));var db=require(_0x4da4('0x6'))['db'];var utils=require(_0x4da4('0x7'));var logger=require(_0x4da4('0x8'))(_0x4da4('0x9'));var config=require(_0x4da4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4da4('0xb')][_0x4da4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x195401,_0x1b94f6,_0x18e9c8){return new BPromise(function(_0x2d8335,_0x38c1a2){return client[_0x4da4('0xd')](_0x195401,_0x18e9c8)[_0x4da4('0xe')](function(_0x15c9ba){logger[_0x4da4('0xf')](_0x4da4('0x10'),_0x1b94f6,_0x4da4('0x11'));logger['debug'](_0x4da4('0x12'),_0x1b94f6,_0x4da4('0x11'),JSON[_0x4da4('0x13')](_0x15c9ba));if(_0x15c9ba[_0x4da4('0x14')]){if(_0x15c9ba['error'][_0x4da4('0x15')]===0x1f4){logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x15c9ba['error'][_0x4da4('0x16')]);return _0x38c1a2(_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);}logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);return _0x2d8335(_0x15c9ba[_0x4da4('0x14')][_0x4da4('0x16')]);}else{logger[_0x4da4('0xf')](_0x4da4('0x10'),_0x1b94f6,_0x4da4('0x11'));_0x2d8335(_0x15c9ba[_0x4da4('0x17')][_0x4da4('0x16')]);}})['catch'](function(_0x531ce5){logger[_0x4da4('0x14')](_0x4da4('0x10'),_0x1b94f6,_0x531ce5);_0x38c1a2(_0x531ce5);});});}exports[_0x4da4('0x18')]=function(_0x3ca699){var _0x5a6832=this;return new Promise(function(_0x26cddc,_0x5dbf62){return db[_0x4da4('0x19')][_0x4da4('0x1a')](_0x3ca699[_0x4da4('0x1b')],{'raw':_0x3ca699[_0x4da4('0x1c')]?_0x3ca699[_0x4da4('0x1c')][_0x4da4('0x1d')]===undefined?!![]:![]:!![]})[_0x4da4('0xe')](function(_0xfb56ff){logger['info']('CreateChatQueueReport',_0x3ca699);logger[_0x4da4('0x1e')]('CreateChatQueueReport',_0x3ca699,JSON[_0x4da4('0x13')](_0xfb56ff));_0x26cddc(_0xfb56ff);})[_0x4da4('0x1f')](function(_0x52afc5){logger['error'](_0x4da4('0x18'),_0x52afc5[_0x4da4('0x16')],_0x3ca699);_0x5dbf62(_0x5a6832[_0x4da4('0x14')](0x1f4,_0x52afc5[_0x4da4('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x117ee7){var _0x39d6e9=this;return new Promise(function(_0x33ecf4,_0x5d289d){return db['ChatQueueReport'][_0x4da4('0x20')](_0x117ee7[_0x4da4('0x1b')],{'raw':_0x117ee7[_0x4da4('0x1c')]?_0x117ee7['options'][_0x4da4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117ee7['options']?_0x117ee7[_0x4da4('0x1c')][_0x4da4('0x21')]||null:null,'attributes':_0x117ee7[_0x4da4('0x1c')]?_0x117ee7[_0x4da4('0x1c')][_0x4da4('0x22')]||null:null,'limit':_0x117ee7[_0x4da4('0x1c')]?_0x117ee7[_0x4da4('0x1c')][_0x4da4('0x23')]||null:null})[_0x4da4('0xe')](function(_0x36370b){logger[_0x4da4('0xf')](_0x4da4('0x24'),_0x117ee7);logger[_0x4da4('0x1e')]('UpdateChatQueueReport',_0x117ee7,JSON[_0x4da4('0x13')](_0x36370b));_0x33ecf4(_0x36370b);})['catch'](function(_0x3ec659){logger['error'](_0x4da4('0x24'),_0x3ec659[_0x4da4('0x16')],_0x117ee7);_0x5d289d(_0x39d6e9[_0x4da4('0x14')](0x1f4,_0x3ec659[_0x4da4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 34f2e87..bf4ddb5 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 _0x623a=['/:id','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x623a,0x159));var _0xa623=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x623a[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa623('0x0'));var router=express[_0xa623('0x1')]();var fs_extra=require(_0xa623('0x2'));var auth=require(_0xa623('0x3'));var interaction=require(_0xa623('0x4'));var config=require(_0xa623('0x5'));var controller=require(_0xa623('0x6'));router[_0xa623('0x7')]('/',auth[_0xa623('0x8')](),controller[_0xa623('0x9')]);router[_0xa623('0x7')](_0xa623('0xa'),auth['isAuthenticated'](),controller[_0xa623('0xb')]);router[_0xa623('0x7')]('/:id',auth[_0xa623('0x8')](),controller[_0xa623('0xc')]);router['post']('/',auth[_0xa623('0x8')](),controller[_0xa623('0xd')]);router[_0xa623('0xe')](_0xa623('0xf'),auth[_0xa623('0x8')](),controller[_0xa623('0x10')]);router[_0xa623('0x11')](_0xa623('0xf'),auth[_0xa623('0x8')](),controller[_0xa623('0x12')]);module[_0xa623('0x13')]=router; \ No newline at end of file +var _0x2869=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','put','update'];(function(_0x38ca3a,_0x203a0b){var _0x3434f9=function(_0x167589){while(--_0x167589){_0x38ca3a['push'](_0x38ca3a['shift']());}};_0x3434f9(++_0x203a0b);}(_0x2869,0x102));var _0x9286=function(_0x12c042,_0x1c18bd){_0x12c042=_0x12c042-0x0;var _0xff80ce=_0x2869[_0x12c042];return _0xff80ce;};'use strict';var multer=require('multer');var util=require(_0x9286('0x0'));var path=require(_0x9286('0x1'));var timeout=require(_0x9286('0x2'));var express=require(_0x9286('0x3'));var router=express['Router']();var fs_extra=require(_0x9286('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9286('0x5'));var controller=require('./chatQueueReport.controller');router[_0x9286('0x6')]('/',auth[_0x9286('0x7')](),controller['index']);router[_0x9286('0x6')](_0x9286('0x8'),auth[_0x9286('0x7')](),controller['describe']);router[_0x9286('0x6')](_0x9286('0x9'),auth[_0x9286('0x7')](),controller[_0x9286('0xa')]);router[_0x9286('0xb')]('/',auth[_0x9286('0x7')](),controller['create']);router[_0x9286('0xc')](_0x9286('0x9'),auth[_0x9286('0x7')](),controller[_0x9286('0xd')]);router['delete'](_0x9286('0x9'),auth[_0x9286('0x7')](),controller[_0x9286('0xe')]);module[_0x9286('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ee80085..0b65ee0 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5e93a1,_0x1b188b){var _0xc4e764=function(_0x129a78){while(--_0x129a78){_0x5e93a1['push'](_0x5e93a1['shift']());}};_0xc4e764(++_0x1b188b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xcb91[_0x54ea7a];return _0x65a10d;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xf126a5,_0x4497ba){var _0x4c8b4b=function(_0x38539d){while(--_0x38539d){_0xf126a5['push'](_0xf126a5['shift']());}};_0x4c8b4b(++_0x4497ba);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0xf3cd[_0x4ab99];return _0x29e39c;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 08bc979..a5478ab 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 _0x2e2c=['type','merge','options','ChatTransferReport','includeAll','include','findAll','rows','catch','keys','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','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','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x4dbb37,_0x3389ae){var _0x32cb2d=function(_0xbd4e34){while(--_0xbd4e34){_0x4dbb37['push'](_0x4dbb37['shift']());}};_0x32cb2d(++_0x3389ae);}(_0x2e2c,0xa4));var _0xc2e2=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x2e2c[_0x46401e];return _0x447cba;};'use strict';var emlformat=require(_0xc2e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2e2('0x1'));var jsonpatch=require(_0xc2e2('0x2'));var rp=require('request-promise');var moment=require(_0xc2e2('0x3'));var BPromise=require(_0xc2e2('0x4'));var Mustache=require(_0xc2e2('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc2e2('0x6'));var csv=require(_0xc2e2('0x7'));var ejs=require(_0xc2e2('0x8'));var fs=require('fs');var fs_extra=require(_0xc2e2('0x9'));var _=require(_0xc2e2('0xa'));var squel=require(_0xc2e2('0xb'));var crypto=require(_0xc2e2('0xc'));var jsforce=require(_0xc2e2('0xd'));var deskjs=require(_0xc2e2('0xe'));var toCsv=require(_0xc2e2('0x7'));var querystring=require(_0xc2e2('0xf'));var Papa=require('papaparse');var Redis=require(_0xc2e2('0x10'));var authService=require(_0xc2e2('0x11'));var qs=require(_0xc2e2('0x12'));var as=require(_0xc2e2('0x13'));var hardwareService=require(_0xc2e2('0x14'));var logger=require(_0xc2e2('0x15'))(_0xc2e2('0x16'));var utils=require('../../config/utils');var config=require(_0xc2e2('0x17'));var licenseUtil=require(_0xc2e2('0x18'));var db=require(_0xc2e2('0x19'))['db'];function respondWithStatusCode(_0xb16fd2,_0x4a7134){_0x4a7134=_0x4a7134||0xcc;return function(_0x10d341){if(_0x10d341){return _0xb16fd2['sendStatus'](_0x4a7134);}return _0xb16fd2[_0xc2e2('0x1a')](_0x4a7134)['end']();};}function respondWithResult(_0x1d6553,_0x69123c){_0x69123c=_0x69123c||0xc8;return function(_0x4778ec){if(_0x4778ec){return _0x1d6553[_0xc2e2('0x1a')](_0x69123c)[_0xc2e2('0x1b')](_0x4778ec);}};}function respondWithFilteredResult(_0x505909,_0x40651a){return function(_0x284adf){if(_0x284adf){var _0x358a43=typeof _0x40651a[_0xc2e2('0x1c')]===_0xc2e2('0x1d')&&typeof _0x40651a['limit']==='undefined';var _0x5395b=_0x284adf[_0xc2e2('0x1e')];var _0x933cb2=_0x358a43?0x0:_0x40651a[_0xc2e2('0x1c')];var _0x52e34c=_0x358a43?_0x284adf['count']:_0x40651a['offset']+_0x40651a[_0xc2e2('0x1f')];var _0x9bd27c;if(_0x52e34c>=_0x5395b){_0x52e34c=_0x5395b;_0x9bd27c=0xc8;}else{_0x9bd27c=0xce;}_0x505909[_0xc2e2('0x1a')](_0x9bd27c);return _0x505909[_0xc2e2('0x20')](_0xc2e2('0x21'),_0x933cb2+'-'+_0x52e34c+'/'+_0x5395b)[_0xc2e2('0x1b')](_0x284adf);}return null;};}function patchUpdates(_0x3baa97){return function(_0x1fa59a){try{jsonpatch[_0xc2e2('0x22')](_0x1fa59a,_0x3baa97,!![]);}catch(_0x243126){return BPromise[_0xc2e2('0x23')](_0x243126);}return _0x1fa59a['save']();};}function saveUpdates(_0x55eeaa,_0x22df44){return function(_0x2f7323){if(_0x2f7323){return _0x2f7323[_0xc2e2('0x24')](_0x55eeaa)[_0xc2e2('0x25')](function(_0x1cfe77){return _0x1cfe77;});}return null;};}function removeEntity(_0x304328,_0x21723f){return function(_0x54298a){if(_0x54298a){return _0x54298a[_0xc2e2('0x26')]()['then'](function(){_0x304328[_0xc2e2('0x1a')](0xcc)[_0xc2e2('0x27')]();});}};}function handleEntityNotFound(_0x31ff,_0x4212d7){return function(_0x22331d){if(!_0x22331d){_0x31ff['sendStatus'](0x194);}return _0x22331d;};}function handleError(_0x973d2,_0x378325){_0x378325=_0x378325||0x1f4;return function(_0x1a7dd2){logger['error'](_0x1a7dd2[_0xc2e2('0x28')]);if(_0x1a7dd2[_0xc2e2('0x29')]){delete _0x1a7dd2['name'];}_0x973d2[_0xc2e2('0x1a')](_0x378325)[_0xc2e2('0x2a')](_0x1a7dd2);};}exports[_0xc2e2('0x2b')]=function(_0x4ac267,_0x5b2511){var _0x5365bd={},_0x2acb4c={},_0x3020b9={'count':0x0,'rows':[]};var _0x386208=_[_0xc2e2('0x2c')](db['ChatTransferReport'][_0xc2e2('0x2d')],function(_0x45ecd4){return{'name':_0x45ecd4[_0xc2e2('0x2e')],'type':_0x45ecd4['type'][_0xc2e2('0x2f')]};});_0x2acb4c[_0xc2e2('0x30')]=_['map'](_0x386208,'name');_0x2acb4c[_0xc2e2('0x31')]=_['keys'](_0x4ac267[_0xc2e2('0x31')]);_0x2acb4c[_0xc2e2('0x32')]=_[_0xc2e2('0x33')](_0x2acb4c[_0xc2e2('0x30')],_0x2acb4c[_0xc2e2('0x31')]);_0x5365bd['attributes']=_['intersection'](_0x2acb4c['model'],qs['fields'](_0x4ac267['query'][_0xc2e2('0x34')]));_0x5365bd[_0xc2e2('0x35')]=_0x5365bd['attributes'][_0xc2e2('0x36')]?_0x5365bd[_0xc2e2('0x35')]:_0x2acb4c['model'];if(!_0x4ac267['query'][_0xc2e2('0x37')](_0xc2e2('0x38'))){_0x5365bd[_0xc2e2('0x1f')]=qs[_0xc2e2('0x1f')](_0x4ac267['query'][_0xc2e2('0x1f')]);_0x5365bd[_0xc2e2('0x1c')]=qs[_0xc2e2('0x1c')](_0x4ac267[_0xc2e2('0x31')]['offset']);}_0x5365bd['order']=qs[_0xc2e2('0x39')](_0x4ac267[_0xc2e2('0x31')]['sort']);_0x5365bd[_0xc2e2('0x3a')]=qs['filters'](_[_0xc2e2('0x3b')](_0x4ac267[_0xc2e2('0x31')],_0x2acb4c[_0xc2e2('0x32')]),_0x386208);if(_0x4ac267[_0xc2e2('0x31')][_0xc2e2('0x3c')]){_0x5365bd[_0xc2e2('0x3a')]=_['merge'](_0x5365bd['where'],{'$or':_['map'](_0x386208,function(_0xc9aa79){if(_0xc9aa79[_0xc2e2('0x3d')]!=='VIRTUAL'){var _0x2022f5={};_0x2022f5[_0xc9aa79[_0xc2e2('0x29')]]={'$like':'%'+_0x4ac267[_0xc2e2('0x31')][_0xc2e2('0x3c')]+'%'};return _0x2022f5;}})});}_0x5365bd=_[_0xc2e2('0x3e')]({},_0x5365bd,_0x4ac267[_0xc2e2('0x3f')]);var _0xf3e154={'where':_0x5365bd[_0xc2e2('0x3a')]};return db[_0xc2e2('0x40')][_0xc2e2('0x1e')](_0xf3e154)[_0xc2e2('0x25')](function(_0x1b2fb3){_0x3020b9['count']=_0x1b2fb3;if(_0x4ac267[_0xc2e2('0x31')][_0xc2e2('0x41')]){_0x5365bd[_0xc2e2('0x42')]=[{'all':!![]}];}return db[_0xc2e2('0x40')][_0xc2e2('0x43')](_0x5365bd);})[_0xc2e2('0x25')](function(_0x2c06d9){_0x3020b9[_0xc2e2('0x44')]=_0x2c06d9;return _0x3020b9;})[_0xc2e2('0x25')](respondWithFilteredResult(_0x5b2511,_0x5365bd))[_0xc2e2('0x45')](handleError(_0x5b2511,null));};exports['show']=function(_0xdb553d,_0x36e3e7){var _0x8914ff={'raw':!![],'where':{'id':_0xdb553d['params']['id']}},_0x2c05a1={};_0x2c05a1['model']=_[_0xc2e2('0x46')](db['ChatTransferReport'][_0xc2e2('0x2d')]);_0x2c05a1['query']=_[_0xc2e2('0x46')](_0xdb553d[_0xc2e2('0x31')]);_0x2c05a1['filters']=_['intersection'](_0x2c05a1[_0xc2e2('0x30')],_0x2c05a1[_0xc2e2('0x31')]);_0x8914ff[_0xc2e2('0x35')]=_[_0xc2e2('0x33')](_0x2c05a1['model'],qs[_0xc2e2('0x34')](_0xdb553d[_0xc2e2('0x31')]['fields']));_0x8914ff[_0xc2e2('0x35')]=_0x8914ff[_0xc2e2('0x35')][_0xc2e2('0x36')]?_0x8914ff[_0xc2e2('0x35')]:_0x2c05a1['model'];if(_0xdb553d[_0xc2e2('0x31')][_0xc2e2('0x41')]){_0x8914ff[_0xc2e2('0x42')]=[{'all':!![]}];}_0x8914ff=_['merge']({},_0x8914ff,_0xdb553d['options']);return db['ChatTransferReport'][_0xc2e2('0x47')](_0x8914ff)[_0xc2e2('0x25')](handleEntityNotFound(_0x36e3e7,null))[_0xc2e2('0x25')](respondWithResult(_0x36e3e7,null))[_0xc2e2('0x45')](handleError(_0x36e3e7,null));};exports[_0xc2e2('0x48')]=function(_0x3bba86,_0x128225){return db[_0xc2e2('0x40')][_0xc2e2('0x48')](_0x3bba86[_0xc2e2('0x49')],{})[_0xc2e2('0x25')](respondWithResult(_0x128225,0xc9))[_0xc2e2('0x45')](handleError(_0x128225,null));};exports[_0xc2e2('0x24')]=function(_0x1ab051,_0x57aeb3){if(_0x1ab051['body']['id']){delete _0x1ab051[_0xc2e2('0x49')]['id'];}return db[_0xc2e2('0x40')][_0xc2e2('0x47')]({'where':{'id':_0x1ab051[_0xc2e2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57aeb3,null))[_0xc2e2('0x25')](saveUpdates(_0x1ab051[_0xc2e2('0x49')],null))[_0xc2e2('0x25')](respondWithResult(_0x57aeb3,null))['catch'](handleError(_0x57aeb3,null));};exports['destroy']=function(_0x4b1676,_0x24fa0f){return db[_0xc2e2('0x40')][_0xc2e2('0x47')]({'where':{'id':_0x4b1676['params']['id']}})[_0xc2e2('0x25')](handleEntityNotFound(_0x24fa0f,null))['then'](removeEntity(_0x24fa0f,null))[_0xc2e2('0x45')](handleError(_0x24fa0f,null));};exports['describe']=function(_0x52b193,_0x104a05){return db[_0xc2e2('0x40')]['describe']()[_0xc2e2('0x25')](respondWithResult(_0x104a05,null))[_0xc2e2('0x45')](handleError(_0x104a05,null));}; \ No newline at end of file +var _0x5fa3=['index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','ChatTransferReport','includeAll','findAll','rows','catch','show','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0xef3494,_0x21bbab){var _0x3be533=function(_0x8b1130){while(--_0x8b1130){_0xef3494['push'](_0xef3494['shift']());}};_0x3be533(++_0x21bbab);}(_0x5fa3,0xc1));var _0x35fa=function(_0x2b448c,_0x2130ce){_0x2b448c=_0x2b448c-0x0;var _0x1e7133=_0x5fa3[_0x2b448c];return _0x1e7133;};'use strict';var emlformat=require(_0x35fa('0x0'));var rimraf=require(_0x35fa('0x1'));var zipdir=require(_0x35fa('0x2'));var jsonpatch=require(_0x35fa('0x3'));var rp=require('request-promise');var moment=require(_0x35fa('0x4'));var BPromise=require(_0x35fa('0x5'));var Mustache=require(_0x35fa('0x6'));var util=require(_0x35fa('0x7'));var path=require(_0x35fa('0x8'));var sox=require(_0x35fa('0x9'));var csv=require(_0x35fa('0xa'));var ejs=require(_0x35fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fa('0xc'));var squel=require(_0x35fa('0xd'));var crypto=require(_0x35fa('0xe'));var jsforce=require(_0x35fa('0xf'));var deskjs=require(_0x35fa('0x10'));var toCsv=require(_0x35fa('0xa'));var querystring=require(_0x35fa('0x11'));var Papa=require(_0x35fa('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35fa('0x13'));var logger=require(_0x35fa('0x14'))(_0x35fa('0x15'));var utils=require(_0x35fa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x35fa('0x17'));var db=require(_0x35fa('0x18'))['db'];function respondWithStatusCode(_0x5b46d7,_0x1977ec){_0x1977ec=_0x1977ec||0xcc;return function(_0x2a6c52){if(_0x2a6c52){return _0x5b46d7['sendStatus'](_0x1977ec);}return _0x5b46d7['status'](_0x1977ec)[_0x35fa('0x19')]();};}function respondWithResult(_0x19df6b,_0x444ab3){_0x444ab3=_0x444ab3||0xc8;return function(_0x24b1cd){if(_0x24b1cd){return _0x19df6b['status'](_0x444ab3)[_0x35fa('0x1a')](_0x24b1cd);}};}function respondWithFilteredResult(_0x5845a1,_0x38e2a6){return function(_0x1597b0){if(_0x1597b0){var _0x33457a=typeof _0x38e2a6[_0x35fa('0x1b')]===_0x35fa('0x1c')&&typeof _0x38e2a6[_0x35fa('0x1d')]===_0x35fa('0x1c');var _0x5071eb=_0x1597b0[_0x35fa('0x1e')];var _0x445a40=_0x33457a?0x0:_0x38e2a6[_0x35fa('0x1b')];var _0x138e15=_0x33457a?_0x1597b0['count']:_0x38e2a6[_0x35fa('0x1b')]+_0x38e2a6[_0x35fa('0x1d')];var _0x183d65;if(_0x138e15>=_0x5071eb){_0x138e15=_0x5071eb;_0x183d65=0xc8;}else{_0x183d65=0xce;}_0x5845a1[_0x35fa('0x1f')](_0x183d65);return _0x5845a1[_0x35fa('0x20')](_0x35fa('0x21'),_0x445a40+'-'+_0x138e15+'/'+_0x5071eb)['json'](_0x1597b0);}return null;};}function patchUpdates(_0x356027){return function(_0x2903b7){try{jsonpatch['apply'](_0x2903b7,_0x356027,!![]);}catch(_0x182238){return BPromise[_0x35fa('0x22')](_0x182238);}return _0x2903b7[_0x35fa('0x23')]();};}function saveUpdates(_0x4d7af0,_0x271fff){return function(_0x33d7eb){if(_0x33d7eb){return _0x33d7eb[_0x35fa('0x24')](_0x4d7af0)[_0x35fa('0x25')](function(_0x373d81){return _0x373d81;});}return null;};}function removeEntity(_0x59a033,_0x4beedd){return function(_0x14c2fd){if(_0x14c2fd){return _0x14c2fd[_0x35fa('0x26')]()['then'](function(){_0x59a033[_0x35fa('0x1f')](0xcc)[_0x35fa('0x19')]();});}};}function handleEntityNotFound(_0x101ac9,_0x1d4054){return function(_0xc9a54){if(!_0xc9a54){_0x101ac9[_0x35fa('0x27')](0x194);}return _0xc9a54;};}function handleError(_0x16cfc3,_0x22a1a0){_0x22a1a0=_0x22a1a0||0x1f4;return function(_0x471819){logger[_0x35fa('0x28')](_0x471819[_0x35fa('0x29')]);if(_0x471819[_0x35fa('0x2a')]){delete _0x471819['name'];}_0x16cfc3[_0x35fa('0x1f')](_0x22a1a0)[_0x35fa('0x2b')](_0x471819);};}exports[_0x35fa('0x2c')]=function(_0x525560,_0x43f127){var _0x8ea3b6={},_0x5a8f78={},_0x4a2cc3={'count':0x0,'rows':[]};var _0x5eb9c6=_['map'](db['ChatTransferReport'][_0x35fa('0x2d')],function(_0x1142d4){return{'name':_0x1142d4[_0x35fa('0x2e')],'type':_0x1142d4[_0x35fa('0x2f')][_0x35fa('0x30')]};});_0x5a8f78['model']=_[_0x35fa('0x31')](_0x5eb9c6,_0x35fa('0x2a'));_0x5a8f78[_0x35fa('0x32')]=_['keys'](_0x525560[_0x35fa('0x32')]);_0x5a8f78[_0x35fa('0x33')]=_[_0x35fa('0x34')](_0x5a8f78[_0x35fa('0x35')],_0x5a8f78[_0x35fa('0x32')]);_0x8ea3b6[_0x35fa('0x36')]=_[_0x35fa('0x34')](_0x5a8f78['model'],qs[_0x35fa('0x37')](_0x525560[_0x35fa('0x32')][_0x35fa('0x37')]));_0x8ea3b6[_0x35fa('0x36')]=_0x8ea3b6[_0x35fa('0x36')][_0x35fa('0x38')]?_0x8ea3b6[_0x35fa('0x36')]:_0x5a8f78[_0x35fa('0x35')];if(!_0x525560[_0x35fa('0x32')][_0x35fa('0x39')](_0x35fa('0x3a'))){_0x8ea3b6['limit']=qs['limit'](_0x525560[_0x35fa('0x32')]['limit']);_0x8ea3b6['offset']=qs['offset'](_0x525560['query'][_0x35fa('0x1b')]);}_0x8ea3b6[_0x35fa('0x3b')]=qs[_0x35fa('0x3c')](_0x525560[_0x35fa('0x32')][_0x35fa('0x3c')]);_0x8ea3b6['where']=qs[_0x35fa('0x33')](_[_0x35fa('0x3d')](_0x525560[_0x35fa('0x32')],_0x5a8f78[_0x35fa('0x33')]),_0x5eb9c6);if(_0x525560['query'][_0x35fa('0x3e')]){_0x8ea3b6[_0x35fa('0x3f')]=_['merge'](_0x8ea3b6[_0x35fa('0x3f')],{'$or':_[_0x35fa('0x31')](_0x5eb9c6,function(_0x1b249f){if(_0x1b249f['type']!==_0x35fa('0x40')){var _0x256f3f={};_0x256f3f[_0x1b249f[_0x35fa('0x2a')]]={'$like':'%'+_0x525560['query']['filter']+'%'};return _0x256f3f;}})});}_0x8ea3b6=_[_0x35fa('0x41')]({},_0x8ea3b6,_0x525560['options']);var _0x275a0f={'where':_0x8ea3b6[_0x35fa('0x3f')]};return db[_0x35fa('0x42')][_0x35fa('0x1e')](_0x275a0f)[_0x35fa('0x25')](function(_0x2c6c9c){_0x4a2cc3[_0x35fa('0x1e')]=_0x2c6c9c;if(_0x525560[_0x35fa('0x32')][_0x35fa('0x43')]){_0x8ea3b6['include']=[{'all':!![]}];}return db[_0x35fa('0x42')][_0x35fa('0x44')](_0x8ea3b6);})[_0x35fa('0x25')](function(_0x52d3d8){_0x4a2cc3[_0x35fa('0x45')]=_0x52d3d8;return _0x4a2cc3;})[_0x35fa('0x25')](respondWithFilteredResult(_0x43f127,_0x8ea3b6))[_0x35fa('0x46')](handleError(_0x43f127,null));};exports[_0x35fa('0x47')]=function(_0x11a903,_0x3d0a84){var _0x4840a9={'raw':!![],'where':{'id':_0x11a903['params']['id']}},_0x429230={};_0x429230['model']=_['keys'](db[_0x35fa('0x42')][_0x35fa('0x2d')]);_0x429230[_0x35fa('0x32')]=_['keys'](_0x11a903['query']);_0x429230[_0x35fa('0x33')]=_[_0x35fa('0x34')](_0x429230['model'],_0x429230['query']);_0x4840a9['attributes']=_['intersection'](_0x429230[_0x35fa('0x35')],qs[_0x35fa('0x37')](_0x11a903[_0x35fa('0x32')]['fields']));_0x4840a9[_0x35fa('0x36')]=_0x4840a9[_0x35fa('0x36')][_0x35fa('0x38')]?_0x4840a9[_0x35fa('0x36')]:_0x429230[_0x35fa('0x35')];if(_0x11a903[_0x35fa('0x32')][_0x35fa('0x43')]){_0x4840a9[_0x35fa('0x48')]=[{'all':!![]}];}_0x4840a9=_['merge']({},_0x4840a9,_0x11a903[_0x35fa('0x49')]);return db['ChatTransferReport']['find'](_0x4840a9)[_0x35fa('0x25')](handleEntityNotFound(_0x3d0a84,null))[_0x35fa('0x25')](respondWithResult(_0x3d0a84,null))[_0x35fa('0x46')](handleError(_0x3d0a84,null));};exports[_0x35fa('0x4a')]=function(_0x3f27ea,_0x558dd9){return db['ChatTransferReport'][_0x35fa('0x4a')](_0x3f27ea[_0x35fa('0x4b')],{})[_0x35fa('0x25')](respondWithResult(_0x558dd9,0xc9))[_0x35fa('0x46')](handleError(_0x558dd9,null));};exports['update']=function(_0x36b2c4,_0x30f406){if(_0x36b2c4[_0x35fa('0x4b')]['id']){delete _0x36b2c4[_0x35fa('0x4b')]['id'];}return db[_0x35fa('0x42')][_0x35fa('0x4c')]({'where':{'id':_0x36b2c4[_0x35fa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30f406,null))[_0x35fa('0x25')](saveUpdates(_0x36b2c4[_0x35fa('0x4b')],null))['then'](respondWithResult(_0x30f406,null))['catch'](handleError(_0x30f406,null));};exports[_0x35fa('0x26')]=function(_0x384963,_0xe11102){return db[_0x35fa('0x42')][_0x35fa('0x4c')]({'where':{'id':_0x384963['params']['id']}})[_0x35fa('0x25')](handleEntityNotFound(_0xe11102,null))[_0x35fa('0x25')](removeEntity(_0xe11102,null))['catch'](handleError(_0xe11102,null));};exports[_0x35fa('0x4e')]=function(_0x42e178,_0x44f7e1){return db['ChatTransferReport'][_0x35fa('0x4e')]()[_0x35fa('0x25')](respondWithResult(_0x44f7e1,null))[_0x35fa('0x46')](handleError(_0x44f7e1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e27c14f..64122e9 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 _0xc57f=['api','moment','path','rimraf','../../config/environment','exports','define','ChatTransferReport','uniqueid','lodash','../../config/logger'];(function(_0x44d658,_0x5913f6){var _0x4bf7f3=function(_0x4550ad){while(--_0x4550ad){_0x44d658['push'](_0x44d658['shift']());}};_0x4bf7f3(++_0x5913f6);}(_0xc57f,0x98));var _0xfc57=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xc57f[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xfc57('0x0'));var util=require('util');var logger=require(_0xfc57('0x1'))(_0xfc57('0x2'));var moment=require(_0xfc57('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc57('0x4'));var rimraf=require(_0xfc57('0x5'));var config=require(_0xfc57('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0xfc57('0x7')]=function(_0xbcb4dc,_0xb777ba){return _0xbcb4dc[_0xfc57('0x8')](_0xfc57('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xfc57('0xa'),'fields':[_0xfc57('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eba=['./chatTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16dc61,_0x347337){var _0x39b213=function(_0x2ea896){while(--_0x2ea896){_0x16dc61['push'](_0x16dc61['shift']());}};_0x39b213(++_0x347337);}(_0x3eba,0x108));var _0xa3eb=function(_0x5619e7,_0x314577){_0x5619e7=_0x5619e7-0x0;var _0x399cb1=_0x3eba[_0x5619e7];return _0x399cb1;};'use strict';var _=require('lodash');var util=require(_0xa3eb('0x0'));var logger=require(_0xa3eb('0x1'))(_0xa3eb('0x2'));var moment=require(_0xa3eb('0x3'));var BPromise=require(_0xa3eb('0x4'));var rp=require(_0xa3eb('0x5'));var fs=require('fs');var path=require(_0xa3eb('0x6'));var rimraf=require(_0xa3eb('0x7'));var config=require(_0xa3eb('0x8'));var attributes=require(_0xa3eb('0x9'));module[_0xa3eb('0xa')]=function(_0x48dafe,_0x4d6ff2){return _0x48dafe[_0xa3eb('0xb')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa3eb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 571d51c..5f250d9 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 _0xb169=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x28e6e4,_0x2f6728){var _0x16b271=function(_0x53cec0){while(--_0x53cec0){_0x28e6e4['push'](_0x28e6e4['shift']());}};_0x16b271(++_0x2f6728);}(_0xb169,0x8c));var _0x9b16=function(_0x2920dd,_0x19d049){_0x2920dd=_0x2920dd-0x0;var _0x5d4e52=_0xb169[_0x2920dd];return _0x5d4e52;};'use strict';var _=require(_0x9b16('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b16('0x1'));var rs=require(_0x9b16('0x2'));var fs=require('fs');var Redis=require(_0x9b16('0x3'));var db=require(_0x9b16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b16('0x5'))(_0x9b16('0x6'));var config=require(_0x9b16('0x7'));var jayson=require(_0x9b16('0x8'));var client=jayson[_0x9b16('0x9')][_0x9b16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b19f0,_0x40509a,_0x1611be){return new BPromise(function(_0x588242,_0x5d8482){return client['request'](_0x4b19f0,_0x1611be)[_0x9b16('0xb')](function(_0x35877e){logger[_0x9b16('0xc')](_0x9b16('0xd'),_0x40509a,_0x9b16('0xe'));logger[_0x9b16('0xf')](_0x9b16('0x10'),_0x40509a,_0x9b16('0xe'),JSON[_0x9b16('0x11')](_0x35877e));if(_0x35877e['error']){if(_0x35877e[_0x9b16('0x12')]['code']===0x1f4){logger[_0x9b16('0x12')](_0x9b16('0xd'),_0x40509a,_0x35877e['error']['message']);return _0x5d8482(_0x35877e['error']['message']);}logger[_0x9b16('0x12')](_0x9b16('0xd'),_0x40509a,_0x35877e['error']['message']);return _0x588242(_0x35877e[_0x9b16('0x12')][_0x9b16('0x13')]);}else{logger[_0x9b16('0xc')](_0x9b16('0xd'),_0x40509a,_0x9b16('0xe'));_0x588242(_0x35877e[_0x9b16('0x14')][_0x9b16('0x13')]);}})[_0x9b16('0x15')](function(_0x7ed35a){logger[_0x9b16('0x12')](_0x9b16('0xd'),_0x40509a,_0x7ed35a);_0x5d8482(_0x7ed35a);});});} \ No newline at end of file +var _0xf94d=['ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37a3f3,_0x663b49){var _0x4da923=function(_0x47713f){while(--_0x47713f){_0x37a3f3['push'](_0x37a3f3['shift']());}};_0x4da923(++_0x663b49);}(_0xf94d,0x13e));var _0xdf94=function(_0x3bf780,_0x38917d){_0x3bf780=_0x3bf780-0x0;var _0x145df2=_0xf94d[_0x3bf780];return _0x145df2;};'use strict';var _=require(_0xdf94('0x0'));var util=require(_0xdf94('0x1'));var moment=require(_0xdf94('0x2'));var BPromise=require(_0xdf94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf94('0x4'))['db'];var utils=require(_0xdf94('0x5'));var logger=require(_0xdf94('0x6'))('rpc');var config=require(_0xdf94('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf94('0x8')][_0xdf94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20921b,_0x3cea31,_0x4cd1cd){return new BPromise(function(_0x29f3aa,_0x5e9c5e){return client[_0xdf94('0xa')](_0x20921b,_0x4cd1cd)['then'](function(_0x1d1514){logger[_0xdf94('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3cea31,_0xdf94('0xc'));logger[_0xdf94('0xd')](_0xdf94('0xe'),_0x3cea31,'request\x20sent',JSON[_0xdf94('0xf')](_0x1d1514));if(_0x1d1514[_0xdf94('0x10')]){if(_0x1d1514[_0xdf94('0x10')][_0xdf94('0x11')]===0x1f4){logger[_0xdf94('0x10')](_0xdf94('0x12'),_0x3cea31,_0x1d1514[_0xdf94('0x10')][_0xdf94('0x13')]);return _0x5e9c5e(_0x1d1514[_0xdf94('0x10')]['message']);}logger['error'](_0xdf94('0x12'),_0x3cea31,_0x1d1514['error'][_0xdf94('0x13')]);return _0x29f3aa(_0x1d1514[_0xdf94('0x10')][_0xdf94('0x13')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3cea31,_0xdf94('0xc'));_0x29f3aa(_0x1d1514['result']['message']);}})[_0xdf94('0x14')](function(_0x4b2b8f){logger[_0xdf94('0x10')](_0xdf94('0x12'),_0x3cea31,_0x4b2b8f);_0x5e9c5e(_0x4b2b8f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 72e72c3..2982049 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 _0xdc00=['index','get','describe','create','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated'];(function(_0x5c2161,_0x5a1984){var _0x377c24=function(_0xe43a12){while(--_0xe43a12){_0x5c2161['push'](_0x5c2161['shift']());}};_0x377c24(++_0x5a1984);}(_0xdc00,0x1ca));var _0x0dc0=function(_0x46e017,_0x25e4a9){_0x46e017=_0x46e017-0x0;var _0x56f77d=_0xdc00[_0x46e017];return _0x56f77d;};'use strict';var multer=require(_0x0dc0('0x0'));var util=require('util');var path=require(_0x0dc0('0x1'));var timeout=require(_0x0dc0('0x2'));var express=require(_0x0dc0('0x3'));var router=express[_0x0dc0('0x4')]();var fs_extra=require(_0x0dc0('0x5'));var auth=require(_0x0dc0('0x6'));var interaction=require(_0x0dc0('0x7'));var config=require('../../config/environment');var controller=require(_0x0dc0('0x8'));router['get']('/',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xa')]);router[_0x0dc0('0xb')]('/describe',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xc')]);router[_0x0dc0('0xb')]('/:id',auth[_0x0dc0('0x9')](),controller['show']);router['post']('/',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xd')]);router[_0x0dc0('0xe')](_0x0dc0('0xf'),auth[_0x0dc0('0x9')](),controller[_0x0dc0('0x10')]);router['delete'](_0x0dc0('0xf'),auth[_0x0dc0('0x9')](),controller[_0x0dc0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x95cc=['index','/:id','show','post','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x5382bd,_0x386378){var _0x141d54=function(_0x5a6caa){while(--_0x5a6caa){_0x5382bd['push'](_0x5382bd['shift']());}};_0x141d54(++_0x386378);}(_0x95cc,0xc7));var _0xc95c=function(_0x29fcea,_0x257199){_0x29fcea=_0x29fcea-0x0;var _0x243673=_0x95cc[_0x29fcea];return _0x243673;};'use strict';var multer=require(_0xc95c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc95c('0x1'));var router=express[_0xc95c('0x2')]();var fs_extra=require(_0xc95c('0x3'));var auth=require(_0xc95c('0x4'));var interaction=require(_0xc95c('0x5'));var config=require(_0xc95c('0x6'));var controller=require(_0xc95c('0x7'));router[_0xc95c('0x8')]('/',auth[_0xc95c('0x9')](),controller[_0xc95c('0xa')]);router[_0xc95c('0x8')]('/describe',auth[_0xc95c('0x9')](),controller['describe']);router[_0xc95c('0x8')](_0xc95c('0xb'),auth[_0xc95c('0x9')](),controller[_0xc95c('0xc')]);router[_0xc95c('0xd')]('/',auth[_0xc95c('0x9')](),controller['create']);router[_0xc95c('0xe')](_0xc95c('0xb'),auth[_0xc95c('0x9')](),controller[_0xc95c('0xf')]);router[_0xc95c('0x10')](_0xc95c('0xb'),auth[_0xc95c('0x9')](),controller[_0xc95c('0x11')]);module[_0xc95c('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4f52a47..0022417 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 _0x7045=['TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY'];(function(_0x2e0967,_0x3fd097){var _0x180b59=function(_0x1048f2){while(--_0x1048f2){_0x2e0967['push'](_0x2e0967['shift']());}};_0x180b59(++_0x3fd097);}(_0x7045,0x1cc));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5704('0x0'));var rs=require(_0x5704('0x1'));module['exports']={'name':{'type':Sequelize[_0x5704('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x3')},'mapKeyOffline':{'type':Sequelize[_0x5704('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x5704('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x4')},'customerAlias':{'type':Sequelize[_0x5704('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5704('0x2')],'allowNull':![],'defaultValue':_0x5704('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5704('0x2')],'allowNull':![],'defaultValue':_0x5704('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5704('0x2')],'allowNull':![],'defaultValue':_0x5704('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5704('0x2')]},'animation':{'type':Sequelize[_0x5704('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5704('0x8')]('rounded',_0x5704('0x9')),'defaultValue':_0x5704('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0xb')},'start_chat_button':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0xc')},'offline_chat_button':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0xd')},'header_offline':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0xe')},'download_transcript':{'type':Sequelize[_0x5704('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5704('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x5704('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5704('0x11')]},'closingQuestion':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x14')},'noteTitle':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x15')},'placeholderMessage':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0x17')},'closingMessageButton':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0xd')},'skipMessageButton':{'type':Sequelize[_0x5704('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x18')},'ratingType':{'type':Sequelize[_0x5704('0x8')](_0x5704('0x19'),_0x5704('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x5704('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5704('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5704('0x1b'),'variable':null,'config':{'placeholder':_0x5704('0x1c'),'type':_0x5704('0x1d'),'required':!![]},'props':{'title':_0x5704('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5704('0x3'),'type':_0x5704('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5704('0x1e')](_0x5704('0x1f'))?JSON[_0x5704('0x20')](this[_0x5704('0x1e')]('onlineForm')):{};},'set':function(_0x571e54){return this[_0x5704('0x21')]('onlineForm',JSON[_0x5704('0x22')](_0x571e54));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5704('0x1b'),'props':{'title':_0x5704('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x5704('0x3'),'type':_0x5704('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5704('0x23')},'props':{'title':_0x5704('0x23'),'helpText':_0x5704('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x5704('0x25'))?JSON[_0x5704('0x20')](this['getDataValue'](_0x5704('0x25'))):{};},'set':function(_0x51cce1){return this[_0x5704('0x21')]('offlineForm',JSON[_0x5704('0x22')](_0x51cce1));}},'token':{'type':Sequelize[_0x5704('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5704('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0x28')},'offlineMessageBody':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x5704('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5704('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5704('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5704('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5704('0x11')],'defaultValue':function(){return _0x5704('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5704('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5704('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5704('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x5704('0xf')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x2d')},'messagesAlignment':{'type':Sequelize[_0x5704('0x2')],'defaultValue':_0x5704('0x2e')},'defaultTitle':{'type':Sequelize[_0x5704('0x2')]},'customerAvatar':{'type':Sequelize[_0x5704('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5704('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5704('0x2')],'allowNull':![],'defaultValue':_0x5704('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5704('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5704('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5704('0x30')},'systemAvatar':{'type':Sequelize[_0x5704('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5704('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![],'comment':_0x5704('0x31'),'set':function(_0x5e1fb0){if(!_0x5e1fb0)this[_0x5704('0x21')](_0x5704('0x32'),null);this[_0x5704('0x21')](_0x5704('0x33'),_0x5e1fb0);}},'vidaooEscalation':{'type':Sequelize[_0x5704('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5704('0x2')]},'vidaooTopic':{'type':Sequelize[_0x5704('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x5704('0x2')],'defaultValue':function(){return _0x5704('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5704('0x11')]}}; \ No newline at end of file +var _0x280e=['All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#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','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','input','name','text','getDataValue','parse','onlineForm','setDataValue','stringify','Comments','offlineForm','generate'];(function(_0x4169ff,_0x546a37){var _0x4f8185=function(_0x346823){while(--_0x346823){_0x4169ff['push'](_0x4169ff['shift']());}};_0x4f8185(++_0x546a37);}(_0x280e,0xf2));var _0xe280=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x280e[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0xe280('0x0'));var rs=require(_0xe280('0x1'));module['exports']={'name':{'type':Sequelize[_0xe280('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'unique':_0xe280('0x3')},'description':{'type':Sequelize[_0xe280('0x2')]},'mapKey':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xe280('0x4')},'key':{'type':Sequelize[_0xe280('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'defaultValue':_0xe280('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'defaultValue':_0xe280('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'defaultValue':_0xe280('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe280('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xe280('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe280('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe280('0x9')](_0xe280('0xa'),_0xe280('0xb')),'defaultValue':_0xe280('0xa')},'header_online':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xe280('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xe280('0xd')},'header_offline':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xe280('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe280('0x10')]},'closingQuestion':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe280('0x14')},'closingMessageButton':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x15')},'ratingType':{'type':Sequelize[_0xe280('0x9')]('star','thumb'),'defaultValue':_0xe280('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xe280('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe280('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe280('0x17'),'variable':null,'config':{'placeholder':_0xe280('0x18'),'type':_0xe280('0x19'),'required':!![]},'props':{'title':_0xe280('0x18'),'helpText':''}},{'type':_0xe280('0x17'),'props':{'title':_0xe280('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe280('0x4'),'type':_0xe280('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe280('0x1a')]('onlineForm')?JSON[_0xe280('0x1b')](this[_0xe280('0x1a')](_0xe280('0x1c'))):{};},'set':function(_0xd4683f){return this[_0xe280('0x1d')](_0xe280('0x1c'),JSON[_0xe280('0x1e')](_0xd4683f));}},'offlineForm':{'type':Sequelize[_0xe280('0x10')],'defaultValue':function(){return JSON[_0xe280('0x1e')]({'items':[{'type':_0xe280('0x17'),'props':{'title':_0xe280('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe280('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0xe280('0x1f')},'props':{'title':_0xe280('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe280('0x1a')](_0xe280('0x20'))?JSON[_0xe280('0x1b')](this['getDataValue'](_0xe280('0x20'))):{};},'set':function(_0x5ab89b){return this[_0xe280('0x1d')]('offlineForm',JSON[_0xe280('0x1e')](_0x5ab89b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe280('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe280('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe280('0x22')},'waitingMessage':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x23')},'offlineMessageBody':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe280('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe280('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe280('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe280('0x10')],'defaultValue':function(){return _0xe280('0x24');}},'notificationSound':{'type':Sequelize[_0xe280('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xe280('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe280('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x25')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x26')},'messagesAlignment':{'type':Sequelize[_0xe280('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe280('0x2')]},'customerAvatar':{'type':Sequelize[_0xe280('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe280('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'defaultValue':_0xe280('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe280('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe280('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe280('0x2')],'defaultValue':_0xe280('0x28')},'systemAvatar':{'type':Sequelize[_0xe280('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe280('0x29')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe280('0x2a'),'set':function(_0x2ff267){if(!_0x2ff267)this['setDataValue'](_0xe280('0x2b'),null);this[_0xe280('0x1d')](_0xe280('0x2c'),_0x2ff267);}},'vidaooEscalation':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe280('0x2')]},'vidaooTopic':{'type':Sequelize[_0xe280('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xe280('0x2d');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe280('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe280('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a791a14..1cde8c5 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 _0x4e8a=['*,*,*,*','ChatMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','difference','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','files','attachments','basename','openNewInteraction','sequelize','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','getProactiveActions','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','headers','replace','testWebsiteWithWildcard','remote','x-real-ip','connection','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','omit','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','APIConflictError','URL','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','offset','undefined','limit','count','status','Content-Range','update','then','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','user-agent','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','%s\x20%s\x20%s','device','model','vendor','type','stringify','Pause','map','ChatWebsite','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','options','where','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','describe','ChatWebsiteId','Disposition','getDispositions','removeDispositions','CannedAnswer','getAnswers','findOne','pick','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','createdAt','updatedAt','CompanyId','includes','mapKey','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','Applications','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','list','ListId','defaults','contact','threadId','closed','ChatInteraction','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','lastName','messageId','created','push','close','unmanaged'];(function(_0x2d88d5,_0x166b23){var _0x13edaa=function(_0xa8dfb1){while(--_0xa8dfb1){_0x2d88d5['push'](_0x2d88d5['shift']());}};_0x13edaa(++_0x166b23);}(_0x4e8a,0x1ae));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0xa4e8('0x0'));var util=require(_0xa4e8('0x1'));var path=require(_0xa4e8('0x2'));var ejs=require(_0xa4e8('0x3'));var fs=require('fs');var fs_extra=require(_0xa4e8('0x4'));var _=require(_0xa4e8('0x5'));var querystring=require(_0xa4e8('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xa4e8('0x7'));var jayson=require(_0xa4e8('0x8'));var qs=require(_0xa4e8('0x9'));var logger=require('../../config/logger')(_0xa4e8('0xa'));var config=require(_0xa4e8('0xb'));var APIBadRequestError=require(_0xa4e8('0xc'))[_0xa4e8('0xd')];var APINotFoundError=require('../../errors/api')[_0xa4e8('0xe')];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xa4e8('0xf')];var APIConflictError=require(_0xa4e8('0xc'))[_0xa4e8('0x10')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0xa4e8('0x11')];var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xa4e8('0x12')],{'host':_0xa4e8('0x13'),'port':0x18eb});var socket=require(_0xa4e8('0x14'))(new Redis(config['redis']));require(_0xa4e8('0x15'))[_0xa4e8('0x16')](socket);var client=jayson[_0xa4e8('0x17')][_0xa4e8('0x18')]({'port':0x232c});var client9002=jayson['client'][_0xa4e8('0x18')]({'port':0x232a});var client9003=jayson['client'][_0xa4e8('0x18')]({'port':0x232b});var client9001=jayson[_0xa4e8('0x17')][_0xa4e8('0x18')]({'port':0x2329});function respondWithRpcPromise(_0xafc910,_0x4e6467,_0x5b9c52,_0x37bbc8){return new Promise(function(_0x5c16b0,_0x43b6ce){var _0x158767=_0x37bbc8||client;return _0x158767[_0xa4e8('0x19')](_0xafc910,_0x5b9c52)['then'](function(_0xb85874){logger[_0xa4e8('0x1a')](_0xa4e8('0x1b'),_0x4e6467,_0xa4e8('0x1c'));logger[_0xa4e8('0x1d')](_0xa4e8('0x1e'),_0x4e6467,_0xa4e8('0x1c'),JSON['stringify'](_0xb85874));if(_0xb85874['error']){if(_0xb85874[_0xa4e8('0x1f')][_0xa4e8('0x20')]===0x1f4){logger['error'](_0xa4e8('0x1b'),_0x4e6467,_0xb85874['error'][_0xa4e8('0x21')]);return _0x43b6ce(_0xb85874[_0xa4e8('0x1f')][_0xa4e8('0x21')]);}logger[_0xa4e8('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x4e6467,_0xb85874[_0xa4e8('0x1f')][_0xa4e8('0x21')]);return _0x5c16b0(_0xb85874[_0xa4e8('0x1f')][_0xa4e8('0x21')]);}else{logger[_0xa4e8('0x1a')](_0xa4e8('0x1b'),_0x4e6467,_0xa4e8('0x1c'));_0x5c16b0(_0xb85874[_0xa4e8('0x22')]['message']);}})[_0xa4e8('0x23')](function(_0x5578fb){logger['error'](_0xa4e8('0x1b'),_0x4e6467,_0x5578fb);_0x43b6ce(_0x5578fb);});});}function respondWithStatusCode(_0x138bd1,_0x27d06b){_0x27d06b=_0x27d06b||0xcc;return function(_0x325e42){if(_0x325e42){return _0x138bd1[_0xa4e8('0x24')](_0x27d06b);}return _0x138bd1['status'](_0x27d06b)[_0xa4e8('0x25')]();};}function respondWithResult(_0x1bad49,_0x2cc633){_0x2cc633=_0x2cc633||0xc8;return function(_0x99a877){if(_0x99a877){return _0x1bad49['status'](_0x2cc633)['json'](_0x99a877);}};}function respondWithFilteredResult(_0x833308,_0x231702){return function(_0x38488a){if(_0x38488a){var _0x1599e7=typeof _0x231702[_0xa4e8('0x26')]===_0xa4e8('0x27')&&typeof _0x231702[_0xa4e8('0x28')]==='undefined';var _0x40051f=_0x38488a[_0xa4e8('0x29')];var _0x44bc23=_0x1599e7?0x0:_0x231702[_0xa4e8('0x26')];var _0x60faed=_0x1599e7?_0x38488a[_0xa4e8('0x29')]:_0x231702[_0xa4e8('0x26')]+_0x231702[_0xa4e8('0x28')];var _0x2344ce;if(_0x60faed>=_0x40051f){_0x60faed=_0x40051f;_0x2344ce=0xc8;}else{_0x2344ce=0xce;}_0x833308[_0xa4e8('0x2a')](_0x2344ce);return _0x833308['set'](_0xa4e8('0x2b'),_0x44bc23+'-'+_0x60faed+'/'+_0x40051f)['json'](_0x38488a);}return null;};}function saveUpdates(_0x1455e1){return function(_0x3ec8d5){if(_0x3ec8d5){return _0x3ec8d5[_0xa4e8('0x2c')](_0x1455e1)['then'](function(_0x488156){return _0x488156;});}return null;};}function removeEntity(_0x190021){return function(_0x19928a){if(_0x19928a){return _0x19928a['destroy']()[_0xa4e8('0x2d')](function(){var _0x5a0205=_0x19928a[_0xa4e8('0x2e')]({'plain':!![]});var _0x136270=_0xa4e8('0x2f');return db[_0xa4e8('0x30')]['destroy']({'where':{'type':_0x136270,'resourceId':_0x5a0205['id']}})[_0xa4e8('0x2d')](function(){return _0x19928a;});})[_0xa4e8('0x2d')](function(){_0x190021[_0xa4e8('0x2a')](0xcc)[_0xa4e8('0x25')]();});}};}function handleEntityNotFound(_0x4875fe){return function(_0xe90ff){if(!_0xe90ff){_0x4875fe[_0xa4e8('0x24')](0x194);}return _0xe90ff;};}function handleError(_0x54d7a7,_0x270e6d){_0x270e6d=_0x270e6d||0x1f4;return function(_0x2ea4d6){logger[_0xa4e8('0x1f')](_0x2ea4d6[_0xa4e8('0x31')]);if(_0x2ea4d6['name']){delete _0x2ea4d6[_0xa4e8('0x32')];}_0x54d7a7[_0xa4e8('0x2a')](_0x270e6d)[_0xa4e8('0x33')](_0x2ea4d6);};}function createInteractionObject(_0x4e4e9e,_0x45daad,_0x9c7991,_0x2e4f01){var _0x2287bd=require(_0xa4e8('0x34'));var _0x2ff0a9=new _0x2287bd();var _0x19b200=_0x2ff0a9['setUA'](_0x9c7991[_0xa4e8('0x35')])['getResult']();var _0x596898=_0x45daad['customerIp'];if(_0x9c7991['cf-connecting-ip']){_0x596898=_0x9c7991[_0xa4e8('0x36')];}else if(_0x9c7991[_0xa4e8('0x37')]){_0x596898=_[_0xa4e8('0x38')](_0x9c7991[_0xa4e8('0x37')]['split'](','));}return{'ContactId':_0x2e4f01['id'],'ChatWebsiteId':_0x4e4e9e,'from':(_0x2e4f01[_0xa4e8('0x39')]||'')+'\x20'+(_0x2e4f01['lastName']||''),'customerIp':_0x596898,'customerPort':_0x9c7991[_0xa4e8('0x3a')]?_0x9c7991[_0xa4e8('0x3a')]:null,'referer':_0x45daad[_0xa4e8('0x3b')],'browserName':_0x19b200[_0xa4e8('0x3c')][_0xa4e8('0x32')]&&_0x19b200[_0xa4e8('0x3c')][_0xa4e8('0x3d')]?util['format'](_0xa4e8('0x3e'),_0x19b200[_0xa4e8('0x3c')][_0xa4e8('0x32')],_0x19b200['browser'][_0xa4e8('0x3d')]):_0xa4e8('0x3f'),'browserVersion':_0x19b200[_0xa4e8('0x3c')][_0xa4e8('0x3d')]||_0xa4e8('0x3f'),'osName':util[_0xa4e8('0x40')](_0xa4e8('0x3e'),_0x19b200['os']['name'],_0x19b200['os'][_0xa4e8('0x3d')]),'osVersion':_0x19b200['os']['version'],'deviceModel':_0x19b200['device']['model']&&_0x19b200['device']['vendor']?util['format'](_0xa4e8('0x41'),_0x19b200[_0xa4e8('0x42')][_0xa4e8('0x43')],_0x19b200[_0xa4e8('0x42')][_0xa4e8('0x44')],_0x19b200[_0xa4e8('0x42')][_0xa4e8('0x45')]):null,'deviceVendor':_0x19b200[_0xa4e8('0x42')][_0xa4e8('0x44')],'deviceType':_0x19b200[_0xa4e8('0x42')][_0xa4e8('0x45')],'formData':JSON[_0xa4e8('0x46')](_0x45daad)};}exports['index']=function(_0x25da92,_0x59f528){var _0x32f10a={'include':[{'model':db[_0xa4e8('0x47')],'as':'mandatoryDispositionPause'}]},_0x51e858={},_0x2a8883={'count':0x0,'rows':[]};var _0x5f0f07=_[_0xa4e8('0x48')](db[_0xa4e8('0x49')]['rawAttributes'],function(_0x1c0cf6){return{'name':_0x1c0cf6[_0xa4e8('0x4a')],'type':_0x1c0cf6[_0xa4e8('0x45')][_0xa4e8('0x4b')]};});_0x51e858['model']=_[_0xa4e8('0x48')](_0x5f0f07,_0xa4e8('0x32'));_0x51e858[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x25da92[_0xa4e8('0x4c')]);_0x51e858[_0xa4e8('0x4e')]=_[_0xa4e8('0x4f')](_0x51e858[_0xa4e8('0x43')],_0x51e858[_0xa4e8('0x4c')]);_0x32f10a[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x51e858[_0xa4e8('0x43')],qs[_0xa4e8('0x51')](_0x25da92[_0xa4e8('0x4c')][_0xa4e8('0x51')]));_0x32f10a[_0xa4e8('0x50')]=_0x32f10a[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x32f10a[_0xa4e8('0x50')]:_0x51e858[_0xa4e8('0x43')];if(!_0x25da92[_0xa4e8('0x4c')][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x32f10a[_0xa4e8('0x28')]=qs['limit'](_0x25da92[_0xa4e8('0x4c')]['limit']);_0x32f10a[_0xa4e8('0x26')]=qs[_0xa4e8('0x26')](_0x25da92[_0xa4e8('0x4c')]['offset']);}_0x32f10a[_0xa4e8('0x55')]=qs[_0xa4e8('0x56')](_0x25da92[_0xa4e8('0x4c')][_0xa4e8('0x56')]);_0x32f10a['where']=qs['filters'](_['pick'](_0x25da92[_0xa4e8('0x4c')],_0x51e858[_0xa4e8('0x4e')]),_0x5f0f07);if(_0x25da92[_0xa4e8('0x4c')]['filter']){_0x32f10a['where']=_['merge'](_0x32f10a['where'],{'$or':_['map'](_0x5f0f07,function(_0x4a1c35){if(_0x4a1c35['type']!=='VIRTUAL'){var _0x5fa13b={};_0x5fa13b[_0x4a1c35[_0xa4e8('0x32')]]={'$like':'%'+_0x25da92[_0xa4e8('0x4c')][_0xa4e8('0x57')]+'%'};return _0x5fa13b;}})});}_0x32f10a=_[_0xa4e8('0x58')]({},_0x32f10a,_0x25da92[_0xa4e8('0x59')]);var _0x16aaac={'where':_0x32f10a[_0xa4e8('0x5a')]};return db[_0xa4e8('0x49')][_0xa4e8('0x29')](_0x16aaac)['then'](function(_0x5be81f){_0x2a8883[_0xa4e8('0x29')]=_0x5be81f;if(_0x25da92[_0xa4e8('0x4c')][_0xa4e8('0x5b')]){_0x32f10a[_0xa4e8('0x5c')]=[{'all':!![]}];}return db[_0xa4e8('0x49')][_0xa4e8('0x5d')](_0x32f10a);})[_0xa4e8('0x2d')](function(_0x3cbde6){_0x2a8883[_0xa4e8('0x5e')]=_0x3cbde6;return _0x2a8883;})[_0xa4e8('0x2d')](respondWithFilteredResult(_0x59f528,_0x32f10a))['catch'](handleError(_0x59f528,null));};exports[_0xa4e8('0x5f')]=function(_0x56e1b2,_0x54e17b){var _0x5df81a={'raw':![],'where':{'id':_0x56e1b2[_0xa4e8('0x60')]['id']},'include':[{'model':db[_0xa4e8('0x47')],'as':_0xa4e8('0x61')}]},_0x592acc={};_0x592acc[_0xa4e8('0x43')]=_['keys'](db[_0xa4e8('0x49')][_0xa4e8('0x62')]);_0x592acc[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x56e1b2[_0xa4e8('0x4c')]);_0x592acc[_0xa4e8('0x4e')]=_[_0xa4e8('0x4f')](_0x592acc[_0xa4e8('0x43')],_0x592acc[_0xa4e8('0x4c')]);_0x5df81a[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x592acc['model'],qs['fields'](_0x56e1b2['query'][_0xa4e8('0x51')]));_0x5df81a[_0xa4e8('0x50')]=_0x5df81a[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x5df81a[_0xa4e8('0x50')]:_0x592acc[_0xa4e8('0x43')];if(_0x56e1b2[_0xa4e8('0x4c')][_0xa4e8('0x5b')]){_0x5df81a[_0xa4e8('0x5c')]=[{'all':!![]}];}_0x5df81a=_['merge']({},_0x5df81a,_0x56e1b2[_0xa4e8('0x59')]);return db[_0xa4e8('0x49')][_0xa4e8('0x63')](_0x5df81a)[_0xa4e8('0x2d')](handleEntityNotFound(_0x54e17b,null))[_0xa4e8('0x2d')](respondWithResult(_0x54e17b,null))[_0xa4e8('0x23')](handleError(_0x54e17b,null));};exports[_0xa4e8('0x64')]=function(_0x1e49c7,_0x105f18){if(!wildcardUtils['testWildcardValidity'](_0x1e49c7[_0xa4e8('0x65')][_0xa4e8('0x66')])){return handleError(_0x105f18,null)(new APIBadRequestError('\x22'+_0x1e49c7[_0xa4e8('0x65')][_0xa4e8('0x66')]+_0xa4e8('0x67')));}return db['ChatWebsite'][_0xa4e8('0x64')](_0x1e49c7['body'],{})['then'](function(_0x323d2c){var _0x5ab10f=_0x1e49c7[_0xa4e8('0x68')][_0xa4e8('0x2e')]({'plain':!![]});if(!_0x5ab10f)throw new Error(_0xa4e8('0x69'));if(_0x5ab10f[_0xa4e8('0x6a')]===_0xa4e8('0x68')){var _0x1a71b5=_0x323d2c[_0xa4e8('0x2e')]({'plain':!![]});var _0x3f22f8='ChatWebsites';return db[_0xa4e8('0x6b')][_0xa4e8('0x63')]({'where':{'name':_0x3f22f8,'userProfileId':_0x5ab10f[_0xa4e8('0x6c')]},'raw':!![]})['then'](function(_0x1dd8fa){if(_0x1dd8fa&&_0x1dd8fa['autoAssociation']===0x0){return db[_0xa4e8('0x30')][_0xa4e8('0x64')]({'name':_0x1a71b5[_0xa4e8('0x32')],'resourceId':_0x1a71b5['id'],'type':_0x1dd8fa[_0xa4e8('0x32')],'sectionId':_0x1dd8fa['id']},{})[_0xa4e8('0x2d')](function(){return _0x323d2c;});}else{return _0x323d2c;}})[_0xa4e8('0x23')](function(_0x13fe49){logger[_0xa4e8('0x1f')](_0xa4e8('0x6d'),_0x13fe49);throw _0x13fe49;});}return _0x323d2c;})[_0xa4e8('0x2d')](respondWithResult(_0x105f18,0xc9))[_0xa4e8('0x23')](handleError(_0x105f18,null));};exports['update']=function(_0x11f3b3,_0x1889b4){if(!wildcardUtils[_0xa4e8('0x6e')](_0x11f3b3[_0xa4e8('0x65')]['address'])){return handleError(_0x1889b4,null)(new APIBadRequestError('\x22'+_0x11f3b3[_0xa4e8('0x65')]['address']+_0xa4e8('0x67')));}if(_0x11f3b3[_0xa4e8('0x65')]['id']){delete _0x11f3b3[_0xa4e8('0x65')]['id'];}return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x11f3b3['params']['id']},'include':[{'model':db[_0xa4e8('0x47')],'as':_0xa4e8('0x61')}]})[_0xa4e8('0x2d')](handleEntityNotFound(_0x1889b4,null))[_0xa4e8('0x2d')](saveUpdates(_0x11f3b3[_0xa4e8('0x65')],null))[_0xa4e8('0x2d')](respondWithResult(_0x1889b4,null))['catch'](handleError(_0x1889b4,null));};exports['destroy']=function(_0x15ac38,_0x2e4c91){return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x15ac38[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x2e4c91,null))[_0xa4e8('0x2d')](removeEntity(_0x2e4c91,null))[_0xa4e8('0x23')](handleError(_0x2e4c91,null));};exports[_0xa4e8('0x6f')]=function(_0x268245,_0x539034){return db[_0xa4e8('0x49')][_0xa4e8('0x6f')]()[_0xa4e8('0x2d')](respondWithResult(_0x539034,null))[_0xa4e8('0x23')](handleError(_0x539034,null));};exports['addDisposition']=function(_0x41e6ff,_0x53998d){if(_0x41e6ff[_0xa4e8('0x65')]['id']){delete _0x41e6ff[_0xa4e8('0x65')]['id'];}return db['ChatWebsite'][_0xa4e8('0x63')]({'where':{'id':_0x41e6ff['params']['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x53998d,null))[_0xa4e8('0x2d')](function(_0x5a20b7){if(_0x5a20b7){_0x41e6ff[_0xa4e8('0x65')][_0xa4e8('0x70')]=_0x5a20b7['id'];return db[_0xa4e8('0x71')]['create'](_0x41e6ff[_0xa4e8('0x65')]);}})[_0xa4e8('0x2d')](respondWithResult(_0x53998d,null))['catch'](handleError(_0x53998d,null));};exports[_0xa4e8('0x72')]=function(_0x2ff27a,_0x4234b1){var _0x548c79={'raw':![],'where':{}};var _0x1fb98c={};var _0x2c70c7={'count':0x0,'rows':[]};return db[_0xa4e8('0x49')]['findOne']({'where':{'id':_0x2ff27a[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x4234b1,null))[_0xa4e8('0x2d')](function(_0xb907dc){if(_0xb907dc){_0x1fb98c[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0x71')][_0xa4e8('0x62')]);_0x1fb98c[_0xa4e8('0x4c')]=_['keys'](_0x2ff27a[_0xa4e8('0x4c')]);_0x1fb98c['filters']=_[_0xa4e8('0x4f')](_0x1fb98c[_0xa4e8('0x43')],_0x1fb98c['query']);_0x548c79[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x1fb98c['model'],qs[_0xa4e8('0x51')](_0x2ff27a['query'][_0xa4e8('0x51')]));_0x548c79['attributes']=_0x548c79[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x548c79[_0xa4e8('0x50')]:_0x1fb98c[_0xa4e8('0x43')];if(!_0x2ff27a[_0xa4e8('0x4c')][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x548c79['limit']=qs[_0xa4e8('0x28')](_0x2ff27a[_0xa4e8('0x4c')][_0xa4e8('0x28')]);_0x548c79[_0xa4e8('0x26')]=qs[_0xa4e8('0x26')](_0x2ff27a[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}_0x548c79[_0xa4e8('0x55')]=qs['sort'](_0x2ff27a[_0xa4e8('0x4c')][_0xa4e8('0x56')]);_0x548c79[_0xa4e8('0x5a')]=qs[_0xa4e8('0x4e')](_['pick'](_0x2ff27a[_0xa4e8('0x4c')],_0x1fb98c[_0xa4e8('0x4e')]));_0x548c79[_0xa4e8('0x5a')]['ChatWebsiteId']=_0xb907dc['id'];if(_0x2ff27a['query'][_0xa4e8('0x57')]){_0x548c79['where']=_[_0xa4e8('0x58')](_0x548c79[_0xa4e8('0x5a')],{'$or':_[_0xa4e8('0x48')](_0x548c79['attributes'],function(_0x3c44a4){var _0x23c4a7={};_0x23c4a7[_0x3c44a4]={'$like':'%'+_0x2ff27a[_0xa4e8('0x4c')][_0xa4e8('0x57')]+'%'};return _0x23c4a7;})});}_0x548c79=_[_0xa4e8('0x58')]({},_0x548c79,_0x2ff27a[_0xa4e8('0x59')]);return db[_0xa4e8('0x71')][_0xa4e8('0x29')]({'where':_0x548c79['where']})[_0xa4e8('0x2d')](function(_0x3b73c6){_0x2c70c7['count']=_0x3b73c6;if(_0x2ff27a['query'][_0xa4e8('0x5b')]){_0x548c79['include']=[{'all':!![]}];}return db['Disposition'][_0xa4e8('0x5d')](_0x548c79);})['then'](function(_0x1986bf){_0x2c70c7[_0xa4e8('0x5e')]=_0x1986bf;return _0x2c70c7;});}})[_0xa4e8('0x2d')](respondWithFilteredResult(_0x4234b1,_0x548c79))[_0xa4e8('0x23')](handleError(_0x4234b1,null));};exports[_0xa4e8('0x73')]=function(_0x14c978,_0x2045e3){return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x14c978[_0xa4e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x2045e3,null))['then'](function(_0x40ce27){if(_0x40ce27){return _0x40ce27['removeDispositions'](_0x14c978[_0xa4e8('0x4c')]['ids']);}})[_0xa4e8('0x2d')](respondWithStatusCode(_0x2045e3,null))[_0xa4e8('0x23')](handleError(_0x2045e3,null));};exports['addAnswer']=function(_0x5d6e60,_0x5c6872){if(_0x5d6e60['body']['id']){delete _0x5d6e60[_0xa4e8('0x65')]['id'];}return db['ChatWebsite'][_0xa4e8('0x63')]({'where':{'id':_0x5d6e60[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x5c6872,null))['then'](function(_0x19b7a5){if(_0x19b7a5){_0x5d6e60[_0xa4e8('0x65')][_0xa4e8('0x70')]=_0x19b7a5['id'];return db[_0xa4e8('0x74')][_0xa4e8('0x64')](_0x5d6e60[_0xa4e8('0x65')]);}})[_0xa4e8('0x2d')](respondWithResult(_0x5c6872,null))[_0xa4e8('0x23')](handleError(_0x5c6872,null));};exports[_0xa4e8('0x75')]=function(_0xde6dc5,_0x4b7f73){var _0x5d56aa={'raw':![],'where':{}};var _0x5621f5={};var _0x52f377={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa4e8('0x76')]({'where':{'id':_0xde6dc5[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x4b7f73,null))['then'](function(_0x410cb9){if(_0x410cb9){_0x5621f5[_0xa4e8('0x43')]=_['keys'](db[_0xa4e8('0x74')][_0xa4e8('0x62')]);_0x5621f5[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0xde6dc5['query']);_0x5621f5[_0xa4e8('0x4e')]=_[_0xa4e8('0x4f')](_0x5621f5['model'],_0x5621f5[_0xa4e8('0x4c')]);_0x5d56aa[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x5621f5['model'],qs[_0xa4e8('0x51')](_0xde6dc5['query'][_0xa4e8('0x51')]));_0x5d56aa[_0xa4e8('0x50')]=_0x5d56aa[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x5d56aa[_0xa4e8('0x50')]:_0x5621f5['model'];if(!_0xde6dc5[_0xa4e8('0x4c')][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x5d56aa['limit']=qs['limit'](_0xde6dc5['query'][_0xa4e8('0x28')]);_0x5d56aa['offset']=qs['offset'](_0xde6dc5[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}_0x5d56aa['order']=qs[_0xa4e8('0x56')](_0xde6dc5['query'][_0xa4e8('0x56')]);_0x5d56aa['where']=qs[_0xa4e8('0x4e')](_[_0xa4e8('0x77')](_0xde6dc5[_0xa4e8('0x4c')],_0x5621f5[_0xa4e8('0x4e')]));_0x5d56aa[_0xa4e8('0x5a')]['ChatWebsiteId']=_0x410cb9['id'];if(_0xde6dc5['query'][_0xa4e8('0x57')]){_0x5d56aa[_0xa4e8('0x5a')]=_[_0xa4e8('0x58')](_0x5d56aa[_0xa4e8('0x5a')],{'$or':_[_0xa4e8('0x48')](_0x5d56aa[_0xa4e8('0x50')],function(_0x159166){var _0x5ee72b={};_0x5ee72b[_0x159166]={'$like':'%'+_0xde6dc5[_0xa4e8('0x4c')]['filter']+'%'};return _0x5ee72b;})});}_0x5d56aa=_[_0xa4e8('0x58')]({},_0x5d56aa,_0xde6dc5[_0xa4e8('0x59')]);return db[_0xa4e8('0x74')][_0xa4e8('0x29')]({'where':_0x5d56aa[_0xa4e8('0x5a')]})[_0xa4e8('0x2d')](function(_0x791899){_0x52f377[_0xa4e8('0x29')]=_0x791899;if(_0xde6dc5[_0xa4e8('0x4c')]['includeAll']){_0x5d56aa[_0xa4e8('0x5c')]=[{'all':!![]}];}return db[_0xa4e8('0x74')]['findAll'](_0x5d56aa);})[_0xa4e8('0x2d')](function(_0x1b32c9){_0x52f377[_0xa4e8('0x5e')]=_0x1b32c9;return _0x52f377;});}})[_0xa4e8('0x2d')](respondWithFilteredResult(_0x4b7f73,_0x5d56aa))[_0xa4e8('0x23')](handleError(_0x4b7f73,null));};exports[_0xa4e8('0x78')]=function(_0x5c51a9,_0x19b5b5){return db['ChatWebsite']['find']({'where':{'id':_0x5c51a9[_0xa4e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x19b5b5,null))[_0xa4e8('0x2d')](function(_0x3002a7){if(_0x3002a7){return _0x3002a7['removeAnswers'](_0x5c51a9['query'][_0xa4e8('0x79')]);}})[_0xa4e8('0x2d')](respondWithStatusCode(_0x19b5b5,null))[_0xa4e8('0x23')](handleError(_0x19b5b5,null));};exports[_0xa4e8('0x7a')]=function(_0x40c509,_0x31c94e){_0x40c509[_0xa4e8('0x65')][_0xa4e8('0x7b')]=_0x40c509[_0xa4e8('0x7c')][_0xa4e8('0x7d')];return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x40c509[_0xa4e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x31c94e,null))[_0xa4e8('0x2d')](saveUpdates(_0x40c509[_0xa4e8('0x65')],null))['then'](respondWithResult(_0x31c94e,null))[_0xa4e8('0x23')](handleError(_0x31c94e,null));};exports['addAvatar']=function(_0x2dcded,_0x5531b7){_0x2dcded['body'][_0xa4e8('0x7e')]=_0x2dcded[_0xa4e8('0x7c')][_0xa4e8('0x7d')];return db[_0xa4e8('0x49')]['find']({'where':{'id':_0x2dcded[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x5531b7,null))[_0xa4e8('0x2d')](saveUpdates(_0x2dcded['body'],null))[_0xa4e8('0x2d')](respondWithResult(_0x5531b7,null))[_0xa4e8('0x23')](handleError(_0x5531b7,null));};exports[_0xa4e8('0x7f')]=function(_0x32aa40,_0x4c0301){_0x32aa40[_0xa4e8('0x65')][_0xa4e8('0x80')]=_0x32aa40[_0xa4e8('0x7c')]['filename'];return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x32aa40['params']['id']}})['then'](handleEntityNotFound(_0x4c0301,null))['then'](saveUpdates(_0x32aa40[_0xa4e8('0x65')],null))[_0xa4e8('0x2d')](respondWithResult(_0x4c0301,null))[_0xa4e8('0x23')](handleError(_0x4c0301,null));};exports['addSystemAvatar']=function(_0x2d4e23,_0x553ce2){_0x2d4e23[_0xa4e8('0x65')][_0xa4e8('0x81')]=_0x2d4e23[_0xa4e8('0x7c')]['filename'];return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x2d4e23['params']['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x553ce2,null))[_0xa4e8('0x2d')](saveUpdates(_0x2d4e23[_0xa4e8('0x65')],null))[_0xa4e8('0x2d')](respondWithResult(_0x553ce2,null))[_0xa4e8('0x23')](handleError(_0x553ce2,null));};exports[_0xa4e8('0x82')]=function(_0x1c4f3f,_0x132f4d){var _0x4e36ec=path['join'](config[_0xa4e8('0x83')],_0xa4e8('0x84'));var _0x33e4ed={'where':{'id':_0x1c4f3f[_0xa4e8('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5880e6=![];return require(_0xa4e8('0x85'))[_0xa4e8('0x86')]()[_0xa4e8('0x2d')](function(_0x12cefe){if(_0x12cefe){_0x5880e6=_0x12cefe['custom'];}})[_0xa4e8('0x2d')](function(){return db[_0xa4e8('0x49')][_0xa4e8('0x63')](_0x33e4ed);})[_0xa4e8('0x2d')](handleEntityNotFound(_0x132f4d,null))[_0xa4e8('0x2d')](function(_0x4ba6a1){if(_0x4ba6a1){if(!_[_0xa4e8('0x87')](_0x4ba6a1[_0xa4e8('0x7b')])){if(fs['existsSync'](path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x89'),_0x4ba6a1['sitepic']))&&_0x5880e6){_0x4e36ec=path[_0xa4e8('0x88')](config['root'],'server/files/images/logos/',_0x4ba6a1['sitepic']);}}return _0x132f4d[_0xa4e8('0x8a')](_0x4e36ec);}})[_0xa4e8('0x23')](handleError(_0x132f4d,null));};exports['getAvatar']=function(_0xefd939,_0x20ac57){var _0x58abc2=path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x8b'));var _0xb7270a={'where':{'id':_0xefd939[_0xa4e8('0x60')]['id']},'attributes':['id',_0xa4e8('0x7e')],'raw':!![]};return db[_0xa4e8('0x49')][_0xa4e8('0x63')](_0xb7270a)[_0xa4e8('0x2d')](handleEntityNotFound(_0x20ac57,null))[_0xa4e8('0x2d')](function(_0x28f435){if(_0x28f435){if(!_['isNil'](_0x28f435[_0xa4e8('0x7e')])){if(fs[_0xa4e8('0x8c')](path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x8d'),_0x28f435[_0xa4e8('0x7e')]))){_0x58abc2=path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x8d'),_0x28f435[_0xa4e8('0x7e')]);}}return _0x20ac57['download'](_0x58abc2);}})[_0xa4e8('0x23')](handleError(_0x20ac57,null));};exports['getCustomerAvatar']=function(_0x1a979b,_0x9ad3d7){var _0x3d1a25=path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],'server/files/images/avatars/customer_avatar.png');var _0x4dba5c={'where':{'id':_0x1a979b['params']['id']},'attributes':['id',_0xa4e8('0x80'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xa4e8('0x63')](_0x4dba5c)[_0xa4e8('0x2d')](handleEntityNotFound(_0x9ad3d7,null))['then'](function(_0x3d2648){if(_0x3d2648){if(!_[_0xa4e8('0x87')](_0x3d2648[_0xa4e8('0x80')])){if(fs[_0xa4e8('0x8c')](path['join'](config[_0xa4e8('0x83')],'server/files/images/avatars/',_0x3d2648[_0xa4e8('0x80')]))&&_0x3d2648['showCustomerAvatar']){_0x3d1a25=path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x8d'),_0x3d2648['customerAvatar']);}}return _0x9ad3d7['download'](_0x3d1a25);}})[_0xa4e8('0x23')](handleError(_0x9ad3d7,null));};exports['getSystemAvatar']=function(_0x2d2baa,_0x504cbb){var _0x3260d9=path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0x8e'));var _0x480102={'where':{'id':_0x2d2baa[_0xa4e8('0x60')]['id']},'attributes':['id',_0xa4e8('0x81')],'raw':!![]};return db['ChatWebsite']['find'](_0x480102)[_0xa4e8('0x2d')](handleEntityNotFound(_0x504cbb,null))['then'](function(_0x40e10d){if(_0x40e10d){if(!_[_0xa4e8('0x87')](_0x40e10d[_0xa4e8('0x81')])){if(fs['existsSync'](path[_0xa4e8('0x88')](config['root'],_0xa4e8('0x8d'),_0x40e10d[_0xa4e8('0x81')]))){_0x3260d9=path[_0xa4e8('0x88')](config['root'],_0xa4e8('0x8d'),_0x40e10d[_0xa4e8('0x81')]);}}return _0x504cbb[_0xa4e8('0x8a')](_0x3260d9);}})[_0xa4e8('0x23')](handleError(_0x504cbb,null));};function checkWebsiteInterval(_0xd665e7){var _0x494c65=_0xd665e7[_0xa4e8('0x8f')];if(!_0x494c65){return Promise[_0xa4e8('0x90')](_0xd665e7);}var _0x2fc723=_0xd665e7[_0xa4e8('0x91')]||undefined;return _0x494c65[_0xa4e8('0x92')](_0x2fc723)[_0xa4e8('0x2d')](function(_0x3247bb){if(!_0x3247bb){throw new APIOutOfIntervalError();}return _0xd665e7;});}exports[_0xa4e8('0x93')]=function(_0x348345,_0x230248){var _0x4ce14d={'body':_0x348345['body'],'channel':_0xa4e8('0x94')};var _0xea11e2=[];var _0x538a91=[];var _0x33b58f={};var _0x543dec=![];if(_0x348345[_0xa4e8('0x65')]['id']){delete _0x348345[_0xa4e8('0x65')]['id'];}if(_['isNil'](_0x348345[_0xa4e8('0x65')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xa4e8('0x87')](_0x348345[_0xa4e8('0x65')]['mapKey'])){throw new APIBadRequestError(_0xa4e8('0x95'));}if(_[_0xa4e8('0x96')](_0x348345['body']['body'])){throw new APIBadRequestError(_0xa4e8('0x97'));}var _0x26eab2=_0x348345[_0xa4e8('0x65')][_0xa4e8('0x98')]&&_0x348345['body'][_0xa4e8('0x3b')];return db['CmContact'][_0xa4e8('0x6f')]()[_0xa4e8('0x2d')](function(_0x29da45){if(!_0x29da45){throw new Error('No\x20available\x20attributes');}_0xea11e2=Object[_0xa4e8('0x4d')](_0x29da45)[_0xa4e8('0x57')](function(_0x439a34){return![_0xa4e8('0x99'),_0xa4e8('0x9a')]['includes'](_0x439a34);});_0x538a91=Object[_0xa4e8('0x4d')](_0x29da45)[_0xa4e8('0x57')](function(_0x278403){return![_0xa4e8('0x99'),_0xa4e8('0x9a'),_0xa4e8('0x9b'),'ListId']['includes'](_0x278403);});if(!_[_0xa4e8('0x9c')](_0x538a91,_0x348345['body'][_0xa4e8('0x9d')])){throw new APIBadRequestError(_0xa4e8('0x9e')+_0x538a91['join'](',\x20'));}_0x33b58f[_0x348345['body'][_0xa4e8('0x9d')]]=_0x348345[_0xa4e8('0x65')]['from'];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x348345['params']['id']},'include':[{'model':db[_0xa4e8('0x9f')],'as':_0xa4e8('0xa0'),'include':[{'model':db[_0xa4e8('0xa1')],'as':_0xa4e8('0xa2'),'where':_0x33b58f,'limit':0x1,'order':[[_0xa4e8('0x9a'),_0xa4e8('0xa3')]]}]},{'model':db['ChatApplication'],'as':_0xa4e8('0xa4')},{'model':db[_0xa4e8('0x8f')],'as':_0xa4e8('0x8f'),'include':[{'model':db[_0xa4e8('0x8f')],'as':'Intervals','attributes':['id',_0xa4e8('0xa5')],'raw':!![]}]}]});})[_0xa4e8('0x2d')](function(_0x2e8279){if(!_0x2e8279){throw new APINotFoundError(util[_0xa4e8('0x40')](_0xa4e8('0xa6'),_0x348345[_0xa4e8('0x60')]['id']));}if(_0x26eab2){return checkWebsiteInterval(_0x2e8279);}return _0x2e8279;})[_0xa4e8('0x2d')](function(_0x52d369){_0x4ce14d[_0xa4e8('0xa7')]=_0x52d369;_0x4ce14d[_0xa4e8('0xa8')]=_[_0xa4e8('0xa9')](_0x52d369[_0xa4e8('0xa4')],[_0xa4e8('0xaa')],['asc']);if(_0x4ce14d[_0xa4e8('0xa7')]['Applications']){delete _0x4ce14d[_0xa4e8('0xa7')][_0xa4e8('0xa4')];}_0x4ce14d[_0xa4e8('0xab')]=_0x52d369[_0xa4e8('0xa0')]||{'id':_0x52d369[_0xa4e8('0xac')]};if(_0x4ce14d['list']&&_0x4ce14d[_0xa4e8('0xab')][_0xa4e8('0xa2')][_0xa4e8('0x52')]){return _0x4ce14d[_0xa4e8('0xab')]['Contacts'][0x0];}var _0x4e4e38=_[_0xa4e8('0xad')](_0x348345['body'],{'firstName':_0x348345['body']['from'],'ListId':_0x52d369[_0xa4e8('0xac')]});_0x4e4e38[_0x348345[_0xa4e8('0x65')]['mapKey']]=_0x348345[_0xa4e8('0x65')]['from'];return db[_0xa4e8('0xa1')][_0xa4e8('0x64')](_0x4e4e38,{'fields':_0xea11e2,'raw':!![]});})[_0xa4e8('0x2d')](function(_0x1c2db1){_0x4ce14d[_0xa4e8('0xae')]=_0x1c2db1;var _0x5c44b9=createInteractionObject(_0x348345[_0xa4e8('0x60')]['id'],_0x348345['body'],_0x348345['headers'],_0x1c2db1);var _0x19ef89={'ChatWebsiteId':_0x348345['params']['id']};if(_0x348345[_0xa4e8('0x65')][_0xa4e8('0xaf')]){_0x19ef89[_0xa4e8('0xaf')]=_0x348345[_0xa4e8('0x65')]['threadId'];_0x19ef89[_0xa4e8('0xb0')]=![];return db[_0xa4e8('0xb1')][_0xa4e8('0x63')]({'where':_0x19ef89})[_0xa4e8('0x2d')](function(_0x48c0aa){var _0x49dfab=_0x348345['body'][_0xa4e8('0x98')]&&_0x348345[_0xa4e8('0x65')]['referer'];if(_0x48c0aa){_0x543dec=!![];return _0x48c0aa;}else if(!_0x49dfab&&_0x48c0aa&&_0x48c0aa[_0xa4e8('0xb0')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x5c44b9['threadId']=_0x348345['body'][_0xa4e8('0xaf')];_0x5c44b9[_0xa4e8('0xb2')]=_0x348345['body'][_0xa4e8('0xb2')];return db[_0xa4e8('0xb1')][_0xa4e8('0x64')](_0x5c44b9);});}_0x19ef89[_0xa4e8('0xb3')]=_0x1c2db1['id'];if(_0x348345[_0xa4e8('0x65')][_0xa4e8('0xb4')]&&_0x348345[_0xa4e8('0x65')]['interaction']['id']){_0x19ef89['id']=_0x348345['body'][_0xa4e8('0xb4')]['id'];return db[_0xa4e8('0xb1')][_0xa4e8('0x63')]({'where':_0x19ef89})[_0xa4e8('0x2d')](function(_0x3b3efa){var _0x574d95=_0x348345['body'][_0xa4e8('0x98')]&&_0x348345[_0xa4e8('0x65')][_0xa4e8('0x3b')];if(!_0x574d95&&_0x3b3efa&&_0x3b3efa['closed']){throw new APIConflictError(_0xa4e8('0xb5'));}else if(_0x3b3efa){_0x543dec=!![];return _0x3b3efa;}else{return db[_0xa4e8('0xb1')][_0xa4e8('0x64')](_0x5c44b9);}});}return db[_0xa4e8('0xb1')][_0xa4e8('0x64')](_0x5c44b9);})[_0xa4e8('0x2d')](function(_0x27fb1c){if(!_0x543dec){return _0x27fb1c;}var _0x1b30a8={'from':(_0x4ce14d[_0xa4e8('0xae')]['firstName']||'')+'\x20'+(_0x4ce14d[_0xa4e8('0xae')][_0xa4e8('0xb6')]||'')};if(_0x348345[_0xa4e8('0x65')][_0xa4e8('0xaf')]&&_0x348345[_0xa4e8('0x65')][_0xa4e8('0xb7')]&&_0x348345[_0xa4e8('0x65')][_0xa4e8('0xaf')]!=_0x348345['body']['messageId']){_0x1b30a8['threadId']=_0x348345[_0xa4e8('0x65')][_0xa4e8('0xb7')];}return _0x27fb1c['update'](_0x1b30a8);})[_0xa4e8('0x2d')](function(_0x4a4ce8){_0x4ce14d[_0xa4e8('0xb4')]=_0x4a4ce8[_0xa4e8('0x2e')]({'plain':!![]});_0x4ce14d[_0xa4e8('0xb4')][_0xa4e8('0xb8')]=!_0x543dec;if(_0x4ce14d[_0xa4e8('0xb4')][_0xa4e8('0xb8')]){if(_0x4ce14d[_0xa4e8('0xa7')]['autoclose']){_0x4ce14d[_0xa4e8('0xa8')][_0xa4e8('0xb9')]({'id':0x0,'priority':_0x4ce14d[_0xa4e8('0xa8')]['length']+0x1,'app':_0xa4e8('0xba'),'appdata':_0xa4e8('0xbb'),'interval':_0xa4e8('0xbc')});}}return db[_0xa4e8('0xbd')][_0xa4e8('0x64')]({'body':_0x348345[_0xa4e8('0x65')][_0xa4e8('0x65')],'ChatWebsiteId':_0x348345[_0xa4e8('0x60')]['id'],'ChatInteractionId':_0x4a4ce8['id'],'direction':'in','ContactId':_0x4ce14d['contact']['id'],'AttachmentId':_0x348345[_0xa4e8('0x65')]['AttachmentId']});})[_0xa4e8('0x2d')](function(_0x375567){_0x4ce14d[_0xa4e8('0x21')]=_0x375567;if(!_0x4ce14d[_0xa4e8('0xb4')]['UserId']){return;}return db[_0xa4e8('0xbe')][_0xa4e8('0x63')]({'attributes':['id',_0xa4e8('0x32')],'where':{'id':_0x4ce14d[_0xa4e8('0xb4')][_0xa4e8('0xbf')]}});})[_0xa4e8('0x2d')](function(_0x444806){if(_0x444806){_0x4ce14d[_0xa4e8('0xa8')][_0xa4e8('0xc0')]({'id':0x0,'priority':0x0,'app':_0xa4e8('0xc1'),'appdata':_0x444806[_0xa4e8('0x32')]+','+(_0x4ce14d['account'][_0xa4e8('0xc2')]||0xa),'interval':_0xa4e8('0xbc')});_0x4ce14d[_0xa4e8('0xc3')]=!![];}if(!_0x4ce14d[_0xa4e8('0xb4')][_0xa4e8('0xc4')]){return;}return db[_0xa4e8('0xc5')][_0xa4e8('0x63')]({'attributes':['id',_0xa4e8('0x32')],'where':{'id':_0x4ce14d[_0xa4e8('0xb4')][_0xa4e8('0xc4')]}});})[_0xa4e8('0x2d')](function(_0x28a95c){if(_0x28a95c){_0x4ce14d[_0xa4e8('0xa8')][_0xa4e8('0xc0')]({'id':0x0,'priority':0x1,'app':_0xa4e8('0xc6'),'appdata':_0x28a95c[_0xa4e8('0x32')]+','+(_0x4ce14d[_0xa4e8('0xa7')]['waitForTheAssignedQueue']||0x12c),'interval':_0xa4e8('0xbc')});}return respondWithRpcPromise('Start',_0xa4e8('0xc7'),_0x4ce14d);})[_0xa4e8('0x2d')](function(_0x2c7d45){respondWithRpcPromise(_0xa4e8('0xc8'),_0xa4e8('0xc8'),{'event':'notify','message':_0x2c7d45},client9002);return _0x2c7d45;})['then'](respondWithResult(_0x230248,null))[_0xa4e8('0x23')](APIHandleError(_0x230248));};exports[_0xa4e8('0xc9')]=function(_0x5b9321,_0x39ef30){var _0x28dc37,_0x426ccb,_0x1b2eae;var _0x1052a1=[];var _0x26020f={};var _0x163b37=_0x5b9321['files']||[];var _0x5f2a26=[];var _0x1aa96e;return db[_0xa4e8('0xa1')][_0xa4e8('0x6f')]()['then'](function(_0x4aae64){if(!_0x4aae64){throw new db[(_0xa4e8('0xca'))]['ValidationError'](_0xa4e8('0xcb'));}_0x1052a1=_[_0xa4e8('0xcc')](_['keys'](_0x4aae64),['createdAt','updatedAt',_0xa4e8('0x9b'),'ListId']);if(_0x5b9321[_0xa4e8('0x65')]['id']){delete _0x5b9321[_0xa4e8('0x65')]['id'];}if(_[_0xa4e8('0x87')](_0x5b9321['body'][_0xa4e8('0xcd')])){throw _0x39ef30[_0xa4e8('0x2a')](0x1f4)[_0xa4e8('0x33')](new db['Sequelize'][(_0xa4e8('0xce'))](_0xa4e8('0xcf')));}if(_[_0xa4e8('0x87')](_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0x65')])||_0x5b9321['body'][_0xa4e8('0x65')]===''){throw _0x39ef30['status'](0x1f4)['send'](new db[(_0xa4e8('0xca'))][(_0xa4e8('0xce'))](_0xa4e8('0xd0')));}if(_[_0xa4e8('0x87')](_0x5b9321[_0xa4e8('0x65')]['mapKeyOffline'])){throw _0x39ef30[_0xa4e8('0x2a')](0x1f4)[_0xa4e8('0x33')](new db[(_0xa4e8('0xca'))][(_0xa4e8('0xce'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1052a1));}if(!_[_0xa4e8('0x9c')](_0x1052a1,_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xd1')])){throw _0x39ef30['status'](0x1f4)['send'](new db[(_0xa4e8('0xca'))][(_0xa4e8('0xce'))](_0xa4e8('0xd2')+_0x1052a1));}_0x26020f[_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xd1')]]=_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xcd')];})[_0xa4e8('0x2d')](function(){return db['ChatWebsite'][_0xa4e8('0x63')]({'where':{'id':_0x5b9321[_0xa4e8('0x60')]['id']},'include':[{'model':db[_0xa4e8('0x9f')],'as':_0xa4e8('0xa0')},{'model':db[_0xa4e8('0xd3')],'as':_0xa4e8('0xd3')}]});})[_0xa4e8('0x2d')](handleEntityNotFound(_0x39ef30,null))[_0xa4e8('0x2d')](function(_0x4786e8){if(_0x4786e8&&_0x4786e8['List']){_0x426ccb=_0x4786e8;var _0x45226e=_[_0xa4e8('0xad')](_0x5b9321[_0xa4e8('0x65')],{'firstName':_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xcd')],'phone':_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xcd')],'ListId':_0x4786e8[_0xa4e8('0xac')]});_0x45226e[_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0xd1')]]=_0x5b9321['body'][_0xa4e8('0xcd')];return db[_0xa4e8('0xa1')][_0xa4e8('0xd4')]({'where':_0x26020f,'defaults':_0x45226e});}})[_0xa4e8('0xd5')](function(_0x5402b2){if(_0x5402b2){_0x1b2eae=_0x5402b2;var _0x3368ea=fs['readFileSync'](path['join'](config[_0xa4e8('0x83')],'server/files/templates/chatOfflineMessage.ejs'),_0xa4e8('0xd6'));var _0x60d391=ejs[_0xa4e8('0xd7')](_0x3368ea,{'body':_[_0xa4e8('0xd8')](_0x5b9321[_0xa4e8('0x65')][_0xa4e8('0x65')]),'bodyTitle':_0x426ccb[_0xa4e8('0xd9')]});return db['ChatOfflineMessage'][_0xa4e8('0x64')]({'body':_0x60d391,'plainBody':htmlToText['fromString'](_0x60d391),'ContactId':_0x5402b2['id'],'ChatWebsiteId':_0x426ccb['id']});}})['then'](function(_0x47c9a4){_0x1aa96e=_0x47c9a4;if(_0x163b37[_0xa4e8('0x52')]){var _0x39d094=_0x163b37[_0xa4e8('0x48')](function(_0x2569c0){return{'name':_0x2569c0[_0xa4e8('0xda')],'basename':_0x2569c0['filename'],'type':_0x2569c0[_0xa4e8('0xdb')],'ChatOfflineMessageId':_0x47c9a4['id']};});_0x5f2a26=_0x39d094[_0xa4e8('0x48')](_0x46f721=>{var _0x5195c8={'filename':_0x46f721[_0xa4e8('0x32')],'path':path[_0xa4e8('0x88')](config[_0xa4e8('0x83')],_0xa4e8('0xdc'),_0xa4e8('0xdd'),_0xa4e8('0xde'),'offline-chat',_0x46f721[_0xa4e8('0xdf')])};return _0x5195c8;});if(!_0x426ccb[_0xa4e8('0xe0')]){return db[_0xa4e8('0xe1')]['transaction'](function(_0x2a972a){return db['Attachment']['bulkCreate'](_0x39d094,{'transaction':_0x2a972a});});}}})[_0xa4e8('0x2d')](function(){if(_0x1aa96e){_0x28dc37=_0x1aa96e;return db[_0xa4e8('0xd3')][_0xa4e8('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0xa4e8('0xe2')],'as':_0xa4e8('0xe3'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa4e8('0xe4'),'raw':!![]}]}]});}})[_0xa4e8('0x2d')](function(_0x53085f){if(_0x53085f&&_0x53085f[_0xa4e8('0xe3')]&&_0x426ccb[_0xa4e8('0xe5')]&&_0x426ccb['forwardOfflineAddress']){var _0x16a58d=_0x53085f[_0xa4e8('0xe6')]();return respondWithRpcPromise(_0xa4e8('0xe7'),_0xa4e8('0xe8'),{'account':_0x16a58d,'message':{'from':util[_0xa4e8('0x40')](_0xa4e8('0xe9'),_0x53085f[_0xa4e8('0x32')],_0x53085f[_0xa4e8('0xea')]||_0x53085f[_0xa4e8('0xe3')][_0xa4e8('0x68')]),'to':_0x426ccb[_0xa4e8('0xeb')],'subject':_0x426ccb[_0xa4e8('0xec')],'html':_0x28dc37[_0xa4e8('0x65')],'attachments':_0x5f2a26}},client9003)[_0xa4e8('0x2d')](function(){return _0x28dc37;})['catch'](function(_0xf29e2f){logger['error'](_0xf29e2f);});}})[_0xa4e8('0x2d')](function(){if(_0x426ccb&&_0x426ccb[_0xa4e8('0xe0')]&&_0x426ccb[_0xa4e8('0xed')]){var _0x58272a=[];if(_0x163b37[_0xa4e8('0x52')]){_0x58272a=_0x163b37[_0xa4e8('0x48')](function(_0x4893a7){return{'name':_0x4893a7[_0xa4e8('0xda')],'basename':_0x4893a7['filename'],'type':_0x4893a7[_0xa4e8('0xdb')],'ChatOfflineMessageId':_0x1aa96e['id']};});}var _0x708b11;if(!_[_0xa4e8('0x87')](_0x426ccb[_0xa4e8('0xee')])){var _0x1662e3=_[_0xa4e8('0x48')](_0x5b9321[_0xa4e8('0x65')],function(_0x2fba20){return _0x2fba20;});var _0x2f111f=_[_0xa4e8('0xef')](_0x1662e3)[0x0];var _0x338d1f=_[_0xa4e8('0xf0')](_0x2f111f,function(_0x149b49){return _0x149b49;});_0x708b11=_0x338d1f[0x1][_0x426ccb[_0xa4e8('0xee')]];}var _0x4fec75={'from':_0x1b2eae['email'],'firstName':_0x1b2eae['firstName'],'lastName':_0x1b2eae[_0xa4e8('0xb6')],'mapKey':_0xa4e8('0xea'),'message':{'from':_0x1b2eae[_0xa4e8('0xea')],'to':_0x426ccb[_0xa4e8('0xd3')][_0xa4e8('0xea')],'cc':'','subject':_[_0xa4e8('0x87')](_0x708b11)?_0x426ccb[_0xa4e8('0xec')]:_0x708b11,'messageId':'','sentAt':new Date(),'attach':_0x58272a['length'],'attachments':_0x58272a,'originChannel':_0xa4e8('0xf1'),'ChatWebsiteId':_0x426ccb['id'],'ChatOfflineMessageId':_0x28dc37['id'],'originTo':_0x426ccb[_0xa4e8('0xd3')][_0xa4e8('0xea')]},'body':_0x28dc37[_0xa4e8('0x65')]};var _0x5f5480={'account':{'id':_0x426ccb['MailAccountId']},'body':_0x4fec75,'log':_0xa4e8('0xf2')};return respondWithRpcPromise(_0xa4e8('0xf2'),_0xa4e8('0xf3'),_0x5f5480,client9001)[_0xa4e8('0x2d')](function(){return _0x28dc37;})[_0xa4e8('0x23')](function(_0x4de7f7){logger[_0xa4e8('0x1f')](_0x4de7f7);});}return;})[_0xa4e8('0x2d')](function(){if(_0x28dc37){return _0x28dc37;}})[_0xa4e8('0x2d')](respondWithResult(_0x39ef30,null))[_0xa4e8('0x23')](function(){for(var _0x128e63 of _0x163b37){var _0x3928bc=path[_0xa4e8('0x88')](config['root'],'server',_0xa4e8('0xdd'),'attachments',_0xa4e8('0xf4'),_0x128e63[_0xa4e8('0x7d')]);fs_extra[_0xa4e8('0xf5')](_0x3928bc)['catch'](function(_0x172b8a){logger[_0xa4e8('0x1f')](_0xa4e8('0xf6'),_0x3928bc,_0x172b8a);});}});};exports[_0xa4e8('0xf7')]=function(_0x317b60,_0x2660a0){return db[_0xa4e8('0xb1')]['find']({'where':{'id':_0x317b60[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x2660a0,null))[_0xa4e8('0x2d')](function(_0xaa074d){if(_0xaa074d){return _0xaa074d[_0xa4e8('0xf7')](_0x317b60[_0xa4e8('0x65')][_0xa4e8('0x79')],_['omit'](_0x317b60[_0xa4e8('0x65')],[_0xa4e8('0x79'),'id'])||{});}})[_0xa4e8('0x2d')](respondWithResult(_0x2660a0,null))['catch'](handleError(_0x2660a0,null));};exports[_0xa4e8('0xf8')]=function(_0x389069,_0x570a15){var _0x5931f6={'raw':![],'where':{}};var _0x2d7b44={};var _0x4f6578={'count':0x0,'rows':[]};return db[_0xa4e8('0x49')][_0xa4e8('0x76')]({'where':{'id':_0x389069[_0xa4e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x570a15,null))[_0xa4e8('0x2d')](function(_0x1b1a62){if(_0x1b1a62){_0x2d7b44[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0xb1')]['rawAttributes']);_0x2d7b44[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x389069[_0xa4e8('0x4c')]);_0x2d7b44['filters']=_['intersection'](_0x2d7b44[_0xa4e8('0x43')],_0x2d7b44[_0xa4e8('0x4c')]);_0x5931f6[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x2d7b44[_0xa4e8('0x43')],qs[_0xa4e8('0x51')](_0x389069['query'][_0xa4e8('0x51')]));_0x5931f6['attributes']=_0x5931f6[_0xa4e8('0x50')]['length']?_0x5931f6[_0xa4e8('0x50')]:_0x2d7b44['model'];if(!_0x389069['query'][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x5931f6[_0xa4e8('0x28')]=qs[_0xa4e8('0x28')](_0x389069[_0xa4e8('0x4c')][_0xa4e8('0x28')]);_0x5931f6['offset']=qs[_0xa4e8('0x26')](_0x389069['query']['offset']);}_0x5931f6[_0xa4e8('0x55')]=qs[_0xa4e8('0x56')](_0x389069[_0xa4e8('0x4c')][_0xa4e8('0x56')]);_0x5931f6[_0xa4e8('0x5a')]=qs['filters'](_[_0xa4e8('0x77')](_0x389069['query'],_0x2d7b44['filters']));_0x5931f6[_0xa4e8('0x5a')][_0xa4e8('0x70')]=_0x1b1a62['id'];if(_0x389069[_0xa4e8('0x4c')][_0xa4e8('0x57')]){_0x5931f6[_0xa4e8('0x5a')]=_[_0xa4e8('0x58')](_0x5931f6[_0xa4e8('0x5a')],{'$or':_[_0xa4e8('0x48')](_0x5931f6[_0xa4e8('0x50')],function(_0x369335){var _0x5cd20a={};_0x5cd20a[_0x369335]={'$like':'%'+_0x389069[_0xa4e8('0x4c')][_0xa4e8('0x57')]+'%'};return _0x5cd20a;})});}_0x5931f6=_[_0xa4e8('0x58')]({},_0x5931f6,_0x389069[_0xa4e8('0x59')]);return db[_0xa4e8('0xb1')][_0xa4e8('0x29')]({'where':_0x5931f6[_0xa4e8('0x5a')]})[_0xa4e8('0x2d')](function(_0x2cc8fb){_0x4f6578[_0xa4e8('0x29')]=_0x2cc8fb;if(_0x389069['query'][_0xa4e8('0x5b')]){_0x5931f6['include']=[{'model':db[_0xa4e8('0xa1')],'as':_0xa4e8('0xf9'),'required':![]},{'model':db['User'],'as':_0xa4e8('0xfa'),'attributes':[_0xa4e8('0x32'),_0xa4e8('0xfb'),_0xa4e8('0xfc')],'required':![]},{'model':db['Tag'],'as':_0xa4e8('0xfd'),'attributes':['id','name',_0xa4e8('0xfe')],'where':_0x389069['query'][_0xa4e8('0xff')]?{'id':_0x389069[_0xa4e8('0x4c')][_0xa4e8('0xff')]}:undefined,'required':_0x389069[_0xa4e8('0x4c')][_0xa4e8('0xff')]?!![]:![]}];}return db[_0xa4e8('0xb1')][_0xa4e8('0x5d')](_0x5931f6);})[_0xa4e8('0x2d')](function(_0x16f5bb){_0x4f6578[_0xa4e8('0x5e')]=_0x16f5bb;return _0x4f6578;});}})[_0xa4e8('0x2d')](respondWithFilteredResult(_0x570a15,_0x5931f6))[_0xa4e8('0x23')](handleError(_0x570a15,null));};exports[_0xa4e8('0x100')]=function(_0x1f1b6c,_0x331aae){var _0x1696f4=0x0;var _0x5c4a8f=0x0;var _0x135918=![];var _0x2198a8;var _0x51614d;return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x1f1b6c[_0xa4e8('0x60')]['id']},'include':[{'model':db[_0xa4e8('0x8f')],'as':_0xa4e8('0x8f'),'include':[{'model':db[_0xa4e8('0x8f')],'as':'Intervals','attributes':['id',_0xa4e8('0xa5')]}]}]})[_0xa4e8('0x2d')](handleEntityNotFound(_0x331aae,null))[_0xa4e8('0x2d')](function(_0x212f83){if(_0x212f83){_0x2198a8=_0x212f83;return _0x212f83[_0xa4e8('0x101')]({'raw':!![]});}})[_0xa4e8('0x2d')](function(_0x57f973){if(_0x2198a8){if(_0x57f973){_0x51614d=_0x57f973;}}return require('../../config/license/util')[_0xa4e8('0x86')]();})[_0xa4e8('0x2d')](function(_0x319ea5){if(_0x319ea5){_0x5c4a8f=_0x319ea5[_0xa4e8('0x102')];_0x135918=_0x319ea5[_0xa4e8('0x103')];}})[_0xa4e8('0x2d')](function(){return db['ChatInteraction'][_0xa4e8('0x29')]({'where':{'closed':![]}});})[_0xa4e8('0x2d')](function(_0x313804){_0x1696f4=_0x313804;if(_0x5c4a8f&&_0x313804>_0x5c4a8f){return db['License'][_0xa4e8('0x76')]({'where':{'id':0x1}})['then'](function(_0x6fbd81){if(_0x6fbd81){_0x6fbd81[_0xa4e8('0x104')](_0xa4e8('0x105'));}});}})[_0xa4e8('0x2d')](function(){var _0x55a04d=_0x2198a8[_0xa4e8('0x8f')];var _0xf259d4=_0x2198a8[_0xa4e8('0x91')]||undefined;return _0x55a04d?_0x55a04d[_0xa4e8('0x92')](_0xf259d4):!![];})[_0xa4e8('0x2d')](function(_0x48ec6e){var _0x21754a=fs['readFileSync'](path[_0xa4e8('0x88')](config['root'],_0xa4e8('0x106')),_0xa4e8('0xd6'));var _0x27af8b=_0xa4e8('0x107');var _0x15329=![];try{const _0x1ffd04=new URL(_0x2198a8[_0xa4e8('0x66')]);_0x2198a8[_0xa4e8('0x66')]=_0x1ffd04['origin'];}catch(_0x5531ae){}var _0x4f3147;if(_0x1f1b6c[_0xa4e8('0x108')][_0xa4e8('0x3b')]){_0x1f1b6c[_0xa4e8('0x108')]['referer']=_0x1f1b6c[_0xa4e8('0x108')][_0xa4e8('0x3b')][_0xa4e8('0x109')](/\/$/,'');_0x4f3147=wildcardUtils[_0xa4e8('0x10a')](_0x2198a8[_0xa4e8('0x66')],_0x1f1b6c['headers'][_0xa4e8('0x3b')]);}else{_0x1f1b6c[_0xa4e8('0x108')]['referer']=_0x2198a8['address'];_0x4f3147=!![];}var _0x2a8bc8={'chatVersion':_0x27af8b,'chatWebsiteAddressOrigin':_0x4f3147?_0x1f1b6c['headers'][_0xa4e8('0x3b')]:_0x2198a8[_0xa4e8('0x66')],'remote':_0x2198a8[_0xa4e8('0x10b')],'query':querystring[_0xa4e8('0x46')](_[_0xa4e8('0x58')](_0x2198a8[_0xa4e8('0x2e')]({'plain':!![]}),{'customerIp':_0x1f1b6c[_0xa4e8('0x108')][_0xa4e8('0x37')]||_0x1f1b6c['headers'][_0xa4e8('0x10c')]||_0x1f1b6c[_0xa4e8('0x10d')]['remoteAddress']||_0x1f1b6c['ip'],'referer':_0x1f1b6c['headers'][_0xa4e8('0x3b')],'openedInteractions':_0x1696f4,'maxInteractions':_0x5c4a8f,'virtual':_0x135918['virtual'],'online':_0x48ec6e,'custom':_0x135918,'address':_0x4f3147?_0x1f1b6c['headers'][_0xa4e8('0x3b')]:null}))[_0xa4e8('0x109')](/'/g,'\x5c\x27')};_0x331aae['send'](ejs['render'](Mustache[_0xa4e8('0xd7')](_0x21754a,_0x2a8bc8),{'proactiveActions':_0x51614d,'alignment':_0x2198a8['alignment'],'verticalAlignment':_0x2198a8[_0xa4e8('0x10e')],'div_color':_0x2198a8[_0xa4e8('0xfe')],'labelText':_0x2198a8[_0xa4e8('0x10f')],'text_color':_0x2198a8[_0xa4e8('0x110')],'text_button_color':_0x2198a8[_0xa4e8('0x111')],'button_color':_0x2198a8[_0xa4e8('0x112')],'background_color':_0x2198a8[_0xa4e8('0x113')],'hideWhenOffline':_0x2198a8[_0xa4e8('0x114')],'intervalId':_0x2198a8[_0xa4e8('0x115')],'isDevelopment':_0x15329,'chatVersion':_0x27af8b}));})['catch'](handleError(_0x331aae,null));};exports[_0xa4e8('0x116')]=function(_0x30ca35,_0x56746c){var _0x382bcb=_0x30ca35['params']['id'];var _0x28b1c1=_0x30ca35[_0xa4e8('0x65')];var _0x2cc9f5=0xc8;var _0x1ac3c9=null;return db[_0xa4e8('0xe1')][_0xa4e8('0x117')]({'isolationLevel':db['sequelize'][_0xa4e8('0x118')][_0xa4e8('0x119')][_0xa4e8('0x11a')]},function(_0x4945cb){return db[_0xa4e8('0x49')]['findOne']({'where':{'id':_0x382bcb},'transaction':_0x4945cb})[_0xa4e8('0x2d')](function(_0x1534b0){if(_0x1534b0){return db[_0xa4e8('0x11b')]['destroy']({'where':{'ChatWebsiteId':_0x382bcb},'transaction':_0x4945cb})[_0xa4e8('0x2d')](function(){var _0x329567=_[_0xa4e8('0x48')](_0x28b1c1,function(_0xb95b72){_0xb95b72[_0xa4e8('0x70')]=_0x382bcb;return _0xb95b72;});return db[_0xa4e8('0x11b')][_0xa4e8('0x11c')](_0x329567,{'transaction':_0x4945cb});});}else{_0x2cc9f5=0x194;_0x1ac3c9=[];}});})[_0xa4e8('0x2d')](function(){if(_0x2cc9f5!==0x194){return db[_0xa4e8('0x11b')][_0xa4e8('0x11d')]({'where':{'ChatWebsiteId':_0x382bcb},'order':_0xa4e8('0xaa')})['then'](function(_0x29ba07){_0x1ac3c9=_0x29ba07;});}})[_0xa4e8('0x23')](function(_0x4d08c7){_0x2cc9f5=0x1f4;logger[_0xa4e8('0x1f')](_0x4d08c7['stack']);if(_0x4d08c7[_0xa4e8('0x32')]){delete _0x4d08c7[_0xa4e8('0x32')];}_0x1ac3c9=_0x4d08c7;})[_0xa4e8('0x11e')](function(){if(_0x1ac3c9===null){_0x56746c[_0xa4e8('0x24')](_0x2cc9f5);}else{if(_0x2cc9f5===0x1f4){_0x56746c[_0xa4e8('0x2a')](_0x2cc9f5)[_0xa4e8('0x33')](_0x1ac3c9);}else{_0x56746c[_0xa4e8('0x2a')](_0x2cc9f5)['json'](_0x1ac3c9);}}});};exports[_0xa4e8('0x11f')]=function(_0x51c485,_0x7acadd){var _0x1687d3={};var _0x49458a={};var _0x12cc57;var _0x4ab294;return db['ChatWebsite']['findOne']({'where':{'id':_0x51c485[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x7acadd,null))[_0xa4e8('0x2d')](function(_0x3d4cee){if(_0x3d4cee){_0x12cc57=_0x3d4cee;_0x49458a[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0x11b')][_0xa4e8('0x62')]);_0x49458a[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x51c485[_0xa4e8('0x4c')]);_0x49458a[_0xa4e8('0x4e')]=_['intersection'](_0x49458a['model'],_0x49458a['query']);_0x1687d3[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x49458a['model'],qs[_0xa4e8('0x51')](_0x51c485[_0xa4e8('0x4c')][_0xa4e8('0x51')]));_0x1687d3[_0xa4e8('0x50')]=_0x1687d3[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x1687d3[_0xa4e8('0x50')]:_0x49458a[_0xa4e8('0x43')];_0x1687d3['order']=qs[_0xa4e8('0x56')](_0x51c485[_0xa4e8('0x4c')][_0xa4e8('0x56')]);_0x1687d3[_0xa4e8('0x5a')]=qs[_0xa4e8('0x4e')](_[_0xa4e8('0x77')](_0x51c485['query'],_0x49458a[_0xa4e8('0x4e')]));if(_0x51c485[_0xa4e8('0x4c')][_0xa4e8('0x57')]){_0x1687d3['where']=_[_0xa4e8('0x58')](_0x1687d3['where'],{'$or':_[_0xa4e8('0x48')](_0x1687d3[_0xa4e8('0x50')],function(_0x30c568){var _0x2388a5={};_0x2388a5[_0x30c568]={'$like':'%'+_0x51c485['query'][_0xa4e8('0x57')]+'%'};return _0x2388a5;})});}_0x1687d3=_['merge']({},_0x1687d3,_0x51c485[_0xa4e8('0x59')]);return _0x12cc57[_0xa4e8('0x11f')](_0x1687d3);}})[_0xa4e8('0x2d')](function(_0x1096a0){if(_0x1096a0){_0x4ab294=_0x1096a0['length'];if(!_0x51c485[_0xa4e8('0x4c')]['hasOwnProperty'](_0xa4e8('0x54'))){_0x1687d3[_0xa4e8('0x28')]=qs[_0xa4e8('0x28')](_0x51c485['query'][_0xa4e8('0x28')]);_0x1687d3[_0xa4e8('0x26')]=qs[_0xa4e8('0x26')](_0x51c485[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}return _0x12cc57[_0xa4e8('0x11f')](_0x1687d3);}})[_0xa4e8('0x2d')](function(_0x3a3b36){if(_0x3a3b36){return _0x3a3b36?{'count':_0x4ab294,'rows':_0x3a3b36}:null;}})[_0xa4e8('0x2d')](respondWithResult(_0x7acadd,null))[_0xa4e8('0x23')](handleError(_0x7acadd,null));};exports['addProactiveActions']=function(_0x253bc0,_0x4b9dc9){return db[_0xa4e8('0x120')][_0xa4e8('0x63')]({'where':{'id':_0x253bc0[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x4b9dc9,null))[_0xa4e8('0x2d')](function(_0xc8d20c){if(_0xc8d20c){return _0xc8d20c[_0xa4e8('0x121')](_0x253bc0[_0xa4e8('0x65')][_0xa4e8('0x79')],_['omit'](_0x253bc0['body'],['ids','id'])||{});}})[_0xa4e8('0x2d')](respondWithResult(_0x4b9dc9,null))[_0xa4e8('0x23')](handleError(_0x4b9dc9,null));};exports[_0xa4e8('0x101')]=function(_0x40d14a,_0x3bb732){var _0x21b784={};var _0x204b95={};var _0x19dbc9;var _0x4da7c1;return db[_0xa4e8('0x49')][_0xa4e8('0x76')]({'where':{'id':_0x40d14a[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x3bb732,null))[_0xa4e8('0x2d')](function(_0x32e442){if(_0x32e442){_0x19dbc9=_0x32e442;_0x204b95[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0x122')][_0xa4e8('0x62')]);_0x204b95[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x40d14a[_0xa4e8('0x4c')]);_0x204b95['filters']=_['intersection'](_0x204b95[_0xa4e8('0x43')],_0x204b95[_0xa4e8('0x4c')]);_0x21b784[_0xa4e8('0x50')]=_['intersection'](_0x204b95[_0xa4e8('0x43')],qs[_0xa4e8('0x51')](_0x40d14a[_0xa4e8('0x4c')][_0xa4e8('0x51')]));_0x21b784['attributes']=_0x21b784['attributes']['length']?_0x21b784[_0xa4e8('0x50')]:_0x204b95[_0xa4e8('0x43')];_0x21b784['order']=qs[_0xa4e8('0x56')](_0x40d14a['query'][_0xa4e8('0x56')]);_0x21b784[_0xa4e8('0x5a')]=qs[_0xa4e8('0x4e')](_[_0xa4e8('0x77')](_0x40d14a[_0xa4e8('0x4c')],_0x204b95[_0xa4e8('0x4e')]));if(_0x40d14a['query'][_0xa4e8('0x57')]){_0x21b784['where']=_['merge'](_0x21b784['where'],{'$or':_['map'](_0x21b784['attributes'],function(_0x8712e7){var _0x4f52ba={};_0x4f52ba[_0x8712e7]={'$like':'%'+_0x40d14a[_0xa4e8('0x4c')]['filter']+'%'};return _0x4f52ba;})});}_0x21b784=_[_0xa4e8('0x58')]({},_0x21b784,_0x40d14a[_0xa4e8('0x59')]);return _0x19dbc9[_0xa4e8('0x101')](_0x21b784);}})[_0xa4e8('0x2d')](function(_0x20d03e){if(_0x20d03e){_0x4da7c1=_0x20d03e[_0xa4e8('0x52')];if(!_0x40d14a['query'][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x21b784['limit']=qs['limit'](_0x40d14a[_0xa4e8('0x4c')]['limit']);_0x21b784['offset']=qs[_0xa4e8('0x26')](_0x40d14a[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}return _0x19dbc9[_0xa4e8('0x101')](_0x21b784);}})[_0xa4e8('0x2d')](function(_0xbb5378){if(_0xbb5378){return _0xbb5378?{'count':_0x4da7c1,'rows':_0xbb5378}:null;}})['then'](respondWithResult(_0x3bb732,null))[_0xa4e8('0x23')](handleError(_0x3bb732,null));};exports[_0xa4e8('0x123')]=function(_0x59d382,_0x4c79eb){var _0x18cbcc=_0x59d382['query'][_0xa4e8('0x124')]===_0xa4e8('0x125')?_0xa4e8('0x126'):_0xa4e8('0x127');return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'attributes':['id',_0x18cbcc],'where':{'id':_0x59d382[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x4c79eb,null))[_0xa4e8('0x2d')](function(_0x8583ff){if(_0x8583ff){var _0x5c7c9b=_0x8583ff[_0x18cbcc];var _0x15ee6e=_0x5c7c9b&&_0x5c7c9b[_0xa4e8('0x128')]?_0x5c7c9b[_0xa4e8('0x128')]:[];_0x4c79eb[_0xa4e8('0x33')]({'fromKey':_[_0xa4e8('0x87')](_0x5c7c9b[_0xa4e8('0x129')])?undefined:_0x5c7c9b[_0xa4e8('0x129')],'count':_0x15ee6e[_0xa4e8('0x52')],'rows':_0x15ee6e});}})[_0xa4e8('0x23')](handleError(_0x4c79eb,null));};exports[_0xa4e8('0x12a')]=function(_0x2b496d,_0x3bb4b9){var _0x4e62b6={'raw':![],'where':{}};var _0x4b9075={};var _0x56a5f2={'count':0x0,'rows':[]};return db[_0xa4e8('0x49')][_0xa4e8('0x76')]({'where':{'id':_0x2b496d[_0xa4e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x3bb4b9,null))[_0xa4e8('0x2d')](function(_0x3f8703){if(_0x3f8703){_0x4b9075[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0x12b')][_0xa4e8('0x62')]);_0x4b9075[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x2b496d[_0xa4e8('0x4c')]);_0x4b9075['filters']=_[_0xa4e8('0x4f')](_0x4b9075['model'],_0x4b9075[_0xa4e8('0x4c')]);_0x4e62b6[_0xa4e8('0x50')]=_[_0xa4e8('0x4f')](_0x4b9075[_0xa4e8('0x43')],qs[_0xa4e8('0x51')](_0x2b496d[_0xa4e8('0x4c')]['fields']));_0x4e62b6[_0xa4e8('0x50')]=_0x4e62b6[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x4e62b6[_0xa4e8('0x50')]:_0x4b9075[_0xa4e8('0x43')];if(!_0x2b496d['query'][_0xa4e8('0x53')](_0xa4e8('0x54'))){_0x4e62b6['limit']=qs[_0xa4e8('0x28')](_0x2b496d[_0xa4e8('0x4c')][_0xa4e8('0x28')]);_0x4e62b6[_0xa4e8('0x26')]=qs[_0xa4e8('0x26')](_0x2b496d[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}_0x4e62b6[_0xa4e8('0x55')]=qs['sort'](_0x2b496d[_0xa4e8('0x4c')][_0xa4e8('0x56')]);_0x4e62b6[_0xa4e8('0x5a')]=qs[_0xa4e8('0x4e')](_['pick'](_0x2b496d[_0xa4e8('0x4c')],_0x4b9075[_0xa4e8('0x4e')]));_0x4e62b6[_0xa4e8('0x5a')][_0xa4e8('0x70')]=_0x3f8703['id'];if(_0x2b496d['query'][_0xa4e8('0x57')]){_0x4e62b6[_0xa4e8('0x5a')]=_[_0xa4e8('0x58')](_0x4e62b6['where'],{'$or':_[_0xa4e8('0x48')](_0x4e62b6[_0xa4e8('0x50')],function(_0x5c18ad){var _0x1b4d99={};_0x1b4d99[_0x5c18ad]={'$like':'%'+_0x2b496d['query']['filter']+'%'};return _0x1b4d99;})});}_0x4e62b6=_['merge']({},_0x4e62b6,_0x2b496d[_0xa4e8('0x59')]);return db[_0xa4e8('0x12b')]['count']({'where':_0x4e62b6[_0xa4e8('0x5a')]})[_0xa4e8('0x2d')](function(_0x3436d5){_0x56a5f2[_0xa4e8('0x29')]=_0x3436d5;if(_0x2b496d[_0xa4e8('0x4c')][_0xa4e8('0x5b')]){_0x4e62b6[_0xa4e8('0x5c')]=[{'all':!![]}];}else{_0x4e62b6['include']=[{'model':db[_0xa4e8('0xa1')],'as':_0xa4e8('0xf9'),'required':![]},{'model':db[_0xa4e8('0x12c')],'as':_0xa4e8('0x12d'),'required':![]}];}return db[_0xa4e8('0x12b')][_0xa4e8('0x5d')](_0x4e62b6);})[_0xa4e8('0x2d')](function(_0x4a5717){_0x56a5f2['rows']=_0x4a5717;return _0x56a5f2;});}})['then'](respondWithFilteredResult(_0x3bb4b9,_0x4e62b6))[_0xa4e8('0x23')](handleError(_0x3bb4b9,null));};exports[_0xa4e8('0x12e')]=function(_0x2f2479,_0x2c21e0){return db[_0xa4e8('0x49')]['find']({'where':{'id':_0x2f2479[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x2c21e0,null))['then'](function(_0x2e9a16){if(_0x2e9a16){return _0x2e9a16['addAgents'](_0x2f2479[_0xa4e8('0x65')][_0xa4e8('0x79')],_[_0xa4e8('0x12f')](_0x2f2479[_0xa4e8('0x65')],['ids','id'])||{})['spread'](function(_0x5f0207){for(var _0x847eef=0x0;_0x847eef<_0x2f2479[_0xa4e8('0x65')][_0xa4e8('0x79')][_0xa4e8('0x52')];_0x847eef+=0x1){socket[_0xa4e8('0x130')](_0xa4e8('0x131'),{'UserId':Number(_0x2f2479[_0xa4e8('0x65')]['ids'][_0x847eef]),'ChatWebsiteId':Number(_0x2f2479['params']['id'])});}return _0x5f0207;});}})['then'](respondWithResult(_0x2c21e0,null))[_0xa4e8('0x23')](handleError(_0x2c21e0,null));};exports[_0xa4e8('0x132')]=function(_0x1da025,_0x2177af){return db[_0xa4e8('0x49')][_0xa4e8('0x63')]({'where':{'id':_0x1da025['params']['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x2177af,null))[_0xa4e8('0x2d')](function(_0x20bda5){if(_0x20bda5){return _0x20bda5[_0xa4e8('0x132')](_0x1da025['query'][_0xa4e8('0x79')])[_0xa4e8('0x2d')](function(){if(_['isArray'](_0x1da025[_0xa4e8('0x4c')]['ids'])){for(var _0xe4bb7d=0x0;_0xe4bb7d<_0x1da025[_0xa4e8('0x4c')]['ids'][_0xa4e8('0x52')];_0xe4bb7d+=0x1){socket[_0xa4e8('0x130')]('userChatWebsite:remove',{'UserId':Number(_0x1da025[_0xa4e8('0x4c')][_0xa4e8('0x79')][_0xe4bb7d]),'ChatWebsiteId':Number(_0x1da025['params']['id'])});}}else{socket['emit'](_0xa4e8('0x133'),{'UserId':Number(_0x1da025[_0xa4e8('0x4c')][_0xa4e8('0x79')]),'ChatWebsiteId':Number(_0x1da025[_0xa4e8('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x2177af,null))['catch'](handleError(_0x2177af,null));};exports[_0xa4e8('0x134')]=function(_0x555a54,_0x50282e){var _0x18ae6c={};var _0x174902={};var _0x2fde66;var _0x1385dc;return db[_0xa4e8('0x49')][_0xa4e8('0x76')]({'where':{'id':_0x555a54[_0xa4e8('0x60')]['id']}})[_0xa4e8('0x2d')](handleEntityNotFound(_0x50282e,null))[_0xa4e8('0x2d')](function(_0x2ca2c1){if(_0x2ca2c1){_0x2fde66=_0x2ca2c1;_0x174902[_0xa4e8('0x43')]=_[_0xa4e8('0x4d')](db[_0xa4e8('0xbe')][_0xa4e8('0x62')]);_0x174902[_0xa4e8('0x4c')]=_[_0xa4e8('0x4d')](_0x555a54[_0xa4e8('0x4c')]);_0x174902['filters']=_[_0xa4e8('0x4f')](_0x174902[_0xa4e8('0x43')],_0x174902['query']);_0x18ae6c[_0xa4e8('0x50')]=_['intersection'](_0x174902['model'],qs[_0xa4e8('0x51')](_0x555a54[_0xa4e8('0x4c')]['fields']));_0x18ae6c[_0xa4e8('0x50')]=_0x18ae6c[_0xa4e8('0x50')][_0xa4e8('0x52')]?_0x18ae6c[_0xa4e8('0x50')]:_0x174902[_0xa4e8('0x43')];_0x18ae6c[_0xa4e8('0x55')]=qs[_0xa4e8('0x56')](_0x555a54[_0xa4e8('0x4c')]['sort']);_0x18ae6c['where']=qs[_0xa4e8('0x4e')](_[_0xa4e8('0x77')](_0x555a54['query'],_0x174902[_0xa4e8('0x4e')]));if(_0x555a54['query'][_0xa4e8('0x57')]){_0x18ae6c['where']=_[_0xa4e8('0x58')](_0x18ae6c[_0xa4e8('0x5a')],{'$or':_[_0xa4e8('0x48')](_0x18ae6c[_0xa4e8('0x50')],function(_0x146677){var _0x44434c={};_0x44434c[_0x146677]={'$like':'%'+_0x555a54['query'][_0xa4e8('0x57')]+'%'};return _0x44434c;})});}_0x18ae6c=_[_0xa4e8('0x58')]({},_0x18ae6c,_0x555a54['options']);return _0x2fde66[_0xa4e8('0x134')](_0x18ae6c);}})[_0xa4e8('0x2d')](function(_0x34c077){if(_0x34c077){_0x1385dc=_0x34c077[_0xa4e8('0x52')];if(!_0x555a54[_0xa4e8('0x4c')]['hasOwnProperty'](_0xa4e8('0x54'))){_0x18ae6c[_0xa4e8('0x28')]=qs[_0xa4e8('0x28')](_0x555a54['query']['limit']);_0x18ae6c[_0xa4e8('0x26')]=qs[_0xa4e8('0x26')](_0x555a54[_0xa4e8('0x4c')][_0xa4e8('0x26')]);}return _0x2fde66[_0xa4e8('0x134')](_0x18ae6c);}})['then'](function(_0x2b6896){if(_0x2b6896){return _0x2b6896?{'count':_0x1385dc,'rows':_0x2b6896}:null;}})['then'](respondWithResult(_0x50282e,null))[_0xa4e8('0x23')](handleError(_0x50282e,null));}; \ No newline at end of file +var _0xb191=['rows','removeDispositions','ids','ChatWebsiteId','CannedAnswer','getAnswers','includeAll','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','Interval','resolve','timezone','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','List','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','Contacts','mapKey','contact','headers','threadId','customerIp','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','files','no\x20available\x20attributes','difference','Sequelize','ValidationError','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','findOne','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getLicense','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','lodash','querystring','ioredis','jayson/promise','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','url','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','request\x20sent','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','options','include','show','params','Pause','rawAttributes','find','catch','address','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','forEach','describe','addDisposition','Disposition','getDispositions','sort','pick','findAll'];(function(_0x1626bd,_0x40a7a9){var _0x16c735=function(_0x42a37b){while(--_0x42a37b){_0x1626bd['push'](_0x1626bd['shift']());}};_0x16c735(++_0x40a7a9);}(_0xb191,0x1ed));var _0x1b19=function(_0x16e007,_0x4f727c){_0x16e007=_0x16e007-0x0;var _0x2f7681=_0xb191[_0x16e007];return _0x2f7681;};'use strict';var Mustache=require(_0x1b19('0x0'));var util=require(_0x1b19('0x1'));var path=require(_0x1b19('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b19('0x3'));var querystring=require(_0x1b19('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0x1b19('0x5'));var jayson=require(_0x1b19('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x1b19('0x7'))(_0x1b19('0x8'));var config=require(_0x1b19('0x9'));var APIBadRequestError=require('../../errors/api')[_0x1b19('0xa')];var APINotFoundError=require(_0x1b19('0xb'))[_0x1b19('0xc')];var APIOutOfIntervalError=require(_0x1b19('0xb'))[_0x1b19('0xd')];var APIHandleError=require(_0x1b19('0xb'))['handleError'];var APIConflictError=require(_0x1b19('0xb'))[_0x1b19('0xe')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x1b19('0xf'))['URL'];var db=require(_0x1b19('0x10'))['db'];config[_0x1b19('0x11')]=_[_0x1b19('0x12')](config[_0x1b19('0x11')],{'host':_0x1b19('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b19('0x11')]));require(_0x1b19('0x14'))[_0x1b19('0x15')](socket);var client=jayson[_0x1b19('0x16')][_0x1b19('0x17')]({'port':0x232c});var client9002=jayson[_0x1b19('0x16')]['http']({'port':0x232a});var client9003=jayson[_0x1b19('0x16')]['http']({'port':0x232b});var client9001=jayson[_0x1b19('0x16')]['http']({'port':0x2329});function respondWithRpcPromise(_0x111564,_0x13f917,_0x11c6a3,_0x36e21a){return new Promise(function(_0x1286f2,_0x25a8e2){var _0x560880=_0x36e21a||client;return _0x560880[_0x1b19('0x18')](_0x111564,_0x11c6a3)['then'](function(_0x36424a){logger[_0x1b19('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x13f917,'request\x20sent');logger['debug'](_0x1b19('0x1a'),_0x13f917,'request\x20sent',JSON[_0x1b19('0x1b')](_0x36424a));if(_0x36424a['error']){if(_0x36424a[_0x1b19('0x1c')][_0x1b19('0x1d')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x13f917,_0x36424a[_0x1b19('0x1c')][_0x1b19('0x1e')]);return _0x25a8e2(_0x36424a[_0x1b19('0x1c')][_0x1b19('0x1e')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x13f917,_0x36424a[_0x1b19('0x1c')]['message']);return _0x1286f2(_0x36424a[_0x1b19('0x1c')][_0x1b19('0x1e')]);}else{logger[_0x1b19('0x19')](_0x1b19('0x1f'),_0x13f917,_0x1b19('0x20'));_0x1286f2(_0x36424a[_0x1b19('0x21')]['message']);}})['catch'](function(_0x40d8bc){logger[_0x1b19('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x13f917,_0x40d8bc);_0x25a8e2(_0x40d8bc);});});}function respondWithStatusCode(_0x5675d6,_0x515d58){_0x515d58=_0x515d58||0xcc;return function(_0x1ea1d1){if(_0x1ea1d1){return _0x5675d6[_0x1b19('0x22')](_0x515d58);}return _0x5675d6[_0x1b19('0x23')](_0x515d58)[_0x1b19('0x24')]();};}function respondWithResult(_0x2105e9,_0x497622){_0x497622=_0x497622||0xc8;return function(_0x350d6f){if(_0x350d6f){return _0x2105e9['status'](_0x497622)[_0x1b19('0x25')](_0x350d6f);}};}function respondWithFilteredResult(_0x3214f1,_0x54dbf3){return function(_0x151064){if(_0x151064){var _0x484791=typeof _0x54dbf3[_0x1b19('0x26')]==='undefined'&&typeof _0x54dbf3[_0x1b19('0x27')]===_0x1b19('0x28');var _0x43d06f=_0x151064[_0x1b19('0x29')];var _0xe277de=_0x484791?0x0:_0x54dbf3[_0x1b19('0x26')];var _0x487682=_0x484791?_0x151064[_0x1b19('0x29')]:_0x54dbf3[_0x1b19('0x26')]+_0x54dbf3[_0x1b19('0x27')];var _0x247aae;if(_0x487682>=_0x43d06f){_0x487682=_0x43d06f;_0x247aae=0xc8;}else{_0x247aae=0xce;}_0x3214f1['status'](_0x247aae);return _0x3214f1['set'](_0x1b19('0x2a'),_0xe277de+'-'+_0x487682+'/'+_0x43d06f)[_0x1b19('0x25')](_0x151064);}return null;};}function saveUpdates(_0x4cb1f8){return function(_0x2e691a){if(_0x2e691a){return _0x2e691a['update'](_0x4cb1f8)[_0x1b19('0x2b')](function(_0x15b281){return _0x15b281;});}return null;};}function removeEntity(_0xc85352){return function(_0x13aadc){if(_0x13aadc){return _0x13aadc[_0x1b19('0x2c')]()[_0x1b19('0x2b')](function(){var _0x261a4e=_0x13aadc[_0x1b19('0x2d')]({'plain':!![]});var _0x13a076=_0x1b19('0x2e');return db[_0x1b19('0x2f')][_0x1b19('0x2c')]({'where':{'type':_0x13a076,'resourceId':_0x261a4e['id']}})[_0x1b19('0x2b')](function(){return _0x13aadc;});})[_0x1b19('0x2b')](function(){_0xc85352[_0x1b19('0x23')](0xcc)[_0x1b19('0x24')]();});}};}function handleEntityNotFound(_0x5a9ad1){return function(_0x554fd3){if(!_0x554fd3){_0x5a9ad1['sendStatus'](0x194);}return _0x554fd3;};}function handleError(_0x25e3ef,_0xdb8f14){_0xdb8f14=_0xdb8f14||0x1f4;return function(_0x5a3968){logger['error'](_0x5a3968[_0x1b19('0x30')]);if(_0x5a3968[_0x1b19('0x31')]){delete _0x5a3968['name'];}_0x25e3ef[_0x1b19('0x23')](_0xdb8f14)[_0x1b19('0x32')](_0x5a3968);};}function createInteractionObject(_0x2daac6,_0x1713c8,_0x862c4f,_0x34f30f){var _0x5bc1c4=require(_0x1b19('0x33'));var _0x371955=new _0x5bc1c4();var _0x2ae258=_0x371955[_0x1b19('0x34')](_0x862c4f[_0x1b19('0x35')])[_0x1b19('0x36')]();var _0x479e67=_0x1713c8['customerIp'];if(_0x862c4f['cf-connecting-ip']){_0x479e67=_0x862c4f[_0x1b19('0x37')];}else if(_0x862c4f[_0x1b19('0x38')]){_0x479e67=_[_0x1b19('0x39')](_0x862c4f[_0x1b19('0x38')]['split'](','));}return{'ContactId':_0x34f30f['id'],'ChatWebsiteId':_0x2daac6,'from':(_0x34f30f[_0x1b19('0x3a')]||'')+'\x20'+(_0x34f30f[_0x1b19('0x3b')]||''),'customerIp':_0x479e67,'customerPort':_0x862c4f[_0x1b19('0x3c')]?_0x862c4f[_0x1b19('0x3c')]:null,'referer':_0x1713c8[_0x1b19('0x3d')],'browserName':_0x2ae258[_0x1b19('0x3e')][_0x1b19('0x31')]&&_0x2ae258[_0x1b19('0x3e')][_0x1b19('0x3f')]?util[_0x1b19('0x40')](_0x1b19('0x41'),_0x2ae258[_0x1b19('0x3e')]['name'],_0x2ae258[_0x1b19('0x3e')][_0x1b19('0x3f')]):_0x1b19('0x42'),'browserVersion':_0x2ae258['browser'][_0x1b19('0x3f')]||_0x1b19('0x42'),'osName':util['format']('%s\x20%s',_0x2ae258['os'][_0x1b19('0x31')],_0x2ae258['os']['version']),'osVersion':_0x2ae258['os'][_0x1b19('0x3f')],'deviceModel':_0x2ae258[_0x1b19('0x43')]['model']&&_0x2ae258[_0x1b19('0x43')][_0x1b19('0x44')]?util[_0x1b19('0x40')](_0x1b19('0x45'),_0x2ae258[_0x1b19('0x43')]['model'],_0x2ae258[_0x1b19('0x43')][_0x1b19('0x44')],_0x2ae258[_0x1b19('0x43')]['type']):null,'deviceVendor':_0x2ae258[_0x1b19('0x43')]['vendor'],'deviceType':_0x2ae258[_0x1b19('0x43')][_0x1b19('0x46')],'formData':JSON['stringify'](_0x1713c8)};}exports['index']=function(_0x1ee644,_0x45e1dc){var _0x15620d={'include':[{'model':db['Pause'],'as':_0x1b19('0x47')}]},_0x2047eb={},_0x1568c8={'count':0x0,'rows':[]};var _0x30fcb6=_[_0x1b19('0x48')](db[_0x1b19('0x49')]['rawAttributes'],function(_0x1e12fd){return{'name':_0x1e12fd[_0x1b19('0x4a')],'type':_0x1e12fd[_0x1b19('0x46')][_0x1b19('0x4b')]};});_0x2047eb[_0x1b19('0x4c')]=_[_0x1b19('0x48')](_0x30fcb6,'name');_0x2047eb[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0x1ee644['query']);_0x2047eb['filters']=_[_0x1b19('0x4f')](_0x2047eb['model'],_0x2047eb[_0x1b19('0x4d')]);_0x15620d[_0x1b19('0x50')]=_['intersection'](_0x2047eb[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0x1ee644[_0x1b19('0x4d')]['fields']));_0x15620d[_0x1b19('0x50')]=_0x15620d['attributes'][_0x1b19('0x52')]?_0x15620d[_0x1b19('0x50')]:_0x2047eb[_0x1b19('0x4c')];if(!_0x1ee644[_0x1b19('0x4d')][_0x1b19('0x53')](_0x1b19('0x54'))){_0x15620d['limit']=qs[_0x1b19('0x27')](_0x1ee644['query'][_0x1b19('0x27')]);_0x15620d['offset']=qs[_0x1b19('0x26')](_0x1ee644[_0x1b19('0x4d')]['offset']);}_0x15620d[_0x1b19('0x55')]=qs['sort'](_0x1ee644[_0x1b19('0x4d')]['sort']);_0x15620d[_0x1b19('0x56')]=qs[_0x1b19('0x57')](_['pick'](_0x1ee644[_0x1b19('0x4d')],_0x2047eb[_0x1b19('0x57')]),_0x30fcb6);if(_0x1ee644[_0x1b19('0x4d')][_0x1b19('0x58')]){_0x15620d[_0x1b19('0x56')]=_['merge'](_0x15620d['where'],{'$or':_[_0x1b19('0x48')](_0x30fcb6,function(_0x4ac615){if(_0x4ac615[_0x1b19('0x46')]!=='VIRTUAL'){var _0x57a8e8={};_0x57a8e8[_0x4ac615[_0x1b19('0x31')]]={'$like':'%'+_0x1ee644[_0x1b19('0x4d')][_0x1b19('0x58')]+'%'};return _0x57a8e8;}})});}_0x15620d=_[_0x1b19('0x59')]({},_0x15620d,_0x1ee644[_0x1b19('0x5a')]);var _0x4fbe95={'where':_0x15620d[_0x1b19('0x56')]};return db[_0x1b19('0x49')][_0x1b19('0x29')](_0x4fbe95)[_0x1b19('0x2b')](function(_0x3300b3){_0x1568c8[_0x1b19('0x29')]=_0x3300b3;if(_0x1ee644[_0x1b19('0x4d')]['includeAll']){_0x15620d[_0x1b19('0x5b')]=[{'all':!![]}];}return db[_0x1b19('0x49')]['findAll'](_0x15620d);})[_0x1b19('0x2b')](function(_0x25aebd){_0x1568c8['rows']=_0x25aebd;return _0x1568c8;})[_0x1b19('0x2b')](respondWithFilteredResult(_0x45e1dc,_0x15620d))['catch'](handleError(_0x45e1dc,null));};exports[_0x1b19('0x5c')]=function(_0x56075f,_0x5f1b3d){var _0x2e3b1b={'raw':![],'where':{'id':_0x56075f[_0x1b19('0x5d')]['id']},'include':[{'model':db[_0x1b19('0x5e')],'as':'mandatoryDispositionPause'}]},_0x3ea1c5={};_0x3ea1c5[_0x1b19('0x4c')]=_['keys'](db[_0x1b19('0x49')][_0x1b19('0x5f')]);_0x3ea1c5[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0x56075f['query']);_0x3ea1c5['filters']=_[_0x1b19('0x4f')](_0x3ea1c5[_0x1b19('0x4c')],_0x3ea1c5[_0x1b19('0x4d')]);_0x2e3b1b[_0x1b19('0x50')]=_[_0x1b19('0x4f')](_0x3ea1c5[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0x56075f[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x2e3b1b[_0x1b19('0x50')]=_0x2e3b1b['attributes'][_0x1b19('0x52')]?_0x2e3b1b[_0x1b19('0x50')]:_0x3ea1c5['model'];if(_0x56075f[_0x1b19('0x4d')]['includeAll']){_0x2e3b1b[_0x1b19('0x5b')]=[{'all':!![]}];}_0x2e3b1b=_[_0x1b19('0x59')]({},_0x2e3b1b,_0x56075f[_0x1b19('0x5a')]);return db[_0x1b19('0x49')][_0x1b19('0x60')](_0x2e3b1b)[_0x1b19('0x2b')](handleEntityNotFound(_0x5f1b3d,null))[_0x1b19('0x2b')](respondWithResult(_0x5f1b3d,null))[_0x1b19('0x61')](handleError(_0x5f1b3d,null));};exports['create']=function(_0x1a4bac,_0x45c5b8){var _0x1d2631=null;_0x1a4bac['body'][_0x1b19('0x62')][_0x1b19('0x63')](',')['forEach'](_0x1a4ae5=>{if(_0x1a4ae5[_0x1b19('0x64')]()!==''&&!wildcardUtils[_0x1b19('0x65')](_0x1a4ae5['trim']())){_0x1d2631=new APIBadRequestError('\x22'+_0x1a4ae5+_0x1b19('0x66'));}});if(_0x1d2631){return handleError(_0x45c5b8,null)(_0x1d2631);}return db['ChatWebsite'][_0x1b19('0x67')](_0x1a4bac[_0x1b19('0x68')],{})[_0x1b19('0x2b')](function(_0xa94ac8){var _0x4dae46=_0x1a4bac[_0x1b19('0x69')]['get']({'plain':!![]});if(!_0x4dae46)throw new Error(_0x1b19('0x6a'));if(_0x4dae46['role']==='user'){var _0x49d7d5=_0xa94ac8[_0x1b19('0x2d')]({'plain':!![]});var _0x3cb0bb='ChatWebsites';return db[_0x1b19('0x6b')][_0x1b19('0x60')]({'where':{'name':_0x3cb0bb,'userProfileId':_0x4dae46[_0x1b19('0x6c')]},'raw':!![]})[_0x1b19('0x2b')](function(_0x505dc0){if(_0x505dc0&&_0x505dc0['autoAssociation']===0x0){return db[_0x1b19('0x2f')][_0x1b19('0x67')]({'name':_0x49d7d5[_0x1b19('0x31')],'resourceId':_0x49d7d5['id'],'type':_0x505dc0['name'],'sectionId':_0x505dc0['id']},{})['then'](function(){return _0xa94ac8;});}else{return _0xa94ac8;}})['catch'](function(_0x410221){logger[_0x1b19('0x1c')](_0x1b19('0x6d'),_0x410221);throw _0x410221;});}return _0xa94ac8;})[_0x1b19('0x2b')](respondWithResult(_0x45c5b8,0xc9))[_0x1b19('0x61')](handleError(_0x45c5b8,null));};exports[_0x1b19('0x6e')]=function(_0x31a672,_0x2cca5e){var _0x285689=null;_0x31a672['body'][_0x1b19('0x62')][_0x1b19('0x63')](',')[_0x1b19('0x6f')](_0x426812=>{if(_0x426812[_0x1b19('0x64')]()!==''&&!wildcardUtils[_0x1b19('0x65')](_0x426812[_0x1b19('0x64')]())){_0x285689=new APIBadRequestError('\x22'+_0x426812+_0x1b19('0x66'));}});if(_0x285689){return handleError(_0x2cca5e,null)(_0x285689);}if(_0x31a672[_0x1b19('0x68')]['id']){delete _0x31a672['body']['id'];}return db['ChatWebsite'][_0x1b19('0x60')]({'where':{'id':_0x31a672[_0x1b19('0x5d')]['id']},'include':[{'model':db[_0x1b19('0x5e')],'as':_0x1b19('0x47')}]})['then'](handleEntityNotFound(_0x2cca5e,null))[_0x1b19('0x2b')](saveUpdates(_0x31a672[_0x1b19('0x68')],null))['then'](respondWithResult(_0x2cca5e,null))[_0x1b19('0x61')](handleError(_0x2cca5e,null));};exports['destroy']=function(_0x555b56,_0x2ef299){return db['ChatWebsite'][_0x1b19('0x60')]({'where':{'id':_0x555b56[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x2ef299,null))[_0x1b19('0x2b')](removeEntity(_0x2ef299,null))['catch'](handleError(_0x2ef299,null));};exports[_0x1b19('0x70')]=function(_0x1cbd87,_0x2473fb){return db[_0x1b19('0x49')][_0x1b19('0x70')]()[_0x1b19('0x2b')](respondWithResult(_0x2473fb,null))[_0x1b19('0x61')](handleError(_0x2473fb,null));};exports[_0x1b19('0x71')]=function(_0xe97a9b,_0x4b6772){if(_0xe97a9b[_0x1b19('0x68')]['id']){delete _0xe97a9b[_0x1b19('0x68')]['id'];}return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0xe97a9b[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x4b6772,null))[_0x1b19('0x2b')](function(_0x430eda){if(_0x430eda){_0xe97a9b['body']['ChatWebsiteId']=_0x430eda['id'];return db[_0x1b19('0x72')]['create'](_0xe97a9b[_0x1b19('0x68')]);}})[_0x1b19('0x2b')](respondWithResult(_0x4b6772,null))[_0x1b19('0x61')](handleError(_0x4b6772,null));};exports[_0x1b19('0x73')]=function(_0x5a5d57,_0xf293f9){var _0x27ee6f={'raw':![],'where':{}};var _0x44360e={};var _0x30b942={'count':0x0,'rows':[]};return db[_0x1b19('0x49')]['findOne']({'where':{'id':_0x5a5d57[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0xf293f9,null))[_0x1b19('0x2b')](function(_0xf8c9d5){if(_0xf8c9d5){_0x44360e[_0x1b19('0x4c')]=_[_0x1b19('0x4e')](db[_0x1b19('0x72')][_0x1b19('0x5f')]);_0x44360e[_0x1b19('0x4d')]=_['keys'](_0x5a5d57[_0x1b19('0x4d')]);_0x44360e['filters']=_[_0x1b19('0x4f')](_0x44360e[_0x1b19('0x4c')],_0x44360e['query']);_0x27ee6f[_0x1b19('0x50')]=_['intersection'](_0x44360e[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0x5a5d57[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x27ee6f[_0x1b19('0x50')]=_0x27ee6f['attributes'][_0x1b19('0x52')]?_0x27ee6f[_0x1b19('0x50')]:_0x44360e['model'];if(!_0x5a5d57['query']['hasOwnProperty'](_0x1b19('0x54'))){_0x27ee6f[_0x1b19('0x27')]=qs[_0x1b19('0x27')](_0x5a5d57['query'][_0x1b19('0x27')]);_0x27ee6f['offset']=qs[_0x1b19('0x26')](_0x5a5d57[_0x1b19('0x4d')][_0x1b19('0x26')]);}_0x27ee6f[_0x1b19('0x55')]=qs[_0x1b19('0x74')](_0x5a5d57[_0x1b19('0x4d')][_0x1b19('0x74')]);_0x27ee6f['where']=qs['filters'](_[_0x1b19('0x75')](_0x5a5d57[_0x1b19('0x4d')],_0x44360e[_0x1b19('0x57')]));_0x27ee6f['where']['ChatWebsiteId']=_0xf8c9d5['id'];if(_0x5a5d57[_0x1b19('0x4d')]['filter']){_0x27ee6f[_0x1b19('0x56')]=_[_0x1b19('0x59')](_0x27ee6f['where'],{'$or':_[_0x1b19('0x48')](_0x27ee6f['attributes'],function(_0x5387c1){var _0x49f795={};_0x49f795[_0x5387c1]={'$like':'%'+_0x5a5d57[_0x1b19('0x4d')]['filter']+'%'};return _0x49f795;})});}_0x27ee6f=_[_0x1b19('0x59')]({},_0x27ee6f,_0x5a5d57['options']);return db[_0x1b19('0x72')]['count']({'where':_0x27ee6f[_0x1b19('0x56')]})['then'](function(_0x5abb64){_0x30b942[_0x1b19('0x29')]=_0x5abb64;if(_0x5a5d57['query']['includeAll']){_0x27ee6f[_0x1b19('0x5b')]=[{'all':!![]}];}return db[_0x1b19('0x72')][_0x1b19('0x76')](_0x27ee6f);})[_0x1b19('0x2b')](function(_0x280d23){_0x30b942[_0x1b19('0x77')]=_0x280d23;return _0x30b942;});}})[_0x1b19('0x2b')](respondWithFilteredResult(_0xf293f9,_0x27ee6f))[_0x1b19('0x61')](handleError(_0xf293f9,null));};exports[_0x1b19('0x78')]=function(_0x56435a,_0x13ffed){return db[_0x1b19('0x49')]['find']({'where':{'id':_0x56435a['params']['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x13ffed,null))[_0x1b19('0x2b')](function(_0x39e5ca){if(_0x39e5ca){return _0x39e5ca[_0x1b19('0x78')](_0x56435a[_0x1b19('0x4d')][_0x1b19('0x79')]);}})[_0x1b19('0x2b')](respondWithStatusCode(_0x13ffed,null))[_0x1b19('0x61')](handleError(_0x13ffed,null));};exports['addAnswer']=function(_0x5e0dea,_0x2788c0){if(_0x5e0dea[_0x1b19('0x68')]['id']){delete _0x5e0dea['body']['id'];}return db[_0x1b19('0x49')]['find']({'where':{'id':_0x5e0dea[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x2788c0,null))['then'](function(_0x34f7c7){if(_0x34f7c7){_0x5e0dea[_0x1b19('0x68')][_0x1b19('0x7a')]=_0x34f7c7['id'];return db[_0x1b19('0x7b')][_0x1b19('0x67')](_0x5e0dea[_0x1b19('0x68')]);}})[_0x1b19('0x2b')](respondWithResult(_0x2788c0,null))[_0x1b19('0x61')](handleError(_0x2788c0,null));};exports[_0x1b19('0x7c')]=function(_0x57f7aa,_0x1a1499){var _0x226b99={'raw':![],'where':{}};var _0x44acca={};var _0x3914af={'count':0x0,'rows':[]};return db[_0x1b19('0x49')]['findOne']({'where':{'id':_0x57f7aa[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x1a1499,null))[_0x1b19('0x2b')](function(_0x28b523){if(_0x28b523){_0x44acca[_0x1b19('0x4c')]=_[_0x1b19('0x4e')](db['CannedAnswer'][_0x1b19('0x5f')]);_0x44acca[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0x57f7aa[_0x1b19('0x4d')]);_0x44acca['filters']=_[_0x1b19('0x4f')](_0x44acca[_0x1b19('0x4c')],_0x44acca['query']);_0x226b99[_0x1b19('0x50')]=_['intersection'](_0x44acca[_0x1b19('0x4c')],qs['fields'](_0x57f7aa['query']['fields']));_0x226b99[_0x1b19('0x50')]=_0x226b99[_0x1b19('0x50')][_0x1b19('0x52')]?_0x226b99['attributes']:_0x44acca['model'];if(!_0x57f7aa['query'][_0x1b19('0x53')](_0x1b19('0x54'))){_0x226b99['limit']=qs[_0x1b19('0x27')](_0x57f7aa[_0x1b19('0x4d')][_0x1b19('0x27')]);_0x226b99['offset']=qs[_0x1b19('0x26')](_0x57f7aa[_0x1b19('0x4d')]['offset']);}_0x226b99[_0x1b19('0x55')]=qs[_0x1b19('0x74')](_0x57f7aa['query']['sort']);_0x226b99[_0x1b19('0x56')]=qs['filters'](_[_0x1b19('0x75')](_0x57f7aa['query'],_0x44acca[_0x1b19('0x57')]));_0x226b99[_0x1b19('0x56')][_0x1b19('0x7a')]=_0x28b523['id'];if(_0x57f7aa[_0x1b19('0x4d')][_0x1b19('0x58')]){_0x226b99[_0x1b19('0x56')]=_[_0x1b19('0x59')](_0x226b99[_0x1b19('0x56')],{'$or':_[_0x1b19('0x48')](_0x226b99['attributes'],function(_0x11a77a){var _0x1ebaef={};_0x1ebaef[_0x11a77a]={'$like':'%'+_0x57f7aa[_0x1b19('0x4d')]['filter']+'%'};return _0x1ebaef;})});}_0x226b99=_[_0x1b19('0x59')]({},_0x226b99,_0x57f7aa[_0x1b19('0x5a')]);return db[_0x1b19('0x7b')][_0x1b19('0x29')]({'where':_0x226b99[_0x1b19('0x56')]})[_0x1b19('0x2b')](function(_0xb5e143){_0x3914af[_0x1b19('0x29')]=_0xb5e143;if(_0x57f7aa['query'][_0x1b19('0x7d')]){_0x226b99[_0x1b19('0x5b')]=[{'all':!![]}];}return db[_0x1b19('0x7b')][_0x1b19('0x76')](_0x226b99);})[_0x1b19('0x2b')](function(_0x2db94e){_0x3914af[_0x1b19('0x77')]=_0x2db94e;return _0x3914af;});}})[_0x1b19('0x2b')](respondWithFilteredResult(_0x1a1499,_0x226b99))[_0x1b19('0x61')](handleError(_0x1a1499,null));};exports['removeAnswers']=function(_0x193ccc,_0x4b4094){return db['ChatWebsite'][_0x1b19('0x60')]({'where':{'id':_0x193ccc['params']['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x4b4094,null))[_0x1b19('0x2b')](function(_0x7f38d1){if(_0x7f38d1){return _0x7f38d1[_0x1b19('0x7e')](_0x193ccc['query']['ids']);}})[_0x1b19('0x2b')](respondWithStatusCode(_0x4b4094,null))[_0x1b19('0x61')](handleError(_0x4b4094,null));};exports['addLogo']=function(_0x9aaa10,_0x3b1e33){_0x9aaa10[_0x1b19('0x68')][_0x1b19('0x7f')]=_0x9aaa10[_0x1b19('0x80')][_0x1b19('0x81')];return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x9aaa10[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x3b1e33,null))[_0x1b19('0x2b')](saveUpdates(_0x9aaa10['body'],null))[_0x1b19('0x2b')](respondWithResult(_0x3b1e33,null))[_0x1b19('0x61')](handleError(_0x3b1e33,null));};exports[_0x1b19('0x82')]=function(_0x38f292,_0xb33399){_0x38f292[_0x1b19('0x68')][_0x1b19('0x83')]=_0x38f292[_0x1b19('0x80')][_0x1b19('0x81')];return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x38f292['params']['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0xb33399,null))[_0x1b19('0x2b')](saveUpdates(_0x38f292[_0x1b19('0x68')],null))[_0x1b19('0x2b')](respondWithResult(_0xb33399,null))['catch'](handleError(_0xb33399,null));};exports[_0x1b19('0x84')]=function(_0x2ae62f,_0x1409dd){_0x2ae62f[_0x1b19('0x68')]['customerAvatar']=_0x2ae62f['file'][_0x1b19('0x81')];return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x2ae62f['params']['id']}})['then'](handleEntityNotFound(_0x1409dd,null))[_0x1b19('0x2b')](saveUpdates(_0x2ae62f[_0x1b19('0x68')],null))['then'](respondWithResult(_0x1409dd,null))[_0x1b19('0x61')](handleError(_0x1409dd,null));};exports[_0x1b19('0x85')]=function(_0x3e1d44,_0x1c34df){_0x3e1d44['body'][_0x1b19('0x86')]=_0x3e1d44['file'][_0x1b19('0x81')];return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x3e1d44[_0x1b19('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c34df,null))[_0x1b19('0x2b')](saveUpdates(_0x3e1d44['body'],null))['then'](respondWithResult(_0x1c34df,null))[_0x1b19('0x61')](handleError(_0x1c34df,null));};exports[_0x1b19('0x87')]=function(_0x57e7d4,_0x415ba3){var _0x3a2e57=path[_0x1b19('0x88')](config[_0x1b19('0x89')],'server/files/images/logos/default_logo.svg');var _0x4828d7={'where':{'id':_0x57e7d4['params']['id']},'attributes':['id',_0x1b19('0x7f')],'raw':!![]};var _0x4807ba=![];return require(_0x1b19('0x8a'))['getLicense']()[_0x1b19('0x2b')](function(_0x892759){if(_0x892759){_0x4807ba=_0x892759[_0x1b19('0x8b')];}})[_0x1b19('0x2b')](function(){return db['ChatWebsite'][_0x1b19('0x60')](_0x4828d7);})['then'](handleEntityNotFound(_0x415ba3,null))[_0x1b19('0x2b')](function(_0x34e999){if(_0x34e999){if(!_[_0x1b19('0x8c')](_0x34e999[_0x1b19('0x7f')])){if(fs[_0x1b19('0x8d')](path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x8e'),_0x34e999['sitepic']))&&_0x4807ba){_0x3a2e57=path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x8e'),_0x34e999[_0x1b19('0x7f')]);}}return _0x415ba3[_0x1b19('0x8f')](_0x3a2e57);}})[_0x1b19('0x61')](handleError(_0x415ba3,null));};exports['getAvatar']=function(_0x19adca,_0x48638b){var _0x2d500a=path['join'](config[_0x1b19('0x89')],_0x1b19('0x90'));var _0x1931cd={'where':{'id':_0x19adca['params']['id']},'attributes':['id',_0x1b19('0x83')],'raw':!![]};return db['ChatWebsite'][_0x1b19('0x60')](_0x1931cd)[_0x1b19('0x2b')](handleEntityNotFound(_0x48638b,null))[_0x1b19('0x2b')](function(_0x233630){if(_0x233630){if(!_['isNil'](_0x233630[_0x1b19('0x83')])){if(fs[_0x1b19('0x8d')](path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x91'),_0x233630[_0x1b19('0x83')]))){_0x2d500a=path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x91'),_0x233630[_0x1b19('0x83')]);}}return _0x48638b[_0x1b19('0x8f')](_0x2d500a);}})[_0x1b19('0x61')](handleError(_0x48638b,null));};exports[_0x1b19('0x92')]=function(_0x43c985,_0x3265f8){var _0x4557bc=path['join'](config[_0x1b19('0x89')],_0x1b19('0x93'));var _0x1cadcb={'where':{'id':_0x43c985[_0x1b19('0x5d')]['id']},'attributes':['id',_0x1b19('0x94'),_0x1b19('0x95')],'raw':!![]};return db[_0x1b19('0x49')][_0x1b19('0x60')](_0x1cadcb)[_0x1b19('0x2b')](handleEntityNotFound(_0x3265f8,null))[_0x1b19('0x2b')](function(_0x471d90){if(_0x471d90){if(!_[_0x1b19('0x8c')](_0x471d90['customerAvatar'])){if(fs[_0x1b19('0x8d')](path[_0x1b19('0x88')](config['root'],_0x1b19('0x91'),_0x471d90[_0x1b19('0x94')]))&&_0x471d90['showCustomerAvatar']){_0x4557bc=path[_0x1b19('0x88')](config['root'],_0x1b19('0x91'),_0x471d90['customerAvatar']);}}return _0x3265f8[_0x1b19('0x8f')](_0x4557bc);}})[_0x1b19('0x61')](handleError(_0x3265f8,null));};exports[_0x1b19('0x96')]=function(_0x4cb7bd,_0x155eb7){var _0x104fc4=path[_0x1b19('0x88')](config[_0x1b19('0x89')],'server/files/images/avatars/system_avatar.png');var _0x405547={'where':{'id':_0x4cb7bd['params']['id']},'attributes':['id',_0x1b19('0x86')],'raw':!![]};return db['ChatWebsite'][_0x1b19('0x60')](_0x405547)['then'](handleEntityNotFound(_0x155eb7,null))[_0x1b19('0x2b')](function(_0x3e8538){if(_0x3e8538){if(!_[_0x1b19('0x8c')](_0x3e8538['systemAvatar'])){if(fs[_0x1b19('0x8d')](path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x91'),_0x3e8538['systemAvatar']))){_0x104fc4=path[_0x1b19('0x88')](config[_0x1b19('0x89')],'server/files/images/avatars/',_0x3e8538[_0x1b19('0x86')]);}}return _0x155eb7['download'](_0x104fc4);}})[_0x1b19('0x61')](handleError(_0x155eb7,null));};function checkWebsiteInterval(_0x5894f4){var _0x4ab458=_0x5894f4[_0x1b19('0x97')];if(!_0x4ab458){return Promise[_0x1b19('0x98')](_0x5894f4);}var _0xffb33b=_0x5894f4[_0x1b19('0x99')]||undefined;return _0x4ab458['ifTime'](_0xffb33b)[_0x1b19('0x2b')](function(_0x2aed4a){if(!_0x2aed4a){throw new APIOutOfIntervalError();}return _0x5894f4;});}exports['notify']=function(_0xf67540,_0x478be4){var _0xc2b8f5={'body':_0xf67540[_0x1b19('0x68')],'channel':'chat'};var _0x3feecc=[];var _0x583d5a=[];var _0x4641f3={};var _0x51bd73=![];if(_0xf67540['body']['id']){delete _0xf67540['body']['id'];}if(_[_0x1b19('0x8c')](_0xf67540['body']['from'])){throw new APIBadRequestError(_0x1b19('0x9a'));}if(_['isNil'](_0xf67540[_0x1b19('0x68')]['mapKey'])){throw new APIBadRequestError(_0x1b19('0x9b'));}if(_[_0x1b19('0x9c')](_0xf67540[_0x1b19('0x68')]['body'])){throw new APIBadRequestError(_0x1b19('0x9d'));}var _0xab66ef=_0xf67540[_0x1b19('0x68')]['customerIp']&&_0xf67540[_0x1b19('0x68')][_0x1b19('0x3d')];return db[_0x1b19('0x9e')][_0x1b19('0x70')]()[_0x1b19('0x2b')](function(_0x5981fc){if(!_0x5981fc){throw new Error(_0x1b19('0x9f'));}_0x3feecc=Object[_0x1b19('0x4e')](_0x5981fc)[_0x1b19('0x58')](function(_0x2ebc3f){return![_0x1b19('0xa0'),_0x1b19('0xa1')][_0x1b19('0xa2')](_0x2ebc3f);});_0x583d5a=Object['keys'](_0x5981fc)[_0x1b19('0x58')](function(_0x49c4d7){return![_0x1b19('0xa0'),_0x1b19('0xa1'),'CompanyId',_0x1b19('0xa3')][_0x1b19('0xa2')](_0x49c4d7);});if(!_[_0x1b19('0xa2')](_0x583d5a,_0xf67540['body']['mapKey'])){throw new APIBadRequestError(_0x1b19('0xa4')+_0x583d5a[_0x1b19('0x88')](',\x20'));}_0x4641f3[_0xf67540['body']['mapKey']]=_0xf67540[_0x1b19('0x68')][_0x1b19('0xa5')];})[_0x1b19('0x2b')](function(){return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0xf67540[_0x1b19('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x1b19('0xa6'),'include':[{'model':db[_0x1b19('0x9e')],'as':'Contacts','where':_0x4641f3,'limit':0x1,'order':[[_0x1b19('0xa1'),_0x1b19('0xa7')]]}]},{'model':db[_0x1b19('0xa8')],'as':_0x1b19('0xa9')},{'model':db[_0x1b19('0x97')],'as':_0x1b19('0x97'),'include':[{'model':db['Interval'],'as':_0x1b19('0xaa'),'attributes':['id',_0x1b19('0xab')],'raw':!![]}]}]});})[_0x1b19('0x2b')](function(_0x1bdfc3){if(!_0x1bdfc3){throw new APINotFoundError(util[_0x1b19('0x40')](_0x1b19('0xac'),_0xf67540[_0x1b19('0x5d')]['id']));}if(_0xab66ef){return checkWebsiteInterval(_0x1bdfc3);}return _0x1bdfc3;})[_0x1b19('0x2b')](function(_0x5b855e){_0xc2b8f5[_0x1b19('0xad')]=_0x5b855e;_0xc2b8f5[_0x1b19('0xae')]=_[_0x1b19('0xaf')](_0x5b855e[_0x1b19('0xa9')],[_0x1b19('0xb0')],[_0x1b19('0xb1')]);if(_0xc2b8f5['account'][_0x1b19('0xa9')]){delete _0xc2b8f5[_0x1b19('0xad')][_0x1b19('0xa9')];}_0xc2b8f5[_0x1b19('0xb2')]=_0x5b855e['List']||{'id':_0x5b855e['ListId']};if(_0xc2b8f5[_0x1b19('0xb2')]&&_0xc2b8f5[_0x1b19('0xb2')][_0x1b19('0xb3')][_0x1b19('0x52')]){return _0xc2b8f5['list'][_0x1b19('0xb3')][0x0];}var _0x2d2005=_[_0x1b19('0x12')](_0xf67540['body'],{'firstName':_0xf67540[_0x1b19('0x68')][_0x1b19('0xa5')],'ListId':_0x5b855e['ListId']});_0x2d2005[_0xf67540['body'][_0x1b19('0xb4')]]=_0xf67540[_0x1b19('0x68')]['from'];return db[_0x1b19('0x9e')][_0x1b19('0x67')](_0x2d2005,{'fields':_0x3feecc,'raw':!![]});})[_0x1b19('0x2b')](function(_0x4b88a7){_0xc2b8f5[_0x1b19('0xb5')]=_0x4b88a7;var _0x26f855=createInteractionObject(_0xf67540[_0x1b19('0x5d')]['id'],_0xf67540[_0x1b19('0x68')],_0xf67540[_0x1b19('0xb6')],_0x4b88a7);var _0x81a618={'ChatWebsiteId':_0xf67540['params']['id']};if(_0xf67540[_0x1b19('0x68')][_0x1b19('0xb7')]){_0x81a618[_0x1b19('0xb7')]=_0xf67540[_0x1b19('0x68')][_0x1b19('0xb7')];_0x81a618['closed']=![];return db['ChatInteraction'][_0x1b19('0x60')]({'where':_0x81a618})[_0x1b19('0x2b')](function(_0x59432d){var _0x420fe5=_0xf67540[_0x1b19('0x68')][_0x1b19('0xb8')]&&_0xf67540['body'][_0x1b19('0x3d')];if(_0x59432d){_0x51bd73=!![];return _0x59432d;}else if(!_0x420fe5&&_0x59432d&&_0x59432d[_0x1b19('0xb9')]){throw new APIConflictError(_0x1b19('0xba'));}_0x26f855[_0x1b19('0xb7')]=_0xf67540['body'][_0x1b19('0xb7')];_0x26f855[_0x1b19('0xbb')]=_0xf67540['body']['externalUrl'];return db[_0x1b19('0xbc')][_0x1b19('0x67')](_0x26f855);});}_0x81a618['ContactId']=_0x4b88a7['id'];if(_0xf67540['body'][_0x1b19('0xbd')]&&_0xf67540[_0x1b19('0x68')][_0x1b19('0xbd')]['id']){_0x81a618['id']=_0xf67540['body']['interaction']['id'];return db['ChatInteraction'][_0x1b19('0x60')]({'where':_0x81a618})[_0x1b19('0x2b')](function(_0x1b3140){var _0xb3bf16=_0xf67540[_0x1b19('0x68')]['customerIp']&&_0xf67540[_0x1b19('0x68')][_0x1b19('0x3d')];if(!_0xb3bf16&&_0x1b3140&&_0x1b3140[_0x1b19('0xb9')]){throw new APIConflictError(_0x1b19('0xba'));}else if(_0x1b3140){_0x51bd73=!![];return _0x1b3140;}else{return db['ChatInteraction'][_0x1b19('0x67')](_0x26f855);}});}return db[_0x1b19('0xbc')][_0x1b19('0x67')](_0x26f855);})['then'](function(_0x1afc2a){if(!_0x51bd73){return _0x1afc2a;}var _0x1322a4={'from':(_0xc2b8f5[_0x1b19('0xb5')][_0x1b19('0x3a')]||'')+'\x20'+(_0xc2b8f5[_0x1b19('0xb5')][_0x1b19('0x3b')]||'')};if(_0xf67540[_0x1b19('0x68')]['threadId']&&_0xf67540[_0x1b19('0x68')][_0x1b19('0xbe')]&&_0xf67540[_0x1b19('0x68')][_0x1b19('0xb7')]!=_0xf67540[_0x1b19('0x68')][_0x1b19('0xbe')]){_0x1322a4['threadId']=_0xf67540[_0x1b19('0x68')]['messageId'];}return _0x1afc2a[_0x1b19('0x6e')](_0x1322a4);})['then'](function(_0x4231a2){_0xc2b8f5['interaction']=_0x4231a2[_0x1b19('0x2d')]({'plain':!![]});_0xc2b8f5[_0x1b19('0xbd')][_0x1b19('0xbf')]=!_0x51bd73;if(_0xc2b8f5[_0x1b19('0xbd')][_0x1b19('0xbf')]){if(_0xc2b8f5[_0x1b19('0xad')][_0x1b19('0xc0')]){_0xc2b8f5['applications'][_0x1b19('0xc1')]({'id':0x0,'priority':_0xc2b8f5[_0x1b19('0xae')][_0x1b19('0x52')]+0x1,'app':'close','appdata':_0x1b19('0xc2'),'interval':_0x1b19('0xc3')});}}return db[_0x1b19('0xc4')][_0x1b19('0x67')]({'body':_0xf67540[_0x1b19('0x68')][_0x1b19('0x68')],'ChatWebsiteId':_0xf67540['params']['id'],'ChatInteractionId':_0x4231a2['id'],'direction':'in','ContactId':_0xc2b8f5[_0x1b19('0xb5')]['id'],'AttachmentId':_0xf67540[_0x1b19('0x68')][_0x1b19('0xc5')]});})[_0x1b19('0x2b')](function(_0x54ad50){_0xc2b8f5[_0x1b19('0x1e')]=_0x54ad50;if(!_0xc2b8f5[_0x1b19('0xbd')][_0x1b19('0xc6')]){return;}return db[_0x1b19('0xc7')][_0x1b19('0x60')]({'attributes':['id',_0x1b19('0x31')],'where':{'id':_0xc2b8f5['interaction'][_0x1b19('0xc6')]}});})[_0x1b19('0x2b')](function(_0x32deea){if(_0x32deea){_0xc2b8f5['applications'][_0x1b19('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32deea['name']+','+(_0xc2b8f5['account'][_0x1b19('0xc9')]||0xa),'interval':_0x1b19('0xc3')});_0xc2b8f5[_0x1b19('0xca')]=!![];}if(!_0xc2b8f5[_0x1b19('0xbd')]['queueId']){return;}return db['ChatQueue'][_0x1b19('0x60')]({'attributes':['id',_0x1b19('0x31')],'where':{'id':_0xc2b8f5['interaction'][_0x1b19('0xcb')]}});})['then'](function(_0x239601){if(_0x239601){_0xc2b8f5[_0x1b19('0xae')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x239601['name']+','+(_0xc2b8f5[_0x1b19('0xad')][_0x1b19('0xcc')]||0x12c),'interval':_0x1b19('0xc3')});}return respondWithRpcPromise(_0x1b19('0xcd'),_0x1b19('0xce'),_0xc2b8f5);})[_0x1b19('0x2b')](function(_0x229b52){respondWithRpcPromise(_0x1b19('0xcf'),_0x1b19('0xcf'),{'event':_0x1b19('0xd0'),'message':_0x229b52},client9002);return _0x229b52;})[_0x1b19('0x2b')](respondWithResult(_0x478be4,null))['catch'](APIHandleError(_0x478be4));};exports['offline']=function(_0x2c9dda,_0x46ec11){var _0x30cbaf,_0x4cef0d,_0x107790;var _0x3cad36=[];var _0x2b51bd={};var _0x5c7272=_0x2c9dda[_0x1b19('0xd1')]||[];var _0x33532a=[];var _0x507770;return db[_0x1b19('0x9e')][_0x1b19('0x70')]()[_0x1b19('0x2b')](function(_0xfd4050){if(!_0xfd4050){throw new db['Sequelize']['ValidationError'](_0x1b19('0xd2'));}_0x3cad36=_[_0x1b19('0xd3')](_[_0x1b19('0x4e')](_0xfd4050),[_0x1b19('0xa0'),'updatedAt','CompanyId',_0x1b19('0xa3')]);if(_0x2c9dda['body']['id']){delete _0x2c9dda[_0x1b19('0x68')]['id'];}if(_[_0x1b19('0x8c')](_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xa5')])){throw _0x46ec11[_0x1b19('0x23')](0x1f4)[_0x1b19('0x32')](new db[(_0x1b19('0xd4'))][(_0x1b19('0xd5'))](_0x1b19('0xd6')));}if(_[_0x1b19('0x8c')](_0x2c9dda['body']['body'])||_0x2c9dda[_0x1b19('0x68')][_0x1b19('0x68')]===''){throw _0x46ec11[_0x1b19('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x1b19('0xd5'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1b19('0x8c')](_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xd7')])){throw _0x46ec11[_0x1b19('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x1b19('0xd5'))](_0x1b19('0xd8')+_0x3cad36));}if(!_[_0x1b19('0xa2')](_0x3cad36,_0x2c9dda['body'][_0x1b19('0xd7')])){throw _0x46ec11['status'](0x1f4)[_0x1b19('0x32')](new db['Sequelize'][(_0x1b19('0xd5'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cad36));}_0x2b51bd[_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xd7')]]=_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xa5')];})['then'](function(){return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x2c9dda[_0x1b19('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x1b19('0xd9')],'as':_0x1b19('0xd9')}]});})[_0x1b19('0x2b')](handleEntityNotFound(_0x46ec11,null))['then'](function(_0x180ecb){if(_0x180ecb&&_0x180ecb[_0x1b19('0xa6')]){_0x4cef0d=_0x180ecb;var _0x35a227=_['defaults'](_0x2c9dda['body'],{'firstName':_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xa5')],'phone':_0x2c9dda['body'][_0x1b19('0xa5')],'ListId':_0x180ecb[_0x1b19('0xa3')]});_0x35a227[_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xd7')]]=_0x2c9dda[_0x1b19('0x68')][_0x1b19('0xa5')];return db['CmContact'][_0x1b19('0xda')]({'where':_0x2b51bd,'defaults':_0x35a227});}})[_0x1b19('0xdb')](function(_0x920e2a){if(_0x920e2a){_0x107790=_0x920e2a;var _0x5d292a=fs[_0x1b19('0xdc')](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x1b19('0xdd'));var _0x2547f2=ejs[_0x1b19('0xde')](_0x5d292a,{'body':_[_0x1b19('0xdf')](_0x2c9dda['body'][_0x1b19('0x68')]),'bodyTitle':_0x4cef0d[_0x1b19('0xe0')]});return db[_0x1b19('0xe1')][_0x1b19('0x67')]({'body':_0x2547f2,'plainBody':htmlToText['fromString'](_0x2547f2),'ContactId':_0x920e2a['id'],'ChatWebsiteId':_0x4cef0d['id']});}})[_0x1b19('0x2b')](function(_0xe58ea3){_0x507770=_0xe58ea3;if(_0x5c7272['length']){var _0x8d01dd=_0x5c7272[_0x1b19('0x48')](function(_0x880a3c){return{'name':_0x880a3c[_0x1b19('0xe2')],'basename':_0x880a3c[_0x1b19('0x81')],'type':_0x880a3c[_0x1b19('0xe3')],'ChatOfflineMessageId':_0xe58ea3['id']};});_0x33532a=_0x8d01dd[_0x1b19('0x48')](_0x16aefe=>{var _0x480da0={'filename':_0x16aefe[_0x1b19('0x31')],'path':path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0xe4'),'files',_0x1b19('0xe5'),_0x1b19('0xe6'),_0x16aefe['basename'])};return _0x480da0;});if(!_0x4cef0d[_0x1b19('0xe7')]){return db[_0x1b19('0xe8')][_0x1b19('0xe9')](function(_0x4494f1){return db[_0x1b19('0xea')]['bulkCreate'](_0x8d01dd,{'transaction':_0x4494f1});});}}})[_0x1b19('0x2b')](function(){if(_0x507770){_0x30cbaf=_0x507770;return db[_0x1b19('0xd9')][_0x1b19('0xeb')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1b19('0xec'),'raw':!![],'include':[{'model':db[_0x1b19('0xed')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x1b19('0x2b')](function(_0x521279){if(_0x521279&&_0x521279[_0x1b19('0xec')]&&_0x4cef0d[_0x1b19('0xee')]&&_0x4cef0d[_0x1b19('0xef')]){var _0x39abd5=_0x521279[_0x1b19('0xf0')]();return respondWithRpcPromise('SendMail',_0x1b19('0xf1'),{'account':_0x39abd5,'message':{'from':util[_0x1b19('0x40')](_0x1b19('0xf2'),_0x521279['name'],_0x521279[_0x1b19('0xf3')]||_0x521279['Smtp'][_0x1b19('0x69')]),'to':_0x4cef0d[_0x1b19('0xef')],'subject':_0x4cef0d[_0x1b19('0xf4')],'html':_0x30cbaf[_0x1b19('0x68')],'attachments':_0x33532a}},client9003)[_0x1b19('0x2b')](function(){return _0x30cbaf;})['catch'](function(_0x4a3a2c){logger[_0x1b19('0x1c')](_0x4a3a2c);});}})[_0x1b19('0x2b')](function(){if(_0x4cef0d&&_0x4cef0d['openNewInteraction']&&_0x4cef0d[_0x1b19('0xf5')]){var _0x452180=[];if(_0x5c7272[_0x1b19('0x52')]){_0x452180=_0x5c7272[_0x1b19('0x48')](function(_0x310197){return{'name':_0x310197[_0x1b19('0xe2')],'basename':_0x310197[_0x1b19('0x81')],'type':_0x310197[_0x1b19('0xe3')],'ChatOfflineMessageId':_0x507770['id']};});}var _0x182213;if(!_[_0x1b19('0x8c')](_0x4cef0d[_0x1b19('0xf6')])){var _0x1d0f7c=_[_0x1b19('0x48')](_0x2c9dda[_0x1b19('0x68')],function(_0x4cbea7){return _0x4cbea7;});var _0x5615d4=_[_0x1b19('0xf7')](_0x1d0f7c)[0x0];var _0x21a68c=_[_0x1b19('0xf8')](_0x5615d4,function(_0x154f41){return _0x154f41;});_0x182213=_0x21a68c[0x1][_0x4cef0d[_0x1b19('0xf6')]];}var _0x4367cf={'from':_0x107790[_0x1b19('0xf3')],'firstName':_0x107790['firstName'],'lastName':_0x107790[_0x1b19('0x3b')],'mapKey':_0x1b19('0xf3'),'message':{'from':_0x107790[_0x1b19('0xf3')],'to':_0x4cef0d['MailAccount'][_0x1b19('0xf3')],'cc':'','subject':_[_0x1b19('0x8c')](_0x182213)?_0x4cef0d[_0x1b19('0xf4')]:_0x182213,'messageId':'','sentAt':new Date(),'attach':_0x452180[_0x1b19('0x52')],'attachments':_0x452180,'originChannel':_0x1b19('0xf9'),'ChatWebsiteId':_0x4cef0d['id'],'ChatOfflineMessageId':_0x30cbaf['id'],'originTo':_0x4cef0d['MailAccount'][_0x1b19('0xf3')]},'body':_0x30cbaf[_0x1b19('0x68')]};var _0x51111f={'account':{'id':_0x4cef0d['MailAccountId']},'body':_0x4367cf,'log':_0x1b19('0xfa')};return respondWithRpcPromise(_0x1b19('0xfa'),_0x1b19('0xfb'),_0x51111f,client9001)[_0x1b19('0x2b')](function(){return _0x30cbaf;})[_0x1b19('0x61')](function(_0x299aa1){logger[_0x1b19('0x1c')](_0x299aa1);});}return;})[_0x1b19('0x2b')](function(){if(_0x30cbaf){return _0x30cbaf;}})[_0x1b19('0x2b')](respondWithResult(_0x46ec11,null))[_0x1b19('0x61')](function(){for(var _0x2cd8a3 of _0x5c7272){var _0x5701ab=path[_0x1b19('0x88')](config[_0x1b19('0x89')],'server',_0x1b19('0xd1'),_0x1b19('0xe5'),_0x1b19('0xe6'),_0x2cd8a3['filename']);fs_extra[_0x1b19('0xfc')](_0x5701ab)[_0x1b19('0x61')](function(_0xaca3d5){logger[_0x1b19('0x1c')](_0x1b19('0xfd'),_0x5701ab,_0xaca3d5);});}});};exports['addInteraction']=function(_0x4dc472,_0x52d50a){return db[_0x1b19('0xbc')][_0x1b19('0x60')]({'where':{'id':_0x4dc472[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x52d50a,null))[_0x1b19('0x2b')](function(_0xd40d65){if(_0xd40d65){return _0xd40d65[_0x1b19('0xfe')](_0x4dc472[_0x1b19('0x68')][_0x1b19('0x79')],_[_0x1b19('0xff')](_0x4dc472[_0x1b19('0x68')],[_0x1b19('0x79'),'id'])||{});}})[_0x1b19('0x2b')](respondWithResult(_0x52d50a,null))['catch'](handleError(_0x52d50a,null));};exports[_0x1b19('0x100')]=function(_0x54db2c,_0x566672){var _0x4447db={'raw':![],'where':{}};var _0x52bb75={};var _0x545893={'count':0x0,'rows':[]};return db[_0x1b19('0x49')][_0x1b19('0xeb')]({'where':{'id':_0x54db2c[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x566672,null))[_0x1b19('0x2b')](function(_0x37d9d1){if(_0x37d9d1){_0x52bb75[_0x1b19('0x4c')]=_['keys'](db[_0x1b19('0xbc')][_0x1b19('0x5f')]);_0x52bb75[_0x1b19('0x4d')]=_['keys'](_0x54db2c[_0x1b19('0x4d')]);_0x52bb75[_0x1b19('0x57')]=_[_0x1b19('0x4f')](_0x52bb75['model'],_0x52bb75[_0x1b19('0x4d')]);_0x4447db[_0x1b19('0x50')]=_[_0x1b19('0x4f')](_0x52bb75['model'],qs[_0x1b19('0x51')](_0x54db2c[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x4447db['attributes']=_0x4447db[_0x1b19('0x50')][_0x1b19('0x52')]?_0x4447db[_0x1b19('0x50')]:_0x52bb75['model'];if(!_0x54db2c[_0x1b19('0x4d')]['hasOwnProperty'](_0x1b19('0x54'))){_0x4447db['limit']=qs[_0x1b19('0x27')](_0x54db2c[_0x1b19('0x4d')]['limit']);_0x4447db[_0x1b19('0x26')]=qs['offset'](_0x54db2c['query']['offset']);}_0x4447db[_0x1b19('0x55')]=qs[_0x1b19('0x74')](_0x54db2c[_0x1b19('0x4d')]['sort']);_0x4447db['where']=qs[_0x1b19('0x57')](_['pick'](_0x54db2c['query'],_0x52bb75[_0x1b19('0x57')]));_0x4447db[_0x1b19('0x56')][_0x1b19('0x7a')]=_0x37d9d1['id'];if(_0x54db2c['query'][_0x1b19('0x58')]){_0x4447db[_0x1b19('0x56')]=_[_0x1b19('0x59')](_0x4447db[_0x1b19('0x56')],{'$or':_['map'](_0x4447db[_0x1b19('0x50')],function(_0x508f60){var _0x571a97={};_0x571a97[_0x508f60]={'$like':'%'+_0x54db2c[_0x1b19('0x4d')][_0x1b19('0x58')]+'%'};return _0x571a97;})});}_0x4447db=_[_0x1b19('0x59')]({},_0x4447db,_0x54db2c[_0x1b19('0x5a')]);return db[_0x1b19('0xbc')][_0x1b19('0x29')]({'where':_0x4447db['where']})[_0x1b19('0x2b')](function(_0x4e22f2){_0x545893[_0x1b19('0x29')]=_0x4e22f2;if(_0x54db2c[_0x1b19('0x4d')][_0x1b19('0x7d')]){_0x4447db[_0x1b19('0x5b')]=[{'model':db['CmContact'],'as':_0x1b19('0x101'),'required':![]},{'model':db[_0x1b19('0xc7')],'as':_0x1b19('0x102'),'attributes':['name',_0x1b19('0x103'),_0x1b19('0x104')],'required':![]},{'model':db[_0x1b19('0x105')],'as':_0x1b19('0x106'),'attributes':['id','name',_0x1b19('0x107')],'where':_0x54db2c[_0x1b19('0x4d')][_0x1b19('0x108')]?{'id':_0x54db2c[_0x1b19('0x4d')]['tag']}:undefined,'required':_0x54db2c[_0x1b19('0x4d')][_0x1b19('0x108')]?!![]:![]}];}return db[_0x1b19('0xbc')][_0x1b19('0x76')](_0x4447db);})['then'](function(_0x227a31){_0x545893[_0x1b19('0x77')]=_0x227a31;return _0x545893;});}})[_0x1b19('0x2b')](respondWithFilteredResult(_0x566672,_0x4447db))[_0x1b19('0x61')](handleError(_0x566672,null));};exports[_0x1b19('0x109')]=function(_0xa9748f,_0x27f343){var _0x5bfb7a=0x0;var _0x61627a=0x0;var _0x1f1b7e=![];var _0x272a3f;var _0x14aa11;return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0xa9748f[_0x1b19('0x5d')]['id']},'include':[{'model':db[_0x1b19('0x97')],'as':_0x1b19('0x97'),'include':[{'model':db[_0x1b19('0x97')],'as':_0x1b19('0xaa'),'attributes':['id',_0x1b19('0xab')]}]}]})['then'](handleEntityNotFound(_0x27f343,null))[_0x1b19('0x2b')](function(_0x130b91){if(_0x130b91){_0x272a3f=_0x130b91;return _0x130b91['getProactiveActions']({'raw':!![]});}})[_0x1b19('0x2b')](function(_0x102016){if(_0x272a3f){if(_0x102016){_0x14aa11=_0x102016;}}return require('../../config/license/util')[_0x1b19('0x10a')]();})['then'](function(_0xbb6242){if(_0xbb6242){_0x61627a=_0xbb6242[_0x1b19('0x10b')];_0x1f1b7e=_0xbb6242[_0x1b19('0x8b')];}})[_0x1b19('0x2b')](function(){return db[_0x1b19('0xbc')][_0x1b19('0x29')]({'where':{'closed':![]}});})[_0x1b19('0x2b')](function(_0x31e34a){_0x5bfb7a=_0x31e34a;if(_0x61627a&&_0x31e34a>_0x61627a){return db[_0x1b19('0x10c')][_0x1b19('0xeb')]({'where':{'id':0x1}})[_0x1b19('0x2b')](function(_0xf605e8){if(_0xf605e8){_0xf605e8['increment'](_0x1b19('0x10d'));}});}})[_0x1b19('0x2b')](function(){var _0x3ec983=_0x272a3f[_0x1b19('0x97')];var _0x5d94a2=_0x272a3f[_0x1b19('0x99')]||undefined;return _0x3ec983?_0x3ec983['ifTime'](_0x5d94a2):!![];})[_0x1b19('0x2b')](function(_0x4a381a){var _0x3023e9=fs[_0x1b19('0xdc')](path[_0x1b19('0x88')](config[_0x1b19('0x89')],_0x1b19('0x10e')),'utf8');var _0x32f811=_0x1b19('0x10f');var _0x13bdc0=![];var _0x508c14,_0x14f2dc;if(_0xa9748f[_0x1b19('0xb6')][_0x1b19('0x3d')]){_0x508c14=new URL(_0xa9748f[_0x1b19('0xb6')]['referer'])[_0x1b19('0x110')];}else if(_0xa9748f[_0x1b19('0xb6')][_0x1b19('0x110')]){_0x508c14=new URL(_0xa9748f[_0x1b19('0xb6')]['origin'])['origin'];}else{_0x508c14=_0x1b19('0x111');}_0x14f2dc=typeof _0x272a3f[_0x1b19('0x62')][_0x1b19('0x63')](',')[_0x1b19('0x60')](function(_0x25fe3c){return wildcardUtils[_0x1b19('0x112')](_0x25fe3c,_0x508c14);})!==_0x1b19('0x28');var _0x2c4d96={'chatVersion':_0x32f811,'chatWebsiteAddressOrigin':_0x14f2dc?_0xa9748f[_0x1b19('0xb6')][_0x1b19('0x3d')]:_0x272a3f[_0x1b19('0x62')],'remote':_0x272a3f[_0x1b19('0x113')],'query':querystring[_0x1b19('0x1b')](_[_0x1b19('0x59')](_0x272a3f[_0x1b19('0x2d')]({'plain':!![]}),{'customerIp':_0xa9748f[_0x1b19('0xb6')][_0x1b19('0x38')]||_0xa9748f[_0x1b19('0xb6')]['x-real-ip']||_0xa9748f[_0x1b19('0x114')][_0x1b19('0x115')]||_0xa9748f['ip'],'referer':_0xa9748f[_0x1b19('0xb6')][_0x1b19('0x3d')],'openedInteractions':_0x5bfb7a,'maxInteractions':_0x61627a,'virtual':_0x1f1b7e['virtual'],'online':_0x4a381a,'custom':_0x1f1b7e,'address':_0x14f2dc?_0xa9748f['headers']['referer']:null}))['replace'](/'/g,'\x5c\x27')};_0x27f343[_0x1b19('0x32')](ejs[_0x1b19('0xde')](Mustache[_0x1b19('0xde')](_0x3023e9,_0x2c4d96),{'proactiveActions':_0x14aa11,'alignment':_0x272a3f['alignment'],'verticalAlignment':_0x272a3f[_0x1b19('0x116')],'div_color':_0x272a3f[_0x1b19('0x107')],'labelText':_0x272a3f[_0x1b19('0x117')],'text_color':_0x272a3f[_0x1b19('0x118')],'text_button_color':_0x272a3f[_0x1b19('0x119')],'button_color':_0x272a3f[_0x1b19('0x11a')],'background_color':_0x272a3f[_0x1b19('0x11b')],'hideWhenOffline':_0x272a3f[_0x1b19('0x11c')],'intervalId':_0x272a3f['IntervalId'],'isDevelopment':_0x13bdc0,'chatVersion':_0x32f811}));})[_0x1b19('0x61')](handleError(_0x27f343,null));};exports['addApplications']=function(_0x3317fa,_0x361658){var _0x53dc98=_0x3317fa[_0x1b19('0x5d')]['id'];var _0x62f5e8=_0x3317fa[_0x1b19('0x68')];var _0x51fbc6=0xc8;var _0x16dbd6=null;return db[_0x1b19('0xe8')][_0x1b19('0xe9')]({'isolationLevel':db['sequelize'][_0x1b19('0x11d')][_0x1b19('0x11e')][_0x1b19('0x11f')]},function(_0x5dcc78){return db[_0x1b19('0x49')][_0x1b19('0xeb')]({'where':{'id':_0x53dc98},'transaction':_0x5dcc78})[_0x1b19('0x2b')](function(_0xb2e6d0){if(_0xb2e6d0){return db[_0x1b19('0xa8')][_0x1b19('0x2c')]({'where':{'ChatWebsiteId':_0x53dc98},'transaction':_0x5dcc78})[_0x1b19('0x2b')](function(){var _0x2a077e=_[_0x1b19('0x48')](_0x62f5e8,function(_0x556619){_0x556619[_0x1b19('0x7a')]=_0x53dc98;return _0x556619;});return db['ChatApplication'][_0x1b19('0x120')](_0x2a077e,{'transaction':_0x5dcc78});});}else{_0x51fbc6=0x194;_0x16dbd6=[];}});})[_0x1b19('0x2b')](function(){if(_0x51fbc6!==0x194){return db['ChatApplication'][_0x1b19('0x121')]({'where':{'ChatWebsiteId':_0x53dc98},'order':'priority'})[_0x1b19('0x2b')](function(_0x5519a0){_0x16dbd6=_0x5519a0;});}})[_0x1b19('0x61')](function(_0x202ef6){_0x51fbc6=0x1f4;logger[_0x1b19('0x1c')](_0x202ef6[_0x1b19('0x30')]);if(_0x202ef6[_0x1b19('0x31')]){delete _0x202ef6['name'];}_0x16dbd6=_0x202ef6;})['finally'](function(){if(_0x16dbd6===null){_0x361658[_0x1b19('0x22')](_0x51fbc6);}else{if(_0x51fbc6===0x1f4){_0x361658[_0x1b19('0x23')](_0x51fbc6)[_0x1b19('0x32')](_0x16dbd6);}else{_0x361658[_0x1b19('0x23')](_0x51fbc6)[_0x1b19('0x25')](_0x16dbd6);}}});};exports['getApplications']=function(_0x38246a,_0x45b354){var _0x243f38={};var _0x1a9634={};var _0x4581ed;var _0x558ac7;return db['ChatWebsite'][_0x1b19('0xeb')]({'where':{'id':_0x38246a['params']['id']}})['then'](handleEntityNotFound(_0x45b354,null))[_0x1b19('0x2b')](function(_0x5b7def){if(_0x5b7def){_0x4581ed=_0x5b7def;_0x1a9634[_0x1b19('0x4c')]=_[_0x1b19('0x4e')](db[_0x1b19('0xa8')][_0x1b19('0x5f')]);_0x1a9634['query']=_[_0x1b19('0x4e')](_0x38246a[_0x1b19('0x4d')]);_0x1a9634[_0x1b19('0x57')]=_[_0x1b19('0x4f')](_0x1a9634[_0x1b19('0x4c')],_0x1a9634[_0x1b19('0x4d')]);_0x243f38[_0x1b19('0x50')]=_[_0x1b19('0x4f')](_0x1a9634[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0x38246a[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x243f38[_0x1b19('0x50')]=_0x243f38[_0x1b19('0x50')][_0x1b19('0x52')]?_0x243f38['attributes']:_0x1a9634[_0x1b19('0x4c')];_0x243f38[_0x1b19('0x55')]=qs[_0x1b19('0x74')](_0x38246a[_0x1b19('0x4d')][_0x1b19('0x74')]);_0x243f38['where']=qs['filters'](_[_0x1b19('0x75')](_0x38246a[_0x1b19('0x4d')],_0x1a9634['filters']));if(_0x38246a[_0x1b19('0x4d')][_0x1b19('0x58')]){_0x243f38[_0x1b19('0x56')]=_['merge'](_0x243f38[_0x1b19('0x56')],{'$or':_[_0x1b19('0x48')](_0x243f38[_0x1b19('0x50')],function(_0x2d3a59){var _0x25f044={};_0x25f044[_0x2d3a59]={'$like':'%'+_0x38246a[_0x1b19('0x4d')][_0x1b19('0x58')]+'%'};return _0x25f044;})});}_0x243f38=_[_0x1b19('0x59')]({},_0x243f38,_0x38246a[_0x1b19('0x5a')]);return _0x4581ed[_0x1b19('0x122')](_0x243f38);}})[_0x1b19('0x2b')](function(_0x44cb7c){if(_0x44cb7c){_0x558ac7=_0x44cb7c[_0x1b19('0x52')];if(!_0x38246a[_0x1b19('0x4d')][_0x1b19('0x53')](_0x1b19('0x54'))){_0x243f38[_0x1b19('0x27')]=qs[_0x1b19('0x27')](_0x38246a['query'][_0x1b19('0x27')]);_0x243f38[_0x1b19('0x26')]=qs[_0x1b19('0x26')](_0x38246a[_0x1b19('0x4d')][_0x1b19('0x26')]);}return _0x4581ed[_0x1b19('0x122')](_0x243f38);}})[_0x1b19('0x2b')](function(_0x51df47){if(_0x51df47){return _0x51df47?{'count':_0x558ac7,'rows':_0x51df47}:null;}})[_0x1b19('0x2b')](respondWithResult(_0x45b354,null))[_0x1b19('0x61')](handleError(_0x45b354,null));};exports[_0x1b19('0x123')]=function(_0x3de987,_0x148ea5){return db[_0x1b19('0x124')][_0x1b19('0x60')]({'where':{'id':_0x3de987[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x148ea5,null))[_0x1b19('0x2b')](function(_0x2bf9d8){if(_0x2bf9d8){return _0x2bf9d8[_0x1b19('0x123')](_0x3de987[_0x1b19('0x68')][_0x1b19('0x79')],_[_0x1b19('0xff')](_0x3de987[_0x1b19('0x68')],[_0x1b19('0x79'),'id'])||{});}})[_0x1b19('0x2b')](respondWithResult(_0x148ea5,null))[_0x1b19('0x61')](handleError(_0x148ea5,null));};exports[_0x1b19('0x125')]=function(_0x4b87bc,_0x43c636){var _0x546ba9={};var _0x4db1f0={};var _0x54740b;var _0x51ba0a;return db[_0x1b19('0x49')][_0x1b19('0xeb')]({'where':{'id':_0x4b87bc[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x43c636,null))[_0x1b19('0x2b')](function(_0x7705d){if(_0x7705d){_0x54740b=_0x7705d;_0x4db1f0[_0x1b19('0x4c')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x4db1f0[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0x4b87bc[_0x1b19('0x4d')]);_0x4db1f0[_0x1b19('0x57')]=_[_0x1b19('0x4f')](_0x4db1f0[_0x1b19('0x4c')],_0x4db1f0[_0x1b19('0x4d')]);_0x546ba9[_0x1b19('0x50')]=_[_0x1b19('0x4f')](_0x4db1f0[_0x1b19('0x4c')],qs['fields'](_0x4b87bc['query'][_0x1b19('0x51')]));_0x546ba9[_0x1b19('0x50')]=_0x546ba9[_0x1b19('0x50')][_0x1b19('0x52')]?_0x546ba9[_0x1b19('0x50')]:_0x4db1f0[_0x1b19('0x4c')];_0x546ba9[_0x1b19('0x55')]=qs[_0x1b19('0x74')](_0x4b87bc[_0x1b19('0x4d')][_0x1b19('0x74')]);_0x546ba9[_0x1b19('0x56')]=qs[_0x1b19('0x57')](_[_0x1b19('0x75')](_0x4b87bc[_0x1b19('0x4d')],_0x4db1f0['filters']));if(_0x4b87bc[_0x1b19('0x4d')]['filter']){_0x546ba9['where']=_[_0x1b19('0x59')](_0x546ba9[_0x1b19('0x56')],{'$or':_[_0x1b19('0x48')](_0x546ba9[_0x1b19('0x50')],function(_0x591c91){var _0x2843b8={};_0x2843b8[_0x591c91]={'$like':'%'+_0x4b87bc['query'][_0x1b19('0x58')]+'%'};return _0x2843b8;})});}_0x546ba9=_[_0x1b19('0x59')]({},_0x546ba9,_0x4b87bc['options']);return _0x54740b[_0x1b19('0x125')](_0x546ba9);}})[_0x1b19('0x2b')](function(_0x2efd4b){if(_0x2efd4b){_0x51ba0a=_0x2efd4b[_0x1b19('0x52')];if(!_0x4b87bc[_0x1b19('0x4d')]['hasOwnProperty'](_0x1b19('0x54'))){_0x546ba9[_0x1b19('0x27')]=qs['limit'](_0x4b87bc[_0x1b19('0x4d')][_0x1b19('0x27')]);_0x546ba9[_0x1b19('0x26')]=qs[_0x1b19('0x26')](_0x4b87bc[_0x1b19('0x4d')][_0x1b19('0x26')]);}return _0x54740b[_0x1b19('0x125')](_0x546ba9);}})[_0x1b19('0x2b')](function(_0x53e698){if(_0x53e698){return _0x53e698?{'count':_0x51ba0a,'rows':_0x53e698}:null;}})['then'](respondWithResult(_0x43c636,null))[_0x1b19('0x61')](handleError(_0x43c636,null));};exports[_0x1b19('0x126')]=function(_0x2f4d07,_0x2d2952){var _0x1d8461=_0x2f4d07['query']['online']==='false'?_0x1b19('0x127'):'onlineForm';return db[_0x1b19('0x49')]['find']({'attributes':['id',_0x1d8461],'where':{'id':_0x2f4d07[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x2d2952,null))[_0x1b19('0x2b')](function(_0x2cfb0d){if(_0x2cfb0d){var _0xc1c444=_0x2cfb0d[_0x1d8461];var _0x3a83c6=_0xc1c444&&_0xc1c444['items']?_0xc1c444[_0x1b19('0x128')]:[];_0x2d2952[_0x1b19('0x32')]({'fromKey':_[_0x1b19('0x8c')](_0xc1c444[_0x1b19('0x129')])?undefined:_0xc1c444[_0x1b19('0x129')],'count':_0x3a83c6['length'],'rows':_0x3a83c6});}})['catch'](handleError(_0x2d2952,null));};exports[_0x1b19('0x12a')]=function(_0x2a80f0,_0x2a6456){var _0x3468ea={'raw':![],'where':{}};var _0x364f9c={};var _0x8d3e2e={'count':0x0,'rows':[]};return db[_0x1b19('0x49')][_0x1b19('0xeb')]({'where':{'id':_0x2a80f0[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x2a6456,null))[_0x1b19('0x2b')](function(_0x2abe0b){if(_0x2abe0b){_0x364f9c[_0x1b19('0x4c')]=_[_0x1b19('0x4e')](db[_0x1b19('0xe1')]['rawAttributes']);_0x364f9c[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0x2a80f0[_0x1b19('0x4d')]);_0x364f9c[_0x1b19('0x57')]=_[_0x1b19('0x4f')](_0x364f9c[_0x1b19('0x4c')],_0x364f9c['query']);_0x3468ea[_0x1b19('0x50')]=_['intersection'](_0x364f9c[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0x2a80f0[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x3468ea['attributes']=_0x3468ea[_0x1b19('0x50')]['length']?_0x3468ea['attributes']:_0x364f9c[_0x1b19('0x4c')];if(!_0x2a80f0['query'][_0x1b19('0x53')](_0x1b19('0x54'))){_0x3468ea['limit']=qs[_0x1b19('0x27')](_0x2a80f0[_0x1b19('0x4d')][_0x1b19('0x27')]);_0x3468ea[_0x1b19('0x26')]=qs[_0x1b19('0x26')](_0x2a80f0['query'][_0x1b19('0x26')]);}_0x3468ea[_0x1b19('0x55')]=qs['sort'](_0x2a80f0[_0x1b19('0x4d')][_0x1b19('0x74')]);_0x3468ea[_0x1b19('0x56')]=qs['filters'](_['pick'](_0x2a80f0['query'],_0x364f9c[_0x1b19('0x57')]));_0x3468ea[_0x1b19('0x56')]['ChatWebsiteId']=_0x2abe0b['id'];if(_0x2a80f0[_0x1b19('0x4d')]['filter']){_0x3468ea['where']=_[_0x1b19('0x59')](_0x3468ea[_0x1b19('0x56')],{'$or':_[_0x1b19('0x48')](_0x3468ea[_0x1b19('0x50')],function(_0x5049f5){var _0x48284b={};_0x48284b[_0x5049f5]={'$like':'%'+_0x2a80f0[_0x1b19('0x4d')][_0x1b19('0x58')]+'%'};return _0x48284b;})});}_0x3468ea=_[_0x1b19('0x59')]({},_0x3468ea,_0x2a80f0[_0x1b19('0x5a')]);return db[_0x1b19('0xe1')][_0x1b19('0x29')]({'where':_0x3468ea['where']})[_0x1b19('0x2b')](function(_0x2a764f){_0x8d3e2e[_0x1b19('0x29')]=_0x2a764f;if(_0x2a80f0[_0x1b19('0x4d')][_0x1b19('0x7d')]){_0x3468ea[_0x1b19('0x5b')]=[{'all':!![]}];}else{_0x3468ea[_0x1b19('0x5b')]=[{'model':db[_0x1b19('0x9e')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0x1b19('0x12b'),'required':![]}];}return db[_0x1b19('0xe1')][_0x1b19('0x76')](_0x3468ea);})[_0x1b19('0x2b')](function(_0x3f63f5){_0x8d3e2e[_0x1b19('0x77')]=_0x3f63f5;return _0x8d3e2e;});}})['then'](respondWithFilteredResult(_0x2a6456,_0x3468ea))[_0x1b19('0x61')](handleError(_0x2a6456,null));};exports[_0x1b19('0x12c')]=function(_0x36761b,_0x438e38){return db[_0x1b19('0x49')]['find']({'where':{'id':_0x36761b[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x438e38,null))[_0x1b19('0x2b')](function(_0x51c8d1){if(_0x51c8d1){return _0x51c8d1['addAgents'](_0x36761b[_0x1b19('0x68')][_0x1b19('0x79')],_[_0x1b19('0xff')](_0x36761b[_0x1b19('0x68')],[_0x1b19('0x79'),'id'])||{})[_0x1b19('0xdb')](function(_0x58c8b4){for(var _0xf419f2=0x0;_0xf419f2<_0x36761b[_0x1b19('0x68')][_0x1b19('0x79')]['length'];_0xf419f2+=0x1){socket[_0x1b19('0x12d')](_0x1b19('0x12e'),{'UserId':Number(_0x36761b['body'][_0x1b19('0x79')][_0xf419f2]),'ChatWebsiteId':Number(_0x36761b[_0x1b19('0x5d')]['id'])});}return _0x58c8b4;});}})[_0x1b19('0x2b')](respondWithResult(_0x438e38,null))['catch'](handleError(_0x438e38,null));};exports[_0x1b19('0x12f')]=function(_0x17fadd,_0xac896b){return db[_0x1b19('0x49')][_0x1b19('0x60')]({'where':{'id':_0x17fadd[_0x1b19('0x5d')]['id']}})['then'](handleEntityNotFound(_0xac896b,null))[_0x1b19('0x2b')](function(_0x985d61){if(_0x985d61){return _0x985d61['removeAgents'](_0x17fadd[_0x1b19('0x4d')][_0x1b19('0x79')])['then'](function(){if(_['isArray'](_0x17fadd[_0x1b19('0x4d')]['ids'])){for(var _0x4e7b48=0x0;_0x4e7b48<_0x17fadd['query'][_0x1b19('0x79')]['length'];_0x4e7b48+=0x1){socket['emit'](_0x1b19('0x130'),{'UserId':Number(_0x17fadd[_0x1b19('0x4d')][_0x1b19('0x79')][_0x4e7b48]),'ChatWebsiteId':Number(_0x17fadd[_0x1b19('0x5d')]['id'])});}}else{socket[_0x1b19('0x12d')](_0x1b19('0x130'),{'UserId':Number(_0x17fadd[_0x1b19('0x4d')][_0x1b19('0x79')]),'ChatWebsiteId':Number(_0x17fadd[_0x1b19('0x5d')]['id'])});}});}})[_0x1b19('0x2b')](respondWithStatusCode(_0xac896b,null))[_0x1b19('0x61')](handleError(_0xac896b,null));};exports[_0x1b19('0x131')]=function(_0xcdcbfa,_0x38a6b5){var _0x1940ad={};var _0x2eef91={};var _0x145ece;var _0xa60590;return db[_0x1b19('0x49')][_0x1b19('0xeb')]({'where':{'id':_0xcdcbfa[_0x1b19('0x5d')]['id']}})[_0x1b19('0x2b')](handleEntityNotFound(_0x38a6b5,null))['then'](function(_0x5e7f30){if(_0x5e7f30){_0x145ece=_0x5e7f30;_0x2eef91[_0x1b19('0x4c')]=_['keys'](db[_0x1b19('0xc7')]['rawAttributes']);_0x2eef91[_0x1b19('0x4d')]=_[_0x1b19('0x4e')](_0xcdcbfa[_0x1b19('0x4d')]);_0x2eef91[_0x1b19('0x57')]=_['intersection'](_0x2eef91[_0x1b19('0x4c')],_0x2eef91[_0x1b19('0x4d')]);_0x1940ad[_0x1b19('0x50')]=_[_0x1b19('0x4f')](_0x2eef91[_0x1b19('0x4c')],qs[_0x1b19('0x51')](_0xcdcbfa[_0x1b19('0x4d')][_0x1b19('0x51')]));_0x1940ad[_0x1b19('0x50')]=_0x1940ad[_0x1b19('0x50')][_0x1b19('0x52')]?_0x1940ad[_0x1b19('0x50')]:_0x2eef91['model'];_0x1940ad['order']=qs[_0x1b19('0x74')](_0xcdcbfa['query']['sort']);_0x1940ad[_0x1b19('0x56')]=qs[_0x1b19('0x57')](_[_0x1b19('0x75')](_0xcdcbfa[_0x1b19('0x4d')],_0x2eef91[_0x1b19('0x57')]));if(_0xcdcbfa[_0x1b19('0x4d')][_0x1b19('0x58')]){_0x1940ad['where']=_[_0x1b19('0x59')](_0x1940ad[_0x1b19('0x56')],{'$or':_[_0x1b19('0x48')](_0x1940ad['attributes'],function(_0x463146){var _0x455fa9={};_0x455fa9[_0x463146]={'$like':'%'+_0xcdcbfa[_0x1b19('0x4d')][_0x1b19('0x58')]+'%'};return _0x455fa9;})});}_0x1940ad=_[_0x1b19('0x59')]({},_0x1940ad,_0xcdcbfa[_0x1b19('0x5a')]);return _0x145ece[_0x1b19('0x131')](_0x1940ad);}})['then'](function(_0x54aecb){if(_0x54aecb){_0xa60590=_0x54aecb[_0x1b19('0x52')];if(!_0xcdcbfa['query'][_0x1b19('0x53')]('nolimit')){_0x1940ad['limit']=qs[_0x1b19('0x27')](_0xcdcbfa[_0x1b19('0x4d')]['limit']);_0x1940ad[_0x1b19('0x26')]=qs[_0x1b19('0x26')](_0xcdcbfa[_0x1b19('0x4d')]['offset']);}return _0x145ece[_0x1b19('0x131')](_0x1940ad);}})['then'](function(_0x472db2){if(_0x472db2){return _0x472db2?{'count':_0xa60590,'rows':_0x472db2}:null;}})[_0x1b19('0x2b')](respondWithResult(_0x38a6b5,null))[_0x1b19('0x61')](handleError(_0x38a6b5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f52c24e..2557632 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 _0xb790=['exports','../../mysqldb','update','emit','hasOwnProperty','hook'];(function(_0x1669fa,_0x1617a6){var _0x172622=function(_0x57a81b){while(--_0x57a81b){_0x1669fa['push'](_0x1669fa['shift']());}};_0x172622(++_0x1617a6);}(_0xb790,0xe5));var _0x0b79=function(_0xe65ac8,_0x2691be){_0xe65ac8=_0xe65ac8-0x0;var _0x202ba1=_0xb790[_0xe65ac8];return _0x202ba1;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x0b79('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b79('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4d16f6){return function(_0x2d75b0,_0x30b3fa,_0x55d197){ChatWebsiteEvents[_0x0b79('0x2')](_0x4d16f6+':'+_0x2d75b0['id'],_0x2d75b0);ChatWebsiteEvents[_0x0b79('0x2')](_0x4d16f6,_0x2d75b0);_0x55d197(null);};}for(var e in events){if(events[_0x0b79('0x3')](e)){var event=events[e];ChatWebsite[_0x0b79('0x4')](e,emitEvent(event));}}module[_0x0b79('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf483=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf483,0xf2));var _0x3f48=function(_0x4de6f0,_0x4b9110){_0x4de6f0=_0x4de6f0-0x0;var _0xef444b=_0xf483[_0x4de6f0];return _0xef444b;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x3f48('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3f48('0x1')](0x0);var events={'afterCreate':_0x3f48('0x2'),'afterUpdate':_0x3f48('0x3'),'afterDestroy':_0x3f48('0x4')};function emitEvent(_0x169391){return function(_0x312d9c,_0x5deb61,_0x49f64a){ChatWebsiteEvents['emit'](_0x169391+':'+_0x312d9c['id'],_0x312d9c);ChatWebsiteEvents[_0x3f48('0x5')](_0x169391,_0x312d9c);_0x49f64a(null);};}for(var e in events){if(events[_0x3f48('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3f48('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9917c8a..e73aedb 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 _0x542b=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x4418b2,_0x5d6c76){var _0x379e74=function(_0x14b351){while(--_0x14b351){_0x4418b2['push'](_0x4418b2['shift']());}};_0x379e74(++_0x5d6c76);}(_0x542b,0xb5));var _0xb542=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x542b[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var logger=require(_0xb542('0x2'))(_0xb542('0x3'));var moment=require('moment');var BPromise=require(_0xb542('0x4'));var rp=require(_0xb542('0x5'));var fs=require('fs');var path=require(_0xb542('0x6'));var rimraf=require('rimraf');var config=require(_0xb542('0x7'));var attributes=require(_0xb542('0x8'));module[_0xb542('0x9')]=function(_0x146e3d,_0x16ed4){return _0x146e3d[_0xb542('0xa')](_0xb542('0xb'),attributes,{'tableName':_0xb542('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46e4=['rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','../../config/logger','request-promise'];(function(_0x93de5d,_0x237c83){var _0x1b9a00=function(_0x32e693){while(--_0x32e693){_0x93de5d['push'](_0x93de5d['shift']());}};_0x1b9a00(++_0x237c83);}(_0x46e4,0x15b));var _0x446e=function(_0x50b16c,_0x5e9cce){_0x50b16c=_0x50b16c-0x0;var _0x4e939a=_0x46e4[_0x50b16c];return _0x4e939a;};'use strict';var _=require(_0x446e('0x0'));var util=require(_0x446e('0x1'));var logger=require(_0x446e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x446e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x446e('0x4'));var config=require('../../config/environment');var attributes=require(_0x446e('0x5'));module[_0x446e('0x6')]=function(_0x48e35e,_0x2b6072){return _0x48e35e[_0x446e('0x7')](_0x446e('0x8'),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 9324b0e..31626b2 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 _0xc476=['info','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x175f09,_0x5f158d){var _0x5d99fe=function(_0x4b828c){while(--_0x4b828c){_0x175f09['push'](_0x175f09['shift']());}};_0x5d99fe(++_0x5f158d);}(_0xc476,0x161));var _0x6c47=function(_0x3caae0,_0x2a5646){_0x3caae0=_0x3caae0-0x0;var _0x34e8bc=_0xc476[_0x3caae0];return _0x34e8bc;};'use strict';var _=require(_0x6c47('0x0'));var util=require(_0x6c47('0x1'));var moment=require(_0x6c47('0x2'));var BPromise=require(_0x6c47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c47('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6c47('0x5'));var config=require(_0x6c47('0x6'));var jayson=require(_0x6c47('0x7'));var client=jayson[_0x6c47('0x8')][_0x6c47('0x9')]({'port':0x232a});config[_0x6c47('0xa')]=_[_0x6c47('0xb')](config[_0x6c47('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c47('0xc'))(new Redis(config['redis']));require(_0x6c47('0xd'))[_0x6c47('0xe')](socket);function respondWithRpcPromise(_0xe0471,_0x173604,_0x5b3814){return new BPromise(function(_0x16417e,_0x49355a){return client['request'](_0xe0471,_0x5b3814)['then'](function(_0x562cc0){logger['info'](_0x6c47('0xf'),_0x173604,_0x6c47('0x10'));logger[_0x6c47('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x173604,_0x6c47('0x10'),JSON[_0x6c47('0x12')](_0x562cc0));if(_0x562cc0['error']){if(_0x562cc0[_0x6c47('0x13')][_0x6c47('0x14')]===0x1f4){logger['error'](_0x6c47('0xf'),_0x173604,_0x562cc0[_0x6c47('0x13')][_0x6c47('0x15')]);return _0x49355a(_0x562cc0[_0x6c47('0x13')][_0x6c47('0x15')]);}logger['error'](_0x6c47('0xf'),_0x173604,_0x562cc0[_0x6c47('0x13')][_0x6c47('0x15')]);return _0x16417e(_0x562cc0['error']['message']);}else{logger[_0x6c47('0x16')](_0x6c47('0xf'),_0x173604,_0x6c47('0x10'));_0x16417e(_0x562cc0[_0x6c47('0x17')][_0x6c47('0x15')]);}})[_0x6c47('0x18')](function(_0xb8dc09){logger[_0x6c47('0x13')](_0x6c47('0xf'),_0x173604,_0xb8dc09);_0x49355a(_0xb8dc09);});});} \ No newline at end of file +var _0xcc55=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x1f354d,_0x3c1285){var _0x48dedc=function(_0x9e309d){while(--_0x9e309d){_0x1f354d['push'](_0x1f354d['shift']());}};_0x48dedc(++_0x3c1285);}(_0xcc55,0x72));var _0x5cc5=function(_0x405f68,_0x507363){_0x405f68=_0x405f68-0x0;var _0x1b9c6f=_0xcc55[_0x405f68];return _0x1b9c6f;};'use strict';var _=require(_0x5cc5('0x0'));var util=require(_0x5cc5('0x1'));var moment=require(_0x5cc5('0x2'));var BPromise=require(_0x5cc5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cc5('0x4'));var db=require(_0x5cc5('0x5'))['db'];var utils=require(_0x5cc5('0x6'));var logger=require(_0x5cc5('0x7'))(_0x5cc5('0x8'));var config=require(_0x5cc5('0x9'));var jayson=require(_0x5cc5('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5cc5('0xb')]=_[_0x5cc5('0xc')](config[_0x5cc5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cc5('0xd'))(new Redis(config[_0x5cc5('0xb')]));require('./chatWebsite.socket')[_0x5cc5('0xe')](socket);function respondWithRpcPromise(_0x277686,_0x46c961,_0x627975){return new BPromise(function(_0x5cd5f0,_0x4c8bc0){return client[_0x5cc5('0xf')](_0x277686,_0x627975)[_0x5cc5('0x10')](function(_0x5437d1){logger['info'](_0x5cc5('0x11'),_0x46c961,'request\x20sent');logger[_0x5cc5('0x12')](_0x5cc5('0x13'),_0x46c961,_0x5cc5('0x14'),JSON[_0x5cc5('0x15')](_0x5437d1));if(_0x5437d1[_0x5cc5('0x16')]){if(_0x5437d1[_0x5cc5('0x16')][_0x5cc5('0x17')]===0x1f4){logger[_0x5cc5('0x16')](_0x5cc5('0x11'),_0x46c961,_0x5437d1[_0x5cc5('0x16')][_0x5cc5('0x18')]);return _0x4c8bc0(_0x5437d1[_0x5cc5('0x16')][_0x5cc5('0x18')]);}logger[_0x5cc5('0x16')](_0x5cc5('0x11'),_0x46c961,_0x5437d1[_0x5cc5('0x16')]['message']);return _0x5cd5f0(_0x5437d1[_0x5cc5('0x16')][_0x5cc5('0x18')]);}else{logger[_0x5cc5('0x19')](_0x5cc5('0x11'),_0x46c961,'request\x20sent');_0x5cd5f0(_0x5437d1[_0x5cc5('0x1a')]['message']);}})[_0x5cc5('0x1b')](function(_0x543fb7){logger[_0x5cc5('0x16')](_0x5cc5('0x11'),_0x46c961,_0x543fb7);_0x4c8bc0(_0x543fb7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 38780d4..2a0d5ff 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 _0xb958=['chatWebsite:','./chatWebsite.events','update','emit','removeListener','register','length'];(function(_0x1bb7be,_0x84652d){var _0x2101d4=function(_0x242a89){while(--_0x242a89){_0x1bb7be['push'](_0x1bb7be['shift']());}};_0x2101d4(++_0x84652d);}(_0xb958,0xb0));var _0x8b95=function(_0x1c37a5,_0x59ee51){_0x1c37a5=_0x1c37a5-0x0;var _0x389d03=_0xb958[_0x1c37a5];return _0x389d03;};'use strict';var ChatWebsiteEvents=require(_0x8b95('0x0'));var events=['save','remove',_0x8b95('0x1')];function createListener(_0x266166,_0x47c5a0){return function(_0x527bc1){_0x47c5a0[_0x8b95('0x2')](_0x266166,_0x527bc1);};}function removeListener(_0x1bf94b,_0x1bb8be){return function(){ChatWebsiteEvents[_0x8b95('0x3')](_0x1bf94b,_0x1bb8be);};}exports[_0x8b95('0x4')]=function(_0x18c7fe){for(var _0x385991=0x0,_0x1b7a2b=events[_0x8b95('0x5')];_0x385991<_0x1b7a2b;_0x385991++){var _0x14b3c9=events[_0x385991];var _0x4dd3f6=createListener(_0x8b95('0x6')+_0x14b3c9,_0x18c7fe);ChatWebsiteEvents['on'](_0x14b3c9,_0x4dd3f6);}}; \ No newline at end of file +var _0x78d0=['emit','removeListener','length','./chatWebsite.events','remove','update'];(function(_0x329918,_0x36a6a4){var _0xa2730c=function(_0x538c84){while(--_0x538c84){_0x329918['push'](_0x329918['shift']());}};_0xa2730c(++_0x36a6a4);}(_0x78d0,0x129));var _0x078d=function(_0xc95bb4,_0x49d6fa){_0xc95bb4=_0xc95bb4-0x0;var _0x23f569=_0x78d0[_0xc95bb4];return _0x23f569;};'use strict';var ChatWebsiteEvents=require(_0x078d('0x0'));var events=['save',_0x078d('0x1'),_0x078d('0x2')];function createListener(_0x1cb794,_0x42beb7){return function(_0x53ed98){_0x42beb7[_0x078d('0x3')](_0x1cb794,_0x53ed98);};}function removeListener(_0x2f518c,_0x5d548c){return function(){ChatWebsiteEvents[_0x078d('0x4')](_0x2f518c,_0x5d548c);};}exports['register']=function(_0x562528){for(var _0x15cd02=0x0,_0x4a786d=events[_0x078d('0x5')];_0x15cd02<_0x4a786d;_0x15cd02++){var _0x2f1d3f=events[_0x15cd02];var _0x193476=createListener('chatWebsite:'+_0x2f1d3f,_0x562528);ChatWebsiteEvents['on'](_0x2f1d3f,_0x193476);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 7c45fa3..1b6c77f 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43fd=['../../../utils/misc','escapeRegExp','URL','replace','localhost','test','([\x5cw]+)','exports'];(function(_0x20a9d0,_0x1ab2b3){var _0xf67c4e=function(_0x217a43){while(--_0x217a43){_0x20a9d0['push'](_0x20a9d0['shift']());}};_0xf67c4e(++_0x1ab2b3);}(_0x43fd,0x150));var _0xd43f=function(_0x33dd78,_0x13c918){_0x33dd78=_0x33dd78-0x0;var _0x3efdaf=_0x43fd[_0x33dd78];return _0x3efdaf;};var escapeRegExp=require(_0xd43f('0x0'))[_0xd43f('0x1')];var URL=require('url')[_0xd43f('0x2')];function testWildcardValidity(_0x4fcc11){let _0x3ba8e5=!![];try{new URL(_0x4fcc11[_0xd43f('0x3')]('*',_0xd43f('0x4')));}catch(_0x466a7a){_0x3ba8e5=![];}return _0x3ba8e5&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xd43f('0x5')](_0x4fcc11);}function testWebsiteWithWildcard(_0x14e48f,_0xdd2104){let _0x2807ed;const _0xfede84=escapeRegExp(_0x14e48f)[_0xd43f('0x3')]('\x5c*',_0xd43f('0x6'));try{new URL(_0x14e48f[_0xd43f('0x3')]('\x5c*',_0xd43f('0x4')));_0x2807ed=new RegExp(_0xfede84)[_0xd43f('0x5')](_0xdd2104);}catch(_0x587add){_0x2807ed=![];}return _0x2807ed;}module[_0xd43f('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x0adf=['url','replace','localhost','test','trim','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp'];(function(_0x3e3a17,_0x4e928b){var _0x2a74a2=function(_0x251e9f){while(--_0x251e9f){_0x3e3a17['push'](_0x3e3a17['shift']());}};_0x2a74a2(++_0x4e928b);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x101199,_0x1dbe12){_0x101199=_0x101199-0x0;var _0x767ecc=_0x0adf[_0x101199];return _0x767ecc;};var escapeRegExp=require(_0xf0ad('0x0'))[_0xf0ad('0x1')];var URL=require(_0xf0ad('0x2'))['URL'];function testWildcardValidity(_0x4a97fd){var _0x10cf5b=!![];try{new URL(_0x4a97fd[_0xf0ad('0x3')]('*',_0xf0ad('0x4')));}catch(_0x27d666){_0x10cf5b=![];}return _0x10cf5b&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf0ad('0x5')](_0x4a97fd);}function testWebsiteWithWildcard(_0x719547,_0x59a588){var _0x3bbf85;var _0x53221f=escapeRegExp(_0x719547[_0xf0ad('0x6')]()[_0xf0ad('0x3')](/\/$/,''))[_0xf0ad('0x3')]('\x5c*',_0xf0ad('0x7'));try{new URL(_0x719547[_0xf0ad('0x3')]('\x5c*',_0xf0ad('0x4')));_0x3bbf85=new RegExp(_0x53221f)[_0xf0ad('0x5')](_0x59a588);}catch(_0x5bdf69){_0x3bbf85=![];}return _0x3bbf85;}module[_0xf0ad('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 5201ecd..3364c47 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 _0xd900=['removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','show','/:id/dispositions','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','any','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','put','/:id','update','delete','removeDispositions'];(function(_0x436d89,_0x439faa){var _0x5f58d9=function(_0x2357ea){while(--_0x2357ea){_0x436d89['push'](_0x436d89['shift']());}};_0x5f58d9(++_0x439faa);}(_0xd900,0x109));var _0x0d90=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0xd900[_0x334d1e];return _0x3b33ba;};'use strict';var multer=require(_0x0d90('0x0'));var util=require('util');var path=require(_0x0d90('0x1'));var timeout=require(_0x0d90('0x2'));var express=require(_0x0d90('0x3'));var router=express[_0x0d90('0x4')]();var fs_extra=require(_0x0d90('0x5'));var auth=require(_0x0d90('0x6'));var interaction=require(_0x0d90('0x7'));var config=require('../../config/environment');var controller=require(_0x0d90('0x8'));router['get']('/',auth[_0x0d90('0x9')](),controller[_0x0d90('0xa')]);router[_0x0d90('0xb')]('/describe',auth[_0x0d90('0x9')](),controller['describe']);router[_0x0d90('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0d90('0xc')]);router[_0x0d90('0xb')](_0x0d90('0xd'),auth[_0x0d90('0x9')](),controller['getDispositions']);router[_0x0d90('0xb')]('/:id/canned_answers',auth[_0x0d90('0x9')](),controller[_0x0d90('0xe')]);router[_0x0d90('0xb')](_0x0d90('0xf'),controller['getLogo']);router['get'](_0x0d90('0x10'),controller[_0x0d90('0x11')]);router[_0x0d90('0xb')]('/:id/customer_avatar',controller[_0x0d90('0x12')]);router[_0x0d90('0xb')](_0x0d90('0x13'),controller[_0x0d90('0x14')]);router['get'](_0x0d90('0x15'),auth[_0x0d90('0x9')](),controller['getInteractions']);router[_0x0d90('0xb')](_0x0d90('0x16'),controller['getSnippet']);router[_0x0d90('0xb')]('/:id/applications',auth[_0x0d90('0x9')](),controller['getApplications']);router[_0x0d90('0xb')](_0x0d90('0x17'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x18')]);router[_0x0d90('0xb')]('/:id/fields',controller[_0x0d90('0x19')]);router[_0x0d90('0xb')](_0x0d90('0x1a'),auth[_0x0d90('0x9')](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0x0d90('0x9')](),controller['getAgents']);router[_0x0d90('0x1b')]('/',auth[_0x0d90('0x9')](),controller[_0x0d90('0x1c')]);router[_0x0d90('0x1b')](_0x0d90('0xd'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x1d')]);router[_0x0d90('0x1b')](_0x0d90('0x1e'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x1f')]);var upload=multer({'storage':multer[_0x0d90('0x20')]({'destination':function(_0x52db11,_0x4d5b9b,_0x509644){_0x509644(null,path[_0x0d90('0x21')](config[_0x0d90('0x22')],_0x0d90('0x23')));},'filename':function(_0x99822,_0x1a519e,_0x4f93c8){_0x4f93c8(null,util[_0x0d90('0x24')](_0x0d90('0x25'),Date[_0x0d90('0x26')](),_0x1a519e[_0x0d90('0x27')]));}})});router['post'](_0x0d90('0xf'),upload['single'](_0x0d90('0x28')),controller[_0x0d90('0x29')]);var upload=multer({'storage':multer[_0x0d90('0x20')]({'destination':function(_0x37c0c7,_0x284b04,_0x464fa2){_0x464fa2(null,path['join'](config[_0x0d90('0x22')],_0x0d90('0x2a')));},'filename':function(_0x5ab6a,_0x31a5a4,_0x1e5aa8){_0x1e5aa8(null,util[_0x0d90('0x24')]('%s-%s',Date[_0x0d90('0x26')](),_0x31a5a4[_0x0d90('0x27')]));}})});router['post'](_0x0d90('0x10'),upload[_0x0d90('0x2b')]('file'),controller[_0x0d90('0x2c')]);var upload=multer({'storage':multer[_0x0d90('0x20')]({'destination':function(_0x2cc138,_0x5b73ba,_0x119526){_0x119526(null,path[_0x0d90('0x21')](config[_0x0d90('0x22')],'server/files/images/avatars/'));},'filename':function(_0x31c708,_0x154b1b,_0x1ba13e){_0x1ba13e(null,util[_0x0d90('0x24')]('%s-%s',Date[_0x0d90('0x26')](),_0x154b1b[_0x0d90('0x27')]));}})});router[_0x0d90('0x1b')](_0x0d90('0x2d'),upload[_0x0d90('0x2b')]('file'),controller[_0x0d90('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12f956,_0x1325e9,_0x31ed2e){_0x31ed2e(null,path[_0x0d90('0x21')](config[_0x0d90('0x22')],_0x0d90('0x2a')));},'filename':function(_0x128eac,_0x5b81b9,_0x217c69){_0x217c69(null,util[_0x0d90('0x24')](_0x0d90('0x25'),Date['now'](),_0x5b81b9['originalname']));}})});router['post'](_0x0d90('0x13'),upload[_0x0d90('0x2b')](_0x0d90('0x28')),controller['addSystemAvatar']);router[_0x0d90('0x1b')](_0x0d90('0x2f'),controller[_0x0d90('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x0d90('0x20')]({'destination':function(_0x1d7233,_0x1da3a4,_0x386f2b){const _0x1c7fbe=path[_0x0d90('0x21')](config[_0x0d90('0x22')],_0x0d90('0x31'),_0x0d90('0x32'),'offline-chat');fs_extra[_0x0d90('0x33')](_0x1c7fbe,function(){_0x386f2b(null,_0x1c7fbe);});},'filename':function(_0x1fb115,_0x200d02,_0x3b55c6){const _0x279d72=_0x200d02[_0x0d90('0x27')][_0x0d90('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x506fe5=path[_0x0d90('0x35')](_0x279d72);const _0x9a651a=Date['now']()+'-'+_0x279d72[_0x0d90('0x34')](_0x506fe5,'')+_0x506fe5;_0x3b55c6(null,_0x9a651a);}})});router['post']('/:id/offline',offlineUploadMulter[_0x0d90('0x36')](),controller['offline']);router[_0x0d90('0x1b')](_0x0d90('0x15'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x37')]);router[_0x0d90('0x1b')](_0x0d90('0x38'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x39')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x0d90('0x3a')]);router['post'](_0x0d90('0x3b'),auth[_0x0d90('0x9')](),controller['addAgents']);router[_0x0d90('0x3c')](_0x0d90('0x3d'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x3e')]);router[_0x0d90('0x3f')](_0x0d90('0x3d'),auth[_0x0d90('0x9')](),controller['destroy']);router[_0x0d90('0x3f')](_0x0d90('0xd'),auth[_0x0d90('0x9')](),controller[_0x0d90('0x40')]);router[_0x0d90('0x3f')](_0x0d90('0x1e'),auth[_0x0d90('0x9')](),controller['removeAnswers']);router[_0x0d90('0x3f')]('/:id/users',auth['isAuthenticated'](),controller[_0x0d90('0x41')]);module['exports']=router; \ No newline at end of file +var _0xfefc=['removeDispositions','removeAnswers','removeAgents','exports','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','create','post','addAnswer','root','format','now','originalname','single','file','addLogo','diskStorage','join','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','any','addInteraction','/:id','update','destroy','delete'];(function(_0x538e56,_0x4fa43c){var _0x232357=function(_0x2de1ad){while(--_0x2de1ad){_0x538e56['push'](_0x538e56['shift']());}};_0x232357(++_0x4fa43c);}(_0xfefc,0xc4));var _0xcfef=function(_0x3c5436,_0x154db5){_0x3c5436=_0x3c5436-0x0;var _0xf8c236=_0xfefc[_0x3c5436];return _0xf8c236;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfef('0x0'));var router=express[_0xcfef('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xcfef('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xcfef('0x3'));var controller=require(_0xcfef('0x4'));router[_0xcfef('0x5')]('/',auth[_0xcfef('0x6')](),controller[_0xcfef('0x7')]);router[_0xcfef('0x5')](_0xcfef('0x8'),auth[_0xcfef('0x6')](),controller[_0xcfef('0x9')]);router[_0xcfef('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xcfef('0xa')]);router[_0xcfef('0x5')](_0xcfef('0xb'),auth[_0xcfef('0x6')](),controller['getDispositions']);router[_0xcfef('0x5')](_0xcfef('0xc'),auth[_0xcfef('0x6')](),controller[_0xcfef('0xd')]);router[_0xcfef('0x5')](_0xcfef('0xe'),controller['getLogo']);router[_0xcfef('0x5')](_0xcfef('0xf'),controller[_0xcfef('0x10')]);router[_0xcfef('0x5')](_0xcfef('0x11'),controller[_0xcfef('0x12')]);router[_0xcfef('0x5')](_0xcfef('0x13'),controller[_0xcfef('0x14')]);router[_0xcfef('0x5')](_0xcfef('0x15'),auth[_0xcfef('0x6')](),controller['getInteractions']);router['get'](_0xcfef('0x16'),controller[_0xcfef('0x17')]);router['get'](_0xcfef('0x18'),auth[_0xcfef('0x6')](),controller[_0xcfef('0x19')]);router[_0xcfef('0x5')](_0xcfef('0x1a'),auth[_0xcfef('0x6')](),controller['getProactiveActions']);router[_0xcfef('0x5')](_0xcfef('0x1b'),controller[_0xcfef('0x1c')]);router[_0xcfef('0x5')]('/:id/offline_messages',auth[_0xcfef('0x6')](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0xcfef('0x6')](),controller['getAgents']);router['post']('/',auth[_0xcfef('0x6')](),controller[_0xcfef('0x1d')]);router['post']('/:id/dispositions',auth[_0xcfef('0x6')](),controller['addDisposition']);router[_0xcfef('0x1e')](_0xcfef('0xc'),auth['isAuthenticated'](),controller[_0xcfef('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1869f6,_0x3aa6da,_0x485d7c){_0x485d7c(null,path['join'](config[_0xcfef('0x20')],'server/files/images/logos/'));},'filename':function(_0x498563,_0x48a67f,_0x5c71ae){_0x5c71ae(null,util[_0xcfef('0x21')]('%s-%s',Date[_0xcfef('0x22')](),_0x48a67f[_0xcfef('0x23')]));}})});router['post'](_0xcfef('0xe'),upload[_0xcfef('0x24')](_0xcfef('0x25')),controller[_0xcfef('0x26')]);var upload=multer({'storage':multer[_0xcfef('0x27')]({'destination':function(_0x2e0248,_0x1d8b38,_0x1b3ff2){_0x1b3ff2(null,path[_0xcfef('0x28')](config[_0xcfef('0x20')],_0xcfef('0x29')));},'filename':function(_0x37eadf,_0x4f6483,_0x4e02f1){_0x4e02f1(null,util['format'](_0xcfef('0x2a'),Date[_0xcfef('0x22')](),_0x4f6483[_0xcfef('0x23')]));}})});router['post'](_0xcfef('0xf'),upload[_0xcfef('0x24')](_0xcfef('0x25')),controller[_0xcfef('0x2b')]);var upload=multer({'storage':multer[_0xcfef('0x27')]({'destination':function(_0x2a59ed,_0x4f539f,_0x61940e){_0x61940e(null,path[_0xcfef('0x28')](config['root'],_0xcfef('0x29')));},'filename':function(_0x420dec,_0x2a2bd0,_0x42d667){_0x42d667(null,util[_0xcfef('0x21')](_0xcfef('0x2a'),Date[_0xcfef('0x22')](),_0x2a2bd0[_0xcfef('0x23')]));}})});router[_0xcfef('0x1e')]('/:id/customer_avatar',upload[_0xcfef('0x24')](_0xcfef('0x25')),controller[_0xcfef('0x2c')]);var upload=multer({'storage':multer[_0xcfef('0x27')]({'destination':function(_0x36dd0c,_0x6a8e50,_0x47dc4e){_0x47dc4e(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2f69d0,_0xe35381,_0xcdb06e){_0xcdb06e(null,util[_0xcfef('0x21')]('%s-%s',Date[_0xcfef('0x22')](),_0xe35381['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xcfef('0x24')](_0xcfef('0x25')),controller[_0xcfef('0x2d')]);router['post'](_0xcfef('0x2e'),controller[_0xcfef('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0xcfef('0x27')]({'destination':function(_0x93be99,_0x148933,_0x14edb0){const _0xd6ddcf=path[_0xcfef('0x28')](config[_0xcfef('0x20')],_0xcfef('0x30'),_0xcfef('0x31'),_0xcfef('0x32'));fs_extra[_0xcfef('0x33')](_0xd6ddcf,function(){_0x14edb0(null,_0xd6ddcf);});},'filename':function(_0x41a8cf,_0x4ddf4a,_0x361e1a){const _0x9ae86f=_0x4ddf4a[_0xcfef('0x23')][_0xcfef('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3151ac=path[_0xcfef('0x35')](_0x9ae86f);const _0x2be1fc=Date['now']()+'-'+_0x9ae86f[_0xcfef('0x34')](_0x3151ac,'')+_0x3151ac;_0x361e1a(null,_0x2be1fc);}})});router[_0xcfef('0x1e')]('/:id/offline',offlineUploadMulter[_0xcfef('0x36')](),controller['offline']);router[_0xcfef('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xcfef('0x37')]);router[_0xcfef('0x1e')](_0xcfef('0x18'),auth[_0xcfef('0x6')](),controller['addApplications']);router[_0xcfef('0x1e')]('/:id/proactive_actions',auth[_0xcfef('0x6')](),controller['addProactiveActions']);router[_0xcfef('0x1e')]('/:id/users',auth[_0xcfef('0x6')](),controller['addAgents']);router['put'](_0xcfef('0x38'),auth['isAuthenticated'](),controller[_0xcfef('0x39')]);router['delete'](_0xcfef('0x38'),auth[_0xcfef('0x6')](),controller[_0xcfef('0x3a')]);router[_0xcfef('0x3b')](_0xcfef('0xb'),auth[_0xcfef('0x6')](),controller[_0xcfef('0x3c')]);router[_0xcfef('0x3b')](_0xcfef('0xc'),auth[_0xcfef('0x6')](),controller[_0xcfef('0x3d')]);router[_0xcfef('0x3b')]('/:id/users',auth[_0xcfef('0x6')](),controller[_0xcfef('0x3e')]);module[_0xcfef('0x3f')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 3390d3d..f722553 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 _0x380d=['env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x3ce466,_0x1163b5){var _0x321502=function(_0x234978){while(--_0x234978){_0x3ce466['push'](_0x3ce466['shift']());}};_0x321502(++_0x1163b5);}(_0x380d,0x165));var _0xd380=function(_0x364009,_0x4f2fbe){_0x364009=_0x364009-0x0;var _0x2c0b12=_0x380d[_0x364009];return _0x2c0b12;};var beaverLogger=require(_0xd380('0x0'));var express=require(_0xd380('0x1'));var auth=require(_0xd380('0x2'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xd380('0x3')]==='production'||![];function clientSideLogs(_0x4fcb83,_0x3436f6,_0x19db5f){var _0x4d73d7=_0x4fcb83[_0xd380('0x4')][_0xd380('0x5')](_0xd380('0x6'));if(!_0x4d73d7){throw new Error(_0xd380('0x7'));}return beaverLogger[_0xd380('0x8')]({'uri':_0xd380('0x9'),'logger':_0x4d73d7,'enableCors':!isProduction})(_0x4fcb83,_0x3436f6,_0x19db5f);}router[_0xd380('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0xd380('0xb')]=router; \ No newline at end of file +var _0x3b55=['../config/environment','env','production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x2c81aa,_0xec314c){var _0x5a194a=function(_0x23cf5c){while(--_0x23cf5c){_0x2c81aa['push'](_0x2c81aa['shift']());}};_0x5a194a(++_0xec314c);}(_0x3b55,0x1e7));var _0x53b5=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0x3b55[_0x163742];return _0x1152ac;};var beaverLogger=require(_0x53b5('0x0'));var express=require(_0x53b5('0x1'));var auth=require(_0x53b5('0x2'));var config=require(_0x53b5('0x3'));var router=express['Router']();var isProduction=config[_0x53b5('0x4')]===_0x53b5('0x5')||![];function clientSideLogs(_0x22cb0b,_0x333644,_0x26396d){var _0x4673a4=_0x22cb0b[_0x53b5('0x6')][_0x53b5('0x7')]('client-side-logger');if(!_0x4673a4){throw new Error(_0x53b5('0x8'));}return beaverLogger[_0x53b5('0x9')]({'uri':_0x53b5('0xa'),'logger':_0x4673a4,'enableCors':!isProduction})(_0x22cb0b,_0x333644,_0x26396d);}router[_0x53b5('0xb')](auth[_0x53b5('0xc')](),clientSideLogs);module[_0x53b5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7b8c4f4..f82685e 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 _0xdbc9=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x5b33be,_0x20b6e7){var _0x1497f4=function(_0x1e5014){while(--_0x1e5014){_0x5b33be['push'](_0x5b33be['shift']());}};_0x1497f4(++_0x20b6e7);}(_0xdbc9,0xab));var _0x9dbc=function(_0xc54a8f,_0x246670){_0xc54a8f=_0xc54a8f-0x0;var _0x4def87=_0xdbc9[_0xc54a8f];return _0x4def87;};'use strict';var Sequelize=require(_0x9dbc('0x0'));module['exports']={'name':{'type':Sequelize[_0x9dbc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9dbc('0x2')](_0x9dbc('0x3'),_0x9dbc('0x4'),_0x9dbc('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9dbc('0x2')]('Outlook365',_0x9dbc('0x6'))},'data1':{'type':Sequelize[_0x9dbc('0x1')],'comment':_0x9dbc('0x7')},'data2':{'type':Sequelize[_0x9dbc('0x1')],'comment':_0x9dbc('0x8')},'data3':{'type':Sequelize[_0x9dbc('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x9dbc('0x1')],'comment':_0x9dbc('0x9')},'data5':{'type':Sequelize[_0x9dbc('0xa')],'comment':_0x9dbc('0xb')},'data6':{'type':Sequelize[_0x9dbc('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9dbc('0xa')],'comment':_0x9dbc('0xc')}}; \ No newline at end of file +var _0xe3b3=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x2826c7,_0x39ff47){var _0x3cea7d=function(_0x113053){while(--_0x113053){_0x2826c7['push'](_0x2826c7['shift']());}};_0x3cea7d(++_0x39ff47);}(_0xe3b3,0x170));var _0x3e3b=function(_0x46ae93,_0x5db71b){_0x46ae93=_0x46ae93-0x0;var _0x1ccc63=_0xe3b3[_0x46ae93];return _0x1ccc63;};'use strict';var Sequelize=require(_0x3e3b('0x0'));module[_0x3e3b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3e3b('0x2')](_0x3e3b('0x3'),_0x3e3b('0x4'),_0x3e3b('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3e3b('0x6'),_0x3e3b('0x7'))},'data1':{'type':Sequelize[_0x3e3b('0x8')],'comment':_0x3e3b('0x9')},'data2':{'type':Sequelize[_0x3e3b('0x8')],'comment':_0x3e3b('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x3e3b('0xb')},'data4':{'type':Sequelize[_0x3e3b('0x8')],'comment':_0x3e3b('0xc')},'data5':{'type':Sequelize[_0x3e3b('0xd')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x3e3b('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x3e3b('0xd')],'comment':_0x3e3b('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 06dda82..a0e178c 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 _0xb9e4=['filter','merge','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','find','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters'];(function(_0x549443,_0x2e04c8){var _0x372ed3=function(_0x214a87){while(--_0x214a87){_0x549443['push'](_0x549443['shift']());}};_0x372ed3(++_0x2e04c8);}(_0xb9e4,0x1ad));var _0x4b9e=function(_0x4b6e9a,_0x5945f4){_0x4b6e9a=_0x4b6e9a-0x0;var _0x3130ac=_0xb9e4[_0x4b6e9a];return _0x3130ac;};'use strict';var _=require(_0x4b9e('0x0'));var Redis=require(_0x4b9e('0x1'));var qs=require(_0x4b9e('0x2'));var encryptor=require(_0x4b9e('0x3'));var config=require(_0x4b9e('0x4'));var logger=require(_0x4b9e('0x5'))(_0x4b9e('0x6'));var db=require(_0x4b9e('0x7'))['db'];var oauth=require(_0x4b9e('0x8'));config['redis']=_[_0x4b9e('0x9')](config['redis'],{'host':_0x4b9e('0xa'),'port':0x18eb});var socket=require(_0x4b9e('0xb'))(new Redis(config[_0x4b9e('0xc')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x19a0bc,_0x1e22e8){_0x1e22e8=_0x1e22e8||0xcc;return function(_0x5bc699){if(_0x5bc699){return _0x19a0bc[_0x4b9e('0xd')](_0x1e22e8);}return _0x19a0bc[_0x4b9e('0xe')](_0x1e22e8)[_0x4b9e('0xf')]();};}function respondWithResult(_0x493c74,_0x4b376f){_0x4b376f=_0x4b376f||0xc8;return function(_0x26f4f9){if(_0x26f4f9){return _0x493c74['status'](_0x4b376f)[_0x4b9e('0x10')](_0x26f4f9);}};}function respondWithFilteredResult(_0x3b7beb,_0x4c6ffb){return function(_0x67e5af){if(_0x67e5af){var _0x3571a8=typeof _0x4c6ffb[_0x4b9e('0x11')]===_0x4b9e('0x12')&&typeof _0x4c6ffb['limit']===_0x4b9e('0x12');var _0xa5f295=_0x67e5af[_0x4b9e('0x13')];var _0x2ddbbf=_0x3571a8?0x0:_0x4c6ffb['offset'];var _0x22dd0a=_0x3571a8?_0x67e5af[_0x4b9e('0x13')]:_0x4c6ffb[_0x4b9e('0x11')]+_0x4c6ffb['limit'];var _0x285110;if(_0x22dd0a>=_0xa5f295){_0x22dd0a=_0xa5f295;_0x285110=0xc8;}else{_0x285110=0xce;}_0x3b7beb['status'](_0x285110);return _0x3b7beb[_0x4b9e('0x14')](_0x4b9e('0x15'),_0x2ddbbf+'-'+_0x22dd0a+'/'+_0xa5f295)[_0x4b9e('0x10')](_0x67e5af);}return null;};}function saveUpdates(_0x1ae6d2){return function(_0x36abf5){if(_0x36abf5){return _0x36abf5[_0x4b9e('0x16')](_0x1ae6d2)[_0x4b9e('0x17')](function(_0x188d4a){return _0x188d4a;});}return null;};}function removeEntity(_0x5629b3){return function(_0x521287){if(_0x521287){return _0x521287[_0x4b9e('0x18')]()[_0x4b9e('0x17')](function(){_0x5629b3[_0x4b9e('0xe')](0xcc)[_0x4b9e('0xf')]();});}};}function handleEntityNotFound(_0x393f09){return function(_0x29a8ed){if(!_0x29a8ed){_0x393f09[_0x4b9e('0xd')](0x194);}return _0x29a8ed;};}function handleError(_0x364cc7,_0x180122){_0x180122=_0x180122||0x1f4;return function(_0x1b749b){logger[_0x4b9e('0x19')](_0x1b749b[_0x4b9e('0x1a')]);if(_0x1b749b[_0x4b9e('0x1b')]){delete _0x1b749b[_0x4b9e('0x1b')];}_0x364cc7[_0x4b9e('0xe')](_0x180122)[_0x4b9e('0x1c')](_0x1b749b);};}function maskClientSecret(_0x197262){return _[_0x4b9e('0x1d')](_0x197262['slice'](0x0,0x3),0x14,'*');}exports[_0x4b9e('0x1e')]=function(_0x496a52,_0x5a003e){var _0x4cfdc3={},_0x3caabf={},_0x21e6d9={'count':0x0,'rows':[]};var _0x10fb07=_[_0x4b9e('0x1f')](db[_0x4b9e('0x20')][_0x4b9e('0x21')],function(_0x2c3dbf){return{'name':_0x2c3dbf[_0x4b9e('0x22')],'type':_0x2c3dbf[_0x4b9e('0x23')][_0x4b9e('0x24')]};});_0x3caabf[_0x4b9e('0x25')]=_['map'](_0x10fb07,_0x4b9e('0x1b'));_0x3caabf[_0x4b9e('0x26')]=_[_0x4b9e('0x27')](_0x496a52['query']);_0x3caabf['filters']=_[_0x4b9e('0x28')](_0x3caabf[_0x4b9e('0x25')],_0x3caabf['query']);_0x4cfdc3[_0x4b9e('0x29')]=_[_0x4b9e('0x28')](_0x3caabf[_0x4b9e('0x25')],qs[_0x4b9e('0x2a')](_0x496a52[_0x4b9e('0x26')][_0x4b9e('0x2a')]));_0x4cfdc3['attributes']=_0x4cfdc3[_0x4b9e('0x29')][_0x4b9e('0x2b')]?_0x4cfdc3[_0x4b9e('0x29')]:_0x3caabf[_0x4b9e('0x25')];if(!_0x496a52[_0x4b9e('0x26')][_0x4b9e('0x2c')]('nolimit')){_0x4cfdc3[_0x4b9e('0x2d')]=qs[_0x4b9e('0x2d')](_0x496a52[_0x4b9e('0x26')]['limit']);_0x4cfdc3[_0x4b9e('0x11')]=qs[_0x4b9e('0x11')](_0x496a52[_0x4b9e('0x26')][_0x4b9e('0x11')]);}_0x4cfdc3[_0x4b9e('0x2e')]=qs[_0x4b9e('0x2f')](_0x496a52[_0x4b9e('0x26')]['sort']);_0x4cfdc3[_0x4b9e('0x30')]=qs['filters'](_[_0x4b9e('0x31')](_0x496a52[_0x4b9e('0x26')],_0x3caabf[_0x4b9e('0x32')]),_0x10fb07);if(_0x496a52[_0x4b9e('0x26')][_0x4b9e('0x33')]){_0x4cfdc3['where']=_[_0x4b9e('0x34')](_0x4cfdc3[_0x4b9e('0x30')],{'$or':_['map'](_0x10fb07,function(_0x549008){if(_0x549008[_0x4b9e('0x23')]!==_0x4b9e('0x35')){var _0x40b939={};_0x40b939[_0x549008[_0x4b9e('0x1b')]]={'$like':'%'+_0x496a52[_0x4b9e('0x26')][_0x4b9e('0x33')]+'%'};return _0x40b939;}})});}_0x4cfdc3=_[_0x4b9e('0x34')]({},_0x4cfdc3,_0x496a52[_0x4b9e('0x36')]);var _0x12014e={'where':_0x4cfdc3[_0x4b9e('0x30')]};return db['CloudProvider'][_0x4b9e('0x13')](_0x12014e)[_0x4b9e('0x17')](function(_0x230be5){_0x21e6d9[_0x4b9e('0x13')]=_0x230be5;if(_0x496a52[_0x4b9e('0x26')]['includeAll']){_0x4cfdc3[_0x4b9e('0x37')]=[{'all':!![]}];}return db[_0x4b9e('0x20')][_0x4b9e('0x38')](_0x4cfdc3);})['then'](function(_0x383f04){_0x21e6d9[_0x4b9e('0x39')]=_[_0x4b9e('0x1f')](_0x383f04,function(_0x52dc97){if(_0x52dc97[_0x4b9e('0x3a')]===_0x4b9e('0x3b')){var _0x37390b=encryptor['decryptString'](_0x52dc97[_0x4b9e('0x3c')]);_0x52dc97[_0x4b9e('0x3c')]=maskClientSecret(_0x37390b);}return _0x52dc97;});return _0x21e6d9;})['then'](respondWithFilteredResult(_0x5a003e,_0x4cfdc3))[_0x4b9e('0x3d')](handleError(_0x5a003e,null));};exports[_0x4b9e('0x3e')]=function(_0x3c5abc,_0x324842){var _0x1e4cfb={'raw':!![],'where':{'id':_0x3c5abc[_0x4b9e('0x3f')]['id']}},_0xae75c2={};_0xae75c2[_0x4b9e('0x25')]=_[_0x4b9e('0x27')](db['CloudProvider'][_0x4b9e('0x21')]);_0xae75c2[_0x4b9e('0x26')]=_['keys'](_0x3c5abc[_0x4b9e('0x26')]);_0xae75c2['filters']=_[_0x4b9e('0x28')](_0xae75c2[_0x4b9e('0x25')],_0xae75c2['query']);_0x1e4cfb[_0x4b9e('0x29')]=_[_0x4b9e('0x28')](_0xae75c2[_0x4b9e('0x25')],qs[_0x4b9e('0x2a')](_0x3c5abc[_0x4b9e('0x26')][_0x4b9e('0x2a')]));_0x1e4cfb[_0x4b9e('0x29')]=_0x1e4cfb['attributes'][_0x4b9e('0x2b')]?_0x1e4cfb[_0x4b9e('0x29')]:_0xae75c2[_0x4b9e('0x25')];if(_0x3c5abc[_0x4b9e('0x26')]['includeAll']){_0x1e4cfb[_0x4b9e('0x37')]=[{'all':!![]}];}_0x1e4cfb=_[_0x4b9e('0x34')]({},_0x1e4cfb,_0x3c5abc[_0x4b9e('0x36')]);return db[_0x4b9e('0x20')][_0x4b9e('0x40')](_0x1e4cfb)[_0x4b9e('0x17')](handleEntityNotFound(_0x324842,null))[_0x4b9e('0x17')](function(_0x581d0c){if(_0x581d0c[_0x4b9e('0x3a')]===_0x4b9e('0x3b')){var _0x376b2e=encryptor['decryptString'](_0x581d0c['data3']);_0x581d0c[_0x4b9e('0x3c')]=maskClientSecret(_0x376b2e);}return _0x581d0c;})[_0x4b9e('0x17')](respondWithResult(_0x324842,null))[_0x4b9e('0x3d')](handleError(_0x324842,null));};exports[_0x4b9e('0x41')]=function(_0x360c80,_0x101e17){if(!_0x360c80['body']['name'])throw new Error(_0x4b9e('0x42'));if(!_0x360c80[_0x4b9e('0x43')][_0x4b9e('0x3a')])throw new Error(_0x4b9e('0x44'));var _0xd99842=db[_0x4b9e('0x20')]['rawAttributes'][_0x4b9e('0x3a')][_0x4b9e('0x45')];if(!_0xd99842[_0x4b9e('0x46')](_0x360c80[_0x4b9e('0x43')]['service']))throw new Error(_0x4b9e('0x47')+_0xd99842[_0x4b9e('0x48')](',\x20'));if(_0x360c80[_0x4b9e('0x43')][_0x4b9e('0x3a')]===_0x4b9e('0x3b')&&_0x360c80[_0x4b9e('0x43')]['data3']){_0x360c80[_0x4b9e('0x43')][_0x4b9e('0x3c')]=encryptor['encryptString'](_0x360c80[_0x4b9e('0x43')]['data3']);}return db[_0x4b9e('0x20')][_0x4b9e('0x41')](_0x360c80[_0x4b9e('0x43')],{})[_0x4b9e('0x17')](respondWithResult(_0x101e17,0xc9))['catch'](handleError(_0x101e17,null));};exports['update']=function(_0x442270,_0x15e573){if(_0x442270['body']['id']){delete _0x442270[_0x4b9e('0x43')]['id'];}return db[_0x4b9e('0x20')]['find']({'where':{'id':_0x442270[_0x4b9e('0x3f')]['id']}})[_0x4b9e('0x17')](handleEntityNotFound(_0x15e573,null))[_0x4b9e('0x17')](function(_0x5de6d0){if(_0x5de6d0['service']===_0x4b9e('0x3b')&&_0x442270[_0x4b9e('0x43')][_0x4b9e('0x3c')]){_0x442270[_0x4b9e('0x43')]['data3']=encryptor['encryptString'](_0x442270[_0x4b9e('0x43')][_0x4b9e('0x3c')]);}return _0x5de6d0;})['then'](saveUpdates(_0x442270[_0x4b9e('0x43')],null))['then'](respondWithResult(_0x15e573,null))[_0x4b9e('0x3d')](handleError(_0x15e573,null));};exports[_0x4b9e('0x18')]=function(_0x21398a,_0x9416e1){return db[_0x4b9e('0x20')]['find']({'where':{'id':_0x21398a['params']['id']}})[_0x4b9e('0x17')](handleEntityNotFound(_0x9416e1,null))['then'](removeEntity(_0x9416e1,null))[_0x4b9e('0x3d')](handleError(_0x9416e1,null));};exports['oauth2MicrosoftAuthorize']=function(_0x1c6fe2,_0xf57ca9){return db['CloudProvider'][_0x4b9e('0x49')]({'where':{'id':_0x1c6fe2[_0x4b9e('0x3f')]['id']},'raw':!![]})['then'](function(_0x10df07){if(!_0x10df07)return _0xf57ca9[_0x4b9e('0xd')](0x194);return{'url':oauth[_0x4b9e('0x4a')](_0x10df07,_0x1c6fe2['user']['id'])};})['then'](respondWithResult(_0xf57ca9,null))[_0x4b9e('0x3d')](handleError(_0xf57ca9,null));};exports[_0x4b9e('0x4b')]=function(_0x153121,_0x1e240c){var _0x2c0394=_0x153121[_0x4b9e('0x43')];var _0x3367f8;var _0xf9d622;if(_0x2c0394['error'])throw _0x2c0394;redis[_0x4b9e('0x4c')](_0x2c0394['state'])[_0x4b9e('0x17')](function(_0x3c5f9a){if(!_0x3c5f9a)throw new Error('Invalid\x20state\x20parameter');_0x3367f8=JSON['parse'](_0x3c5f9a);var _0x3717e8=Buffer['from'](_0x2c0394[_0x4b9e('0x4d')],_0x4b9e('0x4e'))[_0x4b9e('0x4f')]('ascii');_0xf9d622=JSON['parse'](_0x3717e8);if(!oauth[_0x4b9e('0x50')](_0x2c0394[_0x4b9e('0x51')],_0x3367f8[_0x4b9e('0x52')]))throw new Error(_0x4b9e('0x53'));redis['del'](_0x2c0394[_0x4b9e('0x4d')]);return oauth[_0x4b9e('0x54')](_0x2c0394['code'],_0x3367f8);})[_0x4b9e('0x17')](function(_0x4703cb){_0x3367f8[_0x4b9e('0x55')]=_0x4703cb[_0x4b9e('0x56')];_0x3367f8['data6']=_0x4703cb[_0x4b9e('0x57')];return db['CloudProvider'][_0x4b9e('0x16')]({'data5':_0x3367f8[_0x4b9e('0x55')],'data6':_0x3367f8[_0x4b9e('0x58')]},{'where':{'id':_0x3367f8['id']}});})[_0x4b9e('0x17')](function(){oauth[_0x4b9e('0x59')](_0x3367f8);socket[_0x4b9e('0x5a')](_0x4b9e('0x5b'),{'id':_0xf9d622['id']});return;})[_0x4b9e('0x17')](respondWithStatusCode(_0x1e240c,null))[_0x4b9e('0x3d')](function(_0x234b1d){if(_0xf9d622){socket[_0x4b9e('0x5a')](_0x4b9e('0x5c'),{'id':_0xf9d622['id']});}if(!_0x3367f8){logger[_0x4b9e('0x19')](_0x4b9e('0x5d'),_0x234b1d);return _0x1e240c['status'](0x1f4)[_0x4b9e('0x1c')](_0x234b1d['message']);}logger[_0x4b9e('0x19')](_0x4b9e('0x5e'),_0x3367f8['id'],JSON[_0x4b9e('0x5f')](_0x234b1d));});}; \ No newline at end of file +var _0x4b14=['data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','status','end','json','offset','undefined','count','limit','Content-Range','then','destroy','sendStatus','error','name','send','index','map','CloudProvider','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','VIRTUAL','options','where','include','rows','service','decryptString','data3','catch','params','length','MicrosoftAzure','create','body','Service\x20parameter\x20not\x20specified','join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','base64','toString','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token'];(function(_0x4b5b86,_0x23c37a){var _0xd965ac=function(_0x51f2cb){while(--_0x51f2cb){_0x4b5b86['push'](_0x4b5b86['shift']());}};_0xd965ac(++_0x23c37a);}(_0x4b14,0x108));var _0x44b1=function(_0x43752e,_0x42bc14){_0x43752e=_0x43752e-0x0;var _0xb07ab3=_0x4b14[_0x43752e];return _0xb07ab3;};'use strict';var _=require(_0x44b1('0x0'));var Redis=require(_0x44b1('0x1'));var qs=require(_0x44b1('0x2'));var encryptor=require(_0x44b1('0x3'));var config=require(_0x44b1('0x4'));var logger=require(_0x44b1('0x5'))(_0x44b1('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x44b1('0x7'));config[_0x44b1('0x8')]=_[_0x44b1('0x9')](config[_0x44b1('0x8')],{'host':_0x44b1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44b1('0x8')]));var redis=new Redis(config[_0x44b1('0x8')]);function respondWithStatusCode(_0x311f62,_0x9baece){_0x9baece=_0x9baece||0xcc;return function(_0x44933b){if(_0x44933b){return _0x311f62['sendStatus'](_0x9baece);}return _0x311f62[_0x44b1('0xb')](_0x9baece)[_0x44b1('0xc')]();};}function respondWithResult(_0x229649,_0x20f7d0){_0x20f7d0=_0x20f7d0||0xc8;return function(_0xa3bb39){if(_0xa3bb39){return _0x229649[_0x44b1('0xb')](_0x20f7d0)[_0x44b1('0xd')](_0xa3bb39);}};}function respondWithFilteredResult(_0x59aa49,_0x412618){return function(_0x3b1725){if(_0x3b1725){var _0x4dd3ef=typeof _0x412618[_0x44b1('0xe')]===_0x44b1('0xf')&&typeof _0x412618['limit']===_0x44b1('0xf');var _0x3618d0=_0x3b1725[_0x44b1('0x10')];var _0x39ed28=_0x4dd3ef?0x0:_0x412618[_0x44b1('0xe')];var _0x16a69d=_0x4dd3ef?_0x3b1725['count']:_0x412618[_0x44b1('0xe')]+_0x412618[_0x44b1('0x11')];var _0x3afbd1;if(_0x16a69d>=_0x3618d0){_0x16a69d=_0x3618d0;_0x3afbd1=0xc8;}else{_0x3afbd1=0xce;}_0x59aa49['status'](_0x3afbd1);return _0x59aa49['set'](_0x44b1('0x12'),_0x39ed28+'-'+_0x16a69d+'/'+_0x3618d0)[_0x44b1('0xd')](_0x3b1725);}return null;};}function saveUpdates(_0x11ea81){return function(_0x2fcfc1){if(_0x2fcfc1){return _0x2fcfc1['update'](_0x11ea81)[_0x44b1('0x13')](function(_0x5cc436){return _0x5cc436;});}return null;};}function removeEntity(_0x382541){return function(_0x90337a){if(_0x90337a){return _0x90337a[_0x44b1('0x14')]()[_0x44b1('0x13')](function(){_0x382541['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x385ac1){return function(_0x11e15b){if(!_0x11e15b){_0x385ac1[_0x44b1('0x15')](0x194);}return _0x11e15b;};}function handleError(_0x4d481a,_0xa00a62){_0xa00a62=_0xa00a62||0x1f4;return function(_0x13fc01){logger[_0x44b1('0x16')](_0x13fc01['stack']);if(_0x13fc01[_0x44b1('0x17')]){delete _0x13fc01['name'];}_0x4d481a[_0x44b1('0xb')](_0xa00a62)[_0x44b1('0x18')](_0x13fc01);};}function maskClientSecret(_0x2c07c9){return _['padEnd'](_0x2c07c9['slice'](0x0,0x3),0x14,'*');}exports[_0x44b1('0x19')]=function(_0x115c09,_0x195f5c){var _0x563b84={},_0x5c9034={},_0x9a48fb={'count':0x0,'rows':[]};var _0x233e2d=_[_0x44b1('0x1a')](db[_0x44b1('0x1b')]['rawAttributes'],function(_0x112d3c){return{'name':_0x112d3c['fieldName'],'type':_0x112d3c[_0x44b1('0x1c')]['key']};});_0x5c9034[_0x44b1('0x1d')]=_[_0x44b1('0x1a')](_0x233e2d,'name');_0x5c9034[_0x44b1('0x1e')]=_[_0x44b1('0x1f')](_0x115c09[_0x44b1('0x1e')]);_0x5c9034[_0x44b1('0x20')]=_[_0x44b1('0x21')](_0x5c9034[_0x44b1('0x1d')],_0x5c9034[_0x44b1('0x1e')]);_0x563b84[_0x44b1('0x22')]=_[_0x44b1('0x21')](_0x5c9034[_0x44b1('0x1d')],qs[_0x44b1('0x23')](_0x115c09[_0x44b1('0x1e')]['fields']));_0x563b84[_0x44b1('0x22')]=_0x563b84[_0x44b1('0x22')]['length']?_0x563b84[_0x44b1('0x22')]:_0x5c9034[_0x44b1('0x1d')];if(!_0x115c09[_0x44b1('0x1e')][_0x44b1('0x24')]('nolimit')){_0x563b84[_0x44b1('0x11')]=qs[_0x44b1('0x11')](_0x115c09[_0x44b1('0x1e')][_0x44b1('0x11')]);_0x563b84[_0x44b1('0xe')]=qs[_0x44b1('0xe')](_0x115c09[_0x44b1('0x1e')][_0x44b1('0xe')]);}_0x563b84[_0x44b1('0x25')]=qs[_0x44b1('0x26')](_0x115c09['query'][_0x44b1('0x26')]);_0x563b84['where']=qs[_0x44b1('0x20')](_[_0x44b1('0x27')](_0x115c09['query'],_0x5c9034[_0x44b1('0x20')]),_0x233e2d);if(_0x115c09[_0x44b1('0x1e')][_0x44b1('0x28')]){_0x563b84['where']=_['merge'](_0x563b84['where'],{'$or':_['map'](_0x233e2d,function(_0xe7d390){if(_0xe7d390[_0x44b1('0x1c')]!==_0x44b1('0x29')){var _0x3e6d22={};_0x3e6d22[_0xe7d390['name']]={'$like':'%'+_0x115c09[_0x44b1('0x1e')][_0x44b1('0x28')]+'%'};return _0x3e6d22;}})});}_0x563b84=_['merge']({},_0x563b84,_0x115c09[_0x44b1('0x2a')]);var _0xa21b20={'where':_0x563b84[_0x44b1('0x2b')]};return db[_0x44b1('0x1b')][_0x44b1('0x10')](_0xa21b20)[_0x44b1('0x13')](function(_0x2dff9e){_0x9a48fb[_0x44b1('0x10')]=_0x2dff9e;if(_0x115c09[_0x44b1('0x1e')]['includeAll']){_0x563b84[_0x44b1('0x2c')]=[{'all':!![]}];}return db[_0x44b1('0x1b')]['findAll'](_0x563b84);})['then'](function(_0x1b957b){_0x9a48fb[_0x44b1('0x2d')]=_['map'](_0x1b957b,function(_0x1e1ecb){if(_0x1e1ecb[_0x44b1('0x2e')]==='MicrosoftAzure'){var _0x1953c6=encryptor[_0x44b1('0x2f')](_0x1e1ecb[_0x44b1('0x30')]);_0x1e1ecb[_0x44b1('0x30')]=maskClientSecret(_0x1953c6);}return _0x1e1ecb;});return _0x9a48fb;})[_0x44b1('0x13')](respondWithFilteredResult(_0x195f5c,_0x563b84))[_0x44b1('0x31')](handleError(_0x195f5c,null));};exports['show']=function(_0xad9455,_0x263bbb){var _0x2d24c2={'raw':!![],'where':{'id':_0xad9455[_0x44b1('0x32')]['id']}},_0x5a63ef={};_0x5a63ef[_0x44b1('0x1d')]=_['keys'](db[_0x44b1('0x1b')]['rawAttributes']);_0x5a63ef[_0x44b1('0x1e')]=_['keys'](_0xad9455[_0x44b1('0x1e')]);_0x5a63ef[_0x44b1('0x20')]=_['intersection'](_0x5a63ef[_0x44b1('0x1d')],_0x5a63ef['query']);_0x2d24c2[_0x44b1('0x22')]=_['intersection'](_0x5a63ef['model'],qs['fields'](_0xad9455[_0x44b1('0x1e')][_0x44b1('0x23')]));_0x2d24c2[_0x44b1('0x22')]=_0x2d24c2[_0x44b1('0x22')][_0x44b1('0x33')]?_0x2d24c2[_0x44b1('0x22')]:_0x5a63ef[_0x44b1('0x1d')];if(_0xad9455['query']['includeAll']){_0x2d24c2[_0x44b1('0x2c')]=[{'all':!![]}];}_0x2d24c2=_['merge']({},_0x2d24c2,_0xad9455[_0x44b1('0x2a')]);return db[_0x44b1('0x1b')]['find'](_0x2d24c2)[_0x44b1('0x13')](handleEntityNotFound(_0x263bbb,null))[_0x44b1('0x13')](function(_0x39db9c){if(_0x39db9c[_0x44b1('0x2e')]===_0x44b1('0x34')){var _0xd488a4=encryptor[_0x44b1('0x2f')](_0x39db9c[_0x44b1('0x30')]);_0x39db9c[_0x44b1('0x30')]=maskClientSecret(_0xd488a4);}return _0x39db9c;})[_0x44b1('0x13')](respondWithResult(_0x263bbb,null))[_0x44b1('0x31')](handleError(_0x263bbb,null));};exports[_0x44b1('0x35')]=function(_0x239cd7,_0x270440){if(!_0x239cd7[_0x44b1('0x36')][_0x44b1('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x239cd7['body']['service'])throw new Error(_0x44b1('0x37'));var _0x6aab56=db[_0x44b1('0x1b')]['rawAttributes']['service']['values'];if(!_0x6aab56['includes'](_0x239cd7['body']['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x6aab56[_0x44b1('0x38')](',\x20'));if(_0x239cd7['body'][_0x44b1('0x2e')]===_0x44b1('0x34')&&_0x239cd7[_0x44b1('0x36')][_0x44b1('0x30')]){_0x239cd7[_0x44b1('0x36')]['data3']=encryptor[_0x44b1('0x39')](_0x239cd7['body']['data3']);}return db[_0x44b1('0x1b')]['create'](_0x239cd7['body'],{})['then'](respondWithResult(_0x270440,0xc9))[_0x44b1('0x31')](handleError(_0x270440,null));};exports['update']=function(_0x42b99d,_0x17c26d){if(_0x42b99d[_0x44b1('0x36')]['id']){delete _0x42b99d[_0x44b1('0x36')]['id'];}return db[_0x44b1('0x1b')][_0x44b1('0x3a')]({'where':{'id':_0x42b99d['params']['id']}})[_0x44b1('0x13')](handleEntityNotFound(_0x17c26d,null))[_0x44b1('0x13')](function(_0x2aec19){if(_0x2aec19['service']===_0x44b1('0x34')&&_0x42b99d[_0x44b1('0x36')][_0x44b1('0x30')]){_0x42b99d[_0x44b1('0x36')][_0x44b1('0x30')]=encryptor[_0x44b1('0x39')](_0x42b99d[_0x44b1('0x36')]['data3']);}return _0x2aec19;})['then'](saveUpdates(_0x42b99d[_0x44b1('0x36')],null))[_0x44b1('0x13')](respondWithResult(_0x17c26d,null))[_0x44b1('0x31')](handleError(_0x17c26d,null));};exports['destroy']=function(_0x1a4e22,_0x16885a){return db[_0x44b1('0x1b')]['find']({'where':{'id':_0x1a4e22[_0x44b1('0x32')]['id']}})[_0x44b1('0x13')](handleEntityNotFound(_0x16885a,null))[_0x44b1('0x13')](removeEntity(_0x16885a,null))[_0x44b1('0x31')](handleError(_0x16885a,null));};exports[_0x44b1('0x3b')]=function(_0x3a0f9e,_0x344e35){return db['CloudProvider'][_0x44b1('0x3c')]({'where':{'id':_0x3a0f9e['params']['id']},'raw':!![]})[_0x44b1('0x13')](function(_0x54e364){if(!_0x54e364)return _0x344e35[_0x44b1('0x15')](0x194);return{'url':oauth[_0x44b1('0x3d')](_0x54e364,_0x3a0f9e[_0x44b1('0x3e')]['id'])};})[_0x44b1('0x13')](respondWithResult(_0x344e35,null))[_0x44b1('0x31')](handleError(_0x344e35,null));};exports['oauth2MicrosoftCallback']=function(_0x717a38,_0x3400d7){var _0x429328=_0x717a38[_0x44b1('0x36')];var _0x150a53;var _0x14fe93;if(_0x429328[_0x44b1('0x16')])throw _0x429328;redis[_0x44b1('0x3f')](_0x429328[_0x44b1('0x40')])[_0x44b1('0x13')](function(_0x5a8eff){if(!_0x5a8eff)throw new Error(_0x44b1('0x41'));_0x150a53=JSON[_0x44b1('0x42')](_0x5a8eff);var _0x2d6b20=Buffer['from'](_0x429328[_0x44b1('0x40')],_0x44b1('0x43'))[_0x44b1('0x44')]('ascii');_0x14fe93=JSON[_0x44b1('0x42')](_0x2d6b20);if(!oauth[_0x44b1('0x45')](_0x429328['id_token'],_0x150a53['oauth2Claims']))throw new Error(_0x44b1('0x46'));redis[_0x44b1('0x47')](_0x429328['state']);return oauth[_0x44b1('0x48')](_0x429328[_0x44b1('0x49')],_0x150a53);})['then'](function(_0x46ea7a){_0x150a53[_0x44b1('0x4a')]=_0x46ea7a['access_token'];_0x150a53['data6']=_0x46ea7a[_0x44b1('0x4b')];return db['CloudProvider']['update']({'data5':_0x150a53[_0x44b1('0x4a')],'data6':_0x150a53[_0x44b1('0x4c')]},{'where':{'id':_0x150a53['id']}});})[_0x44b1('0x13')](function(){oauth[_0x44b1('0x4d')](_0x150a53);socket[_0x44b1('0x4e')](_0x44b1('0x4f'),{'id':_0x14fe93['id']});return;})[_0x44b1('0x13')](respondWithStatusCode(_0x3400d7,null))[_0x44b1('0x31')](function(_0x2bef39){if(_0x14fe93){socket[_0x44b1('0x4e')](_0x44b1('0x50'),{'id':_0x14fe93['id']});}if(!_0x150a53){logger[_0x44b1('0x16')](_0x44b1('0x51'),_0x2bef39);return _0x3400d7[_0x44b1('0xb')](0x1f4)[_0x44b1('0x18')](_0x2bef39[_0x44b1('0x52')]);}logger[_0x44b1('0x16')](_0x44b1('0x53'),_0x150a53['id'],JSON[_0x44b1('0x54')](_0x2bef39));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 137dcc2..92eed38 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 _0xd9d3=['CloudProvider','cloud_providers','lodash','util','api','bluebird','path','../../config/environment','exports','define'];(function(_0x2451c3,_0x2c16e0){var _0x4bc3bb=function(_0x378dd5){while(--_0x378dd5){_0x2451c3['push'](_0x2451c3['shift']());}};_0x4bc3bb(++_0x2c16e0);}(_0xd9d3,0x174));var _0x3d9d=function(_0x3aacd4,_0x46ed3b){_0x3aacd4=_0x3aacd4-0x0;var _0x3b4e07=_0xd9d3[_0x3aacd4];return _0x3b4e07;};'use strict';var _=require(_0x3d9d('0x0'));var util=require(_0x3d9d('0x1'));var logger=require('../../config/logger')(_0x3d9d('0x2'));var moment=require('moment');var BPromise=require(_0x3d9d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d9d('0x4'));var rimraf=require('rimraf');var config=require(_0x3d9d('0x5'));var attributes=require('./cloudProvider.attributes');module[_0x3d9d('0x6')]=function(_0x185a55,_0xebbd0){return _0x185a55[_0x3d9d('0x7')](_0x3d9d('0x8'),attributes,{'tableName':_0x3d9d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb7=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers'];(function(_0x10ed77,_0x108116){var _0x23c3e7=function(_0x2a4a23){while(--_0x2a4a23){_0x10ed77['push'](_0x10ed77['shift']());}};_0x23c3e7(++_0x108116);}(_0xdbb7,0x9a));var _0x7dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7dbb('0x0'));var logger=require(_0x7dbb('0x1'))(_0x7dbb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7dbb('0x3'));var fs=require('fs');var path=require(_0x7dbb('0x4'));var rimraf=require(_0x7dbb('0x5'));var config=require(_0x7dbb('0x6'));var attributes=require(_0x7dbb('0x7'));module[_0x7dbb('0x8')]=function(_0x4ee702,_0x289582){return _0x4ee702[_0x7dbb('0x9')]('CloudProvider',attributes,{'tableName':_0x7dbb('0xa'),'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 1e7b0d1..0196691 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 _0xbe81=['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/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','base64','toString','hex','client_id','data1','redirect_uri','data4','response_mode','scope','state','nonce','login','key','value','oauth2Claims','oauth2/','set','stringify','payload','iss','issuer','audience','isAfter','unix','exp','resolve','data3','then','refresh_token','data6','decryptString','POST','data5','access_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','findAll','all','inspect','exports','lodash','ioredis','request-promise','../../components/encryptor','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb'];(function(_0x149c91,_0x10138a){var _0x552396=function(_0x487233){while(--_0x487233){_0x149c91['push'](_0x149c91['shift']());}};_0x552396(++_0x10138a);}(_0xbe81,0x121));var _0x1be8=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0xbe81[_0x584b9d];return _0x172053;};'use strict';var _=require(_0x1be8('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x1be8('0x1'));var rp=require(_0x1be8('0x2'));var util=require('util');var encryptor=require(_0x1be8('0x3'));var config=require('../../config/environment');var logger=require(_0x1be8('0x4'))('api');var schedule=require(_0x1be8('0x5'));var db=require(_0x1be8('0x6'))['db'];config[_0x1be8('0x7')]=_[_0x1be8('0x8')](config[_0x1be8('0x7')],{'host':_0x1be8('0x9'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x1be8('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1be8('0xb'),_0x1be8('0xc'),_0x1be8('0xd'),_0x1be8('0xe'),_0x1be8('0xf'),_0x1be8('0x10'),_0x1be8('0x11')],'Dynamics365':['openid',_0x1be8('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1be8('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x225013){var _0x5dd7d6=_[_0x1be8('0x13')](AZURE_AUTH_SCOPES[_0x225013[_0x1be8('0x14')]]);if(_0x225013['type']===_0x1be8('0x15'))_0x5dd7d6['push'](_0x225013['data7']+_0x1be8('0x16'));return _0x5dd7d6[_0x1be8('0x17')]('\x20');}function getAccessTokenScope(_0x2ed6a2){if(_0x2ed6a2[_0x1be8('0x14')]===_0x1be8('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x2ed6a2[_0x1be8('0x14')]===_0x1be8('0x15'))return _0x2ed6a2['data7']+_0x1be8('0x16');}function generateMicrosoftAuthorizationUrl(_0x40dafb,_0x356590){var _0x3afdb4=MICROSOFT_AUTH_URL[_0x1be8('0x19')](_0x1be8('0x1a'),_0x40dafb[_0x1be8('0x1b')]);var _0x576f27=[_0x1be8('0x1c'),'id_token'];var _0x7a6d92=Buffer[_0x1be8('0x1d')](JSON['stringify']({'id':_0x356590}))['toString'](_0x1be8('0x1e'));var _0x72f7e1=crypto['randomBytes'](0x10)[_0x1be8('0x1f')](_0x1be8('0x20'));var _0x1c3019=getAuthorizationScopes(_0x40dafb);var _0x5017d2=[{'key':_0x1be8('0x21'),'value':_0x40dafb[_0x1be8('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x576f27[_0x1be8('0x17')]('\x20'))},{'key':_0x1be8('0x23'),'value':_0x40dafb[_0x1be8('0x24')]},{'key':_0x1be8('0x25'),'value':'form_post'},{'key':_0x1be8('0x26'),'value':encodeURIComponent(_0x1c3019)},{'key':_0x1be8('0x27'),'value':_0x7a6d92},{'key':_0x1be8('0x28'),'value':_0x72f7e1},{'key':'prompt','value':_0x1be8('0x29')}];var _0x5b463f=_0x3afdb4+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1be8('0x13')](_0x5017d2,function(_0x5da5de){return _0x5da5de[_0x1be8('0x2a')]+'='+_0x5da5de[_0x1be8('0x2b')];})[_0x1be8('0x17')]('&');_0x40dafb[_0x1be8('0x2c')]={'issuer':_0x3afdb4['replace'](_0x1be8('0x2d'),''),'audience':_0x40dafb['data1'],'state':_0x7a6d92,'nonce':_0x72f7e1};redis[_0x1be8('0x2e')](_0x7a6d92,JSON[_0x1be8('0x2f')](_0x40dafb));return _0x5b463f;}function isValidIdToken(_0x1a9402,_0x3b7b0c){try{var _0xfef6fe=jwt['decode'](_0x1a9402,{'complete':!![]});var _0x11f64d=_0xfef6fe[_0x1be8('0x30')];if(_0x11f64d[_0x1be8('0x31')]!==_0x3b7b0c[_0x1be8('0x32')])return![];if(_0x11f64d['aud']!==_0x3b7b0c[_0x1be8('0x33')])return![];if(_0x11f64d['nonce']!==_0x3b7b0c['nonce'])return![];if(moment()[_0x1be8('0x34')](moment[_0x1be8('0x35')](_0x11f64d[_0x1be8('0x36')])))return![];return!![];}catch(_0xdea15b){throw _0xdea15b;}}function refreshOauth2MicrosoftAccessToken(_0x459717){return Promise[_0x1be8('0x37')]()['then'](function(){if(_0x459717[_0x1be8('0x38')])return _0x459717;return db['CloudProvider']['findOne']({'where':{'id':_0x459717['id']},'raw':!![]});})[_0x1be8('0x39')](function(_0x38e41c){var _0xe65bd7={'grant_type':_0x1be8('0x3a'),'refresh_token':_0x38e41c[_0x1be8('0x3b')],'scope':getAccessTokenScope(_0x38e41c),'redirect_uri':_0x38e41c[_0x1be8('0x24')],'client_id':_0x38e41c[_0x1be8('0x22')],'client_secret':encryptor[_0x1be8('0x3c')](_0x38e41c[_0x1be8('0x38')])};var _0x4215a6={'method':_0x1be8('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x1be8('0x19')]('{TENANT_ID}',_0x38e41c[_0x1be8('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xe65bd7,'json':!![]};return rp(_0x4215a6);})[_0x1be8('0x39')](function(_0x39221d){_0x459717[_0x1be8('0x3e')]=_0x39221d[_0x1be8('0x3f')];_0x459717['data6']=_0x39221d['refresh_token'];return db[_0x1be8('0x40')][_0x1be8('0x41')]({'data5':_0x459717[_0x1be8('0x3e')],'data6':_0x459717['data6']},{'where':{'id':_0x459717['id']}});})[_0x1be8('0x39')](function(){return _0x459717;})[_0x1be8('0x42')](function(_0x5712a4){logger[_0x1be8('0x43')](_0x1be8('0x44'),_0x459717['id'],_0x5712a4);});}function getOauth2MicrosoftAccessToken(_0x43d717,_0xa05819){var _0x407b8d={'grant_type':_0x1be8('0x45'),'code':_0x43d717,'scope':getAccessTokenScope(_0xa05819),'redirect_uri':_0xa05819[_0x1be8('0x24')],'client_id':_0xa05819[_0x1be8('0x22')],'client_secret':encryptor['decryptString'](_0xa05819[_0x1be8('0x38')])};var _0x148ca0={'method':_0x1be8('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x1be8('0x19')]('{TENANT_ID}',_0xa05819[_0x1be8('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x407b8d,'json':!![]};return rp(_0x148ca0);}function startRefreshInterval(_0x469d16){var _0x5d0cd7=schedule['intervals'];if(_0x5d0cd7[_0x469d16['id']])clearInterval(_0x5d0cd7[_0x469d16['id']]);_0x5d0cd7[_0x469d16['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x469d16['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5d0cd7;}function startAllRefreshIntervals(){return db[_0x1be8('0x40')][_0x1be8('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1be8('0x39')](function(_0x3ef62d){var _0x36b146=_0x3ef62d[_0x1be8('0x13')](function(_0x1c3b8b){return refreshOauth2MicrosoftAccessToken(_0x1c3b8b)[_0x1be8('0x39')](function(_0x1d8019){startRefreshInterval(_0x1d8019);});});return Promise[_0x1be8('0x47')](_0x36b146);})[_0x1be8('0x42')](function(_0x239cf8){var _0x126297=_0x239cf8?util[_0x1be8('0x48')](_0x239cf8,{'showHidden':![],'depth':null}):'';logger[_0x1be8('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x126297);});}module[_0x1be8('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x00a1=['type','Dynamics365','push','/.default','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','hex','client_id','data1','response_type','join','redirect_uri','data4','form_post','prompt','map','oauth2Claims','oauth2/','set','iss','issuer','aud','audience','nonce','isAfter','unix','resolve','then','data3','CloudProvider','findOne','decryptString','data5','access_token','data6','catch','error','authorization_code','intervals','findAll','lodash','moment','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x00a1,0x184));var _0x100a=function(_0x38d3ad,_0x331801){_0x38d3ad=_0x38d3ad-0x0;var _0x4f3d1e=_0x00a1[_0x38d3ad];return _0x4f3d1e;};'use strict';var _=require(_0x100a('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x100a('0x1'));var Redis=require('ioredis');var rp=require(_0x100a('0x2'));var util=require(_0x100a('0x3'));var encryptor=require(_0x100a('0x4'));var config=require('../../config/environment');var logger=require(_0x100a('0x5'))(_0x100a('0x6'));var schedule=require(_0x100a('0x7'));var db=require(_0x100a('0x8'))['db'];config[_0x100a('0x9')]=_[_0x100a('0xa')](config[_0x100a('0x9')],{'host':_0x100a('0xb'),'port':0x18eb});var redis=new Redis(config[_0x100a('0x9')]);var MICROSOFT_AUTH_URL=_0x100a('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x100a('0xd'),_0x100a('0xe'),_0x100a('0xf'),'offline_access',_0x100a('0x10'),_0x100a('0x11'),_0x100a('0x12')],'Dynamics365':[_0x100a('0xd'),_0x100a('0x13')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x575405){var _0x37bb4f=_['map'](AZURE_AUTH_SCOPES[_0x575405['type']]);if(_0x575405[_0x100a('0x14')]===_0x100a('0x15'))_0x37bb4f[_0x100a('0x16')](_0x575405['data7']+_0x100a('0x17'));return _0x37bb4f['join']('\x20');}function getAccessTokenScope(_0x4df2ed){if(_0x4df2ed[_0x100a('0x14')]===_0x100a('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x4df2ed[_0x100a('0x14')]===_0x100a('0x15'))return _0x4df2ed[_0x100a('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2f49bb,_0x2429bf){var _0x4f5afd=MICROSOFT_AUTH_URL[_0x100a('0x1a')](_0x100a('0x1b'),_0x2f49bb[_0x100a('0x1c')]);var _0x1d5a3f=[_0x100a('0x1d'),_0x100a('0x1e')];var _0x83eab4=Buffer[_0x100a('0x1f')](JSON[_0x100a('0x20')]({'id':_0x2429bf}))[_0x100a('0x21')]('base64');var _0x3a35cf=crypto['randomBytes'](0x10)['toString'](_0x100a('0x22'));var _0x2342be=getAuthorizationScopes(_0x2f49bb);var _0x1211a8=[{'key':_0x100a('0x23'),'value':_0x2f49bb[_0x100a('0x24')]},{'key':_0x100a('0x25'),'value':encodeURIComponent(_0x1d5a3f[_0x100a('0x26')]('\x20'))},{'key':_0x100a('0x27'),'value':_0x2f49bb[_0x100a('0x28')]},{'key':'response_mode','value':_0x100a('0x29')},{'key':'scope','value':encodeURIComponent(_0x2342be)},{'key':'state','value':_0x83eab4},{'key':'nonce','value':_0x3a35cf},{'key':_0x100a('0x2a'),'value':'login'}];var _0xf300cc=_0x4f5afd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x100a('0x2b')](_0x1211a8,function(_0x317c8a){return _0x317c8a['key']+'='+_0x317c8a['value'];})[_0x100a('0x26')]('&');_0x2f49bb[_0x100a('0x2c')]={'issuer':_0x4f5afd[_0x100a('0x1a')](_0x100a('0x2d'),''),'audience':_0x2f49bb[_0x100a('0x24')],'state':_0x83eab4,'nonce':_0x3a35cf};redis[_0x100a('0x2e')](_0x83eab4,JSON[_0x100a('0x20')](_0x2f49bb));return _0xf300cc;}function isValidIdToken(_0x4785a0,_0x50bd09){try{var _0x1d1ee1=jwt['decode'](_0x4785a0,{'complete':!![]});var _0x2f607b=_0x1d1ee1['payload'];if(_0x2f607b[_0x100a('0x2f')]!==_0x50bd09[_0x100a('0x30')])return![];if(_0x2f607b[_0x100a('0x31')]!==_0x50bd09[_0x100a('0x32')])return![];if(_0x2f607b[_0x100a('0x33')]!==_0x50bd09['nonce'])return![];if(moment()[_0x100a('0x34')](moment[_0x100a('0x35')](_0x2f607b['exp'])))return![];return!![];}catch(_0xd50f6){throw _0xd50f6;}}function refreshOauth2MicrosoftAccessToken(_0xfcc4d6){return Promise[_0x100a('0x36')]()[_0x100a('0x37')](function(){if(_0xfcc4d6[_0x100a('0x38')])return _0xfcc4d6;return db[_0x100a('0x39')][_0x100a('0x3a')]({'where':{'id':_0xfcc4d6['id']},'raw':!![]});})[_0x100a('0x37')](function(_0x215248){var _0x187ca0={'grant_type':'refresh_token','refresh_token':_0x215248['data6'],'scope':getAccessTokenScope(_0x215248),'redirect_uri':_0x215248[_0x100a('0x28')],'client_id':_0x215248[_0x100a('0x24')],'client_secret':encryptor[_0x100a('0x3b')](_0x215248['data3'])};var _0x5e66f0={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x100a('0x1b'),_0x215248[_0x100a('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x187ca0,'json':!![]};return rp(_0x5e66f0);})[_0x100a('0x37')](function(_0x39e563){_0xfcc4d6[_0x100a('0x3c')]=_0x39e563[_0x100a('0x3d')];_0xfcc4d6[_0x100a('0x3e')]=_0x39e563['refresh_token'];return db[_0x100a('0x39')]['update']({'data5':_0xfcc4d6[_0x100a('0x3c')],'data6':_0xfcc4d6[_0x100a('0x3e')]},{'where':{'id':_0xfcc4d6['id']}});})['then'](function(){return _0xfcc4d6;})[_0x100a('0x3f')](function(_0x4e4439){logger[_0x100a('0x40')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xfcc4d6['id'],_0x4e4439);});}function getOauth2MicrosoftAccessToken(_0x574bdd,_0x4b9782){var _0x27e0c4={'grant_type':_0x100a('0x41'),'code':_0x574bdd,'scope':getAccessTokenScope(_0x4b9782),'redirect_uri':_0x4b9782['data4'],'client_id':_0x4b9782['data1'],'client_secret':encryptor[_0x100a('0x3b')](_0x4b9782['data3'])};var _0xef293e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x100a('0x1a')](_0x100a('0x1b'),_0x4b9782[_0x100a('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x27e0c4,'json':!![]};return rp(_0xef293e);}function startRefreshInterval(_0x4bfd3d){var _0x422f16=schedule[_0x100a('0x42')];if(_0x422f16[_0x4bfd3d['id']])clearInterval(_0x422f16[_0x4bfd3d['id']]);_0x422f16[_0x4bfd3d['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x4bfd3d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x422f16;}function startAllRefreshIntervals(){return db[_0x100a('0x39')][_0x100a('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x100a('0x37')](function(_0x2e1036){var _0x3c74f8=_0x2e1036[_0x100a('0x2b')](function(_0x8027d0){return refreshOauth2MicrosoftAccessToken(_0x8027d0)[_0x100a('0x37')](function(_0x29b6f2){startRefreshInterval(_0x29b6f2);});});return Promise['all'](_0x3c74f8);})[_0x100a('0x3f')](function(_0x1cd042){var _0x23cc68=_0x1cd042?util['inspect'](_0x1cd042,{'showHidden':![],'depth':null}):'';logger[_0x100a('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x23cc68);});}module['exports']={'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 c0d3a44..02d32c4 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 _0x4e2e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x42c1d9,_0x404ad8){var _0x210da3=function(_0x472452){while(--_0x472452){_0x42c1d9['push'](_0x42c1d9['shift']());}};_0x210da3(++_0x404ad8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1a74cd,_0x18a485){_0x1a74cd=_0x1a74cd-0x0;var _0x4dadd1=_0x4e2e[_0x1a74cd];return _0x4dadd1;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});} \ No newline at end of file +var _0x530f=['message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s'];(function(_0x29db9d,_0x3dc4a2){var _0x57b45c=function(_0x4a3f87){while(--_0x4a3f87){_0x29db9d['push'](_0x29db9d['shift']());}};_0x57b45c(++_0x3dc4a2);}(_0x530f,0x167));var _0xf530=function(_0x2d357c,_0x58bd29){_0x2d357c=_0x2d357c-0x0;var _0x1a3480=_0x530f[_0x2d357c];return _0x1a3480;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf530('0x1'));var fs=require('fs');var Redis=require(_0xf530('0x2'));var db=require(_0xf530('0x3'))['db'];var utils=require(_0xf530('0x4'));var logger=require(_0xf530('0x5'))(_0xf530('0x6'));var config=require(_0xf530('0x7'));var jayson=require(_0xf530('0x8'));var client=jayson['client'][_0xf530('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce7f8,_0x1e8282,_0x50682f){return new BPromise(function(_0x2bbe3c,_0xf205be){return client[_0xf530('0xa')](_0x2ce7f8,_0x50682f)[_0xf530('0xb')](function(_0x4132bf){logger[_0xf530('0xc')]('CloudProvider,\x20%s,\x20%s',_0x1e8282,_0xf530('0xd'));logger[_0xf530('0xe')](_0xf530('0xf'),_0x1e8282,_0xf530('0xd'),JSON[_0xf530('0x10')](_0x4132bf));if(_0x4132bf[_0xf530('0x11')]){if(_0x4132bf['error']['code']===0x1f4){logger[_0xf530('0x11')](_0xf530('0x12'),_0x1e8282,_0x4132bf[_0xf530('0x11')][_0xf530('0x13')]);return _0xf205be(_0x4132bf[_0xf530('0x11')]['message']);}logger[_0xf530('0x11')](_0xf530('0x12'),_0x1e8282,_0x4132bf[_0xf530('0x11')][_0xf530('0x13')]);return _0x2bbe3c(_0x4132bf[_0xf530('0x11')][_0xf530('0x13')]);}else{logger[_0xf530('0xc')](_0xf530('0x12'),_0x1e8282,'request\x20sent');_0x2bbe3c(_0x4132bf[_0xf530('0x14')][_0xf530('0x13')]);}})['catch'](function(_0x32eaea){logger[_0xf530('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1e8282,_0x32eaea);_0xf205be(_0x32eaea);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index be6eca6..c92debd 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x5f2f,0x73));var _0xf5f2=function(_0xd1730e,_0x4adb9f){_0xd1730e=_0xd1730e-0x0;var _0x4ce7d4=_0x5f2f[_0xd1730e];return _0x4ce7d4;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x1261,0x144));var _0x1126=function(_0x183c00,_0x5327b8){_0x183c00=_0x183c00-0x0;var _0x4a8361=_0x1261[_0x183c00];return _0x4a8361;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9a82dbe..8744be8 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 _0x023b=['STRING','sequelize'];(function(_0x32088f,_0x538e0a){var _0x43abf1=function(_0x52c41d){while(--_0x52c41d){_0x32088f['push'](_0x32088f['shift']());}};_0x43abf1(++_0x538e0a);}(_0x023b,0x123));var _0xb023=function(_0x170d59,_0x4743ad){_0x170d59=_0x170d59-0x0;var _0x53ed9f=_0x023b[_0x170d59];return _0x53ed9f;};'use strict';var Sequelize=require(_0xb023('0x0'));module['exports']={'name':{'type':Sequelize[_0xb023('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb023('0x1')]},'companyId':{'type':Sequelize[_0xb023('0x1')]},'website':{'type':Sequelize[_0xb023('0x1')]},'phone':{'type':Sequelize[_0xb023('0x1')]},'fax':{'type':Sequelize[_0xb023('0x1')]},'type':{'type':Sequelize[_0xb023('0x1')]},'street':{'type':Sequelize[_0xb023('0x1')]},'postalCode':{'type':Sequelize[_0xb023('0x1')]},'city':{'type':Sequelize[_0xb023('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb023('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb023('0x1')]},'sStreet':{'type':Sequelize[_0xb023('0x1')]},'sPostalCode':{'type':Sequelize[_0xb023('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb023('0x1')]}}; \ No newline at end of file +var _0x117d=['STRING','sequelize','exports'];(function(_0x45681b,_0x26d516){var _0x52a933=function(_0x2fe75c){while(--_0x2fe75c){_0x45681b['push'](_0x45681b['shift']());}};_0x52a933(++_0x26d516);}(_0x117d,0xac));var _0xd117=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x117d[_0x44946b];return _0x249bc4;};'use strict';var Sequelize=require(_0xd117('0x0'));module[_0xd117('0x1')]={'name':{'type':Sequelize[_0xd117('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd117('0x2')]},'companyId':{'type':Sequelize[_0xd117('0x2')]},'website':{'type':Sequelize[_0xd117('0x2')]},'phone':{'type':Sequelize[_0xd117('0x2')]},'fax':{'type':Sequelize[_0xd117('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd117('0x2')]},'postalCode':{'type':Sequelize[_0xd117('0x2')]},'city':{'type':Sequelize[_0xd117('0x2')]},'country':{'type':Sequelize[_0xd117('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd117('0x2')]},'sPostalCode':{'type':Sequelize[_0xd117('0x2')]},'sCity':{'type':Sequelize[_0xd117('0x2')]},'sCountry':{'type':Sequelize[_0xd117('0x2')]},'description':{'type':Sequelize[_0xd117('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7ec3256..d2ae468 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 _0xc815=['index','CmCompany','describe','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','params','rawAttributes','filters','include','options','create','body','user','role','Companies','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','getContacts','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','json','offset','count','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','name','send'];(function(_0x19ef72,_0x275be0){var _0x541034=function(_0x161a14){while(--_0x161a14){_0x19ef72['push'](_0x19ef72['shift']());}};_0x541034(++_0x275be0);}(_0xc815,0x1d4));var _0x5c81=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc815[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x5c81('0x0'));var rimraf=require(_0x5c81('0x1'));var zipdir=require(_0x5c81('0x2'));var jsonpatch=require(_0x5c81('0x3'));var rp=require(_0x5c81('0x4'));var moment=require('moment');var BPromise=require(_0x5c81('0x5'));var Mustache=require(_0x5c81('0x6'));var util=require('util');var path=require(_0x5c81('0x7'));var sox=require(_0x5c81('0x8'));var csv=require('to-csv');var ejs=require(_0x5c81('0x9'));var fs=require('fs');var fs_extra=require(_0x5c81('0xa'));var _=require('lodash');var squel=require(_0x5c81('0xb'));var crypto=require(_0x5c81('0xc'));var jsforce=require(_0x5c81('0xd'));var deskjs=require(_0x5c81('0xe'));var toCsv=require(_0x5c81('0xf'));var querystring=require(_0x5c81('0x10'));var Papa=require(_0x5c81('0x11'));var Redis=require('ioredis');var authService=require(_0x5c81('0x12'));var qs=require(_0x5c81('0x13'));var as=require(_0x5c81('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c81('0x15'));var utils=require('../../config/utils');var config=require(_0x5c81('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c81('0x17'))['db'];function respondWithStatusCode(_0x256024,_0x14e20a){_0x14e20a=_0x14e20a||0xcc;return function(_0x5c95ac){if(_0x5c95ac){return _0x256024['sendStatus'](_0x14e20a);}return _0x256024[_0x5c81('0x18')](_0x14e20a)['end']();};}function respondWithResult(_0x197479,_0x1a5728){_0x1a5728=_0x1a5728||0xc8;return function(_0x121c00){if(_0x121c00){return _0x197479[_0x5c81('0x18')](_0x1a5728)[_0x5c81('0x19')](_0x121c00);}};}function respondWithFilteredResult(_0x549bd1,_0x3d7009){return function(_0x3e2487){if(_0x3e2487){var _0x124e3a=typeof _0x3d7009[_0x5c81('0x1a')]==='undefined'&&typeof _0x3d7009['limit']==='undefined';var _0x1f190e=_0x3e2487[_0x5c81('0x1b')];var _0x190233=_0x124e3a?0x0:_0x3d7009[_0x5c81('0x1a')];var _0x32d374=_0x124e3a?_0x3e2487[_0x5c81('0x1b')]:_0x3d7009[_0x5c81('0x1a')]+_0x3d7009[_0x5c81('0x1c')];var _0x18ca33;if(_0x32d374>=_0x1f190e){_0x32d374=_0x1f190e;_0x18ca33=0xc8;}else{_0x18ca33=0xce;}_0x549bd1['status'](_0x18ca33);return _0x549bd1[_0x5c81('0x1d')]('Content-Range',_0x190233+'-'+_0x32d374+'/'+_0x1f190e)['json'](_0x3e2487);}return null;};}function patchUpdates(_0x5ca887){return function(_0x3e146f){try{jsonpatch[_0x5c81('0x1e')](_0x3e146f,_0x5ca887,!![]);}catch(_0x1b33d2){return BPromise[_0x5c81('0x1f')](_0x1b33d2);}return _0x3e146f[_0x5c81('0x20')]();};}function saveUpdates(_0x1e8d8b,_0x3830a0){return function(_0x249c17){if(_0x249c17){return _0x249c17[_0x5c81('0x21')](_0x1e8d8b)[_0x5c81('0x22')](function(_0x1c77e3){return _0x1c77e3;});}return null;};}function removeEntity(_0x1a02be,_0xfa73d){return function(_0x4f96c8){if(_0x4f96c8){return _0x4f96c8[_0x5c81('0x23')]()[_0x5c81('0x22')](function(){var _0x3ef49e=_0x4f96c8[_0x5c81('0x24')]({'plain':!![]});var _0x31e1bf='Companies';return db[_0x5c81('0x25')]['destroy']({'where':{'type':_0x31e1bf,'resourceId':_0x3ef49e['id']}})[_0x5c81('0x22')](function(){return _0x4f96c8;});})[_0x5c81('0x22')](function(){_0x1a02be[_0x5c81('0x18')](0xcc)[_0x5c81('0x26')]();});}};}function handleEntityNotFound(_0x18689c,_0x1ff427){return function(_0x477ab6){if(!_0x477ab6){_0x18689c[_0x5c81('0x27')](0x194);}return _0x477ab6;};}function handleError(_0x4a26d7,_0xf477a9){_0xf477a9=_0xf477a9||0x1f4;return function(_0x61d7a){logger['error'](_0x61d7a['stack']);if(_0x61d7a[_0x5c81('0x28')]){delete _0x61d7a[_0x5c81('0x28')];}_0x4a26d7[_0x5c81('0x18')](_0xf477a9)[_0x5c81('0x29')](_0x61d7a);};}exports[_0x5c81('0x2a')]=function(_0x267a4b,_0x566923){var _0x39934d={},_0x38f01a={},_0x373d01={'count':0x0,'rows':[]};return db[_0x5c81('0x2b')][_0x5c81('0x2c')]()[_0x5c81('0x22')](function(_0x461022){_0x38f01a['model']=_[_0x5c81('0x2d')](_0x461022);_0x38f01a[_0x5c81('0x2e')]=_[_0x5c81('0x2d')](_0x267a4b[_0x5c81('0x2e')]);_0x38f01a['filters']=_[_0x5c81('0x2f')](_0x38f01a[_0x5c81('0x30')],_0x38f01a[_0x5c81('0x2e')]);_0x39934d[_0x5c81('0x31')]=_[_0x5c81('0x2f')](_0x38f01a[_0x5c81('0x30')],qs[_0x5c81('0x32')](_0x267a4b['query']['fields']));_0x39934d[_0x5c81('0x31')]=_0x39934d[_0x5c81('0x31')][_0x5c81('0x33')]?_0x39934d[_0x5c81('0x31')]:_0x38f01a[_0x5c81('0x30')];if(!_0x267a4b[_0x5c81('0x2e')][_0x5c81('0x34')]('nolimit')){_0x39934d['limit']=qs[_0x5c81('0x1c')](_0x267a4b[_0x5c81('0x2e')][_0x5c81('0x1c')]);_0x39934d[_0x5c81('0x1a')]=qs['offset'](_0x267a4b[_0x5c81('0x2e')][_0x5c81('0x1a')]);}_0x39934d[_0x5c81('0x35')]=qs[_0x5c81('0x36')](_0x267a4b['query'][_0x5c81('0x36')]);_0x39934d[_0x5c81('0x37')]=qs['filters'](_[_0x5c81('0x38')](_0x267a4b['query'],_0x38f01a['filters']),_0x461022);if(_0x267a4b[_0x5c81('0x2e')][_0x5c81('0x39')]){_0x39934d['where']=_[_0x5c81('0x3a')](_0x39934d['where'],{'$or':_[_0x5c81('0x3b')](_0x39934d[_0x5c81('0x31')],function(_0x333649){var _0x9ecd38={};_0x9ecd38[_0x333649]={'$like':'%'+_0x267a4b[_0x5c81('0x2e')][_0x5c81('0x39')]+'%'};return _0x9ecd38;})});}_0x39934d=_['merge']({},_0x39934d,_0x267a4b['options']);var _0x41c97f={'where':_0x39934d['where']};return db['CmCompany'][_0x5c81('0x1b')](_0x41c97f)[_0x5c81('0x22')](function(_0x3b3161){_0x373d01[_0x5c81('0x1b')]=_0x3b3161;if(_0x267a4b['query'][_0x5c81('0x3c')]){_0x39934d['include']=[{'all':!![]}];}return db[_0x5c81('0x2b')][_0x5c81('0x3d')](_0x39934d);})[_0x5c81('0x22')](function(_0x1f40c9){_0x373d01[_0x5c81('0x3e')]=_0x1f40c9;return _0x373d01;})['then'](respondWithFilteredResult(_0x566923,_0x39934d))[_0x5c81('0x3f')](handleError(_0x566923,null));})['catch'](handleError(_0x566923,null));};exports['show']=function(_0x30985c,_0x5a80b9){var _0x152bd7={'raw':![],'where':{'id':_0x30985c[_0x5c81('0x40')]['id']}},_0x38642f={};_0x38642f[_0x5c81('0x30')]=_[_0x5c81('0x2d')](db['CmCompany'][_0x5c81('0x41')]);_0x38642f[_0x5c81('0x2e')]=_[_0x5c81('0x2d')](_0x30985c[_0x5c81('0x2e')]);_0x38642f[_0x5c81('0x42')]=_[_0x5c81('0x2f')](_0x38642f[_0x5c81('0x30')],_0x38642f[_0x5c81('0x2e')]);_0x152bd7['attributes']=_[_0x5c81('0x2f')](_0x38642f['model'],qs[_0x5c81('0x32')](_0x30985c[_0x5c81('0x2e')][_0x5c81('0x32')]));_0x152bd7[_0x5c81('0x31')]=_0x152bd7[_0x5c81('0x31')][_0x5c81('0x33')]?_0x152bd7[_0x5c81('0x31')]:_0x38642f[_0x5c81('0x30')];if(_0x30985c[_0x5c81('0x2e')]['includeAll']){_0x152bd7[_0x5c81('0x43')]=[{'all':!![]}];}_0x152bd7=_[_0x5c81('0x3a')]({},_0x152bd7,_0x30985c[_0x5c81('0x44')]);return db['CmCompany']['find'](_0x152bd7)['then'](handleEntityNotFound(_0x5a80b9,null))['then'](respondWithResult(_0x5a80b9,null))['catch'](handleError(_0x5a80b9,null));};exports[_0x5c81('0x45')]=function(_0x535e3a,_0xaa5e60){return db['CmCompany'][_0x5c81('0x45')](_0x535e3a[_0x5c81('0x46')],{})[_0x5c81('0x22')](function(_0x13027e){var _0x3e9b44=_0x535e3a[_0x5c81('0x47')]['get']({'plain':!![]});if(!_0x3e9b44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9b44[_0x5c81('0x48')]===_0x5c81('0x47')){var _0x441600=_0x13027e[_0x5c81('0x24')]({'plain':!![]});var _0x219ccc=_0x5c81('0x49');return db['UserProfileSection'][_0x5c81('0x4a')]({'where':{'name':_0x219ccc,'userProfileId':_0x3e9b44[_0x5c81('0x4b')]},'raw':!![]})[_0x5c81('0x22')](function(_0x2a6971){if(_0x2a6971&&_0x2a6971[_0x5c81('0x4c')]===0x0){return db[_0x5c81('0x25')][_0x5c81('0x45')]({'name':_0x441600[_0x5c81('0x28')],'resourceId':_0x441600['id'],'type':_0x2a6971[_0x5c81('0x28')],'sectionId':_0x2a6971['id']},{})['then'](function(){return _0x13027e;});}else{return _0x13027e;}})[_0x5c81('0x3f')](function(_0x381e51){logger['error'](_0x5c81('0x4d'),_0x381e51);throw _0x381e51;});}return _0x13027e;})[_0x5c81('0x22')](respondWithResult(_0xaa5e60,0xc9))[_0x5c81('0x3f')](handleError(_0xaa5e60,null));};exports['update']=function(_0x39a93a,_0x2da11b){if(_0x39a93a[_0x5c81('0x46')]['id']){delete _0x39a93a[_0x5c81('0x46')]['id'];}return db[_0x5c81('0x2b')][_0x5c81('0x4a')]({'where':{'id':_0x39a93a[_0x5c81('0x40')]['id']}})[_0x5c81('0x22')](handleEntityNotFound(_0x2da11b,null))[_0x5c81('0x22')](saveUpdates(_0x39a93a[_0x5c81('0x46')],null))[_0x5c81('0x22')](respondWithResult(_0x2da11b,null))[_0x5c81('0x3f')](handleError(_0x2da11b,null));};exports[_0x5c81('0x23')]=function(_0x2267ff,_0x4f43ab){return db[_0x5c81('0x2b')]['find']({'where':{'id':_0x2267ff[_0x5c81('0x40')]['id']}})[_0x5c81('0x22')](handleEntityNotFound(_0x4f43ab,null))[_0x5c81('0x22')](removeEntity(_0x4f43ab,null))['catch'](handleError(_0x4f43ab,null));};exports[_0x5c81('0x2c')]=function(_0x4c5a7d,_0x56df9e){return db[_0x5c81('0x2b')][_0x5c81('0x2c')]()['then'](respondWithResult(_0x56df9e,null))[_0x5c81('0x3f')](handleError(_0x56df9e,null));};exports[_0x5c81('0x4e')]=function(_0x35a51a,_0xf84bad,_0x102570){return db[_0x5c81('0x4f')][_0x5c81('0x4a')]({'where':{'id':_0x35a51a[_0x5c81('0x40')]['id']}})[_0x5c81('0x22')](handleEntityNotFound(_0xf84bad,null))[_0x5c81('0x22')](function(_0x4a30d8){if(_0x4a30d8){return _0x4a30d8['addContacts'](_0x35a51a[_0x5c81('0x46')][_0x5c81('0x50')],_[_0x5c81('0x51')](_0x35a51a[_0x5c81('0x46')],[_0x5c81('0x50'),'id'])||{});}})['then'](respondWithResult(_0xf84bad,null))[_0x5c81('0x3f')](handleError(_0xf84bad,null));};exports['getContacts']=function(_0x14aa9d,_0x260b68,_0x1de365){var _0x597d0b={};var _0x9781fc={};var _0x521eea;var _0x33b412;return db[_0x5c81('0x2b')][_0x5c81('0x52')]({'where':{'id':_0x14aa9d['params']['id']}})[_0x5c81('0x22')](handleEntityNotFound(_0x260b68,null))[_0x5c81('0x22')](function(_0x309c90){if(_0x309c90){_0x521eea=_0x309c90;_0x9781fc[_0x5c81('0x30')]=_[_0x5c81('0x2d')](db[_0x5c81('0x4f')][_0x5c81('0x41')]);_0x9781fc[_0x5c81('0x2e')]=_[_0x5c81('0x2d')](_0x14aa9d[_0x5c81('0x2e')]);_0x9781fc[_0x5c81('0x42')]=_[_0x5c81('0x2f')](_0x9781fc[_0x5c81('0x30')],_0x9781fc['query']);_0x597d0b[_0x5c81('0x31')]=_[_0x5c81('0x2f')](_0x9781fc['model'],qs[_0x5c81('0x32')](_0x14aa9d['query']['fields']));_0x597d0b[_0x5c81('0x31')]=_0x597d0b[_0x5c81('0x31')][_0x5c81('0x33')]?_0x597d0b['attributes']:_0x9781fc[_0x5c81('0x30')];_0x597d0b[_0x5c81('0x35')]=qs['sort'](_0x14aa9d[_0x5c81('0x2e')][_0x5c81('0x36')]);_0x597d0b[_0x5c81('0x37')]=qs[_0x5c81('0x42')](_[_0x5c81('0x38')](_0x14aa9d[_0x5c81('0x2e')],_0x9781fc[_0x5c81('0x42')]));if(_0x14aa9d[_0x5c81('0x2e')][_0x5c81('0x39')]){_0x597d0b[_0x5c81('0x37')]=_[_0x5c81('0x3a')](_0x597d0b['where'],{'$or':_[_0x5c81('0x3b')](_0x597d0b[_0x5c81('0x31')],function(_0x42e3fc){var _0x487e98={};_0x487e98[_0x42e3fc]={'$like':'%'+_0x14aa9d[_0x5c81('0x2e')][_0x5c81('0x39')]+'%'};return _0x487e98;})});}_0x597d0b=_[_0x5c81('0x3a')]({},_0x597d0b,_0x14aa9d[_0x5c81('0x44')]);return _0x521eea[_0x5c81('0x53')](_0x597d0b);}})['then'](function(_0x44a4a5){if(_0x44a4a5){_0x33b412=_0x44a4a5[_0x5c81('0x33')];if(!_0x14aa9d[_0x5c81('0x2e')][_0x5c81('0x34')](_0x5c81('0x54'))){_0x597d0b[_0x5c81('0x1c')]=qs[_0x5c81('0x1c')](_0x14aa9d[_0x5c81('0x2e')][_0x5c81('0x1c')]);_0x597d0b[_0x5c81('0x1a')]=qs[_0x5c81('0x1a')](_0x14aa9d['query'][_0x5c81('0x1a')]);}return _0x521eea['getContacts'](_0x597d0b);}})[_0x5c81('0x22')](function(_0x226420){if(_0x226420){return _0x226420?{'count':_0x33b412,'rows':_0x226420}:null;}})[_0x5c81('0x22')](respondWithResult(_0x260b68,null))[_0x5c81('0x3f')](handleError(_0x260b68,null));}; \ No newline at end of file +var _0x9711=['where','merge','map','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','autoAssociation','params','describe','addContacts','CmContact','ids','omit','getContacts','findOne','pick','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','CmCompany','model','keys','query','filters','fields','attributes','hasOwnProperty','order','sort'];(function(_0x3da02c,_0xe172b1){var _0x265b44=function(_0x1c4ddc){while(--_0x1c4ddc){_0x3da02c['push'](_0x3da02c['shift']());}};_0x265b44(++_0xe172b1);}(_0x9711,0x122));var _0x1971=function(_0x3f6a7b,_0x5be424){_0x3f6a7b=_0x3f6a7b-0x0;var _0x6b830f=_0x9711[_0x3f6a7b];return _0x6b830f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1971('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1971('0x1'));var rp=require(_0x1971('0x2'));var moment=require(_0x1971('0x3'));var BPromise=require(_0x1971('0x4'));var Mustache=require(_0x1971('0x5'));var util=require('util');var path=require(_0x1971('0x6'));var sox=require('sox');var csv=require(_0x1971('0x7'));var ejs=require(_0x1971('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1971('0x9'));var squel=require(_0x1971('0xa'));var crypto=require(_0x1971('0xb'));var jsforce=require(_0x1971('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1971('0x7'));var querystring=require(_0x1971('0xd'));var Papa=require('papaparse');var Redis=require(_0x1971('0xe'));var authService=require(_0x1971('0xf'));var qs=require(_0x1971('0x10'));var as=require(_0x1971('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1971('0x12'))('api');var utils=require(_0x1971('0x13'));var config=require(_0x1971('0x14'));var licenseUtil=require(_0x1971('0x15'));var db=require(_0x1971('0x16'))['db'];function respondWithStatusCode(_0x2bef9e,_0x9aea9c){_0x9aea9c=_0x9aea9c||0xcc;return function(_0x4b2ec8){if(_0x4b2ec8){return _0x2bef9e['sendStatus'](_0x9aea9c);}return _0x2bef9e[_0x1971('0x17')](_0x9aea9c)[_0x1971('0x18')]();};}function respondWithResult(_0x2daf1a,_0x3e62e4){_0x3e62e4=_0x3e62e4||0xc8;return function(_0x5c51f9){if(_0x5c51f9){return _0x2daf1a[_0x1971('0x17')](_0x3e62e4)[_0x1971('0x19')](_0x5c51f9);}};}function respondWithFilteredResult(_0x5c8d41,_0x5646bd){return function(_0x350dd7){if(_0x350dd7){var _0x4fdc53=typeof _0x5646bd[_0x1971('0x1a')]===_0x1971('0x1b')&&typeof _0x5646bd[_0x1971('0x1c')]===_0x1971('0x1b');var _0x33c19b=_0x350dd7[_0x1971('0x1d')];var _0x577f64=_0x4fdc53?0x0:_0x5646bd['offset'];var _0x102356=_0x4fdc53?_0x350dd7[_0x1971('0x1d')]:_0x5646bd[_0x1971('0x1a')]+_0x5646bd['limit'];var _0x2f2b23;if(_0x102356>=_0x33c19b){_0x102356=_0x33c19b;_0x2f2b23=0xc8;}else{_0x2f2b23=0xce;}_0x5c8d41[_0x1971('0x17')](_0x2f2b23);return _0x5c8d41[_0x1971('0x1e')](_0x1971('0x1f'),_0x577f64+'-'+_0x102356+'/'+_0x33c19b)[_0x1971('0x19')](_0x350dd7);}return null;};}function patchUpdates(_0x33195d){return function(_0x355172){try{jsonpatch[_0x1971('0x20')](_0x355172,_0x33195d,!![]);}catch(_0x471419){return BPromise['reject'](_0x471419);}return _0x355172[_0x1971('0x21')]();};}function saveUpdates(_0x1a0b33,_0x308afa){return function(_0x4b6736){if(_0x4b6736){return _0x4b6736[_0x1971('0x22')](_0x1a0b33)[_0x1971('0x23')](function(_0x329de3){return _0x329de3;});}return null;};}function removeEntity(_0x1bfbc9,_0x449532){return function(_0x105b9a){if(_0x105b9a){return _0x105b9a[_0x1971('0x24')]()[_0x1971('0x23')](function(){var _0x1185a7=_0x105b9a[_0x1971('0x25')]({'plain':!![]});var _0x121f9d='Companies';return db[_0x1971('0x26')][_0x1971('0x24')]({'where':{'type':_0x121f9d,'resourceId':_0x1185a7['id']}})[_0x1971('0x23')](function(){return _0x105b9a;});})['then'](function(){_0x1bfbc9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2565,_0x1ea7f7){return function(_0x16ad03){if(!_0x16ad03){_0x5c2565[_0x1971('0x27')](0x194);}return _0x16ad03;};}function handleError(_0x203b3e,_0x18167a){_0x18167a=_0x18167a||0x1f4;return function(_0x278534){logger[_0x1971('0x28')](_0x278534[_0x1971('0x29')]);if(_0x278534[_0x1971('0x2a')]){delete _0x278534['name'];}_0x203b3e[_0x1971('0x17')](_0x18167a)['send'](_0x278534);};}exports[_0x1971('0x2b')]=function(_0x536149,_0x9f464f){var _0x112158={},_0x52757b={},_0x2eb47b={'count':0x0,'rows':[]};return db[_0x1971('0x2c')]['describe']()[_0x1971('0x23')](function(_0x51559a){_0x52757b[_0x1971('0x2d')]=_[_0x1971('0x2e')](_0x51559a);_0x52757b[_0x1971('0x2f')]=_['keys'](_0x536149['query']);_0x52757b[_0x1971('0x30')]=_['intersection'](_0x52757b[_0x1971('0x2d')],_0x52757b['query']);_0x112158['attributes']=_['intersection'](_0x52757b['model'],qs[_0x1971('0x31')](_0x536149[_0x1971('0x2f')][_0x1971('0x31')]));_0x112158[_0x1971('0x32')]=_0x112158[_0x1971('0x32')]['length']?_0x112158['attributes']:_0x52757b['model'];if(!_0x536149['query'][_0x1971('0x33')]('nolimit')){_0x112158['limit']=qs[_0x1971('0x1c')](_0x536149[_0x1971('0x2f')][_0x1971('0x1c')]);_0x112158[_0x1971('0x1a')]=qs[_0x1971('0x1a')](_0x536149[_0x1971('0x2f')][_0x1971('0x1a')]);}_0x112158[_0x1971('0x34')]=qs[_0x1971('0x35')](_0x536149[_0x1971('0x2f')][_0x1971('0x35')]);_0x112158[_0x1971('0x36')]=qs[_0x1971('0x30')](_['pick'](_0x536149[_0x1971('0x2f')],_0x52757b[_0x1971('0x30')]),_0x51559a);if(_0x536149[_0x1971('0x2f')]['filter']){_0x112158[_0x1971('0x36')]=_[_0x1971('0x37')](_0x112158[_0x1971('0x36')],{'$or':_[_0x1971('0x38')](_0x112158[_0x1971('0x32')],function(_0x310df7){var _0x336424={};_0x336424[_0x310df7]={'$like':'%'+_0x536149[_0x1971('0x2f')][_0x1971('0x39')]+'%'};return _0x336424;})});}_0x112158=_['merge']({},_0x112158,_0x536149['options']);var _0xcb6534={'where':_0x112158[_0x1971('0x36')]};return db[_0x1971('0x2c')][_0x1971('0x1d')](_0xcb6534)['then'](function(_0x5a306c){_0x2eb47b[_0x1971('0x1d')]=_0x5a306c;if(_0x536149[_0x1971('0x2f')][_0x1971('0x3a')]){_0x112158[_0x1971('0x3b')]=[{'all':!![]}];}return db[_0x1971('0x2c')][_0x1971('0x3c')](_0x112158);})[_0x1971('0x23')](function(_0x5778a5){_0x2eb47b[_0x1971('0x3d')]=_0x5778a5;return _0x2eb47b;})[_0x1971('0x23')](respondWithFilteredResult(_0x9f464f,_0x112158))['catch'](handleError(_0x9f464f,null));})[_0x1971('0x3e')](handleError(_0x9f464f,null));};exports[_0x1971('0x3f')]=function(_0xc72bb8,_0x34a744){var _0x5605cb={'raw':![],'where':{'id':_0xc72bb8['params']['id']}},_0x34a002={};_0x34a002[_0x1971('0x2d')]=_[_0x1971('0x2e')](db[_0x1971('0x2c')][_0x1971('0x40')]);_0x34a002[_0x1971('0x2f')]=_[_0x1971('0x2e')](_0xc72bb8[_0x1971('0x2f')]);_0x34a002['filters']=_[_0x1971('0x41')](_0x34a002['model'],_0x34a002['query']);_0x5605cb[_0x1971('0x32')]=_[_0x1971('0x41')](_0x34a002[_0x1971('0x2d')],qs[_0x1971('0x31')](_0xc72bb8[_0x1971('0x2f')][_0x1971('0x31')]));_0x5605cb[_0x1971('0x32')]=_0x5605cb[_0x1971('0x32')][_0x1971('0x42')]?_0x5605cb['attributes']:_0x34a002['model'];if(_0xc72bb8[_0x1971('0x2f')][_0x1971('0x3a')]){_0x5605cb[_0x1971('0x3b')]=[{'all':!![]}];}_0x5605cb=_[_0x1971('0x37')]({},_0x5605cb,_0xc72bb8['options']);return db[_0x1971('0x2c')][_0x1971('0x43')](_0x5605cb)[_0x1971('0x23')](handleEntityNotFound(_0x34a744,null))['then'](respondWithResult(_0x34a744,null))[_0x1971('0x3e')](handleError(_0x34a744,null));};exports[_0x1971('0x44')]=function(_0x4389d0,_0x2fa355){return db[_0x1971('0x2c')]['create'](_0x4389d0[_0x1971('0x45')],{})['then'](function(_0x1eeca7){var _0x679786=_0x4389d0[_0x1971('0x46')][_0x1971('0x25')]({'plain':!![]});if(!_0x679786)throw new Error(_0x1971('0x47'));if(_0x679786[_0x1971('0x48')]===_0x1971('0x46')){var _0x6bc95d=_0x1eeca7[_0x1971('0x25')]({'plain':!![]});var _0x4b11ce=_0x1971('0x49');return db['UserProfileSection'][_0x1971('0x43')]({'where':{'name':_0x4b11ce,'userProfileId':_0x679786[_0x1971('0x4a')]},'raw':!![]})['then'](function(_0x1aa97a){if(_0x1aa97a&&_0x1aa97a[_0x1971('0x4b')]===0x0){return db[_0x1971('0x26')][_0x1971('0x44')]({'name':_0x6bc95d[_0x1971('0x2a')],'resourceId':_0x6bc95d['id'],'type':_0x1aa97a['name'],'sectionId':_0x1aa97a['id']},{})['then'](function(){return _0x1eeca7;});}else{return _0x1eeca7;}})['catch'](function(_0x2cfcfd){logger[_0x1971('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cfcfd);throw _0x2cfcfd;});}return _0x1eeca7;})[_0x1971('0x23')](respondWithResult(_0x2fa355,0xc9))[_0x1971('0x3e')](handleError(_0x2fa355,null));};exports[_0x1971('0x22')]=function(_0x4435ab,_0x351b53){if(_0x4435ab[_0x1971('0x45')]['id']){delete _0x4435ab[_0x1971('0x45')]['id'];}return db[_0x1971('0x2c')]['find']({'where':{'id':_0x4435ab[_0x1971('0x4c')]['id']}})[_0x1971('0x23')](handleEntityNotFound(_0x351b53,null))[_0x1971('0x23')](saveUpdates(_0x4435ab[_0x1971('0x45')],null))[_0x1971('0x23')](respondWithResult(_0x351b53,null))['catch'](handleError(_0x351b53,null));};exports[_0x1971('0x24')]=function(_0x2365b1,_0x5d3922){return db['CmCompany'][_0x1971('0x43')]({'where':{'id':_0x2365b1['params']['id']}})['then'](handleEntityNotFound(_0x5d3922,null))['then'](removeEntity(_0x5d3922,null))[_0x1971('0x3e')](handleError(_0x5d3922,null));};exports[_0x1971('0x4d')]=function(_0x552d10,_0x37b5a1){return db[_0x1971('0x2c')][_0x1971('0x4d')]()[_0x1971('0x23')](respondWithResult(_0x37b5a1,null))['catch'](handleError(_0x37b5a1,null));};exports[_0x1971('0x4e')]=function(_0x4da108,_0x8adb,_0x58350e){return db[_0x1971('0x4f')][_0x1971('0x43')]({'where':{'id':_0x4da108[_0x1971('0x4c')]['id']}})[_0x1971('0x23')](handleEntityNotFound(_0x8adb,null))[_0x1971('0x23')](function(_0x547ef0){if(_0x547ef0){return _0x547ef0[_0x1971('0x4e')](_0x4da108[_0x1971('0x45')][_0x1971('0x50')],_[_0x1971('0x51')](_0x4da108[_0x1971('0x45')],[_0x1971('0x50'),'id'])||{});}})['then'](respondWithResult(_0x8adb,null))[_0x1971('0x3e')](handleError(_0x8adb,null));};exports[_0x1971('0x52')]=function(_0x80adb8,_0xc18ed0,_0x5e6f07){var _0x1784e1={};var _0x446f77={};var _0xb3a773;var _0x2bafe6;return db[_0x1971('0x2c')][_0x1971('0x53')]({'where':{'id':_0x80adb8['params']['id']}})['then'](handleEntityNotFound(_0xc18ed0,null))['then'](function(_0x3c7bd6){if(_0x3c7bd6){_0xb3a773=_0x3c7bd6;_0x446f77['model']=_[_0x1971('0x2e')](db[_0x1971('0x4f')]['rawAttributes']);_0x446f77['query']=_[_0x1971('0x2e')](_0x80adb8[_0x1971('0x2f')]);_0x446f77[_0x1971('0x30')]=_['intersection'](_0x446f77['model'],_0x446f77[_0x1971('0x2f')]);_0x1784e1[_0x1971('0x32')]=_[_0x1971('0x41')](_0x446f77[_0x1971('0x2d')],qs['fields'](_0x80adb8[_0x1971('0x2f')][_0x1971('0x31')]));_0x1784e1[_0x1971('0x32')]=_0x1784e1['attributes']['length']?_0x1784e1[_0x1971('0x32')]:_0x446f77['model'];_0x1784e1[_0x1971('0x34')]=qs[_0x1971('0x35')](_0x80adb8['query'][_0x1971('0x35')]);_0x1784e1[_0x1971('0x36')]=qs[_0x1971('0x30')](_[_0x1971('0x54')](_0x80adb8['query'],_0x446f77['filters']));if(_0x80adb8[_0x1971('0x2f')][_0x1971('0x39')]){_0x1784e1[_0x1971('0x36')]=_[_0x1971('0x37')](_0x1784e1[_0x1971('0x36')],{'$or':_[_0x1971('0x38')](_0x1784e1[_0x1971('0x32')],function(_0x2586d6){var _0x2e281f={};_0x2e281f[_0x2586d6]={'$like':'%'+_0x80adb8[_0x1971('0x2f')]['filter']+'%'};return _0x2e281f;})});}_0x1784e1=_[_0x1971('0x37')]({},_0x1784e1,_0x80adb8['options']);return _0xb3a773['getContacts'](_0x1784e1);}})[_0x1971('0x23')](function(_0x28143c){if(_0x28143c){_0x2bafe6=_0x28143c[_0x1971('0x42')];if(!_0x80adb8[_0x1971('0x2f')][_0x1971('0x33')](_0x1971('0x55'))){_0x1784e1[_0x1971('0x1c')]=qs[_0x1971('0x1c')](_0x80adb8[_0x1971('0x2f')][_0x1971('0x1c')]);_0x1784e1[_0x1971('0x1a')]=qs[_0x1971('0x1a')](_0x80adb8[_0x1971('0x2f')][_0x1971('0x1a')]);}return _0xb3a773[_0x1971('0x52')](_0x1784e1);}})[_0x1971('0x23')](function(_0x5747c2){if(_0x5747c2){return _0x5747c2?{'count':_0x2bafe6,'rows':_0x5747c2}:null;}})['then'](respondWithResult(_0xc18ed0,null))[_0x1971('0x3e')](handleError(_0xc18ed0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7b81260..79f589b 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 _0x667f=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x18f3dc,_0x1289b9){var _0x2a10c5=function(_0x37b935){while(--_0x37b935){_0x18f3dc['push'](_0x18f3dc['shift']());}};_0x2a10c5(++_0x1289b9);}(_0x667f,0x192));var _0xf667=function(_0x32e835,_0x4f2b26){_0x32e835=_0x32e835-0x0;var _0x3cef1b=_0x667f[_0x32e835];return _0x3cef1b;};'use strict';var _=require('lodash');var util=require(_0xf667('0x0'));var logger=require(_0xf667('0x1'))(_0xf667('0x2'));var moment=require('moment');var BPromise=require(_0xf667('0x3'));var rp=require(_0xf667('0x4'));var fs=require('fs');var path=require(_0xf667('0x5'));var rimraf=require('rimraf');var config=require(_0xf667('0x6'));var attributes=require(_0xf667('0x7'));module[_0xf667('0x8')]=function(_0x592201,_0x21c5d1){return _0x592201[_0xf667('0x9')](_0xf667('0xa'),attributes,{'tableName':_0xf667('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6bf=['../../config/logger','api','moment','bluebird','path','./cmCompany.attributes','define','CmCompany','cm_companies','util'];(function(_0x10bf87,_0xabfac1){var _0x4c737e=function(_0x20f937){while(--_0x20f937){_0x10bf87['push'](_0x10bf87['shift']());}};_0x4c737e(++_0xabfac1);}(_0xe6bf,0xef));var _0xfe6b=function(_0xab649b,_0x1519e9){_0xab649b=_0xab649b-0x0;var _0x3b7584=_0xe6bf[_0xab649b];return _0x3b7584;};'use strict';var _=require('lodash');var util=require(_0xfe6b('0x0'));var logger=require(_0xfe6b('0x1'))(_0xfe6b('0x2'));var moment=require(_0xfe6b('0x3'));var BPromise=require(_0xfe6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe6b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe6b('0x6'));module['exports']=function(_0x1147be,_0x1b442f){return _0x1147be[_0xfe6b('0x7')](_0xfe6b('0x8'),attributes,{'tableName':_0xfe6b('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 bc636a8..9dd8f4d 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 _0xc430=['stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc430,0xaf));var _0x0c43=function(_0x278a54,_0x8f113b){_0x278a54=_0x278a54-0x0;var _0x1e8b43=_0xc430[_0x278a54];return _0x1e8b43;};'use strict';var _=require(_0x0c43('0x0'));var util=require(_0x0c43('0x1'));var moment=require('moment');var BPromise=require(_0x0c43('0x2'));var rs=require(_0x0c43('0x3'));var fs=require('fs');var Redis=require(_0x0c43('0x4'));var db=require(_0x0c43('0x5'))['db'];var utils=require(_0x0c43('0x6'));var logger=require(_0x0c43('0x7'))(_0x0c43('0x8'));var config=require(_0x0c43('0x9'));var jayson=require(_0x0c43('0xa'));var client=jayson[_0x0c43('0xb')][_0x0c43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31abbf,_0x3cdb8e,_0x9d71ea){return new BPromise(function(_0x492a9a,_0x59d536){return client[_0x0c43('0xd')](_0x31abbf,_0x9d71ea)[_0x0c43('0xe')](function(_0x4bb719){logger[_0x0c43('0xf')]('CmCompany,\x20%s,\x20%s',_0x3cdb8e,_0x0c43('0x10'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x3cdb8e,_0x0c43('0x10'),JSON[_0x0c43('0x11')](_0x4bb719));if(_0x4bb719[_0x0c43('0x12')]){if(_0x4bb719[_0x0c43('0x12')][_0x0c43('0x13')]===0x1f4){logger[_0x0c43('0x12')]('CmCompany,\x20%s,\x20%s',_0x3cdb8e,_0x4bb719['error'][_0x0c43('0x14')]);return _0x59d536(_0x4bb719[_0x0c43('0x12')][_0x0c43('0x14')]);}logger['error'](_0x0c43('0x15'),_0x3cdb8e,_0x4bb719['error'][_0x0c43('0x14')]);return _0x492a9a(_0x4bb719[_0x0c43('0x12')]['message']);}else{logger[_0x0c43('0xf')](_0x0c43('0x15'),_0x3cdb8e,'request\x20sent');_0x492a9a(_0x4bb719[_0x0c43('0x16')][_0x0c43('0x14')]);}})[_0x0c43('0x17')](function(_0x1c7b86){logger[_0x0c43('0x12')](_0x0c43('0x15'),_0x3cdb8e,_0x1c7b86);_0x59d536(_0x1c7b86);});});} \ No newline at end of file +var _0x43eb=['info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x43eb,0x17b));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb43e('0x0'));var moment=require('moment');var BPromise=require(_0xb43e('0x1'));var rs=require(_0xb43e('0x2'));var fs=require('fs');var Redis=require(_0xb43e('0x3'));var db=require(_0xb43e('0x4'))['db'];var utils=require(_0xb43e('0x5'));var logger=require(_0xb43e('0x6'))('rpc');var config=require(_0xb43e('0x7'));var jayson=require(_0xb43e('0x8'));var client=jayson[_0xb43e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3f34,_0x3bc048,_0x373678){return new BPromise(function(_0x5cbe4e,_0x20ed9b){return client[_0xb43e('0xa')](_0x2f3f34,_0x373678)[_0xb43e('0xb')](function(_0x14a8ba){logger[_0xb43e('0xc')]('CmCompany,\x20%s,\x20%s',_0x3bc048,_0xb43e('0xd'));logger[_0xb43e('0xe')](_0xb43e('0xf'),_0x3bc048,_0xb43e('0xd'),JSON[_0xb43e('0x10')](_0x14a8ba));if(_0x14a8ba[_0xb43e('0x11')]){if(_0x14a8ba[_0xb43e('0x11')][_0xb43e('0x12')]===0x1f4){logger[_0xb43e('0x11')]('CmCompany,\x20%s,\x20%s',_0x3bc048,_0x14a8ba[_0xb43e('0x11')][_0xb43e('0x13')]);return _0x20ed9b(_0x14a8ba[_0xb43e('0x11')][_0xb43e('0x13')]);}logger[_0xb43e('0x11')]('CmCompany,\x20%s,\x20%s',_0x3bc048,_0x14a8ba['error'][_0xb43e('0x13')]);return _0x5cbe4e(_0x14a8ba[_0xb43e('0x11')]['message']);}else{logger[_0xb43e('0xc')](_0xb43e('0x14'),_0x3bc048,_0xb43e('0xd'));_0x5cbe4e(_0x14a8ba[_0xb43e('0x15')][_0xb43e('0x13')]);}})[_0xb43e('0x16')](function(_0x89ff54){logger[_0xb43e('0x11')](_0xb43e('0x14'),_0x3bc048,_0x89ff54);_0x20ed9b(_0x89ff54);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 05676e8..4b0be54 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 _0x2175=['describe','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2175,0xa7));var _0x5217=function(_0x12d533,_0x2f6b8c){_0x12d533=_0x12d533-0x0;var _0x56f21b=_0x2175[_0x12d533];return _0x56f21b;};'use strict';var multer=require(_0x5217('0x0'));var util=require(_0x5217('0x1'));var path=require('path');var timeout=require(_0x5217('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5217('0x3'));var auth=require(_0x5217('0x4'));var interaction=require(_0x5217('0x5'));var config=require(_0x5217('0x6'));var controller=require('./cmCompany.controller');router[_0x5217('0x7')]('/',auth[_0x5217('0x8')](),controller['index']);router[_0x5217('0x7')]('/describe',auth[_0x5217('0x8')](),controller[_0x5217('0x9')]);router[_0x5217('0x7')]('/:id',auth[_0x5217('0x8')](),controller[_0x5217('0xa')]);router['get'](_0x5217('0xb'),auth[_0x5217('0x8')](),controller[_0x5217('0xc')]);router[_0x5217('0xd')]('/',auth[_0x5217('0x8')](),controller[_0x5217('0xe')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x5217('0xf')]);router[_0x5217('0x10')]('/:id',auth[_0x5217('0x8')](),controller[_0x5217('0x11')]);router[_0x5217('0x12')](_0x5217('0x13'),auth['isAuthenticated'](),controller[_0x5217('0x14')]);module[_0x5217('0x15')]=router; \ No newline at end of file +var _0xd3a9=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','index','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy'];(function(_0x103be5,_0xe24819){var _0x306562=function(_0x3fbcdc){while(--_0x3fbcdc){_0x103be5['push'](_0x103be5['shift']());}};_0x306562(++_0xe24819);}(_0xd3a9,0x1e5));var _0x9d3a=function(_0x5373ec,_0x357a81){_0x5373ec=_0x5373ec-0x0;var _0x3af206=_0xd3a9[_0x5373ec];return _0x3af206;};'use strict';var multer=require('multer');var util=require(_0x9d3a('0x0'));var path=require(_0x9d3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d3a('0x2'));var router=express[_0x9d3a('0x3')]();var fs_extra=require(_0x9d3a('0x4'));var auth=require(_0x9d3a('0x5'));var interaction=require(_0x9d3a('0x6'));var config=require('../../config/environment');var controller=require(_0x9d3a('0x7'));router[_0x9d3a('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d3a('0x9')]);router[_0x9d3a('0x8')]('/describe',auth[_0x9d3a('0xa')](),controller[_0x9d3a('0xb')]);router[_0x9d3a('0x8')](_0x9d3a('0xc'),auth[_0x9d3a('0xa')](),controller['show']);router[_0x9d3a('0x8')](_0x9d3a('0xd'),auth['isAuthenticated'](),controller[_0x9d3a('0xe')]);router[_0x9d3a('0xf')]('/',auth[_0x9d3a('0xa')](),controller['create']);router[_0x9d3a('0xf')](_0x9d3a('0xd'),auth['isAuthenticated'](),controller[_0x9d3a('0x10')]);router[_0x9d3a('0x11')]('/:id',auth[_0x9d3a('0xa')](),controller[_0x9d3a('0x12')]);router[_0x9d3a('0x13')](_0x9d3a('0xc'),auth[_0x9d3a('0xa')](),controller[_0x9d3a('0x14')]);module[_0x9d3a('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cb5513a..96aa574 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 _0xe150=['INTEGER','UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe150,0x11b));var _0x0e15=function(_0x18d85e,_0x293097){_0x18d85e=_0x18d85e-0x0;var _0x1f7760=_0xe150[_0x18d85e];return _0x1f7760;};'use strict';var _=require(_0x0e15('0x0'));var Sequelize=require(_0x0e15('0x1'));module[_0x0e15('0x2')]={'firstName':{'type':Sequelize[_0x0e15('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0e15('0x3')]},'street':{'type':Sequelize[_0x0e15('0x3')]},'postalCode':{'type':Sequelize[_0x0e15('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e15('0x4')]},'phone':{'type':Sequelize[_0x0e15('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0e15('0x3')]},'email':{'type':Sequelize[_0x0e15('0x3')]},'url':{'type':Sequelize[_0x0e15('0x3')]},'facebook':{'type':Sequelize[_0x0e15('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0e15('0x3')]},'skype':{'type':Sequelize[_0x0e15('0x3')]},'teams':{'type':Sequelize[_0x0e15('0x3')]},'viber':{'type':Sequelize[_0x0e15('0x3')]},'line':{'type':Sequelize[_0x0e15('0x3')]},'wechat':{'type':Sequelize[_0x0e15('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x0e15('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0e15('0x5')](0x2)[_0x0e15('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x0e15('0x7')]},'dialTimezone':{'type':Sequelize[_0x0e15('0x3')]},'utcOffset':{'type':Sequelize[_0x0e15('0x5')]}}; \ No newline at end of file +var _0xcb0f=['INTEGER','UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT'];(function(_0x4136ea,_0x2d93aa){var _0x281aab=function(_0xbc7772){while(--_0xbc7772){_0x4136ea['push'](_0x4136ea['shift']());}};_0x281aab(++_0x2d93aa);}(_0xcb0f,0x114));var _0xfcb0=function(_0x58fe47,_0x495c0d){_0x58fe47=_0x58fe47-0x0;var _0x3fa0fb=_0xcb0f[_0x58fe47];return _0x3fa0fb;};'use strict';var _=require('lodash');var Sequelize=require(_0xfcb0('0x0'));module[_0xfcb0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfcb0('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfcb0('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfcb0('0x2')]},'description':{'type':Sequelize[_0xfcb0('0x3')]},'phone':{'type':Sequelize[_0xfcb0('0x2')]},'mobile':{'type':Sequelize[_0xfcb0('0x2')]},'fax':{'type':Sequelize[_0xfcb0('0x2')]},'email':{'type':Sequelize[_0xfcb0('0x2')]},'url':{'type':Sequelize[_0xfcb0('0x2')]},'facebook':{'type':Sequelize[_0xfcb0('0x2')]},'fb_data':{'type':Sequelize[_0xfcb0('0x2')]},'twitter':{'type':Sequelize[_0xfcb0('0x2')]},'skype':{'type':Sequelize[_0xfcb0('0x2')]},'teams':{'type':Sequelize[_0xfcb0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xfcb0('0x2')]},'wechat':{'type':Sequelize[_0xfcb0('0x2')]},'telegram':{'type':Sequelize[_0xfcb0('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xfcb0('0x2')]},'priority':{'type':Sequelize[_0xfcb0('0x4')](0x2)[_0xfcb0('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfcb0('0x6')],'defaultValue':Sequelize[_0xfcb0('0x7')]},'dialTimezone':{'type':Sequelize[_0xfcb0('0x2')]},'utcOffset':{'type':Sequelize[_0xfcb0('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 18be428..3331344 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 _0xda27=['find','params','describe','tags','keys','length','startsWith','columnName','displayName','analytics','cf_','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','contact','all','show','Tag','Tags','color','tag','Phones','ItemType','literal','Phones.OrderBy','$and','omit','format','cf_%d','CmCustomField','pickBy','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','phone','getTags','findOne','model','rawAttributes','intersection','fields','attributes','sort','filters','pick','filter','options','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','order','ContactId','includeAll','rows','getHopperHistories','getHopperFinals','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','file','parse','User','agent','binding','No\x20phone\x20column\x20specified','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','createdAt','DESC','findAndCountAll','startCase','chat','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','getOptions','findAll','query','user','catch','CmContact'];(function(_0x3b25e8,_0x548a8f){var _0x4db9fa=function(_0x20cfda){while(--_0x20cfda){_0x3b25e8['push'](_0x3b25e8['shift']());}};_0x4db9fa(++_0x548a8f);}(_0xda27,0x1e8));var _0x7da2=function(_0x4165cc,_0x1b4780){_0x4165cc=_0x4165cc-0x0;var _0x5e3a4c=_0xda27[_0x4165cc];return _0x5e3a4c;};'use strict';var moment=require(_0x7da2('0x0'));var BPromise=require(_0x7da2('0x1'));var util=require(_0x7da2('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x7da2('0x3'));var Papa=require(_0x7da2('0x4'));var Redis=require(_0x7da2('0x5'));var contacts=require(_0x7da2('0x6'));var qs=require(_0x7da2('0x7'));var logger=require('../../config/logger')(_0x7da2('0x8'));var config=require(_0x7da2('0x9'));var shared=require(_0x7da2('0xa'));var db=require(_0x7da2('0xb'))['db'];config[_0x7da2('0xc')]=_[_0x7da2('0xd')](config[_0x7da2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7da2('0xe'))(new Redis(config[_0x7da2('0xc')]));require(_0x7da2('0xf'))[_0x7da2('0x10')](socket);function respondWithResult(_0x49c0b3,_0x158d88){_0x158d88=_0x158d88||0xc8;return function(_0x138afd){if(_0x138afd){return _0x49c0b3[_0x7da2('0x11')](_0x158d88)[_0x7da2('0x12')](_0x138afd);}};}function respondWithFilteredResult(_0x53aa63,_0x3c4eb6){return function(_0x2449ea){if(_0x2449ea){var _0xdb5ea8=typeof _0x3c4eb6[_0x7da2('0x13')]==='undefined'&&typeof _0x3c4eb6[_0x7da2('0x14')]===_0x7da2('0x15');var _0x3fbfdd=_0x2449ea['count'];var _0x4ff261=_0xdb5ea8?0x0:_0x3c4eb6[_0x7da2('0x13')];var _0x8b55d=_0xdb5ea8?_0x2449ea[_0x7da2('0x16')]:_0x3c4eb6[_0x7da2('0x13')]+_0x3c4eb6[_0x7da2('0x14')];var _0x551931;if(_0x8b55d>=_0x3fbfdd){_0x8b55d=_0x3fbfdd;_0x551931=0xc8;}else{_0x551931=0xce;}_0x53aa63[_0x7da2('0x11')](_0x551931);return _0x53aa63[_0x7da2('0x17')](_0x7da2('0x18'),_0x4ff261+'-'+_0x8b55d+'/'+_0x3fbfdd)[_0x7da2('0x12')](_0x2449ea);}return null;};}function saveUpdates(_0x2d2e32){return function(_0x374dc0){if(_0x374dc0){return _0x374dc0[_0x7da2('0x19')](_0x2d2e32)[_0x7da2('0x1a')](function(_0x1ccbc2){return _0x1ccbc2;});}return null;};}function removeEntity(_0x409550){return function(_0x5f0764){if(_0x5f0764){return _0x5f0764[_0x7da2('0x1b')]()[_0x7da2('0x1a')](function(){_0x409550[_0x7da2('0x11')](0xcc)[_0x7da2('0x1c')]();});}};}function handleEntityNotFound(_0x2e9e11){return function(_0x1a03c8){if(!_0x1a03c8){_0x2e9e11[_0x7da2('0x1d')](0x194);}return _0x1a03c8;};}function handleError(_0xf18457,_0x51435e){_0x51435e=_0x51435e||0x1f4;return function(_0x577f33){logger[_0x7da2('0x1e')](_0x577f33['stack']);if(_0x577f33[_0x7da2('0x1f')]){delete _0x577f33['name'];}_0xf18457[_0x7da2('0x11')](_0x51435e)[_0x7da2('0x20')](_0x577f33);};}exports[_0x7da2('0x21')]=function(_0x456d77,_0x136671){var _0xc46f9c={};return contacts['describe']()['then'](function(_0x1e4948){_0xc46f9c=qs[_0x7da2('0x22')](_0x1e4948,_0x456d77);return contacts[_0x7da2('0x23')](_0x456d77[_0x7da2('0x24')],_0x456d77[_0x7da2('0x25')],_0xc46f9c,_0x1e4948);})[_0x7da2('0x1a')](respondWithFilteredResult(_0x136671,_0xc46f9c))[_0x7da2('0x26')](handleError(_0x136671,null));};exports[_0x7da2('0x1b')]=function(_0x5de172,_0x1137b2){return db[_0x7da2('0x27')][_0x7da2('0x28')]({'where':{'id':_0x5de172[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x1137b2,null))[_0x7da2('0x1a')](removeEntity(_0x1137b2,null))[_0x7da2('0x26')](handleError(_0x1137b2,null));};exports['describe']=function(_0x5f46e2,_0x2390dd){return db[_0x7da2('0x27')][_0x7da2('0x2a')]()['then'](function(_0x1a5d35){delete _0x1a5d35[_0x7da2('0x2b')];for(var _0x2bb0a4=0x0;_0x2bb0a40x0){return new Promise(function(_0x4f37a1){var _0x275ee1=[];for(var _0x2dc46e=0x0;_0x2dc46e<_0x3ffb69[_0x7da2('0x2d')];_0x2dc46e++){_0x275ee1[_0x7da2('0x61')](insertAdditionalPhones(_0x3ffb69[_0x2dc46e][_0x7da2('0x64')],_0x3ffb69[_0x2dc46e][_0x7da2('0x5b')]));}Promise[_0x7da2('0x65')](_0x275ee1)[_0x7da2('0x1a')](function(){_0x4f37a1(0x1);});})[_0x7da2('0x1a')](function(){return{'success':_0x506440,'failure':_0x147355,'duplicates':_0x16e9af};});}else{return{'success':_0x506440,'failure':_0x147355,'duplicates':_0x16e9af};}}})['then'](respondWithResult(_0x108961,0xc9))[_0x7da2('0x26')](handleError(_0x108961,null));};exports[_0x7da2('0x66')]=function(_0x59e237,_0x319ce5){var _0x4681e7;return db['CmContact'][_0x7da2('0x2a')]()['then'](function(_0x4e3ea8){return db[_0x7da2('0x27')][_0x7da2('0x28')]({'where':{'id':_0x59e237[_0x7da2('0x29')]['id']},'include':[{'model':db[_0x7da2('0x67')],'as':_0x7da2('0x68'),'attributes':['id',_0x7da2('0x1f'),_0x7da2('0x69')],'required':_0x59e237[_0x7da2('0x24')][_0x7da2('0x6a')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x7da2('0x6b'),'where':{'CmContactId':_0x59e237[_0x7da2('0x29')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x7da2('0x6c')}]}],'order':[db['sequelize'][_0x7da2('0x6d')](_0x7da2('0x6e'))],'attributes':_[_0x7da2('0x2c')](_0x4e3ea8)});})[_0x7da2('0x1a')](function(_0x95e05d){if(!_['isNil'](_0x95e05d)){_0x4681e7=_0x95e05d[_0x7da2('0x3c')]({'plain':!![]});var _0x32caa2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x95e05d&&_0x95e05d[_0x7da2('0x62')]){if(_0x95e05d['ListId']){_0x32caa2[_0x7da2('0x5f')][_0x7da2('0x6f')][_0x7da2('0x61')]({'ListId':{'$ne':_0x95e05d[_0x7da2('0x62')]}});}}return db['CmCustomField']['findAll'](_0x32caa2);}})[_0x7da2('0x1a')](function(_0xb184db){if(!_['isNil'](_0xb184db)){return _[_0x7da2('0x70')](_0x4681e7,_['map'](_0xb184db,function(_0x3cd396){return util[_0x7da2('0x71')](_0x7da2('0x72'),_0x3cd396['id']);}));}})[_0x7da2('0x1a')](handleEntityNotFound(_0x319ce5,null))['then'](respondWithResult(_0x319ce5,null))[_0x7da2('0x26')](handleError(_0x319ce5,null));};exports[_0x7da2('0x19')]=function(_0x317cf3,_0x2e8e9e){var _0x59e064;if(_0x317cf3['body']['id']){delete _0x317cf3[_0x7da2('0x3a')]['id'];}if(!_[_0x7da2('0x58')](_0x317cf3[_0x7da2('0x3a')][_0x7da2('0x57')])){var _0x5e9e8a=_0x317cf3[_0x7da2('0x3a')][_0x7da2('0x57')];if(!_['isNil'](shared[_0x7da2('0x59')][_0x5e9e8a]))_0x317cf3[_0x7da2('0x3a')]['utcOffset']=shared[_0x7da2('0x59')][_0x5e9e8a][_0x7da2('0x5a')];}return db['CmContact'][_0x7da2('0x28')]({'where':{'id':_0x317cf3[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x2e8e9e,null))[_0x7da2('0x1a')](saveUpdates(_0x317cf3[_0x7da2('0x3a')],null))[_0x7da2('0x1a')](function(_0x58a145){_0x59e064=_0x58a145;var _0x250624={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x58a145&&_0x58a145[_0x7da2('0x62')]){if(_0x58a145[_0x7da2('0x62')]){_0x250624[_0x7da2('0x5f')][_0x7da2('0x6f')]['push']({'ListId':{'$ne':_0x58a145[_0x7da2('0x62')]}});}}return db[_0x7da2('0x73')][_0x7da2('0x23')](_0x250624);})[_0x7da2('0x1a')](function(_0x5649fa){if(_0x5649fa){return _[_0x7da2('0x70')](_[_0x7da2('0x74')](_0x317cf3[_0x7da2('0x3a')],function(_0x248f66,_0x5644e9){return _['startsWith'](_0x5644e9,_0x7da2('0x32'));}),_[_0x7da2('0x75')](_0x5649fa,function(_0x5c048f){return util[_0x7da2('0x71')](_0x7da2('0x72'),_0x5c048f['id']);}));}})['then'](function(_0x3ee8cb){if(_0x3ee8cb&&!_[_0x7da2('0x76')](_0x3ee8cb)){var _0x2ce534=squel[_0x7da2('0x19')]()[_0x7da2('0x77')](_0x7da2('0x78'))[_0x7da2('0x79')](_0x3ee8cb)[_0x7da2('0x5f')](_0x7da2('0x7a'),_0x317cf3['params']['id'])['toParam']();return db['sequelize']['query'](_0x2ce534['text'],{'replacements':_0x2ce534[_0x7da2('0x35')]});}})[_0x7da2('0x1a')](function(){if(_0x317cf3[_0x7da2('0x3a')][_0x7da2('0x7b')]&&_0x59e064){return db['CmHopper'][_0x7da2('0x19')]({'phone':_0x317cf3[_0x7da2('0x3a')][_0x7da2('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x59e064['id']}});}})[_0x7da2('0x1a')](function(){return _0x59e064;})[_0x7da2('0x1a')](respondWithResult(_0x2e8e9e,null))['catch'](handleError(_0x2e8e9e,null));};exports[_0x7da2('0x7c')]=function(_0xa59d08,_0x26e8b0){var _0x178f7b={};var _0x27a8d0={};var _0x4bfe34;var _0x3ed813;return db[_0x7da2('0x27')][_0x7da2('0x7d')]({'where':{'id':_0xa59d08[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x26e8b0,null))[_0x7da2('0x1a')](function(_0x14e5c2){if(_0x14e5c2){_0x4bfe34=_0x14e5c2;_0x27a8d0[_0x7da2('0x7e')]=_[_0x7da2('0x2c')](db[_0x7da2('0x67')][_0x7da2('0x7f')]);_0x27a8d0[_0x7da2('0x24')]=_[_0x7da2('0x2c')](_0xa59d08['query']);_0x27a8d0['filters']=_[_0x7da2('0x80')](_0x27a8d0[_0x7da2('0x7e')],_0x27a8d0[_0x7da2('0x24')]);_0x178f7b['attributes']=_[_0x7da2('0x80')](_0x27a8d0[_0x7da2('0x7e')],qs[_0x7da2('0x81')](_0xa59d08['query']['fields']));_0x178f7b[_0x7da2('0x82')]=_0x178f7b['attributes']['length']?_0x178f7b[_0x7da2('0x82')]:_0x27a8d0[_0x7da2('0x7e')];_0x178f7b['order']=qs[_0x7da2('0x83')](_0xa59d08[_0x7da2('0x24')][_0x7da2('0x83')]);_0x178f7b['where']=qs[_0x7da2('0x84')](_[_0x7da2('0x85')](_0xa59d08['query'],_0x27a8d0[_0x7da2('0x84')]));if(_0xa59d08[_0x7da2('0x24')][_0x7da2('0x86')]){_0x178f7b[_0x7da2('0x5f')]=_['merge'](_0x178f7b[_0x7da2('0x5f')],{'$or':_[_0x7da2('0x75')](_0x178f7b['attributes'],function(_0xe62987){var _0x31e493={};_0x31e493[_0xe62987]={'$like':'%'+_0xa59d08[_0x7da2('0x24')]['filter']+'%'};return _0x31e493;})});}_0x178f7b=_[_0x7da2('0x39')]({},_0x178f7b,_0xa59d08[_0x7da2('0x87')]);return _0x4bfe34['getTags'](_0x178f7b);}})[_0x7da2('0x1a')](function(_0x46218c){if(_0x46218c){_0x3ed813=_0x46218c[_0x7da2('0x2d')];if(!_0xa59d08['query'][_0x7da2('0x38')]('nolimit')){_0x178f7b[_0x7da2('0x14')]=qs[_0x7da2('0x14')](_0xa59d08[_0x7da2('0x24')][_0x7da2('0x14')]);_0x178f7b[_0x7da2('0x13')]=qs['offset'](_0xa59d08[_0x7da2('0x24')]['offset']);}return _0x4bfe34['getTags'](_0x178f7b);}})['then'](function(_0x38fa8c){if(_0x38fa8c){return _0x38fa8c?{'count':_0x3ed813,'rows':_0x38fa8c}:null;}})['then'](respondWithResult(_0x26e8b0,null))[_0x7da2('0x26')](handleError(_0x26e8b0,null));};exports[_0x7da2('0x88')]=function(_0x238267,_0x471179){if(_0x238267['body']['id']){delete _0x238267[_0x7da2('0x3a')]['id'];}return db[_0x7da2('0x27')][_0x7da2('0x7d')]({'where':{'id':_0x238267[_0x7da2('0x29')]['id']}})['then'](handleEntityNotFound(_0x471179,null))[_0x7da2('0x1a')](function(_0x1c946d){if(_0x1c946d){return _0x1c946d[_0x7da2('0x88')](_0x238267[_0x7da2('0x3a')][_0x7da2('0x89')]||[]);}return null;})[_0x7da2('0x1a')](respondWithResult(_0x471179,null))[_0x7da2('0x26')](handleError(_0x471179,null));};exports[_0x7da2('0x8a')]=function(_0x1f6368,_0x201a33){var _0x23f74a=[];_0x23f74a[_0x7da2('0x61')](addAdditionalPhones(_0x1f6368[_0x7da2('0x3a')]));Promise[_0x7da2('0x65')](_0x23f74a)[_0x7da2('0x1a')](function(){_0x23f74a=[];_0x23f74a[_0x7da2('0x61')](deleteCmHopperPhones(_0x1f6368[_0x7da2('0x3a')]['id']));_0x23f74a['push'](addCmHopperPhones(_0x1f6368[_0x7da2('0x3a')]['id']));Promise[_0x7da2('0x65')](_0x23f74a)[_0x7da2('0x1a')](function(){return[0x1];})[_0x7da2('0x1a')](respondWithResult(_0x201a33,null));});};function addAdditionalPhones(_0xa015a8){var _0x4dbc74;return new Promise(function(_0x97102d){return db[_0x7da2('0x4b')][_0x7da2('0x1b')]({'where':{'CmContactId':_0xa015a8['id']}})[_0x7da2('0x1a')](function(){db[_0x7da2('0x8b')][_0x7da2('0x23')]({'raw':!![],'attributes':['id',_0x7da2('0x8c')]})[_0x7da2('0x1a')](function(_0x3fa705){var _0x607b36=[];for(var _0x3ebfc0=0x0;_0x3ebfc0<_0xa015a8[_0x7da2('0x8d')][_0x7da2('0x2d')];_0x3ebfc0++){var _0x5961bf=_0xa015a8[_0x7da2('0x8e')]?_['isNil'](_0xa015a8['item_types'][_0x3ebfc0])?'':_0xa015a8[_0x7da2('0x8e')][_0x3ebfc0]:_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0][_0x7da2('0x8f')]?_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0]['ItemTypeId']:'';var _0x2a7d24=_[_0x7da2('0x58')](_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0][_0x7da2('0x90')])?'':_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0]['description'];var _0x25c9b4=_0x5961bf+':'+_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0]['phone']+'§'+_0x2a7d24;if(_['isNil'](_0x4dbc74))_0x4dbc74=_0x25c9b4;else _0x4dbc74+=';'+_0x25c9b4;var _0x3061c4=null;var _0x44f181=null;if(_0xa015a8[_0x7da2('0x8e')]){if(!_[_0x7da2('0x58')](_0xa015a8[_0x7da2('0x8e')][_0x3ebfc0])){_0x44f181=_[_0x7da2('0x28')](_0x3fa705,function(_0x81f2a5){return _0x81f2a5['id']===_0xa015a8[_0x7da2('0x8e')][_0x3ebfc0];});if(!_['isNil'](_0x44f181)){_0x3061c4=_0x44f181[_0x7da2('0x8c')];}}}else{if(!_[_0x7da2('0x58')](_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0])){_0x44f181=_[_0x7da2('0x28')](_0x3fa705,function(_0x37b13f){return _0x37b13f['id']===_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0][_0x7da2('0x8f')];});if(!_['isNil'](_0x44f181)){_0x3061c4=_0x3ebfc0;}}}if(_[_0x7da2('0x58')](_0x3061c4)){_0x3061c4=0x64;}_0x607b36[_0x7da2('0x61')](addAdditionalPhone(_0xa015a8['id'],_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0]['phone'],_0xa015a8[_0x7da2('0x8e')]?_[_0x7da2('0x58')](_0xa015a8[_0x7da2('0x8e')][_0x3ebfc0])?null:_0xa015a8[_0x7da2('0x8e')][_0x3ebfc0]:_0xa015a8[_0x7da2('0x8d')][_0x3ebfc0][_0x7da2('0x8f')]?_0xa015a8['items'][_0x3ebfc0]['ItemTypeId']:null,_0x3061c4,_0x2a7d24));}Promise['all'](_0x607b36)['then'](function(){db[_0x7da2('0x27')][_0x7da2('0x19')]({'AdditionalPhones':_0x4dbc74},{'where':{'id':_0xa015a8['id']}})[_0x7da2('0x1a')](function(){_0x97102d(0x1);});});});});});}function addAdditionalPhone(_0x1c8a68,_0x2b3f6d,_0x1c5017,_0x397638,_0x39b44c){return db[_0x7da2('0x4b')][_0x7da2('0x28')]({'where':{'CmContactId':_0x1c8a68,'item':_0x2b3f6d}})[_0x7da2('0x1a')](function(_0x311898){if(_0x311898)logger[_0x7da2('0x40')](_0x7da2('0x91'),_0x311898);else{db['CmContactHasItem'][_0x7da2('0x56')]({'CmContactId':_0x1c8a68,'item':_0x2b3f6d,'ItemTypeId':_0x1c5017,'OrderBy':_0x397638,'ItemClass':_0x7da2('0x92'),'description':_0x39b44c});}});}function deleteCmHopperPhones(_0x3ba72c){return new Promise(function(_0x13573e){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3ba72c}})['then'](function(_0x3fc7a5){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x7da2('0x75')](_0x3fc7a5,'id')}}});})[_0x7da2('0x1a')](function(){_0x13573e(0x1);});});}function addCmHopperPhones(_0x81d1fe){return new Promise(function(_0x4afa4a){return db[_0x7da2('0x42')][_0x7da2('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x81d1fe}})[_0x7da2('0x1a')](function(_0x313811){var _0x284746=[];_[_0x7da2('0x75')](_0x313811,function(_0x29fa96){_0x284746['push'](createCmHopperPhone(_0x81d1fe,_0x29fa96['id']));});Promise['all'](_0x284746)['then'](function(){_0x4afa4a(0x1);});});});}function createCmHopperPhone(_0x1abc0b,_0x54db98){return new Promise(function(_0x4dd475){db[_0x7da2('0x4b')]['findAll']({'raw':!![],'attributes':[_0x7da2('0x93'),_0x7da2('0x8c')],'where':{'CmContactId':_0x1abc0b,'ItemClass':_0x7da2('0x92')},'include':[{'model':db[_0x7da2('0x8b')],'attributes':[_0x7da2('0x8c')],'as':_0x7da2('0x6c')}],'order':[_0x7da2('0x8c'),db[_0x7da2('0x94')][_0x7da2('0x6d')](_0x7da2('0x95'))]})[_0x7da2('0x1a')](function(_0x10c769){var _0x806b18=0x1;var _0x507270=_[_0x7da2('0x75')](_0x10c769,function(_0x1df89e){_0x1df89e[_0x7da2('0x96')]=_0x54db98;_0x1df89e[_0x7da2('0x7b')]=_0x1df89e['item'];_0x1df89e['OrderBy']=_0x806b18;delete _0x1df89e[_0x7da2('0x97')];_0x806b18=_0x806b18+0x1;return _0x1df89e;});return db[_0x7da2('0x98')]['bulkCreate'](_0x507270,{});})[_0x7da2('0x1a')](function(){_0x4dd475(0x1);});});}function insertAdditionalPhones(_0x150831,_0x417fcd){return new Promise(function(_0x426550){var _0x185ee3=[];for(var _0x1ad945=0x0;_0x1ad945<_0x417fcd['length'];_0x1ad945++){var _0x6ae59d=_0x417fcd[_0x1ad945];_0x185ee3[_0x7da2('0x61')](parseContactItemType(_0x6ae59d));}Promise[_0x7da2('0x65')](_0x185ee3)[_0x7da2('0x1a')](function(){var _0x2ec7e9={'id':_0x150831['id'],'items':_0x417fcd};return addAdditionalPhones(_0x2ec7e9)[_0x7da2('0x1a')](function(){return addCmHopperPhones(_0x150831['id']);});})[_0x7da2('0x1a')](function(){_0x426550(_0x150831);});});}function parseContactItemType(_0x15d8e5){return new Promise(function(_0x34d810){if(_0x15d8e5['hasOwnProperty'](_0x7da2('0x8f'))){_0x34d810(_0x15d8e5);}else{return db[_0x7da2('0x8b')][_0x7da2('0x28')]({'where':{'name':_0x15d8e5[_0x7da2('0x6c')]}})[_0x7da2('0x1a')](function(_0x5333de){if(_[_0x7da2('0x58')](_0x5333de))_0x15d8e5['ItemTypeId']=null;else _0x15d8e5['ItemTypeId']=_0x5333de['id'];_0x34d810(_0x15d8e5);});}});}exports[_0x7da2('0x99')]=function(_0x8bee67,_0x193795){return db[_0x7da2('0x4b')][_0x7da2('0x23')]({'raw':!![],'where':{'CmContactId':_0x8bee67[_0x7da2('0x29')]['id'],'ItemClass':_0x7da2('0x92')},'include':[{'model':db[_0x7da2('0x8b')],'as':_0x7da2('0x6c')}],'order':[[_0x7da2('0x8c')],[db['sequelize'][_0x7da2('0x6d')](_0x7da2('0x95'))]]})['then'](function(_0x5a4e73){return _0x5a4e73;})[_0x7da2('0x1a')](respondWithResult(_0x193795,null))[_0x7da2('0x26')](handleError(_0x193795,null));};exports['duplicateAdditionalPhones']=function(_0x12b855,_0x140817){return db[_0x7da2('0x4b')]['findAll']({'raw':!![],'where':{'CmContactId':_0x12b855[_0x7da2('0x3a')][_0x7da2('0x9a')]}})[_0x7da2('0x1a')](function(_0x772665){var _0x26419a=_[_0x7da2('0x75')](_0x772665,function(_0x498a0d){_0x498a0d[_0x7da2('0x9b')]=_0x12b855[_0x7da2('0x3a')]['toContactId'];return _0x498a0d;});return db[_0x7da2('0x4b')][_0x7da2('0x5c')](_0x26419a,{});})['then'](function(){return addCmHopperPhones(_0x12b855[_0x7da2('0x3a')][_0x7da2('0x9c')]);})[_0x7da2('0x1a')](function(){return['ok'];})[_0x7da2('0x1a')](respondWithResult(_0x140817,null))[_0x7da2('0x26')](handleError(_0x140817,null));};exports[_0x7da2('0x9d')]=function(_0x5f0f9c,_0x47251e){var _0x204267=[];_0x204267['push'](createCmHopperPhone(_0x5f0f9c[_0x7da2('0x3a')]['id'],_0x5f0f9c[_0x7da2('0x3a')]['hopperId']));Promise[_0x7da2('0x65')](_0x204267)[_0x7da2('0x1a')](function(){return[0x1];})[_0x7da2('0x1a')](respondWithResult(_0x47251e,null));};exports[_0x7da2('0x9e')]=function(_0x494233,_0x474d4a){var _0x590e1e={'raw':![],'where':{}};var _0x2b94a5={};var _0x15e2d4={'count':0x0,'rows':[]};return db['CmContact'][_0x7da2('0x7d')]({'where':{'id':_0x494233[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x474d4a,null))[_0x7da2('0x1a')](function(_0x3db156){if(_0x3db156){_0x2b94a5[_0x7da2('0x7e')]=_[_0x7da2('0x2c')](db[_0x7da2('0x42')][_0x7da2('0x7f')]);_0x2b94a5['query']=_['keys'](_0x494233['query']);_0x2b94a5[_0x7da2('0x84')]=_['intersection'](_0x2b94a5[_0x7da2('0x7e')],_0x2b94a5['query']);_0x590e1e['attributes']=_['intersection'](_0x2b94a5[_0x7da2('0x7e')],qs[_0x7da2('0x81')](_0x494233[_0x7da2('0x24')][_0x7da2('0x81')]));_0x590e1e[_0x7da2('0x82')]=_0x590e1e['attributes'][_0x7da2('0x2d')]?_0x590e1e[_0x7da2('0x82')]:_0x2b94a5[_0x7da2('0x7e')];if(!_0x494233['query'][_0x7da2('0x38')](_0x7da2('0x9f'))){_0x590e1e[_0x7da2('0x14')]=qs[_0x7da2('0x14')](_0x494233[_0x7da2('0x24')]['limit']);_0x590e1e[_0x7da2('0x13')]=qs[_0x7da2('0x13')](_0x494233['query'][_0x7da2('0x13')]);}_0x590e1e[_0x7da2('0xa0')]=qs[_0x7da2('0x83')](_0x494233['query'][_0x7da2('0x83')]);_0x590e1e[_0x7da2('0x5f')]=qs[_0x7da2('0x84')](_[_0x7da2('0x85')](_0x494233[_0x7da2('0x24')],_0x2b94a5[_0x7da2('0x84')]));_0x590e1e['where'][_0x7da2('0xa1')]=_0x3db156['id'];if(_0x494233['query'][_0x7da2('0x86')]){_0x590e1e[_0x7da2('0x5f')]=_[_0x7da2('0x39')](_0x590e1e[_0x7da2('0x5f')],{'$or':_[_0x7da2('0x75')](_0x590e1e[_0x7da2('0x82')],function(_0x5f257a){var _0x1a6147={};_0x1a6147[_0x5f257a]={'$like':'%'+_0x494233[_0x7da2('0x24')]['filter']+'%'};return _0x1a6147;})});}_0x590e1e=_[_0x7da2('0x39')]({},_0x590e1e,_0x494233[_0x7da2('0x87')]);return db[_0x7da2('0x42')]['count']({'where':_0x590e1e['where']})['then'](function(_0xaa083f){_0x15e2d4[_0x7da2('0x16')]=_0xaa083f;if(_0x494233['query'][_0x7da2('0xa2')]){_0x590e1e['include']=[{'all':!![]}];}return db[_0x7da2('0x42')][_0x7da2('0x23')](_0x590e1e);})[_0x7da2('0x1a')](function(_0x400039){_0x15e2d4[_0x7da2('0xa3')]=_0x400039;return _0x15e2d4;});}})[_0x7da2('0x1a')](respondWithFilteredResult(_0x474d4a,_0x590e1e))[_0x7da2('0x26')](handleError(_0x474d4a,null));};exports[_0x7da2('0xa4')]=function(_0x1d7692,_0x25a7f4){var _0x440b12={'raw':!![],'where':{}};var _0x42ba7e={};var _0x3a10d7={'count':0x0,'rows':[]};return db['CmContact'][_0x7da2('0x7d')]({'where':{'id':_0x1d7692[_0x7da2('0x29')]['id']}})['then'](handleEntityNotFound(_0x25a7f4,null))[_0x7da2('0x1a')](function(_0x1e0a34){if(_0x1e0a34){_0x42ba7e[_0x7da2('0x7e')]=_[_0x7da2('0x2c')](db[_0x7da2('0x4d')][_0x7da2('0x7f')]);_0x42ba7e[_0x7da2('0x24')]=_[_0x7da2('0x2c')](_0x1d7692[_0x7da2('0x24')]);_0x42ba7e['filters']=_[_0x7da2('0x80')](_0x42ba7e[_0x7da2('0x7e')],_0x42ba7e[_0x7da2('0x24')]);_0x440b12[_0x7da2('0x82')]=_[_0x7da2('0x80')](_0x42ba7e[_0x7da2('0x7e')],qs[_0x7da2('0x81')](_0x1d7692[_0x7da2('0x24')][_0x7da2('0x81')]));_0x440b12[_0x7da2('0x82')]=_0x440b12[_0x7da2('0x82')][_0x7da2('0x2d')]?_0x440b12[_0x7da2('0x82')]:_0x42ba7e[_0x7da2('0x7e')];if(!_0x1d7692[_0x7da2('0x24')]['hasOwnProperty'](_0x7da2('0x9f'))){_0x440b12[_0x7da2('0x14')]=qs[_0x7da2('0x14')](_0x1d7692[_0x7da2('0x24')][_0x7da2('0x14')]);_0x440b12[_0x7da2('0x13')]=qs[_0x7da2('0x13')](_0x1d7692['query'][_0x7da2('0x13')]);}_0x440b12['order']=qs[_0x7da2('0x83')](_0x1d7692['query'][_0x7da2('0x83')]);_0x440b12[_0x7da2('0x5f')]=qs[_0x7da2('0x84')](_[_0x7da2('0x85')](_0x1d7692[_0x7da2('0x24')],_0x42ba7e[_0x7da2('0x84')]));_0x440b12['where'][_0x7da2('0xa1')]=_0x1e0a34['id'];if(_0x1d7692[_0x7da2('0x24')][_0x7da2('0x86')]){_0x440b12['where']=_['merge'](_0x440b12[_0x7da2('0x5f')],{'$or':_[_0x7da2('0x75')](_0x440b12[_0x7da2('0x82')],function(_0x4ba000){var _0x3bc765={};_0x3bc765[_0x4ba000]={'$like':'%'+_0x1d7692['query'][_0x7da2('0x86')]+'%'};return _0x3bc765;})});}_0x440b12=_[_0x7da2('0x39')]({},_0x440b12,_0x1d7692[_0x7da2('0x87')]);return db[_0x7da2('0x4d')][_0x7da2('0x16')]({'where':_0x440b12['where']})[_0x7da2('0x1a')](function(_0x268e2f){_0x3a10d7[_0x7da2('0x16')]=_0x268e2f;if(_0x1d7692[_0x7da2('0x24')]['includeAll']){_0x440b12['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x7da2('0x23')](_0x440b12);})[_0x7da2('0x1a')](function(_0x219b37){_0x3a10d7[_0x7da2('0xa3')]=_0x219b37;return _0x3a10d7;});}})['then'](respondWithFilteredResult(_0x25a7f4,_0x440b12))['catch'](handleError(_0x25a7f4,null));};exports[_0x7da2('0xa5')]=function(_0x486a5c,_0x1c3979){var _0x55470f={'raw':!![],'where':{}};var _0xcafec8={};var _0xb1e800={'count':0x0,'rows':[]};return db[_0x7da2('0x27')][_0x7da2('0x7d')]({'where':{'id':_0x486a5c[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x1c3979,null))['then'](function(_0x273af7){if(_0x273af7){_0xcafec8[_0x7da2('0x7e')]=_['keys'](db[_0x7da2('0x4c')]['rawAttributes']);_0xcafec8[_0x7da2('0x24')]=_['keys'](_0x486a5c['query']);_0xcafec8[_0x7da2('0x84')]=_[_0x7da2('0x80')](_0xcafec8[_0x7da2('0x7e')],_0xcafec8['query']);_0x55470f[_0x7da2('0x82')]=_[_0x7da2('0x80')](_0xcafec8['model'],qs[_0x7da2('0x81')](_0x486a5c[_0x7da2('0x24')][_0x7da2('0x81')]));_0x55470f[_0x7da2('0x82')]=_0x55470f[_0x7da2('0x82')]['length']?_0x55470f[_0x7da2('0x82')]:_0xcafec8['model'];if(!_0x486a5c['query']['hasOwnProperty'](_0x7da2('0x9f'))){_0x55470f[_0x7da2('0x14')]=qs[_0x7da2('0x14')](_0x486a5c[_0x7da2('0x24')][_0x7da2('0x14')]);_0x55470f[_0x7da2('0x13')]=qs[_0x7da2('0x13')](_0x486a5c[_0x7da2('0x24')][_0x7da2('0x13')]);}_0x55470f[_0x7da2('0xa0')]=qs[_0x7da2('0x83')](_0x486a5c[_0x7da2('0x24')][_0x7da2('0x83')]);_0x55470f[_0x7da2('0x5f')]=qs[_0x7da2('0x84')](_['pick'](_0x486a5c[_0x7da2('0x24')],_0xcafec8[_0x7da2('0x84')]));_0x55470f[_0x7da2('0x5f')]['ContactId']=_0x273af7['id'];if(_0x486a5c[_0x7da2('0x24')]['filter']){_0x55470f[_0x7da2('0x5f')]=_[_0x7da2('0x39')](_0x55470f['where'],{'$or':_[_0x7da2('0x75')](_0x55470f['attributes'],function(_0x520f6d){var _0x4ff4f9={};_0x4ff4f9[_0x520f6d]={'$like':'%'+_0x486a5c[_0x7da2('0x24')][_0x7da2('0x86')]+'%'};return _0x4ff4f9;})});}_0x55470f=_[_0x7da2('0x39')]({},_0x55470f,_0x486a5c['options']);return db[_0x7da2('0x4c')]['count']({'where':_0x55470f[_0x7da2('0x5f')]})[_0x7da2('0x1a')](function(_0x12813e){_0xb1e800[_0x7da2('0x16')]=_0x12813e;if(_0x486a5c[_0x7da2('0x24')][_0x7da2('0xa2')]){_0x55470f[_0x7da2('0xa6')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x55470f);})[_0x7da2('0x1a')](function(_0x4fe045){_0xb1e800['rows']=_0x4fe045;return _0xb1e800;});}})[_0x7da2('0x1a')](respondWithFilteredResult(_0x1c3979,_0x55470f))['catch'](handleError(_0x1c3979,null));};exports[_0x7da2('0xa7')]=function(_0x36e6f7,_0x1fa933){var _0x4ae8bc={'raw':!![],'where':{}};var _0x4af936={};var _0x2ed587={'count':0x0,'rows':[]};return db[_0x7da2('0x27')]['findOne']({'where':{'id':_0x36e6f7[_0x7da2('0x29')]['id']}})[_0x7da2('0x1a')](handleEntityNotFound(_0x1fa933,null))['then'](function(_0x2897fd){if(_0x2897fd){_0x4af936['model']=_[_0x7da2('0x2c')](db['JscriptySessionReport'][_0x7da2('0x7f')]);_0x4af936[_0x7da2('0x24')]=_['keys'](_0x36e6f7[_0x7da2('0x24')]);_0x4af936[_0x7da2('0x84')]=_[_0x7da2('0x80')](_0x4af936[_0x7da2('0x7e')],_0x4af936[_0x7da2('0x24')]);_0x4ae8bc['attributes']=_[_0x7da2('0x80')](_0x4af936[_0x7da2('0x7e')],qs[_0x7da2('0x81')](_0x36e6f7[_0x7da2('0x24')][_0x7da2('0x81')]));_0x4ae8bc[_0x7da2('0x82')]=_0x4ae8bc[_0x7da2('0x82')]['length']?_0x4ae8bc['attributes']:_0x4af936[_0x7da2('0x7e')];if(!_0x36e6f7[_0x7da2('0x24')][_0x7da2('0x38')](_0x7da2('0x9f'))){_0x4ae8bc[_0x7da2('0x14')]=qs[_0x7da2('0x14')](_0x36e6f7[_0x7da2('0x24')][_0x7da2('0x14')]);_0x4ae8bc[_0x7da2('0x13')]=qs[_0x7da2('0x13')](_0x36e6f7[_0x7da2('0x24')]['offset']);}_0x4ae8bc[_0x7da2('0xa0')]=qs['sort'](_0x36e6f7['query']['sort']);_0x4ae8bc[_0x7da2('0x5f')]=qs[_0x7da2('0x84')](_['pick'](_0x36e6f7[_0x7da2('0x24')],_0x4af936[_0x7da2('0x84')]));_0x4ae8bc['where'][_0x7da2('0xa1')]=_0x2897fd['id'];if(_0x36e6f7[_0x7da2('0x24')][_0x7da2('0x86')]){_0x4ae8bc[_0x7da2('0x5f')]=_['merge'](_0x4ae8bc[_0x7da2('0x5f')],{'$or':_[_0x7da2('0x75')](_0x4ae8bc[_0x7da2('0x82')],function(_0x13f59f){var _0x1a7ac4={};_0x1a7ac4[_0x13f59f]={'$like':'%'+_0x36e6f7[_0x7da2('0x24')][_0x7da2('0x86')]+'%'};return _0x1a7ac4;})});}_0x4ae8bc=_[_0x7da2('0x39')]({},_0x4ae8bc,_0x36e6f7[_0x7da2('0x87')]);return db[_0x7da2('0x54')][_0x7da2('0x16')]({'where':_0x4ae8bc['where']})[_0x7da2('0x1a')](function(_0x4c387d){_0x2ed587[_0x7da2('0x16')]=_0x4c387d;if(_0x36e6f7[_0x7da2('0x24')][_0x7da2('0xa2')]){_0x4ae8bc['include']=[{'all':!![]}];}return db[_0x7da2('0x54')]['findAll'](_0x4ae8bc);})[_0x7da2('0x1a')](function(_0x4a03ef){_0x2ed587[_0x7da2('0xa3')]=_0x4a03ef;return _0x2ed587;});}})[_0x7da2('0x1a')](respondWithFilteredResult(_0x1fa933,_0x4ae8bc))[_0x7da2('0x26')](handleError(_0x1fa933,null));};exports[_0x7da2('0xa8')]=function(_0x260fb4,_0x3398f3){try{if(!_0x260fb4[_0x7da2('0x3a')][_0x7da2('0x62')]){throw new Error(_0x7da2('0xa9'));}if(!_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xaa')]){throw new Error(_0x7da2('0xab'));}if(!_0x260fb4['body'][_0x7da2('0xac')]){throw new Error(_0x7da2('0xad'));}if(!_0x260fb4[_0x7da2('0x3a')]['socket_timestamp']){throw new Error(_0x7da2('0xae'));}var _0x34b504=_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xaa')][_0x7da2('0xaf')](',');var _0x25d9d9=_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xac')][_0x7da2('0xaf')](',');if(!_0x34b504[_0x7da2('0x2d')]||!_0x25d9d9['length']||_0x34b504[_0x7da2('0x2d')]!==_0x25d9d9[_0x7da2('0x2d')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x260fb4[_0x7da2('0x3a')][_0x7da2('0x81')]=_[_0x7da2('0xb0')](_0x34b504,_0x25d9d9);if(!_0x260fb4[_0x7da2('0x3a')]['fields']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x260fb4['body'][_0x7da2('0x81')][_0x7da2('0xb1')]){throw new Error(_0x7da2('0xb2'));}var _0x12778=path[_0x7da2('0x3f')](config[_0x7da2('0xb3')],_0x7da2('0xb4'),_0x260fb4['file'][_0x7da2('0xb5')]);fs['chmodSync'](_0x12778,parseInt(_0x7da2('0xb6'),0x8));var _0x2d037d=require(_0x7da2('0xb7'))[_0x7da2('0xb8')](path[_0x7da2('0x3f')](__dirname,_0x7da2('0xb9')),[_0x12778,_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xaa')],_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xac')],_0x260fb4[_0x7da2('0x3a')]['ListId'],_0x260fb4[_0x7da2('0x3a')][_0x7da2('0xba')],_0x260fb4[_0x7da2('0x3a')][_0x7da2('0x5e')],_0x260fb4[_0x7da2('0x3a')]['socket_timestamp']]);return _0x3398f3[_0x7da2('0x11')](0xc8)[_0x7da2('0x12')]({'message':'File\x20uploaded\x20correctly!','pid':_0x2d037d[_0x7da2('0xbb')]});}catch(_0x13a7de){return _0x3398f3[_0x7da2('0x11')](0x1f4)[_0x7da2('0x20')](_0x13a7de);}};exports[_0x7da2('0xbc')]=function(_0x1fe39b,_0x26f975){var _0x5d5895=fs[_0x7da2('0xbd')](_0x1fe39b[_0x7da2('0xbe')]['path']);Papa[_0x7da2('0xbf')](_0x5d5895,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1f4b1b){return _0x26f975[_0x7da2('0x11')](0xc8)[_0x7da2('0x12')]({'file':_0x1fe39b[_0x7da2('0xbe')],'fields':_0x1f4b1b['meta'][_0x7da2('0x81')]});}});};exports['import']=function(_0x20fb95,_0x11fa7c){return db[_0x7da2('0xc0')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x7da2('0xc1')}})[_0x7da2('0x1a')](function(_0x59429c){var _0xc9f9b5=![];if(!_0x20fb95[_0x7da2('0x3a')][_0x7da2('0x62')]){throw new Error(_0x7da2('0xa9'));}if(!_0x20fb95[_0x7da2('0x3a')][_0x7da2('0xc2')][_0x7da2('0x7b')]){throw new Error(_0x7da2('0xc3'));}if(!_0x20fb95[_0x7da2('0x3a')][_0x7da2('0xc2')][_0x7da2('0xb1')]){throw new Error(_0x7da2('0xb2'));}if(!_0x20fb95[_0x7da2('0x3a')][_0x7da2('0xc4')]){throw new Error(_0x7da2('0xae'));}var _0x1bfee3=require(_0x7da2('0xb7'))[_0x7da2('0xb8')](path[_0x7da2('0x3f')](__dirname,_0x7da2('0xc5')),[_0x20fb95[_0x7da2('0x29')]['id'],JSON[_0x7da2('0xc6')](_0x20fb95[_0x7da2('0x3a')]),JSON[_0x7da2('0xc6')](_0x59429c)]);_0x1bfee3['on'](_0x7da2('0xc7'),function(){_0xc9f9b5=!![];return _0x11fa7c['status'](0xc8)['json']({'message':_0x7da2('0xc8'),'pid':_0x1bfee3[_0x7da2('0xbb')]});});_0x1bfee3['on'](_0x7da2('0xc9'),function(_0x3c35d7){if(_0x3c35d7&&!_0xc9f9b5){return _0x11fa7c[_0x7da2('0x11')](0x1f4)['json']({'message':_0x7da2('0xca'),'pid':_0x1bfee3[_0x7da2('0xbb')]});}});})[_0x7da2('0x26')](handleError(_0x11fa7c,null));};exports[_0x7da2('0xcb')]=function(_0xf405a4,_0xd07318){return db[_0x7da2('0xc0')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x7da2('0x1a')](function(_0x3d31e3){var _0x38678e=![];if(!_0xf405a4[_0x7da2('0x3a')][_0x7da2('0x62')]){throw new Error(_0x7da2('0xa9'));}if(!_0xf405a4['body'][_0x7da2('0xc2')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xf405a4[_0x7da2('0x3a')][_0x7da2('0xc2')][_0x7da2('0xb1')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xf405a4[_0x7da2('0x3a')][_0x7da2('0xc4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x36badc=require(_0x7da2('0xb7'))['fork'](path[_0x7da2('0x3f')](__dirname,'../../components/import/cm/csvUpdates'),[_0xf405a4['params']['id'],JSON[_0x7da2('0xc6')](_0xf405a4[_0x7da2('0x3a')]),JSON[_0x7da2('0xc6')](_0x3d31e3)]);_0x36badc['on'](_0x7da2('0xc7'),function(){_0x38678e=!![];return _0xd07318[_0x7da2('0x11')](0xc8)[_0x7da2('0x12')]({'message':_0x7da2('0xc8'),'pid':_0x36badc[_0x7da2('0xbb')]});});_0x36badc['on'](_0x7da2('0xc9'),function(_0x29d182){if(_0x29d182&&!_0x38678e){return _0xd07318[_0x7da2('0x11')](0x1f4)[_0x7da2('0x12')]({'message':_0x7da2('0xca'),'pid':_0x36badc[_0x7da2('0xbb')]});}});})[_0x7da2('0x26')](handleError(_0xd07318,null));};exports[_0x7da2('0xcc')]=function(_0x2f578f,_0x4a36aa){var _0x1d5b87=[_0x7da2('0xcd'),'chat','sms','openchannel',_0x7da2('0xce'),_0x7da2('0xcf'),_0x7da2('0xd0')];var _0x1b11c1={'offset':0x0,'order':qs['sort'](_0x7da2('0xd1'))},_0x19ff3d={'count':0x0,'rows':[]};Promise[_0x7da2('0xd2')]()[_0x7da2('0x1a')](function(){if(_0x2f578f['query'][_0x7da2('0xd3')]){if(!_[_0x7da2('0xd4')](_0x1d5b87,_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd3')][_0x7da2('0xd5')]())){throw new Error(_0x7da2('0xd6'));}_0x1d5b87=[_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd3')]['toLowerCase']()];}if(_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd7')]){try{var _0x5bf0bd=JSON[_0x7da2('0xbf')](_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd7')]);if(!moment(_0x5bf0bd['from'])['isValid']()){throw new Error(_0x7da2('0xd8'));}if(!moment(_0x5bf0bd['to'])[_0x7da2('0xd9')]()){throw new Error(_0x7da2('0xda'));}}catch(_0x27829b){throw new Error(_0x7da2('0xdb'));}}if(!_0x2f578f[_0x7da2('0x24')][_0x7da2('0x38')](_0x7da2('0x9f'))){_0x1b11c1[_0x7da2('0x14')]=qs['limit'](_0x2f578f[_0x7da2('0x24')][_0x7da2('0x14')]||0xa);_0x1b11c1[_0x7da2('0x13')]=qs[_0x7da2('0x13')](_0x2f578f[_0x7da2('0x24')][_0x7da2('0x13')]);}var _0x1572e6=_0x1d5b87[_0x7da2('0x75')](function(_0x41f6ce){if(_0x41f6ce===_0x7da2('0xd0')){var _0x233353={'attributes':['id',_0x7da2('0xdc'),_0x7da2('0x34'),'source',_0x7da2('0xdd'),_0x7da2('0xde'),_0x7da2('0xdf'),_0x7da2('0xe0'),_0x7da2('0xe1'),_0x7da2('0xe2'),'createdAt',_0x7da2('0xe3'),_0x7da2('0xe4'),_0x7da2('0xe5'),_0x7da2('0xe6')],'where':{'ContactId':_0x2f578f[_0x7da2('0x29')]['id']},'include':[{'model':db[_0x7da2('0xc0')],'as':_0x7da2('0xc0'),'attributes':['id',_0x7da2('0x1f'),_0x7da2('0xe7'),_0x7da2('0xe8')]}],'order':[[_0x7da2('0xe9'),_0x7da2('0xea')]]};if(_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd7')]){_0x233353[_0x7da2('0x5f')]['createdAt']={'$gte':_0x5bf0bd['from'],'$lte':_0x5bf0bd['to']};}return db['VoiceCallReport'][_0x7da2('0xeb')](_0x233353)[_0x7da2('0x1a')](function(_0x31219f){_0x19ff3d[_0x7da2('0x16')]+=_0x31219f[_0x7da2('0x16')];return _['map'](_0x31219f[_0x7da2('0xa3')],function(_0x444771){var _0x31c18d=_0x444771[_0x7da2('0x3c')]({'plain':!![]});_0x31c18d[_0x7da2('0xd3')]=_0x41f6ce;if(_0x31c18d[_0x7da2('0xc0')]){_0x31c18d[_0x7da2('0xc0')]={'id':_0x31c18d[_0x7da2('0xc0')]['id'],'name':_0x31c18d[_0x7da2('0xc0')]['name'],'fullname':_0x31c18d[_0x7da2('0xc0')][_0x7da2('0xe7')],'alias':_0x31c18d[_0x7da2('0xc0')][_0x7da2('0xe8')]};}return _0x31c18d;});});}else{var _0x2a14f0=_[_0x7da2('0xec')](_0x41f6ce)+(_0x41f6ce===_0x7da2('0xed')?_0x7da2('0xee'):_0x7da2('0xef'));var _0x50d33a={'attributes':['id','closed',_0x7da2('0xf0'),_0x7da2('0xe9'),_0x7da2('0xe2'),_0x7da2('0xf1'),_0x7da2('0xf2'),_0x7da2('0xf3'),'UserId',_0x2a14f0+'Id'],'where':{'ContactId':_0x2f578f[_0x7da2('0x29')]['id']},'include':[{'model':db[_0x2a14f0],'as':_0x7da2('0xef'),'attributes':['id','name',_0x7da2('0xf4')]},{'model':db[_0x7da2('0xc0')],'as':_0x7da2('0xf5'),'attributes':['id',_0x7da2('0x1f'),_0x7da2('0xe7')]},{'model':db[_0x7da2('0x67')],'as':'Tags','attributes':['id',_0x7da2('0x1f'),_0x7da2('0x69')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x2f578f[_0x7da2('0x24')][_0x7da2('0xd7')]){_0x50d33a[_0x7da2('0x5f')][_0x7da2('0xe9')]={'$gte':_0x5bf0bd['from'],'$lte':_0x5bf0bd['to']};}switch(_0x41f6ce){case _0x7da2('0xed'):_0x50d33a['attributes'][_0x7da2('0x61')](_0x7da2('0xf6'),_0x7da2('0xf7'),_0x7da2('0xf8'),_0x7da2('0xf9'),_0x7da2('0xfa'),_0x7da2('0xfb'),'ratingType',_0x7da2('0xfc'),_0x7da2('0xfd'));break;case _0x7da2('0xcd'):_0x50d33a[_0x7da2('0x82')][_0x7da2('0x61')](_0x7da2('0xfe'),_0x7da2('0xff'));break;case _0x7da2('0x100'):_0x50d33a[_0x7da2('0x82')]['push']('externalUrl',_0x7da2('0x101'));break;}return db[_[_0x7da2('0xec')](_0x41f6ce)+_0x7da2('0x102')][_0x7da2('0xeb')](_0x50d33a)['then'](function(_0x12f736){_0x19ff3d[_0x7da2('0x16')]+=_0x12f736[_0x7da2('0x16')];return _[_0x7da2('0x75')](_0x12f736[_0x7da2('0xa3')],function(_0x1482af){var _0x2c9458=_0x1482af[_0x7da2('0x3c')]({'plain':!![]});_0x2c9458[_0x7da2('0xd3')]=_0x41f6ce;if(_0x2c9458['Owner']){_0x2c9458[_0x7da2('0xf5')]={'id':_0x2c9458[_0x7da2('0xf5')]['id'],'name':_0x2c9458['Owner'][_0x7da2('0x1f')],'fullname':_0x2c9458['Owner']['fullname']};}return _0x2c9458;});});}});return Promise[_0x7da2('0x65')](_0x1572e6);})['then'](function(_0x439acb){return _(_0x439acb)[_0x7da2('0x103')]()[_0x7da2('0x104')](_0x7da2('0xe9'))[_0x7da2('0x105')]()[_0x7da2('0x106')]();})[_0x7da2('0x1a')](function(_0x22bf2c){_0x19ff3d[_0x7da2('0xa3')]=_0x1b11c1[_0x7da2('0x14')]?_0x22bf2c[_0x7da2('0x107')](_0x1b11c1['offset'],_0x1b11c1['offset']+_0x1b11c1[_0x7da2('0x14')]):_0x22bf2c;return _0x19ff3d;})[_0x7da2('0x1a')](respondWithFilteredResult(_0x4a36aa,_0x1b11c1))[_0x7da2('0x26')](handleError(_0x4a36aa,null));}; \ No newline at end of file +var _0x1b36=['pid','send','parse','meta','import','User','agent','binding','stringify','message','exit','error\x20child\x20process','importUpdates','child_process','start\x20child\x20process\x20correctly!','getJourney','mail','sms','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userSecondDisposition','userThirdDisposition','UserId','DESC','get','fullname','startCase','chat','Website','Account','closed','closedAt','note','disposition','thirdDisposition','Owner','Tags','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','sortBy','reverse','moment','bluebird','util','path','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','offset','limit','undefined','count','status','set','Content-Range','json','update','then','end','sendStatus','error','stack','name','index','describe','getOptions','query','user','destroy','CmContact','find','params','catch','keys','length','cf_','columnName','displayName','analytics','findAll','alias','custom','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','hasOwnProperty','show','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','cf_%d','pickBy','startsWith','format','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','CmHopper','getTags','findOne','model','Tag','rawAttributes','filters','intersection','attributes','order','sort','pick','filter','merge','options','nolimit','setTags','all','OrderBy','item_types','items','ItemTypeId','description','info','PHONE','item','ItemType','`ItemType`.OrderBy','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','fields','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','fork','../../components/import/cm/csv','CompanyId'];(function(_0x456c19,_0x50aadb){var _0x28d587=function(_0x343246){while(--_0x343246){_0x456c19['push'](_0x456c19['shift']());}};_0x28d587(++_0x50aadb);}(_0x1b36,0x140));var _0x61b3=function(_0x4a7cb9,_0x4e0fa2){_0x4a7cb9=_0x4a7cb9-0x0;var _0x4cde3b=_0x1b36[_0x4a7cb9];return _0x4cde3b;};'use strict';var moment=require(_0x61b3('0x0'));var BPromise=require(_0x61b3('0x1'));var util=require(_0x61b3('0x2'));var path=require(_0x61b3('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0x61b3('0x4'));var Redis=require(_0x61b3('0x5'));var contacts=require(_0x61b3('0x6'));var qs=require(_0x61b3('0x7'));var logger=require('../../config/logger')(_0x61b3('0x8'));var config=require(_0x61b3('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_[_0x61b3('0xa')](config[_0x61b3('0xb')],{'host':_0x61b3('0xc'),'port':0x18eb});var socket=require(_0x61b3('0xd'))(new Redis(config[_0x61b3('0xb')]));require(_0x61b3('0xe'))[_0x61b3('0xf')](socket);function respondWithResult(_0x3d831a,_0x45a110){_0x45a110=_0x45a110||0xc8;return function(_0x29b9cb){if(_0x29b9cb){return _0x3d831a['status'](_0x45a110)['json'](_0x29b9cb);}};}function respondWithFilteredResult(_0x43d364,_0x38a4bf){return function(_0x14f21e){if(_0x14f21e){var _0x569880=typeof _0x38a4bf[_0x61b3('0x10')]==='undefined'&&typeof _0x38a4bf[_0x61b3('0x11')]===_0x61b3('0x12');var _0x3290c9=_0x14f21e[_0x61b3('0x13')];var _0x3758b3=_0x569880?0x0:_0x38a4bf[_0x61b3('0x10')];var _0xe00b16=_0x569880?_0x14f21e[_0x61b3('0x13')]:_0x38a4bf[_0x61b3('0x10')]+_0x38a4bf[_0x61b3('0x11')];var _0x2491ad;if(_0xe00b16>=_0x3290c9){_0xe00b16=_0x3290c9;_0x2491ad=0xc8;}else{_0x2491ad=0xce;}_0x43d364[_0x61b3('0x14')](_0x2491ad);return _0x43d364[_0x61b3('0x15')](_0x61b3('0x16'),_0x3758b3+'-'+_0xe00b16+'/'+_0x3290c9)[_0x61b3('0x17')](_0x14f21e);}return null;};}function saveUpdates(_0x3a2c78){return function(_0x67e09e){if(_0x67e09e){return _0x67e09e[_0x61b3('0x18')](_0x3a2c78)[_0x61b3('0x19')](function(_0x22e021){return _0x22e021;});}return null;};}function removeEntity(_0x18119f){return function(_0x237251){if(_0x237251){return _0x237251['destroy']()[_0x61b3('0x19')](function(){_0x18119f[_0x61b3('0x14')](0xcc)[_0x61b3('0x1a')]();});}};}function handleEntityNotFound(_0x5ecc93){return function(_0x538216){if(!_0x538216){_0x5ecc93[_0x61b3('0x1b')](0x194);}return _0x538216;};}function handleError(_0x2a347b,_0x3d972c){_0x3d972c=_0x3d972c||0x1f4;return function(_0x44a477){logger[_0x61b3('0x1c')](_0x44a477[_0x61b3('0x1d')]);if(_0x44a477[_0x61b3('0x1e')]){delete _0x44a477['name'];}_0x2a347b[_0x61b3('0x14')](_0x3d972c)['send'](_0x44a477);};}exports[_0x61b3('0x1f')]=function(_0xa7ca6e,_0x239a0d){var _0x43d5e0={};return contacts[_0x61b3('0x20')]()[_0x61b3('0x19')](function(_0x41f28c){_0x43d5e0=qs[_0x61b3('0x21')](_0x41f28c,_0xa7ca6e);return contacts['findAll'](_0xa7ca6e[_0x61b3('0x22')],_0xa7ca6e[_0x61b3('0x23')],_0x43d5e0,_0x41f28c);})[_0x61b3('0x19')](respondWithFilteredResult(_0x239a0d,_0x43d5e0))['catch'](handleError(_0x239a0d,null));};exports[_0x61b3('0x24')]=function(_0x135f4a,_0x230989){return db[_0x61b3('0x25')][_0x61b3('0x26')]({'where':{'id':_0x135f4a[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x230989,null))[_0x61b3('0x19')](removeEntity(_0x230989,null))[_0x61b3('0x28')](handleError(_0x230989,null));};exports[_0x61b3('0x20')]=function(_0x3ef284,_0x49f963){return db[_0x61b3('0x25')][_0x61b3('0x20')]()[_0x61b3('0x19')](function(_0x524cd3){delete _0x524cd3['tags'];for(var _0x2cb5c4=0x0;_0x2cb5c40x0){return new Promise(function(_0x5ddb2a){var _0x2f9eea=[];for(var _0xa5992b=0x0;_0xa5992b<_0x3cddb2['length'];_0xa5992b++){_0x2f9eea['push'](insertAdditionalPhones(_0x3cddb2[_0xa5992b]['contact'],_0x3cddb2[_0xa5992b]['additionalPhones']));}Promise['all'](_0x2f9eea)[_0x61b3('0x19')](function(){_0x5ddb2a(0x1);});})[_0x61b3('0x19')](function(){return{'success':_0x9acdfa,'failure':_0x476dc7,'duplicates':_0x5244d4};});}else{return{'success':_0x9acdfa,'failure':_0x476dc7,'duplicates':_0x5244d4};}}})[_0x61b3('0x19')](respondWithResult(_0x48b968,0xc9))[_0x61b3('0x28')](handleError(_0x48b968,null));};exports[_0x61b3('0x61')]=function(_0x2e09ca,_0x3c70a2){var _0x8fd503;return db['CmContact']['describe']()[_0x61b3('0x19')](function(_0x5a7a7a){return db[_0x61b3('0x25')]['find']({'where':{'id':_0x2e09ca[_0x61b3('0x27')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x61b3('0x1e'),'color'],'required':_0x2e09ca[_0x61b3('0x22')]['tag']?!![]:![]},{'model':db[_0x61b3('0x48')],'as':_0x61b3('0x62'),'where':{'CmContactId':_0x2e09ca[_0x61b3('0x27')]['id']},'required':![],'include':[{'model':db[_0x61b3('0x63')],'as':'ItemType'}]}],'order':[db[_0x61b3('0x64')][_0x61b3('0x65')](_0x61b3('0x66'))],'attributes':_['keys'](_0x5a7a7a)});})[_0x61b3('0x19')](function(_0x3bb684){if(!_[_0x61b3('0x53')](_0x3bb684)){_0x8fd503=_0x3bb684['get']({'plain':!![]});var _0x1d99cd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3bb684&&_0x3bb684[_0x61b3('0x5d')]){if(_0x3bb684[_0x61b3('0x5d')]){_0x1d99cd['where'][_0x61b3('0x67')][_0x61b3('0x5c')]({'ListId':{'$ne':_0x3bb684[_0x61b3('0x5d')]}});}}return db[_0x61b3('0x68')][_0x61b3('0x2f')](_0x1d99cd);}})[_0x61b3('0x19')](function(_0x2c993c){if(!_[_0x61b3('0x53')](_0x2c993c)){return _[_0x61b3('0x69')](_0x8fd503,_[_0x61b3('0x6a')](_0x2c993c,function(_0x7e06d8){return util['format'](_0x61b3('0x6b'),_0x7e06d8['id']);}));}})[_0x61b3('0x19')](handleEntityNotFound(_0x3c70a2,null))[_0x61b3('0x19')](respondWithResult(_0x3c70a2,null))[_0x61b3('0x28')](handleError(_0x3c70a2,null));};exports['update']=function(_0x465025,_0x411878){var _0x597b00;if(_0x465025[_0x61b3('0x35')]['id']){delete _0x465025[_0x61b3('0x35')]['id'];}if(!_[_0x61b3('0x53')](_0x465025[_0x61b3('0x35')][_0x61b3('0x54')])){var _0x317508=_0x465025[_0x61b3('0x35')][_0x61b3('0x54')];if(!_[_0x61b3('0x53')](shared[_0x61b3('0x55')][_0x317508]))_0x465025[_0x61b3('0x35')][_0x61b3('0x56')]=shared[_0x61b3('0x55')][_0x317508][_0x61b3('0x56')];}return db[_0x61b3('0x25')]['find']({'where':{'id':_0x465025[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x411878,null))[_0x61b3('0x19')](saveUpdates(_0x465025['body'],null))['then'](function(_0x3a1d02){_0x597b00=_0x3a1d02;var _0x4443db={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3a1d02&&_0x3a1d02['ListId']){if(_0x3a1d02['ListId']){_0x4443db[_0x61b3('0x5b')]['$and'][_0x61b3('0x5c')]({'ListId':{'$ne':_0x3a1d02[_0x61b3('0x5d')]}});}}return db[_0x61b3('0x68')]['findAll'](_0x4443db);})[_0x61b3('0x19')](function(_0x5c5ed2){if(_0x5c5ed2){return _[_0x61b3('0x69')](_[_0x61b3('0x6c')](_0x465025[_0x61b3('0x35')],function(_0x1accdd,_0x1519ed){return _[_0x61b3('0x6d')](_0x1519ed,_0x61b3('0x2b'));}),_[_0x61b3('0x6a')](_0x5c5ed2,function(_0x4c0f2a){return util[_0x61b3('0x6e')]('cf_%d',_0x4c0f2a['id']);}));}})[_0x61b3('0x19')](function(_0xa003a1){if(_0xa003a1&&!_['isEmpty'](_0xa003a1)){var _0x2d015d=squel['update']()['table'](_0x61b3('0x6f'))[_0x61b3('0x70')](_0xa003a1)['where'](_0x61b3('0x71'),_0x465025[_0x61b3('0x27')]['id'])[_0x61b3('0x72')]();return db['sequelize'][_0x61b3('0x22')](_0x2d015d[_0x61b3('0x73')],{'replacements':_0x2d015d[_0x61b3('0x74')]});}})['then'](function(){if(_0x465025[_0x61b3('0x35')][_0x61b3('0x75')]&&_0x597b00){return db[_0x61b3('0x76')][_0x61b3('0x18')]({'phone':_0x465025[_0x61b3('0x35')][_0x61b3('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x597b00['id']}});}})[_0x61b3('0x19')](function(){return _0x597b00;})[_0x61b3('0x19')](respondWithResult(_0x411878,null))[_0x61b3('0x28')](handleError(_0x411878,null));};exports[_0x61b3('0x77')]=function(_0x5c8e31,_0x4b27de){var _0x5b483a={};var _0x1ef112={};var _0x12bb75;var _0x350f90;return db[_0x61b3('0x25')][_0x61b3('0x78')]({'where':{'id':_0x5c8e31[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x4b27de,null))[_0x61b3('0x19')](function(_0x36b76b){if(_0x36b76b){_0x12bb75=_0x36b76b;_0x1ef112[_0x61b3('0x79')]=_[_0x61b3('0x29')](db[_0x61b3('0x7a')][_0x61b3('0x7b')]);_0x1ef112['query']=_['keys'](_0x5c8e31[_0x61b3('0x22')]);_0x1ef112[_0x61b3('0x7c')]=_[_0x61b3('0x7d')](_0x1ef112[_0x61b3('0x79')],_0x1ef112[_0x61b3('0x22')]);_0x5b483a[_0x61b3('0x7e')]=_['intersection'](_0x1ef112[_0x61b3('0x79')],qs['fields'](_0x5c8e31[_0x61b3('0x22')]['fields']));_0x5b483a[_0x61b3('0x7e')]=_0x5b483a[_0x61b3('0x7e')][_0x61b3('0x2a')]?_0x5b483a['attributes']:_0x1ef112[_0x61b3('0x79')];_0x5b483a[_0x61b3('0x7f')]=qs['sort'](_0x5c8e31['query'][_0x61b3('0x80')]);_0x5b483a['where']=qs[_0x61b3('0x7c')](_[_0x61b3('0x81')](_0x5c8e31[_0x61b3('0x22')],_0x1ef112['filters']));if(_0x5c8e31[_0x61b3('0x22')]['filter']){_0x5b483a[_0x61b3('0x5b')]=_['merge'](_0x5b483a[_0x61b3('0x5b')],{'$or':_[_0x61b3('0x6a')](_0x5b483a['attributes'],function(_0x1c4106){var _0x159796={};_0x159796[_0x1c4106]={'$like':'%'+_0x5c8e31[_0x61b3('0x22')][_0x61b3('0x82')]+'%'};return _0x159796;})});}_0x5b483a=_[_0x61b3('0x83')]({},_0x5b483a,_0x5c8e31[_0x61b3('0x84')]);return _0x12bb75[_0x61b3('0x77')](_0x5b483a);}})[_0x61b3('0x19')](function(_0x2aa386){if(_0x2aa386){_0x350f90=_0x2aa386[_0x61b3('0x2a')];if(!_0x5c8e31[_0x61b3('0x22')][_0x61b3('0x60')](_0x61b3('0x85'))){_0x5b483a[_0x61b3('0x11')]=qs['limit'](_0x5c8e31[_0x61b3('0x22')][_0x61b3('0x11')]);_0x5b483a[_0x61b3('0x10')]=qs['offset'](_0x5c8e31[_0x61b3('0x22')][_0x61b3('0x10')]);}return _0x12bb75[_0x61b3('0x77')](_0x5b483a);}})['then'](function(_0x565047){if(_0x565047){return _0x565047?{'count':_0x350f90,'rows':_0x565047}:null;}})[_0x61b3('0x19')](respondWithResult(_0x4b27de,null))['catch'](handleError(_0x4b27de,null));};exports[_0x61b3('0x86')]=function(_0x2c2e38,_0x291896){if(_0x2c2e38[_0x61b3('0x35')]['id']){delete _0x2c2e38[_0x61b3('0x35')]['id'];}return db[_0x61b3('0x25')]['findOne']({'where':{'id':_0x2c2e38[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x291896,null))[_0x61b3('0x19')](function(_0x2de59e){if(_0x2de59e){return _0x2de59e[_0x61b3('0x86')](_0x2c2e38[_0x61b3('0x35')]['ids']||[]);}return null;})[_0x61b3('0x19')](respondWithResult(_0x291896,null))['catch'](handleError(_0x291896,null));};exports['setAdditionalPhones']=function(_0x5d43bf,_0x2b69d4){var _0x2a5c01=[];_0x2a5c01[_0x61b3('0x5c')](addAdditionalPhones(_0x5d43bf['body']));Promise[_0x61b3('0x87')](_0x2a5c01)[_0x61b3('0x19')](function(){_0x2a5c01=[];_0x2a5c01[_0x61b3('0x5c')](deleteCmHopperPhones(_0x5d43bf[_0x61b3('0x35')]['id']));_0x2a5c01[_0x61b3('0x5c')](addCmHopperPhones(_0x5d43bf[_0x61b3('0x35')]['id']));Promise[_0x61b3('0x87')](_0x2a5c01)[_0x61b3('0x19')](function(){return[0x1];})[_0x61b3('0x19')](respondWithResult(_0x2b69d4,null));});};function addAdditionalPhones(_0x2bf3c3){var _0x37cf3c;return new Promise(function(_0xb09aff){return db[_0x61b3('0x48')]['destroy']({'where':{'CmContactId':_0x2bf3c3['id']}})[_0x61b3('0x19')](function(){db['ContactItemType'][_0x61b3('0x2f')]({'raw':!![],'attributes':['id',_0x61b3('0x88')]})[_0x61b3('0x19')](function(_0x37e576){var _0x57d745=[];for(var _0x1bb91d=0x0;_0x1bb91d<_0x2bf3c3['items'][_0x61b3('0x2a')];_0x1bb91d++){var _0x4f5b49=_0x2bf3c3[_0x61b3('0x89')]?_[_0x61b3('0x53')](_0x2bf3c3[_0x61b3('0x89')][_0x1bb91d])?'':_0x2bf3c3[_0x61b3('0x89')][_0x1bb91d]:_0x2bf3c3['items'][_0x1bb91d]['ItemTypeId']?_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d][_0x61b3('0x8b')]:'';var _0x1fee26=_[_0x61b3('0x53')](_0x2bf3c3['items'][_0x1bb91d][_0x61b3('0x8c')])?'':_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d][_0x61b3('0x8c')];var _0x1985bd=_0x4f5b49+':'+_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d][_0x61b3('0x75')]+'§'+_0x1fee26;if(_[_0x61b3('0x53')](_0x37cf3c))_0x37cf3c=_0x1985bd;else _0x37cf3c+=';'+_0x1985bd;var _0x122c49=null;var _0x4d472a=null;if(_0x2bf3c3[_0x61b3('0x89')]){if(!_[_0x61b3('0x53')](_0x2bf3c3[_0x61b3('0x89')][_0x1bb91d])){_0x4d472a=_[_0x61b3('0x26')](_0x37e576,function(_0x1c676c){return _0x1c676c['id']===_0x2bf3c3['item_types'][_0x1bb91d];});if(!_[_0x61b3('0x53')](_0x4d472a)){_0x122c49=_0x4d472a[_0x61b3('0x88')];}}}else{if(!_[_0x61b3('0x53')](_0x2bf3c3['items'][_0x1bb91d])){_0x4d472a=_[_0x61b3('0x26')](_0x37e576,function(_0x44ea2f){return _0x44ea2f['id']===_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d]['ItemTypeId'];});if(!_[_0x61b3('0x53')](_0x4d472a)){_0x122c49=_0x1bb91d;}}}if(_[_0x61b3('0x53')](_0x122c49)){_0x122c49=0x64;}_0x57d745['push'](addAdditionalPhone(_0x2bf3c3['id'],_0x2bf3c3['items'][_0x1bb91d][_0x61b3('0x75')],_0x2bf3c3['item_types']?_['isNil'](_0x2bf3c3[_0x61b3('0x89')][_0x1bb91d])?null:_0x2bf3c3[_0x61b3('0x89')][_0x1bb91d]:_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d][_0x61b3('0x8b')]?_0x2bf3c3[_0x61b3('0x8a')][_0x1bb91d]['ItemTypeId']:null,_0x122c49,_0x1fee26));}Promise[_0x61b3('0x87')](_0x57d745)[_0x61b3('0x19')](function(){db[_0x61b3('0x25')]['update']({'AdditionalPhones':_0x37cf3c},{'where':{'id':_0x2bf3c3['id']}})[_0x61b3('0x19')](function(){_0xb09aff(0x1);});});});});});}function addAdditionalPhone(_0x551577,_0x2d67e5,_0xe296a2,_0x4345c3,_0x43dd2f){return db['CmContactHasItem'][_0x61b3('0x26')]({'where':{'CmContactId':_0x551577,'item':_0x2d67e5}})[_0x61b3('0x19')](function(_0x567bd6){if(_0x567bd6)logger[_0x61b3('0x8d')]('contact\x20phone\x20exists',_0x567bd6);else{db[_0x61b3('0x48')][_0x61b3('0x3e')]({'CmContactId':_0x551577,'item':_0x2d67e5,'ItemTypeId':_0xe296a2,'OrderBy':_0x4345c3,'ItemClass':_0x61b3('0x8e'),'description':_0x43dd2f});}});}function deleteCmHopperPhones(_0x1b9be7){return new Promise(function(_0x395bd2){return db[_0x61b3('0x76')][_0x61b3('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b9be7}})[_0x61b3('0x19')](function(_0xc8c993){db['CmHopperAdditionalPhone'][_0x61b3('0x24')]({'where':{'CmHopperId':{'$in':_['map'](_0xc8c993,'id')}}});})[_0x61b3('0x19')](function(){_0x395bd2(0x1);});});}function addCmHopperPhones(_0x205495){return new Promise(function(_0x5e3208){return db[_0x61b3('0x76')][_0x61b3('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x205495}})['then'](function(_0x5ba31e){var _0x12d151=[];_[_0x61b3('0x6a')](_0x5ba31e,function(_0x35a3e9){_0x12d151[_0x61b3('0x5c')](createCmHopperPhone(_0x205495,_0x35a3e9['id']));});Promise['all'](_0x12d151)[_0x61b3('0x19')](function(){_0x5e3208(0x1);});});});}function createCmHopperPhone(_0x2f9e4a,_0x423350){return new Promise(function(_0x50809b){db['CmContactHasItem'][_0x61b3('0x2f')]({'raw':!![],'attributes':[_0x61b3('0x8f'),_0x61b3('0x88')],'where':{'CmContactId':_0x2f9e4a,'ItemClass':_0x61b3('0x8e')},'include':[{'model':db[_0x61b3('0x63')],'attributes':['OrderBy'],'as':_0x61b3('0x90')}],'order':[_0x61b3('0x88'),db[_0x61b3('0x64')][_0x61b3('0x65')](_0x61b3('0x91'))]})[_0x61b3('0x19')](function(_0x4c2bf7){var _0x266d85=0x1;var _0x1cd075=_[_0x61b3('0x6a')](_0x4c2bf7,function(_0x3e73c2){_0x3e73c2['CmHopperId']=_0x423350;_0x3e73c2[_0x61b3('0x75')]=_0x3e73c2[_0x61b3('0x8f')];_0x3e73c2['OrderBy']=_0x266d85;delete _0x3e73c2[_0x61b3('0x92')];_0x266d85=_0x266d85+0x1;return _0x3e73c2;});return db[_0x61b3('0x93')][_0x61b3('0x58')](_0x1cd075,{});})['then'](function(){_0x50809b(0x1);});});}function insertAdditionalPhones(_0x163648,_0x20d064){return new Promise(function(_0x55f748){var _0x11b10d=[];for(var _0x416f92=0x0;_0x416f92<_0x20d064[_0x61b3('0x2a')];_0x416f92++){var _0x100961=_0x20d064[_0x416f92];_0x11b10d[_0x61b3('0x5c')](parseContactItemType(_0x100961));}Promise[_0x61b3('0x87')](_0x11b10d)[_0x61b3('0x19')](function(){var _0x3a789d={'id':_0x163648['id'],'items':_0x20d064};return addAdditionalPhones(_0x3a789d)[_0x61b3('0x19')](function(){return addCmHopperPhones(_0x163648['id']);});})[_0x61b3('0x19')](function(){_0x55f748(_0x163648);});});}function parseContactItemType(_0x42d97f){return new Promise(function(_0x54aae5){if(_0x42d97f[_0x61b3('0x60')]('ItemTypeId')){_0x54aae5(_0x42d97f);}else{return db[_0x61b3('0x63')][_0x61b3('0x26')]({'where':{'name':_0x42d97f[_0x61b3('0x90')]}})[_0x61b3('0x19')](function(_0x1f1c55){if(_['isNil'](_0x1f1c55))_0x42d97f[_0x61b3('0x8b')]=null;else _0x42d97f[_0x61b3('0x8b')]=_0x1f1c55['id'];_0x54aae5(_0x42d97f);});}});}exports[_0x61b3('0x94')]=function(_0x3539e9,_0xbf636b){return db[_0x61b3('0x48')][_0x61b3('0x2f')]({'raw':!![],'where':{'CmContactId':_0x3539e9[_0x61b3('0x27')]['id'],'ItemClass':_0x61b3('0x8e')},'include':[{'model':db[_0x61b3('0x63')],'as':_0x61b3('0x90')}],'order':[[_0x61b3('0x88')],[db[_0x61b3('0x64')][_0x61b3('0x65')](_0x61b3('0x91'))]]})[_0x61b3('0x19')](function(_0x368f17){return _0x368f17;})['then'](respondWithResult(_0xbf636b,null))[_0x61b3('0x28')](handleError(_0xbf636b,null));};exports[_0x61b3('0x95')]=function(_0xe1599e,_0x5e0d8c){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0xe1599e[_0x61b3('0x35')][_0x61b3('0x96')]}})['then'](function(_0x37d396){var _0x162808=_['map'](_0x37d396,function(_0x3a98e9){_0x3a98e9[_0x61b3('0x97')]=_0xe1599e[_0x61b3('0x35')][_0x61b3('0x98')];return _0x3a98e9;});return db['CmContactHasItem']['bulkCreate'](_0x162808,{});})[_0x61b3('0x19')](function(){return addCmHopperPhones(_0xe1599e['body'][_0x61b3('0x98')]);})[_0x61b3('0x19')](function(){return['ok'];})[_0x61b3('0x19')](respondWithResult(_0x5e0d8c,null))['catch'](handleError(_0x5e0d8c,null));};exports['rescheduleAdditionalPhones']=function(_0x1929dd,_0x4490fe){var _0x25f162=[];_0x25f162[_0x61b3('0x5c')](createCmHopperPhone(_0x1929dd[_0x61b3('0x35')]['id'],_0x1929dd['body'][_0x61b3('0x99')]));Promise[_0x61b3('0x87')](_0x25f162)[_0x61b3('0x19')](function(){return[0x1];})[_0x61b3('0x19')](respondWithResult(_0x4490fe,null));};exports['getHoppers']=function(_0x5c07b4,_0x17e4c7){var _0x22ea4c={'raw':![],'where':{}};var _0x15962f={};var _0x2a3e3a={'count':0x0,'rows':[]};return db[_0x61b3('0x25')]['findOne']({'where':{'id':_0x5c07b4[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x17e4c7,null))[_0x61b3('0x19')](function(_0x2ac402){if(_0x2ac402){_0x15962f[_0x61b3('0x79')]=_[_0x61b3('0x29')](db['CmHopper'][_0x61b3('0x7b')]);_0x15962f[_0x61b3('0x22')]=_[_0x61b3('0x29')](_0x5c07b4[_0x61b3('0x22')]);_0x15962f['filters']=_['intersection'](_0x15962f[_0x61b3('0x79')],_0x15962f[_0x61b3('0x22')]);_0x22ea4c[_0x61b3('0x7e')]=_[_0x61b3('0x7d')](_0x15962f[_0x61b3('0x79')],qs[_0x61b3('0x9a')](_0x5c07b4[_0x61b3('0x22')]['fields']));_0x22ea4c[_0x61b3('0x7e')]=_0x22ea4c[_0x61b3('0x7e')]['length']?_0x22ea4c[_0x61b3('0x7e')]:_0x15962f['model'];if(!_0x5c07b4[_0x61b3('0x22')]['hasOwnProperty'](_0x61b3('0x85'))){_0x22ea4c['limit']=qs[_0x61b3('0x11')](_0x5c07b4[_0x61b3('0x22')][_0x61b3('0x11')]);_0x22ea4c[_0x61b3('0x10')]=qs[_0x61b3('0x10')](_0x5c07b4[_0x61b3('0x22')][_0x61b3('0x10')]);}_0x22ea4c[_0x61b3('0x7f')]=qs[_0x61b3('0x80')](_0x5c07b4[_0x61b3('0x22')][_0x61b3('0x80')]);_0x22ea4c['where']=qs['filters'](_[_0x61b3('0x81')](_0x5c07b4['query'],_0x15962f[_0x61b3('0x7c')]));_0x22ea4c[_0x61b3('0x5b')][_0x61b3('0x9b')]=_0x2ac402['id'];if(_0x5c07b4[_0x61b3('0x22')]['filter']){_0x22ea4c[_0x61b3('0x5b')]=_[_0x61b3('0x83')](_0x22ea4c['where'],{'$or':_[_0x61b3('0x6a')](_0x22ea4c[_0x61b3('0x7e')],function(_0x5e480c){var _0x3b6694={};_0x3b6694[_0x5e480c]={'$like':'%'+_0x5c07b4[_0x61b3('0x22')][_0x61b3('0x82')]+'%'};return _0x3b6694;})});}_0x22ea4c=_[_0x61b3('0x83')]({},_0x22ea4c,_0x5c07b4[_0x61b3('0x84')]);return db[_0x61b3('0x76')][_0x61b3('0x13')]({'where':_0x22ea4c[_0x61b3('0x5b')]})[_0x61b3('0x19')](function(_0x5712ed){_0x2a3e3a[_0x61b3('0x13')]=_0x5712ed;if(_0x5c07b4[_0x61b3('0x22')][_0x61b3('0x9c')]){_0x22ea4c[_0x61b3('0x9d')]=[{'all':!![]}];}return db[_0x61b3('0x76')][_0x61b3('0x2f')](_0x22ea4c);})[_0x61b3('0x19')](function(_0x42d194){_0x2a3e3a[_0x61b3('0x9e')]=_0x42d194;return _0x2a3e3a;});}})[_0x61b3('0x19')](respondWithFilteredResult(_0x17e4c7,_0x22ea4c))[_0x61b3('0x28')](handleError(_0x17e4c7,null));};exports[_0x61b3('0x9f')]=function(_0x8996ae,_0x2d4a81){var _0xa060ed={'raw':!![],'where':{}};var _0x30c7a4={};var _0xe438e={'count':0x0,'rows':[]};return db['CmContact'][_0x61b3('0x78')]({'where':{'id':_0x8996ae[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x2d4a81,null))[_0x61b3('0x19')](function(_0xda30a){if(_0xda30a){_0x30c7a4[_0x61b3('0x79')]=_['keys'](db[_0x61b3('0x4a')][_0x61b3('0x7b')]);_0x30c7a4['query']=_[_0x61b3('0x29')](_0x8996ae['query']);_0x30c7a4['filters']=_[_0x61b3('0x7d')](_0x30c7a4[_0x61b3('0x79')],_0x30c7a4['query']);_0xa060ed[_0x61b3('0x7e')]=_[_0x61b3('0x7d')](_0x30c7a4[_0x61b3('0x79')],qs[_0x61b3('0x9a')](_0x8996ae[_0x61b3('0x22')][_0x61b3('0x9a')]));_0xa060ed[_0x61b3('0x7e')]=_0xa060ed[_0x61b3('0x7e')]['length']?_0xa060ed[_0x61b3('0x7e')]:_0x30c7a4[_0x61b3('0x79')];if(!_0x8996ae[_0x61b3('0x22')][_0x61b3('0x60')](_0x61b3('0x85'))){_0xa060ed[_0x61b3('0x11')]=qs[_0x61b3('0x11')](_0x8996ae[_0x61b3('0x22')][_0x61b3('0x11')]);_0xa060ed[_0x61b3('0x10')]=qs['offset'](_0x8996ae[_0x61b3('0x22')][_0x61b3('0x10')]);}_0xa060ed['order']=qs[_0x61b3('0x80')](_0x8996ae[_0x61b3('0x22')]['sort']);_0xa060ed[_0x61b3('0x5b')]=qs[_0x61b3('0x7c')](_[_0x61b3('0x81')](_0x8996ae[_0x61b3('0x22')],_0x30c7a4['filters']));_0xa060ed[_0x61b3('0x5b')]['ContactId']=_0xda30a['id'];if(_0x8996ae[_0x61b3('0x22')][_0x61b3('0x82')]){_0xa060ed[_0x61b3('0x5b')]=_['merge'](_0xa060ed[_0x61b3('0x5b')],{'$or':_['map'](_0xa060ed[_0x61b3('0x7e')],function(_0x4cc7ad){var _0x262104={};_0x262104[_0x4cc7ad]={'$like':'%'+_0x8996ae[_0x61b3('0x22')][_0x61b3('0x82')]+'%'};return _0x262104;})});}_0xa060ed=_[_0x61b3('0x83')]({},_0xa060ed,_0x8996ae[_0x61b3('0x84')]);return db[_0x61b3('0x4a')]['count']({'where':_0xa060ed[_0x61b3('0x5b')]})[_0x61b3('0x19')](function(_0x322763){_0xe438e['count']=_0x322763;if(_0x8996ae[_0x61b3('0x22')][_0x61b3('0x9c')]){_0xa060ed[_0x61b3('0x9d')]=[{'all':!![]}];}return db[_0x61b3('0x4a')]['findAll'](_0xa060ed);})['then'](function(_0x32fef3){_0xe438e[_0x61b3('0x9e')]=_0x32fef3;return _0xe438e;});}})[_0x61b3('0x19')](respondWithFilteredResult(_0x2d4a81,_0xa060ed))['catch'](handleError(_0x2d4a81,null));};exports[_0x61b3('0xa0')]=function(_0x2674ee,_0x2c5ca3){var _0x49f0c8={'raw':!![],'where':{}};var _0x1e2bce={};var _0x2c336d={'count':0x0,'rows':[]};return db[_0x61b3('0x25')][_0x61b3('0x78')]({'where':{'id':_0x2674ee[_0x61b3('0x27')]['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x2c5ca3,null))[_0x61b3('0x19')](function(_0x332c9c){if(_0x332c9c){_0x1e2bce['model']=_[_0x61b3('0x29')](db[_0x61b3('0x49')]['rawAttributes']);_0x1e2bce['query']=_[_0x61b3('0x29')](_0x2674ee[_0x61b3('0x22')]);_0x1e2bce['filters']=_[_0x61b3('0x7d')](_0x1e2bce[_0x61b3('0x79')],_0x1e2bce[_0x61b3('0x22')]);_0x49f0c8[_0x61b3('0x7e')]=_[_0x61b3('0x7d')](_0x1e2bce[_0x61b3('0x79')],qs[_0x61b3('0x9a')](_0x2674ee[_0x61b3('0x22')][_0x61b3('0x9a')]));_0x49f0c8[_0x61b3('0x7e')]=_0x49f0c8['attributes'][_0x61b3('0x2a')]?_0x49f0c8[_0x61b3('0x7e')]:_0x1e2bce['model'];if(!_0x2674ee[_0x61b3('0x22')][_0x61b3('0x60')]('nolimit')){_0x49f0c8[_0x61b3('0x11')]=qs[_0x61b3('0x11')](_0x2674ee['query']['limit']);_0x49f0c8[_0x61b3('0x10')]=qs['offset'](_0x2674ee[_0x61b3('0x22')]['offset']);}_0x49f0c8[_0x61b3('0x7f')]=qs[_0x61b3('0x80')](_0x2674ee['query']['sort']);_0x49f0c8[_0x61b3('0x5b')]=qs[_0x61b3('0x7c')](_['pick'](_0x2674ee[_0x61b3('0x22')],_0x1e2bce[_0x61b3('0x7c')]));_0x49f0c8[_0x61b3('0x5b')][_0x61b3('0x9b')]=_0x332c9c['id'];if(_0x2674ee['query'][_0x61b3('0x82')]){_0x49f0c8[_0x61b3('0x5b')]=_['merge'](_0x49f0c8['where'],{'$or':_[_0x61b3('0x6a')](_0x49f0c8['attributes'],function(_0xf63379){var _0x426e69={};_0x426e69[_0xf63379]={'$like':'%'+_0x2674ee[_0x61b3('0x22')][_0x61b3('0x82')]+'%'};return _0x426e69;})});}_0x49f0c8=_[_0x61b3('0x83')]({},_0x49f0c8,_0x2674ee['options']);return db[_0x61b3('0x49')][_0x61b3('0x13')]({'where':_0x49f0c8[_0x61b3('0x5b')]})['then'](function(_0x8f460e){_0x2c336d[_0x61b3('0x13')]=_0x8f460e;if(_0x2674ee[_0x61b3('0x22')]['includeAll']){_0x49f0c8[_0x61b3('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x61b3('0x2f')](_0x49f0c8);})[_0x61b3('0x19')](function(_0x191740){_0x2c336d[_0x61b3('0x9e')]=_0x191740;return _0x2c336d;});}})[_0x61b3('0x19')](respondWithFilteredResult(_0x2c5ca3,_0x49f0c8))['catch'](handleError(_0x2c5ca3,null));};exports[_0x61b3('0xa1')]=function(_0x38208c,_0x13652a){var _0x47481e={'raw':!![],'where':{}};var _0x425a9e={};var _0x5d1d99={'count':0x0,'rows':[]};return db[_0x61b3('0x25')][_0x61b3('0x78')]({'where':{'id':_0x38208c['params']['id']}})[_0x61b3('0x19')](handleEntityNotFound(_0x13652a,null))['then'](function(_0x4f1b00){if(_0x4f1b00){_0x425a9e[_0x61b3('0x79')]=_['keys'](db[_0x61b3('0x4f')][_0x61b3('0x7b')]);_0x425a9e[_0x61b3('0x22')]=_[_0x61b3('0x29')](_0x38208c['query']);_0x425a9e[_0x61b3('0x7c')]=_['intersection'](_0x425a9e[_0x61b3('0x79')],_0x425a9e[_0x61b3('0x22')]);_0x47481e[_0x61b3('0x7e')]=_[_0x61b3('0x7d')](_0x425a9e[_0x61b3('0x79')],qs['fields'](_0x38208c[_0x61b3('0x22')]['fields']));_0x47481e['attributes']=_0x47481e['attributes'][_0x61b3('0x2a')]?_0x47481e[_0x61b3('0x7e')]:_0x425a9e[_0x61b3('0x79')];if(!_0x38208c[_0x61b3('0x22')][_0x61b3('0x60')](_0x61b3('0x85'))){_0x47481e[_0x61b3('0x11')]=qs[_0x61b3('0x11')](_0x38208c['query'][_0x61b3('0x11')]);_0x47481e[_0x61b3('0x10')]=qs[_0x61b3('0x10')](_0x38208c[_0x61b3('0x22')][_0x61b3('0x10')]);}_0x47481e[_0x61b3('0x7f')]=qs['sort'](_0x38208c[_0x61b3('0x22')][_0x61b3('0x80')]);_0x47481e[_0x61b3('0x5b')]=qs[_0x61b3('0x7c')](_[_0x61b3('0x81')](_0x38208c[_0x61b3('0x22')],_0x425a9e[_0x61b3('0x7c')]));_0x47481e[_0x61b3('0x5b')][_0x61b3('0x9b')]=_0x4f1b00['id'];if(_0x38208c['query'][_0x61b3('0x82')]){_0x47481e[_0x61b3('0x5b')]=_[_0x61b3('0x83')](_0x47481e[_0x61b3('0x5b')],{'$or':_[_0x61b3('0x6a')](_0x47481e['attributes'],function(_0x277155){var _0x5b58d6={};_0x5b58d6[_0x277155]={'$like':'%'+_0x38208c[_0x61b3('0x22')][_0x61b3('0x82')]+'%'};return _0x5b58d6;})});}_0x47481e=_[_0x61b3('0x83')]({},_0x47481e,_0x38208c[_0x61b3('0x84')]);return db[_0x61b3('0x4f')][_0x61b3('0x13')]({'where':_0x47481e[_0x61b3('0x5b')]})[_0x61b3('0x19')](function(_0x5e992f){_0x5d1d99['count']=_0x5e992f;if(_0x38208c[_0x61b3('0x22')][_0x61b3('0x9c')]){_0x47481e['include']=[{'all':!![]}];}return db[_0x61b3('0x4f')]['findAll'](_0x47481e);})['then'](function(_0x2fbbf1){_0x5d1d99['rows']=_0x2fbbf1;return _0x5d1d99;});}})[_0x61b3('0x19')](respondWithFilteredResult(_0x13652a,_0x47481e))['catch'](handleError(_0x13652a,null));};exports[_0x61b3('0xa2')]=function(_0x398fc2,_0x39857b){try{if(!_0x398fc2[_0x61b3('0x35')][_0x61b3('0x5d')]){throw new Error(_0x61b3('0xa3'));}if(!_0x398fc2['body'][_0x61b3('0xa4')]){throw new Error(_0x61b3('0xa5'));}if(!_0x398fc2['body'][_0x61b3('0xa6')]){throw new Error(_0x61b3('0xa7'));}if(!_0x398fc2[_0x61b3('0x35')][_0x61b3('0xa8')]){throw new Error(_0x61b3('0xa9'));}var _0x3e4c40=_0x398fc2['body']['binding_keys']['split'](',');var _0x1dec7f=_0x398fc2[_0x61b3('0x35')][_0x61b3('0xa6')][_0x61b3('0xaa')](',');if(!_0x3e4c40['length']||!_0x1dec7f[_0x61b3('0x2a')]||_0x3e4c40['length']!==_0x1dec7f[_0x61b3('0x2a')]){throw new Error(_0x61b3('0xab'));}_0x398fc2[_0x61b3('0x35')][_0x61b3('0x9a')]=_[_0x61b3('0xac')](_0x3e4c40,_0x1dec7f);if(!_0x398fc2[_0x61b3('0x35')][_0x61b3('0x9a')][_0x61b3('0x75')]){throw new Error(_0x61b3('0xad'));}if(!_0x398fc2[_0x61b3('0x35')][_0x61b3('0x9a')][_0x61b3('0xae')]){throw new Error(_0x61b3('0xaf'));}var _0x2f3787=path[_0x61b3('0x52')](config[_0x61b3('0xb0')],_0x61b3('0xb1'),_0x398fc2[_0x61b3('0xb2')]['filename']);fs['chmodSync'](_0x2f3787,parseInt('0777',0x8));var _0x4453e7=require('child_process')[_0x61b3('0xb3')](path[_0x61b3('0x52')](__dirname,_0x61b3('0xb4')),[_0x2f3787,_0x398fc2[_0x61b3('0x35')]['binding_keys'],_0x398fc2[_0x61b3('0x35')]['binding_values'],_0x398fc2[_0x61b3('0x35')][_0x61b3('0x5d')],_0x398fc2[_0x61b3('0x35')][_0x61b3('0xb5')],_0x398fc2[_0x61b3('0x35')][_0x61b3('0x5a')],_0x398fc2[_0x61b3('0x35')][_0x61b3('0xa8')]]);return _0x39857b[_0x61b3('0x14')](0xc8)[_0x61b3('0x17')]({'message':'File\x20uploaded\x20correctly!','pid':_0x4453e7[_0x61b3('0xb6')]});}catch(_0xcb24ee){return _0x39857b[_0x61b3('0x14')](0x1f4)[_0x61b3('0xb7')](_0xcb24ee);}};exports['upload']=function(_0x6a7a57,_0x5b51e2){var _0x2f9869=fs['createReadStream'](_0x6a7a57[_0x61b3('0xb2')][_0x61b3('0x3')]);Papa[_0x61b3('0xb8')](_0x2f9869,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x331284){return _0x5b51e2[_0x61b3('0x14')](0xc8)['json']({'file':_0x6a7a57[_0x61b3('0xb2')],'fields':_0x331284[_0x61b3('0xb9')][_0x61b3('0x9a')]});}});};exports[_0x61b3('0xba')]=function(_0x5cc1b1,_0x2e9fd4){return db[_0x61b3('0xbb')][_0x61b3('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x61b3('0xbc')}})[_0x61b3('0x19')](function(_0x26b96a){var _0x1173be=![];if(!_0x5cc1b1[_0x61b3('0x35')][_0x61b3('0x5d')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5cc1b1[_0x61b3('0x35')][_0x61b3('0xbd')][_0x61b3('0x75')]){throw new Error(_0x61b3('0xad'));}if(!_0x5cc1b1[_0x61b3('0x35')]['binding'][_0x61b3('0xae')]){throw new Error(_0x61b3('0xaf'));}if(!_0x5cc1b1[_0x61b3('0x35')][_0x61b3('0xa8')]){throw new Error(_0x61b3('0xa9'));}var _0x6b7c38=require('child_process')[_0x61b3('0xb3')](path[_0x61b3('0x52')](__dirname,'../../components/import/cm/csv2'),[_0x5cc1b1[_0x61b3('0x27')]['id'],JSON[_0x61b3('0xbe')](_0x5cc1b1[_0x61b3('0x35')]),JSON['stringify'](_0x26b96a)]);_0x6b7c38['on'](_0x61b3('0xbf'),function(){_0x1173be=!![];return _0x2e9fd4[_0x61b3('0x14')](0xc8)[_0x61b3('0x17')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x6b7c38[_0x61b3('0xb6')]});});_0x6b7c38['on'](_0x61b3('0xc0'),function(_0x40de89){if(_0x40de89&&!_0x1173be){return _0x2e9fd4[_0x61b3('0x14')](0x1f4)['json']({'message':_0x61b3('0xc1'),'pid':_0x6b7c38['pid']});}});})[_0x61b3('0x28')](handleError(_0x2e9fd4,null));};exports[_0x61b3('0xc2')]=function(_0x59e729,_0x3a78bd){return db[_0x61b3('0xbb')][_0x61b3('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x61b3('0xbc')}})[_0x61b3('0x19')](function(_0x357b0c){var _0x3d3fb2=![];if(!_0x59e729[_0x61b3('0x35')]['ListId']){throw new Error(_0x61b3('0xa3'));}if(!_0x59e729[_0x61b3('0x35')]['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x59e729['body'][_0x61b3('0xbd')][_0x61b3('0xae')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x59e729[_0x61b3('0x35')][_0x61b3('0xa8')]){throw new Error(_0x61b3('0xa9'));}var _0x58d6bb=require(_0x61b3('0xc3'))[_0x61b3('0xb3')](path[_0x61b3('0x52')](__dirname,'../../components/import/cm/csvUpdates'),[_0x59e729[_0x61b3('0x27')]['id'],JSON[_0x61b3('0xbe')](_0x59e729['body']),JSON[_0x61b3('0xbe')](_0x357b0c)]);_0x58d6bb['on'](_0x61b3('0xbf'),function(){_0x3d3fb2=!![];return _0x3a78bd[_0x61b3('0x14')](0xc8)['json']({'message':_0x61b3('0xc4'),'pid':_0x58d6bb[_0x61b3('0xb6')]});});_0x58d6bb['on'](_0x61b3('0xc0'),function(_0x1841b7){if(_0x1841b7&&!_0x3d3fb2){return _0x3a78bd[_0x61b3('0x14')](0x1f4)['json']({'message':_0x61b3('0xc1'),'pid':_0x58d6bb[_0x61b3('0xb6')]});}});})[_0x61b3('0x28')](handleError(_0x3a78bd,null));};exports[_0x61b3('0xc5')]=function(_0x4a3da9,_0x402f5c){var _0x49d570=[_0x61b3('0xc6'),'chat',_0x61b3('0xc7'),'openchannel','fax',_0x61b3('0xc8'),'voice'];var _0x366901={'offset':0x0,'order':qs[_0x61b3('0x80')](_0x61b3('0xc9'))},_0x3b050b={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x4a3da9[_0x61b3('0x22')]['channel']){if(!_['includes'](_0x49d570,_0x4a3da9['query'][_0x61b3('0xca')][_0x61b3('0xcb')]())){throw new Error(_0x61b3('0xcc'));}_0x49d570=[_0x4a3da9['query'][_0x61b3('0xca')][_0x61b3('0xcb')]()];}if(_0x4a3da9['query'][_0x61b3('0xcd')]){try{var _0x1c41a4=JSON['parse'](_0x4a3da9[_0x61b3('0x22')]['range']);if(!moment(_0x1c41a4['from'])['isValid']()){throw new Error(_0x61b3('0xce'));}if(!moment(_0x1c41a4['to'])[_0x61b3('0xcf')]()){throw new Error(_0x61b3('0xd0'));}}catch(_0x1617c1){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x4a3da9[_0x61b3('0x22')][_0x61b3('0x60')]('nolimit')){_0x366901[_0x61b3('0x11')]=qs['limit'](_0x4a3da9['query'][_0x61b3('0x11')]||0xa);_0x366901[_0x61b3('0x10')]=qs[_0x61b3('0x10')](_0x4a3da9[_0x61b3('0x22')][_0x61b3('0x10')]);}var _0x1bcd98=_0x49d570[_0x61b3('0x6a')](function(_0x822fdb){if(_0x822fdb===_0x61b3('0xd1')){var _0x22533e={'attributes':['id',_0x61b3('0xd2'),'type',_0x61b3('0xd3'),_0x61b3('0xd4'),_0x61b3('0xd5'),_0x61b3('0xd6'),_0x61b3('0xd7'),_0x61b3('0xd8'),'note',_0x61b3('0xd9'),'userDisposition',_0x61b3('0xda'),_0x61b3('0xdb'),_0x61b3('0xdc')],'where':{'ContactId':_0x4a3da9[_0x61b3('0x27')]['id']},'include':[{'model':db['User'],'as':_0x61b3('0xbb'),'attributes':['id',_0x61b3('0x1e'),'fullname','alias']}],'order':[[_0x61b3('0xd9'),_0x61b3('0xdd')]]};if(_0x4a3da9[_0x61b3('0x22')]['range']){_0x22533e[_0x61b3('0x5b')][_0x61b3('0xd9')]={'$gte':_0x1c41a4['from'],'$lte':_0x1c41a4['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x22533e)[_0x61b3('0x19')](function(_0x51cc32){_0x3b050b['count']+=_0x51cc32[_0x61b3('0x13')];return _[_0x61b3('0x6a')](_0x51cc32[_0x61b3('0x9e')],function(_0x46985d){var _0x49ebaf=_0x46985d[_0x61b3('0xde')]({'plain':!![]});_0x49ebaf['channel']=_0x822fdb;if(_0x49ebaf[_0x61b3('0xbb')]){_0x49ebaf['User']={'id':_0x49ebaf[_0x61b3('0xbb')]['id'],'name':_0x49ebaf[_0x61b3('0xbb')]['name'],'fullname':_0x49ebaf[_0x61b3('0xbb')][_0x61b3('0xdf')],'alias':_0x49ebaf[_0x61b3('0xbb')][_0x61b3('0x30')]};}return _0x49ebaf;});});}else{var _0x586003=_[_0x61b3('0xe0')](_0x822fdb)+(_0x822fdb===_0x61b3('0xe1')?_0x61b3('0xe2'):_0x61b3('0xe3'));var _0x57d639={'attributes':['id',_0x61b3('0xe4'),_0x61b3('0xe5'),'createdAt',_0x61b3('0xe6'),_0x61b3('0xe7'),'secondDisposition',_0x61b3('0xe8'),_0x61b3('0xdc'),_0x586003+'Id'],'where':{'ContactId':_0x4a3da9[_0x61b3('0x27')]['id']},'include':[{'model':db[_0x586003],'as':'Account','attributes':['id',_0x61b3('0x1e'),'key']},{'model':db[_0x61b3('0xbb')],'as':_0x61b3('0xe9'),'attributes':['id','name',_0x61b3('0xdf')]},{'model':db[_0x61b3('0x7a')],'as':_0x61b3('0xea'),'attributes':['id',_0x61b3('0x1e'),_0x61b3('0xeb')],'through':{'attributes':[]}}],'order':[[_0x61b3('0xd9'),_0x61b3('0xdd')]]};if(_0x4a3da9[_0x61b3('0x22')][_0x61b3('0xcd')]){_0x57d639[_0x61b3('0x5b')]['createdAt']={'$gte':_0x1c41a4[_0x61b3('0x36')],'$lte':_0x1c41a4['to']};}switch(_0x822fdb){case'chat':_0x57d639[_0x61b3('0x7e')][_0x61b3('0x5c')](_0x61b3('0xec'),_0x61b3('0xed'),_0x61b3('0xee'),_0x61b3('0xef'),'osName',_0x61b3('0xf0'),'ratingType','ratingValue',_0x61b3('0xf1'));break;case'mail':_0x57d639[_0x61b3('0x7e')]['push'](_0x61b3('0xf2'),_0x61b3('0xf3'));break;case _0x61b3('0xf4'):_0x57d639[_0x61b3('0x7e')][_0x61b3('0x5c')](_0x61b3('0xf5'),_0x61b3('0xf6'));break;}return db[_[_0x61b3('0xe0')](_0x822fdb)+_0x61b3('0xf7')][_0x61b3('0xf8')](_0x57d639)['then'](function(_0x23d8e1){_0x3b050b['count']+=_0x23d8e1[_0x61b3('0x13')];return _[_0x61b3('0x6a')](_0x23d8e1[_0x61b3('0x9e')],function(_0x3d470f){var _0x814dbd=_0x3d470f[_0x61b3('0xde')]({'plain':!![]});_0x814dbd[_0x61b3('0xca')]=_0x822fdb;if(_0x814dbd['Owner']){_0x814dbd[_0x61b3('0xe9')]={'id':_0x814dbd[_0x61b3('0xe9')]['id'],'name':_0x814dbd[_0x61b3('0xe9')][_0x61b3('0x1e')],'fullname':_0x814dbd['Owner']['fullname']};}return _0x814dbd;});});}});return Promise[_0x61b3('0x87')](_0x1bcd98);})[_0x61b3('0x19')](function(_0x46145f){return _(_0x46145f)['flatten']()[_0x61b3('0xf9')](_0x61b3('0xd9'))[_0x61b3('0xfa')]()['value']();})['then'](function(_0x4146fc){_0x3b050b[_0x61b3('0x9e')]=_0x366901[_0x61b3('0x11')]?_0x4146fc['slice'](_0x366901[_0x61b3('0x10')],_0x366901[_0x61b3('0x10')]+_0x366901[_0x61b3('0x11')]):_0x4146fc;return _0x3b050b;})[_0x61b3('0x19')](respondWithFilteredResult(_0x402f5c,_0x366901))[_0x61b3('0x28')](handleError(_0x402f5c,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index d124a7c..1c484b3 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 _0x723f=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x55021a,_0x15fdee){var _0x1affcf=function(_0x149a50){while(--_0x149a50){_0x55021a['push'](_0x55021a['shift']());}};_0x1affcf(++_0x15fdee);}(_0x723f,0x18a));var _0xf723=function(_0x4aeddc,_0x288ae8){_0x4aeddc=_0x4aeddc-0x0;var _0x4106fb=_0x723f[_0x4aeddc];return _0x4106fb;};'use strict';var EventEmitter=require(_0xf723('0x0'));var CmContact=require(_0xf723('0x1'))['db'][_0xf723('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf723('0x3')](0x0);var events={'afterCreate':_0xf723('0x4'),'afterUpdate':_0xf723('0x5'),'afterDestroy':_0xf723('0x6')};function emitEvent(_0x3fc9e4){return function(_0x516c11,_0x1d6469,_0x439eb0){CmContactEvents['emit'](_0x3fc9e4+':'+_0x516c11['id'],_0x516c11);CmContactEvents['emit'](_0x3fc9e4,_0x516c11);_0x439eb0(null);};}for(var e in events){if(events[_0xf723('0x7')](e)){var event=events[e];CmContact[_0xf723('0x8')](e,emitEvent(event));}}module[_0xf723('0x9')]=CmContactEvents; \ No newline at end of file +var _0xe0b2=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb','CmContact'];(function(_0x2da8e3,_0x397415){var _0x281fd5=function(_0x1d9db5){while(--_0x1d9db5){_0x2da8e3['push'](_0x2da8e3['shift']());}};_0x281fd5(++_0x397415);}(_0xe0b2,0x8a));var _0x2e0b=function(_0x190e49,_0x29a2a3){_0x190e49=_0x190e49-0x0;var _0x3fa6a2=_0xe0b2[_0x190e49];return _0x3fa6a2;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x2e0b('0x0'))['db'][_0x2e0b('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2e0b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2e0b('0x3')};function emitEvent(_0x23c459){return function(_0x2c63c2,_0xc59f78,_0x5f018a){CmContactEvents[_0x2e0b('0x4')](_0x23c459+':'+_0x2c63c2['id'],_0x2c63c2);CmContactEvents[_0x2e0b('0x4')](_0x23c459,_0x2c63c2);_0x5f018a(null);};}for(var e in events){if(events[_0x2e0b('0x5')](e)){var event=events[e];CmContact[_0x2e0b('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c88b9f8..6f3ac70 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 _0x420f=['priority','callbackUniqueid','catch','ret','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','CmHopperFinal','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','ContactId','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','request-promise','path','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','timezones','isNil','utcOffset','add','minutes','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x420f,0x1ea));var _0xf420=function(_0x27e01b,_0x22e76a){_0x27e01b=_0x27e01b-0x0;var _0x5cc835=_0x420f[_0x27e01b];return _0x5cc835;};'use strict';var _=require(_0xf420('0x0'));var util=require(_0xf420('0x1'));var logger=require('../../config/logger')(_0xf420('0x2'));var moment=require(_0xf420('0x3'));var BPromise=require('bluebird');var rp=require(_0xf420('0x4'));var fs=require('fs');var path=require(_0xf420('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module['exports']=function(_0x34629f,_0x5b8918){return _0x34629f[_0xf420('0x6')](_0xf420('0x7'),attributes,{'tableName':_0xf420('0x8'),'paranoid':!![],'indexes':[{'name':_0xf420('0x9'),'fields':[_0xf420('0x9')]},{'name':'fti_cm_contacts','fields':[_0xf420('0xa'),_0xf420('0xb'),_0xf420('0x9'),_0xf420('0xc'),_0xf420('0xd'),_0xf420('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xf420('0xf'),'collate':_0xf420('0x10'),'hooks':{'afterCreate':function(_0x558382,_0x5cfd38,_0x231c27){var _0x57b32d=_0x34629f['models'];var _0x33cba9=_0x558382[_0xf420('0x11')]({'plain':!![]});function _0xdad764(){return function(_0xd94e46){logger['error'](_0xf420('0x12'),_0xf420('0x13'),util[_0xf420('0x14')](_0xd94e46,{'showHidden':![],'depth':null}));};}function _0x2dc5a9(_0x2041c0,_0x118b56){var _0x4f48aa=_0x118b56[_0xf420('0x15')]?_0x118b56[_0xf420('0x15')]:moment()[_0xf420('0x16')](_0xf420('0x17'));return new BPromise(function(_0xb1aace,_0x508b11){if(_['isNil'](_0x118b56[_0xf420('0x18')])){_0xb1aace({'ret':_0x4f48aa});}else{_0x57b32d[_0xf420('0x19')]['findOne']({'where':{'id':_0x2041c0['id']}})[_0xf420('0x1a')](function(_0x127e00){if(!_['isNil'](_0x127e00)){var _0x2af2e5=_0x127e00[_0xf420('0x18')];if(!_['isNil'](_0x2af2e5)){var _0x4f4c62=shared[_0xf420('0x1b')];var _0x24976b=_0x4f4c62[_0x2af2e5];var _0x350c99=_0x4f4c62[_0x118b56[_0xf420('0x18')]];if(!_[_0xf420('0x1c')](_0x24976b)&&!_[_0xf420('0x1c')](_0x350c99)){var _0x551d63=_0x24976b[_0xf420('0x1d')]-_0x350c99[_0xf420('0x1d')];_0x4f48aa=_0x118b56[_0xf420('0x15')]?_0x118b56[_0xf420('0x15')]:moment();var _0x21dcf7=moment(_0x4f48aa)[_0xf420('0x1e')](_0x551d63,_0xf420('0x1f'));_0xb1aace({'ret':_0x21dcf7[_0xf420('0x16')](_0xf420('0x17'))});}else _0xb1aace({'ret':_0x4f48aa});}else _0xb1aace({'ret':_0x4f48aa});}else{_0xb1aace({'ret':_0x4f48aa});}});}});return 0xa;}var _0xb71ac7=function(_0x2827f0){return new BPromise(function(_0x4e8ebf,_0x59a741){_0x2dc5a9(_0x2827f0,_0x33cba9)[_0xf420('0x1a')](function(_0x10534c){_0x33cba9[_0xf420('0x15')]=_0x10534c['ret'];_0x57b32d[_0xf420('0x20')][_0xf420('0x21')]({'where':{'phone':_0x33cba9[_0xf420('0x9')],'VoiceQueueId':_0x2827f0['id']}})[_0xf420('0x1a')](function(_0x26a951){if(!_['isNil'](_0x26a951)){throw new Error(_0xf420('0x22')+_0x33cba9['phone']+_0xf420('0x23')+_0x2827f0['id']);}return _0x57b32d[_0xf420('0x20')][_0xf420('0x24')]({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'priority':_0x33cba9[_0xf420('0x26')]?_0x33cba9[_0xf420('0x26')]:0x2,'scheduledat':_0x33cba9[_0xf420('0x15')]?_0x33cba9['scheduledat']:moment()[_0xf420('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9[_0xf420('0x27')]?_0x33cba9['callbackUniqueid']:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()[_0xf420('0x16')](_0xf420('0x17')):undefined,'VoiceQueueId':_0x2827f0['id']});})[_0xf420('0x28')](function(_0x2c8d83){_0x59a741(_0x2c8d83);});});});};var _0x46e2dd=function(_0x36933e){return new BPromise(function(_0x472614,_0x58e176){_0x2dc5a9(_0x36933e,_0x33cba9)[_0xf420('0x1a')](function(_0x206c2c){_0x33cba9['scheduledat']=_0x206c2c[_0xf420('0x29')];_0x57b32d[_0xf420('0x20')][_0xf420('0x21')]({'where':{'phone':_0x33cba9[_0xf420('0x9')],'VoiceQueueId':_0x36933e['id']}})['then'](function(_0x454829){if(!_[_0xf420('0x1c')](_0x454829)){throw new Error(_0xf420('0x22')+_0x33cba9[_0xf420('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x36933e['id']);}return _0x57b32d['CmHopperFinal'][_0xf420('0x21')]({'where':{'calleridnum':_0x33cba9[_0xf420('0x9')],'VoiceQueueId':_0x36933e['id']}});})['then'](function(_0xce0fad){if(!_['isNil'](_0xce0fad)){throw new Error(_0xf420('0x2a')+_0x33cba9[_0xf420('0x9')]+_0xf420('0x2b')+_0x36933e['id']);}return _0x57b32d[_0xf420('0x20')]['create']({'phone':_0x33cba9['phone'],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'priority':_0x33cba9['priority']?_0x33cba9[_0xf420('0x26')]:0x2,'scheduledat':_0x33cba9[_0xf420('0x15')]?_0x33cba9['scheduledat']:moment()[_0xf420('0x16')](_0xf420('0x17')),'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9['callbackUniqueid']?_0x33cba9[_0xf420('0x27')]:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()[_0xf420('0x16')](_0xf420('0x17')):undefined,'VoiceQueueId':_0x36933e['id']});})[_0xf420('0x28')](function(_0x1c5459){_0x58e176(_0x1c5459);});});});};function _0x319b4b(){return function(_0x5fd947){logger['error'](_0xf420('0x12'),_0xf420('0x13'),util[_0xf420('0x14')](_0x5fd947,{'showHidden':![],'depth':null}));};}function _0x5475ca(_0x396445,_0x2cd387){var _0x3fb025=_0x2cd387[_0xf420('0x15')]?_0x2cd387[_0xf420('0x15')]:moment()[_0xf420('0x16')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x455fa7,_0x41c18e){if(_[_0xf420('0x1c')](_0x2cd387['dialTimezone'])){_0x455fa7({'ret':_0x3fb025});}else{_0x57b32d[_0xf420('0x2c')][_0xf420('0x21')]({'where':{'id':_0x396445['id']}})['then'](function(_0x24dc0b){if(!_[_0xf420('0x1c')](_0x24dc0b)){var _0x16ba17=_0x24dc0b[_0xf420('0x18')];if(!_[_0xf420('0x1c')](_0x16ba17)){var _0x230673=shared[_0xf420('0x1b')];var _0x1cd573=_0x230673[_0x16ba17];var _0x14a39e=_0x230673[_0x2cd387[_0xf420('0x18')]];if(!_['isNil'](_0x1cd573)&&!_[_0xf420('0x1c')](_0x14a39e)){var _0x2c8a05=_0x1cd573[_0xf420('0x1d')]-_0x14a39e[_0xf420('0x1d')];_0x3fb025=_0x2cd387[_0xf420('0x15')]?_0x2cd387[_0xf420('0x15')]:moment();var _0x19e718=moment(_0x3fb025)['add'](_0x2c8a05,_0xf420('0x1f'));_0x455fa7({'ret':_0x19e718[_0xf420('0x16')](_0xf420('0x17'))});}else _0x455fa7({'ret':_0x3fb025});}else _0x455fa7({'ret':_0x3fb025});}else{_0x455fa7({'ret':_0x3fb025});}});}});return 0xa;}var _0x46f510=function(_0x13f354){return new BPromise(function(_0xb5be16,_0x355363){_0x5475ca(_0x13f354,_0x33cba9)[_0xf420('0x1a')](function(_0x524499){_0x33cba9[_0xf420('0x15')]=_0x524499[_0xf420('0x29')];_0x57b32d[_0xf420('0x20')][_0xf420('0x21')]({'where':{'phone':_0x33cba9['phone'],'CampaignId':_0x13f354['id']}})[_0xf420('0x1a')](function(_0x357984){if(!_[_0xf420('0x1c')](_0x357984)){throw new Error(_0xf420('0x22')+_0x33cba9['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x13f354['id']);}return _0x57b32d[_0xf420('0x20')][_0xf420('0x24')]({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'priority':_0x33cba9[_0xf420('0x26')]?_0x33cba9[_0xf420('0x26')]:0x2,'scheduledat':_0x33cba9[_0xf420('0x15')]?_0x33cba9['scheduledat']:moment()[_0xf420('0x16')](_0xf420('0x17')),'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9[_0xf420('0x27')]?_0x33cba9[_0xf420('0x27')]:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()[_0xf420('0x16')](_0xf420('0x17')):undefined,'CampaignId':_0x13f354['id']});})['catch'](function(_0x991cac){_0x355363(_0x991cac);});});});};var _0x42d11d=function(_0x223c3c){return new BPromise(function(_0x61211e,_0x434546){_0x5475ca(_0x223c3c,_0x33cba9)[_0xf420('0x1a')](function(_0x483359){_0x33cba9[_0xf420('0x15')]=_0x483359[_0xf420('0x29')];_0x57b32d['CmHopper'][_0xf420('0x21')]({'where':{'phone':_0x33cba9['phone'],'CampaignId':_0x223c3c['id']}})[_0xf420('0x1a')](function(_0x4507d9){if(!_['isNil'](_0x4507d9)){throw new Error(_0xf420('0x22')+_0x33cba9[_0xf420('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x223c3c['id']);}return _0x57b32d[_0xf420('0x2d')][_0xf420('0x21')]({'where':{'calleridnum':_0x33cba9[_0xf420('0x9')],'CampaignId':_0x223c3c['id']}});})[_0xf420('0x1a')](function(_0x39fb2e){if(!_[_0xf420('0x1c')](_0x39fb2e)){throw new Error(_0xf420('0x2a')+_0x33cba9['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x223c3c['id']);}return _0x57b32d[_0xf420('0x20')][_0xf420('0x24')]({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9['ListId'],'priority':_0x33cba9[_0xf420('0x26')]?_0x33cba9['priority']:0x2,'scheduledat':_0x33cba9[_0xf420('0x15')]?_0x33cba9[_0xf420('0x15')]:moment()['format'](_0xf420('0x17')),'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9[_0xf420('0x27')]?_0x33cba9['callbackUniqueid']:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()['format'](_0xf420('0x17')):undefined,'CampaignId':_0x223c3c['id']});})[_0xf420('0x28')](function(_0x4771f2){_0x434546(_0x4771f2);});});});};if(_0x33cba9['ListId']){_0x57b32d[_0xf420('0x19')]['findAll']({'where':{'type':_0xf420('0x2e')},'attributes':['id',_0xf420('0x2f'),_0xf420('0x18')],'include':[{'model':_0x57b32d[_0xf420('0x30')],'as':_0xf420('0x31'),'where':{'id':_0x33cba9[_0xf420('0x25')]}}]})[_0xf420('0x1a')](function(_0x290534){if(_0x290534){var _0x2e0b80=[];for(var _0x358112=0x0,_0x48b245;_0x358112<_0x290534[_0xf420('0x32')];_0x358112+=0x1){_0x48b245=_0x290534[_0x358112][_0xf420('0x11')]({'plain':!![]});switch(_0x48b245[_0xf420('0x2f')]){case _0xf420('0x33'):_0x46e2dd(_0x48b245)[_0xf420('0x28')](_0xdad764());break;case _0xf420('0x34'):_0xb71ac7(_0x48b245)['catch'](_0xdad764());break;default:_0x5475ca(_0x48b245,_0x33cba9)[_0xf420('0x1a')](function(_0x52e156){_0x33cba9[_0xf420('0x15')]=_0x52e156[_0xf420('0x29')];_0x57b32d[_0xf420('0x20')][_0xf420('0x24')]({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'scheduledat':_0x33cba9[_0xf420('0x15')]?_0x33cba9[_0xf420('0x15')]:moment()[_0xf420('0x16')](_0xf420('0x17')),'priority':_0x33cba9[_0xf420('0x26')]?_0x33cba9[_0xf420('0x26')]:0x2,'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9['callbackUniqueid']?_0x33cba9[_0xf420('0x27')]:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()[_0xf420('0x16')](_0xf420('0x17')):undefined,'VoiceQueueId':_0x48b245['id']})[_0xf420('0x28')](_0xdad764());});}}}})[_0xf420('0x1a')](function(){return _0x57b32d[_0xf420('0x19')][_0xf420('0x35')]({'where':{'type':_0xf420('0x2e')},'attributes':['id'],'include':[{'model':_0x57b32d[_0xf420('0x30')],'as':_0xf420('0x36'),'where':{'id':_0x33cba9[_0xf420('0x25')]}}]})[_0xf420('0x1a')](function(_0xd49151){if(_0xd49151){var _0x258a38=[];for(var _0xead56=0x0,_0x42a90b;_0xead56<_0xd49151[_0xf420('0x32')];_0xead56+=0x1){_0x42a90b=_0xd49151[_0xead56]['get']({'plain':!![]});_0x57b32d[_0xf420('0x37')][_0xf420('0x24')]({'phone':_0x33cba9['phone'],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'VoiceQueueId':_0x42a90b['id']})[_0xf420('0x28')](function(_0x5370f4){logger[_0xf420('0x38')](_0xf420('0x39'),_0xf420('0x13'),_0x5370f4['message']);});}}});})[_0xf420('0x1a')](function(){return _0x57b32d['Campaign'][_0xf420('0x35')]({'attributes':['id',_0xf420('0x2f'),_0xf420('0x18')],'include':[{'model':_0x57b32d[_0xf420('0x30')],'as':_0xf420('0x31'),'where':{'id':_0x33cba9[_0xf420('0x25')]}}]})[_0xf420('0x1a')](function(_0x5e9861){if(_0x5e9861){var _0x1d3e2c=[];for(var _0xf35a2a=0x0,_0xefc8f1;_0xf35a2a<_0x5e9861[_0xf420('0x32')];_0xf35a2a+=0x1){_0xefc8f1=_0x5e9861[_0xf35a2a][_0xf420('0x11')]({'plain':!![]});switch(_0xefc8f1[_0xf420('0x2f')]){case'always':_0x42d11d(_0xefc8f1)[_0xf420('0x28')](_0x319b4b());break;case _0xf420('0x34'):_0x46f510(_0xefc8f1)[_0xf420('0x28')](_0x319b4b());break;default:_0x57b32d[_0xf420('0x20')]['create']({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9[_0xf420('0x25')],'scheduledat':_0x33cba9['scheduledat']?_0x33cba9['scheduledat']:moment()[_0xf420('0x16')](_0xf420('0x17')),'priority':_0x33cba9[_0xf420('0x26')]?_0x33cba9[_0xf420('0x26')]:0x2,'callback':_0x33cba9[_0xf420('0x27')]?!![]:![],'callbackuniqueid':_0x33cba9['callbackUniqueid']?_0x33cba9[_0xf420('0x27')]:undefined,'callbackat':_0x33cba9[_0xf420('0x27')]?moment()[_0xf420('0x16')](_0xf420('0x17')):undefined,'CampaignId':_0xefc8f1['id']})[_0xf420('0x28')](_0x319b4b());}}}});})[_0xf420('0x1a')](function(){return _0x57b32d[_0xf420('0x2c')]['findAll']({'attributes':['id'],'include':[{'model':_0x57b32d[_0xf420('0x30')],'as':_0xf420('0x36'),'where':{'id':_0x33cba9[_0xf420('0x25')]}}]})[_0xf420('0x1a')](function(_0x395441){if(_0x395441){var _0x4a7991=[];for(var _0x22e9db=0x0,_0x59ff35;_0x22e9db<_0x395441[_0xf420('0x32')];_0x22e9db+=0x1){_0x59ff35=_0x395441[_0x22e9db]['get']({'plain':!![]});_0x57b32d[_0xf420('0x37')][_0xf420('0x24')]({'phone':_0x33cba9[_0xf420('0x9')],'ContactId':_0x33cba9['id'],'ListId':_0x33cba9['ListId'],'CampaignId':_0x59ff35['id']})[_0xf420('0x28')](function(_0xb8dda3){logger[_0xf420('0x38')](_0xf420('0x39'),_0xf420('0x13'),_0xb8dda3[_0xf420('0x3a')]);});}}});})['then'](function(){_0x231c27();})[_0xf420('0x28')](function(_0x40c5fe){logger[_0xf420('0x38')](_0xf420('0x39'),_0xf420('0x13'),_0x40c5fe[_0xf420('0x3a')]);_0x231c27(_0x40c5fe);});}else{_0x231c27(new Error(_0xf420('0x3b')));}},'afterDestroy':function(_0x5f43c8,_0x2b41fc,_0xbbd842){var _0x5cb1fd=_0x34629f['models'];var _0x4a39a9=_0x5f43c8[_0xf420('0x11')]({'plain':!![]});return _0x5cb1fd[_0xf420('0x20')][_0xf420('0x35')]({'raw':!![],'where':{'ListId':_0x4a39a9['ListId'],'ContactId':_0x4a39a9['id']}})[_0xf420('0x1a')](function(_0x5cd3ea){if(!_['isEmpty'](_0x5cd3ea)){var _0x2686bc=[];for(var _0x21cb37=0x0;_0x21cb37<_0x5cd3ea[_0xf420('0x32')];_0x21cb37+=0x1){var _0x22773c=_0x5cb1fd['CmHopper']['destroy']({'where':{'ListId':_0x5cd3ea[_0x21cb37][_0xf420('0x25')],'ContactId':_0x5cd3ea[_0x21cb37][_0xf420('0x3c')],'VoiceQueueId':_0x5cd3ea[_0x21cb37][_0xf420('0x3d')],'CampaignId':_0x5cd3ea[_0x21cb37][_0xf420('0x3e')]}});_0x2686bc['push'](_0x22773c);}return BPromise[_0xf420('0x3f')](_0x2686bc);}})[_0xf420('0x1a')](function(_0x1985e6){logger['info'](_0xf420('0x40'),util[_0xf420('0x14')](_0x1985e6,{'showHidden':![],'depth':null}));_0xbbd842();})[_0xf420('0x28')](function(_0x3bb748){logger[_0xf420('0x38')](_0xf420('0x41'),util[_0xf420('0x14')](_0x3bb748,{'showHidden':![],'depth':null}));_0xbbd842(_0x3bb748);});}}});}; \ No newline at end of file +var _0xe9d4=['ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','priority','Campaign','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','CmHopperBlack','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','phone','fti_cm_contacts','mobile','email','FULLTEXT','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','isNil','timezones','utcOffset','add','minutes','then'];(function(_0x4cfe90,_0x3da8fb){var _0x13591e=function(_0x3f1281){while(--_0x3f1281){_0x4cfe90['push'](_0x4cfe90['shift']());}};_0x13591e(++_0x3da8fb);}(_0xe9d4,0x1d5));var _0x4e9d=function(_0x1a6a02,_0x1c090f){_0x1a6a02=_0x1a6a02-0x0;var _0x3b19f5=_0xe9d4[_0x1a6a02];return _0x3b19f5;};'use strict';var _=require(_0x4e9d('0x0'));var util=require(_0x4e9d('0x1'));var logger=require('../../config/logger')(_0x4e9d('0x2'));var moment=require(_0x4e9d('0x3'));var BPromise=require(_0x4e9d('0x4'));var rp=require(_0x4e9d('0x5'));var fs=require('fs');var path=require(_0x4e9d('0x6'));var rimraf=require('rimraf');var config=require(_0x4e9d('0x7'));var shared=require(_0x4e9d('0x8'));var attributes=require(_0x4e9d('0x9'));module[_0x4e9d('0xa')]=function(_0x2a9102,_0x1867ee){return _0x2a9102[_0x4e9d('0xb')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x4e9d('0xc'),'fields':['phone']},{'name':_0x4e9d('0xd'),'fields':['firstName','lastName',_0x4e9d('0xc'),_0x4e9d('0xe'),'fax',_0x4e9d('0xf')],'type':_0x4e9d('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x733ad4,_0x2b5328,_0x299a7d){var _0x49869a=_0x2a9102[_0x4e9d('0x11')];var _0x193fb7=_0x733ad4[_0x4e9d('0x12')]({'plain':!![]});function _0x24cae8(){return function(_0x338201){logger[_0x4e9d('0x13')](_0x4e9d('0x14'),_0x4e9d('0x15'),util[_0x4e9d('0x16')](_0x338201,{'showHidden':![],'depth':null}));};}function _0x3b4398(_0x3eed9c,_0x36f559){var _0x39f7a1=_0x36f559[_0x4e9d('0x17')]?_0x36f559['scheduledat']:moment()[_0x4e9d('0x18')](_0x4e9d('0x19'));return new BPromise(function(_0x32c20b,_0x82d6e2){if(_['isNil'](_0x36f559[_0x4e9d('0x1a')])){_0x32c20b({'ret':_0x39f7a1});}else{_0x49869a[_0x4e9d('0x1b')][_0x4e9d('0x1c')]({'where':{'id':_0x3eed9c['id']}})['then'](function(_0x3c9d97){if(!_['isNil'](_0x3c9d97)){var _0x368743=_0x3c9d97[_0x4e9d('0x1a')];if(!_[_0x4e9d('0x1d')](_0x368743)){var _0x43de32=shared[_0x4e9d('0x1e')];var _0x518947=_0x43de32[_0x368743];var _0xd0914=_0x43de32[_0x36f559['dialTimezone']];if(!_[_0x4e9d('0x1d')](_0x518947)&&!_['isNil'](_0xd0914)){var _0x1c0adf=_0x518947[_0x4e9d('0x1f')]-_0xd0914[_0x4e9d('0x1f')];_0x39f7a1=_0x36f559[_0x4e9d('0x17')]?_0x36f559[_0x4e9d('0x17')]:moment();var _0x702a64=moment(_0x39f7a1)[_0x4e9d('0x20')](_0x1c0adf,_0x4e9d('0x21'));_0x32c20b({'ret':_0x702a64[_0x4e9d('0x18')](_0x4e9d('0x19'))});}else _0x32c20b({'ret':_0x39f7a1});}else _0x32c20b({'ret':_0x39f7a1});}else{_0x32c20b({'ret':_0x39f7a1});}});}});return 0xa;}var _0xfdd9dc=function(_0xfaf53e){return new BPromise(function(_0x3d37a5,_0x3f0fab){_0x3b4398(_0xfaf53e,_0x193fb7)[_0x4e9d('0x22')](function(_0x3679be){_0x193fb7[_0x4e9d('0x17')]=_0x3679be[_0x4e9d('0x23')];_0x49869a['CmHopper'][_0x4e9d('0x1c')]({'where':{'phone':_0x193fb7[_0x4e9d('0xc')],'VoiceQueueId':_0xfaf53e['id']}})['then'](function(_0x4bdf73){if(!_[_0x4e9d('0x1d')](_0x4bdf73)){throw new Error('cmContact,\x20afterCreate\x20'+_0x193fb7[_0x4e9d('0xc')]+_0x4e9d('0x24')+_0xfaf53e['id']);}return _0x49869a['CmHopper'][_0x4e9d('0x25')]({'phone':_0x193fb7[_0x4e9d('0xc')],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'priority':_0x193fb7['priority']?_0x193fb7['priority']:0x2,'scheduledat':_0x193fb7[_0x4e9d('0x17')]?_0x193fb7[_0x4e9d('0x17')]:moment()[_0x4e9d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x193fb7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x193fb7['callbackUniqueid']?_0x193fb7[_0x4e9d('0x27')]:undefined,'callbackat':_0x193fb7[_0x4e9d('0x27')]?moment()[_0x4e9d('0x18')](_0x4e9d('0x19')):undefined,'VoiceQueueId':_0xfaf53e['id']});})[_0x4e9d('0x28')](function(_0x4011db){_0x3f0fab(_0x4011db);});});});};var _0x12631a=function(_0x49dd68){return new BPromise(function(_0x54133e,_0x382e96){_0x3b4398(_0x49dd68,_0x193fb7)[_0x4e9d('0x22')](function(_0x14dbd4){_0x193fb7[_0x4e9d('0x17')]=_0x14dbd4[_0x4e9d('0x23')];_0x49869a['CmHopper'][_0x4e9d('0x1c')]({'where':{'phone':_0x193fb7[_0x4e9d('0xc')],'VoiceQueueId':_0x49dd68['id']}})[_0x4e9d('0x22')](function(_0x100b52){if(!_[_0x4e9d('0x1d')](_0x100b52)){throw new Error(_0x4e9d('0x29')+_0x193fb7[_0x4e9d('0xc')]+_0x4e9d('0x2a')+_0x49dd68['id']);}return _0x49869a[_0x4e9d('0x2b')]['findOne']({'where':{'calleridnum':_0x193fb7[_0x4e9d('0xc')],'VoiceQueueId':_0x49dd68['id']}});})['then'](function(_0x44d189){if(!_[_0x4e9d('0x1d')](_0x44d189)){throw new Error(_0x4e9d('0x2c')+_0x193fb7[_0x4e9d('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x49dd68['id']);}return _0x49869a['CmHopper'][_0x4e9d('0x25')]({'phone':_0x193fb7['phone'],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'priority':_0x193fb7['priority']?_0x193fb7[_0x4e9d('0x2d')]:0x2,'scheduledat':_0x193fb7['scheduledat']?_0x193fb7[_0x4e9d('0x17')]:moment()[_0x4e9d('0x18')](_0x4e9d('0x19')),'callback':_0x193fb7[_0x4e9d('0x27')]?!![]:![],'callbackuniqueid':_0x193fb7[_0x4e9d('0x27')]?_0x193fb7[_0x4e9d('0x27')]:undefined,'callbackat':_0x193fb7[_0x4e9d('0x27')]?moment()[_0x4e9d('0x18')](_0x4e9d('0x19')):undefined,'VoiceQueueId':_0x49dd68['id']});})[_0x4e9d('0x28')](function(_0x4779d0){_0x382e96(_0x4779d0);});});});};function _0x507b8c(){return function(_0x39e21d){logger[_0x4e9d('0x13')](_0x4e9d('0x14'),_0x4e9d('0x15'),util['inspect'](_0x39e21d,{'showHidden':![],'depth':null}));};}function _0x3904cc(_0x5424b2,_0x286bec){var _0xf2537f=_0x286bec['scheduledat']?_0x286bec['scheduledat']:moment()['format'](_0x4e9d('0x19'));return new BPromise(function(_0x3a66c7,_0x13d82d){if(_[_0x4e9d('0x1d')](_0x286bec[_0x4e9d('0x1a')])){_0x3a66c7({'ret':_0xf2537f});}else{_0x49869a[_0x4e9d('0x2e')]['findOne']({'where':{'id':_0x5424b2['id']}})[_0x4e9d('0x22')](function(_0x1927d6){if(!_[_0x4e9d('0x1d')](_0x1927d6)){var _0x455d79=_0x1927d6[_0x4e9d('0x1a')];if(!_['isNil'](_0x455d79)){var _0x2bda23=shared['timezones'];var _0x78377f=_0x2bda23[_0x455d79];var _0x43c216=_0x2bda23[_0x286bec[_0x4e9d('0x1a')]];if(!_[_0x4e9d('0x1d')](_0x78377f)&&!_[_0x4e9d('0x1d')](_0x43c216)){var _0x416851=_0x78377f[_0x4e9d('0x1f')]-_0x43c216[_0x4e9d('0x1f')];_0xf2537f=_0x286bec[_0x4e9d('0x17')]?_0x286bec[_0x4e9d('0x17')]:moment();var _0x35235b=moment(_0xf2537f)[_0x4e9d('0x20')](_0x416851,'minutes');_0x3a66c7({'ret':_0x35235b[_0x4e9d('0x18')](_0x4e9d('0x19'))});}else _0x3a66c7({'ret':_0xf2537f});}else _0x3a66c7({'ret':_0xf2537f});}else{_0x3a66c7({'ret':_0xf2537f});}});}});return 0xa;}var _0x2bb0fc=function(_0x250b9f){return new BPromise(function(_0x1a3cde,_0x19e9d0){_0x3904cc(_0x250b9f,_0x193fb7)[_0x4e9d('0x22')](function(_0x419477){_0x193fb7[_0x4e9d('0x17')]=_0x419477['ret'];_0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x1c')]({'where':{'phone':_0x193fb7['phone'],'CampaignId':_0x250b9f['id']}})[_0x4e9d('0x22')](function(_0x374180){if(!_['isNil'](_0x374180)){throw new Error(_0x4e9d('0x29')+_0x193fb7['phone']+_0x4e9d('0x30')+_0x250b9f['id']);}return _0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x25')]({'phone':_0x193fb7['phone'],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7['ListId'],'priority':_0x193fb7[_0x4e9d('0x2d')]?_0x193fb7[_0x4e9d('0x2d')]:0x2,'scheduledat':_0x193fb7[_0x4e9d('0x17')]?_0x193fb7['scheduledat']:moment()[_0x4e9d('0x18')](_0x4e9d('0x19')),'callback':_0x193fb7[_0x4e9d('0x27')]?!![]:![],'callbackuniqueid':_0x193fb7['callbackUniqueid']?_0x193fb7['callbackUniqueid']:undefined,'callbackat':_0x193fb7[_0x4e9d('0x27')]?moment()[_0x4e9d('0x18')](_0x4e9d('0x19')):undefined,'CampaignId':_0x250b9f['id']});})[_0x4e9d('0x28')](function(_0x346909){_0x19e9d0(_0x346909);});});});};var _0x319c4b=function(_0x35e25e){return new BPromise(function(_0x4cc6c1,_0x487e6e){_0x3904cc(_0x35e25e,_0x193fb7)['then'](function(_0x169613){_0x193fb7[_0x4e9d('0x17')]=_0x169613[_0x4e9d('0x23')];_0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x1c')]({'where':{'phone':_0x193fb7['phone'],'CampaignId':_0x35e25e['id']}})[_0x4e9d('0x22')](function(_0x216c67){if(!_['isNil'](_0x216c67)){throw new Error(_0x4e9d('0x29')+_0x193fb7[_0x4e9d('0xc')]+_0x4e9d('0x31')+_0x35e25e['id']);}return _0x49869a['CmHopperFinal'][_0x4e9d('0x1c')]({'where':{'calleridnum':_0x193fb7[_0x4e9d('0xc')],'CampaignId':_0x35e25e['id']}});})['then'](function(_0x3ee511){if(!_['isNil'](_0x3ee511)){throw new Error(_0x4e9d('0x2c')+_0x193fb7['phone']+_0x4e9d('0x32')+_0x35e25e['id']);}return _0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x25')]({'phone':_0x193fb7[_0x4e9d('0xc')],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'priority':_0x193fb7[_0x4e9d('0x2d')]?_0x193fb7['priority']:0x2,'scheduledat':_0x193fb7[_0x4e9d('0x17')]?_0x193fb7[_0x4e9d('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x193fb7[_0x4e9d('0x27')]?!![]:![],'callbackuniqueid':_0x193fb7['callbackUniqueid']?_0x193fb7[_0x4e9d('0x27')]:undefined,'callbackat':_0x193fb7['callbackUniqueid']?moment()[_0x4e9d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x35e25e['id']});})['catch'](function(_0x2c8fac){_0x487e6e(_0x2c8fac);});});});};if(_0x193fb7[_0x4e9d('0x26')]){_0x49869a['VoiceQueue'][_0x4e9d('0x33')]({'where':{'type':_0x4e9d('0x34')},'attributes':['id',_0x4e9d('0x35'),_0x4e9d('0x1a')],'include':[{'model':_0x49869a[_0x4e9d('0x36')],'as':_0x4e9d('0x37'),'where':{'id':_0x193fb7[_0x4e9d('0x26')]}}]})['then'](function(_0x52ec9b){if(_0x52ec9b){var _0x2ab09d=[];for(var _0x5929fd=0x0,_0x113ebc;_0x5929fd<_0x52ec9b[_0x4e9d('0x38')];_0x5929fd+=0x1){_0x113ebc=_0x52ec9b[_0x5929fd][_0x4e9d('0x12')]({'plain':!![]});switch(_0x113ebc['dialCheckDuplicateType']){case _0x4e9d('0x39'):_0x12631a(_0x113ebc)[_0x4e9d('0x28')](_0x24cae8());break;case _0x4e9d('0x3a'):_0xfdd9dc(_0x113ebc)[_0x4e9d('0x28')](_0x24cae8());break;default:_0x3904cc(_0x113ebc,_0x193fb7)['then'](function(_0x20671e){_0x193fb7['scheduledat']=_0x20671e['ret'];_0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x25')]({'phone':_0x193fb7[_0x4e9d('0xc')],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'scheduledat':_0x193fb7[_0x4e9d('0x17')]?_0x193fb7[_0x4e9d('0x17')]:moment()['format'](_0x4e9d('0x19')),'priority':_0x193fb7[_0x4e9d('0x2d')]?_0x193fb7[_0x4e9d('0x2d')]:0x2,'callback':_0x193fb7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x193fb7[_0x4e9d('0x27')]?_0x193fb7[_0x4e9d('0x27')]:undefined,'callbackat':_0x193fb7[_0x4e9d('0x27')]?moment()['format'](_0x4e9d('0x19')):undefined,'VoiceQueueId':_0x113ebc['id']})[_0x4e9d('0x28')](_0x24cae8());});}}}})[_0x4e9d('0x22')](function(){return _0x49869a[_0x4e9d('0x1b')][_0x4e9d('0x33')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x49869a[_0x4e9d('0x36')],'as':_0x4e9d('0x3b'),'where':{'id':_0x193fb7[_0x4e9d('0x26')]}}]})[_0x4e9d('0x22')](function(_0x2a490){if(_0x2a490){var _0x5a1451=[];for(var _0x4f0fb0=0x0,_0x540139;_0x4f0fb0<_0x2a490[_0x4e9d('0x38')];_0x4f0fb0+=0x1){_0x540139=_0x2a490[_0x4f0fb0][_0x4e9d('0x12')]({'plain':!![]});_0x49869a['CmHopperBlack']['create']({'phone':_0x193fb7['phone'],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7['ListId'],'VoiceQueueId':_0x540139['id']})['catch'](function(_0x42e3f1){logger[_0x4e9d('0x13')](_0x4e9d('0x3c'),_0x4e9d('0x15'),_0x42e3f1[_0x4e9d('0x3d')]);});}}});})[_0x4e9d('0x22')](function(){return _0x49869a[_0x4e9d('0x2e')][_0x4e9d('0x33')]({'attributes':['id','dialCheckDuplicateType',_0x4e9d('0x1a')],'include':[{'model':_0x49869a[_0x4e9d('0x36')],'as':'Lists','where':{'id':_0x193fb7[_0x4e9d('0x26')]}}]})[_0x4e9d('0x22')](function(_0x2bf0b2){if(_0x2bf0b2){var _0x1b8d85=[];for(var _0x2b0fec=0x0,_0x21234d;_0x2b0fec<_0x2bf0b2['length'];_0x2b0fec+=0x1){_0x21234d=_0x2bf0b2[_0x2b0fec][_0x4e9d('0x12')]({'plain':!![]});switch(_0x21234d['dialCheckDuplicateType']){case'always':_0x319c4b(_0x21234d)[_0x4e9d('0x28')](_0x507b8c());break;case _0x4e9d('0x3a'):_0x2bb0fc(_0x21234d)[_0x4e9d('0x28')](_0x507b8c());break;default:_0x49869a[_0x4e9d('0x2f')][_0x4e9d('0x25')]({'phone':_0x193fb7[_0x4e9d('0xc')],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'scheduledat':_0x193fb7[_0x4e9d('0x17')]?_0x193fb7[_0x4e9d('0x17')]:moment()[_0x4e9d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x193fb7['priority']?_0x193fb7[_0x4e9d('0x2d')]:0x2,'callback':_0x193fb7[_0x4e9d('0x27')]?!![]:![],'callbackuniqueid':_0x193fb7['callbackUniqueid']?_0x193fb7[_0x4e9d('0x27')]:undefined,'callbackat':_0x193fb7[_0x4e9d('0x27')]?moment()[_0x4e9d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x21234d['id']})[_0x4e9d('0x28')](_0x507b8c());}}}});})[_0x4e9d('0x22')](function(){return _0x49869a[_0x4e9d('0x2e')][_0x4e9d('0x33')]({'attributes':['id'],'include':[{'model':_0x49869a[_0x4e9d('0x36')],'as':_0x4e9d('0x3b'),'where':{'id':_0x193fb7[_0x4e9d('0x26')]}}]})[_0x4e9d('0x22')](function(_0x78ffb){if(_0x78ffb){var _0x5e72dd=[];for(var _0x6c4799=0x0,_0x322834;_0x6c4799<_0x78ffb[_0x4e9d('0x38')];_0x6c4799+=0x1){_0x322834=_0x78ffb[_0x6c4799]['get']({'plain':!![]});_0x49869a[_0x4e9d('0x3e')][_0x4e9d('0x25')]({'phone':_0x193fb7[_0x4e9d('0xc')],'ContactId':_0x193fb7['id'],'ListId':_0x193fb7[_0x4e9d('0x26')],'CampaignId':_0x322834['id']})[_0x4e9d('0x28')](function(_0x3dea15){logger['error'](_0x4e9d('0x3c'),_0x4e9d('0x15'),_0x3dea15[_0x4e9d('0x3d')]);});}}});})[_0x4e9d('0x22')](function(){_0x299a7d();})['catch'](function(_0x9a3ef8){logger[_0x4e9d('0x13')](_0x4e9d('0x3c'),_0x4e9d('0x15'),_0x9a3ef8[_0x4e9d('0x3d')]);_0x299a7d(_0x9a3ef8);});}else{_0x299a7d(new Error(_0x4e9d('0x3f')));}},'afterDestroy':function(_0x592228,_0x138669,_0x528b32){var _0x58fac5=_0x2a9102[_0x4e9d('0x11')];var _0xe4b4d6=_0x592228[_0x4e9d('0x12')]({'plain':!![]});return _0x58fac5['CmHopper'][_0x4e9d('0x33')]({'raw':!![],'where':{'ListId':_0xe4b4d6[_0x4e9d('0x26')],'ContactId':_0xe4b4d6['id']}})[_0x4e9d('0x22')](function(_0x4676a2){if(!_[_0x4e9d('0x40')](_0x4676a2)){var _0x13fb51=[];for(var _0x3bb301=0x0;_0x3bb301<_0x4676a2[_0x4e9d('0x38')];_0x3bb301+=0x1){var _0x4db99b=_0x58fac5[_0x4e9d('0x2f')][_0x4e9d('0x41')]({'where':{'ListId':_0x4676a2[_0x3bb301]['ListId'],'ContactId':_0x4676a2[_0x3bb301][_0x4e9d('0x42')],'VoiceQueueId':_0x4676a2[_0x3bb301][_0x4e9d('0x43')],'CampaignId':_0x4676a2[_0x3bb301][_0x4e9d('0x44')]}});_0x13fb51[_0x4e9d('0x45')](_0x4db99b);}return BPromise[_0x4e9d('0x46')](_0x13fb51);}})[_0x4e9d('0x22')](function(_0x5cf467){logger[_0x4e9d('0x47')]('[CmContact][afterDestroy][Succesfull]',util[_0x4e9d('0x16')](_0x5cf467,{'showHidden':![],'depth':null}));_0x528b32();})[_0x4e9d('0x28')](function(_0x50aeac){logger['error']('[CmContact][afterDestroy][Error]',util[_0x4e9d('0x16')](_0x50aeac,{'showHidden':![],'depth':null}));_0x528b32(_0x50aeac);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f35d2f8..10d94a1 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x4dd1d7,_0x2fc174){var _0x1f8189=function(_0x107c9b){while(--_0x107c9b){_0x4dd1d7['push'](_0x4dd1d7['shift']());}};_0x1f8189(++_0x2fc174);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2bb70b,_0x52da8f){var _0x324fa4=function(_0x36cf3a){while(--_0x36cf3a){_0x2bb70b['push'](_0x2bb70b['shift']());}};_0x324fa4(++_0x52da8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 d646953..cceaad6 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 _0xa631=['exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa631,0xe4));var _0x1a63=function(_0x543f9f,_0x23f70d){_0x543f9f=_0x543f9f-0x0;var _0x1fa110=_0xa631[_0x543f9f];return _0x1fa110;};'use strict';var Sequelize=require('sequelize');module[_0x1a63('0x0')]={'CmContactId':{'type':Sequelize[_0x1a63('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1a63('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1a63('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x1a63('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x31c2=['sequelize','STRING','INTEGER','PHONE'];(function(_0x3277bc,_0x332058){var _0x58ca3c=function(_0xf00d9e){while(--_0xf00d9e){_0x3277bc['push'](_0x3277bc['shift']());}};_0x58ca3c(++_0x332058);}(_0x31c2,0x98));var _0x231c=function(_0x36f2b6,_0x39b4eb){_0x36f2b6=_0x36f2b6-0x0;var _0x1253bd=_0x31c2[_0x36f2b6];return _0x1253bd;};'use strict';var Sequelize=require(_0x231c('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x231c('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x231c('0x3')},'OrderBy':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x231c('0x1')],'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 17e13df..70d0115 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 _0x61b2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','error','stack','name','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','options','include','findAll','rows','show','params','find','catch','create','body','user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x34dd28,_0x127915){var _0x3f0b01=function(_0x1c1c00){while(--_0x1c1c00){_0x34dd28['push'](_0x34dd28['shift']());}};_0x3f0b01(++_0x127915);}(_0x61b2,0x1b5));var _0x261b=function(_0x1bf55e,_0x449a4a){_0x1bf55e=_0x1bf55e-0x0;var _0x1577a7=_0x61b2[_0x1bf55e];return _0x1577a7;};'use strict';var emlformat=require(_0x261b('0x0'));var rimraf=require(_0x261b('0x1'));var zipdir=require(_0x261b('0x2'));var jsonpatch=require(_0x261b('0x3'));var rp=require('request-promise');var moment=require(_0x261b('0x4'));var BPromise=require(_0x261b('0x5'));var Mustache=require(_0x261b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x261b('0x7'));var ejs=require(_0x261b('0x8'));var fs=require('fs');var fs_extra=require(_0x261b('0x9'));var _=require(_0x261b('0xa'));var squel=require(_0x261b('0xb'));var crypto=require(_0x261b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x261b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x261b('0xe'));var Papa=require(_0x261b('0xf'));var Redis=require(_0x261b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x261b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x261b('0x12'))(_0x261b('0x13'));var utils=require(_0x261b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x261b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43fdd1,_0xbd88fe){_0xbd88fe=_0xbd88fe||0xcc;return function(_0x3f7cc5){if(_0x3f7cc5){return _0x43fdd1[_0x261b('0x16')](_0xbd88fe);}return _0x43fdd1['status'](_0xbd88fe)[_0x261b('0x17')]();};}function respondWithResult(_0x53e013,_0x31617d){_0x31617d=_0x31617d||0xc8;return function(_0x27764b){if(_0x27764b){return _0x53e013['status'](_0x31617d)[_0x261b('0x18')](_0x27764b);}};}function respondWithFilteredResult(_0x3e7f82,_0x10d2e2){return function(_0x3bdb39){if(_0x3bdb39){var _0x39624c=typeof _0x10d2e2[_0x261b('0x19')]===_0x261b('0x1a')&&typeof _0x10d2e2['limit']===_0x261b('0x1a');var _0x20bcd4=_0x3bdb39[_0x261b('0x1b')];var _0x377a7f=_0x39624c?0x0:_0x10d2e2[_0x261b('0x19')];var _0x125a3e=_0x39624c?_0x3bdb39[_0x261b('0x1b')]:_0x10d2e2[_0x261b('0x19')]+_0x10d2e2[_0x261b('0x1c')];var _0x4eb9f6;if(_0x125a3e>=_0x20bcd4){_0x125a3e=_0x20bcd4;_0x4eb9f6=0xc8;}else{_0x4eb9f6=0xce;}_0x3e7f82[_0x261b('0x1d')](_0x4eb9f6);return _0x3e7f82[_0x261b('0x1e')](_0x261b('0x1f'),_0x377a7f+'-'+_0x125a3e+'/'+_0x20bcd4)[_0x261b('0x18')](_0x3bdb39);}return null;};}function patchUpdates(_0x2ac025){return function(_0x285080){try{jsonpatch[_0x261b('0x20')](_0x285080,_0x2ac025,!![]);}catch(_0x5caf3a){return BPromise[_0x261b('0x21')](_0x5caf3a);}return _0x285080[_0x261b('0x22')]();};}function saveUpdates(_0x365004,_0x4ff690){return function(_0x29795c){if(_0x29795c){return _0x29795c[_0x261b('0x23')](_0x365004)[_0x261b('0x24')](function(_0x57d775){return _0x57d775;});}return null;};}function removeEntity(_0x229efc,_0x1ef2a2){return function(_0x2629e1){if(_0x2629e1){return _0x2629e1[_0x261b('0x25')]()['then'](function(){var _0x2d44ff=_0x2629e1['get']({'plain':!![]});var _0x40ba05=_0x261b('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x40ba05,'resourceId':_0x2d44ff['id']}})[_0x261b('0x24')](function(){return _0x2629e1;});})['then'](function(){_0x229efc['status'](0xcc)[_0x261b('0x17')]();});}};}function handleEntityNotFound(_0x3dad39,_0x379488){return function(_0x2ddfd4){if(!_0x2ddfd4){_0x3dad39[_0x261b('0x16')](0x194);}return _0x2ddfd4;};}function handleError(_0x4945a5,_0x3c2f75){_0x3c2f75=_0x3c2f75||0x1f4;return function(_0x3ada56){logger[_0x261b('0x27')](_0x3ada56[_0x261b('0x28')]);if(_0x3ada56[_0x261b('0x29')]){delete _0x3ada56[_0x261b('0x29')];}_0x4945a5[_0x261b('0x1d')](_0x3c2f75)['send'](_0x3ada56);};}exports['index']=function(_0x50a6f3,_0x1cacda){var _0x3be1ec={},_0x38519e={},_0x89c89={'count':0x0,'rows':[]};var _0x4e6bdf=_['map'](db[_0x261b('0x2a')][_0x261b('0x2b')],function(_0xcdb11b){return{'name':_0xcdb11b[_0x261b('0x2c')],'type':_0xcdb11b[_0x261b('0x2d')]['key']};});_0x38519e[_0x261b('0x2e')]=_[_0x261b('0x2f')](_0x4e6bdf,_0x261b('0x29'));_0x38519e[_0x261b('0x30')]=_[_0x261b('0x31')](_0x50a6f3[_0x261b('0x30')]);_0x38519e[_0x261b('0x32')]=_[_0x261b('0x33')](_0x38519e['model'],_0x38519e['query']);_0x3be1ec[_0x261b('0x34')]=_[_0x261b('0x33')](_0x38519e[_0x261b('0x2e')],qs[_0x261b('0x35')](_0x50a6f3['query'][_0x261b('0x35')]));_0x3be1ec[_0x261b('0x34')]=_0x3be1ec[_0x261b('0x34')][_0x261b('0x36')]?_0x3be1ec['attributes']:_0x38519e[_0x261b('0x2e')];if(!_0x50a6f3['query']['hasOwnProperty'](_0x261b('0x37'))){_0x3be1ec[_0x261b('0x1c')]=qs['limit'](_0x50a6f3[_0x261b('0x30')][_0x261b('0x1c')]);_0x3be1ec[_0x261b('0x19')]=qs[_0x261b('0x19')](_0x50a6f3['query']['offset']);}_0x3be1ec['order']=qs[_0x261b('0x38')](_0x50a6f3[_0x261b('0x30')][_0x261b('0x38')]);_0x3be1ec[_0x261b('0x39')]=qs['filters'](_['pick'](_0x50a6f3[_0x261b('0x30')],_0x38519e['filters']),_0x4e6bdf);if(_0x50a6f3[_0x261b('0x30')][_0x261b('0x3a')]){_0x3be1ec[_0x261b('0x39')]=_['merge'](_0x3be1ec[_0x261b('0x39')],{'$or':_['map'](_0x4e6bdf,function(_0x2a8ddd){if(_0x2a8ddd['type']!=='VIRTUAL'){var _0x3d9538={};_0x3d9538[_0x2a8ddd[_0x261b('0x29')]]={'$like':'%'+_0x50a6f3[_0x261b('0x30')]['filter']+'%'};return _0x3d9538;}})});}_0x3be1ec=_['merge']({},_0x3be1ec,_0x50a6f3[_0x261b('0x3b')]);var _0x337e7e={'where':_0x3be1ec['where']};return db[_0x261b('0x2a')][_0x261b('0x1b')](_0x337e7e)[_0x261b('0x24')](function(_0xac7d60){_0x89c89['count']=_0xac7d60;if(_0x50a6f3[_0x261b('0x30')]['includeAll']){_0x3be1ec[_0x261b('0x3c')]=[{'all':!![]}];}return db[_0x261b('0x2a')][_0x261b('0x3d')](_0x3be1ec);})['then'](function(_0x1e830c){_0x89c89[_0x261b('0x3e')]=_0x1e830c;return _0x89c89;})[_0x261b('0x24')](respondWithFilteredResult(_0x1cacda,_0x3be1ec))['catch'](handleError(_0x1cacda,null));};exports[_0x261b('0x3f')]=function(_0x3d5e4d,_0x165260){var _0x52ab5e={'raw':!![],'where':{'id':_0x3d5e4d[_0x261b('0x40')]['id']}},_0x2021d5={};_0x2021d5['model']=_['keys'](db[_0x261b('0x2a')][_0x261b('0x2b')]);_0x2021d5[_0x261b('0x30')]=_[_0x261b('0x31')](_0x3d5e4d[_0x261b('0x30')]);_0x2021d5[_0x261b('0x32')]=_[_0x261b('0x33')](_0x2021d5[_0x261b('0x2e')],_0x2021d5['query']);_0x52ab5e[_0x261b('0x34')]=_[_0x261b('0x33')](_0x2021d5[_0x261b('0x2e')],qs[_0x261b('0x35')](_0x3d5e4d[_0x261b('0x30')][_0x261b('0x35')]));_0x52ab5e['attributes']=_0x52ab5e[_0x261b('0x34')]['length']?_0x52ab5e[_0x261b('0x34')]:_0x2021d5[_0x261b('0x2e')];if(_0x3d5e4d['query']['includeAll']){_0x52ab5e[_0x261b('0x3c')]=[{'all':!![]}];}_0x52ab5e=_['merge']({},_0x52ab5e,_0x3d5e4d[_0x261b('0x3b')]);return db['CmContactHasItem'][_0x261b('0x41')](_0x52ab5e)[_0x261b('0x24')](handleEntityNotFound(_0x165260,null))[_0x261b('0x24')](respondWithResult(_0x165260,null))[_0x261b('0x42')](handleError(_0x165260,null));};exports[_0x261b('0x43')]=function(_0x498068,_0xebe393){return db['CmContactHasItem']['create'](_0x498068[_0x261b('0x44')],{})[_0x261b('0x24')](function(_0x28b945){var _0x26cc76=_0x498068[_0x261b('0x45')]['get']({'plain':!![]});if(!_0x26cc76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26cc76[_0x261b('0x46')]===_0x261b('0x45')){var _0xb91f2=_0x28b945[_0x261b('0x47')]({'plain':!![]});var _0x316af9=_0x261b('0x26');return db[_0x261b('0x48')][_0x261b('0x41')]({'where':{'name':_0x316af9,'userProfileId':_0x26cc76['userProfileId']},'raw':!![]})[_0x261b('0x24')](function(_0x5b9b86){if(_0x5b9b86&&_0x5b9b86[_0x261b('0x49')]===0x0){return db['UserProfileResource'][_0x261b('0x43')]({'name':_0xb91f2[_0x261b('0x29')],'resourceId':_0xb91f2['id'],'type':_0x5b9b86[_0x261b('0x29')],'sectionId':_0x5b9b86['id']},{})[_0x261b('0x24')](function(){return _0x28b945;});}else{return _0x28b945;}})[_0x261b('0x42')](function(_0x51dcb1){logger[_0x261b('0x27')](_0x261b('0x4a'),_0x51dcb1);throw _0x51dcb1;});}return _0x28b945;})[_0x261b('0x24')](respondWithResult(_0xebe393,0xc9))['catch'](handleError(_0xebe393,null));};exports['update']=function(_0x29dfeb,_0x23593d){if(_0x29dfeb['body']['id']){delete _0x29dfeb['body']['id'];}return db[_0x261b('0x2a')][_0x261b('0x41')]({'where':{'id':_0x29dfeb[_0x261b('0x40')]['id']}})['then'](handleEntityNotFound(_0x23593d,null))['then'](saveUpdates(_0x29dfeb[_0x261b('0x44')],null))[_0x261b('0x24')](respondWithResult(_0x23593d,null))[_0x261b('0x42')](handleError(_0x23593d,null));};exports['destroy']=function(_0x455ae3,_0x47e5f8){return db[_0x261b('0x2a')][_0x261b('0x41')]({'where':{'id':_0x455ae3[_0x261b('0x40')]['id']}})[_0x261b('0x24')](handleEntityNotFound(_0x47e5f8,null))['then'](removeEntity(_0x47e5f8,null))[_0x261b('0x42')](handleError(_0x47e5f8,null));}; \ No newline at end of file +var _0xa78c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','CmContactHasItem','includeAll','findAll','rows','show','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xd9ac06,_0x5c76a8){var _0x1c57b7=function(_0x32143c){while(--_0x32143c){_0xd9ac06['push'](_0xd9ac06['shift']());}};_0x1c57b7(++_0x5c76a8);}(_0xa78c,0x14a));var _0xca78=function(_0x48dadf,_0x13db46){_0x48dadf=_0x48dadf-0x0;var _0x2bdc8a=_0xa78c[_0x48dadf];return _0x2bdc8a;};'use strict';var emlformat=require(_0xca78('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xca78('0x1'));var rp=require(_0xca78('0x2'));var moment=require(_0xca78('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xca78('0x4'));var util=require(_0xca78('0x5'));var path=require(_0xca78('0x6'));var sox=require(_0xca78('0x7'));var csv=require('to-csv');var ejs=require(_0xca78('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca78('0x9'));var squel=require('squel');var crypto=require(_0xca78('0xa'));var jsforce=require(_0xca78('0xb'));var deskjs=require(_0xca78('0xc'));var toCsv=require(_0xca78('0xd'));var querystring=require('querystring');var Papa=require(_0xca78('0xe'));var Redis=require(_0xca78('0xf'));var authService=require(_0xca78('0x10'));var qs=require(_0xca78('0x11'));var as=require(_0xca78('0x12'));var hardwareService=require(_0xca78('0x13'));var logger=require(_0xca78('0x14'))(_0xca78('0x15'));var utils=require(_0xca78('0x16'));var config=require(_0xca78('0x17'));var licenseUtil=require(_0xca78('0x18'));var db=require(_0xca78('0x19'))['db'];function respondWithStatusCode(_0x252fef,_0x5dec4b){_0x5dec4b=_0x5dec4b||0xcc;return function(_0x4b5f29){if(_0x4b5f29){return _0x252fef[_0xca78('0x1a')](_0x5dec4b);}return _0x252fef['status'](_0x5dec4b)[_0xca78('0x1b')]();};}function respondWithResult(_0x298a78,_0x2e88c1){_0x2e88c1=_0x2e88c1||0xc8;return function(_0x2f8ba0){if(_0x2f8ba0){return _0x298a78[_0xca78('0x1c')](_0x2e88c1)[_0xca78('0x1d')](_0x2f8ba0);}};}function respondWithFilteredResult(_0x59efdf,_0x1b4b57){return function(_0x5a8b4b){if(_0x5a8b4b){var _0x253faf=typeof _0x1b4b57[_0xca78('0x1e')]===_0xca78('0x1f')&&typeof _0x1b4b57[_0xca78('0x20')]===_0xca78('0x1f');var _0x45888b=_0x5a8b4b[_0xca78('0x21')];var _0x3b29a2=_0x253faf?0x0:_0x1b4b57['offset'];var _0x229d82=_0x253faf?_0x5a8b4b[_0xca78('0x21')]:_0x1b4b57[_0xca78('0x1e')]+_0x1b4b57[_0xca78('0x20')];var _0x47a0e1;if(_0x229d82>=_0x45888b){_0x229d82=_0x45888b;_0x47a0e1=0xc8;}else{_0x47a0e1=0xce;}_0x59efdf['status'](_0x47a0e1);return _0x59efdf['set'](_0xca78('0x22'),_0x3b29a2+'-'+_0x229d82+'/'+_0x45888b)[_0xca78('0x1d')](_0x5a8b4b);}return null;};}function patchUpdates(_0x20e856){return function(_0x344e5c){try{jsonpatch[_0xca78('0x23')](_0x344e5c,_0x20e856,!![]);}catch(_0x4dbb2c){return BPromise[_0xca78('0x24')](_0x4dbb2c);}return _0x344e5c[_0xca78('0x25')]();};}function saveUpdates(_0x5a0259,_0x31a4a3){return function(_0x296239){if(_0x296239){return _0x296239[_0xca78('0x26')](_0x5a0259)['then'](function(_0x4d2e76){return _0x4d2e76;});}return null;};}function removeEntity(_0x587277,_0x178076){return function(_0x2e8839){if(_0x2e8839){return _0x2e8839[_0xca78('0x27')]()[_0xca78('0x28')](function(){var _0x50dc60=_0x2e8839[_0xca78('0x29')]({'plain':!![]});var _0x29b089='CmContactHasItems';return db[_0xca78('0x2a')][_0xca78('0x27')]({'where':{'type':_0x29b089,'resourceId':_0x50dc60['id']}})[_0xca78('0x28')](function(){return _0x2e8839;});})[_0xca78('0x28')](function(){_0x587277['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0353c,_0x39d8a1){return function(_0x5847d8){if(!_0x5847d8){_0xa0353c[_0xca78('0x1a')](0x194);}return _0x5847d8;};}function handleError(_0x361df5,_0x2d2a33){_0x2d2a33=_0x2d2a33||0x1f4;return function(_0x5e668b){logger[_0xca78('0x2b')](_0x5e668b['stack']);if(_0x5e668b[_0xca78('0x2c')]){delete _0x5e668b['name'];}_0x361df5[_0xca78('0x1c')](_0x2d2a33)[_0xca78('0x2d')](_0x5e668b);};}exports[_0xca78('0x2e')]=function(_0x51bb6c,_0x16c564){var _0x2a2f88={},_0x3ece5e={},_0x284414={'count':0x0,'rows':[]};var _0x5ebfbb=_[_0xca78('0x2f')](db['CmContactHasItem'][_0xca78('0x30')],function(_0x154a4e){return{'name':_0x154a4e[_0xca78('0x31')],'type':_0x154a4e[_0xca78('0x32')][_0xca78('0x33')]};});_0x3ece5e[_0xca78('0x34')]=_[_0xca78('0x2f')](_0x5ebfbb,_0xca78('0x2c'));_0x3ece5e[_0xca78('0x35')]=_[_0xca78('0x36')](_0x51bb6c[_0xca78('0x35')]);_0x3ece5e[_0xca78('0x37')]=_[_0xca78('0x38')](_0x3ece5e['model'],_0x3ece5e['query']);_0x2a2f88[_0xca78('0x39')]=_[_0xca78('0x38')](_0x3ece5e[_0xca78('0x34')],qs[_0xca78('0x3a')](_0x51bb6c[_0xca78('0x35')][_0xca78('0x3a')]));_0x2a2f88[_0xca78('0x39')]=_0x2a2f88[_0xca78('0x39')][_0xca78('0x3b')]?_0x2a2f88[_0xca78('0x39')]:_0x3ece5e[_0xca78('0x34')];if(!_0x51bb6c[_0xca78('0x35')][_0xca78('0x3c')](_0xca78('0x3d'))){_0x2a2f88[_0xca78('0x20')]=qs[_0xca78('0x20')](_0x51bb6c[_0xca78('0x35')][_0xca78('0x20')]);_0x2a2f88[_0xca78('0x1e')]=qs[_0xca78('0x1e')](_0x51bb6c[_0xca78('0x35')][_0xca78('0x1e')]);}_0x2a2f88[_0xca78('0x3e')]=qs['sort'](_0x51bb6c[_0xca78('0x35')]['sort']);_0x2a2f88[_0xca78('0x3f')]=qs[_0xca78('0x37')](_[_0xca78('0x40')](_0x51bb6c['query'],_0x3ece5e[_0xca78('0x37')]),_0x5ebfbb);if(_0x51bb6c[_0xca78('0x35')][_0xca78('0x41')]){_0x2a2f88[_0xca78('0x3f')]=_['merge'](_0x2a2f88[_0xca78('0x3f')],{'$or':_[_0xca78('0x2f')](_0x5ebfbb,function(_0x26c5ca){if(_0x26c5ca['type']!==_0xca78('0x42')){var _0x15dd02={};_0x15dd02[_0x26c5ca[_0xca78('0x2c')]]={'$like':'%'+_0x51bb6c[_0xca78('0x35')][_0xca78('0x41')]+'%'};return _0x15dd02;}})});}_0x2a2f88=_[_0xca78('0x43')]({},_0x2a2f88,_0x51bb6c[_0xca78('0x44')]);var _0x590f1c={'where':_0x2a2f88[_0xca78('0x3f')]};return db[_0xca78('0x45')][_0xca78('0x21')](_0x590f1c)[_0xca78('0x28')](function(_0x1aeb82){_0x284414[_0xca78('0x21')]=_0x1aeb82;if(_0x51bb6c[_0xca78('0x35')][_0xca78('0x46')]){_0x2a2f88['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xca78('0x47')](_0x2a2f88);})[_0xca78('0x28')](function(_0x10521c){_0x284414[_0xca78('0x48')]=_0x10521c;return _0x284414;})['then'](respondWithFilteredResult(_0x16c564,_0x2a2f88))['catch'](handleError(_0x16c564,null));};exports[_0xca78('0x49')]=function(_0x3d9514,_0x263cd9){var _0x341462={'raw':!![],'where':{'id':_0x3d9514['params']['id']}},_0x3afcc1={};_0x3afcc1[_0xca78('0x34')]=_[_0xca78('0x36')](db[_0xca78('0x45')][_0xca78('0x30')]);_0x3afcc1[_0xca78('0x35')]=_[_0xca78('0x36')](_0x3d9514[_0xca78('0x35')]);_0x3afcc1[_0xca78('0x37')]=_['intersection'](_0x3afcc1[_0xca78('0x34')],_0x3afcc1['query']);_0x341462[_0xca78('0x39')]=_[_0xca78('0x38')](_0x3afcc1[_0xca78('0x34')],qs[_0xca78('0x3a')](_0x3d9514[_0xca78('0x35')][_0xca78('0x3a')]));_0x341462[_0xca78('0x39')]=_0x341462['attributes'][_0xca78('0x3b')]?_0x341462[_0xca78('0x39')]:_0x3afcc1[_0xca78('0x34')];if(_0x3d9514[_0xca78('0x35')]['includeAll']){_0x341462[_0xca78('0x4a')]=[{'all':!![]}];}_0x341462=_[_0xca78('0x43')]({},_0x341462,_0x3d9514['options']);return db[_0xca78('0x45')]['find'](_0x341462)[_0xca78('0x28')](handleEntityNotFound(_0x263cd9,null))[_0xca78('0x28')](respondWithResult(_0x263cd9,null))[_0xca78('0x4b')](handleError(_0x263cd9,null));};exports[_0xca78('0x4c')]=function(_0x3e5ce6,_0x3e0492){return db['CmContactHasItem']['create'](_0x3e5ce6['body'],{})[_0xca78('0x28')](function(_0x1d7021){var _0x292edb=_0x3e5ce6[_0xca78('0x4d')]['get']({'plain':!![]});if(!_0x292edb)throw new Error(_0xca78('0x4e'));if(_0x292edb['role']===_0xca78('0x4d')){var _0x2a539b=_0x1d7021[_0xca78('0x29')]({'plain':!![]});var _0x402e63=_0xca78('0x4f');return db[_0xca78('0x50')][_0xca78('0x51')]({'where':{'name':_0x402e63,'userProfileId':_0x292edb[_0xca78('0x52')]},'raw':!![]})[_0xca78('0x28')](function(_0x4c4f94){if(_0x4c4f94&&_0x4c4f94[_0xca78('0x53')]===0x0){return db[_0xca78('0x2a')]['create']({'name':_0x2a539b[_0xca78('0x2c')],'resourceId':_0x2a539b['id'],'type':_0x4c4f94['name'],'sectionId':_0x4c4f94['id']},{})[_0xca78('0x28')](function(){return _0x1d7021;});}else{return _0x1d7021;}})[_0xca78('0x4b')](function(_0x565fb1){logger['error'](_0xca78('0x54'),_0x565fb1);throw _0x565fb1;});}return _0x1d7021;})[_0xca78('0x28')](respondWithResult(_0x3e0492,0xc9))['catch'](handleError(_0x3e0492,null));};exports[_0xca78('0x26')]=function(_0xb648ba,_0x588237){if(_0xb648ba['body']['id']){delete _0xb648ba[_0xca78('0x55')]['id'];}return db[_0xca78('0x45')][_0xca78('0x51')]({'where':{'id':_0xb648ba['params']['id']}})[_0xca78('0x28')](handleEntityNotFound(_0x588237,null))[_0xca78('0x28')](saveUpdates(_0xb648ba[_0xca78('0x55')],null))[_0xca78('0x28')](respondWithResult(_0x588237,null))[_0xca78('0x4b')](handleError(_0x588237,null));};exports[_0xca78('0x27')]=function(_0x434877,_0x1ff7af){return db[_0xca78('0x45')][_0xca78('0x51')]({'where':{'id':_0x434877[_0xca78('0x56')]['id']}})[_0xca78('0x28')](handleEntityNotFound(_0x1ff7af,null))[_0xca78('0x28')](removeEntity(_0x1ff7af,null))[_0xca78('0x4b')](handleError(_0x1ff7af,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 125d4b7..eeffe67 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 _0x8e78=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0x8e78,0xdc));var _0x88e7=function(_0x14c37d,_0x59f2b8){_0x14c37d=_0x14c37d-0x0;var _0xc09aa6=_0x8e78[_0x14c37d];return _0xc09aa6;};'use strict';var _=require(_0x88e7('0x0'));var util=require(_0x88e7('0x1'));var logger=require(_0x88e7('0x2'))(_0x88e7('0x3'));var moment=require(_0x88e7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x88e7('0x5'));var rimraf=require(_0x88e7('0x6'));var config=require(_0x88e7('0x7'));var attributes=require(_0x88e7('0x8'));module[_0x88e7('0x9')]=function(_0x4c1384,_0x316ed7){return _0x4c1384[_0x88e7('0xa')](_0x88e7('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x119f=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x119f,0x1cb));var _0xf119=function(_0x27cc45,_0x8ba8fa){_0x27cc45=_0x27cc45-0x0;var _0x1e1c88=_0x119f[_0x27cc45];return _0x1e1c88;};'use strict';var _=require(_0xf119('0x0'));var util=require(_0xf119('0x1'));var logger=require(_0xf119('0x2'))('api');var moment=require(_0xf119('0x3'));var BPromise=require('bluebird');var rp=require(_0xf119('0x4'));var fs=require('fs');var path=require(_0xf119('0x5'));var rimraf=require(_0xf119('0x6'));var config=require(_0xf119('0x7'));var attributes=require(_0xf119('0x8'));module[_0xf119('0x9')]=function(_0x157219,_0x2947f4){return _0x157219[_0xf119('0xa')](_0xf119('0xb'),attributes,{'tableName':_0xf119('0xc'),'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 27670ad..9206e57 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 _0xd529=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd529,0x10d));var _0x9d52=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd529[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var moment=require(_0x9d52('0x2'));var BPromise=require(_0x9d52('0x3'));var rs=require(_0x9d52('0x4'));var fs=require('fs');var Redis=require(_0x9d52('0x5'));var db=require(_0x9d52('0x6'))['db'];var utils=require(_0x9d52('0x7'));var logger=require(_0x9d52('0x8'))('rpc');var config=require(_0x9d52('0x9'));var jayson=require(_0x9d52('0xa'));var client=jayson['client'][_0x9d52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38da68,_0x525ad9,_0x3097f0){return new BPromise(function(_0x31978c,_0x4a255f){return client['request'](_0x38da68,_0x3097f0)[_0x9d52('0xc')](function(_0x212253){logger[_0x9d52('0xd')](_0x9d52('0xe'),_0x525ad9,_0x9d52('0xf'));logger[_0x9d52('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x525ad9,_0x9d52('0xf'),JSON['stringify'](_0x212253));if(_0x212253[_0x9d52('0x11')]){if(_0x212253[_0x9d52('0x11')][_0x9d52('0x12')]===0x1f4){logger[_0x9d52('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x525ad9,_0x212253['error'][_0x9d52('0x13')]);return _0x4a255f(_0x212253['error'][_0x9d52('0x13')]);}logger['error'](_0x9d52('0xe'),_0x525ad9,_0x212253[_0x9d52('0x11')][_0x9d52('0x13')]);return _0x31978c(_0x212253[_0x9d52('0x11')]['message']);}else{logger[_0x9d52('0xd')](_0x9d52('0xe'),_0x525ad9,'request\x20sent');_0x31978c(_0x212253[_0x9d52('0x14')][_0x9d52('0x13')]);}})[_0x9d52('0x15')](function(_0x25d578){logger[_0x9d52('0x11')](_0x9d52('0xe'),_0x525ad9,_0x25d578);_0x4a255f(_0x25d578);});});} \ No newline at end of file +var _0x25ef=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x304d9d,_0x30ebe2){var _0x52653a=function(_0x16a4cb){while(--_0x16a4cb){_0x304d9d['push'](_0x304d9d['shift']());}};_0x52653a(++_0x30ebe2);}(_0x25ef,0x130));var _0xf25e=function(_0x513932,_0x4f5bc3){_0x513932=_0x513932-0x0;var _0x2250a0=_0x25ef[_0x513932];return _0x2250a0;};'use strict';var _=require(_0xf25e('0x0'));var util=require('util');var moment=require(_0xf25e('0x1'));var BPromise=require(_0xf25e('0x2'));var rs=require(_0xf25e('0x3'));var fs=require('fs');var Redis=require(_0xf25e('0x4'));var db=require(_0xf25e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf25e('0x6'))(_0xf25e('0x7'));var config=require(_0xf25e('0x8'));var jayson=require(_0xf25e('0x9'));var client=jayson[_0xf25e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0e4d,_0x4c51a5,_0x436b14){return new BPromise(function(_0x26d7b5,_0x11293d){return client[_0xf25e('0xb')](_0x1f0e4d,_0x436b14)[_0xf25e('0xc')](function(_0x5c1493){logger[_0xf25e('0xd')](_0xf25e('0xe'),_0x4c51a5,_0xf25e('0xf'));logger[_0xf25e('0x10')](_0xf25e('0x11'),_0x4c51a5,_0xf25e('0xf'),JSON['stringify'](_0x5c1493));if(_0x5c1493[_0xf25e('0x12')]){if(_0x5c1493['error'][_0xf25e('0x13')]===0x1f4){logger[_0xf25e('0x12')](_0xf25e('0xe'),_0x4c51a5,_0x5c1493[_0xf25e('0x12')][_0xf25e('0x14')]);return _0x11293d(_0x5c1493[_0xf25e('0x12')][_0xf25e('0x14')]);}logger[_0xf25e('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x4c51a5,_0x5c1493[_0xf25e('0x12')][_0xf25e('0x14')]);return _0x26d7b5(_0x5c1493['error'][_0xf25e('0x14')]);}else{logger[_0xf25e('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x4c51a5,_0xf25e('0xf'));_0x26d7b5(_0x5c1493['result']['message']);}})[_0xf25e('0x15')](function(_0x2d731c){logger['error'](_0xf25e('0xe'),_0x4c51a5,_0x2d731c);_0x11293d(_0x2d731c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e4db1a5..8a1c1c1 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 _0x1b07=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','post','put','delete','destroy','multer','util','path','express'];(function(_0x56dbe5,_0x57fa97){var _0x47009d=function(_0x2ed2db){while(--_0x2ed2db){_0x56dbe5['push'](_0x56dbe5['shift']());}};_0x47009d(++_0x57fa97);}(_0x1b07,0x1a0));var _0x71b0=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x1b07[_0x12ddb2];return _0x10b6dd;};'use strict';var multer=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var path=require(_0x71b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x71b0('0x3'));var router=express['Router']();var fs_extra=require(_0x71b0('0x4'));var auth=require(_0x71b0('0x5'));var interaction=require(_0x71b0('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x71b0('0x7')](),controller['index']);router['get'](_0x71b0('0x8'),auth[_0x71b0('0x7')](),controller[_0x71b0('0x9')]);router[_0x71b0('0xa')]('/',auth[_0x71b0('0x7')](),controller['create']);router[_0x71b0('0xb')](_0x71b0('0x8'),auth[_0x71b0('0x7')](),controller['update']);router[_0x71b0('0xc')]('/:id',auth[_0x71b0('0x7')](),controller[_0x71b0('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe469=['util','path','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','/:id','destroy','multer'];(function(_0x4600ca,_0x535057){var _0x2b6236=function(_0x45e68c){while(--_0x45e68c){_0x4600ca['push'](_0x4600ca['shift']());}};_0x2b6236(++_0x535057);}(_0xe469,0xef));var _0x9e46=function(_0x112d63,_0x922c48){_0x112d63=_0x112d63-0x0;var _0x5a6bdf=_0xe469[_0x112d63];return _0x5a6bdf;};'use strict';var multer=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var path=require(_0x9e46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e46('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e46('0x4'));var config=require(_0x9e46('0x5'));var controller=require(_0x9e46('0x6'));router[_0x9e46('0x7')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0x9')]);router[_0x9e46('0x7')]('/:id',auth[_0x9e46('0x8')](),controller[_0x9e46('0xa')]);router[_0x9e46('0xb')]('/',auth[_0x9e46('0x8')](),controller[_0x9e46('0xc')]);router[_0x9e46('0xd')](_0x9e46('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9e46('0xe'),auth[_0x9e46('0x8')](),controller[_0x9e46('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7e92008..a36ce93 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 _0x190f=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','type','select','parse','values','stringify','ENUM','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x190f,0x187));var _0xf190=function(_0x109596,_0x4f7b03){_0x109596=_0x109596-0x0;var _0x39faf2=_0x190f[_0x109596];return _0x39faf2;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf190('0x0'));module[_0xf190('0x1')]={'name':{'type':Sequelize[_0xf190('0x2')],'get':function(_0x582e92){return this[_0xf190('0x3')](_0xf190('0x4'));}},'alias':{'type':Sequelize[_0xf190('0x5')],'allowNull':![],'set':function(_0x503adf){this[_0xf190('0x6')](_0xf190('0x4'),_0x503adf?_0x503adf:this[_0xf190('0x3')](_0xf190('0x7')));}},'type':{'type':Sequelize[_0xf190('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xf190('0x3')](_0xf190('0x8'))===_0xf190('0x9')){return JSON[_0xf190('0xa')](this[_0xf190('0x3')](_0xf190('0xb')));}else{return this[_0xf190('0x3')]('values');}},'set':function(_0x43cc83){if(Array['isArray'](_0x43cc83)){this['setDataValue']('values',JSON[_0xf190('0xc')](_0x43cc83));}else{this[_0xf190('0x6')](_0xf190('0xb'),_0x43cc83);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf190('0xd')]('voice')}}; \ No newline at end of file +var _0xf3f4=['VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports'];(function(_0x427f98,_0x398545){var _0x5bd088=function(_0x34583a){while(--_0x34583a){_0x427f98['push'](_0x427f98['shift']());}};_0x5bd088(++_0x398545);}(_0xf3f4,0x1eb));var _0x4f3f=function(_0x32ca00,_0x487f8e){_0x32ca00=_0x32ca00-0x0;var _0x580cef=_0xf3f4[_0x32ca00];return _0x580cef;};'use strict';var Sequelize=require(_0x4f3f('0x0'));var _=require('lodash');module[_0x4f3f('0x1')]={'name':{'type':Sequelize[_0x4f3f('0x2')],'get':function(_0xcfe106){return this[_0x4f3f('0x3')](_0x4f3f('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3f7d69){this[_0x4f3f('0x5')]('alias',_0x3f7d69?_0x3f7d69:this[_0x4f3f('0x3')](_0x4f3f('0x6')));}},'type':{'type':Sequelize[_0x4f3f('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x4f3f('0x8')](_0x4f3f('0x9')),'get':function(){if(this[_0x4f3f('0x3')](_0x4f3f('0xa'))==='select'){return JSON['parse'](this[_0x4f3f('0x3')](_0x4f3f('0xb')));}else{return this[_0x4f3f('0x3')]('values');}},'set':function(_0x453911){if(Array[_0x4f3f('0xc')](_0x453911)){this[_0x4f3f('0x5')](_0x4f3f('0xb'),JSON[_0x4f3f('0xd')](_0x453911));}else{this['setDataValue'](_0x4f3f('0xb'),_0x453911);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4f3f('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4f3f('0xf')](_0x4f3f('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1490c5e..829f331 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 _0xd2b8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','map','CmCustomField','rawAttributes','differenceBy','name','filters','intersection','model','query','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','body','find','transaction','create','type','text','number','INTEGER','switch','Sequelize','BOOLEAN','sequelize','addColumn','cm_contacts','format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x43e603,_0x510e97){var _0x2e6cd1=function(_0x18615a){while(--_0x18615a){_0x43e603['push'](_0x43e603['shift']());}};_0x2e6cd1(++_0x510e97);}(_0xd2b8,0x132));var _0x8d2b=function(_0x2fb17a,_0x1341d8){_0x2fb17a=_0x2fb17a-0x0;var _0x9c7d94=_0xd2b8[_0x2fb17a];return _0x9c7d94;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d2b('0x0'));var rp=require(_0x8d2b('0x1'));var moment=require('moment');var BPromise=require(_0x8d2b('0x2'));var Mustache=require(_0x8d2b('0x3'));var util=require(_0x8d2b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8d2b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d2b('0x6'));var _=require(_0x8d2b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d2b('0x8'));var deskjs=require(_0x8d2b('0x9'));var toCsv=require(_0x8d2b('0x5'));var querystring=require(_0x8d2b('0xa'));var Papa=require(_0x8d2b('0xb'));var Redis=require(_0x8d2b('0xc'));var authService=require(_0x8d2b('0xd'));var qs=require(_0x8d2b('0xe'));var as=require(_0x8d2b('0xf'));var hardwareService=require(_0x8d2b('0x10'));var logger=require(_0x8d2b('0x11'))(_0x8d2b('0x12'));var utils=require(_0x8d2b('0x13'));var config=require(_0x8d2b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d2b('0x15'))['db'];function respondWithStatusCode(_0x313fc3,_0x1d1174){_0x1d1174=_0x1d1174||0xcc;return function(_0x32ae82){if(_0x32ae82){return _0x313fc3['sendStatus'](_0x1d1174);}return _0x313fc3[_0x8d2b('0x16')](_0x1d1174)[_0x8d2b('0x17')]();};}function respondWithResult(_0x25d64d,_0x556c65){_0x556c65=_0x556c65||0xc8;return function(_0x946e93){if(_0x946e93){return _0x25d64d[_0x8d2b('0x16')](_0x556c65)[_0x8d2b('0x18')](_0x946e93);}};}function respondWithFilteredResult(_0x65c48d,_0x35cabe){return function(_0x437b9a){if(_0x437b9a){var _0x4eb912=typeof _0x35cabe[_0x8d2b('0x19')]===_0x8d2b('0x1a')&&typeof _0x35cabe[_0x8d2b('0x1b')]===_0x8d2b('0x1a');var _0x2797b1=_0x437b9a[_0x8d2b('0x1c')];var _0x49e3f7=_0x4eb912?0x0:_0x35cabe[_0x8d2b('0x19')];var _0x3d0bdc=_0x4eb912?_0x437b9a[_0x8d2b('0x1c')]:_0x35cabe[_0x8d2b('0x19')]+_0x35cabe[_0x8d2b('0x1b')];var _0x2d8f49;if(_0x3d0bdc>=_0x2797b1){_0x3d0bdc=_0x2797b1;_0x2d8f49=0xc8;}else{_0x2d8f49=0xce;}_0x65c48d[_0x8d2b('0x16')](_0x2d8f49);return _0x65c48d[_0x8d2b('0x1d')](_0x8d2b('0x1e'),_0x49e3f7+'-'+_0x3d0bdc+'/'+_0x2797b1)[_0x8d2b('0x18')](_0x437b9a);}return null;};}function patchUpdates(_0x80c73c){return function(_0xa85e55){try{jsonpatch[_0x8d2b('0x1f')](_0xa85e55,_0x80c73c,!![]);}catch(_0x1e9594){return BPromise[_0x8d2b('0x20')](_0x1e9594);}return _0xa85e55[_0x8d2b('0x21')]();};}function saveUpdates(_0x55952a,_0x1dd3b5){return function(_0x1dbc9c){if(_0x1dbc9c){return _0x1dbc9c[_0x8d2b('0x22')](_0x55952a)[_0x8d2b('0x23')](function(_0x3e43d2){return _0x3e43d2;});}return null;};}function removeEntity(_0x5bc965,_0x119f5b){return function(_0x3f3ef1){if(_0x3f3ef1){return _0x3f3ef1[_0x8d2b('0x24')]()[_0x8d2b('0x23')](function(){_0x5bc965[_0x8d2b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdacad9,_0x3cd52a){return function(_0x7ee3ef){if(!_0x7ee3ef){_0xdacad9[_0x8d2b('0x25')](0x194);}return _0x7ee3ef;};}function handleError(_0x109078,_0x356f74){_0x356f74=_0x356f74||0x1f4;return function(_0x39b21b){logger['error'](_0x39b21b[_0x8d2b('0x26')]);if(_0x39b21b['name']){delete _0x39b21b['name'];}_0x109078[_0x8d2b('0x16')](_0x356f74)[_0x8d2b('0x27')](_0x39b21b);};}exports['index']=function(_0x527682,_0x25d5c4){var _0xd53157={},_0x5a890d={},_0x179bd7={'count':0x0,'rows':[]};var _0x28fad7=_[_0x8d2b('0x28')](db[_0x8d2b('0x29')][_0x8d2b('0x2a')],function(_0x5dfc99){return{'name':_0x5dfc99['fieldName'],'type':_0x5dfc99['type']['key']};});_0x5a890d['model']=_[_0x8d2b('0x2b')](_[_0x8d2b('0x28')](_0x28fad7,_0x8d2b('0x2c')),[_0x8d2b('0x2c')]);_0x5a890d['query']=_['keys'](_0x527682['query']);_0x5a890d[_0x8d2b('0x2d')]=_[_0x8d2b('0x2e')](_0x5a890d[_0x8d2b('0x2f')],_0x5a890d[_0x8d2b('0x30')]);_0xd53157['attributes']=_[_0x8d2b('0x2e')](_0x5a890d[_0x8d2b('0x2f')],qs[_0x8d2b('0x31')](_0x527682['query']['fields']));_0xd53157[_0x8d2b('0x32')]=_0xd53157['attributes'][_0x8d2b('0x33')]?_0xd53157[_0x8d2b('0x32')]:_0x5a890d[_0x8d2b('0x2f')];if(!_0x527682['query']['hasOwnProperty'](_0x8d2b('0x34'))){_0xd53157[_0x8d2b('0x1b')]=qs[_0x8d2b('0x1b')](_0x527682[_0x8d2b('0x30')][_0x8d2b('0x1b')]);_0xd53157[_0x8d2b('0x19')]=qs[_0x8d2b('0x19')](_0x527682[_0x8d2b('0x30')]['offset']);}_0xd53157[_0x8d2b('0x35')]=qs[_0x8d2b('0x36')](_0x527682[_0x8d2b('0x30')][_0x8d2b('0x36')]);_0xd53157['where']=qs[_0x8d2b('0x2d')](_['pick'](_0x527682[_0x8d2b('0x30')],_0x5a890d['filters']),_0x28fad7);if(_0x527682[_0x8d2b('0x30')][_0x8d2b('0x37')]){_0xd53157[_0x8d2b('0x38')]=_[_0x8d2b('0x39')](_0xd53157[_0x8d2b('0x38')],{'$or':_[_0x8d2b('0x28')](_0x28fad7,function(_0x440308){if(_0x440308['type']!==_0x8d2b('0x3a')){var _0x1d9796={};_0x1d9796[_0x440308[_0x8d2b('0x2c')]]={'$like':'%'+_0x527682[_0x8d2b('0x30')][_0x8d2b('0x37')]+'%'};return _0x1d9796;}})});}_0xd53157=_['merge']({},_0xd53157,_0x527682[_0x8d2b('0x3b')]);var _0x3bb58d={'where':_0xd53157[_0x8d2b('0x38')]};return db[_0x8d2b('0x29')]['count'](_0x3bb58d)[_0x8d2b('0x23')](function(_0x179c37){_0x179bd7[_0x8d2b('0x1c')]=_0x179c37;if(_0x527682[_0x8d2b('0x30')][_0x8d2b('0x3c')]){_0xd53157[_0x8d2b('0x3d')]=[{'all':!![]}];}return db[_0x8d2b('0x29')][_0x8d2b('0x3e')](_0xd53157);})['then'](function(_0x2ae1fc){_0x179bd7['rows']=_0x2ae1fc;return _0x179bd7;})[_0x8d2b('0x23')](respondWithFilteredResult(_0x25d5c4,_0xd53157))[_0x8d2b('0x3f')](handleError(_0x25d5c4,null));};exports['show']=function(_0x57ff8c,_0x4f5715){var _0x210549={'raw':!![],'where':{'id':_0x57ff8c[_0x8d2b('0x40')]['id']}},_0x4e683e={};_0x4e683e[_0x8d2b('0x2f')]=_['keys'](db[_0x8d2b('0x29')][_0x8d2b('0x2a')]);_0x4e683e[_0x8d2b('0x30')]=_['keys'](_0x57ff8c[_0x8d2b('0x30')]);_0x4e683e['filters']=_[_0x8d2b('0x2e')](_0x4e683e[_0x8d2b('0x2f')],_0x4e683e[_0x8d2b('0x30')]);_0x210549[_0x8d2b('0x32')]=_[_0x8d2b('0x2e')](_0x4e683e[_0x8d2b('0x2f')],qs[_0x8d2b('0x31')](_0x57ff8c[_0x8d2b('0x30')]['fields']));_0x210549[_0x8d2b('0x32')]=_0x210549[_0x8d2b('0x32')][_0x8d2b('0x33')]?_0x210549['attributes']:_0x4e683e[_0x8d2b('0x2f')];if(_0x57ff8c[_0x8d2b('0x30')][_0x8d2b('0x3c')]){_0x210549[_0x8d2b('0x3d')]=[{'all':!![]}];}_0x210549=_['merge']({},_0x210549,_0x57ff8c['options']);return db[_0x8d2b('0x29')]['find'](_0x210549)[_0x8d2b('0x23')](handleEntityNotFound(_0x4f5715,null))[_0x8d2b('0x23')](respondWithResult(_0x4f5715,null))[_0x8d2b('0x3f')](handleError(_0x4f5715,null));};exports[_0x8d2b('0x22')]=function(_0x4e4171,_0x46730b){if(_0x4e4171['body']['id']){delete _0x4e4171[_0x8d2b('0x41')]['id'];}return db[_0x8d2b('0x29')]['find']({'where':{'id':_0x4e4171[_0x8d2b('0x40')]['id']}})[_0x8d2b('0x23')](handleEntityNotFound(_0x46730b,null))[_0x8d2b('0x23')](saveUpdates(_0x4e4171[_0x8d2b('0x41')],null))[_0x8d2b('0x23')](respondWithResult(_0x46730b,null))[_0x8d2b('0x3f')](handleError(_0x46730b,null));};exports['destroy']=function(_0x1c2d73,_0x42fd4e){return db[_0x8d2b('0x29')][_0x8d2b('0x42')]({'where':{'id':_0x1c2d73[_0x8d2b('0x40')]['id']}})[_0x8d2b('0x23')](handleEntityNotFound(_0x42fd4e,null))['then'](removeEntity(_0x42fd4e,null))[_0x8d2b('0x3f')](handleError(_0x42fd4e,null));};exports['create']=function(_0x55efff,_0x4dc381){var _0x4259b0;return db['sequelize'][_0x8d2b('0x43')](function(_0x21adb4){return db[_0x8d2b('0x29')][_0x8d2b('0x44')](_0x55efff['body'],{'transaction':_0x21adb4})['then'](function(_0x3dce3e){_0x4259b0=_0x3dce3e;var _0x1b56e0={'type':db['Sequelize']['TEXT'],'transaction':_0x21adb4};switch(_0x55efff[_0x8d2b('0x41')][_0x8d2b('0x45')]){case _0x8d2b('0x46'):_0x1b56e0[_0x8d2b('0x45')]=db['Sequelize']['TEXT'];break;case _0x8d2b('0x47'):_0x1b56e0[_0x8d2b('0x45')]=db['Sequelize'][_0x8d2b('0x48')];break;case _0x8d2b('0x49'):_0x1b56e0[_0x8d2b('0x45')]=db[_0x8d2b('0x4a')][_0x8d2b('0x4b')];_0x1b56e0['defaultValue']=![];break;default:}return db[_0x8d2b('0x4c')]['queryInterface'][_0x8d2b('0x4d')](_0x8d2b('0x4e'),util[_0x8d2b('0x4f')]('cf_%d',_0x4259b0['id']),_0x1b56e0);})[_0x8d2b('0x23')](function(){return _0x4259b0;});})[_0x8d2b('0x23')](respondWithResult(_0x4dc381,0xc9))[_0x8d2b('0x3f')](handleError(_0x4dc381,null));}; \ No newline at end of file +var _0x5c0b=['util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','differenceBy','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','sequelize','transaction','TEXT','text','number','INTEGER','switch','Sequelize','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x5c0b,0xae));var _0xb5c0=function(_0x3dce43,_0x237a77){_0x3dce43=_0x3dce43-0x0;var _0x386904=_0x5c0b[_0x3dce43];return _0x386904;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5c0('0x0'));var zipdir=require(_0xb5c0('0x1'));var jsonpatch=require(_0xb5c0('0x2'));var rp=require(_0xb5c0('0x3'));var moment=require(_0xb5c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5c0('0x5'));var util=require(_0xb5c0('0x6'));var path=require(_0xb5c0('0x7'));var sox=require(_0xb5c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5c0('0x9'));var _=require(_0xb5c0('0xa'));var squel=require(_0xb5c0('0xb'));var crypto=require(_0xb5c0('0xc'));var jsforce=require(_0xb5c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb5c0('0xe'));var querystring=require('querystring');var Papa=require(_0xb5c0('0xf'));var Redis=require(_0xb5c0('0x10'));var authService=require(_0xb5c0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5c0('0x12'));var logger=require('../../config/logger')(_0xb5c0('0x13'));var utils=require(_0xb5c0('0x14'));var config=require(_0xb5c0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5c0('0x16'))['db'];function respondWithStatusCode(_0x49d22e,_0x5680c7){_0x5680c7=_0x5680c7||0xcc;return function(_0x3da383){if(_0x3da383){return _0x49d22e['sendStatus'](_0x5680c7);}return _0x49d22e[_0xb5c0('0x17')](_0x5680c7)[_0xb5c0('0x18')]();};}function respondWithResult(_0x468ee5,_0x463389){_0x463389=_0x463389||0xc8;return function(_0x33fc3b){if(_0x33fc3b){return _0x468ee5[_0xb5c0('0x17')](_0x463389)[_0xb5c0('0x19')](_0x33fc3b);}};}function respondWithFilteredResult(_0x4af794,_0xbdf156){return function(_0x3fee00){if(_0x3fee00){var _0x2bbd66=typeof _0xbdf156[_0xb5c0('0x1a')]===_0xb5c0('0x1b')&&typeof _0xbdf156['limit']===_0xb5c0('0x1b');var _0x57a4c2=_0x3fee00[_0xb5c0('0x1c')];var _0x3a68c4=_0x2bbd66?0x0:_0xbdf156[_0xb5c0('0x1a')];var _0x1c09b2=_0x2bbd66?_0x3fee00[_0xb5c0('0x1c')]:_0xbdf156['offset']+_0xbdf156[_0xb5c0('0x1d')];var _0x324480;if(_0x1c09b2>=_0x57a4c2){_0x1c09b2=_0x57a4c2;_0x324480=0xc8;}else{_0x324480=0xce;}_0x4af794[_0xb5c0('0x17')](_0x324480);return _0x4af794['set'](_0xb5c0('0x1e'),_0x3a68c4+'-'+_0x1c09b2+'/'+_0x57a4c2)[_0xb5c0('0x19')](_0x3fee00);}return null;};}function patchUpdates(_0x3226ee){return function(_0x441bb0){try{jsonpatch[_0xb5c0('0x1f')](_0x441bb0,_0x3226ee,!![]);}catch(_0x4cddb6){return BPromise[_0xb5c0('0x20')](_0x4cddb6);}return _0x441bb0[_0xb5c0('0x21')]();};}function saveUpdates(_0x34c683,_0x41f20f){return function(_0x41e737){if(_0x41e737){return _0x41e737[_0xb5c0('0x22')](_0x34c683)[_0xb5c0('0x23')](function(_0xc43699){return _0xc43699;});}return null;};}function removeEntity(_0x530e6a,_0x520faa){return function(_0x4dd6ef){if(_0x4dd6ef){return _0x4dd6ef[_0xb5c0('0x24')]()['then'](function(){_0x530e6a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f521b,_0x428dc8){return function(_0x196207){if(!_0x196207){_0x1f521b[_0xb5c0('0x25')](0x194);}return _0x196207;};}function handleError(_0x1a184a,_0x2d3391){_0x2d3391=_0x2d3391||0x1f4;return function(_0x565628){logger['error'](_0x565628[_0xb5c0('0x26')]);if(_0x565628[_0xb5c0('0x27')]){delete _0x565628[_0xb5c0('0x27')];}_0x1a184a[_0xb5c0('0x17')](_0x2d3391)[_0xb5c0('0x28')](_0x565628);};}exports[_0xb5c0('0x29')]=function(_0x163f5a,_0x8b6d00){var _0x354e5b={},_0x14824f={},_0x47f68f={'count':0x0,'rows':[]};var _0x536f7a=_['map'](db[_0xb5c0('0x2a')][_0xb5c0('0x2b')],function(_0x187b36){return{'name':_0x187b36[_0xb5c0('0x2c')],'type':_0x187b36[_0xb5c0('0x2d')]['key']};});_0x14824f['model']=_[_0xb5c0('0x2e')](_[_0xb5c0('0x2f')](_0x536f7a,'name'),[_0xb5c0('0x27')]);_0x14824f[_0xb5c0('0x30')]=_['keys'](_0x163f5a[_0xb5c0('0x30')]);_0x14824f[_0xb5c0('0x31')]=_[_0xb5c0('0x32')](_0x14824f[_0xb5c0('0x33')],_0x14824f['query']);_0x354e5b[_0xb5c0('0x34')]=_['intersection'](_0x14824f[_0xb5c0('0x33')],qs[_0xb5c0('0x35')](_0x163f5a[_0xb5c0('0x30')]['fields']));_0x354e5b['attributes']=_0x354e5b[_0xb5c0('0x34')][_0xb5c0('0x36')]?_0x354e5b[_0xb5c0('0x34')]:_0x14824f[_0xb5c0('0x33')];if(!_0x163f5a['query'][_0xb5c0('0x37')](_0xb5c0('0x38'))){_0x354e5b[_0xb5c0('0x1d')]=qs['limit'](_0x163f5a[_0xb5c0('0x30')][_0xb5c0('0x1d')]);_0x354e5b[_0xb5c0('0x1a')]=qs[_0xb5c0('0x1a')](_0x163f5a['query']['offset']);}_0x354e5b[_0xb5c0('0x39')]=qs[_0xb5c0('0x3a')](_0x163f5a[_0xb5c0('0x30')][_0xb5c0('0x3a')]);_0x354e5b[_0xb5c0('0x3b')]=qs['filters'](_[_0xb5c0('0x3c')](_0x163f5a[_0xb5c0('0x30')],_0x14824f[_0xb5c0('0x31')]),_0x536f7a);if(_0x163f5a[_0xb5c0('0x30')]['filter']){_0x354e5b[_0xb5c0('0x3b')]=_[_0xb5c0('0x3d')](_0x354e5b[_0xb5c0('0x3b')],{'$or':_[_0xb5c0('0x2f')](_0x536f7a,function(_0x34fed8){if(_0x34fed8['type']!==_0xb5c0('0x3e')){var _0x10378d={};_0x10378d[_0x34fed8['name']]={'$like':'%'+_0x163f5a[_0xb5c0('0x30')][_0xb5c0('0x3f')]+'%'};return _0x10378d;}})});}_0x354e5b=_[_0xb5c0('0x3d')]({},_0x354e5b,_0x163f5a[_0xb5c0('0x40')]);var _0x393b13={'where':_0x354e5b[_0xb5c0('0x3b')]};return db[_0xb5c0('0x2a')]['count'](_0x393b13)[_0xb5c0('0x23')](function(_0x3f2669){_0x47f68f[_0xb5c0('0x1c')]=_0x3f2669;if(_0x163f5a[_0xb5c0('0x30')][_0xb5c0('0x41')]){_0x354e5b[_0xb5c0('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0xb5c0('0x43')](_0x354e5b);})[_0xb5c0('0x23')](function(_0x360814){_0x47f68f[_0xb5c0('0x44')]=_0x360814;return _0x47f68f;})['then'](respondWithFilteredResult(_0x8b6d00,_0x354e5b))[_0xb5c0('0x45')](handleError(_0x8b6d00,null));};exports[_0xb5c0('0x46')]=function(_0x4c3446,_0x30aa58){var _0x88bbaf={'raw':!![],'where':{'id':_0x4c3446[_0xb5c0('0x47')]['id']}},_0x4a409a={};_0x4a409a[_0xb5c0('0x33')]=_[_0xb5c0('0x48')](db[_0xb5c0('0x2a')][_0xb5c0('0x2b')]);_0x4a409a['query']=_[_0xb5c0('0x48')](_0x4c3446[_0xb5c0('0x30')]);_0x4a409a[_0xb5c0('0x31')]=_[_0xb5c0('0x32')](_0x4a409a['model'],_0x4a409a[_0xb5c0('0x30')]);_0x88bbaf['attributes']=_[_0xb5c0('0x32')](_0x4a409a[_0xb5c0('0x33')],qs[_0xb5c0('0x35')](_0x4c3446['query'][_0xb5c0('0x35')]));_0x88bbaf[_0xb5c0('0x34')]=_0x88bbaf[_0xb5c0('0x34')][_0xb5c0('0x36')]?_0x88bbaf[_0xb5c0('0x34')]:_0x4a409a['model'];if(_0x4c3446[_0xb5c0('0x30')][_0xb5c0('0x41')]){_0x88bbaf[_0xb5c0('0x42')]=[{'all':!![]}];}_0x88bbaf=_[_0xb5c0('0x3d')]({},_0x88bbaf,_0x4c3446['options']);return db[_0xb5c0('0x2a')][_0xb5c0('0x49')](_0x88bbaf)[_0xb5c0('0x23')](handleEntityNotFound(_0x30aa58,null))[_0xb5c0('0x23')](respondWithResult(_0x30aa58,null))[_0xb5c0('0x45')](handleError(_0x30aa58,null));};exports[_0xb5c0('0x22')]=function(_0x4b64c4,_0x2a0832){if(_0x4b64c4[_0xb5c0('0x4a')]['id']){delete _0x4b64c4['body']['id'];}return db['CmCustomField'][_0xb5c0('0x49')]({'where':{'id':_0x4b64c4[_0xb5c0('0x47')]['id']}})[_0xb5c0('0x23')](handleEntityNotFound(_0x2a0832,null))[_0xb5c0('0x23')](saveUpdates(_0x4b64c4['body'],null))[_0xb5c0('0x23')](respondWithResult(_0x2a0832,null))['catch'](handleError(_0x2a0832,null));};exports[_0xb5c0('0x24')]=function(_0xa984ca,_0x6bd754){return db[_0xb5c0('0x2a')][_0xb5c0('0x49')]({'where':{'id':_0xa984ca[_0xb5c0('0x47')]['id']}})[_0xb5c0('0x23')](handleEntityNotFound(_0x6bd754,null))[_0xb5c0('0x23')](removeEntity(_0x6bd754,null))[_0xb5c0('0x45')](handleError(_0x6bd754,null));};exports[_0xb5c0('0x4b')]=function(_0x41ef6b,_0x572776){var _0x21eebd;return db[_0xb5c0('0x4c')][_0xb5c0('0x4d')](function(_0x205bbf){return db[_0xb5c0('0x2a')][_0xb5c0('0x4b')](_0x41ef6b['body'],{'transaction':_0x205bbf})[_0xb5c0('0x23')](function(_0x17f761){_0x21eebd=_0x17f761;var _0x1b8a46={'type':db['Sequelize'][_0xb5c0('0x4e')],'transaction':_0x205bbf};switch(_0x41ef6b['body'][_0xb5c0('0x2d')]){case _0xb5c0('0x4f'):_0x1b8a46[_0xb5c0('0x2d')]=db['Sequelize'][_0xb5c0('0x4e')];break;case _0xb5c0('0x50'):_0x1b8a46[_0xb5c0('0x2d')]=db['Sequelize'][_0xb5c0('0x51')];break;case _0xb5c0('0x52'):_0x1b8a46[_0xb5c0('0x2d')]=db[_0xb5c0('0x53')]['BOOLEAN'];_0x1b8a46[_0xb5c0('0x54')]=![];break;default:}return db[_0xb5c0('0x4c')][_0xb5c0('0x55')][_0xb5c0('0x56')](_0xb5c0('0x57'),util[_0xb5c0('0x58')](_0xb5c0('0x59'),_0x21eebd['id']),_0x1b8a46);})['then'](function(){return _0x21eebd;});})[_0xb5c0('0x23')](respondWithResult(_0x572776,0xc9))[_0xb5c0('0x45')](handleError(_0x572776,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e5ce435..f91e769 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 _0x19a8=['cm_custom_fields','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x1c97c8,_0x28d564){var _0x2c096d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x1c97c8['push'](_0x1c97c8['shift']());}};_0x2c096d(++_0x28d564);}(_0x19a8,0x1a5));var _0x819a=function(_0x31edc9,_0x4404a1){_0x31edc9=_0x31edc9-0x0;var _0x4d1cd4=_0x19a8[_0x31edc9];return _0x4d1cd4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x819a('0x0'))(_0x819a('0x1'));var moment=require('moment');var BPromise=require(_0x819a('0x2'));var rp=require(_0x819a('0x3'));var fs=require('fs');var path=require(_0x819a('0x4'));var rimraf=require(_0x819a('0x5'));var config=require(_0x819a('0x6'));var attributes=require(_0x819a('0x7'));module[_0x819a('0x8')]=function(_0x1cfb8b,_0x10cfda){return _0x1cfb8b[_0x819a('0x9')](_0x819a('0xa'),attributes,{'tableName':_0x819a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x006e=['exports','define','CmCustomField','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x53e4a6,_0x478d81){var _0x2044c1=function(_0x44b5cf){while(--_0x44b5cf){_0x53e4a6['push'](_0x53e4a6['shift']());}};_0x2044c1(++_0x478d81);}(_0x006e,0xc3));var _0xe006=function(_0x17ef88,_0x581af4){_0x17ef88=_0x17ef88-0x0;var _0x1dc0fc=_0x006e[_0x17ef88];return _0x1dc0fc;};'use strict';var _=require(_0xe006('0x0'));var util=require(_0xe006('0x1'));var logger=require(_0xe006('0x2'))('api');var moment=require(_0xe006('0x3'));var BPromise=require(_0xe006('0x4'));var rp=require(_0xe006('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe006('0x6'));var config=require(_0xe006('0x7'));var attributes=require(_0xe006('0x8'));module[_0xe006('0x9')]=function(_0x9afbea,_0x5106a5){return _0x9afbea[_0xe006('0xa')](_0xe006('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 b33651d..9208963 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 _0xa635=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x457ba4,_0x3fe3db){var _0xaca6f=function(_0xc0421){while(--_0xc0421){_0x457ba4['push'](_0x457ba4['shift']());}};_0xaca6f(++_0x3fe3db);}(_0xa635,0x73));var _0x5a63=function(_0x63b6c3,_0x5c3125){_0x63b6c3=_0x63b6c3-0x0;var _0x1b01f9=_0xa635[_0x63b6c3];return _0x1b01f9;};'use strict';var _=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var moment=require(_0x5a63('0x2'));var BPromise=require(_0x5a63('0x3'));var rs=require(_0x5a63('0x4'));var fs=require('fs');var Redis=require(_0x5a63('0x5'));var db=require(_0x5a63('0x6'))['db'];var utils=require(_0x5a63('0x7'));var logger=require('../../config/logger')(_0x5a63('0x8'));var config=require(_0x5a63('0x9'));var jayson=require(_0x5a63('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fca04,_0x4d4c0,_0x5c5b07){return new BPromise(function(_0x2a6e0f,_0x572aea){return client['request'](_0x2fca04,_0x5c5b07)[_0x5a63('0xb')](function(_0x4cf89a){logger[_0x5a63('0xc')](_0x5a63('0xd'),_0x4d4c0,_0x5a63('0xe'));logger[_0x5a63('0xf')](_0x5a63('0x10'),_0x4d4c0,_0x5a63('0xe'),JSON[_0x5a63('0x11')](_0x4cf89a));if(_0x4cf89a[_0x5a63('0x12')]){if(_0x4cf89a[_0x5a63('0x12')][_0x5a63('0x13')]===0x1f4){logger[_0x5a63('0x12')](_0x5a63('0xd'),_0x4d4c0,_0x4cf89a[_0x5a63('0x12')][_0x5a63('0x14')]);return _0x572aea(_0x4cf89a['error'][_0x5a63('0x14')]);}logger[_0x5a63('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4d4c0,_0x4cf89a[_0x5a63('0x12')]['message']);return _0x2a6e0f(_0x4cf89a['error'][_0x5a63('0x14')]);}else{logger[_0x5a63('0xc')]('CmCustomField,\x20%s,\x20%s',_0x4d4c0,_0x5a63('0xe'));_0x2a6e0f(_0x4cf89a[_0x5a63('0x15')]['message']);}})[_0x5a63('0x16')](function(_0x11f4f){logger[_0x5a63('0x12')](_0x5a63('0xd'),_0x4d4c0,_0x11f4f);_0x572aea(_0x11f4f);});});} \ No newline at end of file +var _0x95b4=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message'];(function(_0xe36b9a,_0x400e8e){var _0x85d06c=function(_0x5e6b6a){while(--_0x5e6b6a){_0xe36b9a['push'](_0xe36b9a['shift']());}};_0x85d06c(++_0x400e8e);}(_0x95b4,0x120));var _0x495b=function(_0x2744ff,_0x2ba52e){_0x2744ff=_0x2744ff-0x0;var _0x42a798=_0x95b4[_0x2744ff];return _0x42a798;};'use strict';var _=require(_0x495b('0x0'));var util=require(_0x495b('0x1'));var moment=require(_0x495b('0x2'));var BPromise=require('bluebird');var rs=require(_0x495b('0x3'));var fs=require('fs');var Redis=require(_0x495b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x495b('0x5'));var logger=require(_0x495b('0x6'))(_0x495b('0x7'));var config=require(_0x495b('0x8'));var jayson=require(_0x495b('0x9'));var client=jayson[_0x495b('0xa')][_0x495b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc67fdf,_0x17e815,_0x4bf5ee){return new BPromise(function(_0x42ddbd,_0x32d13c){return client[_0x495b('0xc')](_0xc67fdf,_0x4bf5ee)[_0x495b('0xd')](function(_0x8e522c){logger[_0x495b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x17e815,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x17e815,_0x495b('0xf'),JSON['stringify'](_0x8e522c));if(_0x8e522c[_0x495b('0x10')]){if(_0x8e522c['error'][_0x495b('0x11')]===0x1f4){logger[_0x495b('0x10')]('CmCustomField,\x20%s,\x20%s',_0x17e815,_0x8e522c[_0x495b('0x10')]['message']);return _0x32d13c(_0x8e522c['error']['message']);}logger[_0x495b('0x10')](_0x495b('0x12'),_0x17e815,_0x8e522c['error'][_0x495b('0x13')]);return _0x42ddbd(_0x8e522c[_0x495b('0x10')][_0x495b('0x13')]);}else{logger[_0x495b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x17e815,_0x495b('0xf'));_0x42ddbd(_0x8e522c[_0x495b('0x14')][_0x495b('0x13')]);}})[_0x495b('0x15')](function(_0x195c09){logger[_0x495b('0x10')](_0x495b('0x12'),_0x17e815,_0x195c09);_0x32d13c(_0x195c09);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index cf9b0b5..76f7d95 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 _0x16a6=['get','/:id','post','create','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller'];(function(_0x42eff9,_0x14ec4d){var _0x5ef4d5=function(_0x4c8a37){while(--_0x4c8a37){_0x42eff9['push'](_0x42eff9['shift']());}};_0x5ef4d5(++_0x14ec4d);}(_0x16a6,0x15c));var _0x616a=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x16a6[_0x5a6de2];return _0x2c0525;};'use strict';var multer=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var path=require('path');var timeout=require(_0x616a('0x2'));var express=require(_0x616a('0x3'));var router=express[_0x616a('0x4')]();var fs_extra=require(_0x616a('0x5'));var auth=require(_0x616a('0x6'));var interaction=require(_0x616a('0x7'));var config=require('../../config/environment');var controller=require(_0x616a('0x8'));router[_0x616a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x616a('0x9')](_0x616a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x616a('0xb')]('/',auth['isAuthenticated'](),controller[_0x616a('0xc')]);router['put'](_0x616a('0xa'),auth[_0x616a('0xd')](),controller[_0x616a('0xe')]);router['delete'](_0x616a('0xa'),auth[_0x616a('0xd')](),controller[_0x616a('0xf')]);module[_0x616a('0x10')]=router; \ No newline at end of file +var _0xf3fe=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','show','post'];(function(_0x4e2c59,_0x2526dc){var _0x471456=function(_0x303926){while(--_0x303926){_0x4e2c59['push'](_0x4e2c59['shift']());}};_0x471456(++_0x2526dc);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x5ede89,_0x5cb96b){_0x5ede89=_0x5ede89-0x0;var _0x506cd0=_0xf3fe[_0x5ede89];return _0x506cd0;};'use strict';var multer=require('multer');var util=require(_0xef3f('0x0'));var path=require(_0xef3f('0x1'));var timeout=require(_0xef3f('0x2'));var express=require(_0xef3f('0x3'));var router=express[_0xef3f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef3f('0x5'));var interaction=require(_0xef3f('0x6'));var config=require(_0xef3f('0x7'));var controller=require(_0xef3f('0x8'));router[_0xef3f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xef3f('0x9')](_0xef3f('0xa'),auth[_0xef3f('0xb')](),controller[_0xef3f('0xc')]);router[_0xef3f('0xd')]('/',auth[_0xef3f('0xb')](),controller[_0xef3f('0xe')]);router[_0xef3f('0xf')](_0xef3f('0xa'),auth['isAuthenticated'](),controller[_0xef3f('0x10')]);router['delete'](_0xef3f('0xa'),auth[_0xef3f('0xb')](),controller[_0xef3f('0x11')]);module[_0xef3f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 55ea0c2..ff2f8e1 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 _0xf5f9=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','STRING','BOOLEAN','DATE'];(function(_0xaa197b,_0x4fe403){var _0x5a407f=function(_0x49dc9a){while(--_0x49dc9a){_0xaa197b['push'](_0xaa197b['shift']());}};_0x5a407f(++_0x4fe403);}(_0xf5f9,0x1a8));var _0x9f5f=function(_0x2f7802,_0x29a4a3){_0x2f7802=_0x2f7802-0x0;var _0x29b223=_0xf5f9[_0x2f7802];return _0x29b223;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x9f5f('0x0')],'allowNull':![]},'active':{'type':Sequelize[_0x9f5f('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9f5f('0x2')],'defaultValue':moment()[_0x9f5f('0x3')](_0x9f5f('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9f5f('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9f5f('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9f5f('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9f5f('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9f5f('0x6')},'ListId':{'type':Sequelize[_0x9f5f('0x5')],'unique':_0x9f5f('0x6')},'UserId':{'type':Sequelize[_0x9f5f('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x9f5f('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x9f5f('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9f5f('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x9f5f('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x176b=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment'];(function(_0x84f4c2,_0x2d71ca){var _0x36cf57=function(_0x4349c8){while(--_0x4349c8){_0x84f4c2['push'](_0x84f4c2['shift']());}};_0x36cf57(++_0x2d71ca);}(_0x176b,0x103));var _0xb176=function(_0x53e0f9,_0x2c84f0){_0x53e0f9=_0x53e0f9-0x0;var _0x46afe5=_0x176b[_0x53e0f9];return _0x46afe5;};'use strict';var moment=require(_0xb176('0x0'));var Sequelize=require(_0xb176('0x1'));module[_0xb176('0x2')]={'phone':{'type':Sequelize[_0xb176('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb176('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb176('0x5')],'defaultValue':moment()[_0xb176('0x6')](_0xb176('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb176('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb176('0x5')]},'priority':{'type':Sequelize[_0xb176('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb176('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb176('0x8')],'unique':_0xb176('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xb176('0x8')],'unique':_0xb176('0x9')},'CampaignId':{'type':Sequelize[_0xb176('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xb176('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb176('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb176('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb176('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb176('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb176('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xb176('0x5')],'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 4578a44..a2deb4b 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 _0x79a8=['user','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ContactId','lastName','isNil','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','getPreviewRecall','transaction','recallme','List','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','offset','limit','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','count','rows','params','keys','includeAll','catch','create','body','find','describe','CampaignId','VoiceQueueId','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername'];(function(_0x475612,_0x54baf2){var _0x1abc5a=function(_0x40b395){while(--_0x40b395){_0x475612['push'](_0x475612['shift']());}};_0x1abc5a(++_0x54baf2);}(_0x79a8,0x1d0));var _0x879a=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0x79a8[_0xfcfc35];return _0x13a3c7;};'use strict';var moment=require(_0x879a('0x0'));var _=require('lodash');var qs=require(_0x879a('0x1'));var logger=require(_0x879a('0x2'))(_0x879a('0x3'));var shared=require('../../config/environment');var db=require(_0x879a('0x4'))['db'];function respondWithResult(_0x49b7c0,_0x46ee67){_0x46ee67=_0x46ee67||0xc8;return function(_0x1fe9b2){if(_0x1fe9b2){return _0x49b7c0[_0x879a('0x5')](_0x46ee67)[_0x879a('0x6')](_0x1fe9b2);}};}function respondWithFilteredResult(_0x1808f1,_0x3cb89c){return function(_0x1d353e){if(_0x1d353e){var _0x2427bf=typeof _0x3cb89c['offset']===_0x879a('0x7')&&typeof _0x3cb89c['limit']===_0x879a('0x7');var _0x2182a3=_0x1d353e['count'];var _0x32f78d=_0x2427bf?0x0:_0x3cb89c[_0x879a('0x8')];var _0x832c07=_0x2427bf?_0x1d353e['count']:_0x3cb89c[_0x879a('0x8')]+_0x3cb89c[_0x879a('0x9')];var _0x4ce306;if(_0x832c07>=_0x2182a3){_0x832c07=_0x2182a3;_0x4ce306=0xc8;}else{_0x4ce306=0xce;}_0x1808f1['status'](_0x4ce306);return _0x1808f1[_0x879a('0xa')](_0x879a('0xb'),_0x32f78d+'-'+_0x832c07+'/'+_0x2182a3)[_0x879a('0x6')](_0x1d353e);}return null;};}function saveUpdates(_0x320115,_0x54a9b6){return function(_0x4738b4){if(_0x4738b4){return _0x4738b4[_0x879a('0xc')](_0x320115)[_0x879a('0xd')](function(_0x1ea66e){return _0x1ea66e;});}return null;};}function handleEntityNotFound(_0x1a20c5,_0x1c2853){return function(_0x461f1e){if(!_0x461f1e){_0x1a20c5[_0x879a('0xe')](0x194);}return _0x461f1e;};}function handleError(_0x1746b6,_0x16b649){_0x16b649=_0x16b649||0x1f4;return function(_0x5b4dbe){logger['error'](_0x5b4dbe[_0x879a('0xf')]);if(_0x5b4dbe[_0x879a('0x10')]){delete _0x5b4dbe['name'];}_0x1746b6[_0x879a('0x5')](_0x16b649)[_0x879a('0x11')](_0x5b4dbe);};}exports[_0x879a('0x12')]=function(_0x3d4462,_0x32d9f5){var _0x61427a={},_0x4160bd={},_0x849ec5={'count':0x0,'rows':[]};var _0x1ed368=_[_0x879a('0x13')](db[_0x879a('0x14')][_0x879a('0x15')],function(_0x18b3d2){return{'name':_0x18b3d2[_0x879a('0x16')],'type':_0x18b3d2['type'][_0x879a('0x17')]};});_0x4160bd[_0x879a('0x18')]=_['map'](_0x1ed368,_0x879a('0x10'));_0x4160bd[_0x879a('0x19')]=_['keys'](_0x3d4462['query']);_0x4160bd['filters']=_[_0x879a('0x1a')](_0x4160bd[_0x879a('0x18')],_0x4160bd[_0x879a('0x19')]);_0x4160bd[_0x879a('0x1b')]=_['concat'](_0x4160bd['filters'],[_0x879a('0x1c'),_0x879a('0x1d'),_0x879a('0x1e'),_0x879a('0x1f'),_0x879a('0x20'),_0x879a('0x21'),_0x879a('0x22'),_0x879a('0x23'),_0x879a('0x24'),_0x879a('0x25'),_0x879a('0x26'),_0x879a('0x27'),_0x879a('0x28'),'$like',_0x879a('0x29'),_0x879a('0x2a'),_0x879a('0x2b'),_0x879a('0x2c'),_0x879a('0x2d'),_0x879a('0x2e'),_0x879a('0x2f'),_0x879a('0x30')]);_0x61427a[_0x879a('0x31')]=_[_0x879a('0x1a')](_0x4160bd[_0x879a('0x18')],qs[_0x879a('0x32')](_0x3d4462[_0x879a('0x19')][_0x879a('0x32')]));_0x61427a[_0x879a('0x31')]=_0x61427a[_0x879a('0x31')][_0x879a('0x33')]?_0x61427a[_0x879a('0x31')]:_0x4160bd['model'];if(!_0x3d4462[_0x879a('0x19')]['hasOwnProperty'](_0x879a('0x34'))){_0x61427a[_0x879a('0x9')]=qs[_0x879a('0x9')](_0x3d4462['query'][_0x879a('0x9')]);_0x61427a['offset']=qs['offset'](_0x3d4462['query']['offset']);}_0x61427a[_0x879a('0x35')]=qs[_0x879a('0x36')](_0x3d4462['query'][_0x879a('0x36')]);_0x61427a[_0x879a('0x37')]=qs[_0x879a('0x1b')](_['pick'](_0x3d4462[_0x879a('0x19')],_0x4160bd[_0x879a('0x1b')]),_0x1ed368);if(_0x3d4462[_0x879a('0x19')][_0x879a('0x38')]){_0x61427a['where']=_[_0x879a('0x39')](_0x61427a[_0x879a('0x37')],{'$or':_[_0x879a('0x13')](_0x1ed368,function(_0x2f5cb8){if(_0x2f5cb8['type']!==_0x879a('0x3a')){var _0x4bbddc={};_0x4bbddc[_0x2f5cb8[_0x879a('0x10')]]={'$like':'%'+_0x3d4462['query'][_0x879a('0x38')]+'%'};return _0x4bbddc;}})});}_0x61427a=_[_0x879a('0x39')]({},_0x61427a,_0x3d4462['options']);var _0x2b80ee={'where':_0x61427a[_0x879a('0x37')]};return db[_0x879a('0x14')][_0x879a('0x3b')](_0x2b80ee)['then'](function(_0x26d0ee){_0x849ec5[_0x879a('0x3b')]=_0x26d0ee;if(_0x3d4462[_0x879a('0x19')]['includeAll']){_0x61427a['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x61427a);})['then'](function(_0x452558){_0x849ec5[_0x879a('0x3c')]=_0x452558;return _0x849ec5;})[_0x879a('0xd')](respondWithFilteredResult(_0x32d9f5,_0x61427a))['catch'](handleError(_0x32d9f5,null));};exports['show']=function(_0x4a047b,_0x44cff6){var _0x5597f9={'raw':!![],'where':{'id':_0x4a047b[_0x879a('0x3d')]['id']}},_0x3ecbe0={};_0x3ecbe0[_0x879a('0x18')]=_['keys'](db['CmHopper'][_0x879a('0x15')]);_0x3ecbe0['query']=_[_0x879a('0x3e')](_0x4a047b[_0x879a('0x19')]);_0x3ecbe0['filters']=_[_0x879a('0x1a')](_0x3ecbe0[_0x879a('0x18')],_0x3ecbe0[_0x879a('0x19')]);_0x5597f9['attributes']=_[_0x879a('0x1a')](_0x3ecbe0[_0x879a('0x18')],qs['fields'](_0x4a047b[_0x879a('0x19')][_0x879a('0x32')]));_0x5597f9['attributes']=_0x5597f9[_0x879a('0x31')][_0x879a('0x33')]?_0x5597f9[_0x879a('0x31')]:_0x3ecbe0[_0x879a('0x18')];if(_0x4a047b['query'][_0x879a('0x3f')]){_0x5597f9['include']=[{'all':!![]}];}_0x5597f9=_[_0x879a('0x39')]({},_0x5597f9,_0x4a047b['options']);return db[_0x879a('0x14')]['find'](_0x5597f9)[_0x879a('0xd')](handleEntityNotFound(_0x44cff6,null))[_0x879a('0xd')](respondWithResult(_0x44cff6,null))[_0x879a('0x40')](handleError(_0x44cff6,null));};exports[_0x879a('0x41')]=function(_0x1059ac,_0x3686b3){return db['CmHopper'][_0x879a('0x41')](_0x1059ac[_0x879a('0x42')],{})[_0x879a('0xd')](respondWithResult(_0x3686b3,0xc9))['catch'](handleError(_0x3686b3,null));};exports[_0x879a('0xc')]=function(_0x445d1f,_0x7f2d83){if(_0x445d1f['body']['id']){delete _0x445d1f[_0x879a('0x42')]['id'];}return db[_0x879a('0x14')][_0x879a('0x43')]({'where':{'id':_0x445d1f[_0x879a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x7f2d83,null))['then'](saveUpdates(_0x445d1f[_0x879a('0x42')],null))[_0x879a('0xd')](respondWithResult(_0x7f2d83,null))['catch'](handleError(_0x7f2d83,null));};exports[_0x879a('0x44')]=function(_0x4420ac,_0x48f92a){return db[_0x879a('0x14')][_0x879a('0x44')]()[_0x879a('0xd')](respondWithResult(_0x48f92a,null))[_0x879a('0x40')](handleError(_0x48f92a,null));};exports['destroy']=function(_0x3ffbe6,_0x32933f){var _0x2b1e44;var _0x51dc92=_0x3ffbe6['params']['id'];return db[_0x879a('0x14')][_0x879a('0x43')]({'where':{'id':_0x3ffbe6['params']['id']}})[_0x879a('0xd')](handleEntityNotFound(_0x32933f,null))[_0x879a('0xd')](function(_0x196d84){if(_0x196d84){return _0x196d84['destroy']()[_0x879a('0xd')](function(_0x677418){return _0x677418;});}})[_0x879a('0xd')](function(_0x2f7691){_0x2b1e44=_0x2f7691;if(_0x2f7691){if(_0x2f7691['VoiceQueueId']||_0x2f7691[_0x879a('0x45')]){return db[_0x2f7691[_0x879a('0x46')]?'VoiceQueue':_0x879a('0x47')][_0x879a('0x43')]({'where':{'id':_0x2f7691['VoiceQueueId']?_0x2f7691['VoiceQueueId']:_0x2f7691[_0x879a('0x45')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x1fe260){var _0x397e90={};if(_0x1fe260){_['merge'](_0x397e90,_[_0x879a('0x48')](_0x2b1e44[_0x879a('0x49')],[_0x879a('0x4a'),'updatedAt','id']));_0x397e90[_0x879a('0x4b')]=0x15;_0x397e90[_0x879a('0x4c')]=_0x879a('0x4d');_0x397e90[_0x879a('0x4e')]=_0x1fe260[_0x879a('0x10')];_0x397e90[_0x879a('0x4f')]=_0x3ffbe6[_0x879a('0x50')][_0x879a('0x10')];_0x397e90['UserId']=_0x3ffbe6[_0x879a('0x50')]['id'];_0x397e90[_0x879a('0x4d')]=!![];_0x397e90['deletedat']=moment()['format'](_0x879a('0x51'));_0x397e90['calleridnum']=_0x2b1e44[_0x879a('0x52')];_0x397e90[_0x879a('0x53')]=_0x2b1e44[_0x879a('0x46')]?_0x879a('0x54'):'ivr';return db['CmContact'][_0x879a('0x43')]({'where':{'id':_0x397e90[_0x879a('0x55')]},'attributes':['firstName',_0x879a('0x56')]})[_0x879a('0xd')](function(_0x1d7ab7){if(!_[_0x879a('0x57')](_0x32933f)&&!_['isNil'](_0x1d7ab7['firstName'])){_0x397e90['calleridname']=_0x1d7ab7[_0x879a('0x58')];if(!_[_0x879a('0x57')](_0x1d7ab7['lastName'])){_0x397e90['calleridname']+='\x20'+_0x1d7ab7[_0x879a('0x56')];}}})[_0x879a('0x59')](function(){return db[_0x879a('0x5a')][_0x879a('0x41')](_0x397e90);});}})['then'](function(_0x3cb80f){return db[_0x879a('0x5b')]['destroy']({'where':{'CmHopperId':_0x51dc92}});})['then'](function(){return _0x32933f[_0x879a('0x5')](0xcc)[_0x879a('0x5c')]();})['catch'](handleError(_0x32933f,null));};exports[_0x879a('0x5d')]=function(_0x1ee969,_0x47f7a1){var _0x3d05a8=[];return db[_0x879a('0x5e')][_0x879a('0x44')]()['then'](function(_0x37e79a){_0x3d05a8=_[_0x879a('0x3e')](_0x37e79a);return _0x1ee969[_0x879a('0x50')][_0x879a('0x5f')]({'where':{'type':_0x879a('0x60'),'dialActive':!![],'dialMethod':_0x879a('0x61')},'attributes':['id',_0x879a('0x62'),_0x879a('0x63')],'raw':!![]});})['then'](function(_0x14b751){if(_0x14b751&&_0x14b751[_0x879a('0x33')]){return db[_0x879a('0x64')]['transaction'](function(_0x4aeca5){var _0x197035={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x879a('0x65')](_0x879a('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x14b751,'id')},'$or':[{'UserId':null},{'UserId':_0x1ee969[_0x879a('0x50')]['id']}]};var _0x2885ae={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x14b751)[_0x879a('0x38')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x879a('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x1ee969['user']['id']}]};var _0x5bd8a7={'$or':[_0x197035,_0x2885ae]};var _0x46a2ac=[];if(_0x1ee969[_0x879a('0x42')][_0x879a('0x67')]&&_0x1ee969[_0x879a('0x42')]['direction']===_0x879a('0x68')){if(!_[_0x879a('0x69')](_0x1ee969[_0x879a('0x42')]['hopperIds'])){_0x5bd8a7['id']={'$in':_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')]};}_0x46a2ac=[['priority','ASC'],[_0x879a('0x6b'),_0x14b751[0x0][_0x879a('0x62')]===_0x879a('0x6c')?_0x879a('0x6d'):'ASC'],db[_0x879a('0x64')][_0x879a('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x879a('0x6d')]];}else{if(!_[_0x879a('0x69')](_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')])){_0x5bd8a7['id']={'$notIn':_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')]};}_0x46a2ac=[[_0x879a('0x6f'),'DESC'],[_0x879a('0x6b'),_0x14b751[0x0]['dialOrderByScheduledAt']],db[_0x879a('0x64')][_0x879a('0x6e')](_0x879a('0x70')),['id',_0x879a('0x6c')]];}return db[_0x879a('0x14')][_0x879a('0x71')]({'attributes':['id',_0x879a('0x72'),_0x879a('0x52'),'recallme'],'where':_0x5bd8a7,'order':_0x46a2ac,'transaction':_0x4aeca5,'lock':_0x4aeca5[_0x879a('0x73')][_0x879a('0x74')],'include':[{'model':db[_0x879a('0x5e')],'as':_0x879a('0x75'),'attributes':_0x3d05a8,'include':[{'model':db[_0x879a('0x76')],'as':_0x879a('0x77'),'attributes':['id',_0x879a('0x10')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x879a('0x10')]},{'model':db[_0x879a('0x78')],'as':_0x879a('0x79'),'attributes':['id',_0x879a('0x10'),_0x879a('0x7a')]}]})['then'](function(_0x3ae266){if(_0x3ae266){return _0x3ae266[_0x879a('0xc')]({'UserId':_0x1ee969['user']['id']},{'transaction':_0x4aeca5});}});});}})[_0x879a('0xd')](handleEntityNotFound(_0x47f7a1,null))[_0x879a('0xd')](respondWithResult(_0x47f7a1,null))['catch'](handleError(_0x47f7a1,null));};exports[_0x879a('0x7b')]=function(_0x58db87,_0x307be0,_0x258ce2){var _0x528baf=[];var _0x4703d8=_0x58db87[_0x879a('0x3d')]['id'];var _0x33644f=_0x58db87['user']['id'];return db[_0x879a('0x5e')][_0x879a('0x44')]()[_0x879a('0xd')](function(_0x1ab184){_0x528baf=_[_0x879a('0x3e')](_0x1ab184);return db[_0x879a('0x64')][_0x879a('0x7c')](function(_0x59b327){const _0x4a10b1={'id':_0x4703d8};return db[_0x879a('0x14')][_0x879a('0x71')]({'attributes':['id',_0x879a('0x72'),_0x879a('0x7d')],'where':_0x4a10b1,'transaction':_0x59b327,'lock':_0x59b327[_0x879a('0x73')]['UPDATE'],'include':[{'model':db[_0x879a('0x5e')],'as':_0x879a('0x75'),'attributes':_0x528baf,'include':[{'model':db[_0x879a('0x76')],'as':_0x879a('0x77'),'attributes':['id',_0x879a('0x10')]}]},{'model':db['CmList'],'as':_0x879a('0x7e'),'attributes':['id',_0x879a('0x10')]},{'model':db[_0x879a('0x78')],'as':_0x879a('0x79'),'attributes':['id',_0x879a('0x10'),'dialActive']}]})['then'](function(_0x25d9b5){if(_0x25d9b5){return _0x25d9b5[_0x879a('0xc')]({'UserId':_0x33644f},{'transaction':_0x59b327});}});});})[_0x879a('0xd')](handleEntityNotFound(_0x307be0,null))[_0x879a('0xd')](respondWithResult(_0x307be0,null))[_0x879a('0x40')](handleError(_0x307be0,null));};exports[_0x879a('0x7f')]=function(_0xa497cb,_0x19b43a){return _0xa497cb[_0x879a('0x50')][_0x879a('0x5f')]({'where':{'type':_0x879a('0x60'),'dialActive':!![],'dialMethod':_0x879a('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x3bbe14){if(_0x3bbe14&&_0x3bbe14[_0x879a('0x33')]){return db[_0x879a('0x14')][_0x879a('0x3b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x879a('0x65')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x879a('0x13')](_0x3bbe14,'id')},'$or':[{'UserId':null},{'UserId':_0xa497cb['user']['id']}]}});}return 0x0;})[_0x879a('0xd')](function(_0x5d0f15){if(!_[_0x879a('0x57')](_0x5d0f15)&&_[_0x879a('0x80')](_0x5d0f15)){return _0x19b43a[_0x879a('0x5')](0xc8)['json']({'contacts':_0x5d0f15});}else{logger[_0x879a('0x81')](_0x879a('0x82'),_0x879a('0x7f'),0x194,'entity\x20not\x20found');_0x19b43a[_0x879a('0xe')](0x194);}})[_0x879a('0x40')](handleError(_0x19b43a,null));};exports[_0x879a('0x83')]=function(_0x289784,_0x4b5da3){var _0x607595=shared[_0x879a('0x84')];var _0x155a40=[];_[_0x879a('0x13')](_0x607595,function(_0x257d24){_0x155a40[_0x879a('0x85')]({'id':_0x257d24[_0x879a('0x10')],'name':_0x257d24[_0x879a('0x10')],'utcOffset':_0x257d24[_0x879a('0x86')]});});return _0x4b5da3[_0x879a('0x5')](0xc8)[_0x879a('0x6')]({'tz':_0x155a40});};exports[_0x879a('0x87')]=function(_0x377d42,_0x5a4163){var _0x3963e9=shared[_0x879a('0x84')];var _0x3301f4={};if(!_['isNil'](_0x3963e9[_0x377d42['body']['id']]))_0x3301f4=_0x3963e9[_0x377d42[_0x879a('0x42')]['id']];return _0x5a4163[_0x879a('0x5')](0xc8)['json'](_0x3301f4);}; \ No newline at end of file +var _0x5075=['index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$between','$in','$notIn','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','rows','catch','show','params','length','includeAll','include','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList','getPreviewRecall','List','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','json','update','then','sendStatus','error','stack','name','send'];(function(_0x501e6d,_0x43ce8e){var _0x545ff9=function(_0x5e0bf2){while(--_0x5e0bf2){_0x501e6d['push'](_0x501e6d['shift']());}};_0x545ff9(++_0x43ce8e);}(_0x5075,0x73));var _0x5507=function(_0x2068ee,_0x42966a){_0x2068ee=_0x2068ee-0x0;var _0xa36814=_0x5075[_0x2068ee];return _0xa36814;};'use strict';var moment=require(_0x5507('0x0'));var _=require(_0x5507('0x1'));var qs=require(_0x5507('0x2'));var logger=require(_0x5507('0x3'))(_0x5507('0x4'));var shared=require(_0x5507('0x5'));var db=require(_0x5507('0x6'))['db'];function respondWithResult(_0x518ca7,_0x3e96ee){_0x3e96ee=_0x3e96ee||0xc8;return function(_0x19a7ab){if(_0x19a7ab){return _0x518ca7[_0x5507('0x7')](_0x3e96ee)['json'](_0x19a7ab);}};}function respondWithFilteredResult(_0x5b6d7f,_0x2cd9ee){return function(_0x773559){if(_0x773559){var _0x4c2d6d=typeof _0x2cd9ee[_0x5507('0x8')]===_0x5507('0x9')&&typeof _0x2cd9ee[_0x5507('0xa')]==='undefined';var _0x5b2591=_0x773559[_0x5507('0xb')];var _0x441bdc=_0x4c2d6d?0x0:_0x2cd9ee[_0x5507('0x8')];var _0x36c9eb=_0x4c2d6d?_0x773559['count']:_0x2cd9ee[_0x5507('0x8')]+_0x2cd9ee[_0x5507('0xa')];var _0x55520e;if(_0x36c9eb>=_0x5b2591){_0x36c9eb=_0x5b2591;_0x55520e=0xc8;}else{_0x55520e=0xce;}_0x5b6d7f[_0x5507('0x7')](_0x55520e);return _0x5b6d7f[_0x5507('0xc')]('Content-Range',_0x441bdc+'-'+_0x36c9eb+'/'+_0x5b2591)[_0x5507('0xd')](_0x773559);}return null;};}function saveUpdates(_0x2a2ea0,_0x32c872){return function(_0x267f27){if(_0x267f27){return _0x267f27[_0x5507('0xe')](_0x2a2ea0)[_0x5507('0xf')](function(_0x59889b){return _0x59889b;});}return null;};}function handleEntityNotFound(_0x9cc3f9,_0x2b7c43){return function(_0xc828e5){if(!_0xc828e5){_0x9cc3f9[_0x5507('0x10')](0x194);}return _0xc828e5;};}function handleError(_0x4df473,_0x49e400){_0x49e400=_0x49e400||0x1f4;return function(_0x10d7b9){logger[_0x5507('0x11')](_0x10d7b9[_0x5507('0x12')]);if(_0x10d7b9[_0x5507('0x13')]){delete _0x10d7b9[_0x5507('0x13')];}_0x4df473[_0x5507('0x7')](_0x49e400)[_0x5507('0x14')](_0x10d7b9);};}exports[_0x5507('0x15')]=function(_0x2f0c7d,_0x233b6a){var _0x2260f7={},_0x3822dd={},_0x5ad6d7={'count':0x0,'rows':[]};var _0x14dab0=_[_0x5507('0x16')](db[_0x5507('0x17')][_0x5507('0x18')],function(_0x54f473){return{'name':_0x54f473[_0x5507('0x19')],'type':_0x54f473[_0x5507('0x1a')][_0x5507('0x1b')]};});_0x3822dd[_0x5507('0x1c')]=_[_0x5507('0x16')](_0x14dab0,_0x5507('0x13'));_0x3822dd['query']=_[_0x5507('0x1d')](_0x2f0c7d[_0x5507('0x1e')]);_0x3822dd[_0x5507('0x1f')]=_[_0x5507('0x20')](_0x3822dd[_0x5507('0x1c')],_0x3822dd[_0x5507('0x1e')]);_0x3822dd[_0x5507('0x1f')]=_[_0x5507('0x21')](_0x3822dd[_0x5507('0x1f')],[_0x5507('0x22'),_0x5507('0x23'),_0x5507('0x24'),_0x5507('0x25'),_0x5507('0x26'),_0x5507('0x27'),'$ne',_0x5507('0x28'),'$not',_0x5507('0x29'),'$notBetween',_0x5507('0x2a'),_0x5507('0x2b'),'$like','$notLike',_0x5507('0x2c'),_0x5507('0x2d'),'$like',_0x5507('0x2e'),_0x5507('0x2f'),_0x5507('0x30'),_0x5507('0x31')]);_0x2260f7[_0x5507('0x32')]=_[_0x5507('0x20')](_0x3822dd['model'],qs[_0x5507('0x33')](_0x2f0c7d[_0x5507('0x1e')][_0x5507('0x33')]));_0x2260f7[_0x5507('0x32')]=_0x2260f7[_0x5507('0x32')]['length']?_0x2260f7['attributes']:_0x3822dd[_0x5507('0x1c')];if(!_0x2f0c7d[_0x5507('0x1e')][_0x5507('0x34')](_0x5507('0x35'))){_0x2260f7['limit']=qs[_0x5507('0xa')](_0x2f0c7d[_0x5507('0x1e')][_0x5507('0xa')]);_0x2260f7[_0x5507('0x8')]=qs[_0x5507('0x8')](_0x2f0c7d[_0x5507('0x1e')][_0x5507('0x8')]);}_0x2260f7[_0x5507('0x36')]=qs['sort'](_0x2f0c7d[_0x5507('0x1e')][_0x5507('0x37')]);_0x2260f7[_0x5507('0x38')]=qs['filters'](_['pick'](_0x2f0c7d[_0x5507('0x1e')],_0x3822dd[_0x5507('0x1f')]),_0x14dab0);if(_0x2f0c7d[_0x5507('0x1e')][_0x5507('0x39')]){_0x2260f7[_0x5507('0x38')]=_['merge'](_0x2260f7['where'],{'$or':_[_0x5507('0x16')](_0x14dab0,function(_0x1f1974){if(_0x1f1974[_0x5507('0x1a')]!==_0x5507('0x3a')){var _0x5dcd57={};_0x5dcd57[_0x1f1974['name']]={'$like':'%'+_0x2f0c7d[_0x5507('0x1e')]['filter']+'%'};return _0x5dcd57;}})});}_0x2260f7=_[_0x5507('0x3b')]({},_0x2260f7,_0x2f0c7d[_0x5507('0x3c')]);var _0xe421={'where':_0x2260f7[_0x5507('0x38')]};return db[_0x5507('0x17')][_0x5507('0xb')](_0xe421)[_0x5507('0xf')](function(_0x2b962d){_0x5ad6d7[_0x5507('0xb')]=_0x2b962d;if(_0x2f0c7d[_0x5507('0x1e')]['includeAll']){_0x2260f7['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2260f7);})[_0x5507('0xf')](function(_0x2cf512){_0x5ad6d7[_0x5507('0x3d')]=_0x2cf512;return _0x5ad6d7;})[_0x5507('0xf')](respondWithFilteredResult(_0x233b6a,_0x2260f7))[_0x5507('0x3e')](handleError(_0x233b6a,null));};exports[_0x5507('0x3f')]=function(_0xbef058,_0x101de3){var _0xbc9f93={'raw':!![],'where':{'id':_0xbef058[_0x5507('0x40')]['id']}},_0x84db0a={};_0x84db0a[_0x5507('0x1c')]=_[_0x5507('0x1d')](db[_0x5507('0x17')]['rawAttributes']);_0x84db0a['query']=_['keys'](_0xbef058[_0x5507('0x1e')]);_0x84db0a[_0x5507('0x1f')]=_[_0x5507('0x20')](_0x84db0a[_0x5507('0x1c')],_0x84db0a[_0x5507('0x1e')]);_0xbc9f93[_0x5507('0x32')]=_[_0x5507('0x20')](_0x84db0a[_0x5507('0x1c')],qs[_0x5507('0x33')](_0xbef058[_0x5507('0x1e')][_0x5507('0x33')]));_0xbc9f93[_0x5507('0x32')]=_0xbc9f93[_0x5507('0x32')][_0x5507('0x41')]?_0xbc9f93[_0x5507('0x32')]:_0x84db0a[_0x5507('0x1c')];if(_0xbef058[_0x5507('0x1e')][_0x5507('0x42')]){_0xbc9f93[_0x5507('0x43')]=[{'all':!![]}];}_0xbc9f93=_['merge']({},_0xbc9f93,_0xbef058[_0x5507('0x3c')]);return db[_0x5507('0x17')]['find'](_0xbc9f93)['then'](handleEntityNotFound(_0x101de3,null))[_0x5507('0xf')](respondWithResult(_0x101de3,null))[_0x5507('0x3e')](handleError(_0x101de3,null));};exports[_0x5507('0x44')]=function(_0x7d4ac1,_0x21cc79){return db['CmHopper'][_0x5507('0x44')](_0x7d4ac1[_0x5507('0x45')],{})[_0x5507('0xf')](respondWithResult(_0x21cc79,0xc9))['catch'](handleError(_0x21cc79,null));};exports[_0x5507('0xe')]=function(_0x33022e,_0xadea4c){if(_0x33022e[_0x5507('0x45')]['id']){delete _0x33022e[_0x5507('0x45')]['id'];}return db['CmHopper'][_0x5507('0x46')]({'where':{'id':_0x33022e['params']['id']}})[_0x5507('0xf')](handleEntityNotFound(_0xadea4c,null))[_0x5507('0xf')](saveUpdates(_0x33022e[_0x5507('0x45')],null))[_0x5507('0xf')](respondWithResult(_0xadea4c,null))[_0x5507('0x3e')](handleError(_0xadea4c,null));};exports[_0x5507('0x47')]=function(_0x418c2e,_0x3452e4){return db['CmHopper'][_0x5507('0x47')]()[_0x5507('0xf')](respondWithResult(_0x3452e4,null))['catch'](handleError(_0x3452e4,null));};exports['destroy']=function(_0x4e5825,_0x39b20f){var _0x5961fd;var _0x403d03=_0x4e5825['params']['id'];return db[_0x5507('0x17')]['find']({'where':{'id':_0x4e5825['params']['id']}})[_0x5507('0xf')](handleEntityNotFound(_0x39b20f,null))[_0x5507('0xf')](function(_0x192b4a){if(_0x192b4a){return _0x192b4a[_0x5507('0x48')]()[_0x5507('0xf')](function(_0x38dabd){return _0x38dabd;});}})['then'](function(_0x41f874){_0x5961fd=_0x41f874;if(_0x41f874){if(_0x41f874[_0x5507('0x49')]||_0x41f874[_0x5507('0x4a')]){return db[_0x41f874['VoiceQueueId']?_0x5507('0x4b'):_0x5507('0x4c')][_0x5507('0x46')]({'where':{'id':_0x41f874[_0x5507('0x49')]?_0x41f874[_0x5507('0x49')]:_0x41f874[_0x5507('0x4a')]},'attributes':['id',_0x5507('0x13')],'raw':!![]});}}})[_0x5507('0xf')](function(_0x4674f9){var _0x245456={};if(_0x4674f9){_[_0x5507('0x3b')](_0x245456,_['omit'](_0x5961fd['dataValues'],[_0x5507('0x4d'),_0x5507('0x4e'),'id']));_0x245456[_0x5507('0x4f')]=0x15;_0x245456[_0x5507('0x50')]=_0x5507('0x51');_0x245456[_0x5507('0x52')]=_0x4674f9[_0x5507('0x13')];_0x245456[_0x5507('0x53')]=_0x4e5825[_0x5507('0x54')][_0x5507('0x13')];_0x245456[_0x5507('0x55')]=_0x4e5825[_0x5507('0x54')]['id'];_0x245456[_0x5507('0x51')]=!![];_0x245456[_0x5507('0x56')]=moment()[_0x5507('0x57')](_0x5507('0x58'));_0x245456['calleridnum']=_0x5961fd[_0x5507('0x59')];_0x245456['campaigntype']=_0x5961fd['VoiceQueueId']?_0x5507('0x5a'):_0x5507('0x5b');return db[_0x5507('0x5c')][_0x5507('0x46')]({'where':{'id':_0x245456['ContactId']},'attributes':[_0x5507('0x5d'),_0x5507('0x5e')]})[_0x5507('0xf')](function(_0x34276a){if(!_[_0x5507('0x5f')](_0x39b20f)&&!_[_0x5507('0x5f')](_0x34276a['firstName'])){_0x245456[_0x5507('0x60')]=_0x34276a[_0x5507('0x5d')];if(!_[_0x5507('0x5f')](_0x34276a['lastName'])){_0x245456['calleridname']+='\x20'+_0x34276a[_0x5507('0x5e')];}}})['finally'](function(){return db[_0x5507('0x61')][_0x5507('0x44')](_0x245456);});}})['then'](function(_0x3e796d){return db[_0x5507('0x62')][_0x5507('0x48')]({'where':{'CmHopperId':_0x403d03}});})[_0x5507('0xf')](function(){return _0x39b20f[_0x5507('0x7')](0xcc)[_0x5507('0x63')]();})[_0x5507('0x3e')](handleError(_0x39b20f,null));};exports[_0x5507('0x64')]=function(_0x737d39,_0x7afa6b){var _0x1453f1=[];return db[_0x5507('0x5c')]['describe']()[_0x5507('0xf')](function(_0x2e904b){_0x1453f1=_[_0x5507('0x1d')](_0x2e904b);return _0x737d39[_0x5507('0x54')][_0x5507('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5507('0x66')},'attributes':['id','dialOrderByScheduledAt',_0x5507('0x67')],'raw':!![]});})[_0x5507('0xf')](function(_0x241733){if(_0x241733&&_0x241733['length']){return db[_0x5507('0x68')][_0x5507('0x69')](function(_0x2a9672){var _0x56632b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5507('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5507('0x16')](_0x241733,'id')},'$or':[{'UserId':null},{'UserId':_0x737d39['user']['id']}]};var _0x48d394={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x241733)[_0x5507('0x39')]([_0x5507('0x67'),0x0])[_0x5507('0x16')]('id')[_0x5507('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x737d39[_0x5507('0x54')]['id']}]};var _0x31cc0d={'$or':[_0x56632b,_0x48d394]};var _0x4bf567=[];if(_0x737d39['body'][_0x5507('0x6b')]&&_0x737d39[_0x5507('0x45')][_0x5507('0x6b')]===_0x5507('0x6c')){if(!_['isEmpty'](_0x737d39[_0x5507('0x45')][_0x5507('0x6d')])){_0x31cc0d['id']={'$in':_0x737d39[_0x5507('0x45')][_0x5507('0x6d')]};}_0x4bf567=[[_0x5507('0x6e'),_0x5507('0x6f')],[_0x5507('0x70'),_0x241733[0x0]['dialOrderByScheduledAt']===_0x5507('0x6f')?_0x5507('0x71'):_0x5507('0x6f')],db['sequelize'][_0x5507('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x737d39[_0x5507('0x45')][_0x5507('0x6d')])){_0x31cc0d['id']={'$notIn':_0x737d39[_0x5507('0x45')][_0x5507('0x6d')]};}_0x4bf567=[[_0x5507('0x6e'),_0x5507('0x71')],[_0x5507('0x70'),_0x241733[0x0]['dialOrderByScheduledAt']],db[_0x5507('0x68')]['literal'](_0x5507('0x73')),['id',_0x5507('0x6f')]];}return db[_0x5507('0x17')][_0x5507('0x74')]({'attributes':['id',_0x5507('0x75'),_0x5507('0x59'),_0x5507('0x76')],'where':_0x31cc0d,'order':_0x4bf567,'transaction':_0x2a9672,'lock':_0x2a9672[_0x5507('0x77')][_0x5507('0x78')],'include':[{'model':db[_0x5507('0x5c')],'as':_0x5507('0x79'),'attributes':_0x1453f1,'include':[{'model':db['CmCompany'],'as':_0x5507('0x7a'),'attributes':['id',_0x5507('0x13')]}]},{'model':db[_0x5507('0x7b')],'as':'List','attributes':['id',_0x5507('0x13')]},{'model':db[_0x5507('0x4b')],'as':'Queue','attributes':['id',_0x5507('0x13'),'dialActive']}]})['then'](function(_0x38b857){if(_0x38b857){return _0x38b857['update']({'UserId':_0x737d39[_0x5507('0x54')]['id']},{'transaction':_0x2a9672});}});});}})[_0x5507('0xf')](handleEntityNotFound(_0x7afa6b,null))[_0x5507('0xf')](respondWithResult(_0x7afa6b,null))[_0x5507('0x3e')](handleError(_0x7afa6b,null));};exports[_0x5507('0x7c')]=function(_0x36c56b,_0x483cde,_0x43fccf){var _0x323dbf=[];var _0x3b212b=_0x36c56b[_0x5507('0x40')]['id'];var _0x10427f=_0x36c56b[_0x5507('0x54')]['id'];return db[_0x5507('0x5c')][_0x5507('0x47')]()[_0x5507('0xf')](function(_0x1674ce){_0x323dbf=_[_0x5507('0x1d')](_0x1674ce);return db[_0x5507('0x68')]['transaction'](function(_0x255b14){const _0x3e8804={'id':_0x3b212b};return db[_0x5507('0x17')][_0x5507('0x74')]({'attributes':['id',_0x5507('0x75'),_0x5507('0x76')],'where':_0x3e8804,'transaction':_0x255b14,'lock':_0x255b14['LOCK'][_0x5507('0x78')],'include':[{'model':db['CmContact'],'as':_0x5507('0x79'),'attributes':_0x323dbf,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x5507('0x13')]}]},{'model':db[_0x5507('0x7b')],'as':_0x5507('0x7d'),'attributes':['id',_0x5507('0x13')]},{'model':db[_0x5507('0x4b')],'as':'Queue','attributes':['id',_0x5507('0x13'),'dialActive']}]})[_0x5507('0xf')](function(_0x471142){if(_0x471142){return _0x471142[_0x5507('0xe')]({'UserId':_0x10427f},{'transaction':_0x255b14});}});});})[_0x5507('0xf')](handleEntityNotFound(_0x483cde,null))['then'](respondWithResult(_0x483cde,null))[_0x5507('0x3e')](handleError(_0x483cde,null));};exports[_0x5507('0x7e')]=function(_0x42bef4,_0x5a8a1b){return _0x42bef4['user'][_0x5507('0x65')]({'where':{'type':_0x5507('0x7f'),'dialActive':!![],'dialMethod':_0x5507('0x66')},'attributes':['id'],'raw':!![]})[_0x5507('0xf')](function(_0x77a772){if(_0x77a772&&_0x77a772[_0x5507('0x41')]){return db[_0x5507('0x17')][_0x5507('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5507('0x57')](_0x5507('0x58'))},'VoiceQueueId':{'$in':_[_0x5507('0x16')](_0x77a772,'id')},'$or':[{'UserId':null},{'UserId':_0x42bef4[_0x5507('0x54')]['id']}]}});}return 0x0;})['then'](function(_0x2824fd){if(!_[_0x5507('0x5f')](_0x2824fd)&&_[_0x5507('0x80')](_0x2824fd)){return _0x5a8a1b[_0x5507('0x7')](0xc8)[_0x5507('0xd')]({'contacts':_0x2824fd});}else{logger[_0x5507('0x11')](_0x5507('0x81'),'getOpenContacts',0x194,_0x5507('0x82'));_0x5a8a1b[_0x5507('0x10')](0x194);}})[_0x5507('0x3e')](handleError(_0x5a8a1b,null));};exports[_0x5507('0x83')]=function(_0x536215,_0x38e8b7){var _0x3e8beb=shared[_0x5507('0x84')];var _0x42925c=[];_[_0x5507('0x16')](_0x3e8beb,function(_0xa78f75){_0x42925c[_0x5507('0x85')]({'id':_0xa78f75['name'],'name':_0xa78f75[_0x5507('0x13')],'utcOffset':_0xa78f75[_0x5507('0x86')]});});return _0x38e8b7[_0x5507('0x7')](0xc8)[_0x5507('0xd')]({'tz':_0x42925c});};exports[_0x5507('0x87')]=function(_0x5cf4ba,_0xaefb37){var _0x4a9227=shared[_0x5507('0x84')];var _0x334d7d={};if(!_[_0x5507('0x5f')](_0x4a9227[_0x5cf4ba[_0x5507('0x45')]['id']]))_0x334d7d=_0x4a9227[_0x5cf4ba[_0x5507('0x45')]['id']];return _0xaefb37[_0x5507('0x7')](0xc8)[_0x5507('0xd')](_0x334d7d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6ad5a1e..cf2b9a0 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 _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12436d,_0xe01009){var _0x1b8ce1=function(_0x47cb9b){while(--_0x47cb9b){_0x12436d['push'](_0x12436d['shift']());}};_0x1b8ce1(++_0xe01009);}(_0x1261,0x144));var _0x1126=function(_0x5c27b6,_0x4a3c28){_0x5c27b6=_0x5c27b6-0x0;var _0x284ce4=_0x1261[_0x5c27b6];return _0x284ce4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x24f696,_0x54288d){var _0x554777=function(_0x5e9496){while(--_0x5e9496){_0x24f696['push'](_0x24f696['shift']());}};_0x554777(++_0x54288d);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a4b75aa..fa2a832 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 _0xd709=['Contact','keys','Agent','name','length','push','includes','all','GetContactDialer','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','\x20MINUTE','NOW()','User','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','error','message','ShowCmHopper','CmHopper','find','catch','body','CreateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','CmContact','describe','sequelize','transaction','order','UPDATE'];(function(_0x29e154,_0x497fb3){var _0x22fa5a=function(_0x12faf9){while(--_0x12faf9){_0x29e154['push'](_0x29e154['shift']());}};_0x22fa5a(++_0x497fb3);}(_0xd709,0x1b0));var _0x9d70=function(_0x372ad3,_0x2e2974){_0x372ad3=_0x372ad3-0x0;var _0x58193c=_0xd709[_0x372ad3];return _0x58193c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9d70('0x0'));var db=require(_0x9d70('0x1'))['db'];var logger=require(_0x9d70('0x2'))(_0x9d70('0x3'));exports[_0x9d70('0x4')]=function(_0x3c0164){var _0x49846f=this;return new Promise(function(_0x58b93b,_0x43cb6f){return db['CmHopper'][_0x9d70('0x5')]({'raw':_0x3c0164[_0x9d70('0x6')]?_0x3c0164[_0x9d70('0x6')][_0x9d70('0x7')]===undefined?!![]:![]:!![],'where':_0x3c0164[_0x9d70('0x6')]?_0x3c0164[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':_0x3c0164[_0x9d70('0x6')]?_0x3c0164['options'][_0x9d70('0x9')]||null:null,'limit':_0x3c0164['options']?_0x3c0164[_0x9d70('0x6')][_0x9d70('0xa')]||null:null,'include':_0x3c0164['options']?_0x3c0164[_0x9d70('0x6')]['include']?_['map'](_0x3c0164[_0x9d70('0x6')][_0x9d70('0xb')],function(_0x435079){return{'model':db[_0x435079[_0x9d70('0xc')]],'as':_0x435079['as'],'attributes':_0x435079[_0x9d70('0x9')],'include':_0x435079[_0x9d70('0xb')]?_[_0x9d70('0xd')](_0x435079[_0x9d70('0xb')],function(_0x437a9e){return{'model':db[_0x437a9e[_0x9d70('0xc')]],'as':_0x437a9e['as'],'attributes':_0x437a9e[_0x9d70('0x9')],'include':_0x437a9e[_0x9d70('0xb')]?_[_0x9d70('0xd')](_0x437a9e[_0x9d70('0xb')],function(_0x1b8968){return{'model':db[_0x1b8968[_0x9d70('0xc')]],'as':_0x1b8968['as'],'attributes':_0x1b8968[_0x9d70('0x9')]};}):[]};}):[]};}):[]:[]})[_0x9d70('0xe')](function(_0x4ffb9f){logger[_0x9d70('0xf')](_0x9d70('0x4'),_0x3c0164);logger[_0x9d70('0x10')](_0x9d70('0x4'),_0x3c0164,JSON[_0x9d70('0x11')](_0x4ffb9f));_0x58b93b(_0x4ffb9f);})['catch'](function(_0x4c7fe6){logger[_0x9d70('0x12')]('GetCmHopper',_0x4c7fe6[_0x9d70('0x13')],_0x3c0164);_0x43cb6f(_0x49846f['error'](0x1f4,_0x4c7fe6['message']));});});};exports[_0x9d70('0x14')]=function(_0x42ccbd){var _0x36fb1b=this;return new Promise(function(_0x2a665d,_0x412a7f){return db[_0x9d70('0x15')][_0x9d70('0x16')]({'raw':_0x42ccbd[_0x9d70('0x6')]?_0x42ccbd[_0x9d70('0x6')][_0x9d70('0x7')]===undefined?!![]:![]:!![],'where':_0x42ccbd[_0x9d70('0x6')]?_0x42ccbd[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':_0x42ccbd[_0x9d70('0x6')]?_0x42ccbd[_0x9d70('0x6')][_0x9d70('0x9')]||null:null,'include':_0x42ccbd[_0x9d70('0x6')]?_0x42ccbd[_0x9d70('0x6')][_0x9d70('0xb')]?_['map'](_0x42ccbd[_0x9d70('0x6')][_0x9d70('0xb')],function(_0x155a30){return{'model':db[_0x155a30[_0x9d70('0xc')]],'as':_0x155a30['as'],'attributes':_0x155a30['attributes'],'include':_0x155a30['include']?_[_0x9d70('0xd')](_0x155a30[_0x9d70('0xb')],function(_0x2665fb){return{'model':db[_0x2665fb['model']],'as':_0x2665fb['as'],'attributes':_0x2665fb['attributes'],'include':_0x2665fb[_0x9d70('0xb')]?_[_0x9d70('0xd')](_0x2665fb[_0x9d70('0xb')],function(_0x313925){return{'model':db[_0x313925['model']],'as':_0x313925['as'],'attributes':_0x313925[_0x9d70('0x9')]};}):[]};}):[]};}):[]:[]})[_0x9d70('0xe')](function(_0x32fe17){logger[_0x9d70('0xf')](_0x9d70('0x14'),_0x42ccbd);logger['debug'](_0x9d70('0x14'),_0x42ccbd,JSON[_0x9d70('0x11')](_0x32fe17));_0x2a665d(_0x32fe17);})[_0x9d70('0x17')](function(_0x2b72f6){logger[_0x9d70('0x12')](_0x9d70('0x14'),_0x2b72f6['message'],_0x42ccbd);_0x412a7f(_0x36fb1b[_0x9d70('0x12')](0x1f4,_0x2b72f6[_0x9d70('0x13')]));});});};exports['CreateCmHopper']=function(_0x4d204f){var _0x9aa356=this;return new Promise(function(_0x294d6f,_0x2eead6){return db[_0x9d70('0x15')]['create'](_0x4d204f[_0x9d70('0x18')],{'raw':_0x4d204f[_0x9d70('0x6')]?_0x4d204f['options']['raw']===undefined?!![]:![]:!![]})[_0x9d70('0xe')](function(_0x4552e2){logger[_0x9d70('0xf')](_0x9d70('0x19'),_0x4d204f);logger[_0x9d70('0x10')]('CreateCmHopper',_0x4d204f,JSON[_0x9d70('0x11')](_0x4552e2));_0x294d6f(_0x4552e2);})[_0x9d70('0x17')](function(_0x462e20){logger[_0x9d70('0x12')](_0x9d70('0x19'),_0x462e20[_0x9d70('0x13')],_0x4d204f);_0x2eead6(_0x9aa356[_0x9d70('0x12')](0x1f4,_0x462e20[_0x9d70('0x13')]));});});};exports['UpdateCmHopper']=function(_0x433b4a){var _0x32941e=this;return new Promise(function(_0x32f1aa,_0x446844){return db[_0x9d70('0x15')][_0x9d70('0x1a')](_0x433b4a['body'],{'raw':_0x433b4a['options']?_0x433b4a['options'][_0x9d70('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x433b4a[_0x9d70('0x6')]?_0x433b4a[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':_0x433b4a[_0x9d70('0x6')]?_0x433b4a[_0x9d70('0x6')][_0x9d70('0x9')]||null:null,'limit':_0x433b4a[_0x9d70('0x6')]?_0x433b4a[_0x9d70('0x6')][_0x9d70('0xa')]||null:null})['then'](function(_0x13417c){logger[_0x9d70('0xf')]('UpdateCmHopper',_0x433b4a);logger[_0x9d70('0xf')](_0x9d70('0x1b'),JSON[_0x9d70('0x11')](_0x433b4a[_0x9d70('0x6')][_0x9d70('0x8')]),_0x433b4a[_0x9d70('0x18')]['active']);logger['debug']('UpdateCmHopper',_0x433b4a,JSON[_0x9d70('0x11')](_0x13417c));_0x32f1aa(_0x13417c);})['catch'](function(_0x11186d){logger[_0x9d70('0x12')]('UpdateCmHopper',_0x11186d[_0x9d70('0x13')],_0x433b4a);_0x446844(_0x32941e[_0x9d70('0x12')](0x1f4,_0x11186d[_0x9d70('0x13')]));});});};exports['DestroyCmHopper']=function(_0x3ded0a){var _0x42e8bd=this;return new Promise(function(_0x522db0,_0x36decc){return db[_0x9d70('0x15')][_0x9d70('0x1c')]({'where':_0x3ded0a[_0x9d70('0x6')]?_0x3ded0a['options'][_0x9d70('0x8')]||null:null})[_0x9d70('0xe')](function(_0x5c1ea4){logger[_0x9d70('0xf')]('DestroyCmHopper',_0x3ded0a);logger[_0x9d70('0x10')](_0x9d70('0x1d'),_0x3ded0a,JSON[_0x9d70('0x11')](_0x5c1ea4));_0x522db0(_0x5c1ea4);})['catch'](function(_0x163a47){logger[_0x9d70('0x12')]('DestroyCmHopper',_0x163a47['message'],_0x3ded0a);_0x36decc(_0x42e8bd[_0x9d70('0x12')](0x1f4,_0x163a47['message']));});});};exports['GetContactDialer']=function(_0x5cfb27){var _0x104505=this;return new Promise(function(_0x4c4fcc,_0x227e56){return db[_0x9d70('0x1e')][_0x9d70('0x1f')]()[_0x9d70('0xe')](function(_0x3af0e2){return db[_0x9d70('0x20')][_0x9d70('0x21')](function(_0x4fdd10){return db[_0x9d70('0x15')][_0x9d70('0x5')]({'where':_0x5cfb27[_0x9d70('0x6')]?_0x5cfb27[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':_0x5cfb27[_0x9d70('0x6')]?_0x5cfb27[_0x9d70('0x6')]['attributes']||null:null,'limit':_0x5cfb27['options']?_0x5cfb27[_0x9d70('0x6')]['limit']||null:null,'order':_0x5cfb27[_0x9d70('0x6')]?_0x5cfb27['options'][_0x9d70('0x22')]||null:null,'transaction':_0x4fdd10,'lock':_0x4fdd10['LOCK'][_0x9d70('0x23')],'include':[{'model':db[_0x9d70('0x1e')],'as':_0x9d70('0x24'),'attributes':_[_0x9d70('0x25')](_0x3af0e2)},{'model':db['User'],'as':_0x9d70('0x26'),'attributes':['id',_0x9d70('0x27'),'voicePause']}]})[_0x9d70('0xe')](function(_0x54f053){var _0x484778=[];var _0x69b56d=[];for(var _0x14162f=0x0;_0x14162f<_0x54f053[_0x9d70('0x28')];_0x14162f+=0x1){var _0x29780d=_0x54f053[_0x14162f]['UserId'];if(_0x29780d===null){_0x484778[_0x9d70('0x29')](_0x54f053[_0x14162f][_0x9d70('0x1a')](_0x5cfb27[_0x9d70('0x18')],{'transaction':_0x4fdd10}));}else if(!_0x69b56d[_0x9d70('0x2a')](_0x29780d)){_0x69b56d[_0x9d70('0x29')](_0x29780d);_0x484778[_0x9d70('0x29')](_0x54f053[_0x14162f][_0x9d70('0x1a')](_0x5cfb27[_0x9d70('0x18')],{'transaction':_0x4fdd10}));}}return BPromise[_0x9d70('0x2b')](_0x484778);});})['then'](function(_0x2a6411){logger[_0x9d70('0xf')](_0x9d70('0x2c'),_0x5cfb27);if(_0x2a6411[_0x9d70('0x28')]>0x0){logger[_0x9d70('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x2a6411[0x0][_0x9d70('0x2d')]['id'],_0x2a6411[0x0][_0x9d70('0x2d')][_0x9d70('0x2e')],_0x2a6411[0x0]['dataValues'][_0x9d70('0x2f')]);}logger[_0x9d70('0x10')](_0x9d70('0x2c'),_0x5cfb27,JSON['stringify'](_0x2a6411));_0x4c4fcc(_0x2a6411);})['catch'](function(_0x38cf1b){logger['error'](_0x9d70('0x2c'),_0x38cf1b[_0x9d70('0x13')],_0x5cfb27);_0x227e56(_0x104505['error'](0x1f4,_0x38cf1b[_0x9d70('0x13')]));});});});};exports[_0x9d70('0x30')]=function(_0x1748d3){var _0x2fc043=this;return new Promise(function(_0x37e0cd,_0x50112d){return db['sequelize'][_0x9d70('0x21')](function(_0x4a5871){return db[_0x9d70('0x31')]['create'](_0x1748d3[_0x9d70('0x18')],{'raw':_0x1748d3[_0x9d70('0x6')]?_0x1748d3[_0x9d70('0x6')][_0x9d70('0x7')]===undefined?!![]:![]:!![],'transaction':_0x4a5871})['then'](function(){logger[_0x9d70('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1748d3['options'][_0x9d70('0x8')]),_0x1748d3['options']['where']['active']);return db[_0x9d70('0x15')][_0x9d70('0x1c')]({'where':_0x1748d3['options']?_0x1748d3['options'][_0x9d70('0x8')]||null:null,'transaction':_0x4a5871});});})[_0x9d70('0xe')](function(_0x29448b){logger[_0x9d70('0xf')](_0x9d70('0x30'),_0x1748d3);logger[_0x9d70('0x10')](_0x9d70('0x30'),_0x1748d3,JSON['stringify'](_0x29448b));_0x37e0cd(_0x29448b);})['catch'](function(_0x2a472b){logger[_0x9d70('0x12')]('MoveContactManagedDialer',_0x2a472b[_0x9d70('0x13')],_0x1748d3);_0x50112d(_0x2fc043[_0x9d70('0x12')](0x1f4,_0x2a472b[_0x9d70('0x13')]));});});};exports[_0x9d70('0x32')]=function(_0x55a33a){var _0x1f1edd=this;return new Promise(function(_0x2da24c,_0x3f49f0){return db['CmHopper'][_0x9d70('0x5')]({'raw':_0x55a33a[_0x9d70('0x6')]?_0x55a33a[_0x9d70('0x6')][_0x9d70('0x7')]===undefined?!![]:![]:!![],'where':_0x55a33a[_0x9d70('0x6')]?_0x55a33a[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':[[db[_0x9d70('0x20')]['fn'](_0x9d70('0x33'),db[_0x9d70('0x20')]['fn']('IF',db[_0x9d70('0x20')][_0x9d70('0x34')](_0x9d70('0x35')+util[_0x9d70('0x36')](_0x9d70('0x37'),moment()[_0x9d70('0x36')](_0x9d70('0x38')))+_0x9d70('0x39')))),_0x9d70('0x3a')]]})['then'](function(_0xc27f61){logger[_0x9d70('0xf')](_0x9d70('0x32'),_0x55a33a);logger[_0x9d70('0x10')](_0x9d70('0x32'),_0x55a33a,JSON[_0x9d70('0x11')](_0xc27f61));_0x2da24c(_0xc27f61);})[_0x9d70('0x17')](function(_0x23ebfb){logger[_0x9d70('0x12')](_0x9d70('0x32'),_0x23ebfb[_0x9d70('0x13')],_0x55a33a);_0x3f49f0(_0x1f1edd[_0x9d70('0x12')](0x1f4,_0x23ebfb['message']));});});};exports[_0x9d70('0x3b')]=function(_0x3d16db){var _0x42bf94=this;return new Promise(function(_0x3a81e8,_0x44f39e){return db['CmContact'][_0x9d70('0x1f')]()[_0x9d70('0xe')](function(){return db[_0x9d70('0x20')][_0x9d70('0x21')](function(_0x3b58ad){return db[_0x9d70('0x15')][_0x9d70('0x5')]({'where':_0x3d16db['options']?_0x3d16db[_0x9d70('0x6')][_0x9d70('0x8')]||null:null,'attributes':_0x3d16db[_0x9d70('0x6')]?_0x3d16db[_0x9d70('0x6')][_0x9d70('0x9')]||null:null,'limit':0x1,'order':_0x3d16db[_0x9d70('0x6')]?_0x3d16db[_0x9d70('0x6')][_0x9d70('0x22')]||null:null,'group':db['CmHopper'][_0x9d70('0x3c')],'transaction':_0x3b58ad,'lock':_0x3b58ad[_0x9d70('0x3d')][_0x9d70('0x23')],'include':_0x3d16db['options']?_0x3d16db['options'][_0x9d70('0xb')]?_['map'](_0x3d16db[_0x9d70('0x6')][_0x9d70('0xb')],function(_0x10bfe7){return{'model':db[_0x10bfe7[_0x9d70('0xc')]],'as':_0x10bfe7['as'],'attributes':_0x10bfe7[_0x9d70('0x9')],'include':_0x10bfe7[_0x9d70('0xb')]?_['map'](_0x10bfe7['include'],function(_0x5f344c){return{'model':db[_0x5f344c[_0x9d70('0xc')]],'as':_0x5f344c['as'],'attributes':_0x5f344c[_0x9d70('0x9')],'include':_0x5f344c[_0x9d70('0xb')]?_[_0x9d70('0xd')](_0x5f344c[_0x9d70('0xb')],function(_0x5a0584){return{'model':db[_0x5a0584[_0x9d70('0xc')]],'as':_0x5a0584['as'],'attributes':_0x5a0584[_0x9d70('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39fd63){var _0x4e2a4e=[];for(var _0x552409=0x0;_0x552409<_0x39fd63[_0x9d70('0x28')];_0x552409+=0x1){_0x4e2a4e['push'](_0x39fd63[_0x552409][_0x9d70('0x1a')](_0x3d16db[_0x9d70('0x18')],{'transaction':_0x3b58ad}));}return BPromise['all'](_0x4e2a4e);});})[_0x9d70('0xe')](function(_0x5b6af0){logger[_0x9d70('0xf')]('GetContactRecallMe',_0x3d16db);logger[_0x9d70('0x10')]('GetContactRecallMe',_0x3d16db,JSON[_0x9d70('0x11')](_0x5b6af0));_0x3a81e8(_0x5b6af0);})['catch'](function(_0x5b6058){logger[_0x9d70('0x12')](_0x9d70('0x3b'),_0x5b6058[_0x9d70('0x13')],_0x3d16db);_0x44f39e(_0x42bf94[_0x9d70('0x12')](0x1f4,_0x5b6058[_0x9d70('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x370a55){var _0x129630=this;return new Promise(function(_0xbb2c80,_0x45745b){db[_0x9d70('0x1e')][_0x9d70('0x1f')]()[_0x9d70('0xe')](function(_0x30ed06){return db[_0x9d70('0x15')][_0x9d70('0x5')]({'raw':_0x370a55['options']?_0x370a55[_0x9d70('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x370a55['options']?_0x370a55[_0x9d70('0x6')]['where']||null:null,'attributes':_0x370a55[_0x9d70('0x6')]?_0x370a55[_0x9d70('0x6')][_0x9d70('0x9')]||null:null,'limit':_0x370a55[_0x9d70('0x6')]?_0x370a55[_0x9d70('0x6')][_0x9d70('0xa')]||null:null,'include':_0x370a55[_0x9d70('0x6')]?_0x370a55['options'][_0x9d70('0xb')]?_[_0x9d70('0xd')](_0x370a55[_0x9d70('0x6')][_0x9d70('0xb')],function(_0x1f4f41){return{'model':db[_0x1f4f41['model']],'as':_0x1f4f41['as'],'attributes':_0x1f4f41['as']===_0x9d70('0x24')?_[_0x9d70('0x25')](_0x30ed06):_0x1f4f41[_0x9d70('0x9')],'include':_0x1f4f41['include']?_[_0x9d70('0xd')](_0x1f4f41[_0x9d70('0xb')],function(_0x16581a){return{'model':db[_0x16581a[_0x9d70('0xc')]],'as':_0x16581a['as'],'attributes':_0x16581a[_0x9d70('0x9')],'include':_0x16581a['include']?_[_0x9d70('0xd')](_0x16581a[_0x9d70('0xb')],function(_0x5808a5){return{'model':db[_0x5808a5[_0x9d70('0xc')]],'as':_0x5808a5['as'],'attributes':_0x5808a5[_0x9d70('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f8e84){logger['info'](_0x9d70('0x4'),_0x370a55);logger[_0x9d70('0x10')](_0x9d70('0x4'),_0x370a55,JSON[_0x9d70('0x11')](_0x4f8e84));_0xbb2c80(_0x4f8e84);})[_0x9d70('0x17')](function(_0x26fa15){logger[_0x9d70('0x12')](_0x9d70('0x4'),_0x26fa15[_0x9d70('0x13')],_0x370a55);_0x45745b(_0x129630['error'](0x1f4,_0x26fa15[_0x9d70('0x13')]));});});});};exports[_0x9d70('0x3e')]=function(_0x1c3ac1){var _0x47c7f9=this;return new Promise(function(_0x227365,_0x316ab9){return db[_0x9d70('0x1e')][_0x9d70('0x3f')]({'raw':!![],'where':{'phone':_0x1c3ac1['options'][_0x9d70('0x8')][_0x9d70('0x40')]},'attributes':['id',_0x9d70('0x41')],'order':[['id',_0x9d70('0x42')]]})['then'](function(_0x382a0e){logger[_0x9d70('0xf')](_0x9d70('0x43'),_0x1c3ac1);logger['debug'](_0x9d70('0x43'),_0x1c3ac1,JSON[_0x9d70('0x11')](_0x382a0e));_0x227365(_0x382a0e);})[_0x9d70('0x17')](function(_0x32477d){logger[_0x9d70('0x12')](_0x9d70('0x43'),_0x32477d[_0x9d70('0x13')],_0x1c3ac1);_0x316ab9(_0x47c7f9[_0x9d70('0x12')](0x1f4,_0x32477d[_0x9d70('0x13')]));});});};exports[_0x9d70('0x44')]=function(_0x21628){var _0xdb1b15=this;return new Promise(function(_0x373d24,_0x57e275){return db[_0x9d70('0x20')][_0x9d70('0x21')](function(_0x48c645){var _0x3e2c2e=_0x21628[_0x9d70('0x6')]&&_0x21628[_0x9d70('0x6')][_0x9d70('0x8')]?_0x21628[_0x9d70('0x6')][_0x9d70('0x8')]:{};return db[_0x9d70('0x15')][_0x9d70('0x1a')](_0x21628[_0x9d70('0x18')],{'where':_0x3e2c2e,'transaction':_0x48c645})[_0x9d70('0xe')](function(_0x1b5d5b){logger[_0x9d70('0xf')]('ResetActiveCalls',_0x21628);logger[_0x9d70('0x10')](_0x9d70('0x44'),_0x21628,JSON[_0x9d70('0x11')](_0x1b5d5b));_0x373d24(_0x1b5d5b);})[_0x9d70('0x17')](function(_0x26925e){logger[_0x9d70('0x12')](_0x9d70('0x44'),_0x26925e[_0x9d70('0x13')],_0x21628);_0x57e275(_0xdb1b15[_0x9d70('0x12')](0x1f4,_0x26925e[_0x9d70('0x13')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x411428){var _0x1d78ac=this;var _0x189490=_0x411428[_0x9d70('0x18')][_0x9d70('0x8')][_0x9d70('0x45')];var _0x35f78f=_0x411428['body'][_0x9d70('0x8')]['interval'];var _0x24bd74=_0x411428[_0x9d70('0x18')][_0x9d70('0x8')][_0x9d70('0x46')];return new Promise(function(_0x315cfb,_0x136ebc){return db['CmHopper'][_0x9d70('0x5')]({'where':{'voiceQueueId':{'$in':_0x189490},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9d70('0x20')][_0x9d70('0x34')]('NOW()\x20+\x20INTERVAL\x20'+_0x35f78f+_0x9d70('0x47')),'$gt':db['sequelize'][_0x9d70('0x34')](_0x9d70('0x48'))}},'UserId':{'$in':_0x24bd74}},'include':[{'model':db['CmContact'],'as':_0x9d70('0x24')},{'model':db[_0x9d70('0x49')],'as':'Agent','attributes':['id',_0x9d70('0x27'),_0x9d70('0x4a')]},{'model':db[_0x9d70('0x4b')],'as':_0x9d70('0x4c')}]})['then'](function(_0x1a3f76){if(_0x1a3f76[_0x9d70('0x28')]>0x0){return db['sequelize'][_0x9d70('0x21')](function(_0x4f57e8){return db['CmHopper'][_0x9d70('0x1a')]({'recallmeNotifiedDate':db[_0x9d70('0x20')][_0x9d70('0x34')](_0x9d70('0x48'))},{'where':{'id':{'$in':_['map'](_0x1a3f76,'id')}},'transaction':_0x4f57e8})[_0x9d70('0xe')](function(){_0x315cfb(_0x1a3f76);})[_0x9d70('0x17')](function(_0x275b0c){logger[_0x9d70('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x275b0c[_0x9d70('0x13')],_0x411428);_0x136ebc(_0x1d78ac[_0x9d70('0x12')](0x1f4,_0x275b0c[_0x9d70('0x13')]));});})[_0x9d70('0x17')](function(_0x2d3677){logger[_0x9d70('0x12')](_0x9d70('0x4d'),_0x2d3677[_0x9d70('0x13')],_0x411428);_0x136ebc(_0x1d78ac[_0x9d70('0x12')](0x1f4,_0x2d3677['message']));});}else{_0x315cfb(_0x1a3f76);}});});}; \ No newline at end of file +var _0xad00=['raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','message','error','ShowCmHopper','then','CreateCmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','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]','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options'];(function(_0x40ff4e,_0x50a4a3){var _0x2ea887=function(_0x3a177b){while(--_0x3a177b){_0x40ff4e['push'](_0x40ff4e['shift']());}};_0x2ea887(++_0x50a4a3);}(_0xad00,0x195));var _0x0ad0=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xad00[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var moment=require(_0x0ad0('0x2'));var BPromise=require(_0x0ad0('0x3'));var db=require(_0x0ad0('0x4'))['db'];var logger=require(_0x0ad0('0x5'))('rpc');exports[_0x0ad0('0x6')]=function(_0x30b79d){var _0x2cc9ab=this;return new Promise(function(_0x5b5f98,_0x38c2b0){return db[_0x0ad0('0x7')][_0x0ad0('0x8')]({'raw':_0x30b79d[_0x0ad0('0x9')]?_0x30b79d[_0x0ad0('0x9')][_0x0ad0('0xa')]===undefined?!![]:![]:!![],'where':_0x30b79d[_0x0ad0('0x9')]?_0x30b79d[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null,'attributes':_0x30b79d[_0x0ad0('0x9')]?_0x30b79d['options'][_0x0ad0('0xc')]||null:null,'limit':_0x30b79d[_0x0ad0('0x9')]?_0x30b79d[_0x0ad0('0x9')][_0x0ad0('0xd')]||null:null,'include':_0x30b79d[_0x0ad0('0x9')]?_0x30b79d[_0x0ad0('0x9')][_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x30b79d[_0x0ad0('0x9')][_0x0ad0('0xe')],function(_0x107f27){return{'model':db[_0x107f27[_0x0ad0('0x10')]],'as':_0x107f27['as'],'attributes':_0x107f27[_0x0ad0('0xc')],'include':_0x107f27['include']?_['map'](_0x107f27[_0x0ad0('0xe')],function(_0x42ab5a){return{'model':db[_0x42ab5a[_0x0ad0('0x10')]],'as':_0x42ab5a['as'],'attributes':_0x42ab5a[_0x0ad0('0xc')],'include':_0x42ab5a[_0x0ad0('0xe')]?_['map'](_0x42ab5a[_0x0ad0('0xe')],function(_0x385ac8){return{'model':db[_0x385ac8['model']],'as':_0x385ac8['as'],'attributes':_0x385ac8[_0x0ad0('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x561c79){logger[_0x0ad0('0x11')](_0x0ad0('0x6'),_0x30b79d);logger[_0x0ad0('0x12')](_0x0ad0('0x6'),_0x30b79d,JSON[_0x0ad0('0x13')](_0x561c79));_0x5b5f98(_0x561c79);})[_0x0ad0('0x14')](function(_0x5424cc){logger['error'](_0x0ad0('0x6'),_0x5424cc[_0x0ad0('0x15')],_0x30b79d);_0x38c2b0(_0x2cc9ab[_0x0ad0('0x16')](0x1f4,_0x5424cc[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x17')]=function(_0x1a5f70){var _0x17de58=this;return new Promise(function(_0x14743a,_0x11a8ce){return db[_0x0ad0('0x7')]['find']({'raw':_0x1a5f70[_0x0ad0('0x9')]?_0x1a5f70['options'][_0x0ad0('0xa')]===undefined?!![]:![]:!![],'where':_0x1a5f70[_0x0ad0('0x9')]?_0x1a5f70[_0x0ad0('0x9')]['where']||null:null,'attributes':_0x1a5f70[_0x0ad0('0x9')]?_0x1a5f70['options'][_0x0ad0('0xc')]||null:null,'include':_0x1a5f70[_0x0ad0('0x9')]?_0x1a5f70[_0x0ad0('0x9')][_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x1a5f70['options']['include'],function(_0x39b216){return{'model':db[_0x39b216[_0x0ad0('0x10')]],'as':_0x39b216['as'],'attributes':_0x39b216[_0x0ad0('0xc')],'include':_0x39b216[_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x39b216[_0x0ad0('0xe')],function(_0x3300f1){return{'model':db[_0x3300f1[_0x0ad0('0x10')]],'as':_0x3300f1['as'],'attributes':_0x3300f1[_0x0ad0('0xc')],'include':_0x3300f1[_0x0ad0('0xe')]?_['map'](_0x3300f1['include'],function(_0x2a3f72){return{'model':db[_0x2a3f72[_0x0ad0('0x10')]],'as':_0x2a3f72['as'],'attributes':_0x2a3f72[_0x0ad0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x0ad0('0x18')](function(_0x321e70){logger['info'](_0x0ad0('0x17'),_0x1a5f70);logger[_0x0ad0('0x12')](_0x0ad0('0x17'),_0x1a5f70,JSON[_0x0ad0('0x13')](_0x321e70));_0x14743a(_0x321e70);})[_0x0ad0('0x14')](function(_0x19d2e2){logger[_0x0ad0('0x16')](_0x0ad0('0x17'),_0x19d2e2[_0x0ad0('0x15')],_0x1a5f70);_0x11a8ce(_0x17de58[_0x0ad0('0x16')](0x1f4,_0x19d2e2[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x19')]=function(_0x5eed72){var _0x86b2a8=this;return new Promise(function(_0x57e6fb,_0x3f6396){return db[_0x0ad0('0x7')][_0x0ad0('0x1a')](_0x5eed72[_0x0ad0('0x1b')],{'raw':_0x5eed72['options']?_0x5eed72[_0x0ad0('0x9')][_0x0ad0('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x21b9cb){logger['info']('CreateCmHopper',_0x5eed72);logger[_0x0ad0('0x12')](_0x0ad0('0x19'),_0x5eed72,JSON[_0x0ad0('0x13')](_0x21b9cb));_0x57e6fb(_0x21b9cb);})[_0x0ad0('0x14')](function(_0x5e3952){logger[_0x0ad0('0x16')](_0x0ad0('0x19'),_0x5e3952[_0x0ad0('0x15')],_0x5eed72);_0x3f6396(_0x86b2a8[_0x0ad0('0x16')](0x1f4,_0x5e3952[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x1c')]=function(_0x303b79){var _0x24fbb3=this;return new Promise(function(_0x5aca74,_0x2064bd){return db[_0x0ad0('0x7')][_0x0ad0('0x1d')](_0x303b79['body'],{'raw':_0x303b79[_0x0ad0('0x9')]?_0x303b79[_0x0ad0('0x9')][_0x0ad0('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x303b79[_0x0ad0('0x9')]?_0x303b79[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null,'attributes':_0x303b79['options']?_0x303b79[_0x0ad0('0x9')][_0x0ad0('0xc')]||null:null,'limit':_0x303b79['options']?_0x303b79[_0x0ad0('0x9')][_0x0ad0('0xd')]||null:null})[_0x0ad0('0x18')](function(_0x473244){logger[_0x0ad0('0x11')](_0x0ad0('0x1c'),_0x303b79);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x303b79[_0x0ad0('0x9')][_0x0ad0('0xb')]),_0x303b79[_0x0ad0('0x1b')][_0x0ad0('0x1e')]);logger['debug'](_0x0ad0('0x1c'),_0x303b79,JSON['stringify'](_0x473244));_0x5aca74(_0x473244);})[_0x0ad0('0x14')](function(_0x2fc9d5){logger[_0x0ad0('0x16')](_0x0ad0('0x1c'),_0x2fc9d5['message'],_0x303b79);_0x2064bd(_0x24fbb3[_0x0ad0('0x16')](0x1f4,_0x2fc9d5['message']));});});};exports[_0x0ad0('0x1f')]=function(_0x27bbb8){var _0x46b1a7=this;return new Promise(function(_0x2711a1,_0x12d53f){return db[_0x0ad0('0x7')][_0x0ad0('0x20')]({'where':_0x27bbb8['options']?_0x27bbb8[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null})[_0x0ad0('0x18')](function(_0x2a9472){logger[_0x0ad0('0x11')]('DestroyCmHopper',_0x27bbb8);logger[_0x0ad0('0x12')]('DestroyCmHopper',_0x27bbb8,JSON[_0x0ad0('0x13')](_0x2a9472));_0x2711a1(_0x2a9472);})[_0x0ad0('0x14')](function(_0x92aa2e){logger[_0x0ad0('0x16')](_0x0ad0('0x1f'),_0x92aa2e[_0x0ad0('0x15')],_0x27bbb8);_0x12d53f(_0x46b1a7[_0x0ad0('0x16')](0x1f4,_0x92aa2e[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x21')]=function(_0x27df16){var _0x97603b=this;return new Promise(function(_0x555e15,_0x2dbc25){return db[_0x0ad0('0x22')][_0x0ad0('0x23')]()[_0x0ad0('0x18')](function(_0x23bedc){return db[_0x0ad0('0x24')][_0x0ad0('0x25')](function(_0x1d31f1){return db[_0x0ad0('0x7')][_0x0ad0('0x8')]({'where':_0x27df16[_0x0ad0('0x9')]?_0x27df16['options'][_0x0ad0('0xb')]||null:null,'attributes':_0x27df16[_0x0ad0('0x9')]?_0x27df16[_0x0ad0('0x9')][_0x0ad0('0xc')]||null:null,'limit':_0x27df16[_0x0ad0('0x9')]?_0x27df16['options']['limit']||null:null,'order':_0x27df16['options']?_0x27df16['options'][_0x0ad0('0x26')]||null:null,'transaction':_0x1d31f1,'lock':_0x1d31f1[_0x0ad0('0x27')][_0x0ad0('0x28')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x0ad0('0x29')](_0x23bedc)},{'model':db[_0x0ad0('0x2a')],'as':_0x0ad0('0x2b'),'attributes':['id',_0x0ad0('0x2c'),_0x0ad0('0x2d')]}]})[_0x0ad0('0x18')](function(_0x22f1d9){var _0x42de28=[];var _0x3c0a90=[];for(var _0x300588=0x0;_0x300588<_0x22f1d9[_0x0ad0('0x2e')];_0x300588+=0x1){var _0x1b7acb=_0x22f1d9[_0x300588]['UserId'];if(_0x1b7acb===null){_0x42de28['push'](_0x22f1d9[_0x300588][_0x0ad0('0x1d')](_0x27df16[_0x0ad0('0x1b')],{'transaction':_0x1d31f1}));}else if(!_0x3c0a90[_0x0ad0('0x2f')](_0x1b7acb)){_0x3c0a90[_0x0ad0('0x30')](_0x1b7acb);_0x42de28[_0x0ad0('0x30')](_0x22f1d9[_0x300588][_0x0ad0('0x1d')](_0x27df16[_0x0ad0('0x1b')],{'transaction':_0x1d31f1}));}}return BPromise[_0x0ad0('0x31')](_0x42de28);});})[_0x0ad0('0x18')](function(_0x186cd4){logger[_0x0ad0('0x11')](_0x0ad0('0x21'),_0x27df16);if(_0x186cd4[_0x0ad0('0x2e')]>0x0){logger['info'](_0x0ad0('0x32'),_0x186cd4[0x0][_0x0ad0('0x33')]['id'],_0x186cd4[0x0][_0x0ad0('0x33')][_0x0ad0('0x34')],_0x186cd4[0x0][_0x0ad0('0x33')][_0x0ad0('0x1e')]);}logger[_0x0ad0('0x12')](_0x0ad0('0x21'),_0x27df16,JSON['stringify'](_0x186cd4));_0x555e15(_0x186cd4);})[_0x0ad0('0x14')](function(_0x40ede3){logger[_0x0ad0('0x16')](_0x0ad0('0x21'),_0x40ede3[_0x0ad0('0x15')],_0x27df16);_0x2dbc25(_0x97603b[_0x0ad0('0x16')](0x1f4,_0x40ede3['message']));});});});};exports[_0x0ad0('0x35')]=function(_0x48f08c){var _0x136bfe=this;return new Promise(function(_0x1b1d60,_0x32fe59){return db[_0x0ad0('0x24')][_0x0ad0('0x25')](function(_0x1dd6ec){return db[_0x0ad0('0x36')][_0x0ad0('0x1a')](_0x48f08c[_0x0ad0('0x1b')],{'raw':_0x48f08c[_0x0ad0('0x9')]?_0x48f08c[_0x0ad0('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1dd6ec})['then'](function(){logger[_0x0ad0('0x11')](_0x0ad0('0x37'),JSON['stringify'](_0x48f08c[_0x0ad0('0x9')][_0x0ad0('0xb')]),_0x48f08c[_0x0ad0('0x9')][_0x0ad0('0xb')][_0x0ad0('0x1e')]);return db[_0x0ad0('0x7')][_0x0ad0('0x20')]({'where':_0x48f08c[_0x0ad0('0x9')]?_0x48f08c[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null,'transaction':_0x1dd6ec});});})[_0x0ad0('0x18')](function(_0x151423){logger[_0x0ad0('0x11')](_0x0ad0('0x35'),_0x48f08c);logger[_0x0ad0('0x12')](_0x0ad0('0x35'),_0x48f08c,JSON[_0x0ad0('0x13')](_0x151423));_0x1b1d60(_0x151423);})[_0x0ad0('0x14')](function(_0x58f824){logger[_0x0ad0('0x16')](_0x0ad0('0x35'),_0x58f824[_0x0ad0('0x15')],_0x48f08c);_0x32fe59(_0x136bfe[_0x0ad0('0x16')](0x1f4,_0x58f824[_0x0ad0('0x15')]));});});};exports['CountReScheduled']=function(_0x534d1e){var _0xe03cc5=this;return new Promise(function(_0x27285e,_0x5258e7){return db['CmHopper']['findAll']({'raw':_0x534d1e[_0x0ad0('0x9')]?_0x534d1e[_0x0ad0('0x9')][_0x0ad0('0xa')]===undefined?!![]:![]:!![],'where':_0x534d1e['options']?_0x534d1e[_0x0ad0('0x9')]['where']||null:null,'attributes':[[db[_0x0ad0('0x24')]['fn'](_0x0ad0('0x38'),db[_0x0ad0('0x24')]['fn']('IF',db['sequelize']['literal'](_0x0ad0('0x39')+util['format'](_0x0ad0('0x3a'),moment()[_0x0ad0('0x3b')](_0x0ad0('0x3c')))+_0x0ad0('0x3d')))),_0x0ad0('0x3e')]]})[_0x0ad0('0x18')](function(_0x5c57df){logger[_0x0ad0('0x11')](_0x0ad0('0x3f'),_0x534d1e);logger['debug']('CountReScheduled',_0x534d1e,JSON['stringify'](_0x5c57df));_0x27285e(_0x5c57df);})[_0x0ad0('0x14')](function(_0x325434){logger[_0x0ad0('0x16')](_0x0ad0('0x3f'),_0x325434[_0x0ad0('0x15')],_0x534d1e);_0x5258e7(_0xe03cc5[_0x0ad0('0x16')](0x1f4,_0x325434[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x40')]=function(_0x5d0ed2){var _0x3e4ada=this;return new Promise(function(_0x938fdf,_0x462e33){return db['CmContact'][_0x0ad0('0x23')]()[_0x0ad0('0x18')](function(){return db[_0x0ad0('0x24')][_0x0ad0('0x25')](function(_0x3a0151){return db[_0x0ad0('0x7')][_0x0ad0('0x8')]({'where':_0x5d0ed2[_0x0ad0('0x9')]?_0x5d0ed2[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null,'attributes':_0x5d0ed2['options']?_0x5d0ed2[_0x0ad0('0x9')][_0x0ad0('0xc')]||null:null,'limit':0x1,'order':_0x5d0ed2['options']?_0x5d0ed2['options']['order']||null:null,'group':db['CmHopper'][_0x0ad0('0x41')],'transaction':_0x3a0151,'lock':_0x3a0151[_0x0ad0('0x27')][_0x0ad0('0x28')],'include':_0x5d0ed2[_0x0ad0('0x9')]?_0x5d0ed2[_0x0ad0('0x9')]['include']?_[_0x0ad0('0xf')](_0x5d0ed2[_0x0ad0('0x9')][_0x0ad0('0xe')],function(_0xeb1f6d){return{'model':db[_0xeb1f6d['model']],'as':_0xeb1f6d['as'],'attributes':_0xeb1f6d[_0x0ad0('0xc')],'include':_0xeb1f6d[_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0xeb1f6d[_0x0ad0('0xe')],function(_0x388147){return{'model':db[_0x388147[_0x0ad0('0x10')]],'as':_0x388147['as'],'attributes':_0x388147[_0x0ad0('0xc')],'include':_0x388147['include']?_[_0x0ad0('0xf')](_0x388147['include'],function(_0x57c10a){return{'model':db[_0x57c10a[_0x0ad0('0x10')]],'as':_0x57c10a['as'],'attributes':_0x57c10a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4351ff){var _0x35c1c5=[];for(var _0x3f2524=0x0;_0x3f2524<_0x4351ff['length'];_0x3f2524+=0x1){_0x35c1c5[_0x0ad0('0x30')](_0x4351ff[_0x3f2524][_0x0ad0('0x1d')](_0x5d0ed2[_0x0ad0('0x1b')],{'transaction':_0x3a0151}));}return BPromise[_0x0ad0('0x31')](_0x35c1c5);});})['then'](function(_0x540c61){logger['info'](_0x0ad0('0x40'),_0x5d0ed2);logger['debug']('GetContactRecallMe',_0x5d0ed2,JSON[_0x0ad0('0x13')](_0x540c61));_0x938fdf(_0x540c61);})[_0x0ad0('0x14')](function(_0x418dd9){logger[_0x0ad0('0x16')](_0x0ad0('0x40'),_0x418dd9[_0x0ad0('0x15')],_0x5d0ed2);_0x462e33(_0x3e4ada['error'](0x1f4,_0x418dd9[_0x0ad0('0x15')]));});});});};exports[_0x0ad0('0x42')]=function(_0x25dd25){var _0x1f47c1=this;return new Promise(function(_0xd0d6f2,_0x16dd9e){db[_0x0ad0('0x22')][_0x0ad0('0x23')]()[_0x0ad0('0x18')](function(_0x183041){return db[_0x0ad0('0x7')]['findAll']({'raw':_0x25dd25['options']?_0x25dd25[_0x0ad0('0x9')][_0x0ad0('0xa')]===undefined?!![]:![]:!![],'where':_0x25dd25[_0x0ad0('0x9')]?_0x25dd25[_0x0ad0('0x9')][_0x0ad0('0xb')]||null:null,'attributes':_0x25dd25['options']?_0x25dd25[_0x0ad0('0x9')][_0x0ad0('0xc')]||null:null,'limit':_0x25dd25[_0x0ad0('0x9')]?_0x25dd25[_0x0ad0('0x9')][_0x0ad0('0xd')]||null:null,'include':_0x25dd25['options']?_0x25dd25['options'][_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x25dd25['options']['include'],function(_0x569f70){return{'model':db[_0x569f70['model']],'as':_0x569f70['as'],'attributes':_0x569f70['as']===_0x0ad0('0x43')?_[_0x0ad0('0x29')](_0x183041):_0x569f70[_0x0ad0('0xc')],'include':_0x569f70[_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x569f70['include'],function(_0x3b77f9){return{'model':db[_0x3b77f9[_0x0ad0('0x10')]],'as':_0x3b77f9['as'],'attributes':_0x3b77f9['attributes'],'include':_0x3b77f9[_0x0ad0('0xe')]?_[_0x0ad0('0xf')](_0x3b77f9[_0x0ad0('0xe')],function(_0x40aeb1){return{'model':db[_0x40aeb1['model']],'as':_0x40aeb1['as'],'attributes':_0x40aeb1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x353af5){logger[_0x0ad0('0x11')](_0x0ad0('0x6'),_0x25dd25);logger[_0x0ad0('0x12')](_0x0ad0('0x6'),_0x25dd25,JSON['stringify'](_0x353af5));_0xd0d6f2(_0x353af5);})[_0x0ad0('0x14')](function(_0x463425){logger['error'](_0x0ad0('0x6'),_0x463425[_0x0ad0('0x15')],_0x25dd25);_0x16dd9e(_0x1f47c1[_0x0ad0('0x16')](0x1f4,_0x463425['message']));});});});};exports[_0x0ad0('0x44')]=function(_0x1dacb1){var _0x4bf21b=this;return new Promise(function(_0x3a0554,_0x289dc8){return db['CmContact'][_0x0ad0('0x45')]({'raw':!![],'where':{'phone':_0x1dacb1[_0x0ad0('0x9')]['where'][_0x0ad0('0x46')]},'attributes':['id',_0x0ad0('0x47')],'order':[['id',_0x0ad0('0x48')]]})[_0x0ad0('0x18')](function(_0x17b530){logger[_0x0ad0('0x11')](_0x0ad0('0x49'),_0x1dacb1);logger[_0x0ad0('0x12')](_0x0ad0('0x49'),_0x1dacb1,JSON[_0x0ad0('0x13')](_0x17b530));_0x3a0554(_0x17b530);})[_0x0ad0('0x14')](function(_0x35a9bd){logger['error'](_0x0ad0('0x49'),_0x35a9bd['message'],_0x1dacb1);_0x289dc8(_0x4bf21b['error'](0x1f4,_0x35a9bd[_0x0ad0('0x15')]));});});};exports[_0x0ad0('0x4a')]=function(_0x580578){var _0xc24fe=this;return new Promise(function(_0x52d315,_0x5be59c){return db[_0x0ad0('0x24')][_0x0ad0('0x25')](function(_0x402953){var _0x5a0aa7=_0x580578['options']&&_0x580578[_0x0ad0('0x9')][_0x0ad0('0xb')]?_0x580578[_0x0ad0('0x9')][_0x0ad0('0xb')]:{};return db[_0x0ad0('0x7')][_0x0ad0('0x1d')](_0x580578[_0x0ad0('0x1b')],{'where':_0x5a0aa7,'transaction':_0x402953})[_0x0ad0('0x18')](function(_0x20875e){logger[_0x0ad0('0x11')](_0x0ad0('0x4a'),_0x580578);logger['debug']('ResetActiveCalls',_0x580578,JSON['stringify'](_0x20875e));_0x52d315(_0x20875e);})[_0x0ad0('0x14')](function(_0x551cd6){logger[_0x0ad0('0x16')](_0x0ad0('0x4a'),_0x551cd6[_0x0ad0('0x15')],_0x580578);_0x5be59c(_0xc24fe[_0x0ad0('0x16')](0x1f4,_0x551cd6[_0x0ad0('0x15')]));});});});};exports[_0x0ad0('0x4b')]=function(_0x1cfa4c){var _0x5c2bec=this;var _0x28af87=_0x1cfa4c[_0x0ad0('0x1b')][_0x0ad0('0xb')]['voiceQueueIds'];var _0x59fa96=_0x1cfa4c[_0x0ad0('0x1b')][_0x0ad0('0xb')][_0x0ad0('0x4c')];var _0x559583=_0x1cfa4c[_0x0ad0('0x1b')]['where'][_0x0ad0('0x4d')];return new Promise(function(_0x186d86,_0x387426){return db[_0x0ad0('0x7')][_0x0ad0('0x8')]({'where':{'voiceQueueId':{'$in':_0x28af87},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x0ad0('0x24')][_0x0ad0('0x4e')](_0x0ad0('0x4f')+_0x59fa96+_0x0ad0('0x50')),'$gt':db[_0x0ad0('0x24')][_0x0ad0('0x4e')]('NOW()')}},'UserId':{'$in':_0x559583}},'include':[{'model':db[_0x0ad0('0x22')],'as':_0x0ad0('0x43')},{'model':db[_0x0ad0('0x2a')],'as':_0x0ad0('0x2b'),'attributes':['id',_0x0ad0('0x2c'),_0x0ad0('0x2d')]},{'model':db[_0x0ad0('0x51')],'as':'List'}]})['then'](function(_0x5c7be7){if(_0x5c7be7['length']>0x0){return db['sequelize'][_0x0ad0('0x25')](function(_0x76554){return db[_0x0ad0('0x7')][_0x0ad0('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0x0ad0('0x4e')](_0x0ad0('0x52'))},{'where':{'id':{'$in':_[_0x0ad0('0xf')](_0x5c7be7,'id')}},'transaction':_0x76554})['then'](function(){_0x186d86(_0x5c7be7);})[_0x0ad0('0x14')](function(_0x43b515){logger[_0x0ad0('0x16')](_0x0ad0('0x4b'),_0x43b515['message'],_0x1cfa4c);_0x387426(_0x5c2bec['error'](0x1f4,_0x43b515[_0x0ad0('0x15')]));});})[_0x0ad0('0x14')](function(_0x1f59b4){logger[_0x0ad0('0x16')]('CmHopperHandlePreviewRecallNotifications',_0x1f59b4[_0x0ad0('0x15')],_0x1cfa4c);_0x387426(_0x5c2bec[_0x0ad0('0x16')](0x1f4,_0x1f59b4['message']));});}else{_0x186d86(_0x5c7be7);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2a26be2..d687a59 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 _0xa208=['create','/preview','getPreview','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post'];(function(_0x2a2783,_0x493053){var _0x287a57=function(_0x19de32){while(--_0x19de32){_0x2a2783['push'](_0x2a2783['shift']());}};_0x287a57(++_0x493053);}(_0xa208,0x18f));var _0x8a20=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa208[_0x34bc30];return _0x5706de;};'use strict';var express=require(_0x8a20('0x0'));var router=express[_0x8a20('0x1')]();var auth=require(_0x8a20('0x2'));var controller=require('./cmHopper.controller');router[_0x8a20('0x3')]('/',auth[_0x8a20('0x4')](),controller[_0x8a20('0x5')]);router['get'](_0x8a20('0x6'),auth[_0x8a20('0x4')](),controller[_0x8a20('0x7')]);router[_0x8a20('0x3')](_0x8a20('0x8'),auth[_0x8a20('0x4')](),controller[_0x8a20('0x9')]);router[_0x8a20('0x3')]('/timezones',auth[_0x8a20('0x4')](),controller[_0x8a20('0xa')]);router['get'](_0x8a20('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8a20('0x3')](_0x8a20('0xc'),auth[_0x8a20('0x4')](),controller[_0x8a20('0xd')]);router[_0x8a20('0xe')]('/',auth[_0x8a20('0x4')](),controller[_0x8a20('0xf')]);router[_0x8a20('0xe')](_0x8a20('0x10'),auth[_0x8a20('0x4')](),controller[_0x8a20('0x11')]);router[_0x8a20('0xe')]('/timezone',auth[_0x8a20('0x4')](),controller['getTimezone']);router[_0x8a20('0x12')](_0x8a20('0xb'),auth['isAuthenticated'](),controller[_0x8a20('0x13')]);router[_0x8a20('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a20('0x15')]);module[_0x8a20('0x16')]=router; \ No newline at end of file +var _0xa8c4=['/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','getPreviewRecall','post','create','/preview','getPreview','getTimezone','/:id','update','delete','destroy','express','Router','./cmHopper.controller','get','isAuthenticated'];(function(_0x53ac51,_0x54af0a){var _0x5db74e=function(_0x354216){while(--_0x354216){_0x53ac51['push'](_0x53ac51['shift']());}};_0x5db74e(++_0x54af0a);}(_0xa8c4,0x15b));var _0x4a8c=function(_0x36c230,_0x1c7cfd){_0x36c230=_0x36c230-0x0;var _0x321e0e=_0xa8c4[_0x36c230];return _0x321e0e;};'use strict';var express=require(_0x4a8c('0x0'));var router=express[_0x4a8c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4a8c('0x2'));router[_0x4a8c('0x3')]('/',auth[_0x4a8c('0x4')](),controller['index']);router['get'](_0x4a8c('0x5'),auth[_0x4a8c('0x4')](),controller[_0x4a8c('0x6')]);router[_0x4a8c('0x3')](_0x4a8c('0x7'),auth['isAuthenticated'](),controller[_0x4a8c('0x8')]);router['get'](_0x4a8c('0x9'),auth[_0x4a8c('0x4')](),controller[_0x4a8c('0xa')]);router[_0x4a8c('0x3')]('/:id',auth[_0x4a8c('0x4')](),controller[_0x4a8c('0xb')]);router[_0x4a8c('0x3')]('/:id/previewrecall',auth[_0x4a8c('0x4')](),controller[_0x4a8c('0xc')]);router[_0x4a8c('0xd')]('/',auth[_0x4a8c('0x4')](),controller[_0x4a8c('0xe')]);router[_0x4a8c('0xd')](_0x4a8c('0xf'),auth[_0x4a8c('0x4')](),controller[_0x4a8c('0x10')]);router[_0x4a8c('0xd')]('/timezone',auth['isAuthenticated'](),controller[_0x4a8c('0x11')]);router['put'](_0x4a8c('0x12'),auth[_0x4a8c('0x4')](),controller[_0x4a8c('0x13')]);router[_0x4a8c('0x14')](_0x4a8c('0x12'),auth['isAuthenticated'](),controller[_0x4a8c('0x15')]);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 440df9c..82803e5 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 _0x1712=['moment','sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3571af,_0x4f577b){var _0x5641e2=function(_0x200cff){while(--_0x200cff){_0x3571af['push'](_0x3571af['shift']());}};_0x5641e2(++_0x4f577b);}(_0x1712,0xc4));var _0x2171=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x1712[_0x35885a];return _0xe86249;};'use strict';var moment=require(_0x2171('0x0'));var Sequelize=require(_0x2171('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x2171('0x2')]},'phone':{'type':Sequelize[_0x2171('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2171('0x4')],'defaultValue':moment()[_0x2171('0x5')](_0x2171('0x6'))},'countbusyretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2171('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc8ba=['sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x2475fb,_0x238ba5){var _0x5a879a=function(_0x997461){while(--_0x997461){_0x2475fb['push'](_0x2475fb['shift']());}};_0x5a879a(++_0x238ba5);}(_0xc8ba,0x1c6));var _0xac8b=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xc8ba[_0x329437];return _0x3789d9;};'use strict';var moment=require(_0xac8b('0x0'));var Sequelize=require(_0xac8b('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xac8b('0x2')]},'phone':{'type':Sequelize[_0xac8b('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xac8b('0x4')],'defaultValue':moment()[_0xac8b('0x5')](_0xac8b('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xac8b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xac8b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xac8b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xac8b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 86eadae..0f732cc 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 _0x893b=['user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','then','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','show','keys','length','includeAll','find','catch','create'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x893b,0xaa));var _0xb893=function(_0x2520ee,_0x3c2a45){_0x2520ee=_0x2520ee-0x0;var _0x1cf5cb=_0x893b[_0x2520ee];return _0x1cf5cb;};'use strict';var emlformat=require(_0xb893('0x0'));var rimraf=require(_0xb893('0x1'));var zipdir=require(_0xb893('0x2'));var jsonpatch=require(_0xb893('0x3'));var rp=require(_0xb893('0x4'));var moment=require(_0xb893('0x5'));var BPromise=require(_0xb893('0x6'));var Mustache=require(_0xb893('0x7'));var util=require(_0xb893('0x8'));var path=require(_0xb893('0x9'));var sox=require(_0xb893('0xa'));var csv=require(_0xb893('0xb'));var ejs=require(_0xb893('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb893('0xd'));var squel=require('squel');var crypto=require(_0xb893('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb893('0xf'));var toCsv=require(_0xb893('0xb'));var querystring=require(_0xb893('0x10'));var Papa=require(_0xb893('0x11'));var Redis=require(_0xb893('0x12'));var authService=require(_0xb893('0x13'));var qs=require(_0xb893('0x14'));var as=require(_0xb893('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb893('0x16'))(_0xb893('0x17'));var utils=require(_0xb893('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aa96e,_0x539ea9){_0x539ea9=_0x539ea9||0xcc;return function(_0x32c938){if(_0x32c938){return _0x2aa96e[_0xb893('0x19')](_0x539ea9);}return _0x2aa96e[_0xb893('0x1a')](_0x539ea9)[_0xb893('0x1b')]();};}function respondWithResult(_0xe04f8d,_0x18aa95){_0x18aa95=_0x18aa95||0xc8;return function(_0x48908c){if(_0x48908c){return _0xe04f8d['status'](_0x18aa95)['json'](_0x48908c);}};}function respondWithFilteredResult(_0x5579ae,_0x36cba9){return function(_0x570390){if(_0x570390){var _0x34a9f2=typeof _0x36cba9[_0xb893('0x1c')]===_0xb893('0x1d')&&typeof _0x36cba9[_0xb893('0x1e')]==='undefined';var _0x1657bb=_0x570390[_0xb893('0x1f')];var _0x1ae841=_0x34a9f2?0x0:_0x36cba9[_0xb893('0x1c')];var _0x5deb0e=_0x34a9f2?_0x570390[_0xb893('0x1f')]:_0x36cba9['offset']+_0x36cba9[_0xb893('0x1e')];var _0x5b33b0;if(_0x5deb0e>=_0x1657bb){_0x5deb0e=_0x1657bb;_0x5b33b0=0xc8;}else{_0x5b33b0=0xce;}_0x5579ae[_0xb893('0x1a')](_0x5b33b0);return _0x5579ae['set']('Content-Range',_0x1ae841+'-'+_0x5deb0e+'/'+_0x1657bb)[_0xb893('0x20')](_0x570390);}return null;};}function patchUpdates(_0x53c98a){return function(_0x208512){try{jsonpatch[_0xb893('0x21')](_0x208512,_0x53c98a,!![]);}catch(_0x47497c){return BPromise['reject'](_0x47497c);}return _0x208512[_0xb893('0x22')]();};}function saveUpdates(_0x1b5fac,_0x13c16c){return function(_0x5c3381){if(_0x5c3381){return _0x5c3381[_0xb893('0x23')](_0x1b5fac)[_0xb893('0x24')](function(_0x1edffd){return _0x1edffd;});}return null;};}function removeEntity(_0x382822,_0x428f74){return function(_0x57949f){if(_0x57949f){return _0x57949f['destroy']()[_0xb893('0x24')](function(){var _0x7defcf=_0x57949f['get']({'plain':!![]});var _0x4324da=_0xb893('0x25');return db[_0xb893('0x26')][_0xb893('0x27')]({'where':{'type':_0x4324da,'resourceId':_0x7defcf['id']}})[_0xb893('0x24')](function(){return _0x57949f;});})['then'](function(){_0x382822[_0xb893('0x1a')](0xcc)[_0xb893('0x1b')]();});}};}function handleEntityNotFound(_0x112d0e,_0xbb5adb){return function(_0x45d8c7){if(!_0x45d8c7){_0x112d0e[_0xb893('0x19')](0x194);}return _0x45d8c7;};}function handleError(_0x3e1abb,_0x42e35d){_0x42e35d=_0x42e35d||0x1f4;return function(_0x42e33d){logger[_0xb893('0x28')](_0x42e33d[_0xb893('0x29')]);if(_0x42e33d[_0xb893('0x2a')]){delete _0x42e33d[_0xb893('0x2a')];}_0x3e1abb['status'](_0x42e35d)[_0xb893('0x2b')](_0x42e33d);};}exports['index']=function(_0x40635e,_0x581ac1){var _0x213788={},_0x559513={},_0x18dd45={'count':0x0,'rows':[]};var _0x2c49a0=_['map'](db[_0xb893('0x2c')][_0xb893('0x2d')],function(_0x4061c8){return{'name':_0x4061c8[_0xb893('0x2e')],'type':_0x4061c8[_0xb893('0x2f')][_0xb893('0x30')]};});_0x559513[_0xb893('0x31')]=_[_0xb893('0x32')](_0x2c49a0,_0xb893('0x2a'));_0x559513[_0xb893('0x33')]=_['keys'](_0x40635e[_0xb893('0x33')]);_0x559513[_0xb893('0x34')]=_[_0xb893('0x35')](_0x559513[_0xb893('0x31')],_0x559513[_0xb893('0x33')]);_0x213788[_0xb893('0x36')]=_[_0xb893('0x35')](_0x559513['model'],qs[_0xb893('0x37')](_0x40635e[_0xb893('0x33')][_0xb893('0x37')]));_0x213788[_0xb893('0x36')]=_0x213788[_0xb893('0x36')]['length']?_0x213788[_0xb893('0x36')]:_0x559513[_0xb893('0x31')];if(!_0x40635e['query'][_0xb893('0x38')](_0xb893('0x39'))){_0x213788[_0xb893('0x1e')]=qs[_0xb893('0x1e')](_0x40635e[_0xb893('0x33')][_0xb893('0x1e')]);_0x213788[_0xb893('0x1c')]=qs[_0xb893('0x1c')](_0x40635e[_0xb893('0x33')]['offset']);}_0x213788[_0xb893('0x3a')]=qs[_0xb893('0x3b')](_0x40635e[_0xb893('0x33')][_0xb893('0x3b')]);_0x213788[_0xb893('0x3c')]=qs['filters'](_[_0xb893('0x3d')](_0x40635e[_0xb893('0x33')],_0x559513['filters']),_0x2c49a0);if(_0x40635e[_0xb893('0x33')][_0xb893('0x3e')]){_0x213788[_0xb893('0x3c')]=_['merge'](_0x213788[_0xb893('0x3c')],{'$or':_[_0xb893('0x32')](_0x2c49a0,function(_0x3a6ac2){if(_0x3a6ac2[_0xb893('0x2f')]!=='VIRTUAL'){var _0x3ec7aa={};_0x3ec7aa[_0x3a6ac2['name']]={'$like':'%'+_0x40635e[_0xb893('0x33')][_0xb893('0x3e')]+'%'};return _0x3ec7aa;}})});}_0x213788=_[_0xb893('0x3f')]({},_0x213788,_0x40635e[_0xb893('0x40')]);var _0x341f8b={'where':_0x213788[_0xb893('0x3c')]};return db['CmHopperAdditionalPhone']['count'](_0x341f8b)[_0xb893('0x24')](function(_0xb5d62c){_0x18dd45[_0xb893('0x1f')]=_0xb5d62c;if(_0x40635e['query']['includeAll']){_0x213788[_0xb893('0x41')]=[{'all':!![]}];}return db[_0xb893('0x2c')]['findAll'](_0x213788);})[_0xb893('0x24')](function(_0x1e1d11){_0x18dd45['rows']=_0x1e1d11;return _0x18dd45;})[_0xb893('0x24')](respondWithFilteredResult(_0x581ac1,_0x213788))['catch'](handleError(_0x581ac1,null));};exports[_0xb893('0x42')]=function(_0x5b26f2,_0x1b435e){var _0x3e0508={'raw':!![],'where':{'id':_0x5b26f2['params']['id']}},_0xec9734={};_0xec9734[_0xb893('0x31')]=_['keys'](db[_0xb893('0x2c')][_0xb893('0x2d')]);_0xec9734[_0xb893('0x33')]=_[_0xb893('0x43')](_0x5b26f2['query']);_0xec9734[_0xb893('0x34')]=_[_0xb893('0x35')](_0xec9734[_0xb893('0x31')],_0xec9734[_0xb893('0x33')]);_0x3e0508[_0xb893('0x36')]=_[_0xb893('0x35')](_0xec9734['model'],qs['fields'](_0x5b26f2[_0xb893('0x33')][_0xb893('0x37')]));_0x3e0508[_0xb893('0x36')]=_0x3e0508['attributes'][_0xb893('0x44')]?_0x3e0508[_0xb893('0x36')]:_0xec9734[_0xb893('0x31')];if(_0x5b26f2[_0xb893('0x33')][_0xb893('0x45')]){_0x3e0508['include']=[{'all':!![]}];}_0x3e0508=_[_0xb893('0x3f')]({},_0x3e0508,_0x5b26f2[_0xb893('0x40')]);return db['CmHopperAdditionalPhone'][_0xb893('0x46')](_0x3e0508)[_0xb893('0x24')](handleEntityNotFound(_0x1b435e,null))['then'](respondWithResult(_0x1b435e,null))[_0xb893('0x47')](handleError(_0x1b435e,null));};exports[_0xb893('0x48')]=function(_0x41ec2f,_0x57943b){return db['CmHopperAdditionalPhone']['create'](_0x41ec2f['body'],{})[_0xb893('0x24')](function(_0x410dd7){var _0x1b2680=_0x41ec2f[_0xb893('0x49')][_0xb893('0x4a')]({'plain':!![]});if(!_0x1b2680)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b2680['role']===_0xb893('0x49')){var _0x14cfc6=_0x410dd7[_0xb893('0x4a')]({'plain':!![]});var _0x275643=_0xb893('0x25');return db[_0xb893('0x4b')][_0xb893('0x46')]({'where':{'name':_0x275643,'userProfileId':_0x1b2680[_0xb893('0x4c')]},'raw':!![]})[_0xb893('0x24')](function(_0x21136b){if(_0x21136b&&_0x21136b[_0xb893('0x4d')]===0x0){return db['UserProfileResource'][_0xb893('0x48')]({'name':_0x14cfc6[_0xb893('0x2a')],'resourceId':_0x14cfc6['id'],'type':_0x21136b[_0xb893('0x2a')],'sectionId':_0x21136b['id']},{})['then'](function(){return _0x410dd7;});}else{return _0x410dd7;}})[_0xb893('0x47')](function(_0x146056){logger[_0xb893('0x28')](_0xb893('0x4e'),_0x146056);throw _0x146056;});}return _0x410dd7;})[_0xb893('0x24')](respondWithResult(_0x57943b,0xc9))['catch'](handleError(_0x57943b,null));};exports[_0xb893('0x23')]=function(_0x316f9a,_0x3bef8e){if(_0x316f9a[_0xb893('0x4f')]['id']){delete _0x316f9a[_0xb893('0x4f')]['id'];}return db[_0xb893('0x2c')][_0xb893('0x46')]({'where':{'id':_0x316f9a['params']['id']}})[_0xb893('0x24')](handleEntityNotFound(_0x3bef8e,null))[_0xb893('0x24')](saveUpdates(_0x316f9a[_0xb893('0x4f')],null))[_0xb893('0x24')](respondWithResult(_0x3bef8e,null))[_0xb893('0x47')](handleError(_0x3bef8e,null));};exports[_0xb893('0x27')]=function(_0x5774c5,_0x24b705){return db[_0xb893('0x2c')][_0xb893('0x46')]({'where':{'id':_0x5774c5[_0xb893('0x50')]['id']}})['then'](handleEntityNotFound(_0x24b705,null))[_0xb893('0x24')](removeEntity(_0x24b705,null))['catch'](handleError(_0x24b705,null));}; \ No newline at end of file +var _0xaed9=['role','CmHopperAdditionalPhones','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','get','end','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','keys','length','create','user'];(function(_0x231bff,_0x3efa9a){var _0x345108=function(_0x3ee4ee){while(--_0x3ee4ee){_0x231bff['push'](_0x231bff['shift']());}};_0x345108(++_0x3efa9a);}(_0xaed9,0x1a7));var _0x9aed=function(_0x3ff6cf,_0x8e4ad2){_0x3ff6cf=_0x3ff6cf-0x0;var _0x20f5e1=_0xaed9[_0x3ff6cf];return _0x20f5e1;};'use strict';var emlformat=require(_0x9aed('0x0'));var rimraf=require(_0x9aed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9aed('0x2'));var moment=require(_0x9aed('0x3'));var BPromise=require(_0x9aed('0x4'));var Mustache=require(_0x9aed('0x5'));var util=require(_0x9aed('0x6'));var path=require(_0x9aed('0x7'));var sox=require(_0x9aed('0x8'));var csv=require(_0x9aed('0x9'));var ejs=require(_0x9aed('0xa'));var fs=require('fs');var fs_extra=require(_0x9aed('0xb'));var _=require(_0x9aed('0xc'));var squel=require(_0x9aed('0xd'));var crypto=require(_0x9aed('0xe'));var jsforce=require(_0x9aed('0xf'));var deskjs=require(_0x9aed('0x10'));var toCsv=require(_0x9aed('0x9'));var querystring=require('querystring');var Papa=require(_0x9aed('0x11'));var Redis=require(_0x9aed('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9aed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9aed('0x14'))(_0x9aed('0x15'));var utils=require(_0x9aed('0x16'));var config=require(_0x9aed('0x17'));var licenseUtil=require(_0x9aed('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1ea2,_0x158d70){_0x158d70=_0x158d70||0xcc;return function(_0x36788c){if(_0x36788c){return _0x1c1ea2[_0x9aed('0x19')](_0x158d70);}return _0x1c1ea2[_0x9aed('0x1a')](_0x158d70)['end']();};}function respondWithResult(_0x1ca0c0,_0x5b5ad5){_0x5b5ad5=_0x5b5ad5||0xc8;return function(_0x2ed313){if(_0x2ed313){return _0x1ca0c0[_0x9aed('0x1a')](_0x5b5ad5)[_0x9aed('0x1b')](_0x2ed313);}};}function respondWithFilteredResult(_0x390b6c,_0x2ac3ab){return function(_0x2cad25){if(_0x2cad25){var _0x5f4398=typeof _0x2ac3ab[_0x9aed('0x1c')]==='undefined'&&typeof _0x2ac3ab[_0x9aed('0x1d')]===_0x9aed('0x1e');var _0x35e79e=_0x2cad25['count'];var _0xcb0ae0=_0x5f4398?0x0:_0x2ac3ab[_0x9aed('0x1c')];var _0x4e22d9=_0x5f4398?_0x2cad25['count']:_0x2ac3ab[_0x9aed('0x1c')]+_0x2ac3ab['limit'];var _0x446093;if(_0x4e22d9>=_0x35e79e){_0x4e22d9=_0x35e79e;_0x446093=0xc8;}else{_0x446093=0xce;}_0x390b6c['status'](_0x446093);return _0x390b6c[_0x9aed('0x1f')]('Content-Range',_0xcb0ae0+'-'+_0x4e22d9+'/'+_0x35e79e)[_0x9aed('0x1b')](_0x2cad25);}return null;};}function patchUpdates(_0x206cbe){return function(_0x31822d){try{jsonpatch[_0x9aed('0x20')](_0x31822d,_0x206cbe,!![]);}catch(_0xc632fd){return BPromise[_0x9aed('0x21')](_0xc632fd);}return _0x31822d[_0x9aed('0x22')]();};}function saveUpdates(_0x28396d,_0x252960){return function(_0x134b26){if(_0x134b26){return _0x134b26[_0x9aed('0x23')](_0x28396d)[_0x9aed('0x24')](function(_0x38f68e){return _0x38f68e;});}return null;};}function removeEntity(_0x520862,_0x17e35e){return function(_0x2fcb3a){if(_0x2fcb3a){return _0x2fcb3a[_0x9aed('0x25')]()[_0x9aed('0x24')](function(){var _0x581174=_0x2fcb3a[_0x9aed('0x26')]({'plain':!![]});var _0x636675='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x9aed('0x25')]({'where':{'type':_0x636675,'resourceId':_0x581174['id']}})[_0x9aed('0x24')](function(){return _0x2fcb3a;});})[_0x9aed('0x24')](function(){_0x520862[_0x9aed('0x1a')](0xcc)[_0x9aed('0x27')]();});}};}function handleEntityNotFound(_0x2c5a48,_0x3b680e){return function(_0xdca630){if(!_0xdca630){_0x2c5a48['sendStatus'](0x194);}return _0xdca630;};}function handleError(_0x2cabfd,_0x30593c){_0x30593c=_0x30593c||0x1f4;return function(_0x29e17c){logger[_0x9aed('0x28')](_0x29e17c[_0x9aed('0x29')]);if(_0x29e17c[_0x9aed('0x2a')]){delete _0x29e17c['name'];}_0x2cabfd[_0x9aed('0x1a')](_0x30593c)['send'](_0x29e17c);};}exports[_0x9aed('0x2b')]=function(_0xb72243,_0xd37e67){var _0x1f8b7b={},_0x27a3a8={},_0x40c8b7={'count':0x0,'rows':[]};var _0x6a2963=_[_0x9aed('0x2c')](db[_0x9aed('0x2d')][_0x9aed('0x2e')],function(_0xd72244){return{'name':_0xd72244[_0x9aed('0x2f')],'type':_0xd72244[_0x9aed('0x30')][_0x9aed('0x31')]};});_0x27a3a8[_0x9aed('0x32')]=_[_0x9aed('0x2c')](_0x6a2963,'name');_0x27a3a8[_0x9aed('0x33')]=_['keys'](_0xb72243[_0x9aed('0x33')]);_0x27a3a8['filters']=_['intersection'](_0x27a3a8[_0x9aed('0x32')],_0x27a3a8[_0x9aed('0x33')]);_0x1f8b7b[_0x9aed('0x34')]=_[_0x9aed('0x35')](_0x27a3a8['model'],qs[_0x9aed('0x36')](_0xb72243[_0x9aed('0x33')][_0x9aed('0x36')]));_0x1f8b7b[_0x9aed('0x34')]=_0x1f8b7b[_0x9aed('0x34')]['length']?_0x1f8b7b[_0x9aed('0x34')]:_0x27a3a8['model'];if(!_0xb72243['query'][_0x9aed('0x37')](_0x9aed('0x38'))){_0x1f8b7b[_0x9aed('0x1d')]=qs[_0x9aed('0x1d')](_0xb72243[_0x9aed('0x33')][_0x9aed('0x1d')]);_0x1f8b7b[_0x9aed('0x1c')]=qs['offset'](_0xb72243[_0x9aed('0x33')]['offset']);}_0x1f8b7b['order']=qs['sort'](_0xb72243['query'][_0x9aed('0x39')]);_0x1f8b7b['where']=qs[_0x9aed('0x3a')](_[_0x9aed('0x3b')](_0xb72243['query'],_0x27a3a8[_0x9aed('0x3a')]),_0x6a2963);if(_0xb72243[_0x9aed('0x33')][_0x9aed('0x3c')]){_0x1f8b7b[_0x9aed('0x3d')]=_[_0x9aed('0x3e')](_0x1f8b7b[_0x9aed('0x3d')],{'$or':_[_0x9aed('0x2c')](_0x6a2963,function(_0x55fa16){if(_0x55fa16['type']!==_0x9aed('0x3f')){var _0x513d4c={};_0x513d4c[_0x55fa16[_0x9aed('0x2a')]]={'$like':'%'+_0xb72243[_0x9aed('0x33')][_0x9aed('0x3c')]+'%'};return _0x513d4c;}})});}_0x1f8b7b=_[_0x9aed('0x3e')]({},_0x1f8b7b,_0xb72243[_0x9aed('0x40')]);var _0x2fe8d9={'where':_0x1f8b7b[_0x9aed('0x3d')]};return db[_0x9aed('0x2d')][_0x9aed('0x41')](_0x2fe8d9)[_0x9aed('0x24')](function(_0x11a0bf){_0x40c8b7[_0x9aed('0x41')]=_0x11a0bf;if(_0xb72243[_0x9aed('0x33')][_0x9aed('0x42')]){_0x1f8b7b[_0x9aed('0x43')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x1f8b7b);})[_0x9aed('0x24')](function(_0x151480){_0x40c8b7['rows']=_0x151480;return _0x40c8b7;})[_0x9aed('0x24')](respondWithFilteredResult(_0xd37e67,_0x1f8b7b))[_0x9aed('0x44')](handleError(_0xd37e67,null));};exports[_0x9aed('0x45')]=function(_0x1d164a,_0x557e0b){var _0x56ada3={'raw':!![],'where':{'id':_0x1d164a[_0x9aed('0x46')]['id']}},_0x40c2d6={};_0x40c2d6[_0x9aed('0x32')]=_['keys'](db[_0x9aed('0x2d')][_0x9aed('0x2e')]);_0x40c2d6[_0x9aed('0x33')]=_[_0x9aed('0x47')](_0x1d164a[_0x9aed('0x33')]);_0x40c2d6[_0x9aed('0x3a')]=_['intersection'](_0x40c2d6['model'],_0x40c2d6[_0x9aed('0x33')]);_0x56ada3[_0x9aed('0x34')]=_[_0x9aed('0x35')](_0x40c2d6[_0x9aed('0x32')],qs[_0x9aed('0x36')](_0x1d164a[_0x9aed('0x33')]['fields']));_0x56ada3[_0x9aed('0x34')]=_0x56ada3[_0x9aed('0x34')][_0x9aed('0x48')]?_0x56ada3[_0x9aed('0x34')]:_0x40c2d6[_0x9aed('0x32')];if(_0x1d164a[_0x9aed('0x33')][_0x9aed('0x42')]){_0x56ada3[_0x9aed('0x43')]=[{'all':!![]}];}_0x56ada3=_[_0x9aed('0x3e')]({},_0x56ada3,_0x1d164a[_0x9aed('0x40')]);return db[_0x9aed('0x2d')]['find'](_0x56ada3)[_0x9aed('0x24')](handleEntityNotFound(_0x557e0b,null))[_0x9aed('0x24')](respondWithResult(_0x557e0b,null))[_0x9aed('0x44')](handleError(_0x557e0b,null));};exports[_0x9aed('0x49')]=function(_0x2bda33,_0x5b2b8d){return db[_0x9aed('0x2d')][_0x9aed('0x49')](_0x2bda33['body'],{})[_0x9aed('0x24')](function(_0x5c7ecb){var _0x16b61d=_0x2bda33[_0x9aed('0x4a')][_0x9aed('0x26')]({'plain':!![]});if(!_0x16b61d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16b61d[_0x9aed('0x4b')]==='user'){var _0xc67a61=_0x5c7ecb[_0x9aed('0x26')]({'plain':!![]});var _0x3e47df=_0x9aed('0x4c');return db['UserProfileSection'][_0x9aed('0x4d')]({'where':{'name':_0x3e47df,'userProfileId':_0x16b61d[_0x9aed('0x4e')]},'raw':!![]})[_0x9aed('0x24')](function(_0x371a3e){if(_0x371a3e&&_0x371a3e[_0x9aed('0x4f')]===0x0){return db[_0x9aed('0x50')][_0x9aed('0x49')]({'name':_0xc67a61[_0x9aed('0x2a')],'resourceId':_0xc67a61['id'],'type':_0x371a3e[_0x9aed('0x2a')],'sectionId':_0x371a3e['id']},{})[_0x9aed('0x24')](function(){return _0x5c7ecb;});}else{return _0x5c7ecb;}})[_0x9aed('0x44')](function(_0x39c92e){logger[_0x9aed('0x28')](_0x9aed('0x51'),_0x39c92e);throw _0x39c92e;});}return _0x5c7ecb;})[_0x9aed('0x24')](respondWithResult(_0x5b2b8d,0xc9))[_0x9aed('0x44')](handleError(_0x5b2b8d,null));};exports['update']=function(_0x3a6abb,_0x145a29){if(_0x3a6abb['body']['id']){delete _0x3a6abb[_0x9aed('0x52')]['id'];}return db['CmHopperAdditionalPhone'][_0x9aed('0x4d')]({'where':{'id':_0x3a6abb[_0x9aed('0x46')]['id']}})['then'](handleEntityNotFound(_0x145a29,null))[_0x9aed('0x24')](saveUpdates(_0x3a6abb[_0x9aed('0x52')],null))[_0x9aed('0x24')](respondWithResult(_0x145a29,null))[_0x9aed('0x44')](handleError(_0x145a29,null));};exports['destroy']=function(_0x55f591,_0x4e2a45){return db[_0x9aed('0x2d')][_0x9aed('0x4d')]({'where':{'id':_0x55f591[_0x9aed('0x46')]['id']}})[_0x9aed('0x24')](handleEntityNotFound(_0x4e2a45,null))[_0x9aed('0x24')](removeEntity(_0x4e2a45,null))[_0x9aed('0x44')](handleError(_0x4e2a45,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 8a1bf89..f2975bd 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 _0xbad8=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0xbad8,0x10e));var _0x8bad=function(_0x3c3d59,_0x369b04){_0x3c3d59=_0x3c3d59-0x0;var _0x25d467=_0xbad8[_0x3c3d59];return _0x25d467;};'use strict';var _=require(_0x8bad('0x0'));var util=require(_0x8bad('0x1'));var logger=require(_0x8bad('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8bad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bad('0x4'));var rimraf=require(_0x8bad('0x5'));var config=require(_0x8bad('0x6'));var attributes=require(_0x8bad('0x7'));module[_0x8bad('0x8')]=function(_0x3a74fe,_0x32b66c){return _0x3a74fe[_0x8bad('0x9')](_0x8bad('0xa'),attributes,{'tableName':_0x8bad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e58=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util'];(function(_0x213d33,_0x2afea9){var _0x570137=function(_0x4cb6b7){while(--_0x4cb6b7){_0x213d33['push'](_0x213d33['shift']());}};_0x570137(++_0x2afea9);}(_0x3e58,0x16a));var _0x83e5=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x3e58[_0x5224ba];return _0x459bd2;};'use strict';var _=require(_0x83e5('0x0'));var util=require(_0x83e5('0x1'));var logger=require(_0x83e5('0x2'))(_0x83e5('0x3'));var moment=require('moment');var BPromise=require(_0x83e5('0x4'));var rp=require(_0x83e5('0x5'));var fs=require('fs');var path=require(_0x83e5('0x6'));var rimraf=require(_0x83e5('0x7'));var config=require(_0x83e5('0x8'));var attributes=require(_0x83e5('0x9'));module[_0x83e5('0xa')]=function(_0x410f0c,_0xd1cc3e){return _0x410f0c[_0x83e5('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x83e5('0xc'),'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 123592a..cc6d2b6 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 _0xfcae=['CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','CmHopperAdditionalPhone','ASC','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','ListId','waitTime','duration','isNil','scheduledat','minutes','add','createdAt','updatedAt','sequelize','transaction','update','phone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xfcae,0x1bc));var _0xefca=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xfcae[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xefca('0x0'));var util=require(_0xefca('0x1'));var moment=require(_0xefca('0x2'));var BPromise=require(_0xefca('0x3'));var rs=require(_0xefca('0x4'));var fs=require('fs');var Redis=require(_0xefca('0x5'));var db=require(_0xefca('0x6'))['db'];var utils=require(_0xefca('0x7'));var logger=require(_0xefca('0x8'))(_0xefca('0x9'));var config=require('../../config/environment');var jayson=require(_0xefca('0xa'));var client=jayson[_0xefca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0cdc,_0x53ab26,_0x296f1b){return new BPromise(function(_0x482fa2,_0xe97c40){return client['request'](_0x3d0cdc,_0x296f1b)[_0xefca('0xc')](function(_0x589d91){logger[_0xefca('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ab26,'request\x20sent');logger[_0xefca('0xe')](_0xefca('0xf'),_0x53ab26,_0xefca('0x10'),JSON['stringify'](_0x589d91));if(_0x589d91[_0xefca('0x11')]){if(_0x589d91[_0xefca('0x11')][_0xefca('0x12')]===0x1f4){logger[_0xefca('0x11')](_0xefca('0x13'),_0x53ab26,_0x589d91[_0xefca('0x11')][_0xefca('0x14')]);return _0xe97c40(_0x589d91[_0xefca('0x11')][_0xefca('0x14')]);}logger[_0xefca('0x11')](_0xefca('0x13'),_0x53ab26,_0x589d91[_0xefca('0x11')]['message']);return _0x482fa2(_0x589d91[_0xefca('0x11')][_0xefca('0x14')]);}else{logger['info'](_0xefca('0x13'),_0x53ab26,_0xefca('0x10'));_0x482fa2(_0x589d91[_0xefca('0x15')]['message']);}})['catch'](function(_0x45dc9d){logger[_0xefca('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ab26,_0x45dc9d);_0xe97c40(_0x45dc9d);});});}exports[_0xefca('0x16')]=function(_0xdd1252){var _0x37577c=this;return new Promise(function(_0x4428af,_0x3bcc7e){return db[_0xefca('0x17')][_0xefca('0x18')]({'raw':!![],'where':{'ContactId':_0xdd1252[_0xefca('0x19')][_0xefca('0x1a')],'ListId':_0xdd1252[_0xefca('0x19')]['ListId'],'VoiceQueueId':_0xdd1252['body'][_0xefca('0x1b')]===undefined?null:_0xdd1252[_0xefca('0x19')][_0xefca('0x1b')],'CampaignId':_0xdd1252[_0xefca('0x19')][_0xefca('0x1c')]===undefined?null:_0xdd1252[_0xefca('0x19')]['CampaignId']}})[_0xefca('0xc')](function(_0x5a5ea4){if(_0x5a5ea4!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5a5ea4['id'],'OrderBy':{'$gt':_0x5a5ea4[_0xefca('0x1d')]}},'order':[[_0xefca('0x1d'),'ASC']]})['then'](function(_0x24a353){var _0x4be1e9=0x0;if(_0x24a353){if(_0x24a353[_0xefca('0x1e')]+_0x24a353[_0xefca('0x1f')]+_0x24a353[_0xefca('0x20')]+_0x24a353['countnosuchnumberretry']+_0x24a353[_0xefca('0x21')]+_0x24a353[_0xefca('0x22')]+_0x24a353['countmachineretry']+_0x24a353[_0xefca('0x23')]<_0xdd1252[_0xefca('0x24')]['dialGlobalMaxRetry'])_0x4be1e9=0x1;_0x4428af({'additional':_0x4be1e9});}else{return db[_0xefca('0x25')][_0xefca('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5a5ea4['id']},'order':[[_0xefca('0x1d'),_0xefca('0x26')]]})[_0xefca('0xc')](function(_0x232b44){var _0x43fda1=0x0;if(_0x232b44){if(_0x232b44[_0xefca('0x1e')]+_0x232b44[_0xefca('0x1f')]+_0x232b44[_0xefca('0x20')]+_0x232b44[_0xefca('0x27')]+_0x232b44[_0xefca('0x21')]+_0x232b44[_0xefca('0x22')]+_0x232b44[_0xefca('0x28')]+_0x232b44['countagentrejectretry']<_0xdd1252['entity'][_0xefca('0x29')])_0x43fda1=0x1;_0x4428af({'additional':_0x43fda1});}else{_0x4428af({'additional':0x0});}})[_0xefca('0x2a')](function(_0x4a8264){logger[_0xefca('0x11')]('VerifyAdditionalPhones',_0x4a8264[_0xefca('0x14')]);_0x3bcc7e(_0x37577c[_0xefca('0x11')](0x1f4,_0x4a8264[_0xefca('0x14')]));});}})[_0xefca('0x2a')](function(_0x34f78c){logger['error'](_0xefca('0x16'),_0x34f78c[_0xefca('0x14')]);_0x3bcc7e(_0x37577c['error'](0x1f4,_0x34f78c[_0xefca('0x14')]));});}else _0x4428af({'additional':0x0});});});};exports[_0xefca('0x2b')]=function(_0x571457){var _0x577e13=this;return new Promise(function(_0x30a403,_0x3b7278){return db[_0xefca('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x571457[_0xefca('0x19')]['ContactId'],'ListId':_0x571457[_0xefca('0x19')][_0xefca('0x2c')],'VoiceQueueId':_0x571457['body'][_0xefca('0x1b')]===undefined?null:_0x571457[_0xefca('0x19')][_0xefca('0x1b')],'CampaignId':_0x571457[_0xefca('0x19')]['CampaignId']===undefined?null:_0x571457[_0xefca('0x19')][_0xefca('0x1c')]}})[_0xefca('0xc')](function(_0x1bf966){if(_0x1bf966!=null){return db[_0xefca('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1bf966['id'],'OrderBy':{'$gte':_0x1bf966[_0xefca('0x1d')]}},'order':[['OrderBy','ASC']]})[_0xefca('0xc')](function(_0xe0dc41){if(_0xe0dc41)return activateAdditionalPhone(_0x1bf966,_0x571457['body'],_0xe0dc41,_0x571457['duration'],_0x571457[_0xefca('0x2d')])['then'](function(_0x352b79){_0x30a403(_0x352b79);});else{return db[_0xefca('0x25')][_0xefca('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1bf966['id']},'order':[['OrderBy',_0xefca('0x26')]]})[_0xefca('0xc')](function(_0x21c198){if(_0x21c198)return activateAdditionalPhone(_0x1bf966,_0x571457[_0xefca('0x19')],_0x21c198,_0x571457[_0xefca('0x2e')],_0x571457['waitTime'])['then'](function(_0x527ef1){_0x30a403(_0x527ef1);});else{_0x30a403({'id':_0x1bf966['id'],'phone':''});}})[_0xefca('0x2a')](function(_0x140ab5){logger['error'](_0xefca('0x16'),_0x140ab5[_0xefca('0x14')]);_0x3b7278(_0x577e13[_0xefca('0x11')](0x1f4,_0x140ab5['message']));});}})[_0xefca('0x2a')](function(_0x2457ae){logger[_0xefca('0x11')]('VerifyAdditionalPhones',_0x2457ae[_0xefca('0x14')]);_0x3b7278(_0x577e13['error'](0x1f4,_0x2457ae[_0xefca('0x14')]));});}else _0x30a403(0x1);});});};function activateAdditionalPhone(_0x2ce149,_0x2b322b,_0x5ea8fd,_0x5375e7,_0x59589d){return new Promise(function(_0x4c7f0f,_0x5c3a08){var _0x494b31;if(_[_0xefca('0x2f')](_0x5ea8fd['scheduledat'])){_0x5ea8fd[_0xefca('0x30')]=moment();}if(moment()>moment(_0x5ea8fd[_0xefca('0x30')])){_0x494b31=moment()['add'](_0x59589d||0x3,_0xefca('0x31'));}else{if(_0x5ea8fd[_0xefca('0x1d')]==0x0){_0x494b31=moment(_0x5ea8fd[_0xefca('0x30')]);}else{_0x494b31=moment()[_0xefca('0x32')](_0x59589d||0x3,_0xefca('0x31'));}}if(_[_0xefca('0x2f')](_0x494b31)){_0x494b31=moment()[_0xefca('0x32')](_0x59589d||0x3,_0xefca('0x31'));}var _0x274e13={'phone':_0x2ce149['phone'],'active':0x0,'OrderBy':_[_0xefca('0x2f')](_0x2ce149[_0xefca('0x1d')])?0x0:_0x2ce149[_0xefca('0x1d')],'scheduledat':moment()[_0xefca('0x32')](_0x5375e7||0x1,_0xefca('0x31')),'countbusyretry':_0x2b322b[_0xefca('0x1e')],'countcongestionretry':_0x2b322b[_0xefca('0x1f')],'countnoanswerretry':_0x2b322b[_0xefca('0x20')],'countnosuchnumberretry':_0x2b322b[_0xefca('0x27')],'countdropretry':_0x2b322b[_0xefca('0x21')],'countabandonedretry':_0x2b322b[_0xefca('0x22')],'countmachineretry':_0x2b322b['countmachineretry'],'countagentrejectretry':_0x2b322b[_0xefca('0x23')],'createdAt':_0x2b322b[_0xefca('0x33')],'updatedAt':_0x2b322b[_0xefca('0x34')]};var _0x3f54c1={'CmHopperId':_0x2ce149['id'],'phone':_0x5ea8fd['phone'],'active':0x0,'OrderBy':_['isNil'](_0x5ea8fd[_0xefca('0x1d')])?0x0:_0x5ea8fd[_0xefca('0x1d')],'scheduledat':_0x494b31,'countbusyretry':_0x5ea8fd['countbusyretry'],'countcongestionretry':_0x5ea8fd[_0xefca('0x1f')],'countnoanswerretry':_0x5ea8fd[_0xefca('0x20')],'countnosuchnumberretry':_0x5ea8fd[_0xefca('0x27')],'countdropretry':_0x5ea8fd['countdropretry'],'countabandonedretry':_0x5ea8fd[_0xefca('0x22')],'countmachineretry':_0x5ea8fd['countmachineretry'],'countagentrejectretry':_0x5ea8fd[_0xefca('0x23')],'createdAt':_0x5ea8fd['createdAt'],'updatedAt':_0x5ea8fd[_0xefca('0x34')]};return db[_0xefca('0x35')][_0xefca('0x36')](function(_0x1a0869){return db[_0xefca('0x25')][_0xefca('0x37')](_0x274e13,{'where':{'id':_0x5ea8fd['id']}},{'transaction':_0x1a0869})['then'](function(){return db[_0xefca('0x17')][_0xefca('0x37')](_0x3f54c1,{'where':{'id':_0x2ce149['id']}},{'transaction':_0x1a0869});});})[_0xefca('0xc')](function(_0x3a1104){_0x4c7f0f({'id':_0x2ce149['id'],'phone':_0x5ea8fd[_0xefca('0x38')]});})[_0xefca('0x2a')](function(_0x2f4e4d){logger[_0xefca('0x11')]('activateAdditionalPhone',_0x2f4e4d[_0xefca('0x14')]);_0x5c3a08({'error':_0x2f4e4d[_0xefca('0x14')]});});});}exports[_0xefca('0x39')]=function(_0xaf6479){var _0x3589ee=this;return new Promise(function(_0x328abe,_0x7a90e1){return db[_0xefca('0x17')][_0xefca('0x37')](_0xaf6479[_0xefca('0x19')][_0xefca('0x3a')],{'where':{'id':_0xaf6479[_0xefca('0x19')]['id']}})[_0xefca('0xc')](function(_0x401bbc){_0x328abe(_0x401bbc);})['catch'](function(_0xbc9396){logger[_0xefca('0x11')]('IncrementPreviewCounters',_0xbc9396[_0xefca('0x14')]);_0x7a90e1(_0x3589ee[_0xefca('0x11')](0x1f4,_0xbc9396['message']));});});}; \ No newline at end of file +var _0x708d=['stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','phone','add','updatedAt','sequelize','transaction','IncrementPreviewCounters','field','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x708d,0x145));var _0xd708=function(_0x40e74c,_0x1883a2){_0x40e74c=_0x40e74c-0x0;var _0x3a8c6b=_0x708d[_0x40e74c];return _0x3a8c6b;};'use strict';var _=require(_0xd708('0x0'));var util=require(_0xd708('0x1'));var moment=require(_0xd708('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd708('0x3'));var db=require(_0xd708('0x4'))['db'];var utils=require(_0xd708('0x5'));var logger=require(_0xd708('0x6'))(_0xd708('0x7'));var config=require(_0xd708('0x8'));var jayson=require(_0xd708('0x9'));var client=jayson[_0xd708('0xa')][_0xd708('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2520b6,_0xca44aa,_0x274388){return new BPromise(function(_0x3e579c,_0x71fe48){return client[_0xd708('0xc')](_0x2520b6,_0x274388)['then'](function(_0x55d2c9){logger[_0xd708('0xd')](_0xd708('0xe'),_0xca44aa,_0xd708('0xf'));logger['debug'](_0xd708('0x10'),_0xca44aa,_0xd708('0xf'),JSON[_0xd708('0x11')](_0x55d2c9));if(_0x55d2c9['error']){if(_0x55d2c9[_0xd708('0x12')][_0xd708('0x13')]===0x1f4){logger[_0xd708('0x12')](_0xd708('0xe'),_0xca44aa,_0x55d2c9[_0xd708('0x12')][_0xd708('0x14')]);return _0x71fe48(_0x55d2c9[_0xd708('0x12')][_0xd708('0x14')]);}logger[_0xd708('0x12')](_0xd708('0xe'),_0xca44aa,_0x55d2c9[_0xd708('0x12')][_0xd708('0x14')]);return _0x3e579c(_0x55d2c9[_0xd708('0x12')][_0xd708('0x14')]);}else{logger[_0xd708('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xca44aa,_0xd708('0xf'));_0x3e579c(_0x55d2c9[_0xd708('0x15')][_0xd708('0x14')]);}})[_0xd708('0x16')](function(_0x5e4726){logger[_0xd708('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xca44aa,_0x5e4726);_0x71fe48(_0x5e4726);});});}exports[_0xd708('0x17')]=function(_0x27ef86){var _0x2e807c=this;return new Promise(function(_0x138cd6,_0x3a958b){return db[_0xd708('0x18')][_0xd708('0x19')]({'raw':!![],'where':{'ContactId':_0x27ef86[_0xd708('0x1a')][_0xd708('0x1b')],'ListId':_0x27ef86[_0xd708('0x1a')]['ListId'],'VoiceQueueId':_0x27ef86[_0xd708('0x1a')][_0xd708('0x1c')]===undefined?null:_0x27ef86[_0xd708('0x1a')]['VoiceQueueId'],'CampaignId':_0x27ef86[_0xd708('0x1a')]['CampaignId']===undefined?null:_0x27ef86[_0xd708('0x1a')][_0xd708('0x1d')]}})['then'](function(_0x5a4067){if(_0x5a4067!=null){return db[_0xd708('0x1e')][_0xd708('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5a4067['id'],'OrderBy':{'$gt':_0x5a4067[_0xd708('0x1f')]}},'order':[[_0xd708('0x1f'),_0xd708('0x20')]]})[_0xd708('0x21')](function(_0x2c2cfb){var _0x2787bf=0x0;if(_0x2c2cfb){if(_0x2c2cfb[_0xd708('0x22')]+_0x2c2cfb[_0xd708('0x23')]+_0x2c2cfb['countnoanswerretry']+_0x2c2cfb['countnosuchnumberretry']+_0x2c2cfb[_0xd708('0x24')]+_0x2c2cfb[_0xd708('0x25')]+_0x2c2cfb[_0xd708('0x26')]+_0x2c2cfb[_0xd708('0x27')]<_0x27ef86[_0xd708('0x28')][_0xd708('0x29')])_0x2787bf=0x1;_0x138cd6({'additional':_0x2787bf});}else{return db['CmHopperAdditionalPhone'][_0xd708('0x19')]({'raw':!![],'where':{'CmHopperId':_0x5a4067['id']},'order':[[_0xd708('0x1f'),'ASC']]})[_0xd708('0x21')](function(_0x1c1f8a){var _0x357c9c=0x0;if(_0x1c1f8a){if(_0x1c1f8a['countbusyretry']+_0x1c1f8a[_0xd708('0x23')]+_0x1c1f8a[_0xd708('0x2a')]+_0x1c1f8a[_0xd708('0x2b')]+_0x1c1f8a[_0xd708('0x24')]+_0x1c1f8a[_0xd708('0x25')]+_0x1c1f8a[_0xd708('0x26')]+_0x1c1f8a[_0xd708('0x27')]<_0x27ef86[_0xd708('0x28')][_0xd708('0x29')])_0x357c9c=0x1;_0x138cd6({'additional':_0x357c9c});}else{_0x138cd6({'additional':0x0});}})['catch'](function(_0x3759f5){logger[_0xd708('0x12')](_0xd708('0x17'),_0x3759f5['message']);_0x3a958b(_0x2e807c[_0xd708('0x12')](0x1f4,_0x3759f5['message']));});}})[_0xd708('0x16')](function(_0x48a1f0){logger[_0xd708('0x12')](_0xd708('0x17'),_0x48a1f0[_0xd708('0x14')]);_0x3a958b(_0x2e807c[_0xd708('0x12')](0x1f4,_0x48a1f0[_0xd708('0x14')]));});}else _0x138cd6({'additional':0x0});});});};exports[_0xd708('0x2c')]=function(_0x206846){var _0x3c99b8=this;return new Promise(function(_0x15f7c7,_0x5c7a1e){return db[_0xd708('0x18')][_0xd708('0x19')]({'raw':!![],'where':{'ContactId':_0x206846[_0xd708('0x1a')][_0xd708('0x1b')],'ListId':_0x206846[_0xd708('0x1a')][_0xd708('0x2d')],'VoiceQueueId':_0x206846[_0xd708('0x1a')][_0xd708('0x1c')]===undefined?null:_0x206846[_0xd708('0x1a')]['VoiceQueueId'],'CampaignId':_0x206846[_0xd708('0x1a')][_0xd708('0x1d')]===undefined?null:_0x206846[_0xd708('0x1a')][_0xd708('0x1d')]}})['then'](function(_0x21d4ed){if(_0x21d4ed!=null){return db[_0xd708('0x1e')][_0xd708('0x19')]({'raw':!![],'where':{'CmHopperId':_0x21d4ed['id'],'OrderBy':{'$gte':_0x21d4ed[_0xd708('0x1f')]}},'order':[[_0xd708('0x1f'),'ASC']]})[_0xd708('0x21')](function(_0x16808d){if(_0x16808d)return activateAdditionalPhone(_0x21d4ed,_0x206846[_0xd708('0x1a')],_0x16808d,_0x206846[_0xd708('0x2e')],_0x206846['waitTime'])[_0xd708('0x21')](function(_0x24ad1d){_0x15f7c7(_0x24ad1d);});else{return db[_0xd708('0x1e')][_0xd708('0x19')]({'raw':!![],'where':{'CmHopperId':_0x21d4ed['id']},'order':[['OrderBy','ASC']]})['then'](function(_0xfc3ea1){if(_0xfc3ea1)return activateAdditionalPhone(_0x21d4ed,_0x206846['body'],_0xfc3ea1,_0x206846['duration'],_0x206846[_0xd708('0x2f')])[_0xd708('0x21')](function(_0x104a88){_0x15f7c7(_0x104a88);});else{_0x15f7c7({'id':_0x21d4ed['id'],'phone':''});}})[_0xd708('0x16')](function(_0x9767ed){logger['error'](_0xd708('0x17'),_0x9767ed[_0xd708('0x14')]);_0x5c7a1e(_0x3c99b8[_0xd708('0x12')](0x1f4,_0x9767ed[_0xd708('0x14')]));});}})[_0xd708('0x16')](function(_0x55af15){logger[_0xd708('0x12')](_0xd708('0x17'),_0x55af15[_0xd708('0x14')]);_0x5c7a1e(_0x3c99b8['error'](0x1f4,_0x55af15[_0xd708('0x14')]));});}else _0x15f7c7(0x1);});});};function activateAdditionalPhone(_0x47d68b,_0x48ab04,_0x23d381,_0xfd7648,_0x13a80f){return new Promise(function(_0x4a82eb,_0xed0121){var _0x329afc;if(_[_0xd708('0x30')](_0x23d381[_0xd708('0x31')])){_0x23d381['scheduledat']=moment();}if(moment()>moment(_0x23d381[_0xd708('0x31')])){_0x329afc=moment()['add'](_0x13a80f||0x3,'minutes');}else{if(_0x23d381[_0xd708('0x1f')]==0x0){_0x329afc=moment(_0x23d381['scheduledat']);}else{_0x329afc=moment()['add'](_0x13a80f||0x3,'minutes');}}if(_[_0xd708('0x30')](_0x329afc)){_0x329afc=moment()['add'](_0x13a80f||0x3,'minutes');}var _0x3cdf65={'phone':_0x47d68b[_0xd708('0x32')],'active':0x0,'OrderBy':_[_0xd708('0x30')](_0x47d68b[_0xd708('0x1f')])?0x0:_0x47d68b[_0xd708('0x1f')],'scheduledat':moment()[_0xd708('0x33')](_0xfd7648||0x1,'minutes'),'countbusyretry':_0x48ab04[_0xd708('0x22')],'countcongestionretry':_0x48ab04['countcongestionretry'],'countnoanswerretry':_0x48ab04[_0xd708('0x2a')],'countnosuchnumberretry':_0x48ab04['countnosuchnumberretry'],'countdropretry':_0x48ab04[_0xd708('0x24')],'countabandonedretry':_0x48ab04[_0xd708('0x25')],'countmachineretry':_0x48ab04[_0xd708('0x26')],'countagentrejectretry':_0x48ab04['countagentrejectretry'],'createdAt':_0x48ab04['createdAt'],'updatedAt':_0x48ab04[_0xd708('0x34')]};var _0x1c05e6={'CmHopperId':_0x47d68b['id'],'phone':_0x23d381[_0xd708('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x23d381[_0xd708('0x1f')])?0x0:_0x23d381['OrderBy'],'scheduledat':_0x329afc,'countbusyretry':_0x23d381[_0xd708('0x22')],'countcongestionretry':_0x23d381[_0xd708('0x23')],'countnoanswerretry':_0x23d381['countnoanswerretry'],'countnosuchnumberretry':_0x23d381['countnosuchnumberretry'],'countdropretry':_0x23d381['countdropretry'],'countabandonedretry':_0x23d381['countabandonedretry'],'countmachineretry':_0x23d381[_0xd708('0x26')],'countagentrejectretry':_0x23d381['countagentrejectretry'],'createdAt':_0x23d381['createdAt'],'updatedAt':_0x23d381[_0xd708('0x34')]};return db[_0xd708('0x35')][_0xd708('0x36')](function(_0x412f12){return db[_0xd708('0x1e')]['update'](_0x3cdf65,{'where':{'id':_0x23d381['id']}},{'transaction':_0x412f12})['then'](function(){return db[_0xd708('0x18')]['update'](_0x1c05e6,{'where':{'id':_0x47d68b['id']}},{'transaction':_0x412f12});});})[_0xd708('0x21')](function(_0x499450){_0x4a82eb({'id':_0x47d68b['id'],'phone':_0x23d381['phone']});})[_0xd708('0x16')](function(_0x2b624b){logger[_0xd708('0x12')]('activateAdditionalPhone',_0x2b624b[_0xd708('0x14')]);_0xed0121({'error':_0x2b624b[_0xd708('0x14')]});});});}exports[_0xd708('0x37')]=function(_0xdc46ed){var _0x5d7088=this;return new Promise(function(_0x301904,_0x39fa72){return db[_0xd708('0x18')]['update'](_0xdc46ed[_0xd708('0x1a')][_0xd708('0x38')],{'where':{'id':_0xdc46ed[_0xd708('0x1a')]['id']}})['then'](function(_0x4d5f5b){_0x301904(_0x4d5f5b);})['catch'](function(_0x11faf4){logger[_0xd708('0x12')](_0xd708('0x37'),_0x11faf4[_0xd708('0x14')]);_0x39fa72(_0x5d7088[_0xd708('0x12')](0x1f4,_0x11faf4[_0xd708('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 631ef75..ad4d674 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 _0x0268=['isAuthenticated','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0268,0x17e));var _0x8026=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x0268[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x8026('0x0'));var util=require('util');var path=require(_0x8026('0x1'));var timeout=require(_0x8026('0x2'));var express=require('express');var router=express[_0x8026('0x3')]();var fs_extra=require(_0x8026('0x4'));var auth=require(_0x8026('0x5'));var interaction=require(_0x8026('0x6'));var config=require(_0x8026('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x8026('0x8')]('/',auth[_0x8026('0x9')](),controller['index']);router[_0x8026('0x8')](_0x8026('0xa'),auth[_0x8026('0x9')](),controller[_0x8026('0xb')]);router[_0x8026('0xc')]('/',auth[_0x8026('0x9')](),controller[_0x8026('0xd')]);router[_0x8026('0xe')](_0x8026('0xa'),auth[_0x8026('0x9')](),controller[_0x8026('0xf')]);router[_0x8026('0x10')](_0x8026('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdc15=['create','put','exports','multer','path','connect-timeout','express','Router','fs-extra','./cmHopperAdditionalPhone.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x152fa1,_0x5266c9){var _0x158acd=function(_0x2ae07a){while(--_0x2ae07a){_0x152fa1['push'](_0x152fa1['shift']());}};_0x158acd(++_0x5266c9);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0xdc15[_0x4eb6ec];return _0x58881b;};'use strict';var multer=require(_0x5dc1('0x0'));var util=require('util');var path=require(_0x5dc1('0x1'));var timeout=require(_0x5dc1('0x2'));var express=require(_0x5dc1('0x3'));var router=express[_0x5dc1('0x4')]();var fs_extra=require(_0x5dc1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5dc1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5dc1('0x7')]);router[_0x5dc1('0x8')](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller[_0x5dc1('0xb')]);router[_0x5dc1('0xc')]('/',auth[_0x5dc1('0xa')](),controller[_0x5dc1('0xd')]);router[_0x5dc1('0xe')](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller['update']);router['delete'](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller['destroy']);module[_0x5dc1('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 59bac1c..39f588a 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 _0x83ed=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x41d364,_0xdfdc1a){var _0x5ace98=function(_0x5f1194){while(--_0x5f1194){_0x41d364['push'](_0x41d364['shift']());}};_0x5ace98(++_0xdfdc1a);}(_0x83ed,0x66));var _0xd83e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x83ed[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xd83e('0x0'));var Sequelize=require('sequelize');module[_0xd83e('0x1')]={'phone':{'type':Sequelize[_0xd83e('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd83e('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd83e('0x3')],'unique':_0xd83e('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd83e('0x3')],'unique':_0xd83e('0x4')}}; \ No newline at end of file +var _0xba34=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x5df17b,_0x1db2b0){var _0x423961=function(_0x3d4849){while(--_0x3d4849){_0x5df17b['push'](_0x5df17b['shift']());}};_0x423961(++_0x1db2b0);}(_0xba34,0x119));var _0x4ba3=function(_0x22246c,_0xd20acd){_0x22246c=_0x22246c-0x0;var _0x17c0b6=_0xba34[_0x22246c];return _0x17c0b6;};'use strict';var moment=require(_0x4ba3('0x0'));var Sequelize=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'phone':{'type':Sequelize[_0x4ba3('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4ba3('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4ba3('0x4')],'unique':_0x4ba3('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index aaa700c..90999ce 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 _0x983f=['fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','zip-dir','request-promise','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x3c8d8d,_0x232554){var _0x8a2586=function(_0x178e06){while(--_0x178e06){_0x3c8d8d['push'](_0x3c8d8d['shift']());}};_0x8a2586(++_0x232554);}(_0x983f,0xe3));var _0xf983=function(_0x1e894a,_0x4202da){_0x1e894a=_0x1e894a-0x0;var _0x53539e=_0x983f[_0x1e894a];return _0x53539e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf983('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf983('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf983('0x2'));var sox=require(_0xf983('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf983('0x4'));var _=require(_0xf983('0x5'));var squel=require('squel');var crypto=require(_0xf983('0x6'));var jsforce=require(_0xf983('0x7'));var deskjs=require(_0xf983('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf983('0x9'));var authService=require(_0xf983('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0xf983('0xb'));var hardwareService=require(_0xf983('0xc'));var logger=require('../../config/logger')(_0xf983('0xd'));var utils=require(_0xf983('0xe'));var config=require(_0xf983('0xf'));var licenseUtil=require(_0xf983('0x10'));var db=require(_0xf983('0x11'))['db'];function respondWithStatusCode(_0x1b6658,_0x1dc754){_0x1dc754=_0x1dc754||0xcc;return function(_0x3ca911){if(_0x3ca911){return _0x1b6658[_0xf983('0x12')](_0x1dc754);}return _0x1b6658[_0xf983('0x13')](_0x1dc754)['end']();};}function respondWithResult(_0x5b2ffa,_0x228b5e){_0x228b5e=_0x228b5e||0xc8;return function(_0x2a325d){if(_0x2a325d){return _0x5b2ffa['status'](_0x228b5e)['json'](_0x2a325d);}};}function respondWithFilteredResult(_0x20fe3c,_0x399737){return function(_0x4810d7){if(_0x4810d7){var _0x58e3cc=typeof _0x399737[_0xf983('0x14')]===_0xf983('0x15')&&typeof _0x399737[_0xf983('0x16')]==='undefined';var _0x173705=_0x4810d7['count'];var _0x34a456=_0x58e3cc?0x0:_0x399737['offset'];var _0x27bada=_0x58e3cc?_0x4810d7[_0xf983('0x17')]:_0x399737[_0xf983('0x14')]+_0x399737['limit'];var _0x3215cc;if(_0x27bada>=_0x173705){_0x27bada=_0x173705;_0x3215cc=0xc8;}else{_0x3215cc=0xce;}_0x20fe3c[_0xf983('0x13')](_0x3215cc);return _0x20fe3c[_0xf983('0x18')](_0xf983('0x19'),_0x34a456+'-'+_0x27bada+'/'+_0x173705)[_0xf983('0x1a')](_0x4810d7);}return null;};}function patchUpdates(_0x136ac1){return function(_0x5013ff){try{jsonpatch['apply'](_0x5013ff,_0x136ac1,!![]);}catch(_0x1d8dd0){return BPromise[_0xf983('0x1b')](_0x1d8dd0);}return _0x5013ff['save']();};}function saveUpdates(_0x193484,_0x23e5b6){return function(_0x565308){if(_0x565308){return _0x565308[_0xf983('0x1c')](_0x193484)['then'](function(_0x2799b8){return _0x2799b8;});}return null;};}function removeEntity(_0x4f29bf,_0x4dc38a){return function(_0xc72bc2){if(_0xc72bc2){return _0xc72bc2[_0xf983('0x1d')]()[_0xf983('0x1e')](function(){_0x4f29bf[_0xf983('0x13')](0xcc)[_0xf983('0x1f')]();});}};}function handleEntityNotFound(_0x4aa20a,_0x3255ed){return function(_0x31fa51){if(!_0x31fa51){_0x4aa20a['sendStatus'](0x194);}return _0x31fa51;};}function handleError(_0x13bdd3,_0x419bb0){_0x419bb0=_0x419bb0||0x1f4;return function(_0x4e4b46){logger[_0xf983('0x20')](_0x4e4b46[_0xf983('0x21')]);if(_0x4e4b46[_0xf983('0x22')]){delete _0x4e4b46['name'];}_0x13bdd3[_0xf983('0x13')](_0x419bb0)[_0xf983('0x23')](_0x4e4b46);};}exports[_0xf983('0x24')]=function(_0x214db0,_0x1e7d9d){var _0x10aa65={},_0x166822={},_0x4af419={'count':0x0,'rows':[]};var _0x4e0678=_[_0xf983('0x25')](db[_0xf983('0x26')][_0xf983('0x27')],function(_0x31cd6c){return{'name':_0x31cd6c[_0xf983('0x28')],'type':_0x31cd6c[_0xf983('0x29')][_0xf983('0x2a')]};});_0x166822[_0xf983('0x2b')]=_[_0xf983('0x25')](_0x4e0678,_0xf983('0x22'));_0x166822[_0xf983('0x2c')]=_[_0xf983('0x2d')](_0x214db0[_0xf983('0x2c')]);_0x166822[_0xf983('0x2e')]=_[_0xf983('0x2f')](_0x166822['model'],_0x166822[_0xf983('0x2c')]);_0x10aa65[_0xf983('0x30')]=_[_0xf983('0x2f')](_0x166822[_0xf983('0x2b')],qs[_0xf983('0x31')](_0x214db0[_0xf983('0x2c')][_0xf983('0x31')]));_0x10aa65[_0xf983('0x30')]=_0x10aa65[_0xf983('0x30')]['length']?_0x10aa65[_0xf983('0x30')]:_0x166822['model'];if(!_0x214db0[_0xf983('0x2c')][_0xf983('0x32')](_0xf983('0x33'))){_0x10aa65[_0xf983('0x16')]=qs[_0xf983('0x16')](_0x214db0[_0xf983('0x2c')][_0xf983('0x16')]);_0x10aa65[_0xf983('0x14')]=qs[_0xf983('0x14')](_0x214db0[_0xf983('0x2c')][_0xf983('0x14')]);}_0x10aa65[_0xf983('0x34')]=qs[_0xf983('0x35')](_0x214db0[_0xf983('0x2c')][_0xf983('0x35')]);_0x10aa65[_0xf983('0x36')]=qs[_0xf983('0x2e')](_['pick'](_0x214db0[_0xf983('0x2c')],_0x166822[_0xf983('0x2e')]),_0x4e0678);if(_0x214db0['query'][_0xf983('0x37')]){_0x10aa65[_0xf983('0x36')]=_['merge'](_0x10aa65[_0xf983('0x36')],{'$or':_[_0xf983('0x25')](_0x4e0678,function(_0x32b921){if(_0x32b921[_0xf983('0x29')]!=='VIRTUAL'){var _0x254835={};_0x254835[_0x32b921['name']]={'$like':'%'+_0x214db0['query'][_0xf983('0x37')]+'%'};return _0x254835;}})});}_0x10aa65=_[_0xf983('0x38')]({},_0x10aa65,_0x214db0[_0xf983('0x39')]);var _0x47f58b={'where':_0x10aa65[_0xf983('0x36')]};return db[_0xf983('0x26')][_0xf983('0x17')](_0x47f58b)[_0xf983('0x1e')](function(_0x1cf849){_0x4af419['count']=_0x1cf849;if(_0x214db0[_0xf983('0x2c')][_0xf983('0x3a')]){_0x10aa65[_0xf983('0x3b')]=[{'all':!![]}];}return db[_0xf983('0x26')][_0xf983('0x3c')](_0x10aa65);})[_0xf983('0x1e')](function(_0x5c2701){_0x4af419[_0xf983('0x3d')]=_0x5c2701;return _0x4af419;})[_0xf983('0x1e')](respondWithFilteredResult(_0x1e7d9d,_0x10aa65))[_0xf983('0x3e')](handleError(_0x1e7d9d,null));};exports[_0xf983('0x3f')]=function(_0x2027f5,_0x4e3d03){var _0x1f0a80={'raw':!![],'where':{'id':_0x2027f5[_0xf983('0x40')]['id']}},_0x4c071f={};_0x4c071f['model']=_['keys'](db[_0xf983('0x26')][_0xf983('0x27')]);_0x4c071f[_0xf983('0x2c')]=_[_0xf983('0x2d')](_0x2027f5[_0xf983('0x2c')]);_0x4c071f[_0xf983('0x2e')]=_[_0xf983('0x2f')](_0x4c071f[_0xf983('0x2b')],_0x4c071f['query']);_0x1f0a80['attributes']=_[_0xf983('0x2f')](_0x4c071f[_0xf983('0x2b')],qs[_0xf983('0x31')](_0x2027f5[_0xf983('0x2c')][_0xf983('0x31')]));_0x1f0a80['attributes']=_0x1f0a80['attributes'][_0xf983('0x41')]?_0x1f0a80[_0xf983('0x30')]:_0x4c071f[_0xf983('0x2b')];if(_0x2027f5[_0xf983('0x2c')][_0xf983('0x3a')]){_0x1f0a80['include']=[{'all':!![]}];}_0x1f0a80=_[_0xf983('0x38')]({},_0x1f0a80,_0x2027f5[_0xf983('0x39')]);return db['CmHopperBlack']['find'](_0x1f0a80)[_0xf983('0x1e')](handleEntityNotFound(_0x4e3d03,null))[_0xf983('0x1e')](respondWithResult(_0x4e3d03,null))[_0xf983('0x3e')](handleError(_0x4e3d03,null));};exports[_0xf983('0x1c')]=function(_0x634adc,_0x21100e){if(_0x634adc[_0xf983('0x42')]['id']){delete _0x634adc[_0xf983('0x42')]['id'];}return db[_0xf983('0x26')][_0xf983('0x43')]({'where':{'id':_0x634adc[_0xf983('0x40')]['id']}})[_0xf983('0x1e')](handleEntityNotFound(_0x21100e,null))[_0xf983('0x1e')](saveUpdates(_0x634adc[_0xf983('0x42')],null))[_0xf983('0x1e')](respondWithResult(_0x21100e,null))[_0xf983('0x3e')](handleError(_0x21100e,null));};exports['destroy']=function(_0x2527cb,_0x4dd365){return db[_0xf983('0x26')][_0xf983('0x43')]({'where':{'id':_0x2527cb[_0xf983('0x40')]['id']}})[_0xf983('0x1e')](handleEntityNotFound(_0x4dd365,null))['then'](removeEntity(_0x4dd365,null))[_0xf983('0x3e')](handleError(_0x4dd365,null));};exports[_0xf983('0x44')]=function(_0x291901,_0x2f1fe0){return db[_0xf983('0x26')][_0xf983('0x44')]()[_0xf983('0x1e')](respondWithResult(_0x2f1fe0,null))[_0xf983('0x3e')](handleError(_0x2f1fe0,null));}; \ No newline at end of file +var _0xe6e9=['fields','length','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','CmHopperBlack','findAll','catch','show','keys','options','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','model','query','intersection','attributes'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0xe6e9,0x182));var _0x9e6e=function(_0x35b4a2,_0x29cb78){_0x35b4a2=_0x35b4a2-0x0;var _0x16a64e=_0xe6e9[_0x35b4a2];return _0x16a64e;};'use strict';var emlformat=require(_0x9e6e('0x0'));var rimraf=require(_0x9e6e('0x1'));var zipdir=require(_0x9e6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e6e('0x3'));var moment=require(_0x9e6e('0x4'));var BPromise=require(_0x9e6e('0x5'));var Mustache=require(_0x9e6e('0x6'));var util=require(_0x9e6e('0x7'));var path=require('path');var sox=require(_0x9e6e('0x8'));var csv=require(_0x9e6e('0x9'));var ejs=require(_0x9e6e('0xa'));var fs=require('fs');var fs_extra=require(_0x9e6e('0xb'));var _=require(_0x9e6e('0xc'));var squel=require('squel');var crypto=require(_0x9e6e('0xd'));var jsforce=require(_0x9e6e('0xe'));var deskjs=require(_0x9e6e('0xf'));var toCsv=require(_0x9e6e('0x9'));var querystring=require(_0x9e6e('0x10'));var Papa=require(_0x9e6e('0x11'));var Redis=require('ioredis');var authService=require(_0x9e6e('0x12'));var qs=require(_0x9e6e('0x13'));var as=require(_0x9e6e('0x14'));var hardwareService=require(_0x9e6e('0x15'));var logger=require('../../config/logger')(_0x9e6e('0x16'));var utils=require(_0x9e6e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9e6e('0x18'));var db=require(_0x9e6e('0x19'))['db'];function respondWithStatusCode(_0x1b85f1,_0x363f0c){_0x363f0c=_0x363f0c||0xcc;return function(_0x5a2cf9){if(_0x5a2cf9){return _0x1b85f1[_0x9e6e('0x1a')](_0x363f0c);}return _0x1b85f1[_0x9e6e('0x1b')](_0x363f0c)[_0x9e6e('0x1c')]();};}function respondWithResult(_0x2981d0,_0x3ade25){_0x3ade25=_0x3ade25||0xc8;return function(_0x38f89c){if(_0x38f89c){return _0x2981d0[_0x9e6e('0x1b')](_0x3ade25)[_0x9e6e('0x1d')](_0x38f89c);}};}function respondWithFilteredResult(_0x3080b1,_0x2dbdba){return function(_0x1941da){if(_0x1941da){var _0x236850=typeof _0x2dbdba[_0x9e6e('0x1e')]===_0x9e6e('0x1f')&&typeof _0x2dbdba[_0x9e6e('0x20')]===_0x9e6e('0x1f');var _0x592ba=_0x1941da[_0x9e6e('0x21')];var _0xfd921e=_0x236850?0x0:_0x2dbdba[_0x9e6e('0x1e')];var _0x2c5876=_0x236850?_0x1941da['count']:_0x2dbdba['offset']+_0x2dbdba['limit'];var _0x14acbd;if(_0x2c5876>=_0x592ba){_0x2c5876=_0x592ba;_0x14acbd=0xc8;}else{_0x14acbd=0xce;}_0x3080b1[_0x9e6e('0x1b')](_0x14acbd);return _0x3080b1[_0x9e6e('0x22')](_0x9e6e('0x23'),_0xfd921e+'-'+_0x2c5876+'/'+_0x592ba)[_0x9e6e('0x1d')](_0x1941da);}return null;};}function patchUpdates(_0x3b9299){return function(_0x195727){try{jsonpatch[_0x9e6e('0x24')](_0x195727,_0x3b9299,!![]);}catch(_0x4e66e3){return BPromise[_0x9e6e('0x25')](_0x4e66e3);}return _0x195727[_0x9e6e('0x26')]();};}function saveUpdates(_0x3b3527,_0x28ae35){return function(_0x1e97c3){if(_0x1e97c3){return _0x1e97c3[_0x9e6e('0x27')](_0x3b3527)[_0x9e6e('0x28')](function(_0x59e00e){return _0x59e00e;});}return null;};}function removeEntity(_0x223fd4,_0x4202cd){return function(_0x3aee5c){if(_0x3aee5c){return _0x3aee5c[_0x9e6e('0x29')]()['then'](function(){_0x223fd4['status'](0xcc)[_0x9e6e('0x1c')]();});}};}function handleEntityNotFound(_0xb7b794,_0x26e0be){return function(_0x4e17b7){if(!_0x4e17b7){_0xb7b794['sendStatus'](0x194);}return _0x4e17b7;};}function handleError(_0x383656,_0x36fef5){_0x36fef5=_0x36fef5||0x1f4;return function(_0x200f78){logger[_0x9e6e('0x2a')](_0x200f78['stack']);if(_0x200f78['name']){delete _0x200f78[_0x9e6e('0x2b')];}_0x383656['status'](_0x36fef5)[_0x9e6e('0x2c')](_0x200f78);};}exports['index']=function(_0x43b1bf,_0x3130b8){var _0x4a0c94={},_0x2511f7={},_0x16f6f7={'count':0x0,'rows':[]};var _0x34f5ff=_[_0x9e6e('0x2d')](db['CmHopperBlack'][_0x9e6e('0x2e')],function(_0x59e4a5){return{'name':_0x59e4a5['fieldName'],'type':_0x59e4a5[_0x9e6e('0x2f')]['key']};});_0x2511f7[_0x9e6e('0x30')]=_[_0x9e6e('0x2d')](_0x34f5ff,_0x9e6e('0x2b'));_0x2511f7[_0x9e6e('0x31')]=_['keys'](_0x43b1bf[_0x9e6e('0x31')]);_0x2511f7['filters']=_[_0x9e6e('0x32')](_0x2511f7['model'],_0x2511f7['query']);_0x4a0c94[_0x9e6e('0x33')]=_[_0x9e6e('0x32')](_0x2511f7[_0x9e6e('0x30')],qs['fields'](_0x43b1bf[_0x9e6e('0x31')][_0x9e6e('0x34')]));_0x4a0c94[_0x9e6e('0x33')]=_0x4a0c94['attributes'][_0x9e6e('0x35')]?_0x4a0c94[_0x9e6e('0x33')]:_0x2511f7[_0x9e6e('0x30')];if(!_0x43b1bf['query']['hasOwnProperty']('nolimit')){_0x4a0c94[_0x9e6e('0x20')]=qs[_0x9e6e('0x20')](_0x43b1bf['query'][_0x9e6e('0x20')]);_0x4a0c94['offset']=qs['offset'](_0x43b1bf[_0x9e6e('0x31')][_0x9e6e('0x1e')]);}_0x4a0c94[_0x9e6e('0x36')]=qs['sort'](_0x43b1bf[_0x9e6e('0x31')]['sort']);_0x4a0c94['where']=qs[_0x9e6e('0x37')](_[_0x9e6e('0x38')](_0x43b1bf[_0x9e6e('0x31')],_0x2511f7['filters']),_0x34f5ff);if(_0x43b1bf[_0x9e6e('0x31')][_0x9e6e('0x39')]){_0x4a0c94[_0x9e6e('0x3a')]=_[_0x9e6e('0x3b')](_0x4a0c94[_0x9e6e('0x3a')],{'$or':_[_0x9e6e('0x2d')](_0x34f5ff,function(_0x511df4){if(_0x511df4[_0x9e6e('0x2f')]!==_0x9e6e('0x3c')){var _0x479318={};_0x479318[_0x511df4[_0x9e6e('0x2b')]]={'$like':'%'+_0x43b1bf[_0x9e6e('0x31')][_0x9e6e('0x39')]+'%'};return _0x479318;}})});}_0x4a0c94=_[_0x9e6e('0x3b')]({},_0x4a0c94,_0x43b1bf['options']);var _0x4d045d={'where':_0x4a0c94[_0x9e6e('0x3a')]};return db['CmHopperBlack']['count'](_0x4d045d)['then'](function(_0x4ebb41){_0x16f6f7['count']=_0x4ebb41;if(_0x43b1bf['query'][_0x9e6e('0x3d')]){_0x4a0c94[_0x9e6e('0x3e')]=[{'all':!![]}];}return db[_0x9e6e('0x3f')][_0x9e6e('0x40')](_0x4a0c94);})[_0x9e6e('0x28')](function(_0x272461){_0x16f6f7['rows']=_0x272461;return _0x16f6f7;})[_0x9e6e('0x28')](respondWithFilteredResult(_0x3130b8,_0x4a0c94))[_0x9e6e('0x41')](handleError(_0x3130b8,null));};exports[_0x9e6e('0x42')]=function(_0x324d1c,_0xbda0d2){var _0x5a7f55={'raw':!![],'where':{'id':_0x324d1c['params']['id']}},_0x5e7bc4={};_0x5e7bc4[_0x9e6e('0x30')]=_[_0x9e6e('0x43')](db[_0x9e6e('0x3f')][_0x9e6e('0x2e')]);_0x5e7bc4[_0x9e6e('0x31')]=_[_0x9e6e('0x43')](_0x324d1c[_0x9e6e('0x31')]);_0x5e7bc4['filters']=_[_0x9e6e('0x32')](_0x5e7bc4[_0x9e6e('0x30')],_0x5e7bc4['query']);_0x5a7f55[_0x9e6e('0x33')]=_[_0x9e6e('0x32')](_0x5e7bc4['model'],qs['fields'](_0x324d1c[_0x9e6e('0x31')][_0x9e6e('0x34')]));_0x5a7f55[_0x9e6e('0x33')]=_0x5a7f55['attributes'][_0x9e6e('0x35')]?_0x5a7f55[_0x9e6e('0x33')]:_0x5e7bc4[_0x9e6e('0x30')];if(_0x324d1c[_0x9e6e('0x31')][_0x9e6e('0x3d')]){_0x5a7f55['include']=[{'all':!![]}];}_0x5a7f55=_['merge']({},_0x5a7f55,_0x324d1c[_0x9e6e('0x44')]);return db[_0x9e6e('0x3f')]['find'](_0x5a7f55)['then'](handleEntityNotFound(_0xbda0d2,null))[_0x9e6e('0x28')](respondWithResult(_0xbda0d2,null))[_0x9e6e('0x41')](handleError(_0xbda0d2,null));};exports['update']=function(_0x22f916,_0x44a54f){if(_0x22f916[_0x9e6e('0x45')]['id']){delete _0x22f916[_0x9e6e('0x45')]['id'];}return db[_0x9e6e('0x3f')][_0x9e6e('0x46')]({'where':{'id':_0x22f916[_0x9e6e('0x47')]['id']}})[_0x9e6e('0x28')](handleEntityNotFound(_0x44a54f,null))[_0x9e6e('0x28')](saveUpdates(_0x22f916[_0x9e6e('0x45')],null))[_0x9e6e('0x28')](respondWithResult(_0x44a54f,null))[_0x9e6e('0x41')](handleError(_0x44a54f,null));};exports[_0x9e6e('0x29')]=function(_0x39fddc,_0x7f90b9){return db[_0x9e6e('0x3f')][_0x9e6e('0x46')]({'where':{'id':_0x39fddc[_0x9e6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x7f90b9,null))[_0x9e6e('0x28')](removeEntity(_0x7f90b9,null))['catch'](handleError(_0x7f90b9,null));};exports['describe']=function(_0x3c2cb7,_0x583a6e){return db['CmHopperBlack'][_0x9e6e('0x48')]()[_0x9e6e('0x28')](respondWithResult(_0x583a6e,null))[_0x9e6e('0x41')](handleError(_0x583a6e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 42b3037..d889ec6 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 _0x2c7d=['../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c7d,0x12a));var _0xd2c7=function(_0x12448c,_0x4b049c){_0x12448c=_0x12448c-0x0;var _0x28fd98=_0x2c7d[_0x12448c];return _0x28fd98;};'use strict';var _=require(_0xd2c7('0x0'));var util=require(_0xd2c7('0x1'));var logger=require(_0xd2c7('0x2'))(_0xd2c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd2c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c7('0x5'));var config=require(_0xd2c7('0x6'));var attributes=require(_0xd2c7('0x7'));module['exports']=function(_0x5e5f27,_0x4d006a){return _0x5e5f27[_0xd2c7('0x8')](_0xd2c7('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dd9=['../../config/logger','api','moment','request-promise','rimraf','exports','define','cm_hopper_black','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7dd9,0xce));var _0x97dd=function(_0x46c393,_0x2a4c9a){_0x46c393=_0x46c393-0x0;var _0x3d7e58=_0x7dd9[_0x46c393];return _0x3d7e58;};'use strict';var _=require('lodash');var util=require(_0x97dd('0x0'));var logger=require(_0x97dd('0x1'))(_0x97dd('0x2'));var moment=require(_0x97dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x97dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97dd('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x97dd('0x6')]=function(_0x55b232,_0x357dfc){return _0x55b232[_0x97dd('0x7')]('CmHopperBlack',attributes,{'tableName':_0x97dd('0x8'),'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 a887b71..30af030 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 _0xc9e3=['jayson/promise','http','request','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','CmHopperBlack,\x20%s,\x20%s','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1d8126,_0x2831c6){var _0x356ac7=function(_0x264ee8){while(--_0x264ee8){_0x1d8126['push'](_0x1d8126['shift']());}};_0x356ac7(++_0x2831c6);}(_0xc9e3,0xa8));var _0x3c9e=function(_0x5024ef,_0x31cb9a){_0x5024ef=_0x5024ef-0x0;var _0xd618e3=_0xc9e3[_0x5024ef];return _0xd618e3;};'use strict';var _=require('lodash');var util=require(_0x3c9e('0x0'));var moment=require(_0x3c9e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c9e('0x2'));var db=require(_0x3c9e('0x3'))['db'];var utils=require(_0x3c9e('0x4'));var logger=require('../../config/logger')(_0x3c9e('0x5'));var config=require(_0x3c9e('0x6'));var jayson=require(_0x3c9e('0x7'));var client=jayson['client'][_0x3c9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b6007,_0x2080d6,_0x6bbf18){return new BPromise(function(_0x5c42aa,_0x55ad24){return client[_0x3c9e('0x9')](_0x5b6007,_0x6bbf18)['then'](function(_0x3cbe96){logger[_0x3c9e('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x2080d6,'request\x20sent');logger[_0x3c9e('0xb')](_0x3c9e('0xc'),_0x2080d6,_0x3c9e('0xd'),JSON[_0x3c9e('0xe')](_0x3cbe96));if(_0x3cbe96['error']){if(_0x3cbe96['error'][_0x3c9e('0xf')]===0x1f4){logger[_0x3c9e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2080d6,_0x3cbe96['error'][_0x3c9e('0x11')]);return _0x55ad24(_0x3cbe96[_0x3c9e('0x10')][_0x3c9e('0x11')]);}logger[_0x3c9e('0x10')](_0x3c9e('0x12'),_0x2080d6,_0x3cbe96[_0x3c9e('0x10')][_0x3c9e('0x11')]);return _0x5c42aa(_0x3cbe96[_0x3c9e('0x10')][_0x3c9e('0x11')]);}else{logger[_0x3c9e('0xa')](_0x3c9e('0x12'),_0x2080d6,_0x3c9e('0xd'));_0x5c42aa(_0x3cbe96['result'][_0x3c9e('0x11')]);}})[_0x3c9e('0x13')](function(_0x3f030c){logger[_0x3c9e('0x10')](_0x3c9e('0x12'),_0x2080d6,_0x3f030c);_0x55ad24(_0x3f030c);});});}exports[_0x3c9e('0x14')]=function(_0x5dc7ae){var _0x2d3753=this;return new Promise(function(_0x2cdd73,_0x18b6c2){return db[_0x3c9e('0x15')][_0x3c9e('0x16')]({'raw':_0x5dc7ae[_0x3c9e('0x17')]?_0x5dc7ae[_0x3c9e('0x17')][_0x3c9e('0x18')]===undefined?!![]:![]:!![],'where':_0x5dc7ae[_0x3c9e('0x17')]?_0x5dc7ae[_0x3c9e('0x17')][_0x3c9e('0x19')]||null:null,'attributes':_0x5dc7ae['options']?_0x5dc7ae[_0x3c9e('0x17')]['attributes']||null:null,'limit':_0x5dc7ae[_0x3c9e('0x17')]?_0x5dc7ae[_0x3c9e('0x17')][_0x3c9e('0x1a')]||null:null,'include':_0x5dc7ae[_0x3c9e('0x17')]?_0x5dc7ae[_0x3c9e('0x17')][_0x3c9e('0x1b')]?_[_0x3c9e('0x1c')](_0x5dc7ae[_0x3c9e('0x17')][_0x3c9e('0x1b')],function(_0x59b53b){return{'model':db[_0x59b53b[_0x3c9e('0x1d')]],'as':_0x59b53b['as'],'attributes':_0x59b53b['attributes'],'include':_0x59b53b[_0x3c9e('0x1b')]?_[_0x3c9e('0x1c')](_0x59b53b[_0x3c9e('0x1b')],function(_0x1aa293){return{'model':db[_0x1aa293['model']],'as':_0x1aa293['as'],'attributes':_0x1aa293[_0x3c9e('0x1e')],'include':_0x1aa293[_0x3c9e('0x1b')]?_[_0x3c9e('0x1c')](_0x1aa293[_0x3c9e('0x1b')],function(_0x4d5ccb){return{'model':db[_0x4d5ccb[_0x3c9e('0x1d')]],'as':_0x4d5ccb['as'],'attributes':_0x4d5ccb[_0x3c9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c9e('0x1f')](function(_0x118c6e){logger[_0x3c9e('0xa')](_0x3c9e('0x14'),_0x5dc7ae);logger[_0x3c9e('0xb')](_0x3c9e('0x14'),_0x5dc7ae,JSON[_0x3c9e('0xe')](_0x118c6e));_0x2cdd73(_0x118c6e);})[_0x3c9e('0x13')](function(_0xbb89e9){logger[_0x3c9e('0x10')]('GetCmHopperBlack',_0xbb89e9[_0x3c9e('0x11')],_0x5dc7ae);_0x18b6c2(_0x2d3753[_0x3c9e('0x10')](0x1f4,_0xbb89e9[_0x3c9e('0x11')]));});});};exports[_0x3c9e('0x20')]=function(_0x226975){var _0x32e6f3=this;return new Promise(function(_0x30ed9c,_0x2a2825){return db[_0x3c9e('0x15')]['update'](_0x226975['body'],{'raw':_0x226975['options']?_0x226975[_0x3c9e('0x17')][_0x3c9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226975[_0x3c9e('0x17')]?_0x226975[_0x3c9e('0x17')][_0x3c9e('0x19')]||null:null,'attributes':_0x226975[_0x3c9e('0x17')]?_0x226975[_0x3c9e('0x17')][_0x3c9e('0x1e')]||null:null,'limit':_0x226975[_0x3c9e('0x17')]?_0x226975[_0x3c9e('0x17')][_0x3c9e('0x1a')]||null:null})[_0x3c9e('0x1f')](function(_0xa8f781){logger[_0x3c9e('0xa')](_0x3c9e('0x20'),_0x226975);logger[_0x3c9e('0xb')]('UpdateCmHopperBlack',_0x226975,JSON['stringify'](_0xa8f781));_0x30ed9c(_0xa8f781);})[_0x3c9e('0x13')](function(_0x21c34c){logger['error'](_0x3c9e('0x20'),_0x21c34c[_0x3c9e('0x11')],_0x226975);_0x2a2825(_0x32e6f3['error'](0x1f4,_0x21c34c[_0x3c9e('0x11')]));});});};exports[_0x3c9e('0x21')]=function(_0x274cdb){var _0x59ad97=this;return new Promise(function(_0x264bac,_0x545893){return db[_0x3c9e('0x15')][_0x3c9e('0x22')]({'where':_0x274cdb[_0x3c9e('0x17')]?_0x274cdb[_0x3c9e('0x17')][_0x3c9e('0x19')]||null:null})[_0x3c9e('0x1f')](function(_0x4725a6){logger[_0x3c9e('0xa')](_0x3c9e('0x21'),_0x274cdb);logger[_0x3c9e('0xb')](_0x3c9e('0x21'),_0x274cdb,JSON[_0x3c9e('0xe')](_0x4725a6));_0x264bac(_0x4725a6);})['catch'](function(_0xc2e86){logger['error'](_0x3c9e('0x21'),_0xc2e86[_0x3c9e('0x11')],_0x274cdb);_0x545893(_0x59ad97[_0x3c9e('0x10')](0x1f4,_0xc2e86[_0x3c9e('0x11')]));});});}; \ No newline at end of file +var _0x65a9=['util','ioredis','../../mysqldb','../../config/environment','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','raw','DestroyCmHopperBlack','CmHopperBlack','destroy'];(function(_0x5557d4,_0x5fa24c){var _0x12cd17=function(_0x255178){while(--_0x255178){_0x5557d4['push'](_0x5557d4['shift']());}};_0x12cd17(++_0x5fa24c);}(_0x65a9,0x8c));var _0x965a=function(_0x297e9b,_0x3b385e){_0x297e9b=_0x297e9b-0x0;var _0x4c55de=_0x65a9[_0x297e9b];return _0x4c55de;};'use strict';var _=require('lodash');var util=require(_0x965a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x965a('0x1'));var db=require(_0x965a('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x965a('0x3'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x590196,_0xd2d5e3,_0x2435d6){return new BPromise(function(_0x91c523,_0x1a2afb){return client['request'](_0x590196,_0x2435d6)[_0x965a('0x4')](function(_0x10139c){logger['info'](_0x965a('0x5'),_0xd2d5e3,_0x965a('0x6'));logger[_0x965a('0x7')](_0x965a('0x8'),_0xd2d5e3,_0x965a('0x6'),JSON[_0x965a('0x9')](_0x10139c));if(_0x10139c[_0x965a('0xa')]){if(_0x10139c[_0x965a('0xa')]['code']===0x1f4){logger[_0x965a('0xa')](_0x965a('0x5'),_0xd2d5e3,_0x10139c[_0x965a('0xa')]['message']);return _0x1a2afb(_0x10139c['error'][_0x965a('0xb')]);}logger[_0x965a('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0xd2d5e3,_0x10139c['error'][_0x965a('0xb')]);return _0x91c523(_0x10139c[_0x965a('0xa')][_0x965a('0xb')]);}else{logger['info'](_0x965a('0x5'),_0xd2d5e3,'request\x20sent');_0x91c523(_0x10139c[_0x965a('0xc')][_0x965a('0xb')]);}})[_0x965a('0xd')](function(_0x9e49fe){logger[_0x965a('0xa')](_0x965a('0x5'),_0xd2d5e3,_0x9e49fe);_0x1a2afb(_0x9e49fe);});});}exports[_0x965a('0xe')]=function(_0xd0b145){var _0x37717f=this;return new Promise(function(_0x421250,_0x531ee2){return db['CmHopperBlack'][_0x965a('0xf')]({'raw':_0xd0b145[_0x965a('0x10')]?_0xd0b145[_0x965a('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0xd0b145[_0x965a('0x10')]?_0xd0b145[_0x965a('0x10')][_0x965a('0x11')]||null:null,'attributes':_0xd0b145[_0x965a('0x10')]?_0xd0b145[_0x965a('0x10')][_0x965a('0x12')]||null:null,'limit':_0xd0b145['options']?_0xd0b145[_0x965a('0x10')][_0x965a('0x13')]||null:null,'include':_0xd0b145[_0x965a('0x10')]?_0xd0b145[_0x965a('0x10')][_0x965a('0x14')]?_[_0x965a('0x15')](_0xd0b145['options'][_0x965a('0x14')],function(_0x5e8803){return{'model':db[_0x5e8803[_0x965a('0x16')]],'as':_0x5e8803['as'],'attributes':_0x5e8803[_0x965a('0x12')],'include':_0x5e8803['include']?_['map'](_0x5e8803[_0x965a('0x14')],function(_0x242582){return{'model':db[_0x242582[_0x965a('0x16')]],'as':_0x242582['as'],'attributes':_0x242582[_0x965a('0x12')],'include':_0x242582[_0x965a('0x14')]?_[_0x965a('0x15')](_0x242582[_0x965a('0x14')],function(_0x22ce72){return{'model':db[_0x22ce72[_0x965a('0x16')]],'as':_0x22ce72['as'],'attributes':_0x22ce72[_0x965a('0x12')]};}):[]};}):[]};}):[]:[]})[_0x965a('0x4')](function(_0x430547){logger['info'](_0x965a('0xe'),_0xd0b145);logger['debug']('GetCmHopperBlack',_0xd0b145,JSON[_0x965a('0x9')](_0x430547));_0x421250(_0x430547);})['catch'](function(_0x2df36d){logger['error'](_0x965a('0xe'),_0x2df36d['message'],_0xd0b145);_0x531ee2(_0x37717f[_0x965a('0xa')](0x1f4,_0x2df36d['message']));});});};exports[_0x965a('0x17')]=function(_0xd92f00){var _0x118482=this;return new Promise(function(_0x11c274,_0x5caf89){return db['CmHopperBlack']['update'](_0xd92f00['body'],{'raw':_0xd92f00[_0x965a('0x10')]?_0xd92f00['options'][_0x965a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd92f00['options']?_0xd92f00[_0x965a('0x10')]['where']||null:null,'attributes':_0xd92f00[_0x965a('0x10')]?_0xd92f00[_0x965a('0x10')][_0x965a('0x12')]||null:null,'limit':_0xd92f00[_0x965a('0x10')]?_0xd92f00[_0x965a('0x10')]['limit']||null:null})[_0x965a('0x4')](function(_0x58a5e3){logger['info'](_0x965a('0x17'),_0xd92f00);logger[_0x965a('0x7')]('UpdateCmHopperBlack',_0xd92f00,JSON['stringify'](_0x58a5e3));_0x11c274(_0x58a5e3);})[_0x965a('0xd')](function(_0x176015){logger[_0x965a('0xa')](_0x965a('0x17'),_0x176015[_0x965a('0xb')],_0xd92f00);_0x5caf89(_0x118482[_0x965a('0xa')](0x1f4,_0x176015[_0x965a('0xb')]));});});};exports[_0x965a('0x19')]=function(_0x2200fa){var _0x4736e7=this;return new Promise(function(_0x473604,_0x27a0e4){return db[_0x965a('0x1a')][_0x965a('0x1b')]({'where':_0x2200fa[_0x965a('0x10')]?_0x2200fa[_0x965a('0x10')][_0x965a('0x11')]||null:null})[_0x965a('0x4')](function(_0x468b07){logger['info'](_0x965a('0x19'),_0x2200fa);logger[_0x965a('0x7')]('DestroyCmHopperBlack',_0x2200fa,JSON[_0x965a('0x9')](_0x468b07));_0x473604(_0x468b07);})['catch'](function(_0x2bb0ef){logger[_0x965a('0xa')](_0x965a('0x19'),_0x2bb0ef[_0x965a('0xb')],_0x2200fa);_0x27a0e4(_0x4736e7[_0x965a('0xa')](0x1f4,_0x2bb0ef['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a3185b1..7b1e19f 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 _0x9fd4=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x46efe9,_0x465611){var _0x3eb009=function(_0x3a0ec6){while(--_0x3a0ec6){_0x46efe9['push'](_0x46efe9['shift']());}};_0x3eb009(++_0x465611);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1f68e6,_0xe62604){_0x1f68e6=_0x1f68e6-0x0;var _0x28a862=_0x9fd4[_0x1f68e6];return _0x28a862;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0xe')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x10')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['destroy']);module[_0x49fd('0x11')]=router; \ No newline at end of file +var _0x53ec=['../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router'];(function(_0x2e1b41,_0x17914a){var _0x163368=function(_0x1b2c7e){while(--_0x1b2c7e){_0x2e1b41['push'](_0x2e1b41['shift']());}};_0x163368(++_0x17914a);}(_0x53ec,0x192));var _0xc53e=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0x53ec[_0x1a0c59];return _0xed67c9;};'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')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ff4e873..35dbaf8 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 _0xc6d1=['STRING','DATE','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x5b325c,_0x74bf05){var _0x27cb24=function(_0x1a8749){while(--_0x1a8749){_0x5b325c['push'](_0x5b325c['shift']());}};_0x27cb24(++_0x74bf05);}(_0xc6d1,0xcd));var _0x1c6d=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xc6d1[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x1c6d('0x0'));var moment=require(_0x1c6d('0x1'));module[_0x1c6d('0x2')]={'state':{'type':Sequelize[_0x1c6d('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x1c6d('0x4')]},'scheduledat':{'type':Sequelize[_0x1c6d('0x5')]},'countbusyretry':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1c6d('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1c6d('0x4')]},'calleridnum':{'type':Sequelize[_0x1c6d('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1c6d('0x5')]},'responsetime':{'type':Sequelize[_0x1c6d('0x5')]},'answertime':{'type':Sequelize[_0x1c6d('0x5')]},'droptime':{'type':Sequelize[_0x1c6d('0x5')]},'endtime':{'type':Sequelize[_0x1c6d('0x5')]},'ringtime':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1c6d('0x4')]},'campaign':{'type':Sequelize[_0x1c6d('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1c6d('0x4')]},'reason':{'type':Sequelize[_0x1c6d('0x4')]},'disposition':{'type':Sequelize[_0x1c6d('0x4')]},'secondDisposition':{'type':Sequelize[_0x1c6d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1c6d('0x4')]},'dispositionat':{'type':Sequelize[_0x1c6d('0x5')],'set':function(_0x5c1504){var _0x8a031=this['getDataValue'](_0x1c6d('0x6'));if(_0x8a031&&_0x5c1504){this['setDataValue'](_0x1c6d('0x7'),moment(_0x5c1504)[_0x1c6d('0x8')](moment(_0x8a031),_0x1c6d('0x9')));}}},'amd':{'type':Sequelize[_0x1c6d('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1c6d('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1c6d('0x5')]},'callback':{'type':Sequelize[_0x1c6d('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1c6d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1c6d('0x5')]},'deleted':{'type':Sequelize[_0x1c6d('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1c6d('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1c6d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x80fe=['sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x23e4c1,_0x3f32a2){var _0x87a225=function(_0x4c7ed9){while(--_0x4c7ed9){_0x23e4c1['push'](_0x23e4c1['shift']());}};_0x87a225(++_0x3f32a2);}(_0x80fe,0x104));var _0xe80f=function(_0x351a64,_0xb61778){_0x351a64=_0x351a64-0x0;var _0x317b9b=_0x80fe[_0x351a64];return _0x317b9b;};'use strict';var Sequelize=require(_0xe80f('0x0'));var moment=require(_0xe80f('0x1'));module[_0xe80f('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe80f('0x3')]},'scheduledat':{'type':Sequelize[_0xe80f('0x4')]},'countbusyretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe80f('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe80f('0x3')]},'calleridnum':{'type':Sequelize[_0xe80f('0x3')]},'calleridname':{'type':Sequelize[_0xe80f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe80f('0x4')]},'answertime':{'type':Sequelize[_0xe80f('0x4')]},'droptime':{'type':Sequelize[_0xe80f('0x4')]},'endtime':{'type':Sequelize[_0xe80f('0x4')]},'ringtime':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe80f('0x3')]},'campaigntype':{'type':Sequelize[_0xe80f('0x3')]},'membername':{'type':Sequelize[_0xe80f('0x3')]},'reason':{'type':Sequelize[_0xe80f('0x3')]},'disposition':{'type':Sequelize[_0xe80f('0x3')]},'secondDisposition':{'type':Sequelize[_0xe80f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1686a1){var _0x5caa39=this[_0xe80f('0x6')](_0xe80f('0x7'));if(_0x5caa39&&_0x1686a1){this[_0xe80f('0x8')](_0xe80f('0x9'),moment(_0x1686a1)[_0xe80f('0xa')](moment(_0x5caa39),_0xe80f('0xb')));}}},'amd':{'type':Sequelize[_0xe80f('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe80f('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe80f('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe80f('0x4')]},'callback':{'type':Sequelize[_0xe80f('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe80f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe80f('0x4')]},'deleted':{'type':Sequelize[_0xe80f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe80f('0x4')]},'recallme':{'type':Sequelize[_0xe80f('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe80f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe80f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index b5d3155..2a6d89d 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 _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x483547,_0x5eca97){var _0x46b5ed=function(_0x2b4ec0){while(--_0x2b4ec0){_0x483547['push'](_0x483547['shift']());}};_0x46b5ed(++_0x5eca97);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3b10ba,_0x17df42){_0x3b10ba=_0x3b10ba-0x0;var _0x420662=_0xc6ac[_0x3b10ba];return _0x420662;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file +var _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b1084,_0x5e24b3){var _0x531e8b=function(_0x5e2897){while(--_0x5e2897){_0x4b1084['push'](_0x4b1084['shift']());}};_0x531e8b(++_0x5e24b3);}(_0x33af,0xec));var _0xf33a=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x33af[_0x31e5cb];return _0x4170df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 1d347c7..a1e588b 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 _0xfe1a=['calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal'];(function(_0x2efd4b,_0x2bc31a){var _0x1141e9=function(_0x421f71){while(--_0x421f71){_0x2efd4b['push'](_0x2efd4b['shift']());}};_0x1141e9(++_0x2bc31a);}(_0xfe1a,0x183));var _0xafe1=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xfe1a[_0x411add];return _0x238242;};'use strict';var _=require(_0xafe1('0x0'));var util=require('util');var logger=require(_0xafe1('0x1'))(_0xafe1('0x2'));var moment=require('moment');var BPromise=require(_0xafe1('0x3'));var rp=require(_0xafe1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafe1('0x5'));var attributes=require(_0xafe1('0x6'));module[_0xafe1('0x7')]=function(_0x406f43,_0x53ba99){return _0x406f43['define'](_0xafe1('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xafe1('0x9')]},{'name':_0xafe1('0xa'),'fields':[_0xafe1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45ae=['rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b45d9,_0x3f4e3e){var _0x26f957=function(_0x487782){while(--_0x487782){_0x2b45d9['push'](_0x2b45d9['shift']());}};_0x26f957(++_0x3f4e3e);}(_0x45ae,0x125));var _0xe45a=function(_0x19261b,_0x26644a){_0x19261b=_0x19261b-0x0;var _0x19ca03=_0x45ae[_0x19261b];return _0x19ca03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe45a('0x0'))(_0xe45a('0x1'));var moment=require(_0xe45a('0x2'));var BPromise=require(_0xe45a('0x3'));var rp=require(_0xe45a('0x4'));var fs=require('fs');var path=require(_0xe45a('0x5'));var rimraf=require(_0xe45a('0x6'));var config=require(_0xe45a('0x7'));var attributes=require(_0xe45a('0x8'));module['exports']=function(_0x17c957,_0x1e3ce5){return _0x17c957[_0xe45a('0x9')](_0xe45a('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe45a('0xb'),'fields':[_0xe45a('0xb')]},{'name':_0xe45a('0xc'),'fields':[_0xe45a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5491bfa..d9bb543 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(_0x5c9a9a,_0x59ac61){var _0x4e31c8=function(_0x4526e8){while(--_0x4526e8){_0x5c9a9a['push'](_0x5c9a9a['shift']());}};_0x4e31c8(++_0x59ac61);}(_0x7a54,0x106));var _0x47a5=function(_0x339f7b,_0x52722f){_0x339f7b=_0x339f7b-0x0;var _0xa892a2=_0x7a54[_0x339f7b];return _0xa892a2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x13c3d4,_0x4337be){var _0x2153d4=function(_0x57f84c){while(--_0x57f84c){_0x13c3d4['push'](_0x13c3d4['shift']());}};_0x2153d4(++_0x4337be);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a93f0,_0x172b1b){_0x5a93f0=_0x5a93f0-0x0;var _0x53844d=_0xb10b[_0x5a93f0];return _0x53844d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 974048c..e6c0c0d 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 _0x6c79=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x1c2344,_0x33e89f){var _0x4c4a0f=function(_0x141789){while(--_0x141789){_0x1c2344['push'](_0x1c2344['shift']());}};_0x4c4a0f(++_0x33e89f);}(_0x6c79,0x184));var _0x96c7=function(_0x5a1613,_0x370b1b){_0x5a1613=_0x5a1613-0x0;var _0x2197d8=_0x6c79[_0x5a1613];return _0x2197d8;};'use strict';var multer=require(_0x96c7('0x0'));var util=require(_0x96c7('0x1'));var path=require(_0x96c7('0x2'));var timeout=require(_0x96c7('0x3'));var express=require(_0x96c7('0x4'));var router=express['Router']();var fs_extra=require(_0x96c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96c7('0x6'));var config=require(_0x96c7('0x7'));var controller=require(_0x96c7('0x8'));router[_0x96c7('0x9')]('/',auth[_0x96c7('0xa')](),controller['index']);router[_0x96c7('0x9')](_0x96c7('0xb'),auth[_0x96c7('0xa')](),controller[_0x96c7('0xc')]);router[_0x96c7('0x9')]('/:id',auth[_0x96c7('0xa')](),controller[_0x96c7('0xd')]);router[_0x96c7('0x9')](_0x96c7('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x96c7('0x9')](_0x96c7('0xf'),auth['isAuthenticated'](),controller[_0x96c7('0x10')]);router[_0x96c7('0x11')]('/voice/queue/moveContacts/:id',auth[_0x96c7('0xa')](),controller[_0x96c7('0x12')]);router['post'](_0x96c7('0x13'),auth['isAuthenticated'](),controller[_0x96c7('0x14')]);router[_0x96c7('0x11')](_0x96c7('0x15'),auth[_0x96c7('0xa')](),controller[_0x96c7('0x16')]);router['put'](_0x96c7('0x17'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x0924=['../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x21fee9,_0x30e3c8){var _0x32ed2c=function(_0x5609cd){while(--_0x5609cd){_0x21fee9['push'](_0x21fee9['shift']());}};_0x32ed2c(++_0x30e3c8);}(_0x0924,0x77));var _0x4092=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0x0924[_0x1be9ce];return _0x164439;};'use strict';var multer=require('multer');var util=require(_0x4092('0x0'));var path=require(_0x4092('0x1'));var timeout=require(_0x4092('0x2'));var express=require(_0x4092('0x3'));var router=express[_0x4092('0x4')]();var fs_extra=require(_0x4092('0x5'));var auth=require(_0x4092('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4092('0x7'));var controller=require(_0x4092('0x8'));router['get']('/',auth[_0x4092('0x9')](),controller['index']);router[_0x4092('0xa')](_0x4092('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4092('0xc'),auth['isAuthenticated'](),controller[_0x4092('0xd')]);router['get'](_0x4092('0xe'),auth['isAuthenticated'](),controller[_0x4092('0xf')]);router['get'](_0x4092('0x10'),auth[_0x4092('0x9')](),controller[_0x4092('0x11')]);router['post'](_0x4092('0x12'),auth[_0x4092('0x9')](),controller[_0x4092('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0x4092('0x9')](),controller[_0x4092('0x14')]);router[_0x4092('0x15')](_0x4092('0x16'),auth['isAuthenticated'](),controller[_0x4092('0x17')]);router['put'](_0x4092('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x4092('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d4f3e08..7f042fb 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 _0xb839=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0xb839,0x11d));var _0x9b83=function(_0x290800,_0x3479dd){_0x290800=_0x290800-0x0;var _0x15fa2a=_0xb839[_0x290800];return _0x15fa2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9b83('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9b83('0x1')]},'scheduledat':{'type':Sequelize[_0x9b83('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9b83('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9b83('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9b83('0x2')]},'answertime':{'type':Sequelize[_0x9b83('0x2')]},'droptime':{'type':Sequelize[_0x9b83('0x2')]},'endtime':{'type':Sequelize[_0x9b83('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9b83('0x1')]},'campaign':{'type':Sequelize[_0x9b83('0x1')]},'campaigntype':{'type':Sequelize[_0x9b83('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9b83('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x9b83('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9b83('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9b83('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9b83('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b83('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b83('0x1')]}}; \ No newline at end of file +var _0x6014=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x6014,0x6d));var _0x4601=function(_0x97db75,_0x3abdb8){_0x97db75=_0x97db75-0x0;var _0x259a53=_0x6014[_0x97db75];return _0x259a53;};'use strict';var Sequelize=require(_0x4601('0x0'));module[_0x4601('0x1')]={'state':{'type':Sequelize[_0x4601('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4601('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4601('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4601('0x3')]},'calleridnum':{'type':Sequelize[_0x4601('0x3')]},'calleridname':{'type':Sequelize[_0x4601('0x3')]},'starttime':{'type':Sequelize[_0x4601('0x4')]},'responsetime':{'type':Sequelize[_0x4601('0x4')]},'answertime':{'type':Sequelize[_0x4601('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4601('0x3')]},'campaign':{'type':Sequelize[_0x4601('0x3')]},'campaigntype':{'type':Sequelize[_0x4601('0x3')]},'membername':{'type':Sequelize[_0x4601('0x3')]},'reason':{'type':Sequelize[_0x4601('0x3')]},'amd':{'type':Sequelize[_0x4601('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4601('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4601('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4601('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4601('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4601('0x4')]},'edited':{'type':Sequelize[_0x4601('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4601('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4601('0x2')],'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 59450bc..1789acc 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 _0xfa53=['include','options','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','length','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params'];(function(_0x32eb63,_0x24f38c){var _0xb55e84=function(_0x58e19f){while(--_0x58e19f){_0x32eb63['push'](_0x32eb63['shift']());}};_0xb55e84(++_0x24f38c);}(_0xfa53,0xdc));var _0x3fa5=function(_0x4d6304,_0x140426){_0x4d6304=_0x4d6304-0x0;var _0x39a640=_0xfa53[_0x4d6304];return _0x39a640;};'use strict';var emlformat=require(_0x3fa5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fa5('0x1'));var jsonpatch=require(_0x3fa5('0x2'));var rp=require(_0x3fa5('0x3'));var moment=require(_0x3fa5('0x4'));var BPromise=require(_0x3fa5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3fa5('0x6'));var ejs=require(_0x3fa5('0x7'));var fs=require('fs');var fs_extra=require(_0x3fa5('0x8'));var _=require(_0x3fa5('0x9'));var squel=require('squel');var crypto=require(_0x3fa5('0xa'));var jsforce=require(_0x3fa5('0xb'));var deskjs=require(_0x3fa5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fa5('0xd'));var Papa=require('papaparse');var Redis=require(_0x3fa5('0xe'));var authService=require(_0x3fa5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fa5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3fa5('0x11'));var config=require(_0x3fa5('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dcd0e,_0x4bdd92){_0x4bdd92=_0x4bdd92||0xcc;return function(_0x4a54db){if(_0x4a54db){return _0x1dcd0e[_0x3fa5('0x13')](_0x4bdd92);}return _0x1dcd0e[_0x3fa5('0x14')](_0x4bdd92)['end']();};}function respondWithResult(_0x352859,_0x16b3f2){_0x16b3f2=_0x16b3f2||0xc8;return function(_0x36c158){if(_0x36c158){return _0x352859[_0x3fa5('0x14')](_0x16b3f2)[_0x3fa5('0x15')](_0x36c158);}};}function respondWithFilteredResult(_0x3fd519,_0x261aaf){return function(_0x482b0d){if(_0x482b0d){var _0x4a4aaf=typeof _0x261aaf[_0x3fa5('0x16')]===_0x3fa5('0x17')&&typeof _0x261aaf['limit']===_0x3fa5('0x17');var _0x1302b6=_0x482b0d[_0x3fa5('0x18')];var _0x294b66=_0x4a4aaf?0x0:_0x261aaf[_0x3fa5('0x16')];var _0x524769=_0x4a4aaf?_0x482b0d[_0x3fa5('0x18')]:_0x261aaf[_0x3fa5('0x16')]+_0x261aaf[_0x3fa5('0x19')];var _0x344590;if(_0x524769>=_0x1302b6){_0x524769=_0x1302b6;_0x344590=0xc8;}else{_0x344590=0xce;}_0x3fd519[_0x3fa5('0x14')](_0x344590);return _0x3fd519[_0x3fa5('0x1a')](_0x3fa5('0x1b'),_0x294b66+'-'+_0x524769+'/'+_0x1302b6)[_0x3fa5('0x15')](_0x482b0d);}return null;};}function patchUpdates(_0x5ed13f){return function(_0x48ccd3){try{jsonpatch[_0x3fa5('0x1c')](_0x48ccd3,_0x5ed13f,!![]);}catch(_0x3d2a17){return BPromise['reject'](_0x3d2a17);}return _0x48ccd3[_0x3fa5('0x1d')]();};}function saveUpdates(_0x5a477a,_0x418321){return function(_0xce10bc){if(_0xce10bc){return _0xce10bc[_0x3fa5('0x1e')](_0x5a477a)[_0x3fa5('0x1f')](function(_0x356aa8){return _0x356aa8;});}return null;};}function removeEntity(_0x13d2cc,_0x118444){return function(_0x533afb){if(_0x533afb){return _0x533afb[_0x3fa5('0x20')]()[_0x3fa5('0x1f')](function(){_0x13d2cc[_0x3fa5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425e1d,_0x10e6a5){return function(_0x499a83){if(!_0x499a83){_0x425e1d['sendStatus'](0x194);}return _0x499a83;};}function handleError(_0x304085,_0x220843){_0x220843=_0x220843||0x1f4;return function(_0x5d4a77){logger[_0x3fa5('0x21')](_0x5d4a77[_0x3fa5('0x22')]);if(_0x5d4a77[_0x3fa5('0x23')]){delete _0x5d4a77['name'];}_0x304085[_0x3fa5('0x14')](_0x220843)[_0x3fa5('0x24')](_0x5d4a77);};}exports[_0x3fa5('0x25')]=function(_0x261ca8,_0x31cad5){var _0x46180e={},_0x94d8e6={},_0x3a394c={'count':0x0,'rows':[]};var _0x5959b9=_[_0x3fa5('0x26')](db[_0x3fa5('0x27')][_0x3fa5('0x28')],function(_0x43005f){return{'name':_0x43005f[_0x3fa5('0x29')],'type':_0x43005f[_0x3fa5('0x2a')][_0x3fa5('0x2b')]};});_0x94d8e6['model']=_[_0x3fa5('0x26')](_0x5959b9,'name');_0x94d8e6[_0x3fa5('0x2c')]=_[_0x3fa5('0x2d')](_0x261ca8['query']);_0x94d8e6['filters']=_[_0x3fa5('0x2e')](_0x94d8e6[_0x3fa5('0x2f')],_0x94d8e6[_0x3fa5('0x2c')]);_0x46180e['attributes']=_[_0x3fa5('0x2e')](_0x94d8e6[_0x3fa5('0x2f')],qs['fields'](_0x261ca8[_0x3fa5('0x2c')][_0x3fa5('0x30')]));_0x46180e['attributes']=_0x46180e['attributes'][_0x3fa5('0x31')]?_0x46180e[_0x3fa5('0x32')]:_0x94d8e6['model'];if(!_0x261ca8['query']['hasOwnProperty']('nolimit')){_0x46180e[_0x3fa5('0x19')]=qs[_0x3fa5('0x19')](_0x261ca8['query']['limit']);_0x46180e[_0x3fa5('0x16')]=qs[_0x3fa5('0x16')](_0x261ca8[_0x3fa5('0x2c')]['offset']);}_0x46180e[_0x3fa5('0x33')]=qs[_0x3fa5('0x34')](_0x261ca8[_0x3fa5('0x2c')][_0x3fa5('0x34')]);_0x46180e[_0x3fa5('0x35')]=qs[_0x3fa5('0x36')](_[_0x3fa5('0x37')](_0x261ca8[_0x3fa5('0x2c')],_0x94d8e6[_0x3fa5('0x36')]),_0x5959b9);if(_0x261ca8['query'][_0x3fa5('0x38')]){_0x46180e[_0x3fa5('0x35')]=_[_0x3fa5('0x39')](_0x46180e[_0x3fa5('0x35')],{'$or':_[_0x3fa5('0x26')](_0x5959b9,function(_0x7426a2){if(_0x7426a2[_0x3fa5('0x2a')]!==_0x3fa5('0x3a')){var _0x22e177={};_0x22e177[_0x7426a2[_0x3fa5('0x23')]]={'$like':'%'+_0x261ca8[_0x3fa5('0x2c')][_0x3fa5('0x38')]+'%'};return _0x22e177;}})});}_0x46180e=_['merge']({},_0x46180e,_0x261ca8['options']);var _0x175bc7={'where':_0x46180e[_0x3fa5('0x35')]};return db[_0x3fa5('0x27')][_0x3fa5('0x18')](_0x175bc7)[_0x3fa5('0x1f')](function(_0x3cd2d9){_0x3a394c[_0x3fa5('0x18')]=_0x3cd2d9;if(_0x261ca8['query'][_0x3fa5('0x3b')]){_0x46180e['include']=[{'all':!![]}];}return db[_0x3fa5('0x27')][_0x3fa5('0x3c')](_0x46180e);})[_0x3fa5('0x1f')](function(_0x281424){_0x3a394c['rows']=_0x281424;return _0x3a394c;})[_0x3fa5('0x1f')](respondWithFilteredResult(_0x31cad5,_0x46180e))[_0x3fa5('0x3d')](handleError(_0x31cad5,null));};exports[_0x3fa5('0x3e')]=function(_0x4ba01f,_0x301716){var _0x16c0a0={'raw':!![],'where':{'id':_0x4ba01f[_0x3fa5('0x3f')]['id']}},_0x2da8a5={};_0x2da8a5[_0x3fa5('0x2f')]=_[_0x3fa5('0x2d')](db[_0x3fa5('0x27')][_0x3fa5('0x28')]);_0x2da8a5[_0x3fa5('0x2c')]=_[_0x3fa5('0x2d')](_0x4ba01f[_0x3fa5('0x2c')]);_0x2da8a5[_0x3fa5('0x36')]=_[_0x3fa5('0x2e')](_0x2da8a5['model'],_0x2da8a5['query']);_0x16c0a0[_0x3fa5('0x32')]=_[_0x3fa5('0x2e')](_0x2da8a5[_0x3fa5('0x2f')],qs[_0x3fa5('0x30')](_0x4ba01f['query'][_0x3fa5('0x30')]));_0x16c0a0['attributes']=_0x16c0a0[_0x3fa5('0x32')][_0x3fa5('0x31')]?_0x16c0a0['attributes']:_0x2da8a5[_0x3fa5('0x2f')];if(_0x4ba01f['query'][_0x3fa5('0x3b')]){_0x16c0a0[_0x3fa5('0x40')]=[{'all':!![]}];}_0x16c0a0=_['merge']({},_0x16c0a0,_0x4ba01f[_0x3fa5('0x41')]);return db['CmHopperHistory'][_0x3fa5('0x42')](_0x16c0a0)['then'](handleEntityNotFound(_0x301716,null))[_0x3fa5('0x1f')](respondWithResult(_0x301716,null))[_0x3fa5('0x3d')](handleError(_0x301716,null));};exports[_0x3fa5('0x43')]=function(_0x245bd3,_0x32fea9){return db[_0x3fa5('0x27')]['create'](_0x245bd3[_0x3fa5('0x44')],{})[_0x3fa5('0x1f')](respondWithResult(_0x32fea9,0xc9))['catch'](handleError(_0x32fea9,null));};exports[_0x3fa5('0x45')]=function(_0x5f0ba3,_0x5697ed){return db[_0x3fa5('0x27')][_0x3fa5('0x45')]()[_0x3fa5('0x1f')](respondWithResult(_0x5697ed,null))[_0x3fa5('0x3d')](handleError(_0x5697ed,null));};exports[_0x3fa5('0x1e')]=function(_0x23f079,_0xe56108){if(_0x23f079['body'][_0x3fa5('0x46')]){delete _0x23f079[_0x3fa5('0x44')][_0x3fa5('0x46')];}return db[_0x3fa5('0x27')][_0x3fa5('0x42')]({'where':{'uniqueid':_0x23f079['params']['id']}})['then'](handleEntityNotFound(_0xe56108,null))[_0x3fa5('0x1f')](saveUpdates(_0x23f079[_0x3fa5('0x44')],null))[_0x3fa5('0x1f')](respondWithResult(_0xe56108,null))[_0x3fa5('0x3d')](handleError(_0xe56108,null));}; \ No newline at end of file +var _0xa104=['show','params','keys','fields','length','merge','options','create','body','describe','update','uniqueid','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','findAll','catch'];(function(_0x40eb31,_0x400d15){var _0x4704ff=function(_0x28a3f2){while(--_0x28a3f2){_0x40eb31['push'](_0x40eb31['shift']());}};_0x4704ff(++_0x400d15);}(_0xa104,0x149));var _0x4a10=function(_0x472f3a,_0xd39aed){_0x472f3a=_0x472f3a-0x0;var _0x568483=_0xa104[_0x472f3a];return _0x568483;};'use strict';var emlformat=require(_0x4a10('0x0'));var rimraf=require(_0x4a10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a10('0x2'));var moment=require(_0x4a10('0x3'));var BPromise=require(_0x4a10('0x4'));var Mustache=require(_0x4a10('0x5'));var util=require(_0x4a10('0x6'));var path=require(_0x4a10('0x7'));var sox=require(_0x4a10('0x8'));var csv=require('to-csv');var ejs=require(_0x4a10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a10('0xa'));var squel=require(_0x4a10('0xb'));var crypto=require(_0x4a10('0xc'));var jsforce=require(_0x4a10('0xd'));var deskjs=require(_0x4a10('0xe'));var toCsv=require(_0x4a10('0xf'));var querystring=require(_0x4a10('0x10'));var Papa=require(_0x4a10('0x11'));var Redis=require(_0x4a10('0x12'));var authService=require(_0x4a10('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4a10('0x14'));var hardwareService=require(_0x4a10('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4a10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a10('0x17'));var db=require(_0x4a10('0x18'))['db'];function respondWithStatusCode(_0x252804,_0x3dd8b0){_0x3dd8b0=_0x3dd8b0||0xcc;return function(_0x549c4d){if(_0x549c4d){return _0x252804[_0x4a10('0x19')](_0x3dd8b0);}return _0x252804['status'](_0x3dd8b0)[_0x4a10('0x1a')]();};}function respondWithResult(_0x67f5ec,_0x4f5567){_0x4f5567=_0x4f5567||0xc8;return function(_0x183746){if(_0x183746){return _0x67f5ec[_0x4a10('0x1b')](_0x4f5567)[_0x4a10('0x1c')](_0x183746);}};}function respondWithFilteredResult(_0x16ff92,_0x224cf8){return function(_0x1ac855){if(_0x1ac855){var _0x42ad9d=typeof _0x224cf8['offset']===_0x4a10('0x1d')&&typeof _0x224cf8[_0x4a10('0x1e')]===_0x4a10('0x1d');var _0x629990=_0x1ac855[_0x4a10('0x1f')];var _0x4d3b8b=_0x42ad9d?0x0:_0x224cf8[_0x4a10('0x20')];var _0x47727a=_0x42ad9d?_0x1ac855['count']:_0x224cf8['offset']+_0x224cf8[_0x4a10('0x1e')];var _0x14cb6b;if(_0x47727a>=_0x629990){_0x47727a=_0x629990;_0x14cb6b=0xc8;}else{_0x14cb6b=0xce;}_0x16ff92[_0x4a10('0x1b')](_0x14cb6b);return _0x16ff92[_0x4a10('0x21')](_0x4a10('0x22'),_0x4d3b8b+'-'+_0x47727a+'/'+_0x629990)[_0x4a10('0x1c')](_0x1ac855);}return null;};}function patchUpdates(_0x5c47dd){return function(_0x13881f){try{jsonpatch[_0x4a10('0x23')](_0x13881f,_0x5c47dd,!![]);}catch(_0x1b7542){return BPromise[_0x4a10('0x24')](_0x1b7542);}return _0x13881f[_0x4a10('0x25')]();};}function saveUpdates(_0x513cdd,_0x312aaa){return function(_0x5ec5d6){if(_0x5ec5d6){return _0x5ec5d6['update'](_0x513cdd)[_0x4a10('0x26')](function(_0x2a42a5){return _0x2a42a5;});}return null;};}function removeEntity(_0x5bdc7e,_0x41d4a4){return function(_0xb52bac){if(_0xb52bac){return _0xb52bac[_0x4a10('0x27')]()[_0x4a10('0x26')](function(){_0x5bdc7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x259ded,_0x2047b4){return function(_0x2c4047){if(!_0x2c4047){_0x259ded[_0x4a10('0x19')](0x194);}return _0x2c4047;};}function handleError(_0x1ffd83,_0x1cb657){_0x1cb657=_0x1cb657||0x1f4;return function(_0x428be6){logger[_0x4a10('0x28')](_0x428be6[_0x4a10('0x29')]);if(_0x428be6['name']){delete _0x428be6[_0x4a10('0x2a')];}_0x1ffd83[_0x4a10('0x1b')](_0x1cb657)[_0x4a10('0x2b')](_0x428be6);};}exports[_0x4a10('0x2c')]=function(_0x352957,_0x1c0b55){var _0x183f64={},_0x1bc969={},_0xf5e440={'count':0x0,'rows':[]};var _0x132837=_[_0x4a10('0x2d')](db[_0x4a10('0x2e')][_0x4a10('0x2f')],function(_0x54b07d){return{'name':_0x54b07d[_0x4a10('0x30')],'type':_0x54b07d[_0x4a10('0x31')][_0x4a10('0x32')]};});_0x1bc969[_0x4a10('0x33')]=_[_0x4a10('0x2d')](_0x132837,'name');_0x1bc969['query']=_['keys'](_0x352957[_0x4a10('0x34')]);_0x1bc969[_0x4a10('0x35')]=_[_0x4a10('0x36')](_0x1bc969[_0x4a10('0x33')],_0x1bc969[_0x4a10('0x34')]);_0x183f64[_0x4a10('0x37')]=_[_0x4a10('0x36')](_0x1bc969[_0x4a10('0x33')],qs['fields'](_0x352957['query']['fields']));_0x183f64['attributes']=_0x183f64[_0x4a10('0x37')]['length']?_0x183f64[_0x4a10('0x37')]:_0x1bc969[_0x4a10('0x33')];if(!_0x352957[_0x4a10('0x34')][_0x4a10('0x38')](_0x4a10('0x39'))){_0x183f64[_0x4a10('0x1e')]=qs[_0x4a10('0x1e')](_0x352957['query'][_0x4a10('0x1e')]);_0x183f64[_0x4a10('0x20')]=qs['offset'](_0x352957[_0x4a10('0x34')][_0x4a10('0x20')]);}_0x183f64['order']=qs['sort'](_0x352957[_0x4a10('0x34')][_0x4a10('0x3a')]);_0x183f64[_0x4a10('0x3b')]=qs[_0x4a10('0x35')](_[_0x4a10('0x3c')](_0x352957['query'],_0x1bc969[_0x4a10('0x35')]),_0x132837);if(_0x352957[_0x4a10('0x34')][_0x4a10('0x3d')]){_0x183f64[_0x4a10('0x3b')]=_['merge'](_0x183f64['where'],{'$or':_[_0x4a10('0x2d')](_0x132837,function(_0x672e37){if(_0x672e37[_0x4a10('0x31')]!==_0x4a10('0x3e')){var _0x36d225={};_0x36d225[_0x672e37[_0x4a10('0x2a')]]={'$like':'%'+_0x352957['query'][_0x4a10('0x3d')]+'%'};return _0x36d225;}})});}_0x183f64=_['merge']({},_0x183f64,_0x352957['options']);var _0x4146bc={'where':_0x183f64[_0x4a10('0x3b')]};return db['CmHopperHistory'][_0x4a10('0x1f')](_0x4146bc)[_0x4a10('0x26')](function(_0x2478df){_0xf5e440[_0x4a10('0x1f')]=_0x2478df;if(_0x352957[_0x4a10('0x34')][_0x4a10('0x3f')]){_0x183f64['include']=[{'all':!![]}];}return db[_0x4a10('0x2e')][_0x4a10('0x40')](_0x183f64);})['then'](function(_0x492b4c){_0xf5e440['rows']=_0x492b4c;return _0xf5e440;})[_0x4a10('0x26')](respondWithFilteredResult(_0x1c0b55,_0x183f64))[_0x4a10('0x41')](handleError(_0x1c0b55,null));};exports[_0x4a10('0x42')]=function(_0x18496d,_0x1b99b5){var _0x48ec9b={'raw':!![],'where':{'id':_0x18496d[_0x4a10('0x43')]['id']}},_0x3533ae={};_0x3533ae['model']=_[_0x4a10('0x44')](db[_0x4a10('0x2e')][_0x4a10('0x2f')]);_0x3533ae[_0x4a10('0x34')]=_['keys'](_0x18496d['query']);_0x3533ae[_0x4a10('0x35')]=_[_0x4a10('0x36')](_0x3533ae[_0x4a10('0x33')],_0x3533ae[_0x4a10('0x34')]);_0x48ec9b[_0x4a10('0x37')]=_[_0x4a10('0x36')](_0x3533ae[_0x4a10('0x33')],qs[_0x4a10('0x45')](_0x18496d[_0x4a10('0x34')][_0x4a10('0x45')]));_0x48ec9b['attributes']=_0x48ec9b[_0x4a10('0x37')][_0x4a10('0x46')]?_0x48ec9b[_0x4a10('0x37')]:_0x3533ae[_0x4a10('0x33')];if(_0x18496d[_0x4a10('0x34')][_0x4a10('0x3f')]){_0x48ec9b['include']=[{'all':!![]}];}_0x48ec9b=_[_0x4a10('0x47')]({},_0x48ec9b,_0x18496d[_0x4a10('0x48')]);return db[_0x4a10('0x2e')]['find'](_0x48ec9b)[_0x4a10('0x26')](handleEntityNotFound(_0x1b99b5,null))[_0x4a10('0x26')](respondWithResult(_0x1b99b5,null))[_0x4a10('0x41')](handleError(_0x1b99b5,null));};exports[_0x4a10('0x49')]=function(_0x29098c,_0x45dc8f){return db[_0x4a10('0x2e')]['create'](_0x29098c[_0x4a10('0x4a')],{})[_0x4a10('0x26')](respondWithResult(_0x45dc8f,0xc9))['catch'](handleError(_0x45dc8f,null));};exports[_0x4a10('0x4b')]=function(_0x1f5c95,_0x26afeb){return db[_0x4a10('0x2e')][_0x4a10('0x4b')]()[_0x4a10('0x26')](respondWithResult(_0x26afeb,null))[_0x4a10('0x41')](handleError(_0x26afeb,null));};exports[_0x4a10('0x4c')]=function(_0xbd9e50,_0x1e0ef1){if(_0xbd9e50[_0x4a10('0x4a')][_0x4a10('0x4d')]){delete _0xbd9e50[_0x4a10('0x4a')][_0x4a10('0x4d')];}return db['CmHopperHistory'][_0x4a10('0x4e')]({'where':{'uniqueid':_0xbd9e50[_0x4a10('0x43')]['id']}})[_0x4a10('0x26')](handleEntityNotFound(_0x1e0ef1,null))[_0x4a10('0x26')](saveUpdates(_0xbd9e50[_0x4a10('0x4a')],null))[_0x4a10('0x26')](respondWithResult(_0x1e0ef1,null))[_0x4a10('0x41')](handleError(_0x1e0ef1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 77e1ea0..dcd3e3c 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 _0xd1ca=['lodash','util','bluebird','request-promise','path','../../config/environment','define','cm_hopper_history','endtime','uniqueid'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xd1ca,0x140));var _0xad1c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd1ca[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad1c('0x2'));var rp=require(_0xad1c('0x3'));var fs=require('fs');var path=require(_0xad1c('0x4'));var rimraf=require('rimraf');var config=require(_0xad1c('0x5'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xd08c6,_0x44ae9c){return _0xd08c6[_0xad1c('0x6')]('CmHopperHistory',attributes,{'tableName':_0xad1c('0x7'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xad1c('0x8')]},{'name':_0xad1c('0x9'),'fields':[_0xad1c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6209=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','lodash','util'];(function(_0x16ec80,_0x51d854){var _0x3c56ea=function(_0xc45db5){while(--_0xc45db5){_0x16ec80['push'](_0x16ec80['shift']());}};_0x3c56ea(++_0x51d854);}(_0x6209,0x1e8));var _0x9620=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6209[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var logger=require(_0x9620('0x2'))(_0x9620('0x3'));var moment=require(_0x9620('0x4'));var BPromise=require(_0x9620('0x5'));var rp=require(_0x9620('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9620('0x7'));var config=require(_0x9620('0x8'));var attributes=require(_0x9620('0x9'));module['exports']=function(_0x30c6e7,_0x26302a){return _0x30c6e7[_0x9620('0xa')](_0x9620('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9620('0xc')]},{'name':'uniqueid','fields':[_0x9620('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a249b27..8a8173b 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dea=['options','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','campaign','ivrAnswerCallsDay','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x31e8b8,_0xd4ce2d){var _0x29d91d=function(_0x27e486){while(--_0x27e486){_0x31e8b8['push'](_0x31e8b8['shift']());}};_0x29d91d(++_0xd4ce2d);}(_0x5dea,0x1bc));var _0xa5de=function(_0x150d8f,_0x26bc1e){_0x150d8f=_0x150d8f-0x0;var _0xff6c99=_0x5dea[_0x150d8f];return _0xff6c99;};'use strict';var _=require(_0xa5de('0x0'));var util=require(_0xa5de('0x1'));var moment=require(_0xa5de('0x2'));var BPromise=require(_0xa5de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5de('0x5'))(_0xa5de('0x6'));var config=require(_0xa5de('0x7'));var jayson=require(_0xa5de('0x8'));var client=jayson['client'][_0xa5de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52ab35,_0x37f97d,_0x39579f){return new BPromise(function(_0x49eb0a,_0x44f1a8){return client[_0xa5de('0xa')](_0x52ab35,_0x39579f)[_0xa5de('0xb')](function(_0x119d05){logger[_0xa5de('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0xa5de('0xd'));logger[_0xa5de('0xe')](_0xa5de('0xf'),_0x37f97d,_0xa5de('0xd'),JSON[_0xa5de('0x10')](_0x119d05));if(_0x119d05['error']){if(_0x119d05[_0xa5de('0x11')][_0xa5de('0x12')]===0x1f4){logger['error'](_0xa5de('0x13'),_0x37f97d,_0x119d05[_0xa5de('0x11')][_0xa5de('0x14')]);return _0x44f1a8(_0x119d05[_0xa5de('0x11')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0x119d05['error'][_0xa5de('0x14')]);return _0x49eb0a(_0x119d05['error'][_0xa5de('0x14')]);}else{logger[_0xa5de('0xc')](_0xa5de('0x13'),_0x37f97d,_0xa5de('0xd'));_0x49eb0a(_0x119d05['result'][_0xa5de('0x14')]);}})[_0xa5de('0x15')](function(_0x1d4c54){logger[_0xa5de('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0x1d4c54);_0x44f1a8(_0x1d4c54);});});}exports[_0xa5de('0x16')]=function(_0x4bf68a){var _0x4eccb9=this;return new Promise(function(_0x5302ca,_0x414d8c){return db[_0xa5de('0x17')][_0xa5de('0x18')](_0x4bf68a['body'],{'raw':_0x4bf68a[_0xa5de('0x19')]?_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1a')]===undefined?!![]:![]:!![]})[_0xa5de('0xb')](function(_0x5e3e42){logger[_0xa5de('0xc')]('CreateCmHopperHistory',_0x4bf68a);logger[_0xa5de('0xe')]('CreateCmHopperHistory',_0x4bf68a,JSON[_0xa5de('0x10')](_0x5e3e42));_0x5302ca(_0x5e3e42);})[_0xa5de('0x15')](function(_0x3b190e){logger[_0xa5de('0x11')](_0xa5de('0x16'),_0x3b190e[_0xa5de('0x14')],_0x4bf68a);_0x414d8c(_0x4eccb9[_0xa5de('0x11')](0x1f4,_0x3b190e[_0xa5de('0x14')]));});});};exports['AvgHandleTime']=function(_0x4938dd){var _0x1e7542=this;return new Promise(function(_0x4ed8e1,_0x181574){return db[_0xa5de('0x17')]['findAll']({'raw':_0x4938dd['options']?_0x4938dd[_0xa5de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4938dd[_0xa5de('0x19')]?_0x4938dd['options'][_0xa5de('0x1b')]||null:null,'attributes':[[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')][_0xa5de('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),_0xa5de('0x21')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize'][_0xa5de('0x1f')](_0xa5de('0x22')))),_0xa5de('0x23')],[db[_0xa5de('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x24')))),_0xa5de('0x25')],[db[_0xa5de('0x1c')]['fn']('AVG',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x26')))),_0xa5de('0x27')],[db['sequelize']['fn'](_0xa5de('0x28'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x55b822){logger[_0xa5de('0xc')]('AvgHandleTime',_0x4938dd);logger[_0xa5de('0xe')]('AvgHandleTime',_0x4938dd,JSON[_0xa5de('0x10')](_0x55b822));_0x4ed8e1(_0x55b822);})[_0xa5de('0x15')](function(_0x42775b){logger[_0xa5de('0x11')](_0xa5de('0x29'),_0x42775b['message'],_0x4938dd);_0x181574(_0x1e7542[_0xa5de('0x11')](0x1f4,_0x42775b[_0xa5de('0x14')]));});});};exports[_0xa5de('0x2a')]=function(_0x5b2a23){var _0x459899=this;return new Promise(function(_0x42cc38,_0x50f174){return db[_0xa5de('0x17')][_0xa5de('0x2b')]({'raw':_0x5b2a23[_0xa5de('0x19')]?_0x5b2a23['options'][_0xa5de('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b2a23[_0xa5de('0x19')]?_0x5b2a23[_0xa5de('0x19')][_0xa5de('0x1b')]||null:null,'attributes':[['campaign',_0xa5de('0x2c')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x2d')))),_0xa5de('0x2e')],[db[_0xa5de('0x1c')]['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x2f')))),_0xa5de('0x30')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),'outboundAnswerCallsDay'],[db[_0xa5de('0x1c')]['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x31')))),'outboundBusyCallsDay'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x32')))),_0xa5de('0x33')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x34')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x35')))),_0xa5de('0x36')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa5de('0x37')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x38')))),_0xa5de('0x39')],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xa5de('0x3a')))),_0xa5de('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa5de('0x3c')],[db['sequelize']['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0xa5de('0x3c')],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize'][_0xa5de('0x1f')](_0xa5de('0x3e')))),_0xa5de('0x3f')]],'group':['campaign']})['then'](function(_0x12eb97){logger[_0xa5de('0xc')]('GetVoiceQueueHopperHistory',_0x5b2a23);logger[_0xa5de('0xe')]('GetVoiceQueueHopperHistory',_0x5b2a23,JSON[_0xa5de('0x10')](_0x12eb97));_0x42cc38(_0x12eb97);})[_0xa5de('0x15')](function(_0x3e0818){logger[_0xa5de('0x11')](_0xa5de('0x2a'),_0x3e0818[_0xa5de('0x14')],_0x5b2a23);_0x50f174(_0x459899[_0xa5de('0x11')](0x1f4,_0x3e0818[_0xa5de('0x14')]));});});};exports[_0xa5de('0x40')]=function(_0xbc113d){var _0x515b7f=this;return new Promise(function(_0x502063,_0x216a49){return db[_0xa5de('0x17')][_0xa5de('0x2b')]({'raw':_0xbc113d[_0xa5de('0x19')]?_0xbc113d[_0xa5de('0x19')][_0xa5de('0x1a')]===undefined?!![]:![]:!![],'where':_0xbc113d[_0xa5de('0x19')]?_0xbc113d['options'][_0xa5de('0x1b')]||null:null,'attributes':[[_0xa5de('0x41'),_0xa5de('0x2c')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')][_0xa5de('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),_0xa5de('0x42')]],'group':[_0xa5de('0x41')]})['then'](function(_0x3f46fb){logger[_0xa5de('0xc')](_0xa5de('0x40'),_0xbc113d);logger[_0xa5de('0xe')](_0xa5de('0x40'),_0xbc113d,JSON['stringify'](_0x3f46fb));_0x502063(_0x3f46fb);})[_0xa5de('0x15')](function(_0x2f5e6a){logger[_0xa5de('0x11')](_0xa5de('0x40'),_0x2f5e6a[_0xa5de('0x14')],_0xbc113d);_0x216a49(_0x515b7f[_0xa5de('0x11')](0x1f4,_0x2f5e6a[_0xa5de('0x14')]));});});}; \ No newline at end of file +var _0xd3b4=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','then','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x351260,_0x3275ae){_0x351260=_0x351260-0x0;var _0x3303bb=_0xd3b4[_0x351260];return _0x3303bb;};'use strict';var _=require(_0x4d3b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4d3b('0x1'));var rs=require(_0x4d3b('0x2'));var fs=require('fs');var Redis=require(_0x4d3b('0x3'));var db=require(_0x4d3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d3b('0x5'))('rpc');var config=require(_0x4d3b('0x6'));var jayson=require(_0x4d3b('0x7'));var client=jayson[_0x4d3b('0x8')][_0x4d3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4511c,_0x64ad89,_0x331043){return new BPromise(function(_0x7b17b9,_0x207a6e){return client[_0x4d3b('0xa')](_0xe4511c,_0x331043)['then'](function(_0x30e71a){logger['info'](_0x4d3b('0xb'),_0x64ad89,'request\x20sent');logger[_0x4d3b('0xc')](_0x4d3b('0xd'),_0x64ad89,_0x4d3b('0xe'),JSON[_0x4d3b('0xf')](_0x30e71a));if(_0x30e71a[_0x4d3b('0x10')]){if(_0x30e71a[_0x4d3b('0x10')][_0x4d3b('0x11')]===0x1f4){logger[_0x4d3b('0x10')](_0x4d3b('0xb'),_0x64ad89,_0x30e71a[_0x4d3b('0x10')][_0x4d3b('0x12')]);return _0x207a6e(_0x30e71a[_0x4d3b('0x10')]['message']);}logger[_0x4d3b('0x10')](_0x4d3b('0xb'),_0x64ad89,_0x30e71a[_0x4d3b('0x10')][_0x4d3b('0x12')]);return _0x7b17b9(_0x30e71a[_0x4d3b('0x10')][_0x4d3b('0x12')]);}else{logger[_0x4d3b('0x13')](_0x4d3b('0xb'),_0x64ad89,_0x4d3b('0xe'));_0x7b17b9(_0x30e71a[_0x4d3b('0x14')]['message']);}})[_0x4d3b('0x15')](function(_0x53c21a){logger[_0x4d3b('0x10')](_0x4d3b('0xb'),_0x64ad89,_0x53c21a);_0x207a6e(_0x53c21a);});});}exports[_0x4d3b('0x16')]=function(_0x408b9b){var _0x4f5ac6=this;return new Promise(function(_0x2f8a24,_0x393b68){return db[_0x4d3b('0x17')][_0x4d3b('0x18')](_0x408b9b[_0x4d3b('0x19')],{'raw':_0x408b9b[_0x4d3b('0x1a')]?_0x408b9b[_0x4d3b('0x1a')][_0x4d3b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x44da95){logger[_0x4d3b('0x13')](_0x4d3b('0x16'),_0x408b9b);logger[_0x4d3b('0xc')](_0x4d3b('0x16'),_0x408b9b,JSON['stringify'](_0x44da95));_0x2f8a24(_0x44da95);})[_0x4d3b('0x15')](function(_0x19c4c0){logger[_0x4d3b('0x10')]('CreateCmHopperHistory',_0x19c4c0[_0x4d3b('0x12')],_0x408b9b);_0x393b68(_0x4f5ac6['error'](0x1f4,_0x19c4c0[_0x4d3b('0x12')]));});});};exports[_0x4d3b('0x1c')]=function(_0xc3fe1d){var _0x5b94fc=this;return new Promise(function(_0x26c9ca,_0x31bd95){return db[_0x4d3b('0x17')][_0x4d3b('0x1d')]({'raw':_0xc3fe1d['options']?_0xc3fe1d[_0x4d3b('0x1a')][_0x4d3b('0x1b')]===undefined?!![]:![]:!![],'where':_0xc3fe1d[_0x4d3b('0x1a')]?_0xc3fe1d[_0x4d3b('0x1a')][_0x4d3b('0x1e')]||null:null,'attributes':[[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')][_0x4d3b('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x4d3b('0x1f')]['fn']('COUNT',db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x23')))),_0x4d3b('0x24')],[db[_0x4d3b('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4d3b('0x1f')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x4d3b('0x25')],[db['sequelize']['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x4d3b('0x26'),db['sequelize']['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x27')))),_0x4d3b('0x28')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x26'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x4d3b('0x2a')](function(_0x4978b6){logger['info'](_0x4d3b('0x1c'),_0xc3fe1d);logger[_0x4d3b('0xc')](_0x4d3b('0x1c'),_0xc3fe1d,JSON[_0x4d3b('0xf')](_0x4978b6));_0x26c9ca(_0x4978b6);})[_0x4d3b('0x15')](function(_0x1aa962){logger[_0x4d3b('0x10')](_0x4d3b('0x1c'),_0x1aa962[_0x4d3b('0x12')],_0xc3fe1d);_0x31bd95(_0x5b94fc[_0x4d3b('0x10')](0x1f4,_0x1aa962['message']));});});};exports[_0x4d3b('0x2b')]=function(_0x5ab93b){var _0x550596=this;return new Promise(function(_0x319bcf,_0x48e72c){return db[_0x4d3b('0x17')][_0x4d3b('0x1d')]({'raw':_0x5ab93b['options']?_0x5ab93b['options'][_0x4d3b('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab93b[_0x4d3b('0x1a')]?_0x5ab93b[_0x4d3b('0x1a')]['where']||null:null,'attributes':[[_0x4d3b('0x2c'),_0x4d3b('0x2d')],[db[_0x4d3b('0x1f')]['fn']('COUNT',db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x4d3b('0x2e')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x4d3b('0x2f')],[db[_0x4d3b('0x1f')]['fn']('COUNT',db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x4d3b('0x30')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x31')))),_0x4d3b('0x32')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db['sequelize'][_0x4d3b('0x22')](_0x4d3b('0x33')))),'outboundCongestionCallsDay'],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db['sequelize']['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x34')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4d3b('0x35')],[db[_0x4d3b('0x1f')]['fn']('COUNT',db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')]['literal'](_0x4d3b('0x36')))),_0x4d3b('0x37')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x4d3b('0x38')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x4d3b('0x39')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x3a')))),_0x4d3b('0x3b')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db[_0x4d3b('0x1f')]['literal'](_0x4d3b('0x3c')))),_0x4d3b('0x3d')],[db[_0x4d3b('0x1f')]['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db['sequelize'][_0x4d3b('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x4d3b('0x3b')],[db['sequelize']['fn'](_0x4d3b('0x20'),db['sequelize']['fn']('IF',db[_0x4d3b('0x1f')][_0x4d3b('0x22')](_0x4d3b('0x3e')))),_0x4d3b('0x3f')]],'group':[_0x4d3b('0x2c')]})[_0x4d3b('0x2a')](function(_0x171499){logger[_0x4d3b('0x13')](_0x4d3b('0x2b'),_0x5ab93b);logger[_0x4d3b('0xc')](_0x4d3b('0x2b'),_0x5ab93b,JSON[_0x4d3b('0xf')](_0x171499));_0x319bcf(_0x171499);})['catch'](function(_0x381e23){logger[_0x4d3b('0x10')](_0x4d3b('0x2b'),_0x381e23[_0x4d3b('0x12')],_0x5ab93b);_0x48e72c(_0x550596['error'](0x1f4,_0x381e23[_0x4d3b('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x15c904){var _0xe32799=this;return new Promise(function(_0x292b2f,_0x515cb6){return db[_0x4d3b('0x17')][_0x4d3b('0x1d')]({'raw':_0x15c904[_0x4d3b('0x1a')]?_0x15c904[_0x4d3b('0x1a')][_0x4d3b('0x1b')]===undefined?!![]:![]:!![],'where':_0x15c904['options']?_0x15c904[_0x4d3b('0x1a')][_0x4d3b('0x1e')]||null:null,'attributes':[[_0x4d3b('0x2c'),_0x4d3b('0x2d')],[db[_0x4d3b('0x1f')]['fn']('COUNT',db[_0x4d3b('0x1f')]['col']('id')),_0x4d3b('0x40')],[db['sequelize']['fn'](_0x4d3b('0x20'),db[_0x4d3b('0x1f')]['fn']('IF',db['sequelize'][_0x4d3b('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x4d3b('0x41')]],'group':[_0x4d3b('0x2c')]})[_0x4d3b('0x2a')](function(_0x462b76){logger['info'](_0x4d3b('0x42'),_0x15c904);logger[_0x4d3b('0xc')](_0x4d3b('0x42'),_0x15c904,JSON[_0x4d3b('0xf')](_0x462b76));_0x292b2f(_0x462b76);})[_0x4d3b('0x15')](function(_0x27a8d7){logger['error'](_0x4d3b('0x42'),_0x27a8d7[_0x4d3b('0x12')],_0x15c904);_0x515cb6(_0xe32799['error'](0x1f4,_0x27a8d7[_0x4d3b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2dcd308..dc77d70 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 _0x07a5=['get','isAuthenticated','/describe','describe','/:id','post','create','put','update','multer','util','../../components/auth/service','./cmHopperHistory.controller'];(function(_0x5259c7,_0x27338a){var _0x19e1dd=function(_0x2cd481){while(--_0x2cd481){_0x5259c7['push'](_0x5259c7['shift']());}};_0x19e1dd(++_0x27338a);}(_0x07a5,0x1a9));var _0x507a=function(_0x559cd9,_0x161f8a){_0x559cd9=_0x559cd9-0x0;var _0x40ca25=_0x07a5[_0x559cd9];return _0x40ca25;};'use strict';var multer=require(_0x507a('0x0'));var util=require(_0x507a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x507a('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x507a('0x3'));router[_0x507a('0x4')]('/',auth[_0x507a('0x5')](),controller['index']);router['get'](_0x507a('0x6'),auth[_0x507a('0x5')](),controller[_0x507a('0x7')]);router[_0x507a('0x4')](_0x507a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x507a('0x9')]('/',auth['isAuthenticated'](),controller[_0x507a('0xa')]);router[_0x507a('0xb')](_0x507a('0x8'),auth[_0x507a('0x5')](),controller[_0x507a('0xc')]);module['exports']=router; \ No newline at end of file +var _0x9080=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','exports','multer'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x9080,0xf6));var _0x0908=function(_0x56ab67,_0x3a629){_0x56ab67=_0x56ab67-0x0;var _0x11ce56=_0x9080[_0x56ab67];return _0x11ce56;};'use strict';var multer=require(_0x0908('0x0'));var util=require(_0x0908('0x1'));var path=require(_0x0908('0x2'));var timeout=require('connect-timeout');var express=require(_0x0908('0x3'));var router=express[_0x0908('0x4')]();var fs_extra=require(_0x0908('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0908('0x6'));var config=require(_0x0908('0x7'));var controller=require(_0x0908('0x8'));router[_0x0908('0x9')]('/',auth[_0x0908('0xa')](),controller[_0x0908('0xb')]);router[_0x0908('0x9')](_0x0908('0xc'),auth[_0x0908('0xa')](),controller[_0x0908('0xd')]);router[_0x0908('0x9')](_0x0908('0xe'),auth[_0x0908('0xa')](),controller['show']);router[_0x0908('0xf')]('/',auth[_0x0908('0xa')](),controller[_0x0908('0x10')]);router[_0x0908('0x11')]('/:id',auth[_0x0908('0xa')](),controller['update']);module[_0x0908('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ec42621..ec23edc 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 _0x1061=['STRING','sequelize'];(function(_0x1a7691,_0xc6a24c){var _0x11d89b=function(_0x52018d){while(--_0x52018d){_0x1a7691['push'](_0x1a7691['shift']());}};_0x11d89b(++_0xc6a24c);}(_0x1061,0x1b5));var _0x1106=function(_0x307f72,_0x4ecb2b){_0x307f72=_0x307f72-0x0;var _0x317597=_0x1061[_0x307f72];return _0x317597;};'use strict';var Sequelize=require(_0x1106('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1106('0x1')]},'dialPrefix':{'type':Sequelize[_0x1106('0x1')]}}; \ No newline at end of file +var _0x984b=['name','STRING'];(function(_0x81198f,_0x3a782d){var _0x5ba3da=function(_0x416214){while(--_0x416214){_0x81198f['push'](_0x81198f['shift']());}};_0x5ba3da(++_0x3a782d);}(_0x984b,0xee));var _0xb984=function(_0x33b267,_0x411016){_0x33b267=_0x33b267-0x0;var _0x2c7197=_0x984b[_0x33b267];return _0x2c7197;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb984('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb984('0x1')]},'dialPrefix':{'type':Sequelize[_0xb984('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e914457..f741333 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 _0x2bae=['find','create','user','get','role','userProfileId','body','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addContacts','tags','isArray','join','push','CmContact','omit','success','errors','message','getContacts','CmCustomField','CustomFields','cf_%d','pick','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','Lists','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','CmList','findAll','catch','params','includeAll','include'];(function(_0x5b84e5,_0x26076b){var _0xff9066=function(_0x3f17df){while(--_0x3f17df){_0x5b84e5['push'](_0x5b84e5['shift']());}};_0xff9066(++_0x26076b);}(_0x2bae,0x18f));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe2ba('0x0'));var rimraf=require(_0xe2ba('0x1'));var zipdir=require(_0xe2ba('0x2'));var jsonpatch=require(_0xe2ba('0x3'));var rp=require(_0xe2ba('0x4'));var moment=require(_0xe2ba('0x5'));var BPromise=require(_0xe2ba('0x6'));var Mustache=require(_0xe2ba('0x7'));var util=require(_0xe2ba('0x8'));var path=require(_0xe2ba('0x9'));var sox=require(_0xe2ba('0xa'));var csv=require('to-csv');var ejs=require(_0xe2ba('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2ba('0xc'));var squel=require(_0xe2ba('0xd'));var crypto=require('crypto');var jsforce=require(_0xe2ba('0xe'));var deskjs=require(_0xe2ba('0xf'));var toCsv=require(_0xe2ba('0x10'));var querystring=require(_0xe2ba('0x11'));var Papa=require(_0xe2ba('0x12'));var Redis=require(_0xe2ba('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe2ba('0x14'));var as=require(_0xe2ba('0x15'));var hardwareService=require(_0xe2ba('0x16'));var logger=require(_0xe2ba('0x17'))('api');var utils=require(_0xe2ba('0x18'));var config=require(_0xe2ba('0x19'));var licenseUtil=require(_0xe2ba('0x1a'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xe2ba('0x1b')]=_['defaults'](config[_0xe2ba('0x1b')],{'host':_0xe2ba('0x1c'),'port':0x18eb});var socket=require(_0xe2ba('0x1d'))(new Redis(config[_0xe2ba('0x1b')]));require(_0xe2ba('0x1e'))[_0xe2ba('0x1f')](socket);function respondWithStatusCode(_0x3a1bc0,_0x2ddc28){_0x2ddc28=_0x2ddc28||0xcc;return function(_0xf50867){if(_0xf50867){return _0x3a1bc0[_0xe2ba('0x20')](_0x2ddc28);}return _0x3a1bc0[_0xe2ba('0x21')](_0x2ddc28)['end']();};}function respondWithResult(_0x4c0007,_0x466c24){_0x466c24=_0x466c24||0xc8;return function(_0x56c8c3){if(_0x56c8c3){return _0x4c0007['status'](_0x466c24)[_0xe2ba('0x22')](_0x56c8c3);}};}function respondWithFilteredResult(_0x58177d,_0x13d53d){return function(_0x3df46d){if(_0x3df46d){var _0x1f46a8=typeof _0x13d53d[_0xe2ba('0x23')]==='undefined'&&typeof _0x13d53d['limit']===_0xe2ba('0x24');var _0x3db3d0=_0x3df46d[_0xe2ba('0x25')];var _0x480248=_0x1f46a8?0x0:_0x13d53d[_0xe2ba('0x23')];var _0x36ab05=_0x1f46a8?_0x3df46d[_0xe2ba('0x25')]:_0x13d53d[_0xe2ba('0x23')]+_0x13d53d[_0xe2ba('0x26')];var _0x3d5d64;if(_0x36ab05>=_0x3db3d0){_0x36ab05=_0x3db3d0;_0x3d5d64=0xc8;}else{_0x3d5d64=0xce;}_0x58177d[_0xe2ba('0x21')](_0x3d5d64);return _0x58177d['set']('Content-Range',_0x480248+'-'+_0x36ab05+'/'+_0x3db3d0)['json'](_0x3df46d);}return null;};}function patchUpdates(_0x5b47f9){return function(_0x181833){try{jsonpatch[_0xe2ba('0x27')](_0x181833,_0x5b47f9,!![]);}catch(_0xab2e55){return BPromise[_0xe2ba('0x28')](_0xab2e55);}return _0x181833[_0xe2ba('0x29')]();};}function saveUpdates(_0x202cb8,_0x4e6bc4){return function(_0x4cb845){if(_0x4cb845){return _0x4cb845[_0xe2ba('0x2a')](_0x202cb8)[_0xe2ba('0x2b')](function(_0x3bc464){return _0x3bc464;});}return null;};}function removeEntity(_0x3ba6d7,_0x1b718c){return function(_0x1e2682){if(_0x1e2682){return _0x1e2682['destroy']()['then'](function(){var _0x4afde9=_0x1e2682['get']({'plain':!![]});var _0x6c1b2=_0xe2ba('0x2c');return db[_0xe2ba('0x2d')][_0xe2ba('0x2e')]({'where':{'type':_0x6c1b2,'resourceId':_0x4afde9['id']}})[_0xe2ba('0x2b')](function(){return _0x1e2682;});})[_0xe2ba('0x2b')](function(){_0x3ba6d7['status'](0xcc)[_0xe2ba('0x2f')]();});}};}function handleEntityNotFound(_0xa0574,_0x4997cd){return function(_0x329333){if(!_0x329333){_0xa0574['sendStatus'](0x194);}return _0x329333;};}function handleError(_0xb7238e,_0x180d4b){_0x180d4b=_0x180d4b||0x1f4;return function(_0x24421e){logger[_0xe2ba('0x30')](_0x24421e[_0xe2ba('0x31')]);if(_0x24421e['name']){delete _0x24421e[_0xe2ba('0x32')];}_0xb7238e[_0xe2ba('0x21')](_0x180d4b)[_0xe2ba('0x33')](_0x24421e);};}exports[_0xe2ba('0x34')]=function(_0x5d2550,_0x224e3e){var _0x2498fd={},_0x5afb45={},_0x46fb29={'count':0x0,'rows':[]};var _0x19a8c7=_[_0xe2ba('0x35')](db['CmList'][_0xe2ba('0x36')],function(_0x405871){return{'name':_0x405871['fieldName'],'type':_0x405871[_0xe2ba('0x37')]['key']};});_0x5afb45[_0xe2ba('0x38')]=_[_0xe2ba('0x35')](_0x19a8c7,_0xe2ba('0x32'));_0x5afb45[_0xe2ba('0x39')]=_[_0xe2ba('0x3a')](_0x5d2550[_0xe2ba('0x39')]);_0x5afb45[_0xe2ba('0x3b')]=_[_0xe2ba('0x3c')](_0x5afb45[_0xe2ba('0x38')],_0x5afb45[_0xe2ba('0x39')]);_0x2498fd[_0xe2ba('0x3d')]=_[_0xe2ba('0x3c')](_0x5afb45[_0xe2ba('0x38')],qs[_0xe2ba('0x3e')](_0x5d2550[_0xe2ba('0x39')][_0xe2ba('0x3e')]));_0x2498fd[_0xe2ba('0x3d')]=_0x2498fd[_0xe2ba('0x3d')][_0xe2ba('0x3f')]?_0x2498fd[_0xe2ba('0x3d')]:_0x5afb45[_0xe2ba('0x38')];if(!_0x5d2550[_0xe2ba('0x39')]['hasOwnProperty'](_0xe2ba('0x40'))){_0x2498fd[_0xe2ba('0x26')]=qs['limit'](_0x5d2550[_0xe2ba('0x39')]['limit']);_0x2498fd['offset']=qs['offset'](_0x5d2550[_0xe2ba('0x39')][_0xe2ba('0x23')]);}_0x2498fd[_0xe2ba('0x41')]=qs[_0xe2ba('0x42')](_0x5d2550[_0xe2ba('0x39')][_0xe2ba('0x42')]);_0x2498fd[_0xe2ba('0x43')]=qs[_0xe2ba('0x3b')](_['pick'](_0x5d2550[_0xe2ba('0x39')],_0x5afb45[_0xe2ba('0x3b')]),_0x19a8c7);if(_0x5d2550[_0xe2ba('0x39')][_0xe2ba('0x44')]){_0x2498fd[_0xe2ba('0x43')]=_['merge'](_0x2498fd[_0xe2ba('0x43')],{'$or':_[_0xe2ba('0x35')](_0x19a8c7,function(_0x35d653){if(_0x35d653[_0xe2ba('0x37')]!==_0xe2ba('0x45')){var _0x2d812a={};_0x2d812a[_0x35d653[_0xe2ba('0x32')]]={'$like':'%'+_0x5d2550['query'][_0xe2ba('0x44')]+'%'};return _0x2d812a;}})});}_0x2498fd=_[_0xe2ba('0x46')]({},_0x2498fd,_0x5d2550[_0xe2ba('0x47')]);var _0x1a1848={'where':_0x2498fd[_0xe2ba('0x43')]};return db[_0xe2ba('0x48')][_0xe2ba('0x25')](_0x1a1848)[_0xe2ba('0x2b')](function(_0x2d5d62){_0x46fb29[_0xe2ba('0x25')]=_0x2d5d62;if(_0x5d2550[_0xe2ba('0x39')]['includeAll']){_0x2498fd['include']=[{'all':!![]}];}return db[_0xe2ba('0x48')][_0xe2ba('0x49')](_0x2498fd);})[_0xe2ba('0x2b')](function(_0x466ba2){_0x46fb29['rows']=_0x466ba2;return _0x46fb29;})[_0xe2ba('0x2b')](respondWithFilteredResult(_0x224e3e,_0x2498fd))[_0xe2ba('0x4a')](handleError(_0x224e3e,null));};exports['show']=function(_0x453210,_0x8b3a90){var _0xc4215={'raw':![],'where':{'id':_0x453210[_0xe2ba('0x4b')]['id']}},_0x18b5e7={};_0x18b5e7[_0xe2ba('0x38')]=_['keys'](db[_0xe2ba('0x48')][_0xe2ba('0x36')]);_0x18b5e7[_0xe2ba('0x39')]=_[_0xe2ba('0x3a')](_0x453210[_0xe2ba('0x39')]);_0x18b5e7[_0xe2ba('0x3b')]=_[_0xe2ba('0x3c')](_0x18b5e7['model'],_0x18b5e7[_0xe2ba('0x39')]);_0xc4215['attributes']=_['intersection'](_0x18b5e7['model'],qs['fields'](_0x453210[_0xe2ba('0x39')]['fields']));_0xc4215[_0xe2ba('0x3d')]=_0xc4215[_0xe2ba('0x3d')][_0xe2ba('0x3f')]?_0xc4215[_0xe2ba('0x3d')]:_0x18b5e7[_0xe2ba('0x38')];if(_0x453210[_0xe2ba('0x39')][_0xe2ba('0x4c')]){_0xc4215[_0xe2ba('0x4d')]=[{'all':!![]}];}_0xc4215=_[_0xe2ba('0x46')]({},_0xc4215,_0x453210[_0xe2ba('0x47')]);return db[_0xe2ba('0x48')][_0xe2ba('0x4e')](_0xc4215)['then'](handleEntityNotFound(_0x8b3a90,null))['then'](respondWithResult(_0x8b3a90,null))[_0xe2ba('0x4a')](handleError(_0x8b3a90,null));};exports[_0xe2ba('0x4f')]=function(_0x2286ef,_0x2f5be2){return db[_0xe2ba('0x48')]['create'](_0x2286ef['body'],{})[_0xe2ba('0x2b')](function(_0x11ab65){var _0x4458b2=_0x2286ef[_0xe2ba('0x50')][_0xe2ba('0x51')]({'plain':!![]});if(!_0x4458b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4458b2[_0xe2ba('0x52')]==='user'){var _0xc27ee5=_0x11ab65[_0xe2ba('0x51')]({'plain':!![]});var _0x11e42d=_0xe2ba('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x11e42d,'userProfileId':_0x4458b2[_0xe2ba('0x53')]},'raw':!![]})[_0xe2ba('0x2b')](function(_0x29fd43){if(_0x29fd43&&_0x29fd43['autoAssociation']===0x0){return db[_0xe2ba('0x2d')][_0xe2ba('0x4f')]({'name':_0xc27ee5['name'],'resourceId':_0xc27ee5['id'],'type':_0x29fd43[_0xe2ba('0x32')],'sectionId':_0x29fd43['id']},{})[_0xe2ba('0x2b')](function(){return _0x11ab65;});}else{return _0x11ab65;}})[_0xe2ba('0x4a')](function(_0x2dd382){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dd382);throw _0x2dd382;});}return _0x11ab65;})['then'](respondWithResult(_0x2f5be2,0xc9))['catch'](handleError(_0x2f5be2,null));};exports[_0xe2ba('0x2a')]=function(_0x5f58e9,_0x3fef84){if(_0x5f58e9[_0xe2ba('0x54')]['id']){delete _0x5f58e9[_0xe2ba('0x54')]['id'];}return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x5f58e9[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x3fef84,null))[_0xe2ba('0x2b')](saveUpdates(_0x5f58e9[_0xe2ba('0x54')],null))[_0xe2ba('0x2b')](respondWithResult(_0x3fef84,null))[_0xe2ba('0x4a')](handleError(_0x3fef84,null));};exports[_0xe2ba('0x2e')]=function(_0x2e6fc8,_0x16cb88){return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x2e6fc8[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x16cb88,null))[_0xe2ba('0x2b')](removeEntity(_0x16cb88,null))[_0xe2ba('0x4a')](handleError(_0x16cb88,null));};exports[_0xe2ba('0x55')]=function(_0x309ba8,_0x589c85){return db[_0xe2ba('0x48')][_0xe2ba('0x55')]()[_0xe2ba('0x2b')](respondWithResult(_0x589c85,null))[_0xe2ba('0x4a')](handleError(_0x589c85,null));};exports['addDisposition']=function(_0x39adbe,_0x210672,_0x4a2147){if(_0x39adbe[_0xe2ba('0x54')]['id']){delete _0x39adbe['body']['id'];}return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x39adbe[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x210672,null))[_0xe2ba('0x2b')](function(_0x2f3479){if(_0x2f3479){_0x39adbe[_0xe2ba('0x54')][_0xe2ba('0x56')]=_0x2f3479['id'];return db[_0xe2ba('0x57')][_0xe2ba('0x4f')](_0x39adbe['body']);}})['then'](respondWithResult(_0x210672,null))['catch'](handleError(_0x210672,null));};exports[_0xe2ba('0x58')]=function(_0x3989d5,_0x4c05fb,_0x1d607a){var _0x44c71f={'raw':![],'where':{}};var _0x269a7f={};var _0x5c4b7f={'count':0x0,'rows':[]};return db[_0xe2ba('0x48')][_0xe2ba('0x59')]({'where':{'id':_0x3989d5[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x4c05fb,null))[_0xe2ba('0x2b')](function(_0xd4fd2f){if(_0xd4fd2f){_0x269a7f[_0xe2ba('0x38')]=_[_0xe2ba('0x3a')](db[_0xe2ba('0x57')][_0xe2ba('0x36')]);_0x269a7f[_0xe2ba('0x39')]=_[_0xe2ba('0x3a')](_0x3989d5['query']);_0x269a7f[_0xe2ba('0x3b')]=_[_0xe2ba('0x3c')](_0x269a7f[_0xe2ba('0x38')],_0x269a7f[_0xe2ba('0x39')]);_0x44c71f['attributes']=_[_0xe2ba('0x3c')](_0x269a7f[_0xe2ba('0x38')],qs[_0xe2ba('0x3e')](_0x3989d5[_0xe2ba('0x39')]['fields']));_0x44c71f[_0xe2ba('0x3d')]=_0x44c71f['attributes'][_0xe2ba('0x3f')]?_0x44c71f[_0xe2ba('0x3d')]:_0x269a7f[_0xe2ba('0x38')];if(!_0x3989d5[_0xe2ba('0x39')][_0xe2ba('0x5a')](_0xe2ba('0x40'))){_0x44c71f['limit']=qs['limit'](_0x3989d5['query'][_0xe2ba('0x26')]);_0x44c71f[_0xe2ba('0x23')]=qs[_0xe2ba('0x23')](_0x3989d5[_0xe2ba('0x39')][_0xe2ba('0x23')]);}_0x44c71f[_0xe2ba('0x41')]=qs[_0xe2ba('0x42')](_0x3989d5[_0xe2ba('0x39')][_0xe2ba('0x42')]);_0x44c71f[_0xe2ba('0x43')]=qs['filters'](_['pick'](_0x3989d5[_0xe2ba('0x39')],_0x269a7f[_0xe2ba('0x3b')]));_0x44c71f[_0xe2ba('0x43')][_0xe2ba('0x56')]=_0xd4fd2f['id'];if(_0x3989d5[_0xe2ba('0x39')][_0xe2ba('0x44')]){_0x44c71f[_0xe2ba('0x43')]=_[_0xe2ba('0x46')](_0x44c71f[_0xe2ba('0x43')],{'$or':_[_0xe2ba('0x35')](_0x44c71f[_0xe2ba('0x3d')],function(_0xc0aa52){var _0x2e9697={};_0x2e9697[_0xc0aa52]={'$like':'%'+_0x3989d5['query']['filter']+'%'};return _0x2e9697;})});}_0x44c71f=_[_0xe2ba('0x46')]({},_0x44c71f,_0x3989d5[_0xe2ba('0x47')]);return db[_0xe2ba('0x57')][_0xe2ba('0x25')]({'where':_0x44c71f['where']})[_0xe2ba('0x2b')](function(_0x2bf8d6){_0x5c4b7f[_0xe2ba('0x25')]=_0x2bf8d6;if(_0x3989d5[_0xe2ba('0x39')][_0xe2ba('0x4c')]){_0x44c71f['include']=[{'all':!![]}];}return db[_0xe2ba('0x57')][_0xe2ba('0x49')](_0x44c71f);})[_0xe2ba('0x2b')](function(_0x302e1d){_0x5c4b7f['rows']=_0x302e1d;return _0x5c4b7f;});}})[_0xe2ba('0x2b')](respondWithFilteredResult(_0x4c05fb,_0x44c71f))[_0xe2ba('0x4a')](handleError(_0x4c05fb,null));};exports[_0xe2ba('0x5b')]=function(_0x160d27,_0x35efe2,_0x5dbf8b){return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x160d27[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x35efe2,null))[_0xe2ba('0x2b')](function(_0x7dc3f6){if(_0x7dc3f6){return _0x7dc3f6[_0xe2ba('0x5b')](_0x160d27[_0xe2ba('0x39')][_0xe2ba('0x5c')]);}})['then'](respondWithStatusCode(_0x35efe2,null))[_0xe2ba('0x4a')](handleError(_0x35efe2,null));};exports[_0xe2ba('0x5d')]=function(_0xc5a484,_0xc59e6,_0x34eb32){return db[_0xe2ba('0x48')]['find']({'where':{'id':_0xc5a484[_0xe2ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0xc59e6,null))[_0xe2ba('0x2b')](function(_0x33bcbb){if(_0x33bcbb){var _0x3a920e=[];var _0x58761d={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xe2ba('0x2b')](function(_0x333622){if(_0xc5a484['body'][_0xe2ba('0x5e')]&&_[_0xe2ba('0x5f')](_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x5e')])){if(_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x5e')]['length']){_0xc5a484[_0xe2ba('0x54')]['tags']=_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x5e')][_0xe2ba('0x60')](';')+';';}else{_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x5e')]=null;}}else{_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x5e')]=null;}if(_0xc5a484[_0xe2ba('0x54')]&&_[_0xe2ba('0x5f')](_0xc5a484[_0xe2ba('0x54')])){for(var _0x301bc8=0x0;_0x301bc8<_0xc5a484[_0xe2ba('0x54')][_0xe2ba('0x3f')];_0x301bc8+=0x1){_0xc5a484[_0xe2ba('0x54')][_0x301bc8][_0xe2ba('0x56')]=_0xc5a484['params']['id'];_0x3a920e[_0xe2ba('0x61')](_0xc5a484['body'][_0x301bc8]);}return BPromise['each'](_0x3a920e,function(_0x39960){return db[_0xe2ba('0x62')][_0xe2ba('0x4f')](_[_0xe2ba('0x63')](_0x39960,[_0xe2ba('0x5c'),'id'])||{},{'fields':_[_0xe2ba('0x3a')](_0x333622),'raw':!![]})[_0xe2ba('0x2b')](function(_0x27be96){_0x58761d[_0xe2ba('0x64')]['push'](_0x27be96['dataValues']);})[_0xe2ba('0x4a')](function(_0x4a695d){_0x58761d[_0xe2ba('0x65')][_0xe2ba('0x61')]({'data':_0x39960,'error':_0x4a695d[_0xe2ba('0x66')]});});})[_0xe2ba('0x2b')](function(_0x1bf62f){return _0x58761d;})[_0xe2ba('0x4a')](function(_0xec6e1d){return _0xec6e1d;});}else{_0xc59e6[_0xe2ba('0x21')](0x190)[_0xe2ba('0x22')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xe2ba('0x2b')](respondWithResult(_0xc59e6,null))[_0xe2ba('0x4a')](handleError(_0xc59e6,null));};exports[_0xe2ba('0x67')]=function(_0x1bc1ab,_0x491137,_0xc21448){var _0x57644f;return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x1bc1ab['params']['id']},'include':[{'model':db[_0xe2ba('0x68')],'as':_0xe2ba('0x69')}]})[_0xe2ba('0x2b')](handleEntityNotFound(_0x491137,null))[_0xe2ba('0x2b')](function(_0x193377){if(_0x193377){_0x57644f=_0x193377;return db[_0xe2ba('0x62')][_0xe2ba('0x36')];}})[_0xe2ba('0x2b')](function(_0x444d29){if(_0x444d29){var _0x54ecc1={};var _0x1a0b7d={};_0x1a0b7d[_0xe2ba('0x38')]=_['concat'](_[_0xe2ba('0x3a')](_0x444d29),_[_0xe2ba('0x35')](_0x57644f['CustomFields'],function(_0x11a7a5){return util['format'](_0xe2ba('0x6a'),_0x11a7a5['id']);}));_0x1a0b7d['query']=_['keys'](_0x1bc1ab['query']);_0x1a0b7d['filters']=_['intersection'](_0x1a0b7d[_0xe2ba('0x38')],_0x1a0b7d[_0xe2ba('0x39')]);_0x54ecc1[_0xe2ba('0x3d')]=_[_0xe2ba('0x3c')](_0x1a0b7d[_0xe2ba('0x38')],qs[_0xe2ba('0x3e')](_0x1bc1ab[_0xe2ba('0x39')]['fields']));_0x54ecc1[_0xe2ba('0x3d')]=_0x54ecc1[_0xe2ba('0x3d')][_0xe2ba('0x3f')]?_0x54ecc1[_0xe2ba('0x3d')]:_0x1a0b7d[_0xe2ba('0x38')];if(!_0x1bc1ab[_0xe2ba('0x39')][_0xe2ba('0x5a')](_0xe2ba('0x40'))){_0x54ecc1['limit']=qs[_0xe2ba('0x26')](_0x1bc1ab['query'][_0xe2ba('0x26')]);_0x54ecc1[_0xe2ba('0x23')]=qs[_0xe2ba('0x23')](_0x1bc1ab[_0xe2ba('0x39')]['offset']);}_0x54ecc1[_0xe2ba('0x41')]=qs[_0xe2ba('0x42')](_0x1bc1ab[_0xe2ba('0x39')][_0xe2ba('0x42')]);_0x54ecc1[_0xe2ba('0x43')]=qs[_0xe2ba('0x3b')](_[_0xe2ba('0x6b')](_0x1bc1ab[_0xe2ba('0x39')],_0x1a0b7d['filters']));_0x54ecc1[_0xe2ba('0x6c')]=!![];if(_0x1bc1ab[_0xe2ba('0x39')][_0xe2ba('0x44')]){_0x54ecc1[_0xe2ba('0x43')]=_[_0xe2ba('0x46')](_0x54ecc1[_0xe2ba('0x43')],{'$or':_[_0xe2ba('0x35')](_0x54ecc1[_0xe2ba('0x3d')],function(_0x43f6b7){var _0x34f5b3={};_0x34f5b3[_0x43f6b7]={'$like':'%'+_0x1bc1ab['query'][_0xe2ba('0x44')]+'%'};return _0x34f5b3;})});}_0x54ecc1=_[_0xe2ba('0x46')]({},_0x54ecc1,_0x1bc1ab[_0xe2ba('0x47')]);return _0x57644f['getContacts'](_0x54ecc1);}})['then'](respondWithResult(_0x491137,null))['catch'](handleError(_0x491137,null));};exports[_0xe2ba('0x6d')]=function(_0x5e3a63,_0x3dc8de,_0x2263d1){var _0x301149;var _0x380a25;var _0x2e4067;var _0x4987c9=_0x5e3a63[_0xe2ba('0x4b')]['id'];csv_results=[];return db[_0xe2ba('0x6e')][_0xe2ba('0x49')]({'attributes':['id',_0xe2ba('0x32')],'raw':!![],'order':[_0xe2ba('0x6f')]})[_0xe2ba('0x2b')](function(_0xf35445){_0x301149=_0xf35445;var _0x1a066b=_[_0xe2ba('0x3a')](db[_0xe2ba('0x62')][_0xe2ba('0x36')]);return db[_0xe2ba('0x68')]['findAll']({'raw':!![],'attributes':['id',_0xe2ba('0x70')]})[_0xe2ba('0x2b')](function(_0x4e3b95){_0x380a25=_0x4e3b95;var _0x2321f6=squel[_0xe2ba('0x71')]()['fields'](_0x1a066b)['from'](_0xe2ba('0x72'),'c')[_0xe2ba('0x43')]('c.ListId\x20=\x20?',_0x4987c9)[_0xe2ba('0x43')](_0xe2ba('0x73'))[_0xe2ba('0x74')]();for(var _0x31999b=0x0;_0x31999b<_0x380a25[_0xe2ba('0x3f')];_0x31999b++){_0x2321f6[_0xe2ba('0x75')](_0xe2ba('0x76')+_0x380a25[_0x31999b]['id'],_0xe2ba('0x77')+_0x380a25[_0x31999b][_0xe2ba('0x70')]);}for(var _0x31999b=0x0;_0x31999b<_0x301149[_0xe2ba('0x3f')];_0x31999b++){_0x2321f6[_0xe2ba('0x75')](squel['select']()[_0xe2ba('0x75')](_0xe2ba('0x78'))[_0xe2ba('0x79')](_0xe2ba('0x7a'))[_0xe2ba('0x43')](_0xe2ba('0x7b'),_0x301149[_0x31999b]['id'])[_0xe2ba('0x43')](_0xe2ba('0x7c')),_0xe2ba('0x7d')+_0x301149[_0x31999b][_0xe2ba('0x32')]);_0x2321f6[_0xe2ba('0x75')](squel[_0xe2ba('0x71')]()[_0xe2ba('0x75')]('description')[_0xe2ba('0x79')](_0xe2ba('0x7a'))[_0xe2ba('0x43')](_0xe2ba('0x7b'),_0x301149[_0x31999b]['id'])[_0xe2ba('0x43')](_0xe2ba('0x7c')),_0xe2ba('0x7e')+_0x301149[_0x31999b][_0xe2ba('0x32')]);}var _0x39870d=[];_0x39870d[_0xe2ba('0x61')](_0x2321f6[_0xe2ba('0x7f')]());BPromise['each'](_0x39870d,handleQuery)[_0xe2ba('0x2b')](function(_0x1f503d){handleQuery(_0x2321f6[_0xe2ba('0x7f')]());var _0x3bc972=csv_results[0x0];if(!_[_0xe2ba('0x80')](_0x3bc972)){var _0x2b1ed9=toCsv(_0x3bc972);var _0x42767a=Date[_0xe2ba('0x81')]();fs['writeFileSync'](util[_0xe2ba('0x82')](_0xe2ba('0x83'),_0x4987c9,_0x42767a),_0x2b1ed9);_0x3dc8de[_0xe2ba('0x84')](_0xe2ba('0x85'),_0xe2ba('0x86')+util[_0xe2ba('0x82')]('list_%d_%s.csv',_0x4987c9,_0x42767a));_0x3dc8de[_0xe2ba('0x84')](_0xe2ba('0x87'),'text/csv');return _0x3dc8de[_0xe2ba('0x88')](util[_0xe2ba('0x82')]('/tmp/list_%d_%s.csv',_0x4987c9,_0x42767a));}else{return _0x3dc8de[_0xe2ba('0x20')](0xcc);}});});});};exports[_0xe2ba('0x89')]=function(_0x560b78,_0x20b68f,_0x3f5110){var _0x52ae75;delete _0x560b78[_0xe2ba('0x54')]['id'];return db['CmList'][_0xe2ba('0x59')]({'where':{'id':_0x560b78[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x20b68f,null))['then'](function(_0x5b2a1a){if(_0x5b2a1a){return db[_0xe2ba('0x8a')][_0xe2ba('0x8b')](function(_0x232839){return db[_0xe2ba('0x68')][_0xe2ba('0x4f')](_0x560b78['body'],{'transaction':_0x232839})[_0xe2ba('0x2b')](function(_0x3eecfc){_0x52ae75=_0x3eecfc;return _0x5b2a1a[_0xe2ba('0x8c')](_0x3eecfc,{'transaction':_0x232839});})[_0xe2ba('0x2b')](function(){var _0x5c45a7={'type':db[_0xe2ba('0x8d')][_0xe2ba('0x8e')],'transaction':_0x232839};switch(_0x560b78[_0xe2ba('0x54')]['type']){case _0xe2ba('0x8f'):_0x5c45a7['type']=db['Sequelize']['TEXT'];break;case _0xe2ba('0x90'):_0x5c45a7[_0xe2ba('0x37')]=db[_0xe2ba('0x8d')][_0xe2ba('0x91')];break;case'switch':_0x5c45a7[_0xe2ba('0x37')]=db['Sequelize'][_0xe2ba('0x92')];_0x5c45a7[_0xe2ba('0x93')]=![];break;default:}return db[_0xe2ba('0x8a')]['queryInterface']['addColumn']('cm_contacts',util[_0xe2ba('0x82')](_0xe2ba('0x94'),_0x52ae75['id']),_0x5c45a7);})[_0xe2ba('0x2b')](function(){return _0x52ae75;});});}})[_0xe2ba('0x2b')](respondWithResult(_0x20b68f,null))[_0xe2ba('0x4a')](handleError(_0x20b68f,null));};exports[_0xe2ba('0x95')]=function(_0x5a3ad3,_0x161a03,_0x3f35e2){var _0xff5e71={};var _0x552aeb={};var _0x168bdd;var _0x616e6b;return db[_0xe2ba('0x48')][_0xe2ba('0x59')]({'where':{'id':_0x5a3ad3[_0xe2ba('0x4b')]['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x161a03,null))[_0xe2ba('0x2b')](function(_0x2c4eee){if(_0x2c4eee){_0x168bdd=_0x2c4eee;_0x552aeb[_0xe2ba('0x38')]=_['keys'](db[_0xe2ba('0x68')][_0xe2ba('0x36')]);_0x552aeb[_0xe2ba('0x39')]=_[_0xe2ba('0x3a')](_0x5a3ad3[_0xe2ba('0x39')]);_0x552aeb['filters']=_[_0xe2ba('0x3c')](_0x552aeb[_0xe2ba('0x38')],_0x552aeb[_0xe2ba('0x39')]);_0xff5e71[_0xe2ba('0x3d')]=_[_0xe2ba('0x3c')](_0x552aeb[_0xe2ba('0x38')],qs[_0xe2ba('0x3e')](_0x5a3ad3[_0xe2ba('0x39')]['fields']));_0xff5e71[_0xe2ba('0x3d')]=_0xff5e71[_0xe2ba('0x3d')]['length']?_0xff5e71[_0xe2ba('0x3d')]:_0x552aeb[_0xe2ba('0x38')];_0xff5e71[_0xe2ba('0x41')]=qs[_0xe2ba('0x42')](_0x5a3ad3[_0xe2ba('0x39')][_0xe2ba('0x42')]);_0xff5e71[_0xe2ba('0x43')]=qs[_0xe2ba('0x3b')](_['pick'](_0x5a3ad3[_0xe2ba('0x39')],_0x552aeb[_0xe2ba('0x3b')]));_0xff5e71['where']=_['merge'](_0xff5e71[_0xe2ba('0x43')],{'$or':[{'ListId':_0x2c4eee['id']},{'ListId':null}]});if(_0x5a3ad3[_0xe2ba('0x39')]['filter']){_0xff5e71[_0xe2ba('0x43')]=_[_0xe2ba('0x46')](_0xff5e71['where'],{'$or':_[_0xe2ba('0x35')](_0xff5e71['attributes'],function(_0x21af3c){var _0xc82762={};_0xc82762[_0x21af3c]={'$like':'%'+_0x5a3ad3[_0xe2ba('0x39')][_0xe2ba('0x44')]+'%'};return _0xc82762;})});}_0xff5e71=_[_0xe2ba('0x46')]({},_0xff5e71,_0x5a3ad3[_0xe2ba('0x47')]);return db[_0xe2ba('0x68')][_0xe2ba('0x96')](_0xff5e71);}})[_0xe2ba('0x2b')](respondWithResult(_0x161a03,null))[_0xe2ba('0x4a')](handleError(_0x161a03,null));};exports[_0xe2ba('0x97')]=function(_0x317272,_0x534237){return db['CmCustomField'][_0xe2ba('0x96')]({'where':{'ListId':null}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x534237,null))['then'](function(_0x255200){return _0x255200;})['then'](respondWithResult(_0x534237,null))['catch'](handleError(_0x534237,null));};exports[_0xe2ba('0x98')]=function(_0x76b6d9,_0xcdd61e,_0x57d5e0){return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x76b6d9[_0xe2ba('0x4b')]['id']}})['then'](handleEntityNotFound(_0xcdd61e,null))['then'](function(_0xdd396a){if(_0xdd396a){return _0xdd396a[_0xe2ba('0x98')](_0x76b6d9[_0xe2ba('0x54')][_0xe2ba('0x5c')],_[_0xe2ba('0x63')](_0x76b6d9[_0xe2ba('0x54')],[_0xe2ba('0x5c'),'id'])||{})[_0xe2ba('0x99')](function(_0x2f165f){for(var _0x3503e6=0x0;_0x3503e6<_0x76b6d9[_0xe2ba('0x54')][_0xe2ba('0x5c')][_0xe2ba('0x3f')];_0x3503e6+=0x1){socket[_0xe2ba('0x9a')]('userCmList:save',{'UserId':Number(_0x76b6d9[_0xe2ba('0x54')][_0xe2ba('0x5c')][_0x3503e6]),'CmListId':Number(_0x76b6d9[_0xe2ba('0x4b')]['id'])});}return _0x2f165f;});}})[_0xe2ba('0x2b')](respondWithResult(_0xcdd61e,null))[_0xe2ba('0x4a')](handleError(_0xcdd61e,null));};exports[_0xe2ba('0x9b')]=function(_0x350222,_0x4d41aa,_0x2039b4){return db[_0xe2ba('0x48')][_0xe2ba('0x4e')]({'where':{'id':_0x350222['params']['id']}})[_0xe2ba('0x2b')](handleEntityNotFound(_0x4d41aa,null))['then'](function(_0x1a17c7){if(_0x1a17c7){return _0x1a17c7[_0xe2ba('0x9b')](_0x350222[_0xe2ba('0x39')]['ids'])['then'](function(){if(_[_0xe2ba('0x5f')](_0x350222[_0xe2ba('0x39')][_0xe2ba('0x5c')])){for(var _0x48763e=0x0;_0x48763e<_0x350222[_0xe2ba('0x39')]['ids'][_0xe2ba('0x3f')];_0x48763e+=0x1){socket[_0xe2ba('0x9a')](_0xe2ba('0x9c'),{'UserId':Number(_0x350222[_0xe2ba('0x39')][_0xe2ba('0x5c')][_0x48763e]),'CmListId':Number(_0x350222[_0xe2ba('0x4b')]['id'])});}}else{socket[_0xe2ba('0x9a')]('userCmList:remove',{'UserId':Number(_0x350222[_0xe2ba('0x39')][_0xe2ba('0x5c')]),'CmListId':Number(_0x350222[_0xe2ba('0x4b')]['id'])});}});}})[_0xe2ba('0x2b')](respondWithStatusCode(_0x4d41aa,null))[_0xe2ba('0x4a')](handleError(_0x4d41aa,null));};exports[_0xe2ba('0x9d')]=function(_0x30e019,_0x1877eb,_0x115c42){var _0x522e35={};var _0x22200a={};var _0x1e6de0;var _0x435e54;return db[_0xe2ba('0x48')][_0xe2ba('0x59')]({'where':{'id':_0x30e019['params']['id']}})['then'](handleEntityNotFound(_0x1877eb,null))['then'](function(_0x288c65){if(_0x288c65){_0x1e6de0=_0x288c65;_0x22200a[_0xe2ba('0x38')]=_[_0xe2ba('0x3a')](db[_0xe2ba('0x9e')][_0xe2ba('0x36')]);_0x22200a[_0xe2ba('0x39')]=_[_0xe2ba('0x3a')](_0x30e019[_0xe2ba('0x39')]);_0x22200a[_0xe2ba('0x3b')]=_[_0xe2ba('0x3c')](_0x22200a[_0xe2ba('0x38')],_0x22200a[_0xe2ba('0x39')]);_0x522e35[_0xe2ba('0x3d')]=_[_0xe2ba('0x3c')](_0x22200a[_0xe2ba('0x38')],qs[_0xe2ba('0x3e')](_0x30e019[_0xe2ba('0x39')][_0xe2ba('0x3e')]));_0x522e35['attributes']=_0x522e35[_0xe2ba('0x3d')]['length']?_0x522e35[_0xe2ba('0x3d')]:_0x22200a[_0xe2ba('0x38')];_0x522e35[_0xe2ba('0x41')]=qs[_0xe2ba('0x42')](_0x30e019[_0xe2ba('0x39')]['sort']);_0x522e35['where']=qs[_0xe2ba('0x3b')](_[_0xe2ba('0x6b')](_0x30e019['query'],_0x22200a[_0xe2ba('0x3b')]));if(_0x30e019[_0xe2ba('0x39')][_0xe2ba('0x44')]){_0x522e35[_0xe2ba('0x43')]=_[_0xe2ba('0x46')](_0x522e35['where'],{'$or':_[_0xe2ba('0x35')](_0x522e35['attributes'],function(_0xef6b8c){var _0x2cd150={};_0x2cd150[_0xef6b8c]={'$like':'%'+_0x30e019[_0xe2ba('0x39')][_0xe2ba('0x44')]+'%'};return _0x2cd150;})});}_0x522e35=_[_0xe2ba('0x46')]({},_0x522e35,_0x30e019[_0xe2ba('0x47')]);return _0x1e6de0['getAgents'](_0x522e35);}})[_0xe2ba('0x2b')](function(_0x2755e0){if(_0x2755e0){_0x435e54=_0x2755e0[_0xe2ba('0x3f')];if(!_0x30e019[_0xe2ba('0x39')][_0xe2ba('0x5a')](_0xe2ba('0x40'))){_0x522e35[_0xe2ba('0x26')]=qs[_0xe2ba('0x26')](_0x30e019['query'][_0xe2ba('0x26')]);_0x522e35[_0xe2ba('0x23')]=qs[_0xe2ba('0x23')](_0x30e019[_0xe2ba('0x39')]['offset']);}return _0x1e6de0[_0xe2ba('0x9d')](_0x522e35);}})[_0xe2ba('0x2b')](function(_0x1f98a7){if(_0x1f98a7){return _0x1f98a7?{'count':_0x435e54,'rows':_0x1f98a7}:null;}})[_0xe2ba('0x2b')](respondWithResult(_0x1877eb,null))[_0xe2ba('0x4a')](handleError(_0x1877eb,null));};function handleQuery(_0x16fb11){logger['info'](_0x16fb11);return db[_0xe2ba('0x8a')]['query'](_0x16fb11)[_0xe2ba('0x99')](function(_0x18ed4e){csv_results[_0xe2ba('0x61')](_0x18ed4e);})[_0xe2ba('0x4a')](function(_0x37e39b){logger[_0xe2ba('0x30')](_0x37e39b[_0xe2ba('0x66')]);});} \ No newline at end of file +var _0x5ab6=['then','Lists','error','name','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','Disposition','getDispositions','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','findOne','User','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy'];(function(_0x15153c,_0x1a526b){var _0x5122b8=function(_0x5218db){while(--_0x5218db){_0x15153c['push'](_0x15153c['shift']());}};_0x5122b8(++_0x1a526b);}(_0x5ab6,0x1b6));var _0x65ab=function(_0x206e23,_0x3b950e){_0x206e23=_0x206e23-0x0;var _0x33e9b0=_0x5ab6[_0x206e23];return _0x33e9b0;};'use strict';var emlformat=require(_0x65ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65ab('0x1'));var jsonpatch=require(_0x65ab('0x2'));var rp=require(_0x65ab('0x3'));var moment=require(_0x65ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65ab('0x5'));var util=require(_0x65ab('0x6'));var path=require(_0x65ab('0x7'));var sox=require(_0x65ab('0x8'));var csv=require(_0x65ab('0x9'));var ejs=require(_0x65ab('0xa'));var fs=require('fs');var fs_extra=require(_0x65ab('0xb'));var _=require(_0x65ab('0xc'));var squel=require(_0x65ab('0xd'));var crypto=require(_0x65ab('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x65ab('0xf'));var toCsv=require(_0x65ab('0x9'));var querystring=require(_0x65ab('0x10'));var Papa=require(_0x65ab('0x11'));var Redis=require('ioredis');var authService=require(_0x65ab('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x65ab('0x13'))(_0x65ab('0x14'));var utils=require(_0x65ab('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x65ab('0x16'));var db=require(_0x65ab('0x17'))['db'];var csv_results;config['redis']=_[_0x65ab('0x18')](config[_0x65ab('0x19')],{'host':_0x65ab('0x1a'),'port':0x18eb});var socket=require(_0x65ab('0x1b'))(new Redis(config[_0x65ab('0x19')]));require('./cmList.socket')[_0x65ab('0x1c')](socket);function respondWithStatusCode(_0x5b2063,_0x3213a6){_0x3213a6=_0x3213a6||0xcc;return function(_0x3e7c6a){if(_0x3e7c6a){return _0x5b2063[_0x65ab('0x1d')](_0x3213a6);}return _0x5b2063[_0x65ab('0x1e')](_0x3213a6)[_0x65ab('0x1f')]();};}function respondWithResult(_0xafefb4,_0x4238fd){_0x4238fd=_0x4238fd||0xc8;return function(_0x2eae1d){if(_0x2eae1d){return _0xafefb4['status'](_0x4238fd)[_0x65ab('0x20')](_0x2eae1d);}};}function respondWithFilteredResult(_0x43cc74,_0x44f1b2){return function(_0x3d1690){if(_0x3d1690){var _0x42f949=typeof _0x44f1b2[_0x65ab('0x21')]===_0x65ab('0x22')&&typeof _0x44f1b2['limit']===_0x65ab('0x22');var _0x3f8298=_0x3d1690['count'];var _0x174b22=_0x42f949?0x0:_0x44f1b2['offset'];var _0x5d37dd=_0x42f949?_0x3d1690[_0x65ab('0x23')]:_0x44f1b2[_0x65ab('0x21')]+_0x44f1b2[_0x65ab('0x24')];var _0x2d1fc7;if(_0x5d37dd>=_0x3f8298){_0x5d37dd=_0x3f8298;_0x2d1fc7=0xc8;}else{_0x2d1fc7=0xce;}_0x43cc74[_0x65ab('0x1e')](_0x2d1fc7);return _0x43cc74[_0x65ab('0x25')]('Content-Range',_0x174b22+'-'+_0x5d37dd+'/'+_0x3f8298)[_0x65ab('0x20')](_0x3d1690);}return null;};}function patchUpdates(_0x379835){return function(_0x3c759c){try{jsonpatch['apply'](_0x3c759c,_0x379835,!![]);}catch(_0x455ae0){return BPromise[_0x65ab('0x26')](_0x455ae0);}return _0x3c759c[_0x65ab('0x27')]();};}function saveUpdates(_0x5e4e09,_0x31b95f){return function(_0x3e2fd4){if(_0x3e2fd4){return _0x3e2fd4[_0x65ab('0x28')](_0x5e4e09)['then'](function(_0x4d368e){return _0x4d368e;});}return null;};}function removeEntity(_0x2f26cf,_0x12e699){return function(_0x4e1bf2){if(_0x4e1bf2){return _0x4e1bf2[_0x65ab('0x29')]()[_0x65ab('0x2a')](function(){var _0x3c7145=_0x4e1bf2['get']({'plain':!![]});var _0x2dc535=_0x65ab('0x2b');return db['UserProfileResource'][_0x65ab('0x29')]({'where':{'type':_0x2dc535,'resourceId':_0x3c7145['id']}})[_0x65ab('0x2a')](function(){return _0x4e1bf2;});})['then'](function(){_0x2f26cf[_0x65ab('0x1e')](0xcc)[_0x65ab('0x1f')]();});}};}function handleEntityNotFound(_0x563abb,_0xc1ad9d){return function(_0x4c27f2){if(!_0x4c27f2){_0x563abb[_0x65ab('0x1d')](0x194);}return _0x4c27f2;};}function handleError(_0x3ba835,_0x32ebd4){_0x32ebd4=_0x32ebd4||0x1f4;return function(_0x217b11){logger[_0x65ab('0x2c')](_0x217b11['stack']);if(_0x217b11[_0x65ab('0x2d')]){delete _0x217b11[_0x65ab('0x2d')];}_0x3ba835[_0x65ab('0x1e')](_0x32ebd4)['send'](_0x217b11);};}exports[_0x65ab('0x2e')]=function(_0x4d8707,_0x12eaee){var _0x12d7d6={},_0x1d7036={},_0x25e23d={'count':0x0,'rows':[]};var _0x37aa4d=_[_0x65ab('0x2f')](db[_0x65ab('0x30')][_0x65ab('0x31')],function(_0x2629d8){return{'name':_0x2629d8[_0x65ab('0x32')],'type':_0x2629d8[_0x65ab('0x33')][_0x65ab('0x34')]};});_0x1d7036[_0x65ab('0x35')]=_[_0x65ab('0x2f')](_0x37aa4d,_0x65ab('0x2d'));_0x1d7036['query']=_[_0x65ab('0x36')](_0x4d8707[_0x65ab('0x37')]);_0x1d7036[_0x65ab('0x38')]=_[_0x65ab('0x39')](_0x1d7036[_0x65ab('0x35')],_0x1d7036['query']);_0x12d7d6[_0x65ab('0x3a')]=_[_0x65ab('0x39')](_0x1d7036['model'],qs['fields'](_0x4d8707[_0x65ab('0x37')][_0x65ab('0x3b')]));_0x12d7d6[_0x65ab('0x3a')]=_0x12d7d6['attributes'][_0x65ab('0x3c')]?_0x12d7d6[_0x65ab('0x3a')]:_0x1d7036[_0x65ab('0x35')];if(!_0x4d8707[_0x65ab('0x37')][_0x65ab('0x3d')](_0x65ab('0x3e'))){_0x12d7d6[_0x65ab('0x24')]=qs[_0x65ab('0x24')](_0x4d8707[_0x65ab('0x37')][_0x65ab('0x24')]);_0x12d7d6[_0x65ab('0x21')]=qs['offset'](_0x4d8707[_0x65ab('0x37')]['offset']);}_0x12d7d6[_0x65ab('0x3f')]=qs[_0x65ab('0x40')](_0x4d8707['query'][_0x65ab('0x40')]);_0x12d7d6[_0x65ab('0x41')]=qs[_0x65ab('0x38')](_[_0x65ab('0x42')](_0x4d8707['query'],_0x1d7036[_0x65ab('0x38')]),_0x37aa4d);if(_0x4d8707[_0x65ab('0x37')]['filter']){_0x12d7d6[_0x65ab('0x41')]=_[_0x65ab('0x43')](_0x12d7d6[_0x65ab('0x41')],{'$or':_[_0x65ab('0x2f')](_0x37aa4d,function(_0x2947ea){if(_0x2947ea[_0x65ab('0x33')]!==_0x65ab('0x44')){var _0x36c0c1={};_0x36c0c1[_0x2947ea[_0x65ab('0x2d')]]={'$like':'%'+_0x4d8707[_0x65ab('0x37')][_0x65ab('0x45')]+'%'};return _0x36c0c1;}})});}_0x12d7d6=_[_0x65ab('0x43')]({},_0x12d7d6,_0x4d8707['options']);var _0x6caddc={'where':_0x12d7d6[_0x65ab('0x41')]};return db[_0x65ab('0x30')]['count'](_0x6caddc)[_0x65ab('0x2a')](function(_0x3e0b80){_0x25e23d[_0x65ab('0x23')]=_0x3e0b80;if(_0x4d8707[_0x65ab('0x37')][_0x65ab('0x46')]){_0x12d7d6[_0x65ab('0x47')]=[{'all':!![]}];}return db['CmList'][_0x65ab('0x48')](_0x12d7d6);})[_0x65ab('0x2a')](function(_0x33bd4c){_0x25e23d[_0x65ab('0x49')]=_0x33bd4c;return _0x25e23d;})[_0x65ab('0x2a')](respondWithFilteredResult(_0x12eaee,_0x12d7d6))[_0x65ab('0x4a')](handleError(_0x12eaee,null));};exports['show']=function(_0x217974,_0x17c3c6){var _0x1fa45c={'raw':![],'where':{'id':_0x217974[_0x65ab('0x4b')]['id']}},_0x59adc8={};_0x59adc8[_0x65ab('0x35')]=_[_0x65ab('0x36')](db[_0x65ab('0x30')][_0x65ab('0x31')]);_0x59adc8[_0x65ab('0x37')]=_[_0x65ab('0x36')](_0x217974['query']);_0x59adc8[_0x65ab('0x38')]=_[_0x65ab('0x39')](_0x59adc8[_0x65ab('0x35')],_0x59adc8[_0x65ab('0x37')]);_0x1fa45c['attributes']=_[_0x65ab('0x39')](_0x59adc8[_0x65ab('0x35')],qs['fields'](_0x217974[_0x65ab('0x37')][_0x65ab('0x3b')]));_0x1fa45c[_0x65ab('0x3a')]=_0x1fa45c[_0x65ab('0x3a')][_0x65ab('0x3c')]?_0x1fa45c[_0x65ab('0x3a')]:_0x59adc8[_0x65ab('0x35')];if(_0x217974['query'][_0x65ab('0x46')]){_0x1fa45c[_0x65ab('0x47')]=[{'all':!![]}];}_0x1fa45c=_[_0x65ab('0x43')]({},_0x1fa45c,_0x217974[_0x65ab('0x4c')]);return db['CmList']['find'](_0x1fa45c)[_0x65ab('0x2a')](handleEntityNotFound(_0x17c3c6,null))[_0x65ab('0x2a')](respondWithResult(_0x17c3c6,null))[_0x65ab('0x4a')](handleError(_0x17c3c6,null));};exports['create']=function(_0x5381ea,_0x575610){return db[_0x65ab('0x30')][_0x65ab('0x4d')](_0x5381ea['body'],{})['then'](function(_0x446736){var _0xab7018=_0x5381ea[_0x65ab('0x4e')][_0x65ab('0x4f')]({'plain':!![]});if(!_0xab7018)throw new Error(_0x65ab('0x50'));if(_0xab7018[_0x65ab('0x51')]===_0x65ab('0x4e')){var _0x168663=_0x446736[_0x65ab('0x4f')]({'plain':!![]});var _0x123fa4='Lists';return db[_0x65ab('0x52')]['find']({'where':{'name':_0x123fa4,'userProfileId':_0xab7018[_0x65ab('0x53')]},'raw':!![]})[_0x65ab('0x2a')](function(_0x44e6f5){if(_0x44e6f5&&_0x44e6f5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x168663[_0x65ab('0x2d')],'resourceId':_0x168663['id'],'type':_0x44e6f5['name'],'sectionId':_0x44e6f5['id']},{})['then'](function(){return _0x446736;});}else{return _0x446736;}})['catch'](function(_0x568af6){logger[_0x65ab('0x2c')](_0x65ab('0x54'),_0x568af6);throw _0x568af6;});}return _0x446736;})[_0x65ab('0x2a')](respondWithResult(_0x575610,0xc9))['catch'](handleError(_0x575610,null));};exports[_0x65ab('0x28')]=function(_0xdbb972,_0x3dbcde){if(_0xdbb972[_0x65ab('0x55')]['id']){delete _0xdbb972['body']['id'];}return db[_0x65ab('0x30')]['find']({'where':{'id':_0xdbb972[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x3dbcde,null))['then'](saveUpdates(_0xdbb972[_0x65ab('0x55')],null))[_0x65ab('0x2a')](respondWithResult(_0x3dbcde,null))[_0x65ab('0x4a')](handleError(_0x3dbcde,null));};exports[_0x65ab('0x29')]=function(_0x26c528,_0x423207){return db['CmList'][_0x65ab('0x56')]({'where':{'id':_0x26c528[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x423207,null))[_0x65ab('0x2a')](removeEntity(_0x423207,null))['catch'](handleError(_0x423207,null));};exports[_0x65ab('0x57')]=function(_0x859e0c,_0x526ad8){return db[_0x65ab('0x30')][_0x65ab('0x57')]()[_0x65ab('0x2a')](respondWithResult(_0x526ad8,null))[_0x65ab('0x4a')](handleError(_0x526ad8,null));};exports[_0x65ab('0x58')]=function(_0x2eedb0,_0x2c6d1e,_0x594931){if(_0x2eedb0[_0x65ab('0x55')]['id']){delete _0x2eedb0[_0x65ab('0x55')]['id'];}return db[_0x65ab('0x30')]['find']({'where':{'id':_0x2eedb0['params']['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x2c6d1e,null))[_0x65ab('0x2a')](function(_0x61af49){if(_0x61af49){_0x2eedb0['body']['ListId']=_0x61af49['id'];return db[_0x65ab('0x59')][_0x65ab('0x4d')](_0x2eedb0[_0x65ab('0x55')]);}})[_0x65ab('0x2a')](respondWithResult(_0x2c6d1e,null))[_0x65ab('0x4a')](handleError(_0x2c6d1e,null));};exports[_0x65ab('0x5a')]=function(_0xa7f917,_0x8fd11d,_0x5912e2){var _0x4005a6={'raw':![],'where':{}};var _0x379675={};var _0xdad3fa={'count':0x0,'rows':[]};return db[_0x65ab('0x30')]['findOne']({'where':{'id':_0xa7f917[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x8fd11d,null))[_0x65ab('0x2a')](function(_0x3318c5){if(_0x3318c5){_0x379675['model']=_[_0x65ab('0x36')](db[_0x65ab('0x59')]['rawAttributes']);_0x379675[_0x65ab('0x37')]=_[_0x65ab('0x36')](_0xa7f917[_0x65ab('0x37')]);_0x379675[_0x65ab('0x38')]=_[_0x65ab('0x39')](_0x379675[_0x65ab('0x35')],_0x379675[_0x65ab('0x37')]);_0x4005a6['attributes']=_[_0x65ab('0x39')](_0x379675['model'],qs[_0x65ab('0x3b')](_0xa7f917[_0x65ab('0x37')]['fields']));_0x4005a6[_0x65ab('0x3a')]=_0x4005a6[_0x65ab('0x3a')][_0x65ab('0x3c')]?_0x4005a6['attributes']:_0x379675[_0x65ab('0x35')];if(!_0xa7f917[_0x65ab('0x37')]['hasOwnProperty'](_0x65ab('0x3e'))){_0x4005a6[_0x65ab('0x24')]=qs[_0x65ab('0x24')](_0xa7f917['query']['limit']);_0x4005a6[_0x65ab('0x21')]=qs[_0x65ab('0x21')](_0xa7f917[_0x65ab('0x37')][_0x65ab('0x21')]);}_0x4005a6[_0x65ab('0x3f')]=qs['sort'](_0xa7f917[_0x65ab('0x37')][_0x65ab('0x40')]);_0x4005a6[_0x65ab('0x41')]=qs[_0x65ab('0x38')](_[_0x65ab('0x42')](_0xa7f917[_0x65ab('0x37')],_0x379675[_0x65ab('0x38')]));_0x4005a6[_0x65ab('0x41')][_0x65ab('0x5b')]=_0x3318c5['id'];if(_0xa7f917[_0x65ab('0x37')][_0x65ab('0x45')]){_0x4005a6[_0x65ab('0x41')]=_[_0x65ab('0x43')](_0x4005a6[_0x65ab('0x41')],{'$or':_[_0x65ab('0x2f')](_0x4005a6[_0x65ab('0x3a')],function(_0x4f8cc9){var _0x4ce3d5={};_0x4ce3d5[_0x4f8cc9]={'$like':'%'+_0xa7f917[_0x65ab('0x37')][_0x65ab('0x45')]+'%'};return _0x4ce3d5;})});}_0x4005a6=_['merge']({},_0x4005a6,_0xa7f917[_0x65ab('0x4c')]);return db['Disposition'][_0x65ab('0x23')]({'where':_0x4005a6[_0x65ab('0x41')]})[_0x65ab('0x2a')](function(_0x1bac19){_0xdad3fa['count']=_0x1bac19;if(_0xa7f917[_0x65ab('0x37')]['includeAll']){_0x4005a6[_0x65ab('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x65ab('0x48')](_0x4005a6);})['then'](function(_0xefc53f){_0xdad3fa[_0x65ab('0x49')]=_0xefc53f;return _0xdad3fa;});}})[_0x65ab('0x2a')](respondWithFilteredResult(_0x8fd11d,_0x4005a6))['catch'](handleError(_0x8fd11d,null));};exports['removeDispositions']=function(_0x25e5cc,_0x85adec,_0x29f5f6){return db[_0x65ab('0x30')]['find']({'where':{'id':_0x25e5cc['params']['id']}})['then'](handleEntityNotFound(_0x85adec,null))[_0x65ab('0x2a')](function(_0x2791b6){if(_0x2791b6){return _0x2791b6[_0x65ab('0x5c')](_0x25e5cc[_0x65ab('0x37')][_0x65ab('0x5d')]);}})[_0x65ab('0x2a')](respondWithStatusCode(_0x85adec,null))[_0x65ab('0x4a')](handleError(_0x85adec,null));};exports[_0x65ab('0x5e')]=function(_0x51670f,_0x25cc26,_0x2974e8){return db[_0x65ab('0x30')][_0x65ab('0x56')]({'where':{'id':_0x51670f[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x25cc26,null))[_0x65ab('0x2a')](function(_0x4b70a9){if(_0x4b70a9){var _0xf847c2=[];var _0x4464a5={'success':[],'errors':[]};return db[_0x65ab('0x5f')][_0x65ab('0x57')]()[_0x65ab('0x2a')](function(_0x255e90){if(_0x51670f[_0x65ab('0x55')][_0x65ab('0x60')]&&_[_0x65ab('0x61')](_0x51670f[_0x65ab('0x55')][_0x65ab('0x60')])){if(_0x51670f[_0x65ab('0x55')]['tags'][_0x65ab('0x3c')]){_0x51670f[_0x65ab('0x55')]['tags']=_0x51670f[_0x65ab('0x55')][_0x65ab('0x60')][_0x65ab('0x62')](';')+';';}else{_0x51670f[_0x65ab('0x55')]['tags']=null;}}else{_0x51670f[_0x65ab('0x55')][_0x65ab('0x60')]=null;}if(_0x51670f['body']&&_[_0x65ab('0x61')](_0x51670f['body'])){for(var _0x4c0dda=0x0;_0x4c0dda<_0x51670f[_0x65ab('0x55')][_0x65ab('0x3c')];_0x4c0dda+=0x1){_0x51670f[_0x65ab('0x55')][_0x4c0dda][_0x65ab('0x5b')]=_0x51670f[_0x65ab('0x4b')]['id'];_0xf847c2[_0x65ab('0x63')](_0x51670f[_0x65ab('0x55')][_0x4c0dda]);}return BPromise[_0x65ab('0x64')](_0xf847c2,function(_0xeb05f8){return db[_0x65ab('0x5f')]['create'](_[_0x65ab('0x65')](_0xeb05f8,['ids','id'])||{},{'fields':_[_0x65ab('0x36')](_0x255e90),'raw':!![]})[_0x65ab('0x2a')](function(_0x3a5f85){_0x4464a5[_0x65ab('0x66')]['push'](_0x3a5f85[_0x65ab('0x67')]);})['catch'](function(_0x3ed889){_0x4464a5[_0x65ab('0x68')][_0x65ab('0x63')]({'data':_0xeb05f8,'error':_0x3ed889[_0x65ab('0x69')]});});})[_0x65ab('0x2a')](function(_0x215671){return _0x4464a5;})[_0x65ab('0x4a')](function(_0x3ce9a7){return _0x3ce9a7;});}else{_0x25cc26[_0x65ab('0x1e')](0x190)[_0x65ab('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x65ab('0x2a')](respondWithResult(_0x25cc26,null))[_0x65ab('0x4a')](handleError(_0x25cc26,null));};exports[_0x65ab('0x6a')]=function(_0x412627,_0x1be747,_0x4eee24){var _0x5a753e;return db[_0x65ab('0x30')][_0x65ab('0x56')]({'where':{'id':_0x412627[_0x65ab('0x4b')]['id']},'include':[{'model':db[_0x65ab('0x6b')],'as':_0x65ab('0x6c')}]})[_0x65ab('0x2a')](handleEntityNotFound(_0x1be747,null))[_0x65ab('0x2a')](function(_0x3267a3){if(_0x3267a3){_0x5a753e=_0x3267a3;return db['CmContact'][_0x65ab('0x31')];}})[_0x65ab('0x2a')](function(_0x4694a6){if(_0x4694a6){var _0x36b2c9={};var _0x189b68={};_0x189b68[_0x65ab('0x35')]=_[_0x65ab('0x6d')](_[_0x65ab('0x36')](_0x4694a6),_['map'](_0x5a753e[_0x65ab('0x6c')],function(_0x332d2a){return util[_0x65ab('0x6e')](_0x65ab('0x6f'),_0x332d2a['id']);}));_0x189b68['query']=_[_0x65ab('0x36')](_0x412627[_0x65ab('0x37')]);_0x189b68['filters']=_[_0x65ab('0x39')](_0x189b68['model'],_0x189b68['query']);_0x36b2c9['attributes']=_[_0x65ab('0x39')](_0x189b68[_0x65ab('0x35')],qs[_0x65ab('0x3b')](_0x412627[_0x65ab('0x37')][_0x65ab('0x3b')]));_0x36b2c9[_0x65ab('0x3a')]=_0x36b2c9[_0x65ab('0x3a')][_0x65ab('0x3c')]?_0x36b2c9[_0x65ab('0x3a')]:_0x189b68[_0x65ab('0x35')];if(!_0x412627[_0x65ab('0x37')][_0x65ab('0x3d')](_0x65ab('0x3e'))){_0x36b2c9[_0x65ab('0x24')]=qs[_0x65ab('0x24')](_0x412627['query'][_0x65ab('0x24')]);_0x36b2c9[_0x65ab('0x21')]=qs[_0x65ab('0x21')](_0x412627['query'][_0x65ab('0x21')]);}_0x36b2c9['order']=qs[_0x65ab('0x40')](_0x412627[_0x65ab('0x37')]['sort']);_0x36b2c9[_0x65ab('0x41')]=qs[_0x65ab('0x38')](_[_0x65ab('0x42')](_0x412627[_0x65ab('0x37')],_0x189b68[_0x65ab('0x38')]));_0x36b2c9[_0x65ab('0x70')]=!![];if(_0x412627['query'][_0x65ab('0x45')]){_0x36b2c9[_0x65ab('0x41')]=_[_0x65ab('0x43')](_0x36b2c9[_0x65ab('0x41')],{'$or':_['map'](_0x36b2c9[_0x65ab('0x3a')],function(_0x10eadf){var _0x38e84f={};_0x38e84f[_0x10eadf]={'$like':'%'+_0x412627['query'][_0x65ab('0x45')]+'%'};return _0x38e84f;})});}_0x36b2c9=_[_0x65ab('0x43')]({},_0x36b2c9,_0x412627[_0x65ab('0x4c')]);return _0x5a753e[_0x65ab('0x6a')](_0x36b2c9);}})['then'](respondWithResult(_0x1be747,null))[_0x65ab('0x4a')](handleError(_0x1be747,null));};exports[_0x65ab('0x71')]=function(_0x20d5fe,_0xf71151,_0x1ede4c){var _0x4fc90f;var _0xd1e470;var _0x1c4ecc;var _0x1385ac=_0x20d5fe[_0x65ab('0x4b')]['id'];csv_results=[];return db[_0x65ab('0x72')][_0x65ab('0x48')]({'attributes':['id',_0x65ab('0x2d')],'raw':!![],'order':[_0x65ab('0x73')]})[_0x65ab('0x2a')](function(_0x183035){_0x4fc90f=_0x183035;var _0x58c8dd=_['keys'](db[_0x65ab('0x5f')][_0x65ab('0x31')]);return db['CmCustomField'][_0x65ab('0x48')]({'raw':!![],'attributes':['id','alias']})[_0x65ab('0x2a')](function(_0x467ce0){_0xd1e470=_0x467ce0;var _0x197b63=squel[_0x65ab('0x74')]()[_0x65ab('0x3b')](_0x58c8dd)[_0x65ab('0x75')](_0x65ab('0x76'),'c')[_0x65ab('0x41')](_0x65ab('0x77'),_0x1385ac)[_0x65ab('0x41')](_0x65ab('0x78'))[_0x65ab('0x79')]();for(var _0x5447c4=0x0;_0x5447c4<_0xd1e470['length'];_0x5447c4++){_0x197b63[_0x65ab('0x7a')](_0x65ab('0x7b')+_0xd1e470[_0x5447c4]['id'],_0x65ab('0x7c')+_0xd1e470[_0x5447c4][_0x65ab('0x7d')]);}for(var _0x5447c4=0x0;_0x5447c4<_0x4fc90f[_0x65ab('0x3c')];_0x5447c4++){_0x197b63[_0x65ab('0x7a')](squel[_0x65ab('0x74')]()['field']('item')[_0x65ab('0x75')](_0x65ab('0x7e'))['where'](_0x65ab('0x7f'),_0x4fc90f[_0x5447c4]['id'])['where'](_0x65ab('0x80')),_0x65ab('0x81')+_0x4fc90f[_0x5447c4][_0x65ab('0x2d')]);_0x197b63[_0x65ab('0x7a')](squel[_0x65ab('0x74')]()['field']('description')['from'](_0x65ab('0x7e'))[_0x65ab('0x41')](_0x65ab('0x7f'),_0x4fc90f[_0x5447c4]['id'])[_0x65ab('0x41')](_0x65ab('0x80')),_0x65ab('0x82')+_0x4fc90f[_0x5447c4][_0x65ab('0x2d')]);}var _0x3a5cbc=[];_0x3a5cbc['push'](_0x197b63['toString']());BPromise['each'](_0x3a5cbc,handleQuery)['then'](function(_0x548504){handleQuery(_0x197b63['toString']());var _0x4bb638=csv_results[0x0];if(!_[_0x65ab('0x83')](_0x4bb638)){var _0x3c7469=toCsv(_0x4bb638);var _0x20fd19=Date['now']();fs['writeFileSync'](util[_0x65ab('0x6e')](_0x65ab('0x84'),_0x1385ac,_0x20fd19),_0x3c7469);_0xf71151[_0x65ab('0x85')](_0x65ab('0x86'),_0x65ab('0x87')+util[_0x65ab('0x6e')](_0x65ab('0x88'),_0x1385ac,_0x20fd19));_0xf71151[_0x65ab('0x85')]('Content-type','text/csv');return _0xf71151[_0x65ab('0x89')](util[_0x65ab('0x6e')]('/tmp/list_%d_%s.csv',_0x1385ac,_0x20fd19));}else{return _0xf71151[_0x65ab('0x1d')](0xcc);}});});});};exports[_0x65ab('0x8a')]=function(_0xbc651d,_0x772acf,_0x235627){var _0x398343;delete _0xbc651d[_0x65ab('0x55')]['id'];return db[_0x65ab('0x30')]['findOne']({'where':{'id':_0xbc651d['params']['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x772acf,null))[_0x65ab('0x2a')](function(_0x22d55d){if(_0x22d55d){return db[_0x65ab('0x8b')]['transaction'](function(_0x55dd82){return db['CmCustomField']['create'](_0xbc651d[_0x65ab('0x55')],{'transaction':_0x55dd82})[_0x65ab('0x2a')](function(_0x57dc15){_0x398343=_0x57dc15;return _0x22d55d[_0x65ab('0x8c')](_0x57dc15,{'transaction':_0x55dd82});})['then'](function(){var _0x2f9708={'type':db[_0x65ab('0x8d')][_0x65ab('0x8e')],'transaction':_0x55dd82};switch(_0xbc651d[_0x65ab('0x55')][_0x65ab('0x33')]){case _0x65ab('0x8f'):_0x2f9708[_0x65ab('0x33')]=db[_0x65ab('0x8d')][_0x65ab('0x8e')];break;case'number':_0x2f9708[_0x65ab('0x33')]=db['Sequelize'][_0x65ab('0x90')];break;case _0x65ab('0x91'):_0x2f9708['type']=db[_0x65ab('0x8d')][_0x65ab('0x92')];_0x2f9708['defaultValue']=![];break;default:}return db[_0x65ab('0x8b')][_0x65ab('0x93')][_0x65ab('0x94')](_0x65ab('0x76'),util[_0x65ab('0x6e')]('cf_%s',_0x398343['id']),_0x2f9708);})[_0x65ab('0x2a')](function(){return _0x398343;});});}})[_0x65ab('0x2a')](respondWithResult(_0x772acf,null))[_0x65ab('0x4a')](handleError(_0x772acf,null));};exports['getCustomFields']=function(_0x441b24,_0x1037ff,_0x259a67){var _0x2497d2={};var _0x2e6fe6={};var _0x3478dd;var _0x719dce;return db[_0x65ab('0x30')]['findOne']({'where':{'id':_0x441b24['params']['id']}})['then'](handleEntityNotFound(_0x1037ff,null))[_0x65ab('0x2a')](function(_0x2da3eb){if(_0x2da3eb){_0x3478dd=_0x2da3eb;_0x2e6fe6['model']=_[_0x65ab('0x36')](db[_0x65ab('0x6b')][_0x65ab('0x31')]);_0x2e6fe6[_0x65ab('0x37')]=_['keys'](_0x441b24[_0x65ab('0x37')]);_0x2e6fe6[_0x65ab('0x38')]=_['intersection'](_0x2e6fe6[_0x65ab('0x35')],_0x2e6fe6[_0x65ab('0x37')]);_0x2497d2[_0x65ab('0x3a')]=_[_0x65ab('0x39')](_0x2e6fe6[_0x65ab('0x35')],qs[_0x65ab('0x3b')](_0x441b24[_0x65ab('0x37')]['fields']));_0x2497d2['attributes']=_0x2497d2['attributes'][_0x65ab('0x3c')]?_0x2497d2['attributes']:_0x2e6fe6[_0x65ab('0x35')];_0x2497d2[_0x65ab('0x3f')]=qs['sort'](_0x441b24[_0x65ab('0x37')]['sort']);_0x2497d2[_0x65ab('0x41')]=qs[_0x65ab('0x38')](_[_0x65ab('0x42')](_0x441b24['query'],_0x2e6fe6['filters']));_0x2497d2['where']=_[_0x65ab('0x43')](_0x2497d2['where'],{'$or':[{'ListId':_0x2da3eb['id']},{'ListId':null}]});if(_0x441b24[_0x65ab('0x37')][_0x65ab('0x45')]){_0x2497d2[_0x65ab('0x41')]=_['merge'](_0x2497d2[_0x65ab('0x41')],{'$or':_[_0x65ab('0x2f')](_0x2497d2[_0x65ab('0x3a')],function(_0x520d48){var _0x51cc33={};_0x51cc33[_0x520d48]={'$like':'%'+_0x441b24[_0x65ab('0x37')]['filter']+'%'};return _0x51cc33;})});}_0x2497d2=_[_0x65ab('0x43')]({},_0x2497d2,_0x441b24[_0x65ab('0x4c')]);return db[_0x65ab('0x6b')][_0x65ab('0x95')](_0x2497d2);}})[_0x65ab('0x2a')](respondWithResult(_0x1037ff,null))['catch'](handleError(_0x1037ff,null));};exports[_0x65ab('0x96')]=function(_0x2af53f,_0x52cafb){return db[_0x65ab('0x6b')][_0x65ab('0x95')]({'where':{'ListId':null}})[_0x65ab('0x2a')](handleEntityNotFound(_0x52cafb,null))['then'](function(_0x1e07a8){return _0x1e07a8;})['then'](respondWithResult(_0x52cafb,null))['catch'](handleError(_0x52cafb,null));};exports[_0x65ab('0x97')]=function(_0x889e6a,_0x441109,_0x169e04){return db[_0x65ab('0x30')][_0x65ab('0x56')]({'where':{'id':_0x889e6a[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x441109,null))[_0x65ab('0x2a')](function(_0xa222d8){if(_0xa222d8){return _0xa222d8[_0x65ab('0x97')](_0x889e6a[_0x65ab('0x55')]['ids'],_[_0x65ab('0x65')](_0x889e6a[_0x65ab('0x55')],[_0x65ab('0x5d'),'id'])||{})[_0x65ab('0x98')](function(_0x55df88){for(var _0x1ab0bc=0x0;_0x1ab0bc<_0x889e6a[_0x65ab('0x55')][_0x65ab('0x5d')][_0x65ab('0x3c')];_0x1ab0bc+=0x1){socket[_0x65ab('0x99')]('userCmList:save',{'UserId':Number(_0x889e6a['body'][_0x65ab('0x5d')][_0x1ab0bc]),'CmListId':Number(_0x889e6a[_0x65ab('0x4b')]['id'])});}return _0x55df88;});}})[_0x65ab('0x2a')](respondWithResult(_0x441109,null))[_0x65ab('0x4a')](handleError(_0x441109,null));};exports[_0x65ab('0x9a')]=function(_0x4cdc0e,_0x4b7da7,_0xf56926){return db[_0x65ab('0x30')][_0x65ab('0x56')]({'where':{'id':_0x4cdc0e[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x4b7da7,null))[_0x65ab('0x2a')](function(_0x2a8227){if(_0x2a8227){return _0x2a8227[_0x65ab('0x9a')](_0x4cdc0e[_0x65ab('0x37')][_0x65ab('0x5d')])[_0x65ab('0x2a')](function(){if(_['isArray'](_0x4cdc0e[_0x65ab('0x37')][_0x65ab('0x5d')])){for(var _0x277d2a=0x0;_0x277d2a<_0x4cdc0e[_0x65ab('0x37')][_0x65ab('0x5d')][_0x65ab('0x3c')];_0x277d2a+=0x1){socket[_0x65ab('0x99')](_0x65ab('0x9b'),{'UserId':Number(_0x4cdc0e[_0x65ab('0x37')][_0x65ab('0x5d')][_0x277d2a]),'CmListId':Number(_0x4cdc0e[_0x65ab('0x4b')]['id'])});}}else{socket['emit'](_0x65ab('0x9b'),{'UserId':Number(_0x4cdc0e['query']['ids']),'CmListId':Number(_0x4cdc0e[_0x65ab('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4b7da7,null))[_0x65ab('0x4a')](handleError(_0x4b7da7,null));};exports[_0x65ab('0x9c')]=function(_0x26e5b5,_0x559ebc,_0x4fe4ba){var _0x4f6737={};var _0x39fcb6={};var _0x452119;var _0x391eee;return db[_0x65ab('0x30')][_0x65ab('0x9d')]({'where':{'id':_0x26e5b5[_0x65ab('0x4b')]['id']}})[_0x65ab('0x2a')](handleEntityNotFound(_0x559ebc,null))[_0x65ab('0x2a')](function(_0xd85e75){if(_0xd85e75){_0x452119=_0xd85e75;_0x39fcb6['model']=_['keys'](db[_0x65ab('0x9e')][_0x65ab('0x31')]);_0x39fcb6[_0x65ab('0x37')]=_[_0x65ab('0x36')](_0x26e5b5[_0x65ab('0x37')]);_0x39fcb6[_0x65ab('0x38')]=_[_0x65ab('0x39')](_0x39fcb6[_0x65ab('0x35')],_0x39fcb6[_0x65ab('0x37')]);_0x4f6737[_0x65ab('0x3a')]=_[_0x65ab('0x39')](_0x39fcb6['model'],qs[_0x65ab('0x3b')](_0x26e5b5[_0x65ab('0x37')][_0x65ab('0x3b')]));_0x4f6737[_0x65ab('0x3a')]=_0x4f6737[_0x65ab('0x3a')][_0x65ab('0x3c')]?_0x4f6737[_0x65ab('0x3a')]:_0x39fcb6[_0x65ab('0x35')];_0x4f6737[_0x65ab('0x3f')]=qs[_0x65ab('0x40')](_0x26e5b5[_0x65ab('0x37')][_0x65ab('0x40')]);_0x4f6737[_0x65ab('0x41')]=qs[_0x65ab('0x38')](_['pick'](_0x26e5b5[_0x65ab('0x37')],_0x39fcb6['filters']));if(_0x26e5b5['query'][_0x65ab('0x45')]){_0x4f6737['where']=_[_0x65ab('0x43')](_0x4f6737[_0x65ab('0x41')],{'$or':_['map'](_0x4f6737[_0x65ab('0x3a')],function(_0x5bb658){var _0x422acc={};_0x422acc[_0x5bb658]={'$like':'%'+_0x26e5b5[_0x65ab('0x37')][_0x65ab('0x45')]+'%'};return _0x422acc;})});}_0x4f6737=_[_0x65ab('0x43')]({},_0x4f6737,_0x26e5b5[_0x65ab('0x4c')]);return _0x452119[_0x65ab('0x9c')](_0x4f6737);}})[_0x65ab('0x2a')](function(_0x52c1aa){if(_0x52c1aa){_0x391eee=_0x52c1aa['length'];if(!_0x26e5b5[_0x65ab('0x37')]['hasOwnProperty']('nolimit')){_0x4f6737[_0x65ab('0x24')]=qs[_0x65ab('0x24')](_0x26e5b5['query']['limit']);_0x4f6737[_0x65ab('0x21')]=qs[_0x65ab('0x21')](_0x26e5b5[_0x65ab('0x37')][_0x65ab('0x21')]);}return _0x452119[_0x65ab('0x9c')](_0x4f6737);}})['then'](function(_0x40e140){if(_0x40e140){return _0x40e140?{'count':_0x391eee,'rows':_0x40e140}:null;}})[_0x65ab('0x2a')](respondWithResult(_0x559ebc,null))['catch'](handleError(_0x559ebc,null));};function handleQuery(_0x292758){logger[_0x65ab('0x9f')](_0x292758);return db[_0x65ab('0x8b')][_0x65ab('0x37')](_0x292758)[_0x65ab('0x98')](function(_0xecc780){csv_results[_0x65ab('0x63')](_0xecc780);})['catch'](function(_0x5d2a9d){logger[_0x65ab('0x2c')](_0x5d2a9d['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8749f0a..e42c4fb 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x55ca,0x126));var _0xa55c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x55ca[_0x39d544];return _0x5a5ff2;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x7217,0x19e));var _0x7721=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7217[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e6d73f6..c37bf0d 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 _0x5b02=['define','CmList','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x22c622,_0x245dc7){var _0x4ce41c=function(_0xc30ae5){while(--_0xc30ae5){_0x22c622['push'](_0x22c622['shift']());}};_0x4ce41c(++_0x245dc7);}(_0x5b02,0xe9));var _0x25b0=function(_0x4a9cf8,_0x5d7391){_0x4a9cf8=_0x4a9cf8-0x0;var _0x94aab9=_0x5b02[_0x4a9cf8];return _0x94aab9;};'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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4547ce,_0x3b9260){var _0x1f769a=function(_0x4d212e){while(--_0x4d212e){_0x4547ce['push'](_0x4547ce['shift']());}};_0x1f769a(++_0x3b9260);}(_0x702d,0x147));var _0xd702=function(_0x571ce1,_0x35a965){_0x571ce1=_0x571ce1-0x0;var _0x37af32=_0x702d[_0x571ce1];return _0x37af32;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 5377908..b1ac170 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 _0x083d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x083d,0x15a));var _0xd083=function(_0x2c8756,_0x8642a){_0x2c8756=_0x2c8756-0x0;var _0x262014=_0x083d[_0x2c8756];return _0x262014;};'use strict';var _=require(_0xd083('0x0'));var util=require('util');var moment=require(_0xd083('0x1'));var BPromise=require(_0xd083('0x2'));var rs=require(_0xd083('0x3'));var fs=require('fs');var Redis=require(_0xd083('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd083('0x5'));var logger=require(_0xd083('0x6'))(_0xd083('0x7'));var config=require(_0xd083('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd083('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd083('0xa')],{'host':_0xd083('0xb'),'port':0x18eb});var socket=require(_0xd083('0xc'))(new Redis(config[_0xd083('0xa')]));require(_0xd083('0xd'))[_0xd083('0xe')](socket);function respondWithRpcPromise(_0x351960,_0x3c62c3,_0x1f18fd){return new BPromise(function(_0x23a01a,_0x441eac){return client[_0xd083('0xf')](_0x351960,_0x1f18fd)[_0xd083('0x10')](function(_0x4264a9){logger[_0xd083('0x11')](_0xd083('0x12'),_0x3c62c3,_0xd083('0x13'));logger['debug'](_0xd083('0x14'),_0x3c62c3,_0xd083('0x13'),JSON['stringify'](_0x4264a9));if(_0x4264a9[_0xd083('0x15')]){if(_0x4264a9[_0xd083('0x15')][_0xd083('0x16')]===0x1f4){logger[_0xd083('0x15')](_0xd083('0x12'),_0x3c62c3,_0x4264a9[_0xd083('0x15')][_0xd083('0x17')]);return _0x441eac(_0x4264a9[_0xd083('0x15')][_0xd083('0x17')]);}logger[_0xd083('0x15')]('CmList,\x20%s,\x20%s',_0x3c62c3,_0x4264a9[_0xd083('0x15')][_0xd083('0x17')]);return _0x23a01a(_0x4264a9[_0xd083('0x15')][_0xd083('0x17')]);}else{logger[_0xd083('0x11')]('CmList,\x20%s,\x20%s',_0x3c62c3,'request\x20sent');_0x23a01a(_0x4264a9['result'][_0xd083('0x17')]);}})[_0xd083('0x18')](function(_0x3d761a){logger[_0xd083('0x15')](_0xd083('0x12'),_0x3c62c3,_0x3d761a);_0x441eac(_0x3d761a);});});} \ No newline at end of file +var _0x5eaf=['stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5eaf,0x1a6));var _0xf5ea=function(_0x408b46,_0x156429){_0x408b46=_0x408b46-0x0;var _0x1b29cf=_0x5eaf[_0x408b46];return _0x1b29cf;};'use strict';var _=require('lodash');var util=require(_0xf5ea('0x0'));var moment=require('moment');var BPromise=require(_0xf5ea('0x1'));var rs=require(_0xf5ea('0x2'));var fs=require('fs');var Redis=require(_0xf5ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf5ea('0x4'))(_0xf5ea('0x5'));var config=require(_0xf5ea('0x6'));var jayson=require(_0xf5ea('0x7'));var client=jayson[_0xf5ea('0x8')][_0xf5ea('0x9')]({'port':0x232a});config[_0xf5ea('0xa')]=_['defaults'](config[_0xf5ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5ea('0xa')]));require(_0xf5ea('0xb'))[_0xf5ea('0xc')](socket);function respondWithRpcPromise(_0x292c0e,_0x1dbff6,_0x1b6fc6){return new BPromise(function(_0x5c2209,_0x29d0f0){return client[_0xf5ea('0xd')](_0x292c0e,_0x1b6fc6)[_0xf5ea('0xe')](function(_0x9c8794){logger[_0xf5ea('0xf')](_0xf5ea('0x10'),_0x1dbff6,_0xf5ea('0x11'));logger[_0xf5ea('0x12')](_0xf5ea('0x13'),_0x1dbff6,_0xf5ea('0x11'),JSON[_0xf5ea('0x14')](_0x9c8794));if(_0x9c8794['error']){if(_0x9c8794['error'][_0xf5ea('0x15')]===0x1f4){logger['error'](_0xf5ea('0x10'),_0x1dbff6,_0x9c8794[_0xf5ea('0x16')][_0xf5ea('0x17')]);return _0x29d0f0(_0x9c8794['error'][_0xf5ea('0x17')]);}logger[_0xf5ea('0x16')]('CmList,\x20%s,\x20%s',_0x1dbff6,_0x9c8794[_0xf5ea('0x16')]['message']);return _0x5c2209(_0x9c8794[_0xf5ea('0x16')][_0xf5ea('0x17')]);}else{logger[_0xf5ea('0xf')]('CmList,\x20%s,\x20%s',_0x1dbff6,_0xf5ea('0x11'));_0x5c2209(_0x9c8794[_0xf5ea('0x18')][_0xf5ea('0x17')]);}})[_0xf5ea('0x19')](function(_0x50816d){logger['error'](_0xf5ea('0x10'),_0x1dbff6,_0x50816d);_0x29d0f0(_0x50816d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e788164..47a91a7 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 _0xe222=['emit','removeListener','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xe222,0x1b5));var _0x2e22=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xe222[_0x4480b9];return _0x3f0f02;};'use strict';var CmListEvents=require(_0x2e22('0x0'));var events=[_0x2e22('0x1'),_0x2e22('0x2'),_0x2e22('0x3')];function createListener(_0x545328,_0x1f6926){return function(_0x2a3b42){_0x1f6926[_0x2e22('0x4')](_0x545328,_0x2a3b42);};}function removeListener(_0x3b02d2,_0x2f7516){return function(){CmListEvents[_0x2e22('0x5')](_0x3b02d2,_0x2f7516);};}exports[_0x2e22('0x6')]=function(_0xf980ba){for(var _0x58b214=0x0,_0xecba97=events[_0x2e22('0x7')];_0x58b214<_0xecba97;_0x58b214++){var _0x3ac390=events[_0x58b214];var _0x5130a1=createListener(_0x2e22('0x8')+_0x3ac390,_0xf980ba);CmListEvents['on'](_0x3ac390,_0x5130a1);}}; \ No newline at end of file +var _0xf76f=['removeListener','register','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x2e32d9,_0x2ff865){var _0x2033c3=function(_0x3d9cdf){while(--_0x3d9cdf){_0x2e32d9['push'](_0x2e32d9['shift']());}};_0x2033c3(++_0x2ff865);}(_0xf76f,0x70));var _0xff76=function(_0x2c271b,_0x5e1728){_0x2c271b=_0x2c271b-0x0;var _0x423d7b=_0xf76f[_0x2c271b];return _0x423d7b;};'use strict';var CmListEvents=require(_0xff76('0x0'));var events=[_0xff76('0x1'),_0xff76('0x2'),_0xff76('0x3')];function createListener(_0x326fa7,_0x583671){return function(_0x29b930){_0x583671[_0xff76('0x4')](_0x326fa7,_0x29b930);};}function removeListener(_0x12b666,_0x407f2b){return function(){CmListEvents[_0xff76('0x5')](_0x12b666,_0x407f2b);};}exports[_0xff76('0x6')]=function(_0x2d9610){for(var _0x250c90=0x0,_0x1fc37c=events[_0xff76('0x7')];_0x250c90<_0x1fc37c;_0x250c90++){var _0x451a3a=events[_0x250c90];var _0x40e7d0=createListener(_0xff76('0x8')+_0x451a3a,_0x2d9610);CmListEvents['on'](_0x451a3a,_0x40e7d0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4a37d07..8a8c0fe 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 _0x1093=['/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addAgents','/:id','update','delete','/:id/dispositions','removeDispositions','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','getGlobalCustomFields','show','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x545b28,_0x266b1a){var _0x459b6c=function(_0x50ba68){while(--_0x50ba68){_0x545b28['push'](_0x545b28['shift']());}};_0x459b6c(++_0x266b1a);}(_0x1093,0xa5));var _0x3109=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x1093[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0x3109('0x0'));var path=require('path');var timeout=require(_0x3109('0x1'));var express=require('express');var router=express[_0x3109('0x2')]();var fs_extra=require(_0x3109('0x3'));var auth=require(_0x3109('0x4'));var interaction=require(_0x3109('0x5'));var config=require(_0x3109('0x6'));var controller=require(_0x3109('0x7'));router['get']('/',auth[_0x3109('0x8')](),controller['index']);router[_0x3109('0x9')]('/describe',auth[_0x3109('0x8')](),controller['describe']);router['get']('/global_fields',auth['isAuthenticated'](),controller[_0x3109('0xa')]);router[_0x3109('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3109('0xb')]);router[_0x3109('0x9')]('/:id/dispositions',auth[_0x3109('0x8')](),controller['getDispositions']);router[_0x3109('0x9')](_0x3109('0xc'),auth['isAuthenticated'](),controller[_0x3109('0xd')]);router['get'](_0x3109('0xe'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x3109('0x9')](_0x3109('0xf'),auth[_0x3109('0x8')](),controller[_0x3109('0x10')]);router[_0x3109('0x9')](_0x3109('0x11'),auth[_0x3109('0x8')](),controller['getAgents']);router[_0x3109('0x12')]('/',auth[_0x3109('0x8')](),controller[_0x3109('0x13')]);router[_0x3109('0x12')]('/:id/dispositions',auth[_0x3109('0x8')](),controller[_0x3109('0x14')]);router[_0x3109('0x12')](_0x3109('0xc'),auth['isAuthenticated'](),controller[_0x3109('0x15')]);router[_0x3109('0x12')](_0x3109('0xf'),auth[_0x3109('0x8')](),controller['addCustomField']);router[_0x3109('0x12')](_0x3109('0x11'),auth['isAuthenticated'](),controller[_0x3109('0x16')]);router['put'](_0x3109('0x17'),auth['isAuthenticated'](),controller[_0x3109('0x18')]);router[_0x3109('0x19')](_0x3109('0x17'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x3109('0x1a'),auth[_0x3109('0x8')](),controller[_0x3109('0x1b')]);router[_0x3109('0x19')](_0x3109('0x11'),auth['isAuthenticated'](),controller[_0x3109('0x1c')]);module[_0x3109('0x1d')]=router; \ No newline at end of file +var _0x6505=['/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x1012f5,_0x3f177e){var _0x992952=function(_0x7b2ec4){while(--_0x7b2ec4){_0x1012f5['push'](_0x1012f5['shift']());}};_0x992952(++_0x3f177e);}(_0x6505,0x8c));var _0x5650=function(_0x5c3d5e,_0x22af15){_0x5c3d5e=_0x5c3d5e-0x0;var _0x39bfab=_0x6505[_0x5c3d5e];return _0x39bfab;};'use strict';var multer=require(_0x5650('0x0'));var util=require(_0x5650('0x1'));var path=require(_0x5650('0x2'));var timeout=require(_0x5650('0x3'));var express=require(_0x5650('0x4'));var router=express[_0x5650('0x5')]();var fs_extra=require(_0x5650('0x6'));var auth=require(_0x5650('0x7'));var interaction=require(_0x5650('0x8'));var config=require(_0x5650('0x9'));var controller=require(_0x5650('0xa'));router['get']('/',auth[_0x5650('0xb')](),controller[_0x5650('0xc')]);router[_0x5650('0xd')](_0x5650('0xe'),auth[_0x5650('0xb')](),controller[_0x5650('0xf')]);router[_0x5650('0xd')]('/global_fields',auth[_0x5650('0xb')](),controller['getGlobalCustomFields']);router[_0x5650('0xd')](_0x5650('0x10'),auth[_0x5650('0xb')](),controller[_0x5650('0x11')]);router[_0x5650('0xd')](_0x5650('0x12'),auth[_0x5650('0xb')](),controller[_0x5650('0x13')]);router[_0x5650('0xd')](_0x5650('0x14'),auth[_0x5650('0xb')](),controller[_0x5650('0x15')]);router[_0x5650('0xd')](_0x5650('0x16'),auth[_0x5650('0xb')](),controller[_0x5650('0x17')]);router[_0x5650('0xd')](_0x5650('0x18'),auth[_0x5650('0xb')](),controller[_0x5650('0x19')]);router['get'](_0x5650('0x1a'),auth[_0x5650('0xb')](),controller[_0x5650('0x1b')]);router[_0x5650('0x1c')]('/',auth[_0x5650('0xb')](),controller[_0x5650('0x1d')]);router['post'](_0x5650('0x12'),auth[_0x5650('0xb')](),controller[_0x5650('0x1e')]);router[_0x5650('0x1c')](_0x5650('0x14'),auth[_0x5650('0xb')](),controller[_0x5650('0x1f')]);router[_0x5650('0x1c')](_0x5650('0x18'),auth[_0x5650('0xb')](),controller[_0x5650('0x20')]);router[_0x5650('0x1c')](_0x5650('0x1a'),auth[_0x5650('0xb')](),controller[_0x5650('0x21')]);router[_0x5650('0x22')](_0x5650('0x10'),auth['isAuthenticated'](),controller[_0x5650('0x23')]);router[_0x5650('0x24')](_0x5650('0x10'),auth[_0x5650('0xb')](),controller[_0x5650('0x25')]);router[_0x5650('0x24')](_0x5650('0x12'),auth[_0x5650('0xb')](),controller[_0x5650('0x26')]);router[_0x5650('0x24')](_0x5650('0x1a'),auth[_0x5650('0xb')](),controller[_0x5650('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 29406d1..398b432 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 _0x9c59=['VIRTUAL','field','STRING','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9c59,0x107));var _0x99c5=function(_0x47e629,_0x5ec1d9){_0x47e629=_0x47e629-0x0;var _0x33e4fc=_0x9c59[_0x47e629];return _0x33e4fc;};'use strict';var Sequelize=require(_0x99c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x99c5('0x1')],'get':function(_0x42f3eb){return this['getDataValue'](_0x99c5('0x2'));}},'field':{'type':Sequelize[_0x99c5('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x99c5('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x626e=['getDataValue','field','STRING','sequelize','exports'];(function(_0x50e304,_0x43cfef){var _0x3b6f9a=function(_0x18947e){while(--_0x18947e){_0x50e304['push'](_0x50e304['shift']());}};_0x3b6f9a(++_0x43cfef);}(_0x626e,0x17a));var _0xe626=function(_0x266850,_0x821b6b){_0x266850=_0x266850-0x0;var _0x3708bc=_0x626e[_0x266850];return _0x3708bc;};'use strict';var Sequelize=require(_0xe626('0x0'));module[_0xe626('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3172f1){return this[_0xe626('0x2')](_0xe626('0x3'));}},'field':{'type':Sequelize[_0xe626('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ee6d067..4d0927e 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x38eabc,_0x1d960a){var _0x2a6ce7=function(_0x1e3260){while(--_0x1e3260){_0x38eabc['push'](_0x38eabc['shift']());}};_0x2a6ce7(++_0x1d960a);}(_0x7a54,0x106));var _0x47a5=function(_0x3d1433,_0x121dc0){_0x3d1433=_0x3d1433-0x0;var _0x585461=_0x7a54[_0x3d1433];return _0x585461;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x232c6c,_0xa1122b){var _0x3ea60c=function(_0xc81ce8){while(--_0xc81ce8){_0x232c6c['push'](_0x232c6c['shift']());}};_0x3ea60c(++_0xa1122b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8ebcb8f..0ff8d01 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 _0x3107=['moment','bluebird','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash','../../config/logger','api'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x3107,0xd9));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7310('0x0'));var util=require('util');var logger=require(_0x7310('0x1'))(_0x7310('0x2'));var moment=require(_0x7310('0x3'));var BPromise=require(_0x7310('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7310('0x5'));var rimraf=require('rimraf');var config=require(_0x7310('0x6'));var attributes=require(_0x7310('0x7'));module[_0x7310('0x8')]=function(_0x564024,_0x1e98b3){return _0x564024[_0x7310('0x9')](_0x7310('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbb8=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbb8,0x9e));var _0x8fbb=function(_0x47b0d9,_0x41b561){_0x47b0d9=_0x47b0d9-0x0;var _0x599df3=_0xfbb8[_0x47b0d9];return _0x599df3;};'use strict';var _=require(_0x8fbb('0x0'));var util=require(_0x8fbb('0x1'));var logger=require(_0x8fbb('0x2'))('api');var moment=require(_0x8fbb('0x3'));var BPromise=require(_0x8fbb('0x4'));var rp=require(_0x8fbb('0x5'));var fs=require('fs');var path=require(_0x8fbb('0x6'));var rimraf=require(_0x8fbb('0x7'));var config=require(_0x8fbb('0x8'));var attributes=require(_0x8fbb('0x9'));module[_0x8fbb('0xa')]=function(_0x3cd21e,_0x10519c){return _0x3cd21e[_0x8fbb('0xb')](_0x8fbb('0xc'),attributes,{'tableName':_0x8fbb('0xd'),'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 4c36baf..b9d4a64 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 _0x2c79=['rpc','jayson/promise','http','request','then','info','debug','request\x20sent','error','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xa58b3c,_0x57a029){var _0x59152f=function(_0x45d5d7){while(--_0x45d5d7){_0xa58b3c['push'](_0xa58b3c['shift']());}};_0x59152f(++_0x57a029);}(_0x2c79,0x1c0));var _0x92c7=function(_0x594cd5,_0x177879){_0x594cd5=_0x594cd5-0x0;var _0xd63c11=_0x2c79[_0x594cd5];return _0xd63c11;};'use strict';var _=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var moment=require(_0x92c7('0x2'));var BPromise=require(_0x92c7('0x3'));var rs=require(_0x92c7('0x4'));var fs=require('fs');var Redis=require(_0x92c7('0x5'));var db=require(_0x92c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x92c7('0x7'))(_0x92c7('0x8'));var config=require('../../config/environment');var jayson=require(_0x92c7('0x9'));var client=jayson['client'][_0x92c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b10e9,_0x3c9986,_0x1f0739){return new BPromise(function(_0x3797c9,_0x3cabbc){return client[_0x92c7('0xb')](_0x4b10e9,_0x1f0739)[_0x92c7('0xc')](function(_0x4bd0da){logger[_0x92c7('0xd')]('Condition,\x20%s,\x20%s',_0x3c9986,'request\x20sent');logger[_0x92c7('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x3c9986,_0x92c7('0xf'),JSON['stringify'](_0x4bd0da));if(_0x4bd0da[_0x92c7('0x10')]){if(_0x4bd0da[_0x92c7('0x10')]['code']===0x1f4){logger[_0x92c7('0x10')](_0x92c7('0x11'),_0x3c9986,_0x4bd0da[_0x92c7('0x10')][_0x92c7('0x12')]);return _0x3cabbc(_0x4bd0da[_0x92c7('0x10')]['message']);}logger[_0x92c7('0x10')](_0x92c7('0x11'),_0x3c9986,_0x4bd0da[_0x92c7('0x10')][_0x92c7('0x12')]);return _0x3797c9(_0x4bd0da[_0x92c7('0x10')]['message']);}else{logger[_0x92c7('0xd')]('Condition,\x20%s,\x20%s',_0x3c9986,_0x92c7('0xf'));_0x3797c9(_0x4bd0da['result'][_0x92c7('0x12')]);}})['catch'](function(_0x4b3c91){logger['error']('Condition,\x20%s,\x20%s',_0x3c9986,_0x4b3c91);_0x3cabbc(_0x4b3c91);});});} \ No newline at end of file +var _0x0cbe=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x59b341,_0x122518){var _0x5690b1=function(_0x3e9204){while(--_0x3e9204){_0x59b341['push'](_0x59b341['shift']());}};_0x5690b1(++_0x122518);}(_0x0cbe,0x1f4));var _0xe0cb=function(_0x273e1c,_0x1fe1b8){_0x273e1c=_0x273e1c-0x0;var _0x2bc896=_0x0cbe[_0x273e1c];return _0x2bc896;};'use strict';var _=require(_0xe0cb('0x0'));var util=require(_0xe0cb('0x1'));var moment=require(_0xe0cb('0x2'));var BPromise=require(_0xe0cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0cb('0x4'));var db=require(_0xe0cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0cb('0x6'))(_0xe0cb('0x7'));var config=require(_0xe0cb('0x8'));var jayson=require(_0xe0cb('0x9'));var client=jayson[_0xe0cb('0xa')][_0xe0cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57adaf,_0x12057f,_0x3486b2){return new BPromise(function(_0x3a106f,_0x35e3a2){return client['request'](_0x57adaf,_0x3486b2)[_0xe0cb('0xc')](function(_0x108aaa){logger[_0xe0cb('0xd')]('Condition,\x20%s,\x20%s',_0x12057f,_0xe0cb('0xe'));logger[_0xe0cb('0xf')](_0xe0cb('0x10'),_0x12057f,_0xe0cb('0xe'),JSON['stringify'](_0x108aaa));if(_0x108aaa[_0xe0cb('0x11')]){if(_0x108aaa[_0xe0cb('0x11')][_0xe0cb('0x12')]===0x1f4){logger[_0xe0cb('0x11')](_0xe0cb('0x13'),_0x12057f,_0x108aaa[_0xe0cb('0x11')]['message']);return _0x35e3a2(_0x108aaa[_0xe0cb('0x11')][_0xe0cb('0x14')]);}logger['error'](_0xe0cb('0x13'),_0x12057f,_0x108aaa[_0xe0cb('0x11')][_0xe0cb('0x14')]);return _0x3a106f(_0x108aaa[_0xe0cb('0x11')][_0xe0cb('0x14')]);}else{logger[_0xe0cb('0xd')](_0xe0cb('0x13'),_0x12057f,_0xe0cb('0xe'));_0x3a106f(_0x108aaa[_0xe0cb('0x15')]['message']);}})[_0xe0cb('0x16')](function(_0x5164a3){logger[_0xe0cb('0x11')](_0xe0cb('0x13'),_0x12057f,_0x5164a3);_0x35e3a2(_0x5164a3);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 17f357e..1a6fa69 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 _0xb8d1=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0xe0b98,_0x4875ee){var _0x29f74f=function(_0x456590){while(--_0x456590){_0xe0b98['push'](_0xe0b98['shift']());}};_0x29f74f(++_0x4875ee);}(_0xb8d1,0xdb));var _0x1b8d=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0xb8d1[_0x482214];return _0x38d0cb;};'use strict';var multer=require(_0x1b8d('0x0'));var util=require(_0x1b8d('0x1'));var path=require(_0x1b8d('0x2'));var timeout=require(_0x1b8d('0x3'));var express=require(_0x1b8d('0x4'));var router=express[_0x1b8d('0x5')]();var fs_extra=require(_0x1b8d('0x6'));var auth=require(_0x1b8d('0x7'));var interaction=require(_0x1b8d('0x8'));var config=require(_0x1b8d('0x9'));var controller=require(_0x1b8d('0xa'));router[_0x1b8d('0xb')]('/:id',auth[_0x1b8d('0xc')](),controller[_0x1b8d('0xd')]);router[_0x1b8d('0xe')](_0x1b8d('0xf'),auth[_0x1b8d('0xc')](),controller[_0x1b8d('0x10')]);module[_0x1b8d('0x11')]=router; \ No newline at end of file +var _0x975b=['fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','destroy','exports','multer','util','path','express','Router'];(function(_0x2eb8fc,_0x531218){var _0x23ee2e=function(_0x4c86ff){while(--_0x4c86ff){_0x2eb8fc['push'](_0x2eb8fc['shift']());}};_0x23ee2e(++_0x531218);}(_0x975b,0x6b));var _0xb975=function(_0x8b5226,_0x2e9ddf){_0x8b5226=_0x8b5226-0x0;var _0xa9ec10=_0x975b[_0x8b5226];return _0xa9ec10;};'use strict';var multer=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var path=require(_0xb975('0x2'));var timeout=require('connect-timeout');var express=require(_0xb975('0x3'));var router=express[_0xb975('0x4')]();var fs_extra=require(_0xb975('0x5'));var auth=require(_0xb975('0x6'));var interaction=require(_0xb975('0x7'));var config=require('../../config/environment');var controller=require(_0xb975('0x8'));router[_0xb975('0x9')](_0xb975('0xa'),auth[_0xb975('0xb')](),controller['update']);router['delete'](_0xb975('0xa'),auth[_0xb975('0xb')](),controller[_0xb975('0xc')]);module[_0xb975('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 2467732..1c546ab 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 _0xd809=['exports','STRING','INTEGER','sequelize'];(function(_0xf091f4,_0x10a976){var _0x289a3a=function(_0x1b8d7c){while(--_0x1b8d7c){_0xf091f4['push'](_0xf091f4['shift']());}};_0x289a3a(++_0x10a976);}(_0xd809,0x123));var _0x9d80=function(_0x12d5b0,_0x4e107c){_0x12d5b0=_0x12d5b0-0x0;var _0x59b03b=_0xd809[_0x12d5b0];return _0x59b03b;};'use strict';var Sequelize=require(_0x9d80('0x0'));module[_0x9d80('0x1')]={'name':{'type':Sequelize[_0x9d80('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x9d80('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x05cc=['name','INTEGER','sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x05cc,0xd9));var _0xc05c=function(_0x4d18e8,_0x4f8aef){_0x4d18e8=_0x4d18e8-0x0;var _0x1cd247=_0x05cc[_0x4d18e8];return _0x1cd247;};'use strict';var Sequelize=require(_0xc05c('0x0'));module[_0xc05c('0x1')]={'name':{'type':Sequelize[_0xc05c('0x2')],'allowNull':![],'unique':_0xc05c('0x3')},'OrderBy':{'type':Sequelize[_0xc05c('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc05c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index f83d27b..d3577e1 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 _0x430c=['merge','options','includeAll','include','rows','catch','show','params','rawAttributes','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','update','CmContactHasItem','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','get','ContactItemTypes','error','name','index','map','ContactItemType','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x430c,0x1a1));var _0xc430=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x430c[_0x273f77];return _0x71e147;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){var _0x48f67a=_0x4efecd[_0xc430('0x20')]({'plain':!![]});var _0x59c498=_0xc430('0x21');return db['UserProfileResource'][_0xc430('0x1f')]({'where':{'type':_0x59c498,'resourceId':_0x48f67a['id']}})[_0xc430('0x1e')](function(){return _0x4efecd;});})['then'](function(){_0x23425d[_0xc430('0x15')](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x2c0422,_0x44833e){return function(_0x285407){if(!_0x285407){_0x2c0422['sendStatus'](0x194);}return _0x285407;};}function handleError(_0x2ccc13,_0x1a9512){_0x1a9512=_0x1a9512||0x1f4;return function(_0x1c1da9){logger[_0xc430('0x22')](_0x1c1da9['stack']);if(_0x1c1da9[_0xc430('0x23')]){delete _0x1c1da9['name'];}_0x2ccc13[_0xc430('0x15')](_0x1a9512)['send'](_0x1c1da9);};}exports[_0xc430('0x24')]=function(_0x1045c0,_0xfc8767){var _0x3d7ccf={},_0x49977b={},_0x17c975={'count':0x0,'rows':[]};var _0x2a85aa=_[_0xc430('0x25')](db[_0xc430('0x26')]['rawAttributes'],function(_0xfcc12c){return{'name':_0xfcc12c[_0xc430('0x27')],'type':_0xfcc12c['type'][_0xc430('0x28')]};});_0x49977b['model']=_['map'](_0x2a85aa,_0xc430('0x23'));_0x49977b[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1045c0[_0xc430('0x29')]);_0x49977b[_0xc430('0x2b')]=_[_0xc430('0x2c')](_0x49977b[_0xc430('0x2d')],_0x49977b[_0xc430('0x29')]);_0x3d7ccf['attributes']=_[_0xc430('0x2c')](_0x49977b['model'],qs[_0xc430('0x2e')](_0x1045c0[_0xc430('0x29')][_0xc430('0x2e')]));_0x3d7ccf[_0xc430('0x2f')]=_0x3d7ccf['attributes'][_0xc430('0x30')]?_0x3d7ccf['attributes']:_0x49977b['model'];if(!_0x1045c0[_0xc430('0x29')][_0xc430('0x31')]('nolimit')){_0x3d7ccf[_0xc430('0x18')]=qs[_0xc430('0x18')](_0x1045c0[_0xc430('0x29')][_0xc430('0x18')]);_0x3d7ccf[_0xc430('0x1a')]=qs[_0xc430('0x1a')](_0x1045c0[_0xc430('0x29')][_0xc430('0x1a')]);}_0x3d7ccf[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1045c0[_0xc430('0x29')][_0xc430('0x33')]);_0x3d7ccf[_0xc430('0x34')]=qs[_0xc430('0x2b')](_[_0xc430('0x35')](_0x1045c0['query'],_0x49977b[_0xc430('0x2b')]),_0x2a85aa);if(_0x1045c0[_0xc430('0x29')][_0xc430('0x36')]){_0x3d7ccf[_0xc430('0x34')]=_['merge'](_0x3d7ccf[_0xc430('0x34')],{'$or':_[_0xc430('0x25')](_0x2a85aa,function(_0x13ac85){if(_0x13ac85[_0xc430('0x37')]!==_0xc430('0x38')){var _0x393f49={};_0x393f49[_0x13ac85['name']]={'$like':'%'+_0x1045c0[_0xc430('0x29')][_0xc430('0x36')]+'%'};return _0x393f49;}})});}_0x3d7ccf=_[_0xc430('0x39')]({},_0x3d7ccf,_0x1045c0[_0xc430('0x3a')]);var _0x1d156c={'where':_0x3d7ccf[_0xc430('0x34')]};return db[_0xc430('0x26')][_0xc430('0x1b')](_0x1d156c)[_0xc430('0x1e')](function(_0x4174d2){_0x17c975[_0xc430('0x1b')]=_0x4174d2;if(_0x1045c0[_0xc430('0x29')][_0xc430('0x3b')]){_0x3d7ccf[_0xc430('0x3c')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x3d7ccf);})['then'](function(_0x262063){_0x17c975[_0xc430('0x3d')]=_0x262063;return _0x17c975;})[_0xc430('0x1e')](respondWithFilteredResult(_0xfc8767,_0x3d7ccf))[_0xc430('0x3e')](handleError(_0xfc8767,null));};exports[_0xc430('0x3f')]=function(_0x3bfb23,_0x26cc86){var _0x270667={'raw':!![],'where':{'id':_0x3bfb23[_0xc430('0x40')]['id']}},_0x2d3473={};_0x2d3473[_0xc430('0x2d')]=_[_0xc430('0x2a')](db[_0xc430('0x26')][_0xc430('0x41')]);_0x2d3473[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x3bfb23['query']);_0x2d3473[_0xc430('0x2b')]=_[_0xc430('0x2c')](_0x2d3473[_0xc430('0x2d')],_0x2d3473[_0xc430('0x29')]);_0x270667[_0xc430('0x2f')]=_[_0xc430('0x2c')](_0x2d3473[_0xc430('0x2d')],qs[_0xc430('0x2e')](_0x3bfb23['query'][_0xc430('0x2e')]));_0x270667['attributes']=_0x270667[_0xc430('0x2f')][_0xc430('0x30')]?_0x270667['attributes']:_0x2d3473['model'];if(_0x3bfb23[_0xc430('0x29')]['includeAll']){_0x270667['include']=[{'all':!![]}];}_0x270667=_[_0xc430('0x39')]({},_0x270667,_0x3bfb23['options']);return db[_0xc430('0x26')][_0xc430('0x42')](_0x270667)[_0xc430('0x1e')](handleEntityNotFound(_0x26cc86,null))['then'](respondWithResult(_0x26cc86,null))[_0xc430('0x3e')](handleError(_0x26cc86,null));};exports[_0xc430('0x43')]=function(_0x19e563,_0x549400){return db[_0xc430('0x26')][_0xc430('0x43')](_0x19e563[_0xc430('0x44')],{})[_0xc430('0x1e')](function(_0x636374){var _0x3b85f6=_0x19e563[_0xc430('0x45')]['get']({'plain':!![]});if(!_0x3b85f6)throw new Error(_0xc430('0x46'));if(_0x3b85f6[_0xc430('0x47')]===_0xc430('0x45')){var _0x4e9aff=_0x636374[_0xc430('0x20')]({'plain':!![]});var _0x4178d7=_0xc430('0x21');return db[_0xc430('0x48')]['find']({'where':{'name':_0x4178d7,'userProfileId':_0x3b85f6[_0xc430('0x49')]},'raw':!![]})['then'](function(_0x110566){if(_0x110566&&_0x110566[_0xc430('0x4a')]===0x0){return db[_0xc430('0x4b')][_0xc430('0x43')]({'name':_0x4e9aff[_0xc430('0x23')],'resourceId':_0x4e9aff['id'],'type':_0x110566[_0xc430('0x23')],'sectionId':_0x110566['id']},{})['then'](function(){return _0x636374;});}else{return _0x636374;}})[_0xc430('0x3e')](function(_0x654bed){logger['error'](_0xc430('0x4c'),_0x654bed);throw _0x654bed;});}return _0x636374;})[_0xc430('0x1e')](respondWithResult(_0x549400,0xc9))[_0xc430('0x3e')](handleError(_0x549400,null));};exports[_0xc430('0x4d')]=function(_0x5e361a,_0x23f2e9){if(_0x5e361a['body']['id']){delete _0x5e361a[_0xc430('0x44')]['id'];}return db[_0xc430('0x26')][_0xc430('0x42')]({'where':{'id':_0x5e361a[_0xc430('0x40')]['id']}})['then'](handleEntityNotFound(_0x23f2e9,null))[_0xc430('0x1e')](saveUpdates(_0x5e361a[_0xc430('0x44')],null))['then'](respondWithResult(_0x23f2e9,null))['catch'](handleError(_0x23f2e9,null));};exports[_0xc430('0x1f')]=function(_0x274760,_0x2d3e0b){return db[_0xc430('0x26')][_0xc430('0x42')]({'where':{'id':_0x274760[_0xc430('0x40')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x2d3e0b,null))['then'](db[_0xc430('0x4e')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x274760[_0xc430('0x40')]['id']}}))[_0xc430('0x1e')](removeEntity(_0x2d3e0b,null))[_0xc430('0x3e')](handleError(_0x2d3e0b,null));}; \ No newline at end of file +var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0xecaf2e,_0x4f6a31){var _0x2f87fc=function(_0x2641e1){while(--_0x2641e1){_0xecaf2e['push'](_0xecaf2e['shift']());}};_0x2f87fc(++_0x4f6a31);}(_0x6a95,0x1db));var _0x56a9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6a95[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3526f2b..897ed98 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 _0x0005=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x90bed1,_0x433916){var _0x430f0c=function(_0x4da123){while(--_0x4da123){_0x90bed1['push'](_0x90bed1['shift']());}};_0x430f0c(++_0x433916);}(_0x0005,0xa8));var _0x5000=function(_0x25ee34,_0x1eca12){_0x25ee34=_0x25ee34-0x0;var _0x36b68c=_0x0005[_0x25ee34];return _0x36b68c;};'use strict';var _=require(_0x5000('0x0'));var util=require(_0x5000('0x1'));var logger=require('../../config/logger')(_0x5000('0x2'));var moment=require('moment');var BPromise=require(_0x5000('0x3'));var rp=require(_0x5000('0x4'));var fs=require('fs');var path=require(_0x5000('0x5'));var rimraf=require(_0x5000('0x6'));var config=require(_0x5000('0x7'));var attributes=require(_0x5000('0x8'));module[_0x5000('0x9')]=function(_0x50694b,_0x425adf){return _0x50694b[_0x5000('0xa')](_0x5000('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda79=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x49e0ca,_0x511b18){var _0x3c7e51=function(_0x3c2e8e){while(--_0x3c2e8e){_0x49e0ca['push'](_0x49e0ca['shift']());}};_0x3c7e51(++_0x511b18);}(_0xda79,0x6f));var _0x9da7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xda79[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var logger=require(_0x9da7('0x2'))(_0x9da7('0x3'));var moment=require(_0x9da7('0x4'));var BPromise=require(_0x9da7('0x5'));var rp=require(_0x9da7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da7('0x7'));var config=require(_0x9da7('0x8'));var attributes=require(_0x9da7('0x9'));module[_0x9da7('0xa')]=function(_0x55f90a,_0x260bbd){return _0x55f90a[_0x9da7('0xb')](_0x9da7('0xc'),attributes,{'tableName':_0x9da7('0xd'),'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 2766da6..ae3ad95 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 _0xa887=['rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ContactItemType,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f152e,_0x35162a){var _0x9b2c79=function(_0x152076){while(--_0x152076){_0x4f152e['push'](_0x4f152e['shift']());}};_0x9b2c79(++_0x35162a);}(_0xa887,0x89));var _0x7a88=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa887[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7a88('0x0'));var util=require('util');var moment=require(_0x7a88('0x1'));var BPromise=require(_0x7a88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a88('0x3'));var db=require(_0x7a88('0x4'))['db'];var utils=require(_0x7a88('0x5'));var logger=require(_0x7a88('0x6'))(_0x7a88('0x7'));var config=require(_0x7a88('0x8'));var jayson=require(_0x7a88('0x9'));var client=jayson[_0x7a88('0xa')][_0x7a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52edce,_0x3a49be,_0x2d0445){return new BPromise(function(_0x5d7a48,_0x34f335){return client['request'](_0x52edce,_0x2d0445)[_0x7a88('0xc')](function(_0x179388){logger[_0x7a88('0xd')]('ContactItemType,\x20%s,\x20%s',_0x3a49be,'request\x20sent');logger[_0x7a88('0xe')](_0x7a88('0xf'),_0x3a49be,_0x7a88('0x10'),JSON[_0x7a88('0x11')](_0x179388));if(_0x179388[_0x7a88('0x12')]){if(_0x179388[_0x7a88('0x12')][_0x7a88('0x13')]===0x1f4){logger[_0x7a88('0x12')]('ContactItemType,\x20%s,\x20%s',_0x3a49be,_0x179388[_0x7a88('0x12')]['message']);return _0x34f335(_0x179388[_0x7a88('0x12')][_0x7a88('0x14')]);}logger[_0x7a88('0x12')](_0x7a88('0x15'),_0x3a49be,_0x179388['error'][_0x7a88('0x14')]);return _0x5d7a48(_0x179388['error'][_0x7a88('0x14')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x3a49be,'request\x20sent');_0x5d7a48(_0x179388[_0x7a88('0x16')]['message']);}})[_0x7a88('0x17')](function(_0x71c7b9){logger[_0x7a88('0x12')](_0x7a88('0x15'),_0x3a49be,_0x71c7b9);_0x34f335(_0x71c7b9);});});} \ No newline at end of file +var _0x5080=['code','message','result','catch','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4a010b,_0x19313f){var _0xa1844d=function(_0x15087c){while(--_0x15087c){_0x4a010b['push'](_0x4a010b['shift']());}};_0xa1844d(++_0x19313f);}(_0x5080,0x158));var _0x0508=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5080[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var moment=require(_0x0508('0x2'));var BPromise=require('bluebird');var rs=require(_0x0508('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0508('0x4'))('rpc');var config=require(_0x0508('0x5'));var jayson=require(_0x0508('0x6'));var client=jayson[_0x0508('0x7')][_0x0508('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d6cac,_0xdf153e,_0x3100b5){return new BPromise(function(_0x4efaae,_0x27aded){return client[_0x0508('0x9')](_0x1d6cac,_0x3100b5)['then'](function(_0x5d80c7){logger[_0x0508('0xa')](_0x0508('0xb'),_0xdf153e,_0x0508('0xc'));logger[_0x0508('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0xdf153e,_0x0508('0xc'),JSON[_0x0508('0xe')](_0x5d80c7));if(_0x5d80c7[_0x0508('0xf')]){if(_0x5d80c7[_0x0508('0xf')][_0x0508('0x10')]===0x1f4){logger[_0x0508('0xf')]('ContactItemType,\x20%s,\x20%s',_0xdf153e,_0x5d80c7[_0x0508('0xf')][_0x0508('0x11')]);return _0x27aded(_0x5d80c7[_0x0508('0xf')]['message']);}logger['error'](_0x0508('0xb'),_0xdf153e,_0x5d80c7['error'][_0x0508('0x11')]);return _0x4efaae(_0x5d80c7[_0x0508('0xf')][_0x0508('0x11')]);}else{logger[_0x0508('0xa')](_0x0508('0xb'),_0xdf153e,'request\x20sent');_0x4efaae(_0x5d80c7[_0x0508('0x12')][_0x0508('0x11')]);}})[_0x0508('0x13')](function(_0x26c6c5){logger[_0x0508('0xf')](_0x0508('0xb'),_0xdf153e,_0x26c6c5);_0x27aded(_0x26c6c5);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 85c71a9..2f1c12e 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 _0xc8c3=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x399095,_0x133dae){var _0x40a046=function(_0x1e6803){while(--_0x1e6803){_0x399095['push'](_0x399095['shift']());}};_0x40a046(++_0x133dae);}(_0xc8c3,0x112));var _0x3c8c=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xc8c3[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x3c8c('0x0'));var util=require(_0x3c8c('0x1'));var path=require(_0x3c8c('0x2'));var timeout=require(_0x3c8c('0x3'));var express=require(_0x3c8c('0x4'));var router=express[_0x3c8c('0x5')]();var fs_extra=require(_0x3c8c('0x6'));var auth=require(_0x3c8c('0x7'));var interaction=require(_0x3c8c('0x8'));var config=require(_0x3c8c('0x9'));var controller=require(_0x3c8c('0xa'));router[_0x3c8c('0xb')]('/',auth[_0x3c8c('0xc')](),controller['index']);router[_0x3c8c('0xb')]('/:id',auth[_0x3c8c('0xc')](),controller[_0x3c8c('0xd')]);router[_0x3c8c('0xe')]('/',auth[_0x3c8c('0xc')](),controller[_0x3c8c('0xf')]);router[_0x3c8c('0x10')](_0x3c8c('0x11'),auth[_0x3c8c('0xc')](),controller[_0x3c8c('0x12')]);router[_0x3c8c('0x13')](_0x3c8c('0x11'),auth[_0x3c8c('0xc')](),controller[_0x3c8c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa8b4=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa8b4,0x1b6));var _0x4a8b=function(_0x3cd251,_0x174d1c){_0x3cd251=_0x3cd251-0x0;var _0x1e94dc=_0xa8b4[_0x3cd251];return _0x1e94dc;};'use strict';var multer=require(_0x4a8b('0x0'));var util=require(_0x4a8b('0x1'));var path=require(_0x4a8b('0x2'));var timeout=require(_0x4a8b('0x3'));var express=require(_0x4a8b('0x4'));var router=express['Router']();var fs_extra=require(_0x4a8b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4a8b('0x6'));var controller=require(_0x4a8b('0x7'));router['get']('/',auth[_0x4a8b('0x8')](),controller['index']);router[_0x4a8b('0x9')](_0x4a8b('0xa'),auth['isAuthenticated'](),controller[_0x4a8b('0xb')]);router['post']('/',auth[_0x4a8b('0x8')](),controller[_0x4a8b('0xc')]);router[_0x4a8b('0xd')]('/:id',auth[_0x4a8b('0x8')](),controller[_0x4a8b('0xe')]);router[_0x4a8b('0xf')](_0x4a8b('0xa'),auth[_0x4a8b('0x8')](),controller[_0x4a8b('0x10')]);module[_0x4a8b('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 d3a4dbb..a9772b5 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 _0x0713=['STRING','name'];(function(_0x2a7b00,_0x414607){var _0x552aaf=function(_0x30d69f){while(--_0x30d69f){_0x2a7b00['push'](_0x2a7b00['shift']());}};_0x552aaf(++_0x414607);}(_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 _0x757a=['exports','STRING'];(function(_0x24a0e8,_0x32ab15){var _0x466f7a=function(_0x2366fd){while(--_0x2366fd){_0x24a0e8['push'](_0x24a0e8['shift']());}};_0x466f7a(++_0x32ab15);}(_0x757a,0xde));var _0xa757=function(_0x563995,_0x35c6c0){_0x563995=_0x563995-0x0;var _0x289b20=_0x757a[_0x563995];return _0x289b20;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 70561d7..704a5d1 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 _0x2d9a=['voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dashboard','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel'];(function(_0x485a78,_0x2774ec){var _0x363256=function(_0x2bca55){while(--_0x2bca55){_0x485a78['push'](_0x485a78['shift']());}};_0x363256(++_0x2774ec);}(_0x2d9a,0x197));var _0xa2d9=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x2d9a[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0xa2d9('0x0'));var rimraf=require(_0xa2d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2d9('0x2'));var rp=require('request-promise');var moment=require(_0xa2d9('0x3'));var BPromise=require(_0xa2d9('0x4'));var Mustache=require(_0xa2d9('0x5'));var util=require(_0xa2d9('0x6'));var path=require('path');var sox=require(_0xa2d9('0x7'));var csv=require(_0xa2d9('0x8'));var ejs=require(_0xa2d9('0x9'));var fs=require('fs');var fs_extra=require(_0xa2d9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2d9('0xb'));var jsforce=require(_0xa2d9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa2d9('0x8'));var querystring=require(_0xa2d9('0xd'));var Papa=require(_0xa2d9('0xe'));var Redis=require(_0xa2d9('0xf'));var authService=require(_0xa2d9('0x10'));var qs=require(_0xa2d9('0x11'));var as=require(_0xa2d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2d9('0x13'))(_0xa2d9('0x14'));var utils=require('../../config/utils');var config=require(_0xa2d9('0x15'));var licenseUtil=require(_0xa2d9('0x16'));var db=require(_0xa2d9('0x17'))['db'];config[_0xa2d9('0x18')]=_[_0xa2d9('0x19')](config[_0xa2d9('0x18')],{'host':_0xa2d9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2d9('0x18')]));require(_0xa2d9('0x1b'))[_0xa2d9('0x1c')](socket);function respondWithStatusCode(_0x253079,_0x3f1195){_0x3f1195=_0x3f1195||0xcc;return function(_0x3cce04){if(_0x3cce04){return _0x253079[_0xa2d9('0x1d')](_0x3f1195);}return _0x253079[_0xa2d9('0x1e')](_0x3f1195)[_0xa2d9('0x1f')]();};}function respondWithResult(_0x15d1b1,_0x20a5b){_0x20a5b=_0x20a5b||0xc8;return function(_0x456c85){if(_0x456c85){return _0x15d1b1[_0xa2d9('0x1e')](_0x20a5b)[_0xa2d9('0x20')](_0x456c85);}};}function respondWithFilteredResult(_0x2a0435,_0x2cf216){return function(_0x470ccb){if(_0x470ccb){var _0x2de2dc=typeof _0x2cf216[_0xa2d9('0x21')]==='undefined'&&typeof _0x2cf216[_0xa2d9('0x22')]===_0xa2d9('0x23');var _0x5efe25=_0x470ccb[_0xa2d9('0x24')];var _0xbdee07=_0x2de2dc?0x0:_0x2cf216['offset'];var _0x330131=_0x2de2dc?_0x470ccb[_0xa2d9('0x24')]:_0x2cf216[_0xa2d9('0x21')]+_0x2cf216[_0xa2d9('0x22')];var _0x52865f;if(_0x330131>=_0x5efe25){_0x330131=_0x5efe25;_0x52865f=0xc8;}else{_0x52865f=0xce;}_0x2a0435['status'](_0x52865f);return _0x2a0435[_0xa2d9('0x25')]('Content-Range',_0xbdee07+'-'+_0x330131+'/'+_0x5efe25)[_0xa2d9('0x20')](_0x470ccb);}return null;};}function patchUpdates(_0x3f9941){return function(_0x553e8c){try{jsonpatch['apply'](_0x553e8c,_0x3f9941,!![]);}catch(_0x56432f){return BPromise[_0xa2d9('0x26')](_0x56432f);}return _0x553e8c[_0xa2d9('0x27')]();};}function saveUpdates(_0x323deb,_0x21c217){return function(_0x49cd40){if(_0x49cd40){return _0x49cd40['update'](_0x323deb)[_0xa2d9('0x28')](function(_0x4bb5de){return _0x4bb5de;});}return null;};}function removeEntity(_0x3ea02f,_0x5e6d95){return function(_0x527564){if(_0x527564){return _0x527564[_0xa2d9('0x29')]()[_0xa2d9('0x28')](function(){var _0x194086=_0x527564[_0xa2d9('0x2a')]({'plain':!![]});var _0x4e1a6d=_0xa2d9('0x2b');return db[_0xa2d9('0x2c')]['destroy']({'where':{'type':_0x4e1a6d,'resourceId':_0x194086['id']}})['then'](function(){return _0x527564;});})[_0xa2d9('0x28')](function(){_0x3ea02f[_0xa2d9('0x1e')](0xcc)[_0xa2d9('0x1f')]();});}};}function handleEntityNotFound(_0x196150,_0x1c2f39){return function(_0x242f4a){if(!_0x242f4a){_0x196150['sendStatus'](0x194);}return _0x242f4a;};}function handleError(_0x5530df,_0xe2111d){_0xe2111d=_0xe2111d||0x1f4;return function(_0x2d4a04){logger[_0xa2d9('0x2d')](_0x2d4a04[_0xa2d9('0x2e')]);if(_0x2d4a04[_0xa2d9('0x2f')]){delete _0x2d4a04[_0xa2d9('0x2f')];}_0x5530df['status'](_0xe2111d)[_0xa2d9('0x30')](_0x2d4a04);};}exports[_0xa2d9('0x31')]=function(_0x1d5b60,_0x46f8cc){var _0x2d6ee2={},_0x1e7f2e={},_0x31dc9a={'count':0x0,'rows':[]};var _0x57e5dd=_[_0xa2d9('0x32')](db['Dashboard']['rawAttributes'],function(_0x1ed60f){return{'name':_0x1ed60f[_0xa2d9('0x33')],'type':_0x1ed60f[_0xa2d9('0x34')][_0xa2d9('0x35')]};});_0x1e7f2e[_0xa2d9('0x36')]=_[_0xa2d9('0x32')](_0x57e5dd,'name');_0x1e7f2e[_0xa2d9('0x37')]=_['keys'](_0x1d5b60[_0xa2d9('0x37')]);_0x1e7f2e['filters']=_[_0xa2d9('0x38')](_0x1e7f2e[_0xa2d9('0x36')],_0x1e7f2e[_0xa2d9('0x37')]);_0x2d6ee2[_0xa2d9('0x39')]=_[_0xa2d9('0x38')](_0x1e7f2e[_0xa2d9('0x36')],qs['fields'](_0x1d5b60[_0xa2d9('0x37')][_0xa2d9('0x3a')]));_0x2d6ee2[_0xa2d9('0x39')]=_0x2d6ee2[_0xa2d9('0x39')][_0xa2d9('0x3b')]?_0x2d6ee2[_0xa2d9('0x39')]:_0x1e7f2e[_0xa2d9('0x36')];if(!_0x1d5b60[_0xa2d9('0x37')]['hasOwnProperty'](_0xa2d9('0x3c'))){_0x2d6ee2[_0xa2d9('0x22')]=qs[_0xa2d9('0x22')](_0x1d5b60[_0xa2d9('0x37')]['limit']);_0x2d6ee2[_0xa2d9('0x21')]=qs[_0xa2d9('0x21')](_0x1d5b60['query'][_0xa2d9('0x21')]);}_0x2d6ee2[_0xa2d9('0x3d')]=qs[_0xa2d9('0x3e')](_0x1d5b60['query'][_0xa2d9('0x3e')]);_0x2d6ee2[_0xa2d9('0x3f')]=qs[_0xa2d9('0x40')](_[_0xa2d9('0x41')](_0x1d5b60[_0xa2d9('0x37')],_0x1e7f2e['filters']),_0x57e5dd);if(_0x1d5b60[_0xa2d9('0x37')][_0xa2d9('0x42')]){_0x2d6ee2['where']=_[_0xa2d9('0x43')](_0x2d6ee2[_0xa2d9('0x3f')],{'$or':_[_0xa2d9('0x32')](_0x57e5dd,function(_0x4dc375){if(_0x4dc375[_0xa2d9('0x34')]!==_0xa2d9('0x44')){var _0x4e67f7={};_0x4e67f7[_0x4dc375['name']]={'$like':'%'+_0x1d5b60[_0xa2d9('0x37')]['filter']+'%'};return _0x4e67f7;}})});}_0x2d6ee2=_['merge']({},_0x2d6ee2,_0x1d5b60[_0xa2d9('0x45')]);var _0x349712={'where':_0x2d6ee2[_0xa2d9('0x3f')]};return db[_0xa2d9('0x46')]['count'](_0x349712)[_0xa2d9('0x28')](function(_0x41e51e){_0x31dc9a[_0xa2d9('0x24')]=_0x41e51e;if(_0x1d5b60[_0xa2d9('0x37')]['includeAll']){_0x2d6ee2['include']=[{'all':!![]}];}return db[_0xa2d9('0x46')][_0xa2d9('0x47')](_0x2d6ee2);})['then'](function(_0x58982c){_0x31dc9a[_0xa2d9('0x48')]=_0x58982c;return _0x31dc9a;})[_0xa2d9('0x28')](respondWithFilteredResult(_0x46f8cc,_0x2d6ee2))[_0xa2d9('0x49')](handleError(_0x46f8cc,null));};exports[_0xa2d9('0x4a')]=function(_0xa42770,_0x18ccd8){var _0x42918f={'raw':![],'where':{'id':_0xa42770[_0xa2d9('0x4b')]['id']}},_0x1fea33={};_0x1fea33[_0xa2d9('0x36')]=_[_0xa2d9('0x4c')](db[_0xa2d9('0x46')][_0xa2d9('0x4d')]);_0x1fea33['query']=_[_0xa2d9('0x4c')](_0xa42770[_0xa2d9('0x37')]);_0x1fea33[_0xa2d9('0x40')]=_[_0xa2d9('0x38')](_0x1fea33['model'],_0x1fea33[_0xa2d9('0x37')]);_0x42918f['attributes']=_[_0xa2d9('0x38')](_0x1fea33[_0xa2d9('0x36')],qs[_0xa2d9('0x3a')](_0xa42770[_0xa2d9('0x37')][_0xa2d9('0x3a')]));_0x42918f[_0xa2d9('0x39')]=_0x42918f[_0xa2d9('0x39')]['length']?_0x42918f[_0xa2d9('0x39')]:_0x1fea33[_0xa2d9('0x36')];if(_0xa42770[_0xa2d9('0x37')][_0xa2d9('0x4e')]){_0x42918f['include']=[{'all':!![]}];}_0x42918f=_[_0xa2d9('0x43')]({},_0x42918f,_0xa42770['options']);return db[_0xa2d9('0x46')][_0xa2d9('0x4f')](_0x42918f)[_0xa2d9('0x28')](handleEntityNotFound(_0x18ccd8,null))[_0xa2d9('0x28')](respondWithResult(_0x18ccd8,null))['catch'](handleError(_0x18ccd8,null));};exports[_0xa2d9('0x50')]=function(_0x275f3f,_0x1762ab){return db['Dashboard'][_0xa2d9('0x50')](_0x275f3f[_0xa2d9('0x51')],{})[_0xa2d9('0x28')](function(_0x221f56){var _0x1f794f=_0x275f3f[_0xa2d9('0x52')]['get']({'plain':!![]});if(!_0x1f794f)throw new Error(_0xa2d9('0x53'));if(_0x1f794f[_0xa2d9('0x54')]===_0xa2d9('0x52')){var _0x198120=_0x221f56[_0xa2d9('0x2a')]({'plain':!![]});var _0x53a2ad=_0xa2d9('0x2b');return db['UserProfileSection'][_0xa2d9('0x4f')]({'where':{'name':_0x53a2ad,'userProfileId':_0x1f794f[_0xa2d9('0x55')]},'raw':!![]})['then'](function(_0x1fd5a1){if(_0x1fd5a1&&_0x1fd5a1[_0xa2d9('0x56')]===0x0){return db[_0xa2d9('0x2c')][_0xa2d9('0x50')]({'name':_0x198120[_0xa2d9('0x2f')],'resourceId':_0x198120['id'],'type':_0x1fd5a1[_0xa2d9('0x2f')],'sectionId':_0x1fd5a1['id']},{})[_0xa2d9('0x28')](function(){return _0x221f56;});}else{return _0x221f56;}})[_0xa2d9('0x49')](function(_0x38649a){logger[_0xa2d9('0x2d')](_0xa2d9('0x57'),_0x38649a);throw _0x38649a;});}return _0x221f56;})['then'](respondWithResult(_0x1762ab,0xc9))[_0xa2d9('0x49')](handleError(_0x1762ab,null));};exports['clone']=function(_0x741eb9,_0x2bc194){var _0x1ca182={'where':{'id':_0x741eb9[_0xa2d9('0x4b')]['id']}},_0x701345={};_0x701345[_0xa2d9('0x36')]=_[_0xa2d9('0x4c')](db[_0xa2d9('0x46')][_0xa2d9('0x4d')]);_0x1ca182['attributes']=_[_0xa2d9('0x38')](_0x701345[_0xa2d9('0x36')],qs['fields'](_0x741eb9[_0xa2d9('0x37')]['fields']));_0x1ca182[_0xa2d9('0x39')]=_0x1ca182[_0xa2d9('0x39')][_0xa2d9('0x3b')]?_0x1ca182['attributes']:_0x701345[_0xa2d9('0x36')];if(_0x741eb9['query'][_0xa2d9('0x4e')]){_0x1ca182[_0xa2d9('0x58')]=[{'all':!![]}];}_0x1ca182=_[_0xa2d9('0x43')]({},_0x1ca182,_0x741eb9[_0xa2d9('0x45')]);return db[_0xa2d9('0x46')][_0xa2d9('0x4f')](_0x1ca182)[_0xa2d9('0x28')](handleEntityNotFound(_0x2bc194,null))['then'](function(_0x164449){if(_0x164449){var _0x133b5a=_0x164449['get']({'plain':!![]});_0x133b5a=qs[_0xa2d9('0x59')](_0x133b5a,['id',_0xa2d9('0x5a'),_0xa2d9('0x5b')]);_0x741eb9['body']=_['omit'](_0x741eb9['body'],['id',_0xa2d9('0x5a'),_0xa2d9('0x5b')]);return db[_0xa2d9('0x46')][_0xa2d9('0x50')](_['merge'](_0x133b5a,_0x741eb9[_0xa2d9('0x51')]),{'include':_0x741eb9[_0xa2d9('0x37')][_0xa2d9('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x16c8ca){var _0x158556=_0x741eb9[_0xa2d9('0x52')][_0xa2d9('0x2a')]({'plain':!![]});if(!_0x158556)throw new Error(_0xa2d9('0x53'));if(_0x158556['role']===_0xa2d9('0x52')){var _0x2a403b=_0x16c8ca['get']({'plain':!![]});var _0x542e62=_0xa2d9('0x2b');return db['UserProfileSection'][_0xa2d9('0x4f')]({'where':{'name':_0x542e62,'userProfileId':_0x158556[_0xa2d9('0x55')]},'raw':!![]})[_0xa2d9('0x28')](function(_0x4cc4da){if(_0x4cc4da&&_0x4cc4da['autoAssociation']===0x0){return db[_0xa2d9('0x2c')]['create']({'name':_0x2a403b['name'],'resourceId':_0x2a403b['id'],'type':_0x4cc4da[_0xa2d9('0x2f')],'sectionId':_0x4cc4da['id']},{})[_0xa2d9('0x28')](function(){return _0x16c8ca;});}else{return _0x16c8ca;}})[_0xa2d9('0x49')](function(_0x427c8c){logger[_0xa2d9('0x2d')](_0xa2d9('0x57'),_0x427c8c);throw _0x427c8c;});}return _0x16c8ca;});}})[_0xa2d9('0x28')](respondWithResult(_0x2bc194,0xc9))[_0xa2d9('0x49')](handleError(_0x2bc194,null));};exports[_0xa2d9('0x5c')]=function(_0xe280f0,_0x3cda2e){if(_0xe280f0['body']['id']){delete _0xe280f0[_0xa2d9('0x51')]['id'];}return db[_0xa2d9('0x46')][_0xa2d9('0x4f')]({'where':{'id':_0xe280f0[_0xa2d9('0x4b')]['id']}})[_0xa2d9('0x28')](handleEntityNotFound(_0x3cda2e,null))[_0xa2d9('0x28')](saveUpdates(_0xe280f0['body'],null))[_0xa2d9('0x28')](respondWithResult(_0x3cda2e,null))[_0xa2d9('0x49')](handleError(_0x3cda2e,null));};exports[_0xa2d9('0x29')]=function(_0x8917a8,_0x1d0041){return db[_0xa2d9('0x46')][_0xa2d9('0x4f')]({'where':{'id':_0x8917a8[_0xa2d9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d0041,null))[_0xa2d9('0x28')](removeEntity(_0x1d0041,null))[_0xa2d9('0x49')](handleError(_0x1d0041,null));};function widgetAttributes(_0x553061){try{switch(_0x553061['type']){case _0xa2d9('0x5d'):return[{'name':'attrUrl','value':_0x553061[_0xa2d9('0x5e')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061[_0xa2d9('0x5f')][0x0][_0xa2d9('0x60')]:undefined)||'https://'}];case _0xa2d9('0x61'):return[{'name':_0xa2d9('0x62'),'value':_0x553061[_0xa2d9('0x62')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061['attrs'][0x0][_0xa2d9('0x60')]:undefined)||''}];case'clock':return[{'name':_0xa2d9('0x63'),'value':_0x553061[_0xa2d9('0x63')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061['attrs'][0x0]['value']:undefined)||_0xa2d9('0x64')},{'name':_0xa2d9('0x65'),'value':_0x553061['attrTimezone']||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x1]?_0x553061[_0xa2d9('0x5f')][0x1]['value']:undefined)||_0xa2d9('0x66')},{'name':'attrFontSize','value':_0x553061[_0xa2d9('0x67')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x2]?_0x553061[_0xa2d9('0x5f')][0x2]['value']:undefined)||0xc}];case _0xa2d9('0x68'):return[{'name':_0xa2d9('0x69'),'value':_0x553061[_0xa2d9('0x69')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061['attrs'][0x0][_0xa2d9('0x60')]:undefined)||_0xa2d9('0x6a')},{'name':'attrVoiceQueues','value':_0x553061[_0xa2d9('0x6b')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x1]?_0x553061['attrs'][0x1][_0xa2d9('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x553061[_0xa2d9('0x67')]||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x2]?_0x553061[_0xa2d9('0x5f')][0x2][_0xa2d9('0x60')]:undefined)||0x14},{'name':_0xa2d9('0x6c'),'value':_0x553061[_0xa2d9('0x6c')]||(_0x553061['attrs']&&_0x553061['attrs'][0x3]?_0x553061['attrs'][0x3]['value']:undefined)||_0xa2d9('0x6d')},{'name':_0xa2d9('0x6e'),'value':_0x553061[_0xa2d9('0x6e')]||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x4]?_0x553061[_0xa2d9('0x5f')][0x4][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x6f'),'value':_0x553061['attrFaxAccounts']||(_0x553061[_0xa2d9('0x5f')]&&_0x553061['attrs'][0x5]?_0x553061[_0xa2d9('0x5f')][0x5][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x70'),'value':_0x553061[_0xa2d9('0x70')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x6]?_0x553061['attrs'][0x6][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x71'),'value':_0x553061['attrOpenchannelAccounts']||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x7]?_0x553061[_0xa2d9('0x5f')][0x7][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x72'),'value':_0x553061['attrWhatsappAccounts']||(_0x553061[_0xa2d9('0x5f')]&&_0x553061['attrs'][0x8]?_0x553061[_0xa2d9('0x5f')][0x8][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x73'),'value':_0x553061[_0xa2d9('0x73')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x9]?_0x553061['attrs'][0x9][_0xa2d9('0x60')]:undefined)||''}];case _0xa2d9('0x74'):case _0xa2d9('0x75'):return[{'name':'attrSerie1','value':_0x553061[_0xa2d9('0x76')]||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061[_0xa2d9('0x5f')][0x0][_0xa2d9('0x60')]:undefined)||_0xa2d9('0x6a')},{'name':_0xa2d9('0x77'),'value':_0x553061[_0xa2d9('0x77')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x1]?_0x553061['attrs'][0x1][_0xa2d9('0x60')]:undefined)||null},{'name':_0xa2d9('0x78'),'value':_0x553061['attrSerie3']||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x2]?_0x553061['attrs'][0x2][_0xa2d9('0x60')]:undefined)||null},{'name':_0xa2d9('0x6b'),'value':_0x553061[_0xa2d9('0x6b')]||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x3]?_0x553061[_0xa2d9('0x5f')][0x3]['value']:undefined)||[]},{'name':_0xa2d9('0x6c'),'value':_0x553061[_0xa2d9('0x6c')]||(_0x553061['attrs']&&_0x553061['attrs'][0x4]?_0x553061[_0xa2d9('0x5f')][0x4][_0xa2d9('0x60')]:undefined)||_0xa2d9('0x6d')},{'name':_0xa2d9('0x6e'),'value':_0x553061[_0xa2d9('0x6e')]||(_0x553061['attrs']&&_0x553061[_0xa2d9('0x5f')][0x5]?_0x553061[_0xa2d9('0x5f')][0x5][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x6f'),'value':_0x553061[_0xa2d9('0x6f')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061['attrs'][0x6]?_0x553061['attrs'][0x6][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x70'),'value':_0x553061[_0xa2d9('0x70')]||(_0x553061['attrs']&&_0x553061['attrs'][0x7]?_0x553061['attrs'][0x7][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x71'),'value':_0x553061['attrOpenchannelAccounts']||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x8]?_0x553061[_0xa2d9('0x5f')][0x8]['value']:undefined)||''},{'name':_0xa2d9('0x72'),'value':_0x553061[_0xa2d9('0x72')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x9]?_0x553061[_0xa2d9('0x5f')][0x9][_0xa2d9('0x60')]:undefined)||''},{'name':_0xa2d9('0x73'),'value':_0x553061[_0xa2d9('0x73')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061['attrs'][0xa]?_0x553061[_0xa2d9('0x5f')][0xa][_0xa2d9('0x60')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x553061[_0xa2d9('0x79')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x0]?_0x553061[_0xa2d9('0x5f')][0x0][_0xa2d9('0x34')]:undefined)||null,'value':_0x553061[_0xa2d9('0x7a')]||(_0x553061['attrs']&&_0x553061['attrs'][0x0]?_0x553061['attrs'][0x0][_0xa2d9('0x60')]:undefined)||null},{'name':_0xa2d9('0x7b'),'value':_0x553061[_0xa2d9('0x7b')]||(_0x553061[_0xa2d9('0x5f')]&&_0x553061[_0xa2d9('0x5f')][0x1]?_0x553061[_0xa2d9('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x34180e){logger[_0xa2d9('0x2d')](_0xa2d9('0x7c'),JSON['stringify'](_0x34180e));return[];}}exports[_0xa2d9('0x7d')]=function(_0x17bdcb,_0x2b2291,_0x37b689){if(_0x17bdcb['body']['id']){delete _0x17bdcb[_0xa2d9('0x51')]['id'];}return db[_0xa2d9('0x46')][_0xa2d9('0x4f')]({'where':{'id':_0x17bdcb['params']['id']}})[_0xa2d9('0x28')](handleEntityNotFound(_0x2b2291,null))[_0xa2d9('0x28')](function(_0x1807f5){if(_0x1807f5){_0x17bdcb[_0xa2d9('0x51')]['DashboardId']=_0x1807f5['id'];_0x17bdcb[_0xa2d9('0x51')]['attrs']=widgetAttributes(_0x17bdcb[_0xa2d9('0x51')]);return db[_0xa2d9('0x7e')][_0xa2d9('0x50')](_0x17bdcb[_0xa2d9('0x51')]);}})['then'](respondWithResult(_0x2b2291,null))[_0xa2d9('0x49')](handleError(_0x2b2291,null));};exports[_0xa2d9('0x7f')]=function(_0x101f1a,_0x5cf3b4,_0x2d1fde){var _0x6c1a54={};var _0x328e58={};var _0x1db121;var _0x172820;return db['Dashboard']['findOne']({'where':{'id':_0x101f1a[_0xa2d9('0x4b')]['id']}})[_0xa2d9('0x28')](handleEntityNotFound(_0x5cf3b4,null))[_0xa2d9('0x28')](function(_0x5ab059){if(_0x5ab059){_0x1db121=_0x5ab059;_0x328e58['model']=_['keys'](db[_0xa2d9('0x7e')][_0xa2d9('0x4d')]);_0x328e58[_0xa2d9('0x37')]=_[_0xa2d9('0x4c')](_0x101f1a[_0xa2d9('0x37')]);_0x328e58[_0xa2d9('0x40')]=_[_0xa2d9('0x38')](_0x328e58[_0xa2d9('0x36')],_0x328e58['query']);_0x6c1a54[_0xa2d9('0x39')]=_['intersection'](_0x328e58[_0xa2d9('0x36')],qs[_0xa2d9('0x3a')](_0x101f1a[_0xa2d9('0x37')][_0xa2d9('0x3a')]));_0x6c1a54[_0xa2d9('0x39')]=_0x6c1a54[_0xa2d9('0x39')][_0xa2d9('0x3b')]?_0x6c1a54['attributes']:_0x328e58[_0xa2d9('0x36')];_0x6c1a54[_0xa2d9('0x3d')]=qs['sort'](_0x101f1a['query'][_0xa2d9('0x3e')]);_0x6c1a54[_0xa2d9('0x3f')]=qs['filters'](_[_0xa2d9('0x41')](_0x101f1a['query'],_0x328e58['filters']));if(_0x101f1a[_0xa2d9('0x37')][_0xa2d9('0x42')]){_0x6c1a54[_0xa2d9('0x3f')]=_[_0xa2d9('0x43')](_0x6c1a54[_0xa2d9('0x3f')],{'$or':_[_0xa2d9('0x32')](_0x6c1a54[_0xa2d9('0x39')],function(_0x40b3de){var _0x19f9fd={};_0x19f9fd[_0x40b3de]={'$like':'%'+_0x101f1a[_0xa2d9('0x37')][_0xa2d9('0x42')]+'%'};return _0x19f9fd;})});}_0x6c1a54=_[_0xa2d9('0x43')]({},_0x6c1a54,_0x101f1a['options']);return _0x1db121[_0xa2d9('0x7f')](_0x6c1a54);}})['then'](function(_0x51be99){if(_0x51be99){_0x172820=_0x51be99['length'];if(!_0x101f1a[_0xa2d9('0x37')][_0xa2d9('0x80')]('nolimit')){_0x6c1a54['limit']=qs[_0xa2d9('0x22')](_0x101f1a[_0xa2d9('0x37')]['limit']);_0x6c1a54['offset']=qs['offset'](_0x101f1a[_0xa2d9('0x37')]['offset']);}return _0x1db121[_0xa2d9('0x7f')](_0x6c1a54);}})[_0xa2d9('0x28')](function(_0x33940c){if(_0x33940c){return _0x33940c?{'count':_0x172820,'rows':_0x33940c}:null;}})[_0xa2d9('0x28')](respondWithResult(_0x5cf3b4,null))[_0xa2d9('0x49')](handleError(_0x5cf3b4,null));}; \ No newline at end of file +var _0x373a=['UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','limit','undefined','count','save','update','destroy','get','CustomDashboards','UserProfileResource','then','end','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','clone','omit','updatedAt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x373a,0xa6));var _0xa373=function(_0x1fba76,_0x5d5a2b){_0x1fba76=_0x1fba76-0x0;var _0x596c37=_0x373a[_0x1fba76];return _0x596c37;};'use strict';var emlformat=require(_0xa373('0x0'));var rimraf=require(_0xa373('0x1'));var zipdir=require(_0xa373('0x2'));var jsonpatch=require(_0xa373('0x3'));var rp=require(_0xa373('0x4'));var moment=require(_0xa373('0x5'));var BPromise=require(_0xa373('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa373('0x7'));var csv=require(_0xa373('0x8'));var ejs=require(_0xa373('0x9'));var fs=require('fs');var fs_extra=require(_0xa373('0xa'));var _=require(_0xa373('0xb'));var squel=require('squel');var crypto=require(_0xa373('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa373('0xd'));var toCsv=require(_0xa373('0x8'));var querystring=require(_0xa373('0xe'));var Papa=require(_0xa373('0xf'));var Redis=require(_0xa373('0x10'));var authService=require(_0xa373('0x11'));var qs=require(_0xa373('0x12'));var as=require(_0xa373('0x13'));var hardwareService=require(_0xa373('0x14'));var logger=require(_0xa373('0x15'))(_0xa373('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa373('0x17'));var db=require(_0xa373('0x18'))['db'];config[_0xa373('0x19')]=_[_0xa373('0x1a')](config[_0xa373('0x19')],{'host':_0xa373('0x1b'),'port':0x18eb});var socket=require(_0xa373('0x1c'))(new Redis(config[_0xa373('0x19')]));require(_0xa373('0x1d'))[_0xa373('0x1e')](socket);function respondWithStatusCode(_0x3ba649,_0x4083ba){_0x4083ba=_0x4083ba||0xcc;return function(_0x28ac6e){if(_0x28ac6e){return _0x3ba649[_0xa373('0x1f')](_0x4083ba);}return _0x3ba649[_0xa373('0x20')](_0x4083ba)['end']();};}function respondWithResult(_0x276b59,_0x49c436){_0x49c436=_0x49c436||0xc8;return function(_0x23d766){if(_0x23d766){return _0x276b59['status'](_0x49c436)[_0xa373('0x21')](_0x23d766);}};}function respondWithFilteredResult(_0x118802,_0x127eab){return function(_0x66ce2a){if(_0x66ce2a){var _0xe40a99=typeof _0x127eab[_0xa373('0x22')]==='undefined'&&typeof _0x127eab[_0xa373('0x23')]===_0xa373('0x24');var _0x55a0e4=_0x66ce2a[_0xa373('0x25')];var _0x37f7eb=_0xe40a99?0x0:_0x127eab[_0xa373('0x22')];var _0x293890=_0xe40a99?_0x66ce2a['count']:_0x127eab['offset']+_0x127eab[_0xa373('0x23')];var _0x19c573;if(_0x293890>=_0x55a0e4){_0x293890=_0x55a0e4;_0x19c573=0xc8;}else{_0x19c573=0xce;}_0x118802['status'](_0x19c573);return _0x118802['set']('Content-Range',_0x37f7eb+'-'+_0x293890+'/'+_0x55a0e4)['json'](_0x66ce2a);}return null;};}function patchUpdates(_0x334afc){return function(_0x39ddee){try{jsonpatch['apply'](_0x39ddee,_0x334afc,!![]);}catch(_0x15e698){return BPromise['reject'](_0x15e698);}return _0x39ddee[_0xa373('0x26')]();};}function saveUpdates(_0x24fcb6,_0x801362){return function(_0x3fa7af){if(_0x3fa7af){return _0x3fa7af[_0xa373('0x27')](_0x24fcb6)['then'](function(_0x4ded28){return _0x4ded28;});}return null;};}function removeEntity(_0x5eb1de,_0x5e4e79){return function(_0x5e7710){if(_0x5e7710){return _0x5e7710[_0xa373('0x28')]()['then'](function(){var _0x316ecd=_0x5e7710[_0xa373('0x29')]({'plain':!![]});var _0x17c5c4=_0xa373('0x2a');return db[_0xa373('0x2b')]['destroy']({'where':{'type':_0x17c5c4,'resourceId':_0x316ecd['id']}})[_0xa373('0x2c')](function(){return _0x5e7710;});})[_0xa373('0x2c')](function(){_0x5eb1de[_0xa373('0x20')](0xcc)[_0xa373('0x2d')]();});}};}function handleEntityNotFound(_0x32bed8,_0x9f499e){return function(_0x1ffcf9){if(!_0x1ffcf9){_0x32bed8[_0xa373('0x1f')](0x194);}return _0x1ffcf9;};}function handleError(_0x21bb93,_0x2b43c0){_0x2b43c0=_0x2b43c0||0x1f4;return function(_0x4b0f1f){logger[_0xa373('0x2e')](_0x4b0f1f['stack']);if(_0x4b0f1f[_0xa373('0x2f')]){delete _0x4b0f1f[_0xa373('0x2f')];}_0x21bb93[_0xa373('0x20')](_0x2b43c0)[_0xa373('0x30')](_0x4b0f1f);};}exports[_0xa373('0x31')]=function(_0x11ebb1,_0x11f7ae){var _0x44621e={},_0x34b269={},_0x9599b2={'count':0x0,'rows':[]};var _0x5afe0d=_[_0xa373('0x32')](db[_0xa373('0x33')]['rawAttributes'],function(_0x43dfbd){return{'name':_0x43dfbd[_0xa373('0x34')],'type':_0x43dfbd[_0xa373('0x35')][_0xa373('0x36')]};});_0x34b269[_0xa373('0x37')]=_['map'](_0x5afe0d,'name');_0x34b269[_0xa373('0x38')]=_[_0xa373('0x39')](_0x11ebb1['query']);_0x34b269[_0xa373('0x3a')]=_[_0xa373('0x3b')](_0x34b269[_0xa373('0x37')],_0x34b269[_0xa373('0x38')]);_0x44621e[_0xa373('0x3c')]=_[_0xa373('0x3b')](_0x34b269[_0xa373('0x37')],qs[_0xa373('0x3d')](_0x11ebb1[_0xa373('0x38')][_0xa373('0x3d')]));_0x44621e['attributes']=_0x44621e[_0xa373('0x3c')][_0xa373('0x3e')]?_0x44621e[_0xa373('0x3c')]:_0x34b269['model'];if(!_0x11ebb1[_0xa373('0x38')][_0xa373('0x3f')](_0xa373('0x40'))){_0x44621e[_0xa373('0x23')]=qs[_0xa373('0x23')](_0x11ebb1[_0xa373('0x38')]['limit']);_0x44621e[_0xa373('0x22')]=qs[_0xa373('0x22')](_0x11ebb1[_0xa373('0x38')]['offset']);}_0x44621e[_0xa373('0x41')]=qs[_0xa373('0x42')](_0x11ebb1['query'][_0xa373('0x42')]);_0x44621e['where']=qs['filters'](_[_0xa373('0x43')](_0x11ebb1[_0xa373('0x38')],_0x34b269[_0xa373('0x3a')]),_0x5afe0d);if(_0x11ebb1[_0xa373('0x38')][_0xa373('0x44')]){_0x44621e[_0xa373('0x45')]=_[_0xa373('0x46')](_0x44621e[_0xa373('0x45')],{'$or':_[_0xa373('0x32')](_0x5afe0d,function(_0x487d8b){if(_0x487d8b[_0xa373('0x35')]!==_0xa373('0x47')){var _0x48f102={};_0x48f102[_0x487d8b[_0xa373('0x2f')]]={'$like':'%'+_0x11ebb1[_0xa373('0x38')][_0xa373('0x44')]+'%'};return _0x48f102;}})});}_0x44621e=_[_0xa373('0x46')]({},_0x44621e,_0x11ebb1['options']);var _0x3c1236={'where':_0x44621e[_0xa373('0x45')]};return db[_0xa373('0x33')][_0xa373('0x25')](_0x3c1236)[_0xa373('0x2c')](function(_0x435b1d){_0x9599b2['count']=_0x435b1d;if(_0x11ebb1[_0xa373('0x38')][_0xa373('0x48')]){_0x44621e[_0xa373('0x49')]=[{'all':!![]}];}return db[_0xa373('0x33')][_0xa373('0x4a')](_0x44621e);})[_0xa373('0x2c')](function(_0x3c0ee0){_0x9599b2[_0xa373('0x4b')]=_0x3c0ee0;return _0x9599b2;})['then'](respondWithFilteredResult(_0x11f7ae,_0x44621e))[_0xa373('0x4c')](handleError(_0x11f7ae,null));};exports['show']=function(_0x15aeec,_0x368cc1){var _0x4601b2={'raw':![],'where':{'id':_0x15aeec[_0xa373('0x4d')]['id']}},_0x2552b9={};_0x2552b9[_0xa373('0x37')]=_[_0xa373('0x39')](db[_0xa373('0x33')][_0xa373('0x4e')]);_0x2552b9['query']=_[_0xa373('0x39')](_0x15aeec[_0xa373('0x38')]);_0x2552b9[_0xa373('0x3a')]=_[_0xa373('0x3b')](_0x2552b9['model'],_0x2552b9[_0xa373('0x38')]);_0x4601b2['attributes']=_['intersection'](_0x2552b9[_0xa373('0x37')],qs[_0xa373('0x3d')](_0x15aeec[_0xa373('0x38')]['fields']));_0x4601b2['attributes']=_0x4601b2[_0xa373('0x3c')][_0xa373('0x3e')]?_0x4601b2[_0xa373('0x3c')]:_0x2552b9[_0xa373('0x37')];if(_0x15aeec[_0xa373('0x38')][_0xa373('0x48')]){_0x4601b2[_0xa373('0x49')]=[{'all':!![]}];}_0x4601b2=_[_0xa373('0x46')]({},_0x4601b2,_0x15aeec[_0xa373('0x4f')]);return db[_0xa373('0x33')][_0xa373('0x50')](_0x4601b2)[_0xa373('0x2c')](handleEntityNotFound(_0x368cc1,null))['then'](respondWithResult(_0x368cc1,null))['catch'](handleError(_0x368cc1,null));};exports['create']=function(_0x48b7bd,_0x10ed7a){return db[_0xa373('0x33')][_0xa373('0x51')](_0x48b7bd[_0xa373('0x52')],{})['then'](function(_0x221ac6){var _0x5d1836=_0x48b7bd[_0xa373('0x53')][_0xa373('0x29')]({'plain':!![]});if(!_0x5d1836)throw new Error(_0xa373('0x54'));if(_0x5d1836[_0xa373('0x55')]===_0xa373('0x53')){var _0x479010=_0x221ac6[_0xa373('0x29')]({'plain':!![]});var _0x524f85=_0xa373('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x524f85,'userProfileId':_0x5d1836['userProfileId']},'raw':!![]})[_0xa373('0x2c')](function(_0x1f7f86){if(_0x1f7f86&&_0x1f7f86[_0xa373('0x56')]===0x0){return db['UserProfileResource'][_0xa373('0x51')]({'name':_0x479010[_0xa373('0x2f')],'resourceId':_0x479010['id'],'type':_0x1f7f86['name'],'sectionId':_0x1f7f86['id']},{})[_0xa373('0x2c')](function(){return _0x221ac6;});}else{return _0x221ac6;}})[_0xa373('0x4c')](function(_0x852fc){logger[_0xa373('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x852fc);throw _0x852fc;});}return _0x221ac6;})['then'](respondWithResult(_0x10ed7a,0xc9))[_0xa373('0x4c')](handleError(_0x10ed7a,null));};exports[_0xa373('0x57')]=function(_0x2f1796,_0x5968ad){var _0x442b5d={'where':{'id':_0x2f1796[_0xa373('0x4d')]['id']}},_0x37f554={};_0x37f554[_0xa373('0x37')]=_['keys'](db[_0xa373('0x33')]['rawAttributes']);_0x442b5d[_0xa373('0x3c')]=_[_0xa373('0x3b')](_0x37f554[_0xa373('0x37')],qs[_0xa373('0x3d')](_0x2f1796[_0xa373('0x38')][_0xa373('0x3d')]));_0x442b5d[_0xa373('0x3c')]=_0x442b5d[_0xa373('0x3c')]['length']?_0x442b5d[_0xa373('0x3c')]:_0x37f554[_0xa373('0x37')];if(_0x2f1796['query'][_0xa373('0x48')]){_0x442b5d[_0xa373('0x49')]=[{'all':!![]}];}_0x442b5d=_[_0xa373('0x46')]({},_0x442b5d,_0x2f1796['options']);return db[_0xa373('0x33')][_0xa373('0x50')](_0x442b5d)[_0xa373('0x2c')](handleEntityNotFound(_0x5968ad,null))[_0xa373('0x2c')](function(_0x89a2e3){if(_0x89a2e3){var _0x333edf=_0x89a2e3[_0xa373('0x29')]({'plain':!![]});_0x333edf=qs[_0xa373('0x58')](_0x333edf,['id','createdAt',_0xa373('0x59')]);_0x2f1796['body']=_['omit'](_0x2f1796[_0xa373('0x52')],['id','createdAt',_0xa373('0x59')]);return db[_0xa373('0x33')]['create'](_[_0xa373('0x46')](_0x333edf,_0x2f1796[_0xa373('0x52')]),{'include':_0x2f1796[_0xa373('0x38')][_0xa373('0x48')]?[{'all':!![]}]:undefined})[_0xa373('0x2c')](function(_0x22e170){var _0x465ddc=_0x2f1796[_0xa373('0x53')][_0xa373('0x29')]({'plain':!![]});if(!_0x465ddc)throw new Error(_0xa373('0x54'));if(_0x465ddc['role']==='user'){var _0x259852=_0x22e170[_0xa373('0x29')]({'plain':!![]});var _0x4bda04=_0xa373('0x2a');return db[_0xa373('0x5a')][_0xa373('0x50')]({'where':{'name':_0x4bda04,'userProfileId':_0x465ddc[_0xa373('0x5b')]},'raw':!![]})[_0xa373('0x2c')](function(_0x542423){if(_0x542423&&_0x542423[_0xa373('0x56')]===0x0){return db[_0xa373('0x2b')][_0xa373('0x51')]({'name':_0x259852['name'],'resourceId':_0x259852['id'],'type':_0x542423[_0xa373('0x2f')],'sectionId':_0x542423['id']},{})[_0xa373('0x2c')](function(){return _0x22e170;});}else{return _0x22e170;}})[_0xa373('0x4c')](function(_0x789cba){logger[_0xa373('0x2e')](_0xa373('0x5c'),_0x789cba);throw _0x789cba;});}return _0x22e170;});}})[_0xa373('0x2c')](respondWithResult(_0x5968ad,0xc9))[_0xa373('0x4c')](handleError(_0x5968ad,null));};exports[_0xa373('0x27')]=function(_0x93953f,_0x4dc346){if(_0x93953f[_0xa373('0x52')]['id']){delete _0x93953f[_0xa373('0x52')]['id'];}return db[_0xa373('0x33')]['find']({'where':{'id':_0x93953f[_0xa373('0x4d')]['id']}})[_0xa373('0x2c')](handleEntityNotFound(_0x4dc346,null))[_0xa373('0x2c')](saveUpdates(_0x93953f[_0xa373('0x52')],null))[_0xa373('0x2c')](respondWithResult(_0x4dc346,null))['catch'](handleError(_0x4dc346,null));};exports[_0xa373('0x28')]=function(_0x371813,_0x427f48){return db[_0xa373('0x33')]['find']({'where':{'id':_0x371813[_0xa373('0x4d')]['id']}})[_0xa373('0x2c')](handleEntityNotFound(_0x427f48,null))[_0xa373('0x2c')](removeEntity(_0x427f48,null))[_0xa373('0x4c')](handleError(_0x427f48,null));};function widgetAttributes(_0x2e155f){try{switch(_0x2e155f['type']){case _0xa373('0x5d'):return[{'name':_0xa373('0x5e'),'value':_0x2e155f[_0xa373('0x5e')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x60')]:undefined)||_0xa373('0x61')}];case _0xa373('0x62'):return[{'name':'attrPath','value':_0x2e155f['attrPath']||(_0x2e155f['attrs']&&_0x2e155f[_0xa373('0x5f')][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x60')]:undefined)||''}];case _0xa373('0x63'):return[{'name':_0xa373('0x64'),'value':_0x2e155f[_0xa373('0x64')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f['attrs'][0x0]?_0x2e155f['attrs'][0x0][_0xa373('0x60')]:undefined)||_0xa373('0x65')},{'name':_0xa373('0x66'),'value':_0x2e155f[_0xa373('0x66')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x1]?_0x2e155f[_0xa373('0x5f')][0x1]['value']:undefined)||_0xa373('0x67')},{'name':_0xa373('0x68'),'value':_0x2e155f[_0xa373('0x68')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x2]?_0x2e155f[_0xa373('0x5f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xa373('0x69'),'value':_0x2e155f[_0xa373('0x69')]||(_0x2e155f['attrs']&&_0x2e155f['attrs'][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x60')]:undefined)||'total'},{'name':_0xa373('0x6a'),'value':_0x2e155f['attrVoiceQueues']||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f['attrs'][0x1]?_0x2e155f[_0xa373('0x5f')][0x1][_0xa373('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x2e155f[_0xa373('0x68')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x2]?_0x2e155f['attrs'][0x2][_0xa373('0x60')]:undefined)||0x14},{'name':_0xa373('0x6b'),'value':_0x2e155f[_0xa373('0x6b')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x3]?_0x2e155f[_0xa373('0x5f')][0x3][_0xa373('0x60')]:undefined)||_0xa373('0x6c')},{'name':_0xa373('0x6d'),'value':_0x2e155f[_0xa373('0x6d')]||(_0x2e155f['attrs']&&_0x2e155f['attrs'][0x4]?_0x2e155f[_0xa373('0x5f')][0x4][_0xa373('0x60')]:undefined)||''},{'name':_0xa373('0x6e'),'value':_0x2e155f[_0xa373('0x6e')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x5]?_0x2e155f[_0xa373('0x5f')][0x5][_0xa373('0x60')]:undefined)||''},{'name':_0xa373('0x6f'),'value':_0x2e155f[_0xa373('0x6f')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f['attrs'][0x6]?_0x2e155f[_0xa373('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2e155f[_0xa373('0x70')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x7]?_0x2e155f[_0xa373('0x5f')][0x7][_0xa373('0x60')]:undefined)||''},{'name':_0xa373('0x71'),'value':_0x2e155f[_0xa373('0x71')]||(_0x2e155f['attrs']&&_0x2e155f[_0xa373('0x5f')][0x8]?_0x2e155f[_0xa373('0x5f')][0x8]['value']:undefined)||''},{'name':_0xa373('0x72'),'value':_0x2e155f[_0xa373('0x72')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x9]?_0x2e155f[_0xa373('0x5f')][0x9][_0xa373('0x60')]:undefined)||''}];case'multibar-chart':case _0xa373('0x73'):return[{'name':_0xa373('0x74'),'value':_0x2e155f[_0xa373('0x74')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x60')]:undefined)||'total'},{'name':_0xa373('0x75'),'value':_0x2e155f[_0xa373('0x75')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x1]?_0x2e155f[_0xa373('0x5f')][0x1]['value']:undefined)||null},{'name':_0xa373('0x76'),'value':_0x2e155f[_0xa373('0x76')]||(_0x2e155f['attrs']&&_0x2e155f[_0xa373('0x5f')][0x2]?_0x2e155f[_0xa373('0x5f')][0x2][_0xa373('0x60')]:undefined)||null},{'name':_0xa373('0x6a'),'value':_0x2e155f[_0xa373('0x6a')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x3]?_0x2e155f['attrs'][0x3][_0xa373('0x60')]:undefined)||[]},{'name':_0xa373('0x6b'),'value':_0x2e155f[_0xa373('0x6b')]||(_0x2e155f['attrs']&&_0x2e155f[_0xa373('0x5f')][0x4]?_0x2e155f[_0xa373('0x5f')][0x4]['value']:undefined)||_0xa373('0x6c')},{'name':_0xa373('0x6d'),'value':_0x2e155f[_0xa373('0x6d')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x5]?_0x2e155f[_0xa373('0x5f')][0x5][_0xa373('0x60')]:undefined)||''},{'name':_0xa373('0x6e'),'value':_0x2e155f['attrFaxAccounts']||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x6]?_0x2e155f[_0xa373('0x5f')][0x6][_0xa373('0x60')]:undefined)||''},{'name':_0xa373('0x6f'),'value':_0x2e155f['attrSmsAccounts']||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x7]?_0x2e155f[_0xa373('0x5f')][0x7]['value']:undefined)||''},{'name':_0xa373('0x70'),'value':_0x2e155f[_0xa373('0x70')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f['attrs'][0x8]?_0x2e155f[_0xa373('0x5f')][0x8][_0xa373('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2e155f[_0xa373('0x71')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x9]?_0x2e155f['attrs'][0x9]['value']:undefined)||''},{'name':_0xa373('0x72'),'value':_0x2e155f[_0xa373('0x72')]||(_0x2e155f['attrs']&&_0x2e155f['attrs'][0xa]?_0x2e155f[_0xa373('0x5f')][0xa][_0xa373('0x60')]:undefined)||''}];case _0xa373('0x77'):return[{'name':_0xa373('0x78'),'type':_0x2e155f[_0xa373('0x79')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f['attrs'][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x35')]:undefined)||null,'value':_0x2e155f[_0xa373('0x78')]||(_0x2e155f[_0xa373('0x5f')]&&_0x2e155f[_0xa373('0x5f')][0x0]?_0x2e155f[_0xa373('0x5f')][0x0][_0xa373('0x60')]:undefined)||null},{'name':_0xa373('0x7a'),'value':_0x2e155f['attrRefresh']||(_0x2e155f['attrs']&&_0x2e155f['attrs'][0x1]?_0x2e155f[_0xa373('0x5f')][0x1][_0xa373('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4aa22){logger[_0xa373('0x2e')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4aa22));return[];}}exports[_0xa373('0x7b')]=function(_0x575158,_0x960934,_0x44f302){if(_0x575158[_0xa373('0x52')]['id']){delete _0x575158[_0xa373('0x52')]['id'];}return db[_0xa373('0x33')][_0xa373('0x50')]({'where':{'id':_0x575158['params']['id']}})[_0xa373('0x2c')](handleEntityNotFound(_0x960934,null))[_0xa373('0x2c')](function(_0x59324f){if(_0x59324f){_0x575158['body'][_0xa373('0x7c')]=_0x59324f['id'];_0x575158['body']['attrs']=widgetAttributes(_0x575158[_0xa373('0x52')]);return db[_0xa373('0x7d')]['create'](_0x575158['body']);}})[_0xa373('0x2c')](respondWithResult(_0x960934,null))[_0xa373('0x4c')](handleError(_0x960934,null));};exports[_0xa373('0x7e')]=function(_0x26eca4,_0x50a7d8,_0xcada4){var _0x492e13={};var _0x51e749={};var _0x27e9b1;var _0x13aa1f;return db[_0xa373('0x33')][_0xa373('0x7f')]({'where':{'id':_0x26eca4[_0xa373('0x4d')]['id']}})[_0xa373('0x2c')](handleEntityNotFound(_0x50a7d8,null))[_0xa373('0x2c')](function(_0x2944af){if(_0x2944af){_0x27e9b1=_0x2944af;_0x51e749[_0xa373('0x37')]=_[_0xa373('0x39')](db[_0xa373('0x7d')][_0xa373('0x4e')]);_0x51e749[_0xa373('0x38')]=_[_0xa373('0x39')](_0x26eca4['query']);_0x51e749[_0xa373('0x3a')]=_[_0xa373('0x3b')](_0x51e749[_0xa373('0x37')],_0x51e749[_0xa373('0x38')]);_0x492e13['attributes']=_[_0xa373('0x3b')](_0x51e749[_0xa373('0x37')],qs['fields'](_0x26eca4[_0xa373('0x38')][_0xa373('0x3d')]));_0x492e13[_0xa373('0x3c')]=_0x492e13[_0xa373('0x3c')][_0xa373('0x3e')]?_0x492e13[_0xa373('0x3c')]:_0x51e749[_0xa373('0x37')];_0x492e13[_0xa373('0x41')]=qs[_0xa373('0x42')](_0x26eca4['query']['sort']);_0x492e13[_0xa373('0x45')]=qs[_0xa373('0x3a')](_[_0xa373('0x43')](_0x26eca4[_0xa373('0x38')],_0x51e749[_0xa373('0x3a')]));if(_0x26eca4['query'][_0xa373('0x44')]){_0x492e13[_0xa373('0x45')]=_[_0xa373('0x46')](_0x492e13[_0xa373('0x45')],{'$or':_[_0xa373('0x32')](_0x492e13['attributes'],function(_0x4b7481){var _0x3e8078={};_0x3e8078[_0x4b7481]={'$like':'%'+_0x26eca4[_0xa373('0x38')][_0xa373('0x44')]+'%'};return _0x3e8078;})});}_0x492e13=_[_0xa373('0x46')]({},_0x492e13,_0x26eca4[_0xa373('0x4f')]);return _0x27e9b1[_0xa373('0x7e')](_0x492e13);}})[_0xa373('0x2c')](function(_0x4bcec8){if(_0x4bcec8){_0x13aa1f=_0x4bcec8['length'];if(!_0x26eca4[_0xa373('0x38')][_0xa373('0x3f')](_0xa373('0x40'))){_0x492e13[_0xa373('0x23')]=qs[_0xa373('0x23')](_0x26eca4[_0xa373('0x38')][_0xa373('0x23')]);_0x492e13['offset']=qs[_0xa373('0x22')](_0x26eca4[_0xa373('0x38')][_0xa373('0x22')]);}return _0x27e9b1[_0xa373('0x7e')](_0x492e13);}})['then'](function(_0x2390c1){if(_0x2390c1){return _0x2390c1?{'count':_0x13aa1f,'rows':_0x2390c1}:null;}})[_0xa373('0x2c')](respondWithResult(_0x50a7d8,null))[_0xa373('0x4c')](handleError(_0x50a7d8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 45f6112..49c2b14 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 _0x85a7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x372aad,_0x849481){var _0xef2e8e=function(_0x568ef6){while(--_0x568ef6){_0x372aad['push'](_0x372aad['shift']());}};_0xef2e8e(++_0x849481);}(_0x85a7,0xa7));var _0x785a=function(_0x32069f,_0x397585){_0x32069f=_0x32069f-0x0;var _0x5506c3=_0x85a7[_0x32069f];return _0x5506c3;};'use strict';var EventEmitter=require(_0x785a('0x0'));var Dashboard=require(_0x785a('0x1'))['db'][_0x785a('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x785a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x785a('0x4'),'afterDestroy':_0x785a('0x5')};function emitEvent(_0x57008d){return function(_0x424393,_0x6f673c,_0x189d71){DashboardEvents['emit'](_0x57008d+':'+_0x424393['id'],_0x424393);DashboardEvents[_0x785a('0x6')](_0x57008d,_0x424393);_0x189d71(null);};}for(var e in events){if(events[_0x785a('0x7')](e)){var event=events[e];Dashboard[_0x785a('0x8')](e,emitEvent(event));}}module[_0x785a('0x9')]=DashboardEvents; \ No newline at end of file +var _0x651e=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard'];(function(_0x124d12,_0x2351a1){var _0x54180f=function(_0x1cf6ef){while(--_0x1cf6ef){_0x124d12['push'](_0x124d12['shift']());}};_0x54180f(++_0x2351a1);}(_0x651e,0x15d));var _0xe651=function(_0x15c160,_0x44d3ae){_0x15c160=_0x15c160-0x0;var _0x3b65d8=_0x651e[_0x15c160];return _0x3b65d8;};'use strict';var EventEmitter=require(_0xe651('0x0'));var Dashboard=require(_0xe651('0x1'))['db'][_0xe651('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe651('0x3'),'afterDestroy':_0xe651('0x4')};function emitEvent(_0x464bfe){return function(_0x5288c9,_0x2bd51a,_0x447883){DashboardEvents[_0xe651('0x5')](_0x464bfe+':'+_0x5288c9['id'],_0x5288c9);DashboardEvents[_0xe651('0x5')](_0x464bfe,_0x5288c9);_0x447883(null);};}for(var e in events){if(events[_0xe651('0x6')](e)){var event=events[e];Dashboard[_0xe651('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 635da06..1838102 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 _0x7211=['dashboards','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x7211,0x123));var _0x1721=function(_0x415372,_0x5bb1d2){_0x415372=_0x415372-0x0;var _0x4cc1cd=_0x7211[_0x415372];return _0x4cc1cd;};'use strict';var _=require('lodash');var util=require(_0x1721('0x0'));var logger=require(_0x1721('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1721('0x2'));var fs=require('fs');var path=require(_0x1721('0x3'));var rimraf=require(_0x1721('0x4'));var config=require(_0x1721('0x5'));var attributes=require(_0x1721('0x6'));module[_0x1721('0x7')]=function(_0x5555e1,_0x25d5d9){return _0x5555e1[_0x1721('0x8')]('Dashboard',attributes,{'tableName':_0x1721('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d4d=['./dashboard.attributes','Dashboard','dashboards','util','api','bluebird','request-promise','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8d4d,0x14b));var _0xd8d4=function(_0x3c6939,_0x4f49ad){_0x3c6939=_0x3c6939-0x0;var _0x482b53=_0x8d4d[_0x3c6939];return _0x482b53;};'use strict';var _=require('lodash');var util=require(_0xd8d4('0x0'));var logger=require('../../config/logger')(_0xd8d4('0x1'));var moment=require('moment');var BPromise=require(_0xd8d4('0x2'));var rp=require(_0xd8d4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8d4('0x4'));var attributes=require(_0xd8d4('0x5'));module['exports']=function(_0x3be483,_0x4b1af4){return _0x3be483['define'](_0xd8d4('0x6'),attributes,{'tableName':_0xd8d4('0x7'),'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 f51e160..8b91858 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 _0xaf6f=['register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaf6f,0x193));var _0xfaf6=function(_0x4ca58d,_0x54c7b9){_0x4ca58d=_0x4ca58d-0x0;var _0x1f3e49=_0xaf6f[_0x4ca58d];return _0x1f3e49;};'use strict';var _=require(_0xfaf6('0x0'));var util=require(_0xfaf6('0x1'));var moment=require(_0xfaf6('0x2'));var BPromise=require(_0xfaf6('0x3'));var rs=require(_0xfaf6('0x4'));var fs=require('fs');var Redis=require(_0xfaf6('0x5'));var db=require(_0xfaf6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaf6('0x7'))(_0xfaf6('0x8'));var config=require(_0xfaf6('0x9'));var jayson=require(_0xfaf6('0xa'));var client=jayson[_0xfaf6('0xb')][_0xfaf6('0xc')]({'port':0x232a});config[_0xfaf6('0xd')]=_[_0xfaf6('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfaf6('0xf'))(new Redis(config[_0xfaf6('0xd')]));require(_0xfaf6('0x10'))[_0xfaf6('0x11')](socket);function respondWithRpcPromise(_0x228ead,_0x4cc521,_0x5e65cc){return new BPromise(function(_0x1c929e,_0x57d353){return client[_0xfaf6('0x12')](_0x228ead,_0x5e65cc)[_0xfaf6('0x13')](function(_0x40e982){logger[_0xfaf6('0x14')](_0xfaf6('0x15'),_0x4cc521,_0xfaf6('0x16'));logger[_0xfaf6('0x17')](_0xfaf6('0x18'),_0x4cc521,_0xfaf6('0x16'),JSON[_0xfaf6('0x19')](_0x40e982));if(_0x40e982[_0xfaf6('0x1a')]){if(_0x40e982[_0xfaf6('0x1a')][_0xfaf6('0x1b')]===0x1f4){logger[_0xfaf6('0x1a')](_0xfaf6('0x15'),_0x4cc521,_0x40e982[_0xfaf6('0x1a')][_0xfaf6('0x1c')]);return _0x57d353(_0x40e982[_0xfaf6('0x1a')]['message']);}logger[_0xfaf6('0x1a')](_0xfaf6('0x15'),_0x4cc521,_0x40e982[_0xfaf6('0x1a')][_0xfaf6('0x1c')]);return _0x1c929e(_0x40e982[_0xfaf6('0x1a')][_0xfaf6('0x1c')]);}else{logger[_0xfaf6('0x14')](_0xfaf6('0x15'),_0x4cc521,_0xfaf6('0x16'));_0x1c929e(_0x40e982['result'][_0xfaf6('0x1c')]);}})[_0xfaf6('0x1d')](function(_0x28e471){logger[_0xfaf6('0x1a')](_0xfaf6('0x15'),_0x4cc521,_0x28e471);_0x57d353(_0x28e471);});});} \ No newline at end of file +var _0xa68c=['info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x1f067c,_0x312549){var _0x1853ca=function(_0x57ce8c){while(--_0x57ce8c){_0x1f067c['push'](_0x1f067c['shift']());}};_0x1853ca(++_0x312549);}(_0xa68c,0x121));var _0xca68=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa68c[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var moment=require(_0xca68('0x2'));var BPromise=require(_0xca68('0x3'));var rs=require(_0xca68('0x4'));var fs=require('fs');var Redis=require(_0xca68('0x5'));var db=require(_0xca68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca68('0x7'))(_0xca68('0x8'));var config=require(_0xca68('0x9'));var jayson=require(_0xca68('0xa'));var client=jayson['client'][_0xca68('0xb')]({'port':0x232a});config[_0xca68('0xc')]=_[_0xca68('0xd')](config[_0xca68('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xca68('0xe'))(new Redis(config['redis']));require(_0xca68('0xf'))[_0xca68('0x10')](socket);function respondWithRpcPromise(_0x42ec9e,_0x4256e2,_0x1dcd91){return new BPromise(function(_0x1d380d,_0x433762){return client[_0xca68('0x11')](_0x42ec9e,_0x1dcd91)[_0xca68('0x12')](function(_0x4b2f6c){logger[_0xca68('0x13')](_0xca68('0x14'),_0x4256e2,'request\x20sent');logger[_0xca68('0x15')](_0xca68('0x16'),_0x4256e2,_0xca68('0x17'),JSON[_0xca68('0x18')](_0x4b2f6c));if(_0x4b2f6c[_0xca68('0x19')]){if(_0x4b2f6c['error'][_0xca68('0x1a')]===0x1f4){logger[_0xca68('0x19')](_0xca68('0x14'),_0x4256e2,_0x4b2f6c[_0xca68('0x19')]['message']);return _0x433762(_0x4b2f6c[_0xca68('0x19')][_0xca68('0x1b')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4256e2,_0x4b2f6c[_0xca68('0x19')][_0xca68('0x1b')]);return _0x1d380d(_0x4b2f6c['error'][_0xca68('0x1b')]);}else{logger[_0xca68('0x13')](_0xca68('0x14'),_0x4256e2,_0xca68('0x17'));_0x1d380d(_0x4b2f6c['result'][_0xca68('0x1b')]);}})['catch'](function(_0x5341a3){logger[_0xca68('0x19')]('Dashboard,\x20%s,\x20%s',_0x4256e2,_0x5341a3);_0x433762(_0x5341a3);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0073600..42c50be 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 _0xeba1=['length','./dashboard.events','save','remove','emit','removeListener','register'];(function(_0x595adf,_0x4b1317){var _0x5dca45=function(_0x4a65c8){while(--_0x4a65c8){_0x595adf['push'](_0x595adf['shift']());}};_0x5dca45(++_0x4b1317);}(_0xeba1,0xd3));var _0x1eba=function(_0x5525c7,_0xe772c5){_0x5525c7=_0x5525c7-0x0;var _0x14eb5b=_0xeba1[_0x5525c7];return _0x14eb5b;};'use strict';var DashboardEvents=require(_0x1eba('0x0'));var events=[_0x1eba('0x1'),_0x1eba('0x2'),'update'];function createListener(_0xbb8460,_0x154a1b){return function(_0x455226){_0x154a1b[_0x1eba('0x3')](_0xbb8460,_0x455226);};}function removeListener(_0x59d0ac,_0x9b80ed){return function(){DashboardEvents[_0x1eba('0x4')](_0x59d0ac,_0x9b80ed);};}exports[_0x1eba('0x5')]=function(_0x2dbc20){for(var _0x59eddf=0x0,_0x3b3fd4=events[_0x1eba('0x6')];_0x59eddf<_0x3b3fd4;_0x59eddf++){var _0x5daac9=events[_0x59eddf];var _0x2790a7=createListener('dashboard:'+_0x5daac9,_0x2dbc20);DashboardEvents['on'](_0x5daac9,_0x2790a7);}}; \ No newline at end of file +var _0xdceb=['remove','update','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x1ef773,_0x19a814){var _0x10a4ad=function(_0x463410){while(--_0x463410){_0x1ef773['push'](_0x1ef773['shift']());}};_0x10a4ad(++_0x19a814);}(_0xdceb,0x1ee));var _0xbdce=function(_0x442fec,_0x526e53){_0x442fec=_0x442fec-0x0;var _0x25070e=_0xdceb[_0x442fec];return _0x25070e;};'use strict';var DashboardEvents=require(_0xbdce('0x0'));var events=[_0xbdce('0x1'),_0xbdce('0x2'),_0xbdce('0x3')];function createListener(_0x1cc4fe,_0x3b10fc){return function(_0x597e06){_0x3b10fc[_0xbdce('0x4')](_0x1cc4fe,_0x597e06);};}function removeListener(_0x161d35,_0x3e78ef){return function(){DashboardEvents[_0xbdce('0x5')](_0x161d35,_0x3e78ef);};}exports[_0xbdce('0x6')]=function(_0x5c4f7d){for(var _0x4084f6=0x0,_0x1bc7a0=events[_0xbdce('0x7')];_0x4084f6<_0x1bc7a0;_0x4084f6++){var _0x1faf11=events[_0x4084f6];var _0x3cdbc3=createListener('dashboard:'+_0x1faf11,_0x5c4f7d);DashboardEvents['on'](_0x1faf11,_0x3cdbc3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f340e87..8a02ea0 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 _0xdab4=['isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0xdab4,0x1d3));var _0x4dab=function(_0x31a322,_0x8fd978){_0x31a322=_0x31a322-0x0;var _0x419acb=_0xdab4[_0x31a322];return _0x419acb;};'use strict';var multer=require(_0x4dab('0x0'));var util=require(_0x4dab('0x1'));var path=require('path');var timeout=require(_0x4dab('0x2'));var express=require(_0x4dab('0x3'));var router=express[_0x4dab('0x4')]();var fs_extra=require(_0x4dab('0x5'));var auth=require(_0x4dab('0x6'));var interaction=require(_0x4dab('0x7'));var config=require(_0x4dab('0x8'));var controller=require(_0x4dab('0x9'));router[_0x4dab('0xa')]('/',auth['isAuthenticated'](),controller[_0x4dab('0xb')]);router['get'](_0x4dab('0xc'),auth[_0x4dab('0xd')](),controller['show']);router[_0x4dab('0xa')](_0x4dab('0xe'),auth[_0x4dab('0xd')](),controller[_0x4dab('0xf')]);router[_0x4dab('0x10')]('/',auth['isAuthenticated'](),controller[_0x4dab('0x11')]);router[_0x4dab('0x10')](_0x4dab('0x12'),auth[_0x4dab('0xd')](),controller[_0x4dab('0x13')]);router[_0x4dab('0x10')]('/:id/items',auth['isAuthenticated'](),controller['addItem']);router[_0x4dab('0x14')](_0x4dab('0xc'),auth[_0x4dab('0xd')](),controller[_0x4dab('0x15')]);router[_0x4dab('0x16')](_0x4dab('0xc'),auth[_0x4dab('0xd')](),controller['destroy']);module[_0x4dab('0x17')]=router; \ No newline at end of file +var _0x8e88=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','post','/:id/clone','clone','addItem','update','delete','destroy','exports','multer'];(function(_0x3aeabe,_0x4357df){var _0x3eb976=function(_0xb5b98b){while(--_0xb5b98b){_0x3aeabe['push'](_0x3aeabe['shift']());}};_0x3eb976(++_0x4357df);}(_0x8e88,0xe5));var _0x88e8=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x8e88[_0x2ef8c1];return _0x288305;};'use strict';var multer=require(_0x88e8('0x0'));var util=require(_0x88e8('0x1'));var path=require(_0x88e8('0x2'));var timeout=require(_0x88e8('0x3'));var express=require(_0x88e8('0x4'));var router=express[_0x88e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x88e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x88e8('0x7'));var controller=require(_0x88e8('0x8'));router['get']('/',auth[_0x88e8('0x9')](),controller[_0x88e8('0xa')]);router[_0x88e8('0xb')](_0x88e8('0xc'),auth[_0x88e8('0x9')](),controller['show']);router[_0x88e8('0xb')](_0x88e8('0xd'),auth[_0x88e8('0x9')](),controller[_0x88e8('0xe')]);router[_0x88e8('0xf')]('/',auth[_0x88e8('0x9')](),controller['create']);router[_0x88e8('0xf')](_0x88e8('0x10'),auth[_0x88e8('0x9')](),controller[_0x88e8('0x11')]);router['post'](_0x88e8('0xd'),auth['isAuthenticated'](),controller[_0x88e8('0x12')]);router['put'](_0x88e8('0xc'),auth['isAuthenticated'](),controller[_0x88e8('0x13')]);router[_0x88e8('0x14')](_0x88e8('0xc'),auth[_0x88e8('0x9')](),controller[_0x88e8('0x15')]);module[_0x88e8('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 0978c1e..7f7ee7b 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 _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x3d4ddb,_0x1c9228){var _0x46ea55=function(_0x5aea0d){while(--_0x5aea0d){_0x3d4ddb['push'](_0x3d4ddb['shift']());}};_0x46ea55(++_0x1c9228);}(_0x5d58,0x187));var _0x85d5=function(_0x208313,_0x3c8fa6){_0x208313=_0x208313-0x0;var _0x12480c=_0x5d58[_0x208313];return _0x12480c;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x170904,_0x134a4c){var _0xfdf3e6=function(_0x48fff9){while(--_0x48fff9){_0x170904['push'](_0x170904['shift']());}};_0xfdf3e6(++_0x134a4c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2ee19c,_0x29b830){_0x2ee19c=_0x2ee19c-0x0;var _0xef8a6f=_0xbd51[_0x2ee19c];return _0xef8a6f;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'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 2e7295a..52f892a 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 _0x4f0d=['reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','DashboardItem','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x4f0d[_0x280ae7];return _0x418b9e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4f0('0x0'));var BPromise=require(_0xd4f0('0x1'));var Mustache=require(_0xd4f0('0x2'));var util=require('util');var path=require(_0xd4f0('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f0('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4f0('0x5'));var squel=require(_0xd4f0('0x6'));var crypto=require('crypto');var jsforce=require(_0xd4f0('0x7'));var deskjs=require(_0xd4f0('0x8'));var toCsv=require(_0xd4f0('0x9'));var querystring=require(_0xd4f0('0xa'));var Papa=require(_0xd4f0('0xb'));var Redis=require('ioredis');var authService=require(_0xd4f0('0xc'));var qs=require(_0xd4f0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f0('0xe'))(_0xd4f0('0xf'));var utils=require('../../config/utils');var config=require(_0xd4f0('0x10'));var licenseUtil=require(_0xd4f0('0x11'));var db=require(_0xd4f0('0x12'))['db'];config[_0xd4f0('0x13')]=_[_0xd4f0('0x14')](config['redis'],{'host':_0xd4f0('0x15'),'port':0x18eb});var socket=require(_0xd4f0('0x16'))(new Redis(config[_0xd4f0('0x13')]));require(_0xd4f0('0x17'))[_0xd4f0('0x18')](socket);function respondWithStatusCode(_0x544936,_0x100cd4){_0x100cd4=_0x100cd4||0xcc;return function(_0x386f84){if(_0x386f84){return _0x544936[_0xd4f0('0x19')](_0x100cd4);}return _0x544936[_0xd4f0('0x1a')](_0x100cd4)[_0xd4f0('0x1b')]();};}function respondWithResult(_0x2dd02d,_0x4f8e76){_0x4f8e76=_0x4f8e76||0xc8;return function(_0x5adf8a){if(_0x5adf8a){return _0x2dd02d[_0xd4f0('0x1a')](_0x4f8e76)[_0xd4f0('0x1c')](_0x5adf8a);}};}function respondWithFilteredResult(_0xff90e,_0x7b2ca4){return function(_0x4d0dcc){if(_0x4d0dcc){var _0x5bf265=typeof _0x7b2ca4[_0xd4f0('0x1d')]===_0xd4f0('0x1e')&&typeof _0x7b2ca4[_0xd4f0('0x1f')]===_0xd4f0('0x1e');var _0x7560d6=_0x4d0dcc[_0xd4f0('0x20')];var _0x57d418=_0x5bf265?0x0:_0x7b2ca4[_0xd4f0('0x1d')];var _0x2f0b79=_0x5bf265?_0x4d0dcc[_0xd4f0('0x20')]:_0x7b2ca4['offset']+_0x7b2ca4[_0xd4f0('0x1f')];var _0x474c22;if(_0x2f0b79>=_0x7560d6){_0x2f0b79=_0x7560d6;_0x474c22=0xc8;}else{_0x474c22=0xce;}_0xff90e[_0xd4f0('0x1a')](_0x474c22);return _0xff90e['set'](_0xd4f0('0x21'),_0x57d418+'-'+_0x2f0b79+'/'+_0x7560d6)[_0xd4f0('0x1c')](_0x4d0dcc);}return null;};}function patchUpdates(_0x655480){return function(_0x5b94bb){try{jsonpatch[_0xd4f0('0x22')](_0x5b94bb,_0x655480,!![]);}catch(_0x174e52){return BPromise[_0xd4f0('0x23')](_0x174e52);}return _0x5b94bb[_0xd4f0('0x24')]();};}function saveUpdates(_0x4fd650,_0x1552e9){return function(_0x3345c6){if(_0x3345c6){return _0x3345c6[_0xd4f0('0x25')](_0x4fd650)[_0xd4f0('0x26')](function(_0x5f4858){return _0x5f4858;});}return null;};}function removeEntity(_0x37e8a1,_0x49b94b){return function(_0x15e310){if(_0x15e310){return _0x15e310[_0xd4f0('0x27')]()[_0xd4f0('0x26')](function(){_0x37e8a1[_0xd4f0('0x1a')](0xcc)[_0xd4f0('0x1b')]();});}};}function handleEntityNotFound(_0x2f4291,_0x1dd584){return function(_0xe25e57){if(!_0xe25e57){_0x2f4291[_0xd4f0('0x19')](0x194);}return _0xe25e57;};}function handleError(_0x2c1f4f,_0xe2bf28){_0xe2bf28=_0xe2bf28||0x1f4;return function(_0x4ea8aa){logger[_0xd4f0('0x28')](_0x4ea8aa[_0xd4f0('0x29')]);if(_0x4ea8aa[_0xd4f0('0x2a')]){delete _0x4ea8aa[_0xd4f0('0x2a')];}_0x2c1f4f['status'](_0xe2bf28)[_0xd4f0('0x2b')](_0x4ea8aa);};}exports[_0xd4f0('0x2c')]=function(_0x401a5b,_0x40da73){var _0x4b8244={'raw':![],'where':{'id':_0x401a5b[_0xd4f0('0x2d')]['id']}},_0x39c44a={};_0x39c44a[_0xd4f0('0x2e')]=_[_0xd4f0('0x2f')](db['DashboardItem'][_0xd4f0('0x30')]);_0x39c44a[_0xd4f0('0x31')]=_[_0xd4f0('0x2f')](_0x401a5b[_0xd4f0('0x31')]);_0x39c44a[_0xd4f0('0x32')]=_[_0xd4f0('0x33')](_0x39c44a[_0xd4f0('0x2e')],_0x39c44a[_0xd4f0('0x31')]);_0x4b8244[_0xd4f0('0x34')]=_[_0xd4f0('0x33')](_0x39c44a[_0xd4f0('0x2e')],qs['fields'](_0x401a5b[_0xd4f0('0x31')][_0xd4f0('0x35')]));_0x4b8244[_0xd4f0('0x34')]=_0x4b8244[_0xd4f0('0x34')][_0xd4f0('0x36')]?_0x4b8244['attributes']:_0x39c44a[_0xd4f0('0x2e')];if(_0x401a5b[_0xd4f0('0x31')]['includeAll']){_0x4b8244[_0xd4f0('0x37')]=[{'all':!![]}];}_0x4b8244=_[_0xd4f0('0x38')]({},_0x4b8244,_0x401a5b[_0xd4f0('0x39')]);return db['DashboardItem'][_0xd4f0('0x3a')](_0x4b8244)['then'](handleEntityNotFound(_0x40da73,null))['then'](respondWithResult(_0x40da73,null))['catch'](handleError(_0x40da73,null));};exports[_0xd4f0('0x27')]=function(_0x33c1ea,_0x23283b){return db[_0xd4f0('0x3b')][_0xd4f0('0x3a')]({'where':{'id':_0x33c1ea['params']['id']}})['then'](handleEntityNotFound(_0x23283b,null))[_0xd4f0('0x26')](removeEntity(_0x23283b,null))[_0xd4f0('0x3c')](handleError(_0x23283b,null));};function widgetAttributes(_0x386ec3){try{switch(_0x386ec3['type']){case _0xd4f0('0x3d'):return[{'name':_0xd4f0('0x3e'),'value':_0x386ec3[_0xd4f0('0x3e')]||(_0x386ec3['attrs']&&_0x386ec3[_0xd4f0('0x3f')][0x0]?_0x386ec3['attrs'][0x0][_0xd4f0('0x40')]:undefined)||_0xd4f0('0x41')}];case _0xd4f0('0x42'):return[{'name':_0xd4f0('0x43'),'value':_0x386ec3[_0xd4f0('0x43')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x0]?_0x386ec3['attrs'][0x0][_0xd4f0('0x40')]:undefined)||''}];case _0xd4f0('0x44'):return[{'name':'attrHourFormat','value':_0x386ec3[_0xd4f0('0x45')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x0]?_0x386ec3[_0xd4f0('0x3f')][0x0][_0xd4f0('0x40')]:undefined)||_0xd4f0('0x46')},{'name':'attrTimezone','value':_0x386ec3[_0xd4f0('0x47')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x1]?_0x386ec3[_0xd4f0('0x3f')][0x1][_0xd4f0('0x40')]:undefined)||_0xd4f0('0x48')},{'name':'attrFontSize','value':_0x386ec3[_0xd4f0('0x49')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x2]?_0x386ec3['attrs'][0x2][_0xd4f0('0x40')]:undefined)||0xc}];case _0xd4f0('0x4a'):return[{'name':_0xd4f0('0x4b'),'value':_0x386ec3['attrMetric']||(_0x386ec3['attrs']&&_0x386ec3[_0xd4f0('0x3f')][0x0]?_0x386ec3[_0xd4f0('0x3f')][0x0][_0xd4f0('0x40')]:undefined)||_0xd4f0('0x4c')},{'name':_0xd4f0('0x4d'),'value':_0x386ec3[_0xd4f0('0x4d')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x1]?_0x386ec3[_0xd4f0('0x3f')][0x1][_0xd4f0('0x40')]:undefined)||[]},{'name':_0xd4f0('0x49'),'value':_0x386ec3[_0xd4f0('0x49')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x2]?_0x386ec3[_0xd4f0('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0xd4f0('0x4e'),'value':_0x386ec3['attrChannel']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x3]?_0x386ec3[_0xd4f0('0x3f')][0x3]['value']:undefined)||_0xd4f0('0x4f')},{'name':_0xd4f0('0x50'),'value':_0x386ec3['attrEmailAccounts']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x4]?_0x386ec3[_0xd4f0('0x3f')][0x4][_0xd4f0('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x386ec3[_0xd4f0('0x51')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x5]?_0x386ec3[_0xd4f0('0x3f')][0x5][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x52'),'value':_0x386ec3[_0xd4f0('0x52')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x6]?_0x386ec3[_0xd4f0('0x3f')][0x6][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x53'),'value':_0x386ec3['attrOpenchannelAccounts']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x7]?_0x386ec3[_0xd4f0('0x3f')][0x7][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x54'),'value':_0x386ec3['attrWhatsappAccounts']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x8]?_0x386ec3[_0xd4f0('0x3f')][0x8][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x55'),'value':_0x386ec3[_0xd4f0('0x55')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x9]?_0x386ec3[_0xd4f0('0x3f')][0x9][_0xd4f0('0x40')]:undefined)||''}];case _0xd4f0('0x56'):case _0xd4f0('0x57'):return[{'name':_0xd4f0('0x58'),'value':_0x386ec3[_0xd4f0('0x58')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x0]?_0x386ec3[_0xd4f0('0x3f')][0x0]['value']:undefined)||_0xd4f0('0x4c')},{'name':_0xd4f0('0x59'),'value':_0x386ec3[_0xd4f0('0x59')]||(_0x386ec3['attrs']&&_0x386ec3[_0xd4f0('0x3f')][0x1]?_0x386ec3[_0xd4f0('0x3f')][0x1]['value']:undefined)||null},{'name':_0xd4f0('0x5a'),'value':_0x386ec3[_0xd4f0('0x5a')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x2]?_0x386ec3['attrs'][0x2][_0xd4f0('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x386ec3[_0xd4f0('0x4d')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x3]?_0x386ec3[_0xd4f0('0x3f')][0x3][_0xd4f0('0x40')]:undefined)||[]},{'name':'attrChannel','value':_0x386ec3['attrChannel']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x4]?_0x386ec3[_0xd4f0('0x3f')][0x4][_0xd4f0('0x40')]:undefined)||_0xd4f0('0x4f')},{'name':_0xd4f0('0x50'),'value':_0x386ec3[_0xd4f0('0x50')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x5]?_0x386ec3['attrs'][0x5][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x51'),'value':_0x386ec3['attrFaxAccounts']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x6]?_0x386ec3[_0xd4f0('0x3f')][0x6][_0xd4f0('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x386ec3['attrSmsAccounts']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x7]?_0x386ec3['attrs'][0x7]['value']:undefined)||''},{'name':_0xd4f0('0x53'),'value':_0x386ec3[_0xd4f0('0x53')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3['attrs'][0x8]?_0x386ec3[_0xd4f0('0x3f')][0x8][_0xd4f0('0x40')]:undefined)||''},{'name':_0xd4f0('0x54'),'value':_0x386ec3[_0xd4f0('0x54')]||(_0x386ec3['attrs']&&_0x386ec3['attrs'][0x9]?_0x386ec3[_0xd4f0('0x3f')][0x9]['value']:undefined)||''},{'name':_0xd4f0('0x55'),'value':_0x386ec3['attrChatWebsites']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0xa]?_0x386ec3['attrs'][0xa][_0xd4f0('0x40')]:undefined)||''}];case _0xd4f0('0x5b'):return[{'name':_0xd4f0('0x5c'),'type':_0x386ec3[_0xd4f0('0x5d')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x0]?_0x386ec3[_0xd4f0('0x3f')][0x0]['type']:undefined)||null,'value':_0x386ec3['attrReport']||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x0]?_0x386ec3['attrs'][0x0][_0xd4f0('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x386ec3[_0xd4f0('0x5e')]||(_0x386ec3[_0xd4f0('0x3f')]&&_0x386ec3[_0xd4f0('0x3f')][0x1]?_0x386ec3[_0xd4f0('0x3f')][0x1][_0xd4f0('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x3d4979){logger[_0xd4f0('0x28')]('widgetAttributes:\x20%s',JSON[_0xd4f0('0x5f')](_0x3d4979));return[];}}exports['create']=function(_0x1c0afe,_0x41da67){if(_0x1c0afe[_0xd4f0('0x60')]){_0x1c0afe[_0xd4f0('0x60')][_0xd4f0('0x3f')]=widgetAttributes(_0x1c0afe['body']);}return db[_0xd4f0('0x3b')]['create'](_0x1c0afe[_0xd4f0('0x60')],{})[_0xd4f0('0x26')](respondWithResult(_0x41da67,0xc9))['catch'](handleError(_0x41da67,null));};exports[_0xd4f0('0x25')]=function(_0x45427c,_0x5e330c){if(_0x45427c[_0xd4f0('0x60')]['id']){delete _0x45427c[_0xd4f0('0x60')]['id'];}_0x45427c[_0xd4f0('0x60')][_0xd4f0('0x3f')]=widgetAttributes(_0x45427c[_0xd4f0('0x60')]);return db[_0xd4f0('0x3b')]['find']({'where':{'id':_0x45427c[_0xd4f0('0x2d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x5e330c,null))[_0xd4f0('0x26')](saveUpdates(_0x45427c['body'],null))[_0xd4f0('0x26')](respondWithResult(_0x5e330c,null))[_0xd4f0('0x3c')](handleError(_0x5e330c,null));}; \ No newline at end of file +var _0x3b74=['value','https://','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrFaxAccounts','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','DashboardItem','catch','find','type','iframe','attrs'];(function(_0x3bbd2d,_0xf8ba3c){var _0x241bd4=function(_0x4f02fb){while(--_0x4f02fb){_0x3bbd2d['push'](_0x3bbd2d['shift']());}};_0x241bd4(++_0xf8ba3c);}(_0x3b74,0x80));var _0x43b7=function(_0x17617c,_0x4c6683){_0x17617c=_0x17617c-0x0;var _0x4b6d31=_0x3b74[_0x17617c];return _0x4b6d31;};'use strict';var emlformat=require(_0x43b7('0x0'));var rimraf=require(_0x43b7('0x1'));var zipdir=require(_0x43b7('0x2'));var jsonpatch=require(_0x43b7('0x3'));var rp=require('request-promise');var moment=require(_0x43b7('0x4'));var BPromise=require(_0x43b7('0x5'));var Mustache=require(_0x43b7('0x6'));var util=require(_0x43b7('0x7'));var path=require('path');var sox=require(_0x43b7('0x8'));var csv=require(_0x43b7('0x9'));var ejs=require(_0x43b7('0xa'));var fs=require('fs');var fs_extra=require(_0x43b7('0xb'));var _=require(_0x43b7('0xc'));var squel=require(_0x43b7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x43b7('0xe'));var toCsv=require(_0x43b7('0x9'));var querystring=require('querystring');var Papa=require(_0x43b7('0xf'));var Redis=require(_0x43b7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x43b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43b7('0x12'));var logger=require(_0x43b7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x43b7('0x14'));var licenseUtil=require(_0x43b7('0x15'));var db=require('../../mysqldb')['db'];config[_0x43b7('0x16')]=_['defaults'](config[_0x43b7('0x16')],{'host':_0x43b7('0x17'),'port':0x18eb});var socket=require(_0x43b7('0x18'))(new Redis(config['redis']));require(_0x43b7('0x19'))[_0x43b7('0x1a')](socket);function respondWithStatusCode(_0x307e4d,_0x28c0dd){_0x28c0dd=_0x28c0dd||0xcc;return function(_0x445dad){if(_0x445dad){return _0x307e4d[_0x43b7('0x1b')](_0x28c0dd);}return _0x307e4d[_0x43b7('0x1c')](_0x28c0dd)[_0x43b7('0x1d')]();};}function respondWithResult(_0x4f2b2c,_0x199493){_0x199493=_0x199493||0xc8;return function(_0x481e71){if(_0x481e71){return _0x4f2b2c[_0x43b7('0x1c')](_0x199493)[_0x43b7('0x1e')](_0x481e71);}};}function respondWithFilteredResult(_0x4a2e48,_0x3dd0a6){return function(_0xaaeba5){if(_0xaaeba5){var _0x111798=typeof _0x3dd0a6[_0x43b7('0x1f')]==='undefined'&&typeof _0x3dd0a6[_0x43b7('0x20')]===_0x43b7('0x21');var _0x2091f4=_0xaaeba5[_0x43b7('0x22')];var _0x42a57e=_0x111798?0x0:_0x3dd0a6[_0x43b7('0x1f')];var _0x400022=_0x111798?_0xaaeba5[_0x43b7('0x22')]:_0x3dd0a6[_0x43b7('0x1f')]+_0x3dd0a6['limit'];var _0x30a632;if(_0x400022>=_0x2091f4){_0x400022=_0x2091f4;_0x30a632=0xc8;}else{_0x30a632=0xce;}_0x4a2e48['status'](_0x30a632);return _0x4a2e48[_0x43b7('0x23')](_0x43b7('0x24'),_0x42a57e+'-'+_0x400022+'/'+_0x2091f4)[_0x43b7('0x1e')](_0xaaeba5);}return null;};}function patchUpdates(_0x978ade){return function(_0x406151){try{jsonpatch[_0x43b7('0x25')](_0x406151,_0x978ade,!![]);}catch(_0x4c0527){return BPromise[_0x43b7('0x26')](_0x4c0527);}return _0x406151[_0x43b7('0x27')]();};}function saveUpdates(_0x48e91b,_0x447b70){return function(_0x4fcce3){if(_0x4fcce3){return _0x4fcce3[_0x43b7('0x28')](_0x48e91b)[_0x43b7('0x29')](function(_0x1f6bd7){return _0x1f6bd7;});}return null;};}function removeEntity(_0x42f73a,_0x2d25b0){return function(_0xda601b){if(_0xda601b){return _0xda601b['destroy']()[_0x43b7('0x29')](function(){_0x42f73a[_0x43b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ff13,_0x78e299){return function(_0x461bed){if(!_0x461bed){_0x16ff13[_0x43b7('0x1b')](0x194);}return _0x461bed;};}function handleError(_0x49de1f,_0xd41a04){_0xd41a04=_0xd41a04||0x1f4;return function(_0x3122d7){logger['error'](_0x3122d7[_0x43b7('0x2a')]);if(_0x3122d7[_0x43b7('0x2b')]){delete _0x3122d7['name'];}_0x49de1f[_0x43b7('0x1c')](_0xd41a04)['send'](_0x3122d7);};}exports[_0x43b7('0x2c')]=function(_0x1379bb,_0x3047ca){var _0xc8625c={'raw':![],'where':{'id':_0x1379bb[_0x43b7('0x2d')]['id']}},_0x1eede6={};_0x1eede6[_0x43b7('0x2e')]=_[_0x43b7('0x2f')](db['DashboardItem'][_0x43b7('0x30')]);_0x1eede6[_0x43b7('0x31')]=_['keys'](_0x1379bb[_0x43b7('0x31')]);_0x1eede6[_0x43b7('0x32')]=_[_0x43b7('0x33')](_0x1eede6[_0x43b7('0x2e')],_0x1eede6[_0x43b7('0x31')]);_0xc8625c[_0x43b7('0x34')]=_[_0x43b7('0x33')](_0x1eede6[_0x43b7('0x2e')],qs['fields'](_0x1379bb[_0x43b7('0x31')][_0x43b7('0x35')]));_0xc8625c[_0x43b7('0x34')]=_0xc8625c['attributes']['length']?_0xc8625c[_0x43b7('0x34')]:_0x1eede6[_0x43b7('0x2e')];if(_0x1379bb['query'][_0x43b7('0x36')]){_0xc8625c[_0x43b7('0x37')]=[{'all':!![]}];}_0xc8625c=_[_0x43b7('0x38')]({},_0xc8625c,_0x1379bb[_0x43b7('0x39')]);return db[_0x43b7('0x3a')]['find'](_0xc8625c)[_0x43b7('0x29')](handleEntityNotFound(_0x3047ca,null))[_0x43b7('0x29')](respondWithResult(_0x3047ca,null))[_0x43b7('0x3b')](handleError(_0x3047ca,null));};exports['destroy']=function(_0x2b0921,_0xacb382){return db[_0x43b7('0x3a')][_0x43b7('0x3c')]({'where':{'id':_0x2b0921[_0x43b7('0x2d')]['id']}})[_0x43b7('0x29')](handleEntityNotFound(_0xacb382,null))[_0x43b7('0x29')](removeEntity(_0xacb382,null))[_0x43b7('0x3b')](handleError(_0xacb382,null));};function widgetAttributes(_0x3f7eb2){try{switch(_0x3f7eb2[_0x43b7('0x3d')]){case _0x43b7('0x3e'):return[{'name':'attrUrl','value':_0x3f7eb2['attrUrl']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||_0x43b7('0x41')}];case'custom':return[{'name':_0x43b7('0x42'),'value':_0x3f7eb2[_0x43b7('0x42')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||''}];case _0x43b7('0x43'):return[{'name':'attrHourFormat','value':_0x3f7eb2['attrHourFormat']||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||_0x43b7('0x44')},{'name':_0x43b7('0x45'),'value':_0x3f7eb2[_0x43b7('0x45')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x1]?_0x3f7eb2['attrs'][0x1][_0x43b7('0x40')]:undefined)||'0.00'},{'name':_0x43b7('0x46'),'value':_0x3f7eb2['attrFontSize']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2]['value']:undefined)||0xc}];case _0x43b7('0x47'):return[{'name':_0x43b7('0x48'),'value':_0x3f7eb2['attrMetric']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x40')]:undefined)||'total'},{'name':_0x43b7('0x49'),'value':_0x3f7eb2[_0x43b7('0x49')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0x1]?_0x3f7eb2['attrs'][0x1][_0x43b7('0x40')]:undefined)||[]},{'name':_0x43b7('0x46'),'value':_0x3f7eb2[_0x43b7('0x46')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0x43b7('0x4a'),'value':_0x3f7eb2[_0x43b7('0x4a')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x3]?_0x3f7eb2['attrs'][0x3][_0x43b7('0x40')]:undefined)||_0x43b7('0x4b')},{'name':_0x43b7('0x4c'),'value':_0x3f7eb2[_0x43b7('0x4c')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x4]?_0x3f7eb2[_0x43b7('0x3f')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3f7eb2['attrFaxAccounts']||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x5]?_0x3f7eb2[_0x43b7('0x3f')][0x5][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4d'),'value':_0x3f7eb2[_0x43b7('0x4d')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x6]?_0x3f7eb2['attrs'][0x6][_0x43b7('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3f7eb2['attrOpenchannelAccounts']||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x7]?_0x3f7eb2['attrs'][0x7][_0x43b7('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3f7eb2[_0x43b7('0x4e')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x8]?_0x3f7eb2['attrs'][0x8][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4f'),'value':_0x3f7eb2[_0x43b7('0x4f')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x9]?_0x3f7eb2[_0x43b7('0x3f')][0x9][_0x43b7('0x40')]:undefined)||''}];case'multibar-chart':case _0x43b7('0x50'):return[{'name':_0x43b7('0x51'),'value':_0x3f7eb2[_0x43b7('0x51')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||_0x43b7('0x52')},{'name':_0x43b7('0x53'),'value':_0x3f7eb2[_0x43b7('0x53')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x1]?_0x3f7eb2[_0x43b7('0x3f')][0x1][_0x43b7('0x40')]:undefined)||null},{'name':_0x43b7('0x54'),'value':_0x3f7eb2[_0x43b7('0x54')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x2]?_0x3f7eb2[_0x43b7('0x3f')][0x2][_0x43b7('0x40')]:undefined)||null},{'name':_0x43b7('0x49'),'value':_0x3f7eb2[_0x43b7('0x49')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x3]?_0x3f7eb2[_0x43b7('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x43b7('0x4a'),'value':_0x3f7eb2[_0x43b7('0x4a')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x4]?_0x3f7eb2[_0x43b7('0x3f')][0x4][_0x43b7('0x40')]:undefined)||_0x43b7('0x4b')},{'name':_0x43b7('0x4c'),'value':_0x3f7eb2[_0x43b7('0x4c')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x5]?_0x3f7eb2[_0x43b7('0x3f')][0x5][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x55'),'value':_0x3f7eb2[_0x43b7('0x55')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x6]?_0x3f7eb2[_0x43b7('0x3f')][0x6][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4d'),'value':_0x3f7eb2[_0x43b7('0x4d')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x7]?_0x3f7eb2['attrs'][0x7][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x56'),'value':_0x3f7eb2[_0x43b7('0x56')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x8]?_0x3f7eb2[_0x43b7('0x3f')][0x8][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4e'),'value':_0x3f7eb2[_0x43b7('0x4e')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x9]?_0x3f7eb2[_0x43b7('0x3f')][0x9][_0x43b7('0x40')]:undefined)||''},{'name':_0x43b7('0x4f'),'value':_0x3f7eb2[_0x43b7('0x4f')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2['attrs'][0xa]?_0x3f7eb2[_0x43b7('0x3f')][0xa][_0x43b7('0x40')]:undefined)||''}];case _0x43b7('0x57'):return[{'name':_0x43b7('0x58'),'type':_0x3f7eb2[_0x43b7('0x59')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2[_0x43b7('0x3f')][0x0][_0x43b7('0x3d')]:undefined)||null,'value':_0x3f7eb2[_0x43b7('0x58')]||(_0x3f7eb2['attrs']&&_0x3f7eb2[_0x43b7('0x3f')][0x0]?_0x3f7eb2['attrs'][0x0]['value']:undefined)||null},{'name':_0x43b7('0x5a'),'value':_0x3f7eb2[_0x43b7('0x5a')]||(_0x3f7eb2[_0x43b7('0x3f')]&&_0x3f7eb2[_0x43b7('0x3f')][0x1]?_0x3f7eb2[_0x43b7('0x3f')][0x1][_0x43b7('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x11f2bb){logger[_0x43b7('0x5b')](_0x43b7('0x5c'),JSON[_0x43b7('0x5d')](_0x11f2bb));return[];}}exports['create']=function(_0x3db8ed,_0x13369c){if(_0x3db8ed[_0x43b7('0x5e')]){_0x3db8ed[_0x43b7('0x5e')][_0x43b7('0x3f')]=widgetAttributes(_0x3db8ed[_0x43b7('0x5e')]);}return db[_0x43b7('0x3a')][_0x43b7('0x5f')](_0x3db8ed[_0x43b7('0x5e')],{})[_0x43b7('0x29')](respondWithResult(_0x13369c,0xc9))['catch'](handleError(_0x13369c,null));};exports[_0x43b7('0x28')]=function(_0xd40838,_0x143164){if(_0xd40838[_0x43b7('0x5e')]['id']){delete _0xd40838[_0x43b7('0x5e')]['id'];}_0xd40838[_0x43b7('0x5e')][_0x43b7('0x3f')]=widgetAttributes(_0xd40838[_0x43b7('0x5e')]);return db[_0x43b7('0x3a')][_0x43b7('0x3c')]({'where':{'id':_0xd40838[_0x43b7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x143164,null))[_0x43b7('0x29')](saveUpdates(_0xd40838[_0x43b7('0x5e')],null))[_0x43b7('0x29')](respondWithResult(_0x143164,null))['catch'](handleError(_0x143164,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 7c851ec..6cab198 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 _0xa3e8=['DashboardItem','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x403b7c,_0x5d1d4d){var _0x34e519=function(_0x96866b){while(--_0x96866b){_0x403b7c['push'](_0x403b7c['shift']());}};_0x34e519(++_0x5d1d4d);}(_0xa3e8,0x127));var _0x8a3e=function(_0x5ad729,_0xb024b2){_0x5ad729=_0x5ad729-0x0;var _0x40e411=_0xa3e8[_0x5ad729];return _0x40e411;};'use strict';var EventEmitter=require(_0x8a3e('0x0'));var DashboardItem=require(_0x8a3e('0x1'))['db'][_0x8a3e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a3e('0x3'),'afterUpdate':_0x8a3e('0x4'),'afterDestroy':_0x8a3e('0x5')};function emitEvent(_0xe6cae2){return function(_0x109d7a,_0x5a81bb,_0x4889a0){DashboardItemEvents['emit'](_0xe6cae2+':'+_0x109d7a['id'],_0x109d7a);DashboardItemEvents[_0x8a3e('0x6')](_0xe6cae2,_0x109d7a);_0x4889a0(null);};}for(var e in events){if(events[_0x8a3e('0x7')](e)){var event=events[e];DashboardItem[_0x8a3e('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x79da=['update','emit','hook','exports','events','DashboardItem','setMaxListeners','save'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x79da,0x194));var _0xa79d=function(_0x2eafef,_0x4f1383){_0x2eafef=_0x2eafef-0x0;var _0xa9dcdc=_0x79da[_0x2eafef];return _0xa9dcdc;};'use strict';var EventEmitter=require(_0xa79d('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa79d('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa79d('0x2')](0x0);var events={'afterCreate':_0xa79d('0x3'),'afterUpdate':_0xa79d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55900e){return function(_0x2fb503,_0x43e572,_0x3e9d37){DashboardItemEvents[_0xa79d('0x5')](_0x55900e+':'+_0x2fb503['id'],_0x2fb503);DashboardItemEvents[_0xa79d('0x5')](_0x55900e,_0x2fb503);_0x3e9d37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xa79d('0x6')](e,emitEvent(event));}}module[_0xa79d('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 260179a..d010173 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 _0x47b4=['exports','DashboardItem','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x47b4,0x1e2));var _0x447b=function(_0x368161,_0x56df36){_0x368161=_0x368161-0x0;var _0x5f50e2=_0x47b4[_0x368161];return _0x5f50e2;};'use strict';var _=require(_0x447b('0x0'));var util=require('util');var logger=require(_0x447b('0x1'))(_0x447b('0x2'));var moment=require('moment');var BPromise=require(_0x447b('0x3'));var rp=require(_0x447b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x447b('0x5'));var config=require(_0x447b('0x6'));var attributes=require(_0x447b('0x7'));module[_0x447b('0x8')]=function(_0x302a00,_0x58ffc0){return _0x302a00['define'](_0x447b('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81e2=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','lodash','util'];(function(_0x4e06a6,_0x559172){var _0x8a58de=function(_0x12f984){while(--_0x12f984){_0x4e06a6['push'](_0x4e06a6['shift']());}};_0x8a58de(++_0x559172);}(_0x81e2,0x1c1));var _0x281e=function(_0x558565,_0x4262ea){_0x558565=_0x558565-0x0;var _0x5320b9=_0x81e2[_0x558565];return _0x5320b9;};'use strict';var _=require(_0x281e('0x0'));var util=require(_0x281e('0x1'));var logger=require(_0x281e('0x2'))('api');var moment=require(_0x281e('0x3'));var BPromise=require('bluebird');var rp=require(_0x281e('0x4'));var fs=require('fs');var path=require(_0x281e('0x5'));var rimraf=require(_0x281e('0x6'));var config=require(_0x281e('0x7'));var attributes=require(_0x281e('0x8'));module['exports']=function(_0x43a586,_0x8f5860){return _0x43a586['define'](_0x281e('0x9'),attributes,{'tableName':_0x281e('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 9e3487f..a823ade 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 _0x8ea3=['http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x146e71,_0x3ef320){var _0x592b5a=function(_0x210186){while(--_0x210186){_0x146e71['push'](_0x146e71['shift']());}};_0x592b5a(++_0x3ef320);}(_0x8ea3,0x1b9));var _0x38ea=function(_0x159c68,_0xc544c9){_0x159c68=_0x159c68-0x0;var _0x32792f=_0x8ea3[_0x159c68];return _0x32792f;};'use strict';var _=require(_0x38ea('0x0'));var util=require('util');var moment=require(_0x38ea('0x1'));var BPromise=require(_0x38ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38ea('0x3'));var db=require(_0x38ea('0x4'))['db'];var utils=require(_0x38ea('0x5'));var logger=require('../../config/logger')(_0x38ea('0x6'));var config=require(_0x38ea('0x7'));var jayson=require(_0x38ea('0x8'));var client=jayson['client'][_0x38ea('0x9')]({'port':0x232a});config[_0x38ea('0xa')]=_[_0x38ea('0xb')](config[_0x38ea('0xa')],{'host':_0x38ea('0xc'),'port':0x18eb});var socket=require(_0x38ea('0xd'))(new Redis(config[_0x38ea('0xa')]));require(_0x38ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x143e07,_0x515638,_0x51f348){return new BPromise(function(_0x3d73bd,_0xd9d4e){return client[_0x38ea('0xf')](_0x143e07,_0x51f348)[_0x38ea('0x10')](function(_0x21e186){logger[_0x38ea('0x11')](_0x38ea('0x12'),_0x515638,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x515638,_0x38ea('0x13'),JSON[_0x38ea('0x14')](_0x21e186));if(_0x21e186[_0x38ea('0x15')]){if(_0x21e186['error'][_0x38ea('0x16')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x515638,_0x21e186[_0x38ea('0x15')][_0x38ea('0x17')]);return _0xd9d4e(_0x21e186['error']['message']);}logger[_0x38ea('0x15')](_0x38ea('0x12'),_0x515638,_0x21e186['error'][_0x38ea('0x17')]);return _0x3d73bd(_0x21e186[_0x38ea('0x15')]['message']);}else{logger['info'](_0x38ea('0x12'),_0x515638,_0x38ea('0x13'));_0x3d73bd(_0x21e186['result']['message']);}})[_0x38ea('0x18')](function(_0x5f55b1){logger[_0x38ea('0x15')](_0x38ea('0x12'),_0x515638,_0x5f55b1);_0xd9d4e(_0x5f55b1);});});} \ No newline at end of file +var _0xce5c=['randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','DashboardItem,\x20%s,\x20%s','lodash','util','moment','bluebird'];(function(_0x4e4ec1,_0x823785){var _0x3d8f35=function(_0x40e453){while(--_0x40e453){_0x4e4ec1['push'](_0x4e4ec1['shift']());}};_0x3d8f35(++_0x823785);}(_0xce5c,0x1f0));var _0xcce5=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xce5c[_0x4c5c97];return _0xd5d2cb;};'use strict';var _=require(_0xcce5('0x0'));var util=require(_0xcce5('0x1'));var moment=require(_0xcce5('0x2'));var BPromise=require(_0xcce5('0x3'));var rs=require(_0xcce5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcce5('0x5'));var logger=require(_0xcce5('0x6'))('rpc');var config=require(_0xcce5('0x7'));var jayson=require(_0xcce5('0x8'));var client=jayson[_0xcce5('0x9')][_0xcce5('0xa')]({'port':0x232a});config[_0xcce5('0xb')]=_[_0xcce5('0xc')](config[_0xcce5('0xb')],{'host':_0xcce5('0xd'),'port':0x18eb});var socket=require(_0xcce5('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0xd61c0c,_0x211723,_0x9f84c){return new BPromise(function(_0x20d1f3,_0x2ca19a){return client[_0xcce5('0xf')](_0xd61c0c,_0x9f84c)[_0xcce5('0x10')](function(_0x2634a1){logger[_0xcce5('0x11')]('DashboardItem,\x20%s,\x20%s',_0x211723,'request\x20sent');logger[_0xcce5('0x12')](_0xcce5('0x13'),_0x211723,_0xcce5('0x14'),JSON[_0xcce5('0x15')](_0x2634a1));if(_0x2634a1[_0xcce5('0x16')]){if(_0x2634a1['error']['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x211723,_0x2634a1[_0xcce5('0x16')][_0xcce5('0x17')]);return _0x2ca19a(_0x2634a1[_0xcce5('0x16')][_0xcce5('0x17')]);}logger[_0xcce5('0x16')](_0xcce5('0x18'),_0x211723,_0x2634a1['error'][_0xcce5('0x17')]);return _0x20d1f3(_0x2634a1['error']['message']);}else{logger['info'](_0xcce5('0x18'),_0x211723,_0xcce5('0x14'));_0x20d1f3(_0x2634a1['result'][_0xcce5('0x17')]);}})['catch'](function(_0x4a46d2){logger['error'](_0xcce5('0x18'),_0x211723,_0x4a46d2);_0x2ca19a(_0x4a46d2);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 89b2566..17019d0 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 _0x327a=['remove','update','removeListener','register','length','./dashboardItem.events','save'];(function(_0x469fe3,_0x1c116f){var _0x323496=function(_0x5a639f){while(--_0x5a639f){_0x469fe3['push'](_0x469fe3['shift']());}};_0x323496(++_0x1c116f);}(_0x327a,0xc9));var _0xa327=function(_0x260808,_0x3b3ca0){_0x260808=_0x260808-0x0;var _0xefc021=_0x327a[_0x260808];return _0xefc021;};'use strict';var DashboardItemEvents=require(_0xa327('0x0'));var events=[_0xa327('0x1'),_0xa327('0x2'),_0xa327('0x3')];function createListener(_0x52d4f6,_0x16355e){return function(_0x5eb136){_0x16355e['emit'](_0x52d4f6,_0x5eb136);};}function removeListener(_0x11123e,_0x4b2468){return function(){DashboardItemEvents[_0xa327('0x4')](_0x11123e,_0x4b2468);};}exports[_0xa327('0x5')]=function(_0x4fccb6){for(var _0x13d622=0x0,_0x500bf9=events[_0xa327('0x6')];_0x13d622<_0x500bf9;_0x13d622++){var _0x4a01fb=events[_0x13d622];var _0x4d06d0=createListener('dashboardItem:'+_0x4a01fb,_0x4fccb6);DashboardItemEvents['on'](_0x4a01fb,_0x4d06d0);}}; \ No newline at end of file +var _0x47ef=['./dashboardItem.events','save','remove','update','removeListener','register','length','dashboardItem:'];(function(_0x9e8cee,_0x4b7f0a){var _0x259e35=function(_0x455c7b){while(--_0x455c7b){_0x9e8cee['push'](_0x9e8cee['shift']());}};_0x259e35(++_0x4b7f0a);}(_0x47ef,0x188));var _0xf47e=function(_0x4a2a69,_0x42508b){_0x4a2a69=_0x4a2a69-0x0;var _0x1daddd=_0x47ef[_0x4a2a69];return _0x1daddd;};'use strict';var DashboardItemEvents=require(_0xf47e('0x0'));var events=[_0xf47e('0x1'),_0xf47e('0x2'),_0xf47e('0x3')];function createListener(_0x3616c0,_0x433555){return function(_0x268f36){_0x433555['emit'](_0x3616c0,_0x268f36);};}function removeListener(_0x541640,_0x20701c){return function(){DashboardItemEvents[_0xf47e('0x4')](_0x541640,_0x20701c);};}exports[_0xf47e('0x5')]=function(_0x168ef4){for(var _0xd724ee=0x0,_0x84e034=events[_0xf47e('0x6')];_0xd724ee<_0x84e034;_0xd724ee++){var _0x3cf1de=events[_0xd724ee];var _0xfc390d=createListener(_0xf47e('0x7')+_0x3cf1de,_0x168ef4);DashboardItemEvents['on'](_0x3cf1de,_0xfc390d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 77b430c..e99cef9 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 _0x522a=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x18fc83,_0x205c12){var _0x397c28=function(_0x545253){while(--_0x545253){_0x18fc83['push'](_0x18fc83['shift']());}};_0x397c28(++_0x205c12);}(_0x522a,0x11f));var _0xa522=function(_0x485038,_0x3e26e8){_0x485038=_0x485038-0x0;var _0xa87ace=_0x522a[_0x485038];return _0xa87ace;};'use strict';var multer=require(_0xa522('0x0'));var util=require(_0xa522('0x1'));var path=require('path');var timeout=require(_0xa522('0x2'));var express=require(_0xa522('0x3'));var router=express[_0xa522('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa522('0x5'));var config=require(_0xa522('0x6'));var controller=require(_0xa522('0x7'));router[_0xa522('0x8')](_0xa522('0x9'),auth[_0xa522('0xa')](),controller['show']);router['post']('/',auth[_0xa522('0xa')](),controller[_0xa522('0xb')]);router[_0xa522('0xc')]('/:id',auth[_0xa522('0xa')](),controller[_0xa522('0xd')]);router[_0xa522('0xe')]('/:id',auth[_0xa522('0xa')](),controller[_0xa522('0xf')]);module[_0xa522('0x10')]=router; \ No newline at end of file +var _0x4b02=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x4bae15,_0x3cdcd0){var _0x239526=function(_0x2bb22e){while(--_0x2bb22e){_0x4bae15['push'](_0x4bae15['shift']());}};_0x239526(++_0x3cdcd0);}(_0x4b02,0x1cc));var _0x24b0=function(_0x20db09,_0x351119){_0x20db09=_0x20db09-0x0;var _0x549839=_0x4b02[_0x20db09];return _0x549839;};'use strict';var multer=require(_0x24b0('0x0'));var util=require(_0x24b0('0x1'));var path=require('path');var timeout=require(_0x24b0('0x2'));var express=require('express');var router=express[_0x24b0('0x3')]();var fs_extra=require(_0x24b0('0x4'));var auth=require(_0x24b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24b0('0x6'));var controller=require('./dashboardItem.controller');router['get'](_0x24b0('0x7'),auth[_0x24b0('0x8')](),controller[_0x24b0('0x9')]);router[_0x24b0('0xa')]('/',auth[_0x24b0('0x8')](),controller[_0x24b0('0xb')]);router[_0x24b0('0xc')]('/:id',auth[_0x24b0('0x8')](),controller[_0x24b0('0xd')]);router[_0x24b0('0xe')](_0x24b0('0x7'),auth[_0x24b0('0x8')](),controller[_0x24b0('0xf')]);module[_0x24b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4e90ca6..c69b651 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 _0xae10=['first','third','STRING','sequelize','exports'];(function(_0x4073ea,_0x56357c){var _0x44df4a=function(_0x165cf9){while(--_0x165cf9){_0x4073ea['push'](_0x4073ea['shift']());}};_0x44df4a(++_0x56357c);}(_0xae10,0x94));var _0x0ae1=function(_0xad0054,_0x20c4a5){_0xad0054=_0xad0054-0x0;var _0x2733fd=_0xae10[_0xad0054];return _0x2733fd;};'use strict';var Sequelize=require(_0x0ae1('0x0'));module[_0x0ae1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x0ae1('0x2'),'second',_0x0ae1('0x3')),'allowNull':![],'defaultValue':_0x0ae1('0x2')},'description':{'type':Sequelize[_0x0ae1('0x4')]}}; \ No newline at end of file +var _0xf7fd=['exports','STRING','ENUM','second','first'];(function(_0x28730b,_0x7c2018){var _0xeb51f2=function(_0xeb859f){while(--_0xeb859f){_0x28730b['push'](_0x28730b['shift']());}};_0xeb51f2(++_0x7c2018);}(_0xf7fd,0x1ef));var _0xdf7f=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf7fd[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require('sequelize');module[_0xdf7f('0x0')]={'name':{'type':Sequelize[_0xdf7f('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xdf7f('0x2')]('first',_0xdf7f('0x3'),'third'),'allowNull':![],'defaultValue':_0xdf7f('0x4')},'description':{'type':Sequelize[_0xdf7f('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b86c0d6..f4762c4 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 _0x7c1a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','intersection','fields','includeAll','find','create','body'];(function(_0x3b9909,_0x39cbd5){var _0x4419cd=function(_0x4458bf){while(--_0x4458bf){_0x3b9909['push'](_0x3b9909['shift']());}};_0x4419cd(++_0x39cbd5);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1e647b,_0x359b5e){_0x1e647b=_0x1e647b-0x0;var _0x23b626=_0x7c1a[_0x1e647b];return _0x23b626;};'use strict';var emlformat=require(_0xa7c1('0x0'));var rimraf=require(_0xa7c1('0x1'));var zipdir=require(_0xa7c1('0x2'));var jsonpatch=require(_0xa7c1('0x3'));var rp=require(_0xa7c1('0x4'));var moment=require(_0xa7c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa7c1('0x6'));var util=require(_0xa7c1('0x7'));var path=require('path');var sox=require(_0xa7c1('0x8'));var csv=require('to-csv');var ejs=require(_0xa7c1('0x9'));var fs=require('fs');var fs_extra=require(_0xa7c1('0xa'));var _=require(_0xa7c1('0xb'));var squel=require(_0xa7c1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7c1('0xd'));var toCsv=require(_0xa7c1('0xe'));var querystring=require(_0xa7c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa7c1('0x10'));var authService=require(_0xa7c1('0x11'));var qs=require(_0xa7c1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c1('0x13'));var logger=require(_0xa7c1('0x14'))('api');var utils=require(_0xa7c1('0x15'));var config=require(_0xa7c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7c1('0x17'))['db'];function respondWithStatusCode(_0x1d7d67,_0x26d63a){_0x26d63a=_0x26d63a||0xcc;return function(_0x3f5f02){if(_0x3f5f02){return _0x1d7d67[_0xa7c1('0x18')](_0x26d63a);}return _0x1d7d67[_0xa7c1('0x19')](_0x26d63a)[_0xa7c1('0x1a')]();};}function respondWithResult(_0xb74ba2,_0x3fc9e6){_0x3fc9e6=_0x3fc9e6||0xc8;return function(_0x21ce41){if(_0x21ce41){return _0xb74ba2[_0xa7c1('0x19')](_0x3fc9e6)[_0xa7c1('0x1b')](_0x21ce41);}};}function respondWithFilteredResult(_0xe28779,_0x5a0c8e){return function(_0xba02b){if(_0xba02b){var _0x3a6f47=typeof _0x5a0c8e[_0xa7c1('0x1c')]===_0xa7c1('0x1d')&&typeof _0x5a0c8e[_0xa7c1('0x1e')]==='undefined';var _0x3b77af=_0xba02b['count'];var _0x440251=_0x3a6f47?0x0:_0x5a0c8e[_0xa7c1('0x1c')];var _0x5dc8e3=_0x3a6f47?_0xba02b[_0xa7c1('0x1f')]:_0x5a0c8e[_0xa7c1('0x1c')]+_0x5a0c8e[_0xa7c1('0x1e')];var _0x5d3841;if(_0x5dc8e3>=_0x3b77af){_0x5dc8e3=_0x3b77af;_0x5d3841=0xc8;}else{_0x5d3841=0xce;}_0xe28779[_0xa7c1('0x19')](_0x5d3841);return _0xe28779[_0xa7c1('0x20')](_0xa7c1('0x21'),_0x440251+'-'+_0x5dc8e3+'/'+_0x3b77af)[_0xa7c1('0x1b')](_0xba02b);}return null;};}function patchUpdates(_0x3b131e){return function(_0x31c16a){try{jsonpatch[_0xa7c1('0x22')](_0x31c16a,_0x3b131e,!![]);}catch(_0xdfcbd9){return BPromise[_0xa7c1('0x23')](_0xdfcbd9);}return _0x31c16a['save']();};}function saveUpdates(_0x42ad46,_0x1c9b7c){return function(_0x1ebcdd){if(_0x1ebcdd){return _0x1ebcdd['update'](_0x42ad46)[_0xa7c1('0x24')](function(_0x7dbe77){return _0x7dbe77;});}return null;};}function removeEntity(_0x43d61f,_0x2dc42b){return function(_0x30cb15){if(_0x30cb15){return _0x30cb15[_0xa7c1('0x25')]()[_0xa7c1('0x24')](function(){var _0x53e490=_0x30cb15['get']({'plain':!![]});var _0x48280a=_0xa7c1('0x26');return db[_0xa7c1('0x27')][_0xa7c1('0x25')]({'where':{'type':_0x48280a,'resourceId':_0x53e490['id']}})[_0xa7c1('0x24')](function(){return _0x30cb15;});})[_0xa7c1('0x24')](function(){_0x43d61f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x465dd1,_0x2726e9){return function(_0xc60f7c){if(!_0xc60f7c){_0x465dd1['sendStatus'](0x194);}return _0xc60f7c;};}function handleError(_0x2c42b4,_0x9a6f55){_0x9a6f55=_0x9a6f55||0x1f4;return function(_0x2fe45b){logger[_0xa7c1('0x28')](_0x2fe45b[_0xa7c1('0x29')]);if(_0x2fe45b[_0xa7c1('0x2a')]){delete _0x2fe45b[_0xa7c1('0x2a')];}_0x2c42b4[_0xa7c1('0x19')](_0x9a6f55)[_0xa7c1('0x2b')](_0x2fe45b);};}exports[_0xa7c1('0x2c')]=function(_0x599b08,_0x6b764d){var _0x924b93={},_0x2a5d5c={},_0x40ad2b={'count':0x0,'rows':[]};var _0x216fd5=_[_0xa7c1('0x2d')](db[_0xa7c1('0x2e')][_0xa7c1('0x2f')],function(_0x42b5a1){return{'name':_0x42b5a1['fieldName'],'type':_0x42b5a1[_0xa7c1('0x30')][_0xa7c1('0x31')]};});_0x2a5d5c[_0xa7c1('0x32')]=_[_0xa7c1('0x2d')](_0x216fd5,'name');_0x2a5d5c['query']=_[_0xa7c1('0x33')](_0x599b08[_0xa7c1('0x34')]);_0x2a5d5c[_0xa7c1('0x35')]=_['intersection'](_0x2a5d5c['model'],_0x2a5d5c[_0xa7c1('0x34')]);_0x924b93[_0xa7c1('0x36')]=_['intersection'](_0x2a5d5c[_0xa7c1('0x32')],qs['fields'](_0x599b08[_0xa7c1('0x34')]['fields']));_0x924b93[_0xa7c1('0x36')]=_0x924b93[_0xa7c1('0x36')]['length']?_0x924b93['attributes']:_0x2a5d5c[_0xa7c1('0x32')];if(!_0x599b08[_0xa7c1('0x34')][_0xa7c1('0x37')](_0xa7c1('0x38'))){_0x924b93[_0xa7c1('0x1e')]=qs[_0xa7c1('0x1e')](_0x599b08[_0xa7c1('0x34')]['limit']);_0x924b93[_0xa7c1('0x1c')]=qs[_0xa7c1('0x1c')](_0x599b08[_0xa7c1('0x34')][_0xa7c1('0x1c')]);}_0x924b93[_0xa7c1('0x39')]=qs[_0xa7c1('0x3a')](_0x599b08['query'][_0xa7c1('0x3a')]);_0x924b93[_0xa7c1('0x3b')]=qs[_0xa7c1('0x35')](_[_0xa7c1('0x3c')](_0x599b08[_0xa7c1('0x34')],_0x2a5d5c[_0xa7c1('0x35')]),_0x216fd5);if(_0x599b08[_0xa7c1('0x34')][_0xa7c1('0x3d')]){_0x924b93['where']=_[_0xa7c1('0x3e')](_0x924b93[_0xa7c1('0x3b')],{'$or':_[_0xa7c1('0x2d')](_0x216fd5,function(_0x1822e8){if(_0x1822e8[_0xa7c1('0x30')]!==_0xa7c1('0x3f')){var _0x3e438b={};_0x3e438b[_0x1822e8[_0xa7c1('0x2a')]]={'$like':'%'+_0x599b08[_0xa7c1('0x34')][_0xa7c1('0x3d')]+'%'};return _0x3e438b;}})});}_0x924b93=_[_0xa7c1('0x3e')]({},_0x924b93,_0x599b08[_0xa7c1('0x40')]);var _0x24f152={'where':_0x924b93[_0xa7c1('0x3b')]};return db[_0xa7c1('0x2e')][_0xa7c1('0x1f')](_0x24f152)[_0xa7c1('0x24')](function(_0x4c0ef7){_0x40ad2b[_0xa7c1('0x1f')]=_0x4c0ef7;if(_0x599b08[_0xa7c1('0x34')]['includeAll']){_0x924b93[_0xa7c1('0x41')]=[{'all':!![]}];}return db[_0xa7c1('0x2e')][_0xa7c1('0x42')](_0x924b93);})[_0xa7c1('0x24')](function(_0x4a43c1){_0x40ad2b[_0xa7c1('0x43')]=_0x4a43c1;return _0x40ad2b;})['then'](respondWithFilteredResult(_0x6b764d,_0x924b93))['catch'](handleError(_0x6b764d,null));};exports[_0xa7c1('0x44')]=function(_0x1d131e,_0x3c1a72){var _0xdbc206={'raw':!![],'where':{'id':_0x1d131e['params']['id']}},_0x3a1b90={};_0x3a1b90[_0xa7c1('0x32')]=_[_0xa7c1('0x33')](db[_0xa7c1('0x2e')]['rawAttributes']);_0x3a1b90['query']=_[_0xa7c1('0x33')](_0x1d131e[_0xa7c1('0x34')]);_0x3a1b90['filters']=_[_0xa7c1('0x45')](_0x3a1b90[_0xa7c1('0x32')],_0x3a1b90[_0xa7c1('0x34')]);_0xdbc206[_0xa7c1('0x36')]=_[_0xa7c1('0x45')](_0x3a1b90['model'],qs[_0xa7c1('0x46')](_0x1d131e[_0xa7c1('0x34')][_0xa7c1('0x46')]));_0xdbc206[_0xa7c1('0x36')]=_0xdbc206[_0xa7c1('0x36')]['length']?_0xdbc206[_0xa7c1('0x36')]:_0x3a1b90[_0xa7c1('0x32')];if(_0x1d131e[_0xa7c1('0x34')][_0xa7c1('0x47')]){_0xdbc206[_0xa7c1('0x41')]=[{'all':!![]}];}_0xdbc206=_[_0xa7c1('0x3e')]({},_0xdbc206,_0x1d131e['options']);return db[_0xa7c1('0x2e')][_0xa7c1('0x48')](_0xdbc206)[_0xa7c1('0x24')](handleEntityNotFound(_0x3c1a72,null))[_0xa7c1('0x24')](respondWithResult(_0x3c1a72,null))['catch'](handleError(_0x3c1a72,null));};exports['create']=function(_0x33e535,_0x4b8da7){return db[_0xa7c1('0x2e')][_0xa7c1('0x49')](_0x33e535[_0xa7c1('0x4a')],{})['then'](function(_0x219197){var _0x4269a0=_0x33e535['user']['get']({'plain':!![]});if(!_0x4269a0)throw new Error(_0xa7c1('0x4b'));if(_0x4269a0[_0xa7c1('0x4c')]===_0xa7c1('0x4d')){var _0x4b58bb=_0x219197[_0xa7c1('0x4e')]({'plain':!![]});var _0x3c4819=_0xa7c1('0x26');return db[_0xa7c1('0x4f')][_0xa7c1('0x48')]({'where':{'name':_0x3c4819,'userProfileId':_0x4269a0['userProfileId']},'raw':!![]})['then'](function(_0x1a459c){if(_0x1a459c&&_0x1a459c[_0xa7c1('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b58bb[_0xa7c1('0x2a')],'resourceId':_0x4b58bb['id'],'type':_0x1a459c[_0xa7c1('0x2a')],'sectionId':_0x1a459c['id']},{})['then'](function(){return _0x219197;});}else{return _0x219197;}})[_0xa7c1('0x51')](function(_0x53c506){logger['error'](_0xa7c1('0x52'),_0x53c506);throw _0x53c506;});}return _0x219197;})[_0xa7c1('0x24')](respondWithResult(_0x4b8da7,0xc9))[_0xa7c1('0x51')](handleError(_0x4b8da7,null));};exports['update']=function(_0x33db7d,_0x507cd8){if(_0x33db7d[_0xa7c1('0x4a')]['id']){delete _0x33db7d[_0xa7c1('0x4a')]['id'];}return db['Disposition'][_0xa7c1('0x48')]({'where':{'id':_0x33db7d['params']['id']}})[_0xa7c1('0x24')](handleEntityNotFound(_0x507cd8,null))[_0xa7c1('0x24')](saveUpdates(_0x33db7d['body'],null))[_0xa7c1('0x24')](respondWithResult(_0x507cd8,null))['catch'](handleError(_0x507cd8,null));};exports[_0xa7c1('0x25')]=function(_0x154305,_0x2da015){return db[_0xa7c1('0x2e')]['find']({'where':{'id':_0x154305[_0xa7c1('0x53')]['id']}})[_0xa7c1('0x24')](handleEntityNotFound(_0x2da015,null))['then'](removeEntity(_0x2da015,null))['catch'](handleError(_0x2da015,null));}; \ No newline at end of file +var _0xcf6a=['keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x3999c0,_0x526cef){var _0x366466=function(_0x1c70e0){while(--_0x1c70e0){_0x3999c0['push'](_0x3999c0['shift']());}};_0x366466(++_0x526cef);}(_0xcf6a,0xbb));var _0xacf6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcf6a[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xacf6('0x0'));var rimraf=require(_0xacf6('0x1'));var zipdir=require(_0xacf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xacf6('0x3'));var BPromise=require(_0xacf6('0x4'));var Mustache=require(_0xacf6('0x5'));var util=require(_0xacf6('0x6'));var path=require(_0xacf6('0x7'));var sox=require('sox');var csv=require(_0xacf6('0x8'));var ejs=require(_0xacf6('0x9'));var fs=require('fs');var fs_extra=require(_0xacf6('0xa'));var _=require(_0xacf6('0xb'));var squel=require(_0xacf6('0xc'));var crypto=require('crypto');var jsforce=require(_0xacf6('0xd'));var deskjs=require(_0xacf6('0xe'));var toCsv=require(_0xacf6('0x8'));var querystring=require(_0xacf6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacf6('0x10'));var as=require(_0xacf6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacf6('0x12'))(_0xacf6('0x13'));var utils=require(_0xacf6('0x14'));var config=require(_0xacf6('0x15'));var licenseUtil=require(_0xacf6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb086,_0x488bc5){_0x488bc5=_0x488bc5||0xcc;return function(_0x134ef6){if(_0x134ef6){return _0x1fb086[_0xacf6('0x17')](_0x488bc5);}return _0x1fb086['status'](_0x488bc5)[_0xacf6('0x18')]();};}function respondWithResult(_0xc07764,_0x543d29){_0x543d29=_0x543d29||0xc8;return function(_0x1658c2){if(_0x1658c2){return _0xc07764['status'](_0x543d29)['json'](_0x1658c2);}};}function respondWithFilteredResult(_0x591687,_0xcd9514){return function(_0x3ab6f1){if(_0x3ab6f1){var _0xfb0fb5=typeof _0xcd9514[_0xacf6('0x19')]===_0xacf6('0x1a')&&typeof _0xcd9514[_0xacf6('0x1b')]===_0xacf6('0x1a');var _0x2354e5=_0x3ab6f1['count'];var _0x45a875=_0xfb0fb5?0x0:_0xcd9514[_0xacf6('0x19')];var _0x2191ab=_0xfb0fb5?_0x3ab6f1[_0xacf6('0x1c')]:_0xcd9514[_0xacf6('0x19')]+_0xcd9514['limit'];var _0x2180ef;if(_0x2191ab>=_0x2354e5){_0x2191ab=_0x2354e5;_0x2180ef=0xc8;}else{_0x2180ef=0xce;}_0x591687[_0xacf6('0x1d')](_0x2180ef);return _0x591687[_0xacf6('0x1e')](_0xacf6('0x1f'),_0x45a875+'-'+_0x2191ab+'/'+_0x2354e5)['json'](_0x3ab6f1);}return null;};}function patchUpdates(_0x5ebf1e){return function(_0x4e00eb){try{jsonpatch['apply'](_0x4e00eb,_0x5ebf1e,!![]);}catch(_0x2ae333){return BPromise[_0xacf6('0x20')](_0x2ae333);}return _0x4e00eb[_0xacf6('0x21')]();};}function saveUpdates(_0x51ac6d,_0x26a795){return function(_0x50fc67){if(_0x50fc67){return _0x50fc67[_0xacf6('0x22')](_0x51ac6d)[_0xacf6('0x23')](function(_0x2056e9){return _0x2056e9;});}return null;};}function removeEntity(_0x366a8b,_0x3d27a0){return function(_0x446018){if(_0x446018){return _0x446018[_0xacf6('0x24')]()['then'](function(){var _0x1976b3=_0x446018[_0xacf6('0x25')]({'plain':!![]});var _0xdd2c3c=_0xacf6('0x26');return db[_0xacf6('0x27')]['destroy']({'where':{'type':_0xdd2c3c,'resourceId':_0x1976b3['id']}})['then'](function(){return _0x446018;});})[_0xacf6('0x23')](function(){_0x366a8b[_0xacf6('0x1d')](0xcc)[_0xacf6('0x18')]();});}};}function handleEntityNotFound(_0x4b3c9b,_0x2b262a){return function(_0x1e7130){if(!_0x1e7130){_0x4b3c9b[_0xacf6('0x17')](0x194);}return _0x1e7130;};}function handleError(_0xcacd7a,_0x19bc65){_0x19bc65=_0x19bc65||0x1f4;return function(_0x442f46){logger[_0xacf6('0x28')](_0x442f46[_0xacf6('0x29')]);if(_0x442f46[_0xacf6('0x2a')]){delete _0x442f46[_0xacf6('0x2a')];}_0xcacd7a['status'](_0x19bc65)[_0xacf6('0x2b')](_0x442f46);};}exports[_0xacf6('0x2c')]=function(_0xf97fdd,_0x3d05c8){var _0x1af2af={},_0x2e77f1={},_0x3d857a={'count':0x0,'rows':[]};var _0xfed42e=_['map'](db[_0xacf6('0x2d')][_0xacf6('0x2e')],function(_0x484d6a){return{'name':_0x484d6a[_0xacf6('0x2f')],'type':_0x484d6a[_0xacf6('0x30')][_0xacf6('0x31')]};});_0x2e77f1[_0xacf6('0x32')]=_[_0xacf6('0x33')](_0xfed42e,_0xacf6('0x2a'));_0x2e77f1[_0xacf6('0x34')]=_[_0xacf6('0x35')](_0xf97fdd[_0xacf6('0x34')]);_0x2e77f1['filters']=_[_0xacf6('0x36')](_0x2e77f1['model'],_0x2e77f1[_0xacf6('0x34')]);_0x1af2af[_0xacf6('0x37')]=_[_0xacf6('0x36')](_0x2e77f1[_0xacf6('0x32')],qs[_0xacf6('0x38')](_0xf97fdd['query'][_0xacf6('0x38')]));_0x1af2af[_0xacf6('0x37')]=_0x1af2af[_0xacf6('0x37')][_0xacf6('0x39')]?_0x1af2af[_0xacf6('0x37')]:_0x2e77f1['model'];if(!_0xf97fdd['query']['hasOwnProperty'](_0xacf6('0x3a'))){_0x1af2af[_0xacf6('0x1b')]=qs[_0xacf6('0x1b')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x1b')]);_0x1af2af[_0xacf6('0x19')]=qs[_0xacf6('0x19')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x19')]);}_0x1af2af['order']=qs[_0xacf6('0x3b')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3b')]);_0x1af2af[_0xacf6('0x3c')]=qs[_0xacf6('0x3d')](_[_0xacf6('0x3e')](_0xf97fdd['query'],_0x2e77f1['filters']),_0xfed42e);if(_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3f')]){_0x1af2af[_0xacf6('0x3c')]=_[_0xacf6('0x40')](_0x1af2af[_0xacf6('0x3c')],{'$or':_[_0xacf6('0x33')](_0xfed42e,function(_0x4d8e00){if(_0x4d8e00[_0xacf6('0x30')]!==_0xacf6('0x41')){var _0x1133d0={};_0x1133d0[_0x4d8e00[_0xacf6('0x2a')]]={'$like':'%'+_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3f')]+'%'};return _0x1133d0;}})});}_0x1af2af=_[_0xacf6('0x40')]({},_0x1af2af,_0xf97fdd[_0xacf6('0x42')]);var _0xf2032c={'where':_0x1af2af[_0xacf6('0x3c')]};return db[_0xacf6('0x2d')][_0xacf6('0x1c')](_0xf2032c)[_0xacf6('0x23')](function(_0x276f86){_0x3d857a['count']=_0x276f86;if(_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x43')]){_0x1af2af[_0xacf6('0x44')]=[{'all':!![]}];}return db[_0xacf6('0x2d')][_0xacf6('0x45')](_0x1af2af);})[_0xacf6('0x23')](function(_0xf46453){_0x3d857a[_0xacf6('0x46')]=_0xf46453;return _0x3d857a;})[_0xacf6('0x23')](respondWithFilteredResult(_0x3d05c8,_0x1af2af))[_0xacf6('0x47')](handleError(_0x3d05c8,null));};exports[_0xacf6('0x48')]=function(_0x2c41a7,_0x5e72e5){var _0x5d7391={'raw':!![],'where':{'id':_0x2c41a7[_0xacf6('0x49')]['id']}},_0x312a64={};_0x312a64[_0xacf6('0x32')]=_[_0xacf6('0x35')](db[_0xacf6('0x2d')]['rawAttributes']);_0x312a64['query']=_[_0xacf6('0x35')](_0x2c41a7[_0xacf6('0x34')]);_0x312a64[_0xacf6('0x3d')]=_[_0xacf6('0x36')](_0x312a64['model'],_0x312a64[_0xacf6('0x34')]);_0x5d7391[_0xacf6('0x37')]=_[_0xacf6('0x36')](_0x312a64['model'],qs[_0xacf6('0x38')](_0x2c41a7['query']['fields']));_0x5d7391[_0xacf6('0x37')]=_0x5d7391[_0xacf6('0x37')][_0xacf6('0x39')]?_0x5d7391['attributes']:_0x312a64[_0xacf6('0x32')];if(_0x2c41a7[_0xacf6('0x34')][_0xacf6('0x43')]){_0x5d7391['include']=[{'all':!![]}];}_0x5d7391=_['merge']({},_0x5d7391,_0x2c41a7[_0xacf6('0x42')]);return db[_0xacf6('0x2d')]['find'](_0x5d7391)[_0xacf6('0x23')](handleEntityNotFound(_0x5e72e5,null))['then'](respondWithResult(_0x5e72e5,null))[_0xacf6('0x47')](handleError(_0x5e72e5,null));};exports[_0xacf6('0x4a')]=function(_0x1e00ea,_0x20ebac){return db[_0xacf6('0x2d')]['create'](_0x1e00ea[_0xacf6('0x4b')],{})[_0xacf6('0x23')](function(_0x4edb35){var _0x1abb5a=_0x1e00ea[_0xacf6('0x4c')][_0xacf6('0x25')]({'plain':!![]});if(!_0x1abb5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1abb5a[_0xacf6('0x4d')]===_0xacf6('0x4c')){var _0x326288=_0x4edb35[_0xacf6('0x25')]({'plain':!![]});var _0x348003=_0xacf6('0x26');return db['UserProfileSection'][_0xacf6('0x4e')]({'where':{'name':_0x348003,'userProfileId':_0x1abb5a['userProfileId']},'raw':!![]})[_0xacf6('0x23')](function(_0x4b8115){if(_0x4b8115&&_0x4b8115['autoAssociation']===0x0){return db[_0xacf6('0x27')][_0xacf6('0x4a')]({'name':_0x326288[_0xacf6('0x2a')],'resourceId':_0x326288['id'],'type':_0x4b8115[_0xacf6('0x2a')],'sectionId':_0x4b8115['id']},{})[_0xacf6('0x23')](function(){return _0x4edb35;});}else{return _0x4edb35;}})[_0xacf6('0x47')](function(_0xd9726){logger[_0xacf6('0x28')](_0xacf6('0x4f'),_0xd9726);throw _0xd9726;});}return _0x4edb35;})[_0xacf6('0x23')](respondWithResult(_0x20ebac,0xc9))[_0xacf6('0x47')](handleError(_0x20ebac,null));};exports['update']=function(_0x315803,_0x2294a0){if(_0x315803[_0xacf6('0x4b')]['id']){delete _0x315803[_0xacf6('0x4b')]['id'];}return db[_0xacf6('0x2d')][_0xacf6('0x4e')]({'where':{'id':_0x315803[_0xacf6('0x49')]['id']}})[_0xacf6('0x23')](handleEntityNotFound(_0x2294a0,null))[_0xacf6('0x23')](saveUpdates(_0x315803['body'],null))[_0xacf6('0x23')](respondWithResult(_0x2294a0,null))['catch'](handleError(_0x2294a0,null));};exports[_0xacf6('0x24')]=function(_0x9a6a16,_0x25b875){return db[_0xacf6('0x2d')][_0xacf6('0x4e')]({'where':{'id':_0x9a6a16[_0xacf6('0x49')]['id']}})[_0xacf6('0x23')](handleEntityNotFound(_0x25b875,null))['then'](removeEntity(_0x25b875,null))[_0xacf6('0x47')](handleError(_0x25b875,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d661ab8..dd4c117 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 _0xd68b=['define','Disposition','name_voice','name','ListId','name_sms','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./disposition.attributes'];(function(_0x283428,_0x5cd704){var _0x58a493=function(_0x3a879f){while(--_0x3a879f){_0x283428['push'](_0x283428['shift']());}};_0x58a493(++_0x5cd704);}(_0xd68b,0x8f));var _0xbd68=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0xd68b[_0x3af6d3];return _0xf0c5a8;};'use strict';var _=require(_0xbd68('0x0'));var util=require(_0xbd68('0x1'));var logger=require(_0xbd68('0x2'))(_0xbd68('0x3'));var moment=require(_0xbd68('0x4'));var BPromise=require(_0xbd68('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd68('0x6'));var rimraf=require(_0xbd68('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd68('0x8'));module['exports']=function(_0x6c3bd0,_0x17e22c){return _0x6c3bd0[_0xbd68('0x9')](_0xbd68('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xbd68('0xb'),'fields':[_0xbd68('0xc'),_0xbd68('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xbd68('0xc'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0xbd68('0xe'),'fields':[_0xbd68('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xbd68('0xf'),'fields':[_0xbd68('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xbd68('0xc'),_0xbd68('0x10')]},{'unique':!![],'name':_0xbd68('0x11'),'fields':['name',_0xbd68('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9630=['SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','name'];(function(_0x44e50b,_0x2a2aa8){var _0x41773c=function(_0x8bb252){while(--_0x8bb252){_0x44e50b['push'](_0x44e50b['shift']());}};_0x41773c(++_0x2a2aa8);}(_0x9630,0x1a3));var _0x0963=function(_0x53a1b1,_0x10a5d4){_0x53a1b1=_0x53a1b1-0x0;var _0x93a5e0=_0x9630[_0x53a1b1];return _0x93a5e0;};'use strict';var _=require(_0x0963('0x0'));var util=require('util');var logger=require(_0x0963('0x1'))(_0x0963('0x2'));var moment=require(_0x0963('0x3'));var BPromise=require(_0x0963('0x4'));var rp=require(_0x0963('0x5'));var fs=require('fs');var path=require(_0x0963('0x6'));var rimraf=require(_0x0963('0x7'));var config=require(_0x0963('0x8'));var attributes=require('./disposition.attributes');module[_0x0963('0x9')]=function(_0x1fabd7,_0x2c47ed){return _0x1fabd7[_0x0963('0xa')]('Disposition',attributes,{'tableName':_0x0963('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x0963('0xc')]},{'unique':!![],'name':_0x0963('0xd'),'fields':['name',_0x0963('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x0963('0xf')]},{'unique':!![],'name':_0x0963('0x10'),'fields':[_0x0963('0x11'),_0x0963('0x12')]},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':_0x0963('0x13'),'fields':[_0x0963('0x11'),_0x0963('0x14')]},{'unique':!![],'name':_0x0963('0x15'),'fields':['name',_0x0963('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4d807d9..7ae9178 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(_0x214603,_0x5b1286){var _0x43e175=function(_0x44daa4){while(--_0x44daa4){_0x214603['push'](_0x214603['shift']());}};_0x43e175(++_0x5b1286);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x2bf640,_0x4af6ec){var _0x365e05=function(_0x5c10a7){while(--_0x5c10a7){_0x2bf640['push'](_0x2bf640['shift']());}};_0x365e05(++_0x4af6ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 f737966..59d3dfa 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 _0xd24e=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd24e,0x1a2));var _0xed24=function(_0xd2ea80,_0x518b7a){_0xd2ea80=_0xd2ea80-0x0;var _0x1ef457=_0xd24e[_0xd2ea80];return _0x1ef457;};'use strict';var multer=require(_0xed24('0x0'));var util=require(_0xed24('0x1'));var path=require(_0xed24('0x2'));var timeout=require(_0xed24('0x3'));var express=require('express');var router=express[_0xed24('0x4')]();var fs_extra=require(_0xed24('0x5'));var auth=require(_0xed24('0x6'));var interaction=require(_0xed24('0x7'));var config=require(_0xed24('0x8'));var controller=require(_0xed24('0x9'));router[_0xed24('0xa')]('/',auth['isAuthenticated'](),controller[_0xed24('0xb')]);router[_0xed24('0xa')](_0xed24('0xc'),auth[_0xed24('0xd')](),controller[_0xed24('0xe')]);router[_0xed24('0xf')]('/',auth[_0xed24('0xd')](),controller['create']);router['put'](_0xed24('0xc'),auth[_0xed24('0xd')](),controller[_0xed24('0x10')]);router[_0xed24('0x11')](_0xed24('0xc'),auth[_0xed24('0xd')](),controller[_0xed24('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf1eb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x221b6d,_0x113ac9){var _0xad678f=function(_0x1ad180){while(--_0x1ad180){_0x221b6d['push'](_0x221b6d['shift']());}};_0xad678f(++_0x113ac9);}(_0xf1eb,0x1ac));var _0xbf1e=function(_0x4cd32a,_0x3936fb){_0x4cd32a=_0x4cd32a-0x0;var _0x7cd962=_0xf1eb[_0x4cd32a];return _0x7cd962;};'use strict';var multer=require(_0xbf1e('0x0'));var util=require(_0xbf1e('0x1'));var path=require(_0xbf1e('0x2'));var timeout=require(_0xbf1e('0x3'));var express=require('express');var router=express[_0xbf1e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf1e('0x5'));var interaction=require(_0xbf1e('0x6'));var config=require(_0xbf1e('0x7'));var controller=require(_0xbf1e('0x8'));router[_0xbf1e('0x9')]('/',auth[_0xbf1e('0xa')](),controller['index']);router['get'](_0xbf1e('0xb'),auth[_0xbf1e('0xa')](),controller[_0xbf1e('0xc')]);router['post']('/',auth[_0xbf1e('0xa')](),controller[_0xbf1e('0xd')]);router[_0xbf1e('0xe')](_0xbf1e('0xb'),auth['isAuthenticated'](),controller[_0xbf1e('0xf')]);router[_0xbf1e('0x10')](_0xbf1e('0xb'),auth[_0xbf1e('0xa')](),controller[_0xbf1e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 27c45c6..a082b81 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 _0x6b8f=['KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','yes','localstationid','ENUM','4800','7200','9600','12000','14400','INTEGER','SIP'];(function(_0x4f2c69,_0x528c29){var _0x29db31=function(_0x5f3081){while(--_0x5f3081){_0x4f2c69['push'](_0x4f2c69['shift']());}};_0x29db31(++_0x528c29);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x457a02,_0x198a1b){_0x457a02=_0x457a02-0x0;var _0x432698=_0x6b8f[_0x457a02];return _0x432698;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf6b8('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf6b8('0x2')},'headerinfo':{'type':Sequelize[_0xf6b8('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xf6b8('0x1')],'unique':_0xf6b8('0x3')},'minrate':{'type':Sequelize[_0xf6b8('0x4')]('2400',_0xf6b8('0x5'),_0xf6b8('0x6'),_0xf6b8('0x7'),_0xf6b8('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xf6b8('0x4')]('2400',_0xf6b8('0x5'),_0xf6b8('0x6'),_0xf6b8('0x7'),_0xf6b8('0x8'),_0xf6b8('0x9')),'defaultValue':_0xf6b8('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf6b8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf6b8('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf6b8('0x4')](_0xf6b8('0xb'),'IAX','DADHI',_0xf6b8('0xc')),'defaultValue':_0xf6b8('0xb')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf6b8('0xd')],'defaultValue':function(){return _0xf6b8('0xe');}},'notificationSound':{'type':Sequelize[_0xf6b8('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf6b8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf6b8('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf6b8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf6b8('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf6b8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf6b8('0xa')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf6b8('0x10'),'set':function(_0x56508b){if(!_0x56508b)this[_0xf6b8('0x11')](_0xf6b8('0x12'),null);this['setDataValue']('mandatoryDisposition',_0x56508b);}}}; \ No newline at end of file +var _0xbeea=['mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','4800','7200','14400','v17,v27,v29','INTEGER','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xbeea,0xb1));var _0xabee=function(_0x1a9cdb,_0x5ac842){_0x1a9cdb=_0x1a9cdb-0x0;var _0x42d97f=_0xbeea[_0x1a9cdb];return _0x42d97f;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]},'ecm':{'type':Sequelize[_0xabee('0x2')]('yes','no'),'defaultValue':_0xabee('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xabee('0x4')},'localstationid':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x5')},'minrate':{'type':Sequelize[_0xabee('0x2')](_0xabee('0x6'),'4800','7200',_0xabee('0x7'),_0xabee('0x8'),'14400'),'defaultValue':_0xabee('0x9')},'maxrate':{'type':Sequelize['ENUM'](_0xabee('0x6'),_0xabee('0x9'),_0xabee('0xa'),_0xabee('0x7'),_0xabee('0x8'),_0xabee('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xabee('0x1')],'defaultValue':_0xabee('0xc')},'gateway':{'type':Sequelize[_0xabee('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xabee('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xabee('0x2')](_0xabee('0xe'),'IAX','DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xabee('0xf')],'defaultValue':function(){return _0xabee('0x10');}},'notificationSound':{'type':Sequelize[_0xabee('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xabee('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabee('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabee('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabee('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabee('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabee('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabee('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xabee('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xabee('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33e3c0){if(!_0x33e3c0)this[_0xabee('0x13')](_0xabee('0x14'),null);this[_0xabee('0x13')](_0xabee('0x15'),_0x33e3c0);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5822da1..1ff3fbc 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 _0xa85f=['omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','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','addAccountApplications','transaction','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','split','FaxMessage','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','user','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','sort','removeAnswers','addInteraction','FaxInteraction'];(function(_0x1d4d67,_0x5c92b6){var _0x9fd1fb=function(_0x44d9e9){while(--_0x44d9e9){_0x1d4d67['push'](_0x1d4d67['shift']());}};_0x9fd1fb(++_0x5c92b6);}(_0xa85f,0x1e1));var _0xfa85=function(_0x4d2219,_0x5b7f96){_0x4d2219=_0x4d2219-0x0;var _0x10edcf=_0xa85f[_0x4d2219];return _0x10edcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa85('0x0'));var zipdir=require(_0xfa85('0x1'));var jsonpatch=require(_0xfa85('0x2'));var rp=require(_0xfa85('0x3'));var moment=require(_0xfa85('0x4'));var BPromise=require(_0xfa85('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfa85('0x6'));var sox=require(_0xfa85('0x7'));var csv=require(_0xfa85('0x8'));var ejs=require(_0xfa85('0x9'));var fs=require('fs');var fs_extra=require(_0xfa85('0xa'));var _=require(_0xfa85('0xb'));var squel=require(_0xfa85('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa85('0xd'));var deskjs=require(_0xfa85('0xe'));var toCsv=require(_0xfa85('0x8'));var querystring=require(_0xfa85('0xf'));var Papa=require(_0xfa85('0x10'));var Redis=require(_0xfa85('0x11'));var authService=require(_0xfa85('0x12'));var qs=require(_0xfa85('0x13'));var as=require(_0xfa85('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa85('0x15'))(_0xfa85('0x16'));var utils=require(_0xfa85('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfa85('0x18'));var db=require(_0xfa85('0x19'))['db'];config['redis']=_[_0xfa85('0x1a')](config[_0xfa85('0x1b')],{'host':_0xfa85('0x1c'),'port':0x18eb});var socket=require(_0xfa85('0x1d'))(new Redis(config[_0xfa85('0x1b')]));require(_0xfa85('0x1e'))[_0xfa85('0x1f')](socket);var jayson=require(_0xfa85('0x20'));var client=jayson[_0xfa85('0x21')][_0xfa85('0x22')]({'port':0x232c});var client9002=jayson[_0xfa85('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31226a,_0x5a31c0,_0x55d035,_0x353721){return new BPromise(function(_0x53f614,_0x46c550){var _0x198107=_0x353721||client;return _0x198107[_0xfa85('0x23')](_0x31226a,_0x55d035)[_0xfa85('0x24')](function(_0x26d678){logger['info'](_0xfa85('0x25'),_0x5a31c0,_0xfa85('0x26'));logger[_0xfa85('0x27')](_0xfa85('0x28'),_0x5a31c0,_0xfa85('0x26'),JSON[_0xfa85('0x29')](_0x26d678));if(_0x26d678[_0xfa85('0x2a')]){if(_0x26d678[_0xfa85('0x2a')][_0xfa85('0x2b')]===0x1f4){logger[_0xfa85('0x2a')](_0xfa85('0x25'),_0x5a31c0,_0x26d678[_0xfa85('0x2a')]['message']);return _0x46c550(_0x26d678[_0xfa85('0x2a')]['message']);}logger[_0xfa85('0x2a')](_0xfa85('0x25'),_0x5a31c0,_0x26d678['error'][_0xfa85('0x2c')]);return _0x53f614(_0x26d678[_0xfa85('0x2a')]['message']);}else{logger[_0xfa85('0x2d')](_0xfa85('0x25'),_0x5a31c0,'request\x20sent');_0x53f614(_0x26d678[_0xfa85('0x2e')][_0xfa85('0x2c')]);}})[_0xfa85('0x2f')](function(_0x5632f0){logger[_0xfa85('0x2a')](_0xfa85('0x25'),_0x5a31c0,_0x5632f0);_0x46c550(_0x5632f0);});});}function respondWithStatusCode(_0x1c9b6b,_0x1f2c0c){_0x1f2c0c=_0x1f2c0c||0xcc;return function(_0x5517b9){if(_0x5517b9){return _0x1c9b6b[_0xfa85('0x30')](_0x1f2c0c);}return _0x1c9b6b[_0xfa85('0x31')](_0x1f2c0c)[_0xfa85('0x32')]();};}function respondWithResult(_0x27fbcb,_0x3c4a58){_0x3c4a58=_0x3c4a58||0xc8;return function(_0x1afd42){if(_0x1afd42){return _0x27fbcb[_0xfa85('0x31')](_0x3c4a58)['json'](_0x1afd42);}};}function respondWithFilteredResult(_0x3dda49,_0x1f407f){return function(_0x40baf7){if(_0x40baf7){var _0x29632f=typeof _0x1f407f[_0xfa85('0x33')]===_0xfa85('0x34')&&typeof _0x1f407f[_0xfa85('0x35')]===_0xfa85('0x34');var _0x28fd9a=_0x40baf7[_0xfa85('0x36')];var _0x559c62=_0x29632f?0x0:_0x1f407f[_0xfa85('0x33')];var _0xd88a4d=_0x29632f?_0x40baf7[_0xfa85('0x36')]:_0x1f407f[_0xfa85('0x33')]+_0x1f407f[_0xfa85('0x35')];var _0x455ecd;if(_0xd88a4d>=_0x28fd9a){_0xd88a4d=_0x28fd9a;_0x455ecd=0xc8;}else{_0x455ecd=0xce;}_0x3dda49['status'](_0x455ecd);return _0x3dda49[_0xfa85('0x37')](_0xfa85('0x38'),_0x559c62+'-'+_0xd88a4d+'/'+_0x28fd9a)['json'](_0x40baf7);}return null;};}function patchUpdates(_0x65f686){return function(_0x37cd95){try{jsonpatch['apply'](_0x37cd95,_0x65f686,!![]);}catch(_0x6812c0){return BPromise[_0xfa85('0x39')](_0x6812c0);}return _0x37cd95[_0xfa85('0x3a')]();};}function saveUpdates(_0x377aa,_0x31cfdb){return function(_0x23d999){if(_0x23d999){return _0x23d999[_0xfa85('0x3b')](_0x377aa)[_0xfa85('0x24')](function(_0x1ca1f2){return _0x1ca1f2;});}return null;};}function removeEntity(_0x5aaf13,_0x301c00){return function(_0xa8c402){if(_0xa8c402){return _0xa8c402[_0xfa85('0x3c')]()['then'](function(){var _0x451843=_0xa8c402[_0xfa85('0x3d')]({'plain':!![]});var _0x5039db=_0xfa85('0x3e');return db[_0xfa85('0x3f')][_0xfa85('0x3c')]({'where':{'type':_0x5039db,'resourceId':_0x451843['id']}})[_0xfa85('0x24')](function(){return _0xa8c402;});})[_0xfa85('0x24')](function(){_0x5aaf13[_0xfa85('0x31')](0xcc)[_0xfa85('0x32')]();});}};}function handleEntityNotFound(_0x19f35b,_0x43b888){return function(_0x5c482b){if(!_0x5c482b){_0x19f35b['sendStatus'](0x194);}return _0x5c482b;};}function handleError(_0x2cda6e,_0x5a7b73){_0x5a7b73=_0x5a7b73||0x1f4;return function(_0x53c52e){logger[_0xfa85('0x2a')](_0x53c52e[_0xfa85('0x40')]);if(_0x53c52e['name']){delete _0x53c52e[_0xfa85('0x41')];}_0x2cda6e[_0xfa85('0x31')](_0x5a7b73)[_0xfa85('0x42')](_0x53c52e);};}exports['index']=function(_0x440796,_0x15a162){var _0x371fef={'include':[{'model':db[_0xfa85('0x43')],'as':'mandatoryDispositionPause'}]},_0x3d5f97={},_0x508922={'count':0x0,'rows':[]};var _0x4ff72f=_[_0xfa85('0x44')](db[_0xfa85('0x45')][_0xfa85('0x46')],function(_0x3f8198){return{'name':_0x3f8198['fieldName'],'type':_0x3f8198[_0xfa85('0x47')][_0xfa85('0x48')]};});_0x3d5f97[_0xfa85('0x49')]=_[_0xfa85('0x44')](_0x4ff72f,'name');_0x3d5f97[_0xfa85('0x4a')]=_[_0xfa85('0x4b')](_0x440796[_0xfa85('0x4a')]);_0x3d5f97[_0xfa85('0x4c')]=_[_0xfa85('0x4d')](_0x3d5f97[_0xfa85('0x49')],_0x3d5f97[_0xfa85('0x4a')]);_0x371fef[_0xfa85('0x4e')]=_[_0xfa85('0x4d')](_0x3d5f97[_0xfa85('0x49')],qs['fields'](_0x440796[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x371fef['attributes']=_0x371fef[_0xfa85('0x4e')][_0xfa85('0x50')]?_0x371fef[_0xfa85('0x4e')]:_0x3d5f97['model'];if(!_0x440796['query'][_0xfa85('0x51')]('nolimit')){_0x371fef[_0xfa85('0x35')]=qs['limit'](_0x440796[_0xfa85('0x4a')][_0xfa85('0x35')]);_0x371fef['offset']=qs[_0xfa85('0x33')](_0x440796[_0xfa85('0x4a')][_0xfa85('0x33')]);}_0x371fef[_0xfa85('0x52')]=qs['sort'](_0x440796[_0xfa85('0x4a')]['sort']);_0x371fef[_0xfa85('0x53')]=qs[_0xfa85('0x4c')](_[_0xfa85('0x54')](_0x440796[_0xfa85('0x4a')],_0x3d5f97['filters']),_0x4ff72f);if(_0x440796['query']['filter']){_0x371fef['where']=_[_0xfa85('0x55')](_0x371fef[_0xfa85('0x53')],{'$or':_['map'](_0x4ff72f,function(_0xe5bad8){if(_0xe5bad8[_0xfa85('0x47')]!==_0xfa85('0x56')){var _0x421afb={};_0x421afb[_0xe5bad8[_0xfa85('0x41')]]={'$like':'%'+_0x440796[_0xfa85('0x4a')][_0xfa85('0x57')]+'%'};return _0x421afb;}})});}_0x371fef=_[_0xfa85('0x55')]({},_0x371fef,_0x440796[_0xfa85('0x58')]);var _0x1ccd84={'where':_0x371fef[_0xfa85('0x53')]};return db['FaxAccount'][_0xfa85('0x36')](_0x1ccd84)['then'](function(_0x3d1e45){_0x508922['count']=_0x3d1e45;if(_0x440796[_0xfa85('0x4a')][_0xfa85('0x59')]){_0x371fef[_0xfa85('0x5a')]=[{'all':!![]}];}return db[_0xfa85('0x45')]['findAll'](_0x371fef);})[_0xfa85('0x24')](function(_0x3d1ddb){_0x508922[_0xfa85('0x5b')]=_0x3d1ddb;return _0x508922;})[_0xfa85('0x24')](respondWithFilteredResult(_0x15a162,_0x371fef))['catch'](handleError(_0x15a162,null));};exports[_0xfa85('0x5c')]=function(_0xe0801a,_0x347738){var _0x193075={'raw':![],'where':{'id':_0xe0801a[_0xfa85('0x5d')]['id']},'include':[{'model':db[_0xfa85('0x43')],'as':_0xfa85('0x5e')}]},_0x2cd48c={};_0x2cd48c[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x45')][_0xfa85('0x46')]);_0x2cd48c['query']=_[_0xfa85('0x4b')](_0xe0801a[_0xfa85('0x4a')]);_0x2cd48c[_0xfa85('0x4c')]=_[_0xfa85('0x4d')](_0x2cd48c[_0xfa85('0x49')],_0x2cd48c[_0xfa85('0x4a')]);_0x193075[_0xfa85('0x4e')]=_['intersection'](_0x2cd48c['model'],qs[_0xfa85('0x4f')](_0xe0801a[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x193075[_0xfa85('0x4e')]=_0x193075['attributes'][_0xfa85('0x50')]?_0x193075[_0xfa85('0x4e')]:_0x2cd48c[_0xfa85('0x49')];if(_0xe0801a['query']['includeAll']){_0x193075['include']=[{'all':!![]}];}_0x193075=_['merge']({},_0x193075,_0xe0801a[_0xfa85('0x58')]);return db['FaxAccount'][_0xfa85('0x5f')](_0x193075)[_0xfa85('0x24')](handleEntityNotFound(_0x347738,null))['then'](respondWithResult(_0x347738,null))[_0xfa85('0x2f')](handleError(_0x347738,null));};exports[_0xfa85('0x60')]=function(_0x3fa08b,_0x1652cc){return db[_0xfa85('0x45')][_0xfa85('0x60')](_0x3fa08b[_0xfa85('0x61')],{})[_0xfa85('0x24')](function(_0x1e95eb){var _0x115713=_0x3fa08b['user'][_0xfa85('0x3d')]({'plain':!![]});if(!_0x115713)throw new Error(_0xfa85('0x62'));if(_0x115713[_0xfa85('0x63')]==='user'){var _0x569d28=_0x1e95eb['get']({'plain':!![]});var _0x22d2b8=_0xfa85('0x3e');return db['UserProfileSection'][_0xfa85('0x5f')]({'where':{'name':_0x22d2b8,'userProfileId':_0x115713[_0xfa85('0x64')]},'raw':!![]})[_0xfa85('0x24')](function(_0x4f21a5){if(_0x4f21a5&&_0x4f21a5[_0xfa85('0x65')]===0x0){return db[_0xfa85('0x3f')]['create']({'name':_0x569d28[_0xfa85('0x41')],'resourceId':_0x569d28['id'],'type':_0x4f21a5[_0xfa85('0x41')],'sectionId':_0x4f21a5['id']},{})['then'](function(){return _0x1e95eb;});}else{return _0x1e95eb;}})[_0xfa85('0x2f')](function(_0x18101b){logger[_0xfa85('0x2a')](_0xfa85('0x66'),_0x18101b);throw _0x18101b;});}return _0x1e95eb;})['then'](respondWithResult(_0x1652cc,0xc9))[_0xfa85('0x2f')](handleError(_0x1652cc,null));};exports[_0xfa85('0x3b')]=function(_0x56ba9c,_0x551468){if(_0x56ba9c[_0xfa85('0x61')]['id']){delete _0x56ba9c[_0xfa85('0x61')]['id'];}return db[_0xfa85('0x45')][_0xfa85('0x5f')]({'where':{'id':_0x56ba9c['params']['id']},'include':[{'model':db['Pause'],'as':_0xfa85('0x5e')}]})['then'](handleEntityNotFound(_0x551468,null))[_0xfa85('0x24')](saveUpdates(_0x56ba9c[_0xfa85('0x61')],null))['then'](respondWithResult(_0x551468,null))[_0xfa85('0x2f')](handleError(_0x551468,null));};exports[_0xfa85('0x3c')]=function(_0x3bae9b,_0x333781){return db['FaxAccount'][_0xfa85('0x5f')]({'where':{'id':_0x3bae9b[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x333781,null))[_0xfa85('0x24')](removeEntity(_0x333781,null))['catch'](handleError(_0x333781,null));};exports[_0xfa85('0x67')]=function(_0x5d310a,_0x346f4b){return db[_0xfa85('0x45')][_0xfa85('0x67')]()[_0xfa85('0x24')](respondWithResult(_0x346f4b,null))[_0xfa85('0x2f')](handleError(_0x346f4b,null));};exports['addDisposition']=function(_0xcf52b1,_0x277796,_0x456851){if(_0xcf52b1[_0xfa85('0x61')]['id']){delete _0xcf52b1[_0xfa85('0x61')]['id'];}return db[_0xfa85('0x45')][_0xfa85('0x5f')]({'where':{'id':_0xcf52b1[_0xfa85('0x5d')]['id']}})['then'](handleEntityNotFound(_0x277796,null))['then'](function(_0x277934){if(_0x277934){_0xcf52b1[_0xfa85('0x61')][_0xfa85('0x68')]=_0x277934['id'];return db[_0xfa85('0x69')][_0xfa85('0x60')](_0xcf52b1[_0xfa85('0x61')]);}})[_0xfa85('0x24')](respondWithResult(_0x277796,null))[_0xfa85('0x2f')](handleError(_0x277796,null));};exports[_0xfa85('0x6a')]=function(_0x30ab55,_0x1f0bef,_0x972799){var _0x51cfd2={'raw':![],'where':{}};var _0x51d30c={};var _0x46ddd6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfa85('0x6b')]({'where':{'id':_0x30ab55[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x1f0bef,null))[_0xfa85('0x24')](function(_0x17e7a9){if(_0x17e7a9){_0x51d30c[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x69')][_0xfa85('0x46')]);_0x51d30c[_0xfa85('0x4a')]=_[_0xfa85('0x4b')](_0x30ab55[_0xfa85('0x4a')]);_0x51d30c['filters']=_[_0xfa85('0x4d')](_0x51d30c[_0xfa85('0x49')],_0x51d30c[_0xfa85('0x4a')]);_0x51cfd2['attributes']=_[_0xfa85('0x4d')](_0x51d30c[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x30ab55[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x51cfd2[_0xfa85('0x4e')]=_0x51cfd2[_0xfa85('0x4e')][_0xfa85('0x50')]?_0x51cfd2[_0xfa85('0x4e')]:_0x51d30c['model'];if(!_0x30ab55[_0xfa85('0x4a')]['hasOwnProperty'](_0xfa85('0x6c'))){_0x51cfd2['limit']=qs['limit'](_0x30ab55[_0xfa85('0x4a')][_0xfa85('0x35')]);_0x51cfd2[_0xfa85('0x33')]=qs[_0xfa85('0x33')](_0x30ab55[_0xfa85('0x4a')]['offset']);}_0x51cfd2[_0xfa85('0x52')]=qs['sort'](_0x30ab55['query']['sort']);_0x51cfd2[_0xfa85('0x53')]=qs[_0xfa85('0x4c')](_['pick'](_0x30ab55['query'],_0x51d30c['filters']));_0x51cfd2['where'][_0xfa85('0x68')]=_0x17e7a9['id'];if(_0x30ab55[_0xfa85('0x4a')][_0xfa85('0x57')]){_0x51cfd2[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x51cfd2[_0xfa85('0x53')],{'$or':_[_0xfa85('0x44')](_0x51cfd2[_0xfa85('0x4e')],function(_0x50b410){var _0x3e808c={};_0x3e808c[_0x50b410]={'$like':'%'+_0x30ab55[_0xfa85('0x4a')][_0xfa85('0x57')]+'%'};return _0x3e808c;})});}_0x51cfd2=_[_0xfa85('0x55')]({},_0x51cfd2,_0x30ab55['options']);return db[_0xfa85('0x69')][_0xfa85('0x36')]({'where':_0x51cfd2[_0xfa85('0x53')]})[_0xfa85('0x24')](function(_0x46dd32){_0x46ddd6[_0xfa85('0x36')]=_0x46dd32;if(_0x30ab55['query'][_0xfa85('0x59')]){_0x51cfd2[_0xfa85('0x5a')]=[{'all':!![]}];}return db[_0xfa85('0x69')][_0xfa85('0x6d')](_0x51cfd2);})[_0xfa85('0x24')](function(_0x1f8b71){_0x46ddd6[_0xfa85('0x5b')]=_0x1f8b71;return _0x46ddd6;});}})[_0xfa85('0x24')](respondWithFilteredResult(_0x1f0bef,_0x51cfd2))[_0xfa85('0x2f')](handleError(_0x1f0bef,null));};exports[_0xfa85('0x6e')]=function(_0x376620,_0x3212ef,_0x2d31c2){return db[_0xfa85('0x45')][_0xfa85('0x5f')]({'where':{'id':_0x376620['params']['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x3212ef,null))['then'](function(_0x37a4c0){if(_0x37a4c0){return _0x37a4c0[_0xfa85('0x6e')](_0x376620[_0xfa85('0x4a')][_0xfa85('0x6f')]);}})['then'](respondWithStatusCode(_0x3212ef,null))[_0xfa85('0x2f')](handleError(_0x3212ef,null));};exports[_0xfa85('0x70')]=function(_0x2d4b62,_0x2219fe,_0x3b4fb4){if(_0x2d4b62[_0xfa85('0x61')]['id']){delete _0x2d4b62['body']['id'];}return db[_0xfa85('0x45')]['find']({'where':{'id':_0x2d4b62[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x2219fe,null))[_0xfa85('0x24')](function(_0x4404f2){if(_0x4404f2){_0x2d4b62['body'][_0xfa85('0x68')]=_0x4404f2['id'];return db[_0xfa85('0x71')][_0xfa85('0x60')](_0x2d4b62[_0xfa85('0x61')]);}})[_0xfa85('0x24')](respondWithResult(_0x2219fe,null))[_0xfa85('0x2f')](handleError(_0x2219fe,null));};exports[_0xfa85('0x72')]=function(_0x63bf65,_0x1e7c44,_0xbd08aa){var _0x34cb62={'raw':![],'where':{}};var _0x534b58={};var _0x5b1d83={'count':0x0,'rows':[]};return db[_0xfa85('0x45')][_0xfa85('0x6b')]({'where':{'id':_0x63bf65[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x1e7c44,null))[_0xfa85('0x24')](function(_0xaceb5){if(_0xaceb5){_0x534b58[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x71')][_0xfa85('0x46')]);_0x534b58[_0xfa85('0x4a')]=_[_0xfa85('0x4b')](_0x63bf65[_0xfa85('0x4a')]);_0x534b58[_0xfa85('0x4c')]=_[_0xfa85('0x4d')](_0x534b58[_0xfa85('0x49')],_0x534b58[_0xfa85('0x4a')]);_0x34cb62[_0xfa85('0x4e')]=_[_0xfa85('0x4d')](_0x534b58[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x63bf65[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x34cb62['attributes']=_0x34cb62[_0xfa85('0x4e')][_0xfa85('0x50')]?_0x34cb62['attributes']:_0x534b58[_0xfa85('0x49')];if(!_0x63bf65[_0xfa85('0x4a')]['hasOwnProperty'](_0xfa85('0x6c'))){_0x34cb62[_0xfa85('0x35')]=qs[_0xfa85('0x35')](_0x63bf65[_0xfa85('0x4a')][_0xfa85('0x35')]);_0x34cb62[_0xfa85('0x33')]=qs[_0xfa85('0x33')](_0x63bf65[_0xfa85('0x4a')][_0xfa85('0x33')]);}_0x34cb62['order']=qs[_0xfa85('0x73')](_0x63bf65[_0xfa85('0x4a')]['sort']);_0x34cb62['where']=qs[_0xfa85('0x4c')](_[_0xfa85('0x54')](_0x63bf65['query'],_0x534b58['filters']));_0x34cb62[_0xfa85('0x53')]['FaxAccountId']=_0xaceb5['id'];if(_0x63bf65[_0xfa85('0x4a')][_0xfa85('0x57')]){_0x34cb62[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x34cb62['where'],{'$or':_[_0xfa85('0x44')](_0x34cb62[_0xfa85('0x4e')],function(_0xeaf08b){var _0x5977dd={};_0x5977dd[_0xeaf08b]={'$like':'%'+_0x63bf65[_0xfa85('0x4a')]['filter']+'%'};return _0x5977dd;})});}_0x34cb62=_[_0xfa85('0x55')]({},_0x34cb62,_0x63bf65[_0xfa85('0x58')]);return db[_0xfa85('0x71')][_0xfa85('0x36')]({'where':_0x34cb62[_0xfa85('0x53')]})[_0xfa85('0x24')](function(_0x93e8df){_0x5b1d83[_0xfa85('0x36')]=_0x93e8df;if(_0x63bf65[_0xfa85('0x4a')]['includeAll']){_0x34cb62[_0xfa85('0x5a')]=[{'all':!![]}];}return db[_0xfa85('0x71')][_0xfa85('0x6d')](_0x34cb62);})[_0xfa85('0x24')](function(_0x2b58d5){_0x5b1d83[_0xfa85('0x5b')]=_0x2b58d5;return _0x5b1d83;});}})[_0xfa85('0x24')](respondWithFilteredResult(_0x1e7c44,_0x34cb62))[_0xfa85('0x2f')](handleError(_0x1e7c44,null));};exports['removeAnswers']=function(_0x30ec10,_0x3f554e,_0x3a6a34){return db['FaxAccount'][_0xfa85('0x5f')]({'where':{'id':_0x30ec10[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x3f554e,null))[_0xfa85('0x24')](function(_0x4ad345){if(_0x4ad345){return _0x4ad345[_0xfa85('0x74')](_0x30ec10[_0xfa85('0x4a')][_0xfa85('0x6f')]);}})[_0xfa85('0x24')](respondWithStatusCode(_0x3f554e,null))[_0xfa85('0x2f')](handleError(_0x3f554e,null));};exports[_0xfa85('0x75')]=function(_0x1a60fd,_0x5c0eec,_0x31a1b0){return db[_0xfa85('0x76')][_0xfa85('0x5f')]({'where':{'id':_0x1a60fd['params']['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x5c0eec,null))[_0xfa85('0x24')](function(_0x134814){if(_0x134814){return _0x134814[_0xfa85('0x75')](_0x1a60fd[_0xfa85('0x61')][_0xfa85('0x6f')],_[_0xfa85('0x77')](_0x1a60fd['body'],['ids','id'])||{});}})[_0xfa85('0x24')](respondWithResult(_0x5c0eec,null))['catch'](handleError(_0x5c0eec,null));};exports['getInteractions']=function(_0x3493ab,_0xfb4437,_0x15451d){var _0x37ffb0={'raw':![],'where':{}};var _0x815534={};var _0x21aa46={'count':0x0,'rows':[]};return db[_0xfa85('0x45')][_0xfa85('0x6b')]({'where':{'id':_0x3493ab[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0xfb4437,null))['then'](function(_0x33d9e6){if(_0x33d9e6){_0x815534[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x76')]['rawAttributes']);_0x815534[_0xfa85('0x4a')]=_[_0xfa85('0x4b')](_0x3493ab[_0xfa85('0x4a')]);_0x815534[_0xfa85('0x4c')]=_[_0xfa85('0x4d')](_0x815534[_0xfa85('0x49')],_0x815534['query']);_0x37ffb0[_0xfa85('0x4e')]=_[_0xfa85('0x4d')](_0x815534[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x3493ab[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x37ffb0[_0xfa85('0x4e')]=_0x37ffb0[_0xfa85('0x4e')][_0xfa85('0x50')]?_0x37ffb0['attributes']:_0x815534[_0xfa85('0x49')];if(!_0x3493ab['query']['hasOwnProperty']('nolimit')){_0x37ffb0[_0xfa85('0x35')]=qs[_0xfa85('0x35')](_0x3493ab['query'][_0xfa85('0x35')]);_0x37ffb0[_0xfa85('0x33')]=qs[_0xfa85('0x33')](_0x3493ab['query'][_0xfa85('0x33')]);}_0x37ffb0[_0xfa85('0x52')]=qs[_0xfa85('0x73')](_0x3493ab[_0xfa85('0x4a')][_0xfa85('0x73')]);_0x37ffb0[_0xfa85('0x53')]=qs[_0xfa85('0x4c')](_[_0xfa85('0x54')](_0x3493ab['query'],_0x815534[_0xfa85('0x4c')]));_0x37ffb0['where']['FaxAccountId']=_0x33d9e6['id'];if(_0x3493ab['query'][_0xfa85('0x57')]){_0x37ffb0[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x37ffb0[_0xfa85('0x53')],{'$or':_[_0xfa85('0x44')](_0x37ffb0['attributes'],function(_0x39ad59){var _0x335bb8={};_0x335bb8[_0x39ad59]={'$like':'%'+_0x3493ab['query'][_0xfa85('0x57')]+'%'};return _0x335bb8;})});}_0x37ffb0=_[_0xfa85('0x55')]({},_0x37ffb0,_0x3493ab[_0xfa85('0x58')]);return db[_0xfa85('0x76')][_0xfa85('0x36')]({'where':_0x37ffb0['where']})[_0xfa85('0x24')](function(_0x2a088e){_0x21aa46[_0xfa85('0x36')]=_0x2a088e;if(_0x3493ab['query']['includeAll']){_0x37ffb0[_0xfa85('0x5a')]=[{'model':db[_0xfa85('0x78')],'as':_0xfa85('0x79'),'required':![]},{'model':db[_0xfa85('0x7a')],'as':_0xfa85('0x7b'),'attributes':[_0xfa85('0x41'),_0xfa85('0x7c'),'internal'],'required':![]},{'model':db[_0xfa85('0x7d')],'as':_0xfa85('0x7e'),'attributes':['id',_0xfa85('0x41'),_0xfa85('0x7f')],'where':_0x3493ab[_0xfa85('0x4a')][_0xfa85('0x80')]?{'id':_0x3493ab[_0xfa85('0x4a')]['tag']}:undefined,'required':_0x3493ab[_0xfa85('0x4a')][_0xfa85('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0xfa85('0x6d')](_0x37ffb0);})[_0xfa85('0x24')](function(_0x2e1c3f){_0x21aa46[_0xfa85('0x5b')]=_0x2e1c3f;return _0x21aa46;});}})['then'](respondWithFilteredResult(_0xfb4437,_0x37ffb0))[_0xfa85('0x2f')](handleError(_0xfb4437,null));};exports['addApplications']=function(_0x576b53,_0x1f531a){var _0x145062=_0x576b53[_0xfa85('0x5d')]['id'];var _0xe134d=_0x576b53[_0xfa85('0x61')];var _0x1de496=0xc8;var _0x203006=null;return db[_0xfa85('0x81')]['transaction']({'isolationLevel':db[_0xfa85('0x81')]['Transaction'][_0xfa85('0x82')][_0xfa85('0x83')]},function(_0x585737){return db['FaxAccount'][_0xfa85('0x6b')]({'where':{'id':_0x145062},'transaction':_0x585737})[_0xfa85('0x24')](function(_0x1bdcf5){if(_0x1bdcf5){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x145062},'transaction':_0x585737})['then'](function(){var _0x58e7f0=_[_0xfa85('0x44')](_0xe134d,function(_0x29e60f){_0x29e60f[_0xfa85('0x68')]=_0x145062;return _0x29e60f;});return db[_0xfa85('0x84')][_0xfa85('0x85')](_0x58e7f0,{'transaction':_0x585737});});}else{_0x1de496=0x194;_0x203006=[];}});})[_0xfa85('0x24')](function(){if(_0x1de496!==0x194){return db['FaxApplication'][_0xfa85('0x86')]({'where':{'FaxAccountId':_0x145062},'order':_0xfa85('0x87')})[_0xfa85('0x24')](function(_0xf2e6fc){_0x203006=_0xf2e6fc;});}})[_0xfa85('0x2f')](function(_0x552f74){_0x1de496=0x1f4;logger[_0xfa85('0x2a')](_0x552f74[_0xfa85('0x40')]);if(_0x552f74[_0xfa85('0x41')]){delete _0x552f74[_0xfa85('0x41')];}_0x203006=_0x552f74;})[_0xfa85('0x88')](function(){if(_0x203006===null){_0x1f531a['sendStatus'](_0x1de496);}else{if(_0x1de496===0x1f4){_0x1f531a[_0xfa85('0x31')](_0x1de496)[_0xfa85('0x42')](_0x203006);}else{_0x1f531a[_0xfa85('0x31')](_0x1de496)[_0xfa85('0x89')](_0x203006);}}});};exports['getApplications']=function(_0x555e18,_0x4d8b8e,_0x8e23bd){var _0x4797ef={};var _0x430da7={};var _0x55a57e;var _0x533301;return db[_0xfa85('0x45')][_0xfa85('0x6b')]({'where':{'id':_0x555e18['params']['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x4d8b8e,null))[_0xfa85('0x24')](function(_0x4bb095){if(_0x4bb095){_0x55a57e=_0x4bb095;_0x430da7[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x84')]['rawAttributes']);_0x430da7['query']=_[_0xfa85('0x4b')](_0x555e18[_0xfa85('0x4a')]);_0x430da7['filters']=_[_0xfa85('0x4d')](_0x430da7[_0xfa85('0x49')],_0x430da7[_0xfa85('0x4a')]);_0x4797ef['attributes']=_[_0xfa85('0x4d')](_0x430da7[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x555e18[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x4797ef[_0xfa85('0x4e')]=_0x4797ef[_0xfa85('0x4e')][_0xfa85('0x50')]?_0x4797ef[_0xfa85('0x4e')]:_0x430da7[_0xfa85('0x49')];_0x4797ef[_0xfa85('0x52')]=qs['sort'](_0x555e18['query'][_0xfa85('0x73')]);_0x4797ef[_0xfa85('0x53')]=qs['filters'](_[_0xfa85('0x54')](_0x555e18[_0xfa85('0x4a')],_0x430da7[_0xfa85('0x4c')]));if(_0x555e18['query'][_0xfa85('0x57')]){_0x4797ef[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x4797ef['where'],{'$or':_[_0xfa85('0x44')](_0x4797ef['attributes'],function(_0x4e5085){var _0x2bd6f8={};_0x2bd6f8[_0x4e5085]={'$like':'%'+_0x555e18[_0xfa85('0x4a')]['filter']+'%'};return _0x2bd6f8;})});}_0x4797ef=_['merge']({},_0x4797ef,_0x555e18[_0xfa85('0x58')]);return _0x55a57e[_0xfa85('0x8a')](_0x4797ef);}})[_0xfa85('0x24')](function(_0x44ca99){if(_0x44ca99){_0x533301=_0x44ca99[_0xfa85('0x50')];if(!_0x555e18[_0xfa85('0x4a')]['hasOwnProperty']('nolimit')){_0x4797ef[_0xfa85('0x35')]=qs['limit'](_0x555e18[_0xfa85('0x4a')][_0xfa85('0x35')]);_0x4797ef[_0xfa85('0x33')]=qs[_0xfa85('0x33')](_0x555e18[_0xfa85('0x4a')][_0xfa85('0x33')]);}return _0x55a57e[_0xfa85('0x8a')](_0x4797ef);}})[_0xfa85('0x24')](function(_0x258942){if(_0x258942){return _0x258942?{'count':_0x533301,'rows':_0x258942}:null;}})[_0xfa85('0x24')](respondWithResult(_0x4d8b8e,null))['catch'](handleError(_0x4d8b8e,null));};function Extension(_0x524fb5,_0xdd0352,_0x119c2b,_0x21baa5){this[_0xfa85('0x8b')]=_0xfa85('0x8c');this['exten']=_0x524fb5[_0xfa85('0x8d')];this['app']=_0x21baa5;this[_0xfa85('0x47')]=_0xfa85('0x8e');this[_0xfa85('0x8f')]=_0xfa85('0x90');this['FaxAccountId']=_0x524fb5['id'];this['priority']=_0xdd0352;this[_0xfa85('0x91')]=_0x119c2b;}function createExtensionsReciveFax(_0x1066e3){var _0x1f11cc=0x1;var _0x1effdf=[];_0x1effdf[_0xfa85('0x92')](new Extension(_0x1066e3,_0x1f11cc,'',_0xfa85('0x93')));_0x1f11cc+=0x1;_0x1effdf['push'](new Extension(_0x1066e3,_0x1f11cc,_0xfa85('0x94'),_0xfa85('0x95')));_0x1f11cc+=0x1;for(var _0x4c68c0 in _0x1066e3){if(_0x1066e3[_0xfa85('0x51')](_0x4c68c0)&&(_0x4c68c0==='ecm'||_0x4c68c0===_0xfa85('0x8d')||_0x4c68c0==='gateway'||_0x4c68c0===_0xfa85('0x96')||_0x4c68c0===_0xfa85('0x97')||_0x4c68c0==='maxrate'||_0x4c68c0==='minrate'||_0x4c68c0===_0xfa85('0x98')||_0x4c68c0===_0xfa85('0x99'))){_0x1effdf[_0xfa85('0x92')](new Extension(_0x1066e3,_0x1f11cc,_0xfa85('0x9a')+_0x4c68c0+')='+_0x1066e3[_0x4c68c0],'Set'));_0x1f11cc+=0x1;}}_0x1effdf[_0xfa85('0x92')](new Extension(_0x1066e3,_0x1f11cc,'6',_0xfa85('0x9b')));_0x1f11cc+=0x1;_0x1effdf[_0xfa85('0x92')](new Extension(_0x1066e3,_0x1f11cc,_0xfa85('0x9c'),'ReceiveFax'));_0x1f11cc=0x0;return _0x1effdf;}exports[_0xfa85('0x9d')]=function(_0x57cf11,_0xea465,_0xa475ae){var _0xa3a481;return db[_0xfa85('0x81')][_0xfa85('0x9e')](function(_0x1f9971){return db[_0xfa85('0x45')][_0xfa85('0x60')](_0x57cf11[_0xfa85('0x61')],{'transaction':_0x1f9971})[_0xfa85('0x24')](function(_0x2aad82){_0xa3a481=_0x2aad82[_0xfa85('0x3d')]({'plain':!![]});return db['VoiceExtension'][_0xfa85('0x85')](createExtensionsReciveFax(_0xa3a481),{'transaction':_0x1f9971});});})[_0xfa85('0x24')](function(){return _0xa3a481;})['then'](respondWithResult(_0xea465,null))['catch'](handleError(_0xea465,null));};exports[_0xfa85('0x9f')]=function(_0x1f85cc,_0x2f4fd4,_0x1a5baf){var _0x865193;return db[_0xfa85('0x81')][_0xfa85('0x9e')](function(_0x445e2a){return db[_0xfa85('0x45')]['update'](_0x1f85cc['body'],{'where':{'id':_0x1f85cc[_0xfa85('0x61')]['id']},'transaction':_0x445e2a})[_0xfa85('0x24')](function(_0xa09eaa){return db['VoiceExtension'][_0xfa85('0x3c')]({'where':{'FaxAccountId':_0x1f85cc[_0xfa85('0x61')]['id']},'transaction':_0x445e2a})['then'](function(_0x3e372c){return db[_0xfa85('0xa0')][_0xfa85('0x85')](createExtensionsReciveFax(_[_0xfa85('0x77')](_0x1f85cc['body'],[_0xfa85('0xa1'),_0xfa85('0x48'),_0xfa85('0xa2'),_0xfa85('0xa3'),_0xfa85('0xa4'),_0xfa85('0xa5')])),{'transaction':_0x445e2a});});});})[_0xfa85('0x24')](function(){return db[_0xfa85('0x45')][_0xfa85('0xa6')](_0x1f85cc[_0xfa85('0x61')]['id']);})[_0xfa85('0x24')](respondWithResult(_0x2f4fd4,null))[_0xfa85('0x2f')](handleError(_0x2f4fd4,null));};exports[_0xfa85('0xa7')]=function(_0x453309,_0x1ce53f,_0x1ada1f){var _0x305aa0={'raw':!![],'where':{}};var _0x2610e8={};var _0x89b971={'count':0x0,'rows':[]};return db[_0xfa85('0x45')][_0xfa85('0x6b')]({'where':{'id':_0x453309[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x1ce53f,null))['then'](function(_0x5cc6ff){if(_0x5cc6ff){_0x2610e8[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db['FaxMessage']['rawAttributes']);_0x2610e8['query']=_[_0xfa85('0x4b')](_0x453309[_0xfa85('0x4a')]);_0x2610e8[_0xfa85('0x4c')]=_[_0xfa85('0x4d')](_0x2610e8[_0xfa85('0x49')],_0x2610e8[_0xfa85('0x4a')]);_0x305aa0[_0xfa85('0x4e')]=_[_0xfa85('0x4d')](_0x2610e8[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x453309[_0xfa85('0x4a')][_0xfa85('0x4f')]));_0x305aa0[_0xfa85('0x4e')]=_0x305aa0['attributes'][_0xfa85('0x50')]?_0x305aa0[_0xfa85('0x4e')]:_0x2610e8[_0xfa85('0x49')];if(!_0x453309['query'][_0xfa85('0x51')](_0xfa85('0x6c'))){_0x305aa0[_0xfa85('0x35')]=qs[_0xfa85('0x35')](_0x453309['query'][_0xfa85('0x35')]);_0x305aa0[_0xfa85('0x33')]=qs['offset'](_0x453309[_0xfa85('0x4a')][_0xfa85('0x33')]);}_0x305aa0[_0xfa85('0x52')]=qs[_0xfa85('0x73')](_0x453309['query'][_0xfa85('0x73')]);_0x305aa0[_0xfa85('0x53')]=qs[_0xfa85('0x4c')](_[_0xfa85('0x54')](_0x453309['query'],_0x2610e8[_0xfa85('0x4c')]));_0x305aa0[_0xfa85('0x53')][_0xfa85('0x68')]=_0x5cc6ff['id'];if(_0x453309[_0xfa85('0x4a')]['filter']){_0x305aa0[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x305aa0[_0xfa85('0x53')],{'$or':_['map'](_0x305aa0[_0xfa85('0x4e')],function(_0x237d03){var _0x19e5c6={};_0x19e5c6[_0x237d03]={'$like':'%'+_0x453309[_0xfa85('0x4a')][_0xfa85('0x57')]+'%'};return _0x19e5c6;})});}if(_0x453309[_0xfa85('0x4a')]['$gte']){var _0x4273ca=_0x453309[_0xfa85('0x4a')]['$gte'][_0xfa85('0xa8')](',');var _0x468e2a={};_0x468e2a[_0x4273ca[0x0]]={'$gte':moment(_0x4273ca[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x305aa0[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x305aa0[_0xfa85('0x53')],_0x468e2a);}_0x305aa0=_['merge']({},_0x305aa0,_0x453309[_0xfa85('0x58')]);return db[_0xfa85('0xa9')][_0xfa85('0x36')]({'where':_0x305aa0['where']})[_0xfa85('0x24')](function(_0x2e3041){_0x89b971['count']=_0x2e3041;if(_0x453309[_0xfa85('0x4a')][_0xfa85('0x59')]){_0x305aa0[_0xfa85('0x5a')]=[{'all':!![]}];}return db[_0xfa85('0xa9')][_0xfa85('0x6d')](_0x305aa0);})[_0xfa85('0x24')](function(_0x17cc6a){_0x89b971[_0xfa85('0x5b')]=_0x17cc6a;return _0x89b971;});}})['then'](respondWithFilteredResult(_0x1ce53f,_0x305aa0))[_0xfa85('0x2f')](handleError(_0x1ce53f,null));};exports[_0xfa85('0x42')]=function(_0x256439,_0x487235,_0x1745b0){var _0x32af10,_0x3aa229={},_0x3ccd17;if(_0x256439['body']['to']){_0x3ccd17=_0x256439[_0xfa85('0x61')]['to'][0x0];}return db[_0xfa85('0x45')][_0xfa85('0x5f')]({'where':{'id':_0x256439[_0xfa85('0x5d')]['id']},'include':[{'model':db[_0xfa85('0xaa')],'as':_0xfa85('0xab'),'include':[{'model':db[_0xfa85('0x78')],'as':_0xfa85('0xac'),'where':{'fax':_0x3ccd17},'limit':0x1,'order':[[_0xfa85('0xa3'),_0xfa85('0xad')]]}]}]})[_0xfa85('0x24')](handleEntityNotFound(_0x487235,null))['then'](function(_0x49d4a4){_0x32af10=_0x49d4a4;if(_0x256439[_0xfa85('0x61')][_0xfa85('0xae')]&&_0x256439[_0xfa85('0x61')][_0xfa85('0xae')][_0xfa85('0x50')]){for(var _0x2e32db=0x0;_0x2e32db<_0x256439['body'][_0xfa85('0xae')]['length'];_0x2e32db+=0x1){_0x256439['body'][_0xfa85('0xae')][_0x2e32db]={'filename':_0x256439['body'][_0xfa85('0xae')][_0x2e32db][_0xfa85('0x41')],'id':_0x256439[_0xfa85('0x61')]['attachments'][_0x2e32db]['id'],'path':path[_0xfa85('0xaf')](config['root'],_0xfa85('0xb0'),_0x256439['body'][_0xfa85('0xae')][_0x2e32db]['basename'])};}}return respondWithRpcPromise(_0xfa85('0xb1'),_0xfa85('0xb1'),{'FaxAccountId':_[_0xfa85('0xb2')](_0x256439[_0xfa85('0x5d')]['id'])?undefined:_0x256439[_0xfa85('0x5d')]['id'],'path':_[_0xfa85('0xb2')](_0x256439['body']['attachments'][0x0][_0xfa85('0x6')])?undefined:_0x256439[_0xfa85('0x61')][_0xfa85('0xae')][0x0][_0xfa85('0x6')],'fax':_[_0xfa85('0xb2')](_0x256439[_0xfa85('0x61')]['to'][0x0])?undefined:_0x256439['body']['to'][0x0]},client9002);})[_0xfa85('0x24')](function(){if(_0x32af10){if(_[_0xfa85('0xb2')](_0x256439['body'][_0xfa85('0xb3')])){_0x256439[_0xfa85('0x61')][_0xfa85('0xb3')]=util[_0xfa85('0xb4')](_0xfa85('0xb5'),_0x32af10[_0xfa85('0x41')],_0x32af10[_0xfa85('0xb6')]);}if(_0x32af10['List']){if(_0x32af10['List'][_0xfa85('0xac')][_0xfa85('0x50')]){return _0x32af10['List'][_0xfa85('0xac')][0x0];}else{return db[_0xfa85('0x78')][_0xfa85('0x60')](_[_0xfa85('0x1a')](_0x256439[_0xfa85('0x61')],{'firstName':_0x256439['body']['to'][0x0],'phone':_0x256439[_0xfa85('0x61')]['to'][0x0],'fax':_0x256439[_0xfa85('0x61')]['to'][0x0],'ListId':_0x32af10['ListId']}));}}else{throw new Error(_0xfa85('0xb7'));}}else{throw new Error(_0xfa85('0xb8'));}})['then'](function(_0x40ee90){if(_0x40ee90){return db[_0xfa85('0x76')][_0xfa85('0x5f')]({'where':{'ContactId':_0x40ee90['id'],'closed':![],'FaxAccountId':_0x32af10['id']}})[_0xfa85('0x24')](function(_0x4cca4f){if(_0x4cca4f){return[_0x4cca4f,![]];}return db['FaxInteraction'][_0xfa85('0x60')]({'UserId':_0x256439['user']['id'],'ContactId':_0x40ee90['id'],'FaxAccountId':_0x32af10['id'],'fax':_0x256439[_0xfa85('0x61')]['to'][0x0],'firstMsgDirection':_0xfa85('0xb9'),'Messages':[_[_0xfa85('0x55')](_0x256439[_0xfa85('0x61')],{'read':![],'body':_0x256439[_0xfa85('0x61')]['attachments'][0x0][_0xfa85('0xba')],'FaxAccountId':_0x32af10['id'],'UserId':_0x256439[_0xfa85('0xbb')]['id'],'ContactId':_0x40ee90['id'],'AttachmentId':_0x256439['body'][_0xfa85('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xfa85('0xa9')],'as':'Messages'}]})[_0xfa85('0x24')](function(_0x438fb5){return[_0x438fb5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfa85('0xbc')](function(_0x3726f5,_0x2fd7c3){if(_0x2fd7c3){return _0x3726f5;}return db[_0xfa85('0xa9')]['create']({'direction':_0xfa85('0xb9'),'read':![],'body':_0x256439[_0xfa85('0x61')][_0xfa85('0xae')][0x0]['filename'],'FaxAccountId':_0x32af10['id'],'FaxInteractionId':_0x3726f5['id'],'UserId':_0x256439[_0xfa85('0xbb')]['id'],'ContactId':_0x3726f5[_0xfa85('0xbd')],'AttachmentId':_0x256439[_0xfa85('0x61')]['attachments'][0x0]['id']})['then'](function(_0x302d21){_0x3726f5[_0xfa85('0xbe')][_0xfa85('0xbf')]=[];_0x3726f5[_0xfa85('0xbe')][_0xfa85('0xbf')]['push'](_0x302d21['dataValues']);return _0x3726f5;});})[_0xfa85('0x24')](function(_0x42f2bf){respondWithRpcPromise(_0xfa85('0xc0'),'SendFax',{'FaxAccountId':_['isNil'](_0x256439[_0xfa85('0x5d')]['id'])?undefined:_0x256439[_0xfa85('0x5d')]['id'],'path':_[_0xfa85('0xb2')](_0x256439['body'][_0xfa85('0xae')][0x0][_0xfa85('0x6')])?undefined:_0x256439[_0xfa85('0x61')][_0xfa85('0xae')][0x0][_0xfa85('0x6')],'fax':_[_0xfa85('0xb2')](_0x256439[_0xfa85('0x61')]['to'][0x0])?undefined:_0x256439[_0xfa85('0x61')]['to'][0x0],'AttachmentId':_0x256439[_0xfa85('0x61')][_0xfa85('0xae')][0x0]['id']},client9002)['then'](function(_0x4e31e5){logger['info'](_0xfa85('0xc1'),_0x4e31e5);})['catch'](function(_0x389fbd){logger['info'](_0xfa85('0xc1'),_0x389fbd);});return _0x42f2bf;})[_0xfa85('0x24')](respondWithResult(_0x487235,null))[_0xfa85('0x2f')](handleError(_0x487235,null));};exports[_0xfa85('0xc2')]=function(_0x3132c2,_0x57e39f,_0x2b6a4f){return db[_0xfa85('0x45')][_0xfa85('0x5f')]({'where':{'id':_0x3132c2[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x57e39f,null))[_0xfa85('0x24')](function(_0x5a27e7){if(_0x5a27e7){return _0x5a27e7[_0xfa85('0xc2')](_0x3132c2[_0xfa85('0x61')]['ids'],_[_0xfa85('0x77')](_0x3132c2[_0xfa85('0x61')],['ids','id'])||{})[_0xfa85('0xbc')](function(_0x47c65f){for(var _0x5b2e13=0x0;_0x5b2e13<_0x3132c2[_0xfa85('0x61')][_0xfa85('0x6f')][_0xfa85('0x50')];_0x5b2e13+=0x1){socket[_0xfa85('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x3132c2[_0xfa85('0x61')]['ids'][_0x5b2e13]),'FaxAccountId':Number(_0x3132c2[_0xfa85('0x5d')]['id'])});}return _0x47c65f;});}})[_0xfa85('0x24')](respondWithResult(_0x57e39f,null))[_0xfa85('0x2f')](handleError(_0x57e39f,null));};exports['removeAgents']=function(_0x285fa3,_0x173087,_0x4bb870){return db['FaxAccount'][_0xfa85('0x5f')]({'where':{'id':_0x285fa3[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x173087,null))['then'](function(_0x536498){if(_0x536498){return _0x536498[_0xfa85('0xc4')](_0x285fa3[_0xfa85('0x4a')][_0xfa85('0x6f')])[_0xfa85('0x24')](function(){if(_[_0xfa85('0xc5')](_0x285fa3[_0xfa85('0x4a')][_0xfa85('0x6f')])){for(var _0xb78dc1=0x0;_0xb78dc1<_0x285fa3[_0xfa85('0x4a')][_0xfa85('0x6f')][_0xfa85('0x50')];_0xb78dc1+=0x1){socket[_0xfa85('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x285fa3[_0xfa85('0x4a')][_0xfa85('0x6f')][_0xb78dc1]),'FaxAccountId':Number(_0x285fa3[_0xfa85('0x5d')]['id'])});}}else{socket[_0xfa85('0xc3')](_0xfa85('0xc6'),{'UserId':Number(_0x285fa3[_0xfa85('0x4a')]['ids']),'FaxAccountId':Number(_0x285fa3[_0xfa85('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173087,null))[_0xfa85('0x2f')](handleError(_0x173087,null));};exports[_0xfa85('0xc7')]=function(_0x1bc802,_0x195237,_0x59fede){var _0x5ea5a5={};var _0x75cfa0={};var _0x279524;var _0x40ffba;return db['FaxAccount'][_0xfa85('0x6b')]({'where':{'id':_0x1bc802[_0xfa85('0x5d')]['id']}})[_0xfa85('0x24')](handleEntityNotFound(_0x195237,null))[_0xfa85('0x24')](function(_0x45aaab){if(_0x45aaab){_0x279524=_0x45aaab;_0x75cfa0[_0xfa85('0x49')]=_[_0xfa85('0x4b')](db[_0xfa85('0x7a')][_0xfa85('0x46')]);_0x75cfa0[_0xfa85('0x4a')]=_['keys'](_0x1bc802[_0xfa85('0x4a')]);_0x75cfa0['filters']=_[_0xfa85('0x4d')](_0x75cfa0[_0xfa85('0x49')],_0x75cfa0[_0xfa85('0x4a')]);_0x5ea5a5['attributes']=_[_0xfa85('0x4d')](_0x75cfa0[_0xfa85('0x49')],qs[_0xfa85('0x4f')](_0x1bc802['query'][_0xfa85('0x4f')]));_0x5ea5a5['attributes']=_0x5ea5a5['attributes']['length']?_0x5ea5a5[_0xfa85('0x4e')]:_0x75cfa0['model'];_0x5ea5a5[_0xfa85('0x52')]=qs[_0xfa85('0x73')](_0x1bc802[_0xfa85('0x4a')]['sort']);_0x5ea5a5['where']=qs[_0xfa85('0x4c')](_[_0xfa85('0x54')](_0x1bc802['query'],_0x75cfa0[_0xfa85('0x4c')]));if(_0x1bc802[_0xfa85('0x4a')][_0xfa85('0x57')]){_0x5ea5a5[_0xfa85('0x53')]=_[_0xfa85('0x55')](_0x5ea5a5[_0xfa85('0x53')],{'$or':_['map'](_0x5ea5a5[_0xfa85('0x4e')],function(_0x2d5dff){var _0x496b22={};_0x496b22[_0x2d5dff]={'$like':'%'+_0x1bc802[_0xfa85('0x4a')][_0xfa85('0x57')]+'%'};return _0x496b22;})});}_0x5ea5a5=_[_0xfa85('0x55')]({},_0x5ea5a5,_0x1bc802[_0xfa85('0x58')]);return _0x279524[_0xfa85('0xc7')](_0x5ea5a5);}})['then'](function(_0x16e1b6){if(_0x16e1b6){_0x40ffba=_0x16e1b6[_0xfa85('0x50')];if(!_0x1bc802['query'][_0xfa85('0x51')](_0xfa85('0x6c'))){_0x5ea5a5[_0xfa85('0x35')]=qs['limit'](_0x1bc802['query'][_0xfa85('0x35')]);_0x5ea5a5[_0xfa85('0x33')]=qs[_0xfa85('0x33')](_0x1bc802[_0xfa85('0x4a')][_0xfa85('0x33')]);}return _0x279524[_0xfa85('0xc7')](_0x5ea5a5);}})[_0xfa85('0x24')](function(_0x579d0f){if(_0x579d0f){return _0x579d0f?{'count':_0x40ffba,'rows':_0x579d0f}:null;}})[_0xfa85('0x24')](respondWithResult(_0x195237,null))[_0xfa85('0x2f')](handleError(_0x195237,null));}; \ No newline at end of file +var _0x0938=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','FaxAccounts','end','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','count','includeAll','include','rows','show','params','mandatoryDispositionPause','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','merge','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','getApplications','from-voip-provider','localstationid','system','description','Fax\x20Extension','priority','appdata','Answer','push','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','user','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xecbaca,_0x2cc4c){var _0x14cc4f=function(_0x549496){while(--_0x549496){_0xecbaca['push'](_0xecbaca['shift']());}};_0x14cc4f(++_0x2cc4c);}(_0x0938,0x17e));var _0x8093=function(_0x1f2b29,_0x212ecb){_0x1f2b29=_0x1f2b29-0x0;var _0x94d517=_0x0938[_0x1f2b29];return _0x94d517;};'use strict';var emlformat=require(_0x8093('0x0'));var rimraf=require(_0x8093('0x1'));var zipdir=require(_0x8093('0x2'));var jsonpatch=require(_0x8093('0x3'));var rp=require(_0x8093('0x4'));var moment=require(_0x8093('0x5'));var BPromise=require(_0x8093('0x6'));var Mustache=require(_0x8093('0x7'));var util=require(_0x8093('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8093('0x9'));var ejs=require(_0x8093('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8093('0xb'));var squel=require(_0x8093('0xc'));var crypto=require('crypto');var jsforce=require(_0x8093('0xd'));var deskjs=require(_0x8093('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8093('0xf'));var Papa=require('papaparse');var Redis=require(_0x8093('0x10'));var authService=require(_0x8093('0x11'));var qs=require(_0x8093('0x12'));var as=require(_0x8093('0x13'));var hardwareService=require(_0x8093('0x14'));var logger=require(_0x8093('0x15'))(_0x8093('0x16'));var utils=require(_0x8093('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8093('0x18')](config['redis'],{'host':_0x8093('0x19'),'port':0x18eb});var socket=require(_0x8093('0x1a'))(new Redis(config[_0x8093('0x1b')]));require(_0x8093('0x1c'))[_0x8093('0x1d')](socket);var jayson=require(_0x8093('0x1e'));var client=jayson['client'][_0x8093('0x1f')]({'port':0x232c});var client9002=jayson[_0x8093('0x20')][_0x8093('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5b0081,_0x128057,_0x41121c,_0x55d04d){return new BPromise(function(_0x4ff552,_0x21ae94){var _0x1eefe9=_0x55d04d||client;return _0x1eefe9[_0x8093('0x21')](_0x5b0081,_0x41121c)[_0x8093('0x22')](function(_0x7753e7){logger[_0x8093('0x23')]('FaxAccount,\x20%s,\x20%s',_0x128057,'request\x20sent');logger[_0x8093('0x24')](_0x8093('0x25'),_0x128057,_0x8093('0x26'),JSON[_0x8093('0x27')](_0x7753e7));if(_0x7753e7[_0x8093('0x28')]){if(_0x7753e7[_0x8093('0x28')]['code']===0x1f4){logger[_0x8093('0x28')](_0x8093('0x29'),_0x128057,_0x7753e7[_0x8093('0x28')][_0x8093('0x2a')]);return _0x21ae94(_0x7753e7[_0x8093('0x28')][_0x8093('0x2a')]);}logger[_0x8093('0x28')](_0x8093('0x29'),_0x128057,_0x7753e7[_0x8093('0x28')][_0x8093('0x2a')]);return _0x4ff552(_0x7753e7[_0x8093('0x28')][_0x8093('0x2a')]);}else{logger[_0x8093('0x23')](_0x8093('0x29'),_0x128057,'request\x20sent');_0x4ff552(_0x7753e7[_0x8093('0x2b')]['message']);}})[_0x8093('0x2c')](function(_0x10f2c2){logger['error']('FaxAccount,\x20%s,\x20%s',_0x128057,_0x10f2c2);_0x21ae94(_0x10f2c2);});});}function respondWithStatusCode(_0x5c0bfc,_0x456f64){_0x456f64=_0x456f64||0xcc;return function(_0x1302fd){if(_0x1302fd){return _0x5c0bfc[_0x8093('0x2d')](_0x456f64);}return _0x5c0bfc[_0x8093('0x2e')](_0x456f64)['end']();};}function respondWithResult(_0x30dc77,_0x5e85d4){_0x5e85d4=_0x5e85d4||0xc8;return function(_0x2180ee){if(_0x2180ee){return _0x30dc77[_0x8093('0x2e')](_0x5e85d4)[_0x8093('0x2f')](_0x2180ee);}};}function respondWithFilteredResult(_0x39be7d,_0x3fcf19){return function(_0x44f2eb){if(_0x44f2eb){var _0x34a473=typeof _0x3fcf19[_0x8093('0x30')]===_0x8093('0x31')&&typeof _0x3fcf19[_0x8093('0x32')]==='undefined';var _0x11dcbe=_0x44f2eb['count'];var _0x57ac56=_0x34a473?0x0:_0x3fcf19[_0x8093('0x30')];var _0x375030=_0x34a473?_0x44f2eb['count']:_0x3fcf19[_0x8093('0x30')]+_0x3fcf19[_0x8093('0x32')];var _0x2207a7;if(_0x375030>=_0x11dcbe){_0x375030=_0x11dcbe;_0x2207a7=0xc8;}else{_0x2207a7=0xce;}_0x39be7d[_0x8093('0x2e')](_0x2207a7);return _0x39be7d[_0x8093('0x33')]('Content-Range',_0x57ac56+'-'+_0x375030+'/'+_0x11dcbe)[_0x8093('0x2f')](_0x44f2eb);}return null;};}function patchUpdates(_0x1a5a3e){return function(_0x397fdf){try{jsonpatch[_0x8093('0x34')](_0x397fdf,_0x1a5a3e,!![]);}catch(_0x1bdd83){return BPromise[_0x8093('0x35')](_0x1bdd83);}return _0x397fdf[_0x8093('0x36')]();};}function saveUpdates(_0x492fa5,_0x556adc){return function(_0x2c6b50){if(_0x2c6b50){return _0x2c6b50[_0x8093('0x37')](_0x492fa5)['then'](function(_0x56982b){return _0x56982b;});}return null;};}function removeEntity(_0x183cd4,_0x32cbd5){return function(_0x2725c6){if(_0x2725c6){return _0x2725c6[_0x8093('0x38')]()[_0x8093('0x22')](function(){var _0x28a2e4=_0x2725c6['get']({'plain':!![]});var _0x123b90=_0x8093('0x39');return db['UserProfileResource'][_0x8093('0x38')]({'where':{'type':_0x123b90,'resourceId':_0x28a2e4['id']}})['then'](function(){return _0x2725c6;});})['then'](function(){_0x183cd4[_0x8093('0x2e')](0xcc)[_0x8093('0x3a')]();});}};}function handleEntityNotFound(_0x2e848f,_0x3e757f){return function(_0x4c157e){if(!_0x4c157e){_0x2e848f[_0x8093('0x2d')](0x194);}return _0x4c157e;};}function handleError(_0x5d5c4b,_0x1f71e6){_0x1f71e6=_0x1f71e6||0x1f4;return function(_0x886968){logger[_0x8093('0x28')](_0x886968[_0x8093('0x3b')]);if(_0x886968[_0x8093('0x3c')]){delete _0x886968[_0x8093('0x3c')];}_0x5d5c4b[_0x8093('0x2e')](_0x1f71e6)[_0x8093('0x3d')](_0x886968);};}exports[_0x8093('0x3e')]=function(_0x40a2a3,_0x16be4a){var _0x4a28e1={'include':[{'model':db[_0x8093('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1022b6={},_0x280b25={'count':0x0,'rows':[]};var _0x14e534=_['map'](db[_0x8093('0x40')][_0x8093('0x41')],function(_0x1fc900){return{'name':_0x1fc900[_0x8093('0x42')],'type':_0x1fc900[_0x8093('0x43')][_0x8093('0x44')]};});_0x1022b6[_0x8093('0x45')]=_['map'](_0x14e534,'name');_0x1022b6['query']=_[_0x8093('0x46')](_0x40a2a3[_0x8093('0x47')]);_0x1022b6[_0x8093('0x48')]=_['intersection'](_0x1022b6[_0x8093('0x45')],_0x1022b6[_0x8093('0x47')]);_0x4a28e1[_0x8093('0x49')]=_[_0x8093('0x4a')](_0x1022b6['model'],qs[_0x8093('0x4b')](_0x40a2a3[_0x8093('0x47')][_0x8093('0x4b')]));_0x4a28e1['attributes']=_0x4a28e1[_0x8093('0x49')][_0x8093('0x4c')]?_0x4a28e1[_0x8093('0x49')]:_0x1022b6[_0x8093('0x45')];if(!_0x40a2a3['query'][_0x8093('0x4d')](_0x8093('0x4e'))){_0x4a28e1[_0x8093('0x32')]=qs[_0x8093('0x32')](_0x40a2a3['query'][_0x8093('0x32')]);_0x4a28e1[_0x8093('0x30')]=qs['offset'](_0x40a2a3['query'][_0x8093('0x30')]);}_0x4a28e1[_0x8093('0x4f')]=qs[_0x8093('0x50')](_0x40a2a3[_0x8093('0x47')][_0x8093('0x50')]);_0x4a28e1[_0x8093('0x51')]=qs[_0x8093('0x48')](_[_0x8093('0x52')](_0x40a2a3[_0x8093('0x47')],_0x1022b6[_0x8093('0x48')]),_0x14e534);if(_0x40a2a3['query'][_0x8093('0x53')]){_0x4a28e1[_0x8093('0x51')]=_['merge'](_0x4a28e1[_0x8093('0x51')],{'$or':_[_0x8093('0x54')](_0x14e534,function(_0x37839e){if(_0x37839e[_0x8093('0x43')]!==_0x8093('0x55')){var _0x156a6f={};_0x156a6f[_0x37839e[_0x8093('0x3c')]]={'$like':'%'+_0x40a2a3[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x156a6f;}})});}_0x4a28e1=_['merge']({},_0x4a28e1,_0x40a2a3[_0x8093('0x56')]);var _0x5874a4={'where':_0x4a28e1[_0x8093('0x51')]};return db['FaxAccount'][_0x8093('0x57')](_0x5874a4)[_0x8093('0x22')](function(_0x3b9608){_0x280b25[_0x8093('0x57')]=_0x3b9608;if(_0x40a2a3[_0x8093('0x47')][_0x8093('0x58')]){_0x4a28e1[_0x8093('0x59')]=[{'all':!![]}];}return db[_0x8093('0x40')]['findAll'](_0x4a28e1);})[_0x8093('0x22')](function(_0x3a0059){_0x280b25[_0x8093('0x5a')]=_0x3a0059;return _0x280b25;})[_0x8093('0x22')](respondWithFilteredResult(_0x16be4a,_0x4a28e1))['catch'](handleError(_0x16be4a,null));};exports[_0x8093('0x5b')]=function(_0x38b90e,_0x3dcb9a){var _0x4e6365={'raw':![],'where':{'id':_0x38b90e[_0x8093('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x8093('0x5d')}]},_0x16f1d5={};_0x16f1d5[_0x8093('0x45')]=_['keys'](db[_0x8093('0x40')]['rawAttributes']);_0x16f1d5[_0x8093('0x47')]=_[_0x8093('0x46')](_0x38b90e[_0x8093('0x47')]);_0x16f1d5['filters']=_['intersection'](_0x16f1d5[_0x8093('0x45')],_0x16f1d5[_0x8093('0x47')]);_0x4e6365[_0x8093('0x49')]=_[_0x8093('0x4a')](_0x16f1d5[_0x8093('0x45')],qs[_0x8093('0x4b')](_0x38b90e['query']['fields']));_0x4e6365[_0x8093('0x49')]=_0x4e6365[_0x8093('0x49')][_0x8093('0x4c')]?_0x4e6365[_0x8093('0x49')]:_0x16f1d5['model'];if(_0x38b90e[_0x8093('0x47')]['includeAll']){_0x4e6365[_0x8093('0x59')]=[{'all':!![]}];}_0x4e6365=_['merge']({},_0x4e6365,_0x38b90e[_0x8093('0x56')]);return db[_0x8093('0x40')]['find'](_0x4e6365)[_0x8093('0x22')](handleEntityNotFound(_0x3dcb9a,null))[_0x8093('0x22')](respondWithResult(_0x3dcb9a,null))[_0x8093('0x2c')](handleError(_0x3dcb9a,null));};exports[_0x8093('0x5e')]=function(_0x41ccdd,_0x237a8e){return db[_0x8093('0x40')]['create'](_0x41ccdd[_0x8093('0x5f')],{})[_0x8093('0x22')](function(_0x478ef4){var _0x4710de=_0x41ccdd['user'][_0x8093('0x60')]({'plain':!![]});if(!_0x4710de)throw new Error(_0x8093('0x61'));if(_0x4710de[_0x8093('0x62')]==='user'){var _0x5c8749=_0x478ef4[_0x8093('0x60')]({'plain':!![]});var _0x1ee3b1='FaxAccounts';return db[_0x8093('0x63')]['find']({'where':{'name':_0x1ee3b1,'userProfileId':_0x4710de[_0x8093('0x64')]},'raw':!![]})[_0x8093('0x22')](function(_0x4f2320){if(_0x4f2320&&_0x4f2320['autoAssociation']===0x0){return db[_0x8093('0x65')]['create']({'name':_0x5c8749[_0x8093('0x3c')],'resourceId':_0x5c8749['id'],'type':_0x4f2320[_0x8093('0x3c')],'sectionId':_0x4f2320['id']},{})['then'](function(){return _0x478ef4;});}else{return _0x478ef4;}})[_0x8093('0x2c')](function(_0x1b5ed4){logger[_0x8093('0x28')](_0x8093('0x66'),_0x1b5ed4);throw _0x1b5ed4;});}return _0x478ef4;})[_0x8093('0x22')](respondWithResult(_0x237a8e,0xc9))[_0x8093('0x2c')](handleError(_0x237a8e,null));};exports[_0x8093('0x37')]=function(_0x204670,_0xe575e3){if(_0x204670[_0x8093('0x5f')]['id']){delete _0x204670[_0x8093('0x5f')]['id'];}return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x204670[_0x8093('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x8093('0x5d')}]})['then'](handleEntityNotFound(_0xe575e3,null))['then'](saveUpdates(_0x204670[_0x8093('0x5f')],null))[_0x8093('0x22')](respondWithResult(_0xe575e3,null))[_0x8093('0x2c')](handleError(_0xe575e3,null));};exports['destroy']=function(_0x191285,_0x3aa3de){return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x191285[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x3aa3de,null))['then'](removeEntity(_0x3aa3de,null))[_0x8093('0x2c')](handleError(_0x3aa3de,null));};exports[_0x8093('0x68')]=function(_0x19c337,_0x1afe0d){return db[_0x8093('0x40')][_0x8093('0x68')]()[_0x8093('0x22')](respondWithResult(_0x1afe0d,null))[_0x8093('0x2c')](handleError(_0x1afe0d,null));};exports[_0x8093('0x69')]=function(_0x4a542f,_0x292757,_0x3e44ad){if(_0x4a542f[_0x8093('0x5f')]['id']){delete _0x4a542f['body']['id'];}return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x4a542f[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x292757,null))[_0x8093('0x22')](function(_0x111598){if(_0x111598){_0x4a542f[_0x8093('0x5f')][_0x8093('0x6a')]=_0x111598['id'];return db[_0x8093('0x6b')][_0x8093('0x5e')](_0x4a542f[_0x8093('0x5f')]);}})[_0x8093('0x22')](respondWithResult(_0x292757,null))[_0x8093('0x2c')](handleError(_0x292757,null));};exports[_0x8093('0x6c')]=function(_0x3b504a,_0x6d9922,_0x39d453){var _0x464150={'raw':![],'where':{}};var _0xdd2e7b={};var _0x4fdddd={'count':0x0,'rows':[]};return db[_0x8093('0x40')][_0x8093('0x6d')]({'where':{'id':_0x3b504a[_0x8093('0x5c')]['id']}})['then'](handleEntityNotFound(_0x6d9922,null))[_0x8093('0x22')](function(_0x5e204a){if(_0x5e204a){_0xdd2e7b[_0x8093('0x45')]=_['keys'](db[_0x8093('0x6b')][_0x8093('0x41')]);_0xdd2e7b[_0x8093('0x47')]=_['keys'](_0x3b504a[_0x8093('0x47')]);_0xdd2e7b['filters']=_['intersection'](_0xdd2e7b[_0x8093('0x45')],_0xdd2e7b[_0x8093('0x47')]);_0x464150[_0x8093('0x49')]=_[_0x8093('0x4a')](_0xdd2e7b['model'],qs[_0x8093('0x4b')](_0x3b504a[_0x8093('0x47')][_0x8093('0x4b')]));_0x464150[_0x8093('0x49')]=_0x464150[_0x8093('0x49')][_0x8093('0x4c')]?_0x464150[_0x8093('0x49')]:_0xdd2e7b[_0x8093('0x45')];if(!_0x3b504a[_0x8093('0x47')][_0x8093('0x4d')](_0x8093('0x4e'))){_0x464150[_0x8093('0x32')]=qs['limit'](_0x3b504a[_0x8093('0x47')]['limit']);_0x464150[_0x8093('0x30')]=qs['offset'](_0x3b504a[_0x8093('0x47')]['offset']);}_0x464150['order']=qs[_0x8093('0x50')](_0x3b504a[_0x8093('0x47')][_0x8093('0x50')]);_0x464150[_0x8093('0x51')]=qs[_0x8093('0x48')](_[_0x8093('0x52')](_0x3b504a[_0x8093('0x47')],_0xdd2e7b[_0x8093('0x48')]));_0x464150[_0x8093('0x51')][_0x8093('0x6a')]=_0x5e204a['id'];if(_0x3b504a[_0x8093('0x47')]['filter']){_0x464150[_0x8093('0x51')]=_['merge'](_0x464150[_0x8093('0x51')],{'$or':_[_0x8093('0x54')](_0x464150[_0x8093('0x49')],function(_0x2073ed){var _0x13f59c={};_0x13f59c[_0x2073ed]={'$like':'%'+_0x3b504a[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x13f59c;})});}_0x464150=_[_0x8093('0x6e')]({},_0x464150,_0x3b504a[_0x8093('0x56')]);return db[_0x8093('0x6b')]['count']({'where':_0x464150['where']})[_0x8093('0x22')](function(_0x5ccf60){_0x4fdddd[_0x8093('0x57')]=_0x5ccf60;if(_0x3b504a[_0x8093('0x47')][_0x8093('0x58')]){_0x464150[_0x8093('0x59')]=[{'all':!![]}];}return db[_0x8093('0x6b')][_0x8093('0x6f')](_0x464150);})['then'](function(_0x30e57e){_0x4fdddd[_0x8093('0x5a')]=_0x30e57e;return _0x4fdddd;});}})['then'](respondWithFilteredResult(_0x6d9922,_0x464150))[_0x8093('0x2c')](handleError(_0x6d9922,null));};exports[_0x8093('0x70')]=function(_0x4fa1b5,_0x2ec984,_0x320951){return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x4fa1b5[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x2ec984,null))[_0x8093('0x22')](function(_0x3c1e36){if(_0x3c1e36){return _0x3c1e36['removeDispositions'](_0x4fa1b5[_0x8093('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x2ec984,null))[_0x8093('0x2c')](handleError(_0x2ec984,null));};exports[_0x8093('0x71')]=function(_0x3e6de5,_0x1b9201,_0x3431d0){if(_0x3e6de5[_0x8093('0x5f')]['id']){delete _0x3e6de5[_0x8093('0x5f')]['id'];}return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x3e6de5[_0x8093('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1b9201,null))[_0x8093('0x22')](function(_0x3b8c81){if(_0x3b8c81){_0x3e6de5[_0x8093('0x5f')][_0x8093('0x6a')]=_0x3b8c81['id'];return db[_0x8093('0x72')][_0x8093('0x5e')](_0x3e6de5[_0x8093('0x5f')]);}})[_0x8093('0x22')](respondWithResult(_0x1b9201,null))[_0x8093('0x2c')](handleError(_0x1b9201,null));};exports[_0x8093('0x73')]=function(_0x4b92aa,_0x403c15,_0x25ec4b){var _0x2799af={'raw':![],'where':{}};var _0x2bc776={};var _0x15ea82={'count':0x0,'rows':[]};return db[_0x8093('0x40')][_0x8093('0x6d')]({'where':{'id':_0x4b92aa['params']['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x403c15,null))['then'](function(_0x454ccd){if(_0x454ccd){_0x2bc776['model']=_['keys'](db[_0x8093('0x72')][_0x8093('0x41')]);_0x2bc776['query']=_[_0x8093('0x46')](_0x4b92aa[_0x8093('0x47')]);_0x2bc776[_0x8093('0x48')]=_[_0x8093('0x4a')](_0x2bc776[_0x8093('0x45')],_0x2bc776[_0x8093('0x47')]);_0x2799af[_0x8093('0x49')]=_[_0x8093('0x4a')](_0x2bc776[_0x8093('0x45')],qs[_0x8093('0x4b')](_0x4b92aa['query'][_0x8093('0x4b')]));_0x2799af['attributes']=_0x2799af[_0x8093('0x49')][_0x8093('0x4c')]?_0x2799af[_0x8093('0x49')]:_0x2bc776[_0x8093('0x45')];if(!_0x4b92aa[_0x8093('0x47')][_0x8093('0x4d')](_0x8093('0x4e'))){_0x2799af['limit']=qs[_0x8093('0x32')](_0x4b92aa['query'][_0x8093('0x32')]);_0x2799af[_0x8093('0x30')]=qs['offset'](_0x4b92aa[_0x8093('0x47')][_0x8093('0x30')]);}_0x2799af[_0x8093('0x4f')]=qs[_0x8093('0x50')](_0x4b92aa['query'][_0x8093('0x50')]);_0x2799af[_0x8093('0x51')]=qs[_0x8093('0x48')](_[_0x8093('0x52')](_0x4b92aa[_0x8093('0x47')],_0x2bc776[_0x8093('0x48')]));_0x2799af[_0x8093('0x51')][_0x8093('0x6a')]=_0x454ccd['id'];if(_0x4b92aa[_0x8093('0x47')][_0x8093('0x53')]){_0x2799af[_0x8093('0x51')]=_['merge'](_0x2799af[_0x8093('0x51')],{'$or':_[_0x8093('0x54')](_0x2799af[_0x8093('0x49')],function(_0x563b04){var _0x19bf86={};_0x19bf86[_0x563b04]={'$like':'%'+_0x4b92aa[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x19bf86;})});}_0x2799af=_[_0x8093('0x6e')]({},_0x2799af,_0x4b92aa[_0x8093('0x56')]);return db[_0x8093('0x72')]['count']({'where':_0x2799af['where']})[_0x8093('0x22')](function(_0x4c7961){_0x15ea82[_0x8093('0x57')]=_0x4c7961;if(_0x4b92aa[_0x8093('0x47')][_0x8093('0x58')]){_0x2799af[_0x8093('0x59')]=[{'all':!![]}];}return db[_0x8093('0x72')]['findAll'](_0x2799af);})[_0x8093('0x22')](function(_0x98d51f){_0x15ea82[_0x8093('0x5a')]=_0x98d51f;return _0x15ea82;});}})[_0x8093('0x22')](respondWithFilteredResult(_0x403c15,_0x2799af))['catch'](handleError(_0x403c15,null));};exports['removeAnswers']=function(_0x19e52a,_0x1dfbd8,_0x252a11){return db[_0x8093('0x40')]['find']({'where':{'id':_0x19e52a[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x1dfbd8,null))[_0x8093('0x22')](function(_0x2b42cd){if(_0x2b42cd){return _0x2b42cd[_0x8093('0x74')](_0x19e52a[_0x8093('0x47')][_0x8093('0x75')]);}})[_0x8093('0x22')](respondWithStatusCode(_0x1dfbd8,null))['catch'](handleError(_0x1dfbd8,null));};exports[_0x8093('0x76')]=function(_0x5faf8e,_0x3e3474,_0x34b104){return db[_0x8093('0x77')][_0x8093('0x67')]({'where':{'id':_0x5faf8e[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x3e3474,null))['then'](function(_0x5b8d8f){if(_0x5b8d8f){return _0x5b8d8f[_0x8093('0x76')](_0x5faf8e['body'][_0x8093('0x75')],_[_0x8093('0x78')](_0x5faf8e[_0x8093('0x5f')],[_0x8093('0x75'),'id'])||{});}})['then'](respondWithResult(_0x3e3474,null))['catch'](handleError(_0x3e3474,null));};exports[_0x8093('0x79')]=function(_0x1539a1,_0xb90dd1,_0x9e8b73){var _0x361dda={'raw':![],'where':{}};var _0x36db3c={};var _0x15995d={'count':0x0,'rows':[]};return db[_0x8093('0x40')]['findOne']({'where':{'id':_0x1539a1['params']['id']}})[_0x8093('0x22')](handleEntityNotFound(_0xb90dd1,null))[_0x8093('0x22')](function(_0x3187de){if(_0x3187de){_0x36db3c[_0x8093('0x45')]=_[_0x8093('0x46')](db[_0x8093('0x77')][_0x8093('0x41')]);_0x36db3c[_0x8093('0x47')]=_[_0x8093('0x46')](_0x1539a1[_0x8093('0x47')]);_0x36db3c[_0x8093('0x48')]=_[_0x8093('0x4a')](_0x36db3c[_0x8093('0x45')],_0x36db3c[_0x8093('0x47')]);_0x361dda[_0x8093('0x49')]=_[_0x8093('0x4a')](_0x36db3c[_0x8093('0x45')],qs['fields'](_0x1539a1[_0x8093('0x47')][_0x8093('0x4b')]));_0x361dda[_0x8093('0x49')]=_0x361dda[_0x8093('0x49')][_0x8093('0x4c')]?_0x361dda[_0x8093('0x49')]:_0x36db3c[_0x8093('0x45')];if(!_0x1539a1[_0x8093('0x47')]['hasOwnProperty']('nolimit')){_0x361dda[_0x8093('0x32')]=qs[_0x8093('0x32')](_0x1539a1['query'][_0x8093('0x32')]);_0x361dda[_0x8093('0x30')]=qs['offset'](_0x1539a1[_0x8093('0x47')][_0x8093('0x30')]);}_0x361dda[_0x8093('0x4f')]=qs[_0x8093('0x50')](_0x1539a1[_0x8093('0x47')][_0x8093('0x50')]);_0x361dda[_0x8093('0x51')]=qs[_0x8093('0x48')](_[_0x8093('0x52')](_0x1539a1[_0x8093('0x47')],_0x36db3c[_0x8093('0x48')]));_0x361dda[_0x8093('0x51')][_0x8093('0x6a')]=_0x3187de['id'];if(_0x1539a1[_0x8093('0x47')][_0x8093('0x53')]){_0x361dda[_0x8093('0x51')]=_['merge'](_0x361dda['where'],{'$or':_['map'](_0x361dda['attributes'],function(_0x19d464){var _0x127476={};_0x127476[_0x19d464]={'$like':'%'+_0x1539a1['query'][_0x8093('0x53')]+'%'};return _0x127476;})});}_0x361dda=_[_0x8093('0x6e')]({},_0x361dda,_0x1539a1['options']);return db[_0x8093('0x77')][_0x8093('0x57')]({'where':_0x361dda[_0x8093('0x51')]})[_0x8093('0x22')](function(_0x346823){_0x15995d[_0x8093('0x57')]=_0x346823;if(_0x1539a1['query'][_0x8093('0x58')]){_0x361dda['include']=[{'model':db[_0x8093('0x7a')],'as':_0x8093('0x7b'),'required':![]},{'model':db['User'],'as':_0x8093('0x7c'),'attributes':[_0x8093('0x3c'),_0x8093('0x7d'),_0x8093('0x7e')],'required':![]},{'model':db[_0x8093('0x7f')],'as':'Tags','attributes':['id',_0x8093('0x3c'),_0x8093('0x80')],'where':_0x1539a1[_0x8093('0x47')][_0x8093('0x81')]?{'id':_0x1539a1[_0x8093('0x47')][_0x8093('0x81')]}:undefined,'required':_0x1539a1['query'][_0x8093('0x81')]?!![]:![]}];}return db[_0x8093('0x77')][_0x8093('0x6f')](_0x361dda);})[_0x8093('0x22')](function(_0x53b2d8){_0x15995d[_0x8093('0x5a')]=_0x53b2d8;return _0x15995d;});}})[_0x8093('0x22')](respondWithFilteredResult(_0xb90dd1,_0x361dda))[_0x8093('0x2c')](handleError(_0xb90dd1,null));};exports[_0x8093('0x82')]=function(_0x54774a,_0x509d48){var _0x5cc100=_0x54774a['params']['id'];var _0x469607=_0x54774a[_0x8093('0x5f')];var _0x348300=0xc8;var _0x3d6777=null;return db['sequelize'][_0x8093('0x83')]({'isolationLevel':db[_0x8093('0x84')][_0x8093('0x85')][_0x8093('0x86')][_0x8093('0x87')]},function(_0x30ad18){return db[_0x8093('0x40')][_0x8093('0x6d')]({'where':{'id':_0x5cc100},'transaction':_0x30ad18})[_0x8093('0x22')](function(_0x3bc2d2){if(_0x3bc2d2){return db[_0x8093('0x88')][_0x8093('0x38')]({'where':{'FaxAccountId':_0x5cc100},'transaction':_0x30ad18})['then'](function(){var _0x26c8c4=_[_0x8093('0x54')](_0x469607,function(_0x2960a2){_0x2960a2[_0x8093('0x6a')]=_0x5cc100;return _0x2960a2;});return db[_0x8093('0x88')][_0x8093('0x89')](_0x26c8c4,{'transaction':_0x30ad18});});}else{_0x348300=0x194;_0x3d6777=[];}});})[_0x8093('0x22')](function(){if(_0x348300!==0x194){return db[_0x8093('0x88')][_0x8093('0x8a')]({'where':{'FaxAccountId':_0x5cc100},'order':'priority'})[_0x8093('0x22')](function(_0x112d8a){_0x3d6777=_0x112d8a;});}})[_0x8093('0x2c')](function(_0x4ed637){_0x348300=0x1f4;logger[_0x8093('0x28')](_0x4ed637[_0x8093('0x3b')]);if(_0x4ed637['name']){delete _0x4ed637[_0x8093('0x3c')];}_0x3d6777=_0x4ed637;})['finally'](function(){if(_0x3d6777===null){_0x509d48[_0x8093('0x2d')](_0x348300);}else{if(_0x348300===0x1f4){_0x509d48[_0x8093('0x2e')](_0x348300)[_0x8093('0x3d')](_0x3d6777);}else{_0x509d48[_0x8093('0x2e')](_0x348300)[_0x8093('0x2f')](_0x3d6777);}}});};exports[_0x8093('0x8b')]=function(_0x153cac,_0x2ae9f5,_0x23dfb1){var _0x453371={};var _0x11e6cf={};var _0x2055ed;var _0x9ac962;return db[_0x8093('0x40')]['findOne']({'where':{'id':_0x153cac[_0x8093('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ae9f5,null))[_0x8093('0x22')](function(_0x36671d){if(_0x36671d){_0x2055ed=_0x36671d;_0x11e6cf[_0x8093('0x45')]=_[_0x8093('0x46')](db[_0x8093('0x88')][_0x8093('0x41')]);_0x11e6cf[_0x8093('0x47')]=_[_0x8093('0x46')](_0x153cac[_0x8093('0x47')]);_0x11e6cf[_0x8093('0x48')]=_[_0x8093('0x4a')](_0x11e6cf[_0x8093('0x45')],_0x11e6cf['query']);_0x453371[_0x8093('0x49')]=_[_0x8093('0x4a')](_0x11e6cf[_0x8093('0x45')],qs[_0x8093('0x4b')](_0x153cac[_0x8093('0x47')]['fields']));_0x453371['attributes']=_0x453371['attributes']['length']?_0x453371[_0x8093('0x49')]:_0x11e6cf[_0x8093('0x45')];_0x453371[_0x8093('0x4f')]=qs[_0x8093('0x50')](_0x153cac[_0x8093('0x47')][_0x8093('0x50')]);_0x453371[_0x8093('0x51')]=qs[_0x8093('0x48')](_[_0x8093('0x52')](_0x153cac[_0x8093('0x47')],_0x11e6cf[_0x8093('0x48')]));if(_0x153cac[_0x8093('0x47')][_0x8093('0x53')]){_0x453371[_0x8093('0x51')]=_[_0x8093('0x6e')](_0x453371[_0x8093('0x51')],{'$or':_[_0x8093('0x54')](_0x453371['attributes'],function(_0x1ef34a){var _0x1941ee={};_0x1941ee[_0x1ef34a]={'$like':'%'+_0x153cac[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x1941ee;})});}_0x453371=_[_0x8093('0x6e')]({},_0x453371,_0x153cac['options']);return _0x2055ed[_0x8093('0x8b')](_0x453371);}})[_0x8093('0x22')](function(_0x10e732){if(_0x10e732){_0x9ac962=_0x10e732[_0x8093('0x4c')];if(!_0x153cac['query'][_0x8093('0x4d')](_0x8093('0x4e'))){_0x453371['limit']=qs[_0x8093('0x32')](_0x153cac['query']['limit']);_0x453371['offset']=qs['offset'](_0x153cac[_0x8093('0x47')][_0x8093('0x30')]);}return _0x2055ed['getApplications'](_0x453371);}})[_0x8093('0x22')](function(_0x116755){if(_0x116755){return _0x116755?{'count':_0x9ac962,'rows':_0x116755}:null;}})[_0x8093('0x22')](respondWithResult(_0x2ae9f5,null))[_0x8093('0x2c')](handleError(_0x2ae9f5,null));};function Extension(_0x4c3a31,_0x46e74e,_0x508e0f,_0xf501aa){this['context']=_0x8093('0x8c');this['exten']=_0x4c3a31[_0x8093('0x8d')];this['app']=_0xf501aa;this[_0x8093('0x43')]=_0x8093('0x8e');this[_0x8093('0x8f')]=_0x8093('0x90');this[_0x8093('0x6a')]=_0x4c3a31['id'];this[_0x8093('0x91')]=_0x46e74e;this[_0x8093('0x92')]=_0x508e0f;}function createExtensionsReciveFax(_0x239b75){var _0x4d96e0=0x1;var _0x251527=[];_0x251527['push'](new Extension(_0x239b75,_0x4d96e0,'',_0x8093('0x93')));_0x4d96e0+=0x1;_0x251527[_0x8093('0x94')](new Extension(_0x239b75,_0x4d96e0,'CDR(type)=inbound-fax',_0x8093('0x95')));_0x4d96e0+=0x1;for(var _0x5513a7 in _0x239b75){if(_0x239b75['hasOwnProperty'](_0x5513a7)&&(_0x5513a7==='ecm'||_0x5513a7===_0x8093('0x8d')||_0x5513a7==='gateway'||_0x5513a7===_0x8093('0x96')||_0x5513a7===_0x8093('0x97')||_0x5513a7===_0x8093('0x98')||_0x5513a7===_0x8093('0x99')||_0x5513a7===_0x8093('0x9a')||_0x5513a7===_0x8093('0x9b'))){_0x251527[_0x8093('0x94')](new Extension(_0x239b75,_0x4d96e0,'FAXOPT('+_0x5513a7+')='+_0x239b75[_0x5513a7],_0x8093('0x95')));_0x4d96e0+=0x1;}}_0x251527[_0x8093('0x94')](new Extension(_0x239b75,_0x4d96e0,'6','Wait'));_0x4d96e0+=0x1;_0x251527[_0x8093('0x94')](new Extension(_0x239b75,_0x4d96e0,_0x8093('0x9c'),'ReceiveFax'));_0x4d96e0=0x0;return _0x251527;}exports[_0x8093('0x9d')]=function(_0x431626,_0x59e6ff,_0x5cd382){var _0x9a89b5;return db[_0x8093('0x84')]['transaction'](function(_0x50b20a){return db['FaxAccount'][_0x8093('0x5e')](_0x431626[_0x8093('0x5f')],{'transaction':_0x50b20a})['then'](function(_0xc9d8da){_0x9a89b5=_0xc9d8da[_0x8093('0x60')]({'plain':!![]});return db[_0x8093('0x9e')][_0x8093('0x89')](createExtensionsReciveFax(_0x9a89b5),{'transaction':_0x50b20a});});})[_0x8093('0x22')](function(){return _0x9a89b5;})[_0x8093('0x22')](respondWithResult(_0x59e6ff,null))[_0x8093('0x2c')](handleError(_0x59e6ff,null));};exports[_0x8093('0x9f')]=function(_0x16b538,_0x126d8c,_0x28349c){var _0x45e080;return db[_0x8093('0x84')][_0x8093('0x83')](function(_0x511aff){return db[_0x8093('0x40')][_0x8093('0x37')](_0x16b538[_0x8093('0x5f')],{'where':{'id':_0x16b538['body']['id']},'transaction':_0x511aff})[_0x8093('0x22')](function(_0x1992d6){return db[_0x8093('0x9e')][_0x8093('0x38')]({'where':{'FaxAccountId':_0x16b538[_0x8093('0x5f')]['id']},'transaction':_0x511aff})['then'](function(_0x5fff17){return db[_0x8093('0x9e')][_0x8093('0x89')](createExtensionsReciveFax(_['omit'](_0x16b538[_0x8093('0x5f')],[_0x8093('0xa0'),'key',_0x8093('0xa1'),_0x8093('0xa2'),_0x8093('0xa3'),'ListId'])),{'transaction':_0x511aff});});});})[_0x8093('0x22')](function(){return db['FaxAccount']['findById'](_0x16b538[_0x8093('0x5f')]['id']);})[_0x8093('0x22')](respondWithResult(_0x126d8c,null))[_0x8093('0x2c')](handleError(_0x126d8c,null));};exports[_0x8093('0xa4')]=function(_0x173d91,_0x48dfca,_0xcdbc6a){var _0xf97bcc={'raw':!![],'where':{}};var _0x39870f={};var _0x55ed84={'count':0x0,'rows':[]};return db[_0x8093('0x40')][_0x8093('0x6d')]({'where':{'id':_0x173d91[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x48dfca,null))[_0x8093('0x22')](function(_0x13645a){if(_0x13645a){_0x39870f['model']=_[_0x8093('0x46')](db[_0x8093('0xa5')][_0x8093('0x41')]);_0x39870f[_0x8093('0x47')]=_[_0x8093('0x46')](_0x173d91[_0x8093('0x47')]);_0x39870f[_0x8093('0x48')]=_[_0x8093('0x4a')](_0x39870f[_0x8093('0x45')],_0x39870f[_0x8093('0x47')]);_0xf97bcc[_0x8093('0x49')]=_['intersection'](_0x39870f[_0x8093('0x45')],qs[_0x8093('0x4b')](_0x173d91[_0x8093('0x47')][_0x8093('0x4b')]));_0xf97bcc[_0x8093('0x49')]=_0xf97bcc[_0x8093('0x49')][_0x8093('0x4c')]?_0xf97bcc[_0x8093('0x49')]:_0x39870f[_0x8093('0x45')];if(!_0x173d91[_0x8093('0x47')][_0x8093('0x4d')](_0x8093('0x4e'))){_0xf97bcc[_0x8093('0x32')]=qs[_0x8093('0x32')](_0x173d91[_0x8093('0x47')][_0x8093('0x32')]);_0xf97bcc[_0x8093('0x30')]=qs[_0x8093('0x30')](_0x173d91[_0x8093('0x47')][_0x8093('0x30')]);}_0xf97bcc[_0x8093('0x4f')]=qs['sort'](_0x173d91[_0x8093('0x47')]['sort']);_0xf97bcc['where']=qs['filters'](_['pick'](_0x173d91[_0x8093('0x47')],_0x39870f[_0x8093('0x48')]));_0xf97bcc[_0x8093('0x51')]['FaxAccountId']=_0x13645a['id'];if(_0x173d91[_0x8093('0x47')][_0x8093('0x53')]){_0xf97bcc[_0x8093('0x51')]=_[_0x8093('0x6e')](_0xf97bcc[_0x8093('0x51')],{'$or':_[_0x8093('0x54')](_0xf97bcc[_0x8093('0x49')],function(_0x391614){var _0x336530={};_0x336530[_0x391614]={'$like':'%'+_0x173d91[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x336530;})});}if(_0x173d91['query'][_0x8093('0xa6')]){var _0x54a20e=_0x173d91['query'][_0x8093('0xa6')][_0x8093('0xa7')](',');var _0x3c5fcf={};_0x3c5fcf[_0x54a20e[0x0]]={'$gte':moment(_0x54a20e[0x1])[_0x8093('0xa8')](_0x8093('0xa9'))};_0xf97bcc[_0x8093('0x51')]=_[_0x8093('0x6e')](_0xf97bcc[_0x8093('0x51')],_0x3c5fcf);}_0xf97bcc=_['merge']({},_0xf97bcc,_0x173d91[_0x8093('0x56')]);return db[_0x8093('0xa5')][_0x8093('0x57')]({'where':_0xf97bcc[_0x8093('0x51')]})[_0x8093('0x22')](function(_0x1ed3f6){_0x55ed84['count']=_0x1ed3f6;if(_0x173d91[_0x8093('0x47')][_0x8093('0x58')]){_0xf97bcc[_0x8093('0x59')]=[{'all':!![]}];}return db[_0x8093('0xa5')][_0x8093('0x6f')](_0xf97bcc);})[_0x8093('0x22')](function(_0xbbe493){_0x55ed84['rows']=_0xbbe493;return _0x55ed84;});}})[_0x8093('0x22')](respondWithFilteredResult(_0x48dfca,_0xf97bcc))[_0x8093('0x2c')](handleError(_0x48dfca,null));};exports[_0x8093('0x3d')]=function(_0x57b785,_0x3896a2,_0x1abed8){var _0x3f5f91,_0x1e79bd={},_0x1271b6;if(_0x57b785[_0x8093('0x5f')]['to']){_0x1271b6=_0x57b785[_0x8093('0x5f')]['to'][0x0];}return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x57b785['params']['id']},'include':[{'model':db[_0x8093('0xaa')],'as':_0x8093('0xab'),'include':[{'model':db[_0x8093('0x7a')],'as':_0x8093('0xac'),'where':{'fax':_0x1271b6},'limit':0x1,'order':[[_0x8093('0xa2'),'DESC']]}]}]})[_0x8093('0x22')](handleEntityNotFound(_0x3896a2,null))['then'](function(_0x368a73){_0x3f5f91=_0x368a73;if(_0x57b785[_0x8093('0x5f')][_0x8093('0xad')]&&_0x57b785[_0x8093('0x5f')]['attachments'][_0x8093('0x4c')]){for(var _0x2a601b=0x0;_0x2a601b<_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][_0x8093('0x4c')];_0x2a601b+=0x1){_0x57b785[_0x8093('0x5f')]['attachments'][_0x2a601b]={'filename':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][_0x2a601b][_0x8093('0x3c')],'id':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][_0x2a601b]['id'],'path':path[_0x8093('0xae')](config[_0x8093('0xaf')],_0x8093('0xb0'),_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][_0x2a601b]['basename'])};}}return respondWithRpcPromise(_0x8093('0xb1'),_0x8093('0xb1'),{'FaxAccountId':_[_0x8093('0xb2')](_0x57b785[_0x8093('0x5c')]['id'])?undefined:_0x57b785['params']['id'],'path':_[_0x8093('0xb2')](_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0][_0x8093('0xb3')])?undefined:_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0][_0x8093('0xb3')],'fax':_['isNil'](_0x57b785['body']['to'][0x0])?undefined:_0x57b785['body']['to'][0x0]},client9002);})[_0x8093('0x22')](function(){if(_0x3f5f91){if(_['isNil'](_0x57b785[_0x8093('0x5f')][_0x8093('0xb4')])){_0x57b785[_0x8093('0x5f')][_0x8093('0xb4')]=util['format'](_0x8093('0xb5'),_0x3f5f91[_0x8093('0x3c')],_0x3f5f91[_0x8093('0xb6')]);}if(_0x3f5f91[_0x8093('0xab')]){if(_0x3f5f91[_0x8093('0xab')][_0x8093('0xac')]['length']){return _0x3f5f91['List']['Contacts'][0x0];}else{return db[_0x8093('0x7a')][_0x8093('0x5e')](_[_0x8093('0x18')](_0x57b785['body'],{'firstName':_0x57b785[_0x8093('0x5f')]['to'][0x0],'phone':_0x57b785[_0x8093('0x5f')]['to'][0x0],'fax':_0x57b785[_0x8093('0x5f')]['to'][0x0],'ListId':_0x3f5f91['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8093('0xb7'));}})[_0x8093('0x22')](function(_0x335005){if(_0x335005){return db[_0x8093('0x77')]['find']({'where':{'ContactId':_0x335005['id'],'closed':![],'FaxAccountId':_0x3f5f91['id']}})['then'](function(_0x11c383){if(_0x11c383){return[_0x11c383,![]];}return db['FaxInteraction']['create']({'UserId':_0x57b785[_0x8093('0xb8')]['id'],'ContactId':_0x335005['id'],'FaxAccountId':_0x3f5f91['id'],'fax':_0x57b785[_0x8093('0x5f')]['to'][0x0],'firstMsgDirection':_0x8093('0xb9'),'Messages':[_['merge'](_0x57b785[_0x8093('0x5f')],{'read':![],'body':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0][_0x8093('0xba')],'FaxAccountId':_0x3f5f91['id'],'UserId':_0x57b785['user']['id'],'ContactId':_0x335005['id'],'AttachmentId':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x8093('0xa5')],'as':'Messages'}]})[_0x8093('0x22')](function(_0xa85bb4){return[_0xa85bb4,!![]];});});}else{throw new Error(_0x8093('0xbb'));}})['spread'](function(_0x550011,_0x4ff305){if(_0x4ff305){return _0x550011;}return db[_0x8093('0xa5')][_0x8093('0x5e')]({'direction':'out','read':![],'body':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0]['filename'],'FaxAccountId':_0x3f5f91['id'],'FaxInteractionId':_0x550011['id'],'UserId':_0x57b785[_0x8093('0xb8')]['id'],'ContactId':_0x550011[_0x8093('0xbc')],'AttachmentId':_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0]['id']})[_0x8093('0x22')](function(_0x1c4e8d){_0x550011[_0x8093('0xbd')][_0x8093('0xbe')]=[];_0x550011[_0x8093('0xbd')][_0x8093('0xbe')][_0x8093('0x94')](_0x1c4e8d[_0x8093('0xbd')]);return _0x550011;});})[_0x8093('0x22')](function(_0x3052ea){respondWithRpcPromise('SendFax',_0x8093('0xbf'),{'FaxAccountId':_[_0x8093('0xb2')](_0x57b785[_0x8093('0x5c')]['id'])?undefined:_0x57b785[_0x8093('0x5c')]['id'],'path':_[_0x8093('0xb2')](_0x57b785[_0x8093('0x5f')][_0x8093('0xad')][0x0]['path'])?undefined:_0x57b785[_0x8093('0x5f')]['attachments'][0x0][_0x8093('0xb3')],'fax':_['isNil'](_0x57b785['body']['to'][0x0])?undefined:_0x57b785['body']['to'][0x0],'AttachmentId':_0x57b785['body'][_0x8093('0xad')][0x0]['id']},client9002)[_0x8093('0x22')](function(_0x1d2778){logger[_0x8093('0x23')]('SendFaxRpc,\x20%s',_0x1d2778);})[_0x8093('0x2c')](function(_0x577806){logger[_0x8093('0x23')]('SendFaxRpc,\x20%s',_0x577806);});return _0x3052ea;})[_0x8093('0x22')](respondWithResult(_0x3896a2,null))[_0x8093('0x2c')](handleError(_0x3896a2,null));};exports[_0x8093('0xc0')]=function(_0x940703,_0x326822,_0x4f4d55){return db[_0x8093('0x40')][_0x8093('0x67')]({'where':{'id':_0x940703[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x326822,null))[_0x8093('0x22')](function(_0x1cc51b){if(_0x1cc51b){return _0x1cc51b[_0x8093('0xc0')](_0x940703['body'][_0x8093('0x75')],_['omit'](_0x940703[_0x8093('0x5f')],[_0x8093('0x75'),'id'])||{})[_0x8093('0xc1')](function(_0x5ec121){for(var _0xfefeb8=0x0;_0xfefeb8<_0x940703[_0x8093('0x5f')][_0x8093('0x75')]['length'];_0xfefeb8+=0x1){socket[_0x8093('0xc2')](_0x8093('0xc3'),{'UserId':Number(_0x940703['body']['ids'][_0xfefeb8]),'FaxAccountId':Number(_0x940703[_0x8093('0x5c')]['id'])});}return _0x5ec121;});}})[_0x8093('0x22')](respondWithResult(_0x326822,null))[_0x8093('0x2c')](handleError(_0x326822,null));};exports[_0x8093('0xc4')]=function(_0x3feea5,_0x535ce7,_0x50b858){return db['FaxAccount']['find']({'where':{'id':_0x3feea5['params']['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x535ce7,null))[_0x8093('0x22')](function(_0x38e5e9){if(_0x38e5e9){return _0x38e5e9[_0x8093('0xc4')](_0x3feea5['query'][_0x8093('0x75')])[_0x8093('0x22')](function(){if(_[_0x8093('0xc5')](_0x3feea5[_0x8093('0x47')][_0x8093('0x75')])){for(var _0x552720=0x0;_0x552720<_0x3feea5['query']['ids'][_0x8093('0x4c')];_0x552720+=0x1){socket[_0x8093('0xc2')](_0x8093('0xc6'),{'UserId':Number(_0x3feea5['query'][_0x8093('0x75')][_0x552720]),'FaxAccountId':Number(_0x3feea5[_0x8093('0x5c')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3feea5['query'][_0x8093('0x75')]),'FaxAccountId':Number(_0x3feea5[_0x8093('0x5c')]['id'])});}});}})[_0x8093('0x22')](respondWithStatusCode(_0x535ce7,null))[_0x8093('0x2c')](handleError(_0x535ce7,null));};exports['getAgents']=function(_0x10e68e,_0x46db08,_0x411453){var _0x404fe3={};var _0x5a516d={};var _0x468c22;var _0x18d16d;return db[_0x8093('0x40')][_0x8093('0x6d')]({'where':{'id':_0x10e68e[_0x8093('0x5c')]['id']}})[_0x8093('0x22')](handleEntityNotFound(_0x46db08,null))['then'](function(_0x2e5d06){if(_0x2e5d06){_0x468c22=_0x2e5d06;_0x5a516d[_0x8093('0x45')]=_[_0x8093('0x46')](db['User']['rawAttributes']);_0x5a516d[_0x8093('0x47')]=_[_0x8093('0x46')](_0x10e68e[_0x8093('0x47')]);_0x5a516d[_0x8093('0x48')]=_[_0x8093('0x4a')](_0x5a516d[_0x8093('0x45')],_0x5a516d[_0x8093('0x47')]);_0x404fe3[_0x8093('0x49')]=_['intersection'](_0x5a516d[_0x8093('0x45')],qs[_0x8093('0x4b')](_0x10e68e[_0x8093('0x47')][_0x8093('0x4b')]));_0x404fe3[_0x8093('0x49')]=_0x404fe3[_0x8093('0x49')]['length']?_0x404fe3[_0x8093('0x49')]:_0x5a516d['model'];_0x404fe3[_0x8093('0x4f')]=qs[_0x8093('0x50')](_0x10e68e['query'][_0x8093('0x50')]);_0x404fe3[_0x8093('0x51')]=qs['filters'](_[_0x8093('0x52')](_0x10e68e['query'],_0x5a516d[_0x8093('0x48')]));if(_0x10e68e[_0x8093('0x47')][_0x8093('0x53')]){_0x404fe3[_0x8093('0x51')]=_['merge'](_0x404fe3[_0x8093('0x51')],{'$or':_['map'](_0x404fe3[_0x8093('0x49')],function(_0x1152c8){var _0x261b02={};_0x261b02[_0x1152c8]={'$like':'%'+_0x10e68e[_0x8093('0x47')][_0x8093('0x53')]+'%'};return _0x261b02;})});}_0x404fe3=_[_0x8093('0x6e')]({},_0x404fe3,_0x10e68e['options']);return _0x468c22[_0x8093('0xc7')](_0x404fe3);}})[_0x8093('0x22')](function(_0x263bb1){if(_0x263bb1){_0x18d16d=_0x263bb1[_0x8093('0x4c')];if(!_0x10e68e[_0x8093('0x47')]['hasOwnProperty'](_0x8093('0x4e'))){_0x404fe3[_0x8093('0x32')]=qs[_0x8093('0x32')](_0x10e68e[_0x8093('0x47')][_0x8093('0x32')]);_0x404fe3[_0x8093('0x30')]=qs[_0x8093('0x30')](_0x10e68e[_0x8093('0x47')][_0x8093('0x30')]);}return _0x468c22['getAgents'](_0x404fe3);}})[_0x8093('0x22')](function(_0x17ed55){if(_0x17ed55){return _0x17ed55?{'count':_0x18d16d,'rows':_0x17ed55}:null;}})[_0x8093('0x22')](respondWithResult(_0x46db08,null))[_0x8093('0x2c')](handleError(_0x46db08,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b5d1611..91d1932 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 _0xbd65=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x11b4fb,_0x10c784){var _0x56cbb5=function(_0x56d812){while(--_0x56d812){_0x11b4fb['push'](_0x11b4fb['shift']());}};_0x56cbb5(++_0x10c784);}(_0xbd65,0x102));var _0x5bd6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xbd65[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x5bd6('0x0'));var FaxAccount=require(_0x5bd6('0x1'))['db'][_0x5bd6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5bd6('0x3')](0x0);var events={'afterCreate':_0x5bd6('0x4'),'afterUpdate':_0x5bd6('0x5'),'afterDestroy':_0x5bd6('0x6')};function emitEvent(_0x162a6e){return function(_0x93918f,_0x1c297d,_0x36c2ea){FaxAccountEvents[_0x5bd6('0x7')](_0x162a6e+':'+_0x93918f['id'],_0x93918f);FaxAccountEvents[_0x5bd6('0x7')](_0x162a6e,_0x93918f);_0x36c2ea(null);};}for(var e in events){if(events[_0x5bd6('0x8')](e)){var event=events[e];FaxAccount[_0x5bd6('0x9')](e,emitEvent(event));}}module[_0x5bd6('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0xc19a=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc19a,0x7f));var _0xac19=function(_0x2530ae,_0x288e6e){_0x2530ae=_0x2530ae-0x0;var _0x2f03b7=_0xc19a[_0x2530ae];return _0x2f03b7;};'use strict';var EventEmitter=require(_0xac19('0x0'));var FaxAccount=require(_0xac19('0x1'))['db'][_0xac19('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xac19('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac19('0x4'),'afterDestroy':_0xac19('0x5')};function emitEvent(_0x3f98b8){return function(_0x487612,_0x1b7e6f,_0xae11e9){FaxAccountEvents['emit'](_0x3f98b8+':'+_0x487612['id'],_0x487612);FaxAccountEvents[_0xac19('0x6')](_0x3f98b8,_0x487612);_0xae11e9(null);};}for(var e in events){if(events[_0xac19('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xac19('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c9977f9..f80e114 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 _0x6c1c=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','util','../../config/logger','moment'];(function(_0x4b652c,_0xdf9e7c){var _0x23f319=function(_0x169341){while(--_0x169341){_0x4b652c['push'](_0x4b652c['shift']());}};_0x23f319(++_0xdf9e7c);}(_0x6c1c,0xac));var _0xc6c1=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6c1c[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0xc6c1('0x0'));var util=require(_0xc6c1('0x1'));var logger=require(_0xc6c1('0x2'))('api');var moment=require(_0xc6c1('0x3'));var BPromise=require('bluebird');var rp=require(_0xc6c1('0x4'));var fs=require('fs');var path=require(_0xc6c1('0x5'));var rimraf=require(_0xc6c1('0x6'));var config=require(_0xc6c1('0x7'));var attributes=require(_0xc6c1('0x8'));module[_0xc6c1('0x9')]=function(_0x455080,_0x361a43){return _0x455080['define']('FaxAccount',attributes,{'tableName':_0xc6c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb20=['FaxAccount','fax_accounts','../../config/logger','api','moment','request-promise','../../config/environment','./faxAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb20,0x161));var _0x0bb2=function(_0x4b19a5,_0x1d6119){_0x4b19a5=_0x4b19a5-0x0;var _0x2e663d=_0xbb20[_0x4b19a5];return _0x2e663d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bb2('0x0'))(_0x0bb2('0x1'));var moment=require(_0x0bb2('0x2'));var BPromise=require('bluebird');var rp=require(_0x0bb2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0bb2('0x4'));var attributes=require(_0x0bb2('0x5'));module[_0x0bb2('0x6')]=function(_0x12577e,_0x25654f){return _0x12577e['define'](_0x0bb2('0x7'),attributes,{'tableName':_0x0bb2('0x8'),'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 0171c7b..22c0c89 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 _0xf3a8=['defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxAccount,\x20%s,\x20%s','catch','FaxAccount','findAll','options','raw','attributes','include','map','model','info','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','List','Applications','list','applications','orderBy','priority','asc','account','Contacts','length','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','unshift','agent','queueId','FaxQueue','name','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x315607,_0x51f930){var _0x250340=function(_0x3ebca9){while(--_0x3ebca9){_0x315607['push'](_0x315607['shift']());}};_0x250340(++_0x51f930);}(_0xf3a8,0xa4));var _0x8f3a=function(_0x28bbb6,_0x1bf830){_0x28bbb6=_0x28bbb6-0x0;var _0x9574=_0xf3a8[_0x28bbb6];return _0x9574;};'use strict';var _=require(_0x8f3a('0x0'));var util=require(_0x8f3a('0x1'));var moment=require(_0x8f3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f3a('0x3'));var fs=require('fs');var Redis=require(_0x8f3a('0x4'));var db=require(_0x8f3a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f3a('0x6'))(_0x8f3a('0x7'));var config=require(_0x8f3a('0x8'));var jayson=require(_0x8f3a('0x9'));var client=jayson[_0x8f3a('0xa')]['http']({'port':0x232c});config[_0x8f3a('0xb')]=_[_0x8f3a('0xc')](config[_0x8f3a('0xb')],{'host':_0x8f3a('0xd'),'port':0x18eb});var socket=require(_0x8f3a('0xe'))(new Redis(config[_0x8f3a('0xb')]));require(_0x8f3a('0xf'))['register'](socket);function respondWithRpcPromise(_0xf30294,_0x40d85b,_0x1fc77c){return new BPromise(function(_0x4d75d2,_0x25c8ce){return client[_0x8f3a('0x10')](_0xf30294,_0x1fc77c)[_0x8f3a('0x11')](function(_0x58ed6c){logger['info']('FaxAccount,\x20%s,\x20%s',_0x40d85b,'request\x20sent');logger['debug'](_0x8f3a('0x12'),_0x40d85b,_0x8f3a('0x13'),JSON['stringify'](_0x58ed6c));if(_0x58ed6c[_0x8f3a('0x14')]){if(_0x58ed6c[_0x8f3a('0x14')][_0x8f3a('0x15')]===0x1f4){logger[_0x8f3a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x40d85b,_0x58ed6c[_0x8f3a('0x14')][_0x8f3a('0x16')]);return _0x25c8ce(_0x58ed6c[_0x8f3a('0x14')]['message']);}logger[_0x8f3a('0x14')](_0x8f3a('0x17'),_0x40d85b,_0x58ed6c[_0x8f3a('0x14')][_0x8f3a('0x16')]);return _0x4d75d2(_0x58ed6c[_0x8f3a('0x14')][_0x8f3a('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x40d85b,_0x8f3a('0x13'));_0x4d75d2(_0x58ed6c['result']['message']);}})[_0x8f3a('0x18')](function(_0x3b2c13){logger[_0x8f3a('0x14')](_0x8f3a('0x17'),_0x40d85b,_0x3b2c13);_0x25c8ce(_0x3b2c13);});});}exports['GetFaxAccount']=function(_0x12e0c5){var _0x5d8827=this;return new Promise(function(_0x5f155c,_0x1f62cd){return db[_0x8f3a('0x19')][_0x8f3a('0x1a')]({'raw':_0x12e0c5[_0x8f3a('0x1b')]?_0x12e0c5[_0x8f3a('0x1b')][_0x8f3a('0x1c')]===undefined?!![]:![]:!![],'where':_0x12e0c5[_0x8f3a('0x1b')]?_0x12e0c5[_0x8f3a('0x1b')]['where']||null:null,'attributes':_0x12e0c5[_0x8f3a('0x1b')]?_0x12e0c5['options'][_0x8f3a('0x1d')]||null:null,'limit':_0x12e0c5['options']?_0x12e0c5['options']['limit']||null:null,'include':_0x12e0c5[_0x8f3a('0x1b')]?_0x12e0c5[_0x8f3a('0x1b')][_0x8f3a('0x1e')]?_[_0x8f3a('0x1f')](_0x12e0c5[_0x8f3a('0x1b')][_0x8f3a('0x1e')],function(_0x5b8c14){return{'model':db[_0x5b8c14[_0x8f3a('0x20')]],'as':_0x5b8c14['as'],'attributes':_0x5b8c14[_0x8f3a('0x1d')],'include':_0x5b8c14['include']?_['map'](_0x5b8c14[_0x8f3a('0x1e')],function(_0x1bcbf4){return{'model':db[_0x1bcbf4[_0x8f3a('0x20')]],'as':_0x1bcbf4['as'],'attributes':_0x1bcbf4[_0x8f3a('0x1d')],'include':_0x1bcbf4[_0x8f3a('0x1e')]?_[_0x8f3a('0x1f')](_0x1bcbf4[_0x8f3a('0x1e')],function(_0x20a928){return{'model':db[_0x20a928[_0x8f3a('0x20')]],'as':_0x20a928['as'],'attributes':_0x20a928[_0x8f3a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8f3a('0x11')](function(_0x383a67){logger[_0x8f3a('0x21')]('GetFaxAccount',_0x12e0c5);logger['debug'](_0x8f3a('0x22'),_0x12e0c5,JSON[_0x8f3a('0x23')](_0x383a67));_0x5f155c(_0x383a67);})[_0x8f3a('0x18')](function(_0x1b6c37){logger['error'](_0x8f3a('0x22'),_0x1b6c37[_0x8f3a('0x16')],_0x12e0c5);_0x1f62cd(_0x5d8827[_0x8f3a('0x14')](0x1f4,_0x1b6c37[_0x8f3a('0x16')]));});});};exports[_0x8f3a('0x24')]=function(_0x4c70c6,_0x3f5438,_0x4240bf){var _0x13741e=this;return new Promise(function(_0x163f5f,_0x5aeedc){var _0x29fb33={'body':_0x4c70c6[_0x8f3a('0x25')],'channel':_0x8f3a('0x26')};var _0x3b4baa=[];var _0x219434=[];var _0xba5f81={};return db[_0x8f3a('0x27')][_0x8f3a('0x28')]()[_0x8f3a('0x11')](function(_0x127063){if(!_0x127063){throw new db[(_0x8f3a('0x29'))][(_0x8f3a('0x2a'))](_0x8f3a('0x2b'));}_0x3b4baa=_['difference'](_[_0x8f3a('0x2c')](_0x127063),[_0x8f3a('0x2d'),_0x8f3a('0x2e')]);_0x219434=_['difference'](_[_0x8f3a('0x2c')](_0x127063),[_0x8f3a('0x2d'),_0x8f3a('0x2e'),_0x8f3a('0x2f'),_0x8f3a('0x30')]);if(_0x4c70c6['body']['id']){delete _0x4c70c6[_0x8f3a('0x25')]['id'];}if(_[_0x8f3a('0x31')](_0x4c70c6[_0x8f3a('0x25')]['from'])){throw new db[(_0x8f3a('0x29'))][(_0x8f3a('0x2a'))](_0x8f3a('0x32'));}if(_['isNil'](_0x4c70c6[_0x8f3a('0x25')][_0x8f3a('0x25')])||_0x4c70c6[_0x8f3a('0x25')][_0x8f3a('0x25')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8f3a('0x31')](_0x4c70c6['body'][_0x8f3a('0x33')])){throw new db[(_0x8f3a('0x29'))][(_0x8f3a('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x219434);}if(!_[_0x8f3a('0x34')](_0x219434,_0x4c70c6[_0x8f3a('0x25')][_0x8f3a('0x33')])){throw new db[(_0x8f3a('0x29'))][(_0x8f3a('0x2a'))](_0x8f3a('0x35')+_0x219434);}_0xba5f81[_0x4c70c6['body'][_0x8f3a('0x33')]]=_0x4c70c6[_0x8f3a('0x25')][_0x8f3a('0x36')];})[_0x8f3a('0x11')](function(){return db[_0x8f3a('0x19')][_0x8f3a('0x37')]({'where':{'id':_0x4c70c6['account']['id']},'include':[{'model':db[_0x8f3a('0x38')],'as':'List','include':[{'model':db[_0x8f3a('0x27')],'as':'Contacts','where':_0xba5f81,'limit':0x1,'order':[[_0x8f3a('0x2e'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x8f3a('0x11')](function(_0x5a83c2){if(_0x5a83c2&&_0x5a83c2[_0x8f3a('0x39')]){var _0x266f49=_0x5a83c2['get']({'plain':!![]});_0x29fb33['account']=_0x266f49;_0x29fb33['applications']=_0x266f49[_0x8f3a('0x3a')];_0x29fb33[_0x8f3a('0x3b')]=_0x266f49[_0x8f3a('0x39')];_0x29fb33[_0x8f3a('0x3c')]=_[_0x8f3a('0x3d')](_0x29fb33[_0x8f3a('0x3c')],[_0x8f3a('0x3e')],[_0x8f3a('0x3f')]);if(_0x29fb33[_0x8f3a('0x40')][_0x8f3a('0x3a')]){delete _0x29fb33[_0x8f3a('0x40')][_0x8f3a('0x3a')];}if(_0x29fb33[_0x8f3a('0x40')][_0x8f3a('0x39')]&&_0x29fb33[_0x8f3a('0x40')]['List'][_0x8f3a('0x41')][_0x8f3a('0x42')]){return _0x29fb33[_0x8f3a('0x40')]['List'][_0x8f3a('0x41')][0x0];}var _0x1d25aa=_[_0x8f3a('0xc')](_0x4c70c6[_0x8f3a('0x25')],{'firstName':_0x4c70c6[_0x8f3a('0x25')]['from'],'ListId':_0x266f49[_0x8f3a('0x30')]});_0x1d25aa[_0x4c70c6['body']['mapKey']]=_0x4c70c6[_0x8f3a('0x25')][_0x8f3a('0x36')];return db['CmContact']['create'](_0x1d25aa,{'fields':_0x3b4baa,'raw':!![]});}})[_0x8f3a('0x11')](function(_0x5ab16d){_0x29fb33[_0x8f3a('0x43')]=_0x5ab16d;if(_0x5ab16d){var _0x1eedae={'ContactId':_0x5ab16d['id'],'FaxAccountId':_0x4c70c6[_0x8f3a('0x40')]['id'],'fax':_0x5ab16d['fax']};return db['FaxInteraction'][_0x8f3a('0x37')]({'where':{'ContactId':_0x5ab16d['id'],'closed':![],'FaxAccountId':_0x4c70c6[_0x8f3a('0x40')]['id']}})[_0x8f3a('0x11')](function(_0xa88510){if(_0xa88510){return[_0xa88510,![]];}return db[_0x8f3a('0x44')]['create'](_0x1eedae)[_0x8f3a('0x11')](function(_0x22d6ee){return[_0x22d6ee,!![]];});});}else{throw new Error(_0x8f3a('0x45'));}})[_0x8f3a('0x46')](function(_0x3f1995,_0x1897ff){var _0x3b5a8d=_0x3f1995[_0x8f3a('0x47')]({'plain':!![]});if(_0x1897ff){if(_0x29fb33[_0x8f3a('0x40')][_0x8f3a('0x48')]){_0x29fb33[_0x8f3a('0x3c')][_0x8f3a('0x49')]({'id':0x0,'priority':_0x29fb33[_0x8f3a('0x3c')]['length']+0x1,'app':'close','appdata':_0x8f3a('0x4a'),'interval':_0x8f3a('0x4b')});}_0x3b5a8d[_0x8f3a('0x4c')]=!![];}else{_0x3b5a8d[_0x8f3a('0x4c')]=![];}_0x29fb33['interaction']=_0x3b5a8d;return db[_0x8f3a('0x4d')]['create']({'body':_0x4c70c6['body'][_0x8f3a('0x25')],'FaxAccountId':_0x4c70c6['account']['id'],'FaxInteractionId':_0x3f1995['id'],'direction':'in','ContactId':_0x3f1995[_0x8f3a('0x4e')],'AttachmentId':_0x4c70c6[_0x8f3a('0x25')]['AttachmentId']});})['then'](function(_0x29f11a){_0x29fb33[_0x8f3a('0x16')]=_0x29f11a;if(!_0x29fb33[_0x8f3a('0x4f')][_0x8f3a('0x50')])return;return db[_0x8f3a('0x51')][_0x8f3a('0x37')]({'attributes':['id','name'],'where':{'id':_0x29fb33[_0x8f3a('0x4f')]['UserId']}});})[_0x8f3a('0x11')](function(_0x4d723f){if(_0x4d723f){_0x29fb33[_0x8f3a('0x3c')][_0x8f3a('0x52')]({'id':0x0,'priority':0x0,'app':_0x8f3a('0x53'),'appdata':_0x4d723f['name']+','+(_0x29fb33['account']['waitForTheAssignedAgent']||0xa),'interval':_0x8f3a('0x4b')});}if(!_0x29fb33['interaction'][_0x8f3a('0x54')])return;return db[_0x8f3a('0x55')][_0x8f3a('0x37')]({'attributes':['id',_0x8f3a('0x56')],'where':{'id':_0x29fb33[_0x8f3a('0x4f')][_0x8f3a('0x54')]}});})['then'](function(_0x2cfbfa){if(_0x2cfbfa){_0x29fb33[_0x8f3a('0x3c')][_0x8f3a('0x52')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2cfbfa[_0x8f3a('0x56')]+','+(_0x29fb33[_0x8f3a('0x40')]['waitForTheAssignedQueue']||0x12c),'interval':_0x8f3a('0x4b')});}return respondWithRpcPromise('Start',_0x8f3a('0x57'),_0x29fb33);})[_0x8f3a('0x11')](function(_0x45e44f){_0x163f5f(_0x45e44f);})[_0x8f3a('0x18')](function(_0x4af324){_0x5aeedc(_0x13741e[_0x8f3a('0x14')](0x1f4,_0x4af324[_0x8f3a('0x16')]));});});}; \ No newline at end of file +var _0x277c=['*,*,*,*','queueId','FaxQueue','waitForTheAssignedQueue','Start','startRouting','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','findAll','options','where','limit','map','include','model','attributes','GetFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','defaults','create','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x277c,0x11a));var _0xc277=function(_0x580d98,_0x2c71ac){_0x580d98=_0x580d98-0x0;var _0x4d5579=_0x277c[_0x580d98];return _0x4d5579;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc277('0x0'));var BPromise=require('bluebird');var rs=require(_0xc277('0x1'));var fs=require('fs');var Redis=require(_0xc277('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc277('0x3'))(_0xc277('0x4'));var config=require(_0xc277('0x5'));var jayson=require(_0xc277('0x6'));var client=jayson[_0xc277('0x7')][_0xc277('0x8')]({'port':0x232c});config['redis']=_['defaults'](config[_0xc277('0x9')],{'host':_0xc277('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc277('0x9')]));require(_0xc277('0xb'))['register'](socket);function respondWithRpcPromise(_0x1732d1,_0x8dba9f,_0x212ef8){return new BPromise(function(_0x35d133,_0x12a713){return client[_0xc277('0xc')](_0x1732d1,_0x212ef8)[_0xc277('0xd')](function(_0x34f8f7){logger[_0xc277('0xe')]('FaxAccount,\x20%s,\x20%s',_0x8dba9f,_0xc277('0xf'));logger[_0xc277('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x8dba9f,'request\x20sent',JSON[_0xc277('0x11')](_0x34f8f7));if(_0x34f8f7[_0xc277('0x12')]){if(_0x34f8f7[_0xc277('0x12')][_0xc277('0x13')]===0x1f4){logger[_0xc277('0x12')](_0xc277('0x14'),_0x8dba9f,_0x34f8f7[_0xc277('0x12')][_0xc277('0x15')]);return _0x12a713(_0x34f8f7[_0xc277('0x12')]['message']);}logger[_0xc277('0x12')]('FaxAccount,\x20%s,\x20%s',_0x8dba9f,_0x34f8f7[_0xc277('0x12')][_0xc277('0x15')]);return _0x35d133(_0x34f8f7[_0xc277('0x12')][_0xc277('0x15')]);}else{logger[_0xc277('0xe')](_0xc277('0x14'),_0x8dba9f,'request\x20sent');_0x35d133(_0x34f8f7[_0xc277('0x16')][_0xc277('0x15')]);}})[_0xc277('0x17')](function(_0x19e339){logger[_0xc277('0x12')]('FaxAccount,\x20%s,\x20%s',_0x8dba9f,_0x19e339);_0x12a713(_0x19e339);});});}exports['GetFaxAccount']=function(_0x2ff2d5){var _0x1b12a6=this;return new Promise(function(_0x4d4509,_0x526812){return db['FaxAccount'][_0xc277('0x18')]({'raw':_0x2ff2d5[_0xc277('0x19')]?_0x2ff2d5[_0xc277('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff2d5[_0xc277('0x19')]?_0x2ff2d5[_0xc277('0x19')][_0xc277('0x1a')]||null:null,'attributes':_0x2ff2d5[_0xc277('0x19')]?_0x2ff2d5['options']['attributes']||null:null,'limit':_0x2ff2d5[_0xc277('0x19')]?_0x2ff2d5[_0xc277('0x19')][_0xc277('0x1b')]||null:null,'include':_0x2ff2d5[_0xc277('0x19')]?_0x2ff2d5['options']['include']?_[_0xc277('0x1c')](_0x2ff2d5['options'][_0xc277('0x1d')],function(_0x8b87c5){return{'model':db[_0x8b87c5[_0xc277('0x1e')]],'as':_0x8b87c5['as'],'attributes':_0x8b87c5[_0xc277('0x1f')],'include':_0x8b87c5[_0xc277('0x1d')]?_[_0xc277('0x1c')](_0x8b87c5[_0xc277('0x1d')],function(_0x2f9e5a){return{'model':db[_0x2f9e5a['model']],'as':_0x2f9e5a['as'],'attributes':_0x2f9e5a[_0xc277('0x1f')],'include':_0x2f9e5a['include']?_[_0xc277('0x1c')](_0x2f9e5a[_0xc277('0x1d')],function(_0x27ff0c){return{'model':db[_0x27ff0c[_0xc277('0x1e')]],'as':_0x27ff0c['as'],'attributes':_0x27ff0c[_0xc277('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc277('0xd')](function(_0x48c619){logger[_0xc277('0xe')](_0xc277('0x20'),_0x2ff2d5);logger[_0xc277('0x10')](_0xc277('0x20'),_0x2ff2d5,JSON[_0xc277('0x11')](_0x48c619));_0x4d4509(_0x48c619);})[_0xc277('0x17')](function(_0x37b81e){logger['error'](_0xc277('0x20'),_0x37b81e[_0xc277('0x15')],_0x2ff2d5);_0x526812(_0x1b12a6['error'](0x1f4,_0x37b81e[_0xc277('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x3e2650,_0x23f178,_0x162f7d){var _0x269b9f=this;return new Promise(function(_0x41cb9e,_0x201a29){var _0x50f73c={'body':_0x3e2650['body'],'channel':'fax'};var _0x440325=[];var _0xfd2310=[];var _0x5aece8={};return db[_0xc277('0x21')][_0xc277('0x22')]()[_0xc277('0xd')](function(_0x2fdadb){if(!_0x2fdadb){throw new db[(_0xc277('0x23'))][(_0xc277('0x24'))](_0xc277('0x25'));}_0x440325=_['difference'](_[_0xc277('0x26')](_0x2fdadb),[_0xc277('0x27'),_0xc277('0x28')]);_0xfd2310=_[_0xc277('0x29')](_[_0xc277('0x26')](_0x2fdadb),[_0xc277('0x27'),'updatedAt',_0xc277('0x2a'),_0xc277('0x2b')]);if(_0x3e2650[_0xc277('0x2c')]['id']){delete _0x3e2650[_0xc277('0x2c')]['id'];}if(_[_0xc277('0x2d')](_0x3e2650['body']['from'])){throw new db['Sequelize'][(_0xc277('0x24'))](_0xc277('0x2e'));}if(_[_0xc277('0x2d')](_0x3e2650[_0xc277('0x2c')]['body'])||_0x3e2650[_0xc277('0x2c')][_0xc277('0x2c')]===''){throw new db['Sequelize'][(_0xc277('0x24'))](_0xc277('0x2f'));}if(_[_0xc277('0x2d')](_0x3e2650[_0xc277('0x2c')][_0xc277('0x30')])){throw new db[(_0xc277('0x23'))][(_0xc277('0x24'))](_0xc277('0x31')+_0xfd2310);}if(!_[_0xc277('0x32')](_0xfd2310,_0x3e2650[_0xc277('0x2c')][_0xc277('0x30')])){throw new db[(_0xc277('0x23'))][(_0xc277('0x24'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfd2310);}_0x5aece8[_0x3e2650[_0xc277('0x2c')]['mapKey']]=_0x3e2650[_0xc277('0x2c')][_0xc277('0x33')];})[_0xc277('0xd')](function(){return db[_0xc277('0x34')][_0xc277('0x35')]({'where':{'id':_0x3e2650[_0xc277('0x36')]['id']},'include':[{'model':db[_0xc277('0x37')],'as':_0xc277('0x38'),'include':[{'model':db[_0xc277('0x21')],'as':_0xc277('0x39'),'where':_0x5aece8,'limit':0x1,'order':[[_0xc277('0x28'),_0xc277('0x3a')]]}]},{'model':db[_0xc277('0x3b')],'as':_0xc277('0x3c')}]});})[_0xc277('0xd')](function(_0x4db7f3){if(_0x4db7f3&&_0x4db7f3['List']){var _0x229dea=_0x4db7f3['get']({'plain':!![]});_0x50f73c['account']=_0x229dea;_0x50f73c[_0xc277('0x3d')]=_0x229dea['Applications'];_0x50f73c[_0xc277('0x3e')]=_0x229dea['List'];_0x50f73c[_0xc277('0x3d')]=_[_0xc277('0x3f')](_0x50f73c[_0xc277('0x3d')],[_0xc277('0x40')],[_0xc277('0x41')]);if(_0x50f73c['account'][_0xc277('0x3c')]){delete _0x50f73c['account']['Applications'];}if(_0x50f73c[_0xc277('0x36')][_0xc277('0x38')]&&_0x50f73c[_0xc277('0x36')][_0xc277('0x38')][_0xc277('0x39')][_0xc277('0x42')]){return _0x50f73c[_0xc277('0x36')][_0xc277('0x38')][_0xc277('0x39')][0x0];}var _0x4fcad4=_[_0xc277('0x43')](_0x3e2650['body'],{'firstName':_0x3e2650[_0xc277('0x2c')][_0xc277('0x33')],'ListId':_0x229dea[_0xc277('0x2b')]});_0x4fcad4[_0x3e2650[_0xc277('0x2c')][_0xc277('0x30')]]=_0x3e2650['body'][_0xc277('0x33')];return db[_0xc277('0x21')][_0xc277('0x44')](_0x4fcad4,{'fields':_0x440325,'raw':!![]});}})[_0xc277('0xd')](function(_0x11a83a){_0x50f73c['contact']=_0x11a83a;if(_0x11a83a){var _0xc703bc={'ContactId':_0x11a83a['id'],'FaxAccountId':_0x3e2650[_0xc277('0x36')]['id'],'fax':_0x11a83a[_0xc277('0x45')]};return db['FaxInteraction'][_0xc277('0x35')]({'where':{'ContactId':_0x11a83a['id'],'closed':![],'FaxAccountId':_0x3e2650['account']['id']}})[_0xc277('0xd')](function(_0x33aed7){if(_0x33aed7){return[_0x33aed7,![]];}return db[_0xc277('0x46')]['create'](_0xc703bc)[_0xc277('0xd')](function(_0x47744e){return[_0x47744e,!![]];});});}else{throw new Error(_0xc277('0x47'));}})[_0xc277('0x48')](function(_0x2f5ce4,_0x33a47e){var _0x348cd6=_0x2f5ce4[_0xc277('0x49')]({'plain':!![]});if(_0x33a47e){if(_0x50f73c[_0xc277('0x36')][_0xc277('0x4a')]){_0x50f73c[_0xc277('0x3d')][_0xc277('0x4b')]({'id':0x0,'priority':_0x50f73c[_0xc277('0x3d')][_0xc277('0x42')]+0x1,'app':'close','appdata':_0xc277('0x4c'),'interval':'*,*,*,*'});}_0x348cd6[_0xc277('0x4d')]=!![];}else{_0x348cd6[_0xc277('0x4d')]=![];}_0x50f73c[_0xc277('0x4e')]=_0x348cd6;return db[_0xc277('0x4f')][_0xc277('0x44')]({'body':_0x3e2650[_0xc277('0x2c')][_0xc277('0x2c')],'FaxAccountId':_0x3e2650[_0xc277('0x36')]['id'],'FaxInteractionId':_0x2f5ce4['id'],'direction':'in','ContactId':_0x2f5ce4['ContactId'],'AttachmentId':_0x3e2650[_0xc277('0x2c')][_0xc277('0x50')]});})['then'](function(_0x9a8c4f){_0x50f73c[_0xc277('0x15')]=_0x9a8c4f;if(!_0x50f73c[_0xc277('0x4e')][_0xc277('0x51')])return;return db['User'][_0xc277('0x35')]({'attributes':['id',_0xc277('0x52')],'where':{'id':_0x50f73c[_0xc277('0x4e')][_0xc277('0x51')]}});})['then'](function(_0x238254){if(_0x238254){_0x50f73c[_0xc277('0x3d')][_0xc277('0x53')]({'id':0x0,'priority':0x0,'app':_0xc277('0x54'),'appdata':_0x238254[_0xc277('0x52')]+','+(_0x50f73c['account'][_0xc277('0x55')]||0xa),'interval':_0xc277('0x56')});}if(!_0x50f73c[_0xc277('0x4e')][_0xc277('0x57')])return;return db[_0xc277('0x58')][_0xc277('0x35')]({'attributes':['id',_0xc277('0x52')],'where':{'id':_0x50f73c[_0xc277('0x4e')][_0xc277('0x57')]}});})[_0xc277('0xd')](function(_0x27de6d){if(_0x27de6d){_0x50f73c[_0xc277('0x3d')][_0xc277('0x53')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x27de6d[_0xc277('0x52')]+','+(_0x50f73c[_0xc277('0x36')][_0xc277('0x59')]||0x12c),'interval':_0xc277('0x56')});}return respondWithRpcPromise(_0xc277('0x5a'),_0xc277('0x5b'),_0x50f73c);})['then'](function(_0xe051d6){_0x41cb9e(_0xe051d6);})['catch'](function(_0xf1067c){_0x201a29(_0x269b9f[_0xc277('0x12')](0x1f4,_0xf1067c[_0xc277('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b380de0..f274250 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 _0x1a4e=['register','length','faxAccount:','./faxAccount.events','remove','emit','removeListener'];(function(_0x174592,_0x2448e3){var _0x22f2ab=function(_0xde7f0f){while(--_0xde7f0f){_0x174592['push'](_0x174592['shift']());}};_0x22f2ab(++_0x2448e3);}(_0x1a4e,0xd5));var _0xe1a4=function(_0x4b2412,_0x5de7f7){_0x4b2412=_0x4b2412-0x0;var _0x2db47d=_0x1a4e[_0x4b2412];return _0x2db47d;};'use strict';var FaxAccountEvents=require(_0xe1a4('0x0'));var events=['save',_0xe1a4('0x1'),'update'];function createListener(_0xbdb4cf,_0x5036c5){return function(_0x278908){_0x5036c5[_0xe1a4('0x2')](_0xbdb4cf,_0x278908);};}function removeListener(_0x42bfe7,_0x5820c6){return function(){FaxAccountEvents[_0xe1a4('0x3')](_0x42bfe7,_0x5820c6);};}exports[_0xe1a4('0x4')]=function(_0x47136c){for(var _0x530236=0x0,_0x2c9657=events[_0xe1a4('0x5')];_0x530236<_0x2c9657;_0x530236++){var _0x24010e=events[_0x530236];var _0x3940bb=createListener(_0xe1a4('0x6')+_0x24010e,_0x47136c);FaxAccountEvents['on'](_0x24010e,_0x3940bb);}}; \ No newline at end of file +var _0x9b0a=['save','remove','update','emit','removeListener','register','length'];(function(_0xdb5508,_0x556083){var _0xed9500=function(_0x4ef13c){while(--_0x4ef13c){_0xdb5508['push'](_0xdb5508['shift']());}};_0xed9500(++_0x556083);}(_0x9b0a,0x134));var _0xa9b0=function(_0x5ac15e,_0x4af04b){_0x5ac15e=_0x5ac15e-0x0;var _0x2130de=_0x9b0a[_0x5ac15e];return _0x2130de;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xa9b0('0x0'),_0xa9b0('0x1'),_0xa9b0('0x2')];function createListener(_0x457a9e,_0x299933){return function(_0x2bf47c){_0x299933[_0xa9b0('0x3')](_0x457a9e,_0x2bf47c);};}function removeListener(_0x287d70,_0xd8f9a5){return function(){FaxAccountEvents[_0xa9b0('0x4')](_0x287d70,_0xd8f9a5);};}exports[_0xa9b0('0x5')]=function(_0x24c32d){for(var _0x59a668=0x0,_0x14c9f6=events[_0xa9b0('0x6')];_0x59a668<_0x14c9f6;_0x59a668++){var _0x16d14a=events[_0x59a668];var _0x276e08=createListener('faxAccount:'+_0x16d14a,_0x24c32d);FaxAccountEvents['on'](_0x16d14a,_0x276e08);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a26e206..1984102 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 _0xb245=['/:id/canned_answers','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/users','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions'];(function(_0x1227c3,_0x37615e){var _0x27943a=function(_0x2d6c1f){while(--_0x2d6c1f){_0x1227c3['push'](_0x1227c3['shift']());}};_0x27943a(++_0x37615e);}(_0xb245,0x6d));var _0x5b24=function(_0x4bc32a,_0x4b8114){_0x4bc32a=_0x4bc32a-0x0;var _0x5c902c=_0xb245[_0x4bc32a];return _0x5c902c;};'use strict';var multer=require(_0x5b24('0x0'));var util=require(_0x5b24('0x1'));var path=require(_0x5b24('0x2'));var timeout=require(_0x5b24('0x3'));var express=require(_0x5b24('0x4'));var router=express[_0x5b24('0x5')]();var fs_extra=require(_0x5b24('0x6'));var auth=require(_0x5b24('0x7'));var interaction=require(_0x5b24('0x8'));var config=require('../../config/environment');var controller=require(_0x5b24('0x9'));router[_0x5b24('0xa')]('/',auth[_0x5b24('0xb')](),controller[_0x5b24('0xc')]);router['get'](_0x5b24('0xd'),auth[_0x5b24('0xb')](),controller['describe']);router[_0x5b24('0xa')](_0x5b24('0xe'),auth[_0x5b24('0xb')](),controller[_0x5b24('0xf')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5b24('0x10')]);router[_0x5b24('0xa')](_0x5b24('0x11'),auth[_0x5b24('0xb')](),controller['getAnswers']);router[_0x5b24('0xa')](_0x5b24('0x12'),auth['isAuthenticated'](),controller[_0x5b24('0x13')]);router['get']('/:id/applications',auth[_0x5b24('0xb')](),controller[_0x5b24('0x14')]);router[_0x5b24('0xa')](_0x5b24('0x15'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x5b24('0x16'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x5b24('0xb')](),controller[_0x5b24('0x17')]);router[_0x5b24('0x18')](_0x5b24('0x19'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x1a')]);router['post'](_0x5b24('0x11'),auth['isAuthenticated'](),controller[_0x5b24('0x1b')]);router['post'](_0x5b24('0x12'),auth[_0x5b24('0xb')](),controller['addInteraction']);router['post'](_0x5b24('0x1c'),auth['isAuthenticated'](),controller[_0x5b24('0x1d')]);router['post'](_0x5b24('0x1e'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x1f')]);router[_0x5b24('0x18')](_0x5b24('0x20'),auth[_0x5b24('0xb')](),controller['updateAccountApplications']);router[_0x5b24('0x18')](_0x5b24('0x21'),auth[_0x5b24('0xb')](),controller['send']);router[_0x5b24('0x18')](_0x5b24('0x16'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x22')]);router[_0x5b24('0x23')](_0x5b24('0xe'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x24')]);router['delete'](_0x5b24('0xe'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x25')]);router[_0x5b24('0x26')](_0x5b24('0x19'),auth[_0x5b24('0xb')](),controller[_0x5b24('0x27')]);router[_0x5b24('0x26')](_0x5b24('0x11'),auth[_0x5b24('0xb')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x5b24('0xb')](),controller[_0x5b24('0x28')]);module[_0x5b24('0x29')]=router; \ No newline at end of file +var _0xb4ee=['/addaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','create','post','/:id/dispositions','addAnswer','addInteraction','addApplications'];(function(_0x23378e,_0x2d82f5){var _0x42c23d=function(_0x45733b){while(--_0x45733b){_0x23378e['push'](_0x23378e['shift']());}};_0x42c23d(++_0x2d82f5);}(_0xb4ee,0x1da));var _0xeb4e=function(_0x46f34a,_0x533acd){_0x46f34a=_0x46f34a-0x0;var _0xf617fe=_0xb4ee[_0x46f34a];return _0xf617fe;};'use strict';var multer=require(_0xeb4e('0x0'));var util=require(_0xeb4e('0x1'));var path=require('path');var timeout=require(_0xeb4e('0x2'));var express=require(_0xeb4e('0x3'));var router=express[_0xeb4e('0x4')]();var fs_extra=require(_0xeb4e('0x5'));var auth=require(_0xeb4e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb4e('0x7'));var controller=require(_0xeb4e('0x8'));router[_0xeb4e('0x9')]('/',auth[_0xeb4e('0xa')](),controller[_0xeb4e('0xb')]);router[_0xeb4e('0x9')](_0xeb4e('0xc'),auth['isAuthenticated'](),controller[_0xeb4e('0xd')]);router['get'](_0xeb4e('0xe'),auth[_0xeb4e('0xa')](),controller['show']);router[_0xeb4e('0x9')]('/:id/dispositions',auth[_0xeb4e('0xa')](),controller[_0xeb4e('0xf')]);router[_0xeb4e('0x9')](_0xeb4e('0x10'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x11')]);router[_0xeb4e('0x9')](_0xeb4e('0x12'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x13')]);router['get'](_0xeb4e('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0xeb4e('0x9')](_0xeb4e('0x15'),auth['isAuthenticated'](),controller[_0xeb4e('0x16')]);router[_0xeb4e('0x9')]('/:id/users',auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x17')]);router['post']('/',auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x18')]);router[_0xeb4e('0x19')](_0xeb4e('0x1a'),auth[_0xeb4e('0xa')](),controller['addDisposition']);router['post'](_0xeb4e('0x10'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x1b')]);router[_0xeb4e('0x19')](_0xeb4e('0x12'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x1c')]);router[_0xeb4e('0x19')](_0xeb4e('0x14'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x1d')]);router[_0xeb4e('0x19')](_0xeb4e('0x1e'),auth[_0xeb4e('0xa')](),controller['addAccountApplications']);router[_0xeb4e('0x19')]('/updateaccountapplications',auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x1f')]);router[_0xeb4e('0x19')](_0xeb4e('0x20'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x21')]);router['post'](_0xeb4e('0x22'),auth['isAuthenticated'](),controller[_0xeb4e('0x23')]);router[_0xeb4e('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xeb4e('0x25')]);router['delete'](_0xeb4e('0xe'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x26')]);router[_0xeb4e('0x27')]('/:id/dispositions',auth[_0xeb4e('0xa')](),controller['removeDispositions']);router['delete'](_0xeb4e('0x10'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x28')]);router[_0xeb4e('0x27')](_0xeb4e('0x22'),auth[_0xeb4e('0xa')](),controller[_0xeb4e('0x29')]);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 ccbc8c7..d4a89e9 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 _0x977e=['TEXT','INTEGER','STRING','noop'];(function(_0xa76c09,_0x4bb97c){var _0x5edc71=function(_0x1a56ce){while(--_0x1a56ce){_0xa76c09['push'](_0xa76c09['shift']());}};_0x5edc71(++_0x4bb97c);}(_0x977e,0x121));var _0xe977=function(_0x4d2268,_0x1fa847){_0x4d2268=_0x4d2268-0x0;var _0x2c34d0=_0x977e[_0x4d2268];return _0x2c34d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xe977('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xe977('0x1')],'allowNull':![],'defaultValue':_0xe977('0x2')},'appdata':{'type':Sequelize[_0xe977('0x3')]()},'description':{'type':Sequelize[_0xe977('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7a92=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x5da889,_0x21c099){var _0x596b98=function(_0x2969de){while(--_0x2969de){_0x5da889['push'](_0x5da889['shift']());}};_0x596b98(++_0x21c099);}(_0x7a92,0x97));var _0x27a9=function(_0x4bad0e,_0x4e149a){_0x4bad0e=_0x4bad0e-0x0;var _0x520338=_0x7a92[_0x4bad0e];return _0x520338;};'use strict';var Sequelize=require(_0x27a9('0x0'));module[_0x27a9('0x1')]={'priority':{'type':Sequelize[_0x27a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x27a9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x27a9('0x4')]()},'description':{'type':Sequelize[_0x27a9('0x3')]},'interval':{'type':Sequelize[_0x27a9('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f689be9..644e6d6 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 _0xb4b3=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','FaxApplication','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','options','create','body','find','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x211499,_0x4e8b52){var _0x1eb435=function(_0x86b4fa){while(--_0x86b4fa){_0x211499['push'](_0x211499['shift']());}};_0x1eb435(++_0x4e8b52);}(_0xb4b3,0xc8));var _0x3b4b=function(_0x4dda18,_0x393cf6){_0x4dda18=_0x4dda18-0x0;var _0x3ff252=_0xb4b3[_0x4dda18];return _0x3ff252;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b4b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b4b('0x1'));var rp=require(_0x3b4b('0x2'));var moment=require(_0x3b4b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b4b('0x4'));var util=require(_0x3b4b('0x5'));var path=require('path');var sox=require(_0x3b4b('0x6'));var csv=require('to-csv');var ejs=require(_0x3b4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b4b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3b4b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3b4b('0xa'));var Papa=require(_0x3b4b('0xb'));var Redis=require(_0x3b4b('0xc'));var authService=require(_0x3b4b('0xd'));var qs=require(_0x3b4b('0xe'));var as=require(_0x3b4b('0xf'));var hardwareService=require(_0x3b4b('0x10'));var logger=require(_0x3b4b('0x11'))('api');var utils=require(_0x3b4b('0x12'));var config=require(_0x3b4b('0x13'));var licenseUtil=require(_0x3b4b('0x14'));var db=require(_0x3b4b('0x15'))['db'];function respondWithStatusCode(_0x5398fd,_0x2ec0e6){_0x2ec0e6=_0x2ec0e6||0xcc;return function(_0x36eab8){if(_0x36eab8){return _0x5398fd['sendStatus'](_0x2ec0e6);}return _0x5398fd['status'](_0x2ec0e6)[_0x3b4b('0x16')]();};}function respondWithResult(_0x130f95,_0x38e38d){_0x38e38d=_0x38e38d||0xc8;return function(_0x17bc4a){if(_0x17bc4a){return _0x130f95[_0x3b4b('0x17')](_0x38e38d)['json'](_0x17bc4a);}};}function respondWithFilteredResult(_0x5608a5,_0x4f987a){return function(_0x553897){if(_0x553897){var _0x3b736e=typeof _0x4f987a['offset']===_0x3b4b('0x18')&&typeof _0x4f987a[_0x3b4b('0x19')]===_0x3b4b('0x18');var _0x1cff3b=_0x553897[_0x3b4b('0x1a')];var _0x53f07c=_0x3b736e?0x0:_0x4f987a[_0x3b4b('0x1b')];var _0x6064c0=_0x3b736e?_0x553897['count']:_0x4f987a[_0x3b4b('0x1b')]+_0x4f987a[_0x3b4b('0x19')];var _0x308697;if(_0x6064c0>=_0x1cff3b){_0x6064c0=_0x1cff3b;_0x308697=0xc8;}else{_0x308697=0xce;}_0x5608a5[_0x3b4b('0x17')](_0x308697);return _0x5608a5[_0x3b4b('0x1c')](_0x3b4b('0x1d'),_0x53f07c+'-'+_0x6064c0+'/'+_0x1cff3b)[_0x3b4b('0x1e')](_0x553897);}return null;};}function patchUpdates(_0x2c6f2b){return function(_0xfdc011){try{jsonpatch[_0x3b4b('0x1f')](_0xfdc011,_0x2c6f2b,!![]);}catch(_0x1ae0dc){return BPromise[_0x3b4b('0x20')](_0x1ae0dc);}return _0xfdc011[_0x3b4b('0x21')]();};}function saveUpdates(_0x599141,_0x7ca751){return function(_0x421db1){if(_0x421db1){return _0x421db1[_0x3b4b('0x22')](_0x599141)[_0x3b4b('0x23')](function(_0x290a07){return _0x290a07;});}return null;};}function removeEntity(_0x1a1e90,_0x19f2c8){return function(_0x3b9011){if(_0x3b9011){return _0x3b9011[_0x3b4b('0x24')]()[_0x3b4b('0x23')](function(){_0x1a1e90[_0x3b4b('0x17')](0xcc)[_0x3b4b('0x16')]();});}};}function handleEntityNotFound(_0xcd4297,_0x505934){return function(_0x4a00b4){if(!_0x4a00b4){_0xcd4297[_0x3b4b('0x25')](0x194);}return _0x4a00b4;};}function handleError(_0x2121e9,_0x43e419){_0x43e419=_0x43e419||0x1f4;return function(_0x3c5b76){logger[_0x3b4b('0x26')](_0x3c5b76['stack']);if(_0x3c5b76[_0x3b4b('0x27')]){delete _0x3c5b76['name'];}_0x2121e9['status'](_0x43e419)[_0x3b4b('0x28')](_0x3c5b76);};}exports['index']=function(_0x26d3cd,_0x14f680){var _0x3e396e={},_0x5adeed={},_0x1787f9={'count':0x0,'rows':[]};var _0x1d2d80=_[_0x3b4b('0x29')](db[_0x3b4b('0x2a')]['rawAttributes'],function(_0x2f6862){return{'name':_0x2f6862[_0x3b4b('0x2b')],'type':_0x2f6862['type']['key']};});_0x5adeed[_0x3b4b('0x2c')]=_[_0x3b4b('0x29')](_0x1d2d80,_0x3b4b('0x27'));_0x5adeed['query']=_['keys'](_0x26d3cd[_0x3b4b('0x2d')]);_0x5adeed[_0x3b4b('0x2e')]=_[_0x3b4b('0x2f')](_0x5adeed[_0x3b4b('0x2c')],_0x5adeed[_0x3b4b('0x2d')]);_0x3e396e[_0x3b4b('0x30')]=_[_0x3b4b('0x2f')](_0x5adeed[_0x3b4b('0x2c')],qs[_0x3b4b('0x31')](_0x26d3cd['query'][_0x3b4b('0x31')]));_0x3e396e[_0x3b4b('0x30')]=_0x3e396e[_0x3b4b('0x30')][_0x3b4b('0x32')]?_0x3e396e[_0x3b4b('0x30')]:_0x5adeed[_0x3b4b('0x2c')];if(!_0x26d3cd[_0x3b4b('0x2d')][_0x3b4b('0x33')](_0x3b4b('0x34'))){_0x3e396e[_0x3b4b('0x19')]=qs[_0x3b4b('0x19')](_0x26d3cd['query'][_0x3b4b('0x19')]);_0x3e396e[_0x3b4b('0x1b')]=qs[_0x3b4b('0x1b')](_0x26d3cd[_0x3b4b('0x2d')][_0x3b4b('0x1b')]);}_0x3e396e['order']=qs[_0x3b4b('0x35')](_0x26d3cd['query'][_0x3b4b('0x35')]);_0x3e396e[_0x3b4b('0x36')]=qs[_0x3b4b('0x2e')](_['pick'](_0x26d3cd[_0x3b4b('0x2d')],_0x5adeed[_0x3b4b('0x2e')]),_0x1d2d80);if(_0x26d3cd[_0x3b4b('0x2d')][_0x3b4b('0x37')]){_0x3e396e[_0x3b4b('0x36')]=_['merge'](_0x3e396e[_0x3b4b('0x36')],{'$or':_[_0x3b4b('0x29')](_0x1d2d80,function(_0x28c1b7){if(_0x28c1b7[_0x3b4b('0x38')]!==_0x3b4b('0x39')){var _0x1db74f={};_0x1db74f[_0x28c1b7[_0x3b4b('0x27')]]={'$like':'%'+_0x26d3cd[_0x3b4b('0x2d')]['filter']+'%'};return _0x1db74f;}})});}_0x3e396e=_[_0x3b4b('0x3a')]({},_0x3e396e,_0x26d3cd['options']);var _0x162d93={'where':_0x3e396e[_0x3b4b('0x36')]};return db[_0x3b4b('0x2a')][_0x3b4b('0x1a')](_0x162d93)['then'](function(_0x15c451){_0x1787f9[_0x3b4b('0x1a')]=_0x15c451;if(_0x26d3cd[_0x3b4b('0x2d')][_0x3b4b('0x3b')]){_0x3e396e[_0x3b4b('0x3c')]=[{'all':!![]}];}return db[_0x3b4b('0x2a')][_0x3b4b('0x3d')](_0x3e396e);})[_0x3b4b('0x23')](function(_0x4a1331){_0x1787f9[_0x3b4b('0x3e')]=_0x4a1331;return _0x1787f9;})['then'](respondWithFilteredResult(_0x14f680,_0x3e396e))[_0x3b4b('0x3f')](handleError(_0x14f680,null));};exports[_0x3b4b('0x40')]=function(_0x3bd6d4,_0x29a158){var _0x453621={'raw':!![],'where':{'id':_0x3bd6d4['params']['id']}},_0x525a37={};_0x525a37[_0x3b4b('0x2c')]=_[_0x3b4b('0x41')](db[_0x3b4b('0x2a')][_0x3b4b('0x42')]);_0x525a37['query']=_[_0x3b4b('0x41')](_0x3bd6d4[_0x3b4b('0x2d')]);_0x525a37[_0x3b4b('0x2e')]=_[_0x3b4b('0x2f')](_0x525a37[_0x3b4b('0x2c')],_0x525a37['query']);_0x453621[_0x3b4b('0x30')]=_[_0x3b4b('0x2f')](_0x525a37[_0x3b4b('0x2c')],qs['fields'](_0x3bd6d4[_0x3b4b('0x2d')][_0x3b4b('0x31')]));_0x453621['attributes']=_0x453621[_0x3b4b('0x30')][_0x3b4b('0x32')]?_0x453621[_0x3b4b('0x30')]:_0x525a37['model'];if(_0x3bd6d4['query']['includeAll']){_0x453621['include']=[{'all':!![]}];}_0x453621=_['merge']({},_0x453621,_0x3bd6d4[_0x3b4b('0x43')]);return db[_0x3b4b('0x2a')]['find'](_0x453621)[_0x3b4b('0x23')](handleEntityNotFound(_0x29a158,null))['then'](respondWithResult(_0x29a158,null))['catch'](handleError(_0x29a158,null));};exports[_0x3b4b('0x44')]=function(_0x18a2fb,_0x197ef7){return db['FaxApplication'][_0x3b4b('0x44')](_0x18a2fb[_0x3b4b('0x45')],{})[_0x3b4b('0x23')](respondWithResult(_0x197ef7,0xc9))[_0x3b4b('0x3f')](handleError(_0x197ef7,null));};exports[_0x3b4b('0x22')]=function(_0x2275b3,_0x1ef153){if(_0x2275b3[_0x3b4b('0x45')]['id']){delete _0x2275b3[_0x3b4b('0x45')]['id'];}return db['FaxApplication'][_0x3b4b('0x46')]({'where':{'id':_0x2275b3[_0x3b4b('0x47')]['id']}})[_0x3b4b('0x23')](handleEntityNotFound(_0x1ef153,null))[_0x3b4b('0x23')](saveUpdates(_0x2275b3[_0x3b4b('0x45')],null))[_0x3b4b('0x23')](respondWithResult(_0x1ef153,null))['catch'](handleError(_0x1ef153,null));};exports[_0x3b4b('0x24')]=function(_0x4f8d7d,_0x1bbc97){return db['FaxApplication']['find']({'where':{'id':_0x4f8d7d[_0x3b4b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1bbc97,null))[_0x3b4b('0x23')](removeEntity(_0x1bbc97,null))[_0x3b4b('0x3f')](handleError(_0x1bbc97,null));}; \ No newline at end of file +var _0xd3f2=['show','rawAttributes','create','body','find','params','eml-format','rimraf','moment','bluebird','mustache','sox','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','end','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','FaxApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0xd3f2,0x1e2));var _0x2d3f=function(_0x52bb76,_0x325703){_0x52bb76=_0x52bb76-0x0;var _0x2f2f21=_0xd3f2[_0x52bb76];return _0x2f2f21;};'use strict';var emlformat=require(_0x2d3f('0x0'));var rimraf=require(_0x2d3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d3f('0x2'));var BPromise=require(_0x2d3f('0x3'));var Mustache=require(_0x2d3f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2d3f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d3f('0x6'));var _=require(_0x2d3f('0x7'));var squel=require(_0x2d3f('0x8'));var crypto=require(_0x2d3f('0x9'));var jsforce=require(_0x2d3f('0xa'));var deskjs=require(_0x2d3f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2d3f('0xc'));var Papa=require(_0x2d3f('0xd'));var Redis=require(_0x2d3f('0xe'));var authService=require(_0x2d3f('0xf'));var qs=require(_0x2d3f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d3f('0x11'))(_0x2d3f('0x12'));var utils=require(_0x2d3f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2d3f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412bb7,_0x105c18){_0x105c18=_0x105c18||0xcc;return function(_0x2a129c){if(_0x2a129c){return _0x412bb7[_0x2d3f('0x15')](_0x105c18);}return _0x412bb7[_0x2d3f('0x16')](_0x105c18)[_0x2d3f('0x17')]();};}function respondWithResult(_0x585c26,_0x2951e9){_0x2951e9=_0x2951e9||0xc8;return function(_0x2fe0ac){if(_0x2fe0ac){return _0x585c26['status'](_0x2951e9)['json'](_0x2fe0ac);}};}function respondWithFilteredResult(_0x9600c2,_0x1107ea){return function(_0x231e37){if(_0x231e37){var _0x5d64a8=typeof _0x1107ea['offset']===_0x2d3f('0x18')&&typeof _0x1107ea[_0x2d3f('0x19')]===_0x2d3f('0x18');var _0x9e45b0=_0x231e37['count'];var _0x521922=_0x5d64a8?0x0:_0x1107ea[_0x2d3f('0x1a')];var _0x18e921=_0x5d64a8?_0x231e37[_0x2d3f('0x1b')]:_0x1107ea[_0x2d3f('0x1a')]+_0x1107ea[_0x2d3f('0x19')];var _0x362ae8;if(_0x18e921>=_0x9e45b0){_0x18e921=_0x9e45b0;_0x362ae8=0xc8;}else{_0x362ae8=0xce;}_0x9600c2['status'](_0x362ae8);return _0x9600c2['set'](_0x2d3f('0x1c'),_0x521922+'-'+_0x18e921+'/'+_0x9e45b0)['json'](_0x231e37);}return null;};}function patchUpdates(_0x3ebb63){return function(_0x258157){try{jsonpatch[_0x2d3f('0x1d')](_0x258157,_0x3ebb63,!![]);}catch(_0x476ed7){return BPromise[_0x2d3f('0x1e')](_0x476ed7);}return _0x258157['save']();};}function saveUpdates(_0x474b8f,_0x4b7db1){return function(_0x7de2bb){if(_0x7de2bb){return _0x7de2bb[_0x2d3f('0x1f')](_0x474b8f)['then'](function(_0x26e651){return _0x26e651;});}return null;};}function removeEntity(_0x323216,_0x3bbe8c){return function(_0x12fe3b){if(_0x12fe3b){return _0x12fe3b[_0x2d3f('0x20')]()[_0x2d3f('0x21')](function(){_0x323216[_0x2d3f('0x16')](0xcc)[_0x2d3f('0x17')]();});}};}function handleEntityNotFound(_0x244b99,_0x5811fa){return function(_0x27c228){if(!_0x27c228){_0x244b99[_0x2d3f('0x15')](0x194);}return _0x27c228;};}function handleError(_0x54c415,_0x201d27){_0x201d27=_0x201d27||0x1f4;return function(_0xd22a6c){logger[_0x2d3f('0x22')](_0xd22a6c[_0x2d3f('0x23')]);if(_0xd22a6c[_0x2d3f('0x24')]){delete _0xd22a6c['name'];}_0x54c415['status'](_0x201d27)['send'](_0xd22a6c);};}exports[_0x2d3f('0x25')]=function(_0x56a58f,_0x270aeb){var _0x477644={},_0x55f2d0={},_0x47094a={'count':0x0,'rows':[]};var _0x13b5d1=_[_0x2d3f('0x26')](db[_0x2d3f('0x27')]['rawAttributes'],function(_0x558e49){return{'name':_0x558e49[_0x2d3f('0x28')],'type':_0x558e49[_0x2d3f('0x29')]['key']};});_0x55f2d0[_0x2d3f('0x2a')]=_[_0x2d3f('0x26')](_0x13b5d1,_0x2d3f('0x24'));_0x55f2d0[_0x2d3f('0x2b')]=_[_0x2d3f('0x2c')](_0x56a58f[_0x2d3f('0x2b')]);_0x55f2d0[_0x2d3f('0x2d')]=_[_0x2d3f('0x2e')](_0x55f2d0['model'],_0x55f2d0['query']);_0x477644[_0x2d3f('0x2f')]=_[_0x2d3f('0x2e')](_0x55f2d0['model'],qs[_0x2d3f('0x30')](_0x56a58f[_0x2d3f('0x2b')][_0x2d3f('0x30')]));_0x477644[_0x2d3f('0x2f')]=_0x477644['attributes'][_0x2d3f('0x31')]?_0x477644[_0x2d3f('0x2f')]:_0x55f2d0[_0x2d3f('0x2a')];if(!_0x56a58f[_0x2d3f('0x2b')]['hasOwnProperty'](_0x2d3f('0x32'))){_0x477644[_0x2d3f('0x19')]=qs[_0x2d3f('0x19')](_0x56a58f['query'][_0x2d3f('0x19')]);_0x477644['offset']=qs[_0x2d3f('0x1a')](_0x56a58f[_0x2d3f('0x2b')]['offset']);}_0x477644[_0x2d3f('0x33')]=qs['sort'](_0x56a58f[_0x2d3f('0x2b')][_0x2d3f('0x34')]);_0x477644[_0x2d3f('0x35')]=qs[_0x2d3f('0x2d')](_['pick'](_0x56a58f[_0x2d3f('0x2b')],_0x55f2d0['filters']),_0x13b5d1);if(_0x56a58f['query']['filter']){_0x477644['where']=_[_0x2d3f('0x36')](_0x477644['where'],{'$or':_['map'](_0x13b5d1,function(_0x4ece5d){if(_0x4ece5d['type']!=='VIRTUAL'){var _0x3c0e42={};_0x3c0e42[_0x4ece5d[_0x2d3f('0x24')]]={'$like':'%'+_0x56a58f[_0x2d3f('0x2b')][_0x2d3f('0x37')]+'%'};return _0x3c0e42;}})});}_0x477644=_[_0x2d3f('0x36')]({},_0x477644,_0x56a58f[_0x2d3f('0x38')]);var _0x401ace={'where':_0x477644['where']};return db[_0x2d3f('0x27')][_0x2d3f('0x1b')](_0x401ace)['then'](function(_0x4ee595){_0x47094a[_0x2d3f('0x1b')]=_0x4ee595;if(_0x56a58f['query'][_0x2d3f('0x39')]){_0x477644[_0x2d3f('0x3a')]=[{'all':!![]}];}return db['FaxApplication'][_0x2d3f('0x3b')](_0x477644);})[_0x2d3f('0x21')](function(_0x3300f7){_0x47094a[_0x2d3f('0x3c')]=_0x3300f7;return _0x47094a;})[_0x2d3f('0x21')](respondWithFilteredResult(_0x270aeb,_0x477644))[_0x2d3f('0x3d')](handleError(_0x270aeb,null));};exports[_0x2d3f('0x3e')]=function(_0x3ef1fb,_0x4abfb1){var _0x2c1221={'raw':!![],'where':{'id':_0x3ef1fb['params']['id']}},_0x30a1c0={};_0x30a1c0[_0x2d3f('0x2a')]=_[_0x2d3f('0x2c')](db['FaxApplication'][_0x2d3f('0x3f')]);_0x30a1c0[_0x2d3f('0x2b')]=_[_0x2d3f('0x2c')](_0x3ef1fb[_0x2d3f('0x2b')]);_0x30a1c0[_0x2d3f('0x2d')]=_[_0x2d3f('0x2e')](_0x30a1c0[_0x2d3f('0x2a')],_0x30a1c0['query']);_0x2c1221[_0x2d3f('0x2f')]=_[_0x2d3f('0x2e')](_0x30a1c0[_0x2d3f('0x2a')],qs[_0x2d3f('0x30')](_0x3ef1fb[_0x2d3f('0x2b')][_0x2d3f('0x30')]));_0x2c1221[_0x2d3f('0x2f')]=_0x2c1221['attributes'][_0x2d3f('0x31')]?_0x2c1221[_0x2d3f('0x2f')]:_0x30a1c0['model'];if(_0x3ef1fb[_0x2d3f('0x2b')][_0x2d3f('0x39')]){_0x2c1221[_0x2d3f('0x3a')]=[{'all':!![]}];}_0x2c1221=_[_0x2d3f('0x36')]({},_0x2c1221,_0x3ef1fb[_0x2d3f('0x38')]);return db[_0x2d3f('0x27')]['find'](_0x2c1221)['then'](handleEntityNotFound(_0x4abfb1,null))[_0x2d3f('0x21')](respondWithResult(_0x4abfb1,null))[_0x2d3f('0x3d')](handleError(_0x4abfb1,null));};exports[_0x2d3f('0x40')]=function(_0xe737f,_0x3f7205){return db[_0x2d3f('0x27')]['create'](_0xe737f['body'],{})[_0x2d3f('0x21')](respondWithResult(_0x3f7205,0xc9))[_0x2d3f('0x3d')](handleError(_0x3f7205,null));};exports[_0x2d3f('0x1f')]=function(_0x344a25,_0x3e1062){if(_0x344a25[_0x2d3f('0x41')]['id']){delete _0x344a25['body']['id'];}return db[_0x2d3f('0x27')][_0x2d3f('0x42')]({'where':{'id':_0x344a25[_0x2d3f('0x43')]['id']}})[_0x2d3f('0x21')](handleEntityNotFound(_0x3e1062,null))[_0x2d3f('0x21')](saveUpdates(_0x344a25[_0x2d3f('0x41')],null))[_0x2d3f('0x21')](respondWithResult(_0x3e1062,null))[_0x2d3f('0x3d')](handleError(_0x3e1062,null));};exports[_0x2d3f('0x20')]=function(_0x544b20,_0x1110a0){return db[_0x2d3f('0x27')][_0x2d3f('0x42')]({'where':{'id':_0x544b20[_0x2d3f('0x43')]['id']}})[_0x2d3f('0x21')](handleEntityNotFound(_0x1110a0,null))[_0x2d3f('0x21')](removeEntity(_0x1110a0,null))['catch'](handleError(_0x1110a0,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index eb5be9b..537f6c5 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 _0xb0d6=['exports','FaxApplication','fax_applications','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x13248d,_0x35184a){var _0x564f27=function(_0x32ce2c){while(--_0x32ce2c){_0x13248d['push'](_0x13248d['shift']());}};_0x564f27(++_0x35184a);}(_0xb0d6,0xa3));var _0x6b0d=function(_0x15d59a,_0x4b13c2){_0x15d59a=_0x15d59a-0x0;var _0x575cd5=_0xb0d6[_0x15d59a];return _0x575cd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b0d('0x0'))('api');var moment=require(_0x6b0d('0x1'));var BPromise=require(_0x6b0d('0x2'));var rp=require(_0x6b0d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b0d('0x4'));var config=require(_0x6b0d('0x5'));var attributes=require(_0x6b0d('0x6'));module[_0x6b0d('0x7')]=function(_0x43752b,_0x4e6039){return _0x43752b['define'](_0x6b0d('0x8'),attributes,{'tableName':_0x6b0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd55d=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2f58ea,_0x2c8f38){var _0x514770=function(_0xd39816){while(--_0xd39816){_0x2f58ea['push'](_0x2f58ea['shift']());}};_0x514770(++_0x2c8f38);}(_0xd55d,0x74));var _0xdd55=function(_0x5d2123,_0x274164){_0x5d2123=_0x5d2123-0x0;var _0xa0d7cc=_0xd55d[_0x5d2123];return _0xa0d7cc;};'use strict';var _=require(_0xdd55('0x0'));var util=require(_0xdd55('0x1'));var logger=require(_0xdd55('0x2'))(_0xdd55('0x3'));var moment=require(_0xdd55('0x4'));var BPromise=require(_0xdd55('0x5'));var rp=require(_0xdd55('0x6'));var fs=require('fs');var path=require(_0xdd55('0x7'));var rimraf=require(_0xdd55('0x8'));var config=require(_0xdd55('0x9'));var attributes=require('./faxApplication.attributes');module[_0xdd55('0xa')]=function(_0xdc421b,_0x37ee61){return _0xdc421b[_0xdd55('0xb')](_0xdd55('0xc'),attributes,{'tableName':_0xdd55('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd55('0xe'),'collate':_0xdd55('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index fdfa37f..a799039 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 _0x30c6=['catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x30c6,0x15e));var _0x630c=function(_0x4d9668,_0x249fed){_0x4d9668=_0x4d9668-0x0;var _0x3d9eaa=_0x30c6[_0x4d9668];return _0x3d9eaa;};'use strict';var _=require(_0x630c('0x0'));var util=require(_0x630c('0x1'));var moment=require(_0x630c('0x2'));var BPromise=require(_0x630c('0x3'));var rs=require(_0x630c('0x4'));var fs=require('fs');var Redis=require(_0x630c('0x5'));var db=require(_0x630c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x630c('0x7'))(_0x630c('0x8'));var config=require(_0x630c('0x9'));var jayson=require(_0x630c('0xa'));var client=jayson[_0x630c('0xb')][_0x630c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d9749,_0x36c16a,_0x467e85){return new BPromise(function(_0x2a8c4e,_0x29ac9a){return client[_0x630c('0xd')](_0x1d9749,_0x467e85)['then'](function(_0x7113a7){logger[_0x630c('0xe')](_0x630c('0xf'),_0x36c16a,_0x630c('0x10'));logger[_0x630c('0x11')](_0x630c('0x12'),_0x36c16a,_0x630c('0x10'),JSON[_0x630c('0x13')](_0x7113a7));if(_0x7113a7[_0x630c('0x14')]){if(_0x7113a7[_0x630c('0x14')][_0x630c('0x15')]===0x1f4){logger[_0x630c('0x14')](_0x630c('0xf'),_0x36c16a,_0x7113a7[_0x630c('0x14')][_0x630c('0x16')]);return _0x29ac9a(_0x7113a7[_0x630c('0x14')]['message']);}logger[_0x630c('0x14')](_0x630c('0xf'),_0x36c16a,_0x7113a7[_0x630c('0x14')]['message']);return _0x2a8c4e(_0x7113a7['error'][_0x630c('0x16')]);}else{logger[_0x630c('0xe')](_0x630c('0xf'),_0x36c16a,_0x630c('0x10'));_0x2a8c4e(_0x7113a7[_0x630c('0x17')][_0x630c('0x16')]);}})[_0x630c('0x18')](function(_0x3b2b98){logger['error'](_0x630c('0xf'),_0x36c16a,_0x3b2b98);_0x29ac9a(_0x3b2b98);});});}exports[_0x630c('0x19')]=function(_0x272f58){var _0xba4a67=this;return new Promise(function(_0x51f9fb,_0x4fd6fd){return db[_0x630c('0x1a')][_0x630c('0x1b')](_0x272f58['body'],{'raw':_0x272f58[_0x630c('0x1c')]?_0x272f58['options'][_0x630c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272f58[_0x630c('0x1c')]?_0x272f58['options'][_0x630c('0x1e')]||null:null,'attributes':_0x272f58[_0x630c('0x1c')]?_0x272f58[_0x630c('0x1c')][_0x630c('0x1f')]||null:null,'limit':_0x272f58[_0x630c('0x1c')]?_0x272f58['options'][_0x630c('0x20')]||null:null})[_0x630c('0x21')](function(_0x9932fe){logger['info'](_0x630c('0x19'),_0x272f58);logger[_0x630c('0x11')](_0x630c('0x19'),_0x272f58,JSON['stringify'](_0x9932fe));_0x51f9fb(_0x9932fe);})[_0x630c('0x18')](function(_0x5ef547){logger[_0x630c('0x14')](_0x630c('0x19'),_0x5ef547['message'],_0x272f58);_0x4fd6fd(_0xba4a67['error'](0x1f4,_0x5ef547['message']));});});}; \ No newline at end of file +var _0x83d3=['then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where'];(function(_0x6c823,_0x3f5e35){var _0x1fda1b=function(_0x1eb5b5){while(--_0x1eb5b5){_0x6c823['push'](_0x6c823['shift']());}};_0x1fda1b(++_0x3f5e35);}(_0x83d3,0x17c));var _0x383d=function(_0x1cd7f1,_0x44236f){_0x1cd7f1=_0x1cd7f1-0x0;var _0x5adfde=_0x83d3[_0x1cd7f1];return _0x5adfde;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var moment=require(_0x383d('0x2'));var BPromise=require(_0x383d('0x3'));var rs=require(_0x383d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x383d('0x5'))['db'];var utils=require(_0x383d('0x6'));var logger=require(_0x383d('0x7'))(_0x383d('0x8'));var config=require('../../config/environment');var jayson=require(_0x383d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbc074b,_0x2c3cab,_0x360bee){return new BPromise(function(_0x5641df,_0x303c1d){return client['request'](_0xbc074b,_0x360bee)['then'](function(_0x221079){logger[_0x383d('0xa')]('FaxApplication,\x20%s,\x20%s',_0x2c3cab,_0x383d('0xb'));logger[_0x383d('0xc')](_0x383d('0xd'),_0x2c3cab,_0x383d('0xb'),JSON[_0x383d('0xe')](_0x221079));if(_0x221079[_0x383d('0xf')]){if(_0x221079['error']['code']===0x1f4){logger['error'](_0x383d('0x10'),_0x2c3cab,_0x221079['error'][_0x383d('0x11')]);return _0x303c1d(_0x221079[_0x383d('0xf')][_0x383d('0x11')]);}logger[_0x383d('0xf')]('FaxApplication,\x20%s,\x20%s',_0x2c3cab,_0x221079['error'][_0x383d('0x11')]);return _0x5641df(_0x221079['error'][_0x383d('0x11')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x2c3cab,_0x383d('0xb'));_0x5641df(_0x221079[_0x383d('0x12')]['message']);}})['catch'](function(_0x11c1f9){logger[_0x383d('0xf')]('FaxApplication,\x20%s,\x20%s',_0x2c3cab,_0x11c1f9);_0x303c1d(_0x11c1f9);});});}exports[_0x383d('0x13')]=function(_0x18dc97){var _0xed4b0b=this;return new Promise(function(_0xc7868,_0x224da3){return db[_0x383d('0x14')][_0x383d('0x15')](_0x18dc97['body'],{'raw':_0x18dc97[_0x383d('0x16')]?_0x18dc97[_0x383d('0x16')][_0x383d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18dc97[_0x383d('0x16')]?_0x18dc97[_0x383d('0x16')][_0x383d('0x18')]||null:null,'attributes':_0x18dc97[_0x383d('0x16')]?_0x18dc97['options']['attributes']||null:null,'limit':_0x18dc97[_0x383d('0x16')]?_0x18dc97[_0x383d('0x16')]['limit']||null:null})[_0x383d('0x19')](function(_0x885aa1){logger[_0x383d('0xa')](_0x383d('0x13'),_0x18dc97);logger[_0x383d('0xc')](_0x383d('0x13'),_0x18dc97,JSON[_0x383d('0xe')](_0x885aa1));_0xc7868(_0x885aa1);})[_0x383d('0x1a')](function(_0x1a3933){logger[_0x383d('0xf')]('UpdateFaxApplication',_0x1a3933['message'],_0x18dc97);_0x224da3(_0xed4b0b[_0x383d('0xf')](0x1f4,_0x1a3933[_0x383d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3b5d790..befc901 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x55eacc,_0x3257f1){var _0x54decc=function(_0x43df93){while(--_0x43df93){_0x55eacc['push'](_0x55eacc['shift']());}};_0x54decc(++_0x3257f1);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x5eb8[_0x1a3243];return _0x33f2ca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x430f13,_0x10ebbd){_0x430f13=_0x430f13-0x0;var _0x107ec3=_0xd7d1[_0x430f13];return _0x107ec3;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index de2576b..6db1310 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 _0x32b6=['ENUM','out','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x313d6f,_0x122c8d){var _0x2059ac=function(_0x49c551){while(--_0x49c551){_0x313d6f['push'](_0x313d6f['shift']());}};_0x2059ac(++_0x122c8d);}(_0x32b6,0x1d1));var _0x632b=function(_0x528dc8,_0x374049){_0x528dc8=_0x528dc8-0x0;var _0x492c85=_0x32b6[_0x528dc8];return _0x492c85;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x632b('0x2')]},'disposition':{'type':Sequelize[_0x632b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x632b('0x3')]},'read1stAt':{'type':Sequelize[_0x632b('0x2')]},'fax':{'type':Sequelize[_0x632b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x632b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x632b('0x6')]}}; \ No newline at end of file +var _0x160f=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0x171fa5,_0x119ff6){var _0x3982a6=function(_0x15c067){while(--_0x15c067){_0x171fa5['push'](_0x171fa5['shift']());}};_0x3982a6(++_0x119ff6);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'closed':{'type':Sequelize[_0xf160('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf160('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf160('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf160('0x4')]},'note':{'type':Sequelize[_0xf160('0x4')]},'read1stAt':{'type':Sequelize[_0xf160('0x3')]},'fax':{'type':Sequelize[_0xf160('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf160('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf160('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf160('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f4b8673..7e00283 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 _0x5eed=['type','key','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','find','create','body','describe','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','toString','join','files','tmp','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','rimraf','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName'];(function(_0x2d16d8,_0x295ba2){var _0x40e2bf=function(_0x45c1cf){while(--_0x45c1cf){_0x2d16d8['push'](_0x2d16d8['shift']());}};_0x40e2bf(++_0x295ba2);}(_0x5eed,0x103));var _0xd5ee=function(_0x473dc1,_0x2f2a62){_0x473dc1=_0x473dc1-0x0;var _0x2c5bde=_0x5eed[_0x473dc1];return _0x2c5bde;};'use strict';var rimraf=require(_0xd5ee('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd5ee('0x1'));var BPromise=require(_0xd5ee('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xd5ee('0x3'));var Redis=require(_0xd5ee('0x4'));var interaction=require(_0xd5ee('0x5'));var qs=require(_0xd5ee('0x6'));var logger=require('../../config/logger')(_0xd5ee('0x7'));var config=require('../../config/environment');var db=require(_0xd5ee('0x8'))['db'];config[_0xd5ee('0x9')]=_[_0xd5ee('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5ee('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x24ca67,_0x1096ee){_0x1096ee=_0x1096ee||0xcc;return function(_0x4ee662){if(_0x4ee662){return _0x24ca67['sendStatus'](_0x1096ee);}return _0x24ca67[_0xd5ee('0xb')](_0x1096ee)['end']();};}function respondWithResult(_0x96099c,_0x59d766){_0x59d766=_0x59d766||0xc8;return function(_0x3d8265){if(_0x3d8265){return _0x96099c[_0xd5ee('0xb')](_0x59d766)[_0xd5ee('0xc')](_0x3d8265);}};}function respondWithFilteredResult(_0x34f421,_0x6b8845){return function(_0x2efea9){if(_0x2efea9){var _0x17af6f=typeof _0x6b8845['offset']===_0xd5ee('0xd')&&typeof _0x6b8845[_0xd5ee('0xe')]===_0xd5ee('0xd');var _0x3294f3=_0x2efea9[_0xd5ee('0xf')];var _0x139193=_0x17af6f?0x0:_0x6b8845[_0xd5ee('0x10')];var _0x2e0970=_0x17af6f?_0x2efea9[_0xd5ee('0xf')]:_0x6b8845[_0xd5ee('0x10')]+_0x6b8845[_0xd5ee('0xe')];var _0x24b43d;if(_0x2e0970>=_0x3294f3){_0x2e0970=_0x3294f3;_0x24b43d=0xc8;}else{_0x24b43d=0xce;}_0x34f421[_0xd5ee('0xb')](_0x24b43d);return _0x34f421[_0xd5ee('0x11')](_0xd5ee('0x12'),_0x139193+'-'+_0x2e0970+'/'+_0x3294f3)[_0xd5ee('0xc')](_0x2efea9);}return null;};}function saveUpdates(_0x4f43be){return function(_0x36c179){if(_0x36c179){return _0x36c179[_0xd5ee('0x13')](_0x4f43be)[_0xd5ee('0x14')](function(_0x8ef175){return _0x8ef175;});}return null;};}function removeEntity(_0x39aa2a){return function(_0x32de9a){if(_0x32de9a){return _0x32de9a[_0xd5ee('0x15')]()[_0xd5ee('0x14')](function(){_0x39aa2a[_0xd5ee('0xb')](0xcc)[_0xd5ee('0x16')]();});}};}function handleEntityNotFound(_0x2aa1bc){return function(_0x21b54d){if(!_0x21b54d){_0x2aa1bc[_0xd5ee('0x17')](0x194);}return _0x21b54d;};}function handleError(_0x108504,_0xe4854){_0xe4854=_0xe4854||0x1f4;return function(_0x1ddefa){logger[_0xd5ee('0x18')](_0x1ddefa[_0xd5ee('0x19')]);if(_0x1ddefa[_0xd5ee('0x1a')]){delete _0x1ddefa[_0xd5ee('0x1a')];}_0x108504['status'](_0xe4854)['send'](_0x1ddefa);};}exports[_0xd5ee('0x1b')]=function(_0x3ed7e8,_0x546578){var _0x24e017={};var _0xaee91=_[_0xd5ee('0x1c')](db[_0xd5ee('0x1d')][_0xd5ee('0x1e')],function(_0x3546b8){return{'name':_0x3546b8[_0xd5ee('0x1f')],'type':_0x3546b8[_0xd5ee('0x20')][_0xd5ee('0x21')]};});_0x24e017=qs['getOptions'](_0xaee91,_0x3ed7e8);return interaction['findAll'](_0xd5ee('0x22'),_0x3ed7e8[_0xd5ee('0x23')],_0x3ed7e8[_0xd5ee('0x24')],_0x24e017,_0xaee91)[_0xd5ee('0x14')](respondWithFilteredResult(_0x546578,_0x24e017))[_0xd5ee('0x25')](handleError(_0x546578,null));};exports[_0xd5ee('0x26')]=function(_0x10b2bb,_0x261599){var _0x52c9e={'raw':![],'where':{'id':_0x10b2bb[_0xd5ee('0x27')]['id']}},_0x14745d={};_0x14745d[_0xd5ee('0x28')]=_[_0xd5ee('0x29')](db[_0xd5ee('0x1d')]['rawAttributes']);_0x14745d[_0xd5ee('0x23')]=_[_0xd5ee('0x29')](_0x10b2bb['query']);_0x14745d[_0xd5ee('0x2a')]=_[_0xd5ee('0x2b')](_0x14745d[_0xd5ee('0x28')],_0x14745d[_0xd5ee('0x23')]);_0x52c9e[_0xd5ee('0x2c')]=_[_0xd5ee('0x2b')](_0x14745d[_0xd5ee('0x28')],qs['fields'](_0x10b2bb['query'][_0xd5ee('0x2d')]));_0x52c9e[_0xd5ee('0x2c')]=_0x52c9e[_0xd5ee('0x2c')][_0xd5ee('0x2e')]?_0x52c9e[_0xd5ee('0x2c')]:_0x14745d[_0xd5ee('0x28')];if(_0x10b2bb['query'][_0xd5ee('0x2f')]){_0x52c9e['include']=[{'all':!![]}];}_0x52c9e=_['merge']({},_0x52c9e,_0x10b2bb['options']);return db['FaxInteraction'][_0xd5ee('0x30')](_0x52c9e)[_0xd5ee('0x14')](handleEntityNotFound(_0x261599,null))[_0xd5ee('0x14')](respondWithResult(_0x261599,null))[_0xd5ee('0x25')](handleError(_0x261599,null));};exports[_0xd5ee('0x31')]=function(_0x160c93,_0x43546b){return db[_0xd5ee('0x1d')][_0xd5ee('0x31')](_0x160c93[_0xd5ee('0x32')],{})['then'](respondWithResult(_0x43546b,0xc9))[_0xd5ee('0x25')](handleError(_0x43546b,null));};exports[_0xd5ee('0x13')]=function(_0x4b9cd7,_0x1d1078){if(_0x4b9cd7[_0xd5ee('0x32')]['id']){delete _0x4b9cd7[_0xd5ee('0x32')]['id'];}return db['FaxInteraction'][_0xd5ee('0x30')]({'where':{'id':_0x4b9cd7[_0xd5ee('0x27')]['id']}})[_0xd5ee('0x14')](handleEntityNotFound(_0x1d1078,null))[_0xd5ee('0x14')](saveUpdates(_0x4b9cd7[_0xd5ee('0x32')],null))[_0xd5ee('0x14')](respondWithResult(_0x1d1078,null))[_0xd5ee('0x25')](handleError(_0x1d1078,null));};exports['destroy']=function(_0x2f114f,_0x586c56){return db['FaxInteraction'][_0xd5ee('0x30')]({'where':{'id':_0x2f114f[_0xd5ee('0x27')]['id']}})['then'](handleEntityNotFound(_0x586c56,null))[_0xd5ee('0x14')](removeEntity(_0x586c56,null))[_0xd5ee('0x25')](handleError(_0x586c56,null));};exports[_0xd5ee('0x33')]=function(_0x43acae,_0x1978be){return db['FaxInteraction'][_0xd5ee('0x33')]()[_0xd5ee('0x14')](respondWithResult(_0x1978be,null))[_0xd5ee('0x25')](handleError(_0x1978be,null));};exports['addMessage']=function(_0x428bcf,_0x5a8673){return db[_0xd5ee('0x34')][_0xd5ee('0x30')]({'where':{'id':_0x428bcf[_0xd5ee('0x27')]['id']}})[_0xd5ee('0x14')](handleEntityNotFound(_0x5a8673,null))[_0xd5ee('0x14')](function(_0x4f7549){if(_0x4f7549){return _0x4f7549['addMessage'](_0x428bcf['body'][_0xd5ee('0x35')],_[_0xd5ee('0x36')](_0x428bcf['body'],[_0xd5ee('0x35'),'id'])||{});}})[_0xd5ee('0x14')](respondWithResult(_0x5a8673,null))[_0xd5ee('0x25')](handleError(_0x5a8673,null));};exports[_0xd5ee('0x37')]=function(_0x306499,_0x302577){var _0x3ff515={'raw':![],'where':{}};var _0x401c98={};var _0x4952b6={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd5ee('0x38')]({'where':{'id':_0x306499[_0xd5ee('0x27')]['id']}})[_0xd5ee('0x14')](handleEntityNotFound(_0x302577,null))[_0xd5ee('0x14')](function(_0x3b4b5d){if(_0x3b4b5d){_0x401c98[_0xd5ee('0x28')]=_[_0xd5ee('0x29')](db['FaxMessage'][_0xd5ee('0x1e')]);_0x401c98[_0xd5ee('0x23')]=_['keys'](_0x306499['query']);_0x401c98[_0xd5ee('0x2a')]=_[_0xd5ee('0x2b')](_0x401c98[_0xd5ee('0x28')],_0x401c98['query']);_0x3ff515[_0xd5ee('0x2c')]=_[_0xd5ee('0x2b')](_0x401c98['model'],qs[_0xd5ee('0x2d')](_0x306499[_0xd5ee('0x23')][_0xd5ee('0x2d')]));_0x3ff515[_0xd5ee('0x2c')]=_0x3ff515[_0xd5ee('0x2c')][_0xd5ee('0x2e')]?_0x3ff515[_0xd5ee('0x2c')]:_0x401c98[_0xd5ee('0x28')];if(!_0x306499['query'][_0xd5ee('0x39')](_0xd5ee('0x3a'))){_0x3ff515[_0xd5ee('0xe')]=qs[_0xd5ee('0xe')](_0x306499['query'][_0xd5ee('0xe')]);_0x3ff515[_0xd5ee('0x10')]=qs[_0xd5ee('0x10')](_0x306499[_0xd5ee('0x23')][_0xd5ee('0x10')]);}_0x3ff515[_0xd5ee('0x3b')]=qs[_0xd5ee('0x3c')](_0x306499[_0xd5ee('0x23')][_0xd5ee('0x3c')]);_0x3ff515[_0xd5ee('0x3d')]=qs[_0xd5ee('0x2a')](_[_0xd5ee('0x3e')](_0x306499[_0xd5ee('0x23')],_0x401c98[_0xd5ee('0x2a')]));_0x3ff515[_0xd5ee('0x3d')]['FaxInteractionId']=_0x3b4b5d['id'];if(_0x306499[_0xd5ee('0x23')][_0xd5ee('0x3f')]){_0x3ff515[_0xd5ee('0x3d')]=_[_0xd5ee('0x40')](_0x3ff515[_0xd5ee('0x3d')],{'$or':_[_0xd5ee('0x1c')](_0x3ff515[_0xd5ee('0x2c')],function(_0x2f44c1){var _0x2cf054={};_0x2cf054[_0x2f44c1]={'$like':'%'+_0x306499[_0xd5ee('0x23')][_0xd5ee('0x3f')]+'%'};return _0x2cf054;})});}if(_0x306499['query'][_0xd5ee('0x41')]){var _0x303176=_0x306499['query'][_0xd5ee('0x41')][_0xd5ee('0x42')](',');var _0x5e47f8={};_0x5e47f8[_0x303176[0x0]]={'$gte':moment(_0x303176[0x1])[_0xd5ee('0x43')](_0xd5ee('0x44'))};_0x3ff515[_0xd5ee('0x3d')]=_[_0xd5ee('0x40')](_0x3ff515[_0xd5ee('0x3d')],_0x5e47f8);}_0x3ff515=_[_0xd5ee('0x40')]({},_0x3ff515,_0x306499[_0xd5ee('0x45')]);return db[_0xd5ee('0x34')][_0xd5ee('0xf')]({'where':_0x3ff515[_0xd5ee('0x3d')]})['then'](function(_0x5907c6){_0x4952b6[_0xd5ee('0xf')]=_0x5907c6;if(_0x306499[_0xd5ee('0x23')][_0xd5ee('0x2f')]){_0x3ff515[_0xd5ee('0x46')]=[{'all':!![]}];}return db[_0xd5ee('0x34')][_0xd5ee('0x47')](_0x3ff515);})[_0xd5ee('0x14')](function(_0x3d09e2){_0x4952b6['rows']=_0x3d09e2;return _0x4952b6;});}})[_0xd5ee('0x14')](respondWithFilteredResult(_0x302577,_0x3ff515))[_0xd5ee('0x25')](handleError(_0x302577,null));};exports[_0xd5ee('0x48')]=function(_0x327205,_0x14f0ee){return db[_0xd5ee('0x1d')]['find']({'where':{'id':_0x327205[_0xd5ee('0x27')]['id']}})[_0xd5ee('0x14')](handleEntityNotFound(_0x14f0ee,null))[_0xd5ee('0x14')](function(_0x481551){if(_0x481551){return _0x481551[_0xd5ee('0x49')](_0x327205[_0xd5ee('0x32')][_0xd5ee('0x35')],_[_0xd5ee('0x36')](_0x327205[_0xd5ee('0x32')],[_0xd5ee('0x35'),'id'])||{})[_0xd5ee('0x4a')](function(){return db[_0xd5ee('0x4b')][_0xd5ee('0x47')]({'attributes':['id','name',_0xd5ee('0x4c')],'where':{'id':_0x327205['body'][_0xd5ee('0x35')]}});})['then'](function(_0x412b15){socket[_0xd5ee('0x4d')](_0xd5ee('0x4e'),{'id':Number(_0x327205['params']['id']),'tags':_0x412b15||[]});return{'id':Number(_0x327205[_0xd5ee('0x27')]['id']),'tags':_0x412b15||[]};});}})['then'](respondWithResult(_0x14f0ee,null))['catch'](handleError(_0x14f0ee,null));};exports[_0xd5ee('0x4f')]=function(_0x4770a1,_0x44b6db){return db['FaxInteraction']['find']({'where':{'id':_0x4770a1['params']['id']}})[_0xd5ee('0x14')](handleEntityNotFound(_0x44b6db,null))['then'](function(_0x4c5986){if(_0x4c5986){return _0x4c5986[_0xd5ee('0x4f')](_0x4770a1[_0xd5ee('0x23')][_0xd5ee('0x35')]);}})[_0xd5ee('0x14')](respondWithStatusCode(_0x44b6db,null))[_0xd5ee('0x25')](handleError(_0x44b6db,null));};exports[_0xd5ee('0x50')]=function(_0x1b6226,_0x2fce10){var _0x46db95=moment()['unix']()[_0xd5ee('0x51')]();var _0x1560b8=path[_0xd5ee('0x52')](config['root'],'server',_0xd5ee('0x53'),_0xd5ee('0x54'));var _0x43504a=path[_0xd5ee('0x52')](config['root'],'server','files','attachments');var _0x37e8c1=path[_0xd5ee('0x52')](_0x1560b8,_0x46db95);var _0x227b02=util[_0xd5ee('0x43')]('transcript-%d-%s.zip',_0x1b6226['params']['id'],_0x46db95);var _0x578667=path[_0xd5ee('0x52')](_0x1560b8,_0x227b02);var _0x24b983=[];_0x24b983[_0xd5ee('0x55')]({'model':db[_0xd5ee('0x56')],'as':_0xd5ee('0x56'),'raw':!![]});var _0x42ce9f=[{'model':db['FaxMessage'],'as':_0xd5ee('0x57'),'attributes':['id','body',_0xd5ee('0x58')],'include':_0x24b983}];return db[_0xd5ee('0x1d')][_0xd5ee('0x30')]({'where':{'id':_0x1b6226[_0xd5ee('0x27')]['id']},'include':_0x42ce9f})['then'](handleEntityNotFound(_0x2fce10,null))[_0xd5ee('0x14')](function(_0x53ca23){if(_0x53ca23&&_0x53ca23[_0xd5ee('0x57')]){var _0x568781=_0x53ca23['get']({'plain':!![]});fs[_0xd5ee('0x59')](_0x37e8c1);for(var _0x1e0019=0x0;_0x1e0019<_0x568781[_0xd5ee('0x57')][_0xd5ee('0x2e')];_0x1e0019++){var _0x2df13a=_0x568781[_0xd5ee('0x57')][_0x1e0019]['Attachment'];if(_0x2df13a){var _0x270b14=path[_0xd5ee('0x52')](_0x43504a,_0x2df13a[_0xd5ee('0x5a')]);if(fs[_0xd5ee('0x5b')](_0x270b14)){fs[_0xd5ee('0x5c')](_0x270b14)[_0xd5ee('0x5d')](fs[_0xd5ee('0x5e')](path['join'](_0x37e8c1,_0x2df13a[_0xd5ee('0x5a')])));}}}return BPromise['resolve']()[_0xd5ee('0x14')](function(){return new BPromise(function(_0x3b37ab,_0x56246c){zipdir(_0x37e8c1,{'saveTo':_0x578667},function(_0x17ef0a,_0x57498e){if(_0x17ef0a)return _0x56246c(_0x17ef0a);return _0x3b37ab(_0x57498e);});})[_0xd5ee('0x14')](function(){return new BPromise(function(_0xda8a34,_0x56b2b3){rimraf(_0x37e8c1,function(_0x11f9ca){if(_0x11f9ca)_0x56b2b3(_0x11f9ca);return _0xda8a34();});});})[_0xd5ee('0x14')](function(){return _0x2fce10['download'](_0x578667,_0x227b02,function(_0x58372e){if(_0x58372e){console[_0xd5ee('0x5f')](_0xd5ee('0x60'),_0x58372e);}else{fs['unlinkSync'](_0x578667);}});});});}else{return _0x2fce10['sendStatus'](0xc8);}})[_0xd5ee('0x25')](handleError(_0x2fce10,null));}; \ No newline at end of file +var _0x6628=['map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','show','params','model','keys','filters','attributes','fields','include','merge','options','find','create','body','catch','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','intersection','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','includeAll','rows','setTags','spread','Tag','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','length','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send'];(function(_0x40294e,_0x1a46a5){var _0x3d002c=function(_0x166607){while(--_0x166607){_0x40294e['push'](_0x40294e['shift']());}};_0x3d002c(++_0x1a46a5);}(_0x6628,0x11c));var _0x8662=function(_0x15a8bc,_0x38dc44){_0x15a8bc=_0x15a8bc-0x0;var _0x523062=_0x6628[_0x15a8bc];return _0x523062;};'use strict';var rimraf=require(_0x8662('0x0'));var zipdir=require(_0x8662('0x1'));var moment=require(_0x8662('0x2'));var BPromise=require(_0x8662('0x3'));var util=require(_0x8662('0x4'));var path=require(_0x8662('0x5'));var fs=require('fs');var _=require(_0x8662('0x6'));var Redis=require(_0x8662('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x8662('0x8'));var logger=require(_0x8662('0x9'))(_0x8662('0xa'));var config=require(_0x8662('0xb'));var db=require(_0x8662('0xc'))['db'];config[_0x8662('0xd')]=_[_0x8662('0xe')](config[_0x8662('0xd')],{'host':_0x8662('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8662('0xd')]));require(_0x8662('0x10'))[_0x8662('0x11')](socket);function respondWithStatusCode(_0x54bd16,_0x3ae573){_0x3ae573=_0x3ae573||0xcc;return function(_0x4f7b46){if(_0x4f7b46){return _0x54bd16['sendStatus'](_0x3ae573);}return _0x54bd16['status'](_0x3ae573)['end']();};}function respondWithResult(_0x3d0bbe,_0x44a1f8){_0x44a1f8=_0x44a1f8||0xc8;return function(_0x3e73b5){if(_0x3e73b5){return _0x3d0bbe['status'](_0x44a1f8)[_0x8662('0x12')](_0x3e73b5);}};}function respondWithFilteredResult(_0xf4169b,_0x501bdf){return function(_0x4e76d2){if(_0x4e76d2){var _0x4330ed=typeof _0x501bdf[_0x8662('0x13')]===_0x8662('0x14')&&typeof _0x501bdf[_0x8662('0x15')]===_0x8662('0x14');var _0xf141a1=_0x4e76d2[_0x8662('0x16')];var _0x3806d5=_0x4330ed?0x0:_0x501bdf[_0x8662('0x13')];var _0x3b4b57=_0x4330ed?_0x4e76d2[_0x8662('0x16')]:_0x501bdf['offset']+_0x501bdf[_0x8662('0x15')];var _0x565eaa;if(_0x3b4b57>=_0xf141a1){_0x3b4b57=_0xf141a1;_0x565eaa=0xc8;}else{_0x565eaa=0xce;}_0xf4169b[_0x8662('0x17')](_0x565eaa);return _0xf4169b[_0x8662('0x18')](_0x8662('0x19'),_0x3806d5+'-'+_0x3b4b57+'/'+_0xf141a1)[_0x8662('0x12')](_0x4e76d2);}return null;};}function saveUpdates(_0x5a10a0){return function(_0x33ccb0){if(_0x33ccb0){return _0x33ccb0[_0x8662('0x1a')](_0x5a10a0)[_0x8662('0x1b')](function(_0x76407f){return _0x76407f;});}return null;};}function removeEntity(_0x5a60ca){return function(_0x269c58){if(_0x269c58){return _0x269c58[_0x8662('0x1c')]()[_0x8662('0x1b')](function(){_0x5a60ca[_0x8662('0x17')](0xcc)[_0x8662('0x1d')]();});}};}function handleEntityNotFound(_0x231836){return function(_0x5b62cb){if(!_0x5b62cb){_0x231836[_0x8662('0x1e')](0x194);}return _0x5b62cb;};}function handleError(_0x58ed7e,_0x358c96){_0x358c96=_0x358c96||0x1f4;return function(_0x2e16a3){logger['error'](_0x2e16a3[_0x8662('0x1f')]);if(_0x2e16a3[_0x8662('0x20')]){delete _0x2e16a3[_0x8662('0x20')];}_0x58ed7e[_0x8662('0x17')](_0x358c96)[_0x8662('0x21')](_0x2e16a3);};}exports['index']=function(_0x49ac8e,_0x32827f){var _0x370d25={};var _0x20cc0e=_[_0x8662('0x22')](db[_0x8662('0x23')][_0x8662('0x24')],function(_0x1d72e0){return{'name':_0x1d72e0[_0x8662('0x25')],'type':_0x1d72e0['type'][_0x8662('0x26')]};});_0x370d25=qs[_0x8662('0x27')](_0x20cc0e,_0x49ac8e);return interaction[_0x8662('0x28')]('fax',_0x49ac8e[_0x8662('0x29')],_0x49ac8e[_0x8662('0x2a')],_0x370d25,_0x20cc0e)['then'](respondWithFilteredResult(_0x32827f,_0x370d25))['catch'](handleError(_0x32827f,null));};exports[_0x8662('0x2b')]=function(_0x22ae38,_0x180c2b){var _0x276aaf={'raw':![],'where':{'id':_0x22ae38[_0x8662('0x2c')]['id']}},_0x4fc19e={};_0x4fc19e[_0x8662('0x2d')]=_[_0x8662('0x2e')](db[_0x8662('0x23')][_0x8662('0x24')]);_0x4fc19e[_0x8662('0x29')]=_[_0x8662('0x2e')](_0x22ae38[_0x8662('0x29')]);_0x4fc19e[_0x8662('0x2f')]=_['intersection'](_0x4fc19e[_0x8662('0x2d')],_0x4fc19e[_0x8662('0x29')]);_0x276aaf[_0x8662('0x30')]=_['intersection'](_0x4fc19e[_0x8662('0x2d')],qs[_0x8662('0x31')](_0x22ae38[_0x8662('0x29')][_0x8662('0x31')]));_0x276aaf['attributes']=_0x276aaf[_0x8662('0x30')]['length']?_0x276aaf[_0x8662('0x30')]:_0x4fc19e[_0x8662('0x2d')];if(_0x22ae38[_0x8662('0x29')]['includeAll']){_0x276aaf[_0x8662('0x32')]=[{'all':!![]}];}_0x276aaf=_[_0x8662('0x33')]({},_0x276aaf,_0x22ae38[_0x8662('0x34')]);return db['FaxInteraction'][_0x8662('0x35')](_0x276aaf)['then'](handleEntityNotFound(_0x180c2b,null))[_0x8662('0x1b')](respondWithResult(_0x180c2b,null))['catch'](handleError(_0x180c2b,null));};exports['create']=function(_0x30410b,_0x1e2da1){return db[_0x8662('0x23')][_0x8662('0x36')](_0x30410b[_0x8662('0x37')],{})[_0x8662('0x1b')](respondWithResult(_0x1e2da1,0xc9))[_0x8662('0x38')](handleError(_0x1e2da1,null));};exports[_0x8662('0x1a')]=function(_0x18c767,_0x3e1c34){if(_0x18c767[_0x8662('0x37')]['id']){delete _0x18c767[_0x8662('0x37')]['id'];}return db[_0x8662('0x23')][_0x8662('0x35')]({'where':{'id':_0x18c767[_0x8662('0x2c')]['id']}})[_0x8662('0x1b')](handleEntityNotFound(_0x3e1c34,null))['then'](saveUpdates(_0x18c767['body'],null))[_0x8662('0x1b')](respondWithResult(_0x3e1c34,null))['catch'](handleError(_0x3e1c34,null));};exports[_0x8662('0x1c')]=function(_0x556136,_0x4fca12){return db['FaxInteraction'][_0x8662('0x35')]({'where':{'id':_0x556136['params']['id']}})[_0x8662('0x1b')](handleEntityNotFound(_0x4fca12,null))[_0x8662('0x1b')](removeEntity(_0x4fca12,null))[_0x8662('0x38')](handleError(_0x4fca12,null));};exports['describe']=function(_0x2d160a,_0x24d8f7){return db[_0x8662('0x23')][_0x8662('0x39')]()[_0x8662('0x1b')](respondWithResult(_0x24d8f7,null))['catch'](handleError(_0x24d8f7,null));};exports[_0x8662('0x3a')]=function(_0x21bd08,_0x1169d7){return db[_0x8662('0x3b')][_0x8662('0x35')]({'where':{'id':_0x21bd08[_0x8662('0x2c')]['id']}})[_0x8662('0x1b')](handleEntityNotFound(_0x1169d7,null))[_0x8662('0x1b')](function(_0x5d42ac){if(_0x5d42ac){return _0x5d42ac['addMessage'](_0x21bd08[_0x8662('0x37')]['ids'],_[_0x8662('0x3c')](_0x21bd08[_0x8662('0x37')],[_0x8662('0x3d'),'id'])||{});}})[_0x8662('0x1b')](respondWithResult(_0x1169d7,null))[_0x8662('0x38')](handleError(_0x1169d7,null));};exports[_0x8662('0x3e')]=function(_0x1089b3,_0x47e8d6){var _0x161969={'raw':![],'where':{}};var _0x130782={};var _0x126982={'count':0x0,'rows':[]};return db[_0x8662('0x23')][_0x8662('0x3f')]({'where':{'id':_0x1089b3[_0x8662('0x2c')]['id']}})[_0x8662('0x1b')](handleEntityNotFound(_0x47e8d6,null))['then'](function(_0x1199aa){if(_0x1199aa){_0x130782[_0x8662('0x2d')]=_[_0x8662('0x2e')](db['FaxMessage'][_0x8662('0x24')]);_0x130782[_0x8662('0x29')]=_[_0x8662('0x2e')](_0x1089b3[_0x8662('0x29')]);_0x130782['filters']=_['intersection'](_0x130782['model'],_0x130782['query']);_0x161969[_0x8662('0x30')]=_[_0x8662('0x40')](_0x130782[_0x8662('0x2d')],qs[_0x8662('0x31')](_0x1089b3[_0x8662('0x29')]['fields']));_0x161969['attributes']=_0x161969['attributes']['length']?_0x161969[_0x8662('0x30')]:_0x130782['model'];if(!_0x1089b3[_0x8662('0x29')]['hasOwnProperty'](_0x8662('0x41'))){_0x161969[_0x8662('0x15')]=qs['limit'](_0x1089b3['query'][_0x8662('0x15')]);_0x161969[_0x8662('0x13')]=qs['offset'](_0x1089b3[_0x8662('0x29')][_0x8662('0x13')]);}_0x161969[_0x8662('0x42')]=qs[_0x8662('0x43')](_0x1089b3[_0x8662('0x29')][_0x8662('0x43')]);_0x161969[_0x8662('0x44')]=qs[_0x8662('0x2f')](_[_0x8662('0x45')](_0x1089b3[_0x8662('0x29')],_0x130782[_0x8662('0x2f')]));_0x161969[_0x8662('0x44')][_0x8662('0x46')]=_0x1199aa['id'];if(_0x1089b3[_0x8662('0x29')][_0x8662('0x47')]){_0x161969[_0x8662('0x44')]=_[_0x8662('0x33')](_0x161969['where'],{'$or':_[_0x8662('0x22')](_0x161969[_0x8662('0x30')],function(_0x290ad8){var _0x287478={};_0x287478[_0x290ad8]={'$like':'%'+_0x1089b3['query']['filter']+'%'};return _0x287478;})});}if(_0x1089b3[_0x8662('0x29')][_0x8662('0x48')]){var _0x6fdce2=_0x1089b3[_0x8662('0x29')][_0x8662('0x48')][_0x8662('0x49')](',');var _0x386b82={};_0x386b82[_0x6fdce2[0x0]]={'$gte':moment(_0x6fdce2[0x1])[_0x8662('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x161969[_0x8662('0x44')]=_['merge'](_0x161969[_0x8662('0x44')],_0x386b82);}_0x161969=_['merge']({},_0x161969,_0x1089b3[_0x8662('0x34')]);return db[_0x8662('0x3b')][_0x8662('0x16')]({'where':_0x161969[_0x8662('0x44')]})[_0x8662('0x1b')](function(_0x254b35){_0x126982[_0x8662('0x16')]=_0x254b35;if(_0x1089b3[_0x8662('0x29')][_0x8662('0x4b')]){_0x161969[_0x8662('0x32')]=[{'all':!![]}];}return db[_0x8662('0x3b')]['findAll'](_0x161969);})[_0x8662('0x1b')](function(_0x3a6293){_0x126982[_0x8662('0x4c')]=_0x3a6293;return _0x126982;});}})[_0x8662('0x1b')](respondWithFilteredResult(_0x47e8d6,_0x161969))['catch'](handleError(_0x47e8d6,null));};exports['addTags']=function(_0x592c06,_0x5cbfb1){return db['FaxInteraction'][_0x8662('0x35')]({'where':{'id':_0x592c06[_0x8662('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5cbfb1,null))['then'](function(_0x46e5cf){if(_0x46e5cf){return _0x46e5cf[_0x8662('0x4d')](_0x592c06['body']['ids'],_[_0x8662('0x3c')](_0x592c06[_0x8662('0x37')],[_0x8662('0x3d'),'id'])||{})[_0x8662('0x4e')](function(){return db[_0x8662('0x4f')][_0x8662('0x28')]({'attributes':['id',_0x8662('0x20'),'color'],'where':{'id':_0x592c06[_0x8662('0x37')][_0x8662('0x3d')]}});})[_0x8662('0x1b')](function(_0x28f781){socket['emit'](_0x8662('0x50'),{'id':Number(_0x592c06['params']['id']),'tags':_0x28f781||[]});return{'id':Number(_0x592c06[_0x8662('0x2c')]['id']),'tags':_0x28f781||[]};});}})[_0x8662('0x1b')](respondWithResult(_0x5cbfb1,null))[_0x8662('0x38')](handleError(_0x5cbfb1,null));};exports[_0x8662('0x51')]=function(_0x3596b3,_0x2bd7be){return db[_0x8662('0x23')]['find']({'where':{'id':_0x3596b3[_0x8662('0x2c')]['id']}})[_0x8662('0x1b')](handleEntityNotFound(_0x2bd7be,null))[_0x8662('0x1b')](function(_0x3da2c9){if(_0x3da2c9){return _0x3da2c9['removeTags'](_0x3596b3[_0x8662('0x29')][_0x8662('0x3d')]);}})[_0x8662('0x1b')](respondWithStatusCode(_0x2bd7be,null))['catch'](handleError(_0x2bd7be,null));};exports[_0x8662('0x52')]=function(_0xea644c,_0x1ad538){var _0x4c2a7d=moment()[_0x8662('0x53')]()[_0x8662('0x54')]();var _0x4b2db9=path[_0x8662('0x55')](config[_0x8662('0x56')],'server',_0x8662('0x57'),_0x8662('0x58'));var _0x65a742=path[_0x8662('0x55')](config[_0x8662('0x56')],_0x8662('0x59'),'files','attachments');var _0x3904dd=path[_0x8662('0x55')](_0x4b2db9,_0x4c2a7d);var _0x3588c5=util['format'](_0x8662('0x5a'),_0xea644c[_0x8662('0x2c')]['id'],_0x4c2a7d);var _0x2343e1=path[_0x8662('0x55')](_0x4b2db9,_0x3588c5);var _0x452b64=[];_0x452b64[_0x8662('0x5b')]({'model':db[_0x8662('0x5c')],'as':_0x8662('0x5c'),'raw':!![]});var _0x1d3f44=[{'model':db[_0x8662('0x3b')],'as':_0x8662('0x5d'),'attributes':['id',_0x8662('0x37'),_0x8662('0x5e')],'include':_0x452b64}];return db[_0x8662('0x23')][_0x8662('0x35')]({'where':{'id':_0xea644c[_0x8662('0x2c')]['id']},'include':_0x1d3f44})[_0x8662('0x1b')](handleEntityNotFound(_0x1ad538,null))[_0x8662('0x1b')](function(_0x52e12f){if(_0x52e12f&&_0x52e12f['Messages']){var _0x43ec64=_0x52e12f[_0x8662('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3904dd);for(var _0x2c84dc=0x0;_0x2c84dc<_0x43ec64[_0x8662('0x5d')][_0x8662('0x60')];_0x2c84dc++){var _0x5b15b7=_0x43ec64[_0x8662('0x5d')][_0x2c84dc]['Attachment'];if(_0x5b15b7){var _0x1b6eb9=path[_0x8662('0x55')](_0x65a742,_0x5b15b7[_0x8662('0x61')]);if(fs[_0x8662('0x62')](_0x1b6eb9)){fs[_0x8662('0x63')](_0x1b6eb9)[_0x8662('0x64')](fs[_0x8662('0x65')](path[_0x8662('0x55')](_0x3904dd,_0x5b15b7[_0x8662('0x61')])));}}}return BPromise[_0x8662('0x66')]()[_0x8662('0x1b')](function(){return new BPromise(function(_0xbb587d,_0x1893de){zipdir(_0x3904dd,{'saveTo':_0x2343e1},function(_0x571602,_0x4bc2fd){if(_0x571602)return _0x1893de(_0x571602);return _0xbb587d(_0x4bc2fd);});})[_0x8662('0x1b')](function(){return new BPromise(function(_0x330396,_0x5d8e1b){rimraf(_0x3904dd,function(_0xa80c42){if(_0xa80c42)_0x5d8e1b(_0xa80c42);return _0x330396();});});})[_0x8662('0x1b')](function(){return _0x1ad538[_0x8662('0x52')](_0x2343e1,_0x3588c5,function(_0x1b29c1){if(_0x1b29c1){console[_0x8662('0x67')](_0x8662('0x68'),_0x1b29c1);}else{fs[_0x8662('0x69')](_0x2343e1);}});});});}else{return _0x1ad538[_0x8662('0x1e')](0xc8);}})[_0x8662('0x38')](handleError(_0x1ad538,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 60fa370..44d9ee5 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 _0x38b7=['hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch'];(function(_0x52764f,_0xdd7611){var _0x48c128=function(_0x4817c3){while(--_0x4817c3){_0x52764f['push'](_0x52764f['shift']());}};_0x48c128(++_0xdd7611);}(_0x38b7,0x9b));var _0x738b=function(_0x36f5bf,_0x38d7fd){_0x36f5bf=_0x36f5bf-0x0;var _0x23e6be=_0x38b7[_0x36f5bf];return _0x23e6be;};'use strict';var EventEmitter=require(_0x738b('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x738b('0x1')];var FaxMessage=require(_0x738b('0x2'))['db'][_0x738b('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x738b('0x4'),'afterUpdate':_0x738b('0x5'),'afterDestroy':_0x738b('0x6')};function emitEvent(_0x26db5c){return function(_0x4d04cb,_0xa1dcbe,_0x413f1f){_0x4d04cb[_0x738b('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x156b4b){_0x4d04cb['setDataValue'](_0x738b('0x8'),_0x156b4b[_0x738b('0x9')](function(_0x16a1df){return{'id':_0x16a1df['id']};}));return FaxMessage[_0x738b('0xa')]({'where':{'FaxInteractionId':_0x4d04cb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x738b('0xb')](function(_0xa57c60){_0x4d04cb[_0x738b('0xc')](_0x738b('0xd'),_0xa57c60['length']);FaxInteractionEvents['emit'](_0x26db5c+':'+_0x4d04cb['id'],_0x4d04cb);FaxInteractionEvents[_0x738b('0xe')](_0x26db5c,_0x4d04cb);_0x413f1f(null);})[_0x738b('0xf')](_0x413f1f(null));};}for(var e in events){if(events[_0x738b('0x10')](e)){var event=events[e];FaxInteraction[_0x738b('0x11')](e,emitEvent(event));}}module[_0x738b('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x2c0c=['events','../../mysqldb','FaxInteraction','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x2c0c,0x1a0));var _0xc2c0=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x2c0c[_0x3740fe];return _0x55492b;};'use strict';var EventEmitter=require(_0xc2c0('0x0'));var FaxInteraction=require(_0xc2c0('0x1'))['db'][_0xc2c0('0x2')];var FaxMessage=require(_0xc2c0('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2c0('0x3'),'afterDestroy':_0xc2c0('0x4')};function emitEvent(_0x1457f0){return function(_0x359a79,_0x684601,_0x15305d){_0x359a79['getUsers']({'attributes':['id'],'raw':!![]})[_0xc2c0('0x5')](function(_0x5f2d35){_0x359a79[_0xc2c0('0x6')](_0xc2c0('0x7'),_0x5f2d35[_0xc2c0('0x8')](function(_0x1e06f8){return{'id':_0x1e06f8['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x359a79['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc2c0('0x5')](function(_0x1995bc){_0x359a79[_0xc2c0('0x6')](_0xc2c0('0x9'),_0x1995bc[_0xc2c0('0xa')]);FaxInteractionEvents[_0xc2c0('0xb')](_0x1457f0+':'+_0x359a79['id'],_0x359a79);FaxInteractionEvents['emit'](_0x1457f0,_0x359a79);_0x15305d(null);})[_0xc2c0('0xc')](_0x15305d(null));};}for(var e in events){if(events[_0xc2c0('0xd')](e)){var event=events[e];FaxInteraction[_0xc2c0('0xe')](e,emitEvent(event));}}module[_0xc2c0('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 74427b5..f9845c7 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 _0x96b8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x36ff43,_0x49011a){var _0x3e2543=function(_0x45c08c){while(--_0x45c08c){_0x36ff43['push'](_0x36ff43['shift']());}};_0x3e2543(++_0x49011a);}(_0x96b8,0x1b9));var _0x896b=function(_0x117abd,_0x55d08b){_0x117abd=_0x117abd-0x0;var _0x2e46f2=_0x96b8[_0x117abd];return _0x2e46f2;};'use strict';var _=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var logger=require(_0x896b('0x2'))(_0x896b('0x3'));var moment=require(_0x896b('0x4'));var BPromise=require(_0x896b('0x5'));var rp=require(_0x896b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x896b('0x7'));var config=require(_0x896b('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x896b('0x9')]=function(_0x2bf636,_0x32e6c0){return _0x2bf636[_0x896b('0xa')]('FaxInteraction',attributes,{'tableName':_0x896b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x176394,_0x4fce4f,_0x298e03){if(_0x176394[_0x896b('0xc')](_0x896b('0xd'))){_0x176394[_0x896b('0xe')]=moment()[_0x896b('0xf')](_0x896b('0x10'));}_0x298e03(null,_0x176394);}}});}; \ No newline at end of file +var _0x60e0=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x60e0,0x176));var _0x060e=function(_0x1a8092,_0x59b258){_0x1a8092=_0x1a8092-0x0;var _0x463163=_0x60e0[_0x1a8092];return _0x463163;};'use strict';var _=require(_0x060e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x060e('0x1'));var moment=require('moment');var BPromise=require(_0x060e('0x2'));var rp=require(_0x060e('0x3'));var fs=require('fs');var path=require(_0x060e('0x4'));var rimraf=require(_0x060e('0x5'));var config=require(_0x060e('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x060e('0x7')]=function(_0x2b4242,_0x407136){return _0x2b4242['define']('FaxInteraction',attributes,{'tableName':_0x060e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e50a2,_0x4b2613,_0x27a983){if(_0x3e50a2[_0x060e('0x9')]('closed')){_0x3e50a2['closedAt']=moment()['format'](_0x060e('0xa'));}_0x27a983(null,_0x3e50a2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2142f98..8bdc64a 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 _0x1a06=['limit','catch','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1a06,0x10f));var _0x61a0=function(_0x57cde5,_0x1f90a3){_0x57cde5=_0x57cde5-0x0;var _0x5d9dd6=_0x1a06[_0x57cde5];return _0x5d9dd6;};'use strict';var _=require(_0x61a0('0x0'));var util=require(_0x61a0('0x1'));var moment=require(_0x61a0('0x2'));var BPromise=require(_0x61a0('0x3'));var rs=require(_0x61a0('0x4'));var fs=require('fs');var Redis=require(_0x61a0('0x5'));var db=require(_0x61a0('0x6'))['db'];var utils=require(_0x61a0('0x7'));var logger=require(_0x61a0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x61a0('0x9'));var client=jayson[_0x61a0('0xa')]['http']({'port':0x232a});config['redis']=_[_0x61a0('0xb')](config[_0x61a0('0xc')],{'host':_0x61a0('0xd'),'port':0x18eb});var socket=require(_0x61a0('0xe'))(new Redis(config[_0x61a0('0xc')]));require(_0x61a0('0xf'))[_0x61a0('0x10')](socket);function respondWithRpcPromise(_0x3dc03c,_0x567fa7,_0x4f3db1){return new BPromise(function(_0x7f489e,_0x145fc2){return client[_0x61a0('0x11')](_0x3dc03c,_0x4f3db1)[_0x61a0('0x12')](function(_0x297998){logger[_0x61a0('0x13')](_0x61a0('0x14'),_0x567fa7,'request\x20sent');logger[_0x61a0('0x15')](_0x61a0('0x16'),_0x567fa7,_0x61a0('0x17'),JSON[_0x61a0('0x18')](_0x297998));if(_0x297998['error']){if(_0x297998['error'][_0x61a0('0x19')]===0x1f4){logger['error'](_0x61a0('0x14'),_0x567fa7,_0x297998['error'][_0x61a0('0x1a')]);return _0x145fc2(_0x297998[_0x61a0('0x1b')][_0x61a0('0x1a')]);}logger[_0x61a0('0x1b')]('FaxInteraction,\x20%s,\x20%s',_0x567fa7,_0x297998[_0x61a0('0x1b')][_0x61a0('0x1a')]);return _0x7f489e(_0x297998[_0x61a0('0x1b')]['message']);}else{logger[_0x61a0('0x13')](_0x61a0('0x14'),_0x567fa7,_0x61a0('0x17'));_0x7f489e(_0x297998[_0x61a0('0x1c')]['message']);}})['catch'](function(_0x58e120){logger[_0x61a0('0x1b')](_0x61a0('0x14'),_0x567fa7,_0x58e120);_0x145fc2(_0x58e120);});});}exports[_0x61a0('0x1d')]=function(_0x3a39e7){var _0x3c6167=this;return new Promise(function(_0xbe6ff1,_0x52f34e){return db[_0x61a0('0x1e')][_0x61a0('0x1f')](_0x3a39e7[_0x61a0('0x20')],{'raw':_0x3a39e7[_0x61a0('0x21')]?_0x3a39e7[_0x61a0('0x21')][_0x61a0('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a39e7['options']?_0x3a39e7[_0x61a0('0x21')][_0x61a0('0x23')]||null:null,'attributes':_0x3a39e7[_0x61a0('0x21')]?_0x3a39e7['options'][_0x61a0('0x24')]||null:null,'limit':_0x3a39e7[_0x61a0('0x21')]?_0x3a39e7[_0x61a0('0x21')][_0x61a0('0x25')]||null:null})['then'](function(_0x500f0b){logger[_0x61a0('0x13')](_0x61a0('0x1d'),_0x3a39e7);logger[_0x61a0('0x15')](_0x61a0('0x1d'),_0x3a39e7,JSON['stringify'](_0x500f0b));_0xbe6ff1(_0x500f0b);})[_0x61a0('0x26')](function(_0x18c7c1){logger[_0x61a0('0x1b')](_0x61a0('0x1d'),_0x18c7c1['message'],_0x3a39e7);_0x52f34e(_0x3c6167[_0x61a0('0x1b')](0x1f4,_0x18c7c1[_0x61a0('0x1a')]));});});};exports[_0x61a0('0x27')]=function(_0x4917d1){return new Promise(function(_0x135ddc,_0x63c287){return db[_0x61a0('0x1e')]['find']({'where':_0x4917d1[_0x61a0('0x21')]?_0x4917d1[_0x61a0('0x21')][_0x61a0('0x23')]||null:null})['then'](function(_0x3699fa){if(_0x3699fa){return _0x3699fa[_0x61a0('0x28')](_0x4917d1['body'][_0x61a0('0x29')],_['omit'](_0x4917d1[_0x61a0('0x20')],[_0x61a0('0x29'),'id'])||{});}})[_0x61a0('0x2a')](function(_0x1ca53e){logger['info']('AddTags',_0x4917d1);logger[_0x61a0('0x15')](_0x61a0('0x2b'),_0x4917d1,JSON[_0x61a0('0x18')](_0x1ca53e));_0x135ddc(_0x1ca53e);})['catch'](function(_0x1902f2){logger[_0x61a0('0x1b')](_0x61a0('0x2b'),_0x1902f2[_0x61a0('0x1a')],_0x4917d1);_0x63c287(_this['error'](0x1f4,_0x1902f2[_0x61a0('0x1a')]));});});}; \ No newline at end of file +var _0x08da=['request','info','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','addTags','ids','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x4ce144,_0x15255e){var _0x1da279=function(_0x464cad){while(--_0x464cad){_0x4ce144['push'](_0x4ce144['shift']());}};_0x1da279(++_0x15255e);}(_0x08da,0x194));var _0xa08d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x08da[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xa08d('0x0'));var util=require('util');var moment=require(_0xa08d('0x1'));var BPromise=require(_0xa08d('0x2'));var rs=require(_0xa08d('0x3'));var fs=require('fs');var Redis=require(_0xa08d('0x4'));var db=require(_0xa08d('0x5'))['db'];var utils=require(_0xa08d('0x6'));var logger=require('../../config/logger')(_0xa08d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa08d('0x8'));var client=jayson[_0xa08d('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa08d('0xa')](config[_0xa08d('0xb')],{'host':_0xa08d('0xc'),'port':0x18eb});var socket=require(_0xa08d('0xd'))(new Redis(config[_0xa08d('0xb')]));require(_0xa08d('0xe'))[_0xa08d('0xf')](socket);function respondWithRpcPromise(_0x72491b,_0x267735,_0x4d22ce){return new BPromise(function(_0x5c3bc1,_0x490101){return client[_0xa08d('0x10')](_0x72491b,_0x4d22ce)['then'](function(_0x16957b){logger[_0xa08d('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x267735,'request\x20sent');logger['debug'](_0xa08d('0x12'),_0x267735,'request\x20sent',JSON[_0xa08d('0x13')](_0x16957b));if(_0x16957b[_0xa08d('0x14')]){if(_0x16957b['error'][_0xa08d('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x267735,_0x16957b[_0xa08d('0x14')][_0xa08d('0x16')]);return _0x490101(_0x16957b[_0xa08d('0x14')]['message']);}logger['error'](_0xa08d('0x17'),_0x267735,_0x16957b[_0xa08d('0x14')]['message']);return _0x5c3bc1(_0x16957b[_0xa08d('0x14')][_0xa08d('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x267735,_0xa08d('0x18'));_0x5c3bc1(_0x16957b[_0xa08d('0x19')]['message']);}})[_0xa08d('0x1a')](function(_0x40009e){logger[_0xa08d('0x14')](_0xa08d('0x17'),_0x267735,_0x40009e);_0x490101(_0x40009e);});});}exports[_0xa08d('0x1b')]=function(_0x12577c){var _0x2b2171=this;return new Promise(function(_0x5e388a,_0x1f2fc8){return db[_0xa08d('0x1c')][_0xa08d('0x1d')](_0x12577c[_0xa08d('0x1e')],{'raw':_0x12577c[_0xa08d('0x1f')]?_0x12577c['options'][_0xa08d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12577c[_0xa08d('0x1f')]?_0x12577c['options'][_0xa08d('0x21')]||null:null,'attributes':_0x12577c['options']?_0x12577c[_0xa08d('0x1f')][_0xa08d('0x22')]||null:null,'limit':_0x12577c[_0xa08d('0x1f')]?_0x12577c[_0xa08d('0x1f')][_0xa08d('0x23')]||null:null})[_0xa08d('0x24')](function(_0xcb50b1){logger[_0xa08d('0x11')](_0xa08d('0x1b'),_0x12577c);logger['debug']('UpdateFaxInteraction',_0x12577c,JSON[_0xa08d('0x13')](_0xcb50b1));_0x5e388a(_0xcb50b1);})['catch'](function(_0x2e067e){logger[_0xa08d('0x14')](_0xa08d('0x1b'),_0x2e067e[_0xa08d('0x16')],_0x12577c);_0x1f2fc8(_0x2b2171[_0xa08d('0x14')](0x1f4,_0x2e067e[_0xa08d('0x16')]));});});};exports[_0xa08d('0x25')]=function(_0x13227b){return new Promise(function(_0x2a4b7a,_0x538a26){return db[_0xa08d('0x1c')]['find']({'where':_0x13227b['options']?_0x13227b[_0xa08d('0x1f')]['where']||null:null})[_0xa08d('0x24')](function(_0x135594){if(_0x135594){return _0x135594[_0xa08d('0x26')](_0x13227b[_0xa08d('0x1e')][_0xa08d('0x27')],_['omit'](_0x13227b['body'],[_0xa08d('0x27'),'id'])||{});}})['spread'](function(_0x1076b5){logger['info'](_0xa08d('0x28'),_0x13227b);logger[_0xa08d('0x29')](_0xa08d('0x28'),_0x13227b,JSON[_0xa08d('0x13')](_0x1076b5));_0x2a4b7a(_0x1076b5);})[_0xa08d('0x1a')](function(_0x3cffd3){logger['error']('AddTags',_0x3cffd3[_0xa08d('0x16')],_0x13227b);_0x538a26(_this[_0xa08d('0x14')](0x1f4,_0x3cffd3[_0xa08d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c2313cd..8cffef5 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 _0xb770=['save','remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x2449bc,_0x493bc9){var _0x2f8628=function(_0xab2e47){while(--_0xab2e47){_0x2449bc['push'](_0x2449bc['shift']());}};_0x2f8628(++_0x493bc9);}(_0xb770,0x7d));var _0x0b77=function(_0x555e05,_0x21c425){_0x555e05=_0x555e05-0x0;var _0x1d4250=_0xb770[_0x555e05];return _0x1d4250;};'use strict';var FaxInteractionEvents=require(_0x0b77('0x0'));var events=[_0x0b77('0x1'),_0x0b77('0x2'),_0x0b77('0x3')];function createListener(_0x3ac79c,_0x35180f){return function(_0x30effa){_0x35180f[_0x0b77('0x4')](_0x3ac79c,_0x30effa);};}function removeListener(_0x2dded6,_0x5222d7){return function(){FaxInteractionEvents[_0x0b77('0x5')](_0x2dded6,_0x5222d7);};}exports[_0x0b77('0x6')]=function(_0x259256){for(var _0x119335=0x0,_0x5e18e8=events[_0x0b77('0x7')];_0x119335<_0x5e18e8;_0x119335++){var _0x1249c0=events[_0x119335];var _0x5ac3de=createListener(_0x0b77('0x8')+_0x1249c0,_0x259256);FaxInteractionEvents['on'](_0x1249c0,_0x5ac3de);}}; \ No newline at end of file +var _0x6168=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x6168,0x115));var _0x8616=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x6168[_0x342baa];return _0x1208f3;};'use strict';var FaxInteractionEvents=require(_0x8616('0x0'));var events=[_0x8616('0x1'),_0x8616('0x2'),_0x8616('0x3')];function createListener(_0x1a8579,_0x687771){return function(_0x537451){_0x687771[_0x8616('0x4')](_0x1a8579,_0x537451);};}function removeListener(_0x4030a8,_0x552c48){return function(){FaxInteractionEvents[_0x8616('0x5')](_0x4030a8,_0x552c48);};}exports[_0x8616('0x6')]=function(_0x5d1982){for(var _0x505cf1=0x0,_0x5e0088=events[_0x8616('0x7')];_0x505cf1<_0x5e0088;_0x505cf1++){var _0x15e249=events[_0x505cf1];var _0x2fff41=createListener(_0x8616('0x8')+_0x15e249,_0x5d1982);FaxInteractionEvents['on'](_0x15e249,_0x2fff41);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2bced01..de6fffe 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 _0x8485=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','create','/:id/messages','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','exports','multer','path','express','Router'];(function(_0x5530a1,_0x4ee22c){var _0x52180d=function(_0x23e64c){while(--_0x23e64c){_0x5530a1['push'](_0x5530a1['shift']());}};_0x52180d(++_0x4ee22c);}(_0x8485,0x88));var _0x5848=function(_0x469a6f,_0x1e12bc){_0x469a6f=_0x469a6f-0x0;var _0x3a9b89=_0x8485[_0x469a6f];return _0x3a9b89;};'use strict';var multer=require(_0x5848('0x0'));var util=require('util');var path=require(_0x5848('0x1'));var timeout=require('connect-timeout');var express=require(_0x5848('0x2'));var router=express[_0x5848('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5848('0x4'));var config=require(_0x5848('0x5'));var controller=require(_0x5848('0x6'));router[_0x5848('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5848('0x7')](_0x5848('0x8'),auth[_0x5848('0x9')](),controller[_0x5848('0xa')]);router['get'](_0x5848('0xb'),auth[_0x5848('0x9')](),controller[_0x5848('0xc')]);router[_0x5848('0x7')]('/:id/messages',auth[_0x5848('0x9')](),controller['getMessages']);router[_0x5848('0x7')](_0x5848('0xd'),auth[_0x5848('0x9')](),controller[_0x5848('0xe')]);router['post']('/',auth[_0x5848('0x9')](),controller[_0x5848('0xf')]);router['post'](_0x5848('0x10'),auth[_0x5848('0x9')](),controller['addMessage']);router[_0x5848('0x11')](_0x5848('0x12'),auth['isAuthenticated'](),interaction[_0x5848('0x13')](_0x5848('0x14'),_0x5848('0x15')),controller[_0x5848('0x16')]);router['put'](_0x5848('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x5848('0x14'),'faxinteraction:update'),controller[_0x5848('0x17')]);router[_0x5848('0x18')](_0x5848('0xb'),auth[_0x5848('0x9')](),interaction['tracked'](_0x5848('0x14'),_0x5848('0x19')),controller[_0x5848('0x1a')]);router[_0x5848('0x18')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x5848('0x1b')]=router; \ No newline at end of file +var _0x9212=['get','index','/describe','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x2b0601,_0x40e460){var _0x4aee5f=function(_0x10eeda){while(--_0x10eeda){_0x2b0601['push'](_0x2b0601['shift']());}};_0x4aee5f(++_0x40e460);}(_0x9212,0x183));var _0x2921=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x9212[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0x2921('0x0'));var util=require('util');var path=require(_0x2921('0x1'));var timeout=require(_0x2921('0x2'));var express=require(_0x2921('0x3'));var router=express[_0x2921('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2921('0x5'));var interaction=require(_0x2921('0x6'));var config=require(_0x2921('0x7'));var controller=require(_0x2921('0x8'));router[_0x2921('0x9')]('/',auth['isAuthenticated'](),controller[_0x2921('0xa')]);router[_0x2921('0x9')](_0x2921('0xb'),auth[_0x2921('0xc')](),controller['describe']);router['get']('/:id',auth[_0x2921('0xc')](),controller[_0x2921('0xd')]);router[_0x2921('0x9')](_0x2921('0xe'),auth[_0x2921('0xc')](),controller[_0x2921('0xf')]);router[_0x2921('0x9')](_0x2921('0x10'),auth[_0x2921('0xc')](),controller[_0x2921('0x11')]);router['post']('/',auth[_0x2921('0xc')](),controller['create']);router[_0x2921('0x12')](_0x2921('0xe'),auth[_0x2921('0xc')](),controller[_0x2921('0x13')]);router[_0x2921('0x12')](_0x2921('0x14'),auth[_0x2921('0xc')](),interaction[_0x2921('0x15')](_0x2921('0x16'),_0x2921('0x17')),controller[_0x2921('0x18')]);router[_0x2921('0x19')](_0x2921('0x1a'),auth['isAuthenticated'](),interaction[_0x2921('0x15')]('fax',_0x2921('0x1b')),controller[_0x2921('0x1c')]);router[_0x2921('0x1d')](_0x2921('0x1a'),auth['isAuthenticated'](),interaction[_0x2921('0x15')](_0x2921('0x16'),_0x2921('0x1e')),controller[_0x2921('0x1f')]);router[_0x2921('0x1d')](_0x2921('0x14'),auth[_0x2921('0xc')](),controller['removeTags']);module[_0x2921('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8a8723d..6e22ea8 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 _0xb7c8=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x255ed7,_0x363bc1){var _0x2b2d54=function(_0x2f45a8){while(--_0x2f45a8){_0x255ed7['push'](_0x255ed7['shift']());}};_0x2b2d54(++_0x363bc1);}(_0xb7c8,0x119));var _0x8b7c=function(_0xc95aac,_0x462047){_0xc95aac=_0xc95aac-0x0;var _0x22ed08=_0xb7c8[_0xc95aac];return _0x22ed08;};'use strict';var Sequelize=require('sequelize');module[_0x8b7c('0x0')]={'body':{'type':Sequelize[_0x8b7c('0x1')](_0x8b7c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8b7c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b7c('0x4')]('in',_0x8b7c('0x5')),'defaultValue':_0x8b7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x8b7c('0x6')]}}; \ No newline at end of file +var _0x80d9=['sequelize','TEXT','medium','BOOLEAN','out','DATE'];(function(_0xe43bdf,_0x33201e){var _0x5df72a=function(_0xbb7ecc){while(--_0xbb7ecc){_0xe43bdf['push'](_0xe43bdf['shift']());}};_0x5df72a(++_0x33201e);}(_0x80d9,0x15c));var _0x980d=function(_0x22cb11,_0x4c572b){_0x22cb11=_0x22cb11-0x0;var _0x32538b=_0x80d9[_0x22cb11];return _0x32538b;};'use strict';var Sequelize=require(_0x980d('0x0'));module['exports']={'body':{'type':Sequelize[_0x980d('0x1')](_0x980d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x980d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x980d('0x4')),'defaultValue':_0x980d('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x980d('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x980d('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e4dc87f..e8be35b 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 _0x786c=['read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','fullname','SIP/%s','EventManager','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','end','name','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxMessage','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','destroy','describe','accept','fax','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil'];(function(_0x253141,_0x3a1973){var _0x23971f=function(_0x2c08a7){while(--_0x2c08a7){_0x253141['push'](_0x253141['shift']());}};_0x23971f(++_0x3a1973);}(_0x786c,0x1ea));var _0xc786=function(_0x599f0f,_0x22c044){_0x599f0f=_0x599f0f-0x0;var _0x3b04b2=_0x786c[_0x599f0f];return _0x3b04b2;};'use strict';var emlformat=require(_0xc786('0x0'));var rimraf=require(_0xc786('0x1'));var zipdir=require(_0xc786('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc786('0x3'));var BPromise=require(_0xc786('0x4'));var Mustache=require(_0xc786('0x5'));var util=require('util');var path=require(_0xc786('0x6'));var sox=require(_0xc786('0x7'));var csv=require(_0xc786('0x8'));var ejs=require(_0xc786('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc786('0xa'));var squel=require('squel');var crypto=require(_0xc786('0xb'));var jsforce=require(_0xc786('0xc'));var deskjs=require(_0xc786('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc786('0xe'));var Papa=require(_0xc786('0xf'));var Redis=require('ioredis');var authService=require(_0xc786('0x10'));var qs=require(_0xc786('0x11'));var as=require(_0xc786('0x12'));var hardwareService=require(_0xc786('0x13'));var logger=require(_0xc786('0x14'))(_0xc786('0x15'));var utils=require('../../config/utils');var config=require(_0xc786('0x16'));var licenseUtil=require(_0xc786('0x17'));var db=require(_0xc786('0x18'))['db'];config['redis']=_[_0xc786('0x19')](config[_0xc786('0x1a')],{'host':_0xc786('0x1b'),'port':0x18eb});var socket=require(_0xc786('0x1c'))(new Redis(config[_0xc786('0x1a')]));require(_0xc786('0x1d'))[_0xc786('0x1e')](socket);var jayson=require(_0xc786('0x1f'));var client=jayson[_0xc786('0x20')][_0xc786('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xc786('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x36caa8,_0x34e684,_0x30bfb7,_0x572065){return new BPromise(function(_0x256e1c,_0x43c3a5){var _0x298223=_0x572065||client;return _0x298223[_0xc786('0x22')](_0x36caa8,_0x30bfb7)['then'](function(_0x3a680d){logger[_0xc786('0x23')](_0xc786('0x24'),_0x34e684,_0xc786('0x25'));logger[_0xc786('0x26')](_0xc786('0x27'),_0x34e684,_0xc786('0x25'),JSON['stringify'](_0x3a680d));if(_0x3a680d['error']){if(_0x3a680d['error']['code']===0x1f4){logger[_0xc786('0x28')](_0xc786('0x24'),_0x34e684,_0x3a680d[_0xc786('0x28')][_0xc786('0x29')]);return _0x43c3a5(_0x3a680d[_0xc786('0x28')]['message']);}logger[_0xc786('0x28')]('FaxMessage,\x20%s,\x20%s',_0x34e684,_0x3a680d[_0xc786('0x28')]['message']);return _0x256e1c(_0x3a680d[_0xc786('0x28')][_0xc786('0x29')]);}else{logger[_0xc786('0x23')](_0xc786('0x24'),_0x34e684,_0xc786('0x25'));_0x256e1c(_0x3a680d[_0xc786('0x2a')][_0xc786('0x29')]);}})[_0xc786('0x2b')](function(_0x34f5a7){logger['error'](_0xc786('0x24'),_0x34e684,_0x34f5a7);_0x43c3a5(_0x34f5a7);});});}function respondWithStatusCode(_0x460686,_0x11d1a3){_0x11d1a3=_0x11d1a3||0xcc;return function(_0x39f29e){if(_0x39f29e){return _0x460686[_0xc786('0x2c')](_0x11d1a3);}return _0x460686[_0xc786('0x2d')](_0x11d1a3)['end']();};}function respondWithResult(_0x1d7313,_0x18ea6d){_0x18ea6d=_0x18ea6d||0xc8;return function(_0x13030e){if(_0x13030e){return _0x1d7313[_0xc786('0x2d')](_0x18ea6d)[_0xc786('0x2e')](_0x13030e);}};}function respondWithFilteredResult(_0x5750c1,_0x408265){return function(_0x4b3d99){if(_0x4b3d99){var _0x307186=typeof _0x408265[_0xc786('0x2f')]===_0xc786('0x30')&&typeof _0x408265[_0xc786('0x31')]===_0xc786('0x30');var _0x3040e8=_0x4b3d99['count'];var _0x1b4b57=_0x307186?0x0:_0x408265['offset'];var _0x110802=_0x307186?_0x4b3d99['count']:_0x408265['offset']+_0x408265[_0xc786('0x31')];var _0xfbfe86;if(_0x110802>=_0x3040e8){_0x110802=_0x3040e8;_0xfbfe86=0xc8;}else{_0xfbfe86=0xce;}_0x5750c1['status'](_0xfbfe86);return _0x5750c1['set'](_0xc786('0x32'),_0x1b4b57+'-'+_0x110802+'/'+_0x3040e8)['json'](_0x4b3d99);}return null;};}function patchUpdates(_0xd48f80){return function(_0x5b1f92){try{jsonpatch[_0xc786('0x33')](_0x5b1f92,_0xd48f80,!![]);}catch(_0x4b5d35){return BPromise[_0xc786('0x34')](_0x4b5d35);}return _0x5b1f92['save']();};}function saveUpdates(_0x2d5f2f,_0x324007){return function(_0x18b472){if(_0x18b472){return _0x18b472[_0xc786('0x35')](_0x2d5f2f)[_0xc786('0x36')](function(_0x5e8795){return _0x5e8795;});}return null;};}function removeEntity(_0x26bbac,_0x14d197){return function(_0x45c562){if(_0x45c562){return _0x45c562['destroy']()[_0xc786('0x36')](function(){_0x26bbac[_0xc786('0x2d')](0xcc)[_0xc786('0x37')]();});}};}function handleEntityNotFound(_0x4043a3,_0x21dd55){return function(_0x2ef259){if(!_0x2ef259){_0x4043a3[_0xc786('0x2c')](0x194);}return _0x2ef259;};}function handleError(_0x244fea,_0x521781){_0x521781=_0x521781||0x1f4;return function(_0x45fc32){logger[_0xc786('0x28')](_0x45fc32['stack']);if(_0x45fc32[_0xc786('0x38')]){delete _0x45fc32[_0xc786('0x38')];}_0x244fea[_0xc786('0x2d')](_0x521781)['send'](_0x45fc32);};}exports['index']=function(_0x45497b,_0x52a0b4){var _0x12967e={},_0x42d055={},_0x23cae6={'count':0x0,'rows':[]};var _0x5ceeb9=_[_0xc786('0x39')](db['FaxMessage']['rawAttributes'],function(_0x51c0bb){return{'name':_0x51c0bb[_0xc786('0x3a')],'type':_0x51c0bb[_0xc786('0x3b')][_0xc786('0x3c')]};});_0x42d055[_0xc786('0x3d')]=_[_0xc786('0x39')](_0x5ceeb9,_0xc786('0x38'));_0x42d055['query']=_[_0xc786('0x3e')](_0x45497b[_0xc786('0x3f')]);_0x42d055[_0xc786('0x40')]=_[_0xc786('0x41')](_0x42d055[_0xc786('0x3d')],_0x42d055[_0xc786('0x3f')]);_0x12967e[_0xc786('0x42')]=_[_0xc786('0x41')](_0x42d055[_0xc786('0x3d')],qs[_0xc786('0x43')](_0x45497b['query'][_0xc786('0x43')]));_0x12967e[_0xc786('0x42')]=_0x12967e['attributes'][_0xc786('0x44')]?_0x12967e[_0xc786('0x42')]:_0x42d055[_0xc786('0x3d')];if(!_0x45497b[_0xc786('0x3f')][_0xc786('0x45')](_0xc786('0x46'))){_0x12967e['limit']=qs['limit'](_0x45497b['query'][_0xc786('0x31')]);_0x12967e[_0xc786('0x2f')]=qs[_0xc786('0x2f')](_0x45497b[_0xc786('0x3f')][_0xc786('0x2f')]);}_0x12967e[_0xc786('0x47')]=qs['sort'](_0x45497b[_0xc786('0x3f')][_0xc786('0x48')]);_0x12967e[_0xc786('0x49')]=qs[_0xc786('0x40')](_['pick'](_0x45497b['query'],_0x42d055['filters']),_0x5ceeb9);if(_0x45497b['query'][_0xc786('0x4a')]){_0x12967e[_0xc786('0x49')]=_[_0xc786('0x4b')](_0x12967e[_0xc786('0x49')],{'$or':_[_0xc786('0x39')](_0x5ceeb9,function(_0x24f9c6){if(_0x24f9c6[_0xc786('0x3b')]!==_0xc786('0x4c')){var _0x1c62df={};_0x1c62df[_0x24f9c6['name']]={'$like':'%'+_0x45497b[_0xc786('0x3f')]['filter']+'%'};return _0x1c62df;}})});}_0x12967e=_[_0xc786('0x4b')]({},_0x12967e,_0x45497b[_0xc786('0x4d')]);var _0x365c63={'where':_0x12967e[_0xc786('0x49')]};return db[_0xc786('0x4e')][_0xc786('0x4f')](_0x365c63)[_0xc786('0x36')](function(_0x3dec2a){_0x23cae6[_0xc786('0x4f')]=_0x3dec2a;if(_0x45497b['query'][_0xc786('0x50')]){_0x12967e[_0xc786('0x51')]=[{'all':!![]}];}return db[_0xc786('0x4e')][_0xc786('0x52')](_0x12967e);})[_0xc786('0x36')](function(_0x54c6ef){_0x23cae6[_0xc786('0x53')]=_0x54c6ef;return _0x23cae6;})[_0xc786('0x36')](respondWithFilteredResult(_0x52a0b4,_0x12967e))['catch'](handleError(_0x52a0b4,null));};exports[_0xc786('0x54')]=function(_0x1431e2,_0x1ab571){var _0x50fa52={'raw':!![],'where':{'id':_0x1431e2[_0xc786('0x55')]['id']}},_0x1aafca={};_0x1aafca[_0xc786('0x3d')]=_[_0xc786('0x3e')](db[_0xc786('0x4e')][_0xc786('0x56')]);_0x1aafca[_0xc786('0x3f')]=_[_0xc786('0x3e')](_0x1431e2[_0xc786('0x3f')]);_0x1aafca[_0xc786('0x40')]=_[_0xc786('0x41')](_0x1aafca[_0xc786('0x3d')],_0x1aafca[_0xc786('0x3f')]);_0x50fa52[_0xc786('0x42')]=_['intersection'](_0x1aafca[_0xc786('0x3d')],qs[_0xc786('0x43')](_0x1431e2['query'][_0xc786('0x43')]));_0x50fa52[_0xc786('0x42')]=_0x50fa52[_0xc786('0x42')][_0xc786('0x44')]?_0x50fa52[_0xc786('0x42')]:_0x1aafca[_0xc786('0x3d')];if(_0x1431e2[_0xc786('0x3f')]['includeAll']){_0x50fa52[_0xc786('0x51')]=[{'all':!![]}];}_0x50fa52=_['merge']({},_0x50fa52,_0x1431e2[_0xc786('0x4d')]);return db['FaxMessage'][_0xc786('0x57')](_0x50fa52)[_0xc786('0x36')](handleEntityNotFound(_0x1ab571,null))[_0xc786('0x36')](respondWithResult(_0x1ab571,null))[_0xc786('0x2b')](handleError(_0x1ab571,null));};exports[_0xc786('0x35')]=function(_0x1cc752,_0x77e045){if(_0x1cc752['body']['id']){delete _0x1cc752['body']['id'];}return db[_0xc786('0x4e')][_0xc786('0x57')]({'where':{'id':_0x1cc752[_0xc786('0x55')]['id']}})[_0xc786('0x36')](handleEntityNotFound(_0x77e045,null))[_0xc786('0x36')](saveUpdates(_0x1cc752[_0xc786('0x58')],null))['then'](respondWithResult(_0x77e045,null))[_0xc786('0x2b')](handleError(_0x77e045,null));};exports[_0xc786('0x59')]=function(_0xc72453,_0x4cba9b){return db[_0xc786('0x4e')][_0xc786('0x57')]({'where':{'id':_0xc72453[_0xc786('0x55')]['id']}})[_0xc786('0x36')](handleEntityNotFound(_0x4cba9b,null))['then'](removeEntity(_0x4cba9b,null))[_0xc786('0x2b')](handleError(_0x4cba9b,null));};exports[_0xc786('0x5a')]=function(_0xec6da4,_0x27b2d4){return db[_0xc786('0x4e')][_0xc786('0x5a')]()[_0xc786('0x36')](respondWithResult(_0x27b2d4,null))[_0xc786('0x2b')](handleError(_0x27b2d4,null));};var interaction_log=require(_0xc786('0x14'))('fax-interactions');exports[_0xc786('0x5b')]=function(_0x319a54,_0x2ed759,_0x413bfa){var _0x8f7370={'agent':{},'channel':_0xc786('0x5c')};if(_0x319a54[_0xc786('0x58')]['id']){delete _0x319a54[_0xc786('0x58')]['id'];}_0x319a54[_0xc786('0x58')]['read']=!![];_0x319a54['body'][_0xc786('0x5d')]=moment()[_0xc786('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x319a54[_0xc786('0x58')][_0xc786('0x5f')]=_0x319a54[_0xc786('0x58')][_0xc786('0x5f')]||_0x319a54[_0xc786('0x60')]['id'];_0x8f7370[_0xc786('0x61')]['id']=_0x319a54['body']['UserId'];return db[_0xc786('0x4e')][_0xc786('0x57')]({'where':{'id':_0x319a54[_0xc786('0x55')]['id'],'UserId':null}})[_0xc786('0x36')](handleEntityNotFound(_0x2ed759,null))[_0xc786('0x36')](saveUpdates(_0x319a54[_0xc786('0x58')],null))[_0xc786('0x36')](function(_0x5943ce){if(_0x5943ce){_0x8f7370[_0xc786('0x29')]=_0x5943ce[_0xc786('0x62')]({'plain':!![]});return db[_0xc786('0x63')][_0xc786('0x57')]({'where':{'id':_0x5943ce[_0xc786('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2ed759,null))['then'](function(_0x57984c){if(_0x57984c){return _0x57984c[_0xc786('0x35')]({'UserId':_0x319a54[_0xc786('0x58')][_0xc786('0x5f')],'read1stAt':_[_0xc786('0x65')](_0x57984c[_0xc786('0x66')])?moment()[_0xc786('0x5e')](_0xc786('0x67')):undefined});}return null;})[_0xc786('0x36')](function(_0x2dbe0){if(_0x2dbe0){_0x8f7370[_0xc786('0x68')]=_0x2dbe0[_0xc786('0x62')]({'plain':!![]});interaction_log['info'](_0xc786('0x69'),_0x319a54[_0xc786('0x60')]['id'],_0x319a54[_0xc786('0x60')][_0xc786('0x38')],_0x319a54[_0xc786('0x60')][_0xc786('0x6a')],_0x8f7370[_0xc786('0x68')]['id'],_0x319a54[_0xc786('0x58')]?JSON[_0xc786('0x6b')](_0x319a54['body']):_0xc786('0x6c'));return respondWithRpcPromise(_0xc786('0x6d'),_0xc786('0x6e'),_0x8f7370);}return null;})[_0xc786('0x36')](function(_0x406215){var _0x35b77f=_0xc786('0x6f')+_0x406215[_0xc786('0x29')]['ContactId'];return db['sequelize']['query'](_0x35b77f,{'type':db[_0xc786('0x70')][_0xc786('0x71')][_0xc786('0x72')],'raw':!![]})[_0xc786('0x36')](function(_0x115c29){return _0x115c29;});})[_0xc786('0x36')](function(_0x55caf1){if(_0x55caf1){_0x8f7370[_0xc786('0x29')][_0xc786('0x73')]=_0x55caf1[0x0];if(!_0x319a54[_0xc786('0x58')][_0xc786('0x5f')])return;return db[_0xc786('0x74')][_0xc786('0x57')]({'where':{'id':_0x319a54[_0xc786('0x58')][_0xc786('0x5f')],'role':_0xc786('0x61')},'attributes':['id',_0xc786('0x38'),'fullname',_0xc786('0x75'),_0xc786('0x76')],'raw':!![]});}return null;})[_0xc786('0x36')](function(_0x5e5a61){if(!_0x5e5a61)return null;_0x8f7370[_0xc786('0x29')][_0xc786('0x61')]=_0x5e5a61;return _0x8f7370;})['then'](function(_0x4be497){if(_0x4be497){if(_0x319a54[_0xc786('0x58')][_0xc786('0x77')]){_0x8f7370[_0xc786('0x29')][_0xc786('0x78')]=util[_0xc786('0x5e')]('SIP/%s',_0x319a54['user']['name']);_0x8f7370[_0xc786('0x29')][_0xc786('0x79')]=_0x8f7370[_0xc786('0x79')];_0x8f7370[_0xc786('0x29')][_0xc786('0x7a')]=_0x8f7370['channel'];_0x8f7370['message'][_0xc786('0x7b')]=_0xc786('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xc786('0x7c'),'message':_0x8f7370[_0xc786('0x29')]},client9002)[_0xc786('0x36')](function(){return _0x8f7370;});}return _0x8f7370;}return null;})[_0xc786('0x36')](respondWithResult(_0x2ed759,null))['catch'](handleError(_0x2ed759,null));};var interaction_log=require(_0xc786('0x14'))(_0xc786('0x7d'));exports[_0xc786('0x34')]=function(_0x185104,_0x26ba51,_0xe5c5e2){var _0x29af7b={'agent':{},'channel':_0xc786('0x5c')};if(_0x185104['body']['id']){delete _0x185104[_0xc786('0x58')]['id'];}_0x185104['body'][_0xc786('0x5f')]=_0x185104['body'][_0xc786('0x5f')]||_0x185104[_0xc786('0x60')]['id'];_0x29af7b['agent']['id']=_0x185104[_0xc786('0x58')][_0xc786('0x5f')];return db[_0xc786('0x4e')][_0xc786('0x57')]({'where':{'id':_0x185104[_0xc786('0x55')]['id'],'UserId':null}})[_0xc786('0x36')](handleEntityNotFound(_0x26ba51,null))[_0xc786('0x36')](function(_0x3c6e4c){if(_0x3c6e4c){_0x29af7b[_0xc786('0x29')]=_0x3c6e4c[_0xc786('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xc786('0x57')]({'where':{'id':_0x3c6e4c[_0xc786('0x64')]}});}return null;})[_0xc786('0x36')](handleEntityNotFound(_0x26ba51,null))['then'](function(_0x5dbb09){if(_0x5dbb09){_0x29af7b['interaction']=_0x5dbb09[_0xc786('0x62')]({'plain':!![]});interaction_log[_0xc786('0x23')](_0xc786('0x7e'),_0x185104[_0xc786('0x60')]['id'],_0x185104['user'][_0xc786('0x38')],_0x185104[_0xc786('0x60')][_0xc786('0x6a')],_0x29af7b[_0xc786('0x68')]['id'],_0x185104['body']?JSON[_0xc786('0x6b')](_0x185104[_0xc786('0x58')]):_0xc786('0x6c'));return respondWithRpcPromise(_0xc786('0x7f'),_0xc786('0x80'),_0x29af7b);}return null;})[_0xc786('0x36')](function(_0x5c622c){var _0x4469d0=_0xc786('0x6f')+_0x5c622c[_0xc786('0x29')][_0xc786('0x81')];return db[_0xc786('0x82')][_0xc786('0x3f')](_0x4469d0,{'type':db[_0xc786('0x70')]['QueryTypes'][_0xc786('0x72')],'raw':!![]})[_0xc786('0x36')](function(_0x55d808){return _0x55d808;});})[_0xc786('0x36')](function(_0xd2787c){if(_0xd2787c){_0x29af7b['message'][_0xc786('0x73')]=_0xd2787c[0x0];if(!_0x185104[_0xc786('0x58')]['UserId'])return;return db[_0xc786('0x74')]['find']({'where':{'id':_0x185104['body'][_0xc786('0x5f')],'role':_0xc786('0x61')},'attributes':['id',_0xc786('0x38'),_0xc786('0x83'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0xca0120){if(!_0xca0120)return null;_0x29af7b[_0xc786('0x29')][_0xc786('0x61')]=_0xca0120;return _0x29af7b;})[_0xc786('0x36')](function(_0xad7bfb){if(_0xad7bfb){_0xad7bfb[_0xc786('0x29')][_0xc786('0x78')]=util[_0xc786('0x5e')](_0xc786('0x84'),_0x185104[_0xc786('0x60')][_0xc786('0x38')]);_0xad7bfb[_0xc786('0x29')][_0xc786('0x79')]=_0x29af7b[_0xc786('0x79')];_0xad7bfb[_0xc786('0x29')][_0xc786('0x7a')]=_0x29af7b[_0xc786('0x79')];_0xad7bfb[_0xc786('0x29')][_0xc786('0x7b')]=_0xc786('0x34');respondWithRpcPromise('EventManager',_0xc786('0x85'),{'event':_0xc786('0x86'),'message':_0xad7bfb[_0xc786('0x29')]},client9002);return _0x29af7b;}return null;})[_0xc786('0x36')](respondWithResult(_0x26ba51,null))[_0xc786('0x2b')](handleError(_0x26ba51,null));};exports[_0xc786('0x87')]=function(_0xd55489,_0x4d4742){var _0x358bcb;return db[_0xc786('0x4e')]['create'](_0xd55489['body'],{})[_0xc786('0x36')](function(_0x409884){_0x358bcb=_0x409884;return db[_0xc786('0x88')][_0xc786('0x89')]({'where':{'id':_0x358bcb[_0xc786('0x81')]}});})['then'](function(_0x407078){if(_[_0xc786('0x65')](_0x407078)){return;}else{_0x358bcb['fax']=_0x407078['fax'];return db[_0xc786('0x8a')]['findOne']({'where':{'id':_0x358bcb[_0xc786('0x8b')]}});}})[_0xc786('0x36')](function(_0xac5136){return respondWithRpcPromise(_0xc786('0x8c'),_0xc786('0x8c'),{'FaxAccountId':_[_0xc786('0x65')](_0xd55489[_0xc786('0x58')])?undefined:_0xd55489[_0xc786('0x58')][_0xc786('0x8d')],'path':_[_0xc786('0x65')](_0xac5136)?undefined:util[_0xc786('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0xac5136[_0xc786('0x8e')]),'fax':_['isNil'](_0x358bcb[_0xc786('0x5c')])?undefined:_0x358bcb[_0xc786('0x5c')],'AttachmentId':_0x358bcb['AttachmentId']},client9002);})[_0xc786('0x36')](respondWithResult(_0x4d4742,0xc9))['catch'](handleError(_0x4d4742,null));};exports[_0xc786('0x8f')]=function(_0x4faff4,_0x5b44fa){var _0x2f8843=path[_0xc786('0x90')](config[_0xc786('0x91')],_0xc786('0x92'),'files',_0xc786('0x93'));return db[_0xc786('0x4e')]['find']({'where':{'id':_0x4faff4[_0xc786('0x55')]['id']},'include':[{'model':db[_0xc786('0x8a')],'as':_0xc786('0x8a')}]})[_0xc786('0x36')](handleEntityNotFound(_0x5b44fa,null))[_0xc786('0x36')](function(_0x197def){if(_0x197def){return _0x5b44fa[_0xc786('0x8f')](path[_0xc786('0x90')](_0x2f8843,_0x197def[_0xc786('0x8a')][_0xc786('0x8e')]));}})[_0xc786('0x2b')](handleError(_0x5b44fa,null));}; \ No newline at end of file +var _0x8a88=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','request\x20sent','result','end','status','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','filter','options','FaxMessage','includeAll','include','findAll','catch','show','params','rawAttributes','body','find','../../config/logger','fax-interactions','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','channel','event','accept','EventManager','acceptmessage','FaxInteractionId','interaction','null','rejectMessage','SELECT','contact','create','CmContact','findOne','Attachment','AttachmentId','SendFax','basename','download','join','root','server','files','eml-format'];(function(_0x149cc8,_0x17a222){var _0x993da4=function(_0x15478a){while(--_0x15478a){_0x149cc8['push'](_0x149cc8['shift']());}};_0x993da4(++_0x17a222);}(_0x8a88,0x10d));var _0x88a8=function(_0xaf0b0f,_0x209e37){_0xaf0b0f=_0xaf0b0f-0x0;var _0x9ed5e9=_0x8a88[_0xaf0b0f];return _0x9ed5e9;};'use strict';var emlformat=require(_0x88a8('0x0'));var rimraf=require(_0x88a8('0x1'));var zipdir=require(_0x88a8('0x2'));var jsonpatch=require(_0x88a8('0x3'));var rp=require(_0x88a8('0x4'));var moment=require(_0x88a8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88a8('0x6'));var path=require('path');var sox=require(_0x88a8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88a8('0x8'));var crypto=require(_0x88a8('0x9'));var jsforce=require(_0x88a8('0xa'));var deskjs=require(_0x88a8('0xb'));var toCsv=require(_0x88a8('0xc'));var querystring=require(_0x88a8('0xd'));var Papa=require('papaparse');var Redis=require(_0x88a8('0xe'));var authService=require(_0x88a8('0xf'));var qs=require(_0x88a8('0x10'));var as=require(_0x88a8('0x11'));var hardwareService=require(_0x88a8('0x12'));var logger=require('../../config/logger')(_0x88a8('0x13'));var utils=require(_0x88a8('0x14'));var config=require(_0x88a8('0x15'));var licenseUtil=require(_0x88a8('0x16'));var db=require(_0x88a8('0x17'))['db'];config[_0x88a8('0x18')]=_[_0x88a8('0x19')](config[_0x88a8('0x18')],{'host':_0x88a8('0x1a'),'port':0x18eb});var socket=require(_0x88a8('0x1b'))(new Redis(config['redis']));require(_0x88a8('0x1c'))[_0x88a8('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x88a8('0x1e')][_0x88a8('0x1f')]({'port':0x232c});var client9002=jayson[_0x88a8('0x1e')][_0x88a8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2f2b4d,_0x1cc39e,_0x355239,_0x1c944a){return new BPromise(function(_0x554700,_0x47c19d){var _0x35acb3=_0x1c944a||client;return _0x35acb3[_0x88a8('0x20')](_0x2f2b4d,_0x355239)[_0x88a8('0x21')](function(_0x5ec1ea){logger[_0x88a8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x1cc39e,'request\x20sent');logger[_0x88a8('0x23')](_0x88a8('0x24'),_0x1cc39e,'request\x20sent',JSON[_0x88a8('0x25')](_0x5ec1ea));if(_0x5ec1ea[_0x88a8('0x26')]){if(_0x5ec1ea['error'][_0x88a8('0x27')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1cc39e,_0x5ec1ea[_0x88a8('0x26')][_0x88a8('0x28')]);return _0x47c19d(_0x5ec1ea['error'][_0x88a8('0x28')]);}logger[_0x88a8('0x26')](_0x88a8('0x29'),_0x1cc39e,_0x5ec1ea['error'][_0x88a8('0x28')]);return _0x554700(_0x5ec1ea[_0x88a8('0x26')]['message']);}else{logger[_0x88a8('0x22')](_0x88a8('0x29'),_0x1cc39e,_0x88a8('0x2a'));_0x554700(_0x5ec1ea[_0x88a8('0x2b')][_0x88a8('0x28')]);}})['catch'](function(_0x1d40cd){logger[_0x88a8('0x26')]('FaxMessage,\x20%s,\x20%s',_0x1cc39e,_0x1d40cd);_0x47c19d(_0x1d40cd);});});}function respondWithStatusCode(_0x537e7d,_0x1bbd6a){_0x1bbd6a=_0x1bbd6a||0xcc;return function(_0x102c16){if(_0x102c16){return _0x537e7d['sendStatus'](_0x1bbd6a);}return _0x537e7d['status'](_0x1bbd6a)[_0x88a8('0x2c')]();};}function respondWithResult(_0x539d0e,_0x184d13){_0x184d13=_0x184d13||0xc8;return function(_0x1a13b0){if(_0x1a13b0){return _0x539d0e[_0x88a8('0x2d')](_0x184d13)['json'](_0x1a13b0);}};}function respondWithFilteredResult(_0x2551c1,_0x7fcebe){return function(_0x165025){if(_0x165025){var _0x1014d6=typeof _0x7fcebe[_0x88a8('0x2e')]===_0x88a8('0x2f')&&typeof _0x7fcebe[_0x88a8('0x30')]==='undefined';var _0x3af48d=_0x165025[_0x88a8('0x31')];var _0x12a023=_0x1014d6?0x0:_0x7fcebe['offset'];var _0x1bcae1=_0x1014d6?_0x165025['count']:_0x7fcebe['offset']+_0x7fcebe['limit'];var _0x18afe6;if(_0x1bcae1>=_0x3af48d){_0x1bcae1=_0x3af48d;_0x18afe6=0xc8;}else{_0x18afe6=0xce;}_0x2551c1[_0x88a8('0x2d')](_0x18afe6);return _0x2551c1[_0x88a8('0x32')]('Content-Range',_0x12a023+'-'+_0x1bcae1+'/'+_0x3af48d)['json'](_0x165025);}return null;};}function patchUpdates(_0xeca8f8){return function(_0x1b49fb){try{jsonpatch['apply'](_0x1b49fb,_0xeca8f8,!![]);}catch(_0x5885b3){return BPromise[_0x88a8('0x33')](_0x5885b3);}return _0x1b49fb[_0x88a8('0x34')]();};}function saveUpdates(_0x22ed63,_0x465044){return function(_0x4b665b){if(_0x4b665b){return _0x4b665b[_0x88a8('0x35')](_0x22ed63)[_0x88a8('0x21')](function(_0x415882){return _0x415882;});}return null;};}function removeEntity(_0x2f5058,_0x4b47d1){return function(_0x576f50){if(_0x576f50){return _0x576f50[_0x88a8('0x36')]()[_0x88a8('0x21')](function(){_0x2f5058[_0x88a8('0x2d')](0xcc)[_0x88a8('0x2c')]();});}};}function handleEntityNotFound(_0x3a4f61,_0x3cdd8c){return function(_0x5c3be8){if(!_0x5c3be8){_0x3a4f61['sendStatus'](0x194);}return _0x5c3be8;};}function handleError(_0x3195c0,_0x3483e){_0x3483e=_0x3483e||0x1f4;return function(_0x303749){logger[_0x88a8('0x26')](_0x303749[_0x88a8('0x37')]);if(_0x303749[_0x88a8('0x38')]){delete _0x303749[_0x88a8('0x38')];}_0x3195c0[_0x88a8('0x2d')](_0x3483e)[_0x88a8('0x39')](_0x303749);};}exports[_0x88a8('0x3a')]=function(_0xff3193,_0x44f544){var _0x51c5fd={},_0x54b165={},_0x5e1fc2={'count':0x0,'rows':[]};var _0xcd1b62=_['map'](db['FaxMessage']['rawAttributes'],function(_0x4ac125){return{'name':_0x4ac125[_0x88a8('0x3b')],'type':_0x4ac125[_0x88a8('0x3c')]['key']};});_0x54b165[_0x88a8('0x3d')]=_[_0x88a8('0x3e')](_0xcd1b62,_0x88a8('0x38'));_0x54b165[_0x88a8('0x3f')]=_[_0x88a8('0x40')](_0xff3193[_0x88a8('0x3f')]);_0x54b165[_0x88a8('0x41')]=_[_0x88a8('0x42')](_0x54b165['model'],_0x54b165['query']);_0x51c5fd['attributes']=_[_0x88a8('0x42')](_0x54b165['model'],qs[_0x88a8('0x43')](_0xff3193[_0x88a8('0x3f')][_0x88a8('0x43')]));_0x51c5fd[_0x88a8('0x44')]=_0x51c5fd[_0x88a8('0x44')][_0x88a8('0x45')]?_0x51c5fd[_0x88a8('0x44')]:_0x54b165[_0x88a8('0x3d')];if(!_0xff3193[_0x88a8('0x3f')]['hasOwnProperty']('nolimit')){_0x51c5fd[_0x88a8('0x30')]=qs[_0x88a8('0x30')](_0xff3193['query']['limit']);_0x51c5fd[_0x88a8('0x2e')]=qs[_0x88a8('0x2e')](_0xff3193['query'][_0x88a8('0x2e')]);}_0x51c5fd[_0x88a8('0x46')]=qs['sort'](_0xff3193[_0x88a8('0x3f')][_0x88a8('0x47')]);_0x51c5fd['where']=qs[_0x88a8('0x41')](_[_0x88a8('0x48')](_0xff3193[_0x88a8('0x3f')],_0x54b165['filters']),_0xcd1b62);if(_0xff3193[_0x88a8('0x3f')]['filter']){_0x51c5fd[_0x88a8('0x49')]=_[_0x88a8('0x4a')](_0x51c5fd[_0x88a8('0x49')],{'$or':_[_0x88a8('0x3e')](_0xcd1b62,function(_0x58ed82){if(_0x58ed82[_0x88a8('0x3c')]!=='VIRTUAL'){var _0x275ba5={};_0x275ba5[_0x58ed82[_0x88a8('0x38')]]={'$like':'%'+_0xff3193[_0x88a8('0x3f')][_0x88a8('0x4b')]+'%'};return _0x275ba5;}})});}_0x51c5fd=_['merge']({},_0x51c5fd,_0xff3193[_0x88a8('0x4c')]);var _0xcdbd43={'where':_0x51c5fd[_0x88a8('0x49')]};return db[_0x88a8('0x4d')]['count'](_0xcdbd43)[_0x88a8('0x21')](function(_0x1db900){_0x5e1fc2['count']=_0x1db900;if(_0xff3193['query'][_0x88a8('0x4e')]){_0x51c5fd[_0x88a8('0x4f')]=[{'all':!![]}];}return db[_0x88a8('0x4d')][_0x88a8('0x50')](_0x51c5fd);})[_0x88a8('0x21')](function(_0x149bdb){_0x5e1fc2['rows']=_0x149bdb;return _0x5e1fc2;})[_0x88a8('0x21')](respondWithFilteredResult(_0x44f544,_0x51c5fd))[_0x88a8('0x51')](handleError(_0x44f544,null));};exports[_0x88a8('0x52')]=function(_0x2d2b4d,_0x1f71dc){var _0x17d8e2={'raw':!![],'where':{'id':_0x2d2b4d[_0x88a8('0x53')]['id']}},_0x154f94={};_0x154f94[_0x88a8('0x3d')]=_[_0x88a8('0x40')](db['FaxMessage'][_0x88a8('0x54')]);_0x154f94['query']=_[_0x88a8('0x40')](_0x2d2b4d[_0x88a8('0x3f')]);_0x154f94[_0x88a8('0x41')]=_[_0x88a8('0x42')](_0x154f94[_0x88a8('0x3d')],_0x154f94[_0x88a8('0x3f')]);_0x17d8e2['attributes']=_[_0x88a8('0x42')](_0x154f94[_0x88a8('0x3d')],qs[_0x88a8('0x43')](_0x2d2b4d['query'][_0x88a8('0x43')]));_0x17d8e2[_0x88a8('0x44')]=_0x17d8e2['attributes'][_0x88a8('0x45')]?_0x17d8e2[_0x88a8('0x44')]:_0x154f94['model'];if(_0x2d2b4d[_0x88a8('0x3f')][_0x88a8('0x4e')]){_0x17d8e2[_0x88a8('0x4f')]=[{'all':!![]}];}_0x17d8e2=_[_0x88a8('0x4a')]({},_0x17d8e2,_0x2d2b4d[_0x88a8('0x4c')]);return db[_0x88a8('0x4d')]['find'](_0x17d8e2)['then'](handleEntityNotFound(_0x1f71dc,null))[_0x88a8('0x21')](respondWithResult(_0x1f71dc,null))['catch'](handleError(_0x1f71dc,null));};exports['update']=function(_0x419947,_0x21bad8){if(_0x419947[_0x88a8('0x55')]['id']){delete _0x419947[_0x88a8('0x55')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x419947[_0x88a8('0x53')]['id']}})[_0x88a8('0x21')](handleEntityNotFound(_0x21bad8,null))[_0x88a8('0x21')](saveUpdates(_0x419947['body'],null))[_0x88a8('0x21')](respondWithResult(_0x21bad8,null))[_0x88a8('0x51')](handleError(_0x21bad8,null));};exports[_0x88a8('0x36')]=function(_0x39d871,_0x5d167d){return db[_0x88a8('0x4d')][_0x88a8('0x56')]({'where':{'id':_0x39d871[_0x88a8('0x53')]['id']}})[_0x88a8('0x21')](handleEntityNotFound(_0x5d167d,null))[_0x88a8('0x21')](removeEntity(_0x5d167d,null))[_0x88a8('0x51')](handleError(_0x5d167d,null));};exports['describe']=function(_0x36f27e,_0x516da2){return db[_0x88a8('0x4d')]['describe']()[_0x88a8('0x21')](respondWithResult(_0x516da2,null))[_0x88a8('0x51')](handleError(_0x516da2,null));};var interaction_log=require(_0x88a8('0x57'))(_0x88a8('0x58'));exports['accept']=function(_0x2cbd2d,_0xb5a55c,_0x467bb8){var _0x485b77={'agent':{},'channel':_0x88a8('0x59')};if(_0x2cbd2d[_0x88a8('0x55')]['id']){delete _0x2cbd2d[_0x88a8('0x55')]['id'];}_0x2cbd2d[_0x88a8('0x55')]['read']=!![];_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5a')]=moment()[_0x88a8('0x5b')](_0x88a8('0x5c'));_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5d')]=_0x2cbd2d['body']['UserId']||_0x2cbd2d[_0x88a8('0x5e')]['id'];_0x485b77[_0x88a8('0x5f')]['id']=_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5d')];return db[_0x88a8('0x4d')]['find']({'where':{'id':_0x2cbd2d[_0x88a8('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb5a55c,null))[_0x88a8('0x21')](saveUpdates(_0x2cbd2d[_0x88a8('0x55')],null))[_0x88a8('0x21')](function(_0x168ea2){if(_0x168ea2){_0x485b77[_0x88a8('0x28')]=_0x168ea2[_0x88a8('0x60')]({'plain':!![]});return db[_0x88a8('0x61')][_0x88a8('0x56')]({'where':{'id':_0x168ea2['FaxInteractionId']}});}return null;})[_0x88a8('0x21')](handleEntityNotFound(_0xb5a55c,null))[_0x88a8('0x21')](function(_0x18dfb1){if(_0x18dfb1){return _0x18dfb1['update']({'UserId':_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5d')],'read1stAt':_[_0x88a8('0x62')](_0x18dfb1['read1stAt'])?moment()['format'](_0x88a8('0x5c')):undefined});}return null;})[_0x88a8('0x21')](function(_0x35bcd7){if(_0x35bcd7){_0x485b77['interaction']=_0x35bcd7[_0x88a8('0x60')]({'plain':!![]});interaction_log[_0x88a8('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cbd2d[_0x88a8('0x5e')]['id'],_0x2cbd2d[_0x88a8('0x5e')][_0x88a8('0x38')],_0x2cbd2d[_0x88a8('0x5e')][_0x88a8('0x63')],_0x485b77['interaction']['id'],_0x2cbd2d[_0x88a8('0x55')]?JSON[_0x88a8('0x25')](_0x2cbd2d[_0x88a8('0x55')]):'null');return respondWithRpcPromise(_0x88a8('0x64'),_0x88a8('0x65'),_0x485b77);}return null;})[_0x88a8('0x21')](function(_0x4f3771){var _0x31aabf=_0x88a8('0x66')+_0x4f3771[_0x88a8('0x28')][_0x88a8('0x67')];return db[_0x88a8('0x68')][_0x88a8('0x3f')](_0x31aabf,{'type':db[_0x88a8('0x69')][_0x88a8('0x6a')]['SELECT'],'raw':!![]})[_0x88a8('0x21')](function(_0x5f2bac){return _0x5f2bac;});})[_0x88a8('0x21')](function(_0x4c3808){if(_0x4c3808){_0x485b77[_0x88a8('0x28')]['contact']=_0x4c3808[0x0];if(!_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5d')])return;return db[_0x88a8('0x6b')][_0x88a8('0x56')]({'where':{'id':_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x5d')],'role':_0x88a8('0x5f')},'attributes':['id',_0x88a8('0x38'),_0x88a8('0x6c'),_0x88a8('0x6d'),_0x88a8('0x6e')],'raw':!![]});}return null;})[_0x88a8('0x21')](function(_0x20a056){if(!_0x20a056)return null;_0x485b77['message']['agent']=_0x20a056;return _0x485b77;})['then'](function(_0x28cac1){if(_0x28cac1){if(_0x2cbd2d[_0x88a8('0x55')][_0x88a8('0x6f')]){_0x485b77['message']['interface']=util[_0x88a8('0x5b')]('SIP/%s',_0x2cbd2d[_0x88a8('0x5e')]['name']);_0x485b77[_0x88a8('0x28')][_0x88a8('0x70')]=_0x485b77[_0x88a8('0x70')];_0x485b77[_0x88a8('0x28')]['motionChannel']=_0x485b77[_0x88a8('0x70')];_0x485b77[_0x88a8('0x28')][_0x88a8('0x71')]=_0x88a8('0x72');return respondWithRpcPromise('EventManager',_0x88a8('0x73'),{'event':_0x88a8('0x74'),'message':_0x485b77[_0x88a8('0x28')]},client9002)[_0x88a8('0x21')](function(){return _0x485b77;});}return _0x485b77;}return null;})[_0x88a8('0x21')](respondWithResult(_0xb5a55c,null))['catch'](handleError(_0xb5a55c,null));};var interaction_log=require(_0x88a8('0x57'))(_0x88a8('0x58'));exports[_0x88a8('0x33')]=function(_0x54cac,_0x33162c,_0x2b0678){var _0x2b065a={'agent':{},'channel':_0x88a8('0x59')};if(_0x54cac[_0x88a8('0x55')]['id']){delete _0x54cac[_0x88a8('0x55')]['id'];}_0x54cac[_0x88a8('0x55')]['UserId']=_0x54cac[_0x88a8('0x55')][_0x88a8('0x5d')]||_0x54cac[_0x88a8('0x5e')]['id'];_0x2b065a[_0x88a8('0x5f')]['id']=_0x54cac[_0x88a8('0x55')][_0x88a8('0x5d')];return db[_0x88a8('0x4d')][_0x88a8('0x56')]({'where':{'id':_0x54cac[_0x88a8('0x53')]['id'],'UserId':null}})[_0x88a8('0x21')](handleEntityNotFound(_0x33162c,null))['then'](function(_0x13332a){if(_0x13332a){_0x2b065a['message']=_0x13332a[_0x88a8('0x60')]({'plain':!![]});return db[_0x88a8('0x61')]['find']({'where':{'id':_0x13332a[_0x88a8('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x33162c,null))['then'](function(_0xb9c097){if(_0xb9c097){_0x2b065a['interaction']=_0xb9c097[_0x88a8('0x60')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54cac[_0x88a8('0x5e')]['id'],_0x54cac[_0x88a8('0x5e')]['name'],_0x54cac[_0x88a8('0x5e')][_0x88a8('0x63')],_0x2b065a[_0x88a8('0x76')]['id'],_0x54cac[_0x88a8('0x55')]?JSON[_0x88a8('0x25')](_0x54cac['body']):_0x88a8('0x77'));return respondWithRpcPromise('RejectMessage',_0x88a8('0x78'),_0x2b065a);}return null;})[_0x88a8('0x21')](function(_0x2a9820){var _0x356ee4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2a9820[_0x88a8('0x28')][_0x88a8('0x67')];return db[_0x88a8('0x68')][_0x88a8('0x3f')](_0x356ee4,{'type':db['Sequelize'][_0x88a8('0x6a')][_0x88a8('0x79')],'raw':!![]})['then'](function(_0x347f28){return _0x347f28;});})[_0x88a8('0x21')](function(_0x771053){if(_0x771053){_0x2b065a[_0x88a8('0x28')][_0x88a8('0x7a')]=_0x771053[0x0];if(!_0x54cac[_0x88a8('0x55')][_0x88a8('0x5d')])return;return db[_0x88a8('0x6b')]['find']({'where':{'id':_0x54cac[_0x88a8('0x55')][_0x88a8('0x5d')],'role':_0x88a8('0x5f')},'attributes':['id',_0x88a8('0x38'),_0x88a8('0x6c'),_0x88a8('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x56df0c){if(!_0x56df0c)return null;_0x2b065a[_0x88a8('0x28')][_0x88a8('0x5f')]=_0x56df0c;return _0x2b065a;})['then'](function(_0x1d9a30){if(_0x1d9a30){_0x1d9a30[_0x88a8('0x28')]['interface']=util['format']('SIP/%s',_0x54cac[_0x88a8('0x5e')]['name']);_0x1d9a30[_0x88a8('0x28')][_0x88a8('0x70')]=_0x2b065a[_0x88a8('0x70')];_0x1d9a30[_0x88a8('0x28')]['motionChannel']=_0x2b065a[_0x88a8('0x70')];_0x1d9a30[_0x88a8('0x28')][_0x88a8('0x71')]=_0x88a8('0x33');respondWithRpcPromise('EventManager',_0x88a8('0x73'),{'event':'rejectmessage','message':_0x1d9a30['message']},client9002);return _0x2b065a;}return null;})['then'](respondWithResult(_0x33162c,null))['catch'](handleError(_0x33162c,null));};exports['create']=function(_0x16e393,_0x36a448){var _0x593e3e;return db['FaxMessage'][_0x88a8('0x7b')](_0x16e393[_0x88a8('0x55')],{})[_0x88a8('0x21')](function(_0x2e56a1){_0x593e3e=_0x2e56a1;return db[_0x88a8('0x7c')][_0x88a8('0x7d')]({'where':{'id':_0x593e3e[_0x88a8('0x67')]}});})['then'](function(_0x55698c){if(_[_0x88a8('0x62')](_0x55698c)){return;}else{_0x593e3e[_0x88a8('0x59')]=_0x55698c[_0x88a8('0x59')];return db[_0x88a8('0x7e')][_0x88a8('0x7d')]({'where':{'id':_0x593e3e[_0x88a8('0x7f')]}});}})['then'](function(_0x2aaa51){return respondWithRpcPromise('SendFax',_0x88a8('0x80'),{'FaxAccountId':_[_0x88a8('0x62')](_0x16e393[_0x88a8('0x55')])?undefined:_0x16e393[_0x88a8('0x55')]['FaxAccountId'],'path':_[_0x88a8('0x62')](_0x2aaa51)?undefined:util[_0x88a8('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x2aaa51[_0x88a8('0x81')]),'fax':_['isNil'](_0x593e3e[_0x88a8('0x59')])?undefined:_0x593e3e[_0x88a8('0x59')],'AttachmentId':_0x593e3e[_0x88a8('0x7f')]},client9002);})[_0x88a8('0x21')](respondWithResult(_0x36a448,0xc9))[_0x88a8('0x51')](handleError(_0x36a448,null));};exports[_0x88a8('0x82')]=function(_0x320555,_0x3aaac9){var _0x11c7d5=path[_0x88a8('0x83')](config[_0x88a8('0x84')],_0x88a8('0x85'),_0x88a8('0x86'),'attachments');return db[_0x88a8('0x4d')]['find']({'where':{'id':_0x320555[_0x88a8('0x53')]['id']},'include':[{'model':db[_0x88a8('0x7e')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x3aaac9,null))[_0x88a8('0x21')](function(_0x18f2a3){if(_0x18f2a3){return _0x3aaac9[_0x88a8('0x82')](path[_0x88a8('0x83')](_0x11c7d5,_0x18f2a3[_0x88a8('0x7e')]['basename']));}})[_0x88a8('0x51')](handleError(_0x3aaac9,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e5a75e6..58da651 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 _0xdbb1=['exports','events','save','hasOwnProperty','hook'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdbb1,0x105));var _0x1dbb=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xdbb1[_0x1694f5];return _0x5b4321;};'use strict';var EventEmitter=require(_0x1dbb('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dbb('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x395788){return function(_0x483e15,_0xa1e321,_0xd53e45){FaxMessageEvents['emit'](_0x395788+':'+_0x483e15['id'],_0x483e15);FaxMessageEvents['emit'](_0x395788,_0x483e15);_0xd53e45(null);};}for(var e in events){if(events[_0x1dbb('0x2')](e)){var event=events[e];FaxMessage[_0x1dbb('0x3')](e,emitEvent(event));}}module[_0x1dbb('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0x672a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x132d9e,_0x1475d7){var _0x4337a4=function(_0x33cf87){while(--_0x33cf87){_0x132d9e['push'](_0x132d9e['shift']());}};_0x4337a4(++_0x1475d7);}(_0x672a,0x122));var _0xa672=function(_0x1cd4e7,_0x5f17dd){_0x1cd4e7=_0x1cd4e7-0x0;var _0x5243eb=_0x672a[_0x1cd4e7];return _0x5243eb;};'use strict';var EventEmitter=require(_0xa672('0x0'));var FaxMessage=require(_0xa672('0x1'))['db'][_0xa672('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa672('0x3')](0x0);var events={'afterCreate':_0xa672('0x4'),'afterUpdate':_0xa672('0x5'),'afterDestroy':_0xa672('0x6')};function emitEvent(_0x447bb3){return function(_0xa8b69a,_0x28670c,_0x2c31cd){FaxMessageEvents['emit'](_0x447bb3+':'+_0xa8b69a['id'],_0xa8b69a);FaxMessageEvents[_0xa672('0x7')](_0x447bb3,_0xa8b69a);_0x2c31cd(null);};}for(var e in events){if(events[_0xa672('0x8')](e)){var event=events[e];FaxMessage[_0xa672('0x9')](e,emitEvent(event));}}module[_0xa672('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 625fe1d..df31c24 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 _0xe727=['fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x3f074f,_0x2ad621){var _0x3f1bdc=function(_0x6f3f0b){while(--_0x6f3f0b){_0x3f074f['push'](_0x3f074f['shift']());}};_0x3f1bdc(++_0x2ad621);}(_0xe727,0x1e1));var _0x7e72=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe727[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7e72('0x0'));var util=require(_0x7e72('0x1'));var logger=require(_0x7e72('0x2'))(_0x7e72('0x3'));var moment=require(_0x7e72('0x4'));var BPromise=require(_0x7e72('0x5'));var rp=require(_0x7e72('0x6'));var fs=require('fs');var path=require(_0x7e72('0x7'));var rimraf=require(_0x7e72('0x8'));var config=require(_0x7e72('0x9'));var attributes=require(_0x7e72('0xa'));module[_0x7e72('0xb')]=function(_0x2053e4,_0x1ee85e){return _0x2053e4[_0x7e72('0xc')](_0x7e72('0xd'),attributes,{'tableName':_0x7e72('0xe'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x7e72('0xf')],'type':_0x7e72('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1259ba,_0xdecd43,_0x53c2ee){var _0x379cfe=_0x2053e4[_0x7e72('0x11')];var _0x415fad=_0x1259ba[_0x7e72('0x12')]({'plain':!![]});if(_0x415fad[_0x7e72('0x13')]['toLowerCase']()==='in'||_0x415fad['direction'][_0x7e72('0x14')]()===_0x7e72('0x15')&&!_0x415fad[_0x7e72('0x16')]&&!_[_0x7e72('0x17')](_0x415fad[_0x7e72('0x18')])){_0x379cfe[_0x7e72('0x19')][_0x7e72('0x1a')]({'where':{'id':_0x415fad[_0x7e72('0x1b')]}})['then'](function(_0x277d37){if(_0x277d37){_0x277d37[_0x7e72('0x1c')]({'lastMsgAt':_0x415fad[_0x7e72('0x1d')],'lastMsgDirection':_0x415fad[_0x7e72('0x13')][_0x7e72('0x14')]()});}})[_0x7e72('0x1e')](function(_0x2aaeab){console[_0x7e72('0x1f')](_0x2aaeab);});}_0x53c2ee();}},'charset':_0x7e72('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd449=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x191f56,_0x5678e0){var _0x49010c=function(_0x17ed88){while(--_0x17ed88){_0x191f56['push'](_0x191f56['shift']());}};_0x49010c(++_0x5678e0);}(_0xd449,0x82));var _0x9d44=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0xd449[_0x5de818];return _0x345670;};'use strict';var _=require('lodash');var util=require(_0x9d44('0x0'));var logger=require(_0x9d44('0x1'))(_0x9d44('0x2'));var moment=require('moment');var BPromise=require(_0x9d44('0x3'));var rp=require(_0x9d44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d44('0x5'));var config=require(_0x9d44('0x6'));var attributes=require(_0x9d44('0x7'));module[_0x9d44('0x8')]=function(_0x1c3697,_0x5d247b){return _0x1c3697['define'](_0x9d44('0x9'),attributes,{'tableName':_0x9d44('0xa'),'paranoid':![],'indexes':[{'name':_0x9d44('0xb'),'fields':[_0x9d44('0xc')],'type':_0x9d44('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xebb20b,_0x10ec5a,_0x55acfb){var _0x194fe8=_0x1c3697[_0x9d44('0xe')];var _0x5b060e=_0xebb20b[_0x9d44('0xf')]({'plain':!![]});if(_0x5b060e[_0x9d44('0x10')][_0x9d44('0x11')]()==='in'||_0x5b060e[_0x9d44('0x10')][_0x9d44('0x11')]()===_0x9d44('0x12')&&!_0x5b060e[_0x9d44('0x13')]&&!_[_0x9d44('0x14')](_0x5b060e[_0x9d44('0x15')])){_0x194fe8['FaxInteraction'][_0x9d44('0x16')]({'where':{'id':_0x5b060e[_0x9d44('0x17')]}})[_0x9d44('0x18')](function(_0x40f9c2){if(_0x40f9c2){_0x40f9c2['update']({'lastMsgAt':_0x5b060e['createdAt'],'lastMsgDirection':_0x5b060e['direction'][_0x9d44('0x11')]()});}})[_0x9d44('0x19')](function(_0x426b03){console[_0x9d44('0x1a')](_0x426b03);});}_0x55acfb();}},'charset':_0x9d44('0x1b'),'collate':_0x9d44('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 9c4d9e8..fd55a99 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 _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14c76a,_0x94b2b4){_0x14c76a=_0x14c76a-0x0;var _0x42cef7=_0x6f0d[_0x14c76a];return _0x42cef7;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x38a70a,_0x2399cf){var _0x4abb99=function(_0x1da004){while(--_0x1da004){_0x38a70a['push'](_0x38a70a['shift']());}};_0x4abb99(++_0x2399cf);}(_0x6aa7,0x178));var _0x76aa=function(_0x36cabc,_0x250804){_0x36cabc=_0x36cabc-0x0;var _0x168649=_0x6aa7[_0x36cabc];return _0x168649;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 59bc1c2..2257022 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 _0xd295=['register','faxMessage:','./faxMessage.events','remove','update','removeListener'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd295,0x8c));var _0x5d29=function(_0x1e29b6,_0x454a6b){_0x1e29b6=_0x1e29b6-0x0;var _0x3bf7ef=_0xd295[_0x1e29b6];return _0x3bf7ef;};'use strict';var FaxMessageEvents=require(_0x5d29('0x0'));var events=['save',_0x5d29('0x1'),_0x5d29('0x2')];function createListener(_0x28085c,_0x4d707e){return function(_0x37a198){_0x4d707e['emit'](_0x28085c,_0x37a198);};}function removeListener(_0x34b7c1,_0x229959){return function(){FaxMessageEvents[_0x5d29('0x3')](_0x34b7c1,_0x229959);};}exports[_0x5d29('0x4')]=function(_0x1be515){for(var _0x165bfb=0x0,_0xcec7=events['length'];_0x165bfb<_0xcec7;_0x165bfb++){var _0x1e6212=events[_0x165bfb];var _0x460219=createListener(_0x5d29('0x5')+_0x1e6212,_0x1be515);FaxMessageEvents['on'](_0x1e6212,_0x460219);}}; \ No newline at end of file +var _0xb2dd=['save','remove','register','length','faxMessage:','./faxMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2dd,0x1cd));var _0xdb2d=function(_0x232d09,_0x30a518){_0x232d09=_0x232d09-0x0;var _0x454385=_0xb2dd[_0x232d09];return _0x454385;};'use strict';var FaxMessageEvents=require(_0xdb2d('0x0'));var events=[_0xdb2d('0x1'),_0xdb2d('0x2'),'update'];function createListener(_0x2da89e,_0x2753c7){return function(_0x3eca7f){_0x2753c7['emit'](_0x2da89e,_0x3eca7f);};}function removeListener(_0x145a1a,_0x1b1813){return function(){FaxMessageEvents['removeListener'](_0x145a1a,_0x1b1813);};}exports[_0xdb2d('0x3')]=function(_0x2b899a){for(var _0xce23d0=0x0,_0x5b52b0=events[_0xdb2d('0x4')];_0xce23d0<_0x5b52b0;_0xce23d0++){var _0x4412ff=events[_0xce23d0];var _0x4df03e=createListener(_0xdb2d('0x5')+_0x4412ff,_0x2b899a);FaxMessageEvents['on'](_0x4412ff,_0x4df03e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c612ef1..02b6fb2 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 _0xd64b=['tracked','fax','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/download','post'];(function(_0x18a79e,_0x69ebe8){var _0x42bbea=function(_0x280e3f){while(--_0x280e3f){_0x18a79e['push'](_0x18a79e['shift']());}};_0x42bbea(++_0x69ebe8);}(_0xd64b,0xc1));var _0xbd64=function(_0xce755b,_0x58fb87){_0xce755b=_0xce755b-0x0;var _0x30d6da=_0xd64b[_0xce755b];return _0x30d6da;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0x8')](_0xbd64('0xd'),auth[_0xbd64('0xa')](),controller['download']);router[_0xbd64('0xe')]('/',auth[_0xbd64('0xa')](),interaction[_0xbd64('0xf')](_0xbd64('0x10'),'faxmessage:create'),controller[_0xbd64('0x11')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x12')]);router[_0xbd64('0x13')](_0xbd64('0x14'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x15')]);router[_0xbd64('0x13')](_0xbd64('0x16'),auth['isAuthenticated'](),controller[_0xbd64('0x17')]);router[_0xbd64('0x18')](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3f8c=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','tracked','fax','create','put'];(function(_0xbcfd78,_0x9d6f34){var _0x5d4815=function(_0x520ff7){while(--_0x520ff7){_0xbcfd78['push'](_0xbcfd78['shift']());}};_0x5d4815(++_0x9d6f34);}(_0x3f8c,0x104));var _0xc3f8=function(_0x13e044,_0x4ae1d7){_0x13e044=_0x13e044-0x0;var _0x393af0=_0x3f8c[_0x13e044];return _0x393af0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['describe']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['download']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),interaction[_0xc3f8('0xc')](_0xc3f8('0xd'),'faxmessage:create'),controller[_0xc3f8('0xe')]);router[_0xc3f8('0xf')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0xf')](_0xc3f8('0x10'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);router[_0xc3f8('0xf')](_0xc3f8('0x12'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x13')]);router[_0xc3f8('0x14')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x15')]);module[_0xc3f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e2c1c2a..dbdd1b4 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 _0x0ce9=['beepall','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x0ce9,0x9a));var _0x90ce=function(_0x280d57,_0x5e6418){_0x280d57=_0x280d57-0x0;var _0x39af06=_0x0ce9[_0x280d57];return _0x39af06;};'use strict';var Sequelize=require(_0x90ce('0x0'));module[_0x90ce('0x1')]={'name':{'type':Sequelize[_0x90ce('0x2')],'unique':_0x90ce('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x90ce('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x90ce('0x4')](_0x90ce('0x5'),_0x90ce('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x90ce('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d17=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x552e26,_0x3bceec){var _0x5aa7a3=function(_0x2503de){while(--_0x2503de){_0x552e26['push'](_0x552e26['shift']());}};_0x5aa7a3(++_0x3bceec);}(_0x0d17,0x119));var _0x70d1=function(_0x5a8c0e,_0x24f92d){_0x5a8c0e=_0x5a8c0e-0x0;var _0x39a8af=_0x0d17[_0x5a8c0e];return _0x39a8af;};'use strict';var Sequelize=require(_0x70d1('0x0'));module['exports']={'name':{'type':Sequelize[_0x70d1('0x1')],'unique':_0x70d1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x70d1('0x1')]},'timeout':{'type':Sequelize[_0x70d1('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x70d1('0x4')](_0x70d1('0x5'),_0x70d1('0x6'),'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 81ff794..a970985 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 _0x363e=['getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','include','query','FaxQueue','rows','show','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','length','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','findAll','User','findAndCountAll','UserId','faxPause','updatedAt','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','isArray'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x363e,0x179));var _0xe363=function(_0x33a925,_0x16b1ee){_0x33a925=_0x33a925-0x0;var _0x134841=_0x363e[_0x33a925];return _0x134841;};'use strict';var BPromise=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var _=require('lodash');var squel=require(_0xe363('0x2'));var Redis=require(_0xe363('0x3'));var qs=require(_0xe363('0x4'));var logger=require(_0xe363('0x5'))(_0xe363('0x6'));var config=require(_0xe363('0x7'));var db=require(_0xe363('0x8'))['db'];config[_0xe363('0x9')]=_[_0xe363('0xa')](config[_0xe363('0x9')],{'host':_0xe363('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe363('0x9')]));require(_0xe363('0xc'))[_0xe363('0xd')](socket);function respondWithStatusCode(_0x29d330,_0x515185){_0x515185=_0x515185||0xcc;return function(_0x24255d){if(_0x24255d){return _0x29d330[_0xe363('0xe')](_0x515185);}return _0x29d330[_0xe363('0xf')](_0x515185)[_0xe363('0x10')]();};}function respondWithResult(_0x29a78c,_0x4133e9){_0x4133e9=_0x4133e9||0xc8;return function(_0x3304a1){if(_0x3304a1){return _0x29a78c['status'](_0x4133e9)[_0xe363('0x11')](_0x3304a1);}};}function respondWithFilteredResult(_0x45cd96,_0x58d1b6){return function(_0x393a1f){if(_0x393a1f){var _0x5d031e=typeof _0x58d1b6['offset']===_0xe363('0x12')&&typeof _0x58d1b6[_0xe363('0x13')]===_0xe363('0x12');var _0x359f69=_0x393a1f[_0xe363('0x14')];var _0x563fbf=_0x5d031e?0x0:_0x58d1b6[_0xe363('0x15')];var _0x22b227=_0x5d031e?_0x393a1f['count']:_0x58d1b6[_0xe363('0x15')]+_0x58d1b6[_0xe363('0x13')];var _0x52e6c6;if(_0x22b227>=_0x359f69){_0x22b227=_0x359f69;_0x52e6c6=0xc8;}else{_0x52e6c6=0xce;}_0x45cd96[_0xe363('0xf')](_0x52e6c6);return _0x45cd96[_0xe363('0x16')]('Content-Range',_0x563fbf+'-'+_0x22b227+'/'+_0x359f69)[_0xe363('0x11')](_0x393a1f);}return null;};}function saveUpdates(_0xc94d0a){return function(_0x5e148d){if(_0x5e148d){return _0x5e148d[_0xe363('0x17')](_0xc94d0a)[_0xe363('0x18')](function(_0x2f2c20){return _0x2f2c20;});}return null;};}function removeEntity(_0x4dcba0){return function(_0x287104){if(_0x287104){return _0x287104[_0xe363('0x19')]()['then'](function(){var _0x37ea93=_0x287104[_0xe363('0x1a')]({'plain':!![]});var _0x1c4953=_0xe363('0x1b');return db[_0xe363('0x1c')][_0xe363('0x19')]({'where':{'type':_0x1c4953,'resourceId':_0x37ea93['id']}})['then'](function(){return _0x287104;});})[_0xe363('0x18')](function(){_0x4dcba0[_0xe363('0xf')](0xcc)[_0xe363('0x10')]();});}};}function handleEntityNotFound(_0x379b8a){return function(_0x43c9c0){if(!_0x43c9c0){_0x379b8a[_0xe363('0xe')](0x194);}return _0x43c9c0;};}function handleError(_0x24199a,_0xaff56f){_0xaff56f=_0xaff56f||0x1f4;return function(_0x41d04b){logger[_0xe363('0x1d')](_0x41d04b[_0xe363('0x1e')]);if(_0x41d04b[_0xe363('0x1f')]){delete _0x41d04b[_0xe363('0x1f')];}_0x24199a[_0xe363('0xf')](_0xaff56f)[_0xe363('0x20')](_0x41d04b);};}exports[_0xe363('0x21')]=function(_0xf9b981,_0xf9949b){var _0x19c7b4={};var _0x3e24ad={'count':0x0,'rows':[]};var _0x312d75=_[_0xe363('0x22')](db['FaxQueue'][_0xe363('0x23')],function(_0x12358b){return{'name':_0x12358b[_0xe363('0x24')],'type':_0x12358b[_0xe363('0x25')][_0xe363('0x26')]};});_0x19c7b4=qs['getOptions'](_0x312d75,_0xf9b981);var _0x33b50c={'where':_0x19c7b4[_0xe363('0x27')]};return db['FaxQueue'][_0xe363('0x14')](_0x33b50c)['then'](function(_0x3ed3e1){_0x3e24ad[_0xe363('0x14')]=_0x3ed3e1;_0x19c7b4['include']=qs[_0xe363('0x28')](_0xf9b981[_0xe363('0x29')]);return db[_0xe363('0x2a')]['findAll'](_0x19c7b4);})[_0xe363('0x18')](function(_0x32c9ab){_0x3e24ad[_0xe363('0x2b')]=_0x32c9ab;return _0x3e24ad;})[_0xe363('0x18')](respondWithFilteredResult(_0xf9949b,_0x19c7b4))['catch'](handleError(_0xf9949b,null));};exports[_0xe363('0x2c')]=function(_0x3869bd,_0x404b32){var _0x187a23={'raw':!![],'where':{'id':_0x3869bd[_0xe363('0x2d')]['id']}},_0x26ac10={};_0x26ac10[_0xe363('0x2e')]=_[_0xe363('0x2f')](db[_0xe363('0x2a')][_0xe363('0x23')]);_0x26ac10['query']=_['keys'](_0x3869bd[_0xe363('0x29')]);_0x26ac10[_0xe363('0x30')]=_['intersection'](_0x26ac10[_0xe363('0x2e')],_0x26ac10[_0xe363('0x29')]);_0x187a23['attributes']=_[_0xe363('0x31')](_0x26ac10[_0xe363('0x2e')],qs[_0xe363('0x32')](_0x3869bd[_0xe363('0x29')]['fields']));_0x187a23['attributes']=_0x187a23[_0xe363('0x33')]['length']?_0x187a23['attributes']:_0x26ac10[_0xe363('0x2e')];if(_0x3869bd[_0xe363('0x29')][_0xe363('0x34')]){_0x187a23[_0xe363('0x28')]=[{'all':!![]}];}_0x187a23=_[_0xe363('0x35')]({},_0x187a23,_0x3869bd[_0xe363('0x36')]);return db[_0xe363('0x2a')][_0xe363('0x37')](_0x187a23)[_0xe363('0x18')](handleEntityNotFound(_0x404b32,null))[_0xe363('0x18')](respondWithResult(_0x404b32,null))[_0xe363('0x38')](handleError(_0x404b32,null));};exports[_0xe363('0x39')]=function(_0x544532,_0x574af3){return db[_0xe363('0x2a')][_0xe363('0x39')](_0x544532[_0xe363('0x3a')],{})['then'](function(_0x534039){var _0x815550=_0x544532[_0xe363('0x3b')][_0xe363('0x1a')]({'plain':!![]});if(!_0x815550)throw new Error(_0xe363('0x3c'));if(_0x815550['role']===_0xe363('0x3b')){var _0x49b8c4=_0x534039[_0xe363('0x1a')]({'plain':!![]});var _0x2a279b=_0xe363('0x1b');return db[_0xe363('0x3d')][_0xe363('0x37')]({'where':{'name':_0x2a279b,'userProfileId':_0x815550[_0xe363('0x3e')]},'raw':!![]})[_0xe363('0x18')](function(_0x44f03c){if(_0x44f03c&&_0x44f03c[_0xe363('0x3f')]===0x0){return db['UserProfileResource']['create']({'name':_0x49b8c4[_0xe363('0x1f')],'resourceId':_0x49b8c4['id'],'type':_0x44f03c[_0xe363('0x1f')],'sectionId':_0x44f03c['id']},{})[_0xe363('0x18')](function(){return _0x534039;});}else{return _0x534039;}})[_0xe363('0x38')](function(_0x2fc2f0){logger[_0xe363('0x1d')](_0xe363('0x40'),_0x2fc2f0);throw _0x2fc2f0;});}return _0x534039;})[_0xe363('0x18')](respondWithResult(_0x574af3,0xc9))[_0xe363('0x38')](handleError(_0x574af3,null));};exports['update']=function(_0x3da5ba,_0x58b837){if(_0x3da5ba[_0xe363('0x3a')]['id']){delete _0x3da5ba['body']['id'];}return db[_0xe363('0x2a')][_0xe363('0x37')]({'where':{'id':_0x3da5ba['params']['id']}})[_0xe363('0x18')](handleEntityNotFound(_0x58b837,null))[_0xe363('0x18')](saveUpdates(_0x3da5ba[_0xe363('0x3a')],null))[_0xe363('0x18')](respondWithResult(_0x58b837,null))[_0xe363('0x38')](handleError(_0x58b837,null));};exports[_0xe363('0x19')]=function(_0x5f4bc0,_0x33a561){return db[_0xe363('0x2a')][_0xe363('0x37')]({'where':{'id':_0x5f4bc0[_0xe363('0x2d')]['id']}})[_0xe363('0x18')](handleEntityNotFound(_0x33a561,null))['then'](removeEntity(_0x33a561,null))[_0xe363('0x38')](handleError(_0x33a561,null));};exports[_0xe363('0x41')]=function(_0x3badf5,_0x18147d){return db[_0xe363('0x2a')][_0xe363('0x41')]()[_0xe363('0x18')](respondWithResult(_0x18147d,null))['catch'](handleError(_0x18147d,null));};exports['getMembers']=function(_0x234523,_0x23d249){var _0x8f6a76={'raw':!![],'where':{}},_0x4aa733={},_0x28b38d;return db[_0xe363('0x2a')]['findOne']({'where':{'id':_0x234523['params']['id']}})[_0xe363('0x18')](handleEntityNotFound(_0x23d249,null))[_0xe363('0x18')](function(_0x1a6c70){if(_0x1a6c70){_0x28b38d=_0x1a6c70[_0xe363('0x1a')]({'plain':!![]});_0x4aa733['model']=_[_0xe363('0x2f')](db[_0xe363('0x42')]['rawAttributes']);_0x4aa733['query']=_[_0xe363('0x2f')](_0x234523[_0xe363('0x29')]);_0x4aa733['filters']=_[_0xe363('0x31')](_0x4aa733['model'],_0x4aa733[_0xe363('0x29')]);_0x8f6a76[_0xe363('0x33')]=_['intersection'](_0x4aa733[_0xe363('0x2e')],qs[_0xe363('0x32')](_0x234523['query'][_0xe363('0x32')]));_0x8f6a76[_0xe363('0x33')]=_0x8f6a76['attributes'][_0xe363('0x43')]?_0x8f6a76['attributes']:_0x4aa733[_0xe363('0x2e')];if(!_0x234523[_0xe363('0x29')][_0xe363('0x44')](_0xe363('0x45'))){_0x8f6a76['limit']=qs[_0xe363('0x13')](_0x234523[_0xe363('0x29')][_0xe363('0x13')]);_0x8f6a76['offset']=qs[_0xe363('0x15')](_0x234523[_0xe363('0x29')][_0xe363('0x15')]);}_0x8f6a76['order']=qs[_0xe363('0x46')](_0x234523[_0xe363('0x29')]['sort']);_0x8f6a76[_0xe363('0x27')]=qs[_0xe363('0x30')](_[_0xe363('0x47')](_0x234523[_0xe363('0x29')],_0x4aa733[_0xe363('0x30')]));_0x8f6a76[_0xe363('0x27')][_0xe363('0x48')]=_0x1a6c70['id'];if(_0x234523[_0xe363('0x29')][_0xe363('0x49')]){_0x8f6a76[_0xe363('0x27')]=_[_0xe363('0x35')](_0x8f6a76[_0xe363('0x27')],{'$or':_[_0xe363('0x22')](_0x8f6a76['attributes'],function(_0x58ba21){var _0x696718={};_0x696718[_0x58ba21]={'$like':'%'+_0x234523[_0xe363('0x29')][_0xe363('0x49')]+'%'};return _0x696718;})});}_0x8f6a76=_[_0xe363('0x35')]({},_0x8f6a76,_0x234523[_0xe363('0x36')]);return db[_0xe363('0x42')][_0xe363('0x4a')](_0x8f6a76);}})[_0xe363('0x18')](function(_0x418e00){if(_0x418e00){return db[_0xe363('0x4b')][_0xe363('0x4c')]({'where':{'id':_[_0xe363('0x22')](_0x418e00,_0xe363('0x4d')),'role':'agent'},'attributes':['id',_0xe363('0x1f'),_0xe363('0x4e'),_0xe363('0x4f'),'createdAt']});}})[_0xe363('0x18')](function(_0xd18c3c){if(_0xd18c3c){return{'count':_0xd18c3c[_0xe363('0x14')],'rows':_[_0xe363('0x22')](_0xd18c3c[_0xe363('0x2b')],function(_0x5cb808){return{'membername':_0x5cb808['name'],'UserId':_0x5cb808['id'],'queue_name':_0x28b38d[_0xe363('0x1f')],'FaxQueueId':_0x28b38d['id'],'interface':util['format'](_0xe363('0x50'),_0xe363('0x51'),_0x5cb808[_0xe363('0x1f')]),'penalty':0x0,'paused':_0x5cb808[_0xe363('0x4e')],'createdAt':_0x5cb808[_0xe363('0x52')],'updatedAt':_0x5cb808[_0xe363('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe363('0x18')](respondWithFilteredResult(_0x23d249,_0x8f6a76))[_0xe363('0x38')](handleError(_0x23d249,null));};exports[_0xe363('0x53')]=function(_0x1d6310,_0x436127){var _0x4dfef5={};var _0x3e3cb8={};var _0xc949cf;var _0xace979;return db['FaxQueue'][_0xe363('0x54')]({'where':{'id':_0x1d6310[_0xe363('0x2d')]['id']}})[_0xe363('0x18')](handleEntityNotFound(_0x436127,null))[_0xe363('0x18')](function(_0x24da3a){if(_0x24da3a){_0xc949cf=_0x24da3a;_0x3e3cb8[_0xe363('0x2e')]=_[_0xe363('0x2f')](db[_0xe363('0x55')][_0xe363('0x23')]);_0x3e3cb8[_0xe363('0x29')]=_[_0xe363('0x2f')](_0x1d6310['query']);_0x3e3cb8['filters']=_[_0xe363('0x31')](_0x3e3cb8['model'],_0x3e3cb8[_0xe363('0x29')]);_0x4dfef5[_0xe363('0x33')]=_[_0xe363('0x31')](_0x3e3cb8[_0xe363('0x2e')],qs['fields'](_0x1d6310['query']['fields']));_0x4dfef5[_0xe363('0x33')]=_0x4dfef5[_0xe363('0x33')][_0xe363('0x43')]?_0x4dfef5[_0xe363('0x33')]:_0x3e3cb8['model'];_0x4dfef5['order']=qs[_0xe363('0x46')](_0x1d6310['query'][_0xe363('0x46')]);_0x4dfef5[_0xe363('0x27')]=qs[_0xe363('0x30')](_[_0xe363('0x47')](_0x1d6310[_0xe363('0x29')],_0x3e3cb8[_0xe363('0x30')]));if(_0x1d6310[_0xe363('0x29')][_0xe363('0x49')]){_0x4dfef5['where']=_[_0xe363('0x35')](_0x4dfef5[_0xe363('0x27')],{'$or':_['map'](_0x4dfef5[_0xe363('0x33')],function(_0x5714f2){var _0x5272d3={};_0x5272d3[_0x5714f2]={'$like':'%'+_0x1d6310[_0xe363('0x29')]['filter']+'%'};return _0x5272d3;})});}_0x4dfef5=_[_0xe363('0x35')]({},_0x4dfef5,_0x1d6310[_0xe363('0x36')]);return _0xc949cf['getTeams'](_0x4dfef5);}})[_0xe363('0x18')](function(_0x3876fb){if(_0x3876fb){_0xace979=_0x3876fb[_0xe363('0x43')];if(!_0x1d6310[_0xe363('0x29')]['hasOwnProperty'](_0xe363('0x45'))){_0x4dfef5['limit']=qs['limit'](_0x1d6310[_0xe363('0x29')][_0xe363('0x13')]);_0x4dfef5[_0xe363('0x15')]=qs[_0xe363('0x15')](_0x1d6310[_0xe363('0x29')][_0xe363('0x15')]);}return _0xc949cf[_0xe363('0x53')](_0x4dfef5);}})[_0xe363('0x18')](function(_0x17ff56){if(_0x17ff56){return _0x17ff56?{'count':_0xace979,'rows':_0x17ff56}:null;}})[_0xe363('0x18')](respondWithResult(_0x436127,null))[_0xe363('0x38')](handleError(_0x436127,null));};exports[_0xe363('0x56')]=function(_0x5abaa5,_0x1ac3a8){var _0xad373c=_0x5abaa5[_0xe363('0x3a')][_0xe363('0x57')];return db[_0xe363('0x55')]['findAll']({'where':{'id':_0xad373c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe363('0x58'),'attributes':['id',_0xe363('0x1f'),_0xe363('0x59'),_0xe363('0x5a'),_0xe363('0x5b')],'raw':!![]}]})[_0xe363('0x18')](function(_0x459807){if(_0x459807){var _0x445588=_['flatMap'](_0x459807,function(_0x379d16){var _0x3b3f63=_0x379d16[_0xe363('0x1a')]({'plain':!![]});return _0x3b3f63['Agents'];});return db['FaxQueue'][_0xe363('0x37')]({'where':{'id':_0x5abaa5['params']['id']}})['then'](function(_0x283104){return db[_0xe363('0x5c')][_0xe363('0x5d')](function(_0xa200e5){return _0x283104['addTeams'](_0xad373c,{'transaction':_0xa200e5})[_0xe363('0x18')](function(){return BPromise[_0xe363('0x5e')](_0x445588,function(_0x346c79){return db[_0xe363('0x42')][_0xe363('0x5f')]({'where':{'UserId':_0x346c79['id'],'FaxQueueId':_0x5abaa5[_0xe363('0x2d')]['id']},'transaction':_0xa200e5});});})['then'](function(){_0x445588[_0xe363('0x60')](function(_0x3404b4){socket[_0xe363('0x61')](_0xe363('0x62'),{'UserId':_0x3404b4['id'],'FaxQueueId':_0x283104['id']});});});});});}})['then'](respondWithStatusCode(_0x1ac3a8,null))[_0xe363('0x38')](handleError(_0x1ac3a8,null));};exports[_0xe363('0x63')]=function(_0x6937b6,_0x48be1b){return db['Team']['findAll']({'where':{'id':_0x6937b6[_0xe363('0x29')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe363('0x58'),'attributes':['id'],'raw':!![]}]})[_0xe363('0x18')](handleEntityNotFound(_0x48be1b,null))[_0xe363('0x18')](function(_0x170f63){var _0x7a1c97=_[_0xe363('0x22')](_0x170f63,'id');var _0xe9e6ce=[];var _0x4cf629=[];var _0x3f10a6=squel[_0xe363('0x64')]();_0x3f10a6[_0xe363('0x65')](_0xe363('0x66'))[_0xe363('0x67')](_0xe363('0x68'),'tq')['join'](_0xe363('0x69'),'ut',_0xe363('0x6a'))[_0xe363('0x27')]('FaxQueueId\x20=\x20?',_0x6937b6[_0xe363('0x2d')]['id']);for(var _0x5e1a3c=0x0;_0x5e1a3c<_0x170f63[_0xe363('0x43')];_0x5e1a3c+=0x1){let _0x23d7fb=_0x170f63[_0x5e1a3c];for(var _0x4f4628=0x0;_0x4f4628<_0x23d7fb[_0xe363('0x58')][_0xe363('0x43')];_0x4f4628+=0x1){let _0x2541f5=_0x23d7fb[_0xe363('0x58')][_0x4f4628];var _0xe4f7e9=_0x3f10a6[_0xe363('0x6b')]();_0xe4f7e9[_0xe363('0x27')](_0xe363('0x6c'),_0x2541f5['id']);_0x4cf629[_0xe363('0x6d')](db[_0xe363('0x5c')][_0xe363('0x29')](_0xe4f7e9[_0xe363('0x6e')](),{'type':db[_0xe363('0x5c')][_0xe363('0x6f')][_0xe363('0x70')]})[_0xe363('0x18')](function(_0x11c151){if(_0x11c151[_0xe363('0x43')]===0x1){return _0x2541f5['id'];}else{var _0x3aaa0d=_[_0xe363('0x71')](_[_0xe363('0x22')](_0x11c151,'TeamId'),function(_0x25a408){return _['includes'](_0x7a1c97,_0x25a408);});if(_0x3aaa0d){return _0x2541f5['id'];}}}));}}return BPromise[_0xe363('0x72')](_0x4cf629)[_0xe363('0x18')](function(_0x4f19b0){_0xe9e6ce=_(_0xe9e6ce)[_0xe363('0x73')](_0x4f19b0)[_0xe363('0x74')]()[_0xe363('0x75')]();return db[_0xe363('0x2a')][_0xe363('0x37')]({'where':{'id':_0x6937b6['params']['id']}})['then'](function(_0x1b689f){return db[_0xe363('0x5c')][_0xe363('0x5d')](function(_0x2ede84){return _0x1b689f[_0xe363('0x63')](_0x6937b6['query']['ids'],{'transaction':_0x2ede84})[_0xe363('0x18')](function(){if(!_['isEmpty'](_0xe9e6ce)){return _0x1b689f[_0xe363('0x76')](_0xe9e6ce,{'transaction':_0x2ede84});}})[_0xe363('0x18')](function(){_0xe9e6ce[_0xe363('0x60')](function(_0x17aec5){socket[_0xe363('0x61')](_0xe363('0x77'),{'UserId':_0x17aec5,'FaxQueueId':_0x1b689f['id']});});});});});});})[_0xe363('0x18')](respondWithStatusCode(_0x48be1b,null))[_0xe363('0x38')](handleError(_0x48be1b,null));};exports['addAgents']=function(_0x59a30f,_0x188fc3){return db[_0xe363('0x2a')][_0xe363('0x37')]({'where':{'id':_0x59a30f[_0xe363('0x2d')]['id']}})['then'](handleEntityNotFound(_0x188fc3,null))['then'](function(_0x11e504){if(_0x11e504){return _0x11e504[_0xe363('0x78')](_0x59a30f[_0xe363('0x3a')][_0xe363('0x57')],_[_0xe363('0x79')](_0x59a30f['body'],[_0xe363('0x57'),'id'])||{})['spread'](function(_0x9566f2){for(var _0x2197cb=0x0;_0x2197cb<_0x59a30f['body']['ids']['length'];_0x2197cb+=0x1){socket[_0xe363('0x61')](_0xe363('0x62'),{'UserId':Number(_0x59a30f[_0xe363('0x3a')]['ids'][_0x2197cb]),'FaxQueueId':Number(_0x59a30f[_0xe363('0x2d')]['id'])});}return _0x9566f2;});}})['then'](respondWithResult(_0x188fc3,null))[_0xe363('0x38')](handleError(_0x188fc3,null));};exports['removeAgents']=function(_0x279bb0,_0x440e33){return db[_0xe363('0x2a')][_0xe363('0x37')]({'where':{'id':_0x279bb0[_0xe363('0x2d')]['id']}})['then'](handleEntityNotFound(_0x440e33,null))[_0xe363('0x18')](function(_0x64257c){if(_0x64257c){return _0x64257c[_0xe363('0x76')](_0x279bb0[_0xe363('0x29')][_0xe363('0x57')])[_0xe363('0x18')](function(){if(_[_0xe363('0x7a')](_0x279bb0[_0xe363('0x29')][_0xe363('0x57')])){for(var _0x1059df=0x0;_0x1059df<_0x279bb0[_0xe363('0x29')][_0xe363('0x57')][_0xe363('0x43')];_0x1059df+=0x1){socket['emit'](_0xe363('0x77'),{'UserId':Number(_0x279bb0[_0xe363('0x29')][_0xe363('0x57')][_0x1059df]),'FaxQueueId':Number(_0x279bb0[_0xe363('0x2d')]['id'])});}}else{socket[_0xe363('0x61')](_0xe363('0x77'),{'UserId':Number(_0x279bb0['query']['ids']),'FaxQueueId':Number(_0x279bb0['params']['id'])});}});}})[_0xe363('0x18')](respondWithStatusCode(_0x440e33,null))[_0xe363('0x38')](handleError(_0x440e33,null));};exports[_0xe363('0x7b')]=function(_0x4419d6,_0x27ce3c){var _0x2b8bac={};var _0xf3ae80={};var _0x4e52e8;var _0xf661d0;return db[_0xe363('0x2a')]['findOne']({'where':{'id':_0x4419d6['params']['id']}})['then'](handleEntityNotFound(_0x27ce3c,null))[_0xe363('0x18')](function(_0x14837a){if(_0x14837a){_0x4e52e8=_0x14837a;_0xf3ae80[_0xe363('0x2e')]=_['keys'](db[_0xe363('0x4b')][_0xe363('0x23')]);_0xf3ae80[_0xe363('0x29')]=_[_0xe363('0x2f')](_0x4419d6[_0xe363('0x29')]);_0xf3ae80[_0xe363('0x30')]=_[_0xe363('0x31')](_0xf3ae80[_0xe363('0x2e')],_0xf3ae80[_0xe363('0x29')]);_0x2b8bac[_0xe363('0x33')]=_[_0xe363('0x31')](_0xf3ae80[_0xe363('0x2e')],qs['fields'](_0x4419d6[_0xe363('0x29')][_0xe363('0x32')]));_0x2b8bac[_0xe363('0x33')]=_0x2b8bac[_0xe363('0x33')][_0xe363('0x43')]?_0x2b8bac[_0xe363('0x33')]:_0xf3ae80['model'];_0x2b8bac[_0xe363('0x7c')]=qs[_0xe363('0x46')](_0x4419d6[_0xe363('0x29')][_0xe363('0x46')]);_0x2b8bac['where']=qs[_0xe363('0x30')](_[_0xe363('0x47')](_0x4419d6['query'],_0xf3ae80[_0xe363('0x30')]));if(_0x4419d6[_0xe363('0x29')][_0xe363('0x49')]){_0x2b8bac['where']=_[_0xe363('0x35')](_0x2b8bac['where'],{'$or':_['map'](_0x2b8bac['attributes'],function(_0x331fd6){var _0x4e516b={};_0x4e516b[_0x331fd6]={'$like':'%'+_0x4419d6[_0xe363('0x29')][_0xe363('0x49')]+'%'};return _0x4e516b;})});}_0x2b8bac=_[_0xe363('0x35')]({},_0x2b8bac,_0x4419d6[_0xe363('0x36')]);return _0x4e52e8[_0xe363('0x7b')](_0x2b8bac);}})['then'](function(_0x48caa8){if(_0x48caa8){_0xf661d0=_0x48caa8['length'];if(!_0x4419d6[_0xe363('0x29')][_0xe363('0x44')]('nolimit')){_0x2b8bac[_0xe363('0x13')]=qs[_0xe363('0x13')](_0x4419d6['query']['limit']);_0x2b8bac[_0xe363('0x15')]=qs[_0xe363('0x15')](_0x4419d6[_0xe363('0x29')][_0xe363('0x15')]);}return _0x4e52e8[_0xe363('0x7b')](_0x2b8bac);}})['then'](function(_0x57300c){if(_0x57300c){return _0x57300c?{'count':_0xf661d0,'rows':_0x57300c}:null;}})[_0xe363('0x18')](respondWithResult(_0x27ce3c,null))[_0xe363('0x38')](handleError(_0x27ce3c,null));}; \ No newline at end of file +var _0xed54=['includes','all','union','compact','transaction','isEmpty','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','end','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','include','query','rows','show','params','filters','intersection','attributes','fields','length','merge','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','keys','UserFaxQueue','model','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','findAll','User','findAndCountAll','createdAt','format','%s/%s','getTeams','Team','filter','ids','Agents','online','voicePause','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId'];(function(_0xdcbe98,_0x46a926){var _0x45b15a=function(_0x3d2d56){while(--_0x3d2d56){_0xdcbe98['push'](_0xdcbe98['shift']());}};_0x45b15a(++_0x46a926);}(_0xed54,0xfc));var _0x4ed5=function(_0x5aac02,_0x1e30cf){_0x5aac02=_0x5aac02-0x0;var _0x1a0856=_0xed54[_0x5aac02];return _0x1a0856;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ed5('0x0'));var _=require(_0x4ed5('0x1'));var squel=require(_0x4ed5('0x2'));var Redis=require(_0x4ed5('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x4ed5('0x4'))(_0x4ed5('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4ed5('0x6')]=_[_0x4ed5('0x7')](config[_0x4ed5('0x6')],{'host':_0x4ed5('0x8'),'port':0x18eb});var socket=require(_0x4ed5('0x9'))(new Redis(config[_0x4ed5('0x6')]));require(_0x4ed5('0xa'))['register'](socket);function respondWithStatusCode(_0x3993ac,_0xde3d51){_0xde3d51=_0xde3d51||0xcc;return function(_0x464a96){if(_0x464a96){return _0x3993ac[_0x4ed5('0xb')](_0xde3d51);}return _0x3993ac[_0x4ed5('0xc')](_0xde3d51)['end']();};}function respondWithResult(_0x23f1db,_0x3c027e){_0x3c027e=_0x3c027e||0xc8;return function(_0x191814){if(_0x191814){return _0x23f1db[_0x4ed5('0xc')](_0x3c027e)[_0x4ed5('0xd')](_0x191814);}};}function respondWithFilteredResult(_0x51c141,_0x223031){return function(_0x24f59d){if(_0x24f59d){var _0x279222=typeof _0x223031[_0x4ed5('0xe')]===_0x4ed5('0xf')&&typeof _0x223031[_0x4ed5('0x10')]===_0x4ed5('0xf');var _0x416ce0=_0x24f59d['count'];var _0x4c9fc0=_0x279222?0x0:_0x223031[_0x4ed5('0xe')];var _0x3468df=_0x279222?_0x24f59d[_0x4ed5('0x11')]:_0x223031[_0x4ed5('0xe')]+_0x223031[_0x4ed5('0x10')];var _0x148458;if(_0x3468df>=_0x416ce0){_0x3468df=_0x416ce0;_0x148458=0xc8;}else{_0x148458=0xce;}_0x51c141[_0x4ed5('0xc')](_0x148458);return _0x51c141[_0x4ed5('0x12')](_0x4ed5('0x13'),_0x4c9fc0+'-'+_0x3468df+'/'+_0x416ce0)[_0x4ed5('0xd')](_0x24f59d);}return null;};}function saveUpdates(_0x168916){return function(_0x35212c){if(_0x35212c){return _0x35212c[_0x4ed5('0x14')](_0x168916)[_0x4ed5('0x15')](function(_0x16a940){return _0x16a940;});}return null;};}function removeEntity(_0x38c405){return function(_0x584745){if(_0x584745){return _0x584745[_0x4ed5('0x16')]()[_0x4ed5('0x15')](function(){var _0x3bcbc4=_0x584745['get']({'plain':!![]});var _0x347bda=_0x4ed5('0x17');return db[_0x4ed5('0x18')][_0x4ed5('0x16')]({'where':{'type':_0x347bda,'resourceId':_0x3bcbc4['id']}})[_0x4ed5('0x15')](function(){return _0x584745;});})[_0x4ed5('0x15')](function(){_0x38c405[_0x4ed5('0xc')](0xcc)[_0x4ed5('0x19')]();});}};}function handleEntityNotFound(_0x4d202e){return function(_0x2d6495){if(!_0x2d6495){_0x4d202e[_0x4ed5('0xb')](0x194);}return _0x2d6495;};}function handleError(_0x4f59d2,_0x32d181){_0x32d181=_0x32d181||0x1f4;return function(_0x5f193f){logger['error'](_0x5f193f['stack']);if(_0x5f193f[_0x4ed5('0x1a')]){delete _0x5f193f['name'];}_0x4f59d2[_0x4ed5('0xc')](_0x32d181)[_0x4ed5('0x1b')](_0x5f193f);};}exports[_0x4ed5('0x1c')]=function(_0x2d59cd,_0x3070a3){var _0x28667a={};var _0x25833e={'count':0x0,'rows':[]};var _0x4f23c3=_[_0x4ed5('0x1d')](db[_0x4ed5('0x1e')][_0x4ed5('0x1f')],function(_0x3a60bc){return{'name':_0x3a60bc[_0x4ed5('0x20')],'type':_0x3a60bc['type'][_0x4ed5('0x21')]};});_0x28667a=qs[_0x4ed5('0x22')](_0x4f23c3,_0x2d59cd);var _0x34285f={'where':_0x28667a['where']};return db[_0x4ed5('0x1e')]['count'](_0x34285f)['then'](function(_0x2f3f5b){_0x25833e[_0x4ed5('0x11')]=_0x2f3f5b;_0x28667a['include']=qs[_0x4ed5('0x23')](_0x2d59cd[_0x4ed5('0x24')]);return db['FaxQueue']['findAll'](_0x28667a);})[_0x4ed5('0x15')](function(_0x34b359){_0x25833e[_0x4ed5('0x25')]=_0x34b359;return _0x25833e;})[_0x4ed5('0x15')](respondWithFilteredResult(_0x3070a3,_0x28667a))['catch'](handleError(_0x3070a3,null));};exports[_0x4ed5('0x26')]=function(_0x1cdbc4,_0x207673){var _0x40b791={'raw':!![],'where':{'id':_0x1cdbc4[_0x4ed5('0x27')]['id']}},_0x5cb925={};_0x5cb925['model']=_['keys'](db[_0x4ed5('0x1e')][_0x4ed5('0x1f')]);_0x5cb925['query']=_['keys'](_0x1cdbc4[_0x4ed5('0x24')]);_0x5cb925[_0x4ed5('0x28')]=_[_0x4ed5('0x29')](_0x5cb925['model'],_0x5cb925[_0x4ed5('0x24')]);_0x40b791[_0x4ed5('0x2a')]=_[_0x4ed5('0x29')](_0x5cb925['model'],qs['fields'](_0x1cdbc4['query'][_0x4ed5('0x2b')]));_0x40b791[_0x4ed5('0x2a')]=_0x40b791['attributes'][_0x4ed5('0x2c')]?_0x40b791['attributes']:_0x5cb925['model'];if(_0x1cdbc4[_0x4ed5('0x24')]['includeAll']){_0x40b791[_0x4ed5('0x23')]=[{'all':!![]}];}_0x40b791=_[_0x4ed5('0x2d')]({},_0x40b791,_0x1cdbc4[_0x4ed5('0x2e')]);return db[_0x4ed5('0x1e')][_0x4ed5('0x2f')](_0x40b791)[_0x4ed5('0x15')](handleEntityNotFound(_0x207673,null))[_0x4ed5('0x15')](respondWithResult(_0x207673,null))[_0x4ed5('0x30')](handleError(_0x207673,null));};exports[_0x4ed5('0x31')]=function(_0x4f21a0,_0x262f05){return db[_0x4ed5('0x1e')][_0x4ed5('0x31')](_0x4f21a0['body'],{})['then'](function(_0x57df5d){var _0x246112=_0x4f21a0['user']['get']({'plain':!![]});if(!_0x246112)throw new Error(_0x4ed5('0x32'));if(_0x246112[_0x4ed5('0x33')]===_0x4ed5('0x34')){var _0xd3726e=_0x57df5d[_0x4ed5('0x35')]({'plain':!![]});var _0x206ed2=_0x4ed5('0x17');return db[_0x4ed5('0x36')][_0x4ed5('0x2f')]({'where':{'name':_0x206ed2,'userProfileId':_0x246112[_0x4ed5('0x37')]},'raw':!![]})[_0x4ed5('0x15')](function(_0x3bf099){if(_0x3bf099&&_0x3bf099[_0x4ed5('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0xd3726e['name'],'resourceId':_0xd3726e['id'],'type':_0x3bf099[_0x4ed5('0x1a')],'sectionId':_0x3bf099['id']},{})['then'](function(){return _0x57df5d;});}else{return _0x57df5d;}})[_0x4ed5('0x30')](function(_0xbf9c15){logger['error'](_0x4ed5('0x39'),_0xbf9c15);throw _0xbf9c15;});}return _0x57df5d;})[_0x4ed5('0x15')](respondWithResult(_0x262f05,0xc9))['catch'](handleError(_0x262f05,null));};exports[_0x4ed5('0x14')]=function(_0x4a0b8d,_0xbaf044){if(_0x4a0b8d[_0x4ed5('0x3a')]['id']){delete _0x4a0b8d[_0x4ed5('0x3a')]['id'];}return db[_0x4ed5('0x1e')][_0x4ed5('0x2f')]({'where':{'id':_0x4a0b8d[_0x4ed5('0x27')]['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0xbaf044,null))[_0x4ed5('0x15')](saveUpdates(_0x4a0b8d[_0x4ed5('0x3a')],null))[_0x4ed5('0x15')](respondWithResult(_0xbaf044,null))[_0x4ed5('0x30')](handleError(_0xbaf044,null));};exports['destroy']=function(_0x34479a,_0x5455c1){return db['FaxQueue']['find']({'where':{'id':_0x34479a[_0x4ed5('0x27')]['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0x5455c1,null))[_0x4ed5('0x15')](removeEntity(_0x5455c1,null))[_0x4ed5('0x30')](handleError(_0x5455c1,null));};exports[_0x4ed5('0x3b')]=function(_0x53f287,_0x3ffa68){return db[_0x4ed5('0x1e')][_0x4ed5('0x3b')]()[_0x4ed5('0x15')](respondWithResult(_0x3ffa68,null))[_0x4ed5('0x30')](handleError(_0x3ffa68,null));};exports[_0x4ed5('0x3c')]=function(_0x403e66,_0x48e87b){var _0x1c4b29={'raw':!![],'where':{}},_0x1de7e9={},_0x178706;return db['FaxQueue'][_0x4ed5('0x3d')]({'where':{'id':_0x403e66['params']['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0x48e87b,null))[_0x4ed5('0x15')](function(_0x8ec127){if(_0x8ec127){_0x178706=_0x8ec127[_0x4ed5('0x35')]({'plain':!![]});_0x1de7e9['model']=_[_0x4ed5('0x3e')](db[_0x4ed5('0x3f')][_0x4ed5('0x1f')]);_0x1de7e9['query']=_[_0x4ed5('0x3e')](_0x403e66[_0x4ed5('0x24')]);_0x1de7e9[_0x4ed5('0x28')]=_[_0x4ed5('0x29')](_0x1de7e9[_0x4ed5('0x40')],_0x1de7e9[_0x4ed5('0x24')]);_0x1c4b29[_0x4ed5('0x2a')]=_[_0x4ed5('0x29')](_0x1de7e9['model'],qs['fields'](_0x403e66[_0x4ed5('0x24')]['fields']));_0x1c4b29[_0x4ed5('0x2a')]=_0x1c4b29[_0x4ed5('0x2a')][_0x4ed5('0x2c')]?_0x1c4b29[_0x4ed5('0x2a')]:_0x1de7e9['model'];if(!_0x403e66[_0x4ed5('0x24')][_0x4ed5('0x41')](_0x4ed5('0x42'))){_0x1c4b29[_0x4ed5('0x10')]=qs[_0x4ed5('0x10')](_0x403e66[_0x4ed5('0x24')][_0x4ed5('0x10')]);_0x1c4b29[_0x4ed5('0xe')]=qs[_0x4ed5('0xe')](_0x403e66[_0x4ed5('0x24')][_0x4ed5('0xe')]);}_0x1c4b29[_0x4ed5('0x43')]=qs[_0x4ed5('0x44')](_0x403e66[_0x4ed5('0x24')][_0x4ed5('0x44')]);_0x1c4b29[_0x4ed5('0x45')]=qs[_0x4ed5('0x28')](_[_0x4ed5('0x46')](_0x403e66['query'],_0x1de7e9[_0x4ed5('0x28')]));_0x1c4b29[_0x4ed5('0x45')][_0x4ed5('0x47')]=_0x8ec127['id'];if(_0x403e66[_0x4ed5('0x24')]['filter']){_0x1c4b29[_0x4ed5('0x45')]=_['merge'](_0x1c4b29['where'],{'$or':_[_0x4ed5('0x1d')](_0x1c4b29['attributes'],function(_0x4d7ee7){var _0x3153d0={};_0x3153d0[_0x4d7ee7]={'$like':'%'+_0x403e66[_0x4ed5('0x24')]['filter']+'%'};return _0x3153d0;})});}_0x1c4b29=_[_0x4ed5('0x2d')]({},_0x1c4b29,_0x403e66[_0x4ed5('0x2e')]);return db['UserFaxQueue'][_0x4ed5('0x48')](_0x1c4b29);}})['then'](function(_0x5268cb){if(_0x5268cb){return db[_0x4ed5('0x49')][_0x4ed5('0x4a')]({'where':{'id':_['map'](_0x5268cb,'UserId'),'role':'agent'},'attributes':['id',_0x4ed5('0x1a'),'faxPause','updatedAt',_0x4ed5('0x4b')]});}})[_0x4ed5('0x15')](function(_0x174449){if(_0x174449){return{'count':_0x174449[_0x4ed5('0x11')],'rows':_[_0x4ed5('0x1d')](_0x174449[_0x4ed5('0x25')],function(_0x59ad10){return{'membername':_0x59ad10[_0x4ed5('0x1a')],'UserId':_0x59ad10['id'],'queue_name':_0x178706[_0x4ed5('0x1a')],'FaxQueueId':_0x178706['id'],'interface':util[_0x4ed5('0x4c')](_0x4ed5('0x4d'),'SIP',_0x59ad10[_0x4ed5('0x1a')]),'penalty':0x0,'paused':_0x59ad10['faxPause'],'createdAt':_0x59ad10[_0x4ed5('0x4b')],'updatedAt':_0x59ad10['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48e87b,_0x1c4b29))[_0x4ed5('0x30')](handleError(_0x48e87b,null));};exports[_0x4ed5('0x4e')]=function(_0xd6be69,_0xe7ea55){var _0x582584={};var _0x5497bc={};var _0x250bbb;var _0xebe200;return db['FaxQueue'][_0x4ed5('0x3d')]({'where':{'id':_0xd6be69[_0x4ed5('0x27')]['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0xe7ea55,null))['then'](function(_0x469f2a){if(_0x469f2a){_0x250bbb=_0x469f2a;_0x5497bc['model']=_[_0x4ed5('0x3e')](db[_0x4ed5('0x4f')][_0x4ed5('0x1f')]);_0x5497bc[_0x4ed5('0x24')]=_[_0x4ed5('0x3e')](_0xd6be69[_0x4ed5('0x24')]);_0x5497bc[_0x4ed5('0x28')]=_[_0x4ed5('0x29')](_0x5497bc[_0x4ed5('0x40')],_0x5497bc[_0x4ed5('0x24')]);_0x582584[_0x4ed5('0x2a')]=_[_0x4ed5('0x29')](_0x5497bc[_0x4ed5('0x40')],qs['fields'](_0xd6be69[_0x4ed5('0x24')]['fields']));_0x582584[_0x4ed5('0x2a')]=_0x582584['attributes']['length']?_0x582584[_0x4ed5('0x2a')]:_0x5497bc['model'];_0x582584[_0x4ed5('0x43')]=qs['sort'](_0xd6be69[_0x4ed5('0x24')][_0x4ed5('0x44')]);_0x582584[_0x4ed5('0x45')]=qs['filters'](_[_0x4ed5('0x46')](_0xd6be69['query'],_0x5497bc[_0x4ed5('0x28')]));if(_0xd6be69[_0x4ed5('0x24')]['filter']){_0x582584[_0x4ed5('0x45')]=_['merge'](_0x582584[_0x4ed5('0x45')],{'$or':_[_0x4ed5('0x1d')](_0x582584['attributes'],function(_0x5a33b4){var _0x172cd2={};_0x172cd2[_0x5a33b4]={'$like':'%'+_0xd6be69[_0x4ed5('0x24')][_0x4ed5('0x50')]+'%'};return _0x172cd2;})});}_0x582584=_[_0x4ed5('0x2d')]({},_0x582584,_0xd6be69[_0x4ed5('0x2e')]);return _0x250bbb[_0x4ed5('0x4e')](_0x582584);}})[_0x4ed5('0x15')](function(_0xad1317){if(_0xad1317){_0xebe200=_0xad1317[_0x4ed5('0x2c')];if(!_0xd6be69[_0x4ed5('0x24')][_0x4ed5('0x41')](_0x4ed5('0x42'))){_0x582584[_0x4ed5('0x10')]=qs[_0x4ed5('0x10')](_0xd6be69[_0x4ed5('0x24')][_0x4ed5('0x10')]);_0x582584[_0x4ed5('0xe')]=qs[_0x4ed5('0xe')](_0xd6be69[_0x4ed5('0x24')][_0x4ed5('0xe')]);}return _0x250bbb[_0x4ed5('0x4e')](_0x582584);}})[_0x4ed5('0x15')](function(_0x152fe6){if(_0x152fe6){return _0x152fe6?{'count':_0xebe200,'rows':_0x152fe6}:null;}})['then'](respondWithResult(_0xe7ea55,null))[_0x4ed5('0x30')](handleError(_0xe7ea55,null));};exports['addTeams']=function(_0x2b04b1,_0x503645){var _0x2d5f36=_0x2b04b1[_0x4ed5('0x3a')][_0x4ed5('0x51')];return db[_0x4ed5('0x4f')]['findAll']({'where':{'id':_0x2d5f36},'attributes':['id'],'include':[{'model':db[_0x4ed5('0x49')],'as':_0x4ed5('0x52'),'attributes':['id','name',_0x4ed5('0x53'),_0x4ed5('0x54'),'interface'],'raw':!![]}]})[_0x4ed5('0x15')](function(_0x189a9c){if(_0x189a9c){var _0x542daa=_[_0x4ed5('0x55')](_0x189a9c,function(_0x42983c){var _0x1b2a18=_0x42983c[_0x4ed5('0x35')]({'plain':!![]});return _0x1b2a18[_0x4ed5('0x52')];});return db[_0x4ed5('0x1e')][_0x4ed5('0x2f')]({'where':{'id':_0x2b04b1['params']['id']}})[_0x4ed5('0x15')](function(_0x3ba7ad){return db[_0x4ed5('0x56')]['transaction'](function(_0x494e0d){return _0x3ba7ad[_0x4ed5('0x57')](_0x2d5f36,{'transaction':_0x494e0d})[_0x4ed5('0x15')](function(){return BPromise[_0x4ed5('0x58')](_0x542daa,function(_0x24f9a1){return db[_0x4ed5('0x3f')][_0x4ed5('0x59')]({'where':{'UserId':_0x24f9a1['id'],'FaxQueueId':_0x2b04b1[_0x4ed5('0x27')]['id']},'transaction':_0x494e0d});});})[_0x4ed5('0x15')](function(){_0x542daa[_0x4ed5('0x5a')](function(_0x5e9543){socket[_0x4ed5('0x5b')]('userFaxQueue:save',{'UserId':_0x5e9543['id'],'FaxQueueId':_0x3ba7ad['id']});});});});});}})[_0x4ed5('0x15')](respondWithStatusCode(_0x503645,null))['catch'](handleError(_0x503645,null));};exports[_0x4ed5('0x5c')]=function(_0x3ea338,_0x5ef86e){return db[_0x4ed5('0x4f')]['findAll']({'where':{'id':_0x3ea338['query'][_0x4ed5('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4ed5('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5ef86e,null))[_0x4ed5('0x15')](function(_0x46c629){var _0x2a88d7=_['map'](_0x46c629,'id');var _0x469e0f=[];var _0x419efc=[];var _0x5b7afe=squel[_0x4ed5('0x5d')]();_0x5b7afe[_0x4ed5('0x5e')](_0x4ed5('0x5f'))[_0x4ed5('0x60')](_0x4ed5('0x61'),'tq')[_0x4ed5('0x62')](_0x4ed5('0x63'),'ut',_0x4ed5('0x64'))[_0x4ed5('0x45')]('FaxQueueId\x20=\x20?',_0x3ea338[_0x4ed5('0x27')]['id']);for(var _0x4d01ec=0x0;_0x4d01ec<_0x46c629[_0x4ed5('0x2c')];_0x4d01ec+=0x1){let _0x17b15=_0x46c629[_0x4d01ec];for(var _0xe4575b=0x0;_0xe4575b<_0x17b15['Agents']['length'];_0xe4575b+=0x1){let _0x3a5e89=_0x17b15[_0x4ed5('0x52')][_0xe4575b];var _0x35ef90=_0x5b7afe[_0x4ed5('0x65')]();_0x35ef90[_0x4ed5('0x45')](_0x4ed5('0x66'),_0x3a5e89['id']);_0x419efc[_0x4ed5('0x67')](db[_0x4ed5('0x56')][_0x4ed5('0x24')](_0x35ef90[_0x4ed5('0x68')](),{'type':db[_0x4ed5('0x56')][_0x4ed5('0x69')][_0x4ed5('0x6a')]})['then'](function(_0x2980c8){if(_0x2980c8[_0x4ed5('0x2c')]===0x1){return _0x3a5e89['id'];}else{var _0x246a71=_['every'](_[_0x4ed5('0x1d')](_0x2980c8,_0x4ed5('0x6b')),function(_0xeb45ff){return _[_0x4ed5('0x6c')](_0x2a88d7,_0xeb45ff);});if(_0x246a71){return _0x3a5e89['id'];}}}));}}return BPromise[_0x4ed5('0x6d')](_0x419efc)[_0x4ed5('0x15')](function(_0x3f0a8b){_0x469e0f=_(_0x469e0f)[_0x4ed5('0x6e')](_0x3f0a8b)[_0x4ed5('0x6f')]()['value']();return db['FaxQueue'][_0x4ed5('0x2f')]({'where':{'id':_0x3ea338[_0x4ed5('0x27')]['id']}})['then'](function(_0x302ce9){return db[_0x4ed5('0x56')][_0x4ed5('0x70')](function(_0x1c8b21){return _0x302ce9[_0x4ed5('0x5c')](_0x3ea338[_0x4ed5('0x24')][_0x4ed5('0x51')],{'transaction':_0x1c8b21})[_0x4ed5('0x15')](function(){if(!_[_0x4ed5('0x71')](_0x469e0f)){return _0x302ce9['removeAgents'](_0x469e0f,{'transaction':_0x1c8b21});}})[_0x4ed5('0x15')](function(){_0x469e0f['forEach'](function(_0x184f17){socket['emit'](_0x4ed5('0x72'),{'UserId':_0x184f17,'FaxQueueId':_0x302ce9['id']});});});});});});})[_0x4ed5('0x15')](respondWithStatusCode(_0x5ef86e,null))[_0x4ed5('0x30')](handleError(_0x5ef86e,null));};exports[_0x4ed5('0x73')]=function(_0x3ab1ff,_0x11a467){return db[_0x4ed5('0x1e')]['find']({'where':{'id':_0x3ab1ff[_0x4ed5('0x27')]['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0x11a467,null))[_0x4ed5('0x15')](function(_0x23e0ce){if(_0x23e0ce){return _0x23e0ce[_0x4ed5('0x73')](_0x3ab1ff[_0x4ed5('0x3a')][_0x4ed5('0x51')],_[_0x4ed5('0x74')](_0x3ab1ff[_0x4ed5('0x3a')],[_0x4ed5('0x51'),'id'])||{})[_0x4ed5('0x75')](function(_0x1828d9){for(var _0x557e4b=0x0;_0x557e4b<_0x3ab1ff[_0x4ed5('0x3a')][_0x4ed5('0x51')]['length'];_0x557e4b+=0x1){socket[_0x4ed5('0x5b')]('userFaxQueue:save',{'UserId':Number(_0x3ab1ff[_0x4ed5('0x3a')][_0x4ed5('0x51')][_0x557e4b]),'FaxQueueId':Number(_0x3ab1ff['params']['id'])});}return _0x1828d9;});}})[_0x4ed5('0x15')](respondWithResult(_0x11a467,null))[_0x4ed5('0x30')](handleError(_0x11a467,null));};exports['removeAgents']=function(_0x440b17,_0x3299d8){return db[_0x4ed5('0x1e')][_0x4ed5('0x2f')]({'where':{'id':_0x440b17[_0x4ed5('0x27')]['id']}})[_0x4ed5('0x15')](handleEntityNotFound(_0x3299d8,null))['then'](function(_0x155886){if(_0x155886){return _0x155886['removeAgents'](_0x440b17['query'][_0x4ed5('0x51')])[_0x4ed5('0x15')](function(){if(_[_0x4ed5('0x76')](_0x440b17['query'][_0x4ed5('0x51')])){for(var _0x1aa180=0x0;_0x1aa180<_0x440b17['query'][_0x4ed5('0x51')]['length'];_0x1aa180+=0x1){socket[_0x4ed5('0x5b')]('userFaxQueue:remove',{'UserId':Number(_0x440b17[_0x4ed5('0x24')][_0x4ed5('0x51')][_0x1aa180]),'FaxQueueId':Number(_0x440b17[_0x4ed5('0x27')]['id'])});}}else{socket[_0x4ed5('0x5b')](_0x4ed5('0x72'),{'UserId':Number(_0x440b17[_0x4ed5('0x24')][_0x4ed5('0x51')]),'FaxQueueId':Number(_0x440b17[_0x4ed5('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x3299d8,null))[_0x4ed5('0x30')](handleError(_0x3299d8,null));};exports['getAgents']=function(_0x5e17b7,_0x4c5dca){var _0x583748={};var _0x5124c2={};var _0x55bbd2;var _0x5ed278;return db[_0x4ed5('0x1e')][_0x4ed5('0x3d')]({'where':{'id':_0x5e17b7[_0x4ed5('0x27')]['id']}})['then'](handleEntityNotFound(_0x4c5dca,null))[_0x4ed5('0x15')](function(_0x3674f0){if(_0x3674f0){_0x55bbd2=_0x3674f0;_0x5124c2[_0x4ed5('0x40')]=_[_0x4ed5('0x3e')](db[_0x4ed5('0x49')][_0x4ed5('0x1f')]);_0x5124c2[_0x4ed5('0x24')]=_[_0x4ed5('0x3e')](_0x5e17b7[_0x4ed5('0x24')]);_0x5124c2['filters']=_['intersection'](_0x5124c2[_0x4ed5('0x40')],_0x5124c2[_0x4ed5('0x24')]);_0x583748[_0x4ed5('0x2a')]=_[_0x4ed5('0x29')](_0x5124c2[_0x4ed5('0x40')],qs[_0x4ed5('0x2b')](_0x5e17b7[_0x4ed5('0x24')][_0x4ed5('0x2b')]));_0x583748[_0x4ed5('0x2a')]=_0x583748['attributes'][_0x4ed5('0x2c')]?_0x583748[_0x4ed5('0x2a')]:_0x5124c2[_0x4ed5('0x40')];_0x583748['order']=qs[_0x4ed5('0x44')](_0x5e17b7[_0x4ed5('0x24')]['sort']);_0x583748['where']=qs[_0x4ed5('0x28')](_['pick'](_0x5e17b7[_0x4ed5('0x24')],_0x5124c2['filters']));if(_0x5e17b7[_0x4ed5('0x24')][_0x4ed5('0x50')]){_0x583748[_0x4ed5('0x45')]=_[_0x4ed5('0x2d')](_0x583748[_0x4ed5('0x45')],{'$or':_[_0x4ed5('0x1d')](_0x583748[_0x4ed5('0x2a')],function(_0x4a8a87){var _0x2f6364={};_0x2f6364[_0x4a8a87]={'$like':'%'+_0x5e17b7['query'][_0x4ed5('0x50')]+'%'};return _0x2f6364;})});}_0x583748=_[_0x4ed5('0x2d')]({},_0x583748,_0x5e17b7['options']);return _0x55bbd2[_0x4ed5('0x77')](_0x583748);}})[_0x4ed5('0x15')](function(_0x41f34c){if(_0x41f34c){_0x5ed278=_0x41f34c[_0x4ed5('0x2c')];if(!_0x5e17b7['query']['hasOwnProperty'](_0x4ed5('0x42'))){_0x583748[_0x4ed5('0x10')]=qs[_0x4ed5('0x10')](_0x5e17b7[_0x4ed5('0x24')][_0x4ed5('0x10')]);_0x583748['offset']=qs[_0x4ed5('0xe')](_0x5e17b7['query'][_0x4ed5('0xe')]);}return _0x55bbd2[_0x4ed5('0x77')](_0x583748);}})[_0x4ed5('0x15')](function(_0x345ca3){if(_0x345ca3){return _0x345ca3?{'count':_0x5ed278,'rows':_0x345ca3}:null;}})['then'](respondWithResult(_0x4c5dca,null))['catch'](handleError(_0x4c5dca,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 71553da..6f38c5f 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 _0x2bb4=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x223e1a,_0x3e471b){var _0x4757bb=function(_0x2574f4){while(--_0x2574f4){_0x223e1a['push'](_0x223e1a['shift']());}};_0x4757bb(++_0x3e471b);}(_0x2bb4,0x18c));var _0x42bb=function(_0x509195,_0x100287){_0x509195=_0x509195-0x0;var _0x195357=_0x2bb4[_0x509195];return _0x195357;};'use strict';var EventEmitter=require(_0x42bb('0x0'));var FaxQueue=require(_0x42bb('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x42bb('0x2'),'afterUpdate':_0x42bb('0x3'),'afterDestroy':_0x42bb('0x4')};function emitEvent(_0x37ca6f){return function(_0x312e3a,_0x3b0951,_0x410806){FaxQueueEvents[_0x42bb('0x5')](_0x37ca6f+':'+_0x312e3a['id'],_0x312e3a);FaxQueueEvents[_0x42bb('0x5')](_0x37ca6f,_0x312e3a);_0x410806(null);};}for(var e in events){if(events[_0x42bb('0x6')](e)){var event=events[e];FaxQueue[_0x42bb('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x6300=['update','remove','emit','hasOwnProperty','exports','events','FaxQueue'];(function(_0x15fa8e,_0x4d7bc2){var _0x33e21d=function(_0x4cfb53){while(--_0x4cfb53){_0x15fa8e['push'](_0x15fa8e['shift']());}};_0x33e21d(++_0x4d7bc2);}(_0x6300,0x171));var _0x0630=function(_0x20548f,_0xda0407){_0x20548f=_0x20548f-0x0;var _0x47dae9=_0x6300[_0x20548f];return _0x47dae9;};'use strict';var EventEmitter=require(_0x0630('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0630('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0630('0x2'),'afterDestroy':_0x0630('0x3')};function emitEvent(_0x318e81){return function(_0x4e84fd,_0x5af0ce,_0x16de7b){FaxQueueEvents[_0x0630('0x4')](_0x318e81+':'+_0x4e84fd['id'],_0x4e84fd);FaxQueueEvents[_0x0630('0x4')](_0x318e81,_0x4e84fd);_0x16de7b(null);};}for(var e in events){if(events[_0x0630('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0630('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 28bc3ac..189e572 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 _0x3b13=['FaxQueue','fax_queues','lodash','util','api','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x5f46ff,_0x448bb3){var _0x4688c9=function(_0x214efe){while(--_0x214efe){_0x5f46ff['push'](_0x5f46ff['shift']());}};_0x4688c9(++_0x448bb3);}(_0x3b13,0xf2));var _0x33b1=function(_0x16d991,_0x3f07cc){_0x16d991=_0x16d991-0x0;var _0x4f41c3=_0x3b13[_0x16d991];return _0x4f41c3;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var logger=require('../../config/logger')(_0x33b1('0x2'));var moment=require('moment');var BPromise=require(_0x33b1('0x3'));var rp=require(_0x33b1('0x4'));var fs=require('fs');var path=require(_0x33b1('0x5'));var rimraf=require('rimraf');var config=require(_0x33b1('0x6'));var attributes=require(_0x33b1('0x7'));module[_0x33b1('0x8')]=function(_0x26a8ee,_0x4dae2b){return _0x26a8ee[_0x33b1('0x9')](_0x33b1('0xa'),attributes,{'tableName':_0x33b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbba=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x13b124,_0xf093d9){var _0x2211d9=function(_0x287555){while(--_0x287555){_0x13b124['push'](_0x13b124['shift']());}};_0x2211d9(++_0xf093d9);}(_0xdbba,0x1e9));var _0xadbb=function(_0x5c1101,_0xa14555){_0x5c1101=_0x5c1101-0x0;var _0x155475=_0xdbba[_0x5c1101];return _0x155475;};'use strict';var _=require('lodash');var util=require(_0xadbb('0x0'));var logger=require(_0xadbb('0x1'))(_0xadbb('0x2'));var moment=require(_0xadbb('0x3'));var BPromise=require('bluebird');var rp=require(_0xadbb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadbb('0x5'));var config=require('../../config/environment');var attributes=require(_0xadbb('0x6'));module[_0xadbb('0x7')]=function(_0x448207,_0x4cd854){return _0x448207[_0xadbb('0x8')](_0xadbb('0x9'),attributes,{'tableName':_0xadbb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 05cd992..ee4dd81 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 _0xa685=['model','stringify','ShowFaxQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','attributes','map','include'];(function(_0x1b99d4,_0x393a85){var _0x5e27a4=function(_0x11af05){while(--_0x11af05){_0x1b99d4['push'](_0x1b99d4['shift']());}};_0x5e27a4(++_0x393a85);}(_0xa685,0x12b));var _0x5a68=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xa685[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0x5a68('0x0'));var util=require(_0x5a68('0x1'));var moment=require(_0x5a68('0x2'));var BPromise=require(_0x5a68('0x3'));var rs=require(_0x5a68('0x4'));var fs=require('fs');var Redis=require(_0x5a68('0x5'));var db=require(_0x5a68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a68('0x7'))(_0x5a68('0x8'));var config=require(_0x5a68('0x9'));var jayson=require(_0x5a68('0xa'));var client=jayson[_0x5a68('0xb')]['http']({'port':0x232a});config[_0x5a68('0xc')]=_[_0x5a68('0xd')](config[_0x5a68('0xc')],{'host':_0x5a68('0xe'),'port':0x18eb});var socket=require(_0x5a68('0xf'))(new Redis(config[_0x5a68('0xc')]));require('./faxQueue.socket')[_0x5a68('0x10')](socket);function respondWithRpcPromise(_0x50624d,_0x285f9b,_0x4fbacf){return new BPromise(function(_0x18d081,_0x4b1a4e){return client[_0x5a68('0x11')](_0x50624d,_0x4fbacf)[_0x5a68('0x12')](function(_0x41f1c7){logger[_0x5a68('0x13')](_0x5a68('0x14'),_0x285f9b,_0x5a68('0x15'));logger[_0x5a68('0x16')](_0x5a68('0x17'),_0x285f9b,_0x5a68('0x15'),JSON['stringify'](_0x41f1c7));if(_0x41f1c7[_0x5a68('0x18')]){if(_0x41f1c7[_0x5a68('0x18')][_0x5a68('0x19')]===0x1f4){logger[_0x5a68('0x18')](_0x5a68('0x14'),_0x285f9b,_0x41f1c7[_0x5a68('0x18')][_0x5a68('0x1a')]);return _0x4b1a4e(_0x41f1c7['error'][_0x5a68('0x1a')]);}logger[_0x5a68('0x18')]('FaxQueue,\x20%s,\x20%s',_0x285f9b,_0x41f1c7[_0x5a68('0x18')][_0x5a68('0x1a')]);return _0x18d081(_0x41f1c7['error'][_0x5a68('0x1a')]);}else{logger[_0x5a68('0x13')](_0x5a68('0x14'),_0x285f9b,_0x5a68('0x15'));_0x18d081(_0x41f1c7[_0x5a68('0x1b')]['message']);}})[_0x5a68('0x1c')](function(_0xa9a749){logger[_0x5a68('0x18')](_0x5a68('0x14'),_0x285f9b,_0xa9a749);_0x4b1a4e(_0xa9a749);});});}exports[_0x5a68('0x1d')]=function(_0x654c02){var _0x3a0d87=this;return new Promise(function(_0x4aa404,_0x19649d){return db[_0x5a68('0x1e')][_0x5a68('0x1f')]({'raw':_0x654c02['options']?_0x654c02['options'][_0x5a68('0x20')]===undefined?!![]:![]:!![],'where':_0x654c02['options']?_0x654c02['options']['where']||null:null,'attributes':_0x654c02[_0x5a68('0x21')]?_0x654c02[_0x5a68('0x21')][_0x5a68('0x22')]||null:null,'limit':_0x654c02[_0x5a68('0x21')]?_0x654c02['options']['limit']||null:null,'include':_0x654c02[_0x5a68('0x21')]?_0x654c02[_0x5a68('0x21')]['include']?_[_0x5a68('0x23')](_0x654c02[_0x5a68('0x21')][_0x5a68('0x24')],function(_0x2f5b86){return{'model':db[_0x2f5b86[_0x5a68('0x25')]],'as':_0x2f5b86['as'],'attributes':_0x2f5b86[_0x5a68('0x22')],'include':_0x2f5b86['include']?_[_0x5a68('0x23')](_0x2f5b86[_0x5a68('0x24')],function(_0x313c18){return{'model':db[_0x313c18[_0x5a68('0x25')]],'as':_0x313c18['as'],'attributes':_0x313c18[_0x5a68('0x22')],'include':_0x313c18[_0x5a68('0x24')]?_[_0x5a68('0x23')](_0x313c18['include'],function(_0x2035a0){return{'model':db[_0x2035a0['model']],'as':_0x2035a0['as'],'attributes':_0x2035a0[_0x5a68('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x310fd1){logger[_0x5a68('0x13')](_0x5a68('0x1d'),_0x654c02);logger[_0x5a68('0x16')](_0x5a68('0x1d'),_0x654c02,JSON[_0x5a68('0x26')](_0x310fd1));_0x4aa404(_0x310fd1);})[_0x5a68('0x1c')](function(_0x3c6f61){logger[_0x5a68('0x18')](_0x5a68('0x1d'),_0x3c6f61[_0x5a68('0x1a')],_0x654c02);_0x19649d(_0x3a0d87[_0x5a68('0x18')](0x1f4,_0x3c6f61['message']));});});};exports[_0x5a68('0x27')]=function(_0x555e8c){var _0x555dca=this;return new Promise(function(_0x3b706c,_0x51bf28){return db[_0x5a68('0x1e')][_0x5a68('0x28')]({'raw':_0x555e8c[_0x5a68('0x21')]?_0x555e8c[_0x5a68('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x555e8c[_0x5a68('0x21')]?_0x555e8c['options'][_0x5a68('0x29')]||null:null,'attributes':_0x555e8c[_0x5a68('0x21')]?_0x555e8c[_0x5a68('0x21')]['attributes']||null:null,'include':_0x555e8c['options']?_0x555e8c[_0x5a68('0x21')][_0x5a68('0x24')]?_[_0x5a68('0x23')](_0x555e8c[_0x5a68('0x21')][_0x5a68('0x24')],function(_0x23b214){return{'model':db[_0x23b214[_0x5a68('0x25')]],'as':_0x23b214['as'],'attributes':_0x23b214[_0x5a68('0x22')],'include':_0x23b214[_0x5a68('0x24')]?_['map'](_0x23b214[_0x5a68('0x24')],function(_0x3f1800){return{'model':db[_0x3f1800['model']],'as':_0x3f1800['as'],'attributes':_0x3f1800[_0x5a68('0x22')],'include':_0x3f1800[_0x5a68('0x24')]?_['map'](_0x3f1800[_0x5a68('0x24')],function(_0x27013b){return{'model':db[_0x27013b[_0x5a68('0x25')]],'as':_0x27013b['as'],'attributes':_0x27013b[_0x5a68('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x802b5b){logger[_0x5a68('0x13')]('ShowFaxQueue',_0x555e8c);logger[_0x5a68('0x16')]('ShowFaxQueue',_0x555e8c,JSON[_0x5a68('0x26')](_0x802b5b));_0x3b706c(_0x802b5b);})[_0x5a68('0x1c')](function(_0x4b5f8f){logger['error'](_0x5a68('0x27'),_0x4b5f8f[_0x5a68('0x1a')],_0x555e8c);_0x51bf28(_0x555dca[_0x5a68('0x18')](0x1f4,_0x4b5f8f[_0x5a68('0x1a')]));});});}; \ No newline at end of file +var _0x86cd=['GetFaxQueue','FaxQueue','options','raw','limit','include','map','model','attributes','ShowFaxQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0xe71818,_0x1317b5){var _0x34eb8f=function(_0x311b5c){while(--_0x311b5c){_0xe71818['push'](_0xe71818['shift']());}};_0x34eb8f(++_0x1317b5);}(_0x86cd,0x18e));var _0xd86c=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x86cd[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0xd86c('0x0'));var util=require(_0xd86c('0x1'));var moment=require(_0xd86c('0x2'));var BPromise=require(_0xd86c('0x3'));var rs=require(_0xd86c('0x4'));var fs=require('fs');var Redis=require(_0xd86c('0x5'));var db=require(_0xd86c('0x6'))['db'];var utils=require(_0xd86c('0x7'));var logger=require(_0xd86c('0x8'))(_0xd86c('0x9'));var config=require(_0xd86c('0xa'));var jayson=require(_0xd86c('0xb'));var client=jayson[_0xd86c('0xc')][_0xd86c('0xd')]({'port':0x232a});config['redis']=_[_0xd86c('0xe')](config['redis'],{'host':_0xd86c('0xf'),'port':0x18eb});var socket=require(_0xd86c('0x10'))(new Redis(config['redis']));require(_0xd86c('0x11'))[_0xd86c('0x12')](socket);function respondWithRpcPromise(_0x5209a3,_0x5c0652,_0x297c25){return new BPromise(function(_0x3e01db,_0x3180bf){return client[_0xd86c('0x13')](_0x5209a3,_0x297c25)[_0xd86c('0x14')](function(_0x5746d7){logger[_0xd86c('0x15')](_0xd86c('0x16'),_0x5c0652,_0xd86c('0x17'));logger[_0xd86c('0x18')](_0xd86c('0x19'),_0x5c0652,_0xd86c('0x17'),JSON[_0xd86c('0x1a')](_0x5746d7));if(_0x5746d7['error']){if(_0x5746d7['error'][_0xd86c('0x1b')]===0x1f4){logger[_0xd86c('0x1c')](_0xd86c('0x16'),_0x5c0652,_0x5746d7[_0xd86c('0x1c')]['message']);return _0x3180bf(_0x5746d7[_0xd86c('0x1c')][_0xd86c('0x1d')]);}logger[_0xd86c('0x1c')]('FaxQueue,\x20%s,\x20%s',_0x5c0652,_0x5746d7[_0xd86c('0x1c')]['message']);return _0x3e01db(_0x5746d7['error'][_0xd86c('0x1d')]);}else{logger[_0xd86c('0x15')](_0xd86c('0x16'),_0x5c0652,_0xd86c('0x17'));_0x3e01db(_0x5746d7[_0xd86c('0x1e')][_0xd86c('0x1d')]);}})[_0xd86c('0x1f')](function(_0x34670a){logger[_0xd86c('0x1c')](_0xd86c('0x16'),_0x5c0652,_0x34670a);_0x3180bf(_0x34670a);});});}exports[_0xd86c('0x20')]=function(_0x32939c){var _0x5a326b=this;return new Promise(function(_0x15be6c,_0x49fe6d){return db[_0xd86c('0x21')]['findAll']({'raw':_0x32939c[_0xd86c('0x22')]?_0x32939c['options'][_0xd86c('0x23')]===undefined?!![]:![]:!![],'where':_0x32939c['options']?_0x32939c['options']['where']||null:null,'attributes':_0x32939c[_0xd86c('0x22')]?_0x32939c[_0xd86c('0x22')]['attributes']||null:null,'limit':_0x32939c['options']?_0x32939c[_0xd86c('0x22')][_0xd86c('0x24')]||null:null,'include':_0x32939c[_0xd86c('0x22')]?_0x32939c[_0xd86c('0x22')][_0xd86c('0x25')]?_[_0xd86c('0x26')](_0x32939c['options']['include'],function(_0x228bb6){return{'model':db[_0x228bb6[_0xd86c('0x27')]],'as':_0x228bb6['as'],'attributes':_0x228bb6[_0xd86c('0x28')],'include':_0x228bb6['include']?_[_0xd86c('0x26')](_0x228bb6[_0xd86c('0x25')],function(_0x4f0ab2){return{'model':db[_0x4f0ab2[_0xd86c('0x27')]],'as':_0x4f0ab2['as'],'attributes':_0x4f0ab2[_0xd86c('0x28')],'include':_0x4f0ab2['include']?_[_0xd86c('0x26')](_0x4f0ab2[_0xd86c('0x25')],function(_0x65cb5f){return{'model':db[_0x65cb5f[_0xd86c('0x27')]],'as':_0x65cb5f['as'],'attributes':_0x65cb5f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd86c('0x14')](function(_0x235193){logger['info'](_0xd86c('0x20'),_0x32939c);logger[_0xd86c('0x18')](_0xd86c('0x20'),_0x32939c,JSON[_0xd86c('0x1a')](_0x235193));_0x15be6c(_0x235193);})[_0xd86c('0x1f')](function(_0x3ca87a){logger['error'](_0xd86c('0x20'),_0x3ca87a[_0xd86c('0x1d')],_0x32939c);_0x49fe6d(_0x5a326b['error'](0x1f4,_0x3ca87a[_0xd86c('0x1d')]));});});};exports[_0xd86c('0x29')]=function(_0x3727d3){var _0x520bbb=this;return new Promise(function(_0x579b9f,_0x5849af){return db[_0xd86c('0x21')]['find']({'raw':_0x3727d3[_0xd86c('0x22')]?_0x3727d3[_0xd86c('0x22')][_0xd86c('0x23')]===undefined?!![]:![]:!![],'where':_0x3727d3[_0xd86c('0x22')]?_0x3727d3[_0xd86c('0x22')][_0xd86c('0x2a')]||null:null,'attributes':_0x3727d3[_0xd86c('0x22')]?_0x3727d3[_0xd86c('0x22')][_0xd86c('0x28')]||null:null,'include':_0x3727d3[_0xd86c('0x22')]?_0x3727d3['options'][_0xd86c('0x25')]?_[_0xd86c('0x26')](_0x3727d3[_0xd86c('0x22')][_0xd86c('0x25')],function(_0x39a570){return{'model':db[_0x39a570['model']],'as':_0x39a570['as'],'attributes':_0x39a570[_0xd86c('0x28')],'include':_0x39a570[_0xd86c('0x25')]?_['map'](_0x39a570[_0xd86c('0x25')],function(_0x2b18c5){return{'model':db[_0x2b18c5[_0xd86c('0x27')]],'as':_0x2b18c5['as'],'attributes':_0x2b18c5[_0xd86c('0x28')],'include':_0x2b18c5[_0xd86c('0x25')]?_['map'](_0x2b18c5[_0xd86c('0x25')],function(_0x4aca18){return{'model':db[_0x4aca18[_0xd86c('0x27')]],'as':_0x4aca18['as'],'attributes':_0x4aca18[_0xd86c('0x28')]};}):[]};}):[]};}):[]:[]})[_0xd86c('0x14')](function(_0x52c3f7){logger[_0xd86c('0x15')](_0xd86c('0x29'),_0x3727d3);logger[_0xd86c('0x18')](_0xd86c('0x29'),_0x3727d3,JSON[_0xd86c('0x1a')](_0x52c3f7));_0x579b9f(_0x52c3f7);})[_0xd86c('0x1f')](function(_0x4ff2ab){logger[_0xd86c('0x1c')]('ShowFaxQueue',_0x4ff2ab['message'],_0x3727d3);_0x5849af(_0x520bbb[_0xd86c('0x1c')](0x1f4,_0x4ff2ab[_0xd86c('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0e16482..1ca150f 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 _0x3a7e=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1a1667,_0x2224b1){var _0x45a134=function(_0x362be7){while(--_0x362be7){_0x1a1667['push'](_0x1a1667['shift']());}};_0x45a134(++_0x2224b1);}(_0x3a7e,0x1cd));var _0xe3a7=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x3a7e[_0x151381];return _0x2afab6;};'use strict';var FaxQueueEvents=require(_0xe3a7('0x0'));var events=['save','remove',_0xe3a7('0x1')];function createListener(_0x378da0,_0x1dd5c8){return function(_0x11cc66){_0x1dd5c8[_0xe3a7('0x2')](_0x378da0,_0x11cc66);};}function removeListener(_0x354b99,_0x3a599f){return function(){FaxQueueEvents[_0xe3a7('0x3')](_0x354b99,_0x3a599f);};}exports[_0xe3a7('0x4')]=function(_0x1dfd5e){for(var _0x1c015d=0x0,_0x1b64e8=events[_0xe3a7('0x5')];_0x1c015d<_0x1b64e8;_0x1c015d++){var _0x119dd7=events[_0x1c015d];var _0x253660=createListener(_0xe3a7('0x6')+_0x119dd7,_0x1dfd5e);FaxQueueEvents['on'](_0x119dd7,_0x253660);}}; \ No newline at end of file +var _0x72d2=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x3c9eef,_0x2ade23){var _0x48662d=function(_0xa634b7){while(--_0xa634b7){_0x3c9eef['push'](_0x3c9eef['shift']());}};_0x48662d(++_0x2ade23);}(_0x72d2,0xb9));var _0x272d=function(_0x2868ec,_0x3aef29){_0x2868ec=_0x2868ec-0x0;var _0x2ad998=_0x72d2[_0x2868ec];return _0x2ad998;};'use strict';var FaxQueueEvents=require(_0x272d('0x0'));var events=[_0x272d('0x1'),_0x272d('0x2'),_0x272d('0x3')];function createListener(_0x44f502,_0x337382){return function(_0x22e815){_0x337382[_0x272d('0x4')](_0x44f502,_0x22e815);};}function removeListener(_0x22275f,_0x1df0ce){return function(){FaxQueueEvents[_0x272d('0x5')](_0x22275f,_0x1df0ce);};}exports[_0x272d('0x6')]=function(_0x1ed486){for(var _0x188810=0x0,_0x405da5=events[_0x272d('0x7')];_0x188810<_0x405da5;_0x188810++){var _0x31c825=events[_0x188810];var _0x1dd6ce=createListener(_0x272d('0x8')+_0x31c825,_0x1ed486);FaxQueueEvents['on'](_0x31c825,_0x1dd6ce);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 71b22e9..a11ded7 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 _0x77d4=['getTeams','/:id/users','create','/:id/teams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','util','connect-timeout','Router','fs-extra','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','show','/:id/members'];(function(_0x5308ff,_0x593ed4){var _0x38e643=function(_0x248dc5){while(--_0x248dc5){_0x5308ff['push'](_0x5308ff['shift']());}};_0x38e643(++_0x593ed4);}(_0x77d4,0x108));var _0x477d=function(_0x551c89,_0x49d911){_0x551c89=_0x551c89-0x0;var _0x220e4a=_0x77d4[_0x551c89];return _0x220e4a;};'use strict';var multer=require('multer');var util=require(_0x477d('0x0'));var path=require('path');var timeout=require(_0x477d('0x1'));var express=require('express');var router=express[_0x477d('0x2')]();var fs_extra=require(_0x477d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x477d('0x4'));var controller=require(_0x477d('0x5'));router[_0x477d('0x6')]('/',auth[_0x477d('0x7')](),controller[_0x477d('0x8')]);router[_0x477d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x477d('0x9')]);router['get']('/:id',auth[_0x477d('0x7')](),controller[_0x477d('0xa')]);router[_0x477d('0x6')](_0x477d('0xb'),auth[_0x477d('0x7')](),controller['getMembers']);router[_0x477d('0x6')]('/:id/teams',auth[_0x477d('0x7')](),controller[_0x477d('0xc')]);router['get'](_0x477d('0xd'),auth[_0x477d('0x7')](),controller['getAgents']);router['post']('/',auth[_0x477d('0x7')](),controller[_0x477d('0xe')]);router['post'](_0x477d('0xf'),auth[_0x477d('0x7')](),controller['addTeams']);router['post'](_0x477d('0xd'),auth['isAuthenticated'](),controller[_0x477d('0x10')]);router[_0x477d('0x11')](_0x477d('0x12'),auth['isAuthenticated'](),controller[_0x477d('0x13')]);router[_0x477d('0x14')](_0x477d('0x12'),auth[_0x477d('0x7')](),controller['destroy']);router[_0x477d('0x14')]('/:id/teams',auth[_0x477d('0x7')](),controller[_0x477d('0x15')]);router[_0x477d('0x14')](_0x477d('0xd'),auth[_0x477d('0x7')](),controller[_0x477d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xafb9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xafb9,0x68));var _0x9afb=function(_0x28757c,_0x334192){_0x28757c=_0x28757c-0x0;var _0x851d24=_0xafb9[_0x28757c];return _0x851d24;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/describe',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0x9')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller['getMembers']);router['get'](_0x9afb('0xf'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x9')](_0x9afb('0x11'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x12')]);router[_0x9afb('0x13')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0x14')]);router['post'](_0x9afb('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9afb('0x13')](_0x9afb('0x11'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x15')]);router[_0x9afb('0x16')](_0x9afb('0x17'),auth[_0x9afb('0xb')](),controller['update']);router[_0x9afb('0x18')](_0x9afb('0x17'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x19')]);router[_0x9afb('0x18')]('/:id/teams',auth[_0x9afb('0xb')](),controller['removeTeams']);router[_0x9afb('0x18')](_0x9afb('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9afb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5ccaa4f..ad84572 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 _0xa169=['DATE','moment','sequelize','STRING'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xa169,0x1ed));var _0x9a16=function(_0x2a8781,_0x11ae3d){_0x2a8781=_0x2a8781-0x0;var _0x4831e3=_0xa169[_0x2a8781];return _0x4831e3;};'use strict';var moment=require(_0x9a16('0x0'));var Sequelize=require(_0x9a16('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9a16('0x2')]},'joinAt':{'type':Sequelize[_0x9a16('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9a16('0x2')]}}; \ No newline at end of file +var _0xb9b3=['STRING','DATE','moment','sequelize'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xb9b3,0x1a6));var _0x3b9b=function(_0x482528,_0x4607c0){_0x482528=_0x482528-0x0;var _0x210a42=_0xb9b3[_0x482528];return _0x210a42;};'use strict';var moment=require(_0x3b9b('0x0'));var Sequelize=require(_0x3b9b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b9b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3b9b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3b9b('0x3')]},'exitAt':{'type':Sequelize[_0x3b9b('0x3')]},'reason':{'type':Sequelize[_0x3b9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index bbb2999..8744ec0 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 _0xe80c=['order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','show','params','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','count','limit','Content-Range','reject','save','then','destroy','status','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x406d90,_0x462d52){var _0x373cfe=function(_0x15358d){while(--_0x15358d){_0x406d90['push'](_0x406d90['shift']());}};_0x373cfe(++_0x462d52);}(_0xe80c,0x1c2));var _0xce80=function(_0x5d24c7,_0x45cd1f){_0x5d24c7=_0x5d24c7-0x0;var _0x3baf0d=_0xe80c[_0x5d24c7];return _0x3baf0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce80('0x0'));var zipdir=require(_0xce80('0x1'));var jsonpatch=require(_0xce80('0x2'));var rp=require(_0xce80('0x3'));var moment=require(_0xce80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce80('0x5'));var util=require(_0xce80('0x6'));var path=require(_0xce80('0x7'));var sox=require(_0xce80('0x8'));var csv=require('to-csv');var ejs=require(_0xce80('0x9'));var fs=require('fs');var fs_extra=require(_0xce80('0xa'));var _=require(_0xce80('0xb'));var squel=require('squel');var crypto=require(_0xce80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce80('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce80('0xe'));var Papa=require(_0xce80('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce80('0x10'));var as=require(_0xce80('0x11'));var hardwareService=require(_0xce80('0x12'));var logger=require(_0xce80('0x13'))(_0xce80('0x14'));var utils=require(_0xce80('0x15'));var config=require(_0xce80('0x16'));var licenseUtil=require(_0xce80('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a9b7,_0x37561b){_0x37561b=_0x37561b||0xcc;return function(_0x12d8c7){if(_0x12d8c7){return _0x45a9b7['sendStatus'](_0x37561b);}return _0x45a9b7['status'](_0x37561b)[_0xce80('0x18')]();};}function respondWithResult(_0x1903ec,_0x15f870){_0x15f870=_0x15f870||0xc8;return function(_0x3cac82){if(_0x3cac82){return _0x1903ec['status'](_0x15f870)[_0xce80('0x19')](_0x3cac82);}};}function respondWithFilteredResult(_0x5d134e,_0x9402b9){return function(_0x48796f){if(_0x48796f){var _0x24efa3=typeof _0x9402b9[_0xce80('0x1a')]==='undefined'&&typeof _0x9402b9['limit']==='undefined';var _0x35b40d=_0x48796f[_0xce80('0x1b')];var _0x148d57=_0x24efa3?0x0:_0x9402b9[_0xce80('0x1a')];var _0x4375b7=_0x24efa3?_0x48796f['count']:_0x9402b9[_0xce80('0x1a')]+_0x9402b9[_0xce80('0x1c')];var _0x4d4345;if(_0x4375b7>=_0x35b40d){_0x4375b7=_0x35b40d;_0x4d4345=0xc8;}else{_0x4d4345=0xce;}_0x5d134e['status'](_0x4d4345);return _0x5d134e['set'](_0xce80('0x1d'),_0x148d57+'-'+_0x4375b7+'/'+_0x35b40d)[_0xce80('0x19')](_0x48796f);}return null;};}function patchUpdates(_0x468b61){return function(_0x44f399){try{jsonpatch['apply'](_0x44f399,_0x468b61,!![]);}catch(_0x259a0b){return BPromise[_0xce80('0x1e')](_0x259a0b);}return _0x44f399[_0xce80('0x1f')]();};}function saveUpdates(_0x5315eb,_0x4df9bb){return function(_0x116b5e){if(_0x116b5e){return _0x116b5e['update'](_0x5315eb)[_0xce80('0x20')](function(_0x348d2d){return _0x348d2d;});}return null;};}function removeEntity(_0x2c5d01,_0x34f511){return function(_0x4fc91c){if(_0x4fc91c){return _0x4fc91c[_0xce80('0x21')]()['then'](function(){_0x2c5d01[_0xce80('0x22')](0xcc)[_0xce80('0x18')]();});}};}function handleEntityNotFound(_0x4cd1f5,_0x48080b){return function(_0x2b2dc3){if(!_0x2b2dc3){_0x4cd1f5['sendStatus'](0x194);}return _0x2b2dc3;};}function handleError(_0x2b7a4a,_0x1017f1){_0x1017f1=_0x1017f1||0x1f4;return function(_0x2a935a){logger[_0xce80('0x23')](_0x2a935a['stack']);if(_0x2a935a[_0xce80('0x24')]){delete _0x2a935a[_0xce80('0x24')];}_0x2b7a4a[_0xce80('0x22')](_0x1017f1)[_0xce80('0x25')](_0x2a935a);};}exports[_0xce80('0x26')]=function(_0x4792fe,_0x4d8796){var _0x6d1190={},_0x51b5bf={},_0x40cd7e={'count':0x0,'rows':[]};var _0x43ffb6=_[_0xce80('0x27')](db[_0xce80('0x28')][_0xce80('0x29')],function(_0x2f445c){return{'name':_0x2f445c[_0xce80('0x2a')],'type':_0x2f445c['type'][_0xce80('0x2b')]};});_0x51b5bf['model']=_['map'](_0x43ffb6,_0xce80('0x24'));_0x51b5bf[_0xce80('0x2c')]=_[_0xce80('0x2d')](_0x4792fe[_0xce80('0x2c')]);_0x51b5bf[_0xce80('0x2e')]=_[_0xce80('0x2f')](_0x51b5bf[_0xce80('0x30')],_0x51b5bf[_0xce80('0x2c')]);_0x6d1190['attributes']=_[_0xce80('0x2f')](_0x51b5bf['model'],qs[_0xce80('0x31')](_0x4792fe[_0xce80('0x2c')][_0xce80('0x31')]));_0x6d1190[_0xce80('0x32')]=_0x6d1190[_0xce80('0x32')][_0xce80('0x33')]?_0x6d1190['attributes']:_0x51b5bf[_0xce80('0x30')];if(!_0x4792fe[_0xce80('0x2c')][_0xce80('0x34')](_0xce80('0x35'))){_0x6d1190[_0xce80('0x1c')]=qs[_0xce80('0x1c')](_0x4792fe['query']['limit']);_0x6d1190[_0xce80('0x1a')]=qs[_0xce80('0x1a')](_0x4792fe[_0xce80('0x2c')][_0xce80('0x1a')]);}_0x6d1190[_0xce80('0x36')]=qs['sort'](_0x4792fe[_0xce80('0x2c')][_0xce80('0x37')]);_0x6d1190[_0xce80('0x38')]=qs[_0xce80('0x2e')](_[_0xce80('0x39')](_0x4792fe[_0xce80('0x2c')],_0x51b5bf[_0xce80('0x2e')]),_0x43ffb6);if(_0x4792fe[_0xce80('0x2c')][_0xce80('0x3a')]){_0x6d1190[_0xce80('0x38')]=_['merge'](_0x6d1190[_0xce80('0x38')],{'$or':_['map'](_0x43ffb6,function(_0x79ad39){if(_0x79ad39[_0xce80('0x3b')]!==_0xce80('0x3c')){var _0x2c87ce={};_0x2c87ce[_0x79ad39[_0xce80('0x24')]]={'$like':'%'+_0x4792fe['query'][_0xce80('0x3a')]+'%'};return _0x2c87ce;}})});}_0x6d1190=_[_0xce80('0x3d')]({},_0x6d1190,_0x4792fe[_0xce80('0x3e')]);var _0x53715e={'where':_0x6d1190[_0xce80('0x38')]};return db['FaxQueueReport'][_0xce80('0x1b')](_0x53715e)[_0xce80('0x20')](function(_0x3a5b0e){_0x40cd7e[_0xce80('0x1b')]=_0x3a5b0e;if(_0x4792fe[_0xce80('0x2c')][_0xce80('0x3f')]){_0x6d1190['include']=[{'all':!![]}];}return db[_0xce80('0x28')][_0xce80('0x40')](_0x6d1190);})[_0xce80('0x20')](function(_0x12bb2c){_0x40cd7e['rows']=_0x12bb2c;return _0x40cd7e;})[_0xce80('0x20')](respondWithFilteredResult(_0x4d8796,_0x6d1190))['catch'](handleError(_0x4d8796,null));};exports[_0xce80('0x41')]=function(_0x30b72c,_0x3e2edd){var _0x4167b9={'raw':!![],'where':{'id':_0x30b72c[_0xce80('0x42')]['id']}},_0x338393={};_0x338393[_0xce80('0x30')]=_[_0xce80('0x2d')](db[_0xce80('0x28')]['rawAttributes']);_0x338393[_0xce80('0x2c')]=_[_0xce80('0x2d')](_0x30b72c[_0xce80('0x2c')]);_0x338393['filters']=_[_0xce80('0x2f')](_0x338393[_0xce80('0x30')],_0x338393[_0xce80('0x2c')]);_0x4167b9['attributes']=_[_0xce80('0x2f')](_0x338393['model'],qs[_0xce80('0x31')](_0x30b72c[_0xce80('0x2c')][_0xce80('0x31')]));_0x4167b9['attributes']=_0x4167b9[_0xce80('0x32')][_0xce80('0x33')]?_0x4167b9[_0xce80('0x32')]:_0x338393['model'];if(_0x30b72c[_0xce80('0x2c')]['includeAll']){_0x4167b9['include']=[{'all':!![]}];}_0x4167b9=_[_0xce80('0x3d')]({},_0x4167b9,_0x30b72c[_0xce80('0x3e')]);return db[_0xce80('0x28')][_0xce80('0x43')](_0x4167b9)[_0xce80('0x20')](handleEntityNotFound(_0x3e2edd,null))[_0xce80('0x20')](respondWithResult(_0x3e2edd,null))[_0xce80('0x44')](handleError(_0x3e2edd,null));};exports[_0xce80('0x45')]=function(_0x5f448e,_0x217fa4){return db['FaxQueueReport'][_0xce80('0x45')](_0x5f448e[_0xce80('0x46')],{})[_0xce80('0x20')](respondWithResult(_0x217fa4,0xc9))[_0xce80('0x44')](handleError(_0x217fa4,null));};exports[_0xce80('0x47')]=function(_0x118583,_0x595662){if(_0x118583[_0xce80('0x46')]['id']){delete _0x118583['body']['id'];}return db[_0xce80('0x28')]['find']({'where':{'id':_0x118583['params']['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x595662,null))[_0xce80('0x20')](saveUpdates(_0x118583[_0xce80('0x46')],null))[_0xce80('0x20')](respondWithResult(_0x595662,null))['catch'](handleError(_0x595662,null));};exports[_0xce80('0x21')]=function(_0xc420ef,_0x56dc30){return db[_0xce80('0x28')][_0xce80('0x43')]({'where':{'id':_0xc420ef[_0xce80('0x42')]['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x56dc30,null))['then'](removeEntity(_0x56dc30,null))['catch'](handleError(_0x56dc30,null));};exports['describe']=function(_0x4671d0,_0x2bd460){return db[_0xce80('0x28')]['describe']()['then'](respondWithResult(_0x2bd460,null))[_0xce80('0x44')](handleError(_0x2bd460,null));}; \ No newline at end of file +var _0x4483=['reject','update','destroy','then','stack','name','send','index','FaxQueueReport','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x2c05f0,_0x306ced){var _0xd5603a=function(_0x4cd0fd){while(--_0x4cd0fd){_0x2c05f0['push'](_0x2c05f0['shift']());}};_0xd5603a(++_0x306ced);}(_0x4483,0x1a3));var _0x3448=function(_0x4bd24a,_0x36f2b1){_0x4bd24a=_0x4bd24a-0x0;var _0x107837=_0x4483[_0x4bd24a];return _0x107837;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));};exports['describe']=function(_0x4db823,_0x371e8a){return db[_0x3448('0x2d')][_0x3448('0x4b')]()[_0x3448('0x28')](respondWithResult(_0x371e8a,null))[_0x3448('0x43')](handleError(_0x371e8a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d73dc0c..f19fde5 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x37dd4a,_0x1af85b){var _0x1c6da0=function(_0x3a9453){while(--_0x3a9453){_0x37dd4a['push'](_0x37dd4a['shift']());}};_0x1c6da0(++_0x1af85b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2ef251,_0x3687e5){_0x2ef251=_0x2ef251-0x0;var _0x5c931b=_0x7fbe[_0x2ef251];return _0x5c931b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2547e9,_0x12dfb2){var _0x317cbb=function(_0x159036){while(--_0x159036){_0x2547e9['push'](_0x2547e9['shift']());}};_0x317cbb(++_0x12dfb2);}(_0x53ec,0x192));var _0xc53e=function(_0x458656,_0x4292d8){_0x458656=_0x458656-0x0;var _0x24e475=_0x53ec[_0x458656];return _0x24e475;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7d45ad8..ee695d5 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 _0xad5e=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxQueueReport','body','options','then','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','FaxQueueReport,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xad5e,0x1f3));var _0xead5=function(_0x1559a3,_0x1e4f51){_0x1559a3=_0x1559a3-0x0;var _0x3a4b87=_0xad5e[_0x1559a3];return _0x3a4b87;};'use strict';var _=require(_0xead5('0x0'));var util=require(_0xead5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xead5('0x2'));var fs=require('fs');var Redis=require(_0xead5('0x3'));var db=require(_0xead5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xead5('0x5'))(_0xead5('0x6'));var config=require('../../config/environment');var jayson=require(_0xead5('0x7'));var client=jayson[_0xead5('0x8')][_0xead5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366897,_0x2906b4,_0x5ad2b){return new BPromise(function(_0xb86b38,_0x2b2723){return client['request'](_0x366897,_0x5ad2b)['then'](function(_0x32b036){logger['info'](_0xead5('0xa'),_0x2906b4,_0xead5('0xb'));logger[_0xead5('0xc')](_0xead5('0xd'),_0x2906b4,'request\x20sent',JSON[_0xead5('0xe')](_0x32b036));if(_0x32b036[_0xead5('0xf')]){if(_0x32b036[_0xead5('0xf')][_0xead5('0x10')]===0x1f4){logger[_0xead5('0xf')](_0xead5('0xa'),_0x2906b4,_0x32b036['error'][_0xead5('0x11')]);return _0x2b2723(_0x32b036['error']['message']);}logger[_0xead5('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x2906b4,_0x32b036[_0xead5('0xf')][_0xead5('0x11')]);return _0xb86b38(_0x32b036[_0xead5('0xf')][_0xead5('0x11')]);}else{logger['info'](_0xead5('0xa'),_0x2906b4,_0xead5('0xb'));_0xb86b38(_0x32b036['result'][_0xead5('0x11')]);}})[_0xead5('0x12')](function(_0x5712c6){logger['error'](_0xead5('0xa'),_0x2906b4,_0x5712c6);_0x2b2723(_0x5712c6);});});}exports['CreateFaxQueueReport']=function(_0x52c49a){var _0x15a9a2=this;return new Promise(function(_0x3f0423,_0x36cc81){return db[_0xead5('0x13')]['create'](_0x52c49a[_0xead5('0x14')],{'raw':_0x52c49a['options']?_0x52c49a[_0xead5('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xead5('0x16')](function(_0x2ff87d){logger['info'](_0xead5('0x17'),_0x52c49a);logger[_0xead5('0xc')](_0xead5('0x17'),_0x52c49a,JSON['stringify'](_0x2ff87d));_0x3f0423(_0x2ff87d);})[_0xead5('0x12')](function(_0x55d2f5){logger[_0xead5('0xf')](_0xead5('0x17'),_0x55d2f5[_0xead5('0x11')],_0x52c49a);_0x36cc81(_0x15a9a2[_0xead5('0xf')](0x1f4,_0x55d2f5[_0xead5('0x11')]));});});};exports[_0xead5('0x18')]=function(_0x4bb8db){var _0x22cfd2=this;return new Promise(function(_0x1c02aa,_0x40b798){return db['FaxQueueReport'][_0xead5('0x19')](_0x4bb8db[_0xead5('0x14')],{'raw':_0x4bb8db['options']?_0x4bb8db['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb8db[_0xead5('0x15')]?_0x4bb8db[_0xead5('0x15')][_0xead5('0x1a')]||null:null,'attributes':_0x4bb8db[_0xead5('0x15')]?_0x4bb8db[_0xead5('0x15')][_0xead5('0x1b')]||null:null,'limit':_0x4bb8db['options']?_0x4bb8db[_0xead5('0x15')][_0xead5('0x1c')]||null:null})[_0xead5('0x16')](function(_0x4132b5){logger[_0xead5('0x1d')]('UpdateFaxQueueReport',_0x4bb8db);logger[_0xead5('0xc')](_0xead5('0x18'),_0x4bb8db,JSON['stringify'](_0x4132b5));_0x1c02aa(_0x4132b5);})[_0xead5('0x12')](function(_0x598782){logger['error'](_0xead5('0x18'),_0x598782[_0xead5('0x11')],_0x4bb8db);_0x40b798(_0x22cfd2[_0xead5('0xf')](0x1f4,_0x598782[_0xead5('0x11')]));});});}; \ No newline at end of file +var _0xd50f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','catch','UpdateFaxQueueReport','body','limit','lodash','util'];(function(_0x3b82ba,_0x49540a){var _0xe1e00d=function(_0x530830){while(--_0x530830){_0x3b82ba['push'](_0x3b82ba['shift']());}};_0xe1e00d(++_0x49540a);}(_0xd50f,0x8f));var _0xfd50=function(_0x1dce91,_0x3f3093){_0x1dce91=_0x1dce91-0x0;var _0x25da86=_0xd50f[_0x1dce91];return _0x25da86;};'use strict';var _=require(_0xfd50('0x0'));var util=require(_0xfd50('0x1'));var moment=require(_0xfd50('0x2'));var BPromise=require(_0xfd50('0x3'));var rs=require(_0xfd50('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd50('0x5'))['db'];var utils=require(_0xfd50('0x6'));var logger=require(_0xfd50('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd50('0x8'));var client=jayson[_0xfd50('0x9')][_0xfd50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x390e45,_0x2c987e,_0x5a83d1){return new BPromise(function(_0xd4d10e,_0x1686af){return client['request'](_0x390e45,_0x5a83d1)['then'](function(_0x552d05){logger[_0xfd50('0xb')](_0xfd50('0xc'),_0x2c987e,_0xfd50('0xd'));logger[_0xfd50('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2c987e,_0xfd50('0xd'),JSON['stringify'](_0x552d05));if(_0x552d05[_0xfd50('0xf')]){if(_0x552d05['error'][_0xfd50('0x10')]===0x1f4){logger[_0xfd50('0xf')](_0xfd50('0xc'),_0x2c987e,_0x552d05[_0xfd50('0xf')][_0xfd50('0x11')]);return _0x1686af(_0x552d05[_0xfd50('0xf')]['message']);}logger[_0xfd50('0xf')](_0xfd50('0xc'),_0x2c987e,_0x552d05['error']['message']);return _0xd4d10e(_0x552d05[_0xfd50('0xf')]['message']);}else{logger[_0xfd50('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x2c987e,_0xfd50('0xd'));_0xd4d10e(_0x552d05[_0xfd50('0x12')][_0xfd50('0x11')]);}})['catch'](function(_0x411150){logger[_0xfd50('0xf')](_0xfd50('0xc'),_0x2c987e,_0x411150);_0x1686af(_0x411150);});});}exports[_0xfd50('0x13')]=function(_0x5b98c1){var _0x191dd4=this;return new Promise(function(_0x375189,_0xaa535){return db[_0xfd50('0x14')][_0xfd50('0x15')](_0x5b98c1['body'],{'raw':_0x5b98c1[_0xfd50('0x16')]?_0x5b98c1[_0xfd50('0x16')][_0xfd50('0x17')]===undefined?!![]:![]:!![]})[_0xfd50('0x18')](function(_0x12569c){logger[_0xfd50('0xb')](_0xfd50('0x13'),_0x5b98c1);logger['debug'](_0xfd50('0x13'),_0x5b98c1,JSON['stringify'](_0x12569c));_0x375189(_0x12569c);})[_0xfd50('0x19')](function(_0x2adc3b){logger['error'](_0xfd50('0x13'),_0x2adc3b[_0xfd50('0x11')],_0x5b98c1);_0xaa535(_0x191dd4[_0xfd50('0xf')](0x1f4,_0x2adc3b[_0xfd50('0x11')]));});});};exports[_0xfd50('0x1a')]=function(_0x5b70f6){var _0x5e625d=this;return new Promise(function(_0x36de1d,_0x373034){return db[_0xfd50('0x14')]['update'](_0x5b70f6[_0xfd50('0x1b')],{'raw':_0x5b70f6['options']?_0x5b70f6[_0xfd50('0x16')][_0xfd50('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b70f6[_0xfd50('0x16')]?_0x5b70f6[_0xfd50('0x16')]['where']||null:null,'attributes':_0x5b70f6['options']?_0x5b70f6[_0xfd50('0x16')]['attributes']||null:null,'limit':_0x5b70f6[_0xfd50('0x16')]?_0x5b70f6[_0xfd50('0x16')][_0xfd50('0x1c')]||null:null})[_0xfd50('0x18')](function(_0x536a1a){logger['info'](_0xfd50('0x1a'),_0x5b70f6);logger['debug'](_0xfd50('0x1a'),_0x5b70f6,JSON['stringify'](_0x536a1a));_0x36de1d(_0x536a1a);})[_0xfd50('0x19')](function(_0x59bef9){logger[_0xfd50('0xf')]('UpdateFaxQueueReport',_0x59bef9[_0xfd50('0x11')],_0x5b70f6);_0x373034(_0x5e625d['error'](0x1f4,_0x59bef9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 579bfc4..4b07c18 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 _0x3de9=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x266e57,_0x41125b){var _0x4cdc1d=function(_0x3d3734){while(--_0x3d3734){_0x266e57['push'](_0x266e57['shift']());}};_0x4cdc1d(++_0x41125b);}(_0x3de9,0x110));var _0x93de=function(_0x564904,_0x183d0e){_0x564904=_0x564904-0x0;var _0x1335fc=_0x3de9[_0x564904];return _0x1335fc;};'use strict';var multer=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var path=require(_0x93de('0x2'));var timeout=require(_0x93de('0x3'));var express=require(_0x93de('0x4'));var router=express['Router']();var fs_extra=require(_0x93de('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93de('0x6'));var config=require(_0x93de('0x7'));var controller=require(_0x93de('0x8'));router[_0x93de('0x9')]('/',auth[_0x93de('0xa')](),controller[_0x93de('0xb')]);router[_0x93de('0x9')](_0x93de('0xc'),auth[_0x93de('0xa')](),controller['describe']);router['get'](_0x93de('0xd'),auth[_0x93de('0xa')](),controller[_0x93de('0xe')]);router[_0x93de('0xf')]('/',auth[_0x93de('0xa')](),controller[_0x93de('0x10')]);router[_0x93de('0x11')](_0x93de('0xd'),auth[_0x93de('0xa')](),controller[_0x93de('0x12')]);router[_0x93de('0x13')](_0x93de('0xd'),auth[_0x93de('0xa')](),controller[_0x93de('0x14')]);module['exports']=router; \ No newline at end of file +var _0x82c8=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','destroy','exports'];(function(_0x125457,_0x30befb){var _0x5a8c71=function(_0x239433){while(--_0x239433){_0x125457['push'](_0x125457['shift']());}};_0x5a8c71(++_0x30befb);}(_0x82c8,0x170));var _0x882c=function(_0x40066e,_0x4afa9b){_0x40066e=_0x40066e-0x0;var _0x505aa4=_0x82c8[_0x40066e];return _0x505aa4;};'use strict';var multer=require(_0x882c('0x0'));var util=require(_0x882c('0x1'));var path=require('path');var timeout=require(_0x882c('0x2'));var express=require('express');var router=express[_0x882c('0x3')]();var fs_extra=require(_0x882c('0x4'));var auth=require(_0x882c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x882c('0x6'));var controller=require(_0x882c('0x7'));router[_0x882c('0x8')]('/',auth[_0x882c('0x9')](),controller[_0x882c('0xa')]);router[_0x882c('0x8')]('/describe',auth[_0x882c('0x9')](),controller[_0x882c('0xb')]);router['get'](_0x882c('0xc'),auth[_0x882c('0x9')](),controller['show']);router[_0x882c('0xd')]('/',auth[_0x882c('0x9')](),controller['create']);router['put']('/:id',auth[_0x882c('0x9')](),controller['update']);router['delete'](_0x882c('0xc'),auth[_0x882c('0x9')](),controller[_0x882c('0xe')]);module[_0x882c('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3162de6..0bd70d5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x55715d,_0x230bea){var _0x13a35b=function(_0x2cda11){while(--_0x2cda11){_0x55715d['push'](_0x55715d['shift']());}};_0x13a35b(++_0x230bea);}(_0x70e0,0x17b));var _0x070e=function(_0x1d3329,_0x29dc23){_0x1d3329=_0x1d3329-0x0;var _0x182d42=_0x70e0[_0x1d3329];return _0x182d42;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xffc0e7,_0x4ae80b){var _0x21ea1a=function(_0x44a9a2){while(--_0x44a9a2){_0xffc0e7['push'](_0xffc0e7['shift']());}};_0x21ea1a(++_0x4ae80b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6e98ea5..f0a03db 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 _0xd0c7=['status','json','offset','undefined','limit','set','reject','save','then','destroy','end','name','send','FaxTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','filter','count','include','findAll','rows','catch','show','params','includeAll','merge','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','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'];(function(_0x34323e,_0x2b395b){var _0xb5fbf8=function(_0x2ad2d5){while(--_0x2ad2d5){_0x34323e['push'](_0x34323e['shift']());}};_0xb5fbf8(++_0x2b395b);}(_0xd0c7,0x7b));var _0x7d0c=function(_0x1e6053,_0x307fba){_0x1e6053=_0x1e6053-0x0;var _0x460c98=_0xd0c7[_0x1e6053];return _0x460c98;};'use strict';var emlformat=require(_0x7d0c('0x0'));var rimraf=require(_0x7d0c('0x1'));var zipdir=require(_0x7d0c('0x2'));var jsonpatch=require(_0x7d0c('0x3'));var rp=require('request-promise');var moment=require(_0x7d0c('0x4'));var BPromise=require(_0x7d0c('0x5'));var Mustache=require(_0x7d0c('0x6'));var util=require(_0x7d0c('0x7'));var path=require('path');var sox=require(_0x7d0c('0x8'));var csv=require(_0x7d0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d0c('0xa'));var _=require(_0x7d0c('0xb'));var squel=require(_0x7d0c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d0c('0xd'));var toCsv=require(_0x7d0c('0x9'));var querystring=require(_0x7d0c('0xe'));var Papa=require(_0x7d0c('0xf'));var Redis=require(_0x7d0c('0x10'));var authService=require(_0x7d0c('0x11'));var qs=require(_0x7d0c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d0c('0x13'));var logger=require(_0x7d0c('0x14'))(_0x7d0c('0x15'));var utils=require(_0x7d0c('0x16'));var config=require(_0x7d0c('0x17'));var licenseUtil=require(_0x7d0c('0x18'));var db=require(_0x7d0c('0x19'))['db'];function respondWithStatusCode(_0x4c8a00,_0x499577){_0x499577=_0x499577||0xcc;return function(_0x220803){if(_0x220803){return _0x4c8a00[_0x7d0c('0x1a')](_0x499577);}return _0x4c8a00[_0x7d0c('0x1b')](_0x499577)['end']();};}function respondWithResult(_0xc16bee,_0x18cf50){_0x18cf50=_0x18cf50||0xc8;return function(_0xed984d){if(_0xed984d){return _0xc16bee[_0x7d0c('0x1b')](_0x18cf50)[_0x7d0c('0x1c')](_0xed984d);}};}function respondWithFilteredResult(_0x3838dd,_0x4b7414){return function(_0x5d770b){if(_0x5d770b){var _0x58c9da=typeof _0x4b7414[_0x7d0c('0x1d')]===_0x7d0c('0x1e')&&typeof _0x4b7414['limit']===_0x7d0c('0x1e');var _0x590ec5=_0x5d770b['count'];var _0x4864ea=_0x58c9da?0x0:_0x4b7414[_0x7d0c('0x1d')];var _0x38069a=_0x58c9da?_0x5d770b['count']:_0x4b7414[_0x7d0c('0x1d')]+_0x4b7414[_0x7d0c('0x1f')];var _0x2c896d;if(_0x38069a>=_0x590ec5){_0x38069a=_0x590ec5;_0x2c896d=0xc8;}else{_0x2c896d=0xce;}_0x3838dd[_0x7d0c('0x1b')](_0x2c896d);return _0x3838dd[_0x7d0c('0x20')]('Content-Range',_0x4864ea+'-'+_0x38069a+'/'+_0x590ec5)[_0x7d0c('0x1c')](_0x5d770b);}return null;};}function patchUpdates(_0x338015){return function(_0x5354c2){try{jsonpatch['apply'](_0x5354c2,_0x338015,!![]);}catch(_0x5f3ae4){return BPromise[_0x7d0c('0x21')](_0x5f3ae4);}return _0x5354c2[_0x7d0c('0x22')]();};}function saveUpdates(_0x51b6f5,_0x2dd9bf){return function(_0x4eb03b){if(_0x4eb03b){return _0x4eb03b['update'](_0x51b6f5)[_0x7d0c('0x23')](function(_0x4c7d47){return _0x4c7d47;});}return null;};}function removeEntity(_0x10d4fc,_0x2ba8f5){return function(_0x4123b3){if(_0x4123b3){return _0x4123b3[_0x7d0c('0x24')]()[_0x7d0c('0x23')](function(){_0x10d4fc[_0x7d0c('0x1b')](0xcc)[_0x7d0c('0x25')]();});}};}function handleEntityNotFound(_0x1deebd,_0x5d67be){return function(_0x43a933){if(!_0x43a933){_0x1deebd['sendStatus'](0x194);}return _0x43a933;};}function handleError(_0x3e84e7,_0x37c25d){_0x37c25d=_0x37c25d||0x1f4;return function(_0x3121e4){logger['error'](_0x3121e4['stack']);if(_0x3121e4[_0x7d0c('0x26')]){delete _0x3121e4[_0x7d0c('0x26')];}_0x3e84e7[_0x7d0c('0x1b')](_0x37c25d)[_0x7d0c('0x27')](_0x3121e4);};}exports['index']=function(_0x291fe2,_0x252ff4){var _0x1d4ecc={},_0x479b4f={},_0x9d9090={'count':0x0,'rows':[]};var _0xafea22=_['map'](db[_0x7d0c('0x28')][_0x7d0c('0x29')],function(_0x5f0978){return{'name':_0x5f0978[_0x7d0c('0x2a')],'type':_0x5f0978['type'][_0x7d0c('0x2b')]};});_0x479b4f[_0x7d0c('0x2c')]=_[_0x7d0c('0x2d')](_0xafea22,_0x7d0c('0x26'));_0x479b4f['query']=_[_0x7d0c('0x2e')](_0x291fe2[_0x7d0c('0x2f')]);_0x479b4f[_0x7d0c('0x30')]=_['intersection'](_0x479b4f['model'],_0x479b4f[_0x7d0c('0x2f')]);_0x1d4ecc['attributes']=_[_0x7d0c('0x31')](_0x479b4f[_0x7d0c('0x2c')],qs[_0x7d0c('0x32')](_0x291fe2['query']['fields']));_0x1d4ecc[_0x7d0c('0x33')]=_0x1d4ecc[_0x7d0c('0x33')][_0x7d0c('0x34')]?_0x1d4ecc['attributes']:_0x479b4f['model'];if(!_0x291fe2[_0x7d0c('0x2f')]['hasOwnProperty'](_0x7d0c('0x35'))){_0x1d4ecc[_0x7d0c('0x1f')]=qs[_0x7d0c('0x1f')](_0x291fe2[_0x7d0c('0x2f')][_0x7d0c('0x1f')]);_0x1d4ecc[_0x7d0c('0x1d')]=qs[_0x7d0c('0x1d')](_0x291fe2[_0x7d0c('0x2f')]['offset']);}_0x1d4ecc['order']=qs[_0x7d0c('0x36')](_0x291fe2[_0x7d0c('0x2f')][_0x7d0c('0x36')]);_0x1d4ecc[_0x7d0c('0x37')]=qs[_0x7d0c('0x30')](_[_0x7d0c('0x38')](_0x291fe2[_0x7d0c('0x2f')],_0x479b4f[_0x7d0c('0x30')]),_0xafea22);if(_0x291fe2[_0x7d0c('0x2f')]['filter']){_0x1d4ecc['where']=_['merge'](_0x1d4ecc[_0x7d0c('0x37')],{'$or':_[_0x7d0c('0x2d')](_0xafea22,function(_0x54daa6){if(_0x54daa6[_0x7d0c('0x39')]!==_0x7d0c('0x3a')){var _0x477d31={};_0x477d31[_0x54daa6['name']]={'$like':'%'+_0x291fe2[_0x7d0c('0x2f')][_0x7d0c('0x3b')]+'%'};return _0x477d31;}})});}_0x1d4ecc=_['merge']({},_0x1d4ecc,_0x291fe2['options']);var _0x4a2251={'where':_0x1d4ecc[_0x7d0c('0x37')]};return db['FaxTransferReport'][_0x7d0c('0x3c')](_0x4a2251)[_0x7d0c('0x23')](function(_0x788063){_0x9d9090[_0x7d0c('0x3c')]=_0x788063;if(_0x291fe2[_0x7d0c('0x2f')]['includeAll']){_0x1d4ecc[_0x7d0c('0x3d')]=[{'all':!![]}];}return db[_0x7d0c('0x28')][_0x7d0c('0x3e')](_0x1d4ecc);})[_0x7d0c('0x23')](function(_0x13fbc4){_0x9d9090[_0x7d0c('0x3f')]=_0x13fbc4;return _0x9d9090;})[_0x7d0c('0x23')](respondWithFilteredResult(_0x252ff4,_0x1d4ecc))[_0x7d0c('0x40')](handleError(_0x252ff4,null));};exports[_0x7d0c('0x41')]=function(_0x3d6dcf,_0x4a18a0){var _0x5f3bbd={'raw':!![],'where':{'id':_0x3d6dcf[_0x7d0c('0x42')]['id']}},_0xa328f={};_0xa328f[_0x7d0c('0x2c')]=_[_0x7d0c('0x2e')](db[_0x7d0c('0x28')][_0x7d0c('0x29')]);_0xa328f[_0x7d0c('0x2f')]=_[_0x7d0c('0x2e')](_0x3d6dcf[_0x7d0c('0x2f')]);_0xa328f[_0x7d0c('0x30')]=_['intersection'](_0xa328f[_0x7d0c('0x2c')],_0xa328f[_0x7d0c('0x2f')]);_0x5f3bbd[_0x7d0c('0x33')]=_[_0x7d0c('0x31')](_0xa328f[_0x7d0c('0x2c')],qs[_0x7d0c('0x32')](_0x3d6dcf[_0x7d0c('0x2f')]['fields']));_0x5f3bbd['attributes']=_0x5f3bbd[_0x7d0c('0x33')][_0x7d0c('0x34')]?_0x5f3bbd[_0x7d0c('0x33')]:_0xa328f[_0x7d0c('0x2c')];if(_0x3d6dcf[_0x7d0c('0x2f')][_0x7d0c('0x43')]){_0x5f3bbd[_0x7d0c('0x3d')]=[{'all':!![]}];}_0x5f3bbd=_[_0x7d0c('0x44')]({},_0x5f3bbd,_0x3d6dcf[_0x7d0c('0x45')]);return db[_0x7d0c('0x28')]['find'](_0x5f3bbd)[_0x7d0c('0x23')](handleEntityNotFound(_0x4a18a0,null))[_0x7d0c('0x23')](respondWithResult(_0x4a18a0,null))['catch'](handleError(_0x4a18a0,null));};exports[_0x7d0c('0x46')]=function(_0x4aeb0c,_0x62d081){return db[_0x7d0c('0x28')][_0x7d0c('0x46')](_0x4aeb0c['body'],{})[_0x7d0c('0x23')](respondWithResult(_0x62d081,0xc9))[_0x7d0c('0x40')](handleError(_0x62d081,null));};exports[_0x7d0c('0x47')]=function(_0x1691dc,_0x9cd25f){if(_0x1691dc[_0x7d0c('0x48')]['id']){delete _0x1691dc[_0x7d0c('0x48')]['id'];}return db[_0x7d0c('0x28')][_0x7d0c('0x49')]({'where':{'id':_0x1691dc['params']['id']}})[_0x7d0c('0x23')](handleEntityNotFound(_0x9cd25f,null))['then'](saveUpdates(_0x1691dc[_0x7d0c('0x48')],null))[_0x7d0c('0x23')](respondWithResult(_0x9cd25f,null))[_0x7d0c('0x40')](handleError(_0x9cd25f,null));};exports[_0x7d0c('0x24')]=function(_0xfe4254,_0x35ed15){return db[_0x7d0c('0x28')]['find']({'where':{'id':_0xfe4254[_0x7d0c('0x42')]['id']}})[_0x7d0c('0x23')](handleEntityNotFound(_0x35ed15,null))[_0x7d0c('0x23')](removeEntity(_0x35ed15,null))[_0x7d0c('0x40')](handleError(_0x35ed15,null));};exports[_0x7d0c('0x4a')]=function(_0x1a5f2d,_0x37f538){return db['FaxTransferReport'][_0x7d0c('0x4a')]()['then'](respondWithResult(_0x37f538,null))[_0x7d0c('0x40')](handleError(_0x37f538,null));}; \ No newline at end of file +var _0x042b=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x38ca1b,_0x3a2965){var _0x2fd895=function(_0x3681ef){while(--_0x3681ef){_0x38ca1b['push'](_0x38ca1b['shift']());}};_0x2fd895(++_0x3a2965);}(_0x042b,0x172));var _0xb042=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x042b[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xb042('0x0'));var rimraf=require(_0xb042('0x1'));var zipdir=require(_0xb042('0x2'));var jsonpatch=require(_0xb042('0x3'));var rp=require('request-promise');var moment=require(_0xb042('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb042('0x5'));var path=require(_0xb042('0x6'));var sox=require(_0xb042('0x7'));var csv=require(_0xb042('0x8'));var ejs=require(_0xb042('0x9'));var fs=require('fs');var fs_extra=require(_0xb042('0xa'));var _=require(_0xb042('0xb'));var squel=require(_0xb042('0xc'));var crypto=require(_0xb042('0xd'));var jsforce=require(_0xb042('0xe'));var deskjs=require(_0xb042('0xf'));var toCsv=require(_0xb042('0x8'));var querystring=require('querystring');var Papa=require(_0xb042('0x10'));var Redis=require(_0xb042('0x11'));var authService=require(_0xb042('0x12'));var qs=require(_0xb042('0x13'));var as=require(_0xb042('0x14'));var hardwareService=require(_0xb042('0x15'));var logger=require(_0xb042('0x16'))(_0xb042('0x17'));var utils=require(_0xb042('0x18'));var config=require(_0xb042('0x19'));var licenseUtil=require(_0xb042('0x1a'));var db=require(_0xb042('0x1b'))['db'];function respondWithStatusCode(_0x281f1d,_0x1e86d3){_0x1e86d3=_0x1e86d3||0xcc;return function(_0x5efeb3){if(_0x5efeb3){return _0x281f1d['sendStatus'](_0x1e86d3);}return _0x281f1d[_0xb042('0x1c')](_0x1e86d3)[_0xb042('0x1d')]();};}function respondWithResult(_0xcdffef,_0x3ea555){_0x3ea555=_0x3ea555||0xc8;return function(_0x1c573e){if(_0x1c573e){return _0xcdffef[_0xb042('0x1c')](_0x3ea555)[_0xb042('0x1e')](_0x1c573e);}};}function respondWithFilteredResult(_0x5bd894,_0x602797){return function(_0x5e6601){if(_0x5e6601){var _0x28858f=typeof _0x602797['offset']===_0xb042('0x1f')&&typeof _0x602797[_0xb042('0x20')]===_0xb042('0x1f');var _0x112ccd=_0x5e6601[_0xb042('0x21')];var _0x4eed3a=_0x28858f?0x0:_0x602797[_0xb042('0x22')];var _0x3d4e1f=_0x28858f?_0x5e6601[_0xb042('0x21')]:_0x602797[_0xb042('0x22')]+_0x602797[_0xb042('0x20')];var _0x3d3d22;if(_0x3d4e1f>=_0x112ccd){_0x3d4e1f=_0x112ccd;_0x3d3d22=0xc8;}else{_0x3d3d22=0xce;}_0x5bd894['status'](_0x3d3d22);return _0x5bd894[_0xb042('0x23')](_0xb042('0x24'),_0x4eed3a+'-'+_0x3d4e1f+'/'+_0x112ccd)[_0xb042('0x1e')](_0x5e6601);}return null;};}function patchUpdates(_0x4d41a4){return function(_0xbda4d5){try{jsonpatch[_0xb042('0x25')](_0xbda4d5,_0x4d41a4,!![]);}catch(_0x534610){return BPromise[_0xb042('0x26')](_0x534610);}return _0xbda4d5[_0xb042('0x27')]();};}function saveUpdates(_0x11568a,_0x3c4f6c){return function(_0x3d7034){if(_0x3d7034){return _0x3d7034[_0xb042('0x28')](_0x11568a)[_0xb042('0x29')](function(_0x552297){return _0x552297;});}return null;};}function removeEntity(_0x10a73b,_0x1ad0cd){return function(_0x1271f5){if(_0x1271f5){return _0x1271f5['destroy']()[_0xb042('0x29')](function(){_0x10a73b[_0xb042('0x1c')](0xcc)[_0xb042('0x1d')]();});}};}function handleEntityNotFound(_0x13afb0,_0x1aa7d6){return function(_0x26837b){if(!_0x26837b){_0x13afb0[_0xb042('0x2a')](0x194);}return _0x26837b;};}function handleError(_0x5a2d4e,_0x337dec){_0x337dec=_0x337dec||0x1f4;return function(_0x59358a){logger['error'](_0x59358a['stack']);if(_0x59358a[_0xb042('0x2b')]){delete _0x59358a[_0xb042('0x2b')];}_0x5a2d4e[_0xb042('0x1c')](_0x337dec)[_0xb042('0x2c')](_0x59358a);};}exports[_0xb042('0x2d')]=function(_0x6a4d7,_0x27d35f){var _0x54eb48={},_0x243b1c={},_0x2e538f={'count':0x0,'rows':[]};var _0x112697=_[_0xb042('0x2e')](db[_0xb042('0x2f')][_0xb042('0x30')],function(_0xc03eb){return{'name':_0xc03eb[_0xb042('0x31')],'type':_0xc03eb[_0xb042('0x32')][_0xb042('0x33')]};});_0x243b1c['model']=_[_0xb042('0x2e')](_0x112697,_0xb042('0x2b'));_0x243b1c[_0xb042('0x34')]=_[_0xb042('0x35')](_0x6a4d7[_0xb042('0x34')]);_0x243b1c['filters']=_[_0xb042('0x36')](_0x243b1c['model'],_0x243b1c[_0xb042('0x34')]);_0x54eb48['attributes']=_[_0xb042('0x36')](_0x243b1c['model'],qs[_0xb042('0x37')](_0x6a4d7[_0xb042('0x34')][_0xb042('0x37')]));_0x54eb48[_0xb042('0x38')]=_0x54eb48[_0xb042('0x38')]['length']?_0x54eb48[_0xb042('0x38')]:_0x243b1c[_0xb042('0x39')];if(!_0x6a4d7[_0xb042('0x34')][_0xb042('0x3a')](_0xb042('0x3b'))){_0x54eb48[_0xb042('0x20')]=qs[_0xb042('0x20')](_0x6a4d7['query'][_0xb042('0x20')]);_0x54eb48[_0xb042('0x22')]=qs[_0xb042('0x22')](_0x6a4d7[_0xb042('0x34')][_0xb042('0x22')]);}_0x54eb48['order']=qs[_0xb042('0x3c')](_0x6a4d7[_0xb042('0x34')]['sort']);_0x54eb48[_0xb042('0x3d')]=qs[_0xb042('0x3e')](_[_0xb042('0x3f')](_0x6a4d7['query'],_0x243b1c[_0xb042('0x3e')]),_0x112697);if(_0x6a4d7['query'][_0xb042('0x40')]){_0x54eb48[_0xb042('0x3d')]=_[_0xb042('0x41')](_0x54eb48[_0xb042('0x3d')],{'$or':_[_0xb042('0x2e')](_0x112697,function(_0x90202b){if(_0x90202b['type']!==_0xb042('0x42')){var _0x476f3f={};_0x476f3f[_0x90202b[_0xb042('0x2b')]]={'$like':'%'+_0x6a4d7[_0xb042('0x34')]['filter']+'%'};return _0x476f3f;}})});}_0x54eb48=_[_0xb042('0x41')]({},_0x54eb48,_0x6a4d7[_0xb042('0x43')]);var _0x196fc7={'where':_0x54eb48['where']};return db[_0xb042('0x2f')][_0xb042('0x21')](_0x196fc7)[_0xb042('0x29')](function(_0x4c6095){_0x2e538f[_0xb042('0x21')]=_0x4c6095;if(_0x6a4d7['query'][_0xb042('0x44')]){_0x54eb48['include']=[{'all':!![]}];}return db[_0xb042('0x2f')][_0xb042('0x45')](_0x54eb48);})[_0xb042('0x29')](function(_0x4d6766){_0x2e538f[_0xb042('0x46')]=_0x4d6766;return _0x2e538f;})['then'](respondWithFilteredResult(_0x27d35f,_0x54eb48))['catch'](handleError(_0x27d35f,null));};exports[_0xb042('0x47')]=function(_0x10fdc6,_0x56eb30){var _0x1e6f71={'raw':!![],'where':{'id':_0x10fdc6[_0xb042('0x48')]['id']}},_0x9269cf={};_0x9269cf[_0xb042('0x39')]=_['keys'](db['FaxTransferReport'][_0xb042('0x30')]);_0x9269cf['query']=_[_0xb042('0x35')](_0x10fdc6[_0xb042('0x34')]);_0x9269cf[_0xb042('0x3e')]=_[_0xb042('0x36')](_0x9269cf['model'],_0x9269cf[_0xb042('0x34')]);_0x1e6f71[_0xb042('0x38')]=_[_0xb042('0x36')](_0x9269cf[_0xb042('0x39')],qs[_0xb042('0x37')](_0x10fdc6[_0xb042('0x34')][_0xb042('0x37')]));_0x1e6f71['attributes']=_0x1e6f71[_0xb042('0x38')]['length']?_0x1e6f71[_0xb042('0x38')]:_0x9269cf['model'];if(_0x10fdc6['query'][_0xb042('0x44')]){_0x1e6f71['include']=[{'all':!![]}];}_0x1e6f71=_['merge']({},_0x1e6f71,_0x10fdc6[_0xb042('0x43')]);return db['FaxTransferReport'][_0xb042('0x49')](_0x1e6f71)[_0xb042('0x29')](handleEntityNotFound(_0x56eb30,null))[_0xb042('0x29')](respondWithResult(_0x56eb30,null))[_0xb042('0x4a')](handleError(_0x56eb30,null));};exports[_0xb042('0x4b')]=function(_0x4c2556,_0x1ded8f){return db[_0xb042('0x2f')][_0xb042('0x4b')](_0x4c2556[_0xb042('0x4c')],{})[_0xb042('0x29')](respondWithResult(_0x1ded8f,0xc9))[_0xb042('0x4a')](handleError(_0x1ded8f,null));};exports['update']=function(_0x1a8615,_0x353510){if(_0x1a8615[_0xb042('0x4c')]['id']){delete _0x1a8615[_0xb042('0x4c')]['id'];}return db['FaxTransferReport'][_0xb042('0x49')]({'where':{'id':_0x1a8615[_0xb042('0x48')]['id']}})['then'](handleEntityNotFound(_0x353510,null))['then'](saveUpdates(_0x1a8615[_0xb042('0x4c')],null))[_0xb042('0x29')](respondWithResult(_0x353510,null))[_0xb042('0x4a')](handleError(_0x353510,null));};exports[_0xb042('0x4d')]=function(_0x3646e8,_0x53a35e){return db['FaxTransferReport'][_0xb042('0x49')]({'where':{'id':_0x3646e8[_0xb042('0x48')]['id']}})[_0xb042('0x29')](handleEntityNotFound(_0x53a35e,null))['then'](removeEntity(_0x53a35e,null))['catch'](handleError(_0x53a35e,null));};exports[_0xb042('0x4e')]=function(_0x49a78f,_0x5bcbaf){return db[_0xb042('0x2f')][_0xb042('0x4e')]()['then'](respondWithResult(_0x5bcbaf,null))['catch'](handleError(_0x5bcbaf,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 73810f9..d72cd12 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 _0x46d9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util'];(function(_0x55be03,_0x58375a){var _0x745919=function(_0x147e34){while(--_0x147e34){_0x55be03['push'](_0x55be03['shift']());}};_0x745919(++_0x58375a);}(_0x46d9,0x16a));var _0x946d=function(_0x1986d,_0x2af5c4){_0x1986d=_0x1986d-0x0;var _0x27dda5=_0x46d9[_0x1986d];return _0x27dda5;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require(_0x946d('0x4'));var BPromise=require(_0x946d('0x5'));var rp=require(_0x946d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x946d('0x7'));var config=require(_0x946d('0x8'));var attributes=require(_0x946d('0x9'));module[_0x946d('0xa')]=function(_0x27bc4d,_0x35688c){return _0x27bc4d[_0x946d('0xb')](_0x946d('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x946d('0xd'),'fields':[_0x946d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa397=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x5f4354,_0xdf8b8a){var _0x57b5b9=function(_0x588439){while(--_0x588439){_0x5f4354['push'](_0x5f4354['shift']());}};_0x57b5b9(++_0xdf8b8a);}(_0xa397,0xdd));var _0x7a39=function(_0x275d4a,_0x1454ad){_0x275d4a=_0x275d4a-0x0;var _0x4ae219=_0xa397[_0x275d4a];return _0x4ae219;};'use strict';var _=require(_0x7a39('0x0'));var util=require('util');var logger=require(_0x7a39('0x1'))(_0x7a39('0x2'));var moment=require(_0x7a39('0x3'));var BPromise=require(_0x7a39('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a39('0x5'));var rimraf=require('rimraf');var config=require(_0x7a39('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x7a39('0x7')]=function(_0x34f2da,_0x3c7e34){return _0x34f2da[_0x7a39('0x8')](_0x7a39('0x9'),attributes,{'tableName':_0x7a39('0xa'),'paranoid':![],'indexes':[{'name':_0x7a39('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f84fda7..b03e98c 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 _0x967c=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result'];(function(_0x2a85ee,_0x4673e8){var _0x5ceb06=function(_0x6638d0){while(--_0x6638d0){_0x2a85ee['push'](_0x2a85ee['shift']());}};_0x5ceb06(++_0x4673e8);}(_0x967c,0xb9));var _0xc967=function(_0x1df7f7,_0x16007a){_0x1df7f7=_0x1df7f7-0x0;var _0x2b3229=_0x967c[_0x1df7f7];return _0x2b3229;};'use strict';var _=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var moment=require('moment');var BPromise=require(_0xc967('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc967('0x3'));var db=require(_0xc967('0x4'))['db'];var utils=require(_0xc967('0x5'));var logger=require('../../config/logger')(_0xc967('0x6'));var config=require(_0xc967('0x7'));var jayson=require(_0xc967('0x8'));var client=jayson['client'][_0xc967('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x308779,_0x15377d,_0x31378a){return new BPromise(function(_0x3ed73f,_0x27de0a){return client[_0xc967('0xa')](_0x308779,_0x31378a)[_0xc967('0xb')](function(_0x292f2f){logger[_0xc967('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x15377d,_0xc967('0xd'));logger[_0xc967('0xe')](_0xc967('0xf'),_0x15377d,_0xc967('0xd'),JSON[_0xc967('0x10')](_0x292f2f));if(_0x292f2f[_0xc967('0x11')]){if(_0x292f2f[_0xc967('0x11')][_0xc967('0x12')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x15377d,_0x292f2f[_0xc967('0x11')][_0xc967('0x13')]);return _0x27de0a(_0x292f2f['error']['message']);}logger[_0xc967('0x11')](_0xc967('0x14'),_0x15377d,_0x292f2f[_0xc967('0x11')][_0xc967('0x13')]);return _0x3ed73f(_0x292f2f['error'][_0xc967('0x13')]);}else{logger[_0xc967('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x15377d,_0xc967('0xd'));_0x3ed73f(_0x292f2f[_0xc967('0x15')]['message']);}})[_0xc967('0x16')](function(_0x15415d){logger[_0xc967('0x11')](_0xc967('0x14'),_0x15377d,_0x15415d);_0x27de0a(_0x15415d);});});} \ No newline at end of file +var _0xea94=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a48a0,_0x3c95f5){var _0x269714=function(_0x33d9e3){while(--_0x33d9e3){_0x1a48a0['push'](_0x1a48a0['shift']());}};_0x269714(++_0x3c95f5);}(_0xea94,0xea));var _0x4ea9=function(_0x44073b,_0x53116c){_0x44073b=_0x44073b-0x0;var _0x3757d4=_0xea94[_0x44073b];return _0x3757d4;};'use strict';var _=require('lodash');var util=require(_0x4ea9('0x0'));var moment=require(_0x4ea9('0x1'));var BPromise=require(_0x4ea9('0x2'));var rs=require(_0x4ea9('0x3'));var fs=require('fs');var Redis=require(_0x4ea9('0x4'));var db=require(_0x4ea9('0x5'))['db'];var utils=require(_0x4ea9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ea9('0x7'));var jayson=require(_0x4ea9('0x8'));var client=jayson['client'][_0x4ea9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca5b16,_0x5adfbb,_0x186054){return new BPromise(function(_0x20d8ad,_0x249364){return client[_0x4ea9('0xa')](_0xca5b16,_0x186054)[_0x4ea9('0xb')](function(_0x223023){logger[_0x4ea9('0xc')](_0x4ea9('0xd'),_0x5adfbb,'request\x20sent');logger[_0x4ea9('0xe')](_0x4ea9('0xf'),_0x5adfbb,_0x4ea9('0x10'),JSON[_0x4ea9('0x11')](_0x223023));if(_0x223023[_0x4ea9('0x12')]){if(_0x223023[_0x4ea9('0x12')][_0x4ea9('0x13')]===0x1f4){logger[_0x4ea9('0x12')](_0x4ea9('0xd'),_0x5adfbb,_0x223023[_0x4ea9('0x12')][_0x4ea9('0x14')]);return _0x249364(_0x223023[_0x4ea9('0x12')][_0x4ea9('0x14')]);}logger[_0x4ea9('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5adfbb,_0x223023[_0x4ea9('0x12')]['message']);return _0x20d8ad(_0x223023['error'][_0x4ea9('0x14')]);}else{logger[_0x4ea9('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x5adfbb,_0x4ea9('0x10'));_0x20d8ad(_0x223023[_0x4ea9('0x15')]['message']);}})[_0x4ea9('0x16')](function(_0x2ff62e){logger[_0x4ea9('0x12')](_0x4ea9('0xd'),_0x5adfbb,_0x2ff62e);_0x249364(_0x2ff62e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 35a800e..4014680 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 _0x41bf=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','update','destroy'];(function(_0x1e5c84,_0x4ff783){var _0x8a9208=function(_0x3da42a){while(--_0x3da42a){_0x1e5c84['push'](_0x1e5c84['shift']());}};_0x8a9208(++_0x4ff783);}(_0x41bf,0x7f));var _0xf41b=function(_0x4ffad9,_0x2d4f8d){_0x4ffad9=_0x4ffad9-0x0;var _0x45b8e8=_0x41bf[_0x4ffad9];return _0x45b8e8;};'use strict';var multer=require(_0xf41b('0x0'));var util=require(_0xf41b('0x1'));var path=require(_0xf41b('0x2'));var timeout=require(_0xf41b('0x3'));var express=require('express');var router=express[_0xf41b('0x4')]();var fs_extra=require(_0xf41b('0x5'));var auth=require(_0xf41b('0x6'));var interaction=require(_0xf41b('0x7'));var config=require(_0xf41b('0x8'));var controller=require(_0xf41b('0x9'));router['get']('/',auth[_0xf41b('0xa')](),controller[_0xf41b('0xb')]);router[_0xf41b('0xc')]('/describe',auth[_0xf41b('0xa')](),controller[_0xf41b('0xd')]);router[_0xf41b('0xc')](_0xf41b('0xe'),auth[_0xf41b('0xa')](),controller[_0xf41b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf41b('0x10')]);router[_0xf41b('0x11')](_0xf41b('0xe'),auth['isAuthenticated'](),controller[_0xf41b('0x12')]);router['delete'](_0xf41b('0xe'),auth[_0xf41b('0xa')](),controller[_0xf41b('0x13')]);module[_0xf41b('0x14')]=router; \ No newline at end of file +var _0x6ebd=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6ebd,0x19b));var _0xd6eb=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x6ebd[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require('multer');var util=require(_0xd6eb('0x0'));var path=require('path');var timeout=require(_0xd6eb('0x1'));var express=require(_0xd6eb('0x2'));var router=express[_0xd6eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd6eb('0x4'));var interaction=require(_0xd6eb('0x5'));var config=require(_0xd6eb('0x6'));var controller=require(_0xd6eb('0x7'));router[_0xd6eb('0x8')]('/',auth[_0xd6eb('0x9')](),controller[_0xd6eb('0xa')]);router[_0xd6eb('0x8')](_0xd6eb('0xb'),auth[_0xd6eb('0x9')](),controller['describe']);router[_0xd6eb('0x8')](_0xd6eb('0xc'),auth[_0xd6eb('0x9')](),controller[_0xd6eb('0xd')]);router[_0xd6eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xd6eb('0xf')]);router[_0xd6eb('0x10')](_0xd6eb('0xc'),auth[_0xd6eb('0x9')](),controller[_0xd6eb('0x11')]);router['delete']('/:id',auth[_0xd6eb('0x9')](),controller[_0xd6eb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2e7db09..53bec19 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 _0x20e2=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x20e2,0x64));var _0x220e=function(_0x5e293a,_0x14ff49){_0x5e293a=_0x5e293a-0x0;var _0x2d1065=_0x20e2[_0x5e293a];return _0x2d1065;};'use strict';var multer=require(_0x220e('0x0'));var util=require('util');var path=require(_0x220e('0x1'));var timeout=require(_0x220e('0x2'));var express=require(_0x220e('0x3'));var router=express['Router']();var fs_extra=require(_0x220e('0x4'));var auth=require(_0x220e('0x5'));var interaction=require(_0x220e('0x6'));var config=require(_0x220e('0x7'));var controller=require(_0x220e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x220e('0x9')](_0x220e('0xa'),auth[_0x220e('0xb')](),controller[_0x220e('0xc')]);router[_0x220e('0x9')](_0x220e('0xd'),auth['isAuthenticated'](),controller[_0x220e('0xe')]);router['get'](_0x220e('0xf'),auth['isAuthenticated'](),controller[_0x220e('0x10')]);router[_0x220e('0x11')]('/',auth[_0x220e('0xb')](),controller['create']);router['post']('/:id/configurations',auth[_0x220e('0xb')](),controller[_0x220e('0x12')]);router[_0x220e('0x13')](_0x220e('0xa'),auth[_0x220e('0xb')](),controller['update']);router['delete'](_0x220e('0xa'),auth[_0x220e('0xb')](),controller[_0x220e('0x14')]);module[_0x220e('0x15')]=router; \ No newline at end of file +var _0x8c30=['post','create','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id/configurations','/:id/fields'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x8c30,0x18f));var _0x08c3=function(_0x4e4bfd,_0x1e43a8){_0x4e4bfd=_0x4e4bfd-0x0;var _0x597b86=_0x8c30[_0x4e4bfd];return _0x597b86;};'use strict';var multer=require(_0x08c3('0x0'));var util=require('util');var path=require(_0x08c3('0x1'));var timeout=require(_0x08c3('0x2'));var express=require(_0x08c3('0x3'));var router=express[_0x08c3('0x4')]();var fs_extra=require(_0x08c3('0x5'));var auth=require(_0x08c3('0x6'));var interaction=require(_0x08c3('0x7'));var config=require(_0x08c3('0x8'));var controller=require(_0x08c3('0x9'));router['get']('/',auth[_0x08c3('0xa')](),controller[_0x08c3('0xb')]);router[_0x08c3('0xc')]('/:id',auth[_0x08c3('0xa')](),controller['show']);router['get'](_0x08c3('0xd'),auth[_0x08c3('0xa')](),controller['getConfigurations']);router['get'](_0x08c3('0xe'),auth[_0x08c3('0xa')](),controller['getFields']);router[_0x08c3('0xf')]('/',auth[_0x08c3('0xa')](),controller[_0x08c3('0x10')]);router[_0x08c3('0xf')](_0x08c3('0xd'),auth['isAuthenticated'](),controller[_0x08c3('0x11')]);router[_0x08c3('0x12')](_0x08c3('0x13'),auth[_0x08c3('0xa')](),controller[_0x08c3('0x14')]);router['delete'](_0x08c3('0x13'),auth[_0x08c3('0xa')](),controller[_0x08c3('0x15')]);module[_0x08c3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 22b9759..c17c33a 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 _0xf223=['STRING','ENUM','basic','integrationTab','newTab'];(function(_0x308350,_0x2ba908){var _0x59cc78=function(_0x2da3e5){while(--_0x2da3e5){_0x308350['push'](_0x308350['shift']());}};_0x59cc78(++_0x2ba908);}(_0xf223,0x1cc));var _0x3f22=function(_0x5595ca,_0x353118){_0x5595ca=_0x5595ca-0x0;var _0x4cda51=_0xf223[_0x5595ca];return _0x4cda51;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3f22('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3f22('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x3f22('0x1')](_0x3f22('0x2')),'defaultValue':_0x3f22('0x2')},'password':{'type':Sequelize[_0x3f22('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3f22('0x0')]},'token':{'type':Sequelize[_0x3f22('0x0')]},'tokenSecret':{'type':Sequelize[_0x3f22('0x0')]},'serverUrl':{'type':Sequelize[_0x3f22('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3f22('0x3'),_0x3f22('0x4')),'defaultValue':_0x3f22('0x3')}}; \ No newline at end of file +var _0xf683=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x471452,_0x157074){var _0x1220ac=function(_0x404d5c){while(--_0x404d5c){_0x471452['push'](_0x471452['shift']());}};_0x1220ac(++_0x157074);}(_0xf683,0x184));var _0x3f68=function(_0x4add0f,_0x46afc2){_0x4add0f=_0x4add0f-0x0;var _0x5d78ce=_0xf683[_0x4add0f];return _0x5d78ce;};'use strict';var Sequelize=require(_0x3f68('0x0'));module[_0x3f68('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f68('0x2')]},'username':{'type':Sequelize[_0x3f68('0x2')]},'remoteUri':{'type':Sequelize[_0x3f68('0x2')]},'authType':{'type':Sequelize[_0x3f68('0x3')](_0x3f68('0x4')),'defaultValue':_0x3f68('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3f68('0x2')]},'tokenSecret':{'type':Sequelize[_0x3f68('0x2')]},'serverUrl':{'type':Sequelize[_0x3f68('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3f68('0x5'),_0x3f68('0x6')),'defaultValue':_0x3f68('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 67c1d0e..37e8dbc 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 _0x8eef=['merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','DeskField','Descriptions','priority','authType','username','password','consumerKey','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields','stringify','test','Wrong\x20credentials','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','DeskAccount','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x8eef,0x190));var _0xf8ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8eef[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf8ee('0x0'));var rimraf=require(_0xf8ee('0x1'));var zipdir=require(_0xf8ee('0x2'));var jsonpatch=require(_0xf8ee('0x3'));var rp=require('request-promise');var moment=require(_0xf8ee('0x4'));var BPromise=require(_0xf8ee('0x5'));var Mustache=require(_0xf8ee('0x6'));var util=require(_0xf8ee('0x7'));var path=require('path');var sox=require(_0xf8ee('0x8'));var csv=require(_0xf8ee('0x9'));var ejs=require(_0xf8ee('0xa'));var fs=require('fs');var fs_extra=require(_0xf8ee('0xb'));var _=require(_0xf8ee('0xc'));var squel=require(_0xf8ee('0xd'));var crypto=require('crypto');var jsforce=require(_0xf8ee('0xe'));var deskjs=require(_0xf8ee('0xf'));var toCsv=require(_0xf8ee('0x9'));var querystring=require(_0xf8ee('0x10'));var Papa=require(_0xf8ee('0x11'));var Redis=require('ioredis');var authService=require(_0xf8ee('0x12'));var qs=require(_0xf8ee('0x13'));var as=require(_0xf8ee('0x14'));var hardwareService=require(_0xf8ee('0x15'));var logger=require(_0xf8ee('0x16'))(_0xf8ee('0x17'));var utils=require('../../config/utils');var config=require(_0xf8ee('0x18'));var licenseUtil=require(_0xf8ee('0x19'));var db=require(_0xf8ee('0x1a'))['db'];var integrations=require(_0xf8ee('0x1b'));function respondWithStatusCode(_0x2c0d7e,_0x4a5de8){_0x4a5de8=_0x4a5de8||0xcc;return function(_0x5cb18d){if(_0x5cb18d){return _0x2c0d7e[_0xf8ee('0x1c')](_0x4a5de8);}return _0x2c0d7e[_0xf8ee('0x1d')](_0x4a5de8)[_0xf8ee('0x1e')]();};}function respondWithResult(_0xebbb4,_0x146c48){_0x146c48=_0x146c48||0xc8;return function(_0x2c5479){if(_0x2c5479){return _0xebbb4[_0xf8ee('0x1d')](_0x146c48)['json'](_0x2c5479);}};}function respondWithFilteredResult(_0xcfb748,_0x37db3a){return function(_0x39f9ca){if(_0x39f9ca){var _0x439e4b=typeof _0x37db3a[_0xf8ee('0x1f')]==='undefined'&&typeof _0x37db3a[_0xf8ee('0x20')]===_0xf8ee('0x21');var _0x59c3c7=_0x39f9ca[_0xf8ee('0x22')];var _0x52e4aa=_0x439e4b?0x0:_0x37db3a[_0xf8ee('0x1f')];var _0x1cdb62=_0x439e4b?_0x39f9ca['count']:_0x37db3a[_0xf8ee('0x1f')]+_0x37db3a[_0xf8ee('0x20')];var _0x360858;if(_0x1cdb62>=_0x59c3c7){_0x1cdb62=_0x59c3c7;_0x360858=0xc8;}else{_0x360858=0xce;}_0xcfb748[_0xf8ee('0x1d')](_0x360858);return _0xcfb748[_0xf8ee('0x23')](_0xf8ee('0x24'),_0x52e4aa+'-'+_0x1cdb62+'/'+_0x59c3c7)[_0xf8ee('0x25')](_0x39f9ca);}return null;};}function patchUpdates(_0x3ab137){return function(_0x5a5987){try{jsonpatch[_0xf8ee('0x26')](_0x5a5987,_0x3ab137,!![]);}catch(_0xcbfd39){return BPromise[_0xf8ee('0x27')](_0xcbfd39);}return _0x5a5987[_0xf8ee('0x28')]();};}function saveUpdates(_0x471b99,_0x25ef54){return function(_0x59e756){if(_0x59e756){return _0x59e756[_0xf8ee('0x29')](_0x471b99)[_0xf8ee('0x2a')](function(_0x4e6394){return _0x4e6394;});}return null;};}function removeEntity(_0x5c63fa,_0x79b183){return function(_0x568d97){if(_0x568d97){return _0x568d97[_0xf8ee('0x2b')]()['then'](function(){_0x5c63fa[_0xf8ee('0x1d')](0xcc)[_0xf8ee('0x1e')]();});}};}function handleEntityNotFound(_0x515235,_0x39a5ad){return function(_0x3157ed){if(!_0x3157ed){_0x515235['sendStatus'](0x194);}return _0x3157ed;};}function handleError(_0x2f86d3,_0x515361){_0x515361=_0x515361||0x1f4;return function(_0x1f7a5e){logger[_0xf8ee('0x2c')](_0x1f7a5e['stack']);if(_0x1f7a5e[_0xf8ee('0x2d')]){delete _0x1f7a5e[_0xf8ee('0x2d')];}_0x2f86d3[_0xf8ee('0x1d')](_0x515361)[_0xf8ee('0x2e')](_0x1f7a5e);};}exports['index']=function(_0x3495d6,_0x1e9782){var _0x2da113={},_0x342e46={},_0x2cfe99={'count':0x0,'rows':[]};var _0x407e82=_[_0xf8ee('0x2f')](db[_0xf8ee('0x30')]['rawAttributes'],function(_0x5c2e73){return{'name':_0x5c2e73['fieldName'],'type':_0x5c2e73[_0xf8ee('0x31')]['key']};});_0x342e46['model']=_['map'](_0x407e82,_0xf8ee('0x2d'));_0x342e46[_0xf8ee('0x32')]=_[_0xf8ee('0x33')](_0x3495d6[_0xf8ee('0x32')]);_0x342e46[_0xf8ee('0x34')]=_[_0xf8ee('0x35')](_0x342e46[_0xf8ee('0x36')],_0x342e46[_0xf8ee('0x32')]);_0x2da113[_0xf8ee('0x37')]=_[_0xf8ee('0x35')](_0x342e46['model'],qs['fields'](_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x38')]));_0x2da113[_0xf8ee('0x37')]=_0x2da113['attributes'][_0xf8ee('0x39')]?_0x2da113[_0xf8ee('0x37')]:_0x342e46['model'];if(!_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x3a')]('nolimit')){_0x2da113[_0xf8ee('0x20')]=qs['limit'](_0x3495d6['query']['limit']);_0x2da113['offset']=qs['offset'](_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x1f')]);}_0x2da113[_0xf8ee('0x3b')]=qs[_0xf8ee('0x3c')](_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x3c')]);_0x2da113[_0xf8ee('0x3d')]=qs[_0xf8ee('0x34')](_[_0xf8ee('0x3e')](_0x3495d6['query'],_0x342e46[_0xf8ee('0x34')]),_0x407e82);if(_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x3f')]){_0x2da113[_0xf8ee('0x3d')]=_[_0xf8ee('0x40')](_0x2da113[_0xf8ee('0x3d')],{'$or':_[_0xf8ee('0x2f')](_0x407e82,function(_0x473cef){if(_0x473cef[_0xf8ee('0x31')]!==_0xf8ee('0x41')){var _0x3afcbb={};_0x3afcbb[_0x473cef[_0xf8ee('0x2d')]]={'$like':'%'+_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x3f')]+'%'};return _0x3afcbb;}})});}_0x2da113=_[_0xf8ee('0x40')]({},_0x2da113,_0x3495d6['options']);var _0x2ceb4e={'where':_0x2da113[_0xf8ee('0x3d')]};return db[_0xf8ee('0x30')][_0xf8ee('0x22')](_0x2ceb4e)[_0xf8ee('0x2a')](function(_0x2afc8a){_0x2cfe99['count']=_0x2afc8a;if(_0x3495d6[_0xf8ee('0x32')][_0xf8ee('0x42')]){_0x2da113['include']=[{'all':!![]}];}return db[_0xf8ee('0x30')]['findAll'](_0x2da113);})[_0xf8ee('0x2a')](function(_0x1a86c8){_0x2cfe99[_0xf8ee('0x43')]=_0x1a86c8;return _0x2cfe99;})[_0xf8ee('0x2a')](respondWithFilteredResult(_0x1e9782,_0x2da113))[_0xf8ee('0x44')](handleError(_0x1e9782,null));};exports[_0xf8ee('0x45')]=function(_0x29ec45,_0x440eed){var _0x42abd9={'raw':![],'where':{'id':_0x29ec45[_0xf8ee('0x46')]['id']}},_0x219207={};_0x219207[_0xf8ee('0x36')]=_[_0xf8ee('0x33')](db['DeskAccount'][_0xf8ee('0x47')]);_0x219207[_0xf8ee('0x32')]=_[_0xf8ee('0x33')](_0x29ec45['query']);_0x219207[_0xf8ee('0x34')]=_[_0xf8ee('0x35')](_0x219207[_0xf8ee('0x36')],_0x219207[_0xf8ee('0x32')]);_0x42abd9[_0xf8ee('0x37')]=_[_0xf8ee('0x35')](_0x219207[_0xf8ee('0x36')],qs[_0xf8ee('0x38')](_0x29ec45[_0xf8ee('0x32')][_0xf8ee('0x38')]));_0x42abd9[_0xf8ee('0x37')]=_0x42abd9[_0xf8ee('0x37')][_0xf8ee('0x39')]?_0x42abd9['attributes']:_0x219207['model'];if(_0x29ec45[_0xf8ee('0x32')]['includeAll']){_0x42abd9[_0xf8ee('0x48')]=[{'all':!![]}];}_0x42abd9=_['merge']({},_0x42abd9,_0x29ec45[_0xf8ee('0x49')]);return db[_0xf8ee('0x30')][_0xf8ee('0x4a')](_0x42abd9)[_0xf8ee('0x2a')](handleEntityNotFound(_0x440eed,null))[_0xf8ee('0x2a')](respondWithResult(_0x440eed,null))[_0xf8ee('0x44')](handleError(_0x440eed,null));};exports[_0xf8ee('0x4b')]=function(_0x4346c8,_0x4b80d5){return db[_0xf8ee('0x30')][_0xf8ee('0x4b')](_0x4346c8[_0xf8ee('0x4c')],{})[_0xf8ee('0x2a')](respondWithResult(_0x4b80d5,0xc9))['catch'](handleError(_0x4b80d5,null));};exports['update']=function(_0x325292,_0x54543c){if(_0x325292[_0xf8ee('0x4c')]['id']){delete _0x325292[_0xf8ee('0x4c')]['id'];}return db[_0xf8ee('0x30')][_0xf8ee('0x4a')]({'where':{'id':_0x325292[_0xf8ee('0x46')]['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0x54543c,null))['then'](saveUpdates(_0x325292[_0xf8ee('0x4c')],null))[_0xf8ee('0x2a')](respondWithResult(_0x54543c,null))[_0xf8ee('0x44')](handleError(_0x54543c,null));};exports[_0xf8ee('0x2b')]=function(_0x56bd4c,_0x3844c2){return db[_0xf8ee('0x30')]['find']({'where':{'id':_0x56bd4c[_0xf8ee('0x46')]['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0x3844c2,null))[_0xf8ee('0x2a')](removeEntity(_0x3844c2,null))[_0xf8ee('0x44')](handleError(_0x3844c2,null));};exports[_0xf8ee('0x4d')]=function(_0x339b2d,_0xc418ec,_0x4a32ae){var _0x141791={};var _0x881754={};var _0x5983ab;var _0x3b79a3;return db[_0xf8ee('0x30')]['findOne']({'where':{'id':_0x339b2d[_0xf8ee('0x46')]['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0xc418ec,null))[_0xf8ee('0x2a')](function(_0x481437){if(_0x481437){_0x5983ab=_0x481437;_0x881754[_0xf8ee('0x36')]=_[_0xf8ee('0x33')](db[_0xf8ee('0x4e')][_0xf8ee('0x47')]);_0x881754[_0xf8ee('0x32')]=_[_0xf8ee('0x33')](_0x339b2d[_0xf8ee('0x32')]);_0x881754[_0xf8ee('0x34')]=_[_0xf8ee('0x35')](_0x881754[_0xf8ee('0x36')],_0x881754[_0xf8ee('0x32')]);_0x141791[_0xf8ee('0x37')]=_[_0xf8ee('0x35')](_0x881754[_0xf8ee('0x36')],qs['fields'](_0x339b2d[_0xf8ee('0x32')][_0xf8ee('0x38')]));_0x141791['attributes']=_0x141791[_0xf8ee('0x37')][_0xf8ee('0x39')]?_0x141791[_0xf8ee('0x37')]:_0x881754['model'];_0x141791[_0xf8ee('0x3b')]=qs['sort'](_0x339b2d[_0xf8ee('0x32')][_0xf8ee('0x3c')]);_0x141791[_0xf8ee('0x3d')]=qs[_0xf8ee('0x34')](_[_0xf8ee('0x3e')](_0x339b2d['query'],_0x881754['filters']));if(_0x339b2d['query'][_0xf8ee('0x3f')]){_0x141791[_0xf8ee('0x3d')]=_[_0xf8ee('0x40')](_0x141791[_0xf8ee('0x3d')],{'$or':_['map'](_0x141791[_0xf8ee('0x37')],function(_0x3a6540){var _0x1a36ae={};_0x1a36ae[_0x3a6540]={'$like':'%'+_0x339b2d[_0xf8ee('0x32')][_0xf8ee('0x3f')]+'%'};return _0x1a36ae;})});}_0x141791=_[_0xf8ee('0x40')]({},_0x141791,_0x339b2d[_0xf8ee('0x49')]);return _0x5983ab[_0xf8ee('0x4d')](_0x141791);}})[_0xf8ee('0x2a')](function(_0x5a4e0d){if(_0x5a4e0d){_0x3b79a3=_0x5a4e0d[_0xf8ee('0x39')];if(!_0x339b2d['query'][_0xf8ee('0x3a')]('nolimit')){_0x141791[_0xf8ee('0x20')]=qs[_0xf8ee('0x20')](_0x339b2d[_0xf8ee('0x32')][_0xf8ee('0x20')]);_0x141791['offset']=qs[_0xf8ee('0x1f')](_0x339b2d[_0xf8ee('0x32')][_0xf8ee('0x1f')]);}return _0x5983ab[_0xf8ee('0x4d')](_0x141791);}})[_0xf8ee('0x2a')](function(_0x27afa3){if(_0x27afa3){return _0x27afa3?{'count':_0x3b79a3,'rows':_0x27afa3}:null;}})['then'](respondWithResult(_0xc418ec,null))[_0xf8ee('0x44')](handleError(_0xc418ec,null));};exports[_0xf8ee('0x4f')]=function(_0x31e192,_0x1fed19,_0x55a5c8){if(_0x31e192[_0xf8ee('0x4c')]['id']){delete _0x31e192[_0xf8ee('0x4c')]['id'];}return db[_0xf8ee('0x30')][_0xf8ee('0x50')]({'where':{'id':_0x31e192[_0xf8ee('0x46')]['id']}})[_0xf8ee('0x2a')](handleEntityNotFound(_0x1fed19,null))[_0xf8ee('0x2a')](function(_0x2f4933){if(_0x2f4933){_0x31e192['body'][_0xf8ee('0x51')]=_0x2f4933['id'];_0x31e192['body'][_0xf8ee('0x52')]=integrations['getSubjects'](_0x31e192['body'][_0xf8ee('0x53')],_0x31e192[_0xf8ee('0x4c')][_0xf8ee('0x31')]);_0x31e192[_0xf8ee('0x4c')]['Descriptions']=integrations[_0xf8ee('0x54')](_0x31e192['body']['channel'],_0x31e192['body'][_0xf8ee('0x31')]);return db[_0xf8ee('0x4e')][_0xf8ee('0x4b')](_0x31e192['body'],{'include':[{'model':db[_0xf8ee('0x55')],'as':_0xf8ee('0x52')},{'model':db[_0xf8ee('0x55')],'as':_0xf8ee('0x56')}]});}return null;})[_0xf8ee('0x2a')](respondWithResult(_0x1fed19,null))[_0xf8ee('0x44')](handleError(_0x1fed19,null));};exports['getFields']=function(_0x4a37ae,_0x2bead3,_0x5a2683){var _0x584bce=[{'name':'priority','label':_0xf8ee('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3793e8='';return db[_0xf8ee('0x30')][_0xf8ee('0x50')]({'where':{'id':_0x4a37ae[_0xf8ee('0x46')]['id']},'attributes':['id','remoteUri',_0xf8ee('0x58'),_0xf8ee('0x59'),_0xf8ee('0x5a'),_0xf8ee('0x5b'),_0xf8ee('0x5c'),_0xf8ee('0x5d'),'tokenSecret']})[_0xf8ee('0x2a')](handleEntityNotFound(_0x2bead3,null))[_0xf8ee('0x2a')](function(_0x2d6061){if(_0x2d6061){_0x3793e8=_0x2d6061['remoteUri'];var _0x48b9fe=_0x3793e8['slice'](-0x1);if(_0x48b9fe==='/'){_0x3793e8=_0x3793e8[_0xf8ee('0x5e')](0x0,_0x3793e8[_0xf8ee('0x5f')](_0x48b9fe));}var _0x5c2b30={'method':_0xf8ee('0x60'),'uri':util[_0xf8ee('0x61')](_0xf8ee('0x62'),_0x3793e8),'headers':{'Content-Type':'application/json','Accept':_0xf8ee('0x63')},'json':!![]};if(_0x2d6061[_0xf8ee('0x58')]===_0xf8ee('0x64')){_0x5c2b30['headers'][_0xf8ee('0x65')]=util[_0xf8ee('0x61')](_0xf8ee('0x66'),new Buffer(util[_0xf8ee('0x61')](_0xf8ee('0x67'),_0x2d6061[_0xf8ee('0x59')],_0x2d6061[_0xf8ee('0x5a')]))[_0xf8ee('0x68')](_0xf8ee('0x69')));}return rp(_0x5c2b30)['then'](function(_0x3c0e8f){return _0x584bce[_0xf8ee('0x6a')](_[_0xf8ee('0x2f')](_0x3c0e8f[_0xf8ee('0x6b')][_0xf8ee('0x6c')],function(_0x352cc2){return{'id':_0x352cc2[_0xf8ee('0x2d')],'name':_0x352cc2[_0xf8ee('0x2d')],'type':_0x352cc2[_0xf8ee('0x31')],'active':_0x352cc2[_0xf8ee('0x6d')],'label':_0x352cc2[_0xf8ee('0x6e')],'custom':!![]};}));});}})[_0xf8ee('0x2a')](function(_0x30fcd7){return{'count':_0x30fcd7[_0xf8ee('0x39')],'rows':_0x30fcd7};})[_0xf8ee('0x2a')](respondWithResult(_0x2bead3,null))[_0xf8ee('0x44')](function(_0x37f9d9){var _0x7d6fce=_0x4a37ae['query']['test']?0x1f4:_0x37f9d9[_0xf8ee('0x6f')]||0x1f4;logger[_0xf8ee('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0xf8ee('0x70'),_0x7d6fce,JSON[_0xf8ee('0x71')](_0x37f9d9));delete _0x37f9d9[_0xf8ee('0x2d')];if(_0x7d6fce===0x191){_0x7d6fce=0x190;}_0x2bead3['status'](_0x7d6fce)['send'](_0x4a37ae[_0xf8ee('0x32')][_0xf8ee('0x72')]?{'message':_0xf8ee('0x73'),'statusCode':_0x37f9d9[_0xf8ee('0x6f')]}:_0x37f9d9);});}; \ No newline at end of file +var _0x36b2=['consumerKey','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','password','base64','concat','_embedded','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','DeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','VIRTUAL','includeAll','rows','catch','show','length','merge','find','create','body','params','getConfigurations','findOne','DeskConfiguration','options','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','username'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x36b2,0x1c7));var _0x236b=function(_0x582e6c,_0x2b4349){_0x582e6c=_0x582e6c-0x0;var _0x13cbf4=_0x36b2[_0x582e6c];return _0x13cbf4;};'use strict';var emlformat=require(_0x236b('0x0'));var rimraf=require(_0x236b('0x1'));var zipdir=require(_0x236b('0x2'));var jsonpatch=require(_0x236b('0x3'));var rp=require(_0x236b('0x4'));var moment=require(_0x236b('0x5'));var BPromise=require(_0x236b('0x6'));var Mustache=require('mustache');var util=require(_0x236b('0x7'));var path=require(_0x236b('0x8'));var sox=require(_0x236b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x236b('0xa'));var _=require(_0x236b('0xb'));var squel=require(_0x236b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x236b('0xd'));var toCsv=require(_0x236b('0xe'));var querystring=require(_0x236b('0xf'));var Papa=require('papaparse');var Redis=require(_0x236b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x236b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x236b('0x12'));var logger=require(_0x236b('0x13'))(_0x236b('0x14'));var utils=require('../../config/utils');var config=require(_0x236b('0x15'));var licenseUtil=require(_0x236b('0x16'));var db=require(_0x236b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2190bd,_0xb2b554){_0xb2b554=_0xb2b554||0xcc;return function(_0x4a979b){if(_0x4a979b){return _0x2190bd[_0x236b('0x18')](_0xb2b554);}return _0x2190bd[_0x236b('0x19')](_0xb2b554)[_0x236b('0x1a')]();};}function respondWithResult(_0x5014ca,_0x48ca17){_0x48ca17=_0x48ca17||0xc8;return function(_0x457b5c){if(_0x457b5c){return _0x5014ca[_0x236b('0x19')](_0x48ca17)[_0x236b('0x1b')](_0x457b5c);}};}function respondWithFilteredResult(_0x4d57b0,_0x3a904b){return function(_0x2f05f9){if(_0x2f05f9){var _0x17c9af=typeof _0x3a904b[_0x236b('0x1c')]===_0x236b('0x1d')&&typeof _0x3a904b['limit']===_0x236b('0x1d');var _0x173adb=_0x2f05f9[_0x236b('0x1e')];var _0x26fc13=_0x17c9af?0x0:_0x3a904b[_0x236b('0x1c')];var _0x13d796=_0x17c9af?_0x2f05f9['count']:_0x3a904b['offset']+_0x3a904b[_0x236b('0x1f')];var _0x499a13;if(_0x13d796>=_0x173adb){_0x13d796=_0x173adb;_0x499a13=0xc8;}else{_0x499a13=0xce;}_0x4d57b0[_0x236b('0x19')](_0x499a13);return _0x4d57b0[_0x236b('0x20')](_0x236b('0x21'),_0x26fc13+'-'+_0x13d796+'/'+_0x173adb)[_0x236b('0x1b')](_0x2f05f9);}return null;};}function patchUpdates(_0x5bb590){return function(_0x2e60f7){try{jsonpatch[_0x236b('0x22')](_0x2e60f7,_0x5bb590,!![]);}catch(_0x384f35){return BPromise[_0x236b('0x23')](_0x384f35);}return _0x2e60f7[_0x236b('0x24')]();};}function saveUpdates(_0x5c1dfb,_0x31250a){return function(_0x278f1b){if(_0x278f1b){return _0x278f1b[_0x236b('0x25')](_0x5c1dfb)[_0x236b('0x26')](function(_0x4a610f){return _0x4a610f;});}return null;};}function removeEntity(_0x13a899,_0x484692){return function(_0x3197eb){if(_0x3197eb){return _0x3197eb[_0x236b('0x27')]()[_0x236b('0x26')](function(){_0x13a899[_0x236b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bb3b3,_0x42e8fc){return function(_0x5e3e90){if(!_0x5e3e90){_0x3bb3b3[_0x236b('0x18')](0x194);}return _0x5e3e90;};}function handleError(_0x4c97d4,_0x56efb8){_0x56efb8=_0x56efb8||0x1f4;return function(_0x150f2c){logger['error'](_0x150f2c['stack']);if(_0x150f2c['name']){delete _0x150f2c[_0x236b('0x28')];}_0x4c97d4[_0x236b('0x19')](_0x56efb8)[_0x236b('0x29')](_0x150f2c);};}exports['index']=function(_0x258b5d,_0x1cd888){var _0x530fbe={},_0x230e18={},_0x51b1d1={'count':0x0,'rows':[]};var _0x276ac5=_['map'](db[_0x236b('0x2a')][_0x236b('0x2b')],function(_0xe7523c){return{'name':_0xe7523c['fieldName'],'type':_0xe7523c[_0x236b('0x2c')][_0x236b('0x2d')]};});_0x230e18[_0x236b('0x2e')]=_[_0x236b('0x2f')](_0x276ac5,_0x236b('0x28'));_0x230e18[_0x236b('0x30')]=_[_0x236b('0x31')](_0x258b5d[_0x236b('0x30')]);_0x230e18[_0x236b('0x32')]=_[_0x236b('0x33')](_0x230e18[_0x236b('0x2e')],_0x230e18[_0x236b('0x30')]);_0x530fbe['attributes']=_[_0x236b('0x33')](_0x230e18[_0x236b('0x2e')],qs[_0x236b('0x34')](_0x258b5d[_0x236b('0x30')][_0x236b('0x34')]));_0x530fbe[_0x236b('0x35')]=_0x530fbe[_0x236b('0x35')]['length']?_0x530fbe['attributes']:_0x230e18[_0x236b('0x2e')];if(!_0x258b5d[_0x236b('0x30')]['hasOwnProperty']('nolimit')){_0x530fbe['limit']=qs[_0x236b('0x1f')](_0x258b5d[_0x236b('0x30')]['limit']);_0x530fbe[_0x236b('0x1c')]=qs[_0x236b('0x1c')](_0x258b5d['query'][_0x236b('0x1c')]);}_0x530fbe[_0x236b('0x36')]=qs[_0x236b('0x37')](_0x258b5d[_0x236b('0x30')][_0x236b('0x37')]);_0x530fbe[_0x236b('0x38')]=qs['filters'](_[_0x236b('0x39')](_0x258b5d[_0x236b('0x30')],_0x230e18[_0x236b('0x32')]),_0x276ac5);if(_0x258b5d[_0x236b('0x30')][_0x236b('0x3a')]){_0x530fbe[_0x236b('0x38')]=_['merge'](_0x530fbe['where'],{'$or':_[_0x236b('0x2f')](_0x276ac5,function(_0x9c3632){if(_0x9c3632['type']!==_0x236b('0x3b')){var _0x296602={};_0x296602[_0x9c3632['name']]={'$like':'%'+_0x258b5d['query'][_0x236b('0x3a')]+'%'};return _0x296602;}})});}_0x530fbe=_['merge']({},_0x530fbe,_0x258b5d['options']);var _0x4472c6={'where':_0x530fbe[_0x236b('0x38')]};return db[_0x236b('0x2a')][_0x236b('0x1e')](_0x4472c6)['then'](function(_0x2321ce){_0x51b1d1['count']=_0x2321ce;if(_0x258b5d['query'][_0x236b('0x3c')]){_0x530fbe['include']=[{'all':!![]}];}return db[_0x236b('0x2a')]['findAll'](_0x530fbe);})[_0x236b('0x26')](function(_0x2bd982){_0x51b1d1[_0x236b('0x3d')]=_0x2bd982;return _0x51b1d1;})[_0x236b('0x26')](respondWithFilteredResult(_0x1cd888,_0x530fbe))[_0x236b('0x3e')](handleError(_0x1cd888,null));};exports[_0x236b('0x3f')]=function(_0x4b9164,_0x486e72){var _0x3d0305={'raw':![],'where':{'id':_0x4b9164['params']['id']}},_0x396dca={};_0x396dca['model']=_[_0x236b('0x31')](db['DeskAccount'][_0x236b('0x2b')]);_0x396dca[_0x236b('0x30')]=_['keys'](_0x4b9164['query']);_0x396dca['filters']=_[_0x236b('0x33')](_0x396dca[_0x236b('0x2e')],_0x396dca[_0x236b('0x30')]);_0x3d0305[_0x236b('0x35')]=_[_0x236b('0x33')](_0x396dca[_0x236b('0x2e')],qs[_0x236b('0x34')](_0x4b9164['query'][_0x236b('0x34')]));_0x3d0305[_0x236b('0x35')]=_0x3d0305[_0x236b('0x35')][_0x236b('0x40')]?_0x3d0305[_0x236b('0x35')]:_0x396dca[_0x236b('0x2e')];if(_0x4b9164[_0x236b('0x30')][_0x236b('0x3c')]){_0x3d0305['include']=[{'all':!![]}];}_0x3d0305=_[_0x236b('0x41')]({},_0x3d0305,_0x4b9164['options']);return db[_0x236b('0x2a')][_0x236b('0x42')](_0x3d0305)[_0x236b('0x26')](handleEntityNotFound(_0x486e72,null))[_0x236b('0x26')](respondWithResult(_0x486e72,null))[_0x236b('0x3e')](handleError(_0x486e72,null));};exports[_0x236b('0x43')]=function(_0x4b553b,_0x348da5){return db[_0x236b('0x2a')][_0x236b('0x43')](_0x4b553b[_0x236b('0x44')],{})[_0x236b('0x26')](respondWithResult(_0x348da5,0xc9))[_0x236b('0x3e')](handleError(_0x348da5,null));};exports[_0x236b('0x25')]=function(_0x29ffbf,_0x439cbd){if(_0x29ffbf[_0x236b('0x44')]['id']){delete _0x29ffbf[_0x236b('0x44')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x29ffbf[_0x236b('0x45')]['id']}})['then'](handleEntityNotFound(_0x439cbd,null))[_0x236b('0x26')](saveUpdates(_0x29ffbf['body'],null))[_0x236b('0x26')](respondWithResult(_0x439cbd,null))[_0x236b('0x3e')](handleError(_0x439cbd,null));};exports[_0x236b('0x27')]=function(_0x2b2c96,_0x3eb44f){return db['DeskAccount'][_0x236b('0x42')]({'where':{'id':_0x2b2c96['params']['id']}})[_0x236b('0x26')](handleEntityNotFound(_0x3eb44f,null))[_0x236b('0x26')](removeEntity(_0x3eb44f,null))[_0x236b('0x3e')](handleError(_0x3eb44f,null));};exports[_0x236b('0x46')]=function(_0x2b0d7d,_0x230b1a,_0x41d0e1){var _0x2c3c0b={};var _0x510344={};var _0x5dc567;var _0x160e44;return db[_0x236b('0x2a')][_0x236b('0x47')]({'where':{'id':_0x2b0d7d[_0x236b('0x45')]['id']}})[_0x236b('0x26')](handleEntityNotFound(_0x230b1a,null))[_0x236b('0x26')](function(_0x4f208e){if(_0x4f208e){_0x5dc567=_0x4f208e;_0x510344['model']=_[_0x236b('0x31')](db[_0x236b('0x48')][_0x236b('0x2b')]);_0x510344[_0x236b('0x30')]=_['keys'](_0x2b0d7d[_0x236b('0x30')]);_0x510344[_0x236b('0x32')]=_[_0x236b('0x33')](_0x510344[_0x236b('0x2e')],_0x510344[_0x236b('0x30')]);_0x2c3c0b[_0x236b('0x35')]=_[_0x236b('0x33')](_0x510344[_0x236b('0x2e')],qs[_0x236b('0x34')](_0x2b0d7d['query'][_0x236b('0x34')]));_0x2c3c0b[_0x236b('0x35')]=_0x2c3c0b['attributes'][_0x236b('0x40')]?_0x2c3c0b[_0x236b('0x35')]:_0x510344[_0x236b('0x2e')];_0x2c3c0b[_0x236b('0x36')]=qs[_0x236b('0x37')](_0x2b0d7d[_0x236b('0x30')][_0x236b('0x37')]);_0x2c3c0b[_0x236b('0x38')]=qs['filters'](_['pick'](_0x2b0d7d[_0x236b('0x30')],_0x510344['filters']));if(_0x2b0d7d['query'][_0x236b('0x3a')]){_0x2c3c0b[_0x236b('0x38')]=_[_0x236b('0x41')](_0x2c3c0b[_0x236b('0x38')],{'$or':_[_0x236b('0x2f')](_0x2c3c0b['attributes'],function(_0xd8ba62){var _0x15d8c9={};_0x15d8c9[_0xd8ba62]={'$like':'%'+_0x2b0d7d[_0x236b('0x30')][_0x236b('0x3a')]+'%'};return _0x15d8c9;})});}_0x2c3c0b=_[_0x236b('0x41')]({},_0x2c3c0b,_0x2b0d7d[_0x236b('0x49')]);return _0x5dc567[_0x236b('0x46')](_0x2c3c0b);}})['then'](function(_0x33112f){if(_0x33112f){_0x160e44=_0x33112f[_0x236b('0x40')];if(!_0x2b0d7d['query'][_0x236b('0x4a')]('nolimit')){_0x2c3c0b[_0x236b('0x1f')]=qs['limit'](_0x2b0d7d[_0x236b('0x30')][_0x236b('0x1f')]);_0x2c3c0b[_0x236b('0x1c')]=qs[_0x236b('0x1c')](_0x2b0d7d[_0x236b('0x30')][_0x236b('0x1c')]);}return _0x5dc567[_0x236b('0x46')](_0x2c3c0b);}})[_0x236b('0x26')](function(_0xfc631e){if(_0xfc631e){return _0xfc631e?{'count':_0x160e44,'rows':_0xfc631e}:null;}})[_0x236b('0x26')](respondWithResult(_0x230b1a,null))[_0x236b('0x3e')](handleError(_0x230b1a,null));};exports['addConfiguration']=function(_0x5ab434,_0x44aee7,_0x1c7cc5){if(_0x5ab434[_0x236b('0x44')]['id']){delete _0x5ab434[_0x236b('0x44')]['id'];}return db[_0x236b('0x2a')][_0x236b('0x47')]({'where':{'id':_0x5ab434['params']['id']}})[_0x236b('0x26')](handleEntityNotFound(_0x44aee7,null))[_0x236b('0x26')](function(_0x14e01c){if(_0x14e01c){_0x5ab434['body'][_0x236b('0x4b')]=_0x14e01c['id'];_0x5ab434[_0x236b('0x44')][_0x236b('0x4c')]=integrations[_0x236b('0x4d')](_0x5ab434[_0x236b('0x44')]['channel'],_0x5ab434[_0x236b('0x44')][_0x236b('0x2c')]);_0x5ab434[_0x236b('0x44')][_0x236b('0x4e')]=integrations[_0x236b('0x4f')](_0x5ab434[_0x236b('0x44')][_0x236b('0x50')],_0x5ab434['body'][_0x236b('0x2c')]);return db[_0x236b('0x48')][_0x236b('0x43')](_0x5ab434[_0x236b('0x44')],{'include':[{'model':db[_0x236b('0x51')],'as':_0x236b('0x4c')},{'model':db[_0x236b('0x51')],'as':_0x236b('0x4e')}]});}return null;})[_0x236b('0x26')](respondWithResult(_0x44aee7,null))[_0x236b('0x3e')](handleError(_0x44aee7,null));};exports[_0x236b('0x52')]=function(_0x2681a5,_0x1d7c8f,_0xf5c561){var _0x1fe195=[{'name':_0x236b('0x53'),'label':_0x236b('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x27911c='';return db[_0x236b('0x2a')][_0x236b('0x47')]({'where':{'id':_0x2681a5[_0x236b('0x45')]['id']},'attributes':['id','remoteUri','authType',_0x236b('0x54'),'password',_0x236b('0x55'),'consumerSecret',_0x236b('0x56'),'tokenSecret']})[_0x236b('0x26')](handleEntityNotFound(_0x1d7c8f,null))[_0x236b('0x26')](function(_0xa6c994){if(_0xa6c994){_0x27911c=_0xa6c994['remoteUri'];var _0x380814=_0x27911c[_0x236b('0x57')](-0x1);if(_0x380814==='/'){_0x27911c=_0x27911c[_0x236b('0x58')](0x0,_0x27911c[_0x236b('0x59')](_0x380814));}var _0x25f953={'method':_0x236b('0x5a'),'uri':util[_0x236b('0x5b')](_0x236b('0x5c'),_0x27911c),'headers':{'Content-Type':_0x236b('0x5d'),'Accept':_0x236b('0x5d')},'json':!![]};if(_0xa6c994[_0x236b('0x5e')]===_0x236b('0x5f')){_0x25f953[_0x236b('0x60')][_0x236b('0x61')]=util[_0x236b('0x5b')](_0x236b('0x62'),new Buffer(util[_0x236b('0x5b')]('%s:%s',_0xa6c994[_0x236b('0x54')],_0xa6c994[_0x236b('0x63')]))['toString'](_0x236b('0x64')));}return rp(_0x25f953)[_0x236b('0x26')](function(_0x2f24e1){return _0x1fe195[_0x236b('0x65')](_[_0x236b('0x2f')](_0x2f24e1[_0x236b('0x66')]['entries'],function(_0x9ca6dd){return{'id':_0x9ca6dd[_0x236b('0x28')],'name':_0x9ca6dd['name'],'type':_0x9ca6dd['type'],'active':_0x9ca6dd['active'],'label':_0x9ca6dd['label'],'custom':!![]};}));});}})[_0x236b('0x26')](function(_0x117a40){return{'count':_0x117a40[_0x236b('0x40')],'rows':_0x117a40};})[_0x236b('0x26')](respondWithResult(_0x1d7c8f,null))[_0x236b('0x3e')](function(_0x456c66){var _0x3966a4=_0x2681a5[_0x236b('0x30')][_0x236b('0x67')]?0x1f4:_0x456c66[_0x236b('0x68')]||0x1f4;logger[_0x236b('0x69')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3966a4,JSON[_0x236b('0x6a')](_0x456c66));delete _0x456c66[_0x236b('0x28')];if(_0x3966a4===0x191){_0x3966a4=0x190;}_0x1d7c8f[_0x236b('0x19')](_0x3966a4)[_0x236b('0x29')](_0x2681a5[_0x236b('0x30')][_0x236b('0x67')]?{'message':_0x236b('0x6b'),'statusCode':_0x456c66[_0x236b('0x68')]}:_0x456c66);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index af85d2c..dae9b7b 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 _0x10fe=['rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','int_desk_accounts','api','moment','bluebird','request-promise','path'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x10fe,0xd7));var _0xe10f=function(_0x5b7619,_0x4d50f8){_0x5b7619=_0x5b7619-0x0;var _0x2b3134=_0x10fe[_0x5b7619];return _0x2b3134;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe10f('0x0'));var moment=require(_0xe10f('0x1'));var BPromise=require(_0xe10f('0x2'));var rp=require(_0xe10f('0x3'));var fs=require('fs');var path=require(_0xe10f('0x4'));var rimraf=require(_0xe10f('0x5'));var config=require(_0xe10f('0x6'));var attributes=require(_0xe10f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe10f('0x8')]=function(_0x49fa18,_0x5bcb7e){return _0x49fa18[_0xe10f('0x9')]('DeskAccount',attributes,{'tableName':_0xe10f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x275c=['api','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x275c,0x142));var _0xc275=function(_0x5fdf27,_0xd2c77f){_0x5fdf27=_0x5fdf27-0x0;var _0x43d0cc=_0x275c[_0x5fdf27];return _0x43d0cc;};'use strict';var _=require('lodash');var util=require(_0xc275('0x0'));var logger=require(_0xc275('0x1'))(_0xc275('0x2'));var moment=require('moment');var BPromise=require(_0xc275('0x3'));var rp=require(_0xc275('0x4'));var fs=require('fs');var path=require(_0xc275('0x5'));var rimraf=require('rimraf');var config=require(_0xc275('0x6'));var attributes=require(_0xc275('0x7'));var integrations=require(_0xc275('0x8'));module[_0xc275('0x9')]=function(_0x26517c,_0x349825){return _0x26517c['define'](_0xc275('0xa'),attributes,{'tableName':_0xc275('0xb'),'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 c49cf03..b369bf9 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 _0x7dcb=['http','then','info','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','where','include','model','attributes','map','debug','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7dcb,0xe8));var _0xb7dc=function(_0x129ed5,_0x4c5b10){_0x129ed5=_0x129ed5-0x0;var _0x46443c=_0x7dcb[_0x129ed5];return _0x46443c;};'use strict';var _=require(_0xb7dc('0x0'));var util=require(_0xb7dc('0x1'));var moment=require(_0xb7dc('0x2'));var BPromise=require(_0xb7dc('0x3'));var rs=require(_0xb7dc('0x4'));var fs=require('fs');var Redis=require(_0xb7dc('0x5'));var db=require(_0xb7dc('0x6'))['db'];var utils=require(_0xb7dc('0x7'));var logger=require(_0xb7dc('0x8'))(_0xb7dc('0x9'));var config=require(_0xb7dc('0xa'));var jayson=require(_0xb7dc('0xb'));var client=jayson[_0xb7dc('0xc')][_0xb7dc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5aae92,_0xed3e1d,_0x419ed8){return new BPromise(function(_0x318bae,_0x55407e){return client['request'](_0x5aae92,_0x419ed8)[_0xb7dc('0xe')](function(_0x4b2835){logger[_0xb7dc('0xf')]('DeskAccount,\x20%s,\x20%s',_0xed3e1d,'request\x20sent');logger['debug'](_0xb7dc('0x10'),_0xed3e1d,'request\x20sent',JSON[_0xb7dc('0x11')](_0x4b2835));if(_0x4b2835[_0xb7dc('0x12')]){if(_0x4b2835[_0xb7dc('0x12')]['code']===0x1f4){logger[_0xb7dc('0x12')](_0xb7dc('0x13'),_0xed3e1d,_0x4b2835[_0xb7dc('0x12')][_0xb7dc('0x14')]);return _0x55407e(_0x4b2835[_0xb7dc('0x12')]['message']);}logger['error'](_0xb7dc('0x13'),_0xed3e1d,_0x4b2835[_0xb7dc('0x12')][_0xb7dc('0x14')]);return _0x318bae(_0x4b2835[_0xb7dc('0x12')]['message']);}else{logger[_0xb7dc('0xf')]('DeskAccount,\x20%s,\x20%s',_0xed3e1d,'request\x20sent');_0x318bae(_0x4b2835[_0xb7dc('0x15')][_0xb7dc('0x14')]);}})[_0xb7dc('0x16')](function(_0x29eed9){logger[_0xb7dc('0x12')](_0xb7dc('0x13'),_0xed3e1d,_0x29eed9);_0x55407e(_0x29eed9);});});}exports[_0xb7dc('0x17')]=function(_0x1572d1){var _0x30b939=this;return new Promise(function(_0x4d1eb6,_0x429274){return db[_0xb7dc('0x18')]['findAll']({'raw':_0x1572d1['options']?_0x1572d1[_0xb7dc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1572d1[_0xb7dc('0x19')]?_0x1572d1[_0xb7dc('0x19')][_0xb7dc('0x1a')]||null:null,'attributes':_0x1572d1['options']?_0x1572d1[_0xb7dc('0x19')]['attributes']||null:null,'limit':_0x1572d1[_0xb7dc('0x19')]?_0x1572d1[_0xb7dc('0x19')]['limit']||null:null,'include':_0x1572d1['options']?_0x1572d1[_0xb7dc('0x19')][_0xb7dc('0x1b')]?_['map'](_0x1572d1[_0xb7dc('0x19')][_0xb7dc('0x1b')],function(_0x162e40){return{'model':db[_0x162e40[_0xb7dc('0x1c')]],'as':_0x162e40['as'],'attributes':_0x162e40[_0xb7dc('0x1d')],'include':_0x162e40['include']?_['map'](_0x162e40[_0xb7dc('0x1b')],function(_0x4d7885){return{'model':db[_0x4d7885[_0xb7dc('0x1c')]],'as':_0x4d7885['as'],'attributes':_0x4d7885[_0xb7dc('0x1d')],'include':_0x4d7885['include']?_[_0xb7dc('0x1e')](_0x4d7885[_0xb7dc('0x1b')],function(_0x113859){return{'model':db[_0x113859[_0xb7dc('0x1c')]],'as':_0x113859['as'],'attributes':_0x113859['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7dc('0xe')](function(_0x5a54a4){logger[_0xb7dc('0xf')](_0xb7dc('0x17'),_0x1572d1);logger[_0xb7dc('0x1f')](_0xb7dc('0x17'),_0x1572d1,JSON[_0xb7dc('0x11')](_0x5a54a4));_0x4d1eb6(_0x5a54a4);})[_0xb7dc('0x16')](function(_0x398c52){logger[_0xb7dc('0x12')](_0xb7dc('0x17'),_0x398c52[_0xb7dc('0x14')],_0x1572d1);_0x429274(_0x30b939['error'](0x1f4,_0x398c52[_0xb7dc('0x14')]));});});};exports['ShowDeskAccount']=function(_0xee01ef){var _0x3a975b=this;return new Promise(function(_0x402207,_0x28737e){return db[_0xb7dc('0x18')][_0xb7dc('0x20')]({'raw':_0xee01ef[_0xb7dc('0x19')]?_0xee01ef['options'][_0xb7dc('0x21')]===undefined?!![]:![]:!![],'where':_0xee01ef[_0xb7dc('0x19')]?_0xee01ef[_0xb7dc('0x19')][_0xb7dc('0x1a')]||null:null,'attributes':_0xee01ef[_0xb7dc('0x19')]?_0xee01ef[_0xb7dc('0x19')][_0xb7dc('0x1d')]||null:null,'include':_0xee01ef[_0xb7dc('0x19')]?_0xee01ef['options'][_0xb7dc('0x1b')]?_[_0xb7dc('0x1e')](_0xee01ef[_0xb7dc('0x19')]['include'],function(_0x3a2de4){return{'model':db[_0x3a2de4[_0xb7dc('0x1c')]],'as':_0x3a2de4['as'],'attributes':_0x3a2de4[_0xb7dc('0x1d')],'include':_0x3a2de4[_0xb7dc('0x1b')]?_[_0xb7dc('0x1e')](_0x3a2de4[_0xb7dc('0x1b')],function(_0x41be87){return{'model':db[_0x41be87['model']],'as':_0x41be87['as'],'attributes':_0x41be87[_0xb7dc('0x1d')],'include':_0x41be87[_0xb7dc('0x1b')]?_[_0xb7dc('0x1e')](_0x41be87[_0xb7dc('0x1b')],function(_0x3824d8){return{'model':db[_0x3824d8['model']],'as':_0x3824d8['as'],'attributes':_0x3824d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7dc('0xe')](function(_0x39d0f5){logger[_0xb7dc('0xf')](_0xb7dc('0x22'),_0xee01ef);logger[_0xb7dc('0x1f')](_0xb7dc('0x22'),_0xee01ef,JSON['stringify'](_0x39d0f5));_0x402207(_0x39d0f5);})[_0xb7dc('0x16')](function(_0x53c4df){logger['error'](_0xb7dc('0x22'),_0x53c4df[_0xb7dc('0x14')],_0xee01ef);_0x28737e(_0x3a975b['error'](0x1f4,_0x53c4df[_0xb7dc('0x14')]));});});}; \ No newline at end of file +var _0x7a1a=['include','model','map','then','catch','find','where','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetDeskAccount','DeskAccount','findAll','options','raw','attributes'];(function(_0x1fd5e5,_0x2d7ac1){var _0x514bcd=function(_0x3a5a0c){while(--_0x3a5a0c){_0x1fd5e5['push'](_0x1fd5e5['shift']());}};_0x514bcd(++_0x2d7ac1);}(_0x7a1a,0x131));var _0xa7a1=function(_0x56b505,_0x5daeb7){_0x56b505=_0x56b505-0x0;var _0x4b7a3e=_0x7a1a[_0x56b505];return _0x4b7a3e;};'use strict';var _=require(_0xa7a1('0x0'));var util=require('util');var moment=require(_0xa7a1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7a1('0x2'));var fs=require('fs');var Redis=require(_0xa7a1('0x3'));var db=require(_0xa7a1('0x4'))['db'];var utils=require(_0xa7a1('0x5'));var logger=require(_0xa7a1('0x6'))(_0xa7a1('0x7'));var config=require(_0xa7a1('0x8'));var jayson=require(_0xa7a1('0x9'));var client=jayson[_0xa7a1('0xa')][_0xa7a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1945be,_0x25be4c,_0x318684){return new BPromise(function(_0x12f24f,_0x57518f){return client['request'](_0x1945be,_0x318684)['then'](function(_0x208d05){logger[_0xa7a1('0xc')](_0xa7a1('0xd'),_0x25be4c,_0xa7a1('0xe'));logger[_0xa7a1('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x25be4c,'request\x20sent',JSON[_0xa7a1('0x10')](_0x208d05));if(_0x208d05[_0xa7a1('0x11')]){if(_0x208d05['error']['code']===0x1f4){logger['error'](_0xa7a1('0xd'),_0x25be4c,_0x208d05[_0xa7a1('0x11')]['message']);return _0x57518f(_0x208d05[_0xa7a1('0x11')][_0xa7a1('0x12')]);}logger[_0xa7a1('0x11')]('DeskAccount,\x20%s,\x20%s',_0x25be4c,_0x208d05['error'][_0xa7a1('0x12')]);return _0x12f24f(_0x208d05[_0xa7a1('0x11')][_0xa7a1('0x12')]);}else{logger[_0xa7a1('0xc')](_0xa7a1('0xd'),_0x25be4c,_0xa7a1('0xe'));_0x12f24f(_0x208d05['result'][_0xa7a1('0x12')]);}})['catch'](function(_0x568edc){logger[_0xa7a1('0x11')]('DeskAccount,\x20%s,\x20%s',_0x25be4c,_0x568edc);_0x57518f(_0x568edc);});});}exports[_0xa7a1('0x13')]=function(_0x29b714){var _0x45d3b2=this;return new Promise(function(_0x48b904,_0x54ddd4){return db[_0xa7a1('0x14')][_0xa7a1('0x15')]({'raw':_0x29b714[_0xa7a1('0x16')]?_0x29b714[_0xa7a1('0x16')][_0xa7a1('0x17')]===undefined?!![]:![]:!![],'where':_0x29b714[_0xa7a1('0x16')]?_0x29b714[_0xa7a1('0x16')]['where']||null:null,'attributes':_0x29b714[_0xa7a1('0x16')]?_0x29b714[_0xa7a1('0x16')][_0xa7a1('0x18')]||null:null,'limit':_0x29b714[_0xa7a1('0x16')]?_0x29b714[_0xa7a1('0x16')]['limit']||null:null,'include':_0x29b714[_0xa7a1('0x16')]?_0x29b714[_0xa7a1('0x16')][_0xa7a1('0x19')]?_['map'](_0x29b714['options'][_0xa7a1('0x19')],function(_0x47b63c){return{'model':db[_0x47b63c[_0xa7a1('0x1a')]],'as':_0x47b63c['as'],'attributes':_0x47b63c[_0xa7a1('0x18')],'include':_0x47b63c[_0xa7a1('0x19')]?_[_0xa7a1('0x1b')](_0x47b63c['include'],function(_0x91295c){return{'model':db[_0x91295c[_0xa7a1('0x1a')]],'as':_0x91295c['as'],'attributes':_0x91295c[_0xa7a1('0x18')],'include':_0x91295c[_0xa7a1('0x19')]?_[_0xa7a1('0x1b')](_0x91295c[_0xa7a1('0x19')],function(_0x2c6eb2){return{'model':db[_0x2c6eb2[_0xa7a1('0x1a')]],'as':_0x2c6eb2['as'],'attributes':_0x2c6eb2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7a1('0x1c')](function(_0x57ef88){logger[_0xa7a1('0xc')](_0xa7a1('0x13'),_0x29b714);logger[_0xa7a1('0xf')]('GetDeskAccount',_0x29b714,JSON[_0xa7a1('0x10')](_0x57ef88));_0x48b904(_0x57ef88);})[_0xa7a1('0x1d')](function(_0x4fe82d){logger[_0xa7a1('0x11')]('GetDeskAccount',_0x4fe82d['message'],_0x29b714);_0x54ddd4(_0x45d3b2[_0xa7a1('0x11')](0x1f4,_0x4fe82d[_0xa7a1('0x12')]));});});};exports['ShowDeskAccount']=function(_0x281b46){var _0x5987d0=this;return new Promise(function(_0xb5e3a7,_0x22d9e6){return db[_0xa7a1('0x14')][_0xa7a1('0x1e')]({'raw':_0x281b46[_0xa7a1('0x16')]?_0x281b46[_0xa7a1('0x16')][_0xa7a1('0x17')]===undefined?!![]:![]:!![],'where':_0x281b46[_0xa7a1('0x16')]?_0x281b46[_0xa7a1('0x16')][_0xa7a1('0x1f')]||null:null,'attributes':_0x281b46[_0xa7a1('0x16')]?_0x281b46[_0xa7a1('0x16')][_0xa7a1('0x18')]||null:null,'include':_0x281b46[_0xa7a1('0x16')]?_0x281b46[_0xa7a1('0x16')][_0xa7a1('0x19')]?_[_0xa7a1('0x1b')](_0x281b46['options'][_0xa7a1('0x19')],function(_0x26e1b5){return{'model':db[_0x26e1b5[_0xa7a1('0x1a')]],'as':_0x26e1b5['as'],'attributes':_0x26e1b5['attributes'],'include':_0x26e1b5[_0xa7a1('0x19')]?_[_0xa7a1('0x1b')](_0x26e1b5[_0xa7a1('0x19')],function(_0x58dcaa){return{'model':db[_0x58dcaa['model']],'as':_0x58dcaa['as'],'attributes':_0x58dcaa[_0xa7a1('0x18')],'include':_0x58dcaa[_0xa7a1('0x19')]?_[_0xa7a1('0x1b')](_0x58dcaa['include'],function(_0xc67e1){return{'model':db[_0xc67e1[_0xa7a1('0x1a')]],'as':_0xc67e1['as'],'attributes':_0xc67e1[_0xa7a1('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa7a1('0x1c')](function(_0x155687){logger['info'](_0xa7a1('0x20'),_0x281b46);logger['debug'](_0xa7a1('0x20'),_0x281b46,JSON[_0xa7a1('0x10')](_0x155687));_0xb5e3a7(_0x155687);})['catch'](function(_0x467035){logger[_0xa7a1('0x11')](_0xa7a1('0x20'),_0x467035[_0xa7a1('0x12')],_0x281b46);_0x22d9e6(_0x5987d0[_0xa7a1('0x11')](0x1f4,_0x467035[_0xa7a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 64cd855..c9059d0 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1941ee,_0x3b65e7){var _0x2aad97=function(_0x295fdd){while(--_0x295fdd){_0x1941ee['push'](_0x1941ee['shift']());}};_0x2aad97(++_0x3b65e7);}(_0xedd9,0xfc));var _0x9edd=function(_0x34bfe9,_0x32e6b9){_0x34bfe9=_0x34bfe9-0x0;var _0x12958a=_0xedd9[_0x34bfe9];return _0x12958a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x5bf212,_0x920f8c){var _0x48d839=function(_0x4295f4){while(--_0x4295f4){_0x5bf212['push'](_0x5bf212['shift']());}};_0x48d839(++_0x920f8c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 637003a..c89f86d 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 _0x0beb=['sequelize','exports','STRING'];(function(_0x181acc,_0x14c2a1){var _0x4bf284=function(_0x55019e){while(--_0x55019e){_0x181acc['push'](_0x181acc['shift']());}};_0x4bf284(++_0x14c2a1);}(_0x0beb,0xab));var _0xb0be=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0beb[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xb0be('0x0'));module[_0xb0be('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0be('0x2')]}}; \ No newline at end of file +var _0xac89=['sequelize','exports','STRING'];(function(_0x2dde2b,_0x4190c6){var _0x401188=function(_0x42bf39){while(--_0x42bf39){_0x2dde2b['push'](_0x2dde2b['shift']());}};_0x401188(++_0x4190c6);}(_0xac89,0x132));var _0x9ac8=function(_0x218e55,_0x109855){_0x218e55=_0x218e55-0x0;var _0x17a16d=_0xac89[_0x218e55];return _0x17a16d;};'use strict';var Sequelize=require(_0x9ac8('0x0'));module[_0x9ac8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9ac8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f365aae..aa338f4 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 _0x910e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xe01c43,_0x3a7889){var _0x4451d4=function(_0x27c70a){while(--_0x27c70a){_0xe01c43['push'](_0xe01c43['shift']());}};_0x4451d4(++_0x3a7889);}(_0x910e,0x9c));var _0xe910=function(_0x301cd7,_0x3bb77f){_0x301cd7=_0x301cd7-0x0;var _0x1b9965=_0x910e[_0x301cd7];return _0x1b9965;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe910('0x0'));var zipdir=require(_0xe910('0x1'));var jsonpatch=require(_0xe910('0x2'));var rp=require(_0xe910('0x3'));var moment=require(_0xe910('0x4'));var BPromise=require(_0xe910('0x5'));var Mustache=require(_0xe910('0x6'));var util=require(_0xe910('0x7'));var path=require(_0xe910('0x8'));var sox=require('sox');var csv=require(_0xe910('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe910('0xa'));var crypto=require('crypto');var jsforce=require(_0xe910('0xb'));var deskjs=require(_0xe910('0xc'));var toCsv=require(_0xe910('0x9'));var querystring=require(_0xe910('0xd'));var Papa=require('papaparse');var Redis=require(_0xe910('0xe'));var authService=require(_0xe910('0xf'));var qs=require(_0xe910('0x10'));var as=require(_0xe910('0x11'));var hardwareService=require(_0xe910('0x12'));var logger=require(_0xe910('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe910('0x14'));var licenseUtil=require(_0xe910('0x15'));var db=require(_0xe910('0x16'))['db'];function respondWithStatusCode(_0x5bf6f0,_0x4b7fc5){_0x4b7fc5=_0x4b7fc5||0xcc;return function(_0x2dbe25){if(_0x2dbe25){return _0x5bf6f0['sendStatus'](_0x4b7fc5);}return _0x5bf6f0[_0xe910('0x17')](_0x4b7fc5)[_0xe910('0x18')]();};}function respondWithResult(_0x1a24b3,_0x4034d7){_0x4034d7=_0x4034d7||0xc8;return function(_0x4c4434){if(_0x4c4434){return _0x1a24b3[_0xe910('0x17')](_0x4034d7)[_0xe910('0x19')](_0x4c4434);}};}function respondWithFilteredResult(_0x2edb25,_0x540d97){return function(_0x5c9ca2){if(_0x5c9ca2){var _0x4084a7=typeof _0x540d97[_0xe910('0x1a')]===_0xe910('0x1b')&&typeof _0x540d97[_0xe910('0x1c')]===_0xe910('0x1b');var _0x35d022=_0x5c9ca2[_0xe910('0x1d')];var _0x31bb46=_0x4084a7?0x0:_0x540d97[_0xe910('0x1a')];var _0x1c0881=_0x4084a7?_0x5c9ca2[_0xe910('0x1d')]:_0x540d97['offset']+_0x540d97[_0xe910('0x1c')];var _0x4b6bc2;if(_0x1c0881>=_0x35d022){_0x1c0881=_0x35d022;_0x4b6bc2=0xc8;}else{_0x4b6bc2=0xce;}_0x2edb25[_0xe910('0x17')](_0x4b6bc2);return _0x2edb25[_0xe910('0x1e')](_0xe910('0x1f'),_0x31bb46+'-'+_0x1c0881+'/'+_0x35d022)['json'](_0x5c9ca2);}return null;};}function patchUpdates(_0xe5adf){return function(_0x2dc503){try{jsonpatch[_0xe910('0x20')](_0x2dc503,_0xe5adf,!![]);}catch(_0xa04287){return BPromise[_0xe910('0x21')](_0xa04287);}return _0x2dc503[_0xe910('0x22')]();};}function saveUpdates(_0x3911e3,_0x83ce7b){return function(_0x2dcec9){if(_0x2dcec9){return _0x2dcec9[_0xe910('0x23')](_0x3911e3)[_0xe910('0x24')](function(_0x1d750d){return _0x1d750d;});}return null;};}function removeEntity(_0x27735c,_0x523b59){return function(_0x27b131){if(_0x27b131){return _0x27b131['destroy']()[_0xe910('0x24')](function(){_0x27735c[_0xe910('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df5e0,_0x50867d){return function(_0x4d3c4f){if(!_0x4d3c4f){_0x2df5e0[_0xe910('0x25')](0x194);}return _0x4d3c4f;};}function handleError(_0x76e35e,_0x593040){_0x593040=_0x593040||0x1f4;return function(_0xfc100c){logger[_0xe910('0x26')](_0xfc100c[_0xe910('0x27')]);if(_0xfc100c[_0xe910('0x28')]){delete _0xfc100c[_0xe910('0x28')];}_0x76e35e[_0xe910('0x17')](_0x593040)[_0xe910('0x29')](_0xfc100c);};}exports[_0xe910('0x2a')]=function(_0x1c894c,_0x171c16){var _0x667936={},_0x1b8be5={},_0x36bbf3={'count':0x0,'rows':[]};var _0x163f49=_[_0xe910('0x2b')](db['DeskConfiguration'][_0xe910('0x2c')],function(_0x37529b){return{'name':_0x37529b['fieldName'],'type':_0x37529b['type'][_0xe910('0x2d')]};});_0x1b8be5[_0xe910('0x2e')]=_[_0xe910('0x2b')](_0x163f49,'name');_0x1b8be5['query']=_[_0xe910('0x2f')](_0x1c894c[_0xe910('0x30')]);_0x1b8be5[_0xe910('0x31')]=_[_0xe910('0x32')](_0x1b8be5[_0xe910('0x2e')],_0x1b8be5['query']);_0x667936[_0xe910('0x33')]=_[_0xe910('0x32')](_0x1b8be5[_0xe910('0x2e')],qs[_0xe910('0x34')](_0x1c894c[_0xe910('0x30')]['fields']));_0x667936['attributes']=_0x667936['attributes'][_0xe910('0x35')]?_0x667936[_0xe910('0x33')]:_0x1b8be5[_0xe910('0x2e')];if(!_0x1c894c['query']['hasOwnProperty'](_0xe910('0x36'))){_0x667936[_0xe910('0x1c')]=qs[_0xe910('0x1c')](_0x1c894c[_0xe910('0x30')][_0xe910('0x1c')]);_0x667936['offset']=qs[_0xe910('0x1a')](_0x1c894c[_0xe910('0x30')][_0xe910('0x1a')]);}_0x667936['order']=qs[_0xe910('0x37')](_0x1c894c['query']['sort']);_0x667936[_0xe910('0x38')]=qs[_0xe910('0x31')](_[_0xe910('0x39')](_0x1c894c[_0xe910('0x30')],_0x1b8be5[_0xe910('0x31')]),_0x163f49);if(_0x1c894c[_0xe910('0x30')]['filter']){_0x667936[_0xe910('0x38')]=_[_0xe910('0x3a')](_0x667936[_0xe910('0x38')],{'$or':_['map'](_0x163f49,function(_0x5935ae){if(_0x5935ae[_0xe910('0x3b')]!==_0xe910('0x3c')){var _0x3ab8f6={};_0x3ab8f6[_0x5935ae[_0xe910('0x28')]]={'$like':'%'+_0x1c894c[_0xe910('0x30')][_0xe910('0x3d')]+'%'};return _0x3ab8f6;}})});}_0x667936=_[_0xe910('0x3a')]({},_0x667936,_0x1c894c[_0xe910('0x3e')]);var _0x2e5832={'where':_0x667936[_0xe910('0x38')]};return db[_0xe910('0x3f')][_0xe910('0x1d')](_0x2e5832)['then'](function(_0x55dfc6){_0x36bbf3['count']=_0x55dfc6;if(_0x1c894c[_0xe910('0x30')][_0xe910('0x40')]){_0x667936[_0xe910('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe910('0x42')](_0x667936);})[_0xe910('0x24')](function(_0x276770){_0x36bbf3[_0xe910('0x43')]=_0x276770;return _0x36bbf3;})[_0xe910('0x24')](respondWithFilteredResult(_0x171c16,_0x667936))[_0xe910('0x44')](handleError(_0x171c16,null));};exports[_0xe910('0x45')]=function(_0x1707f4,_0xb63eac){var _0x34a424={'raw':![],'where':{'id':_0x1707f4[_0xe910('0x46')]['id']}},_0x393456={};_0x393456['model']=_[_0xe910('0x2f')](db[_0xe910('0x3f')][_0xe910('0x2c')]);_0x393456[_0xe910('0x30')]=_['keys'](_0x1707f4[_0xe910('0x30')]);_0x393456['filters']=_[_0xe910('0x32')](_0x393456[_0xe910('0x2e')],_0x393456['query']);_0x34a424[_0xe910('0x33')]=_[_0xe910('0x32')](_0x393456[_0xe910('0x2e')],qs[_0xe910('0x34')](_0x1707f4['query'][_0xe910('0x34')]));_0x34a424[_0xe910('0x33')]=_0x34a424['attributes']['length']?_0x34a424[_0xe910('0x33')]:_0x393456[_0xe910('0x2e')];if(_0x1707f4[_0xe910('0x30')][_0xe910('0x40')]){_0x34a424['include']=[{'all':!![]}];}_0x34a424=_[_0xe910('0x3a')]({},_0x34a424,_0x1707f4[_0xe910('0x3e')]);return db[_0xe910('0x3f')][_0xe910('0x47')](_0x34a424)[_0xe910('0x24')](handleEntityNotFound(_0xb63eac,null))['then'](respondWithResult(_0xb63eac,null))[_0xe910('0x44')](handleError(_0xb63eac,null));};exports[_0xe910('0x48')]=function(_0x2b2272,_0x3aeb5c){return db[_0xe910('0x3f')]['create'](_0x2b2272[_0xe910('0x49')],{})[_0xe910('0x24')](respondWithResult(_0x3aeb5c,0xc9))[_0xe910('0x44')](handleError(_0x3aeb5c,null));};exports[_0xe910('0x23')]=function(_0x1964ea,_0x423298){if(_0x1964ea[_0xe910('0x49')]['id']){delete _0x1964ea['body']['id'];}return db[_0xe910('0x3f')][_0xe910('0x47')]({'where':{'id':_0x1964ea['params']['id']}})[_0xe910('0x24')](handleEntityNotFound(_0x423298,null))[_0xe910('0x24')](saveUpdates(_0x1964ea[_0xe910('0x49')],null))[_0xe910('0x24')](respondWithResult(_0x423298,null))['catch'](handleError(_0x423298,null));};exports[_0xe910('0x4a')]=function(_0x55eb55,_0x30e6b2){return db[_0xe910('0x3f')]['find']({'where':{'id':_0x55eb55['params']['id']}})[_0xe910('0x24')](handleEntityNotFound(_0x30e6b2,null))[_0xe910('0x24')](removeEntity(_0x30e6b2,null))[_0xe910('0x44')](handleError(_0x30e6b2,null));};exports[_0xe910('0x4b')]=function(_0x4f9c20,_0xf3cd5a,_0x4b41c6){var _0x96e3fc={};var _0x44186e={};var _0x3cabfd;var _0x579941;return db['DeskConfiguration'][_0xe910('0x4c')]({'where':{'id':_0x4f9c20['params']['id']}})[_0xe910('0x24')](handleEntityNotFound(_0xf3cd5a,null))[_0xe910('0x24')](function(_0xa9232c){if(_0xa9232c){_0x3cabfd=_0xa9232c;_0x44186e[_0xe910('0x2e')]=_[_0xe910('0x2f')](db[_0xe910('0x4d')][_0xe910('0x2c')]);_0x44186e[_0xe910('0x30')]=_[_0xe910('0x2f')](_0x4f9c20[_0xe910('0x30')]);_0x44186e[_0xe910('0x31')]=_[_0xe910('0x32')](_0x44186e['model'],_0x44186e[_0xe910('0x30')]);_0x96e3fc['attributes']=_[_0xe910('0x32')](_0x44186e[_0xe910('0x2e')],qs[_0xe910('0x34')](_0x4f9c20[_0xe910('0x30')][_0xe910('0x34')]));_0x96e3fc[_0xe910('0x33')]=_0x96e3fc[_0xe910('0x33')]['length']?_0x96e3fc[_0xe910('0x33')]:_0x44186e['model'];_0x96e3fc[_0xe910('0x4e')]=qs[_0xe910('0x37')](_0x4f9c20['query']['sort']);_0x96e3fc[_0xe910('0x38')]=qs['filters'](_[_0xe910('0x39')](_0x4f9c20[_0xe910('0x30')],_0x44186e['filters']));if(_0x4f9c20['query'][_0xe910('0x3d')]){_0x96e3fc[_0xe910('0x38')]=_[_0xe910('0x3a')](_0x96e3fc[_0xe910('0x38')],{'$or':_[_0xe910('0x2b')](_0x96e3fc['attributes'],function(_0xafe51d){var _0x43a5b3={};_0x43a5b3[_0xafe51d]={'$like':'%'+_0x4f9c20['query']['filter']+'%'};return _0x43a5b3;})});}_0x96e3fc=_[_0xe910('0x3a')]({},_0x96e3fc,_0x4f9c20[_0xe910('0x3e')]);return _0x3cabfd[_0xe910('0x4b')](_0x96e3fc);}})[_0xe910('0x24')](function(_0x2ba713){if(_0x2ba713){_0x579941=_0x2ba713[_0xe910('0x35')];if(!_0x4f9c20[_0xe910('0x30')][_0xe910('0x4f')](_0xe910('0x36'))){_0x96e3fc[_0xe910('0x1c')]=qs[_0xe910('0x1c')](_0x4f9c20[_0xe910('0x30')][_0xe910('0x1c')]);_0x96e3fc[_0xe910('0x1a')]=qs[_0xe910('0x1a')](_0x4f9c20['query'][_0xe910('0x1a')]);}return _0x3cabfd[_0xe910('0x4b')](_0x96e3fc);}})[_0xe910('0x24')](function(_0x2493f6){if(_0x2493f6){return _0x2493f6?{'count':_0x579941,'rows':_0x2493f6}:null;}})[_0xe910('0x24')](respondWithResult(_0xf3cd5a,null))[_0xe910('0x44')](handleError(_0xf3cd5a,null));};exports['getSubjects']=function(_0x133f47,_0x5938e7,_0x39fa50){var _0x58de89={};var _0x2976f1={};var _0x3ebdc3;var _0x141c60;return db[_0xe910('0x3f')][_0xe910('0x4c')]({'where':{'id':_0x133f47['params']['id']}})['then'](handleEntityNotFound(_0x5938e7,null))['then'](function(_0x295aaa){if(_0x295aaa){_0x3ebdc3=_0x295aaa;_0x2976f1['model']=_[_0xe910('0x2f')](db[_0xe910('0x4d')][_0xe910('0x2c')]);_0x2976f1[_0xe910('0x30')]=_[_0xe910('0x2f')](_0x133f47[_0xe910('0x30')]);_0x2976f1[_0xe910('0x31')]=_[_0xe910('0x32')](_0x2976f1[_0xe910('0x2e')],_0x2976f1['query']);_0x58de89[_0xe910('0x33')]=_[_0xe910('0x32')](_0x2976f1[_0xe910('0x2e')],qs[_0xe910('0x34')](_0x133f47[_0xe910('0x30')][_0xe910('0x34')]));_0x58de89[_0xe910('0x33')]=_0x58de89[_0xe910('0x33')][_0xe910('0x35')]?_0x58de89[_0xe910('0x33')]:_0x2976f1[_0xe910('0x2e')];_0x58de89[_0xe910('0x4e')]=qs[_0xe910('0x37')](_0x133f47['query'][_0xe910('0x37')]);_0x58de89['where']=qs[_0xe910('0x31')](_[_0xe910('0x39')](_0x133f47[_0xe910('0x30')],_0x2976f1[_0xe910('0x31')]));if(_0x133f47[_0xe910('0x30')]['filter']){_0x58de89[_0xe910('0x38')]=_[_0xe910('0x3a')](_0x58de89['where'],{'$or':_[_0xe910('0x2b')](_0x58de89[_0xe910('0x33')],function(_0x4b26d6){var _0x409fad={};_0x409fad[_0x4b26d6]={'$like':'%'+_0x133f47[_0xe910('0x30')]['filter']+'%'};return _0x409fad;})});}_0x58de89=_[_0xe910('0x3a')]({},_0x58de89,_0x133f47[_0xe910('0x3e')]);return _0x3ebdc3[_0xe910('0x50')](_0x58de89);}})[_0xe910('0x24')](function(_0x4c5050){if(_0x4c5050){_0x141c60=_0x4c5050['length'];if(!_0x133f47['query'][_0xe910('0x4f')](_0xe910('0x36'))){_0x58de89[_0xe910('0x1c')]=qs['limit'](_0x133f47[_0xe910('0x30')]['limit']);_0x58de89[_0xe910('0x1a')]=qs['offset'](_0x133f47['query'][_0xe910('0x1a')]);}return _0x3ebdc3[_0xe910('0x50')](_0x58de89);}})['then'](function(_0x41125d){if(_0x41125d){return _0x41125d?{'count':_0x141c60,'rows':_0x41125d}:null;}})[_0xe910('0x24')](respondWithResult(_0x5938e7,null))['catch'](handleError(_0x5938e7,null));};exports[_0xe910('0x51')]=function(_0x57cd3e,_0x361f63,_0xd9ce48){var _0x5d6301={};var _0x5e0225={};var _0x291232;var _0x3bfa0a;return db[_0xe910('0x3f')][_0xe910('0x4c')]({'where':{'id':_0x57cd3e[_0xe910('0x46')]['id']}})['then'](handleEntityNotFound(_0x361f63,null))['then'](function(_0x48082c){if(_0x48082c){_0x291232=_0x48082c;_0x5e0225[_0xe910('0x2e')]=_[_0xe910('0x2f')](db['DeskField'][_0xe910('0x2c')]);_0x5e0225[_0xe910('0x30')]=_[_0xe910('0x2f')](_0x57cd3e[_0xe910('0x30')]);_0x5e0225['filters']=_['intersection'](_0x5e0225[_0xe910('0x2e')],_0x5e0225['query']);_0x5d6301[_0xe910('0x33')]=_[_0xe910('0x32')](_0x5e0225[_0xe910('0x2e')],qs[_0xe910('0x34')](_0x57cd3e[_0xe910('0x30')][_0xe910('0x34')]));_0x5d6301['attributes']=_0x5d6301[_0xe910('0x33')]['length']?_0x5d6301[_0xe910('0x33')]:_0x5e0225[_0xe910('0x2e')];_0x5d6301[_0xe910('0x4e')]=qs[_0xe910('0x37')](_0x57cd3e[_0xe910('0x30')][_0xe910('0x37')]);_0x5d6301[_0xe910('0x38')]=qs['filters'](_['pick'](_0x57cd3e['query'],_0x5e0225[_0xe910('0x31')]));if(_0x57cd3e[_0xe910('0x30')][_0xe910('0x3d')]){_0x5d6301[_0xe910('0x38')]=_['merge'](_0x5d6301['where'],{'$or':_['map'](_0x5d6301['attributes'],function(_0x4a6f82){var _0x10f51e={};_0x10f51e[_0x4a6f82]={'$like':'%'+_0x57cd3e[_0xe910('0x30')][_0xe910('0x3d')]+'%'};return _0x10f51e;})});}_0x5d6301=_[_0xe910('0x3a')]({},_0x5d6301,_0x57cd3e[_0xe910('0x3e')]);return _0x291232[_0xe910('0x51')](_0x5d6301);}})[_0xe910('0x24')](function(_0x200801){if(_0x200801){_0x3bfa0a=_0x200801[_0xe910('0x35')];if(!_0x57cd3e['query'][_0xe910('0x4f')](_0xe910('0x36'))){_0x5d6301[_0xe910('0x1c')]=qs[_0xe910('0x1c')](_0x57cd3e[_0xe910('0x30')][_0xe910('0x1c')]);_0x5d6301[_0xe910('0x1a')]=qs['offset'](_0x57cd3e[_0xe910('0x30')][_0xe910('0x1a')]);}return _0x291232['getDescriptions'](_0x5d6301);}})[_0xe910('0x24')](function(_0xf6dbaa){if(_0xf6dbaa){return _0xf6dbaa?{'count':_0x3bfa0a,'rows':_0xf6dbaa}:null;}})[_0xe910('0x24')](respondWithResult(_0x361f63,null))[_0xe910('0x44')](handleError(_0x361f63,null));};exports[_0xe910('0x52')]=function(_0x5ec9a4,_0x3a0424,_0x11949c){var _0x2bbcf8={};var _0x2171d3={};var _0x2f4aaa;var _0x5ab258;return db[_0xe910('0x3f')]['findOne']({'where':{'id':_0x5ec9a4[_0xe910('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a0424,null))['then'](function(_0x495dab){if(_0x495dab){_0x2f4aaa=_0x495dab;_0x2171d3['model']=_[_0xe910('0x2f')](db[_0xe910('0x53')]['rawAttributes']);_0x2171d3[_0xe910('0x30')]=_['keys'](_0x5ec9a4[_0xe910('0x30')]);_0x2171d3[_0xe910('0x31')]=_['intersection'](_0x2171d3[_0xe910('0x2e')],_0x2171d3[_0xe910('0x30')]);_0x2bbcf8[_0xe910('0x33')]=_[_0xe910('0x32')](_0x2171d3['model'],qs['fields'](_0x5ec9a4[_0xe910('0x30')][_0xe910('0x34')]));_0x2bbcf8[_0xe910('0x33')]=_0x2bbcf8[_0xe910('0x33')][_0xe910('0x35')]?_0x2bbcf8['attributes']:_0x2171d3['model'];_0x2bbcf8[_0xe910('0x4e')]=qs[_0xe910('0x37')](_0x5ec9a4[_0xe910('0x30')]['sort']);_0x2bbcf8[_0xe910('0x38')]=qs[_0xe910('0x31')](_[_0xe910('0x39')](_0x5ec9a4[_0xe910('0x30')],_0x2171d3[_0xe910('0x31')]));if(_0x5ec9a4[_0xe910('0x30')][_0xe910('0x3d')]){_0x2bbcf8[_0xe910('0x38')]=_[_0xe910('0x3a')](_0x2bbcf8['where'],{'$or':_['map'](_0x2bbcf8[_0xe910('0x33')],function(_0x379f57){var _0x55d0da={};_0x55d0da[_0x379f57]={'$like':'%'+_0x5ec9a4[_0xe910('0x30')][_0xe910('0x3d')]+'%'};return _0x55d0da;})});}_0x2bbcf8=_[_0xe910('0x3a')]({},_0x2bbcf8,_0x5ec9a4[_0xe910('0x3e')]);return _0x2f4aaa[_0xe910('0x52')](_0x2bbcf8);}})[_0xe910('0x24')](function(_0x3a6d61){if(_0x3a6d61){_0x5ab258=_0x3a6d61[_0xe910('0x35')];if(!_0x5ec9a4[_0xe910('0x30')]['hasOwnProperty'](_0xe910('0x36'))){_0x2bbcf8[_0xe910('0x1c')]=qs['limit'](_0x5ec9a4[_0xe910('0x30')][_0xe910('0x1c')]);_0x2bbcf8['offset']=qs[_0xe910('0x1a')](_0x5ec9a4[_0xe910('0x30')][_0xe910('0x1a')]);}return _0x2f4aaa['getTags'](_0x2bbcf8);}})[_0xe910('0x24')](function(_0xb2c51e){if(_0xb2c51e){return _0xb2c51e?{'count':_0x5ab258,'rows':_0xb2c51e}:null;}})[_0xe910('0x24')](respondWithResult(_0x3a0424,null))['catch'](handleError(_0x3a0424,null));};exports[_0xe910('0x54')]=function(_0x48cc73,_0x1f9f56,_0x35750c){if(_0x48cc73[_0xe910('0x49')]['id']){delete _0x48cc73[_0xe910('0x49')]['id'];}return db[_0xe910('0x3f')][_0xe910('0x4c')]({'where':{'id':_0x48cc73[_0xe910('0x46')]['id']}})[_0xe910('0x24')](handleEntityNotFound(_0x1f9f56,null))[_0xe910('0x24')](function(_0xdc87da){if(_0xdc87da){return _0xdc87da[_0xe910('0x54')](_0x48cc73[_0xe910('0x49')][_0xe910('0x55')]||[]);}return null;})[_0xe910('0x24')](respondWithResult(_0x1f9f56,null))[_0xe910('0x44')](handleError(_0x1f9f56,null));}; \ No newline at end of file +var _0x4c89=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','DeskConfiguration','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','getFields','DeskField','getSubjects','findOne','order','getDescriptions','getTags','setTags','eml-format','rimraf'];(function(_0xb65ffb,_0x2cc0af){var _0x58f55c=function(_0x24ba56){while(--_0x24ba56){_0xb65ffb['push'](_0xb65ffb['shift']());}};_0x58f55c(++_0x2cc0af);}(_0x4c89,0x14a));var _0x94c8=function(_0x3dad20,_0x13e0d9){_0x3dad20=_0x3dad20-0x0;var _0x2233d5=_0x4c89[_0x3dad20];return _0x2233d5;};'use strict';var emlformat=require(_0x94c8('0x0'));var rimraf=require(_0x94c8('0x1'));var zipdir=require(_0x94c8('0x2'));var jsonpatch=require(_0x94c8('0x3'));var rp=require(_0x94c8('0x4'));var moment=require(_0x94c8('0x5'));var BPromise=require(_0x94c8('0x6'));var Mustache=require(_0x94c8('0x7'));var util=require(_0x94c8('0x8'));var path=require(_0x94c8('0x9'));var sox=require(_0x94c8('0xa'));var csv=require(_0x94c8('0xb'));var ejs=require(_0x94c8('0xc'));var fs=require('fs');var fs_extra=require(_0x94c8('0xd'));var _=require('lodash');var squel=require(_0x94c8('0xe'));var crypto=require(_0x94c8('0xf'));var jsforce=require(_0x94c8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x94c8('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94c8('0x11'));var authService=require(_0x94c8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94c8('0x13'));var logger=require(_0x94c8('0x14'))(_0x94c8('0x15'));var utils=require(_0x94c8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x94c8('0x17'))['db'];function respondWithStatusCode(_0x23912f,_0x5a5d38){_0x5a5d38=_0x5a5d38||0xcc;return function(_0x4194ee){if(_0x4194ee){return _0x23912f[_0x94c8('0x18')](_0x5a5d38);}return _0x23912f[_0x94c8('0x19')](_0x5a5d38)[_0x94c8('0x1a')]();};}function respondWithResult(_0x57ea05,_0x19a4e3){_0x19a4e3=_0x19a4e3||0xc8;return function(_0x2032a){if(_0x2032a){return _0x57ea05[_0x94c8('0x19')](_0x19a4e3)[_0x94c8('0x1b')](_0x2032a);}};}function respondWithFilteredResult(_0x3324de,_0x42b254){return function(_0x360e73){if(_0x360e73){var _0x5809c3=typeof _0x42b254[_0x94c8('0x1c')]===_0x94c8('0x1d')&&typeof _0x42b254[_0x94c8('0x1e')]===_0x94c8('0x1d');var _0x476372=_0x360e73[_0x94c8('0x1f')];var _0x12e04e=_0x5809c3?0x0:_0x42b254[_0x94c8('0x1c')];var _0x3b7a49=_0x5809c3?_0x360e73[_0x94c8('0x1f')]:_0x42b254[_0x94c8('0x1c')]+_0x42b254['limit'];var _0x25fb58;if(_0x3b7a49>=_0x476372){_0x3b7a49=_0x476372;_0x25fb58=0xc8;}else{_0x25fb58=0xce;}_0x3324de[_0x94c8('0x19')](_0x25fb58);return _0x3324de[_0x94c8('0x20')](_0x94c8('0x21'),_0x12e04e+'-'+_0x3b7a49+'/'+_0x476372)['json'](_0x360e73);}return null;};}function patchUpdates(_0x1fdc32){return function(_0x2fc4d8){try{jsonpatch[_0x94c8('0x22')](_0x2fc4d8,_0x1fdc32,!![]);}catch(_0xe13734){return BPromise[_0x94c8('0x23')](_0xe13734);}return _0x2fc4d8[_0x94c8('0x24')]();};}function saveUpdates(_0x5b1a6c,_0x6b0e3){return function(_0x47a7a7){if(_0x47a7a7){return _0x47a7a7[_0x94c8('0x25')](_0x5b1a6c)[_0x94c8('0x26')](function(_0x187df9){return _0x187df9;});}return null;};}function removeEntity(_0x176de3,_0x5cb964){return function(_0x129bb6){if(_0x129bb6){return _0x129bb6[_0x94c8('0x27')]()[_0x94c8('0x26')](function(){_0x176de3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xec87d0,_0x3cdc0c){return function(_0x39741f){if(!_0x39741f){_0xec87d0[_0x94c8('0x18')](0x194);}return _0x39741f;};}function handleError(_0x358b5b,_0x32614e){_0x32614e=_0x32614e||0x1f4;return function(_0x542ced){logger['error'](_0x542ced[_0x94c8('0x28')]);if(_0x542ced[_0x94c8('0x29')]){delete _0x542ced[_0x94c8('0x29')];}_0x358b5b['status'](_0x32614e)[_0x94c8('0x2a')](_0x542ced);};}exports[_0x94c8('0x2b')]=function(_0x1f8613,_0x4b405a){var _0xe6f4d7={},_0x3ec779={},_0x1e08fc={'count':0x0,'rows':[]};var _0x575a94=_[_0x94c8('0x2c')](db['DeskConfiguration']['rawAttributes'],function(_0x14b73f){return{'name':_0x14b73f[_0x94c8('0x2d')],'type':_0x14b73f[_0x94c8('0x2e')][_0x94c8('0x2f')]};});_0x3ec779['model']=_[_0x94c8('0x2c')](_0x575a94,'name');_0x3ec779[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x1f8613['query']);_0x3ec779[_0x94c8('0x32')]=_[_0x94c8('0x33')](_0x3ec779[_0x94c8('0x34')],_0x3ec779[_0x94c8('0x30')]);_0xe6f4d7[_0x94c8('0x35')]=_[_0x94c8('0x33')](_0x3ec779[_0x94c8('0x34')],qs['fields'](_0x1f8613[_0x94c8('0x30')][_0x94c8('0x36')]));_0xe6f4d7['attributes']=_0xe6f4d7[_0x94c8('0x35')][_0x94c8('0x37')]?_0xe6f4d7[_0x94c8('0x35')]:_0x3ec779[_0x94c8('0x34')];if(!_0x1f8613[_0x94c8('0x30')][_0x94c8('0x38')](_0x94c8('0x39'))){_0xe6f4d7[_0x94c8('0x1e')]=qs[_0x94c8('0x1e')](_0x1f8613[_0x94c8('0x30')]['limit']);_0xe6f4d7['offset']=qs[_0x94c8('0x1c')](_0x1f8613[_0x94c8('0x30')][_0x94c8('0x1c')]);}_0xe6f4d7['order']=qs['sort'](_0x1f8613['query'][_0x94c8('0x3a')]);_0xe6f4d7[_0x94c8('0x3b')]=qs[_0x94c8('0x32')](_[_0x94c8('0x3c')](_0x1f8613[_0x94c8('0x30')],_0x3ec779[_0x94c8('0x32')]),_0x575a94);if(_0x1f8613[_0x94c8('0x30')][_0x94c8('0x3d')]){_0xe6f4d7['where']=_['merge'](_0xe6f4d7[_0x94c8('0x3b')],{'$or':_[_0x94c8('0x2c')](_0x575a94,function(_0x3ecee2){if(_0x3ecee2[_0x94c8('0x2e')]!=='VIRTUAL'){var _0xda5e07={};_0xda5e07[_0x3ecee2[_0x94c8('0x29')]]={'$like':'%'+_0x1f8613[_0x94c8('0x30')][_0x94c8('0x3d')]+'%'};return _0xda5e07;}})});}_0xe6f4d7=_[_0x94c8('0x3e')]({},_0xe6f4d7,_0x1f8613[_0x94c8('0x3f')]);var _0x1dea74={'where':_0xe6f4d7[_0x94c8('0x3b')]};return db[_0x94c8('0x40')]['count'](_0x1dea74)['then'](function(_0xb43dc3){_0x1e08fc[_0x94c8('0x1f')]=_0xb43dc3;if(_0x1f8613[_0x94c8('0x30')][_0x94c8('0x41')]){_0xe6f4d7['include']=[{'all':!![]}];}return db[_0x94c8('0x40')]['findAll'](_0xe6f4d7);})[_0x94c8('0x26')](function(_0x158da1){_0x1e08fc[_0x94c8('0x42')]=_0x158da1;return _0x1e08fc;})['then'](respondWithFilteredResult(_0x4b405a,_0xe6f4d7))[_0x94c8('0x43')](handleError(_0x4b405a,null));};exports[_0x94c8('0x44')]=function(_0x28b5f1,_0x1bd7a6){var _0xaa5014={'raw':![],'where':{'id':_0x28b5f1[_0x94c8('0x45')]['id']}},_0x3f3b5e={};_0x3f3b5e['model']=_[_0x94c8('0x31')](db['DeskConfiguration'][_0x94c8('0x46')]);_0x3f3b5e[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x28b5f1[_0x94c8('0x30')]);_0x3f3b5e[_0x94c8('0x32')]=_[_0x94c8('0x33')](_0x3f3b5e[_0x94c8('0x34')],_0x3f3b5e[_0x94c8('0x30')]);_0xaa5014[_0x94c8('0x35')]=_['intersection'](_0x3f3b5e[_0x94c8('0x34')],qs['fields'](_0x28b5f1[_0x94c8('0x30')][_0x94c8('0x36')]));_0xaa5014[_0x94c8('0x35')]=_0xaa5014['attributes'][_0x94c8('0x37')]?_0xaa5014['attributes']:_0x3f3b5e[_0x94c8('0x34')];if(_0x28b5f1['query']['includeAll']){_0xaa5014[_0x94c8('0x47')]=[{'all':!![]}];}_0xaa5014=_[_0x94c8('0x3e')]({},_0xaa5014,_0x28b5f1[_0x94c8('0x3f')]);return db['DeskConfiguration'][_0x94c8('0x48')](_0xaa5014)[_0x94c8('0x26')](handleEntityNotFound(_0x1bd7a6,null))['then'](respondWithResult(_0x1bd7a6,null))['catch'](handleError(_0x1bd7a6,null));};exports[_0x94c8('0x49')]=function(_0x1db424,_0x1ba269){return db['DeskConfiguration']['create'](_0x1db424[_0x94c8('0x4a')],{})['then'](respondWithResult(_0x1ba269,0xc9))['catch'](handleError(_0x1ba269,null));};exports[_0x94c8('0x25')]=function(_0x392a0b,_0x4c5db1){if(_0x392a0b[_0x94c8('0x4a')]['id']){delete _0x392a0b[_0x94c8('0x4a')]['id'];}return db[_0x94c8('0x40')][_0x94c8('0x48')]({'where':{'id':_0x392a0b[_0x94c8('0x45')]['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x4c5db1,null))[_0x94c8('0x26')](saveUpdates(_0x392a0b[_0x94c8('0x4a')],null))[_0x94c8('0x26')](respondWithResult(_0x4c5db1,null))['catch'](handleError(_0x4c5db1,null));};exports[_0x94c8('0x27')]=function(_0x49adae,_0x5c8ac4){return db['DeskConfiguration']['find']({'where':{'id':_0x49adae[_0x94c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c8ac4,null))['then'](removeEntity(_0x5c8ac4,null))[_0x94c8('0x43')](handleError(_0x5c8ac4,null));};exports[_0x94c8('0x4b')]=function(_0x56ce1d,_0x2851ef,_0x567f0c){var _0x1c2ccf={};var _0x442310={};var _0x166427;var _0xd2d846;return db['DeskConfiguration']['findOne']({'where':{'id':_0x56ce1d[_0x94c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2851ef,null))['then'](function(_0x47aa12){if(_0x47aa12){_0x166427=_0x47aa12;_0x442310[_0x94c8('0x34')]=_['keys'](db[_0x94c8('0x4c')][_0x94c8('0x46')]);_0x442310[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x56ce1d['query']);_0x442310[_0x94c8('0x32')]=_[_0x94c8('0x33')](_0x442310[_0x94c8('0x34')],_0x442310[_0x94c8('0x30')]);_0x1c2ccf[_0x94c8('0x35')]=_[_0x94c8('0x33')](_0x442310[_0x94c8('0x34')],qs[_0x94c8('0x36')](_0x56ce1d[_0x94c8('0x30')][_0x94c8('0x36')]));_0x1c2ccf[_0x94c8('0x35')]=_0x1c2ccf[_0x94c8('0x35')]['length']?_0x1c2ccf[_0x94c8('0x35')]:_0x442310[_0x94c8('0x34')];_0x1c2ccf['order']=qs[_0x94c8('0x3a')](_0x56ce1d['query'][_0x94c8('0x3a')]);_0x1c2ccf[_0x94c8('0x3b')]=qs[_0x94c8('0x32')](_[_0x94c8('0x3c')](_0x56ce1d[_0x94c8('0x30')],_0x442310['filters']));if(_0x56ce1d[_0x94c8('0x30')][_0x94c8('0x3d')]){_0x1c2ccf[_0x94c8('0x3b')]=_[_0x94c8('0x3e')](_0x1c2ccf['where'],{'$or':_[_0x94c8('0x2c')](_0x1c2ccf[_0x94c8('0x35')],function(_0x10790e){var _0x253cd7={};_0x253cd7[_0x10790e]={'$like':'%'+_0x56ce1d['query'][_0x94c8('0x3d')]+'%'};return _0x253cd7;})});}_0x1c2ccf=_[_0x94c8('0x3e')]({},_0x1c2ccf,_0x56ce1d[_0x94c8('0x3f')]);return _0x166427[_0x94c8('0x4b')](_0x1c2ccf);}})[_0x94c8('0x26')](function(_0x4f9070){if(_0x4f9070){_0xd2d846=_0x4f9070['length'];if(!_0x56ce1d[_0x94c8('0x30')][_0x94c8('0x38')](_0x94c8('0x39'))){_0x1c2ccf['limit']=qs[_0x94c8('0x1e')](_0x56ce1d[_0x94c8('0x30')]['limit']);_0x1c2ccf[_0x94c8('0x1c')]=qs[_0x94c8('0x1c')](_0x56ce1d['query'][_0x94c8('0x1c')]);}return _0x166427[_0x94c8('0x4b')](_0x1c2ccf);}})[_0x94c8('0x26')](function(_0x161728){if(_0x161728){return _0x161728?{'count':_0xd2d846,'rows':_0x161728}:null;}})[_0x94c8('0x26')](respondWithResult(_0x2851ef,null))[_0x94c8('0x43')](handleError(_0x2851ef,null));};exports[_0x94c8('0x4d')]=function(_0x3300de,_0x501b52,_0x5e31d4){var _0x48bf3c={};var _0x23bc4c={};var _0x4fdadd;var _0x1d7415;return db[_0x94c8('0x40')][_0x94c8('0x4e')]({'where':{'id':_0x3300de[_0x94c8('0x45')]['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x501b52,null))[_0x94c8('0x26')](function(_0x5543b1){if(_0x5543b1){_0x4fdadd=_0x5543b1;_0x23bc4c[_0x94c8('0x34')]=_[_0x94c8('0x31')](db[_0x94c8('0x4c')][_0x94c8('0x46')]);_0x23bc4c[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x3300de[_0x94c8('0x30')]);_0x23bc4c['filters']=_[_0x94c8('0x33')](_0x23bc4c[_0x94c8('0x34')],_0x23bc4c['query']);_0x48bf3c[_0x94c8('0x35')]=_[_0x94c8('0x33')](_0x23bc4c[_0x94c8('0x34')],qs['fields'](_0x3300de[_0x94c8('0x30')][_0x94c8('0x36')]));_0x48bf3c[_0x94c8('0x35')]=_0x48bf3c[_0x94c8('0x35')]['length']?_0x48bf3c[_0x94c8('0x35')]:_0x23bc4c[_0x94c8('0x34')];_0x48bf3c['order']=qs[_0x94c8('0x3a')](_0x3300de[_0x94c8('0x30')][_0x94c8('0x3a')]);_0x48bf3c[_0x94c8('0x3b')]=qs['filters'](_[_0x94c8('0x3c')](_0x3300de['query'],_0x23bc4c['filters']));if(_0x3300de[_0x94c8('0x30')][_0x94c8('0x3d')]){_0x48bf3c[_0x94c8('0x3b')]=_[_0x94c8('0x3e')](_0x48bf3c[_0x94c8('0x3b')],{'$or':_[_0x94c8('0x2c')](_0x48bf3c[_0x94c8('0x35')],function(_0x84f2aa){var _0x303ff4={};_0x303ff4[_0x84f2aa]={'$like':'%'+_0x3300de[_0x94c8('0x30')][_0x94c8('0x3d')]+'%'};return _0x303ff4;})});}_0x48bf3c=_['merge']({},_0x48bf3c,_0x3300de[_0x94c8('0x3f')]);return _0x4fdadd[_0x94c8('0x4d')](_0x48bf3c);}})['then'](function(_0x1a3e11){if(_0x1a3e11){_0x1d7415=_0x1a3e11[_0x94c8('0x37')];if(!_0x3300de[_0x94c8('0x30')][_0x94c8('0x38')](_0x94c8('0x39'))){_0x48bf3c[_0x94c8('0x1e')]=qs[_0x94c8('0x1e')](_0x3300de[_0x94c8('0x30')][_0x94c8('0x1e')]);_0x48bf3c['offset']=qs[_0x94c8('0x1c')](_0x3300de['query'][_0x94c8('0x1c')]);}return _0x4fdadd[_0x94c8('0x4d')](_0x48bf3c);}})['then'](function(_0x139603){if(_0x139603){return _0x139603?{'count':_0x1d7415,'rows':_0x139603}:null;}})['then'](respondWithResult(_0x501b52,null))[_0x94c8('0x43')](handleError(_0x501b52,null));};exports['getDescriptions']=function(_0x3ba110,_0x5cb69b,_0x128a97){var _0x406968={};var _0x2a3d91={};var _0x10fee3;var _0x357249;return db['DeskConfiguration'][_0x94c8('0x4e')]({'where':{'id':_0x3ba110['params']['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x5cb69b,null))[_0x94c8('0x26')](function(_0x1146b2){if(_0x1146b2){_0x10fee3=_0x1146b2;_0x2a3d91[_0x94c8('0x34')]=_['keys'](db['DeskField'][_0x94c8('0x46')]);_0x2a3d91[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x3ba110[_0x94c8('0x30')]);_0x2a3d91[_0x94c8('0x32')]=_[_0x94c8('0x33')](_0x2a3d91[_0x94c8('0x34')],_0x2a3d91[_0x94c8('0x30')]);_0x406968[_0x94c8('0x35')]=_[_0x94c8('0x33')](_0x2a3d91['model'],qs[_0x94c8('0x36')](_0x3ba110[_0x94c8('0x30')][_0x94c8('0x36')]));_0x406968[_0x94c8('0x35')]=_0x406968['attributes'][_0x94c8('0x37')]?_0x406968[_0x94c8('0x35')]:_0x2a3d91['model'];_0x406968[_0x94c8('0x4f')]=qs[_0x94c8('0x3a')](_0x3ba110[_0x94c8('0x30')][_0x94c8('0x3a')]);_0x406968[_0x94c8('0x3b')]=qs[_0x94c8('0x32')](_[_0x94c8('0x3c')](_0x3ba110[_0x94c8('0x30')],_0x2a3d91[_0x94c8('0x32')]));if(_0x3ba110['query'][_0x94c8('0x3d')]){_0x406968[_0x94c8('0x3b')]=_[_0x94c8('0x3e')](_0x406968[_0x94c8('0x3b')],{'$or':_[_0x94c8('0x2c')](_0x406968[_0x94c8('0x35')],function(_0x3f7f39){var _0x52662e={};_0x52662e[_0x3f7f39]={'$like':'%'+_0x3ba110['query'][_0x94c8('0x3d')]+'%'};return _0x52662e;})});}_0x406968=_[_0x94c8('0x3e')]({},_0x406968,_0x3ba110[_0x94c8('0x3f')]);return _0x10fee3[_0x94c8('0x50')](_0x406968);}})[_0x94c8('0x26')](function(_0x482a01){if(_0x482a01){_0x357249=_0x482a01[_0x94c8('0x37')];if(!_0x3ba110['query']['hasOwnProperty'](_0x94c8('0x39'))){_0x406968[_0x94c8('0x1e')]=qs['limit'](_0x3ba110[_0x94c8('0x30')][_0x94c8('0x1e')]);_0x406968[_0x94c8('0x1c')]=qs[_0x94c8('0x1c')](_0x3ba110[_0x94c8('0x30')][_0x94c8('0x1c')]);}return _0x10fee3[_0x94c8('0x50')](_0x406968);}})[_0x94c8('0x26')](function(_0x9a80fd){if(_0x9a80fd){return _0x9a80fd?{'count':_0x357249,'rows':_0x9a80fd}:null;}})[_0x94c8('0x26')](respondWithResult(_0x5cb69b,null))[_0x94c8('0x43')](handleError(_0x5cb69b,null));};exports[_0x94c8('0x51')]=function(_0x3b77ce,_0xcfb9e6,_0x3d31ff){var _0x39f453={};var _0x4863cd={};var _0x2a6fd;var _0x91be3c;return db[_0x94c8('0x40')][_0x94c8('0x4e')]({'where':{'id':_0x3b77ce['params']['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0xcfb9e6,null))['then'](function(_0x153c71){if(_0x153c71){_0x2a6fd=_0x153c71;_0x4863cd['model']=_[_0x94c8('0x31')](db['Tag'][_0x94c8('0x46')]);_0x4863cd[_0x94c8('0x30')]=_[_0x94c8('0x31')](_0x3b77ce[_0x94c8('0x30')]);_0x4863cd[_0x94c8('0x32')]=_[_0x94c8('0x33')](_0x4863cd[_0x94c8('0x34')],_0x4863cd['query']);_0x39f453[_0x94c8('0x35')]=_[_0x94c8('0x33')](_0x4863cd[_0x94c8('0x34')],qs[_0x94c8('0x36')](_0x3b77ce['query'][_0x94c8('0x36')]));_0x39f453[_0x94c8('0x35')]=_0x39f453['attributes'][_0x94c8('0x37')]?_0x39f453[_0x94c8('0x35')]:_0x4863cd['model'];_0x39f453[_0x94c8('0x4f')]=qs[_0x94c8('0x3a')](_0x3b77ce[_0x94c8('0x30')][_0x94c8('0x3a')]);_0x39f453['where']=qs['filters'](_[_0x94c8('0x3c')](_0x3b77ce[_0x94c8('0x30')],_0x4863cd[_0x94c8('0x32')]));if(_0x3b77ce[_0x94c8('0x30')]['filter']){_0x39f453['where']=_['merge'](_0x39f453['where'],{'$or':_[_0x94c8('0x2c')](_0x39f453[_0x94c8('0x35')],function(_0x21d77c){var _0x3830c8={};_0x3830c8[_0x21d77c]={'$like':'%'+_0x3b77ce[_0x94c8('0x30')][_0x94c8('0x3d')]+'%'};return _0x3830c8;})});}_0x39f453=_['merge']({},_0x39f453,_0x3b77ce['options']);return _0x2a6fd[_0x94c8('0x51')](_0x39f453);}})['then'](function(_0x3f16c5){if(_0x3f16c5){_0x91be3c=_0x3f16c5[_0x94c8('0x37')];if(!_0x3b77ce[_0x94c8('0x30')]['hasOwnProperty'](_0x94c8('0x39'))){_0x39f453[_0x94c8('0x1e')]=qs['limit'](_0x3b77ce[_0x94c8('0x30')][_0x94c8('0x1e')]);_0x39f453['offset']=qs[_0x94c8('0x1c')](_0x3b77ce[_0x94c8('0x30')][_0x94c8('0x1c')]);}return _0x2a6fd['getTags'](_0x39f453);}})[_0x94c8('0x26')](function(_0x36a1ab){if(_0x36a1ab){return _0x36a1ab?{'count':_0x91be3c,'rows':_0x36a1ab}:null;}})['then'](respondWithResult(_0xcfb9e6,null))['catch'](handleError(_0xcfb9e6,null));};exports[_0x94c8('0x52')]=function(_0xbbe928,_0x3c6b35,_0x285eba){if(_0xbbe928['body']['id']){delete _0xbbe928[_0x94c8('0x4a')]['id'];}return db[_0x94c8('0x40')]['findOne']({'where':{'id':_0xbbe928[_0x94c8('0x45')]['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x3c6b35,null))[_0x94c8('0x26')](function(_0x4d1cf1){if(_0x4d1cf1){return _0x4d1cf1[_0x94c8('0x52')](_0xbbe928[_0x94c8('0x4a')]['ids']||[]);}return null;})[_0x94c8('0x26')](respondWithResult(_0x3c6b35,null))['catch'](handleError(_0x3c6b35,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3decce5..ebc4796 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 _0xc22f=['../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xc22f,0x19b));var _0xfc22=function(_0x28320b,_0x28b060){_0x28320b=_0x28320b-0x0;var _0x459dac=_0xc22f[_0x28320b];return _0x459dac;};'use strict';var _=require(_0xfc22('0x0'));var util=require(_0xfc22('0x1'));var logger=require(_0xfc22('0x2'))(_0xfc22('0x3'));var moment=require(_0xfc22('0x4'));var BPromise=require(_0xfc22('0x5'));var rp=require(_0xfc22('0x6'));var fs=require('fs');var path=require(_0xfc22('0x7'));var rimraf=require(_0xfc22('0x8'));var config=require(_0xfc22('0x9'));var attributes=require(_0xfc22('0xa'));module['exports']=function(_0x312a2a,_0x5bedf9){return _0x312a2a[_0xfc22('0xb')](_0xfc22('0xc'),attributes,{'tableName':_0xfc22('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ecd=['rimraf','../../config/environment','exports','DeskConfiguration','int_desk_configurations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5d47fe,_0x5d6118){var _0x4fb7d2=function(_0x44608b){while(--_0x44608b){_0x5d47fe['push'](_0x5d47fe['shift']());}};_0x4fb7d2(++_0x5d6118);}(_0x4ecd,0x163));var _0xd4ec=function(_0x248b72,_0xee1b96){_0x248b72=_0x248b72-0x0;var _0x4f6596=_0x4ecd[_0x248b72];return _0x4f6596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd4ec('0x0'))('api');var moment=require(_0xd4ec('0x1'));var BPromise=require(_0xd4ec('0x2'));var rp=require(_0xd4ec('0x3'));var fs=require('fs');var path=require(_0xd4ec('0x4'));var rimraf=require(_0xd4ec('0x5'));var config=require(_0xd4ec('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xd4ec('0x7')]=function(_0x422900,_0x3288d7){return _0x422900['define'](_0xd4ec('0x8'),attributes,{'tableName':_0xd4ec('0x9'),'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 08ca7a1..2ca887f 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 _0xa742=['result','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa742,0xc7));var _0x2a74=function(_0x23a2ad,_0x2a6385){_0x23a2ad=_0x23a2ad-0x0;var _0x35a351=_0xa742[_0x23a2ad];return _0x35a351;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2a74('0x0'));var rs=require(_0x2a74('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2a74('0x2'));var logger=require('../../config/logger')(_0x2a74('0x3'));var config=require(_0x2a74('0x4'));var jayson=require(_0x2a74('0x5'));var client=jayson[_0x2a74('0x6')][_0x2a74('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17d10f,_0xc06f58,_0x209234){return new BPromise(function(_0x20e347,_0x2ad653){return client['request'](_0x17d10f,_0x209234)[_0x2a74('0x8')](function(_0x5ca328){logger['info'](_0x2a74('0x9'),_0xc06f58,_0x2a74('0xa'));logger[_0x2a74('0xb')](_0x2a74('0xc'),_0xc06f58,'request\x20sent',JSON[_0x2a74('0xd')](_0x5ca328));if(_0x5ca328['error']){if(_0x5ca328['error']['code']===0x1f4){logger['error'](_0x2a74('0x9'),_0xc06f58,_0x5ca328['error']['message']);return _0x2ad653(_0x5ca328[_0x2a74('0xe')][_0x2a74('0xf')]);}logger[_0x2a74('0xe')](_0x2a74('0x9'),_0xc06f58,_0x5ca328[_0x2a74('0xe')][_0x2a74('0xf')]);return _0x20e347(_0x5ca328[_0x2a74('0xe')][_0x2a74('0xf')]);}else{logger[_0x2a74('0x10')](_0x2a74('0x9'),_0xc06f58,_0x2a74('0xa'));_0x20e347(_0x5ca328[_0x2a74('0x11')][_0x2a74('0xf')]);}})['catch'](function(_0x1f9fd6){logger['error'](_0x2a74('0x9'),_0xc06f58,_0x1f9fd6);_0x2ad653(_0x1f9fd6);});});} \ No newline at end of file +var _0xa533=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x5f35eb,_0x1c0dfb){var _0x116e5c=function(_0x5399df){while(--_0x5399df){_0x5f35eb['push'](_0x5f35eb['shift']());}};_0x116e5c(++_0x1c0dfb);}(_0xa533,0x1c6));var _0x3a53=function(_0x464b23,_0x2b4fac){_0x464b23=_0x464b23-0x0;var _0x4db267=_0xa533[_0x464b23];return _0x4db267;};'use strict';var _=require(_0x3a53('0x0'));var util=require(_0x3a53('0x1'));var moment=require(_0x3a53('0x2'));var BPromise=require(_0x3a53('0x3'));var rs=require(_0x3a53('0x4'));var fs=require('fs');var Redis=require(_0x3a53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a53('0x6'));var logger=require(_0x3a53('0x7'))(_0x3a53('0x8'));var config=require(_0x3a53('0x9'));var jayson=require(_0x3a53('0xa'));var client=jayson[_0x3a53('0xb')][_0x3a53('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bc648,_0x4a04fd,_0x4b3762){return new BPromise(function(_0x5ef619,_0x360b1d){return client[_0x3a53('0xd')](_0x2bc648,_0x4b3762)[_0x3a53('0xe')](function(_0x284c21){logger[_0x3a53('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x4a04fd,_0x3a53('0x10'));logger[_0x3a53('0x11')](_0x3a53('0x12'),_0x4a04fd,_0x3a53('0x10'),JSON[_0x3a53('0x13')](_0x284c21));if(_0x284c21[_0x3a53('0x14')]){if(_0x284c21[_0x3a53('0x14')]['code']===0x1f4){logger[_0x3a53('0x14')](_0x3a53('0x15'),_0x4a04fd,_0x284c21[_0x3a53('0x14')][_0x3a53('0x16')]);return _0x360b1d(_0x284c21['error'][_0x3a53('0x16')]);}logger['error'](_0x3a53('0x15'),_0x4a04fd,_0x284c21['error'][_0x3a53('0x16')]);return _0x5ef619(_0x284c21[_0x3a53('0x14')][_0x3a53('0x16')]);}else{logger['info'](_0x3a53('0x15'),_0x4a04fd,_0x3a53('0x10'));_0x5ef619(_0x284c21[_0x3a53('0x17')]['message']);}})['catch'](function(_0x316873){logger[_0x3a53('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x4a04fd,_0x316873);_0x360b1d(_0x316873);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 850b208..c6f13c7 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 _0x1f31=['../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','create','update','exports','util','path','connect-timeout','fs-extra'];(function(_0x1afbdb,_0x5c34ca){var _0xdca820=function(_0x15053f){while(--_0x15053f){_0x1afbdb['push'](_0x1afbdb['shift']());}};_0xdca820(++_0x5c34ca);}(_0x1f31,0x8b));var _0x11f3=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0x1f31[_0x53f37f];return _0x2fe5f8;};'use strict';var multer=require('multer');var util=require(_0x11f3('0x0'));var path=require(_0x11f3('0x1'));var timeout=require(_0x11f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x11f3('0x3'));var auth=require(_0x11f3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x11f3('0x5'));var controller=require(_0x11f3('0x6'));router['get']('/',auth[_0x11f3('0x7')](),controller['index']);router[_0x11f3('0x8')](_0x11f3('0x9'),auth[_0x11f3('0x7')](),controller['show']);router['post']('/',auth[_0x11f3('0x7')](),controller[_0x11f3('0xa')]);router['put'](_0x11f3('0x9'),auth['isAuthenticated'](),controller[_0x11f3('0xb')]);router['delete'](_0x11f3('0x9'),auth[_0x11f3('0x7')](),controller['destroy']);module[_0x11f3('0xc')]=router; \ No newline at end of file +var _0x97e4=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','put','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x97e4,0x13f));var _0x497e=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x97e4[_0x5d6b41];return _0x1c2dd6;};'use strict';var multer=require(_0x497e('0x0'));var util=require('util');var path=require(_0x497e('0x1'));var timeout=require(_0x497e('0x2'));var express=require(_0x497e('0x3'));var router=express['Router']();var fs_extra=require(_0x497e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x497e('0x5'));var config=require(_0x497e('0x6'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x497e('0x7')](),controller[_0x497e('0x8')]);router[_0x497e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x497e('0xa')](_0x497e('0xb'),auth[_0x497e('0x7')](),controller['update']);router['delete']('/:id',auth[_0x497e('0x7')](),controller[_0x497e('0xc')]);module[_0x497e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index dba04e7..0597c34 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 _0x1968=['exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','sequelize'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x1968,0x194));var _0x8196=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1968[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x8196('0x0'));module[_0x8196('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8196('0x2'),_0x8196('0x3'),'customVariable',_0x8196('0x4'),_0x8196('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8196('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8196('0x7')]('string',_0x8196('0x3'),_0x8196('0x8'))},'keyContent':{'type':Sequelize[_0x8196('0x6')]},'idField':{'type':Sequelize[_0x8196('0x6')]},'nameField':{'type':Sequelize[_0x8196('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8196('0x6')]}}; \ No newline at end of file +var _0x5842=['string','variable','customVariable','STRING','ENUM','BOOLEAN','exports'];(function(_0x4e85f2,_0x1cf40b){var _0x3ac183=function(_0x11d3a6){while(--_0x11d3a6){_0x4e85f2['push'](_0x4e85f2['shift']());}};_0x3ac183(++_0x1cf40b);}(_0x5842,0x11e));var _0x2584=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x5842[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require('sequelize');module[_0x2584('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2584('0x1'),_0x2584('0x2'),_0x2584('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2584('0x4')]},'key':{'type':Sequelize[_0x2584('0x4')]},'keyType':{'type':Sequelize[_0x2584('0x5')](_0x2584('0x1'),'variable',_0x2584('0x3'))},'keyContent':{'type':Sequelize[_0x2584('0x4')]},'idField':{'type':Sequelize[_0x2584('0x4')]},'nameField':{'type':Sequelize[_0x2584('0x4')]},'customField':{'type':Sequelize[_0x2584('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2584('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b699899..2bc315e 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 _0xd7c3=['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','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','DeskField','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1a7c4a,_0x4110a9){var _0x101fc4=function(_0x422eab){while(--_0x422eab){_0x1a7c4a['push'](_0x1a7c4a['shift']());}};_0x101fc4(++_0x4110a9);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x51cf09,_0x2c3f3c){_0x51cf09=_0x51cf09-0x0;var _0x47a759=_0xd7c3[_0x51cf09];return _0x47a759;};'use strict';var emlformat=require(_0x3d7c('0x0'));var rimraf=require(_0x3d7c('0x1'));var zipdir=require(_0x3d7c('0x2'));var jsonpatch=require(_0x3d7c('0x3'));var rp=require(_0x3d7c('0x4'));var moment=require(_0x3d7c('0x5'));var BPromise=require(_0x3d7c('0x6'));var Mustache=require(_0x3d7c('0x7'));var util=require(_0x3d7c('0x8'));var path=require('path');var sox=require(_0x3d7c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d7c('0xa'));var squel=require(_0x3d7c('0xb'));var crypto=require(_0x3d7c('0xc'));var jsforce=require(_0x3d7c('0xd'));var deskjs=require(_0x3d7c('0xe'));var toCsv=require(_0x3d7c('0xf'));var querystring=require(_0x3d7c('0x10'));var Papa=require(_0x3d7c('0x11'));var Redis=require(_0x3d7c('0x12'));var authService=require(_0x3d7c('0x13'));var qs=require(_0x3d7c('0x14'));var as=require(_0x3d7c('0x15'));var hardwareService=require(_0x3d7c('0x16'));var logger=require(_0x3d7c('0x17'))(_0x3d7c('0x18'));var utils=require(_0x3d7c('0x19'));var config=require(_0x3d7c('0x1a'));var licenseUtil=require(_0x3d7c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20148f,_0x40e8a6){_0x40e8a6=_0x40e8a6||0xcc;return function(_0xb7bd60){if(_0xb7bd60){return _0x20148f[_0x3d7c('0x1c')](_0x40e8a6);}return _0x20148f[_0x3d7c('0x1d')](_0x40e8a6)[_0x3d7c('0x1e')]();};}function respondWithResult(_0x4728dc,_0x477faf){_0x477faf=_0x477faf||0xc8;return function(_0x2717c5){if(_0x2717c5){return _0x4728dc[_0x3d7c('0x1d')](_0x477faf)[_0x3d7c('0x1f')](_0x2717c5);}};}function respondWithFilteredResult(_0x37122a,_0x1ba7ee){return function(_0xf0a186){if(_0xf0a186){var _0x9d0305=typeof _0x1ba7ee[_0x3d7c('0x20')]==='undefined'&&typeof _0x1ba7ee[_0x3d7c('0x21')]===_0x3d7c('0x22');var _0x49e25c=_0xf0a186['count'];var _0x447ea0=_0x9d0305?0x0:_0x1ba7ee[_0x3d7c('0x20')];var _0x323204=_0x9d0305?_0xf0a186[_0x3d7c('0x23')]:_0x1ba7ee['offset']+_0x1ba7ee[_0x3d7c('0x21')];var _0x328851;if(_0x323204>=_0x49e25c){_0x323204=_0x49e25c;_0x328851=0xc8;}else{_0x328851=0xce;}_0x37122a[_0x3d7c('0x1d')](_0x328851);return _0x37122a['set'](_0x3d7c('0x24'),_0x447ea0+'-'+_0x323204+'/'+_0x49e25c)[_0x3d7c('0x1f')](_0xf0a186);}return null;};}function patchUpdates(_0x3a99fd){return function(_0x5a91d2){try{jsonpatch[_0x3d7c('0x25')](_0x5a91d2,_0x3a99fd,!![]);}catch(_0x22f9f6){return BPromise[_0x3d7c('0x26')](_0x22f9f6);}return _0x5a91d2[_0x3d7c('0x27')]();};}function saveUpdates(_0xa4fbe9,_0x4c977f){return function(_0x126c5e){if(_0x126c5e){return _0x126c5e[_0x3d7c('0x28')](_0xa4fbe9)[_0x3d7c('0x29')](function(_0x81a5a3){return _0x81a5a3;});}return null;};}function removeEntity(_0x553df1,_0x4a7966){return function(_0x3518c9){if(_0x3518c9){return _0x3518c9[_0x3d7c('0x2a')]()[_0x3d7c('0x29')](function(){_0x553df1[_0x3d7c('0x1d')](0xcc)[_0x3d7c('0x1e')]();});}};}function handleEntityNotFound(_0x2806a5,_0x139fa2){return function(_0x2ac594){if(!_0x2ac594){_0x2806a5[_0x3d7c('0x1c')](0x194);}return _0x2ac594;};}function handleError(_0x4696f1,_0x820d20){_0x820d20=_0x820d20||0x1f4;return function(_0x4d440b){logger['error'](_0x4d440b[_0x3d7c('0x2b')]);if(_0x4d440b[_0x3d7c('0x2c')]){delete _0x4d440b['name'];}_0x4696f1[_0x3d7c('0x1d')](_0x820d20)[_0x3d7c('0x2d')](_0x4d440b);};}exports[_0x3d7c('0x2e')]=function(_0x53698b,_0x457c53){var _0x386719={},_0x215c60={},_0x236440={'count':0x0,'rows':[]};var _0x257dde=_['map'](db[_0x3d7c('0x2f')][_0x3d7c('0x30')],function(_0x20dc15){return{'name':_0x20dc15['fieldName'],'type':_0x20dc15[_0x3d7c('0x31')][_0x3d7c('0x32')]};});_0x215c60[_0x3d7c('0x33')]=_[_0x3d7c('0x34')](_0x257dde,_0x3d7c('0x2c'));_0x215c60[_0x3d7c('0x35')]=_['keys'](_0x53698b['query']);_0x215c60[_0x3d7c('0x36')]=_[_0x3d7c('0x37')](_0x215c60[_0x3d7c('0x33')],_0x215c60[_0x3d7c('0x35')]);_0x386719[_0x3d7c('0x38')]=_[_0x3d7c('0x37')](_0x215c60['model'],qs[_0x3d7c('0x39')](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x39')]));_0x386719['attributes']=_0x386719[_0x3d7c('0x38')]['length']?_0x386719['attributes']:_0x215c60[_0x3d7c('0x33')];if(!_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x3a')](_0x3d7c('0x3b'))){_0x386719['limit']=qs[_0x3d7c('0x21')](_0x53698b[_0x3d7c('0x35')]['limit']);_0x386719[_0x3d7c('0x20')]=qs['offset'](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x20')]);}_0x386719[_0x3d7c('0x3c')]=qs[_0x3d7c('0x3d')](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x3d')]);_0x386719[_0x3d7c('0x3e')]=qs[_0x3d7c('0x36')](_[_0x3d7c('0x3f')](_0x53698b[_0x3d7c('0x35')],_0x215c60[_0x3d7c('0x36')]),_0x257dde);if(_0x53698b[_0x3d7c('0x35')]['filter']){_0x386719[_0x3d7c('0x3e')]=_[_0x3d7c('0x40')](_0x386719[_0x3d7c('0x3e')],{'$or':_[_0x3d7c('0x34')](_0x257dde,function(_0x1f1e29){if(_0x1f1e29[_0x3d7c('0x31')]!==_0x3d7c('0x41')){var _0x55ada1={};_0x55ada1[_0x1f1e29[_0x3d7c('0x2c')]]={'$like':'%'+_0x53698b[_0x3d7c('0x35')]['filter']+'%'};return _0x55ada1;}})});}_0x386719=_['merge']({},_0x386719,_0x53698b['options']);var _0x40058f={'where':_0x386719[_0x3d7c('0x3e')]};return db[_0x3d7c('0x2f')][_0x3d7c('0x23')](_0x40058f)['then'](function(_0x130583){_0x236440[_0x3d7c('0x23')]=_0x130583;if(_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x42')]){_0x386719[_0x3d7c('0x43')]=[{'all':!![]}];}return db[_0x3d7c('0x2f')][_0x3d7c('0x44')](_0x386719);})[_0x3d7c('0x29')](function(_0x12fc85){_0x236440[_0x3d7c('0x45')]=_0x12fc85;return _0x236440;})[_0x3d7c('0x29')](respondWithFilteredResult(_0x457c53,_0x386719))[_0x3d7c('0x46')](handleError(_0x457c53,null));};exports[_0x3d7c('0x47')]=function(_0x5bb21a,_0x5b0db8){var _0x177ad7={'raw':!![],'where':{'id':_0x5bb21a[_0x3d7c('0x48')]['id']}},_0x2ed019={};_0x2ed019['model']=_[_0x3d7c('0x49')](db[_0x3d7c('0x2f')][_0x3d7c('0x30')]);_0x2ed019[_0x3d7c('0x35')]=_[_0x3d7c('0x49')](_0x5bb21a[_0x3d7c('0x35')]);_0x2ed019[_0x3d7c('0x36')]=_[_0x3d7c('0x37')](_0x2ed019['model'],_0x2ed019[_0x3d7c('0x35')]);_0x177ad7[_0x3d7c('0x38')]=_[_0x3d7c('0x37')](_0x2ed019[_0x3d7c('0x33')],qs['fields'](_0x5bb21a[_0x3d7c('0x35')][_0x3d7c('0x39')]));_0x177ad7[_0x3d7c('0x38')]=_0x177ad7[_0x3d7c('0x38')][_0x3d7c('0x4a')]?_0x177ad7['attributes']:_0x2ed019[_0x3d7c('0x33')];if(_0x5bb21a['query'][_0x3d7c('0x42')]){_0x177ad7[_0x3d7c('0x43')]=[{'all':!![]}];}_0x177ad7=_[_0x3d7c('0x40')]({},_0x177ad7,_0x5bb21a['options']);return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')](_0x177ad7)[_0x3d7c('0x29')](handleEntityNotFound(_0x5b0db8,null))[_0x3d7c('0x29')](respondWithResult(_0x5b0db8,null))[_0x3d7c('0x46')](handleError(_0x5b0db8,null));};exports['create']=function(_0x468a9c,_0x393217){return db[_0x3d7c('0x2f')][_0x3d7c('0x4c')](_0x468a9c[_0x3d7c('0x4d')],{})[_0x3d7c('0x29')](respondWithResult(_0x393217,0xc9))[_0x3d7c('0x46')](handleError(_0x393217,null));};exports[_0x3d7c('0x28')]=function(_0x2549ed,_0x33cc2c){if(_0x2549ed['body']['id']){delete _0x2549ed[_0x3d7c('0x4d')]['id'];}return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')]({'where':{'id':_0x2549ed[_0x3d7c('0x48')]['id']}})[_0x3d7c('0x29')](handleEntityNotFound(_0x33cc2c,null))['then'](saveUpdates(_0x2549ed[_0x3d7c('0x4d')],null))[_0x3d7c('0x29')](respondWithResult(_0x33cc2c,null))[_0x3d7c('0x46')](handleError(_0x33cc2c,null));};exports[_0x3d7c('0x2a')]=function(_0x1cba46,_0x31bbac){return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')]({'where':{'id':_0x1cba46['params']['id']}})[_0x3d7c('0x29')](handleEntityNotFound(_0x31bbac,null))['then'](removeEntity(_0x31bbac,null))['catch'](handleError(_0x31bbac,null));}; \ No newline at end of file +var _0xea4e=['catch','create','body','destroy','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','error','name','send','map','rawAttributes','model','query','keys','filters','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','DeskField','intersection','find'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xea4e,0x10c));var _0xeea4=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0xea4e[_0x5d6270];return _0x168f26;};'use strict';var emlformat=require(_0xeea4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeea4('0x1'));var moment=require('moment');var BPromise=require(_0xeea4('0x2'));var Mustache=require(_0xeea4('0x3'));var util=require('util');var path=require(_0xeea4('0x4'));var sox=require(_0xeea4('0x5'));var csv=require(_0xeea4('0x6'));var ejs=require(_0xeea4('0x7'));var fs=require('fs');var fs_extra=require(_0xeea4('0x8'));var _=require(_0xeea4('0x9'));var squel=require(_0xeea4('0xa'));var crypto=require(_0xeea4('0xb'));var jsforce=require(_0xeea4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeea4('0x6'));var querystring=require('querystring');var Papa=require(_0xeea4('0xd'));var Redis=require(_0xeea4('0xe'));var authService=require(_0xeea4('0xf'));var qs=require(_0xeea4('0x10'));var as=require(_0xeea4('0x11'));var hardwareService=require(_0xeea4('0x12'));var logger=require(_0xeea4('0x13'))(_0xeea4('0x14'));var utils=require('../../config/utils');var config=require(_0xeea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x216785,_0x3c18ed){_0x3c18ed=_0x3c18ed||0xcc;return function(_0x3dbf8c){if(_0x3dbf8c){return _0x216785[_0xeea4('0x17')](_0x3c18ed);}return _0x216785[_0xeea4('0x18')](_0x3c18ed)[_0xeea4('0x19')]();};}function respondWithResult(_0x9d04aa,_0x4d6605){_0x4d6605=_0x4d6605||0xc8;return function(_0x169fc5){if(_0x169fc5){return _0x9d04aa[_0xeea4('0x18')](_0x4d6605)['json'](_0x169fc5);}};}function respondWithFilteredResult(_0x44f13a,_0x4d47b0){return function(_0x2d5a6c){if(_0x2d5a6c){var _0x44f573=typeof _0x4d47b0[_0xeea4('0x1a')]===_0xeea4('0x1b')&&typeof _0x4d47b0[_0xeea4('0x1c')]===_0xeea4('0x1b');var _0x37cd8e=_0x2d5a6c[_0xeea4('0x1d')];var _0x26d8f4=_0x44f573?0x0:_0x4d47b0[_0xeea4('0x1a')];var _0x4ae372=_0x44f573?_0x2d5a6c[_0xeea4('0x1d')]:_0x4d47b0[_0xeea4('0x1a')]+_0x4d47b0['limit'];var _0x36a9b3;if(_0x4ae372>=_0x37cd8e){_0x4ae372=_0x37cd8e;_0x36a9b3=0xc8;}else{_0x36a9b3=0xce;}_0x44f13a[_0xeea4('0x18')](_0x36a9b3);return _0x44f13a['set'](_0xeea4('0x1e'),_0x26d8f4+'-'+_0x4ae372+'/'+_0x37cd8e)['json'](_0x2d5a6c);}return null;};}function patchUpdates(_0x3f7316){return function(_0x54cf4d){try{jsonpatch['apply'](_0x54cf4d,_0x3f7316,!![]);}catch(_0x3756ad){return BPromise['reject'](_0x3756ad);}return _0x54cf4d[_0xeea4('0x1f')]();};}function saveUpdates(_0x12ba5b,_0x3e162c){return function(_0x19b2a8){if(_0x19b2a8){return _0x19b2a8[_0xeea4('0x20')](_0x12ba5b)['then'](function(_0x3f2cd2){return _0x3f2cd2;});}return null;};}function removeEntity(_0x88ab4f,_0x290983){return function(_0x31dab){if(_0x31dab){return _0x31dab['destroy']()[_0xeea4('0x21')](function(){_0x88ab4f[_0xeea4('0x18')](0xcc)[_0xeea4('0x19')]();});}};}function handleEntityNotFound(_0x433825,_0x565da5){return function(_0x594258){if(!_0x594258){_0x433825[_0xeea4('0x17')](0x194);}return _0x594258;};}function handleError(_0x28d8f9,_0x3207a9){_0x3207a9=_0x3207a9||0x1f4;return function(_0x197573){logger[_0xeea4('0x22')](_0x197573['stack']);if(_0x197573[_0xeea4('0x23')]){delete _0x197573[_0xeea4('0x23')];}_0x28d8f9['status'](_0x3207a9)[_0xeea4('0x24')](_0x197573);};}exports['index']=function(_0x4a3a7e,_0xb2acc2){var _0x2eb38c={},_0x134f24={},_0x1217b4={'count':0x0,'rows':[]};var _0x5b651f=_[_0xeea4('0x25')](db['DeskField'][_0xeea4('0x26')],function(_0x4d68d8){return{'name':_0x4d68d8['fieldName'],'type':_0x4d68d8['type']['key']};});_0x134f24[_0xeea4('0x27')]=_['map'](_0x5b651f,_0xeea4('0x23'));_0x134f24[_0xeea4('0x28')]=_[_0xeea4('0x29')](_0x4a3a7e[_0xeea4('0x28')]);_0x134f24[_0xeea4('0x2a')]=_['intersection'](_0x134f24[_0xeea4('0x27')],_0x134f24[_0xeea4('0x28')]);_0x2eb38c[_0xeea4('0x2b')]=_['intersection'](_0x134f24[_0xeea4('0x27')],qs[_0xeea4('0x2c')](_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x2c')]));_0x2eb38c[_0xeea4('0x2b')]=_0x2eb38c[_0xeea4('0x2b')][_0xeea4('0x2d')]?_0x2eb38c[_0xeea4('0x2b')]:_0x134f24[_0xeea4('0x27')];if(!_0x4a3a7e[_0xeea4('0x28')]['hasOwnProperty']('nolimit')){_0x2eb38c[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x1c')]);_0x2eb38c[_0xeea4('0x1a')]=qs[_0xeea4('0x1a')](_0x4a3a7e[_0xeea4('0x28')]['offset']);}_0x2eb38c[_0xeea4('0x2e')]=qs[_0xeea4('0x2f')](_0x4a3a7e[_0xeea4('0x28')]['sort']);_0x2eb38c[_0xeea4('0x30')]=qs[_0xeea4('0x2a')](_['pick'](_0x4a3a7e[_0xeea4('0x28')],_0x134f24[_0xeea4('0x2a')]),_0x5b651f);if(_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x31')]){_0x2eb38c[_0xeea4('0x30')]=_[_0xeea4('0x32')](_0x2eb38c[_0xeea4('0x30')],{'$or':_[_0xeea4('0x25')](_0x5b651f,function(_0x52a32d){if(_0x52a32d[_0xeea4('0x33')]!==_0xeea4('0x34')){var _0x47f7a2={};_0x47f7a2[_0x52a32d[_0xeea4('0x23')]]={'$like':'%'+_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x31')]+'%'};return _0x47f7a2;}})});}_0x2eb38c=_[_0xeea4('0x32')]({},_0x2eb38c,_0x4a3a7e[_0xeea4('0x35')]);var _0x3981fd={'where':_0x2eb38c[_0xeea4('0x30')]};return db['DeskField'][_0xeea4('0x1d')](_0x3981fd)[_0xeea4('0x21')](function(_0x5d6323){_0x1217b4[_0xeea4('0x1d')]=_0x5d6323;if(_0x4a3a7e['query'][_0xeea4('0x36')]){_0x2eb38c[_0xeea4('0x37')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x2eb38c);})[_0xeea4('0x21')](function(_0x4d1512){_0x1217b4[_0xeea4('0x38')]=_0x4d1512;return _0x1217b4;})[_0xeea4('0x21')](respondWithFilteredResult(_0xb2acc2,_0x2eb38c))['catch'](handleError(_0xb2acc2,null));};exports[_0xeea4('0x39')]=function(_0x410a1c,_0x55d136){var _0xb56e01={'raw':!![],'where':{'id':_0x410a1c[_0xeea4('0x3a')]['id']}},_0x13a30c={};_0x13a30c[_0xeea4('0x27')]=_[_0xeea4('0x29')](db[_0xeea4('0x3b')][_0xeea4('0x26')]);_0x13a30c['query']=_[_0xeea4('0x29')](_0x410a1c[_0xeea4('0x28')]);_0x13a30c[_0xeea4('0x2a')]=_[_0xeea4('0x3c')](_0x13a30c['model'],_0x13a30c[_0xeea4('0x28')]);_0xb56e01[_0xeea4('0x2b')]=_[_0xeea4('0x3c')](_0x13a30c['model'],qs['fields'](_0x410a1c[_0xeea4('0x28')][_0xeea4('0x2c')]));_0xb56e01['attributes']=_0xb56e01['attributes'][_0xeea4('0x2d')]?_0xb56e01[_0xeea4('0x2b')]:_0x13a30c[_0xeea4('0x27')];if(_0x410a1c[_0xeea4('0x28')][_0xeea4('0x36')]){_0xb56e01['include']=[{'all':!![]}];}_0xb56e01=_[_0xeea4('0x32')]({},_0xb56e01,_0x410a1c['options']);return db[_0xeea4('0x3b')][_0xeea4('0x3d')](_0xb56e01)[_0xeea4('0x21')](handleEntityNotFound(_0x55d136,null))['then'](respondWithResult(_0x55d136,null))[_0xeea4('0x3e')](handleError(_0x55d136,null));};exports['create']=function(_0x4e525b,_0x11aa5f){return db[_0xeea4('0x3b')][_0xeea4('0x3f')](_0x4e525b[_0xeea4('0x40')],{})['then'](respondWithResult(_0x11aa5f,0xc9))['catch'](handleError(_0x11aa5f,null));};exports[_0xeea4('0x20')]=function(_0x18bb53,_0x208282){if(_0x18bb53['body']['id']){delete _0x18bb53[_0xeea4('0x40')]['id'];}return db[_0xeea4('0x3b')]['find']({'where':{'id':_0x18bb53['params']['id']}})['then'](handleEntityNotFound(_0x208282,null))[_0xeea4('0x21')](saveUpdates(_0x18bb53[_0xeea4('0x40')],null))[_0xeea4('0x21')](respondWithResult(_0x208282,null))[_0xeea4('0x3e')](handleError(_0x208282,null));};exports[_0xeea4('0x41')]=function(_0x2bc6e6,_0x37c205){return db[_0xeea4('0x3b')]['find']({'where':{'id':_0x2bc6e6['params']['id']}})[_0xeea4('0x21')](handleEntityNotFound(_0x37c205,null))['then'](removeEntity(_0x37c205,null))[_0xeea4('0x3e')](handleError(_0x37c205,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6f69cbe..f9218dc 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 _0x3f2b=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x3f2b,0x10f));var _0xb3f2=function(_0x49d0fb,_0x99b10b){_0x49d0fb=_0x49d0fb-0x0;var _0x10869b=_0x3f2b[_0x49d0fb];return _0x10869b;};'use strict';var _=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var logger=require(_0xb3f2('0x2'))(_0xb3f2('0x3'));var moment=require(_0xb3f2('0x4'));var BPromise=require(_0xb3f2('0x5'));var rp=require(_0xb3f2('0x6'));var fs=require('fs');var path=require(_0xb3f2('0x7'));var rimraf=require(_0xb3f2('0x8'));var config=require(_0xb3f2('0x9'));var attributes=require(_0xb3f2('0xa'));module[_0xb3f2('0xb')]=function(_0x3f6fb8,_0x46e84c){return _0x3f6fb8[_0xb3f2('0xc')](_0xb3f2('0xd'),attributes,{'tableName':_0xb3f2('0xe'),'paranoid':![],'indexes':[{'name':_0xb3f2('0xf'),'fields':[_0xb3f2('0x10'),_0xb3f2('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac4=['idField','FieldId','lodash','../../config/logger','api','bluebird','../../config/environment','exports','define','DeskField','int_desk_fields'];(function(_0x59a320,_0xae9130){var _0x25001d=function(_0x39df2d){while(--_0x39df2d){_0x59a320['push'](_0x59a320['shift']());}};_0x25001d(++_0xae9130);}(_0x7ac4,0x157));var _0x47ac=function(_0x19b9bb,_0x435b2f){_0x19b9bb=_0x19b9bb-0x0;var _0x4018cb=_0x7ac4[_0x19b9bb];return _0x4018cb;};'use strict';var _=require(_0x47ac('0x0'));var util=require('util');var logger=require(_0x47ac('0x1'))(_0x47ac('0x2'));var moment=require('moment');var BPromise=require(_0x47ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x47ac('0x4'));var attributes=require('./intDeskField.attributes');module[_0x47ac('0x5')]=function(_0x5c8370,_0x5cbde9){return _0x5c8370[_0x47ac('0x6')](_0x47ac('0x7'),attributes,{'tableName':_0x47ac('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x47ac('0x9'),_0x47ac('0xa')],'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 fe4f326..2e3014a 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 _0xb6a2=['error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x101bbe,_0x172b68){var _0x1658d7=function(_0x3995b4){while(--_0x3995b4){_0x101bbe['push'](_0x101bbe['shift']());}};_0x1658d7(++_0x172b68);}(_0xb6a2,0x1d1));var _0x2b6a=function(_0x19f2db,_0x431044){_0x19f2db=_0x19f2db-0x0;var _0x3f4eab=_0xb6a2[_0x19f2db];return _0x3f4eab;};'use strict';var _=require(_0x2b6a('0x0'));var util=require('util');var moment=require(_0x2b6a('0x1'));var BPromise=require(_0x2b6a('0x2'));var rs=require(_0x2b6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b6a('0x4'));var logger=require('../../config/logger')(_0x2b6a('0x5'));var config=require(_0x2b6a('0x6'));var jayson=require(_0x2b6a('0x7'));var client=jayson[_0x2b6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x442c4d,_0x5500ee,_0x3beabb){return new BPromise(function(_0x4a9297,_0x29d6cc){return client[_0x2b6a('0x9')](_0x442c4d,_0x3beabb)['then'](function(_0xb6affd){logger[_0x2b6a('0xa')]('DeskField,\x20%s,\x20%s',_0x5500ee,_0x2b6a('0xb'));logger[_0x2b6a('0xc')](_0x2b6a('0xd'),_0x5500ee,_0x2b6a('0xb'),JSON[_0x2b6a('0xe')](_0xb6affd));if(_0xb6affd[_0x2b6a('0xf')]){if(_0xb6affd[_0x2b6a('0xf')][_0x2b6a('0x10')]===0x1f4){logger['error'](_0x2b6a('0x11'),_0x5500ee,_0xb6affd['error']['message']);return _0x29d6cc(_0xb6affd[_0x2b6a('0xf')]['message']);}logger[_0x2b6a('0xf')](_0x2b6a('0x11'),_0x5500ee,_0xb6affd[_0x2b6a('0xf')]['message']);return _0x4a9297(_0xb6affd[_0x2b6a('0xf')][_0x2b6a('0x12')]);}else{logger[_0x2b6a('0xa')](_0x2b6a('0x11'),_0x5500ee,_0x2b6a('0xb'));_0x4a9297(_0xb6affd['result']['message']);}})[_0x2b6a('0x13')](function(_0x27b07a){logger['error'](_0x2b6a('0x11'),_0x5500ee,_0x27b07a);_0x29d6cc(_0x27b07a);});});} \ No newline at end of file +var _0xd07a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45a3ae,_0x2b9745){var _0x58a2b1=function(_0x49efa8){while(--_0x49efa8){_0x45a3ae['push'](_0x45a3ae['shift']());}};_0x58a2b1(++_0x2b9745);}(_0xd07a,0x1b2));var _0xad07=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xd07a[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0xad07('0x0'));var util=require(_0xad07('0x1'));var moment=require('moment');var BPromise=require(_0xad07('0x2'));var rs=require(_0xad07('0x3'));var fs=require('fs');var Redis=require(_0xad07('0x4'));var db=require(_0xad07('0x5'))['db'];var utils=require(_0xad07('0x6'));var logger=require(_0xad07('0x7'))('rpc');var config=require(_0xad07('0x8'));var jayson=require(_0xad07('0x9'));var client=jayson[_0xad07('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d30fb,_0x26f60a,_0x2178f3){return new BPromise(function(_0x5c7cab,_0x5651b9){return client['request'](_0x1d30fb,_0x2178f3)['then'](function(_0x251124){logger['info']('DeskField,\x20%s,\x20%s',_0x26f60a,_0xad07('0xb'));logger['debug'](_0xad07('0xc'),_0x26f60a,_0xad07('0xb'),JSON['stringify'](_0x251124));if(_0x251124['error']){if(_0x251124[_0xad07('0xd')][_0xad07('0xe')]===0x1f4){logger[_0xad07('0xd')](_0xad07('0xf'),_0x26f60a,_0x251124['error']['message']);return _0x5651b9(_0x251124[_0xad07('0xd')]['message']);}logger['error'](_0xad07('0xf'),_0x26f60a,_0x251124[_0xad07('0xd')][_0xad07('0x10')]);return _0x5c7cab(_0x251124[_0xad07('0xd')][_0xad07('0x10')]);}else{logger[_0xad07('0x11')](_0xad07('0xf'),_0x26f60a,_0xad07('0xb'));_0x5c7cab(_0x251124[_0xad07('0x12')][_0xad07('0x10')]);}})[_0xad07('0x13')](function(_0x50335d){logger[_0xad07('0xd')]('DeskField,\x20%s,\x20%s',_0x26f60a,_0x50335d);_0x5651b9(_0x50335d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c9a9ba7..bc1dc78 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 _0x0136=['index','show','isAuthenticated','getFields','post','create','/:id/configurations','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x391d9a,_0x28f029){var _0x29fad8=function(_0x59259b){while(--_0x59259b){_0x391d9a['push'](_0x391d9a['shift']());}};_0x29fad8(++_0x28f029);}(_0x0136,0xc7));var _0x6013=function(_0x4f21f6,_0xa85e36){_0x4f21f6=_0x4f21f6-0x0;var _0x450641=_0x0136[_0x4f21f6];return _0x450641;};'use strict';var multer=require(_0x6013('0x0'));var util=require(_0x6013('0x1'));var path=require(_0x6013('0x2'));var timeout=require(_0x6013('0x3'));var express=require(_0x6013('0x4'));var router=express[_0x6013('0x5')]();var fs_extra=require(_0x6013('0x6'));var auth=require(_0x6013('0x7'));var interaction=require(_0x6013('0x8'));var config=require(_0x6013('0x9'));var controller=require('./intDynamics365Account.controller');router[_0x6013('0xa')]('/',auth['isAuthenticated'](),controller[_0x6013('0xb')]);router[_0x6013('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6013('0xc')]);router[_0x6013('0xa')]('/:id/configurations',auth[_0x6013('0xd')](),controller['getConfigurations']);router[_0x6013('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6013('0xe')]);router[_0x6013('0xf')]('/',auth['isAuthenticated'](),controller[_0x6013('0x10')]);router[_0x6013('0xf')](_0x6013('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x6013('0x12'),auth[_0x6013('0xd')](),controller['update']);router['delete'](_0x6013('0x12'),auth[_0x6013('0xd')](),controller[_0x6013('0x13')]);module[_0x6013('0x14')]=router; \ No newline at end of file +var _0x4b52=['../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','util','connect-timeout','express','Router','fs-extra'];(function(_0x50d747,_0x5d3042){var _0x44bbb5=function(_0x178375){while(--_0x178375){_0x50d747['push'](_0x50d747['shift']());}};_0x44bbb5(++_0x5d3042);}(_0x4b52,0x1f3));var _0x24b5=function(_0x2f8a43,_0x2deab8){_0x2f8a43=_0x2f8a43-0x0;var _0x394ea1=_0x4b52[_0x2f8a43];return _0x394ea1;};'use strict';var multer=require('multer');var util=require(_0x24b5('0x0'));var path=require('path');var timeout=require(_0x24b5('0x1'));var express=require(_0x24b5('0x2'));var router=express[_0x24b5('0x3')]();var fs_extra=require(_0x24b5('0x4'));var auth=require(_0x24b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24b5('0x6'));var controller=require(_0x24b5('0x7'));router[_0x24b5('0x8')]('/',auth[_0x24b5('0x9')](),controller[_0x24b5('0xa')]);router[_0x24b5('0x8')](_0x24b5('0xb'),auth[_0x24b5('0x9')](),controller[_0x24b5('0xc')]);router[_0x24b5('0x8')](_0x24b5('0xd'),auth[_0x24b5('0x9')](),controller[_0x24b5('0xe')]);router[_0x24b5('0x8')](_0x24b5('0xf'),auth[_0x24b5('0x9')](),controller[_0x24b5('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x24b5('0x11')](_0x24b5('0xd'),auth[_0x24b5('0x9')](),controller[_0x24b5('0x12')]);router[_0x24b5('0x13')]('/:id',auth[_0x24b5('0x9')](),controller['update']);router[_0x24b5('0x14')]('/:id',auth[_0x24b5('0x9')](),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 354c854..f003f04 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 _0x4279=['exports','STRING','BOOLEAN'];(function(_0x4362c4,_0x57b51f){var _0x4e2876=function(_0x208a59){while(--_0x208a59){_0x4362c4['push'](_0x4362c4['shift']());}};_0x4e2876(++_0x57b51f);}(_0x4279,0x8d));var _0x9427=function(_0x17556d,_0x4e1b9e){_0x17556d=_0x17556d-0x0;var _0x17b765=_0x4279[_0x17556d];return _0x17b765;};'use strict';var Sequelize=require('sequelize');module[_0x9427('0x0')]={'name':{'type':Sequelize[_0x9427('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9427('0x1')]},'remoteUri':{'type':Sequelize[_0x9427('0x1')]},'tenantId':{'type':Sequelize[_0x9427('0x1')]},'clientId':{'type':Sequelize[_0x9427('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9427('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9427('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf3ff=['sequelize','STRING','BOOLEAN'];(function(_0x223790,_0x1563d6){var _0x20e89e=function(_0x2334a3){while(--_0x2334a3){_0x223790['push'](_0x223790['shift']());}};_0x20e89e(++_0x1563d6);}(_0xf3ff,0xae));var _0xff3f=function(_0x59d010,_0x250050){_0x59d010=_0x59d010-0x0;var _0x25a230=_0xf3ff[_0x59d010];return _0x25a230;};'use strict';var Sequelize=require(_0xff3f('0x0'));module['exports']={'name':{'type':Sequelize[_0xff3f('0x1')]},'username':{'type':Sequelize[_0xff3f('0x1')]},'password':{'type':Sequelize[_0xff3f('0x1')]},'remoteUri':{'type':Sequelize[_0xff3f('0x1')]},'tenantId':{'type':Sequelize[_0xff3f('0x1')]},'clientId':{'type':Sequelize[_0xff3f('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xff3f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xff3f('0x1')]},'modernAuthentication':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 48656d6..57f794e 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 _0x7b10=['clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','substring','push','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','status','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','then','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidyominame','actualserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','username','password','tenantId'];(function(_0x4393af,_0x1c524a){var _0x55f141=function(_0x13d3d3){while(--_0x13d3d3){_0x4393af['push'](_0x4393af['shift']());}};_0x55f141(++_0x1c524a);}(_0x7b10,0x1ac));var _0x07b1=function(_0x5650af,_0x53009d){_0x5650af=_0x5650af-0x0;var _0x412bd7=_0x7b10[_0x5650af];return _0x412bd7;};'use strict';var rp=require(_0x07b1('0x0'));var util=require(_0x07b1('0x1'));var _=require(_0x07b1('0x2'));var qs=require(_0x07b1('0x3'));var logger=require(_0x07b1('0x4'))('api');var db=require(_0x07b1('0x5'))['db'];var integrations=require(_0x07b1('0x6'));function respondWithResult(_0x7c39e7,_0x443b4f){_0x443b4f=_0x443b4f||0xc8;return function(_0x651044){if(_0x651044){return _0x7c39e7['status'](_0x443b4f)[_0x07b1('0x7')](_0x651044);}};}function respondWithFilteredResult(_0x106f8d,_0xece33d){return function(_0x38d152){if(_0x38d152){var _0x1bfc1d=typeof _0xece33d[_0x07b1('0x8')]===_0x07b1('0x9')&&typeof _0xece33d['limit']==='undefined';var _0x5ac2a6=_0x38d152['count'];var _0x13447f=_0x1bfc1d?0x0:_0xece33d[_0x07b1('0x8')];var _0x36c968=_0x1bfc1d?_0x38d152[_0x07b1('0xa')]:_0xece33d[_0x07b1('0x8')]+_0xece33d[_0x07b1('0xb')];var _0x3c5b0d;if(_0x36c968>=_0x5ac2a6){_0x36c968=_0x5ac2a6;_0x3c5b0d=0xc8;}else{_0x3c5b0d=0xce;}_0x106f8d['status'](_0x3c5b0d);return _0x106f8d[_0x07b1('0xc')](_0x07b1('0xd'),_0x13447f+'-'+_0x36c968+'/'+_0x5ac2a6)[_0x07b1('0x7')](_0x38d152);}return null;};}function saveUpdates(_0x47e2e7){return function(_0x2dccb2){if(_0x2dccb2){return _0x2dccb2[_0x07b1('0xe')](_0x47e2e7)['then'](function(_0x1230b6){return _0x1230b6;});}return null;};}function removeEntity(_0x35febf){return function(_0x506383){if(_0x506383){return _0x506383[_0x07b1('0xf')]()['then'](function(){_0x35febf['status'](0xcc)[_0x07b1('0x10')]();});}};}function handleEntityNotFound(_0x11a638){return function(_0x31628c){if(!_0x31628c){_0x11a638[_0x07b1('0x11')](0x194);}return _0x31628c;};}function handleError(_0x5a4858,_0x54f67d){_0x54f67d=_0x54f67d||0x1f4;return function(_0x2d0189){logger[_0x07b1('0x12')](_0x2d0189[_0x07b1('0x13')]);if(_0x2d0189['name']){delete _0x2d0189[_0x07b1('0x14')];}_0x5a4858[_0x07b1('0x15')](_0x54f67d)[_0x07b1('0x16')](_0x2d0189);};}exports['index']=function(_0x3ece8a,_0x4dd2c5){var _0x53601d={},_0x5d94e7={},_0xe3afab={'count':0x0,'rows':[]};var _0x19b591=_[_0x07b1('0x17')](db['Dynamics365Account'][_0x07b1('0x18')],function(_0x3a1792){return{'name':_0x3a1792[_0x07b1('0x19')],'type':_0x3a1792[_0x07b1('0x1a')][_0x07b1('0x1b')]};});_0x5d94e7[_0x07b1('0x1c')]=_['map'](_0x19b591,_0x07b1('0x14'));_0x5d94e7['query']=_[_0x07b1('0x1d')](_0x3ece8a['query']);_0x5d94e7[_0x07b1('0x1e')]=_[_0x07b1('0x1f')](_0x5d94e7[_0x07b1('0x1c')],_0x5d94e7['query']);_0x53601d[_0x07b1('0x20')]=_[_0x07b1('0x1f')](_0x5d94e7[_0x07b1('0x1c')],qs[_0x07b1('0x21')](_0x3ece8a[_0x07b1('0x22')][_0x07b1('0x21')]));_0x53601d[_0x07b1('0x20')]=_0x53601d[_0x07b1('0x20')]['length']?_0x53601d[_0x07b1('0x20')]:_0x5d94e7[_0x07b1('0x1c')];if(!_0x3ece8a[_0x07b1('0x22')]['hasOwnProperty'](_0x07b1('0x23'))){_0x53601d['limit']=qs[_0x07b1('0xb')](_0x3ece8a[_0x07b1('0x22')]['limit']);_0x53601d['offset']=qs['offset'](_0x3ece8a[_0x07b1('0x22')]['offset']);}_0x53601d[_0x07b1('0x24')]=qs[_0x07b1('0x25')](_0x3ece8a[_0x07b1('0x22')][_0x07b1('0x25')]);_0x53601d['where']=qs[_0x07b1('0x1e')](_[_0x07b1('0x26')](_0x3ece8a[_0x07b1('0x22')],_0x5d94e7['filters']),_0x19b591);if(_0x3ece8a['query']['filter']){_0x53601d[_0x07b1('0x27')]=_['merge'](_0x53601d['where'],{'$or':_[_0x07b1('0x17')](_0x19b591,function(_0x3b2264){if(_0x3b2264[_0x07b1('0x1a')]!==_0x07b1('0x28')){var _0xa5dea1={};_0xa5dea1[_0x3b2264[_0x07b1('0x14')]]={'$like':'%'+_0x3ece8a['query'][_0x07b1('0x29')]+'%'};return _0xa5dea1;}})});}_0x53601d=_[_0x07b1('0x2a')]({},_0x53601d,_0x3ece8a[_0x07b1('0x2b')]);var _0x200536={'where':_0x53601d['where']};return db['Dynamics365Account'][_0x07b1('0xa')](_0x200536)[_0x07b1('0x2c')](function(_0x108251){_0xe3afab[_0x07b1('0xa')]=_0x108251;if(_0x3ece8a[_0x07b1('0x22')][_0x07b1('0x2d')]){_0x53601d[_0x07b1('0x2e')]=[{'all':!![]}];}return db[_0x07b1('0x2f')][_0x07b1('0x30')](_0x53601d);})['then'](function(_0x19efee){_0xe3afab[_0x07b1('0x31')]=_0x19efee;return _0xe3afab;})['then'](respondWithFilteredResult(_0x4dd2c5,_0x53601d))[_0x07b1('0x32')](handleError(_0x4dd2c5,null));};exports[_0x07b1('0x33')]=function(_0x3d53e1,_0x256cf1){var _0x20d54b={'raw':![],'where':{'id':_0x3d53e1[_0x07b1('0x34')]['id']}},_0x467fe0={};_0x467fe0['model']=_[_0x07b1('0x1d')](db[_0x07b1('0x2f')][_0x07b1('0x18')]);_0x467fe0['query']=_[_0x07b1('0x1d')](_0x3d53e1[_0x07b1('0x22')]);_0x467fe0[_0x07b1('0x1e')]=_[_0x07b1('0x1f')](_0x467fe0[_0x07b1('0x1c')],_0x467fe0[_0x07b1('0x22')]);_0x20d54b[_0x07b1('0x20')]=_[_0x07b1('0x1f')](_0x467fe0[_0x07b1('0x1c')],qs[_0x07b1('0x21')](_0x3d53e1[_0x07b1('0x22')][_0x07b1('0x21')]));_0x20d54b[_0x07b1('0x20')]=_0x20d54b[_0x07b1('0x20')]['length']?_0x20d54b[_0x07b1('0x20')]:_0x467fe0[_0x07b1('0x1c')];if(_0x3d53e1[_0x07b1('0x22')][_0x07b1('0x2d')]){_0x20d54b['include']=[{'all':!![]}];}_0x20d54b=_[_0x07b1('0x2a')]({},_0x20d54b,_0x3d53e1[_0x07b1('0x2b')]);return db['Dynamics365Account'][_0x07b1('0x35')](_0x20d54b)[_0x07b1('0x2c')](handleEntityNotFound(_0x256cf1,null))[_0x07b1('0x2c')](respondWithResult(_0x256cf1,null))[_0x07b1('0x32')](handleError(_0x256cf1,null));};exports['create']=function(_0x31b605,_0x22ebe0){return db[_0x07b1('0x2f')][_0x07b1('0x36')](_0x31b605[_0x07b1('0x37')],{})[_0x07b1('0x2c')](respondWithResult(_0x22ebe0,0xc9))[_0x07b1('0x32')](handleError(_0x22ebe0,null));};exports['update']=function(_0x1a18b5,_0x2601b6){if(_0x1a18b5[_0x07b1('0x37')]['id']){delete _0x1a18b5['body']['id'];}return db[_0x07b1('0x2f')][_0x07b1('0x35')]({'where':{'id':_0x1a18b5['params']['id']}})['then'](handleEntityNotFound(_0x2601b6,null))[_0x07b1('0x2c')](saveUpdates(_0x1a18b5[_0x07b1('0x37')],null))[_0x07b1('0x2c')](respondWithResult(_0x2601b6,null))[_0x07b1('0x32')](handleError(_0x2601b6,null));};exports[_0x07b1('0xf')]=function(_0x2148e3,_0x31e31f){return db[_0x07b1('0x2f')][_0x07b1('0x35')]({'where':{'id':_0x2148e3[_0x07b1('0x34')]['id']}})[_0x07b1('0x2c')](handleEntityNotFound(_0x31e31f,null))[_0x07b1('0x2c')](removeEntity(_0x31e31f,null))['catch'](handleError(_0x31e31f,null));};exports[_0x07b1('0x38')]=function(_0x51d2be,_0x4fea77){var _0x5a81a7={};var _0x22d23c={};var _0x3294a4;var _0xa9d249;return db[_0x07b1('0x2f')][_0x07b1('0x39')]({'where':{'id':_0x51d2be[_0x07b1('0x34')]['id']}})[_0x07b1('0x2c')](handleEntityNotFound(_0x4fea77,null))[_0x07b1('0x2c')](function(_0x1f1d00){if(_0x1f1d00){_0x3294a4=_0x1f1d00;_0x22d23c[_0x07b1('0x1c')]=_[_0x07b1('0x1d')](db[_0x07b1('0x3a')][_0x07b1('0x18')]);_0x22d23c[_0x07b1('0x22')]=_[_0x07b1('0x1d')](_0x51d2be[_0x07b1('0x22')]);_0x22d23c[_0x07b1('0x1e')]=_[_0x07b1('0x1f')](_0x22d23c[_0x07b1('0x1c')],_0x22d23c[_0x07b1('0x22')]);_0x5a81a7['attributes']=_[_0x07b1('0x1f')](_0x22d23c['model'],qs[_0x07b1('0x21')](_0x51d2be[_0x07b1('0x22')]['fields']));_0x5a81a7['attributes']=_0x5a81a7[_0x07b1('0x20')][_0x07b1('0x3b')]?_0x5a81a7[_0x07b1('0x20')]:_0x22d23c[_0x07b1('0x1c')];_0x5a81a7['order']=qs[_0x07b1('0x25')](_0x51d2be[_0x07b1('0x22')][_0x07b1('0x25')]);_0x5a81a7[_0x07b1('0x27')]=qs[_0x07b1('0x1e')](_[_0x07b1('0x26')](_0x51d2be[_0x07b1('0x22')],_0x22d23c[_0x07b1('0x1e')]));if(_0x51d2be[_0x07b1('0x22')][_0x07b1('0x29')]){_0x5a81a7[_0x07b1('0x27')]=_[_0x07b1('0x2a')](_0x5a81a7[_0x07b1('0x27')],{'$or':_['map'](_0x5a81a7[_0x07b1('0x20')],function(_0x4cf598){var _0x5dd51c={};_0x5dd51c[_0x4cf598]={'$like':'%'+_0x51d2be[_0x07b1('0x22')]['filter']+'%'};return _0x5dd51c;})});}_0x5a81a7=_[_0x07b1('0x2a')]({},_0x5a81a7,_0x51d2be[_0x07b1('0x2b')]);return _0x3294a4[_0x07b1('0x38')](_0x5a81a7);}})['then'](function(_0x25ef9c){if(_0x25ef9c){_0xa9d249=_0x25ef9c[_0x07b1('0x3b')];if(!_0x51d2be[_0x07b1('0x22')][_0x07b1('0x3c')](_0x07b1('0x23'))){_0x5a81a7[_0x07b1('0xb')]=qs[_0x07b1('0xb')](_0x51d2be[_0x07b1('0x22')][_0x07b1('0xb')]);_0x5a81a7['offset']=qs[_0x07b1('0x8')](_0x51d2be[_0x07b1('0x22')][_0x07b1('0x8')]);}return _0x3294a4[_0x07b1('0x38')](_0x5a81a7);}})[_0x07b1('0x2c')](function(_0x3ee716){if(_0x3ee716){return _0x3ee716?{'count':_0xa9d249,'rows':_0x3ee716}:null;}})[_0x07b1('0x2c')](respondWithResult(_0x4fea77,null))[_0x07b1('0x32')](handleError(_0x4fea77,null));};exports['addConfiguration']=function(_0x3500ed,_0x66cb1b){if(_0x3500ed[_0x07b1('0x37')]['id']){delete _0x3500ed[_0x07b1('0x37')]['id'];}return db['Dynamics365Account'][_0x07b1('0x39')]({'where':{'id':_0x3500ed[_0x07b1('0x34')]['id']}})[_0x07b1('0x2c')](handleEntityNotFound(_0x66cb1b,null))['then'](function(_0x3cb2a5){if(_0x3cb2a5){_0x3500ed[_0x07b1('0x37')][_0x07b1('0x3d')]=_0x3cb2a5['id'];_0x3500ed['body'][_0x07b1('0x3e')]=integrations[_0x07b1('0x3f')](_0x3500ed[_0x07b1('0x37')]['channel'],_0x3500ed['body']['type']);_0x3500ed[_0x07b1('0x37')][_0x07b1('0x40')]=integrations['getDescriptions'](_0x3500ed[_0x07b1('0x37')][_0x07b1('0x41')],_0x3500ed['body'][_0x07b1('0x1a')]);return db[_0x07b1('0x3a')]['create'](_0x3500ed[_0x07b1('0x37')],{'include':[{'model':db[_0x07b1('0x42')],'as':_0x07b1('0x3e')},{'model':db[_0x07b1('0x42')],'as':_0x07b1('0x40')}]});}return null;})[_0x07b1('0x2c')](respondWithResult(_0x66cb1b,null))[_0x07b1('0x32')](handleError(_0x66cb1b,null));};function sanitizeRemoteUri(_0x37f9ab){var _0x34a69c=_0x37f9ab[_0x07b1('0x43')](-0x1);if(_0x34a69c==='/')return _0x37f9ab['substring'](0x0,_0x37f9ab[_0x07b1('0x44')](_0x34a69c));return _0x37f9ab;}function getWebApiUrl(_0x5e2158){return util[_0x07b1('0x45')](_0x07b1('0x46'),_0x5e2158);}exports[_0x07b1('0x47')]=function(_0x31e143,_0x28904e){var _0x561792=_0x31e143[_0x07b1('0x22')][_0x07b1('0x48')];var _0x48e2ee=_0x561792==='incident'?'Incident':_0x07b1('0x49');var _0x285048='';var _0x45694e='';var _0x231237='';var _0x128fdc='';var _0x586389='';var _0x287ad1='';var _0x55856b='';var _0x50c482='';var _0x40cefd=[_0x07b1('0x4a'),_0x07b1('0x4b'),_0x07b1('0x4c'),_0x07b1('0x4d'),_0x07b1('0x4e'),_0x07b1('0x4f'),_0x07b1('0x50'),'regardingobjectid',_0x07b1('0x51'),'phonecall_activity_parties'];var _0x2c3b4c=['accountidname',_0x07b1('0x52'),_0x07b1('0x53'),'billedserviceunits',_0x07b1('0x54'),'contactidyominame','contractdetailidname',_0x07b1('0x55'),_0x07b1('0x56'),_0x07b1('0x57'),_0x07b1('0x58'),_0x07b1('0x59'),_0x07b1('0x5a'),_0x07b1('0x5b'),_0x07b1('0x5c'),_0x07b1('0x5d'),_0x07b1('0x5e'),_0x07b1('0x5f'),_0x07b1('0x60'),_0x07b1('0x61'),_0x07b1('0x62'),_0x07b1('0x63'),_0x07b1('0x64'),'exchangerate',_0x07b1('0x65'),_0x07b1('0x66'),_0x07b1('0x67'),_0x07b1('0x68'),_0x07b1('0x69'),_0x07b1('0x6a'),_0x07b1('0x6b'),_0x07b1('0x6c'),_0x07b1('0x6d'),_0x07b1('0x6e'),'modifiedbyyominame',_0x07b1('0x6f'),_0x07b1('0x70'),_0x07b1('0x71'),_0x07b1('0x72'),_0x07b1('0x73'),_0x07b1('0x74'),_0x07b1('0x75'),'overriddencreatedon','owneridname','owneridtype',_0x07b1('0x76'),_0x07b1('0x77'),_0x07b1('0x78'),_0x07b1('0x79'),_0x07b1('0x7a'),_0x07b1('0x7b'),_0x07b1('0x7c'),_0x07b1('0x7d'),_0x07b1('0x7e'),_0x07b1('0x7f'),'responsiblecontactidname',_0x07b1('0x80'),_0x07b1('0x81'),_0x07b1('0x82'),_0x07b1('0x83'),'socialprofileidname',_0x07b1('0x84'),_0x07b1('0x85'),_0x07b1('0x86'),_0x07b1('0x87'),_0x07b1('0x88'),'transactioncurrencyidname','traversedpath',_0x07b1('0x89'),_0x07b1('0x8a')];var _0x4e8f0d=_0x40cefd['concat'](_0x2c3b4c);return db['Dynamics365Account'][_0x07b1('0x39')]({'where':{'id':_0x31e143[_0x07b1('0x34')]['id']},'attributes':['id',_0x07b1('0x8b'),_0x07b1('0x8c'),'remoteUri',_0x07b1('0x8d'),_0x07b1('0x8e'),_0x07b1('0x8f'),_0x07b1('0x90')],'include':[{'model':db[_0x07b1('0x91')],'as':_0x07b1('0x91'),'attributes':['id',_0x07b1('0x92'),'data7']}]})[_0x07b1('0x2c')](handleEntityNotFound(_0x28904e,null))['then'](function(_0x4a3cce){if(_0x4a3cce){if(_0x4a3cce[_0x07b1('0x90')]){_0x4a3cce[_0x07b1('0x93')]=_0x4a3cce[_0x07b1('0x91')][_0x07b1('0x92')];_0x50c482=sanitizeRemoteUri(_0x4a3cce['CloudProvider'][_0x07b1('0x94')]);_0x55856b=getWebApiUrl(_0x50c482);return _0x4a3cce;}_0x50c482=sanitizeRemoteUri(_0x4a3cce['remoteUri']);_0x55856b=getWebApiUrl(_0x50c482);var _0x9ff7df={'method':'POST','uri':_0x07b1('0x95')+_0x4a3cce['tenantId']+_0x07b1('0x96'),'form':{'client_id':_0x4a3cce[_0x07b1('0x8e')],'resource':_0x50c482,'username':_0x4a3cce[_0x07b1('0x8b')],'password':_0x4a3cce[_0x07b1('0x8c')],'grant_type':_0x07b1('0x8c'),'client_secret':_0x4a3cce[_0x07b1('0x8f')]},'json':!![]};return rp(_0x9ff7df);}})[_0x07b1('0x2c')](function(_0x589d13){_0x287ad1=_0x589d13[_0x07b1('0x93')];var _0x5491da={'method':_0x07b1('0x97'),'uri':encodeURI(_0x55856b+_0x07b1('0x98')+_0x48e2ee+'\x27'),'headers':{'Authorization':_0x07b1('0x99')+_0x287ad1,'If-None-Match':null,'OData-Version':_0x07b1('0x9a')},'json':!![]};return rp(_0x5491da);})[_0x07b1('0x2c')](function(_0x15c713){var _0x56861f=_0x15c713[_0x07b1('0x9b')][0x0];var _0x10df90=_0x56861f[_0x07b1('0x9c')];var _0x2f4516={'method':_0x07b1('0x97'),'uri':_0x55856b+_0x07b1('0x9d')+_0x10df90+_0x07b1('0x9e'),'headers':{'Authorization':_0x07b1('0x99')+_0x287ad1,'If-None-Match':null,'OData-Version':_0x07b1('0x9a')},'json':!![]};return rp(_0x2f4516);})['then'](function(_0x4c3792){_0x285048=_0x4c3792;_0x45694e=_0x285048[_0x07b1('0x9f')];_0x45694e=_['remove'](_0x45694e,function(_0x4f0be1){return!_0x4e8f0d[_0x07b1('0xa0')](_0x4f0be1[_0x07b1('0xa1')]);});var _0x1ca6ff=[];var _0x135070=[];_0x45694e[_0x07b1('0xa2')](function(_0x1e7702){if(_0x1e7702[_0x07b1('0xa3')]){var _0x4887b9=_0x1e7702[_0x07b1('0xa3')][_0x07b1('0xa4')](_0x1e7702[_0x07b1('0xa3')][_0x07b1('0x44')]('.')+0x1);if(_0x4887b9==='PicklistAttributeMetadata'){_0x1ca6ff[_0x07b1('0xa5')](getSelectList(_0x55856b,_0x561792,_0x135070,_0x285048[_0x07b1('0x9c')],_0x1e7702[_0x07b1('0x9c')],_0x287ad1));}}});return Promise['all'](_0x1ca6ff);})[_0x07b1('0x2c')](function(_0xf525c3){_0x231237=_0xf525c3[0x0];var _0x35d292=[];var _0x399c75=[];_0x45694e[_0x07b1('0xa2')](function(_0x230944){if(!_[_0x07b1('0xa6')](_0x230944[_0x07b1('0xa3')])){var _0x42c120=_0x230944[_0x07b1('0xa3')]['substring'](_0x230944['@odata.type'][_0x07b1('0x44')]('.')+0x1);if(_0x42c120===_0x07b1('0xa7')){_0x35d292['push'](getBooleanList(_0x55856b,_0x561792,_0x399c75,_0x285048[_0x07b1('0x9c')],_0x230944['MetadataId'],_0x287ad1));}}});return Promise[_0x07b1('0xa8')](_0x35d292);})[_0x07b1('0x2c')](function(_0x4547e2){_0x128fdc=_0x4547e2[0x0];var _0x938c02=[];var _0x55ae9a=[];_0x45694e[_0x07b1('0xa2')](function(_0x5553ee){if(_0x5553ee['@odata.type']){var _0x2ca1c3=_0x5553ee[_0x07b1('0xa3')][_0x07b1('0xa4')](_0x5553ee[_0x07b1('0xa3')][_0x07b1('0x44')]('.')+0x1);if(_0x2ca1c3==='StringAttributeMetadata'||_0x2ca1c3===_0x07b1('0xa9')||_0x2ca1c3==='BigIntAttributeMetadata'||_0x2ca1c3===_0x07b1('0xaa')||_0x2ca1c3==='MemoAttributeMetadata'||_0x2ca1c3===_0x07b1('0xab')||_0x2ca1c3===_0x07b1('0xac')||_0x2ca1c3===_0x07b1('0xad')||_0x2ca1c3===_0x07b1('0xae')||_0x2ca1c3===_0x07b1('0xaf')){_0x938c02['push'](getInputList(_0x55856b,_0x561792,_0x2ca1c3,_0x55ae9a,_0x285048['MetadataId'],_0x5553ee['MetadataId'],_0x287ad1));}}});return Promise[_0x07b1('0xa8')](_0x938c02);})['then'](function(_0x2b5460){_0x586389=_0x2b5460[0x0];var _0x404503=_0x231237[_0x07b1('0xb0')](_0x128fdc)[_0x07b1('0xb0')](_0x586389);var _0x4abc27={'count':_0x404503[_0x07b1('0x3b')],'rows':_0x404503};return _0x4abc27;})['then'](respondWithResult(_0x28904e,null))[_0x07b1('0x32')](function(_0x376fe7){var _0x3c6a97=_0x31e143[_0x07b1('0x22')][_0x07b1('0xb1')]?0x1f4:_0x376fe7[_0x07b1('0xb2')]||0x1f4;logger['error'](_0x376fe7[_0x07b1('0x13')]);delete _0x376fe7[_0x07b1('0x14')];if(_0x3c6a97===0x191){_0x3c6a97=0x190;}_0x28904e[_0x07b1('0x15')](_0x3c6a97)[_0x07b1('0x16')](_0x31e143[_0x07b1('0x22')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x376fe7[_0x07b1('0xb2')]}:_0x376fe7);});};function getSelectList(_0x5e30a3,_0x46079f,_0xfa9f54,_0x2d2010,_0x2d48de,_0x249f91){var _0x5d5dc9={'method':_0x07b1('0x97'),'uri':_0x5e30a3+_0x07b1('0x9d')+_0x2d2010+')/Attributes('+_0x2d48de+_0x07b1('0xb3')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x249f91,'If-None-Match':null,'OData-Version':_0x07b1('0x9a')},'json':!![]};return rp(_0x5d5dc9)[_0x07b1('0x2c')](function(_0x52ca6d){var _0x5482a4=[];var _0x256374=_0x52ca6d[_0x07b1('0xb4')]['Options'];_0x256374[_0x07b1('0xa2')](function(_0x298337){_0x5482a4['push']({'name':_0x298337['Label'][_0x07b1('0xb5')][_0x07b1('0xb6')],'value':String(_0x298337[_0x07b1('0xb7')])});});var _0xe4b5c6={'id':_0x46079f+'_'+_0x52ca6d[_0x07b1('0xa1')],'name':_0x52ca6d[_0x07b1('0xb8')]['UserLocalizedLabel'][_0x07b1('0xb6')],'custom':![],'options':_0x5482a4};_0xfa9f54[_0x07b1('0xa5')](_0xe4b5c6);return _0xfa9f54;});}function getBooleanList(_0x112fc4,_0xdd514f,_0x297855,_0x44d1c2,_0x5be69a,_0x44730e){var _0x445e16={'method':_0x07b1('0x97'),'uri':_0x112fc4+_0x07b1('0x9d')+_0x44d1c2+_0x07b1('0xb9')+_0x5be69a+_0x07b1('0xba'),'headers':{'Authorization':_0x07b1('0x99')+_0x44730e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x445e16)[_0x07b1('0x2c')](function(_0xc0d268){var _0x53f1af=[];_0x53f1af[_0x07b1('0xa5')]({'name':_0xc0d268[_0x07b1('0xb4')]['TrueOption']['Label']['UserLocalizedLabel'][_0x07b1('0xb6')],'value':_0x07b1('0xbb')},{'name':_0xc0d268[_0x07b1('0xb4')]['FalseOption'][_0x07b1('0xb6')][_0x07b1('0xb5')][_0x07b1('0xb6')],'value':_0x07b1('0xbc')});var _0x242ba3={'id':_0xdd514f+'_'+_0xc0d268['LogicalName'],'name':_0xc0d268[_0x07b1('0xb8')][_0x07b1('0xb5')][_0x07b1('0xb6')],'custom':![],'options':_0x53f1af};_0x297855[_0x07b1('0xa5')](_0x242ba3);return _0x297855;});}function getInputList(_0x145852,_0x44e2e7,_0x4d09f0,_0x16d6f9,_0x5927cf,_0x286d10,_0x5d1b2e){var _0x2f4d9b={'method':_0x07b1('0x97'),'uri':_0x145852+_0x07b1('0x9d')+_0x5927cf+')/Attributes('+_0x286d10+')/Microsoft.Dynamics.CRM.'+_0x4d09f0+_0x07b1('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0x5d1b2e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f4d9b)[_0x07b1('0x2c')](function(_0x213674){var _0x104479={'id':_0x44e2e7+'_'+_0x213674[_0x07b1('0xa1')],'name':_0x213674[_0x07b1('0xb8')][_0x07b1('0xb5')]?_0x213674[_0x07b1('0xb8')][_0x07b1('0xb5')][_0x07b1('0xb6')]:_0x213674[_0x07b1('0xa1')],'custom':![],'options':[]};_0x16d6f9['push'](_0x104479);return _0x16d6f9;});} \ No newline at end of file +var _0x3013=['primarycontactidname','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','timezoneruleversionnumber','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','map','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','overriddencreatedon','owneridname','owneridtype','parentcaseidname'];(function(_0x1c88c5,_0x3a5c64){var _0x93352f=function(_0x2a145a){while(--_0x2a145a){_0x1c88c5['push'](_0x1c88c5['shift']());}};_0x93352f(++_0x3a5c64);}(_0x3013,0xea));var _0x3301=function(_0x353d61,_0x1ee56d){_0x353d61=_0x353d61-0x0;var _0x56b3fc=_0x3013[_0x353d61];return _0x56b3fc;};'use strict';var rp=require(_0x3301('0x0'));var util=require(_0x3301('0x1'));var _=require(_0x3301('0x2'));var qs=require(_0x3301('0x3'));var logger=require('../../config/logger')(_0x3301('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3301('0x5'));function respondWithResult(_0x153554,_0xb395bd){_0xb395bd=_0xb395bd||0xc8;return function(_0x3a8c34){if(_0x3a8c34){return _0x153554['status'](_0xb395bd)[_0x3301('0x6')](_0x3a8c34);}};}function respondWithFilteredResult(_0x52515d,_0x41dd5b){return function(_0x3d7e08){if(_0x3d7e08){var _0x4299f9=typeof _0x41dd5b[_0x3301('0x7')]===_0x3301('0x8')&&typeof _0x41dd5b['limit']===_0x3301('0x8');var _0x744189=_0x3d7e08[_0x3301('0x9')];var _0x237b47=_0x4299f9?0x0:_0x41dd5b[_0x3301('0x7')];var _0x57039b=_0x4299f9?_0x3d7e08[_0x3301('0x9')]:_0x41dd5b[_0x3301('0x7')]+_0x41dd5b[_0x3301('0xa')];var _0x365e2b;if(_0x57039b>=_0x744189){_0x57039b=_0x744189;_0x365e2b=0xc8;}else{_0x365e2b=0xce;}_0x52515d[_0x3301('0xb')](_0x365e2b);return _0x52515d[_0x3301('0xc')](_0x3301('0xd'),_0x237b47+'-'+_0x57039b+'/'+_0x744189)[_0x3301('0x6')](_0x3d7e08);}return null;};}function saveUpdates(_0x427c22){return function(_0x40dad9){if(_0x40dad9){return _0x40dad9[_0x3301('0xe')](_0x427c22)[_0x3301('0xf')](function(_0x284f40){return _0x284f40;});}return null;};}function removeEntity(_0x3dcf1d){return function(_0x52a56c){if(_0x52a56c){return _0x52a56c[_0x3301('0x10')]()[_0x3301('0xf')](function(){_0x3dcf1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8f280d){return function(_0x225e94){if(!_0x225e94){_0x8f280d['sendStatus'](0x194);}return _0x225e94;};}function handleError(_0x269d26,_0x1f6a9a){_0x1f6a9a=_0x1f6a9a||0x1f4;return function(_0x4a3915){logger[_0x3301('0x11')](_0x4a3915[_0x3301('0x12')]);if(_0x4a3915[_0x3301('0x13')]){delete _0x4a3915['name'];}_0x269d26[_0x3301('0xb')](_0x1f6a9a)[_0x3301('0x14')](_0x4a3915);};}exports[_0x3301('0x15')]=function(_0x3133b4,_0x1c1cc4){var _0x2a15b9={},_0x4f7f78={},_0x4b0016={'count':0x0,'rows':[]};var _0x5c3170=_['map'](db[_0x3301('0x16')][_0x3301('0x17')],function(_0x451367){return{'name':_0x451367[_0x3301('0x18')],'type':_0x451367['type']['key']};});_0x4f7f78['model']=_[_0x3301('0x19')](_0x5c3170,'name');_0x4f7f78['query']=_[_0x3301('0x1a')](_0x3133b4[_0x3301('0x1b')]);_0x4f7f78[_0x3301('0x1c')]=_[_0x3301('0x1d')](_0x4f7f78[_0x3301('0x1e')],_0x4f7f78[_0x3301('0x1b')]);_0x2a15b9['attributes']=_[_0x3301('0x1d')](_0x4f7f78[_0x3301('0x1e')],qs[_0x3301('0x1f')](_0x3133b4[_0x3301('0x1b')]['fields']));_0x2a15b9[_0x3301('0x20')]=_0x2a15b9[_0x3301('0x20')][_0x3301('0x21')]?_0x2a15b9[_0x3301('0x20')]:_0x4f7f78[_0x3301('0x1e')];if(!_0x3133b4['query']['hasOwnProperty']('nolimit')){_0x2a15b9['limit']=qs[_0x3301('0xa')](_0x3133b4[_0x3301('0x1b')][_0x3301('0xa')]);_0x2a15b9['offset']=qs[_0x3301('0x7')](_0x3133b4[_0x3301('0x1b')][_0x3301('0x7')]);}_0x2a15b9[_0x3301('0x22')]=qs[_0x3301('0x23')](_0x3133b4[_0x3301('0x1b')][_0x3301('0x23')]);_0x2a15b9[_0x3301('0x24')]=qs['filters'](_['pick'](_0x3133b4[_0x3301('0x1b')],_0x4f7f78[_0x3301('0x1c')]),_0x5c3170);if(_0x3133b4[_0x3301('0x1b')][_0x3301('0x25')]){_0x2a15b9[_0x3301('0x24')]=_[_0x3301('0x26')](_0x2a15b9[_0x3301('0x24')],{'$or':_['map'](_0x5c3170,function(_0x4e46c9){if(_0x4e46c9[_0x3301('0x27')]!==_0x3301('0x28')){var _0x1d66a0={};_0x1d66a0[_0x4e46c9[_0x3301('0x13')]]={'$like':'%'+_0x3133b4[_0x3301('0x1b')][_0x3301('0x25')]+'%'};return _0x1d66a0;}})});}_0x2a15b9=_[_0x3301('0x26')]({},_0x2a15b9,_0x3133b4[_0x3301('0x29')]);var _0x36f688={'where':_0x2a15b9['where']};return db[_0x3301('0x16')]['count'](_0x36f688)['then'](function(_0x1b56fe){_0x4b0016[_0x3301('0x9')]=_0x1b56fe;if(_0x3133b4[_0x3301('0x1b')][_0x3301('0x2a')]){_0x2a15b9[_0x3301('0x2b')]=[{'all':!![]}];}return db[_0x3301('0x16')][_0x3301('0x2c')](_0x2a15b9);})['then'](function(_0xbc72a7){_0x4b0016[_0x3301('0x2d')]=_0xbc72a7;return _0x4b0016;})[_0x3301('0xf')](respondWithFilteredResult(_0x1c1cc4,_0x2a15b9))[_0x3301('0x2e')](handleError(_0x1c1cc4,null));};exports[_0x3301('0x2f')]=function(_0x22fd75,_0x6353){var _0x50b205={'raw':![],'where':{'id':_0x22fd75[_0x3301('0x30')]['id']}},_0x714f89={};_0x714f89['model']=_['keys'](db[_0x3301('0x16')][_0x3301('0x17')]);_0x714f89['query']=_[_0x3301('0x1a')](_0x22fd75['query']);_0x714f89[_0x3301('0x1c')]=_[_0x3301('0x1d')](_0x714f89[_0x3301('0x1e')],_0x714f89[_0x3301('0x1b')]);_0x50b205[_0x3301('0x20')]=_[_0x3301('0x1d')](_0x714f89[_0x3301('0x1e')],qs[_0x3301('0x1f')](_0x22fd75[_0x3301('0x1b')][_0x3301('0x1f')]));_0x50b205[_0x3301('0x20')]=_0x50b205[_0x3301('0x20')]['length']?_0x50b205[_0x3301('0x20')]:_0x714f89['model'];if(_0x22fd75[_0x3301('0x1b')]['includeAll']){_0x50b205['include']=[{'all':!![]}];}_0x50b205=_['merge']({},_0x50b205,_0x22fd75[_0x3301('0x29')]);return db['Dynamics365Account']['find'](_0x50b205)[_0x3301('0xf')](handleEntityNotFound(_0x6353,null))[_0x3301('0xf')](respondWithResult(_0x6353,null))[_0x3301('0x2e')](handleError(_0x6353,null));};exports[_0x3301('0x31')]=function(_0xe9c010,_0x24a233){return db[_0x3301('0x16')][_0x3301('0x31')](_0xe9c010[_0x3301('0x32')],{})[_0x3301('0xf')](respondWithResult(_0x24a233,0xc9))['catch'](handleError(_0x24a233,null));};exports['update']=function(_0x42b96a,_0x3e5440){if(_0x42b96a[_0x3301('0x32')]['id']){delete _0x42b96a['body']['id'];}return db[_0x3301('0x16')]['find']({'where':{'id':_0x42b96a['params']['id']}})['then'](handleEntityNotFound(_0x3e5440,null))[_0x3301('0xf')](saveUpdates(_0x42b96a['body'],null))['then'](respondWithResult(_0x3e5440,null))[_0x3301('0x2e')](handleError(_0x3e5440,null));};exports[_0x3301('0x10')]=function(_0x39807b,_0x123338){return db[_0x3301('0x16')][_0x3301('0x33')]({'where':{'id':_0x39807b[_0x3301('0x30')]['id']}})['then'](handleEntityNotFound(_0x123338,null))[_0x3301('0xf')](removeEntity(_0x123338,null))[_0x3301('0x2e')](handleError(_0x123338,null));};exports[_0x3301('0x34')]=function(_0x5c337f,_0x56634d){var _0x553f03={};var _0x4cea2f={};var _0x21ac9f;var _0x59f59c;return db[_0x3301('0x16')][_0x3301('0x35')]({'where':{'id':_0x5c337f['params']['id']}})[_0x3301('0xf')](handleEntityNotFound(_0x56634d,null))[_0x3301('0xf')](function(_0x26183c){if(_0x26183c){_0x21ac9f=_0x26183c;_0x4cea2f[_0x3301('0x1e')]=_[_0x3301('0x1a')](db['Dynamics365Configuration'][_0x3301('0x17')]);_0x4cea2f[_0x3301('0x1b')]=_['keys'](_0x5c337f[_0x3301('0x1b')]);_0x4cea2f[_0x3301('0x1c')]=_[_0x3301('0x1d')](_0x4cea2f[_0x3301('0x1e')],_0x4cea2f[_0x3301('0x1b')]);_0x553f03['attributes']=_['intersection'](_0x4cea2f['model'],qs[_0x3301('0x1f')](_0x5c337f[_0x3301('0x1b')][_0x3301('0x1f')]));_0x553f03[_0x3301('0x20')]=_0x553f03[_0x3301('0x20')]['length']?_0x553f03[_0x3301('0x20')]:_0x4cea2f['model'];_0x553f03['order']=qs[_0x3301('0x23')](_0x5c337f[_0x3301('0x1b')][_0x3301('0x23')]);_0x553f03[_0x3301('0x24')]=qs[_0x3301('0x1c')](_['pick'](_0x5c337f[_0x3301('0x1b')],_0x4cea2f[_0x3301('0x1c')]));if(_0x5c337f[_0x3301('0x1b')][_0x3301('0x25')]){_0x553f03['where']=_[_0x3301('0x26')](_0x553f03[_0x3301('0x24')],{'$or':_[_0x3301('0x19')](_0x553f03['attributes'],function(_0x55a775){var _0x15095d={};_0x15095d[_0x55a775]={'$like':'%'+_0x5c337f[_0x3301('0x1b')][_0x3301('0x25')]+'%'};return _0x15095d;})});}_0x553f03=_[_0x3301('0x26')]({},_0x553f03,_0x5c337f[_0x3301('0x29')]);return _0x21ac9f['getConfigurations'](_0x553f03);}})[_0x3301('0xf')](function(_0x6b5a31){if(_0x6b5a31){_0x59f59c=_0x6b5a31[_0x3301('0x21')];if(!_0x5c337f['query'][_0x3301('0x36')](_0x3301('0x37'))){_0x553f03[_0x3301('0xa')]=qs[_0x3301('0xa')](_0x5c337f[_0x3301('0x1b')]['limit']);_0x553f03[_0x3301('0x7')]=qs[_0x3301('0x7')](_0x5c337f[_0x3301('0x1b')]['offset']);}return _0x21ac9f[_0x3301('0x34')](_0x553f03);}})[_0x3301('0xf')](function(_0x42a4cb){if(_0x42a4cb){return _0x42a4cb?{'count':_0x59f59c,'rows':_0x42a4cb}:null;}})[_0x3301('0xf')](respondWithResult(_0x56634d,null))[_0x3301('0x2e')](handleError(_0x56634d,null));};exports['addConfiguration']=function(_0x3900e6,_0x1d27e6){if(_0x3900e6[_0x3301('0x32')]['id']){delete _0x3900e6[_0x3301('0x32')]['id'];}return db[_0x3301('0x16')][_0x3301('0x35')]({'where':{'id':_0x3900e6['params']['id']}})[_0x3301('0xf')](handleEntityNotFound(_0x1d27e6,null))[_0x3301('0xf')](function(_0x47cf5f){if(_0x47cf5f){_0x3900e6['body'][_0x3301('0x38')]=_0x47cf5f['id'];_0x3900e6[_0x3301('0x32')][_0x3301('0x39')]=integrations[_0x3301('0x3a')](_0x3900e6[_0x3301('0x32')][_0x3301('0x3b')],_0x3900e6[_0x3301('0x32')][_0x3301('0x27')]);_0x3900e6[_0x3301('0x32')][_0x3301('0x3c')]=integrations['getDescriptions'](_0x3900e6['body'][_0x3301('0x3b')],_0x3900e6['body'][_0x3301('0x27')]);return db['Dynamics365Configuration'][_0x3301('0x31')](_0x3900e6[_0x3301('0x32')],{'include':[{'model':db[_0x3301('0x3d')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x3301('0x3c')}]});}return null;})[_0x3301('0xf')](respondWithResult(_0x1d27e6,null))[_0x3301('0x2e')](handleError(_0x1d27e6,null));};function sanitizeRemoteUri(_0x52bc73){var _0x1c0590=_0x52bc73[_0x3301('0x3e')](-0x1);if(_0x1c0590==='/')return _0x52bc73[_0x3301('0x3f')](0x0,_0x52bc73[_0x3301('0x40')](_0x1c0590));return _0x52bc73;}function getWebApiUrl(_0x2152db){return util[_0x3301('0x41')]('%s/api/data/v9.0/',_0x2152db);}exports[_0x3301('0x42')]=function(_0x5009fa,_0xcaca24){var _0x4cfc54=_0x5009fa['query'][_0x3301('0x43')];var _0x30c157=_0x4cfc54===_0x3301('0x44')?_0x3301('0x45'):_0x3301('0x46');var _0x4bf2bb='';var _0x146d08='';var _0x18f1b9='';var _0xfc32d0='';var _0x4a9580='';var _0x151ecb='';var _0xe8b538='';var _0xaa9522='';var _0x100e49=[_0x3301('0x47'),_0x3301('0x48'),_0x3301('0x49'),_0x3301('0x4a'),_0x3301('0x4b'),_0x3301('0x4c'),_0x3301('0x4d'),'regardingobjectid',_0x3301('0x4e'),'phonecall_activity_parties'];var _0x6dd528=[_0x3301('0x4f'),'accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname',_0x3301('0x50'),_0x3301('0x51'),_0x3301('0x52'),_0x3301('0x53'),_0x3301('0x54'),'createdon',_0x3301('0x55'),_0x3301('0x56'),_0x3301('0x57'),_0x3301('0x58'),'customeridyominame',_0x3301('0x59'),_0x3301('0x5a'),_0x3301('0x5b'),_0x3301('0x5c'),'escalatedon',_0x3301('0x5d'),_0x3301('0x5e'),_0x3301('0x5f'),_0x3301('0x60'),_0x3301('0x61'),_0x3301('0x62'),'lastonholdtime',_0x3301('0x63'),_0x3301('0x64'),_0x3301('0x65'),_0x3301('0x66'),_0x3301('0x67'),'modifiedon',_0x3301('0x68'),_0x3301('0x69'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime',_0x3301('0x6a'),_0x3301('0x6b'),_0x3301('0x6c'),'owneridyominame',_0x3301('0x6d'),_0x3301('0x6e'),'primarycontactidyominame','prioritycodename',_0x3301('0x6f'),_0x3301('0x70'),_0x3301('0x71'),'resolvebykpiidname',_0x3301('0x72'),_0x3301('0x73'),_0x3301('0x74'),_0x3301('0x75'),_0x3301('0x76'),'slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber',_0x3301('0x77'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber'];var _0x1c4660=_0x100e49[_0x3301('0x78')](_0x6dd528);return db[_0x3301('0x16')]['findOne']({'where':{'id':_0x5009fa[_0x3301('0x30')]['id']},'attributes':['id',_0x3301('0x79'),_0x3301('0x7a'),_0x3301('0x7b'),'tenantId',_0x3301('0x7c'),_0x3301('0x7d'),_0x3301('0x7e')],'include':[{'model':db[_0x3301('0x7f')],'as':_0x3301('0x7f'),'attributes':['id','data5','data7']}]})[_0x3301('0xf')](handleEntityNotFound(_0xcaca24,null))[_0x3301('0xf')](function(_0x19a196){if(_0x19a196){if(_0x19a196[_0x3301('0x7e')]){_0x19a196['access_token']=_0x19a196[_0x3301('0x7f')]['data5'];_0xaa9522=sanitizeRemoteUri(_0x19a196['CloudProvider'][_0x3301('0x80')]);_0xe8b538=getWebApiUrl(_0xaa9522);return _0x19a196;}_0xaa9522=sanitizeRemoteUri(_0x19a196[_0x3301('0x7b')]);_0xe8b538=getWebApiUrl(_0xaa9522);var _0x56e000={'method':_0x3301('0x81'),'uri':_0x3301('0x82')+_0x19a196[_0x3301('0x83')]+_0x3301('0x84'),'form':{'client_id':_0x19a196['clientId'],'resource':_0xaa9522,'username':_0x19a196[_0x3301('0x79')],'password':_0x19a196[_0x3301('0x7a')],'grant_type':_0x3301('0x7a'),'client_secret':_0x19a196[_0x3301('0x7d')]},'json':!![]};return rp(_0x56e000);}})['then'](function(_0x3deb9c){_0x151ecb=_0x3deb9c[_0x3301('0x85')];var _0x145010={'method':_0x3301('0x86'),'uri':encodeURI(_0xe8b538+_0x3301('0x87')+_0x30c157+'\x27'),'headers':{'Authorization':_0x3301('0x88')+_0x151ecb,'If-None-Match':null,'OData-Version':_0x3301('0x89')},'json':!![]};return rp(_0x145010);})[_0x3301('0xf')](function(_0x55b4e6){var _0x383bcf=_0x55b4e6['value'][0x0];var _0xb2ae64=_0x383bcf[_0x3301('0x8a')];var _0x4104a8={'method':_0x3301('0x86'),'uri':_0xe8b538+_0x3301('0x8b')+_0xb2ae64+_0x3301('0x8c'),'headers':{'Authorization':'Bearer\x20'+_0x151ecb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4104a8);})['then'](function(_0x47e062){_0x4bf2bb=_0x47e062;_0x146d08=_0x4bf2bb[_0x3301('0x8d')];_0x146d08=_[_0x3301('0x8e')](_0x146d08,function(_0x4ac351){return!_0x1c4660['includes'](_0x4ac351['LogicalName']);});var _0x458e1f=[];var _0x414498=[];_0x146d08[_0x3301('0x8f')](function(_0xbb22b4){if(_0xbb22b4[_0x3301('0x90')]){var _0x199f62=_0xbb22b4[_0x3301('0x90')][_0x3301('0x3f')](_0xbb22b4[_0x3301('0x90')][_0x3301('0x40')]('.')+0x1);if(_0x199f62==='PicklistAttributeMetadata'){_0x458e1f['push'](getSelectList(_0xe8b538,_0x4cfc54,_0x414498,_0x4bf2bb[_0x3301('0x8a')],_0xbb22b4[_0x3301('0x8a')],_0x151ecb));}}});return Promise[_0x3301('0x91')](_0x458e1f);})[_0x3301('0xf')](function(_0x5c13a9){_0x18f1b9=_0x5c13a9[0x0];var _0x23e44a=[];var _0x499ca6=[];_0x146d08[_0x3301('0x8f')](function(_0xbfe4eb){if(!_[_0x3301('0x92')](_0xbfe4eb[_0x3301('0x90')])){var _0x3ec5a8=_0xbfe4eb[_0x3301('0x90')]['substring'](_0xbfe4eb['@odata.type'][_0x3301('0x40')]('.')+0x1);if(_0x3ec5a8==='BooleanAttributeMetadata'){_0x23e44a[_0x3301('0x93')](getBooleanList(_0xe8b538,_0x4cfc54,_0x499ca6,_0x4bf2bb[_0x3301('0x8a')],_0xbfe4eb[_0x3301('0x8a')],_0x151ecb));}}});return Promise[_0x3301('0x91')](_0x23e44a);})[_0x3301('0xf')](function(_0x5a30c8){_0xfc32d0=_0x5a30c8[0x0];var _0x3fcee7=[];var _0x57d602=[];_0x146d08[_0x3301('0x8f')](function(_0x41d1eb){if(_0x41d1eb[_0x3301('0x90')]){var _0x499662=_0x41d1eb[_0x3301('0x90')][_0x3301('0x3f')](_0x41d1eb['@odata.type'][_0x3301('0x40')]('.')+0x1);if(_0x499662===_0x3301('0x94')||_0x499662===_0x3301('0x95')||_0x499662===_0x3301('0x96')||_0x499662===_0x3301('0x97')||_0x499662===_0x3301('0x98')||_0x499662==='DateTimeAttributeMetadata'||_0x499662===_0x3301('0x99')||_0x499662===_0x3301('0x9a')||_0x499662===_0x3301('0x9b')||_0x499662===_0x3301('0x9c')){_0x3fcee7[_0x3301('0x93')](getInputList(_0xe8b538,_0x4cfc54,_0x499662,_0x57d602,_0x4bf2bb['MetadataId'],_0x41d1eb[_0x3301('0x8a')],_0x151ecb));}}});return Promise[_0x3301('0x91')](_0x3fcee7);})[_0x3301('0xf')](function(_0x66b78d){_0x4a9580=_0x66b78d[0x0];var _0x39d747=_0x18f1b9['concat'](_0xfc32d0)['concat'](_0x4a9580);var _0x40cc02={'count':_0x39d747[_0x3301('0x21')],'rows':_0x39d747};return _0x40cc02;})[_0x3301('0xf')](respondWithResult(_0xcaca24,null))['catch'](function(_0x191e59){var _0xe7432b=_0x5009fa[_0x3301('0x1b')][_0x3301('0x9d')]?0x1f4:_0x191e59[_0x3301('0x9e')]||0x1f4;logger['error'](_0x191e59[_0x3301('0x12')]);delete _0x191e59[_0x3301('0x13')];if(_0xe7432b===0x191){_0xe7432b=0x190;}_0xcaca24[_0x3301('0xb')](_0xe7432b)[_0x3301('0x14')](_0x5009fa[_0x3301('0x1b')][_0x3301('0x9d')]?{'message':'Wrong\x20credentials','statusCode':_0x191e59[_0x3301('0x9e')]}:_0x191e59);});};function getSelectList(_0x520fe2,_0x12ae12,_0x3a65e1,_0x44cc86,_0x3b6b7d,_0x3c8f85){var _0x5bee9a={'method':_0x3301('0x86'),'uri':_0x520fe2+_0x3301('0x8b')+_0x44cc86+_0x3301('0x9f')+_0x3b6b7d+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x3301('0x88')+_0x3c8f85,'If-None-Match':null,'OData-Version':_0x3301('0x89')},'json':!![]};return rp(_0x5bee9a)[_0x3301('0xf')](function(_0x92c2f7){var _0xac478=[];var _0x41b5bd=_0x92c2f7[_0x3301('0xa0')][_0x3301('0xa1')];_0x41b5bd['forEach'](function(_0x23feec){_0xac478[_0x3301('0x93')]({'name':_0x23feec[_0x3301('0xa2')][_0x3301('0xa3')][_0x3301('0xa2')],'value':String(_0x23feec[_0x3301('0xa4')])});});var _0x59dfe6={'id':_0x12ae12+'_'+_0x92c2f7[_0x3301('0xa5')],'name':_0x92c2f7['DisplayName'][_0x3301('0xa3')][_0x3301('0xa2')],'custom':![],'options':_0xac478};_0x3a65e1[_0x3301('0x93')](_0x59dfe6);return _0x3a65e1;});}function getBooleanList(_0x21d935,_0x2bea89,_0x42504b,_0xca6edf,_0x1f2508,_0x2bb935){var _0x277bae={'method':'GET','uri':_0x21d935+_0x3301('0x8b')+_0xca6edf+_0x3301('0x9f')+_0x1f2508+_0x3301('0xa6'),'headers':{'Authorization':'Bearer\x20'+_0x2bb935,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x277bae)[_0x3301('0xf')](function(_0x49108d){var _0x46c1a2=[];_0x46c1a2[_0x3301('0x93')]({'name':_0x49108d['OptionSet'][_0x3301('0xa7')]['Label'][_0x3301('0xa3')][_0x3301('0xa2')],'value':'true'},{'name':_0x49108d[_0x3301('0xa0')][_0x3301('0xa8')][_0x3301('0xa2')][_0x3301('0xa3')][_0x3301('0xa2')],'value':_0x3301('0xa9')});var _0x290a3d={'id':_0x2bea89+'_'+_0x49108d[_0x3301('0xa5')],'name':_0x49108d[_0x3301('0xaa')][_0x3301('0xa3')][_0x3301('0xa2')],'custom':![],'options':_0x46c1a2};_0x42504b[_0x3301('0x93')](_0x290a3d);return _0x42504b;});}function getInputList(_0x1c39ce,_0x419cd1,_0xc18d6d,_0x2250e3,_0x1a23c1,_0x44847c,_0x1b8c81){var _0xeafbd9={'method':_0x3301('0x86'),'uri':_0x1c39ce+_0x3301('0x8b')+_0x1a23c1+')/Attributes('+_0x44847c+')/Microsoft.Dynamics.CRM.'+_0xc18d6d+_0x3301('0xab'),'headers':{'Authorization':_0x3301('0x88')+_0x1b8c81,'If-None-Match':null,'OData-Version':_0x3301('0x89')},'json':!![]};return rp(_0xeafbd9)['then'](function(_0x76624c){var _0x14a935={'id':_0x419cd1+'_'+_0x76624c[_0x3301('0xa5')],'name':_0x76624c[_0x3301('0xaa')][_0x3301('0xa3')]?_0x76624c['DisplayName'][_0x3301('0xa3')]['Label']:_0x76624c[_0x3301('0xa5')],'custom':![],'options':[]};_0x2250e3[_0x3301('0x93')](_0x14a935);return _0x2250e3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e93ac67..d228ec0 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x29d0e0,_0x1bd476){var _0x169f96=function(_0x36a1a2){while(--_0x36a1a2){_0x29d0e0['push'](_0x29d0e0['shift']());}};_0x169f96(++_0x1bd476);}(_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'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x573d12,_0x534327){var _0x49e50a=function(_0x22619f){while(--_0x22619f){_0x573d12['push'](_0x573d12['shift']());}};_0x49e50a(++_0x534327);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xcb91[_0x548627];return _0x844a84;};'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 8d76653..b6032a8 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 _0x485a=['jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','raw','options','where','attributes','limit','include','map','model','info','ShowDynamics365Account','find','debug','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc2e451,_0x1e5681){var _0x3bc314=function(_0x48736d){while(--_0x48736d){_0xc2e451['push'](_0xc2e451['shift']());}};_0x3bc314(++_0x1e5681);}(_0x485a,0x1b4));var _0xa485=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x485a[_0xfb65aa];return _0x2aee31;};'use strict';var _=require(_0xa485('0x0'));var util=require('util');var moment=require(_0xa485('0x1'));var BPromise=require('bluebird');var rs=require(_0xa485('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa485('0x3'))['db'];var utils=require(_0xa485('0x4'));var logger=require(_0xa485('0x5'))(_0xa485('0x6'));var config=require(_0xa485('0x7'));var jayson=require(_0xa485('0x8'));var client=jayson[_0xa485('0x9')][_0xa485('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bfb5b,_0x1292cf,_0x2199d0){return new BPromise(function(_0x256dbb,_0xbdbd62){return client[_0xa485('0xb')](_0x4bfb5b,_0x2199d0)[_0xa485('0xc')](function(_0x1897be){logger['info'](_0xa485('0xd'),_0x1292cf,_0xa485('0xe'));logger['debug'](_0xa485('0xf'),_0x1292cf,_0xa485('0xe'),JSON[_0xa485('0x10')](_0x1897be));if(_0x1897be['error']){if(_0x1897be[_0xa485('0x11')][_0xa485('0x12')]===0x1f4){logger[_0xa485('0x11')](_0xa485('0xd'),_0x1292cf,_0x1897be[_0xa485('0x11')]['message']);return _0xbdbd62(_0x1897be[_0xa485('0x11')][_0xa485('0x13')]);}logger[_0xa485('0x11')](_0xa485('0xd'),_0x1292cf,_0x1897be[_0xa485('0x11')][_0xa485('0x13')]);return _0x256dbb(_0x1897be['error'][_0xa485('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x1292cf,_0xa485('0xe'));_0x256dbb(_0x1897be[_0xa485('0x14')][_0xa485('0x13')]);}})[_0xa485('0x15')](function(_0x5a62ba){logger[_0xa485('0x11')](_0xa485('0xd'),_0x1292cf,_0x5a62ba);_0xbdbd62(_0x5a62ba);});});}exports[_0xa485('0x16')]=function(_0x1e736a){var _0xf396e2=this;return new Promise(function(_0x49929c,_0x18e5f7){return db[_0xa485('0x17')][_0xa485('0x18')]({'raw':_0x1e736a['options']?_0x1e736a['options'][_0xa485('0x19')]===undefined?!![]:![]:!![],'where':_0x1e736a[_0xa485('0x1a')]?_0x1e736a[_0xa485('0x1a')][_0xa485('0x1b')]||null:null,'attributes':_0x1e736a['options']?_0x1e736a[_0xa485('0x1a')][_0xa485('0x1c')]||null:null,'limit':_0x1e736a['options']?_0x1e736a[_0xa485('0x1a')][_0xa485('0x1d')]||null:null,'include':_0x1e736a[_0xa485('0x1a')]?_0x1e736a['options'][_0xa485('0x1e')]?_[_0xa485('0x1f')](_0x1e736a['options']['include'],function(_0x240df1){return{'model':db[_0x240df1[_0xa485('0x20')]],'as':_0x240df1['as'],'attributes':_0x240df1[_0xa485('0x1c')],'include':_0x240df1['include']?_[_0xa485('0x1f')](_0x240df1[_0xa485('0x1e')],function(_0x4fe1c7){return{'model':db[_0x4fe1c7[_0xa485('0x20')]],'as':_0x4fe1c7['as'],'attributes':_0x4fe1c7[_0xa485('0x1c')],'include':_0x4fe1c7['include']?_['map'](_0x4fe1c7[_0xa485('0x1e')],function(_0x33b907){return{'model':db[_0x33b907[_0xa485('0x20')]],'as':_0x33b907['as'],'attributes':_0x33b907[_0xa485('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa485('0xc')](function(_0x57531d){logger[_0xa485('0x21')](_0xa485('0x16'),_0x1e736a);logger['debug'](_0xa485('0x16'),_0x1e736a,JSON['stringify'](_0x57531d));_0x49929c(_0x57531d);})['catch'](function(_0x312068){logger['error']('GetDynamics365Account',_0x312068[_0xa485('0x13')],_0x1e736a);_0x18e5f7(_0xf396e2[_0xa485('0x11')](0x1f4,_0x312068[_0xa485('0x13')]));});});};exports[_0xa485('0x22')]=function(_0x5c23ca){var _0x13a980=this;return new Promise(function(_0x3a6cf7,_0x12ebb9){return db['Dynamics365Account'][_0xa485('0x23')]({'raw':_0x5c23ca[_0xa485('0x1a')]?_0x5c23ca[_0xa485('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c23ca[_0xa485('0x1a')]?_0x5c23ca[_0xa485('0x1a')][_0xa485('0x1b')]||null:null,'attributes':_0x5c23ca['options']?_0x5c23ca['options'][_0xa485('0x1c')]||null:null,'include':_0x5c23ca[_0xa485('0x1a')]?_0x5c23ca['options'][_0xa485('0x1e')]?_[_0xa485('0x1f')](_0x5c23ca['options'][_0xa485('0x1e')],function(_0x546e8b){return{'model':db[_0x546e8b[_0xa485('0x20')]],'as':_0x546e8b['as'],'attributes':_0x546e8b[_0xa485('0x1c')],'include':_0x546e8b[_0xa485('0x1e')]?_[_0xa485('0x1f')](_0x546e8b['include'],function(_0x266862){return{'model':db[_0x266862[_0xa485('0x20')]],'as':_0x266862['as'],'attributes':_0x266862[_0xa485('0x1c')],'include':_0x266862['include']?_[_0xa485('0x1f')](_0x266862[_0xa485('0x1e')],function(_0x3faff6){return{'model':db[_0x3faff6[_0xa485('0x20')]],'as':_0x3faff6['as'],'attributes':_0x3faff6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4271c7){logger[_0xa485('0x21')](_0xa485('0x22'),_0x5c23ca);logger[_0xa485('0x24')](_0xa485('0x22'),_0x5c23ca,JSON[_0xa485('0x10')](_0x4271c7));_0x3a6cf7(_0x4271c7);})[_0xa485('0x15')](function(_0x347701){logger[_0xa485('0x11')](_0xa485('0x22'),_0x347701[_0xa485('0x13')],_0x5c23ca);_0x12ebb9(_0x13a980[_0xa485('0x11')](0x1f4,_0x347701[_0xa485('0x13')]));});});}; \ No newline at end of file +var _0x1bfd=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','model','map','GetDynamics365Account','ShowDynamics365Account','find','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x1e6c85,_0x59c747){var _0x16ec9b=function(_0xcdeb9e){while(--_0xcdeb9e){_0x1e6c85['push'](_0x1e6c85['shift']());}};_0x16ec9b(++_0x59c747);}(_0x1bfd,0x81));var _0xd1bf=function(_0x446301,_0x15b238){_0x446301=_0x446301-0x0;var _0x268e22=_0x1bfd[_0x446301];return _0x268e22;};'use strict';var _=require(_0xd1bf('0x0'));var util=require(_0xd1bf('0x1'));var moment=require(_0xd1bf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1bf('0x3'));var db=require(_0xd1bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1bf('0x5'))(_0xd1bf('0x6'));var config=require(_0xd1bf('0x7'));var jayson=require(_0xd1bf('0x8'));var client=jayson['client'][_0xd1bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c314b,_0x29f0b9,_0x3ce90c){return new BPromise(function(_0x5120f0,_0x4b35ff){return client[_0xd1bf('0xa')](_0x6c314b,_0x3ce90c)[_0xd1bf('0xb')](function(_0x5060be){logger[_0xd1bf('0xc')](_0xd1bf('0xd'),_0x29f0b9,_0xd1bf('0xe'));logger[_0xd1bf('0xf')](_0xd1bf('0x10'),_0x29f0b9,_0xd1bf('0xe'),JSON[_0xd1bf('0x11')](_0x5060be));if(_0x5060be['error']){if(_0x5060be[_0xd1bf('0x12')][_0xd1bf('0x13')]===0x1f4){logger[_0xd1bf('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x29f0b9,_0x5060be[_0xd1bf('0x12')][_0xd1bf('0x14')]);return _0x4b35ff(_0x5060be[_0xd1bf('0x12')][_0xd1bf('0x14')]);}logger[_0xd1bf('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x29f0b9,_0x5060be[_0xd1bf('0x12')][_0xd1bf('0x14')]);return _0x5120f0(_0x5060be[_0xd1bf('0x12')][_0xd1bf('0x14')]);}else{logger['info'](_0xd1bf('0xd'),_0x29f0b9,_0xd1bf('0xe'));_0x5120f0(_0x5060be[_0xd1bf('0x15')][_0xd1bf('0x14')]);}})[_0xd1bf('0x16')](function(_0xf3360d){logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x29f0b9,_0xf3360d);_0x4b35ff(_0xf3360d);});});}exports['GetDynamics365Account']=function(_0x1b8519){var _0x16331c=this;return new Promise(function(_0x38537e,_0x255040){return db[_0xd1bf('0x17')][_0xd1bf('0x18')]({'raw':_0x1b8519[_0xd1bf('0x19')]?_0x1b8519[_0xd1bf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1b8519[_0xd1bf('0x19')]?_0x1b8519[_0xd1bf('0x19')][_0xd1bf('0x1a')]||null:null,'attributes':_0x1b8519[_0xd1bf('0x19')]?_0x1b8519[_0xd1bf('0x19')][_0xd1bf('0x1b')]||null:null,'limit':_0x1b8519[_0xd1bf('0x19')]?_0x1b8519[_0xd1bf('0x19')][_0xd1bf('0x1c')]||null:null,'include':_0x1b8519[_0xd1bf('0x19')]?_0x1b8519[_0xd1bf('0x19')][_0xd1bf('0x1d')]?_['map'](_0x1b8519[_0xd1bf('0x19')][_0xd1bf('0x1d')],function(_0x2bdc13){return{'model':db[_0x2bdc13[_0xd1bf('0x1e')]],'as':_0x2bdc13['as'],'attributes':_0x2bdc13[_0xd1bf('0x1b')],'include':_0x2bdc13[_0xd1bf('0x1d')]?_[_0xd1bf('0x1f')](_0x2bdc13[_0xd1bf('0x1d')],function(_0x4b77b2){return{'model':db[_0x4b77b2[_0xd1bf('0x1e')]],'as':_0x4b77b2['as'],'attributes':_0x4b77b2[_0xd1bf('0x1b')],'include':_0x4b77b2[_0xd1bf('0x1d')]?_[_0xd1bf('0x1f')](_0x4b77b2['include'],function(_0x532a86){return{'model':db[_0x532a86['model']],'as':_0x532a86['as'],'attributes':_0x532a86[_0xd1bf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e704){logger[_0xd1bf('0xc')](_0xd1bf('0x20'),_0x1b8519);logger[_0xd1bf('0xf')](_0xd1bf('0x20'),_0x1b8519,JSON[_0xd1bf('0x11')](_0xd6e704));_0x38537e(_0xd6e704);})[_0xd1bf('0x16')](function(_0x195a68){logger['error']('GetDynamics365Account',_0x195a68[_0xd1bf('0x14')],_0x1b8519);_0x255040(_0x16331c['error'](0x1f4,_0x195a68['message']));});});};exports[_0xd1bf('0x21')]=function(_0x21ee3a){var _0x495b83=this;return new Promise(function(_0x2d5c6d,_0x4b69e1){return db[_0xd1bf('0x17')][_0xd1bf('0x22')]({'raw':_0x21ee3a[_0xd1bf('0x19')]?_0x21ee3a[_0xd1bf('0x19')][_0xd1bf('0x23')]===undefined?!![]:![]:!![],'where':_0x21ee3a[_0xd1bf('0x19')]?_0x21ee3a[_0xd1bf('0x19')][_0xd1bf('0x1a')]||null:null,'attributes':_0x21ee3a[_0xd1bf('0x19')]?_0x21ee3a[_0xd1bf('0x19')]['attributes']||null:null,'include':_0x21ee3a[_0xd1bf('0x19')]?_0x21ee3a[_0xd1bf('0x19')]['include']?_['map'](_0x21ee3a['options'][_0xd1bf('0x1d')],function(_0x266da5){return{'model':db[_0x266da5[_0xd1bf('0x1e')]],'as':_0x266da5['as'],'attributes':_0x266da5[_0xd1bf('0x1b')],'include':_0x266da5['include']?_[_0xd1bf('0x1f')](_0x266da5[_0xd1bf('0x1d')],function(_0x11c321){return{'model':db[_0x11c321[_0xd1bf('0x1e')]],'as':_0x11c321['as'],'attributes':_0x11c321[_0xd1bf('0x1b')],'include':_0x11c321['include']?_[_0xd1bf('0x1f')](_0x11c321[_0xd1bf('0x1d')],function(_0x533c47){return{'model':db[_0x533c47[_0xd1bf('0x1e')]],'as':_0x533c47['as'],'attributes':_0x533c47[_0xd1bf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd1bf('0xb')](function(_0x4ad270){logger[_0xd1bf('0xc')](_0xd1bf('0x21'),_0x21ee3a);logger[_0xd1bf('0xf')]('ShowDynamics365Account',_0x21ee3a,JSON[_0xd1bf('0x11')](_0x4ad270));_0x2d5c6d(_0x4ad270);})[_0xd1bf('0x16')](function(_0x5f26b4){logger[_0xd1bf('0x12')](_0xd1bf('0x21'),_0x5f26b4[_0xd1bf('0x14')],_0x21ee3a);_0x4b69e1(_0x495b83['error'](0x1f4,_0x5f26b4[_0xd1bf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4de211a..e46c505 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 _0xad6b=['./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0xad6b,0x159));var _0xbad6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xad6b[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xbad6('0x0'));var util=require(_0xbad6('0x1'));var path=require('path');var timeout=require(_0xbad6('0x2'));var express=require(_0xbad6('0x3'));var router=express[_0xbad6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbad6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbad6('0x6'));var controller=require(_0xbad6('0x7'));router[_0xbad6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbad6('0x8')](_0xbad6('0x9'),auth[_0xbad6('0xa')](),controller[_0xbad6('0xb')]);router[_0xbad6('0x8')]('/:id/fields',auth[_0xbad6('0xa')](),controller[_0xbad6('0xc')]);router[_0xbad6('0x8')](_0xbad6('0xd'),auth[_0xbad6('0xa')](),controller[_0xbad6('0xe')]);router[_0xbad6('0x8')](_0xbad6('0xf'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x10')]);router['post']('/',auth[_0xbad6('0xa')](),controller[_0xbad6('0x11')]);router[_0xbad6('0x12')](_0xbad6('0x9'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x13')]);router['delete'](_0xbad6('0x9'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x14')]);module[_0xbad6('0x15')]=router; \ No newline at end of file +var _0x8b38=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x32338b,_0x2a7f43){var _0x11b111=function(_0x4333da){while(--_0x4333da){_0x32338b['push'](_0x32338b['shift']());}};_0x11b111(++_0x2a7f43);}(_0x8b38,0x159));var _0x88b3=function(_0x7d5a8b,_0x2aedef){_0x7d5a8b=_0x7d5a8b-0x0;var _0x56ac46=_0x8b38[_0x7d5a8b];return _0x56ac46;};'use strict';var multer=require(_0x88b3('0x0'));var util=require(_0x88b3('0x1'));var path=require(_0x88b3('0x2'));var timeout=require(_0x88b3('0x3'));var express=require(_0x88b3('0x4'));var router=express['Router']();var fs_extra=require(_0x88b3('0x5'));var auth=require(_0x88b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x88b3('0x7'));var controller=require(_0x88b3('0x8'));router[_0x88b3('0x9')]('/',auth[_0x88b3('0xa')](),controller[_0x88b3('0xb')]);router[_0x88b3('0x9')](_0x88b3('0xc'),auth[_0x88b3('0xa')](),controller[_0x88b3('0xd')]);router['get'](_0x88b3('0xe'),auth[_0x88b3('0xa')](),controller[_0x88b3('0xf')]);router[_0x88b3('0x9')](_0x88b3('0x10'),auth[_0x88b3('0xa')](),controller['getSubjects']);router[_0x88b3('0x9')]('/:id/descriptions',auth[_0x88b3('0xa')](),controller[_0x88b3('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88b3('0x12')]);router['put'](_0x88b3('0xc'),auth['isAuthenticated'](),controller[_0x88b3('0x13')]);router[_0x88b3('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x88b3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c30c44c..934595f 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 _0x6e7c=['nothing','BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x1e4d9a,_0x145493){var _0x1a2d25=function(_0x26048d){while(--_0x26048d){_0x1e4d9a['push'](_0x1e4d9a['shift']());}};_0x1a2d25(++_0x145493);}(_0x6e7c,0x92));var _0xc6e7=function(_0xe274a3,_0x48dc31){_0xe274a3=_0xe274a3-0x0;var _0x18c49e=_0x6e7c[_0xe274a3];return _0x18c49e;};'use strict';var Sequelize=require(_0xc6e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6e7('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc6e7('0x2')](_0xc6e7('0x3'),'phonecall'),'defaultValue':_0xc6e7('0x3')},'moduleCreate':{'type':Sequelize[_0xc6e7('0x2')]('contact',_0xc6e7('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xc6e7('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4a04=['nothing','STRING','BOOLEAN','sequelize','exports','ENUM','incident','phonecall','contact'];(function(_0x2b04eb,_0x496171){var _0x1ec29b=function(_0x54480f){while(--_0x54480f){_0x2b04eb['push'](_0x2b04eb['shift']());}};_0x1ec29b(++_0x496171);}(_0x4a04,0x18f));var _0x44a0=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0x4a04[_0x212fcc];return _0x4d8190;};'use strict';var Sequelize=require(_0x44a0('0x0'));module[_0x44a0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x44a0('0x2')](_0x44a0('0x3'),_0x44a0('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x44a0('0x2')](_0x44a0('0x5'),_0x44a0('0x6')),'defaultValue':_0x44a0('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x44a0('0x7')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x44a0('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 65f02cb..168c869 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 _0xff29=['request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','findOne','Dynamics365Field','rawAttributes','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch'];(function(_0x539f31,_0x185cd2){var _0x33b2b4=function(_0xa53148){while(--_0xa53148){_0x539f31['push'](_0x539f31['shift']());}};_0x33b2b4(++_0x185cd2);}(_0xff29,0x145));var _0x9ff2=function(_0xb8ae57,_0x59b086){_0xb8ae57=_0xb8ae57-0x0;var _0x2758c1=_0xff29[_0xb8ae57];return _0x2758c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ff2('0x0'));var zipdir=require(_0x9ff2('0x1'));var jsonpatch=require(_0x9ff2('0x2'));var rp=require(_0x9ff2('0x3'));var moment=require(_0x9ff2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ff2('0x5'));var util=require('util');var path=require(_0x9ff2('0x6'));var sox=require(_0x9ff2('0x7'));var csv=require(_0x9ff2('0x8'));var ejs=require(_0x9ff2('0x9'));var fs=require('fs');var fs_extra=require(_0x9ff2('0xa'));var _=require('lodash');var squel=require(_0x9ff2('0xb'));var crypto=require(_0x9ff2('0xc'));var jsforce=require(_0x9ff2('0xd'));var deskjs=require(_0x9ff2('0xe'));var toCsv=require(_0x9ff2('0x8'));var querystring=require(_0x9ff2('0xf'));var Papa=require(_0x9ff2('0x10'));var Redis=require(_0x9ff2('0x11'));var authService=require(_0x9ff2('0x12'));var qs=require(_0x9ff2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ff2('0x14'))(_0x9ff2('0x15'));var utils=require(_0x9ff2('0x16'));var config=require(_0x9ff2('0x17'));var licenseUtil=require(_0x9ff2('0x18'));var db=require(_0x9ff2('0x19'))['db'];function respondWithStatusCode(_0x255757,_0x17603b){_0x17603b=_0x17603b||0xcc;return function(_0x581791){if(_0x581791){return _0x255757[_0x9ff2('0x1a')](_0x17603b);}return _0x255757[_0x9ff2('0x1b')](_0x17603b)[_0x9ff2('0x1c')]();};}function respondWithResult(_0x238263,_0x463ccf){_0x463ccf=_0x463ccf||0xc8;return function(_0x5c6a73){if(_0x5c6a73){return _0x238263[_0x9ff2('0x1b')](_0x463ccf)[_0x9ff2('0x1d')](_0x5c6a73);}};}function respondWithFilteredResult(_0x3e3523,_0x5b3ea4){return function(_0x37abea){if(_0x37abea){var _0x3086cd=typeof _0x5b3ea4[_0x9ff2('0x1e')]===_0x9ff2('0x1f')&&typeof _0x5b3ea4[_0x9ff2('0x20')]===_0x9ff2('0x1f');var _0x2b3603=_0x37abea[_0x9ff2('0x21')];var _0x17b320=_0x3086cd?0x0:_0x5b3ea4[_0x9ff2('0x1e')];var _0x50aab4=_0x3086cd?_0x37abea[_0x9ff2('0x21')]:_0x5b3ea4[_0x9ff2('0x1e')]+_0x5b3ea4['limit'];var _0x16bbf4;if(_0x50aab4>=_0x2b3603){_0x50aab4=_0x2b3603;_0x16bbf4=0xc8;}else{_0x16bbf4=0xce;}_0x3e3523[_0x9ff2('0x1b')](_0x16bbf4);return _0x3e3523[_0x9ff2('0x22')](_0x9ff2('0x23'),_0x17b320+'-'+_0x50aab4+'/'+_0x2b3603)['json'](_0x37abea);}return null;};}function patchUpdates(_0x3a38b8){return function(_0x133362){try{jsonpatch[_0x9ff2('0x24')](_0x133362,_0x3a38b8,!![]);}catch(_0xca8a6d){return BPromise[_0x9ff2('0x25')](_0xca8a6d);}return _0x133362[_0x9ff2('0x26')]();};}function saveUpdates(_0x25491e,_0x4f6596){return function(_0x5a595e){if(_0x5a595e){return _0x5a595e[_0x9ff2('0x27')](_0x25491e)[_0x9ff2('0x28')](function(_0x1183fd){return _0x1183fd;});}return null;};}function removeEntity(_0x3513a,_0x25f25c){return function(_0x3615c1){if(_0x3615c1){return _0x3615c1[_0x9ff2('0x29')]()[_0x9ff2('0x28')](function(){_0x3513a[_0x9ff2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2246b1,_0x28d84d){return function(_0x420e3e){if(!_0x420e3e){_0x2246b1[_0x9ff2('0x1a')](0x194);}return _0x420e3e;};}function handleError(_0x7ccfe3,_0x215726){_0x215726=_0x215726||0x1f4;return function(_0x43a300){logger[_0x9ff2('0x2a')](_0x43a300['stack']);if(_0x43a300['name']){delete _0x43a300[_0x9ff2('0x2b')];}_0x7ccfe3[_0x9ff2('0x1b')](_0x215726)['send'](_0x43a300);};}exports[_0x9ff2('0x2c')]=function(_0x52b10b,_0x37f2e0){var _0x8060c={},_0x21fe85={},_0x3eba94={'count':0x0,'rows':[]};var _0x5b5b54=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x9e2c61){return{'name':_0x9e2c61[_0x9ff2('0x2d')],'type':_0x9e2c61[_0x9ff2('0x2e')][_0x9ff2('0x2f')]};});_0x21fe85[_0x9ff2('0x30')]=_[_0x9ff2('0x31')](_0x5b5b54,'name');_0x21fe85['query']=_[_0x9ff2('0x32')](_0x52b10b[_0x9ff2('0x33')]);_0x21fe85['filters']=_['intersection'](_0x21fe85[_0x9ff2('0x30')],_0x21fe85['query']);_0x8060c[_0x9ff2('0x34')]=_['intersection'](_0x21fe85[_0x9ff2('0x30')],qs[_0x9ff2('0x35')](_0x52b10b[_0x9ff2('0x33')][_0x9ff2('0x35')]));_0x8060c[_0x9ff2('0x34')]=_0x8060c['attributes'][_0x9ff2('0x36')]?_0x8060c['attributes']:_0x21fe85[_0x9ff2('0x30')];if(!_0x52b10b[_0x9ff2('0x33')][_0x9ff2('0x37')](_0x9ff2('0x38'))){_0x8060c[_0x9ff2('0x20')]=qs[_0x9ff2('0x20')](_0x52b10b[_0x9ff2('0x33')][_0x9ff2('0x20')]);_0x8060c[_0x9ff2('0x1e')]=qs['offset'](_0x52b10b[_0x9ff2('0x33')][_0x9ff2('0x1e')]);}_0x8060c[_0x9ff2('0x39')]=qs[_0x9ff2('0x3a')](_0x52b10b[_0x9ff2('0x33')]['sort']);_0x8060c[_0x9ff2('0x3b')]=qs[_0x9ff2('0x3c')](_[_0x9ff2('0x3d')](_0x52b10b['query'],_0x21fe85[_0x9ff2('0x3c')]),_0x5b5b54);if(_0x52b10b['query'][_0x9ff2('0x3e')]){_0x8060c[_0x9ff2('0x3b')]=_[_0x9ff2('0x3f')](_0x8060c[_0x9ff2('0x3b')],{'$or':_[_0x9ff2('0x31')](_0x5b5b54,function(_0x4ef5e3){if(_0x4ef5e3['type']!=='VIRTUAL'){var _0x52e03e={};_0x52e03e[_0x4ef5e3[_0x9ff2('0x2b')]]={'$like':'%'+_0x52b10b[_0x9ff2('0x33')][_0x9ff2('0x3e')]+'%'};return _0x52e03e;}})});}_0x8060c=_[_0x9ff2('0x3f')]({},_0x8060c,_0x52b10b['options']);var _0x63aa84={'where':_0x8060c['where']};return db[_0x9ff2('0x40')][_0x9ff2('0x21')](_0x63aa84)[_0x9ff2('0x28')](function(_0x26991d){_0x3eba94[_0x9ff2('0x21')]=_0x26991d;if(_0x52b10b['query'][_0x9ff2('0x41')]){_0x8060c[_0x9ff2('0x42')]=[{'all':!![]}];}return db[_0x9ff2('0x40')][_0x9ff2('0x43')](_0x8060c);})[_0x9ff2('0x28')](function(_0x4c9940){_0x3eba94[_0x9ff2('0x44')]=_0x4c9940;return _0x3eba94;})[_0x9ff2('0x28')](respondWithFilteredResult(_0x37f2e0,_0x8060c))[_0x9ff2('0x45')](handleError(_0x37f2e0,null));};exports[_0x9ff2('0x46')]=function(_0x5b2bb0,_0x2653cb){var _0x5e6323={'raw':![],'where':{'id':_0x5b2bb0[_0x9ff2('0x47')]['id']}},_0x46d540={};_0x46d540[_0x9ff2('0x30')]=_[_0x9ff2('0x32')](db[_0x9ff2('0x40')]['rawAttributes']);_0x46d540['query']=_['keys'](_0x5b2bb0[_0x9ff2('0x33')]);_0x46d540[_0x9ff2('0x3c')]=_[_0x9ff2('0x48')](_0x46d540[_0x9ff2('0x30')],_0x46d540[_0x9ff2('0x33')]);_0x5e6323[_0x9ff2('0x34')]=_['intersection'](_0x46d540[_0x9ff2('0x30')],qs[_0x9ff2('0x35')](_0x5b2bb0[_0x9ff2('0x33')][_0x9ff2('0x35')]));_0x5e6323[_0x9ff2('0x34')]=_0x5e6323[_0x9ff2('0x34')][_0x9ff2('0x36')]?_0x5e6323['attributes']:_0x46d540[_0x9ff2('0x30')];if(_0x5b2bb0[_0x9ff2('0x33')]['includeAll']){_0x5e6323['include']=[{'all':!![]}];}_0x5e6323=_['merge']({},_0x5e6323,_0x5b2bb0['options']);return db[_0x9ff2('0x40')][_0x9ff2('0x49')](_0x5e6323)['then'](handleEntityNotFound(_0x2653cb,null))[_0x9ff2('0x28')](respondWithResult(_0x2653cb,null))[_0x9ff2('0x45')](handleError(_0x2653cb,null));};exports[_0x9ff2('0x4a')]=function(_0x244260,_0x55cb59){return db[_0x9ff2('0x40')][_0x9ff2('0x4a')](_0x244260[_0x9ff2('0x4b')],{})[_0x9ff2('0x28')](respondWithResult(_0x55cb59,0xc9))[_0x9ff2('0x45')](handleError(_0x55cb59,null));};exports[_0x9ff2('0x27')]=function(_0x106fcd,_0xa22e11){if(_0x106fcd[_0x9ff2('0x4b')]['id']){delete _0x106fcd[_0x9ff2('0x4b')]['id'];}return db[_0x9ff2('0x40')]['find']({'where':{'id':_0x106fcd[_0x9ff2('0x47')]['id']}})[_0x9ff2('0x28')](handleEntityNotFound(_0xa22e11,null))[_0x9ff2('0x28')](saveUpdates(_0x106fcd[_0x9ff2('0x4b')],null))[_0x9ff2('0x28')](respondWithResult(_0xa22e11,null))[_0x9ff2('0x45')](handleError(_0xa22e11,null));};exports[_0x9ff2('0x29')]=function(_0x13cba7,_0x8e3cab){return db['Dynamics365Configuration']['find']({'where':{'id':_0x13cba7[_0x9ff2('0x47')]['id']}})[_0x9ff2('0x28')](handleEntityNotFound(_0x8e3cab,null))['then'](removeEntity(_0x8e3cab,null))[_0x9ff2('0x45')](handleError(_0x8e3cab,null));};exports['getFields']=function(_0x399af8,_0x4da9e2,_0x3aafba){var _0x5accc0={};var _0x4ca158={};var _0x3f5cb6;var _0x351c0a;return db[_0x9ff2('0x40')][_0x9ff2('0x4c')]({'where':{'id':_0x399af8[_0x9ff2('0x47')]['id']}})[_0x9ff2('0x28')](handleEntityNotFound(_0x4da9e2,null))['then'](function(_0x1df5e4){if(_0x1df5e4){_0x3f5cb6=_0x1df5e4;_0x4ca158[_0x9ff2('0x30')]=_[_0x9ff2('0x32')](db[_0x9ff2('0x4d')][_0x9ff2('0x4e')]);_0x4ca158[_0x9ff2('0x33')]=_[_0x9ff2('0x32')](_0x399af8[_0x9ff2('0x33')]);_0x4ca158[_0x9ff2('0x3c')]=_[_0x9ff2('0x48')](_0x4ca158[_0x9ff2('0x30')],_0x4ca158[_0x9ff2('0x33')]);_0x5accc0[_0x9ff2('0x34')]=_[_0x9ff2('0x48')](_0x4ca158[_0x9ff2('0x30')],qs[_0x9ff2('0x35')](_0x399af8['query'][_0x9ff2('0x35')]));_0x5accc0['attributes']=_0x5accc0[_0x9ff2('0x34')][_0x9ff2('0x36')]?_0x5accc0[_0x9ff2('0x34')]:_0x4ca158['model'];_0x5accc0[_0x9ff2('0x39')]=qs[_0x9ff2('0x3a')](_0x399af8['query'][_0x9ff2('0x3a')]);_0x5accc0['where']=qs[_0x9ff2('0x3c')](_[_0x9ff2('0x3d')](_0x399af8[_0x9ff2('0x33')],_0x4ca158[_0x9ff2('0x3c')]));if(_0x399af8[_0x9ff2('0x33')][_0x9ff2('0x3e')]){_0x5accc0[_0x9ff2('0x3b')]=_[_0x9ff2('0x3f')](_0x5accc0[_0x9ff2('0x3b')],{'$or':_[_0x9ff2('0x31')](_0x5accc0[_0x9ff2('0x34')],function(_0x44a058){var _0x12b132={};_0x12b132[_0x44a058]={'$like':'%'+_0x399af8[_0x9ff2('0x33')][_0x9ff2('0x3e')]+'%'};return _0x12b132;})});}_0x5accc0=_['merge']({},_0x5accc0,_0x399af8[_0x9ff2('0x4f')]);return _0x3f5cb6['getFields'](_0x5accc0);}})['then'](function(_0x12fb6a){if(_0x12fb6a){_0x351c0a=_0x12fb6a['length'];if(!_0x399af8['query']['hasOwnProperty'](_0x9ff2('0x38'))){_0x5accc0[_0x9ff2('0x20')]=qs[_0x9ff2('0x20')](_0x399af8['query'][_0x9ff2('0x20')]);_0x5accc0[_0x9ff2('0x1e')]=qs[_0x9ff2('0x1e')](_0x399af8['query'][_0x9ff2('0x1e')]);}return _0x3f5cb6['getFields'](_0x5accc0);}})['then'](function(_0x3f36e3){if(_0x3f36e3){return _0x3f36e3?{'count':_0x351c0a,'rows':_0x3f36e3}:null;}})[_0x9ff2('0x28')](respondWithResult(_0x4da9e2,null))[_0x9ff2('0x45')](handleError(_0x4da9e2,null));};exports[_0x9ff2('0x50')]=function(_0x3ccf8e,_0x146d19,_0x48a210){var _0x4e0001={};var _0x5dc749={};var _0x252211;var _0x40d5db;return db['Dynamics365Configuration'][_0x9ff2('0x4c')]({'where':{'id':_0x3ccf8e[_0x9ff2('0x47')]['id']}})['then'](handleEntityNotFound(_0x146d19,null))[_0x9ff2('0x28')](function(_0x508e7c){if(_0x508e7c){_0x252211=_0x508e7c;_0x5dc749['model']=_[_0x9ff2('0x32')](db[_0x9ff2('0x4d')][_0x9ff2('0x4e')]);_0x5dc749['query']=_['keys'](_0x3ccf8e[_0x9ff2('0x33')]);_0x5dc749[_0x9ff2('0x3c')]=_['intersection'](_0x5dc749['model'],_0x5dc749[_0x9ff2('0x33')]);_0x4e0001['attributes']=_[_0x9ff2('0x48')](_0x5dc749[_0x9ff2('0x30')],qs[_0x9ff2('0x35')](_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x35')]));_0x4e0001['attributes']=_0x4e0001[_0x9ff2('0x34')][_0x9ff2('0x36')]?_0x4e0001['attributes']:_0x5dc749[_0x9ff2('0x30')];_0x4e0001['order']=qs[_0x9ff2('0x3a')](_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x3a')]);_0x4e0001[_0x9ff2('0x3b')]=qs['filters'](_[_0x9ff2('0x3d')](_0x3ccf8e[_0x9ff2('0x33')],_0x5dc749[_0x9ff2('0x3c')]));if(_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x3e')]){_0x4e0001['where']=_[_0x9ff2('0x3f')](_0x4e0001['where'],{'$or':_[_0x9ff2('0x31')](_0x4e0001['attributes'],function(_0x2fb557){var _0x281347={};_0x281347[_0x2fb557]={'$like':'%'+_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x3e')]+'%'};return _0x281347;})});}_0x4e0001=_[_0x9ff2('0x3f')]({},_0x4e0001,_0x3ccf8e[_0x9ff2('0x4f')]);return _0x252211[_0x9ff2('0x50')](_0x4e0001);}})['then'](function(_0x43fbef){if(_0x43fbef){_0x40d5db=_0x43fbef[_0x9ff2('0x36')];if(!_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x37')]('nolimit')){_0x4e0001[_0x9ff2('0x20')]=qs[_0x9ff2('0x20')](_0x3ccf8e['query'][_0x9ff2('0x20')]);_0x4e0001[_0x9ff2('0x1e')]=qs[_0x9ff2('0x1e')](_0x3ccf8e[_0x9ff2('0x33')][_0x9ff2('0x1e')]);}return _0x252211[_0x9ff2('0x50')](_0x4e0001);}})['then'](function(_0x56fcd2){if(_0x56fcd2){return _0x56fcd2?{'count':_0x40d5db,'rows':_0x56fcd2}:null;}})['then'](respondWithResult(_0x146d19,null))[_0x9ff2('0x45')](handleError(_0x146d19,null));};exports[_0x9ff2('0x51')]=function(_0xa467c3,_0x16bf37,_0x5d7fa5){var _0x53503c={};var _0x4c753d={};var _0xd3005d;var _0x121bf3;return db['Dynamics365Configuration'][_0x9ff2('0x4c')]({'where':{'id':_0xa467c3['params']['id']}})['then'](handleEntityNotFound(_0x16bf37,null))[_0x9ff2('0x28')](function(_0x358c42){if(_0x358c42){_0xd3005d=_0x358c42;_0x4c753d['model']=_[_0x9ff2('0x32')](db[_0x9ff2('0x4d')]['rawAttributes']);_0x4c753d[_0x9ff2('0x33')]=_['keys'](_0xa467c3[_0x9ff2('0x33')]);_0x4c753d[_0x9ff2('0x3c')]=_[_0x9ff2('0x48')](_0x4c753d['model'],_0x4c753d[_0x9ff2('0x33')]);_0x53503c[_0x9ff2('0x34')]=_[_0x9ff2('0x48')](_0x4c753d[_0x9ff2('0x30')],qs[_0x9ff2('0x35')](_0xa467c3[_0x9ff2('0x33')]['fields']));_0x53503c['attributes']=_0x53503c[_0x9ff2('0x34')][_0x9ff2('0x36')]?_0x53503c['attributes']:_0x4c753d[_0x9ff2('0x30')];_0x53503c[_0x9ff2('0x39')]=qs['sort'](_0xa467c3[_0x9ff2('0x33')][_0x9ff2('0x3a')]);_0x53503c[_0x9ff2('0x3b')]=qs['filters'](_[_0x9ff2('0x3d')](_0xa467c3[_0x9ff2('0x33')],_0x4c753d[_0x9ff2('0x3c')]));if(_0xa467c3[_0x9ff2('0x33')]['filter']){_0x53503c['where']=_[_0x9ff2('0x3f')](_0x53503c[_0x9ff2('0x3b')],{'$or':_[_0x9ff2('0x31')](_0x53503c[_0x9ff2('0x34')],function(_0x57fb99){var _0x3c3b7a={};_0x3c3b7a[_0x57fb99]={'$like':'%'+_0xa467c3[_0x9ff2('0x33')]['filter']+'%'};return _0x3c3b7a;})});}_0x53503c=_[_0x9ff2('0x3f')]({},_0x53503c,_0xa467c3[_0x9ff2('0x4f')]);return _0xd3005d['getDescriptions'](_0x53503c);}})[_0x9ff2('0x28')](function(_0x310f48){if(_0x310f48){_0x121bf3=_0x310f48['length'];if(!_0xa467c3[_0x9ff2('0x33')][_0x9ff2('0x37')](_0x9ff2('0x38'))){_0x53503c[_0x9ff2('0x20')]=qs[_0x9ff2('0x20')](_0xa467c3[_0x9ff2('0x33')][_0x9ff2('0x20')]);_0x53503c['offset']=qs['offset'](_0xa467c3[_0x9ff2('0x33')][_0x9ff2('0x1e')]);}return _0xd3005d[_0x9ff2('0x51')](_0x53503c);}})['then'](function(_0x49cf83){if(_0x49cf83){return _0x49cf83?{'count':_0x121bf3,'rows':_0x49cf83}:null;}})[_0x9ff2('0x28')](respondWithResult(_0x16bf37,null))[_0x9ff2('0x45')](handleError(_0x16bf37,null));}; \ No newline at end of file +var _0xdb9b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','Dynamics365Field','fields','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x31a62a,_0x42267b){var _0x4b3f27=function(_0x2f2cfe){while(--_0x2f2cfe){_0x31a62a['push'](_0x31a62a['shift']());}};_0x4b3f27(++_0x42267b);}(_0xdb9b,0x1c0));var _0xbdb9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdb9b[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xbdb9('0x0'));var rimraf=require(_0xbdb9('0x1'));var zipdir=require(_0xbdb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdb9('0x3'));var moment=require(_0xbdb9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbdb9('0x5'));var util=require(_0xbdb9('0x6'));var path=require(_0xbdb9('0x7'));var sox=require(_0xbdb9('0x8'));var csv=require(_0xbdb9('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(_0xbdb9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbdb9('0xb'));var toCsv=require(_0xbdb9('0x9'));var querystring=require('querystring');var Papa=require(_0xbdb9('0xc'));var Redis=require(_0xbdb9('0xd'));var authService=require(_0xbdb9('0xe'));var qs=require(_0xbdb9('0xf'));var as=require(_0xbdb9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdb9('0x11'))(_0xbdb9('0x12'));var utils=require(_0xbdb9('0x13'));var config=require(_0xbdb9('0x14'));var licenseUtil=require(_0xbdb9('0x15'));var db=require(_0xbdb9('0x16'))['db'];function respondWithStatusCode(_0x9142f5,_0xf85ba1){_0xf85ba1=_0xf85ba1||0xcc;return function(_0x2a23a2){if(_0x2a23a2){return _0x9142f5[_0xbdb9('0x17')](_0xf85ba1);}return _0x9142f5['status'](_0xf85ba1)[_0xbdb9('0x18')]();};}function respondWithResult(_0x186a80,_0x86d76a){_0x86d76a=_0x86d76a||0xc8;return function(_0x553327){if(_0x553327){return _0x186a80[_0xbdb9('0x19')](_0x86d76a)['json'](_0x553327);}};}function respondWithFilteredResult(_0x1e7919,_0x404fe4){return function(_0x46990d){if(_0x46990d){var _0x417ba2=typeof _0x404fe4[_0xbdb9('0x1a')]==='undefined'&&typeof _0x404fe4[_0xbdb9('0x1b')]===_0xbdb9('0x1c');var _0x35cdc1=_0x46990d[_0xbdb9('0x1d')];var _0x407adc=_0x417ba2?0x0:_0x404fe4['offset'];var _0x247aaf=_0x417ba2?_0x46990d[_0xbdb9('0x1d')]:_0x404fe4[_0xbdb9('0x1a')]+_0x404fe4[_0xbdb9('0x1b')];var _0xca5001;if(_0x247aaf>=_0x35cdc1){_0x247aaf=_0x35cdc1;_0xca5001=0xc8;}else{_0xca5001=0xce;}_0x1e7919[_0xbdb9('0x19')](_0xca5001);return _0x1e7919[_0xbdb9('0x1e')](_0xbdb9('0x1f'),_0x407adc+'-'+_0x247aaf+'/'+_0x35cdc1)[_0xbdb9('0x20')](_0x46990d);}return null;};}function patchUpdates(_0x3570ff){return function(_0x11e6d6){try{jsonpatch[_0xbdb9('0x21')](_0x11e6d6,_0x3570ff,!![]);}catch(_0x4a1ca6){return BPromise[_0xbdb9('0x22')](_0x4a1ca6);}return _0x11e6d6['save']();};}function saveUpdates(_0x9b53ab,_0x5c16fd){return function(_0x1b59b4){if(_0x1b59b4){return _0x1b59b4[_0xbdb9('0x23')](_0x9b53ab)[_0xbdb9('0x24')](function(_0x3e2913){return _0x3e2913;});}return null;};}function removeEntity(_0x5218a3,_0x8f3ac3){return function(_0x2777b4){if(_0x2777b4){return _0x2777b4['destroy']()[_0xbdb9('0x24')](function(){_0x5218a3['status'](0xcc)[_0xbdb9('0x18')]();});}};}function handleEntityNotFound(_0x21d13d,_0x28a1dc){return function(_0x53b755){if(!_0x53b755){_0x21d13d['sendStatus'](0x194);}return _0x53b755;};}function handleError(_0xcb0ca8,_0x58c16a){_0x58c16a=_0x58c16a||0x1f4;return function(_0x37658b){logger[_0xbdb9('0x25')](_0x37658b[_0xbdb9('0x26')]);if(_0x37658b[_0xbdb9('0x27')]){delete _0x37658b[_0xbdb9('0x27')];}_0xcb0ca8['status'](_0x58c16a)[_0xbdb9('0x28')](_0x37658b);};}exports['index']=function(_0x31193e,_0x1c720c){var _0x2d7b83={},_0x218e7c={},_0x390afa={'count':0x0,'rows':[]};var _0x3c4f11=_[_0xbdb9('0x29')](db[_0xbdb9('0x2a')][_0xbdb9('0x2b')],function(_0x3cb138){return{'name':_0x3cb138['fieldName'],'type':_0x3cb138[_0xbdb9('0x2c')][_0xbdb9('0x2d')]};});_0x218e7c[_0xbdb9('0x2e')]=_[_0xbdb9('0x29')](_0x3c4f11,_0xbdb9('0x27'));_0x218e7c[_0xbdb9('0x2f')]=_['keys'](_0x31193e[_0xbdb9('0x2f')]);_0x218e7c['filters']=_[_0xbdb9('0x30')](_0x218e7c[_0xbdb9('0x2e')],_0x218e7c[_0xbdb9('0x2f')]);_0x2d7b83[_0xbdb9('0x31')]=_[_0xbdb9('0x30')](_0x218e7c[_0xbdb9('0x2e')],qs['fields'](_0x31193e[_0xbdb9('0x2f')]['fields']));_0x2d7b83['attributes']=_0x2d7b83['attributes'][_0xbdb9('0x32')]?_0x2d7b83[_0xbdb9('0x31')]:_0x218e7c[_0xbdb9('0x2e')];if(!_0x31193e[_0xbdb9('0x2f')][_0xbdb9('0x33')](_0xbdb9('0x34'))){_0x2d7b83[_0xbdb9('0x1b')]=qs['limit'](_0x31193e[_0xbdb9('0x2f')][_0xbdb9('0x1b')]);_0x2d7b83[_0xbdb9('0x1a')]=qs[_0xbdb9('0x1a')](_0x31193e[_0xbdb9('0x2f')][_0xbdb9('0x1a')]);}_0x2d7b83[_0xbdb9('0x35')]=qs[_0xbdb9('0x36')](_0x31193e['query'][_0xbdb9('0x36')]);_0x2d7b83[_0xbdb9('0x37')]=qs[_0xbdb9('0x38')](_['pick'](_0x31193e[_0xbdb9('0x2f')],_0x218e7c[_0xbdb9('0x38')]),_0x3c4f11);if(_0x31193e[_0xbdb9('0x2f')][_0xbdb9('0x39')]){_0x2d7b83['where']=_[_0xbdb9('0x3a')](_0x2d7b83[_0xbdb9('0x37')],{'$or':_[_0xbdb9('0x29')](_0x3c4f11,function(_0x2d3fe0){if(_0x2d3fe0[_0xbdb9('0x2c')]!==_0xbdb9('0x3b')){var _0x1a6a96={};_0x1a6a96[_0x2d3fe0['name']]={'$like':'%'+_0x31193e['query'][_0xbdb9('0x39')]+'%'};return _0x1a6a96;}})});}_0x2d7b83=_[_0xbdb9('0x3a')]({},_0x2d7b83,_0x31193e[_0xbdb9('0x3c')]);var _0x379736={'where':_0x2d7b83[_0xbdb9('0x37')]};return db['Dynamics365Configuration']['count'](_0x379736)[_0xbdb9('0x24')](function(_0x237b2d){_0x390afa[_0xbdb9('0x1d')]=_0x237b2d;if(_0x31193e[_0xbdb9('0x2f')][_0xbdb9('0x3d')]){_0x2d7b83[_0xbdb9('0x3e')]=[{'all':!![]}];}return db[_0xbdb9('0x2a')]['findAll'](_0x2d7b83);})['then'](function(_0x332e74){_0x390afa[_0xbdb9('0x3f')]=_0x332e74;return _0x390afa;})[_0xbdb9('0x24')](respondWithFilteredResult(_0x1c720c,_0x2d7b83))[_0xbdb9('0x40')](handleError(_0x1c720c,null));};exports[_0xbdb9('0x41')]=function(_0x17f6b6,_0x217c31){var _0x3873f0={'raw':![],'where':{'id':_0x17f6b6[_0xbdb9('0x42')]['id']}},_0x549ddc={};_0x549ddc[_0xbdb9('0x2e')]=_[_0xbdb9('0x43')](db[_0xbdb9('0x2a')][_0xbdb9('0x2b')]);_0x549ddc[_0xbdb9('0x2f')]=_[_0xbdb9('0x43')](_0x17f6b6[_0xbdb9('0x2f')]);_0x549ddc['filters']=_[_0xbdb9('0x30')](_0x549ddc[_0xbdb9('0x2e')],_0x549ddc[_0xbdb9('0x2f')]);_0x3873f0['attributes']=_[_0xbdb9('0x30')](_0x549ddc['model'],qs['fields'](_0x17f6b6['query']['fields']));_0x3873f0[_0xbdb9('0x31')]=_0x3873f0[_0xbdb9('0x31')]['length']?_0x3873f0['attributes']:_0x549ddc[_0xbdb9('0x2e')];if(_0x17f6b6[_0xbdb9('0x2f')][_0xbdb9('0x3d')]){_0x3873f0[_0xbdb9('0x3e')]=[{'all':!![]}];}_0x3873f0=_[_0xbdb9('0x3a')]({},_0x3873f0,_0x17f6b6[_0xbdb9('0x3c')]);return db[_0xbdb9('0x2a')][_0xbdb9('0x44')](_0x3873f0)[_0xbdb9('0x24')](handleEntityNotFound(_0x217c31,null))[_0xbdb9('0x24')](respondWithResult(_0x217c31,null))[_0xbdb9('0x40')](handleError(_0x217c31,null));};exports[_0xbdb9('0x45')]=function(_0x3ed55d,_0x1452de){return db[_0xbdb9('0x2a')][_0xbdb9('0x45')](_0x3ed55d['body'],{})[_0xbdb9('0x24')](respondWithResult(_0x1452de,0xc9))[_0xbdb9('0x40')](handleError(_0x1452de,null));};exports['update']=function(_0x505559,_0x5cc0e3){if(_0x505559['body']['id']){delete _0x505559[_0xbdb9('0x46')]['id'];}return db[_0xbdb9('0x2a')][_0xbdb9('0x44')]({'where':{'id':_0x505559[_0xbdb9('0x42')]['id']}})[_0xbdb9('0x24')](handleEntityNotFound(_0x5cc0e3,null))['then'](saveUpdates(_0x505559[_0xbdb9('0x46')],null))[_0xbdb9('0x24')](respondWithResult(_0x5cc0e3,null))['catch'](handleError(_0x5cc0e3,null));};exports['destroy']=function(_0x27fd2a,_0x4d176b){return db['Dynamics365Configuration']['find']({'where':{'id':_0x27fd2a['params']['id']}})[_0xbdb9('0x24')](handleEntityNotFound(_0x4d176b,null))[_0xbdb9('0x24')](removeEntity(_0x4d176b,null))[_0xbdb9('0x40')](handleError(_0x4d176b,null));};exports['getFields']=function(_0x9c311,_0x19111a,_0x4ab31d){var _0x21c31d={};var _0x439847={};var _0xbe3000;var _0x12aad0;return db[_0xbdb9('0x2a')][_0xbdb9('0x47')]({'where':{'id':_0x9c311[_0xbdb9('0x42')]['id']}})[_0xbdb9('0x24')](handleEntityNotFound(_0x19111a,null))['then'](function(_0x45eb12){if(_0x45eb12){_0xbe3000=_0x45eb12;_0x439847[_0xbdb9('0x2e')]=_['keys'](db[_0xbdb9('0x48')][_0xbdb9('0x2b')]);_0x439847[_0xbdb9('0x2f')]=_[_0xbdb9('0x43')](_0x9c311[_0xbdb9('0x2f')]);_0x439847[_0xbdb9('0x38')]=_['intersection'](_0x439847[_0xbdb9('0x2e')],_0x439847['query']);_0x21c31d['attributes']=_[_0xbdb9('0x30')](_0x439847[_0xbdb9('0x2e')],qs[_0xbdb9('0x49')](_0x9c311[_0xbdb9('0x2f')]['fields']));_0x21c31d[_0xbdb9('0x31')]=_0x21c31d[_0xbdb9('0x31')]['length']?_0x21c31d[_0xbdb9('0x31')]:_0x439847[_0xbdb9('0x2e')];_0x21c31d[_0xbdb9('0x35')]=qs['sort'](_0x9c311[_0xbdb9('0x2f')]['sort']);_0x21c31d[_0xbdb9('0x37')]=qs[_0xbdb9('0x38')](_[_0xbdb9('0x4a')](_0x9c311['query'],_0x439847['filters']));if(_0x9c311[_0xbdb9('0x2f')][_0xbdb9('0x39')]){_0x21c31d['where']=_[_0xbdb9('0x3a')](_0x21c31d[_0xbdb9('0x37')],{'$or':_[_0xbdb9('0x29')](_0x21c31d[_0xbdb9('0x31')],function(_0x23cd64){var _0x441eb8={};_0x441eb8[_0x23cd64]={'$like':'%'+_0x9c311['query'][_0xbdb9('0x39')]+'%'};return _0x441eb8;})});}_0x21c31d=_['merge']({},_0x21c31d,_0x9c311['options']);return _0xbe3000[_0xbdb9('0x4b')](_0x21c31d);}})[_0xbdb9('0x24')](function(_0x4c9cc4){if(_0x4c9cc4){_0x12aad0=_0x4c9cc4[_0xbdb9('0x32')];if(!_0x9c311[_0xbdb9('0x2f')][_0xbdb9('0x33')](_0xbdb9('0x34'))){_0x21c31d[_0xbdb9('0x1b')]=qs['limit'](_0x9c311['query'][_0xbdb9('0x1b')]);_0x21c31d[_0xbdb9('0x1a')]=qs['offset'](_0x9c311[_0xbdb9('0x2f')][_0xbdb9('0x1a')]);}return _0xbe3000[_0xbdb9('0x4b')](_0x21c31d);}})['then'](function(_0x42a626){if(_0x42a626){return _0x42a626?{'count':_0x12aad0,'rows':_0x42a626}:null;}})[_0xbdb9('0x24')](respondWithResult(_0x19111a,null))[_0xbdb9('0x40')](handleError(_0x19111a,null));};exports[_0xbdb9('0x4c')]=function(_0x3bfee2,_0x4f6929,_0x10127f){var _0x4612dc={};var _0x7770bc={};var _0x5cbf22;var _0x25c0f9;return db[_0xbdb9('0x2a')][_0xbdb9('0x47')]({'where':{'id':_0x3bfee2['params']['id']}})[_0xbdb9('0x24')](handleEntityNotFound(_0x4f6929,null))['then'](function(_0x103906){if(_0x103906){_0x5cbf22=_0x103906;_0x7770bc[_0xbdb9('0x2e')]=_[_0xbdb9('0x43')](db[_0xbdb9('0x48')][_0xbdb9('0x2b')]);_0x7770bc[_0xbdb9('0x2f')]=_['keys'](_0x3bfee2[_0xbdb9('0x2f')]);_0x7770bc['filters']=_[_0xbdb9('0x30')](_0x7770bc[_0xbdb9('0x2e')],_0x7770bc['query']);_0x4612dc[_0xbdb9('0x31')]=_[_0xbdb9('0x30')](_0x7770bc[_0xbdb9('0x2e')],qs[_0xbdb9('0x49')](_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x49')]));_0x4612dc[_0xbdb9('0x31')]=_0x4612dc['attributes'][_0xbdb9('0x32')]?_0x4612dc[_0xbdb9('0x31')]:_0x7770bc[_0xbdb9('0x2e')];_0x4612dc['order']=qs[_0xbdb9('0x36')](_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x36')]);_0x4612dc[_0xbdb9('0x37')]=qs['filters'](_['pick'](_0x3bfee2[_0xbdb9('0x2f')],_0x7770bc['filters']));if(_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x39')]){_0x4612dc[_0xbdb9('0x37')]=_[_0xbdb9('0x3a')](_0x4612dc[_0xbdb9('0x37')],{'$or':_[_0xbdb9('0x29')](_0x4612dc[_0xbdb9('0x31')],function(_0x1daafc){var _0x32035f={};_0x32035f[_0x1daafc]={'$like':'%'+_0x3bfee2['query'][_0xbdb9('0x39')]+'%'};return _0x32035f;})});}_0x4612dc=_[_0xbdb9('0x3a')]({},_0x4612dc,_0x3bfee2['options']);return _0x5cbf22[_0xbdb9('0x4c')](_0x4612dc);}})[_0xbdb9('0x24')](function(_0x1ece23){if(_0x1ece23){_0x25c0f9=_0x1ece23['length'];if(!_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x33')]('nolimit')){_0x4612dc[_0xbdb9('0x1b')]=qs['limit'](_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x1b')]);_0x4612dc[_0xbdb9('0x1a')]=qs[_0xbdb9('0x1a')](_0x3bfee2[_0xbdb9('0x2f')][_0xbdb9('0x1a')]);}return _0x5cbf22[_0xbdb9('0x4c')](_0x4612dc);}})['then'](function(_0x34b908){if(_0x34b908){return _0x34b908?{'count':_0x25c0f9,'rows':_0x34b908}:null;}})[_0xbdb9('0x24')](respondWithResult(_0x4f6929,null))[_0xbdb9('0x40')](handleError(_0x4f6929,null));};exports[_0xbdb9('0x4d')]=function(_0x2cfabc,_0x2bca38,_0x19b104){var _0xe97855={};var _0x25c4ea={};var _0x5335fa;var _0x11b341;return db[_0xbdb9('0x2a')][_0xbdb9('0x47')]({'where':{'id':_0x2cfabc[_0xbdb9('0x42')]['id']}})['then'](handleEntityNotFound(_0x2bca38,null))[_0xbdb9('0x24')](function(_0x3a843a){if(_0x3a843a){_0x5335fa=_0x3a843a;_0x25c4ea[_0xbdb9('0x2e')]=_['keys'](db[_0xbdb9('0x48')][_0xbdb9('0x2b')]);_0x25c4ea[_0xbdb9('0x2f')]=_[_0xbdb9('0x43')](_0x2cfabc[_0xbdb9('0x2f')]);_0x25c4ea[_0xbdb9('0x38')]=_[_0xbdb9('0x30')](_0x25c4ea['model'],_0x25c4ea[_0xbdb9('0x2f')]);_0xe97855[_0xbdb9('0x31')]=_['intersection'](_0x25c4ea[_0xbdb9('0x2e')],qs[_0xbdb9('0x49')](_0x2cfabc[_0xbdb9('0x2f')]['fields']));_0xe97855['attributes']=_0xe97855[_0xbdb9('0x31')][_0xbdb9('0x32')]?_0xe97855[_0xbdb9('0x31')]:_0x25c4ea[_0xbdb9('0x2e')];_0xe97855[_0xbdb9('0x35')]=qs['sort'](_0x2cfabc['query'][_0xbdb9('0x36')]);_0xe97855[_0xbdb9('0x37')]=qs['filters'](_[_0xbdb9('0x4a')](_0x2cfabc[_0xbdb9('0x2f')],_0x25c4ea[_0xbdb9('0x38')]));if(_0x2cfabc[_0xbdb9('0x2f')]['filter']){_0xe97855['where']=_[_0xbdb9('0x3a')](_0xe97855[_0xbdb9('0x37')],{'$or':_[_0xbdb9('0x29')](_0xe97855[_0xbdb9('0x31')],function(_0x4a89d5){var _0x578a14={};_0x578a14[_0x4a89d5]={'$like':'%'+_0x2cfabc['query'][_0xbdb9('0x39')]+'%'};return _0x578a14;})});}_0xe97855=_[_0xbdb9('0x3a')]({},_0xe97855,_0x2cfabc[_0xbdb9('0x3c')]);return _0x5335fa[_0xbdb9('0x4d')](_0xe97855);}})[_0xbdb9('0x24')](function(_0x491b56){if(_0x491b56){_0x11b341=_0x491b56[_0xbdb9('0x32')];if(!_0x2cfabc['query'][_0xbdb9('0x33')](_0xbdb9('0x34'))){_0xe97855[_0xbdb9('0x1b')]=qs['limit'](_0x2cfabc[_0xbdb9('0x2f')][_0xbdb9('0x1b')]);_0xe97855[_0xbdb9('0x1a')]=qs['offset'](_0x2cfabc['query'][_0xbdb9('0x1a')]);}return _0x5335fa['getDescriptions'](_0xe97855);}})['then'](function(_0x50c6aa){if(_0x50c6aa){return _0x50c6aa?{'count':_0x11b341,'rows':_0x50c6aa}:null;}})['then'](respondWithResult(_0x2bca38,null))[_0xbdb9('0x40')](handleError(_0x2bca38,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1b48a31..fc0f8e1 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x2ff6e6,_0xa7317c){var _0x1a0ecc=function(_0x9dcbb3){while(--_0x9dcbb3){_0x2ff6e6['push'](_0x2ff6e6['shift']());}};_0x1a0ecc(++_0xa7317c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3a9875,_0x3b5e4f){_0x3a9875=_0x3a9875-0x0;var _0x593d43=_0x9bde[_0x3a9875];return _0x593d43;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3d3a98,_0x53e351){var _0x507c46=function(_0xeb28dc){while(--_0xeb28dc){_0x3d3a98['push'](_0x3d3a98['shift']());}};_0x507c46(++_0x53e351);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 44f6f66..1520144 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 _0x439c=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1bc90a,_0x579aa1){var _0x3a0f8c=function(_0x44b567){while(--_0x44b567){_0x1bc90a['push'](_0x1bc90a['shift']());}};_0x3a0f8c(++_0x579aa1);}(_0x439c,0x87));var _0xc439=function(_0x2d54d6,_0x3fa088){_0x2d54d6=_0x2d54d6-0x0;var _0x5b0f69=_0x439c[_0x2d54d6];return _0x5b0f69;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc439('0x0'));var rs=require(_0xc439('0x1'));var fs=require('fs');var Redis=require(_0xc439('0x2'));var db=require(_0xc439('0x3'))['db'];var utils=require(_0xc439('0x4'));var logger=require('../../config/logger')(_0xc439('0x5'));var config=require(_0xc439('0x6'));var jayson=require(_0xc439('0x7'));var client=jayson[_0xc439('0x8')][_0xc439('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517945,_0x5195ad,_0x447e93){return new BPromise(function(_0xfac479,_0x3c7472){return client['request'](_0x517945,_0x447e93)[_0xc439('0xa')](function(_0x34703c){logger[_0xc439('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5195ad,_0xc439('0xc'));logger[_0xc439('0xd')](_0xc439('0xe'),_0x5195ad,_0xc439('0xc'),JSON['stringify'](_0x34703c));if(_0x34703c[_0xc439('0xf')]){if(_0x34703c['error'][_0xc439('0x10')]===0x1f4){logger['error'](_0xc439('0x11'),_0x5195ad,_0x34703c[_0xc439('0xf')][_0xc439('0x12')]);return _0x3c7472(_0x34703c[_0xc439('0xf')][_0xc439('0x12')]);}logger['error'](_0xc439('0x11'),_0x5195ad,_0x34703c[_0xc439('0xf')][_0xc439('0x12')]);return _0xfac479(_0x34703c[_0xc439('0xf')][_0xc439('0x12')]);}else{logger[_0xc439('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5195ad,_0xc439('0xc'));_0xfac479(_0x34703c[_0xc439('0x13')]['message']);}})[_0xc439('0x14')](function(_0xae5681){logger[_0xc439('0xf')](_0xc439('0x11'),_0x5195ad,_0xae5681);_0x3c7472(_0xae5681);});});} \ No newline at end of file +var _0x6fdd=['../../config/logger','../../config/environment','jayson/promise','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','../../config/utils'];(function(_0x4414a7,_0x53182b){var _0x2e577e=function(_0xb96d5e){while(--_0xb96d5e){_0x4414a7['push'](_0x4414a7['shift']());}};_0x2e577e(++_0x53182b);}(_0x6fdd,0xa6));var _0xd6fd=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x6fdd[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0xd6fd('0x0'));var util=require(_0xd6fd('0x1'));var moment=require(_0xd6fd('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(_0xd6fd('0x3'));var logger=require(_0xd6fd('0x4'))('rpc');var config=require(_0xd6fd('0x5'));var jayson=require(_0xd6fd('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea612,_0x5028a8,_0x196408){return new BPromise(function(_0x30a042,_0xe3af4c){return client['request'](_0x3ea612,_0x196408)[_0xd6fd('0x7')](function(_0x16fbb8){logger['info'](_0xd6fd('0x8'),_0x5028a8,_0xd6fd('0x9'));logger[_0xd6fd('0xa')](_0xd6fd('0xb'),_0x5028a8,_0xd6fd('0x9'),JSON['stringify'](_0x16fbb8));if(_0x16fbb8['error']){if(_0x16fbb8[_0xd6fd('0xc')][_0xd6fd('0xd')]===0x1f4){logger['error'](_0xd6fd('0x8'),_0x5028a8,_0x16fbb8['error']['message']);return _0xe3af4c(_0x16fbb8[_0xd6fd('0xc')]['message']);}logger[_0xd6fd('0xc')](_0xd6fd('0x8'),_0x5028a8,_0x16fbb8['error'][_0xd6fd('0xe')]);return _0x30a042(_0x16fbb8[_0xd6fd('0xc')][_0xd6fd('0xe')]);}else{logger[_0xd6fd('0xf')](_0xd6fd('0x8'),_0x5028a8,_0xd6fd('0x9'));_0x30a042(_0x16fbb8['result'][_0xd6fd('0xe')]);}})[_0xd6fd('0x10')](function(_0x342253){logger[_0xd6fd('0xc')](_0xd6fd('0x8'),_0x5028a8,_0x342253);_0xe3af4c(_0x342253);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fec461c..9060f0c 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 _0x6695=['create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x38079f,_0x17bb1e){var _0x3086a5=function(_0x53fb96){while(--_0x53fb96){_0x38079f['push'](_0x38079f['shift']());}};_0x3086a5(++_0x17bb1e);}(_0x6695,0xd8));var _0x5669=function(_0x18205e,_0x47323c){_0x18205e=_0x18205e-0x0;var _0x19cea9=_0x6695[_0x18205e];return _0x19cea9;};'use strict';var multer=require('multer');var util=require(_0x5669('0x0'));var path=require(_0x5669('0x1'));var timeout=require(_0x5669('0x2'));var express=require('express');var router=express[_0x5669('0x3')]();var fs_extra=require(_0x5669('0x4'));var auth=require(_0x5669('0x5'));var interaction=require(_0x5669('0x6'));var config=require(_0x5669('0x7'));var controller=require(_0x5669('0x8'));router['get']('/',auth[_0x5669('0x9')](),controller[_0x5669('0xa')]);router[_0x5669('0xb')](_0x5669('0xc'),auth['isAuthenticated'](),controller[_0x5669('0xd')]);router[_0x5669('0xe')]('/',auth[_0x5669('0x9')](),controller[_0x5669('0xf')]);router[_0x5669('0x10')](_0x5669('0xc'),auth[_0x5669('0x9')](),controller[_0x5669('0x11')]);router[_0x5669('0x12')](_0x5669('0xc'),auth['isAuthenticated'](),controller[_0x5669('0x13')]);module[_0x5669('0x14')]=router; \ No newline at end of file +var _0x1b9e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x1b9e,0xe5));var _0xe1b9=function(_0x396820,_0x491af1){_0x396820=_0x396820-0x0;var _0x166c0c=_0x1b9e[_0x396820];return _0x166c0c;};'use strict';var multer=require('multer');var util=require(_0xe1b9('0x0'));var path=require(_0xe1b9('0x1'));var timeout=require(_0xe1b9('0x2'));var express=require(_0xe1b9('0x3'));var router=express[_0xe1b9('0x4')]();var fs_extra=require(_0xe1b9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe1b9('0x6'));var config=require(_0xe1b9('0x7'));var controller=require(_0xe1b9('0x8'));router[_0xe1b9('0x9')]('/',auth[_0xe1b9('0xa')](),controller[_0xe1b9('0xb')]);router[_0xe1b9('0x9')](_0xe1b9('0xc'),auth[_0xe1b9('0xa')](),controller['show']);router[_0xe1b9('0xd')]('/',auth['isAuthenticated'](),controller[_0xe1b9('0xe')]);router[_0xe1b9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe1b9('0x10')]);router['delete']('/:id',auth[_0xe1b9('0xa')](),controller[_0xe1b9('0x11')]);module[_0xe1b9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 6469818..c718673 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 _0xcfe6=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','customVariable','keyValue'];(function(_0x41d6eb,_0x100ceb){var _0x64d1cb=function(_0x184758){while(--_0x184758){_0x41d6eb['push'](_0x41d6eb['shift']());}};_0x64d1cb(++_0x100ceb);}(_0xcfe6,0x18c));var _0x6cfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfe6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6cfe('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6cfe('0x1'),'variable',_0x6cfe('0x2'),_0x6cfe('0x3'),_0x6cfe('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6cfe('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6cfe('0x6')](_0x6cfe('0x1'),'variable',_0x6cfe('0x2'))},'keyContent':{'type':Sequelize[_0x6cfe('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6cfe('0x5')]},'customField':{'type':Sequelize[_0x6cfe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6cfe('0x5')]}}; \ No newline at end of file +var _0x67fa=['keyValue','picklist','STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x67fa,0x1f4));var _0xa67f=function(_0x4bf305,_0x1fd853){_0x4bf305=_0x4bf305-0x0;var _0x485339=_0x67fa[_0x4bf305];return _0x485339;};'use strict';var Sequelize=require(_0xa67f('0x0'));module[_0xa67f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa67f('0x2'),'variable',_0xa67f('0x3'),_0xa67f('0x4'),_0xa67f('0x5')),'defaultValue':_0xa67f('0x2')},'content':{'type':Sequelize[_0xa67f('0x6')]},'key':{'type':Sequelize[_0xa67f('0x6')]},'keyType':{'type':Sequelize[_0xa67f('0x7')]('string',_0xa67f('0x8'),_0xa67f('0x3'))},'keyContent':{'type':Sequelize[_0xa67f('0x6')]},'idField':{'type':Sequelize[_0xa67f('0x6')]},'nameField':{'type':Sequelize[_0xa67f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa67f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5f4b0fb..ef53d02 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 _0x670a=['create','body','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','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','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','params','rawAttributes','include','options','find'];(function(_0x5b6553,_0x2526c4){var _0x5c9e87=function(_0x2ac608){while(--_0x2ac608){_0x5b6553['push'](_0x5b6553['shift']());}};_0x5c9e87(++_0x2526c4);}(_0x670a,0xe3));var _0xa670=function(_0x55dcc3,_0x1839bb){_0x55dcc3=_0x55dcc3-0x0;var _0x37be1c=_0x670a[_0x55dcc3];return _0x37be1c;};'use strict';var emlformat=require(_0xa670('0x0'));var rimraf=require(_0xa670('0x1'));var zipdir=require(_0xa670('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa670('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa670('0x4'));var util=require('util');var path=require(_0xa670('0x5'));var sox=require(_0xa670('0x6'));var csv=require(_0xa670('0x7'));var ejs=require(_0xa670('0x8'));var fs=require('fs');var fs_extra=require(_0xa670('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa670('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa670('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa670('0xc'));var Papa=require(_0xa670('0xd'));var Redis=require(_0xa670('0xe'));var authService=require(_0xa670('0xf'));var qs=require(_0xa670('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa670('0x11'));var logger=require(_0xa670('0x12'))(_0xa670('0x13'));var utils=require(_0xa670('0x14'));var config=require(_0xa670('0x15'));var licenseUtil=require(_0xa670('0x16'));var db=require(_0xa670('0x17'))['db'];function respondWithStatusCode(_0x351f7d,_0x416166){_0x416166=_0x416166||0xcc;return function(_0x5c9e40){if(_0x5c9e40){return _0x351f7d[_0xa670('0x18')](_0x416166);}return _0x351f7d[_0xa670('0x19')](_0x416166)[_0xa670('0x1a')]();};}function respondWithResult(_0x2461dd,_0x1fe33b){_0x1fe33b=_0x1fe33b||0xc8;return function(_0xcd2036){if(_0xcd2036){return _0x2461dd[_0xa670('0x19')](_0x1fe33b)[_0xa670('0x1b')](_0xcd2036);}};}function respondWithFilteredResult(_0x5e283d,_0x578f29){return function(_0x2ef7fe){if(_0x2ef7fe){var _0x344995=typeof _0x578f29[_0xa670('0x1c')]===_0xa670('0x1d')&&typeof _0x578f29[_0xa670('0x1e')]===_0xa670('0x1d');var _0x3d2e47=_0x2ef7fe['count'];var _0x3573e9=_0x344995?0x0:_0x578f29[_0xa670('0x1c')];var _0x3f5177=_0x344995?_0x2ef7fe[_0xa670('0x1f')]:_0x578f29[_0xa670('0x1c')]+_0x578f29[_0xa670('0x1e')];var _0x4cb003;if(_0x3f5177>=_0x3d2e47){_0x3f5177=_0x3d2e47;_0x4cb003=0xc8;}else{_0x4cb003=0xce;}_0x5e283d['status'](_0x4cb003);return _0x5e283d[_0xa670('0x20')](_0xa670('0x21'),_0x3573e9+'-'+_0x3f5177+'/'+_0x3d2e47)[_0xa670('0x1b')](_0x2ef7fe);}return null;};}function patchUpdates(_0x46b161){return function(_0x494fc7){try{jsonpatch[_0xa670('0x22')](_0x494fc7,_0x46b161,!![]);}catch(_0x273e2e){return BPromise['reject'](_0x273e2e);}return _0x494fc7['save']();};}function saveUpdates(_0x3dfe2a,_0x20449b){return function(_0x5822a5){if(_0x5822a5){return _0x5822a5[_0xa670('0x23')](_0x3dfe2a)[_0xa670('0x24')](function(_0x5d5fb0){return _0x5d5fb0;});}return null;};}function removeEntity(_0x52ba93,_0x219fc1){return function(_0x1f6a42){if(_0x1f6a42){return _0x1f6a42[_0xa670('0x25')]()[_0xa670('0x24')](function(){_0x52ba93['status'](0xcc)[_0xa670('0x1a')]();});}};}function handleEntityNotFound(_0x18e51b,_0x388997){return function(_0x27861b){if(!_0x27861b){_0x18e51b['sendStatus'](0x194);}return _0x27861b;};}function handleError(_0x359923,_0x539728){_0x539728=_0x539728||0x1f4;return function(_0x4b5f52){logger[_0xa670('0x26')](_0x4b5f52[_0xa670('0x27')]);if(_0x4b5f52['name']){delete _0x4b5f52[_0xa670('0x28')];}_0x359923[_0xa670('0x19')](_0x539728)[_0xa670('0x29')](_0x4b5f52);};}exports[_0xa670('0x2a')]=function(_0x4503ba,_0x5d5361){var _0x3b4d4e={},_0xddca07={},_0x22da3f={'count':0x0,'rows':[]};var _0x4f7790=_[_0xa670('0x2b')](db[_0xa670('0x2c')]['rawAttributes'],function(_0x295c4f){return{'name':_0x295c4f[_0xa670('0x2d')],'type':_0x295c4f[_0xa670('0x2e')][_0xa670('0x2f')]};});_0xddca07[_0xa670('0x30')]=_['map'](_0x4f7790,'name');_0xddca07[_0xa670('0x31')]=_[_0xa670('0x32')](_0x4503ba['query']);_0xddca07['filters']=_[_0xa670('0x33')](_0xddca07['model'],_0xddca07['query']);_0x3b4d4e['attributes']=_[_0xa670('0x33')](_0xddca07[_0xa670('0x30')],qs['fields'](_0x4503ba[_0xa670('0x31')][_0xa670('0x34')]));_0x3b4d4e[_0xa670('0x35')]=_0x3b4d4e['attributes'][_0xa670('0x36')]?_0x3b4d4e[_0xa670('0x35')]:_0xddca07[_0xa670('0x30')];if(!_0x4503ba[_0xa670('0x31')][_0xa670('0x37')](_0xa670('0x38'))){_0x3b4d4e['limit']=qs[_0xa670('0x1e')](_0x4503ba[_0xa670('0x31')]['limit']);_0x3b4d4e[_0xa670('0x1c')]=qs[_0xa670('0x1c')](_0x4503ba['query']['offset']);}_0x3b4d4e[_0xa670('0x39')]=qs[_0xa670('0x3a')](_0x4503ba[_0xa670('0x31')][_0xa670('0x3a')]);_0x3b4d4e[_0xa670('0x3b')]=qs[_0xa670('0x3c')](_[_0xa670('0x3d')](_0x4503ba[_0xa670('0x31')],_0xddca07['filters']),_0x4f7790);if(_0x4503ba[_0xa670('0x31')][_0xa670('0x3e')]){_0x3b4d4e[_0xa670('0x3b')]=_[_0xa670('0x3f')](_0x3b4d4e[_0xa670('0x3b')],{'$or':_[_0xa670('0x2b')](_0x4f7790,function(_0x534f58){if(_0x534f58[_0xa670('0x2e')]!=='VIRTUAL'){var _0x340962={};_0x340962[_0x534f58[_0xa670('0x28')]]={'$like':'%'+_0x4503ba[_0xa670('0x31')]['filter']+'%'};return _0x340962;}})});}_0x3b4d4e=_['merge']({},_0x3b4d4e,_0x4503ba['options']);var _0x2970c5={'where':_0x3b4d4e['where']};return db[_0xa670('0x2c')][_0xa670('0x1f')](_0x2970c5)['then'](function(_0x4d8eb6){_0x22da3f[_0xa670('0x1f')]=_0x4d8eb6;if(_0x4503ba[_0xa670('0x31')][_0xa670('0x40')]){_0x3b4d4e['include']=[{'all':!![]}];}return db[_0xa670('0x2c')][_0xa670('0x41')](_0x3b4d4e);})[_0xa670('0x24')](function(_0x5f27a9){_0x22da3f[_0xa670('0x42')]=_0x5f27a9;return _0x22da3f;})[_0xa670('0x24')](respondWithFilteredResult(_0x5d5361,_0x3b4d4e))[_0xa670('0x43')](handleError(_0x5d5361,null));};exports['show']=function(_0x854dac,_0x1b8f5c){var _0x51c64d={'raw':!![],'where':{'id':_0x854dac[_0xa670('0x44')]['id']}},_0xffdaf5={};_0xffdaf5[_0xa670('0x30')]=_[_0xa670('0x32')](db[_0xa670('0x2c')][_0xa670('0x45')]);_0xffdaf5['query']=_[_0xa670('0x32')](_0x854dac[_0xa670('0x31')]);_0xffdaf5[_0xa670('0x3c')]=_[_0xa670('0x33')](_0xffdaf5[_0xa670('0x30')],_0xffdaf5[_0xa670('0x31')]);_0x51c64d[_0xa670('0x35')]=_[_0xa670('0x33')](_0xffdaf5[_0xa670('0x30')],qs[_0xa670('0x34')](_0x854dac['query'][_0xa670('0x34')]));_0x51c64d[_0xa670('0x35')]=_0x51c64d[_0xa670('0x35')][_0xa670('0x36')]?_0x51c64d[_0xa670('0x35')]:_0xffdaf5['model'];if(_0x854dac[_0xa670('0x31')][_0xa670('0x40')]){_0x51c64d[_0xa670('0x46')]=[{'all':!![]}];}_0x51c64d=_['merge']({},_0x51c64d,_0x854dac[_0xa670('0x47')]);return db[_0xa670('0x2c')][_0xa670('0x48')](_0x51c64d)[_0xa670('0x24')](handleEntityNotFound(_0x1b8f5c,null))[_0xa670('0x24')](respondWithResult(_0x1b8f5c,null))[_0xa670('0x43')](handleError(_0x1b8f5c,null));};exports[_0xa670('0x49')]=function(_0x33eb47,_0xbaaf62){return db[_0xa670('0x2c')][_0xa670('0x49')](_0x33eb47[_0xa670('0x4a')],{})[_0xa670('0x24')](respondWithResult(_0xbaaf62,0xc9))['catch'](handleError(_0xbaaf62,null));};exports['update']=function(_0x12146f,_0x236f92){if(_0x12146f[_0xa670('0x4a')]['id']){delete _0x12146f[_0xa670('0x4a')]['id'];}return db[_0xa670('0x2c')][_0xa670('0x48')]({'where':{'id':_0x12146f['params']['id']}})[_0xa670('0x24')](handleEntityNotFound(_0x236f92,null))[_0xa670('0x24')](saveUpdates(_0x12146f[_0xa670('0x4a')],null))[_0xa670('0x24')](respondWithResult(_0x236f92,null))[_0xa670('0x43')](handleError(_0x236f92,null));};exports[_0xa670('0x25')]=function(_0x4d13b0,_0x16e7c1){return db['Dynamics365Field'][_0xa670('0x48')]({'where':{'id':_0x4d13b0[_0xa670('0x44')]['id']}})[_0xa670('0x24')](handleEntityNotFound(_0x16e7c1,null))[_0xa670('0x24')](removeEntity(_0x16e7c1,null))[_0xa670('0x43')](handleError(_0x16e7c1,null));}; \ No newline at end of file +var _0xbfd4=['mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2dd7fb,_0x392468){var _0xe45080=function(_0x134063){while(--_0x134063){_0x2dd7fb['push'](_0x2dd7fb['shift']());}};_0xe45080(++_0x392468);}(_0xbfd4,0xe5));var _0x4bfd=function(_0x35b74a,_0x42d678){_0x35b74a=_0x35b74a-0x0;var _0xe06332=_0xbfd4[_0x35b74a];return _0xe06332;};'use strict';var emlformat=require(_0x4bfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bfd('0x1'));var jsonpatch=require(_0x4bfd('0x2'));var rp=require('request-promise');var moment=require(_0x4bfd('0x3'));var BPromise=require(_0x4bfd('0x4'));var Mustache=require(_0x4bfd('0x5'));var util=require(_0x4bfd('0x6'));var path=require(_0x4bfd('0x7'));var sox=require(_0x4bfd('0x8'));var csv=require(_0x4bfd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bfd('0xa'));var _=require(_0x4bfd('0xb'));var squel=require(_0x4bfd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4bfd('0xd'));var toCsv=require(_0x4bfd('0x9'));var querystring=require(_0x4bfd('0xe'));var Papa=require(_0x4bfd('0xf'));var Redis=require(_0x4bfd('0x10'));var authService=require(_0x4bfd('0x11'));var qs=require(_0x4bfd('0x12'));var as=require(_0x4bfd('0x13'));var hardwareService=require(_0x4bfd('0x14'));var logger=require(_0x4bfd('0x15'))('api');var utils=require(_0x4bfd('0x16'));var config=require(_0x4bfd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21e325,_0x4b76d2){_0x4b76d2=_0x4b76d2||0xcc;return function(_0x48048d){if(_0x48048d){return _0x21e325[_0x4bfd('0x18')](_0x4b76d2);}return _0x21e325['status'](_0x4b76d2)['end']();};}function respondWithResult(_0x46d7bf,_0x7bb2b0){_0x7bb2b0=_0x7bb2b0||0xc8;return function(_0x234ac3){if(_0x234ac3){return _0x46d7bf[_0x4bfd('0x19')](_0x7bb2b0)[_0x4bfd('0x1a')](_0x234ac3);}};}function respondWithFilteredResult(_0x19395c,_0x12bb87){return function(_0x267724){if(_0x267724){var _0xdf3a98=typeof _0x12bb87[_0x4bfd('0x1b')]===_0x4bfd('0x1c')&&typeof _0x12bb87['limit']===_0x4bfd('0x1c');var _0x103127=_0x267724['count'];var _0x538016=_0xdf3a98?0x0:_0x12bb87[_0x4bfd('0x1b')];var _0x492837=_0xdf3a98?_0x267724[_0x4bfd('0x1d')]:_0x12bb87[_0x4bfd('0x1b')]+_0x12bb87['limit'];var _0x26a8bf;if(_0x492837>=_0x103127){_0x492837=_0x103127;_0x26a8bf=0xc8;}else{_0x26a8bf=0xce;}_0x19395c[_0x4bfd('0x19')](_0x26a8bf);return _0x19395c[_0x4bfd('0x1e')](_0x4bfd('0x1f'),_0x538016+'-'+_0x492837+'/'+_0x103127)[_0x4bfd('0x1a')](_0x267724);}return null;};}function patchUpdates(_0x2fd4f2){return function(_0x2050a5){try{jsonpatch[_0x4bfd('0x20')](_0x2050a5,_0x2fd4f2,!![]);}catch(_0x245c41){return BPromise[_0x4bfd('0x21')](_0x245c41);}return _0x2050a5[_0x4bfd('0x22')]();};}function saveUpdates(_0xd699c,_0x1b2641){return function(_0x2ac46b){if(_0x2ac46b){return _0x2ac46b[_0x4bfd('0x23')](_0xd699c)[_0x4bfd('0x24')](function(_0x4e12c4){return _0x4e12c4;});}return null;};}function removeEntity(_0x4cfbb4,_0x21a212){return function(_0x467cae){if(_0x467cae){return _0x467cae[_0x4bfd('0x25')]()[_0x4bfd('0x24')](function(){_0x4cfbb4['status'](0xcc)[_0x4bfd('0x26')]();});}};}function handleEntityNotFound(_0x11bc0d,_0x1caca8){return function(_0x5aba3b){if(!_0x5aba3b){_0x11bc0d[_0x4bfd('0x18')](0x194);}return _0x5aba3b;};}function handleError(_0x4af7b8,_0x576e53){_0x576e53=_0x576e53||0x1f4;return function(_0x4176e6){logger[_0x4bfd('0x27')](_0x4176e6[_0x4bfd('0x28')]);if(_0x4176e6[_0x4bfd('0x29')]){delete _0x4176e6['name'];}_0x4af7b8['status'](_0x576e53)[_0x4bfd('0x2a')](_0x4176e6);};}exports[_0x4bfd('0x2b')]=function(_0x4faf74,_0x278eba){var _0x762295={},_0x2d7325={},_0x549a85={'count':0x0,'rows':[]};var _0x26ef0b=_[_0x4bfd('0x2c')](db[_0x4bfd('0x2d')][_0x4bfd('0x2e')],function(_0x560812){return{'name':_0x560812[_0x4bfd('0x2f')],'type':_0x560812[_0x4bfd('0x30')][_0x4bfd('0x31')]};});_0x2d7325['model']=_[_0x4bfd('0x2c')](_0x26ef0b,_0x4bfd('0x29'));_0x2d7325[_0x4bfd('0x32')]=_['keys'](_0x4faf74['query']);_0x2d7325[_0x4bfd('0x33')]=_[_0x4bfd('0x34')](_0x2d7325['model'],_0x2d7325[_0x4bfd('0x32')]);_0x762295[_0x4bfd('0x35')]=_['intersection'](_0x2d7325[_0x4bfd('0x36')],qs[_0x4bfd('0x37')](_0x4faf74['query'][_0x4bfd('0x37')]));_0x762295[_0x4bfd('0x35')]=_0x762295[_0x4bfd('0x35')][_0x4bfd('0x38')]?_0x762295['attributes']:_0x2d7325[_0x4bfd('0x36')];if(!_0x4faf74['query']['hasOwnProperty'](_0x4bfd('0x39'))){_0x762295['limit']=qs[_0x4bfd('0x3a')](_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x3a')]);_0x762295[_0x4bfd('0x1b')]=qs[_0x4bfd('0x1b')](_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x1b')]);}_0x762295[_0x4bfd('0x3b')]=qs[_0x4bfd('0x3c')](_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x3c')]);_0x762295[_0x4bfd('0x3d')]=qs[_0x4bfd('0x33')](_[_0x4bfd('0x3e')](_0x4faf74['query'],_0x2d7325['filters']),_0x26ef0b);if(_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x3f')]){_0x762295[_0x4bfd('0x3d')]=_['merge'](_0x762295[_0x4bfd('0x3d')],{'$or':_[_0x4bfd('0x2c')](_0x26ef0b,function(_0x459631){if(_0x459631[_0x4bfd('0x30')]!==_0x4bfd('0x40')){var _0x79e99e={};_0x79e99e[_0x459631[_0x4bfd('0x29')]]={'$like':'%'+_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x3f')]+'%'};return _0x79e99e;}})});}_0x762295=_[_0x4bfd('0x41')]({},_0x762295,_0x4faf74[_0x4bfd('0x42')]);var _0x54466e={'where':_0x762295['where']};return db[_0x4bfd('0x2d')][_0x4bfd('0x1d')](_0x54466e)['then'](function(_0x54ab8d){_0x549a85[_0x4bfd('0x1d')]=_0x54ab8d;if(_0x4faf74[_0x4bfd('0x32')][_0x4bfd('0x43')]){_0x762295[_0x4bfd('0x44')]=[{'all':!![]}];}return db[_0x4bfd('0x2d')][_0x4bfd('0x45')](_0x762295);})[_0x4bfd('0x24')](function(_0x5be4e6){_0x549a85[_0x4bfd('0x46')]=_0x5be4e6;return _0x549a85;})[_0x4bfd('0x24')](respondWithFilteredResult(_0x278eba,_0x762295))[_0x4bfd('0x47')](handleError(_0x278eba,null));};exports[_0x4bfd('0x48')]=function(_0x509cba,_0x35624b){var _0x26bd30={'raw':!![],'where':{'id':_0x509cba[_0x4bfd('0x49')]['id']}},_0x211dd2={};_0x211dd2['model']=_['keys'](db[_0x4bfd('0x2d')][_0x4bfd('0x2e')]);_0x211dd2[_0x4bfd('0x32')]=_[_0x4bfd('0x4a')](_0x509cba[_0x4bfd('0x32')]);_0x211dd2[_0x4bfd('0x33')]=_[_0x4bfd('0x34')](_0x211dd2[_0x4bfd('0x36')],_0x211dd2[_0x4bfd('0x32')]);_0x26bd30[_0x4bfd('0x35')]=_[_0x4bfd('0x34')](_0x211dd2[_0x4bfd('0x36')],qs[_0x4bfd('0x37')](_0x509cba[_0x4bfd('0x32')][_0x4bfd('0x37')]));_0x26bd30[_0x4bfd('0x35')]=_0x26bd30[_0x4bfd('0x35')][_0x4bfd('0x38')]?_0x26bd30[_0x4bfd('0x35')]:_0x211dd2['model'];if(_0x509cba[_0x4bfd('0x32')][_0x4bfd('0x43')]){_0x26bd30['include']=[{'all':!![]}];}_0x26bd30=_['merge']({},_0x26bd30,_0x509cba['options']);return db[_0x4bfd('0x2d')][_0x4bfd('0x4b')](_0x26bd30)[_0x4bfd('0x24')](handleEntityNotFound(_0x35624b,null))[_0x4bfd('0x24')](respondWithResult(_0x35624b,null))[_0x4bfd('0x47')](handleError(_0x35624b,null));};exports[_0x4bfd('0x4c')]=function(_0x399dd3,_0x2e98d1){return db['Dynamics365Field']['create'](_0x399dd3['body'],{})[_0x4bfd('0x24')](respondWithResult(_0x2e98d1,0xc9))['catch'](handleError(_0x2e98d1,null));};exports['update']=function(_0x595e4e,_0x2db52b){if(_0x595e4e[_0x4bfd('0x4d')]['id']){delete _0x595e4e['body']['id'];}return db[_0x4bfd('0x2d')][_0x4bfd('0x4b')]({'where':{'id':_0x595e4e[_0x4bfd('0x49')]['id']}})[_0x4bfd('0x24')](handleEntityNotFound(_0x2db52b,null))['then'](saveUpdates(_0x595e4e['body'],null))[_0x4bfd('0x24')](respondWithResult(_0x2db52b,null))[_0x4bfd('0x47')](handleError(_0x2db52b,null));};exports['destroy']=function(_0x3c8895,_0x387fd5){return db[_0x4bfd('0x2d')][_0x4bfd('0x4b')]({'where':{'id':_0x3c8895[_0x4bfd('0x49')]['id']}})[_0x4bfd('0x24')](handleEntityNotFound(_0x387fd5,null))[_0x4bfd('0x24')](removeEntity(_0x387fd5,null))[_0x4bfd('0x47')](handleError(_0x387fd5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 48910f2..84451af 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 _0xee9d=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','api','bluebird','path','rimraf','exports','define'];(function(_0x2faca6,_0x528c2c){var _0x1b1b5b=function(_0x5cd7cd){while(--_0x5cd7cd){_0x2faca6['push'](_0x2faca6['shift']());}};_0x1b1b5b(++_0x528c2c);}(_0xee9d,0x9f));var _0xdee9=function(_0x3f26ba,_0x10fabd){_0x3f26ba=_0x3f26ba-0x0;var _0x3c6cfa=_0xee9d[_0x3f26ba];return _0x3c6cfa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdee9('0x0'));var moment=require('moment');var BPromise=require(_0xdee9('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdee9('0x2'));var rimraf=require(_0xdee9('0x3'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xdee9('0x4')]=function(_0x3bc7ed,_0x293b91){return _0x3bc7ed[_0xdee9('0x5')](_0xdee9('0x6'),attributes,{'tableName':_0xdee9('0x7'),'paranoid':![],'indexes':[{'name':_0xdee9('0x8'),'fields':[_0xdee9('0x9'),_0xdee9('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1618=['idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0xbaf699,_0x4aa945){var _0x55a131=function(_0x219dd7){while(--_0x219dd7){_0xbaf699['push'](_0xbaf699['shift']());}};_0x55a131(++_0x4aa945);}(_0x1618,0x105));var _0x8161=function(_0x1674fe,_0xc02884){_0x1674fe=_0x1674fe-0x0;var _0x49e7bc=_0x1618[_0x1674fe];return _0x49e7bc;};'use strict';var _=require('lodash');var util=require(_0x8161('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8161('0x1'));var BPromise=require(_0x8161('0x2'));var rp=require(_0x8161('0x3'));var fs=require('fs');var path=require(_0x8161('0x4'));var rimraf=require(_0x8161('0x5'));var config=require(_0x8161('0x6'));var attributes=require(_0x8161('0x7'));module[_0x8161('0x8')]=function(_0x2cf352,_0x5a82b2){return _0x2cf352['define'](_0x8161('0x9'),attributes,{'tableName':_0x8161('0xa'),'paranoid':![],'indexes':[{'name':_0x8161('0xb'),'fields':[_0x8161('0xc'),'FieldId'],'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 56b070e..47253be 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 _0x2507=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x54a001,_0x2f6d72){var _0xac26e0=function(_0x3f8b24){while(--_0x3f8b24){_0x54a001['push'](_0x54a001['shift']());}};_0xac26e0(++_0x2f6d72);}(_0x2507,0x1ba));var _0x7250=function(_0x5c72f6,_0x303fc0){_0x5c72f6=_0x5c72f6-0x0;var _0x1207d7=_0x2507[_0x5c72f6];return _0x1207d7;};'use strict';var _=require(_0x7250('0x0'));var util=require('util');var moment=require(_0x7250('0x1'));var BPromise=require('bluebird');var rs=require(_0x7250('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7250('0x3'))['db'];var utils=require(_0x7250('0x4'));var logger=require('../../config/logger')(_0x7250('0x5'));var config=require(_0x7250('0x6'));var jayson=require(_0x7250('0x7'));var client=jayson[_0x7250('0x8')][_0x7250('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x549b17,_0x5d9bf2,_0x457574){return new BPromise(function(_0x4df9c7,_0x48f270){return client[_0x7250('0xa')](_0x549b17,_0x457574)[_0x7250('0xb')](function(_0x1dc5a0){logger[_0x7250('0xc')](_0x7250('0xd'),_0x5d9bf2,_0x7250('0xe'));logger[_0x7250('0xf')](_0x7250('0x10'),_0x5d9bf2,_0x7250('0xe'),JSON[_0x7250('0x11')](_0x1dc5a0));if(_0x1dc5a0['error']){if(_0x1dc5a0[_0x7250('0x12')]['code']===0x1f4){logger[_0x7250('0x12')](_0x7250('0xd'),_0x5d9bf2,_0x1dc5a0[_0x7250('0x12')][_0x7250('0x13')]);return _0x48f270(_0x1dc5a0['error'][_0x7250('0x13')]);}logger['error'](_0x7250('0xd'),_0x5d9bf2,_0x1dc5a0[_0x7250('0x12')][_0x7250('0x13')]);return _0x4df9c7(_0x1dc5a0[_0x7250('0x12')]['message']);}else{logger[_0x7250('0xc')](_0x7250('0xd'),_0x5d9bf2,_0x7250('0xe'));_0x4df9c7(_0x1dc5a0[_0x7250('0x14')][_0x7250('0x13')]);}})[_0x7250('0x15')](function(_0x1aa812){logger[_0x7250('0x12')](_0x7250('0xd'),_0x5d9bf2,_0x1aa812);_0x48f270(_0x1aa812);});});} \ No newline at end of file +var _0xfb63=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Field,\x20%s,\x20%s','result'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xfb63,0x1ba));var _0x3fb6=function(_0x14111a,_0x1ab2d8){_0x14111a=_0x14111a-0x0;var _0x1e8b0f=_0xfb63[_0x14111a];return _0x1e8b0f;};'use strict';var _=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fb6('0x3'));var fs=require('fs');var Redis=require(_0x3fb6('0x4'));var db=require(_0x3fb6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fb6('0x6'))(_0x3fb6('0x7'));var config=require('../../config/environment');var jayson=require(_0x3fb6('0x8'));var client=jayson[_0x3fb6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3c52,_0x12d7eb,_0x3934bb){return new BPromise(function(_0x256e75,_0x1532ea){return client[_0x3fb6('0xa')](_0x1d3c52,_0x3934bb)[_0x3fb6('0xb')](function(_0x44154c){logger[_0x3fb6('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x12d7eb,_0x3fb6('0xd'));logger['debug'](_0x3fb6('0xe'),_0x12d7eb,_0x3fb6('0xd'),JSON[_0x3fb6('0xf')](_0x44154c));if(_0x44154c[_0x3fb6('0x10')]){if(_0x44154c[_0x3fb6('0x10')]['code']===0x1f4){logger[_0x3fb6('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x12d7eb,_0x44154c[_0x3fb6('0x10')][_0x3fb6('0x11')]);return _0x1532ea(_0x44154c[_0x3fb6('0x10')][_0x3fb6('0x11')]);}logger[_0x3fb6('0x10')](_0x3fb6('0x12'),_0x12d7eb,_0x44154c[_0x3fb6('0x10')][_0x3fb6('0x11')]);return _0x256e75(_0x44154c[_0x3fb6('0x10')]['message']);}else{logger[_0x3fb6('0xc')](_0x3fb6('0x12'),_0x12d7eb,_0x3fb6('0xd'));_0x256e75(_0x44154c[_0x3fb6('0x13')]['message']);}})[_0x3fb6('0x14')](function(_0x67a1db){logger[_0x3fb6('0x10')](_0x3fb6('0x12'),_0x12d7eb,_0x67a1db);_0x1532ea(_0x67a1db);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7da0abb..112f771 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 _0x9b19=['express','Router','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x25e1fd,_0x244fb6){var _0x311f26=function(_0x56e92c){while(--_0x56e92c){_0x25e1fd['push'](_0x25e1fd['shift']());}};_0x311f26(++_0x244fb6);}(_0x9b19,0xd9));var _0x99b1=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x9b19[_0x507597];return _0x110a0f;};'use strict';var multer=require(_0x99b1('0x0'));var util=require(_0x99b1('0x1'));var path=require('path');var timeout=require(_0x99b1('0x2'));var express=require(_0x99b1('0x3'));var router=express[_0x99b1('0x4')]();var fs_extra=require(_0x99b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99b1('0x6'));var config=require('../../config/environment');var controller=require(_0x99b1('0x7'));router[_0x99b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x99b1('0x9')]);router[_0x99b1('0x8')](_0x99b1('0xa'),auth[_0x99b1('0xb')](),controller[_0x99b1('0xc')]);router['get'](_0x99b1('0xd'),auth[_0x99b1('0xb')](),controller['getConfigurations']);router['get'](_0x99b1('0xe'),auth[_0x99b1('0xb')](),controller[_0x99b1('0xf')]);router[_0x99b1('0x10')]('/',auth[_0x99b1('0xb')](),controller[_0x99b1('0x11')]);router['post'](_0x99b1('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x99b1('0x12')](_0x99b1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x99b1('0x13')](_0x99b1('0xa'),auth[_0x99b1('0xb')](),controller[_0x99b1('0x14')]);module[_0x99b1('0x15')]=router; \ No newline at end of file +var _0x17f7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','express'];(function(_0x56060c,_0xf8c390){var _0x220f29=function(_0x1a805a){while(--_0x1a805a){_0x56060c['push'](_0x56060c['shift']());}};_0x220f29(++_0xf8c390);}(_0x17f7,0x165));var _0x717f=function(_0x2041f7,_0x49509d){_0x2041f7=_0x2041f7-0x0;var _0x3fbc1b=_0x17f7[_0x2041f7];return _0x3fbc1b;};'use strict';var multer=require(_0x717f('0x0'));var util=require(_0x717f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x717f('0x2'));var router=express[_0x717f('0x3')]();var fs_extra=require(_0x717f('0x4'));var auth=require(_0x717f('0x5'));var interaction=require(_0x717f('0x6'));var config=require(_0x717f('0x7'));var controller=require(_0x717f('0x8'));router[_0x717f('0x9')]('/',auth[_0x717f('0xa')](),controller[_0x717f('0xb')]);router['get'](_0x717f('0xc'),auth[_0x717f('0xa')](),controller['show']);router[_0x717f('0x9')](_0x717f('0xd'),auth['isAuthenticated'](),controller[_0x717f('0xe')]);router[_0x717f('0x9')](_0x717f('0xf'),auth[_0x717f('0xa')](),controller[_0x717f('0x10')]);router[_0x717f('0x11')]('/',auth['isAuthenticated'](),controller[_0x717f('0x12')]);router[_0x717f('0x11')](_0x717f('0xd'),auth['isAuthenticated'](),controller[_0x717f('0x13')]);router[_0x717f('0x14')](_0x717f('0xc'),auth[_0x717f('0xa')](),controller[_0x717f('0x15')]);router[_0x717f('0x16')]('/:id',auth[_0x717f('0xa')](),controller[_0x717f('0x17')]);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 76e37c3..066a1a8 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 _0x6a55=['STRING','sequelize'];(function(_0x331cce,_0x5dc2ae){var _0x5b7cb4=function(_0x3f3d3d){while(--_0x3f3d3d){_0x331cce['push'](_0x331cce['shift']());}};_0x5b7cb4(++_0x5dc2ae);}(_0x6a55,0xdb));var _0x56a5=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x6a55[_0x17882c];return _0x355a59;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0x5ca9b2,_0x279204){var _0x367c7d=function(_0x562136){while(--_0x562136){_0x5ca9b2['push'](_0x5ca9b2['shift']());}};_0x367c7d(++_0x279204);}(_0x8603,0x190));var _0x3860=function(_0x593ccf,_0x2873b5){_0x593ccf=_0x593ccf-0x0;var _0x2ce4c1=_0x8603[_0x593ccf];return _0x2ce4c1;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f92378d..2fde706 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 _0x9a62=['util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','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','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','subject','description','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment'];(function(_0x2e1fcf,_0x1c8494){var _0x130938=function(_0x16313d){while(--_0x16313d){_0x2e1fcf['push'](_0x2e1fcf['shift']());}};_0x130938(++_0x1c8494);}(_0x9a62,0x1bc));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d78fa,_0x7acc03){_0x7acc03=_0x7acc03||0xcc;return function(_0x5e2abb){if(_0x5e2abb){return _0x1d78fa[_0x29a6('0x16')](_0x7acc03);}return _0x1d78fa[_0x29a6('0x17')](_0x7acc03)['end']();};}function respondWithResult(_0x50c663,_0x36d6fd){_0x36d6fd=_0x36d6fd||0xc8;return function(_0x186afa){if(_0x186afa){return _0x50c663['status'](_0x36d6fd)[_0x29a6('0x18')](_0x186afa);}};}function respondWithFilteredResult(_0x22378a,_0x307dd9){return function(_0x4fef5c){if(_0x4fef5c){var _0x862659=typeof _0x307dd9[_0x29a6('0x19')]===_0x29a6('0x1a')&&typeof _0x307dd9[_0x29a6('0x1b')]===_0x29a6('0x1a');var _0x340d75=_0x4fef5c[_0x29a6('0x1c')];var _0x34b66e=_0x862659?0x0:_0x307dd9['offset'];var _0x196882=_0x862659?_0x4fef5c['count']:_0x307dd9[_0x29a6('0x19')]+_0x307dd9[_0x29a6('0x1b')];var _0xdc0ff6;if(_0x196882>=_0x340d75){_0x196882=_0x340d75;_0xdc0ff6=0xc8;}else{_0xdc0ff6=0xce;}_0x22378a['status'](_0xdc0ff6);return _0x22378a[_0x29a6('0x1d')]('Content-Range',_0x34b66e+'-'+_0x196882+'/'+_0x340d75)['json'](_0x4fef5c);}return null;};}function patchUpdates(_0x5a8d55){return function(_0x152b00){try{jsonpatch[_0x29a6('0x1e')](_0x152b00,_0x5a8d55,!![]);}catch(_0x2065be){return BPromise[_0x29a6('0x1f')](_0x2065be);}return _0x152b00[_0x29a6('0x20')]();};}function saveUpdates(_0x552bc7,_0x13341e){return function(_0xae08a5){if(_0xae08a5){return _0xae08a5[_0x29a6('0x21')](_0x552bc7)[_0x29a6('0x22')](function(_0x46fcc7){return _0x46fcc7;});}return null;};}function removeEntity(_0x2dc6c0,_0xedfa4){return function(_0x51761e){if(_0x51761e){return _0x51761e[_0x29a6('0x23')]()[_0x29a6('0x22')](function(){_0x2dc6c0[_0x29a6('0x17')](0xcc)[_0x29a6('0x24')]();});}};}function handleEntityNotFound(_0x1798dd,_0x17b835){return function(_0x364e72){if(!_0x364e72){_0x1798dd['sendStatus'](0x194);}return _0x364e72;};}function handleError(_0x483d22,_0x5a67df){_0x5a67df=_0x5a67df||0x1f4;return function(_0x1bcbf1){logger[_0x29a6('0x25')](_0x1bcbf1[_0x29a6('0x26')]);if(_0x1bcbf1[_0x29a6('0x27')]){delete _0x1bcbf1[_0x29a6('0x27')];}_0x483d22['status'](_0x5a67df)['send'](_0x1bcbf1);};}exports[_0x29a6('0x28')]=function(_0x3607b3,_0x4c5cb8){var _0x454df0={},_0x2b6b35={},_0x4fa41e={'count':0x0,'rows':[]};var _0x5a5cea=_[_0x29a6('0x29')](db[_0x29a6('0x2a')][_0x29a6('0x2b')],function(_0x4250f4){return{'name':_0x4250f4[_0x29a6('0x2c')],'type':_0x4250f4[_0x29a6('0x2d')]['key']};});_0x2b6b35['model']=_[_0x29a6('0x29')](_0x5a5cea,_0x29a6('0x27'));_0x2b6b35[_0x29a6('0x2e')]=_[_0x29a6('0x2f')](_0x3607b3[_0x29a6('0x2e')]);_0x2b6b35[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x2b6b35['model'],_0x2b6b35[_0x29a6('0x2e')]);_0x454df0[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2b6b35[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x454df0[_0x29a6('0x32')]=_0x454df0[_0x29a6('0x32')]['length']?_0x454df0[_0x29a6('0x32')]:_0x2b6b35[_0x29a6('0x33')];if(!_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x35')](_0x29a6('0x36'))){_0x454df0[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x3607b3['query']['limit']);_0x454df0['offset']=qs[_0x29a6('0x19')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x19')]);}_0x454df0[_0x29a6('0x37')]=qs[_0x29a6('0x38')](_0x3607b3[_0x29a6('0x2e')]['sort']);_0x454df0[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_['pick'](_0x3607b3[_0x29a6('0x2e')],_0x2b6b35[_0x29a6('0x30')]),_0x5a5cea);if(_0x3607b3['query'][_0x29a6('0x3a')]){_0x454df0[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x454df0['where'],{'$or':_[_0x29a6('0x29')](_0x5a5cea,function(_0x3c35b6){if(_0x3c35b6[_0x29a6('0x2d')]!=='VIRTUAL'){var _0x50ab51={};_0x50ab51[_0x3c35b6[_0x29a6('0x27')]]={'$like':'%'+_0x3607b3['query'][_0x29a6('0x3a')]+'%'};return _0x50ab51;}})});}_0x454df0=_[_0x29a6('0x3b')]({},_0x454df0,_0x3607b3['options']);var _0x1a428f={'where':_0x454df0[_0x29a6('0x39')]};return db[_0x29a6('0x2a')][_0x29a6('0x1c')](_0x1a428f)[_0x29a6('0x22')](function(_0xc0e144){_0x4fa41e[_0x29a6('0x1c')]=_0xc0e144;if(_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x454df0[_0x29a6('0x3d')]=[{'all':!![]}];}return db[_0x29a6('0x2a')][_0x29a6('0x3e')](_0x454df0);})[_0x29a6('0x22')](function(_0x54b0b1){_0x4fa41e[_0x29a6('0x3f')]=_0x54b0b1;return _0x4fa41e;})[_0x29a6('0x22')](respondWithFilteredResult(_0x4c5cb8,_0x454df0))[_0x29a6('0x40')](handleError(_0x4c5cb8,null));};exports['show']=function(_0x3b71ad,_0x5300ee){var _0x46dc89={'raw':![],'where':{'id':_0x3b71ad[_0x29a6('0x41')]['id']}},_0x2e14af={};_0x2e14af[_0x29a6('0x33')]=_['keys'](db[_0x29a6('0x2a')][_0x29a6('0x2b')]);_0x2e14af[_0x29a6('0x2e')]=_['keys'](_0x3b71ad[_0x29a6('0x2e')]);_0x2e14af[_0x29a6('0x30')]=_['intersection'](_0x2e14af[_0x29a6('0x33')],_0x2e14af[_0x29a6('0x2e')]);_0x46dc89[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2e14af[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x46dc89[_0x29a6('0x32')]=_0x46dc89[_0x29a6('0x32')][_0x29a6('0x42')]?_0x46dc89[_0x29a6('0x32')]:_0x2e14af[_0x29a6('0x33')];if(_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x46dc89[_0x29a6('0x3d')]=[{'all':!![]}];}_0x46dc89=_['merge']({},_0x46dc89,_0x3b71ad['options']);return db['FreshdeskAccount'][_0x29a6('0x43')](_0x46dc89)['then'](handleEntityNotFound(_0x5300ee,null))[_0x29a6('0x22')](respondWithResult(_0x5300ee,null))['catch'](handleError(_0x5300ee,null));};exports['create']=function(_0x25995e,_0x57e994){return db[_0x29a6('0x2a')][_0x29a6('0x44')](_0x25995e['body'],{})[_0x29a6('0x22')](respondWithResult(_0x57e994,0xc9))[_0x29a6('0x40')](handleError(_0x57e994,null));};exports[_0x29a6('0x21')]=function(_0x477085,_0x453ba7){if(_0x477085[_0x29a6('0x45')]['id']){delete _0x477085[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x43')]({'where':{'id':_0x477085[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x453ba7,null))[_0x29a6('0x22')](saveUpdates(_0x477085[_0x29a6('0x45')],null))[_0x29a6('0x22')](respondWithResult(_0x453ba7,null))[_0x29a6('0x40')](handleError(_0x453ba7,null));};exports['destroy']=function(_0x3252cd,_0x36ce7e){return db['FreshdeskAccount']['find']({'where':{'id':_0x3252cd['params']['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x36ce7e,null))[_0x29a6('0x22')](removeEntity(_0x36ce7e,null))[_0x29a6('0x40')](handleError(_0x36ce7e,null));};exports[_0x29a6('0x46')]=function(_0x5cf8cf,_0x3c3262,_0x32327b){var _0x5af0be={};var _0x342585={};var _0x1eacb0;var _0x40f52b;return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x5cf8cf[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c3262,null))[_0x29a6('0x22')](function(_0x371313){if(_0x371313){_0x1eacb0=_0x371313;_0x342585['model']=_[_0x29a6('0x2f')](db['FreshdeskConfiguration'][_0x29a6('0x2b')]);_0x342585['query']=_[_0x29a6('0x2f')](_0x5cf8cf[_0x29a6('0x2e')]);_0x342585[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x342585['model'],_0x342585[_0x29a6('0x2e')]);_0x5af0be[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x342585['model'],qs['fields'](_0x5cf8cf['query']['fields']));_0x5af0be['attributes']=_0x5af0be[_0x29a6('0x32')][_0x29a6('0x42')]?_0x5af0be['attributes']:_0x342585[_0x29a6('0x33')];_0x5af0be['order']=qs[_0x29a6('0x38')](_0x5cf8cf[_0x29a6('0x2e')][_0x29a6('0x38')]);_0x5af0be[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_[_0x29a6('0x48')](_0x5cf8cf[_0x29a6('0x2e')],_0x342585[_0x29a6('0x30')]));if(_0x5cf8cf[_0x29a6('0x2e')]['filter']){_0x5af0be[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x5af0be['where'],{'$or':_[_0x29a6('0x29')](_0x5af0be[_0x29a6('0x32')],function(_0x317803){var _0x569944={};_0x569944[_0x317803]={'$like':'%'+_0x5cf8cf['query'][_0x29a6('0x3a')]+'%'};return _0x569944;})});}_0x5af0be=_[_0x29a6('0x3b')]({},_0x5af0be,_0x5cf8cf['options']);return _0x1eacb0[_0x29a6('0x46')](_0x5af0be);}})['then'](function(_0x45f503){if(_0x45f503){_0x40f52b=_0x45f503['length'];if(!_0x5cf8cf[_0x29a6('0x2e')]['hasOwnProperty']('nolimit')){_0x5af0be[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x5cf8cf['query'][_0x29a6('0x1b')]);_0x5af0be['offset']=qs[_0x29a6('0x19')](_0x5cf8cf['query'][_0x29a6('0x19')]);}return _0x1eacb0['getConfigurations'](_0x5af0be);}})[_0x29a6('0x22')](function(_0x4e4b06){if(_0x4e4b06){return _0x4e4b06?{'count':_0x40f52b,'rows':_0x4e4b06}:null;}})[_0x29a6('0x22')](respondWithResult(_0x3c3262,null))[_0x29a6('0x40')](handleError(_0x3c3262,null));};exports['addConfiguration']=function(_0x290f86,_0x1f8726,_0x41a9e6){if(_0x290f86[_0x29a6('0x45')]['id']){delete _0x290f86[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x290f86[_0x29a6('0x41')]['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x1f8726,null))[_0x29a6('0x22')](function(_0x9d7bdc){if(_0x9d7bdc){_0x290f86[_0x29a6('0x45')][_0x29a6('0x49')]=_0x9d7bdc['id'];_0x290f86[_0x29a6('0x45')][_0x29a6('0x4a')]=integrations[_0x29a6('0x4b')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86['body'][_0x29a6('0x2d')]);_0x290f86[_0x29a6('0x45')][_0x29a6('0x4d')]=integrations[_0x29a6('0x4e')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86[_0x29a6('0x45')][_0x29a6('0x2d')]);return db[_0x29a6('0x4f')][_0x29a6('0x44')](_0x290f86[_0x29a6('0x45')],{'include':[{'model':db[_0x29a6('0x50')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f8726,null))['catch'](handleError(_0x1f8726,null));};exports[_0x29a6('0x51')]=function(_0x13a545,_0x27ba9a,_0x422344){var _0x27d33f='';return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x13a545[_0x29a6('0x41')]['id']},'attributes':['id',_0x29a6('0x52'),_0x29a6('0x53')]})['then'](handleEntityNotFound(_0x27ba9a,null))['then'](function(_0x176d48){if(_0x176d48){_0x27d33f=_0x176d48[_0x29a6('0x52')];var _0x354bdf=_0x27d33f[_0x29a6('0x54')](-0x1);if(_0x354bdf==='/'){_0x27d33f=_0x27d33f[_0x29a6('0x55')](0x0,_0x27d33f[_0x29a6('0x56')](_0x354bdf));}return rp({'method':_0x29a6('0x57'),'uri':util[_0x29a6('0x58')](_0x29a6('0x59'),_0x27d33f,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x29a6('0x58')](_0x29a6('0x5a'),new Buffer(util[_0x29a6('0x58')](_0x29a6('0x5b'),_0x176d48[_0x29a6('0x53')]))[_0x29a6('0x5c')](_0x29a6('0x5d')))},'json':!![]});}})[_0x29a6('0x22')](function(_0x80b865){if(_0x80b865){var _0x2be85d=['requester',_0x29a6('0x5e'),'agent',_0x29a6('0x5f'),_0x29a6('0x17'),'priority',_0x29a6('0x60'),_0x29a6('0x61'),_0x29a6('0x62'),_0x29a6('0x60'),_0x29a6('0x63')];_[_0x29a6('0x64')](_0x80b865,function(_0x1302ca){return _0x2be85d['includes'](_0x1302ca[_0x29a6('0x27')])||!_0x1302ca[_0x29a6('0x65')]&&_0x1302ca[_0x29a6('0x2d')]!==_0x29a6('0x66')&&_0x1302ca[_0x29a6('0x2d')]!==_0x29a6('0x67');});return{'count':_0x80b865[_0x29a6('0x42')],'rows':_[_0x29a6('0x29')](_0x80b865,function(_0x51f622){return{'id':_0x51f622[_0x29a6('0x27')],'name':_0x51f622[_0x29a6('0x68')],'custom':!_0x51f622[_0x29a6('0x65')],'options':_0x51f622[_0x29a6('0x69')]?_[_0x29a6('0x29')](_0x51f622['choices'],function(_0x5d5ba6){return{'name':_[_0x29a6('0x6a')](_0x5d5ba6),'value':_0x5d5ba6};}):[]};})};}})[_0x29a6('0x22')](respondWithResult(_0x27ba9a,null))[_0x29a6('0x40')](function(_0x1a6254){var _0xd860e4=_0x13a545['query']['test']?0x1f4:_0x1a6254[_0x29a6('0x6b')]||0x1f4;logger[_0x29a6('0x25')](_0x29a6('0x6c'),_0x29a6('0x51'),_0xd860e4,JSON[_0x29a6('0x6d')](_0x1a6254));delete _0x1a6254[_0x29a6('0x27')];if(_0xd860e4===0x191){_0xd860e4=0x190;}_0x27ba9a[_0x29a6('0x17')](_0xd860e4)['send'](_0x13a545[_0x29a6('0x2e')][_0x29a6('0x6e')]?{'message':_0x29a6('0x6f'),'statusCode':_0x1a6254[_0x29a6('0x6b')]}:_0x1a6254);});}; \ No newline at end of file +var _0xd404=['ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','keys','merge','create','body','catch','find','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','getSubjects','channel','type','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','toString','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4fae03,_0x46f596){var _0xe21703=function(_0x155eeb){while(--_0x155eeb){_0x4fae03['push'](_0x4fae03['shift']());}};_0xe21703(++_0x46f596);}(_0xd404,0x15b));var _0x4d40=function(_0x35de68,_0x165ef8){_0x35de68=_0x35de68-0x0;var _0xf70815=_0xd404[_0x35de68];return _0xf70815;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];var integrations=require(_0x4d40('0x1a'));function respondWithStatusCode(_0x28e5bf,_0x42a621){_0x42a621=_0x42a621||0xcc;return function(_0x5162f9){if(_0x5162f9){return _0x28e5bf[_0x4d40('0x1b')](_0x42a621);}return _0x28e5bf[_0x4d40('0x1c')](_0x42a621)[_0x4d40('0x1d')]();};}function respondWithResult(_0x2083bd,_0x477a91){_0x477a91=_0x477a91||0xc8;return function(_0x478cdd){if(_0x478cdd){return _0x2083bd[_0x4d40('0x1c')](_0x477a91)[_0x4d40('0x1e')](_0x478cdd);}};}function respondWithFilteredResult(_0x20bc1b,_0xcee25a){return function(_0x453857){if(_0x453857){var _0x361a41=typeof _0xcee25a[_0x4d40('0x1f')]===_0x4d40('0x20')&&typeof _0xcee25a[_0x4d40('0x21')]==='undefined';var _0x535989=_0x453857[_0x4d40('0x22')];var _0x1c0cd8=_0x361a41?0x0:_0xcee25a['offset'];var _0x23b8fd=_0x361a41?_0x453857[_0x4d40('0x22')]:_0xcee25a['offset']+_0xcee25a[_0x4d40('0x21')];var _0x5a77e0;if(_0x23b8fd>=_0x535989){_0x23b8fd=_0x535989;_0x5a77e0=0xc8;}else{_0x5a77e0=0xce;}_0x20bc1b[_0x4d40('0x1c')](_0x5a77e0);return _0x20bc1b[_0x4d40('0x23')]('Content-Range',_0x1c0cd8+'-'+_0x23b8fd+'/'+_0x535989)['json'](_0x453857);}return null;};}function patchUpdates(_0x375ce0){return function(_0x569190){try{jsonpatch['apply'](_0x569190,_0x375ce0,!![]);}catch(_0xc458da){return BPromise[_0x4d40('0x24')](_0xc458da);}return _0x569190[_0x4d40('0x25')]();};}function saveUpdates(_0x5d4c24,_0x356fd6){return function(_0x2ccafa){if(_0x2ccafa){return _0x2ccafa[_0x4d40('0x26')](_0x5d4c24)['then'](function(_0x4eebc3){return _0x4eebc3;});}return null;};}function removeEntity(_0x2df33a,_0x90b652){return function(_0x1285f6){if(_0x1285f6){return _0x1285f6[_0x4d40('0x27')]()[_0x4d40('0x28')](function(){_0x2df33a['status'](0xcc)[_0x4d40('0x1d')]();});}};}function handleEntityNotFound(_0x1f5e5b,_0x560df8){return function(_0x5540ee){if(!_0x5540ee){_0x1f5e5b[_0x4d40('0x1b')](0x194);}return _0x5540ee;};}function handleError(_0x2a0c82,_0x3fa83e){_0x3fa83e=_0x3fa83e||0x1f4;return function(_0x3ad1d7){logger[_0x4d40('0x29')](_0x3ad1d7[_0x4d40('0x2a')]);if(_0x3ad1d7[_0x4d40('0x2b')]){delete _0x3ad1d7[_0x4d40('0x2b')];}_0x2a0c82[_0x4d40('0x1c')](_0x3fa83e)[_0x4d40('0x2c')](_0x3ad1d7);};}exports[_0x4d40('0x2d')]=function(_0x4ca431,_0x4e4e61){var _0x52f706={},_0x158a86={},_0x350488={'count':0x0,'rows':[]};var _0x1ac240=_[_0x4d40('0x2e')](db['FreshdeskAccount'][_0x4d40('0x2f')],function(_0x1c8a1b){return{'name':_0x1c8a1b[_0x4d40('0x30')],'type':_0x1c8a1b['type'][_0x4d40('0x31')]};});_0x158a86[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x1ac240,_0x4d40('0x2b'));_0x158a86[_0x4d40('0x33')]=_['keys'](_0x4ca431[_0x4d40('0x33')]);_0x158a86['filters']=_[_0x4d40('0x34')](_0x158a86[_0x4d40('0x32')],_0x158a86[_0x4d40('0x33')]);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x158a86['model'],qs[_0x4d40('0x36')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x36')]));_0x52f706[_0x4d40('0x35')]=_0x52f706['attributes'][_0x4d40('0x37')]?_0x52f706['attributes']:_0x158a86[_0x4d40('0x32')];if(!_0x4ca431[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x52f706[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x21')]);_0x52f706[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x4ca431['query'][_0x4d40('0x1f')]);}_0x52f706[_0x4d40('0x3a')]=qs['sort'](_0x4ca431['query']['sort']);_0x52f706[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_['pick'](_0x4ca431[_0x4d40('0x33')],_0x158a86[_0x4d40('0x3c')]),_0x1ac240);if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x52f706[_0x4d40('0x3b')]=_['merge'](_0x52f706[_0x4d40('0x3b')],{'$or':_[_0x4d40('0x2e')](_0x1ac240,function(_0x4a84fa){if(_0x4a84fa['type']!==_0x4d40('0x3e')){var _0x11ed1a={};_0x11ed1a[_0x4a84fa['name']]={'$like':'%'+_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x11ed1a;}})});}_0x52f706=_['merge']({},_0x52f706,_0x4ca431[_0x4d40('0x3f')]);var _0x1a9586={'where':_0x52f706['where']};return db[_0x4d40('0x40')][_0x4d40('0x22')](_0x1a9586)['then'](function(_0x2b5db0){_0x350488['count']=_0x2b5db0;if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x41')]){_0x52f706[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x40')][_0x4d40('0x43')](_0x52f706);})[_0x4d40('0x28')](function(_0x91f44d){_0x350488[_0x4d40('0x44')]=_0x91f44d;return _0x350488;})[_0x4d40('0x28')](respondWithFilteredResult(_0x4e4e61,_0x52f706))['catch'](handleError(_0x4e4e61,null));};exports[_0x4d40('0x45')]=function(_0x3718a8,_0x1c2fa8){var _0xcdde22={'raw':![],'where':{'id':_0x3718a8['params']['id']}},_0x22861a={};_0x22861a[_0x4d40('0x32')]=_['keys'](db[_0x4d40('0x40')][_0x4d40('0x2f')]);_0x22861a[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0x3718a8['query']);_0x22861a[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x22861a['model'],_0x22861a[_0x4d40('0x33')]);_0xcdde22['attributes']=_[_0x4d40('0x34')](_0x22861a[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0x3718a8[_0x4d40('0x33')]['fields']));_0xcdde22[_0x4d40('0x35')]=_0xcdde22['attributes'][_0x4d40('0x37')]?_0xcdde22[_0x4d40('0x35')]:_0x22861a[_0x4d40('0x32')];if(_0x3718a8[_0x4d40('0x33')]['includeAll']){_0xcdde22[_0x4d40('0x42')]=[{'all':!![]}];}_0xcdde22=_[_0x4d40('0x47')]({},_0xcdde22,_0x3718a8[_0x4d40('0x3f')]);return db[_0x4d40('0x40')]['find'](_0xcdde22)[_0x4d40('0x28')](handleEntityNotFound(_0x1c2fa8,null))[_0x4d40('0x28')](respondWithResult(_0x1c2fa8,null))['catch'](handleError(_0x1c2fa8,null));};exports[_0x4d40('0x48')]=function(_0x493d8e,_0x3d4283){return db[_0x4d40('0x40')][_0x4d40('0x48')](_0x493d8e[_0x4d40('0x49')],{})[_0x4d40('0x28')](respondWithResult(_0x3d4283,0xc9))[_0x4d40('0x4a')](handleError(_0x3d4283,null));};exports[_0x4d40('0x26')]=function(_0x37b6bf,_0x1cb8e7){if(_0x37b6bf['body']['id']){delete _0x37b6bf[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x37b6bf[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x1cb8e7,null))['then'](saveUpdates(_0x37b6bf[_0x4d40('0x49')],null))[_0x4d40('0x28')](respondWithResult(_0x1cb8e7,null))['catch'](handleError(_0x1cb8e7,null));};exports[_0x4d40('0x27')]=function(_0x48ffd7,_0x282945){return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x48ffd7['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x282945,null))[_0x4d40('0x28')](removeEntity(_0x282945,null))[_0x4d40('0x4a')](handleError(_0x282945,null));};exports[_0x4d40('0x4d')]=function(_0xd3e7cd,_0x52861d,_0x3191a2){var _0x14c6f8={};var _0x5aef99={};var _0x1000f4;var _0x584552;return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0xd3e7cd[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x52861d,null))['then'](function(_0xf62fef){if(_0xf62fef){_0x1000f4=_0xf62fef;_0x5aef99[_0x4d40('0x32')]=_[_0x4d40('0x46')](db[_0x4d40('0x4e')][_0x4d40('0x2f')]);_0x5aef99[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0xd3e7cd[_0x4d40('0x33')]);_0x5aef99[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],_0x5aef99[_0x4d40('0x33')]);_0x14c6f8[_0x4d40('0x35')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x36')]));_0x14c6f8[_0x4d40('0x35')]=_0x14c6f8['attributes'][_0x4d40('0x37')]?_0x14c6f8[_0x4d40('0x35')]:_0x5aef99['model'];_0x14c6f8['order']=qs[_0x4d40('0x4f')](_0xd3e7cd[_0x4d40('0x33')]['sort']);_0x14c6f8['where']=qs[_0x4d40('0x3c')](_['pick'](_0xd3e7cd[_0x4d40('0x33')],_0x5aef99['filters']));if(_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x14c6f8[_0x4d40('0x3b')]=_[_0x4d40('0x47')](_0x14c6f8[_0x4d40('0x3b')],{'$or':_['map'](_0x14c6f8['attributes'],function(_0x4e5b26){var _0x259f9d={};_0x259f9d[_0x4e5b26]={'$like':'%'+_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x259f9d;})});}_0x14c6f8=_[_0x4d40('0x47')]({},_0x14c6f8,_0xd3e7cd[_0x4d40('0x3f')]);return _0x1000f4['getConfigurations'](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x5b6a54){if(_0x5b6a54){_0x584552=_0x5b6a54[_0x4d40('0x37')];if(!_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x14c6f8[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0xd3e7cd['query']['limit']);_0x14c6f8[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x1f')]);}return _0x1000f4[_0x4d40('0x4d')](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x132543){if(_0x132543){return _0x132543?{'count':_0x584552,'rows':_0x132543}:null;}})[_0x4d40('0x28')](respondWithResult(_0x52861d,null))['catch'](handleError(_0x52861d,null));};exports[_0x4d40('0x50')]=function(_0x50917a,_0x5aa05b,_0x512a11){if(_0x50917a[_0x4d40('0x49')]['id']){delete _0x50917a[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x51')]({'where':{'id':_0x50917a['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x5aa05b,null))[_0x4d40('0x28')](function(_0x1e1a6c){if(_0x1e1a6c){_0x50917a[_0x4d40('0x49')][_0x4d40('0x52')]=_0x1e1a6c['id'];_0x50917a['body']['Subjects']=integrations[_0x4d40('0x53')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')][_0x4d40('0x55')]);_0x50917a['body']['Descriptions']=integrations[_0x4d40('0x56')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')]['type']);return db[_0x4d40('0x4e')][_0x4d40('0x48')](_0x50917a[_0x4d40('0x49')],{'include':[{'model':db[_0x4d40('0x57')],'as':_0x4d40('0x58')},{'model':db[_0x4d40('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5aa05b,null))['catch'](handleError(_0x5aa05b,null));};exports[_0x4d40('0x59')]=function(_0x358218,_0x37fd2b,_0x542d06){var _0xcf9e5b='';return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0x358218['params']['id']},'attributes':['id',_0x4d40('0x5a'),_0x4d40('0x5b')]})['then'](handleEntityNotFound(_0x37fd2b,null))[_0x4d40('0x28')](function(_0x471863){if(_0x471863){_0xcf9e5b=_0x471863[_0x4d40('0x5a')];var _0x25258e=_0xcf9e5b[_0x4d40('0x5c')](-0x1);if(_0x25258e==='/'){_0xcf9e5b=_0xcf9e5b[_0x4d40('0x5d')](0x0,_0xcf9e5b['lastIndexOf'](_0x25258e));}return rp({'method':_0x4d40('0x5e'),'uri':util['format'](_0x4d40('0x5f'),_0xcf9e5b,_0x4d40('0x60')),'headers':{'Authorization':util['format'](_0x4d40('0x61'),new Buffer(util[_0x4d40('0x62')]('%s:X',_0x471863[_0x4d40('0x5b')]))[_0x4d40('0x63')]('base64'))},'json':!![]});}})[_0x4d40('0x28')](function(_0xe7e67c){if(_0xe7e67c){var _0x325128=[_0x4d40('0x64'),_0x4d40('0x65'),'agent',_0x4d40('0x66'),_0x4d40('0x1c'),_0x4d40('0x67'),_0x4d40('0x68'),_0x4d40('0x69'),_0x4d40('0x6a'),'group',_0x4d40('0x6b')];_['remove'](_0xe7e67c,function(_0x2856c4){return _0x325128[_0x4d40('0x6c')](_0x2856c4[_0x4d40('0x2b')])||!_0x2856c4[_0x4d40('0x6d')]&&_0x2856c4[_0x4d40('0x55')]!=='custom_text'&&_0x2856c4[_0x4d40('0x55')]!==_0x4d40('0x6e');});return{'count':_0xe7e67c[_0x4d40('0x37')],'rows':_[_0x4d40('0x2e')](_0xe7e67c,function(_0x54a3e7){return{'id':_0x54a3e7[_0x4d40('0x2b')],'name':_0x54a3e7[_0x4d40('0x6f')],'custom':!_0x54a3e7[_0x4d40('0x6d')],'options':_0x54a3e7[_0x4d40('0x70')]?_['map'](_0x54a3e7[_0x4d40('0x70')],function(_0x4e6d11){return{'name':_[_0x4d40('0x71')](_0x4e6d11),'value':_0x4e6d11};}):[]};})};}})[_0x4d40('0x28')](respondWithResult(_0x37fd2b,null))[_0x4d40('0x4a')](function(_0x1b3f7f){var _0x5cfa9c=_0x358218['query'][_0x4d40('0x72')]?0x1f4:_0x1b3f7f[_0x4d40('0x73')]||0x1f4;logger['error'](_0x4d40('0x74'),_0x4d40('0x59'),_0x5cfa9c,JSON[_0x4d40('0x75')](_0x1b3f7f));delete _0x1b3f7f[_0x4d40('0x2b')];if(_0x5cfa9c===0x191){_0x5cfa9c=0x190;}_0x37fd2b[_0x4d40('0x1c')](_0x5cfa9c)['send'](_0x358218[_0x4d40('0x33')][_0x4d40('0x72')]?{'message':_0x4d40('0x76'),'statusCode':_0x1b3f7f[_0x4d40('0x73')]}:_0x1b3f7f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 934f96a..894531f 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 _0xdf1f=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x516a7e,_0x17f43d){var _0x5b8444=function(_0x1b4eca){while(--_0x1b4eca){_0x516a7e['push'](_0x516a7e['shift']());}};_0x5b8444(++_0x17f43d);}(_0xdf1f,0x191));var _0xfdf1=function(_0x9f79f1,_0xcfdcd9){_0x9f79f1=_0x9f79f1-0x0;var _0x4da7c8=_0xdf1f[_0x9f79f1];return _0x4da7c8;};'use strict';var _=require(_0xfdf1('0x0'));var util=require(_0xfdf1('0x1'));var logger=require(_0xfdf1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfdf1('0x3'));var rp=require(_0xfdf1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdf1('0x5'));var config=require(_0xfdf1('0x6'));var attributes=require(_0xfdf1('0x7'));var integrations=require(_0xfdf1('0x8'));module['exports']=function(_0x7e82c1,_0x462d50){return _0x7e82c1[_0xfdf1('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xfdf1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe628=['define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2ac98d,_0x51042a){var _0x42921b=function(_0x525a3a){while(--_0x525a3a){_0x2ac98d['push'](_0x2ac98d['shift']());}};_0x42921b(++_0x51042a);}(_0xe628,0x152));var _0x8e62=function(_0x20bbe5,_0x189723){_0x20bbe5=_0x20bbe5-0x0;var _0x1d94c7=_0xe628[_0x20bbe5];return _0x1d94c7;};'use strict';var _=require(_0x8e62('0x0'));var util=require(_0x8e62('0x1'));var logger=require(_0x8e62('0x2'))(_0x8e62('0x3'));var moment=require(_0x8e62('0x4'));var BPromise=require(_0x8e62('0x5'));var rp=require(_0x8e62('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e62('0x7'));var config=require(_0x8e62('0x8'));var attributes=require(_0x8e62('0x9'));var integrations=require(_0x8e62('0xa'));module[_0x8e62('0xb')]=function(_0x4e7a63,_0x748745){return _0x4e7a63[_0x8e62('0xc')](_0x8e62('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index ce46898..3e57686 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 _0x21d1=['request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x21d1,0x1c9));var _0x121d=function(_0x13888b,_0x1c8035){_0x13888b=_0x13888b-0x0;var _0x242c5f=_0x21d1[_0x13888b];return _0x242c5f;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var moment=require(_0x121d('0x2'));var BPromise=require(_0x121d('0x3'));var rs=require(_0x121d('0x4'));var fs=require('fs');var Redis=require(_0x121d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x121d('0x6'))(_0x121d('0x7'));var config=require(_0x121d('0x8'));var jayson=require(_0x121d('0x9'));var client=jayson[_0x121d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x226625,_0x2bd1e8,_0x47b50b){return new BPromise(function(_0x2d4d7e,_0x242f0c){return client[_0x121d('0xb')](_0x226625,_0x47b50b)[_0x121d('0xc')](function(_0x8b07c2){logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,'request\x20sent');logger[_0x121d('0xf')](_0x121d('0x10'),_0x2bd1e8,_0x121d('0x11'),JSON['stringify'](_0x8b07c2));if(_0x8b07c2['error']){if(_0x8b07c2[_0x121d('0x12')][_0x121d('0x13')]===0x1f4){logger[_0x121d('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x242f0c(_0x8b07c2['error'][_0x121d('0x14')]);}logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x2d4d7e(_0x8b07c2[_0x121d('0x12')][_0x121d('0x14')]);}else{logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,_0x121d('0x11'));_0x2d4d7e(_0x8b07c2[_0x121d('0x15')][_0x121d('0x14')]);}})[_0x121d('0x16')](function(_0x475541){logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x475541);_0x242f0c(_0x475541);});});}exports[_0x121d('0x17')]=function(_0x5aee6a){var _0x5a0b2d=this;return new Promise(function(_0x48e041,_0x278593){return db[_0x121d('0x18')]['findAll']({'raw':_0x5aee6a[_0x121d('0x19')]?_0x5aee6a[_0x121d('0x19')][_0x121d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5aee6a[_0x121d('0x19')]?_0x5aee6a[_0x121d('0x19')][_0x121d('0x1b')]||null:null,'attributes':_0x5aee6a[_0x121d('0x19')]?_0x5aee6a[_0x121d('0x19')][_0x121d('0x1c')]||null:null,'limit':_0x5aee6a[_0x121d('0x19')]?_0x5aee6a[_0x121d('0x19')][_0x121d('0x1d')]||null:null,'include':_0x5aee6a[_0x121d('0x19')]?_0x5aee6a[_0x121d('0x19')][_0x121d('0x1e')]?_[_0x121d('0x1f')](_0x5aee6a[_0x121d('0x19')][_0x121d('0x1e')],function(_0x331e9c){return{'model':db[_0x331e9c[_0x121d('0x20')]],'as':_0x331e9c['as'],'attributes':_0x331e9c[_0x121d('0x1c')],'include':_0x331e9c['include']?_[_0x121d('0x1f')](_0x331e9c[_0x121d('0x1e')],function(_0x78cb1a){return{'model':db[_0x78cb1a[_0x121d('0x20')]],'as':_0x78cb1a['as'],'attributes':_0x78cb1a[_0x121d('0x1c')],'include':_0x78cb1a['include']?_[_0x121d('0x1f')](_0x78cb1a['include'],function(_0x2aa75c){return{'model':db[_0x2aa75c[_0x121d('0x20')]],'as':_0x2aa75c['as'],'attributes':_0x2aa75c[_0x121d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x121d('0xc')](function(_0x1683b0){logger[_0x121d('0xd')](_0x121d('0x17'),_0x5aee6a);logger[_0x121d('0xf')](_0x121d('0x17'),_0x5aee6a,JSON[_0x121d('0x21')](_0x1683b0));_0x48e041(_0x1683b0);})['catch'](function(_0x3c041c){logger['error'](_0x121d('0x17'),_0x3c041c[_0x121d('0x14')],_0x5aee6a);_0x278593(_0x5a0b2d[_0x121d('0x12')](0x1f4,_0x3c041c['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2905c4){var _0xd95b6b=this;return new Promise(function(_0x308e96,_0x40e2ba){return db[_0x121d('0x18')][_0x121d('0x22')]({'raw':_0x2905c4[_0x121d('0x19')]?_0x2905c4['options'][_0x121d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2905c4[_0x121d('0x19')]?_0x2905c4[_0x121d('0x19')][_0x121d('0x1b')]||null:null,'attributes':_0x2905c4[_0x121d('0x19')]?_0x2905c4[_0x121d('0x19')][_0x121d('0x1c')]||null:null,'include':_0x2905c4[_0x121d('0x19')]?_0x2905c4['options'][_0x121d('0x1e')]?_[_0x121d('0x1f')](_0x2905c4[_0x121d('0x19')][_0x121d('0x1e')],function(_0x588f1d){return{'model':db[_0x588f1d[_0x121d('0x20')]],'as':_0x588f1d['as'],'attributes':_0x588f1d[_0x121d('0x1c')],'include':_0x588f1d[_0x121d('0x1e')]?_[_0x121d('0x1f')](_0x588f1d['include'],function(_0x1c0d27){return{'model':db[_0x1c0d27[_0x121d('0x20')]],'as':_0x1c0d27['as'],'attributes':_0x1c0d27[_0x121d('0x1c')],'include':_0x1c0d27['include']?_[_0x121d('0x1f')](_0x1c0d27[_0x121d('0x1e')],function(_0xa91e4c){return{'model':db[_0xa91e4c[_0x121d('0x20')]],'as':_0xa91e4c['as'],'attributes':_0xa91e4c[_0x121d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x121d('0xc')](function(_0x2487fa){logger['info'](_0x121d('0x23'),_0x2905c4);logger[_0x121d('0xf')](_0x121d('0x23'),_0x2905c4,JSON[_0x121d('0x21')](_0x2487fa));_0x308e96(_0x2487fa);})['catch'](function(_0x476733){logger[_0x121d('0x12')](_0x121d('0x23'),_0x476733[_0x121d('0x14')],_0x2905c4);_0x40e2ba(_0xd95b6b[_0x121d('0x12')](0x1f4,_0x476733[_0x121d('0x14')]));});});}; \ No newline at end of file +var _0x2816=['request\x20sent','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x7ad54d,_0x4ab1ea){var _0x2eed9f=function(_0x273d6a){while(--_0x273d6a){_0x7ad54d['push'](_0x7ad54d['shift']());}};_0x2eed9f(++_0x4ab1ea);}(_0x2816,0xc2));var _0x6281=function(_0x5dcedb,_0x3e459e){_0x5dcedb=_0x5dcedb-0x0;var _0x264ca5=_0x2816[_0x5dcedb];return _0x264ca5;};'use strict';var _=require(_0x6281('0x0'));var util=require(_0x6281('0x1'));var moment=require('moment');var BPromise=require(_0x6281('0x2'));var rs=require(_0x6281('0x3'));var fs=require('fs');var Redis=require(_0x6281('0x4'));var db=require(_0x6281('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6281('0x6'));var config=require(_0x6281('0x7'));var jayson=require(_0x6281('0x8'));var client=jayson[_0x6281('0x9')][_0x6281('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9155,_0x26b1d1,_0x3aff6e){return new BPromise(function(_0x2cd564,_0x5cca8c){return client['request'](_0x3f9155,_0x3aff6e)[_0x6281('0xb')](function(_0x587a14){logger[_0x6281('0xc')](_0x6281('0xd'),_0x26b1d1,'request\x20sent');logger[_0x6281('0xe')](_0x6281('0xf'),_0x26b1d1,_0x6281('0x10'),JSON[_0x6281('0x11')](_0x587a14));if(_0x587a14[_0x6281('0x12')]){if(_0x587a14[_0x6281('0x12')]['code']===0x1f4){logger[_0x6281('0x12')](_0x6281('0xd'),_0x26b1d1,_0x587a14[_0x6281('0x12')][_0x6281('0x13')]);return _0x5cca8c(_0x587a14[_0x6281('0x12')]['message']);}logger[_0x6281('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x26b1d1,_0x587a14[_0x6281('0x12')][_0x6281('0x13')]);return _0x2cd564(_0x587a14[_0x6281('0x12')][_0x6281('0x13')]);}else{logger['info'](_0x6281('0xd'),_0x26b1d1,'request\x20sent');_0x2cd564(_0x587a14[_0x6281('0x14')]['message']);}})[_0x6281('0x15')](function(_0x458f1c){logger[_0x6281('0x12')](_0x6281('0xd'),_0x26b1d1,_0x458f1c);_0x5cca8c(_0x458f1c);});});}exports[_0x6281('0x16')]=function(_0x180302){var _0x4acf3f=this;return new Promise(function(_0x337bb0,_0x5ac3b8){return db[_0x6281('0x17')][_0x6281('0x18')]({'raw':_0x180302[_0x6281('0x19')]?_0x180302['options'][_0x6281('0x1a')]===undefined?!![]:![]:!![],'where':_0x180302[_0x6281('0x19')]?_0x180302[_0x6281('0x19')][_0x6281('0x1b')]||null:null,'attributes':_0x180302['options']?_0x180302[_0x6281('0x19')][_0x6281('0x1c')]||null:null,'limit':_0x180302[_0x6281('0x19')]?_0x180302[_0x6281('0x19')][_0x6281('0x1d')]||null:null,'include':_0x180302[_0x6281('0x19')]?_0x180302[_0x6281('0x19')][_0x6281('0x1e')]?_[_0x6281('0x1f')](_0x180302[_0x6281('0x19')][_0x6281('0x1e')],function(_0x253e5c){return{'model':db[_0x253e5c['model']],'as':_0x253e5c['as'],'attributes':_0x253e5c[_0x6281('0x1c')],'include':_0x253e5c['include']?_[_0x6281('0x1f')](_0x253e5c['include'],function(_0x3a6f69){return{'model':db[_0x3a6f69[_0x6281('0x20')]],'as':_0x3a6f69['as'],'attributes':_0x3a6f69['attributes'],'include':_0x3a6f69['include']?_[_0x6281('0x1f')](_0x3a6f69[_0x6281('0x1e')],function(_0x55b931){return{'model':db[_0x55b931[_0x6281('0x20')]],'as':_0x55b931['as'],'attributes':_0x55b931[_0x6281('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6281('0xb')](function(_0x13e577){logger[_0x6281('0xc')]('GetFreshdeskAccount',_0x180302);logger[_0x6281('0xe')](_0x6281('0x16'),_0x180302,JSON[_0x6281('0x11')](_0x13e577));_0x337bb0(_0x13e577);})[_0x6281('0x15')](function(_0x5348bd){logger[_0x6281('0x12')](_0x6281('0x16'),_0x5348bd[_0x6281('0x13')],_0x180302);_0x5ac3b8(_0x4acf3f[_0x6281('0x12')](0x1f4,_0x5348bd[_0x6281('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0xd3f976){var _0x1a7774=this;return new Promise(function(_0xde5378,_0x195a45){return db[_0x6281('0x17')][_0x6281('0x21')]({'raw':_0xd3f976['options']?_0xd3f976[_0x6281('0x19')][_0x6281('0x1a')]===undefined?!![]:![]:!![],'where':_0xd3f976[_0x6281('0x19')]?_0xd3f976[_0x6281('0x19')][_0x6281('0x1b')]||null:null,'attributes':_0xd3f976[_0x6281('0x19')]?_0xd3f976[_0x6281('0x19')][_0x6281('0x1c')]||null:null,'include':_0xd3f976['options']?_0xd3f976[_0x6281('0x19')][_0x6281('0x1e')]?_[_0x6281('0x1f')](_0xd3f976[_0x6281('0x19')]['include'],function(_0x4ed6b2){return{'model':db[_0x4ed6b2[_0x6281('0x20')]],'as':_0x4ed6b2['as'],'attributes':_0x4ed6b2[_0x6281('0x1c')],'include':_0x4ed6b2['include']?_[_0x6281('0x1f')](_0x4ed6b2[_0x6281('0x1e')],function(_0x1a8803){return{'model':db[_0x1a8803[_0x6281('0x20')]],'as':_0x1a8803['as'],'attributes':_0x1a8803[_0x6281('0x1c')],'include':_0x1a8803['include']?_[_0x6281('0x1f')](_0x1a8803[_0x6281('0x1e')],function(_0x555474){return{'model':db[_0x555474[_0x6281('0x20')]],'as':_0x555474['as'],'attributes':_0x555474['attributes']};}):[]};}):[]};}):[]:[]})[_0x6281('0xb')](function(_0x1da9af){logger[_0x6281('0xc')](_0x6281('0x22'),_0xd3f976);logger[_0x6281('0xe')](_0x6281('0x22'),_0xd3f976,JSON[_0x6281('0x11')](_0x1da9af));_0xde5378(_0x1da9af);})[_0x6281('0x15')](function(_0xa078df){logger[_0x6281('0x12')]('ShowFreshdeskAccount',_0xa078df[_0x6281('0x13')],_0xd3f976);_0x195a45(_0x1a7774[_0x6281('0x12')](0x1f4,_0xa078df[_0x6281('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1a39a9c..cf6b1ac 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 _0xe4c4=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','index','get','/:id','isAuthenticated'];(function(_0x4c5034,_0x264da9){var _0x139f2f=function(_0x5544d7){while(--_0x5544d7){_0x4c5034['push'](_0x4c5034['shift']());}};_0x139f2f(++_0x264da9);}(_0xe4c4,0x18c));var _0x4e4c=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0xe4c4[_0x27bcf5];return _0x4ce4cf;};'use strict';var multer=require(_0x4e4c('0x0'));var util=require(_0x4e4c('0x1'));var path=require('path');var timeout=require(_0x4e4c('0x2'));var express=require('express');var router=express[_0x4e4c('0x3')]();var fs_extra=require(_0x4e4c('0x4'));var auth=require(_0x4e4c('0x5'));var interaction=require(_0x4e4c('0x6'));var config=require('../../config/environment');var controller=require(_0x4e4c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e4c('0x8')]);router[_0x4e4c('0x9')](_0x4e4c('0xa'),auth[_0x4e4c('0xb')](),controller[_0x4e4c('0xc')]);router[_0x4e4c('0x9')](_0x4e4c('0xd'),auth[_0x4e4c('0xb')](),controller['getFields']);router['get'](_0x4e4c('0xe'),auth['isAuthenticated'](),controller[_0x4e4c('0xf')]);router[_0x4e4c('0x9')](_0x4e4c('0x10'),auth[_0x4e4c('0xb')](),controller[_0x4e4c('0x11')]);router[_0x4e4c('0x9')](_0x4e4c('0x12'),auth[_0x4e4c('0xb')](),controller[_0x4e4c('0x13')]);router[_0x4e4c('0x14')]('/',auth[_0x4e4c('0xb')](),controller[_0x4e4c('0x15')]);router[_0x4e4c('0x14')](_0x4e4c('0x12'),auth[_0x4e4c('0xb')](),controller['setTags']);router[_0x4e4c('0x16')]('/:id',auth[_0x4e4c('0xb')](),controller['update']);router['delete'](_0x4e4c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e4c('0x17')]=router; \ No newline at end of file +var _0x7ff5=['get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x2355e1,_0x1bf0f5){var _0x239466=function(_0x51c990){while(--_0x51c990){_0x2355e1['push'](_0x2355e1['shift']());}};_0x239466(++_0x1bf0f5);}(_0x7ff5,0x1a6));var _0x57ff=function(_0x2be361,_0x44e8e7){_0x2be361=_0x2be361-0x0;var _0x2c819f=_0x7ff5[_0x2be361];return _0x2c819f;};'use strict';var multer=require(_0x57ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x57ff('0x1'));var express=require('express');var router=express[_0x57ff('0x2')]();var fs_extra=require(_0x57ff('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57ff('0x4'));var controller=require(_0x57ff('0x5'));router['get']('/',auth[_0x57ff('0x6')](),controller[_0x57ff('0x7')]);router['get'](_0x57ff('0x8'),auth[_0x57ff('0x6')](),controller[_0x57ff('0x9')]);router[_0x57ff('0xa')](_0x57ff('0xb'),auth[_0x57ff('0x6')](),controller[_0x57ff('0xc')]);router['get'](_0x57ff('0xd'),auth[_0x57ff('0x6')](),controller['getSubjects']);router[_0x57ff('0xa')](_0x57ff('0xe'),auth['isAuthenticated'](),controller[_0x57ff('0xf')]);router[_0x57ff('0xa')](_0x57ff('0x10'),auth[_0x57ff('0x6')](),controller['getTags']);router[_0x57ff('0x11')]('/',auth[_0x57ff('0x6')](),controller[_0x57ff('0x12')]);router[_0x57ff('0x11')]('/:id/tags',auth[_0x57ff('0x6')](),controller[_0x57ff('0x13')]);router[_0x57ff('0x14')](_0x57ff('0x8'),auth[_0x57ff('0x6')](),controller[_0x57ff('0x15')]);router[_0x57ff('0x16')](_0x57ff('0x8'),auth[_0x57ff('0x6')](),controller[_0x57ff('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 5116915..f2426c8 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 _0x2d1e=['STRING','sequelize'];(function(_0x553c73,_0x3eb2ad){var _0x56f9bb=function(_0x308293){while(--_0x308293){_0x553c73['push'](_0x553c73['shift']());}};_0x56f9bb(++_0x3eb2ad);}(_0x2d1e,0x153));var _0xe2d1=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2d1e[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xe2d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2d1('0x1')]},'description':{'type':Sequelize[_0xe2d1('0x1')]}}; \ No newline at end of file +var _0x5e8c=['STRING','sequelize','exports'];(function(_0x5b96e9,_0x1246ed){var _0x1c3876=function(_0x13fe8b){while(--_0x13fe8b){_0x5b96e9['push'](_0x5b96e9['shift']());}};_0x1c3876(++_0x1246ed);}(_0x5e8c,0x187));var _0xc5e8=function(_0x5387cf,_0x8d656e){_0x5387cf=_0x5387cf-0x0;var _0x156ed0=_0x5e8c[_0x5387cf];return _0x156ed0;};'use strict';var Sequelize=require(_0xc5e8('0x0'));module[_0xc5e8('0x1')]={'name':{'type':Sequelize[_0xc5e8('0x2')]},'description':{'type':Sequelize[_0xc5e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 508b7f3..c695718 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 _0x4522=['model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','FreshdeskConfiguration','type','query','filters','intersection','attributes'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x4522,0x7d));var _0x2452=function(_0x135245,_0x207e50){_0x135245=_0x135245-0x0;var _0x3c91c7=_0x4522[_0x135245];return _0x3c91c7;};'use strict';var emlformat=require(_0x2452('0x0'));var rimraf=require(_0x2452('0x1'));var zipdir=require(_0x2452('0x2'));var jsonpatch=require(_0x2452('0x3'));var rp=require(_0x2452('0x4'));var moment=require(_0x2452('0x5'));var BPromise=require(_0x2452('0x6'));var Mustache=require(_0x2452('0x7'));var util=require(_0x2452('0x8'));var path=require(_0x2452('0x9'));var sox=require(_0x2452('0xa'));var csv=require(_0x2452('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2452('0xc'));var _=require(_0x2452('0xd'));var squel=require(_0x2452('0xe'));var crypto=require(_0x2452('0xf'));var jsforce=require(_0x2452('0x10'));var deskjs=require(_0x2452('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2452('0x12'));var Papa=require(_0x2452('0x13'));var Redis=require(_0x2452('0x14'));var authService=require(_0x2452('0x15'));var qs=require(_0x2452('0x16'));var as=require(_0x2452('0x17'));var hardwareService=require(_0x2452('0x18'));var logger=require(_0x2452('0x19'))(_0x2452('0x1a'));var utils=require(_0x2452('0x1b'));var config=require(_0x2452('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x2452('0x1d'))['db'];function respondWithStatusCode(_0x16cbc1,_0x8abf1e){_0x8abf1e=_0x8abf1e||0xcc;return function(_0x4d42db){if(_0x4d42db){return _0x16cbc1[_0x2452('0x1e')](_0x8abf1e);}return _0x16cbc1[_0x2452('0x1f')](_0x8abf1e)['end']();};}function respondWithResult(_0x366ac9,_0x23b9b3){_0x23b9b3=_0x23b9b3||0xc8;return function(_0x2b1519){if(_0x2b1519){return _0x366ac9[_0x2452('0x1f')](_0x23b9b3)[_0x2452('0x20')](_0x2b1519);}};}function respondWithFilteredResult(_0x4853fe,_0x4dd346){return function(_0x3b9f65){if(_0x3b9f65){var _0x3e8b32=typeof _0x4dd346[_0x2452('0x21')]===_0x2452('0x22')&&typeof _0x4dd346[_0x2452('0x23')]===_0x2452('0x22');var _0x1c71c5=_0x3b9f65['count'];var _0x4a844f=_0x3e8b32?0x0:_0x4dd346[_0x2452('0x21')];var _0x12eb65=_0x3e8b32?_0x3b9f65['count']:_0x4dd346[_0x2452('0x21')]+_0x4dd346[_0x2452('0x23')];var _0x3ef2fe;if(_0x12eb65>=_0x1c71c5){_0x12eb65=_0x1c71c5;_0x3ef2fe=0xc8;}else{_0x3ef2fe=0xce;}_0x4853fe[_0x2452('0x1f')](_0x3ef2fe);return _0x4853fe[_0x2452('0x24')](_0x2452('0x25'),_0x4a844f+'-'+_0x12eb65+'/'+_0x1c71c5)[_0x2452('0x20')](_0x3b9f65);}return null;};}function patchUpdates(_0x3ce5e5){return function(_0x4ac8e5){try{jsonpatch[_0x2452('0x26')](_0x4ac8e5,_0x3ce5e5,!![]);}catch(_0x510f51){return BPromise[_0x2452('0x27')](_0x510f51);}return _0x4ac8e5[_0x2452('0x28')]();};}function saveUpdates(_0x1980ab,_0xaa4315){return function(_0x5ae3ee){if(_0x5ae3ee){return _0x5ae3ee['update'](_0x1980ab)[_0x2452('0x29')](function(_0x5c947b){return _0x5c947b;});}return null;};}function removeEntity(_0x235e30,_0x58ed65){return function(_0x475d0c){if(_0x475d0c){return _0x475d0c[_0x2452('0x2a')]()[_0x2452('0x29')](function(){_0x235e30[_0x2452('0x1f')](0xcc)[_0x2452('0x2b')]();});}};}function handleEntityNotFound(_0x1e5a1f,_0x3bc7c4){return function(_0x1bb600){if(!_0x1bb600){_0x1e5a1f['sendStatus'](0x194);}return _0x1bb600;};}function handleError(_0x5f3a9d,_0x13f43f){_0x13f43f=_0x13f43f||0x1f4;return function(_0x4fc662){logger[_0x2452('0x2c')](_0x4fc662[_0x2452('0x2d')]);if(_0x4fc662[_0x2452('0x2e')]){delete _0x4fc662['name'];}_0x5f3a9d['status'](_0x13f43f)['send'](_0x4fc662);};}exports[_0x2452('0x2f')]=function(_0x398d94,_0xbd8302){var _0x3dd382={},_0x278689={},_0x57722f={'count':0x0,'rows':[]};var _0x28894e=_[_0x2452('0x30')](db[_0x2452('0x31')]['rawAttributes'],function(_0x56f8ef){return{'name':_0x56f8ef['fieldName'],'type':_0x56f8ef[_0x2452('0x32')]['key']};});_0x278689['model']=_[_0x2452('0x30')](_0x28894e,_0x2452('0x2e'));_0x278689[_0x2452('0x33')]=_['keys'](_0x398d94[_0x2452('0x33')]);_0x278689[_0x2452('0x34')]=_[_0x2452('0x35')](_0x278689['model'],_0x278689['query']);_0x3dd382[_0x2452('0x36')]=_[_0x2452('0x35')](_0x278689[_0x2452('0x37')],qs[_0x2452('0x38')](_0x398d94[_0x2452('0x33')][_0x2452('0x38')]));_0x3dd382[_0x2452('0x36')]=_0x3dd382[_0x2452('0x36')][_0x2452('0x39')]?_0x3dd382[_0x2452('0x36')]:_0x278689['model'];if(!_0x398d94['query'][_0x2452('0x3a')](_0x2452('0x3b'))){_0x3dd382[_0x2452('0x23')]=qs[_0x2452('0x23')](_0x398d94[_0x2452('0x33')][_0x2452('0x23')]);_0x3dd382[_0x2452('0x21')]=qs[_0x2452('0x21')](_0x398d94[_0x2452('0x33')]['offset']);}_0x3dd382[_0x2452('0x3c')]=qs[_0x2452('0x3d')](_0x398d94[_0x2452('0x33')]['sort']);_0x3dd382[_0x2452('0x3e')]=qs[_0x2452('0x34')](_[_0x2452('0x3f')](_0x398d94[_0x2452('0x33')],_0x278689[_0x2452('0x34')]),_0x28894e);if(_0x398d94[_0x2452('0x33')][_0x2452('0x40')]){_0x3dd382[_0x2452('0x3e')]=_[_0x2452('0x41')](_0x3dd382[_0x2452('0x3e')],{'$or':_[_0x2452('0x30')](_0x28894e,function(_0x29a7c1){if(_0x29a7c1[_0x2452('0x32')]!==_0x2452('0x42')){var _0x196185={};_0x196185[_0x29a7c1[_0x2452('0x2e')]]={'$like':'%'+_0x398d94[_0x2452('0x33')][_0x2452('0x40')]+'%'};return _0x196185;}})});}_0x3dd382=_[_0x2452('0x41')]({},_0x3dd382,_0x398d94[_0x2452('0x43')]);var _0x50f95f={'where':_0x3dd382[_0x2452('0x3e')]};return db['FreshdeskConfiguration'][_0x2452('0x44')](_0x50f95f)[_0x2452('0x29')](function(_0x153766){_0x57722f[_0x2452('0x44')]=_0x153766;if(_0x398d94[_0x2452('0x33')][_0x2452('0x45')]){_0x3dd382[_0x2452('0x46')]=[{'all':!![]}];}return db[_0x2452('0x31')][_0x2452('0x47')](_0x3dd382);})[_0x2452('0x29')](function(_0x49d796){_0x57722f[_0x2452('0x48')]=_0x49d796;return _0x57722f;})[_0x2452('0x29')](respondWithFilteredResult(_0xbd8302,_0x3dd382))[_0x2452('0x49')](handleError(_0xbd8302,null));};exports[_0x2452('0x4a')]=function(_0x529c28,_0x184137){var _0x4e50ea={'raw':![],'where':{'id':_0x529c28[_0x2452('0x4b')]['id']}},_0x423b5b={};_0x423b5b[_0x2452('0x37')]=_[_0x2452('0x4c')](db[_0x2452('0x31')][_0x2452('0x4d')]);_0x423b5b[_0x2452('0x33')]=_[_0x2452('0x4c')](_0x529c28[_0x2452('0x33')]);_0x423b5b[_0x2452('0x34')]=_[_0x2452('0x35')](_0x423b5b[_0x2452('0x37')],_0x423b5b[_0x2452('0x33')]);_0x4e50ea['attributes']=_['intersection'](_0x423b5b[_0x2452('0x37')],qs[_0x2452('0x38')](_0x529c28[_0x2452('0x33')][_0x2452('0x38')]));_0x4e50ea[_0x2452('0x36')]=_0x4e50ea['attributes'][_0x2452('0x39')]?_0x4e50ea[_0x2452('0x36')]:_0x423b5b[_0x2452('0x37')];if(_0x529c28[_0x2452('0x33')][_0x2452('0x45')]){_0x4e50ea[_0x2452('0x46')]=[{'all':!![]}];}_0x4e50ea=_[_0x2452('0x41')]({},_0x4e50ea,_0x529c28[_0x2452('0x43')]);return db[_0x2452('0x31')][_0x2452('0x4e')](_0x4e50ea)[_0x2452('0x29')](handleEntityNotFound(_0x184137,null))[_0x2452('0x29')](respondWithResult(_0x184137,null))[_0x2452('0x49')](handleError(_0x184137,null));};exports[_0x2452('0x4f')]=function(_0x28a1af,_0x5df9aa){return db[_0x2452('0x31')][_0x2452('0x4f')](_0x28a1af[_0x2452('0x50')],{})['then'](respondWithResult(_0x5df9aa,0xc9))[_0x2452('0x49')](handleError(_0x5df9aa,null));};exports['update']=function(_0x2b0f2f,_0x198b46){if(_0x2b0f2f[_0x2452('0x50')]['id']){delete _0x2b0f2f[_0x2452('0x50')]['id'];}return db[_0x2452('0x31')][_0x2452('0x4e')]({'where':{'id':_0x2b0f2f['params']['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x198b46,null))[_0x2452('0x29')](saveUpdates(_0x2b0f2f[_0x2452('0x50')],null))['then'](respondWithResult(_0x198b46,null))['catch'](handleError(_0x198b46,null));};exports[_0x2452('0x2a')]=function(_0x4a17e9,_0x165db2){return db[_0x2452('0x31')][_0x2452('0x4e')]({'where':{'id':_0x4a17e9['params']['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x165db2,null))[_0x2452('0x29')](removeEntity(_0x165db2,null))[_0x2452('0x49')](handleError(_0x165db2,null));};exports['getFields']=function(_0x2d534e,_0xd6f85d,_0x4701f0){var _0x4dbd97={};var _0x5226ea={};var _0x17c779;var _0x1eb957;return db['FreshdeskConfiguration'][_0x2452('0x51')]({'where':{'id':_0x2d534e[_0x2452('0x4b')]['id']}})[_0x2452('0x29')](handleEntityNotFound(_0xd6f85d,null))[_0x2452('0x29')](function(_0x3b0167){if(_0x3b0167){_0x17c779=_0x3b0167;_0x5226ea[_0x2452('0x37')]=_[_0x2452('0x4c')](db[_0x2452('0x52')]['rawAttributes']);_0x5226ea[_0x2452('0x33')]=_[_0x2452('0x4c')](_0x2d534e[_0x2452('0x33')]);_0x5226ea[_0x2452('0x34')]=_[_0x2452('0x35')](_0x5226ea[_0x2452('0x37')],_0x5226ea['query']);_0x4dbd97[_0x2452('0x36')]=_[_0x2452('0x35')](_0x5226ea[_0x2452('0x37')],qs[_0x2452('0x38')](_0x2d534e[_0x2452('0x33')][_0x2452('0x38')]));_0x4dbd97[_0x2452('0x36')]=_0x4dbd97[_0x2452('0x36')][_0x2452('0x39')]?_0x4dbd97['attributes']:_0x5226ea[_0x2452('0x37')];_0x4dbd97[_0x2452('0x3c')]=qs[_0x2452('0x3d')](_0x2d534e[_0x2452('0x33')][_0x2452('0x3d')]);_0x4dbd97[_0x2452('0x3e')]=qs[_0x2452('0x34')](_[_0x2452('0x3f')](_0x2d534e[_0x2452('0x33')],_0x5226ea[_0x2452('0x34')]));if(_0x2d534e['query'][_0x2452('0x40')]){_0x4dbd97[_0x2452('0x3e')]=_[_0x2452('0x41')](_0x4dbd97[_0x2452('0x3e')],{'$or':_[_0x2452('0x30')](_0x4dbd97['attributes'],function(_0x255e4d){var _0x57d3af={};_0x57d3af[_0x255e4d]={'$like':'%'+_0x2d534e['query'][_0x2452('0x40')]+'%'};return _0x57d3af;})});}_0x4dbd97=_[_0x2452('0x41')]({},_0x4dbd97,_0x2d534e['options']);return _0x17c779[_0x2452('0x53')](_0x4dbd97);}})['then'](function(_0x37eef4){if(_0x37eef4){_0x1eb957=_0x37eef4[_0x2452('0x39')];if(!_0x2d534e[_0x2452('0x33')]['hasOwnProperty'](_0x2452('0x3b'))){_0x4dbd97['limit']=qs[_0x2452('0x23')](_0x2d534e[_0x2452('0x33')][_0x2452('0x23')]);_0x4dbd97[_0x2452('0x21')]=qs['offset'](_0x2d534e[_0x2452('0x33')][_0x2452('0x21')]);}return _0x17c779[_0x2452('0x53')](_0x4dbd97);}})[_0x2452('0x29')](function(_0x237195){if(_0x237195){return _0x237195?{'count':_0x1eb957,'rows':_0x237195}:null;}})[_0x2452('0x29')](respondWithResult(_0xd6f85d,null))[_0x2452('0x49')](handleError(_0xd6f85d,null));};exports['getSubjects']=function(_0x37cf34,_0x24e21f,_0x3fcd69){var _0x3c3c40={};var _0x3c4ef4={};var _0x4e6fda;var _0x135490;return db[_0x2452('0x31')][_0x2452('0x51')]({'where':{'id':_0x37cf34[_0x2452('0x4b')]['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x24e21f,null))[_0x2452('0x29')](function(_0x18a9de){if(_0x18a9de){_0x4e6fda=_0x18a9de;_0x3c4ef4[_0x2452('0x37')]=_[_0x2452('0x4c')](db[_0x2452('0x52')][_0x2452('0x4d')]);_0x3c4ef4[_0x2452('0x33')]=_[_0x2452('0x4c')](_0x37cf34[_0x2452('0x33')]);_0x3c4ef4['filters']=_['intersection'](_0x3c4ef4[_0x2452('0x37')],_0x3c4ef4[_0x2452('0x33')]);_0x3c3c40[_0x2452('0x36')]=_[_0x2452('0x35')](_0x3c4ef4[_0x2452('0x37')],qs[_0x2452('0x38')](_0x37cf34[_0x2452('0x33')]['fields']));_0x3c3c40[_0x2452('0x36')]=_0x3c3c40[_0x2452('0x36')]['length']?_0x3c3c40[_0x2452('0x36')]:_0x3c4ef4[_0x2452('0x37')];_0x3c3c40['order']=qs[_0x2452('0x3d')](_0x37cf34[_0x2452('0x33')][_0x2452('0x3d')]);_0x3c3c40[_0x2452('0x3e')]=qs[_0x2452('0x34')](_[_0x2452('0x3f')](_0x37cf34['query'],_0x3c4ef4[_0x2452('0x34')]));if(_0x37cf34[_0x2452('0x33')][_0x2452('0x40')]){_0x3c3c40[_0x2452('0x3e')]=_[_0x2452('0x41')](_0x3c3c40[_0x2452('0x3e')],{'$or':_[_0x2452('0x30')](_0x3c3c40[_0x2452('0x36')],function(_0x4fdcff){var _0x4664cd={};_0x4664cd[_0x4fdcff]={'$like':'%'+_0x37cf34[_0x2452('0x33')][_0x2452('0x40')]+'%'};return _0x4664cd;})});}_0x3c3c40=_['merge']({},_0x3c3c40,_0x37cf34[_0x2452('0x43')]);return _0x4e6fda[_0x2452('0x54')](_0x3c3c40);}})['then'](function(_0x28cb13){if(_0x28cb13){_0x135490=_0x28cb13[_0x2452('0x39')];if(!_0x37cf34[_0x2452('0x33')]['hasOwnProperty']('nolimit')){_0x3c3c40[_0x2452('0x23')]=qs['limit'](_0x37cf34['query'][_0x2452('0x23')]);_0x3c3c40['offset']=qs[_0x2452('0x21')](_0x37cf34[_0x2452('0x33')][_0x2452('0x21')]);}return _0x4e6fda[_0x2452('0x54')](_0x3c3c40);}})[_0x2452('0x29')](function(_0x4e00d8){if(_0x4e00d8){return _0x4e00d8?{'count':_0x135490,'rows':_0x4e00d8}:null;}})[_0x2452('0x29')](respondWithResult(_0x24e21f,null))['catch'](handleError(_0x24e21f,null));};exports[_0x2452('0x55')]=function(_0x1c05d2,_0x2b0fb0,_0x406234){var _0xf09ab9={};var _0x285f4d={};var _0x4f03f7;var _0x36df4a;return db[_0x2452('0x31')][_0x2452('0x51')]({'where':{'id':_0x1c05d2[_0x2452('0x4b')]['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x2b0fb0,null))['then'](function(_0x1376fe){if(_0x1376fe){_0x4f03f7=_0x1376fe;_0x285f4d[_0x2452('0x37')]=_['keys'](db['FreshdeskField'][_0x2452('0x4d')]);_0x285f4d['query']=_[_0x2452('0x4c')](_0x1c05d2[_0x2452('0x33')]);_0x285f4d[_0x2452('0x34')]=_['intersection'](_0x285f4d[_0x2452('0x37')],_0x285f4d[_0x2452('0x33')]);_0xf09ab9[_0x2452('0x36')]=_[_0x2452('0x35')](_0x285f4d[_0x2452('0x37')],qs[_0x2452('0x38')](_0x1c05d2['query']['fields']));_0xf09ab9[_0x2452('0x36')]=_0xf09ab9[_0x2452('0x36')][_0x2452('0x39')]?_0xf09ab9[_0x2452('0x36')]:_0x285f4d['model'];_0xf09ab9[_0x2452('0x3c')]=qs[_0x2452('0x3d')](_0x1c05d2[_0x2452('0x33')][_0x2452('0x3d')]);_0xf09ab9[_0x2452('0x3e')]=qs['filters'](_[_0x2452('0x3f')](_0x1c05d2[_0x2452('0x33')],_0x285f4d['filters']));if(_0x1c05d2['query'][_0x2452('0x40')]){_0xf09ab9[_0x2452('0x3e')]=_[_0x2452('0x41')](_0xf09ab9[_0x2452('0x3e')],{'$or':_[_0x2452('0x30')](_0xf09ab9[_0x2452('0x36')],function(_0x8f8483){var _0x5e4a5b={};_0x5e4a5b[_0x8f8483]={'$like':'%'+_0x1c05d2['query'][_0x2452('0x40')]+'%'};return _0x5e4a5b;})});}_0xf09ab9=_[_0x2452('0x41')]({},_0xf09ab9,_0x1c05d2['options']);return _0x4f03f7['getDescriptions'](_0xf09ab9);}})[_0x2452('0x29')](function(_0x38c706){if(_0x38c706){_0x36df4a=_0x38c706[_0x2452('0x39')];if(!_0x1c05d2[_0x2452('0x33')][_0x2452('0x3a')](_0x2452('0x3b'))){_0xf09ab9[_0x2452('0x23')]=qs['limit'](_0x1c05d2[_0x2452('0x33')]['limit']);_0xf09ab9[_0x2452('0x21')]=qs[_0x2452('0x21')](_0x1c05d2[_0x2452('0x33')]['offset']);}return _0x4f03f7[_0x2452('0x55')](_0xf09ab9);}})['then'](function(_0x30ac37){if(_0x30ac37){return _0x30ac37?{'count':_0x36df4a,'rows':_0x30ac37}:null;}})[_0x2452('0x29')](respondWithResult(_0x2b0fb0,null))['catch'](handleError(_0x2b0fb0,null));};exports[_0x2452('0x56')]=function(_0x46dd0e,_0x44d1f9,_0x582288){var _0x55637c={};var _0x1b76d5={};var _0x3b7e7a;var _0x2b49bb;return db[_0x2452('0x31')]['findOne']({'where':{'id':_0x46dd0e['params']['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x44d1f9,null))[_0x2452('0x29')](function(_0x2478fd){if(_0x2478fd){_0x3b7e7a=_0x2478fd;_0x1b76d5[_0x2452('0x37')]=_[_0x2452('0x4c')](db[_0x2452('0x57')][_0x2452('0x4d')]);_0x1b76d5[_0x2452('0x33')]=_['keys'](_0x46dd0e[_0x2452('0x33')]);_0x1b76d5[_0x2452('0x34')]=_[_0x2452('0x35')](_0x1b76d5[_0x2452('0x37')],_0x1b76d5[_0x2452('0x33')]);_0x55637c[_0x2452('0x36')]=_[_0x2452('0x35')](_0x1b76d5[_0x2452('0x37')],qs[_0x2452('0x38')](_0x46dd0e['query'][_0x2452('0x38')]));_0x55637c[_0x2452('0x36')]=_0x55637c['attributes']['length']?_0x55637c[_0x2452('0x36')]:_0x1b76d5[_0x2452('0x37')];_0x55637c['order']=qs[_0x2452('0x3d')](_0x46dd0e['query'][_0x2452('0x3d')]);_0x55637c[_0x2452('0x3e')]=qs[_0x2452('0x34')](_[_0x2452('0x3f')](_0x46dd0e[_0x2452('0x33')],_0x1b76d5[_0x2452('0x34')]));if(_0x46dd0e[_0x2452('0x33')][_0x2452('0x40')]){_0x55637c[_0x2452('0x3e')]=_['merge'](_0x55637c['where'],{'$or':_[_0x2452('0x30')](_0x55637c['attributes'],function(_0x14dc67){var _0x442ed1={};_0x442ed1[_0x14dc67]={'$like':'%'+_0x46dd0e[_0x2452('0x33')][_0x2452('0x40')]+'%'};return _0x442ed1;})});}_0x55637c=_[_0x2452('0x41')]({},_0x55637c,_0x46dd0e[_0x2452('0x43')]);return _0x3b7e7a[_0x2452('0x56')](_0x55637c);}})[_0x2452('0x29')](function(_0xadbdcd){if(_0xadbdcd){_0x2b49bb=_0xadbdcd[_0x2452('0x39')];if(!_0x46dd0e[_0x2452('0x33')]['hasOwnProperty'](_0x2452('0x3b'))){_0x55637c[_0x2452('0x23')]=qs['limit'](_0x46dd0e[_0x2452('0x33')][_0x2452('0x23')]);_0x55637c['offset']=qs[_0x2452('0x21')](_0x46dd0e[_0x2452('0x33')][_0x2452('0x21')]);}return _0x3b7e7a[_0x2452('0x56')](_0x55637c);}})[_0x2452('0x29')](function(_0x213283){if(_0x213283){return _0x213283?{'count':_0x2b49bb,'rows':_0x213283}:null;}})[_0x2452('0x29')](respondWithResult(_0x44d1f9,null))['catch'](handleError(_0x44d1f9,null));};exports[_0x2452('0x58')]=function(_0x43227b,_0x8ccfef,_0x56cdee){if(_0x43227b[_0x2452('0x50')]['id']){delete _0x43227b['body']['id'];}return db[_0x2452('0x31')][_0x2452('0x51')]({'where':{'id':_0x43227b[_0x2452('0x4b')]['id']}})[_0x2452('0x29')](handleEntityNotFound(_0x8ccfef,null))[_0x2452('0x29')](function(_0x4ba0e9){if(_0x4ba0e9){return _0x4ba0e9[_0x2452('0x58')](_0x43227b[_0x2452('0x50')][_0x2452('0x59')]||[]);}return null;})[_0x2452('0x29')](respondWithResult(_0x8ccfef,null))[_0x2452('0x49')](handleError(_0x8ccfef,null));}; \ No newline at end of file +var _0xad10=['catch','show','params','rawAttributes','find','create','body','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','FreshdeskConfiguration','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0xad10,0x168));var _0x0ad1=function(_0x190b62,_0x104962){_0x190b62=_0x190b62-0x0;var _0x2dae71=_0xad10[_0x190b62];return _0x2dae71;};'use strict';var emlformat=require(_0x0ad1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ad1('0x1'));var jsonpatch=require(_0x0ad1('0x2'));var rp=require('request-promise');var moment=require(_0x0ad1('0x3'));var BPromise=require(_0x0ad1('0x4'));var Mustache=require(_0x0ad1('0x5'));var util=require('util');var path=require(_0x0ad1('0x6'));var sox=require(_0x0ad1('0x7'));var csv=require(_0x0ad1('0x8'));var ejs=require(_0x0ad1('0x9'));var fs=require('fs');var fs_extra=require(_0x0ad1('0xa'));var _=require(_0x0ad1('0xb'));var squel=require('squel');var crypto=require(_0x0ad1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ad1('0xd'));var Papa=require(_0x0ad1('0xe'));var Redis=require(_0x0ad1('0xf'));var authService=require(_0x0ad1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0ad1('0x11'));var hardwareService=require(_0x0ad1('0x12'));var logger=require(_0x0ad1('0x13'))(_0x0ad1('0x14'));var utils=require(_0x0ad1('0x15'));var config=require(_0x0ad1('0x16'));var licenseUtil=require(_0x0ad1('0x17'));var db=require(_0x0ad1('0x18'))['db'];function respondWithStatusCode(_0x36c9ea,_0x1c47cf){_0x1c47cf=_0x1c47cf||0xcc;return function(_0x5f4293){if(_0x5f4293){return _0x36c9ea[_0x0ad1('0x19')](_0x1c47cf);}return _0x36c9ea[_0x0ad1('0x1a')](_0x1c47cf)[_0x0ad1('0x1b')]();};}function respondWithResult(_0x5431d1,_0x19d413){_0x19d413=_0x19d413||0xc8;return function(_0x342aaf){if(_0x342aaf){return _0x5431d1[_0x0ad1('0x1a')](_0x19d413)['json'](_0x342aaf);}};}function respondWithFilteredResult(_0x5a5af2,_0x470c3d){return function(_0x300954){if(_0x300954){var _0x402885=typeof _0x470c3d[_0x0ad1('0x1c')]===_0x0ad1('0x1d')&&typeof _0x470c3d[_0x0ad1('0x1e')]===_0x0ad1('0x1d');var _0x12f2b9=_0x300954['count'];var _0x4c26e7=_0x402885?0x0:_0x470c3d[_0x0ad1('0x1c')];var _0x1b89ea=_0x402885?_0x300954[_0x0ad1('0x1f')]:_0x470c3d['offset']+_0x470c3d[_0x0ad1('0x1e')];var _0x2ccbbb;if(_0x1b89ea>=_0x12f2b9){_0x1b89ea=_0x12f2b9;_0x2ccbbb=0xc8;}else{_0x2ccbbb=0xce;}_0x5a5af2[_0x0ad1('0x1a')](_0x2ccbbb);return _0x5a5af2[_0x0ad1('0x20')](_0x0ad1('0x21'),_0x4c26e7+'-'+_0x1b89ea+'/'+_0x12f2b9)[_0x0ad1('0x22')](_0x300954);}return null;};}function patchUpdates(_0x56a1eb){return function(_0x55fe49){try{jsonpatch['apply'](_0x55fe49,_0x56a1eb,!![]);}catch(_0x55dffb){return BPromise[_0x0ad1('0x23')](_0x55dffb);}return _0x55fe49[_0x0ad1('0x24')]();};}function saveUpdates(_0x231913,_0x413f9b){return function(_0x5e53fc){if(_0x5e53fc){return _0x5e53fc[_0x0ad1('0x25')](_0x231913)['then'](function(_0xcb4e0){return _0xcb4e0;});}return null;};}function removeEntity(_0x4611ac,_0x2525b6){return function(_0x243fce){if(_0x243fce){return _0x243fce[_0x0ad1('0x26')]()[_0x0ad1('0x27')](function(){_0x4611ac['status'](0xcc)[_0x0ad1('0x1b')]();});}};}function handleEntityNotFound(_0xca8199,_0x7de14b){return function(_0x5950c1){if(!_0x5950c1){_0xca8199['sendStatus'](0x194);}return _0x5950c1;};}function handleError(_0x193d07,_0x1a52e5){_0x1a52e5=_0x1a52e5||0x1f4;return function(_0x1035e0){logger[_0x0ad1('0x28')](_0x1035e0[_0x0ad1('0x29')]);if(_0x1035e0[_0x0ad1('0x2a')]){delete _0x1035e0[_0x0ad1('0x2a')];}_0x193d07['status'](_0x1a52e5)[_0x0ad1('0x2b')](_0x1035e0);};}exports['index']=function(_0x5f35e1,_0x461f5c){var _0x28c863={},_0x15a686={},_0x1aa580={'count':0x0,'rows':[]};var _0x4d68ca=_[_0x0ad1('0x2c')](db[_0x0ad1('0x2d')]['rawAttributes'],function(_0x4d31ef){return{'name':_0x4d31ef[_0x0ad1('0x2e')],'type':_0x4d31ef[_0x0ad1('0x2f')]['key']};});_0x15a686['model']=_['map'](_0x4d68ca,_0x0ad1('0x2a'));_0x15a686[_0x0ad1('0x30')]=_[_0x0ad1('0x31')](_0x5f35e1[_0x0ad1('0x30')]);_0x15a686[_0x0ad1('0x32')]=_[_0x0ad1('0x33')](_0x15a686[_0x0ad1('0x34')],_0x15a686[_0x0ad1('0x30')]);_0x28c863[_0x0ad1('0x35')]=_['intersection'](_0x15a686['model'],qs['fields'](_0x5f35e1[_0x0ad1('0x30')][_0x0ad1('0x36')]));_0x28c863[_0x0ad1('0x35')]=_0x28c863[_0x0ad1('0x35')][_0x0ad1('0x37')]?_0x28c863['attributes']:_0x15a686[_0x0ad1('0x34')];if(!_0x5f35e1[_0x0ad1('0x30')][_0x0ad1('0x38')](_0x0ad1('0x39'))){_0x28c863['limit']=qs[_0x0ad1('0x1e')](_0x5f35e1[_0x0ad1('0x30')][_0x0ad1('0x1e')]);_0x28c863[_0x0ad1('0x1c')]=qs[_0x0ad1('0x1c')](_0x5f35e1['query']['offset']);}_0x28c863[_0x0ad1('0x3a')]=qs[_0x0ad1('0x3b')](_0x5f35e1[_0x0ad1('0x30')]['sort']);_0x28c863[_0x0ad1('0x3c')]=qs['filters'](_[_0x0ad1('0x3d')](_0x5f35e1[_0x0ad1('0x30')],_0x15a686[_0x0ad1('0x32')]),_0x4d68ca);if(_0x5f35e1[_0x0ad1('0x30')][_0x0ad1('0x3e')]){_0x28c863['where']=_['merge'](_0x28c863['where'],{'$or':_['map'](_0x4d68ca,function(_0x9e5316){if(_0x9e5316[_0x0ad1('0x2f')]!==_0x0ad1('0x3f')){var _0x1ae7cb={};_0x1ae7cb[_0x9e5316[_0x0ad1('0x2a')]]={'$like':'%'+_0x5f35e1[_0x0ad1('0x30')][_0x0ad1('0x3e')]+'%'};return _0x1ae7cb;}})});}_0x28c863=_[_0x0ad1('0x40')]({},_0x28c863,_0x5f35e1[_0x0ad1('0x41')]);var _0x360466={'where':_0x28c863[_0x0ad1('0x3c')]};return db[_0x0ad1('0x2d')][_0x0ad1('0x1f')](_0x360466)['then'](function(_0x323928){_0x1aa580[_0x0ad1('0x1f')]=_0x323928;if(_0x5f35e1['query'][_0x0ad1('0x42')]){_0x28c863[_0x0ad1('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0ad1('0x44')](_0x28c863);})[_0x0ad1('0x27')](function(_0x5c7180){_0x1aa580[_0x0ad1('0x45')]=_0x5c7180;return _0x1aa580;})[_0x0ad1('0x27')](respondWithFilteredResult(_0x461f5c,_0x28c863))[_0x0ad1('0x46')](handleError(_0x461f5c,null));};exports[_0x0ad1('0x47')]=function(_0x4fe75e,_0x295335){var _0x577177={'raw':![],'where':{'id':_0x4fe75e[_0x0ad1('0x48')]['id']}},_0x42b865={};_0x42b865[_0x0ad1('0x34')]=_['keys'](db[_0x0ad1('0x2d')][_0x0ad1('0x49')]);_0x42b865[_0x0ad1('0x30')]=_[_0x0ad1('0x31')](_0x4fe75e[_0x0ad1('0x30')]);_0x42b865['filters']=_['intersection'](_0x42b865[_0x0ad1('0x34')],_0x42b865['query']);_0x577177[_0x0ad1('0x35')]=_[_0x0ad1('0x33')](_0x42b865[_0x0ad1('0x34')],qs[_0x0ad1('0x36')](_0x4fe75e['query']['fields']));_0x577177['attributes']=_0x577177['attributes'][_0x0ad1('0x37')]?_0x577177[_0x0ad1('0x35')]:_0x42b865[_0x0ad1('0x34')];if(_0x4fe75e[_0x0ad1('0x30')]['includeAll']){_0x577177[_0x0ad1('0x43')]=[{'all':!![]}];}_0x577177=_[_0x0ad1('0x40')]({},_0x577177,_0x4fe75e[_0x0ad1('0x41')]);return db['FreshdeskConfiguration'][_0x0ad1('0x4a')](_0x577177)[_0x0ad1('0x27')](handleEntityNotFound(_0x295335,null))['then'](respondWithResult(_0x295335,null))[_0x0ad1('0x46')](handleError(_0x295335,null));};exports['create']=function(_0x117bac,_0x3f11e4){return db[_0x0ad1('0x2d')][_0x0ad1('0x4b')](_0x117bac['body'],{})[_0x0ad1('0x27')](respondWithResult(_0x3f11e4,0xc9))[_0x0ad1('0x46')](handleError(_0x3f11e4,null));};exports[_0x0ad1('0x25')]=function(_0x579c43,_0x297085){if(_0x579c43[_0x0ad1('0x4c')]['id']){delete _0x579c43[_0x0ad1('0x4c')]['id'];}return db[_0x0ad1('0x2d')][_0x0ad1('0x4a')]({'where':{'id':_0x579c43[_0x0ad1('0x48')]['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x297085,null))[_0x0ad1('0x27')](saveUpdates(_0x579c43[_0x0ad1('0x4c')],null))['then'](respondWithResult(_0x297085,null))[_0x0ad1('0x46')](handleError(_0x297085,null));};exports['destroy']=function(_0x4d7881,_0x5117bd){return db[_0x0ad1('0x2d')]['find']({'where':{'id':_0x4d7881['params']['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x5117bd,null))[_0x0ad1('0x27')](removeEntity(_0x5117bd,null))[_0x0ad1('0x46')](handleError(_0x5117bd,null));};exports['getFields']=function(_0x4a6d17,_0x47b329,_0x1af415){var _0x572f65={};var _0x36e612={};var _0x2e12dc;var _0x4ef339;return db['FreshdeskConfiguration'][_0x0ad1('0x4d')]({'where':{'id':_0x4a6d17[_0x0ad1('0x48')]['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x47b329,null))[_0x0ad1('0x27')](function(_0x55e753){if(_0x55e753){_0x2e12dc=_0x55e753;_0x36e612[_0x0ad1('0x34')]=_[_0x0ad1('0x31')](db[_0x0ad1('0x4e')][_0x0ad1('0x49')]);_0x36e612[_0x0ad1('0x30')]=_['keys'](_0x4a6d17['query']);_0x36e612[_0x0ad1('0x32')]=_[_0x0ad1('0x33')](_0x36e612['model'],_0x36e612[_0x0ad1('0x30')]);_0x572f65[_0x0ad1('0x35')]=_[_0x0ad1('0x33')](_0x36e612[_0x0ad1('0x34')],qs[_0x0ad1('0x36')](_0x4a6d17[_0x0ad1('0x30')][_0x0ad1('0x36')]));_0x572f65['attributes']=_0x572f65[_0x0ad1('0x35')][_0x0ad1('0x37')]?_0x572f65[_0x0ad1('0x35')]:_0x36e612[_0x0ad1('0x34')];_0x572f65[_0x0ad1('0x3a')]=qs[_0x0ad1('0x3b')](_0x4a6d17[_0x0ad1('0x30')][_0x0ad1('0x3b')]);_0x572f65[_0x0ad1('0x3c')]=qs[_0x0ad1('0x32')](_['pick'](_0x4a6d17[_0x0ad1('0x30')],_0x36e612['filters']));if(_0x4a6d17[_0x0ad1('0x30')]['filter']){_0x572f65[_0x0ad1('0x3c')]=_[_0x0ad1('0x40')](_0x572f65[_0x0ad1('0x3c')],{'$or':_['map'](_0x572f65['attributes'],function(_0x2ca99a){var _0x245710={};_0x245710[_0x2ca99a]={'$like':'%'+_0x4a6d17['query'][_0x0ad1('0x3e')]+'%'};return _0x245710;})});}_0x572f65=_['merge']({},_0x572f65,_0x4a6d17[_0x0ad1('0x41')]);return _0x2e12dc[_0x0ad1('0x4f')](_0x572f65);}})[_0x0ad1('0x27')](function(_0x3e0aa9){if(_0x3e0aa9){_0x4ef339=_0x3e0aa9[_0x0ad1('0x37')];if(!_0x4a6d17[_0x0ad1('0x30')]['hasOwnProperty'](_0x0ad1('0x39'))){_0x572f65[_0x0ad1('0x1e')]=qs[_0x0ad1('0x1e')](_0x4a6d17[_0x0ad1('0x30')][_0x0ad1('0x1e')]);_0x572f65[_0x0ad1('0x1c')]=qs[_0x0ad1('0x1c')](_0x4a6d17['query'][_0x0ad1('0x1c')]);}return _0x2e12dc[_0x0ad1('0x4f')](_0x572f65);}})[_0x0ad1('0x27')](function(_0x2cb27b){if(_0x2cb27b){return _0x2cb27b?{'count':_0x4ef339,'rows':_0x2cb27b}:null;}})[_0x0ad1('0x27')](respondWithResult(_0x47b329,null))['catch'](handleError(_0x47b329,null));};exports[_0x0ad1('0x50')]=function(_0x106d93,_0x44644c,_0x2b7282){var _0x267e5a={};var _0x59f72d={};var _0x4168e8;var _0x16a264;return db['FreshdeskConfiguration'][_0x0ad1('0x4d')]({'where':{'id':_0x106d93['params']['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x44644c,null))['then'](function(_0x524694){if(_0x524694){_0x4168e8=_0x524694;_0x59f72d[_0x0ad1('0x34')]=_[_0x0ad1('0x31')](db[_0x0ad1('0x4e')][_0x0ad1('0x49')]);_0x59f72d['query']=_[_0x0ad1('0x31')](_0x106d93[_0x0ad1('0x30')]);_0x59f72d[_0x0ad1('0x32')]=_['intersection'](_0x59f72d[_0x0ad1('0x34')],_0x59f72d[_0x0ad1('0x30')]);_0x267e5a[_0x0ad1('0x35')]=_[_0x0ad1('0x33')](_0x59f72d[_0x0ad1('0x34')],qs['fields'](_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x36')]));_0x267e5a['attributes']=_0x267e5a[_0x0ad1('0x35')][_0x0ad1('0x37')]?_0x267e5a[_0x0ad1('0x35')]:_0x59f72d[_0x0ad1('0x34')];_0x267e5a[_0x0ad1('0x3a')]=qs[_0x0ad1('0x3b')](_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x3b')]);_0x267e5a['where']=qs[_0x0ad1('0x32')](_[_0x0ad1('0x3d')](_0x106d93['query'],_0x59f72d[_0x0ad1('0x32')]));if(_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x3e')]){_0x267e5a[_0x0ad1('0x3c')]=_[_0x0ad1('0x40')](_0x267e5a['where'],{'$or':_[_0x0ad1('0x2c')](_0x267e5a[_0x0ad1('0x35')],function(_0x4d22ef){var _0x25d7b2={};_0x25d7b2[_0x4d22ef]={'$like':'%'+_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x3e')]+'%'};return _0x25d7b2;})});}_0x267e5a=_[_0x0ad1('0x40')]({},_0x267e5a,_0x106d93[_0x0ad1('0x41')]);return _0x4168e8[_0x0ad1('0x50')](_0x267e5a);}})[_0x0ad1('0x27')](function(_0xd32f28){if(_0xd32f28){_0x16a264=_0xd32f28[_0x0ad1('0x37')];if(!_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x38')]('nolimit')){_0x267e5a[_0x0ad1('0x1e')]=qs[_0x0ad1('0x1e')](_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x1e')]);_0x267e5a[_0x0ad1('0x1c')]=qs[_0x0ad1('0x1c')](_0x106d93[_0x0ad1('0x30')][_0x0ad1('0x1c')]);}return _0x4168e8['getSubjects'](_0x267e5a);}})[_0x0ad1('0x27')](function(_0x4f89aa){if(_0x4f89aa){return _0x4f89aa?{'count':_0x16a264,'rows':_0x4f89aa}:null;}})[_0x0ad1('0x27')](respondWithResult(_0x44644c,null))['catch'](handleError(_0x44644c,null));};exports[_0x0ad1('0x51')]=function(_0x595003,_0x3bdeb7,_0x599bf6){var _0xd0684b={};var _0x69e1e={};var _0x2675b7;var _0x26c513;return db['FreshdeskConfiguration'][_0x0ad1('0x4d')]({'where':{'id':_0x595003[_0x0ad1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3bdeb7,null))[_0x0ad1('0x27')](function(_0x4d36ee){if(_0x4d36ee){_0x2675b7=_0x4d36ee;_0x69e1e[_0x0ad1('0x34')]=_[_0x0ad1('0x31')](db[_0x0ad1('0x4e')][_0x0ad1('0x49')]);_0x69e1e[_0x0ad1('0x30')]=_[_0x0ad1('0x31')](_0x595003['query']);_0x69e1e['filters']=_['intersection'](_0x69e1e[_0x0ad1('0x34')],_0x69e1e[_0x0ad1('0x30')]);_0xd0684b['attributes']=_[_0x0ad1('0x33')](_0x69e1e[_0x0ad1('0x34')],qs[_0x0ad1('0x36')](_0x595003[_0x0ad1('0x30')][_0x0ad1('0x36')]));_0xd0684b[_0x0ad1('0x35')]=_0xd0684b[_0x0ad1('0x35')][_0x0ad1('0x37')]?_0xd0684b[_0x0ad1('0x35')]:_0x69e1e[_0x0ad1('0x34')];_0xd0684b[_0x0ad1('0x3a')]=qs[_0x0ad1('0x3b')](_0x595003[_0x0ad1('0x30')][_0x0ad1('0x3b')]);_0xd0684b['where']=qs[_0x0ad1('0x32')](_[_0x0ad1('0x3d')](_0x595003[_0x0ad1('0x30')],_0x69e1e[_0x0ad1('0x32')]));if(_0x595003['query'][_0x0ad1('0x3e')]){_0xd0684b[_0x0ad1('0x3c')]=_[_0x0ad1('0x40')](_0xd0684b['where'],{'$or':_[_0x0ad1('0x2c')](_0xd0684b[_0x0ad1('0x35')],function(_0x4d71d9){var _0x193a3c={};_0x193a3c[_0x4d71d9]={'$like':'%'+_0x595003['query'][_0x0ad1('0x3e')]+'%'};return _0x193a3c;})});}_0xd0684b=_[_0x0ad1('0x40')]({},_0xd0684b,_0x595003['options']);return _0x2675b7[_0x0ad1('0x51')](_0xd0684b);}})[_0x0ad1('0x27')](function(_0x4b4334){if(_0x4b4334){_0x26c513=_0x4b4334[_0x0ad1('0x37')];if(!_0x595003[_0x0ad1('0x30')][_0x0ad1('0x38')](_0x0ad1('0x39'))){_0xd0684b['limit']=qs[_0x0ad1('0x1e')](_0x595003[_0x0ad1('0x30')]['limit']);_0xd0684b[_0x0ad1('0x1c')]=qs[_0x0ad1('0x1c')](_0x595003[_0x0ad1('0x30')]['offset']);}return _0x2675b7['getDescriptions'](_0xd0684b);}})['then'](function(_0x88b29b){if(_0x88b29b){return _0x88b29b?{'count':_0x26c513,'rows':_0x88b29b}:null;}})[_0x0ad1('0x27')](respondWithResult(_0x3bdeb7,null))['catch'](handleError(_0x3bdeb7,null));};exports[_0x0ad1('0x52')]=function(_0x4ea80a,_0x12afaf,_0x5b467d){var _0x136768={};var _0x400490={};var _0x394745;var _0x15f2ab;return db[_0x0ad1('0x2d')][_0x0ad1('0x4d')]({'where':{'id':_0x4ea80a[_0x0ad1('0x48')]['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x12afaf,null))['then'](function(_0x1a670d){if(_0x1a670d){_0x394745=_0x1a670d;_0x400490[_0x0ad1('0x34')]=_[_0x0ad1('0x31')](db[_0x0ad1('0x53')][_0x0ad1('0x49')]);_0x400490[_0x0ad1('0x30')]=_[_0x0ad1('0x31')](_0x4ea80a[_0x0ad1('0x30')]);_0x400490[_0x0ad1('0x32')]=_[_0x0ad1('0x33')](_0x400490[_0x0ad1('0x34')],_0x400490[_0x0ad1('0x30')]);_0x136768[_0x0ad1('0x35')]=_[_0x0ad1('0x33')](_0x400490[_0x0ad1('0x34')],qs[_0x0ad1('0x36')](_0x4ea80a['query'][_0x0ad1('0x36')]));_0x136768[_0x0ad1('0x35')]=_0x136768[_0x0ad1('0x35')]['length']?_0x136768[_0x0ad1('0x35')]:_0x400490['model'];_0x136768[_0x0ad1('0x3a')]=qs[_0x0ad1('0x3b')](_0x4ea80a['query'][_0x0ad1('0x3b')]);_0x136768[_0x0ad1('0x3c')]=qs['filters'](_['pick'](_0x4ea80a[_0x0ad1('0x30')],_0x400490[_0x0ad1('0x32')]));if(_0x4ea80a[_0x0ad1('0x30')][_0x0ad1('0x3e')]){_0x136768[_0x0ad1('0x3c')]=_[_0x0ad1('0x40')](_0x136768[_0x0ad1('0x3c')],{'$or':_[_0x0ad1('0x2c')](_0x136768[_0x0ad1('0x35')],function(_0x24ac21){var _0x436a22={};_0x436a22[_0x24ac21]={'$like':'%'+_0x4ea80a[_0x0ad1('0x30')][_0x0ad1('0x3e')]+'%'};return _0x436a22;})});}_0x136768=_['merge']({},_0x136768,_0x4ea80a[_0x0ad1('0x41')]);return _0x394745[_0x0ad1('0x52')](_0x136768);}})[_0x0ad1('0x27')](function(_0x3fbb83){if(_0x3fbb83){_0x15f2ab=_0x3fbb83['length'];if(!_0x4ea80a['query'][_0x0ad1('0x38')](_0x0ad1('0x39'))){_0x136768[_0x0ad1('0x1e')]=qs['limit'](_0x4ea80a[_0x0ad1('0x30')][_0x0ad1('0x1e')]);_0x136768['offset']=qs[_0x0ad1('0x1c')](_0x4ea80a[_0x0ad1('0x30')][_0x0ad1('0x1c')]);}return _0x394745[_0x0ad1('0x52')](_0x136768);}})[_0x0ad1('0x27')](function(_0x56c79b){if(_0x56c79b){return _0x56c79b?{'count':_0x15f2ab,'rows':_0x56c79b}:null;}})[_0x0ad1('0x27')](respondWithResult(_0x12afaf,null))[_0x0ad1('0x46')](handleError(_0x12afaf,null));};exports[_0x0ad1('0x54')]=function(_0x326a31,_0x3a4109,_0x4b0f92){if(_0x326a31[_0x0ad1('0x4c')]['id']){delete _0x326a31[_0x0ad1('0x4c')]['id'];}return db[_0x0ad1('0x2d')][_0x0ad1('0x4d')]({'where':{'id':_0x326a31[_0x0ad1('0x48')]['id']}})[_0x0ad1('0x27')](handleEntityNotFound(_0x3a4109,null))[_0x0ad1('0x27')](function(_0x485c5c){if(_0x485c5c){return _0x485c5c[_0x0ad1('0x54')](_0x326a31['body'][_0x0ad1('0x55')]||[]);}return null;})[_0x0ad1('0x27')](respondWithResult(_0x3a4109,null))[_0x0ad1('0x46')](handleError(_0x3a4109,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0a411b4..abf91ff 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 _0xf662=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf662,0x8b));var _0x2f66=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0xf662[_0x390752];return _0x5eca55;};'use strict';var _=require(_0x2f66('0x0'));var util=require(_0x2f66('0x1'));var logger=require(_0x2f66('0x2'))(_0x2f66('0x3'));var moment=require(_0x2f66('0x4'));var BPromise=require(_0x2f66('0x5'));var rp=require(_0x2f66('0x6'));var fs=require('fs');var path=require(_0x2f66('0x7'));var rimraf=require('rimraf');var config=require(_0x2f66('0x8'));var attributes=require(_0x2f66('0x9'));module[_0x2f66('0xa')]=function(_0x2ecc8c,_0xb80131){return _0x2ecc8c[_0x2f66('0xb')](_0x2f66('0xc'),attributes,{'tableName':_0x2f66('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd89=['define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskConfiguration.attributes','exports'];(function(_0x3e7bb8,_0x11f26c){var _0x160bf4=function(_0xbc65a5){while(--_0xbc65a5){_0x3e7bb8['push'](_0x3e7bb8['shift']());}};_0x160bf4(++_0x11f26c);}(_0xcd89,0x135));var _0x9cd8=function(_0x1556a9,_0x23e017){_0x1556a9=_0x1556a9-0x0;var _0x20acf9=_0xcd89[_0x1556a9];return _0x20acf9;};'use strict';var _=require(_0x9cd8('0x0'));var util=require(_0x9cd8('0x1'));var logger=require(_0x9cd8('0x2'))(_0x9cd8('0x3'));var moment=require(_0x9cd8('0x4'));var BPromise=require(_0x9cd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cd8('0x6'));var rimraf=require(_0x9cd8('0x7'));var config=require('../../config/environment');var attributes=require(_0x9cd8('0x8'));module[_0x9cd8('0x9')]=function(_0x405b31,_0x46cead){return _0x405b31[_0x9cd8('0xa')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 3218856..2c95cd9 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 _0x3ff3=['error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2a4881,_0x141fa9){var _0x8083c0=function(_0x4c49ae){while(--_0x4c49ae){_0x2a4881['push'](_0x2a4881['shift']());}};_0x8083c0(++_0x141fa9);}(_0x3ff3,0x16b));var _0x33ff=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3ff3[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x33ff('0x0'));var BPromise=require(_0x33ff('0x1'));var rs=require(_0x33ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33ff('0x3'))['db'];var utils=require(_0x33ff('0x4'));var logger=require(_0x33ff('0x5'))(_0x33ff('0x6'));var config=require('../../config/environment');var jayson=require(_0x33ff('0x7'));var client=jayson[_0x33ff('0x8')][_0x33ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30f9d5,_0x205b8d,_0x116a15){return new BPromise(function(_0x281c10,_0x12c9cc){return client['request'](_0x30f9d5,_0x116a15)[_0x33ff('0xa')](function(_0xbae9ce){logger['info'](_0x33ff('0xb'),_0x205b8d,_0x33ff('0xc'));logger[_0x33ff('0xd')](_0x33ff('0xe'),_0x205b8d,_0x33ff('0xc'),JSON['stringify'](_0xbae9ce));if(_0xbae9ce[_0x33ff('0xf')]){if(_0xbae9ce[_0x33ff('0xf')]['code']===0x1f4){logger['error'](_0x33ff('0xb'),_0x205b8d,_0xbae9ce[_0x33ff('0xf')]['message']);return _0x12c9cc(_0xbae9ce[_0x33ff('0xf')][_0x33ff('0x10')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x205b8d,_0xbae9ce[_0x33ff('0xf')][_0x33ff('0x10')]);return _0x281c10(_0xbae9ce['error'][_0x33ff('0x10')]);}else{logger['info'](_0x33ff('0xb'),_0x205b8d,'request\x20sent');_0x281c10(_0xbae9ce['result'][_0x33ff('0x10')]);}})[_0x33ff('0x11')](function(_0x2ad778){logger[_0x33ff('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x205b8d,_0x2ad778);_0x12c9cc(_0x2ad778);});});} \ No newline at end of file +var _0x8404=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x39ddd4,_0x38ce35){var _0x3d642a=function(_0xa05ced){while(--_0xa05ced){_0x39ddd4['push'](_0x39ddd4['shift']());}};_0x3d642a(++_0x38ce35);}(_0x8404,0x83));var _0x4840=function(_0x18cd7d,_0x2617a9){_0x18cd7d=_0x18cd7d-0x0;var _0x319059=_0x8404[_0x18cd7d];return _0x319059;};'use strict';var _=require('lodash');var util=require(_0x4840('0x0'));var moment=require(_0x4840('0x1'));var BPromise=require(_0x4840('0x2'));var rs=require(_0x4840('0x3'));var fs=require('fs');var Redis=require(_0x4840('0x4'));var db=require(_0x4840('0x5'))['db'];var utils=require(_0x4840('0x6'));var logger=require(_0x4840('0x7'))('rpc');var config=require(_0x4840('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4840('0x9')][_0x4840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1429b1,_0x5a4185,_0x146d83){return new BPromise(function(_0x4e8ed9,_0x223ac0){return client[_0x4840('0xb')](_0x1429b1,_0x146d83)['then'](function(_0x6b113){logger[_0x4840('0xc')](_0x4840('0xd'),_0x5a4185,'request\x20sent');logger[_0x4840('0xe')](_0x4840('0xf'),_0x5a4185,_0x4840('0x10'),JSON[_0x4840('0x11')](_0x6b113));if(_0x6b113[_0x4840('0x12')]){if(_0x6b113[_0x4840('0x12')][_0x4840('0x13')]===0x1f4){logger[_0x4840('0x12')](_0x4840('0xd'),_0x5a4185,_0x6b113['error'][_0x4840('0x14')]);return _0x223ac0(_0x6b113['error'][_0x4840('0x14')]);}logger[_0x4840('0x12')](_0x4840('0xd'),_0x5a4185,_0x6b113['error']['message']);return _0x4e8ed9(_0x6b113[_0x4840('0x12')][_0x4840('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a4185,_0x4840('0x10'));_0x4e8ed9(_0x6b113[_0x4840('0x15')][_0x4840('0x14')]);}})['catch'](function(_0x291ea6){logger[_0x4840('0x12')](_0x4840('0xd'),_0x5a4185,_0x291ea6);_0x223ac0(_0x291ea6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 71a94ff..042f275 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 _0x81a6=['index','get','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated'];(function(_0xb140a8,_0x2a65f0){var _0x1372e4=function(_0x2b0271){while(--_0x2b0271){_0xb140a8['push'](_0xb140a8['shift']());}};_0x1372e4(++_0x2a65f0);}(_0x81a6,0x100));var _0x681a=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x81a6[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x681a('0x0'));var util=require(_0x681a('0x1'));var path=require(_0x681a('0x2'));var timeout=require(_0x681a('0x3'));var express=require(_0x681a('0x4'));var router=express[_0x681a('0x5')]();var fs_extra=require(_0x681a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x681a('0x7'));var config=require('../../config/environment');var controller=require(_0x681a('0x8'));router['get']('/',auth[_0x681a('0x9')](),controller[_0x681a('0xa')]);router[_0x681a('0xb')](_0x681a('0xc'),auth[_0x681a('0x9')](),controller[_0x681a('0xd')]);router['post']('/',auth[_0x681a('0x9')](),controller['create']);router[_0x681a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x681a('0xf')]);router[_0x681a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x681a('0x11')]);module[_0x681a('0x12')]=router; \ No newline at end of file +var _0xb039=['/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get'];(function(_0x26f1d7,_0xedefdc){var _0x169888=function(_0x27338a){while(--_0x27338a){_0x26f1d7['push'](_0x26f1d7['shift']());}};_0x169888(++_0xedefdc);}(_0xb039,0x93));var _0x9b03=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0xb039[_0x3794a0];return _0x5bdaba;};'use strict';var multer=require(_0x9b03('0x0'));var util=require(_0x9b03('0x1'));var path=require(_0x9b03('0x2'));var timeout=require(_0x9b03('0x3'));var express=require(_0x9b03('0x4'));var router=express[_0x9b03('0x5')]();var fs_extra=require(_0x9b03('0x6'));var auth=require(_0x9b03('0x7'));var interaction=require(_0x9b03('0x8'));var config=require(_0x9b03('0x9'));var controller=require(_0x9b03('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b03('0xb')]);router[_0x9b03('0xc')](_0x9b03('0xd'),auth[_0x9b03('0xe')](),controller[_0x9b03('0xf')]);router[_0x9b03('0x10')]('/',auth['isAuthenticated'](),controller[_0x9b03('0x11')]);router['put'](_0x9b03('0xd'),auth[_0x9b03('0xe')](),controller['update']);router[_0x9b03('0x12')](_0x9b03('0xd'),auth[_0x9b03('0xe')](),controller[_0x9b03('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f822bc3..03db00d 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 _0x1d2d=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x1d2d,0x6e));var _0xd1d2=function(_0x11ae36,_0x4e17d6){_0x11ae36=_0x11ae36-0x0;var _0x5b8a8e=_0x1d2d[_0x11ae36];return _0x5b8a8e;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module['exports']={'type':{'type':Sequelize[_0xd1d2('0x1')](_0xd1d2('0x2'),_0xd1d2('0x3'),'customVariable',_0xd1d2('0x4'),_0xd1d2('0x5')),'defaultValue':_0xd1d2('0x2')},'content':{'type':Sequelize[_0xd1d2('0x6')]},'key':{'type':Sequelize[_0xd1d2('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd1d2('0x2'),_0xd1d2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd1d2('0x6')]},'idField':{'type':Sequelize[_0xd1d2('0x6')]},'nameField':{'type':Sequelize[_0xd1d2('0x6')]},'customField':{'type':Sequelize[_0xd1d2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd1d2('0x6')]}}; \ No newline at end of file +var _0xfc64=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x1b485b,_0x41137d){var _0x21159d=function(_0x3a06c6){while(--_0x3a06c6){_0x1b485b['push'](_0x1b485b['shift']());}};_0x21159d(++_0x41137d);}(_0xfc64,0x143));var _0x4fc6=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xfc64[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require('sequelize');module[_0x4fc6('0x0')]={'type':{'type':Sequelize[_0x4fc6('0x1')](_0x4fc6('0x2'),_0x4fc6('0x3'),_0x4fc6('0x4'),_0x4fc6('0x5'),_0x4fc6('0x6')),'defaultValue':_0x4fc6('0x2')},'content':{'type':Sequelize[_0x4fc6('0x7')]},'key':{'type':Sequelize[_0x4fc6('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4fc6('0x2'),_0x4fc6('0x3'),_0x4fc6('0x4'))},'keyContent':{'type':Sequelize[_0x4fc6('0x7')]},'idField':{'type':Sequelize[_0x4fc6('0x7')]},'nameField':{'type':Sequelize[_0x4fc6('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fc6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 524c159..e9c720c 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 _0x702d=['nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x48a8cb,_0x1bb398){var _0x65030=function(_0x1ad10f){while(--_0x1ad10f){_0x48a8cb['push'](_0x48a8cb['shift']());}};_0x65030(++_0x1bb398);}(_0x702d,0x147));var _0xd702=function(_0x295d7d,_0x2292b0){_0x295d7d=_0x295d7d-0x0;var _0x5e4ea9=_0x702d[_0x295d7d];return _0x5e4ea9;};'use strict';var emlformat=require(_0xd702('0x0'));var rimraf=require(_0xd702('0x1'));var zipdir=require(_0xd702('0x2'));var jsonpatch=require(_0xd702('0x3'));var rp=require(_0xd702('0x4'));var moment=require('moment');var BPromise=require(_0xd702('0x5'));var Mustache=require(_0xd702('0x6'));var util=require(_0xd702('0x7'));var path=require(_0xd702('0x8'));var sox=require('sox');var csv=require(_0xd702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd702('0xa'));var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0x9'));var querystring=require(_0xd702('0xe'));var Papa=require(_0xd702('0xf'));var Redis=require(_0xd702('0x10'));var authService=require(_0xd702('0x11'));var qs=require(_0xd702('0x12'));var as=require(_0xd702('0x13'));var hardwareService=require(_0xd702('0x14'));var logger=require(_0xd702('0x15'))(_0xd702('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x17'));var db=require(_0xd702('0x18'))['db'];function respondWithStatusCode(_0x273577,_0x5c0dad){_0x5c0dad=_0x5c0dad||0xcc;return function(_0x13ee5a){if(_0x13ee5a){return _0x273577[_0xd702('0x19')](_0x5c0dad);}return _0x273577[_0xd702('0x1a')](_0x5c0dad)[_0xd702('0x1b')]();};}function respondWithResult(_0x3948f8,_0x181ff2){_0x181ff2=_0x181ff2||0xc8;return function(_0x59dd33){if(_0x59dd33){return _0x3948f8[_0xd702('0x1a')](_0x181ff2)[_0xd702('0x1c')](_0x59dd33);}};}function respondWithFilteredResult(_0x5d7978,_0x707b9){return function(_0x4922f8){if(_0x4922f8){var _0x268c66=typeof _0x707b9[_0xd702('0x1d')]==='undefined'&&typeof _0x707b9[_0xd702('0x1e')]===_0xd702('0x1f');var _0x2a87f2=_0x4922f8['count'];var _0x5b3b1d=_0x268c66?0x0:_0x707b9[_0xd702('0x1d')];var _0x5a296e=_0x268c66?_0x4922f8[_0xd702('0x20')]:_0x707b9[_0xd702('0x1d')]+_0x707b9[_0xd702('0x1e')];var _0x265b1b;if(_0x5a296e>=_0x2a87f2){_0x5a296e=_0x2a87f2;_0x265b1b=0xc8;}else{_0x265b1b=0xce;}_0x5d7978[_0xd702('0x1a')](_0x265b1b);return _0x5d7978[_0xd702('0x21')](_0xd702('0x22'),_0x5b3b1d+'-'+_0x5a296e+'/'+_0x2a87f2)['json'](_0x4922f8);}return null;};}function patchUpdates(_0x4be140){return function(_0x536ca8){try{jsonpatch[_0xd702('0x23')](_0x536ca8,_0x4be140,!![]);}catch(_0x109284){return BPromise['reject'](_0x109284);}return _0x536ca8[_0xd702('0x24')]();};}function saveUpdates(_0x5d91fd,_0xc4c246){return function(_0x5824ec){if(_0x5824ec){return _0x5824ec['update'](_0x5d91fd)['then'](function(_0x21c00e){return _0x21c00e;});}return null;};}function removeEntity(_0xeec2e4,_0x459184){return function(_0x49761c){if(_0x49761c){return _0x49761c[_0xd702('0x25')]()[_0xd702('0x26')](function(){_0xeec2e4[_0xd702('0x1a')](0xcc)[_0xd702('0x1b')]();});}};}function handleEntityNotFound(_0x1200ed,_0x146f35){return function(_0x94c58d){if(!_0x94c58d){_0x1200ed[_0xd702('0x19')](0x194);}return _0x94c58d;};}function handleError(_0x22328a,_0x50d7ad){_0x50d7ad=_0x50d7ad||0x1f4;return function(_0x116b2f){logger[_0xd702('0x27')](_0x116b2f[_0xd702('0x28')]);if(_0x116b2f[_0xd702('0x29')]){delete _0x116b2f[_0xd702('0x29')];}_0x22328a[_0xd702('0x1a')](_0x50d7ad)[_0xd702('0x2a')](_0x116b2f);};}exports[_0xd702('0x2b')]=function(_0x5f1084,_0x47c9a2){var _0x1870b7={},_0x43cd38={},_0x56bc8d={'count':0x0,'rows':[]};var _0x45cd22=_[_0xd702('0x2c')](db[_0xd702('0x2d')][_0xd702('0x2e')],function(_0x56e9cd){return{'name':_0x56e9cd[_0xd702('0x2f')],'type':_0x56e9cd[_0xd702('0x30')][_0xd702('0x31')]};});_0x43cd38[_0xd702('0x32')]=_[_0xd702('0x2c')](_0x45cd22,'name');_0x43cd38[_0xd702('0x33')]=_[_0xd702('0x34')](_0x5f1084[_0xd702('0x33')]);_0x43cd38['filters']=_[_0xd702('0x35')](_0x43cd38['model'],_0x43cd38['query']);_0x1870b7[_0xd702('0x36')]=_[_0xd702('0x35')](_0x43cd38[_0xd702('0x32')],qs['fields'](_0x5f1084[_0xd702('0x33')][_0xd702('0x37')]));_0x1870b7['attributes']=_0x1870b7[_0xd702('0x36')][_0xd702('0x38')]?_0x1870b7[_0xd702('0x36')]:_0x43cd38[_0xd702('0x32')];if(!_0x5f1084[_0xd702('0x33')][_0xd702('0x39')](_0xd702('0x3a'))){_0x1870b7[_0xd702('0x1e')]=qs[_0xd702('0x1e')](_0x5f1084[_0xd702('0x33')][_0xd702('0x1e')]);_0x1870b7[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x5f1084['query'][_0xd702('0x1d')]);}_0x1870b7[_0xd702('0x3b')]=qs[_0xd702('0x3c')](_0x5f1084[_0xd702('0x33')][_0xd702('0x3c')]);_0x1870b7[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_['pick'](_0x5f1084['query'],_0x43cd38[_0xd702('0x3e')]),_0x45cd22);if(_0x5f1084[_0xd702('0x33')]['filter']){_0x1870b7['where']=_[_0xd702('0x3f')](_0x1870b7[_0xd702('0x3d')],{'$or':_['map'](_0x45cd22,function(_0x3a7aee){if(_0x3a7aee[_0xd702('0x30')]!==_0xd702('0x40')){var _0x4822d9={};_0x4822d9[_0x3a7aee[_0xd702('0x29')]]={'$like':'%'+_0x5f1084[_0xd702('0x33')][_0xd702('0x41')]+'%'};return _0x4822d9;}})});}_0x1870b7=_['merge']({},_0x1870b7,_0x5f1084[_0xd702('0x42')]);var _0x512854={'where':_0x1870b7[_0xd702('0x3d')]};return db[_0xd702('0x2d')][_0xd702('0x20')](_0x512854)[_0xd702('0x26')](function(_0x6af8d6){_0x56bc8d[_0xd702('0x20')]=_0x6af8d6;if(_0x5f1084[_0xd702('0x33')][_0xd702('0x43')]){_0x1870b7['include']=[{'all':!![]}];}return db[_0xd702('0x2d')][_0xd702('0x44')](_0x1870b7);})[_0xd702('0x26')](function(_0x3d703e){_0x56bc8d[_0xd702('0x45')]=_0x3d703e;return _0x56bc8d;})['then'](respondWithFilteredResult(_0x47c9a2,_0x1870b7))[_0xd702('0x46')](handleError(_0x47c9a2,null));};exports[_0xd702('0x47')]=function(_0x3424a3,_0x4c56ae){var _0xd48ad0={'raw':!![],'where':{'id':_0x3424a3[_0xd702('0x48')]['id']}},_0x3a1ed5={};_0x3a1ed5[_0xd702('0x32')]=_['keys'](db[_0xd702('0x2d')][_0xd702('0x2e')]);_0x3a1ed5[_0xd702('0x33')]=_[_0xd702('0x34')](_0x3424a3[_0xd702('0x33')]);_0x3a1ed5['filters']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],_0x3a1ed5['query']);_0xd48ad0['attributes']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],qs[_0xd702('0x37')](_0x3424a3[_0xd702('0x33')][_0xd702('0x37')]));_0xd48ad0[_0xd702('0x36')]=_0xd48ad0[_0xd702('0x36')][_0xd702('0x38')]?_0xd48ad0[_0xd702('0x36')]:_0x3a1ed5['model'];if(_0x3424a3['query'][_0xd702('0x43')]){_0xd48ad0['include']=[{'all':!![]}];}_0xd48ad0=_[_0xd702('0x3f')]({},_0xd48ad0,_0x3424a3['options']);return db[_0xd702('0x2d')]['find'](_0xd48ad0)[_0xd702('0x26')](handleEntityNotFound(_0x4c56ae,null))['then'](respondWithResult(_0x4c56ae,null))[_0xd702('0x46')](handleError(_0x4c56ae,null));};exports[_0xd702('0x49')]=function(_0x543b8f,_0x160f5e){return db[_0xd702('0x2d')][_0xd702('0x49')](_0x543b8f[_0xd702('0x4a')],{})[_0xd702('0x26')](respondWithResult(_0x160f5e,0xc9))['catch'](handleError(_0x160f5e,null));};exports[_0xd702('0x4b')]=function(_0x14c1db,_0x2d09be){if(_0x14c1db['body']['id']){delete _0x14c1db[_0xd702('0x4a')]['id'];}return db['FreshdeskField'][_0xd702('0x4c')]({'where':{'id':_0x14c1db[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x2d09be,null))['then'](saveUpdates(_0x14c1db['body'],null))[_0xd702('0x26')](respondWithResult(_0x2d09be,null))[_0xd702('0x46')](handleError(_0x2d09be,null));};exports[_0xd702('0x25')]=function(_0x397e91,_0x16e59b){return db[_0xd702('0x2d')][_0xd702('0x4c')]({'where':{'id':_0x397e91[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x16e59b,null))[_0xd702('0x26')](removeEntity(_0x16e59b,null))['catch'](handleError(_0x16e59b,null));}; \ No newline at end of file +var _0x26c2=['create','body','update','params','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','find'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x26c2,0x130));var _0x226c=function(_0x9d52db,_0x5e050b){_0x9d52db=_0x9d52db-0x0;var _0xa92c3d=_0x26c2[_0x9d52db];return _0xa92c3d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x226c('0x0'));var rp=require(_0x226c('0x1'));var moment=require(_0x226c('0x2'));var BPromise=require(_0x226c('0x3'));var Mustache=require('mustache');var util=require(_0x226c('0x4'));var path=require(_0x226c('0x5'));var sox=require('sox');var csv=require(_0x226c('0x6'));var ejs=require(_0x226c('0x7'));var fs=require('fs');var fs_extra=require(_0x226c('0x8'));var _=require(_0x226c('0x9'));var squel=require(_0x226c('0xa'));var crypto=require('crypto');var jsforce=require(_0x226c('0xb'));var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x6'));var querystring=require(_0x226c('0xd'));var Papa=require(_0x226c('0xe'));var Redis=require('ioredis');var authService=require(_0x226c('0xf'));var qs=require(_0x226c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x226c('0x11'))(_0x226c('0x12'));var utils=require(_0x226c('0x13'));var config=require(_0x226c('0x14'));var licenseUtil=require(_0x226c('0x15'));var db=require(_0x226c('0x16'))['db'];function respondWithStatusCode(_0x2964c2,_0x57dbc4){_0x57dbc4=_0x57dbc4||0xcc;return function(_0x481496){if(_0x481496){return _0x2964c2[_0x226c('0x17')](_0x57dbc4);}return _0x2964c2[_0x226c('0x18')](_0x57dbc4)[_0x226c('0x19')]();};}function respondWithResult(_0x36af55,_0x4eb557){_0x4eb557=_0x4eb557||0xc8;return function(_0x4bfd5c){if(_0x4bfd5c){return _0x36af55[_0x226c('0x18')](_0x4eb557)[_0x226c('0x1a')](_0x4bfd5c);}};}function respondWithFilteredResult(_0x15e13b,_0x55697c){return function(_0x5d6c21){if(_0x5d6c21){var _0x694eef=typeof _0x55697c[_0x226c('0x1b')]===_0x226c('0x1c')&&typeof _0x55697c[_0x226c('0x1d')]===_0x226c('0x1c');var _0x4832f5=_0x5d6c21['count'];var _0x5989e0=_0x694eef?0x0:_0x55697c[_0x226c('0x1b')];var _0x813b69=_0x694eef?_0x5d6c21[_0x226c('0x1e')]:_0x55697c[_0x226c('0x1b')]+_0x55697c['limit'];var _0x7fc168;if(_0x813b69>=_0x4832f5){_0x813b69=_0x4832f5;_0x7fc168=0xc8;}else{_0x7fc168=0xce;}_0x15e13b[_0x226c('0x18')](_0x7fc168);return _0x15e13b[_0x226c('0x1f')](_0x226c('0x20'),_0x5989e0+'-'+_0x813b69+'/'+_0x4832f5)[_0x226c('0x1a')](_0x5d6c21);}return null;};}function patchUpdates(_0x3d412a){return function(_0x4dabf3){try{jsonpatch[_0x226c('0x21')](_0x4dabf3,_0x3d412a,!![]);}catch(_0x34253b){return BPromise[_0x226c('0x22')](_0x34253b);}return _0x4dabf3[_0x226c('0x23')]();};}function saveUpdates(_0x272f26,_0x57eb9f){return function(_0x575c7a){if(_0x575c7a){return _0x575c7a['update'](_0x272f26)[_0x226c('0x24')](function(_0x52985c){return _0x52985c;});}return null;};}function removeEntity(_0x4da72c,_0xbaee21){return function(_0x5b3919){if(_0x5b3919){return _0x5b3919[_0x226c('0x25')]()[_0x226c('0x24')](function(){_0x4da72c[_0x226c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25165d,_0x590ad6){return function(_0x14d6ec){if(!_0x14d6ec){_0x25165d['sendStatus'](0x194);}return _0x14d6ec;};}function handleError(_0x36d254,_0x39eebc){_0x39eebc=_0x39eebc||0x1f4;return function(_0x22a286){logger['error'](_0x22a286[_0x226c('0x26')]);if(_0x22a286['name']){delete _0x22a286[_0x226c('0x27')];}_0x36d254['status'](_0x39eebc)[_0x226c('0x28')](_0x22a286);};}exports['index']=function(_0x40a095,_0x1de6bb){var _0x5ef37f={},_0x54f175={},_0x3b1e93={'count':0x0,'rows':[]};var _0x3f4c2b=_[_0x226c('0x29')](db[_0x226c('0x2a')][_0x226c('0x2b')],function(_0x253aeb){return{'name':_0x253aeb[_0x226c('0x2c')],'type':_0x253aeb[_0x226c('0x2d')][_0x226c('0x2e')]};});_0x54f175[_0x226c('0x2f')]=_[_0x226c('0x29')](_0x3f4c2b,_0x226c('0x27'));_0x54f175['query']=_[_0x226c('0x30')](_0x40a095[_0x226c('0x31')]);_0x54f175[_0x226c('0x32')]=_[_0x226c('0x33')](_0x54f175[_0x226c('0x2f')],_0x54f175['query']);_0x5ef37f[_0x226c('0x34')]=_[_0x226c('0x33')](_0x54f175[_0x226c('0x2f')],qs['fields'](_0x40a095[_0x226c('0x31')]['fields']));_0x5ef37f[_0x226c('0x34')]=_0x5ef37f[_0x226c('0x34')][_0x226c('0x35')]?_0x5ef37f[_0x226c('0x34')]:_0x54f175[_0x226c('0x2f')];if(!_0x40a095[_0x226c('0x31')][_0x226c('0x36')](_0x226c('0x37'))){_0x5ef37f[_0x226c('0x1d')]=qs[_0x226c('0x1d')](_0x40a095[_0x226c('0x31')][_0x226c('0x1d')]);_0x5ef37f[_0x226c('0x1b')]=qs[_0x226c('0x1b')](_0x40a095['query'][_0x226c('0x1b')]);}_0x5ef37f[_0x226c('0x38')]=qs[_0x226c('0x39')](_0x40a095[_0x226c('0x31')][_0x226c('0x39')]);_0x5ef37f[_0x226c('0x3a')]=qs[_0x226c('0x32')](_[_0x226c('0x3b')](_0x40a095[_0x226c('0x31')],_0x54f175['filters']),_0x3f4c2b);if(_0x40a095['query'][_0x226c('0x3c')]){_0x5ef37f[_0x226c('0x3a')]=_[_0x226c('0x3d')](_0x5ef37f[_0x226c('0x3a')],{'$or':_[_0x226c('0x29')](_0x3f4c2b,function(_0x45f181){if(_0x45f181[_0x226c('0x2d')]!==_0x226c('0x3e')){var _0x182b01={};_0x182b01[_0x45f181['name']]={'$like':'%'+_0x40a095[_0x226c('0x31')]['filter']+'%'};return _0x182b01;}})});}_0x5ef37f=_[_0x226c('0x3d')]({},_0x5ef37f,_0x40a095[_0x226c('0x3f')]);var _0x115fb4={'where':_0x5ef37f['where']};return db['FreshdeskField'][_0x226c('0x1e')](_0x115fb4)[_0x226c('0x24')](function(_0x4f709a){_0x3b1e93[_0x226c('0x1e')]=_0x4f709a;if(_0x40a095[_0x226c('0x31')][_0x226c('0x40')]){_0x5ef37f[_0x226c('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0x226c('0x42')](_0x5ef37f);})[_0x226c('0x24')](function(_0x12f34d){_0x3b1e93['rows']=_0x12f34d;return _0x3b1e93;})[_0x226c('0x24')](respondWithFilteredResult(_0x1de6bb,_0x5ef37f))[_0x226c('0x43')](handleError(_0x1de6bb,null));};exports[_0x226c('0x44')]=function(_0x2305bc,_0x34b7cf){var _0x5bff01={'raw':!![],'where':{'id':_0x2305bc['params']['id']}},_0x5ea01f={};_0x5ea01f[_0x226c('0x2f')]=_[_0x226c('0x30')](db[_0x226c('0x2a')][_0x226c('0x2b')]);_0x5ea01f[_0x226c('0x31')]=_[_0x226c('0x30')](_0x2305bc[_0x226c('0x31')]);_0x5ea01f[_0x226c('0x32')]=_[_0x226c('0x33')](_0x5ea01f['model'],_0x5ea01f['query']);_0x5bff01[_0x226c('0x34')]=_[_0x226c('0x33')](_0x5ea01f['model'],qs[_0x226c('0x45')](_0x2305bc['query']['fields']));_0x5bff01[_0x226c('0x34')]=_0x5bff01['attributes'][_0x226c('0x35')]?_0x5bff01[_0x226c('0x34')]:_0x5ea01f[_0x226c('0x2f')];if(_0x2305bc[_0x226c('0x31')][_0x226c('0x40')]){_0x5bff01[_0x226c('0x41')]=[{'all':!![]}];}_0x5bff01=_['merge']({},_0x5bff01,_0x2305bc[_0x226c('0x3f')]);return db['FreshdeskField'][_0x226c('0x46')](_0x5bff01)[_0x226c('0x24')](handleEntityNotFound(_0x34b7cf,null))[_0x226c('0x24')](respondWithResult(_0x34b7cf,null))[_0x226c('0x43')](handleError(_0x34b7cf,null));};exports['create']=function(_0x42042d,_0x524088){return db[_0x226c('0x2a')][_0x226c('0x47')](_0x42042d[_0x226c('0x48')],{})[_0x226c('0x24')](respondWithResult(_0x524088,0xc9))[_0x226c('0x43')](handleError(_0x524088,null));};exports[_0x226c('0x49')]=function(_0x4f99f5,_0x21c046){if(_0x4f99f5[_0x226c('0x48')]['id']){delete _0x4f99f5[_0x226c('0x48')]['id'];}return db[_0x226c('0x2a')][_0x226c('0x46')]({'where':{'id':_0x4f99f5[_0x226c('0x4a')]['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x21c046,null))[_0x226c('0x24')](saveUpdates(_0x4f99f5[_0x226c('0x48')],null))[_0x226c('0x24')](respondWithResult(_0x21c046,null))[_0x226c('0x43')](handleError(_0x21c046,null));};exports[_0x226c('0x25')]=function(_0x5f3434,_0x552580){return db['FreshdeskField'][_0x226c('0x46')]({'where':{'id':_0x5f3434[_0x226c('0x4a')]['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x552580,null))['then'](removeEntity(_0x552580,null))[_0x226c('0x43')](handleError(_0x552580,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6ca8465..ebd92e1 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 _0x9e06=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x525bcf,_0x428c0c){var _0x4c3486=function(_0xf87f2){while(--_0xf87f2){_0x525bcf['push'](_0x525bcf['shift']());}};_0x4c3486(++_0x428c0c);}(_0x9e06,0x14f));var _0x69e0=function(_0x1b0c1d,_0x10621b){_0x1b0c1d=_0x1b0c1d-0x0;var _0x4f2e57=_0x9e06[_0x1b0c1d];return _0x4f2e57;};'use strict';var _=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var logger=require(_0x69e0('0x2'))('api');var moment=require(_0x69e0('0x3'));var BPromise=require(_0x69e0('0x4'));var rp=require(_0x69e0('0x5'));var fs=require('fs');var path=require(_0x69e0('0x6'));var rimraf=require(_0x69e0('0x7'));var config=require(_0x69e0('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0x69e0('0x9')]=function(_0x5de76a,_0x4c1ddc){return _0x5de76a[_0x69e0('0xa')](_0x69e0('0xb'),attributes,{'tableName':_0x69e0('0xc'),'paranoid':![],'indexes':[{'name':_0x69e0('0xd'),'fields':[_0x69e0('0xe'),_0x69e0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b9c=['moment','request-promise','rimraf','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api'];(function(_0x22021a,_0x3afc0f){var _0x324fb4=function(_0x22e4fe){while(--_0x22e4fe){_0x22021a['push'](_0x22021a['shift']());}};_0x324fb4(++_0x3afc0f);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x47a2b1,_0x4c3379){_0x47a2b1=_0x47a2b1-0x0;var _0x43eac7=_0x1b9c[_0x47a2b1];return _0x43eac7;};'use strict';var _=require(_0xc1b9('0x0'));var util=require(_0xc1b9('0x1'));var logger=require('../../config/logger')(_0xc1b9('0x2'));var moment=require(_0xc1b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc1b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1b9('0x6'));module['exports']=function(_0x21e501,_0x56a1f5){return _0x21e501['define'](_0xc1b9('0x7'),attributes,{'tableName':_0xc1b9('0x8'),'paranoid':![],'indexes':[{'name':_0xc1b9('0x9'),'fields':[_0xc1b9('0xa'),_0xc1b9('0xb')],'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 1d63584..747fcc3 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 _0xfab1=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3ee075,_0x2fb99f){var _0xd86d31=function(_0x3373e9){while(--_0x3373e9){_0x3ee075['push'](_0x3ee075['shift']());}};_0xd86d31(++_0x2fb99f);}(_0xfab1,0x159));var _0x1fab=function(_0x18da9d,_0x559a94){_0x18da9d=_0x18da9d-0x0;var _0x2563e8=_0xfab1[_0x18da9d];return _0x2563e8;};'use strict';var _=require(_0x1fab('0x0'));var util=require(_0x1fab('0x1'));var moment=require(_0x1fab('0x2'));var BPromise=require(_0x1fab('0x3'));var rs=require(_0x1fab('0x4'));var fs=require('fs');var Redis=require(_0x1fab('0x5'));var db=require(_0x1fab('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fab('0x7'))(_0x1fab('0x8'));var config=require(_0x1fab('0x9'));var jayson=require(_0x1fab('0xa'));var client=jayson[_0x1fab('0xb')][_0x1fab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x464935,_0x357d5a,_0x1b9b51){return new BPromise(function(_0x44c526,_0xa1c283){return client[_0x1fab('0xd')](_0x464935,_0x1b9b51)[_0x1fab('0xe')](function(_0x1c6be0){logger[_0x1fab('0xf')](_0x1fab('0x10'),_0x357d5a,'request\x20sent');logger[_0x1fab('0x11')](_0x1fab('0x12'),_0x357d5a,'request\x20sent',JSON[_0x1fab('0x13')](_0x1c6be0));if(_0x1c6be0[_0x1fab('0x14')]){if(_0x1c6be0['error'][_0x1fab('0x15')]===0x1f4){logger[_0x1fab('0x14')](_0x1fab('0x10'),_0x357d5a,_0x1c6be0[_0x1fab('0x14')][_0x1fab('0x16')]);return _0xa1c283(_0x1c6be0[_0x1fab('0x14')][_0x1fab('0x16')]);}logger[_0x1fab('0x14')](_0x1fab('0x10'),_0x357d5a,_0x1c6be0['error']['message']);return _0x44c526(_0x1c6be0['error'][_0x1fab('0x16')]);}else{logger[_0x1fab('0xf')](_0x1fab('0x10'),_0x357d5a,_0x1fab('0x17'));_0x44c526(_0x1c6be0[_0x1fab('0x18')][_0x1fab('0x16')]);}})[_0x1fab('0x19')](function(_0x46582f){logger[_0x1fab('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x357d5a,_0x46582f);_0xa1c283(_0x46582f);});});} \ No newline at end of file +var _0xa89d=['info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x34080e,_0xe6374){var _0xc2fc68=function(_0x59c8d0){while(--_0x59c8d0){_0x34080e['push'](_0x34080e['shift']());}};_0xc2fc68(++_0xe6374);}(_0xa89d,0xdc));var _0xda89=function(_0x5e2525,_0x3691e6){_0x5e2525=_0x5e2525-0x0;var _0x4f7a51=_0xa89d[_0x5e2525];return _0x4f7a51;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xda89('0x0'));var rs=require(_0xda89('0x1'));var fs=require('fs');var Redis=require(_0xda89('0x2'));var db=require(_0xda89('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xda89('0x4'))(_0xda89('0x5'));var config=require(_0xda89('0x6'));var jayson=require(_0xda89('0x7'));var client=jayson[_0xda89('0x8')][_0xda89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e8abc,_0x6509f5,_0x37f78d){return new BPromise(function(_0x49e35e,_0x4fc110){return client['request'](_0x1e8abc,_0x37f78d)[_0xda89('0xa')](function(_0xca0a88){logger[_0xda89('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x6509f5,_0xda89('0xc'));logger[_0xda89('0xd')](_0xda89('0xe'),_0x6509f5,_0xda89('0xc'),JSON[_0xda89('0xf')](_0xca0a88));if(_0xca0a88[_0xda89('0x10')]){if(_0xca0a88[_0xda89('0x10')][_0xda89('0x11')]===0x1f4){logger[_0xda89('0x10')](_0xda89('0x12'),_0x6509f5,_0xca0a88['error']['message']);return _0x4fc110(_0xca0a88['error'][_0xda89('0x13')]);}logger[_0xda89('0x10')](_0xda89('0x12'),_0x6509f5,_0xca0a88[_0xda89('0x10')][_0xda89('0x13')]);return _0x49e35e(_0xca0a88[_0xda89('0x10')][_0xda89('0x13')]);}else{logger[_0xda89('0xb')](_0xda89('0x12'),_0x6509f5,_0xda89('0xc'));_0x49e35e(_0xca0a88[_0xda89('0x14')][_0xda89('0x13')]);}})['catch'](function(_0x27ff57){logger['error'](_0xda89('0x12'),_0x6509f5,_0x27ff57);_0x4fc110(_0x27ff57);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f093689..31c95de 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 _0x153f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x153f,0x15b));var _0xf153=function(_0x16a9e0,_0x41b503){_0x16a9e0=_0x16a9e0-0x0;var _0x308ccb=_0x153f[_0x16a9e0];return _0x308ccb;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),controller[_0xf153('0x11')]);router[_0xf153('0x12')]('/:id/configurations',auth[_0xf153('0xa')](),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0x15'),auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x17')](_0xf153('0x15'),auth[_0xf153('0xa')](),controller['destroy']);module[_0xf153('0x18')]=router; \ No newline at end of file +var _0xe5b5=['index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x5a5751,_0xdc8c25){var _0x279e9e=function(_0x11f550){while(--_0x11f550){_0x5a5751['push'](_0x5a5751['shift']());}};_0x279e9e(++_0xdc8c25);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xe5b5[_0x34933a];return _0x36abb4;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/fields',auth[_0x5e5b('0xc')](),controller['getFields']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router[_0x5e5b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e5b('0x14')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller['destroy']);module[_0x5e5b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6966224..f25f02c 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 _0x1893=['STRING','username','remoteUri'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x1893,0xa2));var _0x3189=function(_0xc9bc0f,_0x12e2ac){_0xc9bc0f=_0xc9bc0f-0x0;var _0x4aacbc=_0x1893[_0xc9bc0f];return _0x4aacbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x27e297,_0x789346){var _0x2c1458=function(_0x2a7346){while(--_0x2a7346){_0x27e297['push'](_0x27e297['shift']());}};_0x2c1458(++_0x789346);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2ea1da,_0x1d444b){_0x2ea1da=_0x2ea1da-0x0;var _0x37f88c=_0xdd4f[_0x2ea1da];return _0x37f88c;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 363dc0c..fa8abb9 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 _0x3206=['Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','findOne','map','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','Token\x20token=','users','email'];(function(_0x55c0db,_0x1ed0d2){var _0xedbe65=function(_0x3a2b6a){while(--_0x3a2b6a){_0x55c0db['push'](_0x55c0db['shift']());}};_0xedbe65(++_0x1ed0d2);}(_0x3206,0x132));var _0x6320=function(_0x4f9c08,_0x4d83df){_0x4f9c08=_0x4f9c08-0x0;var _0x4da7e5=_0x3206[_0x4f9c08];return _0x4da7e5;};'use strict';var emlformat=require(_0x6320('0x0'));var rimraf=require(_0x6320('0x1'));var zipdir=require(_0x6320('0x2'));var jsonpatch=require(_0x6320('0x3'));var rp=require(_0x6320('0x4'));var moment=require(_0x6320('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6320('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6320('0x7'));var csv=require('to-csv');var ejs=require(_0x6320('0x8'));var fs=require('fs');var fs_extra=require(_0x6320('0x9'));var _=require(_0x6320('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6320('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6320('0xc'));var querystring=require(_0x6320('0xd'));var Papa=require(_0x6320('0xe'));var Redis=require(_0x6320('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6320('0x10'));var as=require(_0x6320('0x11'));var hardwareService=require(_0x6320('0x12'));var logger=require(_0x6320('0x13'))(_0x6320('0x14'));var utils=require(_0x6320('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6320('0x16'));var db=require(_0x6320('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b6b4d,_0x2c29b3){_0x2c29b3=_0x2c29b3||0xcc;return function(_0xe707b8){if(_0xe707b8){return _0x1b6b4d[_0x6320('0x18')](_0x2c29b3);}return _0x1b6b4d[_0x6320('0x19')](_0x2c29b3)[_0x6320('0x1a')]();};}function respondWithResult(_0x48f6a1,_0x1df075){_0x1df075=_0x1df075||0xc8;return function(_0x5a1e77){if(_0x5a1e77){return _0x48f6a1[_0x6320('0x19')](_0x1df075)[_0x6320('0x1b')](_0x5a1e77);}};}function respondWithFilteredResult(_0x26f0d6,_0x8a08f7){return function(_0x2015da){if(_0x2015da){var _0x122d59=typeof _0x8a08f7[_0x6320('0x1c')]==='undefined'&&typeof _0x8a08f7[_0x6320('0x1d')]===_0x6320('0x1e');var _0x5c0bb8=_0x2015da['count'];var _0x52eaad=_0x122d59?0x0:_0x8a08f7[_0x6320('0x1c')];var _0x1d0025=_0x122d59?_0x2015da[_0x6320('0x1f')]:_0x8a08f7[_0x6320('0x1c')]+_0x8a08f7['limit'];var _0x5e5131;if(_0x1d0025>=_0x5c0bb8){_0x1d0025=_0x5c0bb8;_0x5e5131=0xc8;}else{_0x5e5131=0xce;}_0x26f0d6[_0x6320('0x19')](_0x5e5131);return _0x26f0d6[_0x6320('0x20')](_0x6320('0x21'),_0x52eaad+'-'+_0x1d0025+'/'+_0x5c0bb8)[_0x6320('0x1b')](_0x2015da);}return null;};}function patchUpdates(_0x1ad19a){return function(_0xa029a6){try{jsonpatch[_0x6320('0x22')](_0xa029a6,_0x1ad19a,!![]);}catch(_0x34af55){return BPromise[_0x6320('0x23')](_0x34af55);}return _0xa029a6[_0x6320('0x24')]();};}function saveUpdates(_0x247097,_0x5cf4db){return function(_0x1277b8){if(_0x1277b8){return _0x1277b8[_0x6320('0x25')](_0x247097)['then'](function(_0x365b74){return _0x365b74;});}return null;};}function removeEntity(_0x41a35a,_0x2634e2){return function(_0x478420){if(_0x478420){return _0x478420['destroy']()[_0x6320('0x26')](function(){_0x41a35a[_0x6320('0x19')](0xcc)[_0x6320('0x1a')]();});}};}function handleEntityNotFound(_0x319167,_0x2fe6aa){return function(_0x3d562d){if(!_0x3d562d){_0x319167[_0x6320('0x18')](0x194);}return _0x3d562d;};}function handleError(_0x243c91,_0x11d8a8){_0x11d8a8=_0x11d8a8||0x1f4;return function(_0x286853){logger[_0x6320('0x27')](_0x286853[_0x6320('0x28')]);if(_0x286853[_0x6320('0x29')]){delete _0x286853[_0x6320('0x29')];}_0x243c91['status'](_0x11d8a8)[_0x6320('0x2a')](_0x286853);};}exports['index']=function(_0x1a2ddf,_0x388382){var _0x3ec7b0={},_0x5bfdfb={},_0x5ea36c={'count':0x0,'rows':[]};var _0xf95edf=_['map'](db[_0x6320('0x2b')][_0x6320('0x2c')],function(_0x140d58){return{'name':_0x140d58[_0x6320('0x2d')],'type':_0x140d58[_0x6320('0x2e')]['key']};});_0x5bfdfb[_0x6320('0x2f')]=_['map'](_0xf95edf,_0x6320('0x29'));_0x5bfdfb[_0x6320('0x30')]=_[_0x6320('0x31')](_0x1a2ddf['query']);_0x5bfdfb[_0x6320('0x32')]=_[_0x6320('0x33')](_0x5bfdfb['model'],_0x5bfdfb[_0x6320('0x30')]);_0x3ec7b0[_0x6320('0x34')]=_['intersection'](_0x5bfdfb[_0x6320('0x2f')],qs['fields'](_0x1a2ddf[_0x6320('0x30')][_0x6320('0x35')]));_0x3ec7b0[_0x6320('0x34')]=_0x3ec7b0[_0x6320('0x34')]['length']?_0x3ec7b0[_0x6320('0x34')]:_0x5bfdfb[_0x6320('0x2f')];if(!_0x1a2ddf['query']['hasOwnProperty']('nolimit')){_0x3ec7b0['limit']=qs[_0x6320('0x1d')](_0x1a2ddf['query'][_0x6320('0x1d')]);_0x3ec7b0['offset']=qs[_0x6320('0x1c')](_0x1a2ddf[_0x6320('0x30')][_0x6320('0x1c')]);}_0x3ec7b0[_0x6320('0x36')]=qs[_0x6320('0x37')](_0x1a2ddf[_0x6320('0x30')][_0x6320('0x37')]);_0x3ec7b0[_0x6320('0x38')]=qs[_0x6320('0x32')](_[_0x6320('0x39')](_0x1a2ddf[_0x6320('0x30')],_0x5bfdfb[_0x6320('0x32')]),_0xf95edf);if(_0x1a2ddf['query'][_0x6320('0x3a')]){_0x3ec7b0['where']=_['merge'](_0x3ec7b0[_0x6320('0x38')],{'$or':_['map'](_0xf95edf,function(_0x46f3bc){if(_0x46f3bc[_0x6320('0x2e')]!==_0x6320('0x3b')){var _0x27d747={};_0x27d747[_0x46f3bc['name']]={'$like':'%'+_0x1a2ddf[_0x6320('0x30')][_0x6320('0x3a')]+'%'};return _0x27d747;}})});}_0x3ec7b0=_[_0x6320('0x3c')]({},_0x3ec7b0,_0x1a2ddf[_0x6320('0x3d')]);var _0x5da4b8={'where':_0x3ec7b0[_0x6320('0x38')]};return db[_0x6320('0x2b')][_0x6320('0x1f')](_0x5da4b8)['then'](function(_0x354afa){_0x5ea36c[_0x6320('0x1f')]=_0x354afa;if(_0x1a2ddf[_0x6320('0x30')][_0x6320('0x3e')]){_0x3ec7b0['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x6320('0x3f')](_0x3ec7b0);})[_0x6320('0x26')](function(_0x2c5fb0){_0x5ea36c[_0x6320('0x40')]=_0x2c5fb0;return _0x5ea36c;})['then'](respondWithFilteredResult(_0x388382,_0x3ec7b0))[_0x6320('0x41')](handleError(_0x388382,null));};exports[_0x6320('0x42')]=function(_0x49d1cb,_0x499ddf){var _0x3c9baf={'raw':![],'where':{'id':_0x49d1cb[_0x6320('0x43')]['id']}},_0x348ef={};_0x348ef[_0x6320('0x2f')]=_['keys'](db[_0x6320('0x2b')]['rawAttributes']);_0x348ef['query']=_[_0x6320('0x31')](_0x49d1cb['query']);_0x348ef['filters']=_[_0x6320('0x33')](_0x348ef[_0x6320('0x2f')],_0x348ef[_0x6320('0x30')]);_0x3c9baf[_0x6320('0x34')]=_['intersection'](_0x348ef[_0x6320('0x2f')],qs[_0x6320('0x35')](_0x49d1cb[_0x6320('0x30')]['fields']));_0x3c9baf[_0x6320('0x34')]=_0x3c9baf[_0x6320('0x34')][_0x6320('0x44')]?_0x3c9baf[_0x6320('0x34')]:_0x348ef[_0x6320('0x2f')];if(_0x49d1cb[_0x6320('0x30')][_0x6320('0x3e')]){_0x3c9baf[_0x6320('0x45')]=[{'all':!![]}];}_0x3c9baf=_[_0x6320('0x3c')]({},_0x3c9baf,_0x49d1cb[_0x6320('0x3d')]);return db[_0x6320('0x2b')][_0x6320('0x46')](_0x3c9baf)[_0x6320('0x26')](handleEntityNotFound(_0x499ddf,null))[_0x6320('0x26')](respondWithResult(_0x499ddf,null))[_0x6320('0x41')](handleError(_0x499ddf,null));};exports[_0x6320('0x47')]=function(_0x5d90d5,_0x2a20ec){return db['FreshsalesAccount'][_0x6320('0x47')](_0x5d90d5[_0x6320('0x48')],{})[_0x6320('0x26')](respondWithResult(_0x2a20ec,0xc9))[_0x6320('0x41')](handleError(_0x2a20ec,null));};exports[_0x6320('0x25')]=function(_0x38f28e,_0x8d6377){if(_0x38f28e['body']['id']){delete _0x38f28e[_0x6320('0x48')]['id'];}return db[_0x6320('0x2b')][_0x6320('0x46')]({'where':{'id':_0x38f28e[_0x6320('0x43')]['id']}})[_0x6320('0x26')](handleEntityNotFound(_0x8d6377,null))[_0x6320('0x26')](saveUpdates(_0x38f28e[_0x6320('0x48')],null))[_0x6320('0x26')](respondWithResult(_0x8d6377,null))['catch'](handleError(_0x8d6377,null));};exports['destroy']=function(_0x24f496,_0x191d5a){return db['FreshsalesAccount'][_0x6320('0x46')]({'where':{'id':_0x24f496[_0x6320('0x43')]['id']}})['then'](handleEntityNotFound(_0x191d5a,null))[_0x6320('0x26')](removeEntity(_0x191d5a,null))['catch'](handleError(_0x191d5a,null));};exports['getConfigurations']=function(_0x17d8bc,_0x4e10bd,_0x51a25b){var _0x1bed3f={};var _0x1212e3={};var _0xbd948a;var _0x43c59f;return db[_0x6320('0x2b')][_0x6320('0x49')]({'where':{'id':_0x17d8bc[_0x6320('0x43')]['id']}})[_0x6320('0x26')](handleEntityNotFound(_0x4e10bd,null))[_0x6320('0x26')](function(_0x4b9417){if(_0x4b9417){_0xbd948a=_0x4b9417;_0x1212e3[_0x6320('0x2f')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x1212e3[_0x6320('0x30')]=_[_0x6320('0x31')](_0x17d8bc[_0x6320('0x30')]);_0x1212e3[_0x6320('0x32')]=_[_0x6320('0x33')](_0x1212e3[_0x6320('0x2f')],_0x1212e3['query']);_0x1bed3f['attributes']=_[_0x6320('0x33')](_0x1212e3[_0x6320('0x2f')],qs[_0x6320('0x35')](_0x17d8bc['query'][_0x6320('0x35')]));_0x1bed3f[_0x6320('0x34')]=_0x1bed3f[_0x6320('0x34')][_0x6320('0x44')]?_0x1bed3f['attributes']:_0x1212e3[_0x6320('0x2f')];_0x1bed3f['order']=qs['sort'](_0x17d8bc[_0x6320('0x30')][_0x6320('0x37')]);_0x1bed3f[_0x6320('0x38')]=qs[_0x6320('0x32')](_[_0x6320('0x39')](_0x17d8bc[_0x6320('0x30')],_0x1212e3['filters']));if(_0x17d8bc['query']['filter']){_0x1bed3f[_0x6320('0x38')]=_[_0x6320('0x3c')](_0x1bed3f[_0x6320('0x38')],{'$or':_[_0x6320('0x4a')](_0x1bed3f['attributes'],function(_0xf79faf){var _0x310e81={};_0x310e81[_0xf79faf]={'$like':'%'+_0x17d8bc[_0x6320('0x30')][_0x6320('0x3a')]+'%'};return _0x310e81;})});}_0x1bed3f=_['merge']({},_0x1bed3f,_0x17d8bc[_0x6320('0x3d')]);return _0xbd948a[_0x6320('0x4b')](_0x1bed3f);}})['then'](function(_0x16fd36){if(_0x16fd36){_0x43c59f=_0x16fd36[_0x6320('0x44')];if(!_0x17d8bc[_0x6320('0x30')][_0x6320('0x4c')]('nolimit')){_0x1bed3f['limit']=qs[_0x6320('0x1d')](_0x17d8bc['query'][_0x6320('0x1d')]);_0x1bed3f[_0x6320('0x1c')]=qs['offset'](_0x17d8bc[_0x6320('0x30')][_0x6320('0x1c')]);}return _0xbd948a['getConfigurations'](_0x1bed3f);}})[_0x6320('0x26')](function(_0x169eca){if(_0x169eca){return _0x169eca?{'count':_0x43c59f,'rows':_0x169eca}:null;}})['then'](respondWithResult(_0x4e10bd,null))['catch'](handleError(_0x4e10bd,null));};exports['addConfiguration']=function(_0x3dc18a,_0x2a8d97,_0x47f51f){if(_0x3dc18a[_0x6320('0x48')]['id']){delete _0x3dc18a['body']['id'];}return db[_0x6320('0x2b')]['findOne']({'where':{'id':_0x3dc18a[_0x6320('0x43')]['id']}})[_0x6320('0x26')](handleEntityNotFound(_0x2a8d97,null))[_0x6320('0x26')](function(_0x16d2da){if(_0x16d2da){_0x3dc18a['body'][_0x6320('0x4d')]=_0x16d2da['id'];_0x3dc18a[_0x6320('0x48')][_0x6320('0x4e')]=integrations[_0x6320('0x4f')](_0x3dc18a[_0x6320('0x48')][_0x6320('0x50')],_0x3dc18a['body'][_0x6320('0x2e')]);_0x3dc18a[_0x6320('0x48')]['Descriptions']=integrations['getDescriptions'](_0x3dc18a['body'][_0x6320('0x50')],_0x3dc18a[_0x6320('0x48')][_0x6320('0x2e')]);return db[_0x6320('0x51')][_0x6320('0x47')](_0x3dc18a[_0x6320('0x48')],{'include':[{'model':db[_0x6320('0x52')],'as':_0x6320('0x4e')},{'model':db[_0x6320('0x52')],'as':_0x6320('0x53')}]});}return null;})['then'](respondWithResult(_0x2a8d97,null))[_0x6320('0x41')](handleError(_0x2a8d97,null));};exports['getFields']=function(_0x46dbd4,_0x13e2a7,_0x8518b8){var _0x1b609d='';var _0x3f47f4='';return db[_0x6320('0x2b')]['findOne']({'where':{'id':_0x46dbd4[_0x6320('0x43')]['id']},'attributes':['id','username',_0x6320('0x54'),_0x6320('0x55')]})[_0x6320('0x26')](handleEntityNotFound(_0x13e2a7,null))[_0x6320('0x26')](function(_0x2177f3){if(_0x2177f3){_0x3f47f4=_0x2177f3['username'];_0x1b609d=_0x2177f3[_0x6320('0x54')];var _0x3ba25f=_0x2177f3[_0x6320('0x54')][_0x6320('0x56')](-0x1);if(_0x3ba25f==='/'){_0x1b609d=_0x1b609d[_0x6320('0x57')](0x0,_0x1b609d[_0x6320('0x58')](_0x3ba25f));}return rp({'method':_0x6320('0x59'),'uri':util['format'](_0x6320('0x5a'),_0x1b609d,'/api/selector/owners'),'headers':{'Authorization':_0x6320('0x5b')+_0x2177f3['apiKey']},'json':!![]});}})[_0x6320('0x26')](function(_0x1d3dda){if(_0x1d3dda){var _0x38a349=_0x1d3dda[_0x6320('0x5c')];var _0x3f5ab6=![];var _0x25ed22=null;for(_0x25ed22=0x0;_0x25ed22<_0x38a349[_0x6320('0x44')];_0x25ed22++){if(_0x38a349[_0x25ed22][_0x6320('0x5d')]===_0x3f47f4){_0x3f5ab6=!![];}}if(_0x3f5ab6){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6320('0x5e')});}}})[_0x6320('0x26')](respondWithResult(_0x13e2a7,null))[_0x6320('0x41')](function(_0x3b1434){var _0x375d58=_0x46dbd4['query']['test']?0x1f4:_0x3b1434[_0x6320('0x5f')]||0x1f4;logger[_0x6320('0x27')](_0x6320('0x60'),_0x6320('0x61'),_0x375d58,JSON[_0x6320('0x62')](_0x3b1434));delete _0x3b1434['name'];if(_0x375d58===0x191){_0x375d58=0x190;}_0x13e2a7['status'](_0x375d58)[_0x6320('0x2a')](_0x46dbd4['query'][_0x6320('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x3b1434['statusCode']}:_0x3b1434);});}; \ No newline at end of file +var _0x1745=['sendStatus','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshsalesField','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x1d6f48,_0x1498c4){var _0x34a241=function(_0x1bb415){while(--_0x1bb415){_0x1d6f48['push'](_0x1d6f48['shift']());}};_0x34a241(++_0x1498c4);}(_0x1745,0x1e7));var _0x5174=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1745[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x5174('0x0'));var rimraf=require(_0x5174('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5174('0x2'));var rp=require('request-promise');var moment=require(_0x5174('0x3'));var BPromise=require(_0x5174('0x4'));var Mustache=require(_0x5174('0x5'));var util=require(_0x5174('0x6'));var path=require(_0x5174('0x7'));var sox=require(_0x5174('0x8'));var csv=require(_0x5174('0x9'));var ejs=require(_0x5174('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5174('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5174('0xc'));var toCsv=require(_0x5174('0x9'));var querystring=require(_0x5174('0xd'));var Papa=require(_0x5174('0xe'));var Redis=require(_0x5174('0xf'));var authService=require(_0x5174('0x10'));var qs=require(_0x5174('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5174('0x12'));var logger=require(_0x5174('0x13'))(_0x5174('0x14'));var utils=require(_0x5174('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5174('0x16'));var db=require(_0x5174('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5081ba,_0x613c14){_0x613c14=_0x613c14||0xcc;return function(_0x134b65){if(_0x134b65){return _0x5081ba['sendStatus'](_0x613c14);}return _0x5081ba[_0x5174('0x18')](_0x613c14)[_0x5174('0x19')]();};}function respondWithResult(_0x21650b,_0x10fa9d){_0x10fa9d=_0x10fa9d||0xc8;return function(_0x370893){if(_0x370893){return _0x21650b['status'](_0x10fa9d)[_0x5174('0x1a')](_0x370893);}};}function respondWithFilteredResult(_0x1a4375,_0xcba1c7){return function(_0x2b1ef2){if(_0x2b1ef2){var _0x42a9ae=typeof _0xcba1c7[_0x5174('0x1b')]===_0x5174('0x1c')&&typeof _0xcba1c7[_0x5174('0x1d')]===_0x5174('0x1c');var _0xf5f8e2=_0x2b1ef2[_0x5174('0x1e')];var _0x4e8909=_0x42a9ae?0x0:_0xcba1c7[_0x5174('0x1b')];var _0x5031cd=_0x42a9ae?_0x2b1ef2[_0x5174('0x1e')]:_0xcba1c7[_0x5174('0x1b')]+_0xcba1c7[_0x5174('0x1d')];var _0x18b065;if(_0x5031cd>=_0xf5f8e2){_0x5031cd=_0xf5f8e2;_0x18b065=0xc8;}else{_0x18b065=0xce;}_0x1a4375[_0x5174('0x18')](_0x18b065);return _0x1a4375[_0x5174('0x1f')](_0x5174('0x20'),_0x4e8909+'-'+_0x5031cd+'/'+_0xf5f8e2)['json'](_0x2b1ef2);}return null;};}function patchUpdates(_0xbdfa43){return function(_0x3ec1fa){try{jsonpatch[_0x5174('0x21')](_0x3ec1fa,_0xbdfa43,!![]);}catch(_0x455512){return BPromise[_0x5174('0x22')](_0x455512);}return _0x3ec1fa[_0x5174('0x23')]();};}function saveUpdates(_0x50d83f,_0x7d2ba0){return function(_0x477a86){if(_0x477a86){return _0x477a86[_0x5174('0x24')](_0x50d83f)[_0x5174('0x25')](function(_0x13d571){return _0x13d571;});}return null;};}function removeEntity(_0x23fd22,_0x4a584c){return function(_0x24d32b){if(_0x24d32b){return _0x24d32b['destroy']()['then'](function(){_0x23fd22[_0x5174('0x18')](0xcc)[_0x5174('0x19')]();});}};}function handleEntityNotFound(_0x3fa4bb,_0x31c5a7){return function(_0x1fb131){if(!_0x1fb131){_0x3fa4bb[_0x5174('0x26')](0x194);}return _0x1fb131;};}function handleError(_0x2e34f1,_0x268616){_0x268616=_0x268616||0x1f4;return function(_0x32fa00){logger[_0x5174('0x27')](_0x32fa00[_0x5174('0x28')]);if(_0x32fa00[_0x5174('0x29')]){delete _0x32fa00[_0x5174('0x29')];}_0x2e34f1[_0x5174('0x18')](_0x268616)['send'](_0x32fa00);};}exports[_0x5174('0x2a')]=function(_0x142b37,_0x57efe7){var _0x4f99ea={},_0x2d8224={},_0x301b13={'count':0x0,'rows':[]};var _0xe8bbe1=_[_0x5174('0x2b')](db[_0x5174('0x2c')][_0x5174('0x2d')],function(_0x392cca){return{'name':_0x392cca[_0x5174('0x2e')],'type':_0x392cca[_0x5174('0x2f')][_0x5174('0x30')]};});_0x2d8224[_0x5174('0x31')]=_['map'](_0xe8bbe1,_0x5174('0x29'));_0x2d8224['query']=_['keys'](_0x142b37[_0x5174('0x32')]);_0x2d8224['filters']=_['intersection'](_0x2d8224['model'],_0x2d8224[_0x5174('0x32')]);_0x4f99ea['attributes']=_[_0x5174('0x33')](_0x2d8224[_0x5174('0x31')],qs[_0x5174('0x34')](_0x142b37[_0x5174('0x32')][_0x5174('0x34')]));_0x4f99ea[_0x5174('0x35')]=_0x4f99ea[_0x5174('0x35')]['length']?_0x4f99ea[_0x5174('0x35')]:_0x2d8224['model'];if(!_0x142b37[_0x5174('0x32')]['hasOwnProperty'](_0x5174('0x36'))){_0x4f99ea[_0x5174('0x1d')]=qs[_0x5174('0x1d')](_0x142b37[_0x5174('0x32')][_0x5174('0x1d')]);_0x4f99ea[_0x5174('0x1b')]=qs[_0x5174('0x1b')](_0x142b37[_0x5174('0x32')][_0x5174('0x1b')]);}_0x4f99ea[_0x5174('0x37')]=qs['sort'](_0x142b37['query'][_0x5174('0x38')]);_0x4f99ea[_0x5174('0x39')]=qs[_0x5174('0x3a')](_[_0x5174('0x3b')](_0x142b37[_0x5174('0x32')],_0x2d8224[_0x5174('0x3a')]),_0xe8bbe1);if(_0x142b37[_0x5174('0x32')][_0x5174('0x3c')]){_0x4f99ea['where']=_[_0x5174('0x3d')](_0x4f99ea[_0x5174('0x39')],{'$or':_['map'](_0xe8bbe1,function(_0xe4f976){if(_0xe4f976[_0x5174('0x2f')]!=='VIRTUAL'){var _0x5913a3={};_0x5913a3[_0xe4f976['name']]={'$like':'%'+_0x142b37[_0x5174('0x32')][_0x5174('0x3c')]+'%'};return _0x5913a3;}})});}_0x4f99ea=_[_0x5174('0x3d')]({},_0x4f99ea,_0x142b37['options']);var _0x31a7a2={'where':_0x4f99ea[_0x5174('0x39')]};return db[_0x5174('0x2c')][_0x5174('0x1e')](_0x31a7a2)[_0x5174('0x25')](function(_0x110306){_0x301b13[_0x5174('0x1e')]=_0x110306;if(_0x142b37['query'][_0x5174('0x3e')]){_0x4f99ea[_0x5174('0x3f')]=[{'all':!![]}];}return db[_0x5174('0x2c')][_0x5174('0x40')](_0x4f99ea);})[_0x5174('0x25')](function(_0x29eb46){_0x301b13[_0x5174('0x41')]=_0x29eb46;return _0x301b13;})[_0x5174('0x25')](respondWithFilteredResult(_0x57efe7,_0x4f99ea))[_0x5174('0x42')](handleError(_0x57efe7,null));};exports[_0x5174('0x43')]=function(_0x3bf032,_0x3e0cfc){var _0x46d4fd={'raw':![],'where':{'id':_0x3bf032[_0x5174('0x44')]['id']}},_0x244c70={};_0x244c70['model']=_[_0x5174('0x45')](db[_0x5174('0x2c')][_0x5174('0x2d')]);_0x244c70[_0x5174('0x32')]=_[_0x5174('0x45')](_0x3bf032['query']);_0x244c70[_0x5174('0x3a')]=_[_0x5174('0x33')](_0x244c70[_0x5174('0x31')],_0x244c70['query']);_0x46d4fd[_0x5174('0x35')]=_['intersection'](_0x244c70[_0x5174('0x31')],qs[_0x5174('0x34')](_0x3bf032[_0x5174('0x32')][_0x5174('0x34')]));_0x46d4fd[_0x5174('0x35')]=_0x46d4fd['attributes']['length']?_0x46d4fd['attributes']:_0x244c70[_0x5174('0x31')];if(_0x3bf032[_0x5174('0x32')][_0x5174('0x3e')]){_0x46d4fd[_0x5174('0x3f')]=[{'all':!![]}];}_0x46d4fd=_[_0x5174('0x3d')]({},_0x46d4fd,_0x3bf032[_0x5174('0x46')]);return db[_0x5174('0x2c')][_0x5174('0x47')](_0x46d4fd)[_0x5174('0x25')](handleEntityNotFound(_0x3e0cfc,null))[_0x5174('0x25')](respondWithResult(_0x3e0cfc,null))[_0x5174('0x42')](handleError(_0x3e0cfc,null));};exports['create']=function(_0x2f4bd8,_0x5ad994){return db[_0x5174('0x2c')]['create'](_0x2f4bd8['body'],{})['then'](respondWithResult(_0x5ad994,0xc9))[_0x5174('0x42')](handleError(_0x5ad994,null));};exports[_0x5174('0x24')]=function(_0xf47e4e,_0x3853c0){if(_0xf47e4e[_0x5174('0x48')]['id']){delete _0xf47e4e[_0x5174('0x48')]['id'];}return db[_0x5174('0x2c')]['find']({'where':{'id':_0xf47e4e[_0x5174('0x44')]['id']}})[_0x5174('0x25')](handleEntityNotFound(_0x3853c0,null))['then'](saveUpdates(_0xf47e4e[_0x5174('0x48')],null))[_0x5174('0x25')](respondWithResult(_0x3853c0,null))[_0x5174('0x42')](handleError(_0x3853c0,null));};exports[_0x5174('0x49')]=function(_0xc1ed88,_0x2aea2d){return db[_0x5174('0x2c')]['find']({'where':{'id':_0xc1ed88[_0x5174('0x44')]['id']}})['then'](handleEntityNotFound(_0x2aea2d,null))[_0x5174('0x25')](removeEntity(_0x2aea2d,null))[_0x5174('0x42')](handleError(_0x2aea2d,null));};exports[_0x5174('0x4a')]=function(_0x28ec51,_0x474f29,_0x3cdabc){var _0x1d0b4d={};var _0x5ce352={};var _0x3a8cb4;var _0x5bacc4;return db['FreshsalesAccount'][_0x5174('0x4b')]({'where':{'id':_0x28ec51[_0x5174('0x44')]['id']}})[_0x5174('0x25')](handleEntityNotFound(_0x474f29,null))[_0x5174('0x25')](function(_0x3cc628){if(_0x3cc628){_0x3a8cb4=_0x3cc628;_0x5ce352[_0x5174('0x31')]=_[_0x5174('0x45')](db[_0x5174('0x4c')][_0x5174('0x2d')]);_0x5ce352[_0x5174('0x32')]=_[_0x5174('0x45')](_0x28ec51[_0x5174('0x32')]);_0x5ce352[_0x5174('0x3a')]=_[_0x5174('0x33')](_0x5ce352[_0x5174('0x31')],_0x5ce352[_0x5174('0x32')]);_0x1d0b4d['attributes']=_[_0x5174('0x33')](_0x5ce352['model'],qs[_0x5174('0x34')](_0x28ec51[_0x5174('0x32')]['fields']));_0x1d0b4d[_0x5174('0x35')]=_0x1d0b4d[_0x5174('0x35')][_0x5174('0x4d')]?_0x1d0b4d[_0x5174('0x35')]:_0x5ce352['model'];_0x1d0b4d[_0x5174('0x37')]=qs[_0x5174('0x38')](_0x28ec51[_0x5174('0x32')][_0x5174('0x38')]);_0x1d0b4d[_0x5174('0x39')]=qs[_0x5174('0x3a')](_['pick'](_0x28ec51[_0x5174('0x32')],_0x5ce352[_0x5174('0x3a')]));if(_0x28ec51['query'][_0x5174('0x3c')]){_0x1d0b4d[_0x5174('0x39')]=_[_0x5174('0x3d')](_0x1d0b4d[_0x5174('0x39')],{'$or':_[_0x5174('0x2b')](_0x1d0b4d[_0x5174('0x35')],function(_0x303c01){var _0x442189={};_0x442189[_0x303c01]={'$like':'%'+_0x28ec51['query'][_0x5174('0x3c')]+'%'};return _0x442189;})});}_0x1d0b4d=_[_0x5174('0x3d')]({},_0x1d0b4d,_0x28ec51[_0x5174('0x46')]);return _0x3a8cb4[_0x5174('0x4a')](_0x1d0b4d);}})[_0x5174('0x25')](function(_0xad4ca3){if(_0xad4ca3){_0x5bacc4=_0xad4ca3[_0x5174('0x4d')];if(!_0x28ec51['query'][_0x5174('0x4e')]('nolimit')){_0x1d0b4d[_0x5174('0x1d')]=qs[_0x5174('0x1d')](_0x28ec51['query']['limit']);_0x1d0b4d[_0x5174('0x1b')]=qs['offset'](_0x28ec51[_0x5174('0x32')][_0x5174('0x1b')]);}return _0x3a8cb4[_0x5174('0x4a')](_0x1d0b4d);}})[_0x5174('0x25')](function(_0x4a3824){if(_0x4a3824){return _0x4a3824?{'count':_0x5bacc4,'rows':_0x4a3824}:null;}})[_0x5174('0x25')](respondWithResult(_0x474f29,null))[_0x5174('0x42')](handleError(_0x474f29,null));};exports[_0x5174('0x4f')]=function(_0x46e212,_0x2136af,_0xd8a8da){if(_0x46e212['body']['id']){delete _0x46e212[_0x5174('0x48')]['id'];}return db['FreshsalesAccount'][_0x5174('0x4b')]({'where':{'id':_0x46e212[_0x5174('0x44')]['id']}})[_0x5174('0x25')](handleEntityNotFound(_0x2136af,null))[_0x5174('0x25')](function(_0x4df0d1){if(_0x4df0d1){_0x46e212[_0x5174('0x48')][_0x5174('0x50')]=_0x4df0d1['id'];_0x46e212[_0x5174('0x48')][_0x5174('0x51')]=integrations[_0x5174('0x52')](_0x46e212['body'][_0x5174('0x53')],_0x46e212['body'][_0x5174('0x2f')]);_0x46e212['body'][_0x5174('0x54')]=integrations[_0x5174('0x55')](_0x46e212['body'][_0x5174('0x53')],_0x46e212[_0x5174('0x48')][_0x5174('0x2f')]);return db[_0x5174('0x4c')][_0x5174('0x56')](_0x46e212[_0x5174('0x48')],{'include':[{'model':db['FreshsalesField'],'as':_0x5174('0x51')},{'model':db[_0x5174('0x57')],'as':'Descriptions'}]});}return null;})[_0x5174('0x25')](respondWithResult(_0x2136af,null))[_0x5174('0x42')](handleError(_0x2136af,null));};exports['getFields']=function(_0x4df618,_0x38c845,_0x507f90){var _0x5a29a2='';var _0x5d7ecf='';return db[_0x5174('0x2c')][_0x5174('0x4b')]({'where':{'id':_0x4df618['params']['id']},'attributes':['id','username',_0x5174('0x58'),'apiKey']})[_0x5174('0x25')](handleEntityNotFound(_0x38c845,null))['then'](function(_0x37e395){if(_0x37e395){_0x5d7ecf=_0x37e395['username'];_0x5a29a2=_0x37e395[_0x5174('0x58')];var _0x56b4eb=_0x37e395['remoteUri']['slice'](-0x1);if(_0x56b4eb==='/'){_0x5a29a2=_0x5a29a2[_0x5174('0x59')](0x0,_0x5a29a2[_0x5174('0x5a')](_0x56b4eb));}return rp({'method':_0x5174('0x5b'),'uri':util[_0x5174('0x5c')](_0x5174('0x5d'),_0x5a29a2,_0x5174('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x37e395[_0x5174('0x5f')]},'json':!![]});}})['then'](function(_0x110bd3){if(_0x110bd3){var _0x41a85c=_0x110bd3[_0x5174('0x60')];var _0x2c8582=![];var _0x3f31a7=null;for(_0x3f31a7=0x0;_0x3f31a7<_0x41a85c['length'];_0x3f31a7++){if(_0x41a85c[_0x3f31a7][_0x5174('0x61')]===_0x5d7ecf){_0x2c8582=!![];}}if(_0x2c8582){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5174('0x62')});}}})[_0x5174('0x25')](respondWithResult(_0x38c845,null))[_0x5174('0x42')](function(_0x27bbd4){var _0x58b687=_0x4df618[_0x5174('0x32')]['test']?0x1f4:_0x27bbd4[_0x5174('0x63')]||0x1f4;logger[_0x5174('0x27')](_0x5174('0x64'),_0x5174('0x65'),_0x58b687,JSON[_0x5174('0x66')](_0x27bbd4));delete _0x27bbd4['name'];if(_0x58b687===0x191){_0x58b687=0x190;}_0x38c845[_0x5174('0x18')](_0x58b687)['send'](_0x4df618[_0x5174('0x32')][_0x5174('0x67')]?{'message':_0x5174('0x68'),'statusCode':_0x27bbd4['statusCode']}:_0x27bbd4);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 37e7b0c..b14de17 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 _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x5bab39,_0x33db83){var _0x40305e=function(_0x34bd3a){while(--_0x34bd3a){_0x5bab39['push'](_0x5bab39['shift']());}};_0x40305e(++_0x33db83);}(_0x7880,0x1f4));var _0x0788=function(_0x16ba74,_0x2ebcfa){_0x16ba74=_0x16ba74-0x0;var _0x4333a6=_0x7880[_0x16ba74];return _0x4333a6;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));var integrations=require(_0x0788('0x9'));module[_0x0788('0xa')]=function(_0x775629,_0x3f9cb8){return _0x775629[_0x0788('0xb')](_0x0788('0xc'),attributes,{'tableName':_0x0788('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x2239b1,_0x375c70){var _0x3df4ce=function(_0x116d09){while(--_0x116d09){_0x2239b1['push'](_0x2239b1['shift']());}};_0x3df4ce(++_0x375c70);}(_0xafb9,0x68));var _0x9afb=function(_0x453ddc,_0x358ce0){_0x453ddc=_0x453ddc-0x0;var _0x123a5d=_0xafb9[_0x453ddc];return _0x123a5d;};'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('./intFreshsalesAccount.attributes');var integrations=require(_0x9afb('0x9'));module['exports']=function(_0x1ccf93,_0x548b24){return _0x1ccf93['define'](_0x9afb('0xa'),attributes,{'tableName':_0x9afb('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 367d5c0..c2a9dbc 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 _0xa46e=['model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','info','result','catch','FreshsalesAccount','findAll','options','raw','include','map'];(function(_0x5b0a46,_0x5eec42){var _0xb1c9f1=function(_0x398070){while(--_0x398070){_0x5b0a46['push'](_0x5b0a46['shift']());}};_0xb1c9f1(++_0x5eec42);}(_0xa46e,0x8a));var _0xea46=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xa46e[_0x1c5142];return _0x1268cb;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['GetFreshsalesAccount']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')]({'raw':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')]['where']||null:null,'attributes':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['attributes']||null:null,'limit':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['limit']||null:null,'include':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x19d5c1['options'][_0xea46('0x19')],function(_0x59b10d){return{'model':db[_0x59b10d[_0xea46('0x1b')]],'as':_0x59b10d['as'],'attributes':_0x59b10d[_0xea46('0x1c')],'include':_0x59b10d['include']?_[_0xea46('0x1a')](_0x59b10d['include'],function(_0x2b3a8f){return{'model':db[_0x2b3a8f[_0xea46('0x1b')]],'as':_0x2b3a8f['as'],'attributes':_0x2b3a8f[_0xea46('0x1c')],'include':_0x2b3a8f['include']?_['map'](_0x2b3a8f[_0xea46('0x19')],function(_0x38ac07){return{'model':db[_0x38ac07['model']],'as':_0x38ac07['as'],'attributes':_0x38ac07[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11129d){logger['info'](_0xea46('0x1d'),_0x19d5c1);logger[_0xea46('0xc')](_0xea46('0x1d'),_0x19d5c1,JSON[_0xea46('0xd')](_0x11129d));_0x5cf5dd(_0x11129d);})[_0xea46('0x14')](function(_0x174345){logger['error'](_0xea46('0x1d'),_0x174345[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x174345['message']));});});};exports[_0xea46('0x1e')]=function(_0x3cdf96){var _0x38d631=this;return new Promise(function(_0x5a0fc0,_0x4a0635){return db['FreshsalesAccount'][_0xea46('0x1f')]({'raw':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x20')]||null:null,'attributes':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x1c')]||null:null,'include':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96['options'][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x3cdf96[_0xea46('0x17')][_0xea46('0x19')],function(_0x1472c0){return{'model':db[_0x1472c0[_0xea46('0x1b')]],'as':_0x1472c0['as'],'attributes':_0x1472c0[_0xea46('0x1c')],'include':_0x1472c0['include']?_[_0xea46('0x1a')](_0x1472c0[_0xea46('0x19')],function(_0x388449){return{'model':db[_0x388449[_0xea46('0x1b')]],'as':_0x388449['as'],'attributes':_0x388449[_0xea46('0x1c')],'include':_0x388449['include']?_['map'](_0x388449[_0xea46('0x19')],function(_0x343499){return{'model':db[_0x343499['model']],'as':_0x343499['as'],'attributes':_0x343499[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xea46('0xa')](function(_0x123aae){logger[_0xea46('0x12')]('ShowFreshsalesAccount',_0x3cdf96);logger['debug'](_0xea46('0x1e'),_0x3cdf96,JSON['stringify'](_0x123aae));_0x5a0fc0(_0x123aae);})[_0xea46('0x14')](function(_0xdec374){logger['error'](_0xea46('0x1e'),_0xdec374[_0xea46('0x10')],_0x3cdf96);_0x4a0635(_0x38d631['error'](0x1f4,_0xdec374[_0xea46('0x10')]));});});}; \ No newline at end of file +var _0x3e24=['limit','map','include','model','debug','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes'];(function(_0x5b2c42,_0x18ecab){var _0x5db79c=function(_0x408f0a){while(--_0x408f0a){_0x5b2c42['push'](_0x5b2c42['shift']());}};_0x5db79c(++_0x18ecab);}(_0x3e24,0x167));var _0x43e2=function(_0xd9fd77,_0x3fdccf){_0xd9fd77=_0xd9fd77-0x0;var _0x5cc2e0=_0x3e24[_0xd9fd77];return _0x5cc2e0;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')]({'raw':_0x53f797[_0x43e2('0x17')]?_0x53f797['options'][_0x43e2('0x22')]===undefined?!![]:![]:!![],'where':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'include':_0x53f797['options']?_0x53f797['options'][_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x53f797['options'][_0x43e2('0x1c')],function(_0x34effb){return{'model':db[_0x34effb['model']],'as':_0x34effb['as'],'attributes':_0x34effb[_0x43e2('0x19')],'include':_0x34effb['include']?_['map'](_0x34effb['include'],function(_0x2bb489){return{'model':db[_0x2bb489['model']],'as':_0x2bb489['as'],'attributes':_0x2bb489[_0x43e2('0x19')],'include':_0x2bb489[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x2bb489[_0x43e2('0x1c')],function(_0x44670b){return{'model':db[_0x44670b[_0x43e2('0x1d')]],'as':_0x44670b['as'],'attributes':_0x44670b[_0x43e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x1e9be1){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')](_0x43e2('0x20'),_0x53f797,JSON[_0x43e2('0x1f')](_0x1e9be1));_0xe09322(_0x1e9be1);})[_0x43e2('0x14')](function(_0x40b39b){logger[_0x43e2('0x10')]('ShowFreshsalesAccount',_0x40b39b['message'],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0x40b39b[_0x43e2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2d12d41..6dee340 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 _0x0f2c=['/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x0f2c,0x175));var _0xc0f2=function(_0x401176,_0x1bd06b){_0x401176=_0x401176-0x0;var _0x3f74d6=_0x0f2c[_0x401176];return _0x3f74d6;};'use strict';var multer=require(_0xc0f2('0x0'));var util=require(_0xc0f2('0x1'));var path=require('path');var timeout=require(_0xc0f2('0x2'));var express=require(_0xc0f2('0x3'));var router=express[_0xc0f2('0x4')]();var fs_extra=require(_0xc0f2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc0f2('0x6'));var config=require(_0xc0f2('0x7'));var controller=require(_0xc0f2('0x8'));router[_0xc0f2('0x9')]('/',auth['isAuthenticated'](),controller[_0xc0f2('0xa')]);router[_0xc0f2('0x9')](_0xc0f2('0xb'),auth[_0xc0f2('0xc')](),controller['show']);router[_0xc0f2('0x9')](_0xc0f2('0xd'),auth[_0xc0f2('0xc')](),controller[_0xc0f2('0xe')]);router[_0xc0f2('0x9')]('/:id/descriptions',auth[_0xc0f2('0xc')](),controller[_0xc0f2('0xf')]);router['get'](_0xc0f2('0x10'),auth[_0xc0f2('0xc')](),controller[_0xc0f2('0x11')]);router['post']('/',auth[_0xc0f2('0xc')](),controller[_0xc0f2('0x12')]);router[_0xc0f2('0x13')](_0xc0f2('0xb'),auth[_0xc0f2('0xc')](),controller[_0xc0f2('0x14')]);router[_0xc0f2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc0f2('0x16')]);module[_0xc0f2('0x17')]=router; \ No newline at end of file +var _0x2e86=['/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x1eb42b,_0x2b7a95){var _0x578aa5=function(_0x5b4596){while(--_0x5b4596){_0x1eb42b['push'](_0x1eb42b['shift']());}};_0x578aa5(++_0x2b7a95);}(_0x2e86,0xf1));var _0x62e8=function(_0x4d4c6d,_0xa9e7fb){_0x4d4c6d=_0x4d4c6d-0x0;var _0x53b539=_0x2e86[_0x4d4c6d];return _0x53b539;};'use strict';var multer=require(_0x62e8('0x0'));var util=require('util');var path=require(_0x62e8('0x1'));var timeout=require(_0x62e8('0x2'));var express=require(_0x62e8('0x3'));var router=express['Router']();var fs_extra=require(_0x62e8('0x4'));var auth=require(_0x62e8('0x5'));var interaction=require(_0x62e8('0x6'));var config=require(_0x62e8('0x7'));var controller=require(_0x62e8('0x8'));router[_0x62e8('0x9')]('/',auth[_0x62e8('0xa')](),controller['index']);router[_0x62e8('0x9')](_0x62e8('0xb'),auth[_0x62e8('0xa')](),controller['show']);router[_0x62e8('0x9')](_0x62e8('0xc'),auth[_0x62e8('0xa')](),controller['getSubjects']);router['get'](_0x62e8('0xd'),auth[_0x62e8('0xa')](),controller[_0x62e8('0xe')]);router[_0x62e8('0x9')](_0x62e8('0xf'),auth[_0x62e8('0xa')](),controller['getFields']);router['post']('/',auth[_0x62e8('0xa')](),controller[_0x62e8('0x10')]);router[_0x62e8('0x11')]('/:id',auth[_0x62e8('0xa')](),controller['update']);router[_0x62e8('0x12')](_0x62e8('0xb'),auth[_0x62e8('0xa')](),controller[_0x62e8('0x13')]);module[_0x62e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3cdc075..99a0792 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 _0x92e6=['exports','STRING','sequelize'];(function(_0x55a121,_0x867e38){var _0x4a5f65=function(_0x1082bf){while(--_0x1082bf){_0x55a121['push'](_0x55a121['shift']());}};_0x4a5f65(++_0x867e38);}(_0x92e6,0x188));var _0x692e=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0x92e6[_0xe69bf1];return _0x1259d1;};'use strict';var Sequelize=require(_0x692e('0x0'));module[_0x692e('0x1')]={'name':{'type':Sequelize[_0x692e('0x2')]},'description':{'type':Sequelize[_0x692e('0x2')]}}; \ No newline at end of file +var _0x9c65=['STRING','exports'];(function(_0x462fef,_0x5a88a1){var _0x92592e=function(_0x295aa8){while(--_0x295aa8){_0x462fef['push'](_0x462fef['shift']());}};_0x92592e(++_0x5a88a1);}(_0x9c65,0x81));var _0x59c6=function(_0x333d18,_0x279db0){_0x333d18=_0x333d18-0x0;var _0x2b8d4e=_0x9c65[_0x333d18];return _0x2b8d4e;};'use strict';var Sequelize=require('sequelize');module[_0x59c6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7adb769..287d521 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 _0x5acd=['path','sox','to-csv','ejs','fs-extra','lodash','jsforce','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','apply','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','merge','create','body','find','getSubjects','FreshsalesField','nolimit','getDescriptions','getFields','findOne','eml-format','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5acd,0x126));var _0xd5ac=function(_0x50883d,_0x52cbb2){_0x50883d=_0x50883d-0x0;var _0x117b35=_0x5acd[_0x50883d];return _0x117b35;};'use strict';var emlformat=require(_0xd5ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5ac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5ac('0x2'));var moment=require('moment');var BPromise=require(_0xd5ac('0x3'));var Mustache=require(_0xd5ac('0x4'));var util=require(_0xd5ac('0x5'));var path=require(_0xd5ac('0x6'));var sox=require(_0xd5ac('0x7'));var csv=require(_0xd5ac('0x8'));var ejs=require(_0xd5ac('0x9'));var fs=require('fs');var fs_extra=require(_0xd5ac('0xa'));var _=require(_0xd5ac('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd5ac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd5ac('0x8'));var querystring=require('querystring');var Papa=require(_0xd5ac('0xd'));var Redis=require(_0xd5ac('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd5ac('0xf'));var hardwareService=require(_0xd5ac('0x10'));var logger=require(_0xd5ac('0x11'))('api');var utils=require(_0xd5ac('0x12'));var config=require(_0xd5ac('0x13'));var licenseUtil=require(_0xd5ac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d79c7,_0x5b31fc){_0x5b31fc=_0x5b31fc||0xcc;return function(_0x22225c){if(_0x22225c){return _0x4d79c7[_0xd5ac('0x15')](_0x5b31fc);}return _0x4d79c7[_0xd5ac('0x16')](_0x5b31fc)[_0xd5ac('0x17')]();};}function respondWithResult(_0x43704e,_0x1ad5ed){_0x1ad5ed=_0x1ad5ed||0xc8;return function(_0x5574a6){if(_0x5574a6){return _0x43704e[_0xd5ac('0x16')](_0x1ad5ed)[_0xd5ac('0x18')](_0x5574a6);}};}function respondWithFilteredResult(_0x5be5b3,_0x381be6){return function(_0x2f01bc){if(_0x2f01bc){var _0x25a711=typeof _0x381be6[_0xd5ac('0x19')]===_0xd5ac('0x1a')&&typeof _0x381be6[_0xd5ac('0x1b')]==='undefined';var _0x35922d=_0x2f01bc[_0xd5ac('0x1c')];var _0x38f8d2=_0x25a711?0x0:_0x381be6[_0xd5ac('0x19')];var _0x5defe3=_0x25a711?_0x2f01bc[_0xd5ac('0x1c')]:_0x381be6['offset']+_0x381be6[_0xd5ac('0x1b')];var _0x9e850;if(_0x5defe3>=_0x35922d){_0x5defe3=_0x35922d;_0x9e850=0xc8;}else{_0x9e850=0xce;}_0x5be5b3[_0xd5ac('0x16')](_0x9e850);return _0x5be5b3['set']('Content-Range',_0x38f8d2+'-'+_0x5defe3+'/'+_0x35922d)[_0xd5ac('0x18')](_0x2f01bc);}return null;};}function patchUpdates(_0x1173c1){return function(_0x4b95c8){try{jsonpatch[_0xd5ac('0x1d')](_0x4b95c8,_0x1173c1,!![]);}catch(_0x2d9a32){return BPromise['reject'](_0x2d9a32);}return _0x4b95c8[_0xd5ac('0x1e')]();};}function saveUpdates(_0x360641,_0x2dcfb5){return function(_0x18a838){if(_0x18a838){return _0x18a838[_0xd5ac('0x1f')](_0x360641)[_0xd5ac('0x20')](function(_0x490ce0){return _0x490ce0;});}return null;};}function removeEntity(_0x33bd46,_0xd50308){return function(_0x3ee89c){if(_0x3ee89c){return _0x3ee89c[_0xd5ac('0x21')]()[_0xd5ac('0x20')](function(){_0x33bd46[_0xd5ac('0x16')](0xcc)[_0xd5ac('0x17')]();});}};}function handleEntityNotFound(_0x54eb52,_0x3942b5){return function(_0x4e78a8){if(!_0x4e78a8){_0x54eb52[_0xd5ac('0x15')](0x194);}return _0x4e78a8;};}function handleError(_0x5bef9e,_0x2e7e6a){_0x2e7e6a=_0x2e7e6a||0x1f4;return function(_0x27db8e){logger['error'](_0x27db8e[_0xd5ac('0x22')]);if(_0x27db8e[_0xd5ac('0x23')]){delete _0x27db8e[_0xd5ac('0x23')];}_0x5bef9e['status'](_0x2e7e6a)[_0xd5ac('0x24')](_0x27db8e);};}exports[_0xd5ac('0x25')]=function(_0x5dabb0,_0x2291ab){var _0x91f4f7={},_0x22e099={},_0x10760c={'count':0x0,'rows':[]};var _0x11c975=_[_0xd5ac('0x26')](db[_0xd5ac('0x27')][_0xd5ac('0x28')],function(_0x28fa6e){return{'name':_0x28fa6e[_0xd5ac('0x29')],'type':_0x28fa6e[_0xd5ac('0x2a')][_0xd5ac('0x2b')]};});_0x22e099[_0xd5ac('0x2c')]=_['map'](_0x11c975,_0xd5ac('0x23'));_0x22e099[_0xd5ac('0x2d')]=_[_0xd5ac('0x2e')](_0x5dabb0[_0xd5ac('0x2d')]);_0x22e099[_0xd5ac('0x2f')]=_[_0xd5ac('0x30')](_0x22e099[_0xd5ac('0x2c')],_0x22e099['query']);_0x91f4f7[_0xd5ac('0x31')]=_[_0xd5ac('0x30')](_0x22e099[_0xd5ac('0x2c')],qs['fields'](_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x32')]));_0x91f4f7[_0xd5ac('0x31')]=_0x91f4f7['attributes'][_0xd5ac('0x33')]?_0x91f4f7[_0xd5ac('0x31')]:_0x22e099[_0xd5ac('0x2c')];if(!_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x34')]('nolimit')){_0x91f4f7[_0xd5ac('0x1b')]=qs[_0xd5ac('0x1b')](_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x1b')]);_0x91f4f7[_0xd5ac('0x19')]=qs[_0xd5ac('0x19')](_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x19')]);}_0x91f4f7[_0xd5ac('0x35')]=qs[_0xd5ac('0x36')](_0x5dabb0[_0xd5ac('0x2d')]['sort']);_0x91f4f7[_0xd5ac('0x37')]=qs[_0xd5ac('0x2f')](_[_0xd5ac('0x38')](_0x5dabb0[_0xd5ac('0x2d')],_0x22e099[_0xd5ac('0x2f')]),_0x11c975);if(_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x39')]){_0x91f4f7['where']=_['merge'](_0x91f4f7[_0xd5ac('0x37')],{'$or':_[_0xd5ac('0x26')](_0x11c975,function(_0xe71514){if(_0xe71514['type']!=='VIRTUAL'){var _0x37fd3e={};_0x37fd3e[_0xe71514[_0xd5ac('0x23')]]={'$like':'%'+_0x5dabb0['query'][_0xd5ac('0x39')]+'%'};return _0x37fd3e;}})});}_0x91f4f7=_['merge']({},_0x91f4f7,_0x5dabb0[_0xd5ac('0x3a')]);var _0x4f6cd3={'where':_0x91f4f7['where']};return db[_0xd5ac('0x27')][_0xd5ac('0x1c')](_0x4f6cd3)[_0xd5ac('0x20')](function(_0x2bd846){_0x10760c['count']=_0x2bd846;if(_0x5dabb0[_0xd5ac('0x2d')][_0xd5ac('0x3b')]){_0x91f4f7[_0xd5ac('0x3c')]=[{'all':!![]}];}return db[_0xd5ac('0x27')]['findAll'](_0x91f4f7);})[_0xd5ac('0x20')](function(_0x518d56){_0x10760c[_0xd5ac('0x3d')]=_0x518d56;return _0x10760c;})['then'](respondWithFilteredResult(_0x2291ab,_0x91f4f7))[_0xd5ac('0x3e')](handleError(_0x2291ab,null));};exports[_0xd5ac('0x3f')]=function(_0x40a118,_0x22b9d8){var _0x32f865={'raw':![],'where':{'id':_0x40a118[_0xd5ac('0x40')]['id']}},_0x446813={};_0x446813[_0xd5ac('0x2c')]=_['keys'](db['FreshsalesConfiguration'][_0xd5ac('0x28')]);_0x446813[_0xd5ac('0x2d')]=_[_0xd5ac('0x2e')](_0x40a118[_0xd5ac('0x2d')]);_0x446813['filters']=_[_0xd5ac('0x30')](_0x446813[_0xd5ac('0x2c')],_0x446813[_0xd5ac('0x2d')]);_0x32f865[_0xd5ac('0x31')]=_[_0xd5ac('0x30')](_0x446813[_0xd5ac('0x2c')],qs[_0xd5ac('0x32')](_0x40a118[_0xd5ac('0x2d')][_0xd5ac('0x32')]));_0x32f865[_0xd5ac('0x31')]=_0x32f865[_0xd5ac('0x31')]['length']?_0x32f865[_0xd5ac('0x31')]:_0x446813[_0xd5ac('0x2c')];if(_0x40a118[_0xd5ac('0x2d')][_0xd5ac('0x3b')]){_0x32f865[_0xd5ac('0x3c')]=[{'all':!![]}];}_0x32f865=_[_0xd5ac('0x41')]({},_0x32f865,_0x40a118[_0xd5ac('0x3a')]);return db[_0xd5ac('0x27')]['find'](_0x32f865)['then'](handleEntityNotFound(_0x22b9d8,null))[_0xd5ac('0x20')](respondWithResult(_0x22b9d8,null))[_0xd5ac('0x3e')](handleError(_0x22b9d8,null));};exports[_0xd5ac('0x42')]=function(_0x2d9bcd,_0x15fe73){return db[_0xd5ac('0x27')][_0xd5ac('0x42')](_0x2d9bcd[_0xd5ac('0x43')],{})['then'](respondWithResult(_0x15fe73,0xc9))[_0xd5ac('0x3e')](handleError(_0x15fe73,null));};exports[_0xd5ac('0x1f')]=function(_0x4fd026,_0x51f626){if(_0x4fd026[_0xd5ac('0x43')]['id']){delete _0x4fd026[_0xd5ac('0x43')]['id'];}return db[_0xd5ac('0x27')]['find']({'where':{'id':_0x4fd026['params']['id']}})['then'](handleEntityNotFound(_0x51f626,null))[_0xd5ac('0x20')](saveUpdates(_0x4fd026['body'],null))[_0xd5ac('0x20')](respondWithResult(_0x51f626,null))[_0xd5ac('0x3e')](handleError(_0x51f626,null));};exports[_0xd5ac('0x21')]=function(_0x2ac777,_0x43f060){return db['FreshsalesConfiguration'][_0xd5ac('0x44')]({'where':{'id':_0x2ac777[_0xd5ac('0x40')]['id']}})[_0xd5ac('0x20')](handleEntityNotFound(_0x43f060,null))[_0xd5ac('0x20')](removeEntity(_0x43f060,null))[_0xd5ac('0x3e')](handleError(_0x43f060,null));};exports[_0xd5ac('0x45')]=function(_0x4e7597,_0x16801a,_0x3393a7){var _0x5b9a66={};var _0x12256e={};var _0x227a9d;var _0x316aa0;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4e7597['params']['id']}})['then'](handleEntityNotFound(_0x16801a,null))[_0xd5ac('0x20')](function(_0x155c38){if(_0x155c38){_0x227a9d=_0x155c38;_0x12256e['model']=_[_0xd5ac('0x2e')](db[_0xd5ac('0x46')][_0xd5ac('0x28')]);_0x12256e[_0xd5ac('0x2d')]=_['keys'](_0x4e7597[_0xd5ac('0x2d')]);_0x12256e['filters']=_['intersection'](_0x12256e[_0xd5ac('0x2c')],_0x12256e['query']);_0x5b9a66[_0xd5ac('0x31')]=_[_0xd5ac('0x30')](_0x12256e['model'],qs[_0xd5ac('0x32')](_0x4e7597[_0xd5ac('0x2d')][_0xd5ac('0x32')]));_0x5b9a66[_0xd5ac('0x31')]=_0x5b9a66[_0xd5ac('0x31')]['length']?_0x5b9a66[_0xd5ac('0x31')]:_0x12256e[_0xd5ac('0x2c')];_0x5b9a66['order']=qs[_0xd5ac('0x36')](_0x4e7597[_0xd5ac('0x2d')][_0xd5ac('0x36')]);_0x5b9a66['where']=qs[_0xd5ac('0x2f')](_[_0xd5ac('0x38')](_0x4e7597[_0xd5ac('0x2d')],_0x12256e[_0xd5ac('0x2f')]));if(_0x4e7597[_0xd5ac('0x2d')]['filter']){_0x5b9a66[_0xd5ac('0x37')]=_[_0xd5ac('0x41')](_0x5b9a66[_0xd5ac('0x37')],{'$or':_[_0xd5ac('0x26')](_0x5b9a66['attributes'],function(_0x34035b){var _0x1d92f3={};_0x1d92f3[_0x34035b]={'$like':'%'+_0x4e7597['query']['filter']+'%'};return _0x1d92f3;})});}_0x5b9a66=_[_0xd5ac('0x41')]({},_0x5b9a66,_0x4e7597[_0xd5ac('0x3a')]);return _0x227a9d[_0xd5ac('0x45')](_0x5b9a66);}})[_0xd5ac('0x20')](function(_0x5325ba){if(_0x5325ba){_0x316aa0=_0x5325ba[_0xd5ac('0x33')];if(!_0x4e7597[_0xd5ac('0x2d')][_0xd5ac('0x34')](_0xd5ac('0x47'))){_0x5b9a66[_0xd5ac('0x1b')]=qs[_0xd5ac('0x1b')](_0x4e7597[_0xd5ac('0x2d')][_0xd5ac('0x1b')]);_0x5b9a66[_0xd5ac('0x19')]=qs['offset'](_0x4e7597[_0xd5ac('0x2d')][_0xd5ac('0x19')]);}return _0x227a9d['getSubjects'](_0x5b9a66);}})[_0xd5ac('0x20')](function(_0x192210){if(_0x192210){return _0x192210?{'count':_0x316aa0,'rows':_0x192210}:null;}})[_0xd5ac('0x20')](respondWithResult(_0x16801a,null))[_0xd5ac('0x3e')](handleError(_0x16801a,null));};exports['getDescriptions']=function(_0x45b6ed,_0x5854f7,_0x2a6607){var _0x5de04f={};var _0x49f4ee={};var _0x2f8fe3;var _0x583417;return db[_0xd5ac('0x27')]['findOne']({'where':{'id':_0x45b6ed[_0xd5ac('0x40')]['id']}})['then'](handleEntityNotFound(_0x5854f7,null))[_0xd5ac('0x20')](function(_0x599269){if(_0x599269){_0x2f8fe3=_0x599269;_0x49f4ee['model']=_[_0xd5ac('0x2e')](db[_0xd5ac('0x46')][_0xd5ac('0x28')]);_0x49f4ee[_0xd5ac('0x2d')]=_[_0xd5ac('0x2e')](_0x45b6ed[_0xd5ac('0x2d')]);_0x49f4ee['filters']=_[_0xd5ac('0x30')](_0x49f4ee[_0xd5ac('0x2c')],_0x49f4ee['query']);_0x5de04f['attributes']=_[_0xd5ac('0x30')](_0x49f4ee[_0xd5ac('0x2c')],qs['fields'](_0x45b6ed[_0xd5ac('0x2d')][_0xd5ac('0x32')]));_0x5de04f[_0xd5ac('0x31')]=_0x5de04f[_0xd5ac('0x31')][_0xd5ac('0x33')]?_0x5de04f['attributes']:_0x49f4ee[_0xd5ac('0x2c')];_0x5de04f[_0xd5ac('0x35')]=qs[_0xd5ac('0x36')](_0x45b6ed[_0xd5ac('0x2d')][_0xd5ac('0x36')]);_0x5de04f[_0xd5ac('0x37')]=qs[_0xd5ac('0x2f')](_[_0xd5ac('0x38')](_0x45b6ed[_0xd5ac('0x2d')],_0x49f4ee[_0xd5ac('0x2f')]));if(_0x45b6ed[_0xd5ac('0x2d')]['filter']){_0x5de04f[_0xd5ac('0x37')]=_['merge'](_0x5de04f[_0xd5ac('0x37')],{'$or':_[_0xd5ac('0x26')](_0x5de04f['attributes'],function(_0x2f464e){var _0xaaf34d={};_0xaaf34d[_0x2f464e]={'$like':'%'+_0x45b6ed[_0xd5ac('0x2d')][_0xd5ac('0x39')]+'%'};return _0xaaf34d;})});}_0x5de04f=_[_0xd5ac('0x41')]({},_0x5de04f,_0x45b6ed[_0xd5ac('0x3a')]);return _0x2f8fe3[_0xd5ac('0x48')](_0x5de04f);}})[_0xd5ac('0x20')](function(_0x2fac00){if(_0x2fac00){_0x583417=_0x2fac00[_0xd5ac('0x33')];if(!_0x45b6ed['query']['hasOwnProperty']('nolimit')){_0x5de04f[_0xd5ac('0x1b')]=qs[_0xd5ac('0x1b')](_0x45b6ed[_0xd5ac('0x2d')][_0xd5ac('0x1b')]);_0x5de04f[_0xd5ac('0x19')]=qs['offset'](_0x45b6ed[_0xd5ac('0x2d')][_0xd5ac('0x19')]);}return _0x2f8fe3[_0xd5ac('0x48')](_0x5de04f);}})[_0xd5ac('0x20')](function(_0x475b0a){if(_0x475b0a){return _0x475b0a?{'count':_0x583417,'rows':_0x475b0a}:null;}})[_0xd5ac('0x20')](respondWithResult(_0x5854f7,null))['catch'](handleError(_0x5854f7,null));};exports[_0xd5ac('0x49')]=function(_0x6e954a,_0x232b54,_0x5a4f6d){var _0x367a13={};var _0x2027fb={};var _0x68e8d5;var _0x3d9d6d;return db[_0xd5ac('0x27')][_0xd5ac('0x4a')]({'where':{'id':_0x6e954a[_0xd5ac('0x40')]['id']}})[_0xd5ac('0x20')](handleEntityNotFound(_0x232b54,null))[_0xd5ac('0x20')](function(_0x2aaf2f){if(_0x2aaf2f){_0x68e8d5=_0x2aaf2f;_0x2027fb[_0xd5ac('0x2c')]=_[_0xd5ac('0x2e')](db[_0xd5ac('0x46')]['rawAttributes']);_0x2027fb[_0xd5ac('0x2d')]=_[_0xd5ac('0x2e')](_0x6e954a[_0xd5ac('0x2d')]);_0x2027fb[_0xd5ac('0x2f')]=_[_0xd5ac('0x30')](_0x2027fb[_0xd5ac('0x2c')],_0x2027fb[_0xd5ac('0x2d')]);_0x367a13[_0xd5ac('0x31')]=_[_0xd5ac('0x30')](_0x2027fb[_0xd5ac('0x2c')],qs['fields'](_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x32')]));_0x367a13[_0xd5ac('0x31')]=_0x367a13[_0xd5ac('0x31')][_0xd5ac('0x33')]?_0x367a13[_0xd5ac('0x31')]:_0x2027fb[_0xd5ac('0x2c')];_0x367a13['order']=qs[_0xd5ac('0x36')](_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x36')]);_0x367a13['where']=qs[_0xd5ac('0x2f')](_[_0xd5ac('0x38')](_0x6e954a['query'],_0x2027fb[_0xd5ac('0x2f')]));if(_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x39')]){_0x367a13[_0xd5ac('0x37')]=_[_0xd5ac('0x41')](_0x367a13['where'],{'$or':_['map'](_0x367a13[_0xd5ac('0x31')],function(_0xc5abd1){var _0x4d6d32={};_0x4d6d32[_0xc5abd1]={'$like':'%'+_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x39')]+'%'};return _0x4d6d32;})});}_0x367a13=_[_0xd5ac('0x41')]({},_0x367a13,_0x6e954a[_0xd5ac('0x3a')]);return _0x68e8d5[_0xd5ac('0x49')](_0x367a13);}})['then'](function(_0x1ad0cb){if(_0x1ad0cb){_0x3d9d6d=_0x1ad0cb[_0xd5ac('0x33')];if(!_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x34')](_0xd5ac('0x47'))){_0x367a13['limit']=qs[_0xd5ac('0x1b')](_0x6e954a[_0xd5ac('0x2d')][_0xd5ac('0x1b')]);_0x367a13[_0xd5ac('0x19')]=qs[_0xd5ac('0x19')](_0x6e954a[_0xd5ac('0x2d')]['offset']);}return _0x68e8d5[_0xd5ac('0x49')](_0x367a13);}})[_0xd5ac('0x20')](function(_0xa89480){if(_0xa89480){return _0xa89480?{'count':_0x3d9d6d,'rows':_0xa89480}:null;}})[_0xd5ac('0x20')](respondWithResult(_0x232b54,null))[_0xd5ac('0x3e')](handleError(_0x232b54,null));}; \ No newline at end of file +var _0x3013=['status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getSubjects','findOne','sort','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x3013,0x16a));var _0x3301=function(_0x5db160,_0x3beb43){_0x5db160=_0x5db160-0x0;var _0x5da5b2=_0x3013[_0x5db160];return _0x5da5b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3301('0x0'));var zipdir=require(_0x3301('0x1'));var jsonpatch=require(_0x3301('0x2'));var rp=require(_0x3301('0x3'));var moment=require(_0x3301('0x4'));var BPromise=require(_0x3301('0x5'));var Mustache=require('mustache');var util=require(_0x3301('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3301('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3301('0x8'));var squel=require(_0x3301('0x9'));var crypto=require(_0x3301('0xa'));var jsforce=require(_0x3301('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3301('0xc'));var querystring=require(_0x3301('0xd'));var Papa=require(_0x3301('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3301('0xf'));var as=require(_0x3301('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3301('0x11'))(_0x3301('0x12'));var utils=require('../../config/utils');var config=require(_0x3301('0x13'));var licenseUtil=require(_0x3301('0x14'));var db=require(_0x3301('0x15'))['db'];function respondWithStatusCode(_0x4960ca,_0x1b286d){_0x1b286d=_0x1b286d||0xcc;return function(_0x3810a8){if(_0x3810a8){return _0x4960ca[_0x3301('0x16')](_0x1b286d);}return _0x4960ca[_0x3301('0x17')](_0x1b286d)[_0x3301('0x18')]();};}function respondWithResult(_0x29af23,_0x1f6223){_0x1f6223=_0x1f6223||0xc8;return function(_0x1e1cf4){if(_0x1e1cf4){return _0x29af23[_0x3301('0x17')](_0x1f6223)[_0x3301('0x19')](_0x1e1cf4);}};}function respondWithFilteredResult(_0x6ad8b4,_0x1757fc){return function(_0x2b5f40){if(_0x2b5f40){var _0xc447d9=typeof _0x1757fc[_0x3301('0x1a')]==='undefined'&&typeof _0x1757fc[_0x3301('0x1b')]===_0x3301('0x1c');var _0x2c5ccf=_0x2b5f40[_0x3301('0x1d')];var _0x1e7e4b=_0xc447d9?0x0:_0x1757fc[_0x3301('0x1a')];var _0x567501=_0xc447d9?_0x2b5f40[_0x3301('0x1d')]:_0x1757fc[_0x3301('0x1a')]+_0x1757fc[_0x3301('0x1b')];var _0x37451a;if(_0x567501>=_0x2c5ccf){_0x567501=_0x2c5ccf;_0x37451a=0xc8;}else{_0x37451a=0xce;}_0x6ad8b4[_0x3301('0x17')](_0x37451a);return _0x6ad8b4[_0x3301('0x1e')](_0x3301('0x1f'),_0x1e7e4b+'-'+_0x567501+'/'+_0x2c5ccf)[_0x3301('0x19')](_0x2b5f40);}return null;};}function patchUpdates(_0x2c63b8){return function(_0x24dd1){try{jsonpatch['apply'](_0x24dd1,_0x2c63b8,!![]);}catch(_0x4a0ad3){return BPromise['reject'](_0x4a0ad3);}return _0x24dd1['save']();};}function saveUpdates(_0x161c8c,_0x457dc3){return function(_0x5937b9){if(_0x5937b9){return _0x5937b9[_0x3301('0x20')](_0x161c8c)['then'](function(_0x47f513){return _0x47f513;});}return null;};}function removeEntity(_0x4af36f,_0x442afa){return function(_0x3b5fff){if(_0x3b5fff){return _0x3b5fff[_0x3301('0x21')]()[_0x3301('0x22')](function(){_0x4af36f['status'](0xcc)[_0x3301('0x18')]();});}};}function handleEntityNotFound(_0x21ae64,_0x37ed9b){return function(_0x1dd529){if(!_0x1dd529){_0x21ae64['sendStatus'](0x194);}return _0x1dd529;};}function handleError(_0x3578ee,_0x360560){_0x360560=_0x360560||0x1f4;return function(_0x1b40a9){logger[_0x3301('0x23')](_0x1b40a9[_0x3301('0x24')]);if(_0x1b40a9[_0x3301('0x25')]){delete _0x1b40a9['name'];}_0x3578ee[_0x3301('0x17')](_0x360560)[_0x3301('0x26')](_0x1b40a9);};}exports[_0x3301('0x27')]=function(_0x2e9008,_0x5524bc){var _0xba2bac={},_0x2e6028={},_0x26f7ed={'count':0x0,'rows':[]};var _0x52a844=_[_0x3301('0x28')](db[_0x3301('0x29')][_0x3301('0x2a')],function(_0x3c72a){return{'name':_0x3c72a['fieldName'],'type':_0x3c72a[_0x3301('0x2b')][_0x3301('0x2c')]};});_0x2e6028['model']=_[_0x3301('0x28')](_0x52a844,_0x3301('0x25'));_0x2e6028[_0x3301('0x2d')]=_[_0x3301('0x2e')](_0x2e9008['query']);_0x2e6028[_0x3301('0x2f')]=_[_0x3301('0x30')](_0x2e6028[_0x3301('0x31')],_0x2e6028[_0x3301('0x2d')]);_0xba2bac[_0x3301('0x32')]=_[_0x3301('0x30')](_0x2e6028[_0x3301('0x31')],qs[_0x3301('0x33')](_0x2e9008[_0x3301('0x2d')]['fields']));_0xba2bac['attributes']=_0xba2bac[_0x3301('0x32')][_0x3301('0x34')]?_0xba2bac['attributes']:_0x2e6028[_0x3301('0x31')];if(!_0x2e9008[_0x3301('0x2d')][_0x3301('0x35')](_0x3301('0x36'))){_0xba2bac[_0x3301('0x1b')]=qs[_0x3301('0x1b')](_0x2e9008['query'][_0x3301('0x1b')]);_0xba2bac[_0x3301('0x1a')]=qs[_0x3301('0x1a')](_0x2e9008[_0x3301('0x2d')]['offset']);}_0xba2bac[_0x3301('0x37')]=qs['sort'](_0x2e9008[_0x3301('0x2d')]['sort']);_0xba2bac[_0x3301('0x38')]=qs[_0x3301('0x2f')](_[_0x3301('0x39')](_0x2e9008[_0x3301('0x2d')],_0x2e6028[_0x3301('0x2f')]),_0x52a844);if(_0x2e9008[_0x3301('0x2d')][_0x3301('0x3a')]){_0xba2bac[_0x3301('0x38')]=_[_0x3301('0x3b')](_0xba2bac[_0x3301('0x38')],{'$or':_['map'](_0x52a844,function(_0x5235e9){if(_0x5235e9[_0x3301('0x2b')]!==_0x3301('0x3c')){var _0x59f482={};_0x59f482[_0x5235e9[_0x3301('0x25')]]={'$like':'%'+_0x2e9008[_0x3301('0x2d')]['filter']+'%'};return _0x59f482;}})});}_0xba2bac=_[_0x3301('0x3b')]({},_0xba2bac,_0x2e9008['options']);var _0x437ed={'where':_0xba2bac[_0x3301('0x38')]};return db[_0x3301('0x29')][_0x3301('0x1d')](_0x437ed)[_0x3301('0x22')](function(_0x276e3c){_0x26f7ed[_0x3301('0x1d')]=_0x276e3c;if(_0x2e9008[_0x3301('0x2d')][_0x3301('0x3d')]){_0xba2bac[_0x3301('0x3e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x3301('0x3f')](_0xba2bac);})[_0x3301('0x22')](function(_0x3008cc){_0x26f7ed[_0x3301('0x40')]=_0x3008cc;return _0x26f7ed;})['then'](respondWithFilteredResult(_0x5524bc,_0xba2bac))[_0x3301('0x41')](handleError(_0x5524bc,null));};exports[_0x3301('0x42')]=function(_0x4dac07,_0x262120){var _0x3c479c={'raw':![],'where':{'id':_0x4dac07['params']['id']}},_0x4bc7fe={};_0x4bc7fe[_0x3301('0x31')]=_[_0x3301('0x2e')](db[_0x3301('0x29')][_0x3301('0x2a')]);_0x4bc7fe[_0x3301('0x2d')]=_[_0x3301('0x2e')](_0x4dac07[_0x3301('0x2d')]);_0x4bc7fe[_0x3301('0x2f')]=_[_0x3301('0x30')](_0x4bc7fe[_0x3301('0x31')],_0x4bc7fe[_0x3301('0x2d')]);_0x3c479c[_0x3301('0x32')]=_[_0x3301('0x30')](_0x4bc7fe[_0x3301('0x31')],qs[_0x3301('0x33')](_0x4dac07[_0x3301('0x2d')][_0x3301('0x33')]));_0x3c479c[_0x3301('0x32')]=_0x3c479c[_0x3301('0x32')]['length']?_0x3c479c['attributes']:_0x4bc7fe[_0x3301('0x31')];if(_0x4dac07['query'][_0x3301('0x3d')]){_0x3c479c[_0x3301('0x3e')]=[{'all':!![]}];}_0x3c479c=_[_0x3301('0x3b')]({},_0x3c479c,_0x4dac07[_0x3301('0x43')]);return db[_0x3301('0x29')][_0x3301('0x44')](_0x3c479c)[_0x3301('0x22')](handleEntityNotFound(_0x262120,null))['then'](respondWithResult(_0x262120,null))[_0x3301('0x41')](handleError(_0x262120,null));};exports[_0x3301('0x45')]=function(_0x4567cf,_0x4a0f32){return db[_0x3301('0x29')][_0x3301('0x45')](_0x4567cf[_0x3301('0x46')],{})[_0x3301('0x22')](respondWithResult(_0x4a0f32,0xc9))[_0x3301('0x41')](handleError(_0x4a0f32,null));};exports[_0x3301('0x20')]=function(_0x1e5673,_0x5341a4){if(_0x1e5673[_0x3301('0x46')]['id']){delete _0x1e5673[_0x3301('0x46')]['id'];}return db[_0x3301('0x29')][_0x3301('0x44')]({'where':{'id':_0x1e5673[_0x3301('0x47')]['id']}})[_0x3301('0x22')](handleEntityNotFound(_0x5341a4,null))['then'](saveUpdates(_0x1e5673[_0x3301('0x46')],null))[_0x3301('0x22')](respondWithResult(_0x5341a4,null))[_0x3301('0x41')](handleError(_0x5341a4,null));};exports['destroy']=function(_0x8637b9,_0x33ee9a){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x8637b9[_0x3301('0x47')]['id']}})[_0x3301('0x22')](handleEntityNotFound(_0x33ee9a,null))[_0x3301('0x22')](removeEntity(_0x33ee9a,null))['catch'](handleError(_0x33ee9a,null));};exports[_0x3301('0x48')]=function(_0x5873ba,_0x34f008,_0x5c8cc1){var _0x4b7dcf={};var _0x4547ed={};var _0x167f90;var _0xaa1536;return db[_0x3301('0x29')][_0x3301('0x49')]({'where':{'id':_0x5873ba[_0x3301('0x47')]['id']}})['then'](handleEntityNotFound(_0x34f008,null))[_0x3301('0x22')](function(_0x1eeb98){if(_0x1eeb98){_0x167f90=_0x1eeb98;_0x4547ed[_0x3301('0x31')]=_[_0x3301('0x2e')](db['FreshsalesField']['rawAttributes']);_0x4547ed[_0x3301('0x2d')]=_[_0x3301('0x2e')](_0x5873ba[_0x3301('0x2d')]);_0x4547ed[_0x3301('0x2f')]=_[_0x3301('0x30')](_0x4547ed[_0x3301('0x31')],_0x4547ed[_0x3301('0x2d')]);_0x4b7dcf[_0x3301('0x32')]=_['intersection'](_0x4547ed[_0x3301('0x31')],qs[_0x3301('0x33')](_0x5873ba[_0x3301('0x2d')][_0x3301('0x33')]));_0x4b7dcf[_0x3301('0x32')]=_0x4b7dcf['attributes'][_0x3301('0x34')]?_0x4b7dcf[_0x3301('0x32')]:_0x4547ed[_0x3301('0x31')];_0x4b7dcf[_0x3301('0x37')]=qs[_0x3301('0x4a')](_0x5873ba['query']['sort']);_0x4b7dcf[_0x3301('0x38')]=qs[_0x3301('0x2f')](_[_0x3301('0x39')](_0x5873ba[_0x3301('0x2d')],_0x4547ed[_0x3301('0x2f')]));if(_0x5873ba[_0x3301('0x2d')][_0x3301('0x3a')]){_0x4b7dcf[_0x3301('0x38')]=_[_0x3301('0x3b')](_0x4b7dcf[_0x3301('0x38')],{'$or':_['map'](_0x4b7dcf[_0x3301('0x32')],function(_0x2dfc03){var _0x37bc9a={};_0x37bc9a[_0x2dfc03]={'$like':'%'+_0x5873ba[_0x3301('0x2d')][_0x3301('0x3a')]+'%'};return _0x37bc9a;})});}_0x4b7dcf=_[_0x3301('0x3b')]({},_0x4b7dcf,_0x5873ba[_0x3301('0x43')]);return _0x167f90[_0x3301('0x48')](_0x4b7dcf);}})['then'](function(_0x6697cc){if(_0x6697cc){_0xaa1536=_0x6697cc[_0x3301('0x34')];if(!_0x5873ba[_0x3301('0x2d')][_0x3301('0x35')](_0x3301('0x36'))){_0x4b7dcf[_0x3301('0x1b')]=qs[_0x3301('0x1b')](_0x5873ba[_0x3301('0x2d')]['limit']);_0x4b7dcf['offset']=qs[_0x3301('0x1a')](_0x5873ba[_0x3301('0x2d')]['offset']);}return _0x167f90[_0x3301('0x48')](_0x4b7dcf);}})['then'](function(_0x57e43c){if(_0x57e43c){return _0x57e43c?{'count':_0xaa1536,'rows':_0x57e43c}:null;}})[_0x3301('0x22')](respondWithResult(_0x34f008,null))[_0x3301('0x41')](handleError(_0x34f008,null));};exports[_0x3301('0x4b')]=function(_0x2d7bc9,_0x154a76,_0x1e9a0f){var _0x23d4fd={};var _0x765c9c={};var _0xe23f72;var _0x2a1152;return db[_0x3301('0x29')][_0x3301('0x49')]({'where':{'id':_0x2d7bc9[_0x3301('0x47')]['id']}})[_0x3301('0x22')](handleEntityNotFound(_0x154a76,null))[_0x3301('0x22')](function(_0x49de22){if(_0x49de22){_0xe23f72=_0x49de22;_0x765c9c[_0x3301('0x31')]=_[_0x3301('0x2e')](db['FreshsalesField']['rawAttributes']);_0x765c9c[_0x3301('0x2d')]=_[_0x3301('0x2e')](_0x2d7bc9[_0x3301('0x2d')]);_0x765c9c['filters']=_[_0x3301('0x30')](_0x765c9c[_0x3301('0x31')],_0x765c9c['query']);_0x23d4fd[_0x3301('0x32')]=_[_0x3301('0x30')](_0x765c9c[_0x3301('0x31')],qs[_0x3301('0x33')](_0x2d7bc9['query'][_0x3301('0x33')]));_0x23d4fd[_0x3301('0x32')]=_0x23d4fd[_0x3301('0x32')]['length']?_0x23d4fd[_0x3301('0x32')]:_0x765c9c['model'];_0x23d4fd[_0x3301('0x37')]=qs[_0x3301('0x4a')](_0x2d7bc9[_0x3301('0x2d')][_0x3301('0x4a')]);_0x23d4fd[_0x3301('0x38')]=qs[_0x3301('0x2f')](_['pick'](_0x2d7bc9['query'],_0x765c9c['filters']));if(_0x2d7bc9[_0x3301('0x2d')][_0x3301('0x3a')]){_0x23d4fd[_0x3301('0x38')]=_[_0x3301('0x3b')](_0x23d4fd[_0x3301('0x38')],{'$or':_[_0x3301('0x28')](_0x23d4fd['attributes'],function(_0x41fa44){var _0x5aa98f={};_0x5aa98f[_0x41fa44]={'$like':'%'+_0x2d7bc9[_0x3301('0x2d')][_0x3301('0x3a')]+'%'};return _0x5aa98f;})});}_0x23d4fd=_[_0x3301('0x3b')]({},_0x23d4fd,_0x2d7bc9[_0x3301('0x43')]);return _0xe23f72[_0x3301('0x4b')](_0x23d4fd);}})[_0x3301('0x22')](function(_0x1aee51){if(_0x1aee51){_0x2a1152=_0x1aee51[_0x3301('0x34')];if(!_0x2d7bc9[_0x3301('0x2d')][_0x3301('0x35')](_0x3301('0x36'))){_0x23d4fd[_0x3301('0x1b')]=qs[_0x3301('0x1b')](_0x2d7bc9[_0x3301('0x2d')][_0x3301('0x1b')]);_0x23d4fd[_0x3301('0x1a')]=qs['offset'](_0x2d7bc9['query']['offset']);}return _0xe23f72[_0x3301('0x4b')](_0x23d4fd);}})[_0x3301('0x22')](function(_0x69a6bd){if(_0x69a6bd){return _0x69a6bd?{'count':_0x2a1152,'rows':_0x69a6bd}:null;}})[_0x3301('0x22')](respondWithResult(_0x154a76,null))[_0x3301('0x41')](handleError(_0x154a76,null));};exports[_0x3301('0x4c')]=function(_0x46dd99,_0x370649,_0x590ccc){var _0x3f1b57={};var _0x524c69={};var _0x25df60;var _0x3d2c68;return db['FreshsalesConfiguration'][_0x3301('0x49')]({'where':{'id':_0x46dd99[_0x3301('0x47')]['id']}})[_0x3301('0x22')](handleEntityNotFound(_0x370649,null))[_0x3301('0x22')](function(_0x408c0d){if(_0x408c0d){_0x25df60=_0x408c0d;_0x524c69[_0x3301('0x31')]=_['keys'](db['FreshsalesField'][_0x3301('0x2a')]);_0x524c69[_0x3301('0x2d')]=_[_0x3301('0x2e')](_0x46dd99[_0x3301('0x2d')]);_0x524c69['filters']=_[_0x3301('0x30')](_0x524c69[_0x3301('0x31')],_0x524c69['query']);_0x3f1b57['attributes']=_[_0x3301('0x30')](_0x524c69[_0x3301('0x31')],qs[_0x3301('0x33')](_0x46dd99['query'][_0x3301('0x33')]));_0x3f1b57[_0x3301('0x32')]=_0x3f1b57['attributes'][_0x3301('0x34')]?_0x3f1b57[_0x3301('0x32')]:_0x524c69[_0x3301('0x31')];_0x3f1b57['order']=qs['sort'](_0x46dd99[_0x3301('0x2d')]['sort']);_0x3f1b57[_0x3301('0x38')]=qs[_0x3301('0x2f')](_['pick'](_0x46dd99[_0x3301('0x2d')],_0x524c69[_0x3301('0x2f')]));if(_0x46dd99[_0x3301('0x2d')][_0x3301('0x3a')]){_0x3f1b57[_0x3301('0x38')]=_['merge'](_0x3f1b57['where'],{'$or':_[_0x3301('0x28')](_0x3f1b57[_0x3301('0x32')],function(_0x597e9c){var _0x392d20={};_0x392d20[_0x597e9c]={'$like':'%'+_0x46dd99[_0x3301('0x2d')]['filter']+'%'};return _0x392d20;})});}_0x3f1b57=_[_0x3301('0x3b')]({},_0x3f1b57,_0x46dd99[_0x3301('0x43')]);return _0x25df60[_0x3301('0x4c')](_0x3f1b57);}})[_0x3301('0x22')](function(_0x4c3b29){if(_0x4c3b29){_0x3d2c68=_0x4c3b29[_0x3301('0x34')];if(!_0x46dd99['query']['hasOwnProperty'](_0x3301('0x36'))){_0x3f1b57['limit']=qs[_0x3301('0x1b')](_0x46dd99['query'][_0x3301('0x1b')]);_0x3f1b57['offset']=qs['offset'](_0x46dd99[_0x3301('0x2d')]['offset']);}return _0x25df60[_0x3301('0x4c')](_0x3f1b57);}})[_0x3301('0x22')](function(_0xd5913c){if(_0xd5913c){return _0xd5913c?{'count':_0x3d2c68,'rows':_0xd5913c}:null;}})[_0x3301('0x22')](respondWithResult(_0x370649,null))[_0x3301('0x41')](handleError(_0x370649,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a4a3892..1492244 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 _0x81e2=['int_freshsales_configurations','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x3d4799,_0x60e496){var _0x1b744c=function(_0x2bb813){while(--_0x2bb813){_0x3d4799['push'](_0x3d4799['shift']());}};_0x1b744c(++_0x60e496);}(_0x81e2,0xc1));var _0x281e=function(_0x177f6d,_0x3d3901){_0x177f6d=_0x177f6d-0x0;var _0x1c151b=_0x81e2[_0x177f6d];return _0x1c151b;};'use strict';var _=require(_0x281e('0x0'));var util=require('util');var logger=require(_0x281e('0x1'))(_0x281e('0x2'));var moment=require(_0x281e('0x3'));var BPromise=require('bluebird');var rp=require(_0x281e('0x4'));var fs=require('fs');var path=require(_0x281e('0x5'));var rimraf=require('rimraf');var config=require(_0x281e('0x6'));var attributes=require(_0x281e('0x7'));module[_0x281e('0x8')]=function(_0x369994,_0x4b5427){return _0x369994[_0x281e('0x9')](_0x281e('0xa'),attributes,{'tableName':_0x281e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd85d=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0xa86b52,_0x1e28be){var _0x4468ca=function(_0x1d46b7){while(--_0x1d46b7){_0xa86b52['push'](_0xa86b52['shift']());}};_0x4468ca(++_0x1e28be);}(_0xd85d,0x1b0));var _0xdd85=function(_0x40017d,_0x47cf4c){_0x40017d=_0x40017d-0x0;var _0xcc8097=_0xd85d[_0x40017d];return _0xcc8097;};'use strict';var _=require(_0xdd85('0x0'));var util=require(_0xdd85('0x1'));var logger=require(_0xdd85('0x2'))(_0xdd85('0x3'));var moment=require(_0xdd85('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd85('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd85('0x6'));module[_0xdd85('0x7')]=function(_0x31f5c5,_0x2e3ad5){return _0x31f5c5[_0xdd85('0x8')](_0xdd85('0x9'),attributes,{'tableName':_0xdd85('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 665add6..7521bf7 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 _0x0b09=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x0b09,0x127));var _0x90b0=function(_0x185c79,_0x3db22c){_0x185c79=_0x185c79-0x0;var _0x49e7db=_0x0b09[_0x185c79];return _0x49e7db;};'use strict';var _=require(_0x90b0('0x0'));var util=require(_0x90b0('0x1'));var moment=require('moment');var BPromise=require(_0x90b0('0x2'));var rs=require(_0x90b0('0x3'));var fs=require('fs');var Redis=require(_0x90b0('0x4'));var db=require(_0x90b0('0x5'))['db'];var utils=require(_0x90b0('0x6'));var logger=require(_0x90b0('0x7'))(_0x90b0('0x8'));var config=require(_0x90b0('0x9'));var jayson=require(_0x90b0('0xa'));var client=jayson['client'][_0x90b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e22b,_0x106ba8,_0x58d926){return new BPromise(function(_0x1a5f2c,_0x33ad0b){return client[_0x90b0('0xc')](_0x56e22b,_0x58d926)[_0x90b0('0xd')](function(_0x2f0caf){logger[_0x90b0('0xe')](_0x90b0('0xf'),_0x106ba8,_0x90b0('0x10'));logger['debug'](_0x90b0('0x11'),_0x106ba8,_0x90b0('0x10'),JSON[_0x90b0('0x12')](_0x2f0caf));if(_0x2f0caf[_0x90b0('0x13')]){if(_0x2f0caf[_0x90b0('0x13')]['code']===0x1f4){logger['error'](_0x90b0('0xf'),_0x106ba8,_0x2f0caf[_0x90b0('0x13')][_0x90b0('0x14')]);return _0x33ad0b(_0x2f0caf[_0x90b0('0x13')][_0x90b0('0x14')]);}logger[_0x90b0('0x13')](_0x90b0('0xf'),_0x106ba8,_0x2f0caf[_0x90b0('0x13')][_0x90b0('0x14')]);return _0x1a5f2c(_0x2f0caf[_0x90b0('0x13')][_0x90b0('0x14')]);}else{logger[_0x90b0('0xe')](_0x90b0('0xf'),_0x106ba8,_0x90b0('0x10'));_0x1a5f2c(_0x2f0caf[_0x90b0('0x15')]['message']);}})['catch'](function(_0x45f0be){logger[_0x90b0('0x13')](_0x90b0('0xf'),_0x106ba8,_0x45f0be);_0x33ad0b(_0x45f0be);});});} \ No newline at end of file +var _0x3453=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0xf7fa28,_0x497189){var _0x4554bb=function(_0x113721){while(--_0x113721){_0xf7fa28['push'](_0xf7fa28['shift']());}};_0x4554bb(++_0x497189);}(_0x3453,0x1b7));var _0x3345=function(_0x469d85,_0xb3a69b){_0x469d85=_0x469d85-0x0;var _0xf38710=_0x3453[_0x469d85];return _0xf38710;};'use strict';var _=require(_0x3345('0x0'));var util=require(_0x3345('0x1'));var moment=require('moment');var BPromise=require(_0x3345('0x2'));var rs=require(_0x3345('0x3'));var fs=require('fs');var Redis=require(_0x3345('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3345('0x5'));var logger=require(_0x3345('0x6'))(_0x3345('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3345('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116ed2,_0x44c944,_0x2b1347){return new BPromise(function(_0x3c0f99,_0x28622e){return client[_0x3345('0x9')](_0x116ed2,_0x2b1347)[_0x3345('0xa')](function(_0x3c99fa){logger[_0x3345('0xb')](_0x3345('0xc'),_0x44c944,_0x3345('0xd'));logger[_0x3345('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x44c944,_0x3345('0xd'),JSON['stringify'](_0x3c99fa));if(_0x3c99fa[_0x3345('0xf')]){if(_0x3c99fa[_0x3345('0xf')][_0x3345('0x10')]===0x1f4){logger[_0x3345('0xf')](_0x3345('0xc'),_0x44c944,_0x3c99fa[_0x3345('0xf')][_0x3345('0x11')]);return _0x28622e(_0x3c99fa[_0x3345('0xf')][_0x3345('0x11')]);}logger[_0x3345('0xf')](_0x3345('0xc'),_0x44c944,_0x3c99fa[_0x3345('0xf')][_0x3345('0x11')]);return _0x3c0f99(_0x3c99fa[_0x3345('0xf')]['message']);}else{logger[_0x3345('0xb')](_0x3345('0xc'),_0x44c944,_0x3345('0xd'));_0x3c0f99(_0x3c99fa['result']['message']);}})[_0x3345('0x12')](function(_0x40ef13){logger[_0x3345('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x44c944,_0x40ef13);_0x28622e(_0x40ef13);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 750d79e..7e93b42 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 _0x2621=['/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x25ff14,_0x384501){var _0x1eef4d=function(_0x6df658){while(--_0x6df658){_0x25ff14['push'](_0x25ff14['shift']());}};_0x1eef4d(++_0x384501);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1262('0x0'));var util=require(_0x1262('0x1'));var path=require(_0x1262('0x2'));var timeout=require(_0x1262('0x3'));var express=require(_0x1262('0x4'));var router=express[_0x1262('0x5')]();var fs_extra=require(_0x1262('0x6'));var auth=require(_0x1262('0x7'));var interaction=require(_0x1262('0x8'));var config=require(_0x1262('0x9'));var controller=require(_0x1262('0xa'));router[_0x1262('0xb')]('/',auth[_0x1262('0xc')](),controller[_0x1262('0xd')]);router['get'](_0x1262('0xe'),auth['isAuthenticated'](),controller[_0x1262('0xf')]);router['post']('/',auth[_0x1262('0xc')](),controller[_0x1262('0x10')]);router[_0x1262('0x11')]('/:id',auth[_0x1262('0xc')](),controller['update']);router[_0x1262('0x12')](_0x1262('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1262('0x13')]=router; \ No newline at end of file +var _0xae79=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x1bc1e6,_0x13d154){var _0x5d9439=function(_0x3a95b7){while(--_0x3a95b7){_0x1bc1e6['push'](_0x1bc1e6['shift']());}};_0x5d9439(++_0x13d154);}(_0xae79,0x1d3));var _0x9ae7=function(_0x49f62a,_0x75365b){_0x49f62a=_0x49f62a-0x0;var _0x2fd25b=_0xae79[_0x49f62a];return _0x2fd25b;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var fs_extra=require(_0x9ae7('0x6'));var auth=require(_0x9ae7('0x7'));var interaction=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var controller=require(_0x9ae7('0xa'));router[_0x9ae7('0xb')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xd')]);router[_0x9ae7('0xb')]('/:id',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xf')]('/',auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x10')]);router[_0x9ae7('0x11')]('/:id',auth[_0x9ae7('0xc')](),controller['update']);router[_0x9ae7('0x12')](_0x9ae7('0x13'),auth[_0x9ae7('0xc')](),controller[_0x9ae7('0x14')]);module[_0x9ae7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9db32e2..2c11235 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 _0xa88b=['STRING','ENUM','customVariable','BOOLEAN','sequelize','string','variable','keyValue'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa88b,0x1bc));var _0xba88=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xa88b[_0x5f1cf8];return _0x27d0fa;};'use strict';var Sequelize=require(_0xba88('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xba88('0x1'),_0xba88('0x2'),'customVariable',_0xba88('0x3'),'picklist'),'defaultValue':_0xba88('0x1')},'content':{'type':Sequelize[_0xba88('0x4')]},'key':{'type':Sequelize[_0xba88('0x4')]},'keyType':{'type':Sequelize[_0xba88('0x5')]('string',_0xba88('0x2'),_0xba88('0x6'))},'keyContent':{'type':Sequelize[_0xba88('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xba88('0x4')]},'customField':{'type':Sequelize[_0xba88('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba88('0x4')]}}; \ No newline at end of file +var _0x4d01=['BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x1795b4,_0x4a8cee){var _0x1d515d=function(_0x1bfe25){while(--_0x1bfe25){_0x1795b4['push'](_0x1795b4['shift']());}};_0x1d515d(++_0x4a8cee);}(_0x4d01,0x184));var _0x14d0=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x4d01[_0x45d1fd];return _0xd0e542;};'use strict';var Sequelize=require(_0x14d0('0x0'));module[_0x14d0('0x1')]={'type':{'type':Sequelize[_0x14d0('0x2')](_0x14d0('0x3'),_0x14d0('0x4'),'customVariable','keyValue',_0x14d0('0x5')),'defaultValue':_0x14d0('0x3')},'content':{'type':Sequelize[_0x14d0('0x6')]},'key':{'type':Sequelize[_0x14d0('0x6')]},'keyType':{'type':Sequelize[_0x14d0('0x2')]('string','variable',_0x14d0('0x7'))},'keyContent':{'type':Sequelize[_0x14d0('0x6')]},'idField':{'type':Sequelize[_0x14d0('0x6')]},'nameField':{'type':Sequelize[_0x14d0('0x6')]},'customField':{'type':Sequelize[_0x14d0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8cde9fd..0a96f72 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 _0xb7f1=['count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset'];(function(_0x491682,_0x38227f){var _0xae8b96=function(_0x3a89ef){while(--_0x3a89ef){_0x491682['push'](_0x491682['shift']());}};_0xae8b96(++_0x38227f);}(_0xb7f1,0x76));var _0x1b7f=function(_0x612853,_0x4c0b99){_0x612853=_0x612853-0x0;var _0x3f86bd=_0xb7f1[_0x612853];return _0x3f86bd;};'use strict';var emlformat=require(_0x1b7f('0x0'));var rimraf=require(_0x1b7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b7f('0x2'));var moment=require(_0x1b7f('0x3'));var BPromise=require(_0x1b7f('0x4'));var Mustache=require(_0x1b7f('0x5'));var util=require(_0x1b7f('0x6'));var path=require(_0x1b7f('0x7'));var sox=require(_0x1b7f('0x8'));var csv=require(_0x1b7f('0x9'));var ejs=require(_0x1b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x1b7f('0xb'));var _=require(_0x1b7f('0xc'));var squel=require(_0x1b7f('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b7f('0xe'));var deskjs=require(_0x1b7f('0xf'));var toCsv=require(_0x1b7f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b7f('0x10'));var authService=require(_0x1b7f('0x11'));var qs=require(_0x1b7f('0x12'));var as=require(_0x1b7f('0x13'));var hardwareService=require(_0x1b7f('0x14'));var logger=require('../../config/logger')(_0x1b7f('0x15'));var utils=require('../../config/utils');var config=require(_0x1b7f('0x16'));var licenseUtil=require(_0x1b7f('0x17'));var db=require(_0x1b7f('0x18'))['db'];function respondWithStatusCode(_0x330089,_0x185cb2){_0x185cb2=_0x185cb2||0xcc;return function(_0x3017a9){if(_0x3017a9){return _0x330089['sendStatus'](_0x185cb2);}return _0x330089[_0x1b7f('0x19')](_0x185cb2)[_0x1b7f('0x1a')]();};}function respondWithResult(_0x35fdbf,_0xb47869){_0xb47869=_0xb47869||0xc8;return function(_0x498b2d){if(_0x498b2d){return _0x35fdbf['status'](_0xb47869)[_0x1b7f('0x1b')](_0x498b2d);}};}function respondWithFilteredResult(_0x3953a5,_0x2f32b9){return function(_0x55a411){if(_0x55a411){var _0x578b22=typeof _0x2f32b9['offset']===_0x1b7f('0x1c')&&typeof _0x2f32b9['limit']==='undefined';var _0x1c83a7=_0x55a411['count'];var _0xcc1cf=_0x578b22?0x0:_0x2f32b9[_0x1b7f('0x1d')];var _0x321498=_0x578b22?_0x55a411[_0x1b7f('0x1e')]:_0x2f32b9[_0x1b7f('0x1d')]+_0x2f32b9[_0x1b7f('0x1f')];var _0x528c14;if(_0x321498>=_0x1c83a7){_0x321498=_0x1c83a7;_0x528c14=0xc8;}else{_0x528c14=0xce;}_0x3953a5['status'](_0x528c14);return _0x3953a5[_0x1b7f('0x20')](_0x1b7f('0x21'),_0xcc1cf+'-'+_0x321498+'/'+_0x1c83a7)[_0x1b7f('0x1b')](_0x55a411);}return null;};}function patchUpdates(_0x862de0){return function(_0x3a0090){try{jsonpatch[_0x1b7f('0x22')](_0x3a0090,_0x862de0,!![]);}catch(_0x5e3956){return BPromise[_0x1b7f('0x23')](_0x5e3956);}return _0x3a0090[_0x1b7f('0x24')]();};}function saveUpdates(_0x26c13b,_0x42b327){return function(_0xd54707){if(_0xd54707){return _0xd54707[_0x1b7f('0x25')](_0x26c13b)['then'](function(_0x3ab3cd){return _0x3ab3cd;});}return null;};}function removeEntity(_0xcd5f21,_0x141fdc){return function(_0x1288cb){if(_0x1288cb){return _0x1288cb[_0x1b7f('0x26')]()[_0x1b7f('0x27')](function(){_0xcd5f21[_0x1b7f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x262951,_0x3249f1){return function(_0x4c5dc8){if(!_0x4c5dc8){_0x262951[_0x1b7f('0x28')](0x194);}return _0x4c5dc8;};}function handleError(_0x2bad05,_0x24211a){_0x24211a=_0x24211a||0x1f4;return function(_0x5c5a57){logger[_0x1b7f('0x29')](_0x5c5a57['stack']);if(_0x5c5a57[_0x1b7f('0x2a')]){delete _0x5c5a57[_0x1b7f('0x2a')];}_0x2bad05['status'](_0x24211a)[_0x1b7f('0x2b')](_0x5c5a57);};}exports['index']=function(_0x573109,_0x137ab3){var _0x4de95b={},_0x5da4b1={},_0x40811f={'count':0x0,'rows':[]};var _0x41f998=_[_0x1b7f('0x2c')](db['FreshsalesField'][_0x1b7f('0x2d')],function(_0x563621){return{'name':_0x563621[_0x1b7f('0x2e')],'type':_0x563621['type'][_0x1b7f('0x2f')]};});_0x5da4b1[_0x1b7f('0x30')]=_[_0x1b7f('0x2c')](_0x41f998,_0x1b7f('0x2a'));_0x5da4b1[_0x1b7f('0x31')]=_[_0x1b7f('0x32')](_0x573109['query']);_0x5da4b1[_0x1b7f('0x33')]=_[_0x1b7f('0x34')](_0x5da4b1[_0x1b7f('0x30')],_0x5da4b1[_0x1b7f('0x31')]);_0x4de95b[_0x1b7f('0x35')]=_[_0x1b7f('0x34')](_0x5da4b1[_0x1b7f('0x30')],qs[_0x1b7f('0x36')](_0x573109[_0x1b7f('0x31')][_0x1b7f('0x36')]));_0x4de95b[_0x1b7f('0x35')]=_0x4de95b['attributes']['length']?_0x4de95b[_0x1b7f('0x35')]:_0x5da4b1[_0x1b7f('0x30')];if(!_0x573109[_0x1b7f('0x31')][_0x1b7f('0x37')]('nolimit')){_0x4de95b[_0x1b7f('0x1f')]=qs[_0x1b7f('0x1f')](_0x573109['query'][_0x1b7f('0x1f')]);_0x4de95b['offset']=qs[_0x1b7f('0x1d')](_0x573109[_0x1b7f('0x31')]['offset']);}_0x4de95b['order']=qs[_0x1b7f('0x38')](_0x573109[_0x1b7f('0x31')][_0x1b7f('0x38')]);_0x4de95b[_0x1b7f('0x39')]=qs[_0x1b7f('0x33')](_[_0x1b7f('0x3a')](_0x573109['query'],_0x5da4b1[_0x1b7f('0x33')]),_0x41f998);if(_0x573109[_0x1b7f('0x31')][_0x1b7f('0x3b')]){_0x4de95b[_0x1b7f('0x39')]=_['merge'](_0x4de95b[_0x1b7f('0x39')],{'$or':_[_0x1b7f('0x2c')](_0x41f998,function(_0x27caf5){if(_0x27caf5[_0x1b7f('0x3c')]!=='VIRTUAL'){var _0x256861={};_0x256861[_0x27caf5[_0x1b7f('0x2a')]]={'$like':'%'+_0x573109[_0x1b7f('0x31')]['filter']+'%'};return _0x256861;}})});}_0x4de95b=_[_0x1b7f('0x3d')]({},_0x4de95b,_0x573109[_0x1b7f('0x3e')]);var _0x5c453a={'where':_0x4de95b['where']};return db[_0x1b7f('0x3f')][_0x1b7f('0x1e')](_0x5c453a)['then'](function(_0x52f8b1){_0x40811f[_0x1b7f('0x1e')]=_0x52f8b1;if(_0x573109[_0x1b7f('0x31')][_0x1b7f('0x40')]){_0x4de95b[_0x1b7f('0x41')]=[{'all':!![]}];}return db[_0x1b7f('0x3f')][_0x1b7f('0x42')](_0x4de95b);})[_0x1b7f('0x27')](function(_0x886f10){_0x40811f[_0x1b7f('0x43')]=_0x886f10;return _0x40811f;})[_0x1b7f('0x27')](respondWithFilteredResult(_0x137ab3,_0x4de95b))[_0x1b7f('0x44')](handleError(_0x137ab3,null));};exports['show']=function(_0x13f30a,_0x1e1072){var _0x4b3747={'raw':!![],'where':{'id':_0x13f30a[_0x1b7f('0x45')]['id']}},_0x3a3eac={};_0x3a3eac['model']=_[_0x1b7f('0x32')](db[_0x1b7f('0x3f')][_0x1b7f('0x2d')]);_0x3a3eac[_0x1b7f('0x31')]=_[_0x1b7f('0x32')](_0x13f30a[_0x1b7f('0x31')]);_0x3a3eac[_0x1b7f('0x33')]=_[_0x1b7f('0x34')](_0x3a3eac[_0x1b7f('0x30')],_0x3a3eac[_0x1b7f('0x31')]);_0x4b3747[_0x1b7f('0x35')]=_[_0x1b7f('0x34')](_0x3a3eac[_0x1b7f('0x30')],qs['fields'](_0x13f30a[_0x1b7f('0x31')][_0x1b7f('0x36')]));_0x4b3747['attributes']=_0x4b3747['attributes'][_0x1b7f('0x46')]?_0x4b3747['attributes']:_0x3a3eac['model'];if(_0x13f30a[_0x1b7f('0x31')][_0x1b7f('0x40')]){_0x4b3747[_0x1b7f('0x41')]=[{'all':!![]}];}_0x4b3747=_[_0x1b7f('0x3d')]({},_0x4b3747,_0x13f30a[_0x1b7f('0x3e')]);return db[_0x1b7f('0x3f')][_0x1b7f('0x47')](_0x4b3747)['then'](handleEntityNotFound(_0x1e1072,null))[_0x1b7f('0x27')](respondWithResult(_0x1e1072,null))[_0x1b7f('0x44')](handleError(_0x1e1072,null));};exports['create']=function(_0x1e761a,_0x2e4b0b){return db[_0x1b7f('0x3f')][_0x1b7f('0x48')](_0x1e761a['body'],{})[_0x1b7f('0x27')](respondWithResult(_0x2e4b0b,0xc9))[_0x1b7f('0x44')](handleError(_0x2e4b0b,null));};exports[_0x1b7f('0x25')]=function(_0x191abe,_0x3d9997){if(_0x191abe['body']['id']){delete _0x191abe[_0x1b7f('0x49')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x191abe[_0x1b7f('0x45')]['id']}})[_0x1b7f('0x27')](handleEntityNotFound(_0x3d9997,null))[_0x1b7f('0x27')](saveUpdates(_0x191abe['body'],null))[_0x1b7f('0x27')](respondWithResult(_0x3d9997,null))[_0x1b7f('0x44')](handleError(_0x3d9997,null));};exports[_0x1b7f('0x26')]=function(_0x171c32,_0x38b015){return db[_0x1b7f('0x3f')][_0x1b7f('0x47')]({'where':{'id':_0x171c32[_0x1b7f('0x45')]['id']}})[_0x1b7f('0x27')](handleEntityNotFound(_0x38b015,null))['then'](removeEntity(_0x38b015,null))['catch'](handleError(_0x38b015,null));}; \ No newline at end of file +var _0x7be9=['name','send','FreshsalesField','rawAttributes','fieldName','map','query','keys','filters','model','attributes','intersection','fields','sort','where','pick','type','VIRTUAL','merge','options','includeAll','rows','catch','params','length','include','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','error','stack'];(function(_0x49f66b,_0x105bd6){var _0x24e37c=function(_0x65b213){while(--_0x65b213){_0x49f66b['push'](_0x49f66b['shift']());}};_0x24e37c(++_0x105bd6);}(_0x7be9,0x65));var _0x97be=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x7be9[_0x119d5a];return _0x15bff4;};'use strict';var emlformat=require(_0x97be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97be('0x1'));var jsonpatch=require(_0x97be('0x2'));var rp=require(_0x97be('0x3'));var moment=require(_0x97be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97be('0x5'));var util=require(_0x97be('0x6'));var path=require(_0x97be('0x7'));var sox=require(_0x97be('0x8'));var csv=require(_0x97be('0x9'));var ejs=require(_0x97be('0xa'));var fs=require('fs');var fs_extra=require(_0x97be('0xb'));var _=require(_0x97be('0xc'));var squel=require(_0x97be('0xd'));var crypto=require(_0x97be('0xe'));var jsforce=require(_0x97be('0xf'));var deskjs=require(_0x97be('0x10'));var toCsv=require('to-csv');var querystring=require(_0x97be('0x11'));var Papa=require('papaparse');var Redis=require(_0x97be('0x12'));var authService=require(_0x97be('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x97be('0x14'));var hardwareService=require(_0x97be('0x15'));var logger=require(_0x97be('0x16'))(_0x97be('0x17'));var utils=require(_0x97be('0x18'));var config=require(_0x97be('0x19'));var licenseUtil=require(_0x97be('0x1a'));var db=require(_0x97be('0x1b'))['db'];function respondWithStatusCode(_0x98af3,_0x19c6c5){_0x19c6c5=_0x19c6c5||0xcc;return function(_0x49a2bc){if(_0x49a2bc){return _0x98af3[_0x97be('0x1c')](_0x19c6c5);}return _0x98af3['status'](_0x19c6c5)[_0x97be('0x1d')]();};}function respondWithResult(_0x19b6cc,_0x5f2ea1){_0x5f2ea1=_0x5f2ea1||0xc8;return function(_0x5cb4f1){if(_0x5cb4f1){return _0x19b6cc[_0x97be('0x1e')](_0x5f2ea1)[_0x97be('0x1f')](_0x5cb4f1);}};}function respondWithFilteredResult(_0x5336b2,_0x357ba6){return function(_0x3ce365){if(_0x3ce365){var _0x2dd2ba=typeof _0x357ba6[_0x97be('0x20')]===_0x97be('0x21')&&typeof _0x357ba6[_0x97be('0x22')]===_0x97be('0x21');var _0x56a908=_0x3ce365['count'];var _0xb8263=_0x2dd2ba?0x0:_0x357ba6[_0x97be('0x20')];var _0x2fadd7=_0x2dd2ba?_0x3ce365[_0x97be('0x23')]:_0x357ba6[_0x97be('0x20')]+_0x357ba6[_0x97be('0x22')];var _0x428fe8;if(_0x2fadd7>=_0x56a908){_0x2fadd7=_0x56a908;_0x428fe8=0xc8;}else{_0x428fe8=0xce;}_0x5336b2[_0x97be('0x1e')](_0x428fe8);return _0x5336b2['set'](_0x97be('0x24'),_0xb8263+'-'+_0x2fadd7+'/'+_0x56a908)[_0x97be('0x1f')](_0x3ce365);}return null;};}function patchUpdates(_0x31db41){return function(_0x2d5b5d){try{jsonpatch['apply'](_0x2d5b5d,_0x31db41,!![]);}catch(_0x629e1f){return BPromise[_0x97be('0x25')](_0x629e1f);}return _0x2d5b5d['save']();};}function saveUpdates(_0x430cf0,_0x5d60c5){return function(_0x2657cf){if(_0x2657cf){return _0x2657cf[_0x97be('0x26')](_0x430cf0)['then'](function(_0x3a9ac2){return _0x3a9ac2;});}return null;};}function removeEntity(_0x58ef3d,_0x5a48e5){return function(_0x1213e3){if(_0x1213e3){return _0x1213e3[_0x97be('0x27')]()[_0x97be('0x28')](function(){_0x58ef3d[_0x97be('0x1e')](0xcc)[_0x97be('0x1d')]();});}};}function handleEntityNotFound(_0x59c160,_0x486e87){return function(_0x40ab67){if(!_0x40ab67){_0x59c160[_0x97be('0x1c')](0x194);}return _0x40ab67;};}function handleError(_0x3b21c7,_0x2a0591){_0x2a0591=_0x2a0591||0x1f4;return function(_0x2d074a){logger[_0x97be('0x29')](_0x2d074a[_0x97be('0x2a')]);if(_0x2d074a[_0x97be('0x2b')]){delete _0x2d074a[_0x97be('0x2b')];}_0x3b21c7['status'](_0x2a0591)[_0x97be('0x2c')](_0x2d074a);};}exports['index']=function(_0x320b4f,_0x1447ab){var _0x184f28={},_0x5169f4={},_0xb73f39={'count':0x0,'rows':[]};var _0x47744c=_['map'](db[_0x97be('0x2d')][_0x97be('0x2e')],function(_0xd3234a){return{'name':_0xd3234a[_0x97be('0x2f')],'type':_0xd3234a['type']['key']};});_0x5169f4['model']=_[_0x97be('0x30')](_0x47744c,_0x97be('0x2b'));_0x5169f4[_0x97be('0x31')]=_[_0x97be('0x32')](_0x320b4f[_0x97be('0x31')]);_0x5169f4[_0x97be('0x33')]=_['intersection'](_0x5169f4[_0x97be('0x34')],_0x5169f4[_0x97be('0x31')]);_0x184f28[_0x97be('0x35')]=_[_0x97be('0x36')](_0x5169f4[_0x97be('0x34')],qs['fields'](_0x320b4f[_0x97be('0x31')][_0x97be('0x37')]));_0x184f28[_0x97be('0x35')]=_0x184f28['attributes']['length']?_0x184f28[_0x97be('0x35')]:_0x5169f4[_0x97be('0x34')];if(!_0x320b4f[_0x97be('0x31')]['hasOwnProperty']('nolimit')){_0x184f28[_0x97be('0x22')]=qs[_0x97be('0x22')](_0x320b4f['query'][_0x97be('0x22')]);_0x184f28[_0x97be('0x20')]=qs[_0x97be('0x20')](_0x320b4f[_0x97be('0x31')]['offset']);}_0x184f28['order']=qs[_0x97be('0x38')](_0x320b4f[_0x97be('0x31')][_0x97be('0x38')]);_0x184f28[_0x97be('0x39')]=qs[_0x97be('0x33')](_[_0x97be('0x3a')](_0x320b4f[_0x97be('0x31')],_0x5169f4[_0x97be('0x33')]),_0x47744c);if(_0x320b4f[_0x97be('0x31')]['filter']){_0x184f28[_0x97be('0x39')]=_['merge'](_0x184f28['where'],{'$or':_[_0x97be('0x30')](_0x47744c,function(_0x114808){if(_0x114808[_0x97be('0x3b')]!==_0x97be('0x3c')){var _0x4b4aba={};_0x4b4aba[_0x114808['name']]={'$like':'%'+_0x320b4f[_0x97be('0x31')]['filter']+'%'};return _0x4b4aba;}})});}_0x184f28=_[_0x97be('0x3d')]({},_0x184f28,_0x320b4f[_0x97be('0x3e')]);var _0x32b607={'where':_0x184f28[_0x97be('0x39')]};return db[_0x97be('0x2d')][_0x97be('0x23')](_0x32b607)[_0x97be('0x28')](function(_0x3344e8){_0xb73f39[_0x97be('0x23')]=_0x3344e8;if(_0x320b4f[_0x97be('0x31')][_0x97be('0x3f')]){_0x184f28['include']=[{'all':!![]}];}return db[_0x97be('0x2d')]['findAll'](_0x184f28);})[_0x97be('0x28')](function(_0x4f9a4a){_0xb73f39[_0x97be('0x40')]=_0x4f9a4a;return _0xb73f39;})[_0x97be('0x28')](respondWithFilteredResult(_0x1447ab,_0x184f28))[_0x97be('0x41')](handleError(_0x1447ab,null));};exports['show']=function(_0x4273f7,_0x123a96){var _0x46d2b2={'raw':!![],'where':{'id':_0x4273f7[_0x97be('0x42')]['id']}},_0x4180e3={};_0x4180e3[_0x97be('0x34')]=_[_0x97be('0x32')](db[_0x97be('0x2d')][_0x97be('0x2e')]);_0x4180e3['query']=_[_0x97be('0x32')](_0x4273f7[_0x97be('0x31')]);_0x4180e3['filters']=_[_0x97be('0x36')](_0x4180e3[_0x97be('0x34')],_0x4180e3[_0x97be('0x31')]);_0x46d2b2[_0x97be('0x35')]=_[_0x97be('0x36')](_0x4180e3[_0x97be('0x34')],qs['fields'](_0x4273f7[_0x97be('0x31')]['fields']));_0x46d2b2[_0x97be('0x35')]=_0x46d2b2[_0x97be('0x35')][_0x97be('0x43')]?_0x46d2b2[_0x97be('0x35')]:_0x4180e3[_0x97be('0x34')];if(_0x4273f7[_0x97be('0x31')][_0x97be('0x3f')]){_0x46d2b2[_0x97be('0x44')]=[{'all':!![]}];}_0x46d2b2=_[_0x97be('0x3d')]({},_0x46d2b2,_0x4273f7[_0x97be('0x3e')]);return db[_0x97be('0x2d')]['find'](_0x46d2b2)[_0x97be('0x28')](handleEntityNotFound(_0x123a96,null))[_0x97be('0x28')](respondWithResult(_0x123a96,null))['catch'](handleError(_0x123a96,null));};exports[_0x97be('0x45')]=function(_0x175268,_0xc8f3bd){return db[_0x97be('0x2d')]['create'](_0x175268[_0x97be('0x46')],{})[_0x97be('0x28')](respondWithResult(_0xc8f3bd,0xc9))[_0x97be('0x41')](handleError(_0xc8f3bd,null));};exports[_0x97be('0x26')]=function(_0x130332,_0x10f766){if(_0x130332[_0x97be('0x46')]['id']){delete _0x130332[_0x97be('0x46')]['id'];}return db['FreshsalesField'][_0x97be('0x47')]({'where':{'id':_0x130332['params']['id']}})['then'](handleEntityNotFound(_0x10f766,null))[_0x97be('0x28')](saveUpdates(_0x130332[_0x97be('0x46')],null))[_0x97be('0x28')](respondWithResult(_0x10f766,null))[_0x97be('0x41')](handleError(_0x10f766,null));};exports['destroy']=function(_0x52bb53,_0x33722c){return db[_0x97be('0x2d')][_0x97be('0x47')]({'where':{'id':_0x52bb53['params']['id']}})[_0x97be('0x28')](handleEntityNotFound(_0x33722c,null))['then'](removeEntity(_0x33722c,null))[_0x97be('0x41')](handleError(_0x33722c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0910fbb..4490610 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 _0x6f18=['./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x51c4ee,_0x113035){var _0x3421cb=function(_0x1db285){while(--_0x1db285){_0x51c4ee['push'](_0x51c4ee['shift']());}};_0x3421cb(++_0x113035);}(_0x6f18,0x1b4));var _0x86f1=function(_0x18b9ed,_0x202956){_0x18b9ed=_0x18b9ed-0x0;var _0x930a87=_0x6f18[_0x18b9ed];return _0x930a87;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var logger=require(_0x86f1('0x1'))('api');var moment=require(_0x86f1('0x2'));var BPromise=require(_0x86f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86f1('0x4'));var rimraf=require(_0x86f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86f1('0x6'));module[_0x86f1('0x7')]=function(_0x3c91dc,_0x15a5e1){return _0x3c91dc[_0x86f1('0x8')]('FreshsalesField',attributes,{'tableName':_0x86f1('0x9'),'paranoid':![],'indexes':[{'name':_0x86f1('0xa'),'fields':[_0x86f1('0xb'),_0x86f1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c1a=['FieldId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField'];(function(_0x1464f2,_0x2de2e4){var _0x509d72=function(_0x5d5a25){while(--_0x5d5a25){_0x1464f2['push'](_0x1464f2['shift']());}};_0x509d72(++_0x2de2e4);}(_0x0c1a,0x127));var _0xa0c1=function(_0x3375dd,_0x5088a0){_0x3375dd=_0x3375dd-0x0;var _0x2e276a=_0x0c1a[_0x3375dd];return _0x2e276a;};'use strict';var _=require(_0xa0c1('0x0'));var util=require(_0xa0c1('0x1'));var logger=require(_0xa0c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa0c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0c1('0x4'));var rimraf=require(_0xa0c1('0x5'));var config=require(_0xa0c1('0x6'));var attributes=require(_0xa0c1('0x7'));module[_0xa0c1('0x8')]=function(_0x44538a,_0x199950){return _0x44538a[_0xa0c1('0x9')](_0xa0c1('0xa'),attributes,{'tableName':_0xa0c1('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xa0c1('0xc'),_0xa0c1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index a773ccb..9deec51 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 _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x1967,0x173));var _0x7196=function(_0x574205,_0x2e2764){_0x574205=_0x574205-0x0;var _0x12fb1a=_0x1967[_0x574205];return _0x12fb1a;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x3c5885,_0x5adff2){var _0x39e465=function(_0x5b1921){while(--_0x5b1921){_0x3c5885['push'](_0x3c5885['shift']());}};_0x39e465(++_0x5adff2);}(_0x2675,0x75));var _0x5267=function(_0x39c0d9,_0x589802){_0x39c0d9=_0x39c0d9-0x0;var _0x5c0f10=_0x2675[_0x39c0d9];return _0x5c0f10;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f4077e1..0dd7a13 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(_0x4dbb08,_0x5a693a){var _0x5b936e=function(_0x227b74){while(--_0x227b74){_0x4dbb08['push'](_0x4dbb08['shift']());}};_0x5b936e(++_0x5a693a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x1c2759,_0x58d02c){var _0x20ee10=function(_0x1e00ff){while(--_0x1e00ff){_0x1c2759['push'](_0x1c2759['shift']());}};_0x20ee10(++_0x58d02c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 b9ff478..918a46b 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 _0x9962=['STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0x451ffe,_0x3ccabd){var _0x200801=function(_0x1ae7b1){while(--_0x1ae7b1){_0x451ffe['push'](_0x451ffe['shift']());}};_0x200801(++_0x3ccabd);}(_0x9962,0xb8));var _0x2996=function(_0x4efe61,_0x5d1bb7){_0x4efe61=_0x4efe61-0x0;var _0x111983=_0x9962[_0x4efe61];return _0x111983;};'use strict';var Sequelize=require(_0x2996('0x0'));module['exports']={'name':{'type':Sequelize[_0x2996('0x1')]},'description':{'type':Sequelize[_0x2996('0x1')]},'username':{'type':Sequelize[_0x2996('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x2996('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2996('0x1')]},'clientSecret':{'type':Sequelize[_0x2996('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2996('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2996('0x2')]('integrationTab',_0x2996('0x3')),'defaultValue':_0x2996('0x4')}}; \ No newline at end of file +var _0x4201=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x4201,0x71));var _0x1420=function(_0x381f7f,_0x1321a9){_0x381f7f=_0x381f7f-0x0;var _0xd2ae6d=_0x4201[_0x381f7f];return _0xd2ae6d;};'use strict';var Sequelize=require(_0x1420('0x0'));module[_0x1420('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1420('0x2')]},'username':{'type':Sequelize[_0x1420('0x2')],'unique':_0x1420('0x3')},'remoteUri':{'type':Sequelize[_0x1420('0x2')]},'password':{'type':Sequelize[_0x1420('0x2')]},'clientId':{'type':Sequelize[_0x1420('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1420('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1420('0x4')](_0x1420('0x5'),_0x1420('0x6')),'defaultValue':_0x1420('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d33682f..97c4921 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 _0x3c40=['Wrong\x20credentials','eml-format','zip-dir','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','SalesforceAccount','findAll','rows','show','params','options','catch','create','body','find','SalesforceConfiguration','pick','getConfigurations','addConfiguration','findOne','getSubjects','getDescriptions','Subjects','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','Connection','login','username','password','concat','isNil','ticketType','sobject','describe','IsReminderSet','string','int','picklist','boolean','email','textarea','remove','includes','picklistValues','label','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xed01eb,_0x275edb){var _0x25b9de=function(_0x3c331c){while(--_0x3c331c){_0xed01eb['push'](_0xed01eb['shift']());}};_0x25b9de(++_0x275edb);}(_0x3c40,0x1d9));var _0x03c4=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x3c40[_0x41f2f5];return _0x3d49f1;};'use strict';var emlformat=require(_0x03c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x03c4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x03c4('0x3'));var util=require('util');var path=require(_0x03c4('0x4'));var sox=require(_0x03c4('0x5'));var csv=require('to-csv');var ejs=require(_0x03c4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03c4('0x7'));var squel=require(_0x03c4('0x8'));var crypto=require(_0x03c4('0x9'));var jsforce=require(_0x03c4('0xa'));var deskjs=require(_0x03c4('0xb'));var toCsv=require(_0x03c4('0xc'));var querystring=require(_0x03c4('0xd'));var Papa=require(_0x03c4('0xe'));var Redis=require(_0x03c4('0xf'));var authService=require(_0x03c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03c4('0x11'));var logger=require(_0x03c4('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03c4('0x13'));var db=require(_0x03c4('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b15b1,_0x5eeaf7){_0x5eeaf7=_0x5eeaf7||0xcc;return function(_0x74bad8){if(_0x74bad8){return _0x1b15b1[_0x03c4('0x15')](_0x5eeaf7);}return _0x1b15b1[_0x03c4('0x16')](_0x5eeaf7)[_0x03c4('0x17')]();};}function respondWithResult(_0xcd5efd,_0x1195f7){_0x1195f7=_0x1195f7||0xc8;return function(_0x31d015){if(_0x31d015){return _0xcd5efd[_0x03c4('0x16')](_0x1195f7)[_0x03c4('0x18')](_0x31d015);}};}function respondWithFilteredResult(_0x2c391c,_0x13b742){return function(_0xd59862){if(_0xd59862){var _0x4d520e=typeof _0x13b742[_0x03c4('0x19')]===_0x03c4('0x1a')&&typeof _0x13b742[_0x03c4('0x1b')]===_0x03c4('0x1a');var _0x53e1a3=_0xd59862[_0x03c4('0x1c')];var _0x2e3ff4=_0x4d520e?0x0:_0x13b742[_0x03c4('0x19')];var _0x1d52f4=_0x4d520e?_0xd59862[_0x03c4('0x1c')]:_0x13b742[_0x03c4('0x19')]+_0x13b742['limit'];var _0x81cd7f;if(_0x1d52f4>=_0x53e1a3){_0x1d52f4=_0x53e1a3;_0x81cd7f=0xc8;}else{_0x81cd7f=0xce;}_0x2c391c[_0x03c4('0x16')](_0x81cd7f);return _0x2c391c[_0x03c4('0x1d')](_0x03c4('0x1e'),_0x2e3ff4+'-'+_0x1d52f4+'/'+_0x53e1a3)[_0x03c4('0x18')](_0xd59862);}return null;};}function patchUpdates(_0x126002){return function(_0x52dfab){try{jsonpatch[_0x03c4('0x1f')](_0x52dfab,_0x126002,!![]);}catch(_0x10d7c3){return BPromise[_0x03c4('0x20')](_0x10d7c3);}return _0x52dfab[_0x03c4('0x21')]();};}function saveUpdates(_0x49f1d3,_0x3266fa){return function(_0x5be6d7){if(_0x5be6d7){return _0x5be6d7[_0x03c4('0x22')](_0x49f1d3)[_0x03c4('0x23')](function(_0x291348){return _0x291348;});}return null;};}function removeEntity(_0x10204c,_0x3edc64){return function(_0x4c3821){if(_0x4c3821){return _0x4c3821['destroy']()['then'](function(){_0x10204c[_0x03c4('0x16')](0xcc)[_0x03c4('0x17')]();});}};}function handleEntityNotFound(_0x38066b,_0x1773f8){return function(_0xbf82e6){if(!_0xbf82e6){_0x38066b['sendStatus'](0x194);}return _0xbf82e6;};}function handleError(_0x674385,_0x4c08ab){_0x4c08ab=_0x4c08ab||0x1f4;return function(_0x3eb4ef){logger[_0x03c4('0x24')](_0x3eb4ef['stack']);if(_0x3eb4ef['name']){delete _0x3eb4ef[_0x03c4('0x25')];}_0x674385[_0x03c4('0x16')](_0x4c08ab)[_0x03c4('0x26')](_0x3eb4ef);};}exports['index']=function(_0x508196,_0x14b896){var _0x54054d={},_0x368450={},_0x4c0e12={'count':0x0,'rows':[]};var _0x1ac524=_[_0x03c4('0x27')](db['SalesforceAccount'][_0x03c4('0x28')],function(_0xcc5a2d){return{'name':_0xcc5a2d[_0x03c4('0x29')],'type':_0xcc5a2d[_0x03c4('0x2a')][_0x03c4('0x2b')]};});_0x368450[_0x03c4('0x2c')]=_[_0x03c4('0x27')](_0x1ac524,'name');_0x368450[_0x03c4('0x2d')]=_[_0x03c4('0x2e')](_0x508196[_0x03c4('0x2d')]);_0x368450[_0x03c4('0x2f')]=_[_0x03c4('0x30')](_0x368450['model'],_0x368450[_0x03c4('0x2d')]);_0x54054d[_0x03c4('0x31')]=_[_0x03c4('0x30')](_0x368450['model'],qs['fields'](_0x508196[_0x03c4('0x2d')][_0x03c4('0x32')]));_0x54054d['attributes']=_0x54054d[_0x03c4('0x31')][_0x03c4('0x33')]?_0x54054d[_0x03c4('0x31')]:_0x368450[_0x03c4('0x2c')];if(!_0x508196[_0x03c4('0x2d')][_0x03c4('0x34')](_0x03c4('0x35'))){_0x54054d['limit']=qs[_0x03c4('0x1b')](_0x508196[_0x03c4('0x2d')]['limit']);_0x54054d[_0x03c4('0x19')]=qs[_0x03c4('0x19')](_0x508196[_0x03c4('0x2d')][_0x03c4('0x19')]);}_0x54054d[_0x03c4('0x36')]=qs[_0x03c4('0x37')](_0x508196['query'][_0x03c4('0x37')]);_0x54054d[_0x03c4('0x38')]=qs[_0x03c4('0x2f')](_['pick'](_0x508196[_0x03c4('0x2d')],_0x368450['filters']),_0x1ac524);if(_0x508196['query'][_0x03c4('0x39')]){_0x54054d['where']=_[_0x03c4('0x3a')](_0x54054d['where'],{'$or':_[_0x03c4('0x27')](_0x1ac524,function(_0x339e5f){if(_0x339e5f[_0x03c4('0x2a')]!==_0x03c4('0x3b')){var _0x26ab01={};_0x26ab01[_0x339e5f['name']]={'$like':'%'+_0x508196[_0x03c4('0x2d')][_0x03c4('0x39')]+'%'};return _0x26ab01;}})});}_0x54054d=_[_0x03c4('0x3a')]({},_0x54054d,_0x508196['options']);var _0x522305={'where':_0x54054d['where']};return db['SalesforceAccount']['count'](_0x522305)[_0x03c4('0x23')](function(_0x57e38f){_0x4c0e12[_0x03c4('0x1c')]=_0x57e38f;if(_0x508196[_0x03c4('0x2d')][_0x03c4('0x3c')]){_0x54054d[_0x03c4('0x3d')]=[{'all':!![]}];}return db[_0x03c4('0x3e')][_0x03c4('0x3f')](_0x54054d);})['then'](function(_0x4d5b1c){_0x4c0e12[_0x03c4('0x40')]=_0x4d5b1c;return _0x4c0e12;})[_0x03c4('0x23')](respondWithFilteredResult(_0x14b896,_0x54054d))['catch'](handleError(_0x14b896,null));};exports[_0x03c4('0x41')]=function(_0x1faeb7,_0xbc437a){var _0x4b92ff={'raw':![],'where':{'id':_0x1faeb7[_0x03c4('0x42')]['id']}},_0x3d4ad0={};_0x3d4ad0[_0x03c4('0x2c')]=_['keys'](db[_0x03c4('0x3e')][_0x03c4('0x28')]);_0x3d4ad0[_0x03c4('0x2d')]=_[_0x03c4('0x2e')](_0x1faeb7['query']);_0x3d4ad0[_0x03c4('0x2f')]=_[_0x03c4('0x30')](_0x3d4ad0[_0x03c4('0x2c')],_0x3d4ad0[_0x03c4('0x2d')]);_0x4b92ff[_0x03c4('0x31')]=_[_0x03c4('0x30')](_0x3d4ad0['model'],qs[_0x03c4('0x32')](_0x1faeb7[_0x03c4('0x2d')]['fields']));_0x4b92ff[_0x03c4('0x31')]=_0x4b92ff[_0x03c4('0x31')][_0x03c4('0x33')]?_0x4b92ff[_0x03c4('0x31')]:_0x3d4ad0[_0x03c4('0x2c')];if(_0x1faeb7['query'][_0x03c4('0x3c')]){_0x4b92ff[_0x03c4('0x3d')]=[{'all':!![]}];}_0x4b92ff=_[_0x03c4('0x3a')]({},_0x4b92ff,_0x1faeb7[_0x03c4('0x43')]);return db[_0x03c4('0x3e')]['find'](_0x4b92ff)[_0x03c4('0x23')](handleEntityNotFound(_0xbc437a,null))['then'](respondWithResult(_0xbc437a,null))[_0x03c4('0x44')](handleError(_0xbc437a,null));};exports['create']=function(_0x224643,_0x5cd06e){return db[_0x03c4('0x3e')][_0x03c4('0x45')](_0x224643[_0x03c4('0x46')],{})[_0x03c4('0x23')](respondWithResult(_0x5cd06e,0xc9))[_0x03c4('0x44')](handleError(_0x5cd06e,null));};exports[_0x03c4('0x22')]=function(_0x20929f,_0x2bb87d){if(_0x20929f[_0x03c4('0x46')]['id']){delete _0x20929f[_0x03c4('0x46')]['id'];}return db[_0x03c4('0x3e')]['find']({'where':{'id':_0x20929f['params']['id']}})[_0x03c4('0x23')](handleEntityNotFound(_0x2bb87d,null))[_0x03c4('0x23')](saveUpdates(_0x20929f[_0x03c4('0x46')],null))['then'](respondWithResult(_0x2bb87d,null))[_0x03c4('0x44')](handleError(_0x2bb87d,null));};exports['destroy']=function(_0x335cc5,_0x567649){return db['SalesforceAccount'][_0x03c4('0x47')]({'where':{'id':_0x335cc5[_0x03c4('0x42')]['id']}})[_0x03c4('0x23')](handleEntityNotFound(_0x567649,null))[_0x03c4('0x23')](removeEntity(_0x567649,null))[_0x03c4('0x44')](handleError(_0x567649,null));};exports['getConfigurations']=function(_0x57c87c,_0x2bfbb2,_0x19eb7b){var _0x28cc01={};var _0x25ffea={};var _0xbf9e7b;var _0x125046;return db[_0x03c4('0x3e')]['findOne']({'where':{'id':_0x57c87c['params']['id']}})[_0x03c4('0x23')](handleEntityNotFound(_0x2bfbb2,null))[_0x03c4('0x23')](function(_0x4fe1dd){if(_0x4fe1dd){_0xbf9e7b=_0x4fe1dd;_0x25ffea['model']=_['keys'](db[_0x03c4('0x48')]['rawAttributes']);_0x25ffea[_0x03c4('0x2d')]=_[_0x03c4('0x2e')](_0x57c87c[_0x03c4('0x2d')]);_0x25ffea[_0x03c4('0x2f')]=_[_0x03c4('0x30')](_0x25ffea[_0x03c4('0x2c')],_0x25ffea[_0x03c4('0x2d')]);_0x28cc01[_0x03c4('0x31')]=_[_0x03c4('0x30')](_0x25ffea[_0x03c4('0x2c')],qs['fields'](_0x57c87c['query'][_0x03c4('0x32')]));_0x28cc01[_0x03c4('0x31')]=_0x28cc01[_0x03c4('0x31')]['length']?_0x28cc01['attributes']:_0x25ffea[_0x03c4('0x2c')];_0x28cc01[_0x03c4('0x36')]=qs[_0x03c4('0x37')](_0x57c87c[_0x03c4('0x2d')][_0x03c4('0x37')]);_0x28cc01[_0x03c4('0x38')]=qs[_0x03c4('0x2f')](_[_0x03c4('0x49')](_0x57c87c[_0x03c4('0x2d')],_0x25ffea[_0x03c4('0x2f')]));if(_0x57c87c['query']['filter']){_0x28cc01[_0x03c4('0x38')]=_[_0x03c4('0x3a')](_0x28cc01[_0x03c4('0x38')],{'$or':_[_0x03c4('0x27')](_0x28cc01[_0x03c4('0x31')],function(_0x3b59a2){var _0x56d932={};_0x56d932[_0x3b59a2]={'$like':'%'+_0x57c87c[_0x03c4('0x2d')][_0x03c4('0x39')]+'%'};return _0x56d932;})});}_0x28cc01=_[_0x03c4('0x3a')]({},_0x28cc01,_0x57c87c[_0x03c4('0x43')]);return _0xbf9e7b[_0x03c4('0x4a')](_0x28cc01);}})[_0x03c4('0x23')](function(_0x323ca9){if(_0x323ca9){_0x125046=_0x323ca9['length'];if(!_0x57c87c[_0x03c4('0x2d')][_0x03c4('0x34')](_0x03c4('0x35'))){_0x28cc01[_0x03c4('0x1b')]=qs['limit'](_0x57c87c[_0x03c4('0x2d')][_0x03c4('0x1b')]);_0x28cc01[_0x03c4('0x19')]=qs[_0x03c4('0x19')](_0x57c87c['query'][_0x03c4('0x19')]);}return _0xbf9e7b[_0x03c4('0x4a')](_0x28cc01);}})[_0x03c4('0x23')](function(_0x3143bd){if(_0x3143bd){return _0x3143bd?{'count':_0x125046,'rows':_0x3143bd}:null;}})[_0x03c4('0x23')](respondWithResult(_0x2bfbb2,null))[_0x03c4('0x44')](handleError(_0x2bfbb2,null));};exports[_0x03c4('0x4b')]=function(_0xe16ba6,_0x1fcd61,_0x2febb1){if(_0xe16ba6[_0x03c4('0x46')]['id']){delete _0xe16ba6['body']['id'];}return db[_0x03c4('0x3e')][_0x03c4('0x4c')]({'where':{'id':_0xe16ba6[_0x03c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fcd61,null))[_0x03c4('0x23')](function(_0x4c4bad){if(_0x4c4bad){_0xe16ba6[_0x03c4('0x46')]['AccountId']=_0x4c4bad['id'];_0xe16ba6[_0x03c4('0x46')]['Subjects']=integrations[_0x03c4('0x4d')](_0xe16ba6[_0x03c4('0x46')]['channel'],_0xe16ba6['body'][_0x03c4('0x2a')]);_0xe16ba6[_0x03c4('0x46')]['Descriptions']=integrations[_0x03c4('0x4e')](_0xe16ba6['body']['channel'],_0xe16ba6[_0x03c4('0x46')][_0x03c4('0x2a')]);return db[_0x03c4('0x48')]['create'](_0xe16ba6[_0x03c4('0x46')],{'include':[{'model':db['SalesforceField'],'as':_0x03c4('0x4f')},{'model':db[_0x03c4('0x50')],'as':_0x03c4('0x51')}]});}return null;})['then'](respondWithResult(_0x1fcd61,null))[_0x03c4('0x44')](handleError(_0x1fcd61,null));};exports[_0x03c4('0x52')]=function(_0x3b5842,_0x388999,_0xdccc29){var _0x50c31d;var _0x1d8f5c='';var _0xc6e9d6=_0x03c4('0x53');return db[_0x03c4('0x3e')][_0x03c4('0x4c')]({'where':{'id':_0x3b5842['params']['id']},'attributes':['id',_0x03c4('0x54'),_0x03c4('0x55'),_0x03c4('0x56'),'username','password',_0x03c4('0x57')]})[_0x03c4('0x23')](handleEntityNotFound(_0x388999,null))[_0x03c4('0x23')](function(_0x94b84c){if(_0x94b84c){_0x1d8f5c=_0x94b84c[_0x03c4('0x54')];var _0x33a299=_0x1d8f5c[_0x03c4('0x58')](-0x1);if(_0x33a299==='/'){_0x1d8f5c=_0x1d8f5c[_0x03c4('0x59')](0x0,_0x1d8f5c[_0x03c4('0x5a')](_0x33a299));}_0x50c31d=new jsforce[(_0x03c4('0x5b'))]({'oauth2':{'loginUrl':_0x1d8f5c,'clientId':_0x94b84c[_0x03c4('0x55')],'clientSecret':_0x94b84c['clientSecret']}});return _0x50c31d[_0x03c4('0x5c')](_0x94b84c[_0x03c4('0x5d')],_0x94b84c[_0x03c4('0x5e')][_0x03c4('0x5f')](_0x94b84c[_0x03c4('0x57')]));}})[_0x03c4('0x23')](function(_0x3a4f49){if(_0x3a4f49){if(!_[_0x03c4('0x60')](_0x3b5842[_0x03c4('0x2d')]['ticketType'])){_0xc6e9d6=_0x3b5842[_0x03c4('0x2d')][_0x03c4('0x61')];}return _0x50c31d[_0x03c4('0x62')](_0xc6e9d6)[_0x03c4('0x63')]();}})[_0x03c4('0x23')](function(_0x20ae17){var _0x474ac8=['OwnerId','ActivityDate',_0x03c4('0x64'),'IsRecurrence','Subject','Description'];var _0x1d9811=[_0x03c4('0x65'),_0x03c4('0x66'),_0x03c4('0x67'),_0x03c4('0x68'),_0x03c4('0x69'),_0x03c4('0x6a'),'phone'];if(_0x20ae17){_[_0x03c4('0x6b')](_0x20ae17[_0x03c4('0x32')],function(_0x5ba583){return _0x474ac8[_0x03c4('0x6c')](_0x5ba583[_0x03c4('0x25')])||!_0x1d9811['includes'](_0x5ba583[_0x03c4('0x2a')]);});return{'count':_0x20ae17[_0x03c4('0x32')][_0x03c4('0x33')],'rows':_[_0x03c4('0x27')](_0x20ae17[_0x03c4('0x32')],function(_0x4fc5b6){return{'id':_0x4fc5b6[_0x03c4('0x25')],'name':_0x4fc5b6['label'],'custom':_0x4fc5b6['custom'],'options':_0x4fc5b6[_0x03c4('0x6d')][_0x03c4('0x33')]>0x0?_[_0x03c4('0x27')](_0x4fc5b6[_0x03c4('0x6d')],function(_0x87ac37){return{'name':_0x87ac37[_0x03c4('0x6e')],'value':_0x87ac37['value']};}):_0x4fc5b6[_0x03c4('0x2a')]==_0x03c4('0x68')?[{'name':'True','value':_0x03c4('0x6f')},{'name':_0x03c4('0x70'),'value':'false'}]:[]};})};}})[_0x03c4('0x23')](respondWithResult(_0x388999,null))[_0x03c4('0x44')](function(_0x1944e7){var _0x4666aa=_0x3b5842[_0x03c4('0x2d')][_0x03c4('0x71')]?0x1f4:_0x1944e7[_0x03c4('0x72')]||0x1f4;logger[_0x03c4('0x24')](_0x03c4('0x73'),_0x03c4('0x52'),_0x4666aa,JSON[_0x03c4('0x74')](_0x1944e7));delete _0x1944e7[_0x03c4('0x25')];if(_0x4666aa===0x191){_0x4666aa=0x190;}_0x388999['status'](_0x4666aa)[_0x03c4('0x26')](_0x3b5842[_0x03c4('0x2d')][_0x03c4('0x71')]?{'message':_0x03c4('0x75'),'statusCode':_0x1944e7[_0x03c4('0x72')]}:_0x1944e7);});}; \ No newline at end of file +var _0xdcba=['channel','Descriptions','getDescriptions','Subjects','remoteUri','clientId','clientSecret','substring','lastIndexOf','login','username','password','concat','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','SalesforceAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId'];(function(_0x44508f,_0x3d2edc){var _0x3cc7b9=function(_0x362c76){while(--_0x362c76){_0x44508f['push'](_0x44508f['shift']());}};_0x3cc7b9(++_0x3d2edc);}(_0xdcba,0x196));var _0xadcb=function(_0x53e209,_0x1d2dad){_0x53e209=_0x53e209-0x0;var _0x58b7c7=_0xdcba[_0x53e209];return _0x58b7c7;};'use strict';var emlformat=require(_0xadcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadcb('0x1'));var jsonpatch=require(_0xadcb('0x2'));var rp=require(_0xadcb('0x3'));var moment=require(_0xadcb('0x4'));var BPromise=require(_0xadcb('0x5'));var Mustache=require(_0xadcb('0x6'));var util=require('util');var path=require(_0xadcb('0x7'));var sox=require(_0xadcb('0x8'));var csv=require(_0xadcb('0x9'));var ejs=require(_0xadcb('0xa'));var fs=require('fs');var fs_extra=require(_0xadcb('0xb'));var _=require('lodash');var squel=require(_0xadcb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadcb('0xd'));var toCsv=require(_0xadcb('0x9'));var querystring=require('querystring');var Papa=require(_0xadcb('0xe'));var Redis=require(_0xadcb('0xf'));var authService=require(_0xadcb('0x10'));var qs=require(_0xadcb('0x11'));var as=require(_0xadcb('0x12'));var hardwareService=require(_0xadcb('0x13'));var logger=require('../../config/logger')(_0xadcb('0x14'));var utils=require(_0xadcb('0x15'));var config=require(_0xadcb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xadcb('0x17'))['db'];var integrations=require(_0xadcb('0x18'));function respondWithStatusCode(_0x3c727b,_0x4d63c2){_0x4d63c2=_0x4d63c2||0xcc;return function(_0x1f7b1d){if(_0x1f7b1d){return _0x3c727b[_0xadcb('0x19')](_0x4d63c2);}return _0x3c727b[_0xadcb('0x1a')](_0x4d63c2)[_0xadcb('0x1b')]();};}function respondWithResult(_0x2c421b,_0x36ad0b){_0x36ad0b=_0x36ad0b||0xc8;return function(_0xd737ef){if(_0xd737ef){return _0x2c421b[_0xadcb('0x1a')](_0x36ad0b)[_0xadcb('0x1c')](_0xd737ef);}};}function respondWithFilteredResult(_0x4b9af0,_0x2d8929){return function(_0x6ac533){if(_0x6ac533){var _0x62555=typeof _0x2d8929[_0xadcb('0x1d')]===_0xadcb('0x1e')&&typeof _0x2d8929['limit']===_0xadcb('0x1e');var _0x572b2f=_0x6ac533[_0xadcb('0x1f')];var _0x27edbb=_0x62555?0x0:_0x2d8929['offset'];var _0x1bb1f1=_0x62555?_0x6ac533[_0xadcb('0x1f')]:_0x2d8929[_0xadcb('0x1d')]+_0x2d8929['limit'];var _0x2bf96e;if(_0x1bb1f1>=_0x572b2f){_0x1bb1f1=_0x572b2f;_0x2bf96e=0xc8;}else{_0x2bf96e=0xce;}_0x4b9af0[_0xadcb('0x1a')](_0x2bf96e);return _0x4b9af0[_0xadcb('0x20')]('Content-Range',_0x27edbb+'-'+_0x1bb1f1+'/'+_0x572b2f)[_0xadcb('0x1c')](_0x6ac533);}return null;};}function patchUpdates(_0x5947f8){return function(_0x3f6b90){try{jsonpatch[_0xadcb('0x21')](_0x3f6b90,_0x5947f8,!![]);}catch(_0x10a163){return BPromise[_0xadcb('0x22')](_0x10a163);}return _0x3f6b90[_0xadcb('0x23')]();};}function saveUpdates(_0x94f719,_0x1c8825){return function(_0x1d61da){if(_0x1d61da){return _0x1d61da[_0xadcb('0x24')](_0x94f719)[_0xadcb('0x25')](function(_0x42c4cf){return _0x42c4cf;});}return null;};}function removeEntity(_0x55ae63,_0x1ee4db){return function(_0x433b1c){if(_0x433b1c){return _0x433b1c[_0xadcb('0x26')]()[_0xadcb('0x25')](function(){_0x55ae63[_0xadcb('0x1a')](0xcc)[_0xadcb('0x1b')]();});}};}function handleEntityNotFound(_0x393ce2,_0x5974c4){return function(_0x46ceac){if(!_0x46ceac){_0x393ce2['sendStatus'](0x194);}return _0x46ceac;};}function handleError(_0x332eeb,_0x35a457){_0x35a457=_0x35a457||0x1f4;return function(_0x54aab0){logger[_0xadcb('0x27')](_0x54aab0[_0xadcb('0x28')]);if(_0x54aab0['name']){delete _0x54aab0['name'];}_0x332eeb[_0xadcb('0x1a')](_0x35a457)[_0xadcb('0x29')](_0x54aab0);};}exports[_0xadcb('0x2a')]=function(_0x337513,_0x41eabb){var _0x25073c={},_0x26b1b0={},_0x57e7ec={'count':0x0,'rows':[]};var _0x1b822a=_[_0xadcb('0x2b')](db[_0xadcb('0x2c')][_0xadcb('0x2d')],function(_0xbadab6){return{'name':_0xbadab6['fieldName'],'type':_0xbadab6[_0xadcb('0x2e')][_0xadcb('0x2f')]};});_0x26b1b0[_0xadcb('0x30')]=_[_0xadcb('0x2b')](_0x1b822a,_0xadcb('0x31'));_0x26b1b0[_0xadcb('0x32')]=_[_0xadcb('0x33')](_0x337513[_0xadcb('0x32')]);_0x26b1b0[_0xadcb('0x34')]=_[_0xadcb('0x35')](_0x26b1b0[_0xadcb('0x30')],_0x26b1b0[_0xadcb('0x32')]);_0x25073c[_0xadcb('0x36')]=_[_0xadcb('0x35')](_0x26b1b0[_0xadcb('0x30')],qs[_0xadcb('0x37')](_0x337513[_0xadcb('0x32')][_0xadcb('0x37')]));_0x25073c[_0xadcb('0x36')]=_0x25073c[_0xadcb('0x36')][_0xadcb('0x38')]?_0x25073c['attributes']:_0x26b1b0[_0xadcb('0x30')];if(!_0x337513[_0xadcb('0x32')][_0xadcb('0x39')](_0xadcb('0x3a'))){_0x25073c['limit']=qs['limit'](_0x337513[_0xadcb('0x32')][_0xadcb('0x3b')]);_0x25073c[_0xadcb('0x1d')]=qs['offset'](_0x337513['query'][_0xadcb('0x1d')]);}_0x25073c[_0xadcb('0x3c')]=qs['sort'](_0x337513[_0xadcb('0x32')][_0xadcb('0x3d')]);_0x25073c[_0xadcb('0x3e')]=qs['filters'](_[_0xadcb('0x3f')](_0x337513[_0xadcb('0x32')],_0x26b1b0[_0xadcb('0x34')]),_0x1b822a);if(_0x337513[_0xadcb('0x32')][_0xadcb('0x40')]){_0x25073c[_0xadcb('0x3e')]=_[_0xadcb('0x41')](_0x25073c[_0xadcb('0x3e')],{'$or':_[_0xadcb('0x2b')](_0x1b822a,function(_0x24ff86){if(_0x24ff86[_0xadcb('0x2e')]!==_0xadcb('0x42')){var _0x340df4={};_0x340df4[_0x24ff86[_0xadcb('0x31')]]={'$like':'%'+_0x337513[_0xadcb('0x32')][_0xadcb('0x40')]+'%'};return _0x340df4;}})});}_0x25073c=_['merge']({},_0x25073c,_0x337513[_0xadcb('0x43')]);var _0x21ae54={'where':_0x25073c[_0xadcb('0x3e')]};return db['SalesforceAccount'][_0xadcb('0x1f')](_0x21ae54)[_0xadcb('0x25')](function(_0x313c9a){_0x57e7ec[_0xadcb('0x1f')]=_0x313c9a;if(_0x337513['query'][_0xadcb('0x44')]){_0x25073c['include']=[{'all':!![]}];}return db[_0xadcb('0x2c')][_0xadcb('0x45')](_0x25073c);})[_0xadcb('0x25')](function(_0xd3d615){_0x57e7ec[_0xadcb('0x46')]=_0xd3d615;return _0x57e7ec;})[_0xadcb('0x25')](respondWithFilteredResult(_0x41eabb,_0x25073c))['catch'](handleError(_0x41eabb,null));};exports[_0xadcb('0x47')]=function(_0x3fb1cc,_0x1a6c30){var _0x5cbe5e={'raw':![],'where':{'id':_0x3fb1cc[_0xadcb('0x48')]['id']}},_0x1cbfe2={};_0x1cbfe2[_0xadcb('0x30')]=_[_0xadcb('0x33')](db['SalesforceAccount'][_0xadcb('0x2d')]);_0x1cbfe2[_0xadcb('0x32')]=_[_0xadcb('0x33')](_0x3fb1cc[_0xadcb('0x32')]);_0x1cbfe2['filters']=_[_0xadcb('0x35')](_0x1cbfe2[_0xadcb('0x30')],_0x1cbfe2[_0xadcb('0x32')]);_0x5cbe5e[_0xadcb('0x36')]=_[_0xadcb('0x35')](_0x1cbfe2[_0xadcb('0x30')],qs[_0xadcb('0x37')](_0x3fb1cc[_0xadcb('0x32')][_0xadcb('0x37')]));_0x5cbe5e[_0xadcb('0x36')]=_0x5cbe5e[_0xadcb('0x36')][_0xadcb('0x38')]?_0x5cbe5e[_0xadcb('0x36')]:_0x1cbfe2['model'];if(_0x3fb1cc[_0xadcb('0x32')][_0xadcb('0x44')]){_0x5cbe5e[_0xadcb('0x49')]=[{'all':!![]}];}_0x5cbe5e=_['merge']({},_0x5cbe5e,_0x3fb1cc[_0xadcb('0x43')]);return db[_0xadcb('0x2c')][_0xadcb('0x4a')](_0x5cbe5e)[_0xadcb('0x25')](handleEntityNotFound(_0x1a6c30,null))[_0xadcb('0x25')](respondWithResult(_0x1a6c30,null))[_0xadcb('0x4b')](handleError(_0x1a6c30,null));};exports[_0xadcb('0x4c')]=function(_0x2a6b1e,_0xabb777){return db['SalesforceAccount'][_0xadcb('0x4c')](_0x2a6b1e[_0xadcb('0x4d')],{})[_0xadcb('0x25')](respondWithResult(_0xabb777,0xc9))[_0xadcb('0x4b')](handleError(_0xabb777,null));};exports[_0xadcb('0x24')]=function(_0x3a6b99,_0x1c1488){if(_0x3a6b99[_0xadcb('0x4d')]['id']){delete _0x3a6b99[_0xadcb('0x4d')]['id'];}return db[_0xadcb('0x2c')][_0xadcb('0x4a')]({'where':{'id':_0x3a6b99[_0xadcb('0x48')]['id']}})[_0xadcb('0x25')](handleEntityNotFound(_0x1c1488,null))[_0xadcb('0x25')](saveUpdates(_0x3a6b99[_0xadcb('0x4d')],null))['then'](respondWithResult(_0x1c1488,null))[_0xadcb('0x4b')](handleError(_0x1c1488,null));};exports[_0xadcb('0x26')]=function(_0x3f41c5,_0xba156c){return db[_0xadcb('0x2c')][_0xadcb('0x4a')]({'where':{'id':_0x3f41c5[_0xadcb('0x48')]['id']}})['then'](handleEntityNotFound(_0xba156c,null))[_0xadcb('0x25')](removeEntity(_0xba156c,null))[_0xadcb('0x4b')](handleError(_0xba156c,null));};exports[_0xadcb('0x4e')]=function(_0x4698c1,_0x142cc1,_0x2dd3a7){var _0x33247b={};var _0x19a873={};var _0xfa745b;var _0x71e81e;return db[_0xadcb('0x2c')][_0xadcb('0x4f')]({'where':{'id':_0x4698c1[_0xadcb('0x48')]['id']}})[_0xadcb('0x25')](handleEntityNotFound(_0x142cc1,null))[_0xadcb('0x25')](function(_0x377bde){if(_0x377bde){_0xfa745b=_0x377bde;_0x19a873[_0xadcb('0x30')]=_[_0xadcb('0x33')](db[_0xadcb('0x50')][_0xadcb('0x2d')]);_0x19a873[_0xadcb('0x32')]=_[_0xadcb('0x33')](_0x4698c1[_0xadcb('0x32')]);_0x19a873['filters']=_[_0xadcb('0x35')](_0x19a873['model'],_0x19a873['query']);_0x33247b[_0xadcb('0x36')]=_[_0xadcb('0x35')](_0x19a873[_0xadcb('0x30')],qs[_0xadcb('0x37')](_0x4698c1['query'][_0xadcb('0x37')]));_0x33247b[_0xadcb('0x36')]=_0x33247b['attributes'][_0xadcb('0x38')]?_0x33247b[_0xadcb('0x36')]:_0x19a873['model'];_0x33247b[_0xadcb('0x3c')]=qs[_0xadcb('0x3d')](_0x4698c1['query'][_0xadcb('0x3d')]);_0x33247b['where']=qs[_0xadcb('0x34')](_[_0xadcb('0x3f')](_0x4698c1[_0xadcb('0x32')],_0x19a873['filters']));if(_0x4698c1[_0xadcb('0x32')][_0xadcb('0x40')]){_0x33247b[_0xadcb('0x3e')]=_[_0xadcb('0x41')](_0x33247b[_0xadcb('0x3e')],{'$or':_['map'](_0x33247b[_0xadcb('0x36')],function(_0x31701e){var _0x260766={};_0x260766[_0x31701e]={'$like':'%'+_0x4698c1[_0xadcb('0x32')]['filter']+'%'};return _0x260766;})});}_0x33247b=_[_0xadcb('0x41')]({},_0x33247b,_0x4698c1[_0xadcb('0x43')]);return _0xfa745b[_0xadcb('0x4e')](_0x33247b);}})['then'](function(_0x25b5a1){if(_0x25b5a1){_0x71e81e=_0x25b5a1[_0xadcb('0x38')];if(!_0x4698c1[_0xadcb('0x32')][_0xadcb('0x39')](_0xadcb('0x3a'))){_0x33247b[_0xadcb('0x3b')]=qs[_0xadcb('0x3b')](_0x4698c1[_0xadcb('0x32')][_0xadcb('0x3b')]);_0x33247b['offset']=qs[_0xadcb('0x1d')](_0x4698c1[_0xadcb('0x32')][_0xadcb('0x1d')]);}return _0xfa745b[_0xadcb('0x4e')](_0x33247b);}})[_0xadcb('0x25')](function(_0x1f204d){if(_0x1f204d){return _0x1f204d?{'count':_0x71e81e,'rows':_0x1f204d}:null;}})[_0xadcb('0x25')](respondWithResult(_0x142cc1,null))[_0xadcb('0x4b')](handleError(_0x142cc1,null));};exports['addConfiguration']=function(_0x311120,_0x1e0fdb,_0x4fee4f){if(_0x311120[_0xadcb('0x4d')]['id']){delete _0x311120[_0xadcb('0x4d')]['id'];}return db[_0xadcb('0x2c')][_0xadcb('0x4f')]({'where':{'id':_0x311120[_0xadcb('0x48')]['id']}})[_0xadcb('0x25')](handleEntityNotFound(_0x1e0fdb,null))[_0xadcb('0x25')](function(_0x2cbdd1){if(_0x2cbdd1){_0x311120[_0xadcb('0x4d')][_0xadcb('0x51')]=_0x2cbdd1['id'];_0x311120[_0xadcb('0x4d')]['Subjects']=integrations['getSubjects'](_0x311120[_0xadcb('0x4d')][_0xadcb('0x52')],_0x311120[_0xadcb('0x4d')]['type']);_0x311120[_0xadcb('0x4d')][_0xadcb('0x53')]=integrations[_0xadcb('0x54')](_0x311120[_0xadcb('0x4d')][_0xadcb('0x52')],_0x311120[_0xadcb('0x4d')][_0xadcb('0x2e')]);return db['SalesforceConfiguration'][_0xadcb('0x4c')](_0x311120[_0xadcb('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0xadcb('0x55')},{'model':db['SalesforceField'],'as':_0xadcb('0x53')}]});}return null;})[_0xadcb('0x25')](respondWithResult(_0x1e0fdb,null))['catch'](handleError(_0x1e0fdb,null));};exports['getFields']=function(_0x9d5e6f,_0x7b7cef,_0x2759f4){var _0x55d3a3;var _0x5b0915='';var _0x4f2090='Task';return db[_0xadcb('0x2c')][_0xadcb('0x4f')]({'where':{'id':_0x9d5e6f['params']['id']},'attributes':['id',_0xadcb('0x56'),_0xadcb('0x57'),_0xadcb('0x58'),'username','password','securityToken']})['then'](handleEntityNotFound(_0x7b7cef,null))[_0xadcb('0x25')](function(_0x1b6b9d){if(_0x1b6b9d){_0x5b0915=_0x1b6b9d[_0xadcb('0x56')];var _0x397078=_0x5b0915['slice'](-0x1);if(_0x397078==='/'){_0x5b0915=_0x5b0915[_0xadcb('0x59')](0x0,_0x5b0915[_0xadcb('0x5a')](_0x397078));}_0x55d3a3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5b0915,'clientId':_0x1b6b9d[_0xadcb('0x57')],'clientSecret':_0x1b6b9d['clientSecret']}});return _0x55d3a3[_0xadcb('0x5b')](_0x1b6b9d[_0xadcb('0x5c')],_0x1b6b9d[_0xadcb('0x5d')][_0xadcb('0x5e')](_0x1b6b9d['securityToken']));}})['then'](function(_0x2b0018){if(_0x2b0018){if(!_['isNil'](_0x9d5e6f[_0xadcb('0x32')]['ticketType'])){_0x4f2090=_0x9d5e6f[_0xadcb('0x32')]['ticketType'];}return _0x55d3a3['sobject'](_0x4f2090)[_0xadcb('0x5f')]();}})['then'](function(_0x27db72){var _0x81ba8=[_0xadcb('0x60'),_0xadcb('0x61'),'IsReminderSet',_0xadcb('0x62'),_0xadcb('0x63'),_0xadcb('0x64')];var _0x522a00=[_0xadcb('0x65'),_0xadcb('0x66'),_0xadcb('0x67'),_0xadcb('0x68'),_0xadcb('0x69'),_0xadcb('0x6a'),_0xadcb('0x6b')];if(_0x27db72){_['remove'](_0x27db72['fields'],function(_0x528463){return _0x81ba8[_0xadcb('0x6c')](_0x528463[_0xadcb('0x31')])||!_0x522a00[_0xadcb('0x6c')](_0x528463[_0xadcb('0x2e')]);});return{'count':_0x27db72[_0xadcb('0x37')][_0xadcb('0x38')],'rows':_['map'](_0x27db72[_0xadcb('0x37')],function(_0x57126c){return{'id':_0x57126c['name'],'name':_0x57126c[_0xadcb('0x6d')],'custom':_0x57126c[_0xadcb('0x6e')],'options':_0x57126c[_0xadcb('0x6f')]['length']>0x0?_[_0xadcb('0x2b')](_0x57126c[_0xadcb('0x6f')],function(_0x135aff){return{'name':_0x135aff[_0xadcb('0x6d')],'value':_0x135aff[_0xadcb('0x70')]};}):_0x57126c[_0xadcb('0x2e')]==_0xadcb('0x68')?[{'name':_0xadcb('0x71'),'value':_0xadcb('0x72')},{'name':_0xadcb('0x73'),'value':_0xadcb('0x74')}]:[]};})};}})['then'](respondWithResult(_0x7b7cef,null))[_0xadcb('0x4b')](function(_0xb8ee7c){var _0x55a7e9=_0x9d5e6f[_0xadcb('0x32')][_0xadcb('0x75')]?0x1f4:_0xb8ee7c[_0xadcb('0x76')]||0x1f4;logger['error'](_0xadcb('0x77'),_0xadcb('0x78'),_0x55a7e9,JSON['stringify'](_0xb8ee7c));delete _0xb8ee7c[_0xadcb('0x31')];if(_0x55a7e9===0x191){_0x55a7e9=0x190;}_0x7b7cef[_0xadcb('0x1a')](_0x55a7e9)[_0xadcb('0x29')](_0x9d5e6f['query'][_0xadcb('0x75')]?{'message':_0xadcb('0x79'),'statusCode':_0xb8ee7c[_0xadcb('0x76')]}:_0xb8ee7c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 06eaf78..bcad994 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 _0x0773=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x89021b,_0x3ad200){var _0x5e2de2=function(_0x1755c1){while(--_0x1755c1){_0x89021b['push'](_0x89021b['shift']());}};_0x5e2de2(++_0x3ad200);}(_0x0773,0x1da));var _0x3077=function(_0x511530,_0x2b4dac){_0x511530=_0x511530-0x0;var _0xb5f6b1=_0x0773[_0x511530];return _0xb5f6b1;};'use strict';var _=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var logger=require(_0x3077('0x2'))(_0x3077('0x3'));var moment=require(_0x3077('0x4'));var BPromise=require(_0x3077('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3077('0x6'));var rimraf=require(_0x3077('0x7'));var config=require(_0x3077('0x8'));var attributes=require(_0x3077('0x9'));var integrations=require(_0x3077('0xa'));module[_0x3077('0xb')]=function(_0x47cb09,_0x2659f5){return _0x47cb09['define'](_0x3077('0xc'),attributes,{'tableName':_0x3077('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e04=['define','SalesforceAccount','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1dd58b,_0x3ffbf8){var _0x1efcfb=function(_0xa1cdec){while(--_0xa1cdec){_0x1dd58b['push'](_0x1dd58b['shift']());}};_0x1efcfb(++_0x3ffbf8);}(_0x9e04,0x9e));var _0x49e0=function(_0x147d4f,_0x4d888e){_0x147d4f=_0x147d4f-0x0;var _0x3180dc=_0x9e04[_0x147d4f];return _0x3180dc;};'use strict';var _=require(_0x49e0('0x0'));var util=require(_0x49e0('0x1'));var logger=require('../../config/logger')(_0x49e0('0x2'));var moment=require(_0x49e0('0x3'));var BPromise=require(_0x49e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49e0('0x5'));var rimraf=require(_0x49e0('0x6'));var config=require(_0x49e0('0x7'));var attributes=require(_0x49e0('0x8'));var integrations=require(_0x49e0('0x9'));module[_0x49e0('0xa')]=function(_0x3c9ced,_0x2396b0){return _0x3c9ced[_0x49e0('0xb')](_0x49e0('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 8e5fcce..3ef6b93 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 _0xfaa7=['debug','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0xfaa7,0x123));var _0x7faa=function(_0xe59aef,_0x3ca5b8){_0xe59aef=_0xe59aef-0x0;var _0x10378c=_0xfaa7[_0xe59aef];return _0x10378c;};'use strict';var _=require('lodash');var util=require(_0x7faa('0x0'));var moment=require(_0x7faa('0x1'));var BPromise=require(_0x7faa('0x2'));var rs=require(_0x7faa('0x3'));var fs=require('fs');var Redis=require(_0x7faa('0x4'));var db=require(_0x7faa('0x5'))['db'];var utils=require(_0x7faa('0x6'));var logger=require('../../config/logger')(_0x7faa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7faa('0x8')][_0x7faa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2da941,_0x22ec1a,_0x307b7b){return new BPromise(function(_0x2021cc,_0x682246){return client[_0x7faa('0xa')](_0x2da941,_0x307b7b)[_0x7faa('0xb')](function(_0x2fbbde){logger[_0x7faa('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x22ec1a,_0x7faa('0xd'));logger['debug'](_0x7faa('0xe'),_0x22ec1a,_0x7faa('0xd'),JSON[_0x7faa('0xf')](_0x2fbbde));if(_0x2fbbde[_0x7faa('0x10')]){if(_0x2fbbde[_0x7faa('0x10')][_0x7faa('0x11')]===0x1f4){logger['error'](_0x7faa('0x12'),_0x22ec1a,_0x2fbbde[_0x7faa('0x10')][_0x7faa('0x13')]);return _0x682246(_0x2fbbde[_0x7faa('0x10')]['message']);}logger[_0x7faa('0x10')](_0x7faa('0x12'),_0x22ec1a,_0x2fbbde[_0x7faa('0x10')][_0x7faa('0x13')]);return _0x2021cc(_0x2fbbde[_0x7faa('0x10')][_0x7faa('0x13')]);}else{logger[_0x7faa('0xc')](_0x7faa('0x12'),_0x22ec1a,_0x7faa('0xd'));_0x2021cc(_0x2fbbde[_0x7faa('0x14')]['message']);}})[_0x7faa('0x15')](function(_0x2c354a){logger[_0x7faa('0x10')](_0x7faa('0x12'),_0x22ec1a,_0x2c354a);_0x682246(_0x2c354a);});});}exports[_0x7faa('0x16')]=function(_0x370604){var _0x489150=this;return new Promise(function(_0x51dde2,_0x4e8948){return db[_0x7faa('0x17')][_0x7faa('0x18')]({'raw':_0x370604['options']?_0x370604[_0x7faa('0x19')][_0x7faa('0x1a')]===undefined?!![]:![]:!![],'where':_0x370604[_0x7faa('0x19')]?_0x370604[_0x7faa('0x19')][_0x7faa('0x1b')]||null:null,'attributes':_0x370604['options']?_0x370604['options'][_0x7faa('0x1c')]||null:null,'limit':_0x370604['options']?_0x370604['options'][_0x7faa('0x1d')]||null:null,'include':_0x370604[_0x7faa('0x19')]?_0x370604[_0x7faa('0x19')][_0x7faa('0x1e')]?_[_0x7faa('0x1f')](_0x370604[_0x7faa('0x19')][_0x7faa('0x1e')],function(_0x4b69ba){return{'model':db[_0x4b69ba[_0x7faa('0x20')]],'as':_0x4b69ba['as'],'attributes':_0x4b69ba['attributes'],'include':_0x4b69ba[_0x7faa('0x1e')]?_[_0x7faa('0x1f')](_0x4b69ba['include'],function(_0x1b9792){return{'model':db[_0x1b9792[_0x7faa('0x20')]],'as':_0x1b9792['as'],'attributes':_0x1b9792[_0x7faa('0x1c')],'include':_0x1b9792[_0x7faa('0x1e')]?_[_0x7faa('0x1f')](_0x1b9792['include'],function(_0x8e8760){return{'model':db[_0x8e8760[_0x7faa('0x20')]],'as':_0x8e8760['as'],'attributes':_0x8e8760['attributes']};}):[]};}):[]};}):[]:[]})[_0x7faa('0xb')](function(_0xab8fe5){logger[_0x7faa('0xc')](_0x7faa('0x16'),_0x370604);logger[_0x7faa('0x21')](_0x7faa('0x16'),_0x370604,JSON[_0x7faa('0xf')](_0xab8fe5));_0x51dde2(_0xab8fe5);})[_0x7faa('0x15')](function(_0x1460a8){logger[_0x7faa('0x10')](_0x7faa('0x16'),_0x1460a8[_0x7faa('0x13')],_0x370604);_0x4e8948(_0x489150[_0x7faa('0x10')](0x1f4,_0x1460a8[_0x7faa('0x13')]));});});};exports[_0x7faa('0x22')]=function(_0x372cb3){var _0x50417d=this;return new Promise(function(_0x3acf62,_0x2ac7bc){return db[_0x7faa('0x17')][_0x7faa('0x23')]({'raw':_0x372cb3[_0x7faa('0x19')]?_0x372cb3[_0x7faa('0x19')][_0x7faa('0x1a')]===undefined?!![]:![]:!![],'where':_0x372cb3[_0x7faa('0x19')]?_0x372cb3[_0x7faa('0x19')][_0x7faa('0x1b')]||null:null,'attributes':_0x372cb3[_0x7faa('0x19')]?_0x372cb3[_0x7faa('0x19')]['attributes']||null:null,'include':_0x372cb3['options']?_0x372cb3[_0x7faa('0x19')][_0x7faa('0x1e')]?_[_0x7faa('0x1f')](_0x372cb3['options']['include'],function(_0x504b2d){return{'model':db[_0x504b2d['model']],'as':_0x504b2d['as'],'attributes':_0x504b2d[_0x7faa('0x1c')],'include':_0x504b2d[_0x7faa('0x1e')]?_['map'](_0x504b2d[_0x7faa('0x1e')],function(_0x150b21){return{'model':db[_0x150b21[_0x7faa('0x20')]],'as':_0x150b21['as'],'attributes':_0x150b21['attributes'],'include':_0x150b21[_0x7faa('0x1e')]?_[_0x7faa('0x1f')](_0x150b21[_0x7faa('0x1e')],function(_0x54db3d){return{'model':db[_0x54db3d['model']],'as':_0x54db3d['as'],'attributes':_0x54db3d[_0x7faa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7faa('0xb')](function(_0x30b291){logger[_0x7faa('0xc')](_0x7faa('0x22'),_0x372cb3);logger[_0x7faa('0x21')](_0x7faa('0x22'),_0x372cb3,JSON[_0x7faa('0xf')](_0x30b291));_0x3acf62(_0x30b291);})[_0x7faa('0x15')](function(_0x409fa1){logger[_0x7faa('0x10')](_0x7faa('0x22'),_0x409fa1[_0x7faa('0x13')],_0x372cb3);_0x2ac7bc(_0x50417d[_0x7faa('0x10')](0x1f4,_0x409fa1[_0x7faa('0x13')]));});});}; \ No newline at end of file +var _0xae59=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','info','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','map','include','model','ShowSalesforceAccount','where','lodash','moment'];(function(_0x2304fb,_0x4fdedb){var _0x47014e=function(_0x4ff89a){while(--_0x4ff89a){_0x2304fb['push'](_0x2304fb['shift']());}};_0x47014e(++_0x4fdedb);}(_0xae59,0x1b8));var _0x9ae5=function(_0x275ce3,_0x42a311){_0x275ce3=_0x275ce3-0x0;var _0x5c75a4=_0xae59[_0x275ce3];return _0x5c75a4;};'use strict';var _=require(_0x9ae5('0x0'));var util=require('util');var moment=require(_0x9ae5('0x1'));var BPromise=require(_0x9ae5('0x2'));var rs=require(_0x9ae5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9ae5('0x4'));var logger=require(_0x9ae5('0x5'))(_0x9ae5('0x6'));var config=require(_0x9ae5('0x7'));var jayson=require(_0x9ae5('0x8'));var client=jayson[_0x9ae5('0x9')][_0x9ae5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b38bd,_0x4b7775,_0x1a7af7){return new BPromise(function(_0x193166,_0x95550c){return client[_0x9ae5('0xb')](_0x4b38bd,_0x1a7af7)[_0x9ae5('0xc')](function(_0x1be0e7){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4b7775,_0x9ae5('0xd'));logger[_0x9ae5('0xe')](_0x9ae5('0xf'),_0x4b7775,_0x9ae5('0xd'),JSON[_0x9ae5('0x10')](_0x1be0e7));if(_0x1be0e7[_0x9ae5('0x11')]){if(_0x1be0e7['error'][_0x9ae5('0x12')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4b7775,_0x1be0e7[_0x9ae5('0x11')][_0x9ae5('0x13')]);return _0x95550c(_0x1be0e7['error'][_0x9ae5('0x13')]);}logger['error'](_0x9ae5('0x14'),_0x4b7775,_0x1be0e7[_0x9ae5('0x11')][_0x9ae5('0x13')]);return _0x193166(_0x1be0e7[_0x9ae5('0x11')][_0x9ae5('0x13')]);}else{logger[_0x9ae5('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x4b7775,_0x9ae5('0xd'));_0x193166(_0x1be0e7['result']['message']);}})[_0x9ae5('0x16')](function(_0x1c920e){logger[_0x9ae5('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4b7775,_0x1c920e);_0x95550c(_0x1c920e);});});}exports[_0x9ae5('0x17')]=function(_0x2230cc){var _0x1fcda6=this;return new Promise(function(_0x35ac34,_0x371db8){return db[_0x9ae5('0x18')]['findAll']({'raw':_0x2230cc[_0x9ae5('0x19')]?_0x2230cc[_0x9ae5('0x19')][_0x9ae5('0x1a')]===undefined?!![]:![]:!![],'where':_0x2230cc[_0x9ae5('0x19')]?_0x2230cc[_0x9ae5('0x19')]['where']||null:null,'attributes':_0x2230cc[_0x9ae5('0x19')]?_0x2230cc['options'][_0x9ae5('0x1b')]||null:null,'limit':_0x2230cc[_0x9ae5('0x19')]?_0x2230cc[_0x9ae5('0x19')][_0x9ae5('0x1c')]||null:null,'include':_0x2230cc[_0x9ae5('0x19')]?_0x2230cc['options']['include']?_[_0x9ae5('0x1d')](_0x2230cc['options'][_0x9ae5('0x1e')],function(_0x57e767){return{'model':db[_0x57e767[_0x9ae5('0x1f')]],'as':_0x57e767['as'],'attributes':_0x57e767[_0x9ae5('0x1b')],'include':_0x57e767[_0x9ae5('0x1e')]?_[_0x9ae5('0x1d')](_0x57e767[_0x9ae5('0x1e')],function(_0x142f95){return{'model':db[_0x142f95[_0x9ae5('0x1f')]],'as':_0x142f95['as'],'attributes':_0x142f95['attributes'],'include':_0x142f95[_0x9ae5('0x1e')]?_[_0x9ae5('0x1d')](_0x142f95[_0x9ae5('0x1e')],function(_0x94942a){return{'model':db[_0x94942a[_0x9ae5('0x1f')]],'as':_0x94942a['as'],'attributes':_0x94942a[_0x9ae5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c4956){logger[_0x9ae5('0x15')](_0x9ae5('0x17'),_0x2230cc);logger[_0x9ae5('0xe')]('GetSalesforceAccount',_0x2230cc,JSON[_0x9ae5('0x10')](_0x5c4956));_0x35ac34(_0x5c4956);})[_0x9ae5('0x16')](function(_0x3cf164){logger[_0x9ae5('0x11')](_0x9ae5('0x17'),_0x3cf164[_0x9ae5('0x13')],_0x2230cc);_0x371db8(_0x1fcda6[_0x9ae5('0x11')](0x1f4,_0x3cf164[_0x9ae5('0x13')]));});});};exports[_0x9ae5('0x20')]=function(_0x7de33a){var _0x4b3678=this;return new Promise(function(_0x29528c,_0x2ad98a){return db[_0x9ae5('0x18')]['find']({'raw':_0x7de33a[_0x9ae5('0x19')]?_0x7de33a[_0x9ae5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x7de33a[_0x9ae5('0x19')]?_0x7de33a[_0x9ae5('0x19')][_0x9ae5('0x21')]||null:null,'attributes':_0x7de33a[_0x9ae5('0x19')]?_0x7de33a[_0x9ae5('0x19')][_0x9ae5('0x1b')]||null:null,'include':_0x7de33a[_0x9ae5('0x19')]?_0x7de33a['options'][_0x9ae5('0x1e')]?_['map'](_0x7de33a['options'][_0x9ae5('0x1e')],function(_0x462882){return{'model':db[_0x462882[_0x9ae5('0x1f')]],'as':_0x462882['as'],'attributes':_0x462882['attributes'],'include':_0x462882['include']?_['map'](_0x462882[_0x9ae5('0x1e')],function(_0x1e79e9){return{'model':db[_0x1e79e9[_0x9ae5('0x1f')]],'as':_0x1e79e9['as'],'attributes':_0x1e79e9[_0x9ae5('0x1b')],'include':_0x1e79e9[_0x9ae5('0x1e')]?_[_0x9ae5('0x1d')](_0x1e79e9['include'],function(_0x51c832){return{'model':db[_0x51c832[_0x9ae5('0x1f')]],'as':_0x51c832['as'],'attributes':_0x51c832[_0x9ae5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9ae5('0xc')](function(_0x2f21e1){logger[_0x9ae5('0x15')](_0x9ae5('0x20'),_0x7de33a);logger['debug'](_0x9ae5('0x20'),_0x7de33a,JSON[_0x9ae5('0x10')](_0x2f21e1));_0x29528c(_0x2f21e1);})[_0x9ae5('0x16')](function(_0x49ee26){logger[_0x9ae5('0x11')](_0x9ae5('0x20'),_0x49ee26['message'],_0x7de33a);_0x2ad98a(_0x4b3678[_0x9ae5('0x11')](0x1f4,_0x49ee26[_0x9ae5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 029563b..d4931da 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x550df5,_0x1bda30){var _0x107ed6=function(_0x10e1bc){while(--_0x10e1bc){_0x550df5['push'](_0x550df5['shift']());}};_0x107ed6(++_0x1bda30);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e1b6b,_0x5183d6){_0x5e1b6b=_0x5e1b6b-0x0;var _0x16f2f2=_0x5f2f[_0x5e1b6b];return _0x16f2f2;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x7c39e,_0x1adc4b){var _0x239962=function(_0x1b1b5c){while(--_0x1b1b5c){_0x7c39e['push'](_0x7c39e['shift']());}};_0x239962(++_0x1adc4b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 898003a..24dde8d 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 _0xf79b=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x320c04,_0x21ef13){var _0x252297=function(_0x22b5d8){while(--_0x22b5d8){_0x320c04['push'](_0x320c04['shift']());}};_0x252297(++_0x21ef13);}(_0xf79b,0xa0));var _0xbf79=function(_0x380e10,_0x444f2e){_0x380e10=_0x380e10-0x0;var _0x567b0a=_0xf79b[_0x380e10];return _0x567b0a;};'use strict';var Sequelize=require('sequelize');module[_0xbf79('0x0')]={'name':{'type':Sequelize[_0xbf79('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xbf79('0x2')](_0xbf79('0x3'),_0xbf79('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xbf79('0x2')](_0xbf79('0x5'),_0xbf79('0x6'),_0xbf79('0x7'),_0xbf79('0x8'),_0xbf79('0x9')),'defaultValue':_0xbf79('0x5')},'moduleCreate':{'type':Sequelize[_0xbf79('0x2')]('nothing',_0xbf79('0x6'),_0xbf79('0x7'),'account'),'defaultValue':_0xbf79('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xbf79('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xbf79('0x1')]}}; \ No newline at end of file +var _0x722d=['ENUM','Task','Case','contact_lead','contact','lead','account','nothing','sequelize','exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x722d,0x17e));var _0xd722=function(_0x31509a,_0x4d80b7){_0x31509a=_0x31509a-0x0;var _0x31700a=_0x722d[_0x31509a];return _0x31700a;};'use strict';var Sequelize=require(_0xd722('0x0'));module[_0xd722('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd722('0x2')]},'ticketType':{'type':Sequelize[_0xd722('0x3')](_0xd722('0x4'),_0xd722('0x5')),'defaultValue':_0xd722('0x4')},'moduleSearch':{'type':Sequelize[_0xd722('0x3')](_0xd722('0x6'),_0xd722('0x7'),_0xd722('0x8'),'account_contact_lead',_0xd722('0x9')),'defaultValue':_0xd722('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0xd722('0xa'),'contact',_0xd722('0x8'),_0xd722('0x9')),'defaultValue':_0xd722('0x8')},'leadId':{'type':Sequelize[_0xd722('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd722('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd722('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd722('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 372a8f9..07b7f8b 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 _0x70c8=['params','create','body','find','findOne','SalesforceField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','zip-dir','request-promise','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','reject','save','update','then','destroy','end','error','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show'];(function(_0x6caf42,_0x140b1c){var _0x6c4652=function(_0x766cd9){while(--_0x766cd9){_0x6caf42['push'](_0x6caf42['shift']());}};_0x6c4652(++_0x140b1c);}(_0x70c8,0xa9));var _0x870c=function(_0x20abcc,_0x174bee){_0x20abcc=_0x20abcc-0x0;var _0x58b7af=_0x70c8[_0x20abcc];return _0x58b7af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x870c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x870c('0x1'));var moment=require(_0x870c('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x870c('0x3'));var sox=require(_0x870c('0x4'));var csv=require(_0x870c('0x5'));var ejs=require(_0x870c('0x6'));var fs=require('fs');var fs_extra=require(_0x870c('0x7'));var _=require(_0x870c('0x8'));var squel=require(_0x870c('0x9'));var crypto=require(_0x870c('0xa'));var jsforce=require(_0x870c('0xb'));var deskjs=require(_0x870c('0xc'));var toCsv=require(_0x870c('0x5'));var querystring=require(_0x870c('0xd'));var Papa=require('papaparse');var Redis=require(_0x870c('0xe'));var authService=require(_0x870c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x870c('0x10'));var hardwareService=require(_0x870c('0x11'));var logger=require(_0x870c('0x12'))(_0x870c('0x13'));var utils=require('../../config/utils');var config=require(_0x870c('0x14'));var licenseUtil=require(_0x870c('0x15'));var db=require(_0x870c('0x16'))['db'];function respondWithStatusCode(_0x3f961f,_0xd70628){_0xd70628=_0xd70628||0xcc;return function(_0x312377){if(_0x312377){return _0x3f961f[_0x870c('0x17')](_0xd70628);}return _0x3f961f[_0x870c('0x18')](_0xd70628)['end']();};}function respondWithResult(_0x35d6a7,_0x2077c1){_0x2077c1=_0x2077c1||0xc8;return function(_0x1abd03){if(_0x1abd03){return _0x35d6a7['status'](_0x2077c1)[_0x870c('0x19')](_0x1abd03);}};}function respondWithFilteredResult(_0x211c91,_0xacf80f){return function(_0x1f5aae){if(_0x1f5aae){var _0x33e032=typeof _0xacf80f[_0x870c('0x1a')]===_0x870c('0x1b')&&typeof _0xacf80f['limit']===_0x870c('0x1b');var _0x1408e1=_0x1f5aae['count'];var _0x4796c0=_0x33e032?0x0:_0xacf80f[_0x870c('0x1a')];var _0x26a0e3=_0x33e032?_0x1f5aae['count']:_0xacf80f[_0x870c('0x1a')]+_0xacf80f[_0x870c('0x1c')];var _0x596615;if(_0x26a0e3>=_0x1408e1){_0x26a0e3=_0x1408e1;_0x596615=0xc8;}else{_0x596615=0xce;}_0x211c91[_0x870c('0x18')](_0x596615);return _0x211c91[_0x870c('0x1d')]('Content-Range',_0x4796c0+'-'+_0x26a0e3+'/'+_0x1408e1)[_0x870c('0x19')](_0x1f5aae);}return null;};}function patchUpdates(_0x81f710){return function(_0x2bcde3){try{jsonpatch['apply'](_0x2bcde3,_0x81f710,!![]);}catch(_0x2bc7cd){return BPromise[_0x870c('0x1e')](_0x2bc7cd);}return _0x2bcde3[_0x870c('0x1f')]();};}function saveUpdates(_0x15a07e,_0x49e0b7){return function(_0x2466f8){if(_0x2466f8){return _0x2466f8[_0x870c('0x20')](_0x15a07e)[_0x870c('0x21')](function(_0x32d7cd){return _0x32d7cd;});}return null;};}function removeEntity(_0x1287bf,_0x528cd5){return function(_0x18bd3c){if(_0x18bd3c){return _0x18bd3c[_0x870c('0x22')]()[_0x870c('0x21')](function(){_0x1287bf[_0x870c('0x18')](0xcc)[_0x870c('0x23')]();});}};}function handleEntityNotFound(_0x5b34c0,_0x22b94c){return function(_0x31122e){if(!_0x31122e){_0x5b34c0[_0x870c('0x17')](0x194);}return _0x31122e;};}function handleError(_0x3edfd9,_0x2bd02c){_0x2bd02c=_0x2bd02c||0x1f4;return function(_0x1ad240){logger[_0x870c('0x24')](_0x1ad240['stack']);if(_0x1ad240[_0x870c('0x25')]){delete _0x1ad240[_0x870c('0x25')];}_0x3edfd9['status'](_0x2bd02c)[_0x870c('0x26')](_0x1ad240);};}exports[_0x870c('0x27')]=function(_0x14a914,_0x2199a6){var _0x2a363f={},_0x2edafd={},_0x1906bf={'count':0x0,'rows':[]};var _0x293bec=_[_0x870c('0x28')](db[_0x870c('0x29')][_0x870c('0x2a')],function(_0x227fd6){return{'name':_0x227fd6['fieldName'],'type':_0x227fd6[_0x870c('0x2b')][_0x870c('0x2c')]};});_0x2edafd[_0x870c('0x2d')]=_[_0x870c('0x28')](_0x293bec,_0x870c('0x25'));_0x2edafd[_0x870c('0x2e')]=_[_0x870c('0x2f')](_0x14a914[_0x870c('0x2e')]);_0x2edafd[_0x870c('0x30')]=_[_0x870c('0x31')](_0x2edafd[_0x870c('0x2d')],_0x2edafd['query']);_0x2a363f[_0x870c('0x32')]=_['intersection'](_0x2edafd['model'],qs[_0x870c('0x33')](_0x14a914[_0x870c('0x2e')]['fields']));_0x2a363f[_0x870c('0x32')]=_0x2a363f[_0x870c('0x32')][_0x870c('0x34')]?_0x2a363f[_0x870c('0x32')]:_0x2edafd[_0x870c('0x2d')];if(!_0x14a914[_0x870c('0x2e')]['hasOwnProperty'](_0x870c('0x35'))){_0x2a363f['limit']=qs[_0x870c('0x1c')](_0x14a914[_0x870c('0x2e')][_0x870c('0x1c')]);_0x2a363f[_0x870c('0x1a')]=qs[_0x870c('0x1a')](_0x14a914[_0x870c('0x2e')][_0x870c('0x1a')]);}_0x2a363f[_0x870c('0x36')]=qs[_0x870c('0x37')](_0x14a914[_0x870c('0x2e')][_0x870c('0x37')]);_0x2a363f[_0x870c('0x38')]=qs[_0x870c('0x30')](_['pick'](_0x14a914[_0x870c('0x2e')],_0x2edafd[_0x870c('0x30')]),_0x293bec);if(_0x14a914['query'][_0x870c('0x39')]){_0x2a363f[_0x870c('0x38')]=_[_0x870c('0x3a')](_0x2a363f[_0x870c('0x38')],{'$or':_[_0x870c('0x28')](_0x293bec,function(_0x5d31c2){if(_0x5d31c2[_0x870c('0x2b')]!==_0x870c('0x3b')){var _0x328b3a={};_0x328b3a[_0x5d31c2[_0x870c('0x25')]]={'$like':'%'+_0x14a914[_0x870c('0x2e')]['filter']+'%'};return _0x328b3a;}})});}_0x2a363f=_[_0x870c('0x3a')]({},_0x2a363f,_0x14a914[_0x870c('0x3c')]);var _0x22057f={'where':_0x2a363f[_0x870c('0x38')]};return db[_0x870c('0x29')][_0x870c('0x3d')](_0x22057f)[_0x870c('0x21')](function(_0x2acaae){_0x1906bf[_0x870c('0x3d')]=_0x2acaae;if(_0x14a914[_0x870c('0x2e')][_0x870c('0x3e')]){_0x2a363f[_0x870c('0x3f')]=[{'all':!![]}];}return db[_0x870c('0x29')][_0x870c('0x40')](_0x2a363f);})[_0x870c('0x21')](function(_0x454a5b){_0x1906bf[_0x870c('0x41')]=_0x454a5b;return _0x1906bf;})[_0x870c('0x21')](respondWithFilteredResult(_0x2199a6,_0x2a363f))[_0x870c('0x42')](handleError(_0x2199a6,null));};exports[_0x870c('0x43')]=function(_0x1fccd9,_0x4f708b){var _0x4d8d53={'raw':![],'where':{'id':_0x1fccd9[_0x870c('0x44')]['id']}},_0x4e4f19={};_0x4e4f19[_0x870c('0x2d')]=_[_0x870c('0x2f')](db[_0x870c('0x29')][_0x870c('0x2a')]);_0x4e4f19[_0x870c('0x2e')]=_['keys'](_0x1fccd9[_0x870c('0x2e')]);_0x4e4f19[_0x870c('0x30')]=_[_0x870c('0x31')](_0x4e4f19['model'],_0x4e4f19[_0x870c('0x2e')]);_0x4d8d53[_0x870c('0x32')]=_[_0x870c('0x31')](_0x4e4f19[_0x870c('0x2d')],qs['fields'](_0x1fccd9['query'][_0x870c('0x33')]));_0x4d8d53['attributes']=_0x4d8d53[_0x870c('0x32')][_0x870c('0x34')]?_0x4d8d53[_0x870c('0x32')]:_0x4e4f19[_0x870c('0x2d')];if(_0x1fccd9[_0x870c('0x2e')][_0x870c('0x3e')]){_0x4d8d53[_0x870c('0x3f')]=[{'all':!![]}];}_0x4d8d53=_[_0x870c('0x3a')]({},_0x4d8d53,_0x1fccd9['options']);return db[_0x870c('0x29')]['find'](_0x4d8d53)[_0x870c('0x21')](handleEntityNotFound(_0x4f708b,null))[_0x870c('0x21')](respondWithResult(_0x4f708b,null))[_0x870c('0x42')](handleError(_0x4f708b,null));};exports[_0x870c('0x45')]=function(_0x224a58,_0x18b193){return db[_0x870c('0x29')][_0x870c('0x45')](_0x224a58[_0x870c('0x46')],{})[_0x870c('0x21')](respondWithResult(_0x18b193,0xc9))[_0x870c('0x42')](handleError(_0x18b193,null));};exports['update']=function(_0x41d411,_0x1949af){if(_0x41d411[_0x870c('0x46')]['id']){delete _0x41d411[_0x870c('0x46')]['id'];}return db[_0x870c('0x29')][_0x870c('0x47')]({'where':{'id':_0x41d411[_0x870c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1949af,null))['then'](saveUpdates(_0x41d411['body'],null))[_0x870c('0x21')](respondWithResult(_0x1949af,null))[_0x870c('0x42')](handleError(_0x1949af,null));};exports['destroy']=function(_0xc48e99,_0x45ecb5){return db['SalesforceConfiguration'][_0x870c('0x47')]({'where':{'id':_0xc48e99[_0x870c('0x44')]['id']}})[_0x870c('0x21')](handleEntityNotFound(_0x45ecb5,null))[_0x870c('0x21')](removeEntity(_0x45ecb5,null))[_0x870c('0x42')](handleError(_0x45ecb5,null));};exports['getFields']=function(_0x257d47,_0x285ded,_0x39dcb5){var _0x374af9={};var _0x128768={};var _0x4069d1;var _0x467c01;return db['SalesforceConfiguration'][_0x870c('0x48')]({'where':{'id':_0x257d47[_0x870c('0x44')]['id']}})[_0x870c('0x21')](handleEntityNotFound(_0x285ded,null))[_0x870c('0x21')](function(_0x268722){if(_0x268722){_0x4069d1=_0x268722;_0x128768['model']=_[_0x870c('0x2f')](db[_0x870c('0x49')][_0x870c('0x2a')]);_0x128768[_0x870c('0x2e')]=_['keys'](_0x257d47['query']);_0x128768[_0x870c('0x30')]=_[_0x870c('0x31')](_0x128768[_0x870c('0x2d')],_0x128768[_0x870c('0x2e')]);_0x374af9[_0x870c('0x32')]=_[_0x870c('0x31')](_0x128768['model'],qs[_0x870c('0x33')](_0x257d47[_0x870c('0x2e')]['fields']));_0x374af9[_0x870c('0x32')]=_0x374af9[_0x870c('0x32')][_0x870c('0x34')]?_0x374af9[_0x870c('0x32')]:_0x128768[_0x870c('0x2d')];_0x374af9[_0x870c('0x36')]=qs['sort'](_0x257d47[_0x870c('0x2e')]['sort']);_0x374af9[_0x870c('0x38')]=qs['filters'](_[_0x870c('0x4a')](_0x257d47[_0x870c('0x2e')],_0x128768['filters']));if(_0x257d47[_0x870c('0x2e')][_0x870c('0x39')]){_0x374af9[_0x870c('0x38')]=_[_0x870c('0x3a')](_0x374af9[_0x870c('0x38')],{'$or':_[_0x870c('0x28')](_0x374af9['attributes'],function(_0x18c693){var _0x483284={};_0x483284[_0x18c693]={'$like':'%'+_0x257d47[_0x870c('0x2e')][_0x870c('0x39')]+'%'};return _0x483284;})});}_0x374af9=_[_0x870c('0x3a')]({},_0x374af9,_0x257d47[_0x870c('0x3c')]);return _0x4069d1[_0x870c('0x4b')](_0x374af9);}})[_0x870c('0x21')](function(_0x167802){if(_0x167802){_0x467c01=_0x167802[_0x870c('0x34')];if(!_0x257d47['query'][_0x870c('0x4c')](_0x870c('0x35'))){_0x374af9[_0x870c('0x1c')]=qs[_0x870c('0x1c')](_0x257d47[_0x870c('0x2e')][_0x870c('0x1c')]);_0x374af9['offset']=qs[_0x870c('0x1a')](_0x257d47[_0x870c('0x2e')][_0x870c('0x1a')]);}return _0x4069d1[_0x870c('0x4b')](_0x374af9);}})[_0x870c('0x21')](function(_0x2f59bf){if(_0x2f59bf){return _0x2f59bf?{'count':_0x467c01,'rows':_0x2f59bf}:null;}})[_0x870c('0x21')](respondWithResult(_0x285ded,null))[_0x870c('0x42')](handleError(_0x285ded,null));};exports[_0x870c('0x4d')]=function(_0x2dc0f4,_0x4ace37,_0x5b32b5){var _0x548b75={};var _0x254e8b={};var _0x5a4747;var _0x2b7527;return db[_0x870c('0x29')]['findOne']({'where':{'id':_0x2dc0f4[_0x870c('0x44')]['id']}})[_0x870c('0x21')](handleEntityNotFound(_0x4ace37,null))['then'](function(_0x4dc3dc){if(_0x4dc3dc){_0x5a4747=_0x4dc3dc;_0x254e8b[_0x870c('0x2d')]=_['keys'](db['SalesforceField'][_0x870c('0x2a')]);_0x254e8b[_0x870c('0x2e')]=_[_0x870c('0x2f')](_0x2dc0f4[_0x870c('0x2e')]);_0x254e8b[_0x870c('0x30')]=_[_0x870c('0x31')](_0x254e8b[_0x870c('0x2d')],_0x254e8b[_0x870c('0x2e')]);_0x548b75[_0x870c('0x32')]=_[_0x870c('0x31')](_0x254e8b[_0x870c('0x2d')],qs['fields'](_0x2dc0f4[_0x870c('0x2e')]['fields']));_0x548b75[_0x870c('0x32')]=_0x548b75[_0x870c('0x32')][_0x870c('0x34')]?_0x548b75['attributes']:_0x254e8b[_0x870c('0x2d')];_0x548b75['order']=qs[_0x870c('0x37')](_0x2dc0f4[_0x870c('0x2e')][_0x870c('0x37')]);_0x548b75['where']=qs[_0x870c('0x30')](_[_0x870c('0x4a')](_0x2dc0f4[_0x870c('0x2e')],_0x254e8b[_0x870c('0x30')]));if(_0x2dc0f4[_0x870c('0x2e')][_0x870c('0x39')]){_0x548b75[_0x870c('0x38')]=_[_0x870c('0x3a')](_0x548b75['where'],{'$or':_[_0x870c('0x28')](_0x548b75['attributes'],function(_0x533203){var _0x5bc867={};_0x5bc867[_0x533203]={'$like':'%'+_0x2dc0f4['query']['filter']+'%'};return _0x5bc867;})});}_0x548b75=_[_0x870c('0x3a')]({},_0x548b75,_0x2dc0f4[_0x870c('0x3c')]);return _0x5a4747[_0x870c('0x4d')](_0x548b75);}})[_0x870c('0x21')](function(_0x1b81e5){if(_0x1b81e5){_0x2b7527=_0x1b81e5[_0x870c('0x34')];if(!_0x2dc0f4[_0x870c('0x2e')][_0x870c('0x4c')](_0x870c('0x35'))){_0x548b75[_0x870c('0x1c')]=qs[_0x870c('0x1c')](_0x2dc0f4[_0x870c('0x2e')]['limit']);_0x548b75[_0x870c('0x1a')]=qs['offset'](_0x2dc0f4[_0x870c('0x2e')][_0x870c('0x1a')]);}return _0x5a4747['getSubjects'](_0x548b75);}})[_0x870c('0x21')](function(_0xaddccb){if(_0xaddccb){return _0xaddccb?{'count':_0x2b7527,'rows':_0xaddccb}:null;}})['then'](respondWithResult(_0x4ace37,null))[_0x870c('0x42')](handleError(_0x4ace37,null));};exports[_0x870c('0x4e')]=function(_0x2897b2,_0x99158b,_0x413ac8){var _0x465a66={};var _0x112f5c={};var _0x4d3671;var _0x2d8f3d;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2897b2['params']['id']}})[_0x870c('0x21')](handleEntityNotFound(_0x99158b,null))['then'](function(_0x11a27d){if(_0x11a27d){_0x4d3671=_0x11a27d;_0x112f5c[_0x870c('0x2d')]=_['keys'](db[_0x870c('0x49')][_0x870c('0x2a')]);_0x112f5c[_0x870c('0x2e')]=_[_0x870c('0x2f')](_0x2897b2['query']);_0x112f5c['filters']=_[_0x870c('0x31')](_0x112f5c[_0x870c('0x2d')],_0x112f5c[_0x870c('0x2e')]);_0x465a66[_0x870c('0x32')]=_[_0x870c('0x31')](_0x112f5c[_0x870c('0x2d')],qs[_0x870c('0x33')](_0x2897b2['query'][_0x870c('0x33')]));_0x465a66[_0x870c('0x32')]=_0x465a66['attributes']['length']?_0x465a66['attributes']:_0x112f5c[_0x870c('0x2d')];_0x465a66['order']=qs[_0x870c('0x37')](_0x2897b2[_0x870c('0x2e')][_0x870c('0x37')]);_0x465a66[_0x870c('0x38')]=qs[_0x870c('0x30')](_[_0x870c('0x4a')](_0x2897b2[_0x870c('0x2e')],_0x112f5c[_0x870c('0x30')]));if(_0x2897b2['query'][_0x870c('0x39')]){_0x465a66['where']=_['merge'](_0x465a66[_0x870c('0x38')],{'$or':_[_0x870c('0x28')](_0x465a66[_0x870c('0x32')],function(_0x205033){var _0x2d1f09={};_0x2d1f09[_0x205033]={'$like':'%'+_0x2897b2[_0x870c('0x2e')][_0x870c('0x39')]+'%'};return _0x2d1f09;})});}_0x465a66=_[_0x870c('0x3a')]({},_0x465a66,_0x2897b2[_0x870c('0x3c')]);return _0x4d3671[_0x870c('0x4e')](_0x465a66);}})[_0x870c('0x21')](function(_0xbf8a52){if(_0xbf8a52){_0x2d8f3d=_0xbf8a52[_0x870c('0x34')];if(!_0x2897b2[_0x870c('0x2e')]['hasOwnProperty'](_0x870c('0x35'))){_0x465a66[_0x870c('0x1c')]=qs[_0x870c('0x1c')](_0x2897b2[_0x870c('0x2e')][_0x870c('0x1c')]);_0x465a66[_0x870c('0x1a')]=qs[_0x870c('0x1a')](_0x2897b2['query'][_0x870c('0x1a')]);}return _0x4d3671[_0x870c('0x4e')](_0x465a66);}})[_0x870c('0x21')](function(_0x193334){if(_0x193334){return _0x193334?{'count':_0x2d8f3d,'rows':_0x193334}:null;}})[_0x870c('0x21')](respondWithResult(_0x99158b,null))[_0x870c('0x42')](handleError(_0x99158b,null));}; \ No newline at end of file +var _0xd981=['show','params','SalesforceConfiguration','includeAll','find','create','body','pick','getFields','getSubjects','findOne','SalesforceField','nolimit','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x2f3489,_0x55f1a0){var _0x438761=function(_0x3e6903){while(--_0x3e6903){_0x2f3489['push'](_0x2f3489['shift']());}};_0x438761(++_0x55f1a0);}(_0xd981,0x1ad));var _0x1d98=function(_0x4e196c,_0x14de78){_0x4e196c=_0x4e196c-0x0;var _0x1dfadd=_0xd981[_0x4e196c];return _0x1dfadd;};'use strict';var emlformat=require(_0x1d98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d98('0x1'));var rp=require(_0x1d98('0x2'));var moment=require(_0x1d98('0x3'));var BPromise=require(_0x1d98('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1d98('0x5'));var sox=require(_0x1d98('0x6'));var csv=require('to-csv');var ejs=require(_0x1d98('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d98('0x8'));var squel=require(_0x1d98('0x9'));var crypto=require(_0x1d98('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1d98('0xb'));var toCsv=require(_0x1d98('0xc'));var querystring=require(_0x1d98('0xd'));var Papa=require(_0x1d98('0xe'));var Redis=require(_0x1d98('0xf'));var authService=require(_0x1d98('0x10'));var qs=require(_0x1d98('0x11'));var as=require(_0x1d98('0x12'));var hardwareService=require(_0x1d98('0x13'));var logger=require(_0x1d98('0x14'))(_0x1d98('0x15'));var utils=require(_0x1d98('0x16'));var config=require(_0x1d98('0x17'));var licenseUtil=require(_0x1d98('0x18'));var db=require(_0x1d98('0x19'))['db'];function respondWithStatusCode(_0x4a2ba4,_0x4452c3){_0x4452c3=_0x4452c3||0xcc;return function(_0x2dfcf7){if(_0x2dfcf7){return _0x4a2ba4[_0x1d98('0x1a')](_0x4452c3);}return _0x4a2ba4[_0x1d98('0x1b')](_0x4452c3)[_0x1d98('0x1c')]();};}function respondWithResult(_0x26185f,_0x39191d){_0x39191d=_0x39191d||0xc8;return function(_0x2db4cc){if(_0x2db4cc){return _0x26185f['status'](_0x39191d)[_0x1d98('0x1d')](_0x2db4cc);}};}function respondWithFilteredResult(_0x1f2bfe,_0x1a7519){return function(_0x293032){if(_0x293032){var _0x304f5f=typeof _0x1a7519[_0x1d98('0x1e')]===_0x1d98('0x1f')&&typeof _0x1a7519[_0x1d98('0x20')]==='undefined';var _0x4163d3=_0x293032[_0x1d98('0x21')];var _0x1ee1d8=_0x304f5f?0x0:_0x1a7519[_0x1d98('0x1e')];var _0x31a1b3=_0x304f5f?_0x293032['count']:_0x1a7519[_0x1d98('0x1e')]+_0x1a7519[_0x1d98('0x20')];var _0x37b4f7;if(_0x31a1b3>=_0x4163d3){_0x31a1b3=_0x4163d3;_0x37b4f7=0xc8;}else{_0x37b4f7=0xce;}_0x1f2bfe[_0x1d98('0x1b')](_0x37b4f7);return _0x1f2bfe[_0x1d98('0x22')]('Content-Range',_0x1ee1d8+'-'+_0x31a1b3+'/'+_0x4163d3)[_0x1d98('0x1d')](_0x293032);}return null;};}function patchUpdates(_0x501f4b){return function(_0x4b98de){try{jsonpatch[_0x1d98('0x23')](_0x4b98de,_0x501f4b,!![]);}catch(_0x59ac67){return BPromise[_0x1d98('0x24')](_0x59ac67);}return _0x4b98de[_0x1d98('0x25')]();};}function saveUpdates(_0x53dabe,_0x53815d){return function(_0x167c33){if(_0x167c33){return _0x167c33[_0x1d98('0x26')](_0x53dabe)['then'](function(_0x16f6d1){return _0x16f6d1;});}return null;};}function removeEntity(_0x39b966,_0x3a74c9){return function(_0x32c030){if(_0x32c030){return _0x32c030[_0x1d98('0x27')]()[_0x1d98('0x28')](function(){_0x39b966[_0x1d98('0x1b')](0xcc)[_0x1d98('0x1c')]();});}};}function handleEntityNotFound(_0x2e07e3,_0x2408a4){return function(_0x2ac497){if(!_0x2ac497){_0x2e07e3['sendStatus'](0x194);}return _0x2ac497;};}function handleError(_0x4f290f,_0x4c5bfa){_0x4c5bfa=_0x4c5bfa||0x1f4;return function(_0x5bf318){logger[_0x1d98('0x29')](_0x5bf318[_0x1d98('0x2a')]);if(_0x5bf318[_0x1d98('0x2b')]){delete _0x5bf318[_0x1d98('0x2b')];}_0x4f290f[_0x1d98('0x1b')](_0x4c5bfa)['send'](_0x5bf318);};}exports[_0x1d98('0x2c')]=function(_0x3c7743,_0x3365d5){var _0x112502={},_0xcaa5c5={},_0x3ef6a2={'count':0x0,'rows':[]};var _0x34a1a1=_[_0x1d98('0x2d')](db['SalesforceConfiguration'][_0x1d98('0x2e')],function(_0x500ff4){return{'name':_0x500ff4[_0x1d98('0x2f')],'type':_0x500ff4[_0x1d98('0x30')]['key']};});_0xcaa5c5[_0x1d98('0x31')]=_['map'](_0x34a1a1,_0x1d98('0x2b'));_0xcaa5c5[_0x1d98('0x32')]=_[_0x1d98('0x33')](_0x3c7743[_0x1d98('0x32')]);_0xcaa5c5['filters']=_[_0x1d98('0x34')](_0xcaa5c5[_0x1d98('0x31')],_0xcaa5c5[_0x1d98('0x32')]);_0x112502['attributes']=_[_0x1d98('0x34')](_0xcaa5c5[_0x1d98('0x31')],qs[_0x1d98('0x35')](_0x3c7743['query'][_0x1d98('0x35')]));_0x112502[_0x1d98('0x36')]=_0x112502[_0x1d98('0x36')][_0x1d98('0x37')]?_0x112502['attributes']:_0xcaa5c5[_0x1d98('0x31')];if(!_0x3c7743[_0x1d98('0x32')][_0x1d98('0x38')]('nolimit')){_0x112502[_0x1d98('0x20')]=qs[_0x1d98('0x20')](_0x3c7743[_0x1d98('0x32')][_0x1d98('0x20')]);_0x112502['offset']=qs[_0x1d98('0x1e')](_0x3c7743[_0x1d98('0x32')]['offset']);}_0x112502[_0x1d98('0x39')]=qs[_0x1d98('0x3a')](_0x3c7743[_0x1d98('0x32')][_0x1d98('0x3a')]);_0x112502[_0x1d98('0x3b')]=qs[_0x1d98('0x3c')](_['pick'](_0x3c7743[_0x1d98('0x32')],_0xcaa5c5[_0x1d98('0x3c')]),_0x34a1a1);if(_0x3c7743[_0x1d98('0x32')][_0x1d98('0x3d')]){_0x112502['where']=_[_0x1d98('0x3e')](_0x112502[_0x1d98('0x3b')],{'$or':_[_0x1d98('0x2d')](_0x34a1a1,function(_0x332d82){if(_0x332d82[_0x1d98('0x30')]!==_0x1d98('0x3f')){var _0xfb981e={};_0xfb981e[_0x332d82[_0x1d98('0x2b')]]={'$like':'%'+_0x3c7743[_0x1d98('0x32')][_0x1d98('0x3d')]+'%'};return _0xfb981e;}})});}_0x112502=_[_0x1d98('0x3e')]({},_0x112502,_0x3c7743[_0x1d98('0x40')]);var _0x393f84={'where':_0x112502[_0x1d98('0x3b')]};return db['SalesforceConfiguration'][_0x1d98('0x21')](_0x393f84)[_0x1d98('0x28')](function(_0x1e59bc){_0x3ef6a2[_0x1d98('0x21')]=_0x1e59bc;if(_0x3c7743[_0x1d98('0x32')]['includeAll']){_0x112502[_0x1d98('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x1d98('0x42')](_0x112502);})[_0x1d98('0x28')](function(_0x256762){_0x3ef6a2[_0x1d98('0x43')]=_0x256762;return _0x3ef6a2;})[_0x1d98('0x28')](respondWithFilteredResult(_0x3365d5,_0x112502))[_0x1d98('0x44')](handleError(_0x3365d5,null));};exports[_0x1d98('0x45')]=function(_0x3a2a74,_0x494218){var _0x3e8d83={'raw':![],'where':{'id':_0x3a2a74[_0x1d98('0x46')]['id']}},_0x325c90={};_0x325c90[_0x1d98('0x31')]=_[_0x1d98('0x33')](db[_0x1d98('0x47')][_0x1d98('0x2e')]);_0x325c90['query']=_['keys'](_0x3a2a74[_0x1d98('0x32')]);_0x325c90[_0x1d98('0x3c')]=_[_0x1d98('0x34')](_0x325c90[_0x1d98('0x31')],_0x325c90[_0x1d98('0x32')]);_0x3e8d83[_0x1d98('0x36')]=_[_0x1d98('0x34')](_0x325c90[_0x1d98('0x31')],qs[_0x1d98('0x35')](_0x3a2a74[_0x1d98('0x32')][_0x1d98('0x35')]));_0x3e8d83[_0x1d98('0x36')]=_0x3e8d83[_0x1d98('0x36')][_0x1d98('0x37')]?_0x3e8d83[_0x1d98('0x36')]:_0x325c90[_0x1d98('0x31')];if(_0x3a2a74[_0x1d98('0x32')][_0x1d98('0x48')]){_0x3e8d83[_0x1d98('0x41')]=[{'all':!![]}];}_0x3e8d83=_[_0x1d98('0x3e')]({},_0x3e8d83,_0x3a2a74[_0x1d98('0x40')]);return db['SalesforceConfiguration'][_0x1d98('0x49')](_0x3e8d83)[_0x1d98('0x28')](handleEntityNotFound(_0x494218,null))[_0x1d98('0x28')](respondWithResult(_0x494218,null))[_0x1d98('0x44')](handleError(_0x494218,null));};exports[_0x1d98('0x4a')]=function(_0x1122ca,_0x48224e){return db['SalesforceConfiguration']['create'](_0x1122ca['body'],{})[_0x1d98('0x28')](respondWithResult(_0x48224e,0xc9))[_0x1d98('0x44')](handleError(_0x48224e,null));};exports[_0x1d98('0x26')]=function(_0x49ed35,_0x1f16c4){if(_0x49ed35[_0x1d98('0x4b')]['id']){delete _0x49ed35[_0x1d98('0x4b')]['id'];}return db[_0x1d98('0x47')][_0x1d98('0x49')]({'where':{'id':_0x49ed35['params']['id']}})['then'](handleEntityNotFound(_0x1f16c4,null))['then'](saveUpdates(_0x49ed35[_0x1d98('0x4b')],null))[_0x1d98('0x28')](respondWithResult(_0x1f16c4,null))[_0x1d98('0x44')](handleError(_0x1f16c4,null));};exports[_0x1d98('0x27')]=function(_0x2c3628,_0x3fbe26){return db[_0x1d98('0x47')][_0x1d98('0x49')]({'where':{'id':_0x2c3628[_0x1d98('0x46')]['id']}})[_0x1d98('0x28')](handleEntityNotFound(_0x3fbe26,null))[_0x1d98('0x28')](removeEntity(_0x3fbe26,null))[_0x1d98('0x44')](handleError(_0x3fbe26,null));};exports['getFields']=function(_0x1dca9b,_0xab53e7,_0x330bca){var _0x44ea89={};var _0xad9d6f={};var _0x381e9b;var _0x54e18e;return db[_0x1d98('0x47')]['findOne']({'where':{'id':_0x1dca9b[_0x1d98('0x46')]['id']}})[_0x1d98('0x28')](handleEntityNotFound(_0xab53e7,null))[_0x1d98('0x28')](function(_0x26b0e4){if(_0x26b0e4){_0x381e9b=_0x26b0e4;_0xad9d6f[_0x1d98('0x31')]=_[_0x1d98('0x33')](db['SalesforceField'][_0x1d98('0x2e')]);_0xad9d6f[_0x1d98('0x32')]=_[_0x1d98('0x33')](_0x1dca9b[_0x1d98('0x32')]);_0xad9d6f[_0x1d98('0x3c')]=_[_0x1d98('0x34')](_0xad9d6f[_0x1d98('0x31')],_0xad9d6f[_0x1d98('0x32')]);_0x44ea89[_0x1d98('0x36')]=_[_0x1d98('0x34')](_0xad9d6f[_0x1d98('0x31')],qs[_0x1d98('0x35')](_0x1dca9b['query'][_0x1d98('0x35')]));_0x44ea89['attributes']=_0x44ea89[_0x1d98('0x36')][_0x1d98('0x37')]?_0x44ea89['attributes']:_0xad9d6f[_0x1d98('0x31')];_0x44ea89[_0x1d98('0x39')]=qs['sort'](_0x1dca9b[_0x1d98('0x32')]['sort']);_0x44ea89[_0x1d98('0x3b')]=qs[_0x1d98('0x3c')](_[_0x1d98('0x4c')](_0x1dca9b[_0x1d98('0x32')],_0xad9d6f['filters']));if(_0x1dca9b[_0x1d98('0x32')][_0x1d98('0x3d')]){_0x44ea89[_0x1d98('0x3b')]=_[_0x1d98('0x3e')](_0x44ea89[_0x1d98('0x3b')],{'$or':_[_0x1d98('0x2d')](_0x44ea89['attributes'],function(_0x661843){var _0x1432da={};_0x1432da[_0x661843]={'$like':'%'+_0x1dca9b[_0x1d98('0x32')]['filter']+'%'};return _0x1432da;})});}_0x44ea89=_['merge']({},_0x44ea89,_0x1dca9b['options']);return _0x381e9b[_0x1d98('0x4d')](_0x44ea89);}})['then'](function(_0x134eb0){if(_0x134eb0){_0x54e18e=_0x134eb0[_0x1d98('0x37')];if(!_0x1dca9b[_0x1d98('0x32')][_0x1d98('0x38')]('nolimit')){_0x44ea89[_0x1d98('0x20')]=qs[_0x1d98('0x20')](_0x1dca9b[_0x1d98('0x32')]['limit']);_0x44ea89['offset']=qs['offset'](_0x1dca9b[_0x1d98('0x32')][_0x1d98('0x1e')]);}return _0x381e9b[_0x1d98('0x4d')](_0x44ea89);}})[_0x1d98('0x28')](function(_0x285996){if(_0x285996){return _0x285996?{'count':_0x54e18e,'rows':_0x285996}:null;}})[_0x1d98('0x28')](respondWithResult(_0xab53e7,null))['catch'](handleError(_0xab53e7,null));};exports[_0x1d98('0x4e')]=function(_0x40b5d1,_0x5e84fa,_0x402f67){var _0x16fbbd={};var _0xd15083={};var _0x24cadf;var _0x5dca92;return db[_0x1d98('0x47')][_0x1d98('0x4f')]({'where':{'id':_0x40b5d1[_0x1d98('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e84fa,null))['then'](function(_0x294de5){if(_0x294de5){_0x24cadf=_0x294de5;_0xd15083['model']=_[_0x1d98('0x33')](db[_0x1d98('0x50')][_0x1d98('0x2e')]);_0xd15083[_0x1d98('0x32')]=_[_0x1d98('0x33')](_0x40b5d1[_0x1d98('0x32')]);_0xd15083['filters']=_['intersection'](_0xd15083[_0x1d98('0x31')],_0xd15083[_0x1d98('0x32')]);_0x16fbbd[_0x1d98('0x36')]=_[_0x1d98('0x34')](_0xd15083[_0x1d98('0x31')],qs[_0x1d98('0x35')](_0x40b5d1['query'][_0x1d98('0x35')]));_0x16fbbd[_0x1d98('0x36')]=_0x16fbbd[_0x1d98('0x36')][_0x1d98('0x37')]?_0x16fbbd['attributes']:_0xd15083['model'];_0x16fbbd['order']=qs[_0x1d98('0x3a')](_0x40b5d1[_0x1d98('0x32')][_0x1d98('0x3a')]);_0x16fbbd[_0x1d98('0x3b')]=qs[_0x1d98('0x3c')](_[_0x1d98('0x4c')](_0x40b5d1[_0x1d98('0x32')],_0xd15083[_0x1d98('0x3c')]));if(_0x40b5d1[_0x1d98('0x32')][_0x1d98('0x3d')]){_0x16fbbd[_0x1d98('0x3b')]=_[_0x1d98('0x3e')](_0x16fbbd['where'],{'$or':_[_0x1d98('0x2d')](_0x16fbbd['attributes'],function(_0x59563a){var _0x2bd04a={};_0x2bd04a[_0x59563a]={'$like':'%'+_0x40b5d1[_0x1d98('0x32')][_0x1d98('0x3d')]+'%'};return _0x2bd04a;})});}_0x16fbbd=_[_0x1d98('0x3e')]({},_0x16fbbd,_0x40b5d1[_0x1d98('0x40')]);return _0x24cadf[_0x1d98('0x4e')](_0x16fbbd);}})[_0x1d98('0x28')](function(_0x4aa189){if(_0x4aa189){_0x5dca92=_0x4aa189['length'];if(!_0x40b5d1['query'][_0x1d98('0x38')](_0x1d98('0x51'))){_0x16fbbd[_0x1d98('0x20')]=qs[_0x1d98('0x20')](_0x40b5d1['query'][_0x1d98('0x20')]);_0x16fbbd[_0x1d98('0x1e')]=qs[_0x1d98('0x1e')](_0x40b5d1[_0x1d98('0x32')][_0x1d98('0x1e')]);}return _0x24cadf[_0x1d98('0x4e')](_0x16fbbd);}})[_0x1d98('0x28')](function(_0x3b15eb){if(_0x3b15eb){return _0x3b15eb?{'count':_0x5dca92,'rows':_0x3b15eb}:null;}})[_0x1d98('0x28')](respondWithResult(_0x5e84fa,null))['catch'](handleError(_0x5e84fa,null));};exports[_0x1d98('0x52')]=function(_0x5d7432,_0x2b449c,_0x4799){var _0x132712={};var _0x2dc065={};var _0x5c0718;var _0x2c315b;return db['SalesforceConfiguration'][_0x1d98('0x4f')]({'where':{'id':_0x5d7432[_0x1d98('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b449c,null))['then'](function(_0x121a6f){if(_0x121a6f){_0x5c0718=_0x121a6f;_0x2dc065['model']=_[_0x1d98('0x33')](db['SalesforceField'][_0x1d98('0x2e')]);_0x2dc065['query']=_['keys'](_0x5d7432[_0x1d98('0x32')]);_0x2dc065[_0x1d98('0x3c')]=_[_0x1d98('0x34')](_0x2dc065[_0x1d98('0x31')],_0x2dc065[_0x1d98('0x32')]);_0x132712['attributes']=_[_0x1d98('0x34')](_0x2dc065[_0x1d98('0x31')],qs[_0x1d98('0x35')](_0x5d7432[_0x1d98('0x32')][_0x1d98('0x35')]));_0x132712[_0x1d98('0x36')]=_0x132712[_0x1d98('0x36')][_0x1d98('0x37')]?_0x132712[_0x1d98('0x36')]:_0x2dc065[_0x1d98('0x31')];_0x132712[_0x1d98('0x39')]=qs[_0x1d98('0x3a')](_0x5d7432[_0x1d98('0x32')]['sort']);_0x132712['where']=qs[_0x1d98('0x3c')](_['pick'](_0x5d7432[_0x1d98('0x32')],_0x2dc065[_0x1d98('0x3c')]));if(_0x5d7432['query']['filter']){_0x132712[_0x1d98('0x3b')]=_['merge'](_0x132712['where'],{'$or':_[_0x1d98('0x2d')](_0x132712[_0x1d98('0x36')],function(_0x508154){var _0x4a20f4={};_0x4a20f4[_0x508154]={'$like':'%'+_0x5d7432[_0x1d98('0x32')][_0x1d98('0x3d')]+'%'};return _0x4a20f4;})});}_0x132712=_['merge']({},_0x132712,_0x5d7432[_0x1d98('0x40')]);return _0x5c0718[_0x1d98('0x52')](_0x132712);}})[_0x1d98('0x28')](function(_0x5e36d8){if(_0x5e36d8){_0x2c315b=_0x5e36d8[_0x1d98('0x37')];if(!_0x5d7432['query'][_0x1d98('0x38')](_0x1d98('0x51'))){_0x132712[_0x1d98('0x20')]=qs[_0x1d98('0x20')](_0x5d7432['query'][_0x1d98('0x20')]);_0x132712[_0x1d98('0x1e')]=qs[_0x1d98('0x1e')](_0x5d7432[_0x1d98('0x32')][_0x1d98('0x1e')]);}return _0x5c0718[_0x1d98('0x52')](_0x132712);}})[_0x1d98('0x28')](function(_0xe5a8b8){if(_0xe5a8b8){return _0xe5a8b8?{'count':_0x2c315b,'rows':_0xe5a8b8}:null;}})[_0x1d98('0x28')](respondWithResult(_0x2b449c,null))['catch'](handleError(_0x2b449c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 868541a..039c028 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 _0x51d0=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x4cad95,_0x9a4b5){var _0xb7260e=function(_0x18b1b0){while(--_0x18b1b0){_0x4cad95['push'](_0x4cad95['shift']());}};_0xb7260e(++_0x9a4b5);}(_0x51d0,0xcd));var _0x051d=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x51d0[_0x163040];return _0x364667;};'use strict';var _=require(_0x051d('0x0'));var util=require(_0x051d('0x1'));var logger=require(_0x051d('0x2'))(_0x051d('0x3'));var moment=require(_0x051d('0x4'));var BPromise=require(_0x051d('0x5'));var rp=require(_0x051d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x051d('0x7'));var attributes=require(_0x051d('0x8'));module['exports']=function(_0x4a0e5d,_0x523288){return _0x4a0e5d[_0x051d('0x9')](_0x051d('0xa'),attributes,{'tableName':_0x051d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce5=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5c200e,_0x56ac48){var _0x34a8a9=function(_0x2ea999){while(--_0x2ea999){_0x5c200e['push'](_0x5c200e['shift']());}};_0x34a8a9(++_0x56ac48);}(_0x8ce5,0x79));var _0x58ce=function(_0x293d93,_0x15b19c){_0x293d93=_0x293d93-0x0;var _0x14b1c7=_0x8ce5[_0x293d93];return _0x14b1c7;};'use strict';var _=require(_0x58ce('0x0'));var util=require(_0x58ce('0x1'));var logger=require(_0x58ce('0x2'))(_0x58ce('0x3'));var moment=require(_0x58ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x58ce('0x5'));var fs=require('fs');var path=require(_0x58ce('0x6'));var rimraf=require(_0x58ce('0x7'));var config=require(_0x58ce('0x8'));var attributes=require(_0x58ce('0x9'));module[_0x58ce('0xa')]=function(_0x4facee,_0x13c28b){return _0x4facee['define'](_0x58ce('0xb'),attributes,{'tableName':_0x58ce('0xc'),'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 f26e4cf..9de2493 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 _0xf7b2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x4ad364,_0x3ff8d7){var _0x4ac3c3=function(_0x213721){while(--_0x213721){_0x4ad364['push'](_0x4ad364['shift']());}};_0x4ac3c3(++_0x3ff8d7);}(_0xf7b2,0x1e1));var _0x2f7b=function(_0x30edc9,_0x4fef54){_0x30edc9=_0x30edc9-0x0;var _0x169ec=_0xf7b2[_0x30edc9];return _0x169ec;};'use strict';var _=require(_0x2f7b('0x0'));var util=require(_0x2f7b('0x1'));var moment=require(_0x2f7b('0x2'));var BPromise=require(_0x2f7b('0x3'));var rs=require(_0x2f7b('0x4'));var fs=require('fs');var Redis=require(_0x2f7b('0x5'));var db=require(_0x2f7b('0x6'))['db'];var utils=require(_0x2f7b('0x7'));var logger=require(_0x2f7b('0x8'))('rpc');var config=require(_0x2f7b('0x9'));var jayson=require(_0x2f7b('0xa'));var client=jayson[_0x2f7b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c57df,_0x5297e0,_0x159f3a){return new BPromise(function(_0x2c7947,_0x246cf5){return client[_0x2f7b('0xc')](_0x2c57df,_0x159f3a)[_0x2f7b('0xd')](function(_0x1195db){logger[_0x2f7b('0xe')](_0x2f7b('0xf'),_0x5297e0,'request\x20sent');logger[_0x2f7b('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5297e0,_0x2f7b('0x11'),JSON[_0x2f7b('0x12')](_0x1195db));if(_0x1195db['error']){if(_0x1195db[_0x2f7b('0x13')][_0x2f7b('0x14')]===0x1f4){logger[_0x2f7b('0x13')](_0x2f7b('0xf'),_0x5297e0,_0x1195db['error'][_0x2f7b('0x15')]);return _0x246cf5(_0x1195db['error']['message']);}logger[_0x2f7b('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5297e0,_0x1195db[_0x2f7b('0x13')][_0x2f7b('0x15')]);return _0x2c7947(_0x1195db['error'][_0x2f7b('0x15')]);}else{logger[_0x2f7b('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5297e0,_0x2f7b('0x11'));_0x2c7947(_0x1195db[_0x2f7b('0x16')][_0x2f7b('0x15')]);}})['catch'](function(_0x815469){logger[_0x2f7b('0x13')](_0x2f7b('0xf'),_0x5297e0,_0x815469);_0x246cf5(_0x815469);});});} \ No newline at end of file +var _0xab79=['client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0xab79,0x97));var _0x9ab7=function(_0x581ea5,_0x1a885c){_0x581ea5=_0x581ea5-0x0;var _0x47b178=_0xab79[_0x581ea5];return _0x47b178;};'use strict';var _=require(_0x9ab7('0x0'));var util=require(_0x9ab7('0x1'));var moment=require(_0x9ab7('0x2'));var BPromise=require(_0x9ab7('0x3'));var rs=require(_0x9ab7('0x4'));var fs=require('fs');var Redis=require(_0x9ab7('0x5'));var db=require(_0x9ab7('0x6'))['db'];var utils=require(_0x9ab7('0x7'));var logger=require(_0x9ab7('0x8'))('rpc');var config=require(_0x9ab7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ab7('0xa')][_0x9ab7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8b048,_0x326ca4,_0x3afc4d){return new BPromise(function(_0x30bfbc,_0x139f06){return client[_0x9ab7('0xc')](_0xd8b048,_0x3afc4d)[_0x9ab7('0xd')](function(_0xa4cc2f){logger['info'](_0x9ab7('0xe'),_0x326ca4,_0x9ab7('0xf'));logger[_0x9ab7('0x10')](_0x9ab7('0x11'),_0x326ca4,_0x9ab7('0xf'),JSON[_0x9ab7('0x12')](_0xa4cc2f));if(_0xa4cc2f[_0x9ab7('0x13')]){if(_0xa4cc2f[_0x9ab7('0x13')]['code']===0x1f4){logger['error'](_0x9ab7('0xe'),_0x326ca4,_0xa4cc2f['error'][_0x9ab7('0x14')]);return _0x139f06(_0xa4cc2f[_0x9ab7('0x13')][_0x9ab7('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x326ca4,_0xa4cc2f[_0x9ab7('0x13')][_0x9ab7('0x14')]);return _0x30bfbc(_0xa4cc2f['error'][_0x9ab7('0x14')]);}else{logger[_0x9ab7('0x15')](_0x9ab7('0xe'),_0x326ca4,_0x9ab7('0xf'));_0x30bfbc(_0xa4cc2f['result']['message']);}})[_0x9ab7('0x16')](function(_0x474be7){logger['error'](_0x9ab7('0xe'),_0x326ca4,_0x474be7);_0x139f06(_0x474be7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 777b82d..6353d0a 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 _0xa5e4=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','create','put','update','exports'];(function(_0x167287,_0x283601){var _0x495aa9=function(_0x1bece7){while(--_0x1bece7){_0x167287['push'](_0x167287['shift']());}};_0x495aa9(++_0x283601);}(_0xa5e4,0x1b0));var _0x4a5e=function(_0x3d5b2f,_0x308cc3){_0x3d5b2f=_0x3d5b2f-0x0;var _0xb4584a=_0xa5e4[_0x3d5b2f];return _0xb4584a;};'use strict';var multer=require(_0x4a5e('0x0'));var util=require(_0x4a5e('0x1'));var path=require(_0x4a5e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a5e('0x3')]();var fs_extra=require(_0x4a5e('0x4'));var auth=require(_0x4a5e('0x5'));var interaction=require(_0x4a5e('0x6'));var config=require(_0x4a5e('0x7'));var controller=require(_0x4a5e('0x8'));router[_0x4a5e('0x9')]('/',auth['isAuthenticated'](),controller[_0x4a5e('0xa')]);router[_0x4a5e('0x9')](_0x4a5e('0xb'),auth[_0x4a5e('0xc')](),controller['show']);router[_0x4a5e('0xd')]('/',auth[_0x4a5e('0xc')](),controller[_0x4a5e('0xe')]);router[_0x4a5e('0xf')]('/:id',auth[_0x4a5e('0xc')](),controller[_0x4a5e('0x10')]);router['delete']('/:id',auth[_0x4a5e('0xc')](),controller['destroy']);module[_0x4a5e('0x11')]=router; \ No newline at end of file +var _0x1810=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','create','isAuthenticated','destroy','exports','multer','util'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1810,0xcf));var _0x0181=function(_0x1ea053,_0x22aecc){_0x1ea053=_0x1ea053-0x0;var _0x444b08=_0x1810[_0x1ea053];return _0x444b08;};'use strict';var multer=require(_0x0181('0x0'));var util=require(_0x0181('0x1'));var path=require(_0x0181('0x2'));var timeout=require(_0x0181('0x3'));var express=require(_0x0181('0x4'));var router=express[_0x0181('0x5')]();var fs_extra=require(_0x0181('0x6'));var auth=require(_0x0181('0x7'));var interaction=require(_0x0181('0x8'));var config=require(_0x0181('0x9'));var controller=require(_0x0181('0xa'));router[_0x0181('0xb')]('/',auth['isAuthenticated'](),controller[_0x0181('0xc')]);router[_0x0181('0xb')](_0x0181('0xd'),auth['isAuthenticated'](),controller[_0x0181('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0181('0xf')]);router['put'](_0x0181('0xd'),auth[_0x0181('0x10')](),controller['update']);router['delete']('/:id',auth[_0x0181('0x10')](),controller[_0x0181('0x11')]);module[_0x0181('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c4d67f2..13ad121 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 _0x7ebb=['string','STRING','variable','sequelize','ENUM','customVariable','keyValue','picklist'];(function(_0x11b19b,_0x213234){var _0x1daac1=function(_0x516d3b){while(--_0x516d3b){_0x11b19b['push'](_0x11b19b['shift']());}};_0x1daac1(++_0x213234);}(_0x7ebb,0x10b));var _0xb7eb=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x7ebb[_0x4e55a9];return _0x4a9b67;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module['exports']={'type':{'type':Sequelize[_0xb7eb('0x1')]('string','variable',_0xb7eb('0x2'),_0xb7eb('0x3'),_0xb7eb('0x4')),'defaultValue':_0xb7eb('0x5')},'content':{'type':Sequelize[_0xb7eb('0x6')]},'key':{'type':Sequelize[_0xb7eb('0x6')]},'keyType':{'type':Sequelize[_0xb7eb('0x1')](_0xb7eb('0x5'),_0xb7eb('0x7'),_0xb7eb('0x2'))},'keyContent':{'type':Sequelize[_0xb7eb('0x6')]},'idField':{'type':Sequelize[_0xb7eb('0x6')]},'variableName':{'type':Sequelize[_0xb7eb('0x6')]}}; \ No newline at end of file +var _0x1486=['ENUM','string','variable','customVariable','picklist','STRING','sequelize','exports'];(function(_0x25aad2,_0x552cf2){var _0x1ddf20=function(_0x4f738b){while(--_0x4f738b){_0x25aad2['push'](_0x25aad2['shift']());}};_0x1ddf20(++_0x552cf2);}(_0x1486,0x126));var _0x6148=function(_0x24e3e1,_0x5a6476){_0x24e3e1=_0x24e3e1-0x0;var _0x13fa5d=_0x1486[_0x24e3e1];return _0x13fa5d;};'use strict';var Sequelize=require(_0x6148('0x0'));module[_0x6148('0x1')]={'type':{'type':Sequelize[_0x6148('0x2')](_0x6148('0x3'),_0x6148('0x4'),_0x6148('0x5'),'keyValue',_0x6148('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6148('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6148('0x2')]('string',_0x6148('0x4'),_0x6148('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6148('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2c59c80..001df72 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 _0xe52e=['request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','update','destroy','error','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','find','create','body'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0xe52e,0x8a));var _0xee52=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0xe52e[_0x4d82ea];return _0x257f4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee52('0x0'));var moment=require('moment');var BPromise=require(_0xee52('0x1'));var Mustache=require(_0xee52('0x2'));var util=require(_0xee52('0x3'));var path=require(_0xee52('0x4'));var sox=require(_0xee52('0x5'));var csv=require(_0xee52('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee52('0x7'));var squel=require(_0xee52('0x8'));var crypto=require('crypto');var jsforce=require(_0xee52('0x9'));var deskjs=require(_0xee52('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee52('0xb'));var Redis=require(_0xee52('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee52('0xd'));var hardwareService=require(_0xee52('0xe'));var logger=require('../../config/logger')(_0xee52('0xf'));var utils=require(_0xee52('0x10'));var config=require(_0xee52('0x11'));var licenseUtil=require(_0xee52('0x12'));var db=require(_0xee52('0x13'))['db'];function respondWithStatusCode(_0x3036fc,_0x15593a){_0x15593a=_0x15593a||0xcc;return function(_0x2978fb){if(_0x2978fb){return _0x3036fc[_0xee52('0x14')](_0x15593a);}return _0x3036fc[_0xee52('0x15')](_0x15593a)[_0xee52('0x16')]();};}function respondWithResult(_0x3c9524,_0x19860f){_0x19860f=_0x19860f||0xc8;return function(_0xa5fa2f){if(_0xa5fa2f){return _0x3c9524[_0xee52('0x15')](_0x19860f)['json'](_0xa5fa2f);}};}function respondWithFilteredResult(_0x2cb8d4,_0x140d1a){return function(_0x3e9032){if(_0x3e9032){var _0xe772c2=typeof _0x140d1a[_0xee52('0x17')]==='undefined'&&typeof _0x140d1a[_0xee52('0x18')]===_0xee52('0x19');var _0x565d1c=_0x3e9032[_0xee52('0x1a')];var _0x322d7d=_0xe772c2?0x0:_0x140d1a[_0xee52('0x17')];var _0x2d6801=_0xe772c2?_0x3e9032[_0xee52('0x1a')]:_0x140d1a[_0xee52('0x17')]+_0x140d1a[_0xee52('0x18')];var _0x26d73f;if(_0x2d6801>=_0x565d1c){_0x2d6801=_0x565d1c;_0x26d73f=0xc8;}else{_0x26d73f=0xce;}_0x2cb8d4['status'](_0x26d73f);return _0x2cb8d4['set']('Content-Range',_0x322d7d+'-'+_0x2d6801+'/'+_0x565d1c)[_0xee52('0x1b')](_0x3e9032);}return null;};}function patchUpdates(_0x40bc52){return function(_0x468c24){try{jsonpatch[_0xee52('0x1c')](_0x468c24,_0x40bc52,!![]);}catch(_0x567024){return BPromise[_0xee52('0x1d')](_0x567024);}return _0x468c24['save']();};}function saveUpdates(_0x1adbe7,_0xea9e75){return function(_0x4621a0){if(_0x4621a0){return _0x4621a0[_0xee52('0x1e')](_0x1adbe7)['then'](function(_0x58de73){return _0x58de73;});}return null;};}function removeEntity(_0x9a869b,_0x54d059){return function(_0x55a85b){if(_0x55a85b){return _0x55a85b[_0xee52('0x1f')]()['then'](function(){_0x9a869b['status'](0xcc)[_0xee52('0x16')]();});}};}function handleEntityNotFound(_0x5b62ae,_0x1a7195){return function(_0x551a33){if(!_0x551a33){_0x5b62ae[_0xee52('0x14')](0x194);}return _0x551a33;};}function handleError(_0x3525d6,_0x36c058){_0x36c058=_0x36c058||0x1f4;return function(_0x53e582){logger[_0xee52('0x20')](_0x53e582['stack']);if(_0x53e582[_0xee52('0x21')]){delete _0x53e582[_0xee52('0x21')];}_0x3525d6[_0xee52('0x15')](_0x36c058)['send'](_0x53e582);};}exports[_0xee52('0x22')]=function(_0x523581,_0x28a467){var _0x2b8bd8={},_0x442d80={},_0x4e52ad={'count':0x0,'rows':[]};var _0x47b74e=_[_0xee52('0x23')](db[_0xee52('0x24')][_0xee52('0x25')],function(_0xcbe105){return{'name':_0xcbe105[_0xee52('0x26')],'type':_0xcbe105[_0xee52('0x27')][_0xee52('0x28')]};});_0x442d80[_0xee52('0x29')]=_['map'](_0x47b74e,_0xee52('0x21'));_0x442d80[_0xee52('0x2a')]=_[_0xee52('0x2b')](_0x523581[_0xee52('0x2a')]);_0x442d80['filters']=_[_0xee52('0x2c')](_0x442d80[_0xee52('0x29')],_0x442d80[_0xee52('0x2a')]);_0x2b8bd8[_0xee52('0x2d')]=_['intersection'](_0x442d80[_0xee52('0x29')],qs[_0xee52('0x2e')](_0x523581[_0xee52('0x2a')][_0xee52('0x2e')]));_0x2b8bd8[_0xee52('0x2d')]=_0x2b8bd8[_0xee52('0x2d')][_0xee52('0x2f')]?_0x2b8bd8[_0xee52('0x2d')]:_0x442d80[_0xee52('0x29')];if(!_0x523581[_0xee52('0x2a')][_0xee52('0x30')](_0xee52('0x31'))){_0x2b8bd8[_0xee52('0x18')]=qs[_0xee52('0x18')](_0x523581[_0xee52('0x2a')]['limit']);_0x2b8bd8[_0xee52('0x17')]=qs[_0xee52('0x17')](_0x523581[_0xee52('0x2a')][_0xee52('0x17')]);}_0x2b8bd8[_0xee52('0x32')]=qs[_0xee52('0x33')](_0x523581[_0xee52('0x2a')][_0xee52('0x33')]);_0x2b8bd8[_0xee52('0x34')]=qs[_0xee52('0x35')](_[_0xee52('0x36')](_0x523581['query'],_0x442d80[_0xee52('0x35')]),_0x47b74e);if(_0x523581[_0xee52('0x2a')][_0xee52('0x37')]){_0x2b8bd8[_0xee52('0x34')]=_[_0xee52('0x38')](_0x2b8bd8[_0xee52('0x34')],{'$or':_[_0xee52('0x23')](_0x47b74e,function(_0x1e5e3e){if(_0x1e5e3e[_0xee52('0x27')]!==_0xee52('0x39')){var _0x11e0e6={};_0x11e0e6[_0x1e5e3e[_0xee52('0x21')]]={'$like':'%'+_0x523581[_0xee52('0x2a')]['filter']+'%'};return _0x11e0e6;}})});}_0x2b8bd8=_[_0xee52('0x38')]({},_0x2b8bd8,_0x523581[_0xee52('0x3a')]);var _0x442d87={'where':_0x2b8bd8['where']};return db[_0xee52('0x24')][_0xee52('0x1a')](_0x442d87)[_0xee52('0x3b')](function(_0x10475c){_0x4e52ad['count']=_0x10475c;if(_0x523581[_0xee52('0x2a')][_0xee52('0x3c')]){_0x2b8bd8['include']=[{'all':!![]}];}return db['SalesforceField'][_0xee52('0x3d')](_0x2b8bd8);})['then'](function(_0x419799){_0x4e52ad[_0xee52('0x3e')]=_0x419799;return _0x4e52ad;})['then'](respondWithFilteredResult(_0x28a467,_0x2b8bd8))[_0xee52('0x3f')](handleError(_0x28a467,null));};exports[_0xee52('0x40')]=function(_0x1a65bd,_0x367366){var _0x1632af={'raw':!![],'where':{'id':_0x1a65bd[_0xee52('0x41')]['id']}},_0x5e47c5={};_0x5e47c5['model']=_['keys'](db['SalesforceField'][_0xee52('0x25')]);_0x5e47c5[_0xee52('0x2a')]=_[_0xee52('0x2b')](_0x1a65bd[_0xee52('0x2a')]);_0x5e47c5['filters']=_[_0xee52('0x2c')](_0x5e47c5[_0xee52('0x29')],_0x5e47c5[_0xee52('0x2a')]);_0x1632af['attributes']=_[_0xee52('0x2c')](_0x5e47c5[_0xee52('0x29')],qs[_0xee52('0x2e')](_0x1a65bd[_0xee52('0x2a')]['fields']));_0x1632af['attributes']=_0x1632af[_0xee52('0x2d')][_0xee52('0x2f')]?_0x1632af[_0xee52('0x2d')]:_0x5e47c5[_0xee52('0x29')];if(_0x1a65bd[_0xee52('0x2a')][_0xee52('0x3c')]){_0x1632af['include']=[{'all':!![]}];}_0x1632af=_[_0xee52('0x38')]({},_0x1632af,_0x1a65bd[_0xee52('0x3a')]);return db[_0xee52('0x24')][_0xee52('0x42')](_0x1632af)[_0xee52('0x3b')](handleEntityNotFound(_0x367366,null))[_0xee52('0x3b')](respondWithResult(_0x367366,null))[_0xee52('0x3f')](handleError(_0x367366,null));};exports['create']=function(_0x29431a,_0x3c7ef4){return db['SalesforceField'][_0xee52('0x43')](_0x29431a[_0xee52('0x44')],{})[_0xee52('0x3b')](respondWithResult(_0x3c7ef4,0xc9))[_0xee52('0x3f')](handleError(_0x3c7ef4,null));};exports[_0xee52('0x1e')]=function(_0x30091e,_0x709b69){if(_0x30091e[_0xee52('0x44')]['id']){delete _0x30091e[_0xee52('0x44')]['id'];}return db[_0xee52('0x24')][_0xee52('0x42')]({'where':{'id':_0x30091e['params']['id']}})[_0xee52('0x3b')](handleEntityNotFound(_0x709b69,null))['then'](saveUpdates(_0x30091e[_0xee52('0x44')],null))[_0xee52('0x3b')](respondWithResult(_0x709b69,null))['catch'](handleError(_0x709b69,null));};exports['destroy']=function(_0x35fc0d,_0x11ce37){return db[_0xee52('0x24')]['find']({'where':{'id':_0x35fc0d['params']['id']}})[_0xee52('0x3b')](handleEntityNotFound(_0x11ce37,null))[_0xee52('0x3b')](removeEntity(_0x11ce37,null))[_0xee52('0x3f')](handleError(_0x11ce37,null));}; \ No newline at end of file +var _0x9039=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','rawAttributes','include','options','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','SalesforceField','type'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x9039,0xfe));var _0x9903=function(_0xa0640c,_0x1beb8c){_0xa0640c=_0xa0640c-0x0;var _0x2cc85e=_0x9039[_0xa0640c];return _0x2cc85e;};'use strict';var emlformat=require(_0x9903('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9903('0x1'));var jsonpatch=require(_0x9903('0x2'));var rp=require(_0x9903('0x3'));var moment=require('moment');var BPromise=require(_0x9903('0x4'));var Mustache=require(_0x9903('0x5'));var util=require(_0x9903('0x6'));var path=require(_0x9903('0x7'));var sox=require('sox');var csv=require(_0x9903('0x8'));var ejs=require(_0x9903('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9903('0xa'));var squel=require(_0x9903('0xb'));var crypto=require(_0x9903('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9903('0xd'));var toCsv=require(_0x9903('0x8'));var querystring=require(_0x9903('0xe'));var Papa=require(_0x9903('0xf'));var Redis=require(_0x9903('0x10'));var authService=require(_0x9903('0x11'));var qs=require(_0x9903('0x12'));var as=require(_0x9903('0x13'));var hardwareService=require(_0x9903('0x14'));var logger=require(_0x9903('0x15'))(_0x9903('0x16'));var utils=require(_0x9903('0x17'));var config=require(_0x9903('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc7ab20,_0x370295){_0x370295=_0x370295||0xcc;return function(_0x29c1d2){if(_0x29c1d2){return _0xc7ab20[_0x9903('0x19')](_0x370295);}return _0xc7ab20['status'](_0x370295)[_0x9903('0x1a')]();};}function respondWithResult(_0x502b6e,_0x432734){_0x432734=_0x432734||0xc8;return function(_0x13e050){if(_0x13e050){return _0x502b6e[_0x9903('0x1b')](_0x432734)[_0x9903('0x1c')](_0x13e050);}};}function respondWithFilteredResult(_0x17ef93,_0x4a2efd){return function(_0x587dc7){if(_0x587dc7){var _0x4ae266=typeof _0x4a2efd[_0x9903('0x1d')]===_0x9903('0x1e')&&typeof _0x4a2efd[_0x9903('0x1f')]===_0x9903('0x1e');var _0x17749d=_0x587dc7[_0x9903('0x20')];var _0x601194=_0x4ae266?0x0:_0x4a2efd[_0x9903('0x1d')];var _0x608b06=_0x4ae266?_0x587dc7[_0x9903('0x20')]:_0x4a2efd[_0x9903('0x1d')]+_0x4a2efd['limit'];var _0x35eb62;if(_0x608b06>=_0x17749d){_0x608b06=_0x17749d;_0x35eb62=0xc8;}else{_0x35eb62=0xce;}_0x17ef93[_0x9903('0x1b')](_0x35eb62);return _0x17ef93[_0x9903('0x21')](_0x9903('0x22'),_0x601194+'-'+_0x608b06+'/'+_0x17749d)[_0x9903('0x1c')](_0x587dc7);}return null;};}function patchUpdates(_0x229d14){return function(_0x70043e){try{jsonpatch['apply'](_0x70043e,_0x229d14,!![]);}catch(_0x38b75d){return BPromise[_0x9903('0x23')](_0x38b75d);}return _0x70043e[_0x9903('0x24')]();};}function saveUpdates(_0x3ee167,_0xfbe64e){return function(_0x43efe1){if(_0x43efe1){return _0x43efe1['update'](_0x3ee167)[_0x9903('0x25')](function(_0x15361b){return _0x15361b;});}return null;};}function removeEntity(_0x33dcb8,_0x2b68c1){return function(_0x299065){if(_0x299065){return _0x299065[_0x9903('0x26')]()[_0x9903('0x25')](function(){_0x33dcb8[_0x9903('0x1b')](0xcc)[_0x9903('0x1a')]();});}};}function handleEntityNotFound(_0x2ce28b,_0x1c8785){return function(_0x18dc7e){if(!_0x18dc7e){_0x2ce28b['sendStatus'](0x194);}return _0x18dc7e;};}function handleError(_0xd8f05c,_0x44b26d){_0x44b26d=_0x44b26d||0x1f4;return function(_0x4516ac){logger[_0x9903('0x27')](_0x4516ac[_0x9903('0x28')]);if(_0x4516ac[_0x9903('0x29')]){delete _0x4516ac[_0x9903('0x29')];}_0xd8f05c['status'](_0x44b26d)[_0x9903('0x2a')](_0x4516ac);};}exports['index']=function(_0x5e7c99,_0x146fce){var _0x3f0fa7={},_0x2e83ee={},_0x2a34fc={'count':0x0,'rows':[]};var _0x12640b=_[_0x9903('0x2b')](db[_0x9903('0x2c')]['rawAttributes'],function(_0x5626bb){return{'name':_0x5626bb['fieldName'],'type':_0x5626bb[_0x9903('0x2d')][_0x9903('0x2e')]};});_0x2e83ee['model']=_[_0x9903('0x2b')](_0x12640b,_0x9903('0x29'));_0x2e83ee[_0x9903('0x2f')]=_[_0x9903('0x30')](_0x5e7c99[_0x9903('0x2f')]);_0x2e83ee[_0x9903('0x31')]=_[_0x9903('0x32')](_0x2e83ee[_0x9903('0x33')],_0x2e83ee[_0x9903('0x2f')]);_0x3f0fa7[_0x9903('0x34')]=_[_0x9903('0x32')](_0x2e83ee['model'],qs[_0x9903('0x35')](_0x5e7c99[_0x9903('0x2f')][_0x9903('0x35')]));_0x3f0fa7[_0x9903('0x34')]=_0x3f0fa7[_0x9903('0x34')][_0x9903('0x36')]?_0x3f0fa7[_0x9903('0x34')]:_0x2e83ee['model'];if(!_0x5e7c99[_0x9903('0x2f')][_0x9903('0x37')]('nolimit')){_0x3f0fa7[_0x9903('0x1f')]=qs[_0x9903('0x1f')](_0x5e7c99[_0x9903('0x2f')][_0x9903('0x1f')]);_0x3f0fa7[_0x9903('0x1d')]=qs[_0x9903('0x1d')](_0x5e7c99[_0x9903('0x2f')][_0x9903('0x1d')]);}_0x3f0fa7[_0x9903('0x38')]=qs[_0x9903('0x39')](_0x5e7c99['query'][_0x9903('0x39')]);_0x3f0fa7[_0x9903('0x3a')]=qs[_0x9903('0x31')](_[_0x9903('0x3b')](_0x5e7c99['query'],_0x2e83ee[_0x9903('0x31')]),_0x12640b);if(_0x5e7c99[_0x9903('0x2f')][_0x9903('0x3c')]){_0x3f0fa7['where']=_['merge'](_0x3f0fa7[_0x9903('0x3a')],{'$or':_[_0x9903('0x2b')](_0x12640b,function(_0xbbb982){if(_0xbbb982['type']!==_0x9903('0x3d')){var _0x2bc493={};_0x2bc493[_0xbbb982['name']]={'$like':'%'+_0x5e7c99[_0x9903('0x2f')][_0x9903('0x3c')]+'%'};return _0x2bc493;}})});}_0x3f0fa7=_[_0x9903('0x3e')]({},_0x3f0fa7,_0x5e7c99['options']);var _0x14eaa5={'where':_0x3f0fa7[_0x9903('0x3a')]};return db[_0x9903('0x2c')][_0x9903('0x20')](_0x14eaa5)[_0x9903('0x25')](function(_0x13dc4f){_0x2a34fc[_0x9903('0x20')]=_0x13dc4f;if(_0x5e7c99[_0x9903('0x2f')][_0x9903('0x3f')]){_0x3f0fa7['include']=[{'all':!![]}];}return db[_0x9903('0x2c')]['findAll'](_0x3f0fa7);})[_0x9903('0x25')](function(_0x20e205){_0x2a34fc[_0x9903('0x40')]=_0x20e205;return _0x2a34fc;})[_0x9903('0x25')](respondWithFilteredResult(_0x146fce,_0x3f0fa7))[_0x9903('0x41')](handleError(_0x146fce,null));};exports[_0x9903('0x42')]=function(_0x1461ee,_0x510c04){var _0x2839fc={'raw':!![],'where':{'id':_0x1461ee[_0x9903('0x43')]['id']}},_0x533af5={};_0x533af5[_0x9903('0x33')]=_['keys'](db[_0x9903('0x2c')][_0x9903('0x44')]);_0x533af5['query']=_['keys'](_0x1461ee[_0x9903('0x2f')]);_0x533af5[_0x9903('0x31')]=_[_0x9903('0x32')](_0x533af5['model'],_0x533af5[_0x9903('0x2f')]);_0x2839fc[_0x9903('0x34')]=_[_0x9903('0x32')](_0x533af5['model'],qs[_0x9903('0x35')](_0x1461ee[_0x9903('0x2f')]['fields']));_0x2839fc[_0x9903('0x34')]=_0x2839fc[_0x9903('0x34')]['length']?_0x2839fc[_0x9903('0x34')]:_0x533af5[_0x9903('0x33')];if(_0x1461ee['query'][_0x9903('0x3f')]){_0x2839fc[_0x9903('0x45')]=[{'all':!![]}];}_0x2839fc=_[_0x9903('0x3e')]({},_0x2839fc,_0x1461ee[_0x9903('0x46')]);return db[_0x9903('0x2c')]['find'](_0x2839fc)[_0x9903('0x25')](handleEntityNotFound(_0x510c04,null))[_0x9903('0x25')](respondWithResult(_0x510c04,null))['catch'](handleError(_0x510c04,null));};exports[_0x9903('0x47')]=function(_0x435fc0,_0x1521a6){return db[_0x9903('0x2c')]['create'](_0x435fc0[_0x9903('0x48')],{})[_0x9903('0x25')](respondWithResult(_0x1521a6,0xc9))[_0x9903('0x41')](handleError(_0x1521a6,null));};exports[_0x9903('0x49')]=function(_0x2f9ca3,_0x190da3){if(_0x2f9ca3[_0x9903('0x48')]['id']){delete _0x2f9ca3[_0x9903('0x48')]['id'];}return db[_0x9903('0x2c')][_0x9903('0x4a')]({'where':{'id':_0x2f9ca3[_0x9903('0x43')]['id']}})['then'](handleEntityNotFound(_0x190da3,null))[_0x9903('0x25')](saveUpdates(_0x2f9ca3[_0x9903('0x48')],null))[_0x9903('0x25')](respondWithResult(_0x190da3,null))[_0x9903('0x41')](handleError(_0x190da3,null));};exports[_0x9903('0x26')]=function(_0x3ae3a6,_0x30bed9){return db['SalesforceField'][_0x9903('0x4a')]({'where':{'id':_0x3ae3a6[_0x9903('0x43')]['id']}})[_0x9903('0x25')](handleEntityNotFound(_0x30bed9,null))[_0x9903('0x25')](removeEntity(_0x30bed9,null))[_0x9903('0x41')](handleError(_0x30bed9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 416ad1f..7f5048a 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 _0xf312=['salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x5efae7,_0x9bdeac){var _0x32618f=function(_0xc052ec){while(--_0xc052ec){_0x5efae7['push'](_0x5efae7['shift']());}};_0x32618f(++_0x9bdeac);}(_0xf312,0x1cd));var _0x2f31=function(_0x2c4903,_0x286a98){_0x2c4903=_0x2c4903-0x0;var _0x218708=_0xf312[_0x2c4903];return _0x218708;};'use strict';var _=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var logger=require(_0x2f31('0x2'))(_0x2f31('0x3'));var moment=require(_0x2f31('0x4'));var BPromise=require(_0x2f31('0x5'));var rp=require(_0x2f31('0x6'));var fs=require('fs');var path=require(_0x2f31('0x7'));var rimraf=require(_0x2f31('0x8'));var config=require(_0x2f31('0x9'));var attributes=require(_0x2f31('0xa'));module[_0x2f31('0xb')]=function(_0x4e7645,_0x2d27f6){return _0x4e7645[_0x2f31('0xc')](_0x2f31('0xd'),attributes,{'tableName':_0x2f31('0xe'),'paranoid':![],'indexes':[{'name':_0x2f31('0xf'),'fields':['idField',_0x2f31('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7883=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes'];(function(_0xc6418d,_0x164edc){var _0x47034a=function(_0x2aea11){while(--_0x2aea11){_0xc6418d['push'](_0xc6418d['shift']());}};_0x47034a(++_0x164edc);}(_0x7883,0x1c5));var _0x3788=function(_0x26024d,_0xe5adc7){_0x26024d=_0x26024d-0x0;var _0x507641=_0x7883[_0x26024d];return _0x507641;};'use strict';var _=require('lodash');var util=require(_0x3788('0x0'));var logger=require(_0x3788('0x1'))(_0x3788('0x2'));var moment=require(_0x3788('0x3'));var BPromise=require(_0x3788('0x4'));var rp=require(_0x3788('0x5'));var fs=require('fs');var path=require(_0x3788('0x6'));var rimraf=require(_0x3788('0x7'));var config=require('../../config/environment');var attributes=require(_0x3788('0x8'));module['exports']=function(_0x3b4bd9,_0x25d022){return _0x3b4bd9[_0x3788('0x9')](_0x3788('0xa'),attributes,{'tableName':_0x3788('0xb'),'paranoid':![],'indexes':[{'name':_0x3788('0xc'),'fields':['idField',_0x3788('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4b1f21c..eb35ae0 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 _0x8f7e=['../../config/environment','client','http','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x8f7e,0x11f));var _0xe8f7=function(_0x318606,_0x26823b){_0x318606=_0x318606-0x0;var _0x5f47fd=_0x8f7e[_0x318606];return _0x5f47fd;};'use strict';var _=require(_0xe8f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe8f7('0x1'));var rs=require(_0xe8f7('0x2'));var fs=require('fs');var Redis=require(_0xe8f7('0x3'));var db=require(_0xe8f7('0x4'))['db'];var utils=require(_0xe8f7('0x5'));var logger=require('../../config/logger')(_0xe8f7('0x6'));var config=require(_0xe8f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe8f7('0x8')][_0xe8f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x500c69,_0x456e65,_0x1fd779){return new BPromise(function(_0x39b63e,_0x553318){return client['request'](_0x500c69,_0x1fd779)[_0xe8f7('0xa')](function(_0x2400bf){logger['info'](_0xe8f7('0xb'),_0x456e65,'request\x20sent');logger[_0xe8f7('0xc')](_0xe8f7('0xd'),_0x456e65,_0xe8f7('0xe'),JSON[_0xe8f7('0xf')](_0x2400bf));if(_0x2400bf[_0xe8f7('0x10')]){if(_0x2400bf[_0xe8f7('0x10')][_0xe8f7('0x11')]===0x1f4){logger[_0xe8f7('0x10')](_0xe8f7('0xb'),_0x456e65,_0x2400bf[_0xe8f7('0x10')][_0xe8f7('0x12')]);return _0x553318(_0x2400bf[_0xe8f7('0x10')][_0xe8f7('0x12')]);}logger[_0xe8f7('0x10')]('SalesforceField,\x20%s,\x20%s',_0x456e65,_0x2400bf[_0xe8f7('0x10')][_0xe8f7('0x12')]);return _0x39b63e(_0x2400bf[_0xe8f7('0x10')][_0xe8f7('0x12')]);}else{logger[_0xe8f7('0x13')](_0xe8f7('0xb'),_0x456e65,'request\x20sent');_0x39b63e(_0x2400bf['result']['message']);}})[_0xe8f7('0x14')](function(_0x1aa81c){logger[_0xe8f7('0x10')](_0xe8f7('0xb'),_0x456e65,_0x1aa81c);_0x553318(_0x1aa81c);});});} \ No newline at end of file +var _0xccf2=['SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x41eba9,_0x4bae0b){var _0x5b94f4=function(_0x9b12e6){while(--_0x9b12e6){_0x41eba9['push'](_0x41eba9['shift']());}};_0x5b94f4(++_0x4bae0b);}(_0xccf2,0x110));var _0x2ccf=function(_0x143de7,_0x115259){_0x143de7=_0x143de7-0x0;var _0x321bf9=_0xccf2[_0x143de7];return _0x321bf9;};'use strict';var _=require(_0x2ccf('0x0'));var util=require('util');var moment=require(_0x2ccf('0x1'));var BPromise=require(_0x2ccf('0x2'));var rs=require(_0x2ccf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2ccf('0x4'));var logger=require(_0x2ccf('0x5'))(_0x2ccf('0x6'));var config=require(_0x2ccf('0x7'));var jayson=require(_0x2ccf('0x8'));var client=jayson[_0x2ccf('0x9')][_0x2ccf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d20c5,_0x1c45d7,_0x3b1770){return new BPromise(function(_0x5e32d7,_0x2b3045){return client[_0x2ccf('0xb')](_0x2d20c5,_0x3b1770)['then'](function(_0x4ff03b){logger[_0x2ccf('0xc')](_0x2ccf('0xd'),_0x1c45d7,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1c45d7,_0x2ccf('0xe'),JSON[_0x2ccf('0xf')](_0x4ff03b));if(_0x4ff03b[_0x2ccf('0x10')]){if(_0x4ff03b[_0x2ccf('0x10')][_0x2ccf('0x11')]===0x1f4){logger['error'](_0x2ccf('0xd'),_0x1c45d7,_0x4ff03b[_0x2ccf('0x10')][_0x2ccf('0x12')]);return _0x2b3045(_0x4ff03b[_0x2ccf('0x10')][_0x2ccf('0x12')]);}logger[_0x2ccf('0x10')](_0x2ccf('0xd'),_0x1c45d7,_0x4ff03b[_0x2ccf('0x10')][_0x2ccf('0x12')]);return _0x5e32d7(_0x4ff03b[_0x2ccf('0x10')][_0x2ccf('0x12')]);}else{logger[_0x2ccf('0xc')](_0x2ccf('0xd'),_0x1c45d7,'request\x20sent');_0x5e32d7(_0x4ff03b['result'][_0x2ccf('0x12')]);}})['catch'](function(_0x6b8970){logger[_0x2ccf('0x10')](_0x2ccf('0xd'),_0x1c45d7,_0x6b8970);_0x2b3045(_0x6b8970);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e6e970f..40e8400 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 _0x933b=['put','/:id','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','post','create','addConfiguration'];(function(_0x263448,_0x5475bb){var _0x469f16=function(_0x51322a){while(--_0x51322a){_0x263448['push'](_0x263448['shift']());}};_0x469f16(++_0x5475bb);}(_0x933b,0x16e));var _0xb933=function(_0x94aab,_0x52c70f){_0x94aab=_0x94aab-0x0;var _0x426623=_0x933b[_0x94aab];return _0x426623;};'use strict';var multer=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb933('0x2'));var router=express[_0xb933('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb933('0x4'));var interaction=require(_0xb933('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xb933('0x6')]('/',auth[_0xb933('0x7')](),controller[_0xb933('0x8')]);router[_0xb933('0x6')]('/:id',auth[_0xb933('0x7')](),controller[_0xb933('0x9')]);router[_0xb933('0x6')](_0xb933('0xa'),auth[_0xb933('0x7')](),controller['getConfigurations']);router[_0xb933('0x6')]('/:id/fields',auth[_0xb933('0x7')](),controller['getFields']);router[_0xb933('0xb')]('/',auth[_0xb933('0x7')](),controller[_0xb933('0xc')]);router[_0xb933('0xb')](_0xb933('0xa'),auth[_0xb933('0x7')](),controller[_0xb933('0xd')]);router[_0xb933('0xe')](_0xb933('0xf'),auth[_0xb933('0x7')](),controller[_0xb933('0x10')]);router['delete'](_0xb933('0xf'),auth[_0xb933('0x7')](),controller[_0xb933('0x11')]);module[_0xb933('0x12')]=router; \ No newline at end of file +var _0x7ec2=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x27e613,_0x56c6c3){var _0x53c003=function(_0x40ad69){while(--_0x40ad69){_0x27e613['push'](_0x27e613['shift']());}};_0x53c003(++_0x56c6c3);}(_0x7ec2,0x15c));var _0x27ec=function(_0x4b67c5,_0x227645){_0x4b67c5=_0x4b67c5-0x0;var _0x41f00d=_0x7ec2[_0x4b67c5];return _0x41f00d;};'use strict';var multer=require(_0x27ec('0x0'));var util=require(_0x27ec('0x1'));var path=require(_0x27ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x27ec('0x3'));var router=express[_0x27ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27ec('0x5'));var interaction=require(_0x27ec('0x6'));var config=require(_0x27ec('0x7'));var controller=require(_0x27ec('0x8'));router[_0x27ec('0x9')]('/',auth[_0x27ec('0xa')](),controller[_0x27ec('0xb')]);router[_0x27ec('0x9')](_0x27ec('0xc'),auth[_0x27ec('0xa')](),controller[_0x27ec('0xd')]);router[_0x27ec('0x9')](_0x27ec('0xe'),auth[_0x27ec('0xa')](),controller[_0x27ec('0xf')]);router[_0x27ec('0x9')](_0x27ec('0x10'),auth[_0x27ec('0xa')](),controller[_0x27ec('0x11')]);router[_0x27ec('0x12')]('/',auth[_0x27ec('0xa')](),controller['create']);router[_0x27ec('0x12')](_0x27ec('0xe'),auth[_0x27ec('0xa')](),controller[_0x27ec('0x13')]);router['put'](_0x27ec('0xc'),auth['isAuthenticated'](),controller[_0x27ec('0x14')]);router[_0x27ec('0x15')](_0x27ec('0xc'),auth[_0x27ec('0xa')](),controller[_0x27ec('0x16')]);module[_0x27ec('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cda6ee6..4355940 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 _0xebd2=['sequelize','exports','STRING','username','remoteUri'];(function(_0x176ea9,_0x515b59){var _0x490b58=function(_0x2079c0){while(--_0x2079c0){_0x176ea9['push'](_0x176ea9['shift']());}};_0x490b58(++_0x515b59);}(_0xebd2,0x1d6));var _0x2ebd=function(_0x17e8ff,_0x3f599f){_0x17e8ff=_0x17e8ff-0x0;var _0x328d41=_0xebd2[_0x17e8ff];return _0x328d41;};'use strict';var Sequelize=require(_0x2ebd('0x0'));module[_0x2ebd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2ebd('0x2')]},'username':{'type':Sequelize[_0x2ebd('0x2')],'unique':_0x2ebd('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2ebd('0x2')],'unique':_0x2ebd('0x4')},'serverUrl':{'type':Sequelize[_0x2ebd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb9c7=['sequelize','exports','STRING','remoteUri'];(function(_0x4c845f,_0x243388){var _0x4c83f7=function(_0x4b2e34){while(--_0x4b2e34){_0x4c845f['push'](_0x4c845f['shift']());}};_0x4c83f7(++_0x243388);}(_0xb9c7,0x150));var _0x7b9c=function(_0x571fad,_0xa41ecb){_0x571fad=_0x571fad-0x0;var _0x45fa03=_0xb9c7[_0x571fad];return _0x45fa03;};'use strict';var Sequelize=require(_0x7b9c('0x0'));module[_0x7b9c('0x1')]={'name':{'type':Sequelize[_0x7b9c('0x2')]},'description':{'type':Sequelize[_0x7b9c('0x2')]},'username':{'type':Sequelize[_0x7b9c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x7b9c('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7b9c('0x3')},'serverUrl':{'type':Sequelize[_0x7b9c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c6a6734..82e1c28 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 _0xab3f=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','getConfigurations','findOne','ServicenowConfiguration','sort','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','hold_reason','subcategory','notify','incident_state','severity','category','parent','made_sla','upon_reject','sys_updated_on','child_incidents','opened_by','user_input','sys_created_on','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','reopened_by','urgency','problem_id','company','activity_due','assigned_to','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','internalType','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','all','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','forEach','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x47d028,_0x4d01c9){var _0x289e0c=function(_0x520547){while(--_0x520547){_0x47d028['push'](_0x47d028['shift']());}};_0x289e0c(++_0x4d01c9);}(_0xab3f,0xa4));var _0xfab3=function(_0x4a8f02,_0x525499){_0x4a8f02=_0x4a8f02-0x0;var _0x1c858a=_0xab3f[_0x4a8f02];return _0x1c858a;};'use strict';var emlformat=require(_0xfab3('0x0'));var rimraf=require(_0xfab3('0x1'));var zipdir=require(_0xfab3('0x2'));var jsonpatch=require(_0xfab3('0x3'));var rp=require(_0xfab3('0x4'));var moment=require('moment');var BPromise=require(_0xfab3('0x5'));var Mustache=require(_0xfab3('0x6'));var util=require(_0xfab3('0x7'));var path=require(_0xfab3('0x8'));var sox=require(_0xfab3('0x9'));var csv=require(_0xfab3('0xa'));var ejs=require(_0xfab3('0xb'));var fs=require('fs');var fs_extra=require(_0xfab3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfab3('0xd'));var jsforce=require(_0xfab3('0xe'));var deskjs=require(_0xfab3('0xf'));var toCsv=require(_0xfab3('0xa'));var querystring=require(_0xfab3('0x10'));var Papa=require(_0xfab3('0x11'));var Redis=require('ioredis');var authService=require(_0xfab3('0x12'));var qs=require(_0xfab3('0x13'));var as=require(_0xfab3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfab3('0x15'))('api');var utils=require(_0xfab3('0x16'));var config=require(_0xfab3('0x17'));var licenseUtil=require(_0xfab3('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c8d6e,_0x3d95c3){_0x3d95c3=_0x3d95c3||0xcc;return function(_0x3dfadf){if(_0x3dfadf){return _0x2c8d6e[_0xfab3('0x19')](_0x3d95c3);}return _0x2c8d6e[_0xfab3('0x1a')](_0x3d95c3)[_0xfab3('0x1b')]();};}function respondWithResult(_0x2a0ad4,_0x55c01d){_0x55c01d=_0x55c01d||0xc8;return function(_0x149bd2){if(_0x149bd2){return _0x2a0ad4['status'](_0x55c01d)[_0xfab3('0x1c')](_0x149bd2);}};}function respondWithFilteredResult(_0x284df7,_0x5bdc43){return function(_0x4c3c2a){if(_0x4c3c2a){var _0x493c23=typeof _0x5bdc43['offset']===_0xfab3('0x1d')&&typeof _0x5bdc43['limit']===_0xfab3('0x1d');var _0x6415e1=_0x4c3c2a[_0xfab3('0x1e')];var _0x527537=_0x493c23?0x0:_0x5bdc43[_0xfab3('0x1f')];var _0x5c9927=_0x493c23?_0x4c3c2a[_0xfab3('0x1e')]:_0x5bdc43[_0xfab3('0x1f')]+_0x5bdc43['limit'];var _0x546de0;if(_0x5c9927>=_0x6415e1){_0x5c9927=_0x6415e1;_0x546de0=0xc8;}else{_0x546de0=0xce;}_0x284df7[_0xfab3('0x1a')](_0x546de0);return _0x284df7[_0xfab3('0x20')]('Content-Range',_0x527537+'-'+_0x5c9927+'/'+_0x6415e1)['json'](_0x4c3c2a);}return null;};}function patchUpdates(_0x442e60){return function(_0x1ec90f){try{jsonpatch[_0xfab3('0x21')](_0x1ec90f,_0x442e60,!![]);}catch(_0x575e26){return BPromise[_0xfab3('0x22')](_0x575e26);}return _0x1ec90f[_0xfab3('0x23')]();};}function saveUpdates(_0x196bad,_0x34a0db){return function(_0x5b2a4d){if(_0x5b2a4d){return _0x5b2a4d[_0xfab3('0x24')](_0x196bad)[_0xfab3('0x25')](function(_0x21c104){return _0x21c104;});}return null;};}function removeEntity(_0x4a5220,_0x3ab877){return function(_0x1914a0){if(_0x1914a0){return _0x1914a0['destroy']()['then'](function(){_0x4a5220['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b890a,_0x27562d){return function(_0x156a44){if(!_0x156a44){_0x4b890a[_0xfab3('0x19')](0x194);}return _0x156a44;};}function handleError(_0x253de6,_0x5ea37b){_0x5ea37b=_0x5ea37b||0x1f4;return function(_0x3aca90){logger[_0xfab3('0x26')](_0x3aca90[_0xfab3('0x27')]);if(_0x3aca90[_0xfab3('0x28')]){delete _0x3aca90[_0xfab3('0x28')];}_0x253de6[_0xfab3('0x1a')](_0x5ea37b)[_0xfab3('0x29')](_0x3aca90);};}exports[_0xfab3('0x2a')]=function(_0x557df2,_0x3fc401){var _0x5e0076={},_0x121177={},_0x344ddb={'count':0x0,'rows':[]};var _0x1dbe0b=_[_0xfab3('0x2b')](db[_0xfab3('0x2c')][_0xfab3('0x2d')],function(_0x2da863){return{'name':_0x2da863[_0xfab3('0x2e')],'type':_0x2da863[_0xfab3('0x2f')][_0xfab3('0x30')]};});_0x121177[_0xfab3('0x31')]=_[_0xfab3('0x2b')](_0x1dbe0b,_0xfab3('0x28'));_0x121177['query']=_[_0xfab3('0x32')](_0x557df2[_0xfab3('0x33')]);_0x121177['filters']=_[_0xfab3('0x34')](_0x121177['model'],_0x121177[_0xfab3('0x33')]);_0x5e0076[_0xfab3('0x35')]=_['intersection'](_0x121177[_0xfab3('0x31')],qs[_0xfab3('0x36')](_0x557df2['query'][_0xfab3('0x36')]));_0x5e0076[_0xfab3('0x35')]=_0x5e0076[_0xfab3('0x35')][_0xfab3('0x37')]?_0x5e0076[_0xfab3('0x35')]:_0x121177[_0xfab3('0x31')];if(!_0x557df2[_0xfab3('0x33')][_0xfab3('0x38')](_0xfab3('0x39'))){_0x5e0076[_0xfab3('0x3a')]=qs['limit'](_0x557df2[_0xfab3('0x33')][_0xfab3('0x3a')]);_0x5e0076[_0xfab3('0x1f')]=qs[_0xfab3('0x1f')](_0x557df2[_0xfab3('0x33')]['offset']);}_0x5e0076[_0xfab3('0x3b')]=qs['sort'](_0x557df2[_0xfab3('0x33')]['sort']);_0x5e0076[_0xfab3('0x3c')]=qs[_0xfab3('0x3d')](_[_0xfab3('0x3e')](_0x557df2[_0xfab3('0x33')],_0x121177[_0xfab3('0x3d')]),_0x1dbe0b);if(_0x557df2['query'][_0xfab3('0x3f')]){_0x5e0076[_0xfab3('0x3c')]=_[_0xfab3('0x40')](_0x5e0076[_0xfab3('0x3c')],{'$or':_[_0xfab3('0x2b')](_0x1dbe0b,function(_0x320f7a){if(_0x320f7a[_0xfab3('0x2f')]!=='VIRTUAL'){var _0x4e9eee={};_0x4e9eee[_0x320f7a[_0xfab3('0x28')]]={'$like':'%'+_0x557df2['query'][_0xfab3('0x3f')]+'%'};return _0x4e9eee;}})});}_0x5e0076=_[_0xfab3('0x40')]({},_0x5e0076,_0x557df2[_0xfab3('0x41')]);var _0x321926={'where':_0x5e0076[_0xfab3('0x3c')]};return db[_0xfab3('0x2c')][_0xfab3('0x1e')](_0x321926)['then'](function(_0x5ec2e9){_0x344ddb[_0xfab3('0x1e')]=_0x5ec2e9;if(_0x557df2[_0xfab3('0x33')][_0xfab3('0x42')]){_0x5e0076[_0xfab3('0x43')]=[{'all':!![]}];}return db[_0xfab3('0x2c')][_0xfab3('0x44')](_0x5e0076);})[_0xfab3('0x25')](function(_0x2bdc59){_0x344ddb[_0xfab3('0x45')]=_0x2bdc59;return _0x344ddb;})[_0xfab3('0x25')](respondWithFilteredResult(_0x3fc401,_0x5e0076))['catch'](handleError(_0x3fc401,null));};exports[_0xfab3('0x46')]=function(_0x4ee942,_0x1cf616){var _0x318959={'raw':![],'where':{'id':_0x4ee942[_0xfab3('0x47')]['id']}},_0x89f624={};_0x89f624[_0xfab3('0x31')]=_[_0xfab3('0x32')](db['ServicenowAccount'][_0xfab3('0x2d')]);_0x89f624[_0xfab3('0x33')]=_[_0xfab3('0x32')](_0x4ee942[_0xfab3('0x33')]);_0x89f624[_0xfab3('0x3d')]=_[_0xfab3('0x34')](_0x89f624[_0xfab3('0x31')],_0x89f624[_0xfab3('0x33')]);_0x318959[_0xfab3('0x35')]=_[_0xfab3('0x34')](_0x89f624[_0xfab3('0x31')],qs[_0xfab3('0x36')](_0x4ee942[_0xfab3('0x33')]['fields']));_0x318959[_0xfab3('0x35')]=_0x318959[_0xfab3('0x35')][_0xfab3('0x37')]?_0x318959['attributes']:_0x89f624[_0xfab3('0x31')];if(_0x4ee942[_0xfab3('0x33')][_0xfab3('0x42')]){_0x318959[_0xfab3('0x43')]=[{'all':!![]}];}_0x318959=_['merge']({},_0x318959,_0x4ee942['options']);return db[_0xfab3('0x2c')][_0xfab3('0x48')](_0x318959)[_0xfab3('0x25')](handleEntityNotFound(_0x1cf616,null))[_0xfab3('0x25')](respondWithResult(_0x1cf616,null))['catch'](handleError(_0x1cf616,null));};exports[_0xfab3('0x49')]=function(_0x34beba,_0x480776){return db[_0xfab3('0x2c')][_0xfab3('0x49')](_0x34beba[_0xfab3('0x4a')],{})[_0xfab3('0x25')](respondWithResult(_0x480776,0xc9))[_0xfab3('0x4b')](handleError(_0x480776,null));};exports[_0xfab3('0x24')]=function(_0x187091,_0x18a55f){if(_0x187091[_0xfab3('0x4a')]['id']){delete _0x187091[_0xfab3('0x4a')]['id'];}return db['ServicenowAccount'][_0xfab3('0x48')]({'where':{'id':_0x187091[_0xfab3('0x47')]['id']}})[_0xfab3('0x25')](handleEntityNotFound(_0x18a55f,null))['then'](saveUpdates(_0x187091['body'],null))[_0xfab3('0x25')](respondWithResult(_0x18a55f,null))[_0xfab3('0x4b')](handleError(_0x18a55f,null));};exports[_0xfab3('0x4c')]=function(_0x1183c8,_0x3fe325){return db[_0xfab3('0x2c')]['find']({'where':{'id':_0x1183c8[_0xfab3('0x47')]['id']}})[_0xfab3('0x25')](handleEntityNotFound(_0x3fe325,null))[_0xfab3('0x25')](removeEntity(_0x3fe325,null))[_0xfab3('0x4b')](handleError(_0x3fe325,null));};exports[_0xfab3('0x4d')]=function(_0x247f6f,_0x4850d0,_0xea3c90){var _0xa731a={};var _0x116a38={};var _0x5dc6f5;var _0x1c4397;return db[_0xfab3('0x2c')][_0xfab3('0x4e')]({'where':{'id':_0x247f6f[_0xfab3('0x47')]['id']}})[_0xfab3('0x25')](handleEntityNotFound(_0x4850d0,null))['then'](function(_0x3bc7c0){if(_0x3bc7c0){_0x5dc6f5=_0x3bc7c0;_0x116a38[_0xfab3('0x31')]=_['keys'](db[_0xfab3('0x4f')][_0xfab3('0x2d')]);_0x116a38[_0xfab3('0x33')]=_[_0xfab3('0x32')](_0x247f6f['query']);_0x116a38[_0xfab3('0x3d')]=_[_0xfab3('0x34')](_0x116a38[_0xfab3('0x31')],_0x116a38[_0xfab3('0x33')]);_0xa731a[_0xfab3('0x35')]=_[_0xfab3('0x34')](_0x116a38[_0xfab3('0x31')],qs[_0xfab3('0x36')](_0x247f6f[_0xfab3('0x33')][_0xfab3('0x36')]));_0xa731a[_0xfab3('0x35')]=_0xa731a[_0xfab3('0x35')][_0xfab3('0x37')]?_0xa731a['attributes']:_0x116a38[_0xfab3('0x31')];_0xa731a[_0xfab3('0x3b')]=qs[_0xfab3('0x50')](_0x247f6f[_0xfab3('0x33')][_0xfab3('0x50')]);_0xa731a[_0xfab3('0x3c')]=qs[_0xfab3('0x3d')](_[_0xfab3('0x3e')](_0x247f6f[_0xfab3('0x33')],_0x116a38['filters']));if(_0x247f6f[_0xfab3('0x33')][_0xfab3('0x3f')]){_0xa731a[_0xfab3('0x3c')]=_[_0xfab3('0x40')](_0xa731a[_0xfab3('0x3c')],{'$or':_['map'](_0xa731a[_0xfab3('0x35')],function(_0x428c13){var _0x4c3d3a={};_0x4c3d3a[_0x428c13]={'$like':'%'+_0x247f6f[_0xfab3('0x33')][_0xfab3('0x3f')]+'%'};return _0x4c3d3a;})});}_0xa731a=_[_0xfab3('0x40')]({},_0xa731a,_0x247f6f['options']);return _0x5dc6f5['getConfigurations'](_0xa731a);}})[_0xfab3('0x25')](function(_0x298160){if(_0x298160){_0x1c4397=_0x298160['length'];if(!_0x247f6f['query']['hasOwnProperty'](_0xfab3('0x39'))){_0xa731a[_0xfab3('0x3a')]=qs[_0xfab3('0x3a')](_0x247f6f[_0xfab3('0x33')][_0xfab3('0x3a')]);_0xa731a[_0xfab3('0x1f')]=qs['offset'](_0x247f6f['query'][_0xfab3('0x1f')]);}return _0x5dc6f5[_0xfab3('0x4d')](_0xa731a);}})[_0xfab3('0x25')](function(_0x32fa99){if(_0x32fa99){return _0x32fa99?{'count':_0x1c4397,'rows':_0x32fa99}:null;}})[_0xfab3('0x25')](respondWithResult(_0x4850d0,null))[_0xfab3('0x4b')](handleError(_0x4850d0,null));};exports['addConfiguration']=function(_0x147476,_0x3724b1,_0x38b947){if(_0x147476['body']['id']){delete _0x147476['body']['id'];}return db[_0xfab3('0x2c')][_0xfab3('0x4e')]({'where':{'id':_0x147476[_0xfab3('0x47')]['id']}})[_0xfab3('0x25')](handleEntityNotFound(_0x3724b1,null))[_0xfab3('0x25')](function(_0x462b96){if(_0x462b96){_0x147476[_0xfab3('0x4a')]['AccountId']=_0x462b96['id'];_0x147476[_0xfab3('0x4a')]['Subjects']=integrations['getSubjects'](_0x147476['body']['channel'],_0x147476[_0xfab3('0x4a')]['type']);_0x147476['body'][_0xfab3('0x51')]=integrations[_0xfab3('0x52')](_0x147476[_0xfab3('0x4a')][_0xfab3('0x53')],_0x147476[_0xfab3('0x4a')][_0xfab3('0x2f')]);return db[_0xfab3('0x4f')][_0xfab3('0x49')](_0x147476[_0xfab3('0x4a')],{'include':[{'model':db[_0xfab3('0x54')],'as':_0xfab3('0x55')},{'model':db[_0xfab3('0x54')],'as':'Descriptions'}]});}return null;})[_0xfab3('0x25')](respondWithResult(_0x3724b1,null))[_0xfab3('0x4b')](handleError(_0x3724b1,null));};exports[_0xfab3('0x56')]=function(_0xfebf8e,_0x205f9f,_0xa0b4c7){var _0x4eca21=['made_sla',_0xfab3('0x57'),'knowledge',_0xfab3('0x58'),'close_code',_0xfab3('0x59'),_0xfab3('0x5a'),_0xfab3('0x5b'),_0xfab3('0x5c')];var _0x344a31=[_0xfab3('0x5d'),_0xfab3('0x5e'),'caused_by','watch_list',_0xfab3('0x5f'),_0xfab3('0x60'),_0xfab3('0x61'),_0xfab3('0x57'),'approval_history','number','resolved_by','sys_updated_by',_0xfab3('0x62'),_0xfab3('0x63'),_0xfab3('0x64'),'sys_domain','state',_0xfab3('0x65'),_0xfab3('0x66'),_0xfab3('0x3b'),_0xfab3('0x67'),_0xfab3('0x68'),'cmdb_ci',_0xfab3('0x69'),_0xfab3('0x6a'),_0xfab3('0x6b'),'work_notes_list','business_service',_0xfab3('0x6c'),'sys_domain_path',_0xfab3('0x6d'),_0xfab3('0x6e'),_0xfab3('0x6f'),'opened_at',_0xfab3('0x70'),_0xfab3('0x71'),_0xfab3('0x72'),_0xfab3('0x73'),_0xfab3('0x74'),_0xfab3('0x75'),_0xfab3('0x76'),_0xfab3('0x58'),_0xfab3('0x77'),_0xfab3('0x78'),'close_code',_0xfab3('0x79'),_0xfab3('0x7a'),_0xfab3('0x7b'),_0xfab3('0x7c'),_0xfab3('0x7d'),'additional_assignee_list','description',_0xfab3('0x7e'),_0xfab3('0x59'),_0xfab3('0x7f'),_0xfab3('0x80'),_0xfab3('0x81'),'follow_up',_0xfab3('0x82'),'sys_id','contact_type',_0xfab3('0x83'),'incident_state',_0xfab3('0x84'),_0xfab3('0x85'),_0xfab3('0x86'),'reassignment_count',_0xfab3('0x87'),_0xfab3('0x88'),_0xfab3('0x5b'),'comments','sla_due','approval','comments_and_work_notes','due_date',_0xfab3('0x89'),_0xfab3('0x8a'),_0xfab3('0x8b'),_0xfab3('0x8c'),_0xfab3('0x8d'),_0xfab3('0x8e'),_0xfab3('0x8f'),_0xfab3('0x5c')];var _0x3ed656='';var _0x155163='';var _0x510f89=[];var _0x179c8a='';var _0x5bb06d='';var _0x5aac78=[];var _0x22576d='';var _0x4e138b='';var _0x5cee29={};var _0x47c97e='';return db[_0xfab3('0x2c')][_0xfab3('0x4e')]({'where':{'id':_0xfebf8e[_0xfab3('0x47')]['id']},'attributes':['id',_0xfab3('0x90'),_0xfab3('0x91'),_0xfab3('0x92'),'remoteUri',_0xfab3('0x93')]})[_0xfab3('0x25')](handleEntityNotFound(_0x205f9f,null))[_0xfab3('0x25')](function(_0x56833b){if(_0x56833b){_0x47c97e=_0x56833b[_0xfab3('0x94')];var _0x2249d9=_0x47c97e[_0xfab3('0x95')](-0x1);if(_0x2249d9==='/'){_0x47c97e=_0x47c97e['substring'](0x0,_0x47c97e[_0xfab3('0x96')](_0x2249d9));}_0x4e138b=util[_0xfab3('0x97')]('%s/api/now/doc/table/schema/',_0x47c97e);_0x22576d=util[_0xfab3('0x97')](_0xfab3('0x98'),_0x47c97e);_0x5cee29={'user':_0x56833b[_0xfab3('0x90')],'pass':_0x56833b[_0xfab3('0x91')]};var _0x54e7ef={'method':_0xfab3('0x99'),'uri':_0x4e138b+_0xfab3('0x9a'),'auth':_0x5cee29,'json':!![]};return rp(_0x54e7ef);}})[_0xfab3('0x25')](function(_0x37d116){if(_0x37d116[_0xfab3('0x9b')][_0xfab3('0x37')]>0x0){_0x3ed656=_0x37d116['result'];}console[_0xfab3('0x9c')]('incident\x20table\x20objects',_0x3ed656);_0x5aac78=[];_0x155163=Object[_0xfab3('0x9d')]([],_0x3ed656);_[_0xfab3('0x9e')](_0x155163,function(_0xaa1a69){return!_0x4eca21[_0xfab3('0x9f')](_0xaa1a69[_0xfab3('0x28')]);});_0x155163['forEach'](function(_0x375a34){var _0x173d8f=createFieldObject(_0x22576d,_0x5cee29,_0x375a34[_0xfab3('0xa0')],_0x375a34[_0xfab3('0x28')],_0x375a34['label'],![]);_0x5aac78[_0xfab3('0xa1')](_0x173d8f);});return Promise['all'](_0x5aac78);})[_0xfab3('0x25')](function(_0x2e3c6a){_0x510f89=_0x2e3c6a;_0x179c8a=Object[_0xfab3('0x9d')]([],_0x3ed656);console[_0xfab3('0x9c')]('TCL:\x20_object',_0x3ed656);_[_0xfab3('0x9e')](_0x179c8a,function(_0x275484){return _0x344a31[_0xfab3('0x9f')](_0x275484['name']);});console[_0xfab3('0x9c')](_0xfab3('0xa2'),_0x179c8a);_0x5aac78=[];_0x179c8a['forEach'](function(_0x46c559){var _0x254b19=createFieldObject(_0x22576d,_0x5cee29,_0x46c559['internalType'],_0x46c559[_0xfab3('0x28')],_0x46c559[_0xfab3('0xa3')],!![]);_0x5aac78[_0xfab3('0xa1')](_0x254b19);});return Promise[_0xfab3('0xa4')](_0x5aac78);})[_0xfab3('0x25')](function(_0x610e45){_0x5bb06d=_0x610e45;var _0x1834a1=_0x510f89['concat'](_0x5bb06d);return{'count':_0x1834a1['length'],'rows':_0x1834a1};})[_0xfab3('0x25')](respondWithResult(_0x205f9f,null))[_0xfab3('0x4b')](function(_0x3e5bc0){console[_0xfab3('0x9c')](_0xfab3('0xa5')+_0x3e5bc0);var _0x423a9f=_0xfebf8e[_0xfab3('0x33')]['test']?0x1f4:_0x3e5bc0['statusCode']||0x1f4;logger[_0xfab3('0x26')](_0x3e5bc0[_0xfab3('0x27')]);delete _0x3e5bc0[_0xfab3('0x28')];if(_0x423a9f===0x191){_0x423a9f=0x190;}_0x205f9f['status'](_0x423a9f)[_0xfab3('0x29')](_0xfebf8e['query'][_0xfab3('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x3e5bc0[_0xfab3('0xa7')]}:_0x3e5bc0);});};function createFieldObject(_0x103d40,_0x3d920c,_0xe7b9e3,_0xc2b37f,_0x3e3183,_0x140379){return new Promise(function(_0x3a3908,_0x47fc7e){var _0x2bf91c={'id':_0xc2b37f,'name':_0x3e3183,'custom':_0x140379};if(_0xe7b9e3===_0xfab3('0xa8')){_0x2bf91c[_0xfab3('0x41')]=[{'name':_0xfab3('0xa9'),'value':_0xfab3('0xaa')},{'name':_0xfab3('0xab'),'value':_0xfab3('0xac')}];_0x3a3908(_0x2bf91c);}else{var _0x35c69a={'method':_0xfab3('0x99'),'uri':_0x103d40+_0xfab3('0xad')+_0xc2b37f,'auth':_0x3d920c,'json':!![]};return rp(_0x35c69a)[_0xfab3('0x25')](function(_0x92be02){var _0x5d74ba=[];if(_0x92be02[_0xfab3('0x9b')][_0xfab3('0x37')]>0x0){_0x92be02[_0xfab3('0x9b')][_0xfab3('0xae')](function(_0x4785ce){if(_0x4785ce['inactive']===_0xfab3('0xac')){var _0x2a0a68={'name':_0x4785ce[_0xfab3('0xa3')],'value':_0x4785ce[_0xfab3('0xaf')]};_0x5d74ba[_0xfab3('0xa1')](_0x2a0a68);}});}_0x2bf91c[_0xfab3('0x41')]=_0x5d74ba;if(_0x2bf91c[_0xfab3('0x41')][_0xfab3('0x37')]>0x0){_0x3a3908(_0x2bf91c);}else{if(_0x140379==![]){_0x3a3908();}else{_0x3a3908(_0x2bf91c);}}});}});} \ No newline at end of file +var _0x862f=['sys_id','contact_type','reopened_by','problem_id','company','assigned_to','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','username','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','forEach','internalType','label','all','log','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','length','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','False','false','GET','result','value','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ServicenowAccount','fieldName','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','getConfigurations','findOne','options','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','severity','category','parent','caused_by','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','active','business_service','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x862f,0x19a));var _0xf862=function(_0x523eaf,_0x487fc6){_0x523eaf=_0x523eaf-0x0;var _0x319ba0=_0x862f[_0x523eaf];return _0x319ba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf862('0x0'));var zipdir=require(_0xf862('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf862('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf862('0x3'));var util=require(_0xf862('0x4'));var path=require(_0xf862('0x5'));var sox=require('sox');var csv=require(_0xf862('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf862('0x7'));var _=require(_0xf862('0x8'));var squel=require(_0xf862('0x9'));var crypto=require(_0xf862('0xa'));var jsforce=require(_0xf862('0xb'));var deskjs=require(_0xf862('0xc'));var toCsv=require(_0xf862('0x6'));var querystring=require(_0xf862('0xd'));var Papa=require(_0xf862('0xe'));var Redis=require(_0xf862('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf862('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf862('0x11'))(_0xf862('0x12'));var utils=require(_0xf862('0x13'));var config=require(_0xf862('0x14'));var licenseUtil=require(_0xf862('0x15'));var db=require(_0xf862('0x16'))['db'];var integrations=require(_0xf862('0x17'));function respondWithStatusCode(_0x1c3dc3,_0x36f794){_0x36f794=_0x36f794||0xcc;return function(_0x4033e4){if(_0x4033e4){return _0x1c3dc3['sendStatus'](_0x36f794);}return _0x1c3dc3[_0xf862('0x18')](_0x36f794)[_0xf862('0x19')]();};}function respondWithResult(_0x3a1b32,_0x199901){_0x199901=_0x199901||0xc8;return function(_0x35ed0c){if(_0x35ed0c){return _0x3a1b32['status'](_0x199901)[_0xf862('0x1a')](_0x35ed0c);}};}function respondWithFilteredResult(_0x2de86a,_0x1f4cfc){return function(_0x2f9dbd){if(_0x2f9dbd){var _0x466802=typeof _0x1f4cfc[_0xf862('0x1b')]===_0xf862('0x1c')&&typeof _0x1f4cfc[_0xf862('0x1d')]===_0xf862('0x1c');var _0x203d68=_0x2f9dbd[_0xf862('0x1e')];var _0x2315ca=_0x466802?0x0:_0x1f4cfc[_0xf862('0x1b')];var _0x14ffc2=_0x466802?_0x2f9dbd[_0xf862('0x1e')]:_0x1f4cfc[_0xf862('0x1b')]+_0x1f4cfc[_0xf862('0x1d')];var _0x32ee40;if(_0x14ffc2>=_0x203d68){_0x14ffc2=_0x203d68;_0x32ee40=0xc8;}else{_0x32ee40=0xce;}_0x2de86a[_0xf862('0x18')](_0x32ee40);return _0x2de86a[_0xf862('0x1f')](_0xf862('0x20'),_0x2315ca+'-'+_0x14ffc2+'/'+_0x203d68)['json'](_0x2f9dbd);}return null;};}function patchUpdates(_0x22ae13){return function(_0x56de78){try{jsonpatch[_0xf862('0x21')](_0x56de78,_0x22ae13,!![]);}catch(_0x2cd931){return BPromise[_0xf862('0x22')](_0x2cd931);}return _0x56de78[_0xf862('0x23')]();};}function saveUpdates(_0x17a418,_0x421c9c){return function(_0x16739b){if(_0x16739b){return _0x16739b[_0xf862('0x24')](_0x17a418)[_0xf862('0x25')](function(_0x2bf18b){return _0x2bf18b;});}return null;};}function removeEntity(_0x5c9868,_0x56cbe4){return function(_0x221ae8){if(_0x221ae8){return _0x221ae8[_0xf862('0x26')]()[_0xf862('0x25')](function(){_0x5c9868[_0xf862('0x18')](0xcc)[_0xf862('0x19')]();});}};}function handleEntityNotFound(_0x4ec27d,_0x5269b0){return function(_0x2f29f9){if(!_0x2f29f9){_0x4ec27d[_0xf862('0x27')](0x194);}return _0x2f29f9;};}function handleError(_0x5a7aca,_0x42728c){_0x42728c=_0x42728c||0x1f4;return function(_0x46e6af){logger[_0xf862('0x28')](_0x46e6af[_0xf862('0x29')]);if(_0x46e6af[_0xf862('0x2a')]){delete _0x46e6af[_0xf862('0x2a')];}_0x5a7aca['status'](_0x42728c)[_0xf862('0x2b')](_0x46e6af);};}exports['index']=function(_0x4fad87,_0x315a66){var _0x435810={},_0x557b61={},_0x2dbbd2={'count':0x0,'rows':[]};var _0x14f1b0=_[_0xf862('0x2c')](db[_0xf862('0x2d')]['rawAttributes'],function(_0x39ec36){return{'name':_0x39ec36[_0xf862('0x2e')],'type':_0x39ec36['type']['key']};});_0x557b61[_0xf862('0x2f')]=_[_0xf862('0x2c')](_0x14f1b0,_0xf862('0x2a'));_0x557b61['query']=_[_0xf862('0x30')](_0x4fad87[_0xf862('0x31')]);_0x557b61[_0xf862('0x32')]=_[_0xf862('0x33')](_0x557b61['model'],_0x557b61[_0xf862('0x31')]);_0x435810[_0xf862('0x34')]=_[_0xf862('0x33')](_0x557b61[_0xf862('0x2f')],qs[_0xf862('0x35')](_0x4fad87['query'][_0xf862('0x35')]));_0x435810[_0xf862('0x34')]=_0x435810[_0xf862('0x34')]['length']?_0x435810['attributes']:_0x557b61['model'];if(!_0x4fad87['query']['hasOwnProperty'](_0xf862('0x36'))){_0x435810[_0xf862('0x1d')]=qs[_0xf862('0x1d')](_0x4fad87['query'][_0xf862('0x1d')]);_0x435810[_0xf862('0x1b')]=qs['offset'](_0x4fad87[_0xf862('0x31')][_0xf862('0x1b')]);}_0x435810[_0xf862('0x37')]=qs[_0xf862('0x38')](_0x4fad87['query']['sort']);_0x435810[_0xf862('0x39')]=qs[_0xf862('0x32')](_[_0xf862('0x3a')](_0x4fad87[_0xf862('0x31')],_0x557b61[_0xf862('0x32')]),_0x14f1b0);if(_0x4fad87[_0xf862('0x31')][_0xf862('0x3b')]){_0x435810[_0xf862('0x39')]=_[_0xf862('0x3c')](_0x435810[_0xf862('0x39')],{'$or':_['map'](_0x14f1b0,function(_0x5ca495){if(_0x5ca495[_0xf862('0x3d')]!=='VIRTUAL'){var _0x1c4611={};_0x1c4611[_0x5ca495[_0xf862('0x2a')]]={'$like':'%'+_0x4fad87[_0xf862('0x31')][_0xf862('0x3b')]+'%'};return _0x1c4611;}})});}_0x435810=_[_0xf862('0x3c')]({},_0x435810,_0x4fad87['options']);var _0x593983={'where':_0x435810['where']};return db[_0xf862('0x2d')][_0xf862('0x1e')](_0x593983)[_0xf862('0x25')](function(_0xce01de){_0x2dbbd2[_0xf862('0x1e')]=_0xce01de;if(_0x4fad87['query']['includeAll']){_0x435810[_0xf862('0x3e')]=[{'all':!![]}];}return db[_0xf862('0x2d')][_0xf862('0x3f')](_0x435810);})['then'](function(_0xdfa565){_0x2dbbd2['rows']=_0xdfa565;return _0x2dbbd2;})[_0xf862('0x25')](respondWithFilteredResult(_0x315a66,_0x435810))['catch'](handleError(_0x315a66,null));};exports['show']=function(_0x52b684,_0x3ba278){var _0x1a1b05={'raw':![],'where':{'id':_0x52b684[_0xf862('0x40')]['id']}},_0x1f5e53={};_0x1f5e53[_0xf862('0x2f')]=_[_0xf862('0x30')](db['ServicenowAccount'][_0xf862('0x41')]);_0x1f5e53[_0xf862('0x31')]=_[_0xf862('0x30')](_0x52b684[_0xf862('0x31')]);_0x1f5e53[_0xf862('0x32')]=_[_0xf862('0x33')](_0x1f5e53[_0xf862('0x2f')],_0x1f5e53[_0xf862('0x31')]);_0x1a1b05[_0xf862('0x34')]=_[_0xf862('0x33')](_0x1f5e53['model'],qs[_0xf862('0x35')](_0x52b684[_0xf862('0x31')][_0xf862('0x35')]));_0x1a1b05[_0xf862('0x34')]=_0x1a1b05[_0xf862('0x34')]['length']?_0x1a1b05[_0xf862('0x34')]:_0x1f5e53['model'];if(_0x52b684[_0xf862('0x31')][_0xf862('0x42')]){_0x1a1b05['include']=[{'all':!![]}];}_0x1a1b05=_['merge']({},_0x1a1b05,_0x52b684['options']);return db[_0xf862('0x2d')][_0xf862('0x43')](_0x1a1b05)[_0xf862('0x25')](handleEntityNotFound(_0x3ba278,null))[_0xf862('0x25')](respondWithResult(_0x3ba278,null))[_0xf862('0x44')](handleError(_0x3ba278,null));};exports[_0xf862('0x45')]=function(_0x50a35e,_0x55021d){return db[_0xf862('0x2d')][_0xf862('0x45')](_0x50a35e[_0xf862('0x46')],{})[_0xf862('0x25')](respondWithResult(_0x55021d,0xc9))[_0xf862('0x44')](handleError(_0x55021d,null));};exports['update']=function(_0x261ccf,_0x464747){if(_0x261ccf['body']['id']){delete _0x261ccf[_0xf862('0x46')]['id'];}return db[_0xf862('0x2d')][_0xf862('0x43')]({'where':{'id':_0x261ccf[_0xf862('0x40')]['id']}})[_0xf862('0x25')](handleEntityNotFound(_0x464747,null))['then'](saveUpdates(_0x261ccf[_0xf862('0x46')],null))[_0xf862('0x25')](respondWithResult(_0x464747,null))[_0xf862('0x44')](handleError(_0x464747,null));};exports[_0xf862('0x26')]=function(_0x1a3784,_0x30bb04){return db['ServicenowAccount']['find']({'where':{'id':_0x1a3784[_0xf862('0x40')]['id']}})['then'](handleEntityNotFound(_0x30bb04,null))[_0xf862('0x25')](removeEntity(_0x30bb04,null))['catch'](handleError(_0x30bb04,null));};exports[_0xf862('0x47')]=function(_0xea84e4,_0x43378a,_0x3d93bd){var _0x254d2d={};var _0x18390c={};var _0x3921e9;var _0x1ceffc;return db[_0xf862('0x2d')][_0xf862('0x48')]({'where':{'id':_0xea84e4[_0xf862('0x40')]['id']}})[_0xf862('0x25')](handleEntityNotFound(_0x43378a,null))[_0xf862('0x25')](function(_0x37cbe8){if(_0x37cbe8){_0x3921e9=_0x37cbe8;_0x18390c[_0xf862('0x2f')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x18390c['query']=_[_0xf862('0x30')](_0xea84e4[_0xf862('0x31')]);_0x18390c['filters']=_['intersection'](_0x18390c[_0xf862('0x2f')],_0x18390c[_0xf862('0x31')]);_0x254d2d[_0xf862('0x34')]=_[_0xf862('0x33')](_0x18390c[_0xf862('0x2f')],qs[_0xf862('0x35')](_0xea84e4[_0xf862('0x31')]['fields']));_0x254d2d[_0xf862('0x34')]=_0x254d2d[_0xf862('0x34')]['length']?_0x254d2d[_0xf862('0x34')]:_0x18390c[_0xf862('0x2f')];_0x254d2d[_0xf862('0x37')]=qs[_0xf862('0x38')](_0xea84e4[_0xf862('0x31')][_0xf862('0x38')]);_0x254d2d[_0xf862('0x39')]=qs[_0xf862('0x32')](_[_0xf862('0x3a')](_0xea84e4[_0xf862('0x31')],_0x18390c[_0xf862('0x32')]));if(_0xea84e4[_0xf862('0x31')]['filter']){_0x254d2d['where']=_[_0xf862('0x3c')](_0x254d2d[_0xf862('0x39')],{'$or':_[_0xf862('0x2c')](_0x254d2d[_0xf862('0x34')],function(_0x5d6231){var _0xafa361={};_0xafa361[_0x5d6231]={'$like':'%'+_0xea84e4[_0xf862('0x31')]['filter']+'%'};return _0xafa361;})});}_0x254d2d=_[_0xf862('0x3c')]({},_0x254d2d,_0xea84e4[_0xf862('0x49')]);return _0x3921e9[_0xf862('0x47')](_0x254d2d);}})['then'](function(_0x5e16f8){if(_0x5e16f8){_0x1ceffc=_0x5e16f8['length'];if(!_0xea84e4[_0xf862('0x31')][_0xf862('0x4a')]('nolimit')){_0x254d2d[_0xf862('0x1d')]=qs[_0xf862('0x1d')](_0xea84e4[_0xf862('0x31')]['limit']);_0x254d2d['offset']=qs[_0xf862('0x1b')](_0xea84e4[_0xf862('0x31')][_0xf862('0x1b')]);}return _0x3921e9[_0xf862('0x47')](_0x254d2d);}})[_0xf862('0x25')](function(_0x3148e8){if(_0x3148e8){return _0x3148e8?{'count':_0x1ceffc,'rows':_0x3148e8}:null;}})[_0xf862('0x25')](respondWithResult(_0x43378a,null))['catch'](handleError(_0x43378a,null));};exports[_0xf862('0x4b')]=function(_0x28df2d,_0x240290,_0x6ac71){if(_0x28df2d['body']['id']){delete _0x28df2d[_0xf862('0x46')]['id'];}return db['ServicenowAccount'][_0xf862('0x48')]({'where':{'id':_0x28df2d[_0xf862('0x40')]['id']}})[_0xf862('0x25')](handleEntityNotFound(_0x240290,null))[_0xf862('0x25')](function(_0x49fa32){if(_0x49fa32){_0x28df2d['body'][_0xf862('0x4c')]=_0x49fa32['id'];_0x28df2d[_0xf862('0x46')][_0xf862('0x4d')]=integrations['getSubjects'](_0x28df2d['body'][_0xf862('0x4e')],_0x28df2d[_0xf862('0x46')][_0xf862('0x3d')]);_0x28df2d[_0xf862('0x46')][_0xf862('0x4f')]=integrations['getDescriptions'](_0x28df2d[_0xf862('0x46')][_0xf862('0x4e')],_0x28df2d['body'][_0xf862('0x3d')]);return db[_0xf862('0x50')]['create'](_0x28df2d[_0xf862('0x46')],{'include':[{'model':db[_0xf862('0x51')],'as':'Subjects'},{'model':db[_0xf862('0x51')],'as':_0xf862('0x4f')}]});}return null;})[_0xf862('0x25')](respondWithResult(_0x240290,null))[_0xf862('0x44')](handleError(_0x240290,null));};exports[_0xf862('0x52')]=function(_0x4ffcaa,_0x7f8073,_0xc6beda){var _0x5f038f=[_0xf862('0x53'),'hold_reason',_0xf862('0x54'),_0xf862('0x55'),_0xf862('0x56'),'notify','incident_state',_0xf862('0x57'),_0xf862('0x58')];var _0xdd68be=[_0xf862('0x59'),_0xf862('0x53'),_0xf862('0x5a'),'watch_list',_0xf862('0x5b'),_0xf862('0x5c'),'child_incidents',_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x5f'),_0xf862('0x60'),_0xf862('0x61'),_0xf862('0x62'),_0xf862('0x63'),_0xf862('0x64'),_0xf862('0x65'),'state',_0xf862('0x66'),_0xf862('0x54'),'order',_0xf862('0x67'),'closed_at','cmdb_ci','delivery_plan','impact',_0xf862('0x68'),'work_notes_list',_0xf862('0x69'),_0xf862('0x6a'),'sys_domain_path',_0xf862('0x6b'),_0xf862('0x6c'),_0xf862('0x6d'),'opened_at',_0xf862('0x6e'),_0xf862('0x6f'),_0xf862('0x70'),_0xf862('0x71'),_0xf862('0x72'),_0xf862('0x73'),_0xf862('0x74'),_0xf862('0x55'),_0xf862('0x75'),'short_description',_0xf862('0x56'),_0xf862('0x76'),_0xf862('0x77'),'work_start',_0xf862('0x78'),_0xf862('0x79'),_0xf862('0x7a'),'description',_0xf862('0x7b'),_0xf862('0x7c'),_0xf862('0x7d'),_0xf862('0x7e'),_0xf862('0x7f'),_0xf862('0x80'),_0xf862('0x81'),_0xf862('0x82'),_0xf862('0x83'),_0xf862('0x84'),'incident_state','urgency',_0xf862('0x85'),_0xf862('0x86'),'reassignment_count','activity_due',_0xf862('0x87'),'severity','comments',_0xf862('0x88'),_0xf862('0x89'),_0xf862('0x8a'),'due_date',_0xf862('0x8b'),_0xf862('0x8c'),_0xf862('0x8d'),_0xf862('0x8e'),_0xf862('0x8f'),_0xf862('0x90'),'location',_0xf862('0x58')];var _0x47e7a7='';var _0x5f4831='';var _0x4893a6=[];var _0x45b75d='';var _0x3646b5='';var _0x5c7813=[];var _0x4f4b85='';var _0x4b2bfb='';var _0x4a5a7b={};var _0x21868c='';return db['ServicenowAccount'][_0xf862('0x48')]({'where':{'id':_0x4ffcaa[_0xf862('0x40')]['id']},'attributes':['id','username',_0xf862('0x91'),_0xf862('0x92'),_0xf862('0x93'),'serverUrl']})['then'](handleEntityNotFound(_0x7f8073,null))[_0xf862('0x25')](function(_0xd5a242){if(_0xd5a242){_0x21868c=_0xd5a242[_0xf862('0x93')];var _0x2f9a3d=_0x21868c[_0xf862('0x94')](-0x1);if(_0x2f9a3d==='/'){_0x21868c=_0x21868c[_0xf862('0x95')](0x0,_0x21868c[_0xf862('0x96')](_0x2f9a3d));}_0x4b2bfb=util[_0xf862('0x97')]('%s/api/now/doc/table/schema/',_0x21868c);_0x4f4b85=util[_0xf862('0x97')](_0xf862('0x98'),_0x21868c);_0x4a5a7b={'user':_0xd5a242[_0xf862('0x99')],'pass':_0xd5a242[_0xf862('0x91')]};var _0x5716fb={'method':'GET','uri':_0x4b2bfb+_0xf862('0x9a'),'auth':_0x4a5a7b,'json':!![]};return rp(_0x5716fb);}})[_0xf862('0x25')](function(_0x34c05d){if(_0x34c05d['result']['length']>0x0){_0x47e7a7=_0x34c05d['result'];}console['log'](_0xf862('0x9b'),_0x47e7a7);_0x5c7813=[];_0x5f4831=Object[_0xf862('0x9c')]([],_0x47e7a7);_[_0xf862('0x9d')](_0x5f4831,function(_0x4e5601){return!_0x5f038f['includes'](_0x4e5601['name']);});_0x5f4831[_0xf862('0x9e')](function(_0x28791d){var _0x3b074a=createFieldObject(_0x4f4b85,_0x4a5a7b,_0x28791d[_0xf862('0x9f')],_0x28791d['name'],_0x28791d[_0xf862('0xa0')],![]);_0x5c7813['push'](_0x3b074a);});return Promise[_0xf862('0xa1')](_0x5c7813);})['then'](function(_0x3cc429){_0x4893a6=_0x3cc429;_0x45b75d=Object[_0xf862('0x9c')]([],_0x47e7a7);console[_0xf862('0xa2')](_0xf862('0xa3'),_0x47e7a7);_[_0xf862('0x9d')](_0x45b75d,function(_0x2ad402){return _0xdd68be[_0xf862('0xa4')](_0x2ad402[_0xf862('0x2a')]);});console['log'](_0xf862('0xa5'),_0x45b75d);_0x5c7813=[];_0x45b75d[_0xf862('0x9e')](function(_0x562342){var _0x1ef9bd=createFieldObject(_0x4f4b85,_0x4a5a7b,_0x562342[_0xf862('0x9f')],_0x562342[_0xf862('0x2a')],_0x562342['label'],!![]);_0x5c7813[_0xf862('0xa6')](_0x1ef9bd);});return Promise['all'](_0x5c7813);})['then'](function(_0x9f0ade){_0x3646b5=_0x9f0ade;var _0x2ab061=_0x4893a6[_0xf862('0xa7')](_0x3646b5);return{'count':_0x2ab061[_0xf862('0xa8')],'rows':_0x2ab061};})[_0xf862('0x25')](respondWithResult(_0x7f8073,null))[_0xf862('0x44')](function(_0x5b27e8){console[_0xf862('0xa2')](_0xf862('0xa9')+_0x5b27e8);var _0x3e61ac=_0x4ffcaa['query'][_0xf862('0xaa')]?0x1f4:_0x5b27e8[_0xf862('0xab')]||0x1f4;logger[_0xf862('0x28')](_0x5b27e8[_0xf862('0x29')]);delete _0x5b27e8[_0xf862('0x2a')];if(_0x3e61ac===0x191){_0x3e61ac=0x190;}_0x7f8073['status'](_0x3e61ac)[_0xf862('0x2b')](_0x4ffcaa[_0xf862('0x31')][_0xf862('0xaa')]?{'message':_0xf862('0xac'),'statusCode':_0x5b27e8[_0xf862('0xab')]}:_0x5b27e8);});};function createFieldObject(_0x539c9a,_0x2871e5,_0x1b5659,_0x4f0a75,_0x311528,_0x4b0247){return new Promise(function(_0x46f861,_0x13afd7){var _0x1ee744={'id':_0x4f0a75,'name':_0x311528,'custom':_0x4b0247};if(_0x1b5659===_0xf862('0xad')){_0x1ee744['options']=[{'name':_0xf862('0xae'),'value':'true'},{'name':_0xf862('0xaf'),'value':_0xf862('0xb0')}];_0x46f861(_0x1ee744);}else{var _0x138645={'method':_0xf862('0xb1'),'uri':_0x539c9a+'sys_choice?sysparm_query=name=incident^element='+_0x4f0a75,'auth':_0x2871e5,'json':!![]};return rp(_0x138645)[_0xf862('0x25')](function(_0x5824ef){var _0x53ff7c=[];if(_0x5824ef[_0xf862('0xb2')]['length']>0x0){_0x5824ef[_0xf862('0xb2')]['forEach'](function(_0x3e61dc){if(_0x3e61dc['inactive']==='false'){var _0x26ae24={'name':_0x3e61dc[_0xf862('0xa0')],'value':_0x3e61dc[_0xf862('0xb3')]};_0x53ff7c['push'](_0x26ae24);}});}_0x1ee744[_0xf862('0x49')]=_0x53ff7c;if(_0x1ee744[_0xf862('0x49')][_0xf862('0xa8')]>0x0){_0x46f861(_0x1ee744);}else{if(_0x4b0247==![]){_0x46f861();}else{_0x46f861(_0x1ee744);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0cb1fcf..3f61cfc 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 _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x56ba58,_0x1697c4){var _0x337772=function(_0x1fd2e8){while(--_0x1fd2e8){_0x56ba58['push'](_0x56ba58['shift']());}};_0x337772(++_0x1697c4);}(_0xeff8,0x186));var _0x8eff=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xeff8[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x30ebbf,_0x44f025){var _0x3d3af5=function(_0x50b798){while(--_0x50b798){_0x30ebbf['push'](_0x30ebbf['shift']());}};_0x3d3af5(++_0x44f025);}(_0x8958,0x93));var _0x8895=function(_0x40deb8,_0x3c3bfc){_0x40deb8=_0x40deb8-0x0;var _0x144962=_0x8958[_0x40deb8];return _0x144962;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),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 b1a9a44..6d08988 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 _0x46ea=['debug','stringify','error','message','result','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ServicenowAccount','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xa382ea,_0x44d99e){var _0x64c190=function(_0xee1ec9){while(--_0xee1ec9){_0xa382ea['push'](_0xa382ea['shift']());}};_0x64c190(++_0x44d99e);}(_0x46ea,0x188));var _0xa46e=function(_0x5df265,_0x131e1c){_0x5df265=_0x5df265-0x0;var _0x4b37e5=_0x46ea[_0x5df265];return _0x4b37e5;};'use strict';var _=require(_0xa46e('0x0'));var util=require(_0xa46e('0x1'));var moment=require(_0xa46e('0x2'));var BPromise=require(_0xa46e('0x3'));var rs=require(_0xa46e('0x4'));var fs=require('fs');var Redis=require(_0xa46e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa46e('0x6'))(_0xa46e('0x7'));var config=require(_0xa46e('0x8'));var jayson=require(_0xa46e('0x9'));var client=jayson[_0xa46e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0a732,_0xb8960,_0x582bfe){return new BPromise(function(_0x4f8d28,_0x1cef9a){return client[_0xa46e('0xb')](_0xd0a732,_0x582bfe)[_0xa46e('0xc')](function(_0x4e1539){logger[_0xa46e('0xd')](_0xa46e('0xe'),_0xb8960,_0xa46e('0xf'));logger[_0xa46e('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xb8960,_0xa46e('0xf'),JSON[_0xa46e('0x11')](_0x4e1539));if(_0x4e1539[_0xa46e('0x12')]){if(_0x4e1539[_0xa46e('0x12')]['code']===0x1f4){logger['error'](_0xa46e('0xe'),_0xb8960,_0x4e1539[_0xa46e('0x12')][_0xa46e('0x13')]);return _0x1cef9a(_0x4e1539['error'][_0xa46e('0x13')]);}logger[_0xa46e('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xb8960,_0x4e1539[_0xa46e('0x12')][_0xa46e('0x13')]);return _0x4f8d28(_0x4e1539[_0xa46e('0x12')][_0xa46e('0x13')]);}else{logger['info'](_0xa46e('0xe'),_0xb8960,_0xa46e('0xf'));_0x4f8d28(_0x4e1539[_0xa46e('0x14')][_0xa46e('0x13')]);}})['catch'](function(_0x50640e){logger[_0xa46e('0x12')](_0xa46e('0xe'),_0xb8960,_0x50640e);_0x1cef9a(_0x50640e);});});}exports[_0xa46e('0x15')]=function(_0x5d9a8e){var _0x171296=this;return new Promise(function(_0x1393ea,_0x50d843){return db['ServicenowAccount'][_0xa46e('0x16')]({'raw':_0x5d9a8e[_0xa46e('0x17')]?_0x5d9a8e[_0xa46e('0x17')][_0xa46e('0x18')]===undefined?!![]:![]:!![],'where':_0x5d9a8e[_0xa46e('0x17')]?_0x5d9a8e[_0xa46e('0x17')][_0xa46e('0x19')]||null:null,'attributes':_0x5d9a8e[_0xa46e('0x17')]?_0x5d9a8e[_0xa46e('0x17')][_0xa46e('0x1a')]||null:null,'limit':_0x5d9a8e[_0xa46e('0x17')]?_0x5d9a8e[_0xa46e('0x17')][_0xa46e('0x1b')]||null:null,'include':_0x5d9a8e['options']?_0x5d9a8e[_0xa46e('0x17')][_0xa46e('0x1c')]?_[_0xa46e('0x1d')](_0x5d9a8e['options'][_0xa46e('0x1c')],function(_0x5ec2ab){return{'model':db[_0x5ec2ab['model']],'as':_0x5ec2ab['as'],'attributes':_0x5ec2ab[_0xa46e('0x1a')],'include':_0x5ec2ab[_0xa46e('0x1c')]?_['map'](_0x5ec2ab[_0xa46e('0x1c')],function(_0x4f96d0){return{'model':db[_0x4f96d0[_0xa46e('0x1e')]],'as':_0x4f96d0['as'],'attributes':_0x4f96d0[_0xa46e('0x1a')],'include':_0x4f96d0[_0xa46e('0x1c')]?_['map'](_0x4f96d0[_0xa46e('0x1c')],function(_0x514693){return{'model':db[_0x514693[_0xa46e('0x1e')]],'as':_0x514693['as'],'attributes':_0x514693[_0xa46e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa46e('0xc')](function(_0x1089f7){logger[_0xa46e('0xd')](_0xa46e('0x15'),_0x5d9a8e);logger[_0xa46e('0x10')](_0xa46e('0x15'),_0x5d9a8e,JSON['stringify'](_0x1089f7));_0x1393ea(_0x1089f7);})[_0xa46e('0x1f')](function(_0x550a3e){logger['error'](_0xa46e('0x15'),_0x550a3e[_0xa46e('0x13')],_0x5d9a8e);_0x50d843(_0x171296[_0xa46e('0x12')](0x1f4,_0x550a3e[_0xa46e('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x39e8bf){var _0x815a31=this;return new Promise(function(_0x55b428,_0x2d533b){return db[_0xa46e('0x20')]['find']({'raw':_0x39e8bf[_0xa46e('0x17')]?_0x39e8bf[_0xa46e('0x17')][_0xa46e('0x18')]===undefined?!![]:![]:!![],'where':_0x39e8bf[_0xa46e('0x17')]?_0x39e8bf[_0xa46e('0x17')]['where']||null:null,'attributes':_0x39e8bf[_0xa46e('0x17')]?_0x39e8bf['options']['attributes']||null:null,'include':_0x39e8bf[_0xa46e('0x17')]?_0x39e8bf[_0xa46e('0x17')][_0xa46e('0x1c')]?_['map'](_0x39e8bf[_0xa46e('0x17')][_0xa46e('0x1c')],function(_0x581521){return{'model':db[_0x581521['model']],'as':_0x581521['as'],'attributes':_0x581521['attributes'],'include':_0x581521['include']?_[_0xa46e('0x1d')](_0x581521[_0xa46e('0x1c')],function(_0x3d17fd){return{'model':db[_0x3d17fd['model']],'as':_0x3d17fd['as'],'attributes':_0x3d17fd[_0xa46e('0x1a')],'include':_0x3d17fd[_0xa46e('0x1c')]?_[_0xa46e('0x1d')](_0x3d17fd[_0xa46e('0x1c')],function(_0x551988){return{'model':db[_0x551988[_0xa46e('0x1e')]],'as':_0x551988['as'],'attributes':_0x551988['attributes']};}):[]};}):[]};}):[]:[]})[_0xa46e('0xc')](function(_0x4b1bfd){logger['info'](_0xa46e('0x21'),_0x39e8bf);logger[_0xa46e('0x10')](_0xa46e('0x21'),_0x39e8bf,JSON[_0xa46e('0x11')](_0x4b1bfd));_0x55b428(_0x4b1bfd);})[_0xa46e('0x1f')](function(_0x121130){logger[_0xa46e('0x12')](_0xa46e('0x21'),_0x121130['message'],_0x39e8bf);_0x2d533b(_0x815a31[_0xa46e('0x12')](0x1f4,_0x121130[_0xa46e('0x13')]));});});}; \ No newline at end of file +var _0x8a50=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x240573,_0x59dee7){var _0x42a7f1=function(_0x4e3f48){while(--_0x4e3f48){_0x240573['push'](_0x240573['shift']());}};_0x42a7f1(++_0x59dee7);}(_0x8a50,0x169));var _0x08a5=function(_0xace86a,_0x1a8f74){_0xace86a=_0xace86a-0x0;var _0xad1e56=_0x8a50[_0xace86a];return _0xad1e56;};'use strict';var _=require(_0x08a5('0x0'));var util=require(_0x08a5('0x1'));var moment=require(_0x08a5('0x2'));var BPromise=require(_0x08a5('0x3'));var rs=require(_0x08a5('0x4'));var fs=require('fs');var Redis=require(_0x08a5('0x5'));var db=require(_0x08a5('0x6'))['db'];var utils=require(_0x08a5('0x7'));var logger=require(_0x08a5('0x8'))(_0x08a5('0x9'));var config=require(_0x08a5('0xa'));var jayson=require(_0x08a5('0xb'));var client=jayson[_0x08a5('0xc')][_0x08a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35d235,_0x5a2396,_0x36aedb){return new BPromise(function(_0x44daca,_0x8706d){return client[_0x08a5('0xe')](_0x35d235,_0x36aedb)[_0x08a5('0xf')](function(_0x1429c0){logger[_0x08a5('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x5a2396,_0x08a5('0x11'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5a2396,'request\x20sent',JSON[_0x08a5('0x12')](_0x1429c0));if(_0x1429c0[_0x08a5('0x13')]){if(_0x1429c0[_0x08a5('0x13')]['code']===0x1f4){logger[_0x08a5('0x13')](_0x08a5('0x14'),_0x5a2396,_0x1429c0[_0x08a5('0x13')]['message']);return _0x8706d(_0x1429c0[_0x08a5('0x13')][_0x08a5('0x15')]);}logger[_0x08a5('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5a2396,_0x1429c0[_0x08a5('0x13')]['message']);return _0x44daca(_0x1429c0['error'][_0x08a5('0x15')]);}else{logger[_0x08a5('0x10')](_0x08a5('0x14'),_0x5a2396,_0x08a5('0x11'));_0x44daca(_0x1429c0[_0x08a5('0x16')]['message']);}})[_0x08a5('0x17')](function(_0x2ee12c){logger[_0x08a5('0x13')](_0x08a5('0x14'),_0x5a2396,_0x2ee12c);_0x8706d(_0x2ee12c);});});}exports[_0x08a5('0x18')]=function(_0x2b99d4){var _0x24c9dd=this;return new Promise(function(_0x1be0e7,_0x4f8ff5){return db[_0x08a5('0x19')][_0x08a5('0x1a')]({'raw':_0x2b99d4[_0x08a5('0x1b')]?_0x2b99d4[_0x08a5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b99d4[_0x08a5('0x1b')]?_0x2b99d4['options'][_0x08a5('0x1c')]||null:null,'attributes':_0x2b99d4['options']?_0x2b99d4[_0x08a5('0x1b')][_0x08a5('0x1d')]||null:null,'limit':_0x2b99d4[_0x08a5('0x1b')]?_0x2b99d4['options'][_0x08a5('0x1e')]||null:null,'include':_0x2b99d4[_0x08a5('0x1b')]?_0x2b99d4['options'][_0x08a5('0x1f')]?_[_0x08a5('0x20')](_0x2b99d4[_0x08a5('0x1b')][_0x08a5('0x1f')],function(_0x22ec12){return{'model':db[_0x22ec12['model']],'as':_0x22ec12['as'],'attributes':_0x22ec12[_0x08a5('0x1d')],'include':_0x22ec12[_0x08a5('0x1f')]?_[_0x08a5('0x20')](_0x22ec12[_0x08a5('0x1f')],function(_0x16918b){return{'model':db[_0x16918b['model']],'as':_0x16918b['as'],'attributes':_0x16918b[_0x08a5('0x1d')],'include':_0x16918b[_0x08a5('0x1f')]?_[_0x08a5('0x20')](_0x16918b[_0x08a5('0x1f')],function(_0x13dd37){return{'model':db[_0x13dd37[_0x08a5('0x21')]],'as':_0x13dd37['as'],'attributes':_0x13dd37[_0x08a5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x232ebe){logger['info'](_0x08a5('0x18'),_0x2b99d4);logger['debug']('GetServicenowAccount',_0x2b99d4,JSON['stringify'](_0x232ebe));_0x1be0e7(_0x232ebe);})[_0x08a5('0x17')](function(_0x3ae01d){logger[_0x08a5('0x13')](_0x08a5('0x18'),_0x3ae01d['message'],_0x2b99d4);_0x4f8ff5(_0x24c9dd[_0x08a5('0x13')](0x1f4,_0x3ae01d['message']));});});};exports[_0x08a5('0x22')]=function(_0x2659c9){var _0x20791d=this;return new Promise(function(_0x49073e,_0x35c6a5){return db['ServicenowAccount']['find']({'raw':_0x2659c9[_0x08a5('0x1b')]?_0x2659c9[_0x08a5('0x1b')][_0x08a5('0x23')]===undefined?!![]:![]:!![],'where':_0x2659c9[_0x08a5('0x1b')]?_0x2659c9[_0x08a5('0x1b')][_0x08a5('0x1c')]||null:null,'attributes':_0x2659c9[_0x08a5('0x1b')]?_0x2659c9[_0x08a5('0x1b')]['attributes']||null:null,'include':_0x2659c9[_0x08a5('0x1b')]?_0x2659c9[_0x08a5('0x1b')]['include']?_[_0x08a5('0x20')](_0x2659c9[_0x08a5('0x1b')][_0x08a5('0x1f')],function(_0x12dd64){return{'model':db[_0x12dd64[_0x08a5('0x21')]],'as':_0x12dd64['as'],'attributes':_0x12dd64[_0x08a5('0x1d')],'include':_0x12dd64[_0x08a5('0x1f')]?_[_0x08a5('0x20')](_0x12dd64[_0x08a5('0x1f')],function(_0x5ae9cb){return{'model':db[_0x5ae9cb[_0x08a5('0x21')]],'as':_0x5ae9cb['as'],'attributes':_0x5ae9cb[_0x08a5('0x1d')],'include':_0x5ae9cb['include']?_['map'](_0x5ae9cb['include'],function(_0x6bc3e){return{'model':db[_0x6bc3e[_0x08a5('0x21')]],'as':_0x6bc3e['as'],'attributes':_0x6bc3e[_0x08a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x08a5('0xf')](function(_0x1443aa){logger[_0x08a5('0x10')](_0x08a5('0x22'),_0x2659c9);logger[_0x08a5('0x24')]('ShowServicenowAccount',_0x2659c9,JSON[_0x08a5('0x12')](_0x1443aa));_0x49073e(_0x1443aa);})[_0x08a5('0x17')](function(_0x35a307){logger[_0x08a5('0x13')]('ShowServicenowAccount',_0x35a307['message'],_0x2659c9);_0x35c6a5(_0x20791d[_0x08a5('0x13')](0x1f4,_0x35a307[_0x08a5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b143fc9..37a1c6b 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 _0x968a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put'];(function(_0x185ca3,_0x91cdcb){var _0x7df8c5=function(_0x2c42fc){while(--_0x2c42fc){_0x185ca3['push'](_0x185ca3['shift']());}};_0x7df8c5(++_0x91cdcb);}(_0x968a,0xbc));var _0xa968=function(_0xf78922,_0x211eca){_0xf78922=_0xf78922-0x0;var _0x18312e=_0x968a[_0xf78922];return _0x18312e;};'use strict';var multer=require(_0xa968('0x0'));var util=require(_0xa968('0x1'));var path=require(_0xa968('0x2'));var timeout=require(_0xa968('0x3'));var express=require('express');var router=express[_0xa968('0x4')]();var fs_extra=require(_0xa968('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa968('0x6'));router[_0xa968('0x7')]('/',auth[_0xa968('0x8')](),controller[_0xa968('0x9')]);router['get'](_0xa968('0xa'),auth[_0xa968('0x8')](),controller[_0xa968('0xb')]);router[_0xa968('0x7')](_0xa968('0xc'),auth[_0xa968('0x8')](),controller[_0xa968('0xd')]);router['get'](_0xa968('0xe'),auth[_0xa968('0x8')](),controller[_0xa968('0xf')]);router[_0xa968('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa968('0x10')]);router[_0xa968('0x11')]('/',auth[_0xa968('0x8')](),controller['create']);router[_0xa968('0x12')](_0xa968('0xa'),auth[_0xa968('0x8')](),controller[_0xa968('0x13')]);router[_0xa968('0x14')](_0xa968('0xa'),auth[_0xa968('0x8')](),controller[_0xa968('0x15')]);module[_0xa968('0x16')]=router; \ No newline at end of file +var _0xc4a0=['index','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x3d09e1,_0x10264d){var _0x293595=function(_0xe0b3d2){while(--_0xe0b3d2){_0x3d09e1['push'](_0x3d09e1['shift']());}};_0x293595(++_0x10264d);}(_0xc4a0,0x132));var _0x0c4a=function(_0x57b4a8,_0x468d55){_0x57b4a8=_0x57b4a8-0x0;var _0x313cd0=_0xc4a0[_0x57b4a8];return _0x313cd0;};'use strict';var multer=require(_0x0c4a('0x0'));var util=require('util');var path=require(_0x0c4a('0x1'));var timeout=require(_0x0c4a('0x2'));var express=require(_0x0c4a('0x3'));var router=express[_0x0c4a('0x4')]();var fs_extra=require(_0x0c4a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c4a('0x6'));var controller=require(_0x0c4a('0x7'));router[_0x0c4a('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c4a('0x9')]);router['get']('/:id',auth[_0x0c4a('0xa')](),controller[_0x0c4a('0xb')]);router[_0x0c4a('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0c4a('0xc')]);router[_0x0c4a('0x8')](_0x0c4a('0xd'),auth[_0x0c4a('0xa')](),controller[_0x0c4a('0xe')]);router[_0x0c4a('0x8')]('/:id/descriptions',auth[_0x0c4a('0xa')](),controller[_0x0c4a('0xf')]);router[_0x0c4a('0x10')]('/',auth[_0x0c4a('0xa')](),controller['create']);router['put'](_0x0c4a('0x11'),auth['isAuthenticated'](),controller[_0x0c4a('0x12')]);router[_0x0c4a('0x13')](_0x0c4a('0x11'),auth[_0x0c4a('0xa')](),controller[_0x0c4a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e1e1c29..fde7d9a 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 _0xbb0d=['sequelize','STRING'];(function(_0x45e0ea,_0x54e1fa){var _0x26bb5c=function(_0x29ea5c){while(--_0x29ea5c){_0x45e0ea['push'](_0x45e0ea['shift']());}};_0x26bb5c(++_0x54e1fa);}(_0xbb0d,0x100));var _0xdbb0=function(_0x1b12d6,_0x1714ac){_0x1b12d6=_0x1b12d6-0x0;var _0x2d8379=_0xbb0d[_0x1b12d6];return _0x2d8379;};'use strict';var Sequelize=require(_0xdbb0('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbb0('0x1')]},'description':{'type':Sequelize[_0xdbb0('0x1')]}}; \ No newline at end of file +var _0x6cb2=['STRING','exports'];(function(_0x4dd3f3,_0x2181c9){var _0xff7750=function(_0x39571f){while(--_0x39571f){_0x4dd3f3['push'](_0x4dd3f3['shift']());}};_0xff7750(++_0x2181c9);}(_0x6cb2,0x10f));var _0x26cb=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6cb2[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module[_0x26cb('0x0')]={'name':{'type':Sequelize[_0x26cb('0x1')]},'description':{'type':Sequelize[_0x26cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cc48dc4..cb83971 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 _0x37f1=['then','end','error','name','map','ServicenowConfiguration','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','destroy','findOne','ServicenowField','order','pick','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3101ff,_0xf266f){var _0x3ab3d2=function(_0x3b4045){while(--_0x3b4045){_0x3101ff['push'](_0x3101ff['shift']());}};_0x3ab3d2(++_0xf266f);}(_0x37f1,0x11c));var _0x137f=function(_0x1f2415,_0x4d54f1){_0x1f2415=_0x1f2415-0x0;var _0x148a62=_0x37f1[_0x1f2415];return _0x148a62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x137f('0x0'));var zipdir=require(_0x137f('0x1'));var jsonpatch=require(_0x137f('0x2'));var rp=require('request-promise');var moment=require(_0x137f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x137f('0x4'));var sox=require(_0x137f('0x5'));var csv=require(_0x137f('0x6'));var ejs=require(_0x137f('0x7'));var fs=require('fs');var fs_extra=require(_0x137f('0x8'));var _=require(_0x137f('0x9'));var squel=require(_0x137f('0xa'));var crypto=require(_0x137f('0xb'));var jsforce=require(_0x137f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x137f('0xd'));var Papa=require(_0x137f('0xe'));var Redis=require(_0x137f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x137f('0x10'));var as=require(_0x137f('0x11'));var hardwareService=require(_0x137f('0x12'));var logger=require(_0x137f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x137f('0x14'));var licenseUtil=require(_0x137f('0x15'));var db=require(_0x137f('0x16'))['db'];function respondWithStatusCode(_0x34ac4f,_0x44651d){_0x44651d=_0x44651d||0xcc;return function(_0x5cb1eb){if(_0x5cb1eb){return _0x34ac4f[_0x137f('0x17')](_0x44651d);}return _0x34ac4f[_0x137f('0x18')](_0x44651d)['end']();};}function respondWithResult(_0x115170,_0x35bb5c){_0x35bb5c=_0x35bb5c||0xc8;return function(_0x4935ce){if(_0x4935ce){return _0x115170[_0x137f('0x18')](_0x35bb5c)[_0x137f('0x19')](_0x4935ce);}};}function respondWithFilteredResult(_0x252636,_0x53e41b){return function(_0x4e0017){if(_0x4e0017){var _0x3cb279=typeof _0x53e41b[_0x137f('0x1a')]===_0x137f('0x1b')&&typeof _0x53e41b['limit']===_0x137f('0x1b');var _0x4531dd=_0x4e0017[_0x137f('0x1c')];var _0x321e5c=_0x3cb279?0x0:_0x53e41b[_0x137f('0x1a')];var _0xbf7cee=_0x3cb279?_0x4e0017[_0x137f('0x1c')]:_0x53e41b[_0x137f('0x1a')]+_0x53e41b[_0x137f('0x1d')];var _0x56f57a;if(_0xbf7cee>=_0x4531dd){_0xbf7cee=_0x4531dd;_0x56f57a=0xc8;}else{_0x56f57a=0xce;}_0x252636['status'](_0x56f57a);return _0x252636[_0x137f('0x1e')](_0x137f('0x1f'),_0x321e5c+'-'+_0xbf7cee+'/'+_0x4531dd)[_0x137f('0x19')](_0x4e0017);}return null;};}function patchUpdates(_0x49fb53){return function(_0xadc55c){try{jsonpatch[_0x137f('0x20')](_0xadc55c,_0x49fb53,!![]);}catch(_0x58e4ba){return BPromise[_0x137f('0x21')](_0x58e4ba);}return _0xadc55c[_0x137f('0x22')]();};}function saveUpdates(_0x3f541a,_0x180638){return function(_0x3d965f){if(_0x3d965f){return _0x3d965f[_0x137f('0x23')](_0x3f541a)[_0x137f('0x24')](function(_0xb4ca6d){return _0xb4ca6d;});}return null;};}function removeEntity(_0x3dfdfc,_0x41b59e){return function(_0x449b67){if(_0x449b67){return _0x449b67['destroy']()[_0x137f('0x24')](function(){_0x3dfdfc[_0x137f('0x18')](0xcc)[_0x137f('0x25')]();});}};}function handleEntityNotFound(_0x242e6c,_0x20a2db){return function(_0x388a2b){if(!_0x388a2b){_0x242e6c[_0x137f('0x17')](0x194);}return _0x388a2b;};}function handleError(_0x216050,_0x3d65df){_0x3d65df=_0x3d65df||0x1f4;return function(_0x214204){logger[_0x137f('0x26')](_0x214204['stack']);if(_0x214204[_0x137f('0x27')]){delete _0x214204[_0x137f('0x27')];}_0x216050[_0x137f('0x18')](_0x3d65df)['send'](_0x214204);};}exports['index']=function(_0x314f01,_0x576aec){var _0x46af20={},_0x462326={},_0xef41c5={'count':0x0,'rows':[]};var _0x401f43=_[_0x137f('0x28')](db[_0x137f('0x29')]['rawAttributes'],function(_0x24596b){return{'name':_0x24596b[_0x137f('0x2a')],'type':_0x24596b['type'][_0x137f('0x2b')]};});_0x462326[_0x137f('0x2c')]=_[_0x137f('0x28')](_0x401f43,_0x137f('0x27'));_0x462326[_0x137f('0x2d')]=_[_0x137f('0x2e')](_0x314f01[_0x137f('0x2d')]);_0x462326[_0x137f('0x2f')]=_['intersection'](_0x462326[_0x137f('0x2c')],_0x462326[_0x137f('0x2d')]);_0x46af20[_0x137f('0x30')]=_[_0x137f('0x31')](_0x462326[_0x137f('0x2c')],qs['fields'](_0x314f01[_0x137f('0x2d')]['fields']));_0x46af20['attributes']=_0x46af20[_0x137f('0x30')][_0x137f('0x32')]?_0x46af20[_0x137f('0x30')]:_0x462326['model'];if(!_0x314f01['query'][_0x137f('0x33')](_0x137f('0x34'))){_0x46af20[_0x137f('0x1d')]=qs[_0x137f('0x1d')](_0x314f01['query'][_0x137f('0x1d')]);_0x46af20[_0x137f('0x1a')]=qs[_0x137f('0x1a')](_0x314f01[_0x137f('0x2d')][_0x137f('0x1a')]);}_0x46af20['order']=qs[_0x137f('0x35')](_0x314f01[_0x137f('0x2d')]['sort']);_0x46af20['where']=qs[_0x137f('0x2f')](_['pick'](_0x314f01['query'],_0x462326[_0x137f('0x2f')]),_0x401f43);if(_0x314f01[_0x137f('0x2d')][_0x137f('0x36')]){_0x46af20[_0x137f('0x37')]=_[_0x137f('0x38')](_0x46af20[_0x137f('0x37')],{'$or':_[_0x137f('0x28')](_0x401f43,function(_0x324c74){if(_0x324c74[_0x137f('0x39')]!==_0x137f('0x3a')){var _0x4db414={};_0x4db414[_0x324c74[_0x137f('0x27')]]={'$like':'%'+_0x314f01['query'][_0x137f('0x36')]+'%'};return _0x4db414;}})});}_0x46af20=_[_0x137f('0x38')]({},_0x46af20,_0x314f01[_0x137f('0x3b')]);var _0x9b0fe6={'where':_0x46af20['where']};return db['ServicenowConfiguration'][_0x137f('0x1c')](_0x9b0fe6)[_0x137f('0x24')](function(_0x4eb589){_0xef41c5[_0x137f('0x1c')]=_0x4eb589;if(_0x314f01[_0x137f('0x2d')][_0x137f('0x3c')]){_0x46af20[_0x137f('0x3d')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x137f('0x3e')](_0x46af20);})[_0x137f('0x24')](function(_0x11315a){_0xef41c5[_0x137f('0x3f')]=_0x11315a;return _0xef41c5;})['then'](respondWithFilteredResult(_0x576aec,_0x46af20))[_0x137f('0x40')](handleError(_0x576aec,null));};exports[_0x137f('0x41')]=function(_0x1ee316,_0x1bcb9e){var _0x5882eb={'raw':![],'where':{'id':_0x1ee316[_0x137f('0x42')]['id']}},_0x3cf762={};_0x3cf762['model']=_[_0x137f('0x2e')](db[_0x137f('0x29')][_0x137f('0x43')]);_0x3cf762[_0x137f('0x2d')]=_['keys'](_0x1ee316[_0x137f('0x2d')]);_0x3cf762[_0x137f('0x2f')]=_[_0x137f('0x31')](_0x3cf762['model'],_0x3cf762['query']);_0x5882eb[_0x137f('0x30')]=_[_0x137f('0x31')](_0x3cf762['model'],qs[_0x137f('0x44')](_0x1ee316[_0x137f('0x2d')][_0x137f('0x44')]));_0x5882eb[_0x137f('0x30')]=_0x5882eb[_0x137f('0x30')][_0x137f('0x32')]?_0x5882eb[_0x137f('0x30')]:_0x3cf762[_0x137f('0x2c')];if(_0x1ee316[_0x137f('0x2d')][_0x137f('0x3c')]){_0x5882eb[_0x137f('0x3d')]=[{'all':!![]}];}_0x5882eb=_[_0x137f('0x38')]({},_0x5882eb,_0x1ee316[_0x137f('0x3b')]);return db[_0x137f('0x29')][_0x137f('0x45')](_0x5882eb)[_0x137f('0x24')](handleEntityNotFound(_0x1bcb9e,null))[_0x137f('0x24')](respondWithResult(_0x1bcb9e,null))[_0x137f('0x40')](handleError(_0x1bcb9e,null));};exports['create']=function(_0x5de4d6,_0x1ec774){return db[_0x137f('0x29')][_0x137f('0x46')](_0x5de4d6[_0x137f('0x47')],{})[_0x137f('0x24')](respondWithResult(_0x1ec774,0xc9))[_0x137f('0x40')](handleError(_0x1ec774,null));};exports[_0x137f('0x23')]=function(_0x4fd478,_0x4b2022){if(_0x4fd478[_0x137f('0x47')]['id']){delete _0x4fd478['body']['id'];}return db[_0x137f('0x29')][_0x137f('0x45')]({'where':{'id':_0x4fd478[_0x137f('0x42')]['id']}})[_0x137f('0x24')](handleEntityNotFound(_0x4b2022,null))[_0x137f('0x24')](saveUpdates(_0x4fd478[_0x137f('0x47')],null))['then'](respondWithResult(_0x4b2022,null))['catch'](handleError(_0x4b2022,null));};exports[_0x137f('0x48')]=function(_0x236158,_0x42f83e){return db['ServicenowConfiguration'][_0x137f('0x45')]({'where':{'id':_0x236158[_0x137f('0x42')]['id']}})[_0x137f('0x24')](handleEntityNotFound(_0x42f83e,null))[_0x137f('0x24')](removeEntity(_0x42f83e,null))[_0x137f('0x40')](handleError(_0x42f83e,null));};exports['getFields']=function(_0x2ab01f,_0x21d283,_0x82d7f4){var _0xcb5ad8={};var _0x4e3b1e={};var _0x50e320;var _0x3ac0bc;return db[_0x137f('0x29')][_0x137f('0x49')]({'where':{'id':_0x2ab01f[_0x137f('0x42')]['id']}})[_0x137f('0x24')](handleEntityNotFound(_0x21d283,null))['then'](function(_0x2a1c59){if(_0x2a1c59){_0x50e320=_0x2a1c59;_0x4e3b1e[_0x137f('0x2c')]=_[_0x137f('0x2e')](db[_0x137f('0x4a')]['rawAttributes']);_0x4e3b1e[_0x137f('0x2d')]=_['keys'](_0x2ab01f[_0x137f('0x2d')]);_0x4e3b1e[_0x137f('0x2f')]=_[_0x137f('0x31')](_0x4e3b1e[_0x137f('0x2c')],_0x4e3b1e[_0x137f('0x2d')]);_0xcb5ad8['attributes']=_['intersection'](_0x4e3b1e[_0x137f('0x2c')],qs['fields'](_0x2ab01f[_0x137f('0x2d')][_0x137f('0x44')]));_0xcb5ad8[_0x137f('0x30')]=_0xcb5ad8[_0x137f('0x30')][_0x137f('0x32')]?_0xcb5ad8[_0x137f('0x30')]:_0x4e3b1e[_0x137f('0x2c')];_0xcb5ad8[_0x137f('0x4b')]=qs[_0x137f('0x35')](_0x2ab01f[_0x137f('0x2d')]['sort']);_0xcb5ad8['where']=qs[_0x137f('0x2f')](_[_0x137f('0x4c')](_0x2ab01f[_0x137f('0x2d')],_0x4e3b1e[_0x137f('0x2f')]));if(_0x2ab01f['query'][_0x137f('0x36')]){_0xcb5ad8[_0x137f('0x37')]=_[_0x137f('0x38')](_0xcb5ad8[_0x137f('0x37')],{'$or':_[_0x137f('0x28')](_0xcb5ad8[_0x137f('0x30')],function(_0x3e1e58){var _0x170eb5={};_0x170eb5[_0x3e1e58]={'$like':'%'+_0x2ab01f[_0x137f('0x2d')][_0x137f('0x36')]+'%'};return _0x170eb5;})});}_0xcb5ad8=_[_0x137f('0x38')]({},_0xcb5ad8,_0x2ab01f[_0x137f('0x3b')]);return _0x50e320[_0x137f('0x4d')](_0xcb5ad8);}})[_0x137f('0x24')](function(_0x50fc12){if(_0x50fc12){_0x3ac0bc=_0x50fc12[_0x137f('0x32')];if(!_0x2ab01f['query'][_0x137f('0x33')](_0x137f('0x34'))){_0xcb5ad8[_0x137f('0x1d')]=qs[_0x137f('0x1d')](_0x2ab01f[_0x137f('0x2d')]['limit']);_0xcb5ad8['offset']=qs[_0x137f('0x1a')](_0x2ab01f['query'][_0x137f('0x1a')]);}return _0x50e320[_0x137f('0x4d')](_0xcb5ad8);}})[_0x137f('0x24')](function(_0x58c84f){if(_0x58c84f){return _0x58c84f?{'count':_0x3ac0bc,'rows':_0x58c84f}:null;}})[_0x137f('0x24')](respondWithResult(_0x21d283,null))[_0x137f('0x40')](handleError(_0x21d283,null));};exports['getSubjects']=function(_0x5d63d2,_0x11ef39,_0x1514d7){var _0x4b7e96={};var _0x5c483a={};var _0x46b969;var _0x40ca3d;return db[_0x137f('0x29')][_0x137f('0x49')]({'where':{'id':_0x5d63d2[_0x137f('0x42')]['id']}})[_0x137f('0x24')](handleEntityNotFound(_0x11ef39,null))[_0x137f('0x24')](function(_0x25fee5){if(_0x25fee5){_0x46b969=_0x25fee5;_0x5c483a[_0x137f('0x2c')]=_[_0x137f('0x2e')](db[_0x137f('0x4a')][_0x137f('0x43')]);_0x5c483a[_0x137f('0x2d')]=_[_0x137f('0x2e')](_0x5d63d2[_0x137f('0x2d')]);_0x5c483a[_0x137f('0x2f')]=_['intersection'](_0x5c483a[_0x137f('0x2c')],_0x5c483a[_0x137f('0x2d')]);_0x4b7e96['attributes']=_[_0x137f('0x31')](_0x5c483a[_0x137f('0x2c')],qs[_0x137f('0x44')](_0x5d63d2[_0x137f('0x2d')][_0x137f('0x44')]));_0x4b7e96[_0x137f('0x30')]=_0x4b7e96[_0x137f('0x30')][_0x137f('0x32')]?_0x4b7e96[_0x137f('0x30')]:_0x5c483a[_0x137f('0x2c')];_0x4b7e96['order']=qs[_0x137f('0x35')](_0x5d63d2['query']['sort']);_0x4b7e96[_0x137f('0x37')]=qs[_0x137f('0x2f')](_[_0x137f('0x4c')](_0x5d63d2[_0x137f('0x2d')],_0x5c483a[_0x137f('0x2f')]));if(_0x5d63d2['query'][_0x137f('0x36')]){_0x4b7e96[_0x137f('0x37')]=_[_0x137f('0x38')](_0x4b7e96[_0x137f('0x37')],{'$or':_[_0x137f('0x28')](_0x4b7e96['attributes'],function(_0x3c040c){var _0x234aa6={};_0x234aa6[_0x3c040c]={'$like':'%'+_0x5d63d2[_0x137f('0x2d')][_0x137f('0x36')]+'%'};return _0x234aa6;})});}_0x4b7e96=_['merge']({},_0x4b7e96,_0x5d63d2[_0x137f('0x3b')]);return _0x46b969[_0x137f('0x4e')](_0x4b7e96);}})['then'](function(_0x872b7d){if(_0x872b7d){_0x40ca3d=_0x872b7d[_0x137f('0x32')];if(!_0x5d63d2[_0x137f('0x2d')][_0x137f('0x33')](_0x137f('0x34'))){_0x4b7e96[_0x137f('0x1d')]=qs[_0x137f('0x1d')](_0x5d63d2[_0x137f('0x2d')][_0x137f('0x1d')]);_0x4b7e96[_0x137f('0x1a')]=qs['offset'](_0x5d63d2[_0x137f('0x2d')][_0x137f('0x1a')]);}return _0x46b969[_0x137f('0x4e')](_0x4b7e96);}})[_0x137f('0x24')](function(_0xd70793){if(_0xd70793){return _0xd70793?{'count':_0x40ca3d,'rows':_0xd70793}:null;}})[_0x137f('0x24')](respondWithResult(_0x11ef39,null))[_0x137f('0x40')](handleError(_0x11ef39,null));};exports[_0x137f('0x4f')]=function(_0x30670d,_0x4d7ed7,_0x5593dd){var _0x471d34={};var _0x5d8eb1={};var _0x39213e;var _0x3ba5b8;return db[_0x137f('0x29')][_0x137f('0x49')]({'where':{'id':_0x30670d[_0x137f('0x42')]['id']}})[_0x137f('0x24')](handleEntityNotFound(_0x4d7ed7,null))[_0x137f('0x24')](function(_0x5b0b66){if(_0x5b0b66){_0x39213e=_0x5b0b66;_0x5d8eb1[_0x137f('0x2c')]=_[_0x137f('0x2e')](db['ServicenowField']['rawAttributes']);_0x5d8eb1[_0x137f('0x2d')]=_['keys'](_0x30670d[_0x137f('0x2d')]);_0x5d8eb1[_0x137f('0x2f')]=_[_0x137f('0x31')](_0x5d8eb1[_0x137f('0x2c')],_0x5d8eb1[_0x137f('0x2d')]);_0x471d34[_0x137f('0x30')]=_[_0x137f('0x31')](_0x5d8eb1[_0x137f('0x2c')],qs[_0x137f('0x44')](_0x30670d[_0x137f('0x2d')][_0x137f('0x44')]));_0x471d34['attributes']=_0x471d34[_0x137f('0x30')][_0x137f('0x32')]?_0x471d34[_0x137f('0x30')]:_0x5d8eb1[_0x137f('0x2c')];_0x471d34['order']=qs[_0x137f('0x35')](_0x30670d[_0x137f('0x2d')][_0x137f('0x35')]);_0x471d34[_0x137f('0x37')]=qs[_0x137f('0x2f')](_[_0x137f('0x4c')](_0x30670d[_0x137f('0x2d')],_0x5d8eb1['filters']));if(_0x30670d[_0x137f('0x2d')]['filter']){_0x471d34[_0x137f('0x37')]=_[_0x137f('0x38')](_0x471d34[_0x137f('0x37')],{'$or':_[_0x137f('0x28')](_0x471d34[_0x137f('0x30')],function(_0x1848c2){var _0x401c2e={};_0x401c2e[_0x1848c2]={'$like':'%'+_0x30670d[_0x137f('0x2d')][_0x137f('0x36')]+'%'};return _0x401c2e;})});}_0x471d34=_[_0x137f('0x38')]({},_0x471d34,_0x30670d[_0x137f('0x3b')]);return _0x39213e[_0x137f('0x4f')](_0x471d34);}})[_0x137f('0x24')](function(_0x112bee){if(_0x112bee){_0x3ba5b8=_0x112bee[_0x137f('0x32')];if(!_0x30670d[_0x137f('0x2d')][_0x137f('0x33')]('nolimit')){_0x471d34[_0x137f('0x1d')]=qs[_0x137f('0x1d')](_0x30670d[_0x137f('0x2d')]['limit']);_0x471d34['offset']=qs['offset'](_0x30670d[_0x137f('0x2d')][_0x137f('0x1a')]);}return _0x39213e[_0x137f('0x4f')](_0x471d34);}})[_0x137f('0x24')](function(_0x8d7e90){if(_0x8d7e90){return _0x8d7e90?{'count':_0x3ba5b8,'rows':_0x8d7e90}:null;}})['then'](respondWithResult(_0x4d7ed7,null))['catch'](handleError(_0x4d7ed7,null));}; \ No newline at end of file +var _0x1163=['getFields','findOne','ServicenowField','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x1163,0x1a1));var _0x3116=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x1163[_0x4a45b4];return _0x1a99c9;};'use strict';var emlformat=require(_0x3116('0x0'));var rimraf=require(_0x3116('0x1'));var zipdir=require(_0x3116('0x2'));var jsonpatch=require(_0x3116('0x3'));var rp=require(_0x3116('0x4'));var moment=require(_0x3116('0x5'));var BPromise=require(_0x3116('0x6'));var Mustache=require(_0x3116('0x7'));var util=require(_0x3116('0x8'));var path=require(_0x3116('0x9'));var sox=require('sox');var csv=require(_0x3116('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3116('0xb'));var _=require('lodash');var squel=require(_0x3116('0xc'));var crypto=require(_0x3116('0xd'));var jsforce=require(_0x3116('0xe'));var deskjs=require(_0x3116('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3116('0x10'));var Redis=require(_0x3116('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3116('0x12'));var hardwareService=require(_0x3116('0x13'));var logger=require('../../config/logger')(_0x3116('0x14'));var utils=require('../../config/utils');var config=require(_0x3116('0x15'));var licenseUtil=require(_0x3116('0x16'));var db=require(_0x3116('0x17'))['db'];function respondWithStatusCode(_0x47736c,_0x58c803){_0x58c803=_0x58c803||0xcc;return function(_0xac8743){if(_0xac8743){return _0x47736c['sendStatus'](_0x58c803);}return _0x47736c[_0x3116('0x18')](_0x58c803)[_0x3116('0x19')]();};}function respondWithResult(_0x19d38c,_0x26d9d1){_0x26d9d1=_0x26d9d1||0xc8;return function(_0xdb9dfc){if(_0xdb9dfc){return _0x19d38c[_0x3116('0x18')](_0x26d9d1)['json'](_0xdb9dfc);}};}function respondWithFilteredResult(_0x35c00d,_0x52afa8){return function(_0x5dba07){if(_0x5dba07){var _0x110268=typeof _0x52afa8['offset']===_0x3116('0x1a')&&typeof _0x52afa8[_0x3116('0x1b')]===_0x3116('0x1a');var _0x100871=_0x5dba07[_0x3116('0x1c')];var _0x2551a9=_0x110268?0x0:_0x52afa8[_0x3116('0x1d')];var _0x468ec7=_0x110268?_0x5dba07[_0x3116('0x1c')]:_0x52afa8[_0x3116('0x1d')]+_0x52afa8['limit'];var _0x5daf60;if(_0x468ec7>=_0x100871){_0x468ec7=_0x100871;_0x5daf60=0xc8;}else{_0x5daf60=0xce;}_0x35c00d[_0x3116('0x18')](_0x5daf60);return _0x35c00d[_0x3116('0x1e')]('Content-Range',_0x2551a9+'-'+_0x468ec7+'/'+_0x100871)[_0x3116('0x1f')](_0x5dba07);}return null;};}function patchUpdates(_0x521b6d){return function(_0x222116){try{jsonpatch[_0x3116('0x20')](_0x222116,_0x521b6d,!![]);}catch(_0x5c428b){return BPromise[_0x3116('0x21')](_0x5c428b);}return _0x222116[_0x3116('0x22')]();};}function saveUpdates(_0xdbcc0b,_0x4ab563){return function(_0x39ee39){if(_0x39ee39){return _0x39ee39[_0x3116('0x23')](_0xdbcc0b)[_0x3116('0x24')](function(_0x48b321){return _0x48b321;});}return null;};}function removeEntity(_0x3a9307,_0x2ffe40){return function(_0x57dbf0){if(_0x57dbf0){return _0x57dbf0[_0x3116('0x25')]()[_0x3116('0x24')](function(){_0x3a9307[_0x3116('0x18')](0xcc)[_0x3116('0x19')]();});}};}function handleEntityNotFound(_0x57c93e,_0x5aa47b){return function(_0x39dbe6){if(!_0x39dbe6){_0x57c93e[_0x3116('0x26')](0x194);}return _0x39dbe6;};}function handleError(_0x2b38a9,_0xe73c7b){_0xe73c7b=_0xe73c7b||0x1f4;return function(_0x59ab0f){logger['error'](_0x59ab0f[_0x3116('0x27')]);if(_0x59ab0f[_0x3116('0x28')]){delete _0x59ab0f[_0x3116('0x28')];}_0x2b38a9[_0x3116('0x18')](_0xe73c7b)[_0x3116('0x29')](_0x59ab0f);};}exports[_0x3116('0x2a')]=function(_0x31dbd1,_0x5a4332){var _0x168551={},_0x5418ed={},_0x3459f0={'count':0x0,'rows':[]};var _0xfcc1b8=_[_0x3116('0x2b')](db[_0x3116('0x2c')][_0x3116('0x2d')],function(_0x3f20ca){return{'name':_0x3f20ca[_0x3116('0x2e')],'type':_0x3f20ca[_0x3116('0x2f')][_0x3116('0x30')]};});_0x5418ed[_0x3116('0x31')]=_[_0x3116('0x2b')](_0xfcc1b8,'name');_0x5418ed[_0x3116('0x32')]=_['keys'](_0x31dbd1[_0x3116('0x32')]);_0x5418ed[_0x3116('0x33')]=_[_0x3116('0x34')](_0x5418ed[_0x3116('0x31')],_0x5418ed[_0x3116('0x32')]);_0x168551[_0x3116('0x35')]=_['intersection'](_0x5418ed['model'],qs['fields'](_0x31dbd1[_0x3116('0x32')][_0x3116('0x36')]));_0x168551[_0x3116('0x35')]=_0x168551['attributes'][_0x3116('0x37')]?_0x168551[_0x3116('0x35')]:_0x5418ed['model'];if(!_0x31dbd1[_0x3116('0x32')][_0x3116('0x38')]('nolimit')){_0x168551['limit']=qs['limit'](_0x31dbd1[_0x3116('0x32')][_0x3116('0x1b')]);_0x168551[_0x3116('0x1d')]=qs[_0x3116('0x1d')](_0x31dbd1[_0x3116('0x32')][_0x3116('0x1d')]);}_0x168551[_0x3116('0x39')]=qs[_0x3116('0x3a')](_0x31dbd1[_0x3116('0x32')][_0x3116('0x3a')]);_0x168551['where']=qs['filters'](_[_0x3116('0x3b')](_0x31dbd1[_0x3116('0x32')],_0x5418ed[_0x3116('0x33')]),_0xfcc1b8);if(_0x31dbd1[_0x3116('0x32')]['filter']){_0x168551['where']=_[_0x3116('0x3c')](_0x168551[_0x3116('0x3d')],{'$or':_[_0x3116('0x2b')](_0xfcc1b8,function(_0x16fcb9){if(_0x16fcb9[_0x3116('0x2f')]!==_0x3116('0x3e')){var _0x4ac0ac={};_0x4ac0ac[_0x16fcb9[_0x3116('0x28')]]={'$like':'%'+_0x31dbd1[_0x3116('0x32')]['filter']+'%'};return _0x4ac0ac;}})});}_0x168551=_[_0x3116('0x3c')]({},_0x168551,_0x31dbd1[_0x3116('0x3f')]);var _0x4bc299={'where':_0x168551[_0x3116('0x3d')]};return db[_0x3116('0x2c')][_0x3116('0x1c')](_0x4bc299)['then'](function(_0x422323){_0x3459f0[_0x3116('0x1c')]=_0x422323;if(_0x31dbd1[_0x3116('0x32')][_0x3116('0x40')]){_0x168551[_0x3116('0x41')]=[{'all':!![]}];}return db[_0x3116('0x2c')][_0x3116('0x42')](_0x168551);})['then'](function(_0x80f875){_0x3459f0[_0x3116('0x43')]=_0x80f875;return _0x3459f0;})[_0x3116('0x24')](respondWithFilteredResult(_0x5a4332,_0x168551))[_0x3116('0x44')](handleError(_0x5a4332,null));};exports[_0x3116('0x45')]=function(_0x27a122,_0x50c6a0){var _0x11c7f0={'raw':![],'where':{'id':_0x27a122['params']['id']}},_0x3708f4={};_0x3708f4['model']=_['keys'](db[_0x3116('0x2c')][_0x3116('0x2d')]);_0x3708f4[_0x3116('0x32')]=_[_0x3116('0x46')](_0x27a122[_0x3116('0x32')]);_0x3708f4[_0x3116('0x33')]=_[_0x3116('0x34')](_0x3708f4['model'],_0x3708f4[_0x3116('0x32')]);_0x11c7f0[_0x3116('0x35')]=_[_0x3116('0x34')](_0x3708f4[_0x3116('0x31')],qs['fields'](_0x27a122['query'][_0x3116('0x36')]));_0x11c7f0['attributes']=_0x11c7f0['attributes'][_0x3116('0x37')]?_0x11c7f0[_0x3116('0x35')]:_0x3708f4['model'];if(_0x27a122[_0x3116('0x32')][_0x3116('0x40')]){_0x11c7f0[_0x3116('0x41')]=[{'all':!![]}];}_0x11c7f0=_[_0x3116('0x3c')]({},_0x11c7f0,_0x27a122[_0x3116('0x3f')]);return db[_0x3116('0x2c')][_0x3116('0x47')](_0x11c7f0)['then'](handleEntityNotFound(_0x50c6a0,null))[_0x3116('0x24')](respondWithResult(_0x50c6a0,null))[_0x3116('0x44')](handleError(_0x50c6a0,null));};exports[_0x3116('0x48')]=function(_0x7973da,_0x4c3790){return db[_0x3116('0x2c')][_0x3116('0x48')](_0x7973da[_0x3116('0x49')],{})[_0x3116('0x24')](respondWithResult(_0x4c3790,0xc9))['catch'](handleError(_0x4c3790,null));};exports[_0x3116('0x23')]=function(_0x5802c3,_0x75c087){if(_0x5802c3['body']['id']){delete _0x5802c3[_0x3116('0x49')]['id'];}return db['ServicenowConfiguration'][_0x3116('0x47')]({'where':{'id':_0x5802c3[_0x3116('0x4a')]['id']}})[_0x3116('0x24')](handleEntityNotFound(_0x75c087,null))[_0x3116('0x24')](saveUpdates(_0x5802c3[_0x3116('0x49')],null))[_0x3116('0x24')](respondWithResult(_0x75c087,null))['catch'](handleError(_0x75c087,null));};exports['destroy']=function(_0x3553ae,_0x50ae52){return db[_0x3116('0x2c')]['find']({'where':{'id':_0x3553ae['params']['id']}})['then'](handleEntityNotFound(_0x50ae52,null))['then'](removeEntity(_0x50ae52,null))[_0x3116('0x44')](handleError(_0x50ae52,null));};exports[_0x3116('0x4b')]=function(_0x5590d9,_0x1a88e0,_0x202708){var _0x48f5bc={};var _0x4b2009={};var _0x4b4158;var _0x38d515;return db[_0x3116('0x2c')][_0x3116('0x4c')]({'where':{'id':_0x5590d9[_0x3116('0x4a')]['id']}})[_0x3116('0x24')](handleEntityNotFound(_0x1a88e0,null))[_0x3116('0x24')](function(_0x11eb4a){if(_0x11eb4a){_0x4b4158=_0x11eb4a;_0x4b2009['model']=_[_0x3116('0x46')](db[_0x3116('0x4d')][_0x3116('0x2d')]);_0x4b2009['query']=_['keys'](_0x5590d9[_0x3116('0x32')]);_0x4b2009['filters']=_[_0x3116('0x34')](_0x4b2009[_0x3116('0x31')],_0x4b2009[_0x3116('0x32')]);_0x48f5bc[_0x3116('0x35')]=_['intersection'](_0x4b2009[_0x3116('0x31')],qs['fields'](_0x5590d9[_0x3116('0x32')][_0x3116('0x36')]));_0x48f5bc['attributes']=_0x48f5bc[_0x3116('0x35')][_0x3116('0x37')]?_0x48f5bc[_0x3116('0x35')]:_0x4b2009[_0x3116('0x31')];_0x48f5bc[_0x3116('0x39')]=qs[_0x3116('0x3a')](_0x5590d9[_0x3116('0x32')]['sort']);_0x48f5bc[_0x3116('0x3d')]=qs[_0x3116('0x33')](_[_0x3116('0x3b')](_0x5590d9[_0x3116('0x32')],_0x4b2009['filters']));if(_0x5590d9[_0x3116('0x32')][_0x3116('0x4e')]){_0x48f5bc[_0x3116('0x3d')]=_[_0x3116('0x3c')](_0x48f5bc['where'],{'$or':_[_0x3116('0x2b')](_0x48f5bc[_0x3116('0x35')],function(_0x14e5f4){var _0x45f34b={};_0x45f34b[_0x14e5f4]={'$like':'%'+_0x5590d9[_0x3116('0x32')][_0x3116('0x4e')]+'%'};return _0x45f34b;})});}_0x48f5bc=_[_0x3116('0x3c')]({},_0x48f5bc,_0x5590d9[_0x3116('0x3f')]);return _0x4b4158[_0x3116('0x4b')](_0x48f5bc);}})[_0x3116('0x24')](function(_0x4d2cb6){if(_0x4d2cb6){_0x38d515=_0x4d2cb6[_0x3116('0x37')];if(!_0x5590d9[_0x3116('0x32')][_0x3116('0x38')](_0x3116('0x4f'))){_0x48f5bc[_0x3116('0x1b')]=qs[_0x3116('0x1b')](_0x5590d9[_0x3116('0x32')][_0x3116('0x1b')]);_0x48f5bc[_0x3116('0x1d')]=qs[_0x3116('0x1d')](_0x5590d9['query']['offset']);}return _0x4b4158[_0x3116('0x4b')](_0x48f5bc);}})[_0x3116('0x24')](function(_0x5d942a){if(_0x5d942a){return _0x5d942a?{'count':_0x38d515,'rows':_0x5d942a}:null;}})[_0x3116('0x24')](respondWithResult(_0x1a88e0,null))['catch'](handleError(_0x1a88e0,null));};exports['getSubjects']=function(_0x3db9de,_0x1086ac,_0x372abe){var _0x1ed1af={};var _0x4a2e4e={};var _0x3d7e54;var _0x576f33;return db[_0x3116('0x2c')]['findOne']({'where':{'id':_0x3db9de[_0x3116('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1086ac,null))[_0x3116('0x24')](function(_0x490f45){if(_0x490f45){_0x3d7e54=_0x490f45;_0x4a2e4e['model']=_[_0x3116('0x46')](db[_0x3116('0x4d')][_0x3116('0x2d')]);_0x4a2e4e[_0x3116('0x32')]=_[_0x3116('0x46')](_0x3db9de[_0x3116('0x32')]);_0x4a2e4e[_0x3116('0x33')]=_[_0x3116('0x34')](_0x4a2e4e[_0x3116('0x31')],_0x4a2e4e[_0x3116('0x32')]);_0x1ed1af['attributes']=_[_0x3116('0x34')](_0x4a2e4e['model'],qs['fields'](_0x3db9de[_0x3116('0x32')][_0x3116('0x36')]));_0x1ed1af['attributes']=_0x1ed1af[_0x3116('0x35')][_0x3116('0x37')]?_0x1ed1af[_0x3116('0x35')]:_0x4a2e4e['model'];_0x1ed1af[_0x3116('0x39')]=qs[_0x3116('0x3a')](_0x3db9de['query']['sort']);_0x1ed1af['where']=qs['filters'](_['pick'](_0x3db9de[_0x3116('0x32')],_0x4a2e4e['filters']));if(_0x3db9de['query'][_0x3116('0x4e')]){_0x1ed1af[_0x3116('0x3d')]=_[_0x3116('0x3c')](_0x1ed1af[_0x3116('0x3d')],{'$or':_['map'](_0x1ed1af[_0x3116('0x35')],function(_0x331513){var _0x16d4a6={};_0x16d4a6[_0x331513]={'$like':'%'+_0x3db9de['query']['filter']+'%'};return _0x16d4a6;})});}_0x1ed1af=_[_0x3116('0x3c')]({},_0x1ed1af,_0x3db9de[_0x3116('0x3f')]);return _0x3d7e54[_0x3116('0x50')](_0x1ed1af);}})['then'](function(_0x9ea56c){if(_0x9ea56c){_0x576f33=_0x9ea56c['length'];if(!_0x3db9de[_0x3116('0x32')][_0x3116('0x38')](_0x3116('0x4f'))){_0x1ed1af['limit']=qs[_0x3116('0x1b')](_0x3db9de['query']['limit']);_0x1ed1af['offset']=qs['offset'](_0x3db9de['query'][_0x3116('0x1d')]);}return _0x3d7e54[_0x3116('0x50')](_0x1ed1af);}})[_0x3116('0x24')](function(_0xd7f338){if(_0xd7f338){return _0xd7f338?{'count':_0x576f33,'rows':_0xd7f338}:null;}})[_0x3116('0x24')](respondWithResult(_0x1086ac,null))[_0x3116('0x44')](handleError(_0x1086ac,null));};exports['getDescriptions']=function(_0x16c5d7,_0x4f970b,_0x486d6a){var _0xbcdcbb={};var _0x146f53={};var _0x1a8687;var _0x1dd838;return db['ServicenowConfiguration'][_0x3116('0x4c')]({'where':{'id':_0x16c5d7[_0x3116('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f970b,null))[_0x3116('0x24')](function(_0x1a1377){if(_0x1a1377){_0x1a8687=_0x1a1377;_0x146f53[_0x3116('0x31')]=_[_0x3116('0x46')](db[_0x3116('0x4d')][_0x3116('0x2d')]);_0x146f53[_0x3116('0x32')]=_[_0x3116('0x46')](_0x16c5d7[_0x3116('0x32')]);_0x146f53['filters']=_['intersection'](_0x146f53['model'],_0x146f53[_0x3116('0x32')]);_0xbcdcbb[_0x3116('0x35')]=_[_0x3116('0x34')](_0x146f53['model'],qs['fields'](_0x16c5d7[_0x3116('0x32')][_0x3116('0x36')]));_0xbcdcbb[_0x3116('0x35')]=_0xbcdcbb[_0x3116('0x35')][_0x3116('0x37')]?_0xbcdcbb[_0x3116('0x35')]:_0x146f53[_0x3116('0x31')];_0xbcdcbb[_0x3116('0x39')]=qs['sort'](_0x16c5d7[_0x3116('0x32')]['sort']);_0xbcdcbb[_0x3116('0x3d')]=qs[_0x3116('0x33')](_[_0x3116('0x3b')](_0x16c5d7[_0x3116('0x32')],_0x146f53[_0x3116('0x33')]));if(_0x16c5d7[_0x3116('0x32')][_0x3116('0x4e')]){_0xbcdcbb[_0x3116('0x3d')]=_[_0x3116('0x3c')](_0xbcdcbb['where'],{'$or':_[_0x3116('0x2b')](_0xbcdcbb[_0x3116('0x35')],function(_0x35e354){var _0x2c273c={};_0x2c273c[_0x35e354]={'$like':'%'+_0x16c5d7[_0x3116('0x32')][_0x3116('0x4e')]+'%'};return _0x2c273c;})});}_0xbcdcbb=_[_0x3116('0x3c')]({},_0xbcdcbb,_0x16c5d7['options']);return _0x1a8687[_0x3116('0x51')](_0xbcdcbb);}})[_0x3116('0x24')](function(_0xa9e131){if(_0xa9e131){_0x1dd838=_0xa9e131[_0x3116('0x37')];if(!_0x16c5d7['query'][_0x3116('0x38')](_0x3116('0x4f'))){_0xbcdcbb[_0x3116('0x1b')]=qs[_0x3116('0x1b')](_0x16c5d7[_0x3116('0x32')][_0x3116('0x1b')]);_0xbcdcbb[_0x3116('0x1d')]=qs[_0x3116('0x1d')](_0x16c5d7[_0x3116('0x32')][_0x3116('0x1d')]);}return _0x1a8687[_0x3116('0x51')](_0xbcdcbb);}})['then'](function(_0x15091b){if(_0x15091b){return _0x15091b?{'count':_0x1dd838,'rows':_0x15091b}:null;}})[_0x3116('0x24')](respondWithResult(_0x4f970b,null))['catch'](handleError(_0x4f970b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 97aea9b..7eb18e6 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 _0x2250=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash'];(function(_0x33a47b,_0x25022a){var _0x3164d0=function(_0x1f070f){while(--_0x1f070f){_0x33a47b['push'](_0x33a47b['shift']());}};_0x3164d0(++_0x25022a);}(_0x2250,0x178));var _0x0225=function(_0x4c6eaa,_0x391f8b){_0x4c6eaa=_0x4c6eaa-0x0;var _0x403439=_0x2250[_0x4c6eaa];return _0x403439;};'use strict';var _=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var logger=require(_0x0225('0x2'))(_0x0225('0x3'));var moment=require(_0x0225('0x4'));var BPromise=require(_0x0225('0x5'));var rp=require(_0x0225('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0225('0x7'));var config=require(_0x0225('0x8'));var attributes=require(_0x0225('0x9'));module[_0x0225('0xa')]=function(_0x3d3895,_0x3779fe){return _0x3d3895[_0x0225('0xb')](_0x0225('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x27582d,_0x380a8f){var _0x45efaf=function(_0x2102fb){while(--_0x2102fb){_0x27582d['push'](_0x27582d['shift']());}};_0x45efaf(++_0x380a8f);}(_0xb5fa,0xf8));var _0xab5f=function(_0x3b0a9f,_0x4f219a){_0x3b0a9f=_0x3b0a9f-0x0;var _0x1b6eb2=_0xb5fa[_0x3b0a9f];return _0x1b6eb2;};'use strict';var _=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var logger=require(_0xab5f('0x2'))(_0xab5f('0x3'));var moment=require(_0xab5f('0x4'));var BPromise=require(_0xab5f('0x5'));var rp=require(_0xab5f('0x6'));var fs=require('fs');var path=require(_0xab5f('0x7'));var rimraf=require(_0xab5f('0x8'));var config=require(_0xab5f('0x9'));var attributes=require(_0xab5f('0xa'));module[_0xab5f('0xb')]=function(_0x52f546,_0x4b40ca){return _0x52f546['define'](_0xab5f('0xc'),attributes,{'tableName':_0xab5f('0xd'),'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 25a43c7..349f831 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 _0xe74d=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','stringify','ServicenowConfiguration,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x2ce49f,_0x47401b){var _0x58a4c7=function(_0x193143){while(--_0x193143){_0x2ce49f['push'](_0x2ce49f['shift']());}};_0x58a4c7(++_0x47401b);}(_0xe74d,0x1a0));var _0xde74=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xe74d[_0x599c94];return _0x34e215;};'use strict';var _=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var moment=require(_0xde74('0x2'));var BPromise=require(_0xde74('0x3'));var rs=require(_0xde74('0x4'));var fs=require('fs');var Redis=require(_0xde74('0x5'));var db=require(_0xde74('0x6'))['db'];var utils=require(_0xde74('0x7'));var logger=require('../../config/logger')(_0xde74('0x8'));var config=require(_0xde74('0x9'));var jayson=require(_0xde74('0xa'));var client=jayson[_0xde74('0xb')][_0xde74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5aa72e,_0x3e60db,_0x16bef0){return new BPromise(function(_0x4bb9a1,_0x5cb067){return client['request'](_0x5aa72e,_0x16bef0)['then'](function(_0x1f23d4){logger[_0xde74('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e60db,_0xde74('0xe'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3e60db,_0xde74('0xe'),JSON[_0xde74('0xf')](_0x1f23d4));if(_0x1f23d4['error']){if(_0x1f23d4['error']['code']===0x1f4){logger['error'](_0xde74('0x10'),_0x3e60db,_0x1f23d4[_0xde74('0x11')][_0xde74('0x12')]);return _0x5cb067(_0x1f23d4[_0xde74('0x11')][_0xde74('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x3e60db,_0x1f23d4[_0xde74('0x11')][_0xde74('0x12')]);return _0x4bb9a1(_0x1f23d4['error'][_0xde74('0x12')]);}else{logger[_0xde74('0xd')](_0xde74('0x10'),_0x3e60db,_0xde74('0xe'));_0x4bb9a1(_0x1f23d4['result'][_0xde74('0x12')]);}})[_0xde74('0x13')](function(_0x3d8e62){logger[_0xde74('0x11')](_0xde74('0x10'),_0x3e60db,_0x3d8e62);_0x5cb067(_0x3d8e62);});});} \ No newline at end of file +var _0x7e89=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x204778,_0x5d1e09){var _0x25ee8b=function(_0x3c4b5a){while(--_0x3c4b5a){_0x204778['push'](_0x204778['shift']());}};_0x25ee8b(++_0x5d1e09);}(_0x7e89,0x1bf));var _0x97e8=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0x7e89[_0x595151];return _0x5776df;};'use strict';var _=require(_0x97e8('0x0'));var util=require(_0x97e8('0x1'));var moment=require(_0x97e8('0x2'));var BPromise=require(_0x97e8('0x3'));var rs=require(_0x97e8('0x4'));var fs=require('fs');var Redis=require(_0x97e8('0x5'));var db=require(_0x97e8('0x6'))['db'];var utils=require(_0x97e8('0x7'));var logger=require(_0x97e8('0x8'))('rpc');var config=require(_0x97e8('0x9'));var jayson=require(_0x97e8('0xa'));var client=jayson[_0x97e8('0xb')][_0x97e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a5bc2,_0x7b4c6,_0x27763c){return new BPromise(function(_0x4dd624,_0x49f69d){return client[_0x97e8('0xd')](_0x1a5bc2,_0x27763c)[_0x97e8('0xe')](function(_0x440bdf){logger[_0x97e8('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x7b4c6,_0x97e8('0x10'));logger['debug'](_0x97e8('0x11'),_0x7b4c6,_0x97e8('0x10'),JSON[_0x97e8('0x12')](_0x440bdf));if(_0x440bdf[_0x97e8('0x13')]){if(_0x440bdf[_0x97e8('0x13')][_0x97e8('0x14')]===0x1f4){logger['error'](_0x97e8('0x15'),_0x7b4c6,_0x440bdf[_0x97e8('0x13')][_0x97e8('0x16')]);return _0x49f69d(_0x440bdf[_0x97e8('0x13')][_0x97e8('0x16')]);}logger['error'](_0x97e8('0x15'),_0x7b4c6,_0x440bdf[_0x97e8('0x13')]['message']);return _0x4dd624(_0x440bdf['error'][_0x97e8('0x16')]);}else{logger['info'](_0x97e8('0x15'),_0x7b4c6,_0x97e8('0x10'));_0x4dd624(_0x440bdf['result'][_0x97e8('0x16')]);}})[_0x97e8('0x17')](function(_0x341f7c){logger['error'](_0x97e8('0x15'),_0x7b4c6,_0x341f7c);_0x49f69d(_0x341f7c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b31dd5a..709dc68 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 _0xd977=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x281925,_0x508353){var _0xf5687b=function(_0x14abdb){while(--_0x14abdb){_0x281925['push'](_0x281925['shift']());}};_0xf5687b(++_0x508353);}(_0xd977,0x1df));var _0x7d97=function(_0x35c16d,_0x29641a){_0x35c16d=_0x35c16d-0x0;var _0x2117c3=_0xd977[_0x35c16d];return _0x2117c3;};'use strict';var multer=require('multer');var util=require(_0x7d97('0x0'));var path=require(_0x7d97('0x1'));var timeout=require(_0x7d97('0x2'));var express=require(_0x7d97('0x3'));var router=express[_0x7d97('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7d97('0x5'));var interaction=require(_0x7d97('0x6'));var config=require(_0x7d97('0x7'));var controller=require(_0x7d97('0x8'));router[_0x7d97('0x9')]('/',auth[_0x7d97('0xa')](),controller['index']);router[_0x7d97('0x9')](_0x7d97('0xb'),auth[_0x7d97('0xa')](),controller[_0x7d97('0xc')]);router[_0x7d97('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7d97('0xe')](_0x7d97('0xb'),auth[_0x7d97('0xa')](),controller[_0x7d97('0xf')]);router['delete']('/:id',auth[_0x7d97('0xa')](),controller[_0x7d97('0x10')]);module[_0x7d97('0x11')]=router; \ No newline at end of file +var _0x3cdd=['exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./intServicenowField.controller','index','show','post','isAuthenticated','put','update','delete','destroy'];(function(_0x4c4539,_0x3f1c19){var _0x3f01c5=function(_0x3e562f){while(--_0x3e562f){_0x4c4539['push'](_0x4c4539['shift']());}};_0x3f01c5(++_0x3f1c19);}(_0x3cdd,0x1b1));var _0xd3cd=function(_0x3fe7e6,_0x1c8fd2){_0x3fe7e6=_0x3fe7e6-0x0;var _0x2af697=_0x3cdd[_0x3fe7e6];return _0x2af697;};'use strict';var multer=require(_0xd3cd('0x0'));var util=require('util');var path=require(_0xd3cd('0x1'));var timeout=require(_0xd3cd('0x2'));var express=require(_0xd3cd('0x3'));var router=express['Router']();var fs_extra=require(_0xd3cd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3cd('0x5'));var controller=require(_0xd3cd('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3cd('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd3cd('0x8')]);router[_0xd3cd('0x9')]('/',auth[_0xd3cd('0xa')](),controller['create']);router[_0xd3cd('0xb')]('/:id',auth[_0xd3cd('0xa')](),controller[_0xd3cd('0xc')]);router[_0xd3cd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd3cd('0xe')]);module[_0xd3cd('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 63cec0c..a804a21 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 _0x5682=['customVariable','exports','ENUM','string','variable','picklist','STRING'];(function(_0x5e8123,_0x53bb17){var _0x5b3c1b=function(_0x1be8bb){while(--_0x1be8bb){_0x5e8123['push'](_0x5e8123['shift']());}};_0x5b3c1b(++_0x53bb17);}(_0x5682,0xa9));var _0x2568=function(_0x5016c4,_0x2bbe08){_0x5016c4=_0x5016c4-0x0;var _0x2b1703=_0x5682[_0x5016c4];return _0x2b1703;};'use strict';var Sequelize=require('sequelize');module[_0x2568('0x0')]={'type':{'type':Sequelize[_0x2568('0x1')](_0x2568('0x2'),_0x2568('0x3'),'customVariable','keyValue',_0x2568('0x4')),'defaultValue':_0x2568('0x2')},'content':{'type':Sequelize[_0x2568('0x5')]},'key':{'type':Sequelize[_0x2568('0x5')]},'keyType':{'type':Sequelize[_0x2568('0x1')](_0x2568('0x2'),_0x2568('0x3'),_0x2568('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2568('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2568('0x5')]}}; \ No newline at end of file +var _0x6ae5=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x6ae5,0x1db));var _0x56ae=function(_0x5af519,_0x3bc05a){_0x5af519=_0x5af519-0x0;var _0x16d171=_0x6ae5[_0x5af519];return _0x16d171;};'use strict';var Sequelize=require(_0x56ae('0x0'));module[_0x56ae('0x1')]={'type':{'type':Sequelize[_0x56ae('0x2')](_0x56ae('0x3'),'variable',_0x56ae('0x4'),_0x56ae('0x5'),_0x56ae('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x56ae('0x7')]},'keyType':{'type':Sequelize[_0x56ae('0x2')](_0x56ae('0x3'),_0x56ae('0x8'),_0x56ae('0x4'))},'keyContent':{'type':Sequelize[_0x56ae('0x7')]},'idField':{'type':Sequelize[_0x56ae('0x7')]},'nameField':{'type':Sequelize[_0x56ae('0x7')]},'customField':{'type':Sequelize[_0x56ae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x56ae('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f1468ab..a44b022 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 _0x8ab3=['destroy','sendStatus','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then'];(function(_0x2d1949,_0x308dac){var _0x15cd27=function(_0x36e285){while(--_0x36e285){_0x2d1949['push'](_0x2d1949['shift']());}};_0x15cd27(++_0x308dac);}(_0x8ab3,0xab));var _0x38ab=function(_0x3937e7,_0x91712b){_0x3937e7=_0x3937e7-0x0;var _0x197ad7=_0x8ab3[_0x3937e7];return _0x197ad7;};'use strict';var emlformat=require(_0x38ab('0x0'));var rimraf=require(_0x38ab('0x1'));var zipdir=require(_0x38ab('0x2'));var jsonpatch=require(_0x38ab('0x3'));var rp=require(_0x38ab('0x4'));var moment=require(_0x38ab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38ab('0x6'));var util=require(_0x38ab('0x7'));var path=require(_0x38ab('0x8'));var sox=require('sox');var csv=require(_0x38ab('0x9'));var ejs=require(_0x38ab('0xa'));var fs=require('fs');var fs_extra=require(_0x38ab('0xb'));var _=require('lodash');var squel=require(_0x38ab('0xc'));var crypto=require(_0x38ab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38ab('0xe'));var toCsv=require(_0x38ab('0x9'));var querystring=require(_0x38ab('0xf'));var Papa=require(_0x38ab('0x10'));var Redis=require('ioredis');var authService=require(_0x38ab('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38ab('0x12'));var logger=require(_0x38ab('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38ab('0x14'))['db'];function respondWithStatusCode(_0x3adcca,_0x913d5a){_0x913d5a=_0x913d5a||0xcc;return function(_0x5ba8b4){if(_0x5ba8b4){return _0x3adcca['sendStatus'](_0x913d5a);}return _0x3adcca[_0x38ab('0x15')](_0x913d5a)[_0x38ab('0x16')]();};}function respondWithResult(_0x2037ad,_0x5560a8){_0x5560a8=_0x5560a8||0xc8;return function(_0x42612b){if(_0x42612b){return _0x2037ad[_0x38ab('0x15')](_0x5560a8)['json'](_0x42612b);}};}function respondWithFilteredResult(_0x41bb93,_0x41b6de){return function(_0x437f05){if(_0x437f05){var _0x2cf10f=typeof _0x41b6de[_0x38ab('0x17')]==='undefined'&&typeof _0x41b6de[_0x38ab('0x18')]===_0x38ab('0x19');var _0x270284=_0x437f05[_0x38ab('0x1a')];var _0x5a0303=_0x2cf10f?0x0:_0x41b6de[_0x38ab('0x17')];var _0x3e70f1=_0x2cf10f?_0x437f05[_0x38ab('0x1a')]:_0x41b6de[_0x38ab('0x17')]+_0x41b6de[_0x38ab('0x18')];var _0xcfae72;if(_0x3e70f1>=_0x270284){_0x3e70f1=_0x270284;_0xcfae72=0xc8;}else{_0xcfae72=0xce;}_0x41bb93[_0x38ab('0x15')](_0xcfae72);return _0x41bb93[_0x38ab('0x1b')](_0x38ab('0x1c'),_0x5a0303+'-'+_0x3e70f1+'/'+_0x270284)[_0x38ab('0x1d')](_0x437f05);}return null;};}function patchUpdates(_0x3b7a14){return function(_0x3f4fda){try{jsonpatch['apply'](_0x3f4fda,_0x3b7a14,!![]);}catch(_0x4257cc){return BPromise[_0x38ab('0x1e')](_0x4257cc);}return _0x3f4fda['save']();};}function saveUpdates(_0x2abba3,_0x20b7e0){return function(_0x3abc84){if(_0x3abc84){return _0x3abc84[_0x38ab('0x1f')](_0x2abba3)[_0x38ab('0x20')](function(_0x1279cb){return _0x1279cb;});}return null;};}function removeEntity(_0x175eb4,_0x4216f2){return function(_0x55b5f1){if(_0x55b5f1){return _0x55b5f1[_0x38ab('0x21')]()[_0x38ab('0x20')](function(){_0x175eb4['status'](0xcc)[_0x38ab('0x16')]();});}};}function handleEntityNotFound(_0x3f6705,_0x5a77c8){return function(_0x2fc826){if(!_0x2fc826){_0x3f6705[_0x38ab('0x22')](0x194);}return _0x2fc826;};}function handleError(_0x1b6c44,_0x2a1e74){_0x2a1e74=_0x2a1e74||0x1f4;return function(_0x51b26d){logger['error'](_0x51b26d[_0x38ab('0x23')]);if(_0x51b26d[_0x38ab('0x24')]){delete _0x51b26d[_0x38ab('0x24')];}_0x1b6c44[_0x38ab('0x15')](_0x2a1e74)['send'](_0x51b26d);};}exports['index']=function(_0x1cbfdd,_0xe2b4d6){var _0xe8392e={},_0x58416d={},_0x43d812={'count':0x0,'rows':[]};var _0x454b2b=_[_0x38ab('0x25')](db[_0x38ab('0x26')][_0x38ab('0x27')],function(_0x4c9ee0){return{'name':_0x4c9ee0[_0x38ab('0x28')],'type':_0x4c9ee0[_0x38ab('0x29')][_0x38ab('0x2a')]};});_0x58416d[_0x38ab('0x2b')]=_[_0x38ab('0x25')](_0x454b2b,'name');_0x58416d[_0x38ab('0x2c')]=_[_0x38ab('0x2d')](_0x1cbfdd['query']);_0x58416d[_0x38ab('0x2e')]=_['intersection'](_0x58416d['model'],_0x58416d[_0x38ab('0x2c')]);_0xe8392e[_0x38ab('0x2f')]=_[_0x38ab('0x30')](_0x58416d[_0x38ab('0x2b')],qs[_0x38ab('0x31')](_0x1cbfdd['query']['fields']));_0xe8392e[_0x38ab('0x2f')]=_0xe8392e['attributes'][_0x38ab('0x32')]?_0xe8392e['attributes']:_0x58416d[_0x38ab('0x2b')];if(!_0x1cbfdd[_0x38ab('0x2c')][_0x38ab('0x33')](_0x38ab('0x34'))){_0xe8392e['limit']=qs[_0x38ab('0x18')](_0x1cbfdd['query'][_0x38ab('0x18')]);_0xe8392e[_0x38ab('0x17')]=qs['offset'](_0x1cbfdd['query'][_0x38ab('0x17')]);}_0xe8392e[_0x38ab('0x35')]=qs[_0x38ab('0x36')](_0x1cbfdd['query']['sort']);_0xe8392e['where']=qs[_0x38ab('0x2e')](_[_0x38ab('0x37')](_0x1cbfdd['query'],_0x58416d['filters']),_0x454b2b);if(_0x1cbfdd[_0x38ab('0x2c')][_0x38ab('0x38')]){_0xe8392e[_0x38ab('0x39')]=_['merge'](_0xe8392e['where'],{'$or':_[_0x38ab('0x25')](_0x454b2b,function(_0x48bd4d){if(_0x48bd4d[_0x38ab('0x29')]!=='VIRTUAL'){var _0x423bcc={};_0x423bcc[_0x48bd4d[_0x38ab('0x24')]]={'$like':'%'+_0x1cbfdd[_0x38ab('0x2c')]['filter']+'%'};return _0x423bcc;}})});}_0xe8392e=_[_0x38ab('0x3a')]({},_0xe8392e,_0x1cbfdd[_0x38ab('0x3b')]);var _0x5da443={'where':_0xe8392e[_0x38ab('0x39')]};return db[_0x38ab('0x26')][_0x38ab('0x1a')](_0x5da443)[_0x38ab('0x20')](function(_0x166cf3){_0x43d812[_0x38ab('0x1a')]=_0x166cf3;if(_0x1cbfdd[_0x38ab('0x2c')][_0x38ab('0x3c')]){_0xe8392e['include']=[{'all':!![]}];}return db[_0x38ab('0x26')][_0x38ab('0x3d')](_0xe8392e);})[_0x38ab('0x20')](function(_0x54e1d4){_0x43d812['rows']=_0x54e1d4;return _0x43d812;})[_0x38ab('0x20')](respondWithFilteredResult(_0xe2b4d6,_0xe8392e))[_0x38ab('0x3e')](handleError(_0xe2b4d6,null));};exports[_0x38ab('0x3f')]=function(_0x1d4180,_0x412995){var _0x45a6f9={'raw':!![],'where':{'id':_0x1d4180[_0x38ab('0x40')]['id']}},_0x92afbd={};_0x92afbd['model']=_[_0x38ab('0x2d')](db[_0x38ab('0x26')][_0x38ab('0x27')]);_0x92afbd[_0x38ab('0x2c')]=_[_0x38ab('0x2d')](_0x1d4180[_0x38ab('0x2c')]);_0x92afbd['filters']=_[_0x38ab('0x30')](_0x92afbd['model'],_0x92afbd[_0x38ab('0x2c')]);_0x45a6f9[_0x38ab('0x2f')]=_[_0x38ab('0x30')](_0x92afbd[_0x38ab('0x2b')],qs[_0x38ab('0x31')](_0x1d4180['query'][_0x38ab('0x31')]));_0x45a6f9[_0x38ab('0x2f')]=_0x45a6f9[_0x38ab('0x2f')][_0x38ab('0x32')]?_0x45a6f9[_0x38ab('0x2f')]:_0x92afbd['model'];if(_0x1d4180[_0x38ab('0x2c')]['includeAll']){_0x45a6f9['include']=[{'all':!![]}];}_0x45a6f9=_['merge']({},_0x45a6f9,_0x1d4180[_0x38ab('0x3b')]);return db[_0x38ab('0x26')][_0x38ab('0x41')](_0x45a6f9)[_0x38ab('0x20')](handleEntityNotFound(_0x412995,null))[_0x38ab('0x20')](respondWithResult(_0x412995,null))[_0x38ab('0x3e')](handleError(_0x412995,null));};exports[_0x38ab('0x42')]=function(_0x11e499,_0x5213a0){return db[_0x38ab('0x26')][_0x38ab('0x42')](_0x11e499['body'],{})[_0x38ab('0x20')](respondWithResult(_0x5213a0,0xc9))[_0x38ab('0x3e')](handleError(_0x5213a0,null));};exports[_0x38ab('0x1f')]=function(_0xbaa135,_0x3e28db){if(_0xbaa135[_0x38ab('0x43')]['id']){delete _0xbaa135[_0x38ab('0x43')]['id'];}return db['ServicenowField'][_0x38ab('0x41')]({'where':{'id':_0xbaa135['params']['id']}})['then'](handleEntityNotFound(_0x3e28db,null))['then'](saveUpdates(_0xbaa135['body'],null))['then'](respondWithResult(_0x3e28db,null))[_0x38ab('0x3e')](handleError(_0x3e28db,null));};exports[_0x38ab('0x21')]=function(_0x28ed6f,_0x5bab39){return db[_0x38ab('0x26')][_0x38ab('0x41')]({'where':{'id':_0x28ed6f[_0x38ab('0x40')]['id']}})[_0x38ab('0x20')](handleEntityNotFound(_0x5bab39,null))[_0x38ab('0x20')](removeEntity(_0x5bab39,null))[_0x38ab('0x3e')](handleError(_0x5bab39,null));}; \ No newline at end of file +var _0xaa79=['limit','apply','save','update','then','error','stack','send','index','map','ServicenowField','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','name','filter','options','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count'];(function(_0x117007,_0x4d3414){var _0x2e5522=function(_0x1f9459){while(--_0x1f9459){_0x117007['push'](_0x117007['shift']());}};_0x2e5522(++_0x4d3414);}(_0xaa79,0xb7));var _0x9aa7=function(_0x2b6667,_0x29cf4f){_0x2b6667=_0x2b6667-0x0;var _0x4a9c0a=_0xaa79[_0x2b6667];return _0x4a9c0a;};'use strict';var emlformat=require(_0x9aa7('0x0'));var rimraf=require(_0x9aa7('0x1'));var zipdir=require(_0x9aa7('0x2'));var jsonpatch=require(_0x9aa7('0x3'));var rp=require(_0x9aa7('0x4'));var moment=require(_0x9aa7('0x5'));var BPromise=require(_0x9aa7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9aa7('0x7'));var csv=require(_0x9aa7('0x8'));var ejs=require(_0x9aa7('0x9'));var fs=require('fs');var fs_extra=require(_0x9aa7('0xa'));var _=require(_0x9aa7('0xb'));var squel=require(_0x9aa7('0xc'));var crypto=require(_0x9aa7('0xd'));var jsforce=require(_0x9aa7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9aa7('0x8'));var querystring=require(_0x9aa7('0xf'));var Papa=require(_0x9aa7('0x10'));var Redis=require(_0x9aa7('0x11'));var authService=require(_0x9aa7('0x12'));var qs=require(_0x9aa7('0x13'));var as=require(_0x9aa7('0x14'));var hardwareService=require(_0x9aa7('0x15'));var logger=require(_0x9aa7('0x16'))(_0x9aa7('0x17'));var utils=require(_0x9aa7('0x18'));var config=require(_0x9aa7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aa7('0x1a'))['db'];function respondWithStatusCode(_0xdeb236,_0x5f5356){_0x5f5356=_0x5f5356||0xcc;return function(_0x65b363){if(_0x65b363){return _0xdeb236[_0x9aa7('0x1b')](_0x5f5356);}return _0xdeb236['status'](_0x5f5356)[_0x9aa7('0x1c')]();};}function respondWithResult(_0x48a8d7,_0x159271){_0x159271=_0x159271||0xc8;return function(_0x2bbe07){if(_0x2bbe07){return _0x48a8d7[_0x9aa7('0x1d')](_0x159271)['json'](_0x2bbe07);}};}function respondWithFilteredResult(_0x24db9d,_0x3ef2b6){return function(_0x230f0a){if(_0x230f0a){var _0x25e593=typeof _0x3ef2b6[_0x9aa7('0x1e')]===_0x9aa7('0x1f')&&typeof _0x3ef2b6['limit']===_0x9aa7('0x1f');var _0x53c1b6=_0x230f0a[_0x9aa7('0x20')];var _0x2bbc90=_0x25e593?0x0:_0x3ef2b6[_0x9aa7('0x1e')];var _0x341066=_0x25e593?_0x230f0a[_0x9aa7('0x20')]:_0x3ef2b6[_0x9aa7('0x1e')]+_0x3ef2b6[_0x9aa7('0x21')];var _0xdddbcd;if(_0x341066>=_0x53c1b6){_0x341066=_0x53c1b6;_0xdddbcd=0xc8;}else{_0xdddbcd=0xce;}_0x24db9d['status'](_0xdddbcd);return _0x24db9d['set']('Content-Range',_0x2bbc90+'-'+_0x341066+'/'+_0x53c1b6)['json'](_0x230f0a);}return null;};}function patchUpdates(_0x5f598b){return function(_0x263934){try{jsonpatch[_0x9aa7('0x22')](_0x263934,_0x5f598b,!![]);}catch(_0x455929){return BPromise['reject'](_0x455929);}return _0x263934[_0x9aa7('0x23')]();};}function saveUpdates(_0x50f2d5,_0x366adf){return function(_0x2dccda){if(_0x2dccda){return _0x2dccda[_0x9aa7('0x24')](_0x50f2d5)[_0x9aa7('0x25')](function(_0x205c52){return _0x205c52;});}return null;};}function removeEntity(_0x4aab1c,_0xec6855){return function(_0x2729d9){if(_0x2729d9){return _0x2729d9['destroy']()['then'](function(){_0x4aab1c[_0x9aa7('0x1d')](0xcc)[_0x9aa7('0x1c')]();});}};}function handleEntityNotFound(_0xe6ce7a,_0x1720b7){return function(_0x48e4c4){if(!_0x48e4c4){_0xe6ce7a[_0x9aa7('0x1b')](0x194);}return _0x48e4c4;};}function handleError(_0x3d922f,_0x381c18){_0x381c18=_0x381c18||0x1f4;return function(_0xc8ad2a){logger[_0x9aa7('0x26')](_0xc8ad2a[_0x9aa7('0x27')]);if(_0xc8ad2a['name']){delete _0xc8ad2a['name'];}_0x3d922f[_0x9aa7('0x1d')](_0x381c18)[_0x9aa7('0x28')](_0xc8ad2a);};}exports[_0x9aa7('0x29')]=function(_0x423cfb,_0x2ed6d7){var _0x535e62={},_0x2533fb={},_0x3bcafd={'count':0x0,'rows':[]};var _0x3c8a43=_[_0x9aa7('0x2a')](db[_0x9aa7('0x2b')]['rawAttributes'],function(_0x5c1086){return{'name':_0x5c1086['fieldName'],'type':_0x5c1086['type'][_0x9aa7('0x2c')]};});_0x2533fb['model']=_[_0x9aa7('0x2a')](_0x3c8a43,'name');_0x2533fb[_0x9aa7('0x2d')]=_[_0x9aa7('0x2e')](_0x423cfb[_0x9aa7('0x2d')]);_0x2533fb[_0x9aa7('0x2f')]=_[_0x9aa7('0x30')](_0x2533fb[_0x9aa7('0x31')],_0x2533fb[_0x9aa7('0x2d')]);_0x535e62[_0x9aa7('0x32')]=_[_0x9aa7('0x30')](_0x2533fb[_0x9aa7('0x31')],qs[_0x9aa7('0x33')](_0x423cfb[_0x9aa7('0x2d')][_0x9aa7('0x33')]));_0x535e62[_0x9aa7('0x32')]=_0x535e62[_0x9aa7('0x32')][_0x9aa7('0x34')]?_0x535e62[_0x9aa7('0x32')]:_0x2533fb[_0x9aa7('0x31')];if(!_0x423cfb[_0x9aa7('0x2d')][_0x9aa7('0x35')]('nolimit')){_0x535e62['limit']=qs['limit'](_0x423cfb['query'][_0x9aa7('0x21')]);_0x535e62[_0x9aa7('0x1e')]=qs[_0x9aa7('0x1e')](_0x423cfb[_0x9aa7('0x2d')]['offset']);}_0x535e62[_0x9aa7('0x36')]=qs['sort'](_0x423cfb[_0x9aa7('0x2d')][_0x9aa7('0x37')]);_0x535e62['where']=qs[_0x9aa7('0x2f')](_['pick'](_0x423cfb[_0x9aa7('0x2d')],_0x2533fb[_0x9aa7('0x2f')]),_0x3c8a43);if(_0x423cfb[_0x9aa7('0x2d')]['filter']){_0x535e62[_0x9aa7('0x38')]=_[_0x9aa7('0x39')](_0x535e62[_0x9aa7('0x38')],{'$or':_[_0x9aa7('0x2a')](_0x3c8a43,function(_0x303f09){if(_0x303f09[_0x9aa7('0x3a')]!=='VIRTUAL'){var _0x1e3810={};_0x1e3810[_0x303f09[_0x9aa7('0x3b')]]={'$like':'%'+_0x423cfb[_0x9aa7('0x2d')][_0x9aa7('0x3c')]+'%'};return _0x1e3810;}})});}_0x535e62=_['merge']({},_0x535e62,_0x423cfb[_0x9aa7('0x3d')]);var _0x287a36={'where':_0x535e62[_0x9aa7('0x38')]};return db[_0x9aa7('0x2b')]['count'](_0x287a36)[_0x9aa7('0x25')](function(_0x33af19){_0x3bcafd[_0x9aa7('0x20')]=_0x33af19;if(_0x423cfb['query'][_0x9aa7('0x3e')]){_0x535e62[_0x9aa7('0x3f')]=[{'all':!![]}];}return db[_0x9aa7('0x2b')][_0x9aa7('0x40')](_0x535e62);})[_0x9aa7('0x25')](function(_0x5bfa11){_0x3bcafd['rows']=_0x5bfa11;return _0x3bcafd;})['then'](respondWithFilteredResult(_0x2ed6d7,_0x535e62))[_0x9aa7('0x41')](handleError(_0x2ed6d7,null));};exports['show']=function(_0xc720fb,_0x2e2c1a){var _0x1259ec={'raw':!![],'where':{'id':_0xc720fb['params']['id']}},_0xdaecf4={};_0xdaecf4[_0x9aa7('0x31')]=_['keys'](db[_0x9aa7('0x2b')][_0x9aa7('0x42')]);_0xdaecf4[_0x9aa7('0x2d')]=_[_0x9aa7('0x2e')](_0xc720fb[_0x9aa7('0x2d')]);_0xdaecf4[_0x9aa7('0x2f')]=_[_0x9aa7('0x30')](_0xdaecf4[_0x9aa7('0x31')],_0xdaecf4['query']);_0x1259ec[_0x9aa7('0x32')]=_['intersection'](_0xdaecf4[_0x9aa7('0x31')],qs[_0x9aa7('0x33')](_0xc720fb['query'][_0x9aa7('0x33')]));_0x1259ec[_0x9aa7('0x32')]=_0x1259ec[_0x9aa7('0x32')][_0x9aa7('0x34')]?_0x1259ec['attributes']:_0xdaecf4[_0x9aa7('0x31')];if(_0xc720fb[_0x9aa7('0x2d')][_0x9aa7('0x3e')]){_0x1259ec[_0x9aa7('0x3f')]=[{'all':!![]}];}_0x1259ec=_['merge']({},_0x1259ec,_0xc720fb['options']);return db[_0x9aa7('0x2b')][_0x9aa7('0x43')](_0x1259ec)[_0x9aa7('0x25')](handleEntityNotFound(_0x2e2c1a,null))[_0x9aa7('0x25')](respondWithResult(_0x2e2c1a,null))[_0x9aa7('0x41')](handleError(_0x2e2c1a,null));};exports[_0x9aa7('0x44')]=function(_0x468f9e,_0x42a1c9){return db['ServicenowField'][_0x9aa7('0x44')](_0x468f9e[_0x9aa7('0x45')],{})[_0x9aa7('0x25')](respondWithResult(_0x42a1c9,0xc9))['catch'](handleError(_0x42a1c9,null));};exports[_0x9aa7('0x24')]=function(_0x4e9f32,_0x1435cd){if(_0x4e9f32[_0x9aa7('0x45')]['id']){delete _0x4e9f32[_0x9aa7('0x45')]['id'];}return db['ServicenowField'][_0x9aa7('0x43')]({'where':{'id':_0x4e9f32[_0x9aa7('0x46')]['id']}})[_0x9aa7('0x25')](handleEntityNotFound(_0x1435cd,null))[_0x9aa7('0x25')](saveUpdates(_0x4e9f32[_0x9aa7('0x45')],null))[_0x9aa7('0x25')](respondWithResult(_0x1435cd,null))['catch'](handleError(_0x1435cd,null));};exports[_0x9aa7('0x47')]=function(_0x55dfbc,_0x2667cc){return db[_0x9aa7('0x2b')]['find']({'where':{'id':_0x55dfbc[_0x9aa7('0x46')]['id']}})[_0x9aa7('0x25')](handleEntityNotFound(_0x2667cc,null))['then'](removeEntity(_0x2667cc,null))[_0x9aa7('0x41')](handleError(_0x2667cc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c8233b2..997b6f1 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 _0x85ab=['exports','define','ServicenowField','int_servicenow_fields','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x85ab,0x88));var _0xb85a=function(_0x38ecda,_0x3b551e){_0x38ecda=_0x38ecda-0x0;var _0x3fa8f3=_0x85ab[_0x38ecda];return _0x3fa8f3;};'use strict';var _=require(_0xb85a('0x0'));var util=require('util');var logger=require(_0xb85a('0x1'))(_0xb85a('0x2'));var moment=require(_0xb85a('0x3'));var BPromise=require(_0xb85a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb85a('0x5'));var config=require(_0xb85a('0x6'));var attributes=require(_0xb85a('0x7'));module[_0xb85a('0x8')]=function(_0x4bbf72,_0x53a738){return _0x4bbf72[_0xb85a('0x9')](_0xb85a('0xa'),attributes,{'tableName':_0xb85a('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6011=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','bluebird'];(function(_0x1adf90,_0x1d2f25){var _0x31545a=function(_0x284083){while(--_0x284083){_0x1adf90['push'](_0x1adf90['shift']());}};_0x31545a(++_0x1d2f25);}(_0x6011,0x196));var _0x1601=function(_0x31fc0e,_0x2fe3cf){_0x31fc0e=_0x31fc0e-0x0;var _0x36f0a9=_0x6011[_0x31fc0e];return _0x36f0a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1601('0x0'));var rp=require(_0x1601('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1601('0x2'));var config=require(_0x1601('0x3'));var attributes=require(_0x1601('0x4'));module[_0x1601('0x5')]=function(_0x3c9c29,_0x38cc43){return _0x3c9c29[_0x1601('0x6')](_0x1601('0x7'),attributes,{'tableName':_0x1601('0x8'),'paranoid':![],'indexes':[{'name':_0x1601('0x9'),'fields':['idField',_0x1601('0xa')],'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 3e53394..b4263d2 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x281b46,_0x35cc15){var _0x5836ca=function(_0x27a06f){while(--_0x27a06f){_0x281b46['push'](_0x281b46['shift']());}};_0x5836ca(++_0x35cc15);}(_0x70e0,0x17b));var _0x070e=function(_0x357dbc,_0x133e88){_0x357dbc=_0x357dbc-0x0;var _0x3f800a=_0x70e0[_0x357dbc];return _0x3f800a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x126a10,_0x7bde76){var _0x15a853=function(_0x2bd2d6){while(--_0x2bd2d6){_0x126a10['push'](_0x126a10['shift']());}};_0x15a853(++_0x7bde76);}(_0xf4eb,0xec));var _0xbf4e=function(_0x44956f,_0x55b1e3){_0x44956f=_0x44956f-0x0;var _0x5c3dcd=_0xf4eb[_0x44956f];return _0x5c3dcd;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2b3934a..7191d6c 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(_0x1ee856,_0xd5da21){var _0x1b2d34=function(_0x3bd914){while(--_0x3bd914){_0x1ee856['push'](_0x1ee856['shift']());}};_0x1b2d34(++_0xd5da21);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x1a3503,_0x3fabee){var _0x5ba1cd=function(_0x512b52){while(--_0x512b52){_0x1a3503['push'](_0x1a3503['shift']());}};_0x5ba1cd(++_0x3fabee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 835b112..ecb6a83 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(_0x19c03d,_0x477d5f){var _0x54a37f=function(_0x483b6d){while(--_0x483b6d){_0x19c03d['push'](_0x19c03d['shift']());}};_0x54a37f(++_0x477d5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x5c838f,_0x53d3e6){var _0x4e4caf=function(_0xae6da5){while(--_0xae6da5){_0x5c838f['push'](_0x5c838f['shift']());}};_0x4e4caf(++_0x53d3e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e75bf11..286c8af 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 _0x263c=['fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','fields','find','create','body','catch','params','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','POST','get_module_fields','stringify','Calls','includes','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir'];(function(_0x13182c,_0x74fb8c){var _0x1177a4=function(_0x3b5168){while(--_0x3b5168){_0x13182c['push'](_0x13182c['shift']());}};_0x1177a4(++_0x74fb8c);}(_0x263c,0x76));var _0xc263=function(_0x135d59,_0x3f9233){_0x135d59=_0x135d59-0x0;var _0xe7e1ab=_0x263c[_0x135d59];return _0xe7e1ab;};'use strict';var emlformat=require(_0xc263('0x0'));var rimraf=require(_0xc263('0x1'));var zipdir=require(_0xc263('0x2'));var jsonpatch=require(_0xc263('0x3'));var rp=require(_0xc263('0x4'));var moment=require(_0xc263('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc263('0x6'));var path=require(_0xc263('0x7'));var sox=require(_0xc263('0x8'));var csv=require(_0xc263('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc263('0xa'));var _=require(_0xc263('0xb'));var squel=require(_0xc263('0xc'));var crypto=require(_0xc263('0xd'));var jsforce=require(_0xc263('0xe'));var deskjs=require(_0xc263('0xf'));var toCsv=require(_0xc263('0x9'));var querystring=require(_0xc263('0x10'));var Papa=require(_0xc263('0x11'));var Redis=require(_0xc263('0x12'));var authService=require(_0xc263('0x13'));var qs=require(_0xc263('0x14'));var as=require(_0xc263('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc263('0x16'))('api');var utils=require(_0xc263('0x17'));var config=require(_0xc263('0x18'));var licenseUtil=require(_0xc263('0x19'));var db=require(_0xc263('0x1a'))['db'];var integrations=require(_0xc263('0x1b'));function respondWithStatusCode(_0x58a988,_0xa07f85){_0xa07f85=_0xa07f85||0xcc;return function(_0xa2a3f3){if(_0xa2a3f3){return _0x58a988['sendStatus'](_0xa07f85);}return _0x58a988['status'](_0xa07f85)[_0xc263('0x1c')]();};}function respondWithResult(_0x1ba875,_0x498261){_0x498261=_0x498261||0xc8;return function(_0x2ed27a){if(_0x2ed27a){return _0x1ba875['status'](_0x498261)['json'](_0x2ed27a);}};}function respondWithFilteredResult(_0x13478e,_0x56cd80){return function(_0xc33721){if(_0xc33721){var _0x5093b5=typeof _0x56cd80[_0xc263('0x1d')]===_0xc263('0x1e')&&typeof _0x56cd80[_0xc263('0x1f')]==='undefined';var _0xdcc253=_0xc33721[_0xc263('0x20')];var _0x1a2062=_0x5093b5?0x0:_0x56cd80[_0xc263('0x1d')];var _0xb33697=_0x5093b5?_0xc33721['count']:_0x56cd80[_0xc263('0x1d')]+_0x56cd80[_0xc263('0x1f')];var _0xefa87;if(_0xb33697>=_0xdcc253){_0xb33697=_0xdcc253;_0xefa87=0xc8;}else{_0xefa87=0xce;}_0x13478e[_0xc263('0x21')](_0xefa87);return _0x13478e['set'](_0xc263('0x22'),_0x1a2062+'-'+_0xb33697+'/'+_0xdcc253)[_0xc263('0x23')](_0xc33721);}return null;};}function patchUpdates(_0xcd65fe){return function(_0x48be61){try{jsonpatch[_0xc263('0x24')](_0x48be61,_0xcd65fe,!![]);}catch(_0xd6e8e0){return BPromise['reject'](_0xd6e8e0);}return _0x48be61[_0xc263('0x25')]();};}function saveUpdates(_0x25ee9c,_0x83da8a){return function(_0x17bb9f){if(_0x17bb9f){return _0x17bb9f[_0xc263('0x26')](_0x25ee9c)[_0xc263('0x27')](function(_0x366c31){return _0x366c31;});}return null;};}function removeEntity(_0x357470,_0x3f9175){return function(_0x4c98a4){if(_0x4c98a4){return _0x4c98a4['destroy']()['then'](function(){_0x357470[_0xc263('0x21')](0xcc)[_0xc263('0x1c')]();});}};}function handleEntityNotFound(_0x3547d5,_0x26b1a1){return function(_0x2a99aa){if(!_0x2a99aa){_0x3547d5['sendStatus'](0x194);}return _0x2a99aa;};}function handleError(_0x23e0d3,_0x25d634){_0x25d634=_0x25d634||0x1f4;return function(_0x1d55ee){logger[_0xc263('0x28')](_0x1d55ee[_0xc263('0x29')]);if(_0x1d55ee['name']){delete _0x1d55ee[_0xc263('0x2a')];}_0x23e0d3[_0xc263('0x21')](_0x25d634)['send'](_0x1d55ee);};}exports[_0xc263('0x2b')]=function(_0x2cd362,_0x1d32ad){var _0x1ada37={},_0x3e27ec={},_0x5e0f30={'count':0x0,'rows':[]};var _0x19bc1c=_[_0xc263('0x2c')](db[_0xc263('0x2d')][_0xc263('0x2e')],function(_0x190708){return{'name':_0x190708[_0xc263('0x2f')],'type':_0x190708[_0xc263('0x30')][_0xc263('0x31')]};});_0x3e27ec[_0xc263('0x32')]=_[_0xc263('0x2c')](_0x19bc1c,_0xc263('0x2a'));_0x3e27ec[_0xc263('0x33')]=_['keys'](_0x2cd362[_0xc263('0x33')]);_0x3e27ec[_0xc263('0x34')]=_[_0xc263('0x35')](_0x3e27ec[_0xc263('0x32')],_0x3e27ec[_0xc263('0x33')]);_0x1ada37['attributes']=_[_0xc263('0x35')](_0x3e27ec[_0xc263('0x32')],qs['fields'](_0x2cd362[_0xc263('0x33')]['fields']));_0x1ada37['attributes']=_0x1ada37[_0xc263('0x36')][_0xc263('0x37')]?_0x1ada37[_0xc263('0x36')]:_0x3e27ec[_0xc263('0x32')];if(!_0x2cd362['query']['hasOwnProperty'](_0xc263('0x38'))){_0x1ada37['limit']=qs[_0xc263('0x1f')](_0x2cd362['query'][_0xc263('0x1f')]);_0x1ada37['offset']=qs['offset'](_0x2cd362[_0xc263('0x33')]['offset']);}_0x1ada37['order']=qs['sort'](_0x2cd362[_0xc263('0x33')][_0xc263('0x39')]);_0x1ada37[_0xc263('0x3a')]=qs[_0xc263('0x34')](_[_0xc263('0x3b')](_0x2cd362[_0xc263('0x33')],_0x3e27ec[_0xc263('0x34')]),_0x19bc1c);if(_0x2cd362[_0xc263('0x33')]['filter']){_0x1ada37[_0xc263('0x3a')]=_[_0xc263('0x3c')](_0x1ada37[_0xc263('0x3a')],{'$or':_[_0xc263('0x2c')](_0x19bc1c,function(_0x584725){if(_0x584725['type']!==_0xc263('0x3d')){var _0x5b8162={};_0x5b8162[_0x584725[_0xc263('0x2a')]]={'$like':'%'+_0x2cd362['query'][_0xc263('0x3e')]+'%'};return _0x5b8162;}})});}_0x1ada37=_[_0xc263('0x3c')]({},_0x1ada37,_0x2cd362[_0xc263('0x3f')]);var _0x22021a={'where':_0x1ada37[_0xc263('0x3a')]};return db['SugarcrmAccount'][_0xc263('0x20')](_0x22021a)['then'](function(_0x384b37){_0x5e0f30['count']=_0x384b37;if(_0x2cd362[_0xc263('0x33')][_0xc263('0x40')]){_0x1ada37[_0xc263('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc263('0x42')](_0x1ada37);})['then'](function(_0x42f54e){_0x5e0f30[_0xc263('0x43')]=_0x42f54e;return _0x5e0f30;})[_0xc263('0x27')](respondWithFilteredResult(_0x1d32ad,_0x1ada37))['catch'](handleError(_0x1d32ad,null));};exports[_0xc263('0x44')]=function(_0x577fb3,_0x45e2cd){var _0x42066f={'raw':![],'where':{'id':_0x577fb3['params']['id']}},_0x7c06d8={};_0x7c06d8[_0xc263('0x32')]=_['keys'](db[_0xc263('0x2d')][_0xc263('0x2e')]);_0x7c06d8[_0xc263('0x33')]=_['keys'](_0x577fb3[_0xc263('0x33')]);_0x7c06d8[_0xc263('0x34')]=_[_0xc263('0x35')](_0x7c06d8[_0xc263('0x32')],_0x7c06d8['query']);_0x42066f[_0xc263('0x36')]=_[_0xc263('0x35')](_0x7c06d8['model'],qs[_0xc263('0x45')](_0x577fb3[_0xc263('0x33')][_0xc263('0x45')]));_0x42066f[_0xc263('0x36')]=_0x42066f['attributes']['length']?_0x42066f['attributes']:_0x7c06d8['model'];if(_0x577fb3[_0xc263('0x33')]['includeAll']){_0x42066f[_0xc263('0x41')]=[{'all':!![]}];}_0x42066f=_[_0xc263('0x3c')]({},_0x42066f,_0x577fb3[_0xc263('0x3f')]);return db['SugarcrmAccount'][_0xc263('0x46')](_0x42066f)[_0xc263('0x27')](handleEntityNotFound(_0x45e2cd,null))['then'](respondWithResult(_0x45e2cd,null))['catch'](handleError(_0x45e2cd,null));};exports[_0xc263('0x47')]=function(_0x43acac,_0x24b9ee){return db[_0xc263('0x2d')][_0xc263('0x47')](_0x43acac[_0xc263('0x48')],{})['then'](respondWithResult(_0x24b9ee,0xc9))[_0xc263('0x49')](handleError(_0x24b9ee,null));};exports[_0xc263('0x26')]=function(_0x1330e4,_0x5ed5ee){if(_0x1330e4['body']['id']){delete _0x1330e4[_0xc263('0x48')]['id'];}return db[_0xc263('0x2d')]['find']({'where':{'id':_0x1330e4[_0xc263('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ed5ee,null))['then'](saveUpdates(_0x1330e4[_0xc263('0x48')],null))[_0xc263('0x27')](respondWithResult(_0x5ed5ee,null))[_0xc263('0x49')](handleError(_0x5ed5ee,null));};exports[_0xc263('0x4b')]=function(_0x2c19ed,_0x5b16f4){return db[_0xc263('0x2d')]['find']({'where':{'id':_0x2c19ed[_0xc263('0x4a')]['id']}})[_0xc263('0x27')](handleEntityNotFound(_0x5b16f4,null))['then'](removeEntity(_0x5b16f4,null))[_0xc263('0x49')](handleError(_0x5b16f4,null));};exports[_0xc263('0x4c')]=function(_0x1e5dab,_0x4a1399,_0x38f350){var _0xe239c2={};var _0x5bb89f={};var _0x3bc922;var _0xc6cb19;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1e5dab[_0xc263('0x4a')]['id']}})[_0xc263('0x27')](handleEntityNotFound(_0x4a1399,null))['then'](function(_0x162868){if(_0x162868){_0x3bc922=_0x162868;_0x5bb89f['model']=_['keys'](db[_0xc263('0x4d')][_0xc263('0x2e')]);_0x5bb89f[_0xc263('0x33')]=_['keys'](_0x1e5dab['query']);_0x5bb89f[_0xc263('0x34')]=_[_0xc263('0x35')](_0x5bb89f[_0xc263('0x32')],_0x5bb89f[_0xc263('0x33')]);_0xe239c2[_0xc263('0x36')]=_[_0xc263('0x35')](_0x5bb89f[_0xc263('0x32')],qs[_0xc263('0x45')](_0x1e5dab[_0xc263('0x33')][_0xc263('0x45')]));_0xe239c2[_0xc263('0x36')]=_0xe239c2[_0xc263('0x36')][_0xc263('0x37')]?_0xe239c2[_0xc263('0x36')]:_0x5bb89f[_0xc263('0x32')];_0xe239c2['order']=qs[_0xc263('0x39')](_0x1e5dab['query']['sort']);_0xe239c2[_0xc263('0x3a')]=qs[_0xc263('0x34')](_[_0xc263('0x3b')](_0x1e5dab[_0xc263('0x33')],_0x5bb89f[_0xc263('0x34')]));if(_0x1e5dab[_0xc263('0x33')][_0xc263('0x3e')]){_0xe239c2[_0xc263('0x3a')]=_[_0xc263('0x3c')](_0xe239c2[_0xc263('0x3a')],{'$or':_['map'](_0xe239c2[_0xc263('0x36')],function(_0x322266){var _0x1635b8={};_0x1635b8[_0x322266]={'$like':'%'+_0x1e5dab[_0xc263('0x33')][_0xc263('0x3e')]+'%'};return _0x1635b8;})});}_0xe239c2=_[_0xc263('0x3c')]({},_0xe239c2,_0x1e5dab[_0xc263('0x3f')]);return _0x3bc922[_0xc263('0x4c')](_0xe239c2);}})[_0xc263('0x27')](function(_0x5a9218){if(_0x5a9218){_0xc6cb19=_0x5a9218['length'];if(!_0x1e5dab[_0xc263('0x33')][_0xc263('0x4e')](_0xc263('0x38'))){_0xe239c2[_0xc263('0x1f')]=qs[_0xc263('0x1f')](_0x1e5dab[_0xc263('0x33')][_0xc263('0x1f')]);_0xe239c2[_0xc263('0x1d')]=qs[_0xc263('0x1d')](_0x1e5dab[_0xc263('0x33')][_0xc263('0x1d')]);}return _0x3bc922[_0xc263('0x4c')](_0xe239c2);}})[_0xc263('0x27')](function(_0x473a09){if(_0x473a09){return _0x473a09?{'count':_0xc6cb19,'rows':_0x473a09}:null;}})['then'](respondWithResult(_0x4a1399,null))[_0xc263('0x49')](handleError(_0x4a1399,null));};exports[_0xc263('0x4f')]=function(_0x1c0d26,_0x4504e8,_0x3fdcb3){if(_0x1c0d26[_0xc263('0x48')]['id']){delete _0x1c0d26[_0xc263('0x48')]['id'];}return db[_0xc263('0x2d')][_0xc263('0x50')]({'where':{'id':_0x1c0d26[_0xc263('0x4a')]['id']}})[_0xc263('0x27')](handleEntityNotFound(_0x4504e8,null))['then'](function(_0x1cf486){if(_0x1cf486){_0x1c0d26[_0xc263('0x48')][_0xc263('0x51')]=_0x1cf486['id'];_0x1c0d26[_0xc263('0x48')]['Subjects']=integrations[_0xc263('0x52')](_0x1c0d26[_0xc263('0x48')]['channel'],_0x1c0d26[_0xc263('0x48')][_0xc263('0x30')]);_0x1c0d26[_0xc263('0x48')][_0xc263('0x53')]=integrations[_0xc263('0x54')](_0x1c0d26[_0xc263('0x48')][_0xc263('0x55')],_0x1c0d26[_0xc263('0x48')][_0xc263('0x30')]);return db[_0xc263('0x4d')][_0xc263('0x47')](_0x1c0d26[_0xc263('0x48')],{'include':[{'model':db[_0xc263('0x56')],'as':_0xc263('0x57')},{'model':db[_0xc263('0x56')],'as':_0xc263('0x53')}]});}return null;})[_0xc263('0x27')](respondWithResult(_0x4504e8,null))[_0xc263('0x49')](handleError(_0x4504e8,null));};exports[_0xc263('0x58')]=function(_0x5e5908,_0x33ae8c,_0x1cc1b2){var _0x3df372='';var _0x14589a=['id',_0xc263('0x2a'),_0xc263('0x59'),'created_by','description',_0xc263('0x5a'),_0xc263('0x5b'),_0xc263('0x5c'),_0xc263('0x5d'),_0xc263('0x5e'),_0xc263('0x5f'),'direction'];return db[_0xc263('0x2d')]['findOne']({'where':{'id':_0x5e5908[_0xc263('0x4a')]['id']},'attributes':['id','username',_0xc263('0x60'),_0xc263('0x61')]})['then'](handleEntityNotFound(_0x33ae8c,null))[_0xc263('0x27')](function(_0x3ed4ac){if(_0x3ed4ac){_0x3df372=_0x3ed4ac['remoteUri'];var _0x4b0e79=_0x3df372['slice'](-0x1);if(_0x4b0e79==='/'){_0x3df372=_0x3df372['substring'](0x0,_0x3df372[_0xc263('0x62')](_0x4b0e79));}return rp({'method':'POST','uri':util[_0xc263('0x63')](_0xc263('0x64'),_0x3df372,_0xc263('0x65')),'json':!![],'form':{'method':_0xc263('0x66'),'input_type':'JSON','response_type':_0xc263('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3ed4ac[_0xc263('0x68')],'password':_0x3ed4ac[_0xc263('0x60')],'encryption':_0xc263('0x69')},'application':_0xc263('0x6a')})}});}})['then'](function(_0x222d11){if(_0x222d11&&_0x222d11[_0xc263('0x2a')]!=='Invalid\x20Login'&&_0x222d11[_0xc263('0x2a')]!=='Password\x20Expired'){return rp({'method':_0xc263('0x6b'),'uri':util[_0xc263('0x63')](_0xc263('0x64'),_0x3df372,_0xc263('0x65')),'json':!![],'form':{'method':_0xc263('0x6c'),'input_type':_0xc263('0x67'),'response_type':'JSON','rest_data':JSON[_0xc263('0x6d')]({'session':_0x222d11['id'],'module_name':_0xc263('0x6e')})}})[_0xc263('0x27')](function(_0x421878){if(_0x421878){var _0x5ab3d2=_['values'](_0x421878['module_fields']);_['remove'](_0x5ab3d2,function(_0xce4c82){return _0x14589a[_0xc263('0x6f')](_0xce4c82['name']);});return{'count':_0x5ab3d2['length'],'rows':_[_0xc263('0x2c')](_0x5ab3d2,function(_0x3ae27d){return{'id':_0x3ae27d[_0xc263('0x2a')],'name':_0x3ae27d[_0xc263('0x70')],'custom':_[_0xc263('0x71')](_0x3ae27d[_0xc263('0x2a')],'_c')?!![]:![],'options':_0x3ae27d[_0xc263('0x3f')]?_[_0xc263('0x2c')](_[_0xc263('0x72')](_0x3ae27d['options']),function(_0x448821){return{'name':_0x448821[_0xc263('0x73')],'value':_0x448821['name']};}):[]};})};}})[_0xc263('0x27')](respondWithResult(_0x33ae8c,null))[_0xc263('0x49')](function(_0x2427df){var _0x52319c=_0x5e5908['query'][_0xc263('0x74')]?0x1f4:_0x2427df[_0xc263('0x75')]||0x1f4;logger['error'](_0xc263('0x76'),'getFields',_0x52319c,JSON[_0xc263('0x6d')](_0x2427df));delete _0x2427df[_0xc263('0x2a')];if(_0x52319c===0x191){_0x52319c=0x190;}_0x33ae8c[_0xc263('0x21')](_0x52319c)[_0xc263('0x77')](_0x5e5908[_0xc263('0x33')][_0xc263('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x2427df[_0xc263('0x75')]}:_0x2427df);});}else{var _0x36bd25=0x1f4;_0x33ae8c[_0xc263('0x21')](_0x36bd25)['send']({'message':_0xc263('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8776=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','SugarcrmConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','created_by','description','date_start','parent_type','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login','stringify','PLAIN','Password\x20Expired','%s%s','get_module_fields','JSON','Calls','values','module_fields','remove','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8776,0x136));var _0x6877=function(_0x15cd84,_0x4eda21){_0x15cd84=_0x15cd84-0x0;var _0x3599f7=_0x8776[_0x15cd84];return _0x3599f7;};'use strict';var emlformat=require(_0x6877('0x0'));var rimraf=require(_0x6877('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6877('0x2'));var rp=require('request-promise');var moment=require(_0x6877('0x3'));var BPromise=require(_0x6877('0x4'));var Mustache=require('mustache');var util=require(_0x6877('0x5'));var path=require(_0x6877('0x6'));var sox=require('sox');var csv=require(_0x6877('0x7'));var ejs=require(_0x6877('0x8'));var fs=require('fs');var fs_extra=require(_0x6877('0x9'));var _=require(_0x6877('0xa'));var squel=require(_0x6877('0xb'));var crypto=require(_0x6877('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6877('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6877('0xe'));var Papa=require(_0x6877('0xf'));var Redis=require(_0x6877('0x10'));var authService=require(_0x6877('0x11'));var qs=require(_0x6877('0x12'));var as=require(_0x6877('0x13'));var hardwareService=require(_0x6877('0x14'));var logger=require(_0x6877('0x15'))(_0x6877('0x16'));var utils=require(_0x6877('0x17'));var config=require(_0x6877('0x18'));var licenseUtil=require(_0x6877('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6877('0x1a'));function respondWithStatusCode(_0x316768,_0x5b76dd){_0x5b76dd=_0x5b76dd||0xcc;return function(_0x195b3c){if(_0x195b3c){return _0x316768[_0x6877('0x1b')](_0x5b76dd);}return _0x316768[_0x6877('0x1c')](_0x5b76dd)[_0x6877('0x1d')]();};}function respondWithResult(_0x471d48,_0x17273c){_0x17273c=_0x17273c||0xc8;return function(_0x2f46fd){if(_0x2f46fd){return _0x471d48['status'](_0x17273c)[_0x6877('0x1e')](_0x2f46fd);}};}function respondWithFilteredResult(_0x19af75,_0x20d7da){return function(_0x523c87){if(_0x523c87){var _0x10c3f0=typeof _0x20d7da[_0x6877('0x1f')]===_0x6877('0x20')&&typeof _0x20d7da[_0x6877('0x21')]==='undefined';var _0x421364=_0x523c87['count'];var _0x1ea25c=_0x10c3f0?0x0:_0x20d7da[_0x6877('0x1f')];var _0x32f8b1=_0x10c3f0?_0x523c87[_0x6877('0x22')]:_0x20d7da[_0x6877('0x1f')]+_0x20d7da[_0x6877('0x21')];var _0x41302b;if(_0x32f8b1>=_0x421364){_0x32f8b1=_0x421364;_0x41302b=0xc8;}else{_0x41302b=0xce;}_0x19af75['status'](_0x41302b);return _0x19af75['set'](_0x6877('0x23'),_0x1ea25c+'-'+_0x32f8b1+'/'+_0x421364)['json'](_0x523c87);}return null;};}function patchUpdates(_0x32c233){return function(_0x2d3f50){try{jsonpatch['apply'](_0x2d3f50,_0x32c233,!![]);}catch(_0x3306e2){return BPromise[_0x6877('0x24')](_0x3306e2);}return _0x2d3f50[_0x6877('0x25')]();};}function saveUpdates(_0x863f43,_0x52f8c3){return function(_0x1476a8){if(_0x1476a8){return _0x1476a8['update'](_0x863f43)[_0x6877('0x26')](function(_0x4af553){return _0x4af553;});}return null;};}function removeEntity(_0x31fd23,_0x10337f){return function(_0x5b4eb7){if(_0x5b4eb7){return _0x5b4eb7[_0x6877('0x27')]()[_0x6877('0x26')](function(){_0x31fd23[_0x6877('0x1c')](0xcc)[_0x6877('0x1d')]();});}};}function handleEntityNotFound(_0x44391e,_0x4d5a36){return function(_0x98c762){if(!_0x98c762){_0x44391e['sendStatus'](0x194);}return _0x98c762;};}function handleError(_0x5394c8,_0x43edcb){_0x43edcb=_0x43edcb||0x1f4;return function(_0x2d1db9){logger[_0x6877('0x28')](_0x2d1db9[_0x6877('0x29')]);if(_0x2d1db9[_0x6877('0x2a')]){delete _0x2d1db9[_0x6877('0x2a')];}_0x5394c8[_0x6877('0x1c')](_0x43edcb)[_0x6877('0x2b')](_0x2d1db9);};}exports[_0x6877('0x2c')]=function(_0x2274f0,_0x5f2d2d){var _0x33911b={},_0x3d04bf={},_0x4dd424={'count':0x0,'rows':[]};var _0x318448=_[_0x6877('0x2d')](db[_0x6877('0x2e')][_0x6877('0x2f')],function(_0x45f6bf){return{'name':_0x45f6bf['fieldName'],'type':_0x45f6bf[_0x6877('0x30')][_0x6877('0x31')]};});_0x3d04bf[_0x6877('0x32')]=_[_0x6877('0x2d')](_0x318448,_0x6877('0x2a'));_0x3d04bf[_0x6877('0x33')]=_[_0x6877('0x34')](_0x2274f0['query']);_0x3d04bf[_0x6877('0x35')]=_[_0x6877('0x36')](_0x3d04bf[_0x6877('0x32')],_0x3d04bf['query']);_0x33911b[_0x6877('0x37')]=_[_0x6877('0x36')](_0x3d04bf[_0x6877('0x32')],qs[_0x6877('0x38')](_0x2274f0[_0x6877('0x33')][_0x6877('0x38')]));_0x33911b[_0x6877('0x37')]=_0x33911b['attributes'][_0x6877('0x39')]?_0x33911b[_0x6877('0x37')]:_0x3d04bf[_0x6877('0x32')];if(!_0x2274f0[_0x6877('0x33')]['hasOwnProperty'](_0x6877('0x3a'))){_0x33911b['limit']=qs[_0x6877('0x21')](_0x2274f0[_0x6877('0x33')]['limit']);_0x33911b['offset']=qs[_0x6877('0x1f')](_0x2274f0[_0x6877('0x33')]['offset']);}_0x33911b[_0x6877('0x3b')]=qs[_0x6877('0x3c')](_0x2274f0[_0x6877('0x33')][_0x6877('0x3c')]);_0x33911b[_0x6877('0x3d')]=qs[_0x6877('0x35')](_[_0x6877('0x3e')](_0x2274f0[_0x6877('0x33')],_0x3d04bf[_0x6877('0x35')]),_0x318448);if(_0x2274f0[_0x6877('0x33')][_0x6877('0x3f')]){_0x33911b[_0x6877('0x3d')]=_[_0x6877('0x40')](_0x33911b[_0x6877('0x3d')],{'$or':_[_0x6877('0x2d')](_0x318448,function(_0x756520){if(_0x756520['type']!==_0x6877('0x41')){var _0x3f6eb6={};_0x3f6eb6[_0x756520[_0x6877('0x2a')]]={'$like':'%'+_0x2274f0[_0x6877('0x33')][_0x6877('0x3f')]+'%'};return _0x3f6eb6;}})});}_0x33911b=_[_0x6877('0x40')]({},_0x33911b,_0x2274f0['options']);var _0x4cb4d8={'where':_0x33911b[_0x6877('0x3d')]};return db[_0x6877('0x2e')]['count'](_0x4cb4d8)[_0x6877('0x26')](function(_0x51bf79){_0x4dd424[_0x6877('0x22')]=_0x51bf79;if(_0x2274f0[_0x6877('0x33')]['includeAll']){_0x33911b[_0x6877('0x42')]=[{'all':!![]}];}return db[_0x6877('0x2e')][_0x6877('0x43')](_0x33911b);})[_0x6877('0x26')](function(_0x5dba7b){_0x4dd424[_0x6877('0x44')]=_0x5dba7b;return _0x4dd424;})[_0x6877('0x26')](respondWithFilteredResult(_0x5f2d2d,_0x33911b))[_0x6877('0x45')](handleError(_0x5f2d2d,null));};exports[_0x6877('0x46')]=function(_0x536020,_0x2dee38){var _0x3a4ff4={'raw':![],'where':{'id':_0x536020[_0x6877('0x47')]['id']}},_0x50ad75={};_0x50ad75[_0x6877('0x32')]=_['keys'](db['SugarcrmAccount'][_0x6877('0x2f')]);_0x50ad75[_0x6877('0x33')]=_[_0x6877('0x34')](_0x536020['query']);_0x50ad75[_0x6877('0x35')]=_[_0x6877('0x36')](_0x50ad75[_0x6877('0x32')],_0x50ad75['query']);_0x3a4ff4[_0x6877('0x37')]=_[_0x6877('0x36')](_0x50ad75[_0x6877('0x32')],qs[_0x6877('0x38')](_0x536020['query'][_0x6877('0x38')]));_0x3a4ff4['attributes']=_0x3a4ff4[_0x6877('0x37')][_0x6877('0x39')]?_0x3a4ff4['attributes']:_0x50ad75[_0x6877('0x32')];if(_0x536020[_0x6877('0x33')][_0x6877('0x48')]){_0x3a4ff4[_0x6877('0x42')]=[{'all':!![]}];}_0x3a4ff4=_[_0x6877('0x40')]({},_0x3a4ff4,_0x536020[_0x6877('0x49')]);return db[_0x6877('0x2e')][_0x6877('0x4a')](_0x3a4ff4)[_0x6877('0x26')](handleEntityNotFound(_0x2dee38,null))[_0x6877('0x26')](respondWithResult(_0x2dee38,null))[_0x6877('0x45')](handleError(_0x2dee38,null));};exports[_0x6877('0x4b')]=function(_0x124d39,_0x39fdbe){return db['SugarcrmAccount'][_0x6877('0x4b')](_0x124d39[_0x6877('0x4c')],{})[_0x6877('0x26')](respondWithResult(_0x39fdbe,0xc9))[_0x6877('0x45')](handleError(_0x39fdbe,null));};exports[_0x6877('0x4d')]=function(_0x284c27,_0x40580c){if(_0x284c27[_0x6877('0x4c')]['id']){delete _0x284c27[_0x6877('0x4c')]['id'];}return db['SugarcrmAccount'][_0x6877('0x4a')]({'where':{'id':_0x284c27[_0x6877('0x47')]['id']}})[_0x6877('0x26')](handleEntityNotFound(_0x40580c,null))[_0x6877('0x26')](saveUpdates(_0x284c27[_0x6877('0x4c')],null))['then'](respondWithResult(_0x40580c,null))[_0x6877('0x45')](handleError(_0x40580c,null));};exports[_0x6877('0x27')]=function(_0x38a026,_0xfb44f3){return db[_0x6877('0x2e')][_0x6877('0x4a')]({'where':{'id':_0x38a026[_0x6877('0x47')]['id']}})[_0x6877('0x26')](handleEntityNotFound(_0xfb44f3,null))['then'](removeEntity(_0xfb44f3,null))[_0x6877('0x45')](handleError(_0xfb44f3,null));};exports['getConfigurations']=function(_0x16bb6d,_0x402837,_0x43edcf){var _0x1edc68={};var _0x2db5dc={};var _0x3527fc;var _0x5b2ab7;return db[_0x6877('0x2e')]['findOne']({'where':{'id':_0x16bb6d[_0x6877('0x47')]['id']}})['then'](handleEntityNotFound(_0x402837,null))['then'](function(_0x31ad74){if(_0x31ad74){_0x3527fc=_0x31ad74;_0x2db5dc['model']=_[_0x6877('0x34')](db[_0x6877('0x4e')][_0x6877('0x2f')]);_0x2db5dc['query']=_['keys'](_0x16bb6d[_0x6877('0x33')]);_0x2db5dc[_0x6877('0x35')]=_[_0x6877('0x36')](_0x2db5dc[_0x6877('0x32')],_0x2db5dc['query']);_0x1edc68[_0x6877('0x37')]=_[_0x6877('0x36')](_0x2db5dc[_0x6877('0x32')],qs[_0x6877('0x38')](_0x16bb6d['query']['fields']));_0x1edc68['attributes']=_0x1edc68[_0x6877('0x37')][_0x6877('0x39')]?_0x1edc68[_0x6877('0x37')]:_0x2db5dc[_0x6877('0x32')];_0x1edc68[_0x6877('0x3b')]=qs[_0x6877('0x3c')](_0x16bb6d[_0x6877('0x33')][_0x6877('0x3c')]);_0x1edc68[_0x6877('0x3d')]=qs[_0x6877('0x35')](_[_0x6877('0x3e')](_0x16bb6d[_0x6877('0x33')],_0x2db5dc[_0x6877('0x35')]));if(_0x16bb6d[_0x6877('0x33')][_0x6877('0x3f')]){_0x1edc68['where']=_[_0x6877('0x40')](_0x1edc68[_0x6877('0x3d')],{'$or':_['map'](_0x1edc68['attributes'],function(_0x23b4cc){var _0x365607={};_0x365607[_0x23b4cc]={'$like':'%'+_0x16bb6d[_0x6877('0x33')][_0x6877('0x3f')]+'%'};return _0x365607;})});}_0x1edc68=_['merge']({},_0x1edc68,_0x16bb6d[_0x6877('0x49')]);return _0x3527fc[_0x6877('0x4f')](_0x1edc68);}})['then'](function(_0x47ba8b){if(_0x47ba8b){_0x5b2ab7=_0x47ba8b[_0x6877('0x39')];if(!_0x16bb6d[_0x6877('0x33')]['hasOwnProperty'](_0x6877('0x3a'))){_0x1edc68[_0x6877('0x21')]=qs['limit'](_0x16bb6d[_0x6877('0x33')][_0x6877('0x21')]);_0x1edc68['offset']=qs['offset'](_0x16bb6d['query'][_0x6877('0x1f')]);}return _0x3527fc[_0x6877('0x4f')](_0x1edc68);}})[_0x6877('0x26')](function(_0x25c0d4){if(_0x25c0d4){return _0x25c0d4?{'count':_0x5b2ab7,'rows':_0x25c0d4}:null;}})[_0x6877('0x26')](respondWithResult(_0x402837,null))['catch'](handleError(_0x402837,null));};exports[_0x6877('0x50')]=function(_0x1cbda2,_0x4d6509,_0x3b46c4){if(_0x1cbda2['body']['id']){delete _0x1cbda2['body']['id'];}return db['SugarcrmAccount'][_0x6877('0x51')]({'where':{'id':_0x1cbda2[_0x6877('0x47')]['id']}})[_0x6877('0x26')](handleEntityNotFound(_0x4d6509,null))[_0x6877('0x26')](function(_0x154350){if(_0x154350){_0x1cbda2[_0x6877('0x4c')][_0x6877('0x52')]=_0x154350['id'];_0x1cbda2[_0x6877('0x4c')][_0x6877('0x53')]=integrations[_0x6877('0x54')](_0x1cbda2[_0x6877('0x4c')][_0x6877('0x55')],_0x1cbda2[_0x6877('0x4c')]['type']);_0x1cbda2[_0x6877('0x4c')][_0x6877('0x56')]=integrations[_0x6877('0x57')](_0x1cbda2[_0x6877('0x4c')][_0x6877('0x55')],_0x1cbda2[_0x6877('0x4c')]['type']);return db[_0x6877('0x4e')][_0x6877('0x4b')](_0x1cbda2[_0x6877('0x4c')],{'include':[{'model':db['SugarcrmField'],'as':_0x6877('0x53')},{'model':db['SugarcrmField'],'as':_0x6877('0x56')}]});}return null;})['then'](respondWithResult(_0x4d6509,null))[_0x6877('0x45')](handleError(_0x4d6509,null));};exports['getFields']=function(_0x22fa23,_0x4c930b,_0x26b088){var _0x3a6478='';var _0x6856f5=['id',_0x6877('0x2a'),'assigned_user_id',_0x6877('0x58'),_0x6877('0x59'),_0x6877('0x5a'),'duration_hours','duration_minutes','parent_id',_0x6877('0x5b'),'parent_name',_0x6877('0x5c')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x22fa23[_0x6877('0x47')]['id']},'attributes':['id',_0x6877('0x5d'),_0x6877('0x5e'),_0x6877('0x5f')]})['then'](handleEntityNotFound(_0x4c930b,null))[_0x6877('0x26')](function(_0x52789a){if(_0x52789a){_0x3a6478=_0x52789a[_0x6877('0x5f')];var _0x33aa47=_0x3a6478[_0x6877('0x60')](-0x1);if(_0x33aa47==='/'){_0x3a6478=_0x3a6478[_0x6877('0x61')](0x0,_0x3a6478['lastIndexOf'](_0x33aa47));}return rp({'method':_0x6877('0x62'),'uri':util[_0x6877('0x63')]('%s%s',_0x3a6478,_0x6877('0x64')),'json':!![],'form':{'method':_0x6877('0x65'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x6877('0x66')]({'user_auth':{'user_name':_0x52789a[_0x6877('0x5d')],'password':_0x52789a[_0x6877('0x5e')],'encryption':_0x6877('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6877('0x26')](function(_0xb02563){if(_0xb02563&&_0xb02563[_0x6877('0x2a')]!=='Invalid\x20Login'&&_0xb02563[_0x6877('0x2a')]!==_0x6877('0x68')){return rp({'method':'POST','uri':util['format'](_0x6877('0x69'),_0x3a6478,_0x6877('0x64')),'json':!![],'form':{'method':_0x6877('0x6a'),'input_type':_0x6877('0x6b'),'response_type':'JSON','rest_data':JSON[_0x6877('0x66')]({'session':_0xb02563['id'],'module_name':_0x6877('0x6c')})}})[_0x6877('0x26')](function(_0x57fbb9){if(_0x57fbb9){var _0x111c12=_[_0x6877('0x6d')](_0x57fbb9[_0x6877('0x6e')]);_[_0x6877('0x6f')](_0x111c12,function(_0x2829fd){return _0x6856f5['includes'](_0x2829fd[_0x6877('0x2a')]);});return{'count':_0x111c12['length'],'rows':_[_0x6877('0x2d')](_0x111c12,function(_0x3823fd){return{'id':_0x3823fd['name'],'name':_0x3823fd['label'],'custom':_[_0x6877('0x70')](_0x3823fd[_0x6877('0x2a')],'_c')?!![]:![],'options':_0x3823fd[_0x6877('0x49')]?_[_0x6877('0x2d')](_['values'](_0x3823fd['options']),function(_0x3a5dcf){return{'name':_0x3a5dcf[_0x6877('0x71')],'value':_0x3a5dcf['name']};}):[]};})};}})[_0x6877('0x26')](respondWithResult(_0x4c930b,null))['catch'](function(_0x113056){var _0x2dcd0d=_0x22fa23[_0x6877('0x33')][_0x6877('0x72')]?0x1f4:_0x113056['statusCode']||0x1f4;logger[_0x6877('0x28')](_0x6877('0x73'),_0x6877('0x74'),_0x2dcd0d,JSON[_0x6877('0x66')](_0x113056));delete _0x113056[_0x6877('0x2a')];if(_0x2dcd0d===0x191){_0x2dcd0d=0x190;}_0x4c930b['status'](_0x2dcd0d)[_0x6877('0x2b')](_0x22fa23[_0x6877('0x33')][_0x6877('0x72')]?{'message':_0x6877('0x75'),'statusCode':_0x113056[_0x6877('0x76')]}:_0x113056);});}else{var _0x5e996f=0x1f4;_0x4c930b[_0x6877('0x1c')](_0x5e996f)[_0x6877('0x2b')]({'message':_0x6877('0x75'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 2b0b0a3..325cfb9 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 _0x2deb=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x5afd0f,_0x2a9aa1){var _0x367fd7=function(_0x5bca4a){while(--_0x5bca4a){_0x5afd0f['push'](_0x5afd0f['shift']());}};_0x367fd7(++_0x2a9aa1);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb2de('0x8')]=function(_0x2ed8ec,_0x191004){return _0x2ed8ec['define'](_0xb2de('0x9'),attributes,{'tableName':_0xb2de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5416=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x732a42,_0x4d2282){var _0x8a5026=function(_0x4cbd7d){while(--_0x4cbd7d){_0x732a42['push'](_0x732a42['shift']());}};_0x8a5026(++_0x4d2282);}(_0x5416,0x13d));var _0x6541=function(_0x483430,_0x4651a8){_0x483430=_0x483430-0x0;var _0x255d68=_0x5416[_0x483430];return _0x255d68;};'use strict';var _=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var logger=require(_0x6541('0x2'))(_0x6541('0x3'));var moment=require(_0x6541('0x4'));var BPromise=require('bluebird');var rp=require(_0x6541('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6541('0x6'));var config=require(_0x6541('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x6541('0x8'));module[_0x6541('0x9')]=function(_0x35eba6,_0x38fe33){return _0x35eba6[_0x6541('0xa')](_0x6541('0xb'),attributes,{'tableName':_0x6541('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index ac51bce..336dc30 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 _0x557c=['request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','model','map','ShowSugarcrmAccount','find','raw','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x557c,0x1b5));var _0xc557=function(_0xb40f40,_0x41708a){_0xb40f40=_0xb40f40-0x0;var _0x55c108=_0x557c[_0xb40f40];return _0x55c108;};'use strict';var _=require('lodash');var util=require(_0xc557('0x0'));var moment=require(_0xc557('0x1'));var BPromise=require(_0xc557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc557('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc557('0x4'))('rpc');var config=require(_0xc557('0x5'));var jayson=require(_0xc557('0x6'));var client=jayson['client'][_0xc557('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43117d,_0x439de1,_0x40c906){return new BPromise(function(_0x5b7e64,_0x386604){return client['request'](_0x43117d,_0x40c906)[_0xc557('0x8')](function(_0x458c1d){logger[_0xc557('0x9')](_0xc557('0xa'),_0x439de1,_0xc557('0xb'));logger[_0xc557('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x439de1,_0xc557('0xb'),JSON[_0xc557('0xd')](_0x458c1d));if(_0x458c1d[_0xc557('0xe')]){if(_0x458c1d[_0xc557('0xe')][_0xc557('0xf')]===0x1f4){logger[_0xc557('0xe')](_0xc557('0xa'),_0x439de1,_0x458c1d[_0xc557('0xe')]['message']);return _0x386604(_0x458c1d[_0xc557('0xe')][_0xc557('0x10')]);}logger[_0xc557('0xe')](_0xc557('0xa'),_0x439de1,_0x458c1d[_0xc557('0xe')][_0xc557('0x10')]);return _0x5b7e64(_0x458c1d[_0xc557('0xe')][_0xc557('0x10')]);}else{logger[_0xc557('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x439de1,'request\x20sent');_0x5b7e64(_0x458c1d[_0xc557('0x11')][_0xc557('0x10')]);}})[_0xc557('0x12')](function(_0x198347){logger[_0xc557('0xe')](_0xc557('0xa'),_0x439de1,_0x198347);_0x386604(_0x198347);});});}exports[_0xc557('0x13')]=function(_0x19936a){var _0xafcb9d=this;return new Promise(function(_0x37c4c6,_0x1ca61c){return db[_0xc557('0x14')][_0xc557('0x15')]({'raw':_0x19936a[_0xc557('0x16')]?_0x19936a[_0xc557('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19936a[_0xc557('0x16')]?_0x19936a[_0xc557('0x16')][_0xc557('0x17')]||null:null,'attributes':_0x19936a[_0xc557('0x16')]?_0x19936a[_0xc557('0x16')][_0xc557('0x18')]||null:null,'limit':_0x19936a['options']?_0x19936a['options'][_0xc557('0x19')]||null:null,'include':_0x19936a['options']?_0x19936a[_0xc557('0x16')][_0xc557('0x1a')]?_['map'](_0x19936a[_0xc557('0x16')]['include'],function(_0x2ef889){return{'model':db[_0x2ef889[_0xc557('0x1b')]],'as':_0x2ef889['as'],'attributes':_0x2ef889[_0xc557('0x18')],'include':_0x2ef889[_0xc557('0x1a')]?_['map'](_0x2ef889[_0xc557('0x1a')],function(_0x5e846c){return{'model':db[_0x5e846c[_0xc557('0x1b')]],'as':_0x5e846c['as'],'attributes':_0x5e846c[_0xc557('0x18')],'include':_0x5e846c[_0xc557('0x1a')]?_[_0xc557('0x1c')](_0x5e846c[_0xc557('0x1a')],function(_0x3f6521){return{'model':db[_0x3f6521[_0xc557('0x1b')]],'as':_0x3f6521['as'],'attributes':_0x3f6521[_0xc557('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc557('0x8')](function(_0x4b52f9){logger[_0xc557('0x9')](_0xc557('0x13'),_0x19936a);logger['debug']('GetSugarcrmAccount',_0x19936a,JSON[_0xc557('0xd')](_0x4b52f9));_0x37c4c6(_0x4b52f9);})[_0xc557('0x12')](function(_0x28ff6e){logger['error']('GetSugarcrmAccount',_0x28ff6e[_0xc557('0x10')],_0x19936a);_0x1ca61c(_0xafcb9d[_0xc557('0xe')](0x1f4,_0x28ff6e[_0xc557('0x10')]));});});};exports[_0xc557('0x1d')]=function(_0x185fe2){var _0x251faf=this;return new Promise(function(_0x1a996c,_0x255328){return db[_0xc557('0x14')][_0xc557('0x1e')]({'raw':_0x185fe2[_0xc557('0x16')]?_0x185fe2[_0xc557('0x16')][_0xc557('0x1f')]===undefined?!![]:![]:!![],'where':_0x185fe2[_0xc557('0x16')]?_0x185fe2[_0xc557('0x16')][_0xc557('0x17')]||null:null,'attributes':_0x185fe2[_0xc557('0x16')]?_0x185fe2[_0xc557('0x16')][_0xc557('0x18')]||null:null,'include':_0x185fe2['options']?_0x185fe2[_0xc557('0x16')][_0xc557('0x1a')]?_['map'](_0x185fe2[_0xc557('0x16')][_0xc557('0x1a')],function(_0x372fd8){return{'model':db[_0x372fd8[_0xc557('0x1b')]],'as':_0x372fd8['as'],'attributes':_0x372fd8[_0xc557('0x18')],'include':_0x372fd8['include']?_[_0xc557('0x1c')](_0x372fd8[_0xc557('0x1a')],function(_0x5d5bc3){return{'model':db[_0x5d5bc3[_0xc557('0x1b')]],'as':_0x5d5bc3['as'],'attributes':_0x5d5bc3[_0xc557('0x18')],'include':_0x5d5bc3[_0xc557('0x1a')]?_[_0xc557('0x1c')](_0x5d5bc3[_0xc557('0x1a')],function(_0x5b110b){return{'model':db[_0x5b110b[_0xc557('0x1b')]],'as':_0x5b110b['as'],'attributes':_0x5b110b[_0xc557('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc557('0x8')](function(_0x200134){logger[_0xc557('0x9')]('ShowSugarcrmAccount',_0x185fe2);logger[_0xc557('0xc')](_0xc557('0x1d'),_0x185fe2,JSON['stringify'](_0x200134));_0x1a996c(_0x200134);})['catch'](function(_0x188043){logger['error'](_0xc557('0x1d'),_0x188043[_0xc557('0x10')],_0x185fe2);_0x255328(_0x251faf['error'](0x1f4,_0x188043[_0xc557('0x10')]));});});}; \ No newline at end of file +var _0x0358=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','catch','GetSugarcrmAccount','SugarcrmAccount','raw','options','where','attributes','limit','include','model','map','find','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0358,0xa0));var _0x8035=function(_0x2a9733,_0x1b332e){_0x2a9733=_0x2a9733-0x0;var _0x715464=_0x0358[_0x2a9733];return _0x715464;};'use strict';var _=require(_0x8035('0x0'));var util=require(_0x8035('0x1'));var moment=require(_0x8035('0x2'));var BPromise=require(_0x8035('0x3'));var rs=require(_0x8035('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8035('0x5'))['db'];var utils=require(_0x8035('0x6'));var logger=require('../../config/logger')(_0x8035('0x7'));var config=require(_0x8035('0x8'));var jayson=require(_0x8035('0x9'));var client=jayson[_0x8035('0xa')][_0x8035('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1947d,_0x2d074e,_0x7d3ac1){return new BPromise(function(_0x38c404,_0x5bd456){return client[_0x8035('0xc')](_0x1947d,_0x7d3ac1)['then'](function(_0x5e22fe){logger[_0x8035('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d074e,_0x8035('0xe'));logger[_0x8035('0xf')](_0x8035('0x10'),_0x2d074e,_0x8035('0xe'),JSON[_0x8035('0x11')](_0x5e22fe));if(_0x5e22fe['error']){if(_0x5e22fe[_0x8035('0x12')]['code']===0x1f4){logger[_0x8035('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d074e,_0x5e22fe[_0x8035('0x12')][_0x8035('0x13')]);return _0x5bd456(_0x5e22fe['error'][_0x8035('0x13')]);}logger['error'](_0x8035('0x14'),_0x2d074e,_0x5e22fe[_0x8035('0x12')][_0x8035('0x13')]);return _0x38c404(_0x5e22fe['error'][_0x8035('0x13')]);}else{logger[_0x8035('0xd')](_0x8035('0x14'),_0x2d074e,'request\x20sent');_0x38c404(_0x5e22fe['result'][_0x8035('0x13')]);}})[_0x8035('0x15')](function(_0x34596f){logger[_0x8035('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d074e,_0x34596f);_0x5bd456(_0x34596f);});});}exports[_0x8035('0x16')]=function(_0x3db7be){var _0x5cd956=this;return new Promise(function(_0x43dd02,_0x511237){return db[_0x8035('0x17')]['findAll']({'raw':_0x3db7be['options']?_0x3db7be['options'][_0x8035('0x18')]===undefined?!![]:![]:!![],'where':_0x3db7be[_0x8035('0x19')]?_0x3db7be[_0x8035('0x19')][_0x8035('0x1a')]||null:null,'attributes':_0x3db7be[_0x8035('0x19')]?_0x3db7be[_0x8035('0x19')][_0x8035('0x1b')]||null:null,'limit':_0x3db7be[_0x8035('0x19')]?_0x3db7be[_0x8035('0x19')][_0x8035('0x1c')]||null:null,'include':_0x3db7be[_0x8035('0x19')]?_0x3db7be[_0x8035('0x19')]['include']?_['map'](_0x3db7be['options'][_0x8035('0x1d')],function(_0x39113d){return{'model':db[_0x39113d[_0x8035('0x1e')]],'as':_0x39113d['as'],'attributes':_0x39113d['attributes'],'include':_0x39113d[_0x8035('0x1d')]?_['map'](_0x39113d['include'],function(_0x3eee28){return{'model':db[_0x3eee28['model']],'as':_0x3eee28['as'],'attributes':_0x3eee28['attributes'],'include':_0x3eee28[_0x8035('0x1d')]?_[_0x8035('0x1f')](_0x3eee28['include'],function(_0x1e9345){return{'model':db[_0x1e9345['model']],'as':_0x1e9345['as'],'attributes':_0x1e9345[_0x8035('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43f52b){logger[_0x8035('0xd')](_0x8035('0x16'),_0x3db7be);logger[_0x8035('0xf')](_0x8035('0x16'),_0x3db7be,JSON['stringify'](_0x43f52b));_0x43dd02(_0x43f52b);})[_0x8035('0x15')](function(_0x288ebb){logger[_0x8035('0x12')]('GetSugarcrmAccount',_0x288ebb[_0x8035('0x13')],_0x3db7be);_0x511237(_0x5cd956[_0x8035('0x12')](0x1f4,_0x288ebb[_0x8035('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x1198b3){var _0x4c3227=this;return new Promise(function(_0x3c7070,_0x240719){return db[_0x8035('0x17')][_0x8035('0x20')]({'raw':_0x1198b3[_0x8035('0x19')]?_0x1198b3[_0x8035('0x19')][_0x8035('0x18')]===undefined?!![]:![]:!![],'where':_0x1198b3[_0x8035('0x19')]?_0x1198b3[_0x8035('0x19')][_0x8035('0x1a')]||null:null,'attributes':_0x1198b3[_0x8035('0x19')]?_0x1198b3[_0x8035('0x19')][_0x8035('0x1b')]||null:null,'include':_0x1198b3['options']?_0x1198b3['options'][_0x8035('0x1d')]?_[_0x8035('0x1f')](_0x1198b3[_0x8035('0x19')][_0x8035('0x1d')],function(_0x5748c6){return{'model':db[_0x5748c6['model']],'as':_0x5748c6['as'],'attributes':_0x5748c6['attributes'],'include':_0x5748c6[_0x8035('0x1d')]?_['map'](_0x5748c6[_0x8035('0x1d')],function(_0x490cd2){return{'model':db[_0x490cd2['model']],'as':_0x490cd2['as'],'attributes':_0x490cd2[_0x8035('0x1b')],'include':_0x490cd2[_0x8035('0x1d')]?_[_0x8035('0x1f')](_0x490cd2[_0x8035('0x1d')],function(_0xfcd1d4){return{'model':db[_0xfcd1d4['model']],'as':_0xfcd1d4['as'],'attributes':_0xfcd1d4[_0x8035('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8035('0x21')](function(_0x2ec92e){logger[_0x8035('0xd')](_0x8035('0x22'),_0x1198b3);logger['debug']('ShowSugarcrmAccount',_0x1198b3,JSON[_0x8035('0x11')](_0x2ec92e));_0x3c7070(_0x2ec92e);})['catch'](function(_0x5a1bdc){logger[_0x8035('0x12')](_0x8035('0x22'),_0x5a1bdc[_0x8035('0x13')],_0x1198b3);_0x240719(_0x4c3227['error'](0x1f4,_0x5a1bdc[_0x8035('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 141022a..7343020 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 _0x5bea=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','create'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x5bea,0x13d));var _0xa5be=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5bea[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xa5be('0x0'));var util=require(_0xa5be('0x1'));var path=require(_0xa5be('0x2'));var timeout=require(_0xa5be('0x3'));var express=require('express');var router=express[_0xa5be('0x4')]();var fs_extra=require(_0xa5be('0x5'));var auth=require(_0xa5be('0x6'));var interaction=require(_0xa5be('0x7'));var config=require(_0xa5be('0x8'));var controller=require(_0xa5be('0x9'));router[_0xa5be('0xa')]('/',auth[_0xa5be('0xb')](),controller[_0xa5be('0xc')]);router[_0xa5be('0xa')](_0xa5be('0xd'),auth['isAuthenticated'](),controller[_0xa5be('0xe')]);router[_0xa5be('0xa')]('/:id/fields',auth[_0xa5be('0xb')](),controller[_0xa5be('0xf')]);router['get'](_0xa5be('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xa5be('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xa5be('0xb')](),controller[_0xa5be('0x12')]);router[_0xa5be('0x13')](_0xa5be('0xd'),auth[_0xa5be('0xb')](),controller[_0xa5be('0x14')]);router[_0xa5be('0x15')](_0xa5be('0xd'),auth[_0xa5be('0xb')](),controller[_0xa5be('0x16')]);module[_0xa5be('0x17')]=router; \ No newline at end of file +var _0x5dd1=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x19a937,_0x12cf7f){var _0x1e47eb=function(_0x47905e){while(--_0x47905e){_0x19a937['push'](_0x19a937['shift']());}};_0x1e47eb(++_0x12cf7f);}(_0x5dd1,0x1ab));var _0x15dd=function(_0x34bbed,_0x2f6ee5){_0x34bbed=_0x34bbed-0x0;var _0x33c989=_0x5dd1[_0x34bbed];return _0x33c989;};'use strict';var multer=require(_0x15dd('0x0'));var util=require(_0x15dd('0x1'));var path=require(_0x15dd('0x2'));var timeout=require(_0x15dd('0x3'));var express=require(_0x15dd('0x4'));var router=express[_0x15dd('0x5')]();var fs_extra=require(_0x15dd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x15dd('0x7'));var config=require(_0x15dd('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x15dd('0x9')]('/',auth[_0x15dd('0xa')](),controller[_0x15dd('0xb')]);router[_0x15dd('0x9')]('/:id',auth[_0x15dd('0xa')](),controller['show']);router[_0x15dd('0x9')](_0x15dd('0xc'),auth[_0x15dd('0xa')](),controller[_0x15dd('0xd')]);router['get'](_0x15dd('0xe'),auth['isAuthenticated'](),controller[_0x15dd('0xf')]);router['get']('/:id/descriptions',auth[_0x15dd('0xa')](),controller[_0x15dd('0x10')]);router[_0x15dd('0x11')]('/',auth[_0x15dd('0xa')](),controller[_0x15dd('0x12')]);router[_0x15dd('0x13')](_0x15dd('0x14'),auth['isAuthenticated'](),controller[_0x15dd('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15dd('0x16')]);module[_0x15dd('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f48dce1..016b2c4 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 _0xe16d=['exports','STRING','sequelize'];(function(_0x2d9357,_0x2b2efd){var _0x334c81=function(_0x15f0fd){while(--_0x15f0fd){_0x2d9357['push'](_0x2d9357['shift']());}};_0x334c81(++_0x2b2efd);}(_0xe16d,0xaa));var _0xde16=function(_0x26b5fa,_0x1bea6f){_0x26b5fa=_0x26b5fa-0x0;var _0x4568c9=_0xe16d[_0x26b5fa];return _0x4568c9;};'use strict';var Sequelize=require(_0xde16('0x0'));module[_0xde16('0x1')]={'name':{'type':Sequelize[_0xde16('0x2')]},'description':{'type':Sequelize[_0xde16('0x2')]}}; \ No newline at end of file +var _0x8878=['STRING','sequelize','exports'];(function(_0x447307,_0x17f67e){var _0x503f4e=function(_0x6061cb){while(--_0x6061cb){_0x447307['push'](_0x447307['shift']());}};_0x503f4e(++_0x17f67e);}(_0x8878,0x1d2));var _0x8887=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x8878[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require(_0x8887('0x0'));module[_0x8887('0x1')]={'name':{'type':Sequelize[_0x8887('0x2')]},'description':{'type':Sequelize[_0x8887('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a58b3e3..7f22390 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 _0x23e3=['keys','find','create','body','update','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','end','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','findAll','catch','show','params'];(function(_0x6bd3,_0x32eec0){var _0x109049=function(_0x11ded9){while(--_0x11ded9){_0x6bd3['push'](_0x6bd3['shift']());}};_0x109049(++_0x32eec0);}(_0x23e3,0x191));var _0x323e=function(_0x16e25c,_0x47f742){_0x16e25c=_0x16e25c-0x0;var _0x4e9d95=_0x23e3[_0x16e25c];return _0x4e9d95;};'use strict';var emlformat=require(_0x323e('0x0'));var rimraf=require(_0x323e('0x1'));var zipdir=require(_0x323e('0x2'));var jsonpatch=require(_0x323e('0x3'));var rp=require(_0x323e('0x4'));var moment=require(_0x323e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x323e('0x6'));var path=require(_0x323e('0x7'));var sox=require(_0x323e('0x8'));var csv=require('to-csv');var ejs=require(_0x323e('0x9'));var fs=require('fs');var fs_extra=require(_0x323e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x323e('0xb'));var jsforce=require(_0x323e('0xc'));var deskjs=require(_0x323e('0xd'));var toCsv=require(_0x323e('0xe'));var querystring=require('querystring');var Papa=require(_0x323e('0xf'));var Redis=require(_0x323e('0x10'));var authService=require(_0x323e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x323e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x323e('0x13'))(_0x323e('0x14'));var utils=require(_0x323e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x323e('0x16'));var db=require(_0x323e('0x17'))['db'];function respondWithStatusCode(_0x53b90f,_0x367f07){_0x367f07=_0x367f07||0xcc;return function(_0x44ab8a){if(_0x44ab8a){return _0x53b90f[_0x323e('0x18')](_0x367f07);}return _0x53b90f[_0x323e('0x19')](_0x367f07)['end']();};}function respondWithResult(_0x1ca845,_0x45e98a){_0x45e98a=_0x45e98a||0xc8;return function(_0x2f8142){if(_0x2f8142){return _0x1ca845[_0x323e('0x19')](_0x45e98a)[_0x323e('0x1a')](_0x2f8142);}};}function respondWithFilteredResult(_0x5f4a8d,_0x4ddb3f){return function(_0x1db690){if(_0x1db690){var _0x1e16eb=typeof _0x4ddb3f['offset']===_0x323e('0x1b')&&typeof _0x4ddb3f[_0x323e('0x1c')]===_0x323e('0x1b');var _0xaa9e3c=_0x1db690[_0x323e('0x1d')];var _0x159946=_0x1e16eb?0x0:_0x4ddb3f[_0x323e('0x1e')];var _0x115379=_0x1e16eb?_0x1db690[_0x323e('0x1d')]:_0x4ddb3f[_0x323e('0x1e')]+_0x4ddb3f[_0x323e('0x1c')];var _0x1bb892;if(_0x115379>=_0xaa9e3c){_0x115379=_0xaa9e3c;_0x1bb892=0xc8;}else{_0x1bb892=0xce;}_0x5f4a8d['status'](_0x1bb892);return _0x5f4a8d[_0x323e('0x1f')]('Content-Range',_0x159946+'-'+_0x115379+'/'+_0xaa9e3c)[_0x323e('0x1a')](_0x1db690);}return null;};}function patchUpdates(_0x5552ab){return function(_0x2c252a){try{jsonpatch[_0x323e('0x20')](_0x2c252a,_0x5552ab,!![]);}catch(_0x3e8f9d){return BPromise[_0x323e('0x21')](_0x3e8f9d);}return _0x2c252a[_0x323e('0x22')]();};}function saveUpdates(_0xb08997,_0x86e08a){return function(_0x5bfd7b){if(_0x5bfd7b){return _0x5bfd7b['update'](_0xb08997)['then'](function(_0x3351cd){return _0x3351cd;});}return null;};}function removeEntity(_0x53f156,_0x20f1c2){return function(_0x3b3f5c){if(_0x3b3f5c){return _0x3b3f5c[_0x323e('0x23')]()['then'](function(){_0x53f156[_0x323e('0x19')](0xcc)[_0x323e('0x24')]();});}};}function handleEntityNotFound(_0x3f02ea,_0x543c64){return function(_0x71a997){if(!_0x71a997){_0x3f02ea['sendStatus'](0x194);}return _0x71a997;};}function handleError(_0x3d831f,_0x3d8f22){_0x3d8f22=_0x3d8f22||0x1f4;return function(_0x473d8b){logger[_0x323e('0x25')](_0x473d8b[_0x323e('0x26')]);if(_0x473d8b[_0x323e('0x27')]){delete _0x473d8b['name'];}_0x3d831f[_0x323e('0x19')](_0x3d8f22)[_0x323e('0x28')](_0x473d8b);};}exports[_0x323e('0x29')]=function(_0x5b86f9,_0x3d3d5b){var _0x24f7e1={},_0x312cb2={},_0x3f4b70={'count':0x0,'rows':[]};var _0x1ee57f=_['map'](db[_0x323e('0x2a')][_0x323e('0x2b')],function(_0x83c36b){return{'name':_0x83c36b['fieldName'],'type':_0x83c36b['type'][_0x323e('0x2c')]};});_0x312cb2[_0x323e('0x2d')]=_[_0x323e('0x2e')](_0x1ee57f,_0x323e('0x27'));_0x312cb2[_0x323e('0x2f')]=_['keys'](_0x5b86f9[_0x323e('0x2f')]);_0x312cb2['filters']=_[_0x323e('0x30')](_0x312cb2['model'],_0x312cb2[_0x323e('0x2f')]);_0x24f7e1[_0x323e('0x31')]=_[_0x323e('0x30')](_0x312cb2[_0x323e('0x2d')],qs['fields'](_0x5b86f9[_0x323e('0x2f')][_0x323e('0x32')]));_0x24f7e1['attributes']=_0x24f7e1[_0x323e('0x31')][_0x323e('0x33')]?_0x24f7e1[_0x323e('0x31')]:_0x312cb2[_0x323e('0x2d')];if(!_0x5b86f9[_0x323e('0x2f')][_0x323e('0x34')]('nolimit')){_0x24f7e1[_0x323e('0x1c')]=qs[_0x323e('0x1c')](_0x5b86f9[_0x323e('0x2f')][_0x323e('0x1c')]);_0x24f7e1[_0x323e('0x1e')]=qs[_0x323e('0x1e')](_0x5b86f9[_0x323e('0x2f')][_0x323e('0x1e')]);}_0x24f7e1[_0x323e('0x35')]=qs[_0x323e('0x36')](_0x5b86f9[_0x323e('0x2f')][_0x323e('0x36')]);_0x24f7e1['where']=qs[_0x323e('0x37')](_[_0x323e('0x38')](_0x5b86f9[_0x323e('0x2f')],_0x312cb2[_0x323e('0x37')]),_0x1ee57f);if(_0x5b86f9[_0x323e('0x2f')][_0x323e('0x39')]){_0x24f7e1[_0x323e('0x3a')]=_[_0x323e('0x3b')](_0x24f7e1[_0x323e('0x3a')],{'$or':_[_0x323e('0x2e')](_0x1ee57f,function(_0x29d9b2){if(_0x29d9b2['type']!==_0x323e('0x3c')){var _0x53ab8c={};_0x53ab8c[_0x29d9b2[_0x323e('0x27')]]={'$like':'%'+_0x5b86f9[_0x323e('0x2f')][_0x323e('0x39')]+'%'};return _0x53ab8c;}})});}_0x24f7e1=_['merge']({},_0x24f7e1,_0x5b86f9[_0x323e('0x3d')]);var _0x47b0fd={'where':_0x24f7e1[_0x323e('0x3a')]};return db['SugarcrmConfiguration'][_0x323e('0x1d')](_0x47b0fd)[_0x323e('0x3e')](function(_0x3e544b){_0x3f4b70['count']=_0x3e544b;if(_0x5b86f9[_0x323e('0x2f')]['includeAll']){_0x24f7e1['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x323e('0x3f')](_0x24f7e1);})[_0x323e('0x3e')](function(_0x2e6fde){_0x3f4b70['rows']=_0x2e6fde;return _0x3f4b70;})[_0x323e('0x3e')](respondWithFilteredResult(_0x3d3d5b,_0x24f7e1))[_0x323e('0x40')](handleError(_0x3d3d5b,null));};exports[_0x323e('0x41')]=function(_0x553f9d,_0x33df8a){var _0x145149={'raw':![],'where':{'id':_0x553f9d[_0x323e('0x42')]['id']}},_0x4d8b59={};_0x4d8b59['model']=_[_0x323e('0x43')](db[_0x323e('0x2a')][_0x323e('0x2b')]);_0x4d8b59[_0x323e('0x2f')]=_[_0x323e('0x43')](_0x553f9d['query']);_0x4d8b59[_0x323e('0x37')]=_[_0x323e('0x30')](_0x4d8b59[_0x323e('0x2d')],_0x4d8b59[_0x323e('0x2f')]);_0x145149['attributes']=_['intersection'](_0x4d8b59['model'],qs[_0x323e('0x32')](_0x553f9d[_0x323e('0x2f')][_0x323e('0x32')]));_0x145149[_0x323e('0x31')]=_0x145149[_0x323e('0x31')]['length']?_0x145149[_0x323e('0x31')]:_0x4d8b59[_0x323e('0x2d')];if(_0x553f9d[_0x323e('0x2f')]['includeAll']){_0x145149['include']=[{'all':!![]}];}_0x145149=_['merge']({},_0x145149,_0x553f9d['options']);return db['SugarcrmConfiguration'][_0x323e('0x44')](_0x145149)[_0x323e('0x3e')](handleEntityNotFound(_0x33df8a,null))[_0x323e('0x3e')](respondWithResult(_0x33df8a,null))['catch'](handleError(_0x33df8a,null));};exports[_0x323e('0x45')]=function(_0x4f76f5,_0x5eda0a){return db[_0x323e('0x2a')][_0x323e('0x45')](_0x4f76f5[_0x323e('0x46')],{})[_0x323e('0x3e')](respondWithResult(_0x5eda0a,0xc9))[_0x323e('0x40')](handleError(_0x5eda0a,null));};exports[_0x323e('0x47')]=function(_0x48b3ea,_0x3b9e36){if(_0x48b3ea[_0x323e('0x46')]['id']){delete _0x48b3ea[_0x323e('0x46')]['id'];}return db['SugarcrmConfiguration'][_0x323e('0x44')]({'where':{'id':_0x48b3ea['params']['id']}})[_0x323e('0x3e')](handleEntityNotFound(_0x3b9e36,null))['then'](saveUpdates(_0x48b3ea[_0x323e('0x46')],null))[_0x323e('0x3e')](respondWithResult(_0x3b9e36,null))['catch'](handleError(_0x3b9e36,null));};exports['destroy']=function(_0x2fc2a0,_0x384863){return db[_0x323e('0x2a')][_0x323e('0x44')]({'where':{'id':_0x2fc2a0['params']['id']}})['then'](handleEntityNotFound(_0x384863,null))['then'](removeEntity(_0x384863,null))['catch'](handleError(_0x384863,null));};exports[_0x323e('0x48')]=function(_0x24856a,_0x25b1bb,_0x14a696){var _0x210033={};var _0x5ca763={};var _0x57e81c;var _0x4aa9f2;return db[_0x323e('0x2a')][_0x323e('0x49')]({'where':{'id':_0x24856a[_0x323e('0x42')]['id']}})[_0x323e('0x3e')](handleEntityNotFound(_0x25b1bb,null))['then'](function(_0x1def6a){if(_0x1def6a){_0x57e81c=_0x1def6a;_0x5ca763[_0x323e('0x2d')]=_[_0x323e('0x43')](db[_0x323e('0x4a')][_0x323e('0x2b')]);_0x5ca763[_0x323e('0x2f')]=_[_0x323e('0x43')](_0x24856a['query']);_0x5ca763[_0x323e('0x37')]=_['intersection'](_0x5ca763[_0x323e('0x2d')],_0x5ca763[_0x323e('0x2f')]);_0x210033['attributes']=_[_0x323e('0x30')](_0x5ca763[_0x323e('0x2d')],qs['fields'](_0x24856a[_0x323e('0x2f')]['fields']));_0x210033['attributes']=_0x210033[_0x323e('0x31')][_0x323e('0x33')]?_0x210033[_0x323e('0x31')]:_0x5ca763[_0x323e('0x2d')];_0x210033[_0x323e('0x35')]=qs[_0x323e('0x36')](_0x24856a[_0x323e('0x2f')]['sort']);_0x210033[_0x323e('0x3a')]=qs[_0x323e('0x37')](_[_0x323e('0x38')](_0x24856a['query'],_0x5ca763['filters']));if(_0x24856a[_0x323e('0x2f')]['filter']){_0x210033[_0x323e('0x3a')]=_[_0x323e('0x3b')](_0x210033['where'],{'$or':_['map'](_0x210033[_0x323e('0x31')],function(_0x3d022f){var _0x3777be={};_0x3777be[_0x3d022f]={'$like':'%'+_0x24856a['query']['filter']+'%'};return _0x3777be;})});}_0x210033=_[_0x323e('0x3b')]({},_0x210033,_0x24856a[_0x323e('0x3d')]);return _0x57e81c[_0x323e('0x48')](_0x210033);}})[_0x323e('0x3e')](function(_0x458e5e){if(_0x458e5e){_0x4aa9f2=_0x458e5e[_0x323e('0x33')];if(!_0x24856a[_0x323e('0x2f')][_0x323e('0x34')](_0x323e('0x4b'))){_0x210033[_0x323e('0x1c')]=qs[_0x323e('0x1c')](_0x24856a[_0x323e('0x2f')][_0x323e('0x1c')]);_0x210033[_0x323e('0x1e')]=qs['offset'](_0x24856a[_0x323e('0x2f')][_0x323e('0x1e')]);}return _0x57e81c['getFields'](_0x210033);}})[_0x323e('0x3e')](function(_0x16abae){if(_0x16abae){return _0x16abae?{'count':_0x4aa9f2,'rows':_0x16abae}:null;}})[_0x323e('0x3e')](respondWithResult(_0x25b1bb,null))[_0x323e('0x40')](handleError(_0x25b1bb,null));};exports[_0x323e('0x4c')]=function(_0x38a975,_0x268a48,_0x5812a3){var _0x318ea7={};var _0x287cd2={};var _0xe56cd0;var _0x369933;return db['SugarcrmConfiguration'][_0x323e('0x49')]({'where':{'id':_0x38a975['params']['id']}})[_0x323e('0x3e')](handleEntityNotFound(_0x268a48,null))[_0x323e('0x3e')](function(_0x7fcb55){if(_0x7fcb55){_0xe56cd0=_0x7fcb55;_0x287cd2[_0x323e('0x2d')]=_[_0x323e('0x43')](db[_0x323e('0x4a')][_0x323e('0x2b')]);_0x287cd2[_0x323e('0x2f')]=_['keys'](_0x38a975[_0x323e('0x2f')]);_0x287cd2[_0x323e('0x37')]=_[_0x323e('0x30')](_0x287cd2[_0x323e('0x2d')],_0x287cd2[_0x323e('0x2f')]);_0x318ea7[_0x323e('0x31')]=_[_0x323e('0x30')](_0x287cd2[_0x323e('0x2d')],qs[_0x323e('0x32')](_0x38a975[_0x323e('0x2f')]['fields']));_0x318ea7[_0x323e('0x31')]=_0x318ea7[_0x323e('0x31')][_0x323e('0x33')]?_0x318ea7['attributes']:_0x287cd2[_0x323e('0x2d')];_0x318ea7[_0x323e('0x35')]=qs[_0x323e('0x36')](_0x38a975[_0x323e('0x2f')][_0x323e('0x36')]);_0x318ea7[_0x323e('0x3a')]=qs[_0x323e('0x37')](_[_0x323e('0x38')](_0x38a975[_0x323e('0x2f')],_0x287cd2[_0x323e('0x37')]));if(_0x38a975[_0x323e('0x2f')][_0x323e('0x39')]){_0x318ea7[_0x323e('0x3a')]=_[_0x323e('0x3b')](_0x318ea7[_0x323e('0x3a')],{'$or':_[_0x323e('0x2e')](_0x318ea7[_0x323e('0x31')],function(_0x528d15){var _0x3d26cd={};_0x3d26cd[_0x528d15]={'$like':'%'+_0x38a975[_0x323e('0x2f')][_0x323e('0x39')]+'%'};return _0x3d26cd;})});}_0x318ea7=_[_0x323e('0x3b')]({},_0x318ea7,_0x38a975[_0x323e('0x3d')]);return _0xe56cd0[_0x323e('0x4c')](_0x318ea7);}})[_0x323e('0x3e')](function(_0x563c1a){if(_0x563c1a){_0x369933=_0x563c1a['length'];if(!_0x38a975[_0x323e('0x2f')][_0x323e('0x34')](_0x323e('0x4b'))){_0x318ea7[_0x323e('0x1c')]=qs[_0x323e('0x1c')](_0x38a975[_0x323e('0x2f')][_0x323e('0x1c')]);_0x318ea7['offset']=qs[_0x323e('0x1e')](_0x38a975['query'][_0x323e('0x1e')]);}return _0xe56cd0[_0x323e('0x4c')](_0x318ea7);}})[_0x323e('0x3e')](function(_0x39d07b){if(_0x39d07b){return _0x39d07b?{'count':_0x369933,'rows':_0x39d07b}:null;}})[_0x323e('0x3e')](respondWithResult(_0x268a48,null))[_0x323e('0x40')](handleError(_0x268a48,null));};exports[_0x323e('0x4d')]=function(_0x4a4563,_0x2190a0,_0x540c54){var _0xc5b908={};var _0x4888fb={};var _0x5c768c;var _0x598adf;return db[_0x323e('0x2a')][_0x323e('0x49')]({'where':{'id':_0x4a4563[_0x323e('0x42')]['id']}})[_0x323e('0x3e')](handleEntityNotFound(_0x2190a0,null))[_0x323e('0x3e')](function(_0x4b0779){if(_0x4b0779){_0x5c768c=_0x4b0779;_0x4888fb[_0x323e('0x2d')]=_['keys'](db[_0x323e('0x4a')][_0x323e('0x2b')]);_0x4888fb[_0x323e('0x2f')]=_[_0x323e('0x43')](_0x4a4563[_0x323e('0x2f')]);_0x4888fb[_0x323e('0x37')]=_[_0x323e('0x30')](_0x4888fb[_0x323e('0x2d')],_0x4888fb[_0x323e('0x2f')]);_0xc5b908['attributes']=_['intersection'](_0x4888fb[_0x323e('0x2d')],qs[_0x323e('0x32')](_0x4a4563[_0x323e('0x2f')]['fields']));_0xc5b908[_0x323e('0x31')]=_0xc5b908['attributes'][_0x323e('0x33')]?_0xc5b908[_0x323e('0x31')]:_0x4888fb['model'];_0xc5b908['order']=qs[_0x323e('0x36')](_0x4a4563['query'][_0x323e('0x36')]);_0xc5b908[_0x323e('0x3a')]=qs['filters'](_[_0x323e('0x38')](_0x4a4563[_0x323e('0x2f')],_0x4888fb[_0x323e('0x37')]));if(_0x4a4563[_0x323e('0x2f')][_0x323e('0x39')]){_0xc5b908[_0x323e('0x3a')]=_['merge'](_0xc5b908['where'],{'$or':_[_0x323e('0x2e')](_0xc5b908[_0x323e('0x31')],function(_0x273a5a){var _0x9cb654={};_0x9cb654[_0x273a5a]={'$like':'%'+_0x4a4563[_0x323e('0x2f')]['filter']+'%'};return _0x9cb654;})});}_0xc5b908=_['merge']({},_0xc5b908,_0x4a4563[_0x323e('0x3d')]);return _0x5c768c['getDescriptions'](_0xc5b908);}})[_0x323e('0x3e')](function(_0x456d4a){if(_0x456d4a){_0x598adf=_0x456d4a[_0x323e('0x33')];if(!_0x4a4563[_0x323e('0x2f')][_0x323e('0x34')](_0x323e('0x4b'))){_0xc5b908[_0x323e('0x1c')]=qs['limit'](_0x4a4563[_0x323e('0x2f')]['limit']);_0xc5b908['offset']=qs[_0x323e('0x1e')](_0x4a4563[_0x323e('0x2f')][_0x323e('0x1e')]);}return _0x5c768c['getDescriptions'](_0xc5b908);}})[_0x323e('0x3e')](function(_0x28b77c){if(_0x28b77c){return _0x28b77c?{'count':_0x598adf,'rows':_0x28b77c}:null;}})[_0x323e('0x3e')](respondWithResult(_0x2190a0,null))[_0x323e('0x40')](handleError(_0x2190a0,null));}; \ No newline at end of file +var _0xad45=['VIRTUAL','options','findAll','rows','show','params','attributes','includeAll','catch','create','body','find','getFields','findOne','getSubjects','getDescriptions','SugarcrmField','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type'];(function(_0x5cb16e,_0x3a3b3f){var _0x1db216=function(_0x1f75b2){while(--_0x1f75b2){_0x5cb16e['push'](_0x5cb16e['shift']());}};_0x1db216(++_0x3a3b3f);}(_0xad45,0x19c));var _0x5ad4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad45[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5ad4('0x0'));var rimraf=require(_0x5ad4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ad4('0x2'));var rp=require(_0x5ad4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ad4('0x4'));var util=require(_0x5ad4('0x5'));var path=require('path');var sox=require(_0x5ad4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ad4('0x7'));var _=require(_0x5ad4('0x8'));var squel=require(_0x5ad4('0x9'));var crypto=require(_0x5ad4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5ad4('0xb'));var toCsv=require(_0x5ad4('0xc'));var querystring=require(_0x5ad4('0xd'));var Papa=require('papaparse');var Redis=require(_0x5ad4('0xe'));var authService=require(_0x5ad4('0xf'));var qs=require(_0x5ad4('0x10'));var as=require(_0x5ad4('0x11'));var hardwareService=require(_0x5ad4('0x12'));var logger=require('../../config/logger')(_0x5ad4('0x13'));var utils=require('../../config/utils');var config=require(_0x5ad4('0x14'));var licenseUtil=require(_0x5ad4('0x15'));var db=require(_0x5ad4('0x16'))['db'];function respondWithStatusCode(_0x18cb4e,_0x118f8e){_0x118f8e=_0x118f8e||0xcc;return function(_0x22f9a5){if(_0x22f9a5){return _0x18cb4e[_0x5ad4('0x17')](_0x118f8e);}return _0x18cb4e['status'](_0x118f8e)[_0x5ad4('0x18')]();};}function respondWithResult(_0x4e762b,_0x334667){_0x334667=_0x334667||0xc8;return function(_0x3b5707){if(_0x3b5707){return _0x4e762b[_0x5ad4('0x19')](_0x334667)[_0x5ad4('0x1a')](_0x3b5707);}};}function respondWithFilteredResult(_0x4bf71f,_0xd7ba5d){return function(_0x28e884){if(_0x28e884){var _0x3d7ce0=typeof _0xd7ba5d[_0x5ad4('0x1b')]===_0x5ad4('0x1c')&&typeof _0xd7ba5d[_0x5ad4('0x1d')]===_0x5ad4('0x1c');var _0x2879f3=_0x28e884[_0x5ad4('0x1e')];var _0x5505cf=_0x3d7ce0?0x0:_0xd7ba5d[_0x5ad4('0x1b')];var _0x3f68a4=_0x3d7ce0?_0x28e884[_0x5ad4('0x1e')]:_0xd7ba5d[_0x5ad4('0x1b')]+_0xd7ba5d[_0x5ad4('0x1d')];var _0x3d2e34;if(_0x3f68a4>=_0x2879f3){_0x3f68a4=_0x2879f3;_0x3d2e34=0xc8;}else{_0x3d2e34=0xce;}_0x4bf71f[_0x5ad4('0x19')](_0x3d2e34);return _0x4bf71f[_0x5ad4('0x1f')](_0x5ad4('0x20'),_0x5505cf+'-'+_0x3f68a4+'/'+_0x2879f3)['json'](_0x28e884);}return null;};}function patchUpdates(_0x254897){return function(_0x35902b){try{jsonpatch[_0x5ad4('0x21')](_0x35902b,_0x254897,!![]);}catch(_0x5a4942){return BPromise[_0x5ad4('0x22')](_0x5a4942);}return _0x35902b[_0x5ad4('0x23')]();};}function saveUpdates(_0x18d867,_0xcb755b){return function(_0x575e0c){if(_0x575e0c){return _0x575e0c[_0x5ad4('0x24')](_0x18d867)['then'](function(_0x3de939){return _0x3de939;});}return null;};}function removeEntity(_0x9afed3,_0x5eabf7){return function(_0x4b380f){if(_0x4b380f){return _0x4b380f[_0x5ad4('0x25')]()[_0x5ad4('0x26')](function(){_0x9afed3[_0x5ad4('0x19')](0xcc)[_0x5ad4('0x18')]();});}};}function handleEntityNotFound(_0x18af70,_0x1de97d){return function(_0x2c325f){if(!_0x2c325f){_0x18af70['sendStatus'](0x194);}return _0x2c325f;};}function handleError(_0x20eb4e,_0x4f85b5){_0x4f85b5=_0x4f85b5||0x1f4;return function(_0x169ffd){logger[_0x5ad4('0x27')](_0x169ffd['stack']);if(_0x169ffd[_0x5ad4('0x28')]){delete _0x169ffd[_0x5ad4('0x28')];}_0x20eb4e[_0x5ad4('0x19')](_0x4f85b5)[_0x5ad4('0x29')](_0x169ffd);};}exports['index']=function(_0x1601e1,_0x214ab2){var _0x3dfd48={},_0x4187cb={},_0x968272={'count':0x0,'rows':[]};var _0x459daf=_[_0x5ad4('0x2a')](db[_0x5ad4('0x2b')][_0x5ad4('0x2c')],function(_0xa32c6b){return{'name':_0xa32c6b[_0x5ad4('0x2d')],'type':_0xa32c6b['type']['key']};});_0x4187cb[_0x5ad4('0x2e')]=_['map'](_0x459daf,_0x5ad4('0x28'));_0x4187cb[_0x5ad4('0x2f')]=_[_0x5ad4('0x30')](_0x1601e1['query']);_0x4187cb['filters']=_[_0x5ad4('0x31')](_0x4187cb[_0x5ad4('0x2e')],_0x4187cb[_0x5ad4('0x2f')]);_0x3dfd48['attributes']=_[_0x5ad4('0x31')](_0x4187cb[_0x5ad4('0x2e')],qs[_0x5ad4('0x32')](_0x1601e1[_0x5ad4('0x2f')][_0x5ad4('0x32')]));_0x3dfd48['attributes']=_0x3dfd48['attributes'][_0x5ad4('0x33')]?_0x3dfd48['attributes']:_0x4187cb[_0x5ad4('0x2e')];if(!_0x1601e1[_0x5ad4('0x2f')][_0x5ad4('0x34')](_0x5ad4('0x35'))){_0x3dfd48[_0x5ad4('0x1d')]=qs[_0x5ad4('0x1d')](_0x1601e1[_0x5ad4('0x2f')][_0x5ad4('0x1d')]);_0x3dfd48['offset']=qs[_0x5ad4('0x1b')](_0x1601e1['query']['offset']);}_0x3dfd48[_0x5ad4('0x36')]=qs[_0x5ad4('0x37')](_0x1601e1[_0x5ad4('0x2f')][_0x5ad4('0x37')]);_0x3dfd48[_0x5ad4('0x38')]=qs[_0x5ad4('0x39')](_[_0x5ad4('0x3a')](_0x1601e1[_0x5ad4('0x2f')],_0x4187cb[_0x5ad4('0x39')]),_0x459daf);if(_0x1601e1['query'][_0x5ad4('0x3b')]){_0x3dfd48[_0x5ad4('0x38')]=_[_0x5ad4('0x3c')](_0x3dfd48[_0x5ad4('0x38')],{'$or':_[_0x5ad4('0x2a')](_0x459daf,function(_0x4c2917){if(_0x4c2917[_0x5ad4('0x3d')]!==_0x5ad4('0x3e')){var _0x185b86={};_0x185b86[_0x4c2917['name']]={'$like':'%'+_0x1601e1[_0x5ad4('0x2f')][_0x5ad4('0x3b')]+'%'};return _0x185b86;}})});}_0x3dfd48=_['merge']({},_0x3dfd48,_0x1601e1[_0x5ad4('0x3f')]);var _0x34d2ec={'where':_0x3dfd48[_0x5ad4('0x38')]};return db['SugarcrmConfiguration']['count'](_0x34d2ec)[_0x5ad4('0x26')](function(_0x407c74){_0x968272[_0x5ad4('0x1e')]=_0x407c74;if(_0x1601e1[_0x5ad4('0x2f')]['includeAll']){_0x3dfd48['include']=[{'all':!![]}];}return db[_0x5ad4('0x2b')][_0x5ad4('0x40')](_0x3dfd48);})[_0x5ad4('0x26')](function(_0x16de42){_0x968272[_0x5ad4('0x41')]=_0x16de42;return _0x968272;})[_0x5ad4('0x26')](respondWithFilteredResult(_0x214ab2,_0x3dfd48))['catch'](handleError(_0x214ab2,null));};exports[_0x5ad4('0x42')]=function(_0x38e969,_0x1fef0d){var _0x2e7bc8={'raw':![],'where':{'id':_0x38e969[_0x5ad4('0x43')]['id']}},_0x552c9e={};_0x552c9e['model']=_[_0x5ad4('0x30')](db[_0x5ad4('0x2b')][_0x5ad4('0x2c')]);_0x552c9e[_0x5ad4('0x2f')]=_[_0x5ad4('0x30')](_0x38e969[_0x5ad4('0x2f')]);_0x552c9e[_0x5ad4('0x39')]=_[_0x5ad4('0x31')](_0x552c9e[_0x5ad4('0x2e')],_0x552c9e['query']);_0x2e7bc8[_0x5ad4('0x44')]=_[_0x5ad4('0x31')](_0x552c9e['model'],qs['fields'](_0x38e969[_0x5ad4('0x2f')]['fields']));_0x2e7bc8['attributes']=_0x2e7bc8['attributes'][_0x5ad4('0x33')]?_0x2e7bc8['attributes']:_0x552c9e[_0x5ad4('0x2e')];if(_0x38e969[_0x5ad4('0x2f')][_0x5ad4('0x45')]){_0x2e7bc8['include']=[{'all':!![]}];}_0x2e7bc8=_[_0x5ad4('0x3c')]({},_0x2e7bc8,_0x38e969[_0x5ad4('0x3f')]);return db[_0x5ad4('0x2b')]['find'](_0x2e7bc8)[_0x5ad4('0x26')](handleEntityNotFound(_0x1fef0d,null))['then'](respondWithResult(_0x1fef0d,null))[_0x5ad4('0x46')](handleError(_0x1fef0d,null));};exports['create']=function(_0x77d483,_0x10c9b2){return db[_0x5ad4('0x2b')][_0x5ad4('0x47')](_0x77d483['body'],{})[_0x5ad4('0x26')](respondWithResult(_0x10c9b2,0xc9))['catch'](handleError(_0x10c9b2,null));};exports[_0x5ad4('0x24')]=function(_0xe6f081,_0x59ca03){if(_0xe6f081[_0x5ad4('0x48')]['id']){delete _0xe6f081['body']['id'];}return db['SugarcrmConfiguration'][_0x5ad4('0x49')]({'where':{'id':_0xe6f081['params']['id']}})['then'](handleEntityNotFound(_0x59ca03,null))[_0x5ad4('0x26')](saveUpdates(_0xe6f081['body'],null))[_0x5ad4('0x26')](respondWithResult(_0x59ca03,null))[_0x5ad4('0x46')](handleError(_0x59ca03,null));};exports[_0x5ad4('0x25')]=function(_0x2474be,_0x24a571){return db[_0x5ad4('0x2b')][_0x5ad4('0x49')]({'where':{'id':_0x2474be['params']['id']}})['then'](handleEntityNotFound(_0x24a571,null))[_0x5ad4('0x26')](removeEntity(_0x24a571,null))[_0x5ad4('0x46')](handleError(_0x24a571,null));};exports[_0x5ad4('0x4a')]=function(_0x1ee474,_0x49eca7,_0x563b3a){var _0x5bd426={};var _0x756ae9={};var _0x26ed99;var _0x587f8e;return db[_0x5ad4('0x2b')][_0x5ad4('0x4b')]({'where':{'id':_0x1ee474[_0x5ad4('0x43')]['id']}})[_0x5ad4('0x26')](handleEntityNotFound(_0x49eca7,null))[_0x5ad4('0x26')](function(_0xb72d13){if(_0xb72d13){_0x26ed99=_0xb72d13;_0x756ae9[_0x5ad4('0x2e')]=_[_0x5ad4('0x30')](db['SugarcrmField'][_0x5ad4('0x2c')]);_0x756ae9[_0x5ad4('0x2f')]=_['keys'](_0x1ee474[_0x5ad4('0x2f')]);_0x756ae9[_0x5ad4('0x39')]=_['intersection'](_0x756ae9[_0x5ad4('0x2e')],_0x756ae9[_0x5ad4('0x2f')]);_0x5bd426[_0x5ad4('0x44')]=_[_0x5ad4('0x31')](_0x756ae9[_0x5ad4('0x2e')],qs[_0x5ad4('0x32')](_0x1ee474[_0x5ad4('0x2f')][_0x5ad4('0x32')]));_0x5bd426[_0x5ad4('0x44')]=_0x5bd426[_0x5ad4('0x44')][_0x5ad4('0x33')]?_0x5bd426[_0x5ad4('0x44')]:_0x756ae9[_0x5ad4('0x2e')];_0x5bd426[_0x5ad4('0x36')]=qs[_0x5ad4('0x37')](_0x1ee474[_0x5ad4('0x2f')][_0x5ad4('0x37')]);_0x5bd426[_0x5ad4('0x38')]=qs[_0x5ad4('0x39')](_['pick'](_0x1ee474['query'],_0x756ae9[_0x5ad4('0x39')]));if(_0x1ee474['query'][_0x5ad4('0x3b')]){_0x5bd426[_0x5ad4('0x38')]=_['merge'](_0x5bd426[_0x5ad4('0x38')],{'$or':_[_0x5ad4('0x2a')](_0x5bd426[_0x5ad4('0x44')],function(_0x5ea9a4){var _0x364858={};_0x364858[_0x5ea9a4]={'$like':'%'+_0x1ee474[_0x5ad4('0x2f')][_0x5ad4('0x3b')]+'%'};return _0x364858;})});}_0x5bd426=_[_0x5ad4('0x3c')]({},_0x5bd426,_0x1ee474[_0x5ad4('0x3f')]);return _0x26ed99[_0x5ad4('0x4a')](_0x5bd426);}})[_0x5ad4('0x26')](function(_0x3e6148){if(_0x3e6148){_0x587f8e=_0x3e6148[_0x5ad4('0x33')];if(!_0x1ee474[_0x5ad4('0x2f')]['hasOwnProperty'](_0x5ad4('0x35'))){_0x5bd426[_0x5ad4('0x1d')]=qs[_0x5ad4('0x1d')](_0x1ee474['query'][_0x5ad4('0x1d')]);_0x5bd426[_0x5ad4('0x1b')]=qs[_0x5ad4('0x1b')](_0x1ee474['query'][_0x5ad4('0x1b')]);}return _0x26ed99[_0x5ad4('0x4a')](_0x5bd426);}})[_0x5ad4('0x26')](function(_0x15a134){if(_0x15a134){return _0x15a134?{'count':_0x587f8e,'rows':_0x15a134}:null;}})[_0x5ad4('0x26')](respondWithResult(_0x49eca7,null))[_0x5ad4('0x46')](handleError(_0x49eca7,null));};exports['getSubjects']=function(_0x4d2029,_0x532d80,_0x40b790){var _0x505a59={};var _0x2c79f0={};var _0x1d5b80;var _0x47dec4;return db[_0x5ad4('0x2b')][_0x5ad4('0x4b')]({'where':{'id':_0x4d2029[_0x5ad4('0x43')]['id']}})['then'](handleEntityNotFound(_0x532d80,null))[_0x5ad4('0x26')](function(_0x276c4d){if(_0x276c4d){_0x1d5b80=_0x276c4d;_0x2c79f0['model']=_['keys'](db['SugarcrmField'][_0x5ad4('0x2c')]);_0x2c79f0[_0x5ad4('0x2f')]=_[_0x5ad4('0x30')](_0x4d2029[_0x5ad4('0x2f')]);_0x2c79f0[_0x5ad4('0x39')]=_['intersection'](_0x2c79f0['model'],_0x2c79f0[_0x5ad4('0x2f')]);_0x505a59[_0x5ad4('0x44')]=_[_0x5ad4('0x31')](_0x2c79f0[_0x5ad4('0x2e')],qs[_0x5ad4('0x32')](_0x4d2029[_0x5ad4('0x2f')]['fields']));_0x505a59[_0x5ad4('0x44')]=_0x505a59['attributes'][_0x5ad4('0x33')]?_0x505a59[_0x5ad4('0x44')]:_0x2c79f0[_0x5ad4('0x2e')];_0x505a59[_0x5ad4('0x36')]=qs[_0x5ad4('0x37')](_0x4d2029[_0x5ad4('0x2f')][_0x5ad4('0x37')]);_0x505a59[_0x5ad4('0x38')]=qs[_0x5ad4('0x39')](_[_0x5ad4('0x3a')](_0x4d2029['query'],_0x2c79f0[_0x5ad4('0x39')]));if(_0x4d2029[_0x5ad4('0x2f')][_0x5ad4('0x3b')]){_0x505a59[_0x5ad4('0x38')]=_[_0x5ad4('0x3c')](_0x505a59[_0x5ad4('0x38')],{'$or':_[_0x5ad4('0x2a')](_0x505a59[_0x5ad4('0x44')],function(_0x3413c2){var _0x168c1d={};_0x168c1d[_0x3413c2]={'$like':'%'+_0x4d2029[_0x5ad4('0x2f')]['filter']+'%'};return _0x168c1d;})});}_0x505a59=_['merge']({},_0x505a59,_0x4d2029[_0x5ad4('0x3f')]);return _0x1d5b80[_0x5ad4('0x4c')](_0x505a59);}})[_0x5ad4('0x26')](function(_0x3c2a62){if(_0x3c2a62){_0x47dec4=_0x3c2a62[_0x5ad4('0x33')];if(!_0x4d2029['query']['hasOwnProperty'](_0x5ad4('0x35'))){_0x505a59[_0x5ad4('0x1d')]=qs[_0x5ad4('0x1d')](_0x4d2029[_0x5ad4('0x2f')][_0x5ad4('0x1d')]);_0x505a59['offset']=qs['offset'](_0x4d2029['query']['offset']);}return _0x1d5b80[_0x5ad4('0x4c')](_0x505a59);}})[_0x5ad4('0x26')](function(_0x5194d3){if(_0x5194d3){return _0x5194d3?{'count':_0x47dec4,'rows':_0x5194d3}:null;}})['then'](respondWithResult(_0x532d80,null))[_0x5ad4('0x46')](handleError(_0x532d80,null));};exports[_0x5ad4('0x4d')]=function(_0x2ab454,_0x4beca9,_0x113ec1){var _0x43a7ee={};var _0x525f26={};var _0x5c712c;var _0x3ae578;return db[_0x5ad4('0x2b')][_0x5ad4('0x4b')]({'where':{'id':_0x2ab454[_0x5ad4('0x43')]['id']}})[_0x5ad4('0x26')](handleEntityNotFound(_0x4beca9,null))[_0x5ad4('0x26')](function(_0x4deeae){if(_0x4deeae){_0x5c712c=_0x4deeae;_0x525f26[_0x5ad4('0x2e')]=_[_0x5ad4('0x30')](db[_0x5ad4('0x4e')][_0x5ad4('0x2c')]);_0x525f26[_0x5ad4('0x2f')]=_[_0x5ad4('0x30')](_0x2ab454[_0x5ad4('0x2f')]);_0x525f26[_0x5ad4('0x39')]=_['intersection'](_0x525f26[_0x5ad4('0x2e')],_0x525f26['query']);_0x43a7ee['attributes']=_[_0x5ad4('0x31')](_0x525f26[_0x5ad4('0x2e')],qs[_0x5ad4('0x32')](_0x2ab454[_0x5ad4('0x2f')][_0x5ad4('0x32')]));_0x43a7ee[_0x5ad4('0x44')]=_0x43a7ee[_0x5ad4('0x44')][_0x5ad4('0x33')]?_0x43a7ee[_0x5ad4('0x44')]:_0x525f26['model'];_0x43a7ee[_0x5ad4('0x36')]=qs['sort'](_0x2ab454['query']['sort']);_0x43a7ee[_0x5ad4('0x38')]=qs[_0x5ad4('0x39')](_[_0x5ad4('0x3a')](_0x2ab454['query'],_0x525f26[_0x5ad4('0x39')]));if(_0x2ab454[_0x5ad4('0x2f')]['filter']){_0x43a7ee[_0x5ad4('0x38')]=_['merge'](_0x43a7ee[_0x5ad4('0x38')],{'$or':_[_0x5ad4('0x2a')](_0x43a7ee[_0x5ad4('0x44')],function(_0x3d4ada){var _0x44f1e8={};_0x44f1e8[_0x3d4ada]={'$like':'%'+_0x2ab454[_0x5ad4('0x2f')][_0x5ad4('0x3b')]+'%'};return _0x44f1e8;})});}_0x43a7ee=_[_0x5ad4('0x3c')]({},_0x43a7ee,_0x2ab454[_0x5ad4('0x3f')]);return _0x5c712c['getDescriptions'](_0x43a7ee);}})[_0x5ad4('0x26')](function(_0x4a199f){if(_0x4a199f){_0x3ae578=_0x4a199f[_0x5ad4('0x33')];if(!_0x2ab454[_0x5ad4('0x2f')][_0x5ad4('0x34')]('nolimit')){_0x43a7ee[_0x5ad4('0x1d')]=qs['limit'](_0x2ab454[_0x5ad4('0x2f')][_0x5ad4('0x1d')]);_0x43a7ee[_0x5ad4('0x1b')]=qs[_0x5ad4('0x1b')](_0x2ab454['query'][_0x5ad4('0x1b')]);}return _0x5c712c[_0x5ad4('0x4d')](_0x43a7ee);}})[_0x5ad4('0x26')](function(_0x329c83){if(_0x329c83){return _0x329c83?{'count':_0x3ae578,'rows':_0x329c83}:null;}})['then'](respondWithResult(_0x4beca9,null))[_0x5ad4('0x46')](handleError(_0x4beca9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ab49d46..f2c55d3 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 _0x3a05=['int_sugarcrm_configurations','util','../../config/logger','api','moment','path','rimraf','exports','define','SugarcrmConfiguration'];(function(_0x4ed698,_0x4810ab){var _0xef8aa5=function(_0x5dcc95){while(--_0x5dcc95){_0x4ed698['push'](_0x4ed698['shift']());}};_0xef8aa5(++_0x4810ab);}(_0x3a05,0xe7));var _0x53a0=function(_0x168adc,_0x4a6efe){_0x168adc=_0x168adc-0x0;var _0x22dfd4=_0x3a05[_0x168adc];return _0x22dfd4;};'use strict';var _=require('lodash');var util=require(_0x53a0('0x0'));var logger=require(_0x53a0('0x1'))(_0x53a0('0x2'));var moment=require(_0x53a0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53a0('0x4'));var rimraf=require(_0x53a0('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x53a0('0x6')]=function(_0xe7cc63,_0x1eb827){return _0xe7cc63[_0x53a0('0x7')](_0x53a0('0x8'),attributes,{'tableName':_0x53a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa575=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x190966,_0x220183){var _0x5f26e0=function(_0x58a678){while(--_0x58a678){_0x190966['push'](_0x190966['shift']());}};_0x5f26e0(++_0x220183);}(_0xa575,0x1ae));var _0x5a57=function(_0x3d9115,_0x3aa7e7){_0x3d9115=_0x3d9115-0x0;var _0x4b6b7d=_0xa575[_0x3d9115];return _0x4b6b7d;};'use strict';var _=require(_0x5a57('0x0'));var util=require(_0x5a57('0x1'));var logger=require(_0x5a57('0x2'))(_0x5a57('0x3'));var moment=require(_0x5a57('0x4'));var BPromise=require(_0x5a57('0x5'));var rp=require(_0x5a57('0x6'));var fs=require('fs');var path=require(_0x5a57('0x7'));var rimraf=require(_0x5a57('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a57('0x9'));module['exports']=function(_0x306d14,_0x150adb){return _0x306d14[_0x5a57('0xa')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 39d8323..25ff08e 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 _0x4707=['rpc','jayson/promise','client','http','request','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c7e44,_0x41f509){var _0x21f53a=function(_0x3f4e46){while(--_0x3f4e46){_0x5c7e44['push'](_0x5c7e44['shift']());}};_0x21f53a(++_0x41f509);}(_0x4707,0x1b1));var _0x7470=function(_0x366b6f,_0x4c7e55){_0x366b6f=_0x366b6f-0x0;var _0x3a2e86=_0x4707[_0x366b6f];return _0x3a2e86;};'use strict';var _=require(_0x7470('0x0'));var util=require(_0x7470('0x1'));var moment=require(_0x7470('0x2'));var BPromise=require(_0x7470('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7470('0x4'));var db=require(_0x7470('0x5'))['db'];var utils=require(_0x7470('0x6'));var logger=require('../../config/logger')(_0x7470('0x7'));var config=require('../../config/environment');var jayson=require(_0x7470('0x8'));var client=jayson[_0x7470('0x9')][_0x7470('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd7ad,_0x203a6c,_0x110645){return new BPromise(function(_0x4c2d20,_0x2294fd){return client[_0x7470('0xb')](_0x4cd7ad,_0x110645)['then'](function(_0x4b34e8){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x203a6c,'request\x20sent');logger[_0x7470('0xc')](_0x7470('0xd'),_0x203a6c,_0x7470('0xe'),JSON[_0x7470('0xf')](_0x4b34e8));if(_0x4b34e8['error']){if(_0x4b34e8[_0x7470('0x10')][_0x7470('0x11')]===0x1f4){logger['error'](_0x7470('0x12'),_0x203a6c,_0x4b34e8[_0x7470('0x10')][_0x7470('0x13')]);return _0x2294fd(_0x4b34e8[_0x7470('0x10')][_0x7470('0x13')]);}logger[_0x7470('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x203a6c,_0x4b34e8[_0x7470('0x10')][_0x7470('0x13')]);return _0x4c2d20(_0x4b34e8[_0x7470('0x10')][_0x7470('0x13')]);}else{logger[_0x7470('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x203a6c,_0x7470('0xe'));_0x4c2d20(_0x4b34e8[_0x7470('0x15')]['message']);}})['catch'](function(_0x4760a3){logger[_0x7470('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x203a6c,_0x4760a3);_0x2294fd(_0x4760a3);});});} \ No newline at end of file +var _0x5944=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SugarcrmConfiguration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','debug'];(function(_0x1f5b48,_0xbfa6fd){var _0x3620b5=function(_0x53c55c){while(--_0x53c55c){_0x1f5b48['push'](_0x1f5b48['shift']());}};_0x3620b5(++_0xbfa6fd);}(_0x5944,0x1a9));var _0x4594=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5944[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x4594('0x0'));var util=require(_0x4594('0x1'));var moment=require(_0x4594('0x2'));var BPromise=require(_0x4594('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4594('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4594('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4594('0x6'));var client=jayson[_0x4594('0x7')][_0x4594('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eed1b,_0x3a5154,_0x517ec9){return new BPromise(function(_0xec88fe,_0x2a1291){return client['request'](_0x5eed1b,_0x517ec9)[_0x4594('0x9')](function(_0xa98d1b){logger[_0x4594('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a5154,'request\x20sent');logger[_0x4594('0xb')](_0x4594('0xc'),_0x3a5154,_0x4594('0xd'),JSON[_0x4594('0xe')](_0xa98d1b));if(_0xa98d1b[_0x4594('0xf')]){if(_0xa98d1b[_0x4594('0xf')]['code']===0x1f4){logger[_0x4594('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a5154,_0xa98d1b[_0x4594('0xf')]['message']);return _0x2a1291(_0xa98d1b[_0x4594('0xf')][_0x4594('0x10')]);}logger[_0x4594('0xf')](_0x4594('0x11'),_0x3a5154,_0xa98d1b['error'][_0x4594('0x10')]);return _0xec88fe(_0xa98d1b[_0x4594('0xf')]['message']);}else{logger['info'](_0x4594('0x11'),_0x3a5154,_0x4594('0xd'));_0xec88fe(_0xa98d1b[_0x4594('0x12')][_0x4594('0x10')]);}})['catch'](function(_0x1d52b1){logger['error'](_0x4594('0x11'),_0x3a5154,_0x1d52b1);_0x2a1291(_0x1d52b1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5fe0975..f0caff3 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 _0x92fa=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','/:id','isAuthenticated','create','update','delete','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x1c4ec1,_0x231a01){var _0x526970=function(_0x57fac5){while(--_0x57fac5){_0x1c4ec1['push'](_0x1c4ec1['shift']());}};_0x526970(++_0x231a01);}(_0x92fa,0x18a));var _0xa92f=function(_0x2de114,_0xc8e415){_0x2de114=_0x2de114-0x0;var _0x467c98=_0x92fa[_0x2de114];return _0x467c98;};'use strict';var multer=require(_0xa92f('0x0'));var util=require(_0xa92f('0x1'));var path=require(_0xa92f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa92f('0x3'));var router=express[_0xa92f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa92f('0x5'));var interaction=require(_0xa92f('0x6'));var config=require(_0xa92f('0x7'));var controller=require(_0xa92f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa92f('0x9')]);router['get'](_0xa92f('0xa'),auth[_0xa92f('0xb')](),controller['show']);router['post']('/',auth[_0xa92f('0xb')](),controller[_0xa92f('0xc')]);router['put'](_0xa92f('0xa'),auth[_0xa92f('0xb')](),controller[_0xa92f('0xd')]);router[_0xa92f('0xe')](_0xa92f('0xa'),auth[_0xa92f('0xb')](),controller['destroy']);module[_0xa92f('0xf')]=router; \ No newline at end of file +var _0xff46=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x57e41c,_0x23d354){var _0xd9c399=function(_0x14d072){while(--_0x14d072){_0x57e41c['push'](_0x57e41c['shift']());}};_0xd9c399(++_0x23d354);}(_0xff46,0x14c));var _0x6ff4=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0xff46[_0x1b69aa];return _0x42647d;};'use strict';var multer=require(_0x6ff4('0x0'));var util=require('util');var path=require(_0x6ff4('0x1'));var timeout=require(_0x6ff4('0x2'));var express=require(_0x6ff4('0x3'));var router=express[_0x6ff4('0x4')]();var fs_extra=require(_0x6ff4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ff4('0x6'));var controller=require(_0x6ff4('0x7'));router[_0x6ff4('0x8')]('/',auth[_0x6ff4('0x9')](),controller['index']);router[_0x6ff4('0x8')](_0x6ff4('0xa'),auth[_0x6ff4('0x9')](),controller[_0x6ff4('0xb')]);router[_0x6ff4('0xc')]('/',auth[_0x6ff4('0x9')](),controller[_0x6ff4('0xd')]);router[_0x6ff4('0xe')]('/:id',auth[_0x6ff4('0x9')](),controller[_0x6ff4('0xf')]);router[_0x6ff4('0x10')](_0x6ff4('0xa'),auth[_0x6ff4('0x9')](),controller[_0x6ff4('0x11')]);module[_0x6ff4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ed9d97a..57d6048 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 _0x1f29=['sequelize','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x478868,_0x7da992){var _0x305bed=function(_0x51ddc5){while(--_0x51ddc5){_0x478868['push'](_0x478868['shift']());}};_0x305bed(++_0x7da992);}(_0x1f29,0x181));var _0x91f2=function(_0x5531d9,_0x47d8bb){_0x5531d9=_0x5531d9-0x0;var _0xedc931=_0x1f29[_0x5531d9];return _0xedc931;};'use strict';var Sequelize=require(_0x91f2('0x0'));module['exports']={'type':{'type':Sequelize[_0x91f2('0x1')](_0x91f2('0x2'),'variable',_0x91f2('0x3'),_0x91f2('0x4'),'picklist'),'defaultValue':_0x91f2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x91f2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x91f2('0x2'),_0x91f2('0x6'),_0x91f2('0x3'))},'keyContent':{'type':Sequelize[_0x91f2('0x5')]},'idField':{'type':Sequelize[_0x91f2('0x5')]},'nameField':{'type':Sequelize[_0x91f2('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x91f2('0x5')]}}; \ No newline at end of file +var _0xe624=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3696e8,_0x4d0378){var _0x4b325e=function(_0x21278e){while(--_0x21278e){_0x3696e8['push'](_0x3696e8['shift']());}};_0x4b325e(++_0x4d0378);}(_0xe624,0x9f));var _0x4e62=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xe624[_0x146a97];return _0x259d5c;};'use strict';var Sequelize=require(_0x4e62('0x0'));module[_0x4e62('0x1')]={'type':{'type':Sequelize[_0x4e62('0x2')](_0x4e62('0x3'),_0x4e62('0x4'),_0x4e62('0x5'),'keyValue',_0x4e62('0x6')),'defaultValue':_0x4e62('0x3')},'content':{'type':Sequelize[_0x4e62('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4e62('0x2')]('string','variable',_0x4e62('0x5'))},'keyContent':{'type':Sequelize[_0x4e62('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4e62('0x7')]},'customField':{'type':Sequelize[_0x4e62('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e62('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d20b0e9..e427da2 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 _0x7a18=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','rows','catch','show','params','rawAttributes','include','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','index','map','fieldName','type','key','model','query'];(function(_0x5caa6f,_0x4508a4){var _0x264f34=function(_0x5e8700){while(--_0x5e8700){_0x5caa6f['push'](_0x5caa6f['shift']());}};_0x264f34(++_0x4508a4);}(_0x7a18,0x1a2));var _0x87a1=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x7a18[_0x622035];return _0x326cf2;};'use strict';var emlformat=require(_0x87a1('0x0'));var rimraf=require(_0x87a1('0x1'));var zipdir=require(_0x87a1('0x2'));var jsonpatch=require(_0x87a1('0x3'));var rp=require(_0x87a1('0x4'));var moment=require(_0x87a1('0x5'));var BPromise=require(_0x87a1('0x6'));var Mustache=require(_0x87a1('0x7'));var util=require(_0x87a1('0x8'));var path=require(_0x87a1('0x9'));var sox=require(_0x87a1('0xa'));var csv=require(_0x87a1('0xb'));var ejs=require(_0x87a1('0xc'));var fs=require('fs');var fs_extra=require(_0x87a1('0xd'));var _=require(_0x87a1('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x87a1('0xf'));var deskjs=require(_0x87a1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x87a1('0x11'));var Papa=require('papaparse');var Redis=require(_0x87a1('0x12'));var authService=require(_0x87a1('0x13'));var qs=require(_0x87a1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87a1('0x15'));var logger=require(_0x87a1('0x16'))(_0x87a1('0x17'));var utils=require(_0x87a1('0x18'));var config=require(_0x87a1('0x19'));var licenseUtil=require(_0x87a1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5bc8,_0x262229){_0x262229=_0x262229||0xcc;return function(_0x5d7c52){if(_0x5d7c52){return _0x5d5bc8[_0x87a1('0x1b')](_0x262229);}return _0x5d5bc8[_0x87a1('0x1c')](_0x262229)[_0x87a1('0x1d')]();};}function respondWithResult(_0x30ca35,_0x24d213){_0x24d213=_0x24d213||0xc8;return function(_0xdfce39){if(_0xdfce39){return _0x30ca35[_0x87a1('0x1c')](_0x24d213)['json'](_0xdfce39);}};}function respondWithFilteredResult(_0x12ffca,_0x6997a4){return function(_0x337b82){if(_0x337b82){var _0x417bf3=typeof _0x6997a4['offset']===_0x87a1('0x1e')&&typeof _0x6997a4['limit']===_0x87a1('0x1e');var _0x13676e=_0x337b82[_0x87a1('0x1f')];var _0x2b847d=_0x417bf3?0x0:_0x6997a4['offset'];var _0x27c6cd=_0x417bf3?_0x337b82[_0x87a1('0x1f')]:_0x6997a4[_0x87a1('0x20')]+_0x6997a4[_0x87a1('0x21')];var _0x1e5266;if(_0x27c6cd>=_0x13676e){_0x27c6cd=_0x13676e;_0x1e5266=0xc8;}else{_0x1e5266=0xce;}_0x12ffca[_0x87a1('0x1c')](_0x1e5266);return _0x12ffca[_0x87a1('0x22')](_0x87a1('0x23'),_0x2b847d+'-'+_0x27c6cd+'/'+_0x13676e)[_0x87a1('0x24')](_0x337b82);}return null;};}function patchUpdates(_0x173c44){return function(_0x385235){try{jsonpatch[_0x87a1('0x25')](_0x385235,_0x173c44,!![]);}catch(_0x568772){return BPromise[_0x87a1('0x26')](_0x568772);}return _0x385235['save']();};}function saveUpdates(_0x173562,_0x53d4a3){return function(_0x2edfd6){if(_0x2edfd6){return _0x2edfd6['update'](_0x173562)[_0x87a1('0x27')](function(_0x30bf8a){return _0x30bf8a;});}return null;};}function removeEntity(_0x3859ca,_0x208f11){return function(_0x54e84e){if(_0x54e84e){return _0x54e84e[_0x87a1('0x28')]()[_0x87a1('0x27')](function(){_0x3859ca[_0x87a1('0x1c')](0xcc)[_0x87a1('0x1d')]();});}};}function handleEntityNotFound(_0x30b6e9,_0x521a4d){return function(_0xf84a5e){if(!_0xf84a5e){_0x30b6e9['sendStatus'](0x194);}return _0xf84a5e;};}function handleError(_0x34bed1,_0x351d42){_0x351d42=_0x351d42||0x1f4;return function(_0x37d46b){logger[_0x87a1('0x29')](_0x37d46b['stack']);if(_0x37d46b[_0x87a1('0x2a')]){delete _0x37d46b[_0x87a1('0x2a')];}_0x34bed1[_0x87a1('0x1c')](_0x351d42)['send'](_0x37d46b);};}exports[_0x87a1('0x2b')]=function(_0x59c503,_0xa62bb2){var _0x2c2e62={},_0x21e37d={},_0x1d016a={'count':0x0,'rows':[]};var _0x20ec19=_[_0x87a1('0x2c')](db['SugarcrmField']['rawAttributes'],function(_0x48620f){return{'name':_0x48620f[_0x87a1('0x2d')],'type':_0x48620f[_0x87a1('0x2e')][_0x87a1('0x2f')]};});_0x21e37d[_0x87a1('0x30')]=_[_0x87a1('0x2c')](_0x20ec19,_0x87a1('0x2a'));_0x21e37d[_0x87a1('0x31')]=_[_0x87a1('0x32')](_0x59c503[_0x87a1('0x31')]);_0x21e37d[_0x87a1('0x33')]=_['intersection'](_0x21e37d['model'],_0x21e37d['query']);_0x2c2e62['attributes']=_[_0x87a1('0x34')](_0x21e37d[_0x87a1('0x30')],qs[_0x87a1('0x35')](_0x59c503['query'][_0x87a1('0x35')]));_0x2c2e62[_0x87a1('0x36')]=_0x2c2e62[_0x87a1('0x36')][_0x87a1('0x37')]?_0x2c2e62[_0x87a1('0x36')]:_0x21e37d[_0x87a1('0x30')];if(!_0x59c503[_0x87a1('0x31')][_0x87a1('0x38')](_0x87a1('0x39'))){_0x2c2e62[_0x87a1('0x21')]=qs[_0x87a1('0x21')](_0x59c503[_0x87a1('0x31')][_0x87a1('0x21')]);_0x2c2e62[_0x87a1('0x20')]=qs[_0x87a1('0x20')](_0x59c503[_0x87a1('0x31')][_0x87a1('0x20')]);}_0x2c2e62[_0x87a1('0x3a')]=qs['sort'](_0x59c503['query'][_0x87a1('0x3b')]);_0x2c2e62[_0x87a1('0x3c')]=qs[_0x87a1('0x33')](_[_0x87a1('0x3d')](_0x59c503[_0x87a1('0x31')],_0x21e37d[_0x87a1('0x33')]),_0x20ec19);if(_0x59c503['query'][_0x87a1('0x3e')]){_0x2c2e62[_0x87a1('0x3c')]=_[_0x87a1('0x3f')](_0x2c2e62[_0x87a1('0x3c')],{'$or':_[_0x87a1('0x2c')](_0x20ec19,function(_0x4e0f92){if(_0x4e0f92['type']!==_0x87a1('0x40')){var _0x36cbdf={};_0x36cbdf[_0x4e0f92[_0x87a1('0x2a')]]={'$like':'%'+_0x59c503[_0x87a1('0x31')]['filter']+'%'};return _0x36cbdf;}})});}_0x2c2e62=_[_0x87a1('0x3f')]({},_0x2c2e62,_0x59c503[_0x87a1('0x41')]);var _0x3c5365={'where':_0x2c2e62[_0x87a1('0x3c')]};return db[_0x87a1('0x42')][_0x87a1('0x1f')](_0x3c5365)[_0x87a1('0x27')](function(_0x2bcea9){_0x1d016a[_0x87a1('0x1f')]=_0x2bcea9;if(_0x59c503[_0x87a1('0x31')][_0x87a1('0x43')]){_0x2c2e62['include']=[{'all':!![]}];}return db[_0x87a1('0x42')]['findAll'](_0x2c2e62);})[_0x87a1('0x27')](function(_0x1dbf09){_0x1d016a[_0x87a1('0x44')]=_0x1dbf09;return _0x1d016a;})['then'](respondWithFilteredResult(_0xa62bb2,_0x2c2e62))[_0x87a1('0x45')](handleError(_0xa62bb2,null));};exports[_0x87a1('0x46')]=function(_0x21e73b,_0x34de58){var _0x2eb8d9={'raw':!![],'where':{'id':_0x21e73b[_0x87a1('0x47')]['id']}},_0x1321b5={};_0x1321b5['model']=_[_0x87a1('0x32')](db['SugarcrmField'][_0x87a1('0x48')]);_0x1321b5[_0x87a1('0x31')]=_[_0x87a1('0x32')](_0x21e73b[_0x87a1('0x31')]);_0x1321b5['filters']=_[_0x87a1('0x34')](_0x1321b5[_0x87a1('0x30')],_0x1321b5['query']);_0x2eb8d9['attributes']=_['intersection'](_0x1321b5[_0x87a1('0x30')],qs['fields'](_0x21e73b[_0x87a1('0x31')]['fields']));_0x2eb8d9[_0x87a1('0x36')]=_0x2eb8d9[_0x87a1('0x36')][_0x87a1('0x37')]?_0x2eb8d9['attributes']:_0x1321b5['model'];if(_0x21e73b[_0x87a1('0x31')]['includeAll']){_0x2eb8d9[_0x87a1('0x49')]=[{'all':!![]}];}_0x2eb8d9=_[_0x87a1('0x3f')]({},_0x2eb8d9,_0x21e73b[_0x87a1('0x41')]);return db[_0x87a1('0x42')]['find'](_0x2eb8d9)[_0x87a1('0x27')](handleEntityNotFound(_0x34de58,null))['then'](respondWithResult(_0x34de58,null))[_0x87a1('0x45')](handleError(_0x34de58,null));};exports[_0x87a1('0x4a')]=function(_0x36f2e9,_0x84f3ef){return db[_0x87a1('0x42')][_0x87a1('0x4a')](_0x36f2e9[_0x87a1('0x4b')],{})[_0x87a1('0x27')](respondWithResult(_0x84f3ef,0xc9))[_0x87a1('0x45')](handleError(_0x84f3ef,null));};exports[_0x87a1('0x4c')]=function(_0x55bb5f,_0x5c6dbd){if(_0x55bb5f[_0x87a1('0x4b')]['id']){delete _0x55bb5f['body']['id'];}return db[_0x87a1('0x42')][_0x87a1('0x4d')]({'where':{'id':_0x55bb5f['params']['id']}})['then'](handleEntityNotFound(_0x5c6dbd,null))[_0x87a1('0x27')](saveUpdates(_0x55bb5f[_0x87a1('0x4b')],null))[_0x87a1('0x27')](respondWithResult(_0x5c6dbd,null))[_0x87a1('0x45')](handleError(_0x5c6dbd,null));};exports[_0x87a1('0x28')]=function(_0x931dd7,_0x588241){return db[_0x87a1('0x42')][_0x87a1('0x4d')]({'where':{'id':_0x931dd7[_0x87a1('0x47')]['id']}})[_0x87a1('0x27')](handleEntityNotFound(_0x588241,null))[_0x87a1('0x27')](removeEntity(_0x588241,null))[_0x87a1('0x45')](handleError(_0x588241,null));}; \ No newline at end of file +var _0x17df=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SugarcrmField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17df,0xcf));var _0xf17d=function(_0x1e039b,_0x3caad6){_0x1e039b=_0x1e039b-0x0;var _0x11eb41=_0x17df[_0x1e039b];return _0x11eb41;};'use strict';var emlformat=require(_0xf17d('0x0'));var rimraf=require(_0xf17d('0x1'));var zipdir=require(_0xf17d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf17d('0x3'));var moment=require(_0xf17d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf17d('0x5'));var util=require(_0xf17d('0x6'));var path=require('path');var sox=require(_0xf17d('0x7'));var csv=require(_0xf17d('0x8'));var ejs=require(_0xf17d('0x9'));var fs=require('fs');var fs_extra=require(_0xf17d('0xa'));var _=require(_0xf17d('0xb'));var squel=require(_0xf17d('0xc'));var crypto=require(_0xf17d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf17d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf17d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf17d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf17d('0x10'));var logger=require(_0xf17d('0x11'))(_0xf17d('0x12'));var utils=require(_0xf17d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf17d('0x14'));var db=require(_0xf17d('0x15'))['db'];function respondWithStatusCode(_0x304191,_0x1957a2){_0x1957a2=_0x1957a2||0xcc;return function(_0x83a147){if(_0x83a147){return _0x304191[_0xf17d('0x16')](_0x1957a2);}return _0x304191[_0xf17d('0x17')](_0x1957a2)[_0xf17d('0x18')]();};}function respondWithResult(_0x1940f2,_0x1de846){_0x1de846=_0x1de846||0xc8;return function(_0x5a0639){if(_0x5a0639){return _0x1940f2['status'](_0x1de846)[_0xf17d('0x19')](_0x5a0639);}};}function respondWithFilteredResult(_0x515f87,_0x4404c5){return function(_0xfb8190){if(_0xfb8190){var _0x453a7f=typeof _0x4404c5[_0xf17d('0x1a')]==='undefined'&&typeof _0x4404c5[_0xf17d('0x1b')]===_0xf17d('0x1c');var _0x2ed0e9=_0xfb8190[_0xf17d('0x1d')];var _0xd19a84=_0x453a7f?0x0:_0x4404c5[_0xf17d('0x1a')];var _0x13886b=_0x453a7f?_0xfb8190['count']:_0x4404c5[_0xf17d('0x1a')]+_0x4404c5['limit'];var _0x29ce35;if(_0x13886b>=_0x2ed0e9){_0x13886b=_0x2ed0e9;_0x29ce35=0xc8;}else{_0x29ce35=0xce;}_0x515f87[_0xf17d('0x17')](_0x29ce35);return _0x515f87[_0xf17d('0x1e')](_0xf17d('0x1f'),_0xd19a84+'-'+_0x13886b+'/'+_0x2ed0e9)[_0xf17d('0x19')](_0xfb8190);}return null;};}function patchUpdates(_0x10d506){return function(_0x43fd69){try{jsonpatch[_0xf17d('0x20')](_0x43fd69,_0x10d506,!![]);}catch(_0x32085c){return BPromise[_0xf17d('0x21')](_0x32085c);}return _0x43fd69[_0xf17d('0x22')]();};}function saveUpdates(_0x417722,_0xd78bf6){return function(_0x561059){if(_0x561059){return _0x561059[_0xf17d('0x23')](_0x417722)[_0xf17d('0x24')](function(_0x17dc07){return _0x17dc07;});}return null;};}function removeEntity(_0x2d83ef,_0x91670c){return function(_0x3340b6){if(_0x3340b6){return _0x3340b6['destroy']()[_0xf17d('0x24')](function(){_0x2d83ef[_0xf17d('0x17')](0xcc)[_0xf17d('0x18')]();});}};}function handleEntityNotFound(_0x3797df,_0x44dd96){return function(_0x252be7){if(!_0x252be7){_0x3797df['sendStatus'](0x194);}return _0x252be7;};}function handleError(_0x2710da,_0x5db0b8){_0x5db0b8=_0x5db0b8||0x1f4;return function(_0x5953cf){logger['error'](_0x5953cf[_0xf17d('0x25')]);if(_0x5953cf[_0xf17d('0x26')]){delete _0x5953cf[_0xf17d('0x26')];}_0x2710da[_0xf17d('0x17')](_0x5db0b8)[_0xf17d('0x27')](_0x5953cf);};}exports[_0xf17d('0x28')]=function(_0x4ddf44,_0x8ce23d){var _0x14aae0={},_0x444eb9={},_0x3b99b4={'count':0x0,'rows':[]};var _0x1c83e0=_[_0xf17d('0x29')](db[_0xf17d('0x2a')]['rawAttributes'],function(_0x597982){return{'name':_0x597982[_0xf17d('0x2b')],'type':_0x597982[_0xf17d('0x2c')][_0xf17d('0x2d')]};});_0x444eb9['model']=_[_0xf17d('0x29')](_0x1c83e0,_0xf17d('0x26'));_0x444eb9['query']=_['keys'](_0x4ddf44[_0xf17d('0x2e')]);_0x444eb9[_0xf17d('0x2f')]=_[_0xf17d('0x30')](_0x444eb9[_0xf17d('0x31')],_0x444eb9[_0xf17d('0x2e')]);_0x14aae0[_0xf17d('0x32')]=_[_0xf17d('0x30')](_0x444eb9[_0xf17d('0x31')],qs[_0xf17d('0x33')](_0x4ddf44['query'][_0xf17d('0x33')]));_0x14aae0[_0xf17d('0x32')]=_0x14aae0['attributes'][_0xf17d('0x34')]?_0x14aae0[_0xf17d('0x32')]:_0x444eb9[_0xf17d('0x31')];if(!_0x4ddf44['query'][_0xf17d('0x35')](_0xf17d('0x36'))){_0x14aae0[_0xf17d('0x1b')]=qs['limit'](_0x4ddf44[_0xf17d('0x2e')][_0xf17d('0x1b')]);_0x14aae0[_0xf17d('0x1a')]=qs[_0xf17d('0x1a')](_0x4ddf44['query'][_0xf17d('0x1a')]);}_0x14aae0[_0xf17d('0x37')]=qs[_0xf17d('0x38')](_0x4ddf44[_0xf17d('0x2e')][_0xf17d('0x38')]);_0x14aae0[_0xf17d('0x39')]=qs[_0xf17d('0x2f')](_[_0xf17d('0x3a')](_0x4ddf44[_0xf17d('0x2e')],_0x444eb9[_0xf17d('0x2f')]),_0x1c83e0);if(_0x4ddf44[_0xf17d('0x2e')][_0xf17d('0x3b')]){_0x14aae0['where']=_[_0xf17d('0x3c')](_0x14aae0['where'],{'$or':_['map'](_0x1c83e0,function(_0x249709){if(_0x249709[_0xf17d('0x2c')]!==_0xf17d('0x3d')){var _0x13a43a={};_0x13a43a[_0x249709[_0xf17d('0x26')]]={'$like':'%'+_0x4ddf44[_0xf17d('0x2e')][_0xf17d('0x3b')]+'%'};return _0x13a43a;}})});}_0x14aae0=_[_0xf17d('0x3c')]({},_0x14aae0,_0x4ddf44['options']);var _0x49ae46={'where':_0x14aae0[_0xf17d('0x39')]};return db[_0xf17d('0x2a')][_0xf17d('0x1d')](_0x49ae46)[_0xf17d('0x24')](function(_0x5ac7ef){_0x3b99b4[_0xf17d('0x1d')]=_0x5ac7ef;if(_0x4ddf44[_0xf17d('0x2e')][_0xf17d('0x3e')]){_0x14aae0[_0xf17d('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0xf17d('0x40')](_0x14aae0);})[_0xf17d('0x24')](function(_0x191cdf){_0x3b99b4[_0xf17d('0x41')]=_0x191cdf;return _0x3b99b4;})[_0xf17d('0x24')](respondWithFilteredResult(_0x8ce23d,_0x14aae0))[_0xf17d('0x42')](handleError(_0x8ce23d,null));};exports[_0xf17d('0x43')]=function(_0x4e3346,_0x27e50c){var _0x4fa02f={'raw':!![],'where':{'id':_0x4e3346[_0xf17d('0x44')]['id']}},_0x5c201b={};_0x5c201b['model']=_['keys'](db[_0xf17d('0x2a')]['rawAttributes']);_0x5c201b[_0xf17d('0x2e')]=_[_0xf17d('0x45')](_0x4e3346[_0xf17d('0x2e')]);_0x5c201b[_0xf17d('0x2f')]=_[_0xf17d('0x30')](_0x5c201b[_0xf17d('0x31')],_0x5c201b[_0xf17d('0x2e')]);_0x4fa02f[_0xf17d('0x32')]=_[_0xf17d('0x30')](_0x5c201b[_0xf17d('0x31')],qs['fields'](_0x4e3346[_0xf17d('0x2e')]['fields']));_0x4fa02f[_0xf17d('0x32')]=_0x4fa02f[_0xf17d('0x32')][_0xf17d('0x34')]?_0x4fa02f[_0xf17d('0x32')]:_0x5c201b[_0xf17d('0x31')];if(_0x4e3346[_0xf17d('0x2e')]['includeAll']){_0x4fa02f[_0xf17d('0x3f')]=[{'all':!![]}];}_0x4fa02f=_[_0xf17d('0x3c')]({},_0x4fa02f,_0x4e3346[_0xf17d('0x46')]);return db[_0xf17d('0x2a')][_0xf17d('0x47')](_0x4fa02f)[_0xf17d('0x24')](handleEntityNotFound(_0x27e50c,null))[_0xf17d('0x24')](respondWithResult(_0x27e50c,null))[_0xf17d('0x42')](handleError(_0x27e50c,null));};exports[_0xf17d('0x48')]=function(_0x594c99,_0x44ca62){return db[_0xf17d('0x2a')][_0xf17d('0x48')](_0x594c99['body'],{})[_0xf17d('0x24')](respondWithResult(_0x44ca62,0xc9))[_0xf17d('0x42')](handleError(_0x44ca62,null));};exports[_0xf17d('0x23')]=function(_0x2f39b8,_0x49e987){if(_0x2f39b8[_0xf17d('0x49')]['id']){delete _0x2f39b8[_0xf17d('0x49')]['id'];}return db[_0xf17d('0x2a')][_0xf17d('0x47')]({'where':{'id':_0x2f39b8[_0xf17d('0x44')]['id']}})[_0xf17d('0x24')](handleEntityNotFound(_0x49e987,null))[_0xf17d('0x24')](saveUpdates(_0x2f39b8[_0xf17d('0x49')],null))[_0xf17d('0x24')](respondWithResult(_0x49e987,null))[_0xf17d('0x42')](handleError(_0x49e987,null));};exports['destroy']=function(_0x5c6644,_0x3bbb5b){return db['SugarcrmField'][_0xf17d('0x47')]({'where':{'id':_0x5c6644[_0xf17d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bbb5b,null))['then'](removeEntity(_0x3bbb5b,null))['catch'](handleError(_0x3bbb5b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c589404..6e4ddd9 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 _0xaba2=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x28001b,_0xbbcc0c){var _0x549e94=function(_0x2aaaa3){while(--_0x2aaaa3){_0x28001b['push'](_0x28001b['shift']());}};_0x549e94(++_0xbbcc0c);}(_0xaba2,0x171));var _0x2aba=function(_0x51e928,_0x5b207b){_0x51e928=_0x51e928-0x0;var _0x59615d=_0xaba2[_0x51e928];return _0x59615d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2aba('0x0'))(_0x2aba('0x1'));var moment=require(_0x2aba('0x2'));var BPromise=require('bluebird');var rp=require(_0x2aba('0x3'));var fs=require('fs');var path=require(_0x2aba('0x4'));var rimraf=require(_0x2aba('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x2aba('0x6')]=function(_0x336cd8,_0x45d372){return _0x336cd8[_0x2aba('0x7')](_0x2aba('0x8'),attributes,{'tableName':_0x2aba('0x9'),'paranoid':![],'indexes':[{'name':_0x2aba('0xa'),'fields':[_0x2aba('0xb'),_0x2aba('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2596=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index'];(function(_0x227212,_0x2ea1f8){var _0x498e83=function(_0xbb119b){while(--_0xbb119b){_0x227212['push'](_0x227212['shift']());}};_0x498e83(++_0x2ea1f8);}(_0x2596,0x82));var _0x6259=function(_0xd4aa2c,_0x7a3d56){_0xd4aa2c=_0xd4aa2c-0x0;var _0x52a8ac=_0x2596[_0xd4aa2c];return _0x52a8ac;};'use strict';var _=require(_0x6259('0x0'));var util=require(_0x6259('0x1'));var logger=require(_0x6259('0x2'))(_0x6259('0x3'));var moment=require(_0x6259('0x4'));var BPromise=require(_0x6259('0x5'));var rp=require(_0x6259('0x6'));var fs=require('fs');var path=require(_0x6259('0x7'));var rimraf=require(_0x6259('0x8'));var config=require(_0x6259('0x9'));var attributes=require(_0x6259('0xa'));module[_0x6259('0xb')]=function(_0xc6d01b,_0x593849){return _0xc6d01b[_0x6259('0xc')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6259('0xd'),'fields':[_0x6259('0xe'),_0x6259('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 854675f..dd5587f 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 _0x787f=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x417441,_0x1e64d1){var _0x431950=function(_0x1e0261){while(--_0x1e0261){_0x417441['push'](_0x417441['shift']());}};_0x431950(++_0x1e64d1);}(_0x787f,0x1d4));var _0xf787=function(_0x4291d3,_0x760d53){_0x4291d3=_0x4291d3-0x0;var _0x507bd7=_0x787f[_0x4291d3];return _0x507bd7;};'use strict';var _=require(_0xf787('0x0'));var util=require(_0xf787('0x1'));var moment=require(_0xf787('0x2'));var BPromise=require(_0xf787('0x3'));var rs=require(_0xf787('0x4'));var fs=require('fs');var Redis=require(_0xf787('0x5'));var db=require(_0xf787('0x6'))['db'];var utils=require(_0xf787('0x7'));var logger=require(_0xf787('0x8'))(_0xf787('0x9'));var config=require('../../config/environment');var jayson=require(_0xf787('0xa'));var client=jayson[_0xf787('0xb')][_0xf787('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5494fd,_0x289b6c,_0x3677d8){return new BPromise(function(_0x3b0985,_0x345919){return client[_0xf787('0xd')](_0x5494fd,_0x3677d8)[_0xf787('0xe')](function(_0x2470d1){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x289b6c,'request\x20sent');logger[_0xf787('0xf')](_0xf787('0x10'),_0x289b6c,'request\x20sent',JSON['stringify'](_0x2470d1));if(_0x2470d1[_0xf787('0x11')]){if(_0x2470d1['error']['code']===0x1f4){logger['error'](_0xf787('0x12'),_0x289b6c,_0x2470d1[_0xf787('0x11')][_0xf787('0x13')]);return _0x345919(_0x2470d1[_0xf787('0x11')][_0xf787('0x13')]);}logger['error'](_0xf787('0x12'),_0x289b6c,_0x2470d1[_0xf787('0x11')]['message']);return _0x3b0985(_0x2470d1[_0xf787('0x11')]['message']);}else{logger['info'](_0xf787('0x12'),_0x289b6c,_0xf787('0x14'));_0x3b0985(_0x2470d1[_0xf787('0x15')][_0xf787('0x13')]);}})[_0xf787('0x16')](function(_0x585026){logger[_0xf787('0x11')](_0xf787('0x12'),_0x289b6c,_0x585026);_0x345919(_0x585026);});});} \ No newline at end of file +var _0x1c7f=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0x1c7f,0x1ec));var _0xf1c7=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x1c7f[_0x34021d];return _0x16597b;};'use strict';var _=require(_0xf1c7('0x0'));var util=require(_0xf1c7('0x1'));var moment=require(_0xf1c7('0x2'));var BPromise=require(_0xf1c7('0x3'));var rs=require(_0xf1c7('0x4'));var fs=require('fs');var Redis=require(_0xf1c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf1c7('0x6'));var logger=require(_0xf1c7('0x7'))('rpc');var config=require(_0xf1c7('0x8'));var jayson=require(_0xf1c7('0x9'));var client=jayson['client'][_0xf1c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29ec61,_0x40e591,_0x5040bf){return new BPromise(function(_0x514ca4,_0xa64ff){return client['request'](_0x29ec61,_0x5040bf)[_0xf1c7('0xb')](function(_0x10c32e){logger[_0xf1c7('0xc')](_0xf1c7('0xd'),_0x40e591,_0xf1c7('0xe'));logger[_0xf1c7('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x40e591,'request\x20sent',JSON['stringify'](_0x10c32e));if(_0x10c32e[_0xf1c7('0x10')]){if(_0x10c32e['error'][_0xf1c7('0x11')]===0x1f4){logger[_0xf1c7('0x10')](_0xf1c7('0xd'),_0x40e591,_0x10c32e[_0xf1c7('0x10')][_0xf1c7('0x12')]);return _0xa64ff(_0x10c32e[_0xf1c7('0x10')][_0xf1c7('0x12')]);}logger[_0xf1c7('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x40e591,_0x10c32e[_0xf1c7('0x10')]['message']);return _0x514ca4(_0x10c32e[_0xf1c7('0x10')][_0xf1c7('0x12')]);}else{logger[_0xf1c7('0xc')](_0xf1c7('0xd'),_0x40e591,_0xf1c7('0xe'));_0x514ca4(_0x10c32e[_0xf1c7('0x13')][_0xf1c7('0x12')]);}})[_0xf1c7('0x14')](function(_0x902f2b){logger[_0xf1c7('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x40e591,_0x902f2b);_0xa64ff(_0x902f2b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 43fc55a..9e35fb5 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 _0xeec3=['show','get','/:id/configurations','getConfigurations','post','create','update','delete','destroy','multer','util','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','/:id'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xeec3,0x1c3));var _0x3eec=function(_0x59c445,_0x415677){_0x59c445=_0x59c445-0x0;var _0x34076b=_0xeec3[_0x59c445];return _0x34076b;};'use strict';var multer=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3eec('0x2'));var interaction=require(_0x3eec('0x3'));var config=require('../../config/environment');var controller=require(_0x3eec('0x4'));router['get']('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0x6')]);router['get'](_0x3eec('0x7'),auth[_0x3eec('0x5')](),controller[_0x3eec('0x8')]);router[_0x3eec('0x9')](_0x3eec('0xa'),auth[_0x3eec('0x5')](),controller[_0x3eec('0xb')]);router[_0x3eec('0x9')]('/:id/fields',auth[_0x3eec('0x5')](),controller['getFields']);router[_0x3eec('0xc')]('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0xd')]);router[_0x3eec('0xc')]('/:id/configurations',auth[_0x3eec('0x5')](),controller['addConfiguration']);router['put']('/:id',auth[_0x3eec('0x5')](),controller[_0x3eec('0xe')]);router[_0x3eec('0xf')](_0x3eec('0x7'),auth['isAuthenticated'](),controller[_0x3eec('0x10')]);module['exports']=router; \ No newline at end of file +var _0xaced=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','delete','destroy','exports'];(function(_0x135cd4,_0x73d928){var _0x31c5d5=function(_0xc45385){while(--_0xc45385){_0x135cd4['push'](_0x135cd4['shift']());}};_0x31c5d5(++_0x73d928);}(_0xaced,0x18c));var _0xdace=function(_0x101b10,_0x5d48e3){_0x101b10=_0x101b10-0x0;var _0x187002=_0xaced[_0x101b10];return _0x187002;};'use strict';var multer=require(_0xdace('0x0'));var util=require(_0xdace('0x1'));var path=require(_0xdace('0x2'));var timeout=require(_0xdace('0x3'));var express=require(_0xdace('0x4'));var router=express['Router']();var fs_extra=require(_0xdace('0x5'));var auth=require(_0xdace('0x6'));var interaction=require(_0xdace('0x7'));var config=require(_0xdace('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xdace('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdace('0x9')](_0xdace('0xa'),auth[_0xdace('0xb')](),controller[_0xdace('0xc')]);router['get']('/:id/configurations',auth[_0xdace('0xb')](),controller[_0xdace('0xd')]);router[_0xdace('0x9')](_0xdace('0xe'),auth['isAuthenticated'](),controller[_0xdace('0xf')]);router[_0xdace('0x10')]('/',auth[_0xdace('0xb')](),controller[_0xdace('0x11')]);router['post'](_0xdace('0x12'),auth[_0xdace('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0xdace('0xb')](),controller['update']);router[_0xdace('0x13')](_0xdace('0xa'),auth[_0xdace('0xb')](),controller[_0xdace('0x14')]);module[_0xdace('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cf4b578..d1b81e3 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 _0x2c19=['HelpDesk','exports','STRING'];(function(_0x463309,_0x4e98a3){var _0x9d0ef9=function(_0x106616){while(--_0x106616){_0x463309['push'](_0x463309['shift']());}};_0x9d0ef9(++_0x4e98a3);}(_0x2c19,0x15a));var _0x92c1=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x2c19[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x92c1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x92c1('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x92c1('0x1')],'allowNull':![],'defaultValue':_0x92c1('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x92c1('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4fd5=['STRING','exports'];(function(_0x3fb892,_0x517b9c){var _0x58bc2a=function(_0x39bfb1){while(--_0x39bfb1){_0x3fb892['push'](_0x3fb892['shift']());}};_0x58bc2a(++_0x517b9c);}(_0x4fd5,0xab));var _0x54fd=function(_0x480321,_0x29fbed){_0x480321=_0x480321-0x0;var _0x3a8049=_0x4fd5[_0x480321];return _0x3a8049;};'use strict';var Sequelize=require('sequelize');module[_0x54fd('0x0')]={'name':{'type':Sequelize[_0x54fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x54fd('0x1')]},'username':{'type':Sequelize[_0x54fd('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x54fd('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x54fd('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x54fd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f0e32f6..f5c5883 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 _0xcb0e=['destroy','VtigerConfiguration','pick','getConfigurations','hasOwnProperty','findOne','Subjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','end','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body'];(function(_0x2c068d,_0x48a631){var _0x156553=function(_0x32dfa0){while(--_0x32dfa0){_0x2c068d['push'](_0x2c068d['shift']());}};_0x156553(++_0x48a631);}(_0xcb0e,0x18e));var _0xecb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb0e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xecb0('0x0'));var rimraf=require(_0xecb0('0x1'));var zipdir=require(_0xecb0('0x2'));var jsonpatch=require(_0xecb0('0x3'));var rp=require(_0xecb0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecb0('0x5'));var util=require(_0xecb0('0x6'));var path=require('path');var sox=require(_0xecb0('0x7'));var csv=require(_0xecb0('0x8'));var ejs=require(_0xecb0('0x9'));var fs=require('fs');var fs_extra=require(_0xecb0('0xa'));var _=require(_0xecb0('0xb'));var squel=require(_0xecb0('0xc'));var crypto=require(_0xecb0('0xd'));var jsforce=require(_0xecb0('0xe'));var deskjs=require(_0xecb0('0xf'));var toCsv=require(_0xecb0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xecb0('0x10'));var authService=require(_0xecb0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xecb0('0x12'))(_0xecb0('0x13'));var utils=require(_0xecb0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xecb0('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xecb0('0x16'));function respondWithStatusCode(_0xadccd3,_0x2e2c65){_0x2e2c65=_0x2e2c65||0xcc;return function(_0x16e7d2){if(_0x16e7d2){return _0xadccd3['sendStatus'](_0x2e2c65);}return _0xadccd3[_0xecb0('0x17')](_0x2e2c65)['end']();};}function respondWithResult(_0xac554a,_0x418769){_0x418769=_0x418769||0xc8;return function(_0x301c6e){if(_0x301c6e){return _0xac554a[_0xecb0('0x17')](_0x418769)[_0xecb0('0x18')](_0x301c6e);}};}function respondWithFilteredResult(_0x5d040e,_0x239788){return function(_0x46280f){if(_0x46280f){var _0x3f3a15=typeof _0x239788[_0xecb0('0x19')]===_0xecb0('0x1a')&&typeof _0x239788['limit']===_0xecb0('0x1a');var _0x376f02=_0x46280f[_0xecb0('0x1b')];var _0x3d69fb=_0x3f3a15?0x0:_0x239788[_0xecb0('0x19')];var _0x426211=_0x3f3a15?_0x46280f[_0xecb0('0x1b')]:_0x239788['offset']+_0x239788[_0xecb0('0x1c')];var _0x17e567;if(_0x426211>=_0x376f02){_0x426211=_0x376f02;_0x17e567=0xc8;}else{_0x17e567=0xce;}_0x5d040e[_0xecb0('0x17')](_0x17e567);return _0x5d040e[_0xecb0('0x1d')](_0xecb0('0x1e'),_0x3d69fb+'-'+_0x426211+'/'+_0x376f02)[_0xecb0('0x18')](_0x46280f);}return null;};}function patchUpdates(_0x30e987){return function(_0x425151){try{jsonpatch[_0xecb0('0x1f')](_0x425151,_0x30e987,!![]);}catch(_0x397971){return BPromise['reject'](_0x397971);}return _0x425151[_0xecb0('0x20')]();};}function saveUpdates(_0x47b0bb,_0x5ca150){return function(_0x4defdc){if(_0x4defdc){return _0x4defdc[_0xecb0('0x21')](_0x47b0bb)[_0xecb0('0x22')](function(_0x32a936){return _0x32a936;});}return null;};}function removeEntity(_0xe9d477,_0x1351f1){return function(_0x49efb8){if(_0x49efb8){return _0x49efb8['destroy']()[_0xecb0('0x22')](function(){_0xe9d477[_0xecb0('0x17')](0xcc)[_0xecb0('0x23')]();});}};}function handleEntityNotFound(_0x20b27a,_0x682bff){return function(_0x42b850){if(!_0x42b850){_0x20b27a['sendStatus'](0x194);}return _0x42b850;};}function handleError(_0x4cced6,_0x539ce8){_0x539ce8=_0x539ce8||0x1f4;return function(_0x3e31c8){logger['error'](_0x3e31c8['stack']);if(_0x3e31c8[_0xecb0('0x24')]){delete _0x3e31c8[_0xecb0('0x24')];}_0x4cced6[_0xecb0('0x17')](_0x539ce8)[_0xecb0('0x25')](_0x3e31c8);};}exports[_0xecb0('0x26')]=function(_0x28c064,_0x435860){var _0x5409f6={},_0x446f1a={},_0x2b3a6d={'count':0x0,'rows':[]};var _0x19c5b7=_[_0xecb0('0x27')](db[_0xecb0('0x28')][_0xecb0('0x29')],function(_0x1ed2f7){return{'name':_0x1ed2f7['fieldName'],'type':_0x1ed2f7[_0xecb0('0x2a')][_0xecb0('0x2b')]};});_0x446f1a[_0xecb0('0x2c')]=_[_0xecb0('0x27')](_0x19c5b7,_0xecb0('0x24'));_0x446f1a['query']=_[_0xecb0('0x2d')](_0x28c064['query']);_0x446f1a[_0xecb0('0x2e')]=_[_0xecb0('0x2f')](_0x446f1a[_0xecb0('0x2c')],_0x446f1a[_0xecb0('0x30')]);_0x5409f6[_0xecb0('0x31')]=_[_0xecb0('0x2f')](_0x446f1a['model'],qs[_0xecb0('0x32')](_0x28c064[_0xecb0('0x30')][_0xecb0('0x32')]));_0x5409f6[_0xecb0('0x31')]=_0x5409f6[_0xecb0('0x31')]['length']?_0x5409f6[_0xecb0('0x31')]:_0x446f1a['model'];if(!_0x28c064[_0xecb0('0x30')]['hasOwnProperty'](_0xecb0('0x33'))){_0x5409f6[_0xecb0('0x1c')]=qs['limit'](_0x28c064['query'][_0xecb0('0x1c')]);_0x5409f6[_0xecb0('0x19')]=qs[_0xecb0('0x19')](_0x28c064['query'][_0xecb0('0x19')]);}_0x5409f6[_0xecb0('0x34')]=qs['sort'](_0x28c064[_0xecb0('0x30')][_0xecb0('0x35')]);_0x5409f6['where']=qs[_0xecb0('0x2e')](_['pick'](_0x28c064[_0xecb0('0x30')],_0x446f1a[_0xecb0('0x2e')]),_0x19c5b7);if(_0x28c064[_0xecb0('0x30')][_0xecb0('0x36')]){_0x5409f6['where']=_[_0xecb0('0x37')](_0x5409f6[_0xecb0('0x38')],{'$or':_[_0xecb0('0x27')](_0x19c5b7,function(_0x2cdbd9){if(_0x2cdbd9[_0xecb0('0x2a')]!==_0xecb0('0x39')){var _0x2ac550={};_0x2ac550[_0x2cdbd9[_0xecb0('0x24')]]={'$like':'%'+_0x28c064[_0xecb0('0x30')][_0xecb0('0x36')]+'%'};return _0x2ac550;}})});}_0x5409f6=_[_0xecb0('0x37')]({},_0x5409f6,_0x28c064['options']);var _0x411da={'where':_0x5409f6[_0xecb0('0x38')]};return db[_0xecb0('0x28')][_0xecb0('0x1b')](_0x411da)[_0xecb0('0x22')](function(_0x4b4e86){_0x2b3a6d[_0xecb0('0x1b')]=_0x4b4e86;if(_0x28c064[_0xecb0('0x30')][_0xecb0('0x3a')]){_0x5409f6['include']=[{'all':!![]}];}return db[_0xecb0('0x28')][_0xecb0('0x3b')](_0x5409f6);})[_0xecb0('0x22')](function(_0x38b9f5){_0x2b3a6d[_0xecb0('0x3c')]=_0x38b9f5;return _0x2b3a6d;})[_0xecb0('0x22')](respondWithFilteredResult(_0x435860,_0x5409f6))[_0xecb0('0x3d')](handleError(_0x435860,null));};exports[_0xecb0('0x3e')]=function(_0x26c31b,_0x4bba91){var _0x5e9079={'raw':![],'where':{'id':_0x26c31b[_0xecb0('0x3f')]['id']}},_0x49a4ae={};_0x49a4ae['model']=_[_0xecb0('0x2d')](db[_0xecb0('0x28')]['rawAttributes']);_0x49a4ae[_0xecb0('0x30')]=_[_0xecb0('0x2d')](_0x26c31b[_0xecb0('0x30')]);_0x49a4ae[_0xecb0('0x2e')]=_[_0xecb0('0x2f')](_0x49a4ae[_0xecb0('0x2c')],_0x49a4ae[_0xecb0('0x30')]);_0x5e9079[_0xecb0('0x31')]=_['intersection'](_0x49a4ae[_0xecb0('0x2c')],qs[_0xecb0('0x32')](_0x26c31b[_0xecb0('0x30')][_0xecb0('0x32')]));_0x5e9079[_0xecb0('0x31')]=_0x5e9079[_0xecb0('0x31')][_0xecb0('0x40')]?_0x5e9079[_0xecb0('0x31')]:_0x49a4ae['model'];if(_0x26c31b[_0xecb0('0x30')][_0xecb0('0x3a')]){_0x5e9079[_0xecb0('0x41')]=[{'all':!![]}];}_0x5e9079=_[_0xecb0('0x37')]({},_0x5e9079,_0x26c31b[_0xecb0('0x42')]);return db[_0xecb0('0x28')][_0xecb0('0x43')](_0x5e9079)[_0xecb0('0x22')](handleEntityNotFound(_0x4bba91,null))[_0xecb0('0x22')](respondWithResult(_0x4bba91,null))[_0xecb0('0x3d')](handleError(_0x4bba91,null));};exports[_0xecb0('0x44')]=function(_0x18d15e,_0x2ae6c9){return db[_0xecb0('0x28')][_0xecb0('0x44')](_0x18d15e[_0xecb0('0x45')],{})['then'](respondWithResult(_0x2ae6c9,0xc9))[_0xecb0('0x3d')](handleError(_0x2ae6c9,null));};exports['update']=function(_0x1ef87a,_0x4aca1c){if(_0x1ef87a['body']['id']){delete _0x1ef87a[_0xecb0('0x45')]['id'];}return db[_0xecb0('0x28')]['find']({'where':{'id':_0x1ef87a[_0xecb0('0x3f')]['id']}})[_0xecb0('0x22')](handleEntityNotFound(_0x4aca1c,null))['then'](saveUpdates(_0x1ef87a[_0xecb0('0x45')],null))[_0xecb0('0x22')](respondWithResult(_0x4aca1c,null))[_0xecb0('0x3d')](handleError(_0x4aca1c,null));};exports[_0xecb0('0x46')]=function(_0x2b70b5,_0x327b00){return db[_0xecb0('0x28')][_0xecb0('0x43')]({'where':{'id':_0x2b70b5['params']['id']}})[_0xecb0('0x22')](handleEntityNotFound(_0x327b00,null))['then'](removeEntity(_0x327b00,null))[_0xecb0('0x3d')](handleError(_0x327b00,null));};exports['getConfigurations']=function(_0x39a431,_0x289788,_0x370486){var _0x10c983={};var _0xd68b52={};var _0xcb333;var _0x36cacd;return db[_0xecb0('0x28')]['findOne']({'where':{'id':_0x39a431['params']['id']}})[_0xecb0('0x22')](handleEntityNotFound(_0x289788,null))['then'](function(_0x2dd033){if(_0x2dd033){_0xcb333=_0x2dd033;_0xd68b52[_0xecb0('0x2c')]=_['keys'](db[_0xecb0('0x47')][_0xecb0('0x29')]);_0xd68b52['query']=_[_0xecb0('0x2d')](_0x39a431[_0xecb0('0x30')]);_0xd68b52[_0xecb0('0x2e')]=_[_0xecb0('0x2f')](_0xd68b52['model'],_0xd68b52[_0xecb0('0x30')]);_0x10c983[_0xecb0('0x31')]=_[_0xecb0('0x2f')](_0xd68b52[_0xecb0('0x2c')],qs[_0xecb0('0x32')](_0x39a431[_0xecb0('0x30')][_0xecb0('0x32')]));_0x10c983[_0xecb0('0x31')]=_0x10c983[_0xecb0('0x31')][_0xecb0('0x40')]?_0x10c983[_0xecb0('0x31')]:_0xd68b52['model'];_0x10c983[_0xecb0('0x34')]=qs['sort'](_0x39a431[_0xecb0('0x30')][_0xecb0('0x35')]);_0x10c983['where']=qs[_0xecb0('0x2e')](_[_0xecb0('0x48')](_0x39a431[_0xecb0('0x30')],_0xd68b52[_0xecb0('0x2e')]));if(_0x39a431[_0xecb0('0x30')]['filter']){_0x10c983[_0xecb0('0x38')]=_[_0xecb0('0x37')](_0x10c983[_0xecb0('0x38')],{'$or':_[_0xecb0('0x27')](_0x10c983['attributes'],function(_0x1b8185){var _0x4dbdfc={};_0x4dbdfc[_0x1b8185]={'$like':'%'+_0x39a431[_0xecb0('0x30')]['filter']+'%'};return _0x4dbdfc;})});}_0x10c983=_[_0xecb0('0x37')]({},_0x10c983,_0x39a431[_0xecb0('0x42')]);return _0xcb333[_0xecb0('0x49')](_0x10c983);}})['then'](function(_0x3a25b2){if(_0x3a25b2){_0x36cacd=_0x3a25b2[_0xecb0('0x40')];if(!_0x39a431[_0xecb0('0x30')][_0xecb0('0x4a')]('nolimit')){_0x10c983[_0xecb0('0x1c')]=qs[_0xecb0('0x1c')](_0x39a431['query'][_0xecb0('0x1c')]);_0x10c983[_0xecb0('0x19')]=qs[_0xecb0('0x19')](_0x39a431[_0xecb0('0x30')][_0xecb0('0x19')]);}return _0xcb333['getConfigurations'](_0x10c983);}})[_0xecb0('0x22')](function(_0x2baaca){if(_0x2baaca){return _0x2baaca?{'count':_0x36cacd,'rows':_0x2baaca}:null;}})[_0xecb0('0x22')](respondWithResult(_0x289788,null))[_0xecb0('0x3d')](handleError(_0x289788,null));};exports['addConfiguration']=function(_0x11bb28,_0x15e8cd,_0x188c84){if(_0x11bb28[_0xecb0('0x45')]['id']){delete _0x11bb28[_0xecb0('0x45')]['id'];}return db[_0xecb0('0x28')][_0xecb0('0x4b')]({'where':{'id':_0x11bb28[_0xecb0('0x3f')]['id']}})[_0xecb0('0x22')](handleEntityNotFound(_0x15e8cd,null))[_0xecb0('0x22')](function(_0xbb969c){if(_0xbb969c){_0x11bb28[_0xecb0('0x45')]['AccountId']=_0xbb969c['id'];_0x11bb28[_0xecb0('0x45')][_0xecb0('0x4c')]=integrations['getSubjects'](_0x11bb28['body']['channel'],_0x11bb28[_0xecb0('0x45')]['type']);_0x11bb28[_0xecb0('0x45')][_0xecb0('0x4d')]=integrations[_0xecb0('0x4e')](_0x11bb28[_0xecb0('0x45')]['channel'],_0x11bb28[_0xecb0('0x45')][_0xecb0('0x2a')]);return db['VtigerConfiguration'][_0xecb0('0x44')](_0x11bb28['body'],{'include':[{'model':db[_0xecb0('0x4f')],'as':_0xecb0('0x4c')},{'model':db[_0xecb0('0x4f')],'as':_0xecb0('0x4d')}]});}return null;})[_0xecb0('0x22')](respondWithResult(_0x15e8cd,null))[_0xecb0('0x3d')](handleError(_0x15e8cd,null));};var md5=require(_0xecb0('0x50'));exports[_0xecb0('0x51')]=function(_0xeee333,_0xe78128,_0x1f1464){var _0x647d3d=null;var _0x1c0c0b=null;var _0x418007=null;var _0x4b91cf=null;var _0x27ff89='';return db[_0xecb0('0x28')][_0xecb0('0x4b')]({'where':{'id':_0xeee333[_0xecb0('0x3f')]['id']},'attributes':['id','name',_0xecb0('0x52'),_0xecb0('0x53'),'moduleName',_0xecb0('0x54'),_0xecb0('0x55'),_0xecb0('0x56')]})[_0xecb0('0x22')](handleEntityNotFound(_0xe78128,null))[_0xecb0('0x22')](function(_0x56bd04){if(_0x56bd04){_0x647d3d=_0x56bd04['username'];_0x1c0c0b=_0x56bd04[_0xecb0('0x56')];_0x418007=_0x56bd04[_0xecb0('0x57')];_0x27ff89=_0x56bd04[_0xecb0('0x54')];var _0x5bbaa1=_0x27ff89[_0xecb0('0x58')](-0x1);if(_0x5bbaa1==='/'){_0x27ff89=_0x27ff89[_0xecb0('0x59')](0x0,_0x27ff89[_0xecb0('0x5a')](_0x5bbaa1));}_0x4b91cf=util[_0xecb0('0x5b')]('%s/webservice.php',_0x27ff89);var _0x2ed00d={'method':_0xecb0('0x5c'),'uri':_0x4b91cf,'qs':{'operation':_0xecb0('0x5d'),'username':_0x56bd04[_0xecb0('0x52')]},'json':!![]};return rp(_0x2ed00d);}})[_0xecb0('0x22')](function(_0x290363){if(_0x290363[_0xecb0('0x5e')]){var _0x5974b4={'method':'POST','uri':_0x4b91cf,'form':{'operation':_0xecb0('0x5f'),'username':_0x647d3d,'accessKey':md5(_0x290363[_0xecb0('0x60')][_0xecb0('0x61')]+_0x1c0c0b)},'json':!![]};return rp(_0x5974b4);}})[_0xecb0('0x22')](function(_0x5cc6b6){if(_0x5cc6b6[_0xecb0('0x5e')]){var _0x4ba5ed={'method':_0xecb0('0x5c'),'uri':_0x4b91cf,'qs':{'operation':_0xecb0('0x62'),'username':_0x647d3d,'sessionName':_0x5cc6b6['result'][_0xecb0('0x63')],'elementType':_0x418007},'json':!![]};return rp(_0x4ba5ed);}})[_0xecb0('0x22')](function(_0x545d26){if(_0x545d26[_0xecb0('0x5e')]){var _0x2893c1=[_0xecb0('0x64'),_0xecb0('0x65'),_0xecb0('0x66')];_[_0xecb0('0x67')](_0x545d26[_0xecb0('0x60')][_0xecb0('0x32')],function(_0x4297a6){return _0x2893c1[_0xecb0('0x68')](_0x4297a6[_0xecb0('0x2a')][_0xecb0('0x24')]);});_[_0xecb0('0x67')](_0x545d26[_0xecb0('0x60')]['fields'],function(_0x26f97f){return _0x26f97f[_0xecb0('0x69')]==='false';});return{'count':_0x545d26[_0xecb0('0x60')][_0xecb0('0x32')]['length'],'rows':_[_0xecb0('0x27')](_0x545d26[_0xecb0('0x60')][_0xecb0('0x32')],function(_0x24fa08){return{'id':_0x24fa08['name'],'name':_0x24fa08[_0xecb0('0x6a')],'custom':_['startsWith'](_0x24fa08['name'],'cf_')?!![]:![],'options':_0x24fa08[_0xecb0('0x2a')]['name']===_0xecb0('0x6b')&&_0x24fa08[_0xecb0('0x2a')][_0xecb0('0x6c')]['length']>0x0?_[_0xecb0('0x27')](_0x24fa08[_0xecb0('0x2a')][_0xecb0('0x6c')],function(_0x12830b){return{'name':_0x12830b[_0xecb0('0x6a')],'value':_0x12830b[_0xecb0('0x6d')]};}):[]};})};}})[_0xecb0('0x22')](respondWithResult(_0xe78128,null))[_0xecb0('0x3d')](function(_0x230965){console[_0xecb0('0x6e')](_0xecb0('0x6f')+_0x230965);var _0x64b218=_0xeee333[_0xecb0('0x30')][_0xecb0('0x70')]?0x1f4:_0x230965[_0xecb0('0x71')]||0x1f4;logger[_0xecb0('0x72')](_0xecb0('0x73'),_0xecb0('0x51'),_0x64b218,JSON['stringify'](_0x230965));delete _0x230965[_0xecb0('0x24')];if(_0x64b218===0x191){_0x64b218=0x190;}_0xe78128[_0xecb0('0x17')](_0x64b218)[_0xecb0('0x25')](_0xeee333[_0xecb0('0x30')][_0xecb0('0x70')]?{'message':_0xecb0('0x74'),'statusCode':_0x230965[_0xecb0('0x71')]}:_0x230965);});}; \ No newline at end of file +var _0x2124=['undefined','count','set','Content-Range','apply','then','destroy','end','stack','send','index','map','VtigerAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','update','params','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','format','%s/webservice.php','GET','success','result','sessionName','autogenerated','reference','remove','includes','editable','false','startsWith','picklist','picklistValues','label','value','log','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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/environment','../../config/license/util','sendStatus','status','json','offset','limit'];(function(_0x5fdcee,_0x43769b){var _0x2df3b5=function(_0x4467d6){while(--_0x4467d6){_0x5fdcee['push'](_0x5fdcee['shift']());}};_0x2df3b5(++_0x43769b);}(_0x2124,0xce));var _0x4212=function(_0x3e4b17,_0x4024cb){_0x3e4b17=_0x3e4b17-0x0;var _0xc86483=_0x2124[_0x3e4b17];return _0xc86483;};'use strict';var emlformat=require(_0x4212('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4212('0x1'));var jsonpatch=require(_0x4212('0x2'));var rp=require(_0x4212('0x3'));var moment=require(_0x4212('0x4'));var BPromise=require(_0x4212('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4212('0x6'));var sox=require(_0x4212('0x7'));var csv=require(_0x4212('0x8'));var ejs=require(_0x4212('0x9'));var fs=require('fs');var fs_extra=require(_0x4212('0xa'));var _=require('lodash');var squel=require(_0x4212('0xb'));var crypto=require(_0x4212('0xc'));var jsforce=require(_0x4212('0xd'));var deskjs=require(_0x4212('0xe'));var toCsv=require(_0x4212('0x8'));var querystring=require(_0x4212('0xf'));var Papa=require(_0x4212('0x10'));var Redis=require(_0x4212('0x11'));var authService=require(_0x4212('0x12'));var qs=require(_0x4212('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4212('0x14'));var logger=require(_0x4212('0x15'))(_0x4212('0x16'));var utils=require('../../config/utils');var config=require(_0x4212('0x17'));var licenseUtil=require(_0x4212('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xced74c,_0x4a67a1){_0x4a67a1=_0x4a67a1||0xcc;return function(_0x58dbff){if(_0x58dbff){return _0xced74c[_0x4212('0x19')](_0x4a67a1);}return _0xced74c[_0x4212('0x1a')](_0x4a67a1)['end']();};}function respondWithResult(_0x3de04e,_0x187ae6){_0x187ae6=_0x187ae6||0xc8;return function(_0x14a9d7){if(_0x14a9d7){return _0x3de04e[_0x4212('0x1a')](_0x187ae6)[_0x4212('0x1b')](_0x14a9d7);}};}function respondWithFilteredResult(_0x1c92c1,_0x21de37){return function(_0x4004e6){if(_0x4004e6){var _0x5d79ad=typeof _0x21de37[_0x4212('0x1c')]==='undefined'&&typeof _0x21de37[_0x4212('0x1d')]===_0x4212('0x1e');var _0x3b5187=_0x4004e6[_0x4212('0x1f')];var _0x2eb43e=_0x5d79ad?0x0:_0x21de37[_0x4212('0x1c')];var _0x425091=_0x5d79ad?_0x4004e6[_0x4212('0x1f')]:_0x21de37[_0x4212('0x1c')]+_0x21de37['limit'];var _0x5aad5d;if(_0x425091>=_0x3b5187){_0x425091=_0x3b5187;_0x5aad5d=0xc8;}else{_0x5aad5d=0xce;}_0x1c92c1[_0x4212('0x1a')](_0x5aad5d);return _0x1c92c1[_0x4212('0x20')](_0x4212('0x21'),_0x2eb43e+'-'+_0x425091+'/'+_0x3b5187)[_0x4212('0x1b')](_0x4004e6);}return null;};}function patchUpdates(_0x1d2e8c){return function(_0x354328){try{jsonpatch[_0x4212('0x22')](_0x354328,_0x1d2e8c,!![]);}catch(_0x36673b){return BPromise['reject'](_0x36673b);}return _0x354328['save']();};}function saveUpdates(_0x5f4eed,_0x4a071d){return function(_0xfed352){if(_0xfed352){return _0xfed352['update'](_0x5f4eed)[_0x4212('0x23')](function(_0x11bcf4){return _0x11bcf4;});}return null;};}function removeEntity(_0x1302f6,_0x6d09cc){return function(_0x376536){if(_0x376536){return _0x376536[_0x4212('0x24')]()['then'](function(){_0x1302f6['status'](0xcc)[_0x4212('0x25')]();});}};}function handleEntityNotFound(_0xa5c7fb,_0x478279){return function(_0x3c3e00){if(!_0x3c3e00){_0xa5c7fb[_0x4212('0x19')](0x194);}return _0x3c3e00;};}function handleError(_0x2a5ac1,_0x53e381){_0x53e381=_0x53e381||0x1f4;return function(_0x27fcb6){logger['error'](_0x27fcb6[_0x4212('0x26')]);if(_0x27fcb6['name']){delete _0x27fcb6['name'];}_0x2a5ac1[_0x4212('0x1a')](_0x53e381)[_0x4212('0x27')](_0x27fcb6);};}exports[_0x4212('0x28')]=function(_0xf85a1e,_0x366e39){var _0xa48add={},_0x333de3={},_0x3ea2e3={'count':0x0,'rows':[]};var _0x5793d5=_[_0x4212('0x29')](db[_0x4212('0x2a')][_0x4212('0x2b')],function(_0x46ab74){return{'name':_0x46ab74['fieldName'],'type':_0x46ab74[_0x4212('0x2c')][_0x4212('0x2d')]};});_0x333de3[_0x4212('0x2e')]=_[_0x4212('0x29')](_0x5793d5,_0x4212('0x2f'));_0x333de3[_0x4212('0x30')]=_[_0x4212('0x31')](_0xf85a1e['query']);_0x333de3[_0x4212('0x32')]=_[_0x4212('0x33')](_0x333de3[_0x4212('0x2e')],_0x333de3[_0x4212('0x30')]);_0xa48add[_0x4212('0x34')]=_[_0x4212('0x33')](_0x333de3[_0x4212('0x2e')],qs[_0x4212('0x35')](_0xf85a1e[_0x4212('0x30')][_0x4212('0x35')]));_0xa48add[_0x4212('0x34')]=_0xa48add['attributes'][_0x4212('0x36')]?_0xa48add['attributes']:_0x333de3[_0x4212('0x2e')];if(!_0xf85a1e[_0x4212('0x30')][_0x4212('0x37')](_0x4212('0x38'))){_0xa48add[_0x4212('0x1d')]=qs[_0x4212('0x1d')](_0xf85a1e[_0x4212('0x30')][_0x4212('0x1d')]);_0xa48add[_0x4212('0x1c')]=qs[_0x4212('0x1c')](_0xf85a1e[_0x4212('0x30')][_0x4212('0x1c')]);}_0xa48add['order']=qs['sort'](_0xf85a1e['query'][_0x4212('0x39')]);_0xa48add[_0x4212('0x3a')]=qs[_0x4212('0x32')](_[_0x4212('0x3b')](_0xf85a1e[_0x4212('0x30')],_0x333de3[_0x4212('0x32')]),_0x5793d5);if(_0xf85a1e[_0x4212('0x30')][_0x4212('0x3c')]){_0xa48add[_0x4212('0x3a')]=_[_0x4212('0x3d')](_0xa48add[_0x4212('0x3a')],{'$or':_[_0x4212('0x29')](_0x5793d5,function(_0x3083ed){if(_0x3083ed[_0x4212('0x2c')]!==_0x4212('0x3e')){var _0x1ca5fc={};_0x1ca5fc[_0x3083ed[_0x4212('0x2f')]]={'$like':'%'+_0xf85a1e[_0x4212('0x30')][_0x4212('0x3c')]+'%'};return _0x1ca5fc;}})});}_0xa48add=_[_0x4212('0x3d')]({},_0xa48add,_0xf85a1e[_0x4212('0x3f')]);var _0xbf22b3={'where':_0xa48add[_0x4212('0x3a')]};return db[_0x4212('0x2a')][_0x4212('0x1f')](_0xbf22b3)[_0x4212('0x23')](function(_0x4b1250){_0x3ea2e3[_0x4212('0x1f')]=_0x4b1250;if(_0xf85a1e[_0x4212('0x30')][_0x4212('0x40')]){_0xa48add['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x4212('0x41')](_0xa48add);})['then'](function(_0x2398ab){_0x3ea2e3[_0x4212('0x42')]=_0x2398ab;return _0x3ea2e3;})[_0x4212('0x23')](respondWithFilteredResult(_0x366e39,_0xa48add))['catch'](handleError(_0x366e39,null));};exports[_0x4212('0x43')]=function(_0xf43ee7,_0x218904){var _0x3bce93={'raw':![],'where':{'id':_0xf43ee7['params']['id']}},_0x2e40bb={};_0x2e40bb[_0x4212('0x2e')]=_[_0x4212('0x31')](db[_0x4212('0x2a')][_0x4212('0x2b')]);_0x2e40bb['query']=_[_0x4212('0x31')](_0xf43ee7['query']);_0x2e40bb[_0x4212('0x32')]=_[_0x4212('0x33')](_0x2e40bb['model'],_0x2e40bb[_0x4212('0x30')]);_0x3bce93[_0x4212('0x34')]=_[_0x4212('0x33')](_0x2e40bb[_0x4212('0x2e')],qs[_0x4212('0x35')](_0xf43ee7[_0x4212('0x30')][_0x4212('0x35')]));_0x3bce93[_0x4212('0x34')]=_0x3bce93[_0x4212('0x34')][_0x4212('0x36')]?_0x3bce93[_0x4212('0x34')]:_0x2e40bb[_0x4212('0x2e')];if(_0xf43ee7[_0x4212('0x30')][_0x4212('0x40')]){_0x3bce93[_0x4212('0x44')]=[{'all':!![]}];}_0x3bce93=_[_0x4212('0x3d')]({},_0x3bce93,_0xf43ee7[_0x4212('0x3f')]);return db['VtigerAccount'][_0x4212('0x45')](_0x3bce93)[_0x4212('0x23')](handleEntityNotFound(_0x218904,null))['then'](respondWithResult(_0x218904,null))[_0x4212('0x46')](handleError(_0x218904,null));};exports[_0x4212('0x47')]=function(_0x3d9ec6,_0x2987ec){return db['VtigerAccount'][_0x4212('0x47')](_0x3d9ec6[_0x4212('0x48')],{})[_0x4212('0x23')](respondWithResult(_0x2987ec,0xc9))[_0x4212('0x46')](handleError(_0x2987ec,null));};exports[_0x4212('0x49')]=function(_0x1dc104,_0x2d96c0){if(_0x1dc104[_0x4212('0x48')]['id']){delete _0x1dc104[_0x4212('0x48')]['id'];}return db['VtigerAccount'][_0x4212('0x45')]({'where':{'id':_0x1dc104[_0x4212('0x4a')]['id']}})[_0x4212('0x23')](handleEntityNotFound(_0x2d96c0,null))[_0x4212('0x23')](saveUpdates(_0x1dc104[_0x4212('0x48')],null))[_0x4212('0x23')](respondWithResult(_0x2d96c0,null))[_0x4212('0x46')](handleError(_0x2d96c0,null));};exports[_0x4212('0x24')]=function(_0x564c94,_0x4aedcb){return db[_0x4212('0x2a')][_0x4212('0x45')]({'where':{'id':_0x564c94['params']['id']}})[_0x4212('0x23')](handleEntityNotFound(_0x4aedcb,null))['then'](removeEntity(_0x4aedcb,null))[_0x4212('0x46')](handleError(_0x4aedcb,null));};exports[_0x4212('0x4b')]=function(_0x37f40f,_0x3970c4,_0x2377b7){var _0x51b9c6={};var _0x124aa6={};var _0x217ead;var _0x5daec6;return db[_0x4212('0x2a')][_0x4212('0x4c')]({'where':{'id':_0x37f40f[_0x4212('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3970c4,null))[_0x4212('0x23')](function(_0xcd3e06){if(_0xcd3e06){_0x217ead=_0xcd3e06;_0x124aa6['model']=_[_0x4212('0x31')](db[_0x4212('0x4d')][_0x4212('0x2b')]);_0x124aa6['query']=_[_0x4212('0x31')](_0x37f40f[_0x4212('0x30')]);_0x124aa6['filters']=_[_0x4212('0x33')](_0x124aa6[_0x4212('0x2e')],_0x124aa6[_0x4212('0x30')]);_0x51b9c6[_0x4212('0x34')]=_[_0x4212('0x33')](_0x124aa6[_0x4212('0x2e')],qs[_0x4212('0x35')](_0x37f40f[_0x4212('0x30')][_0x4212('0x35')]));_0x51b9c6[_0x4212('0x34')]=_0x51b9c6[_0x4212('0x34')]['length']?_0x51b9c6['attributes']:_0x124aa6[_0x4212('0x2e')];_0x51b9c6[_0x4212('0x4e')]=qs[_0x4212('0x39')](_0x37f40f[_0x4212('0x30')][_0x4212('0x39')]);_0x51b9c6['where']=qs['filters'](_[_0x4212('0x3b')](_0x37f40f['query'],_0x124aa6[_0x4212('0x32')]));if(_0x37f40f[_0x4212('0x30')]['filter']){_0x51b9c6['where']=_['merge'](_0x51b9c6['where'],{'$or':_[_0x4212('0x29')](_0x51b9c6[_0x4212('0x34')],function(_0x29a725){var _0x9fc294={};_0x9fc294[_0x29a725]={'$like':'%'+_0x37f40f[_0x4212('0x30')]['filter']+'%'};return _0x9fc294;})});}_0x51b9c6=_[_0x4212('0x3d')]({},_0x51b9c6,_0x37f40f[_0x4212('0x3f')]);return _0x217ead['getConfigurations'](_0x51b9c6);}})[_0x4212('0x23')](function(_0x364423){if(_0x364423){_0x5daec6=_0x364423[_0x4212('0x36')];if(!_0x37f40f[_0x4212('0x30')][_0x4212('0x37')](_0x4212('0x38'))){_0x51b9c6[_0x4212('0x1d')]=qs[_0x4212('0x1d')](_0x37f40f[_0x4212('0x30')][_0x4212('0x1d')]);_0x51b9c6[_0x4212('0x1c')]=qs[_0x4212('0x1c')](_0x37f40f[_0x4212('0x30')][_0x4212('0x1c')]);}return _0x217ead[_0x4212('0x4b')](_0x51b9c6);}})[_0x4212('0x23')](function(_0xb8a03){if(_0xb8a03){return _0xb8a03?{'count':_0x5daec6,'rows':_0xb8a03}:null;}})['then'](respondWithResult(_0x3970c4,null))[_0x4212('0x46')](handleError(_0x3970c4,null));};exports[_0x4212('0x4f')]=function(_0x321d0e,_0x2cea7e,_0xc10378){if(_0x321d0e[_0x4212('0x48')]['id']){delete _0x321d0e[_0x4212('0x48')]['id'];}return db[_0x4212('0x2a')]['findOne']({'where':{'id':_0x321d0e['params']['id']}})[_0x4212('0x23')](handleEntityNotFound(_0x2cea7e,null))['then'](function(_0x10fa5f){if(_0x10fa5f){_0x321d0e[_0x4212('0x48')][_0x4212('0x50')]=_0x10fa5f['id'];_0x321d0e[_0x4212('0x48')]['Subjects']=integrations[_0x4212('0x51')](_0x321d0e[_0x4212('0x48')][_0x4212('0x52')],_0x321d0e[_0x4212('0x48')]['type']);_0x321d0e['body'][_0x4212('0x53')]=integrations['getDescriptions'](_0x321d0e[_0x4212('0x48')][_0x4212('0x52')],_0x321d0e[_0x4212('0x48')][_0x4212('0x2c')]);return db[_0x4212('0x4d')][_0x4212('0x47')](_0x321d0e[_0x4212('0x48')],{'include':[{'model':db[_0x4212('0x54')],'as':_0x4212('0x55')},{'model':db[_0x4212('0x54')],'as':_0x4212('0x53')}]});}return null;})['then'](respondWithResult(_0x2cea7e,null))[_0x4212('0x46')](handleError(_0x2cea7e,null));};var md5=require(_0x4212('0x56'));exports[_0x4212('0x57')]=function(_0x303035,_0x4439ef,_0x54922f){var _0x2227bd=null;var _0x42b51a=null;var _0x1f0d96=null;var _0x37abbd=null;var _0x1cf038='';return db[_0x4212('0x2a')][_0x4212('0x4c')]({'where':{'id':_0x303035[_0x4212('0x4a')]['id']},'attributes':['id',_0x4212('0x2f'),_0x4212('0x58'),_0x4212('0x59'),_0x4212('0x5a'),_0x4212('0x5b'),_0x4212('0x5c'),_0x4212('0x5d')]})[_0x4212('0x23')](handleEntityNotFound(_0x4439ef,null))['then'](function(_0x34b272){if(_0x34b272){_0x2227bd=_0x34b272['username'];_0x42b51a=_0x34b272[_0x4212('0x5d')];_0x1f0d96=_0x34b272[_0x4212('0x5a')];_0x1cf038=_0x34b272[_0x4212('0x5b')];var _0x222ef1=_0x1cf038['slice'](-0x1);if(_0x222ef1==='/'){_0x1cf038=_0x1cf038[_0x4212('0x5e')](0x0,_0x1cf038['lastIndexOf'](_0x222ef1));}_0x37abbd=util[_0x4212('0x5f')](_0x4212('0x60'),_0x1cf038);var _0x4cbbb0={'method':_0x4212('0x61'),'uri':_0x37abbd,'qs':{'operation':'getchallenge','username':_0x34b272[_0x4212('0x58')]},'json':!![]};return rp(_0x4cbbb0);}})[_0x4212('0x23')](function(_0x248a98){if(_0x248a98[_0x4212('0x62')]){var _0x1d8f03={'method':'POST','uri':_0x37abbd,'form':{'operation':'login','username':_0x2227bd,'accessKey':md5(_0x248a98[_0x4212('0x63')]['token']+_0x42b51a)},'json':!![]};return rp(_0x1d8f03);}})[_0x4212('0x23')](function(_0x558d3e){if(_0x558d3e[_0x4212('0x62')]){var _0x58750a={'method':_0x4212('0x61'),'uri':_0x37abbd,'qs':{'operation':'describe','username':_0x2227bd,'sessionName':_0x558d3e[_0x4212('0x63')][_0x4212('0x64')],'elementType':_0x1f0d96},'json':!![]};return rp(_0x58750a);}})['then'](function(_0x54d600){if(_0x54d600[_0x4212('0x62')]){var _0x35163f=[_0x4212('0x65'),_0x4212('0x66'),'owner'];_[_0x4212('0x67')](_0x54d600[_0x4212('0x63')]['fields'],function(_0x2a2e9e){return _0x35163f[_0x4212('0x68')](_0x2a2e9e[_0x4212('0x2c')][_0x4212('0x2f')]);});_[_0x4212('0x67')](_0x54d600[_0x4212('0x63')][_0x4212('0x35')],function(_0x1b1986){return _0x1b1986[_0x4212('0x69')]===_0x4212('0x6a');});return{'count':_0x54d600['result'][_0x4212('0x35')][_0x4212('0x36')],'rows':_[_0x4212('0x29')](_0x54d600[_0x4212('0x63')][_0x4212('0x35')],function(_0x83b4f7){return{'id':_0x83b4f7[_0x4212('0x2f')],'name':_0x83b4f7['label'],'custom':_[_0x4212('0x6b')](_0x83b4f7['name'],'cf_')?!![]:![],'options':_0x83b4f7[_0x4212('0x2c')]['name']===_0x4212('0x6c')&&_0x83b4f7['type'][_0x4212('0x6d')][_0x4212('0x36')]>0x0?_['map'](_0x83b4f7[_0x4212('0x2c')]['picklistValues'],function(_0x8d8ccd){return{'name':_0x8d8ccd[_0x4212('0x6e')],'value':_0x8d8ccd[_0x4212('0x6f')]};}):[]};})};}})[_0x4212('0x23')](respondWithResult(_0x4439ef,null))['catch'](function(_0x130430){console[_0x4212('0x70')]('vTiger\x20error:\x20'+_0x130430);var _0x46032c=_0x303035[_0x4212('0x30')][_0x4212('0x71')]?0x1f4:_0x130430[_0x4212('0x72')]||0x1f4;logger[_0x4212('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0x4212('0x57'),_0x46032c,JSON[_0x4212('0x74')](_0x130430));delete _0x130430['name'];if(_0x46032c===0x191){_0x46032c=0x190;}_0x4439ef[_0x4212('0x1a')](_0x46032c)[_0x4212('0x27')](_0x303035['query'][_0x4212('0x71')]?{'message':_0x4212('0x75'),'statusCode':_0x130430['statusCode']}:_0x130430);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index dc27462..3dcebbc 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 _0xa8aa=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger'];(function(_0x3d1068,_0x521bd8){var _0x39250c=function(_0x49d0f1){while(--_0x49d0f1){_0x3d1068['push'](_0x3d1068['shift']());}};_0x39250c(++_0x521bd8);}(_0xa8aa,0xe9));var _0xaa8a=function(_0x47aad8,_0x4292eb){_0x47aad8=_0x47aad8-0x0;var _0x215148=_0xa8aa[_0x47aad8];return _0x215148;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa8a('0x0'))(_0xaa8a('0x1'));var moment=require(_0xaa8a('0x2'));var BPromise=require(_0xaa8a('0x3'));var rp=require(_0xaa8a('0x4'));var fs=require('fs');var path=require(_0xaa8a('0x5'));var rimraf=require('rimraf');var config=require(_0xaa8a('0x6'));var attributes=require(_0xaa8a('0x7'));var integrations=require(_0xaa8a('0x8'));module[_0xaa8a('0x9')]=function(_0x45788d,_0x17eb9b){return _0x45788d[_0xaa8a('0xa')](_0xaa8a('0xb'),attributes,{'tableName':_0xaa8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9295=['define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','../../config/environment','./intVtigerAccount.attributes'];(function(_0x516727,_0x383874){var _0x47a957=function(_0x3ad501){while(--_0x3ad501){_0x516727['push'](_0x516727['shift']());}};_0x47a957(++_0x383874);}(_0x9295,0x9b));var _0x5929=function(_0x11bb63,_0xf6cae6){_0x11bb63=_0x11bb63-0x0;var _0x5d645=_0x9295[_0x11bb63];return _0x5d645;};'use strict';var _=require(_0x5929('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5929('0x1'));var moment=require(_0x5929('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5929('0x3'));var attributes=require(_0x5929('0x4'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x59dc3d,_0xf22f83){return _0x59dc3d[_0x5929('0x5')](_0x5929('0x6'),attributes,{'tableName':_0x5929('0x7'),'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 b43644f..1fcb3a4 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 _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowVtigerAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x97cb2e,_0x4c3c3c){var _0x364106=function(_0xd18f6f){while(--_0xd18f6f){_0x97cb2e['push'](_0x97cb2e['shift']());}};_0x364106(++_0x4c3c3c);}(_0x0972,0x64));var _0x2097=function(_0xeb7bd3,_0x19435a){_0xeb7bd3=_0xeb7bd3-0x0;var _0x5633b6=_0x0972[_0xeb7bd3];return _0x5633b6;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file +var _0x97c1=['error','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','debug','find','where','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56cf44,_0x4d193b){var _0xbf812d=function(_0xff128b){while(--_0xff128b){_0x56cf44['push'](_0x56cf44['shift']());}};_0xbf812d(++_0x4d193b);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetVtigerAccount']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetVtigerAccount',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['VtigerAccount'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d5b64ce..33408eb 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 _0xa29f=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','isAuthenticated','index'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0xa29f,0x1d1));var _0xfa29=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0xa29f[_0x46ec32];return _0x338f60;};'use strict';var multer=require(_0xfa29('0x0'));var util=require(_0xfa29('0x1'));var path=require('path');var timeout=require(_0xfa29('0x2'));var express=require(_0xfa29('0x3'));var router=express[_0xfa29('0x4')]();var fs_extra=require(_0xfa29('0x5'));var auth=require(_0xfa29('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfa29('0x7'));router['get']('/',auth[_0xfa29('0x8')](),controller[_0xfa29('0x9')]);router[_0xfa29('0xa')](_0xfa29('0xb'),auth[_0xfa29('0x8')](),controller[_0xfa29('0xc')]);router[_0xfa29('0xa')](_0xfa29('0xd'),auth[_0xfa29('0x8')](),controller[_0xfa29('0xe')]);router[_0xfa29('0xa')](_0xfa29('0xf'),auth[_0xfa29('0x8')](),controller[_0xfa29('0x10')]);router[_0xfa29('0xa')](_0xfa29('0x11'),auth[_0xfa29('0x8')](),controller[_0xfa29('0x12')]);router[_0xfa29('0x13')]('/',auth[_0xfa29('0x8')](),controller[_0xfa29('0x14')]);router['put']('/:id',auth[_0xfa29('0x8')](),controller[_0xfa29('0x15')]);router[_0xfa29('0x16')]('/:id',auth[_0xfa29('0x8')](),controller[_0xfa29('0x17')]);module[_0xfa29('0x18')]=router; \ No newline at end of file +var _0x8b55=['post','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x32b4aa,_0x12eba6){var _0x473160=function(_0x4906b6){while(--_0x4906b6){_0x32b4aa['push'](_0x32b4aa['shift']());}};_0x473160(++_0x12eba6);}(_0x8b55,0x13c));var _0x58b5=function(_0x5d7c54,_0x2c5195){_0x5d7c54=_0x5d7c54-0x0;var _0x4b7fef=_0x8b55[_0x5d7c54];return _0x4b7fef;};'use strict';var multer=require(_0x58b5('0x0'));var util=require(_0x58b5('0x1'));var path=require(_0x58b5('0x2'));var timeout=require(_0x58b5('0x3'));var express=require(_0x58b5('0x4'));var router=express['Router']();var fs_extra=require(_0x58b5('0x5'));var auth=require(_0x58b5('0x6'));var interaction=require(_0x58b5('0x7'));var config=require(_0x58b5('0x8'));var controller=require(_0x58b5('0x9'));router[_0x58b5('0xa')]('/',auth['isAuthenticated'](),controller[_0x58b5('0xb')]);router['get']('/:id',auth[_0x58b5('0xc')](),controller[_0x58b5('0xd')]);router[_0x58b5('0xa')](_0x58b5('0xe'),auth['isAuthenticated'](),controller[_0x58b5('0xf')]);router[_0x58b5('0xa')](_0x58b5('0x10'),auth[_0x58b5('0xc')](),controller[_0x58b5('0x11')]);router[_0x58b5('0xa')](_0x58b5('0x12'),auth['isAuthenticated'](),controller[_0x58b5('0x13')]);router[_0x58b5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x58b5('0x15')](_0x58b5('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0x58b5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 870dc66..e079950 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 _0x4b2c=['sequelize','exports','STRING'];(function(_0x142b18,_0x35e4ff){var _0x24c9a5=function(_0x3bd378){while(--_0x3bd378){_0x142b18['push'](_0x142b18['shift']());}};_0x24c9a5(++_0x35e4ff);}(_0x4b2c,0xb7));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b2('0x0'));module[_0xc4b2('0x1')]={'name':{'type':Sequelize[_0xc4b2('0x2')]},'description':{'type':Sequelize[_0xc4b2('0x2')]}}; \ No newline at end of file +var _0x4342=['STRING','sequelize','exports'];(function(_0x15f4d9,_0x2b724f){var _0x1b4549=function(_0x1ef78c){while(--_0x1ef78c){_0x15f4d9['push'](_0x15f4d9['shift']());}};_0x1b4549(++_0x2b724f);}(_0x4342,0x18d));var _0x2434=function(_0x3c6516,_0x35f01b){_0x3c6516=_0x3c6516-0x0;var _0x1bb36d=_0x4342[_0x3c6516];return _0x1bb36d;};'use strict';var Sequelize=require(_0x2434('0x0'));module[_0x2434('0x1')]={'name':{'type':Sequelize[_0x2434('0x2')]},'description':{'type':Sequelize[_0x2434('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2d3b738..f524156 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 _0x90be=['key','query','keys','filters','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','VtigerConfiguration','find','create','body','findOne','VtigerField','rawAttributes','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','fieldName','type'];(function(_0x9f723,_0x53b4b4){var _0x2b10a4=function(_0x416281){while(--_0x416281){_0x9f723['push'](_0x9f723['shift']());}};_0x2b10a4(++_0x53b4b4);}(_0x90be,0x15f));var _0xe90b=function(_0x4ae72f,_0x15afe4){_0x4ae72f=_0x4ae72f-0x0;var _0x259011=_0x90be[_0x4ae72f];return _0x259011;};'use strict';var emlformat=require(_0xe90b('0x0'));var rimraf=require(_0xe90b('0x1'));var zipdir=require(_0xe90b('0x2'));var jsonpatch=require(_0xe90b('0x3'));var rp=require(_0xe90b('0x4'));var moment=require('moment');var BPromise=require(_0xe90b('0x5'));var Mustache=require(_0xe90b('0x6'));var util=require(_0xe90b('0x7'));var path=require('path');var sox=require(_0xe90b('0x8'));var csv=require(_0xe90b('0x9'));var ejs=require(_0xe90b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe90b('0xb'));var squel=require('squel');var crypto=require(_0xe90b('0xc'));var jsforce=require(_0xe90b('0xd'));var deskjs=require(_0xe90b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe90b('0xf'));var Redis=require(_0xe90b('0x10'));var authService=require(_0xe90b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe90b('0x12'));var hardwareService=require(_0xe90b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe90b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe90b('0x15'));var db=require(_0xe90b('0x16'))['db'];function respondWithStatusCode(_0x232d45,_0xdd2d34){_0xdd2d34=_0xdd2d34||0xcc;return function(_0x1fceec){if(_0x1fceec){return _0x232d45[_0xe90b('0x17')](_0xdd2d34);}return _0x232d45[_0xe90b('0x18')](_0xdd2d34)[_0xe90b('0x19')]();};}function respondWithResult(_0x1bd2da,_0x3a5f7b){_0x3a5f7b=_0x3a5f7b||0xc8;return function(_0x253211){if(_0x253211){return _0x1bd2da[_0xe90b('0x18')](_0x3a5f7b)['json'](_0x253211);}};}function respondWithFilteredResult(_0x54b806,_0x59c376){return function(_0x2bc188){if(_0x2bc188){var _0x389744=typeof _0x59c376[_0xe90b('0x1a')]==='undefined'&&typeof _0x59c376['limit']===_0xe90b('0x1b');var _0x3c4872=_0x2bc188[_0xe90b('0x1c')];var _0x169486=_0x389744?0x0:_0x59c376[_0xe90b('0x1a')];var _0x3b9cf0=_0x389744?_0x2bc188['count']:_0x59c376['offset']+_0x59c376[_0xe90b('0x1d')];var _0x5edbb2;if(_0x3b9cf0>=_0x3c4872){_0x3b9cf0=_0x3c4872;_0x5edbb2=0xc8;}else{_0x5edbb2=0xce;}_0x54b806[_0xe90b('0x18')](_0x5edbb2);return _0x54b806[_0xe90b('0x1e')](_0xe90b('0x1f'),_0x169486+'-'+_0x3b9cf0+'/'+_0x3c4872)[_0xe90b('0x20')](_0x2bc188);}return null;};}function patchUpdates(_0x180a99){return function(_0x5422e3){try{jsonpatch[_0xe90b('0x21')](_0x5422e3,_0x180a99,!![]);}catch(_0x3c0e55){return BPromise[_0xe90b('0x22')](_0x3c0e55);}return _0x5422e3[_0xe90b('0x23')]();};}function saveUpdates(_0x1346e0,_0x16fe1e){return function(_0x195a25){if(_0x195a25){return _0x195a25[_0xe90b('0x24')](_0x1346e0)[_0xe90b('0x25')](function(_0x5a0e14){return _0x5a0e14;});}return null;};}function removeEntity(_0x234a55,_0x3d1a61){return function(_0x478bd0){if(_0x478bd0){return _0x478bd0[_0xe90b('0x26')]()[_0xe90b('0x25')](function(){_0x234a55['status'](0xcc)[_0xe90b('0x19')]();});}};}function handleEntityNotFound(_0x403935,_0x5714c8){return function(_0x4f69b2){if(!_0x4f69b2){_0x403935[_0xe90b('0x17')](0x194);}return _0x4f69b2;};}function handleError(_0x3aed7f,_0x3f42e9){_0x3f42e9=_0x3f42e9||0x1f4;return function(_0x52d033){logger['error'](_0x52d033[_0xe90b('0x27')]);if(_0x52d033[_0xe90b('0x28')]){delete _0x52d033[_0xe90b('0x28')];}_0x3aed7f['status'](_0x3f42e9)['send'](_0x52d033);};}exports['index']=function(_0xb3cc33,_0x2669be){var _0x2a2d87={},_0x581504={},_0x1f5e51={'count':0x0,'rows':[]};var _0x2a2fe4=_[_0xe90b('0x29')](db['VtigerConfiguration']['rawAttributes'],function(_0x41f975){return{'name':_0x41f975[_0xe90b('0x2a')],'type':_0x41f975[_0xe90b('0x2b')][_0xe90b('0x2c')]};});_0x581504['model']=_[_0xe90b('0x29')](_0x2a2fe4,_0xe90b('0x28'));_0x581504[_0xe90b('0x2d')]=_[_0xe90b('0x2e')](_0xb3cc33['query']);_0x581504[_0xe90b('0x2f')]=_['intersection'](_0x581504[_0xe90b('0x30')],_0x581504[_0xe90b('0x2d')]);_0x2a2d87['attributes']=_[_0xe90b('0x31')](_0x581504[_0xe90b('0x30')],qs['fields'](_0xb3cc33[_0xe90b('0x2d')][_0xe90b('0x32')]));_0x2a2d87['attributes']=_0x2a2d87['attributes'][_0xe90b('0x33')]?_0x2a2d87[_0xe90b('0x34')]:_0x581504[_0xe90b('0x30')];if(!_0xb3cc33[_0xe90b('0x2d')][_0xe90b('0x35')](_0xe90b('0x36'))){_0x2a2d87['limit']=qs['limit'](_0xb3cc33[_0xe90b('0x2d')][_0xe90b('0x1d')]);_0x2a2d87[_0xe90b('0x1a')]=qs['offset'](_0xb3cc33[_0xe90b('0x2d')]['offset']);}_0x2a2d87[_0xe90b('0x37')]=qs[_0xe90b('0x38')](_0xb3cc33['query'][_0xe90b('0x38')]);_0x2a2d87[_0xe90b('0x39')]=qs[_0xe90b('0x2f')](_[_0xe90b('0x3a')](_0xb3cc33[_0xe90b('0x2d')],_0x581504[_0xe90b('0x2f')]),_0x2a2fe4);if(_0xb3cc33['query'][_0xe90b('0x3b')]){_0x2a2d87[_0xe90b('0x39')]=_[_0xe90b('0x3c')](_0x2a2d87[_0xe90b('0x39')],{'$or':_[_0xe90b('0x29')](_0x2a2fe4,function(_0xede986){if(_0xede986[_0xe90b('0x2b')]!==_0xe90b('0x3d')){var _0x3d6e03={};_0x3d6e03[_0xede986[_0xe90b('0x28')]]={'$like':'%'+_0xb3cc33[_0xe90b('0x2d')]['filter']+'%'};return _0x3d6e03;}})});}_0x2a2d87=_[_0xe90b('0x3c')]({},_0x2a2d87,_0xb3cc33[_0xe90b('0x3e')]);var _0x1b6c34={'where':_0x2a2d87[_0xe90b('0x39')]};return db['VtigerConfiguration'][_0xe90b('0x1c')](_0x1b6c34)[_0xe90b('0x25')](function(_0x1f3858){_0x1f5e51['count']=_0x1f3858;if(_0xb3cc33[_0xe90b('0x2d')][_0xe90b('0x3f')]){_0x2a2d87[_0xe90b('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x2a2d87);})['then'](function(_0x141aa5){_0x1f5e51[_0xe90b('0x41')]=_0x141aa5;return _0x1f5e51;})['then'](respondWithFilteredResult(_0x2669be,_0x2a2d87))[_0xe90b('0x42')](handleError(_0x2669be,null));};exports[_0xe90b('0x43')]=function(_0x3ed0c7,_0x47bda6){var _0x45b749={'raw':![],'where':{'id':_0x3ed0c7[_0xe90b('0x44')]['id']}},_0x3c9629={};_0x3c9629[_0xe90b('0x30')]=_[_0xe90b('0x2e')](db[_0xe90b('0x45')]['rawAttributes']);_0x3c9629['query']=_[_0xe90b('0x2e')](_0x3ed0c7[_0xe90b('0x2d')]);_0x3c9629[_0xe90b('0x2f')]=_['intersection'](_0x3c9629[_0xe90b('0x30')],_0x3c9629[_0xe90b('0x2d')]);_0x45b749[_0xe90b('0x34')]=_['intersection'](_0x3c9629[_0xe90b('0x30')],qs['fields'](_0x3ed0c7[_0xe90b('0x2d')]['fields']));_0x45b749[_0xe90b('0x34')]=_0x45b749[_0xe90b('0x34')][_0xe90b('0x33')]?_0x45b749['attributes']:_0x3c9629[_0xe90b('0x30')];if(_0x3ed0c7[_0xe90b('0x2d')]['includeAll']){_0x45b749[_0xe90b('0x40')]=[{'all':!![]}];}_0x45b749=_[_0xe90b('0x3c')]({},_0x45b749,_0x3ed0c7['options']);return db[_0xe90b('0x45')][_0xe90b('0x46')](_0x45b749)[_0xe90b('0x25')](handleEntityNotFound(_0x47bda6,null))[_0xe90b('0x25')](respondWithResult(_0x47bda6,null))[_0xe90b('0x42')](handleError(_0x47bda6,null));};exports['create']=function(_0x38cf76,_0x5f1321){return db[_0xe90b('0x45')][_0xe90b('0x47')](_0x38cf76[_0xe90b('0x48')],{})[_0xe90b('0x25')](respondWithResult(_0x5f1321,0xc9))['catch'](handleError(_0x5f1321,null));};exports[_0xe90b('0x24')]=function(_0x85c0f2,_0x474613){if(_0x85c0f2[_0xe90b('0x48')]['id']){delete _0x85c0f2['body']['id'];}return db[_0xe90b('0x45')]['find']({'where':{'id':_0x85c0f2[_0xe90b('0x44')]['id']}})[_0xe90b('0x25')](handleEntityNotFound(_0x474613,null))[_0xe90b('0x25')](saveUpdates(_0x85c0f2[_0xe90b('0x48')],null))['then'](respondWithResult(_0x474613,null))['catch'](handleError(_0x474613,null));};exports[_0xe90b('0x26')]=function(_0x42f823,_0x85d7a3){return db[_0xe90b('0x45')][_0xe90b('0x46')]({'where':{'id':_0x42f823[_0xe90b('0x44')]['id']}})['then'](handleEntityNotFound(_0x85d7a3,null))['then'](removeEntity(_0x85d7a3,null))['catch'](handleError(_0x85d7a3,null));};exports['getFields']=function(_0x48c9c0,_0x472cc1,_0x4b684d){var _0x44e696={};var _0x34a9fb={};var _0x1c823e;var _0xf77ac2;return db[_0xe90b('0x45')][_0xe90b('0x49')]({'where':{'id':_0x48c9c0['params']['id']}})[_0xe90b('0x25')](handleEntityNotFound(_0x472cc1,null))['then'](function(_0x1602ae){if(_0x1602ae){_0x1c823e=_0x1602ae;_0x34a9fb[_0xe90b('0x30')]=_[_0xe90b('0x2e')](db[_0xe90b('0x4a')][_0xe90b('0x4b')]);_0x34a9fb[_0xe90b('0x2d')]=_[_0xe90b('0x2e')](_0x48c9c0[_0xe90b('0x2d')]);_0x34a9fb[_0xe90b('0x2f')]=_[_0xe90b('0x31')](_0x34a9fb[_0xe90b('0x30')],_0x34a9fb[_0xe90b('0x2d')]);_0x44e696[_0xe90b('0x34')]=_['intersection'](_0x34a9fb[_0xe90b('0x30')],qs[_0xe90b('0x32')](_0x48c9c0['query'][_0xe90b('0x32')]));_0x44e696[_0xe90b('0x34')]=_0x44e696[_0xe90b('0x34')][_0xe90b('0x33')]?_0x44e696[_0xe90b('0x34')]:_0x34a9fb[_0xe90b('0x30')];_0x44e696[_0xe90b('0x37')]=qs[_0xe90b('0x38')](_0x48c9c0[_0xe90b('0x2d')][_0xe90b('0x38')]);_0x44e696[_0xe90b('0x39')]=qs[_0xe90b('0x2f')](_[_0xe90b('0x3a')](_0x48c9c0[_0xe90b('0x2d')],_0x34a9fb['filters']));if(_0x48c9c0[_0xe90b('0x2d')]['filter']){_0x44e696[_0xe90b('0x39')]=_[_0xe90b('0x3c')](_0x44e696[_0xe90b('0x39')],{'$or':_['map'](_0x44e696[_0xe90b('0x34')],function(_0x164961){var _0x28a324={};_0x28a324[_0x164961]={'$like':'%'+_0x48c9c0[_0xe90b('0x2d')][_0xe90b('0x3b')]+'%'};return _0x28a324;})});}_0x44e696=_['merge']({},_0x44e696,_0x48c9c0['options']);return _0x1c823e['getFields'](_0x44e696);}})['then'](function(_0x10d5fe){if(_0x10d5fe){_0xf77ac2=_0x10d5fe[_0xe90b('0x33')];if(!_0x48c9c0[_0xe90b('0x2d')]['hasOwnProperty'](_0xe90b('0x36'))){_0x44e696['limit']=qs[_0xe90b('0x1d')](_0x48c9c0['query'][_0xe90b('0x1d')]);_0x44e696[_0xe90b('0x1a')]=qs[_0xe90b('0x1a')](_0x48c9c0[_0xe90b('0x2d')][_0xe90b('0x1a')]);}return _0x1c823e[_0xe90b('0x4c')](_0x44e696);}})['then'](function(_0x56ed5f){if(_0x56ed5f){return _0x56ed5f?{'count':_0xf77ac2,'rows':_0x56ed5f}:null;}})[_0xe90b('0x25')](respondWithResult(_0x472cc1,null))[_0xe90b('0x42')](handleError(_0x472cc1,null));};exports[_0xe90b('0x4d')]=function(_0x460c9a,_0x3670bc,_0x4310ab){var _0x22902d={};var _0x47a8f1={};var _0x3e60cc;var _0x520fc2;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x460c9a[_0xe90b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3670bc,null))[_0xe90b('0x25')](function(_0xa95528){if(_0xa95528){_0x3e60cc=_0xa95528;_0x47a8f1[_0xe90b('0x30')]=_[_0xe90b('0x2e')](db[_0xe90b('0x4a')][_0xe90b('0x4b')]);_0x47a8f1[_0xe90b('0x2d')]=_[_0xe90b('0x2e')](_0x460c9a[_0xe90b('0x2d')]);_0x47a8f1[_0xe90b('0x2f')]=_['intersection'](_0x47a8f1[_0xe90b('0x30')],_0x47a8f1[_0xe90b('0x2d')]);_0x22902d[_0xe90b('0x34')]=_['intersection'](_0x47a8f1[_0xe90b('0x30')],qs['fields'](_0x460c9a['query']['fields']));_0x22902d[_0xe90b('0x34')]=_0x22902d['attributes'][_0xe90b('0x33')]?_0x22902d[_0xe90b('0x34')]:_0x47a8f1['model'];_0x22902d[_0xe90b('0x37')]=qs[_0xe90b('0x38')](_0x460c9a['query'][_0xe90b('0x38')]);_0x22902d[_0xe90b('0x39')]=qs[_0xe90b('0x2f')](_[_0xe90b('0x3a')](_0x460c9a[_0xe90b('0x2d')],_0x47a8f1[_0xe90b('0x2f')]));if(_0x460c9a[_0xe90b('0x2d')][_0xe90b('0x3b')]){_0x22902d[_0xe90b('0x39')]=_['merge'](_0x22902d[_0xe90b('0x39')],{'$or':_[_0xe90b('0x29')](_0x22902d[_0xe90b('0x34')],function(_0x19f94b){var _0x4d05d7={};_0x4d05d7[_0x19f94b]={'$like':'%'+_0x460c9a['query'][_0xe90b('0x3b')]+'%'};return _0x4d05d7;})});}_0x22902d=_[_0xe90b('0x3c')]({},_0x22902d,_0x460c9a['options']);return _0x3e60cc[_0xe90b('0x4d')](_0x22902d);}})[_0xe90b('0x25')](function(_0x18e5a6){if(_0x18e5a6){_0x520fc2=_0x18e5a6[_0xe90b('0x33')];if(!_0x460c9a['query'][_0xe90b('0x35')]('nolimit')){_0x22902d[_0xe90b('0x1d')]=qs['limit'](_0x460c9a[_0xe90b('0x2d')][_0xe90b('0x1d')]);_0x22902d['offset']=qs[_0xe90b('0x1a')](_0x460c9a[_0xe90b('0x2d')][_0xe90b('0x1a')]);}return _0x3e60cc[_0xe90b('0x4d')](_0x22902d);}})[_0xe90b('0x25')](function(_0x34f792){if(_0x34f792){return _0x34f792?{'count':_0x520fc2,'rows':_0x34f792}:null;}})[_0xe90b('0x25')](respondWithResult(_0x3670bc,null))[_0xe90b('0x42')](handleError(_0x3670bc,null));};exports[_0xe90b('0x4e')]=function(_0x6f86a0,_0xf7f2,_0x3a8c31){var _0x111e89={};var _0x1e03a4={};var _0x4b4491;var _0x302036;return db[_0xe90b('0x45')]['findOne']({'where':{'id':_0x6f86a0[_0xe90b('0x44')]['id']}})[_0xe90b('0x25')](handleEntityNotFound(_0xf7f2,null))[_0xe90b('0x25')](function(_0x1bd150){if(_0x1bd150){_0x4b4491=_0x1bd150;_0x1e03a4[_0xe90b('0x30')]=_[_0xe90b('0x2e')](db[_0xe90b('0x4a')][_0xe90b('0x4b')]);_0x1e03a4[_0xe90b('0x2d')]=_[_0xe90b('0x2e')](_0x6f86a0[_0xe90b('0x2d')]);_0x1e03a4[_0xe90b('0x2f')]=_[_0xe90b('0x31')](_0x1e03a4['model'],_0x1e03a4[_0xe90b('0x2d')]);_0x111e89[_0xe90b('0x34')]=_[_0xe90b('0x31')](_0x1e03a4[_0xe90b('0x30')],qs['fields'](_0x6f86a0[_0xe90b('0x2d')][_0xe90b('0x32')]));_0x111e89[_0xe90b('0x34')]=_0x111e89['attributes'][_0xe90b('0x33')]?_0x111e89['attributes']:_0x1e03a4[_0xe90b('0x30')];_0x111e89['order']=qs[_0xe90b('0x38')](_0x6f86a0['query'][_0xe90b('0x38')]);_0x111e89[_0xe90b('0x39')]=qs[_0xe90b('0x2f')](_[_0xe90b('0x3a')](_0x6f86a0[_0xe90b('0x2d')],_0x1e03a4[_0xe90b('0x2f')]));if(_0x6f86a0['query']['filter']){_0x111e89['where']=_[_0xe90b('0x3c')](_0x111e89[_0xe90b('0x39')],{'$or':_[_0xe90b('0x29')](_0x111e89[_0xe90b('0x34')],function(_0x4a4b2b){var _0x4b5b9f={};_0x4b5b9f[_0x4a4b2b]={'$like':'%'+_0x6f86a0[_0xe90b('0x2d')][_0xe90b('0x3b')]+'%'};return _0x4b5b9f;})});}_0x111e89=_[_0xe90b('0x3c')]({},_0x111e89,_0x6f86a0[_0xe90b('0x3e')]);return _0x4b4491[_0xe90b('0x4e')](_0x111e89);}})[_0xe90b('0x25')](function(_0x2613dc){if(_0x2613dc){_0x302036=_0x2613dc[_0xe90b('0x33')];if(!_0x6f86a0[_0xe90b('0x2d')][_0xe90b('0x35')](_0xe90b('0x36'))){_0x111e89[_0xe90b('0x1d')]=qs[_0xe90b('0x1d')](_0x6f86a0['query'][_0xe90b('0x1d')]);_0x111e89[_0xe90b('0x1a')]=qs['offset'](_0x6f86a0[_0xe90b('0x2d')][_0xe90b('0x1a')]);}return _0x4b4491[_0xe90b('0x4e')](_0x111e89);}})[_0xe90b('0x25')](function(_0x4e7e24){if(_0x4e7e24){return _0x4e7e24?{'count':_0x302036,'rows':_0x4e7e24}:null;}})[_0xe90b('0x25')](respondWithResult(_0xf7f2,null))[_0xe90b('0x42')](handleError(_0xf7f2,null));}; \ No newline at end of file +var _0x2f8c=['map','VtigerConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x2f8c,0x117));var _0xc2f8=function(_0x1fc4b4,_0x3b8c32){_0x1fc4b4=_0x1fc4b4-0x0;var _0x1eeee3=_0x2f8c[_0x1fc4b4];return _0x1eeee3;};'use strict';var emlformat=require(_0xc2f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2f8('0x1'));var jsonpatch=require(_0xc2f8('0x2'));var rp=require('request-promise');var moment=require(_0xc2f8('0x3'));var BPromise=require(_0xc2f8('0x4'));var Mustache=require(_0xc2f8('0x5'));var util=require(_0xc2f8('0x6'));var path=require(_0xc2f8('0x7'));var sox=require('sox');var csv=require(_0xc2f8('0x8'));var ejs=require(_0xc2f8('0x9'));var fs=require('fs');var fs_extra=require(_0xc2f8('0xa'));var _=require('lodash');var squel=require(_0xc2f8('0xb'));var crypto=require(_0xc2f8('0xc'));var jsforce=require(_0xc2f8('0xd'));var deskjs=require(_0xc2f8('0xe'));var toCsv=require(_0xc2f8('0x8'));var querystring=require(_0xc2f8('0xf'));var Papa=require(_0xc2f8('0x10'));var Redis=require(_0xc2f8('0x11'));var authService=require(_0xc2f8('0x12'));var qs=require(_0xc2f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2f8('0x14'));var logger=require(_0xc2f8('0x15'))(_0xc2f8('0x16'));var utils=require(_0xc2f8('0x17'));var config=require(_0xc2f8('0x18'));var licenseUtil=require(_0xc2f8('0x19'));var db=require(_0xc2f8('0x1a'))['db'];function respondWithStatusCode(_0x2277d4,_0x2b835a){_0x2b835a=_0x2b835a||0xcc;return function(_0x2ec42b){if(_0x2ec42b){return _0x2277d4['sendStatus'](_0x2b835a);}return _0x2277d4[_0xc2f8('0x1b')](_0x2b835a)[_0xc2f8('0x1c')]();};}function respondWithResult(_0xba0437,_0x5eb45e){_0x5eb45e=_0x5eb45e||0xc8;return function(_0x330ee1){if(_0x330ee1){return _0xba0437[_0xc2f8('0x1b')](_0x5eb45e)[_0xc2f8('0x1d')](_0x330ee1);}};}function respondWithFilteredResult(_0xf0241d,_0x58f74b){return function(_0x22891d){if(_0x22891d){var _0x3a884a=typeof _0x58f74b[_0xc2f8('0x1e')]===_0xc2f8('0x1f')&&typeof _0x58f74b['limit']===_0xc2f8('0x1f');var _0x495a97=_0x22891d[_0xc2f8('0x20')];var _0x1f27c6=_0x3a884a?0x0:_0x58f74b[_0xc2f8('0x1e')];var _0x4026b2=_0x3a884a?_0x22891d['count']:_0x58f74b[_0xc2f8('0x1e')]+_0x58f74b[_0xc2f8('0x21')];var _0x4202eb;if(_0x4026b2>=_0x495a97){_0x4026b2=_0x495a97;_0x4202eb=0xc8;}else{_0x4202eb=0xce;}_0xf0241d[_0xc2f8('0x1b')](_0x4202eb);return _0xf0241d['set'](_0xc2f8('0x22'),_0x1f27c6+'-'+_0x4026b2+'/'+_0x495a97)['json'](_0x22891d);}return null;};}function patchUpdates(_0x1e5fdd){return function(_0x588383){try{jsonpatch[_0xc2f8('0x23')](_0x588383,_0x1e5fdd,!![]);}catch(_0x5b941b){return BPromise[_0xc2f8('0x24')](_0x5b941b);}return _0x588383['save']();};}function saveUpdates(_0x10aa9e,_0x44f483){return function(_0x2239a0){if(_0x2239a0){return _0x2239a0[_0xc2f8('0x25')](_0x10aa9e)[_0xc2f8('0x26')](function(_0x334fa0){return _0x334fa0;});}return null;};}function removeEntity(_0x301482,_0x222426){return function(_0x3e36f5){if(_0x3e36f5){return _0x3e36f5['destroy']()[_0xc2f8('0x26')](function(){_0x301482[_0xc2f8('0x1b')](0xcc)[_0xc2f8('0x1c')]();});}};}function handleEntityNotFound(_0x2adabf,_0x1757f9){return function(_0x2e6a93){if(!_0x2e6a93){_0x2adabf[_0xc2f8('0x27')](0x194);}return _0x2e6a93;};}function handleError(_0x12958d,_0x1c3e33){_0x1c3e33=_0x1c3e33||0x1f4;return function(_0x8a1e9a){logger[_0xc2f8('0x28')](_0x8a1e9a[_0xc2f8('0x29')]);if(_0x8a1e9a[_0xc2f8('0x2a')]){delete _0x8a1e9a[_0xc2f8('0x2a')];}_0x12958d['status'](_0x1c3e33)[_0xc2f8('0x2b')](_0x8a1e9a);};}exports[_0xc2f8('0x2c')]=function(_0x30e148,_0xf021e8){var _0xedb5e7={},_0x13b7dd={},_0x25dff9={'count':0x0,'rows':[]};var _0x2817fc=_[_0xc2f8('0x2d')](db[_0xc2f8('0x2e')]['rawAttributes'],function(_0x35ae20){return{'name':_0x35ae20[_0xc2f8('0x2f')],'type':_0x35ae20[_0xc2f8('0x30')]['key']};});_0x13b7dd[_0xc2f8('0x31')]=_['map'](_0x2817fc,_0xc2f8('0x2a'));_0x13b7dd[_0xc2f8('0x32')]=_[_0xc2f8('0x33')](_0x30e148['query']);_0x13b7dd[_0xc2f8('0x34')]=_[_0xc2f8('0x35')](_0x13b7dd['model'],_0x13b7dd[_0xc2f8('0x32')]);_0xedb5e7[_0xc2f8('0x36')]=_[_0xc2f8('0x35')](_0x13b7dd[_0xc2f8('0x31')],qs[_0xc2f8('0x37')](_0x30e148['query'][_0xc2f8('0x37')]));_0xedb5e7[_0xc2f8('0x36')]=_0xedb5e7[_0xc2f8('0x36')][_0xc2f8('0x38')]?_0xedb5e7[_0xc2f8('0x36')]:_0x13b7dd[_0xc2f8('0x31')];if(!_0x30e148[_0xc2f8('0x32')][_0xc2f8('0x39')]('nolimit')){_0xedb5e7[_0xc2f8('0x21')]=qs[_0xc2f8('0x21')](_0x30e148['query'][_0xc2f8('0x21')]);_0xedb5e7[_0xc2f8('0x1e')]=qs[_0xc2f8('0x1e')](_0x30e148['query'][_0xc2f8('0x1e')]);}_0xedb5e7[_0xc2f8('0x3a')]=qs['sort'](_0x30e148[_0xc2f8('0x32')][_0xc2f8('0x3b')]);_0xedb5e7['where']=qs[_0xc2f8('0x34')](_[_0xc2f8('0x3c')](_0x30e148['query'],_0x13b7dd['filters']),_0x2817fc);if(_0x30e148[_0xc2f8('0x32')][_0xc2f8('0x3d')]){_0xedb5e7[_0xc2f8('0x3e')]=_[_0xc2f8('0x3f')](_0xedb5e7[_0xc2f8('0x3e')],{'$or':_[_0xc2f8('0x2d')](_0x2817fc,function(_0x5c4864){if(_0x5c4864[_0xc2f8('0x30')]!=='VIRTUAL'){var _0x443299={};_0x443299[_0x5c4864[_0xc2f8('0x2a')]]={'$like':'%'+_0x30e148[_0xc2f8('0x32')][_0xc2f8('0x3d')]+'%'};return _0x443299;}})});}_0xedb5e7=_[_0xc2f8('0x3f')]({},_0xedb5e7,_0x30e148[_0xc2f8('0x40')]);var _0x4def7d={'where':_0xedb5e7[_0xc2f8('0x3e')]};return db[_0xc2f8('0x2e')]['count'](_0x4def7d)[_0xc2f8('0x26')](function(_0x1bbe4f){_0x25dff9[_0xc2f8('0x20')]=_0x1bbe4f;if(_0x30e148[_0xc2f8('0x32')]['includeAll']){_0xedb5e7[_0xc2f8('0x41')]=[{'all':!![]}];}return db[_0xc2f8('0x2e')][_0xc2f8('0x42')](_0xedb5e7);})['then'](function(_0x399c80){_0x25dff9[_0xc2f8('0x43')]=_0x399c80;return _0x25dff9;})[_0xc2f8('0x26')](respondWithFilteredResult(_0xf021e8,_0xedb5e7))['catch'](handleError(_0xf021e8,null));};exports[_0xc2f8('0x44')]=function(_0x100f15,_0x698d09){var _0x114bde={'raw':![],'where':{'id':_0x100f15[_0xc2f8('0x45')]['id']}},_0x49c962={};_0x49c962[_0xc2f8('0x31')]=_['keys'](db[_0xc2f8('0x2e')][_0xc2f8('0x46')]);_0x49c962['query']=_[_0xc2f8('0x33')](_0x100f15['query']);_0x49c962[_0xc2f8('0x34')]=_[_0xc2f8('0x35')](_0x49c962[_0xc2f8('0x31')],_0x49c962[_0xc2f8('0x32')]);_0x114bde[_0xc2f8('0x36')]=_[_0xc2f8('0x35')](_0x49c962[_0xc2f8('0x31')],qs['fields'](_0x100f15[_0xc2f8('0x32')][_0xc2f8('0x37')]));_0x114bde[_0xc2f8('0x36')]=_0x114bde[_0xc2f8('0x36')]['length']?_0x114bde[_0xc2f8('0x36')]:_0x49c962[_0xc2f8('0x31')];if(_0x100f15[_0xc2f8('0x32')]['includeAll']){_0x114bde[_0xc2f8('0x41')]=[{'all':!![]}];}_0x114bde=_[_0xc2f8('0x3f')]({},_0x114bde,_0x100f15[_0xc2f8('0x40')]);return db[_0xc2f8('0x2e')][_0xc2f8('0x47')](_0x114bde)['then'](handleEntityNotFound(_0x698d09,null))[_0xc2f8('0x26')](respondWithResult(_0x698d09,null))[_0xc2f8('0x48')](handleError(_0x698d09,null));};exports['create']=function(_0x185bfb,_0x410770){return db['VtigerConfiguration'][_0xc2f8('0x49')](_0x185bfb[_0xc2f8('0x4a')],{})['then'](respondWithResult(_0x410770,0xc9))['catch'](handleError(_0x410770,null));};exports[_0xc2f8('0x25')]=function(_0xf7cff4,_0xd45655){if(_0xf7cff4[_0xc2f8('0x4a')]['id']){delete _0xf7cff4['body']['id'];}return db[_0xc2f8('0x2e')][_0xc2f8('0x47')]({'where':{'id':_0xf7cff4['params']['id']}})[_0xc2f8('0x26')](handleEntityNotFound(_0xd45655,null))[_0xc2f8('0x26')](saveUpdates(_0xf7cff4[_0xc2f8('0x4a')],null))[_0xc2f8('0x26')](respondWithResult(_0xd45655,null))[_0xc2f8('0x48')](handleError(_0xd45655,null));};exports['destroy']=function(_0x1b398f,_0x4bcfdf){return db['VtigerConfiguration'][_0xc2f8('0x47')]({'where':{'id':_0x1b398f[_0xc2f8('0x45')]['id']}})[_0xc2f8('0x26')](handleEntityNotFound(_0x4bcfdf,null))[_0xc2f8('0x26')](removeEntity(_0x4bcfdf,null))[_0xc2f8('0x48')](handleError(_0x4bcfdf,null));};exports[_0xc2f8('0x4b')]=function(_0x30518b,_0x335fa7,_0x2c70ec){var _0x3565ae={};var _0x11b42f={};var _0x1c8b15;var _0x30c7ad;return db[_0xc2f8('0x2e')][_0xc2f8('0x4c')]({'where':{'id':_0x30518b[_0xc2f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x335fa7,null))['then'](function(_0x571031){if(_0x571031){_0x1c8b15=_0x571031;_0x11b42f[_0xc2f8('0x31')]=_[_0xc2f8('0x33')](db[_0xc2f8('0x4d')]['rawAttributes']);_0x11b42f['query']=_[_0xc2f8('0x33')](_0x30518b['query']);_0x11b42f['filters']=_[_0xc2f8('0x35')](_0x11b42f[_0xc2f8('0x31')],_0x11b42f[_0xc2f8('0x32')]);_0x3565ae[_0xc2f8('0x36')]=_[_0xc2f8('0x35')](_0x11b42f[_0xc2f8('0x31')],qs[_0xc2f8('0x37')](_0x30518b[_0xc2f8('0x32')][_0xc2f8('0x37')]));_0x3565ae[_0xc2f8('0x36')]=_0x3565ae[_0xc2f8('0x36')][_0xc2f8('0x38')]?_0x3565ae[_0xc2f8('0x36')]:_0x11b42f[_0xc2f8('0x31')];_0x3565ae[_0xc2f8('0x3a')]=qs[_0xc2f8('0x3b')](_0x30518b[_0xc2f8('0x32')]['sort']);_0x3565ae[_0xc2f8('0x3e')]=qs['filters'](_[_0xc2f8('0x3c')](_0x30518b[_0xc2f8('0x32')],_0x11b42f[_0xc2f8('0x34')]));if(_0x30518b[_0xc2f8('0x32')][_0xc2f8('0x3d')]){_0x3565ae[_0xc2f8('0x3e')]=_[_0xc2f8('0x3f')](_0x3565ae['where'],{'$or':_['map'](_0x3565ae['attributes'],function(_0x3a3c7c){var _0x8bc2bf={};_0x8bc2bf[_0x3a3c7c]={'$like':'%'+_0x30518b['query'][_0xc2f8('0x3d')]+'%'};return _0x8bc2bf;})});}_0x3565ae=_[_0xc2f8('0x3f')]({},_0x3565ae,_0x30518b['options']);return _0x1c8b15[_0xc2f8('0x4b')](_0x3565ae);}})['then'](function(_0x31e020){if(_0x31e020){_0x30c7ad=_0x31e020[_0xc2f8('0x38')];if(!_0x30518b[_0xc2f8('0x32')]['hasOwnProperty'](_0xc2f8('0x4e'))){_0x3565ae[_0xc2f8('0x21')]=qs[_0xc2f8('0x21')](_0x30518b[_0xc2f8('0x32')][_0xc2f8('0x21')]);_0x3565ae[_0xc2f8('0x1e')]=qs[_0xc2f8('0x1e')](_0x30518b[_0xc2f8('0x32')][_0xc2f8('0x1e')]);}return _0x1c8b15[_0xc2f8('0x4b')](_0x3565ae);}})[_0xc2f8('0x26')](function(_0x3e4189){if(_0x3e4189){return _0x3e4189?{'count':_0x30c7ad,'rows':_0x3e4189}:null;}})[_0xc2f8('0x26')](respondWithResult(_0x335fa7,null))[_0xc2f8('0x48')](handleError(_0x335fa7,null));};exports[_0xc2f8('0x4f')]=function(_0x2586c9,_0x5811f6,_0x8c7f9b){var _0x313662={};var _0x24a009={};var _0x50b1fc;var _0x4e684c;return db['VtigerConfiguration'][_0xc2f8('0x4c')]({'where':{'id':_0x2586c9[_0xc2f8('0x45')]['id']}})[_0xc2f8('0x26')](handleEntityNotFound(_0x5811f6,null))[_0xc2f8('0x26')](function(_0x8cce38){if(_0x8cce38){_0x50b1fc=_0x8cce38;_0x24a009['model']=_['keys'](db[_0xc2f8('0x4d')]['rawAttributes']);_0x24a009[_0xc2f8('0x32')]=_['keys'](_0x2586c9['query']);_0x24a009[_0xc2f8('0x34')]=_[_0xc2f8('0x35')](_0x24a009[_0xc2f8('0x31')],_0x24a009['query']);_0x313662['attributes']=_[_0xc2f8('0x35')](_0x24a009['model'],qs['fields'](_0x2586c9['query'][_0xc2f8('0x37')]));_0x313662[_0xc2f8('0x36')]=_0x313662[_0xc2f8('0x36')][_0xc2f8('0x38')]?_0x313662['attributes']:_0x24a009[_0xc2f8('0x31')];_0x313662[_0xc2f8('0x3a')]=qs[_0xc2f8('0x3b')](_0x2586c9[_0xc2f8('0x32')][_0xc2f8('0x3b')]);_0x313662[_0xc2f8('0x3e')]=qs[_0xc2f8('0x34')](_[_0xc2f8('0x3c')](_0x2586c9['query'],_0x24a009[_0xc2f8('0x34')]));if(_0x2586c9[_0xc2f8('0x32')][_0xc2f8('0x3d')]){_0x313662['where']=_[_0xc2f8('0x3f')](_0x313662['where'],{'$or':_[_0xc2f8('0x2d')](_0x313662[_0xc2f8('0x36')],function(_0x720b5c){var _0x2bd4c6={};_0x2bd4c6[_0x720b5c]={'$like':'%'+_0x2586c9[_0xc2f8('0x32')][_0xc2f8('0x3d')]+'%'};return _0x2bd4c6;})});}_0x313662=_[_0xc2f8('0x3f')]({},_0x313662,_0x2586c9[_0xc2f8('0x40')]);return _0x50b1fc[_0xc2f8('0x4f')](_0x313662);}})['then'](function(_0x57d7c0){if(_0x57d7c0){_0x4e684c=_0x57d7c0[_0xc2f8('0x38')];if(!_0x2586c9['query'][_0xc2f8('0x39')](_0xc2f8('0x4e'))){_0x313662[_0xc2f8('0x21')]=qs['limit'](_0x2586c9[_0xc2f8('0x32')][_0xc2f8('0x21')]);_0x313662[_0xc2f8('0x1e')]=qs[_0xc2f8('0x1e')](_0x2586c9['query'][_0xc2f8('0x1e')]);}return _0x50b1fc[_0xc2f8('0x4f')](_0x313662);}})[_0xc2f8('0x26')](function(_0x17d0ca){if(_0x17d0ca){return _0x17d0ca?{'count':_0x4e684c,'rows':_0x17d0ca}:null;}})['then'](respondWithResult(_0x5811f6,null))[_0xc2f8('0x48')](handleError(_0x5811f6,null));};exports[_0xc2f8('0x50')]=function(_0x5d3464,_0x34258c,_0x5ef881){var _0x48289f={};var _0x2d38dc={};var _0x1e82c3;var _0x1c7182;return db[_0xc2f8('0x2e')][_0xc2f8('0x4c')]({'where':{'id':_0x5d3464[_0xc2f8('0x45')]['id']}})[_0xc2f8('0x26')](handleEntityNotFound(_0x34258c,null))['then'](function(_0x444d40){if(_0x444d40){_0x1e82c3=_0x444d40;_0x2d38dc[_0xc2f8('0x31')]=_[_0xc2f8('0x33')](db[_0xc2f8('0x4d')][_0xc2f8('0x46')]);_0x2d38dc[_0xc2f8('0x32')]=_['keys'](_0x5d3464[_0xc2f8('0x32')]);_0x2d38dc['filters']=_['intersection'](_0x2d38dc[_0xc2f8('0x31')],_0x2d38dc[_0xc2f8('0x32')]);_0x48289f['attributes']=_[_0xc2f8('0x35')](_0x2d38dc['model'],qs[_0xc2f8('0x37')](_0x5d3464[_0xc2f8('0x32')]['fields']));_0x48289f[_0xc2f8('0x36')]=_0x48289f[_0xc2f8('0x36')][_0xc2f8('0x38')]?_0x48289f[_0xc2f8('0x36')]:_0x2d38dc[_0xc2f8('0x31')];_0x48289f['order']=qs[_0xc2f8('0x3b')](_0x5d3464[_0xc2f8('0x32')][_0xc2f8('0x3b')]);_0x48289f[_0xc2f8('0x3e')]=qs[_0xc2f8('0x34')](_[_0xc2f8('0x3c')](_0x5d3464['query'],_0x2d38dc[_0xc2f8('0x34')]));if(_0x5d3464[_0xc2f8('0x32')][_0xc2f8('0x3d')]){_0x48289f[_0xc2f8('0x3e')]=_['merge'](_0x48289f[_0xc2f8('0x3e')],{'$or':_[_0xc2f8('0x2d')](_0x48289f['attributes'],function(_0x5ebce1){var _0x576ca4={};_0x576ca4[_0x5ebce1]={'$like':'%'+_0x5d3464[_0xc2f8('0x32')][_0xc2f8('0x3d')]+'%'};return _0x576ca4;})});}_0x48289f=_[_0xc2f8('0x3f')]({},_0x48289f,_0x5d3464['options']);return _0x1e82c3[_0xc2f8('0x50')](_0x48289f);}})[_0xc2f8('0x26')](function(_0x2fbd70){if(_0x2fbd70){_0x1c7182=_0x2fbd70[_0xc2f8('0x38')];if(!_0x5d3464['query'][_0xc2f8('0x39')](_0xc2f8('0x4e'))){_0x48289f['limit']=qs['limit'](_0x5d3464[_0xc2f8('0x32')][_0xc2f8('0x21')]);_0x48289f[_0xc2f8('0x1e')]=qs[_0xc2f8('0x1e')](_0x5d3464[_0xc2f8('0x32')][_0xc2f8('0x1e')]);}return _0x1e82c3[_0xc2f8('0x50')](_0x48289f);}})[_0xc2f8('0x26')](function(_0x405dc5){if(_0x405dc5){return _0x405dc5?{'count':_0x1c7182,'rows':_0x405dc5}:null;}})[_0xc2f8('0x26')](respondWithResult(_0x34258c,null))[_0xc2f8('0x48')](handleError(_0x34258c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1a9d40d..7437dbd 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 _0xd920=['../../config/logger','bluebird','request-promise','path','../../config/environment','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x5a68bb,_0xd756b){var _0x559336=function(_0x3bd126){while(--_0x3bd126){_0x5a68bb['push'](_0x5a68bb['shift']());}};_0x559336(++_0xd756b);}(_0xd920,0x1af));var _0x0d92=function(_0x381372,_0xf0a5a){_0x381372=_0x381372-0x0;var _0x4e959a=_0xd920[_0x381372];return _0x4e959a;};'use strict';var _=require(_0x0d92('0x0'));var util=require('util');var logger=require(_0x0d92('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d92('0x2'));var rp=require(_0x0d92('0x3'));var fs=require('fs');var path=require(_0x0d92('0x4'));var rimraf=require('rimraf');var config=require(_0x0d92('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x31384e,_0x26a5dd){return _0x31384e[_0x0d92('0x6')](_0x0d92('0x7'),attributes,{'tableName':_0x0d92('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70a3=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x70a3,0x16e));var _0x370a=function(_0x698efe,_0x58754c){_0x698efe=_0x698efe-0x0;var _0x5ebcf4=_0x70a3[_0x698efe];return _0x5ebcf4;};'use strict';var _=require(_0x370a('0x0'));var util=require(_0x370a('0x1'));var logger=require(_0x370a('0x2'))(_0x370a('0x3'));var moment=require(_0x370a('0x4'));var BPromise=require(_0x370a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x370a('0x6'));var attributes=require(_0x370a('0x7'));module['exports']=function(_0x5929c2,_0x492f42){return _0x5929c2[_0x370a('0x8')](_0x370a('0x9'),attributes,{'tableName':_0x370a('0xa'),'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 9b2f799..11d8fd9 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 _0x1a81=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x34a374,_0x4224b2){var _0x4e5f90=function(_0x2ff709){while(--_0x2ff709){_0x34a374['push'](_0x34a374['shift']());}};_0x4e5f90(++_0x4224b2);}(_0x1a81,0x131));var _0x11a8=function(_0x2a7867,_0x5c8949){_0x2a7867=_0x2a7867-0x0;var _0x510fe3=_0x1a81[_0x2a7867];return _0x510fe3;};'use strict';var _=require(_0x11a8('0x0'));var util=require(_0x11a8('0x1'));var moment=require(_0x11a8('0x2'));var BPromise=require(_0x11a8('0x3'));var rs=require(_0x11a8('0x4'));var fs=require('fs');var Redis=require(_0x11a8('0x5'));var db=require(_0x11a8('0x6'))['db'];var utils=require(_0x11a8('0x7'));var logger=require(_0x11a8('0x8'))(_0x11a8('0x9'));var config=require(_0x11a8('0xa'));var jayson=require(_0x11a8('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d22bb,_0x5a1c66,_0x4f62b0){return new BPromise(function(_0x581bbf,_0x1b01db){return client['request'](_0x5d22bb,_0x4f62b0)[_0x11a8('0xc')](function(_0x369e78){logger[_0x11a8('0xd')](_0x11a8('0xe'),_0x5a1c66,_0x11a8('0xf'));logger['debug'](_0x11a8('0x10'),_0x5a1c66,_0x11a8('0xf'),JSON[_0x11a8('0x11')](_0x369e78));if(_0x369e78['error']){if(_0x369e78[_0x11a8('0x12')][_0x11a8('0x13')]===0x1f4){logger[_0x11a8('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a1c66,_0x369e78[_0x11a8('0x12')]['message']);return _0x1b01db(_0x369e78['error'][_0x11a8('0x14')]);}logger[_0x11a8('0x12')](_0x11a8('0xe'),_0x5a1c66,_0x369e78[_0x11a8('0x12')][_0x11a8('0x14')]);return _0x581bbf(_0x369e78[_0x11a8('0x12')]['message']);}else{logger[_0x11a8('0xd')](_0x11a8('0xe'),_0x5a1c66,'request\x20sent');_0x581bbf(_0x369e78[_0x11a8('0x15')][_0x11a8('0x14')]);}})[_0x11a8('0x16')](function(_0x536720){logger[_0x11a8('0x12')](_0x11a8('0xe'),_0x5a1c66,_0x536720);_0x1b01db(_0x536720);});});} \ No newline at end of file +var _0x984c=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3655dd,_0x339572){var _0x2d3cbb=function(_0xf3cd72){while(--_0xf3cd72){_0x3655dd['push'](_0x3655dd['shift']());}};_0x2d3cbb(++_0x339572);}(_0x984c,0xab));var _0xc984=function(_0x9f41fa,_0x526c0e){_0x9f41fa=_0x9f41fa-0x0;var _0x4096a4=_0x984c[_0x9f41fa];return _0x4096a4;};'use strict';var _=require(_0xc984('0x0'));var util=require('util');var moment=require(_0xc984('0x1'));var BPromise=require('bluebird');var rs=require(_0xc984('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc984('0x3'))['db'];var utils=require(_0xc984('0x4'));var logger=require('../../config/logger')(_0xc984('0x5'));var config=require(_0xc984('0x6'));var jayson=require(_0xc984('0x7'));var client=jayson[_0xc984('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546334,_0x42dcf9,_0x455465){return new BPromise(function(_0x3810d9,_0x378878){return client[_0xc984('0x9')](_0x546334,_0x455465)[_0xc984('0xa')](function(_0x28d1ab){logger[_0xc984('0xb')](_0xc984('0xc'),_0x42dcf9,_0xc984('0xd'));logger[_0xc984('0xe')](_0xc984('0xf'),_0x42dcf9,_0xc984('0xd'),JSON[_0xc984('0x10')](_0x28d1ab));if(_0x28d1ab[_0xc984('0x11')]){if(_0x28d1ab[_0xc984('0x11')][_0xc984('0x12')]===0x1f4){logger[_0xc984('0x11')](_0xc984('0xc'),_0x42dcf9,_0x28d1ab[_0xc984('0x11')][_0xc984('0x13')]);return _0x378878(_0x28d1ab['error'][_0xc984('0x13')]);}logger[_0xc984('0x11')](_0xc984('0xc'),_0x42dcf9,_0x28d1ab[_0xc984('0x11')][_0xc984('0x13')]);return _0x3810d9(_0x28d1ab[_0xc984('0x11')]['message']);}else{logger[_0xc984('0xb')](_0xc984('0xc'),_0x42dcf9,_0xc984('0xd'));_0x3810d9(_0x28d1ab['result'][_0xc984('0x13')]);}})['catch'](function(_0x133495){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x42dcf9,_0x133495);_0x378878(_0x133495);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4645639..584d029 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 _0x0c7f=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x39d3d9,_0xb00347){var _0x3859a6=function(_0x1a9576){while(--_0x1a9576){_0x39d3d9['push'](_0x39d3d9['shift']());}};_0x3859a6(++_0xb00347);}(_0x0c7f,0x156));var _0xf0c7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0c7f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xf0c7('0x0'));var path=require(_0xf0c7('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0c7('0x2'));var router=express[_0xf0c7('0x3')]();var fs_extra=require(_0xf0c7('0x4'));var auth=require(_0xf0c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf0c7('0x6'));var controller=require(_0xf0c7('0x7'));router[_0xf0c7('0x8')]('/',auth[_0xf0c7('0x9')](),controller[_0xf0c7('0xa')]);router['get'](_0xf0c7('0xb'),auth['isAuthenticated'](),controller[_0xf0c7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0c7('0xd')]);router[_0xf0c7('0xe')]('/:id',auth[_0xf0c7('0x9')](),controller[_0xf0c7('0xf')]);router[_0xf0c7('0x10')](_0xf0c7('0xb'),auth[_0xf0c7('0x9')](),controller[_0xf0c7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3b4b=['get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x514160,_0x4c988b){var _0x232f80=function(_0x419300){while(--_0x419300){_0x514160['push'](_0x514160['shift']());}};_0x232f80(++_0x4c988b);}(_0x3b4b,0x1ac));var _0xb3b4=function(_0x5b4737,_0xf1380b){_0x5b4737=_0x5b4737-0x0;var _0x244d3a=_0x3b4b[_0x5b4737];return _0x244d3a;};'use strict';var multer=require(_0xb3b4('0x0'));var util=require(_0xb3b4('0x1'));var path=require(_0xb3b4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3b4('0x3'));var router=express[_0xb3b4('0x4')]();var fs_extra=require(_0xb3b4('0x5'));var auth=require(_0xb3b4('0x6'));var interaction=require(_0xb3b4('0x7'));var config=require(_0xb3b4('0x8'));var controller=require('./intVtigerField.controller');router[_0xb3b4('0x9')]('/',auth[_0xb3b4('0xa')](),controller[_0xb3b4('0xb')]);router[_0xb3b4('0x9')](_0xb3b4('0xc'),auth[_0xb3b4('0xa')](),controller['show']);router[_0xb3b4('0xd')]('/',auth[_0xb3b4('0xa')](),controller[_0xb3b4('0xe')]);router[_0xb3b4('0xf')](_0xb3b4('0xc'),auth['isAuthenticated'](),controller[_0xb3b4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb3b4('0x11')]);module[_0xb3b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d63dd0b..a98d1b4 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 _0x3578=['customVariable','BOOLEAN','exports','string','keyValue','picklist','STRING','ENUM'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x3578,0xda));var _0x8357=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x3578[_0x589f71];return _0x5763bd;};'use strict';var Sequelize=require('sequelize');module[_0x8357('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8357('0x1'),'variable','customVariable',_0x8357('0x2'),_0x8357('0x3')),'defaultValue':_0x8357('0x1')},'content':{'type':Sequelize[_0x8357('0x4')]},'key':{'type':Sequelize[_0x8357('0x4')]},'keyType':{'type':Sequelize[_0x8357('0x5')]('string','variable',_0x8357('0x6'))},'keyContent':{'type':Sequelize[_0x8357('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8357('0x4')]},'customField':{'type':Sequelize[_0x8357('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8357('0x4')]}}; \ No newline at end of file +var _0x100b=['BOOLEAN','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x8cb770,_0x4c84e0){var _0x4503ac=function(_0x3ab0ac){while(--_0x3ab0ac){_0x8cb770['push'](_0x8cb770['shift']());}};_0x4503ac(++_0x4c84e0);}(_0x100b,0x119));var _0xb100=function(_0x466413,_0x3cd9b9){_0x466413=_0x466413-0x0;var _0x252d2a=_0x100b[_0x466413];return _0x252d2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb100('0x0')](_0xb100('0x1'),'variable',_0xb100('0x2'),_0xb100('0x3'),_0xb100('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb100('0x5')]},'key':{'type':Sequelize[_0xb100('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb100('0x6'),_0xb100('0x2'))},'keyContent':{'type':Sequelize[_0xb100('0x5')]},'idField':{'type':Sequelize[_0xb100('0x5')]},'nameField':{'type':Sequelize[_0xb100('0x5')]},'customField':{'type':Sequelize[_0xb100('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 62953a8..d7b12ec 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 _0xa0c1=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','body','find','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','VtigerField'];(function(_0x2d7e3d,_0x31168f){var _0xcea7e2=function(_0x320c1d){while(--_0x320c1d){_0x2d7e3d['push'](_0x2d7e3d['shift']());}};_0xcea7e2(++_0x31168f);}(_0xa0c1,0x1c6));var _0x1a0c=function(_0x5dc0a5,_0x5c032e){_0x5dc0a5=_0x5dc0a5-0x0;var _0x1b976f=_0xa0c1[_0x5dc0a5];return _0x1b976f;};'use strict';var emlformat=require(_0x1a0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a0c('0x3'));var util=require(_0x1a0c('0x4'));var path=require(_0x1a0c('0x5'));var sox=require(_0x1a0c('0x6'));var csv=require(_0x1a0c('0x7'));var ejs=require(_0x1a0c('0x8'));var fs=require('fs');var fs_extra=require(_0x1a0c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a0c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1a0c('0x7'));var querystring=require(_0x1a0c('0xb'));var Papa=require(_0x1a0c('0xc'));var Redis=require(_0x1a0c('0xd'));var authService=require(_0x1a0c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1a0c('0xf'));var hardwareService=require(_0x1a0c('0x10'));var logger=require(_0x1a0c('0x11'))(_0x1a0c('0x12'));var utils=require(_0x1a0c('0x13'));var config=require(_0x1a0c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a0c('0x15'))['db'];function respondWithStatusCode(_0x158ff9,_0x3f1d82){_0x3f1d82=_0x3f1d82||0xcc;return function(_0x423dec){if(_0x423dec){return _0x158ff9[_0x1a0c('0x16')](_0x3f1d82);}return _0x158ff9[_0x1a0c('0x17')](_0x3f1d82)[_0x1a0c('0x18')]();};}function respondWithResult(_0x475c8b,_0x1f6e7d){_0x1f6e7d=_0x1f6e7d||0xc8;return function(_0x5d50bb){if(_0x5d50bb){return _0x475c8b[_0x1a0c('0x17')](_0x1f6e7d)[_0x1a0c('0x19')](_0x5d50bb);}};}function respondWithFilteredResult(_0x35454b,_0x1a4761){return function(_0x1edf90){if(_0x1edf90){var _0x4c4ef2=typeof _0x1a4761['offset']==='undefined'&&typeof _0x1a4761[_0x1a0c('0x1a')]===_0x1a0c('0x1b');var _0x259401=_0x1edf90[_0x1a0c('0x1c')];var _0x2f0f22=_0x4c4ef2?0x0:_0x1a4761[_0x1a0c('0x1d')];var _0x30f835=_0x4c4ef2?_0x1edf90[_0x1a0c('0x1c')]:_0x1a4761[_0x1a0c('0x1d')]+_0x1a4761[_0x1a0c('0x1a')];var _0x611de1;if(_0x30f835>=_0x259401){_0x30f835=_0x259401;_0x611de1=0xc8;}else{_0x611de1=0xce;}_0x35454b[_0x1a0c('0x17')](_0x611de1);return _0x35454b[_0x1a0c('0x1e')](_0x1a0c('0x1f'),_0x2f0f22+'-'+_0x30f835+'/'+_0x259401)['json'](_0x1edf90);}return null;};}function patchUpdates(_0x3cad30){return function(_0x1844ea){try{jsonpatch[_0x1a0c('0x20')](_0x1844ea,_0x3cad30,!![]);}catch(_0x1581ce){return BPromise[_0x1a0c('0x21')](_0x1581ce);}return _0x1844ea['save']();};}function saveUpdates(_0x1fdb8a,_0x33e8b4){return function(_0xdb4962){if(_0xdb4962){return _0xdb4962[_0x1a0c('0x22')](_0x1fdb8a)['then'](function(_0x24e4f5){return _0x24e4f5;});}return null;};}function removeEntity(_0x2b6936,_0xd0c507){return function(_0x498318){if(_0x498318){return _0x498318[_0x1a0c('0x23')]()[_0x1a0c('0x24')](function(){_0x2b6936['status'](0xcc)[_0x1a0c('0x18')]();});}};}function handleEntityNotFound(_0x3325c0,_0x47f8a1){return function(_0x4733a7){if(!_0x4733a7){_0x3325c0['sendStatus'](0x194);}return _0x4733a7;};}function handleError(_0x1a8d4b,_0x36009c){_0x36009c=_0x36009c||0x1f4;return function(_0x128dd9){logger[_0x1a0c('0x25')](_0x128dd9[_0x1a0c('0x26')]);if(_0x128dd9[_0x1a0c('0x27')]){delete _0x128dd9['name'];}_0x1a8d4b[_0x1a0c('0x17')](_0x36009c)['send'](_0x128dd9);};}exports[_0x1a0c('0x28')]=function(_0x4e05fc,_0x3e7e49){var _0x350165={},_0x1ff82a={},_0x2e804d={'count':0x0,'rows':[]};var _0x36bd5c=_[_0x1a0c('0x29')](db[_0x1a0c('0x2a')][_0x1a0c('0x2b')],function(_0x5abae5){return{'name':_0x5abae5[_0x1a0c('0x2c')],'type':_0x5abae5[_0x1a0c('0x2d')][_0x1a0c('0x2e')]};});_0x1ff82a[_0x1a0c('0x2f')]=_[_0x1a0c('0x29')](_0x36bd5c,_0x1a0c('0x27'));_0x1ff82a[_0x1a0c('0x30')]=_[_0x1a0c('0x31')](_0x4e05fc[_0x1a0c('0x30')]);_0x1ff82a['filters']=_[_0x1a0c('0x32')](_0x1ff82a[_0x1a0c('0x2f')],_0x1ff82a[_0x1a0c('0x30')]);_0x350165[_0x1a0c('0x33')]=_[_0x1a0c('0x32')](_0x1ff82a['model'],qs[_0x1a0c('0x34')](_0x4e05fc['query'][_0x1a0c('0x34')]));_0x350165[_0x1a0c('0x33')]=_0x350165[_0x1a0c('0x33')][_0x1a0c('0x35')]?_0x350165[_0x1a0c('0x33')]:_0x1ff82a[_0x1a0c('0x2f')];if(!_0x4e05fc[_0x1a0c('0x30')][_0x1a0c('0x36')](_0x1a0c('0x37'))){_0x350165[_0x1a0c('0x1a')]=qs['limit'](_0x4e05fc[_0x1a0c('0x30')][_0x1a0c('0x1a')]);_0x350165[_0x1a0c('0x1d')]=qs[_0x1a0c('0x1d')](_0x4e05fc['query'][_0x1a0c('0x1d')]);}_0x350165[_0x1a0c('0x38')]=qs['sort'](_0x4e05fc[_0x1a0c('0x30')][_0x1a0c('0x39')]);_0x350165[_0x1a0c('0x3a')]=qs[_0x1a0c('0x3b')](_['pick'](_0x4e05fc[_0x1a0c('0x30')],_0x1ff82a[_0x1a0c('0x3b')]),_0x36bd5c);if(_0x4e05fc['query'][_0x1a0c('0x3c')]){_0x350165[_0x1a0c('0x3a')]=_['merge'](_0x350165['where'],{'$or':_[_0x1a0c('0x29')](_0x36bd5c,function(_0x1bfd65){if(_0x1bfd65[_0x1a0c('0x2d')]!==_0x1a0c('0x3d')){var _0x24910e={};_0x24910e[_0x1bfd65[_0x1a0c('0x27')]]={'$like':'%'+_0x4e05fc[_0x1a0c('0x30')][_0x1a0c('0x3c')]+'%'};return _0x24910e;}})});}_0x350165=_['merge']({},_0x350165,_0x4e05fc[_0x1a0c('0x3e')]);var _0x3b9644={'where':_0x350165[_0x1a0c('0x3a')]};return db[_0x1a0c('0x2a')][_0x1a0c('0x1c')](_0x3b9644)[_0x1a0c('0x24')](function(_0x5b73f3){_0x2e804d['count']=_0x5b73f3;if(_0x4e05fc[_0x1a0c('0x30')]['includeAll']){_0x350165[_0x1a0c('0x3f')]=[{'all':!![]}];}return db[_0x1a0c('0x2a')][_0x1a0c('0x40')](_0x350165);})[_0x1a0c('0x24')](function(_0x2e0357){_0x2e804d[_0x1a0c('0x41')]=_0x2e0357;return _0x2e804d;})['then'](respondWithFilteredResult(_0x3e7e49,_0x350165))[_0x1a0c('0x42')](handleError(_0x3e7e49,null));};exports['show']=function(_0x2b014c,_0x22bf16){var _0x27aaf0={'raw':!![],'where':{'id':_0x2b014c[_0x1a0c('0x43')]['id']}},_0x9d7e70={};_0x9d7e70[_0x1a0c('0x2f')]=_[_0x1a0c('0x31')](db[_0x1a0c('0x2a')][_0x1a0c('0x2b')]);_0x9d7e70[_0x1a0c('0x30')]=_['keys'](_0x2b014c[_0x1a0c('0x30')]);_0x9d7e70[_0x1a0c('0x3b')]=_['intersection'](_0x9d7e70['model'],_0x9d7e70[_0x1a0c('0x30')]);_0x27aaf0[_0x1a0c('0x33')]=_[_0x1a0c('0x32')](_0x9d7e70['model'],qs[_0x1a0c('0x34')](_0x2b014c['query'][_0x1a0c('0x34')]));_0x27aaf0[_0x1a0c('0x33')]=_0x27aaf0[_0x1a0c('0x33')][_0x1a0c('0x35')]?_0x27aaf0[_0x1a0c('0x33')]:_0x9d7e70[_0x1a0c('0x2f')];if(_0x2b014c[_0x1a0c('0x30')][_0x1a0c('0x44')]){_0x27aaf0['include']=[{'all':!![]}];}_0x27aaf0=_['merge']({},_0x27aaf0,_0x2b014c[_0x1a0c('0x3e')]);return db['VtigerField']['find'](_0x27aaf0)[_0x1a0c('0x24')](handleEntityNotFound(_0x22bf16,null))[_0x1a0c('0x24')](respondWithResult(_0x22bf16,null))[_0x1a0c('0x42')](handleError(_0x22bf16,null));};exports['create']=function(_0x3062b4,_0x5ec084){return db['VtigerField']['create'](_0x3062b4[_0x1a0c('0x45')],{})['then'](respondWithResult(_0x5ec084,0xc9))[_0x1a0c('0x42')](handleError(_0x5ec084,null));};exports[_0x1a0c('0x22')]=function(_0x17e00f,_0x4ece03){if(_0x17e00f[_0x1a0c('0x45')]['id']){delete _0x17e00f['body']['id'];}return db[_0x1a0c('0x2a')]['find']({'where':{'id':_0x17e00f[_0x1a0c('0x43')]['id']}})[_0x1a0c('0x24')](handleEntityNotFound(_0x4ece03,null))[_0x1a0c('0x24')](saveUpdates(_0x17e00f[_0x1a0c('0x45')],null))['then'](respondWithResult(_0x4ece03,null))[_0x1a0c('0x42')](handleError(_0x4ece03,null));};exports[_0x1a0c('0x23')]=function(_0x116b69,_0x3ad17b){return db[_0x1a0c('0x2a')][_0x1a0c('0x46')]({'where':{'id':_0x116b69[_0x1a0c('0x43')]['id']}})[_0x1a0c('0x24')](handleEntityNotFound(_0x3ad17b,null))[_0x1a0c('0x24')](removeEntity(_0x3ad17b,null))[_0x1a0c('0x42')](handleError(_0x3ad17b,null));}; \ No newline at end of file +var _0x14e5=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerField','include','findAll','rows','show','keys','includeAll','create','body','catch','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0x14e5,0xd5));var _0x514e=function(_0x3168e1,_0xa046e0){_0x3168e1=_0x3168e1-0x0;var _0x13ad69=_0x14e5[_0x3168e1];return _0x13ad69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x514e('0x0'));var zipdir=require(_0x514e('0x1'));var jsonpatch=require(_0x514e('0x2'));var rp=require(_0x514e('0x3'));var moment=require(_0x514e('0x4'));var BPromise=require(_0x514e('0x5'));var Mustache=require(_0x514e('0x6'));var util=require(_0x514e('0x7'));var path=require(_0x514e('0x8'));var sox=require(_0x514e('0x9'));var csv=require(_0x514e('0xa'));var ejs=require(_0x514e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x514e('0xc'));var squel=require('squel');var crypto=require(_0x514e('0xd'));var jsforce=require(_0x514e('0xe'));var deskjs=require(_0x514e('0xf'));var toCsv=require(_0x514e('0xa'));var querystring=require(_0x514e('0x10'));var Papa=require(_0x514e('0x11'));var Redis=require(_0x514e('0x12'));var authService=require(_0x514e('0x13'));var qs=require(_0x514e('0x14'));var as=require(_0x514e('0x15'));var hardwareService=require(_0x514e('0x16'));var logger=require(_0x514e('0x17'))(_0x514e('0x18'));var utils=require(_0x514e('0x19'));var config=require(_0x514e('0x1a'));var licenseUtil=require(_0x514e('0x1b'));var db=require(_0x514e('0x1c'))['db'];function respondWithStatusCode(_0x5c00a0,_0x2f25d7){_0x2f25d7=_0x2f25d7||0xcc;return function(_0x34e104){if(_0x34e104){return _0x5c00a0[_0x514e('0x1d')](_0x2f25d7);}return _0x5c00a0[_0x514e('0x1e')](_0x2f25d7)['end']();};}function respondWithResult(_0x40bbc2,_0x58a768){_0x58a768=_0x58a768||0xc8;return function(_0x566ddf){if(_0x566ddf){return _0x40bbc2[_0x514e('0x1e')](_0x58a768)['json'](_0x566ddf);}};}function respondWithFilteredResult(_0x2a0ae4,_0x5f4193){return function(_0x31b556){if(_0x31b556){var _0x5e4a28=typeof _0x5f4193[_0x514e('0x1f')]==='undefined'&&typeof _0x5f4193[_0x514e('0x20')]===_0x514e('0x21');var _0xf33bd2=_0x31b556[_0x514e('0x22')];var _0xf90424=_0x5e4a28?0x0:_0x5f4193['offset'];var _0x4a03e8=_0x5e4a28?_0x31b556[_0x514e('0x22')]:_0x5f4193[_0x514e('0x1f')]+_0x5f4193[_0x514e('0x20')];var _0x2d6b67;if(_0x4a03e8>=_0xf33bd2){_0x4a03e8=_0xf33bd2;_0x2d6b67=0xc8;}else{_0x2d6b67=0xce;}_0x2a0ae4['status'](_0x2d6b67);return _0x2a0ae4[_0x514e('0x23')](_0x514e('0x24'),_0xf90424+'-'+_0x4a03e8+'/'+_0xf33bd2)[_0x514e('0x25')](_0x31b556);}return null;};}function patchUpdates(_0x1103ad){return function(_0x32ce79){try{jsonpatch[_0x514e('0x26')](_0x32ce79,_0x1103ad,!![]);}catch(_0x3f8959){return BPromise[_0x514e('0x27')](_0x3f8959);}return _0x32ce79[_0x514e('0x28')]();};}function saveUpdates(_0x20dd3f,_0x538869){return function(_0x5a4228){if(_0x5a4228){return _0x5a4228[_0x514e('0x29')](_0x20dd3f)[_0x514e('0x2a')](function(_0x353700){return _0x353700;});}return null;};}function removeEntity(_0x2a7bc9,_0x497297){return function(_0x147177){if(_0x147177){return _0x147177['destroy']()[_0x514e('0x2a')](function(){_0x2a7bc9[_0x514e('0x1e')](0xcc)[_0x514e('0x2b')]();});}};}function handleEntityNotFound(_0x2f108f,_0x5caacf){return function(_0x15f07f){if(!_0x15f07f){_0x2f108f[_0x514e('0x1d')](0x194);}return _0x15f07f;};}function handleError(_0x3e4057,_0x58c585){_0x58c585=_0x58c585||0x1f4;return function(_0x582df3){logger[_0x514e('0x2c')](_0x582df3[_0x514e('0x2d')]);if(_0x582df3[_0x514e('0x2e')]){delete _0x582df3[_0x514e('0x2e')];}_0x3e4057[_0x514e('0x1e')](_0x58c585)[_0x514e('0x2f')](_0x582df3);};}exports[_0x514e('0x30')]=function(_0x2b67a6,_0x1a2547){var _0x120ee0={},_0xead0d6={},_0x2074b2={'count':0x0,'rows':[]};var _0x4cafb5=_[_0x514e('0x31')](db['VtigerField'][_0x514e('0x32')],function(_0x3aabbb){return{'name':_0x3aabbb[_0x514e('0x33')],'type':_0x3aabbb[_0x514e('0x34')][_0x514e('0x35')]};});_0xead0d6['model']=_[_0x514e('0x31')](_0x4cafb5,'name');_0xead0d6[_0x514e('0x36')]=_['keys'](_0x2b67a6[_0x514e('0x36')]);_0xead0d6[_0x514e('0x37')]=_[_0x514e('0x38')](_0xead0d6[_0x514e('0x39')],_0xead0d6['query']);_0x120ee0[_0x514e('0x3a')]=_[_0x514e('0x38')](_0xead0d6[_0x514e('0x39')],qs[_0x514e('0x3b')](_0x2b67a6[_0x514e('0x36')][_0x514e('0x3b')]));_0x120ee0[_0x514e('0x3a')]=_0x120ee0[_0x514e('0x3a')][_0x514e('0x3c')]?_0x120ee0[_0x514e('0x3a')]:_0xead0d6[_0x514e('0x39')];if(!_0x2b67a6[_0x514e('0x36')][_0x514e('0x3d')](_0x514e('0x3e'))){_0x120ee0['limit']=qs[_0x514e('0x20')](_0x2b67a6[_0x514e('0x36')][_0x514e('0x20')]);_0x120ee0[_0x514e('0x1f')]=qs['offset'](_0x2b67a6[_0x514e('0x36')][_0x514e('0x1f')]);}_0x120ee0[_0x514e('0x3f')]=qs[_0x514e('0x40')](_0x2b67a6[_0x514e('0x36')][_0x514e('0x40')]);_0x120ee0[_0x514e('0x41')]=qs[_0x514e('0x37')](_['pick'](_0x2b67a6[_0x514e('0x36')],_0xead0d6['filters']),_0x4cafb5);if(_0x2b67a6[_0x514e('0x36')][_0x514e('0x42')]){_0x120ee0[_0x514e('0x41')]=_[_0x514e('0x43')](_0x120ee0['where'],{'$or':_[_0x514e('0x31')](_0x4cafb5,function(_0xc72d1c){if(_0xc72d1c[_0x514e('0x34')]!==_0x514e('0x44')){var _0x526d93={};_0x526d93[_0xc72d1c['name']]={'$like':'%'+_0x2b67a6[_0x514e('0x36')][_0x514e('0x42')]+'%'};return _0x526d93;}})});}_0x120ee0=_[_0x514e('0x43')]({},_0x120ee0,_0x2b67a6[_0x514e('0x45')]);var _0x391b4e={'where':_0x120ee0[_0x514e('0x41')]};return db[_0x514e('0x46')]['count'](_0x391b4e)[_0x514e('0x2a')](function(_0x576c6a){_0x2074b2[_0x514e('0x22')]=_0x576c6a;if(_0x2b67a6[_0x514e('0x36')]['includeAll']){_0x120ee0[_0x514e('0x47')]=[{'all':!![]}];}return db[_0x514e('0x46')][_0x514e('0x48')](_0x120ee0);})[_0x514e('0x2a')](function(_0x415d48){_0x2074b2[_0x514e('0x49')]=_0x415d48;return _0x2074b2;})[_0x514e('0x2a')](respondWithFilteredResult(_0x1a2547,_0x120ee0))['catch'](handleError(_0x1a2547,null));};exports[_0x514e('0x4a')]=function(_0x23f939,_0x488c37){var _0x3893d1={'raw':!![],'where':{'id':_0x23f939['params']['id']}},_0x69dc15={};_0x69dc15[_0x514e('0x39')]=_[_0x514e('0x4b')](db[_0x514e('0x46')]['rawAttributes']);_0x69dc15[_0x514e('0x36')]=_[_0x514e('0x4b')](_0x23f939['query']);_0x69dc15[_0x514e('0x37')]=_['intersection'](_0x69dc15[_0x514e('0x39')],_0x69dc15[_0x514e('0x36')]);_0x3893d1[_0x514e('0x3a')]=_[_0x514e('0x38')](_0x69dc15['model'],qs[_0x514e('0x3b')](_0x23f939[_0x514e('0x36')][_0x514e('0x3b')]));_0x3893d1[_0x514e('0x3a')]=_0x3893d1[_0x514e('0x3a')][_0x514e('0x3c')]?_0x3893d1[_0x514e('0x3a')]:_0x69dc15[_0x514e('0x39')];if(_0x23f939[_0x514e('0x36')][_0x514e('0x4c')]){_0x3893d1['include']=[{'all':!![]}];}_0x3893d1=_[_0x514e('0x43')]({},_0x3893d1,_0x23f939['options']);return db[_0x514e('0x46')]['find'](_0x3893d1)[_0x514e('0x2a')](handleEntityNotFound(_0x488c37,null))['then'](respondWithResult(_0x488c37,null))['catch'](handleError(_0x488c37,null));};exports[_0x514e('0x4d')]=function(_0x460e5c,_0x573e72){return db[_0x514e('0x46')][_0x514e('0x4d')](_0x460e5c[_0x514e('0x4e')],{})[_0x514e('0x2a')](respondWithResult(_0x573e72,0xc9))[_0x514e('0x4f')](handleError(_0x573e72,null));};exports['update']=function(_0x300e57,_0x8b679b){if(_0x300e57['body']['id']){delete _0x300e57['body']['id'];}return db['VtigerField'][_0x514e('0x50')]({'where':{'id':_0x300e57['params']['id']}})['then'](handleEntityNotFound(_0x8b679b,null))['then'](saveUpdates(_0x300e57[_0x514e('0x4e')],null))[_0x514e('0x2a')](respondWithResult(_0x8b679b,null))['catch'](handleError(_0x8b679b,null));};exports['destroy']=function(_0x33756b,_0x20d1ac){return db[_0x514e('0x46')][_0x514e('0x50')]({'where':{'id':_0x33756b[_0x514e('0x51')]['id']}})[_0x514e('0x2a')](handleEntityNotFound(_0x20d1ac,null))[_0x514e('0x2a')](removeEntity(_0x20d1ac,null))[_0x514e('0x4f')](handleError(_0x20d1ac,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ac43a36..a5f62de 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 _0x28dd=['VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x28dd,0x8d));var _0xd28d=function(_0x3b4922,_0x2fa365){_0x3b4922=_0x3b4922-0x0;var _0x239729=_0x28dd[_0x3b4922];return _0x239729;};'use strict';var _=require(_0xd28d('0x0'));var util=require(_0xd28d('0x1'));var logger=require(_0xd28d('0x2'))(_0xd28d('0x3'));var moment=require(_0xd28d('0x4'));var BPromise=require(_0xd28d('0x5'));var rp=require(_0xd28d('0x6'));var fs=require('fs');var path=require(_0xd28d('0x7'));var rimraf=require(_0xd28d('0x8'));var config=require(_0xd28d('0x9'));var attributes=require('./intVtigerField.attributes');module[_0xd28d('0xa')]=function(_0x1debe9,_0x167400){return _0x1debe9[_0xd28d('0xb')](_0xd28d('0xc'),attributes,{'tableName':_0xd28d('0xd'),'paranoid':![],'indexes':[{'name':_0xd28d('0xe'),'fields':[_0xd28d('0xf'),_0xd28d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36e6=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','api','moment','path','../../config/environment','exports','VtigerField'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x36e6,0x88));var _0x636e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x36e6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x636e('0x0'));var logger=require('../../config/logger')(_0x636e('0x1'));var moment=require(_0x636e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x636e('0x3'));var rimraf=require('rimraf');var config=require(_0x636e('0x4'));var attributes=require('./intVtigerField.attributes');module[_0x636e('0x5')]=function(_0x3aefa0,_0x43ec9a){return _0x3aefa0['define'](_0x636e('0x6'),attributes,{'tableName':_0x636e('0x7'),'paranoid':![],'indexes':[{'name':_0x636e('0x8'),'fields':[_0x636e('0x9'),_0x636e('0xa')],'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 5b2d2d4..0241f8b 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 _0x8030=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0x8030,0x185));var _0x0803=function(_0x115997,_0x328acc){_0x115997=_0x115997-0x0;var _0x4fbe83=_0x8030[_0x115997];return _0x4fbe83;};'use strict';var _=require(_0x0803('0x0'));var util=require(_0x0803('0x1'));var moment=require(_0x0803('0x2'));var BPromise=require('bluebird');var rs=require(_0x0803('0x3'));var fs=require('fs');var Redis=require(_0x0803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0803('0x5'));var logger=require(_0x0803('0x6'))(_0x0803('0x7'));var config=require(_0x0803('0x8'));var jayson=require(_0x0803('0x9'));var client=jayson[_0x0803('0xa')][_0x0803('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38ff22,_0xdd803a,_0x16b13b){return new BPromise(function(_0x338f47,_0x4cc958){return client['request'](_0x38ff22,_0x16b13b)[_0x0803('0xc')](function(_0x2c7b71){logger[_0x0803('0xd')](_0x0803('0xe'),_0xdd803a,_0x0803('0xf'));logger[_0x0803('0x10')](_0x0803('0x11'),_0xdd803a,_0x0803('0xf'),JSON[_0x0803('0x12')](_0x2c7b71));if(_0x2c7b71[_0x0803('0x13')]){if(_0x2c7b71[_0x0803('0x13')][_0x0803('0x14')]===0x1f4){logger[_0x0803('0x13')]('VtigerField,\x20%s,\x20%s',_0xdd803a,_0x2c7b71[_0x0803('0x13')][_0x0803('0x15')]);return _0x4cc958(_0x2c7b71[_0x0803('0x13')]['message']);}logger[_0x0803('0x13')](_0x0803('0xe'),_0xdd803a,_0x2c7b71[_0x0803('0x13')][_0x0803('0x15')]);return _0x338f47(_0x2c7b71[_0x0803('0x13')][_0x0803('0x15')]);}else{logger['info'](_0x0803('0xe'),_0xdd803a,_0x0803('0xf'));_0x338f47(_0x2c7b71[_0x0803('0x16')][_0x0803('0x15')]);}})[_0x0803('0x17')](function(_0x23f2c4){logger[_0x0803('0x13')](_0x0803('0xe'),_0xdd803a,_0x23f2c4);_0x4cc958(_0x23f2c4);});});} \ No newline at end of file +var _0x8121=['message','VtigerField,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a0372,_0xc8b2b3){var _0x1a79f2=function(_0x52b6f1){while(--_0x52b6f1){_0x4a0372['push'](_0x4a0372['shift']());}};_0x1a79f2(++_0xc8b2b3);}(_0x8121,0xf3));var _0x1812=function(_0x23bfba,_0x4354db){_0x23bfba=_0x23bfba-0x0;var _0x5ccba0=_0x8121[_0x23bfba];return _0x5ccba0;};'use strict';var _=require(_0x1812('0x0'));var util=require(_0x1812('0x1'));var moment=require(_0x1812('0x2'));var BPromise=require('bluebird');var rs=require(_0x1812('0x3'));var fs=require('fs');var Redis=require(_0x1812('0x4'));var db=require(_0x1812('0x5'))['db'];var utils=require(_0x1812('0x6'));var logger=require(_0x1812('0x7'))(_0x1812('0x8'));var config=require('../../config/environment');var jayson=require(_0x1812('0x9'));var client=jayson[_0x1812('0xa')][_0x1812('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f9e6,_0xf4449e,_0x24412f){return new BPromise(function(_0x52b0c6,_0x5f30e1){return client[_0x1812('0xc')](_0x21f9e6,_0x24412f)[_0x1812('0xd')](function(_0x249b3b){logger[_0x1812('0xe')]('VtigerField,\x20%s,\x20%s',_0xf4449e,_0x1812('0xf'));logger[_0x1812('0x10')](_0x1812('0x11'),_0xf4449e,_0x1812('0xf'),JSON[_0x1812('0x12')](_0x249b3b));if(_0x249b3b[_0x1812('0x13')]){if(_0x249b3b[_0x1812('0x13')][_0x1812('0x14')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0xf4449e,_0x249b3b[_0x1812('0x13')][_0x1812('0x15')]);return _0x5f30e1(_0x249b3b[_0x1812('0x13')][_0x1812('0x15')]);}logger[_0x1812('0x13')](_0x1812('0x16'),_0xf4449e,_0x249b3b[_0x1812('0x13')][_0x1812('0x15')]);return _0x52b0c6(_0x249b3b['error']['message']);}else{logger[_0x1812('0xe')](_0x1812('0x16'),_0xf4449e,_0x1812('0xf'));_0x52b0c6(_0x249b3b[_0x1812('0x17')]['message']);}})['catch'](function(_0x3a8c63){logger[_0x1812('0x13')](_0x1812('0x16'),_0xf4449e,_0x3a8c63);_0x5f30e1(_0x3a8c63);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cfbcee3..e079201 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 _0xa935=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa935,0x8a));var _0x5a93=function(_0x2b10b5,_0x5c1f2e){_0x2b10b5=_0x2b10b5-0x0;var _0x545669=_0xa935[_0x2b10b5];return _0x545669;};'use strict';var multer=require('multer');var util=require(_0x5a93('0x0'));var path=require(_0x5a93('0x1'));var timeout=require(_0x5a93('0x2'));var express=require(_0x5a93('0x3'));var router=express[_0x5a93('0x4')]();var fs_extra=require(_0x5a93('0x5'));var auth=require(_0x5a93('0x6'));var interaction=require(_0x5a93('0x7'));var config=require(_0x5a93('0x8'));var controller=require(_0x5a93('0x9'));router[_0x5a93('0xa')]('/',auth['isAuthenticated'](),controller[_0x5a93('0xb')]);router[_0x5a93('0xa')](_0x5a93('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5a93('0xa')](_0x5a93('0xd'),auth[_0x5a93('0xe')](),controller[_0x5a93('0xf')]);router[_0x5a93('0xa')](_0x5a93('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x5a93('0x11')]('/',auth[_0x5a93('0xe')](),controller['create']);router[_0x5a93('0x11')](_0x5a93('0xd'),auth[_0x5a93('0xe')](),controller[_0x5a93('0x12')]);router[_0x5a93('0x13')]('/:id',auth[_0x5a93('0xe')](),controller[_0x5a93('0x14')]);router[_0x5a93('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5a93('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdc68=['getConfigurations','getFields','post','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x21c2d5,_0x33db57){var _0x1b1165=function(_0x3d1695){while(--_0x3d1695){_0x21c2d5['push'](_0x21c2d5['shift']());}};_0x1b1165(++_0x33db57);}(_0xdc68,0x1d7));var _0x8dc6=function(_0x1dc8b5,_0x37e337){_0x1dc8b5=_0x1dc8b5-0x0;var _0x173646=_0xdc68[_0x1dc8b5];return _0x173646;};'use strict';var multer=require(_0x8dc6('0x0'));var util=require(_0x8dc6('0x1'));var path=require('path');var timeout=require(_0x8dc6('0x2'));var express=require(_0x8dc6('0x3'));var router=express[_0x8dc6('0x4')]();var fs_extra=require(_0x8dc6('0x5'));var auth=require(_0x8dc6('0x6'));var interaction=require(_0x8dc6('0x7'));var config=require('../../config/environment');var controller=require(_0x8dc6('0x8'));router[_0x8dc6('0x9')]('/',auth[_0x8dc6('0xa')](),controller[_0x8dc6('0xb')]);router[_0x8dc6('0x9')](_0x8dc6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8dc6('0x9')]('/:id/configurations',auth[_0x8dc6('0xa')](),controller[_0x8dc6('0xd')]);router[_0x8dc6('0x9')]('/:id/fields',auth[_0x8dc6('0xa')](),controller[_0x8dc6('0xe')]);router[_0x8dc6('0xf')]('/',auth[_0x8dc6('0xa')](),controller['create']);router[_0x8dc6('0xf')](_0x8dc6('0x10'),auth[_0x8dc6('0xa')](),controller[_0x8dc6('0x11')]);router['put'](_0x8dc6('0xc'),auth[_0x8dc6('0xa')](),controller[_0x8dc6('0x12')]);router[_0x8dc6('0x13')](_0x8dc6('0xc'),auth[_0x8dc6('0xa')](),controller[_0x8dc6('0x14')]);module[_0x8dc6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d5c025a..6307ad2 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 _0x9e6d=['integrationTab','newTab','sequelize','STRING','remoteUri','password','token','ENUM'];(function(_0x16dcc2,_0x1323f2){var _0x41d2ef=function(_0x4b3085){while(--_0x4b3085){_0x16dcc2['push'](_0x16dcc2['shift']());}};_0x41d2ef(++_0x1323f2);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0xa9d2c9,_0x2a2cea){_0xa9d2c9=_0xa9d2c9-0x0;var _0x2e061a=_0x9e6d[_0xa9d2c9];return _0x2e061a;};'use strict';var Sequelize=require(_0xd9e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9e6('0x1')]},'description':{'type':Sequelize[_0xd9e6('0x1')]},'username':{'type':Sequelize[_0xd9e6('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd9e6('0x1')]},'token':{'type':Sequelize[_0xd9e6('0x1')]},'remoteUri':{'type':Sequelize[_0xd9e6('0x1')],'unique':_0xd9e6('0x2')},'authType':{'type':Sequelize['ENUM'](_0xd9e6('0x3'),_0xd9e6('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd9e6('0x5')](_0xd9e6('0x6'),_0xd9e6('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd1ca=['sequelize','exports','username','STRING','remoteUri','token','password','integrationTab'];(function(_0x59b093,_0x27c4a2){var _0xffd8d5=function(_0x1dcb79){while(--_0x1dcb79){_0x59b093['push'](_0x59b093['shift']());}};_0xffd8d5(++_0x27c4a2);}(_0xd1ca,0x140));var _0xad1c=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xd1ca[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0xad1c('0x0'));module[_0xad1c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xad1c('0x2')},'password':{'type':Sequelize[_0xad1c('0x3')]},'token':{'type':Sequelize[_0xad1c('0x3')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xad1c('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xad1c('0x5')),'defaultValue':_0xad1c('0x6')},'serverUrl':{'type':Sequelize[_0xad1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xad1c('0x7'),'newTab'),'defaultValue':_0xad1c('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0ebcff4..23cee1f 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 _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x5423,0xe3));var _0x3542=function(_0xa41d00,_0x44f46b){_0xa41d00=_0xa41d00-0x0;var _0x2a9b0b=_0x5423[_0xa41d00];return _0x2a9b0b;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file +var _0xb688=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','create','params','body','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','getFields','username','password','token','remoteUri','slice','substring','%s/%s','authType','format','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xb688,0xcf));var _0x8b68=function(_0x576dc3,_0x5ef0b8){_0x576dc3=_0x576dc3-0x0;var _0x2e55a6=_0xb688[_0x576dc3];return _0x2e55a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var integrations=require(_0x8b68('0x1b'));function respondWithStatusCode(_0x2f3af4,_0xaa8725){_0xaa8725=_0xaa8725||0xcc;return function(_0x137c8e){if(_0x137c8e){return _0x2f3af4[_0x8b68('0x1c')](_0xaa8725);}return _0x2f3af4['status'](_0xaa8725)[_0x8b68('0x1d')]();};}function respondWithResult(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xc8;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x1e')](_0x5e3c66)[_0x8b68('0x1f')](_0x22f75b);}};}function respondWithFilteredResult(_0x5d3468,_0x5c8d0e){return function(_0x23bd52){if(_0x23bd52){var _0x5c1e44=typeof _0x5c8d0e[_0x8b68('0x20')]===_0x8b68('0x21')&&typeof _0x5c8d0e[_0x8b68('0x22')]===_0x8b68('0x21');var _0x491695=_0x23bd52[_0x8b68('0x23')];var _0x203dd4=_0x5c1e44?0x0:_0x5c8d0e['offset'];var _0x42b3bd=_0x5c1e44?_0x23bd52[_0x8b68('0x23')]:_0x5c8d0e[_0x8b68('0x20')]+_0x5c8d0e[_0x8b68('0x22')];var _0x38b7a7;if(_0x42b3bd>=_0x491695){_0x42b3bd=_0x491695;_0x38b7a7=0xc8;}else{_0x38b7a7=0xce;}_0x5d3468['status'](_0x38b7a7);return _0x5d3468[_0x8b68('0x24')](_0x8b68('0x25'),_0x203dd4+'-'+_0x42b3bd+'/'+_0x491695)[_0x8b68('0x1f')](_0x23bd52);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x26')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x27')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x28')](_0x59cb26)[_0x8b68('0x29')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2a')]()['then'](function(){_0x173524[_0x8b68('0x1e')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2b')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x1e')](_0x448e43)['send'](_0x2ba2a3);};}exports[_0x8b68('0x2c')]=function(_0x3ac356,_0x48e2c8){var _0x494ce4={},_0x357635={},_0x1cd230={'count':0x0,'rows':[]};var _0x1e7c06=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')],function(_0x460c37){return{'name':_0x460c37['fieldName'],'type':_0x460c37[_0x8b68('0x30')]['key']};});_0x357635[_0x8b68('0x31')]=_[_0x8b68('0x2d')](_0x1e7c06,'name');_0x357635[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ac356[_0x8b68('0x32')]);_0x357635['filters']=_['intersection'](_0x357635[_0x8b68('0x31')],_0x357635[_0x8b68('0x32')]);_0x494ce4[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x357635[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x36')]));_0x494ce4[_0x8b68('0x34')]=_0x494ce4[_0x8b68('0x34')][_0x8b68('0x37')]?_0x494ce4[_0x8b68('0x34')]:_0x357635[_0x8b68('0x31')];if(!_0x3ac356[_0x8b68('0x32')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x494ce4[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x22')]);_0x494ce4[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3ac356['query']['offset']);}_0x494ce4[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x494ce4[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x3ac356[_0x8b68('0x32')],_0x357635['filters']),_0x1e7c06);if(_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x494ce4[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x494ce4[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x1e7c06,function(_0xff4080){if(_0xff4080[_0x8b68('0x30')]!=='VIRTUAL'){var _0x3f874c={};_0x3f874c[_0xff4080[_0x8b68('0x41')]]={'$like':'%'+_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]+'%'};return _0x3f874c;}})});}_0x494ce4=_[_0x8b68('0x40')]({},_0x494ce4,_0x3ac356[_0x8b68('0x42')]);var _0xa748c2={'where':_0x494ce4['where']};return db[_0x8b68('0x2e')][_0x8b68('0x23')](_0xa748c2)['then'](function(_0x14ec40){_0x1cd230[_0x8b68('0x23')]=_0x14ec40;if(_0x3ac356['query']['includeAll']){_0x494ce4['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8b68('0x43')](_0x494ce4);})[_0x8b68('0x29')](function(_0x515815){_0x1cd230[_0x8b68('0x44')]=_0x515815;return _0x1cd230;})['then'](respondWithFilteredResult(_0x48e2c8,_0x494ce4))[_0x8b68('0x45')](handleError(_0x48e2c8,null));};exports[_0x8b68('0x46')]=function(_0x5a3193,_0x2f90d9){var _0x5ae345={'raw':![],'where':{'id':_0x5a3193['params']['id']}},_0x4a718c={};_0x4a718c[_0x8b68('0x31')]=_[_0x8b68('0x33')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x4a718c['query']=_[_0x8b68('0x33')](_0x5a3193['query']);_0x4a718c[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x4a718c['model'],_0x4a718c[_0x8b68('0x32')]);_0x5ae345[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x4a718c[_0x8b68('0x31')],qs['fields'](_0x5a3193[_0x8b68('0x32')][_0x8b68('0x36')]));_0x5ae345[_0x8b68('0x34')]=_0x5ae345[_0x8b68('0x34')][_0x8b68('0x37')]?_0x5ae345[_0x8b68('0x34')]:_0x4a718c[_0x8b68('0x31')];if(_0x5a3193[_0x8b68('0x32')][_0x8b68('0x47')]){_0x5ae345[_0x8b68('0x48')]=[{'all':!![]}];}_0x5ae345=_[_0x8b68('0x40')]({},_0x5ae345,_0x5a3193[_0x8b68('0x42')]);return db[_0x8b68('0x2e')][_0x8b68('0x49')](_0x5ae345)[_0x8b68('0x29')](handleEntityNotFound(_0x2f90d9,null))[_0x8b68('0x29')](respondWithResult(_0x2f90d9,null))['catch'](handleError(_0x2f90d9,null));};exports[_0x8b68('0x4a')]=function(_0x20681a,_0x5dd099){return db[_0x8b68('0x2e')]['create'](_0x20681a['body'],{})['then'](respondWithResult(_0x5dd099,0xc9))[_0x8b68('0x45')](handleError(_0x5dd099,null));};exports[_0x8b68('0x28')]=function(_0x34047c,_0x6da48b){if(_0x34047c['body']['id']){delete _0x34047c['body']['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x49')]({'where':{'id':_0x34047c[_0x8b68('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6da48b,null))[_0x8b68('0x29')](saveUpdates(_0x34047c[_0x8b68('0x4c')],null))['then'](respondWithResult(_0x6da48b,null))[_0x8b68('0x45')](handleError(_0x6da48b,null));};exports[_0x8b68('0x2a')]=function(_0x595942,_0x18a9ae){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0x595942[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x18a9ae,null))['then'](removeEntity(_0x18a9ae,null))['catch'](handleError(_0x18a9ae,null));};exports['getConfigurations']=function(_0x28f82d,_0x42eabd,_0x3718b2){var _0x3d4b4f={};var _0x55aad3={};var _0x5a1711;var _0x4492fd;return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x28f82d['params']['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x42eabd,null))[_0x8b68('0x29')](function(_0x3f9d34){if(_0x3f9d34){_0x5a1711=_0x3f9d34;_0x55aad3['model']=_[_0x8b68('0x33')](db['ZendeskConfiguration'][_0x8b68('0x2f')]);_0x55aad3[_0x8b68('0x32')]=_['keys'](_0x28f82d[_0x8b68('0x32')]);_0x55aad3[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],_0x55aad3[_0x8b68('0x32')]);_0x3d4b4f['attributes']=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x36')]));_0x3d4b4f[_0x8b68('0x34')]=_0x3d4b4f[_0x8b68('0x34')][_0x8b68('0x37')]?_0x3d4b4f['attributes']:_0x55aad3[_0x8b68('0x31')];_0x3d4b4f[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x3d4b4f[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x28f82d[_0x8b68('0x32')],_0x55aad3[_0x8b68('0x3d')]));if(_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x3d4b4f[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x3d4b4f[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x3d4b4f[_0x8b68('0x34')],function(_0x3da7b4){var _0xae90f0={};_0xae90f0[_0x3da7b4]={'$like':'%'+_0x28f82d[_0x8b68('0x32')]['filter']+'%'};return _0xae90f0;})});}_0x3d4b4f=_[_0x8b68('0x40')]({},_0x3d4b4f,_0x28f82d['options']);return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x5d2476){if(_0x5d2476){_0x4492fd=_0x5d2476[_0x8b68('0x37')];if(!_0x28f82d[_0x8b68('0x32')][_0x8b68('0x38')]('nolimit')){_0x3d4b4f[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x22')]);_0x3d4b4f[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x28f82d[_0x8b68('0x32')]['offset']);}return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5?{'count':_0x4492fd,'rows':_0x4224f5}:null;}})[_0x8b68('0x29')](respondWithResult(_0x42eabd,null))[_0x8b68('0x45')](handleError(_0x42eabd,null));};exports[_0x8b68('0x4e')]=function(_0x37da34,_0x2d1519,_0x314f1e){if(_0x37da34[_0x8b68('0x4c')]['id']){delete _0x37da34[_0x8b68('0x4c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x37da34[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x2d1519,null))[_0x8b68('0x29')](function(_0x414096){if(_0x414096){_0x37da34[_0x8b68('0x4c')][_0x8b68('0x4f')]=_0x414096['id'];_0x37da34['body']['Subjects']=integrations[_0x8b68('0x50')](_0x37da34[_0x8b68('0x4c')]['channel'],_0x37da34['body']['type']);_0x37da34[_0x8b68('0x4c')][_0x8b68('0x51')]=integrations[_0x8b68('0x52')](_0x37da34[_0x8b68('0x4c')][_0x8b68('0x53')],_0x37da34['body'][_0x8b68('0x30')]);return db[_0x8b68('0x54')]['create'](_0x37da34[_0x8b68('0x4c')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x8b68('0x51')}]});}return null;})[_0x8b68('0x29')](respondWithResult(_0x2d1519,null))[_0x8b68('0x45')](handleError(_0x2d1519,null));};exports[_0x8b68('0x55')]=function(_0x864b6b,_0x1fc24c,_0x35b22b){var _0x34456d='';return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x864b6b['params']['id']},'attributes':['id',_0x8b68('0x56'),_0x8b68('0x57'),_0x8b68('0x58'),'authType','remoteUri']})[_0x8b68('0x29')](handleEntityNotFound(_0x1fc24c,null))[_0x8b68('0x29')](function(_0x525b41){if(_0x525b41){_0x34456d=_0x525b41[_0x8b68('0x59')];var _0x2c1c96=_0x34456d[_0x8b68('0x5a')](-0x1);if(_0x2c1c96==='/'){_0x34456d=_0x34456d[_0x8b68('0x5b')](0x0,_0x34456d['lastIndexOf'](_0x2c1c96));}var _0x96e526={'method':'GET','uri':util['format'](_0x8b68('0x5c'),_0x34456d,'ticket_fields'),'json':!![]};switch(_0x525b41[_0x8b68('0x5d')]){case _0x8b68('0x57'):_0x96e526['headers']={'Authorization':util[_0x8b68('0x5e')](_0x8b68('0x5f'),new Buffer(util[_0x8b68('0x5e')](_0x8b68('0x60'),_0x525b41[_0x8b68('0x56')],_0x525b41['password']))[_0x8b68('0x61')](_0x8b68('0x62')))};break;case _0x8b68('0x58'):_0x96e526[_0x8b68('0x63')]={'Authorization':util[_0x8b68('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x8b68('0x64'),_0x525b41['username'],_0x525b41[_0x8b68('0x58')]))[_0x8b68('0x61')](_0x8b68('0x62')))};break;default:throw new db[(_0x8b68('0x65'))][(_0x8b68('0x66'))](_0x8b68('0x67'));}return rp(_0x96e526);}})[_0x8b68('0x29')](function(_0x486be8){if(_0x486be8){var _0x3033b4=['subject',_0x8b68('0x68'),_0x8b68('0x69'),_0x8b68('0x6a')];_['remove'](_0x486be8[_0x8b68('0x6b')],function(_0x50d0b9){return _0x3033b4[_0x8b68('0x6c')](_0x50d0b9['type']);});return{'count':_0x486be8[_0x8b68('0x6b')][_0x8b68('0x37')],'rows':_[_0x8b68('0x2d')](_0x486be8['ticket_fields'],function(_0x33b775){return{'id':_0x33b775['id'],'name':_0x33b775[_0x8b68('0x6d')]>0x7?_0x33b775[_0x8b68('0x6e')]:_0x33b775[_0x8b68('0x30')],'custom':_0x33b775[_0x8b68('0x6d')]>0x7?!![]:![],'options':_0x33b775[_0x8b68('0x6f')]?_0x33b775[_0x8b68('0x6f')]:_0x33b775[_0x8b68('0x70')]?_0x33b775[_0x8b68('0x70')]:[]};})};}})['then'](respondWithResult(_0x1fc24c,null))[_0x8b68('0x45')](function(_0x3cb970){var _0x9a5bec=_0x864b6b[_0x8b68('0x32')][_0x8b68('0x71')]?0x1f4:_0x3cb970['statusCode']||0x1f4;logger[_0x8b68('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b68('0x55'),_0x9a5bec,JSON[_0x8b68('0x73')](_0x3cb970));delete _0x3cb970['name'];if(_0x9a5bec===0x191){_0x9a5bec=0x190;}_0x1fc24c[_0x8b68('0x1e')](_0x9a5bec)[_0x8b68('0x74')](_0x864b6b[_0x8b68('0x32')]['test']?{'message':_0x8b68('0x75'),'statusCode':_0x3cb970[_0x8b68('0x76')]}:_0x3cb970);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7efe4ad..a03d211 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 _0x9a13=['int_zendesk_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount'];(function(_0x39ac9b,_0xd4ae1a){var _0x2e61fb=function(_0x514ef9){while(--_0x514ef9){_0x39ac9b['push'](_0x39ac9b['shift']());}};_0x2e61fb(++_0xd4ae1a);}(_0x9a13,0x199));var _0x39a1=function(_0x7934ca,_0x51fad4){_0x7934ca=_0x7934ca-0x0;var _0x1823d3=_0x9a13[_0x7934ca];return _0x1823d3;};'use strict';var _=require(_0x39a1('0x0'));var util=require(_0x39a1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x39a1('0x2'));var BPromise=require(_0x39a1('0x3'));var rp=require(_0x39a1('0x4'));var fs=require('fs');var path=require(_0x39a1('0x5'));var rimraf=require('rimraf');var config=require(_0x39a1('0x6'));var attributes=require(_0x39a1('0x7'));var integrations=require(_0x39a1('0x8'));module['exports']=function(_0x499182,_0x4e8345){return _0x499182[_0x39a1('0x9')](_0x39a1('0xa'),attributes,{'tableName':_0x39a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6374=['int_zendesk_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','ZendeskAccount'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0x6374,0x79));var _0x4637=function(_0x24502b,_0x25ee97){_0x24502b=_0x24502b-0x0;var _0x168346=_0x6374[_0x24502b];return _0x168346;};'use strict';var _=require(_0x4637('0x0'));var util=require(_0x4637('0x1'));var logger=require('../../config/logger')(_0x4637('0x2'));var moment=require(_0x4637('0x3'));var BPromise=require('bluebird');var rp=require(_0x4637('0x4'));var fs=require('fs');var path=require(_0x4637('0x5'));var rimraf=require(_0x4637('0x6'));var config=require(_0x4637('0x7'));var attributes=require(_0x4637('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4637('0x9')]=function(_0x26e8eb,_0xdba3c3){return _0x26e8eb['define'](_0x4637('0xa'),attributes,{'tableName':_0x4637('0xb'),'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 8c40583..122024d 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 _0x4e2b=['raw','where','attributes','limit','include','model','map','ShowZendeskAccount','ZendeskAccount','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e2b,0xa9));var _0xb4e2=function(_0x2acd60,_0x20277c){_0x2acd60=_0x2acd60-0x0;var _0x3165a8=_0x4e2b[_0x2acd60];return _0x3165a8;};'use strict';var _=require('lodash');var util=require(_0xb4e2('0x0'));var moment=require('moment');var BPromise=require(_0xb4e2('0x1'));var rs=require(_0xb4e2('0x2'));var fs=require('fs');var Redis=require(_0xb4e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb4e2('0x4'))(_0xb4e2('0x5'));var config=require('../../config/environment');var jayson=require(_0xb4e2('0x6'));var client=jayson[_0xb4e2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d370,_0x1e4520,_0x28d08d){return new BPromise(function(_0x33d107,_0x6e58ea){return client['request'](_0x35d370,_0x28d08d)[_0xb4e2('0x8')](function(_0x13754c){logger['info'](_0xb4e2('0x9'),_0x1e4520,_0xb4e2('0xa'));logger[_0xb4e2('0xb')](_0xb4e2('0xc'),_0x1e4520,_0xb4e2('0xa'),JSON[_0xb4e2('0xd')](_0x13754c));if(_0x13754c[_0xb4e2('0xe')]){if(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0xf')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1e4520,_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);return _0x6e58ea(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);}logger[_0xb4e2('0xe')](_0xb4e2('0x9'),_0x1e4520,_0x13754c['error'][_0xb4e2('0x10')]);return _0x33d107(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);}else{logger[_0xb4e2('0x11')](_0xb4e2('0x9'),_0x1e4520,_0xb4e2('0xa'));_0x33d107(_0x13754c[_0xb4e2('0x12')]['message']);}})[_0xb4e2('0x13')](function(_0x119b9a){logger[_0xb4e2('0xe')](_0xb4e2('0x9'),_0x1e4520,_0x119b9a);_0x6e58ea(_0x119b9a);});});}exports[_0xb4e2('0x14')]=function(_0x569e0f){var _0x22f25=this;return new Promise(function(_0x2b75d9,_0x2023d8){return db['ZendeskAccount'][_0xb4e2('0x15')]({'raw':_0x569e0f['options']?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x17')]===undefined?!![]:![]:!![],'where':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x18')]||null:null,'attributes':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x19')]||null:null,'limit':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1a')]||null:null,'include':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1b')]?_['map'](_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1b')],function(_0x51fe2d){return{'model':db[_0x51fe2d[_0xb4e2('0x1c')]],'as':_0x51fe2d['as'],'attributes':_0x51fe2d[_0xb4e2('0x19')],'include':_0x51fe2d[_0xb4e2('0x1b')]?_['map'](_0x51fe2d[_0xb4e2('0x1b')],function(_0x49c0a2){return{'model':db[_0x49c0a2['model']],'as':_0x49c0a2['as'],'attributes':_0x49c0a2[_0xb4e2('0x19')],'include':_0x49c0a2[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x49c0a2[_0xb4e2('0x1b')],function(_0x2376fe){return{'model':db[_0x2376fe['model']],'as':_0x2376fe['as'],'attributes':_0x2376fe[_0xb4e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb4e2('0x8')](function(_0x20e524){logger[_0xb4e2('0x11')](_0xb4e2('0x14'),_0x569e0f);logger[_0xb4e2('0xb')]('GetZendeskAccount',_0x569e0f,JSON[_0xb4e2('0xd')](_0x20e524));_0x2b75d9(_0x20e524);})[_0xb4e2('0x13')](function(_0x268e92){logger[_0xb4e2('0xe')]('GetZendeskAccount',_0x268e92[_0xb4e2('0x10')],_0x569e0f);_0x2023d8(_0x22f25['error'](0x1f4,_0x268e92[_0xb4e2('0x10')]));});});};exports[_0xb4e2('0x1e')]=function(_0x392b20){var _0x357eb3=this;return new Promise(function(_0x49b320,_0x2ba839){return db[_0xb4e2('0x1f')]['find']({'raw':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')][_0xb4e2('0x18')]||null:null,'attributes':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')][_0xb4e2('0x19')]||null:null,'include':_0x392b20[_0xb4e2('0x16')]?_0x392b20['options'][_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x392b20[_0xb4e2('0x16')]['include'],function(_0x50d6db){return{'model':db[_0x50d6db[_0xb4e2('0x1c')]],'as':_0x50d6db['as'],'attributes':_0x50d6db[_0xb4e2('0x19')],'include':_0x50d6db[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x50d6db[_0xb4e2('0x1b')],function(_0x4cacec){return{'model':db[_0x4cacec[_0xb4e2('0x1c')]],'as':_0x4cacec['as'],'attributes':_0x4cacec[_0xb4e2('0x19')],'include':_0x4cacec[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x4cacec[_0xb4e2('0x1b')],function(_0x21f7b5){return{'model':db[_0x21f7b5['model']],'as':_0x21f7b5['as'],'attributes':_0x21f7b5[_0xb4e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb4e2('0x8')](function(_0x4a0c28){logger[_0xb4e2('0x11')](_0xb4e2('0x1e'),_0x392b20);logger[_0xb4e2('0xb')]('ShowZendeskAccount',_0x392b20,JSON['stringify'](_0x4a0c28));_0x49b320(_0x4a0c28);})[_0xb4e2('0x13')](function(_0x10b42b){logger[_0xb4e2('0xe')](_0xb4e2('0x1e'),_0x10b42b[_0xb4e2('0x10')],_0x392b20);_0x2ba839(_0x357eb3[_0xb4e2('0xe')](0x1f4,_0x10b42b[_0xb4e2('0x10')]));});});}; \ No newline at end of file +var _0x15f4=['then','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15f4,0x16b));var _0x415f=function(_0x4e2d95,_0x417ffc){_0x4e2d95=_0x4e2d95-0x0;var _0xfc13b2=_0x15f4[_0x4e2d95];return _0xfc13b2;};'use strict';var _=require(_0x415f('0x0'));var util=require('util');var moment=require(_0x415f('0x1'));var BPromise=require(_0x415f('0x2'));var rs=require(_0x415f('0x3'));var fs=require('fs');var Redis=require(_0x415f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x415f('0x5'));var logger=require(_0x415f('0x6'))(_0x415f('0x7'));var config=require(_0x415f('0x8'));var jayson=require(_0x415f('0x9'));var client=jayson[_0x415f('0xa')][_0x415f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d0699,_0x2329f4,_0x4a89a9){return new BPromise(function(_0x365450,_0xa7a0e4){return client[_0x415f('0xc')](_0x5d0699,_0x4a89a9)['then'](function(_0x136f25){logger[_0x415f('0xd')](_0x415f('0xe'),_0x2329f4,_0x415f('0xf'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2329f4,_0x415f('0xf'),JSON[_0x415f('0x10')](_0x136f25));if(_0x136f25[_0x415f('0x11')]){if(_0x136f25[_0x415f('0x11')][_0x415f('0x12')]===0x1f4){logger['error'](_0x415f('0xe'),_0x2329f4,_0x136f25[_0x415f('0x11')][_0x415f('0x13')]);return _0xa7a0e4(_0x136f25[_0x415f('0x11')][_0x415f('0x13')]);}logger['error'](_0x415f('0xe'),_0x2329f4,_0x136f25['error'][_0x415f('0x13')]);return _0x365450(_0x136f25[_0x415f('0x11')]['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2329f4,_0x415f('0xf'));_0x365450(_0x136f25[_0x415f('0x14')][_0x415f('0x13')]);}})[_0x415f('0x15')](function(_0x390849){logger[_0x415f('0x11')](_0x415f('0xe'),_0x2329f4,_0x390849);_0xa7a0e4(_0x390849);});});}exports[_0x415f('0x16')]=function(_0x3116d3){var _0x7f4746=this;return new Promise(function(_0x4c29a9,_0x16cb40){return db[_0x415f('0x17')][_0x415f('0x18')]({'raw':_0x3116d3['options']?_0x3116d3[_0x415f('0x19')][_0x415f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3116d3['options']?_0x3116d3[_0x415f('0x19')][_0x415f('0x1b')]||null:null,'attributes':_0x3116d3[_0x415f('0x19')]?_0x3116d3[_0x415f('0x19')][_0x415f('0x1c')]||null:null,'limit':_0x3116d3['options']?_0x3116d3[_0x415f('0x19')][_0x415f('0x1d')]||null:null,'include':_0x3116d3[_0x415f('0x19')]?_0x3116d3[_0x415f('0x19')][_0x415f('0x1e')]?_['map'](_0x3116d3[_0x415f('0x19')][_0x415f('0x1e')],function(_0x8ffbbe){return{'model':db[_0x8ffbbe[_0x415f('0x1f')]],'as':_0x8ffbbe['as'],'attributes':_0x8ffbbe['attributes'],'include':_0x8ffbbe['include']?_[_0x415f('0x20')](_0x8ffbbe[_0x415f('0x1e')],function(_0x1bb69d){return{'model':db[_0x1bb69d[_0x415f('0x1f')]],'as':_0x1bb69d['as'],'attributes':_0x1bb69d['attributes'],'include':_0x1bb69d[_0x415f('0x1e')]?_[_0x415f('0x20')](_0x1bb69d[_0x415f('0x1e')],function(_0x5df289){return{'model':db[_0x5df289[_0x415f('0x1f')]],'as':_0x5df289['as'],'attributes':_0x5df289[_0x415f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x415f('0x21')](function(_0x384947){logger['info'](_0x415f('0x16'),_0x3116d3);logger['debug']('GetZendeskAccount',_0x3116d3,JSON[_0x415f('0x10')](_0x384947));_0x4c29a9(_0x384947);})[_0x415f('0x15')](function(_0x3903c9){logger[_0x415f('0x11')](_0x415f('0x16'),_0x3903c9[_0x415f('0x13')],_0x3116d3);_0x16cb40(_0x7f4746['error'](0x1f4,_0x3903c9[_0x415f('0x13')]));});});};exports[_0x415f('0x22')]=function(_0x30e1a4){var _0x4df9a6=this;return new Promise(function(_0x38def4,_0x3162b8){return db['ZendeskAccount'][_0x415f('0x23')]({'raw':_0x30e1a4[_0x415f('0x19')]?_0x30e1a4[_0x415f('0x19')][_0x415f('0x1a')]===undefined?!![]:![]:!![],'where':_0x30e1a4[_0x415f('0x19')]?_0x30e1a4[_0x415f('0x19')]['where']||null:null,'attributes':_0x30e1a4['options']?_0x30e1a4[_0x415f('0x19')][_0x415f('0x1c')]||null:null,'include':_0x30e1a4[_0x415f('0x19')]?_0x30e1a4[_0x415f('0x19')]['include']?_[_0x415f('0x20')](_0x30e1a4[_0x415f('0x19')]['include'],function(_0x47f274){return{'model':db[_0x47f274[_0x415f('0x1f')]],'as':_0x47f274['as'],'attributes':_0x47f274[_0x415f('0x1c')],'include':_0x47f274[_0x415f('0x1e')]?_[_0x415f('0x20')](_0x47f274[_0x415f('0x1e')],function(_0x2e410f){return{'model':db[_0x2e410f[_0x415f('0x1f')]],'as':_0x2e410f['as'],'attributes':_0x2e410f[_0x415f('0x1c')],'include':_0x2e410f[_0x415f('0x1e')]?_['map'](_0x2e410f[_0x415f('0x1e')],function(_0x28f262){return{'model':db[_0x28f262[_0x415f('0x1f')]],'as':_0x28f262['as'],'attributes':_0x28f262[_0x415f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fb58f){logger[_0x415f('0xd')](_0x415f('0x22'),_0x30e1a4);logger['debug'](_0x415f('0x22'),_0x30e1a4,JSON[_0x415f('0x10')](_0x2fb58f));_0x38def4(_0x2fb58f);})['catch'](function(_0x52b202){logger['error'](_0x415f('0x22'),_0x52b202[_0x415f('0x13')],_0x30e1a4);_0x3162b8(_0x4df9a6[_0x415f('0x11')](0x1f4,_0x52b202[_0x415f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2416461..255d4e4 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x49b57e,_0x55496e){var _0x2dbb9c=function(_0x3b379f){while(--_0x3b379f){_0x49b57e['push'](_0x49b57e['shift']());}};_0x2dbb9c(++_0x55496e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4f6fc4,_0x211229){var _0x28d577=function(_0x46466a){while(--_0x46466a){_0x4f6fc4['push'](_0x4f6fc4['shift']());}};_0x28d577(++_0x211229);}(_0x5c00,0x17e));var _0x05c0=function(_0x1fd456,_0x3b5d5f){_0x1fd456=_0x1fd456-0x0;var _0x599648=_0x5c00[_0x1fd456];return _0x599648;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index bc8e657..cb447f1 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 _0xabb4=['exports','STRING'];(function(_0x42e22d,_0x1e1305){var _0x78df1=function(_0x25d806){while(--_0x25d806){_0x42e22d['push'](_0x42e22d['shift']());}};_0x78df1(++_0x1e1305);}(_0xabb4,0x10e));var _0x4abb=function(_0x55a84e,_0x2dd5ea){_0x55a84e=_0x55a84e-0x0;var _0x52143b=_0xabb4[_0x55a84e];return _0x52143b;};'use strict';var Sequelize=require('sequelize');module[_0x4abb('0x0')]={'name':{'type':Sequelize[_0x4abb('0x1')]},'description':{'type':Sequelize[_0x4abb('0x1')]}}; \ No newline at end of file +var _0x4bea=['STRING'];(function(_0x363e56,_0x122591){var _0x1dd76c=function(_0x49fd5b){while(--_0x49fd5b){_0x363e56['push'](_0x363e56['shift']());}};_0x1dd76c(++_0x122591);}(_0x4bea,0x1ef));var _0xa4be=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x4bea[_0x277721];return _0x286051;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa4be('0x0')]},'description':{'type':Sequelize[_0xa4be('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0785baf..d90cf1a 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 _0x4eb9=['order','filter','findOne','getSubjects','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','keys','find','create','body','getFields','ZendeskField'];(function(_0x385346,_0x363dc4){var _0x325242=function(_0x384da7){while(--_0x384da7){_0x385346['push'](_0x385346['shift']());}};_0x325242(++_0x363dc4);}(_0x4eb9,0x154));var _0x94eb=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x4eb9[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0x94eb('0x0'));var rimraf=require(_0x94eb('0x1'));var zipdir=require(_0x94eb('0x2'));var jsonpatch=require(_0x94eb('0x3'));var rp=require('request-promise');var moment=require(_0x94eb('0x4'));var BPromise=require(_0x94eb('0x5'));var Mustache=require(_0x94eb('0x6'));var util=require('util');var path=require(_0x94eb('0x7'));var sox=require(_0x94eb('0x8'));var csv=require('to-csv');var ejs=require(_0x94eb('0x9'));var fs=require('fs');var fs_extra=require(_0x94eb('0xa'));var _=require(_0x94eb('0xb'));var squel=require(_0x94eb('0xc'));var crypto=require(_0x94eb('0xd'));var jsforce=require(_0x94eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x94eb('0xf'));var querystring=require(_0x94eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94eb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x94eb('0x12'));var hardwareService=require(_0x94eb('0x13'));var logger=require(_0x94eb('0x14'))(_0x94eb('0x15'));var utils=require(_0x94eb('0x16'));var config=require(_0x94eb('0x17'));var licenseUtil=require(_0x94eb('0x18'));var db=require(_0x94eb('0x19'))['db'];function respondWithStatusCode(_0x10458,_0x316293){_0x316293=_0x316293||0xcc;return function(_0x496095){if(_0x496095){return _0x10458[_0x94eb('0x1a')](_0x316293);}return _0x10458['status'](_0x316293)['end']();};}function respondWithResult(_0x39e8cf,_0x433905){_0x433905=_0x433905||0xc8;return function(_0x91170e){if(_0x91170e){return _0x39e8cf[_0x94eb('0x1b')](_0x433905)[_0x94eb('0x1c')](_0x91170e);}};}function respondWithFilteredResult(_0x4a514e,_0x1a1f52){return function(_0x5ae7db){if(_0x5ae7db){var _0x3520cd=typeof _0x1a1f52['offset']==='undefined'&&typeof _0x1a1f52['limit']==='undefined';var _0x50f448=_0x5ae7db[_0x94eb('0x1d')];var _0x1d16a3=_0x3520cd?0x0:_0x1a1f52[_0x94eb('0x1e')];var _0x493cf9=_0x3520cd?_0x5ae7db[_0x94eb('0x1d')]:_0x1a1f52[_0x94eb('0x1e')]+_0x1a1f52[_0x94eb('0x1f')];var _0xc65019;if(_0x493cf9>=_0x50f448){_0x493cf9=_0x50f448;_0xc65019=0xc8;}else{_0xc65019=0xce;}_0x4a514e[_0x94eb('0x1b')](_0xc65019);return _0x4a514e[_0x94eb('0x20')](_0x94eb('0x21'),_0x1d16a3+'-'+_0x493cf9+'/'+_0x50f448)[_0x94eb('0x1c')](_0x5ae7db);}return null;};}function patchUpdates(_0x53fa6c){return function(_0x255960){try{jsonpatch['apply'](_0x255960,_0x53fa6c,!![]);}catch(_0x3ad22c){return BPromise[_0x94eb('0x22')](_0x3ad22c);}return _0x255960['save']();};}function saveUpdates(_0x303ad0,_0x410e8f){return function(_0x4e3a6a){if(_0x4e3a6a){return _0x4e3a6a[_0x94eb('0x23')](_0x303ad0)['then'](function(_0xf6b8c){return _0xf6b8c;});}return null;};}function removeEntity(_0x17532d,_0xdc4e6c){return function(_0x27a689){if(_0x27a689){return _0x27a689[_0x94eb('0x24')]()['then'](function(){_0x17532d[_0x94eb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f5f1,_0x33000c){return function(_0x4407e0){if(!_0x4407e0){_0x53f5f1[_0x94eb('0x1a')](0x194);}return _0x4407e0;};}function handleError(_0x254a7d,_0x27a9b4){_0x27a9b4=_0x27a9b4||0x1f4;return function(_0x57d9ea){logger[_0x94eb('0x25')](_0x57d9ea[_0x94eb('0x26')]);if(_0x57d9ea[_0x94eb('0x27')]){delete _0x57d9ea[_0x94eb('0x27')];}_0x254a7d[_0x94eb('0x1b')](_0x27a9b4)['send'](_0x57d9ea);};}exports[_0x94eb('0x28')]=function(_0x46976f,_0x43e8c2){var _0x5028fb={},_0x5353f3={},_0x2f5cae={'count':0x0,'rows':[]};var _0x235ab3=_[_0x94eb('0x29')](db[_0x94eb('0x2a')][_0x94eb('0x2b')],function(_0x57ea00){return{'name':_0x57ea00[_0x94eb('0x2c')],'type':_0x57ea00[_0x94eb('0x2d')][_0x94eb('0x2e')]};});_0x5353f3[_0x94eb('0x2f')]=_[_0x94eb('0x29')](_0x235ab3,_0x94eb('0x27'));_0x5353f3[_0x94eb('0x30')]=_['keys'](_0x46976f[_0x94eb('0x30')]);_0x5353f3['filters']=_['intersection'](_0x5353f3[_0x94eb('0x2f')],_0x5353f3[_0x94eb('0x30')]);_0x5028fb[_0x94eb('0x31')]=_[_0x94eb('0x32')](_0x5353f3[_0x94eb('0x2f')],qs['fields'](_0x46976f[_0x94eb('0x30')][_0x94eb('0x33')]));_0x5028fb['attributes']=_0x5028fb[_0x94eb('0x31')][_0x94eb('0x34')]?_0x5028fb[_0x94eb('0x31')]:_0x5353f3[_0x94eb('0x2f')];if(!_0x46976f[_0x94eb('0x30')][_0x94eb('0x35')](_0x94eb('0x36'))){_0x5028fb[_0x94eb('0x1f')]=qs['limit'](_0x46976f[_0x94eb('0x30')][_0x94eb('0x1f')]);_0x5028fb[_0x94eb('0x1e')]=qs[_0x94eb('0x1e')](_0x46976f[_0x94eb('0x30')][_0x94eb('0x1e')]);}_0x5028fb['order']=qs['sort'](_0x46976f[_0x94eb('0x30')][_0x94eb('0x37')]);_0x5028fb[_0x94eb('0x38')]=qs['filters'](_[_0x94eb('0x39')](_0x46976f[_0x94eb('0x30')],_0x5353f3[_0x94eb('0x3a')]),_0x235ab3);if(_0x46976f[_0x94eb('0x30')]['filter']){_0x5028fb[_0x94eb('0x38')]=_[_0x94eb('0x3b')](_0x5028fb[_0x94eb('0x38')],{'$or':_[_0x94eb('0x29')](_0x235ab3,function(_0x5a6822){if(_0x5a6822[_0x94eb('0x2d')]!==_0x94eb('0x3c')){var _0x4f4aed={};_0x4f4aed[_0x5a6822[_0x94eb('0x27')]]={'$like':'%'+_0x46976f['query']['filter']+'%'};return _0x4f4aed;}})});}_0x5028fb=_[_0x94eb('0x3b')]({},_0x5028fb,_0x46976f[_0x94eb('0x3d')]);var _0x650948={'where':_0x5028fb['where']};return db[_0x94eb('0x2a')][_0x94eb('0x1d')](_0x650948)['then'](function(_0x44af21){_0x2f5cae[_0x94eb('0x1d')]=_0x44af21;if(_0x46976f[_0x94eb('0x30')][_0x94eb('0x3e')]){_0x5028fb[_0x94eb('0x3f')]=[{'all':!![]}];}return db[_0x94eb('0x2a')][_0x94eb('0x40')](_0x5028fb);})[_0x94eb('0x41')](function(_0x2fb5df){_0x2f5cae['rows']=_0x2fb5df;return _0x2f5cae;})[_0x94eb('0x41')](respondWithFilteredResult(_0x43e8c2,_0x5028fb))[_0x94eb('0x42')](handleError(_0x43e8c2,null));};exports[_0x94eb('0x43')]=function(_0x1d37df,_0x3367cf){var _0x2d569e={'raw':![],'where':{'id':_0x1d37df[_0x94eb('0x44')]['id']}},_0x5ae6c4={};_0x5ae6c4[_0x94eb('0x2f')]=_[_0x94eb('0x45')](db[_0x94eb('0x2a')]['rawAttributes']);_0x5ae6c4[_0x94eb('0x30')]=_[_0x94eb('0x45')](_0x1d37df[_0x94eb('0x30')]);_0x5ae6c4[_0x94eb('0x3a')]=_[_0x94eb('0x32')](_0x5ae6c4[_0x94eb('0x2f')],_0x5ae6c4[_0x94eb('0x30')]);_0x2d569e[_0x94eb('0x31')]=_[_0x94eb('0x32')](_0x5ae6c4[_0x94eb('0x2f')],qs['fields'](_0x1d37df[_0x94eb('0x30')][_0x94eb('0x33')]));_0x2d569e['attributes']=_0x2d569e[_0x94eb('0x31')]['length']?_0x2d569e[_0x94eb('0x31')]:_0x5ae6c4[_0x94eb('0x2f')];if(_0x1d37df[_0x94eb('0x30')][_0x94eb('0x3e')]){_0x2d569e[_0x94eb('0x3f')]=[{'all':!![]}];}_0x2d569e=_['merge']({},_0x2d569e,_0x1d37df[_0x94eb('0x3d')]);return db[_0x94eb('0x2a')][_0x94eb('0x46')](_0x2d569e)['then'](handleEntityNotFound(_0x3367cf,null))[_0x94eb('0x41')](respondWithResult(_0x3367cf,null))[_0x94eb('0x42')](handleError(_0x3367cf,null));};exports['create']=function(_0x3043ea,_0xc37bd0){return db['ZendeskConfiguration'][_0x94eb('0x47')](_0x3043ea[_0x94eb('0x48')],{})['then'](respondWithResult(_0xc37bd0,0xc9))[_0x94eb('0x42')](handleError(_0xc37bd0,null));};exports[_0x94eb('0x23')]=function(_0x55db24,_0x241bd5){if(_0x55db24[_0x94eb('0x48')]['id']){delete _0x55db24[_0x94eb('0x48')]['id'];}return db[_0x94eb('0x2a')][_0x94eb('0x46')]({'where':{'id':_0x55db24[_0x94eb('0x44')]['id']}})['then'](handleEntityNotFound(_0x241bd5,null))[_0x94eb('0x41')](saveUpdates(_0x55db24['body'],null))['then'](respondWithResult(_0x241bd5,null))['catch'](handleError(_0x241bd5,null));};exports[_0x94eb('0x24')]=function(_0x37771f,_0x316d7c){return db[_0x94eb('0x2a')][_0x94eb('0x46')]({'where':{'id':_0x37771f[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x316d7c,null))[_0x94eb('0x41')](removeEntity(_0x316d7c,null))['catch'](handleError(_0x316d7c,null));};exports[_0x94eb('0x49')]=function(_0x5d84d8,_0x44f329,_0x3fd61b){var _0x33f1f0={};var _0x309988={};var _0xd24c2c;var _0x136d4e;return db[_0x94eb('0x2a')]['findOne']({'where':{'id':_0x5d84d8[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x44f329,null))['then'](function(_0xec08a4){if(_0xec08a4){_0xd24c2c=_0xec08a4;_0x309988[_0x94eb('0x2f')]=_[_0x94eb('0x45')](db[_0x94eb('0x4a')][_0x94eb('0x2b')]);_0x309988[_0x94eb('0x30')]=_[_0x94eb('0x45')](_0x5d84d8[_0x94eb('0x30')]);_0x309988[_0x94eb('0x3a')]=_[_0x94eb('0x32')](_0x309988['model'],_0x309988[_0x94eb('0x30')]);_0x33f1f0[_0x94eb('0x31')]=_['intersection'](_0x309988[_0x94eb('0x2f')],qs[_0x94eb('0x33')](_0x5d84d8[_0x94eb('0x30')]['fields']));_0x33f1f0['attributes']=_0x33f1f0[_0x94eb('0x31')][_0x94eb('0x34')]?_0x33f1f0[_0x94eb('0x31')]:_0x309988[_0x94eb('0x2f')];_0x33f1f0[_0x94eb('0x4b')]=qs[_0x94eb('0x37')](_0x5d84d8[_0x94eb('0x30')][_0x94eb('0x37')]);_0x33f1f0['where']=qs['filters'](_['pick'](_0x5d84d8[_0x94eb('0x30')],_0x309988[_0x94eb('0x3a')]));if(_0x5d84d8['query'][_0x94eb('0x4c')]){_0x33f1f0[_0x94eb('0x38')]=_[_0x94eb('0x3b')](_0x33f1f0[_0x94eb('0x38')],{'$or':_[_0x94eb('0x29')](_0x33f1f0[_0x94eb('0x31')],function(_0x17c91d){var _0x5060ee={};_0x5060ee[_0x17c91d]={'$like':'%'+_0x5d84d8[_0x94eb('0x30')][_0x94eb('0x4c')]+'%'};return _0x5060ee;})});}_0x33f1f0=_[_0x94eb('0x3b')]({},_0x33f1f0,_0x5d84d8['options']);return _0xd24c2c[_0x94eb('0x49')](_0x33f1f0);}})[_0x94eb('0x41')](function(_0x7e8bd5){if(_0x7e8bd5){_0x136d4e=_0x7e8bd5[_0x94eb('0x34')];if(!_0x5d84d8[_0x94eb('0x30')][_0x94eb('0x35')](_0x94eb('0x36'))){_0x33f1f0['limit']=qs[_0x94eb('0x1f')](_0x5d84d8[_0x94eb('0x30')]['limit']);_0x33f1f0[_0x94eb('0x1e')]=qs[_0x94eb('0x1e')](_0x5d84d8[_0x94eb('0x30')]['offset']);}return _0xd24c2c[_0x94eb('0x49')](_0x33f1f0);}})[_0x94eb('0x41')](function(_0x53e03d){if(_0x53e03d){return _0x53e03d?{'count':_0x136d4e,'rows':_0x53e03d}:null;}})[_0x94eb('0x41')](respondWithResult(_0x44f329,null))[_0x94eb('0x42')](handleError(_0x44f329,null));};exports['getSubjects']=function(_0x366c74,_0x480419,_0x13bfb1){var _0x5ba993={};var _0x27bcee={};var _0x9fefff;var _0x3e758f;return db[_0x94eb('0x2a')][_0x94eb('0x4d')]({'where':{'id':_0x366c74[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x480419,null))[_0x94eb('0x41')](function(_0x5013fb){if(_0x5013fb){_0x9fefff=_0x5013fb;_0x27bcee['model']=_[_0x94eb('0x45')](db[_0x94eb('0x4a')]['rawAttributes']);_0x27bcee[_0x94eb('0x30')]=_[_0x94eb('0x45')](_0x366c74[_0x94eb('0x30')]);_0x27bcee[_0x94eb('0x3a')]=_[_0x94eb('0x32')](_0x27bcee[_0x94eb('0x2f')],_0x27bcee['query']);_0x5ba993['attributes']=_['intersection'](_0x27bcee[_0x94eb('0x2f')],qs[_0x94eb('0x33')](_0x366c74[_0x94eb('0x30')][_0x94eb('0x33')]));_0x5ba993[_0x94eb('0x31')]=_0x5ba993['attributes'][_0x94eb('0x34')]?_0x5ba993['attributes']:_0x27bcee[_0x94eb('0x2f')];_0x5ba993[_0x94eb('0x4b')]=qs[_0x94eb('0x37')](_0x366c74[_0x94eb('0x30')][_0x94eb('0x37')]);_0x5ba993[_0x94eb('0x38')]=qs[_0x94eb('0x3a')](_[_0x94eb('0x39')](_0x366c74[_0x94eb('0x30')],_0x27bcee[_0x94eb('0x3a')]));if(_0x366c74[_0x94eb('0x30')][_0x94eb('0x4c')]){_0x5ba993[_0x94eb('0x38')]=_[_0x94eb('0x3b')](_0x5ba993[_0x94eb('0x38')],{'$or':_[_0x94eb('0x29')](_0x5ba993['attributes'],function(_0x4366ae){var _0x291612={};_0x291612[_0x4366ae]={'$like':'%'+_0x366c74['query'][_0x94eb('0x4c')]+'%'};return _0x291612;})});}_0x5ba993=_[_0x94eb('0x3b')]({},_0x5ba993,_0x366c74[_0x94eb('0x3d')]);return _0x9fefff['getSubjects'](_0x5ba993);}})[_0x94eb('0x41')](function(_0x2a4bac){if(_0x2a4bac){_0x3e758f=_0x2a4bac['length'];if(!_0x366c74[_0x94eb('0x30')]['hasOwnProperty'](_0x94eb('0x36'))){_0x5ba993[_0x94eb('0x1f')]=qs['limit'](_0x366c74['query'][_0x94eb('0x1f')]);_0x5ba993[_0x94eb('0x1e')]=qs[_0x94eb('0x1e')](_0x366c74[_0x94eb('0x30')][_0x94eb('0x1e')]);}return _0x9fefff[_0x94eb('0x4e')](_0x5ba993);}})[_0x94eb('0x41')](function(_0x3f2733){if(_0x3f2733){return _0x3f2733?{'count':_0x3e758f,'rows':_0x3f2733}:null;}})[_0x94eb('0x41')](respondWithResult(_0x480419,null))['catch'](handleError(_0x480419,null));};exports['getDescriptions']=function(_0x4f499d,_0x2de899,_0x4be0a6){var _0x2600d8={};var _0x37df61={};var _0x391937;var _0x390497;return db[_0x94eb('0x2a')]['findOne']({'where':{'id':_0x4f499d[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x2de899,null))[_0x94eb('0x41')](function(_0x1600e5){if(_0x1600e5){_0x391937=_0x1600e5;_0x37df61[_0x94eb('0x2f')]=_[_0x94eb('0x45')](db['ZendeskField'][_0x94eb('0x2b')]);_0x37df61[_0x94eb('0x30')]=_[_0x94eb('0x45')](_0x4f499d[_0x94eb('0x30')]);_0x37df61['filters']=_[_0x94eb('0x32')](_0x37df61[_0x94eb('0x2f')],_0x37df61[_0x94eb('0x30')]);_0x2600d8[_0x94eb('0x31')]=_[_0x94eb('0x32')](_0x37df61[_0x94eb('0x2f')],qs[_0x94eb('0x33')](_0x4f499d[_0x94eb('0x30')][_0x94eb('0x33')]));_0x2600d8['attributes']=_0x2600d8[_0x94eb('0x31')][_0x94eb('0x34')]?_0x2600d8[_0x94eb('0x31')]:_0x37df61[_0x94eb('0x2f')];_0x2600d8[_0x94eb('0x4b')]=qs[_0x94eb('0x37')](_0x4f499d['query'][_0x94eb('0x37')]);_0x2600d8[_0x94eb('0x38')]=qs[_0x94eb('0x3a')](_[_0x94eb('0x39')](_0x4f499d[_0x94eb('0x30')],_0x37df61['filters']));if(_0x4f499d[_0x94eb('0x30')]['filter']){_0x2600d8['where']=_['merge'](_0x2600d8[_0x94eb('0x38')],{'$or':_[_0x94eb('0x29')](_0x2600d8[_0x94eb('0x31')],function(_0x218f6c){var _0x1955eb={};_0x1955eb[_0x218f6c]={'$like':'%'+_0x4f499d[_0x94eb('0x30')][_0x94eb('0x4c')]+'%'};return _0x1955eb;})});}_0x2600d8=_[_0x94eb('0x3b')]({},_0x2600d8,_0x4f499d['options']);return _0x391937['getDescriptions'](_0x2600d8);}})['then'](function(_0x51e6bb){if(_0x51e6bb){_0x390497=_0x51e6bb['length'];if(!_0x4f499d[_0x94eb('0x30')]['hasOwnProperty']('nolimit')){_0x2600d8[_0x94eb('0x1f')]=qs[_0x94eb('0x1f')](_0x4f499d[_0x94eb('0x30')][_0x94eb('0x1f')]);_0x2600d8['offset']=qs[_0x94eb('0x1e')](_0x4f499d[_0x94eb('0x30')][_0x94eb('0x1e')]);}return _0x391937['getDescriptions'](_0x2600d8);}})['then'](function(_0x1f3a43){if(_0x1f3a43){return _0x1f3a43?{'count':_0x390497,'rows':_0x1f3a43}:null;}})[_0x94eb('0x41')](respondWithResult(_0x2de899,null))['catch'](handleError(_0x2de899,null));};exports[_0x94eb('0x4f')]=function(_0x3f0c81,_0x42b6da,_0x2c8171){var _0x34c27b={};var _0x585ff8={};var _0x1d28b9;var _0x3ba1e5;return db[_0x94eb('0x2a')]['findOne']({'where':{'id':_0x3f0c81[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x42b6da,null))[_0x94eb('0x41')](function(_0x59c526){if(_0x59c526){_0x1d28b9=_0x59c526;_0x585ff8[_0x94eb('0x2f')]=_['keys'](db[_0x94eb('0x50')][_0x94eb('0x2b')]);_0x585ff8[_0x94eb('0x30')]=_[_0x94eb('0x45')](_0x3f0c81['query']);_0x585ff8['filters']=_[_0x94eb('0x32')](_0x585ff8[_0x94eb('0x2f')],_0x585ff8[_0x94eb('0x30')]);_0x34c27b[_0x94eb('0x31')]=_[_0x94eb('0x32')](_0x585ff8['model'],qs[_0x94eb('0x33')](_0x3f0c81[_0x94eb('0x30')][_0x94eb('0x33')]));_0x34c27b[_0x94eb('0x31')]=_0x34c27b[_0x94eb('0x31')]['length']?_0x34c27b[_0x94eb('0x31')]:_0x585ff8[_0x94eb('0x2f')];_0x34c27b['order']=qs['sort'](_0x3f0c81[_0x94eb('0x30')]['sort']);_0x34c27b[_0x94eb('0x38')]=qs[_0x94eb('0x3a')](_[_0x94eb('0x39')](_0x3f0c81['query'],_0x585ff8[_0x94eb('0x3a')]));if(_0x3f0c81[_0x94eb('0x30')][_0x94eb('0x4c')]){_0x34c27b[_0x94eb('0x38')]=_['merge'](_0x34c27b['where'],{'$or':_[_0x94eb('0x29')](_0x34c27b[_0x94eb('0x31')],function(_0x376a17){var _0x413642={};_0x413642[_0x376a17]={'$like':'%'+_0x3f0c81['query']['filter']+'%'};return _0x413642;})});}_0x34c27b=_[_0x94eb('0x3b')]({},_0x34c27b,_0x3f0c81[_0x94eb('0x3d')]);return _0x1d28b9[_0x94eb('0x4f')](_0x34c27b);}})['then'](function(_0x435a0e){if(_0x435a0e){_0x3ba1e5=_0x435a0e['length'];if(!_0x3f0c81['query'][_0x94eb('0x35')]('nolimit')){_0x34c27b[_0x94eb('0x1f')]=qs[_0x94eb('0x1f')](_0x3f0c81[_0x94eb('0x30')][_0x94eb('0x1f')]);_0x34c27b[_0x94eb('0x1e')]=qs[_0x94eb('0x1e')](_0x3f0c81[_0x94eb('0x30')][_0x94eb('0x1e')]);}return _0x1d28b9[_0x94eb('0x4f')](_0x34c27b);}})['then'](function(_0x4c94c9){if(_0x4c94c9){return _0x4c94c9?{'count':_0x3ba1e5,'rows':_0x4c94c9}:null;}})[_0x94eb('0x41')](respondWithResult(_0x42b6da,null))[_0x94eb('0x42')](handleError(_0x42b6da,null));};exports[_0x94eb('0x51')]=function(_0x35dc01,_0x3b319e,_0x5bfaa5){if(_0x35dc01['body']['id']){delete _0x35dc01[_0x94eb('0x48')]['id'];}return db[_0x94eb('0x2a')]['findOne']({'where':{'id':_0x35dc01[_0x94eb('0x44')]['id']}})[_0x94eb('0x41')](handleEntityNotFound(_0x3b319e,null))[_0x94eb('0x41')](function(_0x409e0b){if(_0x409e0b){return _0x409e0b[_0x94eb('0x51')](_0x35dc01[_0x94eb('0x48')][_0x94eb('0x52')]||[]);}return null;})[_0x94eb('0x41')](respondWithResult(_0x3b319e,null))[_0x94eb('0x42')](handleError(_0x3b319e,null));}; \ No newline at end of file +var _0xae06=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs'];(function(_0xf8471,_0x3141bf){var _0x6d3cbb=function(_0x1cc212){while(--_0x1cc212){_0xf8471['push'](_0xf8471['shift']());}};_0x6d3cbb(++_0x3141bf);}(_0xae06,0xa1));var _0x6ae0=function(_0x5259a8,_0x4d28db){_0x5259a8=_0x5259a8-0x0;var _0x5dc6b6=_0xae06[_0x5259a8];return _0x5dc6b6;};'use strict';var emlformat=require(_0x6ae0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ae0('0x1'));var jsonpatch=require(_0x6ae0('0x2'));var rp=require(_0x6ae0('0x3'));var moment=require(_0x6ae0('0x4'));var BPromise=require(_0x6ae0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6ae0('0x6'));var csv=require(_0x6ae0('0x7'));var ejs=require(_0x6ae0('0x8'));var fs=require('fs');var fs_extra=require(_0x6ae0('0x9'));var _=require(_0x6ae0('0xa'));var squel=require(_0x6ae0('0xb'));var crypto=require(_0x6ae0('0xc'));var jsforce=require(_0x6ae0('0xd'));var deskjs=require(_0x6ae0('0xe'));var toCsv=require(_0x6ae0('0x7'));var querystring=require(_0x6ae0('0xf'));var Papa=require(_0x6ae0('0x10'));var Redis=require(_0x6ae0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ae0('0x12'));var as=require(_0x6ae0('0x13'));var hardwareService=require(_0x6ae0('0x14'));var logger=require('../../config/logger')(_0x6ae0('0x15'));var utils=require('../../config/utils');var config=require(_0x6ae0('0x16'));var licenseUtil=require(_0x6ae0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259515,_0x3f5d98){_0x3f5d98=_0x3f5d98||0xcc;return function(_0x4ebe8c){if(_0x4ebe8c){return _0x259515[_0x6ae0('0x18')](_0x3f5d98);}return _0x259515[_0x6ae0('0x19')](_0x3f5d98)[_0x6ae0('0x1a')]();};}function respondWithResult(_0x23bc53,_0xb16b0b){_0xb16b0b=_0xb16b0b||0xc8;return function(_0x568c41){if(_0x568c41){return _0x23bc53[_0x6ae0('0x19')](_0xb16b0b)['json'](_0x568c41);}};}function respondWithFilteredResult(_0x3b59cb,_0x51df81){return function(_0x543fad){if(_0x543fad){var _0x1ab817=typeof _0x51df81[_0x6ae0('0x1b')]==='undefined'&&typeof _0x51df81[_0x6ae0('0x1c')]===_0x6ae0('0x1d');var _0x2441cc=_0x543fad[_0x6ae0('0x1e')];var _0x340844=_0x1ab817?0x0:_0x51df81['offset'];var _0x3ca460=_0x1ab817?_0x543fad[_0x6ae0('0x1e')]:_0x51df81[_0x6ae0('0x1b')]+_0x51df81[_0x6ae0('0x1c')];var _0xf10457;if(_0x3ca460>=_0x2441cc){_0x3ca460=_0x2441cc;_0xf10457=0xc8;}else{_0xf10457=0xce;}_0x3b59cb[_0x6ae0('0x19')](_0xf10457);return _0x3b59cb['set'](_0x6ae0('0x1f'),_0x340844+'-'+_0x3ca460+'/'+_0x2441cc)[_0x6ae0('0x20')](_0x543fad);}return null;};}function patchUpdates(_0x16d5e3){return function(_0x569598){try{jsonpatch['apply'](_0x569598,_0x16d5e3,!![]);}catch(_0x33d9ff){return BPromise[_0x6ae0('0x21')](_0x33d9ff);}return _0x569598[_0x6ae0('0x22')]();};}function saveUpdates(_0x3a5a31,_0xb59891){return function(_0x1727ce){if(_0x1727ce){return _0x1727ce[_0x6ae0('0x23')](_0x3a5a31)[_0x6ae0('0x24')](function(_0x52b64f){return _0x52b64f;});}return null;};}function removeEntity(_0x49a191,_0x557ad1){return function(_0x5ecc75){if(_0x5ecc75){return _0x5ecc75['destroy']()[_0x6ae0('0x24')](function(){_0x49a191[_0x6ae0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24f1c4,_0x134b22){return function(_0x5875b0){if(!_0x5875b0){_0x24f1c4[_0x6ae0('0x18')](0x194);}return _0x5875b0;};}function handleError(_0x1cf1bf,_0x44553e){_0x44553e=_0x44553e||0x1f4;return function(_0x2fdf7a){logger[_0x6ae0('0x25')](_0x2fdf7a[_0x6ae0('0x26')]);if(_0x2fdf7a[_0x6ae0('0x27')]){delete _0x2fdf7a[_0x6ae0('0x27')];}_0x1cf1bf[_0x6ae0('0x19')](_0x44553e)[_0x6ae0('0x28')](_0x2fdf7a);};}exports[_0x6ae0('0x29')]=function(_0x50601a,_0x21fecf){var _0x1e1b4a={},_0xb9ee92={},_0x385235={'count':0x0,'rows':[]};var _0x14ba16=_[_0x6ae0('0x2a')](db[_0x6ae0('0x2b')][_0x6ae0('0x2c')],function(_0x577d55){return{'name':_0x577d55[_0x6ae0('0x2d')],'type':_0x577d55[_0x6ae0('0x2e')][_0x6ae0('0x2f')]};});_0xb9ee92[_0x6ae0('0x30')]=_[_0x6ae0('0x2a')](_0x14ba16,_0x6ae0('0x27'));_0xb9ee92['query']=_[_0x6ae0('0x31')](_0x50601a[_0x6ae0('0x32')]);_0xb9ee92['filters']=_[_0x6ae0('0x33')](_0xb9ee92[_0x6ae0('0x30')],_0xb9ee92[_0x6ae0('0x32')]);_0x1e1b4a[_0x6ae0('0x34')]=_['intersection'](_0xb9ee92[_0x6ae0('0x30')],qs[_0x6ae0('0x35')](_0x50601a['query'][_0x6ae0('0x35')]));_0x1e1b4a[_0x6ae0('0x34')]=_0x1e1b4a[_0x6ae0('0x34')][_0x6ae0('0x36')]?_0x1e1b4a['attributes']:_0xb9ee92['model'];if(!_0x50601a[_0x6ae0('0x32')][_0x6ae0('0x37')](_0x6ae0('0x38'))){_0x1e1b4a[_0x6ae0('0x1c')]=qs[_0x6ae0('0x1c')](_0x50601a['query'][_0x6ae0('0x1c')]);_0x1e1b4a['offset']=qs[_0x6ae0('0x1b')](_0x50601a['query'][_0x6ae0('0x1b')]);}_0x1e1b4a['order']=qs['sort'](_0x50601a[_0x6ae0('0x32')][_0x6ae0('0x39')]);_0x1e1b4a[_0x6ae0('0x3a')]=qs[_0x6ae0('0x3b')](_[_0x6ae0('0x3c')](_0x50601a['query'],_0xb9ee92[_0x6ae0('0x3b')]),_0x14ba16);if(_0x50601a[_0x6ae0('0x32')][_0x6ae0('0x3d')]){_0x1e1b4a['where']=_[_0x6ae0('0x3e')](_0x1e1b4a[_0x6ae0('0x3a')],{'$or':_[_0x6ae0('0x2a')](_0x14ba16,function(_0x25fc17){if(_0x25fc17[_0x6ae0('0x2e')]!==_0x6ae0('0x3f')){var _0x49046d={};_0x49046d[_0x25fc17[_0x6ae0('0x27')]]={'$like':'%'+_0x50601a[_0x6ae0('0x32')]['filter']+'%'};return _0x49046d;}})});}_0x1e1b4a=_[_0x6ae0('0x3e')]({},_0x1e1b4a,_0x50601a[_0x6ae0('0x40')]);var _0x417bf5={'where':_0x1e1b4a[_0x6ae0('0x3a')]};return db['ZendeskConfiguration'][_0x6ae0('0x1e')](_0x417bf5)[_0x6ae0('0x24')](function(_0x87f65a){_0x385235[_0x6ae0('0x1e')]=_0x87f65a;if(_0x50601a[_0x6ae0('0x32')][_0x6ae0('0x41')]){_0x1e1b4a[_0x6ae0('0x42')]=[{'all':!![]}];}return db[_0x6ae0('0x2b')][_0x6ae0('0x43')](_0x1e1b4a);})[_0x6ae0('0x24')](function(_0x347ad5){_0x385235[_0x6ae0('0x44')]=_0x347ad5;return _0x385235;})[_0x6ae0('0x24')](respondWithFilteredResult(_0x21fecf,_0x1e1b4a))[_0x6ae0('0x45')](handleError(_0x21fecf,null));};exports['show']=function(_0x5dc4da,_0x64b2de){var _0x48bb59={'raw':![],'where':{'id':_0x5dc4da[_0x6ae0('0x46')]['id']}},_0x102295={};_0x102295[_0x6ae0('0x30')]=_['keys'](db[_0x6ae0('0x2b')][_0x6ae0('0x2c')]);_0x102295[_0x6ae0('0x32')]=_[_0x6ae0('0x31')](_0x5dc4da['query']);_0x102295[_0x6ae0('0x3b')]=_[_0x6ae0('0x33')](_0x102295[_0x6ae0('0x30')],_0x102295[_0x6ae0('0x32')]);_0x48bb59[_0x6ae0('0x34')]=_[_0x6ae0('0x33')](_0x102295[_0x6ae0('0x30')],qs[_0x6ae0('0x35')](_0x5dc4da[_0x6ae0('0x32')][_0x6ae0('0x35')]));_0x48bb59[_0x6ae0('0x34')]=_0x48bb59[_0x6ae0('0x34')][_0x6ae0('0x36')]?_0x48bb59[_0x6ae0('0x34')]:_0x102295[_0x6ae0('0x30')];if(_0x5dc4da['query'][_0x6ae0('0x41')]){_0x48bb59[_0x6ae0('0x42')]=[{'all':!![]}];}_0x48bb59=_[_0x6ae0('0x3e')]({},_0x48bb59,_0x5dc4da[_0x6ae0('0x40')]);return db[_0x6ae0('0x2b')]['find'](_0x48bb59)[_0x6ae0('0x24')](handleEntityNotFound(_0x64b2de,null))['then'](respondWithResult(_0x64b2de,null))[_0x6ae0('0x45')](handleError(_0x64b2de,null));};exports[_0x6ae0('0x47')]=function(_0x385342,_0x48d5df){return db[_0x6ae0('0x2b')][_0x6ae0('0x47')](_0x385342[_0x6ae0('0x48')],{})[_0x6ae0('0x24')](respondWithResult(_0x48d5df,0xc9))[_0x6ae0('0x45')](handleError(_0x48d5df,null));};exports[_0x6ae0('0x23')]=function(_0x3ef9e0,_0x401670){if(_0x3ef9e0[_0x6ae0('0x48')]['id']){delete _0x3ef9e0['body']['id'];}return db[_0x6ae0('0x2b')][_0x6ae0('0x49')]({'where':{'id':_0x3ef9e0['params']['id']}})[_0x6ae0('0x24')](handleEntityNotFound(_0x401670,null))[_0x6ae0('0x24')](saveUpdates(_0x3ef9e0[_0x6ae0('0x48')],null))[_0x6ae0('0x24')](respondWithResult(_0x401670,null))[_0x6ae0('0x45')](handleError(_0x401670,null));};exports[_0x6ae0('0x4a')]=function(_0x35de4d,_0x2e0956){return db[_0x6ae0('0x2b')][_0x6ae0('0x49')]({'where':{'id':_0x35de4d[_0x6ae0('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e0956,null))[_0x6ae0('0x24')](removeEntity(_0x2e0956,null))['catch'](handleError(_0x2e0956,null));};exports[_0x6ae0('0x4b')]=function(_0x1ad593,_0x4e21f5,_0x1cea2e){var _0x1756cb={};var _0x2c216e={};var _0x47939c;var _0xe0fb9a;return db[_0x6ae0('0x2b')][_0x6ae0('0x4c')]({'where':{'id':_0x1ad593[_0x6ae0('0x46')]['id']}})[_0x6ae0('0x24')](handleEntityNotFound(_0x4e21f5,null))[_0x6ae0('0x24')](function(_0x4daf81){if(_0x4daf81){_0x47939c=_0x4daf81;_0x2c216e[_0x6ae0('0x30')]=_['keys'](db[_0x6ae0('0x4d')]['rawAttributes']);_0x2c216e[_0x6ae0('0x32')]=_['keys'](_0x1ad593['query']);_0x2c216e[_0x6ae0('0x3b')]=_[_0x6ae0('0x33')](_0x2c216e[_0x6ae0('0x30')],_0x2c216e[_0x6ae0('0x32')]);_0x1756cb['attributes']=_['intersection'](_0x2c216e[_0x6ae0('0x30')],qs['fields'](_0x1ad593[_0x6ae0('0x32')][_0x6ae0('0x35')]));_0x1756cb[_0x6ae0('0x34')]=_0x1756cb[_0x6ae0('0x34')][_0x6ae0('0x36')]?_0x1756cb[_0x6ae0('0x34')]:_0x2c216e[_0x6ae0('0x30')];_0x1756cb[_0x6ae0('0x4e')]=qs['sort'](_0x1ad593['query'][_0x6ae0('0x39')]);_0x1756cb[_0x6ae0('0x3a')]=qs['filters'](_[_0x6ae0('0x3c')](_0x1ad593['query'],_0x2c216e[_0x6ae0('0x3b')]));if(_0x1ad593[_0x6ae0('0x32')][_0x6ae0('0x3d')]){_0x1756cb[_0x6ae0('0x3a')]=_[_0x6ae0('0x3e')](_0x1756cb[_0x6ae0('0x3a')],{'$or':_[_0x6ae0('0x2a')](_0x1756cb['attributes'],function(_0x169369){var _0x14523f={};_0x14523f[_0x169369]={'$like':'%'+_0x1ad593[_0x6ae0('0x32')][_0x6ae0('0x3d')]+'%'};return _0x14523f;})});}_0x1756cb=_[_0x6ae0('0x3e')]({},_0x1756cb,_0x1ad593[_0x6ae0('0x40')]);return _0x47939c['getFields'](_0x1756cb);}})[_0x6ae0('0x24')](function(_0x51cc82){if(_0x51cc82){_0xe0fb9a=_0x51cc82['length'];if(!_0x1ad593[_0x6ae0('0x32')][_0x6ae0('0x37')](_0x6ae0('0x38'))){_0x1756cb[_0x6ae0('0x1c')]=qs[_0x6ae0('0x1c')](_0x1ad593['query'][_0x6ae0('0x1c')]);_0x1756cb['offset']=qs[_0x6ae0('0x1b')](_0x1ad593[_0x6ae0('0x32')][_0x6ae0('0x1b')]);}return _0x47939c[_0x6ae0('0x4b')](_0x1756cb);}})[_0x6ae0('0x24')](function(_0x108fa1){if(_0x108fa1){return _0x108fa1?{'count':_0xe0fb9a,'rows':_0x108fa1}:null;}})[_0x6ae0('0x24')](respondWithResult(_0x4e21f5,null))[_0x6ae0('0x45')](handleError(_0x4e21f5,null));};exports[_0x6ae0('0x4f')]=function(_0x143e5c,_0x11de0b,_0x842a62){var _0x584a2d={};var _0x1775e2={};var _0x38e455;var _0x5230e8;return db[_0x6ae0('0x2b')][_0x6ae0('0x4c')]({'where':{'id':_0x143e5c[_0x6ae0('0x46')]['id']}})['then'](handleEntityNotFound(_0x11de0b,null))[_0x6ae0('0x24')](function(_0x299d40){if(_0x299d40){_0x38e455=_0x299d40;_0x1775e2[_0x6ae0('0x30')]=_[_0x6ae0('0x31')](db[_0x6ae0('0x4d')]['rawAttributes']);_0x1775e2[_0x6ae0('0x32')]=_[_0x6ae0('0x31')](_0x143e5c[_0x6ae0('0x32')]);_0x1775e2[_0x6ae0('0x3b')]=_[_0x6ae0('0x33')](_0x1775e2['model'],_0x1775e2[_0x6ae0('0x32')]);_0x584a2d[_0x6ae0('0x34')]=_[_0x6ae0('0x33')](_0x1775e2[_0x6ae0('0x30')],qs[_0x6ae0('0x35')](_0x143e5c[_0x6ae0('0x32')][_0x6ae0('0x35')]));_0x584a2d[_0x6ae0('0x34')]=_0x584a2d[_0x6ae0('0x34')][_0x6ae0('0x36')]?_0x584a2d[_0x6ae0('0x34')]:_0x1775e2['model'];_0x584a2d['order']=qs[_0x6ae0('0x39')](_0x143e5c['query'][_0x6ae0('0x39')]);_0x584a2d[_0x6ae0('0x3a')]=qs['filters'](_['pick'](_0x143e5c[_0x6ae0('0x32')],_0x1775e2[_0x6ae0('0x3b')]));if(_0x143e5c[_0x6ae0('0x32')][_0x6ae0('0x3d')]){_0x584a2d[_0x6ae0('0x3a')]=_[_0x6ae0('0x3e')](_0x584a2d[_0x6ae0('0x3a')],{'$or':_[_0x6ae0('0x2a')](_0x584a2d[_0x6ae0('0x34')],function(_0x5277a9){var _0x53fc0f={};_0x53fc0f[_0x5277a9]={'$like':'%'+_0x143e5c['query'][_0x6ae0('0x3d')]+'%'};return _0x53fc0f;})});}_0x584a2d=_['merge']({},_0x584a2d,_0x143e5c[_0x6ae0('0x40')]);return _0x38e455[_0x6ae0('0x4f')](_0x584a2d);}})[_0x6ae0('0x24')](function(_0x4156de){if(_0x4156de){_0x5230e8=_0x4156de[_0x6ae0('0x36')];if(!_0x143e5c[_0x6ae0('0x32')][_0x6ae0('0x37')](_0x6ae0('0x38'))){_0x584a2d['limit']=qs['limit'](_0x143e5c['query'][_0x6ae0('0x1c')]);_0x584a2d[_0x6ae0('0x1b')]=qs[_0x6ae0('0x1b')](_0x143e5c['query']['offset']);}return _0x38e455[_0x6ae0('0x4f')](_0x584a2d);}})['then'](function(_0x5295a5){if(_0x5295a5){return _0x5295a5?{'count':_0x5230e8,'rows':_0x5295a5}:null;}})['then'](respondWithResult(_0x11de0b,null))[_0x6ae0('0x45')](handleError(_0x11de0b,null));};exports[_0x6ae0('0x50')]=function(_0x309c3d,_0x49dbb1,_0x3994ee){var _0x21d10d={};var _0x13bcac={};var _0x1baef3;var _0x1926cc;return db[_0x6ae0('0x2b')][_0x6ae0('0x4c')]({'where':{'id':_0x309c3d[_0x6ae0('0x46')]['id']}})[_0x6ae0('0x24')](handleEntityNotFound(_0x49dbb1,null))['then'](function(_0x190bf6){if(_0x190bf6){_0x1baef3=_0x190bf6;_0x13bcac[_0x6ae0('0x30')]=_['keys'](db[_0x6ae0('0x4d')]['rawAttributes']);_0x13bcac[_0x6ae0('0x32')]=_[_0x6ae0('0x31')](_0x309c3d['query']);_0x13bcac[_0x6ae0('0x3b')]=_[_0x6ae0('0x33')](_0x13bcac[_0x6ae0('0x30')],_0x13bcac[_0x6ae0('0x32')]);_0x21d10d[_0x6ae0('0x34')]=_['intersection'](_0x13bcac[_0x6ae0('0x30')],qs[_0x6ae0('0x35')](_0x309c3d[_0x6ae0('0x32')][_0x6ae0('0x35')]));_0x21d10d[_0x6ae0('0x34')]=_0x21d10d['attributes'][_0x6ae0('0x36')]?_0x21d10d['attributes']:_0x13bcac[_0x6ae0('0x30')];_0x21d10d['order']=qs[_0x6ae0('0x39')](_0x309c3d[_0x6ae0('0x32')][_0x6ae0('0x39')]);_0x21d10d[_0x6ae0('0x3a')]=qs['filters'](_[_0x6ae0('0x3c')](_0x309c3d[_0x6ae0('0x32')],_0x13bcac['filters']));if(_0x309c3d['query'][_0x6ae0('0x3d')]){_0x21d10d['where']=_['merge'](_0x21d10d['where'],{'$or':_[_0x6ae0('0x2a')](_0x21d10d[_0x6ae0('0x34')],function(_0x510e94){var _0x5b80fb={};_0x5b80fb[_0x510e94]={'$like':'%'+_0x309c3d[_0x6ae0('0x32')][_0x6ae0('0x3d')]+'%'};return _0x5b80fb;})});}_0x21d10d=_['merge']({},_0x21d10d,_0x309c3d[_0x6ae0('0x40')]);return _0x1baef3['getDescriptions'](_0x21d10d);}})[_0x6ae0('0x24')](function(_0x396b95){if(_0x396b95){_0x1926cc=_0x396b95['length'];if(!_0x309c3d[_0x6ae0('0x32')][_0x6ae0('0x37')]('nolimit')){_0x21d10d[_0x6ae0('0x1c')]=qs[_0x6ae0('0x1c')](_0x309c3d['query'][_0x6ae0('0x1c')]);_0x21d10d[_0x6ae0('0x1b')]=qs[_0x6ae0('0x1b')](_0x309c3d[_0x6ae0('0x32')][_0x6ae0('0x1b')]);}return _0x1baef3[_0x6ae0('0x50')](_0x21d10d);}})[_0x6ae0('0x24')](function(_0x4c72e4){if(_0x4c72e4){return _0x4c72e4?{'count':_0x1926cc,'rows':_0x4c72e4}:null;}})['then'](respondWithResult(_0x49dbb1,null))[_0x6ae0('0x45')](handleError(_0x49dbb1,null));};exports[_0x6ae0('0x51')]=function(_0x305f03,_0x4913c5,_0xd36e6f){var _0x411432={};var _0x2a9263={};var _0x14f180;var _0x73fb10;return db[_0x6ae0('0x2b')]['findOne']({'where':{'id':_0x305f03[_0x6ae0('0x46')]['id']}})[_0x6ae0('0x24')](handleEntityNotFound(_0x4913c5,null))[_0x6ae0('0x24')](function(_0x55c2ef){if(_0x55c2ef){_0x14f180=_0x55c2ef;_0x2a9263[_0x6ae0('0x30')]=_[_0x6ae0('0x31')](db[_0x6ae0('0x52')][_0x6ae0('0x2c')]);_0x2a9263[_0x6ae0('0x32')]=_[_0x6ae0('0x31')](_0x305f03[_0x6ae0('0x32')]);_0x2a9263[_0x6ae0('0x3b')]=_[_0x6ae0('0x33')](_0x2a9263[_0x6ae0('0x30')],_0x2a9263[_0x6ae0('0x32')]);_0x411432[_0x6ae0('0x34')]=_[_0x6ae0('0x33')](_0x2a9263[_0x6ae0('0x30')],qs['fields'](_0x305f03[_0x6ae0('0x32')][_0x6ae0('0x35')]));_0x411432[_0x6ae0('0x34')]=_0x411432[_0x6ae0('0x34')][_0x6ae0('0x36')]?_0x411432[_0x6ae0('0x34')]:_0x2a9263['model'];_0x411432[_0x6ae0('0x4e')]=qs[_0x6ae0('0x39')](_0x305f03['query']['sort']);_0x411432[_0x6ae0('0x3a')]=qs[_0x6ae0('0x3b')](_[_0x6ae0('0x3c')](_0x305f03[_0x6ae0('0x32')],_0x2a9263[_0x6ae0('0x3b')]));if(_0x305f03[_0x6ae0('0x32')][_0x6ae0('0x3d')]){_0x411432['where']=_[_0x6ae0('0x3e')](_0x411432[_0x6ae0('0x3a')],{'$or':_['map'](_0x411432['attributes'],function(_0x150c0e){var _0x20e843={};_0x20e843[_0x150c0e]={'$like':'%'+_0x305f03['query'][_0x6ae0('0x3d')]+'%'};return _0x20e843;})});}_0x411432=_[_0x6ae0('0x3e')]({},_0x411432,_0x305f03[_0x6ae0('0x40')]);return _0x14f180['getTags'](_0x411432);}})[_0x6ae0('0x24')](function(_0x34443b){if(_0x34443b){_0x73fb10=_0x34443b['length'];if(!_0x305f03[_0x6ae0('0x32')][_0x6ae0('0x37')](_0x6ae0('0x38'))){_0x411432['limit']=qs[_0x6ae0('0x1c')](_0x305f03[_0x6ae0('0x32')]['limit']);_0x411432[_0x6ae0('0x1b')]=qs[_0x6ae0('0x1b')](_0x305f03[_0x6ae0('0x32')][_0x6ae0('0x1b')]);}return _0x14f180[_0x6ae0('0x51')](_0x411432);}})[_0x6ae0('0x24')](function(_0x15b2ed){if(_0x15b2ed){return _0x15b2ed?{'count':_0x73fb10,'rows':_0x15b2ed}:null;}})[_0x6ae0('0x24')](respondWithResult(_0x4913c5,null))[_0x6ae0('0x45')](handleError(_0x4913c5,null));};exports['setTags']=function(_0x10d8db,_0x550d57,_0x1af650){if(_0x10d8db['body']['id']){delete _0x10d8db[_0x6ae0('0x48')]['id'];}return db[_0x6ae0('0x2b')][_0x6ae0('0x4c')]({'where':{'id':_0x10d8db[_0x6ae0('0x46')]['id']}})[_0x6ae0('0x24')](handleEntityNotFound(_0x550d57,null))[_0x6ae0('0x24')](function(_0x314bce){if(_0x314bce){return _0x314bce[_0x6ae0('0x53')](_0x10d8db[_0x6ae0('0x48')][_0x6ae0('0x54')]||[]);}return null;})[_0x6ae0('0x24')](respondWithResult(_0x550d57,null))['catch'](handleError(_0x550d57,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6ab7ffa..df8bfe2 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 _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x23cd38,_0x469e53){_0x23cd38=_0x23cd38-0x0;var _0x4ef98b=_0xbbbc[_0x23cd38];return _0x4ef98b;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x210b46,_0x52a05f){var _0x203df2=function(_0x3421ea){while(--_0x3421ea){_0x210b46['push'](_0x210b46['shift']());}};_0x203df2(++_0x52a05f);}(_0x5204,0xdf));var _0x4520=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x5204[_0x5c811c];return _0x5df3af;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'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 3ec7ee6..42360a8 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 _0x94c8=['info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0xab2fa1,_0x65e0c6){var _0x33c287=function(_0x3016aa){while(--_0x3016aa){_0xab2fa1['push'](_0xab2fa1['shift']());}};_0x33c287(++_0x65e0c6);}(_0x94c8,0x1d1));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x894c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x894c('0x1'));var fs=require('fs');var Redis=require(_0x894c('0x2'));var db=require(_0x894c('0x3'))['db'];var utils=require(_0x894c('0x4'));var logger=require(_0x894c('0x5'))(_0x894c('0x6'));var config=require(_0x894c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x894c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x497219,_0x1739d9,_0x7b0732){return new BPromise(function(_0x39cf0a,_0x453269){return client['request'](_0x497219,_0x7b0732)[_0x894c('0x9')](function(_0x5c755c){logger[_0x894c('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1739d9,'request\x20sent');logger[_0x894c('0xb')](_0x894c('0xc'),_0x1739d9,_0x894c('0xd'),JSON['stringify'](_0x5c755c));if(_0x5c755c['error']){if(_0x5c755c[_0x894c('0xe')][_0x894c('0xf')]===0x1f4){logger[_0x894c('0xe')](_0x894c('0x10'),_0x1739d9,_0x5c755c[_0x894c('0xe')][_0x894c('0x11')]);return _0x453269(_0x5c755c[_0x894c('0xe')][_0x894c('0x11')]);}logger[_0x894c('0xe')](_0x894c('0x10'),_0x1739d9,_0x5c755c[_0x894c('0xe')][_0x894c('0x11')]);return _0x39cf0a(_0x5c755c[_0x894c('0xe')][_0x894c('0x11')]);}else{logger[_0x894c('0xa')](_0x894c('0x10'),_0x1739d9,_0x894c('0xd'));_0x39cf0a(_0x5c755c[_0x894c('0x12')][_0x894c('0x11')]);}})['catch'](function(_0x4a8354){logger[_0x894c('0xe')](_0x894c('0x10'),_0x1739d9,_0x4a8354);_0x453269(_0x4a8354);});});} \ No newline at end of file +var _0x352a=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x352a,0x8e));var _0xa352=function(_0x49e444,_0x1afd8f){_0x49e444=_0x49e444-0x0;var _0x3d578e=_0x352a[_0x49e444];return _0x3d578e;};'use strict';var _=require('lodash');var util=require(_0xa352('0x0'));var moment=require(_0xa352('0x1'));var BPromise=require(_0xa352('0x2'));var rs=require(_0xa352('0x3'));var fs=require('fs');var Redis=require(_0xa352('0x4'));var db=require(_0xa352('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa352('0x6'))(_0xa352('0x7'));var config=require(_0xa352('0x8'));var jayson=require(_0xa352('0x9'));var client=jayson['client'][_0xa352('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4999ff,_0x5d1767,_0x4b9f63){return new BPromise(function(_0x2566cd,_0x1603e1){return client[_0xa352('0xb')](_0x4999ff,_0x4b9f63)['then'](function(_0x26351f){logger[_0xa352('0xc')](_0xa352('0xd'),_0x5d1767,_0xa352('0xe'));logger[_0xa352('0xf')](_0xa352('0x10'),_0x5d1767,_0xa352('0xe'),JSON[_0xa352('0x11')](_0x26351f));if(_0x26351f[_0xa352('0x12')]){if(_0x26351f[_0xa352('0x12')][_0xa352('0x13')]===0x1f4){logger['error'](_0xa352('0xd'),_0x5d1767,_0x26351f[_0xa352('0x12')][_0xa352('0x14')]);return _0x1603e1(_0x26351f[_0xa352('0x12')]['message']);}logger['error'](_0xa352('0xd'),_0x5d1767,_0x26351f[_0xa352('0x12')][_0xa352('0x14')]);return _0x2566cd(_0x26351f['error'][_0xa352('0x14')]);}else{logger[_0xa352('0xc')](_0xa352('0xd'),_0x5d1767,_0xa352('0xe'));_0x2566cd(_0x26351f['result'][_0xa352('0x14')]);}})[_0xa352('0x15')](function(_0x4cbba1){logger[_0xa352('0x12')](_0xa352('0xd'),_0x5d1767,_0x4cbba1);_0x1603e1(_0x4cbba1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fff377d..7d41921 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 _0x8f6e=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ba38a,_0x132834){var _0x28eebe=function(_0x56946a){while(--_0x56946a){_0x5ba38a['push'](_0x5ba38a['shift']());}};_0x28eebe(++_0x132834);}(_0x8f6e,0x182));var _0xe8f6=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0x8f6e[_0x405778];return _0x341735;};'use strict';var multer=require(_0xe8f6('0x0'));var util=require(_0xe8f6('0x1'));var path=require('path');var timeout=require(_0xe8f6('0x2'));var express=require(_0xe8f6('0x3'));var router=express[_0xe8f6('0x4')]();var fs_extra=require(_0xe8f6('0x5'));var auth=require(_0xe8f6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe8f6('0x7'));var controller=require(_0xe8f6('0x8'));router[_0xe8f6('0x9')]('/',auth[_0xe8f6('0xa')](),controller[_0xe8f6('0xb')]);router[_0xe8f6('0x9')](_0xe8f6('0xc'),auth[_0xe8f6('0xa')](),controller[_0xe8f6('0xd')]);router[_0xe8f6('0xe')]('/',auth[_0xe8f6('0xa')](),controller[_0xe8f6('0xf')]);router[_0xe8f6('0x10')](_0xe8f6('0xc'),auth[_0xe8f6('0xa')](),controller[_0xe8f6('0x11')]);router[_0xe8f6('0x12')](_0xe8f6('0xc'),auth[_0xe8f6('0xa')](),controller['destroy']);module[_0xe8f6('0x13')]=router; \ No newline at end of file +var _0xff5b=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x118763,_0x77d9e7){var _0x499ed9=function(_0x36e600){while(--_0x36e600){_0x118763['push'](_0x118763['shift']());}};_0x499ed9(++_0x77d9e7);}(_0xff5b,0xc1));var _0xbff5=function(_0x3467d5,_0x2178e4){_0x3467d5=_0x3467d5-0x0;var _0x387f2a=_0xff5b[_0x3467d5];return _0x387f2a;};'use strict';var multer=require(_0xbff5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbff5('0x1'));var express=require(_0xbff5('0x2'));var router=express[_0xbff5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbff5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbff5('0x5'));var controller=require(_0xbff5('0x6'));router[_0xbff5('0x7')]('/',auth[_0xbff5('0x8')](),controller[_0xbff5('0x9')]);router['get'](_0xbff5('0xa'),auth[_0xbff5('0x8')](),controller[_0xbff5('0xb')]);router[_0xbff5('0xc')]('/',auth[_0xbff5('0x8')](),controller[_0xbff5('0xd')]);router['put'](_0xbff5('0xa'),auth[_0xbff5('0x8')](),controller[_0xbff5('0xe')]);router[_0xbff5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbff5('0x10')]);module[_0xbff5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 46e41d6..177e510 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 _0x3fc2=['ENUM','customVariable','sequelize','exports','string','variable','keyValue','picklist','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3fc2,0x185));var _0x23fc=function(_0x5133dd,_0x1e12cc){_0x5133dd=_0x5133dd-0x0;var _0x58a982=_0x3fc2[_0x5133dd];return _0x58a982;};'use strict';var Sequelize=require(_0x23fc('0x0'));module[_0x23fc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x23fc('0x2'),_0x23fc('0x3'),'customVariable',_0x23fc('0x4'),_0x23fc('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x23fc('0x6')]},'key':{'type':Sequelize[_0x23fc('0x6')]},'keyType':{'type':Sequelize[_0x23fc('0x7')](_0x23fc('0x2'),_0x23fc('0x3'),_0x23fc('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x23fc('0x6')]},'nameField':{'type':Sequelize[_0x23fc('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x23fc('0x6')]}}; \ No newline at end of file +var _0x456c=['string','variable','customVariable','STRING','BOOLEAN'];(function(_0x296717,_0x39dd1d){var _0xdebcad=function(_0x4688ec){while(--_0x4688ec){_0x296717['push'](_0x296717['shift']());}};_0xdebcad(++_0x39dd1d);}(_0x456c,0x172));var _0xc456=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x456c[_0x2b5b44];return _0x32cb66;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xc456('0x0'),_0xc456('0x1'),_0xc456('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc456('0x3')]},'key':{'type':Sequelize[_0xc456('0x3')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc456('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xc456('0x3')]},'idField':{'type':Sequelize[_0xc456('0x3')]},'nameField':{'type':Sequelize[_0xc456('0x3')]},'customField':{'type':Sequelize[_0xc456('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc456('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 60cc190..5e598ab 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 _0x4e4d=['util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','fields','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xab264e,_0x21d1bf){var _0x5b4624=function(_0x506de8){while(--_0x506de8){_0xab264e['push'](_0xab264e['shift']());}};_0x5b4624(++_0x21d1bf);}(_0x4e4d,0x1c6));var _0xd4e4=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x4e4d[_0x2c0dc0];return _0x4c0990;};'use strict';var emlformat=require(_0xd4e4('0x0'));var rimraf=require(_0xd4e4('0x1'));var zipdir=require(_0xd4e4('0x2'));var jsonpatch=require(_0xd4e4('0x3'));var rp=require(_0xd4e4('0x4'));var moment=require(_0xd4e4('0x5'));var BPromise=require(_0xd4e4('0x6'));var Mustache=require(_0xd4e4('0x7'));var util=require(_0xd4e4('0x8'));var path=require(_0xd4e4('0x9'));var sox=require(_0xd4e4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4e4('0xb'));var squel=require(_0xd4e4('0xc'));var crypto=require(_0xd4e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4e4('0xe'));var toCsv=require(_0xd4e4('0xf'));var querystring=require(_0xd4e4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd4e4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd4e4('0x12'));var as=require(_0xd4e4('0x13'));var hardwareService=require(_0xd4e4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd4e4('0x15'));var config=require(_0xd4e4('0x16'));var licenseUtil=require(_0xd4e4('0x17'));var db=require(_0xd4e4('0x18'))['db'];function respondWithStatusCode(_0x3c441c,_0x1b08f5){_0x1b08f5=_0x1b08f5||0xcc;return function(_0x530c16){if(_0x530c16){return _0x3c441c['sendStatus'](_0x1b08f5);}return _0x3c441c[_0xd4e4('0x19')](_0x1b08f5)[_0xd4e4('0x1a')]();};}function respondWithResult(_0x545ad5,_0x22250c){_0x22250c=_0x22250c||0xc8;return function(_0x2bb6a8){if(_0x2bb6a8){return _0x545ad5['status'](_0x22250c)[_0xd4e4('0x1b')](_0x2bb6a8);}};}function respondWithFilteredResult(_0x22597f,_0x5bc5ba){return function(_0x2af241){if(_0x2af241){var _0x2dfe6c=typeof _0x5bc5ba[_0xd4e4('0x1c')]==='undefined'&&typeof _0x5bc5ba[_0xd4e4('0x1d')]===_0xd4e4('0x1e');var _0x42002c=_0x2af241[_0xd4e4('0x1f')];var _0x39b8a8=_0x2dfe6c?0x0:_0x5bc5ba['offset'];var _0xe771ff=_0x2dfe6c?_0x2af241[_0xd4e4('0x1f')]:_0x5bc5ba[_0xd4e4('0x1c')]+_0x5bc5ba['limit'];var _0x2fe87;if(_0xe771ff>=_0x42002c){_0xe771ff=_0x42002c;_0x2fe87=0xc8;}else{_0x2fe87=0xce;}_0x22597f[_0xd4e4('0x19')](_0x2fe87);return _0x22597f[_0xd4e4('0x20')](_0xd4e4('0x21'),_0x39b8a8+'-'+_0xe771ff+'/'+_0x42002c)[_0xd4e4('0x1b')](_0x2af241);}return null;};}function patchUpdates(_0x12282c){return function(_0x26fab3){try{jsonpatch[_0xd4e4('0x22')](_0x26fab3,_0x12282c,!![]);}catch(_0x255ce6){return BPromise[_0xd4e4('0x23')](_0x255ce6);}return _0x26fab3[_0xd4e4('0x24')]();};}function saveUpdates(_0x9c29c6,_0x1bf6b4){return function(_0x115756){if(_0x115756){return _0x115756[_0xd4e4('0x25')](_0x9c29c6)[_0xd4e4('0x26')](function(_0x5f0dda){return _0x5f0dda;});}return null;};}function removeEntity(_0x5840f5,_0x384389){return function(_0x281e97){if(_0x281e97){return _0x281e97[_0xd4e4('0x27')]()[_0xd4e4('0x26')](function(){_0x5840f5[_0xd4e4('0x19')](0xcc)[_0xd4e4('0x1a')]();});}};}function handleEntityNotFound(_0x52f62d,_0x176fe1){return function(_0x27da67){if(!_0x27da67){_0x52f62d[_0xd4e4('0x28')](0x194);}return _0x27da67;};}function handleError(_0x1e2dd5,_0x1837c4){_0x1837c4=_0x1837c4||0x1f4;return function(_0x1c9c11){logger[_0xd4e4('0x29')](_0x1c9c11[_0xd4e4('0x2a')]);if(_0x1c9c11[_0xd4e4('0x2b')]){delete _0x1c9c11['name'];}_0x1e2dd5[_0xd4e4('0x19')](_0x1837c4)[_0xd4e4('0x2c')](_0x1c9c11);};}exports['index']=function(_0x2708fa,_0x3be9ff){var _0x289fac={},_0x19a81e={},_0x36230f={'count':0x0,'rows':[]};var _0x575e45=_[_0xd4e4('0x2d')](db[_0xd4e4('0x2e')][_0xd4e4('0x2f')],function(_0x5062b0){return{'name':_0x5062b0[_0xd4e4('0x30')],'type':_0x5062b0[_0xd4e4('0x31')][_0xd4e4('0x32')]};});_0x19a81e[_0xd4e4('0x33')]=_[_0xd4e4('0x2d')](_0x575e45,_0xd4e4('0x2b'));_0x19a81e[_0xd4e4('0x34')]=_[_0xd4e4('0x35')](_0x2708fa['query']);_0x19a81e[_0xd4e4('0x36')]=_[_0xd4e4('0x37')](_0x19a81e['model'],_0x19a81e['query']);_0x289fac['attributes']=_['intersection'](_0x19a81e[_0xd4e4('0x33')],qs['fields'](_0x2708fa[_0xd4e4('0x34')]['fields']));_0x289fac[_0xd4e4('0x38')]=_0x289fac[_0xd4e4('0x38')][_0xd4e4('0x39')]?_0x289fac['attributes']:_0x19a81e[_0xd4e4('0x33')];if(!_0x2708fa[_0xd4e4('0x34')][_0xd4e4('0x3a')](_0xd4e4('0x3b'))){_0x289fac[_0xd4e4('0x1d')]=qs[_0xd4e4('0x1d')](_0x2708fa['query']['limit']);_0x289fac[_0xd4e4('0x1c')]=qs[_0xd4e4('0x1c')](_0x2708fa['query'][_0xd4e4('0x1c')]);}_0x289fac['order']=qs['sort'](_0x2708fa['query'][_0xd4e4('0x3c')]);_0x289fac[_0xd4e4('0x3d')]=qs[_0xd4e4('0x36')](_[_0xd4e4('0x3e')](_0x2708fa[_0xd4e4('0x34')],_0x19a81e[_0xd4e4('0x36')]),_0x575e45);if(_0x2708fa['query'][_0xd4e4('0x3f')]){_0x289fac[_0xd4e4('0x3d')]=_['merge'](_0x289fac['where'],{'$or':_[_0xd4e4('0x2d')](_0x575e45,function(_0x1192ba){if(_0x1192ba[_0xd4e4('0x31')]!==_0xd4e4('0x40')){var _0x4859c8={};_0x4859c8[_0x1192ba['name']]={'$like':'%'+_0x2708fa[_0xd4e4('0x34')]['filter']+'%'};return _0x4859c8;}})});}_0x289fac=_[_0xd4e4('0x41')]({},_0x289fac,_0x2708fa[_0xd4e4('0x42')]);var _0x471b44={'where':_0x289fac['where']};return db[_0xd4e4('0x2e')][_0xd4e4('0x1f')](_0x471b44)[_0xd4e4('0x26')](function(_0x1d3965){_0x36230f[_0xd4e4('0x1f')]=_0x1d3965;if(_0x2708fa[_0xd4e4('0x34')]['includeAll']){_0x289fac[_0xd4e4('0x43')]=[{'all':!![]}];}return db[_0xd4e4('0x2e')][_0xd4e4('0x44')](_0x289fac);})['then'](function(_0x55187b){_0x36230f['rows']=_0x55187b;return _0x36230f;})[_0xd4e4('0x26')](respondWithFilteredResult(_0x3be9ff,_0x289fac))[_0xd4e4('0x45')](handleError(_0x3be9ff,null));};exports[_0xd4e4('0x46')]=function(_0x2546d8,_0x1ce87b){var _0x27ada7={'raw':!![],'where':{'id':_0x2546d8[_0xd4e4('0x47')]['id']}},_0x4ae80d={};_0x4ae80d[_0xd4e4('0x33')]=_[_0xd4e4('0x35')](db[_0xd4e4('0x2e')][_0xd4e4('0x2f')]);_0x4ae80d[_0xd4e4('0x34')]=_[_0xd4e4('0x35')](_0x2546d8[_0xd4e4('0x34')]);_0x4ae80d['filters']=_[_0xd4e4('0x37')](_0x4ae80d['model'],_0x4ae80d[_0xd4e4('0x34')]);_0x27ada7[_0xd4e4('0x38')]=_[_0xd4e4('0x37')](_0x4ae80d[_0xd4e4('0x33')],qs[_0xd4e4('0x48')](_0x2546d8[_0xd4e4('0x34')]['fields']));_0x27ada7[_0xd4e4('0x38')]=_0x27ada7['attributes'][_0xd4e4('0x39')]?_0x27ada7[_0xd4e4('0x38')]:_0x4ae80d[_0xd4e4('0x33')];if(_0x2546d8[_0xd4e4('0x34')][_0xd4e4('0x49')]){_0x27ada7[_0xd4e4('0x43')]=[{'all':!![]}];}_0x27ada7=_[_0xd4e4('0x41')]({},_0x27ada7,_0x2546d8[_0xd4e4('0x42')]);return db[_0xd4e4('0x2e')]['find'](_0x27ada7)[_0xd4e4('0x26')](handleEntityNotFound(_0x1ce87b,null))[_0xd4e4('0x26')](respondWithResult(_0x1ce87b,null))['catch'](handleError(_0x1ce87b,null));};exports['create']=function(_0x836fe5,_0x55e2d3){return db[_0xd4e4('0x2e')][_0xd4e4('0x4a')](_0x836fe5[_0xd4e4('0x4b')],{})['then'](respondWithResult(_0x55e2d3,0xc9))[_0xd4e4('0x45')](handleError(_0x55e2d3,null));};exports['update']=function(_0x2b892f,_0x344f65){if(_0x2b892f['body']['id']){delete _0x2b892f[_0xd4e4('0x4b')]['id'];}return db[_0xd4e4('0x2e')]['find']({'where':{'id':_0x2b892f[_0xd4e4('0x47')]['id']}})[_0xd4e4('0x26')](handleEntityNotFound(_0x344f65,null))['then'](saveUpdates(_0x2b892f[_0xd4e4('0x4b')],null))[_0xd4e4('0x26')](respondWithResult(_0x344f65,null))[_0xd4e4('0x45')](handleError(_0x344f65,null));};exports[_0xd4e4('0x27')]=function(_0x385be7,_0x4688b9){return db[_0xd4e4('0x2e')][_0xd4e4('0x4c')]({'where':{'id':_0x385be7[_0xd4e4('0x47')]['id']}})[_0xd4e4('0x26')](handleEntityNotFound(_0x4688b9,null))[_0xd4e4('0x26')](removeEntity(_0x4688b9,null))['catch'](handleError(_0x4688b9,null));}; \ No newline at end of file +var _0x8ea4=['length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','then','sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x8ea4,0x1b2));var _0x48ea=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x8ea4[_0x5c814d];return _0x89b71;};'use strict';var emlformat=require(_0x48ea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x48ea('0x1'));var rp=require(_0x48ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48ea('0x3'));var path=require(_0x48ea('0x4'));var sox=require(_0x48ea('0x5'));var csv=require(_0x48ea('0x6'));var ejs=require(_0x48ea('0x7'));var fs=require('fs');var fs_extra=require(_0x48ea('0x8'));var _=require(_0x48ea('0x9'));var squel=require(_0x48ea('0xa'));var crypto=require(_0x48ea('0xb'));var jsforce=require(_0x48ea('0xc'));var deskjs=require(_0x48ea('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x48ea('0xe'));var Redis=require(_0x48ea('0xf'));var authService=require(_0x48ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ea('0x11'));var logger=require('../../config/logger')(_0x48ea('0x12'));var utils=require('../../config/utils');var config=require(_0x48ea('0x13'));var licenseUtil=require(_0x48ea('0x14'));var db=require(_0x48ea('0x15'))['db'];function respondWithStatusCode(_0x47690c,_0x500851){_0x500851=_0x500851||0xcc;return function(_0x394017){if(_0x394017){return _0x47690c['sendStatus'](_0x500851);}return _0x47690c['status'](_0x500851)[_0x48ea('0x16')]();};}function respondWithResult(_0x203026,_0x31a1a9){_0x31a1a9=_0x31a1a9||0xc8;return function(_0x54df49){if(_0x54df49){return _0x203026['status'](_0x31a1a9)[_0x48ea('0x17')](_0x54df49);}};}function respondWithFilteredResult(_0x669d51,_0x35b40f){return function(_0x37f7d6){if(_0x37f7d6){var _0x581830=typeof _0x35b40f['offset']==='undefined'&&typeof _0x35b40f[_0x48ea('0x18')]===_0x48ea('0x19');var _0x2c45fe=_0x37f7d6[_0x48ea('0x1a')];var _0x2a2476=_0x581830?0x0:_0x35b40f[_0x48ea('0x1b')];var _0x534a89=_0x581830?_0x37f7d6[_0x48ea('0x1a')]:_0x35b40f[_0x48ea('0x1b')]+_0x35b40f[_0x48ea('0x18')];var _0x5f00c0;if(_0x534a89>=_0x2c45fe){_0x534a89=_0x2c45fe;_0x5f00c0=0xc8;}else{_0x5f00c0=0xce;}_0x669d51[_0x48ea('0x1c')](_0x5f00c0);return _0x669d51['set'](_0x48ea('0x1d'),_0x2a2476+'-'+_0x534a89+'/'+_0x2c45fe)[_0x48ea('0x17')](_0x37f7d6);}return null;};}function patchUpdates(_0x4777e9){return function(_0x4d51b6){try{jsonpatch[_0x48ea('0x1e')](_0x4d51b6,_0x4777e9,!![]);}catch(_0x539675){return BPromise['reject'](_0x539675);}return _0x4d51b6[_0x48ea('0x1f')]();};}function saveUpdates(_0x1b420f,_0x112a6a){return function(_0x423ff0){if(_0x423ff0){return _0x423ff0['update'](_0x1b420f)[_0x48ea('0x20')](function(_0x2a5130){return _0x2a5130;});}return null;};}function removeEntity(_0x38b5ff,_0x30c71b){return function(_0x17cf50){if(_0x17cf50){return _0x17cf50['destroy']()[_0x48ea('0x20')](function(){_0x38b5ff[_0x48ea('0x1c')](0xcc)[_0x48ea('0x16')]();});}};}function handleEntityNotFound(_0x18ab8a,_0x26be62){return function(_0x48fe8e){if(!_0x48fe8e){_0x18ab8a[_0x48ea('0x21')](0x194);}return _0x48fe8e;};}function handleError(_0x144fda,_0xcd26fc){_0xcd26fc=_0xcd26fc||0x1f4;return function(_0x53a7a1){logger['error'](_0x53a7a1[_0x48ea('0x22')]);if(_0x53a7a1['name']){delete _0x53a7a1[_0x48ea('0x23')];}_0x144fda[_0x48ea('0x1c')](_0xcd26fc)[_0x48ea('0x24')](_0x53a7a1);};}exports[_0x48ea('0x25')]=function(_0x243656,_0x25042c){var _0x54ae66={},_0x12b0e0={},_0x26851c={'count':0x0,'rows':[]};var _0x49eddb=_[_0x48ea('0x26')](db[_0x48ea('0x27')][_0x48ea('0x28')],function(_0x5dfe68){return{'name':_0x5dfe68[_0x48ea('0x29')],'type':_0x5dfe68['type'][_0x48ea('0x2a')]};});_0x12b0e0['model']=_['map'](_0x49eddb,_0x48ea('0x23'));_0x12b0e0[_0x48ea('0x2b')]=_[_0x48ea('0x2c')](_0x243656[_0x48ea('0x2b')]);_0x12b0e0['filters']=_['intersection'](_0x12b0e0[_0x48ea('0x2d')],_0x12b0e0[_0x48ea('0x2b')]);_0x54ae66[_0x48ea('0x2e')]=_[_0x48ea('0x2f')](_0x12b0e0[_0x48ea('0x2d')],qs[_0x48ea('0x30')](_0x243656['query'][_0x48ea('0x30')]));_0x54ae66['attributes']=_0x54ae66[_0x48ea('0x2e')][_0x48ea('0x31')]?_0x54ae66[_0x48ea('0x2e')]:_0x12b0e0['model'];if(!_0x243656[_0x48ea('0x2b')][_0x48ea('0x32')](_0x48ea('0x33'))){_0x54ae66['limit']=qs['limit'](_0x243656[_0x48ea('0x2b')]['limit']);_0x54ae66['offset']=qs[_0x48ea('0x1b')](_0x243656[_0x48ea('0x2b')][_0x48ea('0x1b')]);}_0x54ae66['order']=qs[_0x48ea('0x34')](_0x243656[_0x48ea('0x2b')]['sort']);_0x54ae66[_0x48ea('0x35')]=qs[_0x48ea('0x36')](_[_0x48ea('0x37')](_0x243656[_0x48ea('0x2b')],_0x12b0e0[_0x48ea('0x36')]),_0x49eddb);if(_0x243656[_0x48ea('0x2b')]['filter']){_0x54ae66[_0x48ea('0x35')]=_[_0x48ea('0x38')](_0x54ae66[_0x48ea('0x35')],{'$or':_[_0x48ea('0x26')](_0x49eddb,function(_0x5c99cc){if(_0x5c99cc[_0x48ea('0x39')]!=='VIRTUAL'){var _0x4a1ca0={};_0x4a1ca0[_0x5c99cc[_0x48ea('0x23')]]={'$like':'%'+_0x243656['query']['filter']+'%'};return _0x4a1ca0;}})});}_0x54ae66=_['merge']({},_0x54ae66,_0x243656[_0x48ea('0x3a')]);var _0x45ccd9={'where':_0x54ae66[_0x48ea('0x35')]};return db[_0x48ea('0x27')][_0x48ea('0x1a')](_0x45ccd9)[_0x48ea('0x20')](function(_0x5a4785){_0x26851c[_0x48ea('0x1a')]=_0x5a4785;if(_0x243656[_0x48ea('0x2b')][_0x48ea('0x3b')]){_0x54ae66[_0x48ea('0x3c')]=[{'all':!![]}];}return db[_0x48ea('0x27')][_0x48ea('0x3d')](_0x54ae66);})[_0x48ea('0x20')](function(_0x5d8db5){_0x26851c['rows']=_0x5d8db5;return _0x26851c;})[_0x48ea('0x20')](respondWithFilteredResult(_0x25042c,_0x54ae66))[_0x48ea('0x3e')](handleError(_0x25042c,null));};exports[_0x48ea('0x3f')]=function(_0x1d1867,_0x400258){var _0x43f46a={'raw':!![],'where':{'id':_0x1d1867[_0x48ea('0x40')]['id']}},_0x4f34a1={};_0x4f34a1['model']=_['keys'](db[_0x48ea('0x27')][_0x48ea('0x28')]);_0x4f34a1[_0x48ea('0x2b')]=_[_0x48ea('0x2c')](_0x1d1867['query']);_0x4f34a1[_0x48ea('0x36')]=_[_0x48ea('0x2f')](_0x4f34a1['model'],_0x4f34a1[_0x48ea('0x2b')]);_0x43f46a[_0x48ea('0x2e')]=_[_0x48ea('0x2f')](_0x4f34a1['model'],qs[_0x48ea('0x30')](_0x1d1867[_0x48ea('0x2b')][_0x48ea('0x30')]));_0x43f46a[_0x48ea('0x2e')]=_0x43f46a[_0x48ea('0x2e')][_0x48ea('0x31')]?_0x43f46a[_0x48ea('0x2e')]:_0x4f34a1[_0x48ea('0x2d')];if(_0x1d1867['query'][_0x48ea('0x3b')]){_0x43f46a[_0x48ea('0x3c')]=[{'all':!![]}];}_0x43f46a=_[_0x48ea('0x38')]({},_0x43f46a,_0x1d1867[_0x48ea('0x3a')]);return db[_0x48ea('0x27')][_0x48ea('0x41')](_0x43f46a)['then'](handleEntityNotFound(_0x400258,null))[_0x48ea('0x20')](respondWithResult(_0x400258,null))['catch'](handleError(_0x400258,null));};exports[_0x48ea('0x42')]=function(_0x47781d,_0x1b392c){return db[_0x48ea('0x27')]['create'](_0x47781d[_0x48ea('0x43')],{})[_0x48ea('0x20')](respondWithResult(_0x1b392c,0xc9))[_0x48ea('0x3e')](handleError(_0x1b392c,null));};exports['update']=function(_0x1eed77,_0x45786d){if(_0x1eed77[_0x48ea('0x43')]['id']){delete _0x1eed77['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x1eed77['params']['id']}})['then'](handleEntityNotFound(_0x45786d,null))[_0x48ea('0x20')](saveUpdates(_0x1eed77[_0x48ea('0x43')],null))[_0x48ea('0x20')](respondWithResult(_0x45786d,null))[_0x48ea('0x3e')](handleError(_0x45786d,null));};exports[_0x48ea('0x44')]=function(_0x434d48,_0x3b2c1d){return db['ZendeskField'][_0x48ea('0x41')]({'where':{'id':_0x434d48[_0x48ea('0x40')]['id']}})[_0x48ea('0x20')](handleEntityNotFound(_0x3b2c1d,null))['then'](removeEntity(_0x3b2c1d,null))[_0x48ea('0x3e')](handleError(_0x3b2c1d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 457cb96..d353b53 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 _0xe30f=['moment','bluebird','request-promise','path','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','../../config/logger','api'];(function(_0x25a19a,_0x536079){var _0x9d8a38=function(_0x55a45c){while(--_0x55a45c){_0x25a19a['push'](_0x25a19a['shift']());}};_0x9d8a38(++_0x536079);}(_0xe30f,0xbc));var _0xfe30=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe30f[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe30('0x0'))(_0xfe30('0x1'));var moment=require(_0xfe30('0x2'));var BPromise=require(_0xfe30('0x3'));var rp=require(_0xfe30('0x4'));var fs=require('fs');var path=require(_0xfe30('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe30('0x6'));module['exports']=function(_0x1c0a35,_0x371744){return _0x1c0a35[_0xfe30('0x7')]('ZendeskField',attributes,{'tableName':_0xfe30('0x8'),'paranoid':![],'indexes':[{'name':_0xfe30('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x08a6=['rimraf','./intZendeskField.attributes','exports','int_zendesk_fields','lodash','moment','bluebird','request-promise','path'];(function(_0x3bb847,_0x55825d){var _0xaabc46=function(_0x3c4de3){while(--_0x3c4de3){_0x3bb847['push'](_0x3bb847['shift']());}};_0xaabc46(++_0x55825d);}(_0x08a6,0x67));var _0x608a=function(_0x4c6f7e,_0xad2dfa){_0x4c6f7e=_0x4c6f7e-0x0;var _0x49ba40=_0x08a6[_0x4c6f7e];return _0x49ba40;};'use strict';var _=require(_0x608a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x608a('0x1'));var BPromise=require(_0x608a('0x2'));var rp=require(_0x608a('0x3'));var fs=require('fs');var path=require(_0x608a('0x4'));var rimraf=require(_0x608a('0x5'));var config=require('../../config/environment');var attributes=require(_0x608a('0x6'));module[_0x608a('0x7')]=function(_0x1d0cd7,_0xaa9512){return _0x1d0cd7['define']('ZendeskField',attributes,{'tableName':_0x608a('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index fa7ec54..7f1cb70 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 _0x6864=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x6864,0x1be));var _0x4686=function(_0x462fac,_0x73b34b){_0x462fac=_0x462fac-0x0;var _0x88b478=_0x6864[_0x462fac];return _0x88b478;};'use strict';var _=require(_0x4686('0x0'));var util=require(_0x4686('0x1'));var moment=require(_0x4686('0x2'));var BPromise=require(_0x4686('0x3'));var rs=require(_0x4686('0x4'));var fs=require('fs');var Redis=require(_0x4686('0x5'));var db=require(_0x4686('0x6'))['db'];var utils=require(_0x4686('0x7'));var logger=require(_0x4686('0x8'))(_0x4686('0x9'));var config=require(_0x4686('0xa'));var jayson=require(_0x4686('0xb'));var client=jayson[_0x4686('0xc')][_0x4686('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23b075,_0x273132,_0x53af3b){return new BPromise(function(_0x5150ed,_0x175e93){return client[_0x4686('0xe')](_0x23b075,_0x53af3b)[_0x4686('0xf')](function(_0x30e377){logger[_0x4686('0x10')](_0x4686('0x11'),_0x273132,_0x4686('0x12'));logger[_0x4686('0x13')](_0x4686('0x14'),_0x273132,'request\x20sent',JSON[_0x4686('0x15')](_0x30e377));if(_0x30e377[_0x4686('0x16')]){if(_0x30e377[_0x4686('0x16')][_0x4686('0x17')]===0x1f4){logger[_0x4686('0x16')](_0x4686('0x11'),_0x273132,_0x30e377['error'][_0x4686('0x18')]);return _0x175e93(_0x30e377[_0x4686('0x16')][_0x4686('0x18')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x273132,_0x30e377['error']['message']);return _0x5150ed(_0x30e377['error'][_0x4686('0x18')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x273132,_0x4686('0x12'));_0x5150ed(_0x30e377[_0x4686('0x19')]['message']);}})['catch'](function(_0x452f1a){logger[_0x4686('0x16')](_0x4686('0x11'),_0x273132,_0x452f1a);_0x175e93(_0x452f1a);});});} \ No newline at end of file +var _0xf7e1=['lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x18d677,_0x5d7115){var _0x171e51=function(_0x307dc6){while(--_0x307dc6){_0x18d677['push'](_0x18d677['shift']());}};_0x171e51(++_0x5d7115);}(_0xf7e1,0x134));var _0x1f7e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf7e1[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x1f7e('0x0'));var util=require(_0x1f7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f7e('0x2'));var fs=require('fs');var Redis=require(_0x1f7e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f7e('0x4'));var logger=require('../../config/logger')(_0x1f7e('0x5'));var config=require(_0x1f7e('0x6'));var jayson=require(_0x1f7e('0x7'));var client=jayson[_0x1f7e('0x8')][_0x1f7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x118469,_0x284407,_0x34ebd4){return new BPromise(function(_0x22ac7e,_0x4c2e70){return client[_0x1f7e('0xa')](_0x118469,_0x34ebd4)[_0x1f7e('0xb')](function(_0x5f1660){logger[_0x1f7e('0xc')](_0x1f7e('0xd'),_0x284407,_0x1f7e('0xe'));logger[_0x1f7e('0xf')](_0x1f7e('0x10'),_0x284407,_0x1f7e('0xe'),JSON[_0x1f7e('0x11')](_0x5f1660));if(_0x5f1660[_0x1f7e('0x12')]){if(_0x5f1660[_0x1f7e('0x12')][_0x1f7e('0x13')]===0x1f4){logger['error'](_0x1f7e('0xd'),_0x284407,_0x5f1660[_0x1f7e('0x12')][_0x1f7e('0x14')]);return _0x4c2e70(_0x5f1660[_0x1f7e('0x12')]['message']);}logger[_0x1f7e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x284407,_0x5f1660['error'][_0x1f7e('0x14')]);return _0x22ac7e(_0x5f1660[_0x1f7e('0x12')][_0x1f7e('0x14')]);}else{logger[_0x1f7e('0xc')](_0x1f7e('0xd'),_0x284407,'request\x20sent');_0x22ac7e(_0x5f1660['result'][_0x1f7e('0x14')]);}})[_0x1f7e('0x15')](function(_0x136034){logger[_0x1f7e('0x12')](_0x1f7e('0xd'),_0x284407,_0x136034);_0x4c2e70(_0x136034);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f335e9b..56a1323 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 _0xc5f4=['index','get','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5f4,0x8b));var _0x4c5f=function(_0x4428c6,_0x32d8d1){_0x4428c6=_0x4428c6-0x0;var _0x2a67c7=_0xc5f4[_0x4428c6];return _0x2a67c7;};'use strict';var multer=require(_0x4c5f('0x0'));var util=require(_0x4c5f('0x1'));var path=require('path');var timeout=require(_0x4c5f('0x2'));var express=require(_0x4c5f('0x3'));var router=express[_0x4c5f('0x4')]();var fs_extra=require(_0x4c5f('0x5'));var auth=require(_0x4c5f('0x6'));var interaction=require(_0x4c5f('0x7'));var config=require(_0x4c5f('0x8'));var controller=require(_0x4c5f('0x9'));router['get']('/',auth[_0x4c5f('0xa')](),controller[_0x4c5f('0xb')]);router[_0x4c5f('0xc')](_0x4c5f('0xd'),auth[_0x4c5f('0xa')](),controller['show']);router[_0x4c5f('0xc')]('/:id/configurations',auth[_0x4c5f('0xa')](),controller[_0x4c5f('0xe')]);router[_0x4c5f('0xc')](_0x4c5f('0xf'),auth['isAuthenticated'](),controller[_0x4c5f('0x10')]);router[_0x4c5f('0x11')]('/',auth[_0x4c5f('0xa')](),controller[_0x4c5f('0x12')]);router[_0x4c5f('0x11')](_0x4c5f('0x13'),auth['isAuthenticated'](),controller[_0x4c5f('0x14')]);router['put']('/:id',auth[_0x4c5f('0xa')](),controller[_0x4c5f('0x15')]);router[_0x4c5f('0x16')](_0x4c5f('0xd'),auth['isAuthenticated'](),controller[_0x4c5f('0x17')]);module[_0x4c5f('0x18')]=router; \ No newline at end of file +var _0xe3fa=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0xe3fa,0x1cb));var _0xae3f=function(_0x9ea38c,_0x9d044c){_0x9ea38c=_0x9ea38c-0x0;var _0x2db088=_0xe3fa[_0x9ea38c];return _0x2db088;};'use strict';var multer=require(_0xae3f('0x0'));var util=require(_0xae3f('0x1'));var path=require(_0xae3f('0x2'));var timeout=require(_0xae3f('0x3'));var express=require(_0xae3f('0x4'));var router=express[_0xae3f('0x5')]();var fs_extra=require(_0xae3f('0x6'));var auth=require(_0xae3f('0x7'));var interaction=require(_0xae3f('0x8'));var config=require(_0xae3f('0x9'));var controller=require(_0xae3f('0xa'));router[_0xae3f('0xb')]('/',auth[_0xae3f('0xc')](),controller[_0xae3f('0xd')]);router[_0xae3f('0xb')](_0xae3f('0xe'),auth[_0xae3f('0xc')](),controller[_0xae3f('0xf')]);router[_0xae3f('0xb')](_0xae3f('0x10'),auth['isAuthenticated'](),controller[_0xae3f('0x11')]);router['get'](_0xae3f('0x12'),auth['isAuthenticated'](),controller[_0xae3f('0x13')]);router['post']('/',auth[_0xae3f('0xc')](),controller[_0xae3f('0x14')]);router[_0xae3f('0x15')](_0xae3f('0x10'),auth[_0xae3f('0xc')](),controller[_0xae3f('0x16')]);router[_0xae3f('0x17')](_0xae3f('0xe'),auth[_0xae3f('0xc')](),controller['update']);router['delete'](_0xae3f('0xe'),auth[_0xae3f('0xc')](),controller[_0xae3f('0x18')]);module[_0xae3f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c8117c2..0795a56 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 _0xe14d=['exports','STRING','sequelize'];(function(_0xf3f2d7,_0xd96b2c){var _0x95073=function(_0x2f2396){while(--_0x2f2396){_0xf3f2d7['push'](_0xf3f2d7['shift']());}};_0x95073(++_0xd96b2c);}(_0xe14d,0x1ee));var _0xde14=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xe14d[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file +var _0xaa88=['exports','STRING','sequelize'];(function(_0x518f4f,_0xc2f4c1){var _0x993397=function(_0x171ab6){while(--_0x171ab6){_0x518f4f['push'](_0x518f4f['shift']());}};_0x993397(++_0xc2f4c1);}(_0xaa88,0x137));var _0x8aa8=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xaa88[_0x24f326];return _0x488e2d;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5264b73..cc50782 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 _0xa7b1=['slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','ZohoAccount','includeAll','findAll','catch','show','params','include','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','clientSecret','access_token','getFields','host','serverUrl','code','refreshToken','zoho.eu','com'];(function(_0x172e2d,_0x1d6bcd){var _0x502e06=function(_0x2af53e){while(--_0x2af53e){_0x172e2d['push'](_0x172e2d['shift']());}};_0x502e06(++_0x1d6bcd);}(_0xa7b1,0x1a7));var _0x1a7b=function(_0xbced0e,_0x344c39){_0xbced0e=_0xbced0e-0x0;var _0x464815=_0xa7b1[_0xbced0e];return _0x464815;};'use strict';var emlformat=require(_0x1a7b('0x0'));var rimraf=require(_0x1a7b('0x1'));var zipdir=require(_0x1a7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a7b('0x3'));var moment=require(_0x1a7b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a7b('0x5'));var path=require('path');var sox=require(_0x1a7b('0x6'));var csv=require(_0x1a7b('0x7'));var ejs=require(_0x1a7b('0x8'));var fs=require('fs');var fs_extra=require(_0x1a7b('0x9'));var _=require('lodash');var squel=require(_0x1a7b('0xa'));var crypto=require(_0x1a7b('0xb'));var jsforce=require(_0x1a7b('0xc'));var deskjs=require(_0x1a7b('0xd'));var toCsv=require(_0x1a7b('0x7'));var querystring=require(_0x1a7b('0xe'));var Papa=require(_0x1a7b('0xf'));var Redis=require(_0x1a7b('0x10'));var authService=require(_0x1a7b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a7b('0x12'));var hardwareService=require(_0x1a7b('0x13'));var logger=require('../../config/logger')(_0x1a7b('0x14'));var utils=require(_0x1a7b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a7b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1a7b('0x17'));function respondWithStatusCode(_0x37db9a,_0x115bd1){_0x115bd1=_0x115bd1||0xcc;return function(_0x59882d){if(_0x59882d){return _0x37db9a[_0x1a7b('0x18')](_0x115bd1);}return _0x37db9a[_0x1a7b('0x19')](_0x115bd1)[_0x1a7b('0x1a')]();};}function respondWithResult(_0xecc885,_0x56d1ba){_0x56d1ba=_0x56d1ba||0xc8;return function(_0x26edf2){if(_0x26edf2){return _0xecc885[_0x1a7b('0x19')](_0x56d1ba)[_0x1a7b('0x1b')](_0x26edf2);}};}function respondWithFilteredResult(_0x1df289,_0x919b9a){return function(_0x3ddf6e){if(_0x3ddf6e){var _0x2a32b7=typeof _0x919b9a[_0x1a7b('0x1c')]===_0x1a7b('0x1d')&&typeof _0x919b9a[_0x1a7b('0x1e')]===_0x1a7b('0x1d');var _0x1432db=_0x3ddf6e[_0x1a7b('0x1f')];var _0x225a43=_0x2a32b7?0x0:_0x919b9a['offset'];var _0x48862b=_0x2a32b7?_0x3ddf6e[_0x1a7b('0x1f')]:_0x919b9a[_0x1a7b('0x1c')]+_0x919b9a[_0x1a7b('0x1e')];var _0xfd3dd7;if(_0x48862b>=_0x1432db){_0x48862b=_0x1432db;_0xfd3dd7=0xc8;}else{_0xfd3dd7=0xce;}_0x1df289['status'](_0xfd3dd7);return _0x1df289[_0x1a7b('0x20')](_0x1a7b('0x21'),_0x225a43+'-'+_0x48862b+'/'+_0x1432db)[_0x1a7b('0x1b')](_0x3ddf6e);}return null;};}function patchUpdates(_0x3d0088){return function(_0x26415b){try{jsonpatch[_0x1a7b('0x22')](_0x26415b,_0x3d0088,!![]);}catch(_0x325533){return BPromise['reject'](_0x325533);}return _0x26415b[_0x1a7b('0x23')]();};}function saveUpdates(_0x15adaa,_0x294b90){return function(_0x3d6ff0){if(_0x3d6ff0){return _0x3d6ff0[_0x1a7b('0x24')](_0x15adaa)['then'](function(_0x39a379){return _0x39a379;});}return null;};}function removeEntity(_0x3e82e6,_0x793b3c){return function(_0x565f74){if(_0x565f74){return _0x565f74[_0x1a7b('0x25')]()[_0x1a7b('0x26')](function(){_0x3e82e6[_0x1a7b('0x19')](0xcc)[_0x1a7b('0x1a')]();});}};}function handleEntityNotFound(_0x280e68,_0x44337b){return function(_0x22635d){if(!_0x22635d){_0x280e68[_0x1a7b('0x18')](0x194);}return _0x22635d;};}function handleError(_0x339233,_0x2b0347){_0x2b0347=_0x2b0347||0x1f4;return function(_0x2d1619){logger[_0x1a7b('0x27')](_0x2d1619[_0x1a7b('0x28')]);if(_0x2d1619[_0x1a7b('0x29')]){delete _0x2d1619[_0x1a7b('0x29')];}_0x339233['status'](_0x2b0347)[_0x1a7b('0x2a')](_0x2d1619);};}exports['index']=function(_0x45a42a,_0x3ba1d1){var _0x131920={},_0xbe5a75={},_0x1035b3={'count':0x0,'rows':[]};var _0x11e876=_['map'](db['ZohoAccount'][_0x1a7b('0x2b')],function(_0x20dc64){return{'name':_0x20dc64[_0x1a7b('0x2c')],'type':_0x20dc64['type']['key']};});_0xbe5a75[_0x1a7b('0x2d')]=_[_0x1a7b('0x2e')](_0x11e876,_0x1a7b('0x29'));_0xbe5a75[_0x1a7b('0x2f')]=_[_0x1a7b('0x30')](_0x45a42a[_0x1a7b('0x2f')]);_0xbe5a75['filters']=_[_0x1a7b('0x31')](_0xbe5a75[_0x1a7b('0x2d')],_0xbe5a75[_0x1a7b('0x2f')]);_0x131920['attributes']=_[_0x1a7b('0x31')](_0xbe5a75[_0x1a7b('0x2d')],qs['fields'](_0x45a42a['query'][_0x1a7b('0x32')]));_0x131920[_0x1a7b('0x33')]=_0x131920[_0x1a7b('0x33')][_0x1a7b('0x34')]?_0x131920[_0x1a7b('0x33')]:_0xbe5a75[_0x1a7b('0x2d')];if(!_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x35')](_0x1a7b('0x36'))){_0x131920[_0x1a7b('0x1e')]=qs[_0x1a7b('0x1e')](_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x1e')]);_0x131920[_0x1a7b('0x1c')]=qs[_0x1a7b('0x1c')](_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x1c')]);}_0x131920[_0x1a7b('0x37')]=qs['sort'](_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x38')]);_0x131920[_0x1a7b('0x39')]=qs['filters'](_[_0x1a7b('0x3a')](_0x45a42a['query'],_0xbe5a75[_0x1a7b('0x3b')]),_0x11e876);if(_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x3c')]){_0x131920[_0x1a7b('0x39')]=_['merge'](_0x131920[_0x1a7b('0x39')],{'$or':_[_0x1a7b('0x2e')](_0x11e876,function(_0x555f06){if(_0x555f06['type']!==_0x1a7b('0x3d')){var _0x33c53f={};_0x33c53f[_0x555f06[_0x1a7b('0x29')]]={'$like':'%'+_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x3c')]+'%'};return _0x33c53f;}})});}_0x131920=_[_0x1a7b('0x3e')]({},_0x131920,_0x45a42a[_0x1a7b('0x3f')]);var _0x3caddf={'where':_0x131920[_0x1a7b('0x39')]};return db[_0x1a7b('0x40')][_0x1a7b('0x1f')](_0x3caddf)[_0x1a7b('0x26')](function(_0x5ce829){_0x1035b3[_0x1a7b('0x1f')]=_0x5ce829;if(_0x45a42a[_0x1a7b('0x2f')][_0x1a7b('0x41')]){_0x131920['include']=[{'all':!![]}];}return db[_0x1a7b('0x40')][_0x1a7b('0x42')](_0x131920);})['then'](function(_0x290573){_0x1035b3['rows']=_0x290573;return _0x1035b3;})['then'](respondWithFilteredResult(_0x3ba1d1,_0x131920))[_0x1a7b('0x43')](handleError(_0x3ba1d1,null));};exports[_0x1a7b('0x44')]=function(_0x184669,_0x5d46fd){var _0x23066f={'raw':![],'where':{'id':_0x184669[_0x1a7b('0x45')]['id']}},_0x5f1c40={};_0x5f1c40['model']=_[_0x1a7b('0x30')](db[_0x1a7b('0x40')][_0x1a7b('0x2b')]);_0x5f1c40[_0x1a7b('0x2f')]=_[_0x1a7b('0x30')](_0x184669[_0x1a7b('0x2f')]);_0x5f1c40[_0x1a7b('0x3b')]=_[_0x1a7b('0x31')](_0x5f1c40[_0x1a7b('0x2d')],_0x5f1c40[_0x1a7b('0x2f')]);_0x23066f[_0x1a7b('0x33')]=_[_0x1a7b('0x31')](_0x5f1c40[_0x1a7b('0x2d')],qs['fields'](_0x184669['query'][_0x1a7b('0x32')]));_0x23066f[_0x1a7b('0x33')]=_0x23066f[_0x1a7b('0x33')][_0x1a7b('0x34')]?_0x23066f['attributes']:_0x5f1c40[_0x1a7b('0x2d')];if(_0x184669[_0x1a7b('0x2f')][_0x1a7b('0x41')]){_0x23066f[_0x1a7b('0x46')]=[{'all':!![]}];}_0x23066f=_['merge']({},_0x23066f,_0x184669[_0x1a7b('0x3f')]);return db[_0x1a7b('0x40')]['find'](_0x23066f)[_0x1a7b('0x26')](handleEntityNotFound(_0x5d46fd,null))[_0x1a7b('0x26')](respondWithResult(_0x5d46fd,null))[_0x1a7b('0x43')](handleError(_0x5d46fd,null));};exports[_0x1a7b('0x47')]=function(_0x44fd5b,_0x2eae9b){return db[_0x1a7b('0x40')][_0x1a7b('0x47')](_0x44fd5b[_0x1a7b('0x48')],{})[_0x1a7b('0x26')](respondWithResult(_0x2eae9b,0xc9))[_0x1a7b('0x43')](handleError(_0x2eae9b,null));};exports[_0x1a7b('0x24')]=function(_0x1609d1,_0x2a19ee){if(_0x1609d1[_0x1a7b('0x48')]['id']){delete _0x1609d1['body']['id'];}return db['ZohoAccount'][_0x1a7b('0x49')]({'where':{'id':_0x1609d1['params']['id']}})['then'](handleEntityNotFound(_0x2a19ee,null))[_0x1a7b('0x26')](saveUpdates(_0x1609d1[_0x1a7b('0x48')],null))[_0x1a7b('0x26')](respondWithResult(_0x2a19ee,null))[_0x1a7b('0x43')](handleError(_0x2a19ee,null));};exports['destroy']=function(_0x5eb0d1,_0x192c46){return db['ZohoAccount'][_0x1a7b('0x49')]({'where':{'id':_0x5eb0d1[_0x1a7b('0x45')]['id']}})[_0x1a7b('0x26')](handleEntityNotFound(_0x192c46,null))[_0x1a7b('0x26')](removeEntity(_0x192c46,null))['catch'](handleError(_0x192c46,null));};exports[_0x1a7b('0x4a')]=function(_0x102654,_0x2c928f,_0x1a2288){var _0x44c080={};var _0x4ba9f2={};var _0xfd0a08;var _0x503bec;return db[_0x1a7b('0x40')][_0x1a7b('0x4b')]({'where':{'id':_0x102654['params']['id']}})[_0x1a7b('0x26')](handleEntityNotFound(_0x2c928f,null))[_0x1a7b('0x26')](function(_0x38210e){if(_0x38210e){_0xfd0a08=_0x38210e;_0x4ba9f2[_0x1a7b('0x2d')]=_[_0x1a7b('0x30')](db[_0x1a7b('0x4c')][_0x1a7b('0x2b')]);_0x4ba9f2['query']=_['keys'](_0x102654[_0x1a7b('0x2f')]);_0x4ba9f2[_0x1a7b('0x3b')]=_[_0x1a7b('0x31')](_0x4ba9f2[_0x1a7b('0x2d')],_0x4ba9f2[_0x1a7b('0x2f')]);_0x44c080[_0x1a7b('0x33')]=_[_0x1a7b('0x31')](_0x4ba9f2[_0x1a7b('0x2d')],qs[_0x1a7b('0x32')](_0x102654['query'][_0x1a7b('0x32')]));_0x44c080[_0x1a7b('0x33')]=_0x44c080[_0x1a7b('0x33')][_0x1a7b('0x34')]?_0x44c080[_0x1a7b('0x33')]:_0x4ba9f2[_0x1a7b('0x2d')];_0x44c080['order']=qs[_0x1a7b('0x38')](_0x102654[_0x1a7b('0x2f')][_0x1a7b('0x38')]);_0x44c080[_0x1a7b('0x39')]=qs[_0x1a7b('0x3b')](_[_0x1a7b('0x3a')](_0x102654['query'],_0x4ba9f2[_0x1a7b('0x3b')]));if(_0x102654['query'][_0x1a7b('0x3c')]){_0x44c080[_0x1a7b('0x39')]=_['merge'](_0x44c080['where'],{'$or':_['map'](_0x44c080[_0x1a7b('0x33')],function(_0x5651e6){var _0x51925e={};_0x51925e[_0x5651e6]={'$like':'%'+_0x102654['query']['filter']+'%'};return _0x51925e;})});}_0x44c080=_[_0x1a7b('0x3e')]({},_0x44c080,_0x102654[_0x1a7b('0x3f')]);return _0xfd0a08[_0x1a7b('0x4a')](_0x44c080);}})[_0x1a7b('0x26')](function(_0x160d5d){if(_0x160d5d){_0x503bec=_0x160d5d[_0x1a7b('0x34')];if(!_0x102654[_0x1a7b('0x2f')][_0x1a7b('0x35')](_0x1a7b('0x36'))){_0x44c080[_0x1a7b('0x1e')]=qs[_0x1a7b('0x1e')](_0x102654['query'][_0x1a7b('0x1e')]);_0x44c080[_0x1a7b('0x1c')]=qs[_0x1a7b('0x1c')](_0x102654[_0x1a7b('0x2f')][_0x1a7b('0x1c')]);}return _0xfd0a08[_0x1a7b('0x4a')](_0x44c080);}})[_0x1a7b('0x26')](function(_0x4bf378){if(_0x4bf378){return _0x4bf378?{'count':_0x503bec,'rows':_0x4bf378}:null;}})[_0x1a7b('0x26')](respondWithResult(_0x2c928f,null))[_0x1a7b('0x43')](handleError(_0x2c928f,null));};exports[_0x1a7b('0x4d')]=function(_0x4ecbc3,_0x52812c,_0x2f359e){if(_0x4ecbc3[_0x1a7b('0x48')]['id']){delete _0x4ecbc3[_0x1a7b('0x48')]['id'];}return db['ZohoAccount'][_0x1a7b('0x4b')]({'where':{'id':_0x4ecbc3[_0x1a7b('0x45')]['id']}})[_0x1a7b('0x26')](handleEntityNotFound(_0x52812c,null))[_0x1a7b('0x26')](function(_0x2bc3e1){if(_0x2bc3e1){_0x4ecbc3['body'][_0x1a7b('0x4e')]=_0x2bc3e1['id'];_0x4ecbc3['body'][_0x1a7b('0x4f')]=integrations[_0x1a7b('0x50')](_0x4ecbc3[_0x1a7b('0x48')][_0x1a7b('0x51')],_0x4ecbc3[_0x1a7b('0x48')][_0x1a7b('0x52')]);_0x4ecbc3['body'][_0x1a7b('0x53')]=integrations['getDescriptions'](_0x4ecbc3['body'][_0x1a7b('0x51')],_0x4ecbc3[_0x1a7b('0x48')][_0x1a7b('0x52')]);return db[_0x1a7b('0x4c')][_0x1a7b('0x47')](_0x4ecbc3[_0x1a7b('0x48')],{'include':[{'model':db[_0x1a7b('0x54')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x1a7b('0x53')}]});}return null;})['then'](respondWithResult(_0x52812c,null))['catch'](handleError(_0x52812c,null));};function getAccessToken(_0x5c05e9){return new Promise(function(_0x44def8,_0x2f95d2){var _0x57afef;switch(_0x5c05e9[_0x1a7b('0x55')]){case'US':_0x57afef=_0x1a7b('0x56');break;case'AU':_0x57afef=_0x1a7b('0x57');break;case'EU':_0x57afef=_0x1a7b('0x58');break;case'IN':_0x57afef='https://accounts.zoho.in';break;case'CN':_0x57afef=_0x1a7b('0x59');break;default:_0x57afef=_0x1a7b('0x58');break;}var _0xe21c68={'method':_0x1a7b('0x5a'),'uri':_0x57afef+'/oauth/v2/token','qs':{'refresh_token':_0x5c05e9['refreshToken'],'client_id':_0x5c05e9[_0x1a7b('0x5b')],'client_secret':_0x5c05e9[_0x1a7b('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xe21c68)[_0x1a7b('0x26')](function(_0x1a4c08){if(_0x1a4c08[_0x1a7b('0x5d')]){_0x44def8(_0x1a4c08['access_token']);}else{_0x2f95d2('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1a7b('0x43')](function(_0x1f6b3b){_0x2f95d2(_0x1f6b3b);});});}exports[_0x1a7b('0x5e')]=function(_0x5a8279,_0x1b266c,_0xbf36ac){var _0x47f7b,_0x230799,_0x598a6f,_0x58ddec,_0x37d241;return db[_0x1a7b('0x40')][_0x1a7b('0x4b')]({'where':{'id':_0x5a8279[_0x1a7b('0x45')]['id']},'attributes':['id',_0x1a7b('0x5f'),'zone','clientId','clientSecret',_0x1a7b('0x60'),_0x1a7b('0x61'),_0x1a7b('0x62')]})[_0x1a7b('0x26')](handleEntityNotFound(_0x1b266c,null))[_0x1a7b('0x26')](function(_0x5eb675){_0x37d241=_0x5eb675;_0x47f7b=_0x37d241[_0x1a7b('0x5f')];_0x230799=_0x47f7b===_0x1a7b('0x63')?'eu':_0x1a7b('0x64');_0x598a6f=_0x37d241[_0x1a7b('0x60')];var _0xf48534=_0x598a6f[_0x1a7b('0x65')](-0x1);if(_0xf48534==='/'||_0xf48534==='\x5c'||_0xf48534===':'){_0x598a6f=_0x598a6f[_0x1a7b('0x66')](0x0,_0x598a6f[_0x1a7b('0x67')](_0xf48534));}if(!_0x37d241[_0x1a7b('0x62')]){throw new Error(_0x1a7b('0x68'));}return getAccessToken(_0x37d241);})[_0x1a7b('0x26')](function(_0x414560){if(_0x414560){return rp({'method':_0x1a7b('0x69'),'uri':util[_0x1a7b('0x6a')](_0x1a7b('0x6b'),_0x230799),'qs':{'module':'Calls'},'headers':{'Authorization':_0x1a7b('0x6c')+_0x414560},'json':!![]});}})['then'](function(_0x4d057a){if(_0x4d057a){if(_0x4d057a[_0x1a7b('0x6d')]&&_0x4d057a[_0x1a7b('0x6d')][_0x1a7b('0x27')]){throw new Error(_0x4d057a[_0x1a7b('0x6d')][_0x1a7b('0x27')][_0x1a7b('0x6e')]);}var _0x5023a3=[];var _0x3a5075=[];var _0x508b8c=[_0x1a7b('0x6f'),'Subject',_0x1a7b('0x70'),_0x1a7b('0x71'),_0x1a7b('0x72'),_0x1a7b('0x73'),_0x1a7b('0x74'),_0x1a7b('0x75')];_0x3a5075=_[_0x1a7b('0x76')](_0x4d057a[_0x1a7b('0x32')],function(_0x7fd5be){return _0x508b8c[_0x1a7b('0x77')](_0x7fd5be[_0x1a7b('0x78')]);});for(var _0x29ab4a=0x0;_0x29ab4a<_0x3a5075[_0x1a7b('0x34')];_0x29ab4a++){if(_0x3a5075[_0x29ab4a]['system_mandatory']===![]){_0x5023a3[_0x1a7b('0x79')]({'id':_0x3a5075[_0x29ab4a]['id'],'name':_0x3a5075[_0x29ab4a][_0x1a7b('0x7a')],'custom':_0x3a5075[_0x29ab4a][_0x1a7b('0x7b')],'options':_0x3a5075[_0x29ab4a][_0x1a7b('0x7c')]===_0x1a7b('0x7d')&&_0x3a5075[_0x29ab4a][_0x1a7b('0x7e')][_0x1a7b('0x34')]>-0x1?_[_0x1a7b('0x2e')](_0x3a5075[_0x29ab4a][_0x1a7b('0x7e')],function(_0xea0d3b){return{'name':_0xea0d3b,'value':_0xea0d3b};}):[]});}}return{'count':_0x5023a3[_0x1a7b('0x34')],'rows':_0x5023a3};}else{return{'count':0x0,'rows':[]};}})[_0x1a7b('0x26')](respondWithResult(_0x1b266c,null))[_0x1a7b('0x43')](function(_0x371f77){var _0x235f3a=_0x5a8279['query'][_0x1a7b('0x7f')]?0x1f4:_0x371f77[_0x1a7b('0x80')]||0x1f4;logger[_0x1a7b('0x27')](_0x1a7b('0x81'),_0x1a7b('0x5e'),_0x235f3a,JSON[_0x1a7b('0x82')](_0x371f77));delete _0x371f77[_0x1a7b('0x29')];if(_0x235f3a===0x191){_0x235f3a=0x190;}_0x1b266c[_0x1a7b('0x19')](_0x235f3a)[_0x1a7b('0x2a')](_0x5a8279['query'][_0x1a7b('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x371f77[_0x1a7b('0x80')]}:_0x371f77);});}; \ No newline at end of file +var _0x776d=['channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','refreshToken','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','addConfiguration','Subjects','getSubjects'];(function(_0x4ea6b5,_0x1b4452){var _0xa1ef96=function(_0x17b77d){while(--_0x17b77d){_0x4ea6b5['push'](_0x4ea6b5['shift']());}};_0xa1ef96(++_0x1b4452);}(_0x776d,0x12f));var _0xd776=function(_0x4fe138,_0x58b985){_0x4fe138=_0x4fe138-0x0;var _0x48df47=_0x776d[_0x4fe138];return _0x48df47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd776('0x0'));var zipdir=require(_0xd776('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd776('0x2'));var moment=require(_0xd776('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd776('0x4'));var util=require(_0xd776('0x5'));var path=require(_0xd776('0x6'));var sox=require(_0xd776('0x7'));var csv=require('to-csv');var ejs=require(_0xd776('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd776('0x9'));var crypto=require('crypto');var jsforce=require(_0xd776('0xa'));var deskjs=require(_0xd776('0xb'));var toCsv=require(_0xd776('0xc'));var querystring=require(_0xd776('0xd'));var Papa=require(_0xd776('0xe'));var Redis=require(_0xd776('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd776('0x10'));var as=require(_0xd776('0x11'));var hardwareService=require(_0xd776('0x12'));var logger=require(_0xd776('0x13'))(_0xd776('0x14'));var utils=require('../../config/utils');var config=require(_0xd776('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd776('0x16'))['db'];var integrations=require(_0xd776('0x17'));function respondWithStatusCode(_0x1f04f3,_0x1f7129){_0x1f7129=_0x1f7129||0xcc;return function(_0x5b4d06){if(_0x5b4d06){return _0x1f04f3[_0xd776('0x18')](_0x1f7129);}return _0x1f04f3['status'](_0x1f7129)[_0xd776('0x19')]();};}function respondWithResult(_0x5daf7d,_0x323ac2){_0x323ac2=_0x323ac2||0xc8;return function(_0x72e139){if(_0x72e139){return _0x5daf7d[_0xd776('0x1a')](_0x323ac2)['json'](_0x72e139);}};}function respondWithFilteredResult(_0x15121d,_0x346492){return function(_0x399f0c){if(_0x399f0c){var _0x10d83c=typeof _0x346492['offset']==='undefined'&&typeof _0x346492[_0xd776('0x1b')]==='undefined';var _0x45e142=_0x399f0c[_0xd776('0x1c')];var _0x51e205=_0x10d83c?0x0:_0x346492[_0xd776('0x1d')];var _0x51e9a3=_0x10d83c?_0x399f0c[_0xd776('0x1c')]:_0x346492[_0xd776('0x1d')]+_0x346492[_0xd776('0x1b')];var _0x1c327d;if(_0x51e9a3>=_0x45e142){_0x51e9a3=_0x45e142;_0x1c327d=0xc8;}else{_0x1c327d=0xce;}_0x15121d[_0xd776('0x1a')](_0x1c327d);return _0x15121d[_0xd776('0x1e')](_0xd776('0x1f'),_0x51e205+'-'+_0x51e9a3+'/'+_0x45e142)[_0xd776('0x20')](_0x399f0c);}return null;};}function patchUpdates(_0x2a5456){return function(_0x1c1d93){try{jsonpatch[_0xd776('0x21')](_0x1c1d93,_0x2a5456,!![]);}catch(_0x4417da){return BPromise[_0xd776('0x22')](_0x4417da);}return _0x1c1d93[_0xd776('0x23')]();};}function saveUpdates(_0xe4b9a5,_0x2668d3){return function(_0x5c0a80){if(_0x5c0a80){return _0x5c0a80[_0xd776('0x24')](_0xe4b9a5)[_0xd776('0x25')](function(_0x2e39c8){return _0x2e39c8;});}return null;};}function removeEntity(_0x308241,_0x31d4ea){return function(_0x3a98ab){if(_0x3a98ab){return _0x3a98ab[_0xd776('0x26')]()['then'](function(){_0x308241[_0xd776('0x1a')](0xcc)[_0xd776('0x19')]();});}};}function handleEntityNotFound(_0xd66bef,_0x2fa9cd){return function(_0x310fe7){if(!_0x310fe7){_0xd66bef[_0xd776('0x18')](0x194);}return _0x310fe7;};}function handleError(_0x44056d,_0x462e0b){_0x462e0b=_0x462e0b||0x1f4;return function(_0x19479c){logger[_0xd776('0x27')](_0x19479c[_0xd776('0x28')]);if(_0x19479c['name']){delete _0x19479c[_0xd776('0x29')];}_0x44056d[_0xd776('0x1a')](_0x462e0b)[_0xd776('0x2a')](_0x19479c);};}exports[_0xd776('0x2b')]=function(_0x47d060,_0x1f121c){var _0x4fa505={},_0x230e61={},_0x1e3ca3={'count':0x0,'rows':[]};var _0x2bf743=_[_0xd776('0x2c')](db['ZohoAccount'][_0xd776('0x2d')],function(_0x5f1755){return{'name':_0x5f1755['fieldName'],'type':_0x5f1755[_0xd776('0x2e')][_0xd776('0x2f')]};});_0x230e61['model']=_[_0xd776('0x2c')](_0x2bf743,_0xd776('0x29'));_0x230e61[_0xd776('0x30')]=_[_0xd776('0x31')](_0x47d060[_0xd776('0x30')]);_0x230e61['filters']=_[_0xd776('0x32')](_0x230e61[_0xd776('0x33')],_0x230e61['query']);_0x4fa505['attributes']=_['intersection'](_0x230e61[_0xd776('0x33')],qs[_0xd776('0x34')](_0x47d060[_0xd776('0x30')][_0xd776('0x34')]));_0x4fa505['attributes']=_0x4fa505[_0xd776('0x35')][_0xd776('0x36')]?_0x4fa505[_0xd776('0x35')]:_0x230e61[_0xd776('0x33')];if(!_0x47d060['query'][_0xd776('0x37')](_0xd776('0x38'))){_0x4fa505[_0xd776('0x1b')]=qs['limit'](_0x47d060['query'][_0xd776('0x1b')]);_0x4fa505[_0xd776('0x1d')]=qs[_0xd776('0x1d')](_0x47d060['query'][_0xd776('0x1d')]);}_0x4fa505[_0xd776('0x39')]=qs['sort'](_0x47d060[_0xd776('0x30')]['sort']);_0x4fa505[_0xd776('0x3a')]=qs[_0xd776('0x3b')](_['pick'](_0x47d060[_0xd776('0x30')],_0x230e61[_0xd776('0x3b')]),_0x2bf743);if(_0x47d060[_0xd776('0x30')][_0xd776('0x3c')]){_0x4fa505['where']=_[_0xd776('0x3d')](_0x4fa505[_0xd776('0x3a')],{'$or':_[_0xd776('0x2c')](_0x2bf743,function(_0x2212f3){if(_0x2212f3[_0xd776('0x2e')]!=='VIRTUAL'){var _0x13ae36={};_0x13ae36[_0x2212f3[_0xd776('0x29')]]={'$like':'%'+_0x47d060['query']['filter']+'%'};return _0x13ae36;}})});}_0x4fa505=_[_0xd776('0x3d')]({},_0x4fa505,_0x47d060['options']);var _0x5cc664={'where':_0x4fa505[_0xd776('0x3a')]};return db[_0xd776('0x3e')][_0xd776('0x1c')](_0x5cc664)[_0xd776('0x25')](function(_0x4bfb89){_0x1e3ca3[_0xd776('0x1c')]=_0x4bfb89;if(_0x47d060['query'][_0xd776('0x3f')]){_0x4fa505[_0xd776('0x40')]=[{'all':!![]}];}return db[_0xd776('0x3e')][_0xd776('0x41')](_0x4fa505);})['then'](function(_0x1cb282){_0x1e3ca3[_0xd776('0x42')]=_0x1cb282;return _0x1e3ca3;})[_0xd776('0x25')](respondWithFilteredResult(_0x1f121c,_0x4fa505))[_0xd776('0x43')](handleError(_0x1f121c,null));};exports[_0xd776('0x44')]=function(_0x19b5ce,_0x39f900){var _0x4b7bfb={'raw':![],'where':{'id':_0x19b5ce[_0xd776('0x45')]['id']}},_0x235d90={};_0x235d90[_0xd776('0x33')]=_[_0xd776('0x31')](db[_0xd776('0x3e')][_0xd776('0x2d')]);_0x235d90[_0xd776('0x30')]=_[_0xd776('0x31')](_0x19b5ce[_0xd776('0x30')]);_0x235d90[_0xd776('0x3b')]=_['intersection'](_0x235d90[_0xd776('0x33')],_0x235d90[_0xd776('0x30')]);_0x4b7bfb['attributes']=_[_0xd776('0x32')](_0x235d90[_0xd776('0x33')],qs['fields'](_0x19b5ce['query'][_0xd776('0x34')]));_0x4b7bfb['attributes']=_0x4b7bfb[_0xd776('0x35')]['length']?_0x4b7bfb['attributes']:_0x235d90['model'];if(_0x19b5ce['query']['includeAll']){_0x4b7bfb[_0xd776('0x40')]=[{'all':!![]}];}_0x4b7bfb=_[_0xd776('0x3d')]({},_0x4b7bfb,_0x19b5ce[_0xd776('0x46')]);return db['ZohoAccount'][_0xd776('0x47')](_0x4b7bfb)[_0xd776('0x25')](handleEntityNotFound(_0x39f900,null))[_0xd776('0x25')](respondWithResult(_0x39f900,null))[_0xd776('0x43')](handleError(_0x39f900,null));};exports[_0xd776('0x48')]=function(_0xc36053,_0x2ed50e){return db[_0xd776('0x3e')][_0xd776('0x48')](_0xc36053['body'],{})[_0xd776('0x25')](respondWithResult(_0x2ed50e,0xc9))[_0xd776('0x43')](handleError(_0x2ed50e,null));};exports[_0xd776('0x24')]=function(_0x3d77a0,_0x52c0c7){if(_0x3d77a0[_0xd776('0x49')]['id']){delete _0x3d77a0[_0xd776('0x49')]['id'];}return db[_0xd776('0x3e')][_0xd776('0x47')]({'where':{'id':_0x3d77a0[_0xd776('0x45')]['id']}})[_0xd776('0x25')](handleEntityNotFound(_0x52c0c7,null))[_0xd776('0x25')](saveUpdates(_0x3d77a0[_0xd776('0x49')],null))[_0xd776('0x25')](respondWithResult(_0x52c0c7,null))[_0xd776('0x43')](handleError(_0x52c0c7,null));};exports[_0xd776('0x26')]=function(_0x2abb08,_0x3affa4){return db[_0xd776('0x3e')][_0xd776('0x47')]({'where':{'id':_0x2abb08[_0xd776('0x45')]['id']}})[_0xd776('0x25')](handleEntityNotFound(_0x3affa4,null))[_0xd776('0x25')](removeEntity(_0x3affa4,null))[_0xd776('0x43')](handleError(_0x3affa4,null));};exports[_0xd776('0x4a')]=function(_0x496036,_0x136454,_0x4ad90a){var _0xe5e6d6={};var _0x44130d={};var _0x47abf1;var _0x4e8462;return db['ZohoAccount'][_0xd776('0x4b')]({'where':{'id':_0x496036[_0xd776('0x45')]['id']}})[_0xd776('0x25')](handleEntityNotFound(_0x136454,null))['then'](function(_0x4ed2e7){if(_0x4ed2e7){_0x47abf1=_0x4ed2e7;_0x44130d[_0xd776('0x33')]=_[_0xd776('0x31')](db[_0xd776('0x4c')][_0xd776('0x2d')]);_0x44130d['query']=_['keys'](_0x496036[_0xd776('0x30')]);_0x44130d[_0xd776('0x3b')]=_[_0xd776('0x32')](_0x44130d[_0xd776('0x33')],_0x44130d[_0xd776('0x30')]);_0xe5e6d6[_0xd776('0x35')]=_[_0xd776('0x32')](_0x44130d[_0xd776('0x33')],qs[_0xd776('0x34')](_0x496036['query'][_0xd776('0x34')]));_0xe5e6d6['attributes']=_0xe5e6d6['attributes'][_0xd776('0x36')]?_0xe5e6d6[_0xd776('0x35')]:_0x44130d['model'];_0xe5e6d6[_0xd776('0x39')]=qs[_0xd776('0x4d')](_0x496036[_0xd776('0x30')]['sort']);_0xe5e6d6[_0xd776('0x3a')]=qs[_0xd776('0x3b')](_['pick'](_0x496036[_0xd776('0x30')],_0x44130d[_0xd776('0x3b')]));if(_0x496036[_0xd776('0x30')][_0xd776('0x3c')]){_0xe5e6d6[_0xd776('0x3a')]=_[_0xd776('0x3d')](_0xe5e6d6['where'],{'$or':_['map'](_0xe5e6d6[_0xd776('0x35')],function(_0xd36d90){var _0x47cd52={};_0x47cd52[_0xd36d90]={'$like':'%'+_0x496036[_0xd776('0x30')][_0xd776('0x3c')]+'%'};return _0x47cd52;})});}_0xe5e6d6=_[_0xd776('0x3d')]({},_0xe5e6d6,_0x496036['options']);return _0x47abf1[_0xd776('0x4a')](_0xe5e6d6);}})['then'](function(_0x5003b1){if(_0x5003b1){_0x4e8462=_0x5003b1['length'];if(!_0x496036['query'][_0xd776('0x37')](_0xd776('0x38'))){_0xe5e6d6[_0xd776('0x1b')]=qs['limit'](_0x496036[_0xd776('0x30')]['limit']);_0xe5e6d6[_0xd776('0x1d')]=qs[_0xd776('0x1d')](_0x496036[_0xd776('0x30')]['offset']);}return _0x47abf1[_0xd776('0x4a')](_0xe5e6d6);}})['then'](function(_0x7ce069){if(_0x7ce069){return _0x7ce069?{'count':_0x4e8462,'rows':_0x7ce069}:null;}})[_0xd776('0x25')](respondWithResult(_0x136454,null))['catch'](handleError(_0x136454,null));};exports[_0xd776('0x4e')]=function(_0x47047b,_0x2c5a2d,_0x1c5372){if(_0x47047b['body']['id']){delete _0x47047b[_0xd776('0x49')]['id'];}return db['ZohoAccount'][_0xd776('0x4b')]({'where':{'id':_0x47047b['params']['id']}})['then'](handleEntityNotFound(_0x2c5a2d,null))[_0xd776('0x25')](function(_0x4c42b0){if(_0x4c42b0){_0x47047b['body']['AccountId']=_0x4c42b0['id'];_0x47047b['body'][_0xd776('0x4f')]=integrations[_0xd776('0x50')](_0x47047b[_0xd776('0x49')][_0xd776('0x51')],_0x47047b['body'][_0xd776('0x2e')]);_0x47047b['body'][_0xd776('0x52')]=integrations[_0xd776('0x53')](_0x47047b[_0xd776('0x49')][_0xd776('0x51')],_0x47047b[_0xd776('0x49')][_0xd776('0x2e')]);return db[_0xd776('0x4c')]['create'](_0x47047b['body'],{'include':[{'model':db[_0xd776('0x54')],'as':_0xd776('0x4f')},{'model':db[_0xd776('0x54')],'as':_0xd776('0x52')}]});}return null;})[_0xd776('0x25')](respondWithResult(_0x2c5a2d,null))[_0xd776('0x43')](handleError(_0x2c5a2d,null));};function getAccessToken(_0x553510){return new Promise(function(_0x176bcc,_0x2e6efd){var _0x33d7ac;switch(_0x553510[_0xd776('0x55')]){case'US':_0x33d7ac=_0xd776('0x56');break;case'AU':_0x33d7ac=_0xd776('0x57');break;case'EU':_0x33d7ac=_0xd776('0x58');break;case'IN':_0x33d7ac=_0xd776('0x59');break;case'CN':_0x33d7ac='https://accounts.zoho.com.cn';break;default:_0x33d7ac=_0xd776('0x58');break;}var _0x3dfe8c={'method':_0xd776('0x5a'),'uri':_0x33d7ac+'/oauth/v2/token','qs':{'refresh_token':_0x553510['refreshToken'],'client_id':_0x553510[_0xd776('0x5b')],'client_secret':_0x553510[_0xd776('0x5c')],'grant_type':_0xd776('0x5d')},'json':!![]};return rp(_0x3dfe8c)[_0xd776('0x25')](function(_0x4c441e){if(_0x4c441e[_0xd776('0x5e')]){_0x176bcc(_0x4c441e[_0xd776('0x5e')]);}else{_0x2e6efd('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd776('0x43')](function(_0x488a0b){_0x2e6efd(_0x488a0b);});});}exports[_0xd776('0x5f')]=function(_0x12478a,_0x47cfe3,_0x402e31){var _0x388122,_0x3eb30c,_0x133f4f,_0xdddfa6,_0x39a09e;return db['ZohoAccount']['findOne']({'where':{'id':_0x12478a[_0xd776('0x45')]['id']},'attributes':['id',_0xd776('0x60'),_0xd776('0x55'),'clientId',_0xd776('0x5c'),_0xd776('0x61'),_0xd776('0x62'),_0xd776('0x63')]})[_0xd776('0x25')](handleEntityNotFound(_0x47cfe3,null))[_0xd776('0x25')](function(_0x4d46b6){_0x39a09e=_0x4d46b6;_0x388122=_0x39a09e[_0xd776('0x60')];_0x3eb30c=_0x388122==='zoho.eu'?'eu':'com';_0x133f4f=_0x39a09e[_0xd776('0x61')];var _0xbc275c=_0x133f4f['slice'](-0x1);if(_0xbc275c==='/'||_0xbc275c==='\x5c'||_0xbc275c===':'){_0x133f4f=_0x133f4f[_0xd776('0x64')](0x0,_0x133f4f[_0xd776('0x65')](_0xbc275c));}if(!_0x39a09e[_0xd776('0x63')]){throw new Error(_0xd776('0x66'));}return getAccessToken(_0x39a09e);})[_0xd776('0x25')](function(_0x42c8fc){if(_0x42c8fc){return rp({'method':_0xd776('0x67'),'uri':util[_0xd776('0x68')](_0xd776('0x69'),_0x3eb30c),'qs':{'module':_0xd776('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x42c8fc},'json':!![]});}})['then'](function(_0x135028){if(_0x135028){if(_0x135028[_0xd776('0x6b')]&&_0x135028[_0xd776('0x6b')][_0xd776('0x27')]){throw new Error(_0x135028[_0xd776('0x6b')][_0xd776('0x27')][_0xd776('0x6c')]);}var _0x1dde95=[];var _0x46ed97=[];var _0x226282=[_0xd776('0x6d'),_0xd776('0x6e'),_0xd776('0x6f'),_0xd776('0x70'),_0xd776('0x71'),_0xd776('0x72'),_0xd776('0x73'),'Call_Type'];_0x46ed97=_[_0xd776('0x74')](_0x135028[_0xd776('0x34')],function(_0x24f9c3){return _0x226282[_0xd776('0x75')](_0x24f9c3[_0xd776('0x76')]);});for(var _0x48eae0=0x0;_0x48eae0<_0x46ed97[_0xd776('0x36')];_0x48eae0++){if(_0x46ed97[_0x48eae0][_0xd776('0x77')]===![]){_0x1dde95[_0xd776('0x78')]({'id':_0x46ed97[_0x48eae0]['id'],'name':_0x46ed97[_0x48eae0]['display_label'],'custom':_0x46ed97[_0x48eae0][_0xd776('0x79')],'options':_0x46ed97[_0x48eae0][_0xd776('0x7a')]===_0xd776('0x7b')&&_0x46ed97[_0x48eae0][_0xd776('0x7c')][_0xd776('0x36')]>-0x1?_[_0xd776('0x2c')](_0x46ed97[_0x48eae0][_0xd776('0x7c')],function(_0x39d138){return{'name':_0x39d138,'value':_0x39d138};}):[]});}}return{'count':_0x1dde95[_0xd776('0x36')],'rows':_0x1dde95};}else{return{'count':0x0,'rows':[]};}})[_0xd776('0x25')](respondWithResult(_0x47cfe3,null))['catch'](function(_0x9ff15c){var _0x150eaa=_0x12478a['query'][_0xd776('0x7d')]?0x1f4:_0x9ff15c['statusCode']||0x1f4;logger['error'](_0xd776('0x7e'),'getFields',_0x150eaa,JSON['stringify'](_0x9ff15c));delete _0x9ff15c[_0xd776('0x29')];if(_0x150eaa===0x191){_0x150eaa=0x190;}_0x47cfe3[_0xd776('0x1a')](_0x150eaa)['send'](_0x12478a[_0xd776('0x30')][_0xd776('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x9ff15c[_0xd776('0x7f')]}:_0x9ff15c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f2edeef..660692f 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 _0x7945=['serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','authorization_code','refreshToken','catch','lodash','util','api','moment','request-promise','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7945,0xb7));var _0x5794=function(_0x4d06a0,_0x225dce){_0x4d06a0=_0x4d06a0-0x0;var _0x5cd335=_0x7945[_0x4d06a0];return _0x5cd335;};'use strict';var _=require(_0x5794('0x0'));var util=require(_0x5794('0x1'));var logger=require('../../config/logger')(_0x5794('0x2'));var moment=require(_0x5794('0x3'));var BPromise=require('bluebird');var rp=require(_0x5794('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5794('0x5'));var attributes=require(_0x5794('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5794('0x7')]=function(_0x31dbce,_0x205092){return _0x31dbce['define'](_0x5794('0x8'),attributes,{'tableName':_0x5794('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdad0fd,_0x14381b,_0x3974e2){if(_0xdad0fd[_0x5794('0xa')](_0x5794('0xb'))||_0xdad0fd[_0x5794('0xa')](_0x5794('0xc'))||_0xdad0fd['changed'](_0x5794('0xd'))||_0xdad0fd[_0x5794('0xa')](_0x5794('0xe'))||_0xdad0fd['changed'](_0x5794('0xf'))||_0xdad0fd['changed'](_0x5794('0x10'))){var _0x5c1488,_0x5523fc;_0x5c1488=_0xdad0fd[_0x5794('0xc')];var _0x3b1124=_0x5c1488[_0x5794('0x11')](-0x1);if(_0x3b1124==='/'||_0x3b1124==='\x5c'||_0x3b1124===':'){_0x5c1488=_0x5c1488['substring'](0x0,_0x5c1488[_0x5794('0x12')](_0x3b1124));}switch(_0xdad0fd[_0x5794('0xb')]){case'US':_0x5523fc=_0x5794('0x13');break;case'AU':_0x5523fc='https://accounts.zoho.com.au';break;case'IN':_0x5523fc=_0x5794('0x14');break;case'CN':_0x5523fc='https://accounts.zoho.com.cn';break;default:_0x5523fc=_0x5794('0x15');break;}var _0x3fb959={'method':_0x5794('0x16'),'uri':_0x5523fc+_0x5794('0x17'),'form':{'grant_type':'authorization_code','client_id':_0xdad0fd['clientId'],'client_secret':_0xdad0fd[_0x5794('0xe')],'redirect_uri':_0xdad0fd[_0x5794('0xc')],'code':_0xdad0fd[_0x5794('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3fb959)[_0x5794('0x18')](function(_0x5028f1){var _0x4098a2=JSON[_0x5794('0x19')](_0x5028f1);if(_0x4098a2[_0x5794('0x1a')]){_0xdad0fd['refreshToken']=_0x4098a2[_0x5794('0x1a')];logger[_0x5794('0x1b')](util[_0x5794('0x1c')](_0x5794('0x1d'),_0xdad0fd[_0x5794('0x1e')],_0xdad0fd['id']));}else{logger[_0x5794('0x1f')](util[_0x5794('0x1c')](_0x5794('0x20'),_0xdad0fd[_0x5794('0x1e')],_0xdad0fd['id']),util[_0x5794('0x21')](_0x4098a2,{'showHidden':![],'depth':null}));}return _0x3974e2(null,_0x14381b);})['catch'](function(_0x5d2660){logger[_0x5794('0x1f')](util['format'](_0x5794('0x20'),_0xdad0fd['name'],_0xdad0fd['id']),util[_0x5794('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3974e2(_0x5d2660);});}else{return _0x3974e2(null,_0x14381b);}},'beforeUpdate':function(_0xd2b0ca,_0x5e9cf7,_0x160ea7){if(_0xd2b0ca[_0x5794('0xa')](_0x5794('0xb'))||_0xd2b0ca[_0x5794('0xa')](_0x5794('0xc'))||_0xd2b0ca['changed'](_0x5794('0xd'))||_0xd2b0ca[_0x5794('0xa')](_0x5794('0xe'))||_0xd2b0ca[_0x5794('0xa')](_0x5794('0xf'))||_0xd2b0ca[_0x5794('0xa')](_0x5794('0x10'))){var _0x4bd6b9,_0x2a4f89;_0x4bd6b9=_0xd2b0ca[_0x5794('0xc')];var _0x1722f6=_0x4bd6b9['slice'](-0x1);if(_0x1722f6==='/'||_0x1722f6==='\x5c'||_0x1722f6===':'){_0x4bd6b9=_0x4bd6b9['substring'](0x0,_0x4bd6b9[_0x5794('0x12')](_0x1722f6));}switch(_0xd2b0ca[_0x5794('0xb')]){case'US':_0x2a4f89='https://accounts.zoho.com';break;case'AU':_0x2a4f89=_0x5794('0x22');break;case'IN':_0x2a4f89=_0x5794('0x14');break;case'CN':_0x2a4f89=_0x5794('0x23');break;default:_0x2a4f89=_0x5794('0x15');break;}var _0x57fb75={'method':_0x5794('0x16'),'uri':_0x2a4f89+_0x5794('0x17'),'form':{'grant_type':_0x5794('0x24'),'client_id':_0xd2b0ca[_0x5794('0xd')],'client_secret':_0xd2b0ca['clientSecret'],'redirect_uri':_0xd2b0ca[_0x5794('0xc')],'code':_0xd2b0ca[_0x5794('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x57fb75)[_0x5794('0x18')](function(_0x32bfbc){var _0x250687=JSON[_0x5794('0x19')](_0x32bfbc);if(_0x250687['refresh_token']){_0xd2b0ca[_0x5794('0x25')]=_0x250687['refresh_token'];logger[_0x5794('0x1b')](util[_0x5794('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xd2b0ca[_0x5794('0x1e')],_0xd2b0ca['id']));}else{logger[_0x5794('0x1f')](util[_0x5794('0x1c')](_0x5794('0x20'),_0xd2b0ca[_0x5794('0x1e')],_0xd2b0ca['id']),util[_0x5794('0x21')](_0x250687,{'showHidden':![],'depth':null}));}return _0x160ea7(null,_0x5e9cf7);})[_0x5794('0x26')](function(_0x581538){logger[_0x5794('0x1f')](util[_0x5794('0x1c')](_0x5794('0x20'),_0xd2b0ca[_0x5794('0x1e')],_0xd2b0ca['id']),util[_0x5794('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x160ea7(_0x581538);});}else{return _0x160ea7(null,_0x5e9cf7);}}}});}; \ No newline at end of file +var _0xe643=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','parse','refreshToken','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientId','host','slice','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token'];(function(_0x343743,_0x42f0d2){var _0xf34b0f=function(_0x2e03d3){while(--_0x2e03d3){_0x343743['push'](_0x343743['shift']());}};_0xf34b0f(++_0x42f0d2);}(_0xe643,0xd3));var _0x3e64=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe643[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e64('0x0'))(_0x3e64('0x1'));var moment=require(_0x3e64('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e64('0x3'));var fs=require('fs');var path=require(_0x3e64('0x4'));var rimraf=require('rimraf');var config=require(_0x3e64('0x5'));var attributes=require(_0x3e64('0x6'));var integrations=require(_0x3e64('0x7'));module['exports']=function(_0x279e1b,_0x4c6134){return _0x279e1b[_0x3e64('0x8')]('ZohoAccount',attributes,{'tableName':_0x3e64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1282ab,_0x48db7e,_0x140280){if(_0x1282ab[_0x3e64('0xa')]('zone')||_0x1282ab['changed'](_0x3e64('0xb'))||_0x1282ab[_0x3e64('0xa')](_0x3e64('0xc'))||_0x1282ab[_0x3e64('0xa')]('clientSecret')||_0x1282ab[_0x3e64('0xa')]('code')||_0x1282ab[_0x3e64('0xa')](_0x3e64('0xd'))){var _0x251a0c,_0x1f6211;_0x251a0c=_0x1282ab[_0x3e64('0xb')];var _0x31d625=_0x251a0c[_0x3e64('0xe')](-0x1);if(_0x31d625==='/'||_0x31d625==='\x5c'||_0x31d625===':'){_0x251a0c=_0x251a0c['substring'](0x0,_0x251a0c['lastIndexOf'](_0x31d625));}switch(_0x1282ab[_0x3e64('0xf')]){case'US':_0x1f6211=_0x3e64('0x10');break;case'AU':_0x1f6211=_0x3e64('0x11');break;case'IN':_0x1f6211=_0x3e64('0x12');break;case'CN':_0x1f6211=_0x3e64('0x13');break;default:_0x1f6211=_0x3e64('0x14');break;}var _0xf9071a={'method':_0x3e64('0x15'),'uri':_0x1f6211+_0x3e64('0x16'),'form':{'grant_type':_0x3e64('0x17'),'client_id':_0x1282ab[_0x3e64('0xc')],'client_secret':_0x1282ab[_0x3e64('0x18')],'redirect_uri':_0x1282ab[_0x3e64('0xb')],'code':_0x1282ab[_0x3e64('0x19')]},'headers':{'Content-Type':_0x3e64('0x1a')}};return rp(_0xf9071a)[_0x3e64('0x1b')](function(_0x49a43d){var _0x3f17a0=JSON['parse'](_0x49a43d);if(_0x3f17a0['refresh_token']){_0x1282ab['refreshToken']=_0x3f17a0[_0x3e64('0x1c')];logger[_0x3e64('0x1d')](util[_0x3e64('0x1e')](_0x3e64('0x1f'),_0x1282ab[_0x3e64('0x20')],_0x1282ab['id']));}else{logger[_0x3e64('0x21')](util[_0x3e64('0x1e')](_0x3e64('0x22'),_0x1282ab[_0x3e64('0x20')],_0x1282ab['id']),util[_0x3e64('0x23')](_0x3f17a0,{'showHidden':![],'depth':null}));}return _0x140280(null,_0x48db7e);})[_0x3e64('0x24')](function(_0x3b9393){logger[_0x3e64('0x21')](util['format'](_0x3e64('0x22'),_0x1282ab['name'],_0x1282ab['id']),util[_0x3e64('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x140280(_0x3b9393);});}else{return _0x140280(null,_0x48db7e);}},'beforeUpdate':function(_0x2846e2,_0x90ad64,_0x20a8fc){if(_0x2846e2[_0x3e64('0xa')](_0x3e64('0xf'))||_0x2846e2['changed'](_0x3e64('0xb'))||_0x2846e2[_0x3e64('0xa')](_0x3e64('0xc'))||_0x2846e2[_0x3e64('0xa')](_0x3e64('0x18'))||_0x2846e2[_0x3e64('0xa')](_0x3e64('0x19'))||_0x2846e2['changed'](_0x3e64('0xd'))){var _0x57dcb1,_0x61bcc7;_0x57dcb1=_0x2846e2[_0x3e64('0xb')];var _0x34ec46=_0x57dcb1[_0x3e64('0xe')](-0x1);if(_0x34ec46==='/'||_0x34ec46==='\x5c'||_0x34ec46===':'){_0x57dcb1=_0x57dcb1['substring'](0x0,_0x57dcb1[_0x3e64('0x25')](_0x34ec46));}switch(_0x2846e2['zone']){case'US':_0x61bcc7=_0x3e64('0x10');break;case'AU':_0x61bcc7=_0x3e64('0x11');break;case'IN':_0x61bcc7='https://accounts.zoho.in';break;case'CN':_0x61bcc7='https://accounts.zoho.com.cn';break;default:_0x61bcc7=_0x3e64('0x14');break;}var _0x550d30={'method':_0x3e64('0x15'),'uri':_0x61bcc7+_0x3e64('0x16'),'form':{'grant_type':_0x3e64('0x17'),'client_id':_0x2846e2[_0x3e64('0xc')],'client_secret':_0x2846e2['clientSecret'],'redirect_uri':_0x2846e2[_0x3e64('0xb')],'code':_0x2846e2[_0x3e64('0x19')]},'headers':{'Content-Type':_0x3e64('0x1a')}};return rp(_0x550d30)['then'](function(_0x3ad173){var _0x413b07=JSON[_0x3e64('0x26')](_0x3ad173);if(_0x413b07[_0x3e64('0x1c')]){_0x2846e2[_0x3e64('0x27')]=_0x413b07[_0x3e64('0x1c')];logger[_0x3e64('0x1d')](util[_0x3e64('0x1e')](_0x3e64('0x1f'),_0x2846e2[_0x3e64('0x20')],_0x2846e2['id']));}else{logger[_0x3e64('0x21')](util['format'](_0x3e64('0x22'),_0x2846e2['name'],_0x2846e2['id']),util[_0x3e64('0x23')](_0x413b07,{'showHidden':![],'depth':null}));}return _0x20a8fc(null,_0x90ad64);})[_0x3e64('0x24')](function(_0x39c5d4){logger[_0x3e64('0x21')](util[_0x3e64('0x1e')](_0x3e64('0x22'),_0x2846e2[_0x3e64('0x20')],_0x2846e2['id']),util[_0x3e64('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x20a8fc(_0x39c5d4);});}else{return _0x20a8fc(null,_0x90ad64);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e9e5262..eef49ae 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 _0xb1fa=['info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowZohoAccount','moment','randomstring','../../config/environment','request'];(function(_0x5f4c5f,_0xd51f71){var _0x5a9348=function(_0x4c7193){while(--_0x4c7193){_0x5f4c5f['push'](_0x5f4c5f['shift']());}};_0x5a9348(++_0xd51f71);}(_0xb1fa,0x9e));var _0xab1f=function(_0x5331b5,_0x29e3ba){_0x5331b5=_0x5331b5-0x0;var _0x153127=_0xb1fa[_0x5331b5];return _0x153127;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab1f('0x0'));var BPromise=require('bluebird');var rs=require(_0xab1f('0x1'));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(_0xab1f('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x463442,_0x54c5b0,_0x17e178){return new BPromise(function(_0x2fbc7e,_0x5213a4){return client[_0xab1f('0x3')](_0x463442,_0x17e178)['then'](function(_0x578cf7){logger[_0xab1f('0x4')](_0xab1f('0x5'),_0x54c5b0,_0xab1f('0x6'));logger[_0xab1f('0x7')](_0xab1f('0x8'),_0x54c5b0,'request\x20sent',JSON[_0xab1f('0x9')](_0x578cf7));if(_0x578cf7['error']){if(_0x578cf7['error'][_0xab1f('0xa')]===0x1f4){logger[_0xab1f('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x5213a4(_0x578cf7['error'][_0xab1f('0xc')]);}logger[_0xab1f('0xb')](_0xab1f('0x5'),_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x2fbc7e(_0x578cf7[_0xab1f('0xb')][_0xab1f('0xc')]);}else{logger[_0xab1f('0x4')]('ZohoAccount,\x20%s,\x20%s',_0x54c5b0,_0xab1f('0x6'));_0x2fbc7e(_0x578cf7['result'][_0xab1f('0xc')]);}})[_0xab1f('0xd')](function(_0xcdba98){logger['error'](_0xab1f('0x5'),_0x54c5b0,_0xcdba98);_0x5213a4(_0xcdba98);});});}exports[_0xab1f('0xe')]=function(_0x558c52){var _0x1ec084=this;return new Promise(function(_0x4ba3f4,_0x1b0ab3){return db[_0xab1f('0xf')][_0xab1f('0x10')]({'raw':_0x558c52['options']?_0x558c52[_0xab1f('0x11')][_0xab1f('0x12')]===undefined?!![]:![]:!![],'where':_0x558c52['options']?_0x558c52[_0xab1f('0x11')][_0xab1f('0x13')]||null:null,'attributes':_0x558c52['options']?_0x558c52['options'][_0xab1f('0x14')]||null:null,'limit':_0x558c52[_0xab1f('0x11')]?_0x558c52[_0xab1f('0x11')][_0xab1f('0x15')]||null:null,'include':_0x558c52[_0xab1f('0x11')]?_0x558c52[_0xab1f('0x11')][_0xab1f('0x16')]?_['map'](_0x558c52[_0xab1f('0x11')][_0xab1f('0x16')],function(_0x3662b8){return{'model':db[_0x3662b8[_0xab1f('0x17')]],'as':_0x3662b8['as'],'attributes':_0x3662b8['attributes'],'include':_0x3662b8[_0xab1f('0x16')]?_[_0xab1f('0x18')](_0x3662b8[_0xab1f('0x16')],function(_0x162041){return{'model':db[_0x162041['model']],'as':_0x162041['as'],'attributes':_0x162041[_0xab1f('0x14')],'include':_0x162041[_0xab1f('0x16')]?_[_0xab1f('0x18')](_0x162041[_0xab1f('0x16')],function(_0x27d4c3){return{'model':db[_0x27d4c3[_0xab1f('0x17')]],'as':_0x27d4c3['as'],'attributes':_0x27d4c3[_0xab1f('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2216ca){logger['info'](_0xab1f('0xe'),_0x558c52);logger['debug'](_0xab1f('0xe'),_0x558c52,JSON[_0xab1f('0x9')](_0x2216ca));_0x4ba3f4(_0x2216ca);})[_0xab1f('0xd')](function(_0x449e16){logger[_0xab1f('0xb')](_0xab1f('0xe'),_0x449e16[_0xab1f('0xc')],_0x558c52);_0x1b0ab3(_0x1ec084[_0xab1f('0xb')](0x1f4,_0x449e16[_0xab1f('0xc')]));});});};exports['ShowZohoAccount']=function(_0x355706){var _0x5e6170=this;return new Promise(function(_0x1c1bce,_0x24c678){return db[_0xab1f('0xf')][_0xab1f('0x19')]({'raw':_0x355706[_0xab1f('0x11')]?_0x355706['options'][_0xab1f('0x12')]===undefined?!![]:![]:!![],'where':_0x355706[_0xab1f('0x11')]?_0x355706[_0xab1f('0x11')]['where']||null:null,'attributes':_0x355706[_0xab1f('0x11')]?_0x355706['options'][_0xab1f('0x14')]||null:null,'include':_0x355706['options']?_0x355706[_0xab1f('0x11')]['include']?_[_0xab1f('0x18')](_0x355706[_0xab1f('0x11')][_0xab1f('0x16')],function(_0x3a5891){return{'model':db[_0x3a5891['model']],'as':_0x3a5891['as'],'attributes':_0x3a5891['attributes'],'include':_0x3a5891[_0xab1f('0x16')]?_['map'](_0x3a5891[_0xab1f('0x16')],function(_0x2f8ac5){return{'model':db[_0x2f8ac5[_0xab1f('0x17')]],'as':_0x2f8ac5['as'],'attributes':_0x2f8ac5[_0xab1f('0x14')],'include':_0x2f8ac5[_0xab1f('0x16')]?_[_0xab1f('0x18')](_0x2f8ac5['include'],function(_0x32a281){return{'model':db[_0x32a281[_0xab1f('0x17')]],'as':_0x32a281['as'],'attributes':_0x32a281['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x344aec){logger[_0xab1f('0x4')](_0xab1f('0x1a'),_0x355706);logger[_0xab1f('0x7')](_0xab1f('0x1a'),_0x355706,JSON[_0xab1f('0x9')](_0x344aec));_0x1c1bce(_0x344aec);})['catch'](function(_0x316301){logger[_0xab1f('0xb')](_0xab1f('0x1a'),_0x316301[_0xab1f('0xc')],_0x355706);_0x24c678(_0x5e6170[_0xab1f('0xb')](0x1f4,_0x316301[_0xab1f('0xc')]));});});}; \ No newline at end of file +var _0xda81=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowZohoAccount','lodash','util','moment','randomstring'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xda81,0x1c3));var _0x1da8=function(_0x2bfd82,_0x9c87a7){_0x2bfd82=_0x2bfd82-0x0;var _0x52fa6d=_0xda81[_0x2bfd82];return _0x52fa6d;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});}exports[_0x1da8('0x16')]=function(_0x1258e3){var _0xbd6f6=this;return new Promise(function(_0x4ccb6e,_0x46ed0f){return db[_0x1da8('0x17')][_0x1da8('0x18')]({'raw':_0x1258e3[_0x1da8('0x19')]?_0x1258e3[_0x1da8('0x19')][_0x1da8('0x1a')]===undefined?!![]:![]:!![],'where':_0x1258e3['options']?_0x1258e3[_0x1da8('0x19')][_0x1da8('0x1b')]||null:null,'attributes':_0x1258e3[_0x1da8('0x19')]?_0x1258e3[_0x1da8('0x19')][_0x1da8('0x1c')]||null:null,'limit':_0x1258e3[_0x1da8('0x19')]?_0x1258e3['options'][_0x1da8('0x1d')]||null:null,'include':_0x1258e3['options']?_0x1258e3[_0x1da8('0x19')][_0x1da8('0x1e')]?_[_0x1da8('0x1f')](_0x1258e3[_0x1da8('0x19')][_0x1da8('0x1e')],function(_0x2ea607){return{'model':db[_0x2ea607[_0x1da8('0x20')]],'as':_0x2ea607['as'],'attributes':_0x2ea607['attributes'],'include':_0x2ea607['include']?_[_0x1da8('0x1f')](_0x2ea607[_0x1da8('0x1e')],function(_0x4e281e){return{'model':db[_0x4e281e[_0x1da8('0x20')]],'as':_0x4e281e['as'],'attributes':_0x4e281e[_0x1da8('0x1c')],'include':_0x4e281e[_0x1da8('0x1e')]?_[_0x1da8('0x1f')](_0x4e281e[_0x1da8('0x1e')],function(_0x46af20){return{'model':db[_0x46af20['model']],'as':_0x46af20['as'],'attributes':_0x46af20[_0x1da8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1da8('0xb')](function(_0x2d81cd){logger[_0x1da8('0xc')](_0x1da8('0x16'),_0x1258e3);logger[_0x1da8('0xe')](_0x1da8('0x16'),_0x1258e3,JSON[_0x1da8('0x10')](_0x2d81cd));_0x4ccb6e(_0x2d81cd);})[_0x1da8('0x15')](function(_0x21f3fe){logger['error'](_0x1da8('0x16'),_0x21f3fe['message'],_0x1258e3);_0x46ed0f(_0xbd6f6['error'](0x1f4,_0x21f3fe['message']));});});};exports['ShowZohoAccount']=function(_0x3e7c00){var _0x82c59d=this;return new Promise(function(_0x5293ed,_0x198b31){return db['ZohoAccount'][_0x1da8('0x21')]({'raw':_0x3e7c00[_0x1da8('0x19')]?_0x3e7c00[_0x1da8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3e7c00[_0x1da8('0x19')]?_0x3e7c00[_0x1da8('0x19')][_0x1da8('0x1b')]||null:null,'attributes':_0x3e7c00[_0x1da8('0x19')]?_0x3e7c00['options'][_0x1da8('0x1c')]||null:null,'include':_0x3e7c00[_0x1da8('0x19')]?_0x3e7c00[_0x1da8('0x19')][_0x1da8('0x1e')]?_[_0x1da8('0x1f')](_0x3e7c00[_0x1da8('0x19')]['include'],function(_0x3903c4){return{'model':db[_0x3903c4[_0x1da8('0x20')]],'as':_0x3903c4['as'],'attributes':_0x3903c4[_0x1da8('0x1c')],'include':_0x3903c4['include']?_[_0x1da8('0x1f')](_0x3903c4[_0x1da8('0x1e')],function(_0x31995e){return{'model':db[_0x31995e[_0x1da8('0x20')]],'as':_0x31995e['as'],'attributes':_0x31995e[_0x1da8('0x1c')],'include':_0x31995e['include']?_[_0x1da8('0x1f')](_0x31995e[_0x1da8('0x1e')],function(_0x1a99bc){return{'model':db[_0x1a99bc['model']],'as':_0x1a99bc['as'],'attributes':_0x1a99bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x1da8('0xb')](function(_0x5ad077){logger['info']('ShowZohoAccount',_0x3e7c00);logger[_0x1da8('0xe')](_0x1da8('0x22'),_0x3e7c00,JSON[_0x1da8('0x10')](_0x5ad077));_0x5293ed(_0x5ad077);})['catch'](function(_0x166934){logger['error'](_0x1da8('0x22'),_0x166934[_0x1da8('0x13')],_0x3e7c00);_0x198b31(_0x82c59d[_0x1da8('0x11')](0x1f4,_0x166934[_0x1da8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index baa1055..77e0c1c 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 _0xac9b=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x1eff7c,_0x357ad0){var _0x304854=function(_0x27f760){while(--_0x27f760){_0x1eff7c['push'](_0x1eff7c['shift']());}};_0x304854(++_0x357ad0);}(_0xac9b,0xb5));var _0xbac9=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0xac9b[_0x2de020];return _0x182b7c;};'use strict';var multer=require(_0xbac9('0x0'));var util=require(_0xbac9('0x1'));var path=require(_0xbac9('0x2'));var timeout=require(_0xbac9('0x3'));var express=require(_0xbac9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbac9('0x5'));var interaction=require(_0xbac9('0x6'));var config=require('../../config/environment');var controller=require(_0xbac9('0x7'));router[_0xbac9('0x8')]('/',auth[_0xbac9('0x9')](),controller[_0xbac9('0xa')]);router[_0xbac9('0x8')](_0xbac9('0xb'),auth[_0xbac9('0x9')](),controller[_0xbac9('0xc')]);router['get'](_0xbac9('0xd'),auth[_0xbac9('0x9')](),controller[_0xbac9('0xe')]);router[_0xbac9('0x8')](_0xbac9('0xf'),auth[_0xbac9('0x9')](),controller[_0xbac9('0x10')]);router['get'](_0xbac9('0x11'),auth[_0xbac9('0x9')](),controller[_0xbac9('0x12')]);router[_0xbac9('0x13')]('/',auth[_0xbac9('0x9')](),controller[_0xbac9('0x14')]);router['put'](_0xbac9('0xb'),auth['isAuthenticated'](),controller[_0xbac9('0x15')]);router[_0xbac9('0x16')](_0xbac9('0xb'),auth['isAuthenticated'](),controller[_0xbac9('0x17')]);module[_0xbac9('0x18')]=router; \ No newline at end of file +var _0x6387=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x6387,0xbb));var _0x7638=function(_0x57ee8,_0x129df7){_0x57ee8=_0x57ee8-0x0;var _0x8daa2=_0x6387[_0x57ee8];return _0x8daa2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7638('0x0'));var timeout=require(_0x7638('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7638('0x2'));var auth=require(_0x7638('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7638('0x4'));var controller=require('./intZohoConfiguration.controller');router[_0x7638('0x5')]('/',auth[_0x7638('0x6')](),controller[_0x7638('0x7')]);router[_0x7638('0x5')](_0x7638('0x8'),auth[_0x7638('0x6')](),controller['show']);router[_0x7638('0x5')](_0x7638('0x9'),auth[_0x7638('0x6')](),controller['getFields']);router[_0x7638('0x5')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7638('0xa')]);router[_0x7638('0x5')](_0x7638('0xb'),auth[_0x7638('0x6')](),controller[_0x7638('0xc')]);router[_0x7638('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7638('0xe')](_0x7638('0x8'),auth[_0x7638('0x6')](),controller['update']);router[_0x7638('0xf')](_0x7638('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x7638('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 81d4ea6..3529706 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 _0x295f=['nothing','contact_lead','lead','exports','STRING','ENUM','contact'];(function(_0x100916,_0x25270d){var _0xa31589=function(_0x2e5f3f){while(--_0x2e5f3f){_0x100916['push'](_0x100916['shift']());}};_0xa31589(++_0x25270d);}(_0x295f,0x168));var _0xf295=function(_0x4e5842,_0x26442b){_0x4e5842=_0x4e5842-0x0;var _0x3f8ae2=_0x295f[_0x4e5842];return _0x3f8ae2;};'use strict';var Sequelize=require('sequelize');module[_0xf295('0x0')]={'name':{'type':Sequelize[_0xf295('0x1')]},'moduleCreate':{'type':Sequelize[_0xf295('0x2')]('lead',_0xf295('0x3'),_0xf295('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xf295('0x5'),_0xf295('0x3'),_0xf295('0x6')),'defaultValue':_0xf295('0x5')},'description':{'type':Sequelize[_0xf295('0x1')]}}; \ No newline at end of file +var _0x630f=['contact','nothing','contact_lead','STRING','ENUM','lead'];(function(_0x31e649,_0xb74ea1){var _0x2925ae=function(_0xef43f0){while(--_0xef43f0){_0x31e649['push'](_0x31e649['shift']());}};_0x2925ae(++_0xb74ea1);}(_0x630f,0x178));var _0xf630=function(_0x325b55,_0x38db96){_0x325b55=_0x325b55-0x0;var _0x5dc9fe=_0x630f[_0x325b55];return _0x5dc9fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf630('0x0')](_0xf630('0x1'),_0xf630('0x2'),_0xf630('0x3')),'defaultValue':_0xf630('0x1')},'moduleSearch':{'type':Sequelize[_0xf630('0x0')](_0xf630('0x4'),_0xf630('0x2'),'lead'),'defaultValue':_0xf630('0x4')},'description':{'type':Sequelize[_0xf630('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 3f642eb..a4a4296 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 _0x1d47=['offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','findAll','catch','params','keys','options','find','create','body','getFields','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5941f9,_0x1261f1){var _0xbdc9f9=function(_0xcc6abe){while(--_0xcc6abe){_0x5941f9['push'](_0x5941f9['shift']());}};_0xbdc9f9(++_0x1261f1);}(_0x1d47,0x7d));var _0x71d4=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x1d47[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0x71d4('0x0'));var rimraf=require(_0x71d4('0x1'));var zipdir=require(_0x71d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71d4('0x3'));var moment=require(_0x71d4('0x4'));var BPromise=require(_0x71d4('0x5'));var Mustache=require('mustache');var util=require(_0x71d4('0x6'));var path=require(_0x71d4('0x7'));var sox=require(_0x71d4('0x8'));var csv=require(_0x71d4('0x9'));var ejs=require(_0x71d4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x71d4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x71d4('0xc'));var toCsv=require(_0x71d4('0x9'));var querystring=require('querystring');var Papa=require(_0x71d4('0xd'));var Redis=require(_0x71d4('0xe'));var authService=require(_0x71d4('0xf'));var qs=require(_0x71d4('0x10'));var as=require(_0x71d4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x71d4('0x12'));var utils=require('../../config/utils');var config=require(_0x71d4('0x13'));var licenseUtil=require(_0x71d4('0x14'));var db=require(_0x71d4('0x15'))['db'];function respondWithStatusCode(_0x4a9f11,_0x5adfcc){_0x5adfcc=_0x5adfcc||0xcc;return function(_0x57bca9){if(_0x57bca9){return _0x4a9f11[_0x71d4('0x16')](_0x5adfcc);}return _0x4a9f11['status'](_0x5adfcc)[_0x71d4('0x17')]();};}function respondWithResult(_0x48bf68,_0x52f5a8){_0x52f5a8=_0x52f5a8||0xc8;return function(_0x581edc){if(_0x581edc){return _0x48bf68[_0x71d4('0x18')](_0x52f5a8)['json'](_0x581edc);}};}function respondWithFilteredResult(_0x2ebc9b,_0x485eb0){return function(_0x5b77f8){if(_0x5b77f8){var _0x386908=typeof _0x485eb0[_0x71d4('0x19')]===_0x71d4('0x1a')&&typeof _0x485eb0['limit']===_0x71d4('0x1a');var _0x41cf58=_0x5b77f8[_0x71d4('0x1b')];var _0x16e74f=_0x386908?0x0:_0x485eb0[_0x71d4('0x19')];var _0x4a1a85=_0x386908?_0x5b77f8[_0x71d4('0x1b')]:_0x485eb0[_0x71d4('0x19')]+_0x485eb0['limit'];var _0x345414;if(_0x4a1a85>=_0x41cf58){_0x4a1a85=_0x41cf58;_0x345414=0xc8;}else{_0x345414=0xce;}_0x2ebc9b[_0x71d4('0x18')](_0x345414);return _0x2ebc9b[_0x71d4('0x1c')](_0x71d4('0x1d'),_0x16e74f+'-'+_0x4a1a85+'/'+_0x41cf58)[_0x71d4('0x1e')](_0x5b77f8);}return null;};}function patchUpdates(_0x165d42){return function(_0x10b0ba){try{jsonpatch[_0x71d4('0x1f')](_0x10b0ba,_0x165d42,!![]);}catch(_0x5c73ee){return BPromise[_0x71d4('0x20')](_0x5c73ee);}return _0x10b0ba['save']();};}function saveUpdates(_0x6cf67c,_0xfd4074){return function(_0x2eafb6){if(_0x2eafb6){return _0x2eafb6[_0x71d4('0x21')](_0x6cf67c)[_0x71d4('0x22')](function(_0x66d65d){return _0x66d65d;});}return null;};}function removeEntity(_0xf10f66,_0x356cf5){return function(_0x51c205){if(_0x51c205){return _0x51c205[_0x71d4('0x23')]()[_0x71d4('0x22')](function(){_0xf10f66[_0x71d4('0x18')](0xcc)[_0x71d4('0x17')]();});}};}function handleEntityNotFound(_0x30f656,_0x24c3ba){return function(_0x992dd6){if(!_0x992dd6){_0x30f656[_0x71d4('0x16')](0x194);}return _0x992dd6;};}function handleError(_0x38d5ab,_0xea08ba){_0xea08ba=_0xea08ba||0x1f4;return function(_0x34adce){logger[_0x71d4('0x24')](_0x34adce[_0x71d4('0x25')]);if(_0x34adce[_0x71d4('0x26')]){delete _0x34adce['name'];}_0x38d5ab[_0x71d4('0x18')](_0xea08ba)[_0x71d4('0x27')](_0x34adce);};}exports[_0x71d4('0x28')]=function(_0x247886,_0x15e2fb){var _0x52eb24={},_0x587483={},_0x39b0bc={'count':0x0,'rows':[]};var _0x2d4373=_['map'](db[_0x71d4('0x29')][_0x71d4('0x2a')],function(_0x108303){return{'name':_0x108303['fieldName'],'type':_0x108303[_0x71d4('0x2b')][_0x71d4('0x2c')]};});_0x587483[_0x71d4('0x2d')]=_[_0x71d4('0x2e')](_0x2d4373,_0x71d4('0x26'));_0x587483[_0x71d4('0x2f')]=_['keys'](_0x247886['query']);_0x587483[_0x71d4('0x30')]=_['intersection'](_0x587483[_0x71d4('0x2d')],_0x587483[_0x71d4('0x2f')]);_0x52eb24['attributes']=_[_0x71d4('0x31')](_0x587483['model'],qs[_0x71d4('0x32')](_0x247886[_0x71d4('0x2f')]['fields']));_0x52eb24[_0x71d4('0x33')]=_0x52eb24['attributes'][_0x71d4('0x34')]?_0x52eb24[_0x71d4('0x33')]:_0x587483[_0x71d4('0x2d')];if(!_0x247886[_0x71d4('0x2f')][_0x71d4('0x35')](_0x71d4('0x36'))){_0x52eb24[_0x71d4('0x37')]=qs['limit'](_0x247886[_0x71d4('0x2f')]['limit']);_0x52eb24[_0x71d4('0x19')]=qs[_0x71d4('0x19')](_0x247886[_0x71d4('0x2f')][_0x71d4('0x19')]);}_0x52eb24[_0x71d4('0x38')]=qs[_0x71d4('0x39')](_0x247886[_0x71d4('0x2f')][_0x71d4('0x39')]);_0x52eb24[_0x71d4('0x3a')]=qs['filters'](_[_0x71d4('0x3b')](_0x247886[_0x71d4('0x2f')],_0x587483[_0x71d4('0x30')]),_0x2d4373);if(_0x247886[_0x71d4('0x2f')]['filter']){_0x52eb24[_0x71d4('0x3a')]=_[_0x71d4('0x3c')](_0x52eb24[_0x71d4('0x3a')],{'$or':_[_0x71d4('0x2e')](_0x2d4373,function(_0x5f688c){if(_0x5f688c[_0x71d4('0x2b')]!=='VIRTUAL'){var _0x429260={};_0x429260[_0x5f688c[_0x71d4('0x26')]]={'$like':'%'+_0x247886['query'][_0x71d4('0x3d')]+'%'};return _0x429260;}})});}_0x52eb24=_[_0x71d4('0x3c')]({},_0x52eb24,_0x247886['options']);var _0x21d633={'where':_0x52eb24[_0x71d4('0x3a')]};return db[_0x71d4('0x29')][_0x71d4('0x1b')](_0x21d633)[_0x71d4('0x22')](function(_0x12b699){_0x39b0bc[_0x71d4('0x1b')]=_0x12b699;if(_0x247886[_0x71d4('0x2f')]['includeAll']){_0x52eb24['include']=[{'all':!![]}];}return db[_0x71d4('0x29')][_0x71d4('0x3e')](_0x52eb24);})[_0x71d4('0x22')](function(_0x1c2c34){_0x39b0bc['rows']=_0x1c2c34;return _0x39b0bc;})[_0x71d4('0x22')](respondWithFilteredResult(_0x15e2fb,_0x52eb24))[_0x71d4('0x3f')](handleError(_0x15e2fb,null));};exports['show']=function(_0x5290d0,_0x41ef5c){var _0x39d578={'raw':![],'where':{'id':_0x5290d0[_0x71d4('0x40')]['id']}},_0x43dc50={};_0x43dc50[_0x71d4('0x2d')]=_[_0x71d4('0x41')](db[_0x71d4('0x29')][_0x71d4('0x2a')]);_0x43dc50[_0x71d4('0x2f')]=_[_0x71d4('0x41')](_0x5290d0[_0x71d4('0x2f')]);_0x43dc50[_0x71d4('0x30')]=_[_0x71d4('0x31')](_0x43dc50['model'],_0x43dc50['query']);_0x39d578['attributes']=_[_0x71d4('0x31')](_0x43dc50[_0x71d4('0x2d')],qs['fields'](_0x5290d0[_0x71d4('0x2f')][_0x71d4('0x32')]));_0x39d578[_0x71d4('0x33')]=_0x39d578[_0x71d4('0x33')][_0x71d4('0x34')]?_0x39d578[_0x71d4('0x33')]:_0x43dc50[_0x71d4('0x2d')];if(_0x5290d0['query']['includeAll']){_0x39d578['include']=[{'all':!![]}];}_0x39d578=_[_0x71d4('0x3c')]({},_0x39d578,_0x5290d0[_0x71d4('0x42')]);return db[_0x71d4('0x29')][_0x71d4('0x43')](_0x39d578)[_0x71d4('0x22')](handleEntityNotFound(_0x41ef5c,null))[_0x71d4('0x22')](respondWithResult(_0x41ef5c,null))[_0x71d4('0x3f')](handleError(_0x41ef5c,null));};exports['create']=function(_0x5f192d,_0x221cf5){return db[_0x71d4('0x29')][_0x71d4('0x44')](_0x5f192d['body'],{})[_0x71d4('0x22')](respondWithResult(_0x221cf5,0xc9))[_0x71d4('0x3f')](handleError(_0x221cf5,null));};exports[_0x71d4('0x21')]=function(_0x4e178a,_0x384450){if(_0x4e178a[_0x71d4('0x45')]['id']){delete _0x4e178a[_0x71d4('0x45')]['id'];}return db[_0x71d4('0x29')][_0x71d4('0x43')]({'where':{'id':_0x4e178a[_0x71d4('0x40')]['id']}})[_0x71d4('0x22')](handleEntityNotFound(_0x384450,null))[_0x71d4('0x22')](saveUpdates(_0x4e178a['body'],null))[_0x71d4('0x22')](respondWithResult(_0x384450,null))[_0x71d4('0x3f')](handleError(_0x384450,null));};exports[_0x71d4('0x23')]=function(_0x2a233c,_0x29ae1a){return db[_0x71d4('0x29')][_0x71d4('0x43')]({'where':{'id':_0x2a233c['params']['id']}})['then'](handleEntityNotFound(_0x29ae1a,null))[_0x71d4('0x22')](removeEntity(_0x29ae1a,null))[_0x71d4('0x3f')](handleError(_0x29ae1a,null));};exports[_0x71d4('0x46')]=function(_0x28fe3d,_0x14371b,_0x5f0103){var _0xb5d9df={};var _0x187746={};var _0x107946;var _0x2cbc87;return db[_0x71d4('0x29')]['findOne']({'where':{'id':_0x28fe3d['params']['id']}})[_0x71d4('0x22')](handleEntityNotFound(_0x14371b,null))[_0x71d4('0x22')](function(_0xf92e97){if(_0xf92e97){_0x107946=_0xf92e97;_0x187746[_0x71d4('0x2d')]=_[_0x71d4('0x41')](db[_0x71d4('0x47')]['rawAttributes']);_0x187746[_0x71d4('0x2f')]=_['keys'](_0x28fe3d[_0x71d4('0x2f')]);_0x187746['filters']=_['intersection'](_0x187746[_0x71d4('0x2d')],_0x187746['query']);_0xb5d9df['attributes']=_[_0x71d4('0x31')](_0x187746[_0x71d4('0x2d')],qs[_0x71d4('0x32')](_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x32')]));_0xb5d9df[_0x71d4('0x33')]=_0xb5d9df[_0x71d4('0x33')][_0x71d4('0x34')]?_0xb5d9df[_0x71d4('0x33')]:_0x187746[_0x71d4('0x2d')];_0xb5d9df[_0x71d4('0x38')]=qs[_0x71d4('0x39')](_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x39')]);_0xb5d9df[_0x71d4('0x3a')]=qs['filters'](_[_0x71d4('0x3b')](_0x28fe3d[_0x71d4('0x2f')],_0x187746['filters']));if(_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x3d')]){_0xb5d9df['where']=_['merge'](_0xb5d9df[_0x71d4('0x3a')],{'$or':_[_0x71d4('0x2e')](_0xb5d9df[_0x71d4('0x33')],function(_0xa12bdf){var _0x33da6d={};_0x33da6d[_0xa12bdf]={'$like':'%'+_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x3d')]+'%'};return _0x33da6d;})});}_0xb5d9df=_[_0x71d4('0x3c')]({},_0xb5d9df,_0x28fe3d['options']);return _0x107946[_0x71d4('0x46')](_0xb5d9df);}})[_0x71d4('0x22')](function(_0x2ba5ad){if(_0x2ba5ad){_0x2cbc87=_0x2ba5ad['length'];if(!_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x35')](_0x71d4('0x36'))){_0xb5d9df[_0x71d4('0x37')]=qs[_0x71d4('0x37')](_0x28fe3d['query'][_0x71d4('0x37')]);_0xb5d9df[_0x71d4('0x19')]=qs['offset'](_0x28fe3d[_0x71d4('0x2f')][_0x71d4('0x19')]);}return _0x107946[_0x71d4('0x46')](_0xb5d9df);}})[_0x71d4('0x22')](function(_0x527be4){if(_0x527be4){return _0x527be4?{'count':_0x2cbc87,'rows':_0x527be4}:null;}})['then'](respondWithResult(_0x14371b,null))[_0x71d4('0x3f')](handleError(_0x14371b,null));};exports[_0x71d4('0x48')]=function(_0x1e6e9c,_0x558d30,_0x554248){var _0x52035f={};var _0x4949ae={};var _0x2674f2;var _0x5c6f60;return db[_0x71d4('0x29')]['findOne']({'where':{'id':_0x1e6e9c['params']['id']}})['then'](handleEntityNotFound(_0x558d30,null))[_0x71d4('0x22')](function(_0x203bbf){if(_0x203bbf){_0x2674f2=_0x203bbf;_0x4949ae['model']=_[_0x71d4('0x41')](db['ZohoField']['rawAttributes']);_0x4949ae['query']=_['keys'](_0x1e6e9c[_0x71d4('0x2f')]);_0x4949ae[_0x71d4('0x30')]=_[_0x71d4('0x31')](_0x4949ae[_0x71d4('0x2d')],_0x4949ae[_0x71d4('0x2f')]);_0x52035f[_0x71d4('0x33')]=_[_0x71d4('0x31')](_0x4949ae[_0x71d4('0x2d')],qs[_0x71d4('0x32')](_0x1e6e9c[_0x71d4('0x2f')][_0x71d4('0x32')]));_0x52035f['attributes']=_0x52035f[_0x71d4('0x33')][_0x71d4('0x34')]?_0x52035f[_0x71d4('0x33')]:_0x4949ae[_0x71d4('0x2d')];_0x52035f[_0x71d4('0x38')]=qs['sort'](_0x1e6e9c[_0x71d4('0x2f')][_0x71d4('0x39')]);_0x52035f[_0x71d4('0x3a')]=qs['filters'](_[_0x71d4('0x3b')](_0x1e6e9c[_0x71d4('0x2f')],_0x4949ae[_0x71d4('0x30')]));if(_0x1e6e9c[_0x71d4('0x2f')][_0x71d4('0x3d')]){_0x52035f[_0x71d4('0x3a')]=_[_0x71d4('0x3c')](_0x52035f[_0x71d4('0x3a')],{'$or':_[_0x71d4('0x2e')](_0x52035f['attributes'],function(_0x13cba7){var _0xf650b8={};_0xf650b8[_0x13cba7]={'$like':'%'+_0x1e6e9c[_0x71d4('0x2f')][_0x71d4('0x3d')]+'%'};return _0xf650b8;})});}_0x52035f=_['merge']({},_0x52035f,_0x1e6e9c[_0x71d4('0x42')]);return _0x2674f2[_0x71d4('0x48')](_0x52035f);}})['then'](function(_0x46b700){if(_0x46b700){_0x5c6f60=_0x46b700[_0x71d4('0x34')];if(!_0x1e6e9c[_0x71d4('0x2f')]['hasOwnProperty']('nolimit')){_0x52035f[_0x71d4('0x37')]=qs[_0x71d4('0x37')](_0x1e6e9c['query'][_0x71d4('0x37')]);_0x52035f[_0x71d4('0x19')]=qs[_0x71d4('0x19')](_0x1e6e9c[_0x71d4('0x2f')][_0x71d4('0x19')]);}return _0x2674f2[_0x71d4('0x48')](_0x52035f);}})[_0x71d4('0x22')](function(_0x266512){if(_0x266512){return _0x266512?{'count':_0x5c6f60,'rows':_0x266512}:null;}})[_0x71d4('0x22')](respondWithResult(_0x558d30,null))[_0x71d4('0x3f')](handleError(_0x558d30,null));};exports['getDescriptions']=function(_0x3a2424,_0x194f75,_0x246bd7){var _0x373457={};var _0x5e9b1b={};var _0x2f0fd2;var _0x226b9a;return db[_0x71d4('0x29')][_0x71d4('0x49')]({'where':{'id':_0x3a2424[_0x71d4('0x40')]['id']}})[_0x71d4('0x22')](handleEntityNotFound(_0x194f75,null))[_0x71d4('0x22')](function(_0x16c7ba){if(_0x16c7ba){_0x2f0fd2=_0x16c7ba;_0x5e9b1b[_0x71d4('0x2d')]=_['keys'](db[_0x71d4('0x47')]['rawAttributes']);_0x5e9b1b[_0x71d4('0x2f')]=_[_0x71d4('0x41')](_0x3a2424['query']);_0x5e9b1b['filters']=_[_0x71d4('0x31')](_0x5e9b1b['model'],_0x5e9b1b[_0x71d4('0x2f')]);_0x373457[_0x71d4('0x33')]=_[_0x71d4('0x31')](_0x5e9b1b[_0x71d4('0x2d')],qs[_0x71d4('0x32')](_0x3a2424[_0x71d4('0x2f')][_0x71d4('0x32')]));_0x373457['attributes']=_0x373457['attributes'][_0x71d4('0x34')]?_0x373457[_0x71d4('0x33')]:_0x5e9b1b['model'];_0x373457['order']=qs['sort'](_0x3a2424[_0x71d4('0x2f')]['sort']);_0x373457[_0x71d4('0x3a')]=qs['filters'](_[_0x71d4('0x3b')](_0x3a2424['query'],_0x5e9b1b[_0x71d4('0x30')]));if(_0x3a2424[_0x71d4('0x2f')]['filter']){_0x373457[_0x71d4('0x3a')]=_[_0x71d4('0x3c')](_0x373457[_0x71d4('0x3a')],{'$or':_[_0x71d4('0x2e')](_0x373457[_0x71d4('0x33')],function(_0x12528b){var _0x3d9fd2={};_0x3d9fd2[_0x12528b]={'$like':'%'+_0x3a2424[_0x71d4('0x2f')]['filter']+'%'};return _0x3d9fd2;})});}_0x373457=_[_0x71d4('0x3c')]({},_0x373457,_0x3a2424[_0x71d4('0x42')]);return _0x2f0fd2[_0x71d4('0x4a')](_0x373457);}})[_0x71d4('0x22')](function(_0x45df1e){if(_0x45df1e){_0x226b9a=_0x45df1e['length'];if(!_0x3a2424['query'][_0x71d4('0x35')](_0x71d4('0x36'))){_0x373457[_0x71d4('0x37')]=qs[_0x71d4('0x37')](_0x3a2424[_0x71d4('0x2f')][_0x71d4('0x37')]);_0x373457[_0x71d4('0x19')]=qs[_0x71d4('0x19')](_0x3a2424['query'][_0x71d4('0x19')]);}return _0x2f0fd2['getDescriptions'](_0x373457);}})[_0x71d4('0x22')](function(_0x1e96a1){if(_0x1e96a1){return _0x1e96a1?{'count':_0x226b9a,'rows':_0x1e96a1}:null;}})[_0x71d4('0x22')](respondWithResult(_0x194f75,null))[_0x71d4('0x3f')](handleError(_0x194f75,null));}; \ No newline at end of file +var _0x9b34=['intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ZohoConfiguration','count','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes'];(function(_0x26d356,_0x312297){var _0x3a0139=function(_0x303596){while(--_0x303596){_0x26d356['push'](_0x26d356['shift']());}};_0x3a0139(++_0x312297);}(_0x9b34,0x10f));var _0x49b3=function(_0x47673f,_0xd025cd){_0x47673f=_0x47673f-0x0;var _0x22fd72=_0x9b34[_0x47673f];return _0x22fd72;};'use strict';var emlformat=require(_0x49b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49b3('0x1'));var jsonpatch=require(_0x49b3('0x2'));var rp=require(_0x49b3('0x3'));var moment=require(_0x49b3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x49b3('0x5'));var path=require(_0x49b3('0x6'));var sox=require('sox');var csv=require(_0x49b3('0x7'));var ejs=require(_0x49b3('0x8'));var fs=require('fs');var fs_extra=require(_0x49b3('0x9'));var _=require(_0x49b3('0xa'));var squel=require(_0x49b3('0xb'));var crypto=require('crypto');var jsforce=require(_0x49b3('0xc'));var deskjs=require(_0x49b3('0xd'));var toCsv=require(_0x49b3('0x7'));var querystring=require(_0x49b3('0xe'));var Papa=require('papaparse');var Redis=require(_0x49b3('0xf'));var authService=require(_0x49b3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x49b3('0x11'));var hardwareService=require(_0x49b3('0x12'));var logger=require('../../config/logger')(_0x49b3('0x13'));var utils=require(_0x49b3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x49b3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509fa1,_0x562934){_0x562934=_0x562934||0xcc;return function(_0x7ca917){if(_0x7ca917){return _0x509fa1[_0x49b3('0x16')](_0x562934);}return _0x509fa1[_0x49b3('0x17')](_0x562934)[_0x49b3('0x18')]();};}function respondWithResult(_0x10cabf,_0x448d23){_0x448d23=_0x448d23||0xc8;return function(_0x1eec06){if(_0x1eec06){return _0x10cabf[_0x49b3('0x17')](_0x448d23)[_0x49b3('0x19')](_0x1eec06);}};}function respondWithFilteredResult(_0x2094fb,_0x12c7ff){return function(_0x5c7a4a){if(_0x5c7a4a){var _0xed4de8=typeof _0x12c7ff[_0x49b3('0x1a')]===_0x49b3('0x1b')&&typeof _0x12c7ff['limit']===_0x49b3('0x1b');var _0x2898f2=_0x5c7a4a['count'];var _0x2b0a51=_0xed4de8?0x0:_0x12c7ff[_0x49b3('0x1a')];var _0x33ea14=_0xed4de8?_0x5c7a4a['count']:_0x12c7ff['offset']+_0x12c7ff[_0x49b3('0x1c')];var _0x124da0;if(_0x33ea14>=_0x2898f2){_0x33ea14=_0x2898f2;_0x124da0=0xc8;}else{_0x124da0=0xce;}_0x2094fb['status'](_0x124da0);return _0x2094fb[_0x49b3('0x1d')](_0x49b3('0x1e'),_0x2b0a51+'-'+_0x33ea14+'/'+_0x2898f2)[_0x49b3('0x19')](_0x5c7a4a);}return null;};}function patchUpdates(_0x80d255){return function(_0xf01e38){try{jsonpatch[_0x49b3('0x1f')](_0xf01e38,_0x80d255,!![]);}catch(_0x872fc6){return BPromise[_0x49b3('0x20')](_0x872fc6);}return _0xf01e38[_0x49b3('0x21')]();};}function saveUpdates(_0x6509d7,_0x3ed29a){return function(_0x557e22){if(_0x557e22){return _0x557e22['update'](_0x6509d7)[_0x49b3('0x22')](function(_0xc7d270){return _0xc7d270;});}return null;};}function removeEntity(_0x6d1eaa,_0x3e73c1){return function(_0x4a98e3){if(_0x4a98e3){return _0x4a98e3[_0x49b3('0x23')]()[_0x49b3('0x22')](function(){_0x6d1eaa[_0x49b3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a45f,_0x573100){return function(_0x54b96e){if(!_0x54b96e){_0x23a45f[_0x49b3('0x16')](0x194);}return _0x54b96e;};}function handleError(_0x4a6a17,_0x1a6fb3){_0x1a6fb3=_0x1a6fb3||0x1f4;return function(_0x2053c7){logger[_0x49b3('0x24')](_0x2053c7[_0x49b3('0x25')]);if(_0x2053c7[_0x49b3('0x26')]){delete _0x2053c7['name'];}_0x4a6a17['status'](_0x1a6fb3)[_0x49b3('0x27')](_0x2053c7);};}exports['index']=function(_0x5be624,_0x3220d7){var _0x3b27a1={},_0x5814e2={},_0x474fc4={'count':0x0,'rows':[]};var _0x32ca4f=_['map'](db['ZohoConfiguration'][_0x49b3('0x28')],function(_0x129f5b){return{'name':_0x129f5b[_0x49b3('0x29')],'type':_0x129f5b[_0x49b3('0x2a')][_0x49b3('0x2b')]};});_0x5814e2[_0x49b3('0x2c')]=_[_0x49b3('0x2d')](_0x32ca4f,_0x49b3('0x26'));_0x5814e2['query']=_['keys'](_0x5be624[_0x49b3('0x2e')]);_0x5814e2[_0x49b3('0x2f')]=_['intersection'](_0x5814e2['model'],_0x5814e2[_0x49b3('0x2e')]);_0x3b27a1[_0x49b3('0x30')]=_[_0x49b3('0x31')](_0x5814e2[_0x49b3('0x2c')],qs[_0x49b3('0x32')](_0x5be624[_0x49b3('0x2e')][_0x49b3('0x32')]));_0x3b27a1[_0x49b3('0x30')]=_0x3b27a1[_0x49b3('0x30')][_0x49b3('0x33')]?_0x3b27a1[_0x49b3('0x30')]:_0x5814e2[_0x49b3('0x2c')];if(!_0x5be624[_0x49b3('0x2e')]['hasOwnProperty'](_0x49b3('0x34'))){_0x3b27a1['limit']=qs[_0x49b3('0x1c')](_0x5be624[_0x49b3('0x2e')][_0x49b3('0x1c')]);_0x3b27a1[_0x49b3('0x1a')]=qs['offset'](_0x5be624['query'][_0x49b3('0x1a')]);}_0x3b27a1[_0x49b3('0x35')]=qs['sort'](_0x5be624[_0x49b3('0x2e')][_0x49b3('0x36')]);_0x3b27a1[_0x49b3('0x37')]=qs['filters'](_[_0x49b3('0x38')](_0x5be624[_0x49b3('0x2e')],_0x5814e2[_0x49b3('0x2f')]),_0x32ca4f);if(_0x5be624[_0x49b3('0x2e')][_0x49b3('0x39')]){_0x3b27a1['where']=_['merge'](_0x3b27a1[_0x49b3('0x37')],{'$or':_[_0x49b3('0x2d')](_0x32ca4f,function(_0x509948){if(_0x509948['type']!==_0x49b3('0x3a')){var _0x5f1241={};_0x5f1241[_0x509948[_0x49b3('0x26')]]={'$like':'%'+_0x5be624[_0x49b3('0x2e')][_0x49b3('0x39')]+'%'};return _0x5f1241;}})});}_0x3b27a1=_[_0x49b3('0x3b')]({},_0x3b27a1,_0x5be624[_0x49b3('0x3c')]);var _0xf8ac03={'where':_0x3b27a1['where']};return db[_0x49b3('0x3d')][_0x49b3('0x3e')](_0xf8ac03)[_0x49b3('0x22')](function(_0x55326b){_0x474fc4[_0x49b3('0x3e')]=_0x55326b;if(_0x5be624[_0x49b3('0x2e')][_0x49b3('0x3f')]){_0x3b27a1['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x49b3('0x40')](_0x3b27a1);})[_0x49b3('0x22')](function(_0x596d52){_0x474fc4[_0x49b3('0x41')]=_0x596d52;return _0x474fc4;})[_0x49b3('0x22')](respondWithFilteredResult(_0x3220d7,_0x3b27a1))[_0x49b3('0x42')](handleError(_0x3220d7,null));};exports[_0x49b3('0x43')]=function(_0x310907,_0x2b88f5){var _0x44a4c6={'raw':![],'where':{'id':_0x310907[_0x49b3('0x44')]['id']}},_0x17e05a={};_0x17e05a[_0x49b3('0x2c')]=_[_0x49b3('0x45')](db[_0x49b3('0x3d')][_0x49b3('0x28')]);_0x17e05a[_0x49b3('0x2e')]=_[_0x49b3('0x45')](_0x310907[_0x49b3('0x2e')]);_0x17e05a[_0x49b3('0x2f')]=_[_0x49b3('0x31')](_0x17e05a[_0x49b3('0x2c')],_0x17e05a[_0x49b3('0x2e')]);_0x44a4c6[_0x49b3('0x30')]=_[_0x49b3('0x31')](_0x17e05a[_0x49b3('0x2c')],qs[_0x49b3('0x32')](_0x310907[_0x49b3('0x2e')][_0x49b3('0x32')]));_0x44a4c6['attributes']=_0x44a4c6['attributes'][_0x49b3('0x33')]?_0x44a4c6[_0x49b3('0x30')]:_0x17e05a[_0x49b3('0x2c')];if(_0x310907['query'][_0x49b3('0x3f')]){_0x44a4c6[_0x49b3('0x46')]=[{'all':!![]}];}_0x44a4c6=_['merge']({},_0x44a4c6,_0x310907[_0x49b3('0x3c')]);return db['ZohoConfiguration']['find'](_0x44a4c6)[_0x49b3('0x22')](handleEntityNotFound(_0x2b88f5,null))['then'](respondWithResult(_0x2b88f5,null))['catch'](handleError(_0x2b88f5,null));};exports[_0x49b3('0x47')]=function(_0x1db88d,_0x1a8d97){return db['ZohoConfiguration'][_0x49b3('0x47')](_0x1db88d[_0x49b3('0x48')],{})[_0x49b3('0x22')](respondWithResult(_0x1a8d97,0xc9))[_0x49b3('0x42')](handleError(_0x1a8d97,null));};exports['update']=function(_0x48103b,_0x4a3bb7){if(_0x48103b[_0x49b3('0x48')]['id']){delete _0x48103b[_0x49b3('0x48')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x48103b[_0x49b3('0x44')]['id']}})[_0x49b3('0x22')](handleEntityNotFound(_0x4a3bb7,null))[_0x49b3('0x22')](saveUpdates(_0x48103b[_0x49b3('0x48')],null))[_0x49b3('0x22')](respondWithResult(_0x4a3bb7,null))[_0x49b3('0x42')](handleError(_0x4a3bb7,null));};exports[_0x49b3('0x23')]=function(_0x1bb9bd,_0x27c7af){return db[_0x49b3('0x3d')][_0x49b3('0x49')]({'where':{'id':_0x1bb9bd['params']['id']}})[_0x49b3('0x22')](handleEntityNotFound(_0x27c7af,null))[_0x49b3('0x22')](removeEntity(_0x27c7af,null))[_0x49b3('0x42')](handleError(_0x27c7af,null));};exports[_0x49b3('0x4a')]=function(_0x27e4ae,_0x30c030,_0xf0d8ff){var _0x5841d6={};var _0x208183={};var _0x5a1eb1;var _0xc01bcc;return db[_0x49b3('0x3d')][_0x49b3('0x4b')]({'where':{'id':_0x27e4ae[_0x49b3('0x44')]['id']}})[_0x49b3('0x22')](handleEntityNotFound(_0x30c030,null))[_0x49b3('0x22')](function(_0x27b17b){if(_0x27b17b){_0x5a1eb1=_0x27b17b;_0x208183[_0x49b3('0x2c')]=_[_0x49b3('0x45')](db[_0x49b3('0x4c')][_0x49b3('0x28')]);_0x208183[_0x49b3('0x2e')]=_[_0x49b3('0x45')](_0x27e4ae['query']);_0x208183['filters']=_[_0x49b3('0x31')](_0x208183[_0x49b3('0x2c')],_0x208183['query']);_0x5841d6['attributes']=_[_0x49b3('0x31')](_0x208183[_0x49b3('0x2c')],qs[_0x49b3('0x32')](_0x27e4ae[_0x49b3('0x2e')][_0x49b3('0x32')]));_0x5841d6[_0x49b3('0x30')]=_0x5841d6[_0x49b3('0x30')]['length']?_0x5841d6['attributes']:_0x208183[_0x49b3('0x2c')];_0x5841d6['order']=qs['sort'](_0x27e4ae[_0x49b3('0x2e')][_0x49b3('0x36')]);_0x5841d6[_0x49b3('0x37')]=qs[_0x49b3('0x2f')](_[_0x49b3('0x38')](_0x27e4ae[_0x49b3('0x2e')],_0x208183[_0x49b3('0x2f')]));if(_0x27e4ae[_0x49b3('0x2e')][_0x49b3('0x39')]){_0x5841d6[_0x49b3('0x37')]=_[_0x49b3('0x3b')](_0x5841d6[_0x49b3('0x37')],{'$or':_[_0x49b3('0x2d')](_0x5841d6['attributes'],function(_0xd8e176){var _0x5c127a={};_0x5c127a[_0xd8e176]={'$like':'%'+_0x27e4ae['query'][_0x49b3('0x39')]+'%'};return _0x5c127a;})});}_0x5841d6=_[_0x49b3('0x3b')]({},_0x5841d6,_0x27e4ae['options']);return _0x5a1eb1['getFields'](_0x5841d6);}})[_0x49b3('0x22')](function(_0x56f05b){if(_0x56f05b){_0xc01bcc=_0x56f05b[_0x49b3('0x33')];if(!_0x27e4ae[_0x49b3('0x2e')][_0x49b3('0x4d')](_0x49b3('0x34'))){_0x5841d6['limit']=qs['limit'](_0x27e4ae['query'][_0x49b3('0x1c')]);_0x5841d6[_0x49b3('0x1a')]=qs['offset'](_0x27e4ae[_0x49b3('0x2e')]['offset']);}return _0x5a1eb1['getFields'](_0x5841d6);}})[_0x49b3('0x22')](function(_0x57aaf0){if(_0x57aaf0){return _0x57aaf0?{'count':_0xc01bcc,'rows':_0x57aaf0}:null;}})[_0x49b3('0x22')](respondWithResult(_0x30c030,null))[_0x49b3('0x42')](handleError(_0x30c030,null));};exports[_0x49b3('0x4e')]=function(_0x2b4709,_0x296260,_0x46c63b){var _0x22fe1d={};var _0x39a14a={};var _0x18c4e8;var _0x97ae53;return db['ZohoConfiguration'][_0x49b3('0x4b')]({'where':{'id':_0x2b4709[_0x49b3('0x44')]['id']}})['then'](handleEntityNotFound(_0x296260,null))[_0x49b3('0x22')](function(_0x31150e){if(_0x31150e){_0x18c4e8=_0x31150e;_0x39a14a['model']=_['keys'](db[_0x49b3('0x4c')][_0x49b3('0x28')]);_0x39a14a[_0x49b3('0x2e')]=_['keys'](_0x2b4709['query']);_0x39a14a[_0x49b3('0x2f')]=_[_0x49b3('0x31')](_0x39a14a[_0x49b3('0x2c')],_0x39a14a[_0x49b3('0x2e')]);_0x22fe1d[_0x49b3('0x30')]=_['intersection'](_0x39a14a['model'],qs['fields'](_0x2b4709['query'][_0x49b3('0x32')]));_0x22fe1d[_0x49b3('0x30')]=_0x22fe1d[_0x49b3('0x30')][_0x49b3('0x33')]?_0x22fe1d[_0x49b3('0x30')]:_0x39a14a[_0x49b3('0x2c')];_0x22fe1d['order']=qs[_0x49b3('0x36')](_0x2b4709[_0x49b3('0x2e')][_0x49b3('0x36')]);_0x22fe1d[_0x49b3('0x37')]=qs['filters'](_['pick'](_0x2b4709[_0x49b3('0x2e')],_0x39a14a[_0x49b3('0x2f')]));if(_0x2b4709[_0x49b3('0x2e')]['filter']){_0x22fe1d[_0x49b3('0x37')]=_[_0x49b3('0x3b')](_0x22fe1d[_0x49b3('0x37')],{'$or':_['map'](_0x22fe1d[_0x49b3('0x30')],function(_0x1bdbcc){var _0xc812be={};_0xc812be[_0x1bdbcc]={'$like':'%'+_0x2b4709['query'][_0x49b3('0x39')]+'%'};return _0xc812be;})});}_0x22fe1d=_[_0x49b3('0x3b')]({},_0x22fe1d,_0x2b4709[_0x49b3('0x3c')]);return _0x18c4e8[_0x49b3('0x4e')](_0x22fe1d);}})[_0x49b3('0x22')](function(_0x5ba1bd){if(_0x5ba1bd){_0x97ae53=_0x5ba1bd[_0x49b3('0x33')];if(!_0x2b4709[_0x49b3('0x2e')][_0x49b3('0x4d')]('nolimit')){_0x22fe1d[_0x49b3('0x1c')]=qs[_0x49b3('0x1c')](_0x2b4709['query'][_0x49b3('0x1c')]);_0x22fe1d[_0x49b3('0x1a')]=qs[_0x49b3('0x1a')](_0x2b4709[_0x49b3('0x2e')][_0x49b3('0x1a')]);}return _0x18c4e8[_0x49b3('0x4e')](_0x22fe1d);}})['then'](function(_0x5982b6){if(_0x5982b6){return _0x5982b6?{'count':_0x97ae53,'rows':_0x5982b6}:null;}})[_0x49b3('0x22')](respondWithResult(_0x296260,null))[_0x49b3('0x42')](handleError(_0x296260,null));};exports[_0x49b3('0x4f')]=function(_0x207ddc,_0x2d4137,_0xa2b2b4){var _0x13ec70={};var _0x106c23={};var _0x519756;var _0x1329fb;return db[_0x49b3('0x3d')][_0x49b3('0x4b')]({'where':{'id':_0x207ddc[_0x49b3('0x44')]['id']}})[_0x49b3('0x22')](handleEntityNotFound(_0x2d4137,null))[_0x49b3('0x22')](function(_0x3f4987){if(_0x3f4987){_0x519756=_0x3f4987;_0x106c23['model']=_['keys'](db[_0x49b3('0x4c')][_0x49b3('0x28')]);_0x106c23[_0x49b3('0x2e')]=_[_0x49b3('0x45')](_0x207ddc['query']);_0x106c23[_0x49b3('0x2f')]=_[_0x49b3('0x31')](_0x106c23[_0x49b3('0x2c')],_0x106c23['query']);_0x13ec70['attributes']=_[_0x49b3('0x31')](_0x106c23[_0x49b3('0x2c')],qs[_0x49b3('0x32')](_0x207ddc['query'][_0x49b3('0x32')]));_0x13ec70[_0x49b3('0x30')]=_0x13ec70[_0x49b3('0x30')][_0x49b3('0x33')]?_0x13ec70[_0x49b3('0x30')]:_0x106c23['model'];_0x13ec70[_0x49b3('0x35')]=qs[_0x49b3('0x36')](_0x207ddc[_0x49b3('0x2e')][_0x49b3('0x36')]);_0x13ec70['where']=qs[_0x49b3('0x2f')](_[_0x49b3('0x38')](_0x207ddc[_0x49b3('0x2e')],_0x106c23[_0x49b3('0x2f')]));if(_0x207ddc[_0x49b3('0x2e')][_0x49b3('0x39')]){_0x13ec70[_0x49b3('0x37')]=_[_0x49b3('0x3b')](_0x13ec70[_0x49b3('0x37')],{'$or':_[_0x49b3('0x2d')](_0x13ec70[_0x49b3('0x30')],function(_0x2f7fd){var _0x30530b={};_0x30530b[_0x2f7fd]={'$like':'%'+_0x207ddc[_0x49b3('0x2e')][_0x49b3('0x39')]+'%'};return _0x30530b;})});}_0x13ec70=_[_0x49b3('0x3b')]({},_0x13ec70,_0x207ddc[_0x49b3('0x3c')]);return _0x519756[_0x49b3('0x4f')](_0x13ec70);}})[_0x49b3('0x22')](function(_0x50b001){if(_0x50b001){_0x1329fb=_0x50b001['length'];if(!_0x207ddc[_0x49b3('0x2e')][_0x49b3('0x4d')]('nolimit')){_0x13ec70[_0x49b3('0x1c')]=qs[_0x49b3('0x1c')](_0x207ddc['query'][_0x49b3('0x1c')]);_0x13ec70[_0x49b3('0x1a')]=qs[_0x49b3('0x1a')](_0x207ddc['query'][_0x49b3('0x1a')]);}return _0x519756['getDescriptions'](_0x13ec70);}})[_0x49b3('0x22')](function(_0x2294d0){if(_0x2294d0){return _0x2294d0?{'count':_0x1329fb,'rows':_0x2294d0}:null;}})['then'](respondWithResult(_0x2d4137,null))[_0x49b3('0x42')](handleError(_0x2d4137,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4f70e06..9bb8784 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 _0x1d2b=['path','rimraf','../../config/environment','exports','define','ZohoConfiguration','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4af864,_0x1be11e){var _0x4a4d41=function(_0x594b98){while(--_0x594b98){_0x4af864['push'](_0x4af864['shift']());}};_0x4a4d41(++_0x1be11e);}(_0x1d2b,0x95));var _0xb1d2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1d2b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb1d2('0x0'));var util=require(_0xb1d2('0x1'));var logger=require(_0xb1d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb1d2('0x3'));var rp=require(_0xb1d2('0x4'));var fs=require('fs');var path=require(_0xb1d2('0x5'));var rimraf=require(_0xb1d2('0x6'));var config=require(_0xb1d2('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0xb1d2('0x8')]=function(_0xd357d2,_0x11ef8f){return _0xd357d2[_0xb1d2('0x9')](_0xb1d2('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf586=['define','ZohoConfiguration','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x41de18,_0x258d31){var _0x1261fb=function(_0x577d1a){while(--_0x577d1a){_0x41de18['push'](_0x41de18['shift']());}};_0x1261fb(++_0x258d31);}(_0xf586,0x84));var _0x6f58=function(_0x5ecff9,_0x473070){_0x5ecff9=_0x5ecff9-0x0;var _0x5e1415=_0xf586[_0x5ecff9];return _0x5e1415;};'use strict';var _=require('lodash');var util=require(_0x6f58('0x0'));var logger=require(_0x6f58('0x1'))('api');var moment=require(_0x6f58('0x2'));var BPromise=require(_0x6f58('0x3'));var rp=require(_0x6f58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f58('0x5'));var config=require('../../config/environment');var attributes=require(_0x6f58('0x6'));module[_0x6f58('0x7')]=function(_0x4cbfa3,_0x411cc8){return _0x4cbfa3[_0x6f58('0x8')](_0x6f58('0x9'),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 b93a6a4..54980e2 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 _0x8256=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info'];(function(_0x264f38,_0x4cdcbf){var _0x337c1c=function(_0xd5073f){while(--_0xd5073f){_0x264f38['push'](_0x264f38['shift']());}};_0x337c1c(++_0x4cdcbf);}(_0x8256,0x1a8));var _0x6825=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8256[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x6825('0x0'));var moment=require(_0x6825('0x1'));var BPromise=require(_0x6825('0x2'));var rs=require(_0x6825('0x3'));var fs=require('fs');var Redis=require(_0x6825('0x4'));var db=require(_0x6825('0x5'))['db'];var utils=require(_0x6825('0x6'));var logger=require(_0x6825('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6825('0x8'));var client=jayson[_0x6825('0x9')][_0x6825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a630a,_0x122ec9,_0x148cab){return new BPromise(function(_0x11c6d3,_0x33b208){return client['request'](_0x4a630a,_0x148cab)[_0x6825('0xb')](function(_0xf59581){logger[_0x6825('0xc')](_0x6825('0xd'),_0x122ec9,_0x6825('0xe'));logger[_0x6825('0xf')](_0x6825('0x10'),_0x122ec9,'request\x20sent',JSON[_0x6825('0x11')](_0xf59581));if(_0xf59581[_0x6825('0x12')]){if(_0xf59581['error'][_0x6825('0x13')]===0x1f4){logger[_0x6825('0x12')](_0x6825('0xd'),_0x122ec9,_0xf59581[_0x6825('0x12')]['message']);return _0x33b208(_0xf59581[_0x6825('0x12')][_0x6825('0x14')]);}logger[_0x6825('0x12')](_0x6825('0xd'),_0x122ec9,_0xf59581[_0x6825('0x12')][_0x6825('0x14')]);return _0x11c6d3(_0xf59581[_0x6825('0x12')]['message']);}else{logger[_0x6825('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x122ec9,_0x6825('0xe'));_0x11c6d3(_0xf59581[_0x6825('0x15')][_0x6825('0x14')]);}})[_0x6825('0x16')](function(_0x35f4ac){logger[_0x6825('0x12')](_0x6825('0xd'),_0x122ec9,_0x35f4ac);_0x33b208(_0x35f4ac);});});} \ No newline at end of file +var _0xd4a5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x207c33,_0x7c5aee){var _0x56d88f=function(_0x49f196){while(--_0x49f196){_0x207c33['push'](_0x207c33['shift']());}};_0x56d88f(++_0x7c5aee);}(_0xd4a5,0xa8));var _0x5d4a=function(_0x1cdd80,_0x5700f5){_0x1cdd80=_0x1cdd80-0x0;var _0x141bf4=_0xd4a5[_0x1cdd80];return _0x141bf4;};'use strict';var _=require(_0x5d4a('0x0'));var util=require(_0x5d4a('0x1'));var moment=require(_0x5d4a('0x2'));var BPromise=require(_0x5d4a('0x3'));var rs=require(_0x5d4a('0x4'));var fs=require('fs');var Redis=require(_0x5d4a('0x5'));var db=require(_0x5d4a('0x6'))['db'];var utils=require(_0x5d4a('0x7'));var logger=require(_0x5d4a('0x8'))('rpc');var config=require(_0x5d4a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5d4a('0xa')][_0x5d4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522811,_0x2eea04,_0x1f7120){return new BPromise(function(_0x1b272f,_0x1baf6e){return client[_0x5d4a('0xc')](_0x522811,_0x1f7120)[_0x5d4a('0xd')](function(_0x576774){logger[_0x5d4a('0xe')](_0x5d4a('0xf'),_0x2eea04,_0x5d4a('0x10'));logger[_0x5d4a('0x11')](_0x5d4a('0x12'),_0x2eea04,'request\x20sent',JSON[_0x5d4a('0x13')](_0x576774));if(_0x576774[_0x5d4a('0x14')]){if(_0x576774[_0x5d4a('0x14')]['code']===0x1f4){logger[_0x5d4a('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x2eea04,_0x576774[_0x5d4a('0x14')][_0x5d4a('0x15')]);return _0x1baf6e(_0x576774['error'][_0x5d4a('0x15')]);}logger[_0x5d4a('0x14')](_0x5d4a('0xf'),_0x2eea04,_0x576774[_0x5d4a('0x14')][_0x5d4a('0x15')]);return _0x1b272f(_0x576774[_0x5d4a('0x14')]['message']);}else{logger[_0x5d4a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x2eea04,'request\x20sent');_0x1b272f(_0x576774[_0x5d4a('0x16')][_0x5d4a('0x15')]);}})[_0x5d4a('0x17')](function(_0x204208){logger[_0x5d4a('0x14')](_0x5d4a('0xf'),_0x2eea04,_0x204208);_0x1baf6e(_0x204208);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5ae3d2d..ff63394 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 _0x3ce9=['Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer','path','connect-timeout','express'];(function(_0x404450,_0x3de029){var _0x35309a=function(_0x380ee4){while(--_0x380ee4){_0x404450['push'](_0x404450['shift']());}};_0x35309a(++_0x3de029);}(_0x3ce9,0xf8));var _0x93ce=function(_0xfffa3c,_0x421a7f){_0xfffa3c=_0xfffa3c-0x0;var _0x332ce4=_0x3ce9[_0xfffa3c];return _0x332ce4;};'use strict';var multer=require(_0x93ce('0x0'));var util=require('util');var path=require(_0x93ce('0x1'));var timeout=require(_0x93ce('0x2'));var express=require(_0x93ce('0x3'));var router=express[_0x93ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93ce('0x5'));var interaction=require(_0x93ce('0x6'));var config=require('../../config/environment');var controller=require(_0x93ce('0x7'));router['get']('/',auth[_0x93ce('0x8')](),controller[_0x93ce('0x9')]);router[_0x93ce('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x93ce('0xb')]);router[_0x93ce('0xc')]('/',auth[_0x93ce('0x8')](),controller[_0x93ce('0xd')]);router[_0x93ce('0xe')](_0x93ce('0xf'),auth[_0x93ce('0x8')](),controller['update']);router[_0x93ce('0x10')](_0x93ce('0xf'),auth[_0x93ce('0x8')](),controller['destroy']);module[_0x93ce('0x11')]=router; \ No newline at end of file +var _0xcecd=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoField.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcecd,0x1e5));var _0xdcec=function(_0x8ef12d,_0x4a5092){_0x8ef12d=_0x8ef12d-0x0;var _0x57d798=_0xcecd[_0x8ef12d];return _0x57d798;};'use strict';var multer=require(_0xdcec('0x0'));var util=require('util');var path=require(_0xdcec('0x1'));var timeout=require(_0xdcec('0x2'));var express=require(_0xdcec('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdcec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdcec('0x5'));var controller=require(_0xdcec('0x6'));router[_0xdcec('0x7')]('/',auth[_0xdcec('0x8')](),controller[_0xdcec('0x9')]);router[_0xdcec('0x7')](_0xdcec('0xa'),auth[_0xdcec('0x8')](),controller[_0xdcec('0xb')]);router['post']('/',auth[_0xdcec('0x8')](),controller[_0xdcec('0xc')]);router[_0xdcec('0xd')]('/:id',auth[_0xdcec('0x8')](),controller[_0xdcec('0xe')]);router[_0xdcec('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdcec('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7a9cc90..0c38a37 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 _0x1f47=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x5a7b01,_0x552690){var _0x374453=function(_0x2ad3d0){while(--_0x2ad3d0){_0x5a7b01['push'](_0x5a7b01['shift']());}};_0x374453(++_0x552690);}(_0x1f47,0x1e3));var _0x71f4=function(_0x252592,_0x1afe19){_0x252592=_0x252592-0x0;var _0x490c10=_0x1f47[_0x252592];return _0x490c10;};'use strict';var Sequelize=require(_0x71f4('0x0'));module[_0x71f4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x71f4('0x2'),_0x71f4('0x3'),_0x71f4('0x4'),_0x71f4('0x5'),_0x71f4('0x6')),'defaultValue':_0x71f4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x71f4('0x7')]},'keyType':{'type':Sequelize[_0x71f4('0x8')](_0x71f4('0x2'),_0x71f4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x71f4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x71f4('0x7')]},'customField':{'type':Sequelize[_0x71f4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x71f4('0x7')]}}; \ No newline at end of file +var _0x589f=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x589f,0x160));var _0xf589=function(_0x33d615,_0x1a5af7){_0x33d615=_0x33d615-0x0;var _0x254611=_0x589f[_0x33d615];return _0x254611;};'use strict';var Sequelize=require(_0xf589('0x0'));module[_0xf589('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf589('0x2'),_0xf589('0x3'),_0xf589('0x4'),_0xf589('0x5'),_0xf589('0x6')),'defaultValue':_0xf589('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf589('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf589('0x3'),_0xf589('0x4'))},'keyContent':{'type':Sequelize[_0xf589('0x7')]},'idField':{'type':Sequelize[_0xf589('0x7')]},'nameField':{'type':Sequelize[_0xf589('0x7')]},'customField':{'type':Sequelize[_0xf589('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7d609b5..62947ec 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 _0x29ef=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x29ef,0xaf));var _0xf29e=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x29ef[_0x1ed116];return _0x574066;};'use strict';var emlformat=require(_0xf29e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf29e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf29e('0x2'));var util=require(_0xf29e('0x3'));var path=require('path');var sox=require(_0xf29e('0x4'));var csv=require(_0xf29e('0x5'));var ejs=require(_0xf29e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf29e('0x7'));var squel=require(_0xf29e('0x8'));var crypto=require(_0xf29e('0x9'));var jsforce=require(_0xf29e('0xa'));var deskjs=require(_0xf29e('0xb'));var toCsv=require(_0xf29e('0x5'));var querystring=require(_0xf29e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf29e('0xd'));var qs=require(_0xf29e('0xe'));var as=require(_0xf29e('0xf'));var hardwareService=require(_0xf29e('0x10'));var logger=require(_0xf29e('0x11'))(_0xf29e('0x12'));var utils=require(_0xf29e('0x13'));var config=require(_0xf29e('0x14'));var licenseUtil=require(_0xf29e('0x15'));var db=require(_0xf29e('0x16'))['db'];function respondWithStatusCode(_0x2cfebe,_0x383b52){_0x383b52=_0x383b52||0xcc;return function(_0x57a43a){if(_0x57a43a){return _0x2cfebe['sendStatus'](_0x383b52);}return _0x2cfebe[_0xf29e('0x17')](_0x383b52)['end']();};}function respondWithResult(_0x3a4c63,_0x2f0c8f){_0x2f0c8f=_0x2f0c8f||0xc8;return function(_0x3017cd){if(_0x3017cd){return _0x3a4c63[_0xf29e('0x17')](_0x2f0c8f)[_0xf29e('0x18')](_0x3017cd);}};}function respondWithFilteredResult(_0x488d2d,_0xda6654){return function(_0x5740bc){if(_0x5740bc){var _0x3efd41=typeof _0xda6654['offset']===_0xf29e('0x19')&&typeof _0xda6654[_0xf29e('0x1a')]==='undefined';var _0x2e6eb1=_0x5740bc[_0xf29e('0x1b')];var _0x9b146f=_0x3efd41?0x0:_0xda6654[_0xf29e('0x1c')];var _0x5db498=_0x3efd41?_0x5740bc[_0xf29e('0x1b')]:_0xda6654[_0xf29e('0x1c')]+_0xda6654[_0xf29e('0x1a')];var _0x9c3707;if(_0x5db498>=_0x2e6eb1){_0x5db498=_0x2e6eb1;_0x9c3707=0xc8;}else{_0x9c3707=0xce;}_0x488d2d[_0xf29e('0x17')](_0x9c3707);return _0x488d2d[_0xf29e('0x1d')](_0xf29e('0x1e'),_0x9b146f+'-'+_0x5db498+'/'+_0x2e6eb1)[_0xf29e('0x18')](_0x5740bc);}return null;};}function patchUpdates(_0x461571){return function(_0x1c89b1){try{jsonpatch[_0xf29e('0x1f')](_0x1c89b1,_0x461571,!![]);}catch(_0x392bda){return BPromise[_0xf29e('0x20')](_0x392bda);}return _0x1c89b1['save']();};}function saveUpdates(_0xf6d22f,_0xb69291){return function(_0x3acd9c){if(_0x3acd9c){return _0x3acd9c[_0xf29e('0x21')](_0xf6d22f)[_0xf29e('0x22')](function(_0x282385){return _0x282385;});}return null;};}function removeEntity(_0x226366,_0x3934a7){return function(_0xc9581){if(_0xc9581){return _0xc9581[_0xf29e('0x23')]()[_0xf29e('0x22')](function(){_0x226366[_0xf29e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523f83,_0x320b5c){return function(_0xeceb4b){if(!_0xeceb4b){_0x523f83[_0xf29e('0x24')](0x194);}return _0xeceb4b;};}function handleError(_0x31c377,_0x4a8e45){_0x4a8e45=_0x4a8e45||0x1f4;return function(_0x420787){logger['error'](_0x420787[_0xf29e('0x25')]);if(_0x420787[_0xf29e('0x26')]){delete _0x420787[_0xf29e('0x26')];}_0x31c377['status'](_0x4a8e45)[_0xf29e('0x27')](_0x420787);};}exports[_0xf29e('0x28')]=function(_0x1cc55e,_0x1bb1de){var _0x20723a={},_0x38f56d={},_0xbede83={'count':0x0,'rows':[]};var _0x549c2e=_[_0xf29e('0x29')](db['ZohoField'][_0xf29e('0x2a')],function(_0x3c8290){return{'name':_0x3c8290[_0xf29e('0x2b')],'type':_0x3c8290[_0xf29e('0x2c')]['key']};});_0x38f56d[_0xf29e('0x2d')]=_['map'](_0x549c2e,_0xf29e('0x26'));_0x38f56d[_0xf29e('0x2e')]=_[_0xf29e('0x2f')](_0x1cc55e[_0xf29e('0x2e')]);_0x38f56d[_0xf29e('0x30')]=_[_0xf29e('0x31')](_0x38f56d['model'],_0x38f56d[_0xf29e('0x2e')]);_0x20723a[_0xf29e('0x32')]=_[_0xf29e('0x31')](_0x38f56d[_0xf29e('0x2d')],qs[_0xf29e('0x33')](_0x1cc55e['query'][_0xf29e('0x33')]));_0x20723a[_0xf29e('0x32')]=_0x20723a[_0xf29e('0x32')][_0xf29e('0x34')]?_0x20723a[_0xf29e('0x32')]:_0x38f56d[_0xf29e('0x2d')];if(!_0x1cc55e[_0xf29e('0x2e')][_0xf29e('0x35')](_0xf29e('0x36'))){_0x20723a[_0xf29e('0x1a')]=qs[_0xf29e('0x1a')](_0x1cc55e[_0xf29e('0x2e')]['limit']);_0x20723a[_0xf29e('0x1c')]=qs[_0xf29e('0x1c')](_0x1cc55e['query'][_0xf29e('0x1c')]);}_0x20723a[_0xf29e('0x37')]=qs[_0xf29e('0x38')](_0x1cc55e[_0xf29e('0x2e')][_0xf29e('0x38')]);_0x20723a[_0xf29e('0x39')]=qs[_0xf29e('0x30')](_[_0xf29e('0x3a')](_0x1cc55e[_0xf29e('0x2e')],_0x38f56d[_0xf29e('0x30')]),_0x549c2e);if(_0x1cc55e[_0xf29e('0x2e')][_0xf29e('0x3b')]){_0x20723a[_0xf29e('0x39')]=_[_0xf29e('0x3c')](_0x20723a[_0xf29e('0x39')],{'$or':_[_0xf29e('0x29')](_0x549c2e,function(_0x59d0f6){if(_0x59d0f6['type']!==_0xf29e('0x3d')){var _0x825c88={};_0x825c88[_0x59d0f6[_0xf29e('0x26')]]={'$like':'%'+_0x1cc55e['query'][_0xf29e('0x3b')]+'%'};return _0x825c88;}})});}_0x20723a=_[_0xf29e('0x3c')]({},_0x20723a,_0x1cc55e[_0xf29e('0x3e')]);var _0x588a1c={'where':_0x20723a[_0xf29e('0x39')]};return db[_0xf29e('0x3f')][_0xf29e('0x1b')](_0x588a1c)['then'](function(_0x1ba3d3){_0xbede83[_0xf29e('0x1b')]=_0x1ba3d3;if(_0x1cc55e[_0xf29e('0x2e')][_0xf29e('0x40')]){_0x20723a[_0xf29e('0x41')]=[{'all':!![]}];}return db[_0xf29e('0x3f')][_0xf29e('0x42')](_0x20723a);})[_0xf29e('0x22')](function(_0x370aec){_0xbede83[_0xf29e('0x43')]=_0x370aec;return _0xbede83;})['then'](respondWithFilteredResult(_0x1bb1de,_0x20723a))[_0xf29e('0x44')](handleError(_0x1bb1de,null));};exports[_0xf29e('0x45')]=function(_0x221832,_0x717e11){var _0x2a7ae3={'raw':!![],'where':{'id':_0x221832[_0xf29e('0x46')]['id']}},_0x546246={};_0x546246['model']=_[_0xf29e('0x2f')](db[_0xf29e('0x3f')][_0xf29e('0x2a')]);_0x546246[_0xf29e('0x2e')]=_[_0xf29e('0x2f')](_0x221832['query']);_0x546246[_0xf29e('0x30')]=_['intersection'](_0x546246['model'],_0x546246['query']);_0x2a7ae3['attributes']=_['intersection'](_0x546246[_0xf29e('0x2d')],qs['fields'](_0x221832[_0xf29e('0x2e')][_0xf29e('0x33')]));_0x2a7ae3[_0xf29e('0x32')]=_0x2a7ae3[_0xf29e('0x32')][_0xf29e('0x34')]?_0x2a7ae3[_0xf29e('0x32')]:_0x546246[_0xf29e('0x2d')];if(_0x221832[_0xf29e('0x2e')][_0xf29e('0x40')]){_0x2a7ae3[_0xf29e('0x41')]=[{'all':!![]}];}_0x2a7ae3=_[_0xf29e('0x3c')]({},_0x2a7ae3,_0x221832[_0xf29e('0x3e')]);return db[_0xf29e('0x3f')][_0xf29e('0x47')](_0x2a7ae3)[_0xf29e('0x22')](handleEntityNotFound(_0x717e11,null))[_0xf29e('0x22')](respondWithResult(_0x717e11,null))['catch'](handleError(_0x717e11,null));};exports[_0xf29e('0x48')]=function(_0x5cbb64,_0x7ef023){return db[_0xf29e('0x3f')][_0xf29e('0x48')](_0x5cbb64[_0xf29e('0x49')],{})[_0xf29e('0x22')](respondWithResult(_0x7ef023,0xc9))['catch'](handleError(_0x7ef023,null));};exports['update']=function(_0x1fb472,_0x585947){if(_0x1fb472[_0xf29e('0x49')]['id']){delete _0x1fb472[_0xf29e('0x49')]['id'];}return db[_0xf29e('0x3f')]['find']({'where':{'id':_0x1fb472[_0xf29e('0x46')]['id']}})[_0xf29e('0x22')](handleEntityNotFound(_0x585947,null))[_0xf29e('0x22')](saveUpdates(_0x1fb472[_0xf29e('0x49')],null))[_0xf29e('0x22')](respondWithResult(_0x585947,null))[_0xf29e('0x44')](handleError(_0x585947,null));};exports[_0xf29e('0x23')]=function(_0x1625bf,_0x13d9f6){return db[_0xf29e('0x3f')][_0xf29e('0x47')]({'where':{'id':_0x1625bf[_0xf29e('0x46')]['id']}})[_0xf29e('0x22')](handleEntityNotFound(_0x13d9f6,null))[_0xf29e('0x22')](removeEntity(_0x13d9f6,null))[_0xf29e('0x44')](handleError(_0x13d9f6,null));}; \ No newline at end of file +var _0x639a=['sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','stack','name','send','ZohoField','type','key','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','catch','params','rawAttributes','includeAll','options','create','body','find','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x639a,0x73));var _0xa639=function(_0x19c34f,_0xf13778){_0x19c34f=_0x19c34f-0x0;var _0x32b01d=_0x639a[_0x19c34f];return _0x32b01d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa639('0x0'));var zipdir=require(_0xa639('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa639('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa639('0x3'));var util=require(_0xa639('0x4'));var path=require(_0xa639('0x5'));var sox=require(_0xa639('0x6'));var csv=require(_0xa639('0x7'));var ejs=require(_0xa639('0x8'));var fs=require('fs');var fs_extra=require(_0xa639('0x9'));var _=require(_0xa639('0xa'));var squel=require(_0xa639('0xb'));var crypto=require(_0xa639('0xc'));var jsforce=require(_0xa639('0xd'));var deskjs=require(_0xa639('0xe'));var toCsv=require(_0xa639('0x7'));var querystring=require(_0xa639('0xf'));var Papa=require('papaparse');var Redis=require(_0xa639('0x10'));var authService=require(_0xa639('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa639('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa639('0x13'))(_0xa639('0x14'));var utils=require(_0xa639('0x15'));var config=require(_0xa639('0x16'));var licenseUtil=require(_0xa639('0x17'));var db=require(_0xa639('0x18'))['db'];function respondWithStatusCode(_0x26bdfd,_0x5028c6){_0x5028c6=_0x5028c6||0xcc;return function(_0x5118c5){if(_0x5118c5){return _0x26bdfd[_0xa639('0x19')](_0x5028c6);}return _0x26bdfd[_0xa639('0x1a')](_0x5028c6)[_0xa639('0x1b')]();};}function respondWithResult(_0x57299e,_0xe7beb8){_0xe7beb8=_0xe7beb8||0xc8;return function(_0x51f622){if(_0x51f622){return _0x57299e[_0xa639('0x1a')](_0xe7beb8)[_0xa639('0x1c')](_0x51f622);}};}function respondWithFilteredResult(_0x227020,_0x3d6804){return function(_0x1c9c35){if(_0x1c9c35){var _0x2031e5=typeof _0x3d6804[_0xa639('0x1d')]==='undefined'&&typeof _0x3d6804[_0xa639('0x1e')]===_0xa639('0x1f');var _0x233a83=_0x1c9c35[_0xa639('0x20')];var _0x5d2b1e=_0x2031e5?0x0:_0x3d6804[_0xa639('0x1d')];var _0x264b4e=_0x2031e5?_0x1c9c35[_0xa639('0x20')]:_0x3d6804['offset']+_0x3d6804['limit'];var _0x32adfe;if(_0x264b4e>=_0x233a83){_0x264b4e=_0x233a83;_0x32adfe=0xc8;}else{_0x32adfe=0xce;}_0x227020['status'](_0x32adfe);return _0x227020[_0xa639('0x21')]('Content-Range',_0x5d2b1e+'-'+_0x264b4e+'/'+_0x233a83)['json'](_0x1c9c35);}return null;};}function patchUpdates(_0x9580b3){return function(_0x1f0bfc){try{jsonpatch['apply'](_0x1f0bfc,_0x9580b3,!![]);}catch(_0x5e7fe6){return BPromise[_0xa639('0x22')](_0x5e7fe6);}return _0x1f0bfc[_0xa639('0x23')]();};}function saveUpdates(_0x2c7adf,_0x5acd68){return function(_0x314318){if(_0x314318){return _0x314318['update'](_0x2c7adf)[_0xa639('0x24')](function(_0x4bd84c){return _0x4bd84c;});}return null;};}function removeEntity(_0x48dd63,_0x4b7462){return function(_0x8bde91){if(_0x8bde91){return _0x8bde91[_0xa639('0x25')]()[_0xa639('0x24')](function(){_0x48dd63[_0xa639('0x1a')](0xcc)[_0xa639('0x1b')]();});}};}function handleEntityNotFound(_0x293b9a,_0x211fdb){return function(_0x571536){if(!_0x571536){_0x293b9a[_0xa639('0x19')](0x194);}return _0x571536;};}function handleError(_0x41171f,_0x5bb284){_0x5bb284=_0x5bb284||0x1f4;return function(_0x13500e){logger['error'](_0x13500e[_0xa639('0x26')]);if(_0x13500e[_0xa639('0x27')]){delete _0x13500e[_0xa639('0x27')];}_0x41171f[_0xa639('0x1a')](_0x5bb284)[_0xa639('0x28')](_0x13500e);};}exports['index']=function(_0x3ec4f2,_0x276390){var _0x29e515={},_0x41e6c1={},_0x5c473e={'count':0x0,'rows':[]};var _0x41dc70=_['map'](db[_0xa639('0x29')]['rawAttributes'],function(_0x437a0e){return{'name':_0x437a0e['fieldName'],'type':_0x437a0e[_0xa639('0x2a')][_0xa639('0x2b')]};});_0x41e6c1['model']=_[_0xa639('0x2c')](_0x41dc70,_0xa639('0x27'));_0x41e6c1['query']=_[_0xa639('0x2d')](_0x3ec4f2[_0xa639('0x2e')]);_0x41e6c1[_0xa639('0x2f')]=_[_0xa639('0x30')](_0x41e6c1[_0xa639('0x31')],_0x41e6c1[_0xa639('0x2e')]);_0x29e515[_0xa639('0x32')]=_[_0xa639('0x30')](_0x41e6c1[_0xa639('0x31')],qs[_0xa639('0x33')](_0x3ec4f2[_0xa639('0x2e')][_0xa639('0x33')]));_0x29e515[_0xa639('0x32')]=_0x29e515[_0xa639('0x32')]['length']?_0x29e515[_0xa639('0x32')]:_0x41e6c1['model'];if(!_0x3ec4f2[_0xa639('0x2e')][_0xa639('0x34')](_0xa639('0x35'))){_0x29e515[_0xa639('0x1e')]=qs[_0xa639('0x1e')](_0x3ec4f2[_0xa639('0x2e')]['limit']);_0x29e515[_0xa639('0x1d')]=qs[_0xa639('0x1d')](_0x3ec4f2[_0xa639('0x2e')]['offset']);}_0x29e515[_0xa639('0x36')]=qs[_0xa639('0x37')](_0x3ec4f2[_0xa639('0x2e')][_0xa639('0x37')]);_0x29e515[_0xa639('0x38')]=qs[_0xa639('0x2f')](_['pick'](_0x3ec4f2[_0xa639('0x2e')],_0x41e6c1[_0xa639('0x2f')]),_0x41dc70);if(_0x3ec4f2['query'][_0xa639('0x39')]){_0x29e515['where']=_[_0xa639('0x3a')](_0x29e515[_0xa639('0x38')],{'$or':_[_0xa639('0x2c')](_0x41dc70,function(_0x1b4248){if(_0x1b4248[_0xa639('0x2a')]!=='VIRTUAL'){var _0x375797={};_0x375797[_0x1b4248[_0xa639('0x27')]]={'$like':'%'+_0x3ec4f2[_0xa639('0x2e')][_0xa639('0x39')]+'%'};return _0x375797;}})});}_0x29e515=_[_0xa639('0x3a')]({},_0x29e515,_0x3ec4f2['options']);var _0x152c59={'where':_0x29e515[_0xa639('0x38')]};return db[_0xa639('0x29')][_0xa639('0x20')](_0x152c59)[_0xa639('0x24')](function(_0x4f4c21){_0x5c473e[_0xa639('0x20')]=_0x4f4c21;if(_0x3ec4f2[_0xa639('0x2e')]['includeAll']){_0x29e515[_0xa639('0x3b')]=[{'all':!![]}];}return db[_0xa639('0x29')][_0xa639('0x3c')](_0x29e515);})[_0xa639('0x24')](function(_0x400516){_0x5c473e[_0xa639('0x3d')]=_0x400516;return _0x5c473e;})['then'](respondWithFilteredResult(_0x276390,_0x29e515))[_0xa639('0x3e')](handleError(_0x276390,null));};exports['show']=function(_0x1c865f,_0x29a976){var _0x10d79e={'raw':!![],'where':{'id':_0x1c865f[_0xa639('0x3f')]['id']}},_0x1afed9={};_0x1afed9[_0xa639('0x31')]=_[_0xa639('0x2d')](db['ZohoField'][_0xa639('0x40')]);_0x1afed9[_0xa639('0x2e')]=_[_0xa639('0x2d')](_0x1c865f['query']);_0x1afed9[_0xa639('0x2f')]=_[_0xa639('0x30')](_0x1afed9[_0xa639('0x31')],_0x1afed9[_0xa639('0x2e')]);_0x10d79e[_0xa639('0x32')]=_[_0xa639('0x30')](_0x1afed9[_0xa639('0x31')],qs['fields'](_0x1c865f[_0xa639('0x2e')][_0xa639('0x33')]));_0x10d79e[_0xa639('0x32')]=_0x10d79e['attributes']['length']?_0x10d79e[_0xa639('0x32')]:_0x1afed9['model'];if(_0x1c865f[_0xa639('0x2e')][_0xa639('0x41')]){_0x10d79e[_0xa639('0x3b')]=[{'all':!![]}];}_0x10d79e=_[_0xa639('0x3a')]({},_0x10d79e,_0x1c865f[_0xa639('0x42')]);return db[_0xa639('0x29')]['find'](_0x10d79e)['then'](handleEntityNotFound(_0x29a976,null))[_0xa639('0x24')](respondWithResult(_0x29a976,null))['catch'](handleError(_0x29a976,null));};exports[_0xa639('0x43')]=function(_0xf199aa,_0x42102c){return db['ZohoField']['create'](_0xf199aa['body'],{})[_0xa639('0x24')](respondWithResult(_0x42102c,0xc9))[_0xa639('0x3e')](handleError(_0x42102c,null));};exports['update']=function(_0x2bc8cb,_0x5696ec){if(_0x2bc8cb[_0xa639('0x44')]['id']){delete _0x2bc8cb[_0xa639('0x44')]['id'];}return db[_0xa639('0x29')]['find']({'where':{'id':_0x2bc8cb[_0xa639('0x3f')]['id']}})[_0xa639('0x24')](handleEntityNotFound(_0x5696ec,null))[_0xa639('0x24')](saveUpdates(_0x2bc8cb[_0xa639('0x44')],null))[_0xa639('0x24')](respondWithResult(_0x5696ec,null))[_0xa639('0x3e')](handleError(_0x5696ec,null));};exports[_0xa639('0x25')]=function(_0x39b163,_0x730638){return db[_0xa639('0x29')][_0xa639('0x45')]({'where':{'id':_0x39b163['params']['id']}})[_0xa639('0x24')](handleEntityNotFound(_0x730638,null))[_0xa639('0x24')](removeEntity(_0x730638,null))[_0xa639('0x3e')](handleError(_0x730638,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index dd27ad3..d04f2b7 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x4176bb,_0x1aa14e){var _0x34c62f=function(_0x277df3){while(--_0x277df3){_0x4176bb['push'](_0x4176bb['shift']());}};_0x34c62f(++_0x1aa14e);}(_0x82c4,0x1ca));var _0x482c=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0x82c4[_0x1fd675];return _0x521d1c;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','ZohoField','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x524e,0x15e));var _0xe524=function(_0xac8ff9,_0x3f6ea9){_0xac8ff9=_0xac8ff9-0x0;var _0x4e2c71=_0x524e[_0xac8ff9];return _0x4e2c71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xd'),_0xe524('0xe')],'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 ab8226e..f7ab11f 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 _0x3f5b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3611ef,_0x4fbb05){var _0x246a54=function(_0x2bbd56){while(--_0x2bbd56){_0x3611ef['push'](_0x3611ef['shift']());}};_0x246a54(++_0x4fbb05);}(_0x3f5b,0x1e4));var _0xb3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb3f5('0x0'));var util=require('util');var moment=require(_0xb3f5('0x1'));var BPromise=require(_0xb3f5('0x2'));var rs=require(_0xb3f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f5('0x4'))['db'];var utils=require(_0xb3f5('0x5'));var logger=require(_0xb3f5('0x6'))(_0xb3f5('0x7'));var config=require(_0xb3f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb3f5('0x9')][_0xb3f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcd89ff,_0x253b94,_0x3626ff){return new BPromise(function(_0x1d41f0,_0x36e66d){return client[_0xb3f5('0xb')](_0xcd89ff,_0x3626ff)[_0xb3f5('0xc')](function(_0x5a7529){logger[_0xb3f5('0xd')](_0xb3f5('0xe'),_0x253b94,'request\x20sent');logger[_0xb3f5('0xf')](_0xb3f5('0x10'),_0x253b94,_0xb3f5('0x11'),JSON[_0xb3f5('0x12')](_0x5a7529));if(_0x5a7529[_0xb3f5('0x13')]){if(_0x5a7529[_0xb3f5('0x13')]['code']===0x1f4){logger['error'](_0xb3f5('0xe'),_0x253b94,_0x5a7529[_0xb3f5('0x13')]['message']);return _0x36e66d(_0x5a7529[_0xb3f5('0x13')][_0xb3f5('0x14')]);}logger[_0xb3f5('0x13')]('ZohoField,\x20%s,\x20%s',_0x253b94,_0x5a7529['error'][_0xb3f5('0x14')]);return _0x1d41f0(_0x5a7529[_0xb3f5('0x13')][_0xb3f5('0x14')]);}else{logger[_0xb3f5('0xd')](_0xb3f5('0xe'),_0x253b94,_0xb3f5('0x11'));_0x1d41f0(_0x5a7529[_0xb3f5('0x15')][_0xb3f5('0x14')]);}})[_0xb3f5('0x16')](function(_0x99c1a4){logger[_0xb3f5('0x13')]('ZohoField,\x20%s,\x20%s',_0x253b94,_0x99c1a4);_0x36e66d(_0x99c1a4);});});} \ No newline at end of file +var _0x51e8=['then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x412319,_0x185f9c){var _0x52b655=function(_0x5b168f){while(--_0x5b168f){_0x412319['push'](_0x412319['shift']());}};_0x52b655(++_0x185f9c);}(_0x51e8,0x19a));var _0x851e=function(_0x4bb93f,_0x3771a1){_0x4bb93f=_0x4bb93f-0x0;var _0xdfef74=_0x51e8[_0x4bb93f];return _0xdfef74;};'use strict';var _=require(_0x851e('0x0'));var util=require(_0x851e('0x1'));var moment=require(_0x851e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x851e('0x3'));var db=require(_0x851e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x851e('0x5'))(_0x851e('0x6'));var config=require('../../config/environment');var jayson=require(_0x851e('0x7'));var client=jayson[_0x851e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7164,_0x126c70,_0x2984d3){return new BPromise(function(_0x18e3e0,_0x32de1e){return client[_0x851e('0x9')](_0x4e7164,_0x2984d3)[_0x851e('0xa')](function(_0xd627cf){logger[_0x851e('0xb')](_0x851e('0xc'),_0x126c70,'request\x20sent');logger[_0x851e('0xd')](_0x851e('0xe'),_0x126c70,'request\x20sent',JSON[_0x851e('0xf')](_0xd627cf));if(_0xd627cf['error']){if(_0xd627cf[_0x851e('0x10')]['code']===0x1f4){logger[_0x851e('0x10')]('ZohoField,\x20%s,\x20%s',_0x126c70,_0xd627cf[_0x851e('0x10')][_0x851e('0x11')]);return _0x32de1e(_0xd627cf[_0x851e('0x10')]['message']);}logger[_0x851e('0x10')](_0x851e('0xc'),_0x126c70,_0xd627cf[_0x851e('0x10')][_0x851e('0x11')]);return _0x18e3e0(_0xd627cf[_0x851e('0x10')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x126c70,_0x851e('0x12'));_0x18e3e0(_0xd627cf[_0x851e('0x13')][_0x851e('0x11')]);}})[_0x851e('0x14')](function(_0x2ad9e4){logger[_0x851e('0x10')](_0x851e('0xc'),_0x126c70,_0x2ad9e4);_0x32de1e(_0x2ad9e4);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9e42c8d..cf12868 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14c6cd,_0x25a233){var _0x1b3892=function(_0x365d13){while(--_0x365d13){_0x14c6cd['push'](_0x14c6cd['shift']());}};_0x1b3892(++_0x25a233);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x49a60d,_0x195b39){var _0x5f3396=function(_0x32083f){while(--_0x32083f){_0x49a60d['push'](_0x49a60d['shift']());}};_0x5f3396(++_0x195b39);}(_0x70e0,0x17b));var _0x070e=function(_0x321834,_0x11cf3a){_0x321834=_0x321834-0x0;var _0x58251c=_0x70e0[_0x321834];return _0x58251c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9060b1b..92eec4d 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 _0x3ebb=['sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x21057f,_0x4e3b82){var _0x1e2c77=function(_0x211e64){while(--_0x211e64){_0x21057f['push'](_0x21057f['shift']());}};_0x1e2c77(++_0x4e3b82);}(_0x3ebb,0xcd));var _0xb3eb=function(_0x178e36,_0x3d2069){_0x178e36=_0x178e36-0x0;var _0x5b03e3=_0x3ebb[_0x178e36];return _0x5b03e3;};'use strict';var Sequelize=require(_0xb3eb('0x0'));module[_0xb3eb('0x1')]={'name':{'type':Sequelize[_0xb3eb('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xb3eb('0x2')],'allowNull':![],'unique':_0xb3eb('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb3eb('0x4')},'filename':{'type':Sequelize[_0xb3eb('0x2')]},'path':{'type':Sequelize[_0xb3eb('0x2')]},'type':{'type':Sequelize[_0xb3eb('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb3eb('0x2')]},'logo':{'type':Sequelize[_0xb3eb('0x2')]},'state':{'type':Sequelize[_0xb3eb('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xb3eb('0x2')]},'title':{'type':Sequelize[_0xb3eb('0x2')]},'remoteUri':{'type':Sequelize[_0xb3eb('0x2')]},'link':{'type':Sequelize[_0xb3eb('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x312f=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x24f5e5,_0x5a9eb8){var _0x470e13=function(_0x39fa0d){while(--_0x39fa0d){_0x24f5e5['push'](_0x24f5e5['shift']());}};_0x470e13(++_0x5a9eb8);}(_0x312f,0x1ab));var _0xf312=function(_0x2aaaa0,_0x57aa0f){_0x2aaaa0=_0x2aaaa0-0x0;var _0x4dd7ca=_0x312f[_0x2aaaa0];return _0x4dd7ca;};'use strict';var Sequelize=require(_0xf312('0x0'));module[_0xf312('0x1')]={'name':{'type':Sequelize[_0xf312('0x2')],'allowNull':![],'unique':_0xf312('0x3')},'version':{'type':Sequelize[_0xf312('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf312('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf312('0x2')]},'type':{'type':Sequelize[_0xf312('0x2')]},'size':{'type':Sequelize[_0xf312('0x5')]},'active':{'type':Sequelize[_0xf312('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf312('0x2')]},'logo':{'type':Sequelize[_0xf312('0x2')]},'state':{'type':Sequelize[_0xf312('0x2')],'unique':_0xf312('0x7')},'description':{'type':Sequelize[_0xf312('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xf312('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 21bfa22..51ad9be 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Integration','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4819,0xcd));var _0x9481=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0x4819[_0xe7a99e];return _0x3bef5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['Integration']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Integration'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));}; \ No newline at end of file +var _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x2038e6,_0x57d969){var _0x543f8f=function(_0x4a4e9a){while(--_0x4a4e9a){_0x2038e6['push'](_0x2038e6['shift']());}};_0x543f8f(++_0x57d969);}(_0x1a85,0x178));var _0x51a8=function(_0x45ff81,_0x3cb624){_0x45ff81=_0x45ff81-0x0;var _0x1abf39=_0x1a85[_0x45ff81];return _0x1abf39;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2b5fb59..b6d539d 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 _0xb43f=['path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','api','moment','bluebird','request-promise'];(function(_0x597992,_0x516580){var _0x2bea67=function(_0x40b79f){while(--_0x40b79f){_0x597992['push'](_0x597992['shift']());}};_0x2bea67(++_0x516580);}(_0xb43f,0x7f));var _0xfb43=function(_0x2dfe07,_0x2b663f){_0x2dfe07=_0x2dfe07-0x0;var _0x30aee0=_0xb43f[_0x2dfe07];return _0x30aee0;};'use strict';var _=require(_0xfb43('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfb43('0x1'));var moment=require(_0xfb43('0x2'));var BPromise=require(_0xfb43('0x3'));var rp=require(_0xfb43('0x4'));var fs=require('fs');var path=require(_0xfb43('0x5'));var rimraf=require(_0xfb43('0x6'));var config=require(_0xfb43('0x7'));var attributes=require(_0xfb43('0x8'));module['exports']=function(_0x37d452,_0x2958c2){return _0x37d452[_0xfb43('0x9')](_0xfb43('0xa'),attributes,{'tableName':_0xfb43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d8b=['integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x0d8b,0x10f));var _0xb0d8=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x0d8b[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xb0d8('0x0'));var util=require(_0xb0d8('0x1'));var logger=require(_0xb0d8('0x2'))(_0xb0d8('0x3'));var moment=require(_0xb0d8('0x4'));var BPromise=require(_0xb0d8('0x5'));var rp=require(_0xb0d8('0x6'));var fs=require('fs');var path=require(_0xb0d8('0x7'));var rimraf=require(_0xb0d8('0x8'));var config=require(_0xb0d8('0x9'));var attributes=require(_0xb0d8('0xa'));module[_0xb0d8('0xb')]=function(_0x42bd54,_0x330210){return _0x42bd54[_0xb0d8('0xc')](_0xb0d8('0xd'),attributes,{'tableName':_0xb0d8('0xe'),'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 7a456cd..aa5b35e 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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x0b0e[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index dd9889f..43de28b 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0xd8d758,_0x153ed5){var _0x55628d=function(_0x1f43dd){while(--_0x1f43dd){_0xd8d758['push'](_0xd8d758['shift']());}};_0x55628d(++_0x153ed5);}(_0x1a85,0x178));var _0x51a8=function(_0x3523cb,_0x511b5c){_0x3523cb=_0x3523cb-0x0;var _0x54efd9=_0x1a85[_0x3523cb];return _0x54efd9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1f9504,_0x5882f1){var _0x56ad92=function(_0x1d8147){while(--_0x1d8147){_0x1f9504['push'](_0x1f9504['shift']());}};_0x56ad92(++_0x5882f1);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c062e,_0x20f461){_0x4c062e=_0x4c062e-0x0;var _0x16e86e=_0x5fab[_0x4c062e];return _0x16e86e;};'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('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6d373e5..51262af 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 _0x80af=['ENUM','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x3b8c0d,_0x307c6b){var _0x87348a=function(_0x521083){while(--_0x521083){_0x3b8c0d['push'](_0x3b8c0d['shift']());}};_0x87348a(++_0x307c6b);}(_0x80af,0x197));var _0xf80a=function(_0x3fc8ea,_0x8c5cb6){_0x3fc8ea=_0x3fc8ea-0x0;var _0x41cad5=_0x80af[_0x3fc8ea];return _0x41cad5;};'use strict';var Sequelize=require(_0xf80a('0x0'));module[_0xf80a('0x1')]={'integration':{'type':Sequelize[_0xf80a('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xf80a('0x2')]},'ticketId':{'type':Sequelize[_0xf80a('0x2')]},'integrationId':{'type':Sequelize[_0xf80a('0x3')]},'contacts':{'type':Sequelize[_0xf80a('0x2')]},'uniqueid':{'type':Sequelize[_0xf80a('0x2')]},'calleridnum':{'type':Sequelize[_0xf80a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf80a('0x2')]},'interface':{'type':Sequelize[_0xf80a('0x2')]},'membername':{'type':Sequelize[_0xf80a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf80a('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf80a('0x4')]},'holdtime':{'type':Sequelize[_0xf80a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf80a('0x4')]},'talktime':{'type':Sequelize[_0xf80a('0x3')]},'agentacw':{'type':Sequelize[_0xf80a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf80a('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf80a('0x4')]},'agentdump':{'type':Sequelize[_0xf80a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf80a('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf80a('0x2')]},'channelstate':{'type':Sequelize[_0xf80a('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf80a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf80a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf80a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf80a('0x2')]},'destchannel':{'type':Sequelize[_0xf80a('0x2')]},'destchannelstate':{'type':Sequelize[_0xf80a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf80a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf80a('0x2')]},'destcalleridname':{'type':Sequelize[_0xf80a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf80a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf80a('0x2')]},'destlanguage':{'type':Sequelize[_0xf80a('0x2')]},'destaccountcode':{'type':Sequelize[_0xf80a('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf80a('0x2')]},'destpriority':{'type':Sequelize[_0xf80a('0x2')]},'destuniqueid':{'type':Sequelize[_0xf80a('0x2')]},'messageId':{'type':Sequelize[_0xf80a('0x2')]},'inReplyTo':{'type':Sequelize[_0xf80a('0x2')]},'subject':{'type':Sequelize[_0xf80a('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf80a('0x2')]},'cc':{'type':Sequelize[_0xf80a('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf80a('0x6')]},'text':{'type':Sequelize[_0xf80a('0x6')]},'status':{'type':Sequelize[_0xf80a('0x7')]('SENT','SENDING','RECEIVED',_0xf80a('0x8'))},'url':{'type':Sequelize[_0xf80a('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf80a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2b88=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3da241,_0xeba26a){var _0x43e156=function(_0x41ced1){while(--_0x41ced1){_0x3da241['push'](_0x3da241['shift']());}};_0x43e156(++_0xeba26a);}(_0x2b88,0xc1));var _0x82b8=function(_0x2ac512,_0x18d0fc){_0x2ac512=_0x2ac512-0x0;var _0x41a20e=_0x2b88[_0x2ac512];return _0x41a20e;};'use strict';var Sequelize=require(_0x82b8('0x0'));module[_0x82b8('0x1')]={'integration':{'type':Sequelize[_0x82b8('0x2')]},'eventChannel':{'type':Sequelize[_0x82b8('0x2')]},'exitStatus':{'type':Sequelize[_0x82b8('0x2')]},'ticketId':{'type':Sequelize[_0x82b8('0x2')]},'integrationId':{'type':Sequelize[_0x82b8('0x3')]},'contacts':{'type':Sequelize[_0x82b8('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x82b8('0x2')]},'calleridname':{'type':Sequelize[_0x82b8('0x2')]},'queue':{'type':Sequelize[_0x82b8('0x2')]},'interface':{'type':Sequelize[_0x82b8('0x2')]},'membername':{'type':Sequelize[_0x82b8('0x2')]},'agentcalledAt':{'type':Sequelize[_0x82b8('0x4')]},'agentconnectAt':{'type':Sequelize[_0x82b8('0x4')]},'holdtime':{'type':Sequelize[_0x82b8('0x3')]},'agentcomplete':{'type':Sequelize[_0x82b8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x82b8('0x4')]},'talktime':{'type':Sequelize[_0x82b8('0x3')]},'agentacw':{'type':Sequelize[_0x82b8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x82b8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x82b8('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x82b8('0x2')]},'channelstate':{'type':Sequelize[_0x82b8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x82b8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x82b8('0x2')]},'connectedlinename':{'type':Sequelize[_0x82b8('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x82b8('0x2')]},'context':{'type':Sequelize[_0x82b8('0x2')]},'exten':{'type':Sequelize[_0x82b8('0x2')]},'priority':{'type':Sequelize[_0x82b8('0x2')]},'destchannel':{'type':Sequelize[_0x82b8('0x2')]},'destchannelstate':{'type':Sequelize[_0x82b8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x82b8('0x2')]},'destcalleridnum':{'type':Sequelize[_0x82b8('0x2')]},'destcalleridname':{'type':Sequelize[_0x82b8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x82b8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x82b8('0x2')]},'destlanguage':{'type':Sequelize[_0x82b8('0x2')]},'destaccountcode':{'type':Sequelize[_0x82b8('0x2')]},'destcontext':{'type':Sequelize[_0x82b8('0x2')]},'destexten':{'type':Sequelize[_0x82b8('0x2')]},'destpriority':{'type':Sequelize[_0x82b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x82b8('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x82b8('0x2')]},'from':{'type':Sequelize[_0x82b8('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x82b8('0x2')]},'attachment':{'type':Sequelize[_0x82b8('0x6')]},'html':{'type':Sequelize[_0x82b8('0x6')]},'text':{'type':Sequelize[_0x82b8('0x6')]},'status':{'type':Sequelize[_0x82b8('0x7')]('SENT',_0x82b8('0x8'),_0x82b8('0x9'),_0x82b8('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x82b8('0x2')]},'appdata':{'type':Sequelize[_0x82b8('0x2')]},'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 f7a6fab..e5d24a8 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 _0x2802=['Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','set'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2802,0x75));var _0x2280=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0x2802[_0x58ceb9];return _0x3d0ff5;};'use strict';var emlformat=require(_0x2280('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2280('0x1'));var jsonpatch=require(_0x2280('0x2'));var rp=require('request-promise');var moment=require(_0x2280('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2280('0x4'));var util=require(_0x2280('0x5'));var path=require(_0x2280('0x6'));var sox=require(_0x2280('0x7'));var csv=require(_0x2280('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2280('0x9'));var _=require(_0x2280('0xa'));var squel=require(_0x2280('0xb'));var crypto=require('crypto');var jsforce=require(_0x2280('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2280('0x8'));var querystring=require('querystring');var Papa=require(_0x2280('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2280('0xe'));var hardwareService=require(_0x2280('0xf'));var logger=require(_0x2280('0x10'))('api');var utils=require(_0x2280('0x11'));var config=require(_0x2280('0x12'));var licenseUtil=require(_0x2280('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1482e0,_0xec2a81){_0xec2a81=_0xec2a81||0xcc;return function(_0x3d8eba){if(_0x3d8eba){return _0x1482e0[_0x2280('0x14')](_0xec2a81);}return _0x1482e0['status'](_0xec2a81)[_0x2280('0x15')]();};}function respondWithResult(_0x319de8,_0x34b84d){_0x34b84d=_0x34b84d||0xc8;return function(_0x5324c2){if(_0x5324c2){return _0x319de8[_0x2280('0x16')](_0x34b84d)['json'](_0x5324c2);}};}function respondWithFilteredResult(_0x6f888e,_0x4f8904){return function(_0xce9fe7){if(_0xce9fe7){var _0x22b64a=typeof _0x4f8904[_0x2280('0x17')]===_0x2280('0x18')&&typeof _0x4f8904['limit']===_0x2280('0x18');var _0x4f5e5a=_0xce9fe7[_0x2280('0x19')];var _0x3966ea=_0x22b64a?0x0:_0x4f8904[_0x2280('0x17')];var _0x20a76f=_0x22b64a?_0xce9fe7[_0x2280('0x19')]:_0x4f8904[_0x2280('0x17')]+_0x4f8904['limit'];var _0x476a8b;if(_0x20a76f>=_0x4f5e5a){_0x20a76f=_0x4f5e5a;_0x476a8b=0xc8;}else{_0x476a8b=0xce;}_0x6f888e[_0x2280('0x16')](_0x476a8b);return _0x6f888e[_0x2280('0x1a')](_0x2280('0x1b'),_0x3966ea+'-'+_0x20a76f+'/'+_0x4f5e5a)[_0x2280('0x1c')](_0xce9fe7);}return null;};}function patchUpdates(_0xd98317){return function(_0x516952){try{jsonpatch[_0x2280('0x1d')](_0x516952,_0xd98317,!![]);}catch(_0x351b8a){return BPromise['reject'](_0x351b8a);}return _0x516952[_0x2280('0x1e')]();};}function saveUpdates(_0x749ac,_0x2288d7){return function(_0x5007f3){if(_0x5007f3){return _0x5007f3[_0x2280('0x1f')](_0x749ac)[_0x2280('0x20')](function(_0x5209c1){return _0x5209c1;});}return null;};}function removeEntity(_0xfb173c,_0x99c925){return function(_0x444703){if(_0x444703){return _0x444703[_0x2280('0x21')]()[_0x2280('0x20')](function(){_0xfb173c['status'](0xcc)[_0x2280('0x15')]();});}};}function handleEntityNotFound(_0xfc6373,_0x40320b){return function(_0x79236){if(!_0x79236){_0xfc6373[_0x2280('0x14')](0x194);}return _0x79236;};}function handleError(_0x5977dd,_0x6af43){_0x6af43=_0x6af43||0x1f4;return function(_0x3745dd){logger['error'](_0x3745dd[_0x2280('0x22')]);if(_0x3745dd[_0x2280('0x23')]){delete _0x3745dd[_0x2280('0x23')];}_0x5977dd[_0x2280('0x16')](_0x6af43)[_0x2280('0x24')](_0x3745dd);};}exports[_0x2280('0x25')]=function(_0x2c3625,_0x1164f7){var _0xd67270={},_0x3f8b35={},_0x3167e9={'count':0x0,'rows':[]};var _0x4697d4=_[_0x2280('0x26')](db['IntegrationReport'][_0x2280('0x27')],function(_0x4e4d61){return{'name':_0x4e4d61[_0x2280('0x28')],'type':_0x4e4d61['type'][_0x2280('0x29')]};});_0x3f8b35[_0x2280('0x2a')]=_['map'](_0x4697d4,_0x2280('0x23'));_0x3f8b35[_0x2280('0x2b')]=_[_0x2280('0x2c')](_0x2c3625[_0x2280('0x2b')]);_0x3f8b35[_0x2280('0x2d')]=_[_0x2280('0x2e')](_0x3f8b35[_0x2280('0x2a')],_0x3f8b35[_0x2280('0x2b')]);_0xd67270['attributes']=_[_0x2280('0x2e')](_0x3f8b35[_0x2280('0x2a')],qs['fields'](_0x2c3625['query'][_0x2280('0x2f')]));_0xd67270[_0x2280('0x30')]=_0xd67270[_0x2280('0x30')][_0x2280('0x31')]?_0xd67270[_0x2280('0x30')]:_0x3f8b35[_0x2280('0x2a')];if(!_0x2c3625['query']['hasOwnProperty'](_0x2280('0x32'))){_0xd67270[_0x2280('0x33')]=qs['limit'](_0x2c3625[_0x2280('0x2b')][_0x2280('0x33')]);_0xd67270[_0x2280('0x17')]=qs['offset'](_0x2c3625[_0x2280('0x2b')]['offset']);}_0xd67270[_0x2280('0x34')]=qs[_0x2280('0x35')](_0x2c3625[_0x2280('0x2b')][_0x2280('0x35')]);_0xd67270[_0x2280('0x36')]=qs[_0x2280('0x2d')](_[_0x2280('0x37')](_0x2c3625['query'],_0x3f8b35[_0x2280('0x2d')]),_0x4697d4);if(_0x2c3625[_0x2280('0x2b')][_0x2280('0x38')]){_0xd67270['where']=_['merge'](_0xd67270[_0x2280('0x36')],{'$or':_[_0x2280('0x26')](_0x4697d4,function(_0x56962c){if(_0x56962c[_0x2280('0x39')]!==_0x2280('0x3a')){var _0x3874ae={};_0x3874ae[_0x56962c[_0x2280('0x23')]]={'$like':'%'+_0x2c3625[_0x2280('0x2b')][_0x2280('0x38')]+'%'};return _0x3874ae;}})});}_0xd67270=_['merge']({},_0xd67270,_0x2c3625[_0x2280('0x3b')]);var _0x5dc66c={'where':_0xd67270[_0x2280('0x36')]};return db[_0x2280('0x3c')][_0x2280('0x19')](_0x5dc66c)['then'](function(_0x11c81c){_0x3167e9[_0x2280('0x19')]=_0x11c81c;if(_0x2c3625[_0x2280('0x2b')][_0x2280('0x3d')]){_0xd67270['include']=[{'all':!![]}];}return db[_0x2280('0x3c')][_0x2280('0x3e')](_0xd67270);})['then'](function(_0x2c5246){_0x3167e9[_0x2280('0x3f')]=_0x2c5246;return _0x3167e9;})['then'](respondWithFilteredResult(_0x1164f7,_0xd67270))['catch'](handleError(_0x1164f7,null));};exports[_0x2280('0x40')]=function(_0x2ea004,_0x352ded){var _0x345a8e={'raw':![],'where':{'id':_0x2ea004[_0x2280('0x41')]['id']}},_0x16b0be={};_0x16b0be[_0x2280('0x2a')]=_[_0x2280('0x2c')](db['IntegrationReport']['rawAttributes']);_0x16b0be['query']=_[_0x2280('0x2c')](_0x2ea004['query']);_0x16b0be['filters']=_['intersection'](_0x16b0be[_0x2280('0x2a')],_0x16b0be[_0x2280('0x2b')]);_0x345a8e[_0x2280('0x30')]=_[_0x2280('0x2e')](_0x16b0be[_0x2280('0x2a')],qs[_0x2280('0x2f')](_0x2ea004['query']['fields']));_0x345a8e[_0x2280('0x30')]=_0x345a8e[_0x2280('0x30')][_0x2280('0x31')]?_0x345a8e[_0x2280('0x30')]:_0x16b0be[_0x2280('0x2a')];if(_0x2ea004[_0x2280('0x2b')][_0x2280('0x3d')]){_0x345a8e[_0x2280('0x42')]=[{'all':!![]}];}_0x345a8e=_['merge']({},_0x345a8e,_0x2ea004[_0x2280('0x3b')]);return db[_0x2280('0x3c')]['find'](_0x345a8e)[_0x2280('0x20')](handleEntityNotFound(_0x352ded,null))[_0x2280('0x20')](respondWithResult(_0x352ded,null))[_0x2280('0x43')](handleError(_0x352ded,null));};exports[_0x2280('0x44')]=function(_0x516e33,_0x3a311a){return db['IntegrationReport'][_0x2280('0x44')](_0x516e33['body'],{})['then'](respondWithResult(_0x3a311a,0xc9))['catch'](handleError(_0x3a311a,null));};exports[_0x2280('0x1f')]=function(_0x413b42,_0x3aaf32){if(_0x413b42[_0x2280('0x45')]['id']){delete _0x413b42['body']['id'];}return db[_0x2280('0x3c')][_0x2280('0x46')]({'where':{'id':_0x413b42[_0x2280('0x41')]['id']}})[_0x2280('0x20')](handleEntityNotFound(_0x3aaf32,null))[_0x2280('0x20')](saveUpdates(_0x413b42[_0x2280('0x45')],null))[_0x2280('0x20')](respondWithResult(_0x3aaf32,null))[_0x2280('0x43')](handleError(_0x3aaf32,null));};exports[_0x2280('0x21')]=function(_0x378976,_0xa9796b){return db[_0x2280('0x3c')][_0x2280('0x46')]({'where':{'id':_0x378976[_0x2280('0x41')]['id']}})[_0x2280('0x20')](handleEntityNotFound(_0xa9796b,null))['then'](removeEntity(_0xa9796b,null))[_0x2280('0x43')](handleError(_0xa9796b,null));};exports[_0x2280('0x47')]=function(_0x291d94,_0x556606){return db[_0x2280('0x3c')][_0x2280('0x47')]()[_0x2280('0x20')](respondWithResult(_0x556606,null))[_0x2280('0x43')](handleError(_0x556606,null));}; \ No newline at end of file +var _0x7c97=['show','params','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x406922,_0x2b58e6){var _0x34aeb8=function(_0x505f4c){while(--_0x505f4c){_0x406922['push'](_0x406922['shift']());}};_0x34aeb8(++_0x2b58e6);}(_0x7c97,0x142));var _0x77c9=function(_0x33468e,_0x5dd2f8){_0x33468e=_0x33468e-0x0;var _0x4de00a=_0x7c97[_0x33468e];return _0x4de00a;};'use strict';var emlformat=require(_0x77c9('0x0'));var rimraf=require(_0x77c9('0x1'));var zipdir=require(_0x77c9('0x2'));var jsonpatch=require(_0x77c9('0x3'));var rp=require(_0x77c9('0x4'));var moment=require(_0x77c9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x77c9('0x6'));var path=require('path');var sox=require(_0x77c9('0x7'));var csv=require(_0x77c9('0x8'));var ejs=require(_0x77c9('0x9'));var fs=require('fs');var fs_extra=require(_0x77c9('0xa'));var _=require(_0x77c9('0xb'));var squel=require(_0x77c9('0xc'));var crypto=require(_0x77c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77c9('0xe'));var toCsv=require(_0x77c9('0x8'));var querystring=require(_0x77c9('0xf'));var Papa=require(_0x77c9('0x10'));var Redis=require(_0x77c9('0x11'));var authService=require(_0x77c9('0x12'));var qs=require(_0x77c9('0x13'));var as=require(_0x77c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77c9('0x15'))(_0x77c9('0x16'));var utils=require(_0x77c9('0x17'));var config=require(_0x77c9('0x18'));var licenseUtil=require(_0x77c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ad0b,_0x13a887){_0x13a887=_0x13a887||0xcc;return function(_0x277451){if(_0x277451){return _0x32ad0b[_0x77c9('0x1a')](_0x13a887);}return _0x32ad0b['status'](_0x13a887)[_0x77c9('0x1b')]();};}function respondWithResult(_0x43ea4e,_0x53f32f){_0x53f32f=_0x53f32f||0xc8;return function(_0x24d820){if(_0x24d820){return _0x43ea4e[_0x77c9('0x1c')](_0x53f32f)[_0x77c9('0x1d')](_0x24d820);}};}function respondWithFilteredResult(_0x480865,_0x3b67e4){return function(_0x148ed4){if(_0x148ed4){var _0x4198bc=typeof _0x3b67e4[_0x77c9('0x1e')]===_0x77c9('0x1f')&&typeof _0x3b67e4[_0x77c9('0x20')]===_0x77c9('0x1f');var _0x399eac=_0x148ed4['count'];var _0x199bc7=_0x4198bc?0x0:_0x3b67e4['offset'];var _0x2c45b9=_0x4198bc?_0x148ed4[_0x77c9('0x21')]:_0x3b67e4[_0x77c9('0x1e')]+_0x3b67e4[_0x77c9('0x20')];var _0x250916;if(_0x2c45b9>=_0x399eac){_0x2c45b9=_0x399eac;_0x250916=0xc8;}else{_0x250916=0xce;}_0x480865['status'](_0x250916);return _0x480865[_0x77c9('0x22')](_0x77c9('0x23'),_0x199bc7+'-'+_0x2c45b9+'/'+_0x399eac)['json'](_0x148ed4);}return null;};}function patchUpdates(_0x34fbd0){return function(_0x5cf6e9){try{jsonpatch[_0x77c9('0x24')](_0x5cf6e9,_0x34fbd0,!![]);}catch(_0x291573){return BPromise[_0x77c9('0x25')](_0x291573);}return _0x5cf6e9['save']();};}function saveUpdates(_0x4d7572,_0x353198){return function(_0x575f90){if(_0x575f90){return _0x575f90[_0x77c9('0x26')](_0x4d7572)[_0x77c9('0x27')](function(_0x507dee){return _0x507dee;});}return null;};}function removeEntity(_0x56cee0,_0x54742b){return function(_0x960d35){if(_0x960d35){return _0x960d35[_0x77c9('0x28')]()[_0x77c9('0x27')](function(){_0x56cee0[_0x77c9('0x1c')](0xcc)[_0x77c9('0x1b')]();});}};}function handleEntityNotFound(_0x47874,_0x1198c1){return function(_0x3ab6ff){if(!_0x3ab6ff){_0x47874[_0x77c9('0x1a')](0x194);}return _0x3ab6ff;};}function handleError(_0x58055d,_0x4255dd){_0x4255dd=_0x4255dd||0x1f4;return function(_0x29b7b5){logger[_0x77c9('0x29')](_0x29b7b5[_0x77c9('0x2a')]);if(_0x29b7b5[_0x77c9('0x2b')]){delete _0x29b7b5[_0x77c9('0x2b')];}_0x58055d[_0x77c9('0x1c')](_0x4255dd)[_0x77c9('0x2c')](_0x29b7b5);};}exports['index']=function(_0x4a00e9,_0x3bcb7a){var _0x7818ce={},_0x37f69a={},_0x126ed2={'count':0x0,'rows':[]};var _0x182822=_[_0x77c9('0x2d')](db[_0x77c9('0x2e')][_0x77c9('0x2f')],function(_0x4ef755){return{'name':_0x4ef755[_0x77c9('0x30')],'type':_0x4ef755[_0x77c9('0x31')][_0x77c9('0x32')]};});_0x37f69a[_0x77c9('0x33')]=_[_0x77c9('0x2d')](_0x182822,_0x77c9('0x2b'));_0x37f69a[_0x77c9('0x34')]=_[_0x77c9('0x35')](_0x4a00e9[_0x77c9('0x34')]);_0x37f69a[_0x77c9('0x36')]=_['intersection'](_0x37f69a[_0x77c9('0x33')],_0x37f69a[_0x77c9('0x34')]);_0x7818ce[_0x77c9('0x37')]=_[_0x77c9('0x38')](_0x37f69a[_0x77c9('0x33')],qs['fields'](_0x4a00e9['query'][_0x77c9('0x39')]));_0x7818ce[_0x77c9('0x37')]=_0x7818ce['attributes'][_0x77c9('0x3a')]?_0x7818ce[_0x77c9('0x37')]:_0x37f69a[_0x77c9('0x33')];if(!_0x4a00e9['query'][_0x77c9('0x3b')](_0x77c9('0x3c'))){_0x7818ce['limit']=qs['limit'](_0x4a00e9['query'][_0x77c9('0x20')]);_0x7818ce[_0x77c9('0x1e')]=qs[_0x77c9('0x1e')](_0x4a00e9[_0x77c9('0x34')][_0x77c9('0x1e')]);}_0x7818ce[_0x77c9('0x3d')]=qs[_0x77c9('0x3e')](_0x4a00e9[_0x77c9('0x34')][_0x77c9('0x3e')]);_0x7818ce[_0x77c9('0x3f')]=qs[_0x77c9('0x36')](_[_0x77c9('0x40')](_0x4a00e9[_0x77c9('0x34')],_0x37f69a['filters']),_0x182822);if(_0x4a00e9[_0x77c9('0x34')][_0x77c9('0x41')]){_0x7818ce['where']=_[_0x77c9('0x42')](_0x7818ce[_0x77c9('0x3f')],{'$or':_[_0x77c9('0x2d')](_0x182822,function(_0x4c264c){if(_0x4c264c[_0x77c9('0x31')]!==_0x77c9('0x43')){var _0x1ce26c={};_0x1ce26c[_0x4c264c[_0x77c9('0x2b')]]={'$like':'%'+_0x4a00e9[_0x77c9('0x34')]['filter']+'%'};return _0x1ce26c;}})});}_0x7818ce=_[_0x77c9('0x42')]({},_0x7818ce,_0x4a00e9[_0x77c9('0x44')]);var _0x439bd2={'where':_0x7818ce[_0x77c9('0x3f')]};return db[_0x77c9('0x2e')][_0x77c9('0x21')](_0x439bd2)['then'](function(_0x419273){_0x126ed2[_0x77c9('0x21')]=_0x419273;if(_0x4a00e9[_0x77c9('0x34')][_0x77c9('0x45')]){_0x7818ce[_0x77c9('0x46')]=[{'all':!![]}];}return db[_0x77c9('0x2e')][_0x77c9('0x47')](_0x7818ce);})['then'](function(_0x5e7fed){_0x126ed2[_0x77c9('0x48')]=_0x5e7fed;return _0x126ed2;})['then'](respondWithFilteredResult(_0x3bcb7a,_0x7818ce))['catch'](handleError(_0x3bcb7a,null));};exports[_0x77c9('0x49')]=function(_0x3b8dae,_0xc968ce){var _0x1e675b={'raw':![],'where':{'id':_0x3b8dae[_0x77c9('0x4a')]['id']}},_0x26739c={};_0x26739c[_0x77c9('0x33')]=_[_0x77c9('0x35')](db[_0x77c9('0x2e')]['rawAttributes']);_0x26739c[_0x77c9('0x34')]=_[_0x77c9('0x35')](_0x3b8dae[_0x77c9('0x34')]);_0x26739c[_0x77c9('0x36')]=_[_0x77c9('0x38')](_0x26739c[_0x77c9('0x33')],_0x26739c[_0x77c9('0x34')]);_0x1e675b[_0x77c9('0x37')]=_[_0x77c9('0x38')](_0x26739c[_0x77c9('0x33')],qs['fields'](_0x3b8dae[_0x77c9('0x34')][_0x77c9('0x39')]));_0x1e675b['attributes']=_0x1e675b['attributes'][_0x77c9('0x3a')]?_0x1e675b[_0x77c9('0x37')]:_0x26739c[_0x77c9('0x33')];if(_0x3b8dae[_0x77c9('0x34')]['includeAll']){_0x1e675b[_0x77c9('0x46')]=[{'all':!![]}];}_0x1e675b=_['merge']({},_0x1e675b,_0x3b8dae[_0x77c9('0x44')]);return db[_0x77c9('0x2e')]['find'](_0x1e675b)[_0x77c9('0x27')](handleEntityNotFound(_0xc968ce,null))[_0x77c9('0x27')](respondWithResult(_0xc968ce,null))['catch'](handleError(_0xc968ce,null));};exports[_0x77c9('0x4b')]=function(_0x163642,_0x380393){return db['IntegrationReport'][_0x77c9('0x4b')](_0x163642['body'],{})[_0x77c9('0x27')](respondWithResult(_0x380393,0xc9))[_0x77c9('0x4c')](handleError(_0x380393,null));};exports[_0x77c9('0x26')]=function(_0x3c0808,_0x1fc9d0){if(_0x3c0808[_0x77c9('0x4d')]['id']){delete _0x3c0808['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3c0808[_0x77c9('0x4a')]['id']}})[_0x77c9('0x27')](handleEntityNotFound(_0x1fc9d0,null))[_0x77c9('0x27')](saveUpdates(_0x3c0808[_0x77c9('0x4d')],null))['then'](respondWithResult(_0x1fc9d0,null))[_0x77c9('0x4c')](handleError(_0x1fc9d0,null));};exports['destroy']=function(_0x26f5db,_0x413362){return db['IntegrationReport']['find']({'where':{'id':_0x26f5db[_0x77c9('0x4a')]['id']}})[_0x77c9('0x27')](handleEntityNotFound(_0x413362,null))[_0x77c9('0x27')](removeEntity(_0x413362,null))[_0x77c9('0x4c')](handleError(_0x413362,null));};exports[_0x77c9('0x4e')]=function(_0xf4dc0e,_0x62d26e){return db[_0x77c9('0x2e')][_0x77c9('0x4e')]()['then'](respondWithResult(_0x62d26e,null))[_0x77c9('0x4c')](handleError(_0x62d26e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 58658ff..7bcd420 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 _0xa2dc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','lodash','../../config/logger'];(function(_0x446694,_0x58ac42){var _0x358a3a=function(_0x43b171){while(--_0x43b171){_0x446694['push'](_0x446694['shift']());}};_0x358a3a(++_0x58ac42);}(_0xa2dc,0x174));var _0xca2d=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xa2dc[_0x1fcf1b];return _0x5d2952;};'use strict';var _=require(_0xca2d('0x0'));var util=require('util');var logger=require(_0xca2d('0x1'))(_0xca2d('0x2'));var moment=require(_0xca2d('0x3'));var BPromise=require(_0xca2d('0x4'));var rp=require(_0xca2d('0x5'));var fs=require('fs');var path=require(_0xca2d('0x6'));var rimraf=require(_0xca2d('0x7'));var config=require(_0xca2d('0x8'));var attributes=require(_0xca2d('0x9'));module['exports']=function(_0x1ecc1e,_0x4eacc8){return _0x1ecc1e[_0xca2d('0xa')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff9c=['IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','define'];(function(_0x54c22b,_0x46a193){var _0x526664=function(_0x32a923){while(--_0x32a923){_0x54c22b['push'](_0x54c22b['shift']());}};_0x526664(++_0x46a193);}(_0xff9c,0x146));var _0xcff9=function(_0x1fc852,_0x449001){_0x1fc852=_0x1fc852-0x0;var _0x46a237=_0xff9c[_0x1fc852];return _0x46a237;};'use strict';var _=require(_0xcff9('0x0'));var util=require(_0xcff9('0x1'));var logger=require(_0xcff9('0x2'))(_0xcff9('0x3'));var moment=require('moment');var BPromise=require(_0xcff9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff9('0x5'));var rimraf=require(_0xcff9('0x6'));var config=require(_0xcff9('0x7'));var attributes=require(_0xcff9('0x8'));module['exports']=function(_0x40ee75,_0x251d05){return _0x40ee75[_0xcff9('0x9')](_0xcff9('0xa'),attributes,{'tableName':_0xcff9('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 95401a3..8e862a8 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x24c811,_0x3bb49a){var _0x536236=function(_0x3d0f87){while(--_0x3d0f87){_0x24c811['push'](_0x24c811['shift']());}};_0x536236(++_0x3bb49a);}(_0x2ef3,0xba));var _0x32ef=function(_0x3bb2ff,_0x49ea68){_0x3bb2ff=_0x3bb2ff-0x0;var _0x2c9d51=_0x2ef3[_0x3bb2ff];return _0x2c9d51;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x287aba,_0x2b05a3){var _0x25d2ea=function(_0x1652c2){while(--_0x1652c2){_0x287aba['push'](_0x287aba['shift']());}};_0x25d2ea(++_0x2b05a3);}(_0x2ef3,0xba));var _0x32ef=function(_0x25245f,_0x3b150f){_0x25245f=_0x25245f-0x0;var _0x565327=_0x2ef3[_0x25245f];return _0x565327;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 96c7ada..ac50f63 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 _0xdced=['/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get','index','/:id','isAuthenticated','show','getIntervals','post','/:id/sub_intervals','addInterval'];(function(_0x10dc94,_0x2fed4f){var _0x4a462d=function(_0x5181bd){while(--_0x5181bd){_0x10dc94['push'](_0x10dc94['shift']());}};_0x4a462d(++_0x2fed4f);}(_0xdced,0xcb));var _0xddce=function(_0xa3ffc1,_0x17f690){_0xa3ffc1=_0xa3ffc1-0x0;var _0x3d7ed6=_0xdced[_0xa3ffc1];return _0x3d7ed6;};'use strict';var multer=require('multer');var util=require(_0xddce('0x0'));var path=require(_0xddce('0x1'));var timeout=require(_0xddce('0x2'));var express=require(_0xddce('0x3'));var router=express[_0xddce('0x4')]();var fs_extra=require(_0xddce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddce('0x6'));var config=require('../../config/environment');var controller=require(_0xddce('0x7'));router[_0xddce('0x8')]('/',auth['isAuthenticated'](),controller[_0xddce('0x9')]);router['get'](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0xc')]);router[_0xddce('0x8')]('/:id/sub_intervals',auth[_0xddce('0xb')](),controller[_0xddce('0xd')]);router[_0xddce('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xddce('0xe')](_0xddce('0xf'),auth['isAuthenticated'](),controller[_0xddce('0x10')]);router[_0xddce('0xe')](_0xddce('0x11'),auth['isAuthenticated'](),controller[_0xddce('0x12')]);router['put'](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0x13')]);router[_0xddce('0x14')](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0x15')]);module['exports']=router; \ No newline at end of file +var _0x463e=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','index','get','/:id','isAuthenticated','show','post','create','/:id/sub_intervals','addInterval','addIntervals','update','delete','destroy','multer'];(function(_0x24c9aa,_0x4e2f13){var _0x46c7ba=function(_0x3fbf5d){while(--_0x3fbf5d){_0x24c9aa['push'](_0x24c9aa['shift']());}};_0x46c7ba(++_0x4e2f13);}(_0x463e,0x13f));var _0xe463=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x463e[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xe463('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe463('0x1'));var express=require('express');var router=express[_0xe463('0x2')]();var fs_extra=require(_0xe463('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe463('0x4'));var config=require(_0xe463('0x5'));var controller=require(_0xe463('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe463('0x7')]);router[_0xe463('0x8')](_0xe463('0x9'),auth[_0xe463('0xa')](),controller[_0xe463('0xb')]);router[_0xe463('0x8')]('/:id/sub_intervals',auth[_0xe463('0xa')](),controller['getIntervals']);router[_0xe463('0xc')]('/',auth[_0xe463('0xa')](),controller[_0xe463('0xd')]);router[_0xe463('0xc')](_0xe463('0xe'),auth[_0xe463('0xa')](),controller[_0xe463('0xf')]);router['post']('/:id/sub_intervals/create_many',auth[_0xe463('0xa')](),controller[_0xe463('0x10')]);router['put']('/:id',auth[_0xe463('0xa')](),controller[_0xe463('0x11')]);router[_0xe463('0x12')](_0xe463('0x9'),auth[_0xe463('0xa')](),controller[_0xe463('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 2ce9a48..bc06158 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 _0x63ef=['sequelize','STRING'];(function(_0x3947ac,_0x4b2f4a){var _0x34f828=function(_0x5add25){while(--_0x5add25){_0x3947ac['push'](_0x3947ac['shift']());}};_0x34f828(++_0x4b2f4a);}(_0x63ef,0x198));var _0xf63e=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x63ef[_0x3be7ff];return _0x186721;};'use strict';var Sequelize=require(_0xf63e('0x0'));module['exports']={'name':{'type':Sequelize[_0xf63e('0x1')]},'description':{'type':Sequelize[_0xf63e('0x1')]},'interval':{'type':Sequelize[_0xf63e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xae1c=['STRING','exports'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xae1c,0x1f3));var _0xcae1=function(_0x2534a6,_0x1ac6d6){_0x2534a6=_0x2534a6-0x0;var _0x517d99=_0xae1c[_0x2534a6];return _0x517d99;};'use strict';var Sequelize=require('sequelize');module[_0xcae1('0x0')]={'name':{'type':Sequelize[_0xcae1('0x1')]},'description':{'type':Sequelize[_0xcae1('0x1')]},'interval':{'type':Sequelize[_0xcae1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e47c8ff..dc652ef 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 _0x394d=['apply','save','destroy','then','get','Intervals','error','stack','name','send','index','Interval','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','params','keys','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','update','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','addIntervals','sequelize','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4d5696,_0xd1d510){var _0x3be99c=function(_0x4a7b13){while(--_0x4a7b13){_0x4d5696['push'](_0x4d5696['shift']());}};_0x3be99c(++_0xd1d510);}(_0x394d,0x156));var _0xd394=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x394d[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0xd394('0x0'));var rimraf=require(_0xd394('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd394('0x2'));var rp=require(_0xd394('0x3'));var moment=require('moment');var BPromise=require(_0xd394('0x4'));var Mustache=require(_0xd394('0x5'));var util=require(_0xd394('0x6'));var path=require(_0xd394('0x7'));var sox=require(_0xd394('0x8'));var csv=require(_0xd394('0x9'));var ejs=require(_0xd394('0xa'));var fs=require('fs');var fs_extra=require(_0xd394('0xb'));var _=require(_0xd394('0xc'));var squel=require(_0xd394('0xd'));var crypto=require(_0xd394('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd394('0xf'));var toCsv=require(_0xd394('0x9'));var querystring=require(_0xd394('0x10'));var Papa=require(_0xd394('0x11'));var Redis=require(_0xd394('0x12'));var authService=require(_0xd394('0x13'));var qs=require(_0xd394('0x14'));var as=require(_0xd394('0x15'));var hardwareService=require(_0xd394('0x16'));var logger=require(_0xd394('0x17'))('api');var utils=require(_0xd394('0x18'));var config=require(_0xd394('0x19'));var licenseUtil=require(_0xd394('0x1a'));var db=require(_0xd394('0x1b'))['db'];var extensions=require(_0xd394('0x1c'));function respondWithStatusCode(_0x2385a9,_0x31482f){_0x31482f=_0x31482f||0xcc;return function(_0x2040cb){if(_0x2040cb){return _0x2385a9[_0xd394('0x1d')](_0x31482f);}return _0x2385a9[_0xd394('0x1e')](_0x31482f)[_0xd394('0x1f')]();};}function respondWithResult(_0x3569e6,_0x4be43f){_0x4be43f=_0x4be43f||0xc8;return function(_0x2f596f){if(_0x2f596f){return _0x3569e6[_0xd394('0x1e')](_0x4be43f)[_0xd394('0x20')](_0x2f596f);}};}function respondWithFilteredResult(_0x56d748,_0x5df36e){return function(_0x1b9dea){if(_0x1b9dea){var _0x37cd93=typeof _0x5df36e[_0xd394('0x21')]===_0xd394('0x22')&&typeof _0x5df36e[_0xd394('0x23')]==='undefined';var _0x336062=_0x1b9dea[_0xd394('0x24')];var _0x463fca=_0x37cd93?0x0:_0x5df36e[_0xd394('0x21')];var _0x26d116=_0x37cd93?_0x1b9dea['count']:_0x5df36e[_0xd394('0x21')]+_0x5df36e[_0xd394('0x23')];var _0x48d1c1;if(_0x26d116>=_0x336062){_0x26d116=_0x336062;_0x48d1c1=0xc8;}else{_0x48d1c1=0xce;}_0x56d748[_0xd394('0x1e')](_0x48d1c1);return _0x56d748[_0xd394('0x25')]('Content-Range',_0x463fca+'-'+_0x26d116+'/'+_0x336062)['json'](_0x1b9dea);}return null;};}function patchUpdates(_0x4fe555){return function(_0x378519){try{jsonpatch[_0xd394('0x26')](_0x378519,_0x4fe555,!![]);}catch(_0xf3c1c4){return BPromise['reject'](_0xf3c1c4);}return _0x378519[_0xd394('0x27')]();};}function saveUpdates(_0xc170a5,_0x54d074){return function(_0x324aee){if(_0x324aee){return _0x324aee['update'](_0xc170a5)['then'](function(_0x5f0376){return _0x5f0376;});}return null;};}function removeEntity(_0xde0044,_0x4c6952){return function(_0x226baf){if(_0x226baf){return _0x226baf[_0xd394('0x28')]()[_0xd394('0x29')](function(){var _0x20ea4f=_0x226baf[_0xd394('0x2a')]({'plain':!![]});var _0x22fa98=_0xd394('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x22fa98,'resourceId':_0x20ea4f['id']}})[_0xd394('0x29')](function(){return _0x226baf;});})['then'](function(){_0xde0044['status'](0xcc)[_0xd394('0x1f')]();});}};}function handleEntityNotFound(_0x23282d,_0x39eba5){return function(_0x1affa5){if(!_0x1affa5){_0x23282d[_0xd394('0x1d')](0x194);}return _0x1affa5;};}function handleError(_0xc265db,_0x14298c){_0x14298c=_0x14298c||0x1f4;return function(_0x37ccad){logger[_0xd394('0x2c')](_0x37ccad[_0xd394('0x2d')]);if(_0x37ccad[_0xd394('0x2e')]){delete _0x37ccad['name'];}_0xc265db['status'](_0x14298c)[_0xd394('0x2f')](_0x37ccad);};}exports[_0xd394('0x30')]=function(_0x5e1930,_0x129bc4){var _0x182d91={},_0x3d7e46={},_0x27b2ab={'count':0x0,'rows':[]};var _0x3a7963=_['map'](db[_0xd394('0x31')][_0xd394('0x32')],function(_0x4dc0bd){return{'name':_0x4dc0bd[_0xd394('0x33')],'type':_0x4dc0bd[_0xd394('0x34')][_0xd394('0x35')]};});_0x3d7e46[_0xd394('0x36')]=_[_0xd394('0x37')](_0x3a7963,_0xd394('0x2e'));_0x3d7e46[_0xd394('0x38')]=_['keys'](_0x5e1930['query']);_0x3d7e46[_0xd394('0x39')]=_['intersection'](_0x3d7e46[_0xd394('0x36')],_0x3d7e46['query']);_0x182d91[_0xd394('0x3a')]=_[_0xd394('0x3b')](_0x3d7e46['model'],qs[_0xd394('0x3c')](_0x5e1930[_0xd394('0x38')][_0xd394('0x3c')]));_0x182d91[_0xd394('0x3a')]=_0x182d91[_0xd394('0x3a')][_0xd394('0x3d')]?_0x182d91['attributes']:_0x3d7e46[_0xd394('0x36')];if(!_0x5e1930[_0xd394('0x38')][_0xd394('0x3e')]('nolimit')){_0x182d91['limit']=qs[_0xd394('0x23')](_0x5e1930[_0xd394('0x38')]['limit']);_0x182d91[_0xd394('0x21')]=qs[_0xd394('0x21')](_0x5e1930[_0xd394('0x38')][_0xd394('0x21')]);}_0x182d91[_0xd394('0x3f')]=qs[_0xd394('0x40')](_0x5e1930[_0xd394('0x38')][_0xd394('0x40')]);_0x182d91[_0xd394('0x41')]=qs[_0xd394('0x39')](_['pick'](_0x5e1930[_0xd394('0x38')],_0x3d7e46[_0xd394('0x39')]),_0x3a7963);if(_0x5e1930[_0xd394('0x38')][_0xd394('0x42')]){_0x182d91[_0xd394('0x41')]=_[_0xd394('0x43')](_0x182d91[_0xd394('0x41')],{'$or':_[_0xd394('0x37')](_0x3a7963,function(_0xb3a571){if(_0xb3a571[_0xd394('0x34')]!=='VIRTUAL'){var _0x55f185={};_0x55f185[_0xb3a571[_0xd394('0x2e')]]={'$like':'%'+_0x5e1930[_0xd394('0x38')][_0xd394('0x42')]+'%'};return _0x55f185;}})});}_0x182d91=_[_0xd394('0x43')]({},_0x182d91,_0x5e1930[_0xd394('0x44')]);var _0x34d82a={'where':_0x182d91['where']};return db[_0xd394('0x31')][_0xd394('0x24')](_0x34d82a)[_0xd394('0x29')](function(_0x31cbb2){_0x27b2ab[_0xd394('0x24')]=_0x31cbb2;if(_0x5e1930[_0xd394('0x38')][_0xd394('0x45')]){_0x182d91['include']=[{'all':!![]}];}return db[_0xd394('0x31')][_0xd394('0x46')](_0x182d91);})[_0xd394('0x29')](function(_0x497180){_0x27b2ab[_0xd394('0x47')]=_0x497180;return _0x27b2ab;})[_0xd394('0x29')](respondWithFilteredResult(_0x129bc4,_0x182d91))['catch'](handleError(_0x129bc4,null));};exports['show']=function(_0x37e355,_0x2ea20c){var _0x4d5b6f={'raw':!![],'where':{'id':_0x37e355[_0xd394('0x48')]['id']}},_0x4c52bd={};_0x4c52bd[_0xd394('0x36')]=_[_0xd394('0x49')](db[_0xd394('0x31')][_0xd394('0x32')]);_0x4c52bd['query']=_[_0xd394('0x49')](_0x37e355[_0xd394('0x38')]);_0x4c52bd[_0xd394('0x39')]=_[_0xd394('0x3b')](_0x4c52bd[_0xd394('0x36')],_0x4c52bd[_0xd394('0x38')]);_0x4d5b6f[_0xd394('0x3a')]=_[_0xd394('0x3b')](_0x4c52bd['model'],qs[_0xd394('0x3c')](_0x37e355[_0xd394('0x38')][_0xd394('0x3c')]));_0x4d5b6f[_0xd394('0x3a')]=_0x4d5b6f[_0xd394('0x3a')]['length']?_0x4d5b6f[_0xd394('0x3a')]:_0x4c52bd['model'];if(_0x37e355[_0xd394('0x38')][_0xd394('0x45')]){_0x4d5b6f[_0xd394('0x4a')]=[{'all':!![]}];}_0x4d5b6f=_[_0xd394('0x43')]({},_0x4d5b6f,_0x37e355[_0xd394('0x44')]);return db[_0xd394('0x31')]['find'](_0x4d5b6f)[_0xd394('0x29')](handleEntityNotFound(_0x2ea20c,null))[_0xd394('0x29')](respondWithResult(_0x2ea20c,null))['catch'](handleError(_0x2ea20c,null));};exports[_0xd394('0x4b')]=function(_0x4bdddf,_0x5de8c4){return db[_0xd394('0x31')]['create'](_0x4bdddf[_0xd394('0x4c')],{})[_0xd394('0x29')](function(_0x8f1f8b){var _0x3f427a=_0x4bdddf[_0xd394('0x4d')]['get']({'plain':!![]});if(!_0x3f427a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f427a[_0xd394('0x4e')]===_0xd394('0x4d')){var _0x4e53e1=_0x8f1f8b[_0xd394('0x2a')]({'plain':!![]});var _0x4e6659=_0xd394('0x2b');return db[_0xd394('0x4f')][_0xd394('0x50')]({'where':{'name':_0x4e6659,'userProfileId':_0x3f427a[_0xd394('0x51')]},'raw':!![]})[_0xd394('0x29')](function(_0x13d000){if(_0x13d000&&_0x13d000[_0xd394('0x52')]===0x0){return db[_0xd394('0x53')][_0xd394('0x4b')]({'name':_0x4e53e1[_0xd394('0x2e')],'resourceId':_0x4e53e1['id'],'type':_0x13d000[_0xd394('0x2e')],'sectionId':_0x13d000['id']},{})['then'](function(){return _0x8f1f8b;});}else{return _0x8f1f8b;}})['catch'](function(_0x3c96a4){logger[_0xd394('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c96a4);throw _0x3c96a4;});}return _0x8f1f8b;})[_0xd394('0x29')](respondWithResult(_0x5de8c4,0xc9))[_0xd394('0x54')](handleError(_0x5de8c4,null));};exports[_0xd394('0x55')]=function(_0x268e35,_0x4e26c4){if(_0x268e35['body']['id']){delete _0x268e35[_0xd394('0x4c')]['id'];}return db['Interval'][_0xd394('0x50')]({'where':{'id':_0x268e35[_0xd394('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e26c4,null))[_0xd394('0x29')](saveUpdates(_0x268e35[_0xd394('0x4c')],null))[_0xd394('0x29')](respondWithResult(_0x4e26c4,null))[_0xd394('0x54')](handleError(_0x4e26c4,null));};exports['destroy']=function(_0x3907e7,_0x1706a0){return db['Interval']['find']({'where':{'id':_0x3907e7[_0xd394('0x48')]['id']}})[_0xd394('0x29')](handleEntityNotFound(_0x1706a0,null))[_0xd394('0x29')](removeEntity(_0x1706a0,null))[_0xd394('0x54')](handleError(_0x1706a0,null));};exports[_0xd394('0x56')]=function(_0x304691,_0x5d0fe0,_0x3da7b8){if(_0x304691['body']['id']){delete _0x304691['body']['id'];}return db[_0xd394('0x31')][_0xd394('0x50')]({'where':{'id':_0x304691[_0xd394('0x48')]['id']}})[_0xd394('0x29')](handleEntityNotFound(_0x5d0fe0,null))[_0xd394('0x29')](function(_0xd6dc3f){if(_0xd6dc3f){_0x304691[_0xd394('0x4c')][_0xd394('0x57')]=_0xd6dc3f['id'];return db[_0xd394('0x31')][_0xd394('0x4b')](_0x304691[_0xd394('0x4c')]);}})[_0xd394('0x29')](respondWithResult(_0x5d0fe0,null))[_0xd394('0x54')](handleError(_0x5d0fe0,null));};exports[_0xd394('0x58')]=function(_0x20b5a4,_0x53678c,_0x1f983e){var _0x5bc4d7={};var _0x3a6421={};var _0x310dde;var _0x242588;return db[_0xd394('0x31')][_0xd394('0x59')]({'where':{'id':_0x20b5a4['params']['id']}})[_0xd394('0x29')](handleEntityNotFound(_0x53678c,null))[_0xd394('0x29')](function(_0x5e1287){if(_0x5e1287){_0x310dde=_0x5e1287;_0x3a6421['model']=_['keys'](db[_0xd394('0x31')][_0xd394('0x32')]);_0x3a6421[_0xd394('0x38')]=_[_0xd394('0x49')](_0x20b5a4[_0xd394('0x38')]);_0x3a6421[_0xd394('0x39')]=_[_0xd394('0x3b')](_0x3a6421[_0xd394('0x36')],_0x3a6421['query']);_0x5bc4d7[_0xd394('0x3a')]=_[_0xd394('0x3b')](_0x3a6421[_0xd394('0x36')],qs[_0xd394('0x3c')](_0x20b5a4[_0xd394('0x38')][_0xd394('0x3c')]));_0x5bc4d7[_0xd394('0x3a')]=_0x5bc4d7[_0xd394('0x3a')][_0xd394('0x3d')]?_0x5bc4d7[_0xd394('0x3a')]:_0x3a6421[_0xd394('0x36')];_0x5bc4d7[_0xd394('0x3f')]=qs[_0xd394('0x40')](_0x20b5a4['query'][_0xd394('0x40')]);_0x5bc4d7[_0xd394('0x41')]=qs['filters'](_[_0xd394('0x5a')](_0x20b5a4[_0xd394('0x38')],_0x3a6421['filters']));if(_0x20b5a4[_0xd394('0x38')][_0xd394('0x42')]){_0x5bc4d7[_0xd394('0x41')]=_[_0xd394('0x43')](_0x5bc4d7[_0xd394('0x41')],{'$or':_[_0xd394('0x37')](_0x5bc4d7['attributes'],function(_0x2d1fad){var _0x1517d4={};_0x1517d4[_0x2d1fad]={'$like':'%'+_0x20b5a4[_0xd394('0x38')][_0xd394('0x42')]+'%'};return _0x1517d4;})});}_0x5bc4d7=_['merge']({},_0x5bc4d7,_0x20b5a4['options']);return _0x310dde[_0xd394('0x58')](_0x5bc4d7);}})[_0xd394('0x29')](function(_0x144b4b){if(_0x144b4b){_0x242588=_0x144b4b['length'];if(!_0x20b5a4['query'][_0xd394('0x3e')](_0xd394('0x5b'))){_0x5bc4d7[_0xd394('0x23')]=qs['limit'](_0x20b5a4[_0xd394('0x38')][_0xd394('0x23')]);_0x5bc4d7[_0xd394('0x21')]=qs[_0xd394('0x21')](_0x20b5a4[_0xd394('0x38')][_0xd394('0x21')]);}return _0x310dde['getIntervals'](_0x5bc4d7);}})[_0xd394('0x29')](function(_0x926065){if(_0x926065){return _0x926065?{'count':_0x242588,'rows':_0x926065}:null;}})['then'](respondWithResult(_0x53678c,null))['catch'](handleError(_0x53678c,null));};exports[_0xd394('0x5c')]=function(_0x1c2ed9,_0x2b09b1,_0x4f87d9){return db[_0xd394('0x31')][_0xd394('0x59')]({'where':{'id':_0x1c2ed9['params']['id']}})[_0xd394('0x29')](handleEntityNotFound(_0x2b09b1,null))[_0xd394('0x29')](function(_0x43bb5d){if(_0x43bb5d){return db[_0xd394('0x5d')]['transaction'](function(_0x40afab){return db[_0xd394('0x31')][_0xd394('0x28')]({'where':{'IntervalId':_0x1c2ed9[_0xd394('0x48')]['id']},'transaction':_0x40afab})['then'](function(_0x1070f1){var _0x457ceb=_[_0xd394('0x37')](_0x1c2ed9[_0xd394('0x4c')],function(_0x1d1f31){delete _0x1d1f31['id'];_0x1d1f31[_0xd394('0x57')]=_0x1c2ed9[_0xd394('0x48')]['id'];return _0x1d1f31;});return db[_0xd394('0x31')][_0xd394('0x5e')](_0x457ceb,{'transaction':_0x40afab});});})[_0xd394('0x29')](function(){return db[_0xd394('0x31')][_0xd394('0x46')]({'where':{'IntervalId':_0x1c2ed9[_0xd394('0x48')]['id']}});});}})[_0xd394('0x29')](respondWithResult(_0x2b09b1,null))[_0xd394('0x54')](handleError(_0x2b09b1,null));}; \ No newline at end of file +var _0xfcbe=['length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','body','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','transaction','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfcbe,0x1ec));var _0xefcb=function(_0x532d92,_0x3c7544){_0x532d92=_0x532d92-0x0;var _0x2d9d31=_0xfcbe[_0x532d92];return _0x2d9d31;};'use strict';var emlformat=require(_0xefcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefcb('0x1'));var jsonpatch=require(_0xefcb('0x2'));var rp=require('request-promise');var moment=require(_0xefcb('0x3'));var BPromise=require(_0xefcb('0x4'));var Mustache=require(_0xefcb('0x5'));var util=require(_0xefcb('0x6'));var path=require(_0xefcb('0x7'));var sox=require(_0xefcb('0x8'));var csv=require(_0xefcb('0x9'));var ejs=require(_0xefcb('0xa'));var fs=require('fs');var fs_extra=require(_0xefcb('0xb'));var _=require('lodash');var squel=require(_0xefcb('0xc'));var crypto=require(_0xefcb('0xd'));var jsforce=require(_0xefcb('0xe'));var deskjs=require(_0xefcb('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefcb('0x10'));var Redis=require('ioredis');var authService=require(_0xefcb('0x11'));var qs=require(_0xefcb('0x12'));var as=require(_0xefcb('0x13'));var hardwareService=require(_0xefcb('0x14'));var logger=require(_0xefcb('0x15'))('api');var utils=require(_0xefcb('0x16'));var config=require(_0xefcb('0x17'));var licenseUtil=require(_0xefcb('0x18'));var db=require(_0xefcb('0x19'))['db'];var extensions=require(_0xefcb('0x1a'));function respondWithStatusCode(_0x1b7f74,_0x5c430e){_0x5c430e=_0x5c430e||0xcc;return function(_0x5203ac){if(_0x5203ac){return _0x1b7f74['sendStatus'](_0x5c430e);}return _0x1b7f74[_0xefcb('0x1b')](_0x5c430e)[_0xefcb('0x1c')]();};}function respondWithResult(_0x3909cb,_0x169eb2){_0x169eb2=_0x169eb2||0xc8;return function(_0x16bcf8){if(_0x16bcf8){return _0x3909cb[_0xefcb('0x1b')](_0x169eb2)[_0xefcb('0x1d')](_0x16bcf8);}};}function respondWithFilteredResult(_0x326c3f,_0x14c614){return function(_0x4f439d){if(_0x4f439d){var _0x5e9c9d=typeof _0x14c614['offset']===_0xefcb('0x1e')&&typeof _0x14c614['limit']===_0xefcb('0x1e');var _0x211b26=_0x4f439d[_0xefcb('0x1f')];var _0x40e1a1=_0x5e9c9d?0x0:_0x14c614['offset'];var _0x3529c6=_0x5e9c9d?_0x4f439d[_0xefcb('0x1f')]:_0x14c614[_0xefcb('0x20')]+_0x14c614[_0xefcb('0x21')];var _0x4b81b6;if(_0x3529c6>=_0x211b26){_0x3529c6=_0x211b26;_0x4b81b6=0xc8;}else{_0x4b81b6=0xce;}_0x326c3f[_0xefcb('0x1b')](_0x4b81b6);return _0x326c3f[_0xefcb('0x22')](_0xefcb('0x23'),_0x40e1a1+'-'+_0x3529c6+'/'+_0x211b26)[_0xefcb('0x1d')](_0x4f439d);}return null;};}function patchUpdates(_0x15a694){return function(_0x558dd7){try{jsonpatch[_0xefcb('0x24')](_0x558dd7,_0x15a694,!![]);}catch(_0x57be26){return BPromise[_0xefcb('0x25')](_0x57be26);}return _0x558dd7[_0xefcb('0x26')]();};}function saveUpdates(_0x2d3744,_0x21693b){return function(_0x57ad00){if(_0x57ad00){return _0x57ad00[_0xefcb('0x27')](_0x2d3744)['then'](function(_0x183cb3){return _0x183cb3;});}return null;};}function removeEntity(_0x3f826f,_0x24d077){return function(_0x3c3a7a){if(_0x3c3a7a){return _0x3c3a7a['destroy']()[_0xefcb('0x28')](function(){var _0x4c0e3b=_0x3c3a7a[_0xefcb('0x29')]({'plain':!![]});var _0x267148='Intervals';return db[_0xefcb('0x2a')][_0xefcb('0x2b')]({'where':{'type':_0x267148,'resourceId':_0x4c0e3b['id']}})[_0xefcb('0x28')](function(){return _0x3c3a7a;});})['then'](function(){_0x3f826f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc14b59,_0x46907f){return function(_0x411b51){if(!_0x411b51){_0xc14b59['sendStatus'](0x194);}return _0x411b51;};}function handleError(_0x4152a3,_0xea58c2){_0xea58c2=_0xea58c2||0x1f4;return function(_0x5e67eb){logger[_0xefcb('0x2c')](_0x5e67eb[_0xefcb('0x2d')]);if(_0x5e67eb[_0xefcb('0x2e')]){delete _0x5e67eb[_0xefcb('0x2e')];}_0x4152a3[_0xefcb('0x1b')](_0xea58c2)[_0xefcb('0x2f')](_0x5e67eb);};}exports[_0xefcb('0x30')]=function(_0x42635d,_0x5f5ac3){var _0x507219={},_0x47ef79={},_0x5d6044={'count':0x0,'rows':[]};var _0x2dd25d=_[_0xefcb('0x31')](db[_0xefcb('0x32')][_0xefcb('0x33')],function(_0x11d7df){return{'name':_0x11d7df['fieldName'],'type':_0x11d7df[_0xefcb('0x34')][_0xefcb('0x35')]};});_0x47ef79[_0xefcb('0x36')]=_[_0xefcb('0x31')](_0x2dd25d,_0xefcb('0x2e'));_0x47ef79[_0xefcb('0x37')]=_[_0xefcb('0x38')](_0x42635d[_0xefcb('0x37')]);_0x47ef79['filters']=_[_0xefcb('0x39')](_0x47ef79[_0xefcb('0x36')],_0x47ef79[_0xefcb('0x37')]);_0x507219[_0xefcb('0x3a')]=_[_0xefcb('0x39')](_0x47ef79['model'],qs[_0xefcb('0x3b')](_0x42635d['query'][_0xefcb('0x3b')]));_0x507219[_0xefcb('0x3a')]=_0x507219[_0xefcb('0x3a')][_0xefcb('0x3c')]?_0x507219[_0xefcb('0x3a')]:_0x47ef79[_0xefcb('0x36')];if(!_0x42635d[_0xefcb('0x37')][_0xefcb('0x3d')](_0xefcb('0x3e'))){_0x507219[_0xefcb('0x21')]=qs[_0xefcb('0x21')](_0x42635d[_0xefcb('0x37')][_0xefcb('0x21')]);_0x507219[_0xefcb('0x20')]=qs[_0xefcb('0x20')](_0x42635d[_0xefcb('0x37')][_0xefcb('0x20')]);}_0x507219['order']=qs[_0xefcb('0x3f')](_0x42635d[_0xefcb('0x37')][_0xefcb('0x3f')]);_0x507219[_0xefcb('0x40')]=qs[_0xefcb('0x41')](_[_0xefcb('0x42')](_0x42635d['query'],_0x47ef79[_0xefcb('0x41')]),_0x2dd25d);if(_0x42635d[_0xefcb('0x37')][_0xefcb('0x43')]){_0x507219[_0xefcb('0x40')]=_['merge'](_0x507219[_0xefcb('0x40')],{'$or':_['map'](_0x2dd25d,function(_0x35c58e){if(_0x35c58e[_0xefcb('0x34')]!=='VIRTUAL'){var _0x56783b={};_0x56783b[_0x35c58e[_0xefcb('0x2e')]]={'$like':'%'+_0x42635d[_0xefcb('0x37')]['filter']+'%'};return _0x56783b;}})});}_0x507219=_[_0xefcb('0x44')]({},_0x507219,_0x42635d[_0xefcb('0x45')]);var _0x1fd593={'where':_0x507219[_0xefcb('0x40')]};return db[_0xefcb('0x32')][_0xefcb('0x1f')](_0x1fd593)[_0xefcb('0x28')](function(_0x3d8f7b){_0x5d6044[_0xefcb('0x1f')]=_0x3d8f7b;if(_0x42635d[_0xefcb('0x37')][_0xefcb('0x46')]){_0x507219[_0xefcb('0x47')]=[{'all':!![]}];}return db[_0xefcb('0x32')][_0xefcb('0x48')](_0x507219);})['then'](function(_0x54c6aa){_0x5d6044[_0xefcb('0x49')]=_0x54c6aa;return _0x5d6044;})[_0xefcb('0x28')](respondWithFilteredResult(_0x5f5ac3,_0x507219))[_0xefcb('0x4a')](handleError(_0x5f5ac3,null));};exports['show']=function(_0x51e2fd,_0x46ed62){var _0x1148f0={'raw':!![],'where':{'id':_0x51e2fd[_0xefcb('0x4b')]['id']}},_0x1cf476={};_0x1cf476[_0xefcb('0x36')]=_[_0xefcb('0x38')](db[_0xefcb('0x32')][_0xefcb('0x33')]);_0x1cf476[_0xefcb('0x37')]=_['keys'](_0x51e2fd[_0xefcb('0x37')]);_0x1cf476['filters']=_[_0xefcb('0x39')](_0x1cf476[_0xefcb('0x36')],_0x1cf476[_0xefcb('0x37')]);_0x1148f0[_0xefcb('0x3a')]=_[_0xefcb('0x39')](_0x1cf476['model'],qs[_0xefcb('0x3b')](_0x51e2fd['query'][_0xefcb('0x3b')]));_0x1148f0['attributes']=_0x1148f0[_0xefcb('0x3a')][_0xefcb('0x3c')]?_0x1148f0['attributes']:_0x1cf476[_0xefcb('0x36')];if(_0x51e2fd['query'][_0xefcb('0x46')]){_0x1148f0[_0xefcb('0x47')]=[{'all':!![]}];}_0x1148f0=_['merge']({},_0x1148f0,_0x51e2fd[_0xefcb('0x45')]);return db[_0xefcb('0x32')][_0xefcb('0x4c')](_0x1148f0)[_0xefcb('0x28')](handleEntityNotFound(_0x46ed62,null))[_0xefcb('0x28')](respondWithResult(_0x46ed62,null))[_0xefcb('0x4a')](handleError(_0x46ed62,null));};exports[_0xefcb('0x4d')]=function(_0x969f69,_0x145747){return db['Interval']['create'](_0x969f69['body'],{})[_0xefcb('0x28')](function(_0x5efe31){var _0x19ec76=_0x969f69[_0xefcb('0x4e')][_0xefcb('0x29')]({'plain':!![]});if(!_0x19ec76)throw new Error(_0xefcb('0x4f'));if(_0x19ec76[_0xefcb('0x50')]===_0xefcb('0x4e')){var _0xf993bb=_0x5efe31[_0xefcb('0x29')]({'plain':!![]});var _0x58b393=_0xefcb('0x51');return db[_0xefcb('0x52')][_0xefcb('0x4c')]({'where':{'name':_0x58b393,'userProfileId':_0x19ec76['userProfileId']},'raw':!![]})[_0xefcb('0x28')](function(_0x727149){if(_0x727149&&_0x727149[_0xefcb('0x53')]===0x0){return db[_0xefcb('0x2a')][_0xefcb('0x4d')]({'name':_0xf993bb[_0xefcb('0x2e')],'resourceId':_0xf993bb['id'],'type':_0x727149[_0xefcb('0x2e')],'sectionId':_0x727149['id']},{})['then'](function(){return _0x5efe31;});}else{return _0x5efe31;}})[_0xefcb('0x4a')](function(_0x3cf3c6){logger[_0xefcb('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cf3c6);throw _0x3cf3c6;});}return _0x5efe31;})['then'](respondWithResult(_0x145747,0xc9))[_0xefcb('0x4a')](handleError(_0x145747,null));};exports[_0xefcb('0x27')]=function(_0x35604d,_0x4e2a77){if(_0x35604d[_0xefcb('0x54')]['id']){delete _0x35604d[_0xefcb('0x54')]['id'];}return db[_0xefcb('0x32')][_0xefcb('0x4c')]({'where':{'id':_0x35604d['params']['id']}})[_0xefcb('0x28')](handleEntityNotFound(_0x4e2a77,null))['then'](saveUpdates(_0x35604d['body'],null))[_0xefcb('0x28')](respondWithResult(_0x4e2a77,null))[_0xefcb('0x4a')](handleError(_0x4e2a77,null));};exports[_0xefcb('0x2b')]=function(_0x42ddd9,_0x29e427){return db[_0xefcb('0x32')][_0xefcb('0x4c')]({'where':{'id':_0x42ddd9['params']['id']}})[_0xefcb('0x28')](handleEntityNotFound(_0x29e427,null))[_0xefcb('0x28')](removeEntity(_0x29e427,null))[_0xefcb('0x4a')](handleError(_0x29e427,null));};exports['addInterval']=function(_0x12e71f,_0x144e75,_0x34bb8a){if(_0x12e71f['body']['id']){delete _0x12e71f[_0xefcb('0x54')]['id'];}return db[_0xefcb('0x32')]['find']({'where':{'id':_0x12e71f[_0xefcb('0x4b')]['id']}})[_0xefcb('0x28')](handleEntityNotFound(_0x144e75,null))['then'](function(_0x245b28){if(_0x245b28){_0x12e71f[_0xefcb('0x54')][_0xefcb('0x55')]=_0x245b28['id'];return db[_0xefcb('0x32')][_0xefcb('0x4d')](_0x12e71f[_0xefcb('0x54')]);}})[_0xefcb('0x28')](respondWithResult(_0x144e75,null))[_0xefcb('0x4a')](handleError(_0x144e75,null));};exports['getIntervals']=function(_0x375cf0,_0x5beb75,_0x57390c){var _0x5c4fd0={};var _0x9e2c9a={};var _0x315c26;var _0x298ba3;return db[_0xefcb('0x32')][_0xefcb('0x56')]({'where':{'id':_0x375cf0[_0xefcb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5beb75,null))[_0xefcb('0x28')](function(_0x11002b){if(_0x11002b){_0x315c26=_0x11002b;_0x9e2c9a[_0xefcb('0x36')]=_[_0xefcb('0x38')](db[_0xefcb('0x32')][_0xefcb('0x33')]);_0x9e2c9a['query']=_[_0xefcb('0x38')](_0x375cf0[_0xefcb('0x37')]);_0x9e2c9a['filters']=_[_0xefcb('0x39')](_0x9e2c9a['model'],_0x9e2c9a['query']);_0x5c4fd0[_0xefcb('0x3a')]=_[_0xefcb('0x39')](_0x9e2c9a[_0xefcb('0x36')],qs['fields'](_0x375cf0[_0xefcb('0x37')][_0xefcb('0x3b')]));_0x5c4fd0[_0xefcb('0x3a')]=_0x5c4fd0[_0xefcb('0x3a')][_0xefcb('0x3c')]?_0x5c4fd0['attributes']:_0x9e2c9a['model'];_0x5c4fd0[_0xefcb('0x57')]=qs[_0xefcb('0x3f')](_0x375cf0[_0xefcb('0x37')][_0xefcb('0x3f')]);_0x5c4fd0['where']=qs['filters'](_[_0xefcb('0x42')](_0x375cf0[_0xefcb('0x37')],_0x9e2c9a[_0xefcb('0x41')]));if(_0x375cf0[_0xefcb('0x37')][_0xefcb('0x43')]){_0x5c4fd0[_0xefcb('0x40')]=_[_0xefcb('0x44')](_0x5c4fd0[_0xefcb('0x40')],{'$or':_[_0xefcb('0x31')](_0x5c4fd0[_0xefcb('0x3a')],function(_0x21607c){var _0x54c488={};_0x54c488[_0x21607c]={'$like':'%'+_0x375cf0[_0xefcb('0x37')][_0xefcb('0x43')]+'%'};return _0x54c488;})});}_0x5c4fd0=_[_0xefcb('0x44')]({},_0x5c4fd0,_0x375cf0[_0xefcb('0x45')]);return _0x315c26['getIntervals'](_0x5c4fd0);}})[_0xefcb('0x28')](function(_0x376f56){if(_0x376f56){_0x298ba3=_0x376f56[_0xefcb('0x3c')];if(!_0x375cf0[_0xefcb('0x37')][_0xefcb('0x3d')](_0xefcb('0x3e'))){_0x5c4fd0['limit']=qs[_0xefcb('0x21')](_0x375cf0[_0xefcb('0x37')][_0xefcb('0x21')]);_0x5c4fd0['offset']=qs[_0xefcb('0x20')](_0x375cf0[_0xefcb('0x37')]['offset']);}return _0x315c26[_0xefcb('0x58')](_0x5c4fd0);}})[_0xefcb('0x28')](function(_0x1c3bca){if(_0x1c3bca){return _0x1c3bca?{'count':_0x298ba3,'rows':_0x1c3bca}:null;}})['then'](respondWithResult(_0x5beb75,null))[_0xefcb('0x4a')](handleError(_0x5beb75,null));};exports[_0xefcb('0x59')]=function(_0x335270,_0x31eb43,_0x324ac4){return db[_0xefcb('0x32')][_0xefcb('0x56')]({'where':{'id':_0x335270[_0xefcb('0x4b')]['id']}})[_0xefcb('0x28')](handleEntityNotFound(_0x31eb43,null))['then'](function(_0x3c1005){if(_0x3c1005){return db[_0xefcb('0x5a')][_0xefcb('0x5b')](function(_0xe936bf){return db[_0xefcb('0x32')][_0xefcb('0x2b')]({'where':{'IntervalId':_0x335270[_0xefcb('0x4b')]['id']},'transaction':_0xe936bf})[_0xefcb('0x28')](function(_0x2e7051){var _0x40ad09=_[_0xefcb('0x31')](_0x335270['body'],function(_0x9c52c9){delete _0x9c52c9['id'];_0x9c52c9['IntervalId']=_0x335270['params']['id'];return _0x9c52c9;});return db[_0xefcb('0x32')]['bulkCreate'](_0x40ad09,{'transaction':_0xe936bf});});})['then'](function(){return db[_0xefcb('0x32')][_0xefcb('0x48')]({'where':{'IntervalId':_0x335270[_0xefcb('0x4b')]['id']}});});}})[_0xefcb('0x28')](respondWithResult(_0x31eb43,null))['catch'](handleError(_0x31eb43,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1070ecd..8f68790 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 _0x7cdb=['interval','string','getIntervals','all','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite'];(function(_0x267335,_0x378e44){var _0x201607=function(_0xc23b53){while(--_0xc23b53){_0x267335['push'](_0x267335['shift']());}};_0x201607(++_0x378e44);}(_0x7cdb,0x14b));var _0xb7cd=function(_0x460096,_0x255d37){_0x460096=_0x460096-0x0;var _0x24fc3c=_0x7cdb[_0x460096];return _0x24fc3c;};'use strict';var attributes=require(_0xb7cd('0x0'));var extensions=require(_0xb7cd('0x1'));var iftime=require(_0xb7cd('0x2'))[_0xb7cd('0x3')];module[_0xb7cd('0x4')]=function(_0x2e80c3){return _0x2e80c3[_0xb7cd('0x5')](_0xb7cd('0x6'),attributes,{'tableName':_0xb7cd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2777a5){extensions[_0xb7cd('0x8')](_0x2e80c3,_0x2777a5);},'afterBulkCreate':function(_0x7e61e9,_0xfe1859,_0x5ddbe5){_0x5ddbe5();extensions[_0xb7cd('0x8')](_0x2e80c3,_0x7e61e9[0x0]);},'afterUpdate':function(_0x1cd2d0){extensions[_0xb7cd('0x8')](_0x2e80c3,_0x1cd2d0);},'afterDestroy':function(_0x1c4e16){extensions['rewrite'](_0x2e80c3,_0x1c4e16);}},'instanceMethods':{'ifTime':function(_0x24c4f9=undefined,_0xd11b44=new Date()){if(typeof this[_0xb7cd('0x9')]===_0xb7cd('0xa')){return iftime(this[_0xb7cd('0x9')],_0x24c4f9,_0xd11b44);}else{return this[_0xb7cd('0xb')]()['then'](function(_0xe12582){return Promise[_0xb7cd('0xc')](_0xe12582[_0xb7cd('0xd')](function(_0x1510fa){return _0x1510fa[_0xb7cd('0xe')](_0x24c4f9,_0xd11b44);}));})[_0xb7cd('0xf')](function(_0x2e74df){return _0x2e74df[_0xb7cd('0x10')](function(_0x25877b,_0x58b145){return _0x25877b||_0x58b145;},![]);});}}}});}; \ No newline at end of file +var _0x691a=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','rewrite','interval','string','all','map','then','reduce','./interval.attributes'];(function(_0x2676d9,_0x5bf196){var _0x3d3f0b=function(_0x2c0bc2){while(--_0x2c0bc2){_0x2676d9['push'](_0x2676d9['shift']());}};_0x3d3f0b(++_0x5bf196);}(_0x691a,0xfb));var _0xa691=function(_0xf4656,_0x40c0d0){_0xf4656=_0xf4656-0x0;var _0x3006b7=_0x691a[_0xf4656];return _0x3006b7;};'use strict';var attributes=require(_0xa691('0x0'));var extensions=require(_0xa691('0x1'));var iftime=require(_0xa691('0x2'))[_0xa691('0x3')];module[_0xa691('0x4')]=function(_0x5c35da){return _0x5c35da[_0xa691('0x5')](_0xa691('0x6'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x88a82c){extensions['rewrite'](_0x5c35da,_0x88a82c);},'afterBulkCreate':function(_0x45eeda,_0x262caf,_0x1ead77){_0x1ead77();extensions['rewrite'](_0x5c35da,_0x45eeda[0x0]);},'afterUpdate':function(_0x3c4b55){extensions[_0xa691('0x7')](_0x5c35da,_0x3c4b55);},'afterDestroy':function(_0x14218b){extensions[_0xa691('0x7')](_0x5c35da,_0x14218b);}},'instanceMethods':{'ifTime':function(_0x3a2141=undefined,_0x234233=new Date()){if(typeof this[_0xa691('0x8')]===_0xa691('0x9')){return iftime(this[_0xa691('0x8')],_0x3a2141,_0x234233);}else{return this['getIntervals']()['then'](function(_0x41a438){return Promise[_0xa691('0xa')](_0x41a438[_0xa691('0xb')](function(_0x5c712a){return _0x5c712a['ifTime'](_0x3a2141,_0x234233);}));})[_0xa691('0xc')](function(_0x4273b8){return _0x4273b8[_0xa691('0xd')](function(_0x427a1d,_0x34b760){return _0x427a1d||_0x34b760;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fd1da47..409bcf0 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 _0xff03=['util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','find','ShowInterval','message','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','lodash'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xff03,0x133));var _0x3ff0=function(_0x120746,_0xcd81b7){_0x120746=_0x120746-0x0;var _0x1de0e6=_0xff03[_0x120746];return _0x1de0e6;};'use strict';var _=require(_0x3ff0('0x0'));var util=require(_0x3ff0('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x3ff0('0x2'))[_0x3ff0('0x3')];var logger=require(_0x3ff0('0x4'))(_0x3ff0('0x5'));exports[_0x3ff0('0x6')]=function(_0x1a7c9d){var _0x216876=this;return new Promise(function(_0x2f253d,_0x27d78e){return db[_0x3ff0('0x7')][_0x3ff0('0x8')]({'raw':_0x1a7c9d[_0x3ff0('0x9')]?_0x1a7c9d[_0x3ff0('0x9')][_0x3ff0('0xa')]===undefined?!![]:![]:!![],'where':_0x1a7c9d[_0x3ff0('0x9')]?_0x1a7c9d['options'][_0x3ff0('0xb')]||null:null,'attributes':_0x1a7c9d['options']?_0x1a7c9d[_0x3ff0('0x9')][_0x3ff0('0xc')]||null:null,'limit':_0x1a7c9d[_0x3ff0('0x9')]?_0x1a7c9d['options'][_0x3ff0('0xd')]||null:null,'include':_0x1a7c9d[_0x3ff0('0x9')]?_0x1a7c9d[_0x3ff0('0x9')][_0x3ff0('0xe')]?_['map'](_0x1a7c9d[_0x3ff0('0x9')]['include'],function(_0x5b8df5){return{'model':db[_0x5b8df5[_0x3ff0('0xf')]],'as':_0x5b8df5['as'],'attributes':_0x5b8df5[_0x3ff0('0xc')],'include':_0x5b8df5['include']?_[_0x3ff0('0x10')](_0x5b8df5[_0x3ff0('0xe')],function(_0x44ad87){return{'model':db[_0x44ad87[_0x3ff0('0xf')]],'as':_0x44ad87['as'],'attributes':_0x44ad87['attributes'],'include':_0x44ad87[_0x3ff0('0xe')]?_['map'](_0x44ad87[_0x3ff0('0xe')],function(_0x5ed98c){return{'model':db[_0x5ed98c[_0x3ff0('0xf')]],'as':_0x5ed98c['as'],'attributes':_0x5ed98c[_0x3ff0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3ff0('0x11')](function(_0x545a94){logger[_0x3ff0('0x12')](_0x3ff0('0x6'),_0x1a7c9d);logger[_0x3ff0('0x13')](_0x3ff0('0x6'),_0x1a7c9d,JSON[_0x3ff0('0x14')](_0x545a94));_0x2f253d(_0x545a94);})[_0x3ff0('0x15')](function(_0x2f9432){logger[_0x3ff0('0x16')](_0x3ff0('0x6'),_0x2f9432['message'],_0x1a7c9d);_0x27d78e(_0x216876['error'](0x1f4,_0x2f9432['message']));});});};exports['ShowInterval']=function(_0x465880){var _0x20bc19=this;return new Promise(function(_0x4dd60e,_0x3a0d24){return db[_0x3ff0('0x7')][_0x3ff0('0x17')]({'raw':_0x465880[_0x3ff0('0x9')]?_0x465880[_0x3ff0('0x9')][_0x3ff0('0xa')]===undefined?!![]:![]:!![],'where':_0x465880['options']?_0x465880[_0x3ff0('0x9')]['where']||null:null,'attributes':_0x465880[_0x3ff0('0x9')]?_0x465880[_0x3ff0('0x9')][_0x3ff0('0xc')]||null:null,'include':_0x465880[_0x3ff0('0x9')]?_0x465880[_0x3ff0('0x9')]['include']?_[_0x3ff0('0x10')](_0x465880[_0x3ff0('0x9')]['include'],function(_0x4a0255){return{'model':db[_0x4a0255[_0x3ff0('0xf')]],'as':_0x4a0255['as'],'attributes':_0x4a0255[_0x3ff0('0xc')],'include':_0x4a0255['include']?_['map'](_0x4a0255['include'],function(_0x3a03a1){return{'model':db[_0x3a03a1['model']],'as':_0x3a03a1['as'],'attributes':_0x3a03a1[_0x3ff0('0xc')],'include':_0x3a03a1['include']?_[_0x3ff0('0x10')](_0x3a03a1[_0x3ff0('0xe')],function(_0x56aa90){return{'model':db[_0x56aa90[_0x3ff0('0xf')]],'as':_0x56aa90['as'],'attributes':_0x56aa90['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ff0('0x11')](function(_0xf5a85){logger[_0x3ff0('0x12')](_0x3ff0('0x18'),_0x465880);logger[_0x3ff0('0x13')](_0x3ff0('0x18'),_0x465880,JSON[_0x3ff0('0x14')](_0xf5a85));_0x4dd60e(_0xf5a85);})[_0x3ff0('0x15')](function(_0x322573){logger[_0x3ff0('0x16')](_0x3ff0('0x18'),_0x322573['message'],_0x465880);_0x3a0d24(_0x20bc19[_0x3ff0('0x16')](0x1f4,_0x322573[_0x3ff0('0x19')]));});});};function checkArrayOfIntervals(_0x2f209d,_0x518738){var _0x1d112d=[];return db[_0x3ff0('0x7')][_0x3ff0('0x8')]({'where':{'id':_0x2f209d}})[_0x3ff0('0x11')](function(_0x262638){_0x1d112d=_0x262638;return Promise[_0x3ff0('0x1a')](_0x1d112d['map'](function(_0x127400){return _0x127400['ifTime'](_0x518738);}));})['then'](function(_0x889a83){var _0x5fae85=_0x889a83[_0x3ff0('0x1b')](function(_0x45421d,_0x5eb7b9){return _0x45421d||_0x5eb7b9;},![]);logger[_0x3ff0('0x12')](util[_0x3ff0('0x1c')](_0x3ff0('0x1d'),_0x1d112d['map'](function(_0x1e96b4){return _0x1e96b4[_0x3ff0('0x1e')];})['join'](',\x20'),_0x1d112d[_0x3ff0('0x10')](function(_0x4c76e6){return _0x4c76e6['id'];})[_0x3ff0('0x1f')](',\x20')));return _0x5fae85;});}function checkSingleInterval(_0x7a8e06,_0x32e4ee){return db[_0x3ff0('0x7')][_0x3ff0('0x20')](_0x7a8e06)[_0x3ff0('0x11')](function(_0xebfe9c){if(_0xebfe9c){logger[_0x3ff0('0x12')](util['format'](_0x3ff0('0x21'),_0xebfe9c[_0x3ff0('0x1e')],_0xebfe9c['id']));return _0xebfe9c[_0x3ff0('0x22')](_0x32e4ee);}});}exports[_0x3ff0('0x23')]=function(_0x557426){var _0x2110f3=_0x557426[_0x3ff0('0x24')];var _0x2607e4=Array[_0x3ff0('0x25')](_0x557426[_0x3ff0('0x26')])?_0x557426['intervals']:typeof _0x557426[_0x3ff0('0x26')]===_0x3ff0('0x27')?[_0x557426['intervals']]:[];var _0x2eff29=_0x557426['timezone']||undefined;var _0x4f0eee=![];if(_0x2607e4[_0x3ff0('0x28')]){logger[_0x3ff0('0x12')](util[_0x3ff0('0x1c')](_0x3ff0('0x29'),_0x2607e4[_0x3ff0('0x1f')](';\x20')));}if(_0x2eff29){logger[_0x3ff0('0x12')](util[_0x3ff0('0x1c')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2eff29));}logger[_0x3ff0('0x13')](_0x3ff0('0x2a'),_0x4f0eee);logger[_0x3ff0('0x2b')]('IntervalIftime',_0x557426);return Promise['resolve']()[_0x3ff0('0x11')](function(){if(Array[_0x3ff0('0x25')](_0x2110f3)){return checkArrayOfIntervals(_0x2110f3,_0x2eff29);}else if(_0x2110f3){return checkSingleInterval(_0x2110f3,_0x2eff29);}})[_0x3ff0('0x11')](function(_0x4a5e6e){var _0xbd5540=_0x2607e4[_0x3ff0('0x1b')](function(_0x15c370,_0x5c6137){return _0x15c370||iftime(_0x5c6137,_0x2eff29);},![]);_0x4f0eee=_0x4a5e6e||_0xbd5540;return _0x4f0eee;})[_0x3ff0('0x15')](function(_0x108093){logger[_0x3ff0('0x16')](_0x3ff0('0x23'),_0x557426,_0x108093);throw this[_0x3ff0('0x16')](0x1f4,_0x108093['message']);});}; \ No newline at end of file +var _0x8434=['message','find','where','ShowInterval','debug','all','ifTime','reduce','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','format','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','then','info','stringify','catch','error'];(function(_0x1ae1f6,_0x52929d){var _0x13f3ee=function(_0x3246db){while(--_0x3246db){_0x1ae1f6['push'](_0x1ae1f6['shift']());}};_0x13f3ee(++_0x52929d);}(_0x8434,0xc8));var _0x4843=function(_0x59e890,_0x39d2cf){_0x59e890=_0x59e890-0x0;var _0x1a91b3=_0x8434[_0x59e890];return _0x1a91b3;};'use strict';var _=require(_0x4843('0x0'));var util=require(_0x4843('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x4843('0x2'))[_0x4843('0x3')];var logger=require(_0x4843('0x4'))('rpc');exports[_0x4843('0x5')]=function(_0x159bc6){var _0x53035f=this;return new Promise(function(_0x1cbd4a,_0x55dfa4){return db[_0x4843('0x6')][_0x4843('0x7')]({'raw':_0x159bc6['options']?_0x159bc6[_0x4843('0x8')][_0x4843('0x9')]===undefined?!![]:![]:!![],'where':_0x159bc6[_0x4843('0x8')]?_0x159bc6[_0x4843('0x8')]['where']||null:null,'attributes':_0x159bc6['options']?_0x159bc6['options'][_0x4843('0xa')]||null:null,'limit':_0x159bc6['options']?_0x159bc6[_0x4843('0x8')][_0x4843('0xb')]||null:null,'include':_0x159bc6['options']?_0x159bc6[_0x4843('0x8')][_0x4843('0xc')]?_[_0x4843('0xd')](_0x159bc6['options'][_0x4843('0xc')],function(_0x315018){return{'model':db[_0x315018['model']],'as':_0x315018['as'],'attributes':_0x315018[_0x4843('0xa')],'include':_0x315018['include']?_['map'](_0x315018[_0x4843('0xc')],function(_0x824a3){return{'model':db[_0x824a3[_0x4843('0xe')]],'as':_0x824a3['as'],'attributes':_0x824a3[_0x4843('0xa')],'include':_0x824a3[_0x4843('0xc')]?_[_0x4843('0xd')](_0x824a3[_0x4843('0xc')],function(_0x4f6b53){return{'model':db[_0x4f6b53[_0x4843('0xe')]],'as':_0x4f6b53['as'],'attributes':_0x4f6b53[_0x4843('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4843('0xf')](function(_0x27f8a9){logger[_0x4843('0x10')]('GetInterval',_0x159bc6);logger['debug'](_0x4843('0x5'),_0x159bc6,JSON[_0x4843('0x11')](_0x27f8a9));_0x1cbd4a(_0x27f8a9);})[_0x4843('0x12')](function(_0x32053e){logger[_0x4843('0x13')]('GetInterval',_0x32053e[_0x4843('0x14')],_0x159bc6);_0x55dfa4(_0x53035f[_0x4843('0x13')](0x1f4,_0x32053e[_0x4843('0x14')]));});});};exports['ShowInterval']=function(_0x3b3873){var _0x1a690c=this;return new Promise(function(_0x445ee4,_0x47a990){return db[_0x4843('0x6')][_0x4843('0x15')]({'raw':_0x3b3873[_0x4843('0x8')]?_0x3b3873[_0x4843('0x8')][_0x4843('0x9')]===undefined?!![]:![]:!![],'where':_0x3b3873[_0x4843('0x8')]?_0x3b3873['options'][_0x4843('0x16')]||null:null,'attributes':_0x3b3873[_0x4843('0x8')]?_0x3b3873['options'][_0x4843('0xa')]||null:null,'include':_0x3b3873[_0x4843('0x8')]?_0x3b3873[_0x4843('0x8')][_0x4843('0xc')]?_[_0x4843('0xd')](_0x3b3873[_0x4843('0x8')][_0x4843('0xc')],function(_0x112e6a){return{'model':db[_0x112e6a[_0x4843('0xe')]],'as':_0x112e6a['as'],'attributes':_0x112e6a[_0x4843('0xa')],'include':_0x112e6a['include']?_[_0x4843('0xd')](_0x112e6a[_0x4843('0xc')],function(_0x2bba0b){return{'model':db[_0x2bba0b['model']],'as':_0x2bba0b['as'],'attributes':_0x2bba0b['attributes'],'include':_0x2bba0b[_0x4843('0xc')]?_['map'](_0x2bba0b['include'],function(_0x4a30af){return{'model':db[_0x4a30af[_0x4843('0xe')]],'as':_0x4a30af['as'],'attributes':_0x4a30af[_0x4843('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4843('0xf')](function(_0x19275d){logger[_0x4843('0x10')](_0x4843('0x17'),_0x3b3873);logger[_0x4843('0x18')]('ShowInterval',_0x3b3873,JSON[_0x4843('0x11')](_0x19275d));_0x445ee4(_0x19275d);})[_0x4843('0x12')](function(_0x1c3506){logger[_0x4843('0x13')]('ShowInterval',_0x1c3506[_0x4843('0x14')],_0x3b3873);_0x47a990(_0x1a690c[_0x4843('0x13')](0x1f4,_0x1c3506[_0x4843('0x14')]));});});};function checkArrayOfIntervals(_0x347707,_0x338994){var _0x2b6121=[];return db[_0x4843('0x6')]['findAll']({'where':{'id':_0x347707}})[_0x4843('0xf')](function(_0x5cc05d){_0x2b6121=_0x5cc05d;return Promise[_0x4843('0x19')](_0x2b6121['map'](function(_0x2588b5){return _0x2588b5[_0x4843('0x1a')](_0x338994);}));})[_0x4843('0xf')](function(_0x1a52f0){var _0x29de8f=_0x1a52f0[_0x4843('0x1b')](function(_0x972b55,_0x564991){return _0x972b55||_0x564991;},![]);logger[_0x4843('0x10')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2b6121[_0x4843('0xd')](function(_0x39b88f){return _0x39b88f[_0x4843('0x1c')];})[_0x4843('0x1d')](',\x20'),_0x2b6121['map'](function(_0x889243){return _0x889243['id'];})[_0x4843('0x1d')](',\x20')));return _0x29de8f;});}function checkSingleInterval(_0xad5d7a,_0x3dd36b){return db['Interval'][_0x4843('0x1e')](_0xad5d7a)[_0x4843('0xf')](function(_0x450bce){if(_0x450bce){logger[_0x4843('0x10')](util['format'](_0x4843('0x1f'),_0x450bce[_0x4843('0x1c')],_0x450bce['id']));return _0x450bce[_0x4843('0x1a')](_0x3dd36b);}});}exports[_0x4843('0x20')]=function(_0x332126){var _0x602673=_0x332126[_0x4843('0x21')];var _0x348e41=Array[_0x4843('0x22')](_0x332126[_0x4843('0x23')])?_0x332126[_0x4843('0x23')]:typeof _0x332126['intervals']===_0x4843('0x24')?[_0x332126['intervals']]:[];var _0x5e1ef6=_0x332126[_0x4843('0x25')]||undefined;var _0x329d22=![];if(_0x348e41['length']){logger['info'](util['format'](_0x4843('0x26'),_0x348e41[_0x4843('0x1d')](';\x20')));}if(_0x5e1ef6){logger[_0x4843('0x10')](util[_0x4843('0x27')](_0x4843('0x28'),_0x5e1ef6));}logger['debug'](_0x4843('0x29'),_0x329d22);logger[_0x4843('0x2a')](_0x4843('0x20'),_0x332126);return Promise[_0x4843('0x2b')]()[_0x4843('0xf')](function(){if(Array[_0x4843('0x22')](_0x602673)){return checkArrayOfIntervals(_0x602673,_0x5e1ef6);}else if(_0x602673){return checkSingleInterval(_0x602673,_0x5e1ef6);}})[_0x4843('0xf')](function(_0x5b80c9){var _0x4baca2=_0x348e41['reduce'](function(_0x3a95ac,_0x56a150){return _0x3a95ac||iftime(_0x56a150,_0x5e1ef6);},![]);_0x329d22=_0x5b80c9||_0x4baca2;return _0x329d22;})[_0x4843('0x12')](function(_0x25cc7e){logger['error'](_0x4843('0x20'),_0x332126,_0x25cc7e);throw this[_0x4843('0x13')](0x1f4,_0x25cc7e[_0x4843('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 46a3451..934ba6e 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x472eb3,_0x21997b){var _0x2816cb=function(_0x38e0cf){while(--_0x38e0cf){_0x472eb3['push'](_0x472eb3['shift']());}};_0x2816cb(++_0x21997b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a4016,_0x119416){_0x2a4016=_0x2a4016-0x0;var _0x2d0f99=_0x5f2f[_0x2a4016];return _0x2d0f99;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d69fd76..ba52d94 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 _0xfbf4=['remoteAddress','body','bluebird','https','../../config/logger','api','support','MOTGUI','summary','Report','\x20from\x20','stringify','Bug','fields','email','customfield_11501','oldToken','customfield_11503','name','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','statusCode','json','parse','error','status','api.jira','write','openIssue','send','x-forwarded-for','socket','connection'];(function(_0x1ded8d,_0x2cc8ad){var _0x116c74=function(_0x2dc1ba){while(--_0x2dc1ba){_0x1ded8d['push'](_0x1ded8d['shift']());}};_0x116c74(++_0x2cc8ad);}(_0xfbf4,0xf8));var _0x4fbf=function(_0x4bd0cf,_0x2c270f){_0x4bd0cf=_0x4bd0cf-0x0;var _0x43c6bd=_0xfbf4[_0x4bd0cf];return _0x43c6bd;};'use strict';var BPromise=require(_0x4fbf('0x0'));var https=require(_0x4fbf('0x1'));var logger=require(_0x4fbf('0x2'))(_0x4fbf('0x3'));var USERNAME=_0x4fbf('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4748c3,_0x2461c9){var _0x4cca2a={'fields':{'project':{'key':_0x4748c3['key']||_0x4fbf('0x5')},'summary':(_0x4748c3[_0x4fbf('0x6')]||_0x4fbf('0x7'))+_0x4fbf('0x8')+_0x4748c3['ip'],'description':_0x4748c3['description']||JSON[_0x4fbf('0x9')](_0x4748c3),'issuetype':{'name':_0x4748c3['issuetype']||_0x4fbf('0xa')}}};_0x4cca2a[_0x4fbf('0xb')]['customfield_11500']=_0x4748c3[_0x4fbf('0xc')];_0x4cca2a['fields'][_0x4fbf('0xd')]=_0x4748c3[_0x4fbf('0xe')];_0x4cca2a['fields']['customfield_11502']=_0x4748c3['newToken'];_0x4cca2a[_0x4fbf('0xb')][_0x4fbf('0xf')]=_0x4748c3[_0x4fbf('0x10')];_0x4cca2a['fields']['customfield_11504']=_0x4748c3[_0x4fbf('0x11')];_0x4cca2a[_0x4fbf('0xb')]['customfield_10102']=_0x4748c3['ip'];var _0x2f0f15={'host':_0x4fbf('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x4fbf('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x4fbf('0x14'),'Authorization':_0x4fbf('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x4fbf('0x16')](_0x4fbf('0x17'))}};var _0x47c72c=JSON[_0x4fbf('0x9')](_0x4cca2a);var _0x2dd57a=https[_0x4fbf('0x18')](_0x2f0f15,function(_0x527953){_0x527953['setEncoding'](_0x4fbf('0x19'));var _0x255075='';_0x527953['on'](_0x4fbf('0x1a'),function(_0x35ffd6){_0x255075+=_0x35ffd6;});_0x527953['on']('end',function(){if(_0x2461c9){return _0x2461c9['status'](_0x527953[_0x4fbf('0x1b')])[_0x4fbf('0x1c')](JSON[_0x4fbf('0x1d')](_0x255075));}});});_0x2dd57a['on'](_0x4fbf('0x1e'),function(_0x89d50b){if(_0x2461c9){return _0x2461c9[_0x4fbf('0x1f')](0x1f4)[_0x4fbf('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x4fbf('0x20')}]});}});_0x2dd57a[_0x4fbf('0x21')](_0x47c72c);_0x2dd57a['end']();}exports[_0x4fbf('0x22')]=openIssue;exports[_0x4fbf('0x23')]=function(_0x1da20e,_0x38d8f7){_0x1da20e['body']['ip']=_0x1da20e['headers'][_0x4fbf('0x24')]||_0x1da20e['connection']['remoteAddress']||_0x1da20e[_0x4fbf('0x25')]['remoteAddress']||_0x1da20e[_0x4fbf('0x26')][_0x4fbf('0x25')][_0x4fbf('0x27')];return openIssue(_0x1da20e[_0x4fbf('0x28')],_0x38d8f7);}; \ No newline at end of file +var _0x7422=['customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','utf8','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','email','fields'];(function(_0x409743,_0x3d997f){var _0x2dd6de=function(_0x28a664){while(--_0x28a664){_0x409743['push'](_0x409743['shift']());}};_0x2dd6de(++_0x3d997f);}(_0x7422,0x17d));var _0x2742=function(_0x1de9d7,_0x19bb90){_0x1de9d7=_0x1de9d7-0x0;var _0x14c823=_0x7422[_0x1de9d7];return _0x14c823;};'use strict';var BPromise=require(_0x2742('0x0'));var https=require(_0x2742('0x1'));var logger=require(_0x2742('0x2'))('api');var USERNAME=_0x2742('0x3');var PASSWORD=_0x2742('0x4');function openIssue(_0x56d39f,_0x5889be){var _0x4b3183={'fields':{'project':{'key':_0x56d39f[_0x2742('0x5')]||_0x2742('0x6')},'summary':(_0x56d39f[_0x2742('0x7')]||_0x2742('0x8'))+'\x20from\x20'+_0x56d39f['ip'],'description':_0x56d39f[_0x2742('0x9')]||JSON[_0x2742('0xa')](_0x56d39f),'issuetype':{'name':_0x56d39f[_0x2742('0xb')]||_0x2742('0xc')}}};_0x4b3183['fields']['customfield_11500']=_0x56d39f[_0x2742('0xd')];_0x4b3183[_0x2742('0xe')][_0x2742('0xf')]=_0x56d39f[_0x2742('0x10')];_0x4b3183[_0x2742('0xe')]['customfield_11502']=_0x56d39f[_0x2742('0x11')];_0x4b3183[_0x2742('0xe')][_0x2742('0x12')]=_0x56d39f['name'];_0x4b3183[_0x2742('0xe')][_0x2742('0x13')]=_0x56d39f['reason'];_0x4b3183[_0x2742('0xe')][_0x2742('0x14')]=_0x56d39f['ip'];var _0x243fa0={'host':_0x2742('0x15'),'port':0x1bb,'path':_0x2742('0x16'),'method':_0x2742('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x2742('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2742('0x19')](_0x2742('0x1a'))}};var _0x79fd37=JSON[_0x2742('0xa')](_0x4b3183);var _0x2e4318=https['request'](_0x243fa0,function(_0x545f62){_0x545f62[_0x2742('0x1b')](_0x2742('0x1c'));var _0x265ee7='';_0x545f62['on']('data',function(_0x3801ff){_0x265ee7+=_0x3801ff;});_0x545f62['on']('end',function(){if(_0x5889be){return _0x5889be[_0x2742('0x1d')](_0x545f62['statusCode'])[_0x2742('0x1e')](JSON[_0x2742('0x1f')](_0x265ee7));}});});_0x2e4318['on'](_0x2742('0x20'),function(_0x24ffad){if(_0x5889be){return _0x5889be[_0x2742('0x1d')](0x1f4)[_0x2742('0x1e')]({'errors':[{'message':_0x2742('0x21'),'type':_0x2742('0x22')}]});}});_0x2e4318[_0x2742('0x23')](_0x79fd37);_0x2e4318['end']();}exports[_0x2742('0x24')]=openIssue;exports[_0x2742('0x25')]=function(_0x1114f2,_0x2300d0){_0x1114f2[_0x2742('0x26')]['ip']=_0x1114f2[_0x2742('0x27')][_0x2742('0x28')]||_0x1114f2[_0x2742('0x29')]['remoteAddress']||_0x1114f2['socket'][_0x2742('0x2a')]||_0x1114f2[_0x2742('0x29')][_0x2742('0x2b')]['remoteAddress'];return openIssue(_0x1114f2[_0x2742('0x26')],_0x2300d0);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 05c6323..4cf3987 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 _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x1ca637,_0x1f28f9){var _0x396e8a=function(_0x17bc55){while(--_0x17bc55){_0x1ca637['push'](_0x1ca637['shift']());}};_0x396e8a(++_0x1f28f9);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4143ec,_0x3cd8c3){_0x4143ec=_0x4143ec-0x0;var _0x46fcf4=_0x0a9a[_0x4143ec];return _0x46fcf4;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x4046f2,_0x2b8121){var _0x443f9d=function(_0x21c241){while(--_0x21c241){_0x4046f2['push'](_0x4046f2['shift']());}};_0x443f9d(++_0x2b8121);}(_0x6324,0x142));var _0x4632=function(_0x30fae7,_0x562858){_0x30fae7=_0x30fae7-0x0;var _0x1dbd52=_0x6324[_0x30fae7];return _0x1dbd52;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 865731e..5ccc960 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x48b4dd,_0x18fc21){_0x48b4dd=_0x48b4dd-0x0;var _0x14617e=_0x7a54[_0x48b4dd];return _0x14617e;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x3bb9b0,_0x3d2bcb){_0x3bb9b0=_0x3bb9b0-0x0;var _0x57c50b=_0x7a54[_0x3bb9b0];return _0x57c50b;};'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 700187d..6a02d66 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 _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','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','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xf006,0x146));var _0x6f00=function(_0x487510,_0x6fa22e){_0x487510=_0x487510-0x0;var _0x21c61f=_0xf006[_0x487510];return _0x21c61f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['JscriptyAnswerReport'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['JscriptyAnswerReport'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['JscriptyAnswerReport'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['JscriptyAnswerReport'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,null));}; \ No newline at end of file +var _0x22da=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x22da,0x80));var _0xa22d=function(_0x1cebd2,_0xd60e90){_0x1cebd2=_0x1cebd2-0x0;var _0x268404=_0x22da[_0x1cebd2];return _0x268404;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa22d('0x0'));var jsonpatch=require(_0xa22d('0x1'));var rp=require(_0xa22d('0x2'));var moment=require(_0xa22d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa22d('0x4'));var util=require(_0xa22d('0x5'));var path=require(_0xa22d('0x6'));var sox=require(_0xa22d('0x7'));var csv=require('to-csv');var ejs=require(_0xa22d('0x8'));var fs=require('fs');var fs_extra=require(_0xa22d('0x9'));var _=require('lodash');var squel=require(_0xa22d('0xa'));var crypto=require(_0xa22d('0xb'));var jsforce=require(_0xa22d('0xc'));var deskjs=require(_0xa22d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa22d('0xe'));var Redis=require(_0xa22d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa22d('0x10'));var as=require(_0xa22d('0x11'));var hardwareService=require(_0xa22d('0x12'));var logger=require(_0xa22d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa22d('0x14'));var licenseUtil=require(_0xa22d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184309,_0x515d6c){_0x515d6c=_0x515d6c||0xcc;return function(_0x983182){if(_0x983182){return _0x184309[_0xa22d('0x16')](_0x515d6c);}return _0x184309[_0xa22d('0x17')](_0x515d6c)['end']();};}function respondWithResult(_0x174a3f,_0x20d7f3){_0x20d7f3=_0x20d7f3||0xc8;return function(_0xc0d11d){if(_0xc0d11d){return _0x174a3f[_0xa22d('0x17')](_0x20d7f3)[_0xa22d('0x18')](_0xc0d11d);}};}function respondWithFilteredResult(_0x4dfa44,_0x132b1d){return function(_0x1b8627){if(_0x1b8627){var _0x2af5c6=typeof _0x132b1d[_0xa22d('0x19')]===_0xa22d('0x1a')&&typeof _0x132b1d[_0xa22d('0x1b')]===_0xa22d('0x1a');var _0x5e56a6=_0x1b8627[_0xa22d('0x1c')];var _0x3d78b9=_0x2af5c6?0x0:_0x132b1d[_0xa22d('0x19')];var _0x1ed22e=_0x2af5c6?_0x1b8627[_0xa22d('0x1c')]:_0x132b1d[_0xa22d('0x19')]+_0x132b1d[_0xa22d('0x1b')];var _0x184604;if(_0x1ed22e>=_0x5e56a6){_0x1ed22e=_0x5e56a6;_0x184604=0xc8;}else{_0x184604=0xce;}_0x4dfa44['status'](_0x184604);return _0x4dfa44[_0xa22d('0x1d')](_0xa22d('0x1e'),_0x3d78b9+'-'+_0x1ed22e+'/'+_0x5e56a6)[_0xa22d('0x18')](_0x1b8627);}return null;};}function patchUpdates(_0x4ed606){return function(_0x4c0aed){try{jsonpatch['apply'](_0x4c0aed,_0x4ed606,!![]);}catch(_0x2cd394){return BPromise[_0xa22d('0x1f')](_0x2cd394);}return _0x4c0aed[_0xa22d('0x20')]();};}function saveUpdates(_0x5071e1,_0x389675){return function(_0x45f528){if(_0x45f528){return _0x45f528[_0xa22d('0x21')](_0x5071e1)['then'](function(_0xdb2773){return _0xdb2773;});}return null;};}function removeEntity(_0x1088ea,_0x502219){return function(_0x24701d){if(_0x24701d){return _0x24701d[_0xa22d('0x22')]()[_0xa22d('0x23')](function(){_0x1088ea[_0xa22d('0x17')](0xcc)[_0xa22d('0x24')]();});}};}function handleEntityNotFound(_0x1c83e8,_0x55f1ce){return function(_0x58aa49){if(!_0x58aa49){_0x1c83e8['sendStatus'](0x194);}return _0x58aa49;};}function handleError(_0x70bfb8,_0x2e4b26){_0x2e4b26=_0x2e4b26||0x1f4;return function(_0x2fe9e0){logger[_0xa22d('0x25')](_0x2fe9e0[_0xa22d('0x26')]);if(_0x2fe9e0[_0xa22d('0x27')]){delete _0x2fe9e0[_0xa22d('0x27')];}_0x70bfb8[_0xa22d('0x17')](_0x2e4b26)[_0xa22d('0x28')](_0x2fe9e0);};}exports[_0xa22d('0x29')]=function(_0x594ac5,_0x5ba48b){var _0xf687b9={},_0x4d460f={},_0x550dd7={'count':0x0,'rows':[]};var _0x1d7b33=_[_0xa22d('0x2a')](db[_0xa22d('0x2b')][_0xa22d('0x2c')],function(_0x1614f4){return{'name':_0x1614f4[_0xa22d('0x2d')],'type':_0x1614f4[_0xa22d('0x2e')][_0xa22d('0x2f')]};});_0x4d460f['model']=_[_0xa22d('0x2a')](_0x1d7b33,_0xa22d('0x27'));_0x4d460f[_0xa22d('0x30')]=_[_0xa22d('0x31')](_0x594ac5[_0xa22d('0x30')]);_0x4d460f[_0xa22d('0x32')]=_[_0xa22d('0x33')](_0x4d460f[_0xa22d('0x34')],_0x4d460f[_0xa22d('0x30')]);_0xf687b9[_0xa22d('0x35')]=_['intersection'](_0x4d460f[_0xa22d('0x34')],qs[_0xa22d('0x36')](_0x594ac5[_0xa22d('0x30')][_0xa22d('0x36')]));_0xf687b9[_0xa22d('0x35')]=_0xf687b9[_0xa22d('0x35')]['length']?_0xf687b9[_0xa22d('0x35')]:_0x4d460f[_0xa22d('0x34')];if(!_0x594ac5['query'][_0xa22d('0x37')]('nolimit')){_0xf687b9[_0xa22d('0x1b')]=qs[_0xa22d('0x1b')](_0x594ac5['query'][_0xa22d('0x1b')]);_0xf687b9['offset']=qs[_0xa22d('0x19')](_0x594ac5[_0xa22d('0x30')][_0xa22d('0x19')]);}_0xf687b9[_0xa22d('0x38')]=qs[_0xa22d('0x39')](_0x594ac5[_0xa22d('0x30')][_0xa22d('0x39')]);_0xf687b9[_0xa22d('0x3a')]=qs['filters'](_[_0xa22d('0x3b')](_0x594ac5[_0xa22d('0x30')],_0x4d460f['filters']),_0x1d7b33);if(_0x594ac5[_0xa22d('0x30')][_0xa22d('0x3c')]){_0xf687b9['where']=_['merge'](_0xf687b9[_0xa22d('0x3a')],{'$or':_[_0xa22d('0x2a')](_0x1d7b33,function(_0x109944){if(_0x109944[_0xa22d('0x2e')]!==_0xa22d('0x3d')){var _0x180c37={};_0x180c37[_0x109944[_0xa22d('0x27')]]={'$like':'%'+_0x594ac5[_0xa22d('0x30')][_0xa22d('0x3c')]+'%'};return _0x180c37;}})});}_0xf687b9=_[_0xa22d('0x3e')]({},_0xf687b9,_0x594ac5['options']);var _0x36287a={'where':_0xf687b9[_0xa22d('0x3a')]};return db[_0xa22d('0x2b')][_0xa22d('0x1c')](_0x36287a)['then'](function(_0x11e608){_0x550dd7['count']=_0x11e608;if(_0x594ac5[_0xa22d('0x30')][_0xa22d('0x3f')]){_0xf687b9[_0xa22d('0x40')]=[{'all':!![]}];}return db[_0xa22d('0x2b')][_0xa22d('0x41')](_0xf687b9);})[_0xa22d('0x23')](function(_0x55034d){_0x550dd7[_0xa22d('0x42')]=_0x55034d;return _0x550dd7;})[_0xa22d('0x23')](respondWithFilteredResult(_0x5ba48b,_0xf687b9))['catch'](handleError(_0x5ba48b,null));};exports[_0xa22d('0x43')]=function(_0x2e44c3,_0x5404d1){var _0x42a36b={'raw':!![],'where':{'id':_0x2e44c3[_0xa22d('0x44')]['id']}},_0x4aebbe={};_0x4aebbe[_0xa22d('0x34')]=_[_0xa22d('0x31')](db['JscriptyAnswerReport'][_0xa22d('0x2c')]);_0x4aebbe[_0xa22d('0x30')]=_['keys'](_0x2e44c3[_0xa22d('0x30')]);_0x4aebbe[_0xa22d('0x32')]=_[_0xa22d('0x33')](_0x4aebbe[_0xa22d('0x34')],_0x4aebbe[_0xa22d('0x30')]);_0x42a36b[_0xa22d('0x35')]=_[_0xa22d('0x33')](_0x4aebbe[_0xa22d('0x34')],qs['fields'](_0x2e44c3['query'][_0xa22d('0x36')]));_0x42a36b['attributes']=_0x42a36b[_0xa22d('0x35')]['length']?_0x42a36b[_0xa22d('0x35')]:_0x4aebbe['model'];if(_0x2e44c3[_0xa22d('0x30')][_0xa22d('0x3f')]){_0x42a36b[_0xa22d('0x40')]=[{'all':!![]}];}_0x42a36b=_[_0xa22d('0x3e')]({},_0x42a36b,_0x2e44c3[_0xa22d('0x45')]);return db[_0xa22d('0x2b')][_0xa22d('0x46')](_0x42a36b)[_0xa22d('0x23')](handleEntityNotFound(_0x5404d1,null))[_0xa22d('0x23')](respondWithResult(_0x5404d1,null))[_0xa22d('0x47')](handleError(_0x5404d1,null));};exports['create']=function(_0x5f488e,_0x132be8){return db['JscriptyAnswerReport'][_0xa22d('0x48')](_0x5f488e['body'],{})[_0xa22d('0x23')](respondWithResult(_0x132be8,0xc9))[_0xa22d('0x47')](handleError(_0x132be8,null));};exports['update']=function(_0x4a1d04,_0x37e2b2){if(_0x4a1d04['body']['id']){delete _0x4a1d04[_0xa22d('0x49')]['id'];}return db['JscriptyAnswerReport'][_0xa22d('0x46')]({'where':{'id':_0x4a1d04[_0xa22d('0x44')]['id']}})[_0xa22d('0x23')](handleEntityNotFound(_0x37e2b2,null))[_0xa22d('0x23')](saveUpdates(_0x4a1d04[_0xa22d('0x49')],null))[_0xa22d('0x23')](respondWithResult(_0x37e2b2,null))[_0xa22d('0x47')](handleError(_0x37e2b2,null));};exports[_0xa22d('0x22')]=function(_0x45672b,_0x5e5847){return db[_0xa22d('0x2b')][_0xa22d('0x46')]({'where':{'id':_0x45672b[_0xa22d('0x44')]['id']}})[_0xa22d('0x23')](handleEntityNotFound(_0x5e5847,null))[_0xa22d('0x23')](removeEntity(_0x5e5847,null))[_0xa22d('0x47')](handleError(_0x5e5847,null));};exports[_0xa22d('0x4a')]=function(_0x432d39,_0x134e7a){return db[_0xa22d('0x2b')]['describe']()[_0xa22d('0x23')](respondWithResult(_0x134e7a,null))[_0xa22d('0x47')](handleError(_0x134e7a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9cacb6f..c45e1c7 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 _0x6146=['request-promise','path','rimraf','../../config/environment','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x6146,0x16f));var _0x6614=function(_0x425077,_0x3c4253){_0x425077=_0x425077-0x0;var _0x461364=_0x6146[_0x425077];return _0x461364;};'use strict';var _=require(_0x6614('0x0'));var util=require(_0x6614('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6614('0x2'));var fs=require('fs');var path=require(_0x6614('0x3'));var rimraf=require(_0x6614('0x4'));var config=require(_0x6614('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x403c5d,_0x39321c){return _0x403c5d[_0x6614('0x6')](_0x6614('0x7'),attributes,{'tableName':_0x6614('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03b1=['exports','JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x03b1,0xe9));var _0x103b=function(_0x4511f3,_0x423aa1){_0x4511f3=_0x4511f3-0x0;var _0x3f8e25=_0x03b1[_0x4511f3];return _0x3f8e25;};'use strict';var _=require(_0x103b('0x0'));var util=require('util');var logger=require(_0x103b('0x1'))(_0x103b('0x2'));var moment=require(_0x103b('0x3'));var BPromise=require(_0x103b('0x4'));var rp=require(_0x103b('0x5'));var fs=require('fs');var path=require(_0x103b('0x6'));var rimraf=require('rimraf');var config=require(_0x103b('0x7'));var attributes=require(_0x103b('0x8'));module[_0x103b('0x9')]=function(_0x39cdef,_0x4db57e){return _0x39cdef['define'](_0x103b('0xa'),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 4ee0c95..5c3ecce 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 _0x33fb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5dbfa3,_0x51a270){var _0x1a25be=function(_0x49c105){while(--_0x49c105){_0x5dbfa3['push'](_0x5dbfa3['shift']());}};_0x1a25be(++_0x51a270);}(_0x33fb,0xb8));var _0xb33f=function(_0x25ffe2,_0x30deb4){_0x25ffe2=_0x25ffe2-0x0;var _0x323d6c=_0x33fb[_0x25ffe2];return _0x323d6c;};'use strict';var _=require(_0xb33f('0x0'));var util=require(_0xb33f('0x1'));var moment=require(_0xb33f('0x2'));var BPromise=require(_0xb33f('0x3'));var rs=require(_0xb33f('0x4'));var fs=require('fs');var Redis=require(_0xb33f('0x5'));var db=require(_0xb33f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb33f('0x7'))(_0xb33f('0x8'));var config=require(_0xb33f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb33f('0xa')][_0xb33f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b588e,_0x2f65e2,_0x42de4c){return new BPromise(function(_0x5c97dc,_0x4ba45a){return client[_0xb33f('0xc')](_0x2b588e,_0x42de4c)['then'](function(_0x278f9c){logger['info'](_0xb33f('0xd'),_0x2f65e2,_0xb33f('0xe'));logger[_0xb33f('0xf')](_0xb33f('0x10'),_0x2f65e2,'request\x20sent',JSON[_0xb33f('0x11')](_0x278f9c));if(_0x278f9c[_0xb33f('0x12')]){if(_0x278f9c[_0xb33f('0x12')][_0xb33f('0x13')]===0x1f4){logger[_0xb33f('0x12')](_0xb33f('0xd'),_0x2f65e2,_0x278f9c[_0xb33f('0x12')][_0xb33f('0x14')]);return _0x4ba45a(_0x278f9c[_0xb33f('0x12')][_0xb33f('0x14')]);}logger[_0xb33f('0x12')](_0xb33f('0xd'),_0x2f65e2,_0x278f9c['error'][_0xb33f('0x14')]);return _0x5c97dc(_0x278f9c[_0xb33f('0x12')]['message']);}else{logger[_0xb33f('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2f65e2,_0xb33f('0xe'));_0x5c97dc(_0x278f9c[_0xb33f('0x16')]['message']);}})['catch'](function(_0x33b1c9){logger[_0xb33f('0x12')](_0xb33f('0xd'),_0x2f65e2,_0x33b1c9);_0x4ba45a(_0x33b1c9);});});} \ No newline at end of file +var _0x1c27=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59d451,_0x502162){var _0x32b4d5=function(_0x577214){while(--_0x577214){_0x59d451['push'](_0x59d451['shift']());}};_0x32b4d5(++_0x502162);}(_0x1c27,0xba));var _0x71c2=function(_0x292bab,_0x18b725){_0x292bab=_0x292bab-0x0;var _0x3a1de1=_0x1c27[_0x292bab];return _0x3a1de1;};'use strict';var _=require(_0x71c2('0x0'));var util=require(_0x71c2('0x1'));var moment=require(_0x71c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x71c2('0x3'));var fs=require('fs');var Redis=require(_0x71c2('0x4'));var db=require(_0x71c2('0x5'))['db'];var utils=require(_0x71c2('0x6'));var logger=require(_0x71c2('0x7'))(_0x71c2('0x8'));var config=require('../../config/environment');var jayson=require(_0x71c2('0x9'));var client=jayson[_0x71c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36cb6d,_0x4352ed,_0x4652e9){return new BPromise(function(_0x3b2a4e,_0x6f9a95){return client[_0x71c2('0xb')](_0x36cb6d,_0x4652e9)[_0x71c2('0xc')](function(_0x171409){logger[_0x71c2('0xd')](_0x71c2('0xe'),_0x4352ed,_0x71c2('0xf'));logger['debug'](_0x71c2('0x10'),_0x4352ed,'request\x20sent',JSON[_0x71c2('0x11')](_0x171409));if(_0x171409['error']){if(_0x171409[_0x71c2('0x12')][_0x71c2('0x13')]===0x1f4){logger[_0x71c2('0x12')](_0x71c2('0xe'),_0x4352ed,_0x171409[_0x71c2('0x12')][_0x71c2('0x14')]);return _0x6f9a95(_0x171409[_0x71c2('0x12')][_0x71c2('0x14')]);}logger['error'](_0x71c2('0xe'),_0x4352ed,_0x171409[_0x71c2('0x12')][_0x71c2('0x14')]);return _0x3b2a4e(_0x171409['error'][_0x71c2('0x14')]);}else{logger[_0x71c2('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4352ed,_0x71c2('0xf'));_0x3b2a4e(_0x171409[_0x71c2('0x15')][_0x71c2('0x14')]);}})[_0x71c2('0x16')](function(_0x2f065e){logger[_0x71c2('0x12')](_0x71c2('0xe'),_0x4352ed,_0x2f065e);_0x6f9a95(_0x2f065e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 918de32..de2850e 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 _0xafb4=['isAuthenticated','getSessions','get','getAnswers','30s','getSummary','post','create','/:id/clone','clone','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xafb4,0x1f0));var _0x4afb=function(_0x5de528,_0x512696){_0x5de528=_0x5de528-0x0;var _0x2006e9=_0xafb4[_0x5de528];return _0x2006e9;};'use strict';var multer=require(_0x4afb('0x0'));var util=require(_0x4afb('0x1'));var path=require(_0x4afb('0x2'));var timeout=require(_0x4afb('0x3'));var express=require(_0x4afb('0x4'));var router=express[_0x4afb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4afb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4afb('0x7'));var controller=require(_0x4afb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4afb('0x9')]);router['get']('/:id',auth[_0x4afb('0xa')](),controller['show']);router['get']('/:id/sessions',auth[_0x4afb('0xa')](),controller[_0x4afb('0xb')]);router[_0x4afb('0xc')]('/:id/answers',auth[_0x4afb('0xa')](),controller[_0x4afb('0xd')]);router['get']('/:id/summary',auth[_0x4afb('0xa')](),timeout(_0x4afb('0xe')),controller[_0x4afb('0xf')]);router[_0x4afb('0x10')]('/',auth[_0x4afb('0xa')](),controller[_0x4afb('0x11')]);router['post'](_0x4afb('0x12'),auth[_0x4afb('0xa')](),controller[_0x4afb('0x13')]);router['put'](_0x4afb('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x4afb('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4afb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa26c=['/:id/summary','post','/:id/clone','clone','put','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa26c,0x16b));var _0xca26=function(_0x579c32,_0x2ed512){_0x579c32=_0x579c32-0x0;var _0x5c1191=_0xa26c[_0x579c32];return _0x5c1191;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca26('0x0'));var timeout=require(_0xca26('0x1'));var express=require(_0xca26('0x2'));var router=express['Router']();var fs_extra=require(_0xca26('0x3'));var auth=require(_0xca26('0x4'));var interaction=require(_0xca26('0x5'));var config=require(_0xca26('0x6'));var controller=require(_0xca26('0x7'));router[_0xca26('0x8')]('/',auth[_0xca26('0x9')](),controller[_0xca26('0xa')]);router[_0xca26('0x8')](_0xca26('0xb'),auth[_0xca26('0x9')](),controller['show']);router['get']('/:id/sessions',auth[_0xca26('0x9')](),controller[_0xca26('0xc')]);router[_0xca26('0x8')](_0xca26('0xd'),auth['isAuthenticated'](),controller[_0xca26('0xe')]);router[_0xca26('0x8')](_0xca26('0xf'),auth[_0xca26('0x9')](),timeout('30s'),controller['getSummary']);router[_0xca26('0x10')]('/',auth[_0xca26('0x9')](),controller['create']);router[_0xca26('0x10')](_0xca26('0x11'),auth[_0xca26('0x9')](),controller[_0xca26('0x12')]);router[_0xca26('0x13')](_0xca26('0xb'),auth[_0xca26('0x9')](),controller['update']);router['delete']('/:id',auth[_0xca26('0x9')](),controller['destroy']);module[_0xca26('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 39c227f..19fc9fc 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 _0x735d=['isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','STRING','name','TEXT','long'];(function(_0x3112c5,_0x2295f7){var _0x5a7ad8=function(_0x172d97){while(--_0x172d97){_0x3112c5['push'](_0x3112c5['shift']());}};_0x5a7ad8(++_0x2295f7);}(_0x735d,0x126));var _0xd735=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x735d[_0x644ecd];return _0x1c66ce;};'use strict';var Sequelize=require(_0xd735('0x0'));var _=require('lodash');var util=require(_0xd735('0x1'));module['exports']={'name':{'type':Sequelize[_0xd735('0x2')],'unique':_0xd735('0x3')},'description':{'type':Sequelize[_0xd735('0x2')]},'formData':{'type':Sequelize[_0xd735('0x4')](_0xd735('0x5')),'set':function(_0x441af1){if(_[_0xd735('0x6')](_0x441af1)){this[_0xd735('0x7')]('formData',JSON[_0xd735('0x8')](_0x441af1));}else if(_[_0xd735('0x9')](_0x441af1)){this[_0xd735('0x7')](_0xd735('0xa'),_0x441af1);}else{this[_0xd735('0x7')](_0xd735('0xa'),util[_0xd735('0xb')](_0xd735('0xc'),this[_0xd735('0xd')](_0xd735('0x3'))||'',this[_0xd735('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd735('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd735('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xce5f=['exports','STRING','name','TEXT','long','formData','stringify','isString','setDataValue','getDataValue','BOOLEAN','lodash'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xce5f,0x9b));var _0xfce5=function(_0x111fe8,_0x1971d3){_0x111fe8=_0x111fe8-0x0;var _0x264220=_0xce5f[_0x111fe8];return _0x264220;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfce5('0x0'));var util=require('util');module[_0xfce5('0x1')]={'name':{'type':Sequelize[_0xfce5('0x2')],'unique':_0xfce5('0x3')},'description':{'type':Sequelize[_0xfce5('0x2')]},'formData':{'type':Sequelize[_0xfce5('0x4')](_0xfce5('0x5')),'set':function(_0x5e1207){if(_['isObjectLike'](_0x5e1207)){this['setDataValue'](_0xfce5('0x6'),JSON[_0xfce5('0x7')](_0x5e1207));}else if(_[_0xfce5('0x8')](_0x5e1207)){this[_0xfce5('0x9')](_0xfce5('0x6'),_0x5e1207);}else{this[_0xfce5('0x9')](_0xfce5('0x6'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xfce5('0xa')](_0xfce5('0x3'))||'',this[_0xfce5('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfce5('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfce5('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 00534fc..110768d 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 _0x112f=['user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','Projects','userProfileId','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x112f,0x11e));var _0xf112=function(_0x3f943f,_0x1bc3d7){_0x3f943f=_0x3f943f-0x0;var _0xdf628a=_0x112f[_0x3f943f];return _0xdf628a;};'use strict';var emlformat=require(_0xf112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf112('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf112('0x2'));var moment=require(_0xf112('0x3'));var BPromise=require(_0xf112('0x4'));var Mustache=require(_0xf112('0x5'));var util=require('util');var path=require(_0xf112('0x6'));var sox=require('sox');var csv=require(_0xf112('0x7'));var ejs=require(_0xf112('0x8'));var fs=require('fs');var fs_extra=require(_0xf112('0x9'));var _=require(_0xf112('0xa'));var squel=require(_0xf112('0xb'));var crypto=require(_0xf112('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf112('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf112('0xe'));var Papa=require(_0xf112('0xf'));var Redis=require(_0xf112('0x10'));var authService=require(_0xf112('0x11'));var qs=require(_0xf112('0x12'));var as=require(_0xf112('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf112('0x14'));var config=require(_0xf112('0x15'));var licenseUtil=require(_0xf112('0x16'));var db=require(_0xf112('0x17'))['db'];function respondWithStatusCode(_0x350f60,_0x330f6c){_0x330f6c=_0x330f6c||0xcc;return function(_0x401344){if(_0x401344){return _0x350f60[_0xf112('0x18')](_0x330f6c);}return _0x350f60[_0xf112('0x19')](_0x330f6c)['end']();};}function respondWithResult(_0x1381f4,_0x5c32f2){_0x5c32f2=_0x5c32f2||0xc8;return function(_0x568a07){if(_0x568a07){return _0x1381f4['status'](_0x5c32f2)[_0xf112('0x1a')](_0x568a07);}};}function respondWithFilteredResult(_0x5111e9,_0xb7fc78){return function(_0x1dabb1){if(_0x1dabb1){var _0x3e5780=typeof _0xb7fc78[_0xf112('0x1b')]===_0xf112('0x1c')&&typeof _0xb7fc78['limit']===_0xf112('0x1c');var _0xae0e54=_0x1dabb1['count'];var _0x16d575=_0x3e5780?0x0:_0xb7fc78[_0xf112('0x1b')];var _0x23872c=_0x3e5780?_0x1dabb1['count']:_0xb7fc78[_0xf112('0x1b')]+_0xb7fc78[_0xf112('0x1d')];var _0x46a02c;if(_0x23872c>=_0xae0e54){_0x23872c=_0xae0e54;_0x46a02c=0xc8;}else{_0x46a02c=0xce;}_0x5111e9[_0xf112('0x19')](_0x46a02c);return _0x5111e9[_0xf112('0x1e')](_0xf112('0x1f'),_0x16d575+'-'+_0x23872c+'/'+_0xae0e54)[_0xf112('0x1a')](_0x1dabb1);}return null;};}function patchUpdates(_0x13cc44){return function(_0x2d3a1b){try{jsonpatch[_0xf112('0x20')](_0x2d3a1b,_0x13cc44,!![]);}catch(_0x240bd4){return BPromise['reject'](_0x240bd4);}return _0x2d3a1b[_0xf112('0x21')]();};}function saveUpdates(_0x5e9599,_0xaed84c){return function(_0x8e7b25){if(_0x8e7b25){return _0x8e7b25[_0xf112('0x22')](_0x5e9599)[_0xf112('0x23')](function(_0x390f4d){return _0x390f4d;});}return null;};}function removeEntity(_0x29b6fb,_0x3f9604){return function(_0x1163b6){if(_0x1163b6){return _0x1163b6[_0xf112('0x24')]()[_0xf112('0x23')](function(){var _0x27a894=_0x1163b6[_0xf112('0x25')]({'plain':!![]});var _0x48a5c9='Projects';return db[_0xf112('0x26')][_0xf112('0x24')]({'where':{'type':_0x48a5c9,'resourceId':_0x27a894['id']}})['then'](function(){return _0x1163b6;});})[_0xf112('0x23')](function(){_0x29b6fb[_0xf112('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ef2f,_0x5227f3){return function(_0x48adaa){if(!_0x48adaa){_0x34ef2f[_0xf112('0x18')](0x194);}return _0x48adaa;};}function handleError(_0x1967df,_0x49e07e){_0x49e07e=_0x49e07e||0x1f4;return function(_0x50ca78){logger[_0xf112('0x27')](_0x50ca78[_0xf112('0x28')]);if(_0x50ca78[_0xf112('0x29')]){delete _0x50ca78[_0xf112('0x29')];}_0x1967df[_0xf112('0x19')](_0x49e07e)[_0xf112('0x2a')](_0x50ca78);};}exports[_0xf112('0x2b')]=function(_0x4fd46a,_0x55db9d){var _0x40b519={},_0x32f538={},_0x54d0e6={'count':0x0,'rows':[]};var _0x27d49d=_['map'](db[_0xf112('0x2c')][_0xf112('0x2d')],function(_0x521072){return{'name':_0x521072[_0xf112('0x2e')],'type':_0x521072[_0xf112('0x2f')][_0xf112('0x30')]};});_0x32f538['model']=_[_0xf112('0x31')](_0x27d49d,_0xf112('0x29'));_0x32f538[_0xf112('0x32')]=_['keys'](_0x4fd46a[_0xf112('0x32')]);_0x32f538['filters']=_[_0xf112('0x33')](_0x32f538[_0xf112('0x34')],_0x32f538[_0xf112('0x32')]);_0x40b519['attributes']=_[_0xf112('0x33')](_0x32f538[_0xf112('0x34')],qs['fields'](_0x4fd46a['query'][_0xf112('0x35')]));_0x40b519[_0xf112('0x36')]=_0x40b519[_0xf112('0x36')][_0xf112('0x37')]?_0x40b519[_0xf112('0x36')]:_0x32f538[_0xf112('0x34')];if(!_0x4fd46a[_0xf112('0x32')][_0xf112('0x38')](_0xf112('0x39'))){_0x40b519[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x4fd46a[_0xf112('0x32')]['limit']);_0x40b519[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x4fd46a[_0xf112('0x32')][_0xf112('0x1b')]);}_0x40b519['order']=qs[_0xf112('0x3a')](_0x4fd46a[_0xf112('0x32')][_0xf112('0x3a')]);_0x40b519[_0xf112('0x3b')]=qs[_0xf112('0x3c')](_['pick'](_0x4fd46a[_0xf112('0x32')],_0x32f538['filters']),_0x27d49d);if(_0x4fd46a['query'][_0xf112('0x3d')]){_0x40b519[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x40b519[_0xf112('0x3b')],{'$or':_['map'](_0x27d49d,function(_0x272d8e){if(_0x272d8e['type']!==_0xf112('0x3f')){var _0x30214f={};_0x30214f[_0x272d8e['name']]={'$like':'%'+_0x4fd46a[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x30214f;}})});}_0x40b519=_[_0xf112('0x3e')]({},_0x40b519,_0x4fd46a[_0xf112('0x40')]);var _0x4ba85d={'where':_0x40b519[_0xf112('0x3b')]};return db[_0xf112('0x2c')]['count'](_0x4ba85d)[_0xf112('0x23')](function(_0x685a5a){_0x54d0e6[_0xf112('0x41')]=_0x685a5a;if(_0x4fd46a['query'][_0xf112('0x42')]){_0x40b519[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x2c')][_0xf112('0x44')](_0x40b519);})[_0xf112('0x23')](function(_0x1c0f45){_0x54d0e6[_0xf112('0x45')]=_0x1c0f45;return _0x54d0e6;})[_0xf112('0x23')](respondWithFilteredResult(_0x55db9d,_0x40b519))['catch'](handleError(_0x55db9d,null));};exports[_0xf112('0x46')]=function(_0x27d074,_0x5b62ce){var _0x81ae92={'raw':![],'where':{'id':_0x27d074['params']['id']}},_0x1f380d={};_0x1f380d[_0xf112('0x34')]=_[_0xf112('0x47')](db['JscriptyProject'][_0xf112('0x2d')]);_0x1f380d[_0xf112('0x32')]=_[_0xf112('0x47')](_0x27d074[_0xf112('0x32')]);_0x1f380d[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x1f380d[_0xf112('0x34')],_0x1f380d[_0xf112('0x32')]);_0x81ae92['attributes']=_['intersection'](_0x1f380d[_0xf112('0x34')],qs[_0xf112('0x35')](_0x27d074[_0xf112('0x32')][_0xf112('0x35')]));_0x81ae92[_0xf112('0x36')]=_0x81ae92[_0xf112('0x36')][_0xf112('0x37')]?_0x81ae92[_0xf112('0x36')]:_0x1f380d[_0xf112('0x34')];if(_0x27d074[_0xf112('0x32')][_0xf112('0x42')]){_0x81ae92[_0xf112('0x43')]=[{'all':!![]}];}_0x81ae92=_[_0xf112('0x3e')]({},_0x81ae92,_0x27d074[_0xf112('0x40')]);return db[_0xf112('0x2c')][_0xf112('0x48')](_0x81ae92)[_0xf112('0x23')](handleEntityNotFound(_0x5b62ce,null))['then'](respondWithResult(_0x5b62ce,null))[_0xf112('0x49')](handleError(_0x5b62ce,null));};exports[_0xf112('0x4a')]=function(_0x34c66d,_0x51a6c4){return db[_0xf112('0x2c')][_0xf112('0x4a')](_0x34c66d['body'],{})['then'](function(_0x58de11){var _0x5c8bf3=_0x34c66d['user'][_0xf112('0x25')]({'plain':!![]});if(!_0x5c8bf3)throw new Error(_0xf112('0x4b'));if(_0x5c8bf3[_0xf112('0x4c')]===_0xf112('0x4d')){var _0x5de006=_0x58de11[_0xf112('0x25')]({'plain':!![]});var _0x321469='Projects';return db[_0xf112('0x4e')][_0xf112('0x48')]({'where':{'name':_0x321469,'userProfileId':_0x5c8bf3['userProfileId']},'raw':!![]})[_0xf112('0x23')](function(_0x5797f8){if(_0x5797f8&&_0x5797f8[_0xf112('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x5de006[_0xf112('0x29')],'resourceId':_0x5de006['id'],'type':_0x5797f8[_0xf112('0x29')],'sectionId':_0x5797f8['id']},{})[_0xf112('0x23')](function(){return _0x58de11;});}else{return _0x58de11;}})[_0xf112('0x49')](function(_0x2b4021){logger[_0xf112('0x27')](_0xf112('0x50'),_0x2b4021);throw _0x2b4021;});}return _0x58de11;})[_0xf112('0x23')](respondWithResult(_0x51a6c4,0xc9))[_0xf112('0x49')](handleError(_0x51a6c4,null));};exports[_0xf112('0x51')]=function(_0x411fa8,_0x4ab934){var _0x47e28b={'where':{'id':_0x411fa8[_0xf112('0x52')]['id']}},_0x1d8d0a={};_0x1d8d0a[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x2c')]['rawAttributes']);_0x47e28b['attributes']=_['intersection'](_0x1d8d0a[_0xf112('0x34')],qs[_0xf112('0x35')](_0x411fa8[_0xf112('0x32')][_0xf112('0x35')]));_0x47e28b[_0xf112('0x36')]=_0x47e28b[_0xf112('0x36')]['length']?_0x47e28b[_0xf112('0x36')]:_0x1d8d0a['model'];if(_0x411fa8[_0xf112('0x32')][_0xf112('0x42')]){_0x47e28b[_0xf112('0x43')]=[{'all':!![]}];}_0x47e28b=_[_0xf112('0x3e')]({},_0x47e28b,_0x411fa8['options']);return db[_0xf112('0x2c')]['find'](_0x47e28b)[_0xf112('0x23')](handleEntityNotFound(_0x4ab934,null))[_0xf112('0x23')](function(_0x3859b7){if(_0x3859b7){var _0x475e05=_0x3859b7[_0xf112('0x25')]({'plain':!![]});_0x475e05=qs[_0xf112('0x53')](_0x475e05,['id',_0xf112('0x54'),_0xf112('0x55')]);_0x411fa8[_0xf112('0x56')]=_[_0xf112('0x53')](_0x411fa8[_0xf112('0x56')],['id',_0xf112('0x54'),_0xf112('0x55')]);return db[_0xf112('0x2c')][_0xf112('0x4a')](_[_0xf112('0x3e')](_0x475e05,_0x411fa8[_0xf112('0x56')]),{'include':_0x411fa8['query'][_0xf112('0x42')]?[{'all':!![]}]:undefined})[_0xf112('0x23')](function(_0x3d084a){var _0x242c32=_0x411fa8[_0xf112('0x4d')]['get']({'plain':!![]});if(!_0x242c32)throw new Error(_0xf112('0x4b'));if(_0x242c32[_0xf112('0x4c')]==='user'){var _0x436027=_0x3d084a['get']({'plain':!![]});var _0x483efb=_0xf112('0x57');return db[_0xf112('0x4e')]['find']({'where':{'name':_0x483efb,'userProfileId':_0x242c32[_0xf112('0x58')]},'raw':!![]})[_0xf112('0x23')](function(_0x4e2fcc){if(_0x4e2fcc&&_0x4e2fcc[_0xf112('0x4f')]===0x0){return db['UserProfileResource'][_0xf112('0x4a')]({'name':_0x436027[_0xf112('0x29')],'resourceId':_0x436027['id'],'type':_0x4e2fcc[_0xf112('0x29')],'sectionId':_0x4e2fcc['id']},{})[_0xf112('0x23')](function(){return _0x3d084a;});}else{return _0x3d084a;}})['catch'](function(_0x4aa8f2){logger[_0xf112('0x27')](_0xf112('0x50'),_0x4aa8f2);throw _0x4aa8f2;});}return _0x3d084a;});}})[_0xf112('0x23')](respondWithResult(_0x4ab934,0xc9))[_0xf112('0x49')](handleError(_0x4ab934,null));};exports[_0xf112('0x22')]=function(_0x5e5718,_0xfbd3a4){if(_0x5e5718[_0xf112('0x56')]['id']){delete _0x5e5718['body']['id'];}return db['JscriptyProject'][_0xf112('0x48')]({'where':{'id':_0x5e5718[_0xf112('0x52')]['id']}})['then'](handleEntityNotFound(_0xfbd3a4,null))[_0xf112('0x23')](saveUpdates(_0x5e5718[_0xf112('0x56')],null))[_0xf112('0x23')](respondWithResult(_0xfbd3a4,null))['catch'](handleError(_0xfbd3a4,null));};exports[_0xf112('0x24')]=function(_0x23a966,_0x5a57f8){return db[_0xf112('0x2c')][_0xf112('0x48')]({'where':{'id':_0x23a966[_0xf112('0x52')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x5a57f8,null))[_0xf112('0x23')](removeEntity(_0x5a57f8,null))[_0xf112('0x49')](handleError(_0x5a57f8,null));};exports[_0xf112('0x59')]=function(_0x2cea82,_0x803707,_0x3b5ddb){var _0x2f8876={'raw':!![],'where':{}};var _0x4f898f={};var _0x4c1b1b={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x2cea82['params']['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x803707,null))[_0xf112('0x23')](function(_0xc88a05){if(_0xc88a05){_0x4f898f[_0xf112('0x34')]=_[_0xf112('0x47')](db[_0xf112('0x5b')][_0xf112('0x2d')]);_0x4f898f[_0xf112('0x32')]=_[_0xf112('0x47')](_0x2cea82[_0xf112('0x32')]);_0x4f898f[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x4f898f[_0xf112('0x34')],_0x4f898f[_0xf112('0x32')]);_0x2f8876['attributes']=_[_0xf112('0x33')](_0x4f898f[_0xf112('0x34')],qs[_0xf112('0x35')](_0x2cea82[_0xf112('0x32')]['fields']));_0x2f8876[_0xf112('0x36')]=_0x2f8876['attributes'][_0xf112('0x37')]?_0x2f8876[_0xf112('0x36')]:_0x4f898f[_0xf112('0x34')];if(!_0x2cea82[_0xf112('0x32')][_0xf112('0x38')]('nolimit')){_0x2f8876[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x2cea82[_0xf112('0x32')][_0xf112('0x1d')]);_0x2f8876['offset']=qs['offset'](_0x2cea82[_0xf112('0x32')]['offset']);}_0x2f8876[_0xf112('0x5c')]=qs['sort'](_0x2cea82['query']['sort']);_0x2f8876[_0xf112('0x3b')]=qs[_0xf112('0x3c')](_[_0xf112('0x5d')](_0x2cea82[_0xf112('0x32')],_0x4f898f[_0xf112('0x3c')]));_0x2f8876[_0xf112('0x3b')][_0xf112('0x5e')]=_0xc88a05['id'];if(_0x2cea82['query'][_0xf112('0x3d')]){_0x2f8876[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x2f8876[_0xf112('0x3b')],{'$or':_[_0xf112('0x31')](_0x2f8876[_0xf112('0x36')],function(_0x234736){var _0x1814fa={};_0x1814fa[_0x234736]={'$like':'%'+_0x2cea82[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x1814fa;})});}_0x2f8876=_[_0xf112('0x3e')]({},_0x2f8876,_0x2cea82[_0xf112('0x40')]);return db[_0xf112('0x5b')]['count']({'where':_0x2f8876[_0xf112('0x3b')]})['then'](function(_0x4c8fd7){_0x4c1b1b['count']=_0x4c8fd7;if(_0x2cea82[_0xf112('0x32')][_0xf112('0x42')]){_0x2f8876[_0xf112('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf112('0x44')](_0x2f8876);})['then'](function(_0xfe6508){_0x4c1b1b[_0xf112('0x45')]=_0xfe6508;return _0x4c1b1b;});}})[_0xf112('0x23')](respondWithFilteredResult(_0x803707,_0x2f8876))[_0xf112('0x49')](handleError(_0x803707,null));};exports[_0xf112('0x5f')]=function(_0x279e63,_0x19995b,_0x50ed7c){var _0x1a9776={'raw':!![],'where':{}};var _0x51bbfa={};var _0x11173c={'count':0x0,'rows':[]};return db[_0xf112('0x2c')][_0xf112('0x5a')]({'where':{'id':_0x279e63['params']['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x19995b,null))['then'](function(_0x370a49){if(_0x370a49){_0x51bbfa[_0xf112('0x34')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x51bbfa[_0xf112('0x32')]=_[_0xf112('0x47')](_0x279e63[_0xf112('0x32')]);_0x51bbfa[_0xf112('0x3c')]=_[_0xf112('0x33')](_0x51bbfa['model'],_0x51bbfa['query']);_0x1a9776['attributes']=_[_0xf112('0x33')](_0x51bbfa[_0xf112('0x34')],qs['fields'](_0x279e63[_0xf112('0x32')][_0xf112('0x35')]));_0x1a9776[_0xf112('0x36')]=_0x1a9776[_0xf112('0x36')][_0xf112('0x37')]?_0x1a9776[_0xf112('0x36')]:_0x51bbfa[_0xf112('0x34')];if(!_0x279e63['query'][_0xf112('0x38')]('nolimit')){_0x1a9776[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x279e63[_0xf112('0x32')][_0xf112('0x1d')]);_0x1a9776[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x279e63['query'][_0xf112('0x1b')]);}_0x1a9776['order']=qs[_0xf112('0x3a')](_0x279e63['query'][_0xf112('0x3a')]);_0x1a9776['where']=qs['filters'](_[_0xf112('0x5d')](_0x279e63[_0xf112('0x32')],_0x51bbfa[_0xf112('0x3c')]));_0x1a9776[_0xf112('0x3b')][_0xf112('0x5e')]=_0x370a49['id'];if(_0x279e63[_0xf112('0x32')][_0xf112('0x3d')]){_0x1a9776[_0xf112('0x3b')]=_[_0xf112('0x3e')](_0x1a9776[_0xf112('0x3b')],{'$or':_['map'](_0x1a9776['attributes'],function(_0x3c52f3){var _0x25600c={};_0x25600c[_0x3c52f3]={'$like':'%'+_0x279e63[_0xf112('0x32')][_0xf112('0x3d')]+'%'};return _0x25600c;})});}_0x1a9776=_[_0xf112('0x3e')]({},_0x1a9776,_0x279e63[_0xf112('0x40')]);return db[_0xf112('0x60')]['count']({'where':_0x1a9776[_0xf112('0x3b')]})['then'](function(_0x1e56d6){_0x11173c[_0xf112('0x41')]=_0x1e56d6;if(_0x279e63[_0xf112('0x32')]['includeAll']){_0x1a9776[_0xf112('0x43')]=[{'all':!![]}];}return db[_0xf112('0x60')]['findAll'](_0x1a9776);})[_0xf112('0x23')](function(_0x3d7853){_0x11173c[_0xf112('0x45')]=_0x3d7853;return _0x11173c;});}})['then'](respondWithFilteredResult(_0x19995b,_0x1a9776))[_0xf112('0x49')](handleError(_0x19995b,null));};function char(_0x55e088){return _0xf112('0x61')===typeof _0x55e088?String[_0xf112('0x62')][_0xf112('0x20')](null,arguments):_0x55e088;}function needsEncapsulation(_0x3f888a){return!!_0x3f888a&&(_0x3f888a[_0xf112('0x63')]()['indexOf'](char(0xd))>=0x0||_0x3f888a[_0xf112('0x63')]()[_0xf112('0x64')](char(0xa))>=0x0||_0x3f888a[_0xf112('0x63')]()['indexOf'](char(0x2c))>=0x0||_0x3f888a[_0xf112('0x63')]()[_0xf112('0x64')](char(0x22))>=0x0);}function encapsulate(_0x2de855){var _0xe98f29=char(0x22),_0x27bec2='\x5c'+char(0x22),_0x7e7e38=_0x2de855[_0xf112('0x63')]()['replace'](new RegExp(_0xe98f29,'g'),_0x27bec2);return _0xe98f29+_0x7e7e38+_0xe98f29;}exports['getSummary']=function(_0xc09f59,_0x4e8085,_0x20fd36){var _0x5003dd,_0x39a651;var _0x257e7b={'where':{'ProjectId':_0xc09f59[_0xf112('0x52')]['id']}};if(_0xc09f59[_0xf112('0x32')][_0xf112('0x65')]){_0x257e7b[_0xf112('0x3b')][_0xf112('0x66')]=JSON['parse'](_0xc09f59[_0xf112('0x32')][_0xf112('0x65')]);}return db['JscriptySessionReport'][_0xf112('0x44')](_0x257e7b)[_0xf112('0x23')](handleEntityNotFound(_0x4e8085,null))['then'](function(_0x3a7974){if(_0x3a7974){_0x5003dd=_0x3a7974;return db[_0xf112('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0xf112('0x31')](_0x5003dd,'id')},'ProjectId':_0xc09f59[_0xf112('0x52')]['id']},'order':_0xf112('0x68')});}})['then'](handleEntityNotFound(_0x4e8085,null))[_0xf112('0x23')](function(_0x18d3f1){if(_0x18d3f1){_0x39a651=_0x18d3f1;var _0x4950ec={};for(var _0x805e76=0x0,_0x107795=_0x39a651['length'];_0x805e76<_0x107795;_0x805e76++){if(!_0x4950ec[_0xf112('0x38')](_0x39a651[_0x805e76][_0xf112('0x69')])){_0x4950ec[_0x39a651[_0x805e76]['questionId']]=needsEncapsulation(_0x39a651[_0x805e76][_0xf112('0x6a')])?encapsulate(_0x39a651[_0x805e76][_0xf112('0x6a')]):_0x39a651[_0x805e76][_0xf112('0x6a')];}}var _0x899e9f=[],_0x8af59b={};for(var _0x1575b9=0x0,_0x2f0923=_0x5003dd[_0xf112('0x37')];_0x1575b9<_0x2f0923;_0x1575b9++){_0x8af59b={'ProjectId':_0xc09f59[_0xf112('0x52')]['id'],'SessionId':_0x5003dd[_0x1575b9]['id'],'StartTime':moment(_0x5003dd[_0x1575b9]['starttime'])[_0xf112('0x6b')](_0xf112('0x6c'))};for(var _0x444390=0x0,_0xd78930=_0x39a651[_0xf112('0x37')];_0x444390<_0xd78930;_0x444390++){if(_0x39a651[_0x444390][_0xf112('0x6d')]==_0x5003dd[_0x1575b9]['id']&&_0x4950ec[_0xf112('0x38')](_0x39a651[_0x444390][_0xf112('0x69')])){_0x8af59b[_0x4950ec[_0x39a651[_0x444390][_0xf112('0x69')]]]=_0x39a651[_0x444390][_0xf112('0x6e')];}}for(var _0x5d965b in _0x4950ec){if(!_0x8af59b['hasOwnProperty'](_0x4950ec[_0x5d965b])){_0x8af59b[_0x4950ec[_0x5d965b]]=null;}}_0x899e9f[_0xf112('0x6f')](_0x8af59b);}return _0x899e9f;}})[_0xf112('0x23')](function(_0x15dd8f){if(!_[_0xf112('0x70')](_0x15dd8f)){var _0x1e172d=toCsv(_0x15dd8f);var _0x43f72a=Date[_0xf112('0x71')]();fs['writeFileSync'](util[_0xf112('0x6b')](_0xf112('0x72'),_0xc09f59[_0xf112('0x52')]['id'],_0x43f72a),_0x1e172d);_0x4e8085[_0xf112('0x73')]('Content-disposition',_0xf112('0x74')+util['format'](_0xf112('0x75'),_0xc09f59['params']['id'],_0x43f72a));_0x4e8085[_0xf112('0x73')](_0xf112('0x76'),_0xf112('0x77'));return _0x4e8085[_0xf112('0x78')](util[_0xf112('0x6b')](_0xf112('0x72'),_0xc09f59[_0xf112('0x52')]['id'],_0x43f72a));}else{return _0x4e8085[_0xf112('0x18')](0xcc);}})[_0xf112('0x49')](handleError(_0x4e8085,null));}; \ No newline at end of file +var _0xb1a4=['writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','order','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now'];(function(_0x2608b9,_0x5bf393){var _0x3bad59=function(_0x51ef82){while(--_0x51ef82){_0x2608b9['push'](_0x2608b9['shift']());}};_0x3bad59(++_0x5bf393);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x22b318,_0xa21719){_0x22b318=_0x22b318-0x0;var _0x221bf7=_0xb1a4[_0x22b318];return _0x221bf7;};'use strict';var emlformat=require(_0x4b1a('0x0'));var rimraf=require(_0x4b1a('0x1'));var zipdir=require(_0x4b1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b1a('0x3'));var Mustache=require(_0x4b1a('0x4'));var util=require('util');var path=require(_0x4b1a('0x5'));var sox=require('sox');var csv=require(_0x4b1a('0x6'));var ejs=require(_0x4b1a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b1a('0x8'));var squel=require(_0x4b1a('0x9'));var crypto=require(_0x4b1a('0xa'));var jsforce=require(_0x4b1a('0xb'));var deskjs=require(_0x4b1a('0xc'));var toCsv=require(_0x4b1a('0x6'));var querystring=require('querystring');var Papa=require(_0x4b1a('0xd'));var Redis=require(_0x4b1a('0xe'));var authService=require(_0x4b1a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b1a('0x10'));var logger=require('../../config/logger')(_0x4b1a('0x11'));var utils=require(_0x4b1a('0x12'));var config=require(_0x4b1a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b1a('0x14'))['db'];function respondWithStatusCode(_0x51b5ac,_0x5e7f0c){_0x5e7f0c=_0x5e7f0c||0xcc;return function(_0x5d47ef){if(_0x5d47ef){return _0x51b5ac['sendStatus'](_0x5e7f0c);}return _0x51b5ac['status'](_0x5e7f0c)[_0x4b1a('0x15')]();};}function respondWithResult(_0x5bfdaa,_0x1bad04){_0x1bad04=_0x1bad04||0xc8;return function(_0x470cc1){if(_0x470cc1){return _0x5bfdaa['status'](_0x1bad04)['json'](_0x470cc1);}};}function respondWithFilteredResult(_0x54abe5,_0x1920e8){return function(_0x3350b8){if(_0x3350b8){var _0x438092=typeof _0x1920e8[_0x4b1a('0x16')]===_0x4b1a('0x17')&&typeof _0x1920e8['limit']==='undefined';var _0x173139=_0x3350b8[_0x4b1a('0x18')];var _0x5887ae=_0x438092?0x0:_0x1920e8[_0x4b1a('0x16')];var _0xa77f53=_0x438092?_0x3350b8[_0x4b1a('0x18')]:_0x1920e8[_0x4b1a('0x16')]+_0x1920e8['limit'];var _0x4cdbc0;if(_0xa77f53>=_0x173139){_0xa77f53=_0x173139;_0x4cdbc0=0xc8;}else{_0x4cdbc0=0xce;}_0x54abe5[_0x4b1a('0x19')](_0x4cdbc0);return _0x54abe5[_0x4b1a('0x1a')](_0x4b1a('0x1b'),_0x5887ae+'-'+_0xa77f53+'/'+_0x173139)['json'](_0x3350b8);}return null;};}function patchUpdates(_0x501ae1){return function(_0x2cb261){try{jsonpatch[_0x4b1a('0x1c')](_0x2cb261,_0x501ae1,!![]);}catch(_0x170e4c){return BPromise[_0x4b1a('0x1d')](_0x170e4c);}return _0x2cb261['save']();};}function saveUpdates(_0x1156b5,_0x33ef81){return function(_0xbfd042){if(_0xbfd042){return _0xbfd042[_0x4b1a('0x1e')](_0x1156b5)[_0x4b1a('0x1f')](function(_0x2250ed){return _0x2250ed;});}return null;};}function removeEntity(_0x462c8a,_0x5bbd70){return function(_0x368a9e){if(_0x368a9e){return _0x368a9e['destroy']()[_0x4b1a('0x1f')](function(){var _0x1becd5=_0x368a9e[_0x4b1a('0x20')]({'plain':!![]});var _0x4342d4=_0x4b1a('0x21');return db[_0x4b1a('0x22')]['destroy']({'where':{'type':_0x4342d4,'resourceId':_0x1becd5['id']}})[_0x4b1a('0x1f')](function(){return _0x368a9e;});})[_0x4b1a('0x1f')](function(){_0x462c8a[_0x4b1a('0x19')](0xcc)[_0x4b1a('0x15')]();});}};}function handleEntityNotFound(_0x368626,_0xa516){return function(_0x448da3){if(!_0x448da3){_0x368626[_0x4b1a('0x23')](0x194);}return _0x448da3;};}function handleError(_0x317923,_0x114413){_0x114413=_0x114413||0x1f4;return function(_0x35f399){logger[_0x4b1a('0x24')](_0x35f399[_0x4b1a('0x25')]);if(_0x35f399[_0x4b1a('0x26')]){delete _0x35f399[_0x4b1a('0x26')];}_0x317923[_0x4b1a('0x19')](_0x114413)[_0x4b1a('0x27')](_0x35f399);};}exports[_0x4b1a('0x28')]=function(_0x5893e0,_0x4bd38c){var _0xed54b1={},_0x2cc0ce={},_0x215045={'count':0x0,'rows':[]};var _0x220058=_[_0x4b1a('0x29')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')],function(_0x34cfe0){return{'name':_0x34cfe0['fieldName'],'type':_0x34cfe0[_0x4b1a('0x2c')][_0x4b1a('0x2d')]};});_0x2cc0ce['model']=_[_0x4b1a('0x29')](_0x220058,_0x4b1a('0x26'));_0x2cc0ce[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x5893e0[_0x4b1a('0x2e')]);_0x2cc0ce['filters']=_[_0x4b1a('0x30')](_0x2cc0ce[_0x4b1a('0x31')],_0x2cc0ce[_0x4b1a('0x2e')]);_0xed54b1[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x2cc0ce[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x5893e0[_0x4b1a('0x2e')]['fields']));_0xed54b1[_0x4b1a('0x32')]=_0xed54b1[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0xed54b1['attributes']:_0x2cc0ce['model'];if(!_0x5893e0[_0x4b1a('0x2e')]['hasOwnProperty'](_0x4b1a('0x35'))){_0xed54b1[_0x4b1a('0x36')]=qs[_0x4b1a('0x36')](_0x5893e0[_0x4b1a('0x2e')]['limit']);_0xed54b1[_0x4b1a('0x16')]=qs[_0x4b1a('0x16')](_0x5893e0['query'][_0x4b1a('0x16')]);}_0xed54b1['order']=qs[_0x4b1a('0x37')](_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x37')]);_0xed54b1['where']=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x5893e0[_0x4b1a('0x2e')],_0x2cc0ce[_0x4b1a('0x38')]),_0x220058);if(_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x3a')]){_0xed54b1[_0x4b1a('0x3b')]=_[_0x4b1a('0x3c')](_0xed54b1[_0x4b1a('0x3b')],{'$or':_['map'](_0x220058,function(_0x2f493d){if(_0x2f493d[_0x4b1a('0x2c')]!==_0x4b1a('0x3d')){var _0xeb70c={};_0xeb70c[_0x2f493d[_0x4b1a('0x26')]]={'$like':'%'+_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x3a')]+'%'};return _0xeb70c;}})});}_0xed54b1=_[_0x4b1a('0x3c')]({},_0xed54b1,_0x5893e0[_0x4b1a('0x3e')]);var _0x4d4747={'where':_0xed54b1[_0x4b1a('0x3b')]};return db[_0x4b1a('0x2a')][_0x4b1a('0x18')](_0x4d4747)[_0x4b1a('0x1f')](function(_0x5d00c0){_0x215045['count']=_0x5d00c0;if(_0x5893e0['query'][_0x4b1a('0x3f')]){_0xed54b1[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x2a')][_0x4b1a('0x41')](_0xed54b1);})[_0x4b1a('0x1f')](function(_0x4f4c77){_0x215045[_0x4b1a('0x42')]=_0x4f4c77;return _0x215045;})[_0x4b1a('0x1f')](respondWithFilteredResult(_0x4bd38c,_0xed54b1))[_0x4b1a('0x43')](handleError(_0x4bd38c,null));};exports[_0x4b1a('0x44')]=function(_0x46bf77,_0x161543){var _0x3db7a9={'raw':![],'where':{'id':_0x46bf77[_0x4b1a('0x45')]['id']}},_0x1a863e={};_0x1a863e[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')]);_0x1a863e['query']=_[_0x4b1a('0x2f')](_0x46bf77['query']);_0x1a863e[_0x4b1a('0x38')]=_[_0x4b1a('0x30')](_0x1a863e[_0x4b1a('0x31')],_0x1a863e[_0x4b1a('0x2e')]);_0x3db7a9[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x1a863e['model'],qs[_0x4b1a('0x33')](_0x46bf77[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x3db7a9[_0x4b1a('0x32')]=_0x3db7a9[_0x4b1a('0x32')]['length']?_0x3db7a9['attributes']:_0x1a863e['model'];if(_0x46bf77[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x3db7a9[_0x4b1a('0x40')]=[{'all':!![]}];}_0x3db7a9=_[_0x4b1a('0x3c')]({},_0x3db7a9,_0x46bf77[_0x4b1a('0x3e')]);return db[_0x4b1a('0x2a')][_0x4b1a('0x46')](_0x3db7a9)['then'](handleEntityNotFound(_0x161543,null))[_0x4b1a('0x1f')](respondWithResult(_0x161543,null))[_0x4b1a('0x43')](handleError(_0x161543,null));};exports[_0x4b1a('0x47')]=function(_0x601ecd,_0x4c3b46){return db[_0x4b1a('0x2a')][_0x4b1a('0x47')](_0x601ecd[_0x4b1a('0x48')],{})[_0x4b1a('0x1f')](function(_0x257e24){var _0x35966f=_0x601ecd[_0x4b1a('0x49')][_0x4b1a('0x20')]({'plain':!![]});if(!_0x35966f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35966f[_0x4b1a('0x4a')]===_0x4b1a('0x49')){var _0x1facd9=_0x257e24[_0x4b1a('0x20')]({'plain':!![]});var _0x42d686=_0x4b1a('0x21');return db[_0x4b1a('0x4b')][_0x4b1a('0x46')]({'where':{'name':_0x42d686,'userProfileId':_0x35966f[_0x4b1a('0x4c')]},'raw':!![]})[_0x4b1a('0x1f')](function(_0x3aa309){if(_0x3aa309&&_0x3aa309[_0x4b1a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x1facd9[_0x4b1a('0x26')],'resourceId':_0x1facd9['id'],'type':_0x3aa309['name'],'sectionId':_0x3aa309['id']},{})['then'](function(){return _0x257e24;});}else{return _0x257e24;}})[_0x4b1a('0x43')](function(_0x1b897c){logger[_0x4b1a('0x24')](_0x4b1a('0x4e'),_0x1b897c);throw _0x1b897c;});}return _0x257e24;})[_0x4b1a('0x1f')](respondWithResult(_0x4c3b46,0xc9))[_0x4b1a('0x43')](handleError(_0x4c3b46,null));};exports[_0x4b1a('0x4f')]=function(_0x3866a4,_0x1668b6){var _0x371ccf={'where':{'id':_0x3866a4[_0x4b1a('0x45')]['id']}},_0x208100={};_0x208100['model']=_[_0x4b1a('0x2f')](db['JscriptyProject'][_0x4b1a('0x2b')]);_0x371ccf['attributes']=_[_0x4b1a('0x30')](_0x208100[_0x4b1a('0x31')],qs['fields'](_0x3866a4[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x371ccf['attributes']=_0x371ccf[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x371ccf[_0x4b1a('0x32')]:_0x208100[_0x4b1a('0x31')];if(_0x3866a4[_0x4b1a('0x2e')]['includeAll']){_0x371ccf['include']=[{'all':!![]}];}_0x371ccf=_[_0x4b1a('0x3c')]({},_0x371ccf,_0x3866a4['options']);return db[_0x4b1a('0x2a')][_0x4b1a('0x46')](_0x371ccf)[_0x4b1a('0x1f')](handleEntityNotFound(_0x1668b6,null))[_0x4b1a('0x1f')](function(_0x4950ab){if(_0x4950ab){var _0x48976d=_0x4950ab[_0x4b1a('0x20')]({'plain':!![]});_0x48976d=qs[_0x4b1a('0x50')](_0x48976d,['id',_0x4b1a('0x51'),_0x4b1a('0x52')]);_0x3866a4[_0x4b1a('0x48')]=_[_0x4b1a('0x50')](_0x3866a4[_0x4b1a('0x48')],['id',_0x4b1a('0x51'),'updatedAt']);return db[_0x4b1a('0x2a')][_0x4b1a('0x47')](_[_0x4b1a('0x3c')](_0x48976d,_0x3866a4[_0x4b1a('0x48')]),{'include':_0x3866a4[_0x4b1a('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x4b1a('0x1f')](function(_0x1eff9f){var _0x30ce51=_0x3866a4['user'][_0x4b1a('0x20')]({'plain':!![]});if(!_0x30ce51)throw new Error(_0x4b1a('0x53'));if(_0x30ce51[_0x4b1a('0x4a')]===_0x4b1a('0x49')){var _0x2180cc=_0x1eff9f[_0x4b1a('0x20')]({'plain':!![]});var _0xc65a46=_0x4b1a('0x21');return db[_0x4b1a('0x4b')][_0x4b1a('0x46')]({'where':{'name':_0xc65a46,'userProfileId':_0x30ce51[_0x4b1a('0x4c')]},'raw':!![]})[_0x4b1a('0x1f')](function(_0x54ebed){if(_0x54ebed&&_0x54ebed['autoAssociation']===0x0){return db[_0x4b1a('0x22')][_0x4b1a('0x47')]({'name':_0x2180cc[_0x4b1a('0x26')],'resourceId':_0x2180cc['id'],'type':_0x54ebed[_0x4b1a('0x26')],'sectionId':_0x54ebed['id']},{})[_0x4b1a('0x1f')](function(){return _0x1eff9f;});}else{return _0x1eff9f;}})[_0x4b1a('0x43')](function(_0x33d038){logger[_0x4b1a('0x24')](_0x4b1a('0x4e'),_0x33d038);throw _0x33d038;});}return _0x1eff9f;});}})[_0x4b1a('0x1f')](respondWithResult(_0x1668b6,0xc9))[_0x4b1a('0x43')](handleError(_0x1668b6,null));};exports[_0x4b1a('0x1e')]=function(_0x2b8891,_0x1e72bc){if(_0x2b8891['body']['id']){delete _0x2b8891[_0x4b1a('0x48')]['id'];}return db[_0x4b1a('0x2a')][_0x4b1a('0x46')]({'where':{'id':_0x2b8891['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x1e72bc,null))[_0x4b1a('0x1f')](saveUpdates(_0x2b8891[_0x4b1a('0x48')],null))[_0x4b1a('0x1f')](respondWithResult(_0x1e72bc,null))[_0x4b1a('0x43')](handleError(_0x1e72bc,null));};exports[_0x4b1a('0x54')]=function(_0x5d7841,_0x4cceb8){return db[_0x4b1a('0x2a')][_0x4b1a('0x46')]({'where':{'id':_0x5d7841['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x4cceb8,null))['then'](removeEntity(_0x4cceb8,null))[_0x4b1a('0x43')](handleError(_0x4cceb8,null));};exports['getSessions']=function(_0x45a2a4,_0x166302,_0x4ee029){var _0x46be0e={'raw':!![],'where':{}};var _0x206d04={};var _0x33f33c={'count':0x0,'rows':[]};return db[_0x4b1a('0x2a')][_0x4b1a('0x55')]({'where':{'id':_0x45a2a4['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x166302,null))[_0x4b1a('0x1f')](function(_0x49a649){if(_0x49a649){_0x206d04[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db[_0x4b1a('0x56')][_0x4b1a('0x2b')]);_0x206d04[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x45a2a4[_0x4b1a('0x2e')]);_0x206d04[_0x4b1a('0x38')]=_[_0x4b1a('0x30')](_0x206d04['model'],_0x206d04[_0x4b1a('0x2e')]);_0x46be0e[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x206d04[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x46be0e['attributes']=_0x46be0e[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x46be0e[_0x4b1a('0x32')]:_0x206d04[_0x4b1a('0x31')];if(!_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x57')](_0x4b1a('0x35'))){_0x46be0e[_0x4b1a('0x36')]=qs[_0x4b1a('0x36')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x36')]);_0x46be0e[_0x4b1a('0x16')]=qs[_0x4b1a('0x16')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x16')]);}_0x46be0e['order']=qs[_0x4b1a('0x37')](_0x45a2a4['query']['sort']);_0x46be0e[_0x4b1a('0x3b')]=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x45a2a4[_0x4b1a('0x2e')],_0x206d04[_0x4b1a('0x38')]));_0x46be0e[_0x4b1a('0x3b')][_0x4b1a('0x58')]=_0x49a649['id'];if(_0x45a2a4['query'][_0x4b1a('0x3a')]){_0x46be0e[_0x4b1a('0x3b')]=_['merge'](_0x46be0e['where'],{'$or':_[_0x4b1a('0x29')](_0x46be0e[_0x4b1a('0x32')],function(_0x3fc193){var _0x203194={};_0x203194[_0x3fc193]={'$like':'%'+_0x45a2a4[_0x4b1a('0x2e')]['filter']+'%'};return _0x203194;})});}_0x46be0e=_[_0x4b1a('0x3c')]({},_0x46be0e,_0x45a2a4[_0x4b1a('0x3e')]);return db['JscriptySessionReport'][_0x4b1a('0x18')]({'where':_0x46be0e['where']})['then'](function(_0x55af1d){_0x33f33c['count']=_0x55af1d;if(_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x46be0e[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x56')][_0x4b1a('0x41')](_0x46be0e);})[_0x4b1a('0x1f')](function(_0x552cbe){_0x33f33c['rows']=_0x552cbe;return _0x33f33c;});}})[_0x4b1a('0x1f')](respondWithFilteredResult(_0x166302,_0x46be0e))['catch'](handleError(_0x166302,null));};exports[_0x4b1a('0x59')]=function(_0x3dbc75,_0x1d6728,_0x462c54){var _0x4f8c2b={'raw':!![],'where':{}};var _0x538f77={};var _0x5b85d8={'count':0x0,'rows':[]};return db[_0x4b1a('0x2a')][_0x4b1a('0x55')]({'where':{'id':_0x3dbc75[_0x4b1a('0x45')]['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x1d6728,null))['then'](function(_0x5306f1){if(_0x5306f1){_0x538f77[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db['JscriptyAnswerReport'][_0x4b1a('0x2b')]);_0x538f77[_0x4b1a('0x2e')]=_['keys'](_0x3dbc75[_0x4b1a('0x2e')]);_0x538f77['filters']=_[_0x4b1a('0x30')](_0x538f77[_0x4b1a('0x31')],_0x538f77[_0x4b1a('0x2e')]);_0x4f8c2b[_0x4b1a('0x32')]=_['intersection'](_0x538f77[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x4f8c2b[_0x4b1a('0x32')]=_0x4f8c2b[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x4f8c2b[_0x4b1a('0x32')]:_0x538f77['model'];if(!_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x57')](_0x4b1a('0x35'))){_0x4f8c2b[_0x4b1a('0x36')]=qs['limit'](_0x3dbc75['query'][_0x4b1a('0x36')]);_0x4f8c2b['offset']=qs[_0x4b1a('0x16')](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x16')]);}_0x4f8c2b[_0x4b1a('0x5a')]=qs['sort'](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x37')]);_0x4f8c2b['where']=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x3dbc75[_0x4b1a('0x2e')],_0x538f77[_0x4b1a('0x38')]));_0x4f8c2b['where'][_0x4b1a('0x58')]=_0x5306f1['id'];if(_0x3dbc75['query'][_0x4b1a('0x3a')]){_0x4f8c2b[_0x4b1a('0x3b')]=_[_0x4b1a('0x3c')](_0x4f8c2b['where'],{'$or':_[_0x4b1a('0x29')](_0x4f8c2b[_0x4b1a('0x32')],function(_0x25afc3){var _0x3f9be8={};_0x3f9be8[_0x25afc3]={'$like':'%'+_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x3a')]+'%'};return _0x3f9be8;})});}_0x4f8c2b=_[_0x4b1a('0x3c')]({},_0x4f8c2b,_0x3dbc75[_0x4b1a('0x3e')]);return db[_0x4b1a('0x5b')][_0x4b1a('0x18')]({'where':_0x4f8c2b[_0x4b1a('0x3b')]})[_0x4b1a('0x1f')](function(_0x46f4a9){_0x5b85d8[_0x4b1a('0x18')]=_0x46f4a9;if(_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x4f8c2b[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x5b')]['findAll'](_0x4f8c2b);})[_0x4b1a('0x1f')](function(_0x3501b2){_0x5b85d8[_0x4b1a('0x42')]=_0x3501b2;return _0x5b85d8;});}})['then'](respondWithFilteredResult(_0x1d6728,_0x4f8c2b))[_0x4b1a('0x43')](handleError(_0x1d6728,null));};function char(_0x58978f){return _0x4b1a('0x5c')===typeof _0x58978f?String[_0x4b1a('0x5d')][_0x4b1a('0x1c')](null,arguments):_0x58978f;}function needsEncapsulation(_0x1f8f5a){return!!_0x1f8f5a&&(_0x1f8f5a['toString']()[_0x4b1a('0x5e')](char(0xd))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()[_0x4b1a('0x5e')](char(0xa))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()[_0x4b1a('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x587a7e){var _0x467dbf=char(0x22),_0x37c1b4='\x5c'+char(0x22),_0x47b966=_0x587a7e[_0x4b1a('0x5f')]()[_0x4b1a('0x60')](new RegExp(_0x467dbf,'g'),_0x37c1b4);return _0x467dbf+_0x47b966+_0x467dbf;}exports[_0x4b1a('0x61')]=function(_0x177875,_0x255c5d,_0x2ec680){var _0x32ae84,_0x1f159c;var _0x15c4eb={'where':{'ProjectId':_0x177875[_0x4b1a('0x45')]['id']}};if(_0x177875[_0x4b1a('0x2e')][_0x4b1a('0x62')]){_0x15c4eb[_0x4b1a('0x3b')][_0x4b1a('0x63')]=JSON[_0x4b1a('0x64')](_0x177875[_0x4b1a('0x2e')][_0x4b1a('0x62')]);}return db[_0x4b1a('0x56')][_0x4b1a('0x41')](_0x15c4eb)[_0x4b1a('0x1f')](handleEntityNotFound(_0x255c5d,null))[_0x4b1a('0x1f')](function(_0x578677){if(_0x578677){_0x32ae84=_0x578677;return db[_0x4b1a('0x65')][_0x4b1a('0x41')]({'where':{'SessionId':{'$in':_[_0x4b1a('0x29')](_0x32ae84,'id')},'ProjectId':_0x177875['params']['id']},'order':_0x4b1a('0x66')});}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x255c5d,null))['then'](function(_0x3eb66d){if(_0x3eb66d){_0x1f159c=_0x3eb66d;var _0x4e05de={};for(var _0x5ca08c=0x0,_0x3a9263=_0x1f159c[_0x4b1a('0x34')];_0x5ca08c<_0x3a9263;_0x5ca08c++){if(!_0x4e05de['hasOwnProperty'](_0x1f159c[_0x5ca08c][_0x4b1a('0x67')])){_0x4e05de[_0x1f159c[_0x5ca08c][_0x4b1a('0x67')]]=needsEncapsulation(_0x1f159c[_0x5ca08c][_0x4b1a('0x68')])?encapsulate(_0x1f159c[_0x5ca08c][_0x4b1a('0x68')]):_0x1f159c[_0x5ca08c][_0x4b1a('0x68')];}}var _0xbf276a=[],_0x520e39={};for(var _0x2918e5=0x0,_0x1e3908=_0x32ae84[_0x4b1a('0x34')];_0x2918e5<_0x1e3908;_0x2918e5++){_0x520e39={'ProjectId':_0x177875[_0x4b1a('0x45')]['id'],'SessionId':_0x32ae84[_0x2918e5]['id'],'StartTime':moment(_0x32ae84[_0x2918e5]['starttime'])[_0x4b1a('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3b6f46=0x0,_0x61b5d2=_0x1f159c[_0x4b1a('0x34')];_0x3b6f46<_0x61b5d2;_0x3b6f46++){if(_0x1f159c[_0x3b6f46][_0x4b1a('0x6a')]==_0x32ae84[_0x2918e5]['id']&&_0x4e05de[_0x4b1a('0x57')](_0x1f159c[_0x3b6f46][_0x4b1a('0x67')])){_0x520e39[_0x4e05de[_0x1f159c[_0x3b6f46][_0x4b1a('0x67')]]]=_0x1f159c[_0x3b6f46][_0x4b1a('0x6b')];}}for(var _0x285d78 in _0x4e05de){if(!_0x520e39[_0x4b1a('0x57')](_0x4e05de[_0x285d78])){_0x520e39[_0x4e05de[_0x285d78]]=null;}}_0xbf276a['push'](_0x520e39);}return _0xbf276a;}})['then'](function(_0x4a200b){if(!_[_0x4b1a('0x6c')](_0x4a200b)){var _0x2b8402=toCsv(_0x4a200b);var _0x48b389=Date[_0x4b1a('0x6d')]();fs[_0x4b1a('0x6e')](util[_0x4b1a('0x69')](_0x4b1a('0x6f'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389),_0x2b8402);_0x255c5d[_0x4b1a('0x70')]('Content-disposition',_0x4b1a('0x71')+util[_0x4b1a('0x69')](_0x4b1a('0x72'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389));_0x255c5d[_0x4b1a('0x70')](_0x4b1a('0x73'),_0x4b1a('0x74'));return _0x255c5d[_0x4b1a('0x75')](util[_0x4b1a('0x69')](_0x4b1a('0x6f'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389));}else{return _0x255c5d[_0x4b1a('0x23')](0xcc);}})[_0x4b1a('0x43')](handleError(_0x255c5d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2244329..3031674 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 _0x63b6=['rimraf','../../config/environment','./jscriptyProject.attributes','define','jscripty_projects','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63b6,0x127));var _0x663b=function(_0x440a26,_0xf3f67d){_0x440a26=_0x440a26-0x0;var _0x505dc7=_0x63b6[_0x440a26];return _0x505dc7;};'use strict';var _=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var logger=require(_0x663b('0x2'))('api');var moment=require(_0x663b('0x3'));var BPromise=require('bluebird');var rp=require(_0x663b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var attributes=require(_0x663b('0x7'));module['exports']=function(_0x4486b1,_0x57e43e){return _0x4486b1[_0x663b('0x8')]('JscriptyProject',attributes,{'tableName':_0x663b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c1f=['path','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x5c1f[_0x593d89];return _0x4aa403;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var logger=require(_0xf5c1('0x1'))(_0xf5c1('0x2'));var moment=require('moment');var BPromise=require(_0xf5c1('0x3'));var rp=require(_0xf5c1('0x4'));var fs=require('fs');var path=require(_0xf5c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf5c1('0x6')]=function(_0x3a7475,_0x52e4cb){return _0x3a7475[_0xf5c1('0x7')](_0xf5c1('0x8'),attributes,{'tableName':_0xf5c1('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 91aede9..6cd91cf 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac4a,0x13f));var _0xaac4=function(_0x2ec8cb,_0x558afe){_0x2ec8cb=_0x2ec8cb-0x0;var _0xc21cde=_0xac4a[_0x2ec8cb];return _0xc21cde;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x295bc0,_0x1903af){_0x295bc0=_0x295bc0-0x0;var _0x300115=_0xbdb7[_0x295bc0];return _0x300115;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5487d30..7f1a489 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 _0xdf85=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3eea0a,_0x4d4e75){var _0x211124=function(_0x18ca17){while(--_0x18ca17){_0x3eea0a['push'](_0x3eea0a['shift']());}};_0x211124(++_0x4d4e75);}(_0xdf85,0x194));var _0x5df8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xdf85[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x5df8('0x0'));var util=require(_0x5df8('0x1'));var path=require(_0x5df8('0x2'));var timeout=require(_0x5df8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5df8('0x4'));var controller=require(_0x5df8('0x5'));router[_0x5df8('0x6')]('/',auth[_0x5df8('0x7')](),controller['index']);router[_0x5df8('0x6')](_0x5df8('0x8'),auth[_0x5df8('0x7')](),controller[_0x5df8('0x9')]);router[_0x5df8('0x6')](_0x5df8('0xa'),auth[_0x5df8('0x7')](),controller[_0x5df8('0xb')]);router[_0x5df8('0xc')]('/',auth[_0x5df8('0x7')](),controller['create']);router[_0x5df8('0xd')]('/:id',auth[_0x5df8('0x7')](),controller[_0x5df8('0xe')]);router['delete'](_0x5df8('0xa'),auth[_0x5df8('0x7')](),controller[_0x5df8('0xf')]);module[_0x5df8('0x10')]=router; \ No newline at end of file +var _0x5ff1=['post','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x5ea764,_0xbdbc17){var _0x306aff=function(_0x17b459){while(--_0x17b459){_0x5ea764['push'](_0x5ea764['shift']());}};_0x306aff(++_0xbdbc17);}(_0x5ff1,0xba));var _0x15ff=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x5ff1[_0x37a9d7];return _0x1343d3;};'use strict';var multer=require('multer');var util=require(_0x15ff('0x0'));var path=require(_0x15ff('0x1'));var timeout=require(_0x15ff('0x2'));var express=require(_0x15ff('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15ff('0x4'));var interaction=require(_0x15ff('0x5'));var config=require(_0x15ff('0x6'));var controller=require(_0x15ff('0x7'));router[_0x15ff('0x8')]('/',auth[_0x15ff('0x9')](),controller['index']);router[_0x15ff('0x8')](_0x15ff('0xa'),auth[_0x15ff('0x9')](),controller[_0x15ff('0xb')]);router[_0x15ff('0x8')](_0x15ff('0xc'),auth[_0x15ff('0x9')](),controller[_0x15ff('0xd')]);router[_0x15ff('0xe')]('/',auth['isAuthenticated'](),controller[_0x15ff('0xf')]);router[_0x15ff('0x10')](_0x15ff('0xc'),auth['isAuthenticated'](),controller[_0x15ff('0x11')]);router['delete']('/:id',auth[_0x15ff('0x9')](),controller[_0x15ff('0x12')]);module[_0x15ff('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 b148bee..4ce85eb 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x15dc0a,_0x4dad1b){_0x15dc0a=_0x15dc0a-0x0;var _0x518fcc=_0x7a54[_0x15dc0a];return _0x518fcc;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x1ca65a,_0x1a24e7){_0x1ca65a=_0x1ca65a-0x0;var _0x4fc499=_0x7a54[_0x1ca65a];return _0x4fc499;};'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 e3975f3..011e031 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 _0x8cf5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','JscriptyQuestionReport','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x8cf5,0x154));var _0x58cf=function(_0x460a08,_0x57f832){_0x460a08=_0x460a08-0x0;var _0x48467e=_0x8cf5[_0x460a08];return _0x48467e;};'use strict';var emlformat=require(_0x58cf('0x0'));var rimraf=require(_0x58cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58cf('0x2'));var rp=require(_0x58cf('0x3'));var moment=require(_0x58cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x58cf('0x5'));var util=require(_0x58cf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x58cf('0x7'));var ejs=require(_0x58cf('0x8'));var fs=require('fs');var fs_extra=require(_0x58cf('0x9'));var _=require(_0x58cf('0xa'));var squel=require(_0x58cf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x58cf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58cf('0xc'));var authService=require(_0x58cf('0xd'));var qs=require(_0x58cf('0xe'));var as=require(_0x58cf('0xf'));var hardwareService=require(_0x58cf('0x10'));var logger=require(_0x58cf('0x11'))(_0x58cf('0x12'));var utils=require(_0x58cf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e69ed,_0x17a3bd){_0x17a3bd=_0x17a3bd||0xcc;return function(_0x2c0623){if(_0x2c0623){return _0x3e69ed[_0x58cf('0x14')](_0x17a3bd);}return _0x3e69ed[_0x58cf('0x15')](_0x17a3bd)[_0x58cf('0x16')]();};}function respondWithResult(_0x5cfd84,_0x5cd5b1){_0x5cd5b1=_0x5cd5b1||0xc8;return function(_0x4f8619){if(_0x4f8619){return _0x5cfd84[_0x58cf('0x15')](_0x5cd5b1)[_0x58cf('0x17')](_0x4f8619);}};}function respondWithFilteredResult(_0x34e4ec,_0x5c7d2e){return function(_0x5c6bbb){if(_0x5c6bbb){var _0xf1f47c=typeof _0x5c7d2e[_0x58cf('0x18')]==='undefined'&&typeof _0x5c7d2e[_0x58cf('0x19')]===_0x58cf('0x1a');var _0x383a5b=_0x5c6bbb[_0x58cf('0x1b')];var _0x484c76=_0xf1f47c?0x0:_0x5c7d2e[_0x58cf('0x18')];var _0x116226=_0xf1f47c?_0x5c6bbb[_0x58cf('0x1b')]:_0x5c7d2e['offset']+_0x5c7d2e[_0x58cf('0x19')];var _0x33590d;if(_0x116226>=_0x383a5b){_0x116226=_0x383a5b;_0x33590d=0xc8;}else{_0x33590d=0xce;}_0x34e4ec[_0x58cf('0x15')](_0x33590d);return _0x34e4ec[_0x58cf('0x1c')](_0x58cf('0x1d'),_0x484c76+'-'+_0x116226+'/'+_0x383a5b)[_0x58cf('0x17')](_0x5c6bbb);}return null;};}function patchUpdates(_0x43b35d){return function(_0x1da619){try{jsonpatch['apply'](_0x1da619,_0x43b35d,!![]);}catch(_0x3fe3fd){return BPromise[_0x58cf('0x1e')](_0x3fe3fd);}return _0x1da619[_0x58cf('0x1f')]();};}function saveUpdates(_0x195995,_0x4dbb72){return function(_0x1a2fb2){if(_0x1a2fb2){return _0x1a2fb2[_0x58cf('0x20')](_0x195995)[_0x58cf('0x21')](function(_0x8251ff){return _0x8251ff;});}return null;};}function removeEntity(_0x2a76c1,_0x10b536){return function(_0xcf3b56){if(_0xcf3b56){return _0xcf3b56[_0x58cf('0x22')]()[_0x58cf('0x21')](function(){_0x2a76c1[_0x58cf('0x15')](0xcc)[_0x58cf('0x16')]();});}};}function handleEntityNotFound(_0x375aa3,_0x1e2475){return function(_0x1e0eb8){if(!_0x1e0eb8){_0x375aa3[_0x58cf('0x14')](0x194);}return _0x1e0eb8;};}function handleError(_0x536df6,_0x3ae698){_0x3ae698=_0x3ae698||0x1f4;return function(_0x228660){logger[_0x58cf('0x23')](_0x228660[_0x58cf('0x24')]);if(_0x228660[_0x58cf('0x25')]){delete _0x228660[_0x58cf('0x25')];}_0x536df6[_0x58cf('0x15')](_0x3ae698)['send'](_0x228660);};}exports[_0x58cf('0x26')]=function(_0xbab33f,_0x17e3aa){var _0x54c789={},_0x187ee4={},_0xd52e38={'count':0x0,'rows':[]};var _0x49d599=_['map'](db[_0x58cf('0x27')]['rawAttributes'],function(_0x3e5b42){return{'name':_0x3e5b42[_0x58cf('0x28')],'type':_0x3e5b42[_0x58cf('0x29')][_0x58cf('0x2a')]};});_0x187ee4[_0x58cf('0x2b')]=_[_0x58cf('0x2c')](_0x49d599,_0x58cf('0x25'));_0x187ee4[_0x58cf('0x2d')]=_['keys'](_0xbab33f[_0x58cf('0x2d')]);_0x187ee4['filters']=_[_0x58cf('0x2e')](_0x187ee4[_0x58cf('0x2b')],_0x187ee4[_0x58cf('0x2d')]);_0x54c789[_0x58cf('0x2f')]=_['intersection'](_0x187ee4['model'],qs['fields'](_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x30')]));_0x54c789[_0x58cf('0x2f')]=_0x54c789[_0x58cf('0x2f')][_0x58cf('0x31')]?_0x54c789[_0x58cf('0x2f')]:_0x187ee4['model'];if(!_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x32')]('nolimit')){_0x54c789[_0x58cf('0x19')]=qs[_0x58cf('0x19')](_0xbab33f['query'][_0x58cf('0x19')]);_0x54c789[_0x58cf('0x18')]=qs[_0x58cf('0x18')](_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x18')]);}_0x54c789['order']=qs[_0x58cf('0x33')](_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x33')]);_0x54c789[_0x58cf('0x34')]=qs[_0x58cf('0x35')](_[_0x58cf('0x36')](_0xbab33f[_0x58cf('0x2d')],_0x187ee4[_0x58cf('0x35')]),_0x49d599);if(_0xbab33f[_0x58cf('0x2d')]['filter']){_0x54c789[_0x58cf('0x34')]=_[_0x58cf('0x37')](_0x54c789['where'],{'$or':_[_0x58cf('0x2c')](_0x49d599,function(_0x196a23){if(_0x196a23[_0x58cf('0x29')]!==_0x58cf('0x38')){var _0x4eab68={};_0x4eab68[_0x196a23[_0x58cf('0x25')]]={'$like':'%'+_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x39')]+'%'};return _0x4eab68;}})});}_0x54c789=_[_0x58cf('0x37')]({},_0x54c789,_0xbab33f['options']);var _0x5773b6={'where':_0x54c789[_0x58cf('0x34')]};return db[_0x58cf('0x27')][_0x58cf('0x1b')](_0x5773b6)[_0x58cf('0x21')](function(_0x3a9f3e){_0xd52e38[_0x58cf('0x1b')]=_0x3a9f3e;if(_0xbab33f[_0x58cf('0x2d')][_0x58cf('0x3a')]){_0x54c789[_0x58cf('0x3b')]=[{'all':!![]}];}return db[_0x58cf('0x27')][_0x58cf('0x3c')](_0x54c789);})[_0x58cf('0x21')](function(_0x2613a2){_0xd52e38[_0x58cf('0x3d')]=_0x2613a2;return _0xd52e38;})[_0x58cf('0x21')](respondWithFilteredResult(_0x17e3aa,_0x54c789))[_0x58cf('0x3e')](handleError(_0x17e3aa,null));};exports['show']=function(_0xf33ad3,_0x496d07){var _0x1ee9c5={'raw':!![],'where':{'id':_0xf33ad3[_0x58cf('0x3f')]['id']}},_0x2695e9={};_0x2695e9[_0x58cf('0x2b')]=_[_0x58cf('0x40')](db[_0x58cf('0x27')][_0x58cf('0x41')]);_0x2695e9['query']=_['keys'](_0xf33ad3[_0x58cf('0x2d')]);_0x2695e9['filters']=_[_0x58cf('0x2e')](_0x2695e9['model'],_0x2695e9[_0x58cf('0x2d')]);_0x1ee9c5[_0x58cf('0x2f')]=_['intersection'](_0x2695e9[_0x58cf('0x2b')],qs[_0x58cf('0x30')](_0xf33ad3[_0x58cf('0x2d')]['fields']));_0x1ee9c5[_0x58cf('0x2f')]=_0x1ee9c5[_0x58cf('0x2f')][_0x58cf('0x31')]?_0x1ee9c5[_0x58cf('0x2f')]:_0x2695e9[_0x58cf('0x2b')];if(_0xf33ad3['query'][_0x58cf('0x3a')]){_0x1ee9c5[_0x58cf('0x3b')]=[{'all':!![]}];}_0x1ee9c5=_['merge']({},_0x1ee9c5,_0xf33ad3[_0x58cf('0x42')]);return db[_0x58cf('0x27')]['find'](_0x1ee9c5)[_0x58cf('0x21')](handleEntityNotFound(_0x496d07,null))[_0x58cf('0x21')](respondWithResult(_0x496d07,null))[_0x58cf('0x3e')](handleError(_0x496d07,null));};exports[_0x58cf('0x43')]=function(_0x22916f,_0x7b542d){return db[_0x58cf('0x27')]['create'](_0x22916f[_0x58cf('0x44')],{})[_0x58cf('0x21')](respondWithResult(_0x7b542d,0xc9))[_0x58cf('0x3e')](handleError(_0x7b542d,null));};exports[_0x58cf('0x20')]=function(_0x34685f,_0x5434ca){if(_0x34685f[_0x58cf('0x44')]['id']){delete _0x34685f[_0x58cf('0x44')]['id'];}return db[_0x58cf('0x27')][_0x58cf('0x45')]({'where':{'id':_0x34685f[_0x58cf('0x3f')]['id']}})[_0x58cf('0x21')](handleEntityNotFound(_0x5434ca,null))[_0x58cf('0x21')](saveUpdates(_0x34685f['body'],null))[_0x58cf('0x21')](respondWithResult(_0x5434ca,null))[_0x58cf('0x3e')](handleError(_0x5434ca,null));};exports[_0x58cf('0x22')]=function(_0x4a7673,_0x3ae47c){return db[_0x58cf('0x27')][_0x58cf('0x45')]({'where':{'id':_0x4a7673['params']['id']}})[_0x58cf('0x21')](handleEntityNotFound(_0x3ae47c,null))['then'](removeEntity(_0x3ae47c,null))[_0x58cf('0x3e')](handleError(_0x3ae47c,null));};exports[_0x58cf('0x46')]=function(_0x1dc26f,_0x2cd5ed){return db[_0x58cf('0x27')][_0x58cf('0x46')]()[_0x58cf('0x21')](respondWithResult(_0x2cd5ed,null))[_0x58cf('0x3e')](handleError(_0x2cd5ed,null));}; \ No newline at end of file +var _0x0353=['fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x3e17ee,_0x3c1cbb){var _0x6df9ca=function(_0x2e7a24){while(--_0x2e7a24){_0x3e17ee['push'](_0x3e17ee['shift']());}};_0x6df9ca(++_0x3c1cbb);}(_0x0353,0x8d));var _0x3035=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x0353[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require(_0x3035('0x0'));var rimraf=require(_0x3035('0x1'));var zipdir=require(_0x3035('0x2'));var jsonpatch=require(_0x3035('0x3'));var rp=require(_0x3035('0x4'));var moment=require(_0x3035('0x5'));var BPromise=require(_0x3035('0x6'));var Mustache=require(_0x3035('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3035('0x8'));var csv=require(_0x3035('0x9'));var ejs=require(_0x3035('0xa'));var fs=require('fs');var fs_extra=require(_0x3035('0xb'));var _=require(_0x3035('0xc'));var squel=require(_0x3035('0xd'));var crypto=require(_0x3035('0xe'));var jsforce=require(_0x3035('0xf'));var deskjs=require(_0x3035('0x10'));var toCsv=require(_0x3035('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3035('0x11'));var as=require(_0x3035('0x12'));var hardwareService=require(_0x3035('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3035('0x14'));var config=require(_0x3035('0x15'));var licenseUtil=require(_0x3035('0x16'));var db=require(_0x3035('0x17'))['db'];function respondWithStatusCode(_0x1c387a,_0x2116ec){_0x2116ec=_0x2116ec||0xcc;return function(_0x4c60e2){if(_0x4c60e2){return _0x1c387a['sendStatus'](_0x2116ec);}return _0x1c387a[_0x3035('0x18')](_0x2116ec)['end']();};}function respondWithResult(_0x5ab6c6,_0x26a538){_0x26a538=_0x26a538||0xc8;return function(_0x3bf7af){if(_0x3bf7af){return _0x5ab6c6[_0x3035('0x18')](_0x26a538)[_0x3035('0x19')](_0x3bf7af);}};}function respondWithFilteredResult(_0x57139b,_0x4631c0){return function(_0x23bead){if(_0x23bead){var _0x1d70a9=typeof _0x4631c0[_0x3035('0x1a')]===_0x3035('0x1b')&&typeof _0x4631c0[_0x3035('0x1c')]===_0x3035('0x1b');var _0x59d819=_0x23bead[_0x3035('0x1d')];var _0x1a458a=_0x1d70a9?0x0:_0x4631c0[_0x3035('0x1a')];var _0x5e65dc=_0x1d70a9?_0x23bead[_0x3035('0x1d')]:_0x4631c0[_0x3035('0x1a')]+_0x4631c0['limit'];var _0x529547;if(_0x5e65dc>=_0x59d819){_0x5e65dc=_0x59d819;_0x529547=0xc8;}else{_0x529547=0xce;}_0x57139b[_0x3035('0x18')](_0x529547);return _0x57139b[_0x3035('0x1e')]('Content-Range',_0x1a458a+'-'+_0x5e65dc+'/'+_0x59d819)[_0x3035('0x19')](_0x23bead);}return null;};}function patchUpdates(_0x5904cf){return function(_0x3970b0){try{jsonpatch[_0x3035('0x1f')](_0x3970b0,_0x5904cf,!![]);}catch(_0x11d0f0){return BPromise[_0x3035('0x20')](_0x11d0f0);}return _0x3970b0[_0x3035('0x21')]();};}function saveUpdates(_0x826338,_0x256976){return function(_0x211ef){if(_0x211ef){return _0x211ef[_0x3035('0x22')](_0x826338)[_0x3035('0x23')](function(_0x5649db){return _0x5649db;});}return null;};}function removeEntity(_0x10713f,_0x4cfa4d){return function(_0x18d909){if(_0x18d909){return _0x18d909[_0x3035('0x24')]()[_0x3035('0x23')](function(){_0x10713f[_0x3035('0x18')](0xcc)[_0x3035('0x25')]();});}};}function handleEntityNotFound(_0x2ddc4c,_0x370552){return function(_0x2e34b9){if(!_0x2e34b9){_0x2ddc4c[_0x3035('0x26')](0x194);}return _0x2e34b9;};}function handleError(_0x2871d1,_0x169e0b){_0x169e0b=_0x169e0b||0x1f4;return function(_0x519632){logger[_0x3035('0x27')](_0x519632[_0x3035('0x28')]);if(_0x519632[_0x3035('0x29')]){delete _0x519632['name'];}_0x2871d1['status'](_0x169e0b)['send'](_0x519632);};}exports[_0x3035('0x2a')]=function(_0x5370b7,_0x220e1e){var _0xc14a53={},_0x50080a={},_0x268461={'count':0x0,'rows':[]};var _0x357e52=_[_0x3035('0x2b')](db[_0x3035('0x2c')][_0x3035('0x2d')],function(_0x128239){return{'name':_0x128239['fieldName'],'type':_0x128239[_0x3035('0x2e')][_0x3035('0x2f')]};});_0x50080a[_0x3035('0x30')]=_[_0x3035('0x2b')](_0x357e52,_0x3035('0x29'));_0x50080a['query']=_[_0x3035('0x31')](_0x5370b7[_0x3035('0x32')]);_0x50080a[_0x3035('0x33')]=_['intersection'](_0x50080a['model'],_0x50080a[_0x3035('0x32')]);_0xc14a53['attributes']=_['intersection'](_0x50080a['model'],qs[_0x3035('0x34')](_0x5370b7[_0x3035('0x32')][_0x3035('0x34')]));_0xc14a53[_0x3035('0x35')]=_0xc14a53[_0x3035('0x35')]['length']?_0xc14a53[_0x3035('0x35')]:_0x50080a['model'];if(!_0x5370b7[_0x3035('0x32')][_0x3035('0x36')](_0x3035('0x37'))){_0xc14a53[_0x3035('0x1c')]=qs[_0x3035('0x1c')](_0x5370b7[_0x3035('0x32')][_0x3035('0x1c')]);_0xc14a53[_0x3035('0x1a')]=qs['offset'](_0x5370b7[_0x3035('0x32')][_0x3035('0x1a')]);}_0xc14a53[_0x3035('0x38')]=qs[_0x3035('0x39')](_0x5370b7['query'][_0x3035('0x39')]);_0xc14a53[_0x3035('0x3a')]=qs[_0x3035('0x33')](_['pick'](_0x5370b7[_0x3035('0x32')],_0x50080a['filters']),_0x357e52);if(_0x5370b7[_0x3035('0x32')][_0x3035('0x3b')]){_0xc14a53[_0x3035('0x3a')]=_['merge'](_0xc14a53['where'],{'$or':_['map'](_0x357e52,function(_0xeeeb8b){if(_0xeeeb8b[_0x3035('0x2e')]!==_0x3035('0x3c')){var _0x53cf17={};_0x53cf17[_0xeeeb8b[_0x3035('0x29')]]={'$like':'%'+_0x5370b7[_0x3035('0x32')][_0x3035('0x3b')]+'%'};return _0x53cf17;}})});}_0xc14a53=_['merge']({},_0xc14a53,_0x5370b7[_0x3035('0x3d')]);var _0x2d5459={'where':_0xc14a53[_0x3035('0x3a')]};return db[_0x3035('0x2c')][_0x3035('0x1d')](_0x2d5459)[_0x3035('0x23')](function(_0x2104fa){_0x268461['count']=_0x2104fa;if(_0x5370b7['query'][_0x3035('0x3e')]){_0xc14a53[_0x3035('0x3f')]=[{'all':!![]}];}return db[_0x3035('0x2c')][_0x3035('0x40')](_0xc14a53);})[_0x3035('0x23')](function(_0x14bcb7){_0x268461[_0x3035('0x41')]=_0x14bcb7;return _0x268461;})[_0x3035('0x23')](respondWithFilteredResult(_0x220e1e,_0xc14a53))[_0x3035('0x42')](handleError(_0x220e1e,null));};exports[_0x3035('0x43')]=function(_0x52a5d6,_0x5dd34b){var _0x4393bf={'raw':!![],'where':{'id':_0x52a5d6[_0x3035('0x44')]['id']}},_0x187629={};_0x187629['model']=_[_0x3035('0x31')](db[_0x3035('0x2c')][_0x3035('0x2d')]);_0x187629['query']=_[_0x3035('0x31')](_0x52a5d6[_0x3035('0x32')]);_0x187629[_0x3035('0x33')]=_[_0x3035('0x45')](_0x187629[_0x3035('0x30')],_0x187629[_0x3035('0x32')]);_0x4393bf[_0x3035('0x35')]=_[_0x3035('0x45')](_0x187629[_0x3035('0x30')],qs[_0x3035('0x34')](_0x52a5d6[_0x3035('0x32')][_0x3035('0x34')]));_0x4393bf[_0x3035('0x35')]=_0x4393bf[_0x3035('0x35')][_0x3035('0x46')]?_0x4393bf[_0x3035('0x35')]:_0x187629[_0x3035('0x30')];if(_0x52a5d6['query'][_0x3035('0x3e')]){_0x4393bf['include']=[{'all':!![]}];}_0x4393bf=_[_0x3035('0x47')]({},_0x4393bf,_0x52a5d6[_0x3035('0x3d')]);return db[_0x3035('0x2c')][_0x3035('0x48')](_0x4393bf)['then'](handleEntityNotFound(_0x5dd34b,null))[_0x3035('0x23')](respondWithResult(_0x5dd34b,null))[_0x3035('0x42')](handleError(_0x5dd34b,null));};exports[_0x3035('0x49')]=function(_0x2b8749,_0x1b69e5){return db[_0x3035('0x2c')][_0x3035('0x49')](_0x2b8749['body'],{})[_0x3035('0x23')](respondWithResult(_0x1b69e5,0xc9))[_0x3035('0x42')](handleError(_0x1b69e5,null));};exports[_0x3035('0x22')]=function(_0x9b0e5c,_0xde4da0){if(_0x9b0e5c[_0x3035('0x4a')]['id']){delete _0x9b0e5c['body']['id'];}return db[_0x3035('0x2c')][_0x3035('0x48')]({'where':{'id':_0x9b0e5c[_0x3035('0x44')]['id']}})['then'](handleEntityNotFound(_0xde4da0,null))[_0x3035('0x23')](saveUpdates(_0x9b0e5c[_0x3035('0x4a')],null))['then'](respondWithResult(_0xde4da0,null))[_0x3035('0x42')](handleError(_0xde4da0,null));};exports[_0x3035('0x24')]=function(_0x547287,_0x1f7c1b){return db[_0x3035('0x2c')]['find']({'where':{'id':_0x547287[_0x3035('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f7c1b,null))['then'](removeEntity(_0x1f7c1b,null))[_0x3035('0x42')](handleError(_0x1f7c1b,null));};exports[_0x3035('0x4b')]=function(_0x30a69f,_0x4d30c3){return db[_0x3035('0x2c')][_0x3035('0x4b')]()['then'](respondWithResult(_0x4d30c3,null))[_0x3035('0x42')](handleError(_0x4d30c3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 981cf48..b22c47a 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 _0x3d85=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','request-promise','rimraf','./jscriptyQuestionReport.attributes','exports'];(function(_0x28abcc,_0x491ec2){var _0x3ab43d=function(_0x134eec){while(--_0x134eec){_0x28abcc['push'](_0x28abcc['shift']());}};_0x3ab43d(++_0x491ec2);}(_0x3d85,0x1a5));var _0x53d8=function(_0x4e2011,_0xaca3dd){_0x4e2011=_0x4e2011-0x0;var _0x155cd5=_0x3d85[_0x4e2011];return _0x155cd5;};'use strict';var _=require(_0x53d8('0x0'));var util=require('util');var logger=require(_0x53d8('0x1'))(_0x53d8('0x2'));var moment=require(_0x53d8('0x3'));var BPromise=require('bluebird');var rp=require(_0x53d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d8('0x5'));var config=require('../../config/environment');var attributes=require(_0x53d8('0x6'));module[_0x53d8('0x7')]=function(_0x1c0232,_0x532d07){return _0x1c0232[_0x53d8('0x8')](_0x53d8('0x9'),attributes,{'tableName':_0x53d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x974b=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x1b94ee,_0x4b9362){var _0x3462c9=function(_0x561612){while(--_0x561612){_0x1b94ee['push'](_0x1b94ee['shift']());}};_0x3462c9(++_0x4b9362);}(_0x974b,0xc4));var _0xb974=function(_0x51de21,_0x2143bb){_0x51de21=_0x51de21-0x0;var _0x11e461=_0x974b[_0x51de21];return _0x11e461;};'use strict';var _=require(_0xb974('0x0'));var util=require(_0xb974('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb974('0x2'));var BPromise=require(_0xb974('0x3'));var rp=require(_0xb974('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb974('0x5'));var config=require(_0xb974('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xb974('0x7')]=function(_0x518c5d,_0x1458d0){return _0x518c5d[_0xb974('0x8')](_0xb974('0x9'),attributes,{'tableName':_0xb974('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 8549026..88520e3 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 _0x3c14=['../../config/logger','../../config/environment','jayson/promise','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd80630,_0x5834be){var _0x2da455=function(_0x543c19){while(--_0x543c19){_0xd80630['push'](_0xd80630['shift']());}};_0x2da455(++_0x5834be);}(_0x3c14,0x176));var _0x43c1=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x3c14[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x43c1('0x0'));var util=require('util');var moment=require(_0x43c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x43c1('0x2'));var fs=require('fs');var Redis=require(_0x43c1('0x3'));var db=require(_0x43c1('0x4'))['db'];var utils=require(_0x43c1('0x5'));var logger=require(_0x43c1('0x6'))('rpc');var config=require(_0x43c1('0x7'));var jayson=require(_0x43c1('0x8'));var client=jayson[_0x43c1('0x9')][_0x43c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c717,_0x4ae2a9,_0x6eae27){return new BPromise(function(_0x1ddb4f,_0x11c88b){return client['request'](_0x36c717,_0x6eae27)[_0x43c1('0xb')](function(_0x2886b1){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ae2a9,'request\x20sent');logger['debug'](_0x43c1('0xc'),_0x4ae2a9,_0x43c1('0xd'),JSON[_0x43c1('0xe')](_0x2886b1));if(_0x2886b1[_0x43c1('0xf')]){if(_0x2886b1[_0x43c1('0xf')][_0x43c1('0x10')]===0x1f4){logger[_0x43c1('0xf')](_0x43c1('0x11'),_0x4ae2a9,_0x2886b1['error'][_0x43c1('0x12')]);return _0x11c88b(_0x2886b1[_0x43c1('0xf')][_0x43c1('0x12')]);}logger['error'](_0x43c1('0x11'),_0x4ae2a9,_0x2886b1['error'][_0x43c1('0x12')]);return _0x1ddb4f(_0x2886b1[_0x43c1('0xf')]['message']);}else{logger['info'](_0x43c1('0x11'),_0x4ae2a9,'request\x20sent');_0x1ddb4f(_0x2886b1['result'][_0x43c1('0x12')]);}})[_0x43c1('0x13')](function(_0x51dd9a){logger[_0x43c1('0xf')](_0x43c1('0x11'),_0x4ae2a9,_0x51dd9a);_0x11c88b(_0x51dd9a);});});} \ No newline at end of file +var _0x55a3=['randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x3a8854,_0x279a13){var _0x31329e=function(_0x173e18){while(--_0x173e18){_0x3a8854['push'](_0x3a8854['shift']());}};_0x31329e(++_0x279a13);}(_0x55a3,0xc2));var _0x355a=function(_0x1299ff,_0x132845){_0x1299ff=_0x1299ff-0x0;var _0x2d732a=_0x55a3[_0x1299ff];return _0x2d732a;};'use strict';var _=require(_0x355a('0x0'));var util=require(_0x355a('0x1'));var moment=require(_0x355a('0x2'));var BPromise=require(_0x355a('0x3'));var rs=require(_0x355a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x355a('0x5'));var logger=require(_0x355a('0x6'))('rpc');var config=require(_0x355a('0x7'));var jayson=require(_0x355a('0x8'));var client=jayson[_0x355a('0x9')][_0x355a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c645e,_0x50d399,_0xc266ad){return new BPromise(function(_0xb3a527,_0x4ade81){return client['request'](_0x4c645e,_0xc266ad)[_0x355a('0xb')](function(_0x16c7a9){logger['info'](_0x355a('0xc'),_0x50d399,_0x355a('0xd'));logger[_0x355a('0xe')](_0x355a('0xf'),_0x50d399,_0x355a('0xd'),JSON[_0x355a('0x10')](_0x16c7a9));if(_0x16c7a9[_0x355a('0x11')]){if(_0x16c7a9[_0x355a('0x11')][_0x355a('0x12')]===0x1f4){logger[_0x355a('0x11')](_0x355a('0xc'),_0x50d399,_0x16c7a9[_0x355a('0x11')][_0x355a('0x13')]);return _0x4ade81(_0x16c7a9[_0x355a('0x11')][_0x355a('0x13')]);}logger[_0x355a('0x11')](_0x355a('0xc'),_0x50d399,_0x16c7a9['error'][_0x355a('0x13')]);return _0xb3a527(_0x16c7a9[_0x355a('0x11')][_0x355a('0x13')]);}else{logger[_0x355a('0x14')](_0x355a('0xc'),_0x50d399,'request\x20sent');_0xb3a527(_0x16c7a9['result'][_0x355a('0x13')]);}})[_0x355a('0x15')](function(_0x40bd70){logger[_0x355a('0x11')](_0x355a('0xc'),_0x50d399,_0x40bd70);_0x4ade81(_0x40bd70);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 84b19df..ab18614 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 _0x7628=['destroy','exports','util','connect-timeout','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x7628,0x11f));var _0x8762=function(_0x18f772,_0x5e1ed7){_0x18f772=_0x18f772-0x0;var _0x1b239b=_0x7628[_0x18f772];return _0x1b239b;};'use strict';var multer=require('multer');var util=require(_0x8762('0x0'));var path=require('path');var timeout=require(_0x8762('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8762('0x2'));var controller=require('./jscriptySessionReport.controller');router[_0x8762('0x3')]('/',auth[_0x8762('0x4')](),controller[_0x8762('0x5')]);router[_0x8762('0x3')](_0x8762('0x6'),auth[_0x8762('0x4')](),controller[_0x8762('0x7')]);router[_0x8762('0x3')](_0x8762('0x8'),auth[_0x8762('0x4')](),controller[_0x8762('0x9')]);router['get'](_0x8762('0xa'),auth[_0x8762('0x4')](),controller[_0x8762('0xb')]);router[_0x8762('0xc')]('/',auth[_0x8762('0x4')](),controller[_0x8762('0xd')]);router[_0x8762('0xe')](_0x8762('0x8'),auth['isAuthenticated'](),controller[_0x8762('0xf')]);router[_0x8762('0x10')]('/:id',auth[_0x8762('0x4')](),controller[_0x8762('0x11')]);module[_0x8762('0x12')]=router; \ No newline at end of file +var _0xb0f6=['index','/describe','/:id','show','getQuestions','post','create','put','update','delete','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x346612,_0x462c7e){var _0x4a2265=function(_0x369ce7){while(--_0x369ce7){_0x346612['push'](_0x346612['shift']());}};_0x4a2265(++_0x462c7e);}(_0xb0f6,0x114));var _0x6b0f=function(_0x459bd6,_0x5171f0){_0x459bd6=_0x459bd6-0x0;var _0x520c53=_0xb0f6[_0x459bd6];return _0x520c53;};'use strict';var multer=require(_0x6b0f('0x0'));var util=require('util');var path=require(_0x6b0f('0x1'));var timeout=require(_0x6b0f('0x2'));var express=require('express');var router=express[_0x6b0f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b0f('0x4'));var config=require(_0x6b0f('0x5'));var controller=require(_0x6b0f('0x6'));router[_0x6b0f('0x7')]('/',auth[_0x6b0f('0x8')](),controller[_0x6b0f('0x9')]);router[_0x6b0f('0x7')](_0x6b0f('0xa'),auth[_0x6b0f('0x8')](),controller['describe']);router['get'](_0x6b0f('0xb'),auth[_0x6b0f('0x8')](),controller[_0x6b0f('0xc')]);router[_0x6b0f('0x7')]('/:id/questions',auth[_0x6b0f('0x8')](),controller[_0x6b0f('0xd')]);router[_0x6b0f('0xe')]('/',auth[_0x6b0f('0x8')](),controller[_0x6b0f('0xf')]);router[_0x6b0f('0x10')](_0x6b0f('0xb'),auth[_0x6b0f('0x8')](),controller[_0x6b0f('0x11')]);router[_0x6b0f('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9b87f3d..f3c051e 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 _0x71f0=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','setDataValue','endtime'];(function(_0x10b47c,_0x1add46){var _0x5900f5=function(_0x5c229d){while(--_0x5c229d){_0x10b47c['push'](_0x10b47c['shift']());}};_0x5900f5(++_0x1add46);}(_0x71f0,0x1b6));var _0x071f=function(_0x395c24,_0x48d2cb){_0x395c24=_0x395c24-0x0;var _0x1d708b=_0x71f0[_0x395c24];return _0x1d708b;};'use strict';var moment=require('moment');var Sequelize=require(_0x071f('0x0'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1f972e){this[_0x071f('0x1')]('starttime',_0x1f972e);this[_0x071f('0x1')](_0x071f('0x2'),moment()['format'](_0x071f('0x3')));}},'endtime':{'type':Sequelize[_0x071f('0x4')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x071f('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x071f('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x071f('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x18d4=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue'];(function(_0x4e5d12,_0xf535ab){var _0x403179=function(_0x36c67f){while(--_0x36c67f){_0x4e5d12['push'](_0x4e5d12['shift']());}};_0x403179(++_0xf535ab);}(_0x18d4,0x19e));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x418d('0x0'));var Sequelize=require(_0x418d('0x1'));module[_0x418d('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x47e9cb){this[_0x418d('0x3')](_0x418d('0x4'),_0x47e9cb);this[_0x418d('0x3')](_0x418d('0x5'),moment()[_0x418d('0x6')](_0x418d('0x7')));}},'endtime':{'type':Sequelize[_0x418d('0x8')]},'membername':{'type':Sequelize[_0x418d('0x9')]},'projectname':{'type':Sequelize[_0x418d('0x9')]},'queue':{'type':Sequelize[_0x418d('0x9')]},'uniqueid':{'type':Sequelize[_0x418d('0x9')]},'calleridname':{'type':Sequelize[_0x418d('0x9')]},'calleridnum':{'type':Sequelize[_0x418d('0x9')]},'completed':{'type':Sequelize[_0x418d('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d0b3052..bf0b143 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 _0xb61a=['where','merge','includeAll','include','findAll','rows','show','params','options','create','body','find','catch','describe','getQuestions','JscriptyQuestionReport','rawAttributes','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0xebb43a,_0x5031dc){var _0x48fbcf=function(_0x3f2145){while(--_0x3f2145){_0xebb43a['push'](_0xebb43a['shift']());}};_0x48fbcf(++_0x5031dc);}(_0xb61a,0x105));var _0xab61=function(_0x1cdad4,_0xf4de77){_0x1cdad4=_0x1cdad4-0x0;var _0x2c8522=_0xb61a[_0x1cdad4];return _0x2c8522;};'use strict';var emlformat=require(_0xab61('0x0'));var rimraf=require(_0xab61('0x1'));var zipdir=require(_0xab61('0x2'));var jsonpatch=require(_0xab61('0x3'));var rp=require(_0xab61('0x4'));var moment=require(_0xab61('0x5'));var BPromise=require(_0xab61('0x6'));var Mustache=require('mustache');var util=require(_0xab61('0x7'));var path=require(_0xab61('0x8'));var sox=require(_0xab61('0x9'));var csv=require(_0xab61('0xa'));var ejs=require(_0xab61('0xb'));var fs=require('fs');var fs_extra=require(_0xab61('0xc'));var _=require(_0xab61('0xd'));var squel=require(_0xab61('0xe'));var crypto=require(_0xab61('0xf'));var jsforce=require(_0xab61('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab61('0x11'));var Papa=require(_0xab61('0x12'));var Redis=require(_0xab61('0x13'));var authService=require(_0xab61('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xab61('0x15'));var hardwareService=require(_0xab61('0x16'));var logger=require('../../config/logger')(_0xab61('0x17'));var utils=require(_0xab61('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x460bca,_0xec6ddc){_0xec6ddc=_0xec6ddc||0xcc;return function(_0x362bdd){if(_0x362bdd){return _0x460bca['sendStatus'](_0xec6ddc);}return _0x460bca['status'](_0xec6ddc)[_0xab61('0x19')]();};}function respondWithResult(_0x31b5b1,_0xf8811b){_0xf8811b=_0xf8811b||0xc8;return function(_0x54b037){if(_0x54b037){return _0x31b5b1[_0xab61('0x1a')](_0xf8811b)['json'](_0x54b037);}};}function respondWithFilteredResult(_0x1799f2,_0x58f7c9){return function(_0x2052d9){if(_0x2052d9){var _0x4591d9=typeof _0x58f7c9[_0xab61('0x1b')]===_0xab61('0x1c')&&typeof _0x58f7c9[_0xab61('0x1d')]===_0xab61('0x1c');var _0x43ee01=_0x2052d9['count'];var _0x1b4e94=_0x4591d9?0x0:_0x58f7c9[_0xab61('0x1b')];var _0x3054dc=_0x4591d9?_0x2052d9[_0xab61('0x1e')]:_0x58f7c9[_0xab61('0x1b')]+_0x58f7c9[_0xab61('0x1d')];var _0x44636f;if(_0x3054dc>=_0x43ee01){_0x3054dc=_0x43ee01;_0x44636f=0xc8;}else{_0x44636f=0xce;}_0x1799f2[_0xab61('0x1a')](_0x44636f);return _0x1799f2[_0xab61('0x1f')]('Content-Range',_0x1b4e94+'-'+_0x3054dc+'/'+_0x43ee01)[_0xab61('0x20')](_0x2052d9);}return null;};}function patchUpdates(_0x1585f9){return function(_0x1e8217){try{jsonpatch[_0xab61('0x21')](_0x1e8217,_0x1585f9,!![]);}catch(_0x30556f){return BPromise[_0xab61('0x22')](_0x30556f);}return _0x1e8217[_0xab61('0x23')]();};}function saveUpdates(_0x33a5c9,_0x3a70c8){return function(_0x2b80e9){if(_0x2b80e9){return _0x2b80e9[_0xab61('0x24')](_0x33a5c9)[_0xab61('0x25')](function(_0x11b20c){return _0x11b20c;});}return null;};}function removeEntity(_0x335a80,_0x478b72){return function(_0x2832b5){if(_0x2832b5){return _0x2832b5[_0xab61('0x26')]()[_0xab61('0x25')](function(){_0x335a80[_0xab61('0x1a')](0xcc)[_0xab61('0x19')]();});}};}function handleEntityNotFound(_0xb50254,_0x59cd93){return function(_0x4aeb6b){if(!_0x4aeb6b){_0xb50254[_0xab61('0x27')](0x194);}return _0x4aeb6b;};}function handleError(_0x2617a7,_0x8c4143){_0x8c4143=_0x8c4143||0x1f4;return function(_0x49780d){logger['error'](_0x49780d[_0xab61('0x28')]);if(_0x49780d[_0xab61('0x29')]){delete _0x49780d['name'];}_0x2617a7[_0xab61('0x1a')](_0x8c4143)[_0xab61('0x2a')](_0x49780d);};}exports[_0xab61('0x2b')]=function(_0x5c65b3,_0x193683){var _0x388989={},_0x132314={},_0x3800ec={'count':0x0,'rows':[]};var _0x34c2b3=_[_0xab61('0x2c')](db[_0xab61('0x2d')]['rawAttributes'],function(_0x5dc8e4){return{'name':_0x5dc8e4[_0xab61('0x2e')],'type':_0x5dc8e4[_0xab61('0x2f')][_0xab61('0x30')]};});_0x132314['model']=_[_0xab61('0x2c')](_0x34c2b3,'name');_0x132314[_0xab61('0x31')]=_[_0xab61('0x32')](_0x5c65b3[_0xab61('0x31')]);_0x132314[_0xab61('0x33')]=_[_0xab61('0x34')](_0x132314[_0xab61('0x35')],_0x132314[_0xab61('0x31')]);_0x388989[_0xab61('0x36')]=_[_0xab61('0x34')](_0x132314[_0xab61('0x35')],qs[_0xab61('0x37')](_0x5c65b3['query'][_0xab61('0x37')]));_0x388989['attributes']=_0x388989[_0xab61('0x36')][_0xab61('0x38')]?_0x388989['attributes']:_0x132314[_0xab61('0x35')];if(!_0x5c65b3[_0xab61('0x31')][_0xab61('0x39')](_0xab61('0x3a'))){_0x388989[_0xab61('0x1d')]=qs[_0xab61('0x1d')](_0x5c65b3[_0xab61('0x31')][_0xab61('0x1d')]);_0x388989[_0xab61('0x1b')]=qs['offset'](_0x5c65b3[_0xab61('0x31')][_0xab61('0x1b')]);}_0x388989[_0xab61('0x3b')]=qs['sort'](_0x5c65b3[_0xab61('0x31')][_0xab61('0x3c')]);_0x388989['where']=qs[_0xab61('0x33')](_[_0xab61('0x3d')](_0x5c65b3['query'],_0x132314[_0xab61('0x33')]),_0x34c2b3);if(_0x5c65b3['query'][_0xab61('0x3e')]){_0x388989[_0xab61('0x3f')]=_['merge'](_0x388989[_0xab61('0x3f')],{'$or':_[_0xab61('0x2c')](_0x34c2b3,function(_0xf2f8bc){if(_0xf2f8bc[_0xab61('0x2f')]!=='VIRTUAL'){var _0x9c5392={};_0x9c5392[_0xf2f8bc[_0xab61('0x29')]]={'$like':'%'+_0x5c65b3[_0xab61('0x31')]['filter']+'%'};return _0x9c5392;}})});}_0x388989=_[_0xab61('0x40')]({},_0x388989,_0x5c65b3['options']);var _0x2d49a3={'where':_0x388989[_0xab61('0x3f')]};return db['JscriptySessionReport'][_0xab61('0x1e')](_0x2d49a3)[_0xab61('0x25')](function(_0xe2febf){_0x3800ec['count']=_0xe2febf;if(_0x5c65b3[_0xab61('0x31')][_0xab61('0x41')]){_0x388989[_0xab61('0x42')]=[{'all':!![]}];}return db[_0xab61('0x2d')][_0xab61('0x43')](_0x388989);})[_0xab61('0x25')](function(_0x30df93){_0x3800ec[_0xab61('0x44')]=_0x30df93;return _0x3800ec;})[_0xab61('0x25')](respondWithFilteredResult(_0x193683,_0x388989))['catch'](handleError(_0x193683,null));};exports[_0xab61('0x45')]=function(_0xa082b9,_0x5ca2dc){var _0x1d2130={'raw':!![],'where':{'id':_0xa082b9[_0xab61('0x46')]['id']}},_0x5d9255={};_0x5d9255[_0xab61('0x35')]=_[_0xab61('0x32')](db['JscriptySessionReport']['rawAttributes']);_0x5d9255[_0xab61('0x31')]=_[_0xab61('0x32')](_0xa082b9[_0xab61('0x31')]);_0x5d9255[_0xab61('0x33')]=_[_0xab61('0x34')](_0x5d9255[_0xab61('0x35')],_0x5d9255['query']);_0x1d2130[_0xab61('0x36')]=_['intersection'](_0x5d9255['model'],qs['fields'](_0xa082b9[_0xab61('0x31')]['fields']));_0x1d2130[_0xab61('0x36')]=_0x1d2130[_0xab61('0x36')][_0xab61('0x38')]?_0x1d2130['attributes']:_0x5d9255[_0xab61('0x35')];if(_0xa082b9[_0xab61('0x31')][_0xab61('0x41')]){_0x1d2130['include']=[{'all':!![]}];}_0x1d2130=_[_0xab61('0x40')]({},_0x1d2130,_0xa082b9[_0xab61('0x47')]);return db['JscriptySessionReport']['find'](_0x1d2130)[_0xab61('0x25')](handleEntityNotFound(_0x5ca2dc,null))[_0xab61('0x25')](respondWithResult(_0x5ca2dc,null))['catch'](handleError(_0x5ca2dc,null));};exports[_0xab61('0x48')]=function(_0x1c175a,_0x239c8a){return db[_0xab61('0x2d')][_0xab61('0x48')](_0x1c175a['body'],{})[_0xab61('0x25')](respondWithResult(_0x239c8a,0xc9))['catch'](handleError(_0x239c8a,null));};exports[_0xab61('0x24')]=function(_0x1e65fb,_0x1f6f05){if(_0x1e65fb[_0xab61('0x49')]['id']){delete _0x1e65fb[_0xab61('0x49')]['id'];}return db[_0xab61('0x2d')][_0xab61('0x4a')]({'where':{'id':_0x1e65fb['params']['id']}})[_0xab61('0x25')](handleEntityNotFound(_0x1f6f05,null))[_0xab61('0x25')](saveUpdates(_0x1e65fb[_0xab61('0x49')],null))[_0xab61('0x25')](respondWithResult(_0x1f6f05,null))[_0xab61('0x4b')](handleError(_0x1f6f05,null));};exports[_0xab61('0x26')]=function(_0x2e40ef,_0x2e3008){return db[_0xab61('0x2d')]['find']({'where':{'id':_0x2e40ef[_0xab61('0x46')]['id']}})[_0xab61('0x25')](handleEntityNotFound(_0x2e3008,null))[_0xab61('0x25')](removeEntity(_0x2e3008,null))[_0xab61('0x4b')](handleError(_0x2e3008,null));};exports[_0xab61('0x4c')]=function(_0x1a1e49,_0x4c02f8){return db[_0xab61('0x2d')][_0xab61('0x4c')]()['then'](respondWithResult(_0x4c02f8,null))[_0xab61('0x4b')](handleError(_0x4c02f8,null));};exports[_0xab61('0x4d')]=function(_0x422300,_0x238efb,_0x349122){var _0xcc941e={'raw':!![],'where':{}};var _0x48583a={};var _0x19fd9f={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x422300[_0xab61('0x46')]['id']}})['then'](handleEntityNotFound(_0x238efb,null))[_0xab61('0x25')](function(_0x13b8ec){if(_0x13b8ec){_0x48583a[_0xab61('0x35')]=_[_0xab61('0x32')](db[_0xab61('0x4e')][_0xab61('0x4f')]);_0x48583a[_0xab61('0x31')]=_['keys'](_0x422300['query']);_0x48583a[_0xab61('0x33')]=_['intersection'](_0x48583a[_0xab61('0x35')],_0x48583a['query']);_0xcc941e[_0xab61('0x36')]=_[_0xab61('0x34')](_0x48583a[_0xab61('0x35')],qs[_0xab61('0x37')](_0x422300[_0xab61('0x31')][_0xab61('0x37')]));_0xcc941e[_0xab61('0x36')]=_0xcc941e['attributes'][_0xab61('0x38')]?_0xcc941e['attributes']:_0x48583a[_0xab61('0x35')];if(!_0x422300[_0xab61('0x31')][_0xab61('0x39')]('nolimit')){_0xcc941e[_0xab61('0x1d')]=qs[_0xab61('0x1d')](_0x422300['query']['limit']);_0xcc941e[_0xab61('0x1b')]=qs[_0xab61('0x1b')](_0x422300[_0xab61('0x31')][_0xab61('0x1b')]);}_0xcc941e['order']=qs['sort'](_0x422300['query']['sort']);_0xcc941e['where']=qs[_0xab61('0x33')](_[_0xab61('0x3d')](_0x422300[_0xab61('0x31')],_0x48583a[_0xab61('0x33')]));_0xcc941e['where'][_0xab61('0x50')]=_0x13b8ec['id'];if(_0x422300['query'][_0xab61('0x3e')]){_0xcc941e[_0xab61('0x3f')]=_['merge'](_0xcc941e['where'],{'$or':_[_0xab61('0x2c')](_0xcc941e[_0xab61('0x36')],function(_0x2b9e1a){var _0x499c5e={};_0x499c5e[_0x2b9e1a]={'$like':'%'+_0x422300['query'][_0xab61('0x3e')]+'%'};return _0x499c5e;})});}_0xcc941e=_[_0xab61('0x40')]({},_0xcc941e,_0x422300['options']);return db['JscriptyQuestionReport'][_0xab61('0x1e')]({'where':_0xcc941e[_0xab61('0x3f')]})[_0xab61('0x25')](function(_0x32f927){_0x19fd9f['count']=_0x32f927;if(_0x422300[_0xab61('0x31')][_0xab61('0x41')]){_0xcc941e[_0xab61('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0xcc941e);})[_0xab61('0x25')](function(_0x2c3a64){_0x19fd9f['rows']=_0x2c3a64;return _0x19fd9f;});}})['then'](respondWithFilteredResult(_0x238efb,_0xcc941e))[_0xab61('0x4b')](handleError(_0x238efb,null));}; \ No newline at end of file +var _0xa210=['keys','include','create','body','update','find','describe','findOne','JscriptyQuestionReport','SessionId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','undefined','count','offset','set','json','apply','save','then','destroy','name','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x128950,_0x43368a){var _0x5086a1=function(_0x1f6c7d){while(--_0x1f6c7d){_0x128950['push'](_0x128950['shift']());}};_0x5086a1(++_0x43368a);}(_0xa210,0x1d2));var _0x0a21=function(_0x19763f,_0x5e3121){_0x19763f=_0x19763f-0x0;var _0x42752f=_0xa210[_0x19763f];return _0x42752f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a21('0x0'));var zipdir=require(_0x0a21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a21('0x2'));var moment=require(_0x0a21('0x3'));var BPromise=require(_0x0a21('0x4'));var Mustache=require(_0x0a21('0x5'));var util=require(_0x0a21('0x6'));var path=require(_0x0a21('0x7'));var sox=require(_0x0a21('0x8'));var csv=require('to-csv');var ejs=require(_0x0a21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a21('0xa'));var squel=require(_0x0a21('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a21('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0a21('0xd'));var Papa=require(_0x0a21('0xe'));var Redis=require(_0x0a21('0xf'));var authService=require(_0x0a21('0x10'));var qs=require(_0x0a21('0x11'));var as=require(_0x0a21('0x12'));var hardwareService=require(_0x0a21('0x13'));var logger=require(_0x0a21('0x14'))(_0x0a21('0x15'));var utils=require('../../config/utils');var config=require(_0x0a21('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a21('0x17'))['db'];function respondWithStatusCode(_0x3785d8,_0x3328eb){_0x3328eb=_0x3328eb||0xcc;return function(_0x5dd338){if(_0x5dd338){return _0x3785d8[_0x0a21('0x18')](_0x3328eb);}return _0x3785d8['status'](_0x3328eb)['end']();};}function respondWithResult(_0x5cd6c2,_0x15b4a1){_0x15b4a1=_0x15b4a1||0xc8;return function(_0x11e6b9){if(_0x11e6b9){return _0x5cd6c2[_0x0a21('0x19')](_0x15b4a1)['json'](_0x11e6b9);}};}function respondWithFilteredResult(_0x44f463,_0x4041a8){return function(_0x1c907a){if(_0x1c907a){var _0x306821=typeof _0x4041a8['offset']==='undefined'&&typeof _0x4041a8['limit']===_0x0a21('0x1a');var _0x4c46b3=_0x1c907a[_0x0a21('0x1b')];var _0x50641f=_0x306821?0x0:_0x4041a8[_0x0a21('0x1c')];var _0x5c0ba5=_0x306821?_0x1c907a[_0x0a21('0x1b')]:_0x4041a8['offset']+_0x4041a8['limit'];var _0x4aaa36;if(_0x5c0ba5>=_0x4c46b3){_0x5c0ba5=_0x4c46b3;_0x4aaa36=0xc8;}else{_0x4aaa36=0xce;}_0x44f463[_0x0a21('0x19')](_0x4aaa36);return _0x44f463[_0x0a21('0x1d')]('Content-Range',_0x50641f+'-'+_0x5c0ba5+'/'+_0x4c46b3)[_0x0a21('0x1e')](_0x1c907a);}return null;};}function patchUpdates(_0x3577bd){return function(_0x39ca69){try{jsonpatch[_0x0a21('0x1f')](_0x39ca69,_0x3577bd,!![]);}catch(_0x23ddc2){return BPromise['reject'](_0x23ddc2);}return _0x39ca69[_0x0a21('0x20')]();};}function saveUpdates(_0x246b1e,_0x594784){return function(_0x3c4798){if(_0x3c4798){return _0x3c4798['update'](_0x246b1e)[_0x0a21('0x21')](function(_0xb6592){return _0xb6592;});}return null;};}function removeEntity(_0x3c16db,_0x562f97){return function(_0x23675d){if(_0x23675d){return _0x23675d[_0x0a21('0x22')]()[_0x0a21('0x21')](function(){_0x3c16db[_0x0a21('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276674,_0x1138c1){return function(_0x5c3478){if(!_0x5c3478){_0x276674[_0x0a21('0x18')](0x194);}return _0x5c3478;};}function handleError(_0x23abf8,_0xfdc711){_0xfdc711=_0xfdc711||0x1f4;return function(_0x429daf){logger['error'](_0x429daf['stack']);if(_0x429daf[_0x0a21('0x23')]){delete _0x429daf['name'];}_0x23abf8[_0x0a21('0x19')](_0xfdc711)['send'](_0x429daf);};}exports['index']=function(_0x16c264,_0x3bc253){var _0x4e79fc={},_0x31810c={},_0x3bd58f={'count':0x0,'rows':[]};var _0x2d019f=_['map'](db[_0x0a21('0x24')][_0x0a21('0x25')],function(_0x5363a2){return{'name':_0x5363a2[_0x0a21('0x26')],'type':_0x5363a2[_0x0a21('0x27')][_0x0a21('0x28')]};});_0x31810c[_0x0a21('0x29')]=_['map'](_0x2d019f,'name');_0x31810c[_0x0a21('0x2a')]=_['keys'](_0x16c264[_0x0a21('0x2a')]);_0x31810c[_0x0a21('0x2b')]=_[_0x0a21('0x2c')](_0x31810c[_0x0a21('0x29')],_0x31810c[_0x0a21('0x2a')]);_0x4e79fc[_0x0a21('0x2d')]=_[_0x0a21('0x2c')](_0x31810c[_0x0a21('0x29')],qs[_0x0a21('0x2e')](_0x16c264[_0x0a21('0x2a')]['fields']));_0x4e79fc[_0x0a21('0x2d')]=_0x4e79fc['attributes'][_0x0a21('0x2f')]?_0x4e79fc['attributes']:_0x31810c[_0x0a21('0x29')];if(!_0x16c264['query'][_0x0a21('0x30')](_0x0a21('0x31'))){_0x4e79fc[_0x0a21('0x32')]=qs[_0x0a21('0x32')](_0x16c264[_0x0a21('0x2a')]['limit']);_0x4e79fc[_0x0a21('0x1c')]=qs['offset'](_0x16c264[_0x0a21('0x2a')][_0x0a21('0x1c')]);}_0x4e79fc[_0x0a21('0x33')]=qs[_0x0a21('0x34')](_0x16c264[_0x0a21('0x2a')][_0x0a21('0x34')]);_0x4e79fc[_0x0a21('0x35')]=qs[_0x0a21('0x2b')](_[_0x0a21('0x36')](_0x16c264[_0x0a21('0x2a')],_0x31810c[_0x0a21('0x2b')]),_0x2d019f);if(_0x16c264[_0x0a21('0x2a')][_0x0a21('0x37')]){_0x4e79fc[_0x0a21('0x35')]=_[_0x0a21('0x38')](_0x4e79fc['where'],{'$or':_[_0x0a21('0x39')](_0x2d019f,function(_0x1079e6){if(_0x1079e6[_0x0a21('0x27')]!==_0x0a21('0x3a')){var _0x11d194={};_0x11d194[_0x1079e6[_0x0a21('0x23')]]={'$like':'%'+_0x16c264[_0x0a21('0x2a')]['filter']+'%'};return _0x11d194;}})});}_0x4e79fc=_['merge']({},_0x4e79fc,_0x16c264[_0x0a21('0x3b')]);var _0x906e80={'where':_0x4e79fc[_0x0a21('0x35')]};return db['JscriptySessionReport'][_0x0a21('0x1b')](_0x906e80)[_0x0a21('0x21')](function(_0x338f9e){_0x3bd58f[_0x0a21('0x1b')]=_0x338f9e;if(_0x16c264[_0x0a21('0x2a')][_0x0a21('0x3c')]){_0x4e79fc['include']=[{'all':!![]}];}return db[_0x0a21('0x24')][_0x0a21('0x3d')](_0x4e79fc);})[_0x0a21('0x21')](function(_0x3645fc){_0x3bd58f[_0x0a21('0x3e')]=_0x3645fc;return _0x3bd58f;})['then'](respondWithFilteredResult(_0x3bc253,_0x4e79fc))[_0x0a21('0x3f')](handleError(_0x3bc253,null));};exports[_0x0a21('0x40')]=function(_0x289dc0,_0x23cef2){var _0x598e63={'raw':!![],'where':{'id':_0x289dc0[_0x0a21('0x41')]['id']}},_0xccd695={};_0xccd695['model']=_[_0x0a21('0x42')](db[_0x0a21('0x24')]['rawAttributes']);_0xccd695[_0x0a21('0x2a')]=_['keys'](_0x289dc0[_0x0a21('0x2a')]);_0xccd695['filters']=_[_0x0a21('0x2c')](_0xccd695[_0x0a21('0x29')],_0xccd695[_0x0a21('0x2a')]);_0x598e63[_0x0a21('0x2d')]=_['intersection'](_0xccd695[_0x0a21('0x29')],qs['fields'](_0x289dc0[_0x0a21('0x2a')]['fields']));_0x598e63[_0x0a21('0x2d')]=_0x598e63[_0x0a21('0x2d')][_0x0a21('0x2f')]?_0x598e63[_0x0a21('0x2d')]:_0xccd695[_0x0a21('0x29')];if(_0x289dc0['query'][_0x0a21('0x3c')]){_0x598e63[_0x0a21('0x43')]=[{'all':!![]}];}_0x598e63=_[_0x0a21('0x38')]({},_0x598e63,_0x289dc0['options']);return db['JscriptySessionReport']['find'](_0x598e63)['then'](handleEntityNotFound(_0x23cef2,null))[_0x0a21('0x21')](respondWithResult(_0x23cef2,null))[_0x0a21('0x3f')](handleError(_0x23cef2,null));};exports[_0x0a21('0x44')]=function(_0x4ced93,_0x3aeea1){return db[_0x0a21('0x24')][_0x0a21('0x44')](_0x4ced93[_0x0a21('0x45')],{})[_0x0a21('0x21')](respondWithResult(_0x3aeea1,0xc9))[_0x0a21('0x3f')](handleError(_0x3aeea1,null));};exports[_0x0a21('0x46')]=function(_0x41d768,_0x2564e9){if(_0x41d768[_0x0a21('0x45')]['id']){delete _0x41d768[_0x0a21('0x45')]['id'];}return db[_0x0a21('0x24')][_0x0a21('0x47')]({'where':{'id':_0x41d768[_0x0a21('0x41')]['id']}})[_0x0a21('0x21')](handleEntityNotFound(_0x2564e9,null))[_0x0a21('0x21')](saveUpdates(_0x41d768[_0x0a21('0x45')],null))[_0x0a21('0x21')](respondWithResult(_0x2564e9,null))['catch'](handleError(_0x2564e9,null));};exports[_0x0a21('0x22')]=function(_0x12368f,_0x298fe6){return db[_0x0a21('0x24')][_0x0a21('0x47')]({'where':{'id':_0x12368f[_0x0a21('0x41')]['id']}})[_0x0a21('0x21')](handleEntityNotFound(_0x298fe6,null))['then'](removeEntity(_0x298fe6,null))['catch'](handleError(_0x298fe6,null));};exports[_0x0a21('0x48')]=function(_0x4a7faf,_0x559a4c){return db[_0x0a21('0x24')][_0x0a21('0x48')]()['then'](respondWithResult(_0x559a4c,null))['catch'](handleError(_0x559a4c,null));};exports['getQuestions']=function(_0x2432fd,_0x1f7530,_0x3dd500){var _0x1503bb={'raw':!![],'where':{}};var _0x478d3d={};var _0x3f7dd8={'count':0x0,'rows':[]};return db[_0x0a21('0x24')][_0x0a21('0x49')]({'where':{'id':_0x2432fd['params']['id']}})[_0x0a21('0x21')](handleEntityNotFound(_0x1f7530,null))[_0x0a21('0x21')](function(_0x76f5d8){if(_0x76f5d8){_0x478d3d[_0x0a21('0x29')]=_['keys'](db[_0x0a21('0x4a')][_0x0a21('0x25')]);_0x478d3d[_0x0a21('0x2a')]=_[_0x0a21('0x42')](_0x2432fd[_0x0a21('0x2a')]);_0x478d3d[_0x0a21('0x2b')]=_[_0x0a21('0x2c')](_0x478d3d[_0x0a21('0x29')],_0x478d3d[_0x0a21('0x2a')]);_0x1503bb[_0x0a21('0x2d')]=_['intersection'](_0x478d3d['model'],qs['fields'](_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x2e')]));_0x1503bb[_0x0a21('0x2d')]=_0x1503bb[_0x0a21('0x2d')][_0x0a21('0x2f')]?_0x1503bb[_0x0a21('0x2d')]:_0x478d3d[_0x0a21('0x29')];if(!_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x30')](_0x0a21('0x31'))){_0x1503bb[_0x0a21('0x32')]=qs[_0x0a21('0x32')](_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x32')]);_0x1503bb[_0x0a21('0x1c')]=qs['offset'](_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x1c')]);}_0x1503bb[_0x0a21('0x33')]=qs['sort'](_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x34')]);_0x1503bb[_0x0a21('0x35')]=qs[_0x0a21('0x2b')](_[_0x0a21('0x36')](_0x2432fd['query'],_0x478d3d[_0x0a21('0x2b')]));_0x1503bb[_0x0a21('0x35')][_0x0a21('0x4b')]=_0x76f5d8['id'];if(_0x2432fd[_0x0a21('0x2a')]['filter']){_0x1503bb[_0x0a21('0x35')]=_['merge'](_0x1503bb[_0x0a21('0x35')],{'$or':_[_0x0a21('0x39')](_0x1503bb[_0x0a21('0x2d')],function(_0x43fc72){var _0x59e8a7={};_0x59e8a7[_0x43fc72]={'$like':'%'+_0x2432fd[_0x0a21('0x2a')][_0x0a21('0x37')]+'%'};return _0x59e8a7;})});}_0x1503bb=_['merge']({},_0x1503bb,_0x2432fd[_0x0a21('0x3b')]);return db[_0x0a21('0x4a')]['count']({'where':_0x1503bb[_0x0a21('0x35')]})[_0x0a21('0x21')](function(_0x80542e){_0x3f7dd8['count']=_0x80542e;if(_0x2432fd[_0x0a21('0x2a')]['includeAll']){_0x1503bb['include']=[{'all':!![]}];}return db[_0x0a21('0x4a')][_0x0a21('0x3d')](_0x1503bb);})[_0x0a21('0x21')](function(_0x3002d0){_0x3f7dd8[_0x0a21('0x3e')]=_0x3002d0;return _0x3f7dd8;});}})[_0x0a21('0x21')](respondWithFilteredResult(_0x1f7530,_0x1503bb))[_0x0a21('0x3f')](handleError(_0x1f7530,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e4eff47..6153750 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','lodash'];(function(_0x1e512e,_0x4d8efa){var _0x1b5616=function(_0x1afbe0){while(--_0x1afbe0){_0x1e512e['push'](_0x1e512e['shift']());}};_0x1b5616(++_0x4d8efa);}(_0x7da7,0x10d));var _0x77da=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x7da7[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','./jscriptySessionReport.attributes'];(function(_0x1ae477,_0x261af2){var _0x1ad330=function(_0x42fcd6){while(--_0x42fcd6){_0x1ae477['push'](_0x1ae477['shift']());}};_0x1ad330(++_0x261af2);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x306a99,_0x285bb2){_0x306a99=_0x306a99-0x0;var _0x99471e=_0xbd51[_0x306a99];return _0x99471e;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'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 f2884d2..9ced126 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 _0xafb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x16249a,_0x372f9e){var _0x28cf81=function(_0x54caa4){while(--_0x54caa4){_0x16249a['push'](_0x16249a['shift']());}};_0x28cf81(++_0x372f9e);}(_0xafb9,0x68));var _0x9afb=function(_0x2f23a0,_0x230fd3){_0x2f23a0=_0x2f23a0-0x0;var _0x21a4aa=_0xafb9[_0x2f23a0];return _0x21a4aa;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});} \ 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(_0x4f028d,_0x48d175){var _0x97963b=function(_0x4842eb){while(--_0x4842eb){_0x4f028d['push'](_0x4f028d['shift']());}};_0x97963b(++_0x48d175);}(_0x68b3,0x1d8));var _0x368b=function(_0x3849a6,_0x3a28fe){_0x3849a6=_0x3849a6-0x0;var _0x42f4b3=_0x68b3[_0x3849a6];return _0x42f4b3;};'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 574fbf7..5ec6ddc 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 _0x368a=['../../config/environment','./license.controller','get','index','put','/:id','/download_log_file','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x22ddeb,_0x4f8ac9){var _0x372bb7=function(_0x4ccc4c){while(--_0x4ccc4c){_0x22ddeb['push'](_0x22ddeb['shift']());}};_0x372bb7(++_0x4f8ac9);}(_0x368a,0x107));var _0xa368=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x368a[_0xce6f11];return _0x35b709;};'use strict';var multer=require('multer');var util=require(_0xa368('0x0'));var path=require(_0xa368('0x1'));var timeout=require(_0xa368('0x2'));var express=require(_0xa368('0x3'));var router=express[_0xa368('0x4')]();var fs_extra=require(_0xa368('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa368('0x6'));var config=require(_0xa368('0x7'));var controller=require(_0xa368('0x8'));router[_0xa368('0x9')]('/',controller[_0xa368('0xa')]);router[_0xa368('0xb')](_0xa368('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa368('0x9')](_0xa368('0xd'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xa368('0xe')]=router; \ No newline at end of file +var _0x16e7=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x16e7,0x131));var _0x716e=function(_0x480a18,_0x285c08){_0x480a18=_0x480a18-0x0;var _0x1f72cb=_0x16e7[_0x480a18];return _0x1f72cb;};'use strict';var multer=require(_0x716e('0x0'));var util=require(_0x716e('0x1'));var path=require(_0x716e('0x2'));var timeout=require(_0x716e('0x3'));var express=require(_0x716e('0x4'));var router=express[_0x716e('0x5')]();var fs_extra=require(_0x716e('0x6'));var auth=require(_0x716e('0x7'));var interaction=require(_0x716e('0x8'));var config=require(_0x716e('0x9'));var controller=require(_0x716e('0xa'));router[_0x716e('0xb')]('/',controller[_0x716e('0xc')]);router[_0x716e('0xd')](_0x716e('0xe'),auth[_0x716e('0xf')](),controller[_0x716e('0x10')]);router[_0x716e('0xb')]('/download_log_file',auth[_0x716e('0xf')](),controller['downloadLogFile']);module[_0x716e('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 99f7915..d54b5f5 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 _0x082f=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x082f,0xa6));var _0xf082=function(_0x17a329,_0x5d2f43){_0x17a329=_0x17a329-0x0;var _0x761387=_0x082f[_0x17a329];return _0x761387;};'use strict';var Sequelize=require(_0xf082('0x0'));module[_0xf082('0x1')]={'license':{'type':Sequelize[_0xf082('0x2')]},'data1':{'type':Sequelize[_0xf082('0x3')]},'data2':{'type':Sequelize[_0xf082('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xf082('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8f5=['STRING','INTEGER','TEXT'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0xd8f5,0xf8));var _0x5d8f=function(_0x425bb1,_0x3c2dcc){_0x425bb1=_0x425bb1-0x0;var _0x2bbc48=_0xd8f5[_0x425bb1];return _0x2bbc48;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x5d8f('0x0')]},'data1':{'type':Sequelize[_0x5d8f('0x1')]},'data2':{'type':Sequelize[_0x5d8f('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5d8f('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 9478958..eb10211 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 _0xd074=['catch','body','find','get','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','filters','query','attributes','intersection','fields','merge','getLicense'];(function(_0x1845f4,_0x2033ea){var _0x43d58b=function(_0x531742){while(--_0x531742){_0x1845f4['push'](_0x1845f4['shift']());}};_0x43d58b(++_0x2033ea);}(_0xd074,0xe8));var _0x4d07=function(_0x52aba4,_0x197aa3){_0x52aba4=_0x52aba4-0x0;var _0x48d5b0=_0xd074[_0x52aba4];return _0x48d5b0;};'use strict';var emlformat=require(_0x4d07('0x0'));var rimraf=require(_0x4d07('0x1'));var zipdir=require(_0x4d07('0x2'));var jsonpatch=require(_0x4d07('0x3'));var rp=require(_0x4d07('0x4'));var moment=require(_0x4d07('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4d07('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d07('0x7'));var fs=require('fs');var fs_extra=require(_0x4d07('0x8'));var _=require('lodash');var squel=require(_0x4d07('0x9'));var crypto=require(_0x4d07('0xa'));var jsforce=require(_0x4d07('0xb'));var deskjs=require(_0x4d07('0xc'));var toCsv=require(_0x4d07('0xd'));var querystring=require(_0x4d07('0xe'));var Papa=require(_0x4d07('0xf'));var Redis=require(_0x4d07('0x10'));var authService=require(_0x4d07('0x11'));var qs=require(_0x4d07('0x12'));var as=require(_0x4d07('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d07('0x14'))(_0x4d07('0x15'));var utils=require(_0x4d07('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4d07('0x17'));var db=require(_0x4d07('0x18'))['db'];function respondWithStatusCode(_0x2b50f7,_0xa6353b){_0xa6353b=_0xa6353b||0xcc;return function(_0x11acb7){if(_0x11acb7){return _0x2b50f7['sendStatus'](_0xa6353b);}return _0x2b50f7[_0x4d07('0x19')](_0xa6353b)[_0x4d07('0x1a')]();};}function respondWithResult(_0x59118a,_0x53de6f){_0x53de6f=_0x53de6f||0xc8;return function(_0x1b0877){if(_0x1b0877){return _0x59118a[_0x4d07('0x19')](_0x53de6f)[_0x4d07('0x1b')](_0x1b0877);}};}function respondWithFilteredResult(_0x5f4de2,_0x12c948){return function(_0x17cd49){if(_0x17cd49){var _0x858f8=typeof _0x12c948[_0x4d07('0x1c')]==='undefined'&&typeof _0x12c948[_0x4d07('0x1d')]===_0x4d07('0x1e');var _0xa5aaf5=_0x17cd49[_0x4d07('0x1f')];var _0x15d09c=_0x858f8?0x0:_0x12c948[_0x4d07('0x1c')];var _0x299221=_0x858f8?_0x17cd49['count']:_0x12c948[_0x4d07('0x1c')]+_0x12c948[_0x4d07('0x1d')];var _0xfae681;if(_0x299221>=_0xa5aaf5){_0x299221=_0xa5aaf5;_0xfae681=0xc8;}else{_0xfae681=0xce;}_0x5f4de2[_0x4d07('0x19')](_0xfae681);return _0x5f4de2[_0x4d07('0x20')](_0x4d07('0x21'),_0x15d09c+'-'+_0x299221+'/'+_0xa5aaf5)[_0x4d07('0x1b')](_0x17cd49);}return null;};}function patchUpdates(_0x5845ec){return function(_0x40327f){try{jsonpatch['apply'](_0x40327f,_0x5845ec,!![]);}catch(_0x41097b){return BPromise[_0x4d07('0x22')](_0x41097b);}return _0x40327f[_0x4d07('0x23')]();};}function saveUpdates(_0x3df728,_0x188bad){return function(_0x3a828a){if(_0x3a828a){return _0x3a828a[_0x4d07('0x24')](_0x3df728)['then'](function(_0x51ac7f){return _0x51ac7f;});}return null;};}function removeEntity(_0x49bcdd,_0x363c3b){return function(_0x3e042f){if(_0x3e042f){return _0x3e042f[_0x4d07('0x25')]()[_0x4d07('0x26')](function(){_0x49bcdd['status'](0xcc)[_0x4d07('0x1a')]();});}};}function handleEntityNotFound(_0x15bfc9,_0x470797){return function(_0x11a10c){if(!_0x11a10c){_0x15bfc9[_0x4d07('0x27')](0x194);}return _0x11a10c;};}function handleError(_0x58313a,_0x40ae1d){_0x40ae1d=_0x40ae1d||0x1f4;return function(_0x26a26c){logger[_0x4d07('0x28')](_0x26a26c[_0x4d07('0x29')]);if(_0x26a26c['name']){delete _0x26a26c[_0x4d07('0x2a')];}_0x58313a[_0x4d07('0x19')](_0x40ae1d)[_0x4d07('0x2b')](_0x26a26c);};}var utilLicense=require(_0x4d07('0x17'));exports[_0x4d07('0x2c')]=function(_0x654ac,_0x30014a){var _0x48f45c={'raw':!![],'where':{'id':0x1}},_0x4e82a0={};_0x4e82a0[_0x4d07('0x2d')]=_[_0x4d07('0x2e')](db[_0x4d07('0x2f')][_0x4d07('0x30')]);_0x4e82a0['query']=_[_0x4d07('0x2e')](_0x654ac['query']);_0x4e82a0[_0x4d07('0x31')]=_['intersection'](_0x4e82a0[_0x4d07('0x2d')],_0x4e82a0[_0x4d07('0x32')]);_0x48f45c[_0x4d07('0x33')]=_[_0x4d07('0x34')](_0x4e82a0[_0x4d07('0x2d')],qs[_0x4d07('0x35')](_0x654ac[_0x4d07('0x32')][_0x4d07('0x35')]));_0x48f45c[_0x4d07('0x33')]=_0x48f45c[_0x4d07('0x33')]['length']?_0x48f45c[_0x4d07('0x33')]:_0x4e82a0[_0x4d07('0x2d')];_0x48f45c=_[_0x4d07('0x36')]({},_0x48f45c,_0x654ac['options']);return utilLicense[_0x4d07('0x37')](_0x48f45c)[_0x4d07('0x26')](respondWithResult(_0x30014a,null))[_0x4d07('0x38')](handleError(_0x30014a,null));};exports[_0x4d07('0x24')]=function(_0x2f0fa0,_0x155440){if(_0x2f0fa0[_0x4d07('0x39')]['id']){delete _0x2f0fa0[_0x4d07('0x39')]['id'];}return db[_0x4d07('0x2f')][_0x4d07('0x3a')]({'where':{'id':_0x2f0fa0['params']['id']}})[_0x4d07('0x26')](handleEntityNotFound(_0x155440,null))[_0x4d07('0x26')](function(_0x49aeaf){var _0x1a4491=_0x49aeaf[_0x4d07('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x1a4491,_0x2f0fa0[_0x4d07('0x39')][_0x4d07('0x3c')]);})[_0x4d07('0x26')](function(_0x3f85ec){if(!_0x3f85ec[_0x4d07('0x3d')]){return saveUpdates(_0x2f0fa0[_0x4d07('0x39')],null);}return _0x3f85ec;})[_0x4d07('0x26')](respondWithResult(_0x155440,null))[_0x4d07('0x38')](handleError(_0x155440,null));};exports[_0x4d07('0x3e')]=function(_0x4b9f7e,_0x1a662e){var _0x418f2f=_0x4d07('0x3f');var _0x1d5261=path[_0x4d07('0x40')](_0x4d07('0x41'),'log',_0x4d07('0x42'),_0x418f2f);_0x1a662e[_0x4d07('0x43')](_0x4d07('0x44'),_0x4d07('0x45')+_0x418f2f);_0x1a662e[_0x4d07('0x20')](_0x4d07('0x46'),_0x4d07('0x47'));_0x1a662e['download'](_0x1d5261);}; \ No newline at end of file +var _0x098b=['log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','request-promise','moment','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','../../config/license/util','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','downloadLogFile','license-info.log','join','/var'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x098b,0x99));var _0xb098=function(_0x38e831,_0x173fc0){_0x38e831=_0x38e831-0x0;var _0x497511=_0x098b[_0x38e831];return _0x497511;};'use strict';var emlformat=require(_0xb098('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb098('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb098('0x2'));var moment=require(_0xb098('0x3'));var BPromise=require(_0xb098('0x4'));var Mustache=require(_0xb098('0x5'));var util=require(_0xb098('0x6'));var path=require(_0xb098('0x7'));var sox=require(_0xb098('0x8'));var csv=require(_0xb098('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb098('0xa'));var _=require(_0xb098('0xb'));var squel=require('squel');var crypto=require(_0xb098('0xc'));var jsforce=require(_0xb098('0xd'));var deskjs=require(_0xb098('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb098('0xf'));var Papa=require('papaparse');var Redis=require(_0xb098('0x10'));var authService=require(_0xb098('0x11'));var qs=require(_0xb098('0x12'));var as=require(_0xb098('0x13'));var hardwareService=require(_0xb098('0x14'));var logger=require(_0xb098('0x15'))(_0xb098('0x16'));var utils=require(_0xb098('0x17'));var config=require(_0xb098('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1db1f1,_0x3e9bc0){_0x3e9bc0=_0x3e9bc0||0xcc;return function(_0x57b79f){if(_0x57b79f){return _0x1db1f1['sendStatus'](_0x3e9bc0);}return _0x1db1f1[_0xb098('0x19')](_0x3e9bc0)[_0xb098('0x1a')]();};}function respondWithResult(_0x25e99e,_0x91b417){_0x91b417=_0x91b417||0xc8;return function(_0x3766ca){if(_0x3766ca){return _0x25e99e['status'](_0x91b417)[_0xb098('0x1b')](_0x3766ca);}};}function respondWithFilteredResult(_0x1e1ce5,_0x3c4fc7){return function(_0x407f8f){if(_0x407f8f){var _0x52f2ce=typeof _0x3c4fc7[_0xb098('0x1c')]===_0xb098('0x1d')&&typeof _0x3c4fc7[_0xb098('0x1e')]===_0xb098('0x1d');var _0x158f61=_0x407f8f[_0xb098('0x1f')];var _0x212cbb=_0x52f2ce?0x0:_0x3c4fc7[_0xb098('0x1c')];var _0x4a3d30=_0x52f2ce?_0x407f8f[_0xb098('0x1f')]:_0x3c4fc7[_0xb098('0x1c')]+_0x3c4fc7['limit'];var _0x1af910;if(_0x4a3d30>=_0x158f61){_0x4a3d30=_0x158f61;_0x1af910=0xc8;}else{_0x1af910=0xce;}_0x1e1ce5['status'](_0x1af910);return _0x1e1ce5[_0xb098('0x20')]('Content-Range',_0x212cbb+'-'+_0x4a3d30+'/'+_0x158f61)[_0xb098('0x1b')](_0x407f8f);}return null;};}function patchUpdates(_0x196a29){return function(_0x280351){try{jsonpatch[_0xb098('0x21')](_0x280351,_0x196a29,!![]);}catch(_0x1e6f79){return BPromise[_0xb098('0x22')](_0x1e6f79);}return _0x280351['save']();};}function saveUpdates(_0x1d51d5,_0x6b35a0){return function(_0x484150){if(_0x484150){return _0x484150[_0xb098('0x23')](_0x1d51d5)['then'](function(_0x10b112){return _0x10b112;});}return null;};}function removeEntity(_0x3bbd71,_0x5509e1){return function(_0x203576){if(_0x203576){return _0x203576[_0xb098('0x24')]()[_0xb098('0x25')](function(){_0x3bbd71[_0xb098('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecd2b,_0x29a215){return function(_0x1efef7){if(!_0x1efef7){_0x2ecd2b[_0xb098('0x26')](0x194);}return _0x1efef7;};}function handleError(_0x3ccbb9,_0xf7c91a){_0xf7c91a=_0xf7c91a||0x1f4;return function(_0x2b081d){logger[_0xb098('0x27')](_0x2b081d[_0xb098('0x28')]);if(_0x2b081d[_0xb098('0x29')]){delete _0x2b081d[_0xb098('0x29')];}_0x3ccbb9['status'](_0xf7c91a)['send'](_0x2b081d);};}var utilLicense=require(_0xb098('0x2a'));exports['index']=function(_0x22d665,_0x33b940){var _0x36cfc4={'raw':!![],'where':{'id':0x1}},_0x27044c={};_0x27044c[_0xb098('0x2b')]=_['keys'](db[_0xb098('0x2c')][_0xb098('0x2d')]);_0x27044c[_0xb098('0x2e')]=_[_0xb098('0x2f')](_0x22d665[_0xb098('0x2e')]);_0x27044c[_0xb098('0x30')]=_[_0xb098('0x31')](_0x27044c[_0xb098('0x2b')],_0x27044c[_0xb098('0x2e')]);_0x36cfc4[_0xb098('0x32')]=_['intersection'](_0x27044c['model'],qs[_0xb098('0x33')](_0x22d665['query'][_0xb098('0x33')]));_0x36cfc4[_0xb098('0x32')]=_0x36cfc4[_0xb098('0x32')][_0xb098('0x34')]?_0x36cfc4[_0xb098('0x32')]:_0x27044c[_0xb098('0x2b')];_0x36cfc4=_[_0xb098('0x35')]({},_0x36cfc4,_0x22d665[_0xb098('0x36')]);return utilLicense[_0xb098('0x37')](_0x36cfc4)[_0xb098('0x25')](respondWithResult(_0x33b940,null))[_0xb098('0x38')](handleError(_0x33b940,null));};exports[_0xb098('0x23')]=function(_0x4fee20,_0x2fd8d8){if(_0x4fee20[_0xb098('0x39')]['id']){delete _0x4fee20[_0xb098('0x39')]['id'];}return db[_0xb098('0x2c')][_0xb098('0x3a')]({'where':{'id':_0x4fee20[_0xb098('0x3b')]['id']}})[_0xb098('0x25')](handleEntityNotFound(_0x2fd8d8,null))[_0xb098('0x25')](function(_0x987b04){var _0x4a1d2b=_0x987b04['get']({'plain':!![]});return utilLicense[_0xb098('0x3c')](_0x4a1d2b,_0x4fee20['body'][_0xb098('0x3d')]);})[_0xb098('0x25')](function(_0x26724b){if(!_0x26724b['demo']){return saveUpdates(_0x4fee20[_0xb098('0x39')],null);}return _0x26724b;})[_0xb098('0x25')](respondWithResult(_0x2fd8d8,null))[_0xb098('0x38')](handleError(_0x2fd8d8,null));};exports[_0xb098('0x3e')]=function(_0x5e13d9,_0x3bbdc4){var _0x544195=_0xb098('0x3f');var _0x592e56=path[_0xb098('0x40')](_0xb098('0x41'),_0xb098('0x42'),_0xb098('0x43'),_0x544195);_0x3bbdc4[_0xb098('0x44')](_0xb098('0x45'),_0xb098('0x46')+_0x544195);_0x3bbdc4[_0xb098('0x20')](_0xb098('0x47'),_0xb098('0x48'));_0x3bbdc4['download'](_0x592e56);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index fbd7bb5..1ec13e2 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 _0x4b7c=['lodash','api','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','License'];(function(_0x34533,_0x531aeb){var _0x5810ff=function(_0x478ff1){while(--_0x478ff1){_0x34533['push'](_0x34533['shift']());}};_0x5810ff(++_0x531aeb);}(_0x4b7c,0x183));var _0xc4b7=function(_0x4bae27,_0x303a51){_0x4bae27=_0x4bae27-0x0;var _0xd80087=_0x4b7c[_0x4bae27];return _0xd80087;};'use strict';var _=require(_0xc4b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc4b7('0x1'));var moment=require('moment');var BPromise=require(_0xc4b7('0x2'));var rp=require(_0xc4b7('0x3'));var fs=require('fs');var path=require(_0xc4b7('0x4'));var rimraf=require('rimraf');var config=require(_0xc4b7('0x5'));var attributes=require(_0xc4b7('0x6'));module[_0xc4b7('0x7')]=function(_0x52f790,_0x217f17){return _0x52f790['define'](_0xc4b7('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c1=['define','License','license','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x5d4142,_0x119c70){var _0x5254b0=function(_0x1a30bf){while(--_0x1a30bf){_0x5d4142['push'](_0x5d4142['shift']());}};_0x5254b0(++_0x119c70);}(_0x12c1,0x177));var _0x112c=function(_0x25ae60,_0x192abe){_0x25ae60=_0x25ae60-0x0;var _0x1e8059=_0x12c1[_0x25ae60];return _0x1e8059;};'use strict';var _=require(_0x112c('0x0'));var util=require(_0x112c('0x1'));var logger=require(_0x112c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x112c('0x3'));var rp=require(_0x112c('0x4'));var fs=require('fs');var path=require(_0x112c('0x5'));var rimraf=require(_0x112c('0x6'));var config=require(_0x112c('0x7'));var attributes=require(_0x112c('0x8'));module['exports']=function(_0x2a41fb,_0x3dffa7){return _0x2a41fb[_0x112c('0x9')](_0x112c('0xa'),attributes,{'tableName':_0x112c('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 284143a..5def824 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 _0x7dbd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','License,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','randomstring'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7dbd,0x1d9));var _0xd7db=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0x7dbd[_0x43b5a7];return _0x5461fe;};'use strict';var _=require(_0xd7db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd7db('0x1'));var fs=require('fs');var Redis=require(_0xd7db('0x2'));var db=require(_0xd7db('0x3'))['db'];var utils=require(_0xd7db('0x4'));var logger=require(_0xd7db('0x5'))(_0xd7db('0x6'));var config=require(_0xd7db('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x341b19,_0x4ebd2e,_0x1a58b9){return new BPromise(function(_0xd5f02d,_0x25054c){return client[_0xd7db('0x9')](_0x341b19,_0x1a58b9)['then'](function(_0x1e8fd1){logger['info'](_0xd7db('0xa'),_0x4ebd2e,_0xd7db('0xb'));logger[_0xd7db('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x4ebd2e,_0xd7db('0xb'),JSON['stringify'](_0x1e8fd1));if(_0x1e8fd1[_0xd7db('0xd')]){if(_0x1e8fd1[_0xd7db('0xd')][_0xd7db('0xe')]===0x1f4){logger[_0xd7db('0xd')](_0xd7db('0xa'),_0x4ebd2e,_0x1e8fd1['error'][_0xd7db('0xf')]);return _0x25054c(_0x1e8fd1[_0xd7db('0xd')][_0xd7db('0xf')]);}logger[_0xd7db('0xd')](_0xd7db('0xa'),_0x4ebd2e,_0x1e8fd1[_0xd7db('0xd')][_0xd7db('0xf')]);return _0xd5f02d(_0x1e8fd1[_0xd7db('0xd')][_0xd7db('0xf')]);}else{logger[_0xd7db('0x10')](_0xd7db('0xa'),_0x4ebd2e,_0xd7db('0xb'));_0xd5f02d(_0x1e8fd1[_0xd7db('0x11')]['message']);}})[_0xd7db('0x12')](function(_0x46aec0){logger[_0xd7db('0xd')](_0xd7db('0xa'),_0x4ebd2e,_0x46aec0);_0x25054c(_0x46aec0);});});} \ No newline at end of file +var _0x4247=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3eed5b,_0x55f6c1){var _0x30414c=function(_0xafd6ff){while(--_0xafd6ff){_0x3eed5b['push'](_0x3eed5b['shift']());}};_0x30414c(++_0x55f6c1);}(_0x4247,0xf6));var _0x7424=function(_0x2406b4,_0x3a78cf){_0x2406b4=_0x2406b4-0x0;var _0x30e3ec=_0x4247[_0x2406b4];return _0x30e3ec;};'use strict';var _=require(_0x7424('0x0'));var util=require(_0x7424('0x1'));var moment=require(_0x7424('0x2'));var BPromise=require(_0x7424('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7424('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7424('0x5'));var logger=require(_0x7424('0x6'))(_0x7424('0x7'));var config=require(_0x7424('0x8'));var jayson=require(_0x7424('0x9'));var client=jayson[_0x7424('0xa')][_0x7424('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x440c00,_0x2e4be5,_0x14d856){return new BPromise(function(_0xb1a2c3,_0x112ed0){return client[_0x7424('0xc')](_0x440c00,_0x14d856)[_0x7424('0xd')](function(_0x423e15){logger[_0x7424('0xe')](_0x7424('0xf'),_0x2e4be5,_0x7424('0x10'));logger[_0x7424('0x11')](_0x7424('0x12'),_0x2e4be5,_0x7424('0x10'),JSON[_0x7424('0x13')](_0x423e15));if(_0x423e15[_0x7424('0x14')]){if(_0x423e15[_0x7424('0x14')][_0x7424('0x15')]===0x1f4){logger[_0x7424('0x14')](_0x7424('0xf'),_0x2e4be5,_0x423e15[_0x7424('0x14')][_0x7424('0x16')]);return _0x112ed0(_0x423e15[_0x7424('0x14')][_0x7424('0x16')]);}logger[_0x7424('0x14')](_0x7424('0xf'),_0x2e4be5,_0x423e15[_0x7424('0x14')][_0x7424('0x16')]);return _0xb1a2c3(_0x423e15[_0x7424('0x14')][_0x7424('0x16')]);}else{logger[_0x7424('0xe')](_0x7424('0xf'),_0x2e4be5,_0x7424('0x10'));_0xb1a2c3(_0x423e15[_0x7424('0x17')]['message']);}})[_0x7424('0x18')](function(_0x15e0e9){logger[_0x7424('0x14')](_0x7424('0xf'),_0x2e4be5,_0x15e0e9);_0x112ed0(_0x15e0e9);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4d1c656..77506f3 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 _0x7219=['getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','create','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/out_servers','removeSmtp','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/users'];(function(_0x2e26f6,_0x45ef20){var _0x113645=function(_0x1c42aa){while(--_0x1c42aa){_0x2e26f6['push'](_0x2e26f6['shift']());}};_0x113645(++_0x45ef20);}(_0x7219,0x175));var _0x9721=function(_0x54c21a,_0x32fbe1){_0x54c21a=_0x54c21a-0x0;var _0x32395d=_0x7219[_0x54c21a];return _0x32395d;};'use strict';var multer=require(_0x9721('0x0'));var util=require(_0x9721('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9721('0x2'));var router=express[_0x9721('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9721('0x4'));var interaction=require(_0x9721('0x5'));var config=require(_0x9721('0x6'));var controller=require(_0x9721('0x7'));router[_0x9721('0x8')]('/',auth[_0x9721('0x9')](),controller['index']);router[_0x9721('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9721('0xa')]);router[_0x9721('0x8')](_0x9721('0xb'),auth['isAuthenticated'](),controller[_0x9721('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9721('0xd')]);router[_0x9721('0x8')]('/:id/canned_answers',auth[_0x9721('0x9')](),controller[_0x9721('0xe')]);router[_0x9721('0x8')](_0x9721('0xf'),auth[_0x9721('0x9')](),controller[_0x9721('0x10')]);router[_0x9721('0x8')]('/:id/out_servers',auth[_0x9721('0x9')](),controller[_0x9721('0x11')]);router[_0x9721('0x8')](_0x9721('0x12'),auth[_0x9721('0x9')](),controller['getInteractions']);router[_0x9721('0x8')]('/:id/applications',auth[_0x9721('0x9')](),controller[_0x9721('0x13')]);router[_0x9721('0x8')](_0x9721('0x14'),auth[_0x9721('0x9')](),controller[_0x9721('0x15')]);router[_0x9721('0x8')]('/:id/verify',auth[_0x9721('0x9')](),controller['verifySmtp']);router[_0x9721('0x8')](_0x9721('0x16'),auth[_0x9721('0x9')](),controller[_0x9721('0x17')]);router[_0x9721('0x18')](_0x9721('0x19'),auth[_0x9721('0x9')](),controller[_0x9721('0x1a')]);router[_0x9721('0x18')](_0x9721('0x1b'),auth[_0x9721('0x9')](),controller['addAnswer']);router[_0x9721('0x18')]('/',auth[_0x9721('0x9')](),controller[_0x9721('0x1c')]);router[_0x9721('0x18')](_0x9721('0xf'),auth[_0x9721('0x9')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0x9721('0x9')](),controller[_0x9721('0x1d')]);router[_0x9721('0x18')](_0x9721('0x12'),auth[_0x9721('0x9')](),controller[_0x9721('0x1e')]);router[_0x9721('0x18')](_0x9721('0x1f'),auth[_0x9721('0x9')](),controller[_0x9721('0x20')]);router[_0x9721('0x18')](_0x9721('0x21'),auth[_0x9721('0x9')](),controller[_0x9721('0x22')]);router['post'](_0x9721('0x16'),auth[_0x9721('0x9')](),controller[_0x9721('0x23')]);router[_0x9721('0x24')]('/:id',auth[_0x9721('0x9')](),controller[_0x9721('0x25')]);router[_0x9721('0x26')](_0x9721('0x19'),auth['isAuthenticated'](),controller[_0x9721('0x27')]);router[_0x9721('0x26')](_0x9721('0x1b'),auth[_0x9721('0x9')](),controller[_0x9721('0x28')]);router[_0x9721('0x26')](_0x9721('0xf'),auth['isAuthenticated'](),controller['removeImap']);router[_0x9721('0x26')](_0x9721('0x29'),auth[_0x9721('0x9')](),controller[_0x9721('0x2a')]);router[_0x9721('0x26')](_0x9721('0xb'),auth[_0x9721('0x9')](),controller['destroy']);router['delete'](_0x9721('0x16'),auth['isAuthenticated'](),controller[_0x9721('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x9e51=['create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/applications','send','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition'];(function(_0x40490e,_0x5a624e){var _0x56a419=function(_0x20fa49){while(--_0x20fa49){_0x40490e['push'](_0x40490e['shift']());}};_0x56a419(++_0x5a624e);}(_0x9e51,0x69));var _0x19e5=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x9e51[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0x19e5('0x0'));var util=require('util');var path=require(_0x19e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x19e5('0x2'));var router=express[_0x19e5('0x3')]();var fs_extra=require(_0x19e5('0x4'));var auth=require(_0x19e5('0x5'));var interaction=require(_0x19e5('0x6'));var config=require(_0x19e5('0x7'));var controller=require('./mailAccount.controller');router[_0x19e5('0x8')]('/',auth[_0x19e5('0x9')](),controller[_0x19e5('0xa')]);router[_0x19e5('0x8')](_0x19e5('0xb'),auth[_0x19e5('0x9')](),controller[_0x19e5('0xc')]);router[_0x19e5('0x8')](_0x19e5('0xd'),auth[_0x19e5('0x9')](),controller[_0x19e5('0xe')]);router['get'](_0x19e5('0xf'),auth['isAuthenticated'](),controller[_0x19e5('0x10')]);router[_0x19e5('0x8')](_0x19e5('0x11'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x12')]);router[_0x19e5('0x8')]('/:id/in_servers',auth[_0x19e5('0x9')](),controller[_0x19e5('0x13')]);router[_0x19e5('0x8')](_0x19e5('0x14'),auth['isAuthenticated'](),controller[_0x19e5('0x15')]);router['get'](_0x19e5('0x16'),auth['isAuthenticated'](),controller[_0x19e5('0x17')]);router['get']('/:id/applications',auth[_0x19e5('0x9')](),controller['getApplications']);router[_0x19e5('0x8')]('/:id/messages',auth[_0x19e5('0x9')](),controller['getMessages']);router[_0x19e5('0x8')](_0x19e5('0x18'),auth['isAuthenticated'](),controller[_0x19e5('0x19')]);router[_0x19e5('0x8')](_0x19e5('0x1a'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x1b')]);router[_0x19e5('0x1c')](_0x19e5('0xf'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x1d')]);router[_0x19e5('0x1c')](_0x19e5('0x11'),auth[_0x19e5('0x9')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x19e5('0x1e')]);router[_0x19e5('0x1c')](_0x19e5('0x1f'),auth['isAuthenticated'](),controller[_0x19e5('0x20')]);router[_0x19e5('0x1c')](_0x19e5('0x14'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x21')]);router[_0x19e5('0x1c')](_0x19e5('0x16'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x22')]);router[_0x19e5('0x1c')](_0x19e5('0x23'),auth['isAuthenticated'](),controller['addApplications']);router[_0x19e5('0x1c')]('/:id/send',auth['isAuthenticated'](),controller[_0x19e5('0x24')]);router['post'](_0x19e5('0x1a'),auth[_0x19e5('0x9')](),controller['addAgents']);router[_0x19e5('0x25')](_0x19e5('0xd'),auth[_0x19e5('0x9')](),controller['update']);router[_0x19e5('0x26')](_0x19e5('0xf'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x27')]);router['delete'](_0x19e5('0x11'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x28')]);router[_0x19e5('0x26')]('/:id/in_servers',auth[_0x19e5('0x9')](),controller[_0x19e5('0x29')]);router[_0x19e5('0x26')](_0x19e5('0x14'),auth['isAuthenticated'](),controller[_0x19e5('0x2a')]);router[_0x19e5('0x26')]('/:id',auth[_0x19e5('0x9')](),controller[_0x19e5('0x2b')]);router[_0x19e5('0x26')](_0x19e5('0x1a'),auth[_0x19e5('0x9')](),controller[_0x19e5('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8128526..ce69ae3 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 _0xdc95=['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','hotmail','yahoo','outlook365','getDataValue','provider','custom'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdc95,0x130));var _0x5dc9=function(_0x449863,_0x4226f0){_0x449863=_0x449863-0x0;var _0x456789=_0xdc95[_0x449863];return _0x456789;};'use strict';var Sequelize=require('sequelize');module[_0x5dc9('0x0')]={'description':{'type':Sequelize[_0x5dc9('0x1')]},'name':{'type':Sequelize[_0x5dc9('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5dc9('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5dc9('0x3')]},'markAsUnread':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dc9('0x4')},'fontSize':{'type':Sequelize[_0x5dc9('0x5')](0x2)[_0x5dc9('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5dc9('0x3')],'defaultValue':function(){return _0x5dc9('0x7');}},'notificationSound':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5dc9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5dc9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5dc9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5dc9('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x5dc9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5dc9('0x2')],'defaultValue':![],'comment':_0x5dc9('0x9'),'set':function(_0x5f0b7f){if(!_0x5f0b7f)this[_0x5dc9('0xa')](_0x5dc9('0xb'),null);this[_0x5dc9('0xa')](_0x5dc9('0xc'),_0x5f0b7f);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x5dc9('0xd'),_0x5dc9('0xe'),_0x5dc9('0xf')),'defaultValue':null,'get':function(){var _0x42a600=this[_0x5dc9('0x10')](_0x5dc9('0x11'));return _0x42a600||_0x5dc9('0x12');},'set':function(_0x22a9f5){if(_0x22a9f5===_0x5dc9('0x12')){_0x22a9f5=null;}return this[_0x5dc9('0xa')](_0x5dc9('0x11'),_0x22a9f5);}}}; \ No newline at end of file +var _0x6f30=['gmail','yahoo','outlook365','getDataValue','custom','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x6f30,0x9d));var _0x06f3=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x6f30[_0x10dc64];return _0x9cf98d;};'use strict';var Sequelize=require('sequelize');module[_0x06f3('0x0')]={'description':{'type':Sequelize[_0x06f3('0x1')]},'name':{'type':Sequelize[_0x06f3('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x06f3('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x06f3('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x06f3('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x06f3('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x06f3('0x3')]},'markAsUnread':{'type':Sequelize[_0x06f3('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x06f3('0x1')],'allowNull':![],'defaultValue':_0x06f3('0x4')},'fontSize':{'type':Sequelize[_0x06f3('0x5')](0x2)[_0x06f3('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x06f3('0x3')],'defaultValue':function(){return _0x06f3('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06f3('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x06f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x06f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x06f3('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x06f3('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x06f3('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x06f3('0x9'),'set':function(_0x136fa5){if(!_0x136fa5)this['setDataValue'](_0x06f3('0xa'),null);this[_0x06f3('0xb')](_0x06f3('0xc'),_0x136fa5);}},'provider':{'type':Sequelize[_0x06f3('0xd')](_0x06f3('0xe'),'hotmail',_0x06f3('0xf'),_0x06f3('0x10')),'defaultValue':null,'get':function(){var _0x28c331=this[_0x06f3('0x11')]('provider');return _0x28c331||'custom';},'set':function(_0x2dcb8c){if(_0x2dcb8c===_0x06f3('0x12')){_0x2dcb8c=null;}return this[_0x06f3('0xb')]('provider',_0x2dcb8c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b0fce9c..a43bcce 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 _0x5fc4=['error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','destroy','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','username','Imap','Smtp','index','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','MailServerIn','MailServerOut','Pause','intersection','length','include','find','body','custom','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','rows','removeDispositions','CannedAnswer','getAnswers','nolimit','removeAnswers','ids','email','isNil','active','description','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tags','color','tag','sequelize','Transaction','bulkCreate','findAndCountAll','priority','finally','MailApplication','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','attachments','join','root','server/files/attachments','basename','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x42453b,_0x2bb552){var _0x3116a7=function(_0x1b0be4){while(--_0x1b0be4){_0x42453b['push'](_0x42453b['shift']());}};_0x3116a7(++_0x2bb552);}(_0x5fc4,0xa9));var _0x45fc=function(_0x2c4fe0,_0x14b057){_0x2c4fe0=_0x2c4fe0-0x0;var _0x14c95e=_0x5fc4[_0x2c4fe0];return _0x14c95e;};'use strict';var moment=require(_0x45fc('0x0'));var BPromise=require('bluebird');var util=require(_0x45fc('0x1'));var path=require(_0x45fc('0x2'));var _=require(_0x45fc('0x3'));var juice=require(_0x45fc('0x4'));var Redis=require(_0x45fc('0x5'));var qs=require(_0x45fc('0x6'));var logger=require(_0x45fc('0x7'))(_0x45fc('0x8'));var config=require(_0x45fc('0x9'));var db=require(_0x45fc('0xa'))['db'];config[_0x45fc('0xb')]=_[_0x45fc('0xc')](config[_0x45fc('0xb')],{'host':_0x45fc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45fc('0xb')]));require(_0x45fc('0xe'))['register'](socket);var jayson=require(_0x45fc('0xf'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x239bd0,_0x3b8a81,_0x159135,_0x1ac0f2){return new BPromise(function(_0x4a9887,_0x131dcb){var _0x467669=_0x1ac0f2||client;return _0x467669[_0x45fc('0x10')](_0x239bd0,_0x159135)[_0x45fc('0x11')](function(_0x55ac43){logger[_0x45fc('0x12')]('MailAccount,\x20%s,\x20%s',_0x3b8a81,_0x45fc('0x13'));logger[_0x45fc('0x14')](_0x45fc('0x15'),_0x3b8a81,_0x45fc('0x13'),JSON[_0x45fc('0x16')](_0x55ac43));if(_0x55ac43[_0x45fc('0x17')]){if(_0x55ac43[_0x45fc('0x17')][_0x45fc('0x18')]===0x1f4){logger[_0x45fc('0x17')](_0x45fc('0x19'),_0x3b8a81,_0x55ac43[_0x45fc('0x17')][_0x45fc('0x1a')]);return _0x131dcb(_0x55ac43['error'][_0x45fc('0x1a')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3b8a81,_0x55ac43[_0x45fc('0x17')][_0x45fc('0x1a')]);return _0x4a9887(_0x55ac43[_0x45fc('0x17')][_0x45fc('0x1a')]);}else{logger[_0x45fc('0x12')]('MailAccount,\x20%s,\x20%s',_0x3b8a81,_0x45fc('0x13'));_0x4a9887(_0x55ac43[_0x45fc('0x1b')]['message']);}})[_0x45fc('0x1c')](function(_0x3519bf){logger[_0x45fc('0x17')](_0x45fc('0x19'),_0x3b8a81,_0x3519bf);_0x131dcb(_0x3519bf);});});}function respondWithStatusCode(_0x4be641,_0x32a620){_0x32a620=_0x32a620||0xcc;return function(_0x4e8a08){if(_0x4e8a08){return _0x4be641[_0x45fc('0x1d')](_0x32a620);}return _0x4be641[_0x45fc('0x1e')](_0x32a620)[_0x45fc('0x1f')]();};}function respondWithResult(_0xacee66,_0x5a2edd){_0x5a2edd=_0x5a2edd||0xc8;return function(_0x6c1fc4){if(_0x6c1fc4){return _0xacee66[_0x45fc('0x1e')](_0x5a2edd)[_0x45fc('0x20')](_0x6c1fc4);}};}function respondWithFilteredResult(_0x3db4c7,_0x419d7e){return function(_0x3cd5ee){if(_0x3cd5ee){var _0x31215c=typeof _0x419d7e[_0x45fc('0x21')]===_0x45fc('0x22')&&typeof _0x419d7e['limit']==='undefined';var _0x58f17=_0x3cd5ee[_0x45fc('0x23')];var _0x55dc0d=_0x31215c?0x0:_0x419d7e[_0x45fc('0x21')];var _0x36eec1=_0x31215c?_0x3cd5ee[_0x45fc('0x23')]:_0x419d7e[_0x45fc('0x21')]+_0x419d7e[_0x45fc('0x24')];var _0x477f38;if(_0x36eec1>=_0x58f17){_0x36eec1=_0x58f17;_0x477f38=0xc8;}else{_0x477f38=0xce;}_0x3db4c7[_0x45fc('0x1e')](_0x477f38);return _0x3db4c7[_0x45fc('0x25')]('Content-Range',_0x55dc0d+'-'+_0x36eec1+'/'+_0x58f17)[_0x45fc('0x20')](_0x3cd5ee);}return null;};}function saveUpdates(_0x43754d){return function(_0x14a9db){if(_0x14a9db){return _0x14a9db[_0x45fc('0x26')](_0x43754d)[_0x45fc('0x11')](function(_0x460b01){return _0x460b01;});}return null;};}function removeEntity(_0x329f37){return function(_0x2ffbc0){if(_0x2ffbc0){return _0x2ffbc0[_0x45fc('0x27')]()[_0x45fc('0x11')](function(){var _0x3b37d6=_0x2ffbc0['get']({'plain':!![]});var _0x2080d4=_0x45fc('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2080d4,'resourceId':_0x3b37d6['id']}})['then'](function(){return _0x2ffbc0;});})[_0x45fc('0x11')](function(){_0x329f37[_0x45fc('0x1e')](0xcc)[_0x45fc('0x1f')]();});}};}function handleEntityNotFound(_0x59313c){return function(_0x2722f9){if(!_0x2722f9){_0x59313c[_0x45fc('0x1d')](0x194);}return _0x2722f9;};}function handleError(_0x2567f0,_0x10df33){_0x10df33=_0x10df33||0x1f4;return function(_0x57d7d1){logger['error'](_0x57d7d1[_0x45fc('0x29')]);if(_0x57d7d1[_0x45fc('0x2a')]){delete _0x57d7d1[_0x45fc('0x2a')];}_0x2567f0[_0x45fc('0x1e')](_0x10df33)[_0x45fc('0x2b')](_0x57d7d1);};}function getImapHost(_0x182922){switch(_0x182922){case _0x45fc('0x2c'):return _0x45fc('0x2d');case _0x45fc('0x2e'):return _0x45fc('0x2f');case'hotmail':return _0x45fc('0x30');case _0x45fc('0x31'):return _0x45fc('0x32');}throw new Error(_0x45fc('0x33'),_0x182922);}function getSmtpHost(_0xf0666){switch(_0xf0666){case _0x45fc('0x2c'):return _0x45fc('0x34');case _0x45fc('0x2e'):return _0x45fc('0x35');case'hotmail':return _0x45fc('0x36');case _0x45fc('0x31'):return _0x45fc('0x37');}throw new Error(_0x45fc('0x33'),_0xf0666);}function getAuthenticationOptions(_0x20706a,_0x45f2c8){var _0x150f68={};var _0xf30634={};if(_0x20706a){_0x150f68[_0x45fc('0x38')]=_0xf30634[_0x45fc('0x38')]=_0x45f2c8['username'];_0x150f68[_0x45fc('0x39')]=_0xf30634['pass']=_0x45f2c8[_0x45fc('0x39')];if(_0x45f2c8[_0x45fc('0x3a')]){_0x150f68['modernAuthentication']=_0xf30634[_0x45fc('0x3a')]=!![];_0x150f68[_0x45fc('0x3b')]=_0xf30634[_0x45fc('0x3b')]=_0x45f2c8[_0x45fc('0x3b')];_0x150f68[_0x45fc('0x39')]=_0xf30634[_0x45fc('0x3c')]=null;}else{_0x150f68[_0x45fc('0x3b')]=_0xf30634['CloudProviderId']=null;}_0x150f68[_0x45fc('0x3d')]=getImapHost(_0x20706a);_0x150f68[_0x45fc('0x3e')]=0x3e1;_0xf30634[_0x45fc('0x3d')]=getSmtpHost(_0x20706a);_0xf30634['port']=0x24b;_0xf30634[_0x45fc('0x3f')]=![];_0x150f68[_0x45fc('0x40')]=_0xf30634[_0x45fc('0x40')]=null;}else{if(_0x45f2c8[_0x45fc('0x41')]){_0x150f68[_0x45fc('0x38')]=_0xf30634[_0x45fc('0x38')]=_0x45f2c8[_0x45fc('0x42')];_0x150f68[_0x45fc('0x39')]=_0xf30634['pass']=_0x45f2c8[_0x45fc('0x39')];}else{_0x150f68[_0x45fc('0x41')]=_0xf30634[_0x45fc('0x41')]=![];_0x150f68[_0x45fc('0x38')]=_0xf30634['user']=null;_0x150f68[_0x45fc('0x39')]=_0xf30634[_0x45fc('0x3c')]=null;}_0x150f68[_0x45fc('0x3d')]=_0x45f2c8[_0x45fc('0x43')]['host'];_0x150f68[_0x45fc('0x3e')]=_0x45f2c8[_0x45fc('0x43')][_0x45fc('0x3e')];_0xf30634[_0x45fc('0x3d')]=_0x45f2c8[_0x45fc('0x44')][_0x45fc('0x3d')];_0xf30634[_0x45fc('0x3e')]=_0x45f2c8['Smtp'][_0x45fc('0x3e')];}return{'Imap':_0x150f68,'Smtp':_0xf30634};}exports[_0x45fc('0x45')]=function(_0x52701a,_0x2c8857){var _0x2d238a={'include':[{'model':db['MailServerIn'],'as':_0x45fc('0x43')},{'model':db['MailServerOut'],'as':_0x45fc('0x44')},{'model':db['Pause'],'as':_0x45fc('0x46')}]},_0x31a41f={},_0x3ba78b={'count':0x0,'rows':[]};var _0xe06e64=_[_0x45fc('0x47')](db[_0x45fc('0x48')]['rawAttributes'],function(_0x73db0b){return{'name':_0x73db0b[_0x45fc('0x49')],'type':_0x73db0b[_0x45fc('0x4a')][_0x45fc('0x4b')]};});_0x31a41f[_0x45fc('0x4c')]=_[_0x45fc('0x47')](_0xe06e64,_0x45fc('0x2a'));_0x31a41f[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x52701a['query']);_0x31a41f['filters']=_['intersection'](_0x31a41f['model'],_0x31a41f[_0x45fc('0x4d')]);_0x2d238a[_0x45fc('0x4f')]=_['intersection'](_0x31a41f['model'],qs['fields'](_0x52701a[_0x45fc('0x4d')][_0x45fc('0x50')]));_0x2d238a[_0x45fc('0x4f')]=_0x2d238a[_0x45fc('0x4f')]['length']?_0x2d238a['attributes']:_0x31a41f[_0x45fc('0x4c')];if(!_0x52701a['query']['hasOwnProperty']('nolimit')){_0x2d238a['limit']=qs[_0x45fc('0x24')](_0x52701a[_0x45fc('0x4d')][_0x45fc('0x24')]);_0x2d238a[_0x45fc('0x21')]=qs['offset'](_0x52701a['query'][_0x45fc('0x21')]);}_0x2d238a[_0x45fc('0x51')]=qs[_0x45fc('0x52')](_0x52701a[_0x45fc('0x4d')]['sort']);_0x2d238a[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_[_0x45fc('0x55')](_0x52701a['query'],_0x31a41f[_0x45fc('0x54')]),_0xe06e64);if(_0x52701a[_0x45fc('0x4d')][_0x45fc('0x56')]){_0x2d238a[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x2d238a[_0x45fc('0x53')],{'$or':_[_0x45fc('0x47')](_0xe06e64,function(_0x7c301b){if(_0x7c301b[_0x45fc('0x4a')]!==_0x45fc('0x58')){var _0x5ef8ab={};_0x5ef8ab[_0x7c301b[_0x45fc('0x2a')]]={'$like':'%'+_0x52701a['query'][_0x45fc('0x56')]+'%'};return _0x5ef8ab;}})});}_0x2d238a=_[_0x45fc('0x57')]({},_0x2d238a,_0x52701a[_0x45fc('0x59')]);var _0x4375d4={'where':_0x2d238a[_0x45fc('0x53')]};return db[_0x45fc('0x48')][_0x45fc('0x23')](_0x4375d4)[_0x45fc('0x11')](function(_0x4b91de){_0x3ba78b[_0x45fc('0x23')]=_0x4b91de;if(_0x52701a[_0x45fc('0x4d')][_0x45fc('0x5a')]){_0x2d238a['include']=[{'all':!![]}];}return db['MailAccount'][_0x45fc('0x5b')](_0x2d238a);})[_0x45fc('0x11')](function(_0x28815d){_0x3ba78b['rows']=_0x28815d;return _0x3ba78b;})['then'](respondWithFilteredResult(_0x2c8857,_0x2d238a))[_0x45fc('0x1c')](handleError(_0x2c8857,null));};exports['show']=function(_0x459c09,_0x19d5f8){var _0x278dc5={'raw':![],'where':{'id':_0x459c09[_0x45fc('0x5c')]['id']},'include':[{'model':db[_0x45fc('0x5d')],'as':_0x45fc('0x43')},{'model':db[_0x45fc('0x5e')],'as':_0x45fc('0x44')},{'model':db[_0x45fc('0x5f')],'as':_0x45fc('0x46')}]},_0x25643b={};_0x25643b[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db[_0x45fc('0x48')]['rawAttributes']);_0x25643b[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x459c09['query']);_0x25643b[_0x45fc('0x54')]=_[_0x45fc('0x60')](_0x25643b[_0x45fc('0x4c')],_0x25643b[_0x45fc('0x4d')]);_0x278dc5[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x25643b['model'],qs[_0x45fc('0x50')](_0x459c09['query'][_0x45fc('0x50')]));_0x278dc5[_0x45fc('0x4f')]=_0x278dc5[_0x45fc('0x4f')][_0x45fc('0x61')]?_0x278dc5[_0x45fc('0x4f')]:_0x25643b[_0x45fc('0x4c')];if(_0x459c09[_0x45fc('0x4d')][_0x45fc('0x5a')]){_0x278dc5[_0x45fc('0x62')]=[{'all':!![]}];}_0x278dc5=_[_0x45fc('0x57')]({},_0x278dc5,_0x459c09[_0x45fc('0x59')]);return db[_0x45fc('0x48')][_0x45fc('0x63')](_0x278dc5)[_0x45fc('0x11')](handleEntityNotFound(_0x19d5f8,null))[_0x45fc('0x11')](respondWithResult(_0x19d5f8,null))[_0x45fc('0x1c')](handleError(_0x19d5f8,null));};exports['update']=function(_0x14a30b,_0x4a8ddd){if(_0x14a30b[_0x45fc('0x64')]['id']){delete _0x14a30b['body']['id'];}var _0x12d224=_0x14a30b[_0x45fc('0x64')]['provider']===_0x45fc('0x65')?null:_0x14a30b['body'][_0x45fc('0x66')];var _0x55f5c2=_0x14a30b[_0x45fc('0x64')][_0x45fc('0x43')]||{};var _0x17ecfa=_0x14a30b[_0x45fc('0x64')][_0x45fc('0x44')]||{};if(_0x12d224){_0x55f5c2[_0x45fc('0x3d')]=getImapHost(_0x12d224);_0x55f5c2['port']=0x3e1;_0x17ecfa[_0x45fc('0x3d')]=getSmtpHost(_0x12d224);_0x17ecfa['port']=0x24b;_0x17ecfa['secure']=![];}if(_0x17ecfa[_0x45fc('0x3a')]){_0x17ecfa['secure']=![];}else{_0x17ecfa[_0x45fc('0x3b')]=null;}if(!_0x55f5c2['modernAuthentication'])_0x55f5c2['CloudProviderId']=null;_0x14a30b[_0x45fc('0x64')]['Imap']=_0x55f5c2;_0x14a30b['body'][_0x45fc('0x44')]=_0x17ecfa;return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x14a30b['params']['id']},'include':[{'model':db[_0x45fc('0x5d')],'as':_0x45fc('0x43')},{'model':db[_0x45fc('0x5e')],'as':_0x45fc('0x44')},{'model':db[_0x45fc('0x5f')],'as':_0x45fc('0x46')}]})[_0x45fc('0x11')](handleEntityNotFound(_0x4a8ddd,null))[_0x45fc('0x11')](function(_0x1d3f3a){if(!_0x1d3f3a)throw new Error(_0x45fc('0x67'));if(_0x1d3f3a[_0x45fc('0x40')])delete _0x14a30b[_0x45fc('0x64')][_0x45fc('0x43')];return _0x1d3f3a;})[_0x45fc('0x11')](saveUpdates(_0x14a30b[_0x45fc('0x64')],null))['then'](function(_0x2477c6){if(!_0x14a30b[_0x45fc('0x64')][_0x45fc('0x43')])return _0x2477c6;return db[_0x45fc('0x5d')][_0x45fc('0x26')](_0x14a30b['body']['Imap'],{'where':{'MailAccountId':_0x2477c6['id']}})['then'](function(){return _0x2477c6;});})['then'](function(_0x3a4a4c){if(!_0x14a30b[_0x45fc('0x64')][_0x45fc('0x44')])return _0x3a4a4c;return db[_0x45fc('0x5e')][_0x45fc('0x26')](_0x14a30b[_0x45fc('0x64')][_0x45fc('0x44')],{'where':{'MailAccountId':_0x3a4a4c['id']}})[_0x45fc('0x11')](function(){return _0x3a4a4c;});})[_0x45fc('0x11')](respondWithResult(_0x4a8ddd,null))['catch'](handleError(_0x4a8ddd,null));};exports[_0x45fc('0x68')]=function(_0x37ea7d,_0x34dcd7){return db[_0x45fc('0x48')]['describe']()[_0x45fc('0x11')](respondWithResult(_0x34dcd7,null))[_0x45fc('0x1c')](handleError(_0x34dcd7,null));};exports[_0x45fc('0x69')]=function(_0x9d7d31,_0xf76cee){if(_0x9d7d31[_0x45fc('0x64')]['id']){delete _0x9d7d31[_0x45fc('0x64')]['id'];}return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x9d7d31[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0xf76cee,null))[_0x45fc('0x11')](function(_0x22ab42){if(_0x22ab42){_0x9d7d31['body'][_0x45fc('0x6a')]=_0x22ab42['id'];return db[_0x45fc('0x6b')][_0x45fc('0x6c')](_0x9d7d31[_0x45fc('0x64')]);}})[_0x45fc('0x11')](respondWithResult(_0xf76cee,null))[_0x45fc('0x1c')](handleError(_0xf76cee,null));};exports[_0x45fc('0x6d')]=function(_0x309341,_0x28e265){var _0x366034={'raw':![],'where':{}};var _0x4afb16={};var _0x58a1ff={'count':0x0,'rows':[]};return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x309341['params']['id']}})['then'](handleEntityNotFound(_0x28e265,null))['then'](function(_0x121488){if(_0x121488){_0x4afb16[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db[_0x45fc('0x6b')][_0x45fc('0x6f')]);_0x4afb16[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x309341['query']);_0x4afb16[_0x45fc('0x54')]=_['intersection'](_0x4afb16[_0x45fc('0x4c')],_0x4afb16[_0x45fc('0x4d')]);_0x366034[_0x45fc('0x4f')]=_['intersection'](_0x4afb16[_0x45fc('0x4c')],qs[_0x45fc('0x50')](_0x309341[_0x45fc('0x4d')][_0x45fc('0x50')]));_0x366034['attributes']=_0x366034[_0x45fc('0x4f')]['length']?_0x366034[_0x45fc('0x4f')]:_0x4afb16[_0x45fc('0x4c')];if(!_0x309341[_0x45fc('0x4d')][_0x45fc('0x70')]('nolimit')){_0x366034['limit']=qs[_0x45fc('0x24')](_0x309341[_0x45fc('0x4d')][_0x45fc('0x24')]);_0x366034[_0x45fc('0x21')]=qs[_0x45fc('0x21')](_0x309341[_0x45fc('0x4d')][_0x45fc('0x21')]);}_0x366034[_0x45fc('0x51')]=qs[_0x45fc('0x52')](_0x309341['query'][_0x45fc('0x52')]);_0x366034[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_['pick'](_0x309341[_0x45fc('0x4d')],_0x4afb16[_0x45fc('0x54')]));_0x366034[_0x45fc('0x53')][_0x45fc('0x6a')]=_0x121488['id'];if(_0x309341[_0x45fc('0x4d')][_0x45fc('0x56')]){_0x366034[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x366034[_0x45fc('0x53')],{'$or':_[_0x45fc('0x47')](_0x366034[_0x45fc('0x4f')],function(_0x3cb0ec){var _0x30a843={};_0x30a843[_0x3cb0ec]={'$like':'%'+_0x309341[_0x45fc('0x4d')][_0x45fc('0x56')]+'%'};return _0x30a843;})});}_0x366034=_[_0x45fc('0x57')]({},_0x366034,_0x309341[_0x45fc('0x59')]);return db[_0x45fc('0x6b')]['count']({'where':_0x366034['where']})[_0x45fc('0x11')](function(_0x524796){_0x58a1ff[_0x45fc('0x23')]=_0x524796;if(_0x309341[_0x45fc('0x4d')][_0x45fc('0x5a')]){_0x366034[_0x45fc('0x62')]=[{'all':!![]}];}return db[_0x45fc('0x6b')][_0x45fc('0x5b')](_0x366034);})[_0x45fc('0x11')](function(_0x20df29){_0x58a1ff[_0x45fc('0x71')]=_0x20df29;return _0x58a1ff;});}})[_0x45fc('0x11')](respondWithFilteredResult(_0x28e265,_0x366034))[_0x45fc('0x1c')](handleError(_0x28e265,null));};exports[_0x45fc('0x72')]=function(_0x5e5e6e,_0x3052dd){return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x5e5e6e[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x3052dd,null))[_0x45fc('0x11')](function(_0x503635){if(_0x503635){return _0x503635[_0x45fc('0x72')](_0x5e5e6e['query']['ids']);}})[_0x45fc('0x11')](respondWithStatusCode(_0x3052dd,null))[_0x45fc('0x1c')](handleError(_0x3052dd,null));};exports['addAnswer']=function(_0x25933e,_0xefc637){if(_0x25933e['body']['id']){delete _0x25933e[_0x45fc('0x64')]['id'];}return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x25933e[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0xefc637,null))['then'](function(_0x5a8bf0){if(_0x5a8bf0){_0x25933e[_0x45fc('0x64')][_0x45fc('0x6a')]=_0x5a8bf0['id'];return db[_0x45fc('0x73')][_0x45fc('0x6c')](_0x25933e[_0x45fc('0x64')]);}})[_0x45fc('0x11')](respondWithResult(_0xefc637,null))['catch'](handleError(_0xefc637,null));};exports[_0x45fc('0x74')]=function(_0x5a76f6,_0x39e463){var _0x198bc7={'raw':![],'where':{}};var _0x5be793={};var _0x1fed9d={'count':0x0,'rows':[]};return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x5a76f6[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x39e463,null))[_0x45fc('0x11')](function(_0x20e4ba){if(_0x20e4ba){_0x5be793[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db[_0x45fc('0x73')][_0x45fc('0x6f')]);_0x5be793[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x5a76f6[_0x45fc('0x4d')]);_0x5be793['filters']=_['intersection'](_0x5be793[_0x45fc('0x4c')],_0x5be793[_0x45fc('0x4d')]);_0x198bc7[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x5be793['model'],qs[_0x45fc('0x50')](_0x5a76f6[_0x45fc('0x4d')][_0x45fc('0x50')]));_0x198bc7[_0x45fc('0x4f')]=_0x198bc7[_0x45fc('0x4f')][_0x45fc('0x61')]?_0x198bc7[_0x45fc('0x4f')]:_0x5be793[_0x45fc('0x4c')];if(!_0x5a76f6[_0x45fc('0x4d')][_0x45fc('0x70')](_0x45fc('0x75'))){_0x198bc7[_0x45fc('0x24')]=qs[_0x45fc('0x24')](_0x5a76f6[_0x45fc('0x4d')][_0x45fc('0x24')]);_0x198bc7[_0x45fc('0x21')]=qs[_0x45fc('0x21')](_0x5a76f6['query'][_0x45fc('0x21')]);}_0x198bc7[_0x45fc('0x51')]=qs['sort'](_0x5a76f6[_0x45fc('0x4d')][_0x45fc('0x52')]);_0x198bc7[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_[_0x45fc('0x55')](_0x5a76f6[_0x45fc('0x4d')],_0x5be793[_0x45fc('0x54')]));_0x198bc7[_0x45fc('0x53')][_0x45fc('0x6a')]=_0x20e4ba['id'];if(_0x5a76f6['query'][_0x45fc('0x56')]){_0x198bc7[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x198bc7['where'],{'$or':_[_0x45fc('0x47')](_0x198bc7[_0x45fc('0x4f')],function(_0xa49a97){var _0x1e9866={};_0x1e9866[_0xa49a97]={'$like':'%'+_0x5a76f6[_0x45fc('0x4d')]['filter']+'%'};return _0x1e9866;})});}_0x198bc7=_[_0x45fc('0x57')]({},_0x198bc7,_0x5a76f6['options']);return db['CannedAnswer'][_0x45fc('0x23')]({'where':_0x198bc7['where']})[_0x45fc('0x11')](function(_0x42ec19){_0x1fed9d[_0x45fc('0x23')]=_0x42ec19;if(_0x5a76f6[_0x45fc('0x4d')][_0x45fc('0x5a')]){_0x198bc7[_0x45fc('0x62')]=[{'all':!![]}];}return db[_0x45fc('0x73')][_0x45fc('0x5b')](_0x198bc7);})['then'](function(_0x607b5d){_0x1fed9d[_0x45fc('0x71')]=_0x607b5d;return _0x1fed9d;});}})['then'](respondWithFilteredResult(_0x39e463,_0x198bc7))[_0x45fc('0x1c')](handleError(_0x39e463,null));};exports[_0x45fc('0x76')]=function(_0x5be35b,_0x3a82ce){return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x5be35b[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x3a82ce,null))[_0x45fc('0x11')](function(_0x434f60){if(_0x434f60){return _0x434f60[_0x45fc('0x76')](_0x5be35b[_0x45fc('0x4d')][_0x45fc('0x77')]);}})[_0x45fc('0x11')](respondWithStatusCode(_0x3a82ce,null))[_0x45fc('0x1c')](handleError(_0x3a82ce,null));};exports[_0x45fc('0x6c')]=function(_0x23b0e6,_0x7e3095){var _0x2311fa={'name':_0x23b0e6['body'][_0x45fc('0x2a')],'key':_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x4b')],'provider':_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x66')]===_0x45fc('0x65')?null:_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x66')],'email':_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x78')],'ListId':_0x23b0e6['body']['ListId'],'active':!_[_0x45fc('0x79')](_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x7a')])?_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x7a')]:!![],'description':_0x23b0e6[_0x45fc('0x64')][_0x45fc('0x7b')]||null};var _0x55568a=getAuthenticationOptions(_0x2311fa[_0x45fc('0x66')],_0x23b0e6['body']);_0x2311fa['Imap']=_0x55568a[_0x45fc('0x43')];_0x2311fa[_0x45fc('0x44')]=_0x55568a[_0x45fc('0x44')];return db[_0x45fc('0x48')][_0x45fc('0x6c')](_0x2311fa,{'include':[{'model':db[_0x45fc('0x5e')],'as':_0x45fc('0x44')},{'model':db[_0x45fc('0x5d')],'as':'Imap'}]})[_0x45fc('0x11')](function(_0x56bb36){var _0x22d8fc=_0x23b0e6[_0x45fc('0x38')][_0x45fc('0x7c')]({'plain':!![]});if(!_0x22d8fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d8fc['role']===_0x45fc('0x38')){var _0x596530=_0x56bb36[_0x45fc('0x7c')]({'plain':!![]});return db[_0x45fc('0x7d')][_0x45fc('0x63')]({'where':{'name':_0x45fc('0x28'),'userProfileId':_0x22d8fc[_0x45fc('0x7e')]},'raw':!![]})[_0x45fc('0x11')](function(_0x283cd3){if(_0x283cd3&&_0x283cd3[_0x45fc('0x7f')]===0x0){return db['UserProfileResource']['create']({'name':_0x596530['name'],'resourceId':_0x596530['id'],'type':_0x283cd3[_0x45fc('0x2a')],'sectionId':_0x283cd3['id']},{})[_0x45fc('0x11')](function(){return _0x56bb36;});}else{return _0x56bb36;}})[_0x45fc('0x1c')](function(_0x42ded9){logger[_0x45fc('0x17')](_0x45fc('0x80'),_0x42ded9);throw _0x42ded9;});}return _0x56bb36;})['then'](respondWithResult(_0x7e3095,0xc9))['catch'](handleError(_0x7e3095,null));};exports[_0x45fc('0x81')]=function(_0x17b0fc,_0x539cfb){return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x17b0fc[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x539cfb,null))[_0x45fc('0x11')](function(_0x3156db){if(_0x3156db){return _0x3156db[_0x45fc('0x81')]();}return null;})[_0x45fc('0x11')](respondWithResult(_0x539cfb,null))[_0x45fc('0x1c')](handleError(_0x539cfb,null));};exports[_0x45fc('0x82')]=function(_0x3bcde7,_0x20102e){if(_0x3bcde7[_0x45fc('0x64')]['id']){delete _0x3bcde7[_0x45fc('0x64')]['id'];}return db[_0x45fc('0x48')]['find']({'where':{'id':_0x3bcde7[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x20102e,null))[_0x45fc('0x11')](function(_0x87e009){if(_0x87e009){_0x3bcde7[_0x45fc('0x64')]['MailAccountId']=_0x87e009['id'];return db[_0x45fc('0x5d')][_0x45fc('0x6c')](_0x3bcde7['body']);}})['then'](respondWithResult(_0x20102e,null))[_0x45fc('0x1c')](handleError(_0x20102e,null));};exports[_0x45fc('0x83')]=function(_0x21271d,_0x5462b1){return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x21271d[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x5462b1,null))['then'](function(_0x23197d){if(_0x23197d){return _0x23197d['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x5462b1,null))['catch'](handleError(_0x5462b1,null));};exports[_0x45fc('0x84')]=function(_0x3f9962,_0x4293c0){return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x3f9962['params']['id']}})['then'](handleEntityNotFound(_0x4293c0,null))['then'](function(_0x375463){if(_0x375463){return _0x375463['getSmtp']();}return null;})[_0x45fc('0x11')](respondWithResult(_0x4293c0,null))['catch'](handleError(_0x4293c0,null));};exports[_0x45fc('0x85')]=function(_0x554286,_0x18d458){if(_0x554286[_0x45fc('0x64')]['id']){delete _0x554286[_0x45fc('0x64')]['id'];}return db['MailAccount'][_0x45fc('0x63')]({'where':{'id':_0x554286[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x18d458,null))[_0x45fc('0x11')](function(_0x25b838){if(_0x25b838){_0x554286[_0x45fc('0x64')]['MailAccountId']=_0x25b838['id'];return db[_0x45fc('0x5e')][_0x45fc('0x6c')](_0x554286[_0x45fc('0x64')]);}})['then'](respondWithResult(_0x18d458,null))[_0x45fc('0x1c')](handleError(_0x18d458,null));};exports['removeSmtp']=function(_0x41882b,_0xb31b37){return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x41882b['params']['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0xb31b37,null))[_0x45fc('0x11')](function(_0x3f7e45){if(_0x3f7e45){return _0x3f7e45[_0x45fc('0x86')](null);}return null;})[_0x45fc('0x11')](respondWithStatusCode(_0xb31b37,null))[_0x45fc('0x1c')](handleError(_0xb31b37,null));};exports['addInteraction']=function(_0x4ddb69,_0x54841a){return db[_0x45fc('0x87')][_0x45fc('0x63')]({'where':{'id':_0x4ddb69[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x54841a,null))[_0x45fc('0x11')](function(_0x302a5e){if(_0x302a5e){return _0x302a5e[_0x45fc('0x88')](_0x4ddb69[_0x45fc('0x64')][_0x45fc('0x77')],_[_0x45fc('0x89')](_0x4ddb69['body'],[_0x45fc('0x77'),'id'])||{});}})['then'](respondWithResult(_0x54841a,null))[_0x45fc('0x1c')](handleError(_0x54841a,null));};exports[_0x45fc('0x8a')]=function(_0x1abf81,_0x239249){var _0x418552={'raw':![],'where':{}};var _0x3c4330={};var _0x2cc206={'count':0x0,'rows':[]};return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x1abf81[_0x45fc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x239249,null))[_0x45fc('0x11')](function(_0x25d44b){if(_0x25d44b){_0x3c4330[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db[_0x45fc('0x87')][_0x45fc('0x6f')]);_0x3c4330['query']=_[_0x45fc('0x4e')](_0x1abf81['query']);_0x3c4330[_0x45fc('0x54')]=_[_0x45fc('0x60')](_0x3c4330[_0x45fc('0x4c')],_0x3c4330['query']);_0x418552[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x3c4330[_0x45fc('0x4c')],qs[_0x45fc('0x50')](_0x1abf81['query'][_0x45fc('0x50')]));_0x418552[_0x45fc('0x4f')]=_0x418552[_0x45fc('0x4f')][_0x45fc('0x61')]?_0x418552[_0x45fc('0x4f')]:_0x3c4330['model'];if(!_0x1abf81[_0x45fc('0x4d')]['hasOwnProperty'](_0x45fc('0x75'))){_0x418552[_0x45fc('0x24')]=qs['limit'](_0x1abf81[_0x45fc('0x4d')][_0x45fc('0x24')]);_0x418552[_0x45fc('0x21')]=qs['offset'](_0x1abf81[_0x45fc('0x4d')][_0x45fc('0x21')]);}_0x418552[_0x45fc('0x51')]=qs[_0x45fc('0x52')](_0x1abf81[_0x45fc('0x4d')][_0x45fc('0x52')]);_0x418552[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_[_0x45fc('0x55')](_0x1abf81[_0x45fc('0x4d')],_0x3c4330[_0x45fc('0x54')]));_0x418552[_0x45fc('0x53')][_0x45fc('0x6a')]=_0x25d44b['id'];if(_0x1abf81['query'][_0x45fc('0x56')]){_0x418552[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x418552[_0x45fc('0x53')],{'$or':_[_0x45fc('0x47')](_0x418552[_0x45fc('0x4f')],function(_0x19bfa6){var _0x11d612={};_0x11d612[_0x19bfa6]={'$like':'%'+_0x1abf81[_0x45fc('0x4d')][_0x45fc('0x56')]+'%'};return _0x11d612;})});}_0x418552=_['merge']({},_0x418552,_0x1abf81[_0x45fc('0x59')]);return db[_0x45fc('0x87')]['count']({'where':_0x418552[_0x45fc('0x53')]})['then'](function(_0x525f0e){_0x2cc206[_0x45fc('0x23')]=_0x525f0e;if(_0x1abf81[_0x45fc('0x4d')]['includeAll']){_0x418552[_0x45fc('0x62')]=[{'model':db[_0x45fc('0x8b')],'as':_0x45fc('0x8c'),'required':![]},{'model':db['User'],'as':_0x45fc('0x8d'),'attributes':[_0x45fc('0x2a'),_0x45fc('0x8e'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x45fc('0x8f'),'attributes':['id','name',_0x45fc('0x90')],'where':_0x1abf81['query'][_0x45fc('0x91')]?{'id':_0x1abf81['query'][_0x45fc('0x91')]}:undefined,'required':_0x1abf81[_0x45fc('0x4d')][_0x45fc('0x91')]?!![]:![]}];}return db['MailInteraction'][_0x45fc('0x5b')](_0x418552);})[_0x45fc('0x11')](function(_0x58cc2e){_0x2cc206[_0x45fc('0x71')]=_0x58cc2e;return _0x2cc206;});}})[_0x45fc('0x11')](respondWithFilteredResult(_0x239249,_0x418552))['catch'](handleError(_0x239249,null));};exports['addApplications']=function addApplications(_0x1a029e,_0x1e4e2e){var _0x449fef=_0x1a029e[_0x45fc('0x5c')]['id'];var _0x1d06f3=_0x1a029e[_0x45fc('0x64')];var _0x35521d=0xc8;var _0x37cb55=null;return db[_0x45fc('0x92')]['transaction']({'isolationLevel':db[_0x45fc('0x92')][_0x45fc('0x93')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1cc9b1){return db[_0x45fc('0x48')]['findOne']({'where':{'id':_0x449fef},'transaction':_0x1cc9b1})[_0x45fc('0x11')](function(_0x478b58){if(_0x478b58){return db['MailApplication'][_0x45fc('0x27')]({'where':{'MailAccountId':_0x449fef},'transaction':_0x1cc9b1})[_0x45fc('0x11')](function(){var _0x49bf9f=_[_0x45fc('0x47')](_0x1d06f3,function(_0x32cb14){_0x32cb14[_0x45fc('0x6a')]=_0x449fef;return _0x32cb14;});return db['MailApplication'][_0x45fc('0x94')](_0x49bf9f,{'transaction':_0x1cc9b1});});}else{_0x35521d=0x194;_0x37cb55=[];}});})['then'](function(){if(_0x35521d!==0x194){return db['MailApplication'][_0x45fc('0x95')]({'where':{'MailAccountId':_0x449fef},'order':_0x45fc('0x96')})[_0x45fc('0x11')](function(_0x2745d1){_0x37cb55=_0x2745d1;});}})[_0x45fc('0x1c')](function(_0xc0c194){_0x35521d=0x1f4;logger[_0x45fc('0x17')](_0xc0c194[_0x45fc('0x29')]);if(_0xc0c194[_0x45fc('0x2a')]){delete _0xc0c194[_0x45fc('0x2a')];}_0x37cb55=_0xc0c194;})[_0x45fc('0x97')](function(){if(_0x37cb55===null){_0x1e4e2e['sendStatus'](_0x35521d);}else{if(_0x35521d===0x1f4){_0x1e4e2e[_0x45fc('0x1e')](_0x35521d)[_0x45fc('0x2b')](_0x37cb55);}else{_0x1e4e2e['status'](_0x35521d)[_0x45fc('0x20')](_0x37cb55);}}});};exports['getApplications']=function(_0x7f1293,_0x314ff5){var _0x36b402={};var _0x49fcd8={};var _0x4bbb92;var _0x5286f9;return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x7f1293['params']['id']}})['then'](handleEntityNotFound(_0x314ff5,null))[_0x45fc('0x11')](function(_0x41edbd){if(_0x41edbd){_0x4bbb92=_0x41edbd;_0x49fcd8[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db[_0x45fc('0x98')][_0x45fc('0x6f')]);_0x49fcd8[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x7f1293['query']);_0x49fcd8['filters']=_[_0x45fc('0x60')](_0x49fcd8[_0x45fc('0x4c')],_0x49fcd8[_0x45fc('0x4d')]);_0x36b402[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x49fcd8[_0x45fc('0x4c')],qs[_0x45fc('0x50')](_0x7f1293['query']['fields']));_0x36b402['attributes']=_0x36b402[_0x45fc('0x4f')]['length']?_0x36b402[_0x45fc('0x4f')]:_0x49fcd8[_0x45fc('0x4c')];_0x36b402['order']=qs['sort'](_0x7f1293['query'][_0x45fc('0x52')]);_0x36b402[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_[_0x45fc('0x55')](_0x7f1293[_0x45fc('0x4d')],_0x49fcd8['filters']));if(_0x7f1293[_0x45fc('0x4d')][_0x45fc('0x56')]){_0x36b402[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x36b402[_0x45fc('0x53')],{'$or':_[_0x45fc('0x47')](_0x36b402[_0x45fc('0x4f')],function(_0x2ff74f){var _0x562dc3={};_0x562dc3[_0x2ff74f]={'$like':'%'+_0x7f1293[_0x45fc('0x4d')][_0x45fc('0x56')]+'%'};return _0x562dc3;})});}_0x36b402=_[_0x45fc('0x57')]({},_0x36b402,_0x7f1293[_0x45fc('0x59')]);return _0x4bbb92[_0x45fc('0x99')](_0x36b402);}})[_0x45fc('0x11')](function(_0x298c73){if(_0x298c73){_0x5286f9=_0x298c73[_0x45fc('0x61')];if(!_0x7f1293[_0x45fc('0x4d')][_0x45fc('0x70')]('nolimit')){_0x36b402['limit']=qs['limit'](_0x7f1293[_0x45fc('0x4d')][_0x45fc('0x24')]);_0x36b402[_0x45fc('0x21')]=qs[_0x45fc('0x21')](_0x7f1293[_0x45fc('0x4d')][_0x45fc('0x21')]);}return _0x4bbb92['getApplications'](_0x36b402);}})[_0x45fc('0x11')](function(_0x357f1c){if(_0x357f1c){return _0x357f1c?{'count':_0x5286f9,'rows':_0x357f1c}:null;}})['then'](respondWithResult(_0x314ff5,null))[_0x45fc('0x1c')](handleError(_0x314ff5,null));};exports[_0x45fc('0x9a')]=function(_0x484fa5,_0x4c8b96){var _0x4a9eed={'raw':!![],'where':{}};var _0x222b44={};var _0x22d803={'count':0x0,'rows':[]};return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x484fa5[_0x45fc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4c8b96,null))[_0x45fc('0x11')](function(_0x16ad63){if(_0x16ad63){_0x222b44[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db['MailMessage']['rawAttributes']);_0x222b44[_0x45fc('0x4d')]=_[_0x45fc('0x4e')](_0x484fa5['query']);_0x222b44['filters']=_['intersection'](_0x222b44['model'],_0x222b44[_0x45fc('0x4d')]);_0x4a9eed[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x222b44[_0x45fc('0x4c')],qs['fields'](_0x484fa5[_0x45fc('0x4d')][_0x45fc('0x50')]));_0x4a9eed['attributes']=_0x4a9eed[_0x45fc('0x4f')][_0x45fc('0x61')]?_0x4a9eed[_0x45fc('0x4f')]:_0x222b44[_0x45fc('0x4c')];if(!_0x484fa5['query'][_0x45fc('0x70')]('nolimit')){_0x4a9eed[_0x45fc('0x24')]=qs['limit'](_0x484fa5[_0x45fc('0x4d')]['limit']);_0x4a9eed['offset']=qs['offset'](_0x484fa5[_0x45fc('0x4d')][_0x45fc('0x21')]);}_0x4a9eed[_0x45fc('0x51')]=qs[_0x45fc('0x52')](_0x484fa5['query'][_0x45fc('0x52')]);_0x4a9eed['where']=qs[_0x45fc('0x54')](_['pick'](_0x484fa5[_0x45fc('0x4d')],_0x222b44[_0x45fc('0x54')]));_0x4a9eed[_0x45fc('0x53')]['MailAccountId']=_0x16ad63['id'];if(_0x484fa5[_0x45fc('0x4d')][_0x45fc('0x56')]){_0x4a9eed[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x4a9eed[_0x45fc('0x53')],{'$or':_[_0x45fc('0x47')](_0x4a9eed[_0x45fc('0x4f')],function(_0x4c214c){var _0x30b8ba={};_0x30b8ba[_0x4c214c]={'$like':'%'+_0x484fa5['query']['filter']+'%'};return _0x30b8ba;})});}if(_0x484fa5[_0x45fc('0x4d')][_0x45fc('0x9b')]){var _0x2b9ff4=_0x484fa5['query'][_0x45fc('0x9b')][_0x45fc('0x9c')](',');var _0x93385b={};_0x93385b[_0x2b9ff4[0x0]]={'$gte':moment(_0x2b9ff4[0x1])[_0x45fc('0x9d')](_0x45fc('0x9e'))};_0x4a9eed[_0x45fc('0x53')]=_[_0x45fc('0x57')](_0x4a9eed[_0x45fc('0x53')],_0x93385b);}_0x4a9eed=_[_0x45fc('0x57')]({},_0x4a9eed,_0x484fa5['options']);return db[_0x45fc('0x9f')][_0x45fc('0x23')]({'where':_0x4a9eed[_0x45fc('0x53')]})['then'](function(_0x4f17bf){_0x22d803['count']=_0x4f17bf;if(_0x484fa5[_0x45fc('0x4d')][_0x45fc('0x5a')]){_0x4a9eed[_0x45fc('0x62')]=[{'all':!![]}];}return db[_0x45fc('0x9f')][_0x45fc('0x5b')](_0x4a9eed);})['then'](function(_0x4620a8){if(_0x484fa5[_0x45fc('0x4d')][_0x45fc('0xa0')]==='true'){for(var _0x4a5b61=0x0;_0x4a5b61<_0x4620a8['length'];_0x4a5b61++){_0x4620a8[_0x4a5b61][_0x45fc('0x64')]=juice(_0x4620a8[_0x4a5b61]['body']);}}_0x22d803['rows']=_0x4620a8;return _0x22d803;});}})['then'](respondWithFilteredResult(_0x4c8b96,_0x4a9eed))[_0x45fc('0x1c')](handleError(_0x4c8b96,null));};exports[_0x45fc('0x2b')]=function(_0x5c26e7,_0x476807){var _0x3fae7a,_0xa4df12={},_0x45cff8;if(_0x5c26e7[_0x45fc('0x64')]['to']){_0x45cff8=_0x5c26e7[_0x45fc('0x64')]['to'][_0x45fc('0x9c')](',')[0x0];}return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x5c26e7[_0x45fc('0x5c')]['id']},'include':[{'model':db[_0x45fc('0xa1')],'as':_0x45fc('0xa2'),'include':[{'model':db['CmContact'],'as':_0x45fc('0xa3'),'where':{'email':_0x45cff8},'limit':0x1,'order':[[_0x45fc('0xa4'),_0x45fc('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0x45fc('0x44'),'raw':!![],'include':[{'model':db[_0x45fc('0xa6')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x476807,null))[_0x45fc('0x11')](function(_0x2f45c2){if(!_0x2f45c2)return;_0x3fae7a=_0x2f45c2;if(!_0x2f45c2[_0x45fc('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x45fc('0x79')](_0x5c26e7['body'][_0x45fc('0xa7')])){_0x5c26e7['body']['from']=util['format']('%s\x20<%s>',_0x2f45c2[_0x45fc('0x2a')],_0x2f45c2[_0x45fc('0x78')]||_0x2f45c2[_0x45fc('0x44')][_0x45fc('0x38')]);}if(_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xa8')]&&_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xa8')][_0x45fc('0x61')]){for(var _0x5b9bc5=0x0;_0x5b9bc5<_0x5c26e7['body'][_0x45fc('0xa8')][_0x45fc('0x61')];_0x5b9bc5+=0x1){_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xa8')][_0x5b9bc5]={'filename':_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xa8')][_0x5b9bc5][_0x45fc('0x2a')],'path':path[_0x45fc('0xa9')](config[_0x45fc('0xaa')],_0x45fc('0xab'),_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xa8')][_0x5b9bc5][_0x45fc('0xac')])};}}var _0x37777a=_0x2f45c2['getSmtpOptions']();return respondWithRpcPromise(_0x45fc('0xad'),'sendMail',{'account':_0x37777a,'message':_0x5c26e7[_0x45fc('0x64')]});})[_0x45fc('0x11')](function(_0x47d881){if(!_0x47d881)return;_0xa4df12=_0x47d881;if(!_0x3fae7a[_0x45fc('0xa2')])throw new Error(_0x45fc('0xae'));if(_0x3fae7a[_0x45fc('0xa2')][_0x45fc('0xa3')][_0x45fc('0x61')])return _0x3fae7a[_0x45fc('0xa2')][_0x45fc('0xa3')][0x0];return db[_0x45fc('0x8b')][_0x45fc('0x6c')](_['defaults'](_0x5c26e7[_0x45fc('0x64')],{'firstName':_0x5c26e7[_0x45fc('0x64')]['to'],'email':_0x5c26e7[_0x45fc('0x64')]['to'],'phone':_0x5c26e7[_0x45fc('0x64')]['to'],'ListId':_0x3fae7a[_0x45fc('0xaf')]}));})[_0x45fc('0x11')](function(_0x305ef4){if(!_0x305ef4)return;var _0x3d3e53={'UserId':_0x5c26e7[_0x45fc('0x38')]['id'],'ContactId':_0x305ef4['id'],'MailAccountId':_0x3fae7a['id'],'inReplyTo':_0xa4df12[_0x45fc('0xb0')],'to':_0x5c26e7['body'][_0x45fc('0xa7')],'cc':_0x5c26e7['body']['cc'],'subject':_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xb1')],'attach':_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xb2')],'firstMsgDirection':_0x45fc('0xb3'),'lastMsgAt':moment()[_0x45fc('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x45fc('0xb3'),'Messages':[_[_0x45fc('0x57')](_0x5c26e7[_0x45fc('0x64')],{'messageId':_0xa4df12['messageId'],'sentAt':moment()[_0x45fc('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3fae7a['id'],'UserId':_0x5c26e7[_0x45fc('0x38')]['id'],'ContactId':_0x305ef4['id']})]};if(_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xb4')]){_0x3d3e53=_[_0x45fc('0x57')](_0x3d3e53,_0x5c26e7[_0x45fc('0x64')][_0x45fc('0xb4')]);}return db[_0x45fc('0x87')][_0x45fc('0x6c')](_0x3d3e53,{'include':[{'model':db[_0x45fc('0x9f')],'as':_0x45fc('0xb5')}]});})[_0x45fc('0x11')](respondWithResult(_0x476807,null))[_0x45fc('0x1c')](handleError(_0x476807,null));};exports[_0x45fc('0xb6')]=function(_0x32143b,_0x1834d1){return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x32143b[_0x45fc('0x5c')]['id']},'include':[{'model':db[_0x45fc('0x5e')],'as':_0x45fc('0x44'),'raw':!![],'include':[{'model':db[_0x45fc('0xa6')],'as':_0x45fc('0xa6'),'raw':!![]}]}]})[_0x45fc('0x11')](handleEntityNotFound(_0x1834d1,null))[_0x45fc('0x11')](function(_0x41f8a7){if(!_0x41f8a7['Smtp'])return;var _0x228267=_0x41f8a7['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x228267});})[_0x45fc('0x11')](respondWithResult(_0x1834d1,null))['catch'](handleError(_0x1834d1,null));};exports[_0x45fc('0x27')]=function(_0x30b9cd,_0x441909){return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x30b9cd['params']['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x441909,null))[_0x45fc('0x11')](function(_0x1b9a95){if(_0x1b9a95&&_0x1b9a95[_0x45fc('0x40')]){throw new db[(_0x45fc('0xb7'))]['ValidationError'](_0x45fc('0xb8'));}return _0x1b9a95;})[_0x45fc('0x11')](removeEntity(_0x441909,null))[_0x45fc('0x1c')](handleError(_0x441909,null));};exports[_0x45fc('0xb9')]=function(_0x50303f,_0x1bc762){return db[_0x45fc('0x48')][_0x45fc('0x63')]({'where':{'id':_0x50303f[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x1bc762,null))[_0x45fc('0x11')](function(_0x2bf766){if(_0x2bf766){return _0x2bf766[_0x45fc('0xb9')](_0x50303f[_0x45fc('0x64')][_0x45fc('0x77')],_[_0x45fc('0x89')](_0x50303f[_0x45fc('0x64')],['ids','id'])||{})[_0x45fc('0xba')](function(_0x179aad){for(var _0x3fd737=0x0;_0x3fd737<_0x50303f[_0x45fc('0x64')][_0x45fc('0x77')][_0x45fc('0x61')];_0x3fd737+=0x1){socket[_0x45fc('0xbb')]('userMailAccount:save',{'UserId':Number(_0x50303f[_0x45fc('0x64')][_0x45fc('0x77')][_0x3fd737]),'MailAccountId':Number(_0x50303f[_0x45fc('0x5c')]['id'])});}return _0x179aad;});}})[_0x45fc('0x11')](respondWithResult(_0x1bc762,null))[_0x45fc('0x1c')](handleError(_0x1bc762,null));};exports[_0x45fc('0xbc')]=function(_0x1265f3,_0x2f9ea9){return db['MailAccount']['find']({'where':{'id':_0x1265f3[_0x45fc('0x5c')]['id']}})[_0x45fc('0x11')](handleEntityNotFound(_0x2f9ea9,null))[_0x45fc('0x11')](function(_0xcc0d00){if(_0xcc0d00){return _0xcc0d00[_0x45fc('0xbc')](_0x1265f3[_0x45fc('0x4d')][_0x45fc('0x77')])[_0x45fc('0x11')](function(){if(_[_0x45fc('0xbd')](_0x1265f3[_0x45fc('0x4d')][_0x45fc('0x77')])){for(var _0x299fae=0x0;_0x299fae<_0x1265f3[_0x45fc('0x4d')]['ids'][_0x45fc('0x61')];_0x299fae+=0x1){socket[_0x45fc('0xbb')](_0x45fc('0xbe'),{'UserId':Number(_0x1265f3['query'][_0x45fc('0x77')][_0x299fae]),'MailAccountId':Number(_0x1265f3[_0x45fc('0x5c')]['id'])});}}else{socket[_0x45fc('0xbb')](_0x45fc('0xbe'),{'UserId':Number(_0x1265f3[_0x45fc('0x4d')][_0x45fc('0x77')]),'MailAccountId':Number(_0x1265f3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2f9ea9,null))[_0x45fc('0x1c')](handleError(_0x2f9ea9,null));};exports[_0x45fc('0xbf')]=function(_0x48b721,_0x3ae446){var _0x378ee6={};var _0x521e42={};var _0x558b6d;var _0x1edc3d;return db[_0x45fc('0x48')][_0x45fc('0x6e')]({'where':{'id':_0x48b721[_0x45fc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3ae446,null))['then'](function(_0x1521bf){if(_0x1521bf){_0x558b6d=_0x1521bf;_0x521e42[_0x45fc('0x4c')]=_[_0x45fc('0x4e')](db['User'][_0x45fc('0x6f')]);_0x521e42['query']=_[_0x45fc('0x4e')](_0x48b721[_0x45fc('0x4d')]);_0x521e42[_0x45fc('0x54')]=_[_0x45fc('0x60')](_0x521e42[_0x45fc('0x4c')],_0x521e42[_0x45fc('0x4d')]);_0x378ee6[_0x45fc('0x4f')]=_[_0x45fc('0x60')](_0x521e42[_0x45fc('0x4c')],qs[_0x45fc('0x50')](_0x48b721[_0x45fc('0x4d')]['fields']));_0x378ee6[_0x45fc('0x4f')]=_0x378ee6[_0x45fc('0x4f')][_0x45fc('0x61')]?_0x378ee6[_0x45fc('0x4f')]:_0x521e42[_0x45fc('0x4c')];_0x378ee6[_0x45fc('0x51')]=qs[_0x45fc('0x52')](_0x48b721[_0x45fc('0x4d')][_0x45fc('0x52')]);_0x378ee6[_0x45fc('0x53')]=qs[_0x45fc('0x54')](_[_0x45fc('0x55')](_0x48b721[_0x45fc('0x4d')],_0x521e42[_0x45fc('0x54')]));if(_0x48b721[_0x45fc('0x4d')][_0x45fc('0x56')]){_0x378ee6[_0x45fc('0x53')]=_['merge'](_0x378ee6['where'],{'$or':_[_0x45fc('0x47')](_0x378ee6['attributes'],function(_0x33eb0f){var _0x478655={};_0x478655[_0x33eb0f]={'$like':'%'+_0x48b721[_0x45fc('0x4d')][_0x45fc('0x56')]+'%'};return _0x478655;})});}_0x378ee6=_[_0x45fc('0x57')]({},_0x378ee6,_0x48b721[_0x45fc('0x59')]);return _0x558b6d[_0x45fc('0xbf')](_0x378ee6);}})[_0x45fc('0x11')](function(_0x446a50){if(_0x446a50){_0x1edc3d=_0x446a50['length'];if(!_0x48b721[_0x45fc('0x4d')][_0x45fc('0x70')](_0x45fc('0x75'))){_0x378ee6['limit']=qs['limit'](_0x48b721[_0x45fc('0x4d')]['limit']);_0x378ee6[_0x45fc('0x21')]=qs['offset'](_0x48b721['query'][_0x45fc('0x21')]);}return _0x558b6d[_0x45fc('0xbf')](_0x378ee6);}})[_0x45fc('0x11')](function(_0x208f82){if(_0x208f82){return _0x208f82?{'count':_0x1edc3d,'rows':_0x208f82}:null;}})[_0x45fc('0x11')](respondWithResult(_0x3ae446,null))[_0x45fc('0x1c')](handleError(_0x3ae446,null));}; \ No newline at end of file +var _0x91df=['outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','provider','custom','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','update','then','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider'];(function(_0x34cd1e,_0x40342a){var _0xecc102=function(_0x5bc302){while(--_0x5bc302){_0x34cd1e['push'](_0x34cd1e['shift']());}};_0xecc102(++_0x40342a);}(_0x91df,0x155));var _0xf91d=function(_0x24af4c,_0x1fc187){_0x24af4c=_0x24af4c-0x0;var _0x2033e3=_0x91df[_0x24af4c];return _0x2033e3;};'use strict';var moment=require(_0xf91d('0x0'));var BPromise=require('bluebird');var util=require(_0xf91d('0x1'));var path=require('path');var _=require(_0xf91d('0x2'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xf91d('0x3'));var logger=require(_0xf91d('0x4'))(_0xf91d('0x5'));var config=require(_0xf91d('0x6'));var db=require(_0xf91d('0x7'))['db'];config[_0xf91d('0x8')]=_['defaults'](config['redis'],{'host':_0xf91d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf91d('0x8')]));require(_0xf91d('0xa'))[_0xf91d('0xb')](socket);var jayson=require(_0xf91d('0xc'));var client=jayson['client'][_0xf91d('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x598863,_0x1d396c,_0x5bca89,_0x29b6e0){return new BPromise(function(_0x3cabe0,_0x44a443){var _0x49b613=_0x29b6e0||client;return _0x49b613[_0xf91d('0xe')](_0x598863,_0x5bca89)['then'](function(_0x1eb60a){logger[_0xf91d('0xf')](_0xf91d('0x10'),_0x1d396c,'request\x20sent');logger[_0xf91d('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1d396c,_0xf91d('0x12'),JSON['stringify'](_0x1eb60a));if(_0x1eb60a[_0xf91d('0x13')]){if(_0x1eb60a[_0xf91d('0x13')][_0xf91d('0x14')]===0x1f4){logger[_0xf91d('0x13')](_0xf91d('0x10'),_0x1d396c,_0x1eb60a[_0xf91d('0x13')][_0xf91d('0x15')]);return _0x44a443(_0x1eb60a['error']['message']);}logger[_0xf91d('0x13')]('MailAccount,\x20%s,\x20%s',_0x1d396c,_0x1eb60a[_0xf91d('0x13')][_0xf91d('0x15')]);return _0x3cabe0(_0x1eb60a[_0xf91d('0x13')][_0xf91d('0x15')]);}else{logger[_0xf91d('0xf')](_0xf91d('0x10'),_0x1d396c,_0xf91d('0x12'));_0x3cabe0(_0x1eb60a[_0xf91d('0x16')][_0xf91d('0x15')]);}})[_0xf91d('0x17')](function(_0x36a5c0){logger[_0xf91d('0x13')](_0xf91d('0x10'),_0x1d396c,_0x36a5c0);_0x44a443(_0x36a5c0);});});}function respondWithStatusCode(_0x26d863,_0x1e171c){_0x1e171c=_0x1e171c||0xcc;return function(_0x523234){if(_0x523234){return _0x26d863[_0xf91d('0x18')](_0x1e171c);}return _0x26d863[_0xf91d('0x19')](_0x1e171c)[_0xf91d('0x1a')]();};}function respondWithResult(_0x15c577,_0xfa020a){_0xfa020a=_0xfa020a||0xc8;return function(_0x287ed0){if(_0x287ed0){return _0x15c577['status'](_0xfa020a)['json'](_0x287ed0);}};}function respondWithFilteredResult(_0x50ea42,_0x1c08b0){return function(_0x9444bd){if(_0x9444bd){var _0x264792=typeof _0x1c08b0['offset']==='undefined'&&typeof _0x1c08b0[_0xf91d('0x1b')]===_0xf91d('0x1c');var _0x15990c=_0x9444bd[_0xf91d('0x1d')];var _0x517109=_0x264792?0x0:_0x1c08b0['offset'];var _0x490016=_0x264792?_0x9444bd[_0xf91d('0x1d')]:_0x1c08b0[_0xf91d('0x1e')]+_0x1c08b0['limit'];var _0x138b58;if(_0x490016>=_0x15990c){_0x490016=_0x15990c;_0x138b58=0xc8;}else{_0x138b58=0xce;}_0x50ea42['status'](_0x138b58);return _0x50ea42[_0xf91d('0x1f')](_0xf91d('0x20'),_0x517109+'-'+_0x490016+'/'+_0x15990c)[_0xf91d('0x21')](_0x9444bd);}return null;};}function saveUpdates(_0x1a7c6a){return function(_0x1396c5){if(_0x1396c5){return _0x1396c5[_0xf91d('0x22')](_0x1a7c6a)[_0xf91d('0x23')](function(_0x5448a6){return _0x5448a6;});}return null;};}function removeEntity(_0x4a929e){return function(_0x4031be){if(_0x4031be){return _0x4031be['destroy']()[_0xf91d('0x23')](function(){var _0x3a5661=_0x4031be[_0xf91d('0x24')]({'plain':!![]});var _0x515b80=_0xf91d('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x515b80,'resourceId':_0x3a5661['id']}})[_0xf91d('0x23')](function(){return _0x4031be;});})['then'](function(){_0x4a929e[_0xf91d('0x19')](0xcc)[_0xf91d('0x1a')]();});}};}function handleEntityNotFound(_0x2084f6){return function(_0x58dd49){if(!_0x58dd49){_0x2084f6[_0xf91d('0x18')](0x194);}return _0x58dd49;};}function handleError(_0x2199b6,_0x33255c){_0x33255c=_0x33255c||0x1f4;return function(_0x2c3342){logger[_0xf91d('0x13')](_0x2c3342[_0xf91d('0x26')]);if(_0x2c3342['name']){delete _0x2c3342[_0xf91d('0x27')];}_0x2199b6[_0xf91d('0x19')](_0x33255c)[_0xf91d('0x28')](_0x2c3342);};}function getImapHost(_0x4e79ac){switch(_0x4e79ac){case _0xf91d('0x29'):return _0xf91d('0x2a');case _0xf91d('0x2b'):return _0xf91d('0x2c');case _0xf91d('0x2d'):return _0xf91d('0x2e');case'outlook365':return _0xf91d('0x2f');}throw new Error(_0xf91d('0x30'),_0x4e79ac);}function getSmtpHost(_0x5077ba){switch(_0x5077ba){case _0xf91d('0x29'):return'smtp.gmail.com';case _0xf91d('0x2b'):return'smtp.mail.yahoo.com';case'hotmail':return'smtp-mail.outlook.com';case _0xf91d('0x31'):return _0xf91d('0x32');}throw new Error(_0xf91d('0x30'),_0x5077ba);}function getAuthenticationOptions(_0x27a431,_0x31512e){var _0xd99e1e={};var _0x3b7afe={};if(_0x27a431){_0xd99e1e[_0xf91d('0x33')]=_0x3b7afe[_0xf91d('0x33')]=_0x31512e[_0xf91d('0x34')];_0xd99e1e[_0xf91d('0x35')]=_0x3b7afe[_0xf91d('0x36')]=_0x31512e[_0xf91d('0x35')];if(_0x31512e[_0xf91d('0x37')]){_0xd99e1e[_0xf91d('0x37')]=_0x3b7afe[_0xf91d('0x37')]=!![];_0xd99e1e['CloudProviderId']=_0x3b7afe[_0xf91d('0x38')]=_0x31512e[_0xf91d('0x38')];_0xd99e1e[_0xf91d('0x35')]=_0x3b7afe[_0xf91d('0x36')]=null;}else{_0xd99e1e[_0xf91d('0x38')]=_0x3b7afe[_0xf91d('0x38')]=null;}_0xd99e1e['host']=getImapHost(_0x27a431);_0xd99e1e[_0xf91d('0x39')]=0x3e1;_0x3b7afe[_0xf91d('0x3a')]=getSmtpHost(_0x27a431);_0x3b7afe[_0xf91d('0x39')]=0x24b;_0x3b7afe[_0xf91d('0x3b')]=![];_0xd99e1e[_0xf91d('0x3c')]=_0x3b7afe[_0xf91d('0x3c')]=null;}else{if(_0x31512e[_0xf91d('0x3d')]){_0xd99e1e[_0xf91d('0x33')]=_0x3b7afe['user']=_0x31512e[_0xf91d('0x34')];_0xd99e1e[_0xf91d('0x35')]=_0x3b7afe['pass']=_0x31512e[_0xf91d('0x35')];}else{_0xd99e1e[_0xf91d('0x3d')]=_0x3b7afe[_0xf91d('0x3d')]=![];_0xd99e1e[_0xf91d('0x33')]=_0x3b7afe[_0xf91d('0x33')]=null;_0xd99e1e[_0xf91d('0x35')]=_0x3b7afe[_0xf91d('0x36')]=null;}_0xd99e1e[_0xf91d('0x3a')]=_0x31512e[_0xf91d('0x3e')]['host'];_0xd99e1e[_0xf91d('0x39')]=_0x31512e[_0xf91d('0x3e')][_0xf91d('0x39')];_0x3b7afe[_0xf91d('0x3a')]=_0x31512e['Smtp']['host'];_0x3b7afe[_0xf91d('0x39')]=_0x31512e[_0xf91d('0x3f')]['port'];}return{'Imap':_0xd99e1e,'Smtp':_0x3b7afe};}exports[_0xf91d('0x40')]=function(_0x15aa60,_0x482720){var _0x2689c3={'include':[{'model':db[_0xf91d('0x41')],'as':_0xf91d('0x3e')},{'model':db[_0xf91d('0x42')],'as':'Smtp'},{'model':db[_0xf91d('0x43')],'as':'mandatoryDispositionPause'}]},_0x3c10ac={},_0x3b14c9={'count':0x0,'rows':[]};var _0x2fe3e2=_[_0xf91d('0x44')](db[_0xf91d('0x45')][_0xf91d('0x46')],function(_0x57da99){return{'name':_0x57da99[_0xf91d('0x47')],'type':_0x57da99[_0xf91d('0x48')][_0xf91d('0x49')]};});_0x3c10ac[_0xf91d('0x4a')]=_['map'](_0x2fe3e2,_0xf91d('0x27'));_0x3c10ac[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x15aa60[_0xf91d('0x4b')]);_0x3c10ac[_0xf91d('0x4d')]=_[_0xf91d('0x4e')](_0x3c10ac[_0xf91d('0x4a')],_0x3c10ac[_0xf91d('0x4b')]);_0x2689c3['attributes']=_[_0xf91d('0x4e')](_0x3c10ac[_0xf91d('0x4a')],qs['fields'](_0x15aa60['query'][_0xf91d('0x4f')]));_0x2689c3[_0xf91d('0x50')]=_0x2689c3[_0xf91d('0x50')][_0xf91d('0x51')]?_0x2689c3[_0xf91d('0x50')]:_0x3c10ac['model'];if(!_0x15aa60[_0xf91d('0x4b')]['hasOwnProperty'](_0xf91d('0x52'))){_0x2689c3[_0xf91d('0x1b')]=qs[_0xf91d('0x1b')](_0x15aa60['query'][_0xf91d('0x1b')]);_0x2689c3[_0xf91d('0x1e')]=qs[_0xf91d('0x1e')](_0x15aa60[_0xf91d('0x4b')]['offset']);}_0x2689c3[_0xf91d('0x53')]=qs[_0xf91d('0x54')](_0x15aa60[_0xf91d('0x4b')]['sort']);_0x2689c3['where']=qs['filters'](_[_0xf91d('0x55')](_0x15aa60['query'],_0x3c10ac[_0xf91d('0x4d')]),_0x2fe3e2);if(_0x15aa60[_0xf91d('0x4b')][_0xf91d('0x56')]){_0x2689c3[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0x2689c3[_0xf91d('0x57')],{'$or':_[_0xf91d('0x44')](_0x2fe3e2,function(_0x5d2bce){if(_0x5d2bce[_0xf91d('0x48')]!==_0xf91d('0x59')){var _0x38e224={};_0x38e224[_0x5d2bce['name']]={'$like':'%'+_0x15aa60[_0xf91d('0x4b')][_0xf91d('0x56')]+'%'};return _0x38e224;}})});}_0x2689c3=_['merge']({},_0x2689c3,_0x15aa60[_0xf91d('0x5a')]);var _0x3d6245={'where':_0x2689c3[_0xf91d('0x57')]};return db[_0xf91d('0x45')][_0xf91d('0x1d')](_0x3d6245)[_0xf91d('0x23')](function(_0x5e6a1f){_0x3b14c9[_0xf91d('0x1d')]=_0x5e6a1f;if(_0x15aa60[_0xf91d('0x4b')][_0xf91d('0x5b')]){_0x2689c3[_0xf91d('0x5c')]=[{'all':!![]}];}return db[_0xf91d('0x45')][_0xf91d('0x5d')](_0x2689c3);})[_0xf91d('0x23')](function(_0x3e5b87){_0x3b14c9[_0xf91d('0x5e')]=_0x3e5b87;return _0x3b14c9;})[_0xf91d('0x23')](respondWithFilteredResult(_0x482720,_0x2689c3))[_0xf91d('0x17')](handleError(_0x482720,null));};exports[_0xf91d('0x5f')]=function(_0xd7bbd9,_0x426354){var _0x5d1354={'raw':![],'where':{'id':_0xd7bbd9[_0xf91d('0x60')]['id']},'include':[{'model':db[_0xf91d('0x41')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xf91d('0x43')],'as':'mandatoryDispositionPause'}]},_0x466f00={};_0x466f00[_0xf91d('0x4a')]=_[_0xf91d('0x4c')](db['MailAccount']['rawAttributes']);_0x466f00['query']=_[_0xf91d('0x4c')](_0xd7bbd9[_0xf91d('0x4b')]);_0x466f00[_0xf91d('0x4d')]=_[_0xf91d('0x4e')](_0x466f00[_0xf91d('0x4a')],_0x466f00['query']);_0x5d1354[_0xf91d('0x50')]=_[_0xf91d('0x4e')](_0x466f00[_0xf91d('0x4a')],qs['fields'](_0xd7bbd9[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0x5d1354[_0xf91d('0x50')]=_0x5d1354[_0xf91d('0x50')][_0xf91d('0x51')]?_0x5d1354[_0xf91d('0x50')]:_0x466f00[_0xf91d('0x4a')];if(_0xd7bbd9[_0xf91d('0x4b')][_0xf91d('0x5b')]){_0x5d1354['include']=[{'all':!![]}];}_0x5d1354=_[_0xf91d('0x58')]({},_0x5d1354,_0xd7bbd9[_0xf91d('0x5a')]);return db['MailAccount'][_0xf91d('0x61')](_0x5d1354)[_0xf91d('0x23')](handleEntityNotFound(_0x426354,null))[_0xf91d('0x23')](respondWithResult(_0x426354,null))[_0xf91d('0x17')](handleError(_0x426354,null));};exports[_0xf91d('0x22')]=function(_0x33e635,_0x1ad254){if(_0x33e635[_0xf91d('0x62')]['id']){delete _0x33e635[_0xf91d('0x62')]['id'];}var _0xf9d05c=_0x33e635[_0xf91d('0x62')][_0xf91d('0x63')]===_0xf91d('0x64')?null:_0x33e635[_0xf91d('0x62')]['provider'];var _0x229900=_0x33e635['body'][_0xf91d('0x3e')]||{};var _0x396596=_0x33e635['body'][_0xf91d('0x3f')]||{};if(_0xf9d05c){_0x229900[_0xf91d('0x3a')]=getImapHost(_0xf9d05c);_0x229900[_0xf91d('0x39')]=0x3e1;_0x396596[_0xf91d('0x3a')]=getSmtpHost(_0xf9d05c);_0x396596[_0xf91d('0x39')]=0x24b;_0x396596[_0xf91d('0x3b')]=![];}if(_0x396596[_0xf91d('0x37')]){_0x396596[_0xf91d('0x3b')]=![];}else{_0x396596['CloudProviderId']=null;}if(!_0x229900[_0xf91d('0x37')])_0x229900[_0xf91d('0x38')]=null;_0x33e635['body'][_0xf91d('0x3e')]=_0x229900;_0x33e635[_0xf91d('0x62')][_0xf91d('0x3f')]=_0x396596;return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x33e635['params']['id']},'include':[{'model':db[_0xf91d('0x41')],'as':_0xf91d('0x3e')},{'model':db[_0xf91d('0x42')],'as':_0xf91d('0x3f')},{'model':db[_0xf91d('0x43')],'as':_0xf91d('0x65')}]})[_0xf91d('0x23')](handleEntityNotFound(_0x1ad254,null))[_0xf91d('0x23')](function(_0x778e1){if(!_0x778e1)throw new Error(_0xf91d('0x66'));if(_0x778e1['service'])delete _0x33e635[_0xf91d('0x62')][_0xf91d('0x3e')];return _0x778e1;})[_0xf91d('0x23')](saveUpdates(_0x33e635[_0xf91d('0x62')],null))['then'](function(_0x1ce8e5){if(!_0x33e635['body']['Imap'])return _0x1ce8e5;return db[_0xf91d('0x41')][_0xf91d('0x22')](_0x33e635[_0xf91d('0x62')][_0xf91d('0x3e')],{'where':{'MailAccountId':_0x1ce8e5['id']}})[_0xf91d('0x23')](function(){return _0x1ce8e5;});})['then'](function(_0x24d568){if(!_0x33e635['body'][_0xf91d('0x3f')])return _0x24d568;return db[_0xf91d('0x42')][_0xf91d('0x22')](_0x33e635[_0xf91d('0x62')][_0xf91d('0x3f')],{'where':{'MailAccountId':_0x24d568['id']}})['then'](function(){return _0x24d568;});})[_0xf91d('0x23')](respondWithResult(_0x1ad254,null))['catch'](handleError(_0x1ad254,null));};exports['describe']=function(_0x19f16c,_0x5d1710){return db[_0xf91d('0x45')][_0xf91d('0x67')]()['then'](respondWithResult(_0x5d1710,null))[_0xf91d('0x17')](handleError(_0x5d1710,null));};exports['addDisposition']=function(_0x16df6a,_0x1d8c2f){if(_0x16df6a[_0xf91d('0x62')]['id']){delete _0x16df6a[_0xf91d('0x62')]['id'];}return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x16df6a[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x1d8c2f,null))['then'](function(_0x421ab0){if(_0x421ab0){_0x16df6a[_0xf91d('0x62')][_0xf91d('0x68')]=_0x421ab0['id'];return db[_0xf91d('0x69')][_0xf91d('0x6a')](_0x16df6a[_0xf91d('0x62')]);}})['then'](respondWithResult(_0x1d8c2f,null))[_0xf91d('0x17')](handleError(_0x1d8c2f,null));};exports[_0xf91d('0x6b')]=function(_0xb53bfd,_0x51bd15){var _0x35f06e={'raw':![],'where':{}};var _0x473fd8={};var _0x25e7d8={'count':0x0,'rows':[]};return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0xb53bfd[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x51bd15,null))[_0xf91d('0x23')](function(_0x10333f){if(_0x10333f){_0x473fd8['model']=_['keys'](db[_0xf91d('0x69')][_0xf91d('0x46')]);_0x473fd8['query']=_[_0xf91d('0x4c')](_0xb53bfd[_0xf91d('0x4b')]);_0x473fd8['filters']=_['intersection'](_0x473fd8[_0xf91d('0x4a')],_0x473fd8[_0xf91d('0x4b')]);_0x35f06e[_0xf91d('0x50')]=_[_0xf91d('0x4e')](_0x473fd8[_0xf91d('0x4a')],qs[_0xf91d('0x4f')](_0xb53bfd[_0xf91d('0x4b')]['fields']));_0x35f06e[_0xf91d('0x50')]=_0x35f06e[_0xf91d('0x50')]['length']?_0x35f06e[_0xf91d('0x50')]:_0x473fd8['model'];if(!_0xb53bfd[_0xf91d('0x4b')][_0xf91d('0x6d')](_0xf91d('0x52'))){_0x35f06e[_0xf91d('0x1b')]=qs[_0xf91d('0x1b')](_0xb53bfd['query']['limit']);_0x35f06e[_0xf91d('0x1e')]=qs[_0xf91d('0x1e')](_0xb53bfd[_0xf91d('0x4b')]['offset']);}_0x35f06e[_0xf91d('0x53')]=qs[_0xf91d('0x54')](_0xb53bfd[_0xf91d('0x4b')]['sort']);_0x35f06e['where']=qs[_0xf91d('0x4d')](_['pick'](_0xb53bfd[_0xf91d('0x4b')],_0x473fd8['filters']));_0x35f06e[_0xf91d('0x57')][_0xf91d('0x68')]=_0x10333f['id'];if(_0xb53bfd[_0xf91d('0x4b')][_0xf91d('0x56')]){_0x35f06e[_0xf91d('0x57')]=_['merge'](_0x35f06e[_0xf91d('0x57')],{'$or':_[_0xf91d('0x44')](_0x35f06e[_0xf91d('0x50')],function(_0x3d1a37){var _0x37adfe={};_0x37adfe[_0x3d1a37]={'$like':'%'+_0xb53bfd[_0xf91d('0x4b')][_0xf91d('0x56')]+'%'};return _0x37adfe;})});}_0x35f06e=_[_0xf91d('0x58')]({},_0x35f06e,_0xb53bfd[_0xf91d('0x5a')]);return db[_0xf91d('0x69')][_0xf91d('0x1d')]({'where':_0x35f06e[_0xf91d('0x57')]})['then'](function(_0x30654a){_0x25e7d8[_0xf91d('0x1d')]=_0x30654a;if(_0xb53bfd[_0xf91d('0x4b')][_0xf91d('0x5b')]){_0x35f06e[_0xf91d('0x5c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x35f06e);})[_0xf91d('0x23')](function(_0x5749d2){_0x25e7d8[_0xf91d('0x5e')]=_0x5749d2;return _0x25e7d8;});}})[_0xf91d('0x23')](respondWithFilteredResult(_0x51bd15,_0x35f06e))[_0xf91d('0x17')](handleError(_0x51bd15,null));};exports[_0xf91d('0x6e')]=function(_0x48c399,_0x19f418){return db['MailAccount'][_0xf91d('0x61')]({'where':{'id':_0x48c399[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x19f418,null))['then'](function(_0xab59a){if(_0xab59a){return _0xab59a[_0xf91d('0x6e')](_0x48c399['query'][_0xf91d('0x6f')]);}})['then'](respondWithStatusCode(_0x19f418,null))[_0xf91d('0x17')](handleError(_0x19f418,null));};exports[_0xf91d('0x70')]=function(_0x19c9d1,_0x1c08cf){if(_0x19c9d1[_0xf91d('0x62')]['id']){delete _0x19c9d1[_0xf91d('0x62')]['id'];}return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x19c9d1['params']['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x1c08cf,null))[_0xf91d('0x23')](function(_0x62314b){if(_0x62314b){_0x19c9d1[_0xf91d('0x62')]['MailAccountId']=_0x62314b['id'];return db[_0xf91d('0x71')]['create'](_0x19c9d1[_0xf91d('0x62')]);}})[_0xf91d('0x23')](respondWithResult(_0x1c08cf,null))['catch'](handleError(_0x1c08cf,null));};exports[_0xf91d('0x72')]=function(_0x501d22,_0x26441e){var _0x13a432={'raw':![],'where':{}};var _0x5f45d7={};var _0x297c40={'count':0x0,'rows':[]};return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0x501d22[_0xf91d('0x60')]['id']}})['then'](handleEntityNotFound(_0x26441e,null))['then'](function(_0xce5e20){if(_0xce5e20){_0x5f45d7[_0xf91d('0x4a')]=_['keys'](db['CannedAnswer'][_0xf91d('0x46')]);_0x5f45d7[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x501d22[_0xf91d('0x4b')]);_0x5f45d7[_0xf91d('0x4d')]=_[_0xf91d('0x4e')](_0x5f45d7[_0xf91d('0x4a')],_0x5f45d7[_0xf91d('0x4b')]);_0x13a432['attributes']=_[_0xf91d('0x4e')](_0x5f45d7[_0xf91d('0x4a')],qs[_0xf91d('0x4f')](_0x501d22[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0x13a432['attributes']=_0x13a432[_0xf91d('0x50')]['length']?_0x13a432['attributes']:_0x5f45d7[_0xf91d('0x4a')];if(!_0x501d22[_0xf91d('0x4b')][_0xf91d('0x6d')](_0xf91d('0x52'))){_0x13a432[_0xf91d('0x1b')]=qs[_0xf91d('0x1b')](_0x501d22[_0xf91d('0x4b')][_0xf91d('0x1b')]);_0x13a432[_0xf91d('0x1e')]=qs['offset'](_0x501d22[_0xf91d('0x4b')][_0xf91d('0x1e')]);}_0x13a432['order']=qs['sort'](_0x501d22[_0xf91d('0x4b')][_0xf91d('0x54')]);_0x13a432[_0xf91d('0x57')]=qs[_0xf91d('0x4d')](_[_0xf91d('0x55')](_0x501d22[_0xf91d('0x4b')],_0x5f45d7['filters']));_0x13a432[_0xf91d('0x57')][_0xf91d('0x68')]=_0xce5e20['id'];if(_0x501d22['query'][_0xf91d('0x56')]){_0x13a432[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0x13a432[_0xf91d('0x57')],{'$or':_['map'](_0x13a432['attributes'],function(_0x202a2f){var _0x118e06={};_0x118e06[_0x202a2f]={'$like':'%'+_0x501d22['query'][_0xf91d('0x56')]+'%'};return _0x118e06;})});}_0x13a432=_[_0xf91d('0x58')]({},_0x13a432,_0x501d22[_0xf91d('0x5a')]);return db[_0xf91d('0x71')][_0xf91d('0x1d')]({'where':_0x13a432[_0xf91d('0x57')]})[_0xf91d('0x23')](function(_0x5bdd55){_0x297c40[_0xf91d('0x1d')]=_0x5bdd55;if(_0x501d22['query'][_0xf91d('0x5b')]){_0x13a432[_0xf91d('0x5c')]=[{'all':!![]}];}return db[_0xf91d('0x71')][_0xf91d('0x5d')](_0x13a432);})[_0xf91d('0x23')](function(_0x34ade1){_0x297c40[_0xf91d('0x5e')]=_0x34ade1;return _0x297c40;});}})[_0xf91d('0x23')](respondWithFilteredResult(_0x26441e,_0x13a432))[_0xf91d('0x17')](handleError(_0x26441e,null));};exports[_0xf91d('0x73')]=function(_0x543a08,_0x3798ae){return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x543a08[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x3798ae,null))[_0xf91d('0x23')](function(_0x345ad7){if(_0x345ad7){return _0x345ad7['removeAnswers'](_0x543a08[_0xf91d('0x4b')][_0xf91d('0x6f')]);}})[_0xf91d('0x23')](respondWithStatusCode(_0x3798ae,null))[_0xf91d('0x17')](handleError(_0x3798ae,null));};exports['create']=function(_0xeaf7e3,_0x5af58a){var _0x3de3da={'name':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x27')],'key':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x49')],'provider':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x63')]===_0xf91d('0x64')?null:_0xeaf7e3['body'][_0xf91d('0x63')],'email':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x74')],'ListId':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x75')],'active':!_[_0xf91d('0x76')](_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x77')])?_0xeaf7e3[_0xf91d('0x62')]['active']:!![],'description':_0xeaf7e3[_0xf91d('0x62')][_0xf91d('0x78')]||null};var _0xfb3bda=getAuthenticationOptions(_0x3de3da['provider'],_0xeaf7e3[_0xf91d('0x62')]);_0x3de3da[_0xf91d('0x3e')]=_0xfb3bda[_0xf91d('0x3e')];_0x3de3da['Smtp']=_0xfb3bda[_0xf91d('0x3f')];return db[_0xf91d('0x45')][_0xf91d('0x6a')](_0x3de3da,{'include':[{'model':db[_0xf91d('0x42')],'as':_0xf91d('0x3f')},{'model':db[_0xf91d('0x41')],'as':_0xf91d('0x3e')}]})[_0xf91d('0x23')](function(_0x2461a2){var _0x213506=_0xeaf7e3[_0xf91d('0x33')]['get']({'plain':!![]});if(!_0x213506)throw new Error(_0xf91d('0x79'));if(_0x213506['role']===_0xf91d('0x33')){var _0x199a9b=_0x2461a2[_0xf91d('0x24')]({'plain':!![]});return db[_0xf91d('0x7a')]['find']({'where':{'name':_0xf91d('0x25'),'userProfileId':_0x213506[_0xf91d('0x7b')]},'raw':!![]})[_0xf91d('0x23')](function(_0x3c58d3){if(_0x3c58d3&&_0x3c58d3[_0xf91d('0x7c')]===0x0){return db[_0xf91d('0x7d')][_0xf91d('0x6a')]({'name':_0x199a9b[_0xf91d('0x27')],'resourceId':_0x199a9b['id'],'type':_0x3c58d3['name'],'sectionId':_0x3c58d3['id']},{})['then'](function(){return _0x2461a2;});}else{return _0x2461a2;}})['catch'](function(_0x167ef1){logger[_0xf91d('0x13')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x167ef1);throw _0x167ef1;});}return _0x2461a2;})[_0xf91d('0x23')](respondWithResult(_0x5af58a,0xc9))[_0xf91d('0x17')](handleError(_0x5af58a,null));};exports[_0xf91d('0x7e')]=function(_0x5387ea,_0x35642e){return db['MailAccount'][_0xf91d('0x6c')]({'where':{'id':_0x5387ea[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x35642e,null))[_0xf91d('0x23')](function(_0x159c94){if(_0x159c94){return _0x159c94[_0xf91d('0x7e')]();}return null;})[_0xf91d('0x23')](respondWithResult(_0x35642e,null))[_0xf91d('0x17')](handleError(_0x35642e,null));};exports[_0xf91d('0x7f')]=function(_0x4acd13,_0x2c65da){if(_0x4acd13[_0xf91d('0x62')]['id']){delete _0x4acd13[_0xf91d('0x62')]['id'];}return db[_0xf91d('0x45')]['find']({'where':{'id':_0x4acd13[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x2c65da,null))[_0xf91d('0x23')](function(_0x36bce9){if(_0x36bce9){_0x4acd13[_0xf91d('0x62')][_0xf91d('0x68')]=_0x36bce9['id'];return db[_0xf91d('0x41')][_0xf91d('0x6a')](_0x4acd13[_0xf91d('0x62')]);}})[_0xf91d('0x23')](respondWithResult(_0x2c65da,null))[_0xf91d('0x17')](handleError(_0x2c65da,null));};exports['removeImap']=function(_0x5b0ac2,_0x450b6a){return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0x5b0ac2['params']['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x450b6a,null))[_0xf91d('0x23')](function(_0x3d48cf){if(_0x3d48cf){return _0x3d48cf['setImap'](null);}return null;})[_0xf91d('0x23')](respondWithStatusCode(_0x450b6a,null))[_0xf91d('0x17')](handleError(_0x450b6a,null));};exports[_0xf91d('0x80')]=function(_0x4468b3,_0x20d627){return db['MailAccount'][_0xf91d('0x6c')]({'where':{'id':_0x4468b3['params']['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x20d627,null))[_0xf91d('0x23')](function(_0x37d113){if(_0x37d113){return _0x37d113[_0xf91d('0x80')]();}return null;})[_0xf91d('0x23')](respondWithResult(_0x20d627,null))[_0xf91d('0x17')](handleError(_0x20d627,null));};exports[_0xf91d('0x81')]=function(_0x31a77b,_0x57655b){if(_0x31a77b[_0xf91d('0x62')]['id']){delete _0x31a77b[_0xf91d('0x62')]['id'];}return db[_0xf91d('0x45')]['find']({'where':{'id':_0x31a77b[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x57655b,null))[_0xf91d('0x23')](function(_0x1b4946){if(_0x1b4946){_0x31a77b['body']['MailAccountId']=_0x1b4946['id'];return db[_0xf91d('0x42')]['create'](_0x31a77b[_0xf91d('0x62')]);}})[_0xf91d('0x23')](respondWithResult(_0x57655b,null))[_0xf91d('0x17')](handleError(_0x57655b,null));};exports[_0xf91d('0x82')]=function(_0xca63ca,_0x3279bd){return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0xca63ca[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x3279bd,null))[_0xf91d('0x23')](function(_0x517975){if(_0x517975){return _0x517975[_0xf91d('0x83')](null);}return null;})[_0xf91d('0x23')](respondWithStatusCode(_0x3279bd,null))[_0xf91d('0x17')](handleError(_0x3279bd,null));};exports[_0xf91d('0x84')]=function(_0x3cb21a,_0x39776b){return db[_0xf91d('0x85')][_0xf91d('0x61')]({'where':{'id':_0x3cb21a[_0xf91d('0x60')]['id']}})['then'](handleEntityNotFound(_0x39776b,null))[_0xf91d('0x23')](function(_0x587065){if(_0x587065){return _0x587065[_0xf91d('0x84')](_0x3cb21a['body'][_0xf91d('0x6f')],_[_0xf91d('0x86')](_0x3cb21a[_0xf91d('0x62')],[_0xf91d('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x39776b,null))[_0xf91d('0x17')](handleError(_0x39776b,null));};exports[_0xf91d('0x87')]=function(_0x249356,_0x332fb9){var _0x51b009={'raw':![],'where':{}};var _0x522015={};var _0x5a0ba1={'count':0x0,'rows':[]};return db[_0xf91d('0x45')]['findOne']({'where':{'id':_0x249356[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x332fb9,null))[_0xf91d('0x23')](function(_0x1bc825){if(_0x1bc825){_0x522015[_0xf91d('0x4a')]=_[_0xf91d('0x4c')](db[_0xf91d('0x85')][_0xf91d('0x46')]);_0x522015[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x249356[_0xf91d('0x4b')]);_0x522015['filters']=_[_0xf91d('0x4e')](_0x522015[_0xf91d('0x4a')],_0x522015[_0xf91d('0x4b')]);_0x51b009[_0xf91d('0x50')]=_[_0xf91d('0x4e')](_0x522015[_0xf91d('0x4a')],qs[_0xf91d('0x4f')](_0x249356[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0x51b009[_0xf91d('0x50')]=_0x51b009[_0xf91d('0x50')][_0xf91d('0x51')]?_0x51b009[_0xf91d('0x50')]:_0x522015[_0xf91d('0x4a')];if(!_0x249356[_0xf91d('0x4b')][_0xf91d('0x6d')](_0xf91d('0x52'))){_0x51b009[_0xf91d('0x1b')]=qs[_0xf91d('0x1b')](_0x249356['query']['limit']);_0x51b009['offset']=qs['offset'](_0x249356[_0xf91d('0x4b')]['offset']);}_0x51b009['order']=qs['sort'](_0x249356[_0xf91d('0x4b')][_0xf91d('0x54')]);_0x51b009[_0xf91d('0x57')]=qs[_0xf91d('0x4d')](_['pick'](_0x249356[_0xf91d('0x4b')],_0x522015[_0xf91d('0x4d')]));_0x51b009[_0xf91d('0x57')][_0xf91d('0x68')]=_0x1bc825['id'];if(_0x249356[_0xf91d('0x4b')]['filter']){_0x51b009[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0x51b009[_0xf91d('0x57')],{'$or':_[_0xf91d('0x44')](_0x51b009[_0xf91d('0x50')],function(_0x5f2e9c){var _0x478074={};_0x478074[_0x5f2e9c]={'$like':'%'+_0x249356[_0xf91d('0x4b')][_0xf91d('0x56')]+'%'};return _0x478074;})});}_0x51b009=_[_0xf91d('0x58')]({},_0x51b009,_0x249356[_0xf91d('0x5a')]);return db['MailInteraction'][_0xf91d('0x1d')]({'where':_0x51b009[_0xf91d('0x57')]})[_0xf91d('0x23')](function(_0x471432){_0x5a0ba1[_0xf91d('0x1d')]=_0x471432;if(_0x249356[_0xf91d('0x4b')][_0xf91d('0x5b')]){_0x51b009[_0xf91d('0x5c')]=[{'model':db[_0xf91d('0x88')],'as':_0xf91d('0x89'),'required':![]},{'model':db[_0xf91d('0x8a')],'as':_0xf91d('0x8b'),'attributes':[_0xf91d('0x27'),_0xf91d('0x8c'),_0xf91d('0x8d')],'required':![]},{'model':db[_0xf91d('0x8e')],'as':_0xf91d('0x8f'),'attributes':['id',_0xf91d('0x27'),'color'],'where':_0x249356[_0xf91d('0x4b')][_0xf91d('0x90')]?{'id':_0x249356[_0xf91d('0x4b')][_0xf91d('0x90')]}:undefined,'required':_0x249356[_0xf91d('0x4b')][_0xf91d('0x90')]?!![]:![]}];}return db[_0xf91d('0x85')][_0xf91d('0x5d')](_0x51b009);})['then'](function(_0x589ada){_0x5a0ba1[_0xf91d('0x5e')]=_0x589ada;return _0x5a0ba1;});}})[_0xf91d('0x23')](respondWithFilteredResult(_0x332fb9,_0x51b009))[_0xf91d('0x17')](handleError(_0x332fb9,null));};exports[_0xf91d('0x91')]=function addApplications(_0x4191de,_0x9eeb9c){var _0x420538=_0x4191de[_0xf91d('0x60')]['id'];var _0xac32e1=_0x4191de[_0xf91d('0x62')];var _0x45f328=0xc8;var _0x1db294=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xf91d('0x92')][_0xf91d('0x93')][_0xf91d('0x94')][_0xf91d('0x95')]},function(_0x3cb198){return db[_0xf91d('0x45')]['findOne']({'where':{'id':_0x420538},'transaction':_0x3cb198})[_0xf91d('0x23')](function(_0x3e639c){if(_0x3e639c){return db[_0xf91d('0x96')][_0xf91d('0x97')]({'where':{'MailAccountId':_0x420538},'transaction':_0x3cb198})[_0xf91d('0x23')](function(){var _0x52c0ac=_[_0xf91d('0x44')](_0xac32e1,function(_0x20f09b){_0x20f09b[_0xf91d('0x68')]=_0x420538;return _0x20f09b;});return db['MailApplication'][_0xf91d('0x98')](_0x52c0ac,{'transaction':_0x3cb198});});}else{_0x45f328=0x194;_0x1db294=[];}});})[_0xf91d('0x23')](function(){if(_0x45f328!==0x194){return db[_0xf91d('0x96')][_0xf91d('0x99')]({'where':{'MailAccountId':_0x420538},'order':_0xf91d('0x9a')})['then'](function(_0x160240){_0x1db294=_0x160240;});}})[_0xf91d('0x17')](function(_0x52c2d1){_0x45f328=0x1f4;logger['error'](_0x52c2d1[_0xf91d('0x26')]);if(_0x52c2d1['name']){delete _0x52c2d1[_0xf91d('0x27')];}_0x1db294=_0x52c2d1;})['finally'](function(){if(_0x1db294===null){_0x9eeb9c['sendStatus'](_0x45f328);}else{if(_0x45f328===0x1f4){_0x9eeb9c[_0xf91d('0x19')](_0x45f328)['send'](_0x1db294);}else{_0x9eeb9c[_0xf91d('0x19')](_0x45f328)[_0xf91d('0x21')](_0x1db294);}}});};exports['getApplications']=function(_0x226fda,_0x484969){var _0x1cb553={};var _0x402390={};var _0x155d5c;var _0x8aba;return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0x226fda['params']['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x484969,null))['then'](function(_0x576e1e){if(_0x576e1e){_0x155d5c=_0x576e1e;_0x402390[_0xf91d('0x4a')]=_[_0xf91d('0x4c')](db['MailApplication']['rawAttributes']);_0x402390[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x226fda[_0xf91d('0x4b')]);_0x402390['filters']=_[_0xf91d('0x4e')](_0x402390[_0xf91d('0x4a')],_0x402390[_0xf91d('0x4b')]);_0x1cb553[_0xf91d('0x50')]=_[_0xf91d('0x4e')](_0x402390['model'],qs['fields'](_0x226fda[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0x1cb553[_0xf91d('0x50')]=_0x1cb553[_0xf91d('0x50')][_0xf91d('0x51')]?_0x1cb553[_0xf91d('0x50')]:_0x402390['model'];_0x1cb553[_0xf91d('0x53')]=qs[_0xf91d('0x54')](_0x226fda['query'][_0xf91d('0x54')]);_0x1cb553['where']=qs['filters'](_[_0xf91d('0x55')](_0x226fda[_0xf91d('0x4b')],_0x402390[_0xf91d('0x4d')]));if(_0x226fda[_0xf91d('0x4b')][_0xf91d('0x56')]){_0x1cb553[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0x1cb553[_0xf91d('0x57')],{'$or':_[_0xf91d('0x44')](_0x1cb553[_0xf91d('0x50')],function(_0x3717ff){var _0x59a7a2={};_0x59a7a2[_0x3717ff]={'$like':'%'+_0x226fda[_0xf91d('0x4b')][_0xf91d('0x56')]+'%'};return _0x59a7a2;})});}_0x1cb553=_['merge']({},_0x1cb553,_0x226fda[_0xf91d('0x5a')]);return _0x155d5c[_0xf91d('0x9b')](_0x1cb553);}})[_0xf91d('0x23')](function(_0x14d501){if(_0x14d501){_0x8aba=_0x14d501[_0xf91d('0x51')];if(!_0x226fda[_0xf91d('0x4b')][_0xf91d('0x6d')]('nolimit')){_0x1cb553[_0xf91d('0x1b')]=qs['limit'](_0x226fda[_0xf91d('0x4b')][_0xf91d('0x1b')]);_0x1cb553[_0xf91d('0x1e')]=qs[_0xf91d('0x1e')](_0x226fda[_0xf91d('0x4b')]['offset']);}return _0x155d5c['getApplications'](_0x1cb553);}})['then'](function(_0x56de0f){if(_0x56de0f){return _0x56de0f?{'count':_0x8aba,'rows':_0x56de0f}:null;}})[_0xf91d('0x23')](respondWithResult(_0x484969,null))[_0xf91d('0x17')](handleError(_0x484969,null));};exports[_0xf91d('0x9c')]=function(_0x5bc268,_0xd885d0){var _0x5c1ae1={'raw':!![],'where':{}};var _0x1324e8={};var _0x43407e={'count':0x0,'rows':[]};return db[_0xf91d('0x45')][_0xf91d('0x6c')]({'where':{'id':_0x5bc268[_0xf91d('0x60')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0xd885d0,null))[_0xf91d('0x23')](function(_0x2ab992){if(_0x2ab992){_0x1324e8[_0xf91d('0x4a')]=_[_0xf91d('0x4c')](db[_0xf91d('0x9d')][_0xf91d('0x46')]);_0x1324e8[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x5bc268[_0xf91d('0x4b')]);_0x1324e8['filters']=_[_0xf91d('0x4e')](_0x1324e8['model'],_0x1324e8[_0xf91d('0x4b')]);_0x5c1ae1['attributes']=_[_0xf91d('0x4e')](_0x1324e8[_0xf91d('0x4a')],qs[_0xf91d('0x4f')](_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0x5c1ae1[_0xf91d('0x50')]=_0x5c1ae1[_0xf91d('0x50')]['length']?_0x5c1ae1['attributes']:_0x1324e8[_0xf91d('0x4a')];if(!_0x5bc268['query'][_0xf91d('0x6d')](_0xf91d('0x52'))){_0x5c1ae1[_0xf91d('0x1b')]=qs[_0xf91d('0x1b')](_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x1b')]);_0x5c1ae1[_0xf91d('0x1e')]=qs[_0xf91d('0x1e')](_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x1e')]);}_0x5c1ae1[_0xf91d('0x53')]=qs['sort'](_0x5bc268['query']['sort']);_0x5c1ae1[_0xf91d('0x57')]=qs[_0xf91d('0x4d')](_[_0xf91d('0x55')](_0x5bc268[_0xf91d('0x4b')],_0x1324e8[_0xf91d('0x4d')]));_0x5c1ae1[_0xf91d('0x57')][_0xf91d('0x68')]=_0x2ab992['id'];if(_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x56')]){_0x5c1ae1['where']=_[_0xf91d('0x58')](_0x5c1ae1[_0xf91d('0x57')],{'$or':_[_0xf91d('0x44')](_0x5c1ae1[_0xf91d('0x50')],function(_0x244d62){var _0x56d40f={};_0x56d40f[_0x244d62]={'$like':'%'+_0x5bc268[_0xf91d('0x4b')]['filter']+'%'};return _0x56d40f;})});}if(_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x9e')]){var _0x3f2da6=_0x5bc268['query'][_0xf91d('0x9e')][_0xf91d('0x9f')](',');var _0x28aea4={};_0x28aea4[_0x3f2da6[0x0]]={'$gte':moment(_0x3f2da6[0x1])[_0xf91d('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5c1ae1[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0x5c1ae1[_0xf91d('0x57')],_0x28aea4);}_0x5c1ae1=_[_0xf91d('0x58')]({},_0x5c1ae1,_0x5bc268['options']);return db[_0xf91d('0x9d')]['count']({'where':_0x5c1ae1[_0xf91d('0x57')]})[_0xf91d('0x23')](function(_0x612feb){_0x43407e[_0xf91d('0x1d')]=_0x612feb;if(_0x5bc268[_0xf91d('0x4b')][_0xf91d('0x5b')]){_0x5c1ae1[_0xf91d('0x5c')]=[{'all':!![]}];}return db[_0xf91d('0x9d')][_0xf91d('0x5d')](_0x5c1ae1);})[_0xf91d('0x23')](function(_0x3351bf){if(_0x5bc268[_0xf91d('0x4b')]['inlineCss']==='true'){for(var _0x58446a=0x0;_0x58446a<_0x3351bf['length'];_0x58446a++){_0x3351bf[_0x58446a][_0xf91d('0x62')]=juice(_0x3351bf[_0x58446a][_0xf91d('0x62')]);}}_0x43407e[_0xf91d('0x5e')]=_0x3351bf;return _0x43407e;});}})[_0xf91d('0x23')](respondWithFilteredResult(_0xd885d0,_0x5c1ae1))[_0xf91d('0x17')](handleError(_0xd885d0,null));};exports[_0xf91d('0x28')]=function(_0x51c99e,_0x3354f7){var _0x3a80e2,_0x47ee3a={},_0x485978;if(_0x51c99e[_0xf91d('0x62')]['to']){_0x485978=_0x51c99e['body']['to']['split'](',')[0x0];}return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x51c99e['params']['id']},'include':[{'model':db[_0xf91d('0xa1')],'as':_0xf91d('0xa2'),'include':[{'model':db[_0xf91d('0x88')],'as':_0xf91d('0xa3'),'where':{'email':_0x485978},'limit':0x1,'order':[[_0xf91d('0xa4'),'DESC']]}]},{'model':db[_0xf91d('0x42')],'as':_0xf91d('0x3f'),'raw':!![],'include':[{'model':db[_0xf91d('0xa5')],'as':_0xf91d('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3354f7,null))[_0xf91d('0x23')](function(_0x3cba47){if(!_0x3cba47)return;_0x3a80e2=_0x3cba47;if(!_0x3cba47['Smtp'])throw new Error(_0xf91d('0xa6'));if(_[_0xf91d('0x76')](_0x51c99e[_0xf91d('0x62')][_0xf91d('0xa7')])){_0x51c99e['body']['from']=util['format'](_0xf91d('0xa8'),_0x3cba47[_0xf91d('0x27')],_0x3cba47[_0xf91d('0x74')]||_0x3cba47[_0xf91d('0x3f')][_0xf91d('0x33')]);}if(_0x51c99e['body'][_0xf91d('0xa9')]&&_0x51c99e[_0xf91d('0x62')]['attachments']['length']){for(var _0x55f13c=0x0;_0x55f13c<_0x51c99e[_0xf91d('0x62')][_0xf91d('0xa9')]['length'];_0x55f13c+=0x1){_0x51c99e[_0xf91d('0x62')][_0xf91d('0xa9')][_0x55f13c]={'filename':_0x51c99e[_0xf91d('0x62')][_0xf91d('0xa9')][_0x55f13c][_0xf91d('0x27')],'path':path[_0xf91d('0xaa')](config[_0xf91d('0xab')],_0xf91d('0xac'),_0x51c99e['body'][_0xf91d('0xa9')][_0x55f13c][_0xf91d('0xad')])};}}var _0x6ca695=_0x3cba47['getSmtpOptions']();return respondWithRpcPromise(_0xf91d('0xae'),'sendMail',{'account':_0x6ca695,'message':_0x51c99e[_0xf91d('0x62')]});})['then'](function(_0x127733){if(!_0x127733)return;_0x47ee3a=_0x127733;if(!_0x3a80e2[_0xf91d('0xa2')])throw new Error(_0xf91d('0xaf'));if(_0x3a80e2[_0xf91d('0xa2')][_0xf91d('0xa3')][_0xf91d('0x51')])return _0x3a80e2['List'][_0xf91d('0xa3')][0x0];return db[_0xf91d('0x88')][_0xf91d('0x6a')](_[_0xf91d('0xb0')](_0x51c99e[_0xf91d('0x62')],{'firstName':_0x51c99e[_0xf91d('0x62')]['to'],'email':_0x51c99e[_0xf91d('0x62')]['to'],'phone':_0x51c99e[_0xf91d('0x62')]['to'],'ListId':_0x3a80e2['ListId']}));})[_0xf91d('0x23')](function(_0x3225dc){if(!_0x3225dc)return;var _0x5c1675={'UserId':_0x51c99e[_0xf91d('0x33')]['id'],'ContactId':_0x3225dc['id'],'MailAccountId':_0x3a80e2['id'],'inReplyTo':_0x47ee3a[_0xf91d('0xb1')],'to':_0x51c99e['body']['from'],'cc':_0x51c99e[_0xf91d('0x62')]['cc'],'subject':_0x51c99e[_0xf91d('0x62')][_0xf91d('0xb2')],'attach':_0x51c99e[_0xf91d('0x62')][_0xf91d('0xb3')],'firstMsgDirection':_0xf91d('0xb4'),'lastMsgAt':moment()[_0xf91d('0xa0')](_0xf91d('0xb5')),'lastMsgDirection':_0xf91d('0xb4'),'Messages':[_['merge'](_0x51c99e[_0xf91d('0x62')],{'messageId':_0x47ee3a[_0xf91d('0xb1')],'sentAt':moment()[_0xf91d('0xa0')](_0xf91d('0xb5')),'read':!![],'MailAccountId':_0x3a80e2['id'],'UserId':_0x51c99e[_0xf91d('0x33')]['id'],'ContactId':_0x3225dc['id']})]};if(_0x51c99e[_0xf91d('0x62')]['Interaction']){_0x5c1675=_['merge'](_0x5c1675,_0x51c99e[_0xf91d('0x62')][_0xf91d('0xb6')]);}return db[_0xf91d('0x85')][_0xf91d('0x6a')](_0x5c1675,{'include':[{'model':db[_0xf91d('0x9d')],'as':_0xf91d('0xb7')}]});})[_0xf91d('0x23')](respondWithResult(_0x3354f7,null))[_0xf91d('0x17')](handleError(_0x3354f7,null));};exports[_0xf91d('0xb8')]=function(_0x340d89,_0x1bb4f5){return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x340d89[_0xf91d('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf91d('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xf91d('0x23')](handleEntityNotFound(_0x1bb4f5,null))[_0xf91d('0x23')](function(_0x51f2ef){if(!_0x51f2ef['Smtp'])return;var _0xc5608=_0x51f2ef['getSmtpOptions']();return respondWithRpcPromise(_0xf91d('0xb9'),_0xf91d('0xb8'),{'account':_0xc5608});})[_0xf91d('0x23')](respondWithResult(_0x1bb4f5,null))[_0xf91d('0x17')](handleError(_0x1bb4f5,null));};exports[_0xf91d('0x97')]=function(_0x54845b,_0x2895a7){return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x54845b['params']['id']}})['then'](handleEntityNotFound(_0x2895a7,null))[_0xf91d('0x23')](function(_0x132e3f){if(_0x132e3f&&_0x132e3f[_0xf91d('0x3c')]){throw new db[(_0xf91d('0xba'))]['ValidationError'](_0xf91d('0xbb'));}return _0x132e3f;})['then'](removeEntity(_0x2895a7,null))[_0xf91d('0x17')](handleError(_0x2895a7,null));};exports['addAgents']=function(_0x22038c,_0x56765d){return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0x22038c['params']['id']}})['then'](handleEntityNotFound(_0x56765d,null))[_0xf91d('0x23')](function(_0x551a1d){if(_0x551a1d){return _0x551a1d[_0xf91d('0xbc')](_0x22038c['body'][_0xf91d('0x6f')],_[_0xf91d('0x86')](_0x22038c[_0xf91d('0x62')],[_0xf91d('0x6f'),'id'])||{})[_0xf91d('0xbd')](function(_0x14cd9f){for(var _0x4c39c9=0x0;_0x4c39c9<_0x22038c[_0xf91d('0x62')][_0xf91d('0x6f')][_0xf91d('0x51')];_0x4c39c9+=0x1){socket[_0xf91d('0xbe')](_0xf91d('0xbf'),{'UserId':Number(_0x22038c[_0xf91d('0x62')]['ids'][_0x4c39c9]),'MailAccountId':Number(_0x22038c[_0xf91d('0x60')]['id'])});}return _0x14cd9f;});}})['then'](respondWithResult(_0x56765d,null))['catch'](handleError(_0x56765d,null));};exports[_0xf91d('0xc0')]=function(_0xf0a306,_0x121787){return db[_0xf91d('0x45')][_0xf91d('0x61')]({'where':{'id':_0xf0a306[_0xf91d('0x60')]['id']}})['then'](handleEntityNotFound(_0x121787,null))[_0xf91d('0x23')](function(_0x4028bc){if(_0x4028bc){return _0x4028bc[_0xf91d('0xc0')](_0xf0a306[_0xf91d('0x4b')]['ids'])['then'](function(){if(_['isArray'](_0xf0a306[_0xf91d('0x4b')][_0xf91d('0x6f')])){for(var _0x7b73e8=0x0;_0x7b73e8<_0xf0a306['query'][_0xf91d('0x6f')]['length'];_0x7b73e8+=0x1){socket[_0xf91d('0xbe')](_0xf91d('0xc1'),{'UserId':Number(_0xf0a306['query'][_0xf91d('0x6f')][_0x7b73e8]),'MailAccountId':Number(_0xf0a306[_0xf91d('0x60')]['id'])});}}else{socket[_0xf91d('0xbe')]('userMailAccount:remove',{'UserId':Number(_0xf0a306[_0xf91d('0x4b')][_0xf91d('0x6f')]),'MailAccountId':Number(_0xf0a306[_0xf91d('0x60')]['id'])});}});}})[_0xf91d('0x23')](respondWithStatusCode(_0x121787,null))['catch'](handleError(_0x121787,null));};exports[_0xf91d('0xc2')]=function(_0x5120bb,_0x1811fa){var _0xc78582={};var _0x31a959={};var _0xfd9085;var _0x55c116;return db['MailAccount'][_0xf91d('0x6c')]({'where':{'id':_0x5120bb['params']['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x1811fa,null))[_0xf91d('0x23')](function(_0x5f3262){if(_0x5f3262){_0xfd9085=_0x5f3262;_0x31a959[_0xf91d('0x4a')]=_[_0xf91d('0x4c')](db[_0xf91d('0x8a')][_0xf91d('0x46')]);_0x31a959[_0xf91d('0x4b')]=_[_0xf91d('0x4c')](_0x5120bb[_0xf91d('0x4b')]);_0x31a959[_0xf91d('0x4d')]=_[_0xf91d('0x4e')](_0x31a959['model'],_0x31a959[_0xf91d('0x4b')]);_0xc78582['attributes']=_[_0xf91d('0x4e')](_0x31a959[_0xf91d('0x4a')],qs[_0xf91d('0x4f')](_0x5120bb[_0xf91d('0x4b')][_0xf91d('0x4f')]));_0xc78582[_0xf91d('0x50')]=_0xc78582['attributes']['length']?_0xc78582[_0xf91d('0x50')]:_0x31a959[_0xf91d('0x4a')];_0xc78582[_0xf91d('0x53')]=qs[_0xf91d('0x54')](_0x5120bb[_0xf91d('0x4b')]['sort']);_0xc78582[_0xf91d('0x57')]=qs[_0xf91d('0x4d')](_[_0xf91d('0x55')](_0x5120bb[_0xf91d('0x4b')],_0x31a959[_0xf91d('0x4d')]));if(_0x5120bb['query']['filter']){_0xc78582[_0xf91d('0x57')]=_[_0xf91d('0x58')](_0xc78582['where'],{'$or':_['map'](_0xc78582[_0xf91d('0x50')],function(_0x5060c4){var _0x4b8240={};_0x4b8240[_0x5060c4]={'$like':'%'+_0x5120bb[_0xf91d('0x4b')][_0xf91d('0x56')]+'%'};return _0x4b8240;})});}_0xc78582=_['merge']({},_0xc78582,_0x5120bb['options']);return _0xfd9085[_0xf91d('0xc2')](_0xc78582);}})[_0xf91d('0x23')](function(_0x5eedaf){if(_0x5eedaf){_0x55c116=_0x5eedaf[_0xf91d('0x51')];if(!_0x5120bb[_0xf91d('0x4b')][_0xf91d('0x6d')](_0xf91d('0x52'))){_0xc78582['limit']=qs[_0xf91d('0x1b')](_0x5120bb[_0xf91d('0x4b')][_0xf91d('0x1b')]);_0xc78582[_0xf91d('0x1e')]=qs[_0xf91d('0x1e')](_0x5120bb['query'][_0xf91d('0x1e')]);}return _0xfd9085[_0xf91d('0xc2')](_0xc78582);}})[_0xf91d('0x23')](function(_0x29d891){if(_0x29d891){return _0x29d891?{'count':_0x55c116,'rows':_0x29d891}:null;}})[_0xf91d('0x23')](respondWithResult(_0x1811fa,null))[_0xf91d('0x17')](handleError(_0x1811fa,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 21d6fdf..bb11b51 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 _0x4d4e=['remove','emit','events','MailAccount','setMaxListeners','update'];(function(_0x546628,_0x2797d3){var _0x3ae92c=function(_0x473210){while(--_0x473210){_0x546628['push'](_0x546628['shift']());}};_0x3ae92c(++_0x2797d3);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x2aee5c,_0x14ddfd){_0x2aee5c=_0x2aee5c-0x0;var _0x5e2363=_0x4d4e[_0x2aee5c];return _0x5e2363;};'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 +var _0xebae=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x1d72e6,_0x4a777f){var _0x35fc9c=function(_0x45b031){while(--_0x45b031){_0x1d72e6['push'](_0x1d72e6['shift']());}};_0x35fc9c(++_0x4a777f);}(_0xebae,0x83));var _0xeeba=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xebae[_0x2bd88d];return _0x5516d4;};'use strict';var EventEmitter=require(_0xeeba('0x0'));var MailAccount=require(_0xeeba('0x1'))['db'][_0xeeba('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xeeba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeeba('0x4')};function emitEvent(_0x136918){return function(_0x1c1d7f,_0x12942b,_0x1f0248){MailAccountEvents[_0xeeba('0x5')](_0x136918+':'+_0x1c1d7f['id'],_0x1c1d7f);MailAccountEvents[_0xeeba('0x5')](_0x136918,_0x1c1d7f);_0x1f0248(null);};}for(var e in events){if(events[_0xeeba('0x6')](e)){var event=events[e];MailAccount[_0xeeba('0x7')](e,emitEvent(event));}}module[_0xeeba('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0abbd62..3ad048e 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 _0xe15f=['exports','define','MailAccount','mail_accounts','provider','custom','service','host','port','secure','Smtp','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes'];(function(_0x587d26,_0x1254d9){var _0x4d88f3=function(_0x2ab0a7){while(--_0x2ab0a7){_0x587d26['push'](_0x587d26['shift']());}};_0x4d88f3(++_0x1254d9);}(_0xe15f,0x1b7));var _0xfe15=function(_0x1ca943,_0x5a4327){_0x1ca943=_0x1ca943-0x0;var _0x25202a=_0xe15f[_0x1ca943];return _0x25202a;};'use strict';var attributes=require(_0xfe15('0x0'));module[_0xfe15('0x1')]=function(_0x463438){return _0x463438[_0xfe15('0x2')](_0xfe15('0x3'),attributes,{'tableName':_0xfe15('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x39218b=this;var _0x5e5dcf={'id':_0x39218b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39218b[_0xfe15('0x5')]!==_0xfe15('0x6')){_0x5e5dcf[_0xfe15('0x7')]=_0x39218b[_0xfe15('0x5')];}else{_0x5e5dcf[_0xfe15('0x8')]=_0x39218b['Smtp']['host'];_0x5e5dcf['port']=_0x39218b['Smtp'][_0xfe15('0x9')];_0x5e5dcf[_0xfe15('0xa')]=_0x39218b[_0xfe15('0xb')][_0xfe15('0xa')];}if(_0x39218b[_0xfe15('0xb')][_0xfe15('0xc')]){if(_0x39218b['Smtp'][_0xfe15('0xd')]){if(!_0x39218b[_0xfe15('0xb')]['CloudProvider'])throw new Error(_0xfe15('0xe'));_0x5e5dcf[_0xfe15('0xf')]={'type':_0xfe15('0x10'),'user':_0x39218b[_0xfe15('0xb')][_0xfe15('0x11')],'accessToken':_0x39218b['Smtp']['CloudProvider'][_0xfe15('0x12')]};}else{_0x5e5dcf[_0xfe15('0xf')]={'user':_0x39218b[_0xfe15('0xb')][_0xfe15('0x11')],'pass':_0x39218b['Smtp'][_0xfe15('0x13')]};}}return _0x5e5dcf;}}});}; \ No newline at end of file +var _0x0f60=['custom','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','exports','define','mail_accounts'];(function(_0x80df30,_0x1223a1){var _0x206ba5=function(_0x1c19da){while(--_0x1c19da){_0x80df30['push'](_0x80df30['shift']());}};_0x206ba5(++_0x1223a1);}(_0x0f60,0xa7));var _0x00f6=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x0f60[_0x21b36c];return _0x236627;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x00f6('0x0')]=function(_0x3417e5){return _0x3417e5[_0x00f6('0x1')]('MailAccount',attributes,{'tableName':_0x00f6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1248fb=this;var _0x105a31={'id':_0x1248fb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1248fb['provider']!==_0x00f6('0x3')){_0x105a31['service']=_0x1248fb[_0x00f6('0x4')];}else{_0x105a31[_0x00f6('0x5')]=_0x1248fb[_0x00f6('0x6')][_0x00f6('0x5')];_0x105a31[_0x00f6('0x7')]=_0x1248fb[_0x00f6('0x6')][_0x00f6('0x7')];_0x105a31[_0x00f6('0x8')]=_0x1248fb[_0x00f6('0x6')][_0x00f6('0x8')];}if(_0x1248fb[_0x00f6('0x6')][_0x00f6('0x9')]){if(_0x1248fb['Smtp'][_0x00f6('0xa')]){if(!_0x1248fb[_0x00f6('0x6')][_0x00f6('0xb')])throw new Error(_0x00f6('0xc'));_0x105a31[_0x00f6('0xd')]={'type':_0x00f6('0xe'),'user':_0x1248fb[_0x00f6('0x6')][_0x00f6('0xf')],'accessToken':_0x1248fb[_0x00f6('0x6')]['CloudProvider'][_0x00f6('0x10')]};}else{_0x105a31[_0x00f6('0xd')]={'user':_0x1248fb[_0x00f6('0x6')][_0x00f6('0xf')],'pass':_0x1248fb[_0x00f6('0x6')]['pass']};}}return _0x105a31;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c7ea0d8..1c84dfb 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 _0x9fd4=['generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','inReplyTo','create','spread','update','attach','interaction','created','MailMessage','contact','attachments','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','options','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','List','get','omit','Applications','applications','list','priority','asc','autoclose','close','length','List\x20not\x20found','messageId'];(function(_0x1274f5,_0x3ddb6b){var _0x5542db=function(_0x225c69){while(--_0x225c69){_0x1274f5['push'](_0x1274f5['shift']());}};_0x5542db(++_0x3ddb6b);}(_0x9fd4,0x16c));var _0x49fd=function(_0x187e24,_0x393e15){_0x187e24=_0x187e24-0x0;var _0x39b658=_0x9fd4[_0x187e24];return _0x39b658;};'use strict';var _=require(_0x49fd('0x0'));var moment=require(_0x49fd('0x1'));var BPromise=require(_0x49fd('0x2'));var rs=require(_0x49fd('0x3'));var Redis=require(_0x49fd('0x4'));var db=require(_0x49fd('0x5'))['db'];var logger=require(_0x49fd('0x6'))(_0x49fd('0x7'));var config=require(_0x49fd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x49fd('0x9')]({'port':0x232c});config[_0x49fd('0xa')]=_[_0x49fd('0xb')](config[_0x49fd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x49fd('0xc'))(new Redis(config[_0x49fd('0xa')]));require(_0x49fd('0xd'))[_0x49fd('0xe')](socket);function respondWithRpcPromise(_0x190807,_0x4a1c47,_0x35034c){return new BPromise(function(_0x130c9b,_0x3e1c71){return client[_0x49fd('0xf')](_0x190807,_0x35034c)[_0x49fd('0x10')](function(_0x2c6d77){logger[_0x49fd('0x11')]('MailAccount,\x20%s,\x20%s',_0x4a1c47,_0x49fd('0x12'));logger[_0x49fd('0x13')](_0x49fd('0x14'),_0x4a1c47,_0x49fd('0x12'),JSON[_0x49fd('0x15')](_0x2c6d77));if(_0x2c6d77[_0x49fd('0x16')]){if(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x17')]===0x1f4){logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);return _0x3e1c71(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);}logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);return _0x130c9b(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);}else{logger[_0x49fd('0x11')](_0x49fd('0x18'),_0x4a1c47,_0x49fd('0x12'));_0x130c9b(_0x2c6d77[_0x49fd('0x1a')][_0x49fd('0x19')]);}})[_0x49fd('0x1b')](function(_0x598793){logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x598793);_0x3e1c71(_0x598793);});});}exports['GetMailAccount']=function(_0x5c323a){var _0x449c9a=this;return new Promise(function(_0x53cbd1,_0x316e7c){return db[_0x49fd('0x1c')]['findAll']({'raw':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x1e')]||null:null,'attributes':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x1f')]||null:null,'limit':_0x5c323a['options']?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x20')]||null:null,'include':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a['options'][_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x5c323a[_0x49fd('0x1d')]['include'],function(_0x597161){return{'model':db[_0x597161['model']],'as':_0x597161['as'],'attributes':_0x597161[_0x49fd('0x1f')],'include':_0x597161[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x597161[_0x49fd('0x21')],function(_0x9587b9){return{'model':db[_0x9587b9[_0x49fd('0x23')]],'as':_0x9587b9['as'],'attributes':_0x9587b9[_0x49fd('0x1f')],'include':_0x9587b9[_0x49fd('0x21')]?_['map'](_0x9587b9[_0x49fd('0x21')],function(_0x52b35d){return{'model':db[_0x52b35d[_0x49fd('0x23')]],'as':_0x52b35d['as'],'attributes':_0x52b35d[_0x49fd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x203038){logger[_0x49fd('0x11')](_0x49fd('0x24'),_0x5c323a);logger[_0x49fd('0x13')](_0x49fd('0x24'),_0x5c323a,JSON[_0x49fd('0x15')](_0x203038));_0x53cbd1(_0x203038);})[_0x49fd('0x1b')](function(_0x242203){logger['error'](_0x49fd('0x24'),_0x242203['message'],_0x5c323a);_0x316e7c(_0x449c9a[_0x49fd('0x16')](0x1f4,_0x242203['message']));});});};exports[_0x49fd('0x25')]=function(_0x3c082c){var _0x390788=this;return new Promise(function(_0x492622,_0x50d304){return db['MailAccount'][_0x49fd('0x26')]({'raw':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c['options'][_0x49fd('0x27')]===undefined?!![]:![]:!![],'where':_0x3c082c['options']?_0x3c082c['options'][_0x49fd('0x1e')]||null:null,'attributes':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x1f')]||null:null,'include':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c['options']['include']?_[_0x49fd('0x22')](_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x21')],function(_0x28f88f){return{'model':db[_0x28f88f['model']],'as':_0x28f88f['as'],'attributes':_0x28f88f[_0x49fd('0x1f')],'include':_0x28f88f[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x28f88f[_0x49fd('0x21')],function(_0x4363b5){return{'model':db[_0x4363b5[_0x49fd('0x23')]],'as':_0x4363b5['as'],'attributes':_0x4363b5[_0x49fd('0x1f')],'include':_0x4363b5[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x4363b5[_0x49fd('0x21')],function(_0x3762c7){return{'model':db[_0x3762c7['model']],'as':_0x3762c7['as'],'attributes':_0x3762c7[_0x49fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x49fd('0x10')](function(_0x8dc5b3){if(_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x28')]===!![])_0x8dc5b3[_0x49fd('0x29')](_0x49fd('0x2a'),_0x8dc5b3[_0x49fd('0x2b')]());logger[_0x49fd('0x11')]('ShowMailAccount',_0x3c082c);logger[_0x49fd('0x13')]('ShowMailAccount',_0x3c082c,JSON[_0x49fd('0x15')](_0x8dc5b3));_0x492622(_0x8dc5b3);})[_0x49fd('0x1b')](function(_0x523ddf){logger[_0x49fd('0x16')](_0x49fd('0x25'),_0x523ddf['message'],_0x3c082c);_0x50d304(_0x390788[_0x49fd('0x16')](0x1f4,_0x523ddf['message']));});});};exports['NotifyMailAccount']=function(_0x5f56f8){var _0x10057b=this;return new Promise(function(_0x32982e,_0x36739b){var _0x3f73d3={'body':_0x5f56f8['body'],'channel':_0x49fd('0x2c')};var _0x2c3b7d=_[_0x49fd('0x2d')](_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')]),[_0x49fd('0x31'),_0x49fd('0x32'),'CompanyId',_0x49fd('0x33')]);var _0x2c8ab1=![];if(_0x5f56f8['body']['id']){delete _0x5f56f8[_0x49fd('0x34')]['id'];}if(_[_0x49fd('0x35')](_0x5f56f8['body'][_0x49fd('0x36')])){return _0x36739b(_0x10057b['error'](0x1f4,_0x49fd('0x37')));}if(_[_0x49fd('0x35')](_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x34')])||_0x5f56f8['body']['body']===''){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x49fd('0x35')](_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')])){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c3b7d));}if(!_[_0x49fd('0x39')](_0x2c3b7d,_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')])){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,_0x49fd('0x3a')+_0x2c3b7d));}var _0x30937f={};_0x30937f[_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')]]=_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x36')];return db[_0x49fd('0x1c')][_0x49fd('0x26')]({'where':{'id':_0x5f56f8[_0x49fd('0x3b')]['id']},'include':[{'model':db[_0x49fd('0x3c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x49fd('0x3d'),'where':_0x30937f,'limit':0x1,'order':[[_0x49fd('0x32'),_0x49fd('0x3e')]]}]},{'model':db[_0x49fd('0x3f')],'as':'Applications'},{'model':db[_0x49fd('0x40')],'as':_0x49fd('0x41'),'include':[{'model':db['CloudProvider'],'as':_0x49fd('0x42')}]}]})[_0x49fd('0x10')](function(_0xaac56f){if(_0xaac56f&&_0xaac56f[_0x49fd('0x43')]){var _0x1316cb=_0xaac56f[_0x49fd('0x44')]({'plain':!![]});_0x3f73d3[_0x49fd('0x3b')]=_[_0x49fd('0x45')](_0x1316cb,[_0x49fd('0x46'),_0x49fd('0x43')]);_0x3f73d3[_0x49fd('0x3b')]['smtpOptions']=_0xaac56f[_0x49fd('0x2b')]();_0x3f73d3[_0x49fd('0x47')]=_0x1316cb[_0x49fd('0x46')];_0x3f73d3[_0x49fd('0x48')]=_0x1316cb[_0x49fd('0x43')];_0x3f73d3[_0x49fd('0x47')]=_['orderBy'](_0x3f73d3['applications'],[_0x49fd('0x49')],[_0x49fd('0x4a')]);if(_0x3f73d3[_0x49fd('0x3b')]&&_0x3f73d3['account'][_0x49fd('0x4b')]){_0x3f73d3[_0x49fd('0x47')]['push']({'id':0x0,'priority':_0x3f73d3['applications']['length']+0x1,'app':_0x49fd('0x4c'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x3f73d3['account'][_0x49fd('0x46')]){delete _0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x46')];}if(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x43')]){delete _0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x43')];}if(_0x1316cb[_0x49fd('0x43')][_0x49fd('0x3d')][_0x49fd('0x4d')]){return _0x1316cb['List'][_0x49fd('0x3d')][0x0];}var _0x202a86=_[_0x49fd('0xb')](_0x5f56f8[_0x49fd('0x34')],{'firstName':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x36')],'ListId':_0x1316cb['ListId']});_0x202a86[_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')]]=_0x5f56f8['body']['from'];return db[_0x49fd('0x2f')]['create'](_0x202a86);}else{throw new Error(_0x49fd('0x4e'));}})['then'](function(_0x24b5a3){_0x3f73d3['contact']=_0x24b5a3;if(_0x24b5a3){if(!_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['messageId']){_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x4f')]=rs[_0x49fd('0x50')]()+'\x20'+_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x36')];}var _0x138dcc={'ContactId':_0x24b5a3['id'],'MailAccountId':_0x5f56f8['account']['id'],'inReplyTo':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x4f')],'to':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x36')],'cc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['attach'],'lastMsgAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x49fd('0x26')]({'where':{'closed':![],'MailAccountId':_0x5f56f8[_0x49fd('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x54')]}}]})[_0x49fd('0x10')](function(_0xb1e0f3){if(_0xb1e0f3){return[_0xb1e0f3,![]];}return db['MailInteraction'][_0x49fd('0x55')](_0x138dcc)['then'](function(_0x418673){return[_0x418673,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x49fd('0x56')](function(_0x1a8da2,_0x234e2a){if(_0x1a8da2){_0x2c8ab1=_0x234e2a;if(!_0x234e2a){return _0x1a8da2[_0x49fd('0x57')]({'inReplyTo':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x4f')],'to':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x36')],'cc':_0x5f56f8[_0x49fd('0x34')]['message']['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x1a8da2[_0x49fd('0x58')]?_0x1a8da2[_0x49fd('0x58')]:_0x5f56f8[_0x49fd('0x34')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgDirection':'in'});}else{return _0x1a8da2;}}})[_0x49fd('0x10')](function(_0xdc81cf){_0x3f73d3[_0x49fd('0x59')]=_0xdc81cf[_0x49fd('0x44')]({'plain':!![]});_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x5a')]=_0x2c8ab1;return db[_0x49fd('0x5b')][_0x49fd('0x55')]({'body':_0x5f56f8[_0x49fd('0x34')]['body'],'MailAccountId':_0x5f56f8[_0x49fd('0x3b')]['id'],'MailInteractionId':_0xdc81cf['id'],'direction':'in','ContactId':_0x3f73d3[_0x49fd('0x5c')]['id'],'messageId':_0x5f56f8[_0x49fd('0x34')]['message']['messageId'],'from':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x36')],'to':_0x5f56f8['body'][_0x49fd('0x19')]['to'],'cc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x5f56f8[_0x49fd('0x34')]['message']['attach'],'Attachments':_0x5f56f8[_0x49fd('0x34')]['message'][_0x49fd('0x5d')],'originTo':_0x5f56f8['body']['message']['originTo'],'originCc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['originCc'],'bcc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['bcc'],'ChatWebsiteId':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['ChatWebsiteId']||null,'originChannel':_0x5f56f8[_0x49fd('0x34')]['message'][_0x49fd('0x5e')]||_0x49fd('0x5f'),'ChatOfflineMessageId':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x60')]||null},{'include':[{'model':db['Attachment'],'as':_0x49fd('0x61')}]});})[_0x49fd('0x10')](function(_0x2e4f40){_0x3f73d3[_0x49fd('0x19')]=_0x2e4f40;if(!_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x62')]){return;}return db[_0x49fd('0x63')][_0x49fd('0x26')]({'attributes':['id','name'],'where':{'id':_0x3f73d3['interaction'][_0x49fd('0x62')]}});})[_0x49fd('0x10')](function(_0x555a87){if(_0x555a87){_0x3f73d3[_0x49fd('0x47')][_0x49fd('0x64')]({'id':0x0,'priority':0x0,'app':_0x49fd('0x65'),'appdata':_0x555a87[_0x49fd('0x66')]+','+(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x67')]||0xa),'interval':_0x49fd('0x68')});}if(!_0x3f73d3['interaction'][_0x49fd('0x69')]){return;}return db[_0x49fd('0x6a')][_0x49fd('0x26')]({'attributes':['id',_0x49fd('0x66')],'where':{'id':_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x69')]}});})[_0x49fd('0x10')](function(_0x545740){if(_0x545740){_0x3f73d3[_0x49fd('0x47')][_0x49fd('0x64')]({'id':0x0,'priority':0x1,'app':_0x49fd('0x6b'),'appdata':_0x545740[_0x49fd('0x66')]+','+(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x6c')]||0x12c),'interval':_0x49fd('0x68')});}return respondWithRpcPromise(_0x49fd('0x6d'),_0x49fd('0x6e'),_0x3f73d3);})[_0x49fd('0x10')](function(_0x41342e){_0x32982e(_0x41342e);})[_0x49fd('0x1b')](function(_0x23a779){_0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,_0x23a779[_0x49fd('0x19')]));});});}; \ No newline at end of file +var _0x8819=['list','orderBy','priority','asc','push','length','autoclose','*,*,*,*','create','List\x20not\x20found','messageId','subject','attach','format','MailInteraction','find','MailMessage','inReplyTo','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','model','attributes','include','map','then','stringify','ShowMailAccount','smtp','smtpOptions','getSmtpOptions','body','mail','difference','keys','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','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','get','omit','Applications','applications'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0x8819,0x94));var _0x9881=function(_0x1ccde5,_0x1f39a4){_0x1ccde5=_0x1ccde5-0x0;var _0x1390bf=_0x8819[_0x1ccde5];return _0x1390bf;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9881('0x0'));var rs=require(_0x9881('0x1'));var Redis=require(_0x9881('0x2'));var db=require(_0x9881('0x3'))['db'];var logger=require(_0x9881('0x4'))('rpc');var config=require(_0x9881('0x5'));var jayson=require(_0x9881('0x6'));var client=jayson[_0x9881('0x7')][_0x9881('0x8')]({'port':0x232c});config[_0x9881('0x9')]=_[_0x9881('0xa')](config['redis'],{'host':_0x9881('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9881('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c2c0f,_0x4034f5,_0x4adf62){return new BPromise(function(_0x2570a3,_0x39122e){return client[_0x9881('0xd')](_0x5c2c0f,_0x4adf62)['then'](function(_0x1df0ba){logger[_0x9881('0xe')](_0x9881('0xf'),_0x4034f5,_0x9881('0x10'));logger['debug'](_0x9881('0x11'),_0x4034f5,_0x9881('0x10'),JSON['stringify'](_0x1df0ba));if(_0x1df0ba[_0x9881('0x12')]){if(_0x1df0ba['error']['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x4034f5,_0x1df0ba[_0x9881('0x12')][_0x9881('0x13')]);return _0x39122e(_0x1df0ba[_0x9881('0x12')][_0x9881('0x13')]);}logger[_0x9881('0x12')](_0x9881('0xf'),_0x4034f5,_0x1df0ba['error'][_0x9881('0x13')]);return _0x2570a3(_0x1df0ba[_0x9881('0x12')][_0x9881('0x13')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4034f5,'request\x20sent');_0x2570a3(_0x1df0ba[_0x9881('0x14')]['message']);}})[_0x9881('0x15')](function(_0x5a9848){logger['error'](_0x9881('0xf'),_0x4034f5,_0x5a9848);_0x39122e(_0x5a9848);});});}exports[_0x9881('0x16')]=function(_0x1cbac3){var _0x2941bc=this;return new Promise(function(_0x43f8a2,_0xe97d44){return db[_0x9881('0x17')][_0x9881('0x18')]({'raw':_0x1cbac3[_0x9881('0x19')]?_0x1cbac3[_0x9881('0x19')][_0x9881('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cbac3[_0x9881('0x19')]?_0x1cbac3[_0x9881('0x19')][_0x9881('0x1b')]||null:null,'attributes':_0x1cbac3[_0x9881('0x19')]?_0x1cbac3['options']['attributes']||null:null,'limit':_0x1cbac3[_0x9881('0x19')]?_0x1cbac3['options']['limit']||null:null,'include':_0x1cbac3[_0x9881('0x19')]?_0x1cbac3[_0x9881('0x19')]['include']?_['map'](_0x1cbac3[_0x9881('0x19')]['include'],function(_0x2bddc1){return{'model':db[_0x2bddc1[_0x9881('0x1c')]],'as':_0x2bddc1['as'],'attributes':_0x2bddc1[_0x9881('0x1d')],'include':_0x2bddc1[_0x9881('0x1e')]?_[_0x9881('0x1f')](_0x2bddc1[_0x9881('0x1e')],function(_0x2f6b7c){return{'model':db[_0x2f6b7c[_0x9881('0x1c')]],'as':_0x2f6b7c['as'],'attributes':_0x2f6b7c[_0x9881('0x1d')],'include':_0x2f6b7c[_0x9881('0x1e')]?_[_0x9881('0x1f')](_0x2f6b7c[_0x9881('0x1e')],function(_0x1f8fdd){return{'model':db[_0x1f8fdd['model']],'as':_0x1f8fdd['as'],'attributes':_0x1f8fdd[_0x9881('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9881('0x20')](function(_0x5c2815){logger[_0x9881('0xe')](_0x9881('0x16'),_0x1cbac3);logger['debug'](_0x9881('0x16'),_0x1cbac3,JSON[_0x9881('0x21')](_0x5c2815));_0x43f8a2(_0x5c2815);})[_0x9881('0x15')](function(_0x204f2b){logger[_0x9881('0x12')](_0x9881('0x16'),_0x204f2b[_0x9881('0x13')],_0x1cbac3);_0xe97d44(_0x2941bc[_0x9881('0x12')](0x1f4,_0x204f2b['message']));});});};exports[_0x9881('0x22')]=function(_0xab2a2c){var _0x2690f8=this;return new Promise(function(_0x4685a4,_0xffc845){return db[_0x9881('0x17')]['find']({'raw':_0xab2a2c[_0x9881('0x19')]?_0xab2a2c[_0x9881('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xab2a2c[_0x9881('0x19')]?_0xab2a2c[_0x9881('0x19')][_0x9881('0x1b')]||null:null,'attributes':_0xab2a2c[_0x9881('0x19')]?_0xab2a2c[_0x9881('0x19')]['attributes']||null:null,'include':_0xab2a2c[_0x9881('0x19')]?_0xab2a2c[_0x9881('0x19')][_0x9881('0x1e')]?_[_0x9881('0x1f')](_0xab2a2c[_0x9881('0x19')][_0x9881('0x1e')],function(_0x2028fc){return{'model':db[_0x2028fc[_0x9881('0x1c')]],'as':_0x2028fc['as'],'attributes':_0x2028fc[_0x9881('0x1d')],'include':_0x2028fc[_0x9881('0x1e')]?_[_0x9881('0x1f')](_0x2028fc[_0x9881('0x1e')],function(_0xfff6a5){return{'model':db[_0xfff6a5[_0x9881('0x1c')]],'as':_0xfff6a5['as'],'attributes':_0xfff6a5[_0x9881('0x1d')],'include':_0xfff6a5[_0x9881('0x1e')]?_['map'](_0xfff6a5[_0x9881('0x1e')],function(_0x5f14d5){return{'model':db[_0x5f14d5[_0x9881('0x1c')]],'as':_0x5f14d5['as'],'attributes':_0x5f14d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9881('0x20')](function(_0x3fe9bf){if(_0xab2a2c['options'][_0x9881('0x23')]===!![])_0x3fe9bf['setDataValue'](_0x9881('0x24'),_0x3fe9bf[_0x9881('0x25')]());logger[_0x9881('0xe')](_0x9881('0x22'),_0xab2a2c);logger['debug'](_0x9881('0x22'),_0xab2a2c,JSON[_0x9881('0x21')](_0x3fe9bf));_0x4685a4(_0x3fe9bf);})[_0x9881('0x15')](function(_0xd98262){logger[_0x9881('0x12')](_0x9881('0x22'),_0xd98262[_0x9881('0x13')],_0xab2a2c);_0xffc845(_0x2690f8['error'](0x1f4,_0xd98262[_0x9881('0x13')]));});});};exports['NotifyMailAccount']=function(_0x44a344){var _0xe1f86a=this;return new Promise(function(_0x1c0396,_0x526ceb){var _0x51be30={'body':_0x44a344[_0x9881('0x26')],'channel':_0x9881('0x27')};var _0x4c5b11=_[_0x9881('0x28')](_[_0x9881('0x29')](db['CmContact'][_0x9881('0x2a')]),[_0x9881('0x2b'),_0x9881('0x2c'),_0x9881('0x2d'),_0x9881('0x2e')]);var _0x1eae2f=![];if(_0x44a344[_0x9881('0x26')]['id']){delete _0x44a344[_0x9881('0x26')]['id'];}if(_[_0x9881('0x2f')](_0x44a344[_0x9881('0x26')]['from'])){return _0x526ceb(_0xe1f86a[_0x9881('0x12')](0x1f4,_0x9881('0x30')));}if(_[_0x9881('0x2f')](_0x44a344[_0x9881('0x26')][_0x9881('0x26')])||_0x44a344['body'][_0x9881('0x26')]===''){return _0x526ceb(_0xe1f86a[_0x9881('0x12')](0x1f4,_0x9881('0x31')));}if(_[_0x9881('0x2f')](_0x44a344['body'][_0x9881('0x32')])){return _0x526ceb(_0xe1f86a[_0x9881('0x12')](0x1f4,_0x9881('0x33')+_0x4c5b11));}if(!_['includes'](_0x4c5b11,_0x44a344[_0x9881('0x26')][_0x9881('0x32')])){return _0x526ceb(_0xe1f86a[_0x9881('0x12')](0x1f4,_0x9881('0x34')+_0x4c5b11));}var _0x193c45={};_0x193c45[_0x44a344[_0x9881('0x26')][_0x9881('0x32')]]=_0x44a344[_0x9881('0x26')][_0x9881('0x35')];return db[_0x9881('0x17')]['find']({'where':{'id':_0x44a344[_0x9881('0x36')]['id']},'include':[{'model':db[_0x9881('0x37')],'as':_0x9881('0x38'),'include':[{'model':db['CmContact'],'as':_0x9881('0x39'),'where':_0x193c45,'limit':0x1,'order':[[_0x9881('0x2c'),_0x9881('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x9881('0x3b')],'as':_0x9881('0x3c'),'include':[{'model':db[_0x9881('0x3d')],'as':_0x9881('0x3d')}]}]})['then'](function(_0x514263){if(_0x514263&&_0x514263[_0x9881('0x38')]){var _0x355357=_0x514263[_0x9881('0x3e')]({'plain':!![]});_0x51be30['account']=_[_0x9881('0x3f')](_0x355357,[_0x9881('0x40'),'List']);_0x51be30[_0x9881('0x36')][_0x9881('0x24')]=_0x514263[_0x9881('0x25')]();_0x51be30[_0x9881('0x41')]=_0x355357[_0x9881('0x40')];_0x51be30[_0x9881('0x42')]=_0x355357[_0x9881('0x38')];_0x51be30['applications']=_[_0x9881('0x43')](_0x51be30['applications'],[_0x9881('0x44')],[_0x9881('0x45')]);if(_0x51be30[_0x9881('0x36')]&&_0x51be30[_0x9881('0x36')]['autoclose']){_0x51be30['applications'][_0x9881('0x46')]({'id':0x0,'priority':_0x51be30[_0x9881('0x41')][_0x9881('0x47')]+0x1,'app':'close','appdata':_0x9881('0x48'),'interval':_0x9881('0x49')});}if(_0x51be30[_0x9881('0x36')][_0x9881('0x40')]){delete _0x51be30[_0x9881('0x36')][_0x9881('0x40')];}if(_0x51be30['account'][_0x9881('0x38')]){delete _0x51be30[_0x9881('0x36')][_0x9881('0x38')];}if(_0x355357[_0x9881('0x38')][_0x9881('0x39')]['length']){return _0x355357['List']['Contacts'][0x0];}var _0x1450c3=_[_0x9881('0xa')](_0x44a344[_0x9881('0x26')],{'firstName':_0x44a344[_0x9881('0x26')][_0x9881('0x35')],'ListId':_0x355357[_0x9881('0x2e')]});_0x1450c3[_0x44a344['body']['mapKey']]=_0x44a344[_0x9881('0x26')][_0x9881('0x35')];return db['CmContact'][_0x9881('0x4a')](_0x1450c3);}else{throw new Error(_0x9881('0x4b'));}})[_0x9881('0x20')](function(_0x3b76b9){_0x51be30['contact']=_0x3b76b9;if(_0x3b76b9){if(!_0x44a344[_0x9881('0x26')]['message'][_0x9881('0x4c')]){_0x44a344[_0x9881('0x26')][_0x9881('0x13')]['messageId']=rs['generate']()+'\x20'+_0x44a344['body'][_0x9881('0x13')][_0x9881('0x35')];}var _0x572858={'ContactId':_0x3b76b9['id'],'MailAccountId':_0x44a344[_0x9881('0x36')]['id'],'inReplyTo':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x4c')],'to':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x35')],'cc':_0x44a344[_0x9881('0x26')]['message']['cc'],'subject':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x4d')],'attach':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x4e')],'lastMsgAt':moment()[_0x9881('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x9881('0x50')][_0x9881('0x51')]({'where':{'closed':![],'MailAccountId':_0x44a344[_0x9881('0x36')]['id']},'include':[{'model':db[_0x9881('0x52')],'as':'Messages','attributes':[_0x9881('0x4c')],'where':{'messageId':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x53')]}}]})[_0x9881('0x20')](function(_0x27a195){if(_0x27a195){return[_0x27a195,![]];}return db['MailInteraction']['create'](_0x572858)[_0x9881('0x20')](function(_0x5d218e){return[_0x5d218e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9881('0x54')](function(_0x172e07,_0x115eec){if(_0x172e07){_0x1eae2f=_0x115eec;if(!_0x115eec){return _0x172e07['update']({'inReplyTo':_0x44a344[_0x9881('0x26')][_0x9881('0x13')]['messageId'],'to':_0x44a344[_0x9881('0x26')][_0x9881('0x13')]['from'],'cc':_0x44a344[_0x9881('0x26')]['message']['cc'],'subject':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x4d')],'attach':_0x172e07[_0x9881('0x4e')]?_0x172e07[_0x9881('0x4e')]:_0x44a344[_0x9881('0x26')]['message'][_0x9881('0x4e')],'substatus':null,'substatusAt':moment()[_0x9881('0x4f')](_0x9881('0x55')),'lastMsgAt':moment()[_0x9881('0x4f')](_0x9881('0x55')),'lastMsgDirection':'in'});}else{return _0x172e07;}}})[_0x9881('0x20')](function(_0x4457a7){_0x51be30[_0x9881('0x56')]=_0x4457a7[_0x9881('0x3e')]({'plain':!![]});_0x51be30[_0x9881('0x56')][_0x9881('0x57')]=_0x1eae2f;return db['MailMessage'][_0x9881('0x4a')]({'body':_0x44a344[_0x9881('0x26')]['body'],'MailAccountId':_0x44a344[_0x9881('0x36')]['id'],'MailInteractionId':_0x4457a7['id'],'direction':'in','ContactId':_0x51be30[_0x9881('0x58')]['id'],'messageId':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x4c')],'from':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x35')],'to':_0x44a344['body'][_0x9881('0x13')]['to'],'cc':_0x44a344[_0x9881('0x26')][_0x9881('0x13')]['cc'],'subject':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x4d')],'attach':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x4e')],'Attachments':_0x44a344['body'][_0x9881('0x13')]['attachments'],'originTo':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x59')],'originCc':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x5a')],'bcc':_0x44a344['body'][_0x9881('0x13')][_0x9881('0x5b')],'ChatWebsiteId':_0x44a344[_0x9881('0x26')][_0x9881('0x13')][_0x9881('0x5c')]||null,'originChannel':_0x44a344[_0x9881('0x26')]['message'][_0x9881('0x5d')]||_0x9881('0x5e'),'ChatOfflineMessageId':_0x44a344[_0x9881('0x26')][_0x9881('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x9881('0x5f')],'as':_0x9881('0x60')}]});})['then'](function(_0x142cfa){_0x51be30[_0x9881('0x13')]=_0x142cfa;if(!_0x51be30[_0x9881('0x56')]['UserId']){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x51be30[_0x9881('0x56')][_0x9881('0x61')]}});})[_0x9881('0x20')](function(_0x237757){if(_0x237757){_0x51be30[_0x9881('0x41')][_0x9881('0x62')]({'id':0x0,'priority':0x0,'app':_0x9881('0x63'),'appdata':_0x237757[_0x9881('0x64')]+','+(_0x51be30['account'][_0x9881('0x65')]||0xa),'interval':_0x9881('0x49')});}if(!_0x51be30[_0x9881('0x56')]['queueId']){return;}return db[_0x9881('0x66')][_0x9881('0x51')]({'attributes':['id',_0x9881('0x64')],'where':{'id':_0x51be30[_0x9881('0x56')][_0x9881('0x67')]}});})[_0x9881('0x20')](function(_0x5e245b){if(_0x5e245b){_0x51be30['applications'][_0x9881('0x62')]({'id':0x0,'priority':0x1,'app':_0x9881('0x68'),'appdata':_0x5e245b[_0x9881('0x64')]+','+(_0x51be30['account'][_0x9881('0x69')]||0x12c),'interval':_0x9881('0x49')});}return respondWithRpcPromise(_0x9881('0x6a'),'startRouting',_0x51be30);})[_0x9881('0x20')](function(_0x13dc4d){_0x1c0396(_0x13dc4d);})[_0x9881('0x15')](function(_0x472ad1){_0x526ceb(_0xe1f86a[_0x9881('0x12')](0x1f4,_0x472ad1[_0x9881('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c4afc7f..76ce62d 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 _0x213c=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x213c,0xc4));var _0xc213=function(_0xe628d4,_0x39b1ff){_0xe628d4=_0xe628d4-0x0;var _0x21a58d=_0x213c[_0xe628d4];return _0x21a58d;};'use strict';var MailAccountEvents=require(_0xc213('0x0'));var events=['save',_0xc213('0x1'),_0xc213('0x2')];function createListener(_0x496ac1,_0x2714bb){return function(_0x3e68ee){_0x2714bb[_0xc213('0x3')](_0x496ac1,_0x3e68ee);};}function removeListener(_0x2a25ff,_0x3503de){return function(){MailAccountEvents[_0xc213('0x4')](_0x2a25ff,_0x3503de);};}exports[_0xc213('0x5')]=function(_0x48b853){for(var _0x3a8d56=0x0,_0x296daf=events[_0xc213('0x6')];_0x3a8d56<_0x296daf;_0x3a8d56++){var _0x1718f9=events[_0x3a8d56];var _0x137ff3=createListener(_0xc213('0x7')+_0x1718f9,_0x48b853);MailAccountEvents['on'](_0x1718f9,_0x137ff3);}}; \ No newline at end of file +var _0xb35e=['register','length','mailAccount:','save','remove','update','removeListener'];(function(_0x38fce3,_0x35f843){var _0x1e8026=function(_0x395812){while(--_0x395812){_0x38fce3['push'](_0x38fce3['shift']());}};_0x1e8026(++_0x35f843);}(_0xb35e,0x96));var _0xeb35=function(_0x40c526,_0x1b9021){_0x40c526=_0x40c526-0x0;var _0x2c677b=_0xb35e[_0x40c526];return _0x2c677b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xeb35('0x0'),_0xeb35('0x1'),_0xeb35('0x2')];function createListener(_0x20f4d4,_0x20de83){return function(_0x1fe240){_0x20de83['emit'](_0x20f4d4,_0x1fe240);};}function removeListener(_0x21c0cd,_0x1b55c5){return function(){MailAccountEvents[_0xeb35('0x3')](_0x21c0cd,_0x1b55c5);};}exports[_0xeb35('0x4')]=function(_0x49e097){for(var _0x147eeb=0x0,_0x24556f=events[_0xeb35('0x5')];_0x147eeb<_0x24556f;_0x147eeb++){var _0x3d9bbf=events[_0x147eeb];var _0x37c63a=createListener(_0xeb35('0x6')+_0x3d9bbf,_0x49e097);MailAccountEvents['on'](_0x3d9bbf,_0x37c63a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index aae730e..bc49e19 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 _0x2e59=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x2e59,0xb1));var _0x92e5=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x2e59[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x92e5('0x0'));var util=require('util');var path=require(_0x92e5('0x1'));var timeout=require(_0x92e5('0x2'));var express=require(_0x92e5('0x3'));var router=express[_0x92e5('0x4')]();var fs_extra=require(_0x92e5('0x5'));var auth=require(_0x92e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92e5('0x7'));var controller=require(_0x92e5('0x8'));router[_0x92e5('0x9')](_0x92e5('0xa'),auth[_0x92e5('0xb')](),controller[_0x92e5('0xc')]);router[_0x92e5('0xd')](_0x92e5('0xa'),auth[_0x92e5('0xb')](),controller['update']);router[_0x92e5('0xe')](_0x92e5('0xa'),auth['isAuthenticated'](),controller[_0x92e5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4aaf=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update'];(function(_0x351c07,_0x1380f0){var _0x53d2f3=function(_0x41d6f8){while(--_0x41d6f8){_0x351c07['push'](_0x351c07['shift']());}};_0x53d2f3(++_0x1380f0);}(_0x4aaf,0x183));var _0xf4aa=function(_0x40af09,_0x4987c8){_0x40af09=_0x40af09-0x0;var _0x116580=_0x4aaf[_0x40af09];return _0x116580;};'use strict';var multer=require(_0xf4aa('0x0'));var util=require('util');var path=require(_0xf4aa('0x1'));var timeout=require(_0xf4aa('0x2'));var express=require(_0xf4aa('0x3'));var router=express[_0xf4aa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf4aa('0x5'));var config=require(_0xf4aa('0x6'));var controller=require(_0xf4aa('0x7'));router[_0xf4aa('0x8')](_0xf4aa('0x9'),auth[_0xf4aa('0xa')](),controller['show']);router[_0xf4aa('0xb')]('/:id',auth[_0xf4aa('0xa')](),controller[_0xf4aa('0xc')]);router[_0xf4aa('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf4aa('0xe')]);module[_0xf4aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1a67143..e6097cd 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 _0x383d=['INTEGER','noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x1fade5,_0x4ec84b){var _0x14626c=function(_0x982710){while(--_0x982710){_0x1fade5['push'](_0x1fade5['shift']());}};_0x14626c(++_0x4ec84b);}(_0x383d,0xe9));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xd383('0x0')]={'priority':{'type':Sequelize[_0xd383('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd383('0x2')},'appdata':{'type':Sequelize[_0xd383('0x3')]()},'description':{'type':Sequelize[_0xd383('0x4')]},'interval':{'type':Sequelize[_0xd383('0x4')],'defaultValue':_0xd383('0x5')}}; \ No newline at end of file +var _0xdcdb=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x52a58c,_0x102224){var _0x3e826a=function(_0x26fc10){while(--_0x26fc10){_0x52a58c['push'](_0x52a58c['shift']());}};_0x3e826a(++_0x102224);}(_0xdcdb,0x64));var _0xbdcd=function(_0x12c511,_0x2102cc){_0x12c511=_0x12c511-0x0;var _0x208ba2=_0xdcdb[_0x12c511];return _0x208ba2;};'use strict';var Sequelize=require(_0xbdcd('0x0'));module[_0xbdcd('0x1')]={'priority':{'type':Sequelize[_0xbdcd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbdcd('0x3')],'allowNull':![],'defaultValue':_0xbdcd('0x4')},'appdata':{'type':Sequelize[_0xbdcd('0x5')]()},'description':{'type':Sequelize[_0xbdcd('0x3')]},'interval':{'type':Sequelize[_0xbdcd('0x3')],'defaultValue':_0xbdcd('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d8c91f7..59f308c 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 _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(_0x110100,_0x43d23b){var _0x4172a8=function(_0x59cc8d){while(--_0x59cc8d){_0x110100['push'](_0x110100['shift']());}};_0x4172a8(++_0x43d23b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x262bab,_0xe70807){_0x262bab=_0x262bab-0x0;var _0x35c381=_0xf4eb[_0x262bab];return _0x35c381;};'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 +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x5b3b5c,_0x7704ac){var _0x2c972f=function(_0x84d137){while(--_0x84d137){_0x5b3b5c['push'](_0x5b3b5c['shift']());}};_0x2c972f(++_0x7704ac);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 61396d4..55f028c 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 _0x392b=['mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailApplication.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x392b,0x182));var _0xb392=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x392b[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb392('0x0'));var logger=require(_0xb392('0x1'))(_0xb392('0x2'));var moment=require(_0xb392('0x3'));var BPromise=require(_0xb392('0x4'));var rp=require(_0xb392('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb392('0x6'));var config=require('../../config/environment');var attributes=require(_0xb392('0x7'));module[_0xb392('0x8')]=function(_0x311b2b,_0x270b5b){return _0x311b2b[_0xb392('0x9')]('MailApplication',attributes,{'tableName':_0xb392('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb392('0xb')});}; \ No newline at end of file +var _0x4e31=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e31,0x100));var _0x14e3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e31[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x14e3('0x0'));var logger=require(_0x14e3('0x1'))(_0x14e3('0x2'));var moment=require(_0x14e3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14e3('0x4'));var rimraf=require(_0x14e3('0x5'));var config=require(_0x14e3('0x6'));var attributes=require('./mailApplication.attributes');module[_0x14e3('0x7')]=function(_0x39d38c,_0x2980a7){return _0x39d38c['define'](_0x14e3('0x8'),attributes,{'tableName':_0x14e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14e3('0xa'),'collate':_0x14e3('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 20f270b..377372c 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 _0x77ff=['util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MailApplication','update','body','options','raw','attributes','UpdateMailApplication'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0x77ff,0x168));var _0xf77f=function(_0x12aab7,_0x10fa9a){_0x12aab7=_0x12aab7-0x0;var _0x16b408=_0x77ff[_0x12aab7];return _0x16b408;};'use strict';var _=require('lodash');var util=require(_0xf77f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf77f('0x1'))['db'];var utils=require(_0xf77f('0x2'));var logger=require(_0xf77f('0x3'))('rpc');var config=require(_0xf77f('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf77f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4f689e,_0x594382,_0x9df472){return new BPromise(function(_0x120174,_0x39b60b){return client['request'](_0x4f689e,_0x9df472)[_0xf77f('0x6')](function(_0xc9bcf7){logger['info'](_0xf77f('0x7'),_0x594382,_0xf77f('0x8'));logger[_0xf77f('0x9')](_0xf77f('0xa'),_0x594382,_0xf77f('0x8'),JSON[_0xf77f('0xb')](_0xc9bcf7));if(_0xc9bcf7[_0xf77f('0xc')]){if(_0xc9bcf7['error']['code']===0x1f4){logger[_0xf77f('0xc')](_0xf77f('0x7'),_0x594382,_0xc9bcf7[_0xf77f('0xc')][_0xf77f('0xd')]);return _0x39b60b(_0xc9bcf7[_0xf77f('0xc')][_0xf77f('0xd')]);}logger['error'](_0xf77f('0x7'),_0x594382,_0xc9bcf7['error']['message']);return _0x120174(_0xc9bcf7[_0xf77f('0xc')][_0xf77f('0xd')]);}else{logger[_0xf77f('0xe')](_0xf77f('0x7'),_0x594382,_0xf77f('0x8'));_0x120174(_0xc9bcf7[_0xf77f('0xf')][_0xf77f('0xd')]);}})[_0xf77f('0x10')](function(_0x350b1b){logger['error'](_0xf77f('0x7'),_0x594382,_0x350b1b);_0x39b60b(_0x350b1b);});});}exports['UpdateMailApplication']=function(_0x2c8447){var _0x384b4a=this;return new Promise(function(_0x11aa2f,_0x7f137){return db[_0xf77f('0x11')][_0xf77f('0x12')](_0x2c8447[_0xf77f('0x13')],{'raw':_0x2c8447[_0xf77f('0x14')]?_0x2c8447[_0xf77f('0x14')][_0xf77f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8447[_0xf77f('0x14')]?_0x2c8447['options']['where']||null:null,'attributes':_0x2c8447['options']?_0x2c8447[_0xf77f('0x14')][_0xf77f('0x16')]||null:null,'limit':_0x2c8447['options']?_0x2c8447[_0xf77f('0x14')]['limit']||null:null})[_0xf77f('0x6')](function(_0x4c0854){logger[_0xf77f('0xe')](_0xf77f('0x17'),_0x2c8447);logger[_0xf77f('0x9')](_0xf77f('0x17'),_0x2c8447,JSON[_0xf77f('0xb')](_0x4c0854));_0x11aa2f(_0x4c0854);})[_0xf77f('0x10')](function(_0x4a987b){logger[_0xf77f('0xc')](_0xf77f('0x17'),_0x4a987b[_0xf77f('0xd')],_0x2c8447);_0x7f137(_0x384b4a['error'](0x1f4,_0x4a987b[_0xf77f('0xd')]));});});}; \ No newline at end of file +var _0x3b73=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','catch'];(function(_0x3b0ec9,_0x5498b9){var _0x2546c1=function(_0x10cd7c){while(--_0x10cd7c){_0x3b0ec9['push'](_0x3b0ec9['shift']());}};_0x2546c1(++_0x5498b9);}(_0x3b73,0x174));var _0x33b7=function(_0x37006f,_0x42fe69){_0x37006f=_0x37006f-0x0;var _0x13653a=_0x3b73[_0x37006f];return _0x13653a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x33b7('0x0'));var BPromise=require('bluebird');var rs=require(_0x33b7('0x1'));var fs=require('fs');var Redis=require(_0x33b7('0x2'));var db=require(_0x33b7('0x3'))['db'];var utils=require(_0x33b7('0x4'));var logger=require(_0x33b7('0x5'))(_0x33b7('0x6'));var config=require(_0x33b7('0x7'));var jayson=require(_0x33b7('0x8'));var client=jayson[_0x33b7('0x9')][_0x33b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44416b,_0x16a072,_0x5a0ddb){return new BPromise(function(_0x283ef3,_0xe5ce7c){return client[_0x33b7('0xb')](_0x44416b,_0x5a0ddb)[_0x33b7('0xc')](function(_0x3931fe){logger['info'](_0x33b7('0xd'),_0x16a072,_0x33b7('0xe'));logger[_0x33b7('0xf')](_0x33b7('0x10'),_0x16a072,_0x33b7('0xe'),JSON[_0x33b7('0x11')](_0x3931fe));if(_0x3931fe[_0x33b7('0x12')]){if(_0x3931fe[_0x33b7('0x12')][_0x33b7('0x13')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x16a072,_0x3931fe[_0x33b7('0x12')][_0x33b7('0x14')]);return _0xe5ce7c(_0x3931fe[_0x33b7('0x12')][_0x33b7('0x14')]);}logger[_0x33b7('0x12')]('MailApplication,\x20%s,\x20%s',_0x16a072,_0x3931fe[_0x33b7('0x12')][_0x33b7('0x14')]);return _0x283ef3(_0x3931fe['error']['message']);}else{logger[_0x33b7('0x15')]('MailApplication,\x20%s,\x20%s',_0x16a072,_0x33b7('0xe'));_0x283ef3(_0x3931fe[_0x33b7('0x16')][_0x33b7('0x14')]);}})['catch'](function(_0x4d5ff2){logger[_0x33b7('0x12')](_0x33b7('0xd'),_0x16a072,_0x4d5ff2);_0xe5ce7c(_0x4d5ff2);});});}exports[_0x33b7('0x17')]=function(_0x52cbe8){var _0x5dfd56=this;return new Promise(function(_0x36e672,_0x5b1a78){return db[_0x33b7('0x18')][_0x33b7('0x19')](_0x52cbe8['body'],{'raw':_0x52cbe8[_0x33b7('0x1a')]?_0x52cbe8[_0x33b7('0x1a')][_0x33b7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52cbe8['options']?_0x52cbe8[_0x33b7('0x1a')]['where']||null:null,'attributes':_0x52cbe8[_0x33b7('0x1a')]?_0x52cbe8[_0x33b7('0x1a')][_0x33b7('0x1c')]||null:null,'limit':_0x52cbe8[_0x33b7('0x1a')]?_0x52cbe8[_0x33b7('0x1a')][_0x33b7('0x1d')]||null:null})[_0x33b7('0xc')](function(_0x210b46){logger['info'](_0x33b7('0x17'),_0x52cbe8);logger[_0x33b7('0xf')](_0x33b7('0x17'),_0x52cbe8,JSON[_0x33b7('0x11')](_0x210b46));_0x36e672(_0x210b46);})[_0x33b7('0x1e')](function(_0x1be6f2){logger[_0x33b7('0x12')](_0x33b7('0x17'),_0x1be6f2[_0x33b7('0x14')],_0x52cbe8);_0x5b1a78(_0x5dfd56[_0x33b7('0x12')](0x1f4,_0x1be6f2[_0x33b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4da57f2..4467922 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 _0x9a07=['put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x3ef532,_0x23d6a0){var _0x842155=function(_0x56f965){while(--_0x56f965){_0x3ef532['push'](_0x3ef532['shift']());}};_0x842155(++_0x23d6a0);}(_0x9a07,0xc4));var _0x79a0=function(_0xd470e6,_0x3f4d52){_0xd470e6=_0xd470e6-0x0;var _0x46e16b=_0x9a07[_0xd470e6];return _0x46e16b;};'use strict';var express=require(_0x79a0('0x0'));var router=express[_0x79a0('0x1')]();var auth=require(_0x79a0('0x2'));var interaction=require(_0x79a0('0x3'));var controller=require(_0x79a0('0x4'));router['get']('/',auth[_0x79a0('0x5')](),controller['index']);router[_0x79a0('0x6')](_0x79a0('0x7'),auth[_0x79a0('0x5')](),controller[_0x79a0('0x8')]);router[_0x79a0('0x6')](_0x79a0('0x9'),auth[_0x79a0('0x5')](),controller[_0x79a0('0xa')]);router[_0x79a0('0x6')](_0x79a0('0xb'),auth['isAuthenticated'](),controller[_0x79a0('0xc')]);router[_0x79a0('0x6')]('/:id/download',auth[_0x79a0('0x5')](),controller['download']);router[_0x79a0('0xd')]('/',auth[_0x79a0('0x5')](),controller[_0x79a0('0xe')]);router[_0x79a0('0xd')](_0x79a0('0xb'),auth[_0x79a0('0x5')](),controller[_0x79a0('0xf')]);router['post'](_0x79a0('0x10'),auth['isAuthenticated'](),interaction[_0x79a0('0x11')](_0x79a0('0x12'),_0x79a0('0x13')),controller['addTags']);router[_0x79a0('0x14')](_0x79a0('0x9'),auth['isAuthenticated'](),interaction[_0x79a0('0x11')]('mail','mailinteraction:update'),controller[_0x79a0('0x15')]);router[_0x79a0('0x16')]('/:id',auth[_0x79a0('0x5')](),interaction[_0x79a0('0x11')](_0x79a0('0x12'),_0x79a0('0x17')),controller[_0x79a0('0x18')]);router[_0x79a0('0x16')](_0x79a0('0x10'),auth[_0x79a0('0x5')](),controller[_0x79a0('0x19')]);module[_0x79a0('0x1a')]=router; \ No newline at end of file +var _0xa75f=['/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','destroy','removeTags','exports','Router','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x58d5d4,_0x4f05a3){var _0x596a07=function(_0x34a6c6){while(--_0x34a6c6){_0x58d5d4['push'](_0x58d5d4['shift']());}};_0x596a07(++_0x4f05a3);}(_0xa75f,0xe3));var _0xfa75=function(_0x43773d,_0x188b6e){_0x43773d=_0x43773d-0x0;var _0x5492c7=_0xa75f[_0x43773d];return _0x5492c7;};'use strict';var express=require('express');var router=express[_0xfa75('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa75('0x1'));var controller=require('./mailInteraction.controller');router[_0xfa75('0x2')]('/',auth[_0xfa75('0x3')](),controller[_0xfa75('0x4')]);router[_0xfa75('0x2')]('/describe',auth[_0xfa75('0x3')](),controller[_0xfa75('0x5')]);router[_0xfa75('0x2')](_0xfa75('0x6'),auth[_0xfa75('0x3')](),controller[_0xfa75('0x7')]);router[_0xfa75('0x2')](_0xfa75('0x8'),auth['isAuthenticated'](),controller['getMessages']);router[_0xfa75('0x2')](_0xfa75('0x9'),auth[_0xfa75('0x3')](),controller[_0xfa75('0xa')]);router[_0xfa75('0xb')]('/',auth[_0xfa75('0x3')](),controller[_0xfa75('0xc')]);router[_0xfa75('0xb')](_0xfa75('0x8'),auth[_0xfa75('0x3')](),controller['addMessage']);router[_0xfa75('0xb')](_0xfa75('0xd'),auth[_0xfa75('0x3')](),interaction[_0xfa75('0xe')](_0xfa75('0xf'),_0xfa75('0x10')),controller[_0xfa75('0x11')]);router['put'](_0xfa75('0x6'),auth[_0xfa75('0x3')](),interaction[_0xfa75('0xe')](_0xfa75('0xf'),_0xfa75('0x12')),controller[_0xfa75('0x13')]);router[_0xfa75('0x14')](_0xfa75('0x6'),auth[_0xfa75('0x3')](),interaction[_0xfa75('0xe')](_0xfa75('0xf'),'mailinteraction:destroy'),controller[_0xfa75('0x15')]);router[_0xfa75('0x14')]('/:id/tags',auth[_0xfa75('0x3')](),controller[_0xfa75('0x16')]);module[_0xfa75('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 f87ba2c..f599d1e 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 _0x249f=['ENUM','out','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0xd47797,_0xd0ef0){var _0x2e8582=function(_0x297d38){while(--_0x297d38){_0xd47797['push'](_0xd47797['shift']());}};_0x2e8582(++_0xd0ef0);}(_0x249f,0xaa));var _0xf249=function(_0x1b948f,_0x2cfbb6){_0x1b948f=_0x1b948f-0x0;var _0x1ca9e4=_0x249f[_0x1b948f];return _0x1ca9e4;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xf249('0x0'));module[_0xf249('0x1')]={'closed':{'type':Sequelize[_0xf249('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf249('0x3')]},'disposition':{'type':Sequelize[_0xf249('0x4')]},'secondDisposition':{'type':Sequelize[_0xf249('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf249('0x4')]},'inReplyTo':{'type':Sequelize[_0xf249('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf249('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xf249('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf249('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xf249('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf249('0x6')]('in',_0xf249('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf249('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf249('0x6')]('in',_0xf249('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf249('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x553f=['out','ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x553f,0x1bb));var _0xf553=function(_0x4fa9dc,_0x351628){_0x4fa9dc=_0x4fa9dc-0x0;var _0x67801d=_0x553f[_0x4fa9dc];return _0x67801d;};'use strict';var Sequelize=require(_0xf553('0x0'));var iconv=require('iconv');module[_0xf553('0x1')]={'closed':{'type':Sequelize[_0xf553('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf553('0x3')]},'disposition':{'type':Sequelize[_0xf553('0x4')]},'secondDisposition':{'type':Sequelize[_0xf553('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf553('0x4')]},'note':{'type':Sequelize[_0xf553('0x4')]},'inReplyTo':{'type':Sequelize[_0xf553('0x4')](0x1fe)},'to':{'type':Sequelize[_0xf553('0x4')]},'cc':{'type':Sequelize[_0xf553('0x5')](_0xf553('0x6'))},'subject':{'type':Sequelize[_0xf553('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf553('0x3')]},'substatus':{'type':Sequelize[_0xf553('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf553('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf553('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf553('0x8')]('in',_0xf553('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf553('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf553('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 2255b53..661ffdc 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 _0x9042=['catch','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','find','body','destroy','describe','addMessage','MailMessage','ids','getMessages','findOne','rawAttributes','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','push','Attachment','Attachments','Messages','bcc','subject','get','each','from','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','index','map','MailInteraction','fieldName','type','getOptions','findAll','mail','query','user'];(function(_0x1dc193,_0xaf90d6){var _0x347295=function(_0x54c498){while(--_0x54c498){_0x1dc193['push'](_0x1dc193['shift']());}};_0x347295(++_0xaf90d6);}(_0x9042,0x19a));var _0x2904=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x9042[_0x476b00];return _0x44ec8e;};'use strict';var emlformat=require(_0x2904('0x0'));var rimraf=require(_0x2904('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2904('0x2'));var BPromise=require(_0x2904('0x3'));var util=require(_0x2904('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x2904('0x5'));var juice=require('juice');var Redis=require(_0x2904('0x6'));var interaction=require(_0x2904('0x7'));var qs=require(_0x2904('0x8'));var logger=require('../../config/logger')(_0x2904('0x9'));var config=require(_0x2904('0xa'));var db=require(_0x2904('0xb'))['db'];var htmlEntities=require(_0x2904('0xc'));config['redis']=_[_0x2904('0xd')](config[_0x2904('0xe')],{'host':_0x2904('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2904('0xe')]));require(_0x2904('0x10'))['register'](socket);function respondWithStatusCode(_0x2b48d0,_0x498f92){_0x498f92=_0x498f92||0xcc;return function(_0x294334){if(_0x294334){return _0x2b48d0[_0x2904('0x11')](_0x498f92);}return _0x2b48d0[_0x2904('0x12')](_0x498f92)[_0x2904('0x13')]();};}function respondWithResult(_0x4e5657,_0x5470cd){_0x5470cd=_0x5470cd||0xc8;return function(_0x2f46eb){if(_0x2f46eb){return _0x4e5657[_0x2904('0x12')](_0x5470cd)[_0x2904('0x14')](_0x2f46eb);}};}function respondWithFilteredResult(_0x33ae5f,_0x5dd324){return function(_0x5c8871){if(_0x5c8871){var _0x220c46=typeof _0x5dd324[_0x2904('0x15')]===_0x2904('0x16')&&typeof _0x5dd324[_0x2904('0x17')]===_0x2904('0x16');var _0x23ffea=_0x5c8871[_0x2904('0x18')];var _0x5002e9=_0x220c46?0x0:_0x5dd324[_0x2904('0x15')];var _0x2a93ce=_0x220c46?_0x5c8871['count']:_0x5dd324[_0x2904('0x15')]+_0x5dd324[_0x2904('0x17')];var _0x3c8b82;if(_0x2a93ce>=_0x23ffea){_0x2a93ce=_0x23ffea;_0x3c8b82=0xc8;}else{_0x3c8b82=0xce;}_0x33ae5f[_0x2904('0x12')](_0x3c8b82);return _0x33ae5f[_0x2904('0x19')](_0x2904('0x1a'),_0x5002e9+'-'+_0x2a93ce+'/'+_0x23ffea)['json'](_0x5c8871);}return null;};}function saveUpdates(_0x39e0ad){return function(_0x5d7cc2){if(_0x5d7cc2){return _0x5d7cc2[_0x2904('0x1b')](_0x39e0ad)[_0x2904('0x1c')](function(_0x205da6){return _0x205da6;});}return null;};}function removeEntity(_0x186dab){return function(_0xe25308){if(_0xe25308){return _0xe25308['destroy']()[_0x2904('0x1c')](function(){_0x186dab[_0x2904('0x12')](0xcc)[_0x2904('0x13')]();});}};}function handleEntityNotFound(_0x55ee26){return function(_0x288c50){if(!_0x288c50){_0x55ee26[_0x2904('0x11')](0x194);}return _0x288c50;};}function handleError(_0x17d89c,_0x5f0076){_0x5f0076=_0x5f0076||0x1f4;return function(_0x3b4d50){logger['error'](_0x3b4d50[_0x2904('0x1d')]);if(_0x3b4d50[_0x2904('0x1e')]){delete _0x3b4d50[_0x2904('0x1e')];}_0x17d89c[_0x2904('0x12')](_0x5f0076)[_0x2904('0x1f')](_0x3b4d50);};}exports[_0x2904('0x20')]=function(_0x4b05a4,_0x28a81f){var _0x4c74fa={};var _0x469d7b=_[_0x2904('0x21')](db[_0x2904('0x22')]['rawAttributes'],function(_0x8b5937){return{'name':_0x8b5937[_0x2904('0x23')],'type':_0x8b5937[_0x2904('0x24')]['key']};});_0x4c74fa=qs[_0x2904('0x25')](_0x469d7b,_0x4b05a4);return interaction[_0x2904('0x26')](_0x2904('0x27'),_0x4b05a4[_0x2904('0x28')],_0x4b05a4[_0x2904('0x29')],_0x4c74fa,_0x469d7b)[_0x2904('0x1c')](respondWithFilteredResult(_0x28a81f,_0x4c74fa))[_0x2904('0x2a')](handleError(_0x28a81f,null));};exports['show']=function(_0x109eb8,_0x46e9b4){var _0x636c85={'raw':![],'where':{'id':_0x109eb8[_0x2904('0x2b')]['id']}},_0x364a73={};_0x364a73[_0x2904('0x2c')]=_[_0x2904('0x2d')](db[_0x2904('0x22')]['rawAttributes']);_0x364a73[_0x2904('0x28')]=_[_0x2904('0x2d')](_0x109eb8[_0x2904('0x28')]);_0x364a73[_0x2904('0x2e')]=_[_0x2904('0x2f')](_0x364a73[_0x2904('0x2c')],_0x364a73[_0x2904('0x28')]);_0x636c85[_0x2904('0x30')]=_['intersection'](_0x364a73[_0x2904('0x2c')],qs[_0x2904('0x31')](_0x109eb8[_0x2904('0x28')][_0x2904('0x31')]));_0x636c85[_0x2904('0x30')]=_0x636c85[_0x2904('0x30')]['length']?_0x636c85[_0x2904('0x30')]:_0x364a73['model'];if(_0x109eb8[_0x2904('0x28')][_0x2904('0x32')]){_0x636c85[_0x2904('0x33')]=[{'all':!![]}];}_0x636c85=_[_0x2904('0x34')]({},_0x636c85,_0x109eb8['options']);return db[_0x2904('0x22')][_0x2904('0x35')](_0x636c85)[_0x2904('0x1c')](handleEntityNotFound(_0x46e9b4,null))[_0x2904('0x1c')](respondWithResult(_0x46e9b4,null))[_0x2904('0x2a')](handleError(_0x46e9b4,null));};exports['create']=function(_0x3c712d,_0x483d8e){return db[_0x2904('0x22')]['create'](_0x3c712d[_0x2904('0x36')],{})[_0x2904('0x1c')](respondWithResult(_0x483d8e,0xc9))[_0x2904('0x2a')](handleError(_0x483d8e,null));};exports[_0x2904('0x1b')]=function(_0x2ee203,_0x5481ce){if(_0x2ee203[_0x2904('0x36')]['id']){delete _0x2ee203[_0x2904('0x36')]['id'];}return db[_0x2904('0x22')][_0x2904('0x35')]({'where':{'id':_0x2ee203[_0x2904('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5481ce,null))['then'](saveUpdates(_0x2ee203[_0x2904('0x36')],null))[_0x2904('0x1c')](respondWithResult(_0x5481ce,null))['catch'](handleError(_0x5481ce,null));};exports[_0x2904('0x37')]=function(_0x5bd7cf,_0x271aa7){return db['MailInteraction'][_0x2904('0x35')]({'where':{'id':_0x5bd7cf[_0x2904('0x2b')]['id']}})['then'](handleEntityNotFound(_0x271aa7,null))[_0x2904('0x1c')](removeEntity(_0x271aa7,null))[_0x2904('0x2a')](handleError(_0x271aa7,null));};exports[_0x2904('0x38')]=function(_0x3cd458,_0x78fea2){return db[_0x2904('0x22')][_0x2904('0x38')]()[_0x2904('0x1c')](respondWithResult(_0x78fea2,null))['catch'](handleError(_0x78fea2,null));};exports[_0x2904('0x39')]=function(_0x24b0e9,_0x3ced55){return db[_0x2904('0x3a')]['find']({'where':{'id':_0x24b0e9[_0x2904('0x2b')]['id']}})[_0x2904('0x1c')](handleEntityNotFound(_0x3ced55,null))[_0x2904('0x1c')](function(_0x282f6f){if(_0x282f6f){return _0x282f6f[_0x2904('0x39')](_0x24b0e9[_0x2904('0x36')][_0x2904('0x3b')],_['omit'](_0x24b0e9[_0x2904('0x36')],[_0x2904('0x3b'),'id'])||{});}})[_0x2904('0x1c')](respondWithResult(_0x3ced55,null))[_0x2904('0x2a')](handleError(_0x3ced55,null));};exports[_0x2904('0x3c')]=function(_0x53d6f0,_0x3dce4f){var _0x2cc972={'raw':![],'where':{}};var _0x323f2f={};var _0x53117f={'count':0x0,'rows':[]};return db[_0x2904('0x22')][_0x2904('0x3d')]({'where':{'id':_0x53d6f0[_0x2904('0x2b')]['id']}})[_0x2904('0x1c')](handleEntityNotFound(_0x3dce4f,null))[_0x2904('0x1c')](function(_0x2b0b1c){if(_0x2b0b1c){_0x323f2f[_0x2904('0x2c')]=_[_0x2904('0x2d')](db['MailMessage'][_0x2904('0x3e')]);_0x323f2f[_0x2904('0x28')]=_['keys'](_0x53d6f0['query']);_0x323f2f[_0x2904('0x2e')]=_['intersection'](_0x323f2f['model'],_0x323f2f['query']);_0x2cc972[_0x2904('0x30')]=_[_0x2904('0x2f')](_0x323f2f['model'],qs['fields'](_0x53d6f0['query'][_0x2904('0x31')]));_0x2cc972['attributes']=_0x2cc972['attributes'][_0x2904('0x3f')]?_0x2cc972[_0x2904('0x30')]:_0x323f2f[_0x2904('0x2c')];if(!_0x53d6f0[_0x2904('0x28')][_0x2904('0x40')](_0x2904('0x41'))){_0x2cc972[_0x2904('0x17')]=qs[_0x2904('0x17')](_0x53d6f0[_0x2904('0x28')]['limit']);_0x2cc972[_0x2904('0x15')]=qs['offset'](_0x53d6f0[_0x2904('0x28')][_0x2904('0x15')]);}_0x2cc972[_0x2904('0x42')]=qs['sort'](_0x53d6f0[_0x2904('0x28')][_0x2904('0x43')]);_0x2cc972[_0x2904('0x44')]=qs[_0x2904('0x2e')](_[_0x2904('0x45')](_0x53d6f0[_0x2904('0x28')],_0x323f2f[_0x2904('0x2e')]));_0x2cc972[_0x2904('0x44')][_0x2904('0x46')]=_0x2b0b1c['id'];if(_0x53d6f0[_0x2904('0x28')][_0x2904('0x47')]){_0x2cc972[_0x2904('0x44')]=_[_0x2904('0x34')](_0x2cc972[_0x2904('0x44')],{'$or':_[_0x2904('0x21')](_0x2cc972[_0x2904('0x30')],function(_0xde99cc){var _0x93b396={};_0x93b396[_0xde99cc]={'$like':'%'+_0x53d6f0[_0x2904('0x28')]['filter']+'%'};return _0x93b396;})});}if(_0x53d6f0['query']['$gte']){var _0x481942=_0x53d6f0[_0x2904('0x28')][_0x2904('0x48')][_0x2904('0x49')](',');var _0x351a58={};_0x351a58[_0x481942[0x0]]={'$gte':moment(_0x481942[0x1])[_0x2904('0x4a')](_0x2904('0x4b'))};_0x2cc972[_0x2904('0x44')]=_[_0x2904('0x34')](_0x2cc972['where'],_0x351a58);}_0x2cc972=_[_0x2904('0x34')]({},_0x2cc972,_0x53d6f0['options']);return db['MailMessage']['count']({'where':_0x2cc972[_0x2904('0x44')]})['then'](function(_0x44d26a){_0x53117f[_0x2904('0x18')]=_0x44d26a;if(_0x53d6f0['query'][_0x2904('0x32')]){_0x2cc972[_0x2904('0x33')]=[{'all':!![]}];}return db[_0x2904('0x3a')][_0x2904('0x26')](_0x2cc972);})[_0x2904('0x1c')](function(_0x48023a){if(_0x53d6f0['query'][_0x2904('0x4c')]===_0x2904('0x4d')){for(var _0x435c8a=0x0;_0x435c8a<_0x48023a['length'];_0x435c8a++){_0x48023a[_0x435c8a][_0x2904('0x36')]=juice(_0x48023a[_0x435c8a][_0x2904('0x36')]);}}_0x53117f[_0x2904('0x4e')]=_0x48023a;return _0x53117f;});}})[_0x2904('0x1c')](respondWithFilteredResult(_0x3dce4f,_0x2cc972))['catch'](handleError(_0x3dce4f,null));};exports['addTags']=function(_0x24627a,_0x58b86d){return db[_0x2904('0x22')]['find']({'where':{'id':_0x24627a[_0x2904('0x2b')]['id']}})['then'](handleEntityNotFound(_0x58b86d,null))[_0x2904('0x1c')](function(_0x5f0d24){if(_0x5f0d24){return _0x5f0d24[_0x2904('0x4f')](_0x24627a[_0x2904('0x36')]['ids'],_['omit'](_0x24627a[_0x2904('0x36')],[_0x2904('0x3b'),'id'])||{})[_0x2904('0x50')](function(){return db[_0x2904('0x51')][_0x2904('0x26')]({'attributes':['id',_0x2904('0x1e'),_0x2904('0x52')],'where':{'id':_0x24627a[_0x2904('0x36')]['ids']}});})[_0x2904('0x1c')](function(_0x5b6d69){socket[_0x2904('0x53')]('mailInteractionTags:save',{'id':Number(_0x24627a[_0x2904('0x2b')]['id']),'tags':_0x5b6d69||[]});return{'id':Number(_0x24627a['params']['id']),'tags':_0x5b6d69||[]};});}})[_0x2904('0x1c')](respondWithResult(_0x58b86d,null))[_0x2904('0x2a')](handleError(_0x58b86d,null));};exports[_0x2904('0x54')]=function(_0xa0075c,_0x36ab2d){return db[_0x2904('0x22')]['find']({'where':{'id':_0xa0075c[_0x2904('0x2b')]['id']}})[_0x2904('0x1c')](handleEntityNotFound(_0x36ab2d,null))[_0x2904('0x1c')](function(_0x1c0b96){if(_0x1c0b96){return _0x1c0b96[_0x2904('0x54')](_0xa0075c[_0x2904('0x28')][_0x2904('0x3b')]);}})[_0x2904('0x1c')](respondWithStatusCode(_0x36ab2d,null))[_0x2904('0x2a')](handleError(_0x36ab2d,null));};exports[_0x2904('0x55')]=function(_0x16d3e1,_0x422a69){var _0x132627=moment()[_0x2904('0x56')]()['toString']();var _0x27b48d=path[_0x2904('0x57')](config[_0x2904('0x58')],_0x2904('0x59'),_0x2904('0x5a'),_0x2904('0x5b'));var _0x374b2e=path[_0x2904('0x57')](config[_0x2904('0x58')],_0x2904('0x59'),'files',_0x2904('0x5c'));var _0x289667=path[_0x2904('0x57')](_0x27b48d,_0x132627);var _0x44e22e=util['format']('transcript-%d-%s.zip',_0x16d3e1['params']['id'],_0x132627);var _0x491902=path[_0x2904('0x57')](_0x27b48d,_0x44e22e);var _0x362198=[];if(_0x16d3e1[_0x2904('0x28')][_0x2904('0x5c')]){_0x362198[_0x2904('0x5d')]({'model':db[_0x2904('0x5e')],'as':_0x2904('0x5f'),'raw':!![]});}var _0x21aeb0=[{'model':db['MailMessage'],'as':_0x2904('0x60'),'attributes':['id',_0x2904('0x36'),'from','to','cc',_0x2904('0x61'),_0x2904('0x62'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2904('0x43')]('id'),'include':_0x362198}];return db[_0x2904('0x22')]['find']({'where':{'id':_0x16d3e1[_0x2904('0x2b')]['id']},'include':_0x21aeb0})[_0x2904('0x1c')](handleEntityNotFound(_0x422a69,null))[_0x2904('0x1c')](function(_0x4ef28c){if(_0x4ef28c&&_0x4ef28c[_0x2904('0x60')]){var _0x550d1c=_0x4ef28c[_0x2904('0x63')]({'plain':!![]});fs['mkdirSync'](_0x289667);return BPromise[_0x2904('0x64')](_0x550d1c[_0x2904('0x60')],function(_0x1a3679,_0x406408){var _0x70fd6c={'from':_0x1a3679[_0x2904('0x65')],'to':_0x1a3679['to']||_0x2904('0x66'),'subject':_0x1a3679['subject'],'html':htmlEntities[_0x2904('0x67')](_0x1a3679[_0x2904('0x36')]),'headers':{'Date':moment(_0x1a3679[_0x2904('0x68')])['format'](_0x2904('0x69'))},'attachments':[]};if(_0x1a3679['cc']){_0x70fd6c[_0x2904('0x6a')]['Cc']=_0x1a3679['cc'];}if(_0x1a3679['bcc']){_0x70fd6c[_0x2904('0x6a')][_0x2904('0x6b')]=_0x1a3679['bcc'];}return new BPromise(function(_0x305e0d,_0x338dd9){if(_0x1a3679[_0x2904('0x5f')]){for(var _0x6e5143=0x0;_0x6e5143<_0x1a3679[_0x2904('0x5f')][_0x2904('0x3f')];_0x6e5143++){var _0x6369df=_0x1a3679[_0x2904('0x5f')][_0x6e5143];var _0x30c4b9=path[_0x2904('0x57')](_0x374b2e,_0x6369df[_0x2904('0x6c')]);if(fs['existsSync'](_0x30c4b9)){_0x70fd6c['attachments'][_0x2904('0x5d')]({'name':_0x6369df[_0x2904('0x1e')],'contentType':_0x6369df[_0x2904('0x24')],'data':fs['readFileSync'](_0x30c4b9)});}}}emlformat[_0x2904('0x6d')](_0x70fd6c,function(_0x57b68f,_0x54d8ea){if(_0x57b68f)return _0x338dd9(_0x57b68f);fs[_0x2904('0x6e')](path['join'](_0x289667,util[_0x2904('0x4a')](_0x2904('0x6f'),_0x406408)),_0x54d8ea);return _0x305e0d(_0x54d8ea);});});})[_0x2904('0x1c')](function(){return new BPromise(function(_0x25c5a5,_0x2b6e07){zipdir(_0x289667,{'saveTo':_0x491902},function(_0x680039,_0x4ca9df){if(_0x680039)return _0x2b6e07(_0x680039);return _0x25c5a5(_0x4ca9df);});})[_0x2904('0x1c')](function(){return new BPromise(function(_0x117c43,_0x3fa949){rimraf(_0x289667,function(_0x74487e){if(_0x74487e)_0x3fa949(_0x74487e);return _0x117c43();});});})[_0x2904('0x1c')](function(){return _0x422a69['download'](_0x491902,_0x44e22e,function(_0x111d99){if(!_0x111d99)fs[_0x2904('0x70')](_0x491902);});});});}else{return _0x422a69['sendStatus'](0xc8);}})[_0x2904('0x2a')](handleError(_0x422a69,null));}; \ No newline at end of file +var _0xe68d=['send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','model','keys','intersection','attributes','fields','include','merge','options','find','create','body','params','addMessage','MailMessage','ids','getMessages','findOne','filters','length','order','sort','where','pick','filter','$gte','format','includeAll','inlineCss','true','rows','addTags','setTags','omit','spread','emit','mailInteractionTags:save','unix','toString','join','root','files','tmp','server','attachments','Attachment','Attachments','from','subject','createdAt','Messages','get','mkdirSync','missing.recipient@your.company.com','headers','Bcc','bcc','existsSync','push','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name'];(function(_0x17865c,_0x2c681d){var _0x40158f=function(_0x38e9c7){while(--_0x38e9c7){_0x17865c['push'](_0x17865c['shift']());}};_0x40158f(++_0x2c681d);}(_0xe68d,0x127));var _0xde68=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xe68d[_0xb725be];return _0x2f2424;};'use strict';var emlformat=require(_0xde68('0x0'));var rimraf=require(_0xde68('0x1'));var zipdir=require(_0xde68('0x2'));var moment=require(_0xde68('0x3'));var BPromise=require('bluebird');var util=require(_0xde68('0x4'));var path=require(_0xde68('0x5'));var fs=require('fs');var _=require(_0xde68('0x6'));var juice=require(_0xde68('0x7'));var Redis=require('ioredis');var interaction=require(_0xde68('0x8'));var qs=require(_0xde68('0x9'));var logger=require(_0xde68('0xa'))(_0xde68('0xb'));var config=require(_0xde68('0xc'));var db=require(_0xde68('0xd'))['db'];var htmlEntities=require('html-entities');config[_0xde68('0xe')]=_[_0xde68('0xf')](config[_0xde68('0xe')],{'host':_0xde68('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xde68('0x11'))[_0xde68('0x12')](socket);function respondWithStatusCode(_0x2545ad,_0x5ca3d4){_0x5ca3d4=_0x5ca3d4||0xcc;return function(_0xd87646){if(_0xd87646){return _0x2545ad['sendStatus'](_0x5ca3d4);}return _0x2545ad[_0xde68('0x13')](_0x5ca3d4)[_0xde68('0x14')]();};}function respondWithResult(_0x1cdae8,_0x12854b){_0x12854b=_0x12854b||0xc8;return function(_0x2186cb){if(_0x2186cb){return _0x1cdae8[_0xde68('0x13')](_0x12854b)[_0xde68('0x15')](_0x2186cb);}};}function respondWithFilteredResult(_0xca2f4c,_0x5e4802){return function(_0x31b52e){if(_0x31b52e){var _0x1aa090=typeof _0x5e4802[_0xde68('0x16')]==='undefined'&&typeof _0x5e4802[_0xde68('0x17')]===_0xde68('0x18');var _0x423d2c=_0x31b52e[_0xde68('0x19')];var _0x307759=_0x1aa090?0x0:_0x5e4802[_0xde68('0x16')];var _0x247390=_0x1aa090?_0x31b52e['count']:_0x5e4802[_0xde68('0x16')]+_0x5e4802[_0xde68('0x17')];var _0xfc37da;if(_0x247390>=_0x423d2c){_0x247390=_0x423d2c;_0xfc37da=0xc8;}else{_0xfc37da=0xce;}_0xca2f4c[_0xde68('0x13')](_0xfc37da);return _0xca2f4c[_0xde68('0x1a')](_0xde68('0x1b'),_0x307759+'-'+_0x247390+'/'+_0x423d2c)[_0xde68('0x15')](_0x31b52e);}return null;};}function saveUpdates(_0x5833c8){return function(_0x490639){if(_0x490639){return _0x490639[_0xde68('0x1c')](_0x5833c8)[_0xde68('0x1d')](function(_0x23f69a){return _0x23f69a;});}return null;};}function removeEntity(_0x5e4082){return function(_0x1494af){if(_0x1494af){return _0x1494af[_0xde68('0x1e')]()['then'](function(){_0x5e4082[_0xde68('0x13')](0xcc)[_0xde68('0x14')]();});}};}function handleEntityNotFound(_0x47bafc){return function(_0x2f6629){if(!_0x2f6629){_0x47bafc[_0xde68('0x1f')](0x194);}return _0x2f6629;};}function handleError(_0x45a47b,_0x69add7){_0x69add7=_0x69add7||0x1f4;return function(_0x4dee34){logger[_0xde68('0x20')](_0x4dee34[_0xde68('0x21')]);if(_0x4dee34[_0xde68('0x22')]){delete _0x4dee34['name'];}_0x45a47b[_0xde68('0x13')](_0x69add7)[_0xde68('0x23')](_0x4dee34);};}exports['index']=function(_0xb0ad3d,_0x492fb2){var _0x279b75={};var _0x469cea=_[_0xde68('0x24')](db[_0xde68('0x25')][_0xde68('0x26')],function(_0x506779){return{'name':_0x506779[_0xde68('0x27')],'type':_0x506779[_0xde68('0x28')][_0xde68('0x29')]};});_0x279b75=qs[_0xde68('0x2a')](_0x469cea,_0xb0ad3d);return interaction[_0xde68('0x2b')](_0xde68('0x2c'),_0xb0ad3d[_0xde68('0x2d')],_0xb0ad3d['user'],_0x279b75,_0x469cea)[_0xde68('0x1d')](respondWithFilteredResult(_0x492fb2,_0x279b75))[_0xde68('0x2e')](handleError(_0x492fb2,null));};exports['show']=function(_0x5a5f19,_0x20277e){var _0x5cd3ae={'raw':![],'where':{'id':_0x5a5f19['params']['id']}},_0x454581={};_0x454581[_0xde68('0x2f')]=_[_0xde68('0x30')](db[_0xde68('0x25')][_0xde68('0x26')]);_0x454581[_0xde68('0x2d')]=_[_0xde68('0x30')](_0x5a5f19[_0xde68('0x2d')]);_0x454581['filters']=_[_0xde68('0x31')](_0x454581[_0xde68('0x2f')],_0x454581['query']);_0x5cd3ae[_0xde68('0x32')]=_[_0xde68('0x31')](_0x454581[_0xde68('0x2f')],qs['fields'](_0x5a5f19[_0xde68('0x2d')][_0xde68('0x33')]));_0x5cd3ae['attributes']=_0x5cd3ae['attributes']['length']?_0x5cd3ae[_0xde68('0x32')]:_0x454581[_0xde68('0x2f')];if(_0x5a5f19[_0xde68('0x2d')]['includeAll']){_0x5cd3ae[_0xde68('0x34')]=[{'all':!![]}];}_0x5cd3ae=_[_0xde68('0x35')]({},_0x5cd3ae,_0x5a5f19[_0xde68('0x36')]);return db['MailInteraction'][_0xde68('0x37')](_0x5cd3ae)[_0xde68('0x1d')](handleEntityNotFound(_0x20277e,null))['then'](respondWithResult(_0x20277e,null))[_0xde68('0x2e')](handleError(_0x20277e,null));};exports['create']=function(_0x4952e4,_0x17644a){return db['MailInteraction'][_0xde68('0x38')](_0x4952e4[_0xde68('0x39')],{})['then'](respondWithResult(_0x17644a,0xc9))[_0xde68('0x2e')](handleError(_0x17644a,null));};exports[_0xde68('0x1c')]=function(_0x15117f,_0x3eb4dd){if(_0x15117f['body']['id']){delete _0x15117f[_0xde68('0x39')]['id'];}return db[_0xde68('0x25')][_0xde68('0x37')]({'where':{'id':_0x15117f[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x3eb4dd,null))[_0xde68('0x1d')](saveUpdates(_0x15117f[_0xde68('0x39')],null))[_0xde68('0x1d')](respondWithResult(_0x3eb4dd,null))[_0xde68('0x2e')](handleError(_0x3eb4dd,null));};exports[_0xde68('0x1e')]=function(_0x181838,_0x4c5db0){return db['MailInteraction']['find']({'where':{'id':_0x181838[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x4c5db0,null))[_0xde68('0x1d')](removeEntity(_0x4c5db0,null))['catch'](handleError(_0x4c5db0,null));};exports['describe']=function(_0x129c41,_0x23349a){return db[_0xde68('0x25')]['describe']()[_0xde68('0x1d')](respondWithResult(_0x23349a,null))[_0xde68('0x2e')](handleError(_0x23349a,null));};exports[_0xde68('0x3b')]=function(_0x30b3ec,_0x32f4f9){return db[_0xde68('0x3c')][_0xde68('0x37')]({'where':{'id':_0x30b3ec[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x32f4f9,null))[_0xde68('0x1d')](function(_0x47a899){if(_0x47a899){return _0x47a899[_0xde68('0x3b')](_0x30b3ec[_0xde68('0x39')][_0xde68('0x3d')],_['omit'](_0x30b3ec[_0xde68('0x39')],[_0xde68('0x3d'),'id'])||{});}})[_0xde68('0x1d')](respondWithResult(_0x32f4f9,null))[_0xde68('0x2e')](handleError(_0x32f4f9,null));};exports[_0xde68('0x3e')]=function(_0xb6c7cc,_0x584973){var _0x199df9={'raw':![],'where':{}};var _0xf2cf75={};var _0x8a5a8d={'count':0x0,'rows':[]};return db[_0xde68('0x25')][_0xde68('0x3f')]({'where':{'id':_0xb6c7cc[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x584973,null))[_0xde68('0x1d')](function(_0x307515){if(_0x307515){_0xf2cf75['model']=_['keys'](db[_0xde68('0x3c')][_0xde68('0x26')]);_0xf2cf75[_0xde68('0x2d')]=_[_0xde68('0x30')](_0xb6c7cc['query']);_0xf2cf75[_0xde68('0x40')]=_[_0xde68('0x31')](_0xf2cf75[_0xde68('0x2f')],_0xf2cf75[_0xde68('0x2d')]);_0x199df9[_0xde68('0x32')]=_['intersection'](_0xf2cf75['model'],qs[_0xde68('0x33')](_0xb6c7cc[_0xde68('0x2d')]['fields']));_0x199df9[_0xde68('0x32')]=_0x199df9[_0xde68('0x32')][_0xde68('0x41')]?_0x199df9['attributes']:_0xf2cf75[_0xde68('0x2f')];if(!_0xb6c7cc['query']['hasOwnProperty']('nolimit')){_0x199df9[_0xde68('0x17')]=qs['limit'](_0xb6c7cc[_0xde68('0x2d')][_0xde68('0x17')]);_0x199df9[_0xde68('0x16')]=qs[_0xde68('0x16')](_0xb6c7cc[_0xde68('0x2d')]['offset']);}_0x199df9[_0xde68('0x42')]=qs[_0xde68('0x43')](_0xb6c7cc['query']['sort']);_0x199df9[_0xde68('0x44')]=qs[_0xde68('0x40')](_[_0xde68('0x45')](_0xb6c7cc[_0xde68('0x2d')],_0xf2cf75[_0xde68('0x40')]));_0x199df9[_0xde68('0x44')]['MailInteractionId']=_0x307515['id'];if(_0xb6c7cc[_0xde68('0x2d')]['filter']){_0x199df9[_0xde68('0x44')]=_['merge'](_0x199df9['where'],{'$or':_['map'](_0x199df9[_0xde68('0x32')],function(_0x44d103){var _0x4c1b6b={};_0x4c1b6b[_0x44d103]={'$like':'%'+_0xb6c7cc[_0xde68('0x2d')][_0xde68('0x46')]+'%'};return _0x4c1b6b;})});}if(_0xb6c7cc['query'][_0xde68('0x47')]){var _0x33c46c=_0xb6c7cc[_0xde68('0x2d')][_0xde68('0x47')]['split'](',');var _0x398290={};_0x398290[_0x33c46c[0x0]]={'$gte':moment(_0x33c46c[0x1])[_0xde68('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x199df9[_0xde68('0x44')]=_[_0xde68('0x35')](_0x199df9[_0xde68('0x44')],_0x398290);}_0x199df9=_[_0xde68('0x35')]({},_0x199df9,_0xb6c7cc['options']);return db[_0xde68('0x3c')][_0xde68('0x19')]({'where':_0x199df9[_0xde68('0x44')]})[_0xde68('0x1d')](function(_0x1c4041){_0x8a5a8d[_0xde68('0x19')]=_0x1c4041;if(_0xb6c7cc['query'][_0xde68('0x49')]){_0x199df9[_0xde68('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0xde68('0x2b')](_0x199df9);})[_0xde68('0x1d')](function(_0x48865c){if(_0xb6c7cc[_0xde68('0x2d')][_0xde68('0x4a')]===_0xde68('0x4b')){for(var _0x1656b7=0x0;_0x1656b7<_0x48865c[_0xde68('0x41')];_0x1656b7++){_0x48865c[_0x1656b7]['body']=juice(_0x48865c[_0x1656b7][_0xde68('0x39')]);}}_0x8a5a8d[_0xde68('0x4c')]=_0x48865c;return _0x8a5a8d;});}})['then'](respondWithFilteredResult(_0x584973,_0x199df9))['catch'](handleError(_0x584973,null));};exports[_0xde68('0x4d')]=function(_0x480f51,_0x14588e){return db[_0xde68('0x25')][_0xde68('0x37')]({'where':{'id':_0x480f51[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x14588e,null))['then'](function(_0x346ac6){if(_0x346ac6){return _0x346ac6[_0xde68('0x4e')](_0x480f51[_0xde68('0x39')][_0xde68('0x3d')],_[_0xde68('0x4f')](_0x480f51[_0xde68('0x39')],['ids','id'])||{})[_0xde68('0x50')](function(){return db['Tag'][_0xde68('0x2b')]({'attributes':['id',_0xde68('0x22'),'color'],'where':{'id':_0x480f51['body']['ids']}});})['then'](function(_0x417eff){socket[_0xde68('0x51')](_0xde68('0x52'),{'id':Number(_0x480f51[_0xde68('0x3a')]['id']),'tags':_0x417eff||[]});return{'id':Number(_0x480f51[_0xde68('0x3a')]['id']),'tags':_0x417eff||[]};});}})['then'](respondWithResult(_0x14588e,null))[_0xde68('0x2e')](handleError(_0x14588e,null));};exports['removeTags']=function(_0x2815c0,_0x4bb126){return db[_0xde68('0x25')]['find']({'where':{'id':_0x2815c0[_0xde68('0x3a')]['id']}})[_0xde68('0x1d')](handleEntityNotFound(_0x4bb126,null))[_0xde68('0x1d')](function(_0xf9fa18){if(_0xf9fa18){return _0xf9fa18['removeTags'](_0x2815c0[_0xde68('0x2d')][_0xde68('0x3d')]);}})[_0xde68('0x1d')](respondWithStatusCode(_0x4bb126,null))[_0xde68('0x2e')](handleError(_0x4bb126,null));};exports['download']=function(_0x3c8bf6,_0x219673){var _0x1b7724=moment()[_0xde68('0x53')]()[_0xde68('0x54')]();var _0x305e00=path[_0xde68('0x55')](config[_0xde68('0x56')],'server',_0xde68('0x57'),_0xde68('0x58'));var _0x18464b=path[_0xde68('0x55')](config[_0xde68('0x56')],_0xde68('0x59'),'files',_0xde68('0x5a'));var _0x227287=path[_0xde68('0x55')](_0x305e00,_0x1b7724);var _0x96cefb=util[_0xde68('0x48')]('transcript-%d-%s.zip',_0x3c8bf6[_0xde68('0x3a')]['id'],_0x1b7724);var _0x181842=path[_0xde68('0x55')](_0x305e00,_0x96cefb);var _0xd3ce59=[];if(_0x3c8bf6['query']['attachments']){_0xd3ce59['push']({'model':db[_0xde68('0x5b')],'as':_0xde68('0x5c'),'raw':!![]});}var _0x43387b=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0xde68('0x39'),_0xde68('0x5d'),'to','cc','bcc',_0xde68('0x5e'),_0xde68('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xd3ce59}];return db[_0xde68('0x25')]['find']({'where':{'id':_0x3c8bf6[_0xde68('0x3a')]['id']},'include':_0x43387b})['then'](handleEntityNotFound(_0x219673,null))['then'](function(_0x4451d6){if(_0x4451d6&&_0x4451d6[_0xde68('0x60')]){var _0x5de384=_0x4451d6[_0xde68('0x61')]({'plain':!![]});fs[_0xde68('0x62')](_0x227287);return BPromise['each'](_0x5de384[_0xde68('0x60')],function(_0x24dbf8,_0x272546){var _0x23be07={'from':_0x24dbf8['from'],'to':_0x24dbf8['to']||_0xde68('0x63'),'subject':_0x24dbf8['subject'],'html':htmlEntities['decode'](_0x24dbf8['body']),'headers':{'Date':moment(_0x24dbf8[_0xde68('0x5f')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x24dbf8['cc']){_0x23be07[_0xde68('0x64')]['Cc']=_0x24dbf8['cc'];}if(_0x24dbf8['bcc']){_0x23be07[_0xde68('0x64')][_0xde68('0x65')]=_0x24dbf8[_0xde68('0x66')];}return new BPromise(function(_0x39b9ec,_0x41d7dd){if(_0x24dbf8[_0xde68('0x5c')]){for(var _0x17d068=0x0;_0x17d068<_0x24dbf8[_0xde68('0x5c')][_0xde68('0x41')];_0x17d068++){var _0x2df8cd=_0x24dbf8['Attachments'][_0x17d068];var _0x76d5b3=path[_0xde68('0x55')](_0x18464b,_0x2df8cd['basename']);if(fs[_0xde68('0x67')](_0x76d5b3)){_0x23be07['attachments'][_0xde68('0x68')]({'name':_0x2df8cd[_0xde68('0x22')],'contentType':_0x2df8cd[_0xde68('0x28')],'data':fs[_0xde68('0x69')](_0x76d5b3)});}}}emlformat['build'](_0x23be07,function(_0x2448ed,_0xeef325){if(_0x2448ed)return _0x41d7dd(_0x2448ed);fs[_0xde68('0x6a')](path[_0xde68('0x55')](_0x227287,util[_0xde68('0x48')](_0xde68('0x6b'),_0x272546)),_0xeef325);return _0x39b9ec(_0xeef325);});});})[_0xde68('0x1d')](function(){return new BPromise(function(_0x533d0b,_0x3ce08b){zipdir(_0x227287,{'saveTo':_0x181842},function(_0x27c7dd,_0x1b6712){if(_0x27c7dd)return _0x3ce08b(_0x27c7dd);return _0x533d0b(_0x1b6712);});})[_0xde68('0x1d')](function(){return new BPromise(function(_0x4e6270,_0x4a9425){rimraf(_0x227287,function(_0x5a5bdf){if(_0x5a5bdf)_0x4a9425(_0x5a5bdf);return _0x4e6270();});});})[_0xde68('0x1d')](function(){return _0x219673[_0xde68('0x6c')](_0x181842,_0x96cefb,function(_0x46873b){if(!_0x46873b)fs[_0xde68('0x6d')](_0x181842);});});});}else{return _0x219673['sendStatus'](0xc8);}})[_0xde68('0x2e')](handleError(_0x219673,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f642f56..e618ad1 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 _0xefac=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','getUsers','then','Users','map','findAll'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xefac,0x156));var _0xcefa=function(_0x3e9b1e,_0x45f33a){_0x3e9b1e=_0x3e9b1e-0x0;var _0x2fd30b=_0xefac[_0x3e9b1e];return _0x2fd30b;};'use strict';var EventEmitter=require(_0xcefa('0x0'));var MailInteraction=require(_0xcefa('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xcefa('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcefa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcefa('0x3'),'afterDestroy':_0xcefa('0x4')};function emitEvent(_0x3b9a7a){return function(_0x813344,_0x5a9ed4,_0x25fc8){_0x813344[_0xcefa('0x5')]({'attributes':['id'],'raw':!![]})[_0xcefa('0x6')](function(_0x5d0f06){_0x813344['setDataValue'](_0xcefa('0x7'),_0x5d0f06[_0xcefa('0x8')](function(_0x4ad0c3){return{'id':_0x4ad0c3['id']};}));return MailMessage[_0xcefa('0x9')]({'where':{'MailInteractionId':_0x813344['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcefa('0x6')](function(_0x290b6e){_0x813344['setDataValue'](_0xcefa('0xa'),_0x290b6e[_0xcefa('0xb')]);MailInteractionEvents[_0xcefa('0xc')](_0x3b9a7a+':'+_0x813344['id'],_0x813344);MailInteractionEvents[_0xcefa('0xc')](_0x3b9a7a,_0x813344);_0x25fc8(null);})[_0xcefa('0xd')](_0x25fc8(null));};}for(var e in events){if(events[_0xcefa('0xe')](e)){var event=events[e];MailInteraction[_0xcefa('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x934a=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x934a,0x127));var _0xa934=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x934a[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0xa934('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xa934('0x1')];var MailMessage=require(_0xa934('0x2'))['db'][_0xa934('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa934('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa934('0x5'),'afterDestroy':_0xa934('0x6')};function emitEvent(_0x17abad){return function(_0x1acaaa,_0x4da881,_0x1c8b08){_0x1acaaa[_0xa934('0x7')]({'attributes':['id'],'raw':!![]})[_0xa934('0x8')](function(_0x519914){_0x1acaaa[_0xa934('0x9')]('Users',_0x519914[_0xa934('0xa')](function(_0x472501){return{'id':_0x472501['id']};}));return MailMessage[_0xa934('0xb')]({'where':{'MailInteractionId':_0x1acaaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa934('0x8')](function(_0x17372b){_0x1acaaa[_0xa934('0x9')](_0xa934('0xc'),_0x17372b[_0xa934('0xd')]);MailInteractionEvents[_0xa934('0xe')](_0x17abad+':'+_0x1acaaa['id'],_0x1acaaa);MailInteractionEvents[_0xa934('0xe')](_0x17abad,_0x1acaaa);_0x1c8b08(null);})[_0xa934('0xf')](_0x1c8b08(null));};}for(var e in events){if(events[_0xa934('0x10')](e)){var event=events[e];MailInteraction[_0xa934('0x11')](e,emitEvent(event));}}module[_0xa934('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f8e8f6c..a363358 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 _0xf55a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','substatusAt','substatus','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','closed'];(function(_0x1e1abe,_0x648e3b){var _0x1f2ae6=function(_0x311058){while(--_0x311058){_0x1e1abe['push'](_0x1e1abe['shift']());}};_0x1f2ae6(++_0x648e3b);}(_0xf55a,0x15c));var _0xaf55=function(_0x139ec0,_0x3e545c){_0x139ec0=_0x139ec0-0x0;var _0x44c78b=_0xf55a[_0x139ec0];return _0x44c78b;};'use strict';var _=require(_0xaf55('0x0'));var util=require(_0xaf55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaf55('0x2'));var BPromise=require(_0xaf55('0x3'));var rp=require(_0xaf55('0x4'));var fs=require('fs');var path=require(_0xaf55('0x5'));var rimraf=require(_0xaf55('0x6'));var config=require('../../config/environment');var attributes=require(_0xaf55('0x7'));module[_0xaf55('0x8')]=function(_0x305ea2,_0x2fa02f){return _0x305ea2[_0xaf55('0x9')](_0xaf55('0xa'),attributes,{'tableName':_0xaf55('0xb'),'paranoid':![],'indexes':[{'name':_0xaf55('0xc'),'fields':[_0xaf55('0xd'),'to'],'type':_0xaf55('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c7cea,_0x4ee9a4,_0x5ab2a5){if(_0x3c7cea['substatus']){_0x3c7cea['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3c7cea[_0xaf55('0xf')]){_0x3c7cea[_0xaf55('0x10')]=moment()[_0xaf55('0x11')](_0xaf55('0x12'));}_0x5ab2a5(null,_0x4ee9a4);},'beforeUpdate':function(_0x2b7d77,_0x5c04d0,_0x12e3fa){if(_0x2b7d77['changed']('substatus')){_0x2b7d77[_0xaf55('0x13')]=_0x2b7d77[_0xaf55('0x14')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2b7d77['changed']('closed')){_0x2b7d77[_0xaf55('0x10')]=moment()['format'](_0xaf55('0x12'));_0x2b7d77['substatus']=null;_0x2b7d77[_0xaf55('0x13')]=null;}_0x12e3fa(null,_0x2b7d77);},'afterUpdate':function(_0x2df002,_0x3db098,_0xc10503){var _0x2ff006=_0x305ea2[_0xaf55('0x15')];var _0x38198b=_0x2df002[_0xaf55('0x16')]({'plain':!![]});if(_0x38198b[_0xaf55('0xf')]){return _0x2ff006['MailMessage'][_0xaf55('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x38198b['id']}})[_0xaf55('0x18')](function(){_0xc10503();})[_0xaf55('0x19')](function(_0x5d42d0){_0xc10503(_0x5d42d0);});}else{_0xc10503();}}},'charset':_0xaf55('0x1a'),'collate':_0xaf55('0x1b')});}; \ No newline at end of file +var _0x2aa1=['MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x2aa1,0x1f3));var _0x12aa=function(_0x3740a4,_0x2dde55){_0x3740a4=_0x3740a4-0x0;var _0x46f26c=_0x2aa1[_0x3740a4];return _0x46f26c;};'use strict';var _=require(_0x12aa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12aa('0x1'));var moment=require(_0x12aa('0x2'));var BPromise=require(_0x12aa('0x3'));var rp=require(_0x12aa('0x4'));var fs=require('fs');var path=require(_0x12aa('0x5'));var rimraf=require('rimraf');var config=require(_0x12aa('0x6'));var attributes=require(_0x12aa('0x7'));module['exports']=function(_0x10581d,_0x407b59){return _0x10581d[_0x12aa('0x8')](_0x12aa('0x9'),attributes,{'tableName':_0x12aa('0xa'),'paranoid':![],'indexes':[{'name':_0x12aa('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f0bc8,_0x536f64,_0x2233d2){if(_0x5f0bc8[_0x12aa('0xc')]){_0x5f0bc8[_0x12aa('0xd')]=moment()[_0x12aa('0xe')](_0x12aa('0xf'));}if(_0x5f0bc8[_0x12aa('0x10')]){_0x5f0bc8[_0x12aa('0x11')]=moment()[_0x12aa('0xe')](_0x12aa('0xf'));}_0x2233d2(null,_0x536f64);},'beforeUpdate':function(_0x485888,_0xd882a0,_0x4f2762){if(_0x485888['changed'](_0x12aa('0xc'))){_0x485888[_0x12aa('0xd')]=_0x485888[_0x12aa('0xc')]?moment()['format'](_0x12aa('0xf')):null;}if(_0x485888[_0x12aa('0x12')](_0x12aa('0x10'))){_0x485888[_0x12aa('0x11')]=moment()[_0x12aa('0xe')](_0x12aa('0xf'));_0x485888[_0x12aa('0xc')]=null;_0x485888['substatusAt']=null;}_0x4f2762(null,_0x485888);},'afterUpdate':function(_0x370e6d,_0x5f503e,_0x11f5ad){var _0x2f166e=_0x10581d[_0x12aa('0x13')];var _0x48d716=_0x370e6d[_0x12aa('0x14')]({'plain':!![]});if(_0x48d716[_0x12aa('0x10')]){return _0x2f166e[_0x12aa('0x15')][_0x12aa('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x48d716['id']}})[_0x12aa('0x17')](function(){_0x11f5ad();})[_0x12aa('0x18')](function(_0xd59fa6){_0x11f5ad(_0xd59fa6);});}else{_0x11f5ad();}}},'charset':'utf8mb4','collate':_0x12aa('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0fdd06d..c192b24 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 _0x2fa9=['debug','catch','find','where','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','body','options','raw','attributes','limit'];(function(_0x2ca91d,_0x4e8413){var _0x4a5dde=function(_0x15af85){while(--_0x15af85){_0x2ca91d['push'](_0x2ca91d['shift']());}};_0x4a5dde(++_0x4e8413);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x375953,_0x57e5bc){_0x375953=_0x375953-0x0;var _0x11d4a5=_0x2fa9[_0x375953];return _0x11d4a5;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x92fa('0x2'));var fs=require('fs');var Redis=require(_0x92fa('0x3'));var db=require(_0x92fa('0x4'))['db'];var utils=require(_0x92fa('0x5'));var logger=require(_0x92fa('0x6'))(_0x92fa('0x7'));var config=require('../../config/environment');var jayson=require(_0x92fa('0x8'));var client=jayson['client'][_0x92fa('0x9')]({'port':0x232a});config['redis']=_[_0x92fa('0xa')](config[_0x92fa('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92fa('0xb')]));require(_0x92fa('0xc'))[_0x92fa('0xd')](socket);function respondWithRpcPromise(_0x16dab5,_0xf614f0,_0x32929e){return new BPromise(function(_0x28e4ef,_0x3f2b3d){return client['request'](_0x16dab5,_0x32929e)[_0x92fa('0xe')](function(_0x225db6){logger[_0x92fa('0xf')](_0x92fa('0x10'),_0xf614f0,'request\x20sent');logger['debug'](_0x92fa('0x11'),_0xf614f0,_0x92fa('0x12'),JSON[_0x92fa('0x13')](_0x225db6));if(_0x225db6['error']){if(_0x225db6[_0x92fa('0x14')][_0x92fa('0x15')]===0x1f4){logger[_0x92fa('0x14')](_0x92fa('0x10'),_0xf614f0,_0x225db6['error'][_0x92fa('0x16')]);return _0x3f2b3d(_0x225db6[_0x92fa('0x14')][_0x92fa('0x16')]);}logger['error'](_0x92fa('0x10'),_0xf614f0,_0x225db6[_0x92fa('0x14')][_0x92fa('0x16')]);return _0x28e4ef(_0x225db6[_0x92fa('0x14')]['message']);}else{logger[_0x92fa('0xf')](_0x92fa('0x10'),_0xf614f0,_0x92fa('0x12'));_0x28e4ef(_0x225db6[_0x92fa('0x17')]['message']);}})['catch'](function(_0x3fa803){logger[_0x92fa('0x14')](_0x92fa('0x10'),_0xf614f0,_0x3fa803);_0x3f2b3d(_0x3fa803);});});}exports[_0x92fa('0x18')]=function(_0x4f724e){var _0x3fa0ff=this;return new Promise(function(_0x3d4d58,_0x4cda98){return db[_0x92fa('0x19')]['update'](_0x4f724e[_0x92fa('0x1a')],{'raw':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e['options'][_0x92fa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e[_0x92fa('0x1b')]['where']||null:null,'attributes':_0x4f724e['options']?_0x4f724e[_0x92fa('0x1b')][_0x92fa('0x1d')]||null:null,'limit':_0x4f724e[_0x92fa('0x1b')]?_0x4f724e[_0x92fa('0x1b')][_0x92fa('0x1e')]||null:null})[_0x92fa('0xe')](function(_0x55ef63){logger['info']('UpdateMailInteraction',_0x4f724e);logger[_0x92fa('0x1f')](_0x92fa('0x18'),_0x4f724e,JSON[_0x92fa('0x13')](_0x55ef63));_0x3d4d58(_0x55ef63);})[_0x92fa('0x20')](function(_0x44c334){logger['error'](_0x92fa('0x18'),_0x44c334['message'],_0x4f724e);_0x4cda98(_0x3fa0ff['error'](0x1f4,_0x44c334[_0x92fa('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x186b64){return new Promise(function(_0x52e320,_0x47b327){return db[_0x92fa('0x19')][_0x92fa('0x21')]({'where':_0x186b64['options']?_0x186b64['options'][_0x92fa('0x22')]||null:null})[_0x92fa('0xe')](function(_0x4994ca){if(_0x4994ca){return _0x4994ca[_0x92fa('0x23')](_0x186b64[_0x92fa('0x1a')][_0x92fa('0x24')],_[_0x92fa('0x25')](_0x186b64['body'],[_0x92fa('0x24'),'id'])||{});}})[_0x92fa('0x26')](function(_0x36d663){logger['info']('AddTags',_0x186b64);logger['debug']('AddTags',_0x186b64,JSON[_0x92fa('0x13')](_0x36d663));_0x52e320(_0x36d663);})['catch'](function(_0x54e88d){logger[_0x92fa('0x14')](_0x92fa('0x27'),_0x54e88d['message'],_0x186b64);_0x47b327(_this[_0x92fa('0x14')](0x1f4,_0x54e88d[_0x92fa('0x16')]));});});}; \ No newline at end of file +var _0x46ed=['info','request\x20sent','stringify','code','error','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','debug','catch','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then'];(function(_0x4f84c3,_0x6d094d){var _0x460f9f=function(_0x5af5bd){while(--_0x5af5bd){_0x4f84c3['push'](_0x4f84c3['shift']());}};_0x460f9f(++_0x6d094d);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});config[_0xd46e('0xb')]=_[_0xd46e('0xc')](config[_0xd46e('0xb')],{'host':_0xd46e('0xd'),'port':0x18eb});var socket=require(_0xd46e('0xe'))(new Redis(config[_0xd46e('0xb')]));require(_0xd46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x7b2d69,_0x81235b,_0x50ccd3){return new BPromise(function(_0x3585e7,_0x15b5cb){return client[_0xd46e('0x10')](_0x7b2d69,_0x50ccd3)[_0xd46e('0x11')](function(_0x1ad723){logger[_0xd46e('0x12')]('MailInteraction,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'),JSON[_0xd46e('0x14')](_0x1ad723));if(_0x1ad723['error']){if(_0x1ad723['error'][_0xd46e('0x15')]===0x1f4){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x15b5cb(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x3585e7(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}else{logger[_0xd46e('0x12')]('MailInteraction,\x20%s,\x20%s',_0x81235b,'request\x20sent');_0x3585e7(_0x1ad723[_0xd46e('0x19')][_0xd46e('0x18')]);}})['catch'](function(_0x4fd1f2){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x4fd1f2);_0x15b5cb(_0x4fd1f2);});});}exports[_0xd46e('0x1a')]=function(_0x2273c5){var _0x409010=this;return new Promise(function(_0x312d6f,_0x3b5fa4){return db[_0xd46e('0x1b')][_0xd46e('0x1c')](_0x2273c5[_0xd46e('0x1d')],{'raw':_0x2273c5[_0xd46e('0x1e')]?_0x2273c5['options'][_0xd46e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2273c5[_0xd46e('0x1e')]?_0x2273c5[_0xd46e('0x1e')][_0xd46e('0x20')]||null:null,'attributes':_0x2273c5[_0xd46e('0x1e')]?_0x2273c5[_0xd46e('0x1e')][_0xd46e('0x21')]||null:null,'limit':_0x2273c5[_0xd46e('0x1e')]?_0x2273c5[_0xd46e('0x1e')]['limit']||null:null})[_0xd46e('0x11')](function(_0x5424e5){logger['info'](_0xd46e('0x1a'),_0x2273c5);logger[_0xd46e('0x22')](_0xd46e('0x1a'),_0x2273c5,JSON[_0xd46e('0x14')](_0x5424e5));_0x312d6f(_0x5424e5);})[_0xd46e('0x23')](function(_0x180851){logger[_0xd46e('0x16')]('UpdateMailInteraction',_0x180851[_0xd46e('0x18')],_0x2273c5);_0x3b5fa4(_0x409010[_0xd46e('0x16')](0x1f4,_0x180851[_0xd46e('0x18')]));});});};exports[_0xd46e('0x24')]=function(_0x96f15c){return new Promise(function(_0x16e941,_0x58aeef){return db[_0xd46e('0x1b')][_0xd46e('0x25')]({'where':_0x96f15c[_0xd46e('0x1e')]?_0x96f15c[_0xd46e('0x1e')][_0xd46e('0x20')]||null:null})[_0xd46e('0x11')](function(_0x147da3){if(_0x147da3){return _0x147da3[_0xd46e('0x26')](_0x96f15c[_0xd46e('0x1d')][_0xd46e('0x27')],_[_0xd46e('0x28')](_0x96f15c[_0xd46e('0x1d')],[_0xd46e('0x27'),'id'])||{});}})['spread'](function(_0x1248ce){logger[_0xd46e('0x12')](_0xd46e('0x29'),_0x96f15c);logger[_0xd46e('0x22')]('AddTags',_0x96f15c,JSON[_0xd46e('0x14')](_0x1248ce));_0x16e941(_0x1248ce);})[_0xd46e('0x23')](function(_0x5ab9df){logger[_0xd46e('0x16')](_0xd46e('0x29'),_0x5ab9df['message'],_0x96f15c);_0x58aeef(_this[_0xd46e('0x16')](0x1f4,_0x5ab9df[_0xd46e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6b42b57..9e283ca 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 _0x9aa1=['update','emit','register','length','./mailInteraction.events','save'];(function(_0x31a09b,_0x2f3a0c){var _0x4532e8=function(_0x20bfd0){while(--_0x20bfd0){_0x31a09b['push'](_0x31a09b['shift']());}};_0x4532e8(++_0x2f3a0c);}(_0x9aa1,0x184));var _0x19aa=function(_0x1e06a2,_0x5de447){_0x1e06a2=_0x1e06a2-0x0;var _0x6a0264=_0x9aa1[_0x1e06a2];return _0x6a0264;};'use strict';var MailInteractionEvents=require(_0x19aa('0x0'));var events=[_0x19aa('0x1'),'remove',_0x19aa('0x2')];function createListener(_0x4116c6,_0x30dbb9){return function(_0x4d6ff7){_0x30dbb9[_0x19aa('0x3')](_0x4116c6,_0x4d6ff7);};}function removeListener(_0x14dbb0,_0x374eb6){return function(){MailInteractionEvents['removeListener'](_0x14dbb0,_0x374eb6);};}exports[_0x19aa('0x4')]=function(_0x283f9a){for(var _0x85e040=0x0,_0x37fe3c=events[_0x19aa('0x5')];_0x85e040<_0x37fe3c;_0x85e040++){var _0x23afe8=events[_0x85e040];var _0x374516=createListener('mailInteraction:'+_0x23afe8,_0x283f9a);MailInteractionEvents['on'](_0x23afe8,_0x374516);}}; \ No newline at end of file +var _0x2032=['emit','removeListener','register','mailInteraction:','save','update'];(function(_0x2cfa3b,_0x6d798f){var _0x412fa0=function(_0x348c44){while(--_0x348c44){_0x2cfa3b['push'](_0x2cfa3b['shift']());}};_0x412fa0(++_0x6d798f);}(_0x2032,0x1d2));var _0x2203=function(_0x218f6e,_0x2b1c71){_0x218f6e=_0x218f6e-0x0;var _0x2e3ba0=_0x2032[_0x218f6e];return _0x2e3ba0;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x2203('0x0'),'remove',_0x2203('0x1')];function createListener(_0x2db486,_0xf02117){return function(_0x15f09d){_0xf02117[_0x2203('0x2')](_0x2db486,_0x15f09d);};}function removeListener(_0x49a648,_0x56c06f){return function(){MailInteractionEvents[_0x2203('0x3')](_0x49a648,_0x56c06f);};}exports[_0x2203('0x4')]=function(_0x24e5a8){for(var _0x1fa315=0x0,_0x302c31=events['length'];_0x1fa315<_0x302c31;_0x1fa315++){var _0xd8a5d5=events[_0x1fa315];var _0x174ce7=createListener(_0x2203('0x5')+_0xd8a5d5,_0x24e5a8);MailInteractionEvents['on'](_0xd8a5d5,_0x174ce7);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 739baf2..87a28f2 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fd4=['./mailInteractionHasTag.controller','get','/describe','isAuthenticated','describe','Router','../../components/auth/service'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x8fd4,0x178));var _0x48fd=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8fd4[_0x25d386];return _0x857f4a;};'use strict';var express=require('express');var router=express[_0x48fd('0x0')]();var auth=require(_0x48fd('0x1'));var controller=require(_0x48fd('0x2'));router[_0x48fd('0x3')](_0x48fd('0x4'),auth[_0x48fd('0x5')](),controller[_0x48fd('0x6')]);module['exports']=router; \ No newline at end of file +var _0xb7b6=['/describe','describe','exports','express','Router','get'];(function(_0x391805,_0x46063d){var _0x15849c=function(_0x3a2866){while(--_0x3a2866){_0x391805['push'](_0x391805['shift']());}};_0x15849c(++_0x46063d);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x4245c1,_0x42837e){_0x4245c1=_0x4245c1-0x0;var _0x15d4ff=_0xb7b6[_0x4245c1];return _0x15d4ff;};'use strict';var express=require(_0x6b7b('0x0'));var router=express[_0x6b7b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0x6b7b('0x2')](_0x6b7b('0x3'),auth['isAuthenticated'](),controller[_0x6b7b('0x4')]);module[_0x6b7b('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 6a5ee84..6c60c65 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x34befa,_0x340aa9){var _0x24e70a=function(_0x68a2c9){while(--_0x68a2c9){_0x34befa['push'](_0x34befa['shift']());}};_0x24e70a(++_0x340aa9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x402d84,_0x14567a){var _0x145074=function(_0x59eba3){while(--_0x59eba3){_0x402d84['push'](_0x402d84['shift']());}};_0x145074(++_0x14567a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 34327e1..45ee278 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f6d=['exports','INTEGER','sequelize'];(function(_0x3ded02,_0x4cd43b){var _0x113344=function(_0x53df68){while(--_0x53df68){_0x3ded02['push'](_0x3ded02['shift']());}};_0x113344(++_0x4cd43b);}(_0x7f6d,0xb0));var _0xd7f6=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x7f6d[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0xd7f6('0x0'));module[_0xd7f6('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd7f6('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x53d8=['exports','INTEGER','sequelize'];(function(_0x4499a3,_0x5dfeff){var _0xb88043=function(_0x38a4b2){while(--_0x38a4b2){_0x4499a3['push'](_0x4499a3['shift']());}};_0xb88043(++_0x5dfeff);}(_0x53d8,0xe3));var _0x853d=function(_0x380c35,_0x52a860){_0x380c35=_0x380c35-0x0;var _0x28fa9f=_0x53d8[_0x380c35];return _0x28fa9f;};'use strict';var Sequelize=require(_0x853d('0x0'));module[_0x853d('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x853d('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index aa08d68..8915ca1 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x507c=['mail_interaction_has_tags','exports','define'];(function(_0x566add,_0x399ac9){var _0x152057=function(_0x40afbf){while(--_0x40afbf){_0x566add['push'](_0x566add['shift']());}};_0x152057(++_0x399ac9);}(_0x507c,0x19f));var _0xc507=function(_0x29ce4e,_0x8b864f){_0x29ce4e=_0x29ce4e-0x0;var _0x2e89a7=_0x507c[_0x29ce4e];return _0x2e89a7;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xc507('0x0')]=function(_0x41ed76){return _0x41ed76[_0xc507('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0xc507('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb4f=['define','MailInteractionHasTag','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbb4f,0xaa));var _0xfbb4=function(_0x5cae4f,_0x11b6ee){_0x5cae4f=_0x5cae4f-0x0;var _0x27eec0=_0xbb4f[_0x5cae4f];return _0x27eec0;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xfbb4('0x0')]=function(_0x24926f){return _0x24926f[_0xfbb4('0x1')](_0xfbb4('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cd3245c..71f8d49 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 _0xe9ad=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe9ad,0x82));var _0xde9a=function(_0x4940a6,_0x448570){_0x4940a6=_0x4940a6-0x0;var _0x101ffe=_0xe9ad[_0x4940a6];return _0x101ffe;};'use strict';var multer=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var path=require(_0xde9a('0x2'));var timeout=require(_0xde9a('0x3'));var express=require(_0xde9a('0x4'));var router=express[_0xde9a('0x5')]();var fs_extra=require(_0xde9a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xde9a('0x7'));var config=require(_0xde9a('0x8'));var controller=require(_0xde9a('0x9'));router[_0xde9a('0xa')]('/',auth['isAuthenticated'](),controller[_0xde9a('0xb')]);router[_0xde9a('0xa')](_0xde9a('0xc'),auth['isAuthenticated'](),controller[_0xde9a('0xd')]);router[_0xde9a('0xa')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x10')]);router[_0xde9a('0xa')](_0xde9a('0x11'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x12')]);router['post']('/',auth[_0xde9a('0xf')](),interaction[_0xde9a('0x13')](_0xde9a('0x14'),_0xde9a('0x15')),controller[_0xde9a('0x16')]);router[_0xde9a('0x17')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x18')]);router['put'](_0xde9a('0x19'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1a')]);router[_0xde9a('0x17')](_0xde9a('0x1b'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1c')]);router[_0xde9a('0x1d')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1e')]);module[_0xde9a('0x1f')]=router; \ No newline at end of file +var _0xe39a=['show','/:id/download','download','post','tracked','put','/:id/accept','accept','/:id/reject','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4585eb,_0x5702b9){var _0x1fffc7=function(_0x568d2a){while(--_0x568d2a){_0x4585eb['push'](_0x4585eb['shift']());}};_0x1fffc7(++_0x5702b9);}(_0xe39a,0xb3));var _0xae39=function(_0x3c7702,_0xa89ed8){_0x3c7702=_0x3c7702-0x0;var _0x577472=_0xe39a[_0x3c7702];return _0x577472;};'use strict';var multer=require('multer');var util=require(_0xae39('0x0'));var path=require('path');var timeout=require(_0xae39('0x1'));var express=require(_0xae39('0x2'));var router=express[_0xae39('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xae39('0x4'));var interaction=require(_0xae39('0x5'));var config=require(_0xae39('0x6'));var controller=require('./mailMessage.controller');router[_0xae39('0x7')]('/',auth[_0xae39('0x8')](),controller[_0xae39('0x9')]);router[_0xae39('0x7')](_0xae39('0xa'),auth[_0xae39('0x8')](),controller[_0xae39('0xb')]);router[_0xae39('0x7')](_0xae39('0xc'),auth[_0xae39('0x8')](),controller[_0xae39('0xd')]);router[_0xae39('0x7')](_0xae39('0xe'),auth[_0xae39('0x8')](),controller[_0xae39('0xf')]);router[_0xae39('0x10')]('/',auth['isAuthenticated'](),interaction[_0xae39('0x11')]('mail','mailmessage:create'),controller['create']);router['put']('/:id',auth[_0xae39('0x8')](),controller['update']);router[_0xae39('0x12')](_0xae39('0x13'),auth[_0xae39('0x8')](),controller[_0xae39('0x14')]);router[_0xae39('0x12')](_0xae39('0x15'),auth[_0xae39('0x8')](),controller['reject']);router[_0xae39('0x16')](_0xae39('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xae39('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1a1d437..898d070 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 _0x4227=['long','DATE','INTEGER','ENUM','Email','sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x49da57,_0x4f7a76){var _0xc1f3d4=function(_0x2d24c2){while(--_0x2d24c2){_0x49da57['push'](_0x49da57['shift']());}};_0xc1f3d4(++_0x4f7a76);}(_0x4227,0x89));var _0x7422=function(_0x1451fd,_0x184482){_0x1451fd=_0x1451fd-0x0;var _0x1578a7=_0x4227[_0x1451fd];return _0x1578a7;};'use strict';var Sequelize=require(_0x7422('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x7422('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7422('0x1')](_0x7422('0x2'))},'read':{'type':Sequelize[_0x7422('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7422('0x4')),'defaultValue':_0x7422('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7422('0x5')](0x1fe)},'from':{'type':Sequelize[_0x7422('0x5')]},'to':{'type':Sequelize[_0x7422('0x1')](_0x7422('0x6'))},'cc':{'type':Sequelize[_0x7422('0x1')](_0x7422('0x6'))},'bcc':{'type':Sequelize[_0x7422('0x1')]('long')},'subject':{'type':Sequelize[_0x7422('0x1')]},'sentAt':{'type':Sequelize[_0x7422('0x7')]},'attach':{'type':Sequelize[_0x7422('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7422('0x7')]},'originTo':{'type':Sequelize['TEXT'](_0x7422('0x6'))},'originCc':{'type':Sequelize[_0x7422('0x1')](_0x7422('0x6'))},'originChannel':{'type':Sequelize[_0x7422('0x9')](_0x7422('0xa'),'Chat'),'defaultValue':_0x7422('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x11f3=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','long','medium','BOOLEAN','ENUM','STRING','TEXT'];(function(_0x296187,_0x66707b){var _0x4565d2=function(_0xb3f7cb){while(--_0xb3f7cb){_0x296187['push'](_0x296187['shift']());}};_0x4565d2(++_0x66707b);}(_0x11f3,0x149));var _0x311f=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x11f3[_0x3a8db5];return _0x2c03cd;};'use strict';var Sequelize=require(_0x311f('0x0'));var _=require(_0x311f('0x1'));module[_0x311f('0x2')]={'body':{'type':Sequelize['TEXT'](_0x311f('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x311f('0x4'))},'read':{'type':Sequelize[_0x311f('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x311f('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x311f('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x311f('0x8')](_0x311f('0x3'))},'cc':{'type':Sequelize[_0x311f('0x8')](_0x311f('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x311f('0x3'))},'subject':{'type':Sequelize[_0x311f('0x8')]},'sentAt':{'type':Sequelize[_0x311f('0x9')]},'attach':{'type':Sequelize[_0x311f('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x311f('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x311f('0x8')](_0x311f('0x3'))},'originCc':{'type':Sequelize[_0x311f('0x8')](_0x311f('0x3'))},'originChannel':{'type':Sequelize[_0x311f('0x6')](_0x311f('0xb'),_0x311f('0xc')),'defaultValue':_0x311f('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 81de727..3f12af8 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 _0xe2d8=['sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailMessage','includeAll','findAll','params','options','find','body','create','direction','out','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','read','readAt','format','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','reject','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','offset','undefined','count','limit','status','Content-Range','json','update','destroy'];(function(_0x1bdb4c,_0x526dbf){var _0x40bfe0=function(_0x3a512c){while(--_0x3a512c){_0x1bdb4c['push'](_0x1bdb4c['shift']());}};_0x40bfe0(++_0x526dbf);}(_0xe2d8,0x115));var _0x8e2d=function(_0x4ed2f1,_0x3623d1){_0x4ed2f1=_0x4ed2f1-0x0;var _0x2b45c1=_0xe2d8[_0x4ed2f1];return _0x2b45c1;};'use strict';var emlformat=require(_0x8e2d('0x0'));var moment=require(_0x8e2d('0x1'));var BPromise=require(_0x8e2d('0x2'));var util=require('util');var path=require(_0x8e2d('0x3'));var fs=require('fs');var _=require(_0x8e2d('0x4'));var Redis=require(_0x8e2d('0x5'));var htmlToText=require(_0x8e2d('0x6'));var qs=require(_0x8e2d('0x7'));var logger=require('../../config/logger')(_0x8e2d('0x8'));var interaction_log=require(_0x8e2d('0x9'))(_0x8e2d('0xa'));var config=require(_0x8e2d('0xb'));var db=require(_0x8e2d('0xc'))['db'];config[_0x8e2d('0xd')]=_[_0x8e2d('0xe')](config[_0x8e2d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e2d('0xf'))(new Redis(config[_0x8e2d('0xd')]));var htmlEntities=require('html-entities');require(_0x8e2d('0x10'))[_0x8e2d('0x11')](socket);var jayson=require(_0x8e2d('0x12'));var client=jayson[_0x8e2d('0x13')][_0x8e2d('0x14')]({'port':0x232c});var client9003=jayson['client'][_0x8e2d('0x14')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x289b75,_0x381c43,_0x4619c8,_0x2fa3ff){return new BPromise(function(_0x390487,_0x149c1a){var _0x2447ed=_0x2fa3ff||client;return _0x2447ed[_0x8e2d('0x15')](_0x289b75,_0x4619c8)[_0x8e2d('0x16')](function(_0x2757ae){logger[_0x8e2d('0x17')]('MailMessage,\x20%s,\x20%s',_0x381c43,_0x8e2d('0x18'));logger[_0x8e2d('0x19')](_0x8e2d('0x1a'),_0x381c43,'request\x20sent',JSON[_0x8e2d('0x1b')](_0x2757ae));if(_0x2757ae[_0x8e2d('0x1c')]){if(_0x2757ae[_0x8e2d('0x1c')][_0x8e2d('0x1d')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x381c43,_0x2757ae[_0x8e2d('0x1c')][_0x8e2d('0x1e')]);return _0x149c1a(_0x2757ae['error'][_0x8e2d('0x1e')]);}logger['error'](_0x8e2d('0x1f'),_0x381c43,_0x2757ae[_0x8e2d('0x1c')][_0x8e2d('0x1e')]);return _0x390487(_0x2757ae['error'][_0x8e2d('0x1e')]);}else{logger[_0x8e2d('0x17')](_0x8e2d('0x1f'),_0x381c43,'request\x20sent');_0x390487(_0x2757ae[_0x8e2d('0x20')][_0x8e2d('0x1e')]);}})[_0x8e2d('0x21')](function(_0x36dd50){logger[_0x8e2d('0x1c')](_0x8e2d('0x1f'),_0x381c43,_0x36dd50);_0x149c1a(_0x36dd50);});});}function respondWithResult(_0x922b2c,_0x564ce2){_0x564ce2=_0x564ce2||0xc8;return function(_0x12a239){if(_0x12a239){return _0x922b2c['status'](_0x564ce2)['json'](_0x12a239);}};}function respondWithFilteredResult(_0x43d88f,_0x9a060d){return function(_0xfc00fb){if(_0xfc00fb){var _0x3d6f15=typeof _0x9a060d[_0x8e2d('0x22')]===_0x8e2d('0x23')&&typeof _0x9a060d['limit']===_0x8e2d('0x23');var _0x382721=_0xfc00fb[_0x8e2d('0x24')];var _0x1c4263=_0x3d6f15?0x0:_0x9a060d[_0x8e2d('0x22')];var _0x3f5c22=_0x3d6f15?_0xfc00fb[_0x8e2d('0x24')]:_0x9a060d[_0x8e2d('0x22')]+_0x9a060d[_0x8e2d('0x25')];var _0x249275;if(_0x3f5c22>=_0x382721){_0x3f5c22=_0x382721;_0x249275=0xc8;}else{_0x249275=0xce;}_0x43d88f[_0x8e2d('0x26')](_0x249275);return _0x43d88f['set'](_0x8e2d('0x27'),_0x1c4263+'-'+_0x3f5c22+'/'+_0x382721)[_0x8e2d('0x28')](_0xfc00fb);}return null;};}function saveUpdates(_0x44a5e7){return function(_0x5affe7){if(_0x5affe7){return _0x5affe7[_0x8e2d('0x29')](_0x44a5e7)[_0x8e2d('0x16')](function(_0x4e4eea){return _0x4e4eea;});}return null;};}function removeEntity(_0x14d4e2){return function(_0x1bd64b){if(_0x1bd64b){return _0x1bd64b[_0x8e2d('0x2a')]()[_0x8e2d('0x16')](function(){_0x14d4e2[_0x8e2d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1456c3){return function(_0x459c51){if(!_0x459c51){_0x1456c3[_0x8e2d('0x2b')](0x194);}return _0x459c51;};}function handleError(_0x3f7356,_0x1e42f7){_0x1e42f7=_0x1e42f7||0x1f4;return function(_0x5878be){logger[_0x8e2d('0x1c')](_0x5878be[_0x8e2d('0x2c')]);if(_0x5878be[_0x8e2d('0x2d')]){delete _0x5878be[_0x8e2d('0x2d')];}_0x3f7356[_0x8e2d('0x26')](_0x1e42f7)[_0x8e2d('0x2e')](_0x5878be);};}exports['index']=function(_0x409686,_0x4a1a8a){var _0x19c1c1={},_0x8a8f8f={},_0xc40001={'count':0x0,'rows':[]};var _0x49888b=_[_0x8e2d('0x2f')](db['MailMessage'][_0x8e2d('0x30')],function(_0x216f59){return{'name':_0x216f59[_0x8e2d('0x31')],'type':_0x216f59[_0x8e2d('0x32')][_0x8e2d('0x33')]};});_0x8a8f8f[_0x8e2d('0x34')]=_[_0x8e2d('0x2f')](_0x49888b,_0x8e2d('0x2d'));_0x8a8f8f['query']=_[_0x8e2d('0x35')](_0x409686['query']);_0x8a8f8f[_0x8e2d('0x36')]=_[_0x8e2d('0x37')](_0x8a8f8f[_0x8e2d('0x34')],_0x8a8f8f[_0x8e2d('0x38')]);_0x19c1c1['attributes']=_[_0x8e2d('0x37')](_0x8a8f8f[_0x8e2d('0x34')],qs[_0x8e2d('0x39')](_0x409686[_0x8e2d('0x38')]['fields']));_0x19c1c1[_0x8e2d('0x3a')]=_0x19c1c1[_0x8e2d('0x3a')][_0x8e2d('0x3b')]?_0x19c1c1[_0x8e2d('0x3a')]:_0x8a8f8f[_0x8e2d('0x34')];if(!_0x409686[_0x8e2d('0x38')][_0x8e2d('0x3c')](_0x8e2d('0x3d'))){_0x19c1c1['limit']=qs[_0x8e2d('0x25')](_0x409686[_0x8e2d('0x38')][_0x8e2d('0x25')]);_0x19c1c1[_0x8e2d('0x22')]=qs[_0x8e2d('0x22')](_0x409686[_0x8e2d('0x38')]['offset']);}_0x19c1c1[_0x8e2d('0x3e')]=qs['sort'](_0x409686['query'][_0x8e2d('0x3f')]);_0x19c1c1[_0x8e2d('0x40')]=qs[_0x8e2d('0x36')](_[_0x8e2d('0x41')](_0x409686[_0x8e2d('0x38')],_0x8a8f8f['filters']),_0x49888b);if(_0x409686[_0x8e2d('0x38')][_0x8e2d('0x42')]){_0x19c1c1['where']=_[_0x8e2d('0x43')](_0x19c1c1[_0x8e2d('0x40')],{'$or':_[_0x8e2d('0x2f')](_0x49888b,function(_0x1f8ac0){if(_0x1f8ac0[_0x8e2d('0x32')]!==_0x8e2d('0x44')){var _0x5bbfed={};_0x5bbfed[_0x1f8ac0[_0x8e2d('0x2d')]]={'$like':'%'+_0x409686['query'][_0x8e2d('0x42')]+'%'};return _0x5bbfed;}})});}_0x19c1c1=_[_0x8e2d('0x43')]({},_0x19c1c1,_0x409686['options']);var _0xc0043d={'where':_0x19c1c1[_0x8e2d('0x40')]};return db[_0x8e2d('0x45')]['count'](_0xc0043d)[_0x8e2d('0x16')](function(_0xc8e2cc){_0xc40001[_0x8e2d('0x24')]=_0xc8e2cc;if(_0x409686[_0x8e2d('0x38')][_0x8e2d('0x46')]){_0x19c1c1['include']=[{'all':!![]}];}return db[_0x8e2d('0x45')][_0x8e2d('0x47')](_0x19c1c1);})[_0x8e2d('0x16')](function(_0x26402f){_0xc40001['rows']=_0x26402f;return _0xc40001;})[_0x8e2d('0x16')](respondWithFilteredResult(_0x4a1a8a,_0x19c1c1))['catch'](handleError(_0x4a1a8a,null));};exports['show']=function(_0x21f1e8,_0x5d97dc){var _0x32b32f={'raw':!![],'where':{'id':_0x21f1e8[_0x8e2d('0x48')]['id']}},_0x443dfe={};_0x443dfe[_0x8e2d('0x34')]=_[_0x8e2d('0x35')](db[_0x8e2d('0x45')][_0x8e2d('0x30')]);_0x443dfe[_0x8e2d('0x38')]=_[_0x8e2d('0x35')](_0x21f1e8['query']);_0x443dfe['filters']=_[_0x8e2d('0x37')](_0x443dfe[_0x8e2d('0x34')],_0x443dfe[_0x8e2d('0x38')]);_0x32b32f[_0x8e2d('0x3a')]=_[_0x8e2d('0x37')](_0x443dfe[_0x8e2d('0x34')],qs['fields'](_0x21f1e8[_0x8e2d('0x38')][_0x8e2d('0x39')]));_0x32b32f['attributes']=_0x32b32f[_0x8e2d('0x3a')][_0x8e2d('0x3b')]?_0x32b32f[_0x8e2d('0x3a')]:_0x443dfe[_0x8e2d('0x34')];if(_0x21f1e8[_0x8e2d('0x38')][_0x8e2d('0x46')]){_0x32b32f['include']=[{'all':!![]}];}_0x32b32f=_[_0x8e2d('0x43')]({},_0x32b32f,_0x21f1e8[_0x8e2d('0x49')]);return db[_0x8e2d('0x45')][_0x8e2d('0x4a')](_0x32b32f)[_0x8e2d('0x16')](handleEntityNotFound(_0x5d97dc,null))[_0x8e2d('0x16')](respondWithResult(_0x5d97dc,null))[_0x8e2d('0x21')](handleError(_0x5d97dc,null));};exports['update']=function(_0x1f654b,_0x37374d){if(_0x1f654b[_0x8e2d('0x4b')]['id']){delete _0x1f654b[_0x8e2d('0x4b')]['id'];}return db[_0x8e2d('0x45')][_0x8e2d('0x4a')]({'where':{'id':_0x1f654b[_0x8e2d('0x48')]['id']}})[_0x8e2d('0x16')](handleEntityNotFound(_0x37374d,null))[_0x8e2d('0x16')](saveUpdates(_0x1f654b[_0x8e2d('0x4b')],null))[_0x8e2d('0x16')](respondWithResult(_0x37374d,null))[_0x8e2d('0x21')](handleError(_0x37374d,null));};exports[_0x8e2d('0x2a')]=function(_0x4ceecd,_0x627613){return db[_0x8e2d('0x45')][_0x8e2d('0x4a')]({'where':{'id':_0x4ceecd['params']['id']}})[_0x8e2d('0x16')](handleEntityNotFound(_0x627613,null))[_0x8e2d('0x16')](removeEntity(_0x627613,null))['catch'](handleError(_0x627613,null));};exports['describe']=function(_0x5642d5,_0x7473a8){return db['MailMessage']['describe']()['then'](respondWithResult(_0x7473a8,null))[_0x8e2d('0x21')](handleError(_0x7473a8,null));};exports[_0x8e2d('0x4c')]=function(_0x35cb30,_0x236fd1){return db[_0x8e2d('0x45')][_0x8e2d('0x4c')](_0x35cb30['body'])[_0x8e2d('0x16')](function(_0x2faed9){if(_0x2faed9){if(_0x2faed9[_0x8e2d('0x4d')]===_0x8e2d('0x4e')&&!_0x2faed9['secret']){var _0xea09a6,_0x54a86c,_0x4ccaee;if(_0x35cb30['body']['to']){_0x54a86c=_0x35cb30[_0x8e2d('0x4b')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x8e2d('0x4f')]({'where':{'id':_0x2faed9[_0x8e2d('0x50')]},'include':[{'model':db[_0x8e2d('0x51')],'as':_0x8e2d('0x52'),'include':[{'model':db['CmContact'],'as':_0x8e2d('0x53'),'where':{'email':_0x54a86c},'limit':0x1,'order':[['updatedAt',_0x8e2d('0x54')]]}]},{'model':db[_0x8e2d('0x55')],'as':_0x8e2d('0x56'),'raw':!![],'include':[{'model':db[_0x8e2d('0x57')],'as':_0x8e2d('0x57'),'raw':!![]}]}]})[_0x8e2d('0x16')](function(_0x86c4a7){_0xea09a6=_0x86c4a7;if(!_0xea09a6||!_0xea09a6['Smtp'])return;var _0x33b563=_0xea09a6[_0x8e2d('0x58')]();if(_0x35cb30['body']['attachments']&&_0x35cb30[_0x8e2d('0x4b')]['attachments']['length']){for(var _0x376b3e=0x0;_0x376b3e<_0x35cb30[_0x8e2d('0x4b')][_0x8e2d('0x59')]['length'];_0x376b3e+=0x1){_0x35cb30['body'][_0x8e2d('0x59')][_0x376b3e]={'filename':_0x35cb30[_0x8e2d('0x4b')]['attachments'][_0x376b3e][_0x8e2d('0x2d')],'path':path[_0x8e2d('0x5a')](config[_0x8e2d('0x5b')],_0x8e2d('0x5c'),_0x35cb30[_0x8e2d('0x4b')][_0x8e2d('0x59')][_0x376b3e]['basename'])};}}_0x4ccaee={'account':_0x33b563,'message':_0x35cb30[_0x8e2d('0x4b')]};return;})[_0x8e2d('0x16')](function(){if(_0xea09a6[_0x8e2d('0x52')]){if(_0xea09a6[_0x8e2d('0x52')][_0x8e2d('0x53')][_0x8e2d('0x3b')]){return _0xea09a6['List'][_0x8e2d('0x53')][0x0];}else{return db['CmContact'][_0x8e2d('0x4c')](_[_0x8e2d('0xe')](_0x35cb30['body'],{'firstName':_0x35cb30[_0x8e2d('0x4b')]['to'],'email':_0x35cb30[_0x8e2d('0x4b')]['to'],'phone':_0x35cb30[_0x8e2d('0x4b')]['to'],'ListId':_0xea09a6['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x8e2d('0x16')](function(){if(_0x4ccaee){return respondWithRpcPromise('SendMail',_0x8e2d('0x5d'),_0x4ccaee,client9003)[_0x8e2d('0x16')](function(_0x425f9b){return _0x2faed9[_0x8e2d('0x29')]({'read':!![],'messageId':_0x425f9b[_0x8e2d('0x5e')],'sentAt':moment()['format'](_0x8e2d('0x5f'))});})[_0x8e2d('0x21')](function(_0x19df58){logger[_0x8e2d('0x1c')]('%s',JSON[_0x8e2d('0x1b')](_0x19df58));return _0x2faed9;});}return _0x2faed9;});}return _0x2faed9;}})[_0x8e2d('0x16')](respondWithResult(_0x236fd1,0xc9))['catch'](handleError(_0x236fd1,null));};exports['accept']=function(_0x382181,_0x1f413f){var _0x339d8d={'agent':{},'channel':'mail'};if(_0x382181[_0x8e2d('0x4b')]['id']){delete _0x382181['body']['id'];}_0x382181['body'][_0x8e2d('0x60')]=!![];_0x382181['body'][_0x8e2d('0x61')]=moment()[_0x8e2d('0x62')](_0x8e2d('0x5f'));_0x382181[_0x8e2d('0x4b')][_0x8e2d('0x63')]=_0x382181[_0x8e2d('0x4b')][_0x8e2d('0x63')]||_0x382181[_0x8e2d('0x64')]['id'];_0x339d8d[_0x8e2d('0x65')]['id']=_0x382181['body'][_0x8e2d('0x63')];return db[_0x8e2d('0x45')][_0x8e2d('0x4a')]({'where':{'id':_0x382181[_0x8e2d('0x48')]['id'],'UserId':null}})[_0x8e2d('0x16')](handleEntityNotFound(_0x1f413f,null))[_0x8e2d('0x16')](saveUpdates(_0x382181[_0x8e2d('0x4b')],null))[_0x8e2d('0x16')](function(_0x5d260d){if(_0x5d260d){_0x339d8d['message']=_0x5d260d[_0x8e2d('0x66')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5d260d[_0x8e2d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x1f413f,null))[_0x8e2d('0x16')](function(_0x2b8167){if(_0x2b8167){return _0x2b8167[_0x8e2d('0x29')]({'UserId':_0x382181[_0x8e2d('0x4b')][_0x8e2d('0x63')],'read1stAt':_[_0x8e2d('0x68')](_0x2b8167[_0x8e2d('0x69')])?moment()[_0x8e2d('0x62')](_0x8e2d('0x5f')):undefined});}return null;})[_0x8e2d('0x16')](function(_0x4f7595){if(_0x4f7595){_0x339d8d['interaction']=_0x4f7595[_0x8e2d('0x66')]({'plain':!![]});interaction_log[_0x8e2d('0x17')](_0x8e2d('0x6a'),_0x382181[_0x8e2d('0x64')]['id'],_0x382181[_0x8e2d('0x64')][_0x8e2d('0x2d')],_0x382181['user']['role'],_0x339d8d[_0x8e2d('0x6b')]['id'],_0x382181[_0x8e2d('0x4b')]?JSON[_0x8e2d('0x1b')](_0x382181[_0x8e2d('0x4b')]):_0x8e2d('0x6c'));return respondWithRpcPromise(_0x8e2d('0x6d'),_0x8e2d('0x6e'),_0x339d8d);}return null;})[_0x8e2d('0x16')](function(_0x412501){var _0x524731=_0x8e2d('0x6f')+_0x412501['message'][_0x8e2d('0x70')];return db[_0x8e2d('0x71')]['query'](_0x524731,{'type':db['Sequelize'][_0x8e2d('0x72')][_0x8e2d('0x73')],'raw':!![]})['then'](function(_0x16adf6){return _0x16adf6;});})[_0x8e2d('0x16')](function(_0x1c27f4){if(_0x1c27f4){_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x74')]=_0x1c27f4[0x0];if(!_0x382181['body'][_0x8e2d('0x63')])return;return db[_0x8e2d('0x75')]['find']({'where':{'id':_0x382181[_0x8e2d('0x4b')]['UserId'],'role':_0x8e2d('0x65')},'attributes':['id',_0x8e2d('0x2d'),_0x8e2d('0x76'),_0x8e2d('0x77'),_0x8e2d('0x78')],'raw':!![]});}return null;})['then'](function(_0x44e9fc){if(!_0x44e9fc)return null;_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x65')]=_0x44e9fc;return _0x339d8d;})[_0x8e2d('0x16')](function(_0x15f719){if(_0x15f719){if(_0x382181[_0x8e2d('0x4b')][_0x8e2d('0x79')]){_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x7a')]=util['format'](_0x8e2d('0x7b'),_0x382181[_0x8e2d('0x64')][_0x8e2d('0x2d')]);_0x339d8d['message'][_0x8e2d('0x7c')]=_0x339d8d[_0x8e2d('0x7c')];_0x339d8d['message'][_0x8e2d('0x7d')]=_0x339d8d[_0x8e2d('0x7c')];_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x7e')]='accept';_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x4b')]=htmlToText[_0x8e2d('0x7f')](_0x339d8d[_0x8e2d('0x1e')][_0x8e2d('0x4b')]);return respondWithRpcPromise(_0x8e2d('0x80'),_0x8e2d('0x80'),{'event':'acceptmessage','message':_0x339d8d['message']},client9002)[_0x8e2d('0x16')](function(){return _0x339d8d;});}return _0x339d8d;}return null;})[_0x8e2d('0x16')](respondWithResult(_0x1f413f,null))[_0x8e2d('0x21')](handleError(_0x1f413f,null));};exports['reject']=function(_0x3e1b77,_0x4cf89a){var _0x590c6d={'agent':{},'channel':_0x8e2d('0x81')};if(_0x3e1b77[_0x8e2d('0x4b')]['id']){delete _0x3e1b77[_0x8e2d('0x4b')]['id'];}_0x3e1b77[_0x8e2d('0x4b')][_0x8e2d('0x63')]=_0x3e1b77['body']['UserId']||_0x3e1b77[_0x8e2d('0x64')]['id'];_0x590c6d[_0x8e2d('0x65')]['id']=_0x3e1b77[_0x8e2d('0x4b')][_0x8e2d('0x63')];return db['MailMessage']['find']({'where':{'id':_0x3e1b77[_0x8e2d('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cf89a,null))[_0x8e2d('0x16')](function(_0x3b2c45){if(_0x3b2c45){_0x590c6d[_0x8e2d('0x1e')]=_0x3b2c45['get']({'plain':!![]});return db[_0x8e2d('0x82')]['find']({'where':{'id':_0x3b2c45[_0x8e2d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x4cf89a,null))[_0x8e2d('0x16')](function(_0x3e4896){if(_0x3e4896){_0x590c6d[_0x8e2d('0x6b')]=_0x3e4896['get']({'plain':!![]});interaction_log[_0x8e2d('0x17')](_0x8e2d('0x83'),_0x3e1b77[_0x8e2d('0x64')]['id'],_0x3e1b77[_0x8e2d('0x64')]['name'],_0x3e1b77[_0x8e2d('0x64')][_0x8e2d('0x84')],_0x590c6d[_0x8e2d('0x6b')]['id'],_0x3e1b77[_0x8e2d('0x4b')]?JSON[_0x8e2d('0x1b')](_0x3e1b77[_0x8e2d('0x4b')]):_0x8e2d('0x6c'));return respondWithRpcPromise(_0x8e2d('0x85'),_0x8e2d('0x86'),_0x590c6d);}return null;})[_0x8e2d('0x16')](function(_0x1a4832){var _0x47e4be='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1a4832[_0x8e2d('0x1e')][_0x8e2d('0x70')];return db[_0x8e2d('0x71')][_0x8e2d('0x38')](_0x47e4be,{'type':db[_0x8e2d('0x87')][_0x8e2d('0x72')][_0x8e2d('0x73')],'raw':!![]})[_0x8e2d('0x16')](function(_0x45dda0){return _0x45dda0;});})[_0x8e2d('0x16')](function(_0x23617a){if(_0x23617a){_0x590c6d[_0x8e2d('0x1e')][_0x8e2d('0x74')]=_0x23617a[0x0];if(!_0x3e1b77['body'][_0x8e2d('0x63')])return;return db[_0x8e2d('0x75')][_0x8e2d('0x4a')]({'where':{'id':_0x3e1b77[_0x8e2d('0x4b')][_0x8e2d('0x63')],'role':'agent'},'attributes':['id',_0x8e2d('0x2d'),_0x8e2d('0x76'),'email',_0x8e2d('0x78')],'raw':!![]});}return null;})['then'](function(_0x3e9746){if(!_0x3e9746)return null;_0x590c6d[_0x8e2d('0x1e')][_0x8e2d('0x65')]=_0x3e9746;return _0x590c6d;})[_0x8e2d('0x16')](function(_0xa5d3a2){if(_0xa5d3a2){_0xa5d3a2[_0x8e2d('0x1e')][_0x8e2d('0x7a')]=util['format'](_0x8e2d('0x7b'),_0x3e1b77['user'][_0x8e2d('0x2d')]);_0xa5d3a2[_0x8e2d('0x1e')][_0x8e2d('0x7c')]=_0x590c6d[_0x8e2d('0x7c')];_0xa5d3a2[_0x8e2d('0x1e')]['motionChannel']=_0x590c6d['channel'];_0xa5d3a2[_0x8e2d('0x1e')][_0x8e2d('0x7e')]=_0x8e2d('0x88');_0xa5d3a2[_0x8e2d('0x1e')][_0x8e2d('0x4b')]=htmlToText[_0x8e2d('0x7f')](_0x590c6d[_0x8e2d('0x1e')][_0x8e2d('0x4b')]);respondWithRpcPromise(_0x8e2d('0x80'),_0x8e2d('0x80'),{'event':_0x8e2d('0x89'),'message':_0xa5d3a2[_0x8e2d('0x1e')]},client9002);return _0x590c6d;}return null;})['then'](respondWithResult(_0x4cf89a,null))[_0x8e2d('0x21')](handleError(_0x4cf89a,null));};exports[_0x8e2d('0x8a')]=function(_0x2f8da5,_0x256f9a){var _0x8964c1=moment()[_0x8e2d('0x8b')]()[_0x8e2d('0x8c')]();var _0x2588b8=path[_0x8e2d('0x5a')](config[_0x8e2d('0x5b')],_0x8e2d('0x8d'),_0x8e2d('0x8e'),_0x8e2d('0x8f'));var _0x1e7db6=path[_0x8e2d('0x5a')](config[_0x8e2d('0x5b')],'server',_0x8e2d('0x8e'),'attachments');var _0x340950=util[_0x8e2d('0x62')](_0x8e2d('0x90'),_0x8964c1);return db[_0x8e2d('0x45')][_0x8e2d('0x4a')]({'where':{'id':_0x2f8da5['params']['id']},'attributes':['id','body',_0x8e2d('0x91'),'to','cc',_0x8e2d('0x92'),_0x8e2d('0x93'),_0x8e2d('0x94')],'include':_0x2f8da5[_0x8e2d('0x38')][_0x8e2d('0x59')]?[{'model':db['Attachment'],'as':_0x8e2d('0x95')}]:undefined})[_0x8e2d('0x16')](handleEntityNotFound(_0x256f9a,null))[_0x8e2d('0x16')](function(_0x736c10){if(_0x736c10){var _0x434da4=_0x736c10;var _0x220ad0={'from':_0x434da4['from'],'to':_0x434da4['to'],'subject':_0x434da4[_0x8e2d('0x93')],'html':htmlEntities[_0x8e2d('0x96')](_0x434da4[_0x8e2d('0x4b')]),'headers':{'Date':moment(_0x434da4[_0x8e2d('0x94')])[_0x8e2d('0x62')](_0x8e2d('0x97'))},'attachments':[]};if(_0x736c10['cc']){_0x220ad0[_0x8e2d('0x98')]['Cc']=_0x736c10['cc'];}if(_0x736c10[_0x8e2d('0x92')]){_0x220ad0[_0x8e2d('0x98')]['Bcc']=_0x736c10[_0x8e2d('0x92')];}return new BPromise(function(_0xed9607,_0xc80d40){if(_0x736c10[_0x8e2d('0x95')]){for(var _0x474c27=0x0;_0x474c27<_0x736c10['Attachments'][_0x8e2d('0x3b')];_0x474c27++){var _0x54e500=_0x736c10[_0x8e2d('0x95')][_0x474c27];var _0xd487f4=path[_0x8e2d('0x5a')](_0x1e7db6,_0x54e500[_0x8e2d('0x99')]);if(fs[_0x8e2d('0x9a')](_0xd487f4)){_0x220ad0[_0x8e2d('0x59')][_0x8e2d('0x9b')]({'name':_0x54e500[_0x8e2d('0x2d')],'contentType':_0x54e500['type'],'data':fs[_0x8e2d('0x9c')](_0xd487f4)});}}}emlformat[_0x8e2d('0x9d')](_0x220ad0,function(_0x5a560c,_0x3e430b){if(_0x5a560c)return _0xc80d40(_0x5a560c);fs[_0x8e2d('0x9e')](path[_0x8e2d('0x5a')](_0x2588b8,_0x340950),_0x3e430b);return _0xed9607(_0x3e430b);});});}})[_0x8e2d('0x16')](function(_0xbc5428){if(_0xbc5428){return _0x256f9a['download'](path[_0x8e2d('0x5a')](_0x2588b8,_0x340950),_0x340950,function(_0x26fe94){if(!_0x26fe94)fs[_0x8e2d('0x9f')](path[_0x8e2d('0x5a')](_0x2588b8,_0x340950));});}})['catch'](handleError(_0x256f9a,null));}; \ No newline at end of file +var _0x65cc=['acceptmessage','RejectMessage','rejectMessage','ContactId','SELECT','User','reject','fromString','rejectmessage','download','unix','toString','root','server','tmp','from','subject','Attachment','Attachments','decode','bcc','Bcc','basename','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','destroy','then','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','body','describe','create','direction','out','secret','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','user','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','info','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','agent','manual','interface','SIP/%s','motionChannel','channel','event','EventManager'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x65cc,0x1ed));var _0xc65c=function(_0x1dfbf0,_0x25aa11){_0x1dfbf0=_0x1dfbf0-0x0;var _0x248732=_0x65cc[_0x1dfbf0];return _0x248732;};'use strict';var emlformat=require(_0xc65c('0x0'));var moment=require(_0xc65c('0x1'));var BPromise=require(_0xc65c('0x2'));var util=require('util');var path=require(_0xc65c('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc65c('0x4'));var htmlToText=require(_0xc65c('0x5'));var qs=require(_0xc65c('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require('../../config/logger')(_0xc65c('0x7'));var config=require(_0xc65c('0x8'));var db=require('../../mysqldb')['db'];config[_0xc65c('0x9')]=_[_0xc65c('0xa')](config['redis'],{'host':_0xc65c('0xb'),'port':0x18eb});var socket=require(_0xc65c('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0xc65c('0xd'));require(_0xc65c('0xe'))[_0xc65c('0xf')](socket);var jayson=require(_0xc65c('0x10'));var client=jayson[_0xc65c('0x11')][_0xc65c('0x12')]({'port':0x232c});var client9003=jayson[_0xc65c('0x11')][_0xc65c('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc65c('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x42e914,_0x13250b,_0x4ccf63,_0xc48e76){return new BPromise(function(_0x1293e4,_0x48b217){var _0x32f67f=_0xc48e76||client;return _0x32f67f['request'](_0x42e914,_0x4ccf63)['then'](function(_0x54c0dd){logger['info'](_0xc65c('0x13'),_0x13250b,'request\x20sent');logger[_0xc65c('0x14')](_0xc65c('0x15'),_0x13250b,'request\x20sent',JSON[_0xc65c('0x16')](_0x54c0dd));if(_0x54c0dd[_0xc65c('0x17')]){if(_0x54c0dd[_0xc65c('0x17')][_0xc65c('0x18')]===0x1f4){logger[_0xc65c('0x17')](_0xc65c('0x13'),_0x13250b,_0x54c0dd['error'][_0xc65c('0x19')]);return _0x48b217(_0x54c0dd[_0xc65c('0x17')][_0xc65c('0x19')]);}logger[_0xc65c('0x17')](_0xc65c('0x13'),_0x13250b,_0x54c0dd[_0xc65c('0x17')][_0xc65c('0x19')]);return _0x1293e4(_0x54c0dd[_0xc65c('0x17')][_0xc65c('0x19')]);}else{logger['info'](_0xc65c('0x13'),_0x13250b,'request\x20sent');_0x1293e4(_0x54c0dd[_0xc65c('0x1a')][_0xc65c('0x19')]);}})['catch'](function(_0x593109){logger['error'](_0xc65c('0x13'),_0x13250b,_0x593109);_0x48b217(_0x593109);});});}function respondWithResult(_0x244638,_0x29c7fe){_0x29c7fe=_0x29c7fe||0xc8;return function(_0x4fe6cd){if(_0x4fe6cd){return _0x244638[_0xc65c('0x1b')](_0x29c7fe)[_0xc65c('0x1c')](_0x4fe6cd);}};}function respondWithFilteredResult(_0x4a96ed,_0x243156){return function(_0x39ef70){if(_0x39ef70){var _0x1530e6=typeof _0x243156[_0xc65c('0x1d')]===_0xc65c('0x1e')&&typeof _0x243156[_0xc65c('0x1f')]===_0xc65c('0x1e');var _0x66d3c1=_0x39ef70['count'];var _0x17c0fd=_0x1530e6?0x0:_0x243156[_0xc65c('0x1d')];var _0x2ab165=_0x1530e6?_0x39ef70[_0xc65c('0x20')]:_0x243156[_0xc65c('0x1d')]+_0x243156[_0xc65c('0x1f')];var _0x1d2773;if(_0x2ab165>=_0x66d3c1){_0x2ab165=_0x66d3c1;_0x1d2773=0xc8;}else{_0x1d2773=0xce;}_0x4a96ed[_0xc65c('0x1b')](_0x1d2773);return _0x4a96ed[_0xc65c('0x21')]('Content-Range',_0x17c0fd+'-'+_0x2ab165+'/'+_0x66d3c1)['json'](_0x39ef70);}return null;};}function saveUpdates(_0x3b6f79){return function(_0x1957dd){if(_0x1957dd){return _0x1957dd['update'](_0x3b6f79)['then'](function(_0x5116da){return _0x5116da;});}return null;};}function removeEntity(_0x3ef0d6){return function(_0xc9bd4a){if(_0xc9bd4a){return _0xc9bd4a[_0xc65c('0x22')]()[_0xc65c('0x23')](function(){_0x3ef0d6['status'](0xcc)[_0xc65c('0x24')]();});}};}function handleEntityNotFound(_0x469c56){return function(_0x16e9cc){if(!_0x16e9cc){_0x469c56[_0xc65c('0x25')](0x194);}return _0x16e9cc;};}function handleError(_0x411d00,_0x5de29e){_0x5de29e=_0x5de29e||0x1f4;return function(_0x427135){logger[_0xc65c('0x17')](_0x427135[_0xc65c('0x26')]);if(_0x427135['name']){delete _0x427135[_0xc65c('0x27')];}_0x411d00[_0xc65c('0x1b')](_0x5de29e)[_0xc65c('0x28')](_0x427135);};}exports[_0xc65c('0x29')]=function(_0x581aec,_0x3596f3){var _0x992ba4={},_0x25720f={},_0x2dd12a={'count':0x0,'rows':[]};var _0x52e573=_['map'](db[_0xc65c('0x2a')][_0xc65c('0x2b')],function(_0x54e610){return{'name':_0x54e610[_0xc65c('0x2c')],'type':_0x54e610['type']['key']};});_0x25720f['model']=_[_0xc65c('0x2d')](_0x52e573,_0xc65c('0x27'));_0x25720f[_0xc65c('0x2e')]=_[_0xc65c('0x2f')](_0x581aec['query']);_0x25720f[_0xc65c('0x30')]=_[_0xc65c('0x31')](_0x25720f[_0xc65c('0x32')],_0x25720f['query']);_0x992ba4[_0xc65c('0x33')]=_[_0xc65c('0x31')](_0x25720f[_0xc65c('0x32')],qs['fields'](_0x581aec[_0xc65c('0x2e')][_0xc65c('0x34')]));_0x992ba4[_0xc65c('0x33')]=_0x992ba4[_0xc65c('0x33')][_0xc65c('0x35')]?_0x992ba4[_0xc65c('0x33')]:_0x25720f[_0xc65c('0x32')];if(!_0x581aec[_0xc65c('0x2e')]['hasOwnProperty'](_0xc65c('0x36'))){_0x992ba4[_0xc65c('0x1f')]=qs['limit'](_0x581aec[_0xc65c('0x2e')]['limit']);_0x992ba4['offset']=qs[_0xc65c('0x1d')](_0x581aec[_0xc65c('0x2e')][_0xc65c('0x1d')]);}_0x992ba4[_0xc65c('0x37')]=qs[_0xc65c('0x38')](_0x581aec['query'][_0xc65c('0x38')]);_0x992ba4[_0xc65c('0x39')]=qs[_0xc65c('0x30')](_[_0xc65c('0x3a')](_0x581aec['query'],_0x25720f['filters']),_0x52e573);if(_0x581aec[_0xc65c('0x2e')][_0xc65c('0x3b')]){_0x992ba4[_0xc65c('0x39')]=_[_0xc65c('0x3c')](_0x992ba4[_0xc65c('0x39')],{'$or':_[_0xc65c('0x2d')](_0x52e573,function(_0x84ac2f){if(_0x84ac2f[_0xc65c('0x3d')]!==_0xc65c('0x3e')){var _0x33cc24={};_0x33cc24[_0x84ac2f[_0xc65c('0x27')]]={'$like':'%'+_0x581aec[_0xc65c('0x2e')][_0xc65c('0x3b')]+'%'};return _0x33cc24;}})});}_0x992ba4=_[_0xc65c('0x3c')]({},_0x992ba4,_0x581aec[_0xc65c('0x3f')]);var _0x54df09={'where':_0x992ba4[_0xc65c('0x39')]};return db[_0xc65c('0x2a')]['count'](_0x54df09)[_0xc65c('0x23')](function(_0x14e91f){_0x2dd12a[_0xc65c('0x20')]=_0x14e91f;if(_0x581aec[_0xc65c('0x2e')][_0xc65c('0x40')]){_0x992ba4[_0xc65c('0x41')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x992ba4);})[_0xc65c('0x23')](function(_0xbe9b71){_0x2dd12a[_0xc65c('0x42')]=_0xbe9b71;return _0x2dd12a;})[_0xc65c('0x23')](respondWithFilteredResult(_0x3596f3,_0x992ba4))[_0xc65c('0x43')](handleError(_0x3596f3,null));};exports['show']=function(_0x5f2830,_0x101cfc){var _0x403e02={'raw':!![],'where':{'id':_0x5f2830[_0xc65c('0x44')]['id']}},_0x10b23e={};_0x10b23e['model']=_[_0xc65c('0x2f')](db[_0xc65c('0x2a')][_0xc65c('0x2b')]);_0x10b23e[_0xc65c('0x2e')]=_[_0xc65c('0x2f')](_0x5f2830['query']);_0x10b23e['filters']=_[_0xc65c('0x31')](_0x10b23e[_0xc65c('0x32')],_0x10b23e['query']);_0x403e02[_0xc65c('0x33')]=_['intersection'](_0x10b23e['model'],qs[_0xc65c('0x34')](_0x5f2830[_0xc65c('0x2e')][_0xc65c('0x34')]));_0x403e02['attributes']=_0x403e02['attributes'][_0xc65c('0x35')]?_0x403e02[_0xc65c('0x33')]:_0x10b23e[_0xc65c('0x32')];if(_0x5f2830[_0xc65c('0x2e')][_0xc65c('0x40')]){_0x403e02[_0xc65c('0x41')]=[{'all':!![]}];}_0x403e02=_[_0xc65c('0x3c')]({},_0x403e02,_0x5f2830['options']);return db[_0xc65c('0x2a')]['find'](_0x403e02)[_0xc65c('0x23')](handleEntityNotFound(_0x101cfc,null))[_0xc65c('0x23')](respondWithResult(_0x101cfc,null))['catch'](handleError(_0x101cfc,null));};exports['update']=function(_0x3749ff,_0x1cea7d){if(_0x3749ff['body']['id']){delete _0x3749ff['body']['id'];}return db[_0xc65c('0x2a')][_0xc65c('0x45')]({'where':{'id':_0x3749ff[_0xc65c('0x44')]['id']}})[_0xc65c('0x23')](handleEntityNotFound(_0x1cea7d,null))['then'](saveUpdates(_0x3749ff[_0xc65c('0x46')],null))['then'](respondWithResult(_0x1cea7d,null))[_0xc65c('0x43')](handleError(_0x1cea7d,null));};exports[_0xc65c('0x22')]=function(_0x595a35,_0x3d64cb){return db['MailMessage']['find']({'where':{'id':_0x595a35[_0xc65c('0x44')]['id']}})[_0xc65c('0x23')](handleEntityNotFound(_0x3d64cb,null))[_0xc65c('0x23')](removeEntity(_0x3d64cb,null))[_0xc65c('0x43')](handleError(_0x3d64cb,null));};exports[_0xc65c('0x47')]=function(_0x3350f8,_0xcf5c87){return db[_0xc65c('0x2a')][_0xc65c('0x47')]()[_0xc65c('0x23')](respondWithResult(_0xcf5c87,null))['catch'](handleError(_0xcf5c87,null));};exports[_0xc65c('0x48')]=function(_0x1e546d,_0x430414){return db[_0xc65c('0x2a')][_0xc65c('0x48')](_0x1e546d[_0xc65c('0x46')])[_0xc65c('0x23')](function(_0x5052cb){if(_0x5052cb){if(_0x5052cb[_0xc65c('0x49')]===_0xc65c('0x4a')&&!_0x5052cb[_0xc65c('0x4b')]){var _0x25660e,_0x18dd13,_0x4cd312;if(_0x1e546d['body']['to']){_0x18dd13=_0x1e546d[_0xc65c('0x46')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x5052cb['MailAccountId']},'include':[{'model':db[_0xc65c('0x4c')],'as':_0xc65c('0x4d'),'include':[{'model':db[_0xc65c('0x4e')],'as':'Contacts','where':{'email':_0x18dd13},'limit':0x1,'order':[[_0xc65c('0x4f'),'DESC']]}]},{'model':db[_0xc65c('0x50')],'as':_0xc65c('0x51'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc65c('0x52'),'raw':!![]}]}]})[_0xc65c('0x23')](function(_0x2afef9){_0x25660e=_0x2afef9;if(!_0x25660e||!_0x25660e[_0xc65c('0x51')])return;var _0x7052f5=_0x25660e[_0xc65c('0x53')]();if(_0x1e546d[_0xc65c('0x46')][_0xc65c('0x54')]&&_0x1e546d[_0xc65c('0x46')][_0xc65c('0x54')]['length']){for(var _0x9a7079=0x0;_0x9a7079<_0x1e546d['body']['attachments'][_0xc65c('0x35')];_0x9a7079+=0x1){_0x1e546d['body'][_0xc65c('0x54')][_0x9a7079]={'filename':_0x1e546d['body']['attachments'][_0x9a7079][_0xc65c('0x27')],'path':path[_0xc65c('0x55')](config['root'],_0xc65c('0x56'),_0x1e546d[_0xc65c('0x46')][_0xc65c('0x54')][_0x9a7079]['basename'])};}}_0x4cd312={'account':_0x7052f5,'message':_0x1e546d[_0xc65c('0x46')]};return;})[_0xc65c('0x23')](function(){if(_0x25660e['List']){if(_0x25660e[_0xc65c('0x4d')][_0xc65c('0x57')][_0xc65c('0x35')]){return _0x25660e[_0xc65c('0x4d')]['Contacts'][0x0];}else{return db[_0xc65c('0x4e')]['create'](_[_0xc65c('0xa')](_0x1e546d['body'],{'firstName':_0x1e546d[_0xc65c('0x46')]['to'],'email':_0x1e546d[_0xc65c('0x46')]['to'],'phone':_0x1e546d[_0xc65c('0x46')]['to'],'ListId':_0x25660e[_0xc65c('0x58')]}));}}else{throw new Error(_0xc65c('0x59'));}})[_0xc65c('0x23')](function(){if(_0x4cd312){return respondWithRpcPromise(_0xc65c('0x5a'),_0xc65c('0x5b'),_0x4cd312,client9003)[_0xc65c('0x23')](function(_0x36b725){return _0x5052cb['update']({'read':!![],'messageId':_0x36b725[_0xc65c('0x5c')],'sentAt':moment()['format'](_0xc65c('0x5d'))});})[_0xc65c('0x43')](function(_0x374a09){logger[_0xc65c('0x17')]('%s',JSON['stringify'](_0x374a09));return _0x5052cb;});}return _0x5052cb;});}return _0x5052cb;}})[_0xc65c('0x23')](respondWithResult(_0x430414,0xc9))[_0xc65c('0x43')](handleError(_0x430414,null));};exports[_0xc65c('0x5e')]=function(_0x86c6d3,_0x47add4){var _0x1997a9={'agent':{},'channel':_0xc65c('0x5f')};if(_0x86c6d3[_0xc65c('0x46')]['id']){delete _0x86c6d3[_0xc65c('0x46')]['id'];}_0x86c6d3['body'][_0xc65c('0x60')]=!![];_0x86c6d3[_0xc65c('0x46')][_0xc65c('0x61')]=moment()[_0xc65c('0x62')](_0xc65c('0x5d'));_0x86c6d3['body']['UserId']=_0x86c6d3[_0xc65c('0x46')][_0xc65c('0x63')]||_0x86c6d3[_0xc65c('0x64')]['id'];_0x1997a9['agent']['id']=_0x86c6d3[_0xc65c('0x46')][_0xc65c('0x63')];return db['MailMessage'][_0xc65c('0x45')]({'where':{'id':_0x86c6d3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x47add4,null))['then'](saveUpdates(_0x86c6d3[_0xc65c('0x46')],null))[_0xc65c('0x23')](function(_0xa03baf){if(_0xa03baf){_0x1997a9[_0xc65c('0x19')]=_0xa03baf['get']({'plain':!![]});return db[_0xc65c('0x65')]['find']({'where':{'id':_0xa03baf[_0xc65c('0x66')]}});}return null;})[_0xc65c('0x23')](handleEntityNotFound(_0x47add4,null))[_0xc65c('0x23')](function(_0xeeefb7){if(_0xeeefb7){return _0xeeefb7['update']({'UserId':_0x86c6d3[_0xc65c('0x46')][_0xc65c('0x63')],'read1stAt':_[_0xc65c('0x67')](_0xeeefb7[_0xc65c('0x68')])?moment()[_0xc65c('0x62')](_0xc65c('0x5d')):undefined});}return null;})[_0xc65c('0x23')](function(_0x209c48){if(_0x209c48){_0x1997a9[_0xc65c('0x69')]=_0x209c48[_0xc65c('0x6a')]({'plain':!![]});interaction_log[_0xc65c('0x6b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x86c6d3['user']['id'],_0x86c6d3['user'][_0xc65c('0x27')],_0x86c6d3[_0xc65c('0x64')][_0xc65c('0x6c')],_0x1997a9[_0xc65c('0x69')]['id'],_0x86c6d3['body']?JSON[_0xc65c('0x16')](_0x86c6d3[_0xc65c('0x46')]):_0xc65c('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xc65c('0x6e'),_0x1997a9);}return null;})['then'](function(_0x4a50b0){var _0x18137a=_0xc65c('0x6f')+_0x4a50b0[_0xc65c('0x19')]['ContactId'];return db[_0xc65c('0x70')][_0xc65c('0x2e')](_0x18137a,{'type':db[_0xc65c('0x71')][_0xc65c('0x72')]['SELECT'],'raw':!![]})[_0xc65c('0x23')](function(_0x5d8600){return _0x5d8600;});})[_0xc65c('0x23')](function(_0x5e0f7e){if(_0x5e0f7e){_0x1997a9[_0xc65c('0x19')][_0xc65c('0x73')]=_0x5e0f7e[0x0];if(!_0x86c6d3['body'][_0xc65c('0x63')])return;return db['User'][_0xc65c('0x45')]({'where':{'id':_0x86c6d3[_0xc65c('0x46')][_0xc65c('0x63')],'role':'agent'},'attributes':['id','name',_0xc65c('0x74'),_0xc65c('0x75'),_0xc65c('0x76')],'raw':!![]});}return null;})[_0xc65c('0x23')](function(_0x4c46af){if(!_0x4c46af)return null;_0x1997a9['message'][_0xc65c('0x77')]=_0x4c46af;return _0x1997a9;})[_0xc65c('0x23')](function(_0x45dd8f){if(_0x45dd8f){if(_0x86c6d3['body'][_0xc65c('0x78')]){_0x1997a9[_0xc65c('0x19')][_0xc65c('0x79')]=util[_0xc65c('0x62')](_0xc65c('0x7a'),_0x86c6d3[_0xc65c('0x64')][_0xc65c('0x27')]);_0x1997a9[_0xc65c('0x19')]['channel']=_0x1997a9['channel'];_0x1997a9[_0xc65c('0x19')][_0xc65c('0x7b')]=_0x1997a9[_0xc65c('0x7c')];_0x1997a9[_0xc65c('0x19')][_0xc65c('0x7d')]=_0xc65c('0x5e');_0x1997a9[_0xc65c('0x19')][_0xc65c('0x46')]=htmlToText['fromString'](_0x1997a9[_0xc65c('0x19')][_0xc65c('0x46')]);return respondWithRpcPromise(_0xc65c('0x7e'),_0xc65c('0x7e'),{'event':_0xc65c('0x7f'),'message':_0x1997a9[_0xc65c('0x19')]},client9002)[_0xc65c('0x23')](function(){return _0x1997a9;});}return _0x1997a9;}return null;})[_0xc65c('0x23')](respondWithResult(_0x47add4,null))['catch'](handleError(_0x47add4,null));};exports['reject']=function(_0x4e3290,_0x56547f){var _0x1b2776={'agent':{},'channel':_0xc65c('0x5f')};if(_0x4e3290[_0xc65c('0x46')]['id']){delete _0x4e3290['body']['id'];}_0x4e3290[_0xc65c('0x46')]['UserId']=_0x4e3290[_0xc65c('0x46')][_0xc65c('0x63')]||_0x4e3290[_0xc65c('0x64')]['id'];_0x1b2776['agent']['id']=_0x4e3290['body'][_0xc65c('0x63')];return db[_0xc65c('0x2a')][_0xc65c('0x45')]({'where':{'id':_0x4e3290['params']['id'],'UserId':null}})[_0xc65c('0x23')](handleEntityNotFound(_0x56547f,null))[_0xc65c('0x23')](function(_0x1ac1ec){if(_0x1ac1ec){_0x1b2776[_0xc65c('0x19')]=_0x1ac1ec[_0xc65c('0x6a')]({'plain':!![]});return db[_0xc65c('0x65')][_0xc65c('0x45')]({'where':{'id':_0x1ac1ec[_0xc65c('0x66')]}});}return null;})[_0xc65c('0x23')](handleEntityNotFound(_0x56547f,null))[_0xc65c('0x23')](function(_0x2531af){if(_0x2531af){_0x1b2776[_0xc65c('0x69')]=_0x2531af[_0xc65c('0x6a')]({'plain':!![]});interaction_log[_0xc65c('0x6b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e3290[_0xc65c('0x64')]['id'],_0x4e3290[_0xc65c('0x64')][_0xc65c('0x27')],_0x4e3290[_0xc65c('0x64')][_0xc65c('0x6c')],_0x1b2776[_0xc65c('0x69')]['id'],_0x4e3290[_0xc65c('0x46')]?JSON['stringify'](_0x4e3290[_0xc65c('0x46')]):_0xc65c('0x6d'));return respondWithRpcPromise(_0xc65c('0x80'),_0xc65c('0x81'),_0x1b2776);}return null;})[_0xc65c('0x23')](function(_0x97885){var _0x3d0a81=_0xc65c('0x6f')+_0x97885[_0xc65c('0x19')][_0xc65c('0x82')];return db[_0xc65c('0x70')][_0xc65c('0x2e')](_0x3d0a81,{'type':db['Sequelize']['QueryTypes'][_0xc65c('0x83')],'raw':!![]})[_0xc65c('0x23')](function(_0x3f935f){return _0x3f935f;});})[_0xc65c('0x23')](function(_0x13da42){if(_0x13da42){_0x1b2776[_0xc65c('0x19')][_0xc65c('0x73')]=_0x13da42[0x0];if(!_0x4e3290[_0xc65c('0x46')][_0xc65c('0x63')])return;return db[_0xc65c('0x84')][_0xc65c('0x45')]({'where':{'id':_0x4e3290[_0xc65c('0x46')][_0xc65c('0x63')],'role':_0xc65c('0x77')},'attributes':['id',_0xc65c('0x27'),'fullname','email',_0xc65c('0x76')],'raw':!![]});}return null;})[_0xc65c('0x23')](function(_0x2de94c){if(!_0x2de94c)return null;_0x1b2776[_0xc65c('0x19')][_0xc65c('0x77')]=_0x2de94c;return _0x1b2776;})[_0xc65c('0x23')](function(_0x45c3d5){if(_0x45c3d5){_0x45c3d5[_0xc65c('0x19')][_0xc65c('0x79')]=util[_0xc65c('0x62')](_0xc65c('0x7a'),_0x4e3290[_0xc65c('0x64')][_0xc65c('0x27')]);_0x45c3d5[_0xc65c('0x19')]['channel']=_0x1b2776[_0xc65c('0x7c')];_0x45c3d5['message'][_0xc65c('0x7b')]=_0x1b2776[_0xc65c('0x7c')];_0x45c3d5[_0xc65c('0x19')][_0xc65c('0x7d')]=_0xc65c('0x85');_0x45c3d5[_0xc65c('0x19')][_0xc65c('0x46')]=htmlToText[_0xc65c('0x86')](_0x1b2776[_0xc65c('0x19')][_0xc65c('0x46')]);respondWithRpcPromise(_0xc65c('0x7e'),'EventManager',{'event':_0xc65c('0x87'),'message':_0x45c3d5[_0xc65c('0x19')]},client9002);return _0x1b2776;}return null;})['then'](respondWithResult(_0x56547f,null))[_0xc65c('0x43')](handleError(_0x56547f,null));};exports[_0xc65c('0x88')]=function(_0x5b7ca3,_0x5942d1){var _0x12739a=moment()[_0xc65c('0x89')]()[_0xc65c('0x8a')]();var _0x5ba0ae=path[_0xc65c('0x55')](config[_0xc65c('0x8b')],_0xc65c('0x8c'),'files',_0xc65c('0x8d'));var _0x2f7d49=path[_0xc65c('0x55')](config[_0xc65c('0x8b')],_0xc65c('0x8c'),'files',_0xc65c('0x54'));var _0x3d0060=util[_0xc65c('0x62')]('message-%s.eml',_0x12739a);return db[_0xc65c('0x2a')][_0xc65c('0x45')]({'where':{'id':_0x5b7ca3[_0xc65c('0x44')]['id']},'attributes':['id','body',_0xc65c('0x8e'),'to','cc','bcc',_0xc65c('0x8f'),'createdAt'],'include':_0x5b7ca3[_0xc65c('0x2e')][_0xc65c('0x54')]?[{'model':db[_0xc65c('0x90')],'as':_0xc65c('0x91')}]:undefined})[_0xc65c('0x23')](handleEntityNotFound(_0x5942d1,null))['then'](function(_0x3a9441){if(_0x3a9441){var _0x2d2b26=_0x3a9441;var _0x3ff1b1={'from':_0x2d2b26[_0xc65c('0x8e')],'to':_0x2d2b26['to'],'subject':_0x2d2b26['subject'],'html':htmlEntities[_0xc65c('0x92')](_0x2d2b26[_0xc65c('0x46')]),'headers':{'Date':moment(_0x2d2b26['createdAt'])[_0xc65c('0x62')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3a9441['cc']){_0x3ff1b1['headers']['Cc']=_0x3a9441['cc'];}if(_0x3a9441[_0xc65c('0x93')]){_0x3ff1b1['headers'][_0xc65c('0x94')]=_0x3a9441[_0xc65c('0x93')];}return new BPromise(function(_0x247b32,_0x268789){if(_0x3a9441[_0xc65c('0x91')]){for(var _0x1d7dbf=0x0;_0x1d7dbf<_0x3a9441[_0xc65c('0x91')]['length'];_0x1d7dbf++){var _0x34ec28=_0x3a9441[_0xc65c('0x91')][_0x1d7dbf];var _0x54f14d=path[_0xc65c('0x55')](_0x2f7d49,_0x34ec28[_0xc65c('0x95')]);if(fs['existsSync'](_0x54f14d)){_0x3ff1b1[_0xc65c('0x54')][_0xc65c('0x96')]({'name':_0x34ec28[_0xc65c('0x27')],'contentType':_0x34ec28[_0xc65c('0x3d')],'data':fs[_0xc65c('0x97')](_0x54f14d)});}}}emlformat[_0xc65c('0x98')](_0x3ff1b1,function(_0x228b44,_0x31b66a){if(_0x228b44)return _0x268789(_0x228b44);fs[_0xc65c('0x99')](path[_0xc65c('0x55')](_0x5ba0ae,_0x3d0060),_0x31b66a);return _0x247b32(_0x31b66a);});});}})['then'](function(_0x355db8){if(_0x355db8){return _0x5942d1['download'](path[_0xc65c('0x55')](_0x5ba0ae,_0x3d0060),_0x3d0060,function(_0x1c89eb){if(!_0x1c89eb)fs[_0xc65c('0x9a')](path[_0xc65c('0x55')](_0x5ba0ae,_0x3d0060));});}})[_0xc65c('0x43')](handleError(_0x5942d1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 0184827..6a3d795 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 _0xa58f=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x304e46,_0x54441f){var _0x5b8e13=function(_0x175ff2){while(--_0x175ff2){_0x304e46['push'](_0x304e46['shift']());}};_0x5b8e13(++_0x54441f);}(_0xa58f,0x19c));var _0xfa58=function(_0x2793ed,_0x17a25d){_0x2793ed=_0x2793ed-0x0;var _0x53c0be=_0xa58f[_0x2793ed];return _0x53c0be;};'use strict';var EventEmitter=require(_0xfa58('0x0'));var MailMessage=require(_0xfa58('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfa58('0x2')](0x0);var events={'afterCreate':_0xfa58('0x3'),'afterUpdate':_0xfa58('0x4'),'afterDestroy':_0xfa58('0x5')};function emitEvent(_0xb9c3ac){return function(_0x4ac377,_0x57446e,_0x262967){MailMessageEvents['emit'](_0xb9c3ac+':'+_0x4ac377['id'],_0x4ac377);MailMessageEvents['emit'](_0xb9c3ac,_0x4ac377);_0x262967(null);};}for(var e in events){if(events[_0xfa58('0x6')](e)){var event=events[e];MailMessage[_0xfa58('0x7')](e,emitEvent(event));}}module[_0xfa58('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb30f=['hasOwnProperty','hook','exports','save','update','remove','emit'];(function(_0x4bfe3a,_0x16a392){var _0x5c3bf4=function(_0x194612){while(--_0x194612){_0x4bfe3a['push'](_0x4bfe3a['shift']());}};_0x5c3bf4(++_0x16a392);}(_0xb30f,0xb2));var _0xfb30=function(_0x332353,_0x188ecc){_0x332353=_0x332353-0x0;var _0x37ee50=_0xb30f[_0x332353];return _0x37ee50;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb30('0x0'),'afterUpdate':_0xfb30('0x1'),'afterDestroy':_0xfb30('0x2')};function emitEvent(_0x3d4a89){return function(_0x1ab531,_0x3a718f,_0x1a5af2){MailMessageEvents[_0xfb30('0x3')](_0x3d4a89+':'+_0x1ab531['id'],_0x1ab531);MailMessageEvents[_0xfb30('0x3')](_0x3d4a89,_0x1ab531);_0x1a5af2(null);};}for(var e in events){if(events[_0xfb30('0x4')](e)){var event=events[e];MailMessage[_0xfb30('0x5')](e,emitEvent(event));}}module[_0xfb30('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9e91044..c5ed6b1 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 _0xe7bd=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','update'];(function(_0x33c4d3,_0x1ab361){var _0x18197e=function(_0x943b20){while(--_0x943b20){_0x33c4d3['push'](_0x33c4d3['shift']());}};_0x18197e(++_0x1ab361);}(_0xe7bd,0x191));var _0xde7b=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0xe7bd[_0x14477e];return _0x5d4a05;};'use strict';var _=require(_0xde7b('0x0'));var util=require(_0xde7b('0x1'));var logger=require(_0xde7b('0x2'))(_0xde7b('0x3'));var moment=require(_0xde7b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xde7b('0x5'));var fs=require('fs');var path=require(_0xde7b('0x6'));var rimraf=require(_0xde7b('0x7'));var config=require(_0xde7b('0x8'));var attributes=require('./mailMessage.attributes');module[_0xde7b('0x9')]=function(_0x547baa,_0x13de2b){return _0x547baa[_0xde7b('0xa')]('MailMessage',attributes,{'tableName':_0xde7b('0xb'),'paranoid':![],'indexes':[{'name':_0xde7b('0xc'),'fields':[_0xde7b('0xc')]},{'name':_0xde7b('0xd'),'fields':[_0xde7b('0xe'),_0xde7b('0xf')],'type':_0xde7b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5fb1a9,_0xb2c076,_0x134640){if(_0x5fb1a9[_0xde7b('0x11')]){_0x5fb1a9[_0xde7b('0xe')]=htmlToText['fromString'](_0x5fb1a9[_0xde7b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x134640(null,_0xb2c076);},'afterCreate':function(_0x2df774,_0x4f8bb8,_0xc49884){var _0xe57b9=_0x547baa[_0xde7b('0x12')];var _0x387ee2=_0x2df774[_0xde7b('0x13')]({'plain':!![]});if(_0x387ee2[_0xde7b('0x14')]['toLowerCase']()==='in'||_0x387ee2[_0xde7b('0x14')][_0xde7b('0x15')]()===_0xde7b('0x16')&&!_0x387ee2[_0xde7b('0x17')]&&!_[_0xde7b('0x18')](_0x387ee2[_0xde7b('0x19')])){_0xe57b9['MailInteraction'][_0xde7b('0x1a')]({'where':{'id':_0x387ee2['MailInteractionId']}})['then'](function(_0x478c92){if(_0x478c92){_0x478c92[_0xde7b('0x1b')]({'lastMsgAt':_0x387ee2[_0xde7b('0x1c')],'lastMsgDirection':_0x387ee2['direction']['toLowerCase']()});}})[_0xde7b('0x1d')](function(_0x21c915){console[_0xde7b('0x1e')](_0x21c915);});}_0xc49884();}},'charset':_0xde7b('0x1f'),'collate':_0xde7b('0x20')});}; \ No newline at end of file +var _0xd419=['request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xd419,0x6d));var _0x9d41=function(_0x3e5e90,_0x5f13c6){_0x3e5e90=_0x3e5e90-0x0;var _0x32c065=_0xd419[_0x3e5e90];return _0x32c065;};'use strict';var _=require(_0x9d41('0x0'));var util=require(_0x9d41('0x1'));var logger=require(_0x9d41('0x2'))('api');var moment=require(_0x9d41('0x3'));var BPromise=require(_0x9d41('0x4'));var rp=require(_0x9d41('0x5'));var htmlToText=require(_0x9d41('0x6'));var fs=require('fs');var path=require(_0x9d41('0x7'));var rimraf=require('rimraf');var config=require(_0x9d41('0x8'));var attributes=require(_0x9d41('0x9'));module[_0x9d41('0xa')]=function(_0x2bc261,_0x180f34){return _0x2bc261[_0x9d41('0xb')](_0x9d41('0xc'),attributes,{'tableName':_0x9d41('0xd'),'paranoid':![],'indexes':[{'name':_0x9d41('0xe'),'fields':[_0x9d41('0xe')]},{'name':_0x9d41('0xf'),'fields':[_0x9d41('0x10'),_0x9d41('0x11')],'type':_0x9d41('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26ef58,_0x2c0527,_0x4c3740){if(_0x26ef58[_0x9d41('0x13')]){_0x26ef58['plainBody']=htmlToText[_0x9d41('0x14')](_0x26ef58[_0x9d41('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c3740(null,_0x2c0527);},'afterCreate':function(_0x16b001,_0x4ea8b1,_0x426676){var _0x1bef18=_0x2bc261[_0x9d41('0x15')];var _0xbf3012=_0x16b001[_0x9d41('0x16')]({'plain':!![]});if(_0xbf3012[_0x9d41('0x17')][_0x9d41('0x18')]()==='in'||_0xbf3012[_0x9d41('0x17')][_0x9d41('0x18')]()==='out'&&!_0xbf3012[_0x9d41('0x19')]&&!_[_0x9d41('0x1a')](_0xbf3012[_0x9d41('0x1b')])){_0x1bef18[_0x9d41('0x1c')][_0x9d41('0x1d')]({'where':{'id':_0xbf3012[_0x9d41('0x1e')]}})[_0x9d41('0x1f')](function(_0x3d3294){if(_0x3d3294){_0x3d3294[_0x9d41('0x20')]({'lastMsgAt':_0xbf3012[_0x9d41('0x21')],'lastMsgDirection':_0xbf3012[_0x9d41('0x17')][_0x9d41('0x18')]()});}})[_0x9d41('0x22')](function(_0x5d59a4){console[_0x9d41('0x23')](_0x5d59a4);});}_0x426676();}},'charset':_0x9d41('0x24'),'collate':_0x9d41('0x25')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index df31d5a..c96f713 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 _0x1a37=['debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent'];(function(_0x490c82,_0x4f3395){var _0x49a4a2=function(_0x29cb94){while(--_0x29cb94){_0x490c82['push'](_0x490c82['shift']());}};_0x49a4a2(++_0x4f3395);}(_0x1a37,0xb4));var _0x71a3=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x1a37[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});}exports[_0x71a3('0x1b')]=function(_0x1c4ec2){var _0x4a7980=this;return new Promise(function(_0x596328,_0x1ab947){return db[_0x71a3('0x1c')][_0x71a3('0x1d')](_0x1c4ec2[_0x71a3('0x1e')],{'raw':_0x1c4ec2[_0x71a3('0x1f')]?_0x1c4ec2['options'][_0x71a3('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3bf78e){logger[_0x71a3('0x19')](_0x71a3('0x1b'),_0x1c4ec2);logger[_0x71a3('0x12')](_0x71a3('0x1b'),_0x1c4ec2,JSON[_0x71a3('0x14')](_0x3bf78e));_0x596328(_0x3bf78e);})['catch'](function(_0x26e6e7){logger[_0x71a3('0x15')](_0x71a3('0x1b'),_0x26e6e7[_0x71a3('0x18')],_0x1c4ec2);_0x1ab947(_0x4a7980[_0x71a3('0x15')](0x1f4,_0x26e6e7['message']));});});}; \ No newline at end of file +var _0x25e7=['result','CreateMailMessage','MailMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25e7,0x1d6));var _0x725e=function(_0x1cd51f,_0x297954){_0x1cd51f=_0x1cd51f-0x0;var _0x54208a=_0x25e7[_0x1cd51f];return _0x54208a;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});config['redis']=_[_0x725e('0xb')](config[_0x725e('0xc')],{'host':_0x725e('0xd'),'port':0x18eb});var socket=require(_0x725e('0xe'))(new Redis(config[_0x725e('0xc')]));require(_0x725e('0xf'))[_0x725e('0x10')](socket);function respondWithRpcPromise(_0x7c40ff,_0x22c189,_0x45cb68){return new BPromise(function(_0x441c29,_0xb297c7){return client['request'](_0x7c40ff,_0x45cb68)['then'](function(_0x40741b){logger[_0x725e('0x11')]('MailMessage,\x20%s,\x20%s',_0x22c189,'request\x20sent');logger[_0x725e('0x12')](_0x725e('0x13'),_0x22c189,'request\x20sent',JSON[_0x725e('0x14')](_0x40741b));if(_0x40741b[_0x725e('0x15')]){if(_0x40741b[_0x725e('0x15')]['code']===0x1f4){logger[_0x725e('0x15')](_0x725e('0x16'),_0x22c189,_0x40741b[_0x725e('0x15')][_0x725e('0x17')]);return _0xb297c7(_0x40741b[_0x725e('0x15')][_0x725e('0x17')]);}logger['error'](_0x725e('0x16'),_0x22c189,_0x40741b[_0x725e('0x15')][_0x725e('0x17')]);return _0x441c29(_0x40741b['error'][_0x725e('0x17')]);}else{logger[_0x725e('0x11')](_0x725e('0x16'),_0x22c189,_0x725e('0x18'));_0x441c29(_0x40741b[_0x725e('0x19')][_0x725e('0x17')]);}})['catch'](function(_0x22fba5){logger[_0x725e('0x15')](_0x725e('0x16'),_0x22c189,_0x22fba5);_0xb297c7(_0x22fba5);});});}exports[_0x725e('0x1a')]=function(_0x1a9ea6){var _0x3ad3d2=this;return new Promise(function(_0x540802,_0x2fc416){return db[_0x725e('0x1b')][_0x725e('0x1c')](_0x1a9ea6[_0x725e('0x1d')],{'raw':_0x1a9ea6[_0x725e('0x1e')]?_0x1a9ea6[_0x725e('0x1e')][_0x725e('0x1f')]===undefined?!![]:![]:!![]})[_0x725e('0x20')](function(_0x7d0792){logger['info'](_0x725e('0x1a'),_0x1a9ea6);logger[_0x725e('0x12')](_0x725e('0x1a'),_0x1a9ea6,JSON[_0x725e('0x14')](_0x7d0792));_0x540802(_0x7d0792);})['catch'](function(_0xffe474){logger['error']('CreateMailMessage',_0xffe474['message'],_0x1a9ea6);_0x2fc416(_0x3ad3d2[_0x725e('0x15')](0x1f4,_0xffe474[_0x725e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a90c530..096e1b2 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 _0x6b7b=['./mailMessage.events','save','remove','update','removeListener','register','mailMessage:'];(function(_0x28db09,_0x47800b){var _0x19fde8=function(_0x5eaaf7){while(--_0x5eaaf7){_0x28db09['push'](_0x28db09['shift']());}};_0x19fde8(++_0x47800b);}(_0x6b7b,0xe7));var _0xb6b7=function(_0x1b3f07,_0x2d7f13){_0x1b3f07=_0x1b3f07-0x0;var _0x3a3eb9=_0x6b7b[_0x1b3f07];return _0x3a3eb9;};'use strict';var MailMessageEvents=require(_0xb6b7('0x0'));var events=[_0xb6b7('0x1'),_0xb6b7('0x2'),_0xb6b7('0x3')];function createListener(_0x143e2e,_0x5af785){return function(_0x20cfc9){_0x5af785['emit'](_0x143e2e,_0x20cfc9);};}function removeListener(_0x35db2d,_0x43a736){return function(){MailMessageEvents[_0xb6b7('0x4')](_0x35db2d,_0x43a736);};}exports[_0xb6b7('0x5')]=function(_0x2839f2){for(var _0x3eff9d=0x0,_0x2c8601=events['length'];_0x3eff9d<_0x2c8601;_0x3eff9d++){var _0x112d0f=events[_0x3eff9d];var _0x246d9d=createListener(_0xb6b7('0x6')+_0x112d0f,_0x2839f2);MailMessageEvents['on'](_0x112d0f,_0x246d9d);}}; \ No newline at end of file +var _0xa753=['register','length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x3b7fa9,_0xfa233){var _0x4c0ddd=function(_0x189671){while(--_0x189671){_0x3b7fa9['push'](_0x3b7fa9['shift']());}};_0x4c0ddd(++_0xfa233);}(_0xa753,0xa3));var _0x3a75=function(_0x17d06b,_0x143f85){_0x17d06b=_0x17d06b-0x0;var _0x48c2dc=_0xa753[_0x17d06b];return _0x48c2dc;};'use strict';var MailMessageEvents=require(_0x3a75('0x0'));var events=[_0x3a75('0x1'),_0x3a75('0x2'),'update'];function createListener(_0x2ae0a6,_0x4766ca){return function(_0x6809ce){_0x4766ca[_0x3a75('0x3')](_0x2ae0a6,_0x6809ce);};}function removeListener(_0x3a6cd5,_0x5c75ac){return function(){MailMessageEvents[_0x3a75('0x4')](_0x3a6cd5,_0x5c75ac);};}exports[_0x3a75('0x5')]=function(_0x4e3db4){for(var _0x2af483=0x0,_0x4a1010=events[_0x3a75('0x6')];_0x2af483<_0x4a1010;_0x2af483++){var _0x2ebbf1=events[_0x2af483];var _0x458729=createListener(_0x3a75('0x7')+_0x2ebbf1,_0x4e3db4);MailMessageEvents['on'](_0x2ebbf1,_0x458729);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c9bcd9c..a9843e9 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 _0x7187=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','/:id/teams','removeAgents','exports','multer','util'];(function(_0x19159d,_0x3d05c8){var _0x35884a=function(_0xe419f8){while(--_0xe419f8){_0x19159d['push'](_0x19159d['shift']());}};_0x35884a(++_0x3d05c8);}(_0x7187,0x76));var _0x7718=function(_0x13c190,_0x5edc8e){_0x13c190=_0x13c190-0x0;var _0x58d0c1=_0x7187[_0x13c190];return _0x58d0c1;};'use strict';var multer=require(_0x7718('0x0'));var util=require(_0x7718('0x1'));var path=require(_0x7718('0x2'));var timeout=require('connect-timeout');var express=require(_0x7718('0x3'));var router=express['Router']();var fs_extra=require(_0x7718('0x4'));var auth=require(_0x7718('0x5'));var interaction=require(_0x7718('0x6'));var config=require(_0x7718('0x7'));var controller=require(_0x7718('0x8'));router[_0x7718('0x9')]('/',auth['isAuthenticated'](),controller[_0x7718('0xa')]);router['get'](_0x7718('0xb'),auth['isAuthenticated'](),controller[_0x7718('0xc')]);router[_0x7718('0x9')](_0x7718('0xd'),auth[_0x7718('0xe')](),controller[_0x7718('0xf')]);router[_0x7718('0x9')](_0x7718('0x10'),auth[_0x7718('0xe')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x7718('0xe')](),controller[_0x7718('0x11')]);router[_0x7718('0x9')]('/:id/users',auth[_0x7718('0xe')](),controller['getAgents']);router[_0x7718('0x12')]('/',auth[_0x7718('0xe')](),controller[_0x7718('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x7718('0x14')]);router['post'](_0x7718('0x15'),auth[_0x7718('0xe')](),controller[_0x7718('0x16')]);router[_0x7718('0x17')](_0x7718('0xd'),auth[_0x7718('0xe')](),controller[_0x7718('0x18')]);router[_0x7718('0x19')](_0x7718('0xd'),auth[_0x7718('0xe')](),controller[_0x7718('0x1a')]);router[_0x7718('0x19')](_0x7718('0x1b'),auth[_0x7718('0xe')](),controller['removeTeams']);router[_0x7718('0x19')](_0x7718('0x15'),auth[_0x7718('0xe')](),controller[_0x7718('0x1c')]);module[_0x7718('0x1d')]=router; \ No newline at end of file +var _0x50cf=['getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0x1edf15,_0x4cd97f){var _0x50da1f=function(_0x9b41b8){while(--_0x9b41b8){_0x1edf15['push'](_0x1edf15['shift']());}};_0x50da1f(++_0x4cd97f);}(_0x50cf,0xbd));var _0xf50c=function(_0x842ed0,_0x16586f){_0x842ed0=_0x842ed0-0x0;var _0x3de920=_0x50cf[_0x842ed0];return _0x3de920;};'use strict';var multer=require(_0xf50c('0x0'));var util=require('util');var path=require(_0xf50c('0x1'));var timeout=require(_0xf50c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf50c('0x3'));var auth=require(_0xf50c('0x4'));var interaction=require(_0xf50c('0x5'));var config=require(_0xf50c('0x6'));var controller=require(_0xf50c('0x7'));router[_0xf50c('0x8')]('/',auth[_0xf50c('0x9')](),controller['index']);router['get']('/describe',auth[_0xf50c('0x9')](),controller[_0xf50c('0xa')]);router[_0xf50c('0x8')](_0xf50c('0xb'),auth[_0xf50c('0x9')](),controller[_0xf50c('0xc')]);router[_0xf50c('0x8')](_0xf50c('0xd'),auth['isAuthenticated'](),controller[_0xf50c('0xe')]);router[_0xf50c('0x8')]('/:id/teams',auth[_0xf50c('0x9')](),controller[_0xf50c('0xf')]);router[_0xf50c('0x8')](_0xf50c('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xf50c('0x11')]);router[_0xf50c('0x12')](_0xf50c('0x13'),auth[_0xf50c('0x9')](),controller[_0xf50c('0x14')]);router[_0xf50c('0x12')](_0xf50c('0x10'),auth[_0xf50c('0x9')](),controller[_0xf50c('0x15')]);router[_0xf50c('0x16')]('/:id',auth[_0xf50c('0x9')](),controller[_0xf50c('0x17')]);router[_0xf50c('0x18')](_0xf50c('0xb'),auth[_0xf50c('0x9')](),controller[_0xf50c('0x19')]);router[_0xf50c('0x18')](_0xf50c('0x13'),auth[_0xf50c('0x9')](),controller[_0xf50c('0x1a')]);router[_0xf50c('0x18')]('/:id/users',auth[_0xf50c('0x9')](),controller[_0xf50c('0x1b')]);module[_0xf50c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ae49890..121c08f 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 _0x415e=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x415e,0x148));var _0xe415=function(_0x3a8551,_0x4c3a72){_0x3a8551=_0x3a8551-0x0;var _0x38fdb7=_0x415e[_0x3a8551];return _0x38fdb7;};'use strict';var Sequelize=require(_0xe415('0x0'));module[_0xe415('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe415('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe415('0x3')]},'timeout':{'type':Sequelize[_0xe415('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe415('0x5')](_0xe415('0x6'),_0xe415('0x7'),_0xe415('0x8'))}}; \ No newline at end of file +var _0xb689=['STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x48d218,_0x38ae7b){var _0x5d86c7=function(_0x362ae9){while(--_0x362ae9){_0x48d218['push'](_0x48d218['shift']());}};_0x5d86c7(++_0x38ae7b);}(_0xb689,0xad));var _0x9b68=function(_0x3053f1,_0x156029){_0x3053f1=_0x3053f1-0x0;var _0x9da9e4=_0xb689[_0x3053f1];return _0x9da9e4;};'use strict';var Sequelize=require(_0x9b68('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b68('0x1')],'unique':_0x9b68('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b68('0x1')]},'timeout':{'type':Sequelize[_0x9b68('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9b68('0x4'),_0x9b68('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1369602..a80732c 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 _0xe6a8=['defaults','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','then','get','UserProfileResource','error','name','send','index','map','type','getOptions','where','MailQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','rawAttributes','filter','length','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','join','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0xe6a8,0xec));var _0x8e6a=function(_0x35e9f8,_0x1bac4a){_0x35e9f8=_0x35e9f8-0x0;var _0x4e4e79=_0xe6a8[_0x35e9f8];return _0x4e4e79;};'use strict';var BPromise=require(_0x8e6a('0x0'));var util=require(_0x8e6a('0x1'));var _=require(_0x8e6a('0x2'));var squel=require(_0x8e6a('0x3'));var Redis=require(_0x8e6a('0x4'));var qs=require(_0x8e6a('0x5'));var logger=require(_0x8e6a('0x6'))(_0x8e6a('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8e6a('0x8')](config[_0x8e6a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e6a('0xa'))(new Redis(config['redis']));require(_0x8e6a('0xb'))['register'](socket);function respondWithStatusCode(_0x4df992,_0x181db3){_0x181db3=_0x181db3||0xcc;return function(_0x4f889f){if(_0x4f889f){return _0x4df992[_0x8e6a('0xc')](_0x181db3);}return _0x4df992[_0x8e6a('0xd')](_0x181db3)[_0x8e6a('0xe')]();};}function respondWithResult(_0x5b059f,_0x530c8c){_0x530c8c=_0x530c8c||0xc8;return function(_0x488402){if(_0x488402){return _0x5b059f[_0x8e6a('0xd')](_0x530c8c)[_0x8e6a('0xf')](_0x488402);}};}function respondWithFilteredResult(_0x2cdabb,_0x4dd684){return function(_0x2bf2c2){if(_0x2bf2c2){var _0x2cd48f=typeof _0x4dd684['offset']===_0x8e6a('0x10')&&typeof _0x4dd684[_0x8e6a('0x11')]===_0x8e6a('0x10');var _0x90d63b=_0x2bf2c2['count'];var _0xd50d53=_0x2cd48f?0x0:_0x4dd684['offset'];var _0x11e79c=_0x2cd48f?_0x2bf2c2[_0x8e6a('0x12')]:_0x4dd684[_0x8e6a('0x13')]+_0x4dd684[_0x8e6a('0x11')];var _0x10815b;if(_0x11e79c>=_0x90d63b){_0x11e79c=_0x90d63b;_0x10815b=0xc8;}else{_0x10815b=0xce;}_0x2cdabb[_0x8e6a('0xd')](_0x10815b);return _0x2cdabb['set'](_0x8e6a('0x14'),_0xd50d53+'-'+_0x11e79c+'/'+_0x90d63b)[_0x8e6a('0xf')](_0x2bf2c2);}return null;};}function saveUpdates(_0x39da0c){return function(_0x413bd6){if(_0x413bd6){return _0x413bd6['update'](_0x39da0c)['then'](function(_0x560e99){return _0x560e99;});}return null;};}function removeEntity(_0x198dae){return function(_0x19d75b){if(_0x19d75b){return _0x19d75b['destroy']()[_0x8e6a('0x15')](function(){var _0x482085=_0x19d75b[_0x8e6a('0x16')]({'plain':!![]});var _0x4a1e50='MailQueues';return db[_0x8e6a('0x17')]['destroy']({'where':{'type':_0x4a1e50,'resourceId':_0x482085['id']}})['then'](function(){return _0x19d75b;});})[_0x8e6a('0x15')](function(){_0x198dae[_0x8e6a('0xd')](0xcc)[_0x8e6a('0xe')]();});}};}function handleEntityNotFound(_0x4cceb1){return function(_0xad2cb0){if(!_0xad2cb0){_0x4cceb1[_0x8e6a('0xc')](0x194);}return _0xad2cb0;};}function handleError(_0x5cc5b5,_0x4ffeb8){_0x4ffeb8=_0x4ffeb8||0x1f4;return function(_0x3d90d5){logger[_0x8e6a('0x18')](_0x3d90d5['stack']);if(_0x3d90d5[_0x8e6a('0x19')]){delete _0x3d90d5[_0x8e6a('0x19')];}_0x5cc5b5[_0x8e6a('0xd')](_0x4ffeb8)[_0x8e6a('0x1a')](_0x3d90d5);};}exports[_0x8e6a('0x1b')]=function(_0x27368c,_0x750721){var _0x155be2={};var _0x110f93={'count':0x0,'rows':[]};var _0x326fa3=_[_0x8e6a('0x1c')](db['MailQueue']['rawAttributes'],function(_0x45055b){return{'name':_0x45055b['fieldName'],'type':_0x45055b[_0x8e6a('0x1d')]['key']};});_0x155be2=qs[_0x8e6a('0x1e')](_0x326fa3,_0x27368c);var _0x487ee6={'where':_0x155be2[_0x8e6a('0x1f')]};return db[_0x8e6a('0x20')][_0x8e6a('0x12')](_0x487ee6)[_0x8e6a('0x15')](function(_0x175b9c){_0x110f93[_0x8e6a('0x12')]=_0x175b9c;_0x155be2['include']=qs[_0x8e6a('0x21')](_0x27368c[_0x8e6a('0x22')]);return db[_0x8e6a('0x20')][_0x8e6a('0x23')](_0x155be2);})['then'](function(_0x30b16f){_0x110f93[_0x8e6a('0x24')]=_0x30b16f;return _0x110f93;})[_0x8e6a('0x15')](respondWithFilteredResult(_0x750721,_0x155be2))[_0x8e6a('0x25')](handleError(_0x750721,null));};exports[_0x8e6a('0x26')]=function(_0x4e36ec,_0x2e318c){var _0x178839={'raw':!![],'where':{'id':_0x4e36ec[_0x8e6a('0x27')]['id']}},_0x33a627={};_0x33a627[_0x8e6a('0x28')]=_[_0x8e6a('0x29')](db['MailQueue']['rawAttributes']);_0x33a627[_0x8e6a('0x22')]=_[_0x8e6a('0x29')](_0x4e36ec[_0x8e6a('0x22')]);_0x33a627[_0x8e6a('0x2a')]=_['intersection'](_0x33a627[_0x8e6a('0x28')],_0x33a627['query']);_0x178839[_0x8e6a('0x2b')]=_[_0x8e6a('0x2c')](_0x33a627['model'],qs['fields'](_0x4e36ec[_0x8e6a('0x22')][_0x8e6a('0x2d')]));_0x178839[_0x8e6a('0x2b')]=_0x178839[_0x8e6a('0x2b')]['length']?_0x178839[_0x8e6a('0x2b')]:_0x33a627[_0x8e6a('0x28')];if(_0x4e36ec[_0x8e6a('0x22')][_0x8e6a('0x2e')]){_0x178839[_0x8e6a('0x21')]=[{'all':!![]}];}_0x178839=_[_0x8e6a('0x2f')]({},_0x178839,_0x4e36ec[_0x8e6a('0x30')]);return db[_0x8e6a('0x20')][_0x8e6a('0x31')](_0x178839)[_0x8e6a('0x15')](handleEntityNotFound(_0x2e318c,null))[_0x8e6a('0x15')](respondWithResult(_0x2e318c,null))[_0x8e6a('0x25')](handleError(_0x2e318c,null));};exports[_0x8e6a('0x32')]=function(_0x117c92,_0xd4ba8e){return db[_0x8e6a('0x20')]['create'](_0x117c92['body'],{})[_0x8e6a('0x15')](function(_0x1c4f02){var _0x3bc2e2=_0x117c92[_0x8e6a('0x33')][_0x8e6a('0x16')]({'plain':!![]});if(!_0x3bc2e2)throw new Error(_0x8e6a('0x34'));if(_0x3bc2e2['role']==='user'){var _0x3d08b8=_0x1c4f02[_0x8e6a('0x16')]({'plain':!![]});var _0x36f06b=_0x8e6a('0x35');return db[_0x8e6a('0x36')][_0x8e6a('0x31')]({'where':{'name':_0x36f06b,'userProfileId':_0x3bc2e2[_0x8e6a('0x37')]},'raw':!![]})['then'](function(_0x313f8e){if(_0x313f8e&&_0x313f8e['autoAssociation']===0x0){return db[_0x8e6a('0x17')][_0x8e6a('0x32')]({'name':_0x3d08b8['name'],'resourceId':_0x3d08b8['id'],'type':_0x313f8e['name'],'sectionId':_0x313f8e['id']},{})[_0x8e6a('0x15')](function(){return _0x1c4f02;});}else{return _0x1c4f02;}})[_0x8e6a('0x25')](function(_0x4a542a){logger[_0x8e6a('0x18')](_0x8e6a('0x38'),_0x4a542a);throw _0x4a542a;});}return _0x1c4f02;})['then'](respondWithResult(_0xd4ba8e,0xc9))[_0x8e6a('0x25')](handleError(_0xd4ba8e,null));};exports[_0x8e6a('0x39')]=function(_0x460522,_0x25dcf2){if(_0x460522['body']['id']){delete _0x460522['body']['id'];}return db[_0x8e6a('0x20')][_0x8e6a('0x31')]({'where':{'id':_0x460522[_0x8e6a('0x27')]['id']}})[_0x8e6a('0x15')](handleEntityNotFound(_0x25dcf2,null))['then'](saveUpdates(_0x460522[_0x8e6a('0x3a')],null))[_0x8e6a('0x15')](respondWithResult(_0x25dcf2,null))['catch'](handleError(_0x25dcf2,null));};exports['destroy']=function(_0x2d704a,_0x57e923){return db['MailQueue']['find']({'where':{'id':_0x2d704a[_0x8e6a('0x27')]['id']}})['then'](handleEntityNotFound(_0x57e923,null))['then'](removeEntity(_0x57e923,null))[_0x8e6a('0x25')](handleError(_0x57e923,null));};exports[_0x8e6a('0x3b')]=function(_0x1da865,_0x45bbc9){return db[_0x8e6a('0x20')][_0x8e6a('0x3b')]()['then'](respondWithResult(_0x45bbc9,null))[_0x8e6a('0x25')](handleError(_0x45bbc9,null));};exports[_0x8e6a('0x3c')]=function(_0x352787,_0x31cc79){var _0x2b8bb0={'raw':!![],'where':{}},_0x52452d={},_0xf7f54f;return db['MailQueue']['findOne']({'where':{'id':_0x352787[_0x8e6a('0x27')]['id']}})['then'](handleEntityNotFound(_0x31cc79,null))[_0x8e6a('0x15')](function(_0x501693){if(_0x501693){_0xf7f54f=_0x501693[_0x8e6a('0x16')]({'plain':!![]});_0x52452d[_0x8e6a('0x28')]=_[_0x8e6a('0x29')](db['UserMailQueue']['rawAttributes']);_0x52452d[_0x8e6a('0x22')]=_[_0x8e6a('0x29')](_0x352787[_0x8e6a('0x22')]);_0x52452d[_0x8e6a('0x2a')]=_[_0x8e6a('0x2c')](_0x52452d[_0x8e6a('0x28')],_0x52452d['query']);_0x2b8bb0[_0x8e6a('0x2b')]=_[_0x8e6a('0x2c')](_0x52452d[_0x8e6a('0x28')],qs[_0x8e6a('0x2d')](_0x352787[_0x8e6a('0x22')]['fields']));_0x2b8bb0[_0x8e6a('0x2b')]=_0x2b8bb0[_0x8e6a('0x2b')]['length']?_0x2b8bb0['attributes']:_0x52452d[_0x8e6a('0x28')];if(!_0x352787[_0x8e6a('0x22')][_0x8e6a('0x3d')](_0x8e6a('0x3e'))){_0x2b8bb0[_0x8e6a('0x11')]=qs[_0x8e6a('0x11')](_0x352787[_0x8e6a('0x22')][_0x8e6a('0x11')]);_0x2b8bb0['offset']=qs[_0x8e6a('0x13')](_0x352787[_0x8e6a('0x22')][_0x8e6a('0x13')]);}_0x2b8bb0[_0x8e6a('0x3f')]=qs[_0x8e6a('0x40')](_0x352787[_0x8e6a('0x22')][_0x8e6a('0x40')]);_0x2b8bb0[_0x8e6a('0x1f')]=qs[_0x8e6a('0x2a')](_[_0x8e6a('0x41')](_0x352787['query'],_0x52452d['filters']));_0x2b8bb0[_0x8e6a('0x1f')][_0x8e6a('0x42')]=_0x501693['id'];if(_0x352787[_0x8e6a('0x22')]['filter']){_0x2b8bb0[_0x8e6a('0x1f')]=_[_0x8e6a('0x2f')](_0x2b8bb0[_0x8e6a('0x1f')],{'$or':_[_0x8e6a('0x1c')](_0x2b8bb0[_0x8e6a('0x2b')],function(_0x2c11d7){var _0x38532f={};_0x38532f[_0x2c11d7]={'$like':'%'+_0x352787['query']['filter']+'%'};return _0x38532f;})});}_0x2b8bb0=_['merge']({},_0x2b8bb0,_0x352787[_0x8e6a('0x30')]);return db[_0x8e6a('0x43')][_0x8e6a('0x23')](_0x2b8bb0);}})[_0x8e6a('0x15')](function(_0x48d38e){if(_0x48d38e){return db[_0x8e6a('0x44')][_0x8e6a('0x45')]({'where':{'id':_[_0x8e6a('0x1c')](_0x48d38e,_0x8e6a('0x46')),'role':_0x8e6a('0x47')},'attributes':['id',_0x8e6a('0x19'),_0x8e6a('0x48'),_0x8e6a('0x49'),_0x8e6a('0x4a')]});}})[_0x8e6a('0x15')](function(_0x461b34){if(_0x461b34){return{'count':_0x461b34['count'],'rows':_['map'](_0x461b34[_0x8e6a('0x24')],function(_0x3911a6){return{'membername':_0x3911a6[_0x8e6a('0x19')],'UserId':_0x3911a6['id'],'queue_name':_0xf7f54f[_0x8e6a('0x19')],'MailQueueId':_0xf7f54f['id'],'interface':util[_0x8e6a('0x4b')]('%s/%s',_0x8e6a('0x4c'),_0x3911a6[_0x8e6a('0x19')]),'penalty':0x0,'paused':_0x3911a6[_0x8e6a('0x48')],'createdAt':_0x3911a6[_0x8e6a('0x4a')],'updatedAt':_0x3911a6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8e6a('0x15')](respondWithFilteredResult(_0x31cc79,_0x2b8bb0))[_0x8e6a('0x25')](handleError(_0x31cc79,null));};exports[_0x8e6a('0x4d')]=function(_0x38e30f,_0x307641){var _0x15edcf={};var _0x19247e={};var _0x42ad10;var _0x44efe4;return db[_0x8e6a('0x20')][_0x8e6a('0x4e')]({'where':{'id':_0x38e30f['params']['id']}})[_0x8e6a('0x15')](handleEntityNotFound(_0x307641,null))[_0x8e6a('0x15')](function(_0x5c6d1e){if(_0x5c6d1e){_0x42ad10=_0x5c6d1e;_0x19247e[_0x8e6a('0x28')]=_['keys'](db[_0x8e6a('0x4f')][_0x8e6a('0x50')]);_0x19247e[_0x8e6a('0x22')]=_[_0x8e6a('0x29')](_0x38e30f['query']);_0x19247e[_0x8e6a('0x2a')]=_[_0x8e6a('0x2c')](_0x19247e[_0x8e6a('0x28')],_0x19247e[_0x8e6a('0x22')]);_0x15edcf['attributes']=_[_0x8e6a('0x2c')](_0x19247e[_0x8e6a('0x28')],qs[_0x8e6a('0x2d')](_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x2d')]));_0x15edcf[_0x8e6a('0x2b')]=_0x15edcf['attributes']['length']?_0x15edcf[_0x8e6a('0x2b')]:_0x19247e[_0x8e6a('0x28')];_0x15edcf[_0x8e6a('0x3f')]=qs['sort'](_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x40')]);_0x15edcf[_0x8e6a('0x1f')]=qs[_0x8e6a('0x2a')](_['pick'](_0x38e30f[_0x8e6a('0x22')],_0x19247e[_0x8e6a('0x2a')]));if(_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x51')]){_0x15edcf[_0x8e6a('0x1f')]=_[_0x8e6a('0x2f')](_0x15edcf[_0x8e6a('0x1f')],{'$or':_[_0x8e6a('0x1c')](_0x15edcf[_0x8e6a('0x2b')],function(_0x53f4db){var _0x156b8d={};_0x156b8d[_0x53f4db]={'$like':'%'+_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x51')]+'%'};return _0x156b8d;})});}_0x15edcf=_[_0x8e6a('0x2f')]({},_0x15edcf,_0x38e30f[_0x8e6a('0x30')]);return _0x42ad10['getTeams'](_0x15edcf);}})[_0x8e6a('0x15')](function(_0xf6a0f3){if(_0xf6a0f3){_0x44efe4=_0xf6a0f3[_0x8e6a('0x52')];if(!_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x3d')](_0x8e6a('0x3e'))){_0x15edcf[_0x8e6a('0x11')]=qs[_0x8e6a('0x11')](_0x38e30f['query'][_0x8e6a('0x11')]);_0x15edcf[_0x8e6a('0x13')]=qs[_0x8e6a('0x13')](_0x38e30f[_0x8e6a('0x22')][_0x8e6a('0x13')]);}return _0x42ad10[_0x8e6a('0x4d')](_0x15edcf);}})[_0x8e6a('0x15')](function(_0x416150){if(_0x416150){return _0x416150?{'count':_0x44efe4,'rows':_0x416150}:null;}})[_0x8e6a('0x15')](respondWithResult(_0x307641,null))[_0x8e6a('0x25')](handleError(_0x307641,null));};exports[_0x8e6a('0x53')]=function(_0xc05991,_0x114891){var _0x5029a5=_0xc05991[_0x8e6a('0x3a')][_0x8e6a('0x54')];return db['Team'][_0x8e6a('0x23')]({'where':{'id':_0x5029a5},'attributes':['id'],'include':[{'model':db[_0x8e6a('0x44')],'as':_0x8e6a('0x55'),'attributes':['id',_0x8e6a('0x19'),_0x8e6a('0x56'),'voicePause',_0x8e6a('0x57')],'raw':!![]}]})[_0x8e6a('0x15')](function(_0x1c9e06){if(_0x1c9e06){var _0x4f9d6d=_[_0x8e6a('0x58')](_0x1c9e06,function(_0x431db8){var _0x2520d9=_0x431db8[_0x8e6a('0x16')]({'plain':!![]});return _0x2520d9[_0x8e6a('0x55')];});return db[_0x8e6a('0x20')][_0x8e6a('0x31')]({'where':{'id':_0xc05991['params']['id']}})[_0x8e6a('0x15')](function(_0x109b34){return db['sequelize']['transaction'](function(_0x212751){return _0x109b34[_0x8e6a('0x53')](_0x5029a5,{'transaction':_0x212751})[_0x8e6a('0x15')](function(){return BPromise[_0x8e6a('0x59')](_0x4f9d6d,function(_0x5dcd0c){return db[_0x8e6a('0x43')][_0x8e6a('0x5a')]({'where':{'UserId':_0x5dcd0c['id'],'MailQueueId':_0xc05991['params']['id']},'transaction':_0x212751});});})[_0x8e6a('0x15')](function(){_0x4f9d6d[_0x8e6a('0x5b')](function(_0x304482){socket[_0x8e6a('0x5c')](_0x8e6a('0x5d'),{'UserId':_0x304482['id'],'MailQueueId':_0x109b34['id']});});});});});}})['then'](respondWithStatusCode(_0x114891,null))['catch'](handleError(_0x114891,null));};exports[_0x8e6a('0x5e')]=function(_0x1c1f43,_0x4f61ec){return db[_0x8e6a('0x4f')][_0x8e6a('0x23')]({'where':{'id':_0x1c1f43[_0x8e6a('0x22')][_0x8e6a('0x54')]},'attributes':['id'],'include':[{'model':db[_0x8e6a('0x44')],'as':_0x8e6a('0x55'),'attributes':['id'],'raw':!![]}]})[_0x8e6a('0x15')](handleEntityNotFound(_0x4f61ec,null))['then'](function(_0x1b79fb){var _0x13631e=_['map'](_0x1b79fb,'id');var _0xfe2b6d=[];var _0x59f7b2=[];var _0x15a07a=squel[_0x8e6a('0x5f')]();_0x15a07a[_0x8e6a('0x60')]('tq.TeamId')[_0x8e6a('0x61')]('team_has_mail_queues','tq')[_0x8e6a('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8e6a('0x1f')](_0x8e6a('0x63'),_0x1c1f43[_0x8e6a('0x27')]['id']);for(var _0xf6dfcb=0x0;_0xf6dfcb<_0x1b79fb[_0x8e6a('0x52')];_0xf6dfcb+=0x1){let _0x3972b3=_0x1b79fb[_0xf6dfcb];for(var _0x5cf1e7=0x0;_0x5cf1e7<_0x3972b3[_0x8e6a('0x55')][_0x8e6a('0x52')];_0x5cf1e7+=0x1){let _0x4a8088=_0x3972b3[_0x8e6a('0x55')][_0x5cf1e7];var _0x1574bc=_0x15a07a['clone']();_0x1574bc[_0x8e6a('0x1f')](_0x8e6a('0x64'),_0x4a8088['id']);_0x59f7b2[_0x8e6a('0x65')](db['sequelize'][_0x8e6a('0x22')](_0x1574bc[_0x8e6a('0x66')](),{'type':db['sequelize'][_0x8e6a('0x67')][_0x8e6a('0x68')]})['then'](function(_0xe7fa67){if(_0xe7fa67[_0x8e6a('0x52')]===0x1){return _0x4a8088['id'];}else{var _0x21f8b6=_[_0x8e6a('0x69')](_[_0x8e6a('0x1c')](_0xe7fa67,_0x8e6a('0x6a')),function(_0x21aa90){return _[_0x8e6a('0x6b')](_0x13631e,_0x21aa90);});if(_0x21f8b6){return _0x4a8088['id'];}}}));}}return BPromise[_0x8e6a('0x6c')](_0x59f7b2)['then'](function(_0x3230b2){_0xfe2b6d=_(_0xfe2b6d)[_0x8e6a('0x6d')](_0x3230b2)[_0x8e6a('0x6e')]()[_0x8e6a('0x6f')]();return db[_0x8e6a('0x20')][_0x8e6a('0x31')]({'where':{'id':_0x1c1f43[_0x8e6a('0x27')]['id']}})[_0x8e6a('0x15')](function(_0x4ad8e2){return db[_0x8e6a('0x70')][_0x8e6a('0x71')](function(_0x384f2e){return _0x4ad8e2[_0x8e6a('0x5e')](_0x1c1f43[_0x8e6a('0x22')][_0x8e6a('0x54')],{'transaction':_0x384f2e})[_0x8e6a('0x15')](function(){if(!_[_0x8e6a('0x72')](_0xfe2b6d)){return _0x4ad8e2[_0x8e6a('0x73')](_0xfe2b6d,{'transaction':_0x384f2e});}})[_0x8e6a('0x15')](function(){_0xfe2b6d[_0x8e6a('0x5b')](function(_0x1f3a68){socket[_0x8e6a('0x5c')](_0x8e6a('0x74'),{'UserId':_0x1f3a68,'MailQueueId':_0x4ad8e2['id']});});});});});});})[_0x8e6a('0x15')](respondWithStatusCode(_0x4f61ec,null))[_0x8e6a('0x25')](handleError(_0x4f61ec,null));};exports[_0x8e6a('0x75')]=function(_0x58a93c,_0x5a511d){return db['MailQueue']['find']({'where':{'id':_0x58a93c[_0x8e6a('0x27')]['id']}})[_0x8e6a('0x15')](handleEntityNotFound(_0x5a511d,null))['then'](function(_0xb6cda6){if(_0xb6cda6){return _0xb6cda6[_0x8e6a('0x75')](_0x58a93c[_0x8e6a('0x3a')][_0x8e6a('0x54')],_[_0x8e6a('0x76')](_0x58a93c['body'],[_0x8e6a('0x54'),'id'])||{})[_0x8e6a('0x77')](function(_0x636215){for(var _0x33428b=0x0;_0x33428b<_0x58a93c[_0x8e6a('0x3a')][_0x8e6a('0x54')]['length'];_0x33428b+=0x1){socket[_0x8e6a('0x5c')](_0x8e6a('0x5d'),{'UserId':Number(_0x58a93c[_0x8e6a('0x3a')][_0x8e6a('0x54')][_0x33428b]),'MailQueueId':Number(_0x58a93c[_0x8e6a('0x27')]['id'])});}return _0x636215;});}})[_0x8e6a('0x15')](respondWithResult(_0x5a511d,null))[_0x8e6a('0x25')](handleError(_0x5a511d,null));};exports[_0x8e6a('0x73')]=function(_0x45d20b,_0x19a609){return db[_0x8e6a('0x20')][_0x8e6a('0x31')]({'where':{'id':_0x45d20b['params']['id']}})[_0x8e6a('0x15')](handleEntityNotFound(_0x19a609,null))[_0x8e6a('0x15')](function(_0x44bf16){if(_0x44bf16){return _0x44bf16[_0x8e6a('0x73')](_0x45d20b[_0x8e6a('0x22')]['ids'])[_0x8e6a('0x15')](function(){if(_[_0x8e6a('0x78')](_0x45d20b[_0x8e6a('0x22')][_0x8e6a('0x54')])){for(var _0x396178=0x0;_0x396178<_0x45d20b[_0x8e6a('0x22')][_0x8e6a('0x54')][_0x8e6a('0x52')];_0x396178+=0x1){socket[_0x8e6a('0x5c')](_0x8e6a('0x74'),{'UserId':Number(_0x45d20b[_0x8e6a('0x22')][_0x8e6a('0x54')][_0x396178]),'MailQueueId':Number(_0x45d20b[_0x8e6a('0x27')]['id'])});}}else{socket[_0x8e6a('0x5c')](_0x8e6a('0x74'),{'UserId':Number(_0x45d20b[_0x8e6a('0x22')][_0x8e6a('0x54')]),'MailQueueId':Number(_0x45d20b['params']['id'])});}});}})[_0x8e6a('0x15')](respondWithStatusCode(_0x19a609,null))['catch'](handleError(_0x19a609,null));};exports[_0x8e6a('0x79')]=function(_0x138eec,_0x1bb5fd){var _0x519d25={};var _0x27a0f={};var _0x3a05de;var _0x575c16;return db[_0x8e6a('0x20')][_0x8e6a('0x4e')]({'where':{'id':_0x138eec[_0x8e6a('0x27')]['id']}})[_0x8e6a('0x15')](handleEntityNotFound(_0x1bb5fd,null))[_0x8e6a('0x15')](function(_0x12761d){if(_0x12761d){_0x3a05de=_0x12761d;_0x27a0f[_0x8e6a('0x28')]=_[_0x8e6a('0x29')](db[_0x8e6a('0x44')][_0x8e6a('0x50')]);_0x27a0f[_0x8e6a('0x22')]=_['keys'](_0x138eec[_0x8e6a('0x22')]);_0x27a0f[_0x8e6a('0x2a')]=_['intersection'](_0x27a0f['model'],_0x27a0f[_0x8e6a('0x22')]);_0x519d25[_0x8e6a('0x2b')]=_['intersection'](_0x27a0f['model'],qs[_0x8e6a('0x2d')](_0x138eec['query']['fields']));_0x519d25[_0x8e6a('0x2b')]=_0x519d25[_0x8e6a('0x2b')][_0x8e6a('0x52')]?_0x519d25[_0x8e6a('0x2b')]:_0x27a0f[_0x8e6a('0x28')];_0x519d25[_0x8e6a('0x3f')]=qs[_0x8e6a('0x40')](_0x138eec[_0x8e6a('0x22')][_0x8e6a('0x40')]);_0x519d25[_0x8e6a('0x1f')]=qs['filters'](_[_0x8e6a('0x41')](_0x138eec[_0x8e6a('0x22')],_0x27a0f[_0x8e6a('0x2a')]));if(_0x138eec['query'][_0x8e6a('0x51')]){_0x519d25[_0x8e6a('0x1f')]=_[_0x8e6a('0x2f')](_0x519d25[_0x8e6a('0x1f')],{'$or':_[_0x8e6a('0x1c')](_0x519d25[_0x8e6a('0x2b')],function(_0x2f4d5c){var _0x1fb476={};_0x1fb476[_0x2f4d5c]={'$like':'%'+_0x138eec[_0x8e6a('0x22')][_0x8e6a('0x51')]+'%'};return _0x1fb476;})});}_0x519d25=_[_0x8e6a('0x2f')]({},_0x519d25,_0x138eec['options']);return _0x3a05de[_0x8e6a('0x79')](_0x519d25);}})[_0x8e6a('0x15')](function(_0x1da2f2){if(_0x1da2f2){_0x575c16=_0x1da2f2[_0x8e6a('0x52')];if(!_0x138eec['query'][_0x8e6a('0x3d')](_0x8e6a('0x3e'))){_0x519d25['limit']=qs['limit'](_0x138eec['query']['limit']);_0x519d25['offset']=qs[_0x8e6a('0x13')](_0x138eec['query'][_0x8e6a('0x13')]);}return _0x3a05de[_0x8e6a('0x79')](_0x519d25);}})[_0x8e6a('0x15')](function(_0x234bd2){if(_0x234bd2){return _0x234bd2?{'count':_0x575c16,'rows':_0x234bd2}:null;}})[_0x8e6a('0x15')](respondWithResult(_0x1bb5fd,null))[_0x8e6a('0x25')](handleError(_0x1bb5fd,null));}; \ No newline at end of file +var _0x6f23=['length','includeAll','merge','options','find','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','create','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','keys','UserMailQueue','rawAttributes','hasOwnProperty','nolimit','sort','MailQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','SIP','mailPause','order','pick','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Team','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','union','value','ids','isEmpty','addAgents','omit','removeAgents','getAgents','findOne','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./mailQueue.socket','register','status','json','undefined','limit','offset','count','set','Content-Range','then','destroy','get','sendStatus','error','stack','index','map','fieldName','type','key','getOptions','where','MailQueue','include','findAll','rows','catch','params','model','query','filters','attributes','intersection','fields'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x6f23,0x131));var _0x36f2=function(_0x2ad6b2,_0x5b7de){_0x2ad6b2=_0x2ad6b2-0x0;var _0x5a318f=_0x6f23[_0x2ad6b2];return _0x5a318f;};'use strict';var BPromise=require(_0x36f2('0x0'));var util=require(_0x36f2('0x1'));var _=require(_0x36f2('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x36f2('0x3'));var logger=require(_0x36f2('0x4'))(_0x36f2('0x5'));var config=require(_0x36f2('0x6'));var db=require(_0x36f2('0x7'))['db'];config['redis']=_[_0x36f2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x36f2('0x9'))(new Redis(config[_0x36f2('0xa')]));require(_0x36f2('0xb'))[_0x36f2('0xc')](socket);function respondWithStatusCode(_0x3b7631,_0x4756ac){_0x4756ac=_0x4756ac||0xcc;return function(_0x1cde9f){if(_0x1cde9f){return _0x3b7631['sendStatus'](_0x4756ac);}return _0x3b7631[_0x36f2('0xd')](_0x4756ac)['end']();};}function respondWithResult(_0x46bd62,_0x16c4d8){_0x16c4d8=_0x16c4d8||0xc8;return function(_0x230003){if(_0x230003){return _0x46bd62[_0x36f2('0xd')](_0x16c4d8)[_0x36f2('0xe')](_0x230003);}};}function respondWithFilteredResult(_0x6271cb,_0x3c7234){return function(_0x350f16){if(_0x350f16){var _0x1bc30f=typeof _0x3c7234['offset']===_0x36f2('0xf')&&typeof _0x3c7234[_0x36f2('0x10')]===_0x36f2('0xf');var _0x40cf18=_0x350f16['count'];var _0x2b1c20=_0x1bc30f?0x0:_0x3c7234[_0x36f2('0x11')];var _0xfe530e=_0x1bc30f?_0x350f16[_0x36f2('0x12')]:_0x3c7234[_0x36f2('0x11')]+_0x3c7234[_0x36f2('0x10')];var _0x568dfe;if(_0xfe530e>=_0x40cf18){_0xfe530e=_0x40cf18;_0x568dfe=0xc8;}else{_0x568dfe=0xce;}_0x6271cb['status'](_0x568dfe);return _0x6271cb[_0x36f2('0x13')](_0x36f2('0x14'),_0x2b1c20+'-'+_0xfe530e+'/'+_0x40cf18)[_0x36f2('0xe')](_0x350f16);}return null;};}function saveUpdates(_0x2dca66){return function(_0x3fc197){if(_0x3fc197){return _0x3fc197['update'](_0x2dca66)[_0x36f2('0x15')](function(_0x1bf527){return _0x1bf527;});}return null;};}function removeEntity(_0x2d48be){return function(_0x2f5e9d){if(_0x2f5e9d){return _0x2f5e9d[_0x36f2('0x16')]()[_0x36f2('0x15')](function(){var _0x1f15fe=_0x2f5e9d[_0x36f2('0x17')]({'plain':!![]});var _0x7b3159='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x7b3159,'resourceId':_0x1f15fe['id']}})[_0x36f2('0x15')](function(){return _0x2f5e9d;});})[_0x36f2('0x15')](function(){_0x2d48be[_0x36f2('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dda2){return function(_0x770fe){if(!_0x770fe){_0x40dda2[_0x36f2('0x18')](0x194);}return _0x770fe;};}function handleError(_0x17e7b8,_0x236480){_0x236480=_0x236480||0x1f4;return function(_0x113f85){logger[_0x36f2('0x19')](_0x113f85[_0x36f2('0x1a')]);if(_0x113f85['name']){delete _0x113f85['name'];}_0x17e7b8[_0x36f2('0xd')](_0x236480)['send'](_0x113f85);};}exports[_0x36f2('0x1b')]=function(_0x2bff63,_0x2779f0){var _0x94a020={};var _0x41c870={'count':0x0,'rows':[]};var _0x1c729d=_[_0x36f2('0x1c')](db['MailQueue']['rawAttributes'],function(_0x8fbc47){return{'name':_0x8fbc47[_0x36f2('0x1d')],'type':_0x8fbc47[_0x36f2('0x1e')][_0x36f2('0x1f')]};});_0x94a020=qs[_0x36f2('0x20')](_0x1c729d,_0x2bff63);var _0x267301={'where':_0x94a020[_0x36f2('0x21')]};return db[_0x36f2('0x22')][_0x36f2('0x12')](_0x267301)[_0x36f2('0x15')](function(_0x512395){_0x41c870[_0x36f2('0x12')]=_0x512395;_0x94a020[_0x36f2('0x23')]=qs[_0x36f2('0x23')](_0x2bff63['query']);return db[_0x36f2('0x22')][_0x36f2('0x24')](_0x94a020);})[_0x36f2('0x15')](function(_0x15fb66){_0x41c870[_0x36f2('0x25')]=_0x15fb66;return _0x41c870;})[_0x36f2('0x15')](respondWithFilteredResult(_0x2779f0,_0x94a020))[_0x36f2('0x26')](handleError(_0x2779f0,null));};exports['show']=function(_0x91a92c,_0x3a6824){var _0x1ecb91={'raw':!![],'where':{'id':_0x91a92c[_0x36f2('0x27')]['id']}},_0x5699fc={};_0x5699fc[_0x36f2('0x28')]=_['keys'](db[_0x36f2('0x22')]['rawAttributes']);_0x5699fc[_0x36f2('0x29')]=_['keys'](_0x91a92c[_0x36f2('0x29')]);_0x5699fc[_0x36f2('0x2a')]=_['intersection'](_0x5699fc[_0x36f2('0x28')],_0x5699fc[_0x36f2('0x29')]);_0x1ecb91[_0x36f2('0x2b')]=_[_0x36f2('0x2c')](_0x5699fc[_0x36f2('0x28')],qs[_0x36f2('0x2d')](_0x91a92c[_0x36f2('0x29')]['fields']));_0x1ecb91[_0x36f2('0x2b')]=_0x1ecb91['attributes'][_0x36f2('0x2e')]?_0x1ecb91[_0x36f2('0x2b')]:_0x5699fc['model'];if(_0x91a92c[_0x36f2('0x29')][_0x36f2('0x2f')]){_0x1ecb91[_0x36f2('0x23')]=[{'all':!![]}];}_0x1ecb91=_[_0x36f2('0x30')]({},_0x1ecb91,_0x91a92c[_0x36f2('0x31')]);return db['MailQueue'][_0x36f2('0x32')](_0x1ecb91)[_0x36f2('0x15')](handleEntityNotFound(_0x3a6824,null))['then'](respondWithResult(_0x3a6824,null))[_0x36f2('0x26')](handleError(_0x3a6824,null));};exports['create']=function(_0x3e2aa0,_0xd5b78a){return db[_0x36f2('0x22')]['create'](_0x3e2aa0['body'],{})[_0x36f2('0x15')](function(_0x3dbcce){var _0xe60c94=_0x3e2aa0[_0x36f2('0x33')][_0x36f2('0x17')]({'plain':!![]});if(!_0xe60c94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe60c94['role']===_0x36f2('0x33')){var _0x3fa755=_0x3dbcce[_0x36f2('0x17')]({'plain':!![]});var _0x1c2332=_0x36f2('0x34');return db[_0x36f2('0x35')][_0x36f2('0x32')]({'where':{'name':_0x1c2332,'userProfileId':_0xe60c94[_0x36f2('0x36')]},'raw':!![]})['then'](function(_0xabb58b){if(_0xabb58b&&_0xabb58b[_0x36f2('0x37')]===0x0){return db['UserProfileResource'][_0x36f2('0x38')]({'name':_0x3fa755['name'],'resourceId':_0x3fa755['id'],'type':_0xabb58b[_0x36f2('0x39')],'sectionId':_0xabb58b['id']},{})['then'](function(){return _0x3dbcce;});}else{return _0x3dbcce;}})[_0x36f2('0x26')](function(_0x1cfa55){logger['error'](_0x36f2('0x3a'),_0x1cfa55);throw _0x1cfa55;});}return _0x3dbcce;})['then'](respondWithResult(_0xd5b78a,0xc9))[_0x36f2('0x26')](handleError(_0xd5b78a,null));};exports[_0x36f2('0x3b')]=function(_0x488115,_0x4d44a4){if(_0x488115[_0x36f2('0x3c')]['id']){delete _0x488115[_0x36f2('0x3c')]['id'];}return db[_0x36f2('0x22')][_0x36f2('0x32')]({'where':{'id':_0x488115[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x4d44a4,null))[_0x36f2('0x15')](saveUpdates(_0x488115[_0x36f2('0x3c')],null))[_0x36f2('0x15')](respondWithResult(_0x4d44a4,null))[_0x36f2('0x26')](handleError(_0x4d44a4,null));};exports[_0x36f2('0x16')]=function(_0x543d73,_0x1affd6){return db[_0x36f2('0x22')][_0x36f2('0x32')]({'where':{'id':_0x543d73[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x1affd6,null))[_0x36f2('0x15')](removeEntity(_0x1affd6,null))[_0x36f2('0x26')](handleError(_0x1affd6,null));};exports[_0x36f2('0x3d')]=function(_0x16e436,_0x162fbe){return db[_0x36f2('0x22')]['describe']()[_0x36f2('0x15')](respondWithResult(_0x162fbe,null))['catch'](handleError(_0x162fbe,null));};exports[_0x36f2('0x3e')]=function(_0x3b008d,_0x2ebbd4){var _0x5bd4c0={'raw':!![],'where':{}},_0x4ff236={},_0x3d0ce7;return db[_0x36f2('0x22')]['findOne']({'where':{'id':_0x3b008d[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x2ebbd4,null))[_0x36f2('0x15')](function(_0x5231bc){if(_0x5231bc){_0x3d0ce7=_0x5231bc[_0x36f2('0x17')]({'plain':!![]});_0x4ff236[_0x36f2('0x28')]=_[_0x36f2('0x3f')](db[_0x36f2('0x40')][_0x36f2('0x41')]);_0x4ff236['query']=_[_0x36f2('0x3f')](_0x3b008d[_0x36f2('0x29')]);_0x4ff236[_0x36f2('0x2a')]=_[_0x36f2('0x2c')](_0x4ff236[_0x36f2('0x28')],_0x4ff236[_0x36f2('0x29')]);_0x5bd4c0[_0x36f2('0x2b')]=_[_0x36f2('0x2c')](_0x4ff236[_0x36f2('0x28')],qs[_0x36f2('0x2d')](_0x3b008d['query'][_0x36f2('0x2d')]));_0x5bd4c0[_0x36f2('0x2b')]=_0x5bd4c0[_0x36f2('0x2b')][_0x36f2('0x2e')]?_0x5bd4c0['attributes']:_0x4ff236[_0x36f2('0x28')];if(!_0x3b008d[_0x36f2('0x29')][_0x36f2('0x42')](_0x36f2('0x43'))){_0x5bd4c0['limit']=qs[_0x36f2('0x10')](_0x3b008d[_0x36f2('0x29')][_0x36f2('0x10')]);_0x5bd4c0[_0x36f2('0x11')]=qs[_0x36f2('0x11')](_0x3b008d['query'][_0x36f2('0x11')]);}_0x5bd4c0['order']=qs[_0x36f2('0x44')](_0x3b008d[_0x36f2('0x29')][_0x36f2('0x44')]);_0x5bd4c0[_0x36f2('0x21')]=qs['filters'](_['pick'](_0x3b008d[_0x36f2('0x29')],_0x4ff236[_0x36f2('0x2a')]));_0x5bd4c0[_0x36f2('0x21')][_0x36f2('0x45')]=_0x5231bc['id'];if(_0x3b008d[_0x36f2('0x29')][_0x36f2('0x46')]){_0x5bd4c0['where']=_[_0x36f2('0x30')](_0x5bd4c0['where'],{'$or':_[_0x36f2('0x1c')](_0x5bd4c0[_0x36f2('0x2b')],function(_0x362b4a){var _0x12275b={};_0x12275b[_0x362b4a]={'$like':'%'+_0x3b008d[_0x36f2('0x29')][_0x36f2('0x46')]+'%'};return _0x12275b;})});}_0x5bd4c0=_[_0x36f2('0x30')]({},_0x5bd4c0,_0x3b008d[_0x36f2('0x31')]);return db['UserMailQueue']['findAll'](_0x5bd4c0);}})[_0x36f2('0x15')](function(_0x5194e2){if(_0x5194e2){return db[_0x36f2('0x47')][_0x36f2('0x48')]({'where':{'id':_[_0x36f2('0x1c')](_0x5194e2,_0x36f2('0x49')),'role':'agent'},'attributes':['id',_0x36f2('0x39'),'mailPause',_0x36f2('0x4a'),_0x36f2('0x4b')]});}})[_0x36f2('0x15')](function(_0x457c9b){if(_0x457c9b){return{'count':_0x457c9b['count'],'rows':_['map'](_0x457c9b['rows'],function(_0xd5559f){return{'membername':_0xd5559f[_0x36f2('0x39')],'UserId':_0xd5559f['id'],'queue_name':_0x3d0ce7['name'],'MailQueueId':_0x3d0ce7['id'],'interface':util['format'](_0x36f2('0x4c'),_0x36f2('0x4d'),_0xd5559f[_0x36f2('0x39')]),'penalty':0x0,'paused':_0xd5559f[_0x36f2('0x4e')],'createdAt':_0xd5559f[_0x36f2('0x4b')],'updatedAt':_0xd5559f[_0x36f2('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ebbd4,_0x5bd4c0))[_0x36f2('0x26')](handleError(_0x2ebbd4,null));};exports['getTeams']=function(_0xc6c0c0,_0x1ce6e1){var _0x12e8a2={};var _0x5460c7={};var _0x341230;var _0x31cee7;return db[_0x36f2('0x22')]['findOne']({'where':{'id':_0xc6c0c0[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x1ce6e1,null))[_0x36f2('0x15')](function(_0xb368a4){if(_0xb368a4){_0x341230=_0xb368a4;_0x5460c7[_0x36f2('0x28')]=_['keys'](db['Team'][_0x36f2('0x41')]);_0x5460c7[_0x36f2('0x29')]=_['keys'](_0xc6c0c0['query']);_0x5460c7[_0x36f2('0x2a')]=_['intersection'](_0x5460c7[_0x36f2('0x28')],_0x5460c7[_0x36f2('0x29')]);_0x12e8a2[_0x36f2('0x2b')]=_[_0x36f2('0x2c')](_0x5460c7[_0x36f2('0x28')],qs[_0x36f2('0x2d')](_0xc6c0c0['query']['fields']));_0x12e8a2[_0x36f2('0x2b')]=_0x12e8a2[_0x36f2('0x2b')]['length']?_0x12e8a2[_0x36f2('0x2b')]:_0x5460c7[_0x36f2('0x28')];_0x12e8a2[_0x36f2('0x4f')]=qs[_0x36f2('0x44')](_0xc6c0c0[_0x36f2('0x29')]['sort']);_0x12e8a2[_0x36f2('0x21')]=qs[_0x36f2('0x2a')](_[_0x36f2('0x50')](_0xc6c0c0[_0x36f2('0x29')],_0x5460c7[_0x36f2('0x2a')]));if(_0xc6c0c0[_0x36f2('0x29')][_0x36f2('0x46')]){_0x12e8a2[_0x36f2('0x21')]=_[_0x36f2('0x30')](_0x12e8a2[_0x36f2('0x21')],{'$or':_[_0x36f2('0x1c')](_0x12e8a2[_0x36f2('0x2b')],function(_0x2242d8){var _0x1131b3={};_0x1131b3[_0x2242d8]={'$like':'%'+_0xc6c0c0[_0x36f2('0x29')][_0x36f2('0x46')]+'%'};return _0x1131b3;})});}_0x12e8a2=_[_0x36f2('0x30')]({},_0x12e8a2,_0xc6c0c0[_0x36f2('0x31')]);return _0x341230[_0x36f2('0x51')](_0x12e8a2);}})[_0x36f2('0x15')](function(_0x1497de){if(_0x1497de){_0x31cee7=_0x1497de[_0x36f2('0x2e')];if(!_0xc6c0c0['query']['hasOwnProperty']('nolimit')){_0x12e8a2[_0x36f2('0x10')]=qs[_0x36f2('0x10')](_0xc6c0c0[_0x36f2('0x29')][_0x36f2('0x10')]);_0x12e8a2[_0x36f2('0x11')]=qs[_0x36f2('0x11')](_0xc6c0c0[_0x36f2('0x29')]['offset']);}return _0x341230[_0x36f2('0x51')](_0x12e8a2);}})[_0x36f2('0x15')](function(_0x4212c2){if(_0x4212c2){return _0x4212c2?{'count':_0x31cee7,'rows':_0x4212c2}:null;}})['then'](respondWithResult(_0x1ce6e1,null))[_0x36f2('0x26')](handleError(_0x1ce6e1,null));};exports[_0x36f2('0x52')]=function(_0x20342d,_0x744a5f){var _0x21bb6c=_0x20342d['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x21bb6c},'attributes':['id'],'include':[{'model':db[_0x36f2('0x47')],'as':_0x36f2('0x53'),'attributes':['id',_0x36f2('0x39'),'online',_0x36f2('0x54'),_0x36f2('0x55')],'raw':!![]}]})[_0x36f2('0x15')](function(_0x4a151d){if(_0x4a151d){var _0x518466=_[_0x36f2('0x56')](_0x4a151d,function(_0x426c66){var _0x5e042e=_0x426c66[_0x36f2('0x17')]({'plain':!![]});return _0x5e042e[_0x36f2('0x53')];});return db['MailQueue'][_0x36f2('0x32')]({'where':{'id':_0x20342d[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](function(_0x4bf3e5){return db[_0x36f2('0x57')][_0x36f2('0x58')](function(_0x35b643){return _0x4bf3e5[_0x36f2('0x52')](_0x21bb6c,{'transaction':_0x35b643})[_0x36f2('0x15')](function(){return BPromise[_0x36f2('0x59')](_0x518466,function(_0x4d1072){return db[_0x36f2('0x40')][_0x36f2('0x5a')]({'where':{'UserId':_0x4d1072['id'],'MailQueueId':_0x20342d[_0x36f2('0x27')]['id']},'transaction':_0x35b643});});})[_0x36f2('0x15')](function(){_0x518466[_0x36f2('0x5b')](function(_0x1b38da){socket[_0x36f2('0x5c')](_0x36f2('0x5d'),{'UserId':_0x1b38da['id'],'MailQueueId':_0x4bf3e5['id']});});});});});}})['then'](respondWithStatusCode(_0x744a5f,null))[_0x36f2('0x26')](handleError(_0x744a5f,null));};exports[_0x36f2('0x5e')]=function(_0x29ef92,_0x9c169e){return db[_0x36f2('0x5f')]['findAll']({'where':{'id':_0x29ef92[_0x36f2('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0x36f2('0x47')],'as':_0x36f2('0x53'),'attributes':['id'],'raw':!![]}]})[_0x36f2('0x15')](handleEntityNotFound(_0x9c169e,null))[_0x36f2('0x15')](function(_0x2047d9){var _0x1480c2=_[_0x36f2('0x1c')](_0x2047d9,'id');var _0x359fbe=[];var _0x299042=[];var _0x4b60fa=squel['select']();_0x4b60fa[_0x36f2('0x60')]('tq.TeamId')[_0x36f2('0x61')]('team_has_mail_queues','tq')[_0x36f2('0x62')](_0x36f2('0x63'),'ut',_0x36f2('0x64'))[_0x36f2('0x21')]('MailQueueId\x20=\x20?',_0x29ef92[_0x36f2('0x27')]['id']);for(var _0x58934b=0x0;_0x58934b<_0x2047d9[_0x36f2('0x2e')];_0x58934b+=0x1){let _0x4984d0=_0x2047d9[_0x58934b];for(var _0x30b8fa=0x0;_0x30b8fa<_0x4984d0['Agents']['length'];_0x30b8fa+=0x1){let _0x512900=_0x4984d0[_0x36f2('0x53')][_0x30b8fa];var _0x1ecdac=_0x4b60fa[_0x36f2('0x65')]();_0x1ecdac[_0x36f2('0x21')](_0x36f2('0x66'),_0x512900['id']);_0x299042[_0x36f2('0x67')](db[_0x36f2('0x57')][_0x36f2('0x29')](_0x1ecdac[_0x36f2('0x68')](),{'type':db['sequelize'][_0x36f2('0x69')]['SELECT']})[_0x36f2('0x15')](function(_0x23c77b){if(_0x23c77b[_0x36f2('0x2e')]===0x1){return _0x512900['id'];}else{var _0x92911b=_[_0x36f2('0x6a')](_['map'](_0x23c77b,'TeamId'),function(_0x4bd86c){return _[_0x36f2('0x6b')](_0x1480c2,_0x4bd86c);});if(_0x92911b){return _0x512900['id'];}}}));}}return BPromise['all'](_0x299042)['then'](function(_0x8adf38){_0x359fbe=_(_0x359fbe)[_0x36f2('0x6c')](_0x8adf38)['compact']()[_0x36f2('0x6d')]();return db[_0x36f2('0x22')][_0x36f2('0x32')]({'where':{'id':_0x29ef92[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](function(_0x2e665a){return db['sequelize'][_0x36f2('0x58')](function(_0x48608c){return _0x2e665a[_0x36f2('0x5e')](_0x29ef92[_0x36f2('0x29')][_0x36f2('0x6e')],{'transaction':_0x48608c})[_0x36f2('0x15')](function(){if(!_[_0x36f2('0x6f')](_0x359fbe)){return _0x2e665a['removeAgents'](_0x359fbe,{'transaction':_0x48608c});}})[_0x36f2('0x15')](function(){_0x359fbe['forEach'](function(_0xaa07a6){socket['emit']('userMailQueue:remove',{'UserId':_0xaa07a6,'MailQueueId':_0x2e665a['id']});});});});});});})[_0x36f2('0x15')](respondWithStatusCode(_0x9c169e,null))['catch'](handleError(_0x9c169e,null));};exports['addAgents']=function(_0x1cbf17,_0x182764){return db['MailQueue'][_0x36f2('0x32')]({'where':{'id':_0x1cbf17[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x182764,null))['then'](function(_0x352880){if(_0x352880){return _0x352880[_0x36f2('0x70')](_0x1cbf17[_0x36f2('0x3c')][_0x36f2('0x6e')],_[_0x36f2('0x71')](_0x1cbf17[_0x36f2('0x3c')],[_0x36f2('0x6e'),'id'])||{})['spread'](function(_0x235cfd){for(var _0x160d3d=0x0;_0x160d3d<_0x1cbf17[_0x36f2('0x3c')][_0x36f2('0x6e')][_0x36f2('0x2e')];_0x160d3d+=0x1){socket[_0x36f2('0x5c')](_0x36f2('0x5d'),{'UserId':Number(_0x1cbf17[_0x36f2('0x3c')][_0x36f2('0x6e')][_0x160d3d]),'MailQueueId':Number(_0x1cbf17[_0x36f2('0x27')]['id'])});}return _0x235cfd;});}})[_0x36f2('0x15')](respondWithResult(_0x182764,null))[_0x36f2('0x26')](handleError(_0x182764,null));};exports[_0x36f2('0x72')]=function(_0x5a7d1b,_0x53e5e5){return db[_0x36f2('0x22')]['find']({'where':{'id':_0x5a7d1b['params']['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x53e5e5,null))[_0x36f2('0x15')](function(_0xd757d6){if(_0xd757d6){return _0xd757d6[_0x36f2('0x72')](_0x5a7d1b[_0x36f2('0x29')]['ids'])[_0x36f2('0x15')](function(){if(_['isArray'](_0x5a7d1b[_0x36f2('0x29')]['ids'])){for(var _0x5b1df8=0x0;_0x5b1df8<_0x5a7d1b[_0x36f2('0x29')]['ids']['length'];_0x5b1df8+=0x1){socket[_0x36f2('0x5c')]('userMailQueue:remove',{'UserId':Number(_0x5a7d1b[_0x36f2('0x29')][_0x36f2('0x6e')][_0x5b1df8]),'MailQueueId':Number(_0x5a7d1b[_0x36f2('0x27')]['id'])});}}else{socket[_0x36f2('0x5c')]('userMailQueue:remove',{'UserId':Number(_0x5a7d1b[_0x36f2('0x29')][_0x36f2('0x6e')]),'MailQueueId':Number(_0x5a7d1b[_0x36f2('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x53e5e5,null))['catch'](handleError(_0x53e5e5,null));};exports[_0x36f2('0x73')]=function(_0x16ab60,_0x10affb){var _0x59a9e2={};var _0x43396e={};var _0x2e5cab;var _0x45ef0b;return db['MailQueue'][_0x36f2('0x74')]({'where':{'id':_0x16ab60[_0x36f2('0x27')]['id']}})[_0x36f2('0x15')](handleEntityNotFound(_0x10affb,null))['then'](function(_0x61f99){if(_0x61f99){_0x2e5cab=_0x61f99;_0x43396e['model']=_[_0x36f2('0x3f')](db['User'][_0x36f2('0x41')]);_0x43396e[_0x36f2('0x29')]=_['keys'](_0x16ab60[_0x36f2('0x29')]);_0x43396e['filters']=_[_0x36f2('0x2c')](_0x43396e[_0x36f2('0x28')],_0x43396e[_0x36f2('0x29')]);_0x59a9e2[_0x36f2('0x2b')]=_[_0x36f2('0x2c')](_0x43396e[_0x36f2('0x28')],qs[_0x36f2('0x2d')](_0x16ab60[_0x36f2('0x29')]['fields']));_0x59a9e2['attributes']=_0x59a9e2[_0x36f2('0x2b')][_0x36f2('0x2e')]?_0x59a9e2['attributes']:_0x43396e['model'];_0x59a9e2['order']=qs['sort'](_0x16ab60[_0x36f2('0x29')][_0x36f2('0x44')]);_0x59a9e2[_0x36f2('0x21')]=qs['filters'](_['pick'](_0x16ab60[_0x36f2('0x29')],_0x43396e[_0x36f2('0x2a')]));if(_0x16ab60['query']['filter']){_0x59a9e2[_0x36f2('0x21')]=_[_0x36f2('0x30')](_0x59a9e2['where'],{'$or':_['map'](_0x59a9e2['attributes'],function(_0x125540){var _0xff9e2b={};_0xff9e2b[_0x125540]={'$like':'%'+_0x16ab60[_0x36f2('0x29')][_0x36f2('0x46')]+'%'};return _0xff9e2b;})});}_0x59a9e2=_[_0x36f2('0x30')]({},_0x59a9e2,_0x16ab60[_0x36f2('0x31')]);return _0x2e5cab[_0x36f2('0x73')](_0x59a9e2);}})[_0x36f2('0x15')](function(_0x1fc361){if(_0x1fc361){_0x45ef0b=_0x1fc361[_0x36f2('0x2e')];if(!_0x16ab60[_0x36f2('0x29')][_0x36f2('0x42')](_0x36f2('0x43'))){_0x59a9e2[_0x36f2('0x10')]=qs[_0x36f2('0x10')](_0x16ab60['query'][_0x36f2('0x10')]);_0x59a9e2['offset']=qs[_0x36f2('0x11')](_0x16ab60[_0x36f2('0x29')][_0x36f2('0x11')]);}return _0x2e5cab[_0x36f2('0x73')](_0x59a9e2);}})[_0x36f2('0x15')](function(_0x78f466){if(_0x78f466){return _0x78f466?{'count':_0x45ef0b,'rows':_0x78f466}:null;}})[_0x36f2('0x15')](respondWithResult(_0x10affb,null))['catch'](handleError(_0x10affb,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 95155b4..2ddb3e8 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 _0x4917=['save','update','emit','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x31d37c,_0x572b1f){var _0x25c904=function(_0x6358f0){while(--_0x6358f0){_0x31d37c['push'](_0x31d37c['shift']());}};_0x25c904(++_0x572b1f);}(_0x4917,0x18c));var _0x7491=function(_0x3dea8b,_0x231a01){_0x3dea8b=_0x3dea8b-0x0;var _0x3a511e=_0x4917[_0x3dea8b];return _0x3a511e;};'use strict';var EventEmitter=require(_0x7491('0x0'));var MailQueue=require(_0x7491('0x1'))['db'][_0x7491('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7491('0x3')](0x0);var events={'afterCreate':_0x7491('0x4'),'afterUpdate':_0x7491('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2784af){return function(_0x363749,_0x189c2f,_0x1ab3be){MailQueueEvents[_0x7491('0x6')](_0x2784af+':'+_0x363749['id'],_0x363749);MailQueueEvents[_0x7491('0x6')](_0x2784af,_0x363749);_0x1ab3be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x7491('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x9d91=['events','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2e8229,_0x482702){var _0x20a7e4=function(_0x46d62c){while(--_0x46d62c){_0x2e8229['push'](_0x2e8229['shift']());}};_0x20a7e4(++_0x482702);}(_0x9d91,0xc8));var _0x19d9=function(_0x584a28,_0x43e989){_0x584a28=_0x584a28-0x0;var _0x442e09=_0x9d91[_0x584a28];return _0x442e09;};'use strict';var EventEmitter=require(_0x19d9('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x19d9('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x19d9('0x2')](0x0);var events={'afterCreate':_0x19d9('0x3'),'afterUpdate':_0x19d9('0x4'),'afterDestroy':_0x19d9('0x5')};function emitEvent(_0xf2e3d3){return function(_0x3d9468,_0x27edc6,_0x55182f){MailQueueEvents[_0x19d9('0x6')](_0xf2e3d3+':'+_0x3d9468['id'],_0x3d9468);MailQueueEvents[_0x19d9('0x6')](_0xf2e3d3,_0x3d9468);_0x55182f(null);};}for(var e in events){if(events[_0x19d9('0x7')](e)){var event=events[e];MailQueue[_0x19d9('0x8')](e,emitEvent(event));}}module[_0x19d9('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b33664f..f5547d4 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 _0x7168=['rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x325fab,_0x20b721){var _0x4553c2=function(_0x2d5f5f){while(--_0x2d5f5f){_0x325fab['push'](_0x325fab['shift']());}};_0x4553c2(++_0x20b721);}(_0x7168,0x18d));var _0x8716=function(_0x2463f0,_0x11f4e0){_0x2463f0=_0x2463f0-0x0;var _0x1e6a90=_0x7168[_0x2463f0];return _0x1e6a90;};'use strict';var _=require(_0x8716('0x0'));var util=require(_0x8716('0x1'));var logger=require(_0x8716('0x2'))(_0x8716('0x3'));var moment=require('moment');var BPromise=require(_0x8716('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8716('0x5'));var rimraf=require(_0x8716('0x6'));var config=require(_0x8716('0x7'));var attributes=require(_0x8716('0x8'));module[_0x8716('0x9')]=function(_0xd69cc3,_0x37a96e){return _0xd69cc3[_0x8716('0xa')](_0x8716('0xb'),attributes,{'tableName':_0x8716('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a0f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailQueue.attributes','define','lodash'];(function(_0x3cc74a,_0x5b7948){var _0x2e7974=function(_0x3fde15){while(--_0x3fde15){_0x3cc74a['push'](_0x3cc74a['shift']());}};_0x2e7974(++_0x5b7948);}(_0x5a0f,0x1a3));var _0xf5a0=function(_0x557870,_0x3482f6){_0x557870=_0x557870-0x0;var _0x4fc6e1=_0x5a0f[_0x557870];return _0x4fc6e1;};'use strict';var _=require(_0xf5a0('0x0'));var util=require(_0xf5a0('0x1'));var logger=require(_0xf5a0('0x2'))(_0xf5a0('0x3'));var moment=require(_0xf5a0('0x4'));var BPromise=require(_0xf5a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5a0('0x6'));var rimraf=require('rimraf');var config=require(_0xf5a0('0x7'));var attributes=require(_0xf5a0('0x8'));module['exports']=function(_0xea2040,_0x3262dc){return _0xea2040[_0xf5a0('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index b96fdf7..a27c91d 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 _0x4fa1=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','find','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x4fa1,0xb1));var _0x14fa=function(_0x2441fe,_0x13f1b0){_0x2441fe=_0x2441fe-0x0;var _0x46cb5a=_0x4fa1[_0x2441fe];return _0x46cb5a;};'use strict';var _=require(_0x14fa('0x0'));var util=require(_0x14fa('0x1'));var moment=require(_0x14fa('0x2'));var BPromise=require(_0x14fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14fa('0x4'));var db=require(_0x14fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14fa('0x6'))('rpc');var config=require(_0x14fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x14fa('0x8')][_0x14fa('0x9')]({'port':0x232a});config[_0x14fa('0xa')]=_[_0x14fa('0xb')](config[_0x14fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14fa('0xa')]));require(_0x14fa('0xc'))[_0x14fa('0xd')](socket);function respondWithRpcPromise(_0x40f550,_0x3c75a3,_0xf51d52){return new BPromise(function(_0x2831cd,_0x57f410){return client[_0x14fa('0xe')](_0x40f550,_0xf51d52)[_0x14fa('0xf')](function(_0x554f5d){logger['info'](_0x14fa('0x10'),_0x3c75a3,_0x14fa('0x11'));logger[_0x14fa('0x12')](_0x14fa('0x13'),_0x3c75a3,_0x14fa('0x11'),JSON[_0x14fa('0x14')](_0x554f5d));if(_0x554f5d['error']){if(_0x554f5d[_0x14fa('0x15')][_0x14fa('0x16')]===0x1f4){logger[_0x14fa('0x15')]('MailQueue,\x20%s,\x20%s',_0x3c75a3,_0x554f5d[_0x14fa('0x15')][_0x14fa('0x17')]);return _0x57f410(_0x554f5d[_0x14fa('0x15')]['message']);}logger[_0x14fa('0x15')](_0x14fa('0x10'),_0x3c75a3,_0x554f5d['error'][_0x14fa('0x17')]);return _0x2831cd(_0x554f5d[_0x14fa('0x15')][_0x14fa('0x17')]);}else{logger[_0x14fa('0x18')](_0x14fa('0x10'),_0x3c75a3,_0x14fa('0x11'));_0x2831cd(_0x554f5d[_0x14fa('0x19')]['message']);}})[_0x14fa('0x1a')](function(_0x117cbc){logger[_0x14fa('0x15')](_0x14fa('0x10'),_0x3c75a3,_0x117cbc);_0x57f410(_0x117cbc);});});}exports[_0x14fa('0x1b')]=function(_0x2aff85){var _0x50aeb0=this;return new Promise(function(_0x47d8a4,_0x18af3f){return db[_0x14fa('0x1c')][_0x14fa('0x1d')]({'raw':_0x2aff85['options']?_0x2aff85[_0x14fa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2aff85[_0x14fa('0x1e')]?_0x2aff85[_0x14fa('0x1e')][_0x14fa('0x1f')]||null:null,'attributes':_0x2aff85[_0x14fa('0x1e')]?_0x2aff85[_0x14fa('0x1e')][_0x14fa('0x20')]||null:null,'limit':_0x2aff85[_0x14fa('0x1e')]?_0x2aff85['options'][_0x14fa('0x21')]||null:null,'include':_0x2aff85['options']?_0x2aff85[_0x14fa('0x1e')][_0x14fa('0x22')]?_[_0x14fa('0x23')](_0x2aff85[_0x14fa('0x1e')][_0x14fa('0x22')],function(_0x1d6168){return{'model':db[_0x1d6168[_0x14fa('0x24')]],'as':_0x1d6168['as'],'attributes':_0x1d6168[_0x14fa('0x20')],'include':_0x1d6168[_0x14fa('0x22')]?_[_0x14fa('0x23')](_0x1d6168[_0x14fa('0x22')],function(_0x2b779a){return{'model':db[_0x2b779a[_0x14fa('0x24')]],'as':_0x2b779a['as'],'attributes':_0x2b779a[_0x14fa('0x20')],'include':_0x2b779a[_0x14fa('0x22')]?_[_0x14fa('0x23')](_0x2b779a[_0x14fa('0x22')],function(_0x4e20fa){return{'model':db[_0x4e20fa[_0x14fa('0x24')]],'as':_0x4e20fa['as'],'attributes':_0x4e20fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x14fa('0xf')](function(_0xf74036){logger[_0x14fa('0x18')]('GetMailQueue',_0x2aff85);logger[_0x14fa('0x12')](_0x14fa('0x1b'),_0x2aff85,JSON[_0x14fa('0x14')](_0xf74036));_0x47d8a4(_0xf74036);})[_0x14fa('0x1a')](function(_0x101e7f){logger[_0x14fa('0x15')](_0x14fa('0x1b'),_0x101e7f[_0x14fa('0x17')],_0x2aff85);_0x18af3f(_0x50aeb0[_0x14fa('0x15')](0x1f4,_0x101e7f[_0x14fa('0x17')]));});});};exports['ShowMailQueue']=function(_0x54fa3d){var _0xa9d417=this;return new Promise(function(_0x269acb,_0x5d9471){return db[_0x14fa('0x1c')][_0x14fa('0x25')]({'raw':_0x54fa3d[_0x14fa('0x1e')]?_0x54fa3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x54fa3d['options']?_0x54fa3d[_0x14fa('0x1e')][_0x14fa('0x1f')]||null:null,'attributes':_0x54fa3d[_0x14fa('0x1e')]?_0x54fa3d[_0x14fa('0x1e')][_0x14fa('0x20')]||null:null,'include':_0x54fa3d['options']?_0x54fa3d['options']['include']?_[_0x14fa('0x23')](_0x54fa3d['options'][_0x14fa('0x22')],function(_0x3c82b1){return{'model':db[_0x3c82b1['model']],'as':_0x3c82b1['as'],'attributes':_0x3c82b1[_0x14fa('0x20')],'include':_0x3c82b1[_0x14fa('0x22')]?_[_0x14fa('0x23')](_0x3c82b1[_0x14fa('0x22')],function(_0x258ae4){return{'model':db[_0x258ae4['model']],'as':_0x258ae4['as'],'attributes':_0x258ae4[_0x14fa('0x20')],'include':_0x258ae4[_0x14fa('0x22')]?_[_0x14fa('0x23')](_0x258ae4[_0x14fa('0x22')],function(_0x443575){return{'model':db[_0x443575['model']],'as':_0x443575['as'],'attributes':_0x443575[_0x14fa('0x20')]};}):[]};}):[]};}):[]:[]})[_0x14fa('0xf')](function(_0x2f2a60){logger[_0x14fa('0x18')](_0x14fa('0x26'),_0x54fa3d);logger['debug'](_0x14fa('0x26'),_0x54fa3d,JSON[_0x14fa('0x14')](_0x2f2a60));_0x269acb(_0x2f2a60);})['catch'](function(_0x268ba0){logger['error']('ShowMailQueue',_0x268ba0['message'],_0x54fa3d);_0x5d9471(_0xa9d417['error'](0x1f4,_0x268ba0[_0x14fa('0x17')]));});});}; \ No newline at end of file +var _0x5fbd=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','info','result','GetMailQueue','findAll','options','raw','where','limit','include','map','attributes','model','catch','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x52bbb7,_0x52b229){var _0x2f8c40=function(_0x43dc7f){while(--_0x43dc7f){_0x52bbb7['push'](_0x52bbb7['shift']());}};_0x2f8c40(++_0x52b229);}(_0x5fbd,0xea));var _0xd5fb=function(_0x374d6f,_0x52afe6){_0x374d6f=_0x374d6f-0x0;var _0x4b4347=_0x5fbd[_0x374d6f];return _0x4b4347;};'use strict';var _=require(_0xd5fb('0x0'));var util=require(_0xd5fb('0x1'));var moment=require(_0xd5fb('0x2'));var BPromise=require(_0xd5fb('0x3'));var rs=require(_0xd5fb('0x4'));var fs=require('fs');var Redis=require(_0xd5fb('0x5'));var db=require(_0xd5fb('0x6'))['db'];var utils=require(_0xd5fb('0x7'));var logger=require(_0xd5fb('0x8'))('rpc');var config=require(_0xd5fb('0x9'));var jayson=require(_0xd5fb('0xa'));var client=jayson[_0xd5fb('0xb')][_0xd5fb('0xc')]({'port':0x232a});config[_0xd5fb('0xd')]=_[_0xd5fb('0xe')](config[_0xd5fb('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5fb('0xf'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x16c702,_0x51a30d,_0x2bb8ee){return new BPromise(function(_0x35b15f,_0x3fa9a9){return client[_0xd5fb('0x10')](_0x16c702,_0x2bb8ee)[_0xd5fb('0x11')](function(_0x29dccd){logger['info']('MailQueue,\x20%s,\x20%s',_0x51a30d,_0xd5fb('0x12'));logger[_0xd5fb('0x13')](_0xd5fb('0x14'),_0x51a30d,'request\x20sent',JSON[_0xd5fb('0x15')](_0x29dccd));if(_0x29dccd[_0xd5fb('0x16')]){if(_0x29dccd[_0xd5fb('0x16')]['code']===0x1f4){logger[_0xd5fb('0x16')]('MailQueue,\x20%s,\x20%s',_0x51a30d,_0x29dccd['error']['message']);return _0x3fa9a9(_0x29dccd[_0xd5fb('0x16')]['message']);}logger[_0xd5fb('0x16')](_0xd5fb('0x17'),_0x51a30d,_0x29dccd['error'][_0xd5fb('0x18')]);return _0x35b15f(_0x29dccd[_0xd5fb('0x16')][_0xd5fb('0x18')]);}else{logger[_0xd5fb('0x19')]('MailQueue,\x20%s,\x20%s',_0x51a30d,'request\x20sent');_0x35b15f(_0x29dccd[_0xd5fb('0x1a')][_0xd5fb('0x18')]);}})['catch'](function(_0x20da6d){logger[_0xd5fb('0x16')]('MailQueue,\x20%s,\x20%s',_0x51a30d,_0x20da6d);_0x3fa9a9(_0x20da6d);});});}exports[_0xd5fb('0x1b')]=function(_0x3f04a6){var _0x52cdb6=this;return new Promise(function(_0x868ee6,_0x4083b3){return db['MailQueue'][_0xd5fb('0x1c')]({'raw':_0x3f04a6[_0xd5fb('0x1d')]?_0x3f04a6['options'][_0xd5fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f04a6[_0xd5fb('0x1d')]?_0x3f04a6['options'][_0xd5fb('0x1f')]||null:null,'attributes':_0x3f04a6['options']?_0x3f04a6[_0xd5fb('0x1d')]['attributes']||null:null,'limit':_0x3f04a6[_0xd5fb('0x1d')]?_0x3f04a6[_0xd5fb('0x1d')][_0xd5fb('0x20')]||null:null,'include':_0x3f04a6[_0xd5fb('0x1d')]?_0x3f04a6[_0xd5fb('0x1d')][_0xd5fb('0x21')]?_[_0xd5fb('0x22')](_0x3f04a6[_0xd5fb('0x1d')][_0xd5fb('0x21')],function(_0x204850){return{'model':db[_0x204850['model']],'as':_0x204850['as'],'attributes':_0x204850[_0xd5fb('0x23')],'include':_0x204850['include']?_[_0xd5fb('0x22')](_0x204850['include'],function(_0x4586f5){return{'model':db[_0x4586f5[_0xd5fb('0x24')]],'as':_0x4586f5['as'],'attributes':_0x4586f5['attributes'],'include':_0x4586f5[_0xd5fb('0x21')]?_[_0xd5fb('0x22')](_0x4586f5['include'],function(_0x43f7f5){return{'model':db[_0x43f7f5[_0xd5fb('0x24')]],'as':_0x43f7f5['as'],'attributes':_0x43f7f5[_0xd5fb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd5fb('0x11')](function(_0x29738c){logger[_0xd5fb('0x19')](_0xd5fb('0x1b'),_0x3f04a6);logger[_0xd5fb('0x13')](_0xd5fb('0x1b'),_0x3f04a6,JSON[_0xd5fb('0x15')](_0x29738c));_0x868ee6(_0x29738c);})[_0xd5fb('0x25')](function(_0x124f44){logger[_0xd5fb('0x16')](_0xd5fb('0x1b'),_0x124f44['message'],_0x3f04a6);_0x4083b3(_0x52cdb6[_0xd5fb('0x16')](0x1f4,_0x124f44[_0xd5fb('0x18')]));});});};exports['ShowMailQueue']=function(_0x4c9783){var _0x5642e3=this;return new Promise(function(_0x263622,_0x564f32){return db['MailQueue'][_0xd5fb('0x26')]({'raw':_0x4c9783[_0xd5fb('0x1d')]?_0x4c9783[_0xd5fb('0x1d')][_0xd5fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c9783[_0xd5fb('0x1d')]?_0x4c9783['options'][_0xd5fb('0x1f')]||null:null,'attributes':_0x4c9783[_0xd5fb('0x1d')]?_0x4c9783[_0xd5fb('0x1d')][_0xd5fb('0x23')]||null:null,'include':_0x4c9783[_0xd5fb('0x1d')]?_0x4c9783[_0xd5fb('0x1d')][_0xd5fb('0x21')]?_[_0xd5fb('0x22')](_0x4c9783[_0xd5fb('0x1d')][_0xd5fb('0x21')],function(_0x4e2d48){return{'model':db[_0x4e2d48[_0xd5fb('0x24')]],'as':_0x4e2d48['as'],'attributes':_0x4e2d48[_0xd5fb('0x23')],'include':_0x4e2d48['include']?_[_0xd5fb('0x22')](_0x4e2d48['include'],function(_0x16ad3b){return{'model':db[_0x16ad3b[_0xd5fb('0x24')]],'as':_0x16ad3b['as'],'attributes':_0x16ad3b['attributes'],'include':_0x16ad3b[_0xd5fb('0x21')]?_['map'](_0x16ad3b[_0xd5fb('0x21')],function(_0x5144c6){return{'model':db[_0x5144c6['model']],'as':_0x5144c6['as'],'attributes':_0x5144c6[_0xd5fb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd5fb('0x11')](function(_0x1e56bc){logger[_0xd5fb('0x19')](_0xd5fb('0x27'),_0x4c9783);logger[_0xd5fb('0x13')](_0xd5fb('0x27'),_0x4c9783,JSON['stringify'](_0x1e56bc));_0x263622(_0x1e56bc);})[_0xd5fb('0x25')](function(_0x4de092){logger[_0xd5fb('0x16')](_0xd5fb('0x27'),_0x4de092[_0xd5fb('0x18')],_0x4c9783);_0x564f32(_0x5642e3[_0xd5fb('0x16')](0x1f4,_0x4de092[_0xd5fb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 44bb656..9a60695 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 _0x51f9=['length','mailQueue:','./mailQueue.events','save','update','emit','removeListener','register'];(function(_0x44156d,_0x555ce8){var _0x123f0c=function(_0x2b3721){while(--_0x2b3721){_0x44156d['push'](_0x44156d['shift']());}};_0x123f0c(++_0x555ce8);}(_0x51f9,0x132));var _0x951f=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x51f9[_0x2932cf];return _0x1711dd;};'use strict';var MailQueueEvents=require(_0x951f('0x0'));var events=[_0x951f('0x1'),'remove',_0x951f('0x2')];function createListener(_0x3739ed,_0x3fd3c9){return function(_0x571465){_0x3fd3c9[_0x951f('0x3')](_0x3739ed,_0x571465);};}function removeListener(_0x389886,_0x16fbe1){return function(){MailQueueEvents[_0x951f('0x4')](_0x389886,_0x16fbe1);};}exports[_0x951f('0x5')]=function(_0xd80e8a){for(var _0x2ca4e0=0x0,_0x4aca31=events[_0x951f('0x6')];_0x2ca4e0<_0x4aca31;_0x2ca4e0++){var _0x1ad764=events[_0x2ca4e0];var _0x1c8fc1=createListener(_0x951f('0x7')+_0x1ad764,_0xd80e8a);MailQueueEvents['on'](_0x1ad764,_0x1c8fc1);}}; \ No newline at end of file +var _0x7292=['update','removeListener','register','length','./mailQueue.events','save','remove'];(function(_0x355338,_0x3cf0b1){var _0x4bbe4b=function(_0x4a73ab){while(--_0x4a73ab){_0x355338['push'](_0x355338['shift']());}};_0x4bbe4b(++_0x3cf0b1);}(_0x7292,0x107));var _0x2729=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7292[_0x465028];return _0xb783d4;};'use strict';var MailQueueEvents=require(_0x2729('0x0'));var events=[_0x2729('0x1'),_0x2729('0x2'),_0x2729('0x3')];function createListener(_0x44519c,_0xdd7bf4){return function(_0x398319){_0xdd7bf4['emit'](_0x44519c,_0x398319);};}function removeListener(_0x400b66,_0x45977a){return function(){MailQueueEvents[_0x2729('0x4')](_0x400b66,_0x45977a);};}exports[_0x2729('0x5')]=function(_0x26a3dc){for(var _0x176a7c=0x0,_0x3562b9=events[_0x2729('0x6')];_0x176a7c<_0x3562b9;_0x176a7c++){var _0x1081fd=events[_0x176a7c];var _0x4c0952=createListener('mailQueue:'+_0x1081fd,_0x26a3dc);MailQueueEvents['on'](_0x1081fd,_0x4c0952);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 291fef1..ca05c79 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 _0x2ca0=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','post','create','put','/:id','update'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0x2ca0,0x192));var _0x02ca=function(_0x3bc04d,_0x28ab50){_0x3bc04d=_0x3bc04d-0x0;var _0x2a543b=_0x2ca0[_0x3bc04d];return _0x2a543b;};'use strict';var multer=require(_0x02ca('0x0'));var util=require(_0x02ca('0x1'));var path=require('path');var timeout=require(_0x02ca('0x2'));var express=require(_0x02ca('0x3'));var router=express[_0x02ca('0x4')]();var fs_extra=require(_0x02ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x02ca('0x6'));var config=require(_0x02ca('0x7'));var controller=require(_0x02ca('0x8'));router['get']('/',auth[_0x02ca('0x9')](),controller['index']);router[_0x02ca('0xa')](_0x02ca('0xb'),auth[_0x02ca('0x9')](),controller[_0x02ca('0xc')]);router[_0x02ca('0xa')]('/:id',auth[_0x02ca('0x9')](),controller['show']);router[_0x02ca('0xd')]('/',auth[_0x02ca('0x9')](),controller[_0x02ca('0xe')]);router[_0x02ca('0xf')](_0x02ca('0x10'),auth[_0x02ca('0x9')](),controller[_0x02ca('0x11')]);router[_0x02ca('0x12')](_0x02ca('0x10'),auth[_0x02ca('0x9')](),controller[_0x02ca('0x13')]);module[_0x02ca('0x14')]=router; \ No newline at end of file +var _0x099b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x375816,_0x2d3c95){var _0x37b17a=function(_0x1531c0){while(--_0x1531c0){_0x375816['push'](_0x375816['shift']());}};_0x37b17a(++_0x2d3c95);}(_0x099b,0x94));var _0xb099=function(_0x144fcf,_0x9a2bee){_0x144fcf=_0x144fcf-0x0;var _0x1cf2c6=_0x099b[_0x144fcf];return _0x1cf2c6;};'use strict';var multer=require('multer');var util=require(_0xb099('0x0'));var path=require(_0xb099('0x1'));var timeout=require(_0xb099('0x2'));var express=require(_0xb099('0x3'));var router=express[_0xb099('0x4')]();var fs_extra=require(_0xb099('0x5'));var auth=require(_0xb099('0x6'));var interaction=require(_0xb099('0x7'));var config=require('../../config/environment');var controller=require(_0xb099('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb099('0x9'),auth[_0xb099('0xa')](),controller[_0xb099('0xb')]);router['get'](_0xb099('0xc'),auth[_0xb099('0xa')](),controller['show']);router[_0xb099('0xd')]('/',auth[_0xb099('0xa')](),controller[_0xb099('0xe')]);router[_0xb099('0xf')](_0xb099('0xc'),auth[_0xb099('0xa')](),controller['update']);router[_0xb099('0x10')]('/:id',auth[_0xb099('0xa')](),controller[_0xb099('0x11')]);module[_0xb099('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 08c92cc..bca0000 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 _0xb072=['DATE','moment','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb072,0x1cd));var _0x2b07=function(_0x289895,_0x33b3f9){_0x289895=_0x289895-0x0;var _0x2b4dcd=_0xb072[_0x289895];return _0x2b4dcd;};'use strict';var moment=require(_0x2b07('0x0'));var Sequelize=require(_0x2b07('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2b07('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2b07('0x2')]},'joinAt':{'type':Sequelize[_0x2b07('0x3')]},'leaveAt':{'type':Sequelize[_0x2b07('0x3')]},'acceptAt':{'type':Sequelize[_0x2b07('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2b07('0x2')]}}; \ No newline at end of file +var _0xe21d=['DATE','sequelize','exports','STRING'];(function(_0x2bded2,_0x22495c){var _0x3d2be0=function(_0x51f446){while(--_0x51f446){_0x2bded2['push'](_0x2bded2['shift']());}};_0x3d2be0(++_0x22495c);}(_0xe21d,0x159));var _0xde21=function(_0x49c14c,_0x437b6c){_0x49c14c=_0x49c14c-0x0;var _0x18475b=_0xe21d[_0x49c14c];return _0x18475b;};'use strict';var moment=require('moment');var Sequelize=require(_0xde21('0x0'));module[_0xde21('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xde21('0x2')]},'joinAt':{'type':Sequelize[_0xde21('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xde21('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a71c32d..dac9764 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 _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0xfd90c2,_0xef8747){var _0xf2e2af=function(_0x1a18a0){while(--_0x1a18a0){_0xfd90c2['push'](_0xfd90c2['shift']());}};_0xf2e2af(++_0xef8747);}(_0xb145,0xa3));var _0x5b14=function(_0x46717d,_0xacb06f){_0x46717d=_0x46717d-0x0;var _0x56fb02=_0xb145[_0x46717d];return _0x56fb02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file +var _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x243ac6,_0x105d5f){_0x243ac6=_0x243ac6-0x0;var _0x27e3e9=_0xbbbc[_0x243ac6];return _0x27e3e9;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['MailQueueReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['MailQueueReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8ddcb4e..6377479 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 _0x6dd8=['uniqueid','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x436db1,_0x3866f3){var _0x1493c7=function(_0x3424b8){while(--_0x3424b8){_0x436db1['push'](_0x436db1['shift']());}};_0x1493c7(++_0x3866f3);}(_0x6dd8,0x85));var _0x86dd=function(_0x38d07a,_0x329042){_0x38d07a=_0x38d07a-0x0;var _0x2e97a4=_0x6dd8[_0x38d07a];return _0x2e97a4;};'use strict';var _=require('lodash');var util=require(_0x86dd('0x0'));var logger=require(_0x86dd('0x1'))(_0x86dd('0x2'));var moment=require(_0x86dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x86dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86dd('0x5'));var config=require(_0x86dd('0x6'));var attributes=require(_0x86dd('0x7'));module[_0x86dd('0x8')]=function(_0x33af51,_0x30c973){return _0x33af51[_0x86dd('0x9')](_0x86dd('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x86dd('0xb'),'fields':[_0x86dd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5ac=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0xbad435,_0x481eaa){var _0x4cdd7a=function(_0x528d63){while(--_0x528d63){_0xbad435['push'](_0xbad435['shift']());}};_0x4cdd7a(++_0x481eaa);}(_0xd5ac,0x1a7));var _0xcd5a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd5ac[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xcd5a('0x0'));var util=require(_0xcd5a('0x1'));var logger=require('../../config/logger')(_0xcd5a('0x2'));var moment=require('moment');var BPromise=require(_0xcd5a('0x3'));var rp=require(_0xcd5a('0x4'));var fs=require('fs');var path=require(_0xcd5a('0x5'));var rimraf=require(_0xcd5a('0x6'));var config=require(_0xcd5a('0x7'));var attributes=require(_0xcd5a('0x8'));module['exports']=function(_0x324b45,_0x48a3d3){return _0x324b45[_0xcd5a('0x9')](_0xcd5a('0xa'),attributes,{'tableName':_0xcd5a('0xb'),'paranoid':![],'indexes':[{'name':_0xcd5a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8aa28ad..abe182b 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x2acbf9,_0x44eba4){var _0x406fe1=function(_0x4ebc3f){while(--_0x4ebc3f){_0x2acbf9['push'](_0x2acbf9['shift']());}};_0x406fe1(++_0x44eba4);}(_0xdb28,0x106));var _0x8db2=function(_0x2577de,_0x2c0d9d){_0x2577de=_0x2577de-0x0;var _0x7a2879=_0xdb28[_0x2577de];return _0x7a2879;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _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(_0x2d46ac,_0x2039c4){var _0x36680d=function(_0x37b7c6){while(--_0x37b7c6){_0x2d46ac['push'](_0x2d46ac['shift']());}};_0x36680d(++_0x2039c4);}(_0xadb5,0xad));var _0x5adb=function(_0x357f48,_0xd57b4){_0x357f48=_0x357f48-0x0;var _0x474db7=_0xadb5[_0x357f48];return _0x474db7;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b82a876..283ba17 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3d9268,_0x12d933){var _0xc25ae1=function(_0x1d5d5a){while(--_0x1d5d5a){_0x3d9268['push'](_0x3d9268['shift']());}};_0xc25ae1(++_0x12d933);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 63defa8..7f11f65 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 _0x1799=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1799,0x161));var _0x9179=function(_0x56ee28,_0x135505){_0x56ee28=_0x56ee28-0x0;var _0x4b35a6=_0x1799[_0x56ee28];return _0x4b35a6;};'use strict';var Sequelize=require(_0x9179('0x0'));module['exports']={'description':{'type':Sequelize[_0x9179('0x1')]},'host':{'type':Sequelize[_0x9179('0x1')]},'authentication':{'type':Sequelize[_0x9179('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9179('0x1')]},'password':{'type':Sequelize[_0x9179('0x1')]},'port':{'type':Sequelize[_0x9179('0x3')]},'tls':{'type':Sequelize[_0x9179('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x9179('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9179('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9179('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9d3d=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x9d3d,0x77));var _0xd9d3=function(_0x5aae0f,_0x544afb){_0x5aae0f=_0x5aae0f-0x0;var _0x3c8fdd=_0x9d3d[_0x5aae0f];return _0x3c8fdd;};'use strict';var Sequelize=require(_0xd9d3('0x0'));module[_0xd9d3('0x1')]={'description':{'type':Sequelize[_0xd9d3('0x2')]},'host':{'type':Sequelize[_0xd9d3('0x2')]},'authentication':{'type':Sequelize[_0xd9d3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd9d3('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd9d3('0x2')],'defaultValue':_0xd9d3('0x4')},'connTimeout':{'type':Sequelize[_0xd9d3('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd9d3('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd9d3('0x2')]},'modernAuthentication':{'type':Sequelize[_0xd9d3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7b4fbf5..a38c1da 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 _0x732c=['moment','request-promise','path','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x4e3d61,_0x5541a3){var _0x59a1b4=function(_0x2858a9){while(--_0x2858a9){_0x4e3d61['push'](_0x4e3d61['shift']());}};_0x59a1b4(++_0x5541a3);}(_0x732c,0x151));var _0xc732=function(_0x5be9ea,_0x37f1fd){_0x5be9ea=_0x5be9ea-0x0;var _0x233613=_0x732c[_0x5be9ea];return _0x233613;};'use strict';var _=require(_0xc732('0x0'));var util=require(_0xc732('0x1'));var logger=require(_0xc732('0x2'))(_0xc732('0x3'));var moment=require(_0xc732('0x4'));var BPromise=require('bluebird');var rp=require(_0xc732('0x5'));var fs=require('fs');var path=require(_0xc732('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc732('0x7'));module[_0xc732('0x8')]=function(_0x154521,_0x46b330){return _0x154521[_0xc732('0x9')]('MailServerIn',attributes,{'tableName':_0xc732('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e6=['define','MailServerIn','mail_servers_in','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x1b336a,_0x52c472){var _0x2a8371=function(_0x2ac0d9){while(--_0x2ac0d9){_0x1b336a['push'](_0x1b336a['shift']());}};_0x2a8371(++_0x52c472);}(_0xf2e6,0x16e));var _0x6f2e=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xf2e6[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require('lodash');var util=require(_0x6f2e('0x0'));var logger=require(_0x6f2e('0x1'))('api');var moment=require(_0x6f2e('0x2'));var BPromise=require(_0x6f2e('0x3'));var rp=require(_0x6f2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f2e('0x5'));var attributes=require(_0x6f2e('0x6'));module[_0x6f2e('0x7')]=function(_0x5f09a9,_0x56dc87){return _0x5f09a9[_0x6f2e('0x8')](_0x6f2e('0x9'),attributes,{'tableName':_0x6f2e('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 30cec29..44095bb 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 _0xf2a4=['attributes','limit','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailServerIn','findAll','options','where'];(function(_0x595f08,_0x1fea1e){var _0x18db9c=function(_0x38b946){while(--_0x38b946){_0x595f08['push'](_0x595f08['shift']());}};_0x18db9c(++_0x1fea1e);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x51ea2b,_0x4fef86){_0x51ea2b=_0x51ea2b-0x0;var _0x5a2b85=_0xf2a4[_0x51ea2b];return _0x5a2b85;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require('moment');var BPromise=require(_0x4f2a('0x2'));var rs=require(_0x4f2a('0x3'));var fs=require('fs');var Redis=require(_0x4f2a('0x4'));var db=require(_0x4f2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2a('0x6'))(_0x4f2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f2a('0x8'));var client=jayson[_0x4f2a('0x9')][_0x4f2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6757,_0x511463,_0x4bd1a7){return new BPromise(function(_0x465bfb,_0x2e3bd2){return client[_0x4f2a('0xb')](_0x3e6757,_0x4bd1a7)['then'](function(_0x3ab9f0){logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));logger[_0x4f2a('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x511463,_0x4f2a('0xe'),JSON[_0x4f2a('0x10')](_0x3ab9f0));if(_0x3ab9f0[_0x4f2a('0x11')]){if(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x12')]===0x1f4){logger[_0x4f2a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x511463,_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);return _0x2e3bd2(_0x3ab9f0[_0x4f2a('0x11')]['message']);}logger[_0x4f2a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x511463,_0x3ab9f0['error'][_0x4f2a('0x13')]);return _0x465bfb(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);}else{logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));_0x465bfb(_0x3ab9f0[_0x4f2a('0x14')][_0x4f2a('0x13')]);}})['catch'](function(_0x18980b){logger[_0x4f2a('0x11')](_0x4f2a('0xd'),_0x511463,_0x18980b);_0x2e3bd2(_0x18980b);});});}exports['GetMailServerIn']=function(_0x388f7b){var _0x505a6e=this;return new Promise(function(_0x48573a,_0x4451c2){return db[_0x4f2a('0x15')][_0x4f2a('0x16')]({'raw':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x18')]||null:null,'attributes':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x19')]||null:null,'limit':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1a')]||null:null,'include':_0x388f7b['options']?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1b')]?_[_0x4f2a('0x1c')](_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1b')],function(_0x131ba9){return{'model':db[_0x131ba9[_0x4f2a('0x1d')]],'as':_0x131ba9['as'],'attributes':_0x131ba9['attributes'],'include':_0x131ba9[_0x4f2a('0x1b')]?_['map'](_0x131ba9[_0x4f2a('0x1b')],function(_0x4f4137){return{'model':db[_0x4f4137[_0x4f2a('0x1d')]],'as':_0x4f4137['as'],'attributes':_0x4f4137[_0x4f2a('0x19')],'include':_0x4f4137[_0x4f2a('0x1b')]?_[_0x4f2a('0x1c')](_0x4f4137[_0x4f2a('0x1b')],function(_0x109879){return{'model':db[_0x109879[_0x4f2a('0x1d')]],'as':_0x109879['as'],'attributes':_0x109879['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4862){logger[_0x4f2a('0xc')]('GetMailServerIn',_0x388f7b);logger[_0x4f2a('0xf')]('GetMailServerIn',_0x388f7b,JSON[_0x4f2a('0x10')](_0x1f4862));_0x48573a(_0x1f4862);})[_0x4f2a('0x1e')](function(_0x518f12){logger[_0x4f2a('0x11')]('GetMailServerIn',_0x518f12[_0x4f2a('0x13')],_0x388f7b);_0x4451c2(_0x505a6e[_0x4f2a('0x11')](0x1f4,_0x518f12['message']));});});}; \ No newline at end of file +var _0xb138=['attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','options','where','limit','include','model'];(function(_0x3a5d4b,_0x9812a5){var _0x3fe344=function(_0xc42e4e){while(--_0xc42e4e){_0x3a5d4b['push'](_0x3a5d4b['shift']());}};_0x3fe344(++_0x9812a5);}(_0xb138,0x1de));var _0x8b13=function(_0x1aabe9,_0x463c43){_0x1aabe9=_0x1aabe9-0x0;var _0x33345c=_0xb138[_0x1aabe9];return _0x33345c;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require(_0x8b13('0x7'));var logger=require(_0x8b13('0x8'))(_0x8b13('0x9'));var config=require(_0x8b13('0xa'));var jayson=require(_0x8b13('0xb'));var client=jayson['client'][_0x8b13('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x843121,_0x5b0ebf,_0xbeaaca){return new BPromise(function(_0x45d884,_0x462e2e){return client[_0x8b13('0xd')](_0x843121,_0xbeaaca)[_0x8b13('0xe')](function(_0x25a127){logger['info']('MailServerIn,\x20%s,\x20%s',_0x5b0ebf,_0x8b13('0xf'));logger[_0x8b13('0x10')](_0x8b13('0x11'),_0x5b0ebf,_0x8b13('0xf'),JSON[_0x8b13('0x12')](_0x25a127));if(_0x25a127[_0x8b13('0x13')]){if(_0x25a127[_0x8b13('0x13')][_0x8b13('0x14')]===0x1f4){logger[_0x8b13('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5b0ebf,_0x25a127['error']['message']);return _0x462e2e(_0x25a127['error'][_0x8b13('0x15')]);}logger[_0x8b13('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5b0ebf,_0x25a127[_0x8b13('0x13')][_0x8b13('0x15')]);return _0x45d884(_0x25a127[_0x8b13('0x13')][_0x8b13('0x15')]);}else{logger[_0x8b13('0x16')](_0x8b13('0x17'),_0x5b0ebf,_0x8b13('0xf'));_0x45d884(_0x25a127[_0x8b13('0x18')]['message']);}})[_0x8b13('0x19')](function(_0x2c6bd8){logger[_0x8b13('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5b0ebf,_0x2c6bd8);_0x462e2e(_0x2c6bd8);});});}exports[_0x8b13('0x1a')]=function(_0x855279){var _0x382b4=this;return new Promise(function(_0x53661c,_0xe34159){return db['MailServerIn']['findAll']({'raw':_0x855279[_0x8b13('0x1b')]?_0x855279['options']['raw']===undefined?!![]:![]:!![],'where':_0x855279[_0x8b13('0x1b')]?_0x855279[_0x8b13('0x1b')][_0x8b13('0x1c')]||null:null,'attributes':_0x855279[_0x8b13('0x1b')]?_0x855279[_0x8b13('0x1b')]['attributes']||null:null,'limit':_0x855279['options']?_0x855279[_0x8b13('0x1b')][_0x8b13('0x1d')]||null:null,'include':_0x855279[_0x8b13('0x1b')]?_0x855279['options']['include']?_['map'](_0x855279[_0x8b13('0x1b')][_0x8b13('0x1e')],function(_0x2af83a){return{'model':db[_0x2af83a[_0x8b13('0x1f')]],'as':_0x2af83a['as'],'attributes':_0x2af83a[_0x8b13('0x20')],'include':_0x2af83a[_0x8b13('0x1e')]?_[_0x8b13('0x21')](_0x2af83a[_0x8b13('0x1e')],function(_0x5cbb8f){return{'model':db[_0x5cbb8f[_0x8b13('0x1f')]],'as':_0x5cbb8f['as'],'attributes':_0x5cbb8f[_0x8b13('0x20')],'include':_0x5cbb8f[_0x8b13('0x1e')]?_[_0x8b13('0x21')](_0x5cbb8f['include'],function(_0x11841e){return{'model':db[_0x11841e['model']],'as':_0x11841e['as'],'attributes':_0x11841e[_0x8b13('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413830){logger[_0x8b13('0x16')]('GetMailServerIn',_0x855279);logger[_0x8b13('0x10')](_0x8b13('0x1a'),_0x855279,JSON[_0x8b13('0x12')](_0x413830));_0x53661c(_0x413830);})[_0x8b13('0x19')](function(_0x3e38c0){logger[_0x8b13('0x13')](_0x8b13('0x1a'),_0x3e38c0['message'],_0x855279);_0xe34159(_0x382b4['error'](0x1f4,_0x3e38c0[_0x8b13('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b157813..307c9b3 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(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_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('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 dd009b1..46af1bb 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 _0x4213=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x4213,0x77));var _0x3421=function(_0x4e5960,_0x5c1bf0){_0x4e5960=_0x4e5960-0x0;var _0x38cf9a=_0x4213[_0x4e5960];return _0x38cf9a;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'description':{'type':Sequelize[_0x3421('0x2')]},'host':{'type':Sequelize[_0x3421('0x2')]},'user':{'type':Sequelize[_0x3421('0x2')]},'pass':{'type':Sequelize[_0x3421('0x2')]},'port':{'type':Sequelize[_0x3421('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3421('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xaf4c26,_0x5272de){var _0x119173=function(_0x50de19){while(--_0x50de19){_0xaf4c26['push'](_0xaf4c26['shift']());}};_0x119173(++_0x5272de);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'description':{'type':Sequelize[_0xf0ab('0x1')]},'host':{'type':Sequelize[_0xf0ab('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf0ab('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf0ab('0x1')]},'authentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6959c22..e690eec 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 _0xca32=['reject','save','update','then','destroy','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x4d0ae5,_0x2546ec){var _0xc26f12=function(_0x36fb67){while(--_0x36fb67){_0x4d0ae5['push'](_0x4d0ae5['shift']());}};_0xc26f12(++_0x2546ec);}(_0xca32,0x1ba));var _0x2ca3=function(_0x57f3bf,_0x8cdffd){_0x57f3bf=_0x57f3bf-0x0;var _0x497b22=_0xca32[_0x57f3bf];return _0x497b22;};'use strict';var emlformat=require(_0x2ca3('0x0'));var rimraf=require(_0x2ca3('0x1'));var zipdir=require(_0x2ca3('0x2'));var jsonpatch=require(_0x2ca3('0x3'));var rp=require(_0x2ca3('0x4'));var moment=require(_0x2ca3('0x5'));var BPromise=require(_0x2ca3('0x6'));var Mustache=require(_0x2ca3('0x7'));var util=require(_0x2ca3('0x8'));var path=require(_0x2ca3('0x9'));var sox=require(_0x2ca3('0xa'));var csv=require(_0x2ca3('0xb'));var ejs=require(_0x2ca3('0xc'));var fs=require('fs');var fs_extra=require(_0x2ca3('0xd'));var _=require('lodash');var squel=require(_0x2ca3('0xe'));var crypto=require(_0x2ca3('0xf'));var jsforce=require(_0x2ca3('0x10'));var deskjs=require(_0x2ca3('0x11'));var toCsv=require(_0x2ca3('0xb'));var querystring=require(_0x2ca3('0x12'));var Papa=require(_0x2ca3('0x13'));var Redis=require(_0x2ca3('0x14'));var authService=require(_0x2ca3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2ca3('0x16'));var hardwareService=require(_0x2ca3('0x17'));var logger=require(_0x2ca3('0x18'))('api');var utils=require(_0x2ca3('0x19'));var config=require(_0x2ca3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ca3('0x1b'))['db'];function respondWithStatusCode(_0x4492f5,_0x59fd35){_0x59fd35=_0x59fd35||0xcc;return function(_0x1ee71e){if(_0x1ee71e){return _0x4492f5['sendStatus'](_0x59fd35);}return _0x4492f5[_0x2ca3('0x1c')](_0x59fd35)[_0x2ca3('0x1d')]();};}function respondWithResult(_0x309f2a,_0x573c92){_0x573c92=_0x573c92||0xc8;return function(_0x2b088a){if(_0x2b088a){return _0x309f2a['status'](_0x573c92)[_0x2ca3('0x1e')](_0x2b088a);}};}function respondWithFilteredResult(_0x1c7ec1,_0x67b8bd){return function(_0x564ede){if(_0x564ede){var _0x4ac9f8=typeof _0x67b8bd[_0x2ca3('0x1f')]===_0x2ca3('0x20')&&typeof _0x67b8bd[_0x2ca3('0x21')]===_0x2ca3('0x20');var _0x3ca14d=_0x564ede[_0x2ca3('0x22')];var _0x269680=_0x4ac9f8?0x0:_0x67b8bd[_0x2ca3('0x1f')];var _0x569c36=_0x4ac9f8?_0x564ede[_0x2ca3('0x22')]:_0x67b8bd[_0x2ca3('0x1f')]+_0x67b8bd[_0x2ca3('0x21')];var _0x20e8ad;if(_0x569c36>=_0x3ca14d){_0x569c36=_0x3ca14d;_0x20e8ad=0xc8;}else{_0x20e8ad=0xce;}_0x1c7ec1['status'](_0x20e8ad);return _0x1c7ec1[_0x2ca3('0x23')](_0x2ca3('0x24'),_0x269680+'-'+_0x569c36+'/'+_0x3ca14d)[_0x2ca3('0x1e')](_0x564ede);}return null;};}function patchUpdates(_0x307288){return function(_0x421739){try{jsonpatch[_0x2ca3('0x25')](_0x421739,_0x307288,!![]);}catch(_0x52348f){return BPromise[_0x2ca3('0x26')](_0x52348f);}return _0x421739[_0x2ca3('0x27')]();};}function saveUpdates(_0xab1ccc,_0x38f6f7){return function(_0x5cef32){if(_0x5cef32){return _0x5cef32[_0x2ca3('0x28')](_0xab1ccc)[_0x2ca3('0x29')](function(_0x38d83c){return _0x38d83c;});}return null;};}function removeEntity(_0x5431ac,_0x42a59d){return function(_0x1464d8){if(_0x1464d8){return _0x1464d8[_0x2ca3('0x2a')]()[_0x2ca3('0x29')](function(){_0x5431ac['status'](0xcc)[_0x2ca3('0x1d')]();});}};}function handleEntityNotFound(_0x116036,_0x2aa2d2){return function(_0x252031){if(!_0x252031){_0x116036[_0x2ca3('0x2b')](0x194);}return _0x252031;};}function handleError(_0x44f806,_0x2dcb7b){_0x2dcb7b=_0x2dcb7b||0x1f4;return function(_0x2176d7){logger[_0x2ca3('0x2c')](_0x2176d7['stack']);if(_0x2176d7[_0x2ca3('0x2d')]){delete _0x2176d7[_0x2ca3('0x2d')];}_0x44f806[_0x2ca3('0x1c')](_0x2dcb7b)[_0x2ca3('0x2e')](_0x2176d7);};}exports[_0x2ca3('0x2f')]=function(_0x5d926b,_0x4b863d){var _0x1d326f={},_0x88b10d={},_0x3f42fd={'count':0x0,'rows':[]};var _0x10a097=_[_0x2ca3('0x30')](db[_0x2ca3('0x31')][_0x2ca3('0x32')],function(_0x440ada){return{'name':_0x440ada[_0x2ca3('0x33')],'type':_0x440ada[_0x2ca3('0x34')][_0x2ca3('0x35')]};});_0x88b10d['model']=_[_0x2ca3('0x30')](_0x10a097,_0x2ca3('0x2d'));_0x88b10d['query']=_[_0x2ca3('0x36')](_0x5d926b[_0x2ca3('0x37')]);_0x88b10d[_0x2ca3('0x38')]=_[_0x2ca3('0x39')](_0x88b10d['model'],_0x88b10d[_0x2ca3('0x37')]);_0x1d326f[_0x2ca3('0x3a')]=_[_0x2ca3('0x39')](_0x88b10d['model'],qs[_0x2ca3('0x3b')](_0x5d926b[_0x2ca3('0x37')][_0x2ca3('0x3b')]));_0x1d326f[_0x2ca3('0x3a')]=_0x1d326f['attributes'][_0x2ca3('0x3c')]?_0x1d326f[_0x2ca3('0x3a')]:_0x88b10d[_0x2ca3('0x3d')];if(!_0x5d926b['query'][_0x2ca3('0x3e')]('nolimit')){_0x1d326f[_0x2ca3('0x21')]=qs[_0x2ca3('0x21')](_0x5d926b[_0x2ca3('0x37')][_0x2ca3('0x21')]);_0x1d326f[_0x2ca3('0x1f')]=qs[_0x2ca3('0x1f')](_0x5d926b[_0x2ca3('0x37')][_0x2ca3('0x1f')]);}_0x1d326f[_0x2ca3('0x3f')]=qs[_0x2ca3('0x40')](_0x5d926b[_0x2ca3('0x37')][_0x2ca3('0x40')]);_0x1d326f['where']=qs[_0x2ca3('0x38')](_['pick'](_0x5d926b[_0x2ca3('0x37')],_0x88b10d[_0x2ca3('0x38')]),_0x10a097);if(_0x5d926b[_0x2ca3('0x37')]['filter']){_0x1d326f[_0x2ca3('0x41')]=_[_0x2ca3('0x42')](_0x1d326f[_0x2ca3('0x41')],{'$or':_[_0x2ca3('0x30')](_0x10a097,function(_0x2ee6b6){if(_0x2ee6b6[_0x2ca3('0x34')]!==_0x2ca3('0x43')){var _0x9aaac0={};_0x9aaac0[_0x2ee6b6[_0x2ca3('0x2d')]]={'$like':'%'+_0x5d926b[_0x2ca3('0x37')][_0x2ca3('0x44')]+'%'};return _0x9aaac0;}})});}_0x1d326f=_[_0x2ca3('0x42')]({},_0x1d326f,_0x5d926b[_0x2ca3('0x45')]);var _0x1ce413={'where':_0x1d326f[_0x2ca3('0x41')]};return db[_0x2ca3('0x31')]['count'](_0x1ce413)['then'](function(_0x187b24){_0x3f42fd[_0x2ca3('0x22')]=_0x187b24;if(_0x5d926b['query'][_0x2ca3('0x46')]){_0x1d326f['include']=[{'all':!![]}];}return db[_0x2ca3('0x31')][_0x2ca3('0x47')](_0x1d326f);})[_0x2ca3('0x29')](function(_0x304be2){_0x3f42fd[_0x2ca3('0x48')]=_0x304be2;return _0x3f42fd;})[_0x2ca3('0x29')](respondWithFilteredResult(_0x4b863d,_0x1d326f))[_0x2ca3('0x49')](handleError(_0x4b863d,null));};exports[_0x2ca3('0x4a')]=function(_0x51c708,_0x59cee4){var _0x403deb={'raw':!![],'where':{'id':_0x51c708[_0x2ca3('0x4b')]['id']}},_0x4bc681={};_0x4bc681[_0x2ca3('0x3d')]=_['keys'](db['MailServerOut'][_0x2ca3('0x32')]);_0x4bc681['query']=_[_0x2ca3('0x36')](_0x51c708[_0x2ca3('0x37')]);_0x4bc681[_0x2ca3('0x38')]=_[_0x2ca3('0x39')](_0x4bc681['model'],_0x4bc681['query']);_0x403deb['attributes']=_[_0x2ca3('0x39')](_0x4bc681['model'],qs[_0x2ca3('0x3b')](_0x51c708[_0x2ca3('0x37')][_0x2ca3('0x3b')]));_0x403deb[_0x2ca3('0x3a')]=_0x403deb[_0x2ca3('0x3a')][_0x2ca3('0x3c')]?_0x403deb[_0x2ca3('0x3a')]:_0x4bc681[_0x2ca3('0x3d')];if(_0x51c708[_0x2ca3('0x37')][_0x2ca3('0x46')]){_0x403deb[_0x2ca3('0x4c')]=[{'all':!![]}];}_0x403deb=_[_0x2ca3('0x42')]({},_0x403deb,_0x51c708['options']);return db[_0x2ca3('0x31')][_0x2ca3('0x4d')](_0x403deb)['then'](handleEntityNotFound(_0x59cee4,null))[_0x2ca3('0x29')](respondWithResult(_0x59cee4,null))[_0x2ca3('0x49')](handleError(_0x59cee4,null));};exports[_0x2ca3('0x4e')]=function(_0x2896d2,_0x407a5f){return db['MailServerOut'][_0x2ca3('0x4e')](_0x2896d2['body'],{})['then'](respondWithResult(_0x407a5f,0xc9))['catch'](handleError(_0x407a5f,null));};exports[_0x2ca3('0x28')]=function(_0xf32368,_0x37273d){if(_0xf32368['body']['id']){delete _0xf32368[_0x2ca3('0x4f')]['id'];}return db[_0x2ca3('0x31')][_0x2ca3('0x4d')]({'where':{'id':_0xf32368[_0x2ca3('0x4b')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x37273d,null))[_0x2ca3('0x29')](saveUpdates(_0xf32368[_0x2ca3('0x4f')],null))[_0x2ca3('0x29')](respondWithResult(_0x37273d,null))[_0x2ca3('0x49')](handleError(_0x37273d,null));};exports[_0x2ca3('0x2a')]=function(_0x3afa29,_0x54a071){return db[_0x2ca3('0x31')][_0x2ca3('0x4d')]({'where':{'id':_0x3afa29[_0x2ca3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54a071,null))['then'](removeEntity(_0x54a071,null))['catch'](handleError(_0x54a071,null));}; \ No newline at end of file +var _0x06da=['../../config/utils','../../config/environment','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x1cacf6,_0x32104f){var _0x5869a6=function(_0x33a151){while(--_0x33a151){_0x1cacf6['push'](_0x1cacf6['shift']());}};_0x5869a6(++_0x32104f);}(_0x06da,0x7b));var _0xa06d=function(_0x3a37a2,_0x10d4ff){_0x3a37a2=_0x3a37a2-0x0;var _0x4f3300=_0x06da[_0x3a37a2];return _0x4f3300;};'use strict';var emlformat=require(_0xa06d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa06d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa06d('0x2'));var moment=require(_0xa06d('0x3'));var BPromise=require(_0xa06d('0x4'));var Mustache=require(_0xa06d('0x5'));var util=require(_0xa06d('0x6'));var path=require(_0xa06d('0x7'));var sox=require(_0xa06d('0x8'));var csv=require(_0xa06d('0x9'));var ejs=require(_0xa06d('0xa'));var fs=require('fs');var fs_extra=require(_0xa06d('0xb'));var _=require(_0xa06d('0xc'));var squel=require(_0xa06d('0xd'));var crypto=require(_0xa06d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa06d('0xf'));var toCsv=require(_0xa06d('0x9'));var querystring=require(_0xa06d('0x10'));var Papa=require(_0xa06d('0x11'));var Redis=require(_0xa06d('0x12'));var authService=require(_0xa06d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa06d('0x14'));var logger=require(_0xa06d('0x15'))(_0xa06d('0x16'));var utils=require(_0xa06d('0x17'));var config=require(_0xa06d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196883,_0x3b183b){_0x3b183b=_0x3b183b||0xcc;return function(_0xb4a9a7){if(_0xb4a9a7){return _0x196883[_0xa06d('0x19')](_0x3b183b);}return _0x196883[_0xa06d('0x1a')](_0x3b183b)['end']();};}function respondWithResult(_0x4977c3,_0x5a0b68){_0x5a0b68=_0x5a0b68||0xc8;return function(_0x23921f){if(_0x23921f){return _0x4977c3[_0xa06d('0x1a')](_0x5a0b68)['json'](_0x23921f);}};}function respondWithFilteredResult(_0x33d9ed,_0x45d527){return function(_0x2f84be){if(_0x2f84be){var _0x298210=typeof _0x45d527['offset']===_0xa06d('0x1b')&&typeof _0x45d527[_0xa06d('0x1c')]===_0xa06d('0x1b');var _0x4c37f2=_0x2f84be['count'];var _0x2c88ae=_0x298210?0x0:_0x45d527[_0xa06d('0x1d')];var _0x298545=_0x298210?_0x2f84be[_0xa06d('0x1e')]:_0x45d527['offset']+_0x45d527['limit'];var _0x3785e9;if(_0x298545>=_0x4c37f2){_0x298545=_0x4c37f2;_0x3785e9=0xc8;}else{_0x3785e9=0xce;}_0x33d9ed[_0xa06d('0x1a')](_0x3785e9);return _0x33d9ed[_0xa06d('0x1f')](_0xa06d('0x20'),_0x2c88ae+'-'+_0x298545+'/'+_0x4c37f2)[_0xa06d('0x21')](_0x2f84be);}return null;};}function patchUpdates(_0x3f7c3e){return function(_0x3f824f){try{jsonpatch[_0xa06d('0x22')](_0x3f824f,_0x3f7c3e,!![]);}catch(_0x37cd60){return BPromise[_0xa06d('0x23')](_0x37cd60);}return _0x3f824f[_0xa06d('0x24')]();};}function saveUpdates(_0x318c42,_0x1230c6){return function(_0x15ce58){if(_0x15ce58){return _0x15ce58['update'](_0x318c42)[_0xa06d('0x25')](function(_0x3e6623){return _0x3e6623;});}return null;};}function removeEntity(_0x34980b,_0x953a65){return function(_0x388a72){if(_0x388a72){return _0x388a72['destroy']()['then'](function(){_0x34980b[_0xa06d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c19d,_0x101351){return function(_0x338732){if(!_0x338732){_0x59c19d[_0xa06d('0x19')](0x194);}return _0x338732;};}function handleError(_0xc7e49b,_0x21d2f5){_0x21d2f5=_0x21d2f5||0x1f4;return function(_0x5a8551){logger[_0xa06d('0x26')](_0x5a8551[_0xa06d('0x27')]);if(_0x5a8551[_0xa06d('0x28')]){delete _0x5a8551['name'];}_0xc7e49b[_0xa06d('0x1a')](_0x21d2f5)[_0xa06d('0x29')](_0x5a8551);};}exports['index']=function(_0x22a1cf,_0x2e4dcd){var _0x311b50={},_0x4ca5aa={},_0x47e619={'count':0x0,'rows':[]};var _0x50856b=_['map'](db[_0xa06d('0x2a')][_0xa06d('0x2b')],function(_0x1a977a){return{'name':_0x1a977a[_0xa06d('0x2c')],'type':_0x1a977a[_0xa06d('0x2d')][_0xa06d('0x2e')]};});_0x4ca5aa[_0xa06d('0x2f')]=_[_0xa06d('0x30')](_0x50856b,_0xa06d('0x28'));_0x4ca5aa[_0xa06d('0x31')]=_['keys'](_0x22a1cf[_0xa06d('0x31')]);_0x4ca5aa['filters']=_[_0xa06d('0x32')](_0x4ca5aa[_0xa06d('0x2f')],_0x4ca5aa[_0xa06d('0x31')]);_0x311b50[_0xa06d('0x33')]=_[_0xa06d('0x32')](_0x4ca5aa[_0xa06d('0x2f')],qs[_0xa06d('0x34')](_0x22a1cf[_0xa06d('0x31')][_0xa06d('0x34')]));_0x311b50[_0xa06d('0x33')]=_0x311b50[_0xa06d('0x33')][_0xa06d('0x35')]?_0x311b50[_0xa06d('0x33')]:_0x4ca5aa[_0xa06d('0x2f')];if(!_0x22a1cf[_0xa06d('0x31')][_0xa06d('0x36')](_0xa06d('0x37'))){_0x311b50[_0xa06d('0x1c')]=qs['limit'](_0x22a1cf[_0xa06d('0x31')][_0xa06d('0x1c')]);_0x311b50['offset']=qs['offset'](_0x22a1cf[_0xa06d('0x31')][_0xa06d('0x1d')]);}_0x311b50[_0xa06d('0x38')]=qs['sort'](_0x22a1cf[_0xa06d('0x31')]['sort']);_0x311b50[_0xa06d('0x39')]=qs[_0xa06d('0x3a')](_['pick'](_0x22a1cf[_0xa06d('0x31')],_0x4ca5aa[_0xa06d('0x3a')]),_0x50856b);if(_0x22a1cf[_0xa06d('0x31')][_0xa06d('0x3b')]){_0x311b50['where']=_[_0xa06d('0x3c')](_0x311b50[_0xa06d('0x39')],{'$or':_[_0xa06d('0x30')](_0x50856b,function(_0xb04e37){if(_0xb04e37[_0xa06d('0x2d')]!==_0xa06d('0x3d')){var _0x380a57={};_0x380a57[_0xb04e37[_0xa06d('0x28')]]={'$like':'%'+_0x22a1cf['query']['filter']+'%'};return _0x380a57;}})});}_0x311b50=_[_0xa06d('0x3c')]({},_0x311b50,_0x22a1cf['options']);var _0x2f00da={'where':_0x311b50[_0xa06d('0x39')]};return db[_0xa06d('0x2a')][_0xa06d('0x1e')](_0x2f00da)[_0xa06d('0x25')](function(_0x231f49){_0x47e619[_0xa06d('0x1e')]=_0x231f49;if(_0x22a1cf['query'][_0xa06d('0x3e')]){_0x311b50[_0xa06d('0x3f')]=[{'all':!![]}];}return db[_0xa06d('0x2a')][_0xa06d('0x40')](_0x311b50);})[_0xa06d('0x25')](function(_0x280b7e){_0x47e619[_0xa06d('0x41')]=_0x280b7e;return _0x47e619;})[_0xa06d('0x25')](respondWithFilteredResult(_0x2e4dcd,_0x311b50))['catch'](handleError(_0x2e4dcd,null));};exports['show']=function(_0x5984bd,_0x1d101c){var _0x3047ee={'raw':!![],'where':{'id':_0x5984bd[_0xa06d('0x42')]['id']}},_0x3dfa5c={};_0x3dfa5c[_0xa06d('0x2f')]=_[_0xa06d('0x43')](db[_0xa06d('0x2a')][_0xa06d('0x2b')]);_0x3dfa5c[_0xa06d('0x31')]=_[_0xa06d('0x43')](_0x5984bd[_0xa06d('0x31')]);_0x3dfa5c[_0xa06d('0x3a')]=_['intersection'](_0x3dfa5c['model'],_0x3dfa5c[_0xa06d('0x31')]);_0x3047ee['attributes']=_[_0xa06d('0x32')](_0x3dfa5c[_0xa06d('0x2f')],qs['fields'](_0x5984bd[_0xa06d('0x31')][_0xa06d('0x34')]));_0x3047ee[_0xa06d('0x33')]=_0x3047ee['attributes'][_0xa06d('0x35')]?_0x3047ee[_0xa06d('0x33')]:_0x3dfa5c[_0xa06d('0x2f')];if(_0x5984bd[_0xa06d('0x31')][_0xa06d('0x3e')]){_0x3047ee[_0xa06d('0x3f')]=[{'all':!![]}];}_0x3047ee=_[_0xa06d('0x3c')]({},_0x3047ee,_0x5984bd[_0xa06d('0x44')]);return db['MailServerOut'][_0xa06d('0x45')](_0x3047ee)[_0xa06d('0x25')](handleEntityNotFound(_0x1d101c,null))[_0xa06d('0x25')](respondWithResult(_0x1d101c,null))[_0xa06d('0x46')](handleError(_0x1d101c,null));};exports[_0xa06d('0x47')]=function(_0x39f654,_0x52ce37){return db['MailServerOut'][_0xa06d('0x47')](_0x39f654['body'],{})[_0xa06d('0x25')](respondWithResult(_0x52ce37,0xc9))[_0xa06d('0x46')](handleError(_0x52ce37,null));};exports['update']=function(_0x3bb5a4,_0x43668b){if(_0x3bb5a4[_0xa06d('0x48')]['id']){delete _0x3bb5a4[_0xa06d('0x48')]['id'];}return db[_0xa06d('0x2a')][_0xa06d('0x45')]({'where':{'id':_0x3bb5a4[_0xa06d('0x42')]['id']}})[_0xa06d('0x25')](handleEntityNotFound(_0x43668b,null))['then'](saveUpdates(_0x3bb5a4[_0xa06d('0x48')],null))[_0xa06d('0x25')](respondWithResult(_0x43668b,null))[_0xa06d('0x46')](handleError(_0x43668b,null));};exports['destroy']=function(_0x1d77db,_0x5acbef){return db[_0xa06d('0x2a')][_0xa06d('0x45')]({'where':{'id':_0x1d77db[_0xa06d('0x42')]['id']}})[_0xa06d('0x25')](handleEntityNotFound(_0x5acbef,null))[_0xa06d('0x25')](removeEntity(_0x5acbef,null))[_0xa06d('0x46')](handleError(_0x5acbef,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9825e35..f88308a 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 _0x1bcb=['rimraf','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0x1bcb,0x1e4));var _0xb1bc=function(_0x127f2b,_0x2a1948){_0x127f2b=_0x127f2b-0x0;var _0x385fe7=_0x1bcb[_0x127f2b];return _0x385fe7;};'use strict';var _=require(_0xb1bc('0x0'));var util=require(_0xb1bc('0x1'));var logger=require(_0xb1bc('0x2'))(_0xb1bc('0x3'));var moment=require(_0xb1bc('0x4'));var BPromise=require(_0xb1bc('0x5'));var rp=require(_0xb1bc('0x6'));var fs=require('fs');var path=require(_0xb1bc('0x7'));var rimraf=require(_0xb1bc('0x8'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x493f29,_0x58cb87){return _0x493f29[_0xb1bc('0x9')](_0xb1bc('0xa'),attributes,{'tableName':_0xb1bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee06=['mail_servers_out','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x477aab,_0x4d08fd){var _0x2cd294=function(_0x4e0c85){while(--_0x4e0c85){_0x477aab['push'](_0x477aab['shift']());}};_0x2cd294(++_0x4d08fd);}(_0xee06,0x1e1));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ee0('0x0'));var util=require(_0x6ee0('0x1'));var logger=require(_0x6ee0('0x2'))(_0x6ee0('0x3'));var moment=require(_0x6ee0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ee0('0x5'));var rimraf=require(_0x6ee0('0x6'));var config=require(_0x6ee0('0x7'));var attributes=require(_0x6ee0('0x8'));module[_0x6ee0('0x9')]=function(_0xb44492,_0x16e523){return _0xb44492[_0x6ee0('0xa')]('MailServerOut',attributes,{'tableName':_0x6ee0('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 4d3e56f..1c9249b 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x430e33,_0x287cb7){var _0x5eed76=function(_0x11e13b){while(--_0x11e13b){_0x430e33['push'](_0x430e33['shift']());}};_0x5eed76(++_0x287cb7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _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(_0x215e60,_0x2271cd){var _0x154260=function(_0x4507f2){while(--_0x4507f2){_0x215e60['push'](_0x215e60['shift']());}};_0x154260(++_0x2271cd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x410da0,_0x2138e5){_0x410da0=_0x410da0-0x0;var _0x3b9106=_0x5f2f[_0x410da0];return _0x3b9106;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0602569..aa04da5 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 _0xf58d=['../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x396936,_0x1979f9){var _0x3844b4=function(_0x53c112){while(--_0x53c112){_0x396936['push'](_0x396936['shift']());}};_0x3844b4(++_0x1979f9);}(_0xf58d,0x189));var _0xdf58=function(_0xa6d4a5,_0x19825b){_0xa6d4a5=_0xa6d4a5-0x0;var _0x3f47aa=_0xf58d[_0xa6d4a5];return _0x3f47aa;};'use strict';var multer=require(_0xdf58('0x0'));var util=require(_0xdf58('0x1'));var path=require('path');var timeout=require(_0xdf58('0x2'));var express=require(_0xdf58('0x3'));var router=express['Router']();var fs_extra=require(_0xdf58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf58('0x5'));var config=require(_0xdf58('0x6'));var controller=require(_0xdf58('0x7'));router[_0xdf58('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf58('0x9')]);router[_0xdf58('0x8')](_0xdf58('0xa'),auth[_0xdf58('0xb')](),controller['describe']);router[_0xdf58('0x8')](_0xdf58('0xc'),auth[_0xdf58('0xb')](),controller['show']);router[_0xdf58('0xd')]('/',auth['isAuthenticated'](),controller[_0xdf58('0xe')]);router[_0xdf58('0xf')](_0xdf58('0xc'),auth[_0xdf58('0xb')](),controller[_0xdf58('0x10')]);router[_0xdf58('0x11')](_0xdf58('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xdf58('0x12')]=router; \ No newline at end of file +var _0x5379=['index','/describe','describe','/:id','show','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x3c4ff0,_0x2c93d9){var _0x2e7f15=function(_0x1573a6){while(--_0x1573a6){_0x3c4ff0['push'](_0x3c4ff0['shift']());}};_0x2e7f15(++_0x2c93d9);}(_0x5379,0xa9));var _0x9537=function(_0xe56c85,_0x20d07d){_0xe56c85=_0xe56c85-0x0;var _0x26b5a7=_0x5379[_0xe56c85];return _0x26b5a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9537('0x0'));var timeout=require(_0x9537('0x1'));var express=require(_0x9537('0x2'));var router=express[_0x9537('0x3')]();var fs_extra=require(_0x9537('0x4'));var auth=require(_0x9537('0x5'));var interaction=require(_0x9537('0x6'));var config=require(_0x9537('0x7'));var controller=require(_0x9537('0x8'));router[_0x9537('0x9')]('/',auth[_0x9537('0xa')](),controller[_0x9537('0xb')]);router[_0x9537('0x9')](_0x9537('0xc'),auth[_0x9537('0xa')](),controller[_0x9537('0xd')]);router[_0x9537('0x9')](_0x9537('0xe'),auth[_0x9537('0xa')](),controller[_0x9537('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9537('0x10')]('/:id',auth[_0x9537('0xa')](),controller[_0x9537('0x11')]);router[_0x9537('0x12')](_0x9537('0xe'),auth['isAuthenticated'](),controller[_0x9537('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 098d6d5..32dfd87 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 _0xd101=['name','sequelize','STRING'];(function(_0x551bc1,_0x47cff3){var _0x12ea5e=function(_0x2d4c10){while(--_0x2d4c10){_0x551bc1['push'](_0x551bc1['shift']());}};_0x12ea5e(++_0x47cff3);}(_0xd101,0xc1));var _0x1d10=function(_0x21a459,_0x1e13f8){_0x21a459=_0x21a459-0x0;var _0x1769be=_0xd101[_0x21a459];return _0x1769be;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'unique':_0x1d10('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d10('0x1')]}}; \ No newline at end of file +var _0x84e7=['exports','STRING'];(function(_0x5043ba,_0x1ae47c){var _0xf4f4de=function(_0x4e5b58){while(--_0x4e5b58){_0x5043ba['push'](_0x5043ba['shift']());}};_0xf4f4de(++_0x1ae47c);}(_0x84e7,0x122));var _0x784e=function(_0x13ca7c,_0x243038){_0x13ca7c=_0x13ca7c-0x0;var _0x126feb=_0x84e7[_0x13ca7c];return _0x126feb;};'use strict';var Sequelize=require('sequelize');module[_0x784e('0x0')]={'name':{'type':Sequelize[_0x784e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x784e('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0e2e543..7774005 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 _0xff71=['fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','MailSubstatus','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x5a5cad,_0x43ca84){var _0x5437fd=function(_0x58ab10){while(--_0x58ab10){_0x5a5cad['push'](_0x5a5cad['shift']());}};_0x5437fd(++_0x43ca84);}(_0xff71,0x1bf));var _0x1ff7=function(_0xf1a516,_0x4b7594){_0xf1a516=_0xf1a516-0x0;var _0x6792d2=_0xff71[_0xf1a516];return _0x6792d2;};'use strict';var emlformat=require(_0x1ff7('0x0'));var rimraf=require(_0x1ff7('0x1'));var zipdir=require(_0x1ff7('0x2'));var jsonpatch=require(_0x1ff7('0x3'));var rp=require('request-promise');var moment=require(_0x1ff7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ff7('0x5'));var util=require('util');var path=require(_0x1ff7('0x6'));var sox=require(_0x1ff7('0x7'));var csv=require(_0x1ff7('0x8'));var ejs=require(_0x1ff7('0x9'));var fs=require('fs');var fs_extra=require(_0x1ff7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ff7('0xb'));var jsforce=require(_0x1ff7('0xc'));var deskjs=require(_0x1ff7('0xd'));var toCsv=require(_0x1ff7('0x8'));var querystring=require(_0x1ff7('0xe'));var Papa=require(_0x1ff7('0xf'));var Redis=require(_0x1ff7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ff7('0x11'));var as=require(_0x1ff7('0x12'));var hardwareService=require(_0x1ff7('0x13'));var logger=require(_0x1ff7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1ff7('0x15'));var licenseUtil=require(_0x1ff7('0x16'));var db=require(_0x1ff7('0x17'))['db'];function respondWithStatusCode(_0x441e3e,_0x228d77){_0x228d77=_0x228d77||0xcc;return function(_0x3cbf37){if(_0x3cbf37){return _0x441e3e[_0x1ff7('0x18')](_0x228d77);}return _0x441e3e[_0x1ff7('0x19')](_0x228d77)[_0x1ff7('0x1a')]();};}function respondWithResult(_0x4702ca,_0x1cc68c){_0x1cc68c=_0x1cc68c||0xc8;return function(_0x1dca9d){if(_0x1dca9d){return _0x4702ca[_0x1ff7('0x19')](_0x1cc68c)[_0x1ff7('0x1b')](_0x1dca9d);}};}function respondWithFilteredResult(_0x1a54ae,_0x411ab2){return function(_0x284065){if(_0x284065){var _0x4e07da=typeof _0x411ab2[_0x1ff7('0x1c')]===_0x1ff7('0x1d')&&typeof _0x411ab2[_0x1ff7('0x1e')]===_0x1ff7('0x1d');var _0x31bf00=_0x284065[_0x1ff7('0x1f')];var _0x4eb959=_0x4e07da?0x0:_0x411ab2[_0x1ff7('0x1c')];var _0x24a1c8=_0x4e07da?_0x284065[_0x1ff7('0x1f')]:_0x411ab2[_0x1ff7('0x1c')]+_0x411ab2[_0x1ff7('0x1e')];var _0x572aa2;if(_0x24a1c8>=_0x31bf00){_0x24a1c8=_0x31bf00;_0x572aa2=0xc8;}else{_0x572aa2=0xce;}_0x1a54ae['status'](_0x572aa2);return _0x1a54ae['set'](_0x1ff7('0x20'),_0x4eb959+'-'+_0x24a1c8+'/'+_0x31bf00)[_0x1ff7('0x1b')](_0x284065);}return null;};}function patchUpdates(_0x518d9f){return function(_0x380317){try{jsonpatch[_0x1ff7('0x21')](_0x380317,_0x518d9f,!![]);}catch(_0x25eabf){return BPromise[_0x1ff7('0x22')](_0x25eabf);}return _0x380317['save']();};}function saveUpdates(_0x1116ab,_0x345156){return function(_0x38d013){if(_0x38d013){return _0x38d013[_0x1ff7('0x23')](_0x1116ab)[_0x1ff7('0x24')](function(_0x448160){return _0x448160;});}return null;};}function removeEntity(_0x548874,_0xaf334f){return function(_0x3e1411){if(_0x3e1411){return _0x3e1411[_0x1ff7('0x25')]()[_0x1ff7('0x24')](function(){_0x548874[_0x1ff7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560c05,_0x447fd0){return function(_0xcd161){if(!_0xcd161){_0x560c05[_0x1ff7('0x18')](0x194);}return _0xcd161;};}function handleError(_0x7a9f9,_0x20cff5){_0x20cff5=_0x20cff5||0x1f4;return function(_0x456ce3){logger[_0x1ff7('0x26')](_0x456ce3[_0x1ff7('0x27')]);if(_0x456ce3[_0x1ff7('0x28')]){delete _0x456ce3[_0x1ff7('0x28')];}_0x7a9f9['status'](_0x20cff5)[_0x1ff7('0x29')](_0x456ce3);};}exports['index']=function(_0x5b5467,_0x2435c8){var _0x3253f6={},_0x40a3d2={},_0x47547e={'count':0x0,'rows':[]};var _0x5a6780=_[_0x1ff7('0x2a')](db[_0x1ff7('0x2b')][_0x1ff7('0x2c')],function(_0x5595ea){return{'name':_0x5595ea['fieldName'],'type':_0x5595ea['type'][_0x1ff7('0x2d')]};});_0x40a3d2[_0x1ff7('0x2e')]=_['map'](_0x5a6780,_0x1ff7('0x28'));_0x40a3d2['query']=_[_0x1ff7('0x2f')](_0x5b5467[_0x1ff7('0x30')]);_0x40a3d2[_0x1ff7('0x31')]=_[_0x1ff7('0x32')](_0x40a3d2[_0x1ff7('0x2e')],_0x40a3d2[_0x1ff7('0x30')]);_0x3253f6[_0x1ff7('0x33')]=_[_0x1ff7('0x32')](_0x40a3d2[_0x1ff7('0x2e')],qs[_0x1ff7('0x34')](_0x5b5467[_0x1ff7('0x30')]['fields']));_0x3253f6[_0x1ff7('0x33')]=_0x3253f6[_0x1ff7('0x33')][_0x1ff7('0x35')]?_0x3253f6['attributes']:_0x40a3d2[_0x1ff7('0x2e')];if(!_0x5b5467[_0x1ff7('0x30')][_0x1ff7('0x36')](_0x1ff7('0x37'))){_0x3253f6[_0x1ff7('0x1e')]=qs[_0x1ff7('0x1e')](_0x5b5467['query'][_0x1ff7('0x1e')]);_0x3253f6['offset']=qs['offset'](_0x5b5467[_0x1ff7('0x30')][_0x1ff7('0x1c')]);}_0x3253f6[_0x1ff7('0x38')]=qs[_0x1ff7('0x39')](_0x5b5467[_0x1ff7('0x30')][_0x1ff7('0x39')]);_0x3253f6[_0x1ff7('0x3a')]=qs['filters'](_[_0x1ff7('0x3b')](_0x5b5467[_0x1ff7('0x30')],_0x40a3d2[_0x1ff7('0x31')]),_0x5a6780);if(_0x5b5467[_0x1ff7('0x30')][_0x1ff7('0x3c')]){_0x3253f6['where']=_['merge'](_0x3253f6['where'],{'$or':_[_0x1ff7('0x2a')](_0x5a6780,function(_0x48597e){if(_0x48597e['type']!==_0x1ff7('0x3d')){var _0x3310d2={};_0x3310d2[_0x48597e['name']]={'$like':'%'+_0x5b5467['query'][_0x1ff7('0x3c')]+'%'};return _0x3310d2;}})});}_0x3253f6=_[_0x1ff7('0x3e')]({},_0x3253f6,_0x5b5467[_0x1ff7('0x3f')]);var _0x33a19b={'where':_0x3253f6[_0x1ff7('0x3a')]};return db['MailSubstatus'][_0x1ff7('0x1f')](_0x33a19b)['then'](function(_0x22f4fb){_0x47547e[_0x1ff7('0x1f')]=_0x22f4fb;if(_0x5b5467[_0x1ff7('0x30')][_0x1ff7('0x40')]){_0x3253f6[_0x1ff7('0x41')]=[{'all':!![]}];}return db[_0x1ff7('0x2b')][_0x1ff7('0x42')](_0x3253f6);})[_0x1ff7('0x24')](function(_0x1347cd){_0x47547e[_0x1ff7('0x43')]=_0x1347cd;return _0x47547e;})[_0x1ff7('0x24')](respondWithFilteredResult(_0x2435c8,_0x3253f6))[_0x1ff7('0x44')](handleError(_0x2435c8,null));};exports[_0x1ff7('0x45')]=function(_0x5a4cb8,_0x1beae9){var _0x8cbd38={'raw':!![],'where':{'id':_0x5a4cb8[_0x1ff7('0x46')]['id']}},_0x1f043e={};_0x1f043e[_0x1ff7('0x2e')]=_[_0x1ff7('0x2f')](db[_0x1ff7('0x2b')][_0x1ff7('0x2c')]);_0x1f043e[_0x1ff7('0x30')]=_[_0x1ff7('0x2f')](_0x5a4cb8['query']);_0x1f043e[_0x1ff7('0x31')]=_[_0x1ff7('0x32')](_0x1f043e[_0x1ff7('0x2e')],_0x1f043e[_0x1ff7('0x30')]);_0x8cbd38[_0x1ff7('0x33')]=_[_0x1ff7('0x32')](_0x1f043e[_0x1ff7('0x2e')],qs[_0x1ff7('0x34')](_0x5a4cb8[_0x1ff7('0x30')][_0x1ff7('0x34')]));_0x8cbd38[_0x1ff7('0x33')]=_0x8cbd38['attributes'][_0x1ff7('0x35')]?_0x8cbd38[_0x1ff7('0x33')]:_0x1f043e['model'];if(_0x5a4cb8[_0x1ff7('0x30')][_0x1ff7('0x40')]){_0x8cbd38['include']=[{'all':!![]}];}_0x8cbd38=_[_0x1ff7('0x3e')]({},_0x8cbd38,_0x5a4cb8[_0x1ff7('0x3f')]);return db['MailSubstatus'][_0x1ff7('0x47')](_0x8cbd38)[_0x1ff7('0x24')](handleEntityNotFound(_0x1beae9,null))[_0x1ff7('0x24')](respondWithResult(_0x1beae9,null))[_0x1ff7('0x44')](handleError(_0x1beae9,null));};exports['create']=function(_0x5e8196,_0x1a506d){return db[_0x1ff7('0x2b')][_0x1ff7('0x48')](_0x5e8196['body'],{})[_0x1ff7('0x24')](respondWithResult(_0x1a506d,0xc9))['catch'](handleError(_0x1a506d,null));};exports[_0x1ff7('0x23')]=function(_0x1fc6b8,_0x384b96){if(_0x1fc6b8[_0x1ff7('0x49')]['id']){delete _0x1fc6b8['body']['id'];}return db[_0x1ff7('0x2b')][_0x1ff7('0x47')]({'where':{'id':_0x1fc6b8[_0x1ff7('0x46')]['id']}})[_0x1ff7('0x24')](handleEntityNotFound(_0x384b96,null))['then'](saveUpdates(_0x1fc6b8[_0x1ff7('0x49')],null))['then'](respondWithResult(_0x384b96,null))[_0x1ff7('0x44')](handleError(_0x384b96,null));};exports[_0x1ff7('0x25')]=function(_0x22e823,_0x41487c){return db[_0x1ff7('0x2b')][_0x1ff7('0x47')]({'where':{'id':_0x22e823[_0x1ff7('0x46')]['id']}})['then'](handleEntityNotFound(_0x41487c,null))[_0x1ff7('0x24')](removeEntity(_0x41487c,null))[_0x1ff7('0x44')](handleError(_0x41487c,null));};exports[_0x1ff7('0x4a')]=function(_0x53552c,_0x12fee9){return db[_0x1ff7('0x2b')]['describe']()[_0x1ff7('0x24')](respondWithResult(_0x12fee9,null))[_0x1ff7('0x44')](handleError(_0x12fee9,null));}; \ No newline at end of file +var _0xebdb=['status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','describe','zip-dir','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xca9639,_0x4b9eb8){var _0x586198=function(_0x14288f){while(--_0x14288f){_0xca9639['push'](_0xca9639['shift']());}};_0x586198(++_0x4b9eb8);}(_0xebdb,0xbf));var _0xbebd=function(_0x567d4e,_0x58f4d4){_0x567d4e=_0x567d4e-0x0;var _0x2041b7=_0xebdb[_0x567d4e];return _0x2041b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbebd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbebd('0x1'));var Mustache=require('mustache');var util=require(_0xbebd('0x2'));var path=require(_0xbebd('0x3'));var sox=require(_0xbebd('0x4'));var csv=require(_0xbebd('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbebd('0x6'));var _=require(_0xbebd('0x7'));var squel=require(_0xbebd('0x8'));var crypto=require(_0xbebd('0x9'));var jsforce=require(_0xbebd('0xa'));var deskjs=require(_0xbebd('0xb'));var toCsv=require(_0xbebd('0x5'));var querystring=require(_0xbebd('0xc'));var Papa=require(_0xbebd('0xd'));var Redis=require(_0xbebd('0xe'));var authService=require(_0xbebd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbebd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbebd('0x11'));var utils=require(_0xbebd('0x12'));var config=require(_0xbebd('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbebd('0x14'))['db'];function respondWithStatusCode(_0x2727b8,_0x1fa00c){_0x1fa00c=_0x1fa00c||0xcc;return function(_0x4195d0){if(_0x4195d0){return _0x2727b8[_0xbebd('0x15')](_0x1fa00c);}return _0x2727b8[_0xbebd('0x16')](_0x1fa00c)[_0xbebd('0x17')]();};}function respondWithResult(_0x2bb69f,_0x3bf244){_0x3bf244=_0x3bf244||0xc8;return function(_0x58ee52){if(_0x58ee52){return _0x2bb69f[_0xbebd('0x16')](_0x3bf244)['json'](_0x58ee52);}};}function respondWithFilteredResult(_0x508401,_0x29a51e){return function(_0x3721b3){if(_0x3721b3){var _0x10cafc=typeof _0x29a51e[_0xbebd('0x18')]==='undefined'&&typeof _0x29a51e[_0xbebd('0x19')]===_0xbebd('0x1a');var _0x47f6fc=_0x3721b3['count'];var _0x1a57d5=_0x10cafc?0x0:_0x29a51e[_0xbebd('0x18')];var _0x1e490f=_0x10cafc?_0x3721b3[_0xbebd('0x1b')]:_0x29a51e[_0xbebd('0x18')]+_0x29a51e[_0xbebd('0x19')];var _0x1a470b;if(_0x1e490f>=_0x47f6fc){_0x1e490f=_0x47f6fc;_0x1a470b=0xc8;}else{_0x1a470b=0xce;}_0x508401[_0xbebd('0x16')](_0x1a470b);return _0x508401[_0xbebd('0x1c')](_0xbebd('0x1d'),_0x1a57d5+'-'+_0x1e490f+'/'+_0x47f6fc)[_0xbebd('0x1e')](_0x3721b3);}return null;};}function patchUpdates(_0x53f31c){return function(_0x212acd){try{jsonpatch[_0xbebd('0x1f')](_0x212acd,_0x53f31c,!![]);}catch(_0x3a7033){return BPromise['reject'](_0x3a7033);}return _0x212acd[_0xbebd('0x20')]();};}function saveUpdates(_0x2d5af0,_0x3be5d2){return function(_0x204123){if(_0x204123){return _0x204123[_0xbebd('0x21')](_0x2d5af0)[_0xbebd('0x22')](function(_0x39a3da){return _0x39a3da;});}return null;};}function removeEntity(_0x45c42c,_0x3c8a67){return function(_0x57ac5c){if(_0x57ac5c){return _0x57ac5c[_0xbebd('0x23')]()[_0xbebd('0x22')](function(){_0x45c42c[_0xbebd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d386d,_0x5fa2b6){return function(_0x5b4e77){if(!_0x5b4e77){_0x9d386d[_0xbebd('0x15')](0x194);}return _0x5b4e77;};}function handleError(_0x2e9107,_0x1e8083){_0x1e8083=_0x1e8083||0x1f4;return function(_0x3ce9da){logger['error'](_0x3ce9da[_0xbebd('0x24')]);if(_0x3ce9da[_0xbebd('0x25')]){delete _0x3ce9da[_0xbebd('0x25')];}_0x2e9107[_0xbebd('0x16')](_0x1e8083)[_0xbebd('0x26')](_0x3ce9da);};}exports[_0xbebd('0x27')]=function(_0x21bc30,_0x3dff71){var _0x124690={},_0x1e3bde={},_0x1a7444={'count':0x0,'rows':[]};var _0x4c6f47=_[_0xbebd('0x28')](db[_0xbebd('0x29')][_0xbebd('0x2a')],function(_0x3bc5a9){return{'name':_0x3bc5a9[_0xbebd('0x2b')],'type':_0x3bc5a9[_0xbebd('0x2c')][_0xbebd('0x2d')]};});_0x1e3bde[_0xbebd('0x2e')]=_[_0xbebd('0x28')](_0x4c6f47,_0xbebd('0x25'));_0x1e3bde[_0xbebd('0x2f')]=_['keys'](_0x21bc30[_0xbebd('0x2f')]);_0x1e3bde['filters']=_[_0xbebd('0x30')](_0x1e3bde['model'],_0x1e3bde['query']);_0x124690['attributes']=_['intersection'](_0x1e3bde['model'],qs['fields'](_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x31')]));_0x124690[_0xbebd('0x32')]=_0x124690[_0xbebd('0x32')][_0xbebd('0x33')]?_0x124690[_0xbebd('0x32')]:_0x1e3bde[_0xbebd('0x2e')];if(!_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x34')](_0xbebd('0x35'))){_0x124690[_0xbebd('0x19')]=qs[_0xbebd('0x19')](_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x19')]);_0x124690[_0xbebd('0x18')]=qs['offset'](_0x21bc30['query'][_0xbebd('0x18')]);}_0x124690['order']=qs[_0xbebd('0x36')](_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x36')]);_0x124690['where']=qs[_0xbebd('0x37')](_[_0xbebd('0x38')](_0x21bc30['query'],_0x1e3bde['filters']),_0x4c6f47);if(_0x21bc30['query'][_0xbebd('0x39')]){_0x124690[_0xbebd('0x3a')]=_[_0xbebd('0x3b')](_0x124690[_0xbebd('0x3a')],{'$or':_[_0xbebd('0x28')](_0x4c6f47,function(_0x4a31fc){if(_0x4a31fc[_0xbebd('0x2c')]!=='VIRTUAL'){var _0x3e3730={};_0x3e3730[_0x4a31fc[_0xbebd('0x25')]]={'$like':'%'+_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x39')]+'%'};return _0x3e3730;}})});}_0x124690=_[_0xbebd('0x3b')]({},_0x124690,_0x21bc30[_0xbebd('0x3c')]);var _0x353063={'where':_0x124690[_0xbebd('0x3a')]};return db[_0xbebd('0x29')][_0xbebd('0x1b')](_0x353063)[_0xbebd('0x22')](function(_0xe5e6df){_0x1a7444[_0xbebd('0x1b')]=_0xe5e6df;if(_0x21bc30[_0xbebd('0x2f')][_0xbebd('0x3d')]){_0x124690['include']=[{'all':!![]}];}return db[_0xbebd('0x29')][_0xbebd('0x3e')](_0x124690);})[_0xbebd('0x22')](function(_0x4ce30d){_0x1a7444[_0xbebd('0x3f')]=_0x4ce30d;return _0x1a7444;})[_0xbebd('0x22')](respondWithFilteredResult(_0x3dff71,_0x124690))[_0xbebd('0x40')](handleError(_0x3dff71,null));};exports['show']=function(_0x24fb65,_0x4b7acd){var _0x62c3d2={'raw':!![],'where':{'id':_0x24fb65['params']['id']}},_0x5844a0={};_0x5844a0[_0xbebd('0x2e')]=_['keys'](db[_0xbebd('0x29')]['rawAttributes']);_0x5844a0[_0xbebd('0x2f')]=_['keys'](_0x24fb65[_0xbebd('0x2f')]);_0x5844a0[_0xbebd('0x37')]=_[_0xbebd('0x30')](_0x5844a0[_0xbebd('0x2e')],_0x5844a0[_0xbebd('0x2f')]);_0x62c3d2['attributes']=_[_0xbebd('0x30')](_0x5844a0[_0xbebd('0x2e')],qs[_0xbebd('0x31')](_0x24fb65[_0xbebd('0x2f')][_0xbebd('0x31')]));_0x62c3d2[_0xbebd('0x32')]=_0x62c3d2[_0xbebd('0x32')][_0xbebd('0x33')]?_0x62c3d2[_0xbebd('0x32')]:_0x5844a0[_0xbebd('0x2e')];if(_0x24fb65[_0xbebd('0x2f')][_0xbebd('0x3d')]){_0x62c3d2[_0xbebd('0x41')]=[{'all':!![]}];}_0x62c3d2=_[_0xbebd('0x3b')]({},_0x62c3d2,_0x24fb65[_0xbebd('0x3c')]);return db[_0xbebd('0x29')][_0xbebd('0x42')](_0x62c3d2)[_0xbebd('0x22')](handleEntityNotFound(_0x4b7acd,null))[_0xbebd('0x22')](respondWithResult(_0x4b7acd,null))[_0xbebd('0x40')](handleError(_0x4b7acd,null));};exports[_0xbebd('0x43')]=function(_0x11b749,_0x408118){return db['MailSubstatus']['create'](_0x11b749[_0xbebd('0x44')],{})[_0xbebd('0x22')](respondWithResult(_0x408118,0xc9))[_0xbebd('0x40')](handleError(_0x408118,null));};exports['update']=function(_0x3d0926,_0x596039){if(_0x3d0926[_0xbebd('0x44')]['id']){delete _0x3d0926[_0xbebd('0x44')]['id'];}return db[_0xbebd('0x29')]['find']({'where':{'id':_0x3d0926[_0xbebd('0x45')]['id']}})['then'](handleEntityNotFound(_0x596039,null))[_0xbebd('0x22')](saveUpdates(_0x3d0926[_0xbebd('0x44')],null))['then'](respondWithResult(_0x596039,null))[_0xbebd('0x40')](handleError(_0x596039,null));};exports['destroy']=function(_0x322241,_0x336907){return db['MailSubstatus'][_0xbebd('0x42')]({'where':{'id':_0x322241[_0xbebd('0x45')]['id']}})[_0xbebd('0x22')](handleEntityNotFound(_0x336907,null))[_0xbebd('0x22')](removeEntity(_0x336907,null))['catch'](handleError(_0x336907,null));};exports[_0xbebd('0x46')]=function(_0x3d7cce,_0x2fe904){return db[_0xbebd('0x29')][_0xbebd('0x46')]()[_0xbebd('0x22')](respondWithResult(_0x2fe904,null))[_0xbebd('0x40')](handleError(_0x2fe904,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 44970a8..6d4ec6a 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 _0xdb3f=['exports','events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2cc67b,_0x4cffe0){var _0xcdabf2=function(_0x2e0814){while(--_0x2e0814){_0x2cc67b['push'](_0x2cc67b['shift']());}};_0xcdabf2(++_0x4cffe0);}(_0xdb3f,0xc9));var _0xfdb3=function(_0x459527,_0x5504bd){_0x459527=_0x459527-0x0;var _0x11c192=_0xdb3f[_0x459527];return _0x11c192;};'use strict';var EventEmitter=require(_0xfdb3('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xfdb3('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xfdb3('0x2')](0x0);var events={'afterUpdate':_0xfdb3('0x3')};function emitEvent(_0x27d471){return function(_0x50bc0a,_0x5d2fb8,_0x45d21b){MailSubstatusEvents[_0xfdb3('0x4')](_0x27d471+':'+_0x50bc0a['id'],_0x50bc0a);MailSubstatusEvents[_0xfdb3('0x4')](_0x27d471,_0x50bc0a);_0x45d21b(null);};}for(var e in events){if(events[_0xfdb3('0x5')](e)){var event=events[e];MailSubstatus[_0xfdb3('0x6')](e,emitEvent(event));}}module[_0xfdb3('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xef49=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xef49,0xbe));var _0x9ef4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xef49[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x9ef4('0x0'))['db'][_0x9ef4('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9ef4('0x2')](0x0);var events={'afterUpdate':_0x9ef4('0x3')};function emitEvent(_0x3a9e96){return function(_0x41d279,_0x6deb0c,_0x8b03fd){MailSubstatusEvents[_0x9ef4('0x4')](_0x3a9e96+':'+_0x41d279['id'],_0x41d279);MailSubstatusEvents[_0x9ef4('0x4')](_0x3a9e96,_0x41d279);_0x8b03fd(null);};}for(var e in events){if(events[_0x9ef4('0x5')](e)){var event=events[e];MailSubstatus[_0x9ef4('0x6')](e,emitEvent(event));}}module[_0x9ef4('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index df1fa68..c37f413 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 _0x3c57=['Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x1834e0,_0x30ddba){var _0x52c0ee=function(_0x46a167){while(--_0x46a167){_0x1834e0['push'](_0x1834e0['shift']());}};_0x52c0ee(++_0x30ddba);}(_0x3c57,0x1c8));var _0x73c5=function(_0x260d60,_0x3a021e){_0x260d60=_0x260d60-0x0;var _0x4ea3ca=_0x3c57[_0x260d60];return _0x4ea3ca;};'use strict';var attributes=require(_0x73c5('0x0'));module[_0x73c5('0x1')]=function(_0x1e6436){var _0x1bfc91=_0x1e6436[_0x73c5('0x2')];return _0x1e6436[_0x73c5('0x3')](_0x73c5('0x4'),attributes,{'tableName':_0x73c5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x50500c,_0x1095e5,_0x1757df){return _0x1bfc91[_0x73c5('0x6')]['update']({'value':_0x50500c[_0x73c5('0x7')]},{'where':{'field':_0x73c5('0x8'),'value':_0x50500c['_previousDataValues'][_0x73c5('0x7')]}})[_0x73c5('0x9')](function(){_0x1757df();})[_0x73c5('0xa')](function(_0x1edaf2){_0x1757df(_0x1edaf2);});}}});}; \ No newline at end of file +var _0x9dfc=['catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues','then'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x9dfc,0x140));var _0xc9df=function(_0x31192e,_0x55914e){_0x31192e=_0x31192e-0x0;var _0x4ebc64=_0x9dfc[_0x31192e];return _0x4ebc64;};'use strict';var attributes=require(_0xc9df('0x0'));module['exports']=function(_0x5c230c){var _0x5dec06=_0x5c230c[_0xc9df('0x1')];return _0x5c230c[_0xc9df('0x2')](_0xc9df('0x3'),attributes,{'tableName':_0xc9df('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x336c0a,_0x19b2c7,_0x147adf){return _0x5dec06[_0xc9df('0x5')][_0xc9df('0x6')]({'value':_0x336c0a[_0xc9df('0x7')]},{'where':{'field':'mailSubstatus','value':_0x336c0a[_0xc9df('0x8')][_0xc9df('0x7')]}})[_0xc9df('0x9')](function(){_0x147adf();})[_0xc9df('0xa')](function(_0xded560){_0x147adf(_0xded560);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 917ffbd..2431996 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 _0x908e=['result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x908e,0x73));var _0xe908=function(_0x3ab5cb,_0x5b9e3d){_0x3ab5cb=_0x3ab5cb-0x0;var _0x46facb=_0x908e[_0x3ab5cb];return _0x46facb;};'use strict';var _=require('lodash');var util=require(_0xe908('0x0'));var moment=require(_0xe908('0x1'));var BPromise=require(_0xe908('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe908('0x3'));var logger=require(_0xe908('0x4'))(_0xe908('0x5'));var config=require(_0xe908('0x6'));var jayson=require(_0xe908('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27ca13,_0x20aa0e,_0x3e5b44){return new BPromise(function(_0x578517,_0x52e1a4){return client[_0xe908('0x8')](_0x27ca13,_0x3e5b44)['then'](function(_0x31e4af){logger[_0xe908('0x9')](_0xe908('0xa'),_0x20aa0e,'request\x20sent');logger[_0xe908('0xb')](_0xe908('0xc'),_0x20aa0e,_0xe908('0xd'),JSON[_0xe908('0xe')](_0x31e4af));if(_0x31e4af[_0xe908('0xf')]){if(_0x31e4af[_0xe908('0xf')][_0xe908('0x10')]===0x1f4){logger[_0xe908('0xf')](_0xe908('0xa'),_0x20aa0e,_0x31e4af[_0xe908('0xf')][_0xe908('0x11')]);return _0x52e1a4(_0x31e4af[_0xe908('0xf')][_0xe908('0x11')]);}logger[_0xe908('0xf')](_0xe908('0xa'),_0x20aa0e,_0x31e4af[_0xe908('0xf')][_0xe908('0x11')]);return _0x578517(_0x31e4af[_0xe908('0xf')][_0xe908('0x11')]);}else{logger[_0xe908('0x9')](_0xe908('0xa'),_0x20aa0e,_0xe908('0xd'));_0x578517(_0x31e4af[_0xe908('0x12')][_0xe908('0x11')]);}})['catch'](function(_0x20ff94){logger[_0xe908('0xf')](_0xe908('0xa'),_0x20aa0e,_0x20ff94);_0x52e1a4(_0x20ff94);});});} \ No newline at end of file +var _0xc9db=['../../config/logger','rpc','jayson/promise','http','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','../../mysqldb','../../config/utils'];(function(_0x12b4c1,_0x59e2c8){var _0x1730cf=function(_0x34e8b5){while(--_0x34e8b5){_0x12b4c1['push'](_0x12b4c1['shift']());}};_0x1730cf(++_0x59e2c8);}(_0xc9db,0xf9));var _0xbc9d=function(_0x4ba9cb,_0x4289a6){_0x4ba9cb=_0x4ba9cb-0x0;var _0x4cd266=_0xc9db[_0x4ba9cb];return _0x4cd266;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbc9d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9d('0x1'))['db'];var utils=require(_0xbc9d('0x2'));var logger=require(_0xbc9d('0x3'))(_0xbc9d('0x4'));var config=require('../../config/environment');var jayson=require(_0xbc9d('0x5'));var client=jayson['client'][_0xbc9d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e2676,_0x3b4c6c,_0x3fe194){return new BPromise(function(_0x14a7f0,_0x59d2c1){return client['request'](_0x5e2676,_0x3fe194)['then'](function(_0x54b223){logger[_0xbc9d('0x7')](_0xbc9d('0x8'),_0x3b4c6c,'request\x20sent');logger[_0xbc9d('0x9')](_0xbc9d('0xa'),_0x3b4c6c,_0xbc9d('0xb'),JSON[_0xbc9d('0xc')](_0x54b223));if(_0x54b223[_0xbc9d('0xd')]){if(_0x54b223[_0xbc9d('0xd')][_0xbc9d('0xe')]===0x1f4){logger[_0xbc9d('0xd')](_0xbc9d('0x8'),_0x3b4c6c,_0x54b223['error']['message']);return _0x59d2c1(_0x54b223[_0xbc9d('0xd')]['message']);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3b4c6c,_0x54b223[_0xbc9d('0xd')]['message']);return _0x14a7f0(_0x54b223[_0xbc9d('0xd')][_0xbc9d('0xf')]);}else{logger[_0xbc9d('0x7')]('MailSubstatus,\x20%s,\x20%s',_0x3b4c6c,'request\x20sent');_0x14a7f0(_0x54b223[_0xbc9d('0x10')][_0xbc9d('0xf')]);}})[_0xbc9d('0x11')](function(_0x1f788b){logger[_0xbc9d('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x3b4c6c,_0x1f788b);_0x59d2c1(_0x1f788b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6077c6d..e3e7f88 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 _0xea2c=['/:id','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','put','update','delete'];(function(_0x3ca809,_0x26e315){var _0x587276=function(_0x24f6bb){while(--_0x24f6bb){_0x3ca809['push'](_0x3ca809['shift']());}};_0x587276(++_0x26e315);}(_0xea2c,0x19f));var _0xcea2=function(_0x11afa3,_0x42ab1a){_0x11afa3=_0x11afa3-0x0;var _0x129657=_0xea2c[_0x11afa3];return _0x129657;};'use strict';var multer=require(_0xcea2('0x0'));var util=require(_0xcea2('0x1'));var path=require('path');var timeout=require(_0xcea2('0x2'));var express=require('express');var router=express[_0xcea2('0x3')]();var fs_extra=require(_0xcea2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcea2('0x5'));var config=require(_0xcea2('0x6'));var controller=require(_0xcea2('0x7'));router[_0xcea2('0x8')]('/',auth[_0xcea2('0x9')](),controller[_0xcea2('0xa')]);router[_0xcea2('0x8')](_0xcea2('0xb'),auth[_0xcea2('0x9')](),controller[_0xcea2('0xc')]);router[_0xcea2('0x8')]('/:id',auth[_0xcea2('0x9')](),controller[_0xcea2('0xd')]);router['post']('/',auth[_0xcea2('0x9')](),controller['create']);router[_0xcea2('0xe')]('/:id',auth[_0xcea2('0x9')](),controller[_0xcea2('0xf')]);router[_0xcea2('0x10')](_0xcea2('0x11'),auth[_0xcea2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3692=['put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2958f8,_0x1b8fda){var _0x1a02c0=function(_0x47642c){while(--_0x47642c){_0x2958f8['push'](_0x2958f8['shift']());}};_0x1a02c0(++_0x1b8fda);}(_0x3692,0x111));var _0x2369=function(_0x2238b1,_0x2cf83b){_0x2238b1=_0x2238b1-0x0;var _0x3bffa6=_0x3692[_0x2238b1];return _0x3bffa6;};'use strict';var multer=require(_0x2369('0x0'));var util=require(_0x2369('0x1'));var path=require(_0x2369('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2369('0x3')]();var fs_extra=require(_0x2369('0x4'));var auth=require(_0x2369('0x5'));var interaction=require(_0x2369('0x6'));var config=require(_0x2369('0x7'));var controller=require('./mailTransferReport.controller');router[_0x2369('0x8')]('/',auth[_0x2369('0x9')](),controller[_0x2369('0xa')]);router[_0x2369('0x8')]('/describe',auth[_0x2369('0x9')](),controller['describe']);router['get'](_0x2369('0xb'),auth[_0x2369('0x9')](),controller[_0x2369('0xc')]);router[_0x2369('0xd')]('/',auth[_0x2369('0x9')](),controller[_0x2369('0xe')]);router[_0x2369('0xf')](_0x2369('0xb'),auth[_0x2369('0x9')](),controller[_0x2369('0x10')]);router[_0x2369('0x11')]('/:id',auth[_0x2369('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 37c1aef..63879af 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x38f374,_0x4b1d43){var _0x3c78a0=function(_0x4cbb16){while(--_0x4cbb16){_0x38f374['push'](_0x38f374['shift']());}};_0x3c78a0(++_0x4b1d43);}(_0xaa88,0x137));var _0x8aa8=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xaa88[_0x3b19ea];return _0x40ece9;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5d0cca,_0x3c46ef){var _0x10a5f1=function(_0x4d72c1){while(--_0x4d72c1){_0x5d0cca['push'](_0x5d0cca['shift']());}};_0x10a5f1(++_0x3c46ef);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 02a13a7..b92f480 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 _0xf1bf=['rows','catch','show','params','intersection','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x79b899,_0x271f68){var _0x51ba28=function(_0x4ca677){while(--_0x4ca677){_0x79b899['push'](_0x79b899['shift']());}};_0x51ba28(++_0x271f68);}(_0xf1bf,0x186));var _0xff1b=function(_0x1c695a,_0x186ab4){_0x1c695a=_0x1c695a-0x0;var _0x38b9e0=_0xf1bf[_0x1c695a];return _0x38b9e0;};'use strict';var emlformat=require(_0xff1b('0x0'));var rimraf=require(_0xff1b('0x1'));var zipdir=require(_0xff1b('0x2'));var jsonpatch=require(_0xff1b('0x3'));var rp=require('request-promise');var moment=require(_0xff1b('0x4'));var BPromise=require(_0xff1b('0x5'));var Mustache=require(_0xff1b('0x6'));var util=require(_0xff1b('0x7'));var path=require(_0xff1b('0x8'));var sox=require(_0xff1b('0x9'));var csv=require(_0xff1b('0xa'));var ejs=require(_0xff1b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff1b('0xc'));var squel=require('squel');var crypto=require(_0xff1b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xff1b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff1b('0xf'));var Redis=require(_0xff1b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff1b('0x11'));var as=require(_0xff1b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff1b('0x13'))(_0xff1b('0x14'));var utils=require(_0xff1b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xff1b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35bd6b,_0x21fb4d){_0x21fb4d=_0x21fb4d||0xcc;return function(_0x120b22){if(_0x120b22){return _0x35bd6b[_0xff1b('0x17')](_0x21fb4d);}return _0x35bd6b['status'](_0x21fb4d)[_0xff1b('0x18')]();};}function respondWithResult(_0x3e532a,_0x34f8c7){_0x34f8c7=_0x34f8c7||0xc8;return function(_0x353321){if(_0x353321){return _0x3e532a['status'](_0x34f8c7)[_0xff1b('0x19')](_0x353321);}};}function respondWithFilteredResult(_0x5007bf,_0x23c527){return function(_0x4409fe){if(_0x4409fe){var _0x405464=typeof _0x23c527[_0xff1b('0x1a')]===_0xff1b('0x1b')&&typeof _0x23c527[_0xff1b('0x1c')]===_0xff1b('0x1b');var _0x1cd54d=_0x4409fe['count'];var _0x88198d=_0x405464?0x0:_0x23c527[_0xff1b('0x1a')];var _0x5c3e98=_0x405464?_0x4409fe[_0xff1b('0x1d')]:_0x23c527[_0xff1b('0x1a')]+_0x23c527[_0xff1b('0x1c')];var _0x153d78;if(_0x5c3e98>=_0x1cd54d){_0x5c3e98=_0x1cd54d;_0x153d78=0xc8;}else{_0x153d78=0xce;}_0x5007bf[_0xff1b('0x1e')](_0x153d78);return _0x5007bf[_0xff1b('0x1f')]('Content-Range',_0x88198d+'-'+_0x5c3e98+'/'+_0x1cd54d)[_0xff1b('0x19')](_0x4409fe);}return null;};}function patchUpdates(_0x1a0cd1){return function(_0x292a9f){try{jsonpatch[_0xff1b('0x20')](_0x292a9f,_0x1a0cd1,!![]);}catch(_0x455c93){return BPromise[_0xff1b('0x21')](_0x455c93);}return _0x292a9f[_0xff1b('0x22')]();};}function saveUpdates(_0x4a5474,_0x3085b1){return function(_0x14722b){if(_0x14722b){return _0x14722b[_0xff1b('0x23')](_0x4a5474)[_0xff1b('0x24')](function(_0x199d63){return _0x199d63;});}return null;};}function removeEntity(_0x46b020,_0x50cec4){return function(_0x4db675){if(_0x4db675){return _0x4db675[_0xff1b('0x25')]()[_0xff1b('0x24')](function(){_0x46b020[_0xff1b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x402e73,_0x150ee0){return function(_0x24b8b1){if(!_0x24b8b1){_0x402e73['sendStatus'](0x194);}return _0x24b8b1;};}function handleError(_0xef4c32,_0x5d1646){_0x5d1646=_0x5d1646||0x1f4;return function(_0x48aa8a){logger[_0xff1b('0x26')](_0x48aa8a[_0xff1b('0x27')]);if(_0x48aa8a[_0xff1b('0x28')]){delete _0x48aa8a[_0xff1b('0x28')];}_0xef4c32[_0xff1b('0x1e')](_0x5d1646)[_0xff1b('0x29')](_0x48aa8a);};}exports[_0xff1b('0x2a')]=function(_0x5213e7,_0xa02e58){var _0x3d282b={},_0x237321={},_0xd87f3e={'count':0x0,'rows':[]};var _0x5c039d=_[_0xff1b('0x2b')](db[_0xff1b('0x2c')]['rawAttributes'],function(_0x3a13b0){return{'name':_0x3a13b0[_0xff1b('0x2d')],'type':_0x3a13b0['type']['key']};});_0x237321[_0xff1b('0x2e')]=_[_0xff1b('0x2b')](_0x5c039d,'name');_0x237321[_0xff1b('0x2f')]=_[_0xff1b('0x30')](_0x5213e7[_0xff1b('0x2f')]);_0x237321[_0xff1b('0x31')]=_['intersection'](_0x237321[_0xff1b('0x2e')],_0x237321[_0xff1b('0x2f')]);_0x3d282b['attributes']=_['intersection'](_0x237321[_0xff1b('0x2e')],qs['fields'](_0x5213e7[_0xff1b('0x2f')][_0xff1b('0x32')]));_0x3d282b[_0xff1b('0x33')]=_0x3d282b['attributes'][_0xff1b('0x34')]?_0x3d282b[_0xff1b('0x33')]:_0x237321[_0xff1b('0x2e')];if(!_0x5213e7[_0xff1b('0x2f')][_0xff1b('0x35')](_0xff1b('0x36'))){_0x3d282b[_0xff1b('0x1c')]=qs[_0xff1b('0x1c')](_0x5213e7['query']['limit']);_0x3d282b[_0xff1b('0x1a')]=qs[_0xff1b('0x1a')](_0x5213e7[_0xff1b('0x2f')]['offset']);}_0x3d282b[_0xff1b('0x37')]=qs['sort'](_0x5213e7[_0xff1b('0x2f')][_0xff1b('0x38')]);_0x3d282b[_0xff1b('0x39')]=qs[_0xff1b('0x31')](_[_0xff1b('0x3a')](_0x5213e7[_0xff1b('0x2f')],_0x237321[_0xff1b('0x31')]),_0x5c039d);if(_0x5213e7['query'][_0xff1b('0x3b')]){_0x3d282b[_0xff1b('0x39')]=_['merge'](_0x3d282b[_0xff1b('0x39')],{'$or':_['map'](_0x5c039d,function(_0xf969ec){if(_0xf969ec[_0xff1b('0x3c')]!==_0xff1b('0x3d')){var _0x5d6227={};_0x5d6227[_0xf969ec[_0xff1b('0x28')]]={'$like':'%'+_0x5213e7['query'][_0xff1b('0x3b')]+'%'};return _0x5d6227;}})});}_0x3d282b=_['merge']({},_0x3d282b,_0x5213e7[_0xff1b('0x3e')]);var _0x2a6724={'where':_0x3d282b[_0xff1b('0x39')]};return db[_0xff1b('0x2c')][_0xff1b('0x1d')](_0x2a6724)[_0xff1b('0x24')](function(_0xe51e01){_0xd87f3e['count']=_0xe51e01;if(_0x5213e7[_0xff1b('0x2f')][_0xff1b('0x3f')]){_0x3d282b[_0xff1b('0x40')]=[{'all':!![]}];}return db[_0xff1b('0x2c')][_0xff1b('0x41')](_0x3d282b);})[_0xff1b('0x24')](function(_0x8df653){_0xd87f3e[_0xff1b('0x42')]=_0x8df653;return _0xd87f3e;})[_0xff1b('0x24')](respondWithFilteredResult(_0xa02e58,_0x3d282b))[_0xff1b('0x43')](handleError(_0xa02e58,null));};exports[_0xff1b('0x44')]=function(_0x2b56f9,_0xfadc0f){var _0x5bbf24={'raw':!![],'where':{'id':_0x2b56f9[_0xff1b('0x45')]['id']}},_0x32d8a9={};_0x32d8a9[_0xff1b('0x2e')]=_['keys'](db[_0xff1b('0x2c')]['rawAttributes']);_0x32d8a9['query']=_[_0xff1b('0x30')](_0x2b56f9[_0xff1b('0x2f')]);_0x32d8a9[_0xff1b('0x31')]=_[_0xff1b('0x46')](_0x32d8a9[_0xff1b('0x2e')],_0x32d8a9[_0xff1b('0x2f')]);_0x5bbf24[_0xff1b('0x33')]=_[_0xff1b('0x46')](_0x32d8a9[_0xff1b('0x2e')],qs[_0xff1b('0x32')](_0x2b56f9[_0xff1b('0x2f')][_0xff1b('0x32')]));_0x5bbf24['attributes']=_0x5bbf24[_0xff1b('0x33')]['length']?_0x5bbf24[_0xff1b('0x33')]:_0x32d8a9[_0xff1b('0x2e')];if(_0x2b56f9[_0xff1b('0x2f')][_0xff1b('0x3f')]){_0x5bbf24['include']=[{'all':!![]}];}_0x5bbf24=_[_0xff1b('0x47')]({},_0x5bbf24,_0x2b56f9['options']);return db['MailTransferReport'][_0xff1b('0x48')](_0x5bbf24)[_0xff1b('0x24')](handleEntityNotFound(_0xfadc0f,null))[_0xff1b('0x24')](respondWithResult(_0xfadc0f,null))[_0xff1b('0x43')](handleError(_0xfadc0f,null));};exports[_0xff1b('0x49')]=function(_0x2a5dc6,_0x2273b3){return db[_0xff1b('0x2c')]['create'](_0x2a5dc6[_0xff1b('0x4a')],{})['then'](respondWithResult(_0x2273b3,0xc9))['catch'](handleError(_0x2273b3,null));};exports[_0xff1b('0x23')]=function(_0x4932c2,_0x175be7){if(_0x4932c2[_0xff1b('0x4a')]['id']){delete _0x4932c2[_0xff1b('0x4a')]['id'];}return db[_0xff1b('0x2c')][_0xff1b('0x48')]({'where':{'id':_0x4932c2[_0xff1b('0x45')]['id']}})[_0xff1b('0x24')](handleEntityNotFound(_0x175be7,null))[_0xff1b('0x24')](saveUpdates(_0x4932c2[_0xff1b('0x4a')],null))[_0xff1b('0x24')](respondWithResult(_0x175be7,null))[_0xff1b('0x43')](handleError(_0x175be7,null));};exports[_0xff1b('0x25')]=function(_0x4a042a,_0x848246){return db[_0xff1b('0x2c')][_0xff1b('0x48')]({'where':{'id':_0x4a042a['params']['id']}})[_0xff1b('0x24')](handleEntityNotFound(_0x848246,null))[_0xff1b('0x24')](removeEntity(_0x848246,null))[_0xff1b('0x43')](handleError(_0x848246,null));};exports[_0xff1b('0x4b')]=function(_0x4652b7,_0x354f81){return db[_0xff1b('0x2c')]['describe']()[_0xff1b('0x24')](respondWithResult(_0x354f81,null))['catch'](handleError(_0x354f81,null));}; \ No newline at end of file +var _0xfe63=['filter','merge','options','findAll','catch','show','params','includeAll','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','stack','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick'];(function(_0x490b3d,_0x3cc22f){var _0x33ab10=function(_0x1312ae){while(--_0x1312ae){_0x490b3d['push'](_0x490b3d['shift']());}};_0x33ab10(++_0x3cc22f);}(_0xfe63,0x1c4));var _0x3fe6=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfe63[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x3fe6('0x0'));var rimraf=require(_0x3fe6('0x1'));var zipdir=require(_0x3fe6('0x2'));var jsonpatch=require(_0x3fe6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fe6('0x4'));var Mustache=require(_0x3fe6('0x5'));var util=require(_0x3fe6('0x6'));var path=require(_0x3fe6('0x7'));var sox=require(_0x3fe6('0x8'));var csv=require('to-csv');var ejs=require(_0x3fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x3fe6('0xa'));var _=require(_0x3fe6('0xb'));var squel=require(_0x3fe6('0xc'));var crypto=require(_0x3fe6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3fe6('0xe'));var querystring=require(_0x3fe6('0xf'));var Papa=require(_0x3fe6('0x10'));var Redis=require(_0x3fe6('0x11'));var authService=require(_0x3fe6('0x12'));var qs=require(_0x3fe6('0x13'));var as=require(_0x3fe6('0x14'));var hardwareService=require(_0x3fe6('0x15'));var logger=require('../../config/logger')(_0x3fe6('0x16'));var utils=require('../../config/utils');var config=require(_0x3fe6('0x17'));var licenseUtil=require(_0x3fe6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb3a5d,_0x3c6687){_0x3c6687=_0x3c6687||0xcc;return function(_0x3ee682){if(_0x3ee682){return _0xfb3a5d[_0x3fe6('0x19')](_0x3c6687);}return _0xfb3a5d[_0x3fe6('0x1a')](_0x3c6687)[_0x3fe6('0x1b')]();};}function respondWithResult(_0x57f5f7,_0x53edf8){_0x53edf8=_0x53edf8||0xc8;return function(_0x295095){if(_0x295095){return _0x57f5f7[_0x3fe6('0x1a')](_0x53edf8)[_0x3fe6('0x1c')](_0x295095);}};}function respondWithFilteredResult(_0x59e1f9,_0x40f034){return function(_0x4b75e7){if(_0x4b75e7){var _0x8714e5=typeof _0x40f034[_0x3fe6('0x1d')]===_0x3fe6('0x1e')&&typeof _0x40f034[_0x3fe6('0x1f')]===_0x3fe6('0x1e');var _0xac27f9=_0x4b75e7[_0x3fe6('0x20')];var _0x372e0e=_0x8714e5?0x0:_0x40f034[_0x3fe6('0x1d')];var _0x4a029f=_0x8714e5?_0x4b75e7['count']:_0x40f034['offset']+_0x40f034['limit'];var _0x1151d0;if(_0x4a029f>=_0xac27f9){_0x4a029f=_0xac27f9;_0x1151d0=0xc8;}else{_0x1151d0=0xce;}_0x59e1f9['status'](_0x1151d0);return _0x59e1f9[_0x3fe6('0x21')]('Content-Range',_0x372e0e+'-'+_0x4a029f+'/'+_0xac27f9)[_0x3fe6('0x1c')](_0x4b75e7);}return null;};}function patchUpdates(_0x23d83e){return function(_0x7aa856){try{jsonpatch['apply'](_0x7aa856,_0x23d83e,!![]);}catch(_0x32e121){return BPromise[_0x3fe6('0x22')](_0x32e121);}return _0x7aa856[_0x3fe6('0x23')]();};}function saveUpdates(_0x4b6c54,_0x2ff3a5){return function(_0x18cc07){if(_0x18cc07){return _0x18cc07[_0x3fe6('0x24')](_0x4b6c54)[_0x3fe6('0x25')](function(_0x4ad52a){return _0x4ad52a;});}return null;};}function removeEntity(_0x1821ec,_0x2d47dc){return function(_0x4ee8f4){if(_0x4ee8f4){return _0x4ee8f4['destroy']()[_0x3fe6('0x25')](function(){_0x1821ec[_0x3fe6('0x1a')](0xcc)[_0x3fe6('0x1b')]();});}};}function handleEntityNotFound(_0x3b48d5,_0x20efc0){return function(_0x2993bb){if(!_0x2993bb){_0x3b48d5[_0x3fe6('0x19')](0x194);}return _0x2993bb;};}function handleError(_0x571fe0,_0x847b0c){_0x847b0c=_0x847b0c||0x1f4;return function(_0x3ff237){logger['error'](_0x3ff237[_0x3fe6('0x26')]);if(_0x3ff237['name']){delete _0x3ff237['name'];}_0x571fe0[_0x3fe6('0x1a')](_0x847b0c)[_0x3fe6('0x27')](_0x3ff237);};}exports[_0x3fe6('0x28')]=function(_0x364165,_0x49bb57){var _0x2bb698={},_0x5333c2={},_0x25df26={'count':0x0,'rows':[]};var _0x57526c=_[_0x3fe6('0x29')](db[_0x3fe6('0x2a')][_0x3fe6('0x2b')],function(_0x282485){return{'name':_0x282485[_0x3fe6('0x2c')],'type':_0x282485[_0x3fe6('0x2d')][_0x3fe6('0x2e')]};});_0x5333c2[_0x3fe6('0x2f')]=_[_0x3fe6('0x29')](_0x57526c,_0x3fe6('0x30'));_0x5333c2[_0x3fe6('0x31')]=_[_0x3fe6('0x32')](_0x364165[_0x3fe6('0x31')]);_0x5333c2[_0x3fe6('0x33')]=_['intersection'](_0x5333c2[_0x3fe6('0x2f')],_0x5333c2[_0x3fe6('0x31')]);_0x2bb698[_0x3fe6('0x34')]=_[_0x3fe6('0x35')](_0x5333c2[_0x3fe6('0x2f')],qs[_0x3fe6('0x36')](_0x364165[_0x3fe6('0x31')]['fields']));_0x2bb698['attributes']=_0x2bb698['attributes']['length']?_0x2bb698[_0x3fe6('0x34')]:_0x5333c2[_0x3fe6('0x2f')];if(!_0x364165[_0x3fe6('0x31')][_0x3fe6('0x37')]('nolimit')){_0x2bb698['limit']=qs[_0x3fe6('0x1f')](_0x364165['query']['limit']);_0x2bb698[_0x3fe6('0x1d')]=qs[_0x3fe6('0x1d')](_0x364165[_0x3fe6('0x31')]['offset']);}_0x2bb698['order']=qs[_0x3fe6('0x38')](_0x364165[_0x3fe6('0x31')][_0x3fe6('0x38')]);_0x2bb698[_0x3fe6('0x39')]=qs[_0x3fe6('0x33')](_[_0x3fe6('0x3a')](_0x364165['query'],_0x5333c2[_0x3fe6('0x33')]),_0x57526c);if(_0x364165['query'][_0x3fe6('0x3b')]){_0x2bb698[_0x3fe6('0x39')]=_[_0x3fe6('0x3c')](_0x2bb698[_0x3fe6('0x39')],{'$or':_['map'](_0x57526c,function(_0x475c44){if(_0x475c44[_0x3fe6('0x2d')]!=='VIRTUAL'){var _0x20d84f={};_0x20d84f[_0x475c44[_0x3fe6('0x30')]]={'$like':'%'+_0x364165[_0x3fe6('0x31')][_0x3fe6('0x3b')]+'%'};return _0x20d84f;}})});}_0x2bb698=_[_0x3fe6('0x3c')]({},_0x2bb698,_0x364165[_0x3fe6('0x3d')]);var _0x33602c={'where':_0x2bb698[_0x3fe6('0x39')]};return db[_0x3fe6('0x2a')][_0x3fe6('0x20')](_0x33602c)[_0x3fe6('0x25')](function(_0x56d9b6){_0x25df26[_0x3fe6('0x20')]=_0x56d9b6;if(_0x364165['query']['includeAll']){_0x2bb698['include']=[{'all':!![]}];}return db[_0x3fe6('0x2a')][_0x3fe6('0x3e')](_0x2bb698);})['then'](function(_0x2d6c02){_0x25df26['rows']=_0x2d6c02;return _0x25df26;})[_0x3fe6('0x25')](respondWithFilteredResult(_0x49bb57,_0x2bb698))[_0x3fe6('0x3f')](handleError(_0x49bb57,null));};exports[_0x3fe6('0x40')]=function(_0x2df7d2,_0x179d17){var _0x849109={'raw':!![],'where':{'id':_0x2df7d2[_0x3fe6('0x41')]['id']}},_0x3ef113={};_0x3ef113[_0x3fe6('0x2f')]=_['keys'](db[_0x3fe6('0x2a')]['rawAttributes']);_0x3ef113[_0x3fe6('0x31')]=_[_0x3fe6('0x32')](_0x2df7d2[_0x3fe6('0x31')]);_0x3ef113[_0x3fe6('0x33')]=_[_0x3fe6('0x35')](_0x3ef113['model'],_0x3ef113['query']);_0x849109['attributes']=_[_0x3fe6('0x35')](_0x3ef113[_0x3fe6('0x2f')],qs[_0x3fe6('0x36')](_0x2df7d2[_0x3fe6('0x31')]['fields']));_0x849109[_0x3fe6('0x34')]=_0x849109[_0x3fe6('0x34')]['length']?_0x849109[_0x3fe6('0x34')]:_0x3ef113[_0x3fe6('0x2f')];if(_0x2df7d2[_0x3fe6('0x31')][_0x3fe6('0x42')]){_0x849109[_0x3fe6('0x43')]=[{'all':!![]}];}_0x849109=_[_0x3fe6('0x3c')]({},_0x849109,_0x2df7d2['options']);return db[_0x3fe6('0x2a')]['find'](_0x849109)[_0x3fe6('0x25')](handleEntityNotFound(_0x179d17,null))[_0x3fe6('0x25')](respondWithResult(_0x179d17,null))[_0x3fe6('0x3f')](handleError(_0x179d17,null));};exports[_0x3fe6('0x44')]=function(_0x4b924d,_0x4b561d){return db[_0x3fe6('0x2a')][_0x3fe6('0x44')](_0x4b924d[_0x3fe6('0x45')],{})[_0x3fe6('0x25')](respondWithResult(_0x4b561d,0xc9))[_0x3fe6('0x3f')](handleError(_0x4b561d,null));};exports[_0x3fe6('0x24')]=function(_0x2ab93a,_0x3ec17e){if(_0x2ab93a[_0x3fe6('0x45')]['id']){delete _0x2ab93a[_0x3fe6('0x45')]['id'];}return db[_0x3fe6('0x2a')][_0x3fe6('0x46')]({'where':{'id':_0x2ab93a['params']['id']}})[_0x3fe6('0x25')](handleEntityNotFound(_0x3ec17e,null))['then'](saveUpdates(_0x2ab93a['body'],null))[_0x3fe6('0x25')](respondWithResult(_0x3ec17e,null))[_0x3fe6('0x3f')](handleError(_0x3ec17e,null));};exports[_0x3fe6('0x47')]=function(_0x4fb3ce,_0x4a7a77){return db[_0x3fe6('0x2a')][_0x3fe6('0x46')]({'where':{'id':_0x4fb3ce[_0x3fe6('0x41')]['id']}})[_0x3fe6('0x25')](handleEntityNotFound(_0x4a7a77,null))[_0x3fe6('0x25')](removeEntity(_0x4a7a77,null))[_0x3fe6('0x3f')](handleError(_0x4a7a77,null));};exports[_0x3fe6('0x48')]=function(_0x5bbd47,_0x6787fd){return db['MailTransferReport']['describe']()[_0x3fe6('0x25')](respondWithResult(_0x6787fd,null))['catch'](handleError(_0x6787fd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c41c837..e8f1b96 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 _0x0689=['../../config/environment','./mailTransferReport.attributes','exports','define','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x492f17,_0x522a19){var _0x415c4e=function(_0x4113fb){while(--_0x4113fb){_0x492f17['push'](_0x492f17['shift']());}};_0x415c4e(++_0x522a19);}(_0x0689,0x161));var _0x9068=function(_0x46b832,_0x454e18){_0x46b832=_0x46b832-0x0;var _0x42b328=_0x0689[_0x46b832];return _0x42b328;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9068('0xb'),'fields':[_0x9068('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6898=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x5b898c,_0x2d1c61){var _0x293f21=function(_0x46d9d4){while(--_0x46d9d4){_0x5b898c['push'](_0x5b898c['shift']());}};_0x293f21(++_0x2d1c61);}(_0x6898,0x11b));var _0x8689=function(_0x2f1550,_0x34d9b4){_0x2f1550=_0x2f1550-0x0;var _0xde0975=_0x6898[_0x2f1550];return _0xde0975;};'use strict';var _=require(_0x8689('0x0'));var util=require('util');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var moment=require(_0x8689('0x3'));var BPromise=require(_0x8689('0x4'));var rp=require(_0x8689('0x5'));var fs=require('fs');var path=require(_0x8689('0x6'));var rimraf=require(_0x8689('0x7'));var config=require('../../config/environment');var attributes=require(_0x8689('0x8'));module[_0x8689('0x9')]=function(_0x2c723e,_0x4e776d){return _0x2c723e[_0x8689('0xa')](_0x8689('0xb'),attributes,{'tableName':_0x8689('0xc'),'paranoid':![],'indexes':[{'name':_0x8689('0xd'),'fields':[_0x8689('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 31d4018..06b77fe 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 _0xdf17=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x5358fd,_0x4a719c){var _0x3adc9e=function(_0x43332c){while(--_0x43332c){_0x5358fd['push'](_0x5358fd['shift']());}};_0x3adc9e(++_0x4a719c);}(_0xdf17,0x96));var _0x7df1=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xdf17[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7df1('0x0'));var util=require('util');var moment=require(_0x7df1('0x1'));var BPromise=require(_0x7df1('0x2'));var rs=require(_0x7df1('0x3'));var fs=require('fs');var Redis=require(_0x7df1('0x4'));var db=require(_0x7df1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7df1('0x6'))(_0x7df1('0x7'));var config=require(_0x7df1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7df1('0x9')][_0x7df1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28c44d,_0x13b590,_0x308aaf){return new BPromise(function(_0x3c0d41,_0x34f3f4){return client[_0x7df1('0xb')](_0x28c44d,_0x308aaf)[_0x7df1('0xc')](function(_0x471360){logger[_0x7df1('0xd')](_0x7df1('0xe'),_0x13b590,'request\x20sent');logger['debug'](_0x7df1('0xf'),_0x13b590,_0x7df1('0x10'),JSON[_0x7df1('0x11')](_0x471360));if(_0x471360[_0x7df1('0x12')]){if(_0x471360[_0x7df1('0x12')][_0x7df1('0x13')]===0x1f4){logger[_0x7df1('0x12')](_0x7df1('0xe'),_0x13b590,_0x471360[_0x7df1('0x12')][_0x7df1('0x14')]);return _0x34f3f4(_0x471360[_0x7df1('0x12')][_0x7df1('0x14')]);}logger[_0x7df1('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x13b590,_0x471360['error'][_0x7df1('0x14')]);return _0x3c0d41(_0x471360['error']['message']);}else{logger[_0x7df1('0xd')](_0x7df1('0xe'),_0x13b590,_0x7df1('0x10'));_0x3c0d41(_0x471360[_0x7df1('0x15')]['message']);}})['catch'](function(_0x173afe){logger[_0x7df1('0x12')](_0x7df1('0xe'),_0x13b590,_0x173afe);_0x34f3f4(_0x173afe);});});} \ No newline at end of file +var _0x84fc=['jayson/promise','client','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x84fc,0x7b));var _0xc84f=function(_0x37db9f,_0x4c93ed){_0x37db9f=_0x37db9f-0x0;var _0x48fb29=_0x84fc[_0x37db9f];return _0x48fb29;};'use strict';var _=require(_0xc84f('0x0'));var util=require(_0xc84f('0x1'));var moment=require(_0xc84f('0x2'));var BPromise=require(_0xc84f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc84f('0x4'));var db=require(_0xc84f('0x5'))['db'];var utils=require(_0xc84f('0x6'));var logger=require('../../config/logger')(_0xc84f('0x7'));var config=require(_0xc84f('0x8'));var jayson=require(_0xc84f('0x9'));var client=jayson[_0xc84f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c35d2,_0x9cb8c8,_0x209f61){return new BPromise(function(_0xb2f47,_0x478027){return client['request'](_0x1c35d2,_0x209f61)[_0xc84f('0xb')](function(_0x2dac45){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x9cb8c8,_0xc84f('0xc'));logger[_0xc84f('0xd')](_0xc84f('0xe'),_0x9cb8c8,_0xc84f('0xc'),JSON[_0xc84f('0xf')](_0x2dac45));if(_0x2dac45[_0xc84f('0x10')]){if(_0x2dac45[_0xc84f('0x10')][_0xc84f('0x11')]===0x1f4){logger[_0xc84f('0x10')](_0xc84f('0x12'),_0x9cb8c8,_0x2dac45[_0xc84f('0x10')]['message']);return _0x478027(_0x2dac45[_0xc84f('0x10')][_0xc84f('0x13')]);}logger[_0xc84f('0x10')](_0xc84f('0x12'),_0x9cb8c8,_0x2dac45[_0xc84f('0x10')][_0xc84f('0x13')]);return _0xb2f47(_0x2dac45[_0xc84f('0x10')]['message']);}else{logger[_0xc84f('0x14')](_0xc84f('0x12'),_0x9cb8c8,_0xc84f('0xc'));_0xb2f47(_0x2dac45['result'][_0xc84f('0x13')]);}})[_0xc84f('0x15')](function(_0x4eb358){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x9cb8c8,_0x4eb358);_0x478027(_0x4eb358);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index deddd06..da863ae 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 _0xa480=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','/:id','destroy','multer','util'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xa480,0x76));var _0x0a48=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xa480[_0xbb9dbf];return _0x30223c;};'use strict';var multer=require(_0x0a48('0x0'));var util=require(_0x0a48('0x1'));var path=require(_0x0a48('0x2'));var timeout=require(_0x0a48('0x3'));var express=require('express');var router=express[_0x0a48('0x4')]();var fs_extra=require(_0x0a48('0x5'));var auth=require(_0x0a48('0x6'));var interaction=require(_0x0a48('0x7'));var config=require('../../config/environment');var controller=require(_0x0a48('0x8'));router[_0x0a48('0x9')]('/',auth[_0x0a48('0xa')](),controller[_0x0a48('0xb')]);router[_0x0a48('0x9')](_0x0a48('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0a48('0x9')]('/:id',auth[_0x0a48('0xa')](),controller[_0x0a48('0xd')]);router[_0x0a48('0xe')]('/',auth[_0x0a48('0xa')](),controller[_0x0a48('0xf')]);router[_0x0a48('0x10')]('/:id',auth[_0x0a48('0xa')](),controller[_0x0a48('0x11')]);router['delete'](_0x0a48('0x12'),auth[_0x0a48('0xa')](),controller[_0x0a48('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4603=['create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4603,0x6f));var _0x3460=function(_0x7f7c28,_0x269b9c){_0x7f7c28=_0x7f7c28-0x0;var _0x43f3fb=_0x4603[_0x7f7c28];return _0x43f3fb;};'use strict';var multer=require(_0x3460('0x0'));var util=require(_0x3460('0x1'));var path=require(_0x3460('0x2'));var timeout=require(_0x3460('0x3'));var express=require('express');var router=express[_0x3460('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3460('0x5'));var interaction=require(_0x3460('0x6'));var config=require(_0x3460('0x7'));var controller=require(_0x3460('0x8'));router[_0x3460('0x9')]('/',auth[_0x3460('0xa')](),controller[_0x3460('0xb')]);router[_0x3460('0x9')](_0x3460('0xc'),auth[_0x3460('0xa')](),controller['describe']);router[_0x3460('0x9')](_0x3460('0xd'),auth[_0x3460('0xa')](),controller[_0x3460('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3460('0xf')]);router['put'](_0x3460('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3460('0xa')](),controller[_0x3460('0x10')]);module[_0x3460('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f95582f..8202f24 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 _0x08f6=['INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x08f6,0x1d5));var _0x608f=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x08f6[_0x326e79];return _0x37eb89;};'use strict';var Sequelize=require(_0x608f('0x0'));var moment=require(_0x608f('0x1'));module[_0x608f('0x2')]={'channel':{'type':Sequelize[_0x608f('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x608f('0x3')]},'type':{'type':Sequelize[_0x608f('0x3')],'defaultValue':_0x608f('0x4'),'comment':_0x608f('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x608f('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x714a9c){var _0x3e27e7=moment(_0x714a9c);var _0x7d09be=moment(this[_0x608f('0x7')](_0x608f('0x8')));var _0x62d47f=_0x3e27e7[_0x608f('0x9')](_0x7d09be,'seconds');this[_0x608f('0xa')](_0x608f('0xb'),_0x714a9c);this[_0x608f('0xa')](_0x608f('0xc'),_0x62d47f>=0x0?_0x62d47f:null);}},'data1':{'type':Sequelize[_0x608f('0x3')],'comment':_0x608f('0xd')},'data2':{'type':Sequelize[_0x608f('0x3')],'comment':_0x608f('0xe')},'data3':{'type':Sequelize[_0x608f('0x3')],'comment':_0x608f('0xf')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x608f('0x10')},'role':{'type':Sequelize[_0x608f('0x3')]},'internal':{'type':Sequelize[_0x608f('0x11')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6746=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING'];(function(_0x58712a,_0x1d88a9){var _0x342032=function(_0x5365f0){while(--_0x5365f0){_0x58712a['push'](_0x58712a['shift']());}};_0x342032(++_0x1d88a9);}(_0x6746,0xe7));var _0x6674=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x6746[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6674('0x0'));module[_0x6674('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6674('0x2')]},'interface':{'type':Sequelize[_0x6674('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x6674('0x3'),'comment':_0x6674('0x4')},'duration':{'type':Sequelize[_0x6674('0x5')]},'enterAt':{'type':Sequelize[_0x6674('0x6')]},'exitAt':{'type':Sequelize[_0x6674('0x6')],'set':function(_0x2cee3f){var _0x42bceb=moment(_0x2cee3f);var _0xb04ce1=moment(this[_0x6674('0x7')](_0x6674('0x8')));var _0x2c95b5=_0x42bceb['diff'](_0xb04ce1,_0x6674('0x9'));this[_0x6674('0xa')](_0x6674('0xb'),_0x2cee3f);this[_0x6674('0xa')](_0x6674('0xc'),_0x2c95b5>=0x0?_0x2c95b5:null);}},'data1':{'type':Sequelize[_0x6674('0x2')],'comment':_0x6674('0xd')},'data2':{'type':Sequelize[_0x6674('0x2')],'comment':_0x6674('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x6674('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x6674('0x10')},'data5':{'type':Sequelize[_0x6674('0x2')],'comment':_0x6674('0x11')},'role':{'type':Sequelize[_0x6674('0x2')]},'internal':{'type':Sequelize[_0x6674('0x5')]},'uniqueid':{'type':Sequelize[_0x6674('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e28556b..a51491a 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x80764,_0x389472){var _0x461709=function(_0x1bbdc1){while(--_0x1bbdc1){_0x80764['push'](_0x80764['shift']());}};_0x461709(++_0x389472);}(_0x008c,0x188));var _0xc008=function(_0x22ea59,_0x387ed1){_0x22ea59=_0x22ea59-0x0;var _0x444611=_0x008c[_0x22ea59];return _0x444611;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x23a33f,_0x413c03){var _0x56e720=function(_0x21a646){while(--_0x21a646){_0x23a33f['push'](_0x23a33f['shift']());}};_0x56e720(++_0x413c03);}(_0x3e74,0x175));var _0x43e7=function(_0x23d3a5,_0x34feed){_0x23d3a5=_0x23d3a5-0x0;var _0x19988b=_0x3e74[_0x23d3a5];return _0x19988b;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1e5fb14..ae67f35 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 _0xb209=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','../../config/logger'];(function(_0x10ea84,_0x31a73d){var _0x1847b3=function(_0x9df7fa){while(--_0x9df7fa){_0x10ea84['push'](_0x10ea84['shift']());}};_0x1847b3(++_0x31a73d);}(_0xb209,0x16e));var _0x9b20=function(_0x227ceb,_0x184cae){_0x227ceb=_0x227ceb-0x0;var _0x2e067e=_0xb209[_0x227ceb];return _0x2e067e;};'use strict';var _=require(_0x9b20('0x0'));var util=require('util');var logger=require(_0x9b20('0x1'))(_0x9b20('0x2'));var moment=require(_0x9b20('0x3'));var BPromise=require(_0x9b20('0x4'));var rp=require(_0x9b20('0x5'));var fs=require('fs');var path=require(_0x9b20('0x6'));var rimraf=require(_0x9b20('0x7'));var config=require(_0x9b20('0x8'));var attributes=require(_0x9b20('0x9'));module[_0x9b20('0xa')]=function(_0x26c338,_0x1e9707){return _0x26c338[_0x9b20('0xb')](_0x9b20('0xc'),attributes,{'tableName':_0x9b20('0xd'),'paranoid':![],'indexes':[{'name':_0x9b20('0xe'),'fields':['membername',_0x9b20('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88ae=['report_member','membername_interface','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MemberReport'];(function(_0x44f0e5,_0xc889fd){var _0x277d40=function(_0x458b0b){while(--_0x458b0b){_0x44f0e5['push'](_0x44f0e5['shift']());}};_0x277d40(++_0xc889fd);}(_0x88ae,0xab));var _0xe88a=function(_0x104c75,_0x478092){_0x104c75=_0x104c75-0x0;var _0x20b8a8=_0x88ae[_0x104c75];return _0x20b8a8;};'use strict';var _=require(_0xe88a('0x0'));var util=require('util');var logger=require(_0xe88a('0x1'))(_0xe88a('0x2'));var moment=require(_0xe88a('0x3'));var BPromise=require(_0xe88a('0x4'));var rp=require(_0xe88a('0x5'));var fs=require('fs');var path=require(_0xe88a('0x6'));var rimraf=require(_0xe88a('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xe88a('0x8')]=function(_0x3a5da7,_0x2b416e){return _0x3a5da7[_0xe88a('0x9')](_0xe88a('0xa'),attributes,{'tableName':_0xe88a('0xb'),'paranoid':![],'indexes':[{'name':_0xe88a('0xc'),'fields':['membername',_0xe88a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index bd07dc8..143d68e 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 _0x86b8=['info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','UpdateMemberReport','MemberReport','update','body','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x5d7296,_0x3103bd){var _0xadb32a=function(_0x4ad775){while(--_0x4ad775){_0x5d7296['push'](_0x5d7296['shift']());}};_0xadb32a(++_0x3103bd);}(_0x86b8,0x15d));var _0x886b=function(_0x582b4d,_0x5cb8d3){_0x582b4d=_0x582b4d-0x0;var _0x32d285=_0x86b8[_0x582b4d];return _0x32d285;};'use strict';var _=require(_0x886b('0x0'));var util=require(_0x886b('0x1'));var moment=require(_0x886b('0x2'));var BPromise=require('bluebird');var rs=require(_0x886b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x886b('0x4'))['db'];var utils=require(_0x886b('0x5'));var logger=require(_0x886b('0x6'))('rpc');var config=require(_0x886b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x886b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd9d9ac,_0xe888a0,_0x2f8957){return new BPromise(function(_0xbc2d70,_0x238701){return client[_0x886b('0x9')](_0xd9d9ac,_0x2f8957)[_0x886b('0xa')](function(_0x52344d){logger[_0x886b('0xb')](_0x886b('0xc'),_0xe888a0,_0x886b('0xd'));logger[_0x886b('0xe')](_0x886b('0xf'),_0xe888a0,_0x886b('0xd'),JSON[_0x886b('0x10')](_0x52344d));if(_0x52344d[_0x886b('0x11')]){if(_0x52344d['error'][_0x886b('0x12')]===0x1f4){logger[_0x886b('0x11')]('MemberReport,\x20%s,\x20%s',_0xe888a0,_0x52344d[_0x886b('0x11')][_0x886b('0x13')]);return _0x238701(_0x52344d[_0x886b('0x11')][_0x886b('0x13')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0xe888a0,_0x52344d[_0x886b('0x11')][_0x886b('0x13')]);return _0xbc2d70(_0x52344d[_0x886b('0x11')][_0x886b('0x13')]);}else{logger[_0x886b('0xb')](_0x886b('0xc'),_0xe888a0,_0x886b('0xd'));_0xbc2d70(_0x52344d[_0x886b('0x14')]['message']);}})[_0x886b('0x15')](function(_0x44d81a){logger['error'](_0x886b('0xc'),_0xe888a0,_0x44d81a);_0x238701(_0x44d81a);});});}exports[_0x886b('0x16')]=function(_0x3df547){var _0x2232a7=this;return new Promise(function(_0x282a98,_0xe05a77){return db['MemberReport']['findAll']({'raw':_0x3df547[_0x886b('0x17')]?_0x3df547[_0x886b('0x17')][_0x886b('0x18')]===undefined?!![]:![]:!![],'where':_0x3df547['options']?_0x3df547['options'][_0x886b('0x19')]||null:null,'attributes':_0x3df547[_0x886b('0x17')]?_0x3df547[_0x886b('0x17')][_0x886b('0x1a')]||null:null,'limit':_0x3df547[_0x886b('0x17')]?_0x3df547[_0x886b('0x17')][_0x886b('0x1b')]||null:null,'include':_0x3df547['options']?_0x3df547[_0x886b('0x17')][_0x886b('0x1c')]?_[_0x886b('0x1d')](_0x3df547['options'][_0x886b('0x1c')],function(_0x2a5519){return{'model':db[_0x2a5519[_0x886b('0x1e')]],'as':_0x2a5519['as'],'attributes':_0x2a5519[_0x886b('0x1a')],'include':_0x2a5519['include']?_[_0x886b('0x1d')](_0x2a5519[_0x886b('0x1c')],function(_0x18d89e){return{'model':db[_0x18d89e[_0x886b('0x1e')]],'as':_0x18d89e['as'],'attributes':_0x18d89e[_0x886b('0x1a')],'include':_0x18d89e['include']?_[_0x886b('0x1d')](_0x18d89e[_0x886b('0x1c')],function(_0x2e2c80){return{'model':db[_0x2e2c80[_0x886b('0x1e')]],'as':_0x2e2c80['as'],'attributes':_0x2e2c80['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b85a4){logger[_0x886b('0xb')]('GetMemberReport',_0x3df547);logger[_0x886b('0xe')](_0x886b('0x16'),_0x3df547,JSON[_0x886b('0x10')](_0x3b85a4));_0x282a98(_0x3b85a4);})[_0x886b('0x15')](function(_0x1374a1){logger[_0x886b('0x11')]('GetMemberReport',_0x1374a1['message'],_0x3df547);_0xe05a77(_0x2232a7[_0x886b('0x11')](0x1f4,_0x1374a1[_0x886b('0x13')]));});});};exports[_0x886b('0x1f')]=function(_0x634c6){var _0x2a6ecf=this;return new Promise(function(_0x6ffb50,_0x57772b){return db['MemberReport']['create'](_0x634c6['body'],{'raw':_0x634c6[_0x886b('0x17')]?_0x634c6['options'][_0x886b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b9891){logger[_0x886b('0xb')](_0x886b('0x1f'),_0x634c6);logger['debug']('CreateMemberReport',_0x634c6,JSON[_0x886b('0x10')](_0x5b9891));_0x6ffb50(_0x5b9891);})['catch'](function(_0x4c29db){logger[_0x886b('0x11')]('CreateMemberReport',_0x4c29db[_0x886b('0x13')],_0x634c6);_0x57772b(_0x2a6ecf[_0x886b('0x11')](0x1f4,_0x4c29db[_0x886b('0x13')]));});});};exports[_0x886b('0x20')]=function(_0x507fbf){var _0x258c16=this;return new Promise(function(_0x160264,_0x4e257a){return db[_0x886b('0x21')][_0x886b('0x22')](_0x507fbf[_0x886b('0x23')],{'raw':_0x507fbf[_0x886b('0x17')]?_0x507fbf[_0x886b('0x17')][_0x886b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507fbf['options']?_0x507fbf[_0x886b('0x17')][_0x886b('0x19')]||null:null,'attributes':_0x507fbf[_0x886b('0x17')]?_0x507fbf[_0x886b('0x17')][_0x886b('0x1a')]||null:null,'limit':_0x507fbf[_0x886b('0x17')]?_0x507fbf[_0x886b('0x17')][_0x886b('0x1b')]||null:null})[_0x886b('0xa')](function(_0x4f63cd){logger['info'](_0x886b('0x20'),_0x507fbf);logger[_0x886b('0xe')]('UpdateMemberReport',_0x507fbf,JSON[_0x886b('0x10')](_0x4f63cd));_0x160264(_0x4f63cd);})[_0x886b('0x15')](function(_0x297772){logger[_0x886b('0x11')]('UpdateMemberReport',_0x297772[_0x886b('0x13')],_0x507fbf);_0x4e257a(_0x258c16['error'](0x1f4,_0x297772[_0x886b('0x13')]));});});}; \ No newline at end of file +var _0xc61d=['options','raw','where','attributes','limit','include','model','map','then','stringify','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMemberReport'];(function(_0x25e2b4,_0x18277b){var _0x2d7d0d=function(_0x378149){while(--_0x378149){_0x25e2b4['push'](_0x25e2b4['shift']());}};_0x2d7d0d(++_0x18277b);}(_0xc61d,0xfb));var _0xdc61=function(_0x3d3517,_0x13db6d){_0x3d3517=_0x3d3517-0x0;var _0x4eaea3=_0xc61d[_0x3d3517];return _0x4eaea3;};'use strict';var _=require(_0xdc61('0x0'));var util=require(_0xdc61('0x1'));var moment=require(_0xdc61('0x2'));var BPromise=require(_0xdc61('0x3'));var rs=require(_0xdc61('0x4'));var fs=require('fs');var Redis=require(_0xdc61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc61('0x6'));var logger=require(_0xdc61('0x7'))('rpc');var config=require(_0xdc61('0x8'));var jayson=require(_0xdc61('0x9'));var client=jayson[_0xdc61('0xa')][_0xdc61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3518fc,_0x84103c,_0x14899f){return new BPromise(function(_0x20bf1e,_0x26eb01){return client[_0xdc61('0xc')](_0x3518fc,_0x14899f)['then'](function(_0x3d38bc){logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));logger[_0xdc61('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x84103c,_0xdc61('0xf'),JSON['stringify'](_0x3d38bc));if(_0x3d38bc[_0xdc61('0x11')]){if(_0x3d38bc['error'][_0xdc61('0x12')]===0x1f4){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x26eb01(_0x3d38bc['error'][_0xdc61('0x13')]);}logger[_0xdc61('0x11')]('MemberReport,\x20%s,\x20%s',_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x20bf1e(_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);}else{logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));_0x20bf1e(_0x3d38bc[_0xdc61('0x14')][_0xdc61('0x13')]);}})['catch'](function(_0x356baf){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x356baf);_0x26eb01(_0x356baf);});});}exports[_0xdc61('0x15')]=function(_0x45b7b7){var _0x393205=this;return new Promise(function(_0x2393a4,_0x5dbe97){return db['MemberReport']['findAll']({'raw':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x17')]===undefined?!![]:![]:!![],'where':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7[_0xdc61('0x16')][_0xdc61('0x18')]||null:null,'attributes':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x19')]||null:null,'limit':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7[_0xdc61('0x16')][_0xdc61('0x1a')]||null:null,'include':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x1b')]?_['map'](_0x45b7b7['options']['include'],function(_0x42a52a){return{'model':db[_0x42a52a[_0xdc61('0x1c')]],'as':_0x42a52a['as'],'attributes':_0x42a52a['attributes'],'include':_0x42a52a[_0xdc61('0x1b')]?_[_0xdc61('0x1d')](_0x42a52a[_0xdc61('0x1b')],function(_0x40cf53){return{'model':db[_0x40cf53[_0xdc61('0x1c')]],'as':_0x40cf53['as'],'attributes':_0x40cf53[_0xdc61('0x19')],'include':_0x40cf53[_0xdc61('0x1b')]?_[_0xdc61('0x1d')](_0x40cf53['include'],function(_0x434095){return{'model':db[_0x434095[_0xdc61('0x1c')]],'as':_0x434095['as'],'attributes':_0x434095[_0xdc61('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdc61('0x1e')](function(_0x27109a){logger[_0xdc61('0xd')](_0xdc61('0x15'),_0x45b7b7);logger['debug'](_0xdc61('0x15'),_0x45b7b7,JSON[_0xdc61('0x1f')](_0x27109a));_0x2393a4(_0x27109a);})[_0xdc61('0x20')](function(_0xfc689f){logger['error'](_0xdc61('0x15'),_0xfc689f[_0xdc61('0x13')],_0x45b7b7);_0x5dbe97(_0x393205[_0xdc61('0x11')](0x1f4,_0xfc689f['message']));});});};exports[_0xdc61('0x21')]=function(_0x6305c1){var _0x593887=this;return new Promise(function(_0x1084de,_0x1fa029){return db[_0xdc61('0x22')][_0xdc61('0x23')](_0x6305c1[_0xdc61('0x24')],{'raw':_0x6305c1[_0xdc61('0x16')]?_0x6305c1[_0xdc61('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xdc61('0x1e')](function(_0x54c6e7){logger[_0xdc61('0xd')](_0xdc61('0x21'),_0x6305c1);logger[_0xdc61('0x10')](_0xdc61('0x21'),_0x6305c1,JSON[_0xdc61('0x1f')](_0x54c6e7));_0x1084de(_0x54c6e7);})[_0xdc61('0x20')](function(_0xa916fd){logger['error'](_0xdc61('0x21'),_0xa916fd[_0xdc61('0x13')],_0x6305c1);_0x1fa029(_0x593887[_0xdc61('0x11')](0x1f4,_0xa916fd[_0xdc61('0x13')]));});});};exports[_0xdc61('0x25')]=function(_0x5ccbed){var _0x15a6d1=this;return new Promise(function(_0x93aaa0,_0x20599c){return db['MemberReport'][_0xdc61('0x26')](_0x5ccbed[_0xdc61('0x24')],{'raw':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')][_0xdc61('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')][_0xdc61('0x18')]||null:null,'attributes':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed['options'][_0xdc61('0x19')]||null:null,'limit':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')]['limit']||null:null})[_0xdc61('0x1e')](function(_0x3f314d){logger[_0xdc61('0xd')]('UpdateMemberReport',_0x5ccbed);logger['debug'](_0xdc61('0x25'),_0x5ccbed,JSON[_0xdc61('0x1f')](_0x3f314d));_0x93aaa0(_0x3f314d);})['catch'](function(_0x555d94){logger[_0xdc61('0x11')](_0xdc61('0x25'),_0x555d94[_0xdc61('0x13')],_0x5ccbed);_0x20599c(_0x15a6d1['error'](0x1f4,_0x555d94[_0xdc61('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a70d29e..b2879ca 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 _0x22c4=['express','Router','fs-extra','../../components/auth/service','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x551620,_0x3fc442){var _0x54a07c=function(_0x260fed){while(--_0x260fed){_0x551620['push'](_0x551620['shift']());}};_0x54a07c(++_0x3fc442);}(_0x22c4,0x81));var _0x422c=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0x22c4[_0x1d5714];return _0x1b620e;};'use strict';var multer=require(_0x422c('0x0'));var util=require('util');var path=require(_0x422c('0x1'));var timeout=require(_0x422c('0x2'));var express=require(_0x422c('0x3'));var router=express[_0x422c('0x4')]();var fs_extra=require(_0x422c('0x5'));var auth=require(_0x422c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x422c('0x7'));router[_0x422c('0x8')]('/',controller[_0x422c('0x9')]);module[_0x422c('0xa')]=router; \ No newline at end of file +var _0x663f=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x56fd12,_0x255fef){var _0x407dff=function(_0x41f0b8){while(--_0x41f0b8){_0x56fd12['push'](_0x56fd12['shift']());}};_0x407dff(++_0x255fef);}(_0x663f,0xdd));var _0xf663=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x663f[_0xa4f636];return _0x37e02a;};'use strict';var multer=require('multer');var util=require(_0xf663('0x0'));var path=require(_0xf663('0x1'));var timeout=require('connect-timeout');var express=require(_0xf663('0x2'));var router=express[_0xf663('0x3')]();var fs_extra=require(_0xf663('0x4'));var auth=require(_0xf663('0x5'));var interaction=require(_0xf663('0x6'));var config=require(_0xf663('0x7'));var controller=require('./migration.controller');router[_0xf663('0x8')]('/',controller[_0xf663('0x9')]);module[_0xf663('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 49d2286..ad4b826 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 _0x1bea=['exports','STRING','version','sequelize'];(function(_0x4c618d,_0x2cb8ed){var _0x9f4245=function(_0x44eb5e){while(--_0x44eb5e){_0x4c618d['push'](_0x4c618d['shift']());}};_0x9f4245(++_0x2cb8ed);}(_0x1bea,0xe7));var _0xa1be=function(_0x4291a2,_0x2ee2e5){_0x4291a2=_0x4291a2-0x0;var _0x235817=_0x1bea[_0x4291a2];return _0x235817;};'use strict';var Sequelize=require(_0xa1be('0x0'));module[_0xa1be('0x1')]={'version':{'type':Sequelize[_0xa1be('0x2')],'unique':_0xa1be('0x3')}}; \ No newline at end of file +var _0xb573=['STRING','version','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb573,0x101));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b57('0x0'));module['exports']={'version':{'type':Sequelize[_0x3b57('0x1')],'unique':_0x3b57('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2402582..1de6fc9 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 _0xbdf3=['rows','catch','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x24a09c,_0x5e54d4){var _0x32d7c2=function(_0x353deb){while(--_0x353deb){_0x24a09c['push'](_0x24a09c['shift']());}};_0x32d7c2(++_0x5e54d4);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0xbdf3[_0x1667df];return _0x341abf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bdf('0x0'));var zipdir=require(_0x3bdf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bdf('0x2'));var moment=require('moment');var BPromise=require(_0x3bdf('0x3'));var Mustache=require(_0x3bdf('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3bdf('0x5'));var csv=require(_0x3bdf('0x6'));var ejs=require(_0x3bdf('0x7'));var fs=require('fs');var fs_extra=require(_0x3bdf('0x8'));var _=require(_0x3bdf('0x9'));var squel=require('squel');var crypto=require(_0x3bdf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bdf('0xb'));var toCsv=require(_0x3bdf('0x6'));var querystring=require(_0x3bdf('0xc'));var Papa=require(_0x3bdf('0xd'));var Redis=require(_0x3bdf('0xe'));var authService=require(_0x3bdf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bdf('0x10'));var logger=require(_0x3bdf('0x11'))(_0x3bdf('0x12'));var utils=require(_0x3bdf('0x13'));var config=require(_0x3bdf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419fd7,_0x51a88f){_0x51a88f=_0x51a88f||0xcc;return function(_0x4237d1){if(_0x4237d1){return _0x419fd7['sendStatus'](_0x51a88f);}return _0x419fd7['status'](_0x51a88f)[_0x3bdf('0x15')]();};}function respondWithResult(_0x66026b,_0x38a735){_0x38a735=_0x38a735||0xc8;return function(_0x4b3cda){if(_0x4b3cda){return _0x66026b[_0x3bdf('0x16')](_0x38a735)[_0x3bdf('0x17')](_0x4b3cda);}};}function respondWithFilteredResult(_0x2e15a1,_0x373708){return function(_0x2847fd){if(_0x2847fd){var _0x3ca17a=typeof _0x373708[_0x3bdf('0x18')]===_0x3bdf('0x19')&&typeof _0x373708[_0x3bdf('0x1a')]===_0x3bdf('0x19');var _0x38fa8a=_0x2847fd[_0x3bdf('0x1b')];var _0x51b247=_0x3ca17a?0x0:_0x373708[_0x3bdf('0x18')];var _0x16f3aa=_0x3ca17a?_0x2847fd[_0x3bdf('0x1b')]:_0x373708[_0x3bdf('0x18')]+_0x373708['limit'];var _0x3fd8ef;if(_0x16f3aa>=_0x38fa8a){_0x16f3aa=_0x38fa8a;_0x3fd8ef=0xc8;}else{_0x3fd8ef=0xce;}_0x2e15a1[_0x3bdf('0x16')](_0x3fd8ef);return _0x2e15a1[_0x3bdf('0x1c')](_0x3bdf('0x1d'),_0x51b247+'-'+_0x16f3aa+'/'+_0x38fa8a)['json'](_0x2847fd);}return null;};}function patchUpdates(_0x1fe112){return function(_0x1762c4){try{jsonpatch[_0x3bdf('0x1e')](_0x1762c4,_0x1fe112,!![]);}catch(_0x4cefd9){return BPromise[_0x3bdf('0x1f')](_0x4cefd9);}return _0x1762c4[_0x3bdf('0x20')]();};}function saveUpdates(_0x5248ba,_0xd18285){return function(_0x23ab3c){if(_0x23ab3c){return _0x23ab3c[_0x3bdf('0x21')](_0x5248ba)[_0x3bdf('0x22')](function(_0x2900c1){return _0x2900c1;});}return null;};}function removeEntity(_0x48951d,_0x173d2b){return function(_0x2bc07d){if(_0x2bc07d){return _0x2bc07d[_0x3bdf('0x23')]()[_0x3bdf('0x22')](function(){_0x48951d[_0x3bdf('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7495f4,_0x59869d){return function(_0x541f97){if(!_0x541f97){_0x7495f4[_0x3bdf('0x24')](0x194);}return _0x541f97;};}function handleError(_0x14d6c5,_0x3892f8){_0x3892f8=_0x3892f8||0x1f4;return function(_0x453427){logger['error'](_0x453427[_0x3bdf('0x25')]);if(_0x453427[_0x3bdf('0x26')]){delete _0x453427[_0x3bdf('0x26')];}_0x14d6c5['status'](_0x3892f8)[_0x3bdf('0x27')](_0x453427);};}exports[_0x3bdf('0x28')]=function(_0x1298b9,_0x175bd7){var _0x49966f={},_0x40c95b={},_0x511e7b={'count':0x0,'rows':[]};var _0x527bf2=_[_0x3bdf('0x29')](db[_0x3bdf('0x2a')][_0x3bdf('0x2b')],function(_0x56387c){return{'name':_0x56387c[_0x3bdf('0x2c')],'type':_0x56387c[_0x3bdf('0x2d')]['key']};});_0x40c95b[_0x3bdf('0x2e')]=_['map'](_0x527bf2,_0x3bdf('0x26'));_0x40c95b[_0x3bdf('0x2f')]=_['keys'](_0x1298b9[_0x3bdf('0x2f')]);_0x40c95b[_0x3bdf('0x30')]=_['intersection'](_0x40c95b['model'],_0x40c95b[_0x3bdf('0x2f')]);_0x49966f['attributes']=_[_0x3bdf('0x31')](_0x40c95b[_0x3bdf('0x2e')],qs[_0x3bdf('0x32')](_0x1298b9['query'][_0x3bdf('0x32')]));_0x49966f[_0x3bdf('0x33')]=_0x49966f[_0x3bdf('0x33')]['length']?_0x49966f[_0x3bdf('0x33')]:_0x40c95b['model'];if(!_0x1298b9['query'][_0x3bdf('0x34')]('nolimit')){_0x49966f[_0x3bdf('0x1a')]=qs[_0x3bdf('0x1a')](_0x1298b9[_0x3bdf('0x2f')]['limit']);_0x49966f['offset']=qs[_0x3bdf('0x18')](_0x1298b9[_0x3bdf('0x2f')]['offset']);}_0x49966f[_0x3bdf('0x35')]=qs[_0x3bdf('0x36')](_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x36')]);_0x49966f[_0x3bdf('0x37')]=qs[_0x3bdf('0x30')](_[_0x3bdf('0x38')](_0x1298b9['query'],_0x40c95b[_0x3bdf('0x30')]),_0x527bf2);if(_0x1298b9['query'][_0x3bdf('0x39')]){_0x49966f['where']=_['merge'](_0x49966f['where'],{'$or':_['map'](_0x527bf2,function(_0x4633c9){if(_0x4633c9[_0x3bdf('0x2d')]!==_0x3bdf('0x3a')){var _0x30e4ae={};_0x30e4ae[_0x4633c9['name']]={'$like':'%'+_0x1298b9['query']['filter']+'%'};return _0x30e4ae;}})});}_0x49966f=_[_0x3bdf('0x3b')]({},_0x49966f,_0x1298b9[_0x3bdf('0x3c')]);var _0x3bde1a={'where':_0x49966f[_0x3bdf('0x37')]};return db[_0x3bdf('0x2a')][_0x3bdf('0x1b')](_0x3bde1a)[_0x3bdf('0x22')](function(_0x44e2a6){_0x511e7b[_0x3bdf('0x1b')]=_0x44e2a6;if(_0x1298b9[_0x3bdf('0x2f')][_0x3bdf('0x3d')]){_0x49966f[_0x3bdf('0x3e')]=[{'all':!![]}];}return db[_0x3bdf('0x2a')][_0x3bdf('0x3f')](_0x49966f);})[_0x3bdf('0x22')](function(_0x1fedfc){_0x511e7b[_0x3bdf('0x40')]=_0x1fedfc;return _0x511e7b;})['then'](respondWithFilteredResult(_0x175bd7,_0x49966f))[_0x3bdf('0x41')](handleError(_0x175bd7,null));}; \ No newline at end of file +var _0x5b5c=['attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Migration','findAll','rows','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','limit','count','offset','set','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x21673d,_0x439d7b){var _0x1c9fd2=function(_0x1abf55){while(--_0x1abf55){_0x21673d['push'](_0x21673d['shift']());}};_0x1c9fd2(++_0x439d7b);}(_0x5b5c,0xfc));var _0xc5b5=function(_0x5806e8,_0x5a497d){_0x5806e8=_0x5806e8-0x0;var _0x229aed=_0x5b5c[_0x5806e8];return _0x229aed;};'use strict';var emlformat=require(_0xc5b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc5b5('0x1'));var rp=require(_0xc5b5('0x2'));var moment=require(_0xc5b5('0x3'));var BPromise=require(_0xc5b5('0x4'));var Mustache=require(_0xc5b5('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc5b5('0x6'));var csv=require(_0xc5b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5b5('0x8'));var _=require('lodash');var squel=require(_0xc5b5('0x9'));var crypto=require(_0xc5b5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc5b5('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5b5('0xc'));var Redis=require(_0xc5b5('0xd'));var authService=require(_0xc5b5('0xe'));var qs=require(_0xc5b5('0xf'));var as=require(_0xc5b5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc5b5('0x11'));var utils=require(_0xc5b5('0x12'));var config=require(_0xc5b5('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec3a1,_0x431cb5){_0x431cb5=_0x431cb5||0xcc;return function(_0x18f285){if(_0x18f285){return _0x5ec3a1['sendStatus'](_0x431cb5);}return _0x5ec3a1[_0xc5b5('0x14')](_0x431cb5)[_0xc5b5('0x15')]();};}function respondWithResult(_0x264957,_0x37742d){_0x37742d=_0x37742d||0xc8;return function(_0x12e2aa){if(_0x12e2aa){return _0x264957[_0xc5b5('0x14')](_0x37742d)[_0xc5b5('0x16')](_0x12e2aa);}};}function respondWithFilteredResult(_0x9ec31e,_0x64e7e0){return function(_0x163fe0){if(_0x163fe0){var _0x227eed=typeof _0x64e7e0['offset']==='undefined'&&typeof _0x64e7e0[_0xc5b5('0x17')]==='undefined';var _0x1915a6=_0x163fe0[_0xc5b5('0x18')];var _0x314d97=_0x227eed?0x0:_0x64e7e0[_0xc5b5('0x19')];var _0x4b31af=_0x227eed?_0x163fe0[_0xc5b5('0x18')]:_0x64e7e0[_0xc5b5('0x19')]+_0x64e7e0['limit'];var _0x580cc5;if(_0x4b31af>=_0x1915a6){_0x4b31af=_0x1915a6;_0x580cc5=0xc8;}else{_0x580cc5=0xce;}_0x9ec31e[_0xc5b5('0x14')](_0x580cc5);return _0x9ec31e[_0xc5b5('0x1a')]('Content-Range',_0x314d97+'-'+_0x4b31af+'/'+_0x1915a6)[_0xc5b5('0x16')](_0x163fe0);}return null;};}function patchUpdates(_0x4c8eac){return function(_0x51e7cb){try{jsonpatch['apply'](_0x51e7cb,_0x4c8eac,!![]);}catch(_0x3e6dd3){return BPromise[_0xc5b5('0x1b')](_0x3e6dd3);}return _0x51e7cb[_0xc5b5('0x1c')]();};}function saveUpdates(_0x1eb49c,_0x4a2beb){return function(_0x1b752d){if(_0x1b752d){return _0x1b752d[_0xc5b5('0x1d')](_0x1eb49c)['then'](function(_0x2e7dbb){return _0x2e7dbb;});}return null;};}function removeEntity(_0x10d822,_0x41b7f8){return function(_0x4c7a5c){if(_0x4c7a5c){return _0x4c7a5c['destroy']()[_0xc5b5('0x1e')](function(){_0x10d822['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fc9b,_0x1cfb6b){return function(_0x14ebf9){if(!_0x14ebf9){_0x45fc9b['sendStatus'](0x194);}return _0x14ebf9;};}function handleError(_0x33501b,_0x2884f8){_0x2884f8=_0x2884f8||0x1f4;return function(_0x38541e){logger['error'](_0x38541e['stack']);if(_0x38541e['name']){delete _0x38541e[_0xc5b5('0x1f')];}_0x33501b[_0xc5b5('0x14')](_0x2884f8)[_0xc5b5('0x20')](_0x38541e);};}exports[_0xc5b5('0x21')]=function(_0x1c4653,_0x20ee61){var _0x22b058={},_0x2e3509={},_0x1db570={'count':0x0,'rows':[]};var _0x47167a=_[_0xc5b5('0x22')](db['Migration'][_0xc5b5('0x23')],function(_0x428a5a){return{'name':_0x428a5a[_0xc5b5('0x24')],'type':_0x428a5a[_0xc5b5('0x25')][_0xc5b5('0x26')]};});_0x2e3509['model']=_[_0xc5b5('0x22')](_0x47167a,_0xc5b5('0x1f'));_0x2e3509[_0xc5b5('0x27')]=_[_0xc5b5('0x28')](_0x1c4653[_0xc5b5('0x27')]);_0x2e3509[_0xc5b5('0x29')]=_[_0xc5b5('0x2a')](_0x2e3509['model'],_0x2e3509[_0xc5b5('0x27')]);_0x22b058[_0xc5b5('0x2b')]=_[_0xc5b5('0x2a')](_0x2e3509['model'],qs[_0xc5b5('0x2c')](_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x2c')]));_0x22b058[_0xc5b5('0x2b')]=_0x22b058[_0xc5b5('0x2b')][_0xc5b5('0x2d')]?_0x22b058[_0xc5b5('0x2b')]:_0x2e3509[_0xc5b5('0x2e')];if(!_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x2f')](_0xc5b5('0x30'))){_0x22b058['limit']=qs[_0xc5b5('0x17')](_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x17')]);_0x22b058[_0xc5b5('0x19')]=qs[_0xc5b5('0x19')](_0x1c4653['query'][_0xc5b5('0x19')]);}_0x22b058[_0xc5b5('0x31')]=qs[_0xc5b5('0x32')](_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x32')]);_0x22b058['where']=qs['filters'](_[_0xc5b5('0x33')](_0x1c4653[_0xc5b5('0x27')],_0x2e3509[_0xc5b5('0x29')]),_0x47167a);if(_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x34')]){_0x22b058[_0xc5b5('0x35')]=_[_0xc5b5('0x36')](_0x22b058[_0xc5b5('0x35')],{'$or':_[_0xc5b5('0x22')](_0x47167a,function(_0x572bd4){if(_0x572bd4[_0xc5b5('0x25')]!==_0xc5b5('0x37')){var _0x10dbc3={};_0x10dbc3[_0x572bd4[_0xc5b5('0x1f')]]={'$like':'%'+_0x1c4653[_0xc5b5('0x27')][_0xc5b5('0x34')]+'%'};return _0x10dbc3;}})});}_0x22b058=_[_0xc5b5('0x36')]({},_0x22b058,_0x1c4653['options']);var _0x2f4bbb={'where':_0x22b058['where']};return db[_0xc5b5('0x38')][_0xc5b5('0x18')](_0x2f4bbb)[_0xc5b5('0x1e')](function(_0x31739b){_0x1db570[_0xc5b5('0x18')]=_0x31739b;if(_0x1c4653[_0xc5b5('0x27')]['includeAll']){_0x22b058['include']=[{'all':!![]}];}return db['Migration'][_0xc5b5('0x39')](_0x22b058);})[_0xc5b5('0x1e')](function(_0xe8ca68){_0x1db570[_0xc5b5('0x3a')]=_0xe8ca68;return _0x1db570;})[_0xc5b5('0x1e')](respondWithFilteredResult(_0x20ee61,_0x22b058))['catch'](handleError(_0x20ee61,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7dd0081..c6ef411 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 _0x151d=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4105a8,_0x198324){var _0x553f0c=function(_0x3720f5){while(--_0x3720f5){_0x4105a8['push'](_0x4105a8['shift']());}};_0x553f0c(++_0x198324);}(_0x151d,0x7c));var _0xd151=function(_0x523979,_0x2aacd9){_0x523979=_0x523979-0x0;var _0x3f7423=_0x151d[_0x523979];return _0x3f7423;};'use strict';var _=require(_0xd151('0x0'));var util=require(_0xd151('0x1'));var logger=require(_0xd151('0x2'))(_0xd151('0x3'));var moment=require(_0xd151('0x4'));var BPromise=require(_0xd151('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd151('0x6'));var config=require(_0xd151('0x7'));var attributes=require('./migration.attributes');module[_0xd151('0x8')]=function(_0x73b8fd,_0x4f154c){return _0x73b8fd[_0xd151('0x9')](_0xd151('0xa'),attributes,{'tableName':_0xd151('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9982=['Migration','migrations','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./migration.attributes','exports','define'];(function(_0x363366,_0x4368f9){var _0x17beec=function(_0x269a00){while(--_0x269a00){_0x363366['push'](_0x363366['shift']());}};_0x17beec(++_0x4368f9);}(_0x9982,0x7b));var _0x2998=function(_0x402c78,_0x4484c9){_0x402c78=_0x402c78-0x0;var _0x593215=_0x9982[_0x402c78];return _0x593215;};'use strict';var _=require(_0x2998('0x0'));var util=require('util');var logger=require(_0x2998('0x1'))('api');var moment=require(_0x2998('0x2'));var BPromise=require(_0x2998('0x3'));var rp=require(_0x2998('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2998('0x5'));var attributes=require(_0x2998('0x6'));module[_0x2998('0x7')]=function(_0x57fa13,_0x59b641){return _0x57fa13[_0x2998('0x8')](_0x2998('0x9'),attributes,{'tableName':_0x2998('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 8bf2548..2e1c446 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 _0xf958=['then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0xa67d03,_0x19f00f){var _0x672e67=function(_0x480219){while(--_0x480219){_0xa67d03['push'](_0xa67d03['shift']());}};_0x672e67(++_0x19f00f);}(_0xf958,0xe6));var _0x8f95=function(_0x4140f3,_0x1c48b0){_0x4140f3=_0x4140f3-0x0;var _0x1b6378=_0xf958[_0x4140f3];return _0x1b6378;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});} \ No newline at end of file +var _0xc4e6=['rpc','../../config/environment','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xc4e6[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var moment=require('moment');var BPromise=require(_0x6c4e('0x2'));var rs=require(_0x6c4e('0x3'));var fs=require('fs');var Redis=require(_0x6c4e('0x4'));var db=require(_0x6c4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c4e('0x6'))(_0x6c4e('0x7'));var config=require(_0x6c4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6c4e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56fec4,_0x3355f9,_0x394d8b){return new BPromise(function(_0xb0496a,_0x2f91ad){return client[_0x6c4e('0xa')](_0x56fec4,_0x394d8b)[_0x6c4e('0xb')](function(_0x58c1da){logger[_0x6c4e('0xc')](_0x6c4e('0xd'),_0x3355f9,_0x6c4e('0xe'));logger[_0x6c4e('0xf')](_0x6c4e('0x10'),_0x3355f9,'request\x20sent',JSON['stringify'](_0x58c1da));if(_0x58c1da[_0x6c4e('0x11')]){if(_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x12')]===0x1f4){logger['error'](_0x6c4e('0xd'),_0x3355f9,_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x13')]);return _0x2f91ad(_0x58c1da[_0x6c4e('0x11')]['message']);}logger[_0x6c4e('0x11')](_0x6c4e('0xd'),_0x3355f9,_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x13')]);return _0xb0496a(_0x58c1da[_0x6c4e('0x11')]['message']);}else{logger[_0x6c4e('0xc')](_0x6c4e('0xd'),_0x3355f9,_0x6c4e('0xe'));_0xb0496a(_0x58c1da['result']['message']);}})['catch'](function(_0x5e4e88){logger[_0x6c4e('0x11')](_0x6c4e('0xd'),_0x3355f9,_0x5e4e88);_0x2f91ad(_0x5e4e88);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8c82dbb..639e00e 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 _0x023e=['post','create','put','update','destroy','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e1ecf,_0x175529){var _0x52be90=function(_0x2da012){while(--_0x2da012){_0x1e1ecf['push'](_0x1e1ecf['shift']());}};_0x52be90(++_0x175529);}(_0x023e,0xc5));var _0xe023=function(_0x36daae,_0x471d49){_0x36daae=_0x36daae-0x0;var _0x21dd26=_0x023e[_0x36daae];return _0x21dd26;};'use strict';var multer=require(_0xe023('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe023('0x1')]();var fs_extra=require(_0xe023('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe023('0x3'));var config=require(_0xe023('0x4'));var controller=require(_0xe023('0x5'));router[_0xe023('0x6')]('/',auth[_0xe023('0x7')](),controller[_0xe023('0x8')]);router[_0xe023('0x6')](_0xe023('0x9'),auth[_0xe023('0x7')](),controller[_0xe023('0xa')]);router[_0xe023('0xb')]('/',auth[_0xe023('0x7')](),controller[_0xe023('0xc')]);router[_0xe023('0xd')](_0xe023('0x9'),auth[_0xe023('0x7')](),controller[_0xe023('0xe')]);router['delete'](_0xe023('0x9'),auth[_0xe023('0x7')](),controller[_0xe023('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7d8d=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1492ac,_0x46acc2){var _0x1126b4=function(_0x8685c6){while(--_0x8685c6){_0x1492ac['push'](_0x1492ac['shift']());}};_0x1126b4(++_0x46acc2);}(_0x7d8d,0x134));var _0xd7d8=function(_0x13bccc,_0x213b92){_0x13bccc=_0x13bccc-0x0;var _0x10a6c4=_0x7d8d[_0x13bccc];return _0x10a6c4;};'use strict';var multer=require(_0xd7d8('0x0'));var util=require(_0xd7d8('0x1'));var path=require(_0xd7d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xd7d8('0x3'));var router=express['Router']();var fs_extra=require(_0xd7d8('0x4'));var auth=require(_0xd7d8('0x5'));var interaction=require(_0xd7d8('0x6'));var config=require(_0xd7d8('0x7'));var controller=require('./network.controller');router[_0xd7d8('0x8')]('/',auth[_0xd7d8('0x9')](),controller[_0xd7d8('0xa')]);router[_0xd7d8('0x8')](_0xd7d8('0xb'),auth[_0xd7d8('0x9')](),controller[_0xd7d8('0xc')]);router[_0xd7d8('0xd')]('/',auth[_0xd7d8('0x9')](),controller[_0xd7d8('0xe')]);router['put'](_0xd7d8('0xb'),auth['isAuthenticated'](),controller[_0xd7d8('0xf')]);router[_0xd7d8('0x10')](_0xd7d8('0xb'),auth[_0xd7d8('0x9')](),controller[_0xd7d8('0x11')]);module[_0xd7d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 16c00bf..f576891 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 _0x6ba3=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0x6ba3,0x164));var _0x36ba=function(_0xfb299e,_0x2ca984){_0xfb299e=_0xfb299e-0x0;var _0x564de9=_0x6ba3[_0xfb299e];return _0x564de9;};'use strict';var Sequelize=require(_0x36ba('0x0'));module[_0x36ba('0x1')]={'type':{'type':Sequelize[_0x36ba('0x2')](_0x36ba('0x3'),_0x36ba('0x4'),_0x36ba('0x5'),_0x36ba('0x6'))},'value':{'type':Sequelize[_0x36ba('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x36ba('0x7')]}}; \ No newline at end of file +var _0x88ae=['turn','sequelize','ENUM','localnet','stun'];(function(_0x4be6e4,_0x454b6e){var _0x3b8cc7=function(_0x419372){while(--_0x419372){_0x4be6e4['push'](_0x4be6e4['shift']());}};_0x3b8cc7(++_0x454b6e);}(_0x88ae,0x1b9));var _0xe88a=function(_0x1871c6,_0x4011ed){_0x1871c6=_0x1871c6-0x0;var _0x54e8fa=_0x88ae[_0x1871c6];return _0x54e8fa;};'use strict';var Sequelize=require(_0xe88a('0x0'));module['exports']={'type':{'type':Sequelize[_0xe88a('0x1')](_0xe88a('0x2'),'externip',_0xe88a('0x3'),_0xe88a('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e943cde..159d2f4 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 _0x51c4=['Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','Network','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','rawAttributes','find','create','body','toUpperCase','STUN','readFileSync','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','server/files/templates/stun_multiple.ejs','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','path','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x7d5a8b,_0x2aedef){var _0x56ac46=function(_0x55a1ab){while(--_0x55a1ab){_0x7d5a8b['push'](_0x7d5a8b['shift']());}};_0x56ac46(++_0x2aedef);}(_0x51c4,0xec));var _0x451c=function(_0x4466ce,_0x3fe925){_0x4466ce=_0x4466ce-0x0;var _0x38f881=_0x51c4[_0x4466ce];return _0x38f881;};'use strict';var util=require('util');var path=require(_0x451c('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x451c('0x1'));var qs=require(_0x451c('0x2'));var logger=require(_0x451c('0x3'))('api');var config=require(_0x451c('0x4'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x451c('0x5')][_0x451c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49df60,_0x51185a,_0x3f7911,_0xd20ab9){return new Promise(function(_0x581abb,_0x368c45){var _0x4cc57c=_0xd20ab9||client;return _0x4cc57c[_0x451c('0x7')](_0x49df60,_0x3f7911)[_0x451c('0x8')](function(_0x39a102){logger[_0x451c('0x9')](_0x451c('0xa'),_0x51185a,_0x451c('0xb'));logger[_0x451c('0xc')](_0x451c('0xd'),_0x51185a,_0x451c('0xb'),JSON['stringify'](_0x39a102));if(_0x39a102[_0x451c('0xe')]){if(_0x39a102['error'][_0x451c('0xf')]===0x1f4){logger['error'](_0x451c('0xa'),_0x51185a,_0x39a102[_0x451c('0xe')][_0x451c('0x10')]);return _0x368c45(_0x39a102[_0x451c('0xe')][_0x451c('0x10')]);}logger[_0x451c('0xe')]('Network,\x20%s,\x20%s',_0x51185a,_0x39a102['error'][_0x451c('0x10')]);return _0x581abb(_0x39a102[_0x451c('0xe')]['message']);}else{logger[_0x451c('0x9')]('Network,\x20%s,\x20%s',_0x51185a,_0x451c('0xb'));_0x581abb(_0x39a102['result'][_0x451c('0x10')]);}})[_0x451c('0x11')](function(_0x2a0c08){logger[_0x451c('0xe')](_0x451c('0xa'),_0x51185a,_0x2a0c08);_0x368c45(_0x2a0c08);});});}function respondWithResult(_0x502d76,_0x506706){_0x506706=_0x506706||0xc8;return function(_0x33f5b2){if(_0x33f5b2){return _0x502d76[_0x451c('0x12')](_0x506706)[_0x451c('0x13')](_0x33f5b2);}};}function respondWithFilteredResult(_0x5d18dc,_0x2d5864){return function(_0x47ad4f){if(_0x47ad4f){var _0x20ad12=typeof _0x2d5864[_0x451c('0x14')]==='undefined'&&typeof _0x2d5864[_0x451c('0x15')]==='undefined';var _0x2dd0cb=_0x47ad4f[_0x451c('0x16')];var _0x3c9948=_0x20ad12?0x0:_0x2d5864[_0x451c('0x14')];var _0x28b063=_0x20ad12?_0x47ad4f[_0x451c('0x16')]:_0x2d5864['offset']+_0x2d5864[_0x451c('0x15')];var _0x1bd8c9;if(_0x28b063>=_0x2dd0cb){_0x28b063=_0x2dd0cb;_0x1bd8c9=0xc8;}else{_0x1bd8c9=0xce;}_0x5d18dc[_0x451c('0x12')](_0x1bd8c9);return _0x5d18dc[_0x451c('0x17')](_0x451c('0x18'),_0x3c9948+'-'+_0x28b063+'/'+_0x2dd0cb)[_0x451c('0x13')](_0x47ad4f);}return null;};}function saveUpdates(_0x2ecde0){return function(_0x2a9815){if(_0x2a9815){return _0x2a9815[_0x451c('0x19')](_0x2ecde0)['then'](function(_0x382631){return _0x382631;});}return null;};}function removeEntity(_0x2b52cb){return function(_0xec7c8a){if(_0xec7c8a){return _0xec7c8a[_0x451c('0x1a')]()[_0x451c('0x8')](function(){_0x2b52cb['status'](0xcc)[_0x451c('0x1b')]();});}};}function handleEntityNotFound(_0x19370b){return function(_0x425a6c){if(!_0x425a6c){_0x19370b[_0x451c('0x1c')](0x194);}return _0x425a6c;};}function handleError(_0x165e6a,_0x517567){_0x517567=_0x517567||0x1f4;return function(_0x21a4a8){logger['error'](_0x21a4a8['stack']);if(_0x21a4a8[_0x451c('0x1d')]){delete _0x21a4a8['name'];}_0x165e6a[_0x451c('0x12')](_0x517567)[_0x451c('0x1e')](_0x21a4a8);};}exports[_0x451c('0x1f')]=function(_0x50dad0,_0x49a28d){var _0x3d20d6={},_0x3d2a26={},_0x1aa35e={'count':0x0,'rows':[]};var _0x2b2556=_[_0x451c('0x20')](db[_0x451c('0x21')]['rawAttributes'],function(_0xe9ba07){return{'name':_0xe9ba07[_0x451c('0x22')],'type':_0xe9ba07[_0x451c('0x23')][_0x451c('0x24')]};});_0x3d2a26[_0x451c('0x25')]=_[_0x451c('0x20')](_0x2b2556,_0x451c('0x1d'));_0x3d2a26['query']=_['keys'](_0x50dad0[_0x451c('0x26')]);_0x3d2a26[_0x451c('0x27')]=_[_0x451c('0x28')](_0x3d2a26['model'],_0x3d2a26[_0x451c('0x26')]);_0x3d20d6[_0x451c('0x29')]=_[_0x451c('0x28')](_0x3d2a26[_0x451c('0x25')],qs[_0x451c('0x2a')](_0x50dad0[_0x451c('0x26')][_0x451c('0x2a')]));_0x3d20d6['attributes']=_0x3d20d6[_0x451c('0x29')][_0x451c('0x2b')]?_0x3d20d6['attributes']:_0x3d2a26['model'];if(!_0x50dad0[_0x451c('0x26')][_0x451c('0x2c')](_0x451c('0x2d'))){_0x3d20d6[_0x451c('0x15')]=qs[_0x451c('0x15')](_0x50dad0[_0x451c('0x26')][_0x451c('0x15')]);_0x3d20d6[_0x451c('0x14')]=qs[_0x451c('0x14')](_0x50dad0[_0x451c('0x26')][_0x451c('0x14')]);}_0x3d20d6[_0x451c('0x2e')]=qs[_0x451c('0x2f')](_0x50dad0[_0x451c('0x26')][_0x451c('0x2f')]);_0x3d20d6[_0x451c('0x30')]=qs['filters'](_['pick'](_0x50dad0['query'],_0x3d2a26[_0x451c('0x27')]),_0x2b2556);if(_0x50dad0[_0x451c('0x26')]['filter']){_0x3d20d6[_0x451c('0x30')]=_[_0x451c('0x31')](_0x3d20d6[_0x451c('0x30')],{'$or':_[_0x451c('0x20')](_0x2b2556,function(_0x2c6585){if(_0x2c6585[_0x451c('0x23')]!==_0x451c('0x32')){var _0x9625={};_0x9625[_0x2c6585[_0x451c('0x1d')]]={'$like':'%'+_0x50dad0[_0x451c('0x26')][_0x451c('0x33')]+'%'};return _0x9625;}})});}_0x3d20d6=_[_0x451c('0x31')]({},_0x3d20d6,_0x50dad0[_0x451c('0x34')]);var _0x89db34={'where':_0x3d20d6[_0x451c('0x30')]};return db['Network'][_0x451c('0x16')](_0x89db34)['then'](function(_0x3ef7da){_0x1aa35e[_0x451c('0x16')]=_0x3ef7da;if(_0x50dad0[_0x451c('0x26')][_0x451c('0x35')]){_0x3d20d6['include']=[{'all':!![]}];}return db[_0x451c('0x21')][_0x451c('0x36')](_0x3d20d6);})[_0x451c('0x8')](function(_0x29bcd1){_0x1aa35e[_0x451c('0x37')]=_0x29bcd1;return _0x1aa35e;})['then'](respondWithFilteredResult(_0x49a28d,_0x3d20d6))[_0x451c('0x11')](handleError(_0x49a28d,null));};exports[_0x451c('0x38')]=function(_0x591fb5,_0x3b7f61){var _0x3ce87e={'raw':!![],'where':{'id':_0x591fb5['params']['id']}},_0x5d12e7={};_0x5d12e7[_0x451c('0x25')]=_[_0x451c('0x39')](db['Network'][_0x451c('0x3a')]);_0x5d12e7[_0x451c('0x26')]=_['keys'](_0x591fb5[_0x451c('0x26')]);_0x5d12e7[_0x451c('0x27')]=_[_0x451c('0x28')](_0x5d12e7[_0x451c('0x25')],_0x5d12e7[_0x451c('0x26')]);_0x3ce87e[_0x451c('0x29')]=_['intersection'](_0x5d12e7[_0x451c('0x25')],qs['fields'](_0x591fb5[_0x451c('0x26')]['fields']));_0x3ce87e[_0x451c('0x29')]=_0x3ce87e[_0x451c('0x29')][_0x451c('0x2b')]?_0x3ce87e['attributes']:_0x5d12e7['model'];if(_0x591fb5['query'][_0x451c('0x35')]){_0x3ce87e['include']=[{'all':!![]}];}_0x3ce87e=_[_0x451c('0x31')]({},_0x3ce87e,_0x591fb5[_0x451c('0x34')]);return db['Network'][_0x451c('0x3b')](_0x3ce87e)[_0x451c('0x8')](handleEntityNotFound(_0x3b7f61,null))[_0x451c('0x8')](respondWithResult(_0x3b7f61,null))[_0x451c('0x11')](handleError(_0x3b7f61,null));};exports[_0x451c('0x3c')]=function(_0x273b8f,_0x3a7d75){var _0x20187f;return db[_0x451c('0x21')][_0x451c('0x3c')](_0x273b8f[_0x451c('0x3d')],{'raw':!![]})['then'](function(_0x4692e8){_0x20187f=_0x4692e8;return db[_0x451c('0x21')][_0x451c('0x36')]({'where':{'type':_0x273b8f[_0x451c('0x3d')]['type']},'raw':!![]});})['then'](function(_0x3bb9a4){if(_0x20187f[_0x451c('0x23')][_0x451c('0x3e')]()==_0x451c('0x3f')){var _0x353ce1=fs[_0x451c('0x40')](path['join'](config[_0x451c('0x41')],'server/files/templates/stun_multiple.ejs'),_0x451c('0x42'));var _0x206fa3=ejs[_0x451c('0x43')](_0x353ce1,{'networks':_0x3bb9a4||[]});fs['writeFileSync'](_0x451c('0x44'),_0x206fa3);return respondWithRpcPromise(_0x451c('0x45'),'create',{'module':'res_stun_monitor.so'});}else if(_0x20187f[_0x451c('0x23')][_0x451c('0x3e')]()=='TURN'){var _0x576f5b=fs[_0x451c('0x40')](path['join'](config[_0x451c('0x41')],'server/files/templates/turn_multiple.ejs'),_0x451c('0x42'));var _0xa9803f=ejs[_0x451c('0x43')](_0x576f5b,{'networks':_0x3bb9a4||[]});fs[_0x451c('0x46')](_0x451c('0x47'),_0xa9803f);return respondWithRpcPromise(_0x451c('0x45'),_0x451c('0x3c'),{'module':_0x451c('0x48')});}else{var _0x5c1dbc=fs[_0x451c('0x40')](path[_0x451c('0x49')](config[_0x451c('0x41')],'server/files/templates/network.ejs'),_0x451c('0x42'));var _0x14df68=ejs[_0x451c('0x43')](_0x5c1dbc,{'networks':_0x3bb9a4||[]});fs['writeFileSync'](util[_0x451c('0x4a')](_0x451c('0x4b'),_0x273b8f[_0x451c('0x3d')][_0x451c('0x23')][_0x451c('0x4c')]()),_0x14df68);return respondWithRpcPromise(_0x451c('0x45'),_0x451c('0x3c'),{'module':_0x451c('0x4d')});}})[_0x451c('0x8')](function(){return _0x20187f;})[_0x451c('0x8')](respondWithResult(_0x3a7d75,0xc9))[_0x451c('0x11')](handleError(_0x3a7d75,null));};exports[_0x451c('0x19')]=function(_0x53c2cb,_0x46518c){var _0x517034;return db['Network'][_0x451c('0x3b')]({'where':{'id':_0x53c2cb[_0x451c('0x4e')]['id']}})[_0x451c('0x8')](handleEntityNotFound(_0x46518c,null))[_0x451c('0x8')](saveUpdates(_0x53c2cb['body'],null))[_0x451c('0x8')](function(_0x5cf668){if(_0x5cf668){_0x517034=_0x5cf668;return db[_0x451c('0x21')]['findAll']({'where':{'type':_0x517034[_0x451c('0x23')]},'raw':!![]});}return null;})[_0x451c('0x8')](function(_0x148355){if(_0x517034['type'][_0x451c('0x3e')]()=='STUN'){var _0x38509d=fs['readFileSync'](path[_0x451c('0x49')](config['root'],_0x451c('0x4f')),_0x451c('0x42'));var _0x48b77b=ejs[_0x451c('0x43')](_0x38509d,{'networks':_0x148355||[]});fs['writeFileSync'](_0x451c('0x44'),_0x48b77b);return respondWithRpcPromise(_0x451c('0x45'),'update',{'module':_0x451c('0x48')});}else if(_0x517034[_0x451c('0x23')][_0x451c('0x3e')]()==_0x451c('0x50')){var _0x107fb0=fs[_0x451c('0x40')](path[_0x451c('0x49')](config['root'],_0x451c('0x51')),'utf8');var _0x314c75=ejs['render'](_0x107fb0,{'networks':_0x148355||[]});fs[_0x451c('0x46')](_0x451c('0x47'),_0x314c75);return respondWithRpcPromise(_0x451c('0x45'),'update',{'module':_0x451c('0x48')});}else{var _0xdc6eb1=fs[_0x451c('0x40')](path[_0x451c('0x49')](config[_0x451c('0x41')],_0x451c('0x52')),_0x451c('0x42'));var _0x44c2e2=ejs[_0x451c('0x43')](_0xdc6eb1,{'networks':_0x148355||[]});fs[_0x451c('0x46')](util[_0x451c('0x4a')](_0x451c('0x4b'),_0x53c2cb[_0x451c('0x3d')]['type'][_0x451c('0x4c')]()),_0x44c2e2);return respondWithRpcPromise(_0x451c('0x45'),_0x451c('0x19'),{'module':_0x451c('0x4d')});}})[_0x451c('0x8')](function(_0x269b35){if(_0x269b35){return _0x517034;}return null;})[_0x451c('0x8')](respondWithResult(_0x46518c,null))[_0x451c('0x11')](handleError(_0x46518c,null));};exports[_0x451c('0x1a')]=function(_0x7d6642,_0xb94dea){var _0x499ecc;return db[_0x451c('0x21')][_0x451c('0x3b')]({'where':{'id':_0x7d6642[_0x451c('0x4e')]['id']}})[_0x451c('0x8')](function(_0x34876e){_0x499ecc=_0x34876e;return _0x34876e;})['then'](handleEntityNotFound(_0xb94dea,null))['then'](removeEntity(_0xb94dea,null))[_0x451c('0x8')](function(){if(_0x499ecc){return db[_0x451c('0x21')][_0x451c('0x36')]({'where':{'type':_0x499ecc['type']},'raw':!![]});}})['then'](function(_0x1eb564){if(_0x499ecc[_0x451c('0x23')][_0x451c('0x3e')]()==_0x451c('0x3f')){var _0x1bc702=fs[_0x451c('0x40')](path[_0x451c('0x49')](config['root'],_0x451c('0x4f')),_0x451c('0x42'));var _0x83ff1c=ejs[_0x451c('0x43')](_0x1bc702,{'networks':_0x1eb564||[]});fs[_0x451c('0x46')]('/etc/asterisk/stun_xcally.conf',_0x83ff1c);return respondWithRpcPromise(_0x451c('0x45'),_0x451c('0x1a'),{'module':_0x451c('0x48')});}else if(_0x499ecc[_0x451c('0x23')][_0x451c('0x3e')]()==_0x451c('0x50')){var _0x2a6503=fs[_0x451c('0x40')](path[_0x451c('0x49')](config['root'],_0x451c('0x51')),_0x451c('0x42'));var _0x32d6b0=ejs[_0x451c('0x43')](_0x2a6503,{'networks':_0x1eb564||[]});fs[_0x451c('0x46')]('/etc/asterisk/turn_xcally.conf',_0x32d6b0);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x2389c1=fs[_0x451c('0x40')](path[_0x451c('0x49')](config[_0x451c('0x41')],_0x451c('0x52')),'utf8');var _0x41158f=ejs[_0x451c('0x43')](_0x2389c1,{'networks':_0x1eb564||[]});fs['writeFileSync'](util[_0x451c('0x4a')](_0x451c('0x4b'),_0x499ecc[_0x451c('0x23')][_0x451c('0x4c')]()),_0x41158f);return respondWithRpcPromise(_0x451c('0x45'),_0x451c('0x1a'),{'module':_0x451c('0x4d')});}})[_0x451c('0x11')](handleError(_0xb94dea,null));}; \ No newline at end of file +var _0xd047=['chan_sip.so','update','find','params','/etc/asterisk/stun_xcally.conf','TURN','toLowerCase','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','catch','status','json','undefined','limit','count','offset','Content-Range','destroy','end','stack','send','index','map','Network','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','writeFileSync','Reload','root','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0x2298fe,_0x505238){var _0x525e16=function(_0x2b448f){while(--_0x2b448f){_0x2298fe['push'](_0x2298fe['shift']());}};_0x525e16(++_0x505238);}(_0xd047,0x153));var _0x7d04=function(_0x1d1017,_0x2f69c5){_0x1d1017=_0x1d1017-0x0;var _0x1bf6ed=_0xd047[_0x1d1017];return _0x1bf6ed;};'use strict';var util=require(_0x7d04('0x0'));var path=require(_0x7d04('0x1'));var ejs=require(_0x7d04('0x2'));var fs=require('fs');var _=require(_0x7d04('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x7d04('0x4'))(_0x7d04('0x5'));var config=require(_0x7d04('0x6'));var db=require(_0x7d04('0x7'))['db'];var jayson=require(_0x7d04('0x8'));var client=jayson[_0x7d04('0x9')][_0x7d04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x426d51,_0xccc009,_0x218b0b,_0x8f9e39){return new Promise(function(_0x2f8cab,_0x2e7927){var _0x278323=_0x8f9e39||client;return _0x278323['request'](_0x426d51,_0x218b0b)[_0x7d04('0xb')](function(_0x2ff474){logger[_0x7d04('0xc')](_0x7d04('0xd'),_0xccc009,_0x7d04('0xe'));logger[_0x7d04('0xf')](_0x7d04('0x10'),_0xccc009,_0x7d04('0xe'),JSON['stringify'](_0x2ff474));if(_0x2ff474['error']){if(_0x2ff474['error']['code']===0x1f4){logger[_0x7d04('0x11')]('Network,\x20%s,\x20%s',_0xccc009,_0x2ff474[_0x7d04('0x11')][_0x7d04('0x12')]);return _0x2e7927(_0x2ff474['error'][_0x7d04('0x12')]);}logger[_0x7d04('0x11')]('Network,\x20%s,\x20%s',_0xccc009,_0x2ff474[_0x7d04('0x11')][_0x7d04('0x12')]);return _0x2f8cab(_0x2ff474[_0x7d04('0x11')][_0x7d04('0x12')]);}else{logger['info'](_0x7d04('0xd'),_0xccc009,_0x7d04('0xe'));_0x2f8cab(_0x2ff474['result'][_0x7d04('0x12')]);}})[_0x7d04('0x13')](function(_0x343832){logger[_0x7d04('0x11')]('Network,\x20%s,\x20%s',_0xccc009,_0x343832);_0x2e7927(_0x343832);});});}function respondWithResult(_0x124a44,_0x33074b){_0x33074b=_0x33074b||0xc8;return function(_0x31a892){if(_0x31a892){return _0x124a44[_0x7d04('0x14')](_0x33074b)[_0x7d04('0x15')](_0x31a892);}};}function respondWithFilteredResult(_0x370f1e,_0x72b14f){return function(_0x55e359){if(_0x55e359){var _0x3e79da=typeof _0x72b14f['offset']===_0x7d04('0x16')&&typeof _0x72b14f[_0x7d04('0x17')]===_0x7d04('0x16');var _0x11fcce=_0x55e359['count'];var _0x2fb9c9=_0x3e79da?0x0:_0x72b14f['offset'];var _0x206d5b=_0x3e79da?_0x55e359[_0x7d04('0x18')]:_0x72b14f[_0x7d04('0x19')]+_0x72b14f[_0x7d04('0x17')];var _0x379a01;if(_0x206d5b>=_0x11fcce){_0x206d5b=_0x11fcce;_0x379a01=0xc8;}else{_0x379a01=0xce;}_0x370f1e['status'](_0x379a01);return _0x370f1e['set'](_0x7d04('0x1a'),_0x2fb9c9+'-'+_0x206d5b+'/'+_0x11fcce)[_0x7d04('0x15')](_0x55e359);}return null;};}function saveUpdates(_0x2d6ef7){return function(_0x40dc3a){if(_0x40dc3a){return _0x40dc3a['update'](_0x2d6ef7)[_0x7d04('0xb')](function(_0x2c95b5){return _0x2c95b5;});}return null;};}function removeEntity(_0x3bc7fc){return function(_0x2ae454){if(_0x2ae454){return _0x2ae454[_0x7d04('0x1b')]()[_0x7d04('0xb')](function(){_0x3bc7fc[_0x7d04('0x14')](0xcc)[_0x7d04('0x1c')]();});}};}function handleEntityNotFound(_0x52e53){return function(_0x348be0){if(!_0x348be0){_0x52e53['sendStatus'](0x194);}return _0x348be0;};}function handleError(_0x47e2b5,_0x34bd7d){_0x34bd7d=_0x34bd7d||0x1f4;return function(_0xe69260){logger[_0x7d04('0x11')](_0xe69260[_0x7d04('0x1d')]);if(_0xe69260['name']){delete _0xe69260['name'];}_0x47e2b5[_0x7d04('0x14')](_0x34bd7d)[_0x7d04('0x1e')](_0xe69260);};}exports[_0x7d04('0x1f')]=function(_0x10a135,_0x491864){var _0x3cc483={},_0x2f4a8a={},_0xebc356={'count':0x0,'rows':[]};var _0x3c9604=_[_0x7d04('0x20')](db[_0x7d04('0x21')][_0x7d04('0x22')],function(_0x178bcd){return{'name':_0x178bcd[_0x7d04('0x23')],'type':_0x178bcd[_0x7d04('0x24')][_0x7d04('0x25')]};});_0x2f4a8a[_0x7d04('0x26')]=_[_0x7d04('0x20')](_0x3c9604,_0x7d04('0x27'));_0x2f4a8a[_0x7d04('0x28')]=_[_0x7d04('0x29')](_0x10a135[_0x7d04('0x28')]);_0x2f4a8a[_0x7d04('0x2a')]=_[_0x7d04('0x2b')](_0x2f4a8a['model'],_0x2f4a8a[_0x7d04('0x28')]);_0x3cc483[_0x7d04('0x2c')]=_[_0x7d04('0x2b')](_0x2f4a8a[_0x7d04('0x26')],qs[_0x7d04('0x2d')](_0x10a135[_0x7d04('0x28')]['fields']));_0x3cc483[_0x7d04('0x2c')]=_0x3cc483[_0x7d04('0x2c')][_0x7d04('0x2e')]?_0x3cc483['attributes']:_0x2f4a8a['model'];if(!_0x10a135[_0x7d04('0x28')]['hasOwnProperty'](_0x7d04('0x2f'))){_0x3cc483[_0x7d04('0x17')]=qs['limit'](_0x10a135[_0x7d04('0x28')][_0x7d04('0x17')]);_0x3cc483[_0x7d04('0x19')]=qs[_0x7d04('0x19')](_0x10a135[_0x7d04('0x28')][_0x7d04('0x19')]);}_0x3cc483['order']=qs[_0x7d04('0x30')](_0x10a135[_0x7d04('0x28')][_0x7d04('0x30')]);_0x3cc483[_0x7d04('0x31')]=qs[_0x7d04('0x2a')](_['pick'](_0x10a135[_0x7d04('0x28')],_0x2f4a8a[_0x7d04('0x2a')]),_0x3c9604);if(_0x10a135[_0x7d04('0x28')][_0x7d04('0x32')]){_0x3cc483[_0x7d04('0x31')]=_['merge'](_0x3cc483[_0x7d04('0x31')],{'$or':_[_0x7d04('0x20')](_0x3c9604,function(_0x24e5e7){if(_0x24e5e7[_0x7d04('0x24')]!==_0x7d04('0x33')){var _0x47ca91={};_0x47ca91[_0x24e5e7[_0x7d04('0x27')]]={'$like':'%'+_0x10a135[_0x7d04('0x28')][_0x7d04('0x32')]+'%'};return _0x47ca91;}})});}_0x3cc483=_[_0x7d04('0x34')]({},_0x3cc483,_0x10a135[_0x7d04('0x35')]);var _0x75c554={'where':_0x3cc483['where']};return db[_0x7d04('0x21')][_0x7d04('0x18')](_0x75c554)[_0x7d04('0xb')](function(_0x35e43a){_0xebc356[_0x7d04('0x18')]=_0x35e43a;if(_0x10a135[_0x7d04('0x28')][_0x7d04('0x36')]){_0x3cc483['include']=[{'all':!![]}];}return db[_0x7d04('0x21')][_0x7d04('0x37')](_0x3cc483);})[_0x7d04('0xb')](function(_0x2d1624){_0xebc356[_0x7d04('0x38')]=_0x2d1624;return _0xebc356;})[_0x7d04('0xb')](respondWithFilteredResult(_0x491864,_0x3cc483))[_0x7d04('0x13')](handleError(_0x491864,null));};exports[_0x7d04('0x39')]=function(_0x24208a,_0x2ab4a4){var _0x2230bd={'raw':!![],'where':{'id':_0x24208a['params']['id']}},_0x511b98={};_0x511b98[_0x7d04('0x26')]=_[_0x7d04('0x29')](db[_0x7d04('0x21')][_0x7d04('0x22')]);_0x511b98[_0x7d04('0x28')]=_['keys'](_0x24208a[_0x7d04('0x28')]);_0x511b98[_0x7d04('0x2a')]=_['intersection'](_0x511b98[_0x7d04('0x26')],_0x511b98[_0x7d04('0x28')]);_0x2230bd[_0x7d04('0x2c')]=_[_0x7d04('0x2b')](_0x511b98['model'],qs[_0x7d04('0x2d')](_0x24208a[_0x7d04('0x28')][_0x7d04('0x2d')]));_0x2230bd['attributes']=_0x2230bd[_0x7d04('0x2c')][_0x7d04('0x2e')]?_0x2230bd[_0x7d04('0x2c')]:_0x511b98['model'];if(_0x24208a[_0x7d04('0x28')][_0x7d04('0x36')]){_0x2230bd['include']=[{'all':!![]}];}_0x2230bd=_['merge']({},_0x2230bd,_0x24208a[_0x7d04('0x35')]);return db[_0x7d04('0x21')]['find'](_0x2230bd)[_0x7d04('0xb')](handleEntityNotFound(_0x2ab4a4,null))[_0x7d04('0xb')](respondWithResult(_0x2ab4a4,null))[_0x7d04('0x13')](handleError(_0x2ab4a4,null));};exports[_0x7d04('0x3a')]=function(_0x1e65ba,_0x28d68c){var _0x73e985;return db[_0x7d04('0x21')][_0x7d04('0x3a')](_0x1e65ba[_0x7d04('0x3b')],{'raw':!![]})['then'](function(_0x5866cb){_0x73e985=_0x5866cb;return db[_0x7d04('0x21')][_0x7d04('0x37')]({'where':{'type':_0x1e65ba[_0x7d04('0x3b')][_0x7d04('0x24')]},'raw':!![]});})[_0x7d04('0xb')](function(_0x3ec3de){if(_0x73e985['type'][_0x7d04('0x3c')]()==_0x7d04('0x3d')){var _0x38a2d0=fs[_0x7d04('0x3e')](path[_0x7d04('0x3f')](config['root'],_0x7d04('0x40')),'utf8');var _0x2ead54=ejs['render'](_0x38a2d0,{'networks':_0x3ec3de||[]});fs[_0x7d04('0x41')]('/etc/asterisk/stun_xcally.conf',_0x2ead54);return respondWithRpcPromise(_0x7d04('0x42'),_0x7d04('0x3a'),{'module':'res_stun_monitor.so'});}else if(_0x73e985['type'][_0x7d04('0x3c')]()=='TURN'){var _0x49d9de=fs[_0x7d04('0x3e')](path['join'](config[_0x7d04('0x43')],_0x7d04('0x44')),_0x7d04('0x45'));var _0xe65cfb=ejs[_0x7d04('0x46')](_0x49d9de,{'networks':_0x3ec3de||[]});fs['writeFileSync'](_0x7d04('0x47'),_0xe65cfb);return respondWithRpcPromise('Reload','create',{'module':_0x7d04('0x48')});}else{var _0x45ac6b=fs[_0x7d04('0x3e')](path[_0x7d04('0x3f')](config[_0x7d04('0x43')],_0x7d04('0x49')),_0x7d04('0x45'));var _0x489513=ejs['render'](_0x45ac6b,{'networks':_0x3ec3de||[]});fs['writeFileSync'](util[_0x7d04('0x4a')](_0x7d04('0x4b'),_0x1e65ba['body'][_0x7d04('0x24')]['toLowerCase']()),_0x489513);return respondWithRpcPromise(_0x7d04('0x42'),'create',{'module':_0x7d04('0x4c')});}})[_0x7d04('0xb')](function(){return _0x73e985;})[_0x7d04('0xb')](respondWithResult(_0x28d68c,0xc9))[_0x7d04('0x13')](handleError(_0x28d68c,null));};exports[_0x7d04('0x4d')]=function(_0x29af78,_0x9101bd){var _0x9a23f5;return db['Network'][_0x7d04('0x4e')]({'where':{'id':_0x29af78[_0x7d04('0x4f')]['id']}})[_0x7d04('0xb')](handleEntityNotFound(_0x9101bd,null))[_0x7d04('0xb')](saveUpdates(_0x29af78[_0x7d04('0x3b')],null))[_0x7d04('0xb')](function(_0x1b3cd9){if(_0x1b3cd9){_0x9a23f5=_0x1b3cd9;return db[_0x7d04('0x21')][_0x7d04('0x37')]({'where':{'type':_0x9a23f5[_0x7d04('0x24')]},'raw':!![]});}return null;})['then'](function(_0x416d14){if(_0x9a23f5[_0x7d04('0x24')][_0x7d04('0x3c')]()=='STUN'){var _0x4793b0=fs[_0x7d04('0x3e')](path['join'](config['root'],_0x7d04('0x40')),_0x7d04('0x45'));var _0x2b2ddf=ejs[_0x7d04('0x46')](_0x4793b0,{'networks':_0x416d14||[]});fs[_0x7d04('0x41')](_0x7d04('0x50'),_0x2b2ddf);return respondWithRpcPromise(_0x7d04('0x42'),_0x7d04('0x4d'),{'module':'res_stun_monitor.so'});}else if(_0x9a23f5['type'][_0x7d04('0x3c')]()==_0x7d04('0x51')){var _0x73b22a=fs[_0x7d04('0x3e')](path['join'](config['root'],_0x7d04('0x44')),_0x7d04('0x45'));var _0x59b60f=ejs['render'](_0x73b22a,{'networks':_0x416d14||[]});fs[_0x7d04('0x41')]('/etc/asterisk/turn_xcally.conf',_0x59b60f);return respondWithRpcPromise('Reload','update',{'module':_0x7d04('0x48')});}else{var _0x5683c9=fs[_0x7d04('0x3e')](path[_0x7d04('0x3f')](config[_0x7d04('0x43')],'server/files/templates/network.ejs'),_0x7d04('0x45'));var _0x595c65=ejs['render'](_0x5683c9,{'networks':_0x416d14||[]});fs['writeFileSync'](util[_0x7d04('0x4a')](_0x7d04('0x4b'),_0x29af78[_0x7d04('0x3b')][_0x7d04('0x24')][_0x7d04('0x52')]()),_0x595c65);return respondWithRpcPromise('Reload',_0x7d04('0x4d'),{'module':'chan_sip.so'});}})[_0x7d04('0xb')](function(_0x59b20a){if(_0x59b20a){return _0x9a23f5;}return null;})[_0x7d04('0xb')](respondWithResult(_0x9101bd,null))[_0x7d04('0x13')](handleError(_0x9101bd,null));};exports['destroy']=function(_0x228d62,_0x4c81fe){var _0x3da70e;return db['Network'][_0x7d04('0x4e')]({'where':{'id':_0x228d62[_0x7d04('0x4f')]['id']}})[_0x7d04('0xb')](function(_0x4c599a){_0x3da70e=_0x4c599a;return _0x4c599a;})[_0x7d04('0xb')](handleEntityNotFound(_0x4c81fe,null))['then'](removeEntity(_0x4c81fe,null))[_0x7d04('0xb')](function(){if(_0x3da70e){return db['Network']['findAll']({'where':{'type':_0x3da70e[_0x7d04('0x24')]},'raw':!![]});}})[_0x7d04('0xb')](function(_0x3fb96a){if(_0x3da70e[_0x7d04('0x24')]['toUpperCase']()==_0x7d04('0x3d')){var _0x5c4d82=fs[_0x7d04('0x3e')](path[_0x7d04('0x3f')](config[_0x7d04('0x43')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x13dc0c=ejs[_0x7d04('0x46')](_0x5c4d82,{'networks':_0x3fb96a||[]});fs[_0x7d04('0x41')](_0x7d04('0x50'),_0x13dc0c);return respondWithRpcPromise('Reload',_0x7d04('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x3da70e[_0x7d04('0x24')][_0x7d04('0x3c')]()==_0x7d04('0x51')){var _0x2433f7=fs['readFileSync'](path[_0x7d04('0x3f')](config[_0x7d04('0x43')],_0x7d04('0x44')),_0x7d04('0x45'));var _0x8475fa=ejs[_0x7d04('0x46')](_0x2433f7,{'networks':_0x3fb96a||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x8475fa);return respondWithRpcPromise(_0x7d04('0x42'),_0x7d04('0x1b'),{'module':_0x7d04('0x48')});}else{var _0xc3806b=fs[_0x7d04('0x3e')](path[_0x7d04('0x3f')](config['root'],_0x7d04('0x49')),_0x7d04('0x45'));var _0x5e8efa=ejs[_0x7d04('0x46')](_0xc3806b,{'networks':_0x3fb96a||[]});fs[_0x7d04('0x41')](util[_0x7d04('0x4a')](_0x7d04('0x4b'),_0x3da70e['type'][_0x7d04('0x52')]()),_0x5e8efa);return respondWithRpcPromise(_0x7d04('0x42'),_0x7d04('0x1b'),{'module':'chan_sip.so'});}})[_0x7d04('0x13')](handleError(_0x4c81fe,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index eb4527e..3206017 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 _0xa25c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','Network','network'];(function(_0x316662,_0x2956f7){var _0x22dce3=function(_0x23ba10){while(--_0x23ba10){_0x316662['push'](_0x316662['shift']());}};_0x22dce3(++_0x2956f7);}(_0xa25c,0x13f));var _0xca25=function(_0x104c8e,_0x4f26c8){_0x104c8e=_0x104c8e-0x0;var _0x39656b=_0xa25c[_0x104c8e];return _0x39656b;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var logger=require(_0xca25('0x1'))(_0xca25('0x2'));var moment=require(_0xca25('0x3'));var BPromise=require(_0xca25('0x4'));var rp=require(_0xca25('0x5'));var fs=require('fs');var path=require(_0xca25('0x6'));var rimraf=require(_0xca25('0x7'));var config=require('../../config/environment');var attributes=require(_0xca25('0x8'));module['exports']=function(_0x4ec046,_0xae1996){return _0x4ec046['define'](_0xca25('0x9'),attributes,{'tableName':_0xca25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','Network','../../config/logger','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports'];(function(_0x23237f,_0x31ca04){var _0x9d7a99=function(_0x2788de){while(--_0x2788de){_0x23237f['push'](_0x23237f['shift']());}};_0x9d7a99(++_0x31ca04);}(_0x22fb,0x192));var _0xb22f=function(_0x292ddc,_0x3437ac){_0x292ddc=_0x292ddc-0x0;var _0x437b59=_0x22fb[_0x292ddc];return _0x437b59;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index d60594e..39c0f01 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x17a655,_0x4d2ba7){_0x17a655=_0x17a655-0x0;var _0x2417c1=_0x7a54[_0x17a655];return _0x2417c1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x282431,_0x1284c7){_0x282431=_0x282431-0x0;var _0x1884d8=_0x7a54[_0x282431];return _0x1884d8;};'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 3d4de81..bc3de77 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 _0xbbbc=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getInteractions','getAgents','post','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x17649d,_0x4e75c7){var _0x36cadd=function(_0x283926){while(--_0x283926){_0x17649d['push'](_0x17649d['shift']());}};_0x36cadd(++_0x4e75c7);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x18e610,_0x161c11){_0x18e610=_0x18e610-0x0;var _0x5041e5=_0xbbbc[_0x18e610];return _0x5041e5;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var timeout=require(_0xcbbb('0x3'));var express=require(_0xcbbb('0x4'));var router=express[_0xcbbb('0x5')]();var fs_extra=require(_0xcbbb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var controller=require(_0xcbbb('0x9'));router[_0xcbbb('0xa')]('/',auth[_0xcbbb('0xb')](),controller['index']);router[_0xcbbb('0xa')](_0xcbbb('0xc'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0xd')]);router[_0xcbbb('0xa')](_0xcbbb('0xe'),auth[_0xcbbb('0xb')](),controller['show']);router[_0xcbbb('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xcbbb('0xf')]);router['get'](_0xcbbb('0x10'),auth['isAuthenticated'](),controller[_0xcbbb('0x11')]);router[_0xcbbb('0xa')]('/:id/applications',auth[_0xcbbb('0xb')](),controller['getApplications']);router[_0xcbbb('0xa')]('/:id/interactions',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x12')]);router[_0xcbbb('0xa')]('/:id/users',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x13')]);router[_0xcbbb('0x14')]('/',auth[_0xcbbb('0xb')](),controller['create']);router['post'](_0xcbbb('0x15'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x16')]);router[_0xcbbb('0x14')]('/:id/canned_answers',auth[_0xcbbb('0xb')](),controller['addAnswer']);router[_0xcbbb('0x14')](_0xcbbb('0x17'),controller[_0xcbbb('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xcbbb('0x19')]);router[_0xcbbb('0x14')](_0xcbbb('0x1a'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1b')]);router[_0xcbbb('0x14')](_0xcbbb('0x1c'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1d')]);router[_0xcbbb('0x1e')]('/:id',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x1f')]);router[_0xcbbb('0x20')](_0xcbbb('0xe'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x21')]);router[_0xcbbb('0x20')](_0xcbbb('0x15'),auth[_0xcbbb('0xb')](),controller['removeDispositions']);router[_0xcbbb('0x20')](_0xcbbb('0x10'),auth['isAuthenticated'](),controller[_0xcbbb('0x22')]);router['delete']('/:id/users',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8aad=['index','get','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated'];(function(_0x43aa6e,_0xd75f81){var _0xfc07d8=function(_0xcf50d4){while(--_0xcf50d4){_0x43aa6e['push'](_0x43aa6e['shift']());}};_0xfc07d8(++_0xd75f81);}(_0x8aad,0x146));var _0xd8aa=function(_0x155f53,_0x424e91){_0x155f53=_0x155f53-0x0;var _0x598b4a=_0x8aad[_0x155f53];return _0x598b4a;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/canned_answers',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x8')](_0xd8aa('0x10'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router['get']('/:id/users',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x13')]('/',auth['isAuthenticated'](),controller[_0xd8aa('0x14')]);router[_0xd8aa('0x13')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller['addDisposition']);router[_0xd8aa('0x13')](_0xd8aa('0x15'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x13')](_0xd8aa('0x17'),controller[_0xd8aa('0x18')]);router[_0xd8aa('0x13')]('/:id/applications',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);router[_0xd8aa('0x13')](_0xd8aa('0x1a'),auth['isAuthenticated'](),controller[_0xd8aa('0x1b')]);router[_0xd8aa('0x13')](_0xd8aa('0x1c'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x1d')]);router['put'](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x1e')]);router['delete'](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x1f')]);router[_0xd8aa('0x20')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x21')]);router[_0xd8aa('0x20')](_0xd8aa('0x15'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x22')]);router[_0xd8aa('0x20')](_0xd8aa('0x1a'),auth['isAuthenticated'](),controller[_0xd8aa('0x23')]);module[_0xd8aa('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e9d1a00..4fd5467 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 _0x9c25=['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','name','generate','TEXT'];(function(_0x5c3a61,_0x57f501){var _0x5a3850=function(_0x4e2627){while(--_0x4e2627){_0x5c3a61['push'](_0x5c3a61['shift']());}};_0x5a3850(++_0x57f501);}(_0x9c25,0x152));var _0x59c2=function(_0x312c88,_0x183a02){_0x312c88=_0x312c88-0x0;var _0xee5456=_0x9c25[_0x312c88];return _0xee5456;};'use strict';var Sequelize=require(_0x59c2('0x0'));var rs=require(_0x59c2('0x1'));module[_0x59c2('0x2')]={'name':{'type':Sequelize[_0x59c2('0x3')],'unique':_0x59c2('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x59c2('0x5')]();}},'replyUri':{'type':Sequelize[_0x59c2('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x59c2('0x6')],'defaultValue':function(){return _0x59c2('0x7');}},'notificationSound':{'type':Sequelize[_0x59c2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59c2('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x59c2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x59c2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x59c2('0x3')]},'queueTransfer':{'type':Sequelize[_0x59c2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59c2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x59c2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x59c2('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x59c2('0x8')],'defaultValue':![],'comment':_0x59c2('0xb'),'set':function(_0x5a2aaf){if(!_0x5a2aaf)this[_0x59c2('0xc')](_0x59c2('0xd'),null);this[_0x59c2('0xc')](_0x59c2('0xe'),_0x5a2aaf);}}}; \ No newline at end of file +var _0x22a5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x22a5,0xd7));var _0x522a=function(_0x4b78b6,_0xa15589){_0x4b78b6=_0x4b78b6-0x0;var _0x1c4c9d=_0x22a5[_0x4b78b6];return _0x1c4c9d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x522a('0x0'));module['exports']={'name':{'type':Sequelize[_0x522a('0x1')],'unique':_0x522a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x522a('0x1')]},'token':{'type':Sequelize[_0x522a('0x1')],'defaultValue':function(){return rs[_0x522a('0x3')]();}},'replyUri':{'type':Sequelize[_0x522a('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x522a('0x4')],'defaultValue':function(){return _0x522a('0x5');}},'notificationSound':{'type':Sequelize[_0x522a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x522a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x522a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x522a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x522a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x522a('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x522a('0x6')],'defaultValue':![],'comment':_0x522a('0x9'),'set':function(_0x15fbb8){if(!_0x15fbb8)this[_0x522a('0xa')](_0x522a('0xb'),null);this['setDataValue'](_0x522a('0xc'),_0x15fbb8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index dc776c0..f49a877 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 _0x27a0=['userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','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','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','end','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','notify','openchannel','ValidationError','difference','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','Contacts','from','CmContact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','push','close','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','Start','EventManager','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','send','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','omit'];(function(_0x5bde1d,_0x4a6359){var _0x4d8808=function(_0x6e4704){while(--_0x6e4704){_0x5bde1d['push'](_0x5bde1d['shift']());}};_0x4d8808(++_0x4a6359);}(_0x27a0,0xbf));var _0x027a=function(_0x432cd2,_0x22f9ac){_0x432cd2=_0x432cd2-0x0;var _0x354d8e=_0x27a0[_0x432cd2];return _0x354d8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x027a('0x0'));var zipdir=require(_0x027a('0x1'));var jsonpatch=require(_0x027a('0x2'));var rp=require(_0x027a('0x3'));var moment=require(_0x027a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x027a('0x5'));var csv=require(_0x027a('0x6'));var ejs=require(_0x027a('0x7'));var fs=require('fs');var fs_extra=require(_0x027a('0x8'));var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x6'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var licenseUtil=require(_0x027a('0x16'));var db=require(_0x027a('0x17'))['db'];config[_0x027a('0x18')]=_[_0x027a('0x19')](config[_0x027a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x027a('0x1a'))(new Redis(config[_0x027a('0x18')]));require(_0x027a('0x1b'))[_0x027a('0x1c')](socket);var jayson=require(_0x027a('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x027a('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b3870,_0x559d13,_0x432007,_0x5a1224){return new BPromise(function(_0x4dc3ab,_0x47ceb7){var _0x588f53=_0x5a1224||client;return _0x588f53[_0x027a('0x1f')](_0x2b3870,_0x432007)[_0x027a('0x20')](function(_0x1fb40b){logger['info'](_0x027a('0x21'),_0x559d13,_0x027a('0x22'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x559d13,_0x027a('0x22'),JSON['stringify'](_0x1fb40b));if(_0x1fb40b[_0x027a('0x23')]){if(_0x1fb40b['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x559d13,_0x1fb40b[_0x027a('0x23')][_0x027a('0x24')]);return _0x47ceb7(_0x1fb40b[_0x027a('0x23')][_0x027a('0x24')]);}logger['error'](_0x027a('0x21'),_0x559d13,_0x1fb40b[_0x027a('0x23')][_0x027a('0x24')]);return _0x4dc3ab(_0x1fb40b[_0x027a('0x23')][_0x027a('0x24')]);}else{logger[_0x027a('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x559d13,_0x027a('0x22'));_0x4dc3ab(_0x1fb40b['result'][_0x027a('0x24')]);}})[_0x027a('0x26')](function(_0x1b1a13){logger[_0x027a('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x559d13,_0x1b1a13);_0x47ceb7(_0x1b1a13);});});}function respondWithStatusCode(_0x559381,_0x18458f){_0x18458f=_0x18458f||0xcc;return function(_0xcc7562){if(_0xcc7562){return _0x559381[_0x027a('0x27')](_0x18458f);}return _0x559381[_0x027a('0x28')](_0x18458f)['end']();};}function respondWithResult(_0x1b5325,_0x55a8cd){_0x55a8cd=_0x55a8cd||0xc8;return function(_0x953887){if(_0x953887){return _0x1b5325['status'](_0x55a8cd)[_0x027a('0x29')](_0x953887);}};}function respondWithFilteredResult(_0x4d5a25,_0x578ea5){return function(_0x31385d){if(_0x31385d){var _0x5782ac=typeof _0x578ea5['offset']===_0x027a('0x2a')&&typeof _0x578ea5['limit']===_0x027a('0x2a');var _0x47c57a=_0x31385d[_0x027a('0x2b')];var _0xc99acc=_0x5782ac?0x0:_0x578ea5['offset'];var _0xe4ea7d=_0x5782ac?_0x31385d['count']:_0x578ea5[_0x027a('0x2c')]+_0x578ea5[_0x027a('0x2d')];var _0x9e0106;if(_0xe4ea7d>=_0x47c57a){_0xe4ea7d=_0x47c57a;_0x9e0106=0xc8;}else{_0x9e0106=0xce;}_0x4d5a25[_0x027a('0x28')](_0x9e0106);return _0x4d5a25[_0x027a('0x2e')](_0x027a('0x2f'),_0xc99acc+'-'+_0xe4ea7d+'/'+_0x47c57a)['json'](_0x31385d);}return null;};}function patchUpdates(_0x3926e8){return function(_0x592350){try{jsonpatch[_0x027a('0x30')](_0x592350,_0x3926e8,!![]);}catch(_0x55d8c5){return BPromise[_0x027a('0x31')](_0x55d8c5);}return _0x592350[_0x027a('0x32')]();};}function saveUpdates(_0x44a10c,_0x307e3c){return function(_0x17f376){if(_0x17f376){return _0x17f376['update'](_0x44a10c)[_0x027a('0x20')](function(_0x26e716){return _0x26e716;});}return null;};}function removeEntity(_0xf89ec4,_0x2aefb7){return function(_0x14cb87){if(_0x14cb87){return _0x14cb87[_0x027a('0x33')]()[_0x027a('0x20')](function(){var _0xd09e6=_0x14cb87[_0x027a('0x34')]({'plain':!![]});var _0x28c008=_0x027a('0x35');return db['UserProfileResource'][_0x027a('0x33')]({'where':{'type':_0x28c008,'resourceId':_0xd09e6['id']}})[_0x027a('0x20')](function(){return _0x14cb87;});})[_0x027a('0x20')](function(){_0xf89ec4[_0x027a('0x28')](0xcc)[_0x027a('0x36')]();});}};}function handleEntityNotFound(_0x163dce,_0x2378b9){return function(_0x48d60b){if(!_0x48d60b){_0x163dce[_0x027a('0x27')](0x194);}return _0x48d60b;};}function handleError(_0x280f46,_0xb646de){_0xb646de=_0xb646de||0x1f4;return function(_0x5e9130){logger[_0x027a('0x23')](_0x5e9130['stack']);if(_0x5e9130[_0x027a('0x37')]){delete _0x5e9130[_0x027a('0x37')];}_0x280f46[_0x027a('0x28')](_0xb646de)['send'](_0x5e9130);};}exports['index']=function(_0x32a44e,_0x2eea3b){var _0x5830f6={'include':[{'model':db[_0x027a('0x38')],'as':_0x027a('0x39')}]},_0x3d36b8={},_0x10ff49={'count':0x0,'rows':[]};var _0x30e5b2=_[_0x027a('0x3a')](db[_0x027a('0x3b')][_0x027a('0x3c')],function(_0x19fc25){return{'name':_0x19fc25[_0x027a('0x3d')],'type':_0x19fc25[_0x027a('0x3e')][_0x027a('0x3f')]};});_0x3d36b8[_0x027a('0x40')]=_[_0x027a('0x3a')](_0x30e5b2,_0x027a('0x37'));_0x3d36b8[_0x027a('0x41')]=_[_0x027a('0x42')](_0x32a44e['query']);_0x3d36b8[_0x027a('0x43')]=_[_0x027a('0x44')](_0x3d36b8[_0x027a('0x40')],_0x3d36b8[_0x027a('0x41')]);_0x5830f6[_0x027a('0x45')]=_[_0x027a('0x44')](_0x3d36b8['model'],qs[_0x027a('0x46')](_0x32a44e[_0x027a('0x41')]['fields']));_0x5830f6[_0x027a('0x45')]=_0x5830f6['attributes']['length']?_0x5830f6[_0x027a('0x45')]:_0x3d36b8['model'];if(!_0x32a44e[_0x027a('0x41')][_0x027a('0x47')](_0x027a('0x48'))){_0x5830f6[_0x027a('0x2d')]=qs[_0x027a('0x2d')](_0x32a44e['query'][_0x027a('0x2d')]);_0x5830f6[_0x027a('0x2c')]=qs[_0x027a('0x2c')](_0x32a44e['query']['offset']);}_0x5830f6['order']=qs['sort'](_0x32a44e[_0x027a('0x41')][_0x027a('0x49')]);_0x5830f6[_0x027a('0x4a')]=qs[_0x027a('0x43')](_[_0x027a('0x4b')](_0x32a44e[_0x027a('0x41')],_0x3d36b8['filters']),_0x30e5b2);if(_0x32a44e['query'][_0x027a('0x4c')]){_0x5830f6[_0x027a('0x4a')]=_[_0x027a('0x4d')](_0x5830f6[_0x027a('0x4a')],{'$or':_[_0x027a('0x3a')](_0x30e5b2,function(_0x6ea84b){if(_0x6ea84b[_0x027a('0x3e')]!==_0x027a('0x4e')){var _0x1fb7ee={};_0x1fb7ee[_0x6ea84b['name']]={'$like':'%'+_0x32a44e[_0x027a('0x41')][_0x027a('0x4c')]+'%'};return _0x1fb7ee;}})});}_0x5830f6=_[_0x027a('0x4d')]({},_0x5830f6,_0x32a44e[_0x027a('0x4f')]);var _0xa3a68d={'where':_0x5830f6[_0x027a('0x4a')]};return db[_0x027a('0x3b')][_0x027a('0x2b')](_0xa3a68d)['then'](function(_0x2e2b76){_0x10ff49[_0x027a('0x2b')]=_0x2e2b76;if(_0x32a44e['query'][_0x027a('0x50')]){_0x5830f6[_0x027a('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5830f6);})['then'](function(_0x37048b){_0x10ff49['rows']=_0x37048b;return _0x10ff49;})[_0x027a('0x20')](respondWithFilteredResult(_0x2eea3b,_0x5830f6))['catch'](handleError(_0x2eea3b,null));};exports['show']=function(_0x53dec5,_0x56ef4a){var _0xa75e3a={'raw':![],'where':{'id':_0x53dec5['params']['id']},'include':[{'model':db['Pause'],'as':_0x027a('0x39')}]},_0x352479={};_0x352479[_0x027a('0x40')]=_[_0x027a('0x42')](db[_0x027a('0x3b')]['rawAttributes']);_0x352479[_0x027a('0x41')]=_['keys'](_0x53dec5[_0x027a('0x41')]);_0x352479[_0x027a('0x43')]=_[_0x027a('0x44')](_0x352479[_0x027a('0x40')],_0x352479[_0x027a('0x41')]);_0xa75e3a[_0x027a('0x45')]=_[_0x027a('0x44')](_0x352479[_0x027a('0x40')],qs['fields'](_0x53dec5[_0x027a('0x41')][_0x027a('0x46')]));_0xa75e3a[_0x027a('0x45')]=_0xa75e3a[_0x027a('0x45')][_0x027a('0x52')]?_0xa75e3a[_0x027a('0x45')]:_0x352479[_0x027a('0x40')];if(_0x53dec5['query'][_0x027a('0x50')]){_0xa75e3a[_0x027a('0x51')]=[{'all':!![]}];}_0xa75e3a=_[_0x027a('0x4d')]({},_0xa75e3a,_0x53dec5[_0x027a('0x4f')]);return db[_0x027a('0x3b')][_0x027a('0x53')](_0xa75e3a)[_0x027a('0x20')](handleEntityNotFound(_0x56ef4a,null))[_0x027a('0x20')](respondWithResult(_0x56ef4a,null))[_0x027a('0x26')](handleError(_0x56ef4a,null));};exports[_0x027a('0x54')]=function(_0x3da285,_0x840903){return db[_0x027a('0x3b')][_0x027a('0x54')](_0x3da285[_0x027a('0x55')],{})['then'](function(_0x13f9b9){var _0x3ed56f=_0x3da285[_0x027a('0x56')][_0x027a('0x34')]({'plain':!![]});if(!_0x3ed56f)throw new Error(_0x027a('0x57'));if(_0x3ed56f[_0x027a('0x58')]===_0x027a('0x56')){var _0x23e9cf=_0x13f9b9[_0x027a('0x34')]({'plain':!![]});var _0x514c34='OpenchannelAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x514c34,'userProfileId':_0x3ed56f[_0x027a('0x59')]},'raw':!![]})[_0x027a('0x20')](function(_0x20918e){if(_0x20918e&&_0x20918e[_0x027a('0x5a')]===0x0){return db[_0x027a('0x5b')]['create']({'name':_0x23e9cf['name'],'resourceId':_0x23e9cf['id'],'type':_0x20918e[_0x027a('0x37')],'sectionId':_0x20918e['id']},{})['then'](function(){return _0x13f9b9;});}else{return _0x13f9b9;}})['catch'](function(_0x364a8b){logger[_0x027a('0x23')](_0x027a('0x5c'),_0x364a8b);throw _0x364a8b;});}return _0x13f9b9;})[_0x027a('0x20')](respondWithResult(_0x840903,0xc9))[_0x027a('0x26')](handleError(_0x840903,null));};exports[_0x027a('0x5d')]=function(_0xc28a,_0x3d0e4c){if(_0xc28a[_0x027a('0x55')]['id']){delete _0xc28a['body']['id'];}return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0xc28a[_0x027a('0x5e')]['id']},'include':[{'model':db[_0x027a('0x38')],'as':_0x027a('0x39')}]})[_0x027a('0x20')](handleEntityNotFound(_0x3d0e4c,null))[_0x027a('0x20')](saveUpdates(_0xc28a[_0x027a('0x55')],null))[_0x027a('0x20')](respondWithResult(_0x3d0e4c,null))[_0x027a('0x26')](handleError(_0x3d0e4c,null));};exports[_0x027a('0x33')]=function(_0x12d17d,_0x2a1f73){return db[_0x027a('0x3b')]['find']({'where':{'id':_0x12d17d[_0x027a('0x5e')]['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x2a1f73,null))[_0x027a('0x20')](removeEntity(_0x2a1f73,null))[_0x027a('0x26')](handleError(_0x2a1f73,null));};exports['describe']=function(_0x4cf78b,_0x2c404a){return db[_0x027a('0x3b')][_0x027a('0x5f')]()[_0x027a('0x20')](respondWithResult(_0x2c404a,null))[_0x027a('0x26')](handleError(_0x2c404a,null));};exports[_0x027a('0x60')]=function(_0x36fd58,_0x2b4cbd,_0x3ae1f3){if(_0x36fd58['body']['id']){delete _0x36fd58[_0x027a('0x55')]['id'];}return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0x36fd58['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x2b4cbd,null))[_0x027a('0x20')](function(_0x52dcab){if(_0x52dcab){_0x36fd58[_0x027a('0x55')][_0x027a('0x61')]=_0x52dcab['id'];return db['Disposition']['create'](_0x36fd58[_0x027a('0x55')]);}})[_0x027a('0x20')](respondWithResult(_0x2b4cbd,null))[_0x027a('0x26')](handleError(_0x2b4cbd,null));};exports[_0x027a('0x62')]=function(_0x58a21e,_0xaa3396,_0x36c707){var _0x146543={'raw':![],'where':{}};var _0x57cce6={};var _0x308da5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x027a('0x63')]({'where':{'id':_0x58a21e['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0xaa3396,null))[_0x027a('0x20')](function(_0x17ef27){if(_0x17ef27){_0x57cce6[_0x027a('0x40')]=_['keys'](db['Disposition']['rawAttributes']);_0x57cce6['query']=_['keys'](_0x58a21e['query']);_0x57cce6['filters']=_[_0x027a('0x44')](_0x57cce6['model'],_0x57cce6[_0x027a('0x41')]);_0x146543['attributes']=_[_0x027a('0x44')](_0x57cce6['model'],qs['fields'](_0x58a21e[_0x027a('0x41')][_0x027a('0x46')]));_0x146543[_0x027a('0x45')]=_0x146543['attributes'][_0x027a('0x52')]?_0x146543['attributes']:_0x57cce6[_0x027a('0x40')];if(!_0x58a21e[_0x027a('0x41')][_0x027a('0x47')]('nolimit')){_0x146543[_0x027a('0x2d')]=qs[_0x027a('0x2d')](_0x58a21e[_0x027a('0x41')][_0x027a('0x2d')]);_0x146543[_0x027a('0x2c')]=qs[_0x027a('0x2c')](_0x58a21e['query'][_0x027a('0x2c')]);}_0x146543['order']=qs[_0x027a('0x49')](_0x58a21e[_0x027a('0x41')][_0x027a('0x49')]);_0x146543[_0x027a('0x4a')]=qs['filters'](_[_0x027a('0x4b')](_0x58a21e[_0x027a('0x41')],_0x57cce6[_0x027a('0x43')]));_0x146543[_0x027a('0x4a')]['OpenchannelAccountId']=_0x17ef27['id'];if(_0x58a21e[_0x027a('0x41')][_0x027a('0x4c')]){_0x146543[_0x027a('0x4a')]=_[_0x027a('0x4d')](_0x146543['where'],{'$or':_[_0x027a('0x3a')](_0x146543[_0x027a('0x45')],function(_0x49ba36){var _0x367a36={};_0x367a36[_0x49ba36]={'$like':'%'+_0x58a21e[_0x027a('0x41')]['filter']+'%'};return _0x367a36;})});}_0x146543=_[_0x027a('0x4d')]({},_0x146543,_0x58a21e[_0x027a('0x4f')]);return db[_0x027a('0x64')][_0x027a('0x2b')]({'where':_0x146543[_0x027a('0x4a')]})[_0x027a('0x20')](function(_0xf2d0d9){_0x308da5['count']=_0xf2d0d9;if(_0x58a21e['query']['includeAll']){_0x146543[_0x027a('0x51')]=[{'all':!![]}];}return db[_0x027a('0x64')][_0x027a('0x65')](_0x146543);})[_0x027a('0x20')](function(_0x2d65a9){_0x308da5[_0x027a('0x66')]=_0x2d65a9;return _0x308da5;});}})['then'](respondWithFilteredResult(_0xaa3396,_0x146543))[_0x027a('0x26')](handleError(_0xaa3396,null));};exports[_0x027a('0x67')]=function(_0x2c9d52,_0x2b17e6,_0x5dc689){return db['OpenchannelAccount'][_0x027a('0x53')]({'where':{'id':_0x2c9d52['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x2b17e6,null))[_0x027a('0x20')](function(_0x5e67f0){if(_0x5e67f0){return _0x5e67f0[_0x027a('0x67')](_0x2c9d52[_0x027a('0x41')][_0x027a('0x68')]);}})[_0x027a('0x20')](respondWithStatusCode(_0x2b17e6,null))[_0x027a('0x26')](handleError(_0x2b17e6,null));};exports[_0x027a('0x69')]=function(_0x3daf40,_0x3af905,_0x3379b2){if(_0x3daf40[_0x027a('0x55')]['id']){delete _0x3daf40[_0x027a('0x55')]['id'];}return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0x3daf40[_0x027a('0x5e')]['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x3af905,null))[_0x027a('0x20')](function(_0x33546d){if(_0x33546d){_0x3daf40['body']['OpenchannelAccountId']=_0x33546d['id'];return db[_0x027a('0x6a')][_0x027a('0x54')](_0x3daf40['body']);}})[_0x027a('0x20')](respondWithResult(_0x3af905,null))[_0x027a('0x26')](handleError(_0x3af905,null));};exports[_0x027a('0x6b')]=function(_0x36bb99,_0x1f2f86,_0x5e1c0c){var _0x39ffe1={'raw':![],'where':{}};var _0x218e4f={};var _0x502265={'count':0x0,'rows':[]};return db[_0x027a('0x3b')][_0x027a('0x63')]({'where':{'id':_0x36bb99['params']['id']}})['then'](handleEntityNotFound(_0x1f2f86,null))[_0x027a('0x20')](function(_0x3a72c0){if(_0x3a72c0){_0x218e4f[_0x027a('0x40')]=_[_0x027a('0x42')](db[_0x027a('0x6a')][_0x027a('0x3c')]);_0x218e4f['query']=_[_0x027a('0x42')](_0x36bb99['query']);_0x218e4f[_0x027a('0x43')]=_[_0x027a('0x44')](_0x218e4f[_0x027a('0x40')],_0x218e4f[_0x027a('0x41')]);_0x39ffe1[_0x027a('0x45')]=_[_0x027a('0x44')](_0x218e4f['model'],qs[_0x027a('0x46')](_0x36bb99[_0x027a('0x41')][_0x027a('0x46')]));_0x39ffe1['attributes']=_0x39ffe1[_0x027a('0x45')][_0x027a('0x52')]?_0x39ffe1[_0x027a('0x45')]:_0x218e4f[_0x027a('0x40')];if(!_0x36bb99['query'][_0x027a('0x47')](_0x027a('0x48'))){_0x39ffe1[_0x027a('0x2d')]=qs[_0x027a('0x2d')](_0x36bb99[_0x027a('0x41')][_0x027a('0x2d')]);_0x39ffe1[_0x027a('0x2c')]=qs['offset'](_0x36bb99[_0x027a('0x41')][_0x027a('0x2c')]);}_0x39ffe1[_0x027a('0x6c')]=qs[_0x027a('0x49')](_0x36bb99[_0x027a('0x41')][_0x027a('0x49')]);_0x39ffe1['where']=qs['filters'](_[_0x027a('0x4b')](_0x36bb99[_0x027a('0x41')],_0x218e4f[_0x027a('0x43')]));_0x39ffe1['where'][_0x027a('0x61')]=_0x3a72c0['id'];if(_0x36bb99[_0x027a('0x41')][_0x027a('0x4c')]){_0x39ffe1[_0x027a('0x4a')]=_[_0x027a('0x4d')](_0x39ffe1[_0x027a('0x4a')],{'$or':_[_0x027a('0x3a')](_0x39ffe1[_0x027a('0x45')],function(_0x199ca4){var _0x4fe569={};_0x4fe569[_0x199ca4]={'$like':'%'+_0x36bb99['query'][_0x027a('0x4c')]+'%'};return _0x4fe569;})});}_0x39ffe1=_[_0x027a('0x4d')]({},_0x39ffe1,_0x36bb99[_0x027a('0x4f')]);return db[_0x027a('0x6a')][_0x027a('0x2b')]({'where':_0x39ffe1[_0x027a('0x4a')]})[_0x027a('0x20')](function(_0x2d7779){_0x502265['count']=_0x2d7779;if(_0x36bb99[_0x027a('0x41')][_0x027a('0x50')]){_0x39ffe1[_0x027a('0x51')]=[{'all':!![]}];}return db[_0x027a('0x6a')][_0x027a('0x65')](_0x39ffe1);})[_0x027a('0x20')](function(_0x44d445){_0x502265[_0x027a('0x66')]=_0x44d445;return _0x502265;});}})['then'](respondWithFilteredResult(_0x1f2f86,_0x39ffe1))[_0x027a('0x26')](handleError(_0x1f2f86,null));};exports[_0x027a('0x6d')]=function(_0x44097c,_0x252123,_0x4da23b){return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0x44097c[_0x027a('0x5e')]['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x252123,null))[_0x027a('0x20')](function(_0xee5a46){if(_0xee5a46){return _0xee5a46['removeAnswers'](_0x44097c[_0x027a('0x41')][_0x027a('0x68')]);}})[_0x027a('0x20')](respondWithStatusCode(_0x252123,null))['catch'](handleError(_0x252123,null));};exports[_0x027a('0x6e')]=function(_0x116478,_0x1b76b5,_0x12ad83){var _0x899c18={'body':_0x116478[_0x027a('0x55')],'channel':_0x027a('0x6f')};var _0x536b8f=[];var _0x502874=[];var _0x1cea2a={};var _0x13c07e=![];return db['CmContact'][_0x027a('0x5f')]()[_0x027a('0x20')](function(_0x22f13c){if(!_0x22f13c){throw new db['Sequelize'][(_0x027a('0x70'))]('no\x20available\x20attributes');}_0x536b8f=_[_0x027a('0x71')](_[_0x027a('0x42')](_0x22f13c),['createdAt',_0x027a('0x72')]);_0x502874=_['difference'](_['keys'](_0x22f13c),['createdAt',_0x027a('0x72'),_0x027a('0x73'),_0x027a('0x74')]);if(_0x116478[_0x027a('0x55')]['id']){delete _0x116478[_0x027a('0x55')]['id'];}if(_[_0x027a('0x75')](_0x116478[_0x027a('0x55')]['from'])){throw new db['Sequelize'][(_0x027a('0x70'))](_0x027a('0x76'));}if(_[_0x027a('0x75')](_0x116478[_0x027a('0x55')]['body'])||_0x116478[_0x027a('0x55')]['body']===''){throw new db[(_0x027a('0x77'))]['ValidationError'](_0x027a('0x78'));}if(_[_0x027a('0x75')](_0x116478[_0x027a('0x55')]['mapKey'])){throw new db[(_0x027a('0x77'))][(_0x027a('0x70'))](_0x027a('0x79')+_0x502874);}if(!_['includes'](_0x502874,_0x116478[_0x027a('0x55')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x502874);}_0x1cea2a[_0x116478[_0x027a('0x55')][_0x027a('0x7a')]]=_0x116478[_0x027a('0x55')]['from'];})[_0x027a('0x20')](function(){return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0x116478[_0x027a('0x5e')]['id']},'include':[{'model':db[_0x027a('0x7b')],'as':_0x027a('0x7c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1cea2a,'limit':0x1,'order':[[_0x027a('0x72'),_0x027a('0x7d')]]}]},{'model':db[_0x027a('0x7e')],'as':_0x027a('0x7f')}]});})[_0x027a('0x20')](handleEntityNotFound(_0x1b76b5,null))[_0x027a('0x20')](function(_0xba71da){if(_0xba71da&&_0xba71da['List']){_0x899c18[_0x027a('0x80')]=_0xba71da;_0x899c18[_0x027a('0x81')]=_0xba71da[_0x027a('0x7f')];_0x899c18['list']=_0xba71da[_0x027a('0x7c')];_0x899c18[_0x027a('0x81')]=_[_0x027a('0x82')](_0x899c18[_0x027a('0x81')],[_0x027a('0x83')],[_0x027a('0x84')]);if(_0x899c18[_0x027a('0x80')][_0x027a('0x7f')]){delete _0x899c18['account'][_0x027a('0x7f')];}if(_0x899c18[_0x027a('0x80')]['List']&&_0x899c18['account'][_0x027a('0x7c')][_0x027a('0x85')][_0x027a('0x52')]){return _0x899c18[_0x027a('0x80')][_0x027a('0x7c')][_0x027a('0x85')][0x0];}var _0x14207a=_[_0x027a('0x19')](_0x116478[_0x027a('0x55')],{'firstName':_0x116478['body'][_0x027a('0x86')],'ListId':_0xba71da[_0x027a('0x74')]});_0x14207a[_0x116478[_0x027a('0x55')][_0x027a('0x7a')]]=_0x116478['body'][_0x027a('0x86')];return db[_0x027a('0x87')][_0x027a('0x54')](_0x14207a,{'fields':_0x536b8f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1b76b5,null))[_0x027a('0x20')](function(_0x4fec7c){_0x899c18['contact']=_0x4fec7c;if(_0x4fec7c){var _0x1cc826={'ContactId':_0x4fec7c['id'],'OpenchannelAccountId':_0x116478[_0x027a('0x5e')]['id'],'from':(_0x4fec7c['firstName']||'')+'\x20'+(_0x4fec7c['lastName']||'')};var _0x43091c={'OpenchannelAccountId':_0x116478['params']['id'],'closed':![]};if(_0x116478['body'][_0x027a('0x88')]){_0x43091c[_0x027a('0x88')]=_0x116478[_0x027a('0x55')][_0x027a('0x88')];return db[_0x027a('0x89')][_0x027a('0x53')]({'where':_0x43091c})['then'](function(_0x108d76){if(_0x108d76){return[_0x108d76,![]];}_0x1cc826['threadId']=_0x116478[_0x027a('0x55')][_0x027a('0x88')];_0x1cc826[_0x027a('0x8a')]=_0x116478[_0x027a('0x55')][_0x027a('0x8a')];return db[_0x027a('0x89')][_0x027a('0x54')](_0x1cc826)[_0x027a('0x20')](function(_0x1311e0){return[_0x1311e0,!![]];});});}else{_0x43091c[_0x027a('0x88')]=null;}_0x43091c[_0x027a('0x8b')]=_0x4fec7c['id'];return db['OpenchannelInteraction'][_0x027a('0x53')]({'where':_0x43091c})['then'](function(_0x4764a3){if(_0x4764a3){return[_0x4764a3,![]];}return db[_0x027a('0x89')]['create'](_0x1cc826)[_0x027a('0x20')](function(_0x1958dc){return[_0x1958dc,!![]];});});}})[_0x027a('0x8c')](function(_0x128819,_0x492f0f){if(_0x128819){_0x13c07e=_0x492f0f;if(!_0x492f0f){var _0x47c5ab={'from':(_0x899c18[_0x027a('0x8d')]['firstName']||'')+'\x20'+(_0x899c18[_0x027a('0x8d')]['lastName']||'')};if(_0x116478[_0x027a('0x55')]['threadId']&&_0x116478[_0x027a('0x55')][_0x027a('0x8e')]&&_0x116478[_0x027a('0x55')]['threadId']!=_0x116478[_0x027a('0x55')][_0x027a('0x8e')]){_0x47c5ab['threadId']=_0x116478[_0x027a('0x55')][_0x027a('0x8e')];}return _0x128819[_0x027a('0x5d')](_0x47c5ab);}else{return _0x128819;}}})[_0x027a('0x20')](function(_0xe7c5ec){_0x899c18[_0x027a('0x8f')]=_0xe7c5ec[_0x027a('0x34')]({'plain':!![]});_0x899c18[_0x027a('0x8f')]['created']=_0x13c07e;if(_0x899c18['interaction']['created']){if(_0x899c18[_0x027a('0x80')]['autoclose']){_0x899c18[_0x027a('0x81')][_0x027a('0x90')]({'id':0x0,'priority':_0x899c18[_0x027a('0x81')][_0x027a('0x52')]+0x1,'app':_0x027a('0x91'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x027a('0x92')][_0x027a('0x54')]({'body':_0x116478[_0x027a('0x55')]['body'],'OpenchannelAccountId':_0x116478[_0x027a('0x5e')]['id'],'OpenchannelInteractionId':_0xe7c5ec['id'],'direction':'in','ContactId':_0x899c18[_0x027a('0x8d')]['id'],'AttachmentId':_0x116478['body']['AttachmentId']});})[_0x027a('0x20')](function(_0x15684e){_0x899c18['message']=_0x15684e;if(!_0x899c18[_0x027a('0x8f')][_0x027a('0x93')])return;return db[_0x027a('0x94')]['find']({'attributes':['id',_0x027a('0x37')],'where':{'id':_0x899c18[_0x027a('0x8f')][_0x027a('0x93')]}});})[_0x027a('0x20')](function(_0x3d232f){if(_0x3d232f){_0x899c18[_0x027a('0x81')][_0x027a('0x95')]({'id':0x0,'priority':0x0,'app':_0x027a('0x96'),'appdata':_0x3d232f['name']+','+(_0x899c18[_0x027a('0x80')][_0x027a('0x97')]||0xa),'interval':_0x027a('0x98')});}if(!_0x899c18[_0x027a('0x8f')][_0x027a('0x99')])return;return db[_0x027a('0x9a')][_0x027a('0x53')]({'attributes':['id',_0x027a('0x37')],'where':{'id':_0x899c18[_0x027a('0x8f')][_0x027a('0x99')]}});})[_0x027a('0x20')](function(_0x54e589){if(_0x54e589){_0x899c18[_0x027a('0x81')][_0x027a('0x95')]({'id':0x0,'priority':0x1,'app':_0x027a('0x9b'),'appdata':_0x54e589['name']+','+(_0x899c18[_0x027a('0x80')]['waitForTheAssignedQueue']||0x12c),'interval':_0x027a('0x98')});}return respondWithRpcPromise(_0x027a('0x9c'),'startRouting',_0x899c18);})[_0x027a('0x20')](function(_0x1a8a84){respondWithRpcPromise('EventManager',_0x027a('0x9d'),{'event':_0x027a('0x6e'),'message':_0x1a8a84},client9002);return _0x1a8a84;})[_0x027a('0x20')](respondWithResult(_0x1b76b5,null))[_0x027a('0x26')](handleError(_0x1b76b5,null));};exports['addApplications']=function(_0x1e89d3,_0x3f9c2){var _0x264556=_0x1e89d3[_0x027a('0x5e')]['id'];var _0x116144=_0x1e89d3['body'];var _0x155294=0xc8;var _0x5dc900=null;return db[_0x027a('0x9e')][_0x027a('0x9f')]({'isolationLevel':db['sequelize']['Transaction'][_0x027a('0xa0')][_0x027a('0xa1')]},function(_0x393ec6){return db[_0x027a('0x3b')][_0x027a('0x63')]({'where':{'id':_0x264556},'transaction':_0x393ec6})['then'](function(_0x3c58a3){if(_0x3c58a3){return db[_0x027a('0x7e')][_0x027a('0x33')]({'where':{'OpenchannelAccountId':_0x264556},'transaction':_0x393ec6})[_0x027a('0x20')](function(){var _0xee0d85=_[_0x027a('0x3a')](_0x116144,function(_0x33de20){_0x33de20[_0x027a('0x61')]=_0x264556;return _0x33de20;});return db['OpenchannelApplication']['bulkCreate'](_0xee0d85,{'transaction':_0x393ec6});});}else{_0x155294=0x194;_0x5dc900=[];}});})[_0x027a('0x20')](function(){if(_0x155294!==0x194){return db[_0x027a('0x7e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x264556},'order':_0x027a('0x83')})[_0x027a('0x20')](function(_0x4721e5){_0x5dc900=_0x4721e5;});}})[_0x027a('0x26')](function(_0x37d664){_0x155294=0x1f4;logger[_0x027a('0x23')](_0x37d664[_0x027a('0xa2')]);if(_0x37d664['name']){delete _0x37d664['name'];}_0x5dc900=_0x37d664;})[_0x027a('0xa3')](function(){if(_0x5dc900===null){_0x3f9c2[_0x027a('0x27')](_0x155294);}else{if(_0x155294===0x1f4){_0x3f9c2[_0x027a('0x28')](_0x155294)[_0x027a('0xa4')](_0x5dc900);}else{_0x3f9c2['status'](_0x155294)[_0x027a('0x29')](_0x5dc900);}}});};exports[_0x027a('0xa5')]=function(_0x4b1760,_0x4a83f7,_0x593c58){var _0x17b396={};var _0x3c388e={};var _0x23f46c;var _0x2da72b;return db[_0x027a('0x3b')][_0x027a('0x63')]({'where':{'id':_0x4b1760['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x4a83f7,null))[_0x027a('0x20')](function(_0x34594d){if(_0x34594d){_0x23f46c=_0x34594d;_0x3c388e[_0x027a('0x40')]=_[_0x027a('0x42')](db[_0x027a('0x7e')][_0x027a('0x3c')]);_0x3c388e[_0x027a('0x41')]=_[_0x027a('0x42')](_0x4b1760[_0x027a('0x41')]);_0x3c388e[_0x027a('0x43')]=_[_0x027a('0x44')](_0x3c388e['model'],_0x3c388e[_0x027a('0x41')]);_0x17b396['attributes']=_[_0x027a('0x44')](_0x3c388e[_0x027a('0x40')],qs[_0x027a('0x46')](_0x4b1760[_0x027a('0x41')][_0x027a('0x46')]));_0x17b396[_0x027a('0x45')]=_0x17b396[_0x027a('0x45')]['length']?_0x17b396[_0x027a('0x45')]:_0x3c388e[_0x027a('0x40')];_0x17b396['order']=qs[_0x027a('0x49')](_0x4b1760[_0x027a('0x41')]['sort']);_0x17b396[_0x027a('0x4a')]=qs[_0x027a('0x43')](_[_0x027a('0x4b')](_0x4b1760[_0x027a('0x41')],_0x3c388e[_0x027a('0x43')]));if(_0x4b1760[_0x027a('0x41')][_0x027a('0x4c')]){_0x17b396[_0x027a('0x4a')]=_[_0x027a('0x4d')](_0x17b396[_0x027a('0x4a')],{'$or':_['map'](_0x17b396[_0x027a('0x45')],function(_0x1a7aa0){var _0x24552b={};_0x24552b[_0x1a7aa0]={'$like':'%'+_0x4b1760['query'][_0x027a('0x4c')]+'%'};return _0x24552b;})});}_0x17b396=_[_0x027a('0x4d')]({},_0x17b396,_0x4b1760[_0x027a('0x4f')]);return _0x23f46c[_0x027a('0xa5')](_0x17b396);}})['then'](function(_0x44dea0){if(_0x44dea0){_0x2da72b=_0x44dea0[_0x027a('0x52')];if(!_0x4b1760[_0x027a('0x41')][_0x027a('0x47')](_0x027a('0x48'))){_0x17b396['limit']=qs[_0x027a('0x2d')](_0x4b1760[_0x027a('0x41')][_0x027a('0x2d')]);_0x17b396['offset']=qs[_0x027a('0x2c')](_0x4b1760[_0x027a('0x41')][_0x027a('0x2c')]);}return _0x23f46c[_0x027a('0xa5')](_0x17b396);}})[_0x027a('0x20')](function(_0x10092e){if(_0x10092e){return _0x10092e?{'count':_0x2da72b,'rows':_0x10092e}:null;}})[_0x027a('0x20')](respondWithResult(_0x4a83f7,null))['catch'](handleError(_0x4a83f7,null));};exports[_0x027a('0xa6')]=function(_0x4b8f5d,_0x2e73d6,_0x35f234){var _0x374116={'raw':![],'where':{}};var _0x4f22f6={};var _0x1bcc23={'count':0x0,'rows':[]};return db[_0x027a('0x3b')][_0x027a('0x63')]({'where':{'id':_0x4b8f5d['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x2e73d6,null))[_0x027a('0x20')](function(_0x1a7132){if(_0x1a7132){_0x4f22f6[_0x027a('0x40')]=_[_0x027a('0x42')](db[_0x027a('0x89')]['rawAttributes']);_0x4f22f6['query']=_[_0x027a('0x42')](_0x4b8f5d[_0x027a('0x41')]);_0x4f22f6[_0x027a('0x43')]=_['intersection'](_0x4f22f6['model'],_0x4f22f6['query']);_0x374116['attributes']=_[_0x027a('0x44')](_0x4f22f6[_0x027a('0x40')],qs['fields'](_0x4b8f5d['query'][_0x027a('0x46')]));_0x374116[_0x027a('0x45')]=_0x374116[_0x027a('0x45')][_0x027a('0x52')]?_0x374116[_0x027a('0x45')]:_0x4f22f6[_0x027a('0x40')];if(!_0x4b8f5d[_0x027a('0x41')][_0x027a('0x47')](_0x027a('0x48'))){_0x374116[_0x027a('0x2d')]=qs[_0x027a('0x2d')](_0x4b8f5d[_0x027a('0x41')]['limit']);_0x374116['offset']=qs[_0x027a('0x2c')](_0x4b8f5d[_0x027a('0x41')][_0x027a('0x2c')]);}_0x374116[_0x027a('0x6c')]=qs[_0x027a('0x49')](_0x4b8f5d[_0x027a('0x41')][_0x027a('0x49')]);_0x374116[_0x027a('0x4a')]=qs[_0x027a('0x43')](_['pick'](_0x4b8f5d[_0x027a('0x41')],_0x4f22f6[_0x027a('0x43')]));_0x374116[_0x027a('0x4a')][_0x027a('0x61')]=_0x1a7132['id'];if(_0x4b8f5d[_0x027a('0x41')][_0x027a('0x4c')]){_0x374116[_0x027a('0x4a')]=_[_0x027a('0x4d')](_0x374116[_0x027a('0x4a')],{'$or':_[_0x027a('0x3a')](_0x374116[_0x027a('0x45')],function(_0x41edda){var _0x42e3cd={};_0x42e3cd[_0x41edda]={'$like':'%'+_0x4b8f5d['query'][_0x027a('0x4c')]+'%'};return _0x42e3cd;})});}_0x374116=_['merge']({},_0x374116,_0x4b8f5d['options']);return db[_0x027a('0x89')][_0x027a('0x2b')]({'where':_0x374116[_0x027a('0x4a')]})['then'](function(_0x99dc68){_0x1bcc23[_0x027a('0x2b')]=_0x99dc68;if(_0x4b8f5d['query'][_0x027a('0x50')]){_0x374116['include']=[{'model':db['CmContact'],'as':_0x027a('0xa7'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x027a('0x37'),_0x027a('0xa8'),_0x027a('0xa9')],'required':![]},{'model':db['Tag'],'as':_0x027a('0xaa'),'attributes':['id',_0x027a('0x37'),_0x027a('0xab')],'where':_0x4b8f5d[_0x027a('0x41')][_0x027a('0xac')]?{'id':_0x4b8f5d['query'][_0x027a('0xac')]}:undefined,'required':_0x4b8f5d[_0x027a('0x41')][_0x027a('0xac')]?!![]:![]}];}return db[_0x027a('0x89')][_0x027a('0x65')](_0x374116);})[_0x027a('0x20')](function(_0x537ec5){_0x1bcc23['rows']=_0x537ec5;return _0x1bcc23;});}})[_0x027a('0x20')](respondWithFilteredResult(_0x2e73d6,_0x374116))[_0x027a('0x26')](handleError(_0x2e73d6,null));};exports[_0x027a('0xad')]=function(_0x54fec0,_0xe2d24a,_0x27daa7){return db[_0x027a('0x3b')]['find']({'where':{'id':_0x54fec0[_0x027a('0x5e')]['id']}})[_0x027a('0x20')](handleEntityNotFound(_0xe2d24a,null))[_0x027a('0x20')](function(_0x40b8e4){if(_0x40b8e4){return _0x40b8e4[_0x027a('0xad')](_0x54fec0[_0x027a('0x55')][_0x027a('0x68')],_[_0x027a('0xae')](_0x54fec0[_0x027a('0x55')],['ids','id'])||{})[_0x027a('0x8c')](function(_0x5db4a6){for(var _0x2b4fb6=0x0;_0x2b4fb6<_0x54fec0[_0x027a('0x55')][_0x027a('0x68')]['length'];_0x2b4fb6+=0x1){socket['emit'](_0x027a('0xaf'),{'UserId':Number(_0x54fec0[_0x027a('0x55')][_0x027a('0x68')][_0x2b4fb6]),'OpenchannelAccountId':Number(_0x54fec0['params']['id'])});}return _0x5db4a6;});}})[_0x027a('0x20')](respondWithResult(_0xe2d24a,null))['catch'](handleError(_0xe2d24a,null));};exports[_0x027a('0xb0')]=function(_0x385327,_0x48f205,_0x4d84df){return db['OpenchannelAccount'][_0x027a('0x53')]({'where':{'id':_0x385327['params']['id']}})['then'](handleEntityNotFound(_0x48f205,null))[_0x027a('0x20')](function(_0x511be1){if(_0x511be1){return _0x511be1['removeAgents'](_0x385327[_0x027a('0x41')][_0x027a('0x68')])[_0x027a('0x20')](function(){if(_[_0x027a('0xb1')](_0x385327[_0x027a('0x41')][_0x027a('0x68')])){for(var _0x5cf88c=0x0;_0x5cf88c<_0x385327[_0x027a('0x41')][_0x027a('0x68')][_0x027a('0x52')];_0x5cf88c+=0x1){socket[_0x027a('0xb2')](_0x027a('0xb3'),{'UserId':Number(_0x385327['query'][_0x027a('0x68')][_0x5cf88c]),'OpenchannelAccountId':Number(_0x385327[_0x027a('0x5e')]['id'])});}}else{socket[_0x027a('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x385327['query'][_0x027a('0x68')]),'OpenchannelAccountId':Number(_0x385327[_0x027a('0x5e')]['id'])});}});}})[_0x027a('0x20')](respondWithStatusCode(_0x48f205,null))[_0x027a('0x26')](handleError(_0x48f205,null));};exports['getAgents']=function(_0x4629e5,_0x301a3c,_0x57b387){var _0x2af719={};var _0x188d0a={};var _0x21dd86;var _0x58a136;return db[_0x027a('0x3b')][_0x027a('0x63')]({'where':{'id':_0x4629e5['params']['id']}})['then'](handleEntityNotFound(_0x301a3c,null))[_0x027a('0x20')](function(_0x50fff6){if(_0x50fff6){_0x21dd86=_0x50fff6;_0x188d0a[_0x027a('0x40')]=_[_0x027a('0x42')](db[_0x027a('0x94')][_0x027a('0x3c')]);_0x188d0a[_0x027a('0x41')]=_['keys'](_0x4629e5[_0x027a('0x41')]);_0x188d0a[_0x027a('0x43')]=_['intersection'](_0x188d0a[_0x027a('0x40')],_0x188d0a[_0x027a('0x41')]);_0x2af719[_0x027a('0x45')]=_['intersection'](_0x188d0a[_0x027a('0x40')],qs[_0x027a('0x46')](_0x4629e5[_0x027a('0x41')][_0x027a('0x46')]));_0x2af719[_0x027a('0x45')]=_0x2af719[_0x027a('0x45')][_0x027a('0x52')]?_0x2af719[_0x027a('0x45')]:_0x188d0a[_0x027a('0x40')];_0x2af719[_0x027a('0x6c')]=qs[_0x027a('0x49')](_0x4629e5['query']['sort']);_0x2af719[_0x027a('0x4a')]=qs[_0x027a('0x43')](_[_0x027a('0x4b')](_0x4629e5[_0x027a('0x41')],_0x188d0a[_0x027a('0x43')]));if(_0x4629e5[_0x027a('0x41')]['filter']){_0x2af719['where']=_[_0x027a('0x4d')](_0x2af719['where'],{'$or':_[_0x027a('0x3a')](_0x2af719[_0x027a('0x45')],function(_0x26e0b4){var _0x3dda8f={};_0x3dda8f[_0x26e0b4]={'$like':'%'+_0x4629e5[_0x027a('0x41')]['filter']+'%'};return _0x3dda8f;})});}_0x2af719=_[_0x027a('0x4d')]({},_0x2af719,_0x4629e5[_0x027a('0x4f')]);return _0x21dd86[_0x027a('0xb4')](_0x2af719);}})[_0x027a('0x20')](function(_0x55c1f2){if(_0x55c1f2){_0x58a136=_0x55c1f2[_0x027a('0x52')];if(!_0x4629e5['query'][_0x027a('0x47')]('nolimit')){_0x2af719[_0x027a('0x2d')]=qs[_0x027a('0x2d')](_0x4629e5[_0x027a('0x41')][_0x027a('0x2d')]);_0x2af719[_0x027a('0x2c')]=qs['offset'](_0x4629e5['query']['offset']);}return _0x21dd86[_0x027a('0xb4')](_0x2af719);}})[_0x027a('0x20')](function(_0x2cd650){if(_0x2cd650){return _0x2cd650?{'count':_0x58a136,'rows':_0x2cd650}:null;}})[_0x027a('0x20')](respondWithResult(_0x301a3c,null))[_0x027a('0x26')](handleError(_0x301a3c,null));};exports[_0x027a('0xa4')]=function(_0x479a16,_0x52a3dd,_0x45dcfb){var _0x5a684d,_0x272fba,_0x513e6f;if(_[_0x027a('0x75')](_0x479a16['body'][_0x027a('0x55')])||_0x479a16[_0x027a('0x55')]['body']===''){throw new db[(_0x027a('0x77'))]['ValidationError'](_0x027a('0x78'));}if(_[_0x027a('0x75')](_0x479a16[_0x027a('0x55')]['to'])){}_0x5a684d=_0x479a16['body']['to'];return db['OpenchannelAccount'][_0x027a('0x63')]({'where':{'id':_0x479a16['params']['id']}})[_0x027a('0x20')](handleEntityNotFound(_0x52a3dd,null))[_0x027a('0x20')](function(_0x32d0de){if(_0x32d0de){return db[_0x027a('0x3b')][_0x027a('0x53')]({'where':{'id':_0x32d0de['id']},'include':[{'model':db[_0x027a('0x7b')],'as':_0x027a('0x7c'),'include':[{'model':db[_0x027a('0x87')],'as':_0x027a('0x85'),'where':{[_0x32d0de['mapKey']]:_0x5a684d},'limit':0x1,'order':[[_0x027a('0x72'),_0x027a('0x7d')]]}]}]})[_0x027a('0x20')](handleEntityNotFound(_0x52a3dd,null))[_0x027a('0x20')](function(_0x216478){if(_0x216478&&_0x216478[_0x027a('0x7c')]){_0x272fba=_0x216478[_0x027a('0x34')]({'plain':!![]});if(_0x272fba[_0x027a('0x7c')]&&_0x272fba[_0x027a('0x7c')][_0x027a('0x85')]['length']){return _0x272fba[_0x027a('0x7c')][_0x027a('0x85')][0x0];}return db[_0x027a('0x87')]['create'](_['defaults'](_0x479a16[_0x027a('0x55')],{'firstName':_0x5a684d,[_0x216478[_0x027a('0x7a')]]:_0x5a684d,'phone':_0x5a684d,'ListId':_0x272fba[_0x027a('0x74')]}));}})['then'](handleEntityNotFound(_0x52a3dd,null))[_0x027a('0x20')](function(_0x17fd16){if(_0x17fd16){_0x513e6f=_0x17fd16;return db[_0x027a('0x89')][_0x027a('0x53')]({'where':{'ContactId':_0x513e6f['id'],'closed':![],'OpenchannelAccountId':_0x272fba['id']}})[_0x027a('0x20')](function(_0x3e38a0){if(_0x3e38a0){return[_0x3e38a0,![]];}return db[_0x027a('0x89')][_0x027a('0x54')]({'UserId':_0x479a16[_0x027a('0x56')]['id'],'ContactId':_0x513e6f['id'],'OpenchannelAccountId':_0x272fba['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x027a('0x4d')](_0x479a16[_0x027a('0x55')],{'read':![],'body':_0x479a16['body'][_0x027a('0x55')],'OpenchannelAccountId':_0x272fba['id'],'UserId':_0x479a16[_0x027a('0x56')]['id'],'ContactId':_0x513e6f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x027a('0xb5')}]})[_0x027a('0x20')](function(_0x35f27d){return[_0x35f27d,!![]];});});}})[_0x027a('0x8c')](function(_0x5e70d0,_0x1444a9){if(_0x1444a9){return _0x5e70d0;}return db[_0x027a('0x92')][_0x027a('0x54')](_[_0x027a('0x4d')](_0x479a16[_0x027a('0x55')],{'read':![],'body':_0x479a16[_0x027a('0x55')][_0x027a('0x55')],'OpenchannelAccountId':_0x272fba['id'],'OpenchannelInteractionId':_0x5e70d0['id'],'UserId':_0x479a16[_0x027a('0x56')]['id'],'ContactId':_0x513e6f['id']}))[_0x027a('0x20')](function(_0x51484b){_0x5e70d0[_0x027a('0xb6')][_0x027a('0xb5')]=[];_0x5e70d0[_0x027a('0xb6')][_0x027a('0xb5')][_0x027a('0x90')](_0x51484b[_0x027a('0xb6')]);return _0x5e70d0;});});}})[_0x027a('0x20')](respondWithResult(_0x52a3dd,null))[_0x027a('0x26')](handleError(_0x52a3dd,null));}; \ No newline at end of file +var _0x3cdc=['fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','./openchannelAccount.socket','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','hasOwnProperty','pick','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','defaults','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Owner'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x286d68,_0x407512){_0x286d68=_0x286d68-0x0;var _0x30b8b5=_0x3cdc[_0x286d68];return _0x30b8b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3cd('0x0'));var zipdir=require(_0xc3cd('0x1'));var jsonpatch=require(_0xc3cd('0x2'));var rp=require(_0xc3cd('0x3'));var moment=require(_0xc3cd('0x4'));var BPromise=require(_0xc3cd('0x5'));var Mustache=require(_0xc3cd('0x6'));var util=require(_0xc3cd('0x7'));var path=require(_0xc3cd('0x8'));var sox=require(_0xc3cd('0x9'));var csv=require(_0xc3cd('0xa'));var ejs=require(_0xc3cd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3cd('0xc'));var squel=require(_0xc3cd('0xd'));var crypto=require(_0xc3cd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3cd('0xf'));var Redis=require('ioredis');var authService=require(_0xc3cd('0x10'));var qs=require(_0xc3cd('0x11'));var as=require(_0xc3cd('0x12'));var hardwareService=require(_0xc3cd('0x13'));var logger=require('../../config/logger')(_0xc3cd('0x14'));var utils=require(_0xc3cd('0x15'));var config=require(_0xc3cd('0x16'));var licenseUtil=require(_0xc3cd('0x17'));var db=require('../../mysqldb')['db'];config[_0xc3cd('0x18')]=_['defaults'](config[_0xc3cd('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc3cd('0x19'))[_0xc3cd('0x1a')](socket);var jayson=require(_0xc3cd('0x1b'));var client=jayson[_0xc3cd('0x1c')][_0xc3cd('0x1d')]({'port':0x232c});var client9002=jayson[_0xc3cd('0x1c')][_0xc3cd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3d40b7,_0xb11b8f,_0x233393,_0x2cb5be){return new BPromise(function(_0x2b944d,_0x1595be){var _0x5712ea=_0x2cb5be||client;return _0x5712ea['request'](_0x3d40b7,_0x233393)[_0xc3cd('0x1e')](function(_0x17a765){logger['info'](_0xc3cd('0x1f'),_0xb11b8f,'request\x20sent');logger[_0xc3cd('0x20')](_0xc3cd('0x21'),_0xb11b8f,_0xc3cd('0x22'),JSON[_0xc3cd('0x23')](_0x17a765));if(_0x17a765[_0xc3cd('0x24')]){if(_0x17a765[_0xc3cd('0x24')][_0xc3cd('0x25')]===0x1f4){logger[_0xc3cd('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xb11b8f,_0x17a765[_0xc3cd('0x24')][_0xc3cd('0x26')]);return _0x1595be(_0x17a765[_0xc3cd('0x24')][_0xc3cd('0x26')]);}logger[_0xc3cd('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xb11b8f,_0x17a765[_0xc3cd('0x24')]['message']);return _0x2b944d(_0x17a765['error'][_0xc3cd('0x26')]);}else{logger['info'](_0xc3cd('0x1f'),_0xb11b8f,_0xc3cd('0x22'));_0x2b944d(_0x17a765[_0xc3cd('0x27')][_0xc3cd('0x26')]);}})['catch'](function(_0x309b9f){logger[_0xc3cd('0x24')](_0xc3cd('0x1f'),_0xb11b8f,_0x309b9f);_0x1595be(_0x309b9f);});});}function respondWithStatusCode(_0x58c003,_0x3f02e3){_0x3f02e3=_0x3f02e3||0xcc;return function(_0x212ead){if(_0x212ead){return _0x58c003[_0xc3cd('0x28')](_0x3f02e3);}return _0x58c003[_0xc3cd('0x29')](_0x3f02e3)['end']();};}function respondWithResult(_0x377ee8,_0x475656){_0x475656=_0x475656||0xc8;return function(_0x3bb85d){if(_0x3bb85d){return _0x377ee8[_0xc3cd('0x29')](_0x475656)[_0xc3cd('0x2a')](_0x3bb85d);}};}function respondWithFilteredResult(_0x41995f,_0x1a112d){return function(_0x454e10){if(_0x454e10){var _0x21c6ce=typeof _0x1a112d[_0xc3cd('0x2b')]===_0xc3cd('0x2c')&&typeof _0x1a112d[_0xc3cd('0x2d')]===_0xc3cd('0x2c');var _0x5e4a76=_0x454e10[_0xc3cd('0x2e')];var _0x1ecaca=_0x21c6ce?0x0:_0x1a112d[_0xc3cd('0x2b')];var _0x14486f=_0x21c6ce?_0x454e10[_0xc3cd('0x2e')]:_0x1a112d[_0xc3cd('0x2b')]+_0x1a112d[_0xc3cd('0x2d')];var _0x23fea6;if(_0x14486f>=_0x5e4a76){_0x14486f=_0x5e4a76;_0x23fea6=0xc8;}else{_0x23fea6=0xce;}_0x41995f[_0xc3cd('0x29')](_0x23fea6);return _0x41995f[_0xc3cd('0x2f')](_0xc3cd('0x30'),_0x1ecaca+'-'+_0x14486f+'/'+_0x5e4a76)['json'](_0x454e10);}return null;};}function patchUpdates(_0x3e16e7){return function(_0x122f8e){try{jsonpatch['apply'](_0x122f8e,_0x3e16e7,!![]);}catch(_0x533d79){return BPromise[_0xc3cd('0x31')](_0x533d79);}return _0x122f8e['save']();};}function saveUpdates(_0x15c21d,_0x893e76){return function(_0xa34fc1){if(_0xa34fc1){return _0xa34fc1[_0xc3cd('0x32')](_0x15c21d)['then'](function(_0x3ffad1){return _0x3ffad1;});}return null;};}function removeEntity(_0x313373,_0x4ee62c){return function(_0x5f2496){if(_0x5f2496){return _0x5f2496[_0xc3cd('0x33')]()[_0xc3cd('0x1e')](function(){var _0x3cdd5a=_0x5f2496[_0xc3cd('0x34')]({'plain':!![]});var _0x5e9421=_0xc3cd('0x35');return db[_0xc3cd('0x36')][_0xc3cd('0x33')]({'where':{'type':_0x5e9421,'resourceId':_0x3cdd5a['id']}})[_0xc3cd('0x1e')](function(){return _0x5f2496;});})[_0xc3cd('0x1e')](function(){_0x313373[_0xc3cd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde6f15,_0x189f6b){return function(_0x30b1f5){if(!_0x30b1f5){_0xde6f15['sendStatus'](0x194);}return _0x30b1f5;};}function handleError(_0x100789,_0x75d735){_0x75d735=_0x75d735||0x1f4;return function(_0x2f9fd5){logger[_0xc3cd('0x24')](_0x2f9fd5[_0xc3cd('0x37')]);if(_0x2f9fd5[_0xc3cd('0x38')]){delete _0x2f9fd5[_0xc3cd('0x38')];}_0x100789[_0xc3cd('0x29')](_0x75d735)[_0xc3cd('0x39')](_0x2f9fd5);};}exports['index']=function(_0x10d200,_0x32fc1c){var _0x21a057={'include':[{'model':db[_0xc3cd('0x3a')],'as':_0xc3cd('0x3b')}]},_0x1fa8bd={},_0x5761df={'count':0x0,'rows':[]};var _0x7e41a8=_[_0xc3cd('0x3c')](db[_0xc3cd('0x3d')][_0xc3cd('0x3e')],function(_0x3f325c){return{'name':_0x3f325c['fieldName'],'type':_0x3f325c[_0xc3cd('0x3f')][_0xc3cd('0x40')]};});_0x1fa8bd[_0xc3cd('0x41')]=_[_0xc3cd('0x3c')](_0x7e41a8,_0xc3cd('0x38'));_0x1fa8bd[_0xc3cd('0x42')]=_['keys'](_0x10d200[_0xc3cd('0x42')]);_0x1fa8bd[_0xc3cd('0x43')]=_[_0xc3cd('0x44')](_0x1fa8bd[_0xc3cd('0x41')],_0x1fa8bd[_0xc3cd('0x42')]);_0x21a057[_0xc3cd('0x45')]=_[_0xc3cd('0x44')](_0x1fa8bd[_0xc3cd('0x41')],qs[_0xc3cd('0x46')](_0x10d200['query'][_0xc3cd('0x46')]));_0x21a057[_0xc3cd('0x45')]=_0x21a057['attributes']['length']?_0x21a057['attributes']:_0x1fa8bd[_0xc3cd('0x41')];if(!_0x10d200['query']['hasOwnProperty']('nolimit')){_0x21a057[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x10d200[_0xc3cd('0x42')][_0xc3cd('0x2d')]);_0x21a057[_0xc3cd('0x2b')]=qs[_0xc3cd('0x2b')](_0x10d200[_0xc3cd('0x42')]['offset']);}_0x21a057[_0xc3cd('0x47')]=qs[_0xc3cd('0x48')](_0x10d200[_0xc3cd('0x42')][_0xc3cd('0x48')]);_0x21a057['where']=qs[_0xc3cd('0x43')](_['pick'](_0x10d200[_0xc3cd('0x42')],_0x1fa8bd['filters']),_0x7e41a8);if(_0x10d200[_0xc3cd('0x42')][_0xc3cd('0x49')]){_0x21a057['where']=_['merge'](_0x21a057[_0xc3cd('0x4a')],{'$or':_['map'](_0x7e41a8,function(_0x7685dd){if(_0x7685dd[_0xc3cd('0x3f')]!==_0xc3cd('0x4b')){var _0x1fa21e={};_0x1fa21e[_0x7685dd['name']]={'$like':'%'+_0x10d200['query'][_0xc3cd('0x49')]+'%'};return _0x1fa21e;}})});}_0x21a057=_[_0xc3cd('0x4c')]({},_0x21a057,_0x10d200[_0xc3cd('0x4d')]);var _0x5f1050={'where':_0x21a057[_0xc3cd('0x4a')]};return db[_0xc3cd('0x3d')][_0xc3cd('0x2e')](_0x5f1050)['then'](function(_0x19b650){_0x5761df[_0xc3cd('0x2e')]=_0x19b650;if(_0x10d200[_0xc3cd('0x42')]['includeAll']){_0x21a057[_0xc3cd('0x4e')]=[{'all':!![]}];}return db[_0xc3cd('0x3d')][_0xc3cd('0x4f')](_0x21a057);})[_0xc3cd('0x1e')](function(_0x370e6e){_0x5761df[_0xc3cd('0x50')]=_0x370e6e;return _0x5761df;})[_0xc3cd('0x1e')](respondWithFilteredResult(_0x32fc1c,_0x21a057))[_0xc3cd('0x51')](handleError(_0x32fc1c,null));};exports[_0xc3cd('0x52')]=function(_0x2055b7,_0x204eb1){var _0x6961fa={'raw':![],'where':{'id':_0x2055b7[_0xc3cd('0x53')]['id']},'include':[{'model':db[_0xc3cd('0x3a')],'as':'mandatoryDispositionPause'}]},_0x2afee8={};_0x2afee8[_0xc3cd('0x41')]=_[_0xc3cd('0x54')](db['OpenchannelAccount'][_0xc3cd('0x3e')]);_0x2afee8[_0xc3cd('0x42')]=_[_0xc3cd('0x54')](_0x2055b7['query']);_0x2afee8[_0xc3cd('0x43')]=_[_0xc3cd('0x44')](_0x2afee8['model'],_0x2afee8[_0xc3cd('0x42')]);_0x6961fa[_0xc3cd('0x45')]=_[_0xc3cd('0x44')](_0x2afee8[_0xc3cd('0x41')],qs[_0xc3cd('0x46')](_0x2055b7[_0xc3cd('0x42')]['fields']));_0x6961fa[_0xc3cd('0x45')]=_0x6961fa[_0xc3cd('0x45')][_0xc3cd('0x55')]?_0x6961fa[_0xc3cd('0x45')]:_0x2afee8[_0xc3cd('0x41')];if(_0x2055b7['query'][_0xc3cd('0x56')]){_0x6961fa[_0xc3cd('0x4e')]=[{'all':!![]}];}_0x6961fa=_[_0xc3cd('0x4c')]({},_0x6961fa,_0x2055b7[_0xc3cd('0x4d')]);return db[_0xc3cd('0x3d')][_0xc3cd('0x57')](_0x6961fa)[_0xc3cd('0x1e')](handleEntityNotFound(_0x204eb1,null))['then'](respondWithResult(_0x204eb1,null))[_0xc3cd('0x51')](handleError(_0x204eb1,null));};exports[_0xc3cd('0x58')]=function(_0x4d69e9,_0x2a6bee){return db['OpenchannelAccount'][_0xc3cd('0x58')](_0x4d69e9[_0xc3cd('0x59')],{})[_0xc3cd('0x1e')](function(_0x33839c){var _0x42008a=_0x4d69e9[_0xc3cd('0x5a')][_0xc3cd('0x34')]({'plain':!![]});if(!_0x42008a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42008a[_0xc3cd('0x5b')]===_0xc3cd('0x5a')){var _0x4b13f2=_0x33839c[_0xc3cd('0x34')]({'plain':!![]});var _0x1b64c9=_0xc3cd('0x35');return db[_0xc3cd('0x5c')][_0xc3cd('0x57')]({'where':{'name':_0x1b64c9,'userProfileId':_0x42008a[_0xc3cd('0x5d')]},'raw':!![]})[_0xc3cd('0x1e')](function(_0x4cd38f){if(_0x4cd38f&&_0x4cd38f[_0xc3cd('0x5e')]===0x0){return db['UserProfileResource'][_0xc3cd('0x58')]({'name':_0x4b13f2['name'],'resourceId':_0x4b13f2['id'],'type':_0x4cd38f['name'],'sectionId':_0x4cd38f['id']},{})[_0xc3cd('0x1e')](function(){return _0x33839c;});}else{return _0x33839c;}})[_0xc3cd('0x51')](function(_0x1450ed){logger['error'](_0xc3cd('0x5f'),_0x1450ed);throw _0x1450ed;});}return _0x33839c;})[_0xc3cd('0x1e')](respondWithResult(_0x2a6bee,0xc9))['catch'](handleError(_0x2a6bee,null));};exports['update']=function(_0x32ded0,_0xe9d55d){if(_0x32ded0[_0xc3cd('0x59')]['id']){delete _0x32ded0[_0xc3cd('0x59')]['id'];}return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x32ded0[_0xc3cd('0x53')]['id']},'include':[{'model':db[_0xc3cd('0x3a')],'as':'mandatoryDispositionPause'}]})[_0xc3cd('0x1e')](handleEntityNotFound(_0xe9d55d,null))[_0xc3cd('0x1e')](saveUpdates(_0x32ded0[_0xc3cd('0x59')],null))[_0xc3cd('0x1e')](respondWithResult(_0xe9d55d,null))['catch'](handleError(_0xe9d55d,null));};exports[_0xc3cd('0x33')]=function(_0x27a4b0,_0x11beff){return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x27a4b0[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x11beff,null))['then'](removeEntity(_0x11beff,null))[_0xc3cd('0x51')](handleError(_0x11beff,null));};exports[_0xc3cd('0x60')]=function(_0x1279c2,_0x477c60){return db[_0xc3cd('0x3d')]['describe']()[_0xc3cd('0x1e')](respondWithResult(_0x477c60,null))[_0xc3cd('0x51')](handleError(_0x477c60,null));};exports[_0xc3cd('0x61')]=function(_0x5013cf,_0x15a841,_0x57317a){if(_0x5013cf[_0xc3cd('0x59')]['id']){delete _0x5013cf['body']['id'];}return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x5013cf[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x15a841,null))['then'](function(_0x40f8c7){if(_0x40f8c7){_0x5013cf[_0xc3cd('0x59')][_0xc3cd('0x62')]=_0x40f8c7['id'];return db[_0xc3cd('0x63')][_0xc3cd('0x58')](_0x5013cf[_0xc3cd('0x59')]);}})[_0xc3cd('0x1e')](respondWithResult(_0x15a841,null))[_0xc3cd('0x51')](handleError(_0x15a841,null));};exports[_0xc3cd('0x64')]=function(_0x267aef,_0x19f359,_0x2e2462){var _0x1a8968={'raw':![],'where':{}};var _0x381ad1={};var _0x43b05d={'count':0x0,'rows':[]};return db[_0xc3cd('0x3d')][_0xc3cd('0x65')]({'where':{'id':_0x267aef['params']['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x19f359,null))[_0xc3cd('0x1e')](function(_0x4a4c6b){if(_0x4a4c6b){_0x381ad1[_0xc3cd('0x41')]=_['keys'](db['Disposition']['rawAttributes']);_0x381ad1[_0xc3cd('0x42')]=_[_0xc3cd('0x54')](_0x267aef['query']);_0x381ad1['filters']=_[_0xc3cd('0x44')](_0x381ad1[_0xc3cd('0x41')],_0x381ad1[_0xc3cd('0x42')]);_0x1a8968[_0xc3cd('0x45')]=_['intersection'](_0x381ad1[_0xc3cd('0x41')],qs['fields'](_0x267aef[_0xc3cd('0x42')][_0xc3cd('0x46')]));_0x1a8968[_0xc3cd('0x45')]=_0x1a8968[_0xc3cd('0x45')][_0xc3cd('0x55')]?_0x1a8968[_0xc3cd('0x45')]:_0x381ad1['model'];if(!_0x267aef['query']['hasOwnProperty'](_0xc3cd('0x66'))){_0x1a8968[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x267aef[_0xc3cd('0x42')]['limit']);_0x1a8968[_0xc3cd('0x2b')]=qs[_0xc3cd('0x2b')](_0x267aef['query'][_0xc3cd('0x2b')]);}_0x1a8968['order']=qs['sort'](_0x267aef['query']['sort']);_0x1a8968[_0xc3cd('0x4a')]=qs[_0xc3cd('0x43')](_['pick'](_0x267aef[_0xc3cd('0x42')],_0x381ad1[_0xc3cd('0x43')]));_0x1a8968['where']['OpenchannelAccountId']=_0x4a4c6b['id'];if(_0x267aef[_0xc3cd('0x42')][_0xc3cd('0x49')]){_0x1a8968['where']=_[_0xc3cd('0x4c')](_0x1a8968[_0xc3cd('0x4a')],{'$or':_[_0xc3cd('0x3c')](_0x1a8968[_0xc3cd('0x45')],function(_0x466964){var _0x3ef3bc={};_0x3ef3bc[_0x466964]={'$like':'%'+_0x267aef['query'][_0xc3cd('0x49')]+'%'};return _0x3ef3bc;})});}_0x1a8968=_[_0xc3cd('0x4c')]({},_0x1a8968,_0x267aef[_0xc3cd('0x4d')]);return db[_0xc3cd('0x63')][_0xc3cd('0x2e')]({'where':_0x1a8968[_0xc3cd('0x4a')]})[_0xc3cd('0x1e')](function(_0x563505){_0x43b05d[_0xc3cd('0x2e')]=_0x563505;if(_0x267aef[_0xc3cd('0x42')]['includeAll']){_0x1a8968[_0xc3cd('0x4e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1a8968);})[_0xc3cd('0x1e')](function(_0x468963){_0x43b05d['rows']=_0x468963;return _0x43b05d;});}})[_0xc3cd('0x1e')](respondWithFilteredResult(_0x19f359,_0x1a8968))[_0xc3cd('0x51')](handleError(_0x19f359,null));};exports[_0xc3cd('0x67')]=function(_0x4c76eb,_0x4deaa2,_0x1f0338){return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x4c76eb['params']['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x4deaa2,null))['then'](function(_0x48fbec){if(_0x48fbec){return _0x48fbec['removeDispositions'](_0x4c76eb[_0xc3cd('0x42')]['ids']);}})[_0xc3cd('0x1e')](respondWithStatusCode(_0x4deaa2,null))[_0xc3cd('0x51')](handleError(_0x4deaa2,null));};exports['addAnswer']=function(_0x29de7c,_0x4676b3,_0xbe71c6){if(_0x29de7c['body']['id']){delete _0x29de7c[_0xc3cd('0x59')]['id'];}return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x29de7c[_0xc3cd('0x53')]['id']}})['then'](handleEntityNotFound(_0x4676b3,null))[_0xc3cd('0x1e')](function(_0x1f846a){if(_0x1f846a){_0x29de7c[_0xc3cd('0x59')][_0xc3cd('0x62')]=_0x1f846a['id'];return db[_0xc3cd('0x68')][_0xc3cd('0x58')](_0x29de7c['body']);}})[_0xc3cd('0x1e')](respondWithResult(_0x4676b3,null))[_0xc3cd('0x51')](handleError(_0x4676b3,null));};exports['getAnswers']=function(_0x28b617,_0x14e790,_0x326cae){var _0x266d13={'raw':![],'where':{}};var _0x3a4c50={};var _0x494785={'count':0x0,'rows':[]};return db[_0xc3cd('0x3d')]['findOne']({'where':{'id':_0x28b617[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x14e790,null))['then'](function(_0x6a0710){if(_0x6a0710){_0x3a4c50[_0xc3cd('0x41')]=_[_0xc3cd('0x54')](db[_0xc3cd('0x68')][_0xc3cd('0x3e')]);_0x3a4c50[_0xc3cd('0x42')]=_[_0xc3cd('0x54')](_0x28b617[_0xc3cd('0x42')]);_0x3a4c50[_0xc3cd('0x43')]=_['intersection'](_0x3a4c50[_0xc3cd('0x41')],_0x3a4c50[_0xc3cd('0x42')]);_0x266d13[_0xc3cd('0x45')]=_['intersection'](_0x3a4c50[_0xc3cd('0x41')],qs['fields'](_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x46')]));_0x266d13[_0xc3cd('0x45')]=_0x266d13[_0xc3cd('0x45')][_0xc3cd('0x55')]?_0x266d13[_0xc3cd('0x45')]:_0x3a4c50[_0xc3cd('0x41')];if(!_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x69')]('nolimit')){_0x266d13[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x28b617['query'][_0xc3cd('0x2d')]);_0x266d13['offset']=qs[_0xc3cd('0x2b')](_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x2b')]);}_0x266d13[_0xc3cd('0x47')]=qs['sort'](_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x48')]);_0x266d13[_0xc3cd('0x4a')]=qs[_0xc3cd('0x43')](_[_0xc3cd('0x6a')](_0x28b617[_0xc3cd('0x42')],_0x3a4c50[_0xc3cd('0x43')]));_0x266d13[_0xc3cd('0x4a')][_0xc3cd('0x62')]=_0x6a0710['id'];if(_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x49')]){_0x266d13[_0xc3cd('0x4a')]=_[_0xc3cd('0x4c')](_0x266d13[_0xc3cd('0x4a')],{'$or':_[_0xc3cd('0x3c')](_0x266d13['attributes'],function(_0x503147){var _0x1710aa={};_0x1710aa[_0x503147]={'$like':'%'+_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x49')]+'%'};return _0x1710aa;})});}_0x266d13=_['merge']({},_0x266d13,_0x28b617[_0xc3cd('0x4d')]);return db[_0xc3cd('0x68')][_0xc3cd('0x2e')]({'where':_0x266d13[_0xc3cd('0x4a')]})[_0xc3cd('0x1e')](function(_0x5c3a55){_0x494785[_0xc3cd('0x2e')]=_0x5c3a55;if(_0x28b617[_0xc3cd('0x42')][_0xc3cd('0x56')]){_0x266d13[_0xc3cd('0x4e')]=[{'all':!![]}];}return db[_0xc3cd('0x68')][_0xc3cd('0x4f')](_0x266d13);})['then'](function(_0x25572c){_0x494785['rows']=_0x25572c;return _0x494785;});}})[_0xc3cd('0x1e')](respondWithFilteredResult(_0x14e790,_0x266d13))[_0xc3cd('0x51')](handleError(_0x14e790,null));};exports[_0xc3cd('0x6b')]=function(_0x4b4288,_0x307c39,_0x2ea123){return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x4b4288[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x307c39,null))[_0xc3cd('0x1e')](function(_0x2b08a0){if(_0x2b08a0){return _0x2b08a0[_0xc3cd('0x6b')](_0x4b4288[_0xc3cd('0x42')][_0xc3cd('0x6c')]);}})[_0xc3cd('0x1e')](respondWithStatusCode(_0x307c39,null))['catch'](handleError(_0x307c39,null));};exports[_0xc3cd('0x6d')]=function(_0x119552,_0x38323c,_0x10b13b){var _0x3cbc80={'body':_0x119552['body'],'channel':_0xc3cd('0x6e')};var _0x478355=[];var _0x3c1f40=[];var _0x1da8d1={};var _0x4bee15=![];return db['CmContact'][_0xc3cd('0x60')]()[_0xc3cd('0x1e')](function(_0x2eab07){if(!_0x2eab07){throw new db[(_0xc3cd('0x6f'))][(_0xc3cd('0x70'))](_0xc3cd('0x71'));}_0x478355=_[_0xc3cd('0x72')](_['keys'](_0x2eab07),[_0xc3cd('0x73'),_0xc3cd('0x74')]);_0x3c1f40=_['difference'](_[_0xc3cd('0x54')](_0x2eab07),[_0xc3cd('0x73'),_0xc3cd('0x74'),_0xc3cd('0x75'),'ListId']);if(_0x119552[_0xc3cd('0x59')]['id']){delete _0x119552['body']['id'];}if(_[_0xc3cd('0x76')](_0x119552['body'][_0xc3cd('0x77')])){throw new db[(_0xc3cd('0x6f'))]['ValidationError'](_0xc3cd('0x78'));}if(_[_0xc3cd('0x76')](_0x119552[_0xc3cd('0x59')][_0xc3cd('0x59')])||_0x119552[_0xc3cd('0x59')][_0xc3cd('0x59')]===''){throw new db[(_0xc3cd('0x6f'))][(_0xc3cd('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc3cd('0x76')](_0x119552[_0xc3cd('0x59')][_0xc3cd('0x79')])){throw new db['Sequelize'][(_0xc3cd('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c1f40);}if(!_[_0xc3cd('0x7a')](_0x3c1f40,_0x119552['body'][_0xc3cd('0x79')])){throw new db['Sequelize'][(_0xc3cd('0x70'))](_0xc3cd('0x7b')+_0x3c1f40);}_0x1da8d1[_0x119552[_0xc3cd('0x59')]['mapKey']]=_0x119552[_0xc3cd('0x59')]['from'];})[_0xc3cd('0x1e')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x119552['params']['id']},'include':[{'model':db[_0xc3cd('0x7c')],'as':_0xc3cd('0x7d'),'include':[{'model':db[_0xc3cd('0x7e')],'as':_0xc3cd('0x7f'),'where':_0x1da8d1,'limit':0x1,'order':[[_0xc3cd('0x74'),'DESC']]}]},{'model':db[_0xc3cd('0x80')],'as':_0xc3cd('0x81')}]});})['then'](handleEntityNotFound(_0x38323c,null))[_0xc3cd('0x1e')](function(_0x164d57){if(_0x164d57&&_0x164d57[_0xc3cd('0x7d')]){_0x3cbc80['account']=_0x164d57;_0x3cbc80['applications']=_0x164d57['Applications'];_0x3cbc80['list']=_0x164d57[_0xc3cd('0x7d')];_0x3cbc80[_0xc3cd('0x82')]=_[_0xc3cd('0x83')](_0x3cbc80[_0xc3cd('0x82')],[_0xc3cd('0x84')],[_0xc3cd('0x85')]);if(_0x3cbc80[_0xc3cd('0x86')][_0xc3cd('0x81')]){delete _0x3cbc80[_0xc3cd('0x86')]['Applications'];}if(_0x3cbc80[_0xc3cd('0x86')]['List']&&_0x3cbc80['account'][_0xc3cd('0x7d')][_0xc3cd('0x7f')][_0xc3cd('0x55')]){return _0x3cbc80['account'][_0xc3cd('0x7d')][_0xc3cd('0x7f')][0x0];}var _0x18af74=_[_0xc3cd('0x87')](_0x119552[_0xc3cd('0x59')],{'firstName':_0x119552[_0xc3cd('0x59')]['from'],'ListId':_0x164d57[_0xc3cd('0x88')]});_0x18af74[_0x119552[_0xc3cd('0x59')][_0xc3cd('0x79')]]=_0x119552[_0xc3cd('0x59')][_0xc3cd('0x77')];return db[_0xc3cd('0x7e')][_0xc3cd('0x58')](_0x18af74,{'fields':_0x478355,'raw':!![]});}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x38323c,null))[_0xc3cd('0x1e')](function(_0x3d3c29){_0x3cbc80[_0xc3cd('0x89')]=_0x3d3c29;if(_0x3d3c29){var _0x4e1e95={'ContactId':_0x3d3c29['id'],'OpenchannelAccountId':_0x119552[_0xc3cd('0x53')]['id'],'from':(_0x3d3c29['firstName']||'')+'\x20'+(_0x3d3c29[_0xc3cd('0x8a')]||'')};var _0x3be29e={'OpenchannelAccountId':_0x119552['params']['id'],'closed':![]};if(_0x119552['body'][_0xc3cd('0x8b')]){_0x3be29e['threadId']=_0x119552[_0xc3cd('0x59')][_0xc3cd('0x8b')];return db[_0xc3cd('0x8c')][_0xc3cd('0x57')]({'where':_0x3be29e})[_0xc3cd('0x1e')](function(_0x471c22){if(_0x471c22){return[_0x471c22,![]];}_0x4e1e95[_0xc3cd('0x8b')]=_0x119552[_0xc3cd('0x59')]['threadId'];_0x4e1e95[_0xc3cd('0x8d')]=_0x119552[_0xc3cd('0x59')][_0xc3cd('0x8d')];return db[_0xc3cd('0x8c')][_0xc3cd('0x58')](_0x4e1e95)['then'](function(_0x367103){return[_0x367103,!![]];});});}else{_0x3be29e[_0xc3cd('0x8b')]=null;}_0x3be29e[_0xc3cd('0x8e')]=_0x3d3c29['id'];return db['OpenchannelInteraction']['find']({'where':_0x3be29e})[_0xc3cd('0x1e')](function(_0xe23927){if(_0xe23927){return[_0xe23927,![]];}return db['OpenchannelInteraction'][_0xc3cd('0x58')](_0x4e1e95)[_0xc3cd('0x1e')](function(_0x37f266){return[_0x37f266,!![]];});});}})[_0xc3cd('0x8f')](function(_0x376220,_0x4453af){if(_0x376220){_0x4bee15=_0x4453af;if(!_0x4453af){var _0xfae174={'from':(_0x3cbc80[_0xc3cd('0x89')]['firstName']||'')+'\x20'+(_0x3cbc80[_0xc3cd('0x89')][_0xc3cd('0x8a')]||'')};if(_0x119552[_0xc3cd('0x59')][_0xc3cd('0x8b')]&&_0x119552[_0xc3cd('0x59')][_0xc3cd('0x90')]&&_0x119552['body'][_0xc3cd('0x8b')]!=_0x119552['body']['messageId']){_0xfae174['threadId']=_0x119552[_0xc3cd('0x59')][_0xc3cd('0x90')];}return _0x376220[_0xc3cd('0x32')](_0xfae174);}else{return _0x376220;}}})[_0xc3cd('0x1e')](function(_0x1cd298){_0x3cbc80[_0xc3cd('0x91')]=_0x1cd298[_0xc3cd('0x34')]({'plain':!![]});_0x3cbc80[_0xc3cd('0x91')][_0xc3cd('0x92')]=_0x4bee15;if(_0x3cbc80[_0xc3cd('0x91')][_0xc3cd('0x92')]){if(_0x3cbc80['account']['autoclose']){_0x3cbc80['applications'][_0xc3cd('0x93')]({'id':0x0,'priority':_0x3cbc80[_0xc3cd('0x82')][_0xc3cd('0x55')]+0x1,'app':_0xc3cd('0x94'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xc3cd('0x95')]['create']({'body':_0x119552['body'][_0xc3cd('0x59')],'OpenchannelAccountId':_0x119552[_0xc3cd('0x53')]['id'],'OpenchannelInteractionId':_0x1cd298['id'],'direction':'in','ContactId':_0x3cbc80[_0xc3cd('0x89')]['id'],'AttachmentId':_0x119552['body'][_0xc3cd('0x96')]});})[_0xc3cd('0x1e')](function(_0x5058c8){_0x3cbc80['message']=_0x5058c8;if(!_0x3cbc80['interaction'][_0xc3cd('0x97')])return;return db[_0xc3cd('0x98')]['find']({'attributes':['id',_0xc3cd('0x38')],'where':{'id':_0x3cbc80[_0xc3cd('0x91')][_0xc3cd('0x97')]}});})[_0xc3cd('0x1e')](function(_0x1ba44d){if(_0x1ba44d){_0x3cbc80[_0xc3cd('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc3cd('0x99'),'appdata':_0x1ba44d[_0xc3cd('0x38')]+','+(_0x3cbc80[_0xc3cd('0x86')][_0xc3cd('0x9a')]||0xa),'interval':_0xc3cd('0x9b')});}if(!_0x3cbc80[_0xc3cd('0x91')][_0xc3cd('0x9c')])return;return db[_0xc3cd('0x9d')][_0xc3cd('0x57')]({'attributes':['id','name'],'where':{'id':_0x3cbc80['interaction'][_0xc3cd('0x9c')]}});})[_0xc3cd('0x1e')](function(_0x2a2461){if(_0x2a2461){_0x3cbc80[_0xc3cd('0x82')]['unshift']({'id':0x0,'priority':0x1,'app':_0xc3cd('0x9e'),'appdata':_0x2a2461[_0xc3cd('0x38')]+','+(_0x3cbc80['account'][_0xc3cd('0x9f')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc3cd('0xa0'),'startRouting',_0x3cbc80);})[_0xc3cd('0x1e')](function(_0x4ede9b){respondWithRpcPromise(_0xc3cd('0xa1'),_0xc3cd('0xa1'),{'event':'notify','message':_0x4ede9b},client9002);return _0x4ede9b;})[_0xc3cd('0x1e')](respondWithResult(_0x38323c,null))[_0xc3cd('0x51')](handleError(_0x38323c,null));};exports[_0xc3cd('0xa2')]=function(_0x220edf,_0x4dd73e){var _0x2c7e3a=_0x220edf[_0xc3cd('0x53')]['id'];var _0x234438=_0x220edf[_0xc3cd('0x59')];var _0x160952=0xc8;var _0x4991ef=null;return db[_0xc3cd('0xa3')][_0xc3cd('0xa4')]({'isolationLevel':db['sequelize'][_0xc3cd('0xa5')]['ISOLATION_LEVELS'][_0xc3cd('0xa6')]},function(_0xc56b8b){return db['OpenchannelAccount'][_0xc3cd('0x65')]({'where':{'id':_0x2c7e3a},'transaction':_0xc56b8b})[_0xc3cd('0x1e')](function(_0x21bcfc){if(_0x21bcfc){return db[_0xc3cd('0x80')][_0xc3cd('0x33')]({'where':{'OpenchannelAccountId':_0x2c7e3a},'transaction':_0xc56b8b})[_0xc3cd('0x1e')](function(){var _0xc36fb3=_['map'](_0x234438,function(_0x156b61){_0x156b61[_0xc3cd('0x62')]=_0x2c7e3a;return _0x156b61;});return db[_0xc3cd('0x80')]['bulkCreate'](_0xc36fb3,{'transaction':_0xc56b8b});});}else{_0x160952=0x194;_0x4991ef=[];}});})[_0xc3cd('0x1e')](function(){if(_0x160952!==0x194){return db['OpenchannelApplication'][_0xc3cd('0xa7')]({'where':{'OpenchannelAccountId':_0x2c7e3a},'order':'priority'})['then'](function(_0x2fa01a){_0x4991ef=_0x2fa01a;});}})[_0xc3cd('0x51')](function(_0x2eb68f){_0x160952=0x1f4;logger[_0xc3cd('0x24')](_0x2eb68f[_0xc3cd('0x37')]);if(_0x2eb68f['name']){delete _0x2eb68f[_0xc3cd('0x38')];}_0x4991ef=_0x2eb68f;})[_0xc3cd('0xa8')](function(){if(_0x4991ef===null){_0x4dd73e[_0xc3cd('0x28')](_0x160952);}else{if(_0x160952===0x1f4){_0x4dd73e['status'](_0x160952)['send'](_0x4991ef);}else{_0x4dd73e[_0xc3cd('0x29')](_0x160952)[_0xc3cd('0x2a')](_0x4991ef);}}});};exports[_0xc3cd('0xa9')]=function(_0x1e4a2e,_0xb3df02,_0x479750){var _0x657ee9={};var _0x31e52e={};var _0x3be802;var _0x53a004;return db[_0xc3cd('0x3d')][_0xc3cd('0x65')]({'where':{'id':_0x1e4a2e[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0xb3df02,null))['then'](function(_0x11de5e){if(_0x11de5e){_0x3be802=_0x11de5e;_0x31e52e['model']=_[_0xc3cd('0x54')](db[_0xc3cd('0x80')][_0xc3cd('0x3e')]);_0x31e52e[_0xc3cd('0x42')]=_['keys'](_0x1e4a2e[_0xc3cd('0x42')]);_0x31e52e['filters']=_['intersection'](_0x31e52e['model'],_0x31e52e[_0xc3cd('0x42')]);_0x657ee9['attributes']=_[_0xc3cd('0x44')](_0x31e52e[_0xc3cd('0x41')],qs[_0xc3cd('0x46')](_0x1e4a2e[_0xc3cd('0x42')][_0xc3cd('0x46')]));_0x657ee9[_0xc3cd('0x45')]=_0x657ee9['attributes']['length']?_0x657ee9[_0xc3cd('0x45')]:_0x31e52e[_0xc3cd('0x41')];_0x657ee9['order']=qs['sort'](_0x1e4a2e[_0xc3cd('0x42')][_0xc3cd('0x48')]);_0x657ee9['where']=qs[_0xc3cd('0x43')](_['pick'](_0x1e4a2e[_0xc3cd('0x42')],_0x31e52e[_0xc3cd('0x43')]));if(_0x1e4a2e[_0xc3cd('0x42')][_0xc3cd('0x49')]){_0x657ee9['where']=_['merge'](_0x657ee9[_0xc3cd('0x4a')],{'$or':_[_0xc3cd('0x3c')](_0x657ee9[_0xc3cd('0x45')],function(_0x2d1de0){var _0x1d46ac={};_0x1d46ac[_0x2d1de0]={'$like':'%'+_0x1e4a2e[_0xc3cd('0x42')][_0xc3cd('0x49')]+'%'};return _0x1d46ac;})});}_0x657ee9=_['merge']({},_0x657ee9,_0x1e4a2e[_0xc3cd('0x4d')]);return _0x3be802[_0xc3cd('0xa9')](_0x657ee9);}})[_0xc3cd('0x1e')](function(_0x77bd38){if(_0x77bd38){_0x53a004=_0x77bd38[_0xc3cd('0x55')];if(!_0x1e4a2e['query'][_0xc3cd('0x69')]('nolimit')){_0x657ee9[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x1e4a2e[_0xc3cd('0x42')][_0xc3cd('0x2d')]);_0x657ee9[_0xc3cd('0x2b')]=qs[_0xc3cd('0x2b')](_0x1e4a2e[_0xc3cd('0x42')]['offset']);}return _0x3be802[_0xc3cd('0xa9')](_0x657ee9);}})['then'](function(_0x3656c4){if(_0x3656c4){return _0x3656c4?{'count':_0x53a004,'rows':_0x3656c4}:null;}})[_0xc3cd('0x1e')](respondWithResult(_0xb3df02,null))[_0xc3cd('0x51')](handleError(_0xb3df02,null));};exports[_0xc3cd('0xaa')]=function(_0x2e7e9c,_0x4f9300,_0x4bd9a4){var _0x447a3d={'raw':![],'where':{}};var _0x5cf33d={};var _0x2399da={'count':0x0,'rows':[]};return db[_0xc3cd('0x3d')]['findOne']({'where':{'id':_0x2e7e9c['params']['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x4f9300,null))[_0xc3cd('0x1e')](function(_0x47e335){if(_0x47e335){_0x5cf33d[_0xc3cd('0x41')]=_[_0xc3cd('0x54')](db[_0xc3cd('0x8c')]['rawAttributes']);_0x5cf33d[_0xc3cd('0x42')]=_[_0xc3cd('0x54')](_0x2e7e9c[_0xc3cd('0x42')]);_0x5cf33d[_0xc3cd('0x43')]=_[_0xc3cd('0x44')](_0x5cf33d[_0xc3cd('0x41')],_0x5cf33d[_0xc3cd('0x42')]);_0x447a3d[_0xc3cd('0x45')]=_['intersection'](_0x5cf33d[_0xc3cd('0x41')],qs[_0xc3cd('0x46')](_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0x46')]));_0x447a3d[_0xc3cd('0x45')]=_0x447a3d[_0xc3cd('0x45')][_0xc3cd('0x55')]?_0x447a3d[_0xc3cd('0x45')]:_0x5cf33d[_0xc3cd('0x41')];if(!_0x2e7e9c['query']['hasOwnProperty'](_0xc3cd('0x66'))){_0x447a3d[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0x2d')]);_0x447a3d[_0xc3cd('0x2b')]=qs[_0xc3cd('0x2b')](_0x2e7e9c['query'][_0xc3cd('0x2b')]);}_0x447a3d[_0xc3cd('0x47')]=qs['sort'](_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0x48')]);_0x447a3d[_0xc3cd('0x4a')]=qs[_0xc3cd('0x43')](_[_0xc3cd('0x6a')](_0x2e7e9c[_0xc3cd('0x42')],_0x5cf33d[_0xc3cd('0x43')]));_0x447a3d['where'][_0xc3cd('0x62')]=_0x47e335['id'];if(_0x2e7e9c['query'][_0xc3cd('0x49')]){_0x447a3d['where']=_[_0xc3cd('0x4c')](_0x447a3d[_0xc3cd('0x4a')],{'$or':_[_0xc3cd('0x3c')](_0x447a3d[_0xc3cd('0x45')],function(_0x2b17dc){var _0x3da5ad={};_0x3da5ad[_0x2b17dc]={'$like':'%'+_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0x49')]+'%'};return _0x3da5ad;})});}_0x447a3d=_['merge']({},_0x447a3d,_0x2e7e9c[_0xc3cd('0x4d')]);return db[_0xc3cd('0x8c')][_0xc3cd('0x2e')]({'where':_0x447a3d['where']})['then'](function(_0x5a4f85){_0x2399da[_0xc3cd('0x2e')]=_0x5a4f85;if(_0x2e7e9c[_0xc3cd('0x42')]['includeAll']){_0x447a3d[_0xc3cd('0x4e')]=[{'model':db[_0xc3cd('0x7e')],'as':'Contact','required':![]},{'model':db[_0xc3cd('0x98')],'as':_0xc3cd('0xab'),'attributes':['name',_0xc3cd('0xac'),_0xc3cd('0xad')],'required':![]},{'model':db[_0xc3cd('0xae')],'as':_0xc3cd('0xaf'),'attributes':['id','name',_0xc3cd('0xb0')],'where':_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0xb1')]?{'id':_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0xb1')]}:undefined,'required':_0x2e7e9c[_0xc3cd('0x42')][_0xc3cd('0xb1')]?!![]:![]}];}return db[_0xc3cd('0x8c')]['findAll'](_0x447a3d);})['then'](function(_0x5e3aba){_0x2399da[_0xc3cd('0x50')]=_0x5e3aba;return _0x2399da;});}})[_0xc3cd('0x1e')](respondWithFilteredResult(_0x4f9300,_0x447a3d))[_0xc3cd('0x51')](handleError(_0x4f9300,null));};exports['addAgents']=function(_0x18d2eb,_0x4a93c5,_0x354296){return db['OpenchannelAccount'][_0xc3cd('0x57')]({'where':{'id':_0x18d2eb[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x4a93c5,null))[_0xc3cd('0x1e')](function(_0x3258cc){if(_0x3258cc){return _0x3258cc[_0xc3cd('0xb2')](_0x18d2eb[_0xc3cd('0x59')][_0xc3cd('0x6c')],_[_0xc3cd('0xb3')](_0x18d2eb['body'],[_0xc3cd('0x6c'),'id'])||{})[_0xc3cd('0x8f')](function(_0x51eb26){for(var _0xf8ae4d=0x0;_0xf8ae4d<_0x18d2eb[_0xc3cd('0x59')][_0xc3cd('0x6c')][_0xc3cd('0x55')];_0xf8ae4d+=0x1){socket[_0xc3cd('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x18d2eb[_0xc3cd('0x59')][_0xc3cd('0x6c')][_0xf8ae4d]),'OpenchannelAccountId':Number(_0x18d2eb['params']['id'])});}return _0x51eb26;});}})[_0xc3cd('0x1e')](respondWithResult(_0x4a93c5,null))[_0xc3cd('0x51')](handleError(_0x4a93c5,null));};exports[_0xc3cd('0xb5')]=function(_0x51753d,_0x361598,_0x102190){return db['OpenchannelAccount']['find']({'where':{'id':_0x51753d[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x361598,null))[_0xc3cd('0x1e')](function(_0x4fa723){if(_0x4fa723){return _0x4fa723[_0xc3cd('0xb5')](_0x51753d[_0xc3cd('0x42')][_0xc3cd('0x6c')])[_0xc3cd('0x1e')](function(){if(_[_0xc3cd('0xb6')](_0x51753d[_0xc3cd('0x42')][_0xc3cd('0x6c')])){for(var _0x1f7226=0x0;_0x1f7226<_0x51753d[_0xc3cd('0x42')][_0xc3cd('0x6c')][_0xc3cd('0x55')];_0x1f7226+=0x1){socket[_0xc3cd('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x51753d[_0xc3cd('0x42')][_0xc3cd('0x6c')][_0x1f7226]),'OpenchannelAccountId':Number(_0x51753d[_0xc3cd('0x53')]['id'])});}}else{socket[_0xc3cd('0xb4')](_0xc3cd('0xb7'),{'UserId':Number(_0x51753d[_0xc3cd('0x42')][_0xc3cd('0x6c')]),'OpenchannelAccountId':Number(_0x51753d[_0xc3cd('0x53')]['id'])});}});}})[_0xc3cd('0x1e')](respondWithStatusCode(_0x361598,null))[_0xc3cd('0x51')](handleError(_0x361598,null));};exports[_0xc3cd('0xb8')]=function(_0x3f6a23,_0x1a7474,_0x3b8022){var _0x1f307d={};var _0x2d2343={};var _0x26531c;var _0x397d0a;return db[_0xc3cd('0x3d')]['findOne']({'where':{'id':_0x3f6a23[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x1a7474,null))[_0xc3cd('0x1e')](function(_0x58c7d2){if(_0x58c7d2){_0x26531c=_0x58c7d2;_0x2d2343[_0xc3cd('0x41')]=_[_0xc3cd('0x54')](db[_0xc3cd('0x98')][_0xc3cd('0x3e')]);_0x2d2343[_0xc3cd('0x42')]=_[_0xc3cd('0x54')](_0x3f6a23[_0xc3cd('0x42')]);_0x2d2343[_0xc3cd('0x43')]=_[_0xc3cd('0x44')](_0x2d2343[_0xc3cd('0x41')],_0x2d2343[_0xc3cd('0x42')]);_0x1f307d[_0xc3cd('0x45')]=_['intersection'](_0x2d2343[_0xc3cd('0x41')],qs['fields'](_0x3f6a23[_0xc3cd('0x42')][_0xc3cd('0x46')]));_0x1f307d[_0xc3cd('0x45')]=_0x1f307d[_0xc3cd('0x45')][_0xc3cd('0x55')]?_0x1f307d[_0xc3cd('0x45')]:_0x2d2343[_0xc3cd('0x41')];_0x1f307d['order']=qs[_0xc3cd('0x48')](_0x3f6a23[_0xc3cd('0x42')][_0xc3cd('0x48')]);_0x1f307d[_0xc3cd('0x4a')]=qs[_0xc3cd('0x43')](_['pick'](_0x3f6a23[_0xc3cd('0x42')],_0x2d2343[_0xc3cd('0x43')]));if(_0x3f6a23[_0xc3cd('0x42')][_0xc3cd('0x49')]){_0x1f307d[_0xc3cd('0x4a')]=_['merge'](_0x1f307d[_0xc3cd('0x4a')],{'$or':_[_0xc3cd('0x3c')](_0x1f307d[_0xc3cd('0x45')],function(_0x2d2e7f){var _0x5682bc={};_0x5682bc[_0x2d2e7f]={'$like':'%'+_0x3f6a23[_0xc3cd('0x42')][_0xc3cd('0x49')]+'%'};return _0x5682bc;})});}_0x1f307d=_[_0xc3cd('0x4c')]({},_0x1f307d,_0x3f6a23[_0xc3cd('0x4d')]);return _0x26531c[_0xc3cd('0xb8')](_0x1f307d);}})[_0xc3cd('0x1e')](function(_0x4e081e){if(_0x4e081e){_0x397d0a=_0x4e081e[_0xc3cd('0x55')];if(!_0x3f6a23['query']['hasOwnProperty']('nolimit')){_0x1f307d[_0xc3cd('0x2d')]=qs[_0xc3cd('0x2d')](_0x3f6a23['query']['limit']);_0x1f307d[_0xc3cd('0x2b')]=qs['offset'](_0x3f6a23[_0xc3cd('0x42')]['offset']);}return _0x26531c[_0xc3cd('0xb8')](_0x1f307d);}})[_0xc3cd('0x1e')](function(_0x236687){if(_0x236687){return _0x236687?{'count':_0x397d0a,'rows':_0x236687}:null;}})[_0xc3cd('0x1e')](respondWithResult(_0x1a7474,null))[_0xc3cd('0x51')](handleError(_0x1a7474,null));};exports[_0xc3cd('0x39')]=function(_0x229575,_0x1b68d8,_0x43fd87){var _0x14a450,_0x48ed97,_0x410b2d;if(_[_0xc3cd('0x76')](_0x229575[_0xc3cd('0x59')][_0xc3cd('0x59')])||_0x229575[_0xc3cd('0x59')]['body']===''){throw new db[(_0xc3cd('0x6f'))][(_0xc3cd('0x70'))](_0xc3cd('0xb9'));}if(_['isNil'](_0x229575[_0xc3cd('0x59')]['to'])){}_0x14a450=_0x229575[_0xc3cd('0x59')]['to'];return db[_0xc3cd('0x3d')][_0xc3cd('0x65')]({'where':{'id':_0x229575[_0xc3cd('0x53')]['id']}})[_0xc3cd('0x1e')](handleEntityNotFound(_0x1b68d8,null))['then'](function(_0x3d08d0){if(_0x3d08d0){return db[_0xc3cd('0x3d')][_0xc3cd('0x57')]({'where':{'id':_0x3d08d0['id']},'include':[{'model':db['CmList'],'as':_0xc3cd('0x7d'),'include':[{'model':db[_0xc3cd('0x7e')],'as':'Contacts','where':{[_0x3d08d0['mapKey']]:_0x14a450},'limit':0x1,'order':[[_0xc3cd('0x74'),_0xc3cd('0xba')]]}]}]})['then'](handleEntityNotFound(_0x1b68d8,null))[_0xc3cd('0x1e')](function(_0x32a801){if(_0x32a801&&_0x32a801[_0xc3cd('0x7d')]){_0x48ed97=_0x32a801[_0xc3cd('0x34')]({'plain':!![]});if(_0x48ed97[_0xc3cd('0x7d')]&&_0x48ed97[_0xc3cd('0x7d')][_0xc3cd('0x7f')][_0xc3cd('0x55')]){return _0x48ed97[_0xc3cd('0x7d')]['Contacts'][0x0];}return db[_0xc3cd('0x7e')][_0xc3cd('0x58')](_['defaults'](_0x229575[_0xc3cd('0x59')],{'firstName':_0x14a450,[_0x32a801['mapKey']]:_0x14a450,'phone':_0x14a450,'ListId':_0x48ed97[_0xc3cd('0x88')]}));}})['then'](handleEntityNotFound(_0x1b68d8,null))[_0xc3cd('0x1e')](function(_0x2a8ee8){if(_0x2a8ee8){_0x410b2d=_0x2a8ee8;return db['OpenchannelInteraction'][_0xc3cd('0x57')]({'where':{'ContactId':_0x410b2d['id'],'closed':![],'OpenchannelAccountId':_0x48ed97['id']}})[_0xc3cd('0x1e')](function(_0x56ad70){if(_0x56ad70){return[_0x56ad70,![]];}return db[_0xc3cd('0x8c')][_0xc3cd('0x58')]({'UserId':_0x229575['user']['id'],'ContactId':_0x410b2d['id'],'OpenchannelAccountId':_0x48ed97['id'],'lastMsgDirection':'out','firstMsgDirection':_0xc3cd('0xbb'),'Messages':[_[_0xc3cd('0x4c')](_0x229575[_0xc3cd('0x59')],{'read':![],'body':_0x229575['body']['body'],'OpenchannelAccountId':_0x48ed97['id'],'UserId':_0x229575[_0xc3cd('0x5a')]['id'],'ContactId':_0x410b2d['id']})]},{'include':[{'model':db[_0xc3cd('0x95')],'as':_0xc3cd('0xbc')}]})[_0xc3cd('0x1e')](function(_0x1e18d9){return[_0x1e18d9,!![]];});});}})['spread'](function(_0x3d8c05,_0x36e7ba){if(_0x36e7ba){return _0x3d8c05;}return db[_0xc3cd('0x95')][_0xc3cd('0x58')](_[_0xc3cd('0x4c')](_0x229575[_0xc3cd('0x59')],{'read':![],'body':_0x229575[_0xc3cd('0x59')][_0xc3cd('0x59')],'OpenchannelAccountId':_0x48ed97['id'],'OpenchannelInteractionId':_0x3d8c05['id'],'UserId':_0x229575[_0xc3cd('0x5a')]['id'],'ContactId':_0x410b2d['id']}))[_0xc3cd('0x1e')](function(_0x13f5e0){_0x3d8c05['dataValues'][_0xc3cd('0xbc')]=[];_0x3d8c05['dataValues'][_0xc3cd('0xbc')]['push'](_0x13f5e0['dataValues']);return _0x3d8c05;});});}})['then'](respondWithResult(_0x1b68d8,null))[_0xc3cd('0x51')](handleError(_0x1b68d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f260469..a5c5dc3 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 _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x37e116,_0x484d8a){var _0x40bd31=function(_0xf367c4){while(--_0xf367c4){_0x37e116['push'](_0x37e116['shift']());}};_0x40bd31(++_0x484d8a);}(_0xac4a,0x13f));var _0xaac4=function(_0xe90269,_0x2376d5){_0xe90269=_0xe90269-0x0;var _0x291ddc=_0xac4a[_0xe90269];return _0x291ddc;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0x276558,_0xfffbb5){var _0x11f394=function(_0x271b83){while(--_0x271b83){_0x276558['push'](_0x276558['shift']());}};_0x11f394(++_0xfffbb5);}(_0x41bb,0xc5));var _0xb41b=function(_0x306a34,_0x4bbb7e){_0x306a34=_0x306a34-0x0;var _0x30b1bc=_0x41bb[_0x306a34];return _0x30b1bc;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var OpenchannelAccount=require(_0xb41b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1bebe78..d8d881e 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(_0xdb58b2,_0x53f173){var _0x1b91a7=function(_0x30bbca){while(--_0x30bbca){_0xdb58b2['push'](_0xdb58b2['shift']());}};_0x1b91a7(++_0x53f173);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x5b94cb,_0x2a3be8){var _0x286ad5=function(_0x51dce9){while(--_0x51dce9){_0x5b94cb['push'](_0x5b94cb['shift']());}};_0x286ad5(++_0x2a3be8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 965ea2f..aafc285 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 _0x2f3a=['http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x20380e,_0x14d546){var _0x51fa7c=function(_0x4262f0){while(--_0x4262f0){_0x20380e['push'](_0x20380e['shift']());}};_0x51fa7c(++_0x14d546);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x20b7e5,_0x24ef33){_0x20b7e5=_0x20b7e5-0x0;var _0x1ba39b=_0x2f3a[_0x20b7e5];return _0x1ba39b;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2f3('0xa')],{'host':_0xa2f3('0xb'),'port':0x18eb});var socket=require(_0xa2f3('0xc'))(new Redis(config[_0xa2f3('0xa')]));require('./openchannelAccount.socket')[_0xa2f3('0xd')](socket);function respondWithRpcPromise(_0x6373f7,_0x1fce68,_0x41a90c){return new BPromise(function(_0x214f68,_0x55ff83){return client[_0xa2f3('0xe')](_0x6373f7,_0x41a90c)[_0xa2f3('0xf')](function(_0x52aabd){logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));logger['debug'](_0xa2f3('0x13'),_0x1fce68,_0xa2f3('0x12'),JSON[_0xa2f3('0x14')](_0x52aabd));if(_0x52aabd[_0xa2f3('0x15')]){if(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x16')]===0x1f4){logger[_0xa2f3('0x15')](_0xa2f3('0x11'),_0x1fce68,_0x52aabd[_0xa2f3('0x15')]['message']);return _0x55ff83(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);}logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);return _0x214f68(_0x52aabd['error']['message']);}else{logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));_0x214f68(_0x52aabd[_0xa2f3('0x18')][_0xa2f3('0x17')]);}})[_0xa2f3('0x19')](function(_0x30be69){logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x30be69);_0x55ff83(_0x30be69);});});} \ No newline at end of file +var _0x750a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x13b61f,_0x2da2db){var _0x429cee=function(_0x2cba23){while(--_0x2cba23){_0x13b61f['push'](_0x13b61f['shift']());}};_0x429cee(++_0x2da2db);}(_0x750a,0x140));var _0xa750=function(_0x3e3867,_0x8c7b99){_0x3e3867=_0x3e3867-0x0;var _0x3325d6=_0x750a[_0x3e3867];return _0x3325d6;};'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});config[_0xa750('0xb')]=_[_0xa750('0xc')](config[_0xa750('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa750('0xb')]));require('./openchannelAccount.socket')[_0xa750('0xd')](socket);function respondWithRpcPromise(_0x1760f5,_0x51f594,_0x264284){return new BPromise(function(_0x2c2ea4,_0x5870f0){return client['request'](_0x1760f5,_0x264284)[_0xa750('0xe')](function(_0x4b19a1){logger[_0xa750('0xf')](_0xa750('0x10'),_0x51f594,'request\x20sent');logger[_0xa750('0x11')](_0xa750('0x12'),_0x51f594,_0xa750('0x13'),JSON['stringify'](_0x4b19a1));if(_0x4b19a1[_0xa750('0x14')]){if(_0x4b19a1[_0xa750('0x14')][_0xa750('0x15')]===0x1f4){logger[_0xa750('0x14')](_0xa750('0x10'),_0x51f594,_0x4b19a1[_0xa750('0x14')]['message']);return _0x5870f0(_0x4b19a1[_0xa750('0x14')][_0xa750('0x16')]);}logger[_0xa750('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x51f594,_0x4b19a1[_0xa750('0x14')][_0xa750('0x16')]);return _0x2c2ea4(_0x4b19a1['error']['message']);}else{logger[_0xa750('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x51f594,_0xa750('0x13'));_0x2c2ea4(_0x4b19a1[_0xa750('0x17')]['message']);}})[_0xa750('0x18')](function(_0x500a84){logger['error'](_0xa750('0x10'),_0x51f594,_0x500a84);_0x5870f0(_0x500a84);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ea6109a..c19b37a 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 _0xca56=['remove','update','emit','removeListener','register','length','./openchannelAccount.events','save'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xca56,0xee));var _0x6ca5=function(_0x50573e,_0x18b553){_0x50573e=_0x50573e-0x0;var _0x2c596f=_0xca56[_0x50573e];return _0x2c596f;};'use strict';var OpenchannelAccountEvents=require(_0x6ca5('0x0'));var events=[_0x6ca5('0x1'),_0x6ca5('0x2'),_0x6ca5('0x3')];function createListener(_0x404fb9,_0x17e955){return function(_0x2f20c2){_0x17e955[_0x6ca5('0x4')](_0x404fb9,_0x2f20c2);};}function removeListener(_0x15105e,_0x5456b0){return function(){OpenchannelAccountEvents[_0x6ca5('0x5')](_0x15105e,_0x5456b0);};}exports[_0x6ca5('0x6')]=function(_0x4440bd){for(var _0x2c078a=0x0,_0x529cbe=events[_0x6ca5('0x7')];_0x2c078a<_0x529cbe;_0x2c078a++){var _0x232b31=events[_0x2c078a];var _0x511b48=createListener('openchannelAccount:'+_0x232b31,_0x4440bd);OpenchannelAccountEvents['on'](_0x232b31,_0x511b48);}}; \ No newline at end of file +var _0xa4de=['update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events'];(function(_0xa5498b,_0x3795b5){var _0x450c2d=function(_0x35c35c){while(--_0x35c35c){_0xa5498b['push'](_0xa5498b['shift']());}};_0x450c2d(++_0x3795b5);}(_0xa4de,0x10d));var _0xea4d=function(_0x382f86,_0x1e0919){_0x382f86=_0x382f86-0x0;var _0xf30c11=_0xa4de[_0x382f86];return _0xf30c11;};'use strict';var OpenchannelAccountEvents=require(_0xea4d('0x0'));var events=['save','remove',_0xea4d('0x1')];function createListener(_0x2857a3,_0xf1af92){return function(_0x3ee016){_0xf1af92[_0xea4d('0x2')](_0x2857a3,_0x3ee016);};}function removeListener(_0x111a9e,_0x23785){return function(){OpenchannelAccountEvents[_0xea4d('0x3')](_0x111a9e,_0x23785);};}exports[_0xea4d('0x4')]=function(_0x24d5fe){for(var _0x604a6a=0x0,_0x2af8a5=events['length'];_0x604a6a<_0x2af8a5;_0x604a6a++){var _0x12d0bb=events[_0x604a6a];var _0x4f98e8=createListener(_0xea4d('0x5')+_0x12d0bb,_0x24d5fe);OpenchannelAccountEvents['on'](_0x12d0bb,_0x4f98e8);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index db0d771..4c29c80 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 _0x2bcd=['put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','get','/:id','show','post'];(function(_0x130574,_0x54f802){var _0x5a6903=function(_0x52aa07){while(--_0x52aa07){_0x130574['push'](_0x130574['shift']());}};_0x5a6903(++_0x54f802);}(_0x2bcd,0x168));var _0xd2bc=function(_0x2fff6b,_0x29752f){_0x2fff6b=_0x2fff6b-0x0;var _0xc562b2=_0x2bcd[_0x2fff6b];return _0xc562b2;};'use strict';var multer=require(_0xd2bc('0x0'));var util=require(_0xd2bc('0x1'));var path=require(_0xd2bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2bc('0x3'));var router=express[_0xd2bc('0x4')]();var fs_extra=require(_0xd2bc('0x5'));var auth=require(_0xd2bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd2bc('0x7'));var controller=require(_0xd2bc('0x8'));router['get']('/',auth[_0xd2bc('0x9')](),controller['index']);router[_0xd2bc('0xa')](_0xd2bc('0xb'),auth[_0xd2bc('0x9')](),controller[_0xd2bc('0xc')]);router[_0xd2bc('0xd')]('/',auth[_0xd2bc('0x9')](),controller['create']);router[_0xd2bc('0xe')](_0xd2bc('0xb'),auth[_0xd2bc('0x9')](),controller['update']);router['delete']('/:id',auth[_0xd2bc('0x9')](),controller[_0xd2bc('0xf')]);module[_0xd2bc('0x10')]=router; \ No newline at end of file +var _0x70d3=['Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x1113e6,_0x4e1433){var _0x43ec51=function(_0x5d741a){while(--_0x5d741a){_0x1113e6['push'](_0x1113e6['shift']());}};_0x43ec51(++_0x4e1433);}(_0x70d3,0x1f4));var _0x370d=function(_0xb2b487,_0x5cc6b2){_0xb2b487=_0xb2b487-0x0;var _0x315826=_0x70d3[_0xb2b487];return _0x315826;};'use strict';var multer=require(_0x370d('0x0'));var util=require(_0x370d('0x1'));var path=require('path');var timeout=require(_0x370d('0x2'));var express=require(_0x370d('0x3'));var router=express[_0x370d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x370d('0x5'));var config=require(_0x370d('0x6'));var controller=require(_0x370d('0x7'));router[_0x370d('0x8')]('/',auth[_0x370d('0x9')](),controller[_0x370d('0xa')]);router[_0x370d('0x8')]('/:id',auth[_0x370d('0x9')](),controller[_0x370d('0xb')]);router[_0x370d('0xc')]('/',auth[_0x370d('0x9')](),controller['create']);router[_0x370d('0xd')](_0x370d('0xe'),auth[_0x370d('0x9')](),controller[_0x370d('0xf')]);router[_0x370d('0x10')](_0x370d('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x370d('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6f1c5ea..918a5c9 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 _0x9f05=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4145a8,_0x55e817){var _0x155db0=function(_0x30ad81){while(--_0x30ad81){_0x4145a8['push'](_0x4145a8['shift']());}};_0x155db0(++_0x55e817);}(_0x9f05,0xf9));var _0x59f0=function(_0x248f49,_0x58ddce){_0x248f49=_0x248f49-0x0;var _0x99cb00=_0x9f05[_0x248f49];return _0x99cb00;};'use strict';var Sequelize=require(_0x59f0('0x0'));module[_0x59f0('0x1')]={'priority':{'type':Sequelize[_0x59f0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x59f0('0x3')],'allowNull':![],'defaultValue':_0x59f0('0x4')},'appdata':{'type':Sequelize[_0x59f0('0x5')]()},'description':{'type':Sequelize[_0x59f0('0x3')]},'interval':{'type':Sequelize[_0x59f0('0x3')],'defaultValue':_0x59f0('0x6')}}; \ No newline at end of file +var _0x6080=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x60df0a,_0x78cc64){var _0x28e96e=function(_0x31e84a){while(--_0x31e84a){_0x60df0a['push'](_0x60df0a['shift']());}};_0x28e96e(++_0x78cc64);}(_0x6080,0x110));var _0x0608=function(_0x135972,_0x15eb37){_0x135972=_0x135972-0x0;var _0x1a8141=_0x6080[_0x135972];return _0x1a8141;};'use strict';var Sequelize=require(_0x0608('0x0'));module[_0x0608('0x1')]={'priority':{'type':Sequelize[_0x0608('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0608('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0608('0x4')]()},'description':{'type':Sequelize[_0x0608('0x3')]},'interval':{'type':Sequelize[_0x0608('0x3')],'defaultValue':_0x0608('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e2e163e..503e324 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 _0x5003=['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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','update','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x44ce91,_0x5f0a9a){var _0x53e0dd=function(_0x2fde80){while(--_0x2fde80){_0x44ce91['push'](_0x44ce91['shift']());}};_0x53e0dd(++_0x5f0a9a);}(_0x5003,0x1db));var _0x3500=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5003[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3500('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3500('0x1'));var jsonpatch=require(_0x3500('0x2'));var rp=require(_0x3500('0x3'));var moment=require(_0x3500('0x4'));var BPromise=require(_0x3500('0x5'));var Mustache=require(_0x3500('0x6'));var util=require(_0x3500('0x7'));var path=require(_0x3500('0x8'));var sox=require(_0x3500('0x9'));var csv=require(_0x3500('0xa'));var ejs=require(_0x3500('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3500('0xc'));var squel=require(_0x3500('0xd'));var crypto=require(_0x3500('0xe'));var jsforce=require(_0x3500('0xf'));var deskjs=require(_0x3500('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3500('0x11'));var Papa=require(_0x3500('0x12'));var Redis=require(_0x3500('0x13'));var authService=require(_0x3500('0x14'));var qs=require(_0x3500('0x15'));var as=require(_0x3500('0x16'));var hardwareService=require(_0x3500('0x17'));var logger=require(_0x3500('0x18'))(_0x3500('0x19'));var utils=require(_0x3500('0x1a'));var config=require(_0x3500('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b0a1c,_0x73f721){_0x73f721=_0x73f721||0xcc;return function(_0x2163a9){if(_0x2163a9){return _0x5b0a1c[_0x3500('0x1c')](_0x73f721);}return _0x5b0a1c[_0x3500('0x1d')](_0x73f721)[_0x3500('0x1e')]();};}function respondWithResult(_0x39b861,_0x3441cf){_0x3441cf=_0x3441cf||0xc8;return function(_0x145789){if(_0x145789){return _0x39b861['status'](_0x3441cf)['json'](_0x145789);}};}function respondWithFilteredResult(_0x1b0397,_0x656c6c){return function(_0x5d1bbf){if(_0x5d1bbf){var _0x1ba2fd=typeof _0x656c6c[_0x3500('0x1f')]==='undefined'&&typeof _0x656c6c[_0x3500('0x20')]===_0x3500('0x21');var _0x4faa64=_0x5d1bbf[_0x3500('0x22')];var _0x456902=_0x1ba2fd?0x0:_0x656c6c[_0x3500('0x1f')];var _0x4502e5=_0x1ba2fd?_0x5d1bbf[_0x3500('0x22')]:_0x656c6c['offset']+_0x656c6c[_0x3500('0x20')];var _0x56abf0;if(_0x4502e5>=_0x4faa64){_0x4502e5=_0x4faa64;_0x56abf0=0xc8;}else{_0x56abf0=0xce;}_0x1b0397['status'](_0x56abf0);return _0x1b0397[_0x3500('0x23')](_0x3500('0x24'),_0x456902+'-'+_0x4502e5+'/'+_0x4faa64)['json'](_0x5d1bbf);}return null;};}function patchUpdates(_0x556b80){return function(_0x2e6f83){try{jsonpatch[_0x3500('0x25')](_0x2e6f83,_0x556b80,!![]);}catch(_0x1d2088){return BPromise[_0x3500('0x26')](_0x1d2088);}return _0x2e6f83[_0x3500('0x27')]();};}function saveUpdates(_0x52f82b,_0x408f65){return function(_0x49c879){if(_0x49c879){return _0x49c879['update'](_0x52f82b)[_0x3500('0x28')](function(_0xf0ebad){return _0xf0ebad;});}return null;};}function removeEntity(_0x471125,_0x154149){return function(_0x475f6e){if(_0x475f6e){return _0x475f6e[_0x3500('0x29')]()[_0x3500('0x28')](function(){_0x471125[_0x3500('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x451996,_0x5c36e4){return function(_0x249dc0){if(!_0x249dc0){_0x451996[_0x3500('0x1c')](0x194);}return _0x249dc0;};}function handleError(_0x4caeaf,_0x1cd12a){_0x1cd12a=_0x1cd12a||0x1f4;return function(_0x5ac17d){logger[_0x3500('0x2a')](_0x5ac17d[_0x3500('0x2b')]);if(_0x5ac17d[_0x3500('0x2c')]){delete _0x5ac17d[_0x3500('0x2c')];}_0x4caeaf[_0x3500('0x1d')](_0x1cd12a)[_0x3500('0x2d')](_0x5ac17d);};}exports[_0x3500('0x2e')]=function(_0x444011,_0x2f6f79){var _0x42e266={},_0x536102={},_0x2e974f={'count':0x0,'rows':[]};var _0x31a2a9=_[_0x3500('0x2f')](db[_0x3500('0x30')][_0x3500('0x31')],function(_0x2457e2){return{'name':_0x2457e2[_0x3500('0x32')],'type':_0x2457e2[_0x3500('0x33')][_0x3500('0x34')]};});_0x536102[_0x3500('0x35')]=_[_0x3500('0x2f')](_0x31a2a9,_0x3500('0x2c'));_0x536102['query']=_[_0x3500('0x36')](_0x444011[_0x3500('0x37')]);_0x536102[_0x3500('0x38')]=_['intersection'](_0x536102[_0x3500('0x35')],_0x536102[_0x3500('0x37')]);_0x42e266[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x536102[_0x3500('0x35')],qs[_0x3500('0x3b')](_0x444011['query'][_0x3500('0x3b')]));_0x42e266[_0x3500('0x39')]=_0x42e266[_0x3500('0x39')][_0x3500('0x3c')]?_0x42e266['attributes']:_0x536102[_0x3500('0x35')];if(!_0x444011[_0x3500('0x37')][_0x3500('0x3d')](_0x3500('0x3e'))){_0x42e266['limit']=qs[_0x3500('0x20')](_0x444011[_0x3500('0x37')][_0x3500('0x20')]);_0x42e266[_0x3500('0x1f')]=qs[_0x3500('0x1f')](_0x444011['query'][_0x3500('0x1f')]);}_0x42e266[_0x3500('0x3f')]=qs[_0x3500('0x40')](_0x444011[_0x3500('0x37')][_0x3500('0x40')]);_0x42e266['where']=qs['filters'](_['pick'](_0x444011['query'],_0x536102[_0x3500('0x38')]),_0x31a2a9);if(_0x444011[_0x3500('0x37')][_0x3500('0x41')]){_0x42e266[_0x3500('0x42')]=_[_0x3500('0x43')](_0x42e266[_0x3500('0x42')],{'$or':_['map'](_0x31a2a9,function(_0x5e1915){if(_0x5e1915[_0x3500('0x33')]!==_0x3500('0x44')){var _0x26ce29={};_0x26ce29[_0x5e1915[_0x3500('0x2c')]]={'$like':'%'+_0x444011[_0x3500('0x37')][_0x3500('0x41')]+'%'};return _0x26ce29;}})});}_0x42e266=_['merge']({},_0x42e266,_0x444011['options']);var _0x3cec86={'where':_0x42e266[_0x3500('0x42')]};return db[_0x3500('0x30')][_0x3500('0x22')](_0x3cec86)[_0x3500('0x28')](function(_0x798595){_0x2e974f[_0x3500('0x22')]=_0x798595;if(_0x444011[_0x3500('0x37')][_0x3500('0x45')]){_0x42e266[_0x3500('0x46')]=[{'all':!![]}];}return db[_0x3500('0x30')][_0x3500('0x47')](_0x42e266);})[_0x3500('0x28')](function(_0x501d99){_0x2e974f[_0x3500('0x48')]=_0x501d99;return _0x2e974f;})['then'](respondWithFilteredResult(_0x2f6f79,_0x42e266))['catch'](handleError(_0x2f6f79,null));};exports[_0x3500('0x49')]=function(_0x1c5b0c,_0x120401){var _0x14db5c={'raw':!![],'where':{'id':_0x1c5b0c['params']['id']}},_0xed1166={};_0xed1166[_0x3500('0x35')]=_[_0x3500('0x36')](db['OpenchannelApplication']['rawAttributes']);_0xed1166[_0x3500('0x37')]=_['keys'](_0x1c5b0c['query']);_0xed1166[_0x3500('0x38')]=_[_0x3500('0x3a')](_0xed1166[_0x3500('0x35')],_0xed1166[_0x3500('0x37')]);_0x14db5c[_0x3500('0x39')]=_[_0x3500('0x3a')](_0xed1166[_0x3500('0x35')],qs[_0x3500('0x3b')](_0x1c5b0c[_0x3500('0x37')][_0x3500('0x3b')]));_0x14db5c[_0x3500('0x39')]=_0x14db5c[_0x3500('0x39')][_0x3500('0x3c')]?_0x14db5c[_0x3500('0x39')]:_0xed1166[_0x3500('0x35')];if(_0x1c5b0c[_0x3500('0x37')][_0x3500('0x45')]){_0x14db5c[_0x3500('0x46')]=[{'all':!![]}];}_0x14db5c=_[_0x3500('0x43')]({},_0x14db5c,_0x1c5b0c[_0x3500('0x4a')]);return db['OpenchannelApplication']['find'](_0x14db5c)[_0x3500('0x28')](handleEntityNotFound(_0x120401,null))['then'](respondWithResult(_0x120401,null))[_0x3500('0x4b')](handleError(_0x120401,null));};exports[_0x3500('0x4c')]=function(_0x5d2ce3,_0x1e7b57){return db[_0x3500('0x30')]['create'](_0x5d2ce3[_0x3500('0x4d')],{})['then'](respondWithResult(_0x1e7b57,0xc9))[_0x3500('0x4b')](handleError(_0x1e7b57,null));};exports[_0x3500('0x4e')]=function(_0x153ab7,_0x201d70){if(_0x153ab7[_0x3500('0x4d')]['id']){delete _0x153ab7[_0x3500('0x4d')]['id'];}return db[_0x3500('0x30')][_0x3500('0x4f')]({'where':{'id':_0x153ab7[_0x3500('0x50')]['id']}})[_0x3500('0x28')](handleEntityNotFound(_0x201d70,null))[_0x3500('0x28')](saveUpdates(_0x153ab7[_0x3500('0x4d')],null))[_0x3500('0x28')](respondWithResult(_0x201d70,null))['catch'](handleError(_0x201d70,null));};exports[_0x3500('0x29')]=function(_0x1c3037,_0x378676){return db[_0x3500('0x30')][_0x3500('0x4f')]({'where':{'id':_0x1c3037['params']['id']}})[_0x3500('0x28')](handleEntityNotFound(_0x378676,null))[_0x3500('0x28')](removeEntity(_0x378676,null))[_0x3500('0x4b')](handleError(_0x378676,null));}; \ No newline at end of file +var _0x37a1=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','findAll','rows','catch','show','params','length','create','body'];(function(_0x3e97cf,_0x1aa802){var _0x5e696c=function(_0x1b80e1){while(--_0x1b80e1){_0x3e97cf['push'](_0x3e97cf['shift']());}};_0x5e696c(++_0x1aa802);}(_0x37a1,0xd9));var _0x137a=function(_0x47e787,_0x571f19){_0x47e787=_0x47e787-0x0;var _0x45f68b=_0x37a1[_0x47e787];return _0x45f68b;};'use strict';var emlformat=require(_0x137a('0x0'));var rimraf=require(_0x137a('0x1'));var zipdir=require(_0x137a('0x2'));var jsonpatch=require(_0x137a('0x3'));var rp=require(_0x137a('0x4'));var moment=require(_0x137a('0x5'));var BPromise=require(_0x137a('0x6'));var Mustache=require('mustache');var util=require(_0x137a('0x7'));var path=require(_0x137a('0x8'));var sox=require('sox');var csv=require(_0x137a('0x9'));var ejs=require(_0x137a('0xa'));var fs=require('fs');var fs_extra=require(_0x137a('0xb'));var _=require('lodash');var squel=require(_0x137a('0xc'));var crypto=require('crypto');var jsforce=require(_0x137a('0xd'));var deskjs=require(_0x137a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x137a('0xf'));var Papa=require(_0x137a('0x10'));var Redis=require('ioredis');var authService=require(_0x137a('0x11'));var qs=require(_0x137a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x137a('0x13'))(_0x137a('0x14'));var utils=require(_0x137a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x137a('0x16'));var db=require(_0x137a('0x17'))['db'];function respondWithStatusCode(_0x26c517,_0x41f53f){_0x41f53f=_0x41f53f||0xcc;return function(_0x53506e){if(_0x53506e){return _0x26c517[_0x137a('0x18')](_0x41f53f);}return _0x26c517[_0x137a('0x19')](_0x41f53f)[_0x137a('0x1a')]();};}function respondWithResult(_0x3cc757,_0x429b56){_0x429b56=_0x429b56||0xc8;return function(_0x4e3ca0){if(_0x4e3ca0){return _0x3cc757[_0x137a('0x19')](_0x429b56)[_0x137a('0x1b')](_0x4e3ca0);}};}function respondWithFilteredResult(_0x2a0aa2,_0xf165f2){return function(_0x1700ab){if(_0x1700ab){var _0x4e8447=typeof _0xf165f2[_0x137a('0x1c')]===_0x137a('0x1d')&&typeof _0xf165f2[_0x137a('0x1e')]==='undefined';var _0x4eb1e6=_0x1700ab['count'];var _0x22d58c=_0x4e8447?0x0:_0xf165f2[_0x137a('0x1c')];var _0x29d6=_0x4e8447?_0x1700ab[_0x137a('0x1f')]:_0xf165f2[_0x137a('0x1c')]+_0xf165f2['limit'];var _0x2aa65e;if(_0x29d6>=_0x4eb1e6){_0x29d6=_0x4eb1e6;_0x2aa65e=0xc8;}else{_0x2aa65e=0xce;}_0x2a0aa2[_0x137a('0x19')](_0x2aa65e);return _0x2a0aa2[_0x137a('0x20')]('Content-Range',_0x22d58c+'-'+_0x29d6+'/'+_0x4eb1e6)[_0x137a('0x1b')](_0x1700ab);}return null;};}function patchUpdates(_0x2cc03f){return function(_0x1fc3fa){try{jsonpatch['apply'](_0x1fc3fa,_0x2cc03f,!![]);}catch(_0x4c7444){return BPromise[_0x137a('0x21')](_0x4c7444);}return _0x1fc3fa[_0x137a('0x22')]();};}function saveUpdates(_0x43b35b,_0x3867ac){return function(_0x45b42b){if(_0x45b42b){return _0x45b42b[_0x137a('0x23')](_0x43b35b)[_0x137a('0x24')](function(_0x585a81){return _0x585a81;});}return null;};}function removeEntity(_0x3be993,_0x354009){return function(_0x5da0f1){if(_0x5da0f1){return _0x5da0f1[_0x137a('0x25')]()[_0x137a('0x24')](function(){_0x3be993[_0x137a('0x19')](0xcc)[_0x137a('0x1a')]();});}};}function handleEntityNotFound(_0x56abf7,_0x1eeda2){return function(_0x339b93){if(!_0x339b93){_0x56abf7['sendStatus'](0x194);}return _0x339b93;};}function handleError(_0x3434ae,_0x3d2279){_0x3d2279=_0x3d2279||0x1f4;return function(_0xe47ddb){logger[_0x137a('0x26')](_0xe47ddb[_0x137a('0x27')]);if(_0xe47ddb['name']){delete _0xe47ddb['name'];}_0x3434ae[_0x137a('0x19')](_0x3d2279)[_0x137a('0x28')](_0xe47ddb);};}exports['index']=function(_0x38b1d,_0x31a747){var _0x454c62={},_0x138e25={},_0x33044c={'count':0x0,'rows':[]};var _0x5907f9=_[_0x137a('0x29')](db[_0x137a('0x2a')][_0x137a('0x2b')],function(_0x3e51f9){return{'name':_0x3e51f9[_0x137a('0x2c')],'type':_0x3e51f9[_0x137a('0x2d')][_0x137a('0x2e')]};});_0x138e25[_0x137a('0x2f')]=_['map'](_0x5907f9,'name');_0x138e25[_0x137a('0x30')]=_[_0x137a('0x31')](_0x38b1d[_0x137a('0x30')]);_0x138e25[_0x137a('0x32')]=_[_0x137a('0x33')](_0x138e25['model'],_0x138e25[_0x137a('0x30')]);_0x454c62[_0x137a('0x34')]=_[_0x137a('0x33')](_0x138e25['model'],qs['fields'](_0x38b1d[_0x137a('0x30')][_0x137a('0x35')]));_0x454c62['attributes']=_0x454c62[_0x137a('0x34')]['length']?_0x454c62[_0x137a('0x34')]:_0x138e25[_0x137a('0x2f')];if(!_0x38b1d[_0x137a('0x30')]['hasOwnProperty']('nolimit')){_0x454c62[_0x137a('0x1e')]=qs[_0x137a('0x1e')](_0x38b1d['query'][_0x137a('0x1e')]);_0x454c62[_0x137a('0x1c')]=qs[_0x137a('0x1c')](_0x38b1d[_0x137a('0x30')][_0x137a('0x1c')]);}_0x454c62['order']=qs[_0x137a('0x36')](_0x38b1d[_0x137a('0x30')]['sort']);_0x454c62[_0x137a('0x37')]=qs['filters'](_[_0x137a('0x38')](_0x38b1d[_0x137a('0x30')],_0x138e25[_0x137a('0x32')]),_0x5907f9);if(_0x38b1d['query']['filter']){_0x454c62[_0x137a('0x37')]=_[_0x137a('0x39')](_0x454c62['where'],{'$or':_[_0x137a('0x29')](_0x5907f9,function(_0x237a71){if(_0x237a71[_0x137a('0x2d')]!==_0x137a('0x3a')){var _0x335186={};_0x335186[_0x237a71[_0x137a('0x3b')]]={'$like':'%'+_0x38b1d['query'][_0x137a('0x3c')]+'%'};return _0x335186;}})});}_0x454c62=_['merge']({},_0x454c62,_0x38b1d[_0x137a('0x3d')]);var _0x5699f2={'where':_0x454c62[_0x137a('0x37')]};return db[_0x137a('0x2a')][_0x137a('0x1f')](_0x5699f2)[_0x137a('0x24')](function(_0x260a33){_0x33044c[_0x137a('0x1f')]=_0x260a33;if(_0x38b1d[_0x137a('0x30')][_0x137a('0x3e')]){_0x454c62['include']=[{'all':!![]}];}return db[_0x137a('0x2a')][_0x137a('0x3f')](_0x454c62);})[_0x137a('0x24')](function(_0x2f7eb6){_0x33044c[_0x137a('0x40')]=_0x2f7eb6;return _0x33044c;})[_0x137a('0x24')](respondWithFilteredResult(_0x31a747,_0x454c62))[_0x137a('0x41')](handleError(_0x31a747,null));};exports[_0x137a('0x42')]=function(_0x4f13f4,_0x1ab8d7){var _0x5d1c18={'raw':!![],'where':{'id':_0x4f13f4[_0x137a('0x43')]['id']}},_0xe8ff72={};_0xe8ff72[_0x137a('0x2f')]=_[_0x137a('0x31')](db[_0x137a('0x2a')][_0x137a('0x2b')]);_0xe8ff72[_0x137a('0x30')]=_[_0x137a('0x31')](_0x4f13f4[_0x137a('0x30')]);_0xe8ff72['filters']=_[_0x137a('0x33')](_0xe8ff72[_0x137a('0x2f')],_0xe8ff72[_0x137a('0x30')]);_0x5d1c18['attributes']=_[_0x137a('0x33')](_0xe8ff72[_0x137a('0x2f')],qs['fields'](_0x4f13f4[_0x137a('0x30')][_0x137a('0x35')]));_0x5d1c18[_0x137a('0x34')]=_0x5d1c18[_0x137a('0x34')][_0x137a('0x44')]?_0x5d1c18[_0x137a('0x34')]:_0xe8ff72[_0x137a('0x2f')];if(_0x4f13f4[_0x137a('0x30')]['includeAll']){_0x5d1c18['include']=[{'all':!![]}];}_0x5d1c18=_[_0x137a('0x39')]({},_0x5d1c18,_0x4f13f4[_0x137a('0x3d')]);return db[_0x137a('0x2a')]['find'](_0x5d1c18)['then'](handleEntityNotFound(_0x1ab8d7,null))[_0x137a('0x24')](respondWithResult(_0x1ab8d7,null))[_0x137a('0x41')](handleError(_0x1ab8d7,null));};exports[_0x137a('0x45')]=function(_0x12019e,_0xf99c1a){return db['OpenchannelApplication']['create'](_0x12019e['body'],{})[_0x137a('0x24')](respondWithResult(_0xf99c1a,0xc9))[_0x137a('0x41')](handleError(_0xf99c1a,null));};exports['update']=function(_0xd5471c,_0x3e0c30){if(_0xd5471c['body']['id']){delete _0xd5471c[_0x137a('0x46')]['id'];}return db[_0x137a('0x2a')][_0x137a('0x47')]({'where':{'id':_0xd5471c[_0x137a('0x43')]['id']}})[_0x137a('0x24')](handleEntityNotFound(_0x3e0c30,null))[_0x137a('0x24')](saveUpdates(_0xd5471c[_0x137a('0x46')],null))[_0x137a('0x24')](respondWithResult(_0x3e0c30,null))[_0x137a('0x41')](handleError(_0x3e0c30,null));};exports[_0x137a('0x25')]=function(_0x1bb8a0,_0x5e4c15){return db[_0x137a('0x2a')][_0x137a('0x47')]({'where':{'id':_0x1bb8a0['params']['id']}})[_0x137a('0x24')](handleEntityNotFound(_0x5e4c15,null))[_0x137a('0x24')](removeEntity(_0x5e4c15,null))[_0x137a('0x41')](handleError(_0x5e4c15,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4b28cd8..2a9c1ad 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 _0x297e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0xda11f5,_0x502f51){var _0x5ee2d2=function(_0x11017d){while(--_0x11017d){_0xda11f5['push'](_0xda11f5['shift']());}};_0x5ee2d2(++_0x502f51);}(_0x297e,0x193));var _0xe297=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x297e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xe297('0x0'));var util=require('util');var logger=require(_0xe297('0x1'))(_0xe297('0x2'));var moment=require(_0xe297('0x3'));var BPromise=require('bluebird');var rp=require(_0xe297('0x4'));var fs=require('fs');var path=require(_0xe297('0x5'));var rimraf=require(_0xe297('0x6'));var config=require('../../config/environment');var attributes=require(_0xe297('0x7'));module[_0xe297('0x8')]=function(_0x428e7d,_0x4e48ac){return _0x428e7d[_0xe297('0x9')](_0xe297('0xa'),attributes,{'tableName':_0xe297('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe297('0xc')});}; \ No newline at end of file +var _0x0126=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x54eef5,_0x4f1f40){var _0x12d89b=function(_0x25aa3b){while(--_0x25aa3b){_0x54eef5['push'](_0x54eef5['shift']());}};_0x12d89b(++_0x4f1f40);}(_0x0126,0x1c7));var _0x6012=function(_0xa09c4a,_0x20d368){_0xa09c4a=_0xa09c4a-0x0;var _0x2ed84b=_0x0126[_0xa09c4a];return _0x2ed84b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6012('0x0'))(_0x6012('0x1'));var moment=require(_0x6012('0x2'));var BPromise=require(_0x6012('0x3'));var rp=require(_0x6012('0x4'));var fs=require('fs');var path=require(_0x6012('0x5'));var rimraf=require(_0x6012('0x6'));var config=require(_0x6012('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x6012('0x8')]=function(_0x4020f8,_0xf46d3d){return _0x4020f8[_0x6012('0x9')](_0x6012('0xa'),attributes,{'tableName':_0x6012('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6012('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6806cc6..e12ecaf 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 _0x11d1=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11d1,0x7d));var _0x111d=function(_0x19ab14,_0x51b6f7){_0x19ab14=_0x19ab14-0x0;var _0x112625=_0x11d1[_0x19ab14];return _0x112625;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var moment=require(_0x111d('0x1'));var BPromise=require(_0x111d('0x2'));var rs=require(_0x111d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x111d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x111d('0x5'))(_0x111d('0x6'));var config=require(_0x111d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x111d('0x8')][_0x111d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c9d90,_0x4dad7a,_0x26210b){return new BPromise(function(_0x46faa9,_0xd0d2e6){return client[_0x111d('0xa')](_0x2c9d90,_0x26210b)['then'](function(_0x42e6a3){logger[_0x111d('0xb')](_0x111d('0xc'),_0x4dad7a,_0x111d('0xd'));logger[_0x111d('0xe')](_0x111d('0xf'),_0x4dad7a,_0x111d('0xd'),JSON['stringify'](_0x42e6a3));if(_0x42e6a3['error']){if(_0x42e6a3['error']['code']===0x1f4){logger[_0x111d('0x10')](_0x111d('0xc'),_0x4dad7a,_0x42e6a3[_0x111d('0x10')][_0x111d('0x11')]);return _0xd0d2e6(_0x42e6a3[_0x111d('0x10')]['message']);}logger[_0x111d('0x10')](_0x111d('0xc'),_0x4dad7a,_0x42e6a3[_0x111d('0x10')][_0x111d('0x11')]);return _0x46faa9(_0x42e6a3[_0x111d('0x10')]['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x4dad7a,_0x111d('0xd'));_0x46faa9(_0x42e6a3[_0x111d('0x12')][_0x111d('0x11')]);}})[_0x111d('0x13')](function(_0x2b79c4){logger['error'](_0x111d('0xc'),_0x4dad7a,_0x2b79c4);_0xd0d2e6(_0x2b79c4);});});}exports[_0x111d('0x14')]=function(_0x354855){var _0x58366e=this;return new Promise(function(_0x14ec30,_0x12fa90){return db[_0x111d('0x15')][_0x111d('0x16')](_0x354855[_0x111d('0x17')],{'raw':_0x354855[_0x111d('0x18')]?_0x354855[_0x111d('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354855['options']?_0x354855[_0x111d('0x18')][_0x111d('0x19')]||null:null,'attributes':_0x354855[_0x111d('0x18')]?_0x354855[_0x111d('0x18')][_0x111d('0x1a')]||null:null,'limit':_0x354855[_0x111d('0x18')]?_0x354855[_0x111d('0x18')]['limit']||null:null})['then'](function(_0x70028b){logger[_0x111d('0xb')](_0x111d('0x14'),_0x354855);logger[_0x111d('0xe')](_0x111d('0x14'),_0x354855,JSON[_0x111d('0x1b')](_0x70028b));_0x14ec30(_0x70028b);})[_0x111d('0x13')](function(_0x470531){logger[_0x111d('0x10')](_0x111d('0x14'),_0x470531[_0x111d('0x11')],_0x354855);_0x12fa90(_0x58366e[_0x111d('0x10')](0x1f4,_0x470531[_0x111d('0x11')]));});});}; \ No newline at end of file +var _0x0341=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes'];(function(_0x73a665,_0x6ed407){var _0x2fa8d8=function(_0x24916d){while(--_0x24916d){_0x73a665['push'](_0x73a665['shift']());}};_0x2fa8d8(++_0x6ed407);}(_0x0341,0x175));var _0x1034=function(_0x36e5ba,_0x13fbf6){_0x36e5ba=_0x36e5ba-0x0;var _0x4e5ce5=_0x0341[_0x36e5ba];return _0x4e5ce5;};'use strict';var _=require(_0x1034('0x0'));var util=require(_0x1034('0x1'));var moment=require(_0x1034('0x2'));var BPromise=require(_0x1034('0x3'));var rs=require(_0x1034('0x4'));var fs=require('fs');var Redis=require(_0x1034('0x5'));var db=require(_0x1034('0x6'))['db'];var utils=require(_0x1034('0x7'));var logger=require('../../config/logger')(_0x1034('0x8'));var config=require(_0x1034('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1034('0xa')][_0x1034('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6a0f,_0x543d86,_0x8fe533){return new BPromise(function(_0x1a54fd,_0x5181cf){return client[_0x1034('0xc')](_0x4c6a0f,_0x8fe533)[_0x1034('0xd')](function(_0x4a8e40){logger[_0x1034('0xe')](_0x1034('0xf'),_0x543d86,_0x1034('0x10'));logger[_0x1034('0x11')](_0x1034('0x12'),_0x543d86,_0x1034('0x10'),JSON[_0x1034('0x13')](_0x4a8e40));if(_0x4a8e40[_0x1034('0x14')]){if(_0x4a8e40[_0x1034('0x14')]['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x543d86,_0x4a8e40[_0x1034('0x14')][_0x1034('0x15')]);return _0x5181cf(_0x4a8e40['error']['message']);}logger[_0x1034('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x543d86,_0x4a8e40['error'][_0x1034('0x15')]);return _0x1a54fd(_0x4a8e40[_0x1034('0x14')]['message']);}else{logger[_0x1034('0xe')](_0x1034('0xf'),_0x543d86,_0x1034('0x10'));_0x1a54fd(_0x4a8e40[_0x1034('0x16')][_0x1034('0x15')]);}})['catch'](function(_0x2c983f){logger[_0x1034('0x14')](_0x1034('0xf'),_0x543d86,_0x2c983f);_0x5181cf(_0x2c983f);});});}exports[_0x1034('0x17')]=function(_0x2a7396){var _0x201fc8=this;return new Promise(function(_0x51413c,_0x26ea34){return db[_0x1034('0x18')][_0x1034('0x19')](_0x2a7396[_0x1034('0x1a')],{'raw':_0x2a7396[_0x1034('0x1b')]?_0x2a7396[_0x1034('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7396[_0x1034('0x1b')]?_0x2a7396[_0x1034('0x1b')][_0x1034('0x1c')]||null:null,'attributes':_0x2a7396[_0x1034('0x1b')]?_0x2a7396[_0x1034('0x1b')][_0x1034('0x1d')]||null:null,'limit':_0x2a7396['options']?_0x2a7396[_0x1034('0x1b')][_0x1034('0x1e')]||null:null})[_0x1034('0xd')](function(_0x4120e3){logger[_0x1034('0xe')](_0x1034('0x17'),_0x2a7396);logger[_0x1034('0x11')](_0x1034('0x17'),_0x2a7396,JSON[_0x1034('0x13')](_0x4120e3));_0x51413c(_0x4120e3);})['catch'](function(_0x22f707){logger[_0x1034('0x14')](_0x1034('0x17'),_0x22f707[_0x1034('0x15')],_0x2a7396);_0x26ea34(_0x201fc8['error'](0x1f4,_0x22f707[_0x1034('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 95df2ea..b79bc76 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 _0xf727=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','isAuthenticated','describe','/:id'];(function(_0x4e9704,_0x13fb4b){var _0x2e6b6a=function(_0x3d7a6b){while(--_0x3d7a6b){_0x4e9704['push'](_0x4e9704['shift']());}};_0x2e6b6a(++_0x13fb4b);}(_0xf727,0x1f2));var _0x7f72=function(_0x382664,_0x1fdc04){_0x382664=_0x382664-0x0;var _0x56acaa=_0xf727[_0x382664];return _0x56acaa;};'use strict';var multer=require(_0x7f72('0x0'));var util=require(_0x7f72('0x1'));var path=require(_0x7f72('0x2'));var timeout=require(_0x7f72('0x3'));var express=require(_0x7f72('0x4'));var router=express['Router']();var fs_extra=require(_0x7f72('0x5'));var auth=require(_0x7f72('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x7f72('0x7')]('/',auth['isAuthenticated'](),controller[_0x7f72('0x8')]);router[_0x7f72('0x7')]('/describe',auth[_0x7f72('0x9')](),controller[_0x7f72('0xa')]);router['get'](_0x7f72('0xb'),auth[_0x7f72('0x9')](),controller[_0x7f72('0xc')]);router[_0x7f72('0x7')](_0x7f72('0xd'),auth[_0x7f72('0x9')](),controller[_0x7f72('0xe')]);router[_0x7f72('0x7')](_0x7f72('0xf'),auth['isAuthenticated'](),controller[_0x7f72('0x10')]);router[_0x7f72('0x11')]('/',auth[_0x7f72('0x9')](),controller[_0x7f72('0x12')]);router[_0x7f72('0x11')](_0x7f72('0xd'),auth[_0x7f72('0x9')](),controller[_0x7f72('0x13')]);router[_0x7f72('0x11')]('/:id/tags',auth[_0x7f72('0x9')](),interaction[_0x7f72('0x14')]('openchannel',_0x7f72('0x15')),controller[_0x7f72('0x16')]);router[_0x7f72('0x17')]('/:id',auth[_0x7f72('0x9')](),interaction['tracked'](_0x7f72('0x18'),'openchannelinteraction:update'),controller[_0x7f72('0x19')]);router[_0x7f72('0x1a')](_0x7f72('0xb'),auth[_0x7f72('0x9')](),interaction['tracked'](_0x7f72('0x18'),'openchannelinteraction:destroy'),controller[_0x7f72('0x1b')]);router['delete'](_0x7f72('0x1c'),auth[_0x7f72('0x9')](),controller[_0x7f72('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x5d3c=['index','show','/:id/messages','getMessages','post','create','/:id/tags','openchannelinteraction:addtags','put','/:id','openchannel','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x133e15,_0x109fad){var _0x12b7d1=function(_0x254478){while(--_0x254478){_0x133e15['push'](_0x133e15['shift']());}};_0x12b7d1(++_0x109fad);}(_0x5d3c,0x12a));var _0xc5d3=function(_0x1d2632,_0x374a4c){_0x1d2632=_0x1d2632-0x0;var _0x362f30=_0x5d3c[_0x1d2632];return _0x362f30;};'use strict';var multer=require(_0xc5d3('0x0'));var util=require(_0xc5d3('0x1'));var path=require(_0xc5d3('0x2'));var timeout=require(_0xc5d3('0x3'));var express=require(_0xc5d3('0x4'));var router=express[_0xc5d3('0x5')]();var fs_extra=require(_0xc5d3('0x6'));var auth=require(_0xc5d3('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xc5d3('0x8')]('/',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xa')]);router['get']('/describe',auth[_0xc5d3('0x9')](),controller['describe']);router[_0xc5d3('0x8')]('/:id',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xb')]);router[_0xc5d3('0x8')](_0xc5d3('0xc'),auth['isAuthenticated'](),controller[_0xc5d3('0xd')]);router[_0xc5d3('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xc5d3('0xe')]('/',auth[_0xc5d3('0x9')](),controller[_0xc5d3('0xf')]);router['post'](_0xc5d3('0xc'),auth[_0xc5d3('0x9')](),controller['addMessage']);router[_0xc5d3('0xe')](_0xc5d3('0x10'),auth[_0xc5d3('0x9')](),interaction['tracked']('openchannel',_0xc5d3('0x11')),controller['addTags']);router[_0xc5d3('0x12')](_0xc5d3('0x13'),auth[_0xc5d3('0x9')](),interaction['tracked'](_0xc5d3('0x14'),_0xc5d3('0x15')),controller[_0xc5d3('0x16')]);router[_0xc5d3('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xc5d3('0x18')](_0xc5d3('0x14'),_0xc5d3('0x19')),controller[_0xc5d3('0x1a')]);router[_0xc5d3('0x17')](_0xc5d3('0x10'),auth[_0xc5d3('0x9')](),controller['removeTags']);module[_0xc5d3('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 16dee5f..11e1347 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 _0x63ef=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x151787,_0x77ec0f){var _0x35f544=function(_0x5c22d4){while(--_0x5c22d4){_0x151787['push'](_0x151787['shift']());}};_0x35f544(++_0x77ec0f);}(_0x63ef,0x11a));var _0xf63e=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x63ef[_0x5ce15c];return _0x36e4f5;};'use strict';var Sequelize=require(_0xf63e('0x0'));module[_0xf63e('0x1')]={'closed':{'type':Sequelize[_0xf63e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf63e('0x3')]},'secondDisposition':{'type':Sequelize[_0xf63e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf63e('0x4')]},'threadId':{'type':Sequelize[_0xf63e('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xf63e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf63e('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xf63e('0x5')]('in',_0xf63e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf63e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xf63e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf63e('0x7')]}}; \ No newline at end of file +var _0xc882=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xc882,0xff));var _0x2c88=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc882[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x2c88('0x0'));module[_0x2c88('0x1')]={'closed':{'type':Sequelize[_0x2c88('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2c88('0x3')]},'disposition':{'type':Sequelize[_0x2c88('0x4')]},'secondDisposition':{'type':Sequelize[_0x2c88('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2c88('0x4')]},'note':{'type':Sequelize[_0x2c88('0x4')]},'read1stAt':{'type':Sequelize[_0x2c88('0x3')]},'threadId':{'type':Sequelize[_0x2c88('0x4')]},'externalUrl':{'type':Sequelize[_0x2c88('0x4')]},'lastMsgAt':{'type':Sequelize[_0x2c88('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2c88('0x5')]('in',_0x2c88('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2c88('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2c88('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c1fdf6f..208a305 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 _0x00bf=['defaults','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','catch','from','params','model','keys','intersection','attributes','fields','length','includeAll','merge','create','body','find','describe','addMessage','OpenchannelMessage','ids','getMessages','filters','hasOwnProperty','order','sort','where','OpenchannelInteractionId','filter','split','options','rows','addTags','setTags','omit','color','emit','removeTags','download','unix','toString','root','files','tmp','join','attachments','push','User','fullname','firstName','lastName','Attachment','createdAt','secret','read','Account','get','mkdirSync','Openchannel','Owner','format','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','Private','Messages','basename','createReadStream','pipe','direction','out','System','Contact','renderFile','server','downloadInteraction.ejs','.pdf','createPdfFromHTML','error','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x00bf,0x15c));var _0xf00b=function(_0x41197a,_0xd1b91d){_0x41197a=_0x41197a-0x0;var _0x5b083e=_0x00bf[_0x41197a];return _0x5b083e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf00b('0x0'));var moment=require(_0xf00b('0x1'));var util=require(_0xf00b('0x2'));var path=require(_0xf00b('0x3'));var ejs=require(_0xf00b('0x4'));var fs=require('fs');var _=require(_0xf00b('0x5'));var Redis=require(_0xf00b('0x6'));var interaction=require(_0xf00b('0x7'));var qs=require(_0xf00b('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xf00b('0x9'))('api');var config=require(_0xf00b('0xa'));var db=require(_0xf00b('0xb'))['db'];config['redis']=_[_0xf00b('0xc')](config[_0xf00b('0xd')],{'host':_0xf00b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf00b('0xd')]));require(_0xf00b('0xf'))[_0xf00b('0x10')](socket);function respondWithStatusCode(_0x4ce85d,_0x208370){_0x208370=_0x208370||0xcc;return function(_0x488727){if(_0x488727){return _0x4ce85d[_0xf00b('0x11')](_0x208370);}return _0x4ce85d[_0xf00b('0x12')](_0x208370)[_0xf00b('0x13')]();};}function respondWithResult(_0xcf7ae0,_0x20d800){_0x20d800=_0x20d800||0xc8;return function(_0x319308){if(_0x319308){return _0xcf7ae0['status'](_0x20d800)['json'](_0x319308);}};}function respondWithFilteredResult(_0x32ad28,_0x11758d){return function(_0x2fe3a6){if(_0x2fe3a6){var _0x27b180=typeof _0x11758d[_0xf00b('0x14')]===_0xf00b('0x15')&&typeof _0x11758d[_0xf00b('0x16')]===_0xf00b('0x15');var _0x37d276=_0x2fe3a6[_0xf00b('0x17')];var _0x2872ae=_0x27b180?0x0:_0x11758d[_0xf00b('0x14')];var _0x47ed46=_0x27b180?_0x2fe3a6['count']:_0x11758d[_0xf00b('0x14')]+_0x11758d[_0xf00b('0x16')];var _0x4c84ae;if(_0x47ed46>=_0x37d276){_0x47ed46=_0x37d276;_0x4c84ae=0xc8;}else{_0x4c84ae=0xce;}_0x32ad28[_0xf00b('0x12')](_0x4c84ae);return _0x32ad28[_0xf00b('0x18')](_0xf00b('0x19'),_0x2872ae+'-'+_0x47ed46+'/'+_0x37d276)[_0xf00b('0x1a')](_0x2fe3a6);}return null;};}function saveUpdates(_0xf0f97){return function(_0x2a4303){if(_0x2a4303){return _0x2a4303[_0xf00b('0x1b')](_0xf0f97)[_0xf00b('0x1c')](function(_0x5bf418){return _0x5bf418;});}return null;};}function removeEntity(_0x2bfedf){return function(_0x3be7d8){if(_0x3be7d8){return _0x3be7d8[_0xf00b('0x1d')]()[_0xf00b('0x1c')](function(){_0x2bfedf[_0xf00b('0x12')](0xcc)[_0xf00b('0x13')]();});}};}function handleEntityNotFound(_0x1c3592){return function(_0x21da28){if(!_0x21da28){_0x1c3592[_0xf00b('0x11')](0x194);}return _0x21da28;};}function handleError(_0xf319bb,_0x37d093){_0x37d093=_0x37d093||0x1f4;return function(_0x938bff){logger['error'](_0x938bff[_0xf00b('0x1e')]);if(_0x938bff[_0xf00b('0x1f')]){delete _0x938bff['name'];}_0xf319bb[_0xf00b('0x12')](_0x37d093)['send'](_0x938bff);};}exports[_0xf00b('0x20')]=function(_0x42e6ff,_0x2e5226){var _0x31664a={};var _0xdbb755=_[_0xf00b('0x21')](db[_0xf00b('0x22')][_0xf00b('0x23')],function(_0x1acbd3){return{'name':_0x1acbd3[_0xf00b('0x24')],'type':_0x1acbd3[_0xf00b('0x25')]['key']};});_0x31664a=qs[_0xf00b('0x26')](_0xdbb755,_0x42e6ff);return interaction[_0xf00b('0x27')](_0xf00b('0x28'),_0x42e6ff[_0xf00b('0x29')],_0x42e6ff['user'],_0x31664a,_0xdbb755)['then'](respondWithFilteredResult(_0x2e5226,_0x31664a))[_0xf00b('0x2a')](handleError(_0x2e5226,null));};exports['show']=function(_0x1cccc1,_0x261310){var _0x433659={};if(_0x1cccc1[_0xf00b('0x29')]['type']&&_0x1cccc1[_0xf00b('0x29')][_0xf00b('0x25')]===_0xf00b('0x2b')){_0x433659['from']=_0x1cccc1[_0xf00b('0x2c')]['id'];}else{_0x433659['id']=_0x1cccc1['params']['id'];}var _0x3cd6f2={'raw':![],'where':_0x433659},_0x1aaa79={};_0x1aaa79[_0xf00b('0x2d')]=_[_0xf00b('0x2e')](db['OpenchannelInteraction']['rawAttributes']);_0x1aaa79['query']=_['keys'](_0x1cccc1[_0xf00b('0x29')]);_0x1aaa79['filters']=_[_0xf00b('0x2f')](_0x1aaa79[_0xf00b('0x2d')],_0x1aaa79[_0xf00b('0x29')]);_0x3cd6f2[_0xf00b('0x30')]=_['intersection'](_0x1aaa79[_0xf00b('0x2d')],qs[_0xf00b('0x31')](_0x1cccc1['query'][_0xf00b('0x31')]));_0x3cd6f2[_0xf00b('0x30')]=_0x3cd6f2['attributes'][_0xf00b('0x32')]?_0x3cd6f2[_0xf00b('0x30')]:_0x1aaa79['model'];if(_0x1cccc1[_0xf00b('0x29')][_0xf00b('0x33')]){_0x3cd6f2['include']=[{'all':!![]}];}_0x3cd6f2=_[_0xf00b('0x34')]({},_0x3cd6f2,_0x1cccc1['options']);return db[_0xf00b('0x22')]['find'](_0x3cd6f2)[_0xf00b('0x1c')](handleEntityNotFound(_0x261310,null))[_0xf00b('0x1c')](respondWithResult(_0x261310,null))[_0xf00b('0x2a')](handleError(_0x261310,null));};exports[_0xf00b('0x35')]=function(_0x3d1f2a,_0x5347e3){return db['OpenchannelInteraction'][_0xf00b('0x35')](_0x3d1f2a[_0xf00b('0x36')],{})['then'](respondWithResult(_0x5347e3,0xc9))[_0xf00b('0x2a')](handleError(_0x5347e3,null));};exports['update']=function(_0x15cb30,_0x119a17){if(_0x15cb30[_0xf00b('0x36')]['id']){delete _0x15cb30[_0xf00b('0x36')]['id'];}return db[_0xf00b('0x22')][_0xf00b('0x37')]({'where':{'id':_0x15cb30[_0xf00b('0x2c')]['id']}})[_0xf00b('0x1c')](handleEntityNotFound(_0x119a17,null))['then'](saveUpdates(_0x15cb30['body'],null))[_0xf00b('0x1c')](respondWithResult(_0x119a17,null))[_0xf00b('0x2a')](handleError(_0x119a17,null));};exports[_0xf00b('0x1d')]=function(_0x40d7c4,_0x45ca0c){return db[_0xf00b('0x22')][_0xf00b('0x37')]({'where':{'id':_0x40d7c4[_0xf00b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x45ca0c,null))['then'](removeEntity(_0x45ca0c,null))[_0xf00b('0x2a')](handleError(_0x45ca0c,null));};exports[_0xf00b('0x38')]=function(_0x260134,_0x12b20){return db['OpenchannelInteraction'][_0xf00b('0x38')]()[_0xf00b('0x1c')](respondWithResult(_0x12b20,null))['catch'](handleError(_0x12b20,null));};exports[_0xf00b('0x39')]=function(_0x1c079d,_0x49fce9){return db[_0xf00b('0x3a')][_0xf00b('0x37')]({'where':{'id':_0x1c079d[_0xf00b('0x2c')]['id']}})[_0xf00b('0x1c')](handleEntityNotFound(_0x49fce9,null))['then'](function(_0x29f7c5){if(_0x29f7c5){return _0x29f7c5['addMessage'](_0x1c079d['body'][_0xf00b('0x3b')],_['omit'](_0x1c079d[_0xf00b('0x36')],[_0xf00b('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x49fce9,null))[_0xf00b('0x2a')](handleError(_0x49fce9,null));};exports[_0xf00b('0x3c')]=function(_0x369a20,_0x14478b){var _0x32d47d={'raw':![],'where':{}};var _0x4dca68={};var _0x120d82={'count':0x0,'rows':[]};return db[_0xf00b('0x22')]['findOne']({'where':{'id':_0x369a20['params']['id']}})[_0xf00b('0x1c')](handleEntityNotFound(_0x14478b,null))[_0xf00b('0x1c')](function(_0xf6a86){if(_0xf6a86){_0x4dca68[_0xf00b('0x2d')]=_[_0xf00b('0x2e')](db['OpenchannelMessage'][_0xf00b('0x23')]);_0x4dca68[_0xf00b('0x29')]=_[_0xf00b('0x2e')](_0x369a20[_0xf00b('0x29')]);_0x4dca68[_0xf00b('0x3d')]=_['intersection'](_0x4dca68[_0xf00b('0x2d')],_0x4dca68['query']);_0x32d47d['attributes']=_['intersection'](_0x4dca68[_0xf00b('0x2d')],qs[_0xf00b('0x31')](_0x369a20[_0xf00b('0x29')]['fields']));_0x32d47d[_0xf00b('0x30')]=_0x32d47d[_0xf00b('0x30')][_0xf00b('0x32')]?_0x32d47d['attributes']:_0x4dca68[_0xf00b('0x2d')];if(!_0x369a20['query'][_0xf00b('0x3e')]('nolimit')){_0x32d47d[_0xf00b('0x16')]=qs['limit'](_0x369a20['query'][_0xf00b('0x16')]);_0x32d47d['offset']=qs[_0xf00b('0x14')](_0x369a20[_0xf00b('0x29')][_0xf00b('0x14')]);}_0x32d47d[_0xf00b('0x3f')]=qs[_0xf00b('0x40')](_0x369a20[_0xf00b('0x29')]['sort']);_0x32d47d[_0xf00b('0x41')]=qs[_0xf00b('0x3d')](_['pick'](_0x369a20[_0xf00b('0x29')],_0x4dca68[_0xf00b('0x3d')]));_0x32d47d[_0xf00b('0x41')][_0xf00b('0x42')]=_0xf6a86['id'];if(_0x369a20['query'][_0xf00b('0x43')]){_0x32d47d[_0xf00b('0x41')]=_[_0xf00b('0x34')](_0x32d47d[_0xf00b('0x41')],{'$or':_['map'](_0x32d47d[_0xf00b('0x30')],function(_0x1e68bd){var _0x3d61dd={};_0x3d61dd[_0x1e68bd]={'$like':'%'+_0x369a20[_0xf00b('0x29')]['filter']+'%'};return _0x3d61dd;})});}if(_0x369a20[_0xf00b('0x29')]['$gte']){var _0x467f58=_0x369a20[_0xf00b('0x29')]['$gte'][_0xf00b('0x44')](',');var _0x55866f={};_0x55866f[_0x467f58[0x0]]={'$gte':moment(_0x467f58[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x32d47d['where']=_['merge'](_0x32d47d[_0xf00b('0x41')],_0x55866f);}_0x32d47d=_[_0xf00b('0x34')]({},_0x32d47d,_0x369a20[_0xf00b('0x45')]);return db[_0xf00b('0x3a')][_0xf00b('0x17')]({'where':_0x32d47d[_0xf00b('0x41')]})[_0xf00b('0x1c')](function(_0x1619ba){_0x120d82[_0xf00b('0x17')]=_0x1619ba;if(_0x369a20[_0xf00b('0x29')][_0xf00b('0x33')]){_0x32d47d['include']=[{'all':!![]}];}return db[_0xf00b('0x3a')][_0xf00b('0x27')](_0x32d47d);})['then'](function(_0x4fca75){_0x120d82[_0xf00b('0x46')]=_0x4fca75;return _0x120d82;});}})[_0xf00b('0x1c')](respondWithFilteredResult(_0x14478b,_0x32d47d))['catch'](handleError(_0x14478b,null));};exports[_0xf00b('0x47')]=function(_0xeb77fa,_0x2899f1){return db[_0xf00b('0x22')]['find']({'where':{'id':_0xeb77fa[_0xf00b('0x2c')]['id']}})[_0xf00b('0x1c')](handleEntityNotFound(_0x2899f1,null))[_0xf00b('0x1c')](function(_0x219afa){if(_0x219afa){return _0x219afa[_0xf00b('0x48')](_0xeb77fa[_0xf00b('0x36')]['ids'],_[_0xf00b('0x49')](_0xeb77fa[_0xf00b('0x36')],[_0xf00b('0x3b'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xf00b('0x1f'),_0xf00b('0x4a')],'where':{'id':_0xeb77fa[_0xf00b('0x36')]['ids']}});})[_0xf00b('0x1c')](function(_0x3338df){socket[_0xf00b('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0xeb77fa[_0xf00b('0x2c')]['id']),'tags':_0x3338df||[]});return{'id':Number(_0xeb77fa[_0xf00b('0x2c')]['id']),'tags':_0x3338df||[]};});}})['then'](respondWithResult(_0x2899f1,null))[_0xf00b('0x2a')](handleError(_0x2899f1,null));};exports['removeTags']=function(_0x3b84a0,_0x1abfc3){return db[_0xf00b('0x22')][_0xf00b('0x37')]({'where':{'id':_0x3b84a0[_0xf00b('0x2c')]['id']}})[_0xf00b('0x1c')](handleEntityNotFound(_0x1abfc3,null))['then'](function(_0x495472){if(_0x495472){return _0x495472[_0xf00b('0x4c')](_0x3b84a0[_0xf00b('0x29')][_0xf00b('0x3b')]);}})[_0xf00b('0x1c')](respondWithStatusCode(_0x1abfc3,null))[_0xf00b('0x2a')](handleError(_0x1abfc3,null));};exports[_0xf00b('0x4d')]=function(_0x334c7b,_0x462a5f){var _0x3efd7e=moment()[_0xf00b('0x4e')]()[_0xf00b('0x4f')]();var _0x52ac95=path['join'](config[_0xf00b('0x50')],'server',_0xf00b('0x51'),_0xf00b('0x52'));var _0x28cf77=path[_0xf00b('0x53')](config['root'],'server',_0xf00b('0x51'),_0xf00b('0x54'));var _0x19c3b8=path['join'](_0x52ac95,_0x3efd7e);var _0x573608=util['format']('transcript-%d-%s.zip',_0x334c7b[_0xf00b('0x2c')]['id'],_0x3efd7e);var _0x58a98d=path[_0xf00b('0x53')](_0x52ac95,_0x573608);var _0x5f850=[];_0x5f850[_0xf00b('0x55')]({'model':db[_0xf00b('0x56')],'as':_0xf00b('0x56'),'attributes':['id',_0xf00b('0x57')],'raw':!![]});_0x5f850[_0xf00b('0x55')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf00b('0x58'),_0xf00b('0x59')],'raw':!![]});if(_0x334c7b[_0xf00b('0x29')]['attachments']){_0x5f850[_0xf00b('0x55')]({'model':db[_0xf00b('0x5a')],'as':_0xf00b('0x5a'),'raw':!![]});}var _0x1ed12d=[{'model':db[_0xf00b('0x3a')],'as':'Messages','attributes':['id',_0xf00b('0x36'),_0xf00b('0x5b'),'direction',_0xf00b('0x5c'),_0xf00b('0x5d')],'include':_0x5f850}];_0x1ed12d[_0xf00b('0x55')]({'model':db['OpenchannelAccount'],'as':_0xf00b('0x5e'),'attributes':['id','name']});_0x1ed12d[_0xf00b('0x55')]({'model':db['User'],'as':'Owner','attributes':['id',_0xf00b('0x57')]});return db[_0xf00b('0x22')][_0xf00b('0x37')]({'where':{'id':_0x334c7b[_0xf00b('0x2c')]['id']},'include':_0x1ed12d})[_0xf00b('0x1c')](handleEntityNotFound(_0x462a5f,null))[_0xf00b('0x1c')](function(_0xace3c2){if(_0xace3c2){var _0x6b1299=_0xace3c2[_0xf00b('0x5f')]({'plain':!![]});fs[_0xf00b('0x60')](_0x19c3b8);var _0x2e4b5e={'channel':_0xf00b('0x61'),'account':_0x6b1299[_0xf00b('0x5e')][_0xf00b('0x1f')],'agent':_0x6b1299[_0xf00b('0x62')]?_0x6b1299[_0xf00b('0x62')]['fullname']:'N.A.','createdAt':moment(_0x6b1299[_0xf00b('0x5b')])[_0xf00b('0x63')](_0xf00b('0x64'))[_0xf00b('0x4f')](),'closedAt':_0x6b1299[_0xf00b('0x65')]?moment(_0x6b1299['closedAt'])[_0xf00b('0x63')](_0xf00b('0x64'))[_0xf00b('0x4f')]():'','disposition':_0x6b1299[_0xf00b('0x66')],'visibility':_0x6b1299[_0xf00b('0x67')]?_0xf00b('0x68'):_0xf00b('0x69'),'messages':_(_0x6b1299[_0xf00b('0x6a')])[_0xf00b('0x43')]({'secret':![]})['map'](function(_0x3fde91){if(_0x3fde91['Attachment']){var _0x3f908e=path[_0xf00b('0x53')](_0x28cf77,_0x3fde91[_0xf00b('0x5a')][_0xf00b('0x6b')]);if(fs['existsSync'](_0x3f908e)){fs[_0xf00b('0x6c')](_0x3f908e)[_0xf00b('0x6d')](fs['createWriteStream'](path[_0xf00b('0x53')](_0x19c3b8,_0x3fde91[_0xf00b('0x5a')]['basename'])));}}return{'date':moment(_0x3fde91[_0xf00b('0x5b')])[_0xf00b('0x63')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf00b('0x4f')](),'sender':_0x3fde91[_0xf00b('0x6e')]===_0xf00b('0x6f')?_0x3fde91[_0xf00b('0x56')]?_0x3fde91[_0xf00b('0x56')][_0xf00b('0x57')]:_0xf00b('0x70'):_0x3fde91[_0xf00b('0x71')]['firstName']+(_0x3fde91['Contact']['lastName']?'\x20'+_0x3fde91[_0xf00b('0x71')][_0xf00b('0x59')]:''),'body':_0x3fde91[_0xf00b('0x5a')]?_0x3fde91[_0xf00b('0x5a')][_0xf00b('0x6b')]:_0x3fde91[_0xf00b('0x36')],'direction':_0x3fde91['direction']===_0xf00b('0x6f')?'A':'C','secret':_0x3fde91[_0xf00b('0x5c')],'read':_0x3fde91[_0xf00b('0x5d')],'attachment':_0x3fde91[_0xf00b('0x5a')]};})['value']()};return ejs[_0xf00b('0x72')](path[_0xf00b('0x53')](config[_0xf00b('0x50')],_0xf00b('0x73'),'views',_0xf00b('0x74')),{'interaction':_0x2e4b5e})[_0xf00b('0x1c')](function(_0x149424){var _0x24e61e=path[_0xf00b('0x53')](_0x19c3b8,'transcript-'+_0x6b1299['id']+'-'+_0x3efd7e+_0xf00b('0x75'));var _0x326ead={'path':_0x24e61e,'channel':_0xf00b('0x61'),'interactionId':_0x6b1299['id']};return pdf[_0xf00b('0x76')](_0x149424,_0x326ead);})[_0xf00b('0x1c')](function(){return new Promise(function(_0x210e13,_0x23f156){zipdir(_0x19c3b8,{'saveTo':_0x58a98d},function(_0x5d5aad,_0x523841){if(_0x5d5aad)return _0x23f156(_0x5d5aad);return _0x210e13(_0x523841);});})[_0xf00b('0x1c')](function(){return new Promise(function(_0x3a80c6,_0x8ee5fd){rimraf(_0x19c3b8,function(_0x46c116){if(_0x46c116)_0x8ee5fd(_0x46c116);return _0x3a80c6();});});})['then'](function(){return _0x462a5f['download'](_0x58a98d,_0x573608,function(_0x38cc0f){if(_0x38cc0f){logger[_0xf00b('0x77')]('Unable\x20to\x20delete\x20zip\x20file',_0x38cc0f);}else{fs['unlinkSync'](_0x58a98d);}});});});}else{return _0x462a5f[_0xf00b('0x11')](0xc8);}})[_0xf00b('0x2a')](handleError(_0x462a5f,null));}; \ No newline at end of file +var _0xb14a=['OpenchannelInteraction','rawAttributes','fieldName','key','findAll','openchannel','query','catch','type','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','merge','options','addTags','setTags','omit','spread','color','emit','removeTags','toString','root','server','tmp','join','files','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','redis','localhost','./openchannelInteraction.socket','register','end','status','json','count','offset','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','map'];(function(_0xeaba4b,_0x1eab4b){var _0x32f4fd=function(_0x43ec5b){while(--_0x43ec5b){_0xeaba4b['push'](_0xeaba4b['shift']());}};_0x32f4fd(++_0x1eab4b);}(_0xb14a,0xdf));var _0xab14=function(_0x1bbf60,_0x5f47ee){_0x1bbf60=_0x1bbf60-0x0;var _0x1adbd6=_0xb14a[_0x1bbf60];return _0x1adbd6;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xab14('0x0'));var moment=require(_0xab14('0x1'));var util=require(_0xab14('0x2'));var path=require(_0xab14('0x3'));var ejs=require(_0xab14('0x4'));var fs=require('fs');var _=require(_0xab14('0x5'));var Redis=require(_0xab14('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xab14('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xab14('0x8'));var config=require('../../config/environment');var db=require(_0xab14('0x9'))['db'];config['redis']=_[_0xab14('0xa')](config[_0xab14('0xb')],{'host':_0xab14('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab14('0xd'))[_0xab14('0xe')](socket);function respondWithStatusCode(_0x4e74d1,_0x10c9b8){_0x10c9b8=_0x10c9b8||0xcc;return function(_0x39334f){if(_0x39334f){return _0x4e74d1['sendStatus'](_0x10c9b8);}return _0x4e74d1['status'](_0x10c9b8)[_0xab14('0xf')]();};}function respondWithResult(_0xdc07d9,_0x2486ee){_0x2486ee=_0x2486ee||0xc8;return function(_0x113b03){if(_0x113b03){return _0xdc07d9[_0xab14('0x10')](_0x2486ee)[_0xab14('0x11')](_0x113b03);}};}function respondWithFilteredResult(_0x1dd5ab,_0x16cbe7){return function(_0x32c253){if(_0x32c253){var _0x2c1ff3=typeof _0x16cbe7['offset']==='undefined'&&typeof _0x16cbe7['limit']==='undefined';var _0x1497fa=_0x32c253[_0xab14('0x12')];var _0x58c055=_0x2c1ff3?0x0:_0x16cbe7[_0xab14('0x13')];var _0xdc6bb6=_0x2c1ff3?_0x32c253[_0xab14('0x12')]:_0x16cbe7[_0xab14('0x13')]+_0x16cbe7[_0xab14('0x14')];var _0x45f30d;if(_0xdc6bb6>=_0x1497fa){_0xdc6bb6=_0x1497fa;_0x45f30d=0xc8;}else{_0x45f30d=0xce;}_0x1dd5ab['status'](_0x45f30d);return _0x1dd5ab[_0xab14('0x15')](_0xab14('0x16'),_0x58c055+'-'+_0xdc6bb6+'/'+_0x1497fa)[_0xab14('0x11')](_0x32c253);}return null;};}function saveUpdates(_0x2fcde4){return function(_0x1ab290){if(_0x1ab290){return _0x1ab290[_0xab14('0x17')](_0x2fcde4)[_0xab14('0x18')](function(_0x4ecb3c){return _0x4ecb3c;});}return null;};}function removeEntity(_0x5ab8ef){return function(_0x5d57c6){if(_0x5d57c6){return _0x5d57c6['destroy']()[_0xab14('0x18')](function(){_0x5ab8ef[_0xab14('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1520){return function(_0x92d555){if(!_0x92d555){_0x1e1520[_0xab14('0x19')](0x194);}return _0x92d555;};}function handleError(_0x4697d4,_0x255488){_0x255488=_0x255488||0x1f4;return function(_0x48395e){logger[_0xab14('0x1a')](_0x48395e[_0xab14('0x1b')]);if(_0x48395e[_0xab14('0x1c')]){delete _0x48395e['name'];}_0x4697d4[_0xab14('0x10')](_0x255488)[_0xab14('0x1d')](_0x48395e);};}exports['index']=function(_0x5d5976,_0x41951d){var _0x5561a7={};var _0x2dd29e=_[_0xab14('0x1e')](db[_0xab14('0x1f')][_0xab14('0x20')],function(_0x12bbfc){return{'name':_0x12bbfc[_0xab14('0x21')],'type':_0x12bbfc['type'][_0xab14('0x22')]};});_0x5561a7=qs['getOptions'](_0x2dd29e,_0x5d5976);return interaction[_0xab14('0x23')](_0xab14('0x24'),_0x5d5976[_0xab14('0x25')],_0x5d5976['user'],_0x5561a7,_0x2dd29e)[_0xab14('0x18')](respondWithFilteredResult(_0x41951d,_0x5561a7))[_0xab14('0x26')](handleError(_0x41951d,null));};exports['show']=function(_0x15adb8,_0x33d0be){var _0x510fc8={};if(_0x15adb8[_0xab14('0x25')][_0xab14('0x27')]&&_0x15adb8['query'][_0xab14('0x27')]==='from'){_0x510fc8[_0xab14('0x28')]=_0x15adb8[_0xab14('0x29')]['id'];}else{_0x510fc8['id']=_0x15adb8[_0xab14('0x29')]['id'];}var _0x2134a7={'raw':![],'where':_0x510fc8},_0xe69391={};_0xe69391[_0xab14('0x2a')]=_[_0xab14('0x2b')](db[_0xab14('0x1f')][_0xab14('0x20')]);_0xe69391[_0xab14('0x25')]=_['keys'](_0x15adb8[_0xab14('0x25')]);_0xe69391[_0xab14('0x2c')]=_[_0xab14('0x2d')](_0xe69391[_0xab14('0x2a')],_0xe69391[_0xab14('0x25')]);_0x2134a7[_0xab14('0x2e')]=_['intersection'](_0xe69391[_0xab14('0x2a')],qs[_0xab14('0x2f')](_0x15adb8[_0xab14('0x25')][_0xab14('0x2f')]));_0x2134a7[_0xab14('0x2e')]=_0x2134a7[_0xab14('0x2e')][_0xab14('0x30')]?_0x2134a7[_0xab14('0x2e')]:_0xe69391[_0xab14('0x2a')];if(_0x15adb8['query'][_0xab14('0x31')]){_0x2134a7[_0xab14('0x32')]=[{'all':!![]}];}_0x2134a7=_['merge']({},_0x2134a7,_0x15adb8['options']);return db[_0xab14('0x1f')][_0xab14('0x33')](_0x2134a7)[_0xab14('0x18')](handleEntityNotFound(_0x33d0be,null))[_0xab14('0x18')](respondWithResult(_0x33d0be,null))[_0xab14('0x26')](handleError(_0x33d0be,null));};exports[_0xab14('0x34')]=function(_0x3b2a47,_0x19afb1){return db['OpenchannelInteraction'][_0xab14('0x34')](_0x3b2a47[_0xab14('0x35')],{})[_0xab14('0x18')](respondWithResult(_0x19afb1,0xc9))[_0xab14('0x26')](handleError(_0x19afb1,null));};exports[_0xab14('0x17')]=function(_0x237a6d,_0x2d27a2){if(_0x237a6d[_0xab14('0x35')]['id']){delete _0x237a6d[_0xab14('0x35')]['id'];}return db[_0xab14('0x1f')]['find']({'where':{'id':_0x237a6d[_0xab14('0x29')]['id']}})[_0xab14('0x18')](handleEntityNotFound(_0x2d27a2,null))[_0xab14('0x18')](saveUpdates(_0x237a6d[_0xab14('0x35')],null))[_0xab14('0x18')](respondWithResult(_0x2d27a2,null))[_0xab14('0x26')](handleError(_0x2d27a2,null));};exports['destroy']=function(_0x112375,_0x19fc74){return db[_0xab14('0x1f')][_0xab14('0x33')]({'where':{'id':_0x112375[_0xab14('0x29')]['id']}})[_0xab14('0x18')](handleEntityNotFound(_0x19fc74,null))[_0xab14('0x18')](removeEntity(_0x19fc74,null))[_0xab14('0x26')](handleError(_0x19fc74,null));};exports['describe']=function(_0x56b955,_0x19af61){return db[_0xab14('0x1f')][_0xab14('0x36')]()['then'](respondWithResult(_0x19af61,null))[_0xab14('0x26')](handleError(_0x19af61,null));};exports[_0xab14('0x37')]=function(_0x59c23b,_0x49fc98){return db[_0xab14('0x38')][_0xab14('0x33')]({'where':{'id':_0x59c23b[_0xab14('0x29')]['id']}})['then'](handleEntityNotFound(_0x49fc98,null))[_0xab14('0x18')](function(_0x32c710){if(_0x32c710){return _0x32c710[_0xab14('0x37')](_0x59c23b[_0xab14('0x35')][_0xab14('0x39')],_['omit'](_0x59c23b[_0xab14('0x35')],[_0xab14('0x39'),'id'])||{});}})[_0xab14('0x18')](respondWithResult(_0x49fc98,null))['catch'](handleError(_0x49fc98,null));};exports[_0xab14('0x3a')]=function(_0x501bf4,_0x19cdf1){var _0x3a1a42={'raw':![],'where':{}};var _0xdea58={};var _0x3d71e2={'count':0x0,'rows':[]};return db[_0xab14('0x1f')][_0xab14('0x3b')]({'where':{'id':_0x501bf4['params']['id']}})[_0xab14('0x18')](handleEntityNotFound(_0x19cdf1,null))[_0xab14('0x18')](function(_0x4b1853){if(_0x4b1853){_0xdea58[_0xab14('0x2a')]=_['keys'](db[_0xab14('0x38')]['rawAttributes']);_0xdea58[_0xab14('0x25')]=_[_0xab14('0x2b')](_0x501bf4[_0xab14('0x25')]);_0xdea58[_0xab14('0x2c')]=_[_0xab14('0x2d')](_0xdea58[_0xab14('0x2a')],_0xdea58[_0xab14('0x25')]);_0x3a1a42['attributes']=_['intersection'](_0xdea58['model'],qs[_0xab14('0x2f')](_0x501bf4[_0xab14('0x25')][_0xab14('0x2f')]));_0x3a1a42[_0xab14('0x2e')]=_0x3a1a42['attributes'][_0xab14('0x30')]?_0x3a1a42[_0xab14('0x2e')]:_0xdea58[_0xab14('0x2a')];if(!_0x501bf4['query'][_0xab14('0x3c')](_0xab14('0x3d'))){_0x3a1a42[_0xab14('0x14')]=qs[_0xab14('0x14')](_0x501bf4['query'][_0xab14('0x14')]);_0x3a1a42[_0xab14('0x13')]=qs[_0xab14('0x13')](_0x501bf4['query'][_0xab14('0x13')]);}_0x3a1a42[_0xab14('0x3e')]=qs[_0xab14('0x3f')](_0x501bf4['query'][_0xab14('0x3f')]);_0x3a1a42[_0xab14('0x40')]=qs[_0xab14('0x2c')](_[_0xab14('0x41')](_0x501bf4['query'],_0xdea58[_0xab14('0x2c')]));_0x3a1a42['where'][_0xab14('0x42')]=_0x4b1853['id'];if(_0x501bf4['query'][_0xab14('0x43')]){_0x3a1a42[_0xab14('0x40')]=_['merge'](_0x3a1a42[_0xab14('0x40')],{'$or':_['map'](_0x3a1a42[_0xab14('0x2e')],function(_0x4afc6e){var _0x1cadf6={};_0x1cadf6[_0x4afc6e]={'$like':'%'+_0x501bf4['query'][_0xab14('0x43')]+'%'};return _0x1cadf6;})});}if(_0x501bf4[_0xab14('0x25')][_0xab14('0x44')]){var _0x280245=_0x501bf4[_0xab14('0x25')][_0xab14('0x44')]['split'](',');var _0x5e2904={};_0x5e2904[_0x280245[0x0]]={'$gte':moment(_0x280245[0x1])['format'](_0xab14('0x45'))};_0x3a1a42['where']=_[_0xab14('0x46')](_0x3a1a42[_0xab14('0x40')],_0x5e2904);}_0x3a1a42=_['merge']({},_0x3a1a42,_0x501bf4[_0xab14('0x47')]);return db['OpenchannelMessage'][_0xab14('0x12')]({'where':_0x3a1a42[_0xab14('0x40')]})[_0xab14('0x18')](function(_0x2f0658){_0x3d71e2[_0xab14('0x12')]=_0x2f0658;if(_0x501bf4[_0xab14('0x25')][_0xab14('0x31')]){_0x3a1a42[_0xab14('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xab14('0x23')](_0x3a1a42);})[_0xab14('0x18')](function(_0x35ea70){_0x3d71e2['rows']=_0x35ea70;return _0x3d71e2;});}})[_0xab14('0x18')](respondWithFilteredResult(_0x19cdf1,_0x3a1a42))['catch'](handleError(_0x19cdf1,null));};exports[_0xab14('0x48')]=function(_0x427e03,_0x56254b){return db['OpenchannelInteraction'][_0xab14('0x33')]({'where':{'id':_0x427e03['params']['id']}})[_0xab14('0x18')](handleEntityNotFound(_0x56254b,null))['then'](function(_0x40b51f){if(_0x40b51f){return _0x40b51f[_0xab14('0x49')](_0x427e03[_0xab14('0x35')]['ids'],_[_0xab14('0x4a')](_0x427e03[_0xab14('0x35')],[_0xab14('0x39'),'id'])||{})[_0xab14('0x4b')](function(){return db['Tag'][_0xab14('0x23')]({'attributes':['id',_0xab14('0x1c'),_0xab14('0x4c')],'where':{'id':_0x427e03[_0xab14('0x35')][_0xab14('0x39')]}});})[_0xab14('0x18')](function(_0xd89b1a){socket[_0xab14('0x4d')]('openchannelInteractionTags:save',{'id':Number(_0x427e03[_0xab14('0x29')]['id']),'tags':_0xd89b1a||[]});return{'id':Number(_0x427e03[_0xab14('0x29')]['id']),'tags':_0xd89b1a||[]};});}})[_0xab14('0x18')](respondWithResult(_0x56254b,null))[_0xab14('0x26')](handleError(_0x56254b,null));};exports[_0xab14('0x4e')]=function(_0x4ac13c,_0x569c62){return db[_0xab14('0x1f')][_0xab14('0x33')]({'where':{'id':_0x4ac13c[_0xab14('0x29')]['id']}})['then'](handleEntityNotFound(_0x569c62,null))[_0xab14('0x18')](function(_0x51190f){if(_0x51190f){return _0x51190f[_0xab14('0x4e')](_0x4ac13c[_0xab14('0x25')][_0xab14('0x39')]);}})[_0xab14('0x18')](respondWithStatusCode(_0x569c62,null))[_0xab14('0x26')](handleError(_0x569c62,null));};exports['download']=function(_0x595693,_0x3b0d5c){var _0xa3e1a2=moment()['unix']()[_0xab14('0x4f')]();var _0x1d2206=path['join'](config[_0xab14('0x50')],_0xab14('0x51'),'files',_0xab14('0x52'));var _0x592124=path[_0xab14('0x53')](config[_0xab14('0x50')],'server',_0xab14('0x54'),'attachments');var _0x1f803a=path[_0xab14('0x53')](_0x1d2206,_0xa3e1a2);var _0x5b6b2d=util[_0xab14('0x55')](_0xab14('0x56'),_0x595693['params']['id'],_0xa3e1a2);var _0x326ae6=path['join'](_0x1d2206,_0x5b6b2d);var _0x3580e9=[];_0x3580e9[_0xab14('0x57')]({'model':db[_0xab14('0x58')],'as':_0xab14('0x58'),'attributes':['id',_0xab14('0x59')],'raw':!![]});_0x3580e9[_0xab14('0x57')]({'model':db['CmContact'],'as':_0xab14('0x5a'),'attributes':['id',_0xab14('0x5b'),_0xab14('0x5c')],'raw':!![]});if(_0x595693[_0xab14('0x25')][_0xab14('0x5d')]){_0x3580e9[_0xab14('0x57')]({'model':db['Attachment'],'as':_0xab14('0x5e'),'raw':!![]});}var _0x2ed075=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xab14('0x35'),_0xab14('0x5f'),_0xab14('0x60'),_0xab14('0x61'),_0xab14('0x62')],'include':_0x3580e9}];_0x2ed075['push']({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id','name']});_0x2ed075[_0xab14('0x57')]({'model':db[_0xab14('0x58')],'as':_0xab14('0x63'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xab14('0x33')]({'where':{'id':_0x595693['params']['id']},'include':_0x2ed075})[_0xab14('0x18')](handleEntityNotFound(_0x3b0d5c,null))[_0xab14('0x18')](function(_0x3c776a){if(_0x3c776a){var _0x5cbccc=_0x3c776a[_0xab14('0x64')]({'plain':!![]});fs[_0xab14('0x65')](_0x1f803a);var _0xb04c72={'channel':_0xab14('0x66'),'account':_0x5cbccc[_0xab14('0x67')][_0xab14('0x1c')],'agent':_0x5cbccc['Owner']?_0x5cbccc[_0xab14('0x63')]['fullname']:_0xab14('0x68'),'createdAt':moment(_0x5cbccc['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xab14('0x4f')](),'closedAt':_0x5cbccc[_0xab14('0x69')]?moment(_0x5cbccc[_0xab14('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xab14('0x4f')]():'','disposition':_0x5cbccc[_0xab14('0x6b')],'visibility':_0x5cbccc['threadId']?_0xab14('0x6c'):_0xab14('0x6d'),'messages':_(_0x5cbccc['Messages'])[_0xab14('0x43')]({'secret':![]})['map'](function(_0x221a74){if(_0x221a74[_0xab14('0x5e')]){var _0x42f0b8=path[_0xab14('0x53')](_0x592124,_0x221a74['Attachment'][_0xab14('0x6e')]);if(fs[_0xab14('0x6f')](_0x42f0b8)){fs[_0xab14('0x70')](_0x42f0b8)[_0xab14('0x71')](fs[_0xab14('0x72')](path[_0xab14('0x53')](_0x1f803a,_0x221a74[_0xab14('0x5e')][_0xab14('0x6e')])));}}return{'date':moment(_0x221a74['createdAt'])['format'](_0xab14('0x45'))[_0xab14('0x4f')](),'sender':_0x221a74['direction']===_0xab14('0x73')?_0x221a74[_0xab14('0x58')]?_0x221a74[_0xab14('0x58')][_0xab14('0x59')]:_0xab14('0x74'):_0x221a74[_0xab14('0x5a')]['firstName']+(_0x221a74['Contact'][_0xab14('0x5c')]?'\x20'+_0x221a74[_0xab14('0x5a')][_0xab14('0x5c')]:''),'body':_0x221a74[_0xab14('0x5e')]?_0x221a74[_0xab14('0x5e')][_0xab14('0x6e')]:_0x221a74[_0xab14('0x35')],'direction':_0x221a74[_0xab14('0x60')]==='out'?'A':'C','secret':_0x221a74[_0xab14('0x61')],'read':_0x221a74[_0xab14('0x62')],'attachment':_0x221a74['Attachment']};})[_0xab14('0x75')]()};return ejs[_0xab14('0x76')](path[_0xab14('0x53')](config[_0xab14('0x50')],_0xab14('0x51'),_0xab14('0x77'),_0xab14('0x78')),{'interaction':_0xb04c72})['then'](function(_0x3274b1){var _0x5da39b=path['join'](_0x1f803a,_0xab14('0x79')+_0x5cbccc['id']+'-'+_0xa3e1a2+_0xab14('0x7a'));var _0xb89469={'path':_0x5da39b,'channel':_0xab14('0x66'),'interactionId':_0x5cbccc['id']};return pdf[_0xab14('0x7b')](_0x3274b1,_0xb89469);})[_0xab14('0x18')](function(){return new Promise(function(_0x48fce2,_0x510dac){zipdir(_0x1f803a,{'saveTo':_0x326ae6},function(_0x4db156,_0x234401){if(_0x4db156)return _0x510dac(_0x4db156);return _0x48fce2(_0x234401);});})['then'](function(){return new Promise(function(_0x3581ef,_0x1f2364){rimraf(_0x1f803a,function(_0x218660){if(_0x218660)_0x1f2364(_0x218660);return _0x3581ef();});});})['then'](function(){return _0x3b0d5c[_0xab14('0x7c')](_0x326ae6,_0x5b6b2d,function(_0x1876c6){if(_0x1876c6){logger[_0xab14('0x1a')](_0xab14('0x7d'),_0x1876c6);}else{fs[_0xab14('0x7e')](_0x326ae6);}});});});}else{return _0x3b0d5c[_0xab14('0x19')](0xc8);}})[_0xab14('0x26')](handleError(_0x3b0d5c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9375c25..f948de3 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 _0x3c57=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','unreadMessages'];(function(_0x2fe780,_0x2f3093){var _0x1200a6=function(_0x3748c6){while(--_0x3748c6){_0x2fe780['push'](_0x2fe780['shift']());}};_0x1200a6(++_0x2f3093);}(_0x3c57,0x1f1));var _0x73c5=function(_0x4d5b88,_0x4304bf){_0x4d5b88=_0x4d5b88-0x0;var _0x4a5d44=_0x3c57[_0x4d5b88];return _0x4a5d44;};'use strict';var EventEmitter=require(_0x73c5('0x0'));var OpenchannelInteraction=require(_0x73c5('0x1'))['db'][_0x73c5('0x2')];var OpenchannelMessage=require(_0x73c5('0x1'))['db'][_0x73c5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x73c5('0x4')](0x0);var events={'afterCreate':_0x73c5('0x5'),'afterUpdate':'update','afterDestroy':_0x73c5('0x6')};function emitEvent(_0x3d0abe){return function(_0x433707,_0x583480,_0x30626d){_0x433707[_0x73c5('0x7')]({'attributes':['id'],'raw':!![]})[_0x73c5('0x8')](function(_0x4cee49){_0x433707['setDataValue'](_0x73c5('0x9'),_0x4cee49[_0x73c5('0xa')](function(_0x1c3ba4){return{'id':_0x1c3ba4['id']};}));return OpenchannelMessage[_0x73c5('0xb')]({'where':{'OpenchannelInteractionId':_0x433707['id'],'direction':'in','read':![]},'raw':!![]});})[_0x73c5('0x8')](function(_0x46bf49){_0x433707['setDataValue'](_0x73c5('0xc'),_0x46bf49['length']);OpenchannelInteractionEvents[_0x73c5('0xd')](_0x3d0abe+':'+_0x433707['id'],_0x433707);OpenchannelInteractionEvents[_0x73c5('0xd')](_0x3d0abe,_0x433707);_0x30626d(null);})[_0x73c5('0xe')](_0x30626d(null));};}for(var e in events){if(events[_0x73c5('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x73c5('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x421a=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','then','setDataValue','Users'];(function(_0x518d42,_0x39bf83){var _0x4c3861=function(_0x1b03ef){while(--_0x1b03ef){_0x518d42['push'](_0x518d42['shift']());}};_0x4c3861(++_0x39bf83);}(_0x421a,0x13b));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xa421('0x0'))['db'][_0xa421('0x1')];var OpenchannelMessage=require(_0xa421('0x0'))['db'][_0xa421('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa421('0x3')](0x0);var events={'afterCreate':_0xa421('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7334dd){return function(_0x36056e,_0xee3f09,_0x42422d){_0x36056e['getUsers']({'attributes':['id'],'raw':!![]})[_0xa421('0x5')](function(_0x148266){_0x36056e[_0xa421('0x6')](_0xa421('0x7'),_0x148266[_0xa421('0x8')](function(_0xd993d){return{'id':_0xd993d['id']};}));return OpenchannelMessage[_0xa421('0x9')]({'where':{'OpenchannelInteractionId':_0x36056e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x387132){_0x36056e[_0xa421('0x6')](_0xa421('0xa'),_0x387132[_0xa421('0xb')]);OpenchannelInteractionEvents['emit'](_0x7334dd+':'+_0x36056e['id'],_0x36056e);OpenchannelInteractionEvents[_0xa421('0xc')](_0x7334dd,_0x36056e);_0x42422d(null);})[_0xa421('0xd')](_0x42422d(null));};}for(var e in events){if(events[_0xa421('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xa421('0xf')](e,emitEvent(event));}}module[_0xa421('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 82b4bb3..4394b13 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 _0x1357=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','closed'];(function(_0x4b068a,_0x3cd89f){var _0x4a92e5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x4b068a['push'](_0x4b068a['shift']());}};_0x4a92e5(++_0x3cd89f);}(_0x1357,0x1b3));var _0x7135=function(_0x313b01,_0x3532e5){_0x313b01=_0x313b01-0x0;var _0xa1a400=_0x1357[_0x313b01];return _0xa1a400;};'use strict';var _=require(_0x7135('0x0'));var util=require(_0x7135('0x1'));var logger=require(_0x7135('0x2'))('api');var moment=require(_0x7135('0x3'));var BPromise=require(_0x7135('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7135('0x5'));var rimraf=require(_0x7135('0x6'));var config=require('../../config/environment');var attributes=require(_0x7135('0x7'));module[_0x7135('0x8')]=function(_0x17206b,_0x2e20e5){return _0x17206b[_0x7135('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x7135('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7135('0xb'),'hooks':{'beforeUpdate':function(_0x47df87,_0x285cd5,_0x13b2d5){if(_0x47df87['changed'](_0x7135('0xc'))){_0x47df87[_0x7135('0xd')]=moment()[_0x7135('0xe')](_0x7135('0xf'));}_0x13b2d5(null,_0x47df87);}}});}; \ No newline at end of file +var _0xdb8b=['exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x4aadbc,_0x4afc4d){var _0x372f33=function(_0xc50454){while(--_0xc50454){_0x4aadbc['push'](_0x4aadbc['shift']());}};_0x372f33(++_0x4afc4d);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x30e421,_0x38d978){_0x30e421=_0x30e421-0x0;var _0x56a0a2=_0xdb8b[_0x30e421];return _0x56a0a2;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var logger=require(_0xbdb8('0x1'))(_0xbdb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbdb8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var attributes=require(_0xbdb8('0x6'));module[_0xbdb8('0x7')]=function(_0x4c6bdb,_0x7affe8){return _0x4c6bdb['define'](_0xbdb8('0x8'),attributes,{'tableName':_0xbdb8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbdb8('0xa'),'collate':_0xbdb8('0xb'),'hooks':{'beforeUpdate':function(_0x2525e2,_0x8b1e35,_0x50f80a){if(_0x2525e2[_0xbdb8('0xc')](_0xbdb8('0xd'))){_0x2525e2[_0xbdb8('0xe')]=moment()[_0xbdb8('0xf')](_0xbdb8('0x10'));}_0x50f80a(null,_0x2525e2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 86cfa3f..d4e70d2 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 _0x88b1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','AddTagsToOpenchannelInteraction','where','addTags','ids','spread','AddTags','util','moment'];(function(_0xd50a2b,_0x3f7e2c){var _0x131344=function(_0x4be738){while(--_0x4be738){_0xd50a2b['push'](_0xd50a2b['shift']());}};_0x131344(++_0x3f7e2c);}(_0x88b1,0x101));var _0x188b=function(_0x369286,_0x566877){_0x369286=_0x369286-0x0;var _0x5e20ff=_0x88b1[_0x369286];return _0x5e20ff;};'use strict';var _=require('lodash');var util=require(_0x188b('0x0'));var moment=require(_0x188b('0x1'));var BPromise=require(_0x188b('0x2'));var rs=require(_0x188b('0x3'));var fs=require('fs');var Redis=require(_0x188b('0x4'));var db=require(_0x188b('0x5'))['db'];var utils=require(_0x188b('0x6'));var logger=require('../../config/logger')(_0x188b('0x7'));var config=require(_0x188b('0x8'));var jayson=require(_0x188b('0x9'));var client=jayson[_0x188b('0xa')][_0x188b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x188b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x188b('0xc')]));require(_0x188b('0xd'))[_0x188b('0xe')](socket);function respondWithRpcPromise(_0x3569ae,_0xe9b6d4,_0x1a08e1){return new BPromise(function(_0x10ead6,_0x456937){return client[_0x188b('0xf')](_0x3569ae,_0x1a08e1)[_0x188b('0x10')](function(_0x4ab3c0){logger[_0x188b('0x11')](_0x188b('0x12'),_0xe9b6d4,_0x188b('0x13'));logger[_0x188b('0x14')](_0x188b('0x15'),_0xe9b6d4,'request\x20sent',JSON[_0x188b('0x16')](_0x4ab3c0));if(_0x4ab3c0[_0x188b('0x17')]){if(_0x4ab3c0[_0x188b('0x17')][_0x188b('0x18')]===0x1f4){logger[_0x188b('0x17')](_0x188b('0x12'),_0xe9b6d4,_0x4ab3c0[_0x188b('0x17')]['message']);return _0x456937(_0x4ab3c0[_0x188b('0x17')]['message']);}logger[_0x188b('0x17')](_0x188b('0x12'),_0xe9b6d4,_0x4ab3c0[_0x188b('0x17')][_0x188b('0x19')]);return _0x10ead6(_0x4ab3c0[_0x188b('0x17')][_0x188b('0x19')]);}else{logger['info'](_0x188b('0x12'),_0xe9b6d4,_0x188b('0x13'));_0x10ead6(_0x4ab3c0['result'][_0x188b('0x19')]);}})[_0x188b('0x1a')](function(_0x4babf3){logger[_0x188b('0x17')](_0x188b('0x12'),_0xe9b6d4,_0x4babf3);_0x456937(_0x4babf3);});});}exports[_0x188b('0x1b')]=function(_0x37075b){var _0x2ee91d=this;return new Promise(function(_0x5bc0c3,_0x5df77e){return db[_0x188b('0x1c')]['update'](_0x37075b[_0x188b('0x1d')],{'raw':_0x37075b[_0x188b('0x1e')]?_0x37075b[_0x188b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37075b[_0x188b('0x1e')]?_0x37075b[_0x188b('0x1e')]['where']||null:null,'attributes':_0x37075b[_0x188b('0x1e')]?_0x37075b['options']['attributes']||null:null,'limit':_0x37075b[_0x188b('0x1e')]?_0x37075b[_0x188b('0x1e')]['limit']||null:null})[_0x188b('0x10')](function(_0x5e730c){logger[_0x188b('0x11')]('UpdateOpenchannelInteraction',_0x37075b);logger[_0x188b('0x14')]('UpdateOpenchannelInteraction',_0x37075b,JSON[_0x188b('0x16')](_0x5e730c));_0x5bc0c3(_0x5e730c);})[_0x188b('0x1a')](function(_0x51fdb3){logger[_0x188b('0x17')]('UpdateOpenchannelInteraction',_0x51fdb3['message'],_0x37075b);_0x5df77e(_0x2ee91d[_0x188b('0x17')](0x1f4,_0x51fdb3[_0x188b('0x19')]));});});};exports[_0x188b('0x1f')]=function(_0x39c731){return new Promise(function(_0x59e0cd,_0x46cf0b){return db[_0x188b('0x1c')]['find']({'where':_0x39c731[_0x188b('0x1e')]?_0x39c731[_0x188b('0x1e')][_0x188b('0x20')]||null:null})[_0x188b('0x10')](function(_0x12cdd1){if(_0x12cdd1){return _0x12cdd1[_0x188b('0x21')](_0x39c731[_0x188b('0x1d')][_0x188b('0x22')],_['omit'](_0x39c731['body'],[_0x188b('0x22'),'id'])||{});}})[_0x188b('0x23')](function(_0x1edba8){logger[_0x188b('0x11')](_0x188b('0x24'),_0x39c731);logger[_0x188b('0x14')](_0x188b('0x24'),_0x39c731,JSON[_0x188b('0x16')](_0x1edba8));_0x59e0cd(_0x1edba8);})['catch'](function(_0x24c467){logger['error'](_0x188b('0x24'),_0x24c467[_0x188b('0x19')],_0x39c731);_0x46cf0b(_this[_0x188b('0x17')](0x1f4,_0x24c467[_0x188b('0x19')]));});});}; \ No newline at end of file +var _0x46f0=['stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','OpenchannelInteraction','body','options','raw','where','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x46f0,0x17c));var _0x046f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46f0[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x046f('0x0'));var util=require(_0x046f('0x1'));var moment=require(_0x046f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x046f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x046f('0x4'));var logger=require(_0x046f('0x5'))(_0x046f('0x6'));var config=require('../../config/environment');var jayson=require(_0x046f('0x7'));var client=jayson[_0x046f('0x8')][_0x046f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x046f('0xa'),'port':0x18eb});var socket=require(_0x046f('0xb'))(new Redis(config[_0x046f('0xc')]));require(_0x046f('0xd'))[_0x046f('0xe')](socket);function respondWithRpcPromise(_0x254769,_0x4c492e,_0x1772fe){return new BPromise(function(_0x104c19,_0x30ad95){return client[_0x046f('0xf')](_0x254769,_0x1772fe)['then'](function(_0x2c1e32){logger[_0x046f('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c492e,_0x046f('0x11'));logger[_0x046f('0x12')](_0x046f('0x13'),_0x4c492e,_0x046f('0x11'),JSON[_0x046f('0x14')](_0x2c1e32));if(_0x2c1e32[_0x046f('0x15')]){if(_0x2c1e32[_0x046f('0x15')][_0x046f('0x16')]===0x1f4){logger[_0x046f('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c492e,_0x2c1e32['error']['message']);return _0x30ad95(_0x2c1e32[_0x046f('0x15')][_0x046f('0x17')]);}logger['error'](_0x046f('0x18'),_0x4c492e,_0x2c1e32[_0x046f('0x15')][_0x046f('0x17')]);return _0x104c19(_0x2c1e32[_0x046f('0x15')][_0x046f('0x17')]);}else{logger[_0x046f('0x10')](_0x046f('0x18'),_0x4c492e,'request\x20sent');_0x104c19(_0x2c1e32['result'][_0x046f('0x17')]);}})[_0x046f('0x19')](function(_0x244296){logger[_0x046f('0x15')](_0x046f('0x18'),_0x4c492e,_0x244296);_0x30ad95(_0x244296);});});}exports['UpdateOpenchannelInteraction']=function(_0x5b7e35){var _0x4f59c7=this;return new Promise(function(_0x39d490,_0x1e4085){return db[_0x046f('0x1a')]['update'](_0x5b7e35[_0x046f('0x1b')],{'raw':_0x5b7e35['options']?_0x5b7e35[_0x046f('0x1c')][_0x046f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b7e35[_0x046f('0x1c')]?_0x5b7e35[_0x046f('0x1c')][_0x046f('0x1e')]||null:null,'attributes':_0x5b7e35[_0x046f('0x1c')]?_0x5b7e35['options']['attributes']||null:null,'limit':_0x5b7e35[_0x046f('0x1c')]?_0x5b7e35[_0x046f('0x1c')]['limit']||null:null})[_0x046f('0x1f')](function(_0x1dad27){logger['info'](_0x046f('0x20'),_0x5b7e35);logger['debug'](_0x046f('0x20'),_0x5b7e35,JSON[_0x046f('0x14')](_0x1dad27));_0x39d490(_0x1dad27);})[_0x046f('0x19')](function(_0x2b734a){logger[_0x046f('0x15')](_0x046f('0x20'),_0x2b734a[_0x046f('0x17')],_0x5b7e35);_0x1e4085(_0x4f59c7[_0x046f('0x15')](0x1f4,_0x2b734a[_0x046f('0x17')]));});});};exports[_0x046f('0x21')]=function(_0x26dc6c){return new Promise(function(_0x4d9efd,_0x4d7df0){return db[_0x046f('0x1a')][_0x046f('0x22')]({'where':_0x26dc6c[_0x046f('0x1c')]?_0x26dc6c[_0x046f('0x1c')]['where']||null:null})[_0x046f('0x1f')](function(_0x2322b5){if(_0x2322b5){return _0x2322b5[_0x046f('0x23')](_0x26dc6c['body']['ids'],_[_0x046f('0x24')](_0x26dc6c[_0x046f('0x1b')],[_0x046f('0x25'),'id'])||{});}})[_0x046f('0x26')](function(_0x2435d6){logger[_0x046f('0x10')]('AddTags',_0x26dc6c);logger['debug']('AddTags',_0x26dc6c,JSON['stringify'](_0x2435d6));_0x4d9efd(_0x2435d6);})[_0x046f('0x19')](function(_0x2753d8){logger[_0x046f('0x15')](_0x046f('0x27'),_0x2753d8[_0x046f('0x17')],_0x26dc6c);_0x4d7df0(_this['error'](0x1f4,_0x2753d8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 91e08cd..2b4316b 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 _0x1f8e=['removeListener','./openchannelInteraction.events','save','update','emit'];(function(_0x31b80d,_0x52a4d6){var _0x17127d=function(_0x223928){while(--_0x223928){_0x31b80d['push'](_0x31b80d['shift']());}};_0x17127d(++_0x52a4d6);}(_0x1f8e,0x1cd));var _0xe1f8=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x1f8e[_0x9df060];return _0x338dfe;};'use strict';var OpenchannelInteractionEvents=require(_0xe1f8('0x0'));var events=[_0xe1f8('0x1'),'remove',_0xe1f8('0x2')];function createListener(_0x4e2d17,_0x361102){return function(_0x2f8b9a){_0x361102[_0xe1f8('0x3')](_0x4e2d17,_0x2f8b9a);};}function removeListener(_0x54ea37,_0x72de25){return function(){OpenchannelInteractionEvents[_0xe1f8('0x4')](_0x54ea37,_0x72de25);};}exports['register']=function(_0x5aff5a){for(var _0x48cb1d=0x0,_0x58323a=events['length'];_0x48cb1d<_0x58323a;_0x48cb1d++){var _0x2f1c4c=events[_0x48cb1d];var _0x59de85=createListener('openchannelInteraction:'+_0x2f1c4c,_0x5aff5a);OpenchannelInteractionEvents['on'](_0x2f1c4c,_0x59de85);}}; \ No newline at end of file +var _0xfff9=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','update','emit'];(function(_0x215c5f,_0x3b702a){var _0x445d3c=function(_0x4e1f99){while(--_0x4e1f99){_0x215c5f['push'](_0x215c5f['shift']());}};_0x445d3c(++_0x3b702a);}(_0xfff9,0x176));var _0x9fff=function(_0x3c28e7,_0x169024){_0x3c28e7=_0x3c28e7-0x0;var _0x557b3a=_0xfff9[_0x3c28e7];return _0x557b3a;};'use strict';var OpenchannelInteractionEvents=require(_0x9fff('0x0'));var events=[_0x9fff('0x1'),'remove',_0x9fff('0x2')];function createListener(_0x2a2a2f,_0x21992c){return function(_0x2aead8){_0x21992c[_0x9fff('0x3')](_0x2a2a2f,_0x2aead8);};}function removeListener(_0x5e4fc7,_0x4aac63){return function(){OpenchannelInteractionEvents[_0x9fff('0x4')](_0x5e4fc7,_0x4aac63);};}exports['register']=function(_0x4205d1){for(var _0x34142c=0x0,_0x58fc17=events[_0x9fff('0x5')];_0x34142c<_0x58fc17;_0x34142c++){var _0x35577d=events[_0x34142c];var _0x3523f5=createListener(_0x9fff('0x6')+_0x35577d,_0x4205d1);OpenchannelInteractionEvents['on'](_0x35577d,_0x3523f5);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a41b911..1938c2f 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x15de11,_0x3cd20d){var _0x4f1c07=function(_0xf74624){while(--_0xf74624){_0x15de11['push'](_0x15de11['shift']());}};_0x4f1c07(++_0x3cd20d);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x48c550,_0x428ac2){var _0x4bf9ee=function(_0x265900){while(--_0x265900){_0x48c550['push'](_0x48c550['shift']());}};_0x4bf9ee(++_0x428ac2);}(_0xe706,0xa3));var _0x6e70=function(_0x76d2ec,_0x45ea7c){_0x76d2ec=_0x76d2ec-0x0;var _0x540bdc=_0xe706[_0x76d2ec];return _0x540bdc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 225329c..09b82df 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 _0xb846=['STRING','TEXT','sequelize','medium','BOOLEAN','ENUM','DATE'];(function(_0x263204,_0x19286b){var _0xed3987=function(_0x282bf1){while(--_0x282bf1){_0x263204['push'](_0x263204['shift']());}};_0xed3987(++_0x19286b);}(_0xb846,0x1d0));var _0x6b84=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb846[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6b84('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b84('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6b84('0x4')]},'providerName':{'type':Sequelize[_0x6b84('0x5')]},'providerResponse':{'type':Sequelize[_0x6b84('0x6')]}}; \ No newline at end of file +var _0x4c99=['sequelize','TEXT','ENUM','out','DATE','STRING'];(function(_0x430f08,_0xed2c96){var _0x446c4e=function(_0x5d9a07){while(--_0x5d9a07){_0x430f08['push'](_0x430f08['shift']());}};_0x446c4e(++_0xed2c96);}(_0x4c99,0x1ec));var _0x94c9=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x4c99[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0x94c9('0x0'));module['exports']={'body':{'type':Sequelize[_0x94c9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x94c9('0x2')]('in',_0x94c9('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x94c9('0x4')]},'providerName':{'type':Sequelize[_0x94c9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1dbee1d..c0a865d 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 _0xadc5=['openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT','User','channel','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','status','end','undefined','count','offset','json','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','describe','openchannel-interactions','accept'];(function(_0x307018,_0x35373b){var _0x59f892=function(_0x3a8e56){while(--_0x3a8e56){_0x307018['push'](_0x307018['shift']());}};_0x59f892(++_0x35373b);}(_0xadc5,0x1bd));var _0x5adc=function(_0x1e3a62,_0x499aae){_0x1e3a62=_0x1e3a62-0x0;var _0x24a7ba=_0xadc5[_0x1e3a62];return _0x24a7ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5adc('0x0'));var jsonpatch=require(_0x5adc('0x1'));var rp=require(_0x5adc('0x2'));var moment=require(_0x5adc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5adc('0x4'));var path=require(_0x5adc('0x5'));var sox=require(_0x5adc('0x6'));var csv=require(_0x5adc('0x7'));var ejs=require(_0x5adc('0x8'));var fs=require('fs');var fs_extra=require(_0x5adc('0x9'));var _=require(_0x5adc('0xa'));var squel=require(_0x5adc('0xb'));var crypto=require(_0x5adc('0xc'));var jsforce=require(_0x5adc('0xd'));var deskjs=require(_0x5adc('0xe'));var toCsv=require(_0x5adc('0x7'));var querystring=require(_0x5adc('0xf'));var Papa=require(_0x5adc('0x10'));var Redis=require(_0x5adc('0x11'));var authService=require(_0x5adc('0x12'));var qs=require(_0x5adc('0x13'));var as=require(_0x5adc('0x14'));var hardwareService=require(_0x5adc('0x15'));var logger=require(_0x5adc('0x16'))(_0x5adc('0x17'));var utils=require(_0x5adc('0x18'));var config=require(_0x5adc('0x19'));var licenseUtil=require(_0x5adc('0x1a'));var db=require(_0x5adc('0x1b'))['db'];config['redis']=_[_0x5adc('0x1c')](config[_0x5adc('0x1d')],{'host':_0x5adc('0x1e'),'port':0x18eb});var socket=require(_0x5adc('0x1f'))(new Redis(config[_0x5adc('0x1d')]));require('./openchannelMessage.socket')[_0x5adc('0x20')](socket);var jayson=require(_0x5adc('0x21'));var client=jayson['client'][_0x5adc('0x22')]({'port':0x232c});var client9002=jayson[_0x5adc('0x23')][_0x5adc('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2e350b,_0x369ef5,_0x46c059,_0x3717b5){return new BPromise(function(_0x4412d9,_0x142aad){var _0x303be8=_0x3717b5||client;return _0x303be8['request'](_0x2e350b,_0x46c059)[_0x5adc('0x24')](function(_0x26a99f){logger['info'](_0x5adc('0x25'),_0x369ef5,_0x5adc('0x26'));logger[_0x5adc('0x27')](_0x5adc('0x28'),_0x369ef5,_0x5adc('0x26'),JSON['stringify'](_0x26a99f));if(_0x26a99f[_0x5adc('0x29')]){if(_0x26a99f[_0x5adc('0x29')]['code']===0x1f4){logger['error'](_0x5adc('0x25'),_0x369ef5,_0x26a99f[_0x5adc('0x29')][_0x5adc('0x2a')]);return _0x142aad(_0x26a99f[_0x5adc('0x29')][_0x5adc('0x2a')]);}logger[_0x5adc('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x369ef5,_0x26a99f['error'][_0x5adc('0x2a')]);return _0x4412d9(_0x26a99f[_0x5adc('0x29')]['message']);}else{logger[_0x5adc('0x2b')](_0x5adc('0x25'),_0x369ef5,_0x5adc('0x26'));_0x4412d9(_0x26a99f['result'][_0x5adc('0x2a')]);}})['catch'](function(_0x48b984){logger[_0x5adc('0x29')](_0x5adc('0x25'),_0x369ef5,_0x48b984);_0x142aad(_0x48b984);});});}function respondWithStatusCode(_0x221387,_0x20a3cf){_0x20a3cf=_0x20a3cf||0xcc;return function(_0x13cbbb){if(_0x13cbbb){return _0x221387[_0x5adc('0x2c')](_0x20a3cf);}return _0x221387[_0x5adc('0x2d')](_0x20a3cf)[_0x5adc('0x2e')]();};}function respondWithResult(_0xeea440,_0x3aca91){_0x3aca91=_0x3aca91||0xc8;return function(_0x56d1c1){if(_0x56d1c1){return _0xeea440[_0x5adc('0x2d')](_0x3aca91)['json'](_0x56d1c1);}};}function respondWithFilteredResult(_0x455f81,_0x5173f1){return function(_0x5d5f6){if(_0x5d5f6){var _0x8bcd95=typeof _0x5173f1['offset']===_0x5adc('0x2f')&&typeof _0x5173f1['limit']===_0x5adc('0x2f');var _0x2b5139=_0x5d5f6[_0x5adc('0x30')];var _0x54c4cd=_0x8bcd95?0x0:_0x5173f1[_0x5adc('0x31')];var _0x38bdb1=_0x8bcd95?_0x5d5f6[_0x5adc('0x30')]:_0x5173f1[_0x5adc('0x31')]+_0x5173f1['limit'];var _0x1aab3f;if(_0x38bdb1>=_0x2b5139){_0x38bdb1=_0x2b5139;_0x1aab3f=0xc8;}else{_0x1aab3f=0xce;}_0x455f81[_0x5adc('0x2d')](_0x1aab3f);return _0x455f81['set']('Content-Range',_0x54c4cd+'-'+_0x38bdb1+'/'+_0x2b5139)[_0x5adc('0x32')](_0x5d5f6);}return null;};}function patchUpdates(_0x3ded41){return function(_0x1ca5cd){try{jsonpatch['apply'](_0x1ca5cd,_0x3ded41,!![]);}catch(_0x2f1782){return BPromise[_0x5adc('0x33')](_0x2f1782);}return _0x1ca5cd[_0x5adc('0x34')]();};}function saveUpdates(_0x2abd6d,_0x4bd7b0){return function(_0x1021a0){if(_0x1021a0){return _0x1021a0[_0x5adc('0x35')](_0x2abd6d)[_0x5adc('0x24')](function(_0x587534){return _0x587534;});}return null;};}function removeEntity(_0x555563,_0x3b485d){return function(_0x51937c){if(_0x51937c){return _0x51937c[_0x5adc('0x36')]()[_0x5adc('0x24')](function(){_0x555563[_0x5adc('0x2d')](0xcc)[_0x5adc('0x2e')]();});}};}function handleEntityNotFound(_0x49ddfb,_0x375040){return function(_0x4ce418){if(!_0x4ce418){_0x49ddfb[_0x5adc('0x2c')](0x194);}return _0x4ce418;};}function handleError(_0x593c24,_0x40e96c){_0x40e96c=_0x40e96c||0x1f4;return function(_0x282f1d){logger['error'](_0x282f1d[_0x5adc('0x37')]);if(_0x282f1d[_0x5adc('0x38')]){delete _0x282f1d[_0x5adc('0x38')];}_0x593c24[_0x5adc('0x2d')](_0x40e96c)[_0x5adc('0x39')](_0x282f1d);};}exports['index']=function(_0xe1659b,_0x4b1dd4){var _0x14860b={},_0x204682={},_0x30f1c3={'count':0x0,'rows':[]};var _0x2dd92a=_[_0x5adc('0x3a')](db[_0x5adc('0x3b')][_0x5adc('0x3c')],function(_0x608213){return{'name':_0x608213[_0x5adc('0x3d')],'type':_0x608213[_0x5adc('0x3e')][_0x5adc('0x3f')]};});_0x204682[_0x5adc('0x40')]=_[_0x5adc('0x3a')](_0x2dd92a,_0x5adc('0x38'));_0x204682[_0x5adc('0x41')]=_['keys'](_0xe1659b[_0x5adc('0x41')]);_0x204682[_0x5adc('0x42')]=_[_0x5adc('0x43')](_0x204682[_0x5adc('0x40')],_0x204682[_0x5adc('0x41')]);_0x14860b[_0x5adc('0x44')]=_['intersection'](_0x204682[_0x5adc('0x40')],qs[_0x5adc('0x45')](_0xe1659b[_0x5adc('0x41')]['fields']));_0x14860b['attributes']=_0x14860b[_0x5adc('0x44')][_0x5adc('0x46')]?_0x14860b[_0x5adc('0x44')]:_0x204682[_0x5adc('0x40')];if(!_0xe1659b['query'][_0x5adc('0x47')](_0x5adc('0x48'))){_0x14860b['limit']=qs[_0x5adc('0x49')](_0xe1659b[_0x5adc('0x41')]['limit']);_0x14860b[_0x5adc('0x31')]=qs[_0x5adc('0x31')](_0xe1659b[_0x5adc('0x41')][_0x5adc('0x31')]);}_0x14860b[_0x5adc('0x4a')]=qs['sort'](_0xe1659b[_0x5adc('0x41')][_0x5adc('0x4b')]);_0x14860b[_0x5adc('0x4c')]=qs['filters'](_[_0x5adc('0x4d')](_0xe1659b['query'],_0x204682[_0x5adc('0x42')]),_0x2dd92a);if(_0xe1659b['query'][_0x5adc('0x4e')]){_0x14860b[_0x5adc('0x4c')]=_[_0x5adc('0x4f')](_0x14860b[_0x5adc('0x4c')],{'$or':_[_0x5adc('0x3a')](_0x2dd92a,function(_0x14dcec){if(_0x14dcec[_0x5adc('0x3e')]!==_0x5adc('0x50')){var _0x128da5={};_0x128da5[_0x14dcec[_0x5adc('0x38')]]={'$like':'%'+_0xe1659b[_0x5adc('0x41')][_0x5adc('0x4e')]+'%'};return _0x128da5;}})});}_0x14860b=_[_0x5adc('0x4f')]({},_0x14860b,_0xe1659b['options']);var _0x47fe25={'where':_0x14860b[_0x5adc('0x4c')]};return db[_0x5adc('0x3b')][_0x5adc('0x30')](_0x47fe25)[_0x5adc('0x24')](function(_0x540f31){_0x30f1c3['count']=_0x540f31;if(_0xe1659b[_0x5adc('0x41')][_0x5adc('0x51')]){_0x14860b[_0x5adc('0x52')]=[{'all':!![]}];}return db[_0x5adc('0x3b')][_0x5adc('0x53')](_0x14860b);})[_0x5adc('0x24')](function(_0x133ecc){_0x30f1c3[_0x5adc('0x54')]=_0x133ecc;return _0x30f1c3;})[_0x5adc('0x24')](respondWithFilteredResult(_0x4b1dd4,_0x14860b))['catch'](handleError(_0x4b1dd4,null));};exports['show']=function(_0x2e958e,_0x1e1bc6){var _0x344c23={'raw':!![],'where':{'id':_0x2e958e[_0x5adc('0x55')]['id']}},_0x50bf13={};_0x50bf13[_0x5adc('0x40')]=_['keys'](db[_0x5adc('0x3b')][_0x5adc('0x3c')]);_0x50bf13[_0x5adc('0x41')]=_[_0x5adc('0x56')](_0x2e958e[_0x5adc('0x41')]);_0x50bf13[_0x5adc('0x42')]=_[_0x5adc('0x43')](_0x50bf13[_0x5adc('0x40')],_0x50bf13[_0x5adc('0x41')]);_0x344c23[_0x5adc('0x44')]=_[_0x5adc('0x43')](_0x50bf13['model'],qs[_0x5adc('0x45')](_0x2e958e[_0x5adc('0x41')][_0x5adc('0x45')]));_0x344c23[_0x5adc('0x44')]=_0x344c23[_0x5adc('0x44')][_0x5adc('0x46')]?_0x344c23[_0x5adc('0x44')]:_0x50bf13[_0x5adc('0x40')];if(_0x2e958e[_0x5adc('0x41')][_0x5adc('0x51')]){_0x344c23[_0x5adc('0x52')]=[{'all':!![]}];}_0x344c23=_[_0x5adc('0x4f')]({},_0x344c23,_0x2e958e[_0x5adc('0x57')]);return db[_0x5adc('0x3b')][_0x5adc('0x58')](_0x344c23)[_0x5adc('0x24')](handleEntityNotFound(_0x1e1bc6,null))['then'](respondWithResult(_0x1e1bc6,null))[_0x5adc('0x59')](handleError(_0x1e1bc6,null));};exports['create']=function(_0x43e190,_0x6773be){return db[_0x5adc('0x3b')][_0x5adc('0x5a')](_0x43e190[_0x5adc('0x5b')],{})[_0x5adc('0x24')](respondWithResult(_0x6773be,0xc9))['catch'](handleError(_0x6773be,null));};exports[_0x5adc('0x35')]=function(_0x3d5719,_0xee88d2){if(_0x3d5719['body']['id']){delete _0x3d5719['body']['id'];}return db[_0x5adc('0x3b')][_0x5adc('0x58')]({'where':{'id':_0x3d5719[_0x5adc('0x55')]['id']}})[_0x5adc('0x24')](handleEntityNotFound(_0xee88d2,null))[_0x5adc('0x24')](saveUpdates(_0x3d5719[_0x5adc('0x5b')],null))[_0x5adc('0x24')](respondWithResult(_0xee88d2,null))[_0x5adc('0x59')](handleError(_0xee88d2,null));};exports[_0x5adc('0x36')]=function(_0x5790e5,_0x16c222){return db[_0x5adc('0x3b')][_0x5adc('0x58')]({'where':{'id':_0x5790e5[_0x5adc('0x55')]['id']}})[_0x5adc('0x24')](handleEntityNotFound(_0x16c222,null))[_0x5adc('0x24')](removeEntity(_0x16c222,null))[_0x5adc('0x59')](handleError(_0x16c222,null));};exports['describe']=function(_0x51389b,_0x6bb09d){return db[_0x5adc('0x3b')][_0x5adc('0x5c')]()[_0x5adc('0x24')](respondWithResult(_0x6bb09d,null))[_0x5adc('0x59')](handleError(_0x6bb09d,null));};var interaction_log=require(_0x5adc('0x16'))(_0x5adc('0x5d'));exports[_0x5adc('0x5e')]=function(_0x4cf796,_0x24f225,_0xa2a780){var _0x465691={'agent':{},'channel':_0x5adc('0x5f')};if(_0x4cf796[_0x5adc('0x5b')]['id']){delete _0x4cf796['body']['id'];}_0x4cf796[_0x5adc('0x5b')][_0x5adc('0x60')]=!![];_0x4cf796[_0x5adc('0x5b')][_0x5adc('0x61')]=moment()[_0x5adc('0x62')](_0x5adc('0x63'));_0x4cf796[_0x5adc('0x5b')]['UserId']=_0x4cf796['body'][_0x5adc('0x64')]||_0x4cf796[_0x5adc('0x65')]['id'];_0x465691[_0x5adc('0x66')]['id']=_0x4cf796['body']['UserId'];return db['OpenchannelMessage'][_0x5adc('0x58')]({'where':{'id':_0x4cf796[_0x5adc('0x55')]['id'],'UserId':null}})[_0x5adc('0x24')](handleEntityNotFound(_0x24f225,null))[_0x5adc('0x24')](saveUpdates(_0x4cf796[_0x5adc('0x5b')],null))['then'](function(_0x367d7d){if(_0x367d7d){_0x465691['message']=_0x367d7d[_0x5adc('0x67')]({'plain':!![]});return db[_0x5adc('0x68')][_0x5adc('0x58')]({'where':{'id':_0x367d7d[_0x5adc('0x69')]}});}return null;})[_0x5adc('0x24')](handleEntityNotFound(_0x24f225,null))[_0x5adc('0x24')](function(_0x64bc60){if(_0x64bc60){return _0x64bc60[_0x5adc('0x35')]({'UserId':_0x4cf796[_0x5adc('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x64bc60[_0x5adc('0x6a')])?moment()[_0x5adc('0x62')](_0x5adc('0x63')):undefined});}return null;})[_0x5adc('0x24')](function(_0x2a8f03){if(_0x2a8f03){_0x465691[_0x5adc('0x6b')]=_0x2a8f03[_0x5adc('0x67')]({'plain':!![]});interaction_log[_0x5adc('0x2b')](_0x5adc('0x6c'),_0x4cf796[_0x5adc('0x65')]['id'],_0x4cf796[_0x5adc('0x65')]['name'],_0x4cf796['user'][_0x5adc('0x6d')],_0x465691[_0x5adc('0x6b')]['id'],_0x4cf796[_0x5adc('0x5b')]?JSON['stringify'](_0x4cf796[_0x5adc('0x5b')]):_0x5adc('0x6e'));return respondWithRpcPromise(_0x5adc('0x6f'),_0x5adc('0x70'),_0x465691);}return null;})[_0x5adc('0x24')](function(_0x794d0f){var _0x5d30a4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x794d0f[_0x5adc('0x2a')][_0x5adc('0x71')];return db[_0x5adc('0x72')][_0x5adc('0x41')](_0x5d30a4,{'type':db[_0x5adc('0x73')][_0x5adc('0x74')]['SELECT'],'raw':!![]})[_0x5adc('0x24')](function(_0x1cfb89){return _0x1cfb89;});})['then'](function(_0x1f922d){if(_0x1f922d){_0x465691[_0x5adc('0x2a')][_0x5adc('0x75')]=_0x1f922d[0x0];if(!_0x4cf796[_0x5adc('0x5b')][_0x5adc('0x64')])return;return db['User']['find']({'where':{'id':_0x4cf796['body'][_0x5adc('0x64')],'role':_0x5adc('0x66')},'attributes':['id','name',_0x5adc('0x76'),_0x5adc('0x77'),_0x5adc('0x78')],'raw':!![]});}return null;})[_0x5adc('0x24')](function(_0x5d8333){if(!_0x5d8333)return null;_0x465691['message']['agent']=_0x5d8333;return _0x465691;})[_0x5adc('0x24')](function(_0x416d1b){if(_0x416d1b){if(_0x4cf796['body'][_0x5adc('0x79')]){_0x465691[_0x5adc('0x2a')][_0x5adc('0x7a')]=util['format'](_0x5adc('0x7b'),_0x4cf796[_0x5adc('0x65')][_0x5adc('0x38')]);_0x465691[_0x5adc('0x2a')]['channel']=_0x465691['channel'];_0x465691[_0x5adc('0x2a')][_0x5adc('0x7c')]=_0x465691['channel'];_0x465691[_0x5adc('0x2a')][_0x5adc('0x7d')]='accept';return respondWithRpcPromise('EventManager',_0x5adc('0x7e'),{'event':'acceptmessage','message':_0x465691[_0x5adc('0x2a')]},client9002)[_0x5adc('0x24')](function(){return _0x465691;});}return _0x465691;}return null;})[_0x5adc('0x24')](respondWithResult(_0x24f225,null))[_0x5adc('0x59')](handleError(_0x24f225,null));};var interaction_log=require(_0x5adc('0x16'))(_0x5adc('0x5d'));exports['reject']=function(_0x1fb86a,_0x3c928e,_0x1847e7){var _0x232b03={'agent':{},'channel':_0x5adc('0x5f')};if(_0x1fb86a['body']['id']){delete _0x1fb86a['body']['id'];}_0x1fb86a['body'][_0x5adc('0x64')]=_0x1fb86a[_0x5adc('0x5b')][_0x5adc('0x64')]||_0x1fb86a[_0x5adc('0x65')]['id'];_0x232b03[_0x5adc('0x66')]['id']=_0x1fb86a[_0x5adc('0x5b')][_0x5adc('0x64')];return db['OpenchannelMessage']['find']({'where':{'id':_0x1fb86a['params']['id'],'UserId':null}})[_0x5adc('0x24')](handleEntityNotFound(_0x3c928e,null))[_0x5adc('0x24')](function(_0x5f3787){if(_0x5f3787){_0x232b03[_0x5adc('0x2a')]=_0x5f3787[_0x5adc('0x67')]({'plain':!![]});return db[_0x5adc('0x68')][_0x5adc('0x58')]({'where':{'id':_0x5f3787[_0x5adc('0x69')]}});}return null;})[_0x5adc('0x24')](handleEntityNotFound(_0x3c928e,null))[_0x5adc('0x24')](function(_0x32eb1d){if(_0x32eb1d){_0x232b03[_0x5adc('0x6b')]=_0x32eb1d[_0x5adc('0x67')]({'plain':!![]});interaction_log[_0x5adc('0x2b')](_0x5adc('0x7f'),_0x1fb86a[_0x5adc('0x65')]['id'],_0x1fb86a[_0x5adc('0x65')][_0x5adc('0x38')],_0x1fb86a['user'][_0x5adc('0x6d')],_0x232b03[_0x5adc('0x6b')]['id'],_0x1fb86a[_0x5adc('0x5b')]?JSON[_0x5adc('0x80')](_0x1fb86a[_0x5adc('0x5b')]):_0x5adc('0x6e'));return respondWithRpcPromise(_0x5adc('0x81'),_0x5adc('0x82'),_0x232b03);}return null;})[_0x5adc('0x24')](function(_0x160cd9){var _0x2d3487='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x160cd9[_0x5adc('0x2a')][_0x5adc('0x71')];return db['sequelize'][_0x5adc('0x41')](_0x2d3487,{'type':db[_0x5adc('0x73')][_0x5adc('0x74')][_0x5adc('0x83')],'raw':!![]})[_0x5adc('0x24')](function(_0x212a5f){return _0x212a5f;});})[_0x5adc('0x24')](function(_0x406924){if(_0x406924){_0x232b03[_0x5adc('0x2a')][_0x5adc('0x75')]=_0x406924[0x0];if(!_0x1fb86a[_0x5adc('0x5b')][_0x5adc('0x64')])return;return db[_0x5adc('0x84')][_0x5adc('0x58')]({'where':{'id':_0x1fb86a['body'][_0x5adc('0x64')],'role':_0x5adc('0x66')},'attributes':['id',_0x5adc('0x38'),_0x5adc('0x76'),_0x5adc('0x77'),_0x5adc('0x78')],'raw':!![]});}return null;})[_0x5adc('0x24')](function(_0x1e0638){if(!_0x1e0638)return null;_0x232b03[_0x5adc('0x2a')]['agent']=_0x1e0638;return _0x232b03;})[_0x5adc('0x24')](function(_0x456cd5){if(_0x456cd5){_0x456cd5[_0x5adc('0x2a')][_0x5adc('0x7a')]=util[_0x5adc('0x62')]('SIP/%s',_0x1fb86a[_0x5adc('0x65')][_0x5adc('0x38')]);_0x456cd5[_0x5adc('0x2a')][_0x5adc('0x85')]=_0x232b03[_0x5adc('0x85')];_0x456cd5[_0x5adc('0x2a')][_0x5adc('0x7c')]=_0x232b03['channel'];_0x456cd5[_0x5adc('0x2a')][_0x5adc('0x7d')]=_0x5adc('0x33');respondWithRpcPromise(_0x5adc('0x7e'),'EventManager',{'event':_0x5adc('0x86'),'message':_0x456cd5['message']},client9002);return _0x232b03;}return null;})[_0x5adc('0x24')](respondWithResult(_0x3c928e,null))[_0x5adc('0x59')](handleError(_0x3c928e,null));}; \ No newline at end of file +var _0x8d40=['AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','User','email','rejectmessage','eml-format','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','accept','openchannel','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null'];(function(_0x48396f,_0x2303c2){var _0x37cb9e=function(_0x4e250b){while(--_0x4e250b){_0x48396f['push'](_0x48396f['shift']());}};_0x37cb9e(++_0x2303c2);}(_0x8d40,0x9b));var _0x08d4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8d40[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x08d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x08d4('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x08d4('0x3'));var path=require(_0x08d4('0x4'));var sox=require(_0x08d4('0x5'));var csv=require(_0x08d4('0x6'));var ejs=require(_0x08d4('0x7'));var fs=require('fs');var fs_extra=require(_0x08d4('0x8'));var _=require(_0x08d4('0x9'));var squel=require(_0x08d4('0xa'));var crypto=require('crypto');var jsforce=require(_0x08d4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08d4('0xc'));var Papa=require('papaparse');var Redis=require(_0x08d4('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08d4('0xe'));var hardwareService=require(_0x08d4('0xf'));var logger=require(_0x08d4('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x08d4('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x08d4('0x12'))['db'];config[_0x08d4('0x13')]=_[_0x08d4('0x14')](config['redis'],{'host':_0x08d4('0x15'),'port':0x18eb});var socket=require(_0x08d4('0x16'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x08d4('0x17')](socket);var jayson=require(_0x08d4('0x18'));var client=jayson[_0x08d4('0x19')][_0x08d4('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x08d4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x563be4,_0x52ff13,_0x5a447f,_0x26c410){return new BPromise(function(_0x349cdc,_0x2b7dad){var _0x251800=_0x26c410||client;return _0x251800[_0x08d4('0x1b')](_0x563be4,_0x5a447f)[_0x08d4('0x1c')](function(_0x15c01b){logger[_0x08d4('0x1d')](_0x08d4('0x1e'),_0x52ff13,_0x08d4('0x1f'));logger[_0x08d4('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x52ff13,_0x08d4('0x1f'),JSON['stringify'](_0x15c01b));if(_0x15c01b[_0x08d4('0x21')]){if(_0x15c01b[_0x08d4('0x21')][_0x08d4('0x22')]===0x1f4){logger['error'](_0x08d4('0x1e'),_0x52ff13,_0x15c01b[_0x08d4('0x21')]['message']);return _0x2b7dad(_0x15c01b[_0x08d4('0x21')][_0x08d4('0x23')]);}logger[_0x08d4('0x21')](_0x08d4('0x1e'),_0x52ff13,_0x15c01b['error'][_0x08d4('0x23')]);return _0x349cdc(_0x15c01b[_0x08d4('0x21')][_0x08d4('0x23')]);}else{logger['info'](_0x08d4('0x1e'),_0x52ff13,_0x08d4('0x1f'));_0x349cdc(_0x15c01b[_0x08d4('0x24')][_0x08d4('0x23')]);}})['catch'](function(_0x30ec5a){logger[_0x08d4('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x52ff13,_0x30ec5a);_0x2b7dad(_0x30ec5a);});});}function respondWithStatusCode(_0x5054cf,_0x36fba2){_0x36fba2=_0x36fba2||0xcc;return function(_0x3f06e9){if(_0x3f06e9){return _0x5054cf[_0x08d4('0x25')](_0x36fba2);}return _0x5054cf[_0x08d4('0x26')](_0x36fba2)[_0x08d4('0x27')]();};}function respondWithResult(_0xfbdd2b,_0x16e592){_0x16e592=_0x16e592||0xc8;return function(_0x1d1bcd){if(_0x1d1bcd){return _0xfbdd2b[_0x08d4('0x26')](_0x16e592)[_0x08d4('0x28')](_0x1d1bcd);}};}function respondWithFilteredResult(_0x611a65,_0x1884cf){return function(_0x101fcb){if(_0x101fcb){var _0x5c3ac9=typeof _0x1884cf[_0x08d4('0x29')]===_0x08d4('0x2a')&&typeof _0x1884cf[_0x08d4('0x2b')]===_0x08d4('0x2a');var _0x42f093=_0x101fcb[_0x08d4('0x2c')];var _0x361c34=_0x5c3ac9?0x0:_0x1884cf[_0x08d4('0x29')];var _0x23fc56=_0x5c3ac9?_0x101fcb[_0x08d4('0x2c')]:_0x1884cf[_0x08d4('0x29')]+_0x1884cf['limit'];var _0x23e743;if(_0x23fc56>=_0x42f093){_0x23fc56=_0x42f093;_0x23e743=0xc8;}else{_0x23e743=0xce;}_0x611a65[_0x08d4('0x26')](_0x23e743);return _0x611a65[_0x08d4('0x2d')]('Content-Range',_0x361c34+'-'+_0x23fc56+'/'+_0x42f093)[_0x08d4('0x28')](_0x101fcb);}return null;};}function patchUpdates(_0x51c925){return function(_0x41b5db){try{jsonpatch[_0x08d4('0x2e')](_0x41b5db,_0x51c925,!![]);}catch(_0x3dc1c6){return BPromise[_0x08d4('0x2f')](_0x3dc1c6);}return _0x41b5db[_0x08d4('0x30')]();};}function saveUpdates(_0x476272,_0x1c94d2){return function(_0x1ba0b0){if(_0x1ba0b0){return _0x1ba0b0[_0x08d4('0x31')](_0x476272)[_0x08d4('0x1c')](function(_0x4037bd){return _0x4037bd;});}return null;};}function removeEntity(_0x29c05f,_0x168f60){return function(_0x7ddc9a){if(_0x7ddc9a){return _0x7ddc9a[_0x08d4('0x32')]()[_0x08d4('0x1c')](function(){_0x29c05f[_0x08d4('0x26')](0xcc)[_0x08d4('0x27')]();});}};}function handleEntityNotFound(_0x34de7d,_0x6758af){return function(_0x2cdfb0){if(!_0x2cdfb0){_0x34de7d[_0x08d4('0x25')](0x194);}return _0x2cdfb0;};}function handleError(_0x5a6b4f,_0x365ae1){_0x365ae1=_0x365ae1||0x1f4;return function(_0x2b15fd){logger['error'](_0x2b15fd[_0x08d4('0x33')]);if(_0x2b15fd[_0x08d4('0x34')]){delete _0x2b15fd[_0x08d4('0x34')];}_0x5a6b4f[_0x08d4('0x26')](_0x365ae1)['send'](_0x2b15fd);};}exports[_0x08d4('0x35')]=function(_0x3b11fc,_0x42b3d4){var _0x1d98f1={},_0x6d7367={},_0x2f637b={'count':0x0,'rows':[]};var _0x202e9b=_[_0x08d4('0x36')](db[_0x08d4('0x37')][_0x08d4('0x38')],function(_0x18e33a){return{'name':_0x18e33a['fieldName'],'type':_0x18e33a['type'][_0x08d4('0x39')]};});_0x6d7367[_0x08d4('0x3a')]=_['map'](_0x202e9b,_0x08d4('0x34'));_0x6d7367['query']=_['keys'](_0x3b11fc[_0x08d4('0x3b')]);_0x6d7367[_0x08d4('0x3c')]=_[_0x08d4('0x3d')](_0x6d7367[_0x08d4('0x3a')],_0x6d7367[_0x08d4('0x3b')]);_0x1d98f1[_0x08d4('0x3e')]=_[_0x08d4('0x3d')](_0x6d7367[_0x08d4('0x3a')],qs['fields'](_0x3b11fc[_0x08d4('0x3b')][_0x08d4('0x3f')]));_0x1d98f1[_0x08d4('0x3e')]=_0x1d98f1['attributes'][_0x08d4('0x40')]?_0x1d98f1['attributes']:_0x6d7367[_0x08d4('0x3a')];if(!_0x3b11fc['query'][_0x08d4('0x41')](_0x08d4('0x42'))){_0x1d98f1[_0x08d4('0x2b')]=qs[_0x08d4('0x2b')](_0x3b11fc[_0x08d4('0x3b')][_0x08d4('0x2b')]);_0x1d98f1[_0x08d4('0x29')]=qs[_0x08d4('0x29')](_0x3b11fc['query'][_0x08d4('0x29')]);}_0x1d98f1[_0x08d4('0x43')]=qs[_0x08d4('0x44')](_0x3b11fc['query'][_0x08d4('0x44')]);_0x1d98f1['where']=qs[_0x08d4('0x3c')](_[_0x08d4('0x45')](_0x3b11fc[_0x08d4('0x3b')],_0x6d7367[_0x08d4('0x3c')]),_0x202e9b);if(_0x3b11fc['query']['filter']){_0x1d98f1[_0x08d4('0x46')]=_[_0x08d4('0x47')](_0x1d98f1[_0x08d4('0x46')],{'$or':_[_0x08d4('0x36')](_0x202e9b,function(_0x24abcf){if(_0x24abcf[_0x08d4('0x48')]!=='VIRTUAL'){var _0x3e0727={};_0x3e0727[_0x24abcf['name']]={'$like':'%'+_0x3b11fc[_0x08d4('0x3b')][_0x08d4('0x49')]+'%'};return _0x3e0727;}})});}_0x1d98f1=_[_0x08d4('0x47')]({},_0x1d98f1,_0x3b11fc[_0x08d4('0x4a')]);var _0x31bf3d={'where':_0x1d98f1['where']};return db[_0x08d4('0x37')]['count'](_0x31bf3d)[_0x08d4('0x1c')](function(_0x50819d){_0x2f637b[_0x08d4('0x2c')]=_0x50819d;if(_0x3b11fc[_0x08d4('0x3b')][_0x08d4('0x4b')]){_0x1d98f1[_0x08d4('0x4c')]=[{'all':!![]}];}return db[_0x08d4('0x37')]['findAll'](_0x1d98f1);})['then'](function(_0xc5549e){_0x2f637b[_0x08d4('0x4d')]=_0xc5549e;return _0x2f637b;})[_0x08d4('0x1c')](respondWithFilteredResult(_0x42b3d4,_0x1d98f1))[_0x08d4('0x4e')](handleError(_0x42b3d4,null));};exports[_0x08d4('0x4f')]=function(_0x4fa324,_0x4f1d0f){var _0x3faa3e={'raw':!![],'where':{'id':_0x4fa324[_0x08d4('0x50')]['id']}},_0x9372f6={};_0x9372f6[_0x08d4('0x3a')]=_[_0x08d4('0x51')](db[_0x08d4('0x37')][_0x08d4('0x38')]);_0x9372f6[_0x08d4('0x3b')]=_[_0x08d4('0x51')](_0x4fa324[_0x08d4('0x3b')]);_0x9372f6[_0x08d4('0x3c')]=_[_0x08d4('0x3d')](_0x9372f6[_0x08d4('0x3a')],_0x9372f6['query']);_0x3faa3e[_0x08d4('0x3e')]=_[_0x08d4('0x3d')](_0x9372f6[_0x08d4('0x3a')],qs['fields'](_0x4fa324[_0x08d4('0x3b')][_0x08d4('0x3f')]));_0x3faa3e[_0x08d4('0x3e')]=_0x3faa3e['attributes'][_0x08d4('0x40')]?_0x3faa3e[_0x08d4('0x3e')]:_0x9372f6['model'];if(_0x4fa324[_0x08d4('0x3b')][_0x08d4('0x4b')]){_0x3faa3e['include']=[{'all':!![]}];}_0x3faa3e=_[_0x08d4('0x47')]({},_0x3faa3e,_0x4fa324[_0x08d4('0x4a')]);return db[_0x08d4('0x37')][_0x08d4('0x52')](_0x3faa3e)[_0x08d4('0x1c')](handleEntityNotFound(_0x4f1d0f,null))[_0x08d4('0x1c')](respondWithResult(_0x4f1d0f,null))[_0x08d4('0x4e')](handleError(_0x4f1d0f,null));};exports[_0x08d4('0x53')]=function(_0x4efc7e,_0x21f2ba){return db[_0x08d4('0x37')][_0x08d4('0x53')](_0x4efc7e[_0x08d4('0x54')],{})['then'](respondWithResult(_0x21f2ba,0xc9))[_0x08d4('0x4e')](handleError(_0x21f2ba,null));};exports[_0x08d4('0x31')]=function(_0x53b936,_0x1d1bbf){if(_0x53b936[_0x08d4('0x54')]['id']){delete _0x53b936['body']['id'];}return db['OpenchannelMessage'][_0x08d4('0x52')]({'where':{'id':_0x53b936[_0x08d4('0x50')]['id']}})[_0x08d4('0x1c')](handleEntityNotFound(_0x1d1bbf,null))['then'](saveUpdates(_0x53b936[_0x08d4('0x54')],null))[_0x08d4('0x1c')](respondWithResult(_0x1d1bbf,null))[_0x08d4('0x4e')](handleError(_0x1d1bbf,null));};exports[_0x08d4('0x32')]=function(_0x2fb0d7,_0xe0a891){return db[_0x08d4('0x37')][_0x08d4('0x52')]({'where':{'id':_0x2fb0d7[_0x08d4('0x50')]['id']}})['then'](handleEntityNotFound(_0xe0a891,null))[_0x08d4('0x1c')](removeEntity(_0xe0a891,null))[_0x08d4('0x4e')](handleError(_0xe0a891,null));};exports[_0x08d4('0x55')]=function(_0x3912a5,_0xe98aa7){return db[_0x08d4('0x37')][_0x08d4('0x55')]()['then'](respondWithResult(_0xe98aa7,null))['catch'](handleError(_0xe98aa7,null));};var interaction_log=require(_0x08d4('0x10'))('openchannel-interactions');exports[_0x08d4('0x56')]=function(_0x1d4539,_0x241a52,_0x54f3bc){var _0x166ae7={'agent':{},'channel':_0x08d4('0x57')};if(_0x1d4539[_0x08d4('0x54')]['id']){delete _0x1d4539['body']['id'];}_0x1d4539['body']['read']=!![];_0x1d4539[_0x08d4('0x54')][_0x08d4('0x58')]=moment()[_0x08d4('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d4539[_0x08d4('0x54')][_0x08d4('0x5a')]=_0x1d4539[_0x08d4('0x54')]['UserId']||_0x1d4539[_0x08d4('0x5b')]['id'];_0x166ae7[_0x08d4('0x5c')]['id']=_0x1d4539[_0x08d4('0x54')]['UserId'];return db[_0x08d4('0x37')][_0x08d4('0x52')]({'where':{'id':_0x1d4539['params']['id'],'UserId':null}})[_0x08d4('0x1c')](handleEntityNotFound(_0x241a52,null))[_0x08d4('0x1c')](saveUpdates(_0x1d4539[_0x08d4('0x54')],null))[_0x08d4('0x1c')](function(_0x4dda38){if(_0x4dda38){_0x166ae7[_0x08d4('0x23')]=_0x4dda38['get']({'plain':!![]});return db[_0x08d4('0x5d')][_0x08d4('0x52')]({'where':{'id':_0x4dda38[_0x08d4('0x5e')]}});}return null;})[_0x08d4('0x1c')](handleEntityNotFound(_0x241a52,null))[_0x08d4('0x1c')](function(_0xfed2f8){if(_0xfed2f8){return _0xfed2f8['update']({'UserId':_0x1d4539[_0x08d4('0x54')][_0x08d4('0x5a')],'read1stAt':_['isNil'](_0xfed2f8['read1stAt'])?moment()[_0x08d4('0x59')](_0x08d4('0x5f')):undefined});}return null;})[_0x08d4('0x1c')](function(_0x156a20){if(_0x156a20){_0x166ae7[_0x08d4('0x60')]=_0x156a20[_0x08d4('0x61')]({'plain':!![]});interaction_log['info'](_0x08d4('0x62'),_0x1d4539['user']['id'],_0x1d4539[_0x08d4('0x5b')][_0x08d4('0x34')],_0x1d4539[_0x08d4('0x5b')]['role'],_0x166ae7[_0x08d4('0x60')]['id'],_0x1d4539['body']?JSON[_0x08d4('0x63')](_0x1d4539[_0x08d4('0x54')]):_0x08d4('0x64'));return respondWithRpcPromise(_0x08d4('0x65'),_0x08d4('0x66'),_0x166ae7);}return null;})['then'](function(_0x2a9842){var _0x599e29=_0x08d4('0x67')+_0x2a9842[_0x08d4('0x23')]['ContactId'];return db[_0x08d4('0x68')]['query'](_0x599e29,{'type':db[_0x08d4('0x69')][_0x08d4('0x6a')][_0x08d4('0x6b')],'raw':!![]})[_0x08d4('0x1c')](function(_0x20a4d3){return _0x20a4d3;});})[_0x08d4('0x1c')](function(_0x3cdbd1){if(_0x3cdbd1){_0x166ae7[_0x08d4('0x23')][_0x08d4('0x6c')]=_0x3cdbd1[0x0];if(!_0x1d4539[_0x08d4('0x54')][_0x08d4('0x5a')])return;return db['User'][_0x08d4('0x52')]({'where':{'id':_0x1d4539['body'][_0x08d4('0x5a')],'role':_0x08d4('0x5c')},'attributes':['id',_0x08d4('0x34'),_0x08d4('0x6d'),'email',_0x08d4('0x6e')],'raw':!![]});}return null;})[_0x08d4('0x1c')](function(_0x54ea53){if(!_0x54ea53)return null;_0x166ae7['message'][_0x08d4('0x5c')]=_0x54ea53;return _0x166ae7;})[_0x08d4('0x1c')](function(_0x60e92a){if(_0x60e92a){if(_0x1d4539[_0x08d4('0x54')][_0x08d4('0x6f')]){_0x166ae7[_0x08d4('0x23')][_0x08d4('0x70')]=util[_0x08d4('0x59')](_0x08d4('0x71'),_0x1d4539[_0x08d4('0x5b')]['name']);_0x166ae7['message']['channel']=_0x166ae7[_0x08d4('0x72')];_0x166ae7['message'][_0x08d4('0x73')]=_0x166ae7[_0x08d4('0x72')];_0x166ae7[_0x08d4('0x23')][_0x08d4('0x74')]='accept';return respondWithRpcPromise(_0x08d4('0x75'),_0x08d4('0x75'),{'event':_0x08d4('0x76'),'message':_0x166ae7[_0x08d4('0x23')]},client9002)[_0x08d4('0x1c')](function(){return _0x166ae7;});}return _0x166ae7;}return null;})[_0x08d4('0x1c')](respondWithResult(_0x241a52,null))['catch'](handleError(_0x241a52,null));};var interaction_log=require(_0x08d4('0x10'))(_0x08d4('0x77'));exports['reject']=function(_0xf23dd3,_0x5370da,_0x41ff82){var _0x346501={'agent':{},'channel':'openchannel'};if(_0xf23dd3[_0x08d4('0x54')]['id']){delete _0xf23dd3[_0x08d4('0x54')]['id'];}_0xf23dd3['body'][_0x08d4('0x5a')]=_0xf23dd3['body'][_0x08d4('0x5a')]||_0xf23dd3['user']['id'];_0x346501[_0x08d4('0x5c')]['id']=_0xf23dd3[_0x08d4('0x54')][_0x08d4('0x5a')];return db[_0x08d4('0x37')][_0x08d4('0x52')]({'where':{'id':_0xf23dd3['params']['id'],'UserId':null}})[_0x08d4('0x1c')](handleEntityNotFound(_0x5370da,null))[_0x08d4('0x1c')](function(_0x14423f){if(_0x14423f){_0x346501[_0x08d4('0x23')]=_0x14423f[_0x08d4('0x61')]({'plain':!![]});return db[_0x08d4('0x5d')][_0x08d4('0x52')]({'where':{'id':_0x14423f[_0x08d4('0x5e')]}});}return null;})[_0x08d4('0x1c')](handleEntityNotFound(_0x5370da,null))[_0x08d4('0x1c')](function(_0x187148){if(_0x187148){_0x346501[_0x08d4('0x60')]=_0x187148[_0x08d4('0x61')]({'plain':!![]});interaction_log[_0x08d4('0x1d')](_0x08d4('0x78'),_0xf23dd3[_0x08d4('0x5b')]['id'],_0xf23dd3[_0x08d4('0x5b')]['name'],_0xf23dd3['user'][_0x08d4('0x79')],_0x346501[_0x08d4('0x60')]['id'],_0xf23dd3[_0x08d4('0x54')]?JSON[_0x08d4('0x63')](_0xf23dd3[_0x08d4('0x54')]):'null');return respondWithRpcPromise(_0x08d4('0x7a'),_0x08d4('0x7b'),_0x346501);}return null;})['then'](function(_0x410afe){var _0x3b4957=_0x08d4('0x67')+_0x410afe['message'][_0x08d4('0x7c')];return db[_0x08d4('0x68')][_0x08d4('0x3b')](_0x3b4957,{'type':db[_0x08d4('0x69')][_0x08d4('0x6a')]['SELECT'],'raw':!![]})[_0x08d4('0x1c')](function(_0x4e9ba8){return _0x4e9ba8;});})[_0x08d4('0x1c')](function(_0x146282){if(_0x146282){_0x346501['message'][_0x08d4('0x6c')]=_0x146282[0x0];if(!_0xf23dd3[_0x08d4('0x54')][_0x08d4('0x5a')])return;return db[_0x08d4('0x7d')][_0x08d4('0x52')]({'where':{'id':_0xf23dd3[_0x08d4('0x54')][_0x08d4('0x5a')],'role':_0x08d4('0x5c')},'attributes':['id','name',_0x08d4('0x6d'),_0x08d4('0x7e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5c6832){if(!_0x5c6832)return null;_0x346501[_0x08d4('0x23')][_0x08d4('0x5c')]=_0x5c6832;return _0x346501;})[_0x08d4('0x1c')](function(_0x281e53){if(_0x281e53){_0x281e53[_0x08d4('0x23')]['interface']=util[_0x08d4('0x59')](_0x08d4('0x71'),_0xf23dd3['user'][_0x08d4('0x34')]);_0x281e53['message'][_0x08d4('0x72')]=_0x346501[_0x08d4('0x72')];_0x281e53['message']['motionChannel']=_0x346501['channel'];_0x281e53[_0x08d4('0x23')][_0x08d4('0x74')]=_0x08d4('0x2f');respondWithRpcPromise('EventManager','EventManager',{'event':_0x08d4('0x7f'),'message':_0x281e53[_0x08d4('0x23')]},client9002);return _0x346501;}return null;})['then'](respondWithResult(_0x5370da,null))[_0x08d4('0x4e')](handleError(_0x5370da,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index fbc7a31..40139bc 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 _0xe1ff=['setMaxListeners','update','emit','hook','events','OpenchannelMessage'];(function(_0x18c44d,_0x33976d){var _0x71abcf=function(_0x43072b){while(--_0x43072b){_0x18c44d['push'](_0x18c44d['shift']());}};_0x71abcf(++_0x33976d);}(_0xe1ff,0xdc));var _0xfe1f=function(_0x50be1d,_0x1b947a){_0x50be1d=_0x50be1d-0x0;var _0xa0e02c=_0xe1ff[_0x50be1d];return _0xa0e02c;};'use strict';var EventEmitter=require(_0xfe1f('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xfe1f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfe1f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe1f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e31ab){return function(_0xf77eab,_0x36b020,_0x8209aa){OpenchannelMessageEvents[_0xfe1f('0x4')](_0x1e31ab+':'+_0xf77eab['id'],_0xf77eab);OpenchannelMessageEvents['emit'](_0x1e31ab,_0xf77eab);_0x8209aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xfe1f('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xf378=['emit','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x5be1bb,_0xb97fcc){var _0x39c104=function(_0x10af50){while(--_0x10af50){_0x5be1bb['push'](_0x5be1bb['shift']());}};_0x39c104(++_0xb97fcc);}(_0xf378,0x77));var _0x8f37=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf378[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require(_0x8f37('0x0'));var OpenchannelMessage=require(_0x8f37('0x1'))['db'][_0x8f37('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8f37('0x3')](0x0);var events={'afterCreate':_0x8f37('0x4'),'afterUpdate':_0x8f37('0x5'),'afterDestroy':_0x8f37('0x6')};function emitEvent(_0x3e58d4){return function(_0x2dbf6b,_0x1c9df2,_0x2aec25){OpenchannelMessageEvents[_0x8f37('0x7')](_0x3e58d4+':'+_0x2dbf6b['id'],_0x2dbf6b);OpenchannelMessageEvents[_0x8f37('0x7')](_0x3e58d4,_0x2dbf6b);_0x2aec25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8f37('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8d1e2e9..a3e69c2 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 _0x9992=['exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','toLowerCase','direction','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','Interactions','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','POST','method','GET','body','info','Message\x20%d\x20forwarded\x20to\x20%s','replyUri','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x8c5f12,_0x2fbc1d){var _0x41220d=function(_0x1bb566){while(--_0x1bb566){_0x8c5f12['push'](_0x8c5f12['shift']());}};_0x41220d(++_0x2fbc1d);}(_0x9992,0x129));var _0x2999=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x9992[_0x5b34c0];return _0x242bd3;};'use strict';var _=require('lodash');var util=require(_0x2999('0x0'));var logger=require(_0x2999('0x1'))(_0x2999('0x2'));var moment=require('moment');var BPromise=require(_0x2999('0x3'));var rp=require(_0x2999('0x4'));var fs=require('fs');var path=require(_0x2999('0x5'));var rimraf=require(_0x2999('0x6'));var config=require(_0x2999('0x7'));var attributes=require(_0x2999('0x8'));module[_0x2999('0x9')]=function(_0x160a7c,_0x25d0f6){return _0x160a7c['define'](_0x2999('0xa'),attributes,{'tableName':_0x2999('0xb'),'paranoid':![],'indexes':[{'name':_0x2999('0xc'),'fields':['body'],'type':_0x2999('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bee88,_0x189049,_0x18ad7d){var _0x44b23a=_0x160a7c['models'];var _0x39053b=_0x3bee88[_0x2999('0xe')]({'plain':!![]});if(_0x39053b['direction'][_0x2999('0xf')]()==='in'||_0x39053b[_0x2999('0x10')][_0x2999('0xf')]()===_0x2999('0x11')&&!_0x39053b[_0x2999('0x12')]&&!_['isNil'](_0x39053b['UserId'])){_0x44b23a[_0x2999('0x13')][_0x2999('0x14')]({'where':{'id':_0x39053b[_0x2999('0x15')]}})[_0x2999('0x16')](function(_0x16c9a7){if(_0x16c9a7){_0x16c9a7[_0x2999('0x17')]({'lastMsgAt':_0x39053b[_0x2999('0x18')],'lastMsgDirection':_0x39053b['direction'][_0x2999('0xf')]()});}})[_0x2999('0x19')](function(_0x568484){console[_0x2999('0x1a')](_0x568484);});}if(_0x39053b['direction']===_0x2999('0x11')&&!_0x39053b[_0x2999('0x12')]){var _0x99e097;_0x44b23a[_0x2999('0x1b')]['describe']()[_0x2999('0x16')](function(_0x19f0a7){return _0x44b23a[_0x2999('0x1c')][_0x2999('0x1d')]({'where':{'id':_0x39053b['OpenchannelAccountId']},'include':[{'model':_0x44b23a['OpenchannelInteraction'],'as':_0x2999('0x1e'),'where':{'id':_0x39053b[_0x2999('0x15')]},'limit':0x1,'include':[{'model':_0x44b23a[_0x2999('0x1b')],'as':_0x2999('0x1f'),'attributes':_[_0x2999('0x20')](_0x19f0a7)}]}]});})[_0x2999('0x16')](function(_0x37a1d2){_0x99e097=_0x37a1d2[_0x2999('0xe')]({'plain':!![]});if(_0x99e097&&_0x99e097['replyUri']){logger['info'](_0x2999('0x21'),_0x2999('0x22'),util[_0x2999('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x39053b['id'],_0x99e097['replyUri']));if(_0x99e097[_0x2999('0x1e')]&&_0x99e097[_0x2999('0x1e')][_0x2999('0x24')]){_0x39053b[_0x2999('0x25')]=_[_0x2999('0x26')](_0x99e097[_0x2999('0x1e')][0x0],_0x2999('0x1f'));_0x39053b['Contact']=_0x99e097[_0x2999('0x1e')][0x0][_0x2999('0x1f')];}var _0x189049={'method':_0x2999('0x27'),'uri':encodeURI(_0x99e097['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x189049[_0x2999('0x28')]){case _0x2999('0x29'):_0x189049['qs']=_0x39053b;break;case _0x2999('0x27'):_0x189049[_0x2999('0x2a')]=_0x39053b;break;}return rp(_0x189049)['then'](function(_0x4f31bd){logger[_0x2999('0x2b')](_0x2999('0x21'),_0x2999('0x22'),util[_0x2999('0x23')](_0x2999('0x2c'),_0x39053b['id'],_0x99e097[_0x2999('0x2d')]));if(_0x4f31bd[_0x2999('0x2a')][_0x2999('0x2e')]&&_0x4f31bd['body'][_0x2999('0x2e')]!=_0x39053b[_0x2999('0x25')][_0x2999('0x2e')]){return _0x44b23a['OpenchannelInteraction']['update']({'threadId':_0x4f31bd['body'][_0x2999('0x2e')]},{'where':{'id':_0x39053b[_0x2999('0x25')]['id']}});}else{return;}})['then'](function(){return _0x3bee88[_0x2999('0x17')]({'read':!![]});})['catch'](function(_0x5e356d){logger[_0x2999('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x2999('0x22'),util[_0x2999('0x2f')](_0x5e356d,{'showHidden':![],'depth':null}));_0x18ad7d();});}else{_0x18ad7d();}})[_0x2999('0x30')](function(){_0x18ad7d();});}else{_0x18ad7d();}}},'charset':_0x2999('0x31'),'collate':_0x2999('0x32')});}; \ No newline at end of file +var _0x8947=['find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','get','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','toLowerCase','catch','error','secret','describe','then','OpenchannelAccount'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x8947,0x198));var _0x7894=function(_0xdc3e6b,_0x1b8e24){_0xdc3e6b=_0xdc3e6b-0x0;var _0x4702cb=_0x8947[_0xdc3e6b];return _0x4702cb;};'use strict';var _=require(_0x7894('0x0'));var util=require(_0x7894('0x1'));var logger=require(_0x7894('0x2'))(_0x7894('0x3'));var moment=require(_0x7894('0x4'));var BPromise=require(_0x7894('0x5'));var rp=require(_0x7894('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7894('0x7'));var config=require(_0x7894('0x8'));var attributes=require(_0x7894('0x9'));module[_0x7894('0xa')]=function(_0x1a8534,_0x57a380){return _0x1a8534[_0x7894('0xb')](_0x7894('0xc'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x7894('0xd'),'fields':[_0x7894('0xe')],'type':_0x7894('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2ef5,_0x89e0ed,_0x4fcfa0){var _0x4086e8=_0x1a8534[_0x7894('0x10')];var _0x41a8f9=_0x5b2ef5['get']({'plain':!![]});if(_0x41a8f9[_0x7894('0x11')]['toLowerCase']()==='in'||_0x41a8f9['direction']['toLowerCase']()==='out'&&!_0x41a8f9['secret']&&!_[_0x7894('0x12')](_0x41a8f9[_0x7894('0x13')])){_0x4086e8[_0x7894('0x14')][_0x7894('0x15')]({'where':{'id':_0x41a8f9[_0x7894('0x16')]}})['then'](function(_0x4a3a61){if(_0x4a3a61){_0x4a3a61[_0x7894('0x17')]({'lastMsgAt':_0x41a8f9[_0x7894('0x18')],'lastMsgDirection':_0x41a8f9['direction'][_0x7894('0x19')]()});}})[_0x7894('0x1a')](function(_0x18654e){console[_0x7894('0x1b')](_0x18654e);});}if(_0x41a8f9[_0x7894('0x11')]==='out'&&!_0x41a8f9[_0x7894('0x1c')]){var _0x5a5f02;_0x4086e8['CmContact'][_0x7894('0x1d')]()[_0x7894('0x1e')](function(_0x204d86){return _0x4086e8[_0x7894('0x1f')][_0x7894('0x20')]({'where':{'id':_0x41a8f9[_0x7894('0x21')]},'include':[{'model':_0x4086e8[_0x7894('0x14')],'as':_0x7894('0x22'),'where':{'id':_0x41a8f9[_0x7894('0x16')]},'limit':0x1,'include':[{'model':_0x4086e8[_0x7894('0x23')],'as':_0x7894('0x24'),'attributes':_[_0x7894('0x25')](_0x204d86)}]}]});})[_0x7894('0x1e')](function(_0x4aba30){_0x5a5f02=_0x4aba30[_0x7894('0x26')]({'plain':!![]});if(_0x5a5f02&&_0x5a5f02['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x7894('0x27'),util[_0x7894('0x28')](_0x7894('0x29'),_0x41a8f9['id'],_0x5a5f02[_0x7894('0x2a')]));if(_0x5a5f02[_0x7894('0x22')]&&_0x5a5f02[_0x7894('0x22')][_0x7894('0x2b')]){_0x41a8f9[_0x7894('0x2c')]=_[_0x7894('0x2d')](_0x5a5f02['Interactions'][0x0],_0x7894('0x24'));_0x41a8f9[_0x7894('0x24')]=_0x5a5f02['Interactions'][0x0]['Contact'];}var _0x89e0ed={'method':_0x7894('0x2e'),'uri':encodeURI(_0x5a5f02['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x89e0ed[_0x7894('0x2f')]){case _0x7894('0x30'):_0x89e0ed['qs']=_0x41a8f9;break;case _0x7894('0x2e'):_0x89e0ed[_0x7894('0xe')]=_0x41a8f9;break;}return rp(_0x89e0ed)[_0x7894('0x1e')](function(_0x218394){logger[_0x7894('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x7894('0x27'),util[_0x7894('0x28')](_0x7894('0x32'),_0x41a8f9['id'],_0x5a5f02[_0x7894('0x2a')]));if(_0x218394[_0x7894('0xe')]['threadId']&&_0x218394[_0x7894('0xe')][_0x7894('0x33')]!=_0x41a8f9[_0x7894('0x2c')][_0x7894('0x33')]){return _0x4086e8[_0x7894('0x14')]['update']({'threadId':_0x218394[_0x7894('0xe')][_0x7894('0x33')]},{'where':{'id':_0x41a8f9[_0x7894('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x5b2ef5[_0x7894('0x17')]({'read':!![]});})[_0x7894('0x1a')](function(_0x31275f){logger[_0x7894('0x1b')](_0x7894('0x34'),_0x7894('0x27'),util[_0x7894('0x35')](_0x31275f,{'showHidden':![],'depth':null}));_0x4fcfa0();});}else{_0x4fcfa0();}})['finally'](function(){_0x4fcfa0();});}else{_0x4fcfa0();}}},'charset':'utf8mb4','collate':_0x7894('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ad5f664..eee0049 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x1f0f95,_0x25ccac){var _0x354f1f=function(_0x2b4841){while(--_0x2b4841){_0x1f0f95['push'](_0x1f0f95['shift']());}};_0x354f1f(++_0x25ccac);}(_0xadb5,0xad));var _0x5adb=function(_0x52f76e,_0x37be73){_0x52f76e=_0x52f76e-0x0;var _0x645303=_0xadb5[_0x52f76e];return _0x645303;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x560b6c,_0x494654){var _0x4fc247=function(_0xce2790){while(--_0xce2790){_0x560b6c['push'](_0x560b6c['shift']());}};_0x4fc247(++_0x494654);}(_0xadb5,0xad));var _0x5adb=function(_0x335e38,_0x4181c2){_0x335e38=_0x335e38-0x0;var _0x467580=_0xadb5[_0x335e38];return _0x467580;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a41b0d9..48b2720 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 _0x1298=['save','update','emit','register','length','openchannelMessage:'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x1298,0x19e));var _0x8129=function(_0x23a3ff,_0x50b508){_0x23a3ff=_0x23a3ff-0x0;var _0x59b890=_0x1298[_0x23a3ff];return _0x59b890;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x8129('0x0'),'remove',_0x8129('0x1')];function createListener(_0x11c863,_0x5bdd76){return function(_0x3a133f){_0x5bdd76[_0x8129('0x2')](_0x11c863,_0x3a133f);};}function removeListener(_0x31d02a,_0x39e214){return function(){OpenchannelMessageEvents['removeListener'](_0x31d02a,_0x39e214);};}exports[_0x8129('0x3')]=function(_0x193d60){for(var _0x579301=0x0,_0x4f0a40=events[_0x8129('0x4')];_0x579301<_0x4f0a40;_0x579301++){var _0x2d07d5=events[_0x579301];var _0x3ff6e0=createListener(_0x8129('0x5')+_0x2d07d5,_0x193d60);OpenchannelMessageEvents['on'](_0x2d07d5,_0x3ff6e0);}}; \ No newline at end of file +var _0xd6c6=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x3fc3bc,_0x3b0f53){var _0x590ccf=function(_0x1f8d76){while(--_0x1f8d76){_0x3fc3bc['push'](_0x3fc3bc['shift']());}};_0x590ccf(++_0x3b0f53);}(_0xd6c6,0xcf));var _0x6d6c=function(_0x426bf4,_0x55276d){_0x426bf4=_0x426bf4-0x0;var _0x2c017c=_0xd6c6[_0x426bf4];return _0x2c017c;};'use strict';var OpenchannelMessageEvents=require(_0x6d6c('0x0'));var events=[_0x6d6c('0x1'),_0x6d6c('0x2'),_0x6d6c('0x3')];function createListener(_0x40f752,_0x538a6a){return function(_0x1a30f0){_0x538a6a[_0x6d6c('0x4')](_0x40f752,_0x1a30f0);};}function removeListener(_0x52bf30,_0x5d1ccc){return function(){OpenchannelMessageEvents[_0x6d6c('0x5')](_0x52bf30,_0x5d1ccc);};}exports['register']=function(_0x3a0c1e){for(var _0x10d08f=0x0,_0xce89f7=events[_0x6d6c('0x6')];_0x10d08f<_0xce89f7;_0x10d08f++){var _0x2a4102=events[_0x10d08f];var _0x23ae09=createListener(_0x6d6c('0x7')+_0x2a4102,_0x3a0c1e);OpenchannelMessageEvents['on'](_0x2a4102,_0x23ae09);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 94185ba..cd8c25a 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 _0x6e38=['create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','show','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x34b245,_0xfe65b4){var _0x3a8984=function(_0x12c6a8){while(--_0x12c6a8){_0x34b245['push'](_0x34b245['shift']());}};_0x3a8984(++_0xfe65b4);}(_0x6e38,0x167));var _0x86e3=function(_0x4dcea3,_0x47772e){_0x4dcea3=_0x4dcea3-0x0;var _0x5424bd=_0x6e38[_0x4dcea3];return _0x5424bd;};'use strict';var multer=require(_0x86e3('0x0'));var util=require(_0x86e3('0x1'));var path=require('path');var timeout=require(_0x86e3('0x2'));var express=require(_0x86e3('0x3'));var router=express[_0x86e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86e3('0x5'));var interaction=require(_0x86e3('0x6'));var config=require(_0x86e3('0x7'));var controller=require(_0x86e3('0x8'));router[_0x86e3('0x9')]('/',auth[_0x86e3('0xa')](),controller[_0x86e3('0xb')]);router['get'](_0x86e3('0xc'),auth[_0x86e3('0xa')](),controller['describe']);router[_0x86e3('0x9')]('/:id',auth[_0x86e3('0xa')](),controller[_0x86e3('0xd')]);router[_0x86e3('0x9')]('/:id/members',auth[_0x86e3('0xa')](),controller['getMembers']);router[_0x86e3('0x9')](_0x86e3('0xe'),auth[_0x86e3('0xa')](),controller[_0x86e3('0xf')]);router['get'](_0x86e3('0x10'),auth[_0x86e3('0xa')](),controller[_0x86e3('0x11')]);router['post']('/',auth[_0x86e3('0xa')](),controller[_0x86e3('0x12')]);router[_0x86e3('0x13')](_0x86e3('0xe'),auth[_0x86e3('0xa')](),controller[_0x86e3('0x14')]);router[_0x86e3('0x13')](_0x86e3('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x86e3('0x15')](_0x86e3('0x16'),auth['isAuthenticated'](),controller[_0x86e3('0x17')]);router[_0x86e3('0x18')](_0x86e3('0x16'),auth[_0x86e3('0xa')](),controller[_0x86e3('0x19')]);router['delete'](_0x86e3('0xe'),auth[_0x86e3('0xa')](),controller[_0x86e3('0x1a')]);router[_0x86e3('0x18')](_0x86e3('0x10'),auth[_0x86e3('0xa')](),controller[_0x86e3('0x1b')]);module[_0x86e3('0x1c')]=router; \ No newline at end of file +var _0xa7a5=['/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x19ef32,_0x3b78ff){var _0x20034e=function(_0x3eb2d9){while(--_0x3eb2d9){_0x19ef32['push'](_0x19ef32['shift']());}};_0x20034e(++_0x3b78ff);}(_0xa7a5,0x134));var _0x5a7a=function(_0x3940f8,_0x30aac4){_0x3940f8=_0x3940f8-0x0;var _0x4b7fa5=_0xa7a5[_0x3940f8];return _0x4b7fa5;};'use strict';var multer=require(_0x5a7a('0x0'));var util=require(_0x5a7a('0x1'));var path=require(_0x5a7a('0x2'));var timeout=require(_0x5a7a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a7a('0x4'));var auth=require(_0x5a7a('0x5'));var interaction=require(_0x5a7a('0x6'));var config=require(_0x5a7a('0x7'));var controller=require('./openchannelQueue.controller');router[_0x5a7a('0x8')]('/',auth[_0x5a7a('0x9')](),controller[_0x5a7a('0xa')]);router[_0x5a7a('0x8')](_0x5a7a('0xb'),auth['isAuthenticated'](),controller[_0x5a7a('0xc')]);router[_0x5a7a('0x8')]('/:id',auth[_0x5a7a('0x9')](),controller[_0x5a7a('0xd')]);router[_0x5a7a('0x8')](_0x5a7a('0xe'),auth[_0x5a7a('0x9')](),controller[_0x5a7a('0xf')]);router[_0x5a7a('0x8')](_0x5a7a('0x10'),auth['isAuthenticated'](),controller[_0x5a7a('0x11')]);router[_0x5a7a('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x5a7a('0x12')]);router[_0x5a7a('0x13')]('/',auth[_0x5a7a('0x9')](),controller[_0x5a7a('0x14')]);router[_0x5a7a('0x13')](_0x5a7a('0x10'),auth[_0x5a7a('0x9')](),controller[_0x5a7a('0x15')]);router[_0x5a7a('0x13')](_0x5a7a('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5a7a('0x17')]('/:id',auth[_0x5a7a('0x9')](),controller[_0x5a7a('0x18')]);router[_0x5a7a('0x19')]('/:id',auth[_0x5a7a('0x9')](),controller[_0x5a7a('0x1a')]);router[_0x5a7a('0x19')](_0x5a7a('0x10'),auth[_0x5a7a('0x9')](),controller[_0x5a7a('0x1b')]);router['delete']('/:id/users',auth[_0x5a7a('0x9')](),controller['removeAgents']);module[_0x5a7a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6f00172..2204756 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 _0x0f95=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x0f95,0x1c2));var _0x50f9=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x0f95[_0x5d07ff];return _0x5226ad;};'use strict';var Sequelize=require(_0x50f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x50f9('0x1')],'unique':_0x50f9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x50f9('0x1')]},'timeout':{'type':Sequelize[_0x50f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x50f9('0x4'),_0x50f9('0x5'),_0x50f9('0x6'))}}; \ No newline at end of file +var _0x939d=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x33f0c1,_0x4eb140){var _0x1145b6=function(_0x5bedc9){while(--_0x5bedc9){_0x33f0c1['push'](_0x33f0c1['shift']());}};_0x1145b6(++_0x4eb140);}(_0x939d,0x15d));var _0xd939=function(_0x58bc5c,_0x111dd5){_0x58bc5c=_0x58bc5c-0x0;var _0x1bbfef=_0x939d[_0x58bc5c];return _0x1bbfef;};'use strict';var Sequelize=require(_0xd939('0x0'));module[_0xd939('0x1')]={'name':{'type':Sequelize[_0xd939('0x2')],'unique':_0xd939('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd939('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd939('0x5')](_0xd939('0x6'),_0xd939('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3f62ebf..a98f1a2 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 _0xfda7=['ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','OpenchannelQueues','error','stack','name','index','OpenchannelQueue','type','key','getOptions','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','rawAttributes','filters','order','sort','where','pick','OpenchannelQueueId','filter','map','findAndCountAll','UserId','agent','format','%s/%s','SIP','openchannelPause','createdAt','updatedAt','getTeams','hasOwnProperty','nolimit','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams'];(function(_0x2a83dc,_0x24697a){var _0x18ef39=function(_0x2ca9fe){while(--_0x2ca9fe){_0x2a83dc['push'](_0x2a83dc['shift']());}};_0x18ef39(++_0x24697a);}(_0xfda7,0x18e));var _0x7fda=function(_0x2dd18f,_0x37dc7c){_0x2dd18f=_0x2dd18f-0x0;var _0x46243a=_0xfda7[_0x2dd18f];return _0x46243a;};'use strict';var BPromise=require(_0x7fda('0x0'));var util=require(_0x7fda('0x1'));var _=require(_0x7fda('0x2'));var squel=require(_0x7fda('0x3'));var Redis=require('ioredis');var qs=require(_0x7fda('0x4'));var logger=require(_0x7fda('0x5'))(_0x7fda('0x6'));var config=require(_0x7fda('0x7'));var db=require('../../mysqldb')['db'];config[_0x7fda('0x8')]=_[_0x7fda('0x9')](config[_0x7fda('0x8')],{'host':_0x7fda('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fda('0x8')]));require('./openchannelQueue.socket')[_0x7fda('0xb')](socket);function respondWithStatusCode(_0xa2d44,_0x42f4f3){_0x42f4f3=_0x42f4f3||0xcc;return function(_0x58d12e){if(_0x58d12e){return _0xa2d44['sendStatus'](_0x42f4f3);}return _0xa2d44[_0x7fda('0xc')](_0x42f4f3)[_0x7fda('0xd')]();};}function respondWithResult(_0xba9718,_0x41f5c7){_0x41f5c7=_0x41f5c7||0xc8;return function(_0x41f5ab){if(_0x41f5ab){return _0xba9718[_0x7fda('0xc')](_0x41f5c7)[_0x7fda('0xe')](_0x41f5ab);}};}function respondWithFilteredResult(_0x37fc00,_0x5b3d85){return function(_0x33f195){if(_0x33f195){var _0x2d08e5=typeof _0x5b3d85[_0x7fda('0xf')]===_0x7fda('0x10')&&typeof _0x5b3d85['limit']==='undefined';var _0x28c935=_0x33f195[_0x7fda('0x11')];var _0x2a10e6=_0x2d08e5?0x0:_0x5b3d85[_0x7fda('0xf')];var _0x2a544a=_0x2d08e5?_0x33f195[_0x7fda('0x11')]:_0x5b3d85[_0x7fda('0xf')]+_0x5b3d85[_0x7fda('0x12')];var _0x135f9e;if(_0x2a544a>=_0x28c935){_0x2a544a=_0x28c935;_0x135f9e=0xc8;}else{_0x135f9e=0xce;}_0x37fc00[_0x7fda('0xc')](_0x135f9e);return _0x37fc00[_0x7fda('0x13')](_0x7fda('0x14'),_0x2a10e6+'-'+_0x2a544a+'/'+_0x28c935)[_0x7fda('0xe')](_0x33f195);}return null;};}function saveUpdates(_0x1f4fa0){return function(_0x2ed0d2){if(_0x2ed0d2){return _0x2ed0d2[_0x7fda('0x15')](_0x1f4fa0)[_0x7fda('0x16')](function(_0xc6312f){return _0xc6312f;});}return null;};}function removeEntity(_0x3f10a2){return function(_0xb43bde){if(_0xb43bde){return _0xb43bde[_0x7fda('0x17')]()[_0x7fda('0x16')](function(){var _0xee1000=_0xb43bde[_0x7fda('0x18')]({'plain':!![]});var _0x412f06=_0x7fda('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x412f06,'resourceId':_0xee1000['id']}})[_0x7fda('0x16')](function(){return _0xb43bde;});})['then'](function(){_0x3f10a2[_0x7fda('0xc')](0xcc)[_0x7fda('0xd')]();});}};}function handleEntityNotFound(_0x3c34be){return function(_0x27a823){if(!_0x27a823){_0x3c34be['sendStatus'](0x194);}return _0x27a823;};}function handleError(_0x232147,_0x139ed5){_0x139ed5=_0x139ed5||0x1f4;return function(_0x2f2d35){logger[_0x7fda('0x1a')](_0x2f2d35[_0x7fda('0x1b')]);if(_0x2f2d35[_0x7fda('0x1c')]){delete _0x2f2d35['name'];}_0x232147[_0x7fda('0xc')](_0x139ed5)['send'](_0x2f2d35);};}exports[_0x7fda('0x1d')]=function(_0x4f07c2,_0x3ecba9){var _0x4aa8ae={};var _0x390b33={'count':0x0,'rows':[]};var _0x387da5=_['map'](db[_0x7fda('0x1e')]['rawAttributes'],function(_0xb35bcb){return{'name':_0xb35bcb['fieldName'],'type':_0xb35bcb[_0x7fda('0x1f')][_0x7fda('0x20')]};});_0x4aa8ae=qs[_0x7fda('0x21')](_0x387da5,_0x4f07c2);var _0x4eb99f={'where':_0x4aa8ae['where']};return db[_0x7fda('0x1e')][_0x7fda('0x11')](_0x4eb99f)[_0x7fda('0x16')](function(_0x43d111){_0x390b33['count']=_0x43d111;_0x4aa8ae['include']=qs[_0x7fda('0x22')](_0x4f07c2[_0x7fda('0x23')]);return db[_0x7fda('0x1e')][_0x7fda('0x24')](_0x4aa8ae);})[_0x7fda('0x16')](function(_0x1727b9){_0x390b33[_0x7fda('0x25')]=_0x1727b9;return _0x390b33;})[_0x7fda('0x16')](respondWithFilteredResult(_0x3ecba9,_0x4aa8ae))[_0x7fda('0x26')](handleError(_0x3ecba9,null));};exports[_0x7fda('0x27')]=function(_0x418fab,_0x577808){var _0x44248e={'raw':!![],'where':{'id':_0x418fab[_0x7fda('0x28')]['id']}},_0x394ef3={};_0x394ef3[_0x7fda('0x29')]=_[_0x7fda('0x2a')](db[_0x7fda('0x1e')]['rawAttributes']);_0x394ef3[_0x7fda('0x23')]=_['keys'](_0x418fab[_0x7fda('0x23')]);_0x394ef3['filters']=_[_0x7fda('0x2b')](_0x394ef3['model'],_0x394ef3[_0x7fda('0x23')]);_0x44248e[_0x7fda('0x2c')]=_[_0x7fda('0x2b')](_0x394ef3[_0x7fda('0x29')],qs[_0x7fda('0x2d')](_0x418fab[_0x7fda('0x23')]['fields']));_0x44248e[_0x7fda('0x2c')]=_0x44248e[_0x7fda('0x2c')][_0x7fda('0x2e')]?_0x44248e[_0x7fda('0x2c')]:_0x394ef3[_0x7fda('0x29')];if(_0x418fab[_0x7fda('0x23')][_0x7fda('0x2f')]){_0x44248e[_0x7fda('0x22')]=[{'all':!![]}];}_0x44248e=_[_0x7fda('0x30')]({},_0x44248e,_0x418fab[_0x7fda('0x31')]);return db[_0x7fda('0x1e')][_0x7fda('0x32')](_0x44248e)[_0x7fda('0x16')](handleEntityNotFound(_0x577808,null))[_0x7fda('0x16')](respondWithResult(_0x577808,null))[_0x7fda('0x26')](handleError(_0x577808,null));};exports['create']=function(_0x392568,_0x240a5b){return db[_0x7fda('0x1e')][_0x7fda('0x33')](_0x392568[_0x7fda('0x34')],{})[_0x7fda('0x16')](function(_0x38c9e4){var _0xe918ba=_0x392568[_0x7fda('0x35')][_0x7fda('0x18')]({'plain':!![]});if(!_0xe918ba)throw new Error(_0x7fda('0x36'));if(_0xe918ba['role']===_0x7fda('0x35')){var _0x5205b8=_0x38c9e4[_0x7fda('0x18')]({'plain':!![]});var _0x1f8ed9=_0x7fda('0x19');return db[_0x7fda('0x37')]['find']({'where':{'name':_0x1f8ed9,'userProfileId':_0xe918ba[_0x7fda('0x38')]},'raw':!![]})[_0x7fda('0x16')](function(_0x371ef3){if(_0x371ef3&&_0x371ef3[_0x7fda('0x39')]===0x0){return db[_0x7fda('0x3a')][_0x7fda('0x33')]({'name':_0x5205b8[_0x7fda('0x1c')],'resourceId':_0x5205b8['id'],'type':_0x371ef3['name'],'sectionId':_0x371ef3['id']},{})[_0x7fda('0x16')](function(){return _0x38c9e4;});}else{return _0x38c9e4;}})[_0x7fda('0x26')](function(_0x1fffc4){logger[_0x7fda('0x1a')](_0x7fda('0x3b'),_0x1fffc4);throw _0x1fffc4;});}return _0x38c9e4;})[_0x7fda('0x16')](respondWithResult(_0x240a5b,0xc9))[_0x7fda('0x26')](handleError(_0x240a5b,null));};exports[_0x7fda('0x15')]=function(_0x11f3fc,_0x18a771){if(_0x11f3fc[_0x7fda('0x34')]['id']){delete _0x11f3fc['body']['id'];}return db[_0x7fda('0x1e')][_0x7fda('0x32')]({'where':{'id':_0x11f3fc[_0x7fda('0x28')]['id']}})['then'](handleEntityNotFound(_0x18a771,null))[_0x7fda('0x16')](saveUpdates(_0x11f3fc[_0x7fda('0x34')],null))[_0x7fda('0x16')](respondWithResult(_0x18a771,null))[_0x7fda('0x26')](handleError(_0x18a771,null));};exports['destroy']=function(_0x477a86,_0x4caf2b){return db['OpenchannelQueue'][_0x7fda('0x32')]({'where':{'id':_0x477a86[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](handleEntityNotFound(_0x4caf2b,null))['then'](removeEntity(_0x4caf2b,null))[_0x7fda('0x26')](handleError(_0x4caf2b,null));};exports[_0x7fda('0x3c')]=function(_0x559549,_0x6e05fc){return db[_0x7fda('0x1e')][_0x7fda('0x3c')]()['then'](respondWithResult(_0x6e05fc,null))[_0x7fda('0x26')](handleError(_0x6e05fc,null));};exports['getMembers']=function(_0x5070d2,_0x1da0b2){var _0x57d1c2={'raw':!![],'where':{}},_0x2a8fdb={},_0xa906b1;return db[_0x7fda('0x1e')][_0x7fda('0x3d')]({'where':{'id':_0x5070d2[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](handleEntityNotFound(_0x1da0b2,null))['then'](function(_0x9d68ce){if(_0x9d68ce){_0xa906b1=_0x9d68ce[_0x7fda('0x18')]({'plain':!![]});_0x2a8fdb[_0x7fda('0x29')]=_[_0x7fda('0x2a')](db[_0x7fda('0x3e')][_0x7fda('0x3f')]);_0x2a8fdb[_0x7fda('0x23')]=_['keys'](_0x5070d2[_0x7fda('0x23')]);_0x2a8fdb[_0x7fda('0x40')]=_[_0x7fda('0x2b')](_0x2a8fdb[_0x7fda('0x29')],_0x2a8fdb['query']);_0x57d1c2[_0x7fda('0x2c')]=_[_0x7fda('0x2b')](_0x2a8fdb[_0x7fda('0x29')],qs['fields'](_0x5070d2['query'][_0x7fda('0x2d')]));_0x57d1c2[_0x7fda('0x2c')]=_0x57d1c2[_0x7fda('0x2c')][_0x7fda('0x2e')]?_0x57d1c2['attributes']:_0x2a8fdb['model'];if(!_0x5070d2[_0x7fda('0x23')]['hasOwnProperty']('nolimit')){_0x57d1c2[_0x7fda('0x12')]=qs[_0x7fda('0x12')](_0x5070d2['query']['limit']);_0x57d1c2['offset']=qs[_0x7fda('0xf')](_0x5070d2[_0x7fda('0x23')][_0x7fda('0xf')]);}_0x57d1c2[_0x7fda('0x41')]=qs[_0x7fda('0x42')](_0x5070d2[_0x7fda('0x23')][_0x7fda('0x42')]);_0x57d1c2[_0x7fda('0x43')]=qs[_0x7fda('0x40')](_[_0x7fda('0x44')](_0x5070d2[_0x7fda('0x23')],_0x2a8fdb[_0x7fda('0x40')]));_0x57d1c2[_0x7fda('0x43')][_0x7fda('0x45')]=_0x9d68ce['id'];if(_0x5070d2['query'][_0x7fda('0x46')]){_0x57d1c2['where']=_[_0x7fda('0x30')](_0x57d1c2[_0x7fda('0x43')],{'$or':_[_0x7fda('0x47')](_0x57d1c2[_0x7fda('0x2c')],function(_0x8f15d1){var _0x335ce1={};_0x335ce1[_0x8f15d1]={'$like':'%'+_0x5070d2[_0x7fda('0x23')][_0x7fda('0x46')]+'%'};return _0x335ce1;})});}_0x57d1c2=_[_0x7fda('0x30')]({},_0x57d1c2,_0x5070d2[_0x7fda('0x31')]);return db['UserOpenchannelQueue'][_0x7fda('0x24')](_0x57d1c2);}})[_0x7fda('0x16')](function(_0x416123){if(_0x416123){return db['User'][_0x7fda('0x48')]({'where':{'id':_[_0x7fda('0x47')](_0x416123,_0x7fda('0x49')),'role':_0x7fda('0x4a')},'attributes':['id',_0x7fda('0x1c'),'openchannelPause','updatedAt','createdAt']});}})[_0x7fda('0x16')](function(_0x35fdbc){if(_0x35fdbc){return{'count':_0x35fdbc[_0x7fda('0x11')],'rows':_[_0x7fda('0x47')](_0x35fdbc[_0x7fda('0x25')],function(_0x42a83d){return{'membername':_0x42a83d[_0x7fda('0x1c')],'UserId':_0x42a83d['id'],'queue_name':_0xa906b1[_0x7fda('0x1c')],'OpenchannelQueueId':_0xa906b1['id'],'interface':util[_0x7fda('0x4b')](_0x7fda('0x4c'),_0x7fda('0x4d'),_0x42a83d[_0x7fda('0x1c')]),'penalty':0x0,'paused':_0x42a83d[_0x7fda('0x4e')],'createdAt':_0x42a83d[_0x7fda('0x4f')],'updatedAt':_0x42a83d[_0x7fda('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1da0b2,_0x57d1c2))[_0x7fda('0x26')](handleError(_0x1da0b2,null));};exports['getTeams']=function(_0x34b6b9,_0x3991b8){var _0x38a3ac={};var _0x774afe={};var _0x4d6535;var _0x14c48d;return db[_0x7fda('0x1e')][_0x7fda('0x3d')]({'where':{'id':_0x34b6b9[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](handleEntityNotFound(_0x3991b8,null))[_0x7fda('0x16')](function(_0x404b7f){if(_0x404b7f){_0x4d6535=_0x404b7f;_0x774afe[_0x7fda('0x29')]=_[_0x7fda('0x2a')](db['Team'][_0x7fda('0x3f')]);_0x774afe[_0x7fda('0x23')]=_[_0x7fda('0x2a')](_0x34b6b9[_0x7fda('0x23')]);_0x774afe['filters']=_['intersection'](_0x774afe['model'],_0x774afe[_0x7fda('0x23')]);_0x38a3ac[_0x7fda('0x2c')]=_[_0x7fda('0x2b')](_0x774afe['model'],qs['fields'](_0x34b6b9[_0x7fda('0x23')]['fields']));_0x38a3ac[_0x7fda('0x2c')]=_0x38a3ac[_0x7fda('0x2c')][_0x7fda('0x2e')]?_0x38a3ac[_0x7fda('0x2c')]:_0x774afe[_0x7fda('0x29')];_0x38a3ac[_0x7fda('0x41')]=qs['sort'](_0x34b6b9[_0x7fda('0x23')][_0x7fda('0x42')]);_0x38a3ac['where']=qs[_0x7fda('0x40')](_[_0x7fda('0x44')](_0x34b6b9[_0x7fda('0x23')],_0x774afe['filters']));if(_0x34b6b9[_0x7fda('0x23')][_0x7fda('0x46')]){_0x38a3ac['where']=_['merge'](_0x38a3ac[_0x7fda('0x43')],{'$or':_[_0x7fda('0x47')](_0x38a3ac['attributes'],function(_0x3dde3e){var _0x3a1f3a={};_0x3a1f3a[_0x3dde3e]={'$like':'%'+_0x34b6b9['query'][_0x7fda('0x46')]+'%'};return _0x3a1f3a;})});}_0x38a3ac=_[_0x7fda('0x30')]({},_0x38a3ac,_0x34b6b9[_0x7fda('0x31')]);return _0x4d6535[_0x7fda('0x51')](_0x38a3ac);}})[_0x7fda('0x16')](function(_0x20194d){if(_0x20194d){_0x14c48d=_0x20194d[_0x7fda('0x2e')];if(!_0x34b6b9[_0x7fda('0x23')][_0x7fda('0x52')](_0x7fda('0x53'))){_0x38a3ac[_0x7fda('0x12')]=qs['limit'](_0x34b6b9[_0x7fda('0x23')][_0x7fda('0x12')]);_0x38a3ac['offset']=qs[_0x7fda('0xf')](_0x34b6b9[_0x7fda('0x23')][_0x7fda('0xf')]);}return _0x4d6535[_0x7fda('0x51')](_0x38a3ac);}})[_0x7fda('0x16')](function(_0x3a60c5){if(_0x3a60c5){return _0x3a60c5?{'count':_0x14c48d,'rows':_0x3a60c5}:null;}})[_0x7fda('0x16')](respondWithResult(_0x3991b8,null))[_0x7fda('0x26')](handleError(_0x3991b8,null));};exports['addTeams']=function(_0x521b12,_0x427548){var _0x5e5ba9=_0x521b12[_0x7fda('0x34')][_0x7fda('0x54')];return db[_0x7fda('0x55')][_0x7fda('0x24')]({'where':{'id':_0x5e5ba9},'attributes':['id'],'include':[{'model':db[_0x7fda('0x56')],'as':_0x7fda('0x57'),'attributes':['id',_0x7fda('0x1c'),_0x7fda('0x58'),_0x7fda('0x59'),_0x7fda('0x5a')],'raw':!![]}]})[_0x7fda('0x16')](function(_0x4761c6){if(_0x4761c6){var _0xe53c27=_[_0x7fda('0x5b')](_0x4761c6,function(_0x16ae7e){var _0x373da7=_0x16ae7e[_0x7fda('0x18')]({'plain':!![]});return _0x373da7[_0x7fda('0x57')];});return db[_0x7fda('0x1e')][_0x7fda('0x32')]({'where':{'id':_0x521b12[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](function(_0x8b37c6){return db[_0x7fda('0x5c')][_0x7fda('0x5d')](function(_0x28f24f){return _0x8b37c6['addTeams'](_0x5e5ba9,{'transaction':_0x28f24f})[_0x7fda('0x16')](function(){return BPromise[_0x7fda('0x5e')](_0xe53c27,function(_0xe3336c){return db[_0x7fda('0x3e')][_0x7fda('0x5f')]({'where':{'UserId':_0xe3336c['id'],'OpenchannelQueueId':_0x521b12[_0x7fda('0x28')]['id']},'transaction':_0x28f24f});});})['then'](function(){_0xe53c27[_0x7fda('0x60')](function(_0x502d32){socket[_0x7fda('0x61')](_0x7fda('0x62'),{'UserId':_0x502d32['id'],'OpenchannelQueueId':_0x8b37c6['id']});});});});});}})[_0x7fda('0x16')](respondWithStatusCode(_0x427548,null))[_0x7fda('0x26')](handleError(_0x427548,null));};exports[_0x7fda('0x63')]=function(_0x179955,_0x54c727){return db[_0x7fda('0x55')][_0x7fda('0x24')]({'where':{'id':_0x179955['query'][_0x7fda('0x54')]},'attributes':['id'],'include':[{'model':db[_0x7fda('0x56')],'as':_0x7fda('0x57'),'attributes':['id'],'raw':!![]}]})[_0x7fda('0x16')](handleEntityNotFound(_0x54c727,null))[_0x7fda('0x16')](function(_0x3678f2){var _0x2d1ba9=_[_0x7fda('0x47')](_0x3678f2,'id');var _0xa7de00=[];var _0x2ddff1=[];var _0x4ed63b=squel[_0x7fda('0x64')]();_0x4ed63b[_0x7fda('0x65')](_0x7fda('0x66'))[_0x7fda('0x67')](_0x7fda('0x68'),'tq')['join'](_0x7fda('0x69'),'ut',_0x7fda('0x6a'))[_0x7fda('0x43')]('OpenchannelQueueId\x20=\x20?',_0x179955[_0x7fda('0x28')]['id']);for(var _0x10e114=0x0;_0x10e114<_0x3678f2[_0x7fda('0x2e')];_0x10e114+=0x1){let _0x5dbba9=_0x3678f2[_0x10e114];for(var _0x5ee5c1=0x0;_0x5ee5c1<_0x5dbba9[_0x7fda('0x57')][_0x7fda('0x2e')];_0x5ee5c1+=0x1){let _0x7bfc3e=_0x5dbba9[_0x7fda('0x57')][_0x5ee5c1];var _0x186ce1=_0x4ed63b[_0x7fda('0x6b')]();_0x186ce1[_0x7fda('0x43')](_0x7fda('0x6c'),_0x7bfc3e['id']);_0x2ddff1['push'](db['sequelize'][_0x7fda('0x23')](_0x186ce1[_0x7fda('0x6d')](),{'type':db[_0x7fda('0x5c')][_0x7fda('0x6e')][_0x7fda('0x6f')]})[_0x7fda('0x16')](function(_0x3e65f0){if(_0x3e65f0[_0x7fda('0x2e')]===0x1){return _0x7bfc3e['id'];}else{var _0xf67cd2=_[_0x7fda('0x70')](_[_0x7fda('0x47')](_0x3e65f0,_0x7fda('0x71')),function(_0x26b375){return _['includes'](_0x2d1ba9,_0x26b375);});if(_0xf67cd2){return _0x7bfc3e['id'];}}}));}}return BPromise[_0x7fda('0x72')](_0x2ddff1)[_0x7fda('0x16')](function(_0x16a4bd){_0xa7de00=_(_0xa7de00)[_0x7fda('0x73')](_0x16a4bd)[_0x7fda('0x74')]()[_0x7fda('0x75')]();return db[_0x7fda('0x1e')][_0x7fda('0x32')]({'where':{'id':_0x179955[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](function(_0x468ef8){return db[_0x7fda('0x5c')][_0x7fda('0x5d')](function(_0x43822c){return _0x468ef8[_0x7fda('0x63')](_0x179955['query'][_0x7fda('0x54')],{'transaction':_0x43822c})['then'](function(){if(!_[_0x7fda('0x76')](_0xa7de00)){return _0x468ef8[_0x7fda('0x77')](_0xa7de00,{'transaction':_0x43822c});}})[_0x7fda('0x16')](function(){_0xa7de00[_0x7fda('0x60')](function(_0x2af899){socket['emit'](_0x7fda('0x78'),{'UserId':_0x2af899,'OpenchannelQueueId':_0x468ef8['id']});});});});});});})['then'](respondWithStatusCode(_0x54c727,null))['catch'](handleError(_0x54c727,null));};exports[_0x7fda('0x79')]=function(_0x56d602,_0x1c1f7c){return db[_0x7fda('0x1e')]['find']({'where':{'id':_0x56d602[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](handleEntityNotFound(_0x1c1f7c,null))[_0x7fda('0x16')](function(_0x155fd5){if(_0x155fd5){return _0x155fd5[_0x7fda('0x79')](_0x56d602[_0x7fda('0x34')]['ids'],_[_0x7fda('0x7a')](_0x56d602['body'],[_0x7fda('0x54'),'id'])||{})[_0x7fda('0x7b')](function(_0x26f1e6){for(var _0x4b8cb6=0x0;_0x4b8cb6<_0x56d602[_0x7fda('0x34')]['ids'][_0x7fda('0x2e')];_0x4b8cb6+=0x1){socket[_0x7fda('0x61')](_0x7fda('0x62'),{'UserId':Number(_0x56d602[_0x7fda('0x34')][_0x7fda('0x54')][_0x4b8cb6]),'OpenchannelQueueId':Number(_0x56d602[_0x7fda('0x28')]['id'])});}return _0x26f1e6;});}})[_0x7fda('0x16')](respondWithResult(_0x1c1f7c,null))[_0x7fda('0x26')](handleError(_0x1c1f7c,null));};exports[_0x7fda('0x77')]=function(_0x182070,_0x784f22){return db[_0x7fda('0x1e')]['find']({'where':{'id':_0x182070[_0x7fda('0x28')]['id']}})[_0x7fda('0x16')](handleEntityNotFound(_0x784f22,null))[_0x7fda('0x16')](function(_0x1c1ca9){if(_0x1c1ca9){return _0x1c1ca9[_0x7fda('0x77')](_0x182070[_0x7fda('0x23')][_0x7fda('0x54')])[_0x7fda('0x16')](function(){if(_[_0x7fda('0x7c')](_0x182070[_0x7fda('0x23')]['ids'])){for(var _0x51ad8a=0x0;_0x51ad8a<_0x182070[_0x7fda('0x23')][_0x7fda('0x54')]['length'];_0x51ad8a+=0x1){socket[_0x7fda('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0x182070[_0x7fda('0x23')]['ids'][_0x51ad8a]),'OpenchannelQueueId':Number(_0x182070[_0x7fda('0x28')]['id'])});}}else{socket[_0x7fda('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0x182070[_0x7fda('0x23')][_0x7fda('0x54')]),'OpenchannelQueueId':Number(_0x182070['params']['id'])});}});}})['then'](respondWithStatusCode(_0x784f22,null))[_0x7fda('0x26')](handleError(_0x784f22,null));};exports[_0x7fda('0x7d')]=function(_0x2ea5bd,_0x3cde9f){var _0x217e44={};var _0x3efba7={};var _0x50b2cb;var _0x50614e;return db[_0x7fda('0x1e')][_0x7fda('0x3d')]({'where':{'id':_0x2ea5bd[_0x7fda('0x28')]['id']}})['then'](handleEntityNotFound(_0x3cde9f,null))['then'](function(_0x2e2ed0){if(_0x2e2ed0){_0x50b2cb=_0x2e2ed0;_0x3efba7[_0x7fda('0x29')]=_[_0x7fda('0x2a')](db[_0x7fda('0x56')][_0x7fda('0x3f')]);_0x3efba7[_0x7fda('0x23')]=_[_0x7fda('0x2a')](_0x2ea5bd[_0x7fda('0x23')]);_0x3efba7[_0x7fda('0x40')]=_['intersection'](_0x3efba7['model'],_0x3efba7[_0x7fda('0x23')]);_0x217e44[_0x7fda('0x2c')]=_[_0x7fda('0x2b')](_0x3efba7[_0x7fda('0x29')],qs['fields'](_0x2ea5bd['query'][_0x7fda('0x2d')]));_0x217e44[_0x7fda('0x2c')]=_0x217e44['attributes'][_0x7fda('0x2e')]?_0x217e44[_0x7fda('0x2c')]:_0x3efba7['model'];_0x217e44[_0x7fda('0x41')]=qs['sort'](_0x2ea5bd[_0x7fda('0x23')]['sort']);_0x217e44['where']=qs[_0x7fda('0x40')](_[_0x7fda('0x44')](_0x2ea5bd[_0x7fda('0x23')],_0x3efba7[_0x7fda('0x40')]));if(_0x2ea5bd[_0x7fda('0x23')]['filter']){_0x217e44[_0x7fda('0x43')]=_['merge'](_0x217e44[_0x7fda('0x43')],{'$or':_['map'](_0x217e44['attributes'],function(_0x2ac3f2){var _0x22251e={};_0x22251e[_0x2ac3f2]={'$like':'%'+_0x2ea5bd[_0x7fda('0x23')][_0x7fda('0x46')]+'%'};return _0x22251e;})});}_0x217e44=_[_0x7fda('0x30')]({},_0x217e44,_0x2ea5bd['options']);return _0x50b2cb[_0x7fda('0x7d')](_0x217e44);}})[_0x7fda('0x16')](function(_0x12ece8){if(_0x12ece8){_0x50614e=_0x12ece8[_0x7fda('0x2e')];if(!_0x2ea5bd[_0x7fda('0x23')][_0x7fda('0x52')](_0x7fda('0x53'))){_0x217e44[_0x7fda('0x12')]=qs['limit'](_0x2ea5bd[_0x7fda('0x23')][_0x7fda('0x12')]);_0x217e44[_0x7fda('0xf')]=qs[_0x7fda('0xf')](_0x2ea5bd[_0x7fda('0x23')][_0x7fda('0xf')]);}return _0x50b2cb[_0x7fda('0x7d')](_0x217e44);}})['then'](function(_0x2cfc54){if(_0x2cfc54){return _0x2cfc54?{'count':_0x50614e,'rows':_0x2cfc54}:null;}})['then'](respondWithResult(_0x3cde9f,null))[_0x7fda('0x26')](handleError(_0x3cde9f,null));}; \ No newline at end of file +var _0x5968=['options','findAndCountAll','UserId','openchannelPause','updatedAt','%s/%s','SIP','createdAt','getTeams','nolimit','addTeams','ids','Team','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','UserOpenchannelQueue','findOrCreate','userOpenchannelQueue:save','removeTeams','User','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','OpenchannelQueues','UserProfileResource','then','end','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','getOptions','where','include','query','rows','catch','show','keys','rawAttributes','intersection','model','fields','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','filters','hasOwnProperty','order','sort','pick','filter'];(function(_0x4f4bb8,_0x32e15d){var _0xf6e91f=function(_0x2d1fd6){while(--_0x2d1fd6){_0x4f4bb8['push'](_0x4f4bb8['shift']());}};_0xf6e91f(++_0x32e15d);}(_0x5968,0xb1));var _0x8596=function(_0x12c65a,_0x1fa08c){_0x12c65a=_0x12c65a-0x0;var _0x21fbaa=_0x5968[_0x12c65a];return _0x21fbaa;};'use strict';var BPromise=require(_0x8596('0x0'));var util=require('util');var _=require(_0x8596('0x1'));var squel=require('squel');var Redis=require(_0x8596('0x2'));var qs=require(_0x8596('0x3'));var logger=require(_0x8596('0x4'))(_0x8596('0x5'));var config=require(_0x8596('0x6'));var db=require(_0x8596('0x7'))['db'];config[_0x8596('0x8')]=_['defaults'](config[_0x8596('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8596('0x9'))(new Redis(config[_0x8596('0x8')]));require(_0x8596('0xa'))[_0x8596('0xb')](socket);function respondWithStatusCode(_0x4fb526,_0x38bf08){_0x38bf08=_0x38bf08||0xcc;return function(_0x3127d5){if(_0x3127d5){return _0x4fb526[_0x8596('0xc')](_0x38bf08);}return _0x4fb526[_0x8596('0xd')](_0x38bf08)['end']();};}function respondWithResult(_0x4c5004,_0x343b65){_0x343b65=_0x343b65||0xc8;return function(_0x41d8ac){if(_0x41d8ac){return _0x4c5004[_0x8596('0xd')](_0x343b65)[_0x8596('0xe')](_0x41d8ac);}};}function respondWithFilteredResult(_0x13c95b,_0x209571){return function(_0x238068){if(_0x238068){var _0x4820f0=typeof _0x209571[_0x8596('0xf')]===_0x8596('0x10')&&typeof _0x209571[_0x8596('0x11')]===_0x8596('0x10');var _0x35c32a=_0x238068[_0x8596('0x12')];var _0x4cbc92=_0x4820f0?0x0:_0x209571['offset'];var _0x154e38=_0x4820f0?_0x238068['count']:_0x209571[_0x8596('0xf')]+_0x209571['limit'];var _0x3327e8;if(_0x154e38>=_0x35c32a){_0x154e38=_0x35c32a;_0x3327e8=0xc8;}else{_0x3327e8=0xce;}_0x13c95b[_0x8596('0xd')](_0x3327e8);return _0x13c95b[_0x8596('0x13')](_0x8596('0x14'),_0x4cbc92+'-'+_0x154e38+'/'+_0x35c32a)[_0x8596('0xe')](_0x238068);}return null;};}function saveUpdates(_0x15d9ba){return function(_0x3efe98){if(_0x3efe98){return _0x3efe98[_0x8596('0x15')](_0x15d9ba)['then'](function(_0x120a50){return _0x120a50;});}return null;};}function removeEntity(_0x5e6070){return function(_0x22f09d){if(_0x22f09d){return _0x22f09d[_0x8596('0x16')]()['then'](function(){var _0x4212f9=_0x22f09d[_0x8596('0x17')]({'plain':!![]});var _0x2c94a7=_0x8596('0x18');return db[_0x8596('0x19')][_0x8596('0x16')]({'where':{'type':_0x2c94a7,'resourceId':_0x4212f9['id']}})['then'](function(){return _0x22f09d;});})[_0x8596('0x1a')](function(){_0x5e6070[_0x8596('0xd')](0xcc)[_0x8596('0x1b')]();});}};}function handleEntityNotFound(_0x4b9ffd){return function(_0x2469e3){if(!_0x2469e3){_0x4b9ffd[_0x8596('0xc')](0x194);}return _0x2469e3;};}function handleError(_0x3fc02d,_0x5128a0){_0x5128a0=_0x5128a0||0x1f4;return function(_0x48f19b){logger['error'](_0x48f19b[_0x8596('0x1c')]);if(_0x48f19b['name']){delete _0x48f19b[_0x8596('0x1d')];}_0x3fc02d[_0x8596('0xd')](_0x5128a0)[_0x8596('0x1e')](_0x48f19b);};}exports[_0x8596('0x1f')]=function(_0x19eefb,_0x11cb4a){var _0x1a630b={};var _0x4ca991={'count':0x0,'rows':[]};var _0x3359eb=_[_0x8596('0x20')](db[_0x8596('0x21')]['rawAttributes'],function(_0x4d40e2){return{'name':_0x4d40e2[_0x8596('0x22')],'type':_0x4d40e2[_0x8596('0x23')][_0x8596('0x24')]};});_0x1a630b=qs[_0x8596('0x25')](_0x3359eb,_0x19eefb);var _0x29a83f={'where':_0x1a630b[_0x8596('0x26')]};return db[_0x8596('0x21')][_0x8596('0x12')](_0x29a83f)[_0x8596('0x1a')](function(_0x2943d1){_0x4ca991[_0x8596('0x12')]=_0x2943d1;_0x1a630b[_0x8596('0x27')]=qs[_0x8596('0x27')](_0x19eefb[_0x8596('0x28')]);return db['OpenchannelQueue']['findAll'](_0x1a630b);})[_0x8596('0x1a')](function(_0x389392){_0x4ca991[_0x8596('0x29')]=_0x389392;return _0x4ca991;})[_0x8596('0x1a')](respondWithFilteredResult(_0x11cb4a,_0x1a630b))[_0x8596('0x2a')](handleError(_0x11cb4a,null));};exports[_0x8596('0x2b')]=function(_0x4f4a1b,_0x4f9f52){var _0x2aef22={'raw':!![],'where':{'id':_0x4f4a1b['params']['id']}},_0x2b0e61={};_0x2b0e61['model']=_[_0x8596('0x2c')](db['OpenchannelQueue'][_0x8596('0x2d')]);_0x2b0e61['query']=_[_0x8596('0x2c')](_0x4f4a1b['query']);_0x2b0e61['filters']=_[_0x8596('0x2e')](_0x2b0e61[_0x8596('0x2f')],_0x2b0e61['query']);_0x2aef22['attributes']=_[_0x8596('0x2e')](_0x2b0e61['model'],qs[_0x8596('0x30')](_0x4f4a1b[_0x8596('0x28')][_0x8596('0x30')]));_0x2aef22['attributes']=_0x2aef22[_0x8596('0x31')][_0x8596('0x32')]?_0x2aef22[_0x8596('0x31')]:_0x2b0e61[_0x8596('0x2f')];if(_0x4f4a1b[_0x8596('0x28')]['includeAll']){_0x2aef22['include']=[{'all':!![]}];}_0x2aef22=_[_0x8596('0x33')]({},_0x2aef22,_0x4f4a1b['options']);return db[_0x8596('0x21')][_0x8596('0x34')](_0x2aef22)[_0x8596('0x1a')](handleEntityNotFound(_0x4f9f52,null))[_0x8596('0x1a')](respondWithResult(_0x4f9f52,null))['catch'](handleError(_0x4f9f52,null));};exports[_0x8596('0x35')]=function(_0x348528,_0x2ac8d4){return db['OpenchannelQueue'][_0x8596('0x35')](_0x348528[_0x8596('0x36')],{})['then'](function(_0x393054){var _0x49396f=_0x348528[_0x8596('0x37')][_0x8596('0x17')]({'plain':!![]});if(!_0x49396f)throw new Error(_0x8596('0x38'));if(_0x49396f['role']===_0x8596('0x37')){var _0xbfb4bd=_0x393054['get']({'plain':!![]});var _0x88b588='OpenchannelQueues';return db['UserProfileSection'][_0x8596('0x34')]({'where':{'name':_0x88b588,'userProfileId':_0x49396f['userProfileId']},'raw':!![]})[_0x8596('0x1a')](function(_0x37f110){if(_0x37f110&&_0x37f110[_0x8596('0x39')]===0x0){return db[_0x8596('0x19')][_0x8596('0x35')]({'name':_0xbfb4bd['name'],'resourceId':_0xbfb4bd['id'],'type':_0x37f110[_0x8596('0x1d')],'sectionId':_0x37f110['id']},{})[_0x8596('0x1a')](function(){return _0x393054;});}else{return _0x393054;}})[_0x8596('0x2a')](function(_0x14d1de){logger[_0x8596('0x3a')](_0x8596('0x3b'),_0x14d1de);throw _0x14d1de;});}return _0x393054;})[_0x8596('0x1a')](respondWithResult(_0x2ac8d4,0xc9))[_0x8596('0x2a')](handleError(_0x2ac8d4,null));};exports[_0x8596('0x15')]=function(_0x466896,_0x26db0e){if(_0x466896['body']['id']){delete _0x466896[_0x8596('0x36')]['id'];}return db[_0x8596('0x21')][_0x8596('0x34')]({'where':{'id':_0x466896[_0x8596('0x3c')]['id']}})['then'](handleEntityNotFound(_0x26db0e,null))['then'](saveUpdates(_0x466896[_0x8596('0x36')],null))[_0x8596('0x1a')](respondWithResult(_0x26db0e,null))[_0x8596('0x2a')](handleError(_0x26db0e,null));};exports[_0x8596('0x16')]=function(_0x2490a9,_0x17d07d){return db[_0x8596('0x21')][_0x8596('0x34')]({'where':{'id':_0x2490a9[_0x8596('0x3c')]['id']}})[_0x8596('0x1a')](handleEntityNotFound(_0x17d07d,null))[_0x8596('0x1a')](removeEntity(_0x17d07d,null))[_0x8596('0x2a')](handleError(_0x17d07d,null));};exports[_0x8596('0x3d')]=function(_0x1de8eb,_0x5db45a){return db['OpenchannelQueue'][_0x8596('0x3d')]()['then'](respondWithResult(_0x5db45a,null))[_0x8596('0x2a')](handleError(_0x5db45a,null));};exports[_0x8596('0x3e')]=function(_0x5aa6b1,_0x480087){var _0x261d14={'raw':!![],'where':{}},_0x2e1d62={},_0xea4e94;return db[_0x8596('0x21')]['findOne']({'where':{'id':_0x5aa6b1[_0x8596('0x3c')]['id']}})['then'](handleEntityNotFound(_0x480087,null))[_0x8596('0x1a')](function(_0x38245b){if(_0x38245b){_0xea4e94=_0x38245b['get']({'plain':!![]});_0x2e1d62[_0x8596('0x2f')]=_[_0x8596('0x2c')](db['UserOpenchannelQueue'][_0x8596('0x2d')]);_0x2e1d62[_0x8596('0x28')]=_['keys'](_0x5aa6b1[_0x8596('0x28')]);_0x2e1d62[_0x8596('0x3f')]=_[_0x8596('0x2e')](_0x2e1d62['model'],_0x2e1d62['query']);_0x261d14[_0x8596('0x31')]=_[_0x8596('0x2e')](_0x2e1d62[_0x8596('0x2f')],qs[_0x8596('0x30')](_0x5aa6b1['query'][_0x8596('0x30')]));_0x261d14[_0x8596('0x31')]=_0x261d14[_0x8596('0x31')][_0x8596('0x32')]?_0x261d14['attributes']:_0x2e1d62[_0x8596('0x2f')];if(!_0x5aa6b1[_0x8596('0x28')][_0x8596('0x40')]('nolimit')){_0x261d14[_0x8596('0x11')]=qs['limit'](_0x5aa6b1[_0x8596('0x28')][_0x8596('0x11')]);_0x261d14['offset']=qs[_0x8596('0xf')](_0x5aa6b1[_0x8596('0x28')]['offset']);}_0x261d14[_0x8596('0x41')]=qs['sort'](_0x5aa6b1[_0x8596('0x28')][_0x8596('0x42')]);_0x261d14[_0x8596('0x26')]=qs[_0x8596('0x3f')](_[_0x8596('0x43')](_0x5aa6b1[_0x8596('0x28')],_0x2e1d62[_0x8596('0x3f')]));_0x261d14[_0x8596('0x26')]['OpenchannelQueueId']=_0x38245b['id'];if(_0x5aa6b1[_0x8596('0x28')][_0x8596('0x44')]){_0x261d14['where']=_[_0x8596('0x33')](_0x261d14[_0x8596('0x26')],{'$or':_[_0x8596('0x20')](_0x261d14[_0x8596('0x31')],function(_0x1662ad){var _0x2c3bc8={};_0x2c3bc8[_0x1662ad]={'$like':'%'+_0x5aa6b1['query'][_0x8596('0x44')]+'%'};return _0x2c3bc8;})});}_0x261d14=_[_0x8596('0x33')]({},_0x261d14,_0x5aa6b1[_0x8596('0x45')]);return db['UserOpenchannelQueue']['findAll'](_0x261d14);}})[_0x8596('0x1a')](function(_0xef36f5){if(_0xef36f5){return db['User'][_0x8596('0x46')]({'where':{'id':_['map'](_0xef36f5,_0x8596('0x47')),'role':'agent'},'attributes':['id','name',_0x8596('0x48'),_0x8596('0x49'),'createdAt']});}})[_0x8596('0x1a')](function(_0x1c3d5e){if(_0x1c3d5e){return{'count':_0x1c3d5e['count'],'rows':_[_0x8596('0x20')](_0x1c3d5e['rows'],function(_0x24fa46){return{'membername':_0x24fa46[_0x8596('0x1d')],'UserId':_0x24fa46['id'],'queue_name':_0xea4e94[_0x8596('0x1d')],'OpenchannelQueueId':_0xea4e94['id'],'interface':util['format'](_0x8596('0x4a'),_0x8596('0x4b'),_0x24fa46[_0x8596('0x1d')]),'penalty':0x0,'paused':_0x24fa46[_0x8596('0x48')],'createdAt':_0x24fa46[_0x8596('0x4c')],'updatedAt':_0x24fa46[_0x8596('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8596('0x1a')](respondWithFilteredResult(_0x480087,_0x261d14))[_0x8596('0x2a')](handleError(_0x480087,null));};exports[_0x8596('0x4d')]=function(_0x1071c1,_0x1508cf){var _0x965c25={};var _0x45acd8={};var _0x457acf;var _0x44f2eb;return db[_0x8596('0x21')]['findOne']({'where':{'id':_0x1071c1[_0x8596('0x3c')]['id']}})[_0x8596('0x1a')](handleEntityNotFound(_0x1508cf,null))[_0x8596('0x1a')](function(_0x228566){if(_0x228566){_0x457acf=_0x228566;_0x45acd8[_0x8596('0x2f')]=_['keys'](db['Team'][_0x8596('0x2d')]);_0x45acd8[_0x8596('0x28')]=_['keys'](_0x1071c1[_0x8596('0x28')]);_0x45acd8[_0x8596('0x3f')]=_['intersection'](_0x45acd8[_0x8596('0x2f')],_0x45acd8[_0x8596('0x28')]);_0x965c25['attributes']=_[_0x8596('0x2e')](_0x45acd8[_0x8596('0x2f')],qs[_0x8596('0x30')](_0x1071c1[_0x8596('0x28')][_0x8596('0x30')]));_0x965c25[_0x8596('0x31')]=_0x965c25[_0x8596('0x31')][_0x8596('0x32')]?_0x965c25[_0x8596('0x31')]:_0x45acd8[_0x8596('0x2f')];_0x965c25[_0x8596('0x41')]=qs[_0x8596('0x42')](_0x1071c1[_0x8596('0x28')]['sort']);_0x965c25[_0x8596('0x26')]=qs[_0x8596('0x3f')](_['pick'](_0x1071c1['query'],_0x45acd8[_0x8596('0x3f')]));if(_0x1071c1[_0x8596('0x28')]['filter']){_0x965c25[_0x8596('0x26')]=_[_0x8596('0x33')](_0x965c25[_0x8596('0x26')],{'$or':_[_0x8596('0x20')](_0x965c25[_0x8596('0x31')],function(_0x415fc8){var _0x59932a={};_0x59932a[_0x415fc8]={'$like':'%'+_0x1071c1[_0x8596('0x28')][_0x8596('0x44')]+'%'};return _0x59932a;})});}_0x965c25=_['merge']({},_0x965c25,_0x1071c1[_0x8596('0x45')]);return _0x457acf[_0x8596('0x4d')](_0x965c25);}})['then'](function(_0xa6597a){if(_0xa6597a){_0x44f2eb=_0xa6597a[_0x8596('0x32')];if(!_0x1071c1[_0x8596('0x28')][_0x8596('0x40')](_0x8596('0x4e'))){_0x965c25[_0x8596('0x11')]=qs['limit'](_0x1071c1[_0x8596('0x28')][_0x8596('0x11')]);_0x965c25[_0x8596('0xf')]=qs[_0x8596('0xf')](_0x1071c1[_0x8596('0x28')][_0x8596('0xf')]);}return _0x457acf[_0x8596('0x4d')](_0x965c25);}})[_0x8596('0x1a')](function(_0x26310b){if(_0x26310b){return _0x26310b?{'count':_0x44f2eb,'rows':_0x26310b}:null;}})[_0x8596('0x1a')](respondWithResult(_0x1508cf,null))[_0x8596('0x2a')](handleError(_0x1508cf,null));};exports[_0x8596('0x4f')]=function(_0x2347c4,_0x28f324){var _0x59eca2=_0x2347c4[_0x8596('0x36')][_0x8596('0x50')];return db[_0x8596('0x51')][_0x8596('0x52')]({'where':{'id':_0x59eca2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8596('0x53'),'attributes':['id',_0x8596('0x1d'),_0x8596('0x54'),_0x8596('0x55'),_0x8596('0x56')],'raw':!![]}]})[_0x8596('0x1a')](function(_0x33957e){if(_0x33957e){var _0x515749=_['flatMap'](_0x33957e,function(_0x5ead0c){var _0xea4a26=_0x5ead0c[_0x8596('0x17')]({'plain':!![]});return _0xea4a26['Agents'];});return db[_0x8596('0x21')][_0x8596('0x34')]({'where':{'id':_0x2347c4['params']['id']}})[_0x8596('0x1a')](function(_0x321a23){return db[_0x8596('0x57')][_0x8596('0x58')](function(_0xdea384){return _0x321a23[_0x8596('0x4f')](_0x59eca2,{'transaction':_0xdea384})[_0x8596('0x1a')](function(){return BPromise[_0x8596('0x59')](_0x515749,function(_0x3001a7){return db[_0x8596('0x5a')][_0x8596('0x5b')]({'where':{'UserId':_0x3001a7['id'],'OpenchannelQueueId':_0x2347c4[_0x8596('0x3c')]['id']},'transaction':_0xdea384});});})[_0x8596('0x1a')](function(){_0x515749['forEach'](function(_0x3c84e1){socket['emit'](_0x8596('0x5c'),{'UserId':_0x3c84e1['id'],'OpenchannelQueueId':_0x321a23['id']});});});});});}})[_0x8596('0x1a')](respondWithStatusCode(_0x28f324,null))[_0x8596('0x2a')](handleError(_0x28f324,null));};exports[_0x8596('0x5d')]=function(_0x78530c,_0x18d591){return db['Team'][_0x8596('0x52')]({'where':{'id':_0x78530c[_0x8596('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8596('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8596('0x1a')](handleEntityNotFound(_0x18d591,null))[_0x8596('0x1a')](function(_0x45fee4){var _0x4e8f29=_[_0x8596('0x20')](_0x45fee4,'id');var _0x1f086c=[];var _0x29d1b7=[];var _0x19f911=squel[_0x8596('0x5f')]();_0x19f911[_0x8596('0x60')](_0x8596('0x61'))[_0x8596('0x62')]('team_has_openchannel_queues','tq')[_0x8596('0x63')](_0x8596('0x64'),'ut',_0x8596('0x65'))[_0x8596('0x26')](_0x8596('0x66'),_0x78530c['params']['id']);for(var _0x18534d=0x0;_0x18534d<_0x45fee4[_0x8596('0x32')];_0x18534d+=0x1){let _0x2eed78=_0x45fee4[_0x18534d];for(var _0x4259cd=0x0;_0x4259cd<_0x2eed78['Agents'][_0x8596('0x32')];_0x4259cd+=0x1){let _0xdc6488=_0x2eed78['Agents'][_0x4259cd];var _0x42ee7c=_0x19f911[_0x8596('0x67')]();_0x42ee7c[_0x8596('0x26')](_0x8596('0x68'),_0xdc6488['id']);_0x29d1b7[_0x8596('0x69')](db['sequelize']['query'](_0x42ee7c['toString'](),{'type':db[_0x8596('0x57')][_0x8596('0x6a')][_0x8596('0x6b')]})['then'](function(_0x22166e){if(_0x22166e[_0x8596('0x32')]===0x1){return _0xdc6488['id'];}else{var _0x335bec=_[_0x8596('0x6c')](_['map'](_0x22166e,_0x8596('0x6d')),function(_0x3b5100){return _[_0x8596('0x6e')](_0x4e8f29,_0x3b5100);});if(_0x335bec){return _0xdc6488['id'];}}}));}}return BPromise[_0x8596('0x6f')](_0x29d1b7)[_0x8596('0x1a')](function(_0xca6d85){_0x1f086c=_(_0x1f086c)[_0x8596('0x70')](_0xca6d85)['compact']()[_0x8596('0x71')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x78530c[_0x8596('0x3c')]['id']}})[_0x8596('0x1a')](function(_0x99f108){return db['sequelize'][_0x8596('0x58')](function(_0x247960){return _0x99f108['removeTeams'](_0x78530c[_0x8596('0x28')][_0x8596('0x50')],{'transaction':_0x247960})[_0x8596('0x1a')](function(){if(!_['isEmpty'](_0x1f086c)){return _0x99f108[_0x8596('0x72')](_0x1f086c,{'transaction':_0x247960});}})[_0x8596('0x1a')](function(){_0x1f086c[_0x8596('0x73')](function(_0x4d6ba6){socket[_0x8596('0x74')]('userOpenchannelQueue:remove',{'UserId':_0x4d6ba6,'OpenchannelQueueId':_0x99f108['id']});});});});});});})[_0x8596('0x1a')](respondWithStatusCode(_0x18d591,null))[_0x8596('0x2a')](handleError(_0x18d591,null));};exports[_0x8596('0x75')]=function(_0x2f4694,_0x19131e){return db[_0x8596('0x21')][_0x8596('0x34')]({'where':{'id':_0x2f4694[_0x8596('0x3c')]['id']}})[_0x8596('0x1a')](handleEntityNotFound(_0x19131e,null))[_0x8596('0x1a')](function(_0x1bafd3){if(_0x1bafd3){return _0x1bafd3['addAgents'](_0x2f4694['body'][_0x8596('0x50')],_[_0x8596('0x76')](_0x2f4694[_0x8596('0x36')],[_0x8596('0x50'),'id'])||{})[_0x8596('0x77')](function(_0x133d6a){for(var _0x3ba5ee=0x0;_0x3ba5ee<_0x2f4694[_0x8596('0x36')][_0x8596('0x50')][_0x8596('0x32')];_0x3ba5ee+=0x1){socket[_0x8596('0x74')](_0x8596('0x5c'),{'UserId':Number(_0x2f4694[_0x8596('0x36')][_0x8596('0x50')][_0x3ba5ee]),'OpenchannelQueueId':Number(_0x2f4694[_0x8596('0x3c')]['id'])});}return _0x133d6a;});}})['then'](respondWithResult(_0x19131e,null))[_0x8596('0x2a')](handleError(_0x19131e,null));};exports['removeAgents']=function(_0x2b6ee6,_0x23f715){return db[_0x8596('0x21')][_0x8596('0x34')]({'where':{'id':_0x2b6ee6[_0x8596('0x3c')]['id']}})[_0x8596('0x1a')](handleEntityNotFound(_0x23f715,null))[_0x8596('0x1a')](function(_0x46a304){if(_0x46a304){return _0x46a304[_0x8596('0x72')](_0x2b6ee6[_0x8596('0x28')][_0x8596('0x50')])[_0x8596('0x1a')](function(){if(_[_0x8596('0x78')](_0x2b6ee6['query'][_0x8596('0x50')])){for(var _0x3bff75=0x0;_0x3bff75<_0x2b6ee6['query'][_0x8596('0x50')][_0x8596('0x32')];_0x3bff75+=0x1){socket[_0x8596('0x74')](_0x8596('0x79'),{'UserId':Number(_0x2b6ee6[_0x8596('0x28')]['ids'][_0x3bff75]),'OpenchannelQueueId':Number(_0x2b6ee6[_0x8596('0x3c')]['id'])});}}else{socket[_0x8596('0x74')](_0x8596('0x79'),{'UserId':Number(_0x2b6ee6[_0x8596('0x28')][_0x8596('0x50')]),'OpenchannelQueueId':Number(_0x2b6ee6[_0x8596('0x3c')]['id'])});}});}})[_0x8596('0x1a')](respondWithStatusCode(_0x23f715,null))[_0x8596('0x2a')](handleError(_0x23f715,null));};exports['getAgents']=function(_0x51afb7,_0xc3be25){var _0xc53438={};var _0xf37874={};var _0x46dd01;var _0x48db79;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x51afb7[_0x8596('0x3c')]['id']}})['then'](handleEntityNotFound(_0xc3be25,null))[_0x8596('0x1a')](function(_0xabc751){if(_0xabc751){_0x46dd01=_0xabc751;_0xf37874['model']=_['keys'](db['User'][_0x8596('0x2d')]);_0xf37874[_0x8596('0x28')]=_[_0x8596('0x2c')](_0x51afb7[_0x8596('0x28')]);_0xf37874[_0x8596('0x3f')]=_[_0x8596('0x2e')](_0xf37874['model'],_0xf37874['query']);_0xc53438[_0x8596('0x31')]=_[_0x8596('0x2e')](_0xf37874[_0x8596('0x2f')],qs[_0x8596('0x30')](_0x51afb7[_0x8596('0x28')][_0x8596('0x30')]));_0xc53438[_0x8596('0x31')]=_0xc53438[_0x8596('0x31')][_0x8596('0x32')]?_0xc53438[_0x8596('0x31')]:_0xf37874[_0x8596('0x2f')];_0xc53438[_0x8596('0x41')]=qs[_0x8596('0x42')](_0x51afb7['query']['sort']);_0xc53438[_0x8596('0x26')]=qs[_0x8596('0x3f')](_[_0x8596('0x43')](_0x51afb7[_0x8596('0x28')],_0xf37874['filters']));if(_0x51afb7[_0x8596('0x28')][_0x8596('0x44')]){_0xc53438[_0x8596('0x26')]=_[_0x8596('0x33')](_0xc53438['where'],{'$or':_[_0x8596('0x20')](_0xc53438['attributes'],function(_0x50b8a6){var _0x212bda={};_0x212bda[_0x50b8a6]={'$like':'%'+_0x51afb7[_0x8596('0x28')][_0x8596('0x44')]+'%'};return _0x212bda;})});}_0xc53438=_[_0x8596('0x33')]({},_0xc53438,_0x51afb7[_0x8596('0x45')]);return _0x46dd01[_0x8596('0x7a')](_0xc53438);}})[_0x8596('0x1a')](function(_0x2e8638){if(_0x2e8638){_0x48db79=_0x2e8638[_0x8596('0x32')];if(!_0x51afb7[_0x8596('0x28')][_0x8596('0x40')](_0x8596('0x4e'))){_0xc53438[_0x8596('0x11')]=qs[_0x8596('0x11')](_0x51afb7['query']['limit']);_0xc53438[_0x8596('0xf')]=qs['offset'](_0x51afb7['query'][_0x8596('0xf')]);}return _0x46dd01[_0x8596('0x7a')](_0xc53438);}})[_0x8596('0x1a')](function(_0xdab184){if(_0xdab184){return _0xdab184?{'count':_0x48db79,'rows':_0xdab184}:null;}})[_0x8596('0x1a')](respondWithResult(_0xc3be25,null))['catch'](handleError(_0xc3be25,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 762e00d..24ca4a1 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 _0xabed=['events','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1d82b2,_0x2dd498){var _0x43436f=function(_0x27f169){while(--_0x27f169){_0x1d82b2['push'](_0x1d82b2['shift']());}};_0x43436f(++_0x2dd498);}(_0xabed,0x1ae));var _0xdabe=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xabed[_0x26b622];return _0x58a028;};'use strict';var EventEmitter=require(_0xdabe('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xdabe('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdabe('0x2')](0x0);var events={'afterCreate':_0xdabe('0x3'),'afterUpdate':_0xdabe('0x4'),'afterDestroy':_0xdabe('0x5')};function emitEvent(_0x4f308){return function(_0x3448fb,_0x2fbb90,_0x455d91){OpenchannelQueueEvents[_0xdabe('0x6')](_0x4f308+':'+_0x3448fb['id'],_0x3448fb);OpenchannelQueueEvents[_0xdabe('0x6')](_0x4f308,_0x3448fb);_0x455d91(null);};}for(var e in events){if(events[_0xdabe('0x7')](e)){var event=events[e];OpenchannelQueue[_0xdabe('0x8')](e,emitEvent(event));}}module[_0xdabe('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb561=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x1ed4f3,_0x189dd7){var _0x5829e2=function(_0x35aa56){while(--_0x35aa56){_0x1ed4f3['push'](_0x1ed4f3['shift']());}};_0x5829e2(++_0x189dd7);}(_0xb561,0xf5));var _0x1b56=function(_0x918ebd,_0x526325){_0x918ebd=_0x918ebd-0x0;var _0x155952=_0xb561[_0x918ebd];return _0x155952;};'use strict';var EventEmitter=require(_0x1b56('0x0'));var OpenchannelQueue=require(_0x1b56('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b56('0x2'),'afterUpdate':_0x1b56('0x3'),'afterDestroy':_0x1b56('0x4')};function emitEvent(_0x5e428a){return function(_0x23ca40,_0x53e02a,_0x98abad){OpenchannelQueueEvents[_0x1b56('0x5')](_0x5e428a+':'+_0x23ca40['id'],_0x23ca40);OpenchannelQueueEvents[_0x1b56('0x5')](_0x5e428a,_0x23ca40);_0x98abad(null);};}for(var e in events){if(events[_0x1b56('0x6')](e)){var event=events[e];OpenchannelQueue[_0x1b56('0x7')](e,emitEvent(event));}}module[_0x1b56('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 33acad6..a99302c 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 _0x1f45=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x6c3a33,_0x5472be){var _0xe545f2=function(_0x30f71b){while(--_0x30f71b){_0x6c3a33['push'](_0x6c3a33['shift']());}};_0xe545f2(++_0x5472be);}(_0x1f45,0x17f));var _0x51f4=function(_0x12c03d,_0x367830){_0x12c03d=_0x12c03d-0x0;var _0x37eaa3=_0x1f45[_0x12c03d];return _0x37eaa3;};'use strict';var _=require(_0x51f4('0x0'));var util=require(_0x51f4('0x1'));var logger=require(_0x51f4('0x2'))(_0x51f4('0x3'));var moment=require(_0x51f4('0x4'));var BPromise=require(_0x51f4('0x5'));var rp=require(_0x51f4('0x6'));var fs=require('fs');var path=require(_0x51f4('0x7'));var rimraf=require('rimraf');var config=require(_0x51f4('0x8'));var attributes=require(_0x51f4('0x9'));module[_0x51f4('0xa')]=function(_0x7d5ece,_0x171d19){return _0x7d5ece[_0x51f4('0xb')](_0x51f4('0xc'),attributes,{'tableName':_0x51f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db1=['./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3abf70,_0x586e9b){var _0x2242ab=function(_0x31c4f4){while(--_0x31c4f4){_0x3abf70['push'](_0x3abf70['shift']());}};_0x2242ab(++_0x586e9b);}(_0x4db1,0x64));var _0x14db=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x4db1[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var logger=require(_0x14db('0x2'))('api');var moment=require(_0x14db('0x3'));var BPromise=require(_0x14db('0x4'));var rp=require(_0x14db('0x5'));var fs=require('fs');var path=require(_0x14db('0x6'));var rimraf=require(_0x14db('0x7'));var config=require('../../config/environment');var attributes=require(_0x14db('0x8'));module[_0x14db('0x9')]=function(_0x4364e6,_0x541a83){return _0x4364e6[_0x14db('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x14db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index a6c0caf..b784b6a 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 _0x2668=['http','redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','options','raw','attributes','include','map','model','debug','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x346e17,_0x18997c){var _0x20259a=function(_0x5905b7){while(--_0x5905b7){_0x346e17['push'](_0x346e17['shift']());}};_0x20259a(++_0x18997c);}(_0x2668,0xd5));var _0x8266=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2668[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x8266('0x0'));var util=require(_0x8266('0x1'));var moment=require(_0x8266('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(_0x8266('0x3'));var logger=require(_0x8266('0x4'))(_0x8266('0x5'));var config=require(_0x8266('0x6'));var jayson=require(_0x8266('0x7'));var client=jayson[_0x8266('0x8')][_0x8266('0x9')]({'port':0x232a});config[_0x8266('0xa')]=_[_0x8266('0xb')](config[_0x8266('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8266('0xa')]));require(_0x8266('0xc'))[_0x8266('0xd')](socket);function respondWithRpcPromise(_0x2c40dd,_0x239e71,_0x35984f){return new BPromise(function(_0xbca51b,_0xa7ad9f){return client[_0x8266('0xe')](_0x2c40dd,_0x35984f)[_0x8266('0xf')](function(_0x52a6fa){logger[_0x8266('0x10')](_0x8266('0x11'),_0x239e71,'request\x20sent');logger['debug'](_0x8266('0x12'),_0x239e71,_0x8266('0x13'),JSON[_0x8266('0x14')](_0x52a6fa));if(_0x52a6fa[_0x8266('0x15')]){if(_0x52a6fa[_0x8266('0x15')][_0x8266('0x16')]===0x1f4){logger[_0x8266('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x239e71,_0x52a6fa[_0x8266('0x15')][_0x8266('0x17')]);return _0xa7ad9f(_0x52a6fa['error'][_0x8266('0x17')]);}logger['error'](_0x8266('0x11'),_0x239e71,_0x52a6fa[_0x8266('0x15')]['message']);return _0xbca51b(_0x52a6fa[_0x8266('0x15')][_0x8266('0x17')]);}else{logger[_0x8266('0x10')](_0x8266('0x11'),_0x239e71,_0x8266('0x13'));_0xbca51b(_0x52a6fa[_0x8266('0x18')][_0x8266('0x17')]);}})[_0x8266('0x19')](function(_0x2ee0a7){logger[_0x8266('0x15')](_0x8266('0x11'),_0x239e71,_0x2ee0a7);_0xa7ad9f(_0x2ee0a7);});});}exports[_0x8266('0x1a')]=function(_0x4239cc){var _0x29d775=this;return new Promise(function(_0x9f163c,_0x5c7b09){return db['OpenchannelQueue']['findAll']({'raw':_0x4239cc[_0x8266('0x1b')]?_0x4239cc['options'][_0x8266('0x1c')]===undefined?!![]:![]:!![],'where':_0x4239cc[_0x8266('0x1b')]?_0x4239cc[_0x8266('0x1b')]['where']||null:null,'attributes':_0x4239cc[_0x8266('0x1b')]?_0x4239cc['options'][_0x8266('0x1d')]||null:null,'limit':_0x4239cc[_0x8266('0x1b')]?_0x4239cc[_0x8266('0x1b')]['limit']||null:null,'include':_0x4239cc[_0x8266('0x1b')]?_0x4239cc['options'][_0x8266('0x1e')]?_[_0x8266('0x1f')](_0x4239cc['options'][_0x8266('0x1e')],function(_0x64c843){return{'model':db[_0x64c843['model']],'as':_0x64c843['as'],'attributes':_0x64c843['attributes'],'include':_0x64c843[_0x8266('0x1e')]?_[_0x8266('0x1f')](_0x64c843[_0x8266('0x1e')],function(_0x19cc7d){return{'model':db[_0x19cc7d[_0x8266('0x20')]],'as':_0x19cc7d['as'],'attributes':_0x19cc7d[_0x8266('0x1d')],'include':_0x19cc7d[_0x8266('0x1e')]?_[_0x8266('0x1f')](_0x19cc7d['include'],function(_0x1f33c4){return{'model':db[_0x1f33c4[_0x8266('0x20')]],'as':_0x1f33c4['as'],'attributes':_0x1f33c4[_0x8266('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8266('0xf')](function(_0x581560){logger[_0x8266('0x10')](_0x8266('0x1a'),_0x4239cc);logger[_0x8266('0x21')](_0x8266('0x1a'),_0x4239cc,JSON['stringify'](_0x581560));_0x9f163c(_0x581560);})[_0x8266('0x19')](function(_0x187879){logger[_0x8266('0x15')](_0x8266('0x1a'),_0x187879[_0x8266('0x17')],_0x4239cc);_0x5c7b09(_0x29d775[_0x8266('0x15')](0x1f4,_0x187879[_0x8266('0x17')]));});});};exports[_0x8266('0x22')]=function(_0x1a9fdf){var _0x504779=this;return new Promise(function(_0x3b7a73,_0x5f0409){return db[_0x8266('0x23')][_0x8266('0x24')]({'raw':_0x1a9fdf[_0x8266('0x1b')]?_0x1a9fdf[_0x8266('0x1b')][_0x8266('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a9fdf[_0x8266('0x1b')]?_0x1a9fdf['options']['where']||null:null,'attributes':_0x1a9fdf[_0x8266('0x1b')]?_0x1a9fdf[_0x8266('0x1b')][_0x8266('0x1d')]||null:null,'include':_0x1a9fdf[_0x8266('0x1b')]?_0x1a9fdf[_0x8266('0x1b')][_0x8266('0x1e')]?_[_0x8266('0x1f')](_0x1a9fdf[_0x8266('0x1b')][_0x8266('0x1e')],function(_0x1a6206){return{'model':db[_0x1a6206[_0x8266('0x20')]],'as':_0x1a6206['as'],'attributes':_0x1a6206['attributes'],'include':_0x1a6206[_0x8266('0x1e')]?_[_0x8266('0x1f')](_0x1a6206[_0x8266('0x1e')],function(_0xf4ee7e){return{'model':db[_0xf4ee7e['model']],'as':_0xf4ee7e['as'],'attributes':_0xf4ee7e[_0x8266('0x1d')],'include':_0xf4ee7e[_0x8266('0x1e')]?_[_0x8266('0x1f')](_0xf4ee7e[_0x8266('0x1e')],function(_0x3cd517){return{'model':db[_0x3cd517[_0x8266('0x20')]],'as':_0x3cd517['as'],'attributes':_0x3cd517[_0x8266('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8266('0xf')](function(_0x32a942){logger[_0x8266('0x10')]('ShowOpenchannelQueue',_0x1a9fdf);logger['debug'](_0x8266('0x22'),_0x1a9fdf,JSON[_0x8266('0x14')](_0x32a942));_0x3b7a73(_0x32a942);})[_0x8266('0x19')](function(_0x1a8535){logger[_0x8266('0x15')]('ShowOpenchannelQueue',_0x1a8535[_0x8266('0x17')],_0x1a9fdf);_0x5f0409(_0x504779[_0x8266('0x15')](0x1f4,_0x1a8535['message']));});});}; \ No newline at end of file +var _0x0d19=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4daee7,_0x3fd7fc){var _0x4f78ca=function(_0x4f80c1){while(--_0x4f80c1){_0x4daee7['push'](_0x4daee7['shift']());}};_0x4f78ca(++_0x3fd7fc);}(_0x0d19,0xb4));var _0x90d1=function(_0x221c0e,_0x1cf4e5){_0x221c0e=_0x221c0e-0x0;var _0x1ffc3a=_0x0d19[_0x221c0e];return _0x1ffc3a;};'use strict';var _=require(_0x90d1('0x0'));var util=require(_0x90d1('0x1'));var moment=require(_0x90d1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x90d1('0x4'));var logger=require(_0x90d1('0x5'))('rpc');var config=require(_0x90d1('0x6'));var jayson=require(_0x90d1('0x7'));var client=jayson[_0x90d1('0x8')][_0x90d1('0x9')]({'port':0x232a});config[_0x90d1('0xa')]=_[_0x90d1('0xb')](config[_0x90d1('0xa')],{'host':_0x90d1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90d1('0xa')]));require(_0x90d1('0xd'))[_0x90d1('0xe')](socket);function respondWithRpcPromise(_0x437980,_0x1d2ab3,_0x550e56){return new BPromise(function(_0x149c5a,_0x550071){return client[_0x90d1('0xf')](_0x437980,_0x550e56)[_0x90d1('0x10')](function(_0x1ed364){logger['info'](_0x90d1('0x11'),_0x1d2ab3,_0x90d1('0x12'));logger[_0x90d1('0x13')](_0x90d1('0x14'),_0x1d2ab3,'request\x20sent',JSON[_0x90d1('0x15')](_0x1ed364));if(_0x1ed364[_0x90d1('0x16')]){if(_0x1ed364[_0x90d1('0x16')]['code']===0x1f4){logger[_0x90d1('0x16')](_0x90d1('0x11'),_0x1d2ab3,_0x1ed364[_0x90d1('0x16')][_0x90d1('0x17')]);return _0x550071(_0x1ed364['error']['message']);}logger[_0x90d1('0x16')](_0x90d1('0x11'),_0x1d2ab3,_0x1ed364[_0x90d1('0x16')][_0x90d1('0x17')]);return _0x149c5a(_0x1ed364[_0x90d1('0x16')][_0x90d1('0x17')]);}else{logger[_0x90d1('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x1d2ab3,_0x90d1('0x12'));_0x149c5a(_0x1ed364[_0x90d1('0x19')][_0x90d1('0x17')]);}})[_0x90d1('0x1a')](function(_0x47f569){logger[_0x90d1('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x1d2ab3,_0x47f569);_0x550071(_0x47f569);});});}exports[_0x90d1('0x1b')]=function(_0x1100ef){var _0x75ef87=this;return new Promise(function(_0x924745,_0x2962f8){return db[_0x90d1('0x1c')][_0x90d1('0x1d')]({'raw':_0x1100ef['options']?_0x1100ef[_0x90d1('0x1e')][_0x90d1('0x1f')]===undefined?!![]:![]:!![],'where':_0x1100ef[_0x90d1('0x1e')]?_0x1100ef['options'][_0x90d1('0x20')]||null:null,'attributes':_0x1100ef[_0x90d1('0x1e')]?_0x1100ef['options'][_0x90d1('0x21')]||null:null,'limit':_0x1100ef[_0x90d1('0x1e')]?_0x1100ef[_0x90d1('0x1e')][_0x90d1('0x22')]||null:null,'include':_0x1100ef[_0x90d1('0x1e')]?_0x1100ef[_0x90d1('0x1e')][_0x90d1('0x23')]?_[_0x90d1('0x24')](_0x1100ef['options'][_0x90d1('0x23')],function(_0x133e22){return{'model':db[_0x133e22['model']],'as':_0x133e22['as'],'attributes':_0x133e22[_0x90d1('0x21')],'include':_0x133e22[_0x90d1('0x23')]?_[_0x90d1('0x24')](_0x133e22['include'],function(_0x3eac3f){return{'model':db[_0x3eac3f[_0x90d1('0x25')]],'as':_0x3eac3f['as'],'attributes':_0x3eac3f[_0x90d1('0x21')],'include':_0x3eac3f[_0x90d1('0x23')]?_[_0x90d1('0x24')](_0x3eac3f[_0x90d1('0x23')],function(_0x3610bf){return{'model':db[_0x3610bf[_0x90d1('0x25')]],'as':_0x3610bf['as'],'attributes':_0x3610bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x90d1('0x10')](function(_0x1cb28e){logger[_0x90d1('0x18')](_0x90d1('0x1b'),_0x1100ef);logger[_0x90d1('0x13')](_0x90d1('0x1b'),_0x1100ef,JSON[_0x90d1('0x15')](_0x1cb28e));_0x924745(_0x1cb28e);})[_0x90d1('0x1a')](function(_0x4a850d){logger[_0x90d1('0x16')](_0x90d1('0x1b'),_0x4a850d[_0x90d1('0x17')],_0x1100ef);_0x2962f8(_0x75ef87[_0x90d1('0x16')](0x1f4,_0x4a850d[_0x90d1('0x17')]));});});};exports[_0x90d1('0x26')]=function(_0x3f9d9c){var _0x23414b=this;return new Promise(function(_0x144278,_0x3d495f){return db['OpenchannelQueue'][_0x90d1('0x27')]({'raw':_0x3f9d9c[_0x90d1('0x1e')]?_0x3f9d9c[_0x90d1('0x1e')][_0x90d1('0x1f')]===undefined?!![]:![]:!![],'where':_0x3f9d9c[_0x90d1('0x1e')]?_0x3f9d9c[_0x90d1('0x1e')][_0x90d1('0x20')]||null:null,'attributes':_0x3f9d9c[_0x90d1('0x1e')]?_0x3f9d9c[_0x90d1('0x1e')][_0x90d1('0x21')]||null:null,'include':_0x3f9d9c[_0x90d1('0x1e')]?_0x3f9d9c['options']['include']?_[_0x90d1('0x24')](_0x3f9d9c[_0x90d1('0x1e')][_0x90d1('0x23')],function(_0x5a6589){return{'model':db[_0x5a6589[_0x90d1('0x25')]],'as':_0x5a6589['as'],'attributes':_0x5a6589[_0x90d1('0x21')],'include':_0x5a6589['include']?_['map'](_0x5a6589[_0x90d1('0x23')],function(_0x16f72e){return{'model':db[_0x16f72e[_0x90d1('0x25')]],'as':_0x16f72e['as'],'attributes':_0x16f72e[_0x90d1('0x21')],'include':_0x16f72e[_0x90d1('0x23')]?_[_0x90d1('0x24')](_0x16f72e[_0x90d1('0x23')],function(_0x4c1742){return{'model':db[_0x4c1742[_0x90d1('0x25')]],'as':_0x4c1742['as'],'attributes':_0x4c1742[_0x90d1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ea5a6){logger[_0x90d1('0x18')]('ShowOpenchannelQueue',_0x3f9d9c);logger['debug'](_0x90d1('0x26'),_0x3f9d9c,JSON[_0x90d1('0x15')](_0x2ea5a6));_0x144278(_0x2ea5a6);})[_0x90d1('0x1a')](function(_0x406ce1){logger[_0x90d1('0x16')]('ShowOpenchannelQueue',_0x406ce1[_0x90d1('0x17')],_0x3f9d9c);_0x3d495f(_0x23414b['error'](0x1f4,_0x406ce1[_0x90d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 59e0c80..26dbf41 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 _0xf4e9=['emit','register','length','openchannelQueue:','save','remove','update'];(function(_0x120bc0,_0x40e780){var _0x49d52a=function(_0x41c990){while(--_0x41c990){_0x120bc0['push'](_0x120bc0['shift']());}};_0x49d52a(++_0x40e780);}(_0xf4e9,0x1a1));var _0x9f4e=function(_0x52ac12,_0x396ebd){_0x52ac12=_0x52ac12-0x0;var _0x5957b4=_0xf4e9[_0x52ac12];return _0x5957b4;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9f4e('0x0'),_0x9f4e('0x1'),_0x9f4e('0x2')];function createListener(_0x35e63d,_0x1dd193){return function(_0x5a3bd1){_0x1dd193[_0x9f4e('0x3')](_0x35e63d,_0x5a3bd1);};}function removeListener(_0x31ddc2,_0x2d6987){return function(){OpenchannelQueueEvents['removeListener'](_0x31ddc2,_0x2d6987);};}exports[_0x9f4e('0x4')]=function(_0x3dddc6){for(var _0x35bd56=0x0,_0x4bca86=events[_0x9f4e('0x5')];_0x35bd56<_0x4bca86;_0x35bd56++){var _0x2031f5=events[_0x35bd56];var _0x4d18dc=createListener(_0x9f4e('0x6')+_0x2031f5,_0x3dddc6);OpenchannelQueueEvents['on'](_0x2031f5,_0x4d18dc);}}; \ No newline at end of file +var _0x7728=['removeListener','register','length','openchannelQueue:','save','update','emit'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x7728,0xc1));var _0x8772=function(_0x5442a5,_0x4110f1){_0x5442a5=_0x5442a5-0x0;var _0x130af0=_0x7728[_0x5442a5];return _0x130af0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x8772('0x0'),'remove',_0x8772('0x1')];function createListener(_0x232725,_0x4a8452){return function(_0x2a9044){_0x4a8452[_0x8772('0x2')](_0x232725,_0x2a9044);};}function removeListener(_0x588cfd,_0x25f512){return function(){OpenchannelQueueEvents[_0x8772('0x3')](_0x588cfd,_0x25f512);};}exports[_0x8772('0x4')]=function(_0x433e62){for(var _0x517285=0x0,_0x1efb14=events[_0x8772('0x5')];_0x517285<_0x1efb14;_0x517285++){var _0x4544ff=events[_0x517285];var _0x3b226f=createListener(_0x8772('0x6')+_0x4544ff,_0x433e62);OpenchannelQueueEvents['on'](_0x4544ff,_0x3b226f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 79e480f..253fde5 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 _0xae30=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','show','create','/:id','delete'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xae30,0xbc));var _0x0ae3=function(_0x1a6659,_0xcc8b76){_0x1a6659=_0x1a6659-0x0;var _0x53aeb8=_0xae30[_0x1a6659];return _0x53aeb8;};'use strict';var multer=require('multer');var util=require(_0x0ae3('0x0'));var path=require(_0x0ae3('0x1'));var timeout=require(_0x0ae3('0x2'));var express=require(_0x0ae3('0x3'));var router=express[_0x0ae3('0x4')]();var fs_extra=require(_0x0ae3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae3('0x6'));var config=require(_0x0ae3('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x0ae3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0ae3('0x8')](_0x0ae3('0x9'),auth['isAuthenticated'](),controller[_0x0ae3('0xa')]);router[_0x0ae3('0x8')]('/:id',auth[_0x0ae3('0xb')](),controller[_0x0ae3('0xc')]);router['post']('/',auth[_0x0ae3('0xb')](),controller[_0x0ae3('0xd')]);router['put'](_0x0ae3('0xe'),auth[_0x0ae3('0xb')](),controller['update']);router[_0x0ae3('0xf')](_0x0ae3('0xe'),auth[_0x0ae3('0xb')](),controller['destroy']);module[_0x0ae3('0x10')]=router; \ No newline at end of file +var _0x218f=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x218f,0x1dc));var _0xf218=function(_0x2dd1b7,_0x2f0f0a){_0x2dd1b7=_0x2dd1b7-0x0;var _0x2b6e7e=_0x218f[_0x2dd1b7];return _0x2b6e7e;};'use strict';var multer=require(_0xf218('0x0'));var util=require(_0xf218('0x1'));var path=require(_0xf218('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf218('0x3')]();var fs_extra=require(_0xf218('0x4'));var auth=require(_0xf218('0x5'));var interaction=require(_0xf218('0x6'));var config=require(_0xf218('0x7'));var controller=require(_0xf218('0x8'));router[_0xf218('0x9')]('/',auth[_0xf218('0xa')](),controller[_0xf218('0xb')]);router[_0xf218('0x9')](_0xf218('0xc'),auth[_0xf218('0xa')](),controller[_0xf218('0xd')]);router[_0xf218('0x9')](_0xf218('0xe'),auth[_0xf218('0xa')](),controller[_0xf218('0xf')]);router[_0xf218('0x10')]('/',auth['isAuthenticated'](),controller[_0xf218('0x11')]);router[_0xf218('0x12')]('/:id',auth[_0xf218('0xa')](),controller[_0xf218('0x13')]);router[_0xf218('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf218('0x15')]);module[_0xf218('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0f90200..ddb6406 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 _0xe66d=['sequelize','STRING','DATE','moment'];(function(_0x1a3d04,_0x266c48){var _0x4824a2=function(_0x172e6e){while(--_0x172e6e){_0x1a3d04['push'](_0x1a3d04['shift']());}};_0x4824a2(++_0x266c48);}(_0xe66d,0xfb));var _0xde66=function(_0x6171c0,_0x127af3){_0x6171c0=_0x6171c0-0x0;var _0x227390=_0xe66d[_0x6171c0];return _0x227390;};'use strict';var moment=require(_0xde66('0x0'));var Sequelize=require(_0xde66('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xde66('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xde66('0x2')]},'joinAt':{'type':Sequelize[_0xde66('0x3')]},'leaveAt':{'type':Sequelize[_0xde66('0x3')]},'acceptAt':{'type':Sequelize[_0xde66('0x3')]},'exitAt':{'type':Sequelize[_0xde66('0x3')]},'reason':{'type':Sequelize[_0xde66('0x2')]}}; \ No newline at end of file +var _0x3ad5=['DATE','moment','exports','STRING'];(function(_0x23ceab,_0x13ba45){var _0x64fde7=function(_0x5dbaf9){while(--_0x5dbaf9){_0x23ceab['push'](_0x23ceab['shift']());}};_0x64fde7(++_0x13ba45);}(_0x3ad5,0xe9));var _0x53ad=function(_0x17f7e4,_0x2277b2){_0x17f7e4=_0x17f7e4-0x0;var _0x239692=_0x3ad5[_0x17f7e4];return _0x239692;};'use strict';var moment=require(_0x53ad('0x0'));var Sequelize=require('sequelize');module[_0x53ad('0x1')]={'uniqueid':{'type':Sequelize[_0x53ad('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x53ad('0x2')]},'joinAt':{'type':Sequelize[_0x53ad('0x3')]},'leaveAt':{'type':Sequelize[_0x53ad('0x3')]},'acceptAt':{'type':Sequelize[_0x53ad('0x3')]},'exitAt':{'type':Sequelize[_0x53ad('0x3')]},'reason':{'type':Sequelize[_0x53ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ddca28d..6e3f70f 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 _0x45a1=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x45a1,0x8d));var _0x145a=function(_0x560f2f,_0x307f4a){_0x560f2f=_0x560f2f-0x0;var _0x180b0d=_0x45a1[_0x560f2f];return _0x180b0d;};'use strict';var emlformat=require(_0x145a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x145a('0x1'));var jsonpatch=require(_0x145a('0x2'));var rp=require(_0x145a('0x3'));var moment=require(_0x145a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x145a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x145a('0x6'));var csv=require(_0x145a('0x7'));var ejs=require(_0x145a('0x8'));var fs=require('fs');var fs_extra=require(_0x145a('0x9'));var _=require(_0x145a('0xa'));var squel=require(_0x145a('0xb'));var crypto=require('crypto');var jsforce=require(_0x145a('0xc'));var deskjs=require(_0x145a('0xd'));var toCsv=require(_0x145a('0x7'));var querystring=require(_0x145a('0xe'));var Papa=require(_0x145a('0xf'));var Redis=require(_0x145a('0x10'));var authService=require(_0x145a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x145a('0x12'))(_0x145a('0x13'));var utils=require(_0x145a('0x14'));var config=require(_0x145a('0x15'));var licenseUtil=require(_0x145a('0x16'));var db=require(_0x145a('0x17'))['db'];function respondWithStatusCode(_0x2f7a1a,_0xf51bbc){_0xf51bbc=_0xf51bbc||0xcc;return function(_0x1e6eb9){if(_0x1e6eb9){return _0x2f7a1a[_0x145a('0x18')](_0xf51bbc);}return _0x2f7a1a[_0x145a('0x19')](_0xf51bbc)[_0x145a('0x1a')]();};}function respondWithResult(_0x5177ba,_0x36401a){_0x36401a=_0x36401a||0xc8;return function(_0x56ad78){if(_0x56ad78){return _0x5177ba[_0x145a('0x19')](_0x36401a)[_0x145a('0x1b')](_0x56ad78);}};}function respondWithFilteredResult(_0x17e8b2,_0x4072c6){return function(_0x11ba22){if(_0x11ba22){var _0x5991eb=typeof _0x4072c6['offset']===_0x145a('0x1c')&&typeof _0x4072c6['limit']==='undefined';var _0x542447=_0x11ba22[_0x145a('0x1d')];var _0x1e3d29=_0x5991eb?0x0:_0x4072c6[_0x145a('0x1e')];var _0x5ce60d=_0x5991eb?_0x11ba22['count']:_0x4072c6['offset']+_0x4072c6[_0x145a('0x1f')];var _0x1f1d54;if(_0x5ce60d>=_0x542447){_0x5ce60d=_0x542447;_0x1f1d54=0xc8;}else{_0x1f1d54=0xce;}_0x17e8b2[_0x145a('0x19')](_0x1f1d54);return _0x17e8b2[_0x145a('0x20')]('Content-Range',_0x1e3d29+'-'+_0x5ce60d+'/'+_0x542447)['json'](_0x11ba22);}return null;};}function patchUpdates(_0x3d16bc){return function(_0x1c29e6){try{jsonpatch[_0x145a('0x21')](_0x1c29e6,_0x3d16bc,!![]);}catch(_0x47e714){return BPromise[_0x145a('0x22')](_0x47e714);}return _0x1c29e6['save']();};}function saveUpdates(_0x195810,_0x335c15){return function(_0x3b3128){if(_0x3b3128){return _0x3b3128[_0x145a('0x23')](_0x195810)[_0x145a('0x24')](function(_0xb31892){return _0xb31892;});}return null;};}function removeEntity(_0x333953,_0x55a1f4){return function(_0x26be44){if(_0x26be44){return _0x26be44[_0x145a('0x25')]()[_0x145a('0x24')](function(){_0x333953['status'](0xcc)[_0x145a('0x1a')]();});}};}function handleEntityNotFound(_0x1ae3b8,_0x4d330e){return function(_0x12da8c){if(!_0x12da8c){_0x1ae3b8[_0x145a('0x18')](0x194);}return _0x12da8c;};}function handleError(_0x56df4b,_0x3c56c6){_0x3c56c6=_0x3c56c6||0x1f4;return function(_0x1b3ed5){logger[_0x145a('0x26')](_0x1b3ed5[_0x145a('0x27')]);if(_0x1b3ed5[_0x145a('0x28')]){delete _0x1b3ed5[_0x145a('0x28')];}_0x56df4b[_0x145a('0x19')](_0x3c56c6)[_0x145a('0x29')](_0x1b3ed5);};}exports[_0x145a('0x2a')]=function(_0x1d6d53,_0x11ec90){var _0x46facf={},_0x1f6b5f={},_0x30003d={'count':0x0,'rows':[]};var _0x325f7c=_[_0x145a('0x2b')](db[_0x145a('0x2c')][_0x145a('0x2d')],function(_0x28b7d3){return{'name':_0x28b7d3[_0x145a('0x2e')],'type':_0x28b7d3[_0x145a('0x2f')][_0x145a('0x30')]};});_0x1f6b5f[_0x145a('0x31')]=_[_0x145a('0x2b')](_0x325f7c,_0x145a('0x28'));_0x1f6b5f[_0x145a('0x32')]=_[_0x145a('0x33')](_0x1d6d53['query']);_0x1f6b5f['filters']=_[_0x145a('0x34')](_0x1f6b5f[_0x145a('0x31')],_0x1f6b5f[_0x145a('0x32')]);_0x46facf[_0x145a('0x35')]=_['intersection'](_0x1f6b5f[_0x145a('0x31')],qs['fields'](_0x1d6d53[_0x145a('0x32')][_0x145a('0x36')]));_0x46facf[_0x145a('0x35')]=_0x46facf['attributes']['length']?_0x46facf[_0x145a('0x35')]:_0x1f6b5f[_0x145a('0x31')];if(!_0x1d6d53[_0x145a('0x32')][_0x145a('0x37')](_0x145a('0x38'))){_0x46facf[_0x145a('0x1f')]=qs['limit'](_0x1d6d53[_0x145a('0x32')]['limit']);_0x46facf[_0x145a('0x1e')]=qs[_0x145a('0x1e')](_0x1d6d53[_0x145a('0x32')][_0x145a('0x1e')]);}_0x46facf[_0x145a('0x39')]=qs[_0x145a('0x3a')](_0x1d6d53[_0x145a('0x32')][_0x145a('0x3a')]);_0x46facf[_0x145a('0x3b')]=qs['filters'](_[_0x145a('0x3c')](_0x1d6d53[_0x145a('0x32')],_0x1f6b5f[_0x145a('0x3d')]),_0x325f7c);if(_0x1d6d53[_0x145a('0x32')][_0x145a('0x3e')]){_0x46facf[_0x145a('0x3b')]=_[_0x145a('0x3f')](_0x46facf[_0x145a('0x3b')],{'$or':_[_0x145a('0x2b')](_0x325f7c,function(_0xc188b4){if(_0xc188b4['type']!=='VIRTUAL'){var _0x2a2514={};_0x2a2514[_0xc188b4[_0x145a('0x28')]]={'$like':'%'+_0x1d6d53['query'][_0x145a('0x3e')]+'%'};return _0x2a2514;}})});}_0x46facf=_['merge']({},_0x46facf,_0x1d6d53[_0x145a('0x40')]);var _0x2440a6={'where':_0x46facf[_0x145a('0x3b')]};return db[_0x145a('0x2c')][_0x145a('0x1d')](_0x2440a6)[_0x145a('0x24')](function(_0x1685ce){_0x30003d[_0x145a('0x1d')]=_0x1685ce;if(_0x1d6d53['query'][_0x145a('0x41')]){_0x46facf[_0x145a('0x42')]=[{'all':!![]}];}return db[_0x145a('0x2c')]['findAll'](_0x46facf);})[_0x145a('0x24')](function(_0x166f97){_0x30003d[_0x145a('0x43')]=_0x166f97;return _0x30003d;})[_0x145a('0x24')](respondWithFilteredResult(_0x11ec90,_0x46facf))[_0x145a('0x44')](handleError(_0x11ec90,null));};exports['show']=function(_0x1f8557,_0x1dd32e){var _0x309dde={'raw':!![],'where':{'id':_0x1f8557[_0x145a('0x45')]['id']}},_0x13012f={};_0x13012f[_0x145a('0x31')]=_[_0x145a('0x33')](db['OpenchannelQueueReport'][_0x145a('0x2d')]);_0x13012f[_0x145a('0x32')]=_[_0x145a('0x33')](_0x1f8557[_0x145a('0x32')]);_0x13012f['filters']=_[_0x145a('0x34')](_0x13012f[_0x145a('0x31')],_0x13012f[_0x145a('0x32')]);_0x309dde[_0x145a('0x35')]=_[_0x145a('0x34')](_0x13012f['model'],qs['fields'](_0x1f8557[_0x145a('0x32')]['fields']));_0x309dde[_0x145a('0x35')]=_0x309dde[_0x145a('0x35')]['length']?_0x309dde[_0x145a('0x35')]:_0x13012f[_0x145a('0x31')];if(_0x1f8557[_0x145a('0x32')][_0x145a('0x41')]){_0x309dde[_0x145a('0x42')]=[{'all':!![]}];}_0x309dde=_['merge']({},_0x309dde,_0x1f8557[_0x145a('0x40')]);return db[_0x145a('0x2c')]['find'](_0x309dde)['then'](handleEntityNotFound(_0x1dd32e,null))[_0x145a('0x24')](respondWithResult(_0x1dd32e,null))[_0x145a('0x44')](handleError(_0x1dd32e,null));};exports['create']=function(_0x478a47,_0x104108){return db['OpenchannelQueueReport'][_0x145a('0x46')](_0x478a47[_0x145a('0x47')],{})[_0x145a('0x24')](respondWithResult(_0x104108,0xc9))[_0x145a('0x44')](handleError(_0x104108,null));};exports[_0x145a('0x23')]=function(_0x449478,_0x16e133){if(_0x449478['body']['id']){delete _0x449478['body']['id'];}return db['OpenchannelQueueReport'][_0x145a('0x48')]({'where':{'id':_0x449478[_0x145a('0x45')]['id']}})['then'](handleEntityNotFound(_0x16e133,null))[_0x145a('0x24')](saveUpdates(_0x449478[_0x145a('0x47')],null))[_0x145a('0x24')](respondWithResult(_0x16e133,null))[_0x145a('0x44')](handleError(_0x16e133,null));};exports[_0x145a('0x25')]=function(_0xd6416e,_0x1df228){return db[_0x145a('0x2c')][_0x145a('0x48')]({'where':{'id':_0xd6416e[_0x145a('0x45')]['id']}})['then'](handleEntityNotFound(_0x1df228,null))[_0x145a('0x24')](removeEntity(_0x1df228,null))[_0x145a('0x44')](handleError(_0x1df228,null));};exports[_0x145a('0x49')]=function(_0x442c43,_0x45a882){return db[_0x145a('0x2c')][_0x145a('0x49')]()[_0x145a('0x24')](respondWithResult(_0x45a882,null))[_0x145a('0x44')](handleError(_0x45a882,null));}; \ No newline at end of file +var _0xa76f=['status','end','json','undefined','limit','offset','set','apply','reject','then','destroy','sendStatus','name','index','OpenchannelQueueReport','fieldName','type','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','fields','length','create','update','body','find','params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x76129c,_0x16b8be){var _0x575503=function(_0x590564){while(--_0x590564){_0x76129c['push'](_0x76129c['shift']());}};_0x575503(++_0x16b8be);}(_0xa76f,0x1ae));var _0xfa76=function(_0x7b1ad7,_0x2465ef){_0x7b1ad7=_0x7b1ad7-0x0;var _0x2a7b43=_0xa76f[_0x7b1ad7];return _0x2a7b43;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa76('0x0'));var jsonpatch=require(_0xfa76('0x1'));var rp=require('request-promise');var moment=require(_0xfa76('0x2'));var BPromise=require(_0xfa76('0x3'));var Mustache=require(_0xfa76('0x4'));var util=require(_0xfa76('0x5'));var path=require(_0xfa76('0x6'));var sox=require(_0xfa76('0x7'));var csv=require(_0xfa76('0x8'));var ejs=require(_0xfa76('0x9'));var fs=require('fs');var fs_extra=require(_0xfa76('0xa'));var _=require(_0xfa76('0xb'));var squel=require(_0xfa76('0xc'));var crypto=require(_0xfa76('0xd'));var jsforce=require(_0xfa76('0xe'));var deskjs=require(_0xfa76('0xf'));var toCsv=require(_0xfa76('0x8'));var querystring=require(_0xfa76('0x10'));var Papa=require(_0xfa76('0x11'));var Redis=require(_0xfa76('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfa76('0x13'));var as=require(_0xfa76('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa76('0x15'))(_0xfa76('0x16'));var utils=require(_0xfa76('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfa76('0x18'));var db=require(_0xfa76('0x19'))['db'];function respondWithStatusCode(_0x1fa124,_0x4aa528){_0x4aa528=_0x4aa528||0xcc;return function(_0x114ac9){if(_0x114ac9){return _0x1fa124['sendStatus'](_0x4aa528);}return _0x1fa124[_0xfa76('0x1a')](_0x4aa528)[_0xfa76('0x1b')]();};}function respondWithResult(_0x439930,_0x38da24){_0x38da24=_0x38da24||0xc8;return function(_0x1184fa){if(_0x1184fa){return _0x439930[_0xfa76('0x1a')](_0x38da24)[_0xfa76('0x1c')](_0x1184fa);}};}function respondWithFilteredResult(_0x56252c,_0x35bff1){return function(_0x357dd1){if(_0x357dd1){var _0x37f392=typeof _0x35bff1['offset']===_0xfa76('0x1d')&&typeof _0x35bff1[_0xfa76('0x1e')]===_0xfa76('0x1d');var _0x3eccc5=_0x357dd1['count'];var _0x5ce139=_0x37f392?0x0:_0x35bff1[_0xfa76('0x1f')];var _0x49f513=_0x37f392?_0x357dd1['count']:_0x35bff1[_0xfa76('0x1f')]+_0x35bff1[_0xfa76('0x1e')];var _0x21127e;if(_0x49f513>=_0x3eccc5){_0x49f513=_0x3eccc5;_0x21127e=0xc8;}else{_0x21127e=0xce;}_0x56252c[_0xfa76('0x1a')](_0x21127e);return _0x56252c[_0xfa76('0x20')]('Content-Range',_0x5ce139+'-'+_0x49f513+'/'+_0x3eccc5)['json'](_0x357dd1);}return null;};}function patchUpdates(_0x366748){return function(_0x3be92e){try{jsonpatch[_0xfa76('0x21')](_0x3be92e,_0x366748,!![]);}catch(_0x4fd9c2){return BPromise[_0xfa76('0x22')](_0x4fd9c2);}return _0x3be92e['save']();};}function saveUpdates(_0x3e9547,_0x408783){return function(_0x1a1733){if(_0x1a1733){return _0x1a1733['update'](_0x3e9547)[_0xfa76('0x23')](function(_0x297569){return _0x297569;});}return null;};}function removeEntity(_0x5264de,_0x4352e3){return function(_0x43feda){if(_0x43feda){return _0x43feda[_0xfa76('0x24')]()['then'](function(){_0x5264de[_0xfa76('0x1a')](0xcc)[_0xfa76('0x1b')]();});}};}function handleEntityNotFound(_0xff5dff,_0x28b8fd){return function(_0x32ac7a){if(!_0x32ac7a){_0xff5dff[_0xfa76('0x25')](0x194);}return _0x32ac7a;};}function handleError(_0x3ba525,_0x1475cb){_0x1475cb=_0x1475cb||0x1f4;return function(_0x4954e0){logger['error'](_0x4954e0['stack']);if(_0x4954e0[_0xfa76('0x26')]){delete _0x4954e0[_0xfa76('0x26')];}_0x3ba525['status'](_0x1475cb)['send'](_0x4954e0);};}exports[_0xfa76('0x27')]=function(_0x1b68b3,_0x2ed313){var _0x4b9482={},_0x476fc8={},_0x294576={'count':0x0,'rows':[]};var _0x37de02=_['map'](db[_0xfa76('0x28')]['rawAttributes'],function(_0x1e87eb){return{'name':_0x1e87eb[_0xfa76('0x29')],'type':_0x1e87eb[_0xfa76('0x2a')][_0xfa76('0x2b')]};});_0x476fc8[_0xfa76('0x2c')]=_[_0xfa76('0x2d')](_0x37de02,_0xfa76('0x26'));_0x476fc8[_0xfa76('0x2e')]=_['keys'](_0x1b68b3[_0xfa76('0x2e')]);_0x476fc8[_0xfa76('0x2f')]=_[_0xfa76('0x30')](_0x476fc8[_0xfa76('0x2c')],_0x476fc8[_0xfa76('0x2e')]);_0x4b9482['attributes']=_['intersection'](_0x476fc8[_0xfa76('0x2c')],qs['fields'](_0x1b68b3[_0xfa76('0x2e')]['fields']));_0x4b9482[_0xfa76('0x31')]=_0x4b9482[_0xfa76('0x31')]['length']?_0x4b9482[_0xfa76('0x31')]:_0x476fc8[_0xfa76('0x2c')];if(!_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x32')](_0xfa76('0x33'))){_0x4b9482[_0xfa76('0x1e')]=qs[_0xfa76('0x1e')](_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x1e')]);_0x4b9482[_0xfa76('0x1f')]=qs[_0xfa76('0x1f')](_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x1f')]);}_0x4b9482[_0xfa76('0x34')]=qs['sort'](_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x35')]);_0x4b9482[_0xfa76('0x36')]=qs[_0xfa76('0x2f')](_[_0xfa76('0x37')](_0x1b68b3[_0xfa76('0x2e')],_0x476fc8['filters']),_0x37de02);if(_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x38')]){_0x4b9482['where']=_[_0xfa76('0x39')](_0x4b9482[_0xfa76('0x36')],{'$or':_[_0xfa76('0x2d')](_0x37de02,function(_0xa13a47){if(_0xa13a47[_0xfa76('0x2a')]!==_0xfa76('0x3a')){var _0x5e41d8={};_0x5e41d8[_0xa13a47[_0xfa76('0x26')]]={'$like':'%'+_0x1b68b3[_0xfa76('0x2e')][_0xfa76('0x38')]+'%'};return _0x5e41d8;}})});}_0x4b9482=_[_0xfa76('0x39')]({},_0x4b9482,_0x1b68b3[_0xfa76('0x3b')]);var _0x37d064={'where':_0x4b9482[_0xfa76('0x36')]};return db[_0xfa76('0x28')][_0xfa76('0x3c')](_0x37d064)[_0xfa76('0x23')](function(_0x53cdd4){_0x294576[_0xfa76('0x3c')]=_0x53cdd4;if(_0x1b68b3['query'][_0xfa76('0x3d')]){_0x4b9482[_0xfa76('0x3e')]=[{'all':!![]}];}return db[_0xfa76('0x28')][_0xfa76('0x3f')](_0x4b9482);})['then'](function(_0x10480a){_0x294576[_0xfa76('0x40')]=_0x10480a;return _0x294576;})[_0xfa76('0x23')](respondWithFilteredResult(_0x2ed313,_0x4b9482))[_0xfa76('0x41')](handleError(_0x2ed313,null));};exports[_0xfa76('0x42')]=function(_0x5b7f22,_0x34c0e4){var _0x3ac7cd={'raw':!![],'where':{'id':_0x5b7f22['params']['id']}},_0x1f0c6c={};_0x1f0c6c['model']=_[_0xfa76('0x43')](db[_0xfa76('0x28')]['rawAttributes']);_0x1f0c6c[_0xfa76('0x2e')]=_[_0xfa76('0x43')](_0x5b7f22[_0xfa76('0x2e')]);_0x1f0c6c[_0xfa76('0x2f')]=_[_0xfa76('0x30')](_0x1f0c6c[_0xfa76('0x2c')],_0x1f0c6c['query']);_0x3ac7cd[_0xfa76('0x31')]=_['intersection'](_0x1f0c6c[_0xfa76('0x2c')],qs[_0xfa76('0x44')](_0x5b7f22[_0xfa76('0x2e')]['fields']));_0x3ac7cd['attributes']=_0x3ac7cd[_0xfa76('0x31')][_0xfa76('0x45')]?_0x3ac7cd[_0xfa76('0x31')]:_0x1f0c6c[_0xfa76('0x2c')];if(_0x5b7f22[_0xfa76('0x2e')]['includeAll']){_0x3ac7cd['include']=[{'all':!![]}];}_0x3ac7cd=_[_0xfa76('0x39')]({},_0x3ac7cd,_0x5b7f22[_0xfa76('0x3b')]);return db[_0xfa76('0x28')]['find'](_0x3ac7cd)[_0xfa76('0x23')](handleEntityNotFound(_0x34c0e4,null))[_0xfa76('0x23')](respondWithResult(_0x34c0e4,null))[_0xfa76('0x41')](handleError(_0x34c0e4,null));};exports['create']=function(_0x269dda,_0x1e106f){return db['OpenchannelQueueReport'][_0xfa76('0x46')](_0x269dda['body'],{})['then'](respondWithResult(_0x1e106f,0xc9))[_0xfa76('0x41')](handleError(_0x1e106f,null));};exports[_0xfa76('0x47')]=function(_0x2c70d2,_0x267e05){if(_0x2c70d2[_0xfa76('0x48')]['id']){delete _0x2c70d2[_0xfa76('0x48')]['id'];}return db[_0xfa76('0x28')][_0xfa76('0x49')]({'where':{'id':_0x2c70d2[_0xfa76('0x4a')]['id']}})['then'](handleEntityNotFound(_0x267e05,null))[_0xfa76('0x23')](saveUpdates(_0x2c70d2['body'],null))[_0xfa76('0x23')](respondWithResult(_0x267e05,null))['catch'](handleError(_0x267e05,null));};exports[_0xfa76('0x24')]=function(_0xcf9eef,_0x3b41a1){return db[_0xfa76('0x28')]['find']({'where':{'id':_0xcf9eef[_0xfa76('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b41a1,null))['then'](removeEntity(_0x3b41a1,null))['catch'](handleError(_0x3b41a1,null));};exports[_0xfa76('0x4b')]=function(_0x4215ff,_0x36ed02){return db['OpenchannelQueueReport'][_0xfa76('0x4b')]()[_0xfa76('0x23')](respondWithResult(_0x36ed02,null))[_0xfa76('0x41')](handleError(_0x36ed02,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9960771..3554ec6 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4e9566,_0x20b096){var _0x3632d0=function(_0x3a4efe){while(--_0x3a4efe){_0x4e9566['push'](_0x4e9566['shift']());}};_0x3632d0(++_0x20b096);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x5f3a4b,_0x245bd9){var _0x23f616=function(_0x2514c8){while(--_0x2514c8){_0x5f3a4b['push'](_0x5f3a4b['shift']());}};_0x23f616(++_0x245bd9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'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 6d86d9a..2a477b3 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 _0xdac7=['client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','update','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3ccb15,_0xd231ac){var _0x15b2c7=function(_0x37d865){while(--_0x37d865){_0x3ccb15['push'](_0x3ccb15['shift']());}};_0x15b2c7(++_0xd231ac);}(_0xdac7,0x180));var _0x7dac=function(_0x40bd2b,_0xa329a4){_0x40bd2b=_0x40bd2b-0x0;var _0x5122f8=_0xdac7[_0x40bd2b];return _0x5122f8;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dac('0x2'));var db=require(_0x7dac('0x3'))['db'];var utils=require(_0x7dac('0x4'));var logger=require(_0x7dac('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dac('0x6')][_0x7dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x505705,_0x28cc84,_0x53c460){return new BPromise(function(_0x3b319f,_0x5ccf75){return client[_0x7dac('0x8')](_0x505705,_0x53c460)[_0x7dac('0x9')](function(_0x45fbdc){logger[_0x7dac('0xa')](_0x7dac('0xb'),_0x28cc84,_0x7dac('0xc'));logger[_0x7dac('0xd')](_0x7dac('0xe'),_0x28cc84,_0x7dac('0xc'),JSON[_0x7dac('0xf')](_0x45fbdc));if(_0x45fbdc['error']){if(_0x45fbdc['error']['code']===0x1f4){logger[_0x7dac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x28cc84,_0x45fbdc[_0x7dac('0x10')]['message']);return _0x5ccf75(_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);}logger[_0x7dac('0x10')](_0x7dac('0xb'),_0x28cc84,_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);return _0x3b319f(_0x45fbdc[_0x7dac('0x10')]['message']);}else{logger[_0x7dac('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x28cc84,'request\x20sent');_0x3b319f(_0x45fbdc[_0x7dac('0x12')][_0x7dac('0x11')]);}})[_0x7dac('0x13')](function(_0x2de4ea){logger[_0x7dac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x28cc84,_0x2de4ea);_0x5ccf75(_0x2de4ea);});});}exports[_0x7dac('0x14')]=function(_0x4c1f4f){var _0x352a77=this;return new Promise(function(_0x4639e2,_0x313615){return db[_0x7dac('0x15')][_0x7dac('0x16')](_0x4c1f4f[_0x7dac('0x17')],{'raw':_0x4c1f4f[_0x7dac('0x18')]?_0x4c1f4f[_0x7dac('0x18')][_0x7dac('0x19')]===undefined?!![]:![]:!![]})[_0x7dac('0x9')](function(_0x18f993){logger[_0x7dac('0xa')](_0x7dac('0x14'),_0x4c1f4f);logger[_0x7dac('0xd')]('CreateOpenchannelQueueReport',_0x4c1f4f,JSON['stringify'](_0x18f993));_0x4639e2(_0x18f993);})[_0x7dac('0x13')](function(_0x4c9fda){logger[_0x7dac('0x10')](_0x7dac('0x14'),_0x4c9fda['message'],_0x4c1f4f);_0x313615(_0x352a77[_0x7dac('0x10')](0x1f4,_0x4c9fda[_0x7dac('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0xbdabba){var _0x41b3cd=this;return new Promise(function(_0x341cc8,_0x179881){return db[_0x7dac('0x15')][_0x7dac('0x1a')](_0xbdabba[_0x7dac('0x17')],{'raw':_0xbdabba['options']?_0xbdabba[_0x7dac('0x18')][_0x7dac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbdabba[_0x7dac('0x18')]?_0xbdabba['options']['where']||null:null,'attributes':_0xbdabba[_0x7dac('0x18')]?_0xbdabba[_0x7dac('0x18')][_0x7dac('0x1b')]||null:null,'limit':_0xbdabba[_0x7dac('0x18')]?_0xbdabba[_0x7dac('0x18')][_0x7dac('0x1c')]||null:null})[_0x7dac('0x9')](function(_0x31bbf7){logger[_0x7dac('0xa')](_0x7dac('0x1d'),_0xbdabba);logger[_0x7dac('0xd')]('UpdateOpenchannelQueueReport',_0xbdabba,JSON['stringify'](_0x31bbf7));_0x341cc8(_0x31bbf7);})[_0x7dac('0x13')](function(_0xa92c4b){logger[_0x7dac('0x10')]('UpdateOpenchannelQueueReport',_0xa92c4b[_0x7dac('0x11')],_0xbdabba);_0x179881(_0x41b3cd[_0x7dac('0x10')](0x1f4,_0xa92c4b[_0x7dac('0x11')]));});});}; \ No newline at end of file +var _0x8952=['raw','debug','UpdateOpenchannelQueueReport','body','options','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x8952,0x17e));var _0x2895=function(_0x1a360e,_0x2f4f24){_0x1a360e=_0x1a360e-0x0;var _0x3ffcff=_0x8952[_0x1a360e];return _0x3ffcff;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')](_0xbf8b63['body'],{'raw':_0xbf8b63['options']?_0xbf8b63['options'][_0x2895('0x18')]===undefined?!![]:![]:!![]})[_0x2895('0xc')](function(_0x3ec4da){logger['info'](_0x2895('0x15'),_0xbf8b63);logger[_0x2895('0x19')](_0x2895('0x15'),_0xbf8b63,JSON[_0x2895('0xf')](_0x3ec4da));_0x155124(_0x3ec4da);})[_0x2895('0x14')](function(_0x5dbbfe){logger[_0x2895('0x10')](_0x2895('0x15'),_0x5dbbfe['message'],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x5dbbfe[_0x2895('0x12')]));});});};exports[_0x2895('0x1a')]=function(_0x511286){var _0x4e884f=this;return new Promise(function(_0x3a72fa,_0x4569b5){return db[_0x2895('0x16')]['update'](_0x511286[_0x2895('0x1b')],{'raw':_0x511286[_0x2895('0x1c')]?_0x511286['options'][_0x2895('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x511286[_0x2895('0x1c')]?_0x511286[_0x2895('0x1c')]['where']||null:null,'attributes':_0x511286[_0x2895('0x1c')]?_0x511286[_0x2895('0x1c')]['attributes']||null:null,'limit':_0x511286[_0x2895('0x1c')]?_0x511286['options']['limit']||null:null})[_0x2895('0xc')](function(_0x4ee2cc){logger[_0x2895('0xd')](_0x2895('0x1a'),_0x511286);logger['debug']('UpdateOpenchannelQueueReport',_0x511286,JSON[_0x2895('0xf')](_0x4ee2cc));_0x3a72fa(_0x4ee2cc);})[_0x2895('0x14')](function(_0x190e07){logger[_0x2895('0x10')](_0x2895('0x1a'),_0x190e07[_0x2895('0x12')],_0x511286);_0x4569b5(_0x4e884f[_0x2895('0x10')](0x1f4,_0x190e07['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5997d6d..5fc7c78 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 _0x775e=['create','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x775e,0x169));var _0xe775=function(_0x67343e,_0x2fa00d){_0x67343e=_0x67343e-0x0;var _0x91168f=_0x775e[_0x67343e];return _0x91168f;};'use strict';var multer=require(_0xe775('0x0'));var util=require('util');var path=require(_0xe775('0x1'));var timeout=require(_0xe775('0x2'));var express=require(_0xe775('0x3'));var router=express['Router']();var fs_extra=require(_0xe775('0x4'));var auth=require(_0xe775('0x5'));var interaction=require(_0xe775('0x6'));var config=require(_0xe775('0x7'));var controller=require(_0xe775('0x8'));router[_0xe775('0x9')]('/',auth[_0xe775('0xa')](),controller[_0xe775('0xb')]);router['get'](_0xe775('0xc'),auth[_0xe775('0xa')](),controller[_0xe775('0xd')]);router[_0xe775('0x9')](_0xe775('0xe'),auth[_0xe775('0xa')](),controller[_0xe775('0xf')]);router[_0xe775('0x10')]('/',auth[_0xe775('0xa')](),controller[_0xe775('0x11')]);router['put'](_0xe775('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe775('0x12')](_0xe775('0xe'),auth[_0xe775('0xa')](),controller[_0xe775('0x13')]);module[_0xe775('0x14')]=router; \ No newline at end of file +var _0xbd4c=['multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','put','delete','destroy'];(function(_0x4513a2,_0x5764d2){var _0x1f5254=function(_0x526a15){while(--_0x526a15){_0x4513a2['push'](_0x4513a2['shift']());}};_0x1f5254(++_0x5764d2);}(_0xbd4c,0x1a4));var _0xcbd4=function(_0x5b75aa,_0x24883b){_0x5b75aa=_0x5b75aa-0x0;var _0x2012a7=_0xbd4c[_0x5b75aa];return _0x2012a7;};'use strict';var multer=require(_0xcbd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcbd4('0x1')]();var fs_extra=require(_0xcbd4('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xcbd4('0x3'));var config=require(_0xcbd4('0x4'));var controller=require(_0xcbd4('0x5'));router[_0xcbd4('0x6')]('/',auth[_0xcbd4('0x7')](),controller[_0xcbd4('0x8')]);router[_0xcbd4('0x6')](_0xcbd4('0x9'),auth[_0xcbd4('0x7')](),controller[_0xcbd4('0xa')]);router['get']('/:id',auth[_0xcbd4('0x7')](),controller['show']);router[_0xcbd4('0xb')]('/',auth[_0xcbd4('0x7')](),controller['create']);router[_0xcbd4('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcbd4('0xd')]('/:id',auth[_0xcbd4('0x7')](),controller[_0xcbd4('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2762808..cc1ebe6 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x21e745,_0x547d44){_0x21e745=_0x21e745-0x0;var _0x43f2a1=_0x9bde[_0x21e745];return _0x43f2a1;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xb43b,0x1b2));var _0xbb43=function(_0x191e97,_0x155edc){_0x191e97=_0x191e97-0x0;var _0x3e4192=_0xb43b[_0x191e97];return _0x3e4192;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 21e4854..a091399 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 _0x90ff=['count','Content-Range','apply','save','update','then','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x323726,_0x7af501){var _0x1b8691=function(_0xbe7b2b){while(--_0xbe7b2b){_0x323726['push'](_0x323726['shift']());}};_0x1b8691(++_0x7af501);}(_0x90ff,0x111));var _0xf90f=function(_0x23a915,_0x48d215){_0x23a915=_0x23a915-0x0;var _0x1e301d=_0x90ff[_0x23a915];return _0x1e301d;};'use strict';var emlformat=require(_0xf90f('0x0'));var rimraf=require(_0xf90f('0x1'));var zipdir=require(_0xf90f('0x2'));var jsonpatch=require(_0xf90f('0x3'));var rp=require(_0xf90f('0x4'));var moment=require(_0xf90f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf90f('0x6'));var util=require(_0xf90f('0x7'));var path=require(_0xf90f('0x8'));var sox=require(_0xf90f('0x9'));var csv=require('to-csv');var ejs=require(_0xf90f('0xa'));var fs=require('fs');var fs_extra=require(_0xf90f('0xb'));var _=require(_0xf90f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf90f('0xd'));var deskjs=require(_0xf90f('0xe'));var toCsv=require(_0xf90f('0xf'));var querystring=require(_0xf90f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf90f('0x11'));var qs=require(_0xf90f('0x12'));var as=require(_0xf90f('0x13'));var hardwareService=require(_0xf90f('0x14'));var logger=require(_0xf90f('0x15'))('api');var utils=require(_0xf90f('0x16'));var config=require(_0xf90f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf90f('0x18'))['db'];function respondWithStatusCode(_0x15641d,_0x47ea3c){_0x47ea3c=_0x47ea3c||0xcc;return function(_0x1e6ea2){if(_0x1e6ea2){return _0x15641d['sendStatus'](_0x47ea3c);}return _0x15641d[_0xf90f('0x19')](_0x47ea3c)[_0xf90f('0x1a')]();};}function respondWithResult(_0x39769a,_0x4be7ad){_0x4be7ad=_0x4be7ad||0xc8;return function(_0x5a8da2){if(_0x5a8da2){return _0x39769a['status'](_0x4be7ad)[_0xf90f('0x1b')](_0x5a8da2);}};}function respondWithFilteredResult(_0xfb4a45,_0x3d7d34){return function(_0x27c2ff){if(_0x27c2ff){var _0x2c1e99=typeof _0x3d7d34[_0xf90f('0x1c')]===_0xf90f('0x1d')&&typeof _0x3d7d34[_0xf90f('0x1e')]===_0xf90f('0x1d');var _0x4ccddf=_0x27c2ff[_0xf90f('0x1f')];var _0xb68ddd=_0x2c1e99?0x0:_0x3d7d34[_0xf90f('0x1c')];var _0x39c455=_0x2c1e99?_0x27c2ff[_0xf90f('0x1f')]:_0x3d7d34[_0xf90f('0x1c')]+_0x3d7d34[_0xf90f('0x1e')];var _0x3059ff;if(_0x39c455>=_0x4ccddf){_0x39c455=_0x4ccddf;_0x3059ff=0xc8;}else{_0x3059ff=0xce;}_0xfb4a45['status'](_0x3059ff);return _0xfb4a45['set'](_0xf90f('0x20'),_0xb68ddd+'-'+_0x39c455+'/'+_0x4ccddf)[_0xf90f('0x1b')](_0x27c2ff);}return null;};}function patchUpdates(_0x53a9be){return function(_0x4bf4df){try{jsonpatch[_0xf90f('0x21')](_0x4bf4df,_0x53a9be,!![]);}catch(_0x44ff69){return BPromise['reject'](_0x44ff69);}return _0x4bf4df[_0xf90f('0x22')]();};}function saveUpdates(_0x3a0767,_0x512155){return function(_0x46b0c5){if(_0x46b0c5){return _0x46b0c5[_0xf90f('0x23')](_0x3a0767)[_0xf90f('0x24')](function(_0xb84a7f){return _0xb84a7f;});}return null;};}function removeEntity(_0x12ae7c,_0x17835a){return function(_0x614d5f){if(_0x614d5f){return _0x614d5f['destroy']()[_0xf90f('0x24')](function(){_0x12ae7c['status'](0xcc)[_0xf90f('0x1a')]();});}};}function handleEntityNotFound(_0x521e77,_0x41edfc){return function(_0x409e62){if(!_0x409e62){_0x521e77['sendStatus'](0x194);}return _0x409e62;};}function handleError(_0x104d9e,_0x2ac230){_0x2ac230=_0x2ac230||0x1f4;return function(_0x2f448d){logger[_0xf90f('0x25')](_0x2f448d[_0xf90f('0x26')]);if(_0x2f448d['name']){delete _0x2f448d['name'];}_0x104d9e['status'](_0x2ac230)[_0xf90f('0x27')](_0x2f448d);};}exports[_0xf90f('0x28')]=function(_0x4815ef,_0x214ac7){var _0x4cbcfc={},_0x2b7b82={},_0x469307={'count':0x0,'rows':[]};var _0x35d982=_[_0xf90f('0x29')](db[_0xf90f('0x2a')][_0xf90f('0x2b')],function(_0x2bfe61){return{'name':_0x2bfe61[_0xf90f('0x2c')],'type':_0x2bfe61[_0xf90f('0x2d')]['key']};});_0x2b7b82[_0xf90f('0x2e')]=_[_0xf90f('0x29')](_0x35d982,'name');_0x2b7b82[_0xf90f('0x2f')]=_[_0xf90f('0x30')](_0x4815ef[_0xf90f('0x2f')]);_0x2b7b82[_0xf90f('0x31')]=_['intersection'](_0x2b7b82[_0xf90f('0x2e')],_0x2b7b82[_0xf90f('0x2f')]);_0x4cbcfc[_0xf90f('0x32')]=_[_0xf90f('0x33')](_0x2b7b82[_0xf90f('0x2e')],qs['fields'](_0x4815ef[_0xf90f('0x2f')][_0xf90f('0x34')]));_0x4cbcfc[_0xf90f('0x32')]=_0x4cbcfc[_0xf90f('0x32')][_0xf90f('0x35')]?_0x4cbcfc[_0xf90f('0x32')]:_0x2b7b82[_0xf90f('0x2e')];if(!_0x4815ef['query'][_0xf90f('0x36')]('nolimit')){_0x4cbcfc[_0xf90f('0x1e')]=qs[_0xf90f('0x1e')](_0x4815ef[_0xf90f('0x2f')]['limit']);_0x4cbcfc['offset']=qs[_0xf90f('0x1c')](_0x4815ef[_0xf90f('0x2f')][_0xf90f('0x1c')]);}_0x4cbcfc[_0xf90f('0x37')]=qs[_0xf90f('0x38')](_0x4815ef[_0xf90f('0x2f')][_0xf90f('0x38')]);_0x4cbcfc[_0xf90f('0x39')]=qs['filters'](_[_0xf90f('0x3a')](_0x4815ef[_0xf90f('0x2f')],_0x2b7b82[_0xf90f('0x31')]),_0x35d982);if(_0x4815ef['query'][_0xf90f('0x3b')]){_0x4cbcfc[_0xf90f('0x39')]=_['merge'](_0x4cbcfc[_0xf90f('0x39')],{'$or':_[_0xf90f('0x29')](_0x35d982,function(_0x263550){if(_0x263550[_0xf90f('0x2d')]!==_0xf90f('0x3c')){var _0x15d52a={};_0x15d52a[_0x263550[_0xf90f('0x3d')]]={'$like':'%'+_0x4815ef[_0xf90f('0x2f')][_0xf90f('0x3b')]+'%'};return _0x15d52a;}})});}_0x4cbcfc=_[_0xf90f('0x3e')]({},_0x4cbcfc,_0x4815ef[_0xf90f('0x3f')]);var _0x3ba253={'where':_0x4cbcfc['where']};return db[_0xf90f('0x2a')][_0xf90f('0x1f')](_0x3ba253)[_0xf90f('0x24')](function(_0x13ef1a){_0x469307[_0xf90f('0x1f')]=_0x13ef1a;if(_0x4815ef[_0xf90f('0x2f')][_0xf90f('0x40')]){_0x4cbcfc[_0xf90f('0x41')]=[{'all':!![]}];}return db[_0xf90f('0x2a')][_0xf90f('0x42')](_0x4cbcfc);})[_0xf90f('0x24')](function(_0xa110b0){_0x469307[_0xf90f('0x43')]=_0xa110b0;return _0x469307;})[_0xf90f('0x24')](respondWithFilteredResult(_0x214ac7,_0x4cbcfc))[_0xf90f('0x44')](handleError(_0x214ac7,null));};exports[_0xf90f('0x45')]=function(_0x291fbe,_0x1324a9){var _0x19403c={'raw':!![],'where':{'id':_0x291fbe[_0xf90f('0x46')]['id']}},_0x5b13f7={};_0x5b13f7[_0xf90f('0x2e')]=_[_0xf90f('0x30')](db[_0xf90f('0x2a')]['rawAttributes']);_0x5b13f7['query']=_[_0xf90f('0x30')](_0x291fbe[_0xf90f('0x2f')]);_0x5b13f7[_0xf90f('0x31')]=_[_0xf90f('0x33')](_0x5b13f7[_0xf90f('0x2e')],_0x5b13f7[_0xf90f('0x2f')]);_0x19403c[_0xf90f('0x32')]=_[_0xf90f('0x33')](_0x5b13f7[_0xf90f('0x2e')],qs[_0xf90f('0x34')](_0x291fbe[_0xf90f('0x2f')][_0xf90f('0x34')]));_0x19403c[_0xf90f('0x32')]=_0x19403c[_0xf90f('0x32')][_0xf90f('0x35')]?_0x19403c[_0xf90f('0x32')]:_0x5b13f7['model'];if(_0x291fbe[_0xf90f('0x2f')]['includeAll']){_0x19403c['include']=[{'all':!![]}];}_0x19403c=_[_0xf90f('0x3e')]({},_0x19403c,_0x291fbe[_0xf90f('0x3f')]);return db[_0xf90f('0x2a')][_0xf90f('0x47')](_0x19403c)[_0xf90f('0x24')](handleEntityNotFound(_0x1324a9,null))[_0xf90f('0x24')](respondWithResult(_0x1324a9,null))[_0xf90f('0x44')](handleError(_0x1324a9,null));};exports['create']=function(_0x520f60,_0x5361d0){return db[_0xf90f('0x2a')][_0xf90f('0x48')](_0x520f60[_0xf90f('0x49')],{})[_0xf90f('0x24')](respondWithResult(_0x5361d0,0xc9))[_0xf90f('0x44')](handleError(_0x5361d0,null));};exports[_0xf90f('0x23')]=function(_0x2bac92,_0x1d4e47){if(_0x2bac92['body']['id']){delete _0x2bac92[_0xf90f('0x49')]['id'];}return db[_0xf90f('0x2a')][_0xf90f('0x47')]({'where':{'id':_0x2bac92[_0xf90f('0x46')]['id']}})[_0xf90f('0x24')](handleEntityNotFound(_0x1d4e47,null))[_0xf90f('0x24')](saveUpdates(_0x2bac92['body'],null))['then'](respondWithResult(_0x1d4e47,null))['catch'](handleError(_0x1d4e47,null));};exports[_0xf90f('0x4a')]=function(_0x2cb2c1,_0x181d44){return db[_0xf90f('0x2a')][_0xf90f('0x47')]({'where':{'id':_0x2cb2c1['params']['id']}})['then'](handleEntityNotFound(_0x181d44,null))[_0xf90f('0x24')](removeEntity(_0x181d44,null))[_0xf90f('0x44')](handleError(_0x181d44,null));};exports[_0xf90f('0x4b')]=function(_0x1da939,_0x2f3be2){return db['OpenchannelTransferReport'][_0xf90f('0x4b')]()[_0xf90f('0x24')](respondWithResult(_0x2f3be2,null))[_0xf90f('0x44')](handleError(_0x2f3be2,null));}; \ No newline at end of file +var _0x8232=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4827a3,_0xffcef2){var _0x2c41c9=function(_0x1747a4){while(--_0x1747a4){_0x4827a3['push'](_0x4827a3['shift']());}};_0x2c41c9(++_0xffcef2);}(_0x8232,0x87));var _0x2823=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x8232[_0x5e36d1];return _0x950b9e;};'use strict';var emlformat=require(_0x2823('0x0'));var rimraf=require(_0x2823('0x1'));var zipdir=require(_0x2823('0x2'));var jsonpatch=require(_0x2823('0x3'));var rp=require(_0x2823('0x4'));var moment=require('moment');var BPromise=require(_0x2823('0x5'));var Mustache=require('mustache');var util=require(_0x2823('0x6'));var path=require(_0x2823('0x7'));var sox=require('sox');var csv=require(_0x2823('0x8'));var ejs=require(_0x2823('0x9'));var fs=require('fs');var fs_extra=require(_0x2823('0xa'));var _=require(_0x2823('0xb'));var squel=require(_0x2823('0xc'));var crypto=require('crypto');var jsforce=require(_0x2823('0xd'));var deskjs=require(_0x2823('0xe'));var toCsv=require(_0x2823('0x8'));var querystring=require(_0x2823('0xf'));var Papa=require(_0x2823('0x10'));var Redis=require(_0x2823('0x11'));var authService=require(_0x2823('0x12'));var qs=require(_0x2823('0x13'));var as=require(_0x2823('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2823('0x15'))('api');var utils=require(_0x2823('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2823('0x17'));var db=require(_0x2823('0x18'))['db'];function respondWithStatusCode(_0x3a474a,_0x1a87f7){_0x1a87f7=_0x1a87f7||0xcc;return function(_0x8894eb){if(_0x8894eb){return _0x3a474a[_0x2823('0x19')](_0x1a87f7);}return _0x3a474a[_0x2823('0x1a')](_0x1a87f7)[_0x2823('0x1b')]();};}function respondWithResult(_0x583b20,_0x4717d0){_0x4717d0=_0x4717d0||0xc8;return function(_0x7c6a44){if(_0x7c6a44){return _0x583b20[_0x2823('0x1a')](_0x4717d0)[_0x2823('0x1c')](_0x7c6a44);}};}function respondWithFilteredResult(_0xfb9024,_0x52d40a){return function(_0x147f03){if(_0x147f03){var _0x1ae64c=typeof _0x52d40a[_0x2823('0x1d')]==='undefined'&&typeof _0x52d40a['limit']===_0x2823('0x1e');var _0x3add2d=_0x147f03[_0x2823('0x1f')];var _0x27b7f0=_0x1ae64c?0x0:_0x52d40a[_0x2823('0x1d')];var _0x4e930b=_0x1ae64c?_0x147f03[_0x2823('0x1f')]:_0x52d40a[_0x2823('0x1d')]+_0x52d40a[_0x2823('0x20')];var _0x218c90;if(_0x4e930b>=_0x3add2d){_0x4e930b=_0x3add2d;_0x218c90=0xc8;}else{_0x218c90=0xce;}_0xfb9024[_0x2823('0x1a')](_0x218c90);return _0xfb9024['set'](_0x2823('0x21'),_0x27b7f0+'-'+_0x4e930b+'/'+_0x3add2d)[_0x2823('0x1c')](_0x147f03);}return null;};}function patchUpdates(_0xe853a1){return function(_0x2b89f5){try{jsonpatch['apply'](_0x2b89f5,_0xe853a1,!![]);}catch(_0x13a7db){return BPromise[_0x2823('0x22')](_0x13a7db);}return _0x2b89f5[_0x2823('0x23')]();};}function saveUpdates(_0x5caf13,_0xd5e7fa){return function(_0x26d98c){if(_0x26d98c){return _0x26d98c['update'](_0x5caf13)[_0x2823('0x24')](function(_0x497b70){return _0x497b70;});}return null;};}function removeEntity(_0x1d747c,_0x87cb01){return function(_0x4c4641){if(_0x4c4641){return _0x4c4641[_0x2823('0x25')]()[_0x2823('0x24')](function(){_0x1d747c[_0x2823('0x1a')](0xcc)[_0x2823('0x1b')]();});}};}function handleEntityNotFound(_0x447ee,_0x388757){return function(_0x4c4738){if(!_0x4c4738){_0x447ee['sendStatus'](0x194);}return _0x4c4738;};}function handleError(_0x48ef26,_0x23deb5){_0x23deb5=_0x23deb5||0x1f4;return function(_0x109aeb){logger[_0x2823('0x26')](_0x109aeb[_0x2823('0x27')]);if(_0x109aeb[_0x2823('0x28')]){delete _0x109aeb[_0x2823('0x28')];}_0x48ef26[_0x2823('0x1a')](_0x23deb5)[_0x2823('0x29')](_0x109aeb);};}exports['index']=function(_0x2d2e4e,_0x3b64fb){var _0x62f6e9={},_0x4c4f82={},_0x45f784={'count':0x0,'rows':[]};var _0x5bc9a5=_[_0x2823('0x2a')](db[_0x2823('0x2b')][_0x2823('0x2c')],function(_0x4ab118){return{'name':_0x4ab118[_0x2823('0x2d')],'type':_0x4ab118['type'][_0x2823('0x2e')]};});_0x4c4f82[_0x2823('0x2f')]=_[_0x2823('0x2a')](_0x5bc9a5,_0x2823('0x28'));_0x4c4f82[_0x2823('0x30')]=_[_0x2823('0x31')](_0x2d2e4e['query']);_0x4c4f82[_0x2823('0x32')]=_[_0x2823('0x33')](_0x4c4f82['model'],_0x4c4f82[_0x2823('0x30')]);_0x62f6e9['attributes']=_[_0x2823('0x33')](_0x4c4f82[_0x2823('0x2f')],qs['fields'](_0x2d2e4e[_0x2823('0x30')][_0x2823('0x34')]));_0x62f6e9[_0x2823('0x35')]=_0x62f6e9['attributes'][_0x2823('0x36')]?_0x62f6e9[_0x2823('0x35')]:_0x4c4f82[_0x2823('0x2f')];if(!_0x2d2e4e[_0x2823('0x30')][_0x2823('0x37')]('nolimit')){_0x62f6e9['limit']=qs[_0x2823('0x20')](_0x2d2e4e[_0x2823('0x30')]['limit']);_0x62f6e9[_0x2823('0x1d')]=qs[_0x2823('0x1d')](_0x2d2e4e[_0x2823('0x30')][_0x2823('0x1d')]);}_0x62f6e9[_0x2823('0x38')]=qs[_0x2823('0x39')](_0x2d2e4e['query']['sort']);_0x62f6e9['where']=qs[_0x2823('0x32')](_[_0x2823('0x3a')](_0x2d2e4e[_0x2823('0x30')],_0x4c4f82['filters']),_0x5bc9a5);if(_0x2d2e4e[_0x2823('0x30')][_0x2823('0x3b')]){_0x62f6e9[_0x2823('0x3c')]=_['merge'](_0x62f6e9[_0x2823('0x3c')],{'$or':_[_0x2823('0x2a')](_0x5bc9a5,function(_0x42ca64){if(_0x42ca64[_0x2823('0x3d')]!==_0x2823('0x3e')){var _0x5dde79={};_0x5dde79[_0x42ca64[_0x2823('0x28')]]={'$like':'%'+_0x2d2e4e[_0x2823('0x30')][_0x2823('0x3b')]+'%'};return _0x5dde79;}})});}_0x62f6e9=_[_0x2823('0x3f')]({},_0x62f6e9,_0x2d2e4e[_0x2823('0x40')]);var _0x6b3649={'where':_0x62f6e9['where']};return db[_0x2823('0x2b')][_0x2823('0x1f')](_0x6b3649)[_0x2823('0x24')](function(_0x25c827){_0x45f784['count']=_0x25c827;if(_0x2d2e4e['query'][_0x2823('0x41')]){_0x62f6e9[_0x2823('0x42')]=[{'all':!![]}];}return db[_0x2823('0x2b')][_0x2823('0x43')](_0x62f6e9);})[_0x2823('0x24')](function(_0x254aa9){_0x45f784[_0x2823('0x44')]=_0x254aa9;return _0x45f784;})[_0x2823('0x24')](respondWithFilteredResult(_0x3b64fb,_0x62f6e9))['catch'](handleError(_0x3b64fb,null));};exports[_0x2823('0x45')]=function(_0x43f22e,_0x50cbd1){var _0x1bb215={'raw':!![],'where':{'id':_0x43f22e[_0x2823('0x46')]['id']}},_0x49112e={};_0x49112e['model']=_[_0x2823('0x31')](db[_0x2823('0x2b')][_0x2823('0x2c')]);_0x49112e[_0x2823('0x30')]=_[_0x2823('0x31')](_0x43f22e[_0x2823('0x30')]);_0x49112e['filters']=_[_0x2823('0x33')](_0x49112e[_0x2823('0x2f')],_0x49112e[_0x2823('0x30')]);_0x1bb215['attributes']=_[_0x2823('0x33')](_0x49112e['model'],qs[_0x2823('0x34')](_0x43f22e['query']['fields']));_0x1bb215['attributes']=_0x1bb215[_0x2823('0x35')][_0x2823('0x36')]?_0x1bb215[_0x2823('0x35')]:_0x49112e[_0x2823('0x2f')];if(_0x43f22e[_0x2823('0x30')][_0x2823('0x41')]){_0x1bb215[_0x2823('0x42')]=[{'all':!![]}];}_0x1bb215=_['merge']({},_0x1bb215,_0x43f22e[_0x2823('0x40')]);return db[_0x2823('0x2b')][_0x2823('0x47')](_0x1bb215)[_0x2823('0x24')](handleEntityNotFound(_0x50cbd1,null))['then'](respondWithResult(_0x50cbd1,null))['catch'](handleError(_0x50cbd1,null));};exports[_0x2823('0x48')]=function(_0x3324d4,_0x350df3){return db['OpenchannelTransferReport'][_0x2823('0x48')](_0x3324d4[_0x2823('0x49')],{})[_0x2823('0x24')](respondWithResult(_0x350df3,0xc9))['catch'](handleError(_0x350df3,null));};exports[_0x2823('0x4a')]=function(_0x21f347,_0x480999){if(_0x21f347[_0x2823('0x49')]['id']){delete _0x21f347[_0x2823('0x49')]['id'];}return db[_0x2823('0x2b')][_0x2823('0x47')]({'where':{'id':_0x21f347[_0x2823('0x46')]['id']}})[_0x2823('0x24')](handleEntityNotFound(_0x480999,null))['then'](saveUpdates(_0x21f347['body'],null))['then'](respondWithResult(_0x480999,null))['catch'](handleError(_0x480999,null));};exports['destroy']=function(_0x5c9690,_0x4aeac0){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5c9690['params']['id']}})[_0x2823('0x24')](handleEntityNotFound(_0x4aeac0,null))['then'](removeEntity(_0x4aeac0,null))[_0x2823('0x4b')](handleError(_0x4aeac0,null));};exports[_0x2823('0x4c')]=function(_0x2700ae,_0x3dadc8){return db['OpenchannelTransferReport'][_0x2823('0x4c')]()[_0x2823('0x24')](respondWithResult(_0x3dadc8,null))[_0x2823('0x4b')](handleError(_0x3dadc8,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e93e36d..1fdcd01 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 _0x2750=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x23d0b4,_0x245ed5){var _0x4c5562=function(_0x46c707){while(--_0x46c707){_0x23d0b4['push'](_0x23d0b4['shift']());}};_0x4c5562(++_0x245ed5);}(_0x2750,0x188));var _0x0275=function(_0x49dd23,_0x3d87e4){_0x49dd23=_0x49dd23-0x0;var _0x5b9d90=_0x2750[_0x49dd23];return _0x5b9d90;};'use strict';var _=require(_0x0275('0x0'));var util=require(_0x0275('0x1'));var logger=require(_0x0275('0x2'))(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var rp=require(_0x0275('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module['exports']=function(_0x5c6b46,_0x431e7e){return _0x5c6b46[_0x0275('0xa')](_0x0275('0xb'),attributes,{'tableName':_0x0275('0xc'),'paranoid':![],'indexes':[{'name':_0x0275('0xd'),'fields':[_0x0275('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d35=['moment','bluebird','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util'];(function(_0x430fd1,_0x33b890){var _0x107b78=function(_0xd5b5e9){while(--_0xd5b5e9){_0x430fd1['push'](_0x430fd1['shift']());}};_0x107b78(++_0x33b890);}(_0x1d35,0x77));var _0x51d3=function(_0x593838,_0x48fac1){_0x593838=_0x593838-0x0;var _0x3a9d9f=_0x1d35[_0x593838];return _0x3a9d9f;};'use strict';var _=require('lodash');var util=require(_0x51d3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x51d3('0x1'));var BPromise=require(_0x51d3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51d3('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51d3('0x4'));module[_0x51d3('0x5')]=function(_0x263e90,_0x2d766f){return _0x263e90[_0x51d3('0x6')](_0x51d3('0x7'),attributes,{'tableName':_0x51d3('0x8'),'paranoid':![],'indexes':[{'name':_0x51d3('0x9'),'fields':[_0x51d3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2e7fcd6..93873ca 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 _0x9576=['client','request','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x378fa0,_0x2fbd5d){var _0x396270=function(_0x3c610f){while(--_0x3c610f){_0x378fa0['push'](_0x378fa0['shift']());}};_0x396270(++_0x2fbd5d);}(_0x9576,0x182));var _0x6957=function(_0x46a376,_0x29af0b){_0x46a376=_0x46a376-0x0;var _0x2356fd=_0x9576[_0x46a376];return _0x2356fd;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6d8af8,_0x3425fe,_0x70b8c4){return new BPromise(function(_0x2e5727,_0x6397fe){return client[_0x6957('0xb')](_0x6d8af8,_0x70b8c4)['then'](function(_0x28a4c6){logger[_0x6957('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3425fe,'request\x20sent');logger[_0x6957('0xd')](_0x6957('0xe'),_0x3425fe,_0x6957('0xf'),JSON[_0x6957('0x10')](_0x28a4c6));if(_0x28a4c6[_0x6957('0x11')]){if(_0x28a4c6[_0x6957('0x11')][_0x6957('0x12')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3425fe,_0x28a4c6['error'][_0x6957('0x13')]);return _0x6397fe(_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);}logger[_0x6957('0x11')](_0x6957('0x14'),_0x3425fe,_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);return _0x2e5727(_0x28a4c6['error']['message']);}else{logger['info'](_0x6957('0x14'),_0x3425fe,_0x6957('0xf'));_0x2e5727(_0x28a4c6[_0x6957('0x15')][_0x6957('0x13')]);}})['catch'](function(_0x14422d){logger['error'](_0x6957('0x14'),_0x3425fe,_0x14422d);_0x6397fe(_0x14422d);});});} \ No newline at end of file +var _0x46fc=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x46fc,0x103));var _0xc46f=function(_0x13a9e8,_0x2abb1f){_0x13a9e8=_0x13a9e8-0x0;var _0x40b47c=_0x46fc[_0x13a9e8];return _0x40b47c;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var moment=require(_0xc46f('0x2'));var BPromise=require(_0xc46f('0x3'));var rs=require(_0xc46f('0x4'));var fs=require('fs');var Redis=require(_0xc46f('0x5'));var db=require(_0xc46f('0x6'))['db'];var utils=require(_0xc46f('0x7'));var logger=require(_0xc46f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46f('0x9'));var client=jayson[_0xc46f('0xa')][_0xc46f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15904c,_0x1f5ac8,_0x312101){return new BPromise(function(_0x155a10,_0x327019){return client[_0xc46f('0xc')](_0x15904c,_0x312101)[_0xc46f('0xd')](function(_0x1bd18f){logger[_0xc46f('0xe')](_0xc46f('0xf'),_0x1f5ac8,_0xc46f('0x10'));logger['debug'](_0xc46f('0x11'),_0x1f5ac8,_0xc46f('0x10'),JSON[_0xc46f('0x12')](_0x1bd18f));if(_0x1bd18f[_0xc46f('0x13')]){if(_0x1bd18f['error']['code']===0x1f4){logger['error'](_0xc46f('0xf'),_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')]['message']);return _0x327019(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);return _0x155a10(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f5ac8,'request\x20sent');_0x155a10(_0x1bd18f[_0xc46f('0x15')][_0xc46f('0x14')]);}})[_0xc46f('0x16')](function(_0x516238){logger[_0xc46f('0x13')](_0xc46f('0xf'),_0x1f5ac8,_0x516238);_0x327019(_0x516238);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 20cf8f1..f528156 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 _0xb522=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x35424f,_0x58b79f){var _0x380a86=function(_0x3ae8c8){while(--_0x3ae8c8){_0x35424f['push'](_0x35424f['shift']());}};_0x380a86(++_0x58b79f);}(_0xb522,0x1ce));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2b52('0x0'));var util=require('util');var path=require(_0x2b52('0x1'));var timeout=require(_0x2b52('0x2'));var express=require(_0x2b52('0x3'));var router=express[_0x2b52('0x4')]();var fs_extra=require(_0x2b52('0x5'));var auth=require(_0x2b52('0x6'));var interaction=require(_0x2b52('0x7'));var config=require(_0x2b52('0x8'));var controller=require('./pause.controller');router[_0x2b52('0x9')]('/',auth[_0x2b52('0xa')](),controller['index']);router[_0x2b52('0x9')](_0x2b52('0xb'),auth[_0x2b52('0xa')](),controller['show']);router['post']('/',auth[_0x2b52('0xa')](),controller[_0x2b52('0xc')]);router[_0x2b52('0xd')](_0x2b52('0xb'),auth[_0x2b52('0xa')](),controller[_0x2b52('0xe')]);router[_0x2b52('0xf')](_0x2b52('0xb'),auth[_0x2b52('0xa')](),controller[_0x2b52('0x10')]);module[_0x2b52('0x11')]=router; \ No newline at end of file +var _0x3727=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x52cc54,_0x5afce2){var _0x821686=function(_0x3d521a){while(--_0x3d521a){_0x52cc54['push'](_0x52cc54['shift']());}};_0x821686(++_0x5afce2);}(_0x3727,0xb5));var _0x7372=function(_0x1eaa90,_0x48328c){_0x1eaa90=_0x1eaa90-0x0;var _0x41b794=_0x3727[_0x1eaa90];return _0x41b794;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7372('0x0'));var timeout=require(_0x7372('0x1'));var express=require(_0x7372('0x2'));var router=express[_0x7372('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7372('0x4'));var interaction=require(_0x7372('0x5'));var config=require(_0x7372('0x6'));var controller=require('./pause.controller');router[_0x7372('0x7')]('/',auth[_0x7372('0x8')](),controller['index']);router[_0x7372('0x7')](_0x7372('0x9'),auth[_0x7372('0x8')](),controller[_0x7372('0xa')]);router[_0x7372('0xb')]('/',auth[_0x7372('0x8')](),controller[_0x7372('0xc')]);router[_0x7372('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7372('0xe')]);router[_0x7372('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7372('0x10')]);module[_0x7372('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 05df932..9c32883 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 _0xb351=['name','sequelize','exports','STRING'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0xb351,0x17d));var _0x1b35=function(_0x296666,_0xc1fb98){_0x296666=_0x296666-0x0;var _0x1278ef=_0xb351[_0x296666];return _0x1278ef;};'use strict';var Sequelize=require(_0x1b35('0x0'));module[_0x1b35('0x1')]={'name':{'type':Sequelize[_0x1b35('0x2')],'unique':_0x1b35('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1b35('0x2')]}}; \ No newline at end of file +var _0xa9c7=['name','STRING'];(function(_0x541d0c,_0x23c623){var _0x411744=function(_0x47fce9){while(--_0x47fce9){_0x541d0c['push'](_0x541d0c['shift']());}};_0x411744(++_0x23c623);}(_0xa9c7,0xd7));var _0x7a9c=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0xa9c7[_0x11d95f];return _0x2b1a14;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a9c('0x0')],'unique':_0x7a9c('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b21f336..f27aaf5 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 _0xcc3a=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','destroy','Pauses','error','stack','name','send','index','map','Pause','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x294f16,_0x4832d9){var _0x263204=function(_0x346be3){while(--_0x346be3){_0x294f16['push'](_0x294f16['shift']());}};_0x263204(++_0x4832d9);}(_0xcc3a,0x17a));var _0xacc3=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xcc3a[_0x287a47];return _0x3fb726;};'use strict';var emlformat=require(_0xacc3('0x0'));var rimraf=require(_0xacc3('0x1'));var zipdir=require(_0xacc3('0x2'));var jsonpatch=require(_0xacc3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xacc3('0x4'));var sox=require(_0xacc3('0x5'));var csv=require('to-csv');var ejs=require(_0xacc3('0x6'));var fs=require('fs');var fs_extra=require(_0xacc3('0x7'));var _=require('lodash');var squel=require(_0xacc3('0x8'));var crypto=require(_0xacc3('0x9'));var jsforce=require(_0xacc3('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xacc3('0xb'));var Papa=require(_0xacc3('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacc3('0xd'));var as=require(_0xacc3('0xe'));var hardwareService=require(_0xacc3('0xf'));var logger=require(_0xacc3('0x10'))(_0xacc3('0x11'));var utils=require('../../config/utils');var config=require(_0xacc3('0x12'));var licenseUtil=require(_0xacc3('0x13'));var db=require(_0xacc3('0x14'))['db'];function respondWithStatusCode(_0x498fe5,_0x448dc8){_0x448dc8=_0x448dc8||0xcc;return function(_0x10aa56){if(_0x10aa56){return _0x498fe5[_0xacc3('0x15')](_0x448dc8);}return _0x498fe5['status'](_0x448dc8)[_0xacc3('0x16')]();};}function respondWithResult(_0x2dc031,_0x4f113f){_0x4f113f=_0x4f113f||0xc8;return function(_0x553cb6){if(_0x553cb6){return _0x2dc031['status'](_0x4f113f)[_0xacc3('0x17')](_0x553cb6);}};}function respondWithFilteredResult(_0x2f380f,_0x11adeb){return function(_0x38c364){if(_0x38c364){var _0x5d357f=typeof _0x11adeb['offset']==='undefined'&&typeof _0x11adeb[_0xacc3('0x18')]===_0xacc3('0x19');var _0x3f8fb0=_0x38c364[_0xacc3('0x1a')];var _0x139e89=_0x5d357f?0x0:_0x11adeb['offset'];var _0x24ee4d=_0x5d357f?_0x38c364[_0xacc3('0x1a')]:_0x11adeb[_0xacc3('0x1b')]+_0x11adeb[_0xacc3('0x18')];var _0x4e27a0;if(_0x24ee4d>=_0x3f8fb0){_0x24ee4d=_0x3f8fb0;_0x4e27a0=0xc8;}else{_0x4e27a0=0xce;}_0x2f380f[_0xacc3('0x1c')](_0x4e27a0);return _0x2f380f['set'](_0xacc3('0x1d'),_0x139e89+'-'+_0x24ee4d+'/'+_0x3f8fb0)[_0xacc3('0x17')](_0x38c364);}return null;};}function patchUpdates(_0x3d4827){return function(_0x140ccb){try{jsonpatch[_0xacc3('0x1e')](_0x140ccb,_0x3d4827,!![]);}catch(_0x1fe633){return BPromise['reject'](_0x1fe633);}return _0x140ccb[_0xacc3('0x1f')]();};}function saveUpdates(_0x5a1a28,_0x1560e8){return function(_0x1294e5){if(_0x1294e5){return _0x1294e5[_0xacc3('0x20')](_0x5a1a28)[_0xacc3('0x21')](function(_0x4240ba){return _0x4240ba;});}return null;};}function removeEntity(_0x1badc5,_0x35c409){return function(_0x2f9a67){if(_0x2f9a67){return _0x2f9a67[_0xacc3('0x22')]()['then'](function(){var _0x46e5a1=_0x2f9a67['get']({'plain':!![]});var _0x57e2db=_0xacc3('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x57e2db,'resourceId':_0x46e5a1['id']}})['then'](function(){return _0x2f9a67;});})[_0xacc3('0x21')](function(){_0x1badc5[_0xacc3('0x1c')](0xcc)[_0xacc3('0x16')]();});}};}function handleEntityNotFound(_0x5590ae,_0x284767){return function(_0x545da9){if(!_0x545da9){_0x5590ae['sendStatus'](0x194);}return _0x545da9;};}function handleError(_0x4f3d3e,_0x1520d3){_0x1520d3=_0x1520d3||0x1f4;return function(_0x5c0e27){logger[_0xacc3('0x24')](_0x5c0e27[_0xacc3('0x25')]);if(_0x5c0e27[_0xacc3('0x26')]){delete _0x5c0e27[_0xacc3('0x26')];}_0x4f3d3e['status'](_0x1520d3)[_0xacc3('0x27')](_0x5c0e27);};}exports[_0xacc3('0x28')]=function(_0x2da619,_0x1c41c0){var _0xf32ca1={},_0x53505d={},_0x327087={'count':0x0,'rows':[]};var _0x5c980c=_[_0xacc3('0x29')](db[_0xacc3('0x2a')]['rawAttributes'],function(_0xc68627){return{'name':_0xc68627[_0xacc3('0x2b')],'type':_0xc68627[_0xacc3('0x2c')]['key']};});_0x53505d[_0xacc3('0x2d')]=_[_0xacc3('0x29')](_0x5c980c,_0xacc3('0x26'));_0x53505d['query']=_['keys'](_0x2da619[_0xacc3('0x2e')]);_0x53505d[_0xacc3('0x2f')]=_[_0xacc3('0x30')](_0x53505d[_0xacc3('0x2d')],_0x53505d[_0xacc3('0x2e')]);_0xf32ca1[_0xacc3('0x31')]=_['intersection'](_0x53505d[_0xacc3('0x2d')],qs[_0xacc3('0x32')](_0x2da619[_0xacc3('0x2e')][_0xacc3('0x32')]));_0xf32ca1[_0xacc3('0x31')]=_0xf32ca1[_0xacc3('0x31')]['length']?_0xf32ca1[_0xacc3('0x31')]:_0x53505d['model'];if(!_0x2da619['query'][_0xacc3('0x33')](_0xacc3('0x34'))){_0xf32ca1[_0xacc3('0x18')]=qs[_0xacc3('0x18')](_0x2da619[_0xacc3('0x2e')]['limit']);_0xf32ca1[_0xacc3('0x1b')]=qs[_0xacc3('0x1b')](_0x2da619['query']['offset']);}_0xf32ca1[_0xacc3('0x35')]=qs[_0xacc3('0x36')](_0x2da619[_0xacc3('0x2e')][_0xacc3('0x36')]);_0xf32ca1[_0xacc3('0x37')]=qs[_0xacc3('0x2f')](_[_0xacc3('0x38')](_0x2da619[_0xacc3('0x2e')],_0x53505d[_0xacc3('0x2f')]),_0x5c980c);if(_0x2da619[_0xacc3('0x2e')][_0xacc3('0x39')]){_0xf32ca1[_0xacc3('0x37')]=_[_0xacc3('0x3a')](_0xf32ca1[_0xacc3('0x37')],{'$or':_[_0xacc3('0x29')](_0x5c980c,function(_0x4ef7d1){if(_0x4ef7d1[_0xacc3('0x2c')]!=='VIRTUAL'){var _0x281c3f={};_0x281c3f[_0x4ef7d1[_0xacc3('0x26')]]={'$like':'%'+_0x2da619[_0xacc3('0x2e')][_0xacc3('0x39')]+'%'};return _0x281c3f;}})});}_0xf32ca1=_[_0xacc3('0x3a')]({},_0xf32ca1,_0x2da619[_0xacc3('0x3b')]);var _0x29a8db={'where':_0xf32ca1['where']};return db[_0xacc3('0x2a')][_0xacc3('0x1a')](_0x29a8db)[_0xacc3('0x21')](function(_0x14ddad){_0x327087[_0xacc3('0x1a')]=_0x14ddad;if(_0x2da619['query'][_0xacc3('0x3c')]){_0xf32ca1[_0xacc3('0x3d')]=[{'all':!![]}];}return db[_0xacc3('0x2a')][_0xacc3('0x3e')](_0xf32ca1);})[_0xacc3('0x21')](function(_0x55ec16){_0x327087[_0xacc3('0x3f')]=_0x55ec16;return _0x327087;})['then'](respondWithFilteredResult(_0x1c41c0,_0xf32ca1))['catch'](handleError(_0x1c41c0,null));};exports[_0xacc3('0x40')]=function(_0x334ff4,_0x598a29){var _0x163fa3={'raw':!![],'where':{'id':_0x334ff4['params']['id']}},_0x10c42b={};_0x10c42b[_0xacc3('0x2d')]=_[_0xacc3('0x41')](db[_0xacc3('0x2a')][_0xacc3('0x42')]);_0x10c42b['query']=_['keys'](_0x334ff4['query']);_0x10c42b[_0xacc3('0x2f')]=_[_0xacc3('0x30')](_0x10c42b[_0xacc3('0x2d')],_0x10c42b[_0xacc3('0x2e')]);_0x163fa3['attributes']=_[_0xacc3('0x30')](_0x10c42b[_0xacc3('0x2d')],qs[_0xacc3('0x32')](_0x334ff4[_0xacc3('0x2e')]['fields']));_0x163fa3['attributes']=_0x163fa3[_0xacc3('0x31')]['length']?_0x163fa3['attributes']:_0x10c42b[_0xacc3('0x2d')];if(_0x334ff4[_0xacc3('0x2e')][_0xacc3('0x3c')]){_0x163fa3[_0xacc3('0x3d')]=[{'all':!![]}];}_0x163fa3=_[_0xacc3('0x3a')]({},_0x163fa3,_0x334ff4['options']);return db[_0xacc3('0x2a')]['find'](_0x163fa3)[_0xacc3('0x21')](handleEntityNotFound(_0x598a29,null))['then'](respondWithResult(_0x598a29,null))['catch'](handleError(_0x598a29,null));};exports[_0xacc3('0x43')]=function(_0x36b69f,_0x203f66){return db[_0xacc3('0x2a')]['create'](_0x36b69f[_0xacc3('0x44')],{})[_0xacc3('0x21')](function(_0xe27388){var _0x2c3450=_0x36b69f[_0xacc3('0x45')][_0xacc3('0x46')]({'plain':!![]});if(!_0x2c3450)throw new Error(_0xacc3('0x47'));if(_0x2c3450['role']===_0xacc3('0x45')){var _0x732632=_0xe27388['get']({'plain':!![]});var _0x2d2c8f=_0xacc3('0x23');return db[_0xacc3('0x48')][_0xacc3('0x49')]({'where':{'name':_0x2d2c8f,'userProfileId':_0x2c3450[_0xacc3('0x4a')]},'raw':!![]})[_0xacc3('0x21')](function(_0x84028f){if(_0x84028f&&_0x84028f['autoAssociation']===0x0){return db[_0xacc3('0x4b')]['create']({'name':_0x732632[_0xacc3('0x26')],'resourceId':_0x732632['id'],'type':_0x84028f['name'],'sectionId':_0x84028f['id']},{})[_0xacc3('0x21')](function(){return _0xe27388;});}else{return _0xe27388;}})['catch'](function(_0x2cd5ea){logger[_0xacc3('0x24')](_0xacc3('0x4c'),_0x2cd5ea);throw _0x2cd5ea;});}return _0xe27388;})[_0xacc3('0x21')](respondWithResult(_0x203f66,0xc9))[_0xacc3('0x4d')](handleError(_0x203f66,null));};exports[_0xacc3('0x20')]=function(_0x45407d,_0x5e327c){if(_0x45407d[_0xacc3('0x44')]['id']){delete _0x45407d['body']['id'];}return db[_0xacc3('0x2a')][_0xacc3('0x49')]({'where':{'id':_0x45407d[_0xacc3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e327c,null))['then'](saveUpdates(_0x45407d[_0xacc3('0x44')],null))[_0xacc3('0x21')](respondWithResult(_0x5e327c,null))[_0xacc3('0x4d')](handleError(_0x5e327c,null));};exports[_0xacc3('0x22')]=function(_0x573b04,_0x2329fd){return db[_0xacc3('0x2a')][_0xacc3('0x49')]({'where':{'id':_0x573b04[_0xacc3('0x4e')]['id']}})[_0xacc3('0x21')](handleEntityNotFound(_0x2329fd,null))[_0xacc3('0x21')](removeEntity(_0x2329fd,null))[_0xacc3('0x4d')](handleError(_0x2329fd,null));}; \ No newline at end of file +var _0xc94d=['attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x29af3f,_0x48e915){var _0x1da5bb=function(_0x3c2905){while(--_0x3c2905){_0x29af3f['push'](_0x29af3f['shift']());}};_0x1da5bb(++_0x48e915);}(_0xc94d,0x108));var _0xdc94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc94d[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xdc94('0x0'));var rimraf=require(_0xdc94('0x1'));var zipdir=require(_0xdc94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc94('0x3'));var moment=require(_0xdc94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc94('0x5'));var util=require(_0xdc94('0x6'));var path=require('path');var sox=require(_0xdc94('0x7'));var csv=require(_0xdc94('0x8'));var ejs=require(_0xdc94('0x9'));var fs=require('fs');var fs_extra=require(_0xdc94('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc94('0xb'));var toCsv=require(_0xdc94('0x8'));var querystring=require(_0xdc94('0xc'));var Papa=require('papaparse');var Redis=require(_0xdc94('0xd'));var authService=require(_0xdc94('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdc94('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc94('0x10'))(_0xdc94('0x11'));var utils=require('../../config/utils');var config=require(_0xdc94('0x12'));var licenseUtil=require(_0xdc94('0x13'));var db=require(_0xdc94('0x14'))['db'];function respondWithStatusCode(_0x4246e6,_0xb574d9){_0xb574d9=_0xb574d9||0xcc;return function(_0x3266f4){if(_0x3266f4){return _0x4246e6[_0xdc94('0x15')](_0xb574d9);}return _0x4246e6['status'](_0xb574d9)[_0xdc94('0x16')]();};}function respondWithResult(_0x290746,_0x1f793a){_0x1f793a=_0x1f793a||0xc8;return function(_0xc372d3){if(_0xc372d3){return _0x290746[_0xdc94('0x17')](_0x1f793a)[_0xdc94('0x18')](_0xc372d3);}};}function respondWithFilteredResult(_0x24baf0,_0x56abf1){return function(_0x46884d){if(_0x46884d){var _0x597e9f=typeof _0x56abf1[_0xdc94('0x19')]===_0xdc94('0x1a')&&typeof _0x56abf1['limit']===_0xdc94('0x1a');var _0x42056f=_0x46884d['count'];var _0x223387=_0x597e9f?0x0:_0x56abf1[_0xdc94('0x19')];var _0x45be3c=_0x597e9f?_0x46884d[_0xdc94('0x1b')]:_0x56abf1['offset']+_0x56abf1['limit'];var _0x56f949;if(_0x45be3c>=_0x42056f){_0x45be3c=_0x42056f;_0x56f949=0xc8;}else{_0x56f949=0xce;}_0x24baf0[_0xdc94('0x17')](_0x56f949);return _0x24baf0[_0xdc94('0x1c')](_0xdc94('0x1d'),_0x223387+'-'+_0x45be3c+'/'+_0x42056f)[_0xdc94('0x18')](_0x46884d);}return null;};}function patchUpdates(_0xdb9fda){return function(_0x147932){try{jsonpatch['apply'](_0x147932,_0xdb9fda,!![]);}catch(_0x1fb7f6){return BPromise['reject'](_0x1fb7f6);}return _0x147932[_0xdc94('0x1e')]();};}function saveUpdates(_0x2e8ee0,_0xa218f6){return function(_0x420823){if(_0x420823){return _0x420823[_0xdc94('0x1f')](_0x2e8ee0)['then'](function(_0x51cba8){return _0x51cba8;});}return null;};}function removeEntity(_0x4fc326,_0x25d4e4){return function(_0x34e405){if(_0x34e405){return _0x34e405[_0xdc94('0x20')]()[_0xdc94('0x21')](function(){var _0x9c1f0a=_0x34e405[_0xdc94('0x22')]({'plain':!![]});var _0x230c1b=_0xdc94('0x23');return db[_0xdc94('0x24')][_0xdc94('0x20')]({'where':{'type':_0x230c1b,'resourceId':_0x9c1f0a['id']}})['then'](function(){return _0x34e405;});})['then'](function(){_0x4fc326[_0xdc94('0x17')](0xcc)[_0xdc94('0x16')]();});}};}function handleEntityNotFound(_0x570b85,_0x1dcc1b){return function(_0x2e8ef4){if(!_0x2e8ef4){_0x570b85[_0xdc94('0x15')](0x194);}return _0x2e8ef4;};}function handleError(_0x53b0fa,_0xc0ba1f){_0xc0ba1f=_0xc0ba1f||0x1f4;return function(_0x2c2bf6){logger[_0xdc94('0x25')](_0x2c2bf6['stack']);if(_0x2c2bf6['name']){delete _0x2c2bf6[_0xdc94('0x26')];}_0x53b0fa[_0xdc94('0x17')](_0xc0ba1f)[_0xdc94('0x27')](_0x2c2bf6);};}exports[_0xdc94('0x28')]=function(_0x3ebbdb,_0x61e786){var _0x5b0300={},_0x3aeda8={},_0x36f172={'count':0x0,'rows':[]};var _0x157650=_[_0xdc94('0x29')](db[_0xdc94('0x2a')][_0xdc94('0x2b')],function(_0x5c972e){return{'name':_0x5c972e[_0xdc94('0x2c')],'type':_0x5c972e[_0xdc94('0x2d')][_0xdc94('0x2e')]};});_0x3aeda8['model']=_[_0xdc94('0x29')](_0x157650,_0xdc94('0x26'));_0x3aeda8[_0xdc94('0x2f')]=_[_0xdc94('0x30')](_0x3ebbdb[_0xdc94('0x2f')]);_0x3aeda8[_0xdc94('0x31')]=_[_0xdc94('0x32')](_0x3aeda8[_0xdc94('0x33')],_0x3aeda8['query']);_0x5b0300[_0xdc94('0x34')]=_['intersection'](_0x3aeda8[_0xdc94('0x33')],qs[_0xdc94('0x35')](_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x35')]));_0x5b0300['attributes']=_0x5b0300[_0xdc94('0x34')][_0xdc94('0x36')]?_0x5b0300[_0xdc94('0x34')]:_0x3aeda8[_0xdc94('0x33')];if(!_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x37')]('nolimit')){_0x5b0300['limit']=qs[_0xdc94('0x38')](_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x38')]);_0x5b0300[_0xdc94('0x19')]=qs['offset'](_0x3ebbdb['query'][_0xdc94('0x19')]);}_0x5b0300[_0xdc94('0x39')]=qs[_0xdc94('0x3a')](_0x3ebbdb['query'][_0xdc94('0x3a')]);_0x5b0300[_0xdc94('0x3b')]=qs[_0xdc94('0x31')](_[_0xdc94('0x3c')](_0x3ebbdb[_0xdc94('0x2f')],_0x3aeda8[_0xdc94('0x31')]),_0x157650);if(_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x3d')]){_0x5b0300['where']=_[_0xdc94('0x3e')](_0x5b0300[_0xdc94('0x3b')],{'$or':_[_0xdc94('0x29')](_0x157650,function(_0x2d8975){if(_0x2d8975[_0xdc94('0x2d')]!=='VIRTUAL'){var _0x4e4bae={};_0x4e4bae[_0x2d8975[_0xdc94('0x26')]]={'$like':'%'+_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x3d')]+'%'};return _0x4e4bae;}})});}_0x5b0300=_[_0xdc94('0x3e')]({},_0x5b0300,_0x3ebbdb[_0xdc94('0x3f')]);var _0x491000={'where':_0x5b0300[_0xdc94('0x3b')]};return db['Pause'][_0xdc94('0x1b')](_0x491000)[_0xdc94('0x21')](function(_0x3b4e84){_0x36f172[_0xdc94('0x1b')]=_0x3b4e84;if(_0x3ebbdb[_0xdc94('0x2f')][_0xdc94('0x40')]){_0x5b0300[_0xdc94('0x41')]=[{'all':!![]}];}return db[_0xdc94('0x2a')]['findAll'](_0x5b0300);})['then'](function(_0x5094f7){_0x36f172[_0xdc94('0x42')]=_0x5094f7;return _0x36f172;})[_0xdc94('0x21')](respondWithFilteredResult(_0x61e786,_0x5b0300))[_0xdc94('0x43')](handleError(_0x61e786,null));};exports[_0xdc94('0x44')]=function(_0x7e574a,_0x2f49a6){var _0x51b2ba={'raw':!![],'where':{'id':_0x7e574a[_0xdc94('0x45')]['id']}},_0x44e290={};_0x44e290[_0xdc94('0x33')]=_['keys'](db['Pause'][_0xdc94('0x2b')]);_0x44e290['query']=_[_0xdc94('0x30')](_0x7e574a[_0xdc94('0x2f')]);_0x44e290['filters']=_['intersection'](_0x44e290[_0xdc94('0x33')],_0x44e290[_0xdc94('0x2f')]);_0x51b2ba['attributes']=_['intersection'](_0x44e290[_0xdc94('0x33')],qs[_0xdc94('0x35')](_0x7e574a[_0xdc94('0x2f')][_0xdc94('0x35')]));_0x51b2ba['attributes']=_0x51b2ba['attributes'][_0xdc94('0x36')]?_0x51b2ba[_0xdc94('0x34')]:_0x44e290[_0xdc94('0x33')];if(_0x7e574a['query'][_0xdc94('0x40')]){_0x51b2ba[_0xdc94('0x41')]=[{'all':!![]}];}_0x51b2ba=_['merge']({},_0x51b2ba,_0x7e574a[_0xdc94('0x3f')]);return db['Pause']['find'](_0x51b2ba)['then'](handleEntityNotFound(_0x2f49a6,null))[_0xdc94('0x21')](respondWithResult(_0x2f49a6,null))[_0xdc94('0x43')](handleError(_0x2f49a6,null));};exports[_0xdc94('0x46')]=function(_0x62fc53,_0x36a436){return db[_0xdc94('0x2a')]['create'](_0x62fc53['body'],{})['then'](function(_0x852bdc){var _0x102e83=_0x62fc53[_0xdc94('0x47')][_0xdc94('0x22')]({'plain':!![]});if(!_0x102e83)throw new Error(_0xdc94('0x48'));if(_0x102e83['role']===_0xdc94('0x47')){var _0x41756e=_0x852bdc[_0xdc94('0x22')]({'plain':!![]});var _0xc5d4ca='Pauses';return db[_0xdc94('0x49')][_0xdc94('0x4a')]({'where':{'name':_0xc5d4ca,'userProfileId':_0x102e83[_0xdc94('0x4b')]},'raw':!![]})[_0xdc94('0x21')](function(_0x2dec08){if(_0x2dec08&&_0x2dec08[_0xdc94('0x4c')]===0x0){return db[_0xdc94('0x24')][_0xdc94('0x46')]({'name':_0x41756e[_0xdc94('0x26')],'resourceId':_0x41756e['id'],'type':_0x2dec08['name'],'sectionId':_0x2dec08['id']},{})[_0xdc94('0x21')](function(){return _0x852bdc;});}else{return _0x852bdc;}})[_0xdc94('0x43')](function(_0x7384e2){logger['error'](_0xdc94('0x4d'),_0x7384e2);throw _0x7384e2;});}return _0x852bdc;})['then'](respondWithResult(_0x36a436,0xc9))['catch'](handleError(_0x36a436,null));};exports[_0xdc94('0x1f')]=function(_0x2a25ce,_0x2ca9aa){if(_0x2a25ce[_0xdc94('0x4e')]['id']){delete _0x2a25ce['body']['id'];}return db[_0xdc94('0x2a')][_0xdc94('0x4a')]({'where':{'id':_0x2a25ce[_0xdc94('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ca9aa,null))['then'](saveUpdates(_0x2a25ce['body'],null))[_0xdc94('0x21')](respondWithResult(_0x2ca9aa,null))['catch'](handleError(_0x2ca9aa,null));};exports[_0xdc94('0x20')]=function(_0x435924,_0x31f4b3){return db[_0xdc94('0x2a')][_0xdc94('0x4a')]({'where':{'id':_0x435924[_0xdc94('0x45')]['id']}})['then'](handleEntityNotFound(_0x31f4b3,null))[_0xdc94('0x21')](removeEntity(_0x31f4b3,null))[_0xdc94('0x43')](handleError(_0x31f4b3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4bba7e7..f3e85d2 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x7217,0x19e));var _0x7721=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7217[_0x4709c0];return _0x13348b;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 0876ae0..bfc9c38 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3e05d9,_0x269883){var _0x4cdfdd=function(_0x56b820){while(--_0x56b820){_0x3e05d9['push'](_0x3e05d9['shift']());}};_0x4cdfdd(++_0x269883);}(_0xb10b,0x12a));var _0xbb10=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb10b[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1e5729,_0x866465){var _0x316bd5=function(_0x4e8b9e){while(--_0x4e8b9e){_0x1e5729['push'](_0x1e5729['shift']());}};_0x316bd5(++_0x866465);}(_0xb10b,0x12a));var _0xbb10=function(_0x4935d3,_0x37bb5b){_0x4935d3=_0x4935d3-0x0;var _0x457d57=_0xb10b[_0x4935d3];return _0x457d57;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 681a87c..a04b36f 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 _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x1ba2c0,_0x2f4cc9){var _0x33f8ce=function(_0x284d17){while(--_0x284d17){_0x1ba2c0['push'](_0x1ba2c0['shift']());}};_0x33f8ce(++_0x2f4cc9);}(_0x4c4e,0x152));var _0xe4c4=function(_0xc9eaee,_0x51bb00){_0xc9eaee=_0xc9eaee-0x0;var _0x479b47=_0x4c4e[_0xc9eaee];return _0x479b47;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file +var _0xc978=['isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x1c4c7a,_0xfbb038){var _0x3b5477=function(_0x48b40b){while(--_0x48b40b){_0x1c4c7a['push'](_0x1c4c7a['shift']());}};_0x3b5477(++_0xfbb038);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0xa')]('/:id/download',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);var upload=multer({'storage':multer[_0x8c97('0x12')]({'destination':function(_0x3a34b2,_0x400eb6,_0x949a83){_0x949a83(null,path[_0x8c97('0x13')](config[_0x8c97('0x14')],_0x8c97('0x15')));},'filename':function(_0x5cf392,_0x44611a,_0x346274){_0x44611a['originalname']=_0x44611a[_0x8c97('0x16')][_0x8c97('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x346274(null,util['format'](_0x8c97('0x18'),path['basename'](_0x44611a['originalname'],path['extname'](_0x44611a[_0x8c97('0x16')])),Date[_0x8c97('0x19')](),path[_0x8c97('0x1a')](_0x44611a[_0x8c97('0x16')])));}})});router[_0x8c97('0x1b')]('/',upload[_0x8c97('0x1c')](_0x8c97('0x1d')),controller[_0x8c97('0x1e')]);router[_0x8c97('0x1b')]('/webhook',controller[_0x8c97('0x1f')]);router[_0x8c97('0x20')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x21')]);router[_0x8c97('0x22')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x22')]);module[_0x8c97('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ffbaee9..67abfac 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 _0xf17e=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x97a36e,_0x133ed2){var _0x3b0f44=function(_0x5cdc3b){while(--_0x5cdc3b){_0x97a36e['push'](_0x97a36e['shift']());}};_0x3b0f44(++_0x133ed2);}(_0xf17e,0x117));var _0xef17=function(_0x2cabc7,_0x989644){_0x2cabc7=_0x2cabc7-0x0;var _0x458522=_0xf17e[_0x2cabc7];return _0x458522;};'use strict';var Sequelize=require(_0xef17('0x0'));module['exports']={'name':{'type':Sequelize[_0xef17('0x1')]},'type':{'type':Sequelize['ENUM'](_0xef17('0x2'),_0xef17('0x3'))},'description':{'type':Sequelize[_0xef17('0x4')]},'version':{'type':Sequelize[_0xef17('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xef17('0x5')],'defaultValue':0x0,'comment':_0xef17('0x6')},'sidebar':{'type':Sequelize[_0xef17('0x7')](_0xef17('0x8'),'agentOnly',_0xef17('0x9'),_0xef17('0xa')),'defaultValue':_0xef17('0x9'),'comment':_0xef17('0xb')},'icon':{'type':Sequelize[_0xef17('0x1')]},'adminUrl':{'type':Sequelize[_0xef17('0x1')]},'agentUrl':{'type':Sequelize[_0xef17('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xef17('0x1')]}}; \ No newline at end of file +var _0x2984=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html'];(function(_0x1b6522,_0x2ce190){var _0xcc968c=function(_0x51df9c){while(--_0x51df9c){_0x1b6522['push'](_0x1b6522['shift']());}};_0xcc968c(++_0x2ce190);}(_0x2984,0xf9));var _0x4298=function(_0x5673c4,_0x5b672d){_0x5673c4=_0x5673c4-0x0;var _0x32b859=_0x2984[_0x5673c4];return _0x32b859;};'use strict';var Sequelize=require(_0x4298('0x0'));module[_0x4298('0x1')]={'name':{'type':Sequelize[_0x4298('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4298('0x3'),'script')},'description':{'type':Sequelize[_0x4298('0x4')]},'version':{'type':Sequelize[_0x4298('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x4298('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4298('0x6')](_0x4298('0x7'),_0x4298('0x8'),'always','never'),'defaultValue':_0x4298('0x9'),'comment':_0x4298('0xa')},'icon':{'type':Sequelize[_0x4298('0x2')]},'adminUrl':{'type':Sequelize[_0x4298('0x2')]},'agentUrl':{'type':Sequelize[_0x4298('0x2')]},'scriptName':{'type':Sequelize[_0x4298('0x2')]},'scriptPath':{'type':Sequelize[_0x4298('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d3e84e3..5e8fd17 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 _0xa9e3=['catch','show','params','keys','find','download','path','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','basename','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','agent','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','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','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Plugin','includeAll','include','rows'];(function(_0x5b9355,_0x57417c){var _0x4d09f4=function(_0x5171ba){while(--_0x5171ba){_0x5b9355['push'](_0x5b9355['shift']());}};_0x4d09f4(++_0x57417c);}(_0xa9e3,0x1ba));var _0x3a9e=function(_0x2bce0b,_0x3b5f2f){_0x2bce0b=_0x2bce0b-0x0;var _0x4e40c9=_0xa9e3[_0x2bce0b];return _0x4e40c9;};'use strict';var emlformat=require(_0x3a9e('0x0'));var rimraf=require(_0x3a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a9e('0x2'));var rp=require('request-promise');var moment=require(_0x3a9e('0x3'));var BPromise=require(_0x3a9e('0x4'));var Mustache=require('mustache');var util=require(_0x3a9e('0x5'));var path=require('path');var sox=require(_0x3a9e('0x6'));var csv=require(_0x3a9e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a9e('0x8'));var squel=require(_0x3a9e('0x9'));var crypto=require('crypto');var jsforce=require(_0x3a9e('0xa'));var deskjs=require(_0x3a9e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x3a9e('0xc'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x3a9e('0xd'));var authService=require(_0x3a9e('0xe'));var qs=require(_0x3a9e('0xf'));var as=require(_0x3a9e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a9e('0x11'))(_0x3a9e('0x12'));var utils=require(_0x3a9e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a9e('0x14'))['db'];config[_0x3a9e('0x15')]=_[_0x3a9e('0x16')](config[_0x3a9e('0x15')],{'host':_0x3a9e('0x17'),'port':0x18eb});var socket=require(_0x3a9e('0x18'))(new Redis(config[_0x3a9e('0x15')]));require(_0x3a9e('0x19'))[_0x3a9e('0x1a')](socket);function respondWithStatusCode(_0x33fccd,_0x3ec005){_0x3ec005=_0x3ec005||0xcc;return function(_0x5e7e5f){if(_0x5e7e5f){return _0x33fccd['sendStatus'](_0x3ec005);}return _0x33fccd[_0x3a9e('0x1b')](_0x3ec005)[_0x3a9e('0x1c')]();};}function respondWithResult(_0x953a2d,_0x44a43b){_0x44a43b=_0x44a43b||0xc8;return function(_0x207f40){if(_0x207f40){return _0x953a2d[_0x3a9e('0x1b')](_0x44a43b)[_0x3a9e('0x1d')](_0x207f40);}};}function respondWithFilteredResult(_0xf2426d,_0x50a17b){return function(_0x5dc4c3){if(_0x5dc4c3){var _0x1c4390=typeof _0x50a17b[_0x3a9e('0x1e')]==='undefined'&&typeof _0x50a17b[_0x3a9e('0x1f')]===_0x3a9e('0x20');var _0x2462c0=_0x5dc4c3[_0x3a9e('0x21')];var _0x3a73f1=_0x1c4390?0x0:_0x50a17b['offset'];var _0x571077=_0x1c4390?_0x5dc4c3[_0x3a9e('0x21')]:_0x50a17b[_0x3a9e('0x1e')]+_0x50a17b[_0x3a9e('0x1f')];var _0x56d1e4;if(_0x571077>=_0x2462c0){_0x571077=_0x2462c0;_0x56d1e4=0xc8;}else{_0x56d1e4=0xce;}_0xf2426d['status'](_0x56d1e4);return _0xf2426d[_0x3a9e('0x22')](_0x3a9e('0x23'),_0x3a73f1+'-'+_0x571077+'/'+_0x2462c0)['json'](_0x5dc4c3);}return null;};}function patchUpdates(_0x43bb95){return function(_0x1aa2f2){try{jsonpatch[_0x3a9e('0x24')](_0x1aa2f2,_0x43bb95,!![]);}catch(_0x1e8008){return BPromise[_0x3a9e('0x25')](_0x1e8008);}return _0x1aa2f2[_0x3a9e('0x26')]();};}function saveUpdates(_0x30e043,_0xed0e37){return function(_0x41fc2e){if(_0x41fc2e){return _0x41fc2e[_0x3a9e('0x27')](_0x30e043)[_0x3a9e('0x28')](function(_0x7b91c2){return _0x7b91c2;});}return null;};}function removeEntity(_0xb4c3aa,_0x4c16ed){return function(_0x4e89dc){if(_0x4e89dc){return _0x4e89dc['destroy']()['then'](function(){var _0x34bd18=_0x4e89dc[_0x3a9e('0x29')]({'plain':!![]});var _0x28cb04=_0x3a9e('0x2a');return db[_0x3a9e('0x2b')]['destroy']({'where':{'type':_0x28cb04,'resourceId':_0x34bd18['id']}})[_0x3a9e('0x28')](function(){return _0x4e89dc;});})[_0x3a9e('0x28')](function(){_0xb4c3aa[_0x3a9e('0x1b')](0xcc)[_0x3a9e('0x1c')]();});}};}function handleEntityNotFound(_0x327555,_0x39e3b2){return function(_0x4b10db){if(!_0x4b10db){_0x327555[_0x3a9e('0x2c')](0x194);}return _0x4b10db;};}function handleError(_0xf1846b,_0x33867d){_0x33867d=_0x33867d||0x1f4;return function(_0x7fe8b7){logger[_0x3a9e('0x2d')](_0x7fe8b7[_0x3a9e('0x2e')]);if(_0x7fe8b7[_0x3a9e('0x2f')]){delete _0x7fe8b7[_0x3a9e('0x2f')];}_0xf1846b[_0x3a9e('0x1b')](_0x33867d)[_0x3a9e('0x30')](_0x7fe8b7);};}exports[_0x3a9e('0x31')]=function(_0x550a80,_0x1556a4){var _0x45c322={},_0x18ad34={},_0x309ee3={'count':0x0,'rows':[]};var _0x208577=_[_0x3a9e('0x32')](db['Plugin'][_0x3a9e('0x33')],function(_0x251c37){return{'name':_0x251c37['fieldName'],'type':_0x251c37[_0x3a9e('0x34')][_0x3a9e('0x35')]};});_0x18ad34[_0x3a9e('0x36')]=_[_0x3a9e('0x32')](_0x208577,_0x3a9e('0x2f'));_0x18ad34[_0x3a9e('0x37')]=_['keys'](_0x550a80[_0x3a9e('0x37')]);_0x18ad34[_0x3a9e('0x38')]=_['intersection'](_0x18ad34[_0x3a9e('0x36')],_0x18ad34[_0x3a9e('0x37')]);_0x45c322['attributes']=_[_0x3a9e('0x39')](_0x18ad34[_0x3a9e('0x36')],qs[_0x3a9e('0x3a')](_0x550a80[_0x3a9e('0x37')]['fields']));_0x45c322[_0x3a9e('0x3b')]=_0x45c322[_0x3a9e('0x3b')][_0x3a9e('0x3c')]?_0x45c322[_0x3a9e('0x3b')]:_0x18ad34[_0x3a9e('0x36')];if(!_0x550a80['query']['hasOwnProperty'](_0x3a9e('0x3d'))){_0x45c322['limit']=qs[_0x3a9e('0x1f')](_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x1f')]);_0x45c322[_0x3a9e('0x1e')]=qs[_0x3a9e('0x1e')](_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x1e')]);}_0x45c322[_0x3a9e('0x3e')]=qs[_0x3a9e('0x3f')](_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x3f')]);_0x45c322[_0x3a9e('0x40')]=qs[_0x3a9e('0x38')](_[_0x3a9e('0x41')](_0x550a80[_0x3a9e('0x37')],_0x18ad34[_0x3a9e('0x38')]),_0x208577);if(_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x42')]){_0x45c322[_0x3a9e('0x40')]=_['merge'](_0x45c322[_0x3a9e('0x40')],{'$or':_['map'](_0x208577,function(_0x546eba){if(_0x546eba[_0x3a9e('0x34')]!==_0x3a9e('0x43')){var _0x53cafe={};_0x53cafe[_0x546eba['name']]={'$like':'%'+_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x42')]+'%'};return _0x53cafe;}})});}_0x45c322=_[_0x3a9e('0x44')]({},_0x45c322,_0x550a80[_0x3a9e('0x45')]);var _0x6f3476={'where':_0x45c322[_0x3a9e('0x40')]};return db[_0x3a9e('0x46')][_0x3a9e('0x21')](_0x6f3476)[_0x3a9e('0x28')](function(_0x274a4f){_0x309ee3[_0x3a9e('0x21')]=_0x274a4f;if(_0x550a80[_0x3a9e('0x37')][_0x3a9e('0x47')]){_0x45c322[_0x3a9e('0x48')]=[{'all':!![]}];}return db[_0x3a9e('0x46')]['findAll'](_0x45c322);})[_0x3a9e('0x28')](function(_0x2e0b12){_0x309ee3[_0x3a9e('0x49')]=_0x2e0b12;return _0x309ee3;})[_0x3a9e('0x28')](respondWithFilteredResult(_0x1556a4,_0x45c322))[_0x3a9e('0x4a')](handleError(_0x1556a4,null));};exports[_0x3a9e('0x4b')]=function(_0x4361e2,_0x512695){var _0x1d8584={'raw':!![],'where':{'id':_0x4361e2[_0x3a9e('0x4c')]['id']}},_0x12f8ff={};_0x12f8ff[_0x3a9e('0x36')]=_[_0x3a9e('0x4d')](db[_0x3a9e('0x46')]['rawAttributes']);_0x12f8ff[_0x3a9e('0x37')]=_[_0x3a9e('0x4d')](_0x4361e2['query']);_0x12f8ff['filters']=_[_0x3a9e('0x39')](_0x12f8ff['model'],_0x12f8ff[_0x3a9e('0x37')]);_0x1d8584[_0x3a9e('0x3b')]=_[_0x3a9e('0x39')](_0x12f8ff[_0x3a9e('0x36')],qs[_0x3a9e('0x3a')](_0x4361e2[_0x3a9e('0x37')][_0x3a9e('0x3a')]));_0x1d8584[_0x3a9e('0x3b')]=_0x1d8584[_0x3a9e('0x3b')]['length']?_0x1d8584['attributes']:_0x12f8ff[_0x3a9e('0x36')];if(_0x4361e2[_0x3a9e('0x37')][_0x3a9e('0x47')]){_0x1d8584['include']=[{'all':!![]}];}_0x1d8584=_[_0x3a9e('0x44')]({},_0x1d8584,_0x4361e2[_0x3a9e('0x45')]);return db[_0x3a9e('0x46')][_0x3a9e('0x4e')](_0x1d8584)['then'](handleEntityNotFound(_0x512695,null))[_0x3a9e('0x28')](respondWithResult(_0x512695,null))[_0x3a9e('0x4a')](handleError(_0x512695,null));};exports[_0x3a9e('0x4f')]=function(_0x3c4b68,_0x3b6f1d,_0x24940e){return db[_0x3a9e('0x46')][_0x3a9e('0x4e')]({'where':{'id':_0x3c4b68[_0x3a9e('0x4c')]['id']},'attributes':[_0x3a9e('0x2f'),_0x3a9e('0x50')],'raw':!![]})[_0x3a9e('0x28')](handleEntityNotFound(_0x3b6f1d,null))[_0x3a9e('0x28')](function(_0x13548f){if(_0x13548f){var _0xc37260=path[_0x3a9e('0x51')](config[_0x3a9e('0x52')],_0x3a9e('0x53'),util[_0x3a9e('0x54')](_0x3a9e('0x55'),path['basename'](_0x13548f[_0x3a9e('0x50')])));var _0x2b42ed=fs[_0x3a9e('0x56')](_0xc37260);var _0x272b3a=archiver(_0x3a9e('0x57'),{'zlib':{'level':0x9}});_0x272b3a['on'](_0x3a9e('0x58'),function(_0x1cc97f){if(_0x1cc97f[_0x3a9e('0x59')]===_0x3a9e('0x5a')){logger[_0x3a9e('0x2d')](_0x1cc97f);}else{throw new db['Sequelize']['Error'](_0x3a9e('0x5b'));}});_0x272b3a['on'](_0x3a9e('0x2d'),function(_0x5d0048){throw new db[(_0x3a9e('0x5c'))][(_0x3a9e('0x5d'))](_0x3a9e('0x5b'));});_0x272b3a[_0x3a9e('0x5e')](_0x2b42ed);_0x272b3a[_0x3a9e('0x5f')](_0x3a9e('0x60'),{'cwd':path[_0x3a9e('0x51')](config[_0x3a9e('0x52')],'server/files/plugins',path[_0x3a9e('0x61')](_0x13548f[_0x3a9e('0x50')])),'ignore':[path[_0x3a9e('0x51')](path[_0x3a9e('0x62')](_0x13548f[_0x3a9e('0x50')]),_0x3a9e('0x63')),path[_0x3a9e('0x51')](path[_0x3a9e('0x62')](_0x13548f['path']),'attachments/**/*')],'nodir':!![]})[_0x3a9e('0x64')]();_0x2b42ed['on'](_0x3a9e('0x65'),function(){if(!fs[_0x3a9e('0x66')](_0xc37260)){throw new db[(_0x3a9e('0x5c'))][(_0x3a9e('0x5d'))](_0x3a9e('0x67'));}return _0x3b6f1d[_0x3a9e('0x4f')](_0xc37260,util[_0x3a9e('0x54')](_0x3a9e('0x55'),path[_0x3a9e('0x62')](_0x13548f['path'])),function(_0x50e781){if(_0x50e781){throw new db['Sequelize'][(_0x3a9e('0x5d'))](_0x3a9e('0x68'));}fs[_0x3a9e('0x69')](_0xc37260);logger[_0x3a9e('0x6a')]('Download\x20completed');logger['info'](_0x3a9e('0x6b'));});});}return null;})[_0x3a9e('0x4a')](handleError(_0x3b6f1d,null));};exports[_0x3a9e('0x6c')]=function(_0x1f5469,_0xf51368,_0x22699e){var _0x94916=path['basename'](_0x1f5469[_0x3a9e('0x6d')][_0x3a9e('0x6e')],path[_0x3a9e('0x6f')](_0x1f5469['file'][_0x3a9e('0x6e')]));var _0x6cd710=path[_0x3a9e('0x51')](config[_0x3a9e('0x52')],_0x3a9e('0x53'),_0x1f5469['file']['filename']);var _0x11ad50=path[_0x3a9e('0x51')](config[_0x3a9e('0x52')],_0x3a9e('0x53'),_0x94916);logger[_0x3a9e('0x6a')](_0x3a9e('0x70'),_0x6cd710);logger[_0x3a9e('0x6a')](_0x3a9e('0x71'),_0x11ad50);try{fs[_0x3a9e('0x72')](_0x6cd710,parseInt(_0x3a9e('0x73'),0x8));extract(_0x6cd710,{'dir':_0x11ad50},function(_0x483d62){if(_0x483d62){logger['error'](_0x483d62);handleError(_0x483d62,!![]);};var _0x122e30=fs[_0x3a9e('0x74')](_0x11ad50);if(_0x122e30['length']>0x1){removeReferences(_0x6cd710,_0x11ad50);logger[_0x3a9e('0x2d')](_0x3a9e('0x75'));return _0x22699e(new Error('Invalid\x20plugin\x20structure'));}var _0x173a12=fs[_0x3a9e('0x76')](path['join'](_0x11ad50,_0x122e30[0x0]));if(_0x173a12[_0x3a9e('0x77')]()){removeReferences(_0x6cd710,_0x11ad50);logger[_0x3a9e('0x2d')](_0x3a9e('0x75'));return _0x22699e(new Error(_0x3a9e('0x75')));}if(_0x173a12[_0x3a9e('0x78')]()){var _0x47d882=fs['readdirSync'](path[_0x3a9e('0x51')](_0x11ad50,_0x122e30[0x0]));if(_0x47d882[_0x3a9e('0x3c')]===0x0){removeReferences(_0x6cd710,_0x11ad50);logger[_0x3a9e('0x2d')](_0x3a9e('0x75'));return _0x22699e(new Error('Invalid\x20plugin\x20structure'));}var _0x5ab102=_0x47d882[_0x3a9e('0x79')](function(_0x40d463){return _0x40d463===_0x3a9e('0x7a');});if(!_0x5ab102){return _0x22699e(new Error('Plugin\x20manifest\x20missing'));}var _0x5474f5=fs['readFileSync'](path['join'](_0x11ad50,_0x122e30[0x0],_0x3a9e('0x7a')));var _0x820a41=JSON[_0x3a9e('0x7b')](_0x5474f5);if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x2f')]){return _0x22699e(new Error(_0x3a9e('0x7c')));}if(_0x3a9e('0x20')==typeof _0x820a41['type']){return _0x22699e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7d')]){return _0x22699e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')]){return _0x22699e(new Error(_0x3a9e('0x7f')));}if(_0x820a41[_0x3a9e('0x34')]===_0x3a9e('0x80')){if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')]['views']){return _0x22699e(new Error(_0x3a9e('0x81')));}if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x83')]&&_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')]['agent']){return _0x22699e(new Error(_0x3a9e('0x84')));}}else if(_0x820a41[_0x3a9e('0x34')]===_0x3a9e('0x85')){if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x86')]){return _0x22699e(new Error(_0x3a9e('0x87')));}if(_0x3a9e('0x20')==typeof _0x820a41[_0x3a9e('0x7e')]['scriptPath']){return _0x22699e(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x22699e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2cac70=_0x820a41[_0x3a9e('0x2f')];var _0xc28c96=_0x820a41['description'];var _0x1ec7be=_0x820a41[_0x3a9e('0x34')];var _0x49ba35=_0x820a41['sidebar']?_0x820a41[_0x3a9e('0x88')]:_0x3a9e('0x89');var _0x58d874=_0x820a41[_0x3a9e('0x8a')]?_0x820a41['icon']:_0x3a9e('0x8b');var _0x781105='';var _0xc5c234='';var _0x30d32b='';var _0x2f6b42='';var _0x2ceaf9=_0x820a41[_0x3a9e('0x7d')];if(_0x1ec7be==='html'){if(_0x3a9e('0x20')!=typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x83')]){var _0x4bf60f=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x3a9e('0x8c')](_0x4bf60f)){_0x781105=path[_0x3a9e('0x51')]('plugins',_0x94916,_0x122e30[0x0],_0x4bf60f);}else{_0x781105=_0x4bf60f;}}else{logger[_0x3a9e('0x6a')](_0x3a9e('0x8d'));}if(_0x3a9e('0x20')!=typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')]['agent']){var _0x249f85=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3a9e('0x8c')](_0x249f85)){_0xc5c234=path['join'](_0x3a9e('0x8e'),_0x94916,_0x122e30[0x0],_0x249f85);}else{_0xc5c234=_0x249f85;}}else{logger[_0x3a9e('0x6a')](_0x3a9e('0x8f'));}}else if(_0x1ec7be===_0x3a9e('0x85')){_0x30d32b=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x86')];_0x2f6b42=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x90')];if(_0x3a9e('0x20')!=typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')]){if('undefined'!=typeof _0x820a41[_0x3a9e('0x7e')]['views']['admin']){var _0x4bf60f=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x3a9e('0x8c')](_0x4bf60f)){_0x781105=path['join']('plugins',_0x94916,_0x122e30[0x0],_0x4bf60f);}else{_0x781105=_0x4bf60f;}}if(_0x3a9e('0x20')!=typeof _0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x91')]){var _0x249f85=_0x820a41[_0x3a9e('0x7e')][_0x3a9e('0x82')][_0x3a9e('0x91')];if(!/^(f|ht)tps?:\/\//i[_0x3a9e('0x8c')](_0x249f85)){_0xc5c234=path[_0x3a9e('0x51')](_0x3a9e('0x8e'),_0x94916,_0x122e30[0x0],_0x249f85);}else{_0xc5c234=_0x249f85;}}}}var _0x435364={'name':_0x2cac70,'description':_0xc28c96,'path':path[_0x3a9e('0x51')](_0x94916,_0x122e30[0x0]),'type':_0x1ec7be,'sidebar':_0x49ba35,'icon':_0x58d874,'adminUrl':_0x781105,'agentUrl':_0xc5c234,'scriptName':_0x30d32b,'scriptPath':_0x2f6b42,'version':_0x2ceaf9};removeReferences(_0x6cd710,null);return db[_0x3a9e('0x46')]['create'](_0x435364)['then'](function(_0x302a6b){var _0x3f7b6b={'role':_0x1f5469[_0x3a9e('0x92')]['role'],'userProfileId':_0x1f5469[_0x3a9e('0x92')][_0x3a9e('0x93')]};if(!_0x3f7b6b)throw new Error(_0x3a9e('0x94'));if(_0x3f7b6b[_0x3a9e('0x95')]===_0x3a9e('0x96')){var _0x171aa6=_0x302a6b[_0x3a9e('0x29')]({'plain':!![]});return db[_0x3a9e('0x97')][_0x3a9e('0x4e')]({'where':{'name':_0x3a9e('0x2a'),'userProfileId':_0x3f7b6b[_0x3a9e('0x93')]},'raw':!![]})[_0x3a9e('0x28')](function(_0x4c35a9){if(_0x4c35a9&&_0x4c35a9[_0x3a9e('0x98')]===0x0){return db[_0x3a9e('0x2b')][_0x3a9e('0x99')]({'name':_0x171aa6['name'],'resourceId':_0x171aa6['id'],'type':_0x4c35a9['name'],'sectionId':_0x4c35a9['id']},{})[_0x3a9e('0x28')](function(){return _0x302a6b;});}else{return _0x302a6b;}})['catch'](function(_0x3f3a84){logger[_0x3a9e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f3a84);throw _0x3f3a84;});}return _0x302a6b;})['then'](respondWithResult(_0xf51368,null))[_0x3a9e('0x4a')](handleError(_0xf51368,null));}});}catch(_0x48352c){_0xf51368[_0x3a9e('0x1b')](0x1f4)[_0x3a9e('0x30')](_0x48352c);}};function removeReferences(_0x1d6edf,_0x4c74df){try{if(_0x1d6edf){fs['unlinkSync'](_0x1d6edf);logger[_0x3a9e('0x6a')](_0x3a9e('0x9a'));}if(_0x4c74df){rimraf(_0x4c74df,function(){});logger[_0x3a9e('0x6a')](_0x3a9e('0x9b'));}}catch(_0x9190aa){logger['error'](_0x9190aa);}}exports[_0x3a9e('0x27')]=function(_0x682d02,_0x5d20f8,_0x4ab557){return db[_0x3a9e('0x46')]['find']({'where':{'id':_0x682d02[_0x3a9e('0x4c')]['id']}})[_0x3a9e('0x28')](handleEntityNotFound(_0x5d20f8,null))['then'](saveUpdates(_0x682d02[_0x3a9e('0x92')],null))[_0x3a9e('0x28')](respondWithResult(_0x5d20f8,null))[_0x3a9e('0x4a')](handleError(_0x5d20f8,null));};exports['delete']=function(_0x39f1b4,_0xcfa11f,_0x5d5467){return db[_0x3a9e('0x46')]['find']({'where':{'id':_0x39f1b4[_0x3a9e('0x4c')]['id']}})[_0x3a9e('0x28')](function(_0x42dce6){if(_0x42dce6){return _0x42dce6['destroy']();}})[_0x3a9e('0x28')](function(_0xab9e84){rimraf(path[_0x3a9e('0x51')](config[_0x3a9e('0x52')],_0x3a9e('0x53'),path[_0x3a9e('0x61')](_0xab9e84[_0x3a9e('0x50')])),function(){});return _0xab9e84;})['then'](handleEntityNotFound(_0xcfa11f,null))[_0x3a9e('0x28')](respondWithStatusCode(_0xcfa11f,null))[_0x3a9e('0x4a')](handleError(_0xcfa11f,null));};exports[_0x3a9e('0x9c')]=function(_0x2b2766,_0x2ddc32,_0x5974a3){return BPromise[_0x3a9e('0x9d')]()[_0x3a9e('0x28')](function(){if(!_0x2b2766[_0x3a9e('0x37')][_0x3a9e('0x50')]){throw new Error(_0x3a9e('0x9e'));}if(!_0x2b2766[_0x3a9e('0x37')][_0x3a9e('0x9f')]){throw new Error(_0x3a9e('0xa0'));}var _0x1e7129=_0x2b2766['query'][_0x3a9e('0xa1')]?_0x2b2766[_0x3a9e('0x37')]['hostname']+':'+_0x2b2766[_0x3a9e('0x37')]['port']:_0x3a9e('0xa2')+_0x2b2766[_0x3a9e('0x37')][_0x3a9e('0x9f')];var _0x1d9afe=_0x2b2766[_0x3a9e('0x37')][_0x3a9e('0x1d')]?_0x2b2766['query']['json']:!![];var _0x130059=_0x2b2766[_0x3a9e('0x37')][_0x3a9e('0xa3')]?_0x2b2766['query'][_0x3a9e('0xa3')]:null;var _0x436e83={'method':_0x2b2766[_0x3a9e('0xa4')],'uri':util['format'](_0x3a9e('0xa5'),_0x1e7129,_0x2b2766['query'][_0x3a9e('0x50')]),'json':_0x1d9afe,'resolveWithFullResponse':!![],'encoding':_0x130059,'qs':_0x2b2766[_0x3a9e('0x37')]};if(_0x2b2766[_0x3a9e('0xa6')]){_0x436e83[_0x3a9e('0xa6')]=_0x2b2766[_0x3a9e('0xa6')];if(_0x436e83[_0x3a9e('0xa6')][_0x3a9e('0xa7')]){delete _0x436e83[_0x3a9e('0xa6')]['content-length'];}}if(_0x436e83[_0x3a9e('0xa6')]['content-type']){delete _0x436e83['headers'][_0x3a9e('0xa8')];}return rp(_0x436e83);})[_0x3a9e('0x28')](function(_0xe41f52){if(_0xe41f52){_0x2ddc32[_0x3a9e('0x22')](_0xe41f52['headers']);logger[_0x3a9e('0x6a')](_0xe41f52[_0x3a9e('0x92')]);if(_[_0x3a9e('0xa9')](_0x2b2766['query']['path'],_0x3a9e('0x4f'))&&_0xe41f52['statusCode']==0x1f4){return _0x2ddc32['sendStatus'](_0xe41f52['statusCode']);}else{return _0x2ddc32['status'](_0xe41f52[_0x3a9e('0xaa')])[_0x3a9e('0x30')](_0xe41f52[_0x3a9e('0x92')]);}}else{return _0x2ddc32[_0x3a9e('0x2c')](0xc8);}})['catch'](handleError(_0x2ddc32,null));};exports[_0x3a9e('0xab')]=function(_0x5dbf53,_0x57fb7e,_0x29db42){return BPromise['resolve']()[_0x3a9e('0x28')](function(){if(!_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x50')]){throw new Error(_0x3a9e('0x9e'));}if(!_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x9f')]){throw new Error(_0x3a9e('0xa0'));}var _0x4e81c7=_0x5dbf53[_0x3a9e('0x37')]['hostname']?_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0xa1')]+':'+_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x9f')]:_0x3a9e('0xa2')+_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x9f')];var _0x50e04d=_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x1d')]?_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x1d')]:!![];var _0x1ce17d=_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0xa3')]?_0x5dbf53[_0x3a9e('0x37')]['encoding']:null;var _0x18725f={'method':_0x5dbf53[_0x3a9e('0xa4')],'uri':util['format']('%s%s',_0x4e81c7,_0x5dbf53[_0x3a9e('0x37')][_0x3a9e('0x50')]),'json':_0x50e04d,'resolveWithFullResponse':!![],'encoding':_0x1ce17d,'body':_0x5dbf53['body']};if(_0x5dbf53[_0x3a9e('0xa6')]){_0x18725f[_0x3a9e('0xa6')]=_0x5dbf53['headers'];if(_0x18725f[_0x3a9e('0xa6')][_0x3a9e('0xa7')]){delete _0x18725f[_0x3a9e('0xa6')][_0x3a9e('0xa7')];}}if(_0x18725f[_0x3a9e('0xa6')]['content-type']){delete _0x18725f['headers'][_0x3a9e('0xa8')];}return rp(_0x18725f);})[_0x3a9e('0x28')](function(_0x1313ba){if(_0x1313ba){_0x57fb7e[_0x3a9e('0x22')](_0x1313ba[_0x3a9e('0xa6')]);logger['info'](_0x1313ba[_0x3a9e('0x92')]);return _0x57fb7e[_0x3a9e('0x1b')](_0x1313ba[_0x3a9e('0xaa')])['send'](_0x1313ba['body']);}else{return _0x57fb7e[_0x3a9e('0x2c')](0xc8);}})['catch'](handleError(_0x57fb7e,null));}; \ No newline at end of file +var _0x0053=['order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','findAll','rows','catch','show','params','includeAll','include','find','download','join','root','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','parameters','html','Invalid\x20manifest:\x20views\x20missing','admin','views','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x524ce0,_0x3670b2){var _0x38299f=function(_0x513ef4){while(--_0x513ef4){_0x524ce0['push'](_0x524ce0['shift']());}};_0x38299f(++_0x3670b2);}(_0x0053,0x1b2));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3005('0x0'));var rimraf=require(_0x3005('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3005('0x2'));var BPromise=require(_0x3005('0x3'));var Mustache=require('mustache');var util=require(_0x3005('0x4'));var path=require(_0x3005('0x5'));var sox=require(_0x3005('0x6'));var csv=require(_0x3005('0x7'));var ejs=require(_0x3005('0x8'));var fs=require('fs');var fs_extra=require(_0x3005('0x9'));var _=require(_0x3005('0xa'));var squel=require(_0x3005('0xb'));var crypto=require(_0x3005('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3005('0xd'));var toCsv=require(_0x3005('0x7'));var querystring=require(_0x3005('0xe'));var Papa=require(_0x3005('0xf'));var extract=require(_0x3005('0x10'));var rimraf=require(_0x3005('0x1'));var archiver=require(_0x3005('0x11'));var Redis=require(_0x3005('0x12'));var authService=require(_0x3005('0x13'));var qs=require(_0x3005('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3005('0x15'));var logger=require(_0x3005('0x16'))(_0x3005('0x17'));var utils=require(_0x3005('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3005('0x19'));var db=require(_0x3005('0x1a'))['db'];config[_0x3005('0x1b')]=_[_0x3005('0x1c')](config['redis'],{'host':_0x3005('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3005('0x1b')]));require(_0x3005('0x1e'))[_0x3005('0x1f')](socket);function respondWithStatusCode(_0x56cce9,_0x2d40c1){_0x2d40c1=_0x2d40c1||0xcc;return function(_0x17eb85){if(_0x17eb85){return _0x56cce9[_0x3005('0x20')](_0x2d40c1);}return _0x56cce9[_0x3005('0x21')](_0x2d40c1)[_0x3005('0x22')]();};}function respondWithResult(_0x5499e0,_0x2c55be){_0x2c55be=_0x2c55be||0xc8;return function(_0x5a3c04){if(_0x5a3c04){return _0x5499e0['status'](_0x2c55be)['json'](_0x5a3c04);}};}function respondWithFilteredResult(_0x4e8e48,_0x3143e2){return function(_0xb13ae0){if(_0xb13ae0){var _0x377b7e=typeof _0x3143e2[_0x3005('0x23')]===_0x3005('0x24')&&typeof _0x3143e2[_0x3005('0x25')]===_0x3005('0x24');var _0x213f93=_0xb13ae0[_0x3005('0x26')];var _0x1621d4=_0x377b7e?0x0:_0x3143e2[_0x3005('0x23')];var _0x5837d2=_0x377b7e?_0xb13ae0[_0x3005('0x26')]:_0x3143e2[_0x3005('0x23')]+_0x3143e2[_0x3005('0x25')];var _0x9fd3da;if(_0x5837d2>=_0x213f93){_0x5837d2=_0x213f93;_0x9fd3da=0xc8;}else{_0x9fd3da=0xce;}_0x4e8e48[_0x3005('0x21')](_0x9fd3da);return _0x4e8e48[_0x3005('0x27')]('Content-Range',_0x1621d4+'-'+_0x5837d2+'/'+_0x213f93)[_0x3005('0x28')](_0xb13ae0);}return null;};}function patchUpdates(_0x3bef9a){return function(_0x93405f){try{jsonpatch[_0x3005('0x29')](_0x93405f,_0x3bef9a,!![]);}catch(_0x4178a0){return BPromise['reject'](_0x4178a0);}return _0x93405f['save']();};}function saveUpdates(_0x3274e1,_0x126dc6){return function(_0x31c5bf){if(_0x31c5bf){return _0x31c5bf[_0x3005('0x2a')](_0x3274e1)[_0x3005('0x2b')](function(_0xf8409d){return _0xf8409d;});}return null;};}function removeEntity(_0x2a03fb,_0x3e576b){return function(_0x1f0d3c){if(_0x1f0d3c){return _0x1f0d3c['destroy']()[_0x3005('0x2b')](function(){var _0x35683f=_0x1f0d3c['get']({'plain':!![]});var _0x1e05b5='Plugins';return db['UserProfileResource'][_0x3005('0x2c')]({'where':{'type':_0x1e05b5,'resourceId':_0x35683f['id']}})[_0x3005('0x2b')](function(){return _0x1f0d3c;});})[_0x3005('0x2b')](function(){_0x2a03fb[_0x3005('0x21')](0xcc)[_0x3005('0x22')]();});}};}function handleEntityNotFound(_0x286de5,_0x4432db){return function(_0xac1130){if(!_0xac1130){_0x286de5[_0x3005('0x20')](0x194);}return _0xac1130;};}function handleError(_0x44f2be,_0xdc53a6){_0xdc53a6=_0xdc53a6||0x1f4;return function(_0x463a9a){logger[_0x3005('0x2d')](_0x463a9a[_0x3005('0x2e')]);if(_0x463a9a[_0x3005('0x2f')]){delete _0x463a9a[_0x3005('0x2f')];}_0x44f2be[_0x3005('0x21')](_0xdc53a6)[_0x3005('0x30')](_0x463a9a);};}exports['index']=function(_0x1bcee0,_0x197961){var _0x19a146={},_0x3c8755={},_0x45b8cc={'count':0x0,'rows':[]};var _0x269db1=_[_0x3005('0x31')](db['Plugin'][_0x3005('0x32')],function(_0x1ac85e){return{'name':_0x1ac85e[_0x3005('0x33')],'type':_0x1ac85e[_0x3005('0x34')][_0x3005('0x35')]};});_0x3c8755[_0x3005('0x36')]=_[_0x3005('0x31')](_0x269db1,_0x3005('0x2f'));_0x3c8755[_0x3005('0x37')]=_[_0x3005('0x38')](_0x1bcee0[_0x3005('0x37')]);_0x3c8755[_0x3005('0x39')]=_[_0x3005('0x3a')](_0x3c8755[_0x3005('0x36')],_0x3c8755['query']);_0x19a146[_0x3005('0x3b')]=_[_0x3005('0x3a')](_0x3c8755[_0x3005('0x36')],qs[_0x3005('0x3c')](_0x1bcee0[_0x3005('0x37')][_0x3005('0x3c')]));_0x19a146['attributes']=_0x19a146['attributes'][_0x3005('0x3d')]?_0x19a146[_0x3005('0x3b')]:_0x3c8755[_0x3005('0x36')];if(!_0x1bcee0[_0x3005('0x37')][_0x3005('0x3e')](_0x3005('0x3f'))){_0x19a146['limit']=qs[_0x3005('0x25')](_0x1bcee0[_0x3005('0x37')][_0x3005('0x25')]);_0x19a146[_0x3005('0x23')]=qs['offset'](_0x1bcee0['query'][_0x3005('0x23')]);}_0x19a146[_0x3005('0x40')]=qs[_0x3005('0x41')](_0x1bcee0[_0x3005('0x37')][_0x3005('0x41')]);_0x19a146[_0x3005('0x42')]=qs[_0x3005('0x39')](_[_0x3005('0x43')](_0x1bcee0['query'],_0x3c8755['filters']),_0x269db1);if(_0x1bcee0['query'][_0x3005('0x44')]){_0x19a146[_0x3005('0x42')]=_[_0x3005('0x45')](_0x19a146[_0x3005('0x42')],{'$or':_[_0x3005('0x31')](_0x269db1,function(_0x35cea1){if(_0x35cea1[_0x3005('0x34')]!==_0x3005('0x46')){var _0x28379f={};_0x28379f[_0x35cea1[_0x3005('0x2f')]]={'$like':'%'+_0x1bcee0[_0x3005('0x37')][_0x3005('0x44')]+'%'};return _0x28379f;}})});}_0x19a146=_['merge']({},_0x19a146,_0x1bcee0[_0x3005('0x47')]);var _0x343f0b={'where':_0x19a146[_0x3005('0x42')]};return db[_0x3005('0x48')][_0x3005('0x26')](_0x343f0b)['then'](function(_0x5f5933){_0x45b8cc[_0x3005('0x26')]=_0x5f5933;if(_0x1bcee0[_0x3005('0x37')]['includeAll']){_0x19a146['include']=[{'all':!![]}];}return db[_0x3005('0x48')][_0x3005('0x49')](_0x19a146);})[_0x3005('0x2b')](function(_0x2d66db){_0x45b8cc[_0x3005('0x4a')]=_0x2d66db;return _0x45b8cc;})[_0x3005('0x2b')](respondWithFilteredResult(_0x197961,_0x19a146))[_0x3005('0x4b')](handleError(_0x197961,null));};exports[_0x3005('0x4c')]=function(_0x2b6268,_0x35f13f){var _0x1c02bc={'raw':!![],'where':{'id':_0x2b6268[_0x3005('0x4d')]['id']}},_0x23b947={};_0x23b947[_0x3005('0x36')]=_[_0x3005('0x38')](db[_0x3005('0x48')][_0x3005('0x32')]);_0x23b947['query']=_[_0x3005('0x38')](_0x2b6268['query']);_0x23b947['filters']=_[_0x3005('0x3a')](_0x23b947[_0x3005('0x36')],_0x23b947[_0x3005('0x37')]);_0x1c02bc['attributes']=_[_0x3005('0x3a')](_0x23b947[_0x3005('0x36')],qs[_0x3005('0x3c')](_0x2b6268[_0x3005('0x37')]['fields']));_0x1c02bc[_0x3005('0x3b')]=_0x1c02bc['attributes'][_0x3005('0x3d')]?_0x1c02bc[_0x3005('0x3b')]:_0x23b947[_0x3005('0x36')];if(_0x2b6268[_0x3005('0x37')][_0x3005('0x4e')]){_0x1c02bc[_0x3005('0x4f')]=[{'all':!![]}];}_0x1c02bc=_['merge']({},_0x1c02bc,_0x2b6268[_0x3005('0x47')]);return db[_0x3005('0x48')][_0x3005('0x50')](_0x1c02bc)[_0x3005('0x2b')](handleEntityNotFound(_0x35f13f,null))['then'](respondWithResult(_0x35f13f,null))[_0x3005('0x4b')](handleError(_0x35f13f,null));};exports[_0x3005('0x51')]=function(_0x346809,_0x225c67,_0x4acc92){return db[_0x3005('0x48')][_0x3005('0x50')]({'where':{'id':_0x346809[_0x3005('0x4d')]['id']},'attributes':[_0x3005('0x2f'),_0x3005('0x5')],'raw':!![]})[_0x3005('0x2b')](handleEntityNotFound(_0x225c67,null))['then'](function(_0x17b195){if(_0x17b195){var _0x3d151d=path[_0x3005('0x52')](config[_0x3005('0x53')],'server/files/plugins',util[_0x3005('0x54')]('%s.zip',path[_0x3005('0x55')](_0x17b195[_0x3005('0x5')])));var _0x5d69dd=fs[_0x3005('0x56')](_0x3d151d);var _0x2c4cb7=archiver(_0x3005('0x57'),{'zlib':{'level':0x9}});_0x2c4cb7['on'](_0x3005('0x58'),function(_0x24716a){if(_0x24716a['code']===_0x3005('0x59')){logger[_0x3005('0x2d')](_0x24716a);}else{throw new db[(_0x3005('0x5a'))][(_0x3005('0x5b'))](_0x3005('0x5c'));}});_0x2c4cb7['on'](_0x3005('0x2d'),function(_0x457bae){throw new db[(_0x3005('0x5a'))][(_0x3005('0x5b'))](_0x3005('0x5c'));});_0x2c4cb7[_0x3005('0x5d')](_0x5d69dd);_0x2c4cb7[_0x3005('0x5e')](_0x3005('0x5f'),{'cwd':path[_0x3005('0x52')](config[_0x3005('0x53')],_0x3005('0x60'),path[_0x3005('0x61')](_0x17b195[_0x3005('0x5')])),'ignore':[path[_0x3005('0x52')](path[_0x3005('0x55')](_0x17b195[_0x3005('0x5')]),_0x3005('0x62')),path[_0x3005('0x52')](path[_0x3005('0x55')](_0x17b195[_0x3005('0x5')]),'attachments/**/*')],'nodir':!![]})[_0x3005('0x63')]();_0x5d69dd['on'](_0x3005('0x64'),function(){if(!fs['existsSync'](_0x3d151d)){throw new db[(_0x3005('0x5a'))][(_0x3005('0x5b'))](_0x3005('0x65'));}return _0x225c67[_0x3005('0x51')](_0x3d151d,util[_0x3005('0x54')]('%s.zip',path[_0x3005('0x55')](_0x17b195['path'])),function(_0x46d70c){if(_0x46d70c){throw new db['Sequelize']['Error'](_0x3005('0x66'));}fs['unlinkSync'](_0x3d151d);logger[_0x3005('0x67')](_0x3005('0x68'));logger[_0x3005('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x3005('0x4b')](handleError(_0x225c67,null));};exports[_0x3005('0x69')]=function(_0x4e567c,_0x574b37,_0x629ced){var _0x26e9dc=path[_0x3005('0x55')](_0x4e567c[_0x3005('0x6a')][_0x3005('0x6b')],path[_0x3005('0x6c')](_0x4e567c[_0x3005('0x6a')][_0x3005('0x6b')]));var _0x4e1c4e=path['join'](config[_0x3005('0x53')],'server/files/plugins',_0x4e567c[_0x3005('0x6a')][_0x3005('0x6b')]);var _0x3bf7d2=path[_0x3005('0x52')](config[_0x3005('0x53')],_0x3005('0x60'),_0x26e9dc);logger['info'](_0x3005('0x6d'),_0x4e1c4e);logger[_0x3005('0x67')](_0x3005('0x6e'),_0x3bf7d2);try{fs[_0x3005('0x6f')](_0x4e1c4e,parseInt(_0x3005('0x70'),0x8));extract(_0x4e1c4e,{'dir':_0x3bf7d2},function(_0x219398){if(_0x219398){logger[_0x3005('0x2d')](_0x219398);handleError(_0x219398,!![]);};var _0xa9424c=fs[_0x3005('0x71')](_0x3bf7d2);if(_0xa9424c[_0x3005('0x3d')]>0x1){removeReferences(_0x4e1c4e,_0x3bf7d2);logger[_0x3005('0x2d')](_0x3005('0x72'));return _0x629ced(new Error(_0x3005('0x72')));}var _0x10aa23=fs['lstatSync'](path[_0x3005('0x52')](_0x3bf7d2,_0xa9424c[0x0]));if(_0x10aa23['isFile']()){removeReferences(_0x4e1c4e,_0x3bf7d2);logger[_0x3005('0x2d')]('Invalid\x20plugin\x20structure');return _0x629ced(new Error('Invalid\x20plugin\x20structure'));}if(_0x10aa23['isDirectory']()){var _0x2f7a9c=fs[_0x3005('0x71')](path[_0x3005('0x52')](_0x3bf7d2,_0xa9424c[0x0]));if(_0x2f7a9c[_0x3005('0x3d')]===0x0){removeReferences(_0x4e1c4e,_0x3bf7d2);logger[_0x3005('0x2d')](_0x3005('0x72'));return _0x629ced(new Error(_0x3005('0x72')));}var _0x195c52=_0x2f7a9c[_0x3005('0x73')](function(_0x5a0246){return _0x5a0246===_0x3005('0x74');});if(!_0x195c52){return _0x629ced(new Error(_0x3005('0x75')));}var _0x13e76a=fs['readFileSync'](path[_0x3005('0x52')](_0x3bf7d2,_0xa9424c[0x0],_0x3005('0x74')));var _0x18eda4=JSON[_0x3005('0x76')](_0x13e76a);if(_0x3005('0x24')==typeof _0x18eda4['name']){return _0x629ced(new Error(_0x3005('0x77')));}if(_0x3005('0x24')==typeof _0x18eda4[_0x3005('0x34')]){return _0x629ced(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3005('0x24')==typeof _0x18eda4['version']){return _0x629ced(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x3005('0x24')==typeof _0x18eda4[_0x3005('0x78')]){return _0x629ced(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x18eda4[_0x3005('0x34')]===_0x3005('0x79')){if(_0x3005('0x24')==typeof _0x18eda4[_0x3005('0x78')]['views']){return _0x629ced(new Error(_0x3005('0x7a')));}if('undefined'==typeof _0x18eda4[_0x3005('0x78')]['views'][_0x3005('0x7b')]&&_0x3005('0x24')==typeof _0x18eda4[_0x3005('0x78')][_0x3005('0x7c')]['agent']){return _0x629ced(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x18eda4[_0x3005('0x34')]==='script'){if(_0x3005('0x24')==typeof _0x18eda4[_0x3005('0x78')][_0x3005('0x7d')]){return _0x629ced(new Error(_0x3005('0x7e')));}if('undefined'==typeof _0x18eda4[_0x3005('0x78')][_0x3005('0x7f')]){return _0x629ced(new Error(_0x3005('0x80')));}}else{return _0x629ced(new Error(_0x3005('0x81')));}var _0x417eea=_0x18eda4[_0x3005('0x2f')];var _0x912324=_0x18eda4['description'];var _0x47c966=_0x18eda4[_0x3005('0x34')];var _0x31360b=_0x18eda4['sidebar']?_0x18eda4[_0x3005('0x82')]:'always';var _0xba6454=_0x18eda4[_0x3005('0x83')]?_0x18eda4[_0x3005('0x83')]:_0x3005('0x84');var _0x1db609='';var _0x27fae9='';var _0x929851='';var _0x52b32b='';var _0x35564c=_0x18eda4[_0x3005('0x85')];if(_0x47c966===_0x3005('0x79')){if(_0x3005('0x24')!=typeof _0x18eda4['parameters']['views']['admin']){var _0xed1c61=_0x18eda4['parameters'][_0x3005('0x7c')][_0x3005('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x3005('0x86')](_0xed1c61)){_0x1db609=path[_0x3005('0x52')](_0x3005('0x87'),_0x26e9dc,_0xa9424c[0x0],_0xed1c61);}else{_0x1db609=_0xed1c61;}}else{logger[_0x3005('0x67')](_0x3005('0x88'));}if(_0x3005('0x24')!=typeof _0x18eda4['parameters'][_0x3005('0x7c')][_0x3005('0x89')]){var _0x2e6200=_0x18eda4['parameters'][_0x3005('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x3005('0x86')](_0x2e6200)){_0x27fae9=path[_0x3005('0x52')](_0x3005('0x87'),_0x26e9dc,_0xa9424c[0x0],_0x2e6200);}else{_0x27fae9=_0x2e6200;}}else{logger['info'](_0x3005('0x8a'));}}else if(_0x47c966==='script'){_0x929851=_0x18eda4['parameters'][_0x3005('0x7d')];_0x52b32b=_0x18eda4[_0x3005('0x78')][_0x3005('0x7f')];if('undefined'!=typeof _0x18eda4['parameters'][_0x3005('0x7c')]){if(_0x3005('0x24')!=typeof _0x18eda4[_0x3005('0x78')][_0x3005('0x7c')][_0x3005('0x7b')]){var _0xed1c61=_0x18eda4['parameters']['views'][_0x3005('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x3005('0x86')](_0xed1c61)){_0x1db609=path[_0x3005('0x52')]('plugins',_0x26e9dc,_0xa9424c[0x0],_0xed1c61);}else{_0x1db609=_0xed1c61;}}if(_0x3005('0x24')!=typeof _0x18eda4['parameters'][_0x3005('0x7c')][_0x3005('0x89')]){var _0x2e6200=_0x18eda4[_0x3005('0x78')][_0x3005('0x7c')][_0x3005('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x3005('0x86')](_0x2e6200)){_0x27fae9=path[_0x3005('0x52')]('plugins',_0x26e9dc,_0xa9424c[0x0],_0x2e6200);}else{_0x27fae9=_0x2e6200;}}}}var _0x448889={'name':_0x417eea,'description':_0x912324,'path':path[_0x3005('0x52')](_0x26e9dc,_0xa9424c[0x0]),'type':_0x47c966,'sidebar':_0x31360b,'icon':_0xba6454,'adminUrl':_0x1db609,'agentUrl':_0x27fae9,'scriptName':_0x929851,'scriptPath':_0x52b32b,'version':_0x35564c};removeReferences(_0x4e1c4e,null);return db[_0x3005('0x48')][_0x3005('0x8b')](_0x448889)[_0x3005('0x2b')](function(_0x3b08c1){var _0x16cea0={'role':_0x4e567c['body'][_0x3005('0x8c')],'userProfileId':_0x4e567c[_0x3005('0x8d')][_0x3005('0x8e')]};if(!_0x16cea0)throw new Error(_0x3005('0x8f'));if(_0x16cea0[_0x3005('0x8c')]===_0x3005('0x90')){var _0x423cb4=_0x3b08c1['get']({'plain':!![]});return db[_0x3005('0x91')][_0x3005('0x50')]({'where':{'name':_0x3005('0x92'),'userProfileId':_0x16cea0[_0x3005('0x8e')]},'raw':!![]})[_0x3005('0x2b')](function(_0x415d7e){if(_0x415d7e&&_0x415d7e[_0x3005('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x423cb4['name'],'resourceId':_0x423cb4['id'],'type':_0x415d7e[_0x3005('0x2f')],'sectionId':_0x415d7e['id']},{})[_0x3005('0x2b')](function(){return _0x3b08c1;});}else{return _0x3b08c1;}})['catch'](function(_0x56c91f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56c91f);throw _0x56c91f;});}return _0x3b08c1;})[_0x3005('0x2b')](respondWithResult(_0x574b37,null))[_0x3005('0x4b')](handleError(_0x574b37,null));}});}catch(_0x1fc111){_0x574b37[_0x3005('0x21')](0x1f4)[_0x3005('0x30')](_0x1fc111);}};function removeReferences(_0x29eec4,_0x2f5f10){try{if(_0x29eec4){fs[_0x3005('0x94')](_0x29eec4);logger[_0x3005('0x67')](_0x3005('0x95'));}if(_0x2f5f10){rimraf(_0x2f5f10,function(){});logger[_0x3005('0x67')](_0x3005('0x96'));}}catch(_0x2eb54f){logger[_0x3005('0x2d')](_0x2eb54f);}}exports[_0x3005('0x2a')]=function(_0x3b6606,_0x1d9a76,_0x320ac5){return db[_0x3005('0x48')][_0x3005('0x50')]({'where':{'id':_0x3b6606[_0x3005('0x4d')]['id']}})[_0x3005('0x2b')](handleEntityNotFound(_0x1d9a76,null))['then'](saveUpdates(_0x3b6606['body'],null))['then'](respondWithResult(_0x1d9a76,null))[_0x3005('0x4b')](handleError(_0x1d9a76,null));};exports[_0x3005('0x97')]=function(_0x2544b6,_0x17a353,_0x3af0a6){return db[_0x3005('0x48')][_0x3005('0x50')]({'where':{'id':_0x2544b6['params']['id']}})['then'](function(_0x2b8108){if(_0x2b8108){return _0x2b8108[_0x3005('0x2c')]();}})[_0x3005('0x2b')](function(_0x17113a){rimraf(path[_0x3005('0x52')](config[_0x3005('0x53')],'server/files/plugins',path[_0x3005('0x61')](_0x17113a[_0x3005('0x5')])),function(){});return _0x17113a;})[_0x3005('0x2b')](handleEntityNotFound(_0x17a353,null))[_0x3005('0x2b')](respondWithStatusCode(_0x17a353,null))[_0x3005('0x4b')](handleError(_0x17a353,null));};exports[_0x3005('0x98')]=function(_0x3eb61b,_0x20c5da,_0x670e69){return BPromise['resolve']()['then'](function(){if(!_0x3eb61b[_0x3005('0x37')]['path']){throw new Error(_0x3005('0x99'));}if(!_0x3eb61b['query'][_0x3005('0x9a')]){throw new Error(_0x3005('0x9b'));}var _0x3d062a=_0x3eb61b[_0x3005('0x37')][_0x3005('0x9c')]?_0x3eb61b[_0x3005('0x37')]['hostname']+':'+_0x3eb61b[_0x3005('0x37')][_0x3005('0x9a')]:_0x3005('0x9d')+_0x3eb61b[_0x3005('0x37')][_0x3005('0x9a')];var _0x347d49=_0x3eb61b[_0x3005('0x37')]['json']?_0x3eb61b[_0x3005('0x37')][_0x3005('0x28')]:!![];var _0x205bab=_0x3eb61b[_0x3005('0x37')][_0x3005('0x9e')]?_0x3eb61b['query'][_0x3005('0x9e')]:null;var _0x375999={'method':_0x3eb61b[_0x3005('0x9f')],'uri':util[_0x3005('0x54')](_0x3005('0xa0'),_0x3d062a,_0x3eb61b[_0x3005('0x37')][_0x3005('0x5')]),'json':_0x347d49,'resolveWithFullResponse':!![],'encoding':_0x205bab,'qs':_0x3eb61b['query']};if(_0x3eb61b[_0x3005('0xa1')]){_0x375999[_0x3005('0xa1')]=_0x3eb61b['headers'];if(_0x375999['headers']['content-length']){delete _0x375999[_0x3005('0xa1')][_0x3005('0xa2')];}}if(_0x375999[_0x3005('0xa1')][_0x3005('0xa3')]){delete _0x375999[_0x3005('0xa1')][_0x3005('0xa3')];}return rp(_0x375999);})[_0x3005('0x2b')](function(_0x48e984){if(_0x48e984){_0x20c5da[_0x3005('0x27')](_0x48e984['headers']);logger['info'](_0x48e984[_0x3005('0x8d')]);if(_['endsWith'](_0x3eb61b[_0x3005('0x37')][_0x3005('0x5')],_0x3005('0x51'))&&_0x48e984[_0x3005('0xa4')]==0x1f4){return _0x20c5da[_0x3005('0x20')](_0x48e984[_0x3005('0xa4')]);}else{return _0x20c5da[_0x3005('0x21')](_0x48e984['statusCode'])[_0x3005('0x30')](_0x48e984[_0x3005('0x8d')]);}}else{return _0x20c5da[_0x3005('0x20')](0xc8);}})[_0x3005('0x4b')](handleError(_0x20c5da,null));};exports[_0x3005('0xa5')]=function(_0x2e86d0,_0x501679,_0x50fef1){return BPromise['resolve']()[_0x3005('0x2b')](function(){if(!_0x2e86d0['query'][_0x3005('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2e86d0[_0x3005('0x37')][_0x3005('0x9a')]){throw new Error(_0x3005('0x9b'));}var _0x58aa89=_0x2e86d0['query']['hostname']?_0x2e86d0[_0x3005('0x37')][_0x3005('0x9c')]+':'+_0x2e86d0[_0x3005('0x37')][_0x3005('0x9a')]:_0x3005('0x9d')+_0x2e86d0[_0x3005('0x37')][_0x3005('0x9a')];var _0x17ff71=_0x2e86d0[_0x3005('0x37')][_0x3005('0x28')]?_0x2e86d0[_0x3005('0x37')][_0x3005('0x28')]:!![];var _0x12cb4d=_0x2e86d0[_0x3005('0x37')][_0x3005('0x9e')]?_0x2e86d0[_0x3005('0x37')][_0x3005('0x9e')]:null;var _0x4312ed={'method':_0x2e86d0['method'],'uri':util['format']('%s%s',_0x58aa89,_0x2e86d0['query']['path']),'json':_0x17ff71,'resolveWithFullResponse':!![],'encoding':_0x12cb4d,'body':_0x2e86d0['body']};if(_0x2e86d0['headers']){_0x4312ed[_0x3005('0xa1')]=_0x2e86d0['headers'];if(_0x4312ed[_0x3005('0xa1')][_0x3005('0xa2')]){delete _0x4312ed[_0x3005('0xa1')]['content-length'];}}if(_0x4312ed['headers']['content-type']){delete _0x4312ed[_0x3005('0xa1')][_0x3005('0xa3')];}return rp(_0x4312ed);})[_0x3005('0x2b')](function(_0x2dd084){if(_0x2dd084){_0x501679['set'](_0x2dd084[_0x3005('0xa1')]);logger[_0x3005('0x67')](_0x2dd084[_0x3005('0x8d')]);return _0x501679['status'](_0x2dd084[_0x3005('0xa4')])['send'](_0x2dd084['body']);}else{return _0x501679[_0x3005('0x20')](0xc8);}})[_0x3005('0x4b')](handleError(_0x501679,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8aaba03..b0c58be 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 _0xf072=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save','remove'];(function(_0x35edd0,_0x44533c){var _0x33177b=function(_0x5a3089){while(--_0x5a3089){_0x35edd0['push'](_0x35edd0['shift']());}};_0x33177b(++_0x44533c);}(_0xf072,0x1cf));var _0x2f07=function(_0x5d6554,_0x4cd082){_0x5d6554=_0x5d6554-0x0;var _0x4a6e98=_0xf072[_0x5d6554];return _0x4a6e98;};'use strict';var EventEmitter=require(_0x2f07('0x0'));var Plugin=require(_0x2f07('0x1'))['db'][_0x2f07('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f07('0x3'),'afterUpdate':'update','afterDestroy':_0x2f07('0x4')};function emitEvent(_0x432696){return function(_0x1536c3,_0x48d7b6,_0x1d5a33){PluginEvents[_0x2f07('0x5')](_0x432696+':'+_0x1536c3['id'],_0x1536c3);PluginEvents[_0x2f07('0x5')](_0x432696,_0x1536c3);_0x1d5a33(null);};}for(var e in events){if(events[_0x2f07('0x6')](e)){var event=events[e];Plugin[_0x2f07('0x7')](e,emitEvent(event));}}module[_0x2f07('0x8')]=PluginEvents; \ No newline at end of file +var _0x79bf=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4361fd,_0x227bdc){var _0x48a16f=function(_0x30737f){while(--_0x30737f){_0x4361fd['push'](_0x4361fd['shift']());}};_0x48a16f(++_0x227bdc);}(_0x79bf,0x1df));var _0xf79b=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0x79bf[_0x26c12e];return _0xbab0c7;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xf79b('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xf79b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf79b('0x2'),'afterDestroy':_0xf79b('0x3')};function emitEvent(_0x917960){return function(_0x193fad,_0x44bff1,_0x8b298){PluginEvents[_0xf79b('0x4')](_0x917960+':'+_0x193fad['id'],_0x193fad);PluginEvents['emit'](_0x917960,_0x193fad);_0x8b298(null);};}for(var e in events){if(events[_0xf79b('0x5')](e)){var event=events[e];Plugin[_0xf79b('0x6')](e,emitEvent(event));}}module[_0xf79b('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 86ccc88..b86bf53 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 _0x7bb8=['api','moment','request-promise','path','../../config/environment','./plugin.attributes','plugins','util','../../config/logger'];(function(_0x50f58f,_0x374f99){var _0x252978=function(_0x21d87a){while(--_0x21d87a){_0x50f58f['push'](_0x50f58f['shift']());}};_0x252978(++_0x374f99);}(_0x7bb8,0xe8));var _0x87bb=function(_0x3d690c,_0x38577d){_0x3d690c=_0x3d690c-0x0;var _0x5db67c=_0x7bb8[_0x3d690c];return _0x5db67c;};'use strict';var _=require('lodash');var util=require(_0x87bb('0x0'));var logger=require(_0x87bb('0x1'))(_0x87bb('0x2'));var moment=require(_0x87bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x87bb('0x4'));var fs=require('fs');var path=require(_0x87bb('0x5'));var rimraf=require('rimraf');var config=require(_0x87bb('0x6'));var attributes=require(_0x87bb('0x7'));module['exports']=function(_0x38b56d,_0x46622e){return _0x38b56d['define']('Plugin',attributes,{'tableName':_0x87bb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1375=['exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x1375,0x170));var _0x5137=function(_0x2d3aed,_0x22536c){_0x2d3aed=_0x2d3aed-0x0;var _0x1b0461=_0x1375[_0x2d3aed];return _0x1b0461;};'use strict';var _=require(_0x5137('0x0'));var util=require(_0x5137('0x1'));var logger=require(_0x5137('0x2'))('api');var moment=require(_0x5137('0x3'));var BPromise=require(_0x5137('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5137('0x5'));var rimraf=require(_0x5137('0x6'));var config=require(_0x5137('0x7'));var attributes=require(_0x5137('0x8'));module[_0x5137('0x9')]=function(_0xa98823,_0x2a2131){return _0xa98823[_0x5137('0xa')](_0x5137('0xb'),attributes,{'tableName':_0x5137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 39645c6..820c1be 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 _0x6306=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin','body','options','raw','stringify','catch','util'];(function(_0x1e64bf,_0x29167f){var _0x4487ee=function(_0x4027b5){while(--_0x4027b5){_0x1e64bf['push'](_0x1e64bf['shift']());}};_0x4487ee(++_0x29167f);}(_0x6306,0xcb));var _0x6630=function(_0x5a2a77,_0x2c6e06){_0x5a2a77=_0x5a2a77-0x0;var _0x113570=_0x6306[_0x5a2a77];return _0x113570;};'use strict';var _=require('lodash');var util=require(_0x6630('0x0'));var moment=require(_0x6630('0x1'));var BPromise=require(_0x6630('0x2'));var rs=require(_0x6630('0x3'));var fs=require('fs');var Redis=require(_0x6630('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6630('0x5'));var logger=require(_0x6630('0x6'))(_0x6630('0x7'));var config=require(_0x6630('0x8'));var jayson=require(_0x6630('0x9'));var client=jayson[_0x6630('0xa')][_0x6630('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6630('0xc')],{'host':_0x6630('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6630('0xc')]));require(_0x6630('0xe'))[_0x6630('0xf')](socket);function respondWithRpcPromise(_0x519ed2,_0x1e8686,_0x4a6036){return new BPromise(function(_0x2f8242,_0x1c41e2){return client[_0x6630('0x10')](_0x519ed2,_0x4a6036)[_0x6630('0x11')](function(_0x4040b0){logger[_0x6630('0x12')](_0x6630('0x13'),_0x1e8686,_0x6630('0x14'));logger[_0x6630('0x15')](_0x6630('0x16'),_0x1e8686,_0x6630('0x14'),JSON['stringify'](_0x4040b0));if(_0x4040b0[_0x6630('0x17')]){if(_0x4040b0[_0x6630('0x17')][_0x6630('0x18')]===0x1f4){logger[_0x6630('0x17')](_0x6630('0x13'),_0x1e8686,_0x4040b0['error']['message']);return _0x1c41e2(_0x4040b0['error'][_0x6630('0x19')]);}logger['error'](_0x6630('0x13'),_0x1e8686,_0x4040b0[_0x6630('0x17')][_0x6630('0x19')]);return _0x2f8242(_0x4040b0['error'][_0x6630('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1e8686,_0x6630('0x14'));_0x2f8242(_0x4040b0[_0x6630('0x1a')][_0x6630('0x19')]);}})['catch'](function(_0x275c13){logger[_0x6630('0x17')](_0x6630('0x13'),_0x1e8686,_0x275c13);_0x1c41e2(_0x275c13);});});}exports[_0x6630('0x1b')]=function(_0x47f0c1){var _0x2b9085=this;return new Promise(function(_0x50f187,_0x20309e){return db[_0x6630('0x1c')]['create'](_0x47f0c1[_0x6630('0x1d')],{'raw':_0x47f0c1[_0x6630('0x1e')]?_0x47f0c1[_0x6630('0x1e')][_0x6630('0x1f')]===undefined?!![]:![]:!![]})[_0x6630('0x11')](function(_0x81c809){logger['info'](_0x6630('0x1b'),_0x47f0c1);logger[_0x6630('0x15')](_0x6630('0x1b'),_0x47f0c1,JSON[_0x6630('0x20')](_0x81c809));_0x50f187(_0x81c809);})[_0x6630('0x21')](function(_0x2a114d){logger['error'](_0x6630('0x1b'),_0x2a114d['message'],_0x47f0c1);_0x20309e(_0x2b9085[_0x6630('0x17')](0x1f4,_0x2a114d[_0x6630('0x19')]));});});}; \ No newline at end of file +var _0x999c=['localhost','socket.io-emitter','./plugin.socket','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','body','options','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x999c,0xdd));var _0xc999=function(_0x29c18c,_0x4143ed){_0x29c18c=_0x29c18c-0x0;var _0x3359d9=_0x999c[_0x29c18c];return _0x3359d9;};'use strict';var _=require(_0xc999('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc999('0x1'));var fs=require('fs');var Redis=require(_0xc999('0x2'));var db=require(_0xc999('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc999('0x4'))('rpc');var config=require(_0xc999('0x5'));var jayson=require(_0xc999('0x6'));var client=jayson[_0xc999('0x7')][_0xc999('0x8')]({'port':0x232a});config[_0xc999('0x9')]=_[_0xc999('0xa')](config['redis'],{'host':_0xc999('0xb'),'port':0x18eb});var socket=require(_0xc999('0xc'))(new Redis(config[_0xc999('0x9')]));require(_0xc999('0xd'))['register'](socket);function respondWithRpcPromise(_0x240714,_0x2f3cc6,_0x15a96f){return new BPromise(function(_0x3002a0,_0x3a98f0){return client['request'](_0x240714,_0x15a96f)[_0xc999('0xe')](function(_0x1b32c6){logger[_0xc999('0xf')]('Plugin,\x20%s,\x20%s',_0x2f3cc6,_0xc999('0x10'));logger['debug'](_0xc999('0x11'),_0x2f3cc6,_0xc999('0x10'),JSON['stringify'](_0x1b32c6));if(_0x1b32c6['error']){if(_0x1b32c6[_0xc999('0x12')][_0xc999('0x13')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x2f3cc6,_0x1b32c6[_0xc999('0x12')][_0xc999('0x14')]);return _0x3a98f0(_0x1b32c6['error'][_0xc999('0x14')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x2f3cc6,_0x1b32c6[_0xc999('0x12')]['message']);return _0x3002a0(_0x1b32c6[_0xc999('0x12')]['message']);}else{logger['info'](_0xc999('0x15'),_0x2f3cc6,_0xc999('0x10'));_0x3002a0(_0x1b32c6[_0xc999('0x16')][_0xc999('0x14')]);}})[_0xc999('0x17')](function(_0x18b9b8){logger['error'](_0xc999('0x15'),_0x2f3cc6,_0x18b9b8);_0x3a98f0(_0x18b9b8);});});}exports[_0xc999('0x18')]=function(_0x1dfacc){var _0x3a4eed=this;return new Promise(function(_0x1e6ca0,_0x32ea0f){return db[_0xc999('0x19')][_0xc999('0x1a')](_0x1dfacc[_0xc999('0x1b')],{'raw':_0x1dfacc[_0xc999('0x1c')]?_0x1dfacc[_0xc999('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5dccff){logger['info']('CreatePlugin',_0x1dfacc);logger['debug']('CreatePlugin',_0x1dfacc,JSON['stringify'](_0x5dccff));_0x1e6ca0(_0x5dccff);})['catch'](function(_0x21ee89){logger[_0xc999('0x12')](_0xc999('0x18'),_0x21ee89[_0xc999('0x14')],_0x1dfacc);_0x32ea0f(_0x3a4eed['error'](0x1f4,_0x21ee89[_0xc999('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4b6781a..a119eff 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 _0x3b33=['remove','emit','removeListener','register','length','plugin:','save'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x3b33,0x1b8));var _0x33b3=function(_0x221338,_0x5b6482){_0x221338=_0x221338-0x0;var _0x7953e4=_0x3b33[_0x221338];return _0x7953e4;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x33b3('0x0'),_0x33b3('0x1'),'update'];function createListener(_0x514cc8,_0x1e5ad4){return function(_0x516ddc){_0x1e5ad4[_0x33b3('0x2')](_0x514cc8,_0x516ddc);};}function removeListener(_0x2051a7,_0x288bce){return function(){PluginEvents[_0x33b3('0x3')](_0x2051a7,_0x288bce);};}exports[_0x33b3('0x4')]=function(_0x5411da){for(var _0xa1f3e6=0x0,_0x1d9083=events[_0x33b3('0x5')];_0xa1f3e6<_0x1d9083;_0xa1f3e6++){var _0x47957d=events[_0xa1f3e6];var _0x3d8449=createListener(_0x33b3('0x6')+_0x47957d,_0x5411da);PluginEvents['on'](_0x47957d,_0x3d8449);}}; \ No newline at end of file +var _0x1abe=['save','removeListener','register','length','plugin:'];(function(_0x185776,_0xe231bd){var _0x54c191=function(_0x2ac0b4){while(--_0x2ac0b4){_0x185776['push'](_0x185776['shift']());}};_0x54c191(++_0xe231bd);}(_0x1abe,0x1db));var _0xe1ab=function(_0x48fa2e,_0x48fc64){_0x48fa2e=_0x48fa2e-0x0;var _0x2b4001=_0x1abe[_0x48fa2e];return _0x2b4001;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xe1ab('0x0'),'remove','update'];function createListener(_0x34709e,_0x436f86){return function(_0x42e54e){_0x436f86['emit'](_0x34709e,_0x42e54e);};}function removeListener(_0x426241,_0x427f03){return function(){PluginEvents[_0xe1ab('0x1')](_0x426241,_0x427f03);};}exports[_0xe1ab('0x2')]=function(_0x34e8fb){for(var _0x4f26f3=0x0,_0x5ed2e3=events[_0xe1ab('0x3')];_0x4f26f3<_0x5ed2e3;_0x4f26f3++){var _0x1e397e=events[_0x4f26f3];var _0x4b2b0b=createListener(_0xe1ab('0x4')+_0x1e397e,_0x34e8fb);PluginEvents['on'](_0x1e397e,_0x4b2b0b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 651af59..b70a397 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(_0x216d2c,_0x46e0a2){var _0xf7577c=function(_0x2063d3){while(--_0x2063d3){_0x216d2c['push'](_0x216d2c['shift']());}};_0xf7577c(++_0x46e0a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0xe3ea9f,_0x53ab6e){var _0x10dbf8=function(_0x19ce87){while(--_0x19ce87){_0xe3ea9f['push'](_0xe3ea9f['shift']());}};_0x10dbf8(++_0x53ab6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 f74a759..9795cfd 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 _0x984b=['reject','express','motion2','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','delete','Unknown\x20id','api','path','child_process','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0x5c7cff,_0x229de9){var _0x48f729=function(_0x4d4428){while(--_0x4d4428){_0x5c7cff['push'](_0x5c7cff['shift']());}};_0x48f729(++_0x229de9);}(_0x984b,0xee));var _0xb984=function(_0xc1d361,_0x437f53){_0xc1d361=_0xc1d361-0x0;var _0x3eacfc=_0x984b[_0xc1d361];return _0x3eacfc;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xb984('0x0'));var path=require(_0xb984('0x1'));var exec=require(_0xb984('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x8384b0,_0x340f2c){return function(_0x4d8f6a){if(!_0x4d8f6a){_0x8384b0['sendStatus'](0x194);;}return _0x4d8f6a;};}function respondWithResult(_0x2cca53,_0x46c541){_0x46c541=_0x46c541||0xc8;return function(_0x5a605a){if(_0x5a605a){return _0x2cca53[_0xb984('0x3')](_0x46c541)[_0xb984('0x4')](_0x5a605a);}return null;};}function handleError(_0x4d72b7,_0x37fd36){_0x37fd36=_0x37fd36||0x1f4;return function(_0x4e6b9a){logger[_0xb984('0x5')](_0x4e6b9a[_0xb984('0x6')]);if(_0x4e6b9a[_0xb984('0x7')]){delete _0x4e6b9a[_0xb984('0x7')];}_0x4d72b7[_0xb984('0x3')](_0x37fd36)[_0xb984('0x8')](_0x4e6b9a);};}function execChildProcess(){return new BPromise(function(_0x11525c,_0xfca315){exec(_0xb984('0x9'),function(_0x3c3e8a,_0x1f107f,_0x39e612){logger['info'](_0x1f107f);logger[_0xb984('0xa')](_0x39e612);if(_0x3c3e8a){logger['error'](_0x3c3e8a);return _0xfca315(_0x3c3e8a);}return _0x11525c(_0x1f107f);});});}exports[_0xb984('0xb')]=function(_0x2dba22,_0x594a5e){return pm2[_0xb984('0xc')]()[_0xb984('0xd')](function(_0x564d24){if(_0x564d24){var _0x203dba=_[_0xb984('0xe')](_0x564d24,function(_0x549791){return _0x549791[_0xb984('0x7')]===_0xb984('0xf')||_0x549791['name']===_0xb984('0x10');});return{'rows':_0x203dba,'count':_0x203dba['length']};}return null;})[_0xb984('0xd')](respondWithResult(_0x594a5e,null))[_0xb984('0x11')](handleError(_0x594a5e,null));};exports[_0xb984('0x12')]=function(_0x3f7cff,_0x59dcb7){return pm2[_0xb984('0x13')](_0x3f7cff[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x59dcb7,null))[_0xb984('0xd')](handleEntityNotFound(_0x59dcb7,null))[_0xb984('0x11')](handleError(_0x59dcb7,null));};exports[_0xb984('0x15')]=function(_0x5c2e25,_0x2492f4){if(_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')]&&_0x5c2e25[_0xb984('0x16')][_0xb984('0x17')]){var _0xcf9365=path['join'](__dirname,_0xb984('0x18'),_0x5c2e25[_0xb984('0x16')]['script']);var _0x44b570=process[_0xb984('0x19')]();process[_0xb984('0x1a')](path[_0xb984('0x1b')](_0xcf9365));return execChildProcess()[_0xb984('0xd')](function(_0x286033){process[_0xb984('0x1a')](_0x44b570);return pm2['start']({'name':_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')],'script':_0xcf9365});})[_0xb984('0xd')](function(_0x5d4d38){pm2[_0xb984('0x1c')]();return _0x5d4d38[0x0];})[_0xb984('0xd')](respondWithResult(_0x2492f4,0xc9))[_0xb984('0x11')](handleError(_0x2492f4,null));}else{return _0x2492f4[_0xb984('0x3')](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x1d')});}};exports[_0xb984('0x1e')]=function(_0x4b3da0,_0x5d93d9){if(_0x4b3da0[_0xb984('0x16')]['id']){delete _0x4b3da0[_0xb984('0x16')]['id'];}var _0x3e254b={'online':_0xb984('0x1f'),'stopped':'stop'};if(_0x3e254b[_0xb984('0x20')](_0x4b3da0[_0xb984('0x16')][_0xb984('0x3')])){return pm2[_0x3e254b[_0x4b3da0['body'][_0xb984('0x3')]]](_0x4b3da0[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x5d93d9,0xc8))[_0xb984('0x11')](handleError(_0x5d93d9,null));}else{return _0x5d93d9['status'](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xb984('0x21')]=function(_0x23ecf6,_0x58a98c){if(_0x23ecf6[_0xb984('0x16')]['id']){delete _0x23ecf6[_0xb984('0x16')]['id'];}if(_0x23ecf6[_0xb984('0x14')]['id']){return pm2[_0xb984('0x22')](_0x23ecf6['params']['id'])['then'](function(_0x315f70){pm2[_0xb984('0x1c')]();return _0x315f70[0x0];})[_0xb984('0xd')](respondWithResult(_0x58a98c,null))[_0xb984('0x11')](handleError(_0x58a98c,null));}else{return _0x58a98c['status'](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x23')});}}; \ No newline at end of file +var _0x5ff3=['Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x5ff3,0x17d));var _0x35ff=function(_0x42438c,_0x8c2e7a){_0x42438c=_0x42438c-0x0;var _0x4f2a51=_0x5ff3[_0x42438c];return _0x4f2a51;};'use strict';var _=require('lodash');var pm2=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var path=require('path');var exec=require(_0x35ff('0x2'))[_0x35ff('0x3')];var BPromise=require(_0x35ff('0x4'));function handleEntityNotFound(_0xd0846d,_0x551514){return function(_0x2fcb74){if(!_0x2fcb74){_0xd0846d[_0x35ff('0x5')](0x194);;}return _0x2fcb74;};}function respondWithResult(_0x2e9873,_0x11e738){_0x11e738=_0x11e738||0xc8;return function(_0x30c3ff){if(_0x30c3ff){return _0x2e9873['status'](_0x11e738)[_0x35ff('0x6')](_0x30c3ff);}return null;};}function handleError(_0x4c9fab,_0x2e7470){_0x2e7470=_0x2e7470||0x1f4;return function(_0xfcec34){logger[_0x35ff('0x7')](_0xfcec34['stack']);if(_0xfcec34[_0x35ff('0x8')]){delete _0xfcec34['name'];}_0x4c9fab[_0x35ff('0x9')](_0x2e7470)[_0x35ff('0xa')](_0xfcec34);};}function execChildProcess(){return new BPromise(function(_0x57ad20,_0x5c3131){exec(_0x35ff('0xb'),function(_0x574c81,_0x592295,_0x567080){logger[_0x35ff('0xc')](_0x592295);logger[_0x35ff('0xc')](_0x567080);if(_0x574c81){logger[_0x35ff('0x7')](_0x574c81);return _0x5c3131(_0x574c81);}return _0x57ad20(_0x592295);});});}exports[_0x35ff('0xd')]=function(_0x559e33,_0x33154f){return pm2[_0x35ff('0xe')]()[_0x35ff('0xf')](function(_0x4d1d41){if(_0x4d1d41){var _0xff8ac=_[_0x35ff('0x10')](_0x4d1d41,function(_0x254975){return _0x254975[_0x35ff('0x8')]===_0x35ff('0x11')||_0x254975[_0x35ff('0x8')]===_0x35ff('0x12');});return{'rows':_0xff8ac,'count':_0xff8ac[_0x35ff('0x13')]};}return null;})[_0x35ff('0xf')](respondWithResult(_0x33154f,null))[_0x35ff('0x14')](handleError(_0x33154f,null));};exports[_0x35ff('0x15')]=function(_0x3430e2,_0x37ea06){return pm2[_0x35ff('0x16')](_0x3430e2[_0x35ff('0x17')]['id'])['then'](respondWithResult(_0x37ea06,null))[_0x35ff('0xf')](handleEntityNotFound(_0x37ea06,null))[_0x35ff('0x14')](handleError(_0x37ea06,null));};exports[_0x35ff('0x18')]=function(_0x1c0d8c,_0x567bcb){if(_0x1c0d8c['body'][_0x35ff('0x8')]&&_0x1c0d8c[_0x35ff('0x19')]['script']){var _0x238f65=path[_0x35ff('0x1a')](__dirname,_0x35ff('0x1b'),_0x1c0d8c[_0x35ff('0x19')]['script']);var _0x3d60b4=process['cwd']();process[_0x35ff('0x1c')](path[_0x35ff('0x1d')](_0x238f65));return execChildProcess()[_0x35ff('0xf')](function(_0x16a5a0){process[_0x35ff('0x1c')](_0x3d60b4);return pm2[_0x35ff('0x1e')]({'name':_0x1c0d8c[_0x35ff('0x19')]['name'],'script':_0x238f65});})[_0x35ff('0xf')](function(_0x2ffcb){pm2['dump']();return _0x2ffcb[0x0];})[_0x35ff('0xf')](respondWithResult(_0x567bcb,0xc9))['catch'](handleError(_0x567bcb,null));}else{return _0x567bcb['status'](0x1f4)[_0x35ff('0xa')]({'message':_0x35ff('0x1f')});}};exports[_0x35ff('0x20')]=function(_0x11a5eb,_0x302d5a){if(_0x11a5eb['body']['id']){delete _0x11a5eb[_0x35ff('0x19')]['id'];}var _0x412873={'online':_0x35ff('0x21'),'stopped':'stop'};if(_0x412873[_0x35ff('0x22')](_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')])){return pm2[_0x412873[_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')]]](_0x11a5eb[_0x35ff('0x17')]['id'])[_0x35ff('0xf')](respondWithResult(_0x302d5a,0xc8))[_0x35ff('0x14')](handleError(_0x302d5a,null));}else{return _0x302d5a[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x23')});}};exports['destroy']=function(_0x1cb370,_0x257501){if(_0x1cb370[_0x35ff('0x19')]['id']){delete _0x1cb370[_0x35ff('0x19')]['id'];}if(_0x1cb370['params']['id']){return pm2[_0x35ff('0x24')](_0x1cb370['params']['id'])[_0x35ff('0xf')](function(_0xf88865){pm2['dump']();return _0xf88865[0x0];})['then'](respondWithResult(_0x257501,null))[_0x35ff('0x14')](handleError(_0x257501,null));}else{return _0x257501[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 54df354..40f5a1c 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 _0xf592=['get','getQueues','exports','express','../../components/auth/service','/agents','isAuthenticated','getAgents'];(function(_0xc67084,_0x3e2efc){var _0x4d06c6=function(_0x2eb951){while(--_0x2eb951){_0xc67084['push'](_0xc67084['shift']());}};_0x4d06c6(++_0x3e2efc);}(_0xf592,0xc3));var _0x2f59=function(_0x536e31,_0x4467df){_0x536e31=_0x536e31-0x0;var _0x160e26=_0xf592[_0x536e31];return _0x160e26;};'use strict';var express=require(_0x2f59('0x0'));var router=express['Router']();var auth=require(_0x2f59('0x1'));var controller=require('./realtime.controller');router['get'](_0x2f59('0x2'),auth[_0x2f59('0x3')](),controller[_0x2f59('0x4')]);router[_0x2f59('0x5')]('/queues',auth[_0x2f59('0x3')](),controller[_0x2f59('0x6')]);module[_0x2f59('0x7')]=router; \ No newline at end of file +var _0x8f29=['getQueues','exports','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f29,0x1a0));var _0x98f2=function(_0x5c0cc2,_0x1efb9e){_0x5c0cc2=_0x5c0cc2-0x0;var _0x33c66e=_0x8f29[_0x5c0cc2];return _0x33c66e;};'use strict';var express=require('express');var router=express[_0x98f2('0x0')]();var auth=require(_0x98f2('0x1'));var controller=require(_0x98f2('0x2'));router[_0x98f2('0x3')](_0x98f2('0x4'),auth[_0x98f2('0x5')](),controller[_0x98f2('0x6')]);router[_0x98f2('0x3')]('/queues',auth[_0x98f2('0x5')](),controller[_0x98f2('0x7')]);module[_0x98f2('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a467094..364cc6c 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 _0xf853=['getAgentIdsByQueues','getRealtimeAgents','length','map','User','fieldName','type','key','role','agent','raw','push','FIELD(id,','forEach','*pause','Pause','where','merge','user','userProfileId','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','startCase','Queue','rawAttributes','fields','name','dialActive','dialMethod','outbound','QueueCampaigns','Queues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xf853,0x124));var _0x3f85=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xf853[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x3f85('0x0'));var util=require(_0x3f85('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x3f85('0x2'));var qs=require(_0x3f85('0x3'));var utils=require(_0x3f85('0x4'));var db=require(_0x3f85('0x5'))['db'];var APIBadRequestError=require(_0x3f85('0x6'))[_0x3f85('0x7')];var APIHandleError=require('../../errors/api')[_0x3f85('0x8')];function respondWithFilteredResult(_0x5ef182,_0x526a4c){return function(_0x98011f){if(_0x98011f){var _0x333865=typeof _0x526a4c[_0x3f85('0x9')]===_0x3f85('0xa')&&typeof _0x526a4c['limit']===_0x3f85('0xa');var _0x1566cf=_0x98011f[_0x3f85('0xb')];var _0x2cc98f=_0x333865?0x0:_0x526a4c['offset'];var _0x208cc5=_0x333865?_0x98011f[_0x3f85('0xb')]:_0x526a4c[_0x3f85('0x9')]+_0x526a4c[_0x3f85('0xc')];var _0x3105cd;if(_0x208cc5>=_0x1566cf){_0x208cc5=_0x1566cf;_0x3105cd=0xc8;}else{_0x3105cd=0xce;}_0x5ef182['status'](_0x3105cd);return _0x5ef182['set'](_0x3f85('0xd'),_0x2cc98f+'-'+_0x208cc5+'/'+_0x1566cf)['json'](_0x98011f);}return null;};}exports[_0x3f85('0xe')]=function(_0x3d9e8d,_0x239daf){var _0xcaa69={'count':0x0,'rows':[]};var _0x260f3f={};var _0x4ea760;var _0xf22b89=utils[_0x3f85('0xf')]();var _0x55927a;var _0x31eef1;var _0x2123b8=_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x11')];var _0x3d1fa8=_0x3d9e8d[_0x3f85('0x10')]['globalStatusFilter'];var _0x59f284=_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x12')];var _0x23171c=_0x3d1fa8===_0x3f85('0x13')||_0x3d1fa8==='*pause'?!![]:![];var _0x48ee99=[];var _0x5a44f6;var _0x4cb0e8;Promise['resolve']()[_0x3f85('0x14')](function(){if(_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x15')]){if(!utils[_0x3f85('0x16')](_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x15')])){throw new APIBadRequestError(util[_0x3f85('0x17')](_0x3f85('0x18'),_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x15')]));}_0x4ea760=_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x15')][_0x3f85('0x19')]();}if(!_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x1a')]||!_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x1a')]['includes'](_0x3f85('0x1b'))){_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x1a')]=rta[_0x3f85('0x1c')](_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x1a')]);return;}var _0xfa39a7=rta[_0x3f85('0x1d')](_0x3d9e8d[_0x3f85('0x10')][_0x3f85('0x1a')]);_0x3d9e8d['query']['sort']=_0xfa39a7['fields'][_0x3f85('0x1e')](',');_0x5a44f6=_0xfa39a7[_0x3f85('0x1f')];})[_0x3f85('0x14')](function(){if(!_0x2123b8){return[];}return rta[_0x3f85('0x20')](_0x2123b8,_0x4ea760);})[_0x3f85('0x14')](function(_0xd453a8){_0x48ee99=_0xd453a8;return rta[_0x3f85('0x21')]();})[_0x3f85('0x14')](function(_0x40fb0a){_0x31eef1=_0x40fb0a['rows'];if((!_0x3d1fa8||_0x23171c)&&!_0x5a44f6){return _0x48ee99;}if(_0x5a44f6&&!_0x3d1fa8){return rta['getSortedAgentsIdsByStatus'](_0x31eef1,_0x48ee99,_0x5a44f6);}else{return rta['getAgentIdsByStatus'](_0x31eef1,_0x48ee99,_0x3d1fa8);}})[_0x3f85('0x14')](function(_0x2fc162){_0x48ee99=_0x2fc162;var _0x233525=![];if(_0x48ee99[_0x3f85('0x22')]===0x0){if(_0x2123b8||_0x3d1fa8){_0x233525=!![];}if(_0x23171c){_0x233525=![];}}if(_0x233525){return _0xcaa69;}var _0x34f393=_[_0x3f85('0x23')](db[_0x3f85('0x24')]['rawAttributes'],function(_0x2c07e3){return{'name':_0x2c07e3[_0x3f85('0x25')],'type':_0x2c07e3[_0x3f85('0x26')][_0x3f85('0x27')]};});_0x3d9e8d['query'][_0x3f85('0x28')]=_0x3f85('0x29');_0x260f3f=qs['getOptions'](_0x34f393,_0x3d9e8d);_0x260f3f[_0x3f85('0x2a')]=!![];var _0x46ea02=[];if(_0x48ee99[_0x3f85('0x22')]>0x0){_0x46ea02[_0x3f85('0x2b')]({'id':{'$in':_0x48ee99}});if(_0x5a44f6&&!_0x3d1fa8){_0x4cb0e8=[db['sequelize']['literal'](_0x3f85('0x2c')+_0x48ee99+')')];_0x260f3f[_0x3f85('0x1f')]=_0x4cb0e8;}}if(_0x23171c){_0xf22b89[_0x3f85('0x2d')](function(_0x30d4ef){var _0x51e2df=!![];if(_0x3d1fa8===_0x3f85('0x2e')&&_0x4ea760!==_0x30d4ef){_0x51e2df=![];}_0x46ea02[_0x3f85('0x2b')]({[_0x30d4ef+'Pause']:_0x51e2df});});if(_0x59f284){_0x46ea02[_0x3f85('0x2b')]({'pauseType':_0x59f284});}}else if(_0x3d1fa8){_0xf22b89[_0x3f85('0x2d')](function(_0x2a999e){_0x46ea02[_0x3f85('0x2b')]({[_0x2a999e+_0x3f85('0x2f')]:![]});});}_0x260f3f[_0x3f85('0x30')]=_[_0x3f85('0x31')](_0x260f3f[_0x3f85('0x30')],{'$and':_0x46ea02});if(_0x3d9e8d[_0x3f85('0x32')][_0x3f85('0x28')]==='user'){var _0x51a6da={'params':{'id':_0x3d9e8d[_0x3f85('0x32')][_0x3f85('0x33')]},'query':{'section':'Agents','role':_0x3f85('0x29'),'raw':!![],'ids':_0x48ee99,'customSorting':_0x4cb0e8}};if(_0x3d9e8d[_0x3f85('0x10')]['online']){_0x51a6da[_0x3f85('0x10')]['online']=!![];}if(_0x23171c){_0x51a6da[_0x3f85('0x10')][_0x3f85('0x34')]=_0x46ea02;}_0x51a6da['query']=Object[_0x3f85('0x35')](_0x51a6da[_0x3f85('0x10')],_[_0x3f85('0x36')](_0x3d9e8d[_0x3f85('0x10')],'id'));return db[_0x3f85('0x37')][_0x3f85('0x38')](_0x51a6da);}return db[_0x3f85('0x24')][_0x3f85('0x39')](_0x260f3f);})[_0x3f85('0x14')](function(_0x21c982){_0xcaa69[_0x3f85('0xb')]=_0x21c982['count'];_0x55927a=_0x21c982[_0x3f85('0x3a')];return _0x55927a[_0x3f85('0x23')](function(_0x1c383a){var _0x1fac13=_[_0x3f85('0x3b')](_0x31eef1,['id',_0x1c383a['id']]);if(_0x1fac13){var _0x34067d=rta['filterAgentAttributes'](_0x1fac13);_['merge'](_0x1c383a,_0x34067d);}_0x1c383a['globalStatus']=rta[_0x3f85('0x3c')](_0x1c383a);if(_0x1c383a[_0x3f85('0x1b')]['includes']('pause')){_0xf22b89[_0x3f85('0x2d')](function(_0xef0595){if(_0x1c383a[_0xef0595+'Pause']){if(_0xef0595===_0x3f85('0x3d')){if(_0x1c383a[_0x3f85('0x3e')]!==_0x3f85('0x3f')){_0x1c383a[_0x3f85('0x3e')]=_0x3f85('0x13');}}else{_0x1c383a[_0xef0595+_0x3f85('0x40')]='pause';}}});}return _0x1c383a;});})[_0x3f85('0x14')](function(_0x145be5){if(!_0x5a44f6||_0x4cb0e8){return _0x145be5;}return rta[_0x3f85('0x41')](_0x145be5,_0x5a44f6);})[_0x3f85('0x14')](function(_0x1bc10a){var _0x16003f=rta[_0x3f85('0x42')]();_0xcaa69[_0x3f85('0x3a')]=_0x1bc10a[_0x3f85('0x23')](function(_0x370991){return _[_0x3f85('0x43')](_0x370991,_0x16003f);});return _0xcaa69;})[_0x3f85('0x14')](respondWithFilteredResult(_0x239daf,_0x260f3f))[_0x3f85('0x44')](APIHandleError(_0x239daf));};exports[_0x3f85('0x45')]=function(_0x268c81,_0xd3547a){var _0x1db751={'count':0x0,'rows':[]};var _0x27d98c={};var _0x22f0ae;var _0xb64271;var _0x16edfa;Promise[_0x3f85('0x46')]()[_0x3f85('0x14')](function(){if(_0x268c81[_0x3f85('0x10')][_0x3f85('0x15')]){if(!utils[_0x3f85('0x16')](_0x268c81['query'][_0x3f85('0x15')])){throw new APIBadRequestError(util['format'](_0x3f85('0x18'),_0x268c81[_0x3f85('0x10')][_0x3f85('0x15')]));}_0x22f0ae=_0x268c81[_0x3f85('0x10')][_0x3f85('0x15')][_0x3f85('0x19')]();}var _0x368217=_[_0x3f85('0x47')](_0x22f0ae)+_0x3f85('0x48');var _0x31ec6a=_[_0x3f85('0x23')](db[_0x368217][_0x3f85('0x49')],function(_0x2ce30d){return{'name':_0x2ce30d[_0x3f85('0x25')],'type':_0x2ce30d[_0x3f85('0x26')][_0x3f85('0x27')]};});if(!_0x268c81['query'][_0x3f85('0x4a')]){var _0x1d9c88=['id',_0x3f85('0x4b')];if(_0x22f0ae==='voice'){_0x1d9c88[_0x3f85('0x2b')](_0x3f85('0x26'));if(_0x268c81[_0x3f85('0x10')]['type']==='outbound'){_0x1d9c88[_0x3f85('0x2b')]([_0x3f85('0x4c'),_0x3f85('0x4d')]);}}_0x268c81[_0x3f85('0x10')][_0x3f85('0x4a')]=_0x1d9c88['join'](',');}_0x27d98c=qs['getOptions'](_0x31ec6a,_0x268c81);if(_0x268c81[_0x3f85('0x32')][_0x3f85('0x28')]===_0x3f85('0x32')){var _0x4d5fd6={'params':{'id':_0x268c81[_0x3f85('0x32')][_0x3f85('0x33')]},'query':{'section':_0x22f0ae===_0x3f85('0x3d')&&_0x268c81['query'][_0x3f85('0x26')]===_0x3f85('0x4e')?_0x3f85('0x4f'):_['startCase'](_0x22f0ae)+_0x3f85('0x50'),'type':_0x268c81[_0x3f85('0x10')][_0x3f85('0x26')],'nolimit':!![],'sort':_0x3f85('0x4b'),'filter':_0x268c81[_0x3f85('0x10')]['filter']}};_0x4d5fd6[_0x3f85('0x10')]=Object[_0x3f85('0x35')](_0x4d5fd6[_0x3f85('0x10')],_0x268c81[_0x3f85('0x10')]);delete _0x4d5fd6[_0x3f85('0x10')]['id'];return db['UserProfile'][_0x3f85('0x38')](_0x4d5fd6);}return db[_0x368217][_0x3f85('0x39')](_0x27d98c);})[_0x3f85('0x14')](function(_0x5a4615){_0x1db751['count']=_0x5a4615[_0x3f85('0xb')];_0xb64271=_0x5a4615['rows'];return rtq['getRealtimeQueues'](_0x268c81,_0x22f0ae);})[_0x3f85('0x14')](function(_0x170836){_0x16edfa=_0x170836[_0x3f85('0x3a')];return rtq['initializeQueues'](_0xb64271,_0x16edfa,_0x22f0ae,_0x268c81[_0x3f85('0x10')][_0x3f85('0x26')]);})['then'](function(_0x2d4f5e){_0x1db751[_0x3f85('0x3a')]=_0x2d4f5e;return _0x1db751;})['then'](respondWithFilteredResult(_0xd3547a,_0x27d98c))[_0x3f85('0x44')](APIHandleError(_0xd3547a));}; \ No newline at end of file +var _0xcbce=['util','../../components/parsers/qs','../../config/utils','../../errors/api','handleError','offset','limit','count','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','map','User','rawAttributes','key','role','agent','raw','length','literal','FIELD(id,','forEach','*pause','push','Pause','where','user','userProfileId','Agents','online','omit','UserProfile','findAndCountAll','find','filterAgentAttributes','merge','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','pick','getQueues','startCase','fieldName','type','name','outbound','dialActive','dialMethod','fields','getOptions','QueueCampaigns','Queues','assign','getRealtimeQueues','initializeQueues','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcbce,0x1eb));var _0xecbc=function(_0x2d174a,_0x3a258f){_0x2d174a=_0x2d174a-0x0;var _0x24d980=_0xcbce[_0x2d174a];return _0x24d980;};'use strict';var _=require(_0xecbc('0x0'));var util=require(_0xecbc('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0xecbc('0x2'));var utils=require(_0xecbc('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xecbc('0x4'))['APIBadRequestError'];var APIHandleError=require(_0xecbc('0x4'))[_0xecbc('0x5')];function respondWithFilteredResult(_0x537bc8,_0x123f05){return function(_0x2c1fcd){if(_0x2c1fcd){var _0x33e4db=typeof _0x123f05[_0xecbc('0x6')]==='undefined'&&typeof _0x123f05[_0xecbc('0x7')]==='undefined';var _0x4f816a=_0x2c1fcd['count'];var _0x39b7b6=_0x33e4db?0x0:_0x123f05[_0xecbc('0x6')];var _0x3ea56b=_0x33e4db?_0x2c1fcd[_0xecbc('0x8')]:_0x123f05[_0xecbc('0x6')]+_0x123f05[_0xecbc('0x7')];var _0x380f85;if(_0x3ea56b>=_0x4f816a){_0x3ea56b=_0x4f816a;_0x380f85=0xc8;}else{_0x380f85=0xce;}_0x537bc8['status'](_0x380f85);return _0x537bc8[_0xecbc('0x9')]('Content-Range',_0x39b7b6+'-'+_0x3ea56b+'/'+_0x4f816a)[_0xecbc('0xa')](_0x2c1fcd);}return null;};}exports[_0xecbc('0xb')]=function(_0x305839,_0x193976){var _0x588010={'count':0x0,'rows':[]};var _0x4cd0db={};var _0x31b4b4;var _0x1dc1a5=utils[_0xecbc('0xc')]();var _0x340d89;var _0x558f60;var _0x358df4=_0x305839[_0xecbc('0xd')][_0xecbc('0xe')];var _0x137069=_0x305839[_0xecbc('0xd')][_0xecbc('0xf')];var _0x4af2f8=_0x305839[_0xecbc('0xd')][_0xecbc('0x10')];var _0x2d073b=_0x137069===_0xecbc('0x11')||_0x137069==='*pause'?!![]:![];var _0x24a9dd=[];var _0x1d6506;var _0x4f81db;Promise['resolve']()[_0xecbc('0x12')](function(){if(_0x305839[_0xecbc('0xd')]['channel']){if(!utils[_0xecbc('0x13')](_0x305839[_0xecbc('0xd')][_0xecbc('0x14')])){throw new APIBadRequestError(util[_0xecbc('0x15')](_0xecbc('0x16'),_0x305839[_0xecbc('0xd')][_0xecbc('0x14')]));}_0x31b4b4=_0x305839[_0xecbc('0xd')][_0xecbc('0x14')][_0xecbc('0x17')]();}if(!_0x305839[_0xecbc('0xd')][_0xecbc('0x18')]||!_0x305839[_0xecbc('0xd')][_0xecbc('0x18')][_0xecbc('0x19')](_0xecbc('0x1a'))){_0x305839[_0xecbc('0xd')][_0xecbc('0x18')]=rta[_0xecbc('0x1b')](_0x305839[_0xecbc('0xd')][_0xecbc('0x18')]);return;}var _0xd4570a=rta['getUpdatedSortOptions'](_0x305839[_0xecbc('0xd')][_0xecbc('0x18')]);_0x305839['query']['sort']=_0xd4570a['fields'][_0xecbc('0x1c')](',');_0x1d6506=_0xd4570a[_0xecbc('0x1d')];})[_0xecbc('0x12')](function(){if(!_0x358df4){return[];}return rta[_0xecbc('0x1e')](_0x358df4,_0x31b4b4);})[_0xecbc('0x12')](function(_0xcfa35e){_0x24a9dd=_0xcfa35e;return rta[_0xecbc('0x1f')]();})['then'](function(_0x1bb138){_0x558f60=_0x1bb138[_0xecbc('0x20')];if((!_0x137069||_0x2d073b)&&!_0x1d6506){return _0x24a9dd;}if(_0x1d6506&&!_0x137069){return rta['getSortedAgentsIdsByStatus'](_0x558f60,_0x24a9dd,_0x1d6506);}else{return rta[_0xecbc('0x21')](_0x558f60,_0x24a9dd,_0x137069);}})[_0xecbc('0x12')](function(_0x22f593){_0x24a9dd=_0x22f593;var _0x5159f8=![];if(_0x24a9dd['length']===0x0){if(_0x358df4||_0x137069){_0x5159f8=!![];}if(_0x2d073b){_0x5159f8=![];}}if(_0x5159f8){return _0x588010;}var _0x4a6c59=_[_0xecbc('0x22')](db[_0xecbc('0x23')][_0xecbc('0x24')],function(_0x26b1a9){return{'name':_0x26b1a9['fieldName'],'type':_0x26b1a9['type'][_0xecbc('0x25')]};});_0x305839['query'][_0xecbc('0x26')]=_0xecbc('0x27');_0x4cd0db=qs['getOptions'](_0x4a6c59,_0x305839);_0x4cd0db[_0xecbc('0x28')]=!![];var _0x3e4347=[];if(_0x24a9dd[_0xecbc('0x29')]>0x0){_0x3e4347['push']({'id':{'$in':_0x24a9dd}});if(_0x1d6506&&!_0x137069){_0x4f81db=[db['sequelize'][_0xecbc('0x2a')](_0xecbc('0x2b')+_0x24a9dd+')')];_0x4cd0db[_0xecbc('0x1d')]=_0x4f81db;}}if(_0x2d073b){_0x1dc1a5[_0xecbc('0x2c')](function(_0x1b277a){var _0x1ad851=!![];if(_0x137069===_0xecbc('0x2d')&&_0x31b4b4!==_0x1b277a){_0x1ad851=![];}_0x3e4347[_0xecbc('0x2e')]({[_0x1b277a+_0xecbc('0x2f')]:_0x1ad851});});if(_0x4af2f8){_0x3e4347['push']({'pauseType':_0x4af2f8});}}else if(_0x137069){_0x1dc1a5[_0xecbc('0x2c')](function(_0x40c02f){_0x3e4347[_0xecbc('0x2e')]({[_0x40c02f+_0xecbc('0x2f')]:![]});});}_0x4cd0db[_0xecbc('0x30')]=_['merge'](_0x4cd0db[_0xecbc('0x30')],{'$and':_0x3e4347});if(_0x305839[_0xecbc('0x31')][_0xecbc('0x26')]===_0xecbc('0x31')){var _0x3de757={'params':{'id':_0x305839[_0xecbc('0x31')][_0xecbc('0x32')]},'query':{'section':_0xecbc('0x33'),'role':_0xecbc('0x27'),'raw':!![],'ids':_0x24a9dd,'customSorting':_0x4f81db}};if(_0x305839[_0xecbc('0xd')][_0xecbc('0x34')]){_0x3de757[_0xecbc('0xd')][_0xecbc('0x34')]=!![];}if(_0x2d073b){_0x3de757['query']['extraQueryConditions']=_0x3e4347;}_0x3de757[_0xecbc('0xd')]=Object['assign'](_0x3de757[_0xecbc('0xd')],_[_0xecbc('0x35')](_0x305839[_0xecbc('0xd')],'id'));return db[_0xecbc('0x36')]['getResources'](_0x3de757);}return db[_0xecbc('0x23')][_0xecbc('0x37')](_0x4cd0db);})[_0xecbc('0x12')](function(_0x1b8433){_0x588010[_0xecbc('0x8')]=_0x1b8433['count'];_0x340d89=_0x1b8433[_0xecbc('0x20')];return _0x340d89[_0xecbc('0x22')](function(_0x55ac0f){var _0x4bb64e=_[_0xecbc('0x38')](_0x558f60,['id',_0x55ac0f['id']]);if(_0x4bb64e){var _0x3219ce=rta[_0xecbc('0x39')](_0x4bb64e);_[_0xecbc('0x3a')](_0x55ac0f,_0x3219ce);}_0x55ac0f[_0xecbc('0x1a')]=rta[_0xecbc('0x3b')](_0x55ac0f);if(_0x55ac0f[_0xecbc('0x1a')]['includes'](_0xecbc('0x11'))){_0x1dc1a5['forEach'](function(_0x51778b){if(_0x55ac0f[_0x51778b+_0xecbc('0x2f')]){if(_0x51778b===_0xecbc('0x3c')){if(_0x55ac0f[_0xecbc('0x3d')]!==_0xecbc('0x3e')){_0x55ac0f[_0xecbc('0x3d')]=_0xecbc('0x11');}}else{_0x55ac0f[_0x51778b+_0xecbc('0x3f')]=_0xecbc('0x11');}}});}return _0x55ac0f;});})[_0xecbc('0x12')](function(_0x5a61fe){if(!_0x1d6506||_0x4f81db){return _0x5a61fe;}return rta[_0xecbc('0x40')](_0x5a61fe,_0x1d6506);})['then'](function(_0x231cb1){var _0x2d0328=rta['getRealtimeAgentsQueryFields']();_0x588010[_0xecbc('0x20')]=_0x231cb1[_0xecbc('0x22')](function(_0x33278d){return _[_0xecbc('0x41')](_0x33278d,_0x2d0328);});return _0x588010;})['then'](respondWithFilteredResult(_0x193976,_0x4cd0db))['catch'](APIHandleError(_0x193976));};exports[_0xecbc('0x42')]=function(_0x210c94,_0x5be367){var _0x23ef02={'count':0x0,'rows':[]};var _0x16a7c5={};var _0x21c7e7;var _0x1e6566;var _0x100e88;Promise['resolve']()['then'](function(){if(_0x210c94[_0xecbc('0xd')]['channel']){if(!utils[_0xecbc('0x13')](_0x210c94[_0xecbc('0xd')]['channel'])){throw new APIBadRequestError(util[_0xecbc('0x15')](_0xecbc('0x16'),_0x210c94[_0xecbc('0xd')]['channel']));}_0x21c7e7=_0x210c94[_0xecbc('0xd')][_0xecbc('0x14')][_0xecbc('0x17')]();}var _0x45f97e=_[_0xecbc('0x43')](_0x21c7e7)+'Queue';var _0x338065=_[_0xecbc('0x22')](db[_0x45f97e][_0xecbc('0x24')],function(_0x3b5cba){return{'name':_0x3b5cba[_0xecbc('0x44')],'type':_0x3b5cba[_0xecbc('0x45')][_0xecbc('0x25')]};});if(!_0x210c94['query']['fields']){var _0x3b8762=['id',_0xecbc('0x46')];if(_0x21c7e7===_0xecbc('0x3c')){_0x3b8762['push'](_0xecbc('0x45'));if(_0x210c94[_0xecbc('0xd')][_0xecbc('0x45')]===_0xecbc('0x47')){_0x3b8762['push']([_0xecbc('0x48'),_0xecbc('0x49')]);}}_0x210c94[_0xecbc('0xd')][_0xecbc('0x4a')]=_0x3b8762['join'](',');}_0x16a7c5=qs[_0xecbc('0x4b')](_0x338065,_0x210c94);if(_0x210c94['user'][_0xecbc('0x26')]===_0xecbc('0x31')){var _0x318f56={'params':{'id':_0x210c94[_0xecbc('0x31')]['userProfileId']},'query':{'section':_0x21c7e7===_0xecbc('0x3c')&&_0x210c94[_0xecbc('0xd')][_0xecbc('0x45')]===_0xecbc('0x47')?_0xecbc('0x4c'):_[_0xecbc('0x43')](_0x21c7e7)+_0xecbc('0x4d'),'type':_0x210c94[_0xecbc('0xd')][_0xecbc('0x45')],'nolimit':!![],'sort':_0xecbc('0x46'),'filter':_0x210c94['query']['filter']}};_0x318f56['query']=Object[_0xecbc('0x4e')](_0x318f56[_0xecbc('0xd')],_0x210c94[_0xecbc('0xd')]);delete _0x318f56['query']['id'];return db['UserProfile']['getResources'](_0x318f56);}return db[_0x45f97e][_0xecbc('0x37')](_0x16a7c5);})['then'](function(_0x55ccbe){_0x23ef02[_0xecbc('0x8')]=_0x55ccbe[_0xecbc('0x8')];_0x1e6566=_0x55ccbe['rows'];return rtq[_0xecbc('0x4f')](_0x210c94,_0x21c7e7);})[_0xecbc('0x12')](function(_0x57bf9e){_0x100e88=_0x57bf9e[_0xecbc('0x20')];return rtq[_0xecbc('0x50')](_0x1e6566,_0x100e88,_0x21c7e7,_0x210c94['query']['type']);})['then'](function(_0x3ebb07){_0x23ef02[_0xecbc('0x20')]=_0x3ebb07;return _0x23ef02;})[_0xecbc('0x12')](respondWithFilteredResult(_0x5be367,_0x16a7c5))[_0xecbc('0x51')](APIHandleError(_0x5be367));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9c2bf8d..84d860a 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3f6c31,_0x376055){var _0x44c7e6=function(_0x4cae45){while(--_0x4cae45){_0x3f6c31['push'](_0x3f6c31['shift']());}};_0x44c7e6(++_0x376055);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x378cef,_0x327e52){var _0x2dab3f=function(_0xebd3f5){while(--_0xebd3f5){_0x378cef['push'](_0x378cef['shift']());}};_0x2dab3f(++_0x327e52);}(_0xe706,0xa3));var _0x6e70=function(_0x2a0a38,_0x4a6de5){_0x2a0a38=_0x2a0a38-0x0;var _0x4a200e=_0xe706[_0x2a0a38];return _0x4a200e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index feacc36..e808d96 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 _0xe829=['STRING','DATE','exports','INTEGER'];(function(_0x3d9080,_0x5d31b3){var _0x224bd8=function(_0x55cb38){while(--_0x55cb38){_0x3d9080['push'](_0x3d9080['shift']());}};_0x224bd8(++_0x5d31b3);}(_0xe829,0xde));var _0x9e82=function(_0x893787,_0x2ecfe4){_0x893787=_0x893787-0x0;var _0x4d2cb0=_0xe829[_0x893787];return _0x4d2cb0;};'use strict';var Sequelize=require('sequelize');module[_0x9e82('0x0')]={'state':{'type':Sequelize[_0x9e82('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9e82('0x2')]},'scheduledat':{'type':Sequelize[_0x9e82('0x3')]},'uniqueid':{'type':Sequelize[_0x9e82('0x2')]},'starttime':{'type':Sequelize[_0x9e82('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9e82('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9e82('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba0d=['STRING','DATE','sequelize','INTEGER'];(function(_0x5d5355,_0x5d9821){var _0x46adfd=function(_0x37214){while(--_0x37214){_0x5d5355['push'](_0x5d5355['shift']());}};_0x46adfd(++_0x5d9821);}(_0xba0d,0x8e));var _0xdba0=function(_0x3220e7,_0x2aafa8){_0x3220e7=_0x3220e7-0x0;var _0x4bfb85=_0xba0d[_0x3220e7];return _0x4bfb85;};'use strict';var Sequelize=require(_0xdba0('0x0'));module['exports']={'state':{'type':Sequelize[_0xdba0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdba0('0x2')]},'scheduledat':{'type':Sequelize[_0xdba0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdba0('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xdba0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdba0('0x2')]},'campaigntype':{'type':Sequelize[_0xdba0('0x2')]},'membername':{'type':Sequelize[_0xdba0('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 154347c..05d8fea 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 _0xa897=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa897,0xc6));var _0x7a89=function(_0x133df9,_0x53e081){_0x133df9=_0x133df9-0x0;var _0x5225f6=_0xa897[_0x133df9];return _0x5225f6;};'use strict';var _=require(_0x7a89('0x0'));var util=require(_0x7a89('0x1'));var logger=require(_0x7a89('0x2'))('api');var moment=require(_0x7a89('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a89('0x4'));var fs=require('fs');var path=require(_0x7a89('0x5'));var rimraf=require(_0x7a89('0x6'));var config=require(_0x7a89('0x7'));var attributes=require(_0x7a89('0x8'));module[_0x7a89('0x9')]=function(_0x2c5523,_0x465b2a){return _0x2c5523['define']('ReportAgentPreview',attributes,{'tableName':_0x7a89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf14a=['bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','lodash','util','api'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf14a,0x165));var _0xaf14=function(_0x31899e,_0x570006){_0x31899e=_0x31899e-0x0;var _0x52e5a1=_0xf14a[_0x31899e];return _0x52e5a1;};'use strict';var _=require(_0xaf14('0x0'));var util=require(_0xaf14('0x1'));var logger=require('../../config/logger')(_0xaf14('0x2'));var moment=require('moment');var BPromise=require(_0xaf14('0x3'));var rp=require(_0xaf14('0x4'));var fs=require('fs');var path=require(_0xaf14('0x5'));var rimraf=require(_0xaf14('0x6'));var config=require('../../config/environment');var attributes=require(_0xaf14('0x7'));module[_0xaf14('0x8')]=function(_0x163da9,_0x684111){return _0x163da9[_0xaf14('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 69446b1..1aea980 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 _0x828d=['rpc','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e7a81,_0x304327){var _0x1f3de3=function(_0xff8f70){while(--_0xff8f70){_0x2e7a81['push'](_0x2e7a81['shift']());}};_0x1f3de3(++_0x304327);}(_0x828d,0x12c));var _0xd828=function(_0x32ca2e,_0x49e777){_0x32ca2e=_0x32ca2e-0x0;var _0x446941=_0x828d[_0x32ca2e];return _0x446941;};'use strict';var _=require(_0xd828('0x0'));var util=require(_0xd828('0x1'));var moment=require(_0xd828('0x2'));var BPromise=require(_0xd828('0x3'));var rs=require(_0xd828('0x4'));var fs=require('fs');var Redis=require(_0xd828('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd828('0x6'));var logger=require(_0xd828('0x7'))(_0xd828('0x8'));var config=require('../../config/environment');var jayson=require(_0xd828('0x9'));var client=jayson[_0xd828('0xa')][_0xd828('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563135,_0x5b3847,_0x482dfc){return new BPromise(function(_0x44fea5,_0x2e24a2){return client['request'](_0x563135,_0x482dfc)[_0xd828('0xc')](function(_0x6c1f68){logger[_0xd828('0xd')](_0xd828('0xe'),_0x5b3847,'request\x20sent');logger[_0xd828('0xf')](_0xd828('0x10'),_0x5b3847,'request\x20sent',JSON['stringify'](_0x6c1f68));if(_0x6c1f68['error']){if(_0x6c1f68['error'][_0xd828('0x11')]===0x1f4){logger[_0xd828('0x12')](_0xd828('0xe'),_0x5b3847,_0x6c1f68['error']['message']);return _0x2e24a2(_0x6c1f68[_0xd828('0x12')]['message']);}logger[_0xd828('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b3847,_0x6c1f68[_0xd828('0x12')][_0xd828('0x13')]);return _0x44fea5(_0x6c1f68[_0xd828('0x12')]['message']);}else{logger['info'](_0xd828('0xe'),_0x5b3847,_0xd828('0x14'));_0x44fea5(_0x6c1f68[_0xd828('0x15')][_0xd828('0x13')]);}})[_0xd828('0x16')](function(_0x5850a0){logger[_0xd828('0x12')](_0xd828('0xe'),_0x5b3847,_0x5850a0);_0x2e24a2(_0x5850a0);});});}exports[_0xd828('0x17')]=function(_0x137a2b){var _0x3a38d4=this;return new Promise(function(_0x59833b,_0x1ca60c){return db[_0xd828('0x18')][_0xd828('0x19')](_0x137a2b['body'],{'raw':_0x137a2b['options']?_0x137a2b[_0xd828('0x1a')][_0xd828('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1a1613){logger[_0xd828('0xd')](_0xd828('0x17'),_0x137a2b);logger[_0xd828('0xf')](_0xd828('0x17'),_0x137a2b,JSON['stringify'](_0x1a1613));_0x59833b(_0x1a1613);})[_0xd828('0x16')](function(_0x249372){logger[_0xd828('0x12')](_0xd828('0x17'),_0x249372['message'],_0x137a2b);_0x1ca60c(_0x3a38d4['error'](0x1f4,_0x249372[_0xd828('0x13')]));});});}; \ No newline at end of file +var _0x61f8=['ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x139b24,_0x294135){var _0x3164ba=function(_0xed6f3b){while(--_0xed6f3b){_0x139b24['push'](_0x139b24['shift']());}};_0x3164ba(++_0x294135);}(_0x61f8,0x129));var _0x861f=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x61f8[_0x35fb56];return _0x2fd52c;};'use strict';var _=require('lodash');var util=require(_0x861f('0x0'));var moment=require(_0x861f('0x1'));var BPromise=require(_0x861f('0x2'));var rs=require(_0x861f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x861f('0x4'))['db'];var utils=require(_0x861f('0x5'));var logger=require(_0x861f('0x6'))(_0x861f('0x7'));var config=require(_0x861f('0x8'));var jayson=require(_0x861f('0x9'));var client=jayson[_0x861f('0xa')][_0x861f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49be12,_0x5d27c9,_0x18c48b){return new BPromise(function(_0x49dd12,_0x962afa){return client['request'](_0x49be12,_0x18c48b)['then'](function(_0x46e7cd){logger[_0x861f('0xc')](_0x861f('0xd'),_0x5d27c9,_0x861f('0xe'));logger[_0x861f('0xf')](_0x861f('0x10'),_0x5d27c9,_0x861f('0xe'),JSON['stringify'](_0x46e7cd));if(_0x46e7cd[_0x861f('0x11')]){if(_0x46e7cd[_0x861f('0x11')][_0x861f('0x12')]===0x1f4){logger[_0x861f('0x11')](_0x861f('0xd'),_0x5d27c9,_0x46e7cd[_0x861f('0x11')][_0x861f('0x13')]);return _0x962afa(_0x46e7cd[_0x861f('0x11')][_0x861f('0x13')]);}logger[_0x861f('0x11')](_0x861f('0xd'),_0x5d27c9,_0x46e7cd[_0x861f('0x11')][_0x861f('0x13')]);return _0x49dd12(_0x46e7cd['error'][_0x861f('0x13')]);}else{logger[_0x861f('0xc')](_0x861f('0xd'),_0x5d27c9,_0x861f('0xe'));_0x49dd12(_0x46e7cd[_0x861f('0x14')][_0x861f('0x13')]);}})[_0x861f('0x15')](function(_0x3c2693){logger[_0x861f('0x11')](_0x861f('0xd'),_0x5d27c9,_0x3c2693);_0x962afa(_0x3c2693);});});}exports['CreateReportAgentPreview']=function(_0x46767d){var _0x3cd9f7=this;return new Promise(function(_0x329f1a,_0x4f4ee1){return db[_0x861f('0x16')][_0x861f('0x17')](_0x46767d[_0x861f('0x18')],{'raw':_0x46767d[_0x861f('0x19')]?_0x46767d[_0x861f('0x19')][_0x861f('0x1a')]===undefined?!![]:![]:!![]})[_0x861f('0x1b')](function(_0x1f6e34){logger[_0x861f('0xc')](_0x861f('0x1c'),_0x46767d);logger[_0x861f('0xf')](_0x861f('0x1c'),_0x46767d,JSON['stringify'](_0x1f6e34));_0x329f1a(_0x1f6e34);})['catch'](function(_0x4c0bde){logger[_0x861f('0x11')](_0x861f('0x1c'),_0x4c0bde[_0x861f('0x13')],_0x46767d);_0x4f4ee1(_0x3cd9f7[_0x861f('0x11')](0x1f4,_0x4c0bde[_0x861f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d674730..8d02c94 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 _0x5968=['mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','agentNotify','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x5968,0x1c1));var _0x8596=function(_0xc312e3,_0x2ecd5a){_0xc312e3=_0xc312e3-0x0;var _0x2cbcde=_0x5968[_0xc312e3];return _0x2cbcde;};'use strict';var multer=require('multer');var util=require(_0x8596('0x0'));var path=require(_0x8596('0x1'));var express=require(_0x8596('0x2'));var router=express[_0x8596('0x3')]();var auth=require(_0x8596('0x4'));var controller=require(_0x8596('0x5'));router[_0x8596('0x6')]('/voice/channels',auth[_0x8596('0x7')](),controller['voiceChannels']);router[_0x8596('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x8596('0x7')](),controller['voiceChannelMixMonitor']);router[_0x8596('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x8596('0x8')]);router[_0x8596('0x6')](_0x8596('0x9'),auth[_0x8596('0x7')](),controller['voiceQueues']);router[_0x8596('0x6')](_0x8596('0xa'),auth[_0x8596('0x7')](),controller['chatQueues']);router[_0x8596('0x6')](_0x8596('0xb'),auth[_0x8596('0x7')](),controller[_0x8596('0xc')]);router['get']('/mail/accounts',auth[_0x8596('0x7')](),controller[_0x8596('0xd')]);router[_0x8596('0x6')](_0x8596('0xe'),auth[_0x8596('0x7')](),controller[_0x8596('0xf')]);router[_0x8596('0x6')](_0x8596('0x10'),auth[_0x8596('0x7')](),controller[_0x8596('0x11')]);router[_0x8596('0x6')](_0x8596('0x12'),auth[_0x8596('0x7')](),controller[_0x8596('0x13')]);router['get'](_0x8596('0x14'),auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x8596('0x15')]);router[_0x8596('0x6')](_0x8596('0x16'),auth[_0x8596('0x7')](),controller[_0x8596('0x17')]);router[_0x8596('0x6')](_0x8596('0x18'),auth[_0x8596('0x7')](),controller[_0x8596('0x19')]);router[_0x8596('0x6')](_0x8596('0x1a'),auth[_0x8596('0x7')](),controller[_0x8596('0x1b')]);router[_0x8596('0x6')](_0x8596('0x1c'),auth[_0x8596('0x7')](),controller[_0x8596('0x1d')]);router[_0x8596('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x8596('0x1e')]);router[_0x8596('0x1f')](_0x8596('0x20'),auth[_0x8596('0x7')](),controller[_0x8596('0x21')]);router['get'](_0x8596('0x22'),auth[_0x8596('0x7')](),controller[_0x8596('0x23')]);router[_0x8596('0x6')](_0x8596('0x24'),auth[_0x8596('0x7')](),controller[_0x8596('0x25')]);router['get'](_0x8596('0x26'),auth[_0x8596('0x7')](),controller[_0x8596('0x27')]);router[_0x8596('0x1f')](_0x8596('0x28'),auth[_0x8596('0x7')](),controller['agentCapacity']);router['get']('/telephones',auth['isAuthenticated'](),controller[_0x8596('0x29')]);router[_0x8596('0x6')](_0x8596('0x2a'),auth[_0x8596('0x7')](),controller[_0x8596('0x2b')]);router[_0x8596('0x6')]('/campaigns',auth[_0x8596('0x7')](),controller[_0x8596('0x2c')]);router[_0x8596('0x6')](_0x8596('0x2d'),auth[_0x8596('0x7')](),controller[_0x8596('0x2e')]);router[_0x8596('0x6')](_0x8596('0x2f'),auth[_0x8596('0x7')](),controller[_0x8596('0x30')]);router[_0x8596('0x6')](_0x8596('0x31'),auth['isAuthenticated'](),controller[_0x8596('0x32')]);router[_0x8596('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x8596('0x7')](),controller[_0x8596('0x33')]);router[_0x8596('0x6')](_0x8596('0x34'),auth[_0x8596('0x7')](),controller[_0x8596('0x35')]);router[_0x8596('0x6')](_0x8596('0x36'),auth['isAuthenticated'](),controller[_0x8596('0x37')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x8596('0x7')](),controller[_0x8596('0x38')]);router[_0x8596('0x6')](_0x8596('0x39'),auth['isAuthenticated'](),controller[_0x8596('0x3a')]);router[_0x8596('0x3b')](_0x8596('0x3c'),auth[_0x8596('0x7')](),controller[_0x8596('0x3d')](_0x8596('0x3e')));router['get'](_0x8596('0x3f'),auth['isAuthenticated'](),controller[_0x8596('0x40')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8596('0x3d')](_0x8596('0x41')));router[_0x8596('0x6')](_0x8596('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x8596('0x43'),auth[_0x8596('0x7')](),controller[_0x8596('0x3d')](_0x8596('0x44')));router[_0x8596('0x6')](_0x8596('0x45'),auth[_0x8596('0x7')](),controller[_0x8596('0x46')]);router['post']('/openchannel/queues/:id/notify',auth[_0x8596('0x7')](),controller[_0x8596('0x3d')]('openchannel'));router[_0x8596('0x6')](_0x8596('0x47'),auth[_0x8596('0x7')](),controller['showOpenchannelQueues']);router[_0x8596('0x3b')](_0x8596('0x48'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x8596('0x3b')](_0x8596('0x49'),auth[_0x8596('0x7')](),controller['queueNotify']('whatsapp'));router[_0x8596('0x6')](_0x8596('0x4a'),auth['isAuthenticated'](),controller['showSmsQueues']);router['get'](_0x8596('0x4b'),auth[_0x8596('0x7')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x8596('0x4c')]);module['exports']=router; \ No newline at end of file +var _0xfa6d=['voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x2ae4cb,_0x399323){var _0x4a49c4=function(_0x113a0d){while(--_0x113a0d){_0x2ae4cb['push'](_0x2ae4cb['shift']());}};_0x4a49c4(++_0x399323);}(_0xfa6d,0x14a));var _0xdfa6=function(_0x118280,_0x2d869c){_0x118280=_0x118280-0x0;var _0x438dda=_0xfa6d[_0x118280];return _0x438dda;};'use strict';var multer=require(_0xdfa6('0x0'));var util=require(_0xdfa6('0x1'));var path=require(_0xdfa6('0x2'));var express=require('express');var router=express[_0xdfa6('0x3')]();var auth=require(_0xdfa6('0x4'));var controller=require(_0xdfa6('0x5'));router[_0xdfa6('0x6')]('/voice/channels',auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x8')]);router[_0xdfa6('0x6')](_0xdfa6('0x9'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0xa')]);router[_0xdfa6('0x6')](_0xdfa6('0xb'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0xc')]);router[_0xdfa6('0x6')](_0xdfa6('0xd'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0xe')]);router[_0xdfa6('0x6')]('/chat/queues',auth[_0xdfa6('0x7')](),controller[_0xdfa6('0xf')]);router[_0xdfa6('0x6')](_0xdfa6('0x10'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x11')]);router[_0xdfa6('0x6')](_0xdfa6('0x12'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x13')]);router[_0xdfa6('0x6')](_0xdfa6('0x14'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x15')]);router['get'](_0xdfa6('0x16'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x17')]);router[_0xdfa6('0x6')]('/whatsapp/queues',auth[_0xdfa6('0x7')](),controller['whatsappQueues']);router['get'](_0xdfa6('0x18'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x19')]);router[_0xdfa6('0x6')](_0xdfa6('0x1a'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x1b')]);router[_0xdfa6('0x6')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xdfa6('0x6')](_0xdfa6('0x1c'),auth[_0xdfa6('0x7')](),controller['voiceQueuesChannel']);router[_0xdfa6('0x6')](_0xdfa6('0x1d'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x1e')]);router[_0xdfa6('0x6')](_0xdfa6('0x1f'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x20')]);router[_0xdfa6('0x6')](_0xdfa6('0x21'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x22')]);router[_0xdfa6('0x23')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0xdfa6('0x24')]);router[_0xdfa6('0x6')](_0xdfa6('0x25'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x26')]);router['get']('/outbound/channels',auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x27')]);router['get'](_0xdfa6('0x28'),auth[_0xdfa6('0x7')](),controller['agents']);router[_0xdfa6('0x23')](_0xdfa6('0x29'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x2a')]);router[_0xdfa6('0x6')](_0xdfa6('0x2b'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x2c')]);router[_0xdfa6('0x6')](_0xdfa6('0x2d'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x2e')]);router['get'](_0xdfa6('0x2f'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x30')]);router[_0xdfa6('0x6')](_0xdfa6('0x31'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x32')]);router['get'](_0xdfa6('0x33'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x34')]);router['get'](_0xdfa6('0x35'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x36')]);router[_0xdfa6('0x6')](_0xdfa6('0x37'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xdfa6('0x38'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xdfa6('0x39'),auth['isAuthenticated'](),controller[_0xdfa6('0x3a')]);router[_0xdfa6('0x6')](_0xdfa6('0x3b'),auth['isAuthenticated'](),controller[_0xdfa6('0x3c')]);router[_0xdfa6('0x6')](_0xdfa6('0x3d'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x3e')]);router[_0xdfa6('0x3f')](_0xdfa6('0x40'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x41')](_0xdfa6('0x42')));router['get'](_0xdfa6('0x43'),auth['isAuthenticated'](),controller[_0xdfa6('0x44')]);router[_0xdfa6('0x3f')](_0xdfa6('0x45'),auth[_0xdfa6('0x7')](),controller['queueNotify'](_0xdfa6('0x46')));router[_0xdfa6('0x6')](_0xdfa6('0x47'),auth[_0xdfa6('0x7')](),controller['showChatQueues']);router[_0xdfa6('0x3f')](_0xdfa6('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xdfa6('0x49')));router[_0xdfa6('0x6')](_0xdfa6('0x4a'),auth[_0xdfa6('0x7')](),controller['showFaxQueues']);router[_0xdfa6('0x3f')](_0xdfa6('0x4b'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x41')]('openchannel'));router[_0xdfa6('0x6')](_0xdfa6('0x4c'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x4d')]);router[_0xdfa6('0x3f')](_0xdfa6('0x4e'),auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x41')]('sms'));router[_0xdfa6('0x3f')](_0xdfa6('0x4f'),auth[_0xdfa6('0x7')](),controller['queueNotify'](_0xdfa6('0x50')));router[_0xdfa6('0x6')]('/sms/queues/:id',auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x51')]);router[_0xdfa6('0x6')](_0xdfa6('0x52'),auth[_0xdfa6('0x7')](),controller['showWhatsappQueues']);router[_0xdfa6('0x3f')]('/agents/:id/notify',auth[_0xdfa6('0x7')](),controller[_0xdfa6('0x53')]);module[_0xdfa6('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 75b800a..9afa2c7 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(_0x6f770a,_0x48ed35){var _0x19af88=function(_0x1ab1cc){while(--_0x1ab1cc){_0x6f770a['push'](_0x6f770a['shift']());}};_0x19af88(++_0x48ed35);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 _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(_0xadbfd9,_0x34dbe2){var _0x40d940=function(_0x3b6350){while(--_0x3b6350){_0xadbfd9['push'](_0xadbfd9['shift']());}};_0x40d940(++_0x34dbe2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index df40d0a..4ab9abf 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 _0x92d2=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3b3399,_0x992e2c){var _0x1f9b01=function(_0x3876ef){while(--_0x3876ef){_0x3b3399['push'](_0x3b3399['shift']());}};_0x1f9b01(++_0x992e2c);}(_0x92d2,0x1c2));var _0x292d=function(_0xa03603,_0x5d7ec4){_0xa03603=_0xa03603-0x0;var _0x284472=_0x92d2[_0xa03603];return _0x284472;};'use strict';var multer=require(_0x292d('0x0'));var util=require(_0x292d('0x1'));var path=require(_0x292d('0x2'));var timeout=require('connect-timeout');var express=require(_0x292d('0x3'));var router=express[_0x292d('0x4')]();var fs_extra=require(_0x292d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x292d('0x6'));var controller=require(_0x292d('0x7'));router[_0x292d('0x8')]('/',auth[_0x292d('0x9')](),controller[_0x292d('0xa')]);router['get'](_0x292d('0xb'),auth[_0x292d('0x9')](),controller['show']);router['get'](_0x292d('0xc'),auth[_0x292d('0x9')](),controller[_0x292d('0xd')]);router[_0x292d('0xe')]('/',auth['isAuthenticated'](),controller[_0x292d('0xf')]);router['put'](_0x292d('0xb'),auth[_0x292d('0x9')](),controller['update']);router[_0x292d('0x10')]('/:id',auth[_0x292d('0x9')](),controller[_0x292d('0x11')]);module[_0x292d('0x12')]=router; \ No newline at end of file +var _0xb111=['run','post','create','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id','/:id/run'];(function(_0x9c5fa,_0x287f69){var _0x4a124f=function(_0x4328e1){while(--_0x4328e1){_0x9c5fa['push'](_0x9c5fa['shift']());}};_0x4a124f(++_0x287f69);}(_0xb111,0x1da));var _0x1b11=function(_0x480bd7,_0x3283e6){_0x480bd7=_0x480bd7-0x0;var _0x2384dd=_0xb111[_0x480bd7];return _0x2384dd;};'use strict';var multer=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var path=require('path');var timeout=require(_0x1b11('0x2'));var express=require('express');var router=express[_0x1b11('0x3')]();var fs_extra=require(_0x1b11('0x4'));var auth=require(_0x1b11('0x5'));var interaction=require(_0x1b11('0x6'));var config=require('../../config/environment');var controller=require(_0x1b11('0x7'));router[_0x1b11('0x8')]('/',auth[_0x1b11('0x9')](),controller['index']);router[_0x1b11('0x8')](_0x1b11('0xa'),auth[_0x1b11('0x9')](),controller['show']);router[_0x1b11('0x8')](_0x1b11('0xb'),auth[_0x1b11('0x9')](),controller[_0x1b11('0xc')]);router[_0x1b11('0xd')]('/',auth[_0x1b11('0x9')](),controller[_0x1b11('0xe')]);router[_0x1b11('0xf')](_0x1b11('0xa'),auth[_0x1b11('0x9')](),controller['update']);router['delete'](_0x1b11('0xa'),auth[_0x1b11('0x9')](),controller[_0x1b11('0x10')]);module[_0x1b11('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index fd41bb3..26c0284 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 _0x6661=['default','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','custom'];(function(_0x59e5cf,_0x506693){var _0x5a8839=function(_0x6ed328){while(--_0x6ed328){_0x59e5cf['push'](_0x59e5cf['shift']());}};_0x5a8839(++_0x506693);}(_0x6661,0xb5));var _0x1666=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6661[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x1666('0x0'));module[_0x1666('0x1')]={'name':{'type':Sequelize[_0x1666('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1666('0x2')]},'active':{'type':Sequelize[_0x1666('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1666('0x2')],'allowNull':![],'defaultValue':_0x1666('0x4')},'startAt':{'type':Sequelize[_0x1666('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1666('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1666('0x6')]('years',_0x1666('0x7'),_0x1666('0x8'),_0x1666('0x9'),'days',_0x1666('0xa'),_0x1666('0xb')),'allowNull':![],'defaultValue':_0x1666('0xc')},'output':{'type':Sequelize[_0x1666('0x6')](_0x1666('0xd'),_0x1666('0xe'),_0x1666('0xf')),'allowNull':![],'defaultValue':_0x1666('0xd')},'type':{'type':Sequelize[_0x1666('0x6')](_0x1666('0x10'),_0x1666('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf0e5=['DATE','quarters','weeks','days','hours','minutes','ENUM','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x334f2e,_0x36bde4){var _0x5baa87=function(_0x1e4323){while(--_0x1e4323){_0x334f2e['push'](_0x334f2e['shift']());}};_0x5baa87(++_0x36bde4);}(_0xf0e5,0x18b));var _0x5f0e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf0e5[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x5f0e('0x0'));module[_0x5f0e('0x1')]={'name':{'type':Sequelize[_0x5f0e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5f0e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f0e('0x4')},'startAt':{'type':Sequelize[_0x5f0e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5f0e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x5f0e('0x6'),'months',_0x5f0e('0x7'),_0x5f0e('0x8'),_0x5f0e('0x9'),_0x5f0e('0xa')),'allowNull':![],'defaultValue':_0x5f0e('0x8')},'output':{'type':Sequelize[_0x5f0e('0xb')](_0x5f0e('0xc'),_0x5f0e('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x5f0e('0xc')},'type':{'type':Sequelize[_0x5f0e('0xb')]('custom','default'),'allowNull':![],'defaultValue':_0x5f0e('0xe')},'sendMail':{'type':Sequelize[_0x5f0e('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5f0e('0xf')]},'bcc':{'type':Sequelize[_0x5f0e('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9a0214a..c2c60d9 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 _0x9fb4=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','index','map','Schedule','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','rows','catch','show','params','keys','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x286ee4,_0x255a92){var _0x300e4c=function(_0x21637b){while(--_0x21637b){_0x286ee4['push'](_0x286ee4['shift']());}};_0x300e4c(++_0x255a92);}(_0x9fb4,0x1c6));var _0x49fb=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x9fb4[_0x4a7193];return _0xc33d94;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49fb('0x0'));var jsonpatch=require(_0x49fb('0x1'));var rp=require(_0x49fb('0x2'));var moment=require(_0x49fb('0x3'));var BPromise=require(_0x49fb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x49fb('0x5'));var csv=require(_0x49fb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49fb('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x49fb('0x8'));var jsforce=require(_0x49fb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x49fb('0x6'));var querystring=require('querystring');var Papa=require(_0x49fb('0xa'));var Redis=require('ioredis');var authService=require(_0x49fb('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x49fb('0xc'));var hardwareService=require(_0x49fb('0xd'));var logger=require(_0x49fb('0xe'))(_0x49fb('0xf'));var utils=require(_0x49fb('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x49fb('0x11'));var db=require(_0x49fb('0x12'))['db'];function respondWithStatusCode(_0x547501,_0x3a7ac){_0x3a7ac=_0x3a7ac||0xcc;return function(_0xc05d5d){if(_0xc05d5d){return _0x547501['sendStatus'](_0x3a7ac);}return _0x547501[_0x49fb('0x13')](_0x3a7ac)['end']();};}function respondWithResult(_0x1d00af,_0xf7aa7d){_0xf7aa7d=_0xf7aa7d||0xc8;return function(_0x40802f){if(_0x40802f){return _0x1d00af['status'](_0xf7aa7d)[_0x49fb('0x14')](_0x40802f);}};}function respondWithFilteredResult(_0x2afa60,_0x175248){return function(_0x7682b6){if(_0x7682b6){var _0x5a6496=typeof _0x175248[_0x49fb('0x15')]===_0x49fb('0x16')&&typeof _0x175248['limit']===_0x49fb('0x16');var _0x4c9ede=_0x7682b6['count'];var _0x44e1e9=_0x5a6496?0x0:_0x175248['offset'];var _0x3af98e=_0x5a6496?_0x7682b6['count']:_0x175248[_0x49fb('0x15')]+_0x175248['limit'];var _0x453cb5;if(_0x3af98e>=_0x4c9ede){_0x3af98e=_0x4c9ede;_0x453cb5=0xc8;}else{_0x453cb5=0xce;}_0x2afa60[_0x49fb('0x13')](_0x453cb5);return _0x2afa60['set'](_0x49fb('0x17'),_0x44e1e9+'-'+_0x3af98e+'/'+_0x4c9ede)['json'](_0x7682b6);}return null;};}function patchUpdates(_0x3568df){return function(_0x10118a){try{jsonpatch[_0x49fb('0x18')](_0x10118a,_0x3568df,!![]);}catch(_0x1632b6){return BPromise[_0x49fb('0x19')](_0x1632b6);}return _0x10118a[_0x49fb('0x1a')]();};}function saveUpdates(_0x256eec,_0x3148ea){return function(_0x11e787){if(_0x11e787){return _0x11e787[_0x49fb('0x1b')](_0x256eec)['then'](function(_0x483db9){return _0x483db9;});}return null;};}function removeEntity(_0x3c64a9,_0x270ba6){return function(_0x3b99c0){if(_0x3b99c0){return _0x3b99c0[_0x49fb('0x1c')]()[_0x49fb('0x1d')](function(){var _0x13658a=_0x3b99c0[_0x49fb('0x1e')]({'plain':!![]});var _0x4205eb='Scheduler';return db[_0x49fb('0x1f')]['destroy']({'where':{'type':_0x4205eb,'resourceId':_0x13658a['id']}})[_0x49fb('0x1d')](function(){return _0x3b99c0;});})['then'](function(){_0x3c64a9['status'](0xcc)[_0x49fb('0x20')]();});}};}function handleEntityNotFound(_0x473ba7,_0x187372){return function(_0x102db2){if(!_0x102db2){_0x473ba7[_0x49fb('0x21')](0x194);}return _0x102db2;};}function handleError(_0x1dc428,_0x5184da){_0x5184da=_0x5184da||0x1f4;return function(_0x132a7e){logger[_0x49fb('0x22')](_0x132a7e[_0x49fb('0x23')]);if(_0x132a7e[_0x49fb('0x24')]){delete _0x132a7e[_0x49fb('0x24')];}_0x1dc428[_0x49fb('0x13')](_0x5184da)['send'](_0x132a7e);};}exports[_0x49fb('0x25')]=function(_0x12bc64,_0x107565){var _0x55e635={},_0x2c5326={},_0x31442e={'count':0x0,'rows':[]};var _0x211cc7=_[_0x49fb('0x26')](db[_0x49fb('0x27')][_0x49fb('0x28')],function(_0x2e71a5){return{'name':_0x2e71a5[_0x49fb('0x29')],'type':_0x2e71a5['type']['key']};});_0x2c5326[_0x49fb('0x2a')]=_[_0x49fb('0x26')](_0x211cc7,_0x49fb('0x24'));_0x2c5326[_0x49fb('0x2b')]=_['keys'](_0x12bc64['query']);_0x2c5326[_0x49fb('0x2c')]=_['intersection'](_0x2c5326['model'],_0x2c5326['query']);_0x55e635['attributes']=_[_0x49fb('0x2d')](_0x2c5326[_0x49fb('0x2a')],qs[_0x49fb('0x2e')](_0x12bc64[_0x49fb('0x2b')][_0x49fb('0x2e')]));_0x55e635[_0x49fb('0x2f')]=_0x55e635['attributes'][_0x49fb('0x30')]?_0x55e635['attributes']:_0x2c5326[_0x49fb('0x2a')];if(!_0x12bc64[_0x49fb('0x2b')]['hasOwnProperty'](_0x49fb('0x31'))){_0x55e635[_0x49fb('0x32')]=qs[_0x49fb('0x32')](_0x12bc64[_0x49fb('0x2b')][_0x49fb('0x32')]);_0x55e635[_0x49fb('0x15')]=qs['offset'](_0x12bc64['query'][_0x49fb('0x15')]);}_0x55e635[_0x49fb('0x33')]=qs[_0x49fb('0x34')](_0x12bc64['query']['sort']);_0x55e635[_0x49fb('0x35')]=qs['filters'](_[_0x49fb('0x36')](_0x12bc64[_0x49fb('0x2b')],_0x2c5326[_0x49fb('0x2c')]),_0x211cc7);if(_0x12bc64[_0x49fb('0x2b')][_0x49fb('0x37')]){_0x55e635[_0x49fb('0x35')]=_[_0x49fb('0x38')](_0x55e635[_0x49fb('0x35')],{'$or':_['map'](_0x211cc7,function(_0x439335){if(_0x439335[_0x49fb('0x39')]!==_0x49fb('0x3a')){var _0x54a140={};_0x54a140[_0x439335[_0x49fb('0x24')]]={'$like':'%'+_0x12bc64['query']['filter']+'%'};return _0x54a140;}})});}_0x55e635=_[_0x49fb('0x38')]({},_0x55e635,_0x12bc64[_0x49fb('0x3b')]);var _0xa4f5f8={'where':_0x55e635[_0x49fb('0x35')]};return db[_0x49fb('0x27')]['count'](_0xa4f5f8)[_0x49fb('0x1d')](function(_0x541d30){_0x31442e[_0x49fb('0x3c')]=_0x541d30;if(_0x12bc64[_0x49fb('0x2b')]['includeAll']){_0x55e635[_0x49fb('0x3d')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x55e635);})[_0x49fb('0x1d')](function(_0xa84e32){_0x31442e[_0x49fb('0x3e')]=_0xa84e32;return _0x31442e;})[_0x49fb('0x1d')](respondWithFilteredResult(_0x107565,_0x55e635))[_0x49fb('0x3f')](handleError(_0x107565,null));};exports[_0x49fb('0x40')]=function(_0x54a300,_0x2d9c26){var _0x51fc66={'raw':![],'where':{'id':_0x54a300[_0x49fb('0x41')]['id']}},_0x341694={};_0x341694[_0x49fb('0x2a')]=_[_0x49fb('0x42')](db[_0x49fb('0x27')][_0x49fb('0x28')]);_0x341694[_0x49fb('0x2b')]=_[_0x49fb('0x42')](_0x54a300['query']);_0x341694[_0x49fb('0x2c')]=_['intersection'](_0x341694[_0x49fb('0x2a')],_0x341694[_0x49fb('0x2b')]);_0x51fc66[_0x49fb('0x2f')]=_[_0x49fb('0x2d')](_0x341694[_0x49fb('0x2a')],qs['fields'](_0x54a300[_0x49fb('0x2b')][_0x49fb('0x2e')]));_0x51fc66[_0x49fb('0x2f')]=_0x51fc66[_0x49fb('0x2f')][_0x49fb('0x30')]?_0x51fc66[_0x49fb('0x2f')]:_0x341694[_0x49fb('0x2a')];if(_0x54a300[_0x49fb('0x2b')]['includeAll']){_0x51fc66[_0x49fb('0x3d')]=[{'all':!![]}];}_0x51fc66=_[_0x49fb('0x38')]({},_0x51fc66,_0x54a300['options']);return db[_0x49fb('0x27')][_0x49fb('0x43')](_0x51fc66)[_0x49fb('0x1d')](handleEntityNotFound(_0x2d9c26,null))[_0x49fb('0x1d')](respondWithResult(_0x2d9c26,null))[_0x49fb('0x3f')](handleError(_0x2d9c26,null));};exports[_0x49fb('0x44')]=function(_0x5e914b,_0x4ef9f3){return db[_0x49fb('0x27')][_0x49fb('0x44')](_0x5e914b[_0x49fb('0x45')],{})['then'](function(_0xee50a5){var _0x214ac7=_0x5e914b[_0x49fb('0x46')][_0x49fb('0x1e')]({'plain':!![]});if(!_0x214ac7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x214ac7[_0x49fb('0x47')]==='user'){var _0x31eb5d=_0xee50a5[_0x49fb('0x1e')]({'plain':!![]});var _0x173c7a=_0x49fb('0x48');return db[_0x49fb('0x49')][_0x49fb('0x43')]({'where':{'name':_0x173c7a,'userProfileId':_0x214ac7[_0x49fb('0x4a')]},'raw':!![]})['then'](function(_0x12bda1){if(_0x12bda1&&_0x12bda1[_0x49fb('0x4b')]===0x0){return db['UserProfileResource'][_0x49fb('0x44')]({'name':_0x31eb5d[_0x49fb('0x24')],'resourceId':_0x31eb5d['id'],'type':_0x12bda1[_0x49fb('0x24')],'sectionId':_0x12bda1['id']},{})[_0x49fb('0x1d')](function(){return _0xee50a5;});}else{return _0xee50a5;}})[_0x49fb('0x3f')](function(_0x56fdae){logger['error'](_0x49fb('0x4c'),_0x56fdae);throw _0x56fdae;});}return _0xee50a5;})[_0x49fb('0x1d')](respondWithResult(_0x4ef9f3,0xc9))[_0x49fb('0x3f')](handleError(_0x4ef9f3,null));};exports[_0x49fb('0x1b')]=function(_0x7df199,_0x5b1baf){if(_0x7df199[_0x49fb('0x45')]['id']){delete _0x7df199[_0x49fb('0x45')]['id'];}return db[_0x49fb('0x27')][_0x49fb('0x43')]({'where':{'id':_0x7df199[_0x49fb('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b1baf,null))['then'](saveUpdates(_0x7df199[_0x49fb('0x45')],null))['then'](respondWithResult(_0x5b1baf,null))[_0x49fb('0x3f')](handleError(_0x5b1baf,null));};exports[_0x49fb('0x1c')]=function(_0x52c4d1,_0x3b27ff){return db[_0x49fb('0x27')][_0x49fb('0x43')]({'where':{'id':_0x52c4d1[_0x49fb('0x41')]['id']}})[_0x49fb('0x1d')](handleEntityNotFound(_0x3b27ff,null))[_0x49fb('0x1d')](removeEntity(_0x3b27ff,null))['catch'](handleError(_0x3b27ff,null));};exports['run']=function(_0x29bad2,_0x373f6c,_0x56da81){var _0x2bd823=require('../../config/schedule');return db[_0x49fb('0x27')]['find']({'where':{'id':_0x29bad2[_0x49fb('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x373f6c,null))[_0x49fb('0x1d')](function(){_0x2bd823[_0x49fb('0x4d')](_0x29bad2['params']['id']);})[_0x49fb('0x1d')](respondWithStatusCode(_0x373f6c,null))['catch'](handleError(_0x373f6c,null));}; \ No newline at end of file +var _0xdcb8=['end','status','json','undefined','limit','offset','count','set','Content-Range','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','Schedule','rows','catch','show','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x541af8,_0xdc7f81){var _0x440260=function(_0x261ca3){while(--_0x261ca3){_0x541af8['push'](_0x541af8['shift']());}};_0x440260(++_0xdc7f81);}(_0xdcb8,0x8e));var _0x8dcb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcb8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x8dcb('0x0'));var rimraf=require(_0x8dcb('0x1'));var zipdir=require(_0x8dcb('0x2'));var jsonpatch=require(_0x8dcb('0x3'));var rp=require(_0x8dcb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8dcb('0x5'));var util=require('util');var path=require(_0x8dcb('0x6'));var sox=require(_0x8dcb('0x7'));var csv=require(_0x8dcb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dcb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8dcb('0xa'));var jsforce=require(_0x8dcb('0xb'));var deskjs=require(_0x8dcb('0xc'));var toCsv=require(_0x8dcb('0x8'));var querystring=require(_0x8dcb('0xd'));var Papa=require(_0x8dcb('0xe'));var Redis=require(_0x8dcb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8dcb('0x10'));var as=require(_0x8dcb('0x11'));var hardwareService=require(_0x8dcb('0x12'));var logger=require('../../config/logger')(_0x8dcb('0x13'));var utils=require(_0x8dcb('0x14'));var config=require(_0x8dcb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dcb('0x16'))['db'];function respondWithStatusCode(_0x207e6f,_0x5603ea){_0x5603ea=_0x5603ea||0xcc;return function(_0x118892){if(_0x118892){return _0x207e6f[_0x8dcb('0x17')](_0x5603ea);}return _0x207e6f['status'](_0x5603ea)[_0x8dcb('0x18')]();};}function respondWithResult(_0x5eb34f,_0x163d28){_0x163d28=_0x163d28||0xc8;return function(_0x227f00){if(_0x227f00){return _0x5eb34f[_0x8dcb('0x19')](_0x163d28)[_0x8dcb('0x1a')](_0x227f00);}};}function respondWithFilteredResult(_0x5c2ffd,_0x4eab43){return function(_0x4fab7d){if(_0x4fab7d){var _0x4182d2=typeof _0x4eab43['offset']===_0x8dcb('0x1b')&&typeof _0x4eab43[_0x8dcb('0x1c')]===_0x8dcb('0x1b');var _0x121ce1=_0x4fab7d['count'];var _0xa4804c=_0x4182d2?0x0:_0x4eab43[_0x8dcb('0x1d')];var _0x52894e=_0x4182d2?_0x4fab7d[_0x8dcb('0x1e')]:_0x4eab43['offset']+_0x4eab43[_0x8dcb('0x1c')];var _0x916c4a;if(_0x52894e>=_0x121ce1){_0x52894e=_0x121ce1;_0x916c4a=0xc8;}else{_0x916c4a=0xce;}_0x5c2ffd['status'](_0x916c4a);return _0x5c2ffd[_0x8dcb('0x1f')](_0x8dcb('0x20'),_0xa4804c+'-'+_0x52894e+'/'+_0x121ce1)['json'](_0x4fab7d);}return null;};}function patchUpdates(_0x5b6f3d){return function(_0x55788c){try{jsonpatch['apply'](_0x55788c,_0x5b6f3d,!![]);}catch(_0x562a57){return BPromise['reject'](_0x562a57);}return _0x55788c['save']();};}function saveUpdates(_0x3cefc0,_0x152b95){return function(_0x375885){if(_0x375885){return _0x375885['update'](_0x3cefc0)[_0x8dcb('0x21')](function(_0x44cd41){return _0x44cd41;});}return null;};}function removeEntity(_0x4493ca,_0x346e76){return function(_0x33ab0e){if(_0x33ab0e){return _0x33ab0e[_0x8dcb('0x22')]()[_0x8dcb('0x21')](function(){var _0x13bec5=_0x33ab0e[_0x8dcb('0x23')]({'plain':!![]});var _0xcb9e95='Scheduler';return db[_0x8dcb('0x24')][_0x8dcb('0x22')]({'where':{'type':_0xcb9e95,'resourceId':_0x13bec5['id']}})[_0x8dcb('0x21')](function(){return _0x33ab0e;});})[_0x8dcb('0x21')](function(){_0x4493ca['status'](0xcc)[_0x8dcb('0x18')]();});}};}function handleEntityNotFound(_0x1972de,_0x34f1b1){return function(_0xc0682){if(!_0xc0682){_0x1972de['sendStatus'](0x194);}return _0xc0682;};}function handleError(_0x242687,_0x4c243a){_0x4c243a=_0x4c243a||0x1f4;return function(_0x2862ea){logger[_0x8dcb('0x25')](_0x2862ea['stack']);if(_0x2862ea[_0x8dcb('0x26')]){delete _0x2862ea[_0x8dcb('0x26')];}_0x242687[_0x8dcb('0x19')](_0x4c243a)[_0x8dcb('0x27')](_0x2862ea);};}exports[_0x8dcb('0x28')]=function(_0xf859d0,_0x3f9f5b){var _0x185656={},_0xd4d608={},_0x43df29={'count':0x0,'rows':[]};var _0x14fcd8=_['map'](db['Schedule'][_0x8dcb('0x29')],function(_0xb7ed2b){return{'name':_0xb7ed2b[_0x8dcb('0x2a')],'type':_0xb7ed2b[_0x8dcb('0x2b')][_0x8dcb('0x2c')]};});_0xd4d608[_0x8dcb('0x2d')]=_[_0x8dcb('0x2e')](_0x14fcd8,'name');_0xd4d608[_0x8dcb('0x2f')]=_[_0x8dcb('0x30')](_0xf859d0[_0x8dcb('0x2f')]);_0xd4d608[_0x8dcb('0x31')]=_[_0x8dcb('0x32')](_0xd4d608['model'],_0xd4d608[_0x8dcb('0x2f')]);_0x185656[_0x8dcb('0x33')]=_['intersection'](_0xd4d608['model'],qs[_0x8dcb('0x34')](_0xf859d0[_0x8dcb('0x2f')]['fields']));_0x185656[_0x8dcb('0x33')]=_0x185656[_0x8dcb('0x33')][_0x8dcb('0x35')]?_0x185656['attributes']:_0xd4d608['model'];if(!_0xf859d0[_0x8dcb('0x2f')][_0x8dcb('0x36')](_0x8dcb('0x37'))){_0x185656[_0x8dcb('0x1c')]=qs['limit'](_0xf859d0[_0x8dcb('0x2f')][_0x8dcb('0x1c')]);_0x185656[_0x8dcb('0x1d')]=qs[_0x8dcb('0x1d')](_0xf859d0[_0x8dcb('0x2f')]['offset']);}_0x185656[_0x8dcb('0x38')]=qs['sort'](_0xf859d0[_0x8dcb('0x2f')][_0x8dcb('0x39')]);_0x185656['where']=qs['filters'](_[_0x8dcb('0x3a')](_0xf859d0[_0x8dcb('0x2f')],_0xd4d608[_0x8dcb('0x31')]),_0x14fcd8);if(_0xf859d0[_0x8dcb('0x2f')]['filter']){_0x185656[_0x8dcb('0x3b')]=_[_0x8dcb('0x3c')](_0x185656[_0x8dcb('0x3b')],{'$or':_['map'](_0x14fcd8,function(_0x40e18b){if(_0x40e18b['type']!==_0x8dcb('0x3d')){var _0x2e5ff7={};_0x2e5ff7[_0x40e18b['name']]={'$like':'%'+_0xf859d0[_0x8dcb('0x2f')][_0x8dcb('0x3e')]+'%'};return _0x2e5ff7;}})});}_0x185656=_[_0x8dcb('0x3c')]({},_0x185656,_0xf859d0[_0x8dcb('0x3f')]);var _0x13798c={'where':_0x185656['where']};return db['Schedule'][_0x8dcb('0x1e')](_0x13798c)[_0x8dcb('0x21')](function(_0x44ea22){_0x43df29[_0x8dcb('0x1e')]=_0x44ea22;if(_0xf859d0[_0x8dcb('0x2f')]['includeAll']){_0x185656[_0x8dcb('0x40')]=[{'all':!![]}];}return db[_0x8dcb('0x41')]['findAll'](_0x185656);})[_0x8dcb('0x21')](function(_0x566fa1){_0x43df29[_0x8dcb('0x42')]=_0x566fa1;return _0x43df29;})[_0x8dcb('0x21')](respondWithFilteredResult(_0x3f9f5b,_0x185656))[_0x8dcb('0x43')](handleError(_0x3f9f5b,null));};exports[_0x8dcb('0x44')]=function(_0x445c96,_0xfc3ace){var _0x479caf={'raw':![],'where':{'id':_0x445c96['params']['id']}},_0xec4a1={};_0xec4a1['model']=_['keys'](db['Schedule'][_0x8dcb('0x29')]);_0xec4a1[_0x8dcb('0x2f')]=_[_0x8dcb('0x30')](_0x445c96[_0x8dcb('0x2f')]);_0xec4a1['filters']=_[_0x8dcb('0x32')](_0xec4a1[_0x8dcb('0x2d')],_0xec4a1[_0x8dcb('0x2f')]);_0x479caf[_0x8dcb('0x33')]=_[_0x8dcb('0x32')](_0xec4a1[_0x8dcb('0x2d')],qs[_0x8dcb('0x34')](_0x445c96[_0x8dcb('0x2f')][_0x8dcb('0x34')]));_0x479caf[_0x8dcb('0x33')]=_0x479caf['attributes']['length']?_0x479caf[_0x8dcb('0x33')]:_0xec4a1[_0x8dcb('0x2d')];if(_0x445c96[_0x8dcb('0x2f')][_0x8dcb('0x45')]){_0x479caf['include']=[{'all':!![]}];}_0x479caf=_[_0x8dcb('0x3c')]({},_0x479caf,_0x445c96[_0x8dcb('0x3f')]);return db[_0x8dcb('0x41')][_0x8dcb('0x46')](_0x479caf)['then'](handleEntityNotFound(_0xfc3ace,null))[_0x8dcb('0x21')](respondWithResult(_0xfc3ace,null))[_0x8dcb('0x43')](handleError(_0xfc3ace,null));};exports[_0x8dcb('0x47')]=function(_0x5427c2,_0x30f58c){return db[_0x8dcb('0x41')][_0x8dcb('0x47')](_0x5427c2['body'],{})[_0x8dcb('0x21')](function(_0x3d10c9){var _0x89f971=_0x5427c2['user'][_0x8dcb('0x23')]({'plain':!![]});if(!_0x89f971)throw new Error(_0x8dcb('0x48'));if(_0x89f971[_0x8dcb('0x49')]===_0x8dcb('0x4a')){var _0x45017e=_0x3d10c9[_0x8dcb('0x23')]({'plain':!![]});var _0x2ecc16='Scheduler';return db[_0x8dcb('0x4b')]['find']({'where':{'name':_0x2ecc16,'userProfileId':_0x89f971['userProfileId']},'raw':!![]})[_0x8dcb('0x21')](function(_0x4d48b9){if(_0x4d48b9&&_0x4d48b9[_0x8dcb('0x4c')]===0x0){return db[_0x8dcb('0x24')][_0x8dcb('0x47')]({'name':_0x45017e[_0x8dcb('0x26')],'resourceId':_0x45017e['id'],'type':_0x4d48b9[_0x8dcb('0x26')],'sectionId':_0x4d48b9['id']},{})[_0x8dcb('0x21')](function(){return _0x3d10c9;});}else{return _0x3d10c9;}})[_0x8dcb('0x43')](function(_0x434512){logger[_0x8dcb('0x25')](_0x8dcb('0x4d'),_0x434512);throw _0x434512;});}return _0x3d10c9;})[_0x8dcb('0x21')](respondWithResult(_0x30f58c,0xc9))['catch'](handleError(_0x30f58c,null));};exports[_0x8dcb('0x4e')]=function(_0xfba212,_0x1c3f04){if(_0xfba212['body']['id']){delete _0xfba212[_0x8dcb('0x4f')]['id'];}return db[_0x8dcb('0x41')][_0x8dcb('0x46')]({'where':{'id':_0xfba212['params']['id']}})['then'](handleEntityNotFound(_0x1c3f04,null))['then'](saveUpdates(_0xfba212['body'],null))[_0x8dcb('0x21')](respondWithResult(_0x1c3f04,null))[_0x8dcb('0x43')](handleError(_0x1c3f04,null));};exports[_0x8dcb('0x22')]=function(_0x1e687b,_0x506728){return db[_0x8dcb('0x41')][_0x8dcb('0x46')]({'where':{'id':_0x1e687b[_0x8dcb('0x50')]['id']}})[_0x8dcb('0x21')](handleEntityNotFound(_0x506728,null))[_0x8dcb('0x21')](removeEntity(_0x506728,null))['catch'](handleError(_0x506728,null));};exports[_0x8dcb('0x51')]=function(_0x18f336,_0x5d310b,_0x185150){var _0x456316=require(_0x8dcb('0x52'));return db['Schedule']['find']({'where':{'id':_0x18f336[_0x8dcb('0x50')]['id']},'raw':!![]})[_0x8dcb('0x21')](handleEntityNotFound(_0x5d310b,null))[_0x8dcb('0x21')](function(){_0x456316['run'](_0x18f336[_0x8dcb('0x50')]['id']);})[_0x8dcb('0x21')](respondWithStatusCode(_0x5d310b,null))['catch'](handleError(_0x5d310b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1fbb16f..a2de3e3 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 _0xf40d=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x186e95,_0x2fbad4){var _0x2c75d1=function(_0x371933){while(--_0x371933){_0x186e95['push'](_0x186e95['shift']());}};_0x2c75d1(++_0x2fbad4);}(_0xf40d,0x19d));var _0xdf40=function(_0x162b9e,_0x4bea8c){_0x162b9e=_0x162b9e-0x0;var _0x3b32b1=_0xf40d[_0x162b9e];return _0x3b32b1;};'use strict';var _=require(_0xdf40('0x0'));var util=require(_0xdf40('0x1'));var logger=require(_0xdf40('0x2'))(_0xdf40('0x3'));var moment=require('moment');var BPromise=require(_0xdf40('0x4'));var rp=require(_0xdf40('0x5'));var fs=require('fs');var path=require(_0xdf40('0x6'));var rimraf=require(_0xdf40('0x7'));var config=require(_0xdf40('0x8'));var attributes=require(_0xdf40('0x9'));module[_0xdf40('0xa')]=function(_0xda8931,_0x49c96a){return _0xda8931[_0xdf40('0xb')](_0xdf40('0xc'),attributes,{'tableName':_0xdf40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe803=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','api','moment'];(function(_0x33c467,_0x403332){var _0xbb4419=function(_0xef91da){while(--_0xef91da){_0x33c467['push'](_0x33c467['shift']());}};_0xbb4419(++_0x403332);}(_0xe803,0x1d0));var _0x3e80=function(_0x23e093,_0x12b602){_0x23e093=_0x23e093-0x0;var _0x48e7ac=_0xe803[_0x23e093];return _0x48e7ac;};'use strict';var _=require(_0x3e80('0x0'));var util=require(_0x3e80('0x1'));var logger=require('../../config/logger')(_0x3e80('0x2'));var moment=require(_0x3e80('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e80('0x4'));var fs=require('fs');var path=require(_0x3e80('0x5'));var rimraf=require(_0x3e80('0x6'));var config=require(_0x3e80('0x7'));var attributes=require(_0x3e80('0x8'));module[_0x3e80('0x9')]=function(_0x303850,_0x5074e7){return _0x303850['define'](_0x3e80('0xa'),attributes,{'tableName':_0x3e80('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 32e1b93..045f9f2 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 _0xcf0f=['Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info'];(function(_0x24eb13,_0x9bf446){var _0x36d230=function(_0x5308a7){while(--_0x5308a7){_0x24eb13['push'](_0x24eb13['shift']());}};_0x36d230(++_0x9bf446);}(_0xcf0f,0xef));var _0xfcf0=function(_0x5f360b,_0x14753e){_0x5f360b=_0x5f360b-0x0;var _0x217f89=_0xcf0f[_0x5f360b];return _0x217f89;};'use strict';var _=require(_0xfcf0('0x0'));var util=require(_0xfcf0('0x1'));var moment=require(_0xfcf0('0x2'));var BPromise=require(_0xfcf0('0x3'));var rs=require(_0xfcf0('0x4'));var fs=require('fs');var Redis=require(_0xfcf0('0x5'));var db=require(_0xfcf0('0x6'))['db'];var utils=require(_0xfcf0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfcf0('0x8'));var jayson=require(_0xfcf0('0x9'));var client=jayson['client'][_0xfcf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bacb6,_0x4b5104,_0x1e8f15){return new BPromise(function(_0xa57425,_0x446acf){return client[_0xfcf0('0xb')](_0x3bacb6,_0x1e8f15)['then'](function(_0x432f4a){logger[_0xfcf0('0xc')](_0xfcf0('0xd'),_0x4b5104,_0xfcf0('0xe'));logger['debug'](_0xfcf0('0xf'),_0x4b5104,_0xfcf0('0xe'),JSON[_0xfcf0('0x10')](_0x432f4a));if(_0x432f4a[_0xfcf0('0x11')]){if(_0x432f4a[_0xfcf0('0x11')]['code']===0x1f4){logger[_0xfcf0('0x11')]('Schedule,\x20%s,\x20%s',_0x4b5104,_0x432f4a[_0xfcf0('0x11')][_0xfcf0('0x12')]);return _0x446acf(_0x432f4a[_0xfcf0('0x11')][_0xfcf0('0x12')]);}logger[_0xfcf0('0x11')](_0xfcf0('0xd'),_0x4b5104,_0x432f4a[_0xfcf0('0x11')][_0xfcf0('0x12')]);return _0xa57425(_0x432f4a[_0xfcf0('0x11')][_0xfcf0('0x12')]);}else{logger[_0xfcf0('0xc')](_0xfcf0('0xd'),_0x4b5104,'request\x20sent');_0xa57425(_0x432f4a[_0xfcf0('0x13')][_0xfcf0('0x12')]);}})[_0xfcf0('0x14')](function(_0x427a6b){logger[_0xfcf0('0x11')](_0xfcf0('0xd'),_0x4b5104,_0x427a6b);_0x446acf(_0x427a6b);});});} \ No newline at end of file +var _0x4445=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Schedule,\x20%s,\x20%s'];(function(_0xb47ffb,_0x4a6f2d){var _0x20eb9f=function(_0x58ac8e){while(--_0x58ac8e){_0xb47ffb['push'](_0xb47ffb['shift']());}};_0x20eb9f(++_0x4a6f2d);}(_0x4445,0x150));var _0x5444=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x4445[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x5444('0x0'));var util=require(_0x5444('0x1'));var moment=require(_0x5444('0x2'));var BPromise=require('bluebird');var rs=require(_0x5444('0x3'));var fs=require('fs');var Redis=require(_0x5444('0x4'));var db=require(_0x5444('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5444('0x6'))(_0x5444('0x7'));var config=require(_0x5444('0x8'));var jayson=require(_0x5444('0x9'));var client=jayson[_0x5444('0xa')][_0x5444('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cfcd1,_0x1baedb,_0x1c4af3){return new BPromise(function(_0xbee3f6,_0x4eb490){return client['request'](_0x4cfcd1,_0x1c4af3)['then'](function(_0x5c18ea){logger[_0x5444('0xc')]('Schedule,\x20%s,\x20%s',_0x1baedb,'request\x20sent');logger[_0x5444('0xd')](_0x5444('0xe'),_0x1baedb,_0x5444('0xf'),JSON[_0x5444('0x10')](_0x5c18ea));if(_0x5c18ea['error']){if(_0x5c18ea[_0x5444('0x11')][_0x5444('0x12')]===0x1f4){logger[_0x5444('0x11')]('Schedule,\x20%s,\x20%s',_0x1baedb,_0x5c18ea['error'][_0x5444('0x13')]);return _0x4eb490(_0x5c18ea[_0x5444('0x11')][_0x5444('0x13')]);}logger[_0x5444('0x11')](_0x5444('0x14'),_0x1baedb,_0x5c18ea[_0x5444('0x11')][_0x5444('0x13')]);return _0xbee3f6(_0x5c18ea[_0x5444('0x11')]['message']);}else{logger[_0x5444('0xc')](_0x5444('0x14'),_0x1baedb,_0x5444('0xf'));_0xbee3f6(_0x5c18ea['result'][_0x5444('0x13')]);}})['catch'](function(_0x3bf958){logger[_0x5444('0x11')]('Schedule,\x20%s,\x20%s',_0x1baedb,_0x3bf958);_0x4eb490(_0x3bf958);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9e3cc5f..32af1a1 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 _0x6c71=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','create','put','destroy','multer','util','path','express','Router','fs-extra'];(function(_0xe0076,_0x3c039a){var _0x1f9f88=function(_0x35caa6){while(--_0x35caa6){_0xe0076['push'](_0xe0076['shift']());}};_0x1f9f88(++_0x3c039a);}(_0x6c71,0x72));var _0x16c7=function(_0x5766b0,_0xbba441){_0x5766b0=_0x5766b0-0x0;var _0x346211=_0x6c71[_0x5766b0];return _0x346211;};'use strict';var multer=require(_0x16c7('0x0'));var util=require(_0x16c7('0x1'));var path=require(_0x16c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x16c7('0x3'));var router=express[_0x16c7('0x4')]();var fs_extra=require(_0x16c7('0x5'));var auth=require(_0x16c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16c7('0x7'));var controller=require('./screenRecording.controller');router[_0x16c7('0x8')]('/',auth[_0x16c7('0x9')](),controller[_0x16c7('0xa')]);router[_0x16c7('0x8')](_0x16c7('0xb'),auth['isAuthenticated'](),controller[_0x16c7('0xc')]);router['get'](_0x16c7('0xd'),auth[_0x16c7('0x9')](),controller[_0x16c7('0xe')]);router[_0x16c7('0x8')](_0x16c7('0xf'),auth[_0x16c7('0x9')](),controller[_0x16c7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16c7('0x11')]);router[_0x16c7('0x12')](_0x16c7('0xd'),auth[_0x16c7('0x9')](),controller['update']);router['delete'](_0x16c7('0xd'),auth[_0x16c7('0x9')](),controller[_0x16c7('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc81d=['/describe','describe','/:id','show','download','create','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get'];(function(_0x3073b1,_0x349ef5){var _0x58d884=function(_0x52c47f){while(--_0x52c47f){_0x3073b1['push'](_0x3073b1['shift']());}};_0x58d884(++_0x349ef5);}(_0xc81d,0x9c));var _0xdc81=function(_0x59b8d5,_0x36dda0){_0x59b8d5=_0x59b8d5-0x0;var _0xaf26de=_0xc81d[_0x59b8d5];return _0xaf26de;};'use strict';var multer=require('multer');var util=require(_0xdc81('0x0'));var path=require(_0xdc81('0x1'));var timeout=require(_0xdc81('0x2'));var express=require(_0xdc81('0x3'));var router=express['Router']();var fs_extra=require(_0xdc81('0x4'));var auth=require(_0xdc81('0x5'));var interaction=require(_0xdc81('0x6'));var config=require(_0xdc81('0x7'));var controller=require(_0xdc81('0x8'));router['get']('/',auth[_0xdc81('0x9')](),controller[_0xdc81('0xa')]);router[_0xdc81('0xb')](_0xdc81('0xc'),auth[_0xdc81('0x9')](),controller[_0xdc81('0xd')]);router[_0xdc81('0xb')](_0xdc81('0xe'),auth['isAuthenticated'](),controller[_0xdc81('0xf')]);router[_0xdc81('0xb')]('/:id/download',auth[_0xdc81('0x9')](),controller[_0xdc81('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc81('0x11')]);router['put']('/:id',auth[_0xdc81('0x9')](),controller['update']);router[_0xdc81('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdc81('0x13')]);module[_0xdc81('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ea1cd12..1450285 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 _0xda2d=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x17723c,_0x1ea81d){var _0x1ffbf3=function(_0x5276cd){while(--_0x5276cd){_0x17723c['push'](_0x17723c['shift']());}};_0x1ffbf3(++_0x1ea81d);}(_0xda2d,0x102));var _0xdda2=function(_0x3ea0fc,_0x52c750){_0x3ea0fc=_0x3ea0fc-0x0;var _0x40bf04=_0xda2d[_0x3ea0fc];return _0x40bf04;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var config=require(_0xdda2('0x2'));module[_0xdda2('0x3')]={'format':{'type':Sequelize[_0xdda2('0x4')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0xdda2('0x5')](_0xdda2('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xdda2('0x7')]},'channel':{'type':Sequelize[_0xdda2('0x7')]},'value':{'type':Sequelize[_0xdda2('0x7')],'set':function(_0xf38e58){var _0x2f55dc=_0xf38e58[_0xdda2('0x8')](/\\/g,'/');this[_0xdda2('0x9')](_0xdda2('0x6'),_0x2f55dc);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdda2('0xa')],'set':function(_0x22c6e5){this['setDataValue'](_0xdda2('0xb'),moment()[_0xdda2('0xc')](_0x22c6e5,'ms'));this[_0xdda2('0x9')](_0xdda2('0xd'),moment());this[_0xdda2('0x9')](_0xdda2('0xe'),_0x22c6e5);}},'startedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xdda2('0x10')]();}},'closedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')](_0xdda2('0xd')))[_0xdda2('0x11')](_0xdda2('0x12'))[_0xdda2('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdda2('0x5')]('createdAt'))[_0xdda2('0x11')](_0xdda2('0x12'))[_0xdda2('0x10')]();}},'updatedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')]('updatedAt'))['format'](_0xdda2('0x12'))['toString']();}}}; \ No newline at end of file +var _0x88c3=['subtract','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','path','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','INTEGER'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x88c3,0x1ee));var _0x388c=function(_0x41de4e,_0x3eabc4){_0x41de4e=_0x41de4e-0x0;var _0x3497ce=_0x88c3[_0x41de4e];return _0x3497ce;};'use strict';var Sequelize=require(_0x388c('0x0'));var moment=require('moment');var path=require(_0x388c('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x388c('0x2')],'get':function(){return this['getDataValue']('value')?path[_0x388c('0x3')](this[_0x388c('0x4')](_0x388c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x388c('0x6')]},'channel':{'type':Sequelize[_0x388c('0x6')]},'value':{'type':Sequelize[_0x388c('0x6')],'set':function(_0x5a1c0d){var _0x3e79d8=_0x5a1c0d[_0x388c('0x7')](/\\/g,'/');this[_0x388c('0x8')](_0x388c('0x5'),_0x3e79d8);}},'rating':{'type':Sequelize[_0x388c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x388c('0x9')],'set':function(_0x2debe9){this[_0x388c('0x8')]('startedAt',moment()[_0x388c('0xa')](_0x2debe9,'ms'));this['setDataValue']('closedAt',moment());this[_0x388c('0x8')](_0x388c('0xb'),_0x2debe9);}},'startedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this[_0x388c('0x4')](_0x388c('0xd')))[_0x388c('0xe')](_0x388c('0xf'))[_0x388c('0x10')]();}},'closedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0x388c('0xf'))[_0x388c('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x388c('0x4')](_0x388c('0x11')))['format']('MM-DD-YYYY\x20HH:mm')[_0x388c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this[_0x388c('0x4')]('updatedAt'))[_0x388c('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x388c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 21e426b..55c6982 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x105fab,_0x13db00){var _0x55e880=function(_0x102062){while(--_0x102062){_0x105fab['push'](_0x105fab['shift']());}};_0x55e880(++_0x13db00);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x00bb[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xae24,0x182));var _0x4ae2=function(_0x5b9239,_0x19b0ef){_0x5b9239=_0x5b9239-0x0;var _0x54f551=_0xae24[_0x5b9239];return _0x54f551;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 6ad16fb..6b60a58 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 _0x658d=['interactionid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','define'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x658d,0xc9));var _0xd658=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x658d[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xd658('0x0'));var util=require(_0xd658('0x1'));var logger=require(_0xd658('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd658('0x3'));var rp=require(_0xd658('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd658('0x5'));var config=require('../../config/environment');var attributes=require(_0xd658('0x6'));module[_0xd658('0x7')]=function(_0x3ee4a7,_0x1c2a61){return _0x3ee4a7[_0xd658('0x8')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xd658('0x9'),'fields':[_0xd658('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3483=['rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xd5a250,_0x2b0314){var _0x696493=function(_0x2b8ec2){while(--_0x2b8ec2){_0xd5a250['push'](_0xd5a250['shift']());}};_0x696493(++_0x2b0314);}(_0x3483,0x14f));var _0x3348=function(_0x5c96b8,_0xfc6e63){_0x5c96b8=_0x5c96b8-0x0;var _0x30d645=_0x3483[_0x5c96b8];return _0x30d645;};'use strict';var _=require(_0x3348('0x0'));var util=require(_0x3348('0x1'));var logger=require(_0x3348('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3348('0x3'));var rp=require(_0x3348('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3348('0x5'));var config=require('../../config/environment');var attributes=require(_0x3348('0x6'));module[_0x3348('0x7')]=function(_0x5518ba,_0x6641f0){return _0x5518ba['define']('ScreenRecording',attributes,{'tableName':_0x3348('0x8'),'paranoid':![],'indexes':[{'name':_0x3348('0x9'),'fields':[_0x3348('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2b755ae..a33d80e 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 _0xfae3=['../../mysqldb','rpc','client','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x31662e,_0x3476b2){var _0x4e1ff9=function(_0x3e1d8d){while(--_0x3e1d8d){_0x31662e['push'](_0x31662e['shift']());}};_0x4e1ff9(++_0x3476b2);}(_0xfae3,0x1de));var _0x3fae=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0xfae3[_0x258257];return _0xafb58a;};'use strict';var _=require(_0x3fae('0x0'));var util=require(_0x3fae('0x1'));var moment=require(_0x3fae('0x2'));var BPromise=require(_0x3fae('0x3'));var rs=require(_0x3fae('0x4'));var fs=require('fs');var Redis=require(_0x3fae('0x5'));var db=require(_0x3fae('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3fae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3fae('0x8')][_0x3fae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe513f1,_0x3ad75e,_0x3c2096){return new BPromise(function(_0x195538,_0x4c5536){return client[_0x3fae('0xa')](_0xe513f1,_0x3c2096)[_0x3fae('0xb')](function(_0x162aca){logger['info'](_0x3fae('0xc'),_0x3ad75e,'request\x20sent');logger[_0x3fae('0xd')](_0x3fae('0xe'),_0x3ad75e,'request\x20sent',JSON[_0x3fae('0xf')](_0x162aca));if(_0x162aca[_0x3fae('0x10')]){if(_0x162aca[_0x3fae('0x10')][_0x3fae('0x11')]===0x1f4){logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x3ad75e,_0x162aca[_0x3fae('0x10')][_0x3fae('0x12')]);return _0x4c5536(_0x162aca[_0x3fae('0x10')][_0x3fae('0x12')]);}logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x3ad75e,_0x162aca[_0x3fae('0x10')][_0x3fae('0x12')]);return _0x195538(_0x162aca[_0x3fae('0x10')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x3ad75e,_0x3fae('0x13'));_0x195538(_0x162aca[_0x3fae('0x14')][_0x3fae('0x12')]);}})[_0x3fae('0x15')](function(_0x12bcdb){logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x3ad75e,_0x12bcdb);_0x4c5536(_0x12bcdb);});});} \ No newline at end of file +var _0xc01f=['rpc','../../config/environment','jayson/promise','client','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x365f3f,_0x5297f4){var _0x4c489c=function(_0x5d9104){while(--_0x5d9104){_0x365f3f['push'](_0x365f3f['shift']());}};_0x4c489c(++_0x5297f4);}(_0xc01f,0xaf));var _0xfc01=function(_0x200b00,_0x5e6540){_0x200b00=_0x200b00-0x0;var _0x4fc5b7=_0xc01f[_0x200b00];return _0x4fc5b7;};'use strict';var _=require('lodash');var util=require(_0xfc01('0x0'));var moment=require('moment');var BPromise=require(_0xfc01('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc01('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc01('0x3'));var logger=require(_0xfc01('0x4'))(_0xfc01('0x5'));var config=require(_0xfc01('0x6'));var jayson=require(_0xfc01('0x7'));var client=jayson[_0xfc01('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2935e7,_0x3bb21f,_0x2e46dc){return new BPromise(function(_0x1a2d7c,_0x2f8c16){return client[_0xfc01('0x9')](_0x2935e7,_0x2e46dc)[_0xfc01('0xa')](function(_0x18a9f9){logger['info'](_0xfc01('0xb'),_0x3bb21f,_0xfc01('0xc'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3bb21f,'request\x20sent',JSON[_0xfc01('0xd')](_0x18a9f9));if(_0x18a9f9[_0xfc01('0xe')]){if(_0x18a9f9['error'][_0xfc01('0xf')]===0x1f4){logger['error'](_0xfc01('0xb'),_0x3bb21f,_0x18a9f9[_0xfc01('0xe')][_0xfc01('0x10')]);return _0x2f8c16(_0x18a9f9[_0xfc01('0xe')][_0xfc01('0x10')]);}logger[_0xfc01('0xe')](_0xfc01('0xb'),_0x3bb21f,_0x18a9f9[_0xfc01('0xe')][_0xfc01('0x10')]);return _0x1a2d7c(_0x18a9f9[_0xfc01('0xe')][_0xfc01('0x10')]);}else{logger['info'](_0xfc01('0xb'),_0x3bb21f,'request\x20sent');_0x1a2d7c(_0x18a9f9['result'][_0xfc01('0x10')]);}})[_0xfc01('0x11')](function(_0x37e977){logger[_0xfc01('0xe')](_0xfc01('0xb'),_0x3bb21f,_0x37e977);_0x2f8c16(_0x37e977);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 5e19d94..295733c 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 _0x861e=['get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','/:id/preferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','logologin','post','addLogoLogin','preferred','/:id/favicon','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x3ae561,_0x539245){var _0xfc5149=function(_0x3863eb){while(--_0x3863eb){_0x3ae561['push'](_0x3ae561['shift']());}};_0xfc5149(++_0x539245);}(_0x861e,0xb0));var _0xe861=function(_0x5f0389,_0x1ff3d4){_0x5f0389=_0x5f0389-0x0;var _0x4538dd=_0x861e[_0x5f0389];return _0x4538dd;};'use strict';var multer=require(_0xe861('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe861('0x1'));var express=require(_0xe861('0x2'));var router=express[_0xe861('0x3')]();var fs_extra=require(_0xe861('0x4'));var auth=require(_0xe861('0x5'));var interaction=require(_0xe861('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router['get']('/',auth[_0xe861('0x7')](),controller[_0xe861('0x8')]);router[_0xe861('0x9')](_0xe861('0xa'),controller[_0xe861('0xb')]);router[_0xe861('0x9')](_0xe861('0xc'),controller[_0xe861('0xd')]);router['get'](_0xe861('0xe'),controller['getLogo']);router[_0xe861('0x9')](_0xe861('0xf'),controller['getLogoLogin']);router['get'](_0xe861('0x10'),controller['gdpr']);router[_0xe861('0x9')](_0xe861('0x11'),controller['getPreferred']);router[_0xe861('0x9')]('/:id/favicon',controller[_0xe861('0x12')]);var upload=multer({'storage':multer[_0xe861('0x13')]({'destination':function(_0x503b1c,_0x432a6f,_0x3fe315){_0x3fe315(null,path[_0xe861('0x14')](config[_0xe861('0x15')],_0xe861('0x16')));},'filename':function(_0x4a4bd3,_0x587a2c,_0x34174a){_0x34174a(null,util[_0xe861('0x17')](_0xe861('0x18'),_0xe861('0x19'),path[_0xe861('0x1a')](_0x587a2c[_0xe861('0x1b')])));}})});router['post'](_0xe861('0xe'),upload[_0xe861('0x1c')](_0xe861('0x1d')),controller[_0xe861('0x1e')]);var upload=multer({'storage':multer[_0xe861('0x13')]({'destination':function(_0x394bd8,_0x3deb78,_0x35a879){_0x35a879(null,path[_0xe861('0x14')](config[_0xe861('0x15')],_0xe861('0x16')));},'filename':function(_0x49cb98,_0xf148bf,_0x47450d){_0x47450d(null,util[_0xe861('0x17')](_0xe861('0x18'),_0xe861('0x1f'),path[_0xe861('0x1a')](_0xf148bf['originalname'])));}})});router[_0xe861('0x20')]('/:id/logo_login',upload[_0xe861('0x1c')](_0xe861('0x1d')),controller[_0xe861('0x21')]);var upload=multer({'storage':multer[_0xe861('0x13')]({'destination':function(_0x4089a4,_0x2b99b0,_0x5f1f0a){_0x5f1f0a(null,path[_0xe861('0x14')](config['root'],_0xe861('0x16')));},'filename':function(_0x30a825,_0x4bd3ae,_0x275c50){_0x275c50(null,util[_0xe861('0x17')](_0xe861('0x18'),_0xe861('0x22'),path[_0xe861('0x1a')](_0x4bd3ae[_0xe861('0x1b')])));}})});router[_0xe861('0x20')](_0xe861('0x11'),upload[_0xe861('0x1c')](_0xe861('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x333d5,_0x2930f2,_0x56b697){_0x56b697(null,path[_0xe861('0x14')](config['root'],_0xe861('0x16')));},'filename':function(_0x454e4c,_0x4893f7,_0x15de13){_0x15de13(null,util[_0xe861('0x17')](_0xe861('0x18'),'favicon',path['extname'](_0x4893f7[_0xe861('0x1b')])));}})});router[_0xe861('0x20')](_0xe861('0x23'),upload[_0xe861('0x1c')]('file'),controller['addFavicon']);router['put'](_0xe861('0xc'),auth['isAuthenticated'](),controller['update']);module[_0xe861('0x24')]=router; \ No newline at end of file +var _0xd54d=['format','%s%s','preferred','addPreferred','favicon','put','/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','root','logo','extname','originalname','post','/:id/logo','file','addLogo','diskStorage','join','logologin','single','addLogoLogin','server/files/images/logos/'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd54d,0x8d));var _0xdd54=function(_0x27c5e9,_0x23d409){_0x27c5e9=_0x27c5e9-0x0;var _0xf547f2=_0xd54d[_0x27c5e9];return _0xf547f2;};'use strict';var multer=require('multer');var util=require(_0xdd54('0x0'));var path=require('path');var timeout=require(_0xdd54('0x1'));var express=require(_0xdd54('0x2'));var router=express[_0xdd54('0x3')]();var fs_extra=require(_0xdd54('0x4'));var auth=require(_0xdd54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdd54('0x6'));var controller=require(_0xdd54('0x7'));router['get']('/',auth[_0xdd54('0x8')](),controller[_0xdd54('0x9')]);router[_0xdd54('0xa')](_0xdd54('0xb'),controller['getDate']);router[_0xdd54('0xa')]('/:id',controller[_0xdd54('0xc')]);router[_0xdd54('0xa')]('/:id/logo',controller[_0xdd54('0xd')]);router[_0xdd54('0xa')](_0xdd54('0xe'),controller[_0xdd54('0xf')]);router[_0xdd54('0xa')](_0xdd54('0x10'),controller[_0xdd54('0x11')]);router[_0xdd54('0xa')](_0xdd54('0x12'),controller[_0xdd54('0x13')]);router[_0xdd54('0xa')](_0xdd54('0x14'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34cb94,_0x492215,_0x7ae428){_0x7ae428(null,path['join'](config[_0xdd54('0x15')],'server/files/images/logos/'));},'filename':function(_0x14226f,_0x251beb,_0x517d4f){_0x517d4f(null,util['format']('%s%s',_0xdd54('0x16'),path[_0xdd54('0x17')](_0x251beb[_0xdd54('0x18')])));}})});router[_0xdd54('0x19')](_0xdd54('0x1a'),upload['single'](_0xdd54('0x1b')),controller[_0xdd54('0x1c')]);var upload=multer({'storage':multer[_0xdd54('0x1d')]({'destination':function(_0x106c5b,_0x284f9a,_0x48b540){_0x48b540(null,path[_0xdd54('0x1e')](config[_0xdd54('0x15')],'server/files/images/logos/'));},'filename':function(_0x5709d6,_0x27fda0,_0x24839d){_0x24839d(null,util['format']('%s%s',_0xdd54('0x1f'),path[_0xdd54('0x17')](_0x27fda0[_0xdd54('0x18')])));}})});router['post'](_0xdd54('0xe'),upload[_0xdd54('0x20')](_0xdd54('0x1b')),controller[_0xdd54('0x21')]);var upload=multer({'storage':multer[_0xdd54('0x1d')]({'destination':function(_0x16846f,_0x20489d,_0xc0d0d0){_0xc0d0d0(null,path[_0xdd54('0x1e')](config[_0xdd54('0x15')],_0xdd54('0x22')));},'filename':function(_0x5d3f72,_0x330580,_0x35a19c){_0x35a19c(null,util[_0xdd54('0x23')](_0xdd54('0x24'),_0xdd54('0x25'),path[_0xdd54('0x17')](_0x330580['originalname'])));}})});router[_0xdd54('0x19')](_0xdd54('0x12'),upload['single']('file'),controller[_0xdd54('0x26')]);var upload=multer({'storage':multer[_0xdd54('0x1d')]({'destination':function(_0x4b2e6c,_0x4b0e42,_0x3ce385){_0x3ce385(null,path['join'](config['root'],_0xdd54('0x22')));},'filename':function(_0x2413b7,_0xc5407d,_0xfc291e){_0xfc291e(null,util[_0xdd54('0x23')](_0xdd54('0x24'),_0xdd54('0x27'),path['extname'](_0xc5407d[_0xdd54('0x18')])));}})});router[_0xdd54('0x19')](_0xdd54('0x14'),upload[_0xdd54('0x20')](_0xdd54('0x1b')),controller['addFavicon']);router[_0xdd54('0x28')](_0xdd54('0x29'),auth[_0xdd54('0x8')](),controller[_0xdd54('0x2a')]);module[_0xdd54('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5d8f086..e44e3eb 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 _0xae12=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted'];(function(_0x49b721,_0xe862a5){var _0xb5348d=function(_0xc0e846){while(--_0xc0e846){_0x49b721['push'](_0x49b721['shift']());}};_0xb5348d(++_0xe862a5);}(_0xae12,0xef));var _0x2ae1=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xae12[_0x4404ff];return _0x5e7b19;};'use strict';var Sequelize=require('sequelize');module[_0x2ae1('0x0')]={'min_internal':{'type':Sequelize[_0x2ae1('0x1')](0xb),'unique':_0x2ae1('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2ae1('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2ae1('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x2ae1('0x3')},'logo':{'type':Sequelize[_0x2ae1('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2ae1('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x2ae1('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x2ae1('0x4')]},'pageTitle':{'type':Sequelize[_0x2ae1('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2ae1('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2ae1('0x4')],'defaultValue':_0x2ae1('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2ae1('0x4')],'defaultValue':_0x2ae1('0x7')},'chatTimeout':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2ae1('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2ae1('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2ae1('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x2ae1('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2ae1('0x1')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x2ae1('0x1')](0x2)[_0x2ae1('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x2ae1('0x1')](0x2)[_0x2ae1('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x2ae1('0x1')](0x2)[_0x2ae1('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x2ae1('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x2ae1('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xbe87=['INTEGER','min_internal','BOOLEAN','STRING','UNSIGNED','sequelize','exports'];(function(_0x485a98,_0x15a988){var _0x5877ec=function(_0x43a678){while(--_0x43a678){_0x485a98['push'](_0x485a98['shift']());}};_0x5877ec(++_0x15a988);}(_0xbe87,0xe5));var _0x7be8=function(_0x315b12,_0xf7f8c7){_0x315b12=_0x315b12-0x0;var _0x40a925=_0xbe87[_0x315b12];return _0x40a925;};'use strict';var Sequelize=require(_0x7be8('0x0'));module[_0x7be8('0x1')]={'min_internal':{'type':Sequelize[_0x7be8('0x2')](0xb),'unique':_0x7be8('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7be8('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7be8('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7be8('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7be8('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7be8('0x5')]},'turnusername':{'type':Sequelize[_0x7be8('0x5')]},'turnpassword':{'type':Sequelize[_0x7be8('0x5')]},'pageTitle':{'type':Sequelize[_0x7be8('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7be8('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7be8('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7be8('0x5')]},'defaultPreferred':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7be8('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7be8('0x5')]},'defaultFavicon':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7be8('0x2')]},'transcribeRegion':{'type':Sequelize[_0x7be8('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7be8('0x2')]},'sentimentRegion':{'type':Sequelize[_0x7be8('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7be8('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7be8('0x2')](0x2)[_0x7be8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7be8('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7be8('0x2')](0x2)[_0x7be8('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7be8('0x2')](0x2)[_0x7be8('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7be8('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7be8('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index be9b152..b266217 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 _0xce50=['moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','Setting','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','keys','includeAll','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','download','getLicense','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce50,0x1d8));var _0x0ce5=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xce50[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ce5('0x0'));var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ce5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0ce5('0x6'));var ejs=require(_0x0ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x0ce5('0x8'));var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require(_0x0ce5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x6'));var querystring=require('querystring');var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce5('0x10'));var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0ce5('0x15')][_0x0ce5('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x352865,_0x282453,_0x4f4a14,_0x85bbb){return new BPromise(function(_0x117fa9,_0x5f4317){var _0x45dacd=_0x85bbb||client;return _0x45dacd['request'](_0x352865,_0x4f4a14)[_0x0ce5('0x17')](function(_0x1dd856){logger[_0x0ce5('0x18')](_0x0ce5('0x19'),_0x282453,_0x0ce5('0x1a'));logger[_0x0ce5('0x1b')](_0x0ce5('0x1c'),_0x282453,_0x0ce5('0x1a'),JSON['stringify'](_0x1dd856));if(_0x1dd856[_0x0ce5('0x1d')]){if(_0x1dd856[_0x0ce5('0x1d')]['code']===0x1f4){logger['error'](_0x0ce5('0x19'),_0x282453,_0x1dd856['error'][_0x0ce5('0x1e')]);return _0x5f4317(_0x1dd856[_0x0ce5('0x1d')][_0x0ce5('0x1e')]);}logger[_0x0ce5('0x1d')](_0x0ce5('0x19'),_0x282453,_0x1dd856[_0x0ce5('0x1d')]['message']);return _0x117fa9(_0x1dd856[_0x0ce5('0x1d')][_0x0ce5('0x1e')]);}else{logger[_0x0ce5('0x18')](_0x0ce5('0x19'),_0x282453,'request\x20sent');_0x117fa9(_0x1dd856[_0x0ce5('0x1f')]['message']);}})[_0x0ce5('0x20')](function(_0x3c59d1){logger[_0x0ce5('0x1d')](_0x0ce5('0x19'),_0x282453,_0x3c59d1);_0x5f4317(_0x3c59d1);});});}function respondWithStatusCode(_0x334e7d,_0xbb1a2c){_0xbb1a2c=_0xbb1a2c||0xcc;return function(_0x3ca9de){if(_0x3ca9de){return _0x334e7d[_0x0ce5('0x21')](_0xbb1a2c);}return _0x334e7d[_0x0ce5('0x22')](_0xbb1a2c)[_0x0ce5('0x23')]();};}function respondWithResult(_0x5adffe,_0x5392a4){_0x5392a4=_0x5392a4||0xc8;return function(_0x2332d4){if(_0x2332d4){return _0x5adffe['status'](_0x5392a4)['json'](_0x2332d4);}};}function respondWithFilteredResult(_0x73f240,_0x564276){return function(_0x2c7414){if(_0x2c7414){var _0x1c0731=typeof _0x564276['offset']==='undefined'&&typeof _0x564276[_0x0ce5('0x24')]===_0x0ce5('0x25');var _0x565295=_0x2c7414[_0x0ce5('0x26')];var _0x470fb6=_0x1c0731?0x0:_0x564276[_0x0ce5('0x27')];var _0x54a385=_0x1c0731?_0x2c7414['count']:_0x564276[_0x0ce5('0x27')]+_0x564276[_0x0ce5('0x24')];var _0x295402;if(_0x54a385>=_0x565295){_0x54a385=_0x565295;_0x295402=0xc8;}else{_0x295402=0xce;}_0x73f240[_0x0ce5('0x22')](_0x295402);return _0x73f240[_0x0ce5('0x28')](_0x0ce5('0x29'),_0x470fb6+'-'+_0x54a385+'/'+_0x565295)[_0x0ce5('0x2a')](_0x2c7414);}return null;};}function patchUpdates(_0xf5d353){return function(_0x34612a){try{jsonpatch[_0x0ce5('0x2b')](_0x34612a,_0xf5d353,!![]);}catch(_0x2f392c){return BPromise[_0x0ce5('0x2c')](_0x2f392c);}return _0x34612a[_0x0ce5('0x2d')]();};}function saveUpdates(_0xfef4a3,_0x733d8a){return function(_0x143960){if(_0x143960){return _0x143960[_0x0ce5('0x2e')](_0xfef4a3)[_0x0ce5('0x17')](function(_0x15712d){return _0x15712d;});}return null;};}function removeEntity(_0x40dcf8,_0x1d7351){return function(_0x441ff1){if(_0x441ff1){return _0x441ff1['destroy']()[_0x0ce5('0x17')](function(){_0x40dcf8[_0x0ce5('0x22')](0xcc)[_0x0ce5('0x23')]();});}};}function handleEntityNotFound(_0x510021,_0x37a303){return function(_0x14cceb){if(!_0x14cceb){_0x510021[_0x0ce5('0x21')](0x194);}return _0x14cceb;};}function handleError(_0x92c9c7,_0x530707){_0x530707=_0x530707||0x1f4;return function(_0x3ec9c2){logger[_0x0ce5('0x1d')](_0x3ec9c2[_0x0ce5('0x2f')]);if(_0x3ec9c2[_0x0ce5('0x30')]){delete _0x3ec9c2[_0x0ce5('0x30')];}_0x92c9c7[_0x0ce5('0x22')](_0x530707)[_0x0ce5('0x31')](_0x3ec9c2);};}exports[_0x0ce5('0x32')]=function(_0x454101,_0x19c9a4){var _0x163541={},_0x453ee4={},_0x4d5a1d={'count':0x0,'rows':[]};var _0x13d73e=_[_0x0ce5('0x33')](db[_0x0ce5('0x34')]['rawAttributes'],function(_0x15cbde){return{'name':_0x15cbde[_0x0ce5('0x35')],'type':_0x15cbde[_0x0ce5('0x36')][_0x0ce5('0x37')]};});_0x453ee4['model']=_[_0x0ce5('0x33')](_0x13d73e,'name');_0x453ee4[_0x0ce5('0x38')]=_['keys'](_0x454101['query']);_0x453ee4[_0x0ce5('0x39')]=_[_0x0ce5('0x3a')](_0x453ee4[_0x0ce5('0x3b')],_0x453ee4['query']);_0x163541[_0x0ce5('0x3c')]=_[_0x0ce5('0x3a')](_0x453ee4[_0x0ce5('0x3b')],qs[_0x0ce5('0x3d')](_0x454101['query'][_0x0ce5('0x3d')]));_0x163541[_0x0ce5('0x3c')]=_0x163541[_0x0ce5('0x3c')][_0x0ce5('0x3e')]?_0x163541[_0x0ce5('0x3c')]:_0x453ee4[_0x0ce5('0x3b')];if(!_0x454101['query'][_0x0ce5('0x3f')](_0x0ce5('0x40'))){_0x163541[_0x0ce5('0x24')]=qs[_0x0ce5('0x24')](_0x454101[_0x0ce5('0x38')][_0x0ce5('0x24')]);_0x163541[_0x0ce5('0x27')]=qs[_0x0ce5('0x27')](_0x454101[_0x0ce5('0x38')]['offset']);}_0x163541['order']=qs[_0x0ce5('0x41')](_0x454101[_0x0ce5('0x38')]['sort']);_0x163541['where']=qs[_0x0ce5('0x39')](_[_0x0ce5('0x42')](_0x454101[_0x0ce5('0x38')],_0x453ee4[_0x0ce5('0x39')]),_0x13d73e);if(_0x454101[_0x0ce5('0x38')][_0x0ce5('0x43')]){_0x163541[_0x0ce5('0x44')]=_[_0x0ce5('0x45')](_0x163541[_0x0ce5('0x44')],{'$or':_[_0x0ce5('0x33')](_0x13d73e,function(_0x4f218b){if(_0x4f218b['type']!=='VIRTUAL'){var _0x3b0caf={};_0x3b0caf[_0x4f218b[_0x0ce5('0x30')]]={'$like':'%'+_0x454101[_0x0ce5('0x38')][_0x0ce5('0x43')]+'%'};return _0x3b0caf;}})});}_0x163541=_[_0x0ce5('0x45')]({},_0x163541,_0x454101[_0x0ce5('0x46')]);var _0x525c20={'where':_0x163541[_0x0ce5('0x44')]};return db[_0x0ce5('0x34')][_0x0ce5('0x26')](_0x525c20)[_0x0ce5('0x17')](function(_0x48e6c8){_0x4d5a1d[_0x0ce5('0x26')]=_0x48e6c8;if(_0x454101['query']['includeAll']){_0x163541[_0x0ce5('0x47')]=[{'all':!![]}];}return db[_0x0ce5('0x34')][_0x0ce5('0x48')](_0x163541);})[_0x0ce5('0x17')](function(_0x3a3ec5){_0x4d5a1d[_0x0ce5('0x49')]=_0x3a3ec5;return _0x4d5a1d;})[_0x0ce5('0x17')](respondWithFilteredResult(_0x19c9a4,_0x163541))[_0x0ce5('0x20')](handleError(_0x19c9a4,null));};exports[_0x0ce5('0x4a')]=function(_0x41607c,_0x3eded5){var _0x40e47c={'raw':![],'where':{'id':_0x41607c[_0x0ce5('0x4b')]['id']}},_0x5629f4={};_0x5629f4['model']=_[_0x0ce5('0x4c')](db['Setting']['rawAttributes']);_0x5629f4['query']=_[_0x0ce5('0x4c')](_0x41607c['query']);_0x5629f4['filters']=_['intersection'](_0x5629f4[_0x0ce5('0x3b')],_0x5629f4[_0x0ce5('0x38')]);_0x40e47c[_0x0ce5('0x3c')]=_[_0x0ce5('0x3a')](_0x5629f4['model'],qs['fields'](_0x41607c[_0x0ce5('0x38')][_0x0ce5('0x3d')]));_0x40e47c[_0x0ce5('0x3c')]=_0x40e47c[_0x0ce5('0x3c')][_0x0ce5('0x3e')]?_0x40e47c[_0x0ce5('0x3c')]:_0x5629f4[_0x0ce5('0x3b')];if(_0x41607c[_0x0ce5('0x38')][_0x0ce5('0x4d')]){_0x40e47c[_0x0ce5('0x47')]=[{'all':!![]}];}_0x40e47c=_[_0x0ce5('0x45')]({},_0x40e47c,_0x41607c[_0x0ce5('0x46')]);return db[_0x0ce5('0x34')][_0x0ce5('0x4e')](_0x40e47c)[_0x0ce5('0x17')](handleEntityNotFound(_0x3eded5,null))[_0x0ce5('0x17')](respondWithResult(_0x3eded5,null))[_0x0ce5('0x20')](handleError(_0x3eded5,null));};exports[_0x0ce5('0x2e')]=function(_0x1be40d,_0x5462bf){if(_0x1be40d[_0x0ce5('0x4f')]['id']){delete _0x1be40d['body']['id'];}return db[_0x0ce5('0x34')][_0x0ce5('0x4e')]({'where':{'id':_0x1be40d[_0x0ce5('0x4b')]['id']}})[_0x0ce5('0x17')](handleEntityNotFound(_0x5462bf,null))[_0x0ce5('0x17')](saveUpdates(_0x1be40d[_0x0ce5('0x4f')],null))[_0x0ce5('0x17')](respondWithResult(_0x5462bf,null))[_0x0ce5('0x20')](handleError(_0x5462bf,null));};exports[_0x0ce5('0x50')]=function(_0x17d713,_0x847e99,_0x3d8a48){if(_0x17d713[_0x0ce5('0x51')]&&_0x17d713[_0x0ce5('0x51')][_0x0ce5('0x52')]){_0x17d713[_0x0ce5('0x4f')][_0x0ce5('0x53')]=_0x17d713[_0x0ce5('0x51')][_0x0ce5('0x52')];}return db[_0x0ce5('0x34')][_0x0ce5('0x4e')]({'where':{'id':_0x17d713[_0x0ce5('0x4b')]['id']}})[_0x0ce5('0x17')](handleEntityNotFound(_0x847e99,null))[_0x0ce5('0x17')](saveUpdates(_0x17d713[_0x0ce5('0x4f')],null))[_0x0ce5('0x17')](respondWithResult(_0x847e99,null))[_0x0ce5('0x20')](handleError(_0x847e99,null));};exports[_0x0ce5('0x54')]=function(_0x517ea0,_0x8554bc,_0x579300){if(_0x517ea0[_0x0ce5('0x51')]&&_0x517ea0[_0x0ce5('0x51')][_0x0ce5('0x52')]){_0x517ea0[_0x0ce5('0x4f')][_0x0ce5('0x55')]=_0x517ea0[_0x0ce5('0x51')]['filename'];}return db['Setting']['find']({'where':{'id':_0x517ea0['params']['id']}})['then'](handleEntityNotFound(_0x8554bc,null))[_0x0ce5('0x17')](saveUpdates(_0x517ea0[_0x0ce5('0x4f')],null))[_0x0ce5('0x17')](respondWithResult(_0x8554bc,null))[_0x0ce5('0x20')](handleError(_0x8554bc,null));};var utilLicense=require(_0x0ce5('0x56'));exports[_0x0ce5('0x57')]=function(_0x2080a3,_0x4573cf,_0x2abab1){var _0x2cff86=_0x0ce5('0x58');var _0xe34980={'custom':![]};return utilLicense['getLicense']()[_0x0ce5('0x17')](function(_0x1f7405){if(_0x1f7405){_0xe34980=_0x1f7405;}return db['Setting'][_0x0ce5('0x4e')]({'where':{'id':_0x2080a3[_0x0ce5('0x4b')]['id']},'attributes':[_0x0ce5('0x53'),_0x0ce5('0x55'),_0x0ce5('0x59'),_0x0ce5('0x5a'),_0x0ce5('0x5b'),_0x0ce5('0x5c'),_0x0ce5('0x5d'),_0x0ce5('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x4573cf,null))[_0x0ce5('0x17')](function(_0x42efa9){if(_0x42efa9){var _0x43a734=_0x42efa9[_0x0ce5('0x53')]&&fs[_0x0ce5('0x5f')](path[_0x0ce5('0x60')](config['root'],_0x2cff86,_[_0x0ce5('0x61')](_0x42efa9[_0x0ce5('0x53')])))?path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x2cff86,_[_0x0ce5('0x61')](_0x42efa9[_0x0ce5('0x53')])):path['join'](config[_0x0ce5('0x62')],_0x2cff86,_[_0x0ce5('0x61')](_0x0ce5('0x63')));var _0x4b5076=_0x0ce5('0x64')+_[_0x0ce5('0x65')]('logo');if(_0x42efa9[_0x4b5076]||!_0xe34980[_0x0ce5('0x66')]){_0x43a734=path[_0x0ce5('0x60')](config['root'],_0x2cff86,_[_0x0ce5('0x61')](_0x0ce5('0x63')));}if(!fs[_0x0ce5('0x5f')](_0x43a734)){throw new db[(_0x0ce5('0x67'))]['ValidationError'](_[_0x0ce5('0x65')](_0x0ce5('0x53'))+'\x20not\x20found');}return _0x4573cf[_0x0ce5('0x68')](_0x43a734);}})[_0x0ce5('0x20')](handleError(_0x4573cf,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x329ec4,_0x1ea4c7,_0x1a2e55){var _0x5c2f23=_0x0ce5('0x58');var _0x3b0db5={'custom':![]};return utilLicense[_0x0ce5('0x69')]()['then'](function(_0x2302dd){if(_0x2302dd){_0x3b0db5=_0x2302dd;}return db[_0x0ce5('0x34')]['find']({'where':{'id':_0x329ec4[_0x0ce5('0x4b')]['id']},'attributes':[_0x0ce5('0x53'),'loginLogo',_0x0ce5('0x59'),_0x0ce5('0x5a'),_0x0ce5('0x5b'),_0x0ce5('0x5c'),'defaultPreferred',_0x0ce5('0x5e')],'raw':!![]});})[_0x0ce5('0x17')](handleEntityNotFound(_0x1ea4c7,null))[_0x0ce5('0x17')](function(_0x2c8448){if(_0x2c8448){var _0x58738a=_0x2c8448[_0x0ce5('0x55')]&&fs[_0x0ce5('0x5f')](path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x5c2f23,_[_0x0ce5('0x61')](_0x2c8448['loginLogo'])))?path['join'](config[_0x0ce5('0x62')],_0x5c2f23,_[_0x0ce5('0x61')](_0x2c8448[_0x0ce5('0x55')])):path['join'](config[_0x0ce5('0x62')],_0x5c2f23,_[_0x0ce5('0x61')](_0x0ce5('0x6a')));var _0x1741c6=_0x0ce5('0x64')+_[_0x0ce5('0x65')](_0x0ce5('0x55'));if(_0x2c8448[_0x1741c6]||!_0x3b0db5[_0x0ce5('0x66')]){_0x58738a=path['join'](config[_0x0ce5('0x62')],_0x5c2f23,_[_0x0ce5('0x61')](_0x0ce5('0x6a')));}if(!fs[_0x0ce5('0x5f')](_0x58738a)){throw new db[(_0x0ce5('0x67'))][(_0x0ce5('0x6b'))](_[_0x0ce5('0x65')]('loginLogo')+_0x0ce5('0x6c'));}return _0x1ea4c7['download'](_0x58738a);}})['catch'](handleError(_0x1ea4c7,null));};exports[_0x0ce5('0x6d')]=function(_0x415068,_0x19e56e){return db['Setting'][_0x0ce5('0x4e')]({'where':{'id':_0x415068[_0x0ce5('0x4b')]['id']},'attributes':[_0x0ce5('0x6e')]})[_0x0ce5('0x17')](respondWithResult(_0x19e56e,null))[_0x0ce5('0x20')](handleError(_0x19e56e,null));};exports[_0x0ce5('0x6f')]=function(_0xe05298,_0x1c0a74,_0xf5ed5a){if(_0xe05298[_0x0ce5('0x51')]&&_0xe05298[_0x0ce5('0x51')][_0x0ce5('0x52')]){_0xe05298[_0x0ce5('0x4f')][_0x0ce5('0x59')]=_0xe05298[_0x0ce5('0x51')]['filename'];}return db[_0x0ce5('0x34')]['find']({'where':{'id':_0xe05298[_0x0ce5('0x4b')]['id']}})[_0x0ce5('0x17')](handleEntityNotFound(_0x1c0a74,null))[_0x0ce5('0x17')](saveUpdates(_0xe05298['body'],null))[_0x0ce5('0x17')](respondWithResult(_0x1c0a74,null))[_0x0ce5('0x20')](handleError(_0x1c0a74,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x4659fb,_0xf83749,_0x598c3a){var _0x499c20=_0x0ce5('0x58');var _0x4c3686={'custom':![]};return utilLicense[_0x0ce5('0x69')]()[_0x0ce5('0x17')](function(_0x5928fc){if(_0x5928fc){_0x4c3686=_0x5928fc;}return db[_0x0ce5('0x34')]['find']({'where':{'id':_0x4659fb[_0x0ce5('0x4b')]['id']},'attributes':[_0x0ce5('0x53'),_0x0ce5('0x55'),_0x0ce5('0x59'),_0x0ce5('0x5a'),'defaultLogo',_0x0ce5('0x5c'),'defaultPreferred',_0x0ce5('0x5e')],'raw':!![]});})[_0x0ce5('0x17')](handleEntityNotFound(_0xf83749,null))['then'](function(_0x34322e){if(_0x34322e){var _0x4ccf66=_0x34322e['preferred']&&fs[_0x0ce5('0x5f')](path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x499c20,_[_0x0ce5('0x61')](_0x34322e[_0x0ce5('0x59')])))?path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x499c20,_[_0x0ce5('0x61')](_0x34322e[_0x0ce5('0x59')])):path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x499c20,_[_0x0ce5('0x61')](_0x0ce5('0x70')));var _0x355b71=_0x0ce5('0x64')+_[_0x0ce5('0x65')](_0x0ce5('0x59'));if(_0x34322e[_0x355b71]||!_0x4c3686[_0x0ce5('0x66')]||!_0x4c3686[_0x0ce5('0x59')]){_0x4ccf66=path[_0x0ce5('0x60')](config['root'],_0x499c20,_[_0x0ce5('0x61')]('default_preferred.png'));}if(!fs[_0x0ce5('0x5f')](_0x4ccf66)){throw new db[(_0x0ce5('0x67'))][(_0x0ce5('0x6b'))](_[_0x0ce5('0x65')]('preferred')+_0x0ce5('0x6c'));}return _0xf83749[_0x0ce5('0x68')](_0x4ccf66);}})[_0x0ce5('0x20')](handleError(_0xf83749,null));};exports[_0x0ce5('0x71')]=function(_0x22e286,_0x518b07,_0x11abd6){if(_0x22e286[_0x0ce5('0x51')]&&_0x22e286[_0x0ce5('0x51')]['filename']){_0x22e286[_0x0ce5('0x4f')]['favicon']=_0x22e286[_0x0ce5('0x51')][_0x0ce5('0x52')];}return db[_0x0ce5('0x34')][_0x0ce5('0x4e')]({'where':{'id':_0x22e286[_0x0ce5('0x4b')]['id']}})[_0x0ce5('0x17')](handleEntityNotFound(_0x518b07,null))['then'](saveUpdates(_0x22e286['body'],null))[_0x0ce5('0x17')](respondWithResult(_0x518b07,null))[_0x0ce5('0x20')](handleError(_0x518b07,null));};var utilLicense=require(_0x0ce5('0x56'));exports[_0x0ce5('0x72')]=function(_0x1be385,_0x22a122,_0x27a36c){var _0x102d81='server/files/images/logos';var _0x37dc41={'custom':![]};return utilLicense['getLicense']()[_0x0ce5('0x17')](function(_0x3ad112){if(_0x3ad112){_0x37dc41=_0x3ad112;}return db[_0x0ce5('0x34')][_0x0ce5('0x4e')]({'where':{'id':_0x1be385[_0x0ce5('0x4b')]['id']},'attributes':[_0x0ce5('0x53'),_0x0ce5('0x55'),_0x0ce5('0x59'),_0x0ce5('0x5a'),_0x0ce5('0x5b'),'defaultLoginLogo',_0x0ce5('0x5d'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x22a122,null))[_0x0ce5('0x17')](function(_0x3ca695){if(_0x3ca695){var _0x12e646=_0x3ca695['favicon']&&fs[_0x0ce5('0x5f')](path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x102d81,_[_0x0ce5('0x61')](_0x3ca695['favicon'])))?path[_0x0ce5('0x60')](config['root'],_0x102d81,_[_0x0ce5('0x61')](_0x3ca695[_0x0ce5('0x5a')])):path['join'](config['root'],_0x102d81,_[_0x0ce5('0x61')](_0x0ce5('0x73')));var _0x4abfb5=_0x0ce5('0x64')+_[_0x0ce5('0x65')](_0x0ce5('0x5a'));if(_0x3ca695[_0x4abfb5]||!_0x37dc41[_0x0ce5('0x66')]){_0x12e646=path[_0x0ce5('0x60')](config[_0x0ce5('0x62')],_0x102d81,_[_0x0ce5('0x61')](_0x0ce5('0x73')));}if(!fs[_0x0ce5('0x5f')](_0x12e646)){throw new db['Sequelize'][(_0x0ce5('0x6b'))](_[_0x0ce5('0x65')](_0x0ce5('0x5a'))+_0x0ce5('0x6c'));}return _0x22a122[_0x0ce5('0x68')](_0x12e646);}})[_0x0ce5('0x20')](handleError(_0x22a122,null));};exports['getDate']=function(_0x2b4dfc,_0x17ba87){var _0x1447aa={'offset':moment()['utcOffset']()};_0x1447aa[_0x0ce5('0x74')]=moment()['utcOffset'](_0x1447aa[_0x0ce5('0x27')])[_0x0ce5('0x75')](_0x0ce5('0x76'));return _0x17ba87[_0x0ce5('0x22')](0xc8)[_0x0ce5('0x31')](_0x1447aa);}; \ No newline at end of file +var _0xa33b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Setting','includeAll','findAll','params','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','custom','existsSync','\x20not\x20found','download','server/files/images/logos','getLicense','default_loginLogo.svg','Sequelize','ValidationError','securePassword','addPreferred','getPreferred','preferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x26dcd8,_0x461d6b){var _0x1654e9=function(_0x29ab7b){while(--_0x29ab7b){_0x26dcd8['push'](_0x26dcd8['shift']());}};_0x1654e9(++_0x461d6b);}(_0xa33b,0x68));var _0xba33=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa33b[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xba33('0x0'));var rimraf=require(_0xba33('0x1'));var zipdir=require(_0xba33('0x2'));var jsonpatch=require(_0xba33('0x3'));var rp=require(_0xba33('0x4'));var moment=require(_0xba33('0x5'));var BPromise=require(_0xba33('0x6'));var Mustache=require(_0xba33('0x7'));var util=require(_0xba33('0x8'));var path=require('path');var sox=require(_0xba33('0x9'));var csv=require('to-csv');var ejs=require(_0xba33('0xa'));var fs=require('fs');var fs_extra=require(_0xba33('0xb'));var _=require(_0xba33('0xc'));var squel=require(_0xba33('0xd'));var crypto=require(_0xba33('0xe'));var jsforce=require(_0xba33('0xf'));var deskjs=require(_0xba33('0x10'));var toCsv=require(_0xba33('0x11'));var querystring=require('querystring');var Papa=require(_0xba33('0x12'));var Redis=require(_0xba33('0x13'));var authService=require(_0xba33('0x14'));var qs=require(_0xba33('0x15'));var as=require(_0xba33('0x16'));var hardwareService=require(_0xba33('0x17'));var logger=require(_0xba33('0x18'))(_0xba33('0x19'));var utils=require(_0xba33('0x1a'));var config=require(_0xba33('0x1b'));var licenseUtil=require(_0xba33('0x1c'));var db=require(_0xba33('0x1d'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xba33('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376d32,_0x2709b7,_0x1d3fb5,_0x39b7e0){return new BPromise(function(_0x261489,_0x548ef5){var _0x2b274b=_0x39b7e0||client;return _0x2b274b[_0xba33('0x1f')](_0x376d32,_0x1d3fb5)['then'](function(_0x1b404b){logger[_0xba33('0x20')](_0xba33('0x21'),_0x2709b7,_0xba33('0x22'));logger[_0xba33('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x2709b7,_0xba33('0x22'),JSON[_0xba33('0x24')](_0x1b404b));if(_0x1b404b[_0xba33('0x25')]){if(_0x1b404b[_0xba33('0x25')][_0xba33('0x26')]===0x1f4){logger[_0xba33('0x25')](_0xba33('0x21'),_0x2709b7,_0x1b404b[_0xba33('0x25')][_0xba33('0x27')]);return _0x548ef5(_0x1b404b[_0xba33('0x25')][_0xba33('0x27')]);}logger['error'](_0xba33('0x21'),_0x2709b7,_0x1b404b[_0xba33('0x25')][_0xba33('0x27')]);return _0x261489(_0x1b404b['error'][_0xba33('0x27')]);}else{logger[_0xba33('0x20')](_0xba33('0x21'),_0x2709b7,_0xba33('0x22'));_0x261489(_0x1b404b[_0xba33('0x28')][_0xba33('0x27')]);}})[_0xba33('0x29')](function(_0xab4a3a){logger[_0xba33('0x25')](_0xba33('0x21'),_0x2709b7,_0xab4a3a);_0x548ef5(_0xab4a3a);});});}function respondWithStatusCode(_0x2631b7,_0x14c840){_0x14c840=_0x14c840||0xcc;return function(_0x1cac85){if(_0x1cac85){return _0x2631b7[_0xba33('0x2a')](_0x14c840);}return _0x2631b7[_0xba33('0x2b')](_0x14c840)[_0xba33('0x2c')]();};}function respondWithResult(_0x358415,_0x4e93a8){_0x4e93a8=_0x4e93a8||0xc8;return function(_0x26ec34){if(_0x26ec34){return _0x358415[_0xba33('0x2b')](_0x4e93a8)['json'](_0x26ec34);}};}function respondWithFilteredResult(_0x15399c,_0x42c11a){return function(_0x9f3bcd){if(_0x9f3bcd){var _0x3449ec=typeof _0x42c11a['offset']===_0xba33('0x2d')&&typeof _0x42c11a[_0xba33('0x2e')]===_0xba33('0x2d');var _0x42b9d2=_0x9f3bcd[_0xba33('0x2f')];var _0x3b70d0=_0x3449ec?0x0:_0x42c11a[_0xba33('0x30')];var _0xaa6102=_0x3449ec?_0x9f3bcd['count']:_0x42c11a[_0xba33('0x30')]+_0x42c11a[_0xba33('0x2e')];var _0x2fc2bb;if(_0xaa6102>=_0x42b9d2){_0xaa6102=_0x42b9d2;_0x2fc2bb=0xc8;}else{_0x2fc2bb=0xce;}_0x15399c['status'](_0x2fc2bb);return _0x15399c[_0xba33('0x31')](_0xba33('0x32'),_0x3b70d0+'-'+_0xaa6102+'/'+_0x42b9d2)[_0xba33('0x33')](_0x9f3bcd);}return null;};}function patchUpdates(_0xbb8c58){return function(_0x39732f){try{jsonpatch[_0xba33('0x34')](_0x39732f,_0xbb8c58,!![]);}catch(_0xba600a){return BPromise['reject'](_0xba600a);}return _0x39732f[_0xba33('0x35')]();};}function saveUpdates(_0x4ffc76,_0x495efe){return function(_0x5798d5){if(_0x5798d5){return _0x5798d5['update'](_0x4ffc76)[_0xba33('0x36')](function(_0x33a819){return _0x33a819;});}return null;};}function removeEntity(_0x93fa9d,_0x44cdad){return function(_0x186894){if(_0x186894){return _0x186894[_0xba33('0x37')]()[_0xba33('0x36')](function(){_0x93fa9d[_0xba33('0x2b')](0xcc)[_0xba33('0x2c')]();});}};}function handleEntityNotFound(_0x1b244f,_0x558079){return function(_0x5e7f17){if(!_0x5e7f17){_0x1b244f[_0xba33('0x2a')](0x194);}return _0x5e7f17;};}function handleError(_0x476bdf,_0x267dba){_0x267dba=_0x267dba||0x1f4;return function(_0x1e5c5c){logger[_0xba33('0x25')](_0x1e5c5c[_0xba33('0x38')]);if(_0x1e5c5c[_0xba33('0x39')]){delete _0x1e5c5c[_0xba33('0x39')];}_0x476bdf[_0xba33('0x2b')](_0x267dba)[_0xba33('0x3a')](_0x1e5c5c);};}exports['index']=function(_0x3a0b89,_0x2c36c1){var _0x1fed52={},_0x34fa79={},_0x4be826={'count':0x0,'rows':[]};var _0x286111=_[_0xba33('0x3b')](db['Setting'][_0xba33('0x3c')],function(_0x1e9cc4){return{'name':_0x1e9cc4[_0xba33('0x3d')],'type':_0x1e9cc4[_0xba33('0x3e')][_0xba33('0x3f')]};});_0x34fa79['model']=_['map'](_0x286111,'name');_0x34fa79[_0xba33('0x40')]=_[_0xba33('0x41')](_0x3a0b89[_0xba33('0x40')]);_0x34fa79[_0xba33('0x42')]=_['intersection'](_0x34fa79[_0xba33('0x43')],_0x34fa79[_0xba33('0x40')]);_0x1fed52[_0xba33('0x44')]=_[_0xba33('0x45')](_0x34fa79[_0xba33('0x43')],qs[_0xba33('0x46')](_0x3a0b89[_0xba33('0x40')][_0xba33('0x46')]));_0x1fed52['attributes']=_0x1fed52[_0xba33('0x44')][_0xba33('0x47')]?_0x1fed52[_0xba33('0x44')]:_0x34fa79[_0xba33('0x43')];if(!_0x3a0b89['query'][_0xba33('0x48')](_0xba33('0x49'))){_0x1fed52[_0xba33('0x2e')]=qs[_0xba33('0x2e')](_0x3a0b89[_0xba33('0x40')][_0xba33('0x2e')]);_0x1fed52[_0xba33('0x30')]=qs[_0xba33('0x30')](_0x3a0b89[_0xba33('0x40')][_0xba33('0x30')]);}_0x1fed52[_0xba33('0x4a')]=qs[_0xba33('0x4b')](_0x3a0b89['query']['sort']);_0x1fed52['where']=qs['filters'](_['pick'](_0x3a0b89[_0xba33('0x40')],_0x34fa79['filters']),_0x286111);if(_0x3a0b89[_0xba33('0x40')][_0xba33('0x4c')]){_0x1fed52[_0xba33('0x4d')]=_[_0xba33('0x4e')](_0x1fed52['where'],{'$or':_[_0xba33('0x3b')](_0x286111,function(_0xdc061d){if(_0xdc061d[_0xba33('0x3e')]!==_0xba33('0x4f')){var _0x3574b2={};_0x3574b2[_0xdc061d['name']]={'$like':'%'+_0x3a0b89[_0xba33('0x40')][_0xba33('0x4c')]+'%'};return _0x3574b2;}})});}_0x1fed52=_[_0xba33('0x4e')]({},_0x1fed52,_0x3a0b89[_0xba33('0x50')]);var _0x1b351d={'where':_0x1fed52['where']};return db[_0xba33('0x51')][_0xba33('0x2f')](_0x1b351d)[_0xba33('0x36')](function(_0x21f871){_0x4be826[_0xba33('0x2f')]=_0x21f871;if(_0x3a0b89[_0xba33('0x40')][_0xba33('0x52')]){_0x1fed52['include']=[{'all':!![]}];}return db['Setting'][_0xba33('0x53')](_0x1fed52);})[_0xba33('0x36')](function(_0x4d82ca){_0x4be826['rows']=_0x4d82ca;return _0x4be826;})[_0xba33('0x36')](respondWithFilteredResult(_0x2c36c1,_0x1fed52))[_0xba33('0x29')](handleError(_0x2c36c1,null));};exports['show']=function(_0x741a95,_0x5bbf72){var _0xa29e6e={'raw':![],'where':{'id':_0x741a95[_0xba33('0x54')]['id']}},_0x40d7a2={};_0x40d7a2[_0xba33('0x43')]=_['keys'](db[_0xba33('0x51')][_0xba33('0x3c')]);_0x40d7a2[_0xba33('0x40')]=_[_0xba33('0x41')](_0x741a95[_0xba33('0x40')]);_0x40d7a2['filters']=_['intersection'](_0x40d7a2[_0xba33('0x43')],_0x40d7a2['query']);_0xa29e6e[_0xba33('0x44')]=_[_0xba33('0x45')](_0x40d7a2[_0xba33('0x43')],qs[_0xba33('0x46')](_0x741a95[_0xba33('0x40')][_0xba33('0x46')]));_0xa29e6e[_0xba33('0x44')]=_0xa29e6e[_0xba33('0x44')][_0xba33('0x47')]?_0xa29e6e[_0xba33('0x44')]:_0x40d7a2['model'];if(_0x741a95[_0xba33('0x40')][_0xba33('0x52')]){_0xa29e6e['include']=[{'all':!![]}];}_0xa29e6e=_[_0xba33('0x4e')]({},_0xa29e6e,_0x741a95[_0xba33('0x50')]);return db[_0xba33('0x51')][_0xba33('0x55')](_0xa29e6e)['then'](handleEntityNotFound(_0x5bbf72,null))[_0xba33('0x36')](respondWithResult(_0x5bbf72,null))['catch'](handleError(_0x5bbf72,null));};exports[_0xba33('0x56')]=function(_0x225f6f,_0x432e3f){if(_0x225f6f[_0xba33('0x57')]['id']){delete _0x225f6f[_0xba33('0x57')]['id'];}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0x225f6f[_0xba33('0x54')]['id']}})[_0xba33('0x36')](handleEntityNotFound(_0x432e3f,null))[_0xba33('0x36')](saveUpdates(_0x225f6f[_0xba33('0x57')],null))['then'](respondWithResult(_0x432e3f,null))[_0xba33('0x29')](handleError(_0x432e3f,null));};exports[_0xba33('0x58')]=function(_0x2ee434,_0x33693c,_0x2958c4){if(_0x2ee434['file']&&_0x2ee434[_0xba33('0x59')][_0xba33('0x5a')]){_0x2ee434[_0xba33('0x57')][_0xba33('0x5b')]=_0x2ee434[_0xba33('0x59')][_0xba33('0x5a')];}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0x2ee434[_0xba33('0x54')]['id']}})[_0xba33('0x36')](handleEntityNotFound(_0x33693c,null))[_0xba33('0x36')](saveUpdates(_0x2ee434[_0xba33('0x57')],null))[_0xba33('0x36')](respondWithResult(_0x33693c,null))['catch'](handleError(_0x33693c,null));};exports[_0xba33('0x5c')]=function(_0x12092a,_0x1c0454,_0x1377f8){if(_0x12092a[_0xba33('0x59')]&&_0x12092a[_0xba33('0x59')][_0xba33('0x5a')]){_0x12092a[_0xba33('0x57')][_0xba33('0x5d')]=_0x12092a['file']['filename'];}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0x12092a[_0xba33('0x54')]['id']}})[_0xba33('0x36')](handleEntityNotFound(_0x1c0454,null))[_0xba33('0x36')](saveUpdates(_0x12092a[_0xba33('0x57')],null))['then'](respondWithResult(_0x1c0454,null))[_0xba33('0x29')](handleError(_0x1c0454,null));};var utilLicense=require(_0xba33('0x1c'));exports['getLogo']=function(_0xab74e5,_0x4ba530,_0xc865c4){var _0x999aa5='server/files/images/logos';var _0x1978ca={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1a698c){if(_0x1a698c){_0x1978ca=_0x1a698c;}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0xab74e5['params']['id']},'attributes':[_0xba33('0x5b'),_0xba33('0x5d'),'preferred',_0xba33('0x5e'),_0xba33('0x5f'),_0xba33('0x60'),_0xba33('0x61'),_0xba33('0x62')],'raw':!![]});})[_0xba33('0x36')](handleEntityNotFound(_0x4ba530,null))[_0xba33('0x36')](function(_0x3f7e91){if(_0x3f7e91){var _0x24b41e=_0x3f7e91[_0xba33('0x5b')]&&fs['existsSync'](path[_0xba33('0x63')](config['root'],_0x999aa5,_[_0xba33('0x64')](_0x3f7e91['logo'])))?path[_0xba33('0x63')](config[_0xba33('0x65')],_0x999aa5,_[_0xba33('0x64')](_0x3f7e91[_0xba33('0x5b')])):path[_0xba33('0x63')](config[_0xba33('0x65')],_0x999aa5,_['toLower'](_0xba33('0x66')));var _0x4f5f38=_0xba33('0x67')+_[_0xba33('0x68')](_0xba33('0x5b'));if(_0x3f7e91[_0x4f5f38]||!_0x1978ca[_0xba33('0x69')]){_0x24b41e=path['join'](config[_0xba33('0x65')],_0x999aa5,_['toLower'](_0xba33('0x66')));}if(!fs[_0xba33('0x6a')](_0x24b41e)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0xba33('0x5b'))+_0xba33('0x6b'));}return _0x4ba530[_0xba33('0x6c')](_0x24b41e);}})[_0xba33('0x29')](handleError(_0x4ba530,null));};var utilLicense=require(_0xba33('0x1c'));exports['getLogoLogin']=function(_0x3996e8,_0x5a53dc,_0xba29c9){var _0x2826fd=_0xba33('0x6d');var _0xae87d3={'custom':![]};return utilLicense[_0xba33('0x6e')]()[_0xba33('0x36')](function(_0x35e2f5){if(_0x35e2f5){_0xae87d3=_0x35e2f5;}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0x3996e8[_0xba33('0x54')]['id']},'attributes':[_0xba33('0x5b'),_0xba33('0x5d'),'preferred',_0xba33('0x5e'),_0xba33('0x5f'),_0xba33('0x60'),_0xba33('0x61'),'defaultFavicon'],'raw':!![]});})[_0xba33('0x36')](handleEntityNotFound(_0x5a53dc,null))['then'](function(_0x2b1b00){if(_0x2b1b00){var _0x28510b=_0x2b1b00[_0xba33('0x5d')]&&fs[_0xba33('0x6a')](path['join'](config[_0xba33('0x65')],_0x2826fd,_['toLower'](_0x2b1b00['loginLogo'])))?path['join'](config[_0xba33('0x65')],_0x2826fd,_[_0xba33('0x64')](_0x2b1b00[_0xba33('0x5d')])):path[_0xba33('0x63')](config[_0xba33('0x65')],_0x2826fd,_[_0xba33('0x64')](_0xba33('0x6f')));var _0x3b9c63=_0xba33('0x67')+_['upperFirst'](_0xba33('0x5d'));if(_0x2b1b00[_0x3b9c63]||!_0xae87d3[_0xba33('0x69')]){_0x28510b=path['join'](config[_0xba33('0x65')],_0x2826fd,_[_0xba33('0x64')](_0xba33('0x6f')));}if(!fs['existsSync'](_0x28510b)){throw new db[(_0xba33('0x70'))][(_0xba33('0x71'))](_[_0xba33('0x68')](_0xba33('0x5d'))+_0xba33('0x6b'));}return _0x5a53dc[_0xba33('0x6c')](_0x28510b);}})[_0xba33('0x29')](handleError(_0x5a53dc,null));};exports['gdpr']=function(_0x1afce7,_0x381ea3){return db['Setting'][_0xba33('0x55')]({'where':{'id':_0x1afce7[_0xba33('0x54')]['id']},'attributes':[_0xba33('0x72')]})[_0xba33('0x36')](respondWithResult(_0x381ea3,null))[_0xba33('0x29')](handleError(_0x381ea3,null));};exports[_0xba33('0x73')]=function(_0x3fa2ea,_0x47c519,_0x4404f4){if(_0x3fa2ea['file']&&_0x3fa2ea[_0xba33('0x59')][_0xba33('0x5a')]){_0x3fa2ea[_0xba33('0x57')]['preferred']=_0x3fa2ea[_0xba33('0x59')][_0xba33('0x5a')];}return db[_0xba33('0x51')][_0xba33('0x55')]({'where':{'id':_0x3fa2ea[_0xba33('0x54')]['id']}})[_0xba33('0x36')](handleEntityNotFound(_0x47c519,null))[_0xba33('0x36')](saveUpdates(_0x3fa2ea[_0xba33('0x57')],null))[_0xba33('0x36')](respondWithResult(_0x47c519,null))[_0xba33('0x29')](handleError(_0x47c519,null));};var utilLicense=require(_0xba33('0x1c'));exports[_0xba33('0x74')]=function(_0x3397ef,_0x1da9f7,_0x29bf3c){var _0x17e65d=_0xba33('0x6d');var _0x272e35={'custom':![]};return utilLicense[_0xba33('0x6e')]()[_0xba33('0x36')](function(_0x43d537){if(_0x43d537){_0x272e35=_0x43d537;}return db['Setting']['find']({'where':{'id':_0x3397ef['params']['id']},'attributes':['logo',_0xba33('0x5d'),_0xba33('0x75'),_0xba33('0x5e'),_0xba33('0x5f'),_0xba33('0x60'),_0xba33('0x61'),'defaultFavicon'],'raw':!![]});})[_0xba33('0x36')](handleEntityNotFound(_0x1da9f7,null))[_0xba33('0x36')](function(_0xc3ccba){if(_0xc3ccba){var _0x132791=_0xc3ccba[_0xba33('0x75')]&&fs['existsSync'](path[_0xba33('0x63')](config['root'],_0x17e65d,_[_0xba33('0x64')](_0xc3ccba[_0xba33('0x75')])))?path[_0xba33('0x63')](config[_0xba33('0x65')],_0x17e65d,_[_0xba33('0x64')](_0xc3ccba[_0xba33('0x75')])):path['join'](config[_0xba33('0x65')],_0x17e65d,_[_0xba33('0x64')]('default_preferred.png'));var _0x96f340='default'+_['upperFirst'](_0xba33('0x75'));if(_0xc3ccba[_0x96f340]||!_0x272e35[_0xba33('0x69')]||!_0x272e35[_0xba33('0x75')]){_0x132791=path[_0xba33('0x63')](config[_0xba33('0x65')],_0x17e65d,_['toLower'](_0xba33('0x76')));}if(!fs['existsSync'](_0x132791)){throw new db[(_0xba33('0x70'))]['ValidationError'](_[_0xba33('0x68')]('preferred')+_0xba33('0x6b'));}return _0x1da9f7[_0xba33('0x6c')](_0x132791);}})['catch'](handleError(_0x1da9f7,null));};exports[_0xba33('0x77')]=function(_0x1f5061,_0x83dfdc,_0x1df210){if(_0x1f5061[_0xba33('0x59')]&&_0x1f5061[_0xba33('0x59')][_0xba33('0x5a')]){_0x1f5061[_0xba33('0x57')][_0xba33('0x5e')]=_0x1f5061[_0xba33('0x59')]['filename'];}return db[_0xba33('0x51')]['find']({'where':{'id':_0x1f5061[_0xba33('0x54')]['id']}})[_0xba33('0x36')](handleEntityNotFound(_0x83dfdc,null))[_0xba33('0x36')](saveUpdates(_0x1f5061[_0xba33('0x57')],null))[_0xba33('0x36')](respondWithResult(_0x83dfdc,null))[_0xba33('0x29')](handleError(_0x83dfdc,null));};var utilLicense=require(_0xba33('0x1c'));exports[_0xba33('0x78')]=function(_0x3c10d5,_0xd29b3a,_0x526189){var _0x3f0743='server/files/images/logos';var _0x58f80d={'custom':![]};return utilLicense[_0xba33('0x6e')]()[_0xba33('0x36')](function(_0x14e9e1){if(_0x14e9e1){_0x58f80d=_0x14e9e1;}return db['Setting'][_0xba33('0x55')]({'where':{'id':_0x3c10d5[_0xba33('0x54')]['id']},'attributes':[_0xba33('0x5b'),_0xba33('0x5d'),_0xba33('0x75'),_0xba33('0x5e'),_0xba33('0x5f'),_0xba33('0x60'),_0xba33('0x61'),_0xba33('0x62')],'raw':!![]});})[_0xba33('0x36')](handleEntityNotFound(_0xd29b3a,null))['then'](function(_0xa84608){if(_0xa84608){var _0xe5ef70=_0xa84608[_0xba33('0x5e')]&&fs[_0xba33('0x6a')](path['join'](config[_0xba33('0x65')],_0x3f0743,_[_0xba33('0x64')](_0xa84608['favicon'])))?path[_0xba33('0x63')](config[_0xba33('0x65')],_0x3f0743,_[_0xba33('0x64')](_0xa84608[_0xba33('0x5e')])):path['join'](config['root'],_0x3f0743,_[_0xba33('0x64')](_0xba33('0x79')));var _0x29cd5b=_0xba33('0x67')+_[_0xba33('0x68')](_0xba33('0x5e'));if(_0xa84608[_0x29cd5b]||!_0x58f80d[_0xba33('0x69')]){_0xe5ef70=path['join'](config[_0xba33('0x65')],_0x3f0743,_[_0xba33('0x64')]('default_favicon.ico'));}if(!fs[_0xba33('0x6a')](_0xe5ef70)){throw new db[(_0xba33('0x70'))]['ValidationError'](_[_0xba33('0x68')]('favicon')+_0xba33('0x6b'));}return _0xd29b3a[_0xba33('0x6c')](_0xe5ef70);}})[_0xba33('0x29')](handleError(_0xd29b3a,null));};exports[_0xba33('0x7a')]=function(_0x3b37e5,_0x5e713b){var _0x3dc141={'offset':moment()[_0xba33('0x7b')]()};_0x3dc141[_0xba33('0x7c')]=moment()[_0xba33('0x7b')](_0x3dc141[_0xba33('0x30')])[_0xba33('0x7d')](_0xba33('0x7e'));return _0x5e713b[_0xba33('0x2b')](0xc8)[_0xba33('0x3a')](_0x3dc141);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a1a422e..c62c1da 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x55ca,0x126));var _0xa55c=function(_0x2ea9bb,_0x41a73f){_0x2ea9bb=_0x2ea9bb-0x0;var _0x3f0084=_0x55ca[_0x2ea9bb];return _0x3f0084;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 078b8dc..b168b3c 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 _0x68d9=['code','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','model','map','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5545d7,_0x23ac3d){var _0x500cfa=function(_0x3596f4){while(--_0x3596f4){_0x5545d7['push'](_0x5545d7['shift']());}};_0x500cfa(++_0x23ac3d);}(_0x68d9,0x139));var _0x968d=function(_0x252343,_0x30ff75){_0x252343=_0x252343-0x0;var _0x5691c4=_0x68d9[_0x252343];return _0x5691c4;};'use strict';var _=require(_0x968d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x968d('0x1'));var rs=require(_0x968d('0x2'));var fs=require('fs');var Redis=require(_0x968d('0x3'));var db=require(_0x968d('0x4'))['db'];var utils=require(_0x968d('0x5'));var logger=require('../../config/logger')(_0x968d('0x6'));var config=require(_0x968d('0x7'));var jayson=require(_0x968d('0x8'));var client=jayson['client'][_0x968d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9b6819,_0x5ad41e,_0x42496a){return new BPromise(function(_0x4f6980,_0xeddf35){return client['request'](_0x9b6819,_0x42496a)[_0x968d('0xa')](function(_0x262c4b){logger[_0x968d('0xb')](_0x968d('0xc'),_0x5ad41e,_0x968d('0xd'));logger[_0x968d('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x5ad41e,'request\x20sent',JSON[_0x968d('0xf')](_0x262c4b));if(_0x262c4b['error']){if(_0x262c4b[_0x968d('0x10')][_0x968d('0x11')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5ad41e,_0x262c4b['error'][_0x968d('0x12')]);return _0xeddf35(_0x262c4b[_0x968d('0x10')][_0x968d('0x12')]);}logger['error'](_0x968d('0xc'),_0x5ad41e,_0x262c4b[_0x968d('0x10')][_0x968d('0x12')]);return _0x4f6980(_0x262c4b[_0x968d('0x10')][_0x968d('0x12')]);}else{logger[_0x968d('0xb')](_0x968d('0xc'),_0x5ad41e,_0x968d('0xd'));_0x4f6980(_0x262c4b[_0x968d('0x13')][_0x968d('0x12')]);}})[_0x968d('0x14')](function(_0x4de2e2){logger['error'](_0x968d('0xc'),_0x5ad41e,_0x4de2e2);_0xeddf35(_0x4de2e2);});});}exports[_0x968d('0x15')]=function(_0xaab02d){var _0x5bbdef=this;return new Promise(function(_0x3a823f,_0x42e86e){return db[_0x968d('0x16')][_0x968d('0x17')]({'raw':_0xaab02d[_0x968d('0x18')]?_0xaab02d[_0x968d('0x18')][_0x968d('0x19')]===undefined?!![]:![]:!![],'where':_0xaab02d[_0x968d('0x18')]?_0xaab02d[_0x968d('0x18')]['where']||null:null,'attributes':_0xaab02d[_0x968d('0x18')]?_0xaab02d[_0x968d('0x18')][_0x968d('0x1a')]||null:null,'include':_0xaab02d[_0x968d('0x18')]?_0xaab02d[_0x968d('0x18')]['include']?_['map'](_0xaab02d[_0x968d('0x18')][_0x968d('0x1b')],function(_0x37416f){return{'model':db[_0x37416f[_0x968d('0x1c')]],'as':_0x37416f['as'],'attributes':_0x37416f[_0x968d('0x1a')],'include':_0x37416f['include']?_[_0x968d('0x1d')](_0x37416f[_0x968d('0x1b')],function(_0x4e3411){return{'model':db[_0x4e3411['model']],'as':_0x4e3411['as'],'attributes':_0x4e3411[_0x968d('0x1a')],'include':_0x4e3411[_0x968d('0x1b')]?_[_0x968d('0x1d')](_0x4e3411[_0x968d('0x1b')],function(_0x52d88b){return{'model':db[_0x52d88b['model']],'as':_0x52d88b['as'],'attributes':_0x52d88b[_0x968d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x279fa2){logger[_0x968d('0xb')](_0x968d('0x15'),_0xaab02d);logger['debug']('ShowSetting',_0xaab02d,JSON[_0x968d('0xf')](_0x279fa2));_0x3a823f(_0x279fa2);})[_0x968d('0x14')](function(_0x371850){logger[_0x968d('0x10')]('ShowSetting',_0x371850[_0x968d('0x12')],_0xaab02d);_0x42e86e(_0x5bbdef['error'](0x1f4,_0x371850[_0x968d('0x12')]));});});}; \ No newline at end of file +var _0x21f1=['find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','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'];(function(_0x486e6f,_0x395450){var _0x104212=function(_0x368754){while(--_0x368754){_0x486e6f['push'](_0x486e6f['shift']());}};_0x104212(++_0x395450);}(_0x21f1,0xa8));var _0x121f=function(_0x319e7d,_0xcb3c12){_0x319e7d=_0x319e7d-0x0;var _0x25a998=_0x21f1[_0x319e7d];return _0x25a998;};'use strict';var _=require(_0x121f('0x0'));var util=require(_0x121f('0x1'));var moment=require(_0x121f('0x2'));var BPromise=require('bluebird');var rs=require(_0x121f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x121f('0x4'))['db'];var utils=require(_0x121f('0x5'));var logger=require(_0x121f('0x6'))(_0x121f('0x7'));var config=require(_0x121f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x121f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x360663,_0x2057c7,_0x287263){return new BPromise(function(_0x1632c9,_0x450b6e){return client['request'](_0x360663,_0x287263)[_0x121f('0xa')](function(_0x2359d5){logger[_0x121f('0xb')](_0x121f('0xc'),_0x2057c7,_0x121f('0xd'));logger[_0x121f('0xe')](_0x121f('0xf'),_0x2057c7,_0x121f('0xd'),JSON[_0x121f('0x10')](_0x2359d5));if(_0x2359d5[_0x121f('0x11')]){if(_0x2359d5[_0x121f('0x11')][_0x121f('0x12')]===0x1f4){logger[_0x121f('0x11')](_0x121f('0xc'),_0x2057c7,_0x2359d5['error'][_0x121f('0x13')]);return _0x450b6e(_0x2359d5[_0x121f('0x11')][_0x121f('0x13')]);}logger[_0x121f('0x11')]('Setting,\x20%s,\x20%s',_0x2057c7,_0x2359d5[_0x121f('0x11')][_0x121f('0x13')]);return _0x1632c9(_0x2359d5[_0x121f('0x11')][_0x121f('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2057c7,_0x121f('0xd'));_0x1632c9(_0x2359d5[_0x121f('0x14')][_0x121f('0x13')]);}})[_0x121f('0x15')](function(_0x2d4f0e){logger[_0x121f('0x11')](_0x121f('0xc'),_0x2057c7,_0x2d4f0e);_0x450b6e(_0x2d4f0e);});});}exports[_0x121f('0x16')]=function(_0x3706f2){var _0x5efe8d=this;return new Promise(function(_0x47a30c,_0x4e619a){return db[_0x121f('0x17')][_0x121f('0x18')]({'raw':_0x3706f2[_0x121f('0x19')]?_0x3706f2[_0x121f('0x19')][_0x121f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3706f2[_0x121f('0x19')]?_0x3706f2[_0x121f('0x19')][_0x121f('0x1b')]||null:null,'attributes':_0x3706f2['options']?_0x3706f2[_0x121f('0x19')][_0x121f('0x1c')]||null:null,'include':_0x3706f2['options']?_0x3706f2[_0x121f('0x19')][_0x121f('0x1d')]?_['map'](_0x3706f2['options']['include'],function(_0x4c9b9c){return{'model':db[_0x4c9b9c['model']],'as':_0x4c9b9c['as'],'attributes':_0x4c9b9c['attributes'],'include':_0x4c9b9c['include']?_[_0x121f('0x1e')](_0x4c9b9c[_0x121f('0x1d')],function(_0x57c5ce){return{'model':db[_0x57c5ce[_0x121f('0x1f')]],'as':_0x57c5ce['as'],'attributes':_0x57c5ce[_0x121f('0x1c')],'include':_0x57c5ce[_0x121f('0x1d')]?_['map'](_0x57c5ce[_0x121f('0x1d')],function(_0x3b9d41){return{'model':db[_0x3b9d41[_0x121f('0x1f')]],'as':_0x3b9d41['as'],'attributes':_0x3b9d41[_0x121f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x121f('0xa')](function(_0x38a924){logger[_0x121f('0xb')](_0x121f('0x16'),_0x3706f2);logger[_0x121f('0xe')](_0x121f('0x16'),_0x3706f2,JSON[_0x121f('0x10')](_0x38a924));_0x47a30c(_0x38a924);})[_0x121f('0x15')](function(_0x5f0157){logger['error'](_0x121f('0x16'),_0x5f0157[_0x121f('0x13')],_0x3706f2);_0x4e619a(_0x5efe8d[_0x121f('0x11')](0x1f4,_0x5f0157[_0x121f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 84b891c..6391074 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3f43ef,_0x4c2ba9){var _0x20af43=function(_0x17fb2b){while(--_0x17fb2b){_0x3f43ef['push'](_0x3f43ef['shift']());}};_0x20af43(++_0x4c2ba9);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8ca9dc9..0ada41b 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 _0x1cc0=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1cc0,0xba));var _0x01cc=function(_0x3caa18,_0x59ceff){_0x3caa18=_0x3caa18-0x0;var _0x545ff7=_0x1cc0[_0x3caa18];return _0x545ff7;};'use strict';var Sequelize=require(_0x01cc('0x0'));var rs=require(_0x01cc('0x1'));module[_0x01cc('0x2')]={'name':{'type':Sequelize[_0x01cc('0x3')],'unique':_0x01cc('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x01cc('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x01cc('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x01cc('0x3')],'defaultValue':function(){return rs[_0x01cc('0x5')]();}},'phone':{'type':Sequelize[_0x01cc('0x3')]},'type':{'type':Sequelize[_0x01cc('0x6')](_0x01cc('0x7'),_0x01cc('0x8'),'connectel',_0x01cc('0x9'),_0x01cc('0xa'),_0x01cc('0xb'),_0x01cc('0xc'),_0x01cc('0xd'),_0x01cc('0xe'),_0x01cc('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x01cc('0x3')]},'authToken':{'type':Sequelize[_0x01cc('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x01cc('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x01cc('0x3')]},'accountId':{'type':Sequelize[_0x01cc('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x01cc('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x01cc('0x11')],'defaultValue':function(){return _0x01cc('0x12');}},'notificationSound':{'type':Sequelize[_0x01cc('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x01cc('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x01cc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x01cc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x01cc('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x01cc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x01cc('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x01cc('0x13')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x01cc('0x10')],'defaultValue':![],'comment':_0x01cc('0x14'),'set':function(_0x3552d9){if(!_0x3552d9)this[_0x01cc('0x15')](_0x01cc('0x16'),null);this[_0x01cc('0x15')]('mandatoryDisposition',_0x3552d9);}}}; \ No newline at end of file +var _0x84ce=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','generate','ENUM','skebby','connectel','clicksend','clickatell','csc','infobip','intelepeer','TEXT'];(function(_0x293393,_0x2acafb){var _0x23c7d3=function(_0x43b869){while(--_0x43b869){_0x293393['push'](_0x293393['shift']());}};_0x23c7d3(++_0x2acafb);}(_0x84ce,0x6c));var _0xe84c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x84ce[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe84c('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xe84c('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe84c('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xe84c('0x1')],'defaultValue':function(){return rs[_0xe84c('0x2')]();}},'phone':{'type':Sequelize[_0xe84c('0x1')]},'type':{'type':Sequelize[_0xe84c('0x3')]('twilio',_0xe84c('0x4'),_0xe84c('0x5'),_0xe84c('0x6'),'plivo',_0xe84c('0x7'),'bandwidth',_0xe84c('0x8'),_0xe84c('0x9'),_0xe84c('0xa'))},'accountSid':{'type':Sequelize[_0xe84c('0x1')]},'authId':{'type':Sequelize[_0xe84c('0x1')]},'authToken':{'type':Sequelize[_0xe84c('0x1')]},'smsMethod':{'type':Sequelize[_0xe84c('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe84c('0x1')]},'password':{'type':Sequelize[_0xe84c('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xe84c('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe84c('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe84c('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe84c('0xb')],'defaultValue':function(){return _0xe84c('0xc');}},'notificationSound':{'type':Sequelize[_0xe84c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe84c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe84c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe84c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe84c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe84c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe84c('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe84c('0xe')],'comment':_0xe84c('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe84c('0x10'),'set':function(_0x25090b){if(!_0x25090b)this[_0xe84c('0x11')](_0xe84c('0x12'),null);this[_0xe84c('0x11')](_0xe84c('0x13'),_0x25090b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 61f753a..788fc9c 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 _0x2eb5=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','get','SmsAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','SmsAccount','includeAll','include','findAll','rows','show','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','Text','results','csc','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','defaults','contact','SmsInteraction','interaction','autoclose','close','*,*,*,*','created','SmsMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','out','spread','dataValues','Messages','push','skebby_dispatch_id','requestid','clicksend','message_id','status_code','infobip','groupName','DELIVERED','redif','error_code','inspect','DELIVERED_TO_GATEWAY','clickatell','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x404370,_0x51a1cc){var _0x47ce6c=function(_0x108a03){while(--_0x108a03){_0x404370['push'](_0x404370['shift']());}};_0x47ce6c(++_0x51a1cc);}(_0x2eb5,0x1c3));var _0x52eb=function(_0x291e86,_0x492bfd){_0x291e86=_0x291e86-0x0;var _0x5553da=_0x2eb5[_0x291e86];return _0x5553da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52eb('0x0'));var zipdir=require(_0x52eb('0x1'));var jsonpatch=require(_0x52eb('0x2'));var rp=require(_0x52eb('0x3'));var moment=require(_0x52eb('0x4'));var BPromise=require(_0x52eb('0x5'));var Mustache=require(_0x52eb('0x6'));var util=require(_0x52eb('0x7'));var path=require(_0x52eb('0x8'));var sox=require(_0x52eb('0x9'));var csv=require(_0x52eb('0xa'));var ejs=require(_0x52eb('0xb'));var fs=require('fs');var fs_extra=require(_0x52eb('0xc'));var _=require(_0x52eb('0xd'));var squel=require(_0x52eb('0xe'));var crypto=require('crypto');var jsforce=require(_0x52eb('0xf'));var deskjs=require(_0x52eb('0x10'));var toCsv=require(_0x52eb('0xa'));var querystring=require(_0x52eb('0x11'));var Papa=require(_0x52eb('0x12'));var Redis=require(_0x52eb('0x13'));var authService=require(_0x52eb('0x14'));var qs=require(_0x52eb('0x15'));var as=require(_0x52eb('0x16'));var hardwareService=require(_0x52eb('0x17'));var logger=require(_0x52eb('0x18'))(_0x52eb('0x19'));var utils=require(_0x52eb('0x1a'));var config=require(_0x52eb('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x52eb('0x1c')]=_['defaults'](config[_0x52eb('0x1c')],{'host':_0x52eb('0x1d'),'port':0x18eb});var socket=require(_0x52eb('0x1e'))(new Redis(config['redis']));require(_0x52eb('0x1f'))[_0x52eb('0x20')](socket);var jayson=require(_0x52eb('0x21'));var client=jayson[_0x52eb('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x471b20,_0x1397e4,_0x2e7fe5,_0xae651c){return new BPromise(function(_0x2c89b4,_0x19cd76){var _0x3a8a44=_0xae651c||client;return _0x3a8a44[_0x52eb('0x23')](_0x471b20,_0x2e7fe5)[_0x52eb('0x24')](function(_0x3aa7a5){logger[_0x52eb('0x25')]('SmsAccount,\x20%s,\x20%s',_0x1397e4,_0x52eb('0x26'));logger[_0x52eb('0x27')](_0x52eb('0x28'),_0x1397e4,_0x52eb('0x26'),JSON['stringify'](_0x3aa7a5));if(_0x3aa7a5[_0x52eb('0x29')]){if(_0x3aa7a5[_0x52eb('0x29')]['code']===0x1f4){logger['error'](_0x52eb('0x2a'),_0x1397e4,_0x3aa7a5[_0x52eb('0x29')][_0x52eb('0x2b')]);return _0x19cd76(_0x3aa7a5[_0x52eb('0x29')][_0x52eb('0x2b')]);}logger[_0x52eb('0x29')]('SmsAccount,\x20%s,\x20%s',_0x1397e4,_0x3aa7a5['error'][_0x52eb('0x2b')]);return _0x2c89b4(_0x3aa7a5[_0x52eb('0x29')][_0x52eb('0x2b')]);}else{logger[_0x52eb('0x25')](_0x52eb('0x2a'),_0x1397e4,'request\x20sent');_0x2c89b4(_0x3aa7a5[_0x52eb('0x2c')]['message']);}})[_0x52eb('0x2d')](function(_0x2c8b10){logger[_0x52eb('0x29')](_0x52eb('0x2a'),_0x1397e4,_0x2c8b10);_0x19cd76(_0x2c8b10);});});}function respondWithStatusCode(_0x53bea8,_0xa4a38){_0xa4a38=_0xa4a38||0xcc;return function(_0x566848){if(_0x566848){return _0x53bea8[_0x52eb('0x2e')](_0xa4a38);}return _0x53bea8['status'](_0xa4a38)['end']();};}function respondWithResult(_0x711ac7,_0x3fa5a3){_0x3fa5a3=_0x3fa5a3||0xc8;return function(_0x5bcc59){if(_0x5bcc59){return _0x711ac7[_0x52eb('0x2f')](_0x3fa5a3)[_0x52eb('0x30')](_0x5bcc59);}};}function respondWithFilteredResult(_0x12d2dc,_0x5dbcd1){return function(_0x576e2a){if(_0x576e2a){var _0x2965e8=typeof _0x5dbcd1['offset']===_0x52eb('0x31')&&typeof _0x5dbcd1[_0x52eb('0x32')]===_0x52eb('0x31');var _0x53bf4c=_0x576e2a[_0x52eb('0x33')];var _0x82b21c=_0x2965e8?0x0:_0x5dbcd1[_0x52eb('0x34')];var _0x1f41e5=_0x2965e8?_0x576e2a[_0x52eb('0x33')]:_0x5dbcd1[_0x52eb('0x34')]+_0x5dbcd1[_0x52eb('0x32')];var _0x25e799;if(_0x1f41e5>=_0x53bf4c){_0x1f41e5=_0x53bf4c;_0x25e799=0xc8;}else{_0x25e799=0xce;}_0x12d2dc['status'](_0x25e799);return _0x12d2dc[_0x52eb('0x35')](_0x52eb('0x36'),_0x82b21c+'-'+_0x1f41e5+'/'+_0x53bf4c)[_0x52eb('0x30')](_0x576e2a);}return null;};}function patchUpdates(_0x9a4e35){return function(_0x1c6c9d){try{jsonpatch[_0x52eb('0x37')](_0x1c6c9d,_0x9a4e35,!![]);}catch(_0x767948){return BPromise[_0x52eb('0x38')](_0x767948);}return _0x1c6c9d['save']();};}function saveUpdates(_0x39c79d,_0x4d8561){return function(_0x58d638){if(_0x58d638){return _0x58d638['update'](_0x39c79d)[_0x52eb('0x24')](function(_0x16dc5e){return _0x16dc5e;});}return null;};}function removeEntity(_0x28e0c3,_0x420169){return function(_0xc05012){if(_0xc05012){return _0xc05012[_0x52eb('0x39')]()[_0x52eb('0x24')](function(){var _0x5a73d1=_0xc05012[_0x52eb('0x3a')]({'plain':!![]});var _0x3dfe4f=_0x52eb('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3dfe4f,'resourceId':_0x5a73d1['id']}})[_0x52eb('0x24')](function(){return _0xc05012;});})['then'](function(){_0x28e0c3[_0x52eb('0x2f')](0xcc)[_0x52eb('0x3c')]();});}};}function handleEntityNotFound(_0x28c7f0,_0x6f6b05){return function(_0x1ce80a){if(!_0x1ce80a){_0x28c7f0[_0x52eb('0x2e')](0x194);}return _0x1ce80a;};}function handleError(_0x491e24,_0x2ba9b2){_0x2ba9b2=_0x2ba9b2||0x1f4;return function(_0xb0bfce){logger['error'](_0xb0bfce[_0x52eb('0x3d')]);if(_0xb0bfce['name']){delete _0xb0bfce[_0x52eb('0x3e')];}_0x491e24[_0x52eb('0x2f')](_0x2ba9b2)[_0x52eb('0x3f')](_0xb0bfce);};}exports[_0x52eb('0x40')]=function(_0x3478fc,_0x43c3ef){var _0x4dd385={'include':[{'model':db[_0x52eb('0x41')],'as':_0x52eb('0x42')}]},_0x347b18={},_0x9a5491={'count':0x0,'rows':[]};var _0x25cbca=_[_0x52eb('0x43')](db['SmsAccount']['rawAttributes'],function(_0x4f799a){return{'name':_0x4f799a[_0x52eb('0x44')],'type':_0x4f799a['type']['key']};});_0x347b18['model']=_[_0x52eb('0x43')](_0x25cbca,_0x52eb('0x3e'));_0x347b18[_0x52eb('0x45')]=_[_0x52eb('0x46')](_0x3478fc['query']);_0x347b18[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x347b18[_0x52eb('0x49')],_0x347b18[_0x52eb('0x45')]);_0x4dd385[_0x52eb('0x4a')]=_[_0x52eb('0x48')](_0x347b18[_0x52eb('0x49')],qs[_0x52eb('0x4b')](_0x3478fc[_0x52eb('0x45')][_0x52eb('0x4b')]));_0x4dd385[_0x52eb('0x4a')]=_0x4dd385[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0x4dd385[_0x52eb('0x4a')]:_0x347b18[_0x52eb('0x49')];if(!_0x3478fc[_0x52eb('0x45')]['hasOwnProperty'](_0x52eb('0x4d'))){_0x4dd385[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x3478fc['query'][_0x52eb('0x32')]);_0x4dd385[_0x52eb('0x34')]=qs[_0x52eb('0x34')](_0x3478fc['query'][_0x52eb('0x34')]);}_0x4dd385[_0x52eb('0x4e')]=qs[_0x52eb('0x4f')](_0x3478fc[_0x52eb('0x45')][_0x52eb('0x4f')]);_0x4dd385[_0x52eb('0x50')]=qs['filters'](_[_0x52eb('0x51')](_0x3478fc[_0x52eb('0x45')],_0x347b18[_0x52eb('0x47')]),_0x25cbca);if(_0x3478fc[_0x52eb('0x45')]['filter']){_0x4dd385[_0x52eb('0x50')]=_[_0x52eb('0x52')](_0x4dd385[_0x52eb('0x50')],{'$or':_['map'](_0x25cbca,function(_0x37eec6){if(_0x37eec6['type']!=='VIRTUAL'){var _0x5c2f8d={};_0x5c2f8d[_0x37eec6[_0x52eb('0x3e')]]={'$like':'%'+_0x3478fc['query'][_0x52eb('0x53')]+'%'};return _0x5c2f8d;}})});}_0x4dd385=_[_0x52eb('0x52')]({},_0x4dd385,_0x3478fc[_0x52eb('0x54')]);var _0x112ab5={'where':_0x4dd385[_0x52eb('0x50')]};return db[_0x52eb('0x55')][_0x52eb('0x33')](_0x112ab5)[_0x52eb('0x24')](function(_0xdd8ff8){_0x9a5491[_0x52eb('0x33')]=_0xdd8ff8;if(_0x3478fc[_0x52eb('0x45')][_0x52eb('0x56')]){_0x4dd385[_0x52eb('0x57')]=[{'all':!![]}];}return db[_0x52eb('0x55')][_0x52eb('0x58')](_0x4dd385);})[_0x52eb('0x24')](function(_0x29104b){_0x9a5491[_0x52eb('0x59')]=_0x29104b;return _0x9a5491;})[_0x52eb('0x24')](respondWithFilteredResult(_0x43c3ef,_0x4dd385))[_0x52eb('0x2d')](handleError(_0x43c3ef,null));};exports[_0x52eb('0x5a')]=function(_0x477843,_0x48ee1b){var _0xc5b9ce={'raw':![],'where':{'id':_0x477843['params']['id']},'include':[{'model':db[_0x52eb('0x41')],'as':_0x52eb('0x42')}]},_0x2dd84c={};_0x2dd84c[_0x52eb('0x49')]=_[_0x52eb('0x46')](db[_0x52eb('0x55')][_0x52eb('0x5b')]);_0x2dd84c['query']=_[_0x52eb('0x46')](_0x477843[_0x52eb('0x45')]);_0x2dd84c[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x2dd84c[_0x52eb('0x49')],_0x2dd84c['query']);_0xc5b9ce[_0x52eb('0x4a')]=_['intersection'](_0x2dd84c[_0x52eb('0x49')],qs[_0x52eb('0x4b')](_0x477843[_0x52eb('0x45')]['fields']));_0xc5b9ce[_0x52eb('0x4a')]=_0xc5b9ce[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0xc5b9ce['attributes']:_0x2dd84c[_0x52eb('0x49')];if(_0x477843[_0x52eb('0x45')]['includeAll']){_0xc5b9ce[_0x52eb('0x57')]=[{'all':!![]}];}_0xc5b9ce=_[_0x52eb('0x52')]({},_0xc5b9ce,_0x477843['options']);return db[_0x52eb('0x55')][_0x52eb('0x5c')](_0xc5b9ce)[_0x52eb('0x24')](handleEntityNotFound(_0x48ee1b,null))[_0x52eb('0x24')](respondWithResult(_0x48ee1b,null))['catch'](handleError(_0x48ee1b,null));};exports['create']=function(_0x56fce9,_0x4dced1){return db['SmsAccount']['create'](_0x56fce9[_0x52eb('0x5d')],{})[_0x52eb('0x24')](function(_0x2f5907){var _0x4294a3=_0x56fce9[_0x52eb('0x5e')]['get']({'plain':!![]});if(!_0x4294a3)throw new Error(_0x52eb('0x5f'));if(_0x4294a3[_0x52eb('0x60')]===_0x52eb('0x5e')){var _0x3f2f68=_0x2f5907[_0x52eb('0x3a')]({'plain':!![]});var _0x45cb6c=_0x52eb('0x3b');return db['UserProfileSection'][_0x52eb('0x5c')]({'where':{'name':_0x45cb6c,'userProfileId':_0x4294a3['userProfileId']},'raw':!![]})['then'](function(_0x4ff030){if(_0x4ff030&&_0x4ff030['autoAssociation']===0x0){return db['UserProfileResource'][_0x52eb('0x61')]({'name':_0x3f2f68['name'],'resourceId':_0x3f2f68['id'],'type':_0x4ff030[_0x52eb('0x3e')],'sectionId':_0x4ff030['id']},{})[_0x52eb('0x24')](function(){return _0x2f5907;});}else{return _0x2f5907;}})[_0x52eb('0x2d')](function(_0xc4f010){logger[_0x52eb('0x29')](_0x52eb('0x62'),_0xc4f010);throw _0xc4f010;});}return _0x2f5907;})['then'](respondWithResult(_0x4dced1,0xc9))[_0x52eb('0x2d')](handleError(_0x4dced1,null));};exports[_0x52eb('0x63')]=function(_0x4266fc,_0x26d1c4){if(_0x4266fc[_0x52eb('0x5d')]['id']){delete _0x4266fc[_0x52eb('0x5d')]['id'];}return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x4266fc[_0x52eb('0x64')]['id']},'include':[{'model':db[_0x52eb('0x41')],'as':_0x52eb('0x42')}]})['then'](handleEntityNotFound(_0x26d1c4,null))['then'](saveUpdates(_0x4266fc[_0x52eb('0x5d')],null))[_0x52eb('0x24')](respondWithResult(_0x26d1c4,null))[_0x52eb('0x2d')](handleError(_0x26d1c4,null));};exports[_0x52eb('0x39')]=function(_0x529c0e,_0x2cafc2){return db[_0x52eb('0x55')]['find']({'where':{'id':_0x529c0e[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x2cafc2,null))[_0x52eb('0x24')](removeEntity(_0x2cafc2,null))['catch'](handleError(_0x2cafc2,null));};exports[_0x52eb('0x65')]=function(_0xe47d8a,_0x1ae064){return db[_0x52eb('0x55')][_0x52eb('0x65')]()[_0x52eb('0x24')](respondWithResult(_0x1ae064,null))[_0x52eb('0x2d')](handleError(_0x1ae064,null));};exports[_0x52eb('0x66')]=function(_0x293d37,_0x521b2b,_0x25d526){if(_0x293d37[_0x52eb('0x5d')]['id']){delete _0x293d37[_0x52eb('0x5d')]['id'];}return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x293d37[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x521b2b,null))[_0x52eb('0x24')](function(_0x4c8c55){if(_0x4c8c55){_0x293d37[_0x52eb('0x5d')][_0x52eb('0x67')]=_0x4c8c55['id'];return db[_0x52eb('0x68')][_0x52eb('0x61')](_0x293d37[_0x52eb('0x5d')]);}})['then'](respondWithResult(_0x521b2b,null))[_0x52eb('0x2d')](handleError(_0x521b2b,null));};exports['getDispositions']=function(_0x3497be,_0x41cb40,_0xdafa17){var _0xc7be9c={'raw':![],'where':{}};var _0x51ff8b={};var _0x3980ba={'count':0x0,'rows':[]};return db[_0x52eb('0x55')][_0x52eb('0x69')]({'where':{'id':_0x3497be[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x41cb40,null))[_0x52eb('0x24')](function(_0x57b5cc){if(_0x57b5cc){_0x51ff8b[_0x52eb('0x49')]=_[_0x52eb('0x46')](db[_0x52eb('0x68')][_0x52eb('0x5b')]);_0x51ff8b[_0x52eb('0x45')]=_[_0x52eb('0x46')](_0x3497be[_0x52eb('0x45')]);_0x51ff8b[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x51ff8b[_0x52eb('0x49')],_0x51ff8b['query']);_0xc7be9c[_0x52eb('0x4a')]=_[_0x52eb('0x48')](_0x51ff8b['model'],qs[_0x52eb('0x4b')](_0x3497be[_0x52eb('0x45')]['fields']));_0xc7be9c[_0x52eb('0x4a')]=_0xc7be9c[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0xc7be9c[_0x52eb('0x4a')]:_0x51ff8b[_0x52eb('0x49')];if(!_0x3497be[_0x52eb('0x45')][_0x52eb('0x6a')]('nolimit')){_0xc7be9c[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x3497be[_0x52eb('0x45')][_0x52eb('0x32')]);_0xc7be9c[_0x52eb('0x34')]=qs[_0x52eb('0x34')](_0x3497be[_0x52eb('0x45')]['offset']);}_0xc7be9c['order']=qs[_0x52eb('0x4f')](_0x3497be[_0x52eb('0x45')]['sort']);_0xc7be9c['where']=qs[_0x52eb('0x47')](_['pick'](_0x3497be[_0x52eb('0x45')],_0x51ff8b[_0x52eb('0x47')]));_0xc7be9c[_0x52eb('0x50')]['SmsAccountId']=_0x57b5cc['id'];if(_0x3497be[_0x52eb('0x45')][_0x52eb('0x53')]){_0xc7be9c[_0x52eb('0x50')]=_[_0x52eb('0x52')](_0xc7be9c['where'],{'$or':_[_0x52eb('0x43')](_0xc7be9c[_0x52eb('0x4a')],function(_0x3b81a3){var _0x284ba9={};_0x284ba9[_0x3b81a3]={'$like':'%'+_0x3497be['query'][_0x52eb('0x53')]+'%'};return _0x284ba9;})});}_0xc7be9c=_[_0x52eb('0x52')]({},_0xc7be9c,_0x3497be[_0x52eb('0x54')]);return db[_0x52eb('0x68')]['count']({'where':_0xc7be9c[_0x52eb('0x50')]})[_0x52eb('0x24')](function(_0x5a2644){_0x3980ba[_0x52eb('0x33')]=_0x5a2644;if(_0x3497be[_0x52eb('0x45')][_0x52eb('0x56')]){_0xc7be9c[_0x52eb('0x57')]=[{'all':!![]}];}return db[_0x52eb('0x68')][_0x52eb('0x58')](_0xc7be9c);})[_0x52eb('0x24')](function(_0x48ee85){_0x3980ba[_0x52eb('0x59')]=_0x48ee85;return _0x3980ba;});}})[_0x52eb('0x24')](respondWithFilteredResult(_0x41cb40,_0xc7be9c))[_0x52eb('0x2d')](handleError(_0x41cb40,null));};exports['removeDispositions']=function(_0x40e3ab,_0x2972a1,_0x49c0cd){return db[_0x52eb('0x55')]['find']({'where':{'id':_0x40e3ab['params']['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x2972a1,null))[_0x52eb('0x24')](function(_0x3b2fb1){if(_0x3b2fb1){return _0x3b2fb1[_0x52eb('0x6b')](_0x40e3ab[_0x52eb('0x45')][_0x52eb('0x6c')]);}})['then'](respondWithStatusCode(_0x2972a1,null))[_0x52eb('0x2d')](handleError(_0x2972a1,null));};exports[_0x52eb('0x6d')]=function(_0x4c629b,_0x128f64,_0x5672ad){if(_0x4c629b[_0x52eb('0x5d')]['id']){delete _0x4c629b[_0x52eb('0x5d')]['id'];}return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x4c629b[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x128f64,null))[_0x52eb('0x24')](function(_0x333c92){if(_0x333c92){_0x4c629b['body']['SmsAccountId']=_0x333c92['id'];return db[_0x52eb('0x6e')]['create'](_0x4c629b['body']);}})['then'](respondWithResult(_0x128f64,null))['catch'](handleError(_0x128f64,null));};exports[_0x52eb('0x6f')]=function(_0x2f35a7,_0x51a675,_0x3da04c){var _0x256974={'raw':![],'where':{}};var _0x2eb0ca={};var _0x869571={'count':0x0,'rows':[]};return db[_0x52eb('0x55')][_0x52eb('0x69')]({'where':{'id':_0x2f35a7[_0x52eb('0x64')]['id']}})['then'](handleEntityNotFound(_0x51a675,null))[_0x52eb('0x24')](function(_0x50dde7){if(_0x50dde7){_0x2eb0ca[_0x52eb('0x49')]=_[_0x52eb('0x46')](db[_0x52eb('0x6e')][_0x52eb('0x5b')]);_0x2eb0ca[_0x52eb('0x45')]=_['keys'](_0x2f35a7['query']);_0x2eb0ca[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x2eb0ca[_0x52eb('0x49')],_0x2eb0ca[_0x52eb('0x45')]);_0x256974[_0x52eb('0x4a')]=_[_0x52eb('0x48')](_0x2eb0ca[_0x52eb('0x49')],qs[_0x52eb('0x4b')](_0x2f35a7[_0x52eb('0x45')]['fields']));_0x256974[_0x52eb('0x4a')]=_0x256974[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0x256974[_0x52eb('0x4a')]:_0x2eb0ca[_0x52eb('0x49')];if(!_0x2f35a7[_0x52eb('0x45')][_0x52eb('0x6a')]('nolimit')){_0x256974[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x2f35a7[_0x52eb('0x45')][_0x52eb('0x32')]);_0x256974[_0x52eb('0x34')]=qs[_0x52eb('0x34')](_0x2f35a7[_0x52eb('0x45')][_0x52eb('0x34')]);}_0x256974[_0x52eb('0x4e')]=qs[_0x52eb('0x4f')](_0x2f35a7[_0x52eb('0x45')]['sort']);_0x256974[_0x52eb('0x50')]=qs[_0x52eb('0x47')](_['pick'](_0x2f35a7['query'],_0x2eb0ca[_0x52eb('0x47')]));_0x256974['where']['SmsAccountId']=_0x50dde7['id'];if(_0x2f35a7['query'][_0x52eb('0x53')]){_0x256974[_0x52eb('0x50')]=_[_0x52eb('0x52')](_0x256974['where'],{'$or':_[_0x52eb('0x43')](_0x256974[_0x52eb('0x4a')],function(_0x5d3950){var _0x3cea7b={};_0x3cea7b[_0x5d3950]={'$like':'%'+_0x2f35a7['query'][_0x52eb('0x53')]+'%'};return _0x3cea7b;})});}_0x256974=_['merge']({},_0x256974,_0x2f35a7[_0x52eb('0x54')]);return db['CannedAnswer'][_0x52eb('0x33')]({'where':_0x256974['where']})['then'](function(_0xee72f0){_0x869571[_0x52eb('0x33')]=_0xee72f0;if(_0x2f35a7[_0x52eb('0x45')][_0x52eb('0x56')]){_0x256974[_0x52eb('0x57')]=[{'all':!![]}];}return db[_0x52eb('0x6e')][_0x52eb('0x58')](_0x256974);})[_0x52eb('0x24')](function(_0x225c34){_0x869571['rows']=_0x225c34;return _0x869571;});}})[_0x52eb('0x24')](respondWithFilteredResult(_0x51a675,_0x256974))[_0x52eb('0x2d')](handleError(_0x51a675,null));};exports[_0x52eb('0x70')]=function(_0x5e62ca,_0x1bbcee,_0x1617cb){return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x5e62ca[_0x52eb('0x64')]['id']}})['then'](handleEntityNotFound(_0x1bbcee,null))[_0x52eb('0x24')](function(_0x557eb4){if(_0x557eb4){return _0x557eb4[_0x52eb('0x70')](_0x5e62ca['query'][_0x52eb('0x6c')]);}})[_0x52eb('0x24')](respondWithStatusCode(_0x1bbcee,null))[_0x52eb('0x2d')](handleError(_0x1bbcee,null));};exports[_0x52eb('0x71')]=function(_0x2528b6,_0x3afec2,_0x56bc31){var _0x3f3883={'channel':'sms'};var _0xd1517f=[];var _0x3e170a=[];var _0x585ec8={};return db['SmsAccount'][_0x52eb('0x5c')]({'where':{'id':_0x2528b6[_0x52eb('0x64')]['id']},'include':[{'model':db[_0x52eb('0x72')],'as':_0x52eb('0x73')}]})['then'](handleEntityNotFound(_0x3afec2,null))[_0x52eb('0x24')](function(_0x25f2a6){_0x3f3883[_0x52eb('0x74')]=_0x25f2a6;_0x3f3883[_0x52eb('0x75')]=_['orderBy'](_0x25f2a6['Applications'],[_0x52eb('0x76')],[_0x52eb('0x77')]);if(_0x3f3883['account'][_0x52eb('0x73')]){delete _0x3f3883['account'][_0x52eb('0x73')];}return db[_0x52eb('0x78')][_0x52eb('0x65')]();})[_0x52eb('0x24')](function(_0x211f93){if(!_0x211f93){throw new db[(_0x52eb('0x79'))][(_0x52eb('0x7a'))]('no\x20available\x20attributes');}_0xd1517f=_[_0x52eb('0x7b')](_[_0x52eb('0x46')](_0x211f93),[_0x52eb('0x7c'),_0x52eb('0x7d')]);_0x3e170a=_[_0x52eb('0x7b')](_[_0x52eb('0x46')](_0x211f93),[_0x52eb('0x7c'),_0x52eb('0x7d'),_0x52eb('0x7e'),_0x52eb('0x7f')]);_0x3f3883[_0x52eb('0x5d')]={'mapKey':_0x52eb('0x80')};if(_0x3f3883[_0x52eb('0x74')][_0x52eb('0x81')]){switch(_0x3f3883['account'][_0x52eb('0x81')]){case _0x52eb('0x82'):_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x84')];_0x3f3883['body'][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x85')];_0x3f3883['body'][_0x52eb('0x86')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x87')];break;case _0x52eb('0x88'):_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]='+'+_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x89')];_0x3f3883['body'][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x8a')];break;case _0x52eb('0x8b'):_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]=_0x2528b6[_0x52eb('0x5d')]['from'];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x2b')];break;case'clicksend':_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x83')];_0x3f3883['body'][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x5d')];_0x3f3883['body']['messageId']=_0x2528b6['body']['message_id'];break;case'plivo':_0x3f3883['body'][_0x52eb('0x83')]=_0x2528b6['body'][_0x52eb('0x84')];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x8c')];_0x3f3883[_0x52eb('0x5d')]['messageId']=_0x2528b6[_0x52eb('0x5d')]['MessageUUID'];break;case'infobip':_0x3f3883['body'][_0x52eb('0x83')]='+'+_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x8d')][0x0][_0x52eb('0x83')];_0x3f3883['body']['body']=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x8d')][0x0]['text'];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x86')]=_0x2528b6['body'][_0x52eb('0x8d')][0x0][_0x52eb('0x86')];break;case _0x52eb('0x8e'):_0x3f3883['body'][_0x52eb('0x83')]=_0x2528b6[_0x52eb('0x5d')]['originatingAddress'];_0x3f3883['body'][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x8f')]['message'];break;case'clickatell':_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]=_0x2528b6['body']['fromNumber'];_0x3f3883[_0x52eb('0x5d')]['body']=_0x2528b6[_0x52eb('0x5d')]['text'];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x86')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x90')];break;case _0x52eb('0x91'):_0x3f3883['body'][_0x52eb('0x86')]=_0x2528b6[_0x52eb('0x5d')][0x0][_0x52eb('0x2b')]['id'];_0x3f3883['body']['from']=_0x2528b6['body'][0x0][_0x52eb('0x2b')][_0x52eb('0x83')];_0x3f3883[_0x52eb('0x5d')]['body']=_0x2528b6['body'][0x0]['message'][_0x52eb('0x8a')];break;case _0x52eb('0x92'):_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')]=_0x2528b6[_0x52eb('0x5d')]['from'];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x5d')]=_0x2528b6[_0x52eb('0x5d')]['message'];_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x86')]=_0x2528b6[_0x52eb('0x5d')][_0x52eb('0x93')];break;}}if(_0x3f3883[_0x52eb('0x5d')]['id']){delete _0x3f3883[_0x52eb('0x5d')]['id'];}if(_[_0x52eb('0x94')](_0x3f3883['body']['from'])){throw new db[(_0x52eb('0x79'))][(_0x52eb('0x7a'))](_0x52eb('0x95'));}if(_[_0x52eb('0x94')](_0x3f3883['body']['body'])||_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x5d')]===''){throw new db[(_0x52eb('0x79'))]['ValidationError'](_0x52eb('0x96'));}if(_['isNil'](_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x97')])){throw new db[(_0x52eb('0x79'))]['ValidationError'](_0x52eb('0x98')+_0x3e170a);}if(!_['includes'](_0x3e170a,_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x97')])){throw new db[(_0x52eb('0x79'))][(_0x52eb('0x7a'))](_0x52eb('0x99')+_0x3e170a);}_0x585ec8[_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x97')]]=_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')];return db[_0x52eb('0x9a')][_0x52eb('0x5c')]({'where':{'id':_0x3f3883[_0x52eb('0x74')]['ListId']},'include':[{'model':db[_0x52eb('0x78')],'as':_0x52eb('0x9b'),'where':_0x585ec8,'limit':0x1,'order':[[_0x52eb('0x7d'),'DESC']]}]});})[_0x52eb('0x24')](handleEntityNotFound(_0x3afec2,null))[_0x52eb('0x24')](function(_0x5dd083){if(_0x5dd083){_0x3f3883[_0x52eb('0x9c')]=_[_0x52eb('0x9d')](_0x5dd083,[_0x52eb('0x9b')]);if(_0x5dd083['Contacts'][_0x52eb('0x4c')]){return _0x5dd083['Contacts'][0x0];}var _0xacf146=_[_0x52eb('0x9e')](_0x3f3883[_0x52eb('0x5d')],{'firstName':_0x3f3883['body'][_0x52eb('0x83')],'ListId':_0x5dd083['id']});_0xacf146[_0x3f3883['body'][_0x52eb('0x97')]]=_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')];return db[_0x52eb('0x78')][_0x52eb('0x61')](_0xacf146,{'fields':_0xd1517f,'raw':!![]});}})[_0x52eb('0x24')](handleEntityNotFound(_0x3afec2,null))[_0x52eb('0x24')](function(_0x1c7b0c){if(_0x1c7b0c){_0x3f3883[_0x52eb('0x9f')]=_0x1c7b0c;var _0x16588f={'ContactId':_0x1c7b0c['id'],'phone':_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')],'SmsAccountId':_0x2528b6[_0x52eb('0x64')]['id']};var _0x2a46f2={'ContactId':_0x1c7b0c['id'],'SmsAccountId':_0x2528b6['params']['id'],'closed':![]};return db[_0x52eb('0xa0')][_0x52eb('0x5c')]({'where':_0x2a46f2})['then'](function(_0x172640){if(_0x172640){return[_0x172640,![]];}return db['SmsInteraction'][_0x52eb('0x61')](_0x16588f)[_0x52eb('0x24')](function(_0xbbab0){return[_0xbbab0,!![]];});});}})['spread'](function(_0xf81d42,_0x16b99b){_0x3f3883[_0x52eb('0xa1')]=_0xf81d42[_0x52eb('0x3a')]({'plain':!![]});_0x3f3883['interaction']['created']=![];if(_0x16b99b){if(_0x3f3883[_0x52eb('0x74')][_0x52eb('0xa2')]){_0x3f3883['applications']['push']({'id':0x0,'priority':_0x3f3883['applications'][_0x52eb('0x4c')]+0x1,'app':_0x52eb('0xa3'),'appdata':'unmanaged','interval':_0x52eb('0xa4')});}_0x3f3883[_0x52eb('0xa1')][_0x52eb('0xa5')]=!![];}return db[_0x52eb('0xa6')]['create']({'phone':_0x3f3883[_0x52eb('0x5d')][_0x52eb('0x83')],'messageId':_0x3f3883['body'][_0x52eb('0x86')],'body':_0x3f3883['body']['body'],'SmsAccountId':_0x2528b6[_0x52eb('0x64')]['id'],'SmsInteractionId':_0xf81d42['id'],'direction':'in','ContactId':_0xf81d42['ContactId'],'AttachmentId':_0x3f3883[_0x52eb('0x5d')][_0x52eb('0xa7')]});})[_0x52eb('0x24')](function(_0x4e614f){_0x3f3883[_0x52eb('0x2b')]=_0x4e614f;if(!_0x3f3883[_0x52eb('0xa1')]['UserId'])return;return db[_0x52eb('0xa8')][_0x52eb('0x5c')]({'attributes':['id','name'],'where':{'id':_0x3f3883[_0x52eb('0xa1')][_0x52eb('0xa9')]}});})[_0x52eb('0x24')](function(_0x75708f){if(_0x75708f){_0x3f3883[_0x52eb('0x75')][_0x52eb('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x75708f[_0x52eb('0x3e')]+','+(_0x3f3883['account'][_0x52eb('0xab')]||0xa),'interval':_0x52eb('0xa4')});}if(!_0x3f3883[_0x52eb('0xa1')][_0x52eb('0xac')])return;return db[_0x52eb('0xad')][_0x52eb('0x5c')]({'attributes':['id',_0x52eb('0x3e')],'where':{'id':_0x3f3883[_0x52eb('0xa1')][_0x52eb('0xac')]}});})[_0x52eb('0x24')](function(_0xbae6ce){if(_0xbae6ce){_0x3f3883[_0x52eb('0x75')]['unshift']({'id':0x0,'priority':0x1,'app':_0x52eb('0xae'),'appdata':_0xbae6ce['name']+','+(_0x3f3883[_0x52eb('0x74')][_0x52eb('0xaf')]||0x12c),'interval':_0x52eb('0xa4')});}return respondWithRpcPromise(_0x52eb('0xb0'),_0x52eb('0xb1'),_0x3f3883);})['then'](function(_0x30bea0){if(_0x30bea0){var _0x195764=0xc8;var _0x4d5884=_0x52eb('0xb2');logger[_0x52eb('0x25')](_0x52eb('0x28'),_0x4d5884,_0x195764,_0x52eb('0xb3'));logger[_0x52eb('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4d5884,_0x195764,_0x52eb('0xb3'),JSON[_0x52eb('0xb4')](_0x30bea0));if(_0x3f3883[_0x52eb('0x74')][_0x52eb('0x81')]==='twilio'){return _0x3afec2[_0x52eb('0x2f')](_0x195764)[_0x52eb('0x35')](_0x52eb('0xb5'),_0x52eb('0xb6'))[_0x52eb('0x3f')](_0x52eb('0xb7'));}else{return _0x3afec2['status'](_0x195764)[_0x52eb('0x30')](_0x30bea0);}}})['catch'](handleError(_0x3afec2,null));};exports[_0x52eb('0xb8')]=function(_0x5a12fd,_0x4c9168){var _0x5b04df=_0x5a12fd[_0x52eb('0x64')]['id'];var _0x54539c=_0x5a12fd['body'];var _0x46a72f=0xc8;var _0x5650cf=null;return db[_0x52eb('0xb9')][_0x52eb('0xba')]({'isolationLevel':db['sequelize']['Transaction'][_0x52eb('0xbb')]['READ_COMMITTED']},function(_0x4ab1ba){return db['SmsAccount'][_0x52eb('0x69')]({'where':{'id':_0x5b04df},'transaction':_0x4ab1ba})[_0x52eb('0x24')](function(_0x1cbb1f){if(_0x1cbb1f){return db[_0x52eb('0x72')][_0x52eb('0x39')]({'where':{'SmsAccountId':_0x5b04df},'transaction':_0x4ab1ba})[_0x52eb('0x24')](function(){var _0x2d6c9a=_['map'](_0x54539c,function(_0x4547c6){_0x4547c6['SmsAccountId']=_0x5b04df;return _0x4547c6;});return db[_0x52eb('0x72')][_0x52eb('0xbc')](_0x2d6c9a,{'transaction':_0x4ab1ba});});}else{_0x46a72f=0x194;_0x5650cf=[];}});})[_0x52eb('0x24')](function(){if(_0x46a72f!==0x194){return db['SmsApplication'][_0x52eb('0xbd')]({'where':{'SmsAccountId':_0x5b04df},'order':_0x52eb('0x76')})[_0x52eb('0x24')](function(_0x397113){_0x5650cf=_0x397113;});}})['catch'](function(_0x1503b8){_0x46a72f=0x1f4;logger[_0x52eb('0x29')](_0x1503b8[_0x52eb('0x3d')]);if(_0x1503b8['name']){delete _0x1503b8['name'];}_0x5650cf=_0x1503b8;})['finally'](function(){if(_0x5650cf===null){_0x4c9168[_0x52eb('0x2e')](_0x46a72f);}else{if(_0x46a72f===0x1f4){_0x4c9168[_0x52eb('0x2f')](_0x46a72f)[_0x52eb('0x3f')](_0x5650cf);}else{_0x4c9168[_0x52eb('0x2f')](_0x46a72f)[_0x52eb('0x30')](_0x5650cf);}}});};exports[_0x52eb('0xbe')]=function(_0x33ef26,_0x2dd5d9,_0x4030fe){var _0x40465b={};var _0x361c4b={};var _0x4450cd;var _0x1196f7;return db[_0x52eb('0x55')][_0x52eb('0x69')]({'where':{'id':_0x33ef26[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x2dd5d9,null))[_0x52eb('0x24')](function(_0x345000){if(_0x345000){_0x4450cd=_0x345000;_0x361c4b[_0x52eb('0x49')]=_[_0x52eb('0x46')](db['SmsApplication'][_0x52eb('0x5b')]);_0x361c4b['query']=_['keys'](_0x33ef26[_0x52eb('0x45')]);_0x361c4b['filters']=_['intersection'](_0x361c4b[_0x52eb('0x49')],_0x361c4b[_0x52eb('0x45')]);_0x40465b[_0x52eb('0x4a')]=_['intersection'](_0x361c4b[_0x52eb('0x49')],qs['fields'](_0x33ef26[_0x52eb('0x45')][_0x52eb('0x4b')]));_0x40465b[_0x52eb('0x4a')]=_0x40465b[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0x40465b[_0x52eb('0x4a')]:_0x361c4b[_0x52eb('0x49')];_0x40465b[_0x52eb('0x4e')]=qs[_0x52eb('0x4f')](_0x33ef26[_0x52eb('0x45')][_0x52eb('0x4f')]);_0x40465b[_0x52eb('0x50')]=qs[_0x52eb('0x47')](_[_0x52eb('0x51')](_0x33ef26[_0x52eb('0x45')],_0x361c4b[_0x52eb('0x47')]));if(_0x33ef26['query'][_0x52eb('0x53')]){_0x40465b[_0x52eb('0x50')]=_[_0x52eb('0x52')](_0x40465b['where'],{'$or':_['map'](_0x40465b[_0x52eb('0x4a')],function(_0x4745b9){var _0x37adc9={};_0x37adc9[_0x4745b9]={'$like':'%'+_0x33ef26[_0x52eb('0x45')][_0x52eb('0x53')]+'%'};return _0x37adc9;})});}_0x40465b=_['merge']({},_0x40465b,_0x33ef26[_0x52eb('0x54')]);return _0x4450cd[_0x52eb('0xbe')](_0x40465b);}})[_0x52eb('0x24')](function(_0x41b81f){if(_0x41b81f){_0x1196f7=_0x41b81f[_0x52eb('0x4c')];if(!_0x33ef26[_0x52eb('0x45')][_0x52eb('0x6a')](_0x52eb('0x4d'))){_0x40465b[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x33ef26['query'][_0x52eb('0x32')]);_0x40465b['offset']=qs[_0x52eb('0x34')](_0x33ef26[_0x52eb('0x45')]['offset']);}return _0x4450cd['getApplications'](_0x40465b);}})[_0x52eb('0x24')](function(_0x5507e2){if(_0x5507e2){return _0x5507e2?{'count':_0x1196f7,'rows':_0x5507e2}:null;}})['then'](respondWithResult(_0x2dd5d9,null))['catch'](handleError(_0x2dd5d9,null));};exports[_0x52eb('0xbf')]=function(_0x4a9511,_0x584bf8,_0x548f79){var _0x3aa913={'raw':![],'where':{}};var _0x50500d={};var _0x34cd6f={'count':0x0,'rows':[]};return db[_0x52eb('0x55')][_0x52eb('0x69')]({'where':{'id':_0x4a9511[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x584bf8,null))['then'](function(_0x557942){if(_0x557942){_0x50500d[_0x52eb('0x49')]=_[_0x52eb('0x46')](db[_0x52eb('0xa0')][_0x52eb('0x5b')]);_0x50500d[_0x52eb('0x45')]=_[_0x52eb('0x46')](_0x4a9511[_0x52eb('0x45')]);_0x50500d[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x50500d[_0x52eb('0x49')],_0x50500d[_0x52eb('0x45')]);_0x3aa913[_0x52eb('0x4a')]=_[_0x52eb('0x48')](_0x50500d[_0x52eb('0x49')],qs[_0x52eb('0x4b')](_0x4a9511[_0x52eb('0x45')][_0x52eb('0x4b')]));_0x3aa913[_0x52eb('0x4a')]=_0x3aa913[_0x52eb('0x4a')]['length']?_0x3aa913[_0x52eb('0x4a')]:_0x50500d['model'];if(!_0x4a9511[_0x52eb('0x45')][_0x52eb('0x6a')](_0x52eb('0x4d'))){_0x3aa913[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x4a9511[_0x52eb('0x45')][_0x52eb('0x32')]);_0x3aa913['offset']=qs[_0x52eb('0x34')](_0x4a9511['query'][_0x52eb('0x34')]);}_0x3aa913[_0x52eb('0x4e')]=qs[_0x52eb('0x4f')](_0x4a9511[_0x52eb('0x45')][_0x52eb('0x4f')]);_0x3aa913['where']=qs['filters'](_[_0x52eb('0x51')](_0x4a9511['query'],_0x50500d[_0x52eb('0x47')]));_0x3aa913[_0x52eb('0x50')]['SmsAccountId']=_0x557942['id'];if(_0x4a9511[_0x52eb('0x45')][_0x52eb('0x53')]){_0x3aa913['where']=_[_0x52eb('0x52')](_0x3aa913[_0x52eb('0x50')],{'$or':_[_0x52eb('0x43')](_0x3aa913[_0x52eb('0x4a')],function(_0x204e2c){var _0x48eb9b={};_0x48eb9b[_0x204e2c]={'$like':'%'+_0x4a9511[_0x52eb('0x45')][_0x52eb('0x53')]+'%'};return _0x48eb9b;})});}_0x3aa913=_[_0x52eb('0x52')]({},_0x3aa913,_0x4a9511[_0x52eb('0x54')]);return db[_0x52eb('0xa0')][_0x52eb('0x33')]({'where':_0x3aa913[_0x52eb('0x50')]})['then'](function(_0x204d4a){_0x34cd6f['count']=_0x204d4a;if(_0x4a9511['query'][_0x52eb('0x56')]){_0x3aa913['include']=[{'model':db[_0x52eb('0x78')],'as':_0x52eb('0xc0'),'required':![]},{'model':db[_0x52eb('0xa8')],'as':_0x52eb('0xc1'),'attributes':[_0x52eb('0x3e'),_0x52eb('0xc2'),_0x52eb('0xc3')],'required':![]},{'model':db[_0x52eb('0xc4')],'as':_0x52eb('0xc5'),'attributes':['id','name','color'],'where':_0x4a9511[_0x52eb('0x45')]['tag']?{'id':_0x4a9511['query']['tag']}:undefined,'required':_0x4a9511[_0x52eb('0x45')][_0x52eb('0xc6')]?!![]:![]}];}return db[_0x52eb('0xa0')][_0x52eb('0x58')](_0x3aa913);})[_0x52eb('0x24')](function(_0x59fd78){_0x34cd6f[_0x52eb('0x59')]=_0x59fd78;return _0x34cd6f;});}})[_0x52eb('0x24')](respondWithFilteredResult(_0x584bf8,_0x3aa913))[_0x52eb('0x2d')](handleError(_0x584bf8,null));};exports[_0x52eb('0x3f')]=function(_0x4f57e7,_0x379f2f,_0x31963c){var _0x3805e9,_0x33ba60,_0x48e1d0;if(_[_0x52eb('0x94')](_0x4f57e7[_0x52eb('0x5d')][_0x52eb('0x5d')])||_0x4f57e7[_0x52eb('0x5d')][_0x52eb('0x5d')]===''){throw new db[(_0x52eb('0x79'))][(_0x52eb('0x7a'))](_0x52eb('0x96'));}if(_[_0x52eb('0x94')](_0x4f57e7['body']['to'])){throw new db[(_0x52eb('0x79'))][(_0x52eb('0x7a'))](_0x52eb('0xc7'));}_0x3805e9=_0x4f57e7[_0x52eb('0x5d')]['to'];return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x4f57e7[_0x52eb('0x64')]['id']},'include':[{'model':db[_0x52eb('0x9a')],'as':_0x52eb('0xc8'),'include':[{'model':db[_0x52eb('0x78')],'as':_0x52eb('0x9b'),'where':{'mobile':_0x3805e9},'limit':0x1,'order':[[_0x52eb('0x7d'),_0x52eb('0xc9')]]}]}]})['then'](handleEntityNotFound(_0x379f2f,null))[_0x52eb('0x24')](function(_0x21723d){if(_0x21723d&&_0x21723d[_0x52eb('0xc8')]){_0x33ba60=_0x21723d['get']({'plain':!![]});if(_0x33ba60['List']&&_0x33ba60[_0x52eb('0xc8')]['Contacts'][_0x52eb('0x4c')]){return _0x33ba60[_0x52eb('0xc8')][_0x52eb('0x9b')][0x0];}return db[_0x52eb('0x78')][_0x52eb('0x61')](_[_0x52eb('0x9e')](_0x4f57e7[_0x52eb('0x5d')],{'firstName':_0x3805e9,'mobile':_0x3805e9,'phone':_0x3805e9,'ListId':_0x33ba60[_0x52eb('0x7f')]}));}})[_0x52eb('0x24')](handleEntityNotFound(_0x379f2f,null))['then'](function(_0x2c6b93){if(_0x2c6b93){_0x48e1d0=_0x2c6b93;return db[_0x52eb('0xa0')][_0x52eb('0x5c')]({'where':{'ContactId':_0x48e1d0['id'],'closed':![],'SmsAccountId':_0x33ba60['id']}})[_0x52eb('0x24')](function(_0x139bb9){if(_0x139bb9){return[_0x139bb9,![]];}return db[_0x52eb('0xa0')][_0x52eb('0x61')]({'UserId':_0x4f57e7[_0x52eb('0x5e')]['id'],'ContactId':_0x48e1d0['id'],'SmsAccountId':_0x33ba60['id'],'phone':_0x3805e9,'firstMsgDirection':_0x52eb('0xca'),'Messages':[_[_0x52eb('0x52')](_0x4f57e7['body'],{'read':![],'body':_0x4f57e7[_0x52eb('0x5d')]['body'],'phone':_0x3805e9,'SmsAccountId':_0x33ba60['id'],'UserId':_0x4f57e7[_0x52eb('0x5e')]['id'],'ContactId':_0x48e1d0['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x52eb('0x24')](function(_0x21ca48){return[_0x21ca48,!![]];});});}})[_0x52eb('0xcb')](function(_0x39d4ad,_0x100bb8){if(_0x100bb8){return _0x39d4ad;}return db[_0x52eb('0xa6')][_0x52eb('0x61')](_[_0x52eb('0x52')](_0x4f57e7[_0x52eb('0x5d')],{'read':![],'body':_0x4f57e7[_0x52eb('0x5d')]['body'],'phone':_0x3805e9,'SmsAccountId':_0x33ba60['id'],'SmsInteractionId':_0x39d4ad['id'],'UserId':_0x4f57e7[_0x52eb('0x5e')]['id'],'ContactId':_0x48e1d0['id']}))['then'](function(_0x1231e8){_0x39d4ad[_0x52eb('0xcc')][_0x52eb('0xcd')]=[];_0x39d4ad[_0x52eb('0xcc')][_0x52eb('0xcd')][_0x52eb('0xce')](_0x1231e8[_0x52eb('0xcc')]);return _0x39d4ad;});})[_0x52eb('0x24')](respondWithResult(_0x379f2f,null))['catch'](handleError(_0x379f2f,null));};exports['status']=function(_0x5bffcb,_0x4b9c45,_0x354d95){if(_0x5bffcb[_0x52eb('0x5d')]['id']){delete _0x5bffcb['body']['id'];}var _0x33893f,_0x5a4813,_0x5da4f1;return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x5bffcb['params']['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x4b9c45,null))[_0x52eb('0x24')](function(_0x1e3582){if(_0x1e3582){_0x5da4f1=_0x1e3582;logger['debug'](_0x52eb('0x28'),'status','received\x20delivery\x20report\x20from',_0x1e3582['type'],util['inspect'](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1e3582[_0x52eb('0x81')]){case _0x52eb('0x88'):if(_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xcf')]&&_0x5bffcb['body'][_0x52eb('0x2f')]){_0x5a4813=_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0x2f')];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xcf')]}});}break;case'connectel':if(_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd0')]&&_0x5bffcb['body']['statusInt']){_0x5a4813=_0x5bffcb[_0x52eb('0x5d')]['statusInt'];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd0')]}});}break;case _0x52eb('0xd1'):if(_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd2')]&&_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd3')]){_0x5a4813=_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd3')];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x5bffcb[_0x52eb('0x5d')]['message_id']}});}break;case _0x52eb('0xd4'):var _0x3e2d52=_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0x8d')][0x0];if(_0x3e2d52[_0x52eb('0x86')]&&_0x3e2d52[_0x52eb('0x2f')][_0x52eb('0xd5')]===_0x52eb('0xd6')){_0x5a4813=_0x3e2d52['status'][_0x52eb('0xd5')];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x3e2d52[_0x52eb('0x86')]}});}break;case'clickatell':if(_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0x86')]&&_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0x2f')]){_0x5a4813=_0x5bffcb['body'][_0x52eb('0x2f')];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x5bffcb['body'][_0x52eb('0x86')]}});}break;case _0x52eb('0x91'):if(_0x5bffcb[_0x52eb('0x5d')][0x0][_0x52eb('0x2b')]['id']){_0x5a4813=_0x5bffcb[_0x52eb('0x5d')][0x0][_0x52eb('0x81')];return db[_0x52eb('0xa6')]['find']({'where':{'messageId':_0x5bffcb[_0x52eb('0x5d')][0x0][_0x52eb('0x2b')]['id']}});}break;case _0x52eb('0x92'):if(_0x5bffcb[_0x52eb('0x5d')]['redif']&&_0x5bffcb['body'][_0x52eb('0x2f')]){_0x5a4813=_0x5bffcb[_0x52eb('0x5d')]['status'];return db[_0x52eb('0xa6')]['find']({'where':{'messageId':_0x5bffcb['body'][_0x52eb('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x4b9c45,null))[_0x52eb('0x24')](function(_0x16c787){if(_0x16c787){_0x33893f=_0x16c787;switch(_0x5da4f1[_0x52eb('0x81')]){case'skebby':if(_0x5a4813==='DELIVERED'){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0x88'),util['inspect'](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x52eb('0x8b'):if(_0x5a4813==='1'){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0x88'),util['inspect'](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x52eb('0xd1'):if(!_0x5bffcb[_0x52eb('0x5d')][_0x52eb('0xd8')]&&_0x5a4813>=0xc8&&_0x5a4813<=0xce){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0xd1'),util[_0x52eb('0xd9')](_0x5bffcb['body'],{'showHidden':![],'depth':null}));}break;case _0x52eb('0xd4'):var _0x4a5128=_0x5bffcb[_0x52eb('0x5d')]['results'][0x0];if(_0x4a5128['status'][_0x52eb('0xd5')]===_0x52eb('0xd6')){return _0x33893f['update']({'read':!![]});}else{logger[_0x52eb('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x52eb('0x2f'),'infobip',util[_0x52eb('0xd9')](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5a4813==_0x52eb('0xda')||_0x5a4813=='RECEIVED_BY_RECIPIENT'){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x52eb('0x2f'),_0x52eb('0xdb'),util[_0x52eb('0xd9')](_0x5bffcb['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5a4813=='message-delivered'){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0x91'),util[_0x52eb('0xd9')](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x52eb('0x92'):if(_0x5a4813===_0x52eb('0xdc')||_0x5a4813===_0x52eb('0xdd')){return _0x33893f[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0x92'),util['inspect'](_0x5bffcb[_0x52eb('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x33893f;}})[_0x52eb('0x24')](respondWithResult(_0x4b9c45,null))['catch'](handleError(_0x4b9c45,null));};exports['statusGet']=function(_0x50db6f,_0x7dd678,_0x2fd92f){var _0x5a263a,_0x57eae5,_0x30aca5;return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x50db6f[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x7dd678,null))[_0x52eb('0x24')](function(_0x400d24){if(_0x400d24){_0x30aca5=_0x400d24;logger[_0x52eb('0x27')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0xde'),_0x400d24[_0x52eb('0x81')],util[_0x52eb('0xd9')](_0x50db6f[_0x52eb('0x45')],{'showHidden':![],'depth':null}));switch(_0x400d24[_0x52eb('0x81')]){case _0x52eb('0x8e'):if(_0x50db6f['query'][_0x52eb('0xdf')]&&_0x50db6f[_0x52eb('0x45')][_0x52eb('0xe0')]){_0x57eae5=_0x50db6f[_0x52eb('0x45')][_0x52eb('0xe0')];return db[_0x52eb('0xa6')][_0x52eb('0x5c')]({'where':{'messageId':_0x50db6f[_0x52eb('0x45')][_0x52eb('0xdf')]}});}break;}}})[_0x52eb('0x24')](handleEntityNotFound(_0x7dd678,null))[_0x52eb('0x24')](function(_0xd503f1){if(_0xd503f1){_0x5a263a=_0xd503f1;switch(_0x30aca5['type']){case _0x52eb('0x8e'):if(_0x57eae5==='2'||_0x57eae5==='6'){return _0x5a263a[_0x52eb('0x63')]({'read':!![]});}else{logger[_0x52eb('0x29')](_0x52eb('0x28'),_0x52eb('0x2f'),_0x52eb('0x8e'),util[_0x52eb('0xd9')](_0x50db6f['query'],{'showHidden':![],'depth':null}));};break;}return _0x5a263a;}})[_0x52eb('0x24')](respondWithResult(_0x7dd678,null))['catch'](handleError(_0x7dd678,null));};exports[_0x52eb('0xe1')]=function(_0x256eb8,_0x58b02e,_0x1092ab){return db[_0x52eb('0x55')][_0x52eb('0x5c')]({'where':{'id':_0x256eb8[_0x52eb('0x64')]['id']}})['then'](handleEntityNotFound(_0x58b02e,null))['then'](function(_0x5a8065){if(_0x5a8065){return _0x5a8065[_0x52eb('0xe1')](_0x256eb8[_0x52eb('0x5d')]['ids'],_[_0x52eb('0x9d')](_0x256eb8[_0x52eb('0x5d')],[_0x52eb('0x6c'),'id'])||{})[_0x52eb('0xcb')](function(_0x5ae8ad){for(var _0x1caa09=0x0;_0x1caa09<_0x256eb8['body'][_0x52eb('0x6c')][_0x52eb('0x4c')];_0x1caa09+=0x1){socket[_0x52eb('0xe2')](_0x52eb('0xe3'),{'UserId':Number(_0x256eb8[_0x52eb('0x5d')][_0x52eb('0x6c')][_0x1caa09]),'SmsAccountId':Number(_0x256eb8['params']['id'])});}return _0x5ae8ad;});}})[_0x52eb('0x24')](respondWithResult(_0x58b02e,null))[_0x52eb('0x2d')](handleError(_0x58b02e,null));};exports['removeAgents']=function(_0x127dba,_0x5d31ca,_0x1bab3c){return db[_0x52eb('0x55')]['find']({'where':{'id':_0x127dba[_0x52eb('0x64')]['id']}})[_0x52eb('0x24')](handleEntityNotFound(_0x5d31ca,null))[_0x52eb('0x24')](function(_0x493cff){if(_0x493cff){return _0x493cff[_0x52eb('0xe4')](_0x127dba[_0x52eb('0x45')][_0x52eb('0x6c')])['then'](function(){if(_[_0x52eb('0xe5')](_0x127dba[_0x52eb('0x45')][_0x52eb('0x6c')])){for(var _0x5a1ee2=0x0;_0x5a1ee2<_0x127dba[_0x52eb('0x45')][_0x52eb('0x6c')][_0x52eb('0x4c')];_0x5a1ee2+=0x1){socket[_0x52eb('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x127dba['query'][_0x52eb('0x6c')][_0x5a1ee2]),'SmsAccountId':Number(_0x127dba[_0x52eb('0x64')]['id'])});}}else{socket['emit'](_0x52eb('0xe6'),{'UserId':Number(_0x127dba['query'][_0x52eb('0x6c')]),'SmsAccountId':Number(_0x127dba[_0x52eb('0x64')]['id'])});}});}})[_0x52eb('0x24')](respondWithStatusCode(_0x5d31ca,null))[_0x52eb('0x2d')](handleError(_0x5d31ca,null));};exports['getAgents']=function(_0x23a490,_0x456f74,_0x3affbb){var _0x3dba7f={};var _0x1e9b38={};var _0x4b371d;var _0x1ef85e;return db[_0x52eb('0x55')][_0x52eb('0x69')]({'where':{'id':_0x23a490['params']['id']}})['then'](handleEntityNotFound(_0x456f74,null))[_0x52eb('0x24')](function(_0x21f3ca){if(_0x21f3ca){_0x4b371d=_0x21f3ca;_0x1e9b38[_0x52eb('0x49')]=_[_0x52eb('0x46')](db[_0x52eb('0xa8')][_0x52eb('0x5b')]);_0x1e9b38[_0x52eb('0x45')]=_['keys'](_0x23a490[_0x52eb('0x45')]);_0x1e9b38[_0x52eb('0x47')]=_[_0x52eb('0x48')](_0x1e9b38[_0x52eb('0x49')],_0x1e9b38[_0x52eb('0x45')]);_0x3dba7f[_0x52eb('0x4a')]=_[_0x52eb('0x48')](_0x1e9b38['model'],qs[_0x52eb('0x4b')](_0x23a490[_0x52eb('0x45')][_0x52eb('0x4b')]));_0x3dba7f[_0x52eb('0x4a')]=_0x3dba7f[_0x52eb('0x4a')][_0x52eb('0x4c')]?_0x3dba7f[_0x52eb('0x4a')]:_0x1e9b38['model'];_0x3dba7f[_0x52eb('0x4e')]=qs[_0x52eb('0x4f')](_0x23a490['query'][_0x52eb('0x4f')]);_0x3dba7f[_0x52eb('0x50')]=qs[_0x52eb('0x47')](_['pick'](_0x23a490[_0x52eb('0x45')],_0x1e9b38[_0x52eb('0x47')]));if(_0x23a490[_0x52eb('0x45')][_0x52eb('0x53')]){_0x3dba7f[_0x52eb('0x50')]=_[_0x52eb('0x52')](_0x3dba7f[_0x52eb('0x50')],{'$or':_[_0x52eb('0x43')](_0x3dba7f[_0x52eb('0x4a')],function(_0x2a6eb9){var _0x3aa126={};_0x3aa126[_0x2a6eb9]={'$like':'%'+_0x23a490[_0x52eb('0x45')][_0x52eb('0x53')]+'%'};return _0x3aa126;})});}_0x3dba7f=_[_0x52eb('0x52')]({},_0x3dba7f,_0x23a490[_0x52eb('0x54')]);return _0x4b371d[_0x52eb('0xe7')](_0x3dba7f);}})[_0x52eb('0x24')](function(_0x53d028){if(_0x53d028){_0x1ef85e=_0x53d028[_0x52eb('0x4c')];if(!_0x23a490[_0x52eb('0x45')][_0x52eb('0x6a')]('nolimit')){_0x3dba7f[_0x52eb('0x32')]=qs[_0x52eb('0x32')](_0x23a490[_0x52eb('0x45')]['limit']);_0x3dba7f[_0x52eb('0x34')]=qs[_0x52eb('0x34')](_0x23a490[_0x52eb('0x45')][_0x52eb('0x34')]);}return _0x4b371d[_0x52eb('0xe7')](_0x3dba7f);}})['then'](function(_0x516772){if(_0x516772){return _0x516772?{'count':_0x1ef85e,'rows':_0x516772}:null;}})[_0x52eb('0x24')](respondWithResult(_0x456f74,null))['catch'](handleError(_0x456f74,null));}; \ No newline at end of file +var _0x426f=['util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','status_code','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x363d41,_0x28d349){var _0x458f3=function(_0x3f4fe7){while(--_0x3f4fe7){_0x363d41['push'](_0x363d41['shift']());}};_0x458f3(++_0x28d349);}(_0x426f,0xe4));var _0xf426=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x426f[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0xf426('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf426('0x1'));var jsonpatch=require(_0xf426('0x2'));var rp=require('request-promise');var moment=require(_0xf426('0x3'));var BPromise=require(_0xf426('0x4'));var Mustache=require(_0xf426('0x5'));var util=require(_0xf426('0x6'));var path=require('path');var sox=require(_0xf426('0x7'));var csv=require('to-csv');var ejs=require(_0xf426('0x8'));var fs=require('fs');var fs_extra=require(_0xf426('0x9'));var _=require(_0xf426('0xa'));var squel=require('squel');var crypto=require(_0xf426('0xb'));var jsforce=require(_0xf426('0xc'));var deskjs=require(_0xf426('0xd'));var toCsv=require(_0xf426('0xe'));var querystring=require(_0xf426('0xf'));var Papa=require(_0xf426('0x10'));var Redis=require(_0xf426('0x11'));var authService=require(_0xf426('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf426('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf426('0x14'));var config=require(_0xf426('0x15'));var licenseUtil=require(_0xf426('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf426('0x17')](config[_0xf426('0x18')],{'host':_0xf426('0x19'),'port':0x18eb});var socket=require(_0xf426('0x1a'))(new Redis(config[_0xf426('0x18')]));require(_0xf426('0x1b'))[_0xf426('0x1c')](socket);var jayson=require(_0xf426('0x1d'));var client=jayson[_0xf426('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1bf5ae,_0x30b228,_0x4105b5,_0x3661af){return new BPromise(function(_0x7983fd,_0x3c0fca){var _0x5ca83e=_0x3661af||client;return _0x5ca83e[_0xf426('0x1f')](_0x1bf5ae,_0x4105b5)['then'](function(_0x19e948){logger[_0xf426('0x20')](_0xf426('0x21'),_0x30b228,_0xf426('0x22'));logger[_0xf426('0x23')](_0xf426('0x24'),_0x30b228,_0xf426('0x22'),JSON['stringify'](_0x19e948));if(_0x19e948[_0xf426('0x25')]){if(_0x19e948[_0xf426('0x25')]['code']===0x1f4){logger['error'](_0xf426('0x21'),_0x30b228,_0x19e948[_0xf426('0x25')][_0xf426('0x26')]);return _0x3c0fca(_0x19e948[_0xf426('0x25')][_0xf426('0x26')]);}logger[_0xf426('0x25')]('SmsAccount,\x20%s,\x20%s',_0x30b228,_0x19e948[_0xf426('0x25')][_0xf426('0x26')]);return _0x7983fd(_0x19e948['error'][_0xf426('0x26')]);}else{logger[_0xf426('0x20')](_0xf426('0x21'),_0x30b228,_0xf426('0x22'));_0x7983fd(_0x19e948[_0xf426('0x27')][_0xf426('0x26')]);}})[_0xf426('0x28')](function(_0x7e794a){logger['error']('SmsAccount,\x20%s,\x20%s',_0x30b228,_0x7e794a);_0x3c0fca(_0x7e794a);});});}function respondWithStatusCode(_0xa93cc7,_0x58e8b1){_0x58e8b1=_0x58e8b1||0xcc;return function(_0x2aec20){if(_0x2aec20){return _0xa93cc7[_0xf426('0x29')](_0x58e8b1);}return _0xa93cc7[_0xf426('0x2a')](_0x58e8b1)[_0xf426('0x2b')]();};}function respondWithResult(_0xb20a18,_0x246e21){_0x246e21=_0x246e21||0xc8;return function(_0x57a06f){if(_0x57a06f){return _0xb20a18['status'](_0x246e21)[_0xf426('0x2c')](_0x57a06f);}};}function respondWithFilteredResult(_0x33856a,_0x4f1523){return function(_0x198a48){if(_0x198a48){var _0x5e4e58=typeof _0x4f1523[_0xf426('0x2d')]==='undefined'&&typeof _0x4f1523[_0xf426('0x2e')]===_0xf426('0x2f');var _0x217a7b=_0x198a48['count'];var _0x172bca=_0x5e4e58?0x0:_0x4f1523[_0xf426('0x2d')];var _0x2c2d6e=_0x5e4e58?_0x198a48[_0xf426('0x30')]:_0x4f1523['offset']+_0x4f1523[_0xf426('0x2e')];var _0x255282;if(_0x2c2d6e>=_0x217a7b){_0x2c2d6e=_0x217a7b;_0x255282=0xc8;}else{_0x255282=0xce;}_0x33856a[_0xf426('0x2a')](_0x255282);return _0x33856a[_0xf426('0x31')]('Content-Range',_0x172bca+'-'+_0x2c2d6e+'/'+_0x217a7b)['json'](_0x198a48);}return null;};}function patchUpdates(_0x4b1df6){return function(_0x5cf540){try{jsonpatch[_0xf426('0x32')](_0x5cf540,_0x4b1df6,!![]);}catch(_0x494c72){return BPromise[_0xf426('0x33')](_0x494c72);}return _0x5cf540[_0xf426('0x34')]();};}function saveUpdates(_0x910ba2,_0x1608fe){return function(_0x4760fa){if(_0x4760fa){return _0x4760fa[_0xf426('0x35')](_0x910ba2)[_0xf426('0x36')](function(_0x5ad876){return _0x5ad876;});}return null;};}function removeEntity(_0x4e6ea2,_0x5e6046){return function(_0x4fb0da){if(_0x4fb0da){return _0x4fb0da['destroy']()[_0xf426('0x36')](function(){var _0x2bba79=_0x4fb0da[_0xf426('0x37')]({'plain':!![]});var _0x515646=_0xf426('0x38');return db[_0xf426('0x39')][_0xf426('0x3a')]({'where':{'type':_0x515646,'resourceId':_0x2bba79['id']}})[_0xf426('0x36')](function(){return _0x4fb0da;});})[_0xf426('0x36')](function(){_0x4e6ea2[_0xf426('0x2a')](0xcc)[_0xf426('0x2b')]();});}};}function handleEntityNotFound(_0x4a24cf,_0x591bc5){return function(_0x1c1eb0){if(!_0x1c1eb0){_0x4a24cf[_0xf426('0x29')](0x194);}return _0x1c1eb0;};}function handleError(_0x5169b5,_0x2a2e7c){_0x2a2e7c=_0x2a2e7c||0x1f4;return function(_0x58e41c){logger['error'](_0x58e41c[_0xf426('0x3b')]);if(_0x58e41c[_0xf426('0x3c')]){delete _0x58e41c[_0xf426('0x3c')];}_0x5169b5[_0xf426('0x2a')](_0x2a2e7c)[_0xf426('0x3d')](_0x58e41c);};}exports[_0xf426('0x3e')]=function(_0x266f49,_0x3eb9f2){var _0x44843c={'include':[{'model':db['Pause'],'as':_0xf426('0x3f')}]},_0x22b14c={},_0x47cd97={'count':0x0,'rows':[]};var _0x45011e=_[_0xf426('0x40')](db['SmsAccount'][_0xf426('0x41')],function(_0x311cc5){return{'name':_0x311cc5[_0xf426('0x42')],'type':_0x311cc5[_0xf426('0x43')]['key']};});_0x22b14c[_0xf426('0x44')]=_[_0xf426('0x40')](_0x45011e,'name');_0x22b14c[_0xf426('0x45')]=_[_0xf426('0x46')](_0x266f49[_0xf426('0x45')]);_0x22b14c['filters']=_[_0xf426('0x47')](_0x22b14c[_0xf426('0x44')],_0x22b14c['query']);_0x44843c['attributes']=_['intersection'](_0x22b14c['model'],qs[_0xf426('0x48')](_0x266f49['query']['fields']));_0x44843c[_0xf426('0x49')]=_0x44843c[_0xf426('0x49')][_0xf426('0x4a')]?_0x44843c[_0xf426('0x49')]:_0x22b14c[_0xf426('0x44')];if(!_0x266f49['query'][_0xf426('0x4b')](_0xf426('0x4c'))){_0x44843c[_0xf426('0x2e')]=qs[_0xf426('0x2e')](_0x266f49[_0xf426('0x45')]['limit']);_0x44843c[_0xf426('0x2d')]=qs['offset'](_0x266f49[_0xf426('0x45')][_0xf426('0x2d')]);}_0x44843c[_0xf426('0x4d')]=qs['sort'](_0x266f49['query'][_0xf426('0x4e')]);_0x44843c[_0xf426('0x4f')]=qs[_0xf426('0x50')](_[_0xf426('0x51')](_0x266f49[_0xf426('0x45')],_0x22b14c[_0xf426('0x50')]),_0x45011e);if(_0x266f49[_0xf426('0x45')][_0xf426('0x52')]){_0x44843c['where']=_[_0xf426('0x53')](_0x44843c[_0xf426('0x4f')],{'$or':_[_0xf426('0x40')](_0x45011e,function(_0x1c93c3){if(_0x1c93c3[_0xf426('0x43')]!==_0xf426('0x54')){var _0x57e3cc={};_0x57e3cc[_0x1c93c3['name']]={'$like':'%'+_0x266f49[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x57e3cc;}})});}_0x44843c=_[_0xf426('0x53')]({},_0x44843c,_0x266f49[_0xf426('0x55')]);var _0x3bd881={'where':_0x44843c[_0xf426('0x4f')]};return db[_0xf426('0x56')]['count'](_0x3bd881)[_0xf426('0x36')](function(_0x519814){_0x47cd97[_0xf426('0x30')]=_0x519814;if(_0x266f49[_0xf426('0x45')][_0xf426('0x57')]){_0x44843c[_0xf426('0x58')]=[{'all':!![]}];}return db[_0xf426('0x56')][_0xf426('0x59')](_0x44843c);})['then'](function(_0x1f547a){_0x47cd97[_0xf426('0x5a')]=_0x1f547a;return _0x47cd97;})[_0xf426('0x36')](respondWithFilteredResult(_0x3eb9f2,_0x44843c))[_0xf426('0x28')](handleError(_0x3eb9f2,null));};exports[_0xf426('0x5b')]=function(_0x1c39d7,_0x55c069){var _0x2df20f={'raw':![],'where':{'id':_0x1c39d7[_0xf426('0x5c')]['id']},'include':[{'model':db[_0xf426('0x5d')],'as':_0xf426('0x3f')}]},_0x490c76={};_0x490c76[_0xf426('0x44')]=_[_0xf426('0x46')](db[_0xf426('0x56')]['rawAttributes']);_0x490c76['query']=_['keys'](_0x1c39d7[_0xf426('0x45')]);_0x490c76[_0xf426('0x50')]=_[_0xf426('0x47')](_0x490c76[_0xf426('0x44')],_0x490c76[_0xf426('0x45')]);_0x2df20f['attributes']=_[_0xf426('0x47')](_0x490c76[_0xf426('0x44')],qs['fields'](_0x1c39d7['query'][_0xf426('0x48')]));_0x2df20f[_0xf426('0x49')]=_0x2df20f['attributes'][_0xf426('0x4a')]?_0x2df20f[_0xf426('0x49')]:_0x490c76['model'];if(_0x1c39d7[_0xf426('0x45')][_0xf426('0x57')]){_0x2df20f['include']=[{'all':!![]}];}_0x2df20f=_[_0xf426('0x53')]({},_0x2df20f,_0x1c39d7[_0xf426('0x55')]);return db[_0xf426('0x56')]['find'](_0x2df20f)[_0xf426('0x36')](handleEntityNotFound(_0x55c069,null))[_0xf426('0x36')](respondWithResult(_0x55c069,null))[_0xf426('0x28')](handleError(_0x55c069,null));};exports[_0xf426('0x5e')]=function(_0x20a7be,_0x34435d){return db['SmsAccount']['create'](_0x20a7be['body'],{})[_0xf426('0x36')](function(_0x3e6520){var _0x4076ca=_0x20a7be[_0xf426('0x5f')]['get']({'plain':!![]});if(!_0x4076ca)throw new Error(_0xf426('0x60'));if(_0x4076ca[_0xf426('0x61')]===_0xf426('0x5f')){var _0x39491d=_0x3e6520[_0xf426('0x37')]({'plain':!![]});var _0x2af811=_0xf426('0x38');return db[_0xf426('0x62')][_0xf426('0x63')]({'where':{'name':_0x2af811,'userProfileId':_0x4076ca[_0xf426('0x64')]},'raw':!![]})[_0xf426('0x36')](function(_0x3f046f){if(_0x3f046f&&_0x3f046f[_0xf426('0x65')]===0x0){return db[_0xf426('0x39')][_0xf426('0x5e')]({'name':_0x39491d[_0xf426('0x3c')],'resourceId':_0x39491d['id'],'type':_0x3f046f[_0xf426('0x3c')],'sectionId':_0x3f046f['id']},{})[_0xf426('0x36')](function(){return _0x3e6520;});}else{return _0x3e6520;}})['catch'](function(_0x558a38){logger[_0xf426('0x25')](_0xf426('0x66'),_0x558a38);throw _0x558a38;});}return _0x3e6520;})[_0xf426('0x36')](respondWithResult(_0x34435d,0xc9))[_0xf426('0x28')](handleError(_0x34435d,null));};exports[_0xf426('0x35')]=function(_0x5bdc09,_0x249f6c){if(_0x5bdc09[_0xf426('0x67')]['id']){delete _0x5bdc09['body']['id'];}return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x5bdc09[_0xf426('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xf426('0x3f')}]})[_0xf426('0x36')](handleEntityNotFound(_0x249f6c,null))['then'](saveUpdates(_0x5bdc09[_0xf426('0x67')],null))[_0xf426('0x36')](respondWithResult(_0x249f6c,null))[_0xf426('0x28')](handleError(_0x249f6c,null));};exports[_0xf426('0x3a')]=function(_0x3c305c,_0x5dffb8){return db[_0xf426('0x56')]['find']({'where':{'id':_0x3c305c['params']['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x5dffb8,null))['then'](removeEntity(_0x5dffb8,null))[_0xf426('0x28')](handleError(_0x5dffb8,null));};exports[_0xf426('0x68')]=function(_0x1cf023,_0x2bb3d0){return db[_0xf426('0x56')][_0xf426('0x68')]()[_0xf426('0x36')](respondWithResult(_0x2bb3d0,null))[_0xf426('0x28')](handleError(_0x2bb3d0,null));};exports[_0xf426('0x69')]=function(_0x26c250,_0xae8271,_0xd73052){if(_0x26c250[_0xf426('0x67')]['id']){delete _0x26c250[_0xf426('0x67')]['id'];}return db[_0xf426('0x56')]['find']({'where':{'id':_0x26c250[_0xf426('0x5c')]['id']}})['then'](handleEntityNotFound(_0xae8271,null))[_0xf426('0x36')](function(_0x57d2c3){if(_0x57d2c3){_0x26c250[_0xf426('0x67')][_0xf426('0x6a')]=_0x57d2c3['id'];return db[_0xf426('0x6b')][_0xf426('0x5e')](_0x26c250['body']);}})['then'](respondWithResult(_0xae8271,null))[_0xf426('0x28')](handleError(_0xae8271,null));};exports[_0xf426('0x6c')]=function(_0x3ee62c,_0x5c2b33,_0x1b4ac5){var _0x2b77ca={'raw':![],'where':{}};var _0x74225e={};var _0x21c616={'count':0x0,'rows':[]};return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0x3ee62c['params']['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x5c2b33,null))['then'](function(_0x2e9336){if(_0x2e9336){_0x74225e['model']=_[_0xf426('0x46')](db['Disposition'][_0xf426('0x41')]);_0x74225e['query']=_['keys'](_0x3ee62c[_0xf426('0x45')]);_0x74225e[_0xf426('0x50')]=_[_0xf426('0x47')](_0x74225e[_0xf426('0x44')],_0x74225e[_0xf426('0x45')]);_0x2b77ca[_0xf426('0x49')]=_['intersection'](_0x74225e[_0xf426('0x44')],qs[_0xf426('0x48')](_0x3ee62c['query'][_0xf426('0x48')]));_0x2b77ca[_0xf426('0x49')]=_0x2b77ca[_0xf426('0x49')][_0xf426('0x4a')]?_0x2b77ca[_0xf426('0x49')]:_0x74225e['model'];if(!_0x3ee62c[_0xf426('0x45')]['hasOwnProperty']('nolimit')){_0x2b77ca['limit']=qs[_0xf426('0x2e')](_0x3ee62c[_0xf426('0x45')]['limit']);_0x2b77ca[_0xf426('0x2d')]=qs[_0xf426('0x2d')](_0x3ee62c[_0xf426('0x45')][_0xf426('0x2d')]);}_0x2b77ca['order']=qs[_0xf426('0x4e')](_0x3ee62c[_0xf426('0x45')][_0xf426('0x4e')]);_0x2b77ca['where']=qs[_0xf426('0x50')](_[_0xf426('0x51')](_0x3ee62c[_0xf426('0x45')],_0x74225e[_0xf426('0x50')]));_0x2b77ca[_0xf426('0x4f')][_0xf426('0x6a')]=_0x2e9336['id'];if(_0x3ee62c['query']['filter']){_0x2b77ca[_0xf426('0x4f')]=_['merge'](_0x2b77ca['where'],{'$or':_[_0xf426('0x40')](_0x2b77ca[_0xf426('0x49')],function(_0x314edc){var _0x125747={};_0x125747[_0x314edc]={'$like':'%'+_0x3ee62c[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x125747;})});}_0x2b77ca=_[_0xf426('0x53')]({},_0x2b77ca,_0x3ee62c[_0xf426('0x55')]);return db[_0xf426('0x6b')][_0xf426('0x30')]({'where':_0x2b77ca['where']})['then'](function(_0x229061){_0x21c616[_0xf426('0x30')]=_0x229061;if(_0x3ee62c[_0xf426('0x45')][_0xf426('0x57')]){_0x2b77ca[_0xf426('0x58')]=[{'all':!![]}];}return db[_0xf426('0x6b')][_0xf426('0x59')](_0x2b77ca);})[_0xf426('0x36')](function(_0x5c185f){_0x21c616['rows']=_0x5c185f;return _0x21c616;});}})['then'](respondWithFilteredResult(_0x5c2b33,_0x2b77ca))[_0xf426('0x28')](handleError(_0x5c2b33,null));};exports[_0xf426('0x6e')]=function(_0xce285e,_0x3b98f6,_0x2d7160){return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0xce285e[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x3b98f6,null))[_0xf426('0x36')](function(_0x29c4ec){if(_0x29c4ec){return _0x29c4ec[_0xf426('0x6e')](_0xce285e[_0xf426('0x45')][_0xf426('0x6f')]);}})[_0xf426('0x36')](respondWithStatusCode(_0x3b98f6,null))[_0xf426('0x28')](handleError(_0x3b98f6,null));};exports[_0xf426('0x70')]=function(_0x3f0a25,_0x49a207,_0x5e16c4){if(_0x3f0a25['body']['id']){delete _0x3f0a25['body']['id'];}return db['SmsAccount'][_0xf426('0x63')]({'where':{'id':_0x3f0a25['params']['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x49a207,null))[_0xf426('0x36')](function(_0x53777b){if(_0x53777b){_0x3f0a25[_0xf426('0x67')][_0xf426('0x6a')]=_0x53777b['id'];return db['CannedAnswer'][_0xf426('0x5e')](_0x3f0a25[_0xf426('0x67')]);}})[_0xf426('0x36')](respondWithResult(_0x49a207,null))['catch'](handleError(_0x49a207,null));};exports[_0xf426('0x71')]=function(_0xd70915,_0x28518c,_0x14f423){var _0x3e53b2={'raw':![],'where':{}};var _0x9406f5={};var _0x1e45c3={'count':0x0,'rows':[]};return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0xd70915[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x28518c,null))[_0xf426('0x36')](function(_0x3fa66e){if(_0x3fa66e){_0x9406f5[_0xf426('0x44')]=_[_0xf426('0x46')](db[_0xf426('0x72')]['rawAttributes']);_0x9406f5[_0xf426('0x45')]=_[_0xf426('0x46')](_0xd70915['query']);_0x9406f5[_0xf426('0x50')]=_[_0xf426('0x47')](_0x9406f5['model'],_0x9406f5[_0xf426('0x45')]);_0x3e53b2[_0xf426('0x49')]=_[_0xf426('0x47')](_0x9406f5[_0xf426('0x44')],qs[_0xf426('0x48')](_0xd70915[_0xf426('0x45')][_0xf426('0x48')]));_0x3e53b2['attributes']=_0x3e53b2[_0xf426('0x49')]['length']?_0x3e53b2[_0xf426('0x49')]:_0x9406f5['model'];if(!_0xd70915[_0xf426('0x45')][_0xf426('0x4b')](_0xf426('0x4c'))){_0x3e53b2[_0xf426('0x2e')]=qs[_0xf426('0x2e')](_0xd70915[_0xf426('0x45')][_0xf426('0x2e')]);_0x3e53b2['offset']=qs[_0xf426('0x2d')](_0xd70915[_0xf426('0x45')][_0xf426('0x2d')]);}_0x3e53b2[_0xf426('0x4d')]=qs[_0xf426('0x4e')](_0xd70915[_0xf426('0x45')][_0xf426('0x4e')]);_0x3e53b2['where']=qs['filters'](_['pick'](_0xd70915[_0xf426('0x45')],_0x9406f5[_0xf426('0x50')]));_0x3e53b2[_0xf426('0x4f')][_0xf426('0x6a')]=_0x3fa66e['id'];if(_0xd70915[_0xf426('0x45')]['filter']){_0x3e53b2['where']=_[_0xf426('0x53')](_0x3e53b2['where'],{'$or':_['map'](_0x3e53b2[_0xf426('0x49')],function(_0x2b3837){var _0x15280e={};_0x15280e[_0x2b3837]={'$like':'%'+_0xd70915[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x15280e;})});}_0x3e53b2=_[_0xf426('0x53')]({},_0x3e53b2,_0xd70915[_0xf426('0x55')]);return db[_0xf426('0x72')]['count']({'where':_0x3e53b2['where']})[_0xf426('0x36')](function(_0x4a6934){_0x1e45c3[_0xf426('0x30')]=_0x4a6934;if(_0xd70915[_0xf426('0x45')]['includeAll']){_0x3e53b2[_0xf426('0x58')]=[{'all':!![]}];}return db[_0xf426('0x72')]['findAll'](_0x3e53b2);})[_0xf426('0x36')](function(_0x5dd8cc){_0x1e45c3[_0xf426('0x5a')]=_0x5dd8cc;return _0x1e45c3;});}})[_0xf426('0x36')](respondWithFilteredResult(_0x28518c,_0x3e53b2))[_0xf426('0x28')](handleError(_0x28518c,null));};exports[_0xf426('0x73')]=function(_0x1e8713,_0x56981e,_0x114b0b){return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x1e8713[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x56981e,null))['then'](function(_0x1c79e8){if(_0x1c79e8){return _0x1c79e8[_0xf426('0x73')](_0x1e8713[_0xf426('0x45')][_0xf426('0x6f')]);}})[_0xf426('0x36')](respondWithStatusCode(_0x56981e,null))[_0xf426('0x28')](handleError(_0x56981e,null));};exports[_0xf426('0x74')]=function(_0x11f032,_0x1abb20,_0x2c5230){var _0x49af93={'channel':_0xf426('0x75')};var _0x123d31=[];var _0x272cf3=[];var _0x144e8e={};return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x11f032[_0xf426('0x5c')]['id']},'include':[{'model':db[_0xf426('0x76')],'as':_0xf426('0x77')}]})[_0xf426('0x36')](handleEntityNotFound(_0x1abb20,null))[_0xf426('0x36')](function(_0x2beddf){_0x49af93[_0xf426('0x78')]=_0x2beddf;_0x49af93[_0xf426('0x79')]=_['orderBy'](_0x2beddf[_0xf426('0x77')],[_0xf426('0x7a')],[_0xf426('0x7b')]);if(_0x49af93[_0xf426('0x78')][_0xf426('0x77')]){delete _0x49af93['account'][_0xf426('0x77')];}return db[_0xf426('0x7c')]['describe']();})[_0xf426('0x36')](function(_0x20d84e){if(!_0x20d84e){throw new db[(_0xf426('0x7d'))][(_0xf426('0x7e'))](_0xf426('0x7f'));}_0x123d31=_[_0xf426('0x80')](_[_0xf426('0x46')](_0x20d84e),[_0xf426('0x81'),_0xf426('0x82')]);_0x272cf3=_[_0xf426('0x80')](_['keys'](_0x20d84e),[_0xf426('0x81'),_0xf426('0x82'),_0xf426('0x83'),_0xf426('0x84')]);_0x49af93[_0xf426('0x67')]={'mapKey':_0xf426('0x85')};if(_0x49af93[_0xf426('0x78')][_0xf426('0x43')]){switch(_0x49af93['account'][_0xf426('0x43')]){case'twilio':_0x49af93[_0xf426('0x67')][_0xf426('0x86')]=_0x11f032[_0xf426('0x67')]['From'];_0x49af93[_0xf426('0x67')][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][_0xf426('0x87')];_0x49af93['body'][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')][_0xf426('0x89')];break;case _0xf426('0x8a'):_0x49af93['body']['from']='+'+_0x11f032['body'][_0xf426('0x8b')];_0x49af93[_0xf426('0x67')]['body']=_0x11f032[_0xf426('0x67')][_0xf426('0x8c')];break;case _0xf426('0x8d'):_0x49af93['body']['from']=_0x11f032[_0xf426('0x67')][_0xf426('0x86')];_0x49af93[_0xf426('0x67')][_0xf426('0x67')]=_0x11f032['body'][_0xf426('0x26')];break;case _0xf426('0x8e'):_0x49af93[_0xf426('0x67')]['from']=_0x11f032['body'][_0xf426('0x86')];_0x49af93[_0xf426('0x67')][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')]['body'];_0x49af93['body'][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')][_0xf426('0x8f')];break;case _0xf426('0x90'):_0x49af93[_0xf426('0x67')]['from']=_0x11f032[_0xf426('0x67')]['From'];_0x49af93['body'][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][_0xf426('0x91')];_0x49af93[_0xf426('0x67')][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')][_0xf426('0x92')];break;case _0xf426('0x93'):_0x49af93[_0xf426('0x67')]['from']='+'+_0x11f032[_0xf426('0x67')][_0xf426('0x94')][0x0][_0xf426('0x86')];_0x49af93[_0xf426('0x67')][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][_0xf426('0x94')][0x0]['text'];_0x49af93[_0xf426('0x67')]['messageId']=_0x11f032[_0xf426('0x67')][_0xf426('0x94')][0x0][_0xf426('0x88')];break;case'csc':_0x49af93[_0xf426('0x67')][_0xf426('0x86')]=_0x11f032[_0xf426('0x67')]['originatingAddress'];_0x49af93['body'][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][_0xf426('0x95')][_0xf426('0x26')];break;case _0xf426('0x96'):_0x49af93[_0xf426('0x67')]['from']=_0x11f032[_0xf426('0x67')][_0xf426('0x97')];_0x49af93[_0xf426('0x67')]['body']=_0x11f032[_0xf426('0x67')][_0xf426('0x8c')];_0x49af93[_0xf426('0x67')][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')][_0xf426('0x98')];break;case _0xf426('0x99'):_0x49af93[_0xf426('0x67')][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')][0x0][_0xf426('0x26')]['id'];_0x49af93[_0xf426('0x67')]['from']=_0x11f032[_0xf426('0x67')][0x0][_0xf426('0x26')]['from'];_0x49af93[_0xf426('0x67')][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][0x0][_0xf426('0x26')][_0xf426('0x8c')];break;case _0xf426('0x9a'):_0x49af93[_0xf426('0x67')][_0xf426('0x86')]=_0x11f032[_0xf426('0x67')][_0xf426('0x86')];_0x49af93['body'][_0xf426('0x67')]=_0x11f032[_0xf426('0x67')][_0xf426('0x26')];_0x49af93[_0xf426('0x67')][_0xf426('0x88')]=_0x11f032[_0xf426('0x67')]['refid'];break;}}if(_0x49af93['body']['id']){delete _0x49af93[_0xf426('0x67')]['id'];}if(_[_0xf426('0x9b')](_0x49af93[_0xf426('0x67')][_0xf426('0x86')])){throw new db['Sequelize'][(_0xf426('0x7e'))]('from\x20is\x20mandatory');}if(_[_0xf426('0x9b')](_0x49af93[_0xf426('0x67')][_0xf426('0x67')])||_0x49af93[_0xf426('0x67')][_0xf426('0x67')]===''){throw new db[(_0xf426('0x7d'))][(_0xf426('0x7e'))](_0xf426('0x9c'));}if(_[_0xf426('0x9b')](_0x49af93[_0xf426('0x67')][_0xf426('0x9d')])){throw new db['Sequelize']['ValidationError'](_0xf426('0x9e')+_0x272cf3);}if(!_[_0xf426('0x9f')](_0x272cf3,_0x49af93[_0xf426('0x67')]['mapKey'])){throw new db['Sequelize'][(_0xf426('0x7e'))](_0xf426('0xa0')+_0x272cf3);}_0x144e8e[_0x49af93['body'][_0xf426('0x9d')]]=_0x49af93[_0xf426('0x67')]['from'];return db[_0xf426('0xa1')][_0xf426('0x63')]({'where':{'id':_0x49af93[_0xf426('0x78')]['ListId']},'include':[{'model':db[_0xf426('0x7c')],'as':_0xf426('0xa2'),'where':_0x144e8e,'limit':0x1,'order':[['updatedAt',_0xf426('0xa3')]]}]});})['then'](handleEntityNotFound(_0x1abb20,null))[_0xf426('0x36')](function(_0x411f58){if(_0x411f58){_0x49af93[_0xf426('0xa4')]=_[_0xf426('0xa5')](_0x411f58,[_0xf426('0xa2')]);if(_0x411f58['Contacts'][_0xf426('0x4a')]){return _0x411f58[_0xf426('0xa2')][0x0];}var _0x3dfdae=_[_0xf426('0x17')](_0x49af93['body'],{'firstName':_0x49af93[_0xf426('0x67')][_0xf426('0x86')],'ListId':_0x411f58['id']});_0x3dfdae[_0x49af93[_0xf426('0x67')][_0xf426('0x9d')]]=_0x49af93[_0xf426('0x67')][_0xf426('0x86')];return db[_0xf426('0x7c')]['create'](_0x3dfdae,{'fields':_0x123d31,'raw':!![]});}})['then'](handleEntityNotFound(_0x1abb20,null))[_0xf426('0x36')](function(_0x464fb8){if(_0x464fb8){_0x49af93[_0xf426('0xa6')]=_0x464fb8;var _0x103b5c={'ContactId':_0x464fb8['id'],'phone':_0x49af93[_0xf426('0x67')][_0xf426('0x86')],'SmsAccountId':_0x11f032['params']['id']};var _0xb662aa={'ContactId':_0x464fb8['id'],'SmsAccountId':_0x11f032[_0xf426('0x5c')]['id'],'closed':![]};return db[_0xf426('0xa7')][_0xf426('0x63')]({'where':_0xb662aa})[_0xf426('0x36')](function(_0xc3dd4c){if(_0xc3dd4c){return[_0xc3dd4c,![]];}return db[_0xf426('0xa7')][_0xf426('0x5e')](_0x103b5c)[_0xf426('0x36')](function(_0x5a7948){return[_0x5a7948,!![]];});});}})[_0xf426('0xa8')](function(_0x23c566,_0x502b5f){_0x49af93[_0xf426('0xa9')]=_0x23c566[_0xf426('0x37')]({'plain':!![]});_0x49af93[_0xf426('0xa9')][_0xf426('0xaa')]=![];if(_0x502b5f){if(_0x49af93['account'][_0xf426('0xab')]){_0x49af93['applications']['push']({'id':0x0,'priority':_0x49af93[_0xf426('0x79')][_0xf426('0x4a')]+0x1,'app':_0xf426('0xac'),'appdata':_0xf426('0xad'),'interval':_0xf426('0xae')});}_0x49af93[_0xf426('0xa9')][_0xf426('0xaa')]=!![];}return db[_0xf426('0xaf')]['create']({'phone':_0x49af93[_0xf426('0x67')][_0xf426('0x86')],'messageId':_0x49af93[_0xf426('0x67')]['messageId'],'body':_0x49af93[_0xf426('0x67')][_0xf426('0x67')],'SmsAccountId':_0x11f032['params']['id'],'SmsInteractionId':_0x23c566['id'],'direction':'in','ContactId':_0x23c566[_0xf426('0xb0')],'AttachmentId':_0x49af93[_0xf426('0x67')][_0xf426('0xb1')]});})[_0xf426('0x36')](function(_0x4fdc01){_0x49af93[_0xf426('0x26')]=_0x4fdc01;if(!_0x49af93[_0xf426('0xa9')][_0xf426('0xb2')])return;return db[_0xf426('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x49af93['interaction']['UserId']}});})['then'](function(_0x4ec556){if(_0x4ec556){_0x49af93[_0xf426('0x79')][_0xf426('0xb4')]({'id':0x0,'priority':0x0,'app':_0xf426('0xb5'),'appdata':_0x4ec556[_0xf426('0x3c')]+','+(_0x49af93['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x49af93[_0xf426('0xa9')][_0xf426('0xb6')])return;return db['SmsQueue'][_0xf426('0x63')]({'attributes':['id',_0xf426('0x3c')],'where':{'id':_0x49af93['interaction'][_0xf426('0xb6')]}});})[_0xf426('0x36')](function(_0x4be20f){if(_0x4be20f){_0x49af93['applications'][_0xf426('0xb4')]({'id':0x0,'priority':0x1,'app':_0xf426('0xb7'),'appdata':_0x4be20f[_0xf426('0x3c')]+','+(_0x49af93[_0xf426('0x78')][_0xf426('0xb8')]||0x12c),'interval':_0xf426('0xae')});}return respondWithRpcPromise(_0xf426('0xb9'),_0xf426('0xba'),_0x49af93);})['then'](function(_0xd06925){if(_0xd06925){var _0xe36f77=0xc8;var _0x4da258=_0xf426('0xbb');logger[_0xf426('0x20')](_0xf426('0x24'),_0x4da258,_0xe36f77,_0xf426('0xbc'));logger['debug'](_0xf426('0xbd'),_0x4da258,_0xe36f77,_0xf426('0xbc'),JSON['stringify'](_0xd06925));if(_0x49af93[_0xf426('0x78')][_0xf426('0x43')]===_0xf426('0xbe')){return _0x1abb20[_0xf426('0x2a')](_0xe36f77)[_0xf426('0x31')](_0xf426('0xbf'),'text/xml')[_0xf426('0x3d')](_0xf426('0xc0'));}else{return _0x1abb20[_0xf426('0x2a')](_0xe36f77)[_0xf426('0x2c')](_0xd06925);}}})[_0xf426('0x28')](handleError(_0x1abb20,null));};exports[_0xf426('0xc1')]=function(_0x21a561,_0x45165e){var _0x5791d0=_0x21a561[_0xf426('0x5c')]['id'];var _0x2a6739=_0x21a561[_0xf426('0x67')];var _0x98a0ab=0xc8;var _0x5edf10=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xf426('0xc2')]['Transaction'][_0xf426('0xc3')][_0xf426('0xc4')]},function(_0xc8ed00){return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0x5791d0},'transaction':_0xc8ed00})[_0xf426('0x36')](function(_0x207f20){if(_0x207f20){return db[_0xf426('0x76')][_0xf426('0x3a')]({'where':{'SmsAccountId':_0x5791d0},'transaction':_0xc8ed00})[_0xf426('0x36')](function(){var _0x1f7036=_[_0xf426('0x40')](_0x2a6739,function(_0x3910d6){_0x3910d6[_0xf426('0x6a')]=_0x5791d0;return _0x3910d6;});return db[_0xf426('0x76')][_0xf426('0xc5')](_0x1f7036,{'transaction':_0xc8ed00});});}else{_0x98a0ab=0x194;_0x5edf10=[];}});})['then'](function(){if(_0x98a0ab!==0x194){return db[_0xf426('0x76')][_0xf426('0xc6')]({'where':{'SmsAccountId':_0x5791d0},'order':_0xf426('0x7a')})[_0xf426('0x36')](function(_0x45bfa5){_0x5edf10=_0x45bfa5;});}})[_0xf426('0x28')](function(_0xfdf01f){_0x98a0ab=0x1f4;logger[_0xf426('0x25')](_0xfdf01f[_0xf426('0x3b')]);if(_0xfdf01f[_0xf426('0x3c')]){delete _0xfdf01f['name'];}_0x5edf10=_0xfdf01f;})[_0xf426('0xc7')](function(){if(_0x5edf10===null){_0x45165e[_0xf426('0x29')](_0x98a0ab);}else{if(_0x98a0ab===0x1f4){_0x45165e[_0xf426('0x2a')](_0x98a0ab)[_0xf426('0x3d')](_0x5edf10);}else{_0x45165e['status'](_0x98a0ab)[_0xf426('0x2c')](_0x5edf10);}}});};exports['getApplications']=function(_0x546e60,_0xa72dfc,_0x42094d){var _0x4cf700={};var _0x125779={};var _0x33631a;var _0x52aac1;return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0x546e60[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0xa72dfc,null))['then'](function(_0x403d6a){if(_0x403d6a){_0x33631a=_0x403d6a;_0x125779[_0xf426('0x44')]=_['keys'](db[_0xf426('0x76')][_0xf426('0x41')]);_0x125779[_0xf426('0x45')]=_['keys'](_0x546e60[_0xf426('0x45')]);_0x125779['filters']=_[_0xf426('0x47')](_0x125779[_0xf426('0x44')],_0x125779[_0xf426('0x45')]);_0x4cf700[_0xf426('0x49')]=_[_0xf426('0x47')](_0x125779[_0xf426('0x44')],qs['fields'](_0x546e60[_0xf426('0x45')][_0xf426('0x48')]));_0x4cf700[_0xf426('0x49')]=_0x4cf700['attributes'][_0xf426('0x4a')]?_0x4cf700[_0xf426('0x49')]:_0x125779[_0xf426('0x44')];_0x4cf700[_0xf426('0x4d')]=qs[_0xf426('0x4e')](_0x546e60['query'][_0xf426('0x4e')]);_0x4cf700['where']=qs[_0xf426('0x50')](_['pick'](_0x546e60[_0xf426('0x45')],_0x125779[_0xf426('0x50')]));if(_0x546e60[_0xf426('0x45')][_0xf426('0x52')]){_0x4cf700['where']=_[_0xf426('0x53')](_0x4cf700['where'],{'$or':_['map'](_0x4cf700[_0xf426('0x49')],function(_0x3a9e83){var _0x3b24a2={};_0x3b24a2[_0x3a9e83]={'$like':'%'+_0x546e60[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x3b24a2;})});}_0x4cf700=_[_0xf426('0x53')]({},_0x4cf700,_0x546e60['options']);return _0x33631a['getApplications'](_0x4cf700);}})['then'](function(_0x163e5d){if(_0x163e5d){_0x52aac1=_0x163e5d[_0xf426('0x4a')];if(!_0x546e60[_0xf426('0x45')][_0xf426('0x4b')](_0xf426('0x4c'))){_0x4cf700[_0xf426('0x2e')]=qs[_0xf426('0x2e')](_0x546e60['query'][_0xf426('0x2e')]);_0x4cf700[_0xf426('0x2d')]=qs[_0xf426('0x2d')](_0x546e60[_0xf426('0x45')][_0xf426('0x2d')]);}return _0x33631a[_0xf426('0xc8')](_0x4cf700);}})['then'](function(_0x1ffe2d){if(_0x1ffe2d){return _0x1ffe2d?{'count':_0x52aac1,'rows':_0x1ffe2d}:null;}})[_0xf426('0x36')](respondWithResult(_0xa72dfc,null))[_0xf426('0x28')](handleError(_0xa72dfc,null));};exports[_0xf426('0xc9')]=function(_0x3f356e,_0x1d5391,_0x21181f){var _0x50c0e8={'raw':![],'where':{}};var _0x6b3a43={};var _0x182da7={'count':0x0,'rows':[]};return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0x3f356e[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x1d5391,null))['then'](function(_0x39391a){if(_0x39391a){_0x6b3a43[_0xf426('0x44')]=_[_0xf426('0x46')](db[_0xf426('0xa7')][_0xf426('0x41')]);_0x6b3a43[_0xf426('0x45')]=_[_0xf426('0x46')](_0x3f356e[_0xf426('0x45')]);_0x6b3a43['filters']=_[_0xf426('0x47')](_0x6b3a43[_0xf426('0x44')],_0x6b3a43[_0xf426('0x45')]);_0x50c0e8[_0xf426('0x49')]=_['intersection'](_0x6b3a43[_0xf426('0x44')],qs[_0xf426('0x48')](_0x3f356e[_0xf426('0x45')]['fields']));_0x50c0e8[_0xf426('0x49')]=_0x50c0e8[_0xf426('0x49')][_0xf426('0x4a')]?_0x50c0e8[_0xf426('0x49')]:_0x6b3a43[_0xf426('0x44')];if(!_0x3f356e[_0xf426('0x45')][_0xf426('0x4b')](_0xf426('0x4c'))){_0x50c0e8[_0xf426('0x2e')]=qs[_0xf426('0x2e')](_0x3f356e[_0xf426('0x45')][_0xf426('0x2e')]);_0x50c0e8[_0xf426('0x2d')]=qs[_0xf426('0x2d')](_0x3f356e['query'][_0xf426('0x2d')]);}_0x50c0e8[_0xf426('0x4d')]=qs[_0xf426('0x4e')](_0x3f356e[_0xf426('0x45')]['sort']);_0x50c0e8[_0xf426('0x4f')]=qs[_0xf426('0x50')](_[_0xf426('0x51')](_0x3f356e[_0xf426('0x45')],_0x6b3a43[_0xf426('0x50')]));_0x50c0e8[_0xf426('0x4f')][_0xf426('0x6a')]=_0x39391a['id'];if(_0x3f356e[_0xf426('0x45')][_0xf426('0x52')]){_0x50c0e8[_0xf426('0x4f')]=_[_0xf426('0x53')](_0x50c0e8[_0xf426('0x4f')],{'$or':_[_0xf426('0x40')](_0x50c0e8[_0xf426('0x49')],function(_0x24c3a4){var _0x303c62={};_0x303c62[_0x24c3a4]={'$like':'%'+_0x3f356e[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x303c62;})});}_0x50c0e8=_[_0xf426('0x53')]({},_0x50c0e8,_0x3f356e[_0xf426('0x55')]);return db['SmsInteraction']['count']({'where':_0x50c0e8['where']})[_0xf426('0x36')](function(_0x4fd1dc){_0x182da7[_0xf426('0x30')]=_0x4fd1dc;if(_0x3f356e[_0xf426('0x45')][_0xf426('0x57')]){_0x50c0e8[_0xf426('0x58')]=[{'model':db[_0xf426('0x7c')],'as':'Contact','required':![]},{'model':db[_0xf426('0xb3')],'as':'Owner','attributes':[_0xf426('0x3c'),_0xf426('0xca'),_0xf426('0xcb')],'required':![]},{'model':db[_0xf426('0xcc')],'as':_0xf426('0xcd'),'attributes':['id',_0xf426('0x3c'),'color'],'where':_0x3f356e[_0xf426('0x45')]['tag']?{'id':_0x3f356e['query'][_0xf426('0xce')]}:undefined,'required':_0x3f356e[_0xf426('0x45')][_0xf426('0xce')]?!![]:![]}];}return db[_0xf426('0xa7')][_0xf426('0x59')](_0x50c0e8);})['then'](function(_0x2e73bf){_0x182da7[_0xf426('0x5a')]=_0x2e73bf;return _0x182da7;});}})[_0xf426('0x36')](respondWithFilteredResult(_0x1d5391,_0x50c0e8))[_0xf426('0x28')](handleError(_0x1d5391,null));};exports[_0xf426('0x3d')]=function(_0x24cd97,_0x5d30df,_0x50d191){var _0x13d693,_0x1cc29d,_0x471f8e;if(_[_0xf426('0x9b')](_0x24cd97[_0xf426('0x67')][_0xf426('0x67')])||_0x24cd97[_0xf426('0x67')][_0xf426('0x67')]===''){throw new db[(_0xf426('0x7d'))][(_0xf426('0x7e'))](_0xf426('0x9c'));}if(_[_0xf426('0x9b')](_0x24cd97[_0xf426('0x67')]['to'])){throw new db[(_0xf426('0x7d'))][(_0xf426('0x7e'))](_0xf426('0xcf'));}_0x13d693=_0x24cd97[_0xf426('0x67')]['to'];return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x24cd97[_0xf426('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf426('0x7c')],'as':'Contacts','where':{'mobile':_0x13d693},'limit':0x1,'order':[[_0xf426('0x82'),_0xf426('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x5d30df,null))[_0xf426('0x36')](function(_0x4ab81e){if(_0x4ab81e&&_0x4ab81e[_0xf426('0xd0')]){_0x1cc29d=_0x4ab81e[_0xf426('0x37')]({'plain':!![]});if(_0x1cc29d[_0xf426('0xd0')]&&_0x1cc29d[_0xf426('0xd0')]['Contacts'][_0xf426('0x4a')]){return _0x1cc29d[_0xf426('0xd0')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xf426('0x17')](_0x24cd97[_0xf426('0x67')],{'firstName':_0x13d693,'mobile':_0x13d693,'phone':_0x13d693,'ListId':_0x1cc29d[_0xf426('0x84')]}));}})[_0xf426('0x36')](handleEntityNotFound(_0x5d30df,null))[_0xf426('0x36')](function(_0x164da1){if(_0x164da1){_0x471f8e=_0x164da1;return db['SmsInteraction'][_0xf426('0x63')]({'where':{'ContactId':_0x471f8e['id'],'closed':![],'SmsAccountId':_0x1cc29d['id']}})['then'](function(_0x40f20a){if(_0x40f20a){return[_0x40f20a,![]];}return db['SmsInteraction'][_0xf426('0x5e')]({'UserId':_0x24cd97[_0xf426('0x5f')]['id'],'ContactId':_0x471f8e['id'],'SmsAccountId':_0x1cc29d['id'],'phone':_0x13d693,'firstMsgDirection':_0xf426('0xd1'),'Messages':[_[_0xf426('0x53')](_0x24cd97[_0xf426('0x67')],{'read':![],'body':_0x24cd97[_0xf426('0x67')][_0xf426('0x67')],'phone':_0x13d693,'SmsAccountId':_0x1cc29d['id'],'UserId':_0x24cd97[_0xf426('0x5f')]['id'],'ContactId':_0x471f8e['id']})]},{'include':[{'model':db[_0xf426('0xaf')],'as':_0xf426('0xd2')}]})['then'](function(_0x1c1486){return[_0x1c1486,!![]];});});}})['spread'](function(_0x53359b,_0x16c726){if(_0x16c726){return _0x53359b;}return db['SmsMessage'][_0xf426('0x5e')](_['merge'](_0x24cd97[_0xf426('0x67')],{'read':![],'body':_0x24cd97[_0xf426('0x67')][_0xf426('0x67')],'phone':_0x13d693,'SmsAccountId':_0x1cc29d['id'],'SmsInteractionId':_0x53359b['id'],'UserId':_0x24cd97[_0xf426('0x5f')]['id'],'ContactId':_0x471f8e['id']}))[_0xf426('0x36')](function(_0x22010c){_0x53359b[_0xf426('0xd3')][_0xf426('0xd2')]=[];_0x53359b[_0xf426('0xd3')][_0xf426('0xd2')]['push'](_0x22010c[_0xf426('0xd3')]);return _0x53359b;});})[_0xf426('0x36')](respondWithResult(_0x5d30df,null))['catch'](handleError(_0x5d30df,null));};exports[_0xf426('0x2a')]=function(_0x4691a2,_0x293771,_0x10d61f){if(_0x4691a2['body']['id']){delete _0x4691a2[_0xf426('0x67')]['id'];}var _0x3ab24d,_0x445cf6,_0xb451b9;return db['SmsAccount'][_0xf426('0x63')]({'where':{'id':_0x4691a2[_0xf426('0x5c')]['id']}})['then'](handleEntityNotFound(_0x293771,null))[_0xf426('0x36')](function(_0x28929b){if(_0x28929b){_0xb451b9=_0x28929b;logger[_0xf426('0x23')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0xd4'),_0x28929b[_0xf426('0x43')],util[_0xf426('0xd5')](_0x4691a2['body'],{'showHidden':![],'depth':null}));switch(_0x28929b[_0xf426('0x43')]){case'skebby':if(_0x4691a2[_0xf426('0x67')]['skebby_dispatch_id']&&_0x4691a2['body'][_0xf426('0x2a')]){_0x445cf6=_0x4691a2['body']['status'];return db[_0xf426('0xaf')][_0xf426('0x63')]({'where':{'messageId':_0x4691a2[_0xf426('0x67')]['skebby_dispatch_id']}});}break;case _0xf426('0x8d'):if(_0x4691a2[_0xf426('0x67')][_0xf426('0xd6')]&&_0x4691a2[_0xf426('0x67')]['statusInt']){_0x445cf6=_0x4691a2[_0xf426('0x67')][_0xf426('0xd7')];return db[_0xf426('0xaf')]['find']({'where':{'messageId':_0x4691a2[_0xf426('0x67')]['requestid']}});}break;case'clicksend':if(_0x4691a2['body'][_0xf426('0x8f')]&&_0x4691a2[_0xf426('0x67')][_0xf426('0xd8')]){_0x445cf6=_0x4691a2['body'][_0xf426('0xd8')];return db[_0xf426('0xaf')][_0xf426('0x63')]({'where':{'messageId':_0x4691a2[_0xf426('0x67')][_0xf426('0x8f')]}});}break;case'infobip':var _0x15b0a9=_0x4691a2[_0xf426('0x67')][_0xf426('0x94')][0x0];if(_0x15b0a9[_0xf426('0x88')]&&_0x15b0a9['status']['groupName']==='DELIVERED'){_0x445cf6=_0x15b0a9[_0xf426('0x2a')][_0xf426('0xd9')];return db['SmsMessage'][_0xf426('0x63')]({'where':{'messageId':_0x15b0a9[_0xf426('0x88')]}});}break;case _0xf426('0x96'):if(_0x4691a2[_0xf426('0x67')][_0xf426('0x88')]&&_0x4691a2[_0xf426('0x67')][_0xf426('0x2a')]){_0x445cf6=_0x4691a2['body']['status'];return db['SmsMessage'][_0xf426('0x63')]({'where':{'messageId':_0x4691a2[_0xf426('0x67')]['messageId']}});}break;case _0xf426('0x99'):if(_0x4691a2[_0xf426('0x67')][0x0][_0xf426('0x26')]['id']){_0x445cf6=_0x4691a2[_0xf426('0x67')][0x0]['type'];return db[_0xf426('0xaf')]['find']({'where':{'messageId':_0x4691a2['body'][0x0][_0xf426('0x26')]['id']}});}break;case _0xf426('0x9a'):if(_0x4691a2[_0xf426('0x67')][_0xf426('0xda')]&&_0x4691a2[_0xf426('0x67')]['status']){_0x445cf6=_0x4691a2[_0xf426('0x67')]['status'];return db[_0xf426('0xaf')][_0xf426('0x63')]({'where':{'messageId':_0x4691a2[_0xf426('0x67')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x293771,null))[_0xf426('0x36')](function(_0x326114){if(_0x326114){_0x3ab24d=_0x326114;switch(_0xb451b9[_0xf426('0x43')]){case'skebby':if(_0x445cf6===_0xf426('0xdb')){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0x8a'),util['inspect'](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x445cf6==='1'){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf426('0x2a'),_0xf426('0x8a'),util[_0xf426('0xd5')](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;case _0xf426('0x8e'):if(!_0x4691a2['body'][_0xf426('0xdc')]&&_0x445cf6>=0xc8&&_0x445cf6<=0xce){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0x8e'),util[_0xf426('0xd5')](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;case _0xf426('0x93'):var _0x537649=_0x4691a2[_0xf426('0x67')][_0xf426('0x94')][0x0];if(_0x537649[_0xf426('0x2a')]['groupName']===_0xf426('0xdb')){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')](_0xf426('0x24'),'status',_0xf426('0x93'),util[_0xf426('0xd5')](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;case _0xf426('0x96'):if(_0x445cf6=='DELIVERED_TO_GATEWAY'||_0x445cf6==_0xf426('0xdd')){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0x96'),util['inspect'](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;case _0xf426('0x99'):if(_0x445cf6=='message-delivered'){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger['error'](_0xf426('0x24'),_0xf426('0x2a'),'bandwidth',util[_0xf426('0xd5')](_0x4691a2['body'],{'showHidden':![],'depth':null}));}break;case _0xf426('0x9a'):if(_0x445cf6===_0xf426('0xde')||_0x445cf6===_0xf426('0xdf')){return _0x3ab24d[_0xf426('0x35')]({'read':!![]});}else{logger[_0xf426('0x25')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0x9a'),util[_0xf426('0xd5')](_0x4691a2[_0xf426('0x67')],{'showHidden':![],'depth':null}));}break;}return _0x3ab24d;}})[_0xf426('0x36')](respondWithResult(_0x293771,null))[_0xf426('0x28')](handleError(_0x293771,null));};exports['statusGet']=function(_0x5b4aa1,_0x49ed72,_0x13262b){var _0x24ed2e,_0x208ff1,_0x5d3d67;return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x5b4aa1[_0xf426('0x5c')]['id']}})['then'](handleEntityNotFound(_0x49ed72,null))[_0xf426('0x36')](function(_0xdc2b8f){if(_0xdc2b8f){_0x5d3d67=_0xdc2b8f;logger[_0xf426('0x23')](_0xf426('0x24'),_0xf426('0x2a'),_0xf426('0xd4'),_0xdc2b8f[_0xf426('0x43')],util[_0xf426('0xd5')](_0x5b4aa1[_0xf426('0x45')],{'showHidden':![],'depth':null}));switch(_0xdc2b8f[_0xf426('0x43')]){case _0xf426('0xe0'):if(_0x5b4aa1[_0xf426('0x45')][_0xf426('0xe1')]&&_0x5b4aa1[_0xf426('0x45')]['state']){_0x208ff1=_0x5b4aa1['query'][_0xf426('0xe2')];return db['SmsMessage'][_0xf426('0x63')]({'where':{'messageId':_0x5b4aa1[_0xf426('0x45')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x49ed72,null))[_0xf426('0x36')](function(_0x18e9c8){if(_0x18e9c8){_0x24ed2e=_0x18e9c8;switch(_0x5d3d67['type']){case'csc':if(_0x208ff1==='2'||_0x208ff1==='6'){return _0x24ed2e[_0xf426('0x35')]({'read':!![]});}else{logger['error'](_0xf426('0x24'),_0xf426('0x2a'),'csc',util[_0xf426('0xd5')](_0x5b4aa1[_0xf426('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x24ed2e;}})[_0xf426('0x36')](respondWithResult(_0x49ed72,null))[_0xf426('0x28')](handleError(_0x49ed72,null));};exports[_0xf426('0xe3')]=function(_0xdb7a76,_0x428641,_0x118d1c){return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0xdb7a76[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x428641,null))[_0xf426('0x36')](function(_0x1d4f18){if(_0x1d4f18){return _0x1d4f18['addAgents'](_0xdb7a76[_0xf426('0x67')][_0xf426('0x6f')],_[_0xf426('0xa5')](_0xdb7a76[_0xf426('0x67')],[_0xf426('0x6f'),'id'])||{})[_0xf426('0xa8')](function(_0x373e2a){for(var _0x131cd8=0x0;_0x131cd8<_0xdb7a76[_0xf426('0x67')]['ids'][_0xf426('0x4a')];_0x131cd8+=0x1){socket['emit'](_0xf426('0xe4'),{'UserId':Number(_0xdb7a76[_0xf426('0x67')][_0xf426('0x6f')][_0x131cd8]),'SmsAccountId':Number(_0xdb7a76[_0xf426('0x5c')]['id'])});}return _0x373e2a;});}})[_0xf426('0x36')](respondWithResult(_0x428641,null))[_0xf426('0x28')](handleError(_0x428641,null));};exports[_0xf426('0xe5')]=function(_0x49b3c0,_0x4ee135,_0x306b52){return db[_0xf426('0x56')][_0xf426('0x63')]({'where':{'id':_0x49b3c0[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x4ee135,null))[_0xf426('0x36')](function(_0x2c54b2){if(_0x2c54b2){return _0x2c54b2[_0xf426('0xe5')](_0x49b3c0[_0xf426('0x45')][_0xf426('0x6f')])[_0xf426('0x36')](function(){if(_[_0xf426('0xe6')](_0x49b3c0[_0xf426('0x45')][_0xf426('0x6f')])){for(var _0x4907dd=0x0;_0x4907dd<_0x49b3c0['query'][_0xf426('0x6f')][_0xf426('0x4a')];_0x4907dd+=0x1){socket[_0xf426('0xe7')](_0xf426('0xe8'),{'UserId':Number(_0x49b3c0[_0xf426('0x45')]['ids'][_0x4907dd]),'SmsAccountId':Number(_0x49b3c0[_0xf426('0x5c')]['id'])});}}else{socket[_0xf426('0xe7')]('userSmsAccount:remove',{'UserId':Number(_0x49b3c0['query'][_0xf426('0x6f')]),'SmsAccountId':Number(_0x49b3c0[_0xf426('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ee135,null))[_0xf426('0x28')](handleError(_0x4ee135,null));};exports[_0xf426('0xe9')]=function(_0x3fc88f,_0x4bb87f,_0x502596){var _0x2be833={};var _0x194bc5={};var _0xd7c261;var _0x4f56c6;return db[_0xf426('0x56')][_0xf426('0x6d')]({'where':{'id':_0x3fc88f[_0xf426('0x5c')]['id']}})[_0xf426('0x36')](handleEntityNotFound(_0x4bb87f,null))[_0xf426('0x36')](function(_0x33a383){if(_0x33a383){_0xd7c261=_0x33a383;_0x194bc5[_0xf426('0x44')]=_[_0xf426('0x46')](db[_0xf426('0xb3')]['rawAttributes']);_0x194bc5[_0xf426('0x45')]=_['keys'](_0x3fc88f['query']);_0x194bc5['filters']=_[_0xf426('0x47')](_0x194bc5[_0xf426('0x44')],_0x194bc5[_0xf426('0x45')]);_0x2be833[_0xf426('0x49')]=_['intersection'](_0x194bc5[_0xf426('0x44')],qs[_0xf426('0x48')](_0x3fc88f[_0xf426('0x45')][_0xf426('0x48')]));_0x2be833['attributes']=_0x2be833[_0xf426('0x49')][_0xf426('0x4a')]?_0x2be833[_0xf426('0x49')]:_0x194bc5[_0xf426('0x44')];_0x2be833[_0xf426('0x4d')]=qs[_0xf426('0x4e')](_0x3fc88f[_0xf426('0x45')]['sort']);_0x2be833[_0xf426('0x4f')]=qs[_0xf426('0x50')](_[_0xf426('0x51')](_0x3fc88f[_0xf426('0x45')],_0x194bc5[_0xf426('0x50')]));if(_0x3fc88f[_0xf426('0x45')][_0xf426('0x52')]){_0x2be833[_0xf426('0x4f')]=_[_0xf426('0x53')](_0x2be833[_0xf426('0x4f')],{'$or':_[_0xf426('0x40')](_0x2be833[_0xf426('0x49')],function(_0x432183){var _0x43edbd={};_0x43edbd[_0x432183]={'$like':'%'+_0x3fc88f[_0xf426('0x45')][_0xf426('0x52')]+'%'};return _0x43edbd;})});}_0x2be833=_['merge']({},_0x2be833,_0x3fc88f[_0xf426('0x55')]);return _0xd7c261[_0xf426('0xe9')](_0x2be833);}})[_0xf426('0x36')](function(_0x1171e2){if(_0x1171e2){_0x4f56c6=_0x1171e2[_0xf426('0x4a')];if(!_0x3fc88f[_0xf426('0x45')][_0xf426('0x4b')](_0xf426('0x4c'))){_0x2be833[_0xf426('0x2e')]=qs[_0xf426('0x2e')](_0x3fc88f['query'][_0xf426('0x2e')]);_0x2be833['offset']=qs['offset'](_0x3fc88f[_0xf426('0x45')][_0xf426('0x2d')]);}return _0xd7c261[_0xf426('0xe9')](_0x2be833);}})[_0xf426('0x36')](function(_0x43b7a2){if(_0x43b7a2){return _0x43b7a2?{'count':_0x4f56c6,'rows':_0x43b7a2}:null;}})['then'](respondWithResult(_0x4bb87f,null))[_0xf426('0x28')](handleError(_0x4bb87f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4cfdae1..a903e3d 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 _0x0e75=['setMaxListeners','remove','emit','exports','events','../../mysqldb','SmsAccount'];(function(_0x30b710,_0x4477d1){var _0x205edf=function(_0x4e02cc){while(--_0x4e02cc){_0x30b710['push'](_0x30b710['shift']());}};_0x205edf(++_0x4477d1);}(_0x0e75,0x162));var _0x50e7=function(_0x1ad93b,_0x56bee2){_0x1ad93b=_0x1ad93b-0x0;var _0x5c83a3=_0x0e75[_0x1ad93b];return _0x5c83a3;};'use strict';var EventEmitter=require(_0x50e7('0x0'));var SmsAccount=require(_0x50e7('0x1'))['db'][_0x50e7('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x50e7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x50e7('0x4')};function emitEvent(_0x182f1f){return function(_0xd96ca8,_0x367f84,_0x1b180c){SmsAccountEvents['emit'](_0x182f1f+':'+_0xd96ca8['id'],_0xd96ca8);SmsAccountEvents[_0x50e7('0x5')](_0x182f1f,_0xd96ca8);_0x1b180c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x50e7('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x1f51=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','save'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1f51,0x114));var _0x11f5=function(_0x208dc9,_0x125896){_0x208dc9=_0x208dc9-0x0;var _0x3ff723=_0x1f51[_0x208dc9];return _0x3ff723;};'use strict';var EventEmitter=require(_0x11f5('0x0'));var SmsAccount=require(_0x11f5('0x1'))['db'][_0x11f5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11f5('0x3'),'afterUpdate':'update','afterDestroy':_0x11f5('0x4')};function emitEvent(_0x57230a){return function(_0x1951c6,_0x1f7024,_0x428fd4){SmsAccountEvents[_0x11f5('0x5')](_0x57230a+':'+_0x1951c6['id'],_0x1951c6);SmsAccountEvents[_0x11f5('0x5')](_0x57230a,_0x1951c6);_0x428fd4(null);};}for(var e in events){if(events[_0x11f5('0x6')](e)){var event=events[e];SmsAccount[_0x11f5('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 7769f0e..196f7f7 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 _0x1afa=['../../config/environment','define','SmsAccount','sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1afa,0xe0));var _0xa1af=function(_0x58a928,_0x32d56d){_0x58a928=_0x58a928-0x0;var _0x4226db=_0x1afa[_0x58a928];return _0x4226db;};'use strict';var _=require('lodash');var util=require(_0xa1af('0x0'));var logger=require(_0xa1af('0x1'))(_0xa1af('0x2'));var moment=require(_0xa1af('0x3'));var BPromise=require(_0xa1af('0x4'));var rp=require(_0xa1af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa1af('0x6'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x416c94,_0x1fd4ab){return _0x416c94[_0xa1af('0x7')](_0xa1af('0x8'),attributes,{'tableName':_0xa1af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f23=['path','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x514462,_0x3b328f){var _0x321ab1=function(_0x470507){while(--_0x470507){_0x514462['push'](_0x514462['shift']());}};_0x321ab1(++_0x3b328f);}(_0x6f23,0xde));var _0x36f2=function(_0x3d3f44,_0x588c39){_0x3d3f44=_0x3d3f44-0x0;var _0x357158=_0x6f23[_0x3d3f44];return _0x357158;};'use strict';var _=require(_0x36f2('0x0'));var util=require('util');var logger=require(_0x36f2('0x1'))(_0x36f2('0x2'));var moment=require(_0x36f2('0x3'));var BPromise=require(_0x36f2('0x4'));var rp=require(_0x36f2('0x5'));var fs=require('fs');var path=require(_0x36f2('0x6'));var rimraf=require('rimraf');var config=require(_0x36f2('0x7'));var attributes=require(_0x36f2('0x8'));module[_0x36f2('0x9')]=function(_0x1a24ce,_0x29dd12){return _0x1a24ce['define'](_0x36f2('0xa'),attributes,{'tableName':_0x36f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 722bcb7..61304c1 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 _0x8dc2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','localhost','socket.io-emitter','redis','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x8dc2,0x141));var _0x28dc=function(_0x576422,_0x1ff4d2){_0x576422=_0x576422-0x0;var _0x33f6f5=_0x8dc2[_0x576422];return _0x33f6f5;};'use strict';var _=require(_0x28dc('0x0'));var util=require(_0x28dc('0x1'));var moment=require(_0x28dc('0x2'));var BPromise=require(_0x28dc('0x3'));var rs=require(_0x28dc('0x4'));var fs=require('fs');var Redis=require(_0x28dc('0x5'));var db=require(_0x28dc('0x6'))['db'];var utils=require(_0x28dc('0x7'));var logger=require(_0x28dc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28dc('0x9'));var client=jayson['client'][_0x28dc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x28dc('0xb'),'port':0x18eb});var socket=require(_0x28dc('0xc'))(new Redis(config[_0x28dc('0xd')]));require(_0x28dc('0xe'))[_0x28dc('0xf')](socket);function respondWithRpcPromise(_0x1c63a0,_0x548faa,_0x2ecaa0){return new BPromise(function(_0x4885ad,_0x20c30e){return client['request'](_0x1c63a0,_0x2ecaa0)[_0x28dc('0x10')](function(_0x378ac8){logger[_0x28dc('0x11')](_0x28dc('0x12'),_0x548faa,_0x28dc('0x13'));logger[_0x28dc('0x14')](_0x28dc('0x15'),_0x548faa,'request\x20sent',JSON['stringify'](_0x378ac8));if(_0x378ac8[_0x28dc('0x16')]){if(_0x378ac8[_0x28dc('0x16')][_0x28dc('0x17')]===0x1f4){logger[_0x28dc('0x16')](_0x28dc('0x12'),_0x548faa,_0x378ac8[_0x28dc('0x16')][_0x28dc('0x18')]);return _0x20c30e(_0x378ac8['error'][_0x28dc('0x18')]);}logger[_0x28dc('0x16')](_0x28dc('0x12'),_0x548faa,_0x378ac8[_0x28dc('0x16')][_0x28dc('0x18')]);return _0x4885ad(_0x378ac8['error']['message']);}else{logger[_0x28dc('0x11')](_0x28dc('0x12'),_0x548faa,'request\x20sent');_0x4885ad(_0x378ac8[_0x28dc('0x19')][_0x28dc('0x18')]);}})[_0x28dc('0x1a')](function(_0x49f4a5){logger[_0x28dc('0x16')](_0x28dc('0x12'),_0x548faa,_0x49f4a5);_0x20c30e(_0x49f4a5);});});}exports[_0x28dc('0x1b')]=function(_0x45cf9b){var _0x4368e8=this;return new Promise(function(_0x2b07bd,_0x3ca314){return db['SmsAccount']['find']({'raw':_0x45cf9b[_0x28dc('0x1c')]?_0x45cf9b[_0x28dc('0x1c')][_0x28dc('0x1d')]===undefined?!![]:![]:!![],'where':_0x45cf9b['options']?_0x45cf9b[_0x28dc('0x1c')][_0x28dc('0x1e')]||null:null,'attributes':_0x45cf9b[_0x28dc('0x1c')]?_0x45cf9b['options'][_0x28dc('0x1f')]||null:null,'include':_0x45cf9b[_0x28dc('0x1c')]?_0x45cf9b[_0x28dc('0x1c')]['include']?_[_0x28dc('0x20')](_0x45cf9b['options'][_0x28dc('0x21')],function(_0x59f9d1){return{'model':db[_0x59f9d1[_0x28dc('0x22')]],'as':_0x59f9d1['as'],'attributes':_0x59f9d1[_0x28dc('0x1f')],'include':_0x59f9d1[_0x28dc('0x21')]?_['map'](_0x59f9d1[_0x28dc('0x21')],function(_0x16f7b6){return{'model':db[_0x16f7b6[_0x28dc('0x22')]],'as':_0x16f7b6['as'],'attributes':_0x16f7b6[_0x28dc('0x1f')],'include':_0x16f7b6['include']?_['map'](_0x16f7b6[_0x28dc('0x21')],function(_0x151c1c){return{'model':db[_0x151c1c[_0x28dc('0x22')]],'as':_0x151c1c['as'],'attributes':_0x151c1c[_0x28dc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x28dc('0x10')](function(_0x4a7702){logger[_0x28dc('0x11')](_0x28dc('0x1b'),_0x45cf9b);logger[_0x28dc('0x14')](_0x28dc('0x1b'),_0x45cf9b,JSON[_0x28dc('0x23')](_0x4a7702));_0x2b07bd(_0x4a7702);})[_0x28dc('0x1a')](function(_0x2bcf93){logger[_0x28dc('0x16')](_0x28dc('0x1b'),_0x2bcf93[_0x28dc('0x18')],_0x45cf9b);_0x3ca314(_0x4368e8[_0x28dc('0x16')](0x1f4,_0x2bcf93[_0x28dc('0x18')]));});});}; \ No newline at end of file +var _0x1f75=['http','redis','localhost','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','attributes','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a2564,_0x4aedce){var _0x56ba04=function(_0x1c01ab){while(--_0x1c01ab){_0x2a2564['push'](_0x2a2564['shift']());}};_0x56ba04(++_0x4aedce);}(_0x1f75,0x127));var _0x51f7=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1f75[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var moment=require(_0x51f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x51f7('0x2'));var fs=require('fs');var Redis=require(_0x51f7('0x3'));var db=require(_0x51f7('0x4'))['db'];var utils=require(_0x51f7('0x5'));var logger=require(_0x51f7('0x6'))(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var jayson=require(_0x51f7('0x9'));var client=jayson[_0x51f7('0xa')][_0x51f7('0xb')]({'port':0x232a});config[_0x51f7('0xc')]=_['defaults'](config['redis'],{'host':_0x51f7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51f7('0xc')]));require(_0x51f7('0xe'))[_0x51f7('0xf')](socket);function respondWithRpcPromise(_0x3ff5c0,_0x1b833a,_0x596cda){return new BPromise(function(_0x3fa450,_0x217685){return client['request'](_0x3ff5c0,_0x596cda)[_0x51f7('0x10')](function(_0x496fba){logger['info'](_0x51f7('0x11'),_0x1b833a,_0x51f7('0x12'));logger[_0x51f7('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b833a,_0x51f7('0x12'),JSON[_0x51f7('0x14')](_0x496fba));if(_0x496fba[_0x51f7('0x15')]){if(_0x496fba['error'][_0x51f7('0x16')]===0x1f4){logger[_0x51f7('0x15')]('SmsAccount,\x20%s,\x20%s',_0x1b833a,_0x496fba[_0x51f7('0x15')][_0x51f7('0x17')]);return _0x217685(_0x496fba['error'][_0x51f7('0x17')]);}logger[_0x51f7('0x15')](_0x51f7('0x11'),_0x1b833a,_0x496fba[_0x51f7('0x15')][_0x51f7('0x17')]);return _0x3fa450(_0x496fba[_0x51f7('0x15')][_0x51f7('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1b833a,_0x51f7('0x12'));_0x3fa450(_0x496fba[_0x51f7('0x18')][_0x51f7('0x17')]);}})[_0x51f7('0x19')](function(_0x264129){logger[_0x51f7('0x15')](_0x51f7('0x11'),_0x1b833a,_0x264129);_0x217685(_0x264129);});});}exports[_0x51f7('0x1a')]=function(_0x56fd6a){var _0x554966=this;return new Promise(function(_0x2aa0e2,_0x2d6ec7){return db['SmsAccount'][_0x51f7('0x1b')]({'raw':_0x56fd6a[_0x51f7('0x1c')]?_0x56fd6a[_0x51f7('0x1c')][_0x51f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x56fd6a[_0x51f7('0x1c')]?_0x56fd6a[_0x51f7('0x1c')]['where']||null:null,'attributes':_0x56fd6a['options']?_0x56fd6a[_0x51f7('0x1c')][_0x51f7('0x1e')]||null:null,'include':_0x56fd6a[_0x51f7('0x1c')]?_0x56fd6a[_0x51f7('0x1c')]['include']?_[_0x51f7('0x1f')](_0x56fd6a[_0x51f7('0x1c')][_0x51f7('0x20')],function(_0x488739){return{'model':db[_0x488739['model']],'as':_0x488739['as'],'attributes':_0x488739[_0x51f7('0x1e')],'include':_0x488739[_0x51f7('0x20')]?_[_0x51f7('0x1f')](_0x488739[_0x51f7('0x20')],function(_0x5ed2e0){return{'model':db[_0x5ed2e0['model']],'as':_0x5ed2e0['as'],'attributes':_0x5ed2e0[_0x51f7('0x1e')],'include':_0x5ed2e0[_0x51f7('0x20')]?_[_0x51f7('0x1f')](_0x5ed2e0[_0x51f7('0x20')],function(_0x3a42f0){return{'model':db[_0x3a42f0[_0x51f7('0x21')]],'as':_0x3a42f0['as'],'attributes':_0x3a42f0[_0x51f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x51f7('0x10')](function(_0x15d279){logger['info'](_0x51f7('0x1a'),_0x56fd6a);logger[_0x51f7('0x13')](_0x51f7('0x1a'),_0x56fd6a,JSON[_0x51f7('0x14')](_0x15d279));_0x2aa0e2(_0x15d279);})[_0x51f7('0x19')](function(_0x31cf08){logger[_0x51f7('0x15')](_0x51f7('0x1a'),_0x31cf08['message'],_0x56fd6a);_0x2d6ec7(_0x554966[_0x51f7('0x15')](0x1f4,_0x31cf08[_0x51f7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 61cc010..c80a03e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 8d937d2..817c9f1 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x4dd1a3,_0x3e5c8c){var _0x27c911=function(_0x56852f){while(--_0x56852f){_0x4dd1a3['push'](_0x4dd1a3['shift']());}};_0x27c911(++_0x3e5c8c);}(_0x55ca,0x126));var _0xa55c=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x55ca[_0x287059];return _0x225c79;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x48cfde,_0x3c79f2){var _0xdad55e=function(_0x27c92d){while(--_0x27c92d){_0x48cfde['push'](_0x48cfde['shift']());}};_0xdad55e(++_0x3c79f2);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f2b443c..056359f 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 _0x81be=['exports','STRING','noop','sequelize'];(function(_0x3c9838,_0x1d2d2b){var _0xe7b5a7=function(_0x3a295a){while(--_0x3a295a){_0x3c9838['push'](_0x3c9838['shift']());}};_0xe7b5a7(++_0x1d2d2b);}(_0x81be,0xc3));var _0xe81b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x81be[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xe81b('0x0'));module[_0xe81b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe81b('0x2')],'allowNull':![],'defaultValue':_0xe81b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe81b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1169=['*,*,*,*','INTEGER','STRING','TEXT'];(function(_0x509aeb,_0x3ab138){var _0x1b2ba1=function(_0x16ed61){while(--_0x16ed61){_0x509aeb['push'](_0x509aeb['shift']());}};_0x1b2ba1(++_0x3ab138);}(_0x1169,0x9d));var _0x9116=function(_0x2c510f,_0x44c5aa){_0x2c510f=_0x2c510f-0x0;var _0x10449a=_0x1169[_0x2c510f];return _0x10449a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9116('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9116('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9116('0x2')]()},'description':{'type':Sequelize[_0x9116('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9116('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b16cfec..cd8d6da 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 _0x0182=['squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','end','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','params','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x3fd073,_0x32931f){var _0x40d7b1=function(_0x379467){while(--_0x379467){_0x3fd073['push'](_0x3fd073['shift']());}};_0x40d7b1(++_0x32931f);}(_0x0182,0x7d));var _0x2018=function(_0x23895f,_0x43e4a9){_0x23895f=_0x23895f-0x0;var _0x39cfc9=_0x0182[_0x23895f];return _0x39cfc9;};'use strict';var emlformat=require(_0x2018('0x0'));var rimraf=require(_0x2018('0x1'));var zipdir=require(_0x2018('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2018('0x3'));var moment=require('moment');var BPromise=require(_0x2018('0x4'));var Mustache=require(_0x2018('0x5'));var util=require('util');var path=require(_0x2018('0x6'));var sox=require(_0x2018('0x7'));var csv=require(_0x2018('0x8'));var ejs=require(_0x2018('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2018('0xa'));var squel=require(_0x2018('0xb'));var crypto=require('crypto');var jsforce=require(_0x2018('0xc'));var deskjs=require(_0x2018('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2018('0xe'));var Redis=require('ioredis');var authService=require(_0x2018('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2018('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2018('0x11'));var config=require(_0x2018('0x12'));var licenseUtil=require(_0x2018('0x13'));var db=require(_0x2018('0x14'))['db'];function respondWithStatusCode(_0x41dc03,_0x31645c){_0x31645c=_0x31645c||0xcc;return function(_0xe9a0){if(_0xe9a0){return _0x41dc03[_0x2018('0x15')](_0x31645c);}return _0x41dc03['status'](_0x31645c)['end']();};}function respondWithResult(_0x472ea1,_0x3e1575){_0x3e1575=_0x3e1575||0xc8;return function(_0x8dc48e){if(_0x8dc48e){return _0x472ea1[_0x2018('0x16')](_0x3e1575)['json'](_0x8dc48e);}};}function respondWithFilteredResult(_0x39001e,_0x51c8eb){return function(_0x2b0ccf){if(_0x2b0ccf){var _0x36d72a=typeof _0x51c8eb[_0x2018('0x17')]===_0x2018('0x18')&&typeof _0x51c8eb['limit']==='undefined';var _0x812c49=_0x2b0ccf[_0x2018('0x19')];var _0x493489=_0x36d72a?0x0:_0x51c8eb['offset'];var _0x1e191a=_0x36d72a?_0x2b0ccf[_0x2018('0x19')]:_0x51c8eb[_0x2018('0x17')]+_0x51c8eb[_0x2018('0x1a')];var _0x3dc661;if(_0x1e191a>=_0x812c49){_0x1e191a=_0x812c49;_0x3dc661=0xc8;}else{_0x3dc661=0xce;}_0x39001e['status'](_0x3dc661);return _0x39001e['set'](_0x2018('0x1b'),_0x493489+'-'+_0x1e191a+'/'+_0x812c49)[_0x2018('0x1c')](_0x2b0ccf);}return null;};}function patchUpdates(_0x3561b1){return function(_0x340325){try{jsonpatch[_0x2018('0x1d')](_0x340325,_0x3561b1,!![]);}catch(_0x3114a7){return BPromise['reject'](_0x3114a7);}return _0x340325['save']();};}function saveUpdates(_0x401106,_0x225ed9){return function(_0xfd98a5){if(_0xfd98a5){return _0xfd98a5[_0x2018('0x1e')](_0x401106)[_0x2018('0x1f')](function(_0x7996fe){return _0x7996fe;});}return null;};}function removeEntity(_0x4cf11e,_0x12cee1){return function(_0x573d5c){if(_0x573d5c){return _0x573d5c[_0x2018('0x20')]()['then'](function(){_0x4cf11e[_0x2018('0x16')](0xcc)[_0x2018('0x21')]();});}};}function handleEntityNotFound(_0x1100c9,_0x1c35d5){return function(_0x4e6fd8){if(!_0x4e6fd8){_0x1100c9[_0x2018('0x15')](0x194);}return _0x4e6fd8;};}function handleError(_0x4da453,_0x3c99b8){_0x3c99b8=_0x3c99b8||0x1f4;return function(_0x2abd53){logger[_0x2018('0x22')](_0x2abd53[_0x2018('0x23')]);if(_0x2abd53[_0x2018('0x24')]){delete _0x2abd53['name'];}_0x4da453['status'](_0x3c99b8)['send'](_0x2abd53);};}exports[_0x2018('0x25')]=function(_0x1e921f,_0x51088b){var _0x5c65fc={},_0x49d889={},_0x424138={'count':0x0,'rows':[]};var _0x516773=_[_0x2018('0x26')](db[_0x2018('0x27')][_0x2018('0x28')],function(_0x35d6fa){return{'name':_0x35d6fa[_0x2018('0x29')],'type':_0x35d6fa[_0x2018('0x2a')]['key']};});_0x49d889[_0x2018('0x2b')]=_['map'](_0x516773,_0x2018('0x24'));_0x49d889[_0x2018('0x2c')]=_[_0x2018('0x2d')](_0x1e921f[_0x2018('0x2c')]);_0x49d889[_0x2018('0x2e')]=_[_0x2018('0x2f')](_0x49d889[_0x2018('0x2b')],_0x49d889[_0x2018('0x2c')]);_0x5c65fc[_0x2018('0x30')]=_['intersection'](_0x49d889[_0x2018('0x2b')],qs[_0x2018('0x31')](_0x1e921f[_0x2018('0x2c')][_0x2018('0x31')]));_0x5c65fc[_0x2018('0x30')]=_0x5c65fc['attributes'][_0x2018('0x32')]?_0x5c65fc[_0x2018('0x30')]:_0x49d889[_0x2018('0x2b')];if(!_0x1e921f['query'][_0x2018('0x33')](_0x2018('0x34'))){_0x5c65fc['limit']=qs[_0x2018('0x1a')](_0x1e921f['query'][_0x2018('0x1a')]);_0x5c65fc['offset']=qs[_0x2018('0x17')](_0x1e921f[_0x2018('0x2c')][_0x2018('0x17')]);}_0x5c65fc['order']=qs['sort'](_0x1e921f['query'][_0x2018('0x35')]);_0x5c65fc[_0x2018('0x36')]=qs[_0x2018('0x2e')](_[_0x2018('0x37')](_0x1e921f['query'],_0x49d889[_0x2018('0x2e')]),_0x516773);if(_0x1e921f[_0x2018('0x2c')][_0x2018('0x38')]){_0x5c65fc[_0x2018('0x36')]=_[_0x2018('0x39')](_0x5c65fc[_0x2018('0x36')],{'$or':_[_0x2018('0x26')](_0x516773,function(_0x159b0e){if(_0x159b0e[_0x2018('0x2a')]!==_0x2018('0x3a')){var _0x164f1a={};_0x164f1a[_0x159b0e['name']]={'$like':'%'+_0x1e921f[_0x2018('0x2c')][_0x2018('0x38')]+'%'};return _0x164f1a;}})});}_0x5c65fc=_['merge']({},_0x5c65fc,_0x1e921f[_0x2018('0x3b')]);var _0xf60a72={'where':_0x5c65fc[_0x2018('0x36')]};return db[_0x2018('0x27')][_0x2018('0x19')](_0xf60a72)[_0x2018('0x1f')](function(_0x11e6a6){_0x424138['count']=_0x11e6a6;if(_0x1e921f[_0x2018('0x2c')][_0x2018('0x3c')]){_0x5c65fc[_0x2018('0x3d')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x5c65fc);})[_0x2018('0x1f')](function(_0x53ad6b){_0x424138[_0x2018('0x3e')]=_0x53ad6b;return _0x424138;})[_0x2018('0x1f')](respondWithFilteredResult(_0x51088b,_0x5c65fc))[_0x2018('0x3f')](handleError(_0x51088b,null));};exports['show']=function(_0x144482,_0x2fe93b){var _0x4e4f77={'raw':!![],'where':{'id':_0x144482['params']['id']}},_0x356e48={};_0x356e48['model']=_[_0x2018('0x2d')](db[_0x2018('0x27')][_0x2018('0x28')]);_0x356e48[_0x2018('0x2c')]=_[_0x2018('0x2d')](_0x144482['query']);_0x356e48['filters']=_[_0x2018('0x2f')](_0x356e48[_0x2018('0x2b')],_0x356e48['query']);_0x4e4f77[_0x2018('0x30')]=_[_0x2018('0x2f')](_0x356e48[_0x2018('0x2b')],qs[_0x2018('0x31')](_0x144482[_0x2018('0x2c')]['fields']));_0x4e4f77[_0x2018('0x30')]=_0x4e4f77['attributes'][_0x2018('0x32')]?_0x4e4f77['attributes']:_0x356e48[_0x2018('0x2b')];if(_0x144482[_0x2018('0x2c')][_0x2018('0x3c')]){_0x4e4f77[_0x2018('0x3d')]=[{'all':!![]}];}_0x4e4f77=_['merge']({},_0x4e4f77,_0x144482[_0x2018('0x3b')]);return db['SmsApplication'][_0x2018('0x40')](_0x4e4f77)[_0x2018('0x1f')](handleEntityNotFound(_0x2fe93b,null))[_0x2018('0x1f')](respondWithResult(_0x2fe93b,null))[_0x2018('0x3f')](handleError(_0x2fe93b,null));};exports['create']=function(_0x5600b2,_0xb81595){return db[_0x2018('0x27')][_0x2018('0x41')](_0x5600b2['body'],{})[_0x2018('0x1f')](respondWithResult(_0xb81595,0xc9))['catch'](handleError(_0xb81595,null));};exports['update']=function(_0x224f2c,_0x1e4f00){if(_0x224f2c['body']['id']){delete _0x224f2c['body']['id'];}return db[_0x2018('0x27')][_0x2018('0x40')]({'where':{'id':_0x224f2c[_0x2018('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e4f00,null))[_0x2018('0x1f')](saveUpdates(_0x224f2c[_0x2018('0x43')],null))['then'](respondWithResult(_0x1e4f00,null))[_0x2018('0x3f')](handleError(_0x1e4f00,null));};exports[_0x2018('0x20')]=function(_0x84aae8,_0x1ab90a){return db[_0x2018('0x27')][_0x2018('0x40')]({'where':{'id':_0x84aae8['params']['id']}})[_0x2018('0x1f')](handleEntityNotFound(_0x1ab90a,null))['then'](removeEntity(_0x1ab90a,null))[_0x2018('0x3f')](handleError(_0x1ab90a,null));}; \ No newline at end of file +var _0xd189=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','SmsApplication','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x365ef8,_0x2ccbf8){var _0x194e9f=function(_0x2d0f1f){while(--_0x2d0f1f){_0x365ef8['push'](_0x365ef8['shift']());}};_0x194e9f(++_0x2ccbf8);}(_0xd189,0xa7));var _0x9d18=function(_0x3d6f66,_0x5c4f8a){_0x3d6f66=_0x3d6f66-0x0;var _0x59b853=_0xd189[_0x3d6f66];return _0x59b853;};'use strict';var emlformat=require(_0x9d18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d18('0x1'));var jsonpatch=require(_0x9d18('0x2'));var rp=require('request-promise');var moment=require(_0x9d18('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d18('0x4'));var util=require('util');var path=require(_0x9d18('0x5'));var sox=require(_0x9d18('0x6'));var csv=require('to-csv');var ejs=require(_0x9d18('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d18('0x8'));var squel=require(_0x9d18('0x9'));var crypto=require(_0x9d18('0xa'));var jsforce=require(_0x9d18('0xb'));var deskjs=require(_0x9d18('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9d18('0xd'));var Papa=require('papaparse');var Redis=require(_0x9d18('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9d18('0xf'));var as=require(_0x9d18('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d18('0x11'))('api');var utils=require(_0x9d18('0x12'));var config=require(_0x9d18('0x13'));var licenseUtil=require(_0x9d18('0x14'));var db=require(_0x9d18('0x15'))['db'];function respondWithStatusCode(_0x1b8b24,_0x4230a1){_0x4230a1=_0x4230a1||0xcc;return function(_0x1cf8cc){if(_0x1cf8cc){return _0x1b8b24[_0x9d18('0x16')](_0x4230a1);}return _0x1b8b24[_0x9d18('0x17')](_0x4230a1)[_0x9d18('0x18')]();};}function respondWithResult(_0xdedb27,_0x533e0f){_0x533e0f=_0x533e0f||0xc8;return function(_0x1e2d22){if(_0x1e2d22){return _0xdedb27['status'](_0x533e0f)[_0x9d18('0x19')](_0x1e2d22);}};}function respondWithFilteredResult(_0x3c66c5,_0x4880e5){return function(_0x161b6b){if(_0x161b6b){var _0x2c21c8=typeof _0x4880e5[_0x9d18('0x1a')]===_0x9d18('0x1b')&&typeof _0x4880e5[_0x9d18('0x1c')]===_0x9d18('0x1b');var _0x1bec5f=_0x161b6b[_0x9d18('0x1d')];var _0x5d9a5f=_0x2c21c8?0x0:_0x4880e5['offset'];var _0x5dd78e=_0x2c21c8?_0x161b6b[_0x9d18('0x1d')]:_0x4880e5[_0x9d18('0x1a')]+_0x4880e5[_0x9d18('0x1c')];var _0x31c258;if(_0x5dd78e>=_0x1bec5f){_0x5dd78e=_0x1bec5f;_0x31c258=0xc8;}else{_0x31c258=0xce;}_0x3c66c5['status'](_0x31c258);return _0x3c66c5[_0x9d18('0x1e')](_0x9d18('0x1f'),_0x5d9a5f+'-'+_0x5dd78e+'/'+_0x1bec5f)['json'](_0x161b6b);}return null;};}function patchUpdates(_0xc28125){return function(_0xffb210){try{jsonpatch['apply'](_0xffb210,_0xc28125,!![]);}catch(_0x815a09){return BPromise[_0x9d18('0x20')](_0x815a09);}return _0xffb210[_0x9d18('0x21')]();};}function saveUpdates(_0x3f5a7f,_0x522d86){return function(_0x13bfb5){if(_0x13bfb5){return _0x13bfb5[_0x9d18('0x22')](_0x3f5a7f)[_0x9d18('0x23')](function(_0x5a405b){return _0x5a405b;});}return null;};}function removeEntity(_0xd286f2,_0x2ed5e8){return function(_0x27072a){if(_0x27072a){return _0x27072a[_0x9d18('0x24')]()['then'](function(){_0xd286f2['status'](0xcc)[_0x9d18('0x18')]();});}};}function handleEntityNotFound(_0x4df5bb,_0x4a4303){return function(_0x3d68a6){if(!_0x3d68a6){_0x4df5bb[_0x9d18('0x16')](0x194);}return _0x3d68a6;};}function handleError(_0x3d6b5a,_0x1a9dd4){_0x1a9dd4=_0x1a9dd4||0x1f4;return function(_0x3c5470){logger[_0x9d18('0x25')](_0x3c5470[_0x9d18('0x26')]);if(_0x3c5470['name']){delete _0x3c5470['name'];}_0x3d6b5a[_0x9d18('0x17')](_0x1a9dd4)[_0x9d18('0x27')](_0x3c5470);};}exports[_0x9d18('0x28')]=function(_0x2203f3,_0x51b106){var _0x328fdd={},_0x49aff2={},_0x587c95={'count':0x0,'rows':[]};var _0x2c7b72=_['map'](db[_0x9d18('0x29')][_0x9d18('0x2a')],function(_0x83832c){return{'name':_0x83832c[_0x9d18('0x2b')],'type':_0x83832c[_0x9d18('0x2c')]['key']};});_0x49aff2[_0x9d18('0x2d')]=_[_0x9d18('0x2e')](_0x2c7b72,_0x9d18('0x2f'));_0x49aff2[_0x9d18('0x30')]=_[_0x9d18('0x31')](_0x2203f3[_0x9d18('0x30')]);_0x49aff2[_0x9d18('0x32')]=_[_0x9d18('0x33')](_0x49aff2[_0x9d18('0x2d')],_0x49aff2[_0x9d18('0x30')]);_0x328fdd[_0x9d18('0x34')]=_[_0x9d18('0x33')](_0x49aff2[_0x9d18('0x2d')],qs[_0x9d18('0x35')](_0x2203f3[_0x9d18('0x30')][_0x9d18('0x35')]));_0x328fdd[_0x9d18('0x34')]=_0x328fdd[_0x9d18('0x34')][_0x9d18('0x36')]?_0x328fdd[_0x9d18('0x34')]:_0x49aff2[_0x9d18('0x2d')];if(!_0x2203f3['query'][_0x9d18('0x37')](_0x9d18('0x38'))){_0x328fdd[_0x9d18('0x1c')]=qs[_0x9d18('0x1c')](_0x2203f3[_0x9d18('0x30')][_0x9d18('0x1c')]);_0x328fdd[_0x9d18('0x1a')]=qs[_0x9d18('0x1a')](_0x2203f3['query']['offset']);}_0x328fdd[_0x9d18('0x39')]=qs[_0x9d18('0x3a')](_0x2203f3[_0x9d18('0x30')][_0x9d18('0x3a')]);_0x328fdd[_0x9d18('0x3b')]=qs['filters'](_[_0x9d18('0x3c')](_0x2203f3[_0x9d18('0x30')],_0x49aff2['filters']),_0x2c7b72);if(_0x2203f3['query'][_0x9d18('0x3d')]){_0x328fdd[_0x9d18('0x3b')]=_[_0x9d18('0x3e')](_0x328fdd['where'],{'$or':_[_0x9d18('0x2e')](_0x2c7b72,function(_0x2b9655){if(_0x2b9655['type']!==_0x9d18('0x3f')){var _0x5db965={};_0x5db965[_0x2b9655['name']]={'$like':'%'+_0x2203f3[_0x9d18('0x30')][_0x9d18('0x3d')]+'%'};return _0x5db965;}})});}_0x328fdd=_['merge']({},_0x328fdd,_0x2203f3[_0x9d18('0x40')]);var _0x31669f={'where':_0x328fdd[_0x9d18('0x3b')]};return db[_0x9d18('0x29')]['count'](_0x31669f)[_0x9d18('0x23')](function(_0xf8d442){_0x587c95['count']=_0xf8d442;if(_0x2203f3[_0x9d18('0x30')][_0x9d18('0x41')]){_0x328fdd['include']=[{'all':!![]}];}return db[_0x9d18('0x29')]['findAll'](_0x328fdd);})['then'](function(_0x22b78d){_0x587c95[_0x9d18('0x42')]=_0x22b78d;return _0x587c95;})[_0x9d18('0x23')](respondWithFilteredResult(_0x51b106,_0x328fdd))['catch'](handleError(_0x51b106,null));};exports[_0x9d18('0x43')]=function(_0x2bd71e,_0x5599bc){var _0x3df1c2={'raw':!![],'where':{'id':_0x2bd71e[_0x9d18('0x44')]['id']}},_0x20967a={};_0x20967a[_0x9d18('0x2d')]=_[_0x9d18('0x31')](db[_0x9d18('0x29')][_0x9d18('0x2a')]);_0x20967a['query']=_[_0x9d18('0x31')](_0x2bd71e['query']);_0x20967a['filters']=_[_0x9d18('0x33')](_0x20967a[_0x9d18('0x2d')],_0x20967a['query']);_0x3df1c2['attributes']=_[_0x9d18('0x33')](_0x20967a[_0x9d18('0x2d')],qs['fields'](_0x2bd71e[_0x9d18('0x30')]['fields']));_0x3df1c2[_0x9d18('0x34')]=_0x3df1c2[_0x9d18('0x34')][_0x9d18('0x36')]?_0x3df1c2['attributes']:_0x20967a[_0x9d18('0x2d')];if(_0x2bd71e[_0x9d18('0x30')]['includeAll']){_0x3df1c2[_0x9d18('0x45')]=[{'all':!![]}];}_0x3df1c2=_[_0x9d18('0x3e')]({},_0x3df1c2,_0x2bd71e[_0x9d18('0x40')]);return db['SmsApplication'][_0x9d18('0x46')](_0x3df1c2)['then'](handleEntityNotFound(_0x5599bc,null))[_0x9d18('0x23')](respondWithResult(_0x5599bc,null))[_0x9d18('0x47')](handleError(_0x5599bc,null));};exports[_0x9d18('0x48')]=function(_0x53b960,_0x14edf6){return db[_0x9d18('0x29')]['create'](_0x53b960['body'],{})['then'](respondWithResult(_0x14edf6,0xc9))[_0x9d18('0x47')](handleError(_0x14edf6,null));};exports[_0x9d18('0x22')]=function(_0x2fc236,_0x46d535){if(_0x2fc236[_0x9d18('0x49')]['id']){delete _0x2fc236['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x2fc236['params']['id']}})['then'](handleEntityNotFound(_0x46d535,null))['then'](saveUpdates(_0x2fc236[_0x9d18('0x49')],null))[_0x9d18('0x23')](respondWithResult(_0x46d535,null))[_0x9d18('0x47')](handleError(_0x46d535,null));};exports[_0x9d18('0x24')]=function(_0x77f2e3,_0x1ca1d9){return db[_0x9d18('0x29')][_0x9d18('0x46')]({'where':{'id':_0x77f2e3[_0x9d18('0x44')]['id']}})[_0x9d18('0x23')](handleEntityNotFound(_0x1ca1d9,null))['then'](removeEntity(_0x1ca1d9,null))['catch'](handleError(_0x1ca1d9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5ded373..7888625 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 _0x44ca=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x44ca,0xe6));var _0xa44c=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0x44ca[_0xb6a965];return _0x51d37d;};'use strict';var _=require(_0xa44c('0x0'));var util=require(_0xa44c('0x1'));var logger=require(_0xa44c('0x2'))('api');var moment=require(_0xa44c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa44c('0x4'));var rimraf=require(_0xa44c('0x5'));var config=require(_0xa44c('0x6'));var attributes=require(_0xa44c('0x7'));module[_0xa44c('0x8')]=function(_0x4c69ba,_0x214fca){return _0x4c69ba[_0xa44c('0x9')](_0xa44c('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa44c('0xb'),'collate':_0xa44c('0xc')});}; \ No newline at end of file +var _0x5c24=['api','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x5c24,0x184));var _0x45c2=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x5c24[_0x283127];return _0x43da5d;};'use strict';var _=require(_0x45c2('0x0'));var util=require(_0x45c2('0x1'));var logger=require('../../config/logger')(_0x45c2('0x2'));var moment=require('moment');var BPromise=require(_0x45c2('0x3'));var rp=require(_0x45c2('0x4'));var fs=require('fs');var path=require(_0x45c2('0x5'));var rimraf=require('rimraf');var config=require(_0x45c2('0x6'));var attributes=require(_0x45c2('0x7'));module[_0x45c2('0x8')]=function(_0x51d8cb,_0x397c98){return _0x51d8cb[_0x45c2('0x9')](_0x45c2('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x45c2('0xb'),'collate':_0x45c2('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 065cf5b..746b5df 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 _0xd506=['catch','lodash','../../config/logger','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x506c10,_0x4e7b53){var _0x4c91c4=function(_0x1b8860){while(--_0x1b8860){_0x506c10['push'](_0x506c10['shift']());}};_0x4c91c4(++_0x4e7b53);}(_0xd506,0x197));var _0x6d50=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd506[_0x432682];return _0x463d05;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d50('0x1'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d50('0x2')][_0x6d50('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x1b0af3,_0x4cf512,_0x9565b6){return new BPromise(function(_0xce67b6,_0x2dacde){return client['request'](_0x1b0af3,_0x9565b6)[_0x6d50('0x4')](function(_0x5012ed){logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,_0x6d50('0x7'));logger[_0x6d50('0x8')](_0x6d50('0x9'),_0x4cf512,_0x6d50('0x7'),JSON['stringify'](_0x5012ed));if(_0x5012ed['error']){if(_0x5012ed['error'][_0x6d50('0xa')]===0x1f4){logger[_0x6d50('0xb')](_0x6d50('0x6'),_0x4cf512,_0x5012ed[_0x6d50('0xb')]['message']);return _0x2dacde(_0x5012ed[_0x6d50('0xb')]['message']);}logger[_0x6d50('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4cf512,_0x5012ed['error']['message']);return _0xce67b6(_0x5012ed[_0x6d50('0xb')]['message']);}else{logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,'request\x20sent');_0xce67b6(_0x5012ed['result'][_0x6d50('0xc')]);}})[_0x6d50('0xd')](function(_0x38068e){logger['error'](_0x6d50('0x6'),_0x4cf512,_0x38068e);_0x2dacde(_0x38068e);});});} \ No newline at end of file +var _0x531a=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x54ba66,_0x110fef){var _0x53f0ed=function(_0x46e2a0){while(--_0x46e2a0){_0x54ba66['push'](_0x54ba66['shift']());}};_0x53f0ed(++_0x110fef);}(_0x531a,0x100));var _0xa531=function(_0x306095,_0x21cbce){_0x306095=_0x306095-0x0;var _0x3ac326=_0x531a[_0x306095];return _0x3ac326;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('SmsApplication,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('SmsApplication,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('SmsApplication,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 947caf3..8406170 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 _0xf7b4=['/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0x2e535d,_0x1365c1){var _0x3e8891=function(_0x2f088a){while(--_0x2f088a){_0x2e535d['push'](_0x2e535d['shift']());}};_0x3e8891(++_0x1365c1);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2f1823,_0x2ab6e5){_0x2f1823=_0x2f1823-0x0;var _0x544f66=_0xf7b4[_0x2f1823];return _0x544f66;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/messages',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0x7')](_0x4f7b('0xf'),auth[_0x4f7b('0x8')](),controller['download']);router[_0x4f7b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f7b('0x10')](_0x4f7b('0x11'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['post'](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x16')),controller[_0x4f7b('0x17')]);router[_0x4f7b('0x18')](_0x4f7b('0xc'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x19')),controller['update']);router[_0x4f7b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),'smsinteraction:destroy'),controller[_0x4f7b('0x1b')]);router[_0x4f7b('0x1a')](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),controller['removeTags']);module[_0x4f7b('0x1c')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4389d6,_0x58768d){var _0x3f279b=function(_0x1a4764){while(--_0x1a4764){_0x4389d6['push'](_0x4389d6['shift']());}};_0x3f279b(++_0x58768d);}(_0x2032,0xd9));var _0x2203=function(_0x327490,_0x4800ef){_0x327490=_0x327490-0x0;var _0x30514d=_0x2032[_0x327490];return _0x30514d;};'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',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c6a4492..05d0b36 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 _0x1c63=['DATE','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x398676,_0xbb2c3e){var _0x18ac21=function(_0x5081cb){while(--_0x5081cb){_0x398676['push'](_0x398676['shift']());}};_0x18ac21(++_0xbb2c3e);}(_0x1c63,0xdc));var _0x31c6=function(_0x420745,_0x1a6314){_0x420745=_0x420745-0x0;var _0x153a1a=_0x1c63[_0x420745];return _0x153a1a;};'use strict';var Sequelize=require(_0x31c6('0x0'));var moment=require(_0x31c6('0x1'));module[_0x31c6('0x2')]={'closed':{'type':Sequelize[_0x31c6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x31c6('0x4')]},'secondDisposition':{'type':Sequelize[_0x31c6('0x4')]},'thirdDisposition':{'type':Sequelize[_0x31c6('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x31c6('0x4')]},'read1stAt':{'type':Sequelize[_0x31c6('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x31c6('0x6')]('in',_0x31c6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x31c6('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x31c6('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x31c6('0x8')]}}; \ No newline at end of file +var _0x6739=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x414c2d,_0x313f6e){var _0x50bd23=function(_0x311522){while(--_0x311522){_0x414c2d['push'](_0x414c2d['shift']());}};_0x50bd23(++_0x313f6e);}(_0x6739,0xd3));var _0x9673=function(_0x81d428,_0x2dba52){_0x81d428=_0x81d428-0x0;var _0x59d078=_0x6739[_0x81d428];return _0x59d078;};'use strict';var Sequelize=require(_0x9673('0x0'));var moment=require(_0x9673('0x1'));module[_0x9673('0x2')]={'closed':{'type':Sequelize[_0x9673('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9673('0x4')]},'disposition':{'type':Sequelize[_0x9673('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9673('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9673('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9673('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9673('0x6')]('in',_0x9673('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'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 6e42a3c..a630228 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 _0x5dfb=['value','renderFile','views','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','moment','bluebird','path','ejs','lodash','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','limit','undefined','offset','count','set','Content-Range','update','then','destroy','error','stack','name','index','SmsInteraction','rawAttributes','key','getOptions','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','map','$gte','format','findAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','lastName','direction','secret','read','Account','Owner','get','mkdirSync','fullname','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','System','Contact','firstName'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5dfb,0x170));var _0xb5df=function(_0x1b3a72,_0x3a1f98){_0x1b3a72=_0x1b3a72-0x0;var _0x8b247f=_0x5dfb[_0x1b3a72];return _0x8b247f;};'use strict';var rimraf=require(_0xb5df('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb5df('0x1'));var BPromise=require(_0xb5df('0x2'));var util=require('util');var path=require(_0xb5df('0x3'));var ejs=require(_0xb5df('0x4'));var fs=require('fs');var _=require(_0xb5df('0x5'));var Redis=require('ioredis');var interaction=require(_0xb5df('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xb5df('0x7'));var config=require(_0xb5df('0x8'));var db=require(_0xb5df('0x9'))['db'];config['redis']=_['defaults'](config[_0xb5df('0xa')],{'host':_0xb5df('0xb'),'port':0x18eb});var socket=require(_0xb5df('0xc'))(new Redis(config[_0xb5df('0xa')]));require(_0xb5df('0xd'))[_0xb5df('0xe')](socket);function respondWithStatusCode(_0x1afe60,_0x43e625){_0x43e625=_0x43e625||0xcc;return function(_0x4fb59d){if(_0x4fb59d){return _0x1afe60['sendStatus'](_0x43e625);}return _0x1afe60[_0xb5df('0xf')](_0x43e625)[_0xb5df('0x10')]();};}function respondWithResult(_0x4d2580,_0x2aaf91){_0x2aaf91=_0x2aaf91||0xc8;return function(_0x5cfbeb){if(_0x5cfbeb){return _0x4d2580[_0xb5df('0xf')](_0x2aaf91)['json'](_0x5cfbeb);}};}function respondWithFilteredResult(_0x56d18b,_0x962d03){return function(_0x57b0c6){if(_0x57b0c6){var _0x40bedc=typeof _0x962d03['offset']==='undefined'&&typeof _0x962d03[_0xb5df('0x11')]===_0xb5df('0x12');var _0x52162d=_0x57b0c6['count'];var _0x41c76e=_0x40bedc?0x0:_0x962d03[_0xb5df('0x13')];var _0x593da7=_0x40bedc?_0x57b0c6[_0xb5df('0x14')]:_0x962d03[_0xb5df('0x13')]+_0x962d03[_0xb5df('0x11')];var _0x54ff4a;if(_0x593da7>=_0x52162d){_0x593da7=_0x52162d;_0x54ff4a=0xc8;}else{_0x54ff4a=0xce;}_0x56d18b[_0xb5df('0xf')](_0x54ff4a);return _0x56d18b[_0xb5df('0x15')](_0xb5df('0x16'),_0x41c76e+'-'+_0x593da7+'/'+_0x52162d)['json'](_0x57b0c6);}return null;};}function saveUpdates(_0x6846f1){return function(_0x124b78){if(_0x124b78){return _0x124b78[_0xb5df('0x17')](_0x6846f1)[_0xb5df('0x18')](function(_0x25e6d9){return _0x25e6d9;});}return null;};}function removeEntity(_0x197231){return function(_0x23de67){if(_0x23de67){return _0x23de67[_0xb5df('0x19')]()[_0xb5df('0x18')](function(){_0x197231['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1ce85){return function(_0x28d435){if(!_0x28d435){_0xf1ce85['sendStatus'](0x194);}return _0x28d435;};}function handleError(_0x4dd349,_0x5d0831){_0x5d0831=_0x5d0831||0x1f4;return function(_0x12d177){logger[_0xb5df('0x1a')](_0x12d177[_0xb5df('0x1b')]);if(_0x12d177[_0xb5df('0x1c')]){delete _0x12d177['name'];}_0x4dd349[_0xb5df('0xf')](_0x5d0831)['send'](_0x12d177);};}exports[_0xb5df('0x1d')]=function(_0x2536bc,_0x334063){var _0xb73c4a={};var _0x369626=_['map'](db[_0xb5df('0x1e')][_0xb5df('0x1f')],function(_0x169a00){return{'name':_0x169a00['fieldName'],'type':_0x169a00['type'][_0xb5df('0x20')]};});_0xb73c4a=qs[_0xb5df('0x21')](_0x369626,_0x2536bc);return interaction['findAll']('sms',_0x2536bc[_0xb5df('0x22')],_0x2536bc['user'],_0xb73c4a,_0x369626)[_0xb5df('0x18')](respondWithFilteredResult(_0x334063,_0xb73c4a))[_0xb5df('0x23')](handleError(_0x334063,null));};exports[_0xb5df('0x24')]=function(_0x2513cd,_0x955d70){var _0x47b708={'raw':![],'where':{'id':_0x2513cd[_0xb5df('0x25')]['id']}},_0x56aba0={};_0x56aba0[_0xb5df('0x26')]=_['keys'](db['SmsInteraction'][_0xb5df('0x1f')]);_0x56aba0['query']=_[_0xb5df('0x27')](_0x2513cd[_0xb5df('0x22')]);_0x56aba0[_0xb5df('0x28')]=_[_0xb5df('0x29')](_0x56aba0[_0xb5df('0x26')],_0x56aba0[_0xb5df('0x22')]);_0x47b708[_0xb5df('0x2a')]=_[_0xb5df('0x29')](_0x56aba0['model'],qs[_0xb5df('0x2b')](_0x2513cd['query']['fields']));_0x47b708['attributes']=_0x47b708[_0xb5df('0x2a')][_0xb5df('0x2c')]?_0x47b708[_0xb5df('0x2a')]:_0x56aba0[_0xb5df('0x26')];if(_0x2513cd[_0xb5df('0x22')][_0xb5df('0x2d')]){_0x47b708[_0xb5df('0x2e')]=[{'all':!![]}];}_0x47b708=_[_0xb5df('0x2f')]({},_0x47b708,_0x2513cd[_0xb5df('0x30')]);return db[_0xb5df('0x1e')][_0xb5df('0x31')](_0x47b708)[_0xb5df('0x18')](handleEntityNotFound(_0x955d70,null))[_0xb5df('0x18')](respondWithResult(_0x955d70,null))['catch'](handleError(_0x955d70,null));};exports[_0xb5df('0x32')]=function(_0x3476c2,_0x108a08){return db[_0xb5df('0x1e')][_0xb5df('0x32')](_0x3476c2[_0xb5df('0x33')],{})[_0xb5df('0x18')](respondWithResult(_0x108a08,0xc9))['catch'](handleError(_0x108a08,null));};exports['update']=function(_0x14906f,_0x4505b3){if(_0x14906f[_0xb5df('0x33')]['id']){delete _0x14906f['body']['id'];}return db[_0xb5df('0x1e')]['find']({'where':{'id':_0x14906f[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0x4505b3,null))[_0xb5df('0x18')](saveUpdates(_0x14906f[_0xb5df('0x33')],null))[_0xb5df('0x18')](respondWithResult(_0x4505b3,null))[_0xb5df('0x23')](handleError(_0x4505b3,null));};exports['destroy']=function(_0x2da901,_0xcf83c3){return db['SmsInteraction'][_0xb5df('0x31')]({'where':{'id':_0x2da901[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0xcf83c3,null))[_0xb5df('0x18')](removeEntity(_0xcf83c3,null))['catch'](handleError(_0xcf83c3,null));};exports[_0xb5df('0x34')]=function(_0x356eb1,_0x25985c){return db[_0xb5df('0x1e')]['describe']()['then'](respondWithResult(_0x25985c,null))['catch'](handleError(_0x25985c,null));};exports[_0xb5df('0x35')]=function(_0x133dc0,_0x4248b2){return db[_0xb5df('0x36')]['find']({'where':{'id':_0x133dc0[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0x4248b2,null))[_0xb5df('0x18')](function(_0x43d7ff){if(_0x43d7ff){return _0x43d7ff[_0xb5df('0x35')](_0x133dc0[_0xb5df('0x33')][_0xb5df('0x37')],_[_0xb5df('0x38')](_0x133dc0[_0xb5df('0x33')],[_0xb5df('0x37'),'id'])||{});}})[_0xb5df('0x18')](respondWithResult(_0x4248b2,null))['catch'](handleError(_0x4248b2,null));};exports['getMessages']=function(_0x2f9429,_0x4999cf){var _0x34a9f2={'raw':![],'where':{}};var _0x978e36={};var _0x4b814e={'count':0x0,'rows':[]};return db[_0xb5df('0x1e')]['findOne']({'where':{'id':_0x2f9429[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0x4999cf,null))[_0xb5df('0x18')](function(_0x3626c1){if(_0x3626c1){_0x978e36[_0xb5df('0x26')]=_[_0xb5df('0x27')](db['SmsMessage']['rawAttributes']);_0x978e36[_0xb5df('0x22')]=_[_0xb5df('0x27')](_0x2f9429['query']);_0x978e36['filters']=_['intersection'](_0x978e36[_0xb5df('0x26')],_0x978e36[_0xb5df('0x22')]);_0x34a9f2[_0xb5df('0x2a')]=_['intersection'](_0x978e36[_0xb5df('0x26')],qs['fields'](_0x2f9429[_0xb5df('0x22')][_0xb5df('0x2b')]));_0x34a9f2[_0xb5df('0x2a')]=_0x34a9f2[_0xb5df('0x2a')][_0xb5df('0x2c')]?_0x34a9f2['attributes']:_0x978e36[_0xb5df('0x26')];if(!_0x2f9429[_0xb5df('0x22')][_0xb5df('0x39')](_0xb5df('0x3a'))){_0x34a9f2['limit']=qs['limit'](_0x2f9429['query']['limit']);_0x34a9f2['offset']=qs['offset'](_0x2f9429[_0xb5df('0x22')][_0xb5df('0x13')]);}_0x34a9f2[_0xb5df('0x3b')]=qs[_0xb5df('0x3c')](_0x2f9429['query'][_0xb5df('0x3c')]);_0x34a9f2[_0xb5df('0x3d')]=qs[_0xb5df('0x28')](_[_0xb5df('0x3e')](_0x2f9429[_0xb5df('0x22')],_0x978e36[_0xb5df('0x28')]));_0x34a9f2[_0xb5df('0x3d')][_0xb5df('0x3f')]=_0x3626c1['id'];if(_0x2f9429[_0xb5df('0x22')][_0xb5df('0x40')]){_0x34a9f2[_0xb5df('0x3d')]=_['merge'](_0x34a9f2[_0xb5df('0x3d')],{'$or':_[_0xb5df('0x41')](_0x34a9f2[_0xb5df('0x2a')],function(_0xe218cd){var _0x1a2619={};_0x1a2619[_0xe218cd]={'$like':'%'+_0x2f9429['query']['filter']+'%'};return _0x1a2619;})});}if(_0x2f9429['query'][_0xb5df('0x42')]){var _0x182025=_0x2f9429[_0xb5df('0x22')][_0xb5df('0x42')]['split'](',');var _0x382635={};_0x382635[_0x182025[0x0]]={'$gte':moment(_0x182025[0x1])[_0xb5df('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x34a9f2['where']=_[_0xb5df('0x2f')](_0x34a9f2[_0xb5df('0x3d')],_0x382635);}_0x34a9f2=_[_0xb5df('0x2f')]({},_0x34a9f2,_0x2f9429[_0xb5df('0x30')]);return db['SmsMessage'][_0xb5df('0x14')]({'where':_0x34a9f2[_0xb5df('0x3d')]})[_0xb5df('0x18')](function(_0x46dd02){_0x4b814e['count']=_0x46dd02;if(_0x2f9429['query'][_0xb5df('0x2d')]){_0x34a9f2[_0xb5df('0x2e')]=[{'all':!![]}];}return db['SmsMessage'][_0xb5df('0x44')](_0x34a9f2);})[_0xb5df('0x18')](function(_0x388604){_0x4b814e[_0xb5df('0x45')]=_0x388604;return _0x4b814e;});}})[_0xb5df('0x18')](respondWithFilteredResult(_0x4999cf,_0x34a9f2))[_0xb5df('0x23')](handleError(_0x4999cf,null));};exports[_0xb5df('0x46')]=function(_0x51d539,_0x729a22){return db[_0xb5df('0x1e')][_0xb5df('0x31')]({'where':{'id':_0x51d539[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0x729a22,null))[_0xb5df('0x18')](function(_0xddce14){if(_0xddce14){return _0xddce14[_0xb5df('0x47')](_0x51d539[_0xb5df('0x33')][_0xb5df('0x37')],_['omit'](_0x51d539['body'],[_0xb5df('0x37'),'id'])||{})[_0xb5df('0x48')](function(){return db[_0xb5df('0x49')][_0xb5df('0x44')]({'attributes':['id',_0xb5df('0x1c'),_0xb5df('0x4a')],'where':{'id':_0x51d539[_0xb5df('0x33')][_0xb5df('0x37')]}});})[_0xb5df('0x18')](function(_0x17084f){socket[_0xb5df('0x4b')](_0xb5df('0x4c'),{'id':Number(_0x51d539[_0xb5df('0x25')]['id']),'tags':_0x17084f||[]});return{'id':Number(_0x51d539[_0xb5df('0x25')]['id']),'tags':_0x17084f||[]};});}})['then'](respondWithResult(_0x729a22,null))[_0xb5df('0x23')](handleError(_0x729a22,null));};exports['removeTags']=function(_0x11ad5d,_0x1d7791){return db[_0xb5df('0x1e')][_0xb5df('0x31')]({'where':{'id':_0x11ad5d[_0xb5df('0x25')]['id']}})[_0xb5df('0x18')](handleEntityNotFound(_0x1d7791,null))[_0xb5df('0x18')](function(_0x2dd0d2){if(_0x2dd0d2){return _0x2dd0d2[_0xb5df('0x4d')](_0x11ad5d[_0xb5df('0x22')][_0xb5df('0x37')]);}})[_0xb5df('0x18')](respondWithStatusCode(_0x1d7791,null))['catch'](handleError(_0x1d7791,null));};exports[_0xb5df('0x4e')]=function(_0x3cb5db,_0x402168){var _0x4420ad=moment()[_0xb5df('0x4f')]()[_0xb5df('0x50')]();var _0x7e77a9=path[_0xb5df('0x51')](config[_0xb5df('0x52')],_0xb5df('0x53'),_0xb5df('0x54'),_0xb5df('0x55'));var _0xf405f5=path[_0xb5df('0x51')](_0x7e77a9,_0x4420ad);var _0x49cce0=util['format'](_0xb5df('0x56'),_0x3cb5db['params']['id'],_0x4420ad);var _0x3b24e5=path['join'](_0x7e77a9,_0x49cce0);var _0x49bf9c=[];_0x49bf9c[_0xb5df('0x57')]({'model':db[_0xb5df('0x58')],'as':_0xb5df('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x49bf9c['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xb5df('0x59')],'raw':!![]});var _0x2d9270=[{'model':db[_0xb5df('0x36')],'as':'Messages','attributes':['id','body','createdAt',_0xb5df('0x5a'),_0xb5df('0x5b'),_0xb5df('0x5c')],'include':_0x49bf9c}];_0x2d9270[_0xb5df('0x57')]({'model':db['SmsAccount'],'as':_0xb5df('0x5d'),'attributes':['id',_0xb5df('0x1c')]});_0x2d9270[_0xb5df('0x57')]({'model':db[_0xb5df('0x58')],'as':_0xb5df('0x5e'),'attributes':['id','fullname']});return db['SmsInteraction'][_0xb5df('0x31')]({'where':{'id':_0x3cb5db['params']['id']},'include':_0x2d9270})[_0xb5df('0x18')](handleEntityNotFound(_0x402168,null))[_0xb5df('0x18')](function(_0x24f2c5){if(_0x24f2c5){var _0x2745e9=_0x24f2c5[_0xb5df('0x5f')]({'plain':!![]});fs[_0xb5df('0x60')](_0xf405f5);var _0x3285fb={'channel':'Sms','account':_0x2745e9[_0xb5df('0x5d')]['name'],'agent':_0x2745e9[_0xb5df('0x5e')]?_0x2745e9[_0xb5df('0x5e')][_0xb5df('0x61')]:_0xb5df('0x62'),'createdAt':moment(_0x2745e9[_0xb5df('0x63')])[_0xb5df('0x43')](_0xb5df('0x64'))[_0xb5df('0x50')](),'closedAt':_0x2745e9[_0xb5df('0x65')]?moment(_0x2745e9[_0xb5df('0x66')])[_0xb5df('0x43')](_0xb5df('0x64'))[_0xb5df('0x50')]():'','disposition':_0x2745e9[_0xb5df('0x67')],'messages':_(_0x2745e9[_0xb5df('0x68')])[_0xb5df('0x40')]({'secret':![]})[_0xb5df('0x41')](function(_0x25362e){return{'date':moment(_0x25362e[_0xb5df('0x63')])[_0xb5df('0x43')](_0xb5df('0x64'))[_0xb5df('0x50')](),'sender':_0x25362e['direction']==='out'?_0x25362e[_0xb5df('0x58')]?_0x25362e[_0xb5df('0x58')][_0xb5df('0x61')]:_0xb5df('0x69'):_0x25362e[_0xb5df('0x6a')][_0xb5df('0x6b')]+(_0x25362e[_0xb5df('0x6a')]['lastName']?'\x20'+_0x25362e['Contact'][_0xb5df('0x59')]:''),'body':_0x25362e[_0xb5df('0x33')],'direction':_0x25362e[_0xb5df('0x5a')]==='out'?'A':'C','secret':_0x25362e[_0xb5df('0x5b')],'read':_0x25362e[_0xb5df('0x5c')]};})[_0xb5df('0x6c')]()};return ejs[_0xb5df('0x6d')](path[_0xb5df('0x51')](config['root'],_0xb5df('0x53'),_0xb5df('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x3285fb})['then'](function(_0x19ffc4){var _0x3af35a=path[_0xb5df('0x51')](_0xf405f5,_0xb5df('0x6f')+_0x2745e9['id']+'-'+_0x4420ad+_0xb5df('0x70'));var _0x40a1c9={'path':_0x3af35a,'channel':_0xb5df('0x71'),'interactionId':_0x2745e9['id']};return pdf[_0xb5df('0x72')](_0x19ffc4,_0x40a1c9);})[_0xb5df('0x18')](function(){return new BPromise(function(_0xd35e91,_0x1d1839){zipdir(_0xf405f5,{'saveTo':_0x3b24e5},function(_0x4ffdfd,_0x5a53a4){if(_0x4ffdfd)return _0x1d1839(_0x4ffdfd);return _0xd35e91(_0x5a53a4);});})[_0xb5df('0x18')](function(){return new BPromise(function(_0x33dcc9,_0x511ed1){rimraf(_0xf405f5,function(_0x17a7e2){if(_0x17a7e2)_0x511ed1(_0x17a7e2);return _0x33dcc9();});});})[_0xb5df('0x18')](function(){return _0x402168['download'](_0x3b24e5,_0x49cce0,function(_0x57cc3a){if(_0x57cc3a){console[_0xb5df('0x73')](_0xb5df('0x74'),_0x57cc3a);}else{fs[_0xb5df('0x75')](_0x3b24e5);}});});});}else{return _0x402168[_0xb5df('0x76')](0xc8);}})[_0xb5df('0x23')](handleError(_0x402168,null));}; \ No newline at end of file +var _0xe528=['zip-dir','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','then','destroy','error','name','send','index','map','SmsInteraction','fieldName','type','getOptions','findAll','sms','query','user','catch','params','model','keys','intersection','attributes','fields','length','include','options','find','body','update','describe','addMessage','ids','findOne','SmsMessage','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','removeTags','download','unix','toString','join','root','server','tmp','push','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','get','mkdirSync','Account','N.A.','closed','closedAt','System','Contact','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe528,0x167));var _0x8e52=function(_0x44e9d1,_0x21dfa7){_0x44e9d1=_0x44e9d1-0x0;var _0xf72fc9=_0xe528[_0x44e9d1];return _0xf72fc9;};'use strict';var rimraf=require(_0x8e52('0x0'));var zipdir=require(_0x8e52('0x1'));var moment=require(_0x8e52('0x2'));var BPromise=require(_0x8e52('0x3'));var util=require('util');var path=require(_0x8e52('0x4'));var ejs=require(_0x8e52('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8e52('0x6'));var interaction=require(_0x8e52('0x7'));var qs=require(_0x8e52('0x8'));var pdf=require(_0x8e52('0x9'));var logger=require(_0x8e52('0xa'))(_0x8e52('0xb'));var config=require(_0x8e52('0xc'));var db=require(_0x8e52('0xd'))['db'];config['redis']=_['defaults'](config[_0x8e52('0xe')],{'host':_0x8e52('0xf'),'port':0x18eb});var socket=require(_0x8e52('0x10'))(new Redis(config[_0x8e52('0xe')]));require(_0x8e52('0x11'))[_0x8e52('0x12')](socket);function respondWithStatusCode(_0x28357e,_0x133007){_0x133007=_0x133007||0xcc;return function(_0x1d3b03){if(_0x1d3b03){return _0x28357e[_0x8e52('0x13')](_0x133007);}return _0x28357e['status'](_0x133007)[_0x8e52('0x14')]();};}function respondWithResult(_0x3ea43c,_0x1625b2){_0x1625b2=_0x1625b2||0xc8;return function(_0x5c58fa){if(_0x5c58fa){return _0x3ea43c['status'](_0x1625b2)[_0x8e52('0x15')](_0x5c58fa);}};}function respondWithFilteredResult(_0x5aa51d,_0x276038){return function(_0x99272c){if(_0x99272c){var _0x1b0114=typeof _0x276038[_0x8e52('0x16')]==='undefined'&&typeof _0x276038[_0x8e52('0x17')]===_0x8e52('0x18');var _0x136a9f=_0x99272c[_0x8e52('0x19')];var _0x3a6661=_0x1b0114?0x0:_0x276038[_0x8e52('0x16')];var _0x55e24d=_0x1b0114?_0x99272c[_0x8e52('0x19')]:_0x276038[_0x8e52('0x16')]+_0x276038['limit'];var _0x788af1;if(_0x55e24d>=_0x136a9f){_0x55e24d=_0x136a9f;_0x788af1=0xc8;}else{_0x788af1=0xce;}_0x5aa51d[_0x8e52('0x1a')](_0x788af1);return _0x5aa51d['set'](_0x8e52('0x1b'),_0x3a6661+'-'+_0x55e24d+'/'+_0x136a9f)[_0x8e52('0x15')](_0x99272c);}return null;};}function saveUpdates(_0x3358c0){return function(_0x3f51d7){if(_0x3f51d7){return _0x3f51d7['update'](_0x3358c0)[_0x8e52('0x1c')](function(_0x5306f3){return _0x5306f3;});}return null;};}function removeEntity(_0xb54b46){return function(_0x24e44e){if(_0x24e44e){return _0x24e44e[_0x8e52('0x1d')]()[_0x8e52('0x1c')](function(){_0xb54b46['status'](0xcc)[_0x8e52('0x14')]();});}};}function handleEntityNotFound(_0x3c732f){return function(_0xb36439){if(!_0xb36439){_0x3c732f['sendStatus'](0x194);}return _0xb36439;};}function handleError(_0x8d5630,_0x32e0a7){_0x32e0a7=_0x32e0a7||0x1f4;return function(_0x387a0e){logger[_0x8e52('0x1e')](_0x387a0e['stack']);if(_0x387a0e[_0x8e52('0x1f')]){delete _0x387a0e[_0x8e52('0x1f')];}_0x8d5630['status'](_0x32e0a7)[_0x8e52('0x20')](_0x387a0e);};}exports[_0x8e52('0x21')]=function(_0x2af759,_0x3fb26c){var _0xe357a5={};var _0x15c84a=_[_0x8e52('0x22')](db[_0x8e52('0x23')]['rawAttributes'],function(_0x2d3b2e){return{'name':_0x2d3b2e[_0x8e52('0x24')],'type':_0x2d3b2e[_0x8e52('0x25')]['key']};});_0xe357a5=qs[_0x8e52('0x26')](_0x15c84a,_0x2af759);return interaction[_0x8e52('0x27')](_0x8e52('0x28'),_0x2af759[_0x8e52('0x29')],_0x2af759[_0x8e52('0x2a')],_0xe357a5,_0x15c84a)[_0x8e52('0x1c')](respondWithFilteredResult(_0x3fb26c,_0xe357a5))[_0x8e52('0x2b')](handleError(_0x3fb26c,null));};exports['show']=function(_0x1ffdfc,_0x503c1e){var _0x27ce34={'raw':![],'where':{'id':_0x1ffdfc[_0x8e52('0x2c')]['id']}},_0x20068d={};_0x20068d[_0x8e52('0x2d')]=_[_0x8e52('0x2e')](db[_0x8e52('0x23')]['rawAttributes']);_0x20068d['query']=_[_0x8e52('0x2e')](_0x1ffdfc[_0x8e52('0x29')]);_0x20068d['filters']=_[_0x8e52('0x2f')](_0x20068d[_0x8e52('0x2d')],_0x20068d[_0x8e52('0x29')]);_0x27ce34[_0x8e52('0x30')]=_[_0x8e52('0x2f')](_0x20068d[_0x8e52('0x2d')],qs[_0x8e52('0x31')](_0x1ffdfc[_0x8e52('0x29')][_0x8e52('0x31')]));_0x27ce34[_0x8e52('0x30')]=_0x27ce34[_0x8e52('0x30')][_0x8e52('0x32')]?_0x27ce34['attributes']:_0x20068d['model'];if(_0x1ffdfc[_0x8e52('0x29')]['includeAll']){_0x27ce34[_0x8e52('0x33')]=[{'all':!![]}];}_0x27ce34=_['merge']({},_0x27ce34,_0x1ffdfc[_0x8e52('0x34')]);return db['SmsInteraction'][_0x8e52('0x35')](_0x27ce34)[_0x8e52('0x1c')](handleEntityNotFound(_0x503c1e,null))[_0x8e52('0x1c')](respondWithResult(_0x503c1e,null))[_0x8e52('0x2b')](handleError(_0x503c1e,null));};exports['create']=function(_0x43c31f,_0x2b21b6){return db[_0x8e52('0x23')]['create'](_0x43c31f[_0x8e52('0x36')],{})[_0x8e52('0x1c')](respondWithResult(_0x2b21b6,0xc9))[_0x8e52('0x2b')](handleError(_0x2b21b6,null));};exports[_0x8e52('0x37')]=function(_0x59cc27,_0x4c3e32){if(_0x59cc27[_0x8e52('0x36')]['id']){delete _0x59cc27[_0x8e52('0x36')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x59cc27['params']['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x4c3e32,null))['then'](saveUpdates(_0x59cc27['body'],null))[_0x8e52('0x1c')](respondWithResult(_0x4c3e32,null))[_0x8e52('0x2b')](handleError(_0x4c3e32,null));};exports['destroy']=function(_0xa0f48,_0x19c36f){return db[_0x8e52('0x23')][_0x8e52('0x35')]({'where':{'id':_0xa0f48['params']['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x19c36f,null))[_0x8e52('0x1c')](removeEntity(_0x19c36f,null))[_0x8e52('0x2b')](handleError(_0x19c36f,null));};exports[_0x8e52('0x38')]=function(_0x36073d,_0x53ad75){return db[_0x8e52('0x23')]['describe']()[_0x8e52('0x1c')](respondWithResult(_0x53ad75,null))[_0x8e52('0x2b')](handleError(_0x53ad75,null));};exports[_0x8e52('0x39')]=function(_0x16e90d,_0x2566fc){return db['SmsMessage'][_0x8e52('0x35')]({'where':{'id':_0x16e90d['params']['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x2566fc,null))['then'](function(_0x352686){if(_0x352686){return _0x352686[_0x8e52('0x39')](_0x16e90d[_0x8e52('0x36')][_0x8e52('0x3a')],_['omit'](_0x16e90d[_0x8e52('0x36')],['ids','id'])||{});}})[_0x8e52('0x1c')](respondWithResult(_0x2566fc,null))[_0x8e52('0x2b')](handleError(_0x2566fc,null));};exports['getMessages']=function(_0xf8da2d,_0x4cd5ea){var _0x710a23={'raw':![],'where':{}};var _0x4eb8a0={};var _0x46dae3={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8e52('0x3b')]({'where':{'id':_0xf8da2d[_0x8e52('0x2c')]['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x4cd5ea,null))[_0x8e52('0x1c')](function(_0x46b856){if(_0x46b856){_0x4eb8a0[_0x8e52('0x2d')]=_[_0x8e52('0x2e')](db[_0x8e52('0x3c')][_0x8e52('0x3d')]);_0x4eb8a0[_0x8e52('0x29')]=_['keys'](_0xf8da2d[_0x8e52('0x29')]);_0x4eb8a0[_0x8e52('0x3e')]=_[_0x8e52('0x2f')](_0x4eb8a0[_0x8e52('0x2d')],_0x4eb8a0[_0x8e52('0x29')]);_0x710a23['attributes']=_[_0x8e52('0x2f')](_0x4eb8a0['model'],qs[_0x8e52('0x31')](_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x31')]));_0x710a23[_0x8e52('0x30')]=_0x710a23[_0x8e52('0x30')]['length']?_0x710a23[_0x8e52('0x30')]:_0x4eb8a0[_0x8e52('0x2d')];if(!_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x3f')](_0x8e52('0x40'))){_0x710a23['limit']=qs['limit'](_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x17')]);_0x710a23[_0x8e52('0x16')]=qs[_0x8e52('0x16')](_0xf8da2d['query']['offset']);}_0x710a23[_0x8e52('0x41')]=qs[_0x8e52('0x42')](_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x42')]);_0x710a23['where']=qs[_0x8e52('0x3e')](_[_0x8e52('0x43')](_0xf8da2d['query'],_0x4eb8a0[_0x8e52('0x3e')]));_0x710a23[_0x8e52('0x44')][_0x8e52('0x45')]=_0x46b856['id'];if(_0xf8da2d['query'][_0x8e52('0x46')]){_0x710a23[_0x8e52('0x44')]=_[_0x8e52('0x47')](_0x710a23[_0x8e52('0x44')],{'$or':_[_0x8e52('0x22')](_0x710a23['attributes'],function(_0x5001c4){var _0x3ff71a={};_0x3ff71a[_0x5001c4]={'$like':'%'+_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x46')]+'%'};return _0x3ff71a;})});}if(_0xf8da2d['query'][_0x8e52('0x48')]){var _0x34ffd7=_0xf8da2d[_0x8e52('0x29')][_0x8e52('0x48')][_0x8e52('0x49')](',');var _0x50e2bc={};_0x50e2bc[_0x34ffd7[0x0]]={'$gte':moment(_0x34ffd7[0x1])[_0x8e52('0x4a')](_0x8e52('0x4b'))};_0x710a23[_0x8e52('0x44')]=_[_0x8e52('0x47')](_0x710a23['where'],_0x50e2bc);}_0x710a23=_[_0x8e52('0x47')]({},_0x710a23,_0xf8da2d[_0x8e52('0x34')]);return db[_0x8e52('0x3c')][_0x8e52('0x19')]({'where':_0x710a23['where']})[_0x8e52('0x1c')](function(_0x1bcdb8){_0x46dae3[_0x8e52('0x19')]=_0x1bcdb8;if(_0xf8da2d[_0x8e52('0x29')]['includeAll']){_0x710a23['include']=[{'all':!![]}];}return db[_0x8e52('0x3c')][_0x8e52('0x27')](_0x710a23);})[_0x8e52('0x1c')](function(_0x1f38cc){_0x46dae3[_0x8e52('0x4c')]=_0x1f38cc;return _0x46dae3;});}})[_0x8e52('0x1c')](respondWithFilteredResult(_0x4cd5ea,_0x710a23))['catch'](handleError(_0x4cd5ea,null));};exports['addTags']=function(_0x10576f,_0x535e10){return db[_0x8e52('0x23')][_0x8e52('0x35')]({'where':{'id':_0x10576f[_0x8e52('0x2c')]['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x535e10,null))[_0x8e52('0x1c')](function(_0x525ae1){if(_0x525ae1){return _0x525ae1[_0x8e52('0x4d')](_0x10576f[_0x8e52('0x36')][_0x8e52('0x3a')],_['omit'](_0x10576f[_0x8e52('0x36')],[_0x8e52('0x3a'),'id'])||{})[_0x8e52('0x4e')](function(){return db[_0x8e52('0x4f')][_0x8e52('0x27')]({'attributes':['id',_0x8e52('0x1f'),_0x8e52('0x50')],'where':{'id':_0x10576f[_0x8e52('0x36')][_0x8e52('0x3a')]}});})[_0x8e52('0x1c')](function(_0x40cd29){socket['emit']('smsInteractionTags:save',{'id':Number(_0x10576f[_0x8e52('0x2c')]['id']),'tags':_0x40cd29||[]});return{'id':Number(_0x10576f['params']['id']),'tags':_0x40cd29||[]};});}})[_0x8e52('0x1c')](respondWithResult(_0x535e10,null))['catch'](handleError(_0x535e10,null));};exports[_0x8e52('0x51')]=function(_0x4d7686,_0x3d2222){return db['SmsInteraction'][_0x8e52('0x35')]({'where':{'id':_0x4d7686[_0x8e52('0x2c')]['id']}})[_0x8e52('0x1c')](handleEntityNotFound(_0x3d2222,null))[_0x8e52('0x1c')](function(_0x294784){if(_0x294784){return _0x294784[_0x8e52('0x51')](_0x4d7686[_0x8e52('0x29')][_0x8e52('0x3a')]);}})[_0x8e52('0x1c')](respondWithStatusCode(_0x3d2222,null))[_0x8e52('0x2b')](handleError(_0x3d2222,null));};exports[_0x8e52('0x52')]=function(_0x4e4b2b,_0x5c61e5){var _0x230c67=moment()[_0x8e52('0x53')]()[_0x8e52('0x54')]();var _0x461760=path[_0x8e52('0x55')](config[_0x8e52('0x56')],_0x8e52('0x57'),'files',_0x8e52('0x58'));var _0x2d4a6b=path[_0x8e52('0x55')](_0x461760,_0x230c67);var _0x500521=util['format']('transcript-%d-%s.zip',_0x4e4b2b[_0x8e52('0x2c')]['id'],_0x230c67);var _0x26c228=path[_0x8e52('0x55')](_0x461760,_0x500521);var _0xa0d8f=[];_0xa0d8f[_0x8e52('0x59')]({'model':db[_0x8e52('0x5a')],'as':'User','attributes':['id',_0x8e52('0x5b')],'raw':!![]});_0xa0d8f[_0x8e52('0x59')]({'model':db[_0x8e52('0x5c')],'as':'Contact','attributes':['id',_0x8e52('0x5d'),_0x8e52('0x5e')],'raw':!![]});var _0x15d9ea=[{'model':db[_0x8e52('0x3c')],'as':_0x8e52('0x5f'),'attributes':['id','body',_0x8e52('0x60'),_0x8e52('0x61'),_0x8e52('0x62'),_0x8e52('0x63')],'include':_0xa0d8f}];_0x15d9ea[_0x8e52('0x59')]({'model':db[_0x8e52('0x64')],'as':'Account','attributes':['id',_0x8e52('0x1f')]});_0x15d9ea['push']({'model':db[_0x8e52('0x5a')],'as':_0x8e52('0x65'),'attributes':['id',_0x8e52('0x5b')]});return db['SmsInteraction']['find']({'where':{'id':_0x4e4b2b[_0x8e52('0x2c')]['id']},'include':_0x15d9ea})[_0x8e52('0x1c')](handleEntityNotFound(_0x5c61e5,null))['then'](function(_0x5c4a5a){if(_0x5c4a5a){var _0x146255=_0x5c4a5a[_0x8e52('0x66')]({'plain':!![]});fs[_0x8e52('0x67')](_0x2d4a6b);var _0x225108={'channel':'Sms','account':_0x146255[_0x8e52('0x68')]['name'],'agent':_0x146255[_0x8e52('0x65')]?_0x146255[_0x8e52('0x65')][_0x8e52('0x5b')]:_0x8e52('0x69'),'createdAt':moment(_0x146255[_0x8e52('0x60')])[_0x8e52('0x4a')](_0x8e52('0x4b'))[_0x8e52('0x54')](),'closedAt':_0x146255[_0x8e52('0x6a')]?moment(_0x146255[_0x8e52('0x6b')])[_0x8e52('0x4a')](_0x8e52('0x4b'))[_0x8e52('0x54')]():'','disposition':_0x146255['disposition'],'messages':_(_0x146255[_0x8e52('0x5f')])[_0x8e52('0x46')]({'secret':![]})[_0x8e52('0x22')](function(_0x577c3e){return{'date':moment(_0x577c3e[_0x8e52('0x60')])[_0x8e52('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8e52('0x54')](),'sender':_0x577c3e['direction']==='out'?_0x577c3e[_0x8e52('0x5a')]?_0x577c3e[_0x8e52('0x5a')][_0x8e52('0x5b')]:_0x8e52('0x6c'):_0x577c3e[_0x8e52('0x6d')]['firstName']+(_0x577c3e[_0x8e52('0x6d')]['lastName']?'\x20'+_0x577c3e[_0x8e52('0x6d')]['lastName']:''),'body':_0x577c3e[_0x8e52('0x36')],'direction':_0x577c3e[_0x8e52('0x61')]===_0x8e52('0x6e')?'A':'C','secret':_0x577c3e[_0x8e52('0x62')],'read':_0x577c3e[_0x8e52('0x63')]};})[_0x8e52('0x6f')]()};return ejs[_0x8e52('0x70')](path[_0x8e52('0x55')](config[_0x8e52('0x56')],'server',_0x8e52('0x71'),_0x8e52('0x72')),{'interaction':_0x225108})[_0x8e52('0x1c')](function(_0x277276){var _0x59cb1a=path['join'](_0x2d4a6b,'transcript-'+_0x146255['id']+'-'+_0x230c67+_0x8e52('0x73'));var _0x110afd={'path':_0x59cb1a,'channel':'Sms','interactionId':_0x146255['id']};return pdf[_0x8e52('0x74')](_0x277276,_0x110afd);})[_0x8e52('0x1c')](function(){return new BPromise(function(_0x4b29e7,_0x3e3715){zipdir(_0x2d4a6b,{'saveTo':_0x26c228},function(_0x339fdf,_0x5783ae){if(_0x339fdf)return _0x3e3715(_0x339fdf);return _0x4b29e7(_0x5783ae);});})[_0x8e52('0x1c')](function(){return new BPromise(function(_0xad88cb,_0x39b0fd){rimraf(_0x2d4a6b,function(_0xc4a59c){if(_0xc4a59c)_0x39b0fd(_0xc4a59c);return _0xad88cb();});});})['then'](function(){return _0x5c61e5[_0x8e52('0x52')](_0x26c228,_0x500521,function(_0x3df68c){if(_0x3df68c){console[_0x8e52('0x75')](_0x8e52('0x76'),_0x3df68c);}else{fs[_0x8e52('0x77')](_0x26c228);}});});});}else{return _0x5c61e5['sendStatus'](0xc8);}})[_0x8e52('0x2b')](handleError(_0x5c61e5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ca3be4e..5e16f93 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 _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(_0x154b4c,_0xa38e2){_0x154b4c=_0x154b4c-0x0;var _0x100586=_0xf4f4[_0x154b4c];return _0x100586;};'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 +var _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x65f6('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x65f6('0x0'))['db'][_0x65f6('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x65f6('0x2')](0x0);var events={'afterCreate':_0x65f6('0x3'),'afterUpdate':_0x65f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c5029){return function(_0x5150c8,_0x1c9f5b,_0x22b017){_0x5150c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0e12){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x6'),_0x1c0e12[_0x65f6('0x7')](function(_0xc44c70){return{'id':_0xc44c70['id']};}));return SmsMessage[_0x65f6('0x8')]({'where':{'SmsInteractionId':_0x5150c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5123ee){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x9'),_0x5123ee[_0x65f6('0xa')]);SmsInteractionEvents[_0x65f6('0xb')](_0x3c5029+':'+_0x5150c8['id'],_0x5150c8);SmsInteractionEvents['emit'](_0x3c5029,_0x5150c8);_0x22b017(null);})[_0x65f6('0xc')](_0x22b017(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x65f6('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 697c3d2..82aa082 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 _0x91a2=['../../config/environment','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x91a2,0x117));var _0x291a=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x91a2[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0x291a('0x0'));var util=require('util');var logger=require(_0x291a('0x1'))(_0x291a('0x2'));var moment=require('moment');var BPromise=require(_0x291a('0x3'));var rp=require(_0x291a('0x4'));var fs=require('fs');var path=require(_0x291a('0x5'));var rimraf=require('rimraf');var config=require(_0x291a('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x291a('0x7')]=function(_0x3255f1,_0x4c99ea){return _0x3255f1[_0x291a('0x8')]('SmsInteraction',attributes,{'tableName':_0x291a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x189b8f,_0x221a7f,_0x445c8b){if(_0x189b8f[_0x291a('0xa')](_0x291a('0xb'))){_0x189b8f[_0x291a('0xc')]=moment()[_0x291a('0xd')](_0x291a('0xe'));}_0x445c8b(null,_0x189b8f);}}});}; \ No newline at end of file +var _0x7041=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','./smsInteraction.attributes','define','SmsInteraction','changed'];(function(_0x5c7053,_0x557816){var _0x5936d7=function(_0x1a2743){while(--_0x1a2743){_0x5c7053['push'](_0x5c7053['shift']());}};_0x5936d7(++_0x557816);}(_0x7041,0x81));var _0x1704=function(_0x580c18,_0xce2496){_0x580c18=_0x580c18-0x0;var _0x93c357=_0x7041[_0x580c18];return _0x93c357;};'use strict';var _=require(_0x1704('0x0'));var util=require(_0x1704('0x1'));var logger=require(_0x1704('0x2'))(_0x1704('0x3'));var moment=require('moment');var BPromise=require(_0x1704('0x4'));var rp=require(_0x1704('0x5'));var fs=require('fs');var path=require(_0x1704('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1704('0x7'));module['exports']=function(_0x297cf2,_0x5b658b){return _0x297cf2[_0x1704('0x8')](_0x1704('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f5ab8,_0x4612b7,_0x3924a1){if(_0x1f5ab8[_0x1704('0xa')](_0x1704('0xb'))){_0x1f5ab8[_0x1704('0xc')]=moment()['format'](_0x1704('0xd'));}_0x3924a1(null,_0x1f5ab8);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index be566c5..6c5f6d7 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 _0xb63f=['then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','stringify','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./smsInteraction.socket','register','request'];(function(_0x5adc26,_0x4ada89){var _0x20d039=function(_0x495b5e){while(--_0x495b5e){_0x5adc26['push'](_0x5adc26['shift']());}};_0x20d039(++_0x4ada89);}(_0xb63f,0xc1));var _0xfb63=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0xb63f[_0x21d36e];return _0x4cc307;};'use strict';var _=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var moment=require(_0xfb63('0x2'));var BPromise=require(_0xfb63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb63('0x4'));var db=require(_0xfb63('0x5'))['db'];var utils=require(_0xfb63('0x6'));var logger=require(_0xfb63('0x7'))(_0xfb63('0x8'));var config=require(_0xfb63('0x9'));var jayson=require(_0xfb63('0xa'));var client=jayson[_0xfb63('0xb')]['http']({'port':0x232a});config[_0xfb63('0xc')]=_[_0xfb63('0xd')](config[_0xfb63('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb63('0xc')]));require(_0xfb63('0xe'))[_0xfb63('0xf')](socket);function respondWithRpcPromise(_0x4d3fae,_0x2ef8cd,_0x16760f){return new BPromise(function(_0x484a5a,_0x598a68){return client[_0xfb63('0x10')](_0x4d3fae,_0x16760f)[_0xfb63('0x11')](function(_0x452d77){logger[_0xfb63('0x12')](_0xfb63('0x13'),_0x2ef8cd,_0xfb63('0x14'));logger[_0xfb63('0x15')](_0xfb63('0x16'),_0x2ef8cd,_0xfb63('0x14'),JSON['stringify'](_0x452d77));if(_0x452d77[_0xfb63('0x17')]){if(_0x452d77[_0xfb63('0x17')][_0xfb63('0x18')]===0x1f4){logger['error'](_0xfb63('0x13'),_0x2ef8cd,_0x452d77[_0xfb63('0x17')][_0xfb63('0x19')]);return _0x598a68(_0x452d77[_0xfb63('0x17')][_0xfb63('0x19')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2ef8cd,_0x452d77[_0xfb63('0x17')][_0xfb63('0x19')]);return _0x484a5a(_0x452d77['error'][_0xfb63('0x19')]);}else{logger[_0xfb63('0x12')](_0xfb63('0x13'),_0x2ef8cd,_0xfb63('0x14'));_0x484a5a(_0x452d77[_0xfb63('0x1a')][_0xfb63('0x19')]);}})[_0xfb63('0x1b')](function(_0x9ce80f){logger[_0xfb63('0x17')](_0xfb63('0x13'),_0x2ef8cd,_0x9ce80f);_0x598a68(_0x9ce80f);});});}exports[_0xfb63('0x1c')]=function(_0x1364d9){var _0x10fcc7=this;return new Promise(function(_0x2df470,_0x5ad5b1){return db[_0xfb63('0x1d')][_0xfb63('0x1e')](_0x1364d9[_0xfb63('0x1f')],{'raw':_0x1364d9['options']?_0x1364d9[_0xfb63('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1364d9[_0xfb63('0x20')]?_0x1364d9[_0xfb63('0x20')][_0xfb63('0x21')]||null:null,'attributes':_0x1364d9[_0xfb63('0x20')]?_0x1364d9[_0xfb63('0x20')][_0xfb63('0x22')]||null:null,'limit':_0x1364d9['options']?_0x1364d9[_0xfb63('0x20')][_0xfb63('0x23')]||null:null})[_0xfb63('0x11')](function(_0x4170c2){logger[_0xfb63('0x12')]('UpdateSmsInteraction',_0x1364d9);logger[_0xfb63('0x15')](_0xfb63('0x1c'),_0x1364d9,JSON[_0xfb63('0x24')](_0x4170c2));_0x2df470(_0x4170c2);})[_0xfb63('0x1b')](function(_0x43c8f2){logger['error'](_0xfb63('0x1c'),_0x43c8f2[_0xfb63('0x19')],_0x1364d9);_0x5ad5b1(_0x10fcc7['error'](0x1f4,_0x43c8f2[_0xfb63('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2754ac){return new Promise(function(_0x343f28,_0x290309){return db['SmsInteraction']['find']({'where':_0x2754ac[_0xfb63('0x20')]?_0x2754ac['options'][_0xfb63('0x21')]||null:null})['then'](function(_0x398b7b){if(_0x398b7b){return _0x398b7b[_0xfb63('0x25')](_0x2754ac['body'][_0xfb63('0x26')],_[_0xfb63('0x27')](_0x2754ac[_0xfb63('0x1f')],['ids','id'])||{});}})[_0xfb63('0x28')](function(_0x374460){logger['info']('AddTags',_0x2754ac);logger[_0xfb63('0x15')](_0xfb63('0x29'),_0x2754ac,JSON[_0xfb63('0x24')](_0x374460));_0x343f28(_0x374460);})[_0xfb63('0x1b')](function(_0x1156e8){logger[_0xfb63('0x17')](_0xfb63('0x29'),_0x1156e8['message'],_0x2754ac);_0x290309(_this[_0xfb63('0x17')](0x1f4,_0x1156e8[_0xfb63('0x19')]));});});}; \ No newline at end of file +var _0x67cc=['SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateSmsInteraction','options','raw','where','limit','AddTagsToSmsInteraction','SmsInteraction','addTags','omit','body','ids','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x1178c8,_0x53d295){var _0x319873=function(_0x50d4d0){while(--_0x50d4d0){_0x1178c8['push'](_0x1178c8['shift']());}};_0x319873(++_0x53d295);}(_0x67cc,0x67));var _0xc67c=function(_0x361a28,_0x4da70e){_0x361a28=_0x361a28-0x0;var _0x2f8f23=_0x67cc[_0x361a28];return _0x2f8f23;};'use strict';var _=require('lodash');var util=require(_0xc67c('0x0'));var moment=require('moment');var BPromise=require(_0xc67c('0x1'));var rs=require(_0xc67c('0x2'));var fs=require('fs');var Redis=require(_0xc67c('0x3'));var db=require(_0xc67c('0x4'))['db'];var utils=require(_0xc67c('0x5'));var logger=require('../../config/logger')(_0xc67c('0x6'));var config=require(_0xc67c('0x7'));var jayson=require(_0xc67c('0x8'));var client=jayson[_0xc67c('0x9')][_0xc67c('0xa')]({'port':0x232a});config[_0xc67c('0xb')]=_[_0xc67c('0xc')](config[_0xc67c('0xb')],{'host':_0xc67c('0xd'),'port':0x18eb});var socket=require(_0xc67c('0xe'))(new Redis(config[_0xc67c('0xb')]));require(_0xc67c('0xf'))[_0xc67c('0x10')](socket);function respondWithRpcPromise(_0x5968b1,_0x59b7a8,_0x265c9f){return new BPromise(function(_0x509209,_0x3378b9){return client[_0xc67c('0x11')](_0x5968b1,_0x265c9f)[_0xc67c('0x12')](function(_0x273298){logger[_0xc67c('0x13')](_0xc67c('0x14'),_0x59b7a8,'request\x20sent');logger[_0xc67c('0x15')](_0xc67c('0x16'),_0x59b7a8,'request\x20sent',JSON[_0xc67c('0x17')](_0x273298));if(_0x273298[_0xc67c('0x18')]){if(_0x273298[_0xc67c('0x18')]['code']===0x1f4){logger[_0xc67c('0x18')](_0xc67c('0x14'),_0x59b7a8,_0x273298[_0xc67c('0x18')][_0xc67c('0x19')]);return _0x3378b9(_0x273298['error'][_0xc67c('0x19')]);}logger['error'](_0xc67c('0x14'),_0x59b7a8,_0x273298['error'][_0xc67c('0x19')]);return _0x509209(_0x273298[_0xc67c('0x18')][_0xc67c('0x19')]);}else{logger[_0xc67c('0x13')](_0xc67c('0x14'),_0x59b7a8,_0xc67c('0x1a'));_0x509209(_0x273298[_0xc67c('0x1b')][_0xc67c('0x19')]);}})[_0xc67c('0x1c')](function(_0x541e12){logger[_0xc67c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x59b7a8,_0x541e12);_0x3378b9(_0x541e12);});});}exports[_0xc67c('0x1d')]=function(_0x2c5ffd){var _0x47600a=this;return new Promise(function(_0x15bb1c,_0x3bf813){return db['SmsInteraction']['update'](_0x2c5ffd['body'],{'raw':_0x2c5ffd[_0xc67c('0x1e')]?_0x2c5ffd[_0xc67c('0x1e')][_0xc67c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5ffd[_0xc67c('0x1e')]?_0x2c5ffd[_0xc67c('0x1e')][_0xc67c('0x20')]||null:null,'attributes':_0x2c5ffd[_0xc67c('0x1e')]?_0x2c5ffd['options']['attributes']||null:null,'limit':_0x2c5ffd[_0xc67c('0x1e')]?_0x2c5ffd[_0xc67c('0x1e')][_0xc67c('0x21')]||null:null})[_0xc67c('0x12')](function(_0x3f6e86){logger[_0xc67c('0x13')]('UpdateSmsInteraction',_0x2c5ffd);logger[_0xc67c('0x15')]('UpdateSmsInteraction',_0x2c5ffd,JSON['stringify'](_0x3f6e86));_0x15bb1c(_0x3f6e86);})[_0xc67c('0x1c')](function(_0x4d20a3){logger['error']('UpdateSmsInteraction',_0x4d20a3[_0xc67c('0x19')],_0x2c5ffd);_0x3bf813(_0x47600a[_0xc67c('0x18')](0x1f4,_0x4d20a3[_0xc67c('0x19')]));});});};exports[_0xc67c('0x22')]=function(_0x331cc6){return new Promise(function(_0x1b068d,_0x1822b9){return db[_0xc67c('0x23')]['find']({'where':_0x331cc6['options']?_0x331cc6[_0xc67c('0x1e')][_0xc67c('0x20')]||null:null})['then'](function(_0x3c8fc8){if(_0x3c8fc8){return _0x3c8fc8[_0xc67c('0x24')](_0x331cc6['body']['ids'],_[_0xc67c('0x25')](_0x331cc6[_0xc67c('0x26')],[_0xc67c('0x27'),'id'])||{});}})['spread'](function(_0xbfd715){logger[_0xc67c('0x13')](_0xc67c('0x28'),_0x331cc6);logger[_0xc67c('0x15')]('AddTags',_0x331cc6,JSON[_0xc67c('0x17')](_0xbfd715));_0x1b068d(_0xbfd715);})[_0xc67c('0x1c')](function(_0x9d8217){logger[_0xc67c('0x18')](_0xc67c('0x28'),_0x9d8217[_0xc67c('0x19')],_0x331cc6);_0x1822b9(_this[_0xc67c('0x18')](0x1f4,_0x9d8217[_0xc67c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 52e0c80..243e034 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 _0xc715=['save','update','emit','removeListener','register','./smsInteraction.events'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xc715,0x15b));var _0x5c71=function(_0x34ce8c,_0x526c3c){_0x34ce8c=_0x34ce8c-0x0;var _0x31bde5=_0xc715[_0x34ce8c];return _0x31bde5;};'use strict';var SmsInteractionEvents=require(_0x5c71('0x0'));var events=[_0x5c71('0x1'),'remove',_0x5c71('0x2')];function createListener(_0x5b6093,_0x4e6839){return function(_0x12db4d){_0x4e6839[_0x5c71('0x3')](_0x5b6093,_0x12db4d);};}function removeListener(_0x3afac4,_0x7f4ab8){return function(){SmsInteractionEvents[_0x5c71('0x4')](_0x3afac4,_0x7f4ab8);};}exports[_0x5c71('0x5')]=function(_0x5dad50){for(var _0x3d6423=0x0,_0x3812f7=events['length'];_0x3d6423<_0x3812f7;_0x3d6423++){var _0x490c8c=events[_0x3d6423];var _0x382406=createListener('smsInteraction:'+_0x490c8c,_0x5dad50);SmsInteractionEvents['on'](_0x490c8c,_0x382406);}}; \ No newline at end of file +var _0xfc66=['remove','update','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x4b0e62,_0xe3584){var _0x1caa43=function(_0x769c23){while(--_0x769c23){_0x4b0e62['push'](_0x4b0e62['shift']());}};_0x1caa43(++_0xe3584);}(_0xfc66,0xce));var _0x6fc6=function(_0x3af9aa,_0x4c2d84){_0x3af9aa=_0x3af9aa-0x0;var _0x23d347=_0xfc66[_0x3af9aa];return _0x23d347;};'use strict';var SmsInteractionEvents=require(_0x6fc6('0x0'));var events=[_0x6fc6('0x1'),_0x6fc6('0x2'),_0x6fc6('0x3')];function createListener(_0x48ebc4,_0x214f16){return function(_0x44635c){_0x214f16['emit'](_0x48ebc4,_0x44635c);};}function removeListener(_0x3f9af2,_0x4c802b){return function(){SmsInteractionEvents[_0x6fc6('0x4')](_0x3f9af2,_0x4c802b);};}exports[_0x6fc6('0x5')]=function(_0x3cf3ab){for(var _0x41509a=0x0,_0x50e0e6=events[_0x6fc6('0x6')];_0x41509a<_0x50e0e6;_0x41509a++){var _0x5d13a5=events[_0x41509a];var _0x204940=createListener(_0x6fc6('0x7')+_0x5d13a5,_0x3cf3ab);SmsInteractionEvents['on'](_0x5d13a5,_0x204940);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0534853..254fe64 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 _0x2baf=['isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./smsMessage.controller','get'];(function(_0x2335bd,_0x54e892){var _0x2aac2c=function(_0x3194dc){while(--_0x3194dc){_0x2335bd['push'](_0x2335bd['shift']());}};_0x2aac2c(++_0x54e892);}(_0x2baf,0xc8));var _0xf2ba=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x2baf[_0x102b0c];return _0x9b15ca;};'use strict';var multer=require('multer');var util=require(_0xf2ba('0x0'));var path=require(_0xf2ba('0x1'));var timeout=require(_0xf2ba('0x2'));var express=require(_0xf2ba('0x3'));var router=express[_0xf2ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2ba('0x6'));router[_0xf2ba('0x7')]('/',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x9')]);router[_0xf2ba('0x7')]('/describe',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xa')]);router[_0xf2ba('0x7')](_0xf2ba('0xb'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xc')]);router[_0xf2ba('0xd')]('/',auth[_0xf2ba('0x8')](),interaction[_0xf2ba('0xe')](_0xf2ba('0xf'),_0xf2ba('0x10')),controller[_0xf2ba('0x11')]);router[_0xf2ba('0xd')](_0xf2ba('0x12'),controller['status']);router['put'](_0xf2ba('0xb'),auth[_0xf2ba('0x8')](),controller['update']);router[_0xf2ba('0x13')](_0xf2ba('0x14'),auth[_0xf2ba('0x8')](),controller['accept']);router[_0xf2ba('0x13')](_0xf2ba('0x15'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x16')]);router[_0xf2ba('0x17')](_0xf2ba('0xb'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x18')]);module[_0xf2ba('0x19')]=router; \ No newline at end of file +var _0xbfba=['put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','post','sms','smsmessage:create','create','status'];(function(_0x335647,_0x13f7a0){var _0x5dbf94=function(_0x52d06c){while(--_0x52d06c){_0x335647['push'](_0x335647['shift']());}};_0x5dbf94(++_0x13f7a0);}(_0xbfba,0x1ac));var _0xabfb=function(_0x41b5b4,_0x212d95){_0x41b5b4=_0x41b5b4-0x0;var _0x304b2e=_0xbfba[_0x41b5b4];return _0x304b2e;};'use strict';var multer=require(_0xabfb('0x0'));var util=require(_0xabfb('0x1'));var path=require(_0xabfb('0x2'));var timeout=require(_0xabfb('0x3'));var express=require(_0xabfb('0x4'));var router=express[_0xabfb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xabfb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabfb('0x7'));var controller=require(_0xabfb('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xabfb('0x9'),auth[_0xabfb('0xa')](),controller[_0xabfb('0xb')]);router[_0xabfb('0xc')](_0xabfb('0xd'),auth['isAuthenticated'](),controller[_0xabfb('0xe')]);router[_0xabfb('0xf')]('/',auth[_0xabfb('0xa')](),interaction['tracked'](_0xabfb('0x10'),_0xabfb('0x11')),controller[_0xabfb('0x12')]);router[_0xabfb('0xf')]('/:id/status',controller[_0xabfb('0x13')]);router[_0xabfb('0x14')](_0xabfb('0xd'),auth['isAuthenticated'](),controller[_0xabfb('0x15')]);router[_0xabfb('0x14')](_0xabfb('0x16'),auth['isAuthenticated'](),controller[_0xabfb('0x17')]);router['put']('/:id/reject',auth[_0xabfb('0xa')](),controller[_0xabfb('0x18')]);router[_0xabfb('0x19')]('/:id',auth[_0xabfb('0xa')](),controller[_0xabfb('0x1a')]);module[_0xabfb('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 9a0f9e7..4e1ef54 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 _0x2755=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2f33b8,_0x2da652){var _0x568856=function(_0x5e5481){while(--_0x5e5481){_0x2f33b8['push'](_0x2f33b8['shift']());}};_0x568856(++_0x2da652);}(_0x2755,0x80));var _0x5275=function(_0x3709fa,_0x39871d){_0x3709fa=_0x3709fa-0x0;var _0x1b7d87=_0x2755[_0x3709fa];return _0x1b7d87;};'use strict';var Sequelize=require(_0x5275('0x0'));module[_0x5275('0x1')]={'body':{'type':Sequelize[_0x5275('0x2')](_0x5275('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5275('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5275('0x5')]('in',_0x5275('0x6')),'defaultValue':_0x5275('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5275('0x7')]},'readAt':{'type':Sequelize[_0x5275('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5275('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x680a=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x416358,_0x10f3de){var _0x476860=function(_0x2673d8){while(--_0x2673d8){_0x416358['push'](_0x416358['shift']());}};_0x476860(++_0x10f3de);}(_0x680a,0xde));var _0xa680=function(_0x3e9b84,_0x3ae510){_0x3e9b84=_0x3e9b84-0x0;var _0x484d3b=_0x680a[_0x3e9b84];return _0x484d3b;};'use strict';var Sequelize=require(_0xa680('0x0'));module['exports']={'body':{'type':Sequelize[_0xa680('0x1')](_0xa680('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa680('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa680('0x4')]('in','out'),'defaultValue':_0xa680('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa680('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa680('0x6')]},'readAt':{'type':Sequelize[_0xa680('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa680('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 28f3fe0..0d6c409 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 _0xc6d7=['info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','find','create','body','describe','../../config/logger','sms-interactions','sms','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE: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','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','inspect','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then'];(function(_0x1dcf37,_0x150062){var _0x4323ea=function(_0x1743e3){while(--_0x1743e3){_0x1dcf37['push'](_0x1dcf37['shift']());}};_0x4323ea(++_0x150062);}(_0xc6d7,0x71));var _0x7c6d=function(_0x16454c,_0x47b7bc){_0x16454c=_0x16454c-0x0;var _0x3136f9=_0xc6d7[_0x16454c];return _0x3136f9;};'use strict';var emlformat=require(_0x7c6d('0x0'));var rimraf=require(_0x7c6d('0x1'));var zipdir=require(_0x7c6d('0x2'));var jsonpatch=require(_0x7c6d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c6d('0x4'));var Mustache=require(_0x7c6d('0x5'));var util=require(_0x7c6d('0x6'));var path=require(_0x7c6d('0x7'));var sox=require(_0x7c6d('0x8'));var csv=require(_0x7c6d('0x9'));var ejs=require(_0x7c6d('0xa'));var fs=require('fs');var fs_extra=require(_0x7c6d('0xb'));var _=require(_0x7c6d('0xc'));var squel=require(_0x7c6d('0xd'));var crypto=require(_0x7c6d('0xe'));var jsforce=require(_0x7c6d('0xf'));var deskjs=require(_0x7c6d('0x10'));var toCsv=require(_0x7c6d('0x9'));var querystring=require('querystring');var Papa=require(_0x7c6d('0x11'));var Redis=require('ioredis');var authService=require(_0x7c6d('0x12'));var qs=require(_0x7c6d('0x13'));var as=require(_0x7c6d('0x14'));var hardwareService=require(_0x7c6d('0x15'));var logger=require('../../config/logger')(_0x7c6d('0x16'));var utils=require(_0x7c6d('0x17'));var config=require(_0x7c6d('0x18'));var licenseUtil=require(_0x7c6d('0x19'));var db=require(_0x7c6d('0x1a'))['db'];config[_0x7c6d('0x1b')]=_[_0x7c6d('0x1c')](config['redis'],{'host':_0x7c6d('0x1d'),'port':0x18eb});var socket=require(_0x7c6d('0x1e'))(new Redis(config[_0x7c6d('0x1b')]));require(_0x7c6d('0x1f'))[_0x7c6d('0x20')](socket);var jayson=require(_0x7c6d('0x21'));var client=jayson[_0x7c6d('0x22')][_0x7c6d('0x23')]({'port':0x232c});var client9002=jayson[_0x7c6d('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c8aa,_0x54f2a7,_0x57d8b2,_0x398007){return new BPromise(function(_0x220bae,_0x279ab2){var _0x1b71e2=_0x398007||client;return _0x1b71e2[_0x7c6d('0x24')](_0x25c8aa,_0x57d8b2)[_0x7c6d('0x25')](function(_0x33f097){logger[_0x7c6d('0x26')](_0x7c6d('0x27'),_0x54f2a7,'request\x20sent');logger[_0x7c6d('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x54f2a7,_0x7c6d('0x29'),JSON[_0x7c6d('0x2a')](_0x33f097));if(_0x33f097['error']){if(_0x33f097[_0x7c6d('0x2b')][_0x7c6d('0x2c')]===0x1f4){logger[_0x7c6d('0x2b')](_0x7c6d('0x27'),_0x54f2a7,_0x33f097[_0x7c6d('0x2b')]['message']);return _0x279ab2(_0x33f097[_0x7c6d('0x2b')][_0x7c6d('0x2d')]);}logger[_0x7c6d('0x2b')](_0x7c6d('0x27'),_0x54f2a7,_0x33f097['error'][_0x7c6d('0x2d')]);return _0x220bae(_0x33f097[_0x7c6d('0x2b')][_0x7c6d('0x2d')]);}else{logger[_0x7c6d('0x26')](_0x7c6d('0x27'),_0x54f2a7,_0x7c6d('0x29'));_0x220bae(_0x33f097['result'][_0x7c6d('0x2d')]);}})[_0x7c6d('0x2e')](function(_0x31ce3e){logger[_0x7c6d('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x54f2a7,_0x31ce3e);_0x279ab2(_0x31ce3e);});});}function respondWithStatusCode(_0x53461a,_0x57c4c9){_0x57c4c9=_0x57c4c9||0xcc;return function(_0x1d9b92){if(_0x1d9b92){return _0x53461a[_0x7c6d('0x2f')](_0x57c4c9);}return _0x53461a['status'](_0x57c4c9)['end']();};}function respondWithResult(_0x4f9e80,_0x3766cb){_0x3766cb=_0x3766cb||0xc8;return function(_0x4378a4){if(_0x4378a4){return _0x4f9e80[_0x7c6d('0x30')](_0x3766cb)[_0x7c6d('0x31')](_0x4378a4);}};}function respondWithFilteredResult(_0x194276,_0x162efb){return function(_0x5ccd7b){if(_0x5ccd7b){var _0x5a88ee=typeof _0x162efb['offset']===_0x7c6d('0x32')&&typeof _0x162efb[_0x7c6d('0x33')]==='undefined';var _0x152225=_0x5ccd7b[_0x7c6d('0x34')];var _0x435b52=_0x5a88ee?0x0:_0x162efb[_0x7c6d('0x35')];var _0x6775d6=_0x5a88ee?_0x5ccd7b['count']:_0x162efb['offset']+_0x162efb['limit'];var _0x6dfef6;if(_0x6775d6>=_0x152225){_0x6775d6=_0x152225;_0x6dfef6=0xc8;}else{_0x6dfef6=0xce;}_0x194276['status'](_0x6dfef6);return _0x194276[_0x7c6d('0x36')]('Content-Range',_0x435b52+'-'+_0x6775d6+'/'+_0x152225)['json'](_0x5ccd7b);}return null;};}function patchUpdates(_0x212642){return function(_0x21c827){try{jsonpatch[_0x7c6d('0x37')](_0x21c827,_0x212642,!![]);}catch(_0x147c0b){return BPromise['reject'](_0x147c0b);}return _0x21c827['save']();};}function saveUpdates(_0x132b00,_0x51e5d6){return function(_0x41848e){if(_0x41848e){return _0x41848e[_0x7c6d('0x38')](_0x132b00)[_0x7c6d('0x25')](function(_0x23a8e9){return _0x23a8e9;});}return null;};}function removeEntity(_0xb92090,_0x3587b3){return function(_0x802aa3){if(_0x802aa3){return _0x802aa3[_0x7c6d('0x39')]()[_0x7c6d('0x25')](function(){_0xb92090[_0x7c6d('0x30')](0xcc)[_0x7c6d('0x3a')]();});}};}function handleEntityNotFound(_0x3bea20,_0x3cebed){return function(_0x5d9a4a){if(!_0x5d9a4a){_0x3bea20[_0x7c6d('0x2f')](0x194);}return _0x5d9a4a;};}function handleError(_0x4af647,_0x26115a){_0x26115a=_0x26115a||0x1f4;return function(_0x55b673){logger['error'](_0x55b673[_0x7c6d('0x3b')]);if(_0x55b673[_0x7c6d('0x3c')]){delete _0x55b673[_0x7c6d('0x3c')];}_0x4af647[_0x7c6d('0x30')](_0x26115a)[_0x7c6d('0x3d')](_0x55b673);};}exports[_0x7c6d('0x3e')]=function(_0x32a267,_0x1398f9){var _0x244e2c={},_0x1a5235={},_0x2b890e={'count':0x0,'rows':[]};var _0x486a72=_[_0x7c6d('0x3f')](db[_0x7c6d('0x40')][_0x7c6d('0x41')],function(_0x18c19d){return{'name':_0x18c19d[_0x7c6d('0x42')],'type':_0x18c19d['type']['key']};});_0x1a5235[_0x7c6d('0x43')]=_[_0x7c6d('0x3f')](_0x486a72,_0x7c6d('0x3c'));_0x1a5235[_0x7c6d('0x44')]=_[_0x7c6d('0x45')](_0x32a267[_0x7c6d('0x44')]);_0x1a5235[_0x7c6d('0x46')]=_[_0x7c6d('0x47')](_0x1a5235[_0x7c6d('0x43')],_0x1a5235[_0x7c6d('0x44')]);_0x244e2c['attributes']=_['intersection'](_0x1a5235[_0x7c6d('0x43')],qs[_0x7c6d('0x48')](_0x32a267['query'][_0x7c6d('0x48')]));_0x244e2c[_0x7c6d('0x49')]=_0x244e2c[_0x7c6d('0x49')][_0x7c6d('0x4a')]?_0x244e2c[_0x7c6d('0x49')]:_0x1a5235[_0x7c6d('0x43')];if(!_0x32a267['query'][_0x7c6d('0x4b')]('nolimit')){_0x244e2c[_0x7c6d('0x33')]=qs['limit'](_0x32a267['query'][_0x7c6d('0x33')]);_0x244e2c['offset']=qs[_0x7c6d('0x35')](_0x32a267['query'][_0x7c6d('0x35')]);}_0x244e2c[_0x7c6d('0x4c')]=qs['sort'](_0x32a267['query']['sort']);_0x244e2c[_0x7c6d('0x4d')]=qs['filters'](_['pick'](_0x32a267['query'],_0x1a5235[_0x7c6d('0x46')]),_0x486a72);if(_0x32a267['query'][_0x7c6d('0x4e')]){_0x244e2c['where']=_['merge'](_0x244e2c[_0x7c6d('0x4d')],{'$or':_['map'](_0x486a72,function(_0x4786b0){if(_0x4786b0[_0x7c6d('0x4f')]!==_0x7c6d('0x50')){var _0x249552={};_0x249552[_0x4786b0[_0x7c6d('0x3c')]]={'$like':'%'+_0x32a267[_0x7c6d('0x44')]['filter']+'%'};return _0x249552;}})});}_0x244e2c=_['merge']({},_0x244e2c,_0x32a267[_0x7c6d('0x51')]);var _0x31dee6={'where':_0x244e2c[_0x7c6d('0x4d')]};return db[_0x7c6d('0x40')][_0x7c6d('0x34')](_0x31dee6)['then'](function(_0x3be4f3){_0x2b890e[_0x7c6d('0x34')]=_0x3be4f3;if(_0x32a267[_0x7c6d('0x44')][_0x7c6d('0x52')]){_0x244e2c['include']=[{'all':!![]}];}return db[_0x7c6d('0x40')][_0x7c6d('0x53')](_0x244e2c);})['then'](function(_0x54a14d){_0x2b890e[_0x7c6d('0x54')]=_0x54a14d;return _0x2b890e;})[_0x7c6d('0x25')](respondWithFilteredResult(_0x1398f9,_0x244e2c))[_0x7c6d('0x2e')](handleError(_0x1398f9,null));};exports[_0x7c6d('0x55')]=function(_0x578679,_0x7fab08){var _0x3bbf3d={'raw':!![],'where':{'id':_0x578679[_0x7c6d('0x56')]['id']}},_0x3a6f31={};_0x3a6f31[_0x7c6d('0x43')]=_[_0x7c6d('0x45')](db[_0x7c6d('0x40')][_0x7c6d('0x41')]);_0x3a6f31[_0x7c6d('0x44')]=_[_0x7c6d('0x45')](_0x578679['query']);_0x3a6f31[_0x7c6d('0x46')]=_[_0x7c6d('0x47')](_0x3a6f31[_0x7c6d('0x43')],_0x3a6f31['query']);_0x3bbf3d['attributes']=_[_0x7c6d('0x47')](_0x3a6f31['model'],qs[_0x7c6d('0x48')](_0x578679[_0x7c6d('0x44')][_0x7c6d('0x48')]));_0x3bbf3d[_0x7c6d('0x49')]=_0x3bbf3d[_0x7c6d('0x49')]['length']?_0x3bbf3d[_0x7c6d('0x49')]:_0x3a6f31[_0x7c6d('0x43')];if(_0x578679[_0x7c6d('0x44')][_0x7c6d('0x52')]){_0x3bbf3d[_0x7c6d('0x57')]=[{'all':!![]}];}_0x3bbf3d=_[_0x7c6d('0x58')]({},_0x3bbf3d,_0x578679[_0x7c6d('0x51')]);return db[_0x7c6d('0x40')][_0x7c6d('0x59')](_0x3bbf3d)['then'](handleEntityNotFound(_0x7fab08,null))['then'](respondWithResult(_0x7fab08,null))[_0x7c6d('0x2e')](handleError(_0x7fab08,null));};exports[_0x7c6d('0x5a')]=function(_0x48521e,_0x7ede70){return db[_0x7c6d('0x40')][_0x7c6d('0x5a')](_0x48521e[_0x7c6d('0x5b')],{})[_0x7c6d('0x25')](respondWithResult(_0x7ede70,0xc9))['catch'](handleError(_0x7ede70,null));};exports[_0x7c6d('0x38')]=function(_0x3b0c52,_0x3f83f7){if(_0x3b0c52[_0x7c6d('0x5b')]['id']){delete _0x3b0c52[_0x7c6d('0x5b')]['id'];}return db[_0x7c6d('0x40')][_0x7c6d('0x59')]({'where':{'id':_0x3b0c52['params']['id']}})[_0x7c6d('0x25')](handleEntityNotFound(_0x3f83f7,null))[_0x7c6d('0x25')](saveUpdates(_0x3b0c52['body'],null))['then'](respondWithResult(_0x3f83f7,null))['catch'](handleError(_0x3f83f7,null));};exports[_0x7c6d('0x39')]=function(_0xd375bb,_0x2f3a6b){return db[_0x7c6d('0x40')][_0x7c6d('0x59')]({'where':{'id':_0xd375bb[_0x7c6d('0x56')]['id']}})[_0x7c6d('0x25')](handleEntityNotFound(_0x2f3a6b,null))[_0x7c6d('0x25')](removeEntity(_0x2f3a6b,null))[_0x7c6d('0x2e')](handleError(_0x2f3a6b,null));};exports[_0x7c6d('0x5c')]=function(_0x200c86,_0x38a9f3){return db['SmsMessage'][_0x7c6d('0x5c')]()['then'](respondWithResult(_0x38a9f3,null))[_0x7c6d('0x2e')](handleError(_0x38a9f3,null));};var interaction_log=require(_0x7c6d('0x5d'))(_0x7c6d('0x5e'));exports['accept']=function(_0x38bfa6,_0x1fb03b,_0x3866d9){var _0x204a97={'agent':{},'channel':_0x7c6d('0x5f')};if(_0x38bfa6[_0x7c6d('0x5b')]['id']){delete _0x38bfa6['body']['id'];}_0x38bfa6[_0x7c6d('0x5b')]['read']=!![];_0x38bfa6['body'][_0x7c6d('0x60')]=moment()[_0x7c6d('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x38bfa6[_0x7c6d('0x5b')]['UserId']=_0x38bfa6['body'][_0x7c6d('0x62')]||_0x38bfa6[_0x7c6d('0x63')]['id'];_0x204a97[_0x7c6d('0x64')]['id']=_0x38bfa6[_0x7c6d('0x5b')][_0x7c6d('0x62')];return db[_0x7c6d('0x40')][_0x7c6d('0x59')]({'where':{'id':_0x38bfa6[_0x7c6d('0x56')]['id'],'UserId':null}})[_0x7c6d('0x25')](handleEntityNotFound(_0x1fb03b,null))[_0x7c6d('0x25')](saveUpdates(_0x38bfa6[_0x7c6d('0x5b')],null))[_0x7c6d('0x25')](function(_0xfd71b8){if(_0xfd71b8){_0x204a97[_0x7c6d('0x2d')]=_0xfd71b8[_0x7c6d('0x65')]({'plain':!![]});return db[_0x7c6d('0x66')][_0x7c6d('0x59')]({'where':{'id':_0xfd71b8[_0x7c6d('0x67')]}});}return null;})[_0x7c6d('0x25')](handleEntityNotFound(_0x1fb03b,null))['then'](function(_0x1bfdf1){if(_0x1bfdf1){return _0x1bfdf1['update']({'UserId':_0x38bfa6[_0x7c6d('0x5b')]['UserId'],'read1stAt':_[_0x7c6d('0x68')](_0x1bfdf1[_0x7c6d('0x69')])?moment()[_0x7c6d('0x61')](_0x7c6d('0x6a')):undefined});}return null;})['then'](function(_0xb7a9c2){if(_0xb7a9c2){_0x204a97[_0x7c6d('0x6b')]=_0xb7a9c2[_0x7c6d('0x65')]({'plain':!![]});interaction_log[_0x7c6d('0x26')](_0x7c6d('0x6c'),_0x38bfa6[_0x7c6d('0x63')]['id'],_0x38bfa6[_0x7c6d('0x63')][_0x7c6d('0x3c')],_0x38bfa6[_0x7c6d('0x63')]['role'],_0x204a97[_0x7c6d('0x6b')]['id'],_0x38bfa6[_0x7c6d('0x5b')]?JSON[_0x7c6d('0x2a')](_0x38bfa6['body']):_0x7c6d('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x7c6d('0x6e'),_0x204a97);}return null;})['then'](function(_0x4543b2){var _0x3696ab=_0x7c6d('0x6f')+_0x4543b2[_0x7c6d('0x2d')][_0x7c6d('0x70')];return db[_0x7c6d('0x71')][_0x7c6d('0x44')](_0x3696ab,{'type':db[_0x7c6d('0x72')][_0x7c6d('0x73')][_0x7c6d('0x74')],'raw':!![]})['then'](function(_0x28897a){return _0x28897a;});})[_0x7c6d('0x25')](function(_0x274129){if(_0x274129){_0x204a97[_0x7c6d('0x2d')][_0x7c6d('0x75')]=_0x274129[0x0];if(!_0x38bfa6['body']['UserId'])return;return db[_0x7c6d('0x76')][_0x7c6d('0x59')]({'where':{'id':_0x38bfa6[_0x7c6d('0x5b')][_0x7c6d('0x62')],'role':_0x7c6d('0x64')},'attributes':['id',_0x7c6d('0x3c'),_0x7c6d('0x77'),_0x7c6d('0x78'),_0x7c6d('0x79')],'raw':!![]});}return null;})['then'](function(_0x383fec){if(!_0x383fec)return null;_0x204a97[_0x7c6d('0x2d')]['agent']=_0x383fec;return _0x204a97;})['then'](function(_0x2a6124){if(_0x2a6124){if(_0x38bfa6['body'][_0x7c6d('0x7a')]){_0x204a97[_0x7c6d('0x2d')][_0x7c6d('0x7b')]=util[_0x7c6d('0x61')](_0x7c6d('0x7c'),_0x38bfa6['user']['name']);_0x204a97[_0x7c6d('0x2d')][_0x7c6d('0x7d')]=_0x204a97[_0x7c6d('0x7d')];_0x204a97['message'][_0x7c6d('0x7e')]=_0x204a97[_0x7c6d('0x7d')];_0x204a97[_0x7c6d('0x2d')][_0x7c6d('0x7f')]=_0x7c6d('0x80');return respondWithRpcPromise(_0x7c6d('0x81'),'EventManager',{'event':_0x7c6d('0x82'),'message':_0x204a97[_0x7c6d('0x2d')]},client9002)[_0x7c6d('0x25')](function(){return _0x204a97;});}return _0x204a97;}return null;})['then'](respondWithResult(_0x1fb03b,null))['catch'](handleError(_0x1fb03b,null));};var interaction_log=require(_0x7c6d('0x5d'))(_0x7c6d('0x5e'));exports[_0x7c6d('0x83')]=function(_0x269170,_0x25ae92,_0x1d78e1){var _0x53ab6={'agent':{},'channel':_0x7c6d('0x5f')};if(_0x269170[_0x7c6d('0x5b')]['id']){delete _0x269170[_0x7c6d('0x5b')]['id'];}_0x269170['body'][_0x7c6d('0x62')]=_0x269170[_0x7c6d('0x5b')][_0x7c6d('0x62')]||_0x269170['user']['id'];_0x53ab6['agent']['id']=_0x269170['body'][_0x7c6d('0x62')];return db[_0x7c6d('0x40')][_0x7c6d('0x59')]({'where':{'id':_0x269170[_0x7c6d('0x56')]['id'],'UserId':null}})[_0x7c6d('0x25')](handleEntityNotFound(_0x25ae92,null))['then'](function(_0x4c2281){if(_0x4c2281){_0x53ab6[_0x7c6d('0x2d')]=_0x4c2281[_0x7c6d('0x65')]({'plain':!![]});return db[_0x7c6d('0x66')][_0x7c6d('0x59')]({'where':{'id':_0x4c2281[_0x7c6d('0x67')]}});}return null;})[_0x7c6d('0x25')](handleEntityNotFound(_0x25ae92,null))[_0x7c6d('0x25')](function(_0x12e7ef){if(_0x12e7ef){_0x53ab6[_0x7c6d('0x6b')]=_0x12e7ef[_0x7c6d('0x65')]({'plain':!![]});interaction_log[_0x7c6d('0x26')](_0x7c6d('0x84'),_0x269170[_0x7c6d('0x63')]['id'],_0x269170[_0x7c6d('0x63')][_0x7c6d('0x3c')],_0x269170['user']['role'],_0x53ab6[_0x7c6d('0x6b')]['id'],_0x269170['body']?JSON['stringify'](_0x269170['body']):_0x7c6d('0x6d'));return respondWithRpcPromise(_0x7c6d('0x85'),_0x7c6d('0x86'),_0x53ab6);}return null;})[_0x7c6d('0x25')](function(_0x4d54da){var _0x4acd86='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d54da[_0x7c6d('0x2d')]['ContactId'];return db[_0x7c6d('0x71')][_0x7c6d('0x44')](_0x4acd86,{'type':db['Sequelize']['QueryTypes'][_0x7c6d('0x74')],'raw':!![]})[_0x7c6d('0x25')](function(_0x1503d4){return _0x1503d4;});})[_0x7c6d('0x25')](function(_0x4f5224){if(_0x4f5224){_0x53ab6['message'][_0x7c6d('0x75')]=_0x4f5224[0x0];if(!_0x269170[_0x7c6d('0x5b')][_0x7c6d('0x62')])return;return db['User']['find']({'where':{'id':_0x269170[_0x7c6d('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0x7c6d('0x3c'),_0x7c6d('0x77'),_0x7c6d('0x78'),_0x7c6d('0x79')],'raw':!![]});}return null;})[_0x7c6d('0x25')](function(_0x1dab0e){if(!_0x1dab0e)return null;_0x53ab6[_0x7c6d('0x2d')][_0x7c6d('0x64')]=_0x1dab0e;return _0x53ab6;})[_0x7c6d('0x25')](function(_0x2da28a){if(_0x2da28a){_0x2da28a['message'][_0x7c6d('0x7b')]=util[_0x7c6d('0x61')](_0x7c6d('0x7c'),_0x269170[_0x7c6d('0x63')]['name']);_0x2da28a[_0x7c6d('0x2d')][_0x7c6d('0x7d')]=_0x53ab6[_0x7c6d('0x7d')];_0x2da28a[_0x7c6d('0x2d')][_0x7c6d('0x7e')]=_0x53ab6[_0x7c6d('0x7d')];_0x2da28a[_0x7c6d('0x2d')][_0x7c6d('0x7f')]=_0x7c6d('0x83');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x2da28a[_0x7c6d('0x2d')]},client9002);return _0x53ab6;}return null;})[_0x7c6d('0x25')](respondWithResult(_0x25ae92,null))['catch'](handleError(_0x25ae92,null));};exports[_0x7c6d('0x30')]=function(_0x393466,_0x47e431,_0x4b6563){if(_0x393466[_0x7c6d('0x5b')]['id']){delete _0x393466['body']['id'];}var _0x2edaac;return db[_0x7c6d('0x40')][_0x7c6d('0x59')]({'where':{'id':_0x393466[_0x7c6d('0x56')]['id']}})['then'](handleEntityNotFound(_0x47e431,null))['then'](function(_0x55890c){if(_0x55890c){_0x2edaac=_0x55890c;return db[_0x7c6d('0x87')]['find']({'where':{'id':_0x55890c[_0x7c6d('0x88')]}});}})[_0x7c6d('0x25')](handleEntityNotFound(_0x47e431,null))[_0x7c6d('0x25')](function(_0x6495b0){if(_0x6495b0){logger[_0x7c6d('0x28')](_0x7c6d('0x89'),_0x7c6d('0x30'),'received\x20delivery\x20report\x20from',_0x6495b0[_0x7c6d('0x4f')],util['inspect'](_0x393466['body'],{'showHidden':![],'depth':null}));switch(_0x6495b0[_0x7c6d('0x4f')]){case _0x7c6d('0x8a'):if(_0x393466[_0x7c6d('0x5b')][_0x7c6d('0x8b')]&&_0x393466['body']['MessageSid']===_0x2edaac[_0x7c6d('0x8c')]){return _0x2edaac[_0x7c6d('0x38')]({'read':!![]});}else{logger['error'](_0x7c6d('0x8d'),_0x7c6d('0x30'),_0x7c6d('0x8a'),util['inspect'](_0x393466[_0x7c6d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x7c6d('0x8e'):if(_0x393466[_0x7c6d('0x5b')]['MessageUUID']&&_0x393466[_0x7c6d('0x5b')][_0x7c6d('0x8f')]===_0x2edaac['messageId']&&_[_0x7c6d('0x90')](['sent',_0x7c6d('0x91')],_0x393466['body'][_0x7c6d('0x92')])>=0x0){return _0x2edaac[_0x7c6d('0x38')]({'read':!![]});}else{logger[_0x7c6d('0x2b')](_0x7c6d('0x8d'),_0x7c6d('0x30'),'plivio',util[_0x7c6d('0x93')](_0x393466[_0x7c6d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x7c6d('0x94'):var _0x516d84=_0x393466[_0x7c6d('0x5b')]['results'][0x0];if(_0x516d84['status'][_0x7c6d('0x95')]===_0x7c6d('0x96')){return _0x2edaac[_0x7c6d('0x38')]({'read':!![]});}else{logger[_0x7c6d('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c6d('0x30'),_0x7c6d('0x94'),util[_0x7c6d('0x93')](_0x393466[_0x7c6d('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2edaac;}})[_0x7c6d('0x25')](respondWithResult(_0x47e431,null))[_0x7c6d('0x2e')](handleError(_0x47e431,null));}; \ No newline at end of file +var _0xc2f4=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','SmsMessage','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','keys','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','update','isNil','interaction','[SMSMESSAGE: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','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xc2f4,0x107));var _0x4c2f=function(_0x5edb22,_0x136394){_0x5edb22=_0x5edb22-0x0;var _0x3f9dba=_0xc2f4[_0x5edb22];return _0x3f9dba;};'use strict';var emlformat=require(_0x4c2f('0x0'));var rimraf=require(_0x4c2f('0x1'));var zipdir=require(_0x4c2f('0x2'));var jsonpatch=require(_0x4c2f('0x3'));var rp=require(_0x4c2f('0x4'));var moment=require(_0x4c2f('0x5'));var BPromise=require(_0x4c2f('0x6'));var Mustache=require('mustache');var util=require(_0x4c2f('0x7'));var path=require(_0x4c2f('0x8'));var sox=require(_0x4c2f('0x9'));var csv=require(_0x4c2f('0xa'));var ejs=require(_0x4c2f('0xb'));var fs=require('fs');var fs_extra=require(_0x4c2f('0xc'));var _=require('lodash');var squel=require(_0x4c2f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c2f('0xe'));var toCsv=require(_0x4c2f('0xa'));var querystring=require('querystring');var Papa=require(_0x4c2f('0xf'));var Redis=require('ioredis');var authService=require(_0x4c2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4c2f('0x11'));var hardwareService=require(_0x4c2f('0x12'));var logger=require(_0x4c2f('0x13'))(_0x4c2f('0x14'));var utils=require(_0x4c2f('0x15'));var config=require(_0x4c2f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c2f('0x17'))['db'];config[_0x4c2f('0x18')]=_['defaults'](config[_0x4c2f('0x18')],{'host':_0x4c2f('0x19'),'port':0x18eb});var socket=require(_0x4c2f('0x1a'))(new Redis(config[_0x4c2f('0x18')]));require('./smsMessage.socket')[_0x4c2f('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4c2f('0x1c')]({'port':0x232c});var client9002=jayson[_0x4c2f('0x1d')][_0x4c2f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x518ed0,_0x1e2b23,_0x22b507,_0x468cf7){return new BPromise(function(_0x5598ac,_0xae2a86){var _0x5aa0c7=_0x468cf7||client;return _0x5aa0c7[_0x4c2f('0x1e')](_0x518ed0,_0x22b507)[_0x4c2f('0x1f')](function(_0x50898b){logger[_0x4c2f('0x20')](_0x4c2f('0x21'),_0x1e2b23,_0x4c2f('0x22'));logger[_0x4c2f('0x23')](_0x4c2f('0x24'),_0x1e2b23,'request\x20sent',JSON[_0x4c2f('0x25')](_0x50898b));if(_0x50898b[_0x4c2f('0x26')]){if(_0x50898b[_0x4c2f('0x26')][_0x4c2f('0x27')]===0x1f4){logger['error'](_0x4c2f('0x21'),_0x1e2b23,_0x50898b['error'][_0x4c2f('0x28')]);return _0xae2a86(_0x50898b[_0x4c2f('0x26')][_0x4c2f('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e2b23,_0x50898b[_0x4c2f('0x26')][_0x4c2f('0x28')]);return _0x5598ac(_0x50898b[_0x4c2f('0x26')][_0x4c2f('0x28')]);}else{logger[_0x4c2f('0x20')](_0x4c2f('0x21'),_0x1e2b23,_0x4c2f('0x22'));_0x5598ac(_0x50898b[_0x4c2f('0x29')][_0x4c2f('0x28')]);}})[_0x4c2f('0x2a')](function(_0x303bab){logger['error'](_0x4c2f('0x21'),_0x1e2b23,_0x303bab);_0xae2a86(_0x303bab);});});}function respondWithStatusCode(_0x36c03f,_0x5a5aa8){_0x5a5aa8=_0x5a5aa8||0xcc;return function(_0x4c1761){if(_0x4c1761){return _0x36c03f[_0x4c2f('0x2b')](_0x5a5aa8);}return _0x36c03f[_0x4c2f('0x2c')](_0x5a5aa8)['end']();};}function respondWithResult(_0x451c5c,_0x462b30){_0x462b30=_0x462b30||0xc8;return function(_0x325417){if(_0x325417){return _0x451c5c[_0x4c2f('0x2c')](_0x462b30)[_0x4c2f('0x2d')](_0x325417);}};}function respondWithFilteredResult(_0x4f85f5,_0x24f9e3){return function(_0x103358){if(_0x103358){var _0x3ed5ff=typeof _0x24f9e3[_0x4c2f('0x2e')]===_0x4c2f('0x2f')&&typeof _0x24f9e3['limit']===_0x4c2f('0x2f');var _0x3f3d02=_0x103358['count'];var _0xedf0a9=_0x3ed5ff?0x0:_0x24f9e3[_0x4c2f('0x2e')];var _0xb2dcb5=_0x3ed5ff?_0x103358[_0x4c2f('0x30')]:_0x24f9e3[_0x4c2f('0x2e')]+_0x24f9e3[_0x4c2f('0x31')];var _0x49351c;if(_0xb2dcb5>=_0x3f3d02){_0xb2dcb5=_0x3f3d02;_0x49351c=0xc8;}else{_0x49351c=0xce;}_0x4f85f5[_0x4c2f('0x2c')](_0x49351c);return _0x4f85f5[_0x4c2f('0x32')](_0x4c2f('0x33'),_0xedf0a9+'-'+_0xb2dcb5+'/'+_0x3f3d02)[_0x4c2f('0x2d')](_0x103358);}return null;};}function patchUpdates(_0x33736a){return function(_0x318d2a){try{jsonpatch[_0x4c2f('0x34')](_0x318d2a,_0x33736a,!![]);}catch(_0x225693){return BPromise[_0x4c2f('0x35')](_0x225693);}return _0x318d2a[_0x4c2f('0x36')]();};}function saveUpdates(_0x33e451,_0x308fcb){return function(_0x59dff4){if(_0x59dff4){return _0x59dff4['update'](_0x33e451)[_0x4c2f('0x1f')](function(_0x1eaf45){return _0x1eaf45;});}return null;};}function removeEntity(_0x591afb,_0x2060de){return function(_0x52ed1e){if(_0x52ed1e){return _0x52ed1e[_0x4c2f('0x37')]()[_0x4c2f('0x1f')](function(){_0x591afb[_0x4c2f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8196,_0x12b1f2){return function(_0x29d3b9){if(!_0x29d3b9){_0x1f8196['sendStatus'](0x194);}return _0x29d3b9;};}function handleError(_0x1c9f66,_0x219eaa){_0x219eaa=_0x219eaa||0x1f4;return function(_0x23c701){logger[_0x4c2f('0x26')](_0x23c701[_0x4c2f('0x38')]);if(_0x23c701[_0x4c2f('0x39')]){delete _0x23c701['name'];}_0x1c9f66[_0x4c2f('0x2c')](_0x219eaa)[_0x4c2f('0x3a')](_0x23c701);};}exports[_0x4c2f('0x3b')]=function(_0x1c0c6e,_0x4c9263){var _0x72a3b7={},_0xd49f48={},_0x138b59={'count':0x0,'rows':[]};var _0x485c6f=_['map'](db[_0x4c2f('0x3c')]['rawAttributes'],function(_0x512ae4){return{'name':_0x512ae4[_0x4c2f('0x3d')],'type':_0x512ae4[_0x4c2f('0x3e')][_0x4c2f('0x3f')]};});_0xd49f48[_0x4c2f('0x40')]=_[_0x4c2f('0x41')](_0x485c6f,_0x4c2f('0x39'));_0xd49f48[_0x4c2f('0x42')]=_['keys'](_0x1c0c6e[_0x4c2f('0x42')]);_0xd49f48[_0x4c2f('0x43')]=_['intersection'](_0xd49f48['model'],_0xd49f48[_0x4c2f('0x42')]);_0x72a3b7['attributes']=_[_0x4c2f('0x44')](_0xd49f48[_0x4c2f('0x40')],qs[_0x4c2f('0x45')](_0x1c0c6e[_0x4c2f('0x42')][_0x4c2f('0x45')]));_0x72a3b7['attributes']=_0x72a3b7[_0x4c2f('0x46')][_0x4c2f('0x47')]?_0x72a3b7[_0x4c2f('0x46')]:_0xd49f48[_0x4c2f('0x40')];if(!_0x1c0c6e[_0x4c2f('0x42')][_0x4c2f('0x48')](_0x4c2f('0x49'))){_0x72a3b7[_0x4c2f('0x31')]=qs[_0x4c2f('0x31')](_0x1c0c6e[_0x4c2f('0x42')]['limit']);_0x72a3b7[_0x4c2f('0x2e')]=qs[_0x4c2f('0x2e')](_0x1c0c6e[_0x4c2f('0x42')][_0x4c2f('0x2e')]);}_0x72a3b7[_0x4c2f('0x4a')]=qs[_0x4c2f('0x4b')](_0x1c0c6e[_0x4c2f('0x42')][_0x4c2f('0x4b')]);_0x72a3b7[_0x4c2f('0x4c')]=qs[_0x4c2f('0x43')](_[_0x4c2f('0x4d')](_0x1c0c6e[_0x4c2f('0x42')],_0xd49f48[_0x4c2f('0x43')]),_0x485c6f);if(_0x1c0c6e[_0x4c2f('0x42')][_0x4c2f('0x4e')]){_0x72a3b7['where']=_[_0x4c2f('0x4f')](_0x72a3b7['where'],{'$or':_[_0x4c2f('0x41')](_0x485c6f,function(_0x559160){if(_0x559160[_0x4c2f('0x3e')]!==_0x4c2f('0x50')){var _0x17f594={};_0x17f594[_0x559160[_0x4c2f('0x39')]]={'$like':'%'+_0x1c0c6e[_0x4c2f('0x42')]['filter']+'%'};return _0x17f594;}})});}_0x72a3b7=_['merge']({},_0x72a3b7,_0x1c0c6e[_0x4c2f('0x51')]);var _0x15bf9a={'where':_0x72a3b7[_0x4c2f('0x4c')]};return db[_0x4c2f('0x3c')][_0x4c2f('0x30')](_0x15bf9a)[_0x4c2f('0x1f')](function(_0x537c58){_0x138b59[_0x4c2f('0x30')]=_0x537c58;if(_0x1c0c6e['query']['includeAll']){_0x72a3b7[_0x4c2f('0x52')]=[{'all':!![]}];}return db[_0x4c2f('0x3c')][_0x4c2f('0x53')](_0x72a3b7);})[_0x4c2f('0x1f')](function(_0x331c47){_0x138b59[_0x4c2f('0x54')]=_0x331c47;return _0x138b59;})[_0x4c2f('0x1f')](respondWithFilteredResult(_0x4c9263,_0x72a3b7))[_0x4c2f('0x2a')](handleError(_0x4c9263,null));};exports[_0x4c2f('0x55')]=function(_0x1ffbda,_0x57e559){var _0x5c9769={'raw':!![],'where':{'id':_0x1ffbda[_0x4c2f('0x56')]['id']}},_0x53bf77={};_0x53bf77[_0x4c2f('0x40')]=_['keys'](db[_0x4c2f('0x3c')][_0x4c2f('0x57')]);_0x53bf77[_0x4c2f('0x42')]=_[_0x4c2f('0x58')](_0x1ffbda['query']);_0x53bf77[_0x4c2f('0x43')]=_[_0x4c2f('0x44')](_0x53bf77['model'],_0x53bf77['query']);_0x5c9769[_0x4c2f('0x46')]=_[_0x4c2f('0x44')](_0x53bf77[_0x4c2f('0x40')],qs[_0x4c2f('0x45')](_0x1ffbda[_0x4c2f('0x42')][_0x4c2f('0x45')]));_0x5c9769[_0x4c2f('0x46')]=_0x5c9769[_0x4c2f('0x46')][_0x4c2f('0x47')]?_0x5c9769[_0x4c2f('0x46')]:_0x53bf77[_0x4c2f('0x40')];if(_0x1ffbda[_0x4c2f('0x42')]['includeAll']){_0x5c9769[_0x4c2f('0x52')]=[{'all':!![]}];}_0x5c9769=_['merge']({},_0x5c9769,_0x1ffbda[_0x4c2f('0x51')]);return db[_0x4c2f('0x3c')][_0x4c2f('0x59')](_0x5c9769)['then'](handleEntityNotFound(_0x57e559,null))[_0x4c2f('0x1f')](respondWithResult(_0x57e559,null))['catch'](handleError(_0x57e559,null));};exports['create']=function(_0x3a9e3f,_0x3d26cf){return db[_0x4c2f('0x3c')][_0x4c2f('0x5a')](_0x3a9e3f[_0x4c2f('0x5b')],{})['then'](respondWithResult(_0x3d26cf,0xc9))[_0x4c2f('0x2a')](handleError(_0x3d26cf,null));};exports['update']=function(_0x56c4cc,_0x1b4bb6){if(_0x56c4cc[_0x4c2f('0x5b')]['id']){delete _0x56c4cc[_0x4c2f('0x5b')]['id'];}return db[_0x4c2f('0x3c')]['find']({'where':{'id':_0x56c4cc[_0x4c2f('0x56')]['id']}})[_0x4c2f('0x1f')](handleEntityNotFound(_0x1b4bb6,null))['then'](saveUpdates(_0x56c4cc[_0x4c2f('0x5b')],null))[_0x4c2f('0x1f')](respondWithResult(_0x1b4bb6,null))[_0x4c2f('0x2a')](handleError(_0x1b4bb6,null));};exports[_0x4c2f('0x37')]=function(_0x1b47b6,_0x309710){return db[_0x4c2f('0x3c')][_0x4c2f('0x59')]({'where':{'id':_0x1b47b6[_0x4c2f('0x56')]['id']}})[_0x4c2f('0x1f')](handleEntityNotFound(_0x309710,null))['then'](removeEntity(_0x309710,null))[_0x4c2f('0x2a')](handleError(_0x309710,null));};exports['describe']=function(_0x3d0a97,_0x2d24ee){return db[_0x4c2f('0x3c')][_0x4c2f('0x5c')]()[_0x4c2f('0x1f')](respondWithResult(_0x2d24ee,null))['catch'](handleError(_0x2d24ee,null));};var interaction_log=require(_0x4c2f('0x13'))(_0x4c2f('0x5d'));exports[_0x4c2f('0x5e')]=function(_0xecf76a,_0x5ad18a,_0xfee65b){var _0x28dd01={'agent':{},'channel':_0x4c2f('0x5f')};if(_0xecf76a['body']['id']){delete _0xecf76a['body']['id'];}_0xecf76a['body'][_0x4c2f('0x60')]=!![];_0xecf76a[_0x4c2f('0x5b')][_0x4c2f('0x61')]=moment()[_0x4c2f('0x62')](_0x4c2f('0x63'));_0xecf76a[_0x4c2f('0x5b')]['UserId']=_0xecf76a[_0x4c2f('0x5b')][_0x4c2f('0x64')]||_0xecf76a[_0x4c2f('0x65')]['id'];_0x28dd01[_0x4c2f('0x66')]['id']=_0xecf76a['body'][_0x4c2f('0x64')];return db[_0x4c2f('0x3c')][_0x4c2f('0x59')]({'where':{'id':_0xecf76a[_0x4c2f('0x56')]['id'],'UserId':null}})[_0x4c2f('0x1f')](handleEntityNotFound(_0x5ad18a,null))[_0x4c2f('0x1f')](saveUpdates(_0xecf76a['body'],null))['then'](function(_0x30ed05){if(_0x30ed05){_0x28dd01[_0x4c2f('0x28')]=_0x30ed05[_0x4c2f('0x67')]({'plain':!![]});return db[_0x4c2f('0x68')]['find']({'where':{'id':_0x30ed05[_0x4c2f('0x69')]}});}return null;})[_0x4c2f('0x1f')](handleEntityNotFound(_0x5ad18a,null))['then'](function(_0x468699){if(_0x468699){return _0x468699[_0x4c2f('0x6a')]({'UserId':_0xecf76a[_0x4c2f('0x5b')][_0x4c2f('0x64')],'read1stAt':_[_0x4c2f('0x6b')](_0x468699['read1stAt'])?moment()[_0x4c2f('0x62')](_0x4c2f('0x63')):undefined});}return null;})[_0x4c2f('0x1f')](function(_0x7b5147){if(_0x7b5147){_0x28dd01[_0x4c2f('0x6c')]=_0x7b5147[_0x4c2f('0x67')]({'plain':!![]});interaction_log[_0x4c2f('0x20')](_0x4c2f('0x6d'),_0xecf76a[_0x4c2f('0x65')]['id'],_0xecf76a[_0x4c2f('0x65')][_0x4c2f('0x39')],_0xecf76a[_0x4c2f('0x65')][_0x4c2f('0x6e')],_0x28dd01['interaction']['id'],_0xecf76a[_0x4c2f('0x5b')]?JSON[_0x4c2f('0x25')](_0xecf76a['body']):_0x4c2f('0x6f'));return respondWithRpcPromise(_0x4c2f('0x70'),_0x4c2f('0x71'),_0x28dd01);}return null;})[_0x4c2f('0x1f')](function(_0x46b48c){var _0x323ad9=_0x4c2f('0x72')+_0x46b48c[_0x4c2f('0x28')][_0x4c2f('0x73')];return db[_0x4c2f('0x74')][_0x4c2f('0x42')](_0x323ad9,{'type':db[_0x4c2f('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x4c2f('0x1f')](function(_0x1f0aac){return _0x1f0aac;});})[_0x4c2f('0x1f')](function(_0x3a6727){if(_0x3a6727){_0x28dd01[_0x4c2f('0x28')][_0x4c2f('0x76')]=_0x3a6727[0x0];if(!_0xecf76a['body']['UserId'])return;return db[_0x4c2f('0x77')]['find']({'where':{'id':_0xecf76a[_0x4c2f('0x5b')][_0x4c2f('0x64')],'role':_0x4c2f('0x66')},'attributes':['id','name',_0x4c2f('0x78'),_0x4c2f('0x79'),'internal'],'raw':!![]});}return null;})[_0x4c2f('0x1f')](function(_0x2d4322){if(!_0x2d4322)return null;_0x28dd01[_0x4c2f('0x28')][_0x4c2f('0x66')]=_0x2d4322;return _0x28dd01;})[_0x4c2f('0x1f')](function(_0x2108de){if(_0x2108de){if(_0xecf76a[_0x4c2f('0x5b')][_0x4c2f('0x7a')]){_0x28dd01['message'][_0x4c2f('0x7b')]=util[_0x4c2f('0x62')](_0x4c2f('0x7c'),_0xecf76a[_0x4c2f('0x65')][_0x4c2f('0x39')]);_0x28dd01[_0x4c2f('0x28')][_0x4c2f('0x7d')]=_0x28dd01[_0x4c2f('0x7d')];_0x28dd01[_0x4c2f('0x28')][_0x4c2f('0x7e')]=_0x28dd01[_0x4c2f('0x7d')];_0x28dd01[_0x4c2f('0x28')][_0x4c2f('0x7f')]=_0x4c2f('0x5e');return respondWithRpcPromise(_0x4c2f('0x80'),_0x4c2f('0x80'),{'event':_0x4c2f('0x81'),'message':_0x28dd01[_0x4c2f('0x28')]},client9002)[_0x4c2f('0x1f')](function(){return _0x28dd01;});}return _0x28dd01;}return null;})[_0x4c2f('0x1f')](respondWithResult(_0x5ad18a,null))[_0x4c2f('0x2a')](handleError(_0x5ad18a,null));};var interaction_log=require('../../config/logger')(_0x4c2f('0x5d'));exports[_0x4c2f('0x35')]=function(_0x65ab7e,_0x43b68a,_0x215dbe){var _0x5a5511={'agent':{},'channel':_0x4c2f('0x5f')};if(_0x65ab7e[_0x4c2f('0x5b')]['id']){delete _0x65ab7e[_0x4c2f('0x5b')]['id'];}_0x65ab7e['body'][_0x4c2f('0x64')]=_0x65ab7e[_0x4c2f('0x5b')][_0x4c2f('0x64')]||_0x65ab7e['user']['id'];_0x5a5511[_0x4c2f('0x66')]['id']=_0x65ab7e[_0x4c2f('0x5b')][_0x4c2f('0x64')];return db[_0x4c2f('0x3c')][_0x4c2f('0x59')]({'where':{'id':_0x65ab7e['params']['id'],'UserId':null}})[_0x4c2f('0x1f')](handleEntityNotFound(_0x43b68a,null))['then'](function(_0x5d3b22){if(_0x5d3b22){_0x5a5511[_0x4c2f('0x28')]=_0x5d3b22[_0x4c2f('0x67')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x5d3b22[_0x4c2f('0x69')]}});}return null;})[_0x4c2f('0x1f')](handleEntityNotFound(_0x43b68a,null))[_0x4c2f('0x1f')](function(_0x2c400a){if(_0x2c400a){_0x5a5511[_0x4c2f('0x6c')]=_0x2c400a[_0x4c2f('0x67')]({'plain':!![]});interaction_log['info'](_0x4c2f('0x82'),_0x65ab7e[_0x4c2f('0x65')]['id'],_0x65ab7e[_0x4c2f('0x65')][_0x4c2f('0x39')],_0x65ab7e[_0x4c2f('0x65')][_0x4c2f('0x6e')],_0x5a5511['interaction']['id'],_0x65ab7e[_0x4c2f('0x5b')]?JSON[_0x4c2f('0x25')](_0x65ab7e['body']):_0x4c2f('0x6f'));return respondWithRpcPromise(_0x4c2f('0x83'),_0x4c2f('0x84'),_0x5a5511);}return null;})['then'](function(_0x2219bc){var _0x2e5b2c=_0x4c2f('0x72')+_0x2219bc[_0x4c2f('0x28')][_0x4c2f('0x73')];return db[_0x4c2f('0x74')][_0x4c2f('0x42')](_0x2e5b2c,{'type':db[_0x4c2f('0x75')]['QueryTypes'][_0x4c2f('0x85')],'raw':!![]})[_0x4c2f('0x1f')](function(_0x4a3c97){return _0x4a3c97;});})[_0x4c2f('0x1f')](function(_0x1da571){if(_0x1da571){_0x5a5511[_0x4c2f('0x28')]['contact']=_0x1da571[0x0];if(!_0x65ab7e[_0x4c2f('0x5b')][_0x4c2f('0x64')])return;return db[_0x4c2f('0x77')][_0x4c2f('0x59')]({'where':{'id':_0x65ab7e[_0x4c2f('0x5b')][_0x4c2f('0x64')],'role':_0x4c2f('0x66')},'attributes':['id',_0x4c2f('0x39'),_0x4c2f('0x78'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4cec55){if(!_0x4cec55)return null;_0x5a5511[_0x4c2f('0x28')]['agent']=_0x4cec55;return _0x5a5511;})[_0x4c2f('0x1f')](function(_0x29af8f){if(_0x29af8f){_0x29af8f[_0x4c2f('0x28')]['interface']=util[_0x4c2f('0x62')](_0x4c2f('0x7c'),_0x65ab7e['user'][_0x4c2f('0x39')]);_0x29af8f['message'][_0x4c2f('0x7d')]=_0x5a5511['channel'];_0x29af8f[_0x4c2f('0x28')][_0x4c2f('0x7e')]=_0x5a5511[_0x4c2f('0x7d')];_0x29af8f[_0x4c2f('0x28')]['event']=_0x4c2f('0x35');respondWithRpcPromise(_0x4c2f('0x80'),_0x4c2f('0x80'),{'event':_0x4c2f('0x86'),'message':_0x29af8f[_0x4c2f('0x28')]},client9002);return _0x5a5511;}return null;})[_0x4c2f('0x1f')](respondWithResult(_0x43b68a,null))[_0x4c2f('0x2a')](handleError(_0x43b68a,null));};exports[_0x4c2f('0x2c')]=function(_0x51cf47,_0xaf71fa,_0x2e2a3c){if(_0x51cf47['body']['id']){delete _0x51cf47['body']['id'];}var _0x3df13a;return db['SmsMessage'][_0x4c2f('0x59')]({'where':{'id':_0x51cf47[_0x4c2f('0x56')]['id']}})[_0x4c2f('0x1f')](handleEntityNotFound(_0xaf71fa,null))['then'](function(_0x4cd6c8){if(_0x4cd6c8){_0x3df13a=_0x4cd6c8;return db[_0x4c2f('0x87')][_0x4c2f('0x59')]({'where':{'id':_0x4cd6c8[_0x4c2f('0x88')]}});}})['then'](handleEntityNotFound(_0xaf71fa,null))[_0x4c2f('0x1f')](function(_0x5f0e11){if(_0x5f0e11){logger[_0x4c2f('0x23')](_0x4c2f('0x24'),_0x4c2f('0x2c'),_0x4c2f('0x89'),_0x5f0e11[_0x4c2f('0x3e')],util[_0x4c2f('0x8a')](_0x51cf47[_0x4c2f('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5f0e11[_0x4c2f('0x3e')]){case _0x4c2f('0x8b'):if(_0x51cf47[_0x4c2f('0x5b')][_0x4c2f('0x8c')]&&_0x51cf47[_0x4c2f('0x5b')][_0x4c2f('0x8c')]===_0x3df13a['messageId']){return _0x3df13a[_0x4c2f('0x6a')]({'read':!![]});}else{logger['error'](_0x4c2f('0x8d'),_0x4c2f('0x2c'),_0x4c2f('0x8b'),util['inspect'](_0x51cf47[_0x4c2f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4c2f('0x8e'):if(_0x51cf47[_0x4c2f('0x5b')][_0x4c2f('0x8f')]&&_0x51cf47[_0x4c2f('0x5b')]['MessageUUID']===_0x3df13a[_0x4c2f('0x90')]&&_[_0x4c2f('0x91')]([_0x4c2f('0x92'),_0x4c2f('0x93')],_0x51cf47['body'][_0x4c2f('0x94')])>=0x0){return _0x3df13a[_0x4c2f('0x6a')]({'read':!![]});}else{logger[_0x4c2f('0x26')](_0x4c2f('0x8d'),_0x4c2f('0x2c'),_0x4c2f('0x95'),util[_0x4c2f('0x8a')](_0x51cf47[_0x4c2f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4c2f('0x96'):var _0x2d3e0c=_0x51cf47['body'][_0x4c2f('0x97')][0x0];if(_0x2d3e0c[_0x4c2f('0x2c')][_0x4c2f('0x98')]===_0x4c2f('0x99')){return _0x3df13a[_0x4c2f('0x6a')]({'read':!![]});}else{logger[_0x4c2f('0x26')](_0x4c2f('0x8d'),'status',_0x4c2f('0x96'),util[_0x4c2f('0x8a')](_0x51cf47[_0x4c2f('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3df13a;}})['then'](respondWithResult(_0xaf71fa,null))[_0x4c2f('0x2a')](handleError(_0xaf71fa,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 187fcfe..4b1711f 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 _0xf581=['save','update','remove','hasOwnProperty','hook','../../mysqldb','SmsMessage'];(function(_0x13977c,_0x21ceac){var _0x184062=function(_0x50554c){while(--_0x50554c){_0x13977c['push'](_0x13977c['shift']());}};_0x184062(++_0x21ceac);}(_0xf581,0xbb));var _0x1f58=function(_0x41765d,_0xb2208a){_0x41765d=_0x41765d-0x0;var _0x537535=_0xf581[_0x41765d];return _0x537535;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1f58('0x0'))['db'][_0x1f58('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f58('0x2'),'afterUpdate':_0x1f58('0x3'),'afterDestroy':_0x1f58('0x4')};function emitEvent(_0x45ad49){return function(_0x210612,_0x1d5520,_0x45a5f1){SmsMessageEvents['emit'](_0x45ad49+':'+_0x210612['id'],_0x210612);SmsMessageEvents['emit'](_0x45ad49,_0x210612);_0x45a5f1(null);};}for(var e in events){if(events[_0x1f58('0x5')](e)){var event=events[e];SmsMessage[_0x1f58('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x330d=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x330d,0xc5));var _0xd330=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x330d[_0x15b380];return _0x232c5c;};'use strict';var EventEmitter=require(_0xd330('0x0'));var SmsMessage=require(_0xd330('0x1'))['db'][_0xd330('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd330('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd330('0x4'),'afterDestroy':_0xd330('0x5')};function emitEvent(_0x4f4389){return function(_0x1046a6,_0x33728e,_0x377413){SmsMessageEvents[_0xd330('0x6')](_0x4f4389+':'+_0x1046a6['id'],_0x1046a6);SmsMessageEvents[_0xd330('0x6')](_0x4f4389,_0x1046a6);_0x377413(null);};}for(var e in events){if(events[_0xd330('0x7')](e)){var event=events[e];SmsMessage[_0xd330('0x8')](e,emitEvent(event));}}module[_0xd330('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f7bd8eb..d9fc9fd 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 _0x204f=['/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','direction','error','find','SmsAccountId','type','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','session_key','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','POST','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','text','timestamp','keys','sort','apiKey','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId'];(function(_0x195764,_0x2d7739){var _0xd02ca8=function(_0x17bc90){while(--_0x17bc90){_0x195764['push'](_0x195764['shift']());}};_0xd02ca8(++_0x2d7739);}(_0x204f,0x8c));var _0xf204=function(_0x227859,_0x58688e){_0x227859=_0x227859-0x0;var _0x1a3ca9=_0x204f[_0x227859];return _0x1a3ca9;};'use strict';var _=require(_0xf204('0x0'));var util=require(_0xf204('0x1'));var logger=require(_0xf204('0x2'))('api');var moment=require(_0xf204('0x3'));var BPromise=require(_0xf204('0x4'));var rp=require(_0xf204('0x5'));var fs=require('fs');var path=require(_0xf204('0x6'));var rimraf=require(_0xf204('0x7'));var config=require(_0xf204('0x8'));var attributes=require(_0xf204('0x9'));module[_0xf204('0xa')]=function(_0x46c001,_0x4dc70c){return _0x46c001['define'](_0xf204('0xb'),attributes,{'tableName':_0xf204('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xf204('0xd')]},{'name':_0xf204('0xe'),'fields':[_0xf204('0xf')],'type':_0xf204('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x265caa,_0x170d48,_0x255616){var _0x43d769=_0x46c001[_0xf204('0x11')];var _0x3aca32=_0x265caa[_0xf204('0x12')]({'plain':!![]});if(_0x3aca32['direction'][_0xf204('0x13')]()==='in'||_0x3aca32['direction'][_0xf204('0x13')]()===_0xf204('0x14')&&!_0x3aca32[_0xf204('0x15')]&&!_[_0xf204('0x16')](_0x3aca32[_0xf204('0x17')])&&!_[_0xf204('0x16')](_0x3aca32[_0xf204('0x18')])){_0x43d769[_0xf204('0x19')][_0xf204('0x1a')]({'where':{'id':_0x3aca32[_0xf204('0x18')]}})[_0xf204('0x1b')](function(_0x2f65b4){if(_0x2f65b4){_0x2f65b4[_0xf204('0x1c')]({'lastMsgAt':_0x3aca32['createdAt'],'lastMsgDirection':_0x3aca32[_0xf204('0x1d')][_0xf204('0x13')]()});}})['catch'](function(_0xda2077){console[_0xf204('0x1e')](_0xda2077);});}if(_0x3aca32['direction']===_0xf204('0x14')&&!_0x3aca32[_0xf204('0x15')]){var _0x43a00f;_0x43d769['SmsAccount'][_0xf204('0x1f')]({'where':{'id':_0x3aca32[_0xf204('0x20')]},'raw':!![]})[_0xf204('0x1b')](function(_0x4868aa){_0x43a00f=_0x4868aa;if(_0x43a00f&&_0x43a00f['type']){switch(_0x43a00f[_0xf204('0x21')]){case'twilio':var _0x59b214=require('twilio');if(_0x43a00f[_0xf204('0x22')]&&_0x43a00f[_0xf204('0x23')]&&_0x43a00f[_0xf204('0x24')]){var _0x2b7fa3=new _0x59b214(_0x43a00f['accountSid'],_0x43a00f['authToken']);_0x2b7fa3[_0xf204('0x25')]['create']({'body':_0x3aca32[_0xf204('0xf')],'to':_0x3aca32[_0xf204('0x24')],'from':_0x43a00f[_0xf204('0x24')],'statusCallback':_0x43a00f[_0xf204('0x26')]+_0xf204('0x27')+_0x3aca32['id']+_0xf204('0x28')+_0x43a00f[_0xf204('0x29')]})[_0xf204('0x1b')](function(_0x3e1160){if(_0x3e1160[_0xf204('0x2a')]){return _0x265caa[_0xf204('0x1c')]({'messageId':_0x3e1160['sid']});}})[_0xf204('0x2b')](function(_0x36cbe7){logger['error'](_0xf204('0x2c'),'afterCreate','twilio',util[_0xf204('0x2d')](_0x36cbe7,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf204('0x2e'),'twilio',_0xf204('0x2f'));}break;case _0xf204('0x30'):var _0x35508e=_0xf204('0x31');if(_0x43a00f[_0xf204('0x32')]&&_0x43a00f[_0xf204('0x33')]){var _0x2385c0={'recipient':[_0x3aca32['phone']],'message':_0x3aca32[_0xf204('0xf')],'message_type':_0x43a00f[_0xf204('0x34')]};if(_0x43a00f[_0xf204('0x34')]&&_0x43a00f[_0xf204('0x34')]!=='SI'){_0x2385c0[_0xf204('0x35')]=_0x43a00f[_0xf204('0x24')];}var _0x2e3ae0={'url':_0x35508e+_0xf204('0x36')+_0x43a00f[_0xf204('0x32')]+_0xf204('0x37')+_0x43a00f['password'],'method':_0xf204('0x38')};rp(_0x2e3ae0)[_0xf204('0x1b')](function(_0xa45c92){var _0x439ca5=_0xa45c92['split'](';');var _0x48cdb7={'user_key':_0x439ca5[0x0],'session_key':_0x439ca5[0x1]};_0x2e3ae0={'url':_0x35508e+_0xf204('0x39'),'method':'POST','headers':{'user_key':_0x48cdb7[_0xf204('0x3a')],'Session_key':_0x48cdb7[_0xf204('0x3b')]},'json':!![],'body':_0x2385c0};return rp(_0x2e3ae0);})[_0xf204('0x1b')](function(_0x47ec81){if(_0x47ec81['total_sent']>=0x1){var _0x4aa5fc={'messageId':_0x47ec81['internal_order_id']};if(_0x43a00f[_0xf204('0x34')]!=='GP'||!_0x43a00f[_0xf204('0x3c')]){_0x4aa5fc['read']=!![];}return _0x265caa['update'](_0x4aa5fc);}else{return logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x30'),util[_0xf204('0x2d')](_0x47ec81,{'showHidden':![],'depth':null}));}})[_0xf204('0x2b')](function(_0xf04def){return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x30'),util[_0xf204('0x2d')](_0xf04def,{'showHidden':![],'depth':null}));});}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf204('0x3d'):if(_0x43a00f[_0xf204('0x23')]){var _0x31aa25={'recipient':_0x3aca32[_0xf204('0x24')],'message':_0x3aca32[_0xf204('0xf')],'sender':_0x43a00f[_0xf204('0x3e')]||_0x43a00f['phone'],'authorization':_0x43a00f[_0xf204('0x23')]};var _0x170d48={'method':'POST','uri':_0xf204('0x3f'),'body':_0x31aa25,'json':!![]};rp(_0x170d48)[_0xf204('0x1b')](function(_0x2ed822){var _0x5973a2={'messageId':_0x2ed822[_0xf204('0x40')]};if(!_0x43a00f[_0xf204('0x3c')]){_0x5973a2[_0xf204('0x41')]=!![];}return _0x265caa['update'](_0x5973a2);})[_0xf204('0x2b')](function(_0xd6de3){logger[_0xf204('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf204('0x2e'),_0xf204('0x3d'),util[_0xf204('0x2d')](_0xd6de3,{'showHidden':![],'depth':null}));});}else{logger[_0xf204('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf204('0x2e'),'connectel',_0xf204('0x42'));}break;case _0xf204('0x43'):if(_0x43a00f[_0xf204('0x32')]&&_0x43a00f[_0xf204('0x33')]){var _0x31aa25={'messages':[{'source':_0xf204('0x44'),'to':_0x3aca32[_0xf204('0x24')],'body':_0x3aca32[_0xf204('0xf')],'from':_0x43a00f[_0xf204('0x3e')]||_0x43a00f[_0xf204('0x24')]}]};var _0x42192a=util['format']('%s:%s',_0x43a00f[_0xf204('0x32')],_0x43a00f[_0xf204('0x33')]);var _0x170d48={'method':_0xf204('0x45'),'uri':_0xf204('0x46'),'body':_0x31aa25,'headers':{'Authorization':util[_0xf204('0x47')](_0xf204('0x48'),new Buffer(_0x42192a)['toString'](_0xf204('0x49')))},'json':!![]};rp(_0x170d48)['then'](function(_0x263966){if(_0x263966[_0xf204('0x4a')]>=0xc8&&_0x263966[_0xf204('0x4a')]<=0xce){if(_0x263966[_0xf204('0x4b')]&&_0x263966[_0xf204('0x4b')][_0xf204('0x4c')]>0x0){var _0x53d1e6=_[_0xf204('0x4d')](_0x263966[_0xf204('0x4b')][_0xf204('0x25')]);var _0x1dae7e={'messageId':_0x53d1e6[_0xf204('0x4e')]};if(!_0x43a00f['deliveryReport']){_0x1dae7e['read']=!![];}return _0x265caa[_0xf204('0x1c')](_0x1dae7e);}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),'clickSend',util[_0xf204('0x2d')](_0x263966,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x4f'),util[_0xf204('0x2d')](_0x263966,{'showHidden':![],'depth':null}));}})[_0xf204('0x2b')](function(_0x2346dd){logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x4f'),util['inspect'](_0x2346dd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x4f'),_0xf204('0x50'));}break;case _0xf204('0x51'):if(_0x43a00f[_0xf204('0x52')]&&_0x43a00f[_0xf204('0x23')]){var _0x31aa25={'dst':_0x3aca32['phone'],'text':_0x3aca32[_0xf204('0xf')],'src':_0x43a00f[_0xf204('0x3e')]||_0x43a00f[_0xf204('0x24')],'url':_0x43a00f[_0xf204('0x26')]+'/api/sms/messages/'+_0x3aca32['id']+_0xf204('0x28')+_0x43a00f[_0xf204('0x29')]};var _0x42192a=util[_0xf204('0x47')](_0xf204('0x53'),_0x43a00f[_0xf204('0x52')],_0x43a00f[_0xf204('0x23')]);var _0x170d48={'method':'POST','uri':util[_0xf204('0x47')](_0xf204('0x54'),_0x43a00f['authId']),'body':_0x31aa25,'headers':{'Authorization':util[_0xf204('0x47')]('Basic\x20%s',new Buffer(_0x42192a)[_0xf204('0x55')]('base64'))},'json':!![]};rp(_0x170d48)[_0xf204('0x1b')](function(_0x454111){var _0x40684a={'messageId':_0x454111[_0xf204('0x56')][0x0]};return _0x265caa['update'](_0x40684a);})[_0xf204('0x2b')](function(_0x399bc4){logger[_0xf204('0x1e')](_0xf204('0x2c'),'afterCreate',_0xf204('0x51'),util[_0xf204('0x2d')](_0x399bc4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf204('0x51'),_0xf204('0x57'));}break;case'infobip':if(_0x43a00f[_0xf204('0x32')]&&_0x43a00f[_0xf204('0x33')]){if(_0x43a00f[_0xf204('0x58')]){var _0x39bd8e={'method':_0xf204('0x45'),'uri':_0x43a00f[_0xf204('0x58')]+_0xf204('0x59'),'body':{'username':_0x43a00f['username'],'password':_0x43a00f[_0xf204('0x33')]},'json':!![]};return rp(_0x39bd8e)[_0xf204('0x1b')](function(_0x597592){var _0x3d588d={'method':_0xf204('0x45'),'uri':_0x43a00f[_0xf204('0x58')]+_0xf204('0x5a'),'body':{'messages':[{'from':_0x43a00f[_0xf204('0x24')],'destinations':[{'to':_0x3aca32[_0xf204('0x24')]}],'text':_0x3aca32[_0xf204('0xf')],'notifyUrl':_0x43a00f['remote']+_0xf204('0x27')+_0x3aca32['id']+_0xf204('0x28')+_0x43a00f[_0xf204('0x29')],'notifyContentType':_0xf204('0x5b'),'callbackData':_0x43a00f[_0xf204('0x24')]+';'+_0x3aca32[_0xf204('0xf')]}]},'headers':{'Authorization':_0xf204('0x5c')+_0x597592[_0xf204('0x29')]},'json':!![]};return rp(_0x3d588d)[_0xf204('0x1b')](function(_0x1199a1){if(_0x1199a1[_0xf204('0x25')]){var _0x46b6d3={'messageId':_0x1199a1[_0xf204('0x25')][0x0][_0xf204('0xd')]};if(!_0x43a00f[_0xf204('0x3c')]){_0x46b6d3['read']=!![];}return _0x265caa['update'](_0x46b6d3);}else{return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x5d'),util['inspect'](_0x1199a1,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5b6035){return logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),'infobip',util['inspect'](_0x5b6035,{'showHidden':![],'depth':null}));});}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x5d'),_0xf204('0x5e'));}}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),'infobip',_0xf204('0x50'));}break;case _0xf204('0x5f'):var _0x526e0a=require(_0xf204('0x60'));if(_0x43a00f['apiKey']){var _0x50185a={};_0x50185a['login']=_0x43a00f['username'];_0x50185a[_0xf204('0x24')]=_0x3aca32['phone'];_0x50185a[_0xf204('0x35')]=_0x43a00f['phone'];_0x50185a[_0xf204('0x61')]=_0x3aca32[_0xf204('0xf')];_0x50185a[_0xf204('0x62')]=+new Date();var _0x59c697='';var _0x29ef8='';var _0x25736a=Object[_0xf204('0x63')](_0x50185a);_0x25736a[_0xf204('0x64')]();for(var _0x382ee0=0x0;_0x382ee0<_0x25736a['length'];_0x382ee0++){if(_0x59c697!=''){_0x59c697+='&';}_0x59c697+=_0x25736a[_0x382ee0]+'='+encodeURIComponent(_0x50185a[_0x25736a[_0x382ee0]]);_0x29ef8+=_0x50185a[_0x25736a[_0x382ee0]];}_0x29ef8+=_0x43a00f[_0xf204('0x65')];_0x29ef8=_0x526e0a[_0xf204('0x66')](_0xf204('0x67'))['update'](_0x29ef8)[_0xf204('0x68')](_0xf204('0x69'));if(_0x59c697!==''){_0x59c697+='&';}_0x59c697+=_0xf204('0x6a')+_0x29ef8;var _0x2e3ae0={'method':_0xf204('0x38'),'uri':_0x43a00f[_0xf204('0x58')]+'/external/get/send.php?'+_0x59c697,'json':!![]};return rp(_0x2e3ae0)['then'](function(_0x52b2b1){var _0x36db17=Object[_0xf204('0x63')](_0x52b2b1);if(_0x52b2b1[_0x36db17[0x0]]['error']&&parseInt(_0x52b2b1[_0x36db17[0x0]][_0xf204('0x1e')])===0x0){var _0xde8009={'messageId':_0x52b2b1[_0x36db17[0x0]][_0xf204('0x6b')]};if(!_0x43a00f['deliveryReport']){_0xde8009[_0xf204('0x41')]=!![];}return _0x265caa[_0xf204('0x1c')](_0xde8009);}else{return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x5f'),util[_0xf204('0x2d')](_0x52b2b1[_0xf204('0x1e')],{'showHidden':![],'depth':null}));}})[_0xf204('0x2b')](function(_0x3d013f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf204('0x2e'),_0xf204('0x5f'),util[_0xf204('0x2d')](_0x3d013f,{'showHidden':![],'depth':null}));});}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x5f'),_0xf204('0x6c'));}break;case'clickatell':if(_0x43a00f['apiKey']){var _0xc3b31b={'method':_0xf204('0x45'),'uri':_0xf204('0x6d'),'headers':{'Authorization':_0x43a00f[_0xf204('0x65')]},'body':{'content':_0x3aca32['body'],'to':[_0x3aca32[_0xf204('0x24')]],'from':_0x43a00f[_0xf204('0x24')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0xc3b31b)['then'](function(_0x5c8fc5){if(!_0x5c8fc5[_0xf204('0x1e')]){var _0x1ec5cc={'messageId':_0x5c8fc5[_0xf204('0x25')][0x0][_0xf204('0x6e')]};if(!_0x43a00f['deliveryReport']){_0x1ec5cc[_0xf204('0x41')]=!![];}return _0x265caa[_0xf204('0x1c')](_0x1ec5cc);}else{return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x6f'),util['inspect'](_0x5c8fc5[_0xf204('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3342af){return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x6f'),util[_0xf204('0x2d')](_0x3342af,{'showHidden':![],'depth':null}));});}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),'afterCreate',_0xf204('0x6f'),_0xf204('0x6c'));}break;case'bandwidth':if(_0x43a00f[_0xf204('0x32')]&&_0x43a00f['password']){var _0x42192a=util[_0xf204('0x47')]('%s:%s',_0x43a00f[_0xf204('0x32')],_0x43a00f[_0xf204('0x33')]);var _0x170d48={'method':_0xf204('0x45'),'uri':_0xf204('0x70')+_0x43a00f[_0xf204('0x71')]+_0xf204('0x72'),'body':{'to':[_0x3aca32[_0xf204('0x24')]],'text':_0x3aca32['body'],'from':_0x43a00f[_0xf204('0x24')],'applicationId':_0x43a00f[_0xf204('0x73')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x42192a)[_0xf204('0x55')](_0xf204('0x49')))},'json':!![]};rp(_0x170d48)[_0xf204('0x1b')](function(_0x27d8d6){if(_0x27d8d6['id']){var _0x45c667={'messageId':_0x27d8d6['id']};return _0x265caa[_0xf204('0x1c')](_0x45c667);}else{logger[_0xf204('0x1e')](_0xf204('0x2c'),'afterCreate',_0xf204('0x74'),util[_0xf204('0x2d')](_0x27d8d6,{'showHidden':![],'depth':null}));}})[_0xf204('0x2b')](function(_0x1393ba){logger[_0xf204('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf204('0x2e'),_0xf204('0x74'),util[_0xf204('0x2d')](_0x1393ba,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf204('0x2c'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xf204('0x75'):if(_0x43a00f['apiKey']){var _0x2ba9a8={};var _0x2e3ae0={'method':_0xf204('0x45'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf204('0x76')+_0x43a00f[_0xf204('0x65')],'Content-Type':'application/json'},'body':{'from':_0x43a00f[_0xf204('0x24')],'to':_0x3aca32[_0xf204('0x24')],'text':_0x3aca32[_0xf204('0xf')]},'json':!![]};return rp(_0x2e3ae0)[_0xf204('0x1b')](function(_0x4525c1){if(_0x4525c1[_0xf204('0x77')]==0xca){_0x2ba9a8['message']=_0x4525c1;var _0x135dde={'method':_0xf204('0x45'),'uri':_0xf204('0x78'),'headers':{'Authorization':_0xf204('0x76')+_0x43a00f[_0xf204('0x65')],'Content-Type':_0xf204('0x5b')},'body':{'refid':_0x2ba9a8[_0xf204('0x79')][_0xf204('0x7a')]},'json':!![]};return rp(_0x135dde)['then'](function(_0x1ac409){_0x2ba9a8[_0xf204('0x7b')]=_0x1ac409;var _0x5e1fbc={'messageId':_0x2ba9a8[_0xf204('0x79')][_0xf204('0x7a')],'read':!![]};return _0x265caa['update'](_0x5e1fbc);});}else{return logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x75'),util[_0xf204('0x2d')](_0x4525c1,{'showHidden':![],'depth':null}));}})[_0xf204('0x2b')](function(_0x10b446){return logger[_0xf204('0x1e')](_0xf204('0x2c'),_0xf204('0x2e'),'intelepeer',util[_0xf204('0x2d')](_0x10b446,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xf204('0x2c'),_0xf204('0x2e'),_0xf204('0x75'),'Token\x20not\x20received');}break;}}})[_0xf204('0x7c')](function(){_0x255616();});}else{_0x255616();}}},'charset':_0xf204('0x7d'),'collate':_0xf204('0x7e')});}; \ No newline at end of file +var _0xe558=['authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','infobip','baseUrl','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','password','accountId','/messages','intelepeer','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','error','SmsAccountId','twilio','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','queued_count','head','message_id','clickSend','plivo'];(function(_0x5e343b,_0xc10397){var _0x5d0676=function(_0x2e4557){while(--_0x2e4557){_0x5e343b['push'](_0x5e343b['shift']());}};_0x5d0676(++_0xc10397);}(_0xe558,0x11a));var _0x8e55=function(_0x133990,_0x334b7a){_0x133990=_0x133990-0x0;var _0x176242=_0xe558[_0x133990];return _0x176242;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var logger=require(_0x8e55('0x2'))(_0x8e55('0x3'));var moment=require(_0x8e55('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e55('0x5'));var rimraf=require(_0x8e55('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x8e55('0x7')]=function(_0x4b6c56,_0x3f860f){return _0x4b6c56[_0x8e55('0x8')](_0x8e55('0x9'),attributes,{'tableName':_0x8e55('0xa'),'paranoid':![],'indexes':[{'name':_0x8e55('0xb'),'fields':['messageId']},{'name':_0x8e55('0xc'),'fields':['body'],'type':_0x8e55('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x171b4c,_0x1577d6,_0x8ba66a){var _0x831e10=_0x4b6c56[_0x8e55('0xe')];var _0x52e12a=_0x171b4c[_0x8e55('0xf')]({'plain':!![]});if(_0x52e12a[_0x8e55('0x10')]['toLowerCase']()==='in'||_0x52e12a['direction'][_0x8e55('0x11')]()===_0x8e55('0x12')&&!_0x52e12a[_0x8e55('0x13')]&&!_[_0x8e55('0x14')](_0x52e12a[_0x8e55('0x15')])&&!_[_0x8e55('0x14')](_0x52e12a['SmsInteractionId'])){_0x831e10[_0x8e55('0x16')][_0x8e55('0x17')]({'where':{'id':_0x52e12a[_0x8e55('0x18')]}})[_0x8e55('0x19')](function(_0x49cbb7){if(_0x49cbb7){_0x49cbb7[_0x8e55('0x1a')]({'lastMsgAt':_0x52e12a[_0x8e55('0x1b')],'lastMsgDirection':_0x52e12a['direction'][_0x8e55('0x11')]()});}})['catch'](function(_0x25c1d2){console[_0x8e55('0x1c')](_0x25c1d2);});}if(_0x52e12a['direction']===_0x8e55('0x12')&&!_0x52e12a[_0x8e55('0x13')]){var _0x4581ca;_0x831e10['SmsAccount']['find']({'where':{'id':_0x52e12a[_0x8e55('0x1d')]},'raw':!![]})[_0x8e55('0x19')](function(_0x5a5f4e){_0x4581ca=_0x5a5f4e;if(_0x4581ca&&_0x4581ca['type']){switch(_0x4581ca['type']){case _0x8e55('0x1e'):var _0x4c56da=require(_0x8e55('0x1e'));if(_0x4581ca['accountSid']&&_0x4581ca[_0x8e55('0x1f')]&&_0x4581ca[_0x8e55('0x20')]){var _0x19d4dc=new _0x4c56da(_0x4581ca['accountSid'],_0x4581ca[_0x8e55('0x1f')]);_0x19d4dc[_0x8e55('0x21')][_0x8e55('0x22')]({'body':_0x52e12a[_0x8e55('0x23')],'to':_0x52e12a[_0x8e55('0x20')],'from':_0x4581ca['phone'],'statusCallback':_0x4581ca[_0x8e55('0x24')]+_0x8e55('0x25')+_0x52e12a['id']+_0x8e55('0x26')+_0x4581ca[_0x8e55('0x27')]})[_0x8e55('0x19')](function(_0x34b478){if(_0x34b478[_0x8e55('0x28')]){return _0x171b4c[_0x8e55('0x1a')]({'messageId':_0x34b478[_0x8e55('0x28')]});}})[_0x8e55('0x29')](function(_0x8ccb78){logger[_0x8e55('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e55('0x2a'),_0x8e55('0x1e'),util[_0x8e55('0x2b')](_0x8ccb78,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x1e'),_0x8e55('0x2d'));}break;case _0x8e55('0x2e'):var _0x3470ce=_0x8e55('0x2f');if(_0x4581ca[_0x8e55('0x30')]&&_0x4581ca['password']){var _0x17bed0={'recipient':[_0x52e12a[_0x8e55('0x20')]],'message':_0x52e12a[_0x8e55('0x23')],'message_type':_0x4581ca[_0x8e55('0x31')]};if(_0x4581ca[_0x8e55('0x31')]&&_0x4581ca[_0x8e55('0x31')]!=='SI'){_0x17bed0[_0x8e55('0x32')]=_0x4581ca['phone'];}var _0x498a20={'url':_0x3470ce+'login?username='+_0x4581ca[_0x8e55('0x30')]+_0x8e55('0x33')+_0x4581ca['password'],'method':_0x8e55('0x34')};rp(_0x498a20)['then'](function(_0x388a15){var _0x1cb3d5=_0x388a15[_0x8e55('0x35')](';');var _0x21857e={'user_key':_0x1cb3d5[0x0],'session_key':_0x1cb3d5[0x1]};_0x498a20={'url':_0x3470ce+_0x8e55('0x36'),'method':_0x8e55('0x37'),'headers':{'user_key':_0x21857e[_0x8e55('0x38')],'Session_key':_0x21857e[_0x8e55('0x39')]},'json':!![],'body':_0x17bed0};return rp(_0x498a20);})['then'](function(_0x25e501){if(_0x25e501[_0x8e55('0x3a')]>=0x1){var _0x4c6e1={'messageId':_0x25e501['internal_order_id']};if(_0x4581ca['smsMethod']!=='GP'||!_0x4581ca[_0x8e55('0x3b')]){_0x4c6e1['read']=!![];}return _0x171b4c[_0x8e55('0x1a')](_0x4c6e1);}else{return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate','skebby',util[_0x8e55('0x2b')](_0x25e501,{'showHidden':![],'depth':null}));}})[_0x8e55('0x29')](function(_0xada5a4){return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate',_0x8e55('0x2e'),util['inspect'](_0xada5a4,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate',_0x8e55('0x2e'),_0x8e55('0x3c'));}break;case _0x8e55('0x3d'):if(_0x4581ca[_0x8e55('0x1f')]){var _0x36db2c={'recipient':_0x52e12a[_0x8e55('0x20')],'message':_0x52e12a[_0x8e55('0x23')],'sender':_0x4581ca[_0x8e55('0x3e')]||_0x4581ca['phone'],'authorization':_0x4581ca['authToken']};var _0x1577d6={'method':_0x8e55('0x37'),'uri':_0x8e55('0x3f'),'body':_0x36db2c,'json':!![]};rp(_0x1577d6)['then'](function(_0x21527f){var _0x3f00cb={'messageId':_0x21527f['requestid']};if(!_0x4581ca[_0x8e55('0x3b')]){_0x3f00cb[_0x8e55('0x40')]=!![];}return _0x171b4c['update'](_0x3f00cb);})[_0x8e55('0x29')](function(_0x5b2d10){logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x3d'),util[_0x8e55('0x2b')](_0x5b2d10,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x3d'),_0x8e55('0x41'));}break;case _0x8e55('0x42'):if(_0x4581ca['username']&&_0x4581ca['password']){var _0x36db2c={'messages':[{'source':_0x8e55('0x43'),'to':_0x52e12a[_0x8e55('0x20')],'body':_0x52e12a[_0x8e55('0x23')],'from':_0x4581ca[_0x8e55('0x3e')]||_0x4581ca['phone']}]};var _0x3aca86=util[_0x8e55('0x44')](_0x8e55('0x45'),_0x4581ca[_0x8e55('0x30')],_0x4581ca['password']);var _0x1577d6={'method':_0x8e55('0x37'),'uri':_0x8e55('0x46'),'body':_0x36db2c,'headers':{'Authorization':util[_0x8e55('0x44')](_0x8e55('0x47'),new Buffer(_0x3aca86)['toString']('base64'))},'json':!![]};rp(_0x1577d6)['then'](function(_0x112157){if(_0x112157[_0x8e55('0x48')]>=0xc8&&_0x112157['http_code']<=0xce){if(_0x112157['data']&&_0x112157['data'][_0x8e55('0x49')]>0x0){var _0x36d6ba=_[_0x8e55('0x4a')](_0x112157['data'][_0x8e55('0x21')]);var _0x2a2e2e={'messageId':_0x36d6ba[_0x8e55('0x4b')]};if(!_0x4581ca[_0x8e55('0x3b')]){_0x2a2e2e['read']=!![];}return _0x171b4c[_0x8e55('0x1a')](_0x2a2e2e);}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate',_0x8e55('0x4c'),util[_0x8e55('0x2b')](_0x112157,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x4c'),util[_0x8e55('0x2b')](_0x112157,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a630c){logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x4c'),util[_0x8e55('0x2b')](_0x2a630c,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x4c'),_0x8e55('0x3c'));}break;case _0x8e55('0x4d'):if(_0x4581ca[_0x8e55('0x4e')]&&_0x4581ca[_0x8e55('0x1f')]){var _0x36db2c={'dst':_0x52e12a[_0x8e55('0x20')],'text':_0x52e12a[_0x8e55('0x23')],'src':_0x4581ca['senderString']||_0x4581ca['phone'],'url':_0x4581ca['remote']+_0x8e55('0x25')+_0x52e12a['id']+_0x8e55('0x26')+_0x4581ca[_0x8e55('0x27')]};var _0x3aca86=util['format'](_0x8e55('0x45'),_0x4581ca[_0x8e55('0x4e')],_0x4581ca[_0x8e55('0x1f')]);var _0x1577d6={'method':_0x8e55('0x37'),'uri':util[_0x8e55('0x44')](_0x8e55('0x4f'),_0x4581ca[_0x8e55('0x4e')]),'body':_0x36db2c,'headers':{'Authorization':util[_0x8e55('0x44')](_0x8e55('0x47'),new Buffer(_0x3aca86)[_0x8e55('0x50')](_0x8e55('0x51')))},'json':!![]};rp(_0x1577d6)[_0x8e55('0x19')](function(_0x5ebea4){var _0x406024={'messageId':_0x5ebea4[_0x8e55('0x52')][0x0]};return _0x171b4c[_0x8e55('0x1a')](_0x406024);})[_0x8e55('0x29')](function(_0x297467){logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x4d'),util[_0x8e55('0x2b')](_0x297467,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x8e55('0x53'):if(_0x4581ca[_0x8e55('0x30')]&&_0x4581ca['password']){if(_0x4581ca['baseUrl']){var _0x3f856f={'method':_0x8e55('0x37'),'uri':_0x4581ca['baseUrl']+'/auth/1/session','body':{'username':_0x4581ca[_0x8e55('0x30')],'password':_0x4581ca['password']},'json':!![]};return rp(_0x3f856f)[_0x8e55('0x19')](function(_0x357c3c){var _0x257d0b={'method':'POST','uri':_0x4581ca[_0x8e55('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4581ca['phone'],'destinations':[{'to':_0x52e12a[_0x8e55('0x20')]}],'text':_0x52e12a[_0x8e55('0x23')],'notifyUrl':_0x4581ca['remote']+_0x8e55('0x25')+_0x52e12a['id']+_0x8e55('0x26')+_0x4581ca['token'],'notifyContentType':'application/json','callbackData':_0x4581ca[_0x8e55('0x20')]+';'+_0x52e12a[_0x8e55('0x23')]}]},'headers':{'Authorization':_0x8e55('0x55')+_0x357c3c[_0x8e55('0x27')]},'json':!![]};return rp(_0x257d0b)[_0x8e55('0x19')](function(_0x40f6fe){if(_0x40f6fe[_0x8e55('0x21')]){var _0x514059={'messageId':_0x40f6fe[_0x8e55('0x21')][0x0]['messageId']};if(!_0x4581ca['deliveryReport']){_0x514059[_0x8e55('0x40')]=!![];}return _0x171b4c[_0x8e55('0x1a')](_0x514059);}else{return logger[_0x8e55('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e55('0x2a'),'infobip',util['inspect'](_0x40f6fe,{'showHidden':![],'depth':null}));}});})[_0x8e55('0x29')](function(_0x2a423b){return logger['error'](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x53'),util[_0x8e55('0x2b')](_0x2a423b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e55('0x2a'),_0x8e55('0x53'),_0x8e55('0x56'));}}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x53'),_0x8e55('0x3c'));}break;case'csc':var _0x394df8=require(_0x8e55('0x57'));if(_0x4581ca[_0x8e55('0x58')]){var _0xb730c3={};_0xb730c3['login']=_0x4581ca[_0x8e55('0x30')];_0xb730c3[_0x8e55('0x20')]=_0x52e12a[_0x8e55('0x20')];_0xb730c3[_0x8e55('0x32')]=_0x4581ca[_0x8e55('0x20')];_0xb730c3[_0x8e55('0x59')]=_0x52e12a[_0x8e55('0x23')];_0xb730c3[_0x8e55('0x5a')]=+new Date();var _0x3db4e6='';var _0x348fff='';var _0x5ab2c7=Object[_0x8e55('0x5b')](_0xb730c3);_0x5ab2c7[_0x8e55('0x5c')]();for(var _0x374272=0x0;_0x374272<_0x5ab2c7[_0x8e55('0x5d')];_0x374272++){if(_0x3db4e6!=''){_0x3db4e6+='&';}_0x3db4e6+=_0x5ab2c7[_0x374272]+'='+encodeURIComponent(_0xb730c3[_0x5ab2c7[_0x374272]]);_0x348fff+=_0xb730c3[_0x5ab2c7[_0x374272]];}_0x348fff+=_0x4581ca[_0x8e55('0x58')];_0x348fff=_0x394df8[_0x8e55('0x5e')](_0x8e55('0x5f'))[_0x8e55('0x1a')](_0x348fff)[_0x8e55('0x60')](_0x8e55('0x61'));if(_0x3db4e6!==''){_0x3db4e6+='&';}_0x3db4e6+='signature='+_0x348fff;var _0x498a20={'method':_0x8e55('0x34'),'uri':_0x4581ca[_0x8e55('0x54')]+_0x8e55('0x62')+_0x3db4e6,'json':!![]};return rp(_0x498a20)[_0x8e55('0x19')](function(_0x62b85a){var _0x25ed80=Object[_0x8e55('0x5b')](_0x62b85a);if(_0x62b85a[_0x25ed80[0x0]][_0x8e55('0x1c')]&&parseInt(_0x62b85a[_0x25ed80[0x0]][_0x8e55('0x1c')])===0x0){var _0x5add95={'messageId':_0x62b85a[_0x25ed80[0x0]][_0x8e55('0x63')]};if(!_0x4581ca['deliveryReport']){_0x5add95[_0x8e55('0x40')]=!![];}return _0x171b4c[_0x8e55('0x1a')](_0x5add95);}else{return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),'csc',util[_0x8e55('0x2b')](_0x62b85a[_0x8e55('0x1c')],{'showHidden':![],'depth':null}));}})[_0x8e55('0x29')](function(_0x4b5a96){return logger[_0x8e55('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8e55('0x64'),util[_0x8e55('0x2b')](_0x4b5a96,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e55('0x2a'),'csc',_0x8e55('0x65'));}break;case _0x8e55('0x66'):if(_0x4581ca[_0x8e55('0x58')]){var _0x41b8ee={'method':_0x8e55('0x37'),'uri':_0x8e55('0x67'),'headers':{'Authorization':_0x4581ca['apiKey']},'body':{'content':_0x52e12a[_0x8e55('0x23')],'to':[_0x52e12a[_0x8e55('0x20')]],'from':_0x4581ca['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x8e55('0x68')},'json':!![]};rp(_0x41b8ee)['then'](function(_0x5bc989){if(!_0x5bc989[_0x8e55('0x1c')]){var _0x3c19d9={'messageId':_0x5bc989['messages'][0x0][_0x8e55('0x69')]};if(!_0x4581ca['deliveryReport']){_0x3c19d9[_0x8e55('0x40')]=!![];}return _0x171b4c[_0x8e55('0x1a')](_0x3c19d9);}else{return logger[_0x8e55('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e55('0x2a'),_0x8e55('0x66'),util[_0x8e55('0x2b')](_0x5bc989[_0x8e55('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1ba41f){return logger['error'](_0x8e55('0x2c'),_0x8e55('0x2a'),'clickatell',util[_0x8e55('0x2b')](_0x1ba41f,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x8e55('0x6a'):if(_0x4581ca[_0x8e55('0x30')]&&_0x4581ca[_0x8e55('0x6b')]){var _0x3aca86=util['format'](_0x8e55('0x45'),_0x4581ca[_0x8e55('0x30')],_0x4581ca[_0x8e55('0x6b')]);var _0x1577d6={'method':_0x8e55('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4581ca[_0x8e55('0x6c')]+_0x8e55('0x6d'),'body':{'to':[_0x52e12a[_0x8e55('0x20')]],'text':_0x52e12a[_0x8e55('0x23')],'from':_0x4581ca['phone'],'applicationId':_0x4581ca['applicationId']},'headers':{'Authorization':util[_0x8e55('0x44')](_0x8e55('0x47'),new Buffer(_0x3aca86)[_0x8e55('0x50')]('base64'))},'json':!![]};rp(_0x1577d6)[_0x8e55('0x19')](function(_0x51dd2){if(_0x51dd2['id']){var _0x1ad66a={'messageId':_0x51dd2['id']};return _0x171b4c[_0x8e55('0x1a')](_0x1ad66a);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8e55('0x6a'),util[_0x8e55('0x2b')](_0x51dd2,{'showHidden':![],'depth':null}));}})[_0x8e55('0x29')](function(_0x3291d6){logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate',_0x8e55('0x6a'),util[_0x8e55('0x2b')](_0x3291d6,{'showHidden':![],'depth':null}));});}else{logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x8e55('0x6e'):if(_0x4581ca[_0x8e55('0x58')]){var _0x549903={};var _0x498a20={'method':_0x8e55('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x8e55('0x6f')+_0x4581ca[_0x8e55('0x58')],'Content-Type':_0x8e55('0x70')},'body':{'from':_0x4581ca[_0x8e55('0x20')],'to':_0x52e12a[_0x8e55('0x20')],'text':_0x52e12a['body']},'json':!![]};return rp(_0x498a20)['then'](function(_0x1e4a6c){if(_0x1e4a6c[_0x8e55('0x71')]==0xca){_0x549903[_0x8e55('0x72')]=_0x1e4a6c;var _0x5abdd4={'method':'POST','uri':_0x8e55('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x4581ca[_0x8e55('0x58')],'Content-Type':_0x8e55('0x70')},'body':{'refid':_0x549903[_0x8e55('0x72')][_0x8e55('0x74')]},'json':!![]};return rp(_0x5abdd4)['then'](function(_0x41d8fc){_0x549903[_0x8e55('0x75')]=_0x41d8fc;var _0x5504b8={'messageId':_0x549903[_0x8e55('0x72')][_0x8e55('0x74')],'read':!![]};return _0x171b4c['update'](_0x5504b8);});}else{return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x6e'),util[_0x8e55('0x2b')](_0x1e4a6c,{'showHidden':![],'depth':null}));}})[_0x8e55('0x29')](function(_0x1fa60b){return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),_0x8e55('0x2a'),_0x8e55('0x6e'),util[_0x8e55('0x2b')](_0x1fa60b,{'showHidden':![],'depth':null}));});}else{return logger[_0x8e55('0x1c')](_0x8e55('0x2c'),'afterCreate',_0x8e55('0x6e'),'Token\x20not\x20received');}break;}}})[_0x8e55('0x76')](function(){_0x8ba66a();});}else{_0x8ba66a();}}},'charset':_0x8e55('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index dff2bfc..3f86286 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 _0x2417=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird'];(function(_0x2b7474,_0x12bbec){var _0x365141=function(_0x2d80dd){while(--_0x2d80dd){_0x2b7474['push'](_0x2b7474['shift']());}};_0x365141(++_0x12bbec);}(_0x2417,0x1eb));var _0x7241=function(_0x480cca,_0x33709f){_0x480cca=_0x480cca-0x0;var _0x22bcdb=_0x2417[_0x480cca];return _0x22bcdb;};'use strict';var _=require(_0x7241('0x0'));var util=require(_0x7241('0x1'));var moment=require(_0x7241('0x2'));var BPromise=require(_0x7241('0x3'));var rs=require(_0x7241('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7241('0x5'))['db'];var utils=require(_0x7241('0x6'));var logger=require('../../config/logger')(_0x7241('0x7'));var config=require(_0x7241('0x8'));var jayson=require(_0x7241('0x9'));var client=jayson[_0x7241('0xa')][_0x7241('0xb')]({'port':0x232a});config[_0x7241('0xc')]=_['defaults'](config[_0x7241('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7241('0xd'))(new Redis(config[_0x7241('0xc')]));require('./smsMessage.socket')[_0x7241('0xe')](socket);function respondWithRpcPromise(_0x37818a,_0x373200,_0x316208){return new BPromise(function(_0x2c6035,_0x4ac8f8){return client[_0x7241('0xf')](_0x37818a,_0x316208)[_0x7241('0x10')](function(_0x5dbec9){logger['info'](_0x7241('0x11'),_0x373200,_0x7241('0x12'));logger[_0x7241('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x373200,_0x7241('0x12'),JSON[_0x7241('0x14')](_0x5dbec9));if(_0x5dbec9['error']){if(_0x5dbec9[_0x7241('0x15')][_0x7241('0x16')]===0x1f4){logger[_0x7241('0x15')](_0x7241('0x11'),_0x373200,_0x5dbec9[_0x7241('0x15')][_0x7241('0x17')]);return _0x4ac8f8(_0x5dbec9[_0x7241('0x15')][_0x7241('0x17')]);}logger['error'](_0x7241('0x11'),_0x373200,_0x5dbec9[_0x7241('0x15')]['message']);return _0x2c6035(_0x5dbec9['error']['message']);}else{logger[_0x7241('0x18')](_0x7241('0x11'),_0x373200,_0x7241('0x12'));_0x2c6035(_0x5dbec9[_0x7241('0x19')][_0x7241('0x17')]);}})[_0x7241('0x1a')](function(_0x57e798){logger[_0x7241('0x15')](_0x7241('0x11'),_0x373200,_0x57e798);_0x4ac8f8(_0x57e798);});});}exports[_0x7241('0x1b')]=function(_0x30de73){var _0xeaa757=this;return new Promise(function(_0x4646fa,_0x2cac73){return db[_0x7241('0x1c')][_0x7241('0x1d')](_0x30de73[_0x7241('0x1e')],{'raw':_0x30de73['options']?_0x30de73[_0x7241('0x1f')][_0x7241('0x20')]===undefined?!![]:![]:!![]})[_0x7241('0x10')](function(_0x4501f7){logger[_0x7241('0x18')](_0x7241('0x1b'),_0x30de73);logger[_0x7241('0x13')](_0x7241('0x1b'),_0x30de73,JSON[_0x7241('0x14')](_0x4501f7));_0x4646fa(_0x4501f7);})[_0x7241('0x1a')](function(_0x2edf9b){logger[_0x7241('0x15')](_0x7241('0x1b'),_0x2edf9b['message'],_0x30de73);_0x2cac73(_0xeaa757[_0x7241('0x15')](0x1f4,_0x2edf9b[_0x7241('0x17')]));});});}; \ No newline at end of file +var _0x8f6a=['register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x32776a,_0x592b3b){var _0x4e4c3f=function(_0x328a00){while(--_0x328a00){_0x32776a['push'](_0x32776a['shift']());}};_0x4e4c3f(++_0x592b3b);}(_0x8f6a,0x1cc));var _0xa8f6=function(_0x1f260c,_0x39abb3){_0x1f260c=_0x1f260c-0x0;var _0x402101=_0x8f6a[_0x1f260c];return _0x402101;};'use strict';var _=require('lodash');var util=require(_0xa8f6('0x0'));var moment=require(_0xa8f6('0x1'));var BPromise=require(_0xa8f6('0x2'));var rs=require(_0xa8f6('0x3'));var fs=require('fs');var Redis=require(_0xa8f6('0x4'));var db=require(_0xa8f6('0x5'))['db'];var utils=require(_0xa8f6('0x6'));var logger=require(_0xa8f6('0x7'))(_0xa8f6('0x8'));var config=require(_0xa8f6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa8f6('0xa')]['http']({'port':0x232a});config[_0xa8f6('0xb')]=_[_0xa8f6('0xc')](config['redis'],{'host':_0xa8f6('0xd'),'port':0x18eb});var socket=require(_0xa8f6('0xe'))(new Redis(config['redis']));require(_0xa8f6('0xf'))[_0xa8f6('0x10')](socket);function respondWithRpcPromise(_0x29e27c,_0x3f7496,_0x2e74c9){return new BPromise(function(_0x3ad652,_0x28a156){return client[_0xa8f6('0x11')](_0x29e27c,_0x2e74c9)[_0xa8f6('0x12')](function(_0x540e2c){logger[_0xa8f6('0x13')](_0xa8f6('0x14'),_0x3f7496,_0xa8f6('0x15'));logger[_0xa8f6('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f7496,_0xa8f6('0x15'),JSON[_0xa8f6('0x17')](_0x540e2c));if(_0x540e2c['error']){if(_0x540e2c['error'][_0xa8f6('0x18')]===0x1f4){logger[_0xa8f6('0x19')](_0xa8f6('0x14'),_0x3f7496,_0x540e2c[_0xa8f6('0x19')][_0xa8f6('0x1a')]);return _0x28a156(_0x540e2c[_0xa8f6('0x19')]['message']);}logger[_0xa8f6('0x19')](_0xa8f6('0x14'),_0x3f7496,_0x540e2c['error'][_0xa8f6('0x1a')]);return _0x3ad652(_0x540e2c[_0xa8f6('0x19')][_0xa8f6('0x1a')]);}else{logger['info'](_0xa8f6('0x14'),_0x3f7496,_0xa8f6('0x15'));_0x3ad652(_0x540e2c['result'][_0xa8f6('0x1a')]);}})[_0xa8f6('0x1b')](function(_0x2e7b20){logger[_0xa8f6('0x19')](_0xa8f6('0x14'),_0x3f7496,_0x2e7b20);_0x28a156(_0x2e7b20);});});}exports[_0xa8f6('0x1c')]=function(_0x24cde6){var _0x1c7bba=this;return new Promise(function(_0x33bfd8,_0x16c329){return db[_0xa8f6('0x1d')][_0xa8f6('0x1e')](_0x24cde6[_0xa8f6('0x1f')],{'raw':_0x24cde6[_0xa8f6('0x20')]?_0x24cde6[_0xa8f6('0x20')][_0xa8f6('0x21')]===undefined?!![]:![]:!![]})[_0xa8f6('0x12')](function(_0x271bb7){logger[_0xa8f6('0x13')]('CreateSmsMessage',_0x24cde6);logger[_0xa8f6('0x16')](_0xa8f6('0x1c'),_0x24cde6,JSON[_0xa8f6('0x17')](_0x271bb7));_0x33bfd8(_0x271bb7);})[_0xa8f6('0x1b')](function(_0x230212){logger['error'](_0xa8f6('0x1c'),_0x230212[_0xa8f6('0x1a')],_0x24cde6);_0x16c329(_0x1c7bba[_0xa8f6('0x19')](0x1f4,_0x230212[_0xa8f6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d0153dd..030ac5a 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 _0x5b25=['save','remove','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x5562ba,_0x472817){var _0x2b359d=function(_0x15ef53){while(--_0x15ef53){_0x5562ba['push'](_0x5562ba['shift']());}};_0x2b359d(++_0x472817);}(_0x5b25,0x131));var _0x55b2=function(_0xd8bdab,_0x33f8a0){_0xd8bdab=_0xd8bdab-0x0;var _0x39b6b5=_0x5b25[_0xd8bdab];return _0x39b6b5;};'use strict';var SmsMessageEvents=require(_0x55b2('0x0'));var events=[_0x55b2('0x1'),_0x55b2('0x2'),_0x55b2('0x3')];function createListener(_0x172424,_0x1ff17a){return function(_0x4086ce){_0x1ff17a[_0x55b2('0x4')](_0x172424,_0x4086ce);};}function removeListener(_0xb1fe59,_0x5388b4){return function(){SmsMessageEvents[_0x55b2('0x5')](_0xb1fe59,_0x5388b4);};}exports[_0x55b2('0x6')]=function(_0x52f976){for(var _0x1f3d31=0x0,_0xb294f8=events[_0x55b2('0x7')];_0x1f3d31<_0xb294f8;_0x1f3d31++){var _0x4f701b=events[_0x1f3d31];var _0x1c0027=createListener(_0x55b2('0x8')+_0x4f701b,_0x52f976);SmsMessageEvents['on'](_0x4f701b,_0x1c0027);}}; \ No newline at end of file +var _0x3631=['update','emit','register','length','smsMessage:','./smsMessage.events','remove'];(function(_0x372330,_0x5c8b48){var _0x243725=function(_0x42511d){while(--_0x42511d){_0x372330['push'](_0x372330['shift']());}};_0x243725(++_0x5c8b48);}(_0x3631,0x124));var _0x1363=function(_0x31d707,_0x733c2b){_0x31d707=_0x31d707-0x0;var _0x3ff20d=_0x3631[_0x31d707];return _0x3ff20d;};'use strict';var SmsMessageEvents=require(_0x1363('0x0'));var events=['save',_0x1363('0x1'),_0x1363('0x2')];function createListener(_0x3015ee,_0x500250){return function(_0x4e6649){_0x500250[_0x1363('0x3')](_0x3015ee,_0x4e6649);};}function removeListener(_0x407cd4,_0xb4474b){return function(){SmsMessageEvents['removeListener'](_0x407cd4,_0xb4474b);};}exports[_0x1363('0x4')]=function(_0xed3562){for(var _0x3b7b07=0x0,_0x49893d=events[_0x1363('0x5')];_0x3b7b07<_0x49893d;_0x3b7b07++){var _0x36d237=events[_0x3b7b07];var _0x868669=createListener(_0x1363('0x6')+_0x36d237,_0xed3562);SmsMessageEvents['on'](_0x36d237,_0x868669);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 62ace59..a7d0468 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 _0x76f1=['isAuthenticated','index','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','delete','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x76f1,0x83));var _0x176f=function(_0x37c1d6,_0x22189b){_0x37c1d6=_0x37c1d6-0x0;var _0x34be0f=_0x76f1[_0x37c1d6];return _0x34be0f;};'use strict';var multer=require(_0x176f('0x0'));var util=require(_0x176f('0x1'));var path=require('path');var timeout=require(_0x176f('0x2'));var express=require(_0x176f('0x3'));var router=express[_0x176f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x176f('0x5'));var interaction=require(_0x176f('0x6'));var config=require(_0x176f('0x7'));var controller=require(_0x176f('0x8'));router['get']('/',auth[_0x176f('0x9')](),controller[_0x176f('0xa')]);router['get']('/describe',auth[_0x176f('0x9')](),controller['describe']);router['get']('/:id',auth[_0x176f('0x9')](),controller[_0x176f('0xb')]);router[_0x176f('0xc')](_0x176f('0xd'),auth[_0x176f('0x9')](),controller[_0x176f('0xe')]);router[_0x176f('0xc')](_0x176f('0xf'),auth[_0x176f('0x9')](),controller[_0x176f('0x10')]);router[_0x176f('0xc')](_0x176f('0x11'),auth[_0x176f('0x9')](),controller[_0x176f('0x12')]);router['post']('/',auth[_0x176f('0x9')](),controller[_0x176f('0x13')]);router[_0x176f('0x14')](_0x176f('0xf'),auth[_0x176f('0x9')](),controller['addTeams']);router[_0x176f('0x14')](_0x176f('0x11'),auth[_0x176f('0x9')](),controller[_0x176f('0x15')]);router[_0x176f('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x176f('0x17')](_0x176f('0x18'),auth[_0x176f('0x9')](),controller[_0x176f('0x19')]);router[_0x176f('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x176f('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x176f('0x1a')]);module[_0x176f('0x1b')]=router; \ No newline at end of file +var _0x4055=['put','update','destroy','removeTeams','delete','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents'];(function(_0x5a7de0,_0x57157d){var _0x3d5d49=function(_0x315627){while(--_0x315627){_0x5a7de0['push'](_0x5a7de0['shift']());}};_0x3d5d49(++_0x57157d);}(_0x4055,0x7b));var _0x5405=function(_0x5e6cea,_0x24b02a){_0x5e6cea=_0x5e6cea-0x0;var _0x55a315=_0x4055[_0x5e6cea];return _0x55a315;};'use strict';var multer=require('multer');var util=require(_0x5405('0x0'));var path=require('path');var timeout=require(_0x5405('0x1'));var express=require(_0x5405('0x2'));var router=express[_0x5405('0x3')]();var fs_extra=require(_0x5405('0x4'));var auth=require(_0x5405('0x5'));var interaction=require(_0x5405('0x6'));var config=require('../../config/environment');var controller=require(_0x5405('0x7'));router[_0x5405('0x8')]('/',auth[_0x5405('0x9')](),controller['index']);router[_0x5405('0x8')](_0x5405('0xa'),auth['isAuthenticated'](),controller[_0x5405('0xb')]);router[_0x5405('0x8')](_0x5405('0xc'),auth[_0x5405('0x9')](),controller[_0x5405('0xd')]);router[_0x5405('0x8')](_0x5405('0xe'),auth[_0x5405('0x9')](),controller['getMembers']);router[_0x5405('0x8')]('/:id/teams',auth[_0x5405('0x9')](),controller[_0x5405('0xf')]);router[_0x5405('0x8')](_0x5405('0x10'),auth[_0x5405('0x9')](),controller['getAgents']);router[_0x5405('0x11')]('/',auth['isAuthenticated'](),controller[_0x5405('0x12')]);router['post'](_0x5405('0x13'),auth['isAuthenticated'](),controller[_0x5405('0x14')]);router[_0x5405('0x11')](_0x5405('0x10'),auth['isAuthenticated'](),controller[_0x5405('0x15')]);router[_0x5405('0x16')]('/:id',auth[_0x5405('0x9')](),controller[_0x5405('0x17')]);router['delete'](_0x5405('0xc'),auth[_0x5405('0x9')](),controller[_0x5405('0x18')]);router['delete'](_0x5405('0x13'),auth[_0x5405('0x9')](),controller[_0x5405('0x19')]);router[_0x5405('0x1a')](_0x5405('0x10'),auth[_0x5405('0x9')](),controller[_0x5405('0x1b')]);module[_0x5405('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e3d8c75..6e309f2 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 _0x5cfb=['roundrobin','beepall'];(function(_0x1f1ea8,_0x87f022){var _0x257b12=function(_0x200015){while(--_0x200015){_0x1f1ea8['push'](_0x1f1ea8['shift']());}};_0x257b12(++_0x87f022);}(_0x5cfb,0x15f));var _0xb5cf=function(_0x5660f6,_0x5646db){_0x5660f6=_0x5660f6-0x0;var _0x4bf573=_0x5cfb[_0x5660f6];return _0x4bf573;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xb5cf('0x0'),_0xb5cf('0x1'))}}; \ No newline at end of file +var _0x3722=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5c2c72,_0x22cf09){var _0x11c44c=function(_0x37bcca){while(--_0x37bcca){_0x5c2c72['push'](_0x5c2c72['shift']());}};_0x11c44c(++_0x22cf09);}(_0x3722,0x1c6));var _0x2372=function(_0x528da8,_0x5d2a15){_0x528da8=_0x528da8-0x0;var _0x5ea3a3=_0x3722[_0x528da8];return _0x5ea3a3;};'use strict';var Sequelize=require(_0x2372('0x0'));module[_0x2372('0x1')]={'name':{'type':Sequelize[_0x2372('0x2')],'unique':_0x2372('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2372('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2372('0x4')](_0x2372('0x5'),_0x2372('0x6'),_0x2372('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0d2630a..214e963 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x5ed9ed,_0x4ebd49){var _0xb64dc2=function(_0x1b23f9){while(--_0x1b23f9){_0x5ed9ed['push'](_0x5ed9ed['shift']());}};_0xb64dc2(++_0x4ebd49);}(_0xdb28,0x106));var _0x8db2=function(_0x189434,_0x4c7e20){_0x189434=_0x189434-0x0;var _0x2bd839=_0xdb28[_0x189434];return _0x2bd839;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x20412f,_0x32b502){var _0x16d840=function(_0x538f15){while(--_0x538f15){_0x20412f['push'](_0x20412f['shift']());}};_0x16d840(++_0x32b502);}(_0x5f2f,0x73));var _0xf5f2=function(_0x241cf2,_0x4ea0c1){_0x241cf2=_0x241cf2-0x0;var _0x23ee03=_0x5f2f[_0x241cf2];return _0x23ee03;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9490a5f..fbd544e 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 _0x84f4=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x1dcefc,_0x377c95){var _0xc92c86=function(_0x2fd4d8){while(--_0x2fd4d8){_0x1dcefc['push'](_0x1dcefc['shift']());}};_0xc92c86(++_0x377c95);}(_0x84f4,0x1a2));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x484f('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x484f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x484f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x200fa0){return function(_0x178082,_0x1a4a83,_0x22cec5){SmsQueueEvents[_0x484f('0x3')](_0x200fa0+':'+_0x178082['id'],_0x178082);SmsQueueEvents[_0x484f('0x3')](_0x200fa0,_0x178082);_0x22cec5(null);};}for(var e in events){if(events[_0x484f('0x4')](e)){var event=events[e];SmsQueue[_0x484f('0x5')](e,emitEvent(event));}}module[_0x484f('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xd62a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x3840b4,_0x46b6b5){var _0x27c663=function(_0xb81b29){while(--_0xb81b29){_0x3840b4['push'](_0x3840b4['shift']());}};_0x27c663(++_0x46b6b5);}(_0xd62a,0xc3));var _0xad62=function(_0x72c3ff,_0x41433d){_0x72c3ff=_0x72c3ff-0x0;var _0x24b28f=_0xd62a[_0x72c3ff];return _0x24b28f;};'use strict';var EventEmitter=require(_0xad62('0x0'));var SmsQueue=require(_0xad62('0x1'))['db'][_0xad62('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xad62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad62('0x4'),'afterDestroy':_0xad62('0x5')};function emitEvent(_0x15bfcb){return function(_0x451199,_0x10753f,_0xe48a5d){SmsQueueEvents[_0xad62('0x6')](_0x15bfcb+':'+_0x451199['id'],_0x451199);SmsQueueEvents['emit'](_0x15bfcb,_0x451199);_0xe48a5d(null);};}for(var e in events){if(events[_0xad62('0x7')](e)){var event=events[e];SmsQueue[_0xad62('0x8')](e,emitEvent(event));}}module[_0xad62('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9da22eb..2ca7217 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 _0xcd55=['api','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger'];(function(_0xcebe2b,_0x3971af){var _0x38d672=function(_0x4f7f79){while(--_0x4f7f79){_0xcebe2b['push'](_0xcebe2b['shift']());}};_0x38d672(++_0x3971af);}(_0xcd55,0x14e));var _0x5cd5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xcd55[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x5cd5('0x0'));var logger=require(_0x5cd5('0x1'))(_0x5cd5('0x2'));var moment=require('moment');var BPromise=require(_0x5cd5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cd5('0x4'));var rimraf=require(_0x5cd5('0x5'));var config=require(_0x5cd5('0x6'));var attributes=require(_0x5cd5('0x7'));module[_0x5cd5('0x8')]=function(_0x20d209,_0x3b2211){return _0x20d209[_0x5cd5('0x9')](_0x5cd5('0xa'),attributes,{'tableName':_0x5cd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c8f=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x328cf4,_0x3bcab2){var _0x5ab062=function(_0x2ce7a4){while(--_0x2ce7a4){_0x328cf4['push'](_0x328cf4['shift']());}};_0x5ab062(++_0x3bcab2);}(_0x5c8f,0x118));var _0xf5c8=function(_0x10f179,_0x34056d){_0x10f179=_0x10f179-0x0;var _0x3788eb=_0x5c8f[_0x10f179];return _0x3788eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5c8('0x0'))('api');var moment=require(_0xf5c8('0x1'));var BPromise=require(_0xf5c8('0x2'));var rp=require(_0xf5c8('0x3'));var fs=require('fs');var path=require(_0xf5c8('0x4'));var rimraf=require('rimraf');var config=require(_0xf5c8('0x5'));var attributes=require(_0xf5c8('0x6'));module[_0xf5c8('0x7')]=function(_0x393c43,_0x4dd3e6){return _0x393c43[_0xf5c8('0x8')](_0xf5c8('0x9'),attributes,{'tableName':_0xf5c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 84d5cf0..cdf90b4 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 _0x36b5=['ShowSmsQueue','find','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x11c00c,_0x60a3f7){var _0x2ec559=function(_0x272b16){while(--_0x272b16){_0x11c00c['push'](_0x11c00c['shift']());}};_0x2ec559(++_0x60a3f7);}(_0x36b5,0x1ef));var _0x536b=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0x36b5[_0x1263cc];return _0x4132a0;};'use strict';var _=require(_0x536b('0x0'));var util=require('util');var moment=require(_0x536b('0x1'));var BPromise=require(_0x536b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x536b('0x3'))['db'];var utils=require(_0x536b('0x4'));var logger=require(_0x536b('0x5'))(_0x536b('0x6'));var config=require(_0x536b('0x7'));var jayson=require(_0x536b('0x8'));var client=jayson[_0x536b('0x9')][_0x536b('0xa')]({'port':0x232a});config[_0x536b('0xb')]=_['defaults'](config[_0x536b('0xb')],{'host':_0x536b('0xc'),'port':0x18eb});var socket=require(_0x536b('0xd'))(new Redis(config[_0x536b('0xb')]));require(_0x536b('0xe'))[_0x536b('0xf')](socket);function respondWithRpcPromise(_0x442057,_0x4ef01d,_0x2b5055){return new BPromise(function(_0x2931ac,_0x2083f6){return client[_0x536b('0x10')](_0x442057,_0x2b5055)[_0x536b('0x11')](function(_0x4f3fe6){logger[_0x536b('0x12')](_0x536b('0x13'),_0x4ef01d,_0x536b('0x14'));logger['debug'](_0x536b('0x15'),_0x4ef01d,'request\x20sent',JSON[_0x536b('0x16')](_0x4f3fe6));if(_0x4f3fe6[_0x536b('0x17')]){if(_0x4f3fe6[_0x536b('0x17')][_0x536b('0x18')]===0x1f4){logger[_0x536b('0x17')](_0x536b('0x13'),_0x4ef01d,_0x4f3fe6['error']['message']);return _0x2083f6(_0x4f3fe6['error']['message']);}logger[_0x536b('0x17')](_0x536b('0x13'),_0x4ef01d,_0x4f3fe6[_0x536b('0x17')][_0x536b('0x19')]);return _0x2931ac(_0x4f3fe6['error'][_0x536b('0x19')]);}else{logger[_0x536b('0x12')](_0x536b('0x13'),_0x4ef01d,_0x536b('0x14'));_0x2931ac(_0x4f3fe6['result']['message']);}})[_0x536b('0x1a')](function(_0x44e954){logger['error'](_0x536b('0x13'),_0x4ef01d,_0x44e954);_0x2083f6(_0x44e954);});});}exports[_0x536b('0x1b')]=function(_0x406989){var _0x2c2879=this;return new Promise(function(_0x3178a1,_0x367c62){return db[_0x536b('0x1c')][_0x536b('0x1d')]({'raw':_0x406989['options']?_0x406989[_0x536b('0x1e')][_0x536b('0x1f')]===undefined?!![]:![]:!![],'where':_0x406989[_0x536b('0x1e')]?_0x406989[_0x536b('0x1e')][_0x536b('0x20')]||null:null,'attributes':_0x406989[_0x536b('0x1e')]?_0x406989[_0x536b('0x1e')][_0x536b('0x21')]||null:null,'limit':_0x406989[_0x536b('0x1e')]?_0x406989[_0x536b('0x1e')][_0x536b('0x22')]||null:null,'include':_0x406989[_0x536b('0x1e')]?_0x406989[_0x536b('0x1e')][_0x536b('0x23')]?_[_0x536b('0x24')](_0x406989[_0x536b('0x1e')]['include'],function(_0x1a4d76){return{'model':db[_0x1a4d76[_0x536b('0x25')]],'as':_0x1a4d76['as'],'attributes':_0x1a4d76[_0x536b('0x21')],'include':_0x1a4d76[_0x536b('0x23')]?_[_0x536b('0x24')](_0x1a4d76['include'],function(_0x71e149){return{'model':db[_0x71e149['model']],'as':_0x71e149['as'],'attributes':_0x71e149[_0x536b('0x21')],'include':_0x71e149[_0x536b('0x23')]?_['map'](_0x71e149['include'],function(_0x39663a){return{'model':db[_0x39663a[_0x536b('0x25')]],'as':_0x39663a['as'],'attributes':_0x39663a[_0x536b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x536b('0x11')](function(_0x5a3d14){logger[_0x536b('0x12')](_0x536b('0x1b'),_0x406989);logger['debug'](_0x536b('0x1b'),_0x406989,JSON['stringify'](_0x5a3d14));_0x3178a1(_0x5a3d14);})[_0x536b('0x1a')](function(_0x20d2d7){logger[_0x536b('0x17')]('GetSmsQueue',_0x20d2d7[_0x536b('0x19')],_0x406989);_0x367c62(_0x2c2879[_0x536b('0x17')](0x1f4,_0x20d2d7[_0x536b('0x19')]));});});};exports[_0x536b('0x26')]=function(_0x2520b3){var _0x3de2f8=this;return new Promise(function(_0xd7a307,_0x10cddd){return db[_0x536b('0x1c')][_0x536b('0x27')]({'raw':_0x2520b3[_0x536b('0x1e')]?_0x2520b3[_0x536b('0x1e')][_0x536b('0x1f')]===undefined?!![]:![]:!![],'where':_0x2520b3[_0x536b('0x1e')]?_0x2520b3[_0x536b('0x1e')][_0x536b('0x20')]||null:null,'attributes':_0x2520b3['options']?_0x2520b3[_0x536b('0x1e')]['attributes']||null:null,'include':_0x2520b3[_0x536b('0x1e')]?_0x2520b3[_0x536b('0x1e')][_0x536b('0x23')]?_[_0x536b('0x24')](_0x2520b3[_0x536b('0x1e')]['include'],function(_0x432d6c){return{'model':db[_0x432d6c[_0x536b('0x25')]],'as':_0x432d6c['as'],'attributes':_0x432d6c[_0x536b('0x21')],'include':_0x432d6c['include']?_['map'](_0x432d6c[_0x536b('0x23')],function(_0xef22c2){return{'model':db[_0xef22c2['model']],'as':_0xef22c2['as'],'attributes':_0xef22c2[_0x536b('0x21')],'include':_0xef22c2[_0x536b('0x23')]?_[_0x536b('0x24')](_0xef22c2[_0x536b('0x23')],function(_0xcf65ff){return{'model':db[_0xcf65ff[_0x536b('0x25')]],'as':_0xcf65ff['as'],'attributes':_0xcf65ff[_0x536b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4070f2){logger[_0x536b('0x12')](_0x536b('0x26'),_0x2520b3);logger[_0x536b('0x28')]('ShowSmsQueue',_0x2520b3,JSON[_0x536b('0x16')](_0x4070f2));_0xd7a307(_0x4070f2);})[_0x536b('0x1a')](function(_0x25cd17){logger[_0x536b('0x17')](_0x536b('0x26'),_0x25cd17[_0x536b('0x19')],_0x2520b3);_0x10cddd(_0x3de2f8[_0x536b('0x17')](0x1f4,_0x25cd17[_0x536b('0x19')]));});});}; \ No newline at end of file +var _0x1fb8=['../../config/environment','client','redis','defaults','socket.io-emitter','./smsQueue.socket','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsQueue,\x20%s,\x20%s','result','catch','findAll','options','raw','where','limit','map','include','attributes','model','GetSmsQueue','ShowSmsQueue','SmsQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fb8,0xd7));var _0x81fb=function(_0x4ee799,_0x22e2c2){_0x4ee799=_0x4ee799-0x0;var _0x26fe5b=_0x1fb8[_0x4ee799];return _0x26fe5b;};'use strict';var _=require('lodash');var util=require(_0x81fb('0x0'));var moment=require('moment');var BPromise=require(_0x81fb('0x1'));var rs=require(_0x81fb('0x2'));var fs=require('fs');var Redis=require(_0x81fb('0x3'));var db=require(_0x81fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x81fb('0x5'))(_0x81fb('0x6'));var config=require(_0x81fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x81fb('0x8')]['http']({'port':0x232a});config[_0x81fb('0x9')]=_[_0x81fb('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81fb('0xb'))(new Redis(config['redis']));require(_0x81fb('0xc'))['register'](socket);function respondWithRpcPromise(_0x127196,_0x257f17,_0x48f8ab){return new BPromise(function(_0x41271f,_0x3c02dd){return client[_0x81fb('0xd')](_0x127196,_0x48f8ab)['then'](function(_0x58361c){logger[_0x81fb('0xe')]('SmsQueue,\x20%s,\x20%s',_0x257f17,_0x81fb('0xf'));logger[_0x81fb('0x10')](_0x81fb('0x11'),_0x257f17,'request\x20sent',JSON[_0x81fb('0x12')](_0x58361c));if(_0x58361c[_0x81fb('0x13')]){if(_0x58361c[_0x81fb('0x13')]['code']===0x1f4){logger[_0x81fb('0x13')]('SmsQueue,\x20%s,\x20%s',_0x257f17,_0x58361c['error'][_0x81fb('0x14')]);return _0x3c02dd(_0x58361c[_0x81fb('0x13')][_0x81fb('0x14')]);}logger[_0x81fb('0x13')](_0x81fb('0x15'),_0x257f17,_0x58361c[_0x81fb('0x13')][_0x81fb('0x14')]);return _0x41271f(_0x58361c[_0x81fb('0x13')][_0x81fb('0x14')]);}else{logger['info'](_0x81fb('0x15'),_0x257f17,_0x81fb('0xf'));_0x41271f(_0x58361c[_0x81fb('0x16')][_0x81fb('0x14')]);}})[_0x81fb('0x17')](function(_0x3eca53){logger['error']('SmsQueue,\x20%s,\x20%s',_0x257f17,_0x3eca53);_0x3c02dd(_0x3eca53);});});}exports['GetSmsQueue']=function(_0x3dd853){var _0xc6d95b=this;return new Promise(function(_0x587ed9,_0xacaeb7){return db['SmsQueue'][_0x81fb('0x18')]({'raw':_0x3dd853[_0x81fb('0x19')]?_0x3dd853[_0x81fb('0x19')][_0x81fb('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dd853[_0x81fb('0x19')]?_0x3dd853[_0x81fb('0x19')][_0x81fb('0x1b')]||null:null,'attributes':_0x3dd853[_0x81fb('0x19')]?_0x3dd853[_0x81fb('0x19')]['attributes']||null:null,'limit':_0x3dd853[_0x81fb('0x19')]?_0x3dd853[_0x81fb('0x19')][_0x81fb('0x1c')]||null:null,'include':_0x3dd853[_0x81fb('0x19')]?_0x3dd853[_0x81fb('0x19')]['include']?_[_0x81fb('0x1d')](_0x3dd853[_0x81fb('0x19')][_0x81fb('0x1e')],function(_0x195c0f){return{'model':db[_0x195c0f['model']],'as':_0x195c0f['as'],'attributes':_0x195c0f[_0x81fb('0x1f')],'include':_0x195c0f[_0x81fb('0x1e')]?_['map'](_0x195c0f['include'],function(_0x4dce84){return{'model':db[_0x4dce84[_0x81fb('0x20')]],'as':_0x4dce84['as'],'attributes':_0x4dce84['attributes'],'include':_0x4dce84[_0x81fb('0x1e')]?_[_0x81fb('0x1d')](_0x4dce84[_0x81fb('0x1e')],function(_0x47d956){return{'model':db[_0x47d956[_0x81fb('0x20')]],'as':_0x47d956['as'],'attributes':_0x47d956[_0x81fb('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fbbbf){logger['info'](_0x81fb('0x21'),_0x3dd853);logger[_0x81fb('0x10')]('GetSmsQueue',_0x3dd853,JSON[_0x81fb('0x12')](_0x2fbbbf));_0x587ed9(_0x2fbbbf);})[_0x81fb('0x17')](function(_0x334d6a){logger[_0x81fb('0x13')](_0x81fb('0x21'),_0x334d6a['message'],_0x3dd853);_0xacaeb7(_0xc6d95b['error'](0x1f4,_0x334d6a[_0x81fb('0x14')]));});});};exports[_0x81fb('0x22')]=function(_0x1da6b8){var _0x19aa3b=this;return new Promise(function(_0x3c39fe,_0x574b50){return db[_0x81fb('0x23')][_0x81fb('0x24')]({'raw':_0x1da6b8[_0x81fb('0x19')]?_0x1da6b8[_0x81fb('0x19')][_0x81fb('0x1a')]===undefined?!![]:![]:!![],'where':_0x1da6b8['options']?_0x1da6b8['options'][_0x81fb('0x1b')]||null:null,'attributes':_0x1da6b8[_0x81fb('0x19')]?_0x1da6b8['options'][_0x81fb('0x1f')]||null:null,'include':_0x1da6b8[_0x81fb('0x19')]?_0x1da6b8[_0x81fb('0x19')][_0x81fb('0x1e')]?_[_0x81fb('0x1d')](_0x1da6b8['options'][_0x81fb('0x1e')],function(_0x290132){return{'model':db[_0x290132[_0x81fb('0x20')]],'as':_0x290132['as'],'attributes':_0x290132[_0x81fb('0x1f')],'include':_0x290132['include']?_['map'](_0x290132[_0x81fb('0x1e')],function(_0x5267f1){return{'model':db[_0x5267f1[_0x81fb('0x20')]],'as':_0x5267f1['as'],'attributes':_0x5267f1[_0x81fb('0x1f')],'include':_0x5267f1['include']?_[_0x81fb('0x1d')](_0x5267f1[_0x81fb('0x1e')],function(_0x6807d5){return{'model':db[_0x6807d5[_0x81fb('0x20')]],'as':_0x6807d5['as'],'attributes':_0x6807d5[_0x81fb('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c0c4d){logger[_0x81fb('0xe')](_0x81fb('0x22'),_0x1da6b8);logger[_0x81fb('0x10')](_0x81fb('0x22'),_0x1da6b8,JSON[_0x81fb('0x12')](_0x3c0c4d));_0x3c39fe(_0x3c0c4d);})[_0x81fb('0x17')](function(_0x43a81d){logger[_0x81fb('0x13')]('ShowSmsQueue',_0x43a81d[_0x81fb('0x14')],_0x1da6b8);_0x574b50(_0x19aa3b['error'](0x1f4,_0x43a81d[_0x81fb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0cc8b53..95d92cb 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 _0xd313=['./smsQueue.events','save','update','emit','register','length','smsQueue:'];(function(_0x2a988b,_0x10f43c){var _0x161e23=function(_0x4c5765){while(--_0x4c5765){_0x2a988b['push'](_0x2a988b['shift']());}};_0x161e23(++_0x10f43c);}(_0xd313,0xa8));var _0x3d31=function(_0x289541,_0x507837){_0x289541=_0x289541-0x0;var _0x28de6e=_0xd313[_0x289541];return _0x28de6e;};'use strict';var SmsQueueEvents=require(_0x3d31('0x0'));var events=[_0x3d31('0x1'),'remove',_0x3d31('0x2')];function createListener(_0x420a46,_0x135012){return function(_0x241971){_0x135012[_0x3d31('0x3')](_0x420a46,_0x241971);};}function removeListener(_0x3a658a,_0x43e496){return function(){SmsQueueEvents['removeListener'](_0x3a658a,_0x43e496);};}exports[_0x3d31('0x4')]=function(_0x29e0fb){for(var _0x5b1a7b=0x0,_0x2d5e67=events[_0x3d31('0x5')];_0x5b1a7b<_0x2d5e67;_0x5b1a7b++){var _0x460678=events[_0x5b1a7b];var _0x19d440=createListener(_0x3d31('0x6')+_0x460678,_0x29e0fb);SmsQueueEvents['on'](_0x460678,_0x19d440);}}; \ No newline at end of file +var _0x9b10=['removeListener','length','./smsQueue.events','remove','update','emit'];(function(_0x1be0fb,_0x4c0c9c){var _0x248ec6=function(_0x29f00f){while(--_0x29f00f){_0x1be0fb['push'](_0x1be0fb['shift']());}};_0x248ec6(++_0x4c0c9c);}(_0x9b10,0x18e));var _0x09b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9b10[_0x167cc1];return _0x10bc4b;};'use strict';var SmsQueueEvents=require(_0x09b1('0x0'));var events=['save',_0x09b1('0x1'),_0x09b1('0x2')];function createListener(_0x88bb2d,_0x398e42){return function(_0x2ed84d){_0x398e42[_0x09b1('0x3')](_0x88bb2d,_0x2ed84d);};}function removeListener(_0x564661,_0x59d6ca){return function(){SmsQueueEvents[_0x09b1('0x4')](_0x564661,_0x59d6ca);};}exports['register']=function(_0x3af227){for(var _0x3f306c=0x0,_0x2fd5f5=events[_0x09b1('0x5')];_0x3f306c<_0x2fd5f5;_0x3f306c++){var _0x5472d3=events[_0x3f306c];var _0x5e7c8a=createListener('smsQueue:'+_0x5472d3,_0x3af227);SmsQueueEvents['on'](_0x5472d3,_0x5e7c8a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 93f12db..d482dad 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 _0x805b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c566a,_0x317001){var _0x33a0b5=function(_0x24178a){while(--_0x24178a){_0x4c566a['push'](_0x4c566a['shift']());}};_0x33a0b5(++_0x317001);}(_0x805b,0xad));var _0xb805=function(_0x5b9256,_0x1eed86){_0x5b9256=_0x5b9256-0x0;var _0x1da886=_0x805b[_0x5b9256];return _0x1da886;};'use strict';var multer=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var path=require(_0xb805('0x2'));var timeout=require(_0xb805('0x3'));var express=require(_0xb805('0x4'));var router=express[_0xb805('0x5')]();var fs_extra=require(_0xb805('0x6'));var auth=require(_0xb805('0x7'));var interaction=require(_0xb805('0x8'));var config=require(_0xb805('0x9'));var controller=require('./smsQueueReport.controller');router[_0xb805('0xa')]('/',auth[_0xb805('0xb')](),controller['index']);router[_0xb805('0xa')](_0xb805('0xc'),auth['isAuthenticated'](),controller[_0xb805('0xd')]);router[_0xb805('0xa')](_0xb805('0xe'),auth[_0xb805('0xb')](),controller[_0xb805('0xf')]);router[_0xb805('0x10')]('/',auth[_0xb805('0xb')](),controller['create']);router['put']('/:id',auth[_0xb805('0xb')](),controller['update']);router[_0xb805('0x11')](_0xb805('0xe'),auth[_0xb805('0xb')](),controller[_0xb805('0x12')]);module[_0xb805('0x13')]=router; \ No newline at end of file +var _0x4250=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x437bf5,_0x12de66){var _0x3a963c=function(_0x201758){while(--_0x201758){_0x437bf5['push'](_0x437bf5['shift']());}};_0x3a963c(++_0x12de66);}(_0x4250,0x146));var _0x0425=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4250[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var path=require(_0x0425('0x2'));var timeout=require(_0x0425('0x3'));var express=require('express');var router=express[_0x0425('0x4')]();var fs_extra=require(_0x0425('0x5'));var auth=require(_0x0425('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0425('0x7'));var controller=require(_0x0425('0x8'));router[_0x0425('0x9')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0xb')]);router[_0x0425('0x9')](_0x0425('0xc'),auth[_0x0425('0xa')](),controller[_0x0425('0xd')]);router[_0x0425('0x9')](_0x0425('0xe'),auth[_0x0425('0xa')](),controller[_0x0425('0xf')]);router[_0x0425('0x10')]('/',auth[_0x0425('0xa')](),controller[_0x0425('0x11')]);router[_0x0425('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0425('0x13')]);router['delete'](_0x0425('0xe'),auth[_0x0425('0xa')](),controller['destroy']);module[_0x0425('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b0ace7f..9080d44 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 _0xa009=['sequelize','exports','STRING','DATE','moment'];(function(_0x5eadc9,_0x579811){var _0x1895f1=function(_0x447ae0){while(--_0x447ae0){_0x5eadc9['push'](_0x5eadc9['shift']());}};_0x1895f1(++_0x579811);}(_0xa009,0x13a));var _0x9a00=function(_0x4238f1,_0x40e962){_0x4238f1=_0x4238f1-0x0;var _0x5924ac=_0xa009[_0x4238f1];return _0x5924ac;};'use strict';var moment=require(_0x9a00('0x0'));var Sequelize=require(_0x9a00('0x1'));module[_0x9a00('0x2')]={'uniqueid':{'type':Sequelize[_0x9a00('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9a00('0x3')]},'joinAt':{'type':Sequelize[_0x9a00('0x4')]},'leaveAt':{'type':Sequelize[_0x9a00('0x4')]},'acceptAt':{'type':Sequelize[_0x9a00('0x4')]},'exitAt':{'type':Sequelize[_0x9a00('0x4')]},'reason':{'type':Sequelize[_0x9a00('0x3')]}}; \ No newline at end of file +var _0x768e=['moment','sequelize','exports','STRING','DATE'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x768e,0x9b));var _0xe768=function(_0x1c0856,_0x49104b){_0x1c0856=_0x1c0856-0x0;var _0x3557e2=_0x768e[_0x1c0856];return _0x3557e2;};'use strict';var moment=require(_0xe768('0x0'));var Sequelize=require(_0xe768('0x1'));module[_0xe768('0x2')]={'uniqueid':{'type':Sequelize[_0xe768('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe768('0x3')]},'joinAt':{'type':Sequelize[_0xe768('0x4')]},'leaveAt':{'type':Sequelize[_0xe768('0x4')]},'acceptAt':{'type':Sequelize[_0xe768('0x4')]},'exitAt':{'type':Sequelize[_0xe768('0x4')]},'reason':{'type':Sequelize[_0xe768('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 936611e..7c6ab65 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 _0x3642=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x4e12ef,_0x5916c8){var _0x486512=function(_0xc43f91){while(--_0xc43f91){_0x4e12ef['push'](_0x4e12ef['shift']());}};_0x486512(++_0x5916c8);}(_0x3642,0x166));var _0x2364=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x3642[_0x3f9584];return _0x9d54c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2364('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2364('0x1'));var rp=require(_0x2364('0x2'));var moment=require('moment');var BPromise=require(_0x2364('0x3'));var Mustache=require(_0x2364('0x4'));var util=require(_0x2364('0x5'));var path=require(_0x2364('0x6'));var sox=require(_0x2364('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2364('0x8'));var _=require(_0x2364('0x9'));var squel=require(_0x2364('0xa'));var crypto=require(_0x2364('0xb'));var jsforce=require(_0x2364('0xc'));var deskjs=require(_0x2364('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2364('0xe'));var Redis=require(_0x2364('0xf'));var authService=require(_0x2364('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2364('0x11'));var hardwareService=require(_0x2364('0x12'));var logger=require(_0x2364('0x13'))(_0x2364('0x14'));var utils=require('../../config/utils');var config=require(_0x2364('0x15'));var licenseUtil=require(_0x2364('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x157eb7,_0x6623b){_0x6623b=_0x6623b||0xcc;return function(_0x5b97b9){if(_0x5b97b9){return _0x157eb7[_0x2364('0x17')](_0x6623b);}return _0x157eb7[_0x2364('0x18')](_0x6623b)[_0x2364('0x19')]();};}function respondWithResult(_0x4dab7a,_0x5b884c){_0x5b884c=_0x5b884c||0xc8;return function(_0x3bd932){if(_0x3bd932){return _0x4dab7a[_0x2364('0x18')](_0x5b884c)[_0x2364('0x1a')](_0x3bd932);}};}function respondWithFilteredResult(_0x4c7c9d,_0x149630){return function(_0x360cc3){if(_0x360cc3){var _0x19598b=typeof _0x149630['offset']===_0x2364('0x1b')&&typeof _0x149630['limit']===_0x2364('0x1b');var _0x3a3afe=_0x360cc3[_0x2364('0x1c')];var _0x16bb40=_0x19598b?0x0:_0x149630['offset'];var _0x1345cc=_0x19598b?_0x360cc3[_0x2364('0x1c')]:_0x149630[_0x2364('0x1d')]+_0x149630[_0x2364('0x1e')];var _0x2a0813;if(_0x1345cc>=_0x3a3afe){_0x1345cc=_0x3a3afe;_0x2a0813=0xc8;}else{_0x2a0813=0xce;}_0x4c7c9d[_0x2364('0x18')](_0x2a0813);return _0x4c7c9d[_0x2364('0x1f')](_0x2364('0x20'),_0x16bb40+'-'+_0x1345cc+'/'+_0x3a3afe)[_0x2364('0x1a')](_0x360cc3);}return null;};}function patchUpdates(_0x4faea2){return function(_0x163cc4){try{jsonpatch['apply'](_0x163cc4,_0x4faea2,!![]);}catch(_0x3b12bf){return BPromise[_0x2364('0x21')](_0x3b12bf);}return _0x163cc4['save']();};}function saveUpdates(_0x4768f5,_0x43cb6f){return function(_0x3238de){if(_0x3238de){return _0x3238de[_0x2364('0x22')](_0x4768f5)[_0x2364('0x23')](function(_0x3895e3){return _0x3895e3;});}return null;};}function removeEntity(_0x4969c7,_0x59f2d3){return function(_0x4dfa9b){if(_0x4dfa9b){return _0x4dfa9b[_0x2364('0x24')]()['then'](function(){_0x4969c7[_0x2364('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422460,_0x481ac4){return function(_0x149b38){if(!_0x149b38){_0x422460[_0x2364('0x17')](0x194);}return _0x149b38;};}function handleError(_0x100989,_0x309ae2){_0x309ae2=_0x309ae2||0x1f4;return function(_0x46131c){logger[_0x2364('0x25')](_0x46131c[_0x2364('0x26')]);if(_0x46131c['name']){delete _0x46131c[_0x2364('0x27')];}_0x100989[_0x2364('0x18')](_0x309ae2)[_0x2364('0x28')](_0x46131c);};}exports[_0x2364('0x29')]=function(_0xa0fe4d,_0x56c33e){var _0xf3c425={},_0x51f4bb={},_0x7e0538={'count':0x0,'rows':[]};var _0x3dffae=_['map'](db[_0x2364('0x2a')][_0x2364('0x2b')],function(_0xd2f961){return{'name':_0xd2f961['fieldName'],'type':_0xd2f961['type']['key']};});_0x51f4bb[_0x2364('0x2c')]=_[_0x2364('0x2d')](_0x3dffae,'name');_0x51f4bb[_0x2364('0x2e')]=_[_0x2364('0x2f')](_0xa0fe4d[_0x2364('0x2e')]);_0x51f4bb[_0x2364('0x30')]=_[_0x2364('0x31')](_0x51f4bb[_0x2364('0x2c')],_0x51f4bb[_0x2364('0x2e')]);_0xf3c425[_0x2364('0x32')]=_[_0x2364('0x31')](_0x51f4bb[_0x2364('0x2c')],qs[_0x2364('0x33')](_0xa0fe4d[_0x2364('0x2e')]['fields']));_0xf3c425[_0x2364('0x32')]=_0xf3c425['attributes'][_0x2364('0x34')]?_0xf3c425[_0x2364('0x32')]:_0x51f4bb[_0x2364('0x2c')];if(!_0xa0fe4d['query'][_0x2364('0x35')](_0x2364('0x36'))){_0xf3c425[_0x2364('0x1e')]=qs[_0x2364('0x1e')](_0xa0fe4d['query'][_0x2364('0x1e')]);_0xf3c425[_0x2364('0x1d')]=qs[_0x2364('0x1d')](_0xa0fe4d[_0x2364('0x2e')]['offset']);}_0xf3c425[_0x2364('0x37')]=qs[_0x2364('0x38')](_0xa0fe4d[_0x2364('0x2e')][_0x2364('0x38')]);_0xf3c425[_0x2364('0x39')]=qs[_0x2364('0x30')](_[_0x2364('0x3a')](_0xa0fe4d[_0x2364('0x2e')],_0x51f4bb['filters']),_0x3dffae);if(_0xa0fe4d[_0x2364('0x2e')][_0x2364('0x3b')]){_0xf3c425['where']=_[_0x2364('0x3c')](_0xf3c425['where'],{'$or':_[_0x2364('0x2d')](_0x3dffae,function(_0x5468d6){if(_0x5468d6[_0x2364('0x3d')]!==_0x2364('0x3e')){var _0x22b9ed={};_0x22b9ed[_0x5468d6['name']]={'$like':'%'+_0xa0fe4d[_0x2364('0x2e')][_0x2364('0x3b')]+'%'};return _0x22b9ed;}})});}_0xf3c425=_[_0x2364('0x3c')]({},_0xf3c425,_0xa0fe4d[_0x2364('0x3f')]);var _0x4917e8={'where':_0xf3c425['where']};return db[_0x2364('0x2a')][_0x2364('0x1c')](_0x4917e8)[_0x2364('0x23')](function(_0x5b182a){_0x7e0538[_0x2364('0x1c')]=_0x5b182a;if(_0xa0fe4d[_0x2364('0x2e')][_0x2364('0x40')]){_0xf3c425[_0x2364('0x41')]=[{'all':!![]}];}return db[_0x2364('0x2a')][_0x2364('0x42')](_0xf3c425);})[_0x2364('0x23')](function(_0x1c50d7){_0x7e0538[_0x2364('0x43')]=_0x1c50d7;return _0x7e0538;})[_0x2364('0x23')](respondWithFilteredResult(_0x56c33e,_0xf3c425))[_0x2364('0x44')](handleError(_0x56c33e,null));};exports['show']=function(_0x2401cf,_0x35dfeb){var _0x5d7833={'raw':!![],'where':{'id':_0x2401cf['params']['id']}},_0x2462c1={};_0x2462c1['model']=_['keys'](db[_0x2364('0x2a')][_0x2364('0x2b')]);_0x2462c1[_0x2364('0x2e')]=_[_0x2364('0x2f')](_0x2401cf[_0x2364('0x2e')]);_0x2462c1[_0x2364('0x30')]=_[_0x2364('0x31')](_0x2462c1['model'],_0x2462c1[_0x2364('0x2e')]);_0x5d7833[_0x2364('0x32')]=_[_0x2364('0x31')](_0x2462c1[_0x2364('0x2c')],qs[_0x2364('0x33')](_0x2401cf[_0x2364('0x2e')]['fields']));_0x5d7833['attributes']=_0x5d7833[_0x2364('0x32')][_0x2364('0x34')]?_0x5d7833[_0x2364('0x32')]:_0x2462c1[_0x2364('0x2c')];if(_0x2401cf[_0x2364('0x2e')]['includeAll']){_0x5d7833['include']=[{'all':!![]}];}_0x5d7833=_['merge']({},_0x5d7833,_0x2401cf['options']);return db[_0x2364('0x2a')][_0x2364('0x45')](_0x5d7833)[_0x2364('0x23')](handleEntityNotFound(_0x35dfeb,null))[_0x2364('0x23')](respondWithResult(_0x35dfeb,null))[_0x2364('0x44')](handleError(_0x35dfeb,null));};exports[_0x2364('0x46')]=function(_0x15a524,_0x480260){return db['SmsQueueReport'][_0x2364('0x46')](_0x15a524['body'],{})[_0x2364('0x23')](respondWithResult(_0x480260,0xc9))['catch'](handleError(_0x480260,null));};exports[_0x2364('0x22')]=function(_0x34635f,_0x4eb13c){if(_0x34635f[_0x2364('0x47')]['id']){delete _0x34635f[_0x2364('0x47')]['id'];}return db[_0x2364('0x2a')]['find']({'where':{'id':_0x34635f[_0x2364('0x48')]['id']}})[_0x2364('0x23')](handleEntityNotFound(_0x4eb13c,null))['then'](saveUpdates(_0x34635f['body'],null))[_0x2364('0x23')](respondWithResult(_0x4eb13c,null))[_0x2364('0x44')](handleError(_0x4eb13c,null));};exports[_0x2364('0x24')]=function(_0x10e946,_0x3223c1){return db[_0x2364('0x2a')]['find']({'where':{'id':_0x10e946[_0x2364('0x48')]['id']}})[_0x2364('0x23')](handleEntityNotFound(_0x3223c1,null))[_0x2364('0x23')](removeEntity(_0x3223c1,null))['catch'](handleError(_0x3223c1,null));};exports[_0x2364('0x49')]=function(_0x4c00e0,_0x5b1e65){return db[_0x2364('0x2a')][_0x2364('0x49')]()[_0x2364('0x23')](respondWithResult(_0x5b1e65,null))[_0x2364('0x44')](handleError(_0x5b1e65,null));}; \ No newline at end of file +var _0xc8fb=['path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','rimraf','moment','bluebird','util'];(function(_0x19109a,_0x4a6c9a){var _0x23ba0e=function(_0x173d67){while(--_0x173d67){_0x19109a['push'](_0x19109a['shift']());}};_0x23ba0e(++_0x4a6c9a);}(_0xc8fb,0x124));var _0xbc8f=function(_0x335720,_0x33a8b5){_0x335720=_0x335720-0x0;var _0x14c7bd=_0xc8fb[_0x335720];return _0x14c7bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc8f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbc8f('0x1'));var BPromise=require(_0xbc8f('0x2'));var Mustache=require('mustache');var util=require(_0xbc8f('0x3'));var path=require(_0xbc8f('0x4'));var sox=require(_0xbc8f('0x5'));var csv=require('to-csv');var ejs=require(_0xbc8f('0x6'));var fs=require('fs');var fs_extra=require(_0xbc8f('0x7'));var _=require(_0xbc8f('0x8'));var squel=require(_0xbc8f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc8f('0xa'));var toCsv=require(_0xbc8f('0xb'));var querystring=require('querystring');var Papa=require(_0xbc8f('0xc'));var Redis=require(_0xbc8f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc8f('0xe'));var as=require(_0xbc8f('0xf'));var hardwareService=require(_0xbc8f('0x10'));var logger=require(_0xbc8f('0x11'))(_0xbc8f('0x12'));var utils=require(_0xbc8f('0x13'));var config=require(_0xbc8f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc8f('0x15'))['db'];function respondWithStatusCode(_0x214264,_0x30aec9){_0x30aec9=_0x30aec9||0xcc;return function(_0x47c003){if(_0x47c003){return _0x214264['sendStatus'](_0x30aec9);}return _0x214264[_0xbc8f('0x16')](_0x30aec9)['end']();};}function respondWithResult(_0x30ab64,_0x2e6003){_0x2e6003=_0x2e6003||0xc8;return function(_0x48ccb9){if(_0x48ccb9){return _0x30ab64[_0xbc8f('0x16')](_0x2e6003)['json'](_0x48ccb9);}};}function respondWithFilteredResult(_0x52056c,_0x2aa8aa){return function(_0x4b50b7){if(_0x4b50b7){var _0x48afdf=typeof _0x2aa8aa[_0xbc8f('0x17')]==='undefined'&&typeof _0x2aa8aa['limit']===_0xbc8f('0x18');var _0x3497aa=_0x4b50b7['count'];var _0x1b1927=_0x48afdf?0x0:_0x2aa8aa['offset'];var _0x58c77d=_0x48afdf?_0x4b50b7[_0xbc8f('0x19')]:_0x2aa8aa[_0xbc8f('0x17')]+_0x2aa8aa[_0xbc8f('0x1a')];var _0x67c1c1;if(_0x58c77d>=_0x3497aa){_0x58c77d=_0x3497aa;_0x67c1c1=0xc8;}else{_0x67c1c1=0xce;}_0x52056c[_0xbc8f('0x16')](_0x67c1c1);return _0x52056c['set'](_0xbc8f('0x1b'),_0x1b1927+'-'+_0x58c77d+'/'+_0x3497aa)[_0xbc8f('0x1c')](_0x4b50b7);}return null;};}function patchUpdates(_0x3e9fdf){return function(_0x53fbd2){try{jsonpatch[_0xbc8f('0x1d')](_0x53fbd2,_0x3e9fdf,!![]);}catch(_0x9ecf27){return BPromise['reject'](_0x9ecf27);}return _0x53fbd2['save']();};}function saveUpdates(_0x147ead,_0x328221){return function(_0x39d2f1){if(_0x39d2f1){return _0x39d2f1[_0xbc8f('0x1e')](_0x147ead)[_0xbc8f('0x1f')](function(_0x4831c8){return _0x4831c8;});}return null;};}function removeEntity(_0x176eb3,_0x268d86){return function(_0x1a9075){if(_0x1a9075){return _0x1a9075[_0xbc8f('0x20')]()[_0xbc8f('0x1f')](function(){_0x176eb3['status'](0xcc)[_0xbc8f('0x21')]();});}};}function handleEntityNotFound(_0x3d7156,_0x477a70){return function(_0x1463e7){if(!_0x1463e7){_0x3d7156[_0xbc8f('0x22')](0x194);}return _0x1463e7;};}function handleError(_0x731341,_0x162360){_0x162360=_0x162360||0x1f4;return function(_0x4346a1){logger[_0xbc8f('0x23')](_0x4346a1[_0xbc8f('0x24')]);if(_0x4346a1[_0xbc8f('0x25')]){delete _0x4346a1['name'];}_0x731341[_0xbc8f('0x16')](_0x162360)[_0xbc8f('0x26')](_0x4346a1);};}exports[_0xbc8f('0x27')]=function(_0x1c46ea,_0x593542){var _0x4850cd={},_0xce8ace={},_0x5230b6={'count':0x0,'rows':[]};var _0x4233eb=_[_0xbc8f('0x28')](db[_0xbc8f('0x29')][_0xbc8f('0x2a')],function(_0x50d957){return{'name':_0x50d957[_0xbc8f('0x2b')],'type':_0x50d957['type'][_0xbc8f('0x2c')]};});_0xce8ace['model']=_[_0xbc8f('0x28')](_0x4233eb,_0xbc8f('0x25'));_0xce8ace['query']=_[_0xbc8f('0x2d')](_0x1c46ea[_0xbc8f('0x2e')]);_0xce8ace[_0xbc8f('0x2f')]=_['intersection'](_0xce8ace['model'],_0xce8ace[_0xbc8f('0x2e')]);_0x4850cd[_0xbc8f('0x30')]=_[_0xbc8f('0x31')](_0xce8ace[_0xbc8f('0x32')],qs['fields'](_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x33')]));_0x4850cd[_0xbc8f('0x30')]=_0x4850cd[_0xbc8f('0x30')]['length']?_0x4850cd['attributes']:_0xce8ace[_0xbc8f('0x32')];if(!_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x34')](_0xbc8f('0x35'))){_0x4850cd[_0xbc8f('0x1a')]=qs['limit'](_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x1a')]);_0x4850cd[_0xbc8f('0x17')]=qs['offset'](_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x17')]);}_0x4850cd[_0xbc8f('0x36')]=qs[_0xbc8f('0x37')](_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x37')]);_0x4850cd[_0xbc8f('0x38')]=qs[_0xbc8f('0x2f')](_[_0xbc8f('0x39')](_0x1c46ea[_0xbc8f('0x2e')],_0xce8ace['filters']),_0x4233eb);if(_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x3a')]){_0x4850cd[_0xbc8f('0x38')]=_[_0xbc8f('0x3b')](_0x4850cd[_0xbc8f('0x38')],{'$or':_[_0xbc8f('0x28')](_0x4233eb,function(_0x11bfa4){if(_0x11bfa4[_0xbc8f('0x3c')]!==_0xbc8f('0x3d')){var _0xfe718e={};_0xfe718e[_0x11bfa4[_0xbc8f('0x25')]]={'$like':'%'+_0x1c46ea[_0xbc8f('0x2e')]['filter']+'%'};return _0xfe718e;}})});}_0x4850cd=_[_0xbc8f('0x3b')]({},_0x4850cd,_0x1c46ea['options']);var _0xb1e54c={'where':_0x4850cd[_0xbc8f('0x38')]};return db[_0xbc8f('0x29')]['count'](_0xb1e54c)[_0xbc8f('0x1f')](function(_0x23cfef){_0x5230b6[_0xbc8f('0x19')]=_0x23cfef;if(_0x1c46ea[_0xbc8f('0x2e')][_0xbc8f('0x3e')]){_0x4850cd[_0xbc8f('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x4850cd);})['then'](function(_0xfa55a3){_0x5230b6[_0xbc8f('0x40')]=_0xfa55a3;return _0x5230b6;})[_0xbc8f('0x1f')](respondWithFilteredResult(_0x593542,_0x4850cd))[_0xbc8f('0x41')](handleError(_0x593542,null));};exports[_0xbc8f('0x42')]=function(_0x5a62ed,_0x93e768){var _0x45c855={'raw':!![],'where':{'id':_0x5a62ed[_0xbc8f('0x43')]['id']}},_0x2a1c1c={};_0x2a1c1c[_0xbc8f('0x32')]=_[_0xbc8f('0x2d')](db['SmsQueueReport']['rawAttributes']);_0x2a1c1c[_0xbc8f('0x2e')]=_['keys'](_0x5a62ed[_0xbc8f('0x2e')]);_0x2a1c1c[_0xbc8f('0x2f')]=_[_0xbc8f('0x31')](_0x2a1c1c[_0xbc8f('0x32')],_0x2a1c1c['query']);_0x45c855[_0xbc8f('0x30')]=_[_0xbc8f('0x31')](_0x2a1c1c['model'],qs[_0xbc8f('0x33')](_0x5a62ed[_0xbc8f('0x2e')][_0xbc8f('0x33')]));_0x45c855[_0xbc8f('0x30')]=_0x45c855[_0xbc8f('0x30')][_0xbc8f('0x44')]?_0x45c855['attributes']:_0x2a1c1c[_0xbc8f('0x32')];if(_0x5a62ed[_0xbc8f('0x2e')][_0xbc8f('0x3e')]){_0x45c855[_0xbc8f('0x3f')]=[{'all':!![]}];}_0x45c855=_['merge']({},_0x45c855,_0x5a62ed[_0xbc8f('0x45')]);return db[_0xbc8f('0x29')][_0xbc8f('0x46')](_0x45c855)[_0xbc8f('0x1f')](handleEntityNotFound(_0x93e768,null))[_0xbc8f('0x1f')](respondWithResult(_0x93e768,null))['catch'](handleError(_0x93e768,null));};exports['create']=function(_0x57bf7b,_0x17cc5c){return db[_0xbc8f('0x29')][_0xbc8f('0x47')](_0x57bf7b[_0xbc8f('0x48')],{})[_0xbc8f('0x1f')](respondWithResult(_0x17cc5c,0xc9))['catch'](handleError(_0x17cc5c,null));};exports[_0xbc8f('0x1e')]=function(_0xa453c3,_0x1300f8){if(_0xa453c3[_0xbc8f('0x48')]['id']){delete _0xa453c3[_0xbc8f('0x48')]['id'];}return db[_0xbc8f('0x29')][_0xbc8f('0x46')]({'where':{'id':_0xa453c3[_0xbc8f('0x43')]['id']}})[_0xbc8f('0x1f')](handleEntityNotFound(_0x1300f8,null))[_0xbc8f('0x1f')](saveUpdates(_0xa453c3[_0xbc8f('0x48')],null))[_0xbc8f('0x1f')](respondWithResult(_0x1300f8,null))[_0xbc8f('0x41')](handleError(_0x1300f8,null));};exports[_0xbc8f('0x20')]=function(_0x1e5c42,_0x596b07){return db[_0xbc8f('0x29')]['find']({'where':{'id':_0x1e5c42[_0xbc8f('0x43')]['id']}})['then'](handleEntityNotFound(_0x596b07,null))[_0xbc8f('0x1f')](removeEntity(_0x596b07,null))[_0xbc8f('0x41')](handleError(_0x596b07,null));};exports[_0xbc8f('0x49')]=function(_0x28c8c4,_0x465bef){return db[_0xbc8f('0x29')][_0xbc8f('0x49')]()[_0xbc8f('0x1f')](respondWithResult(_0x465bef,null))['catch'](handleError(_0x465bef,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5b491c1..55cefe2 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x4ca6ab,_0x29bc6c){var _0x516678=function(_0x108d0e){while(--_0x108d0e){_0x4ca6ab['push'](_0x4ca6ab['shift']());}};_0x516678(++_0x29bc6c);}(_0xe706,0xa3));var _0x6e70=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xe706[_0x37b3e5];return _0x207f20;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8bee4f4..310b63f 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 _0x1906=['options','raw','UpdateSmsQueueReport','SmsQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','create','body'];(function(_0x1f45bd,_0x26b063){var _0x34b552=function(_0x3e8c15){while(--_0x3e8c15){_0x1f45bd['push'](_0x1f45bd['shift']());}};_0x34b552(++_0x26b063);}(_0x1906,0x6d));var _0x6190=function(_0x14fd10,_0x207b9a){_0x14fd10=_0x14fd10-0x0;var _0x323483=_0x1906[_0x14fd10];return _0x323483;};'use strict';var _=require(_0x6190('0x0'));var util=require(_0x6190('0x1'));var moment=require(_0x6190('0x2'));var BPromise=require(_0x6190('0x3'));var rs=require(_0x6190('0x4'));var fs=require('fs');var Redis=require(_0x6190('0x5'));var db=require(_0x6190('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6190('0x7'))(_0x6190('0x8'));var config=require('../../config/environment');var jayson=require(_0x6190('0x9'));var client=jayson['client'][_0x6190('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9876,_0x4f9bce,_0x3175be){return new BPromise(function(_0x3826df,_0x2246d4){return client[_0x6190('0xb')](_0x4a9876,_0x3175be)[_0x6190('0xc')](function(_0x16f8b2){logger['info'](_0x6190('0xd'),_0x4f9bce,_0x6190('0xe'));logger[_0x6190('0xf')](_0x6190('0x10'),_0x4f9bce,_0x6190('0xe'),JSON[_0x6190('0x11')](_0x16f8b2));if(_0x16f8b2['error']){if(_0x16f8b2[_0x6190('0x12')][_0x6190('0x13')]===0x1f4){logger['error'](_0x6190('0xd'),_0x4f9bce,_0x16f8b2[_0x6190('0x12')][_0x6190('0x14')]);return _0x2246d4(_0x16f8b2['error'][_0x6190('0x14')]);}logger[_0x6190('0x12')](_0x6190('0xd'),_0x4f9bce,_0x16f8b2['error']['message']);return _0x3826df(_0x16f8b2['error'][_0x6190('0x14')]);}else{logger[_0x6190('0x15')](_0x6190('0xd'),_0x4f9bce,_0x6190('0xe'));_0x3826df(_0x16f8b2[_0x6190('0x16')][_0x6190('0x14')]);}})[_0x6190('0x17')](function(_0x51b3cf){logger[_0x6190('0x12')](_0x6190('0xd'),_0x4f9bce,_0x51b3cf);_0x2246d4(_0x51b3cf);});});}exports[_0x6190('0x18')]=function(_0x5183cf){var _0x2d31f9=this;return new Promise(function(_0x7087f8,_0x47770e){return db['SmsQueueReport'][_0x6190('0x19')](_0x5183cf[_0x6190('0x1a')],{'raw':_0x5183cf[_0x6190('0x1b')]?_0x5183cf[_0x6190('0x1b')][_0x6190('0x1c')]===undefined?!![]:![]:!![]})[_0x6190('0xc')](function(_0x5f4ef3){logger[_0x6190('0x15')](_0x6190('0x18'),_0x5183cf);logger[_0x6190('0xf')](_0x6190('0x18'),_0x5183cf,JSON[_0x6190('0x11')](_0x5f4ef3));_0x7087f8(_0x5f4ef3);})[_0x6190('0x17')](function(_0x3378ff){logger[_0x6190('0x12')](_0x6190('0x18'),_0x3378ff['message'],_0x5183cf);_0x47770e(_0x2d31f9[_0x6190('0x12')](0x1f4,_0x3378ff[_0x6190('0x14')]));});});};exports[_0x6190('0x1d')]=function(_0xcd6d37){var _0x5610d9=this;return new Promise(function(_0xb0ffc6,_0x20fdfb){return db[_0x6190('0x1e')]['update'](_0xcd6d37[_0x6190('0x1a')],{'raw':_0xcd6d37[_0x6190('0x1b')]?_0xcd6d37[_0x6190('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd6d37[_0x6190('0x1b')]?_0xcd6d37[_0x6190('0x1b')][_0x6190('0x1f')]||null:null,'attributes':_0xcd6d37[_0x6190('0x1b')]?_0xcd6d37[_0x6190('0x1b')][_0x6190('0x20')]||null:null,'limit':_0xcd6d37[_0x6190('0x1b')]?_0xcd6d37[_0x6190('0x1b')][_0x6190('0x21')]||null:null})[_0x6190('0xc')](function(_0x3969dc){logger['info'](_0x6190('0x1d'),_0xcd6d37);logger['debug'](_0x6190('0x1d'),_0xcd6d37,JSON[_0x6190('0x11')](_0x3969dc));_0xb0ffc6(_0x3969dc);})['catch'](function(_0x39af56){logger[_0x6190('0x12')](_0x6190('0x1d'),_0x39af56[_0x6190('0x14')],_0xcd6d37);_0x20fdfb(_0x5610d9[_0x6190('0x12')](0x1f4,_0x39af56[_0x6190('0x14')]));});});}; \ No newline at end of file +var _0xca01=['error','code','message','result','catch','SmsQueueReport','create','body','options','debug','stringify','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0xe1ef1d,_0x51c03b){var _0x650f6b=function(_0x347649){while(--_0x347649){_0xe1ef1d['push'](_0xe1ef1d['shift']());}};_0x650f6b(++_0x51c03b);}(_0xca01,0xa3));var _0x1ca0=function(_0x1906f1,_0x5d9978){_0x1906f1=_0x1906f1-0x0;var _0x28ca50=_0xca01[_0x1906f1];return _0x28ca50;};'use strict';var _=require(_0x1ca0('0x0'));var util=require(_0x1ca0('0x1'));var moment=require(_0x1ca0('0x2'));var BPromise=require(_0x1ca0('0x3'));var rs=require(_0x1ca0('0x4'));var fs=require('fs');var Redis=require(_0x1ca0('0x5'));var db=require(_0x1ca0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca0('0x7'))(_0x1ca0('0x8'));var config=require(_0x1ca0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ca0('0xa')][_0x1ca0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d496b,_0x190a53,_0x113b2f){return new BPromise(function(_0x4ca7ce,_0x4a604b){return client[_0x1ca0('0xc')](_0x3d496b,_0x113b2f)['then'](function(_0x3169d6){logger[_0x1ca0('0xd')](_0x1ca0('0xe'),_0x190a53,_0x1ca0('0xf'));logger['debug'](_0x1ca0('0x10'),_0x190a53,_0x1ca0('0xf'),JSON['stringify'](_0x3169d6));if(_0x3169d6[_0x1ca0('0x11')]){if(_0x3169d6[_0x1ca0('0x11')][_0x1ca0('0x12')]===0x1f4){logger[_0x1ca0('0x11')](_0x1ca0('0xe'),_0x190a53,_0x3169d6[_0x1ca0('0x11')]['message']);return _0x4a604b(_0x3169d6[_0x1ca0('0x11')][_0x1ca0('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x190a53,_0x3169d6['error'][_0x1ca0('0x13')]);return _0x4ca7ce(_0x3169d6['error']['message']);}else{logger[_0x1ca0('0xd')](_0x1ca0('0xe'),_0x190a53,_0x1ca0('0xf'));_0x4ca7ce(_0x3169d6[_0x1ca0('0x14')][_0x1ca0('0x13')]);}})[_0x1ca0('0x15')](function(_0x53ff1e){logger[_0x1ca0('0x11')](_0x1ca0('0xe'),_0x190a53,_0x53ff1e);_0x4a604b(_0x53ff1e);});});}exports['CreateSmsQueueReport']=function(_0x55bc59){var _0xbeb9d3=this;return new Promise(function(_0x5a5328,_0x28473a){return db[_0x1ca0('0x16')][_0x1ca0('0x17')](_0x55bc59[_0x1ca0('0x18')],{'raw':_0x55bc59[_0x1ca0('0x19')]?_0x55bc59[_0x1ca0('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x46bbb0){logger['info']('CreateSmsQueueReport',_0x55bc59);logger[_0x1ca0('0x1a')]('CreateSmsQueueReport',_0x55bc59,JSON[_0x1ca0('0x1b')](_0x46bbb0));_0x5a5328(_0x46bbb0);})['catch'](function(_0x583034){logger[_0x1ca0('0x11')](_0x1ca0('0x1c'),_0x583034[_0x1ca0('0x13')],_0x55bc59);_0x28473a(_0xbeb9d3[_0x1ca0('0x11')](0x1f4,_0x583034['message']));});});};exports[_0x1ca0('0x1d')]=function(_0xb3d3c9){var _0x508494=this;return new Promise(function(_0x2c228a,_0x33526e){return db[_0x1ca0('0x16')][_0x1ca0('0x1e')](_0xb3d3c9['body'],{'raw':_0xb3d3c9[_0x1ca0('0x19')]?_0xb3d3c9[_0x1ca0('0x19')][_0x1ca0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb3d3c9[_0x1ca0('0x19')]?_0xb3d3c9['options'][_0x1ca0('0x20')]||null:null,'attributes':_0xb3d3c9[_0x1ca0('0x19')]?_0xb3d3c9[_0x1ca0('0x19')][_0x1ca0('0x21')]||null:null,'limit':_0xb3d3c9['options']?_0xb3d3c9[_0x1ca0('0x19')][_0x1ca0('0x22')]||null:null})[_0x1ca0('0x23')](function(_0x232287){logger['info']('UpdateSmsQueueReport',_0xb3d3c9);logger[_0x1ca0('0x1a')](_0x1ca0('0x1d'),_0xb3d3c9,JSON[_0x1ca0('0x1b')](_0x232287));_0x2c228a(_0x232287);})[_0x1ca0('0x15')](function(_0x24b3f0){logger[_0x1ca0('0x11')](_0x1ca0('0x1d'),_0x24b3f0[_0x1ca0('0x13')],_0xb3d3c9);_0x33526e(_0x508494[_0x1ca0('0x11')](0x1f4,_0x24b3f0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 05bc3c5..9cda6b0 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 _0x2d17=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2d17,0x17e));var _0x72d1=function(_0x31f52d,_0x5e84f5){_0x31f52d=_0x31f52d-0x0;var _0x1f2b67=_0x2d17[_0x31f52d];return _0x1f2b67;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./smsTransferReport.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xe')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x12')]);module[_0x72d1('0x13')]=router; \ No newline at end of file +var _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','describe'];(function(_0x18c2dd,_0x3ef55a){var _0x4b35c5=function(_0x3a89bf){while(--_0x3a89bf){_0x18c2dd['push'](_0x18c2dd['shift']());}};_0x4b35c5(++_0x3ef55a);}(_0x950a,0x111));var _0xa950=function(_0x376213,_0x5a0025){_0x376213=_0x376213-0x0;var _0x5ab0ca=_0x950a[_0x376213];return _0x5ab0ca;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('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 e59c4d0..630effb 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x52ac91,_0x5e1bfc){var _0x5abb38=function(_0x2ca78a){while(--_0x2ca78a){_0x52ac91['push'](_0x52ac91['shift']());}};_0x5abb38(++_0x5e1bfc);}(_0x008c,0x188));var _0xc008=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0x008c[_0x26c12e];return _0xbab0c7;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5d9c71,_0x5b0d3d){_0x5d9c71=_0x5d9c71-0x0;var _0x4b820e=_0x9bde[_0x5d9c71];return _0x4b820e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7ae4a6d..d9a9650 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 _0x1e3f=['type','map','query','keys','filters','fields','attributes','model','nolimit','order','sort','where','merge','filter','options','SmsTransferReport','findAll','rows','catch','show','params','intersection','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','rawAttributes','fieldName'];(function(_0x59603d,_0x194217){var _0x7d3482=function(_0x1fd14c){while(--_0x1fd14c){_0x59603d['push'](_0x59603d['shift']());}};_0x7d3482(++_0x194217);}(_0x1e3f,0xad));var _0xf1e3=function(_0x20be28,_0x24b925){_0x20be28=_0x20be28-0x0;var _0x8ab067=_0x1e3f[_0x20be28];return _0x8ab067;};'use strict';var emlformat=require(_0xf1e3('0x0'));var rimraf=require(_0xf1e3('0x1'));var zipdir=require(_0xf1e3('0x2'));var jsonpatch=require(_0xf1e3('0x3'));var rp=require(_0xf1e3('0x4'));var moment=require(_0xf1e3('0x5'));var BPromise=require(_0xf1e3('0x6'));var Mustache=require(_0xf1e3('0x7'));var util=require(_0xf1e3('0x8'));var path=require(_0xf1e3('0x9'));var sox=require(_0xf1e3('0xa'));var csv=require(_0xf1e3('0xb'));var ejs=require(_0xf1e3('0xc'));var fs=require('fs');var fs_extra=require(_0xf1e3('0xd'));var _=require(_0xf1e3('0xe'));var squel=require(_0xf1e3('0xf'));var crypto=require(_0xf1e3('0x10'));var jsforce=require(_0xf1e3('0x11'));var deskjs=require(_0xf1e3('0x12'));var toCsv=require(_0xf1e3('0xb'));var querystring=require(_0xf1e3('0x13'));var Papa=require(_0xf1e3('0x14'));var Redis=require(_0xf1e3('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1e3('0x16'));var logger=require('../../config/logger')(_0xf1e3('0x17'));var utils=require(_0xf1e3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf1e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e2f9b,_0x2aecd1){_0x2aecd1=_0x2aecd1||0xcc;return function(_0x87322b){if(_0x87322b){return _0x3e2f9b[_0xf1e3('0x1a')](_0x2aecd1);}return _0x3e2f9b[_0xf1e3('0x1b')](_0x2aecd1)['end']();};}function respondWithResult(_0x5de9cf,_0x558caa){_0x558caa=_0x558caa||0xc8;return function(_0x2b2bb0){if(_0x2b2bb0){return _0x5de9cf[_0xf1e3('0x1b')](_0x558caa)[_0xf1e3('0x1c')](_0x2b2bb0);}};}function respondWithFilteredResult(_0x4af9ea,_0x5f0677){return function(_0x1cecf7){if(_0x1cecf7){var _0x17a688=typeof _0x5f0677[_0xf1e3('0x1d')]===_0xf1e3('0x1e')&&typeof _0x5f0677[_0xf1e3('0x1f')]==='undefined';var _0x493f2f=_0x1cecf7['count'];var _0x3cf53a=_0x17a688?0x0:_0x5f0677[_0xf1e3('0x1d')];var _0x15b37d=_0x17a688?_0x1cecf7[_0xf1e3('0x20')]:_0x5f0677['offset']+_0x5f0677['limit'];var _0x39ecf0;if(_0x15b37d>=_0x493f2f){_0x15b37d=_0x493f2f;_0x39ecf0=0xc8;}else{_0x39ecf0=0xce;}_0x4af9ea[_0xf1e3('0x1b')](_0x39ecf0);return _0x4af9ea['set'](_0xf1e3('0x21'),_0x3cf53a+'-'+_0x15b37d+'/'+_0x493f2f)[_0xf1e3('0x1c')](_0x1cecf7);}return null;};}function patchUpdates(_0x50fee6){return function(_0x48143c){try{jsonpatch[_0xf1e3('0x22')](_0x48143c,_0x50fee6,!![]);}catch(_0x5b5973){return BPromise[_0xf1e3('0x23')](_0x5b5973);}return _0x48143c[_0xf1e3('0x24')]();};}function saveUpdates(_0x264522,_0x149c73){return function(_0x1c9679){if(_0x1c9679){return _0x1c9679['update'](_0x264522)[_0xf1e3('0x25')](function(_0x591385){return _0x591385;});}return null;};}function removeEntity(_0x5d2283,_0x259a71){return function(_0x2fa07d){if(_0x2fa07d){return _0x2fa07d[_0xf1e3('0x26')]()[_0xf1e3('0x25')](function(){_0x5d2283[_0xf1e3('0x1b')](0xcc)[_0xf1e3('0x27')]();});}};}function handleEntityNotFound(_0x10d75c,_0x266992){return function(_0x2fd304){if(!_0x2fd304){_0x10d75c[_0xf1e3('0x1a')](0x194);}return _0x2fd304;};}function handleError(_0x19aa76,_0xe5ffff){_0xe5ffff=_0xe5ffff||0x1f4;return function(_0x12f397){logger['error'](_0x12f397[_0xf1e3('0x28')]);if(_0x12f397[_0xf1e3('0x29')]){delete _0x12f397[_0xf1e3('0x29')];}_0x19aa76[_0xf1e3('0x1b')](_0xe5ffff)[_0xf1e3('0x2a')](_0x12f397);};}exports[_0xf1e3('0x2b')]=function(_0x1aecbb,_0x21755a){var _0x28136d={},_0x537a48={},_0x4b1bb0={'count':0x0,'rows':[]};var _0x5e5884=_['map'](db['SmsTransferReport'][_0xf1e3('0x2c')],function(_0x398cd0){return{'name':_0x398cd0[_0xf1e3('0x2d')],'type':_0x398cd0[_0xf1e3('0x2e')]['key']};});_0x537a48['model']=_[_0xf1e3('0x2f')](_0x5e5884,'name');_0x537a48[_0xf1e3('0x30')]=_[_0xf1e3('0x31')](_0x1aecbb[_0xf1e3('0x30')]);_0x537a48[_0xf1e3('0x32')]=_['intersection'](_0x537a48['model'],_0x537a48[_0xf1e3('0x30')]);_0x28136d['attributes']=_['intersection'](_0x537a48['model'],qs[_0xf1e3('0x33')](_0x1aecbb[_0xf1e3('0x30')][_0xf1e3('0x33')]));_0x28136d['attributes']=_0x28136d[_0xf1e3('0x34')]['length']?_0x28136d[_0xf1e3('0x34')]:_0x537a48[_0xf1e3('0x35')];if(!_0x1aecbb['query']['hasOwnProperty'](_0xf1e3('0x36'))){_0x28136d['limit']=qs[_0xf1e3('0x1f')](_0x1aecbb[_0xf1e3('0x30')][_0xf1e3('0x1f')]);_0x28136d['offset']=qs[_0xf1e3('0x1d')](_0x1aecbb[_0xf1e3('0x30')][_0xf1e3('0x1d')]);}_0x28136d[_0xf1e3('0x37')]=qs[_0xf1e3('0x38')](_0x1aecbb[_0xf1e3('0x30')][_0xf1e3('0x38')]);_0x28136d[_0xf1e3('0x39')]=qs[_0xf1e3('0x32')](_['pick'](_0x1aecbb[_0xf1e3('0x30')],_0x537a48[_0xf1e3('0x32')]),_0x5e5884);if(_0x1aecbb[_0xf1e3('0x30')]['filter']){_0x28136d[_0xf1e3('0x39')]=_[_0xf1e3('0x3a')](_0x28136d[_0xf1e3('0x39')],{'$or':_[_0xf1e3('0x2f')](_0x5e5884,function(_0x290f42){if(_0x290f42[_0xf1e3('0x2e')]!=='VIRTUAL'){var _0x1e32ad={};_0x1e32ad[_0x290f42[_0xf1e3('0x29')]]={'$like':'%'+_0x1aecbb[_0xf1e3('0x30')][_0xf1e3('0x3b')]+'%'};return _0x1e32ad;}})});}_0x28136d=_['merge']({},_0x28136d,_0x1aecbb[_0xf1e3('0x3c')]);var _0x268ebe={'where':_0x28136d[_0xf1e3('0x39')]};return db['SmsTransferReport'][_0xf1e3('0x20')](_0x268ebe)['then'](function(_0x342d9d){_0x4b1bb0[_0xf1e3('0x20')]=_0x342d9d;if(_0x1aecbb[_0xf1e3('0x30')]['includeAll']){_0x28136d['include']=[{'all':!![]}];}return db[_0xf1e3('0x3d')][_0xf1e3('0x3e')](_0x28136d);})[_0xf1e3('0x25')](function(_0x12036b){_0x4b1bb0[_0xf1e3('0x3f')]=_0x12036b;return _0x4b1bb0;})[_0xf1e3('0x25')](respondWithFilteredResult(_0x21755a,_0x28136d))[_0xf1e3('0x40')](handleError(_0x21755a,null));};exports[_0xf1e3('0x41')]=function(_0x93e3ca,_0x3cbc2e){var _0x4dff61={'raw':!![],'where':{'id':_0x93e3ca[_0xf1e3('0x42')]['id']}},_0x314d33={};_0x314d33[_0xf1e3('0x35')]=_[_0xf1e3('0x31')](db[_0xf1e3('0x3d')]['rawAttributes']);_0x314d33[_0xf1e3('0x30')]=_[_0xf1e3('0x31')](_0x93e3ca[_0xf1e3('0x30')]);_0x314d33[_0xf1e3('0x32')]=_[_0xf1e3('0x43')](_0x314d33[_0xf1e3('0x35')],_0x314d33[_0xf1e3('0x30')]);_0x4dff61[_0xf1e3('0x34')]=_['intersection'](_0x314d33[_0xf1e3('0x35')],qs['fields'](_0x93e3ca[_0xf1e3('0x30')][_0xf1e3('0x33')]));_0x4dff61['attributes']=_0x4dff61[_0xf1e3('0x34')]['length']?_0x4dff61[_0xf1e3('0x34')]:_0x314d33['model'];if(_0x93e3ca[_0xf1e3('0x30')]['includeAll']){_0x4dff61['include']=[{'all':!![]}];}_0x4dff61=_[_0xf1e3('0x3a')]({},_0x4dff61,_0x93e3ca['options']);return db['SmsTransferReport']['find'](_0x4dff61)['then'](handleEntityNotFound(_0x3cbc2e,null))[_0xf1e3('0x25')](respondWithResult(_0x3cbc2e,null))[_0xf1e3('0x40')](handleError(_0x3cbc2e,null));};exports[_0xf1e3('0x44')]=function(_0x6771c5,_0x242777){return db[_0xf1e3('0x3d')][_0xf1e3('0x44')](_0x6771c5[_0xf1e3('0x45')],{})[_0xf1e3('0x25')](respondWithResult(_0x242777,0xc9))[_0xf1e3('0x40')](handleError(_0x242777,null));};exports[_0xf1e3('0x46')]=function(_0x29d0cf,_0x142923){if(_0x29d0cf[_0xf1e3('0x45')]['id']){delete _0x29d0cf['body']['id'];}return db[_0xf1e3('0x3d')][_0xf1e3('0x47')]({'where':{'id':_0x29d0cf[_0xf1e3('0x42')]['id']}})[_0xf1e3('0x25')](handleEntityNotFound(_0x142923,null))[_0xf1e3('0x25')](saveUpdates(_0x29d0cf[_0xf1e3('0x45')],null))[_0xf1e3('0x25')](respondWithResult(_0x142923,null))[_0xf1e3('0x40')](handleError(_0x142923,null));};exports['destroy']=function(_0x1acc48,_0x35ff40){return db['SmsTransferReport'][_0xf1e3('0x47')]({'where':{'id':_0x1acc48['params']['id']}})['then'](handleEntityNotFound(_0x35ff40,null))['then'](removeEntity(_0x35ff40,null))[_0xf1e3('0x40')](handleError(_0x35ff40,null));};exports[_0xf1e3('0x48')]=function(_0x34950f,_0x1ae5ec){return db[_0xf1e3('0x3d')][_0xf1e3('0x48')]()[_0xf1e3('0x25')](respondWithResult(_0x1ae5ec,null))[_0xf1e3('0x40')](handleError(_0x1ae5ec,null));}; \ No newline at end of file +var _0x64bc=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','send','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','name','filter','merge','options','SmsTransferReport','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create'];(function(_0x38833a,_0x3cf597){var _0x50b36d=function(_0x44fa19){while(--_0x44fa19){_0x38833a['push'](_0x38833a['shift']());}};_0x50b36d(++_0x3cf597);}(_0x64bc,0xa0));var _0xc64b=function(_0xa2d41,_0x29a7bf){_0xa2d41=_0xa2d41-0x0;var _0x164681=_0x64bc[_0xa2d41];return _0x164681;};'use strict';var emlformat=require(_0xc64b('0x0'));var rimraf=require(_0xc64b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc64b('0x2'));var rp=require(_0xc64b('0x3'));var moment=require(_0xc64b('0x4'));var BPromise=require(_0xc64b('0x5'));var Mustache=require(_0xc64b('0x6'));var util=require(_0xc64b('0x7'));var path=require(_0xc64b('0x8'));var sox=require(_0xc64b('0x9'));var csv=require(_0xc64b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc64b('0xb'));var _=require('lodash');var squel=require(_0xc64b('0xc'));var crypto=require(_0xc64b('0xd'));var jsforce=require(_0xc64b('0xe'));var deskjs=require(_0xc64b('0xf'));var toCsv=require(_0xc64b('0xa'));var querystring=require(_0xc64b('0x10'));var Papa=require(_0xc64b('0x11'));var Redis=require('ioredis');var authService=require(_0xc64b('0x12'));var qs=require(_0xc64b('0x13'));var as=require(_0xc64b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc64b('0x15'))(_0xc64b('0x16'));var utils=require(_0xc64b('0x17'));var config=require(_0xc64b('0x18'));var licenseUtil=require(_0xc64b('0x19'));var db=require(_0xc64b('0x1a'))['db'];function respondWithStatusCode(_0xac7f4b,_0x184cd8){_0x184cd8=_0x184cd8||0xcc;return function(_0x271c10){if(_0x271c10){return _0xac7f4b['sendStatus'](_0x184cd8);}return _0xac7f4b[_0xc64b('0x1b')](_0x184cd8)['end']();};}function respondWithResult(_0x410829,_0x4b75de){_0x4b75de=_0x4b75de||0xc8;return function(_0x305180){if(_0x305180){return _0x410829[_0xc64b('0x1b')](_0x4b75de)[_0xc64b('0x1c')](_0x305180);}};}function respondWithFilteredResult(_0x5013ce,_0x3495c1){return function(_0x40fe4d){if(_0x40fe4d){var _0x263fc8=typeof _0x3495c1[_0xc64b('0x1d')]===_0xc64b('0x1e')&&typeof _0x3495c1[_0xc64b('0x1f')]==='undefined';var _0x21dc56=_0x40fe4d[_0xc64b('0x20')];var _0x4ad335=_0x263fc8?0x0:_0x3495c1['offset'];var _0x1a2b11=_0x263fc8?_0x40fe4d[_0xc64b('0x20')]:_0x3495c1[_0xc64b('0x1d')]+_0x3495c1[_0xc64b('0x1f')];var _0x49adeb;if(_0x1a2b11>=_0x21dc56){_0x1a2b11=_0x21dc56;_0x49adeb=0xc8;}else{_0x49adeb=0xce;}_0x5013ce[_0xc64b('0x1b')](_0x49adeb);return _0x5013ce['set'](_0xc64b('0x21'),_0x4ad335+'-'+_0x1a2b11+'/'+_0x21dc56)[_0xc64b('0x1c')](_0x40fe4d);}return null;};}function patchUpdates(_0x44dc24){return function(_0x8d669e){try{jsonpatch['apply'](_0x8d669e,_0x44dc24,!![]);}catch(_0x305988){return BPromise[_0xc64b('0x22')](_0x305988);}return _0x8d669e['save']();};}function saveUpdates(_0x3cf87c,_0x3a1a1c){return function(_0x4b2cef){if(_0x4b2cef){return _0x4b2cef[_0xc64b('0x23')](_0x3cf87c)[_0xc64b('0x24')](function(_0x1187ed){return _0x1187ed;});}return null;};}function removeEntity(_0x3bb191,_0x6b966e){return function(_0xf42d0e){if(_0xf42d0e){return _0xf42d0e[_0xc64b('0x25')]()[_0xc64b('0x24')](function(){_0x3bb191[_0xc64b('0x1b')](0xcc)[_0xc64b('0x26')]();});}};}function handleEntityNotFound(_0x1e51ff,_0x4c0727){return function(_0x132431){if(!_0x132431){_0x1e51ff[_0xc64b('0x27')](0x194);}return _0x132431;};}function handleError(_0x5de422,_0x21e6c1){_0x21e6c1=_0x21e6c1||0x1f4;return function(_0x3d9896){logger[_0xc64b('0x28')](_0x3d9896[_0xc64b('0x29')]);if(_0x3d9896['name']){delete _0x3d9896['name'];}_0x5de422[_0xc64b('0x1b')](_0x21e6c1)[_0xc64b('0x2a')](_0x3d9896);};}exports[_0xc64b('0x2b')]=function(_0x15b73e,_0x1de7c2){var _0x54b474={},_0xe611fe={},_0x35caef={'count':0x0,'rows':[]};var _0x4af3b4=_[_0xc64b('0x2c')](db['SmsTransferReport'][_0xc64b('0x2d')],function(_0x3983e4){return{'name':_0x3983e4['fieldName'],'type':_0x3983e4[_0xc64b('0x2e')][_0xc64b('0x2f')]};});_0xe611fe[_0xc64b('0x30')]=_[_0xc64b('0x2c')](_0x4af3b4,'name');_0xe611fe['query']=_['keys'](_0x15b73e[_0xc64b('0x31')]);_0xe611fe[_0xc64b('0x32')]=_['intersection'](_0xe611fe['model'],_0xe611fe['query']);_0x54b474[_0xc64b('0x33')]=_['intersection'](_0xe611fe['model'],qs[_0xc64b('0x34')](_0x15b73e[_0xc64b('0x31')][_0xc64b('0x34')]));_0x54b474[_0xc64b('0x33')]=_0x54b474[_0xc64b('0x33')][_0xc64b('0x35')]?_0x54b474[_0xc64b('0x33')]:_0xe611fe[_0xc64b('0x30')];if(!_0x15b73e[_0xc64b('0x31')][_0xc64b('0x36')](_0xc64b('0x37'))){_0x54b474[_0xc64b('0x1f')]=qs[_0xc64b('0x1f')](_0x15b73e[_0xc64b('0x31')][_0xc64b('0x1f')]);_0x54b474[_0xc64b('0x1d')]=qs[_0xc64b('0x1d')](_0x15b73e[_0xc64b('0x31')][_0xc64b('0x1d')]);}_0x54b474[_0xc64b('0x38')]=qs[_0xc64b('0x39')](_0x15b73e['query'][_0xc64b('0x39')]);_0x54b474['where']=qs[_0xc64b('0x32')](_[_0xc64b('0x3a')](_0x15b73e['query'],_0xe611fe[_0xc64b('0x32')]),_0x4af3b4);if(_0x15b73e['query']['filter']){_0x54b474[_0xc64b('0x3b')]=_['merge'](_0x54b474['where'],{'$or':_[_0xc64b('0x2c')](_0x4af3b4,function(_0x5f0e67){if(_0x5f0e67['type']!==_0xc64b('0x3c')){var _0x2c0527={};_0x2c0527[_0x5f0e67[_0xc64b('0x3d')]]={'$like':'%'+_0x15b73e['query'][_0xc64b('0x3e')]+'%'};return _0x2c0527;}})});}_0x54b474=_[_0xc64b('0x3f')]({},_0x54b474,_0x15b73e[_0xc64b('0x40')]);var _0xf69860={'where':_0x54b474[_0xc64b('0x3b')]};return db[_0xc64b('0x41')][_0xc64b('0x20')](_0xf69860)[_0xc64b('0x24')](function(_0x3ea9ae){_0x35caef[_0xc64b('0x20')]=_0x3ea9ae;if(_0x15b73e['query'][_0xc64b('0x42')]){_0x54b474['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xc64b('0x43')](_0x54b474);})['then'](function(_0x529574){_0x35caef[_0xc64b('0x44')]=_0x529574;return _0x35caef;})[_0xc64b('0x24')](respondWithFilteredResult(_0x1de7c2,_0x54b474))[_0xc64b('0x45')](handleError(_0x1de7c2,null));};exports[_0xc64b('0x46')]=function(_0x5c3686,_0x189b65){var _0x1534ae={'raw':!![],'where':{'id':_0x5c3686[_0xc64b('0x47')]['id']}},_0x2d1870={};_0x2d1870[_0xc64b('0x30')]=_['keys'](db[_0xc64b('0x41')][_0xc64b('0x2d')]);_0x2d1870[_0xc64b('0x31')]=_[_0xc64b('0x48')](_0x5c3686[_0xc64b('0x31')]);_0x2d1870[_0xc64b('0x32')]=_[_0xc64b('0x49')](_0x2d1870['model'],_0x2d1870[_0xc64b('0x31')]);_0x1534ae[_0xc64b('0x33')]=_['intersection'](_0x2d1870[_0xc64b('0x30')],qs['fields'](_0x5c3686['query']['fields']));_0x1534ae[_0xc64b('0x33')]=_0x1534ae[_0xc64b('0x33')][_0xc64b('0x35')]?_0x1534ae[_0xc64b('0x33')]:_0x2d1870['model'];if(_0x5c3686['query'][_0xc64b('0x42')]){_0x1534ae[_0xc64b('0x4a')]=[{'all':!![]}];}_0x1534ae=_['merge']({},_0x1534ae,_0x5c3686[_0xc64b('0x40')]);return db[_0xc64b('0x41')][_0xc64b('0x4b')](_0x1534ae)['then'](handleEntityNotFound(_0x189b65,null))[_0xc64b('0x24')](respondWithResult(_0x189b65,null))[_0xc64b('0x45')](handleError(_0x189b65,null));};exports[_0xc64b('0x4c')]=function(_0x90dfac,_0x55f554){return db[_0xc64b('0x41')][_0xc64b('0x4c')](_0x90dfac[_0xc64b('0x4d')],{})[_0xc64b('0x24')](respondWithResult(_0x55f554,0xc9))[_0xc64b('0x45')](handleError(_0x55f554,null));};exports[_0xc64b('0x23')]=function(_0x56a459,_0x9b4aea){if(_0x56a459[_0xc64b('0x4d')]['id']){delete _0x56a459['body']['id'];}return db[_0xc64b('0x41')][_0xc64b('0x4b')]({'where':{'id':_0x56a459[_0xc64b('0x47')]['id']}})[_0xc64b('0x24')](handleEntityNotFound(_0x9b4aea,null))['then'](saveUpdates(_0x56a459['body'],null))[_0xc64b('0x24')](respondWithResult(_0x9b4aea,null))[_0xc64b('0x45')](handleError(_0x9b4aea,null));};exports[_0xc64b('0x25')]=function(_0x12e9b9,_0x321241){return db['SmsTransferReport'][_0xc64b('0x4b')]({'where':{'id':_0x12e9b9[_0xc64b('0x47')]['id']}})[_0xc64b('0x24')](handleEntityNotFound(_0x321241,null))[_0xc64b('0x24')](removeEntity(_0x321241,null))[_0xc64b('0x45')](handleError(_0x321241,null));};exports[_0xc64b('0x4e')]=function(_0x3862c9,_0x29febc){return db[_0xc64b('0x41')][_0xc64b('0x4e')]()[_0xc64b('0x24')](respondWithResult(_0x29febc,null))['catch'](handleError(_0x29febc,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5ee02d6..197571d 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 _0x31ee=['api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x17516a,_0x2824c1){var _0x22e61f=function(_0x5f0226){while(--_0x5f0226){_0x17516a['push'](_0x17516a['shift']());}};_0x22e61f(++_0x2824c1);}(_0x31ee,0xf4));var _0xe31e=function(_0x3c7d67,_0x23ebb5){_0x3c7d67=_0x3c7d67-0x0;var _0x18ece1=_0x31ee[_0x3c7d67];return _0x18ece1;};'use strict';var _=require(_0xe31e('0x0'));var util=require(_0xe31e('0x1'));var logger=require(_0xe31e('0x2'))(_0xe31e('0x3'));var moment=require(_0xe31e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe31e('0x5'));var fs=require('fs');var path=require(_0xe31e('0x6'));var rimraf=require('rimraf');var config=require(_0xe31e('0x7'));var attributes=require(_0xe31e('0x8'));module[_0xe31e('0x9')]=function(_0x1483aa,_0x10de21){return _0x1483aa[_0xe31e('0xa')]('SmsTransferReport',attributes,{'tableName':_0xe31e('0xb'),'paranoid':![],'indexes':[{'name':_0xe31e('0xc'),'fields':[_0xe31e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x192f=['./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0x192f,0xd6));var _0xf192=function(_0x37a014,_0x555f73){_0x37a014=_0x37a014-0x0;var _0x5be41b=_0x192f[_0x37a014];return _0x5be41b;};'use strict';var _=require(_0xf192('0x0'));var util=require('util');var logger=require(_0xf192('0x1'))('api');var moment=require(_0xf192('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x3'));var rimraf=require(_0xf192('0x4'));var config=require(_0xf192('0x5'));var attributes=require(_0xf192('0x6'));module[_0xf192('0x7')]=function(_0x221f55,_0x5a05b0){return _0x221f55[_0xf192('0x8')](_0xf192('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xf192('0xa'),'fields':[_0xf192('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5ef33db..136bd5d 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 _0x14f5=['SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x201d19,_0x41595b){var _0x25d546=function(_0x2b4a95){while(--_0x2b4a95){_0x201d19['push'](_0x201d19['shift']());}};_0x25d546(++_0x41595b);}(_0x14f5,0xae));var _0x514f=function(_0x5c24e2,_0x14aa2e){_0x5c24e2=_0x5c24e2-0x0;var _0x3be752=_0x14f5[_0x5c24e2];return _0x3be752;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});} \ No newline at end of file +var _0xf360=['error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x51f575,_0x49918f){var _0x47e06d=function(_0x31c535){while(--_0x31c535){_0x51f575['push'](_0x51f575['shift']());}};_0x47e06d(++_0x49918f);}(_0xf360,0x9e));var _0x0f36=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf360[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var moment=require(_0x0f36('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require(_0x0f36('0x6'))('rpc');var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson[_0x0f36('0x9')][_0x0f36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2db632,_0x259878,_0x2d4bb7){return new BPromise(function(_0x370193,_0x5c356f){return client[_0x0f36('0xb')](_0x2db632,_0x2d4bb7)[_0x0f36('0xc')](function(_0x47718b){logger[_0x0f36('0xd')](_0x0f36('0xe'),_0x259878,_0x0f36('0xf'));logger['debug'](_0x0f36('0x10'),_0x259878,_0x0f36('0xf'),JSON[_0x0f36('0x11')](_0x47718b));if(_0x47718b['error']){if(_0x47718b[_0x0f36('0x12')]['code']===0x1f4){logger['error'](_0x0f36('0xe'),_0x259878,_0x47718b[_0x0f36('0x12')]['message']);return _0x5c356f(_0x47718b[_0x0f36('0x12')][_0x0f36('0x13')]);}logger[_0x0f36('0x12')](_0x0f36('0xe'),_0x259878,_0x47718b['error'][_0x0f36('0x13')]);return _0x370193(_0x47718b['error'][_0x0f36('0x13')]);}else{logger[_0x0f36('0xd')](_0x0f36('0xe'),_0x259878,_0x0f36('0xf'));_0x370193(_0x47718b[_0x0f36('0x14')][_0x0f36('0x13')]);}})[_0x0f36('0x15')](function(_0x486739){logger['error'](_0x0f36('0xe'),_0x259878,_0x486739);_0x5c356f(_0x486739);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 559685d..d39644a 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 _0xa791=['single','file','create','put','update','delete','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','extname','post'];(function(_0x5f4515,_0x504df2){var _0x329dd9=function(_0x29b10d){while(--_0x29b10d){_0x5f4515['push'](_0x5f4515['shift']());}};_0x329dd9(++_0x504df2);}(_0xa791,0x18f));var _0x1a79=function(_0x511b98,_0x3eddfe){_0x511b98=_0x511b98-0x0;var _0x4198f8=_0xa791[_0x511b98];return _0x4198f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a79('0x0'));var timeout=require(_0x1a79('0x1'));var express=require(_0x1a79('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a79('0x3'));var config=require(_0x1a79('0x4'));var controller=require('./sound.controller');router[_0x1a79('0x5')]('/',auth[_0x1a79('0x6')](),controller['index']);router[_0x1a79('0x5')](_0x1a79('0x7'),auth['isAuthenticated'](),controller[_0x1a79('0x8')]);router[_0x1a79('0x5')]('/:id/download',auth[_0x1a79('0x6')](),controller[_0x1a79('0x9')]);var upload=multer({'storage':multer[_0x1a79('0xa')]({'destination':function(_0x8cc842,_0x3a78b4,_0x337b82){_0x337b82(null,path[_0x1a79('0xb')](config[_0x1a79('0xc')],_0x1a79('0xd')));},'filename':function(_0x3b5ac6,_0x59d8b4,_0x484026){_0x59d8b4[_0x1a79('0xe')]=_0x59d8b4[_0x1a79('0xe')][_0x1a79('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x484026(null,util[_0x1a79('0x10')](_0x1a79('0x11'),path['basename'](_0x59d8b4[_0x1a79('0xe')],path['extname'](_0x59d8b4[_0x1a79('0xe')])),Date[_0x1a79('0x12')](),path[_0x1a79('0x13')](_0x59d8b4[_0x1a79('0xe')])));}})});router[_0x1a79('0x14')]('/',upload[_0x1a79('0x15')](_0x1a79('0x16')),controller[_0x1a79('0x17')]);router[_0x1a79('0x18')]('/:id',auth[_0x1a79('0x6')](),controller[_0x1a79('0x19')]);router['delete'](_0x1a79('0x7'),auth[_0x1a79('0x6')](),controller[_0x1a79('0x1a')]);module[_0x1a79('0x1b')]=router; \ No newline at end of file +var _0x23f8=['get','isAuthenticated','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','extname','post','single','file','create','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','./sound.controller'];(function(_0x25e9d2,_0x135a13){var _0x142aff=function(_0xe2e0c8){while(--_0xe2e0c8){_0x25e9d2['push'](_0x25e9d2['shift']());}};_0x142aff(++_0x135a13);}(_0x23f8,0x123));var _0x823f=function(_0x4a4939,_0x491270){_0x4a4939=_0x4a4939-0x0;var _0x31227c=_0x23f8[_0x4a4939];return _0x31227c;};'use strict';var multer=require(_0x823f('0x0'));var util=require('util');var path=require(_0x823f('0x1'));var timeout=require(_0x823f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x823f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x823f('0x4'));var config=require('../../config/environment');var controller=require(_0x823f('0x5'));router[_0x823f('0x6')]('/',auth[_0x823f('0x7')](),controller['index']);router[_0x823f('0x6')](_0x823f('0x8'),auth[_0x823f('0x7')](),controller['show']);router[_0x823f('0x6')](_0x823f('0x9'),auth[_0x823f('0x7')](),controller[_0x823f('0xa')]);var upload=multer({'storage':multer[_0x823f('0xb')]({'destination':function(_0x3245af,_0x21fa24,_0x4b6fe0){_0x4b6fe0(null,path[_0x823f('0xc')](config[_0x823f('0xd')],_0x823f('0xe')));},'filename':function(_0x1d5293,_0xc48eb4,_0x2e306d){_0xc48eb4[_0x823f('0xf')]=_0xc48eb4[_0x823f('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e306d(null,util[_0x823f('0x10')](_0x823f('0x11'),path['basename'](_0xc48eb4[_0x823f('0xf')],path['extname'](_0xc48eb4[_0x823f('0xf')])),Date[_0x823f('0x12')](),path[_0x823f('0x13')](_0xc48eb4[_0x823f('0xf')])));}})});router[_0x823f('0x14')]('/',upload[_0x823f('0x15')](_0x823f('0x16')),controller[_0x823f('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x823f('0x18')]);router[_0x823f('0x19')](_0x823f('0x8'),auth['isAuthenticated'](),controller['delete']);module[_0x823f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index fc1547e..c6e5ba8 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 _0xca26=['BIGINT','sequelize','exports','STRING','name','FLOAT','INTEGER'];(function(_0x47d6e2,_0x3071cb){var _0x1d406d=function(_0x33abb6){while(--_0x33abb6){_0x47d6e2['push'](_0x47d6e2['shift']());}};_0x1d406d(++_0x3071cb);}(_0xca26,0x1b3));var _0x6ca2=function(_0x19beab,_0x2c9e3e){_0x19beab=_0x19beab-0x0;var _0x14d7fe=_0xca26[_0x19beab];return _0x14d7fe;};'use strict';var Sequelize=require(_0x6ca2('0x0'));module[_0x6ca2('0x1')]={'name':{'type':Sequelize[_0x6ca2('0x2')],'unique':_0x6ca2('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x6ca2('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x6ca2('0x2')]},'original_format':{'type':Sequelize[_0x6ca2('0x2')]},'original_duration':{'type':Sequelize[_0x6ca2('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x6ca2('0x5')]},'original_bitRate':{'type':Sequelize[_0x6ca2('0x6')]},'original_sampleRate':{'type':Sequelize[_0x6ca2('0x5')]},'converted_format':{'type':Sequelize[_0x6ca2('0x2')]},'converted_duration':{'type':Sequelize[_0x6ca2('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x6ca2('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6ca2('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x6ca2('0x5')]}}; \ No newline at end of file +var _0xd5a1=['BIGINT','INTEGER','STRING','name'];(function(_0x5d07bb,_0x271464){var _0x42960a=function(_0x2f0724){while(--_0x2f0724){_0x5d07bb['push'](_0x5d07bb['shift']());}};_0x42960a(++_0x271464);}(_0xd5a1,0x162));var _0x1d5a=function(_0xf618d8,_0x2be5ba){_0xf618d8=_0xf618d8-0x0;var _0x1d2b06=_0xd5a1[_0xf618d8];return _0x1d2b06;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1d5a('0x0')],'unique':_0x1d5a('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1d5a('0x0')]},'display_name':{'type':Sequelize[_0x1d5a('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x1d5a('0x0')]},'original_format':{'type':Sequelize[_0x1d5a('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x1d5a('0x2')]},'original_channelCount':{'type':Sequelize[_0x1d5a('0x3')]},'original_bitRate':{'type':Sequelize[_0x1d5a('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x1d5a('0x0')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1d5a('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x1d5a('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0746ddf..1450b32 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 _0xabc5=['ValidationError','Sound\x20not\x20found','join','format','%s.%s','file','originalname','extname','filename','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','userProfileId','autoAssociation','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','keys','catch','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted'];(function(_0x9e505f,_0x103e40){var _0x16895d=function(_0x437218){while(--_0x437218){_0x9e505f['push'](_0x9e505f['shift']());}};_0x16895d(++_0x103e40);}(_0xabc5,0x1a7));var _0x5abc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabc5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5abc('0x0'));var rimraf=require(_0x5abc('0x1'));var zipdir=require(_0x5abc('0x2'));var jsonpatch=require(_0x5abc('0x3'));var rp=require('request-promise');var moment=require(_0x5abc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5abc('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5abc('0x6'));var csv=require(_0x5abc('0x7'));var ejs=require(_0x5abc('0x8'));var fs=require('fs');var fs_extra=require(_0x5abc('0x9'));var _=require(_0x5abc('0xa'));var squel=require('squel');var crypto=require(_0x5abc('0xb'));var jsforce=require(_0x5abc('0xc'));var deskjs=require(_0x5abc('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5abc('0xe'));var Redis=require(_0x5abc('0xf'));var authService=require(_0x5abc('0x10'));var qs=require(_0x5abc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5abc('0x12'));var logger=require(_0x5abc('0x13'))(_0x5abc('0x14'));var utils=require('../../config/utils');var config=require(_0x5abc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5abc('0x16'))['db'];function respondWithStatusCode(_0x280783,_0x487e4d){_0x487e4d=_0x487e4d||0xcc;return function(_0xb7ef27){if(_0xb7ef27){return _0x280783[_0x5abc('0x17')](_0x487e4d);}return _0x280783['status'](_0x487e4d)[_0x5abc('0x18')]();};}function respondWithResult(_0x4665b0,_0x2213cd){_0x2213cd=_0x2213cd||0xc8;return function(_0x12464a){if(_0x12464a){return _0x4665b0[_0x5abc('0x19')](_0x2213cd)['json'](_0x12464a);}};}function respondWithFilteredResult(_0x82d356,_0x445c2b){return function(_0xa23490){if(_0xa23490){var _0x4ab537=typeof _0x445c2b[_0x5abc('0x1a')]===_0x5abc('0x1b')&&typeof _0x445c2b[_0x5abc('0x1c')]==='undefined';var _0x13a488=_0xa23490[_0x5abc('0x1d')];var _0x7034d0=_0x4ab537?0x0:_0x445c2b[_0x5abc('0x1a')];var _0x2a9cdf=_0x4ab537?_0xa23490[_0x5abc('0x1d')]:_0x445c2b[_0x5abc('0x1a')]+_0x445c2b['limit'];var _0x52a208;if(_0x2a9cdf>=_0x13a488){_0x2a9cdf=_0x13a488;_0x52a208=0xc8;}else{_0x52a208=0xce;}_0x82d356[_0x5abc('0x19')](_0x52a208);return _0x82d356[_0x5abc('0x1e')](_0x5abc('0x1f'),_0x7034d0+'-'+_0x2a9cdf+'/'+_0x13a488)[_0x5abc('0x20')](_0xa23490);}return null;};}function patchUpdates(_0x389ccd){return function(_0x5eb53b){try{jsonpatch[_0x5abc('0x21')](_0x5eb53b,_0x389ccd,!![]);}catch(_0x4281bb){return BPromise[_0x5abc('0x22')](_0x4281bb);}return _0x5eb53b[_0x5abc('0x23')]();};}function saveUpdates(_0x2cf6f3,_0xaf7ff3){return function(_0x3e4a68){if(_0x3e4a68){return _0x3e4a68[_0x5abc('0x24')](_0x2cf6f3)[_0x5abc('0x25')](function(_0x280a21){return _0x280a21;});}return null;};}function removeEntity(_0x2e4485,_0x14965b){return function(_0x883093){if(_0x883093){return _0x883093[_0x5abc('0x26')]()[_0x5abc('0x25')](function(){var _0x2feed0=_0x883093[_0x5abc('0x27')]({'plain':!![]});var _0xbb5847='Sounds';return db[_0x5abc('0x28')]['destroy']({'where':{'type':_0xbb5847,'resourceId':_0x2feed0['id']}})[_0x5abc('0x25')](function(){return _0x883093;});})['then'](function(){_0x2e4485['status'](0xcc)[_0x5abc('0x18')]();});}};}function handleEntityNotFound(_0x132b80,_0x3c8313){return function(_0xb315c1){if(!_0xb315c1){_0x132b80['sendStatus'](0x194);}return _0xb315c1;};}function handleError(_0xc5c22a,_0xcb42e7){_0xcb42e7=_0xcb42e7||0x1f4;return function(_0x5acdbf){logger[_0x5abc('0x29')](_0x5acdbf[_0x5abc('0x2a')]);if(_0x5acdbf[_0x5abc('0x2b')]){delete _0x5acdbf[_0x5abc('0x2b')];}_0xc5c22a[_0x5abc('0x19')](_0xcb42e7)[_0x5abc('0x2c')](_0x5acdbf);};}exports[_0x5abc('0x2d')]=function(_0x877c02,_0x12c0c2){var _0x16f54e={},_0x1b6186={},_0x3452cc={'count':0x0,'rows':[]};var _0x4dcef9=_[_0x5abc('0x2e')](db[_0x5abc('0x2f')][_0x5abc('0x30')],function(_0x176f16){return{'name':_0x176f16[_0x5abc('0x31')],'type':_0x176f16[_0x5abc('0x32')][_0x5abc('0x33')]};});_0x1b6186['model']=_[_0x5abc('0x2e')](_0x4dcef9,'name');_0x1b6186[_0x5abc('0x34')]=_['keys'](_0x877c02[_0x5abc('0x34')]);_0x1b6186[_0x5abc('0x35')]=_['intersection'](_0x1b6186[_0x5abc('0x36')],_0x1b6186['query']);_0x16f54e['attributes']=_[_0x5abc('0x37')](_0x1b6186[_0x5abc('0x36')],qs['fields'](_0x877c02[_0x5abc('0x34')][_0x5abc('0x38')]));_0x16f54e[_0x5abc('0x39')]=_0x16f54e['attributes'][_0x5abc('0x3a')]?_0x16f54e[_0x5abc('0x39')]:_0x1b6186[_0x5abc('0x36')];if(!_0x877c02[_0x5abc('0x34')][_0x5abc('0x3b')](_0x5abc('0x3c'))){_0x16f54e[_0x5abc('0x1c')]=qs[_0x5abc('0x1c')](_0x877c02[_0x5abc('0x34')][_0x5abc('0x1c')]);_0x16f54e[_0x5abc('0x1a')]=qs['offset'](_0x877c02[_0x5abc('0x34')][_0x5abc('0x1a')]);}_0x16f54e[_0x5abc('0x3d')]=qs[_0x5abc('0x3e')](_0x877c02['query']['sort']);_0x16f54e[_0x5abc('0x3f')]=qs['filters'](_[_0x5abc('0x40')](_0x877c02[_0x5abc('0x34')],_0x1b6186['filters']),_0x4dcef9);if(_0x877c02[_0x5abc('0x34')][_0x5abc('0x41')]){_0x16f54e[_0x5abc('0x3f')]=_[_0x5abc('0x42')](_0x16f54e['where'],{'$or':_['map'](_0x4dcef9,function(_0x46ed61){if(_0x46ed61[_0x5abc('0x32')]!==_0x5abc('0x43')){var _0x5e7c68={};_0x5e7c68[_0x46ed61['name']]={'$like':'%'+_0x877c02[_0x5abc('0x34')][_0x5abc('0x41')]+'%'};return _0x5e7c68;}})});}_0x16f54e=_[_0x5abc('0x42')]({},_0x16f54e,_0x877c02[_0x5abc('0x44')]);var _0x119b41={'where':_0x16f54e[_0x5abc('0x3f')]};return db[_0x5abc('0x2f')][_0x5abc('0x1d')](_0x119b41)[_0x5abc('0x25')](function(_0x3c564a){_0x3452cc[_0x5abc('0x1d')]=_0x3c564a;if(_0x877c02[_0x5abc('0x34')][_0x5abc('0x45')]){_0x16f54e['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x16f54e);})[_0x5abc('0x25')](function(_0x4a9b97){_0x3452cc[_0x5abc('0x46')]=_0x4a9b97;return _0x3452cc;})[_0x5abc('0x25')](respondWithFilteredResult(_0x12c0c2,_0x16f54e))['catch'](handleError(_0x12c0c2,null));};exports['show']=function(_0xb63bf4,_0x34312a){var _0x7017b9={'raw':!![],'where':{'id':_0xb63bf4[_0x5abc('0x47')]['id']}},_0x44690a={};_0x44690a[_0x5abc('0x36')]=_['keys'](db[_0x5abc('0x2f')][_0x5abc('0x30')]);_0x44690a['query']=_[_0x5abc('0x48')](_0xb63bf4[_0x5abc('0x34')]);_0x44690a[_0x5abc('0x35')]=_[_0x5abc('0x37')](_0x44690a[_0x5abc('0x36')],_0x44690a[_0x5abc('0x34')]);_0x7017b9['attributes']=_['intersection'](_0x44690a[_0x5abc('0x36')],qs[_0x5abc('0x38')](_0xb63bf4[_0x5abc('0x34')][_0x5abc('0x38')]));_0x7017b9[_0x5abc('0x39')]=_0x7017b9[_0x5abc('0x39')][_0x5abc('0x3a')]?_0x7017b9[_0x5abc('0x39')]:_0x44690a[_0x5abc('0x36')];if(_0xb63bf4['query']['includeAll']){_0x7017b9['include']=[{'all':!![]}];}_0x7017b9=_['merge']({},_0x7017b9,_0xb63bf4[_0x5abc('0x44')]);return db['Sound']['find'](_0x7017b9)[_0x5abc('0x25')](handleEntityNotFound(_0x34312a,null))[_0x5abc('0x25')](respondWithResult(_0x34312a,null))[_0x5abc('0x49')](handleError(_0x34312a,null));};exports[_0x5abc('0x4a')]=function(_0x421631,_0x4e1565,_0x281a5c){return db['Sound'][_0x5abc('0x4b')]({'where':{'id':_0x421631[_0x5abc('0x47')]['id']},'attributes':[_0x5abc('0x2b'),_0x5abc('0x4c'),_0x5abc('0x4d')],'raw':!![]})[_0x5abc('0x25')](handleEntityNotFound(_0x4e1565,null))[_0x5abc('0x25')](function(_0x57589a){if(_0x57589a){if(!fs[_0x5abc('0x4e')](path['join'](config[_0x5abc('0x4f')],_0x5abc('0x50'),_0x57589a[_0x5abc('0x4c')]+'.'+_0x57589a[_0x5abc('0x4d')]))){throw new db['Sequelize'][(_0x5abc('0x51'))](_0x5abc('0x52'));}return _0x4e1565[_0x5abc('0x4a')](path[_0x5abc('0x53')](config[_0x5abc('0x4f')],'server/files/sounds/converted',util[_0x5abc('0x54')](_0x5abc('0x55'),_0x57589a[_0x5abc('0x4c')],_0x57589a[_0x5abc('0x4d')])),util['format'](_0x5abc('0x55'),_0x57589a[_0x5abc('0x2b')],_0x57589a[_0x5abc('0x4d')]));}return null;})['catch'](handleError(_0x4e1565,null));};exports['create']=function(_0x33e11e,_0x3112c4,_0x383903){var _0xdc98d1={'name':path['basename'](_0x33e11e[_0x5abc('0x56')][_0x5abc('0x57')],path[_0x5abc('0x58')](_0x33e11e[_0x5abc('0x56')][_0x5abc('0x57')])),'save_name':path['basename'](_0x33e11e['file'][_0x5abc('0x59')],path[_0x5abc('0x58')](_0x33e11e['file'][_0x5abc('0x59')])),'original_format':path['extname'](_0x33e11e['file'][_0x5abc('0x57')])[_0x5abc('0x5a')](0x1),'converted_format':_0x5abc('0x5b')};var _0x66ab0=path['join'](config[_0x5abc('0x4f')],'server/files/sounds/original',_0x33e11e[_0x5abc('0x56')][_0x5abc('0x59')]);var _0x37589c=path['join'](config['root'],_0x5abc('0x50'),util[_0x5abc('0x54')](_0x5abc('0x55'),path[_0x5abc('0x5c')](_0x33e11e[_0x5abc('0x56')][_0x5abc('0x59')],path[_0x5abc('0x58')](_0x33e11e[_0x5abc('0x56')]['filename'])),_0xdc98d1[_0x5abc('0x4d')]));logger[_0x5abc('0x5d')](_0x5abc('0x5e'),_0x66ab0);logger[_0x5abc('0x5d')](_0x5abc('0x5f'),_0x37589c);try{fs['chmodSync'](_0x66ab0,parseInt('0777',0x8));var _0x4ac3bc=sox[_0x5abc('0x60')](_0x66ab0,_0x37589c,{'sampleRate':0x1f40,'format':_0x5abc('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ac3bc['on'](_0x5abc('0x29'),function(_0x4a7628){fs[_0x5abc('0x61')](_0x66ab0);_0x3112c4[_0x5abc('0x19')](0x1f4)[_0x5abc('0x2c')](_0x4a7628);});_0x4ac3bc['on']('src',function(_0x253420){_0xdc98d1['original_duration']=isNaN(_0x253420[_0x5abc('0x62')])?null:_0x253420[_0x5abc('0x62')]*0x3e8;_0xdc98d1[_0x5abc('0x63')]=isNaN(_0x253420[_0x5abc('0x64')])?null:_0x253420['sampleCount'];_0xdc98d1[_0x5abc('0x65')]=isNaN(_0x253420['channelCount'])?null:_0x253420[_0x5abc('0x66')];_0xdc98d1['original_bitRate']=isNaN(_0x253420[_0x5abc('0x67')])?null:_0x253420[_0x5abc('0x67')];_0xdc98d1[_0x5abc('0x68')]=isNaN(_0x253420[_0x5abc('0x69')])?null:_0x253420[_0x5abc('0x69')];});_0x4ac3bc['on'](_0x5abc('0x6a'),function(_0xcebdc7){_0xdc98d1[_0x5abc('0x6b')]=isNaN(_0xcebdc7['duration'])?null:_0xcebdc7[_0x5abc('0x62')]*0x3e8;_0xdc98d1[_0x5abc('0x6c')]=isNaN(_0xcebdc7[_0x5abc('0x64')])?null:_0xcebdc7[_0x5abc('0x64')];_0xdc98d1[_0x5abc('0x6d')]=isNaN(_0xcebdc7[_0x5abc('0x66')])?null:_0xcebdc7[_0x5abc('0x66')];_0xdc98d1[_0x5abc('0x6e')]=isNaN(_0xcebdc7[_0x5abc('0x67')])?null:_0xcebdc7[_0x5abc('0x67')];_0xdc98d1[_0x5abc('0x6f')]=isNaN(_0xcebdc7[_0x5abc('0x69')])?null:_0xcebdc7[_0x5abc('0x69')];});_0x4ac3bc['on'](_0x5abc('0x18'),function(){fs[_0x5abc('0x70')](_0x37589c,parseInt(_0x5abc('0x71'),0x8));return db[_0x5abc('0x2f')][_0x5abc('0x72')](_0xdc98d1)[_0x5abc('0x25')](function(_0x37db6e){var _0x28ac67={'role':_0x33e11e[_0x5abc('0x73')][_0x5abc('0x74')],'userProfileId':_0x33e11e[_0x5abc('0x73')]['userProfileId']};if(!_0x28ac67)throw new Error(_0x5abc('0x75'));if(_0x28ac67[_0x5abc('0x74')]===_0x5abc('0x76')){var _0x2571f3=_0x37db6e[_0x5abc('0x27')]({'plain':!![]});return db[_0x5abc('0x77')][_0x5abc('0x4b')]({'where':{'name':_0x5abc('0x78'),'userProfileId':_0x28ac67[_0x5abc('0x79')]},'raw':!![]})['then'](function(_0x534c6b){if(_0x534c6b&&_0x534c6b[_0x5abc('0x7a')]===0x0){return db['UserProfileResource'][_0x5abc('0x72')]({'name':_0x2571f3[_0x5abc('0x2b')],'resourceId':_0x2571f3['id'],'type':_0x534c6b[_0x5abc('0x2b')],'sectionId':_0x534c6b['id']},{})[_0x5abc('0x25')](function(){return _0x37db6e;});}else{return _0x37db6e;}})[_0x5abc('0x49')](function(_0x41db39){logger[_0x5abc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41db39);throw _0x41db39;});}return _0x37db6e;})[_0x5abc('0x25')](respondWithResult(_0x3112c4,null))[_0x5abc('0x49')](handleError(_0x3112c4,null));});_0x4ac3bc['start']();}catch(_0x103610){_0x3112c4[_0x5abc('0x19')](0x1f4)[_0x5abc('0x2c')](_0x103610);}};exports[_0x5abc('0x24')]=function(_0x2d17e4,_0x13186f,_0x2feea4){return db[_0x5abc('0x2f')]['find']({'where':{'id':_0x2d17e4[_0x5abc('0x47')]['id']}})[_0x5abc('0x25')](handleEntityNotFound(_0x13186f,null))[_0x5abc('0x25')](saveUpdates(_[_0x5abc('0x40')](_0x2d17e4[_0x5abc('0x73')],[_0x5abc('0x2b'),'description']),null))[_0x5abc('0x25')](respondWithResult(_0x13186f,null))[_0x5abc('0x49')](handleError(_0x13186f,null));};exports[_0x5abc('0x7b')]=function(_0x1d9af4,_0xeb0ceb,_0xbf95a3){return db['Sound']['find']({'where':{'id':_0x1d9af4['params']['id']}})[_0x5abc('0x25')](function(_0x484eba){if(_0x484eba){return _0x484eba[_0x5abc('0x26')]();}})[_0x5abc('0x25')](function(_0x610f89){var _0x1b2b75=path[_0x5abc('0x53')](config[_0x5abc('0x4f')],_0x5abc('0x7c'),util[_0x5abc('0x54')]('%s.%s',_0x610f89[_0x5abc('0x4c')],_0x610f89[_0x5abc('0x7d')]));var _0x4686b1=path['join'](config[_0x5abc('0x4f')],_0x5abc('0x50'),util[_0x5abc('0x54')](_0x5abc('0x55'),_0x610f89[_0x5abc('0x4c')],_0x610f89['converted_format']));fs['unlinkSync'](_0x1b2b75);fs[_0x5abc('0x61')](_0x4686b1);return _0x610f89;})[_0x5abc('0x25')](function(_0x482f17){if(_0x482f17){return _0xeb0ceb['status'](0xcc)[_0x5abc('0x18')]();}})[_0x5abc('0x25')](handleEntityNotFound(_0xeb0ceb,null))[_0x5abc('0x49')](handleError(_0xeb0ceb,null));}; \ No newline at end of file +var _0x77c3=['fields','length','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','filter','options','where','Sound','includeAll','include','findAll','rows','catch','show','find','download','params','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_sampleRate','body','role','userProfileId','user','autoAssociation','start','update','delete','server/files/sounds/original','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','Sounds','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x30c390,_0x45d858){var _0x44d2ab=function(_0x16c6c5){while(--_0x16c6c5){_0x30c390['push'](_0x30c390['shift']());}};_0x44d2ab(++_0x45d858);}(_0x77c3,0xb8));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x377c('0x0'));var rimraf=require(_0x377c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x377c('0x2'));var BPromise=require(_0x377c('0x3'));var Mustache=require(_0x377c('0x4'));var util=require(_0x377c('0x5'));var path=require(_0x377c('0x6'));var sox=require(_0x377c('0x7'));var csv=require(_0x377c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x377c('0x9'));var crypto=require(_0x377c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x377c('0xb'));var Papa=require(_0x377c('0xc'));var Redis=require(_0x377c('0xd'));var authService=require(_0x377c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x377c('0xf'));var hardwareService=require(_0x377c('0x10'));var logger=require(_0x377c('0x11'))(_0x377c('0x12'));var utils=require(_0x377c('0x13'));var config=require(_0x377c('0x14'));var licenseUtil=require(_0x377c('0x15'));var db=require(_0x377c('0x16'))['db'];function respondWithStatusCode(_0x404347,_0x1b769e){_0x1b769e=_0x1b769e||0xcc;return function(_0x389ff1){if(_0x389ff1){return _0x404347[_0x377c('0x17')](_0x1b769e);}return _0x404347[_0x377c('0x18')](_0x1b769e)['end']();};}function respondWithResult(_0x5d0d71,_0x56faf0){_0x56faf0=_0x56faf0||0xc8;return function(_0x506028){if(_0x506028){return _0x5d0d71['status'](_0x56faf0)[_0x377c('0x19')](_0x506028);}};}function respondWithFilteredResult(_0x4fb02f,_0x1286a1){return function(_0x69214e){if(_0x69214e){var _0x52a3bc=typeof _0x1286a1[_0x377c('0x1a')]===_0x377c('0x1b')&&typeof _0x1286a1[_0x377c('0x1c')]===_0x377c('0x1b');var _0x3dbc5e=_0x69214e[_0x377c('0x1d')];var _0x1cff10=_0x52a3bc?0x0:_0x1286a1[_0x377c('0x1a')];var _0x540b42=_0x52a3bc?_0x69214e[_0x377c('0x1d')]:_0x1286a1['offset']+_0x1286a1['limit'];var _0x2496aa;if(_0x540b42>=_0x3dbc5e){_0x540b42=_0x3dbc5e;_0x2496aa=0xc8;}else{_0x2496aa=0xce;}_0x4fb02f[_0x377c('0x18')](_0x2496aa);return _0x4fb02f[_0x377c('0x1e')](_0x377c('0x1f'),_0x1cff10+'-'+_0x540b42+'/'+_0x3dbc5e)[_0x377c('0x19')](_0x69214e);}return null;};}function patchUpdates(_0x30f638){return function(_0x46304b){try{jsonpatch[_0x377c('0x20')](_0x46304b,_0x30f638,!![]);}catch(_0x12a174){return BPromise['reject'](_0x12a174);}return _0x46304b[_0x377c('0x21')]();};}function saveUpdates(_0x39ece7,_0x15200f){return function(_0x1a0f63){if(_0x1a0f63){return _0x1a0f63['update'](_0x39ece7)[_0x377c('0x22')](function(_0x1a5d77){return _0x1a5d77;});}return null;};}function removeEntity(_0x52c550,_0x3eabb6){return function(_0x13312e){if(_0x13312e){return _0x13312e[_0x377c('0x23')]()[_0x377c('0x22')](function(){var _0x2880ad=_0x13312e['get']({'plain':!![]});var _0x252d79=_0x377c('0x24');return db[_0x377c('0x25')]['destroy']({'where':{'type':_0x252d79,'resourceId':_0x2880ad['id']}})['then'](function(){return _0x13312e;});})[_0x377c('0x22')](function(){_0x52c550[_0x377c('0x18')](0xcc)[_0x377c('0x26')]();});}};}function handleEntityNotFound(_0x512d27,_0x21ffe5){return function(_0x1e894f){if(!_0x1e894f){_0x512d27[_0x377c('0x17')](0x194);}return _0x1e894f;};}function handleError(_0x215f9a,_0x2016ea){_0x2016ea=_0x2016ea||0x1f4;return function(_0x4464d3){logger[_0x377c('0x27')](_0x4464d3['stack']);if(_0x4464d3['name']){delete _0x4464d3[_0x377c('0x28')];}_0x215f9a[_0x377c('0x18')](_0x2016ea)[_0x377c('0x29')](_0x4464d3);};}exports[_0x377c('0x2a')]=function(_0x5cd14c,_0xe1930c){var _0x366896={},_0xb3cdfb={},_0x41cec6={'count':0x0,'rows':[]};var _0x459494=_[_0x377c('0x2b')](db['Sound'][_0x377c('0x2c')],function(_0xc14dee){return{'name':_0xc14dee[_0x377c('0x2d')],'type':_0xc14dee[_0x377c('0x2e')][_0x377c('0x2f')]};});_0xb3cdfb[_0x377c('0x30')]=_['map'](_0x459494,'name');_0xb3cdfb[_0x377c('0x31')]=_[_0x377c('0x32')](_0x5cd14c[_0x377c('0x31')]);_0xb3cdfb[_0x377c('0x33')]=_['intersection'](_0xb3cdfb[_0x377c('0x30')],_0xb3cdfb[_0x377c('0x31')]);_0x366896[_0x377c('0x34')]=_[_0x377c('0x35')](_0xb3cdfb[_0x377c('0x30')],qs['fields'](_0x5cd14c['query'][_0x377c('0x36')]));_0x366896[_0x377c('0x34')]=_0x366896[_0x377c('0x34')][_0x377c('0x37')]?_0x366896['attributes']:_0xb3cdfb[_0x377c('0x30')];if(!_0x5cd14c['query'][_0x377c('0x38')](_0x377c('0x39'))){_0x366896['limit']=qs['limit'](_0x5cd14c[_0x377c('0x31')]['limit']);_0x366896[_0x377c('0x1a')]=qs[_0x377c('0x1a')](_0x5cd14c[_0x377c('0x31')]['offset']);}_0x366896['order']=qs[_0x377c('0x3a')](_0x5cd14c[_0x377c('0x31')][_0x377c('0x3a')]);_0x366896['where']=qs[_0x377c('0x33')](_[_0x377c('0x3b')](_0x5cd14c['query'],_0xb3cdfb[_0x377c('0x33')]),_0x459494);if(_0x5cd14c['query']['filter']){_0x366896['where']=_[_0x377c('0x3c')](_0x366896['where'],{'$or':_[_0x377c('0x2b')](_0x459494,function(_0x4d0319){if(_0x4d0319['type']!==_0x377c('0x3d')){var _0x318096={};_0x318096[_0x4d0319['name']]={'$like':'%'+_0x5cd14c['query'][_0x377c('0x3e')]+'%'};return _0x318096;}})});}_0x366896=_[_0x377c('0x3c')]({},_0x366896,_0x5cd14c[_0x377c('0x3f')]);var _0x3bdd78={'where':_0x366896[_0x377c('0x40')]};return db[_0x377c('0x41')][_0x377c('0x1d')](_0x3bdd78)['then'](function(_0x2a4985){_0x41cec6[_0x377c('0x1d')]=_0x2a4985;if(_0x5cd14c[_0x377c('0x31')][_0x377c('0x42')]){_0x366896[_0x377c('0x43')]=[{'all':!![]}];}return db[_0x377c('0x41')][_0x377c('0x44')](_0x366896);})[_0x377c('0x22')](function(_0x3f9097){_0x41cec6[_0x377c('0x45')]=_0x3f9097;return _0x41cec6;})[_0x377c('0x22')](respondWithFilteredResult(_0xe1930c,_0x366896))[_0x377c('0x46')](handleError(_0xe1930c,null));};exports[_0x377c('0x47')]=function(_0x205dfe,_0x46b012){var _0x1475c2={'raw':!![],'where':{'id':_0x205dfe['params']['id']}},_0x157a43={};_0x157a43[_0x377c('0x30')]=_[_0x377c('0x32')](db[_0x377c('0x41')][_0x377c('0x2c')]);_0x157a43[_0x377c('0x31')]=_[_0x377c('0x32')](_0x205dfe[_0x377c('0x31')]);_0x157a43['filters']=_[_0x377c('0x35')](_0x157a43[_0x377c('0x30')],_0x157a43[_0x377c('0x31')]);_0x1475c2[_0x377c('0x34')]=_[_0x377c('0x35')](_0x157a43[_0x377c('0x30')],qs['fields'](_0x205dfe[_0x377c('0x31')][_0x377c('0x36')]));_0x1475c2[_0x377c('0x34')]=_0x1475c2['attributes'][_0x377c('0x37')]?_0x1475c2[_0x377c('0x34')]:_0x157a43[_0x377c('0x30')];if(_0x205dfe[_0x377c('0x31')][_0x377c('0x42')]){_0x1475c2[_0x377c('0x43')]=[{'all':!![]}];}_0x1475c2=_[_0x377c('0x3c')]({},_0x1475c2,_0x205dfe[_0x377c('0x3f')]);return db[_0x377c('0x41')][_0x377c('0x48')](_0x1475c2)[_0x377c('0x22')](handleEntityNotFound(_0x46b012,null))[_0x377c('0x22')](respondWithResult(_0x46b012,null))[_0x377c('0x46')](handleError(_0x46b012,null));};exports[_0x377c('0x49')]=function(_0x3428b5,_0x98650e,_0x4f7542){return db[_0x377c('0x41')]['find']({'where':{'id':_0x3428b5[_0x377c('0x4a')]['id']},'attributes':[_0x377c('0x28'),_0x377c('0x4b'),_0x377c('0x4c')],'raw':!![]})[_0x377c('0x22')](handleEntityNotFound(_0x98650e,null))[_0x377c('0x22')](function(_0x43d507){if(_0x43d507){if(!fs['existsSync'](path[_0x377c('0x4d')](config[_0x377c('0x4e')],_0x377c('0x4f'),_0x43d507[_0x377c('0x4b')]+'.'+_0x43d507[_0x377c('0x4c')]))){throw new db['Sequelize'][(_0x377c('0x50'))](_0x377c('0x51'));}return _0x98650e['download'](path['join'](config['root'],_0x377c('0x4f'),util[_0x377c('0x52')](_0x377c('0x53'),_0x43d507[_0x377c('0x4b')],_0x43d507[_0x377c('0x4c')])),util['format'](_0x377c('0x53'),_0x43d507[_0x377c('0x28')],_0x43d507[_0x377c('0x4c')]));}return null;})['catch'](handleError(_0x98650e,null));};exports[_0x377c('0x54')]=function(_0x3e26b6,_0x19e8b1,_0x208124){var _0x5bc7cf={'name':path[_0x377c('0x55')](_0x3e26b6[_0x377c('0x56')][_0x377c('0x57')],path[_0x377c('0x58')](_0x3e26b6[_0x377c('0x56')][_0x377c('0x57')])),'save_name':path[_0x377c('0x55')](_0x3e26b6[_0x377c('0x56')]['filename'],path[_0x377c('0x58')](_0x3e26b6['file'][_0x377c('0x59')])),'original_format':path[_0x377c('0x58')](_0x3e26b6[_0x377c('0x56')][_0x377c('0x57')])[_0x377c('0x5a')](0x1),'converted_format':_0x377c('0x5b')};var _0x39478e=path[_0x377c('0x4d')](config[_0x377c('0x4e')],'server/files/sounds/original',_0x3e26b6['file'][_0x377c('0x59')]);var _0x16f7e7=path[_0x377c('0x4d')](config[_0x377c('0x4e')],'server/files/sounds/converted',util[_0x377c('0x52')](_0x377c('0x53'),path[_0x377c('0x55')](_0x3e26b6['file'][_0x377c('0x59')],path[_0x377c('0x58')](_0x3e26b6[_0x377c('0x56')][_0x377c('0x59')])),_0x5bc7cf[_0x377c('0x4c')]));logger[_0x377c('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x39478e);logger[_0x377c('0x5c')](_0x377c('0x5d'),_0x16f7e7);try{fs[_0x377c('0x5e')](_0x39478e,parseInt(_0x377c('0x5f'),0x8));var _0x49d5e7=sox['transcode'](_0x39478e,_0x16f7e7,{'sampleRate':0x1f40,'format':_0x377c('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x49d5e7['on'](_0x377c('0x27'),function(_0x541f51){fs[_0x377c('0x60')](_0x39478e);_0x19e8b1[_0x377c('0x18')](0x1f4)[_0x377c('0x29')](_0x541f51);});_0x49d5e7['on'](_0x377c('0x61'),function(_0x44c441){_0x5bc7cf[_0x377c('0x62')]=isNaN(_0x44c441[_0x377c('0x63')])?null:_0x44c441[_0x377c('0x63')]*0x3e8;_0x5bc7cf[_0x377c('0x64')]=isNaN(_0x44c441['sampleCount'])?null:_0x44c441[_0x377c('0x65')];_0x5bc7cf['original_channelCount']=isNaN(_0x44c441[_0x377c('0x66')])?null:_0x44c441['channelCount'];_0x5bc7cf['original_bitRate']=isNaN(_0x44c441[_0x377c('0x67')])?null:_0x44c441[_0x377c('0x67')];_0x5bc7cf[_0x377c('0x68')]=isNaN(_0x44c441['sampleRate'])?null:_0x44c441[_0x377c('0x69')];});_0x49d5e7['on'](_0x377c('0x6a'),function(_0x404bc6){_0x5bc7cf[_0x377c('0x6b')]=isNaN(_0x404bc6['duration'])?null:_0x404bc6[_0x377c('0x63')]*0x3e8;_0x5bc7cf[_0x377c('0x6c')]=isNaN(_0x404bc6[_0x377c('0x65')])?null:_0x404bc6['sampleCount'];_0x5bc7cf['converted_channelCount']=isNaN(_0x404bc6[_0x377c('0x66')])?null:_0x404bc6[_0x377c('0x66')];_0x5bc7cf['converted_bitRate']=isNaN(_0x404bc6['bitRate'])?null:_0x404bc6[_0x377c('0x67')];_0x5bc7cf[_0x377c('0x6d')]=isNaN(_0x404bc6[_0x377c('0x69')])?null:_0x404bc6[_0x377c('0x69')];});_0x49d5e7['on'](_0x377c('0x26'),function(){fs[_0x377c('0x5e')](_0x16f7e7,parseInt('0777',0x8));return db[_0x377c('0x41')]['create'](_0x5bc7cf)['then'](function(_0x21c2c2){var _0x44855d={'role':_0x3e26b6[_0x377c('0x6e')][_0x377c('0x6f')],'userProfileId':_0x3e26b6[_0x377c('0x6e')][_0x377c('0x70')]};if(!_0x44855d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44855d[_0x377c('0x6f')]===_0x377c('0x71')){var _0x4df590=_0x21c2c2['get']({'plain':!![]});return db['UserProfileSection'][_0x377c('0x48')]({'where':{'name':_0x377c('0x24'),'userProfileId':_0x44855d[_0x377c('0x70')]},'raw':!![]})[_0x377c('0x22')](function(_0x31f276){if(_0x31f276&&_0x31f276[_0x377c('0x72')]===0x0){return db[_0x377c('0x25')]['create']({'name':_0x4df590['name'],'resourceId':_0x4df590['id'],'type':_0x31f276['name'],'sectionId':_0x31f276['id']},{})[_0x377c('0x22')](function(){return _0x21c2c2;});}else{return _0x21c2c2;}})[_0x377c('0x46')](function(_0x3fe90f){logger[_0x377c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fe90f);throw _0x3fe90f;});}return _0x21c2c2;})[_0x377c('0x22')](respondWithResult(_0x19e8b1,null))[_0x377c('0x46')](handleError(_0x19e8b1,null));});_0x49d5e7[_0x377c('0x73')]();}catch(_0x4cccaa){_0x19e8b1['status'](0x1f4)[_0x377c('0x29')](_0x4cccaa);}};exports[_0x377c('0x74')]=function(_0x194f94,_0x30bb6c,_0x3c4469){return db[_0x377c('0x41')]['find']({'where':{'id':_0x194f94['params']['id']}})[_0x377c('0x22')](handleEntityNotFound(_0x30bb6c,null))['then'](saveUpdates(_[_0x377c('0x3b')](_0x194f94[_0x377c('0x6e')],[_0x377c('0x28'),'description']),null))[_0x377c('0x22')](respondWithResult(_0x30bb6c,null))['catch'](handleError(_0x30bb6c,null));};exports[_0x377c('0x75')]=function(_0x50f650,_0x359057,_0x101979){return db[_0x377c('0x41')]['find']({'where':{'id':_0x50f650['params']['id']}})[_0x377c('0x22')](function(_0x112116){if(_0x112116){return _0x112116['destroy']();}})[_0x377c('0x22')](function(_0x4c9e5a){var _0x4fff10=path[_0x377c('0x4d')](config[_0x377c('0x4e')],_0x377c('0x76'),util[_0x377c('0x52')](_0x377c('0x53'),_0x4c9e5a[_0x377c('0x4b')],_0x4c9e5a['original_format']));var _0x1a10d5=path[_0x377c('0x4d')](config[_0x377c('0x4e')],_0x377c('0x4f'),util['format'](_0x377c('0x53'),_0x4c9e5a[_0x377c('0x4b')],_0x4c9e5a[_0x377c('0x4c')]));fs[_0x377c('0x60')](_0x4fff10);fs[_0x377c('0x60')](_0x1a10d5);return _0x4c9e5a;})[_0x377c('0x22')](function(_0x56a1ab){if(_0x56a1ab){return _0x359057['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x359057,null))[_0x377c('0x46')](handleError(_0x359057,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4699afc..e7b1c2b 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 _0x9206=['Sound','tools_sounds','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x129184,_0x374390){var _0x502d8d=function(_0x19ca79){while(--_0x19ca79){_0x129184['push'](_0x129184['shift']());}};_0x502d8d(++_0x374390);}(_0x9206,0x152));var _0x6920=function(_0x4c2c7d,_0x43d8da){_0x4c2c7d=_0x4c2c7d-0x0;var _0x36e976=_0x9206[_0x4c2c7d];return _0x36e976;};'use strict';var _=require(_0x6920('0x0'));var util=require('util');var logger=require(_0x6920('0x1'))(_0x6920('0x2'));var moment=require(_0x6920('0x3'));var BPromise=require(_0x6920('0x4'));var rp=require(_0x6920('0x5'));var fs=require('fs');var path=require(_0x6920('0x6'));var rimraf=require(_0x6920('0x7'));var config=require(_0x6920('0x8'));var attributes=require('./sound.attributes');module[_0x6920('0x9')]=function(_0x29a334,_0x5c7b02){return _0x29a334['define'](_0x6920('0xa'),attributes,{'tableName':_0x6920('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8785=['Sound','tools_sounds','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./sound.attributes','exports','define'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x8785,0x15e));var _0x5878=function(_0x57d5ad,_0x1b5cc4){_0x57d5ad=_0x57d5ad-0x0;var _0xd45663=_0x8785[_0x57d5ad];return _0xd45663;};'use strict';var _=require(_0x5878('0x0'));var util=require('util');var logger=require(_0x5878('0x1'))(_0x5878('0x2'));var moment=require(_0x5878('0x3'));var BPromise=require('bluebird');var rp=require(_0x5878('0x4'));var fs=require('fs');var path=require(_0x5878('0x5'));var rimraf=require(_0x5878('0x6'));var config=require('../../config/environment');var attributes=require(_0x5878('0x7'));module[_0x5878('0x8')]=function(_0xf42472,_0x533ef6){return _0xf42472[_0x5878('0x9')](_0x5878('0xa'),attributes,{'tableName':_0x5878('0xb'),'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 93e7076..01e1400 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 _0x90ec=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x18147e,_0x1d8690){var _0x178987=function(_0x195a5b){while(--_0x195a5b){_0x18147e['push'](_0x18147e['shift']());}};_0x178987(++_0x1d8690);}(_0x90ec,0x139));var _0xc90e=function(_0x14113e,_0x496ecc){_0x14113e=_0x14113e-0x0;var _0x3fcca4=_0x90ec[_0x14113e];return _0x3fcca4;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var moment=require(_0xc90e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc90e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc90e('0x4'));var logger=require(_0xc90e('0x5'))(_0xc90e('0x6'));var config=require(_0xc90e('0x7'));var jayson=require(_0xc90e('0x8'));var client=jayson[_0xc90e('0x9')][_0xc90e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f08d3,_0x51c558,_0x1ca13b){return new BPromise(function(_0x3d8b3a,_0x515f4b){return client[_0xc90e('0xb')](_0x5f08d3,_0x1ca13b)[_0xc90e('0xc')](function(_0x4fbe18){logger[_0xc90e('0xd')]('Sound,\x20%s,\x20%s',_0x51c558,_0xc90e('0xe'));logger[_0xc90e('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x51c558,_0xc90e('0xe'),JSON[_0xc90e('0x10')](_0x4fbe18));if(_0x4fbe18[_0xc90e('0x11')]){if(_0x4fbe18['error'][_0xc90e('0x12')]===0x1f4){logger[_0xc90e('0x11')](_0xc90e('0x13'),_0x51c558,_0x4fbe18[_0xc90e('0x11')][_0xc90e('0x14')]);return _0x515f4b(_0x4fbe18[_0xc90e('0x11')][_0xc90e('0x14')]);}logger[_0xc90e('0x11')](_0xc90e('0x13'),_0x51c558,_0x4fbe18[_0xc90e('0x11')][_0xc90e('0x14')]);return _0x3d8b3a(_0x4fbe18[_0xc90e('0x11')][_0xc90e('0x14')]);}else{logger[_0xc90e('0xd')](_0xc90e('0x13'),_0x51c558,'request\x20sent');_0x3d8b3a(_0x4fbe18[_0xc90e('0x15')][_0xc90e('0x14')]);}})[_0xc90e('0x16')](function(_0xe5bac0){logger['error']('Sound,\x20%s,\x20%s',_0x51c558,_0xe5bac0);_0x515f4b(_0xe5bac0);});});}exports[_0xc90e('0x17')]=function(_0x5c426c){var _0x149948=this;return new Promise(function(_0x151402,_0x82ece0){return db[_0xc90e('0x18')][_0xc90e('0x19')]({'raw':_0x5c426c['options']?_0x5c426c[_0xc90e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c426c['options']?_0x5c426c['options'][_0xc90e('0x1b')]||null:null,'attributes':_0x5c426c[_0xc90e('0x1a')]?_0x5c426c['options']['attributes']||null:null,'include':_0x5c426c['options']?_0x5c426c['options'][_0xc90e('0x1c')]?_[_0xc90e('0x1d')](_0x5c426c[_0xc90e('0x1a')][_0xc90e('0x1c')],function(_0x2202ed){return{'model':db[_0x2202ed[_0xc90e('0x1e')]],'as':_0x2202ed['as'],'attributes':_0x2202ed[_0xc90e('0x1f')],'include':_0x2202ed[_0xc90e('0x1c')]?_[_0xc90e('0x1d')](_0x2202ed[_0xc90e('0x1c')],function(_0x5e52c2){return{'model':db[_0x5e52c2[_0xc90e('0x1e')]],'as':_0x5e52c2['as'],'attributes':_0x5e52c2[_0xc90e('0x1f')],'include':_0x5e52c2[_0xc90e('0x1c')]?_[_0xc90e('0x1d')](_0x5e52c2['include'],function(_0x304d34){return{'model':db[_0x304d34[_0xc90e('0x1e')]],'as':_0x304d34['as'],'attributes':_0x304d34[_0xc90e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc90e('0xc')](function(_0x4a7053){logger[_0xc90e('0xd')](_0xc90e('0x17'),_0x5c426c);logger[_0xc90e('0xf')](_0xc90e('0x17'),_0x5c426c,JSON[_0xc90e('0x10')](_0x4a7053));_0x151402(_0x4a7053);})[_0xc90e('0x16')](function(_0x395b8f){logger[_0xc90e('0x11')](_0xc90e('0x17'),_0x395b8f[_0xc90e('0x14')],_0x5c426c);_0x82ece0(_0x149948[_0xc90e('0x11')](0x1f4,_0x395b8f['message']));});});}; \ No newline at end of file +var _0x7d88=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','catch','lodash','util','randomstring','ioredis'];(function(_0x4e865d,_0x5ce5fe){var _0x5cd7ff=function(_0x5b1f94){while(--_0x5b1f94){_0x4e865d['push'](_0x4e865d['shift']());}};_0x5cd7ff(++_0x5ce5fe);}(_0x7d88,0xb6));var _0x87d8=function(_0x4dad2e,_0x176e9b){_0x4dad2e=_0x4dad2e-0x0;var _0xa328f7=_0x7d88[_0x4dad2e];return _0xa328f7;};'use strict';var _=require(_0x87d8('0x0'));var util=require(_0x87d8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87d8('0x2'));var fs=require('fs');var Redis=require(_0x87d8('0x3'));var db=require(_0x87d8('0x4'))['db'];var utils=require(_0x87d8('0x5'));var logger=require('../../config/logger')(_0x87d8('0x6'));var config=require(_0x87d8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0752,_0x1acaf2,_0x196e1d){return new BPromise(function(_0x8cad29,_0x3600e4){return client[_0x87d8('0x9')](_0x5b0752,_0x196e1d)['then'](function(_0x4c8840){logger[_0x87d8('0xa')](_0x87d8('0xb'),_0x1acaf2,_0x87d8('0xc'));logger[_0x87d8('0xd')](_0x87d8('0xe'),_0x1acaf2,_0x87d8('0xc'),JSON[_0x87d8('0xf')](_0x4c8840));if(_0x4c8840['error']){if(_0x4c8840['error']['code']===0x1f4){logger[_0x87d8('0x10')](_0x87d8('0xb'),_0x1acaf2,_0x4c8840[_0x87d8('0x10')][_0x87d8('0x11')]);return _0x3600e4(_0x4c8840[_0x87d8('0x10')][_0x87d8('0x11')]);}logger[_0x87d8('0x10')](_0x87d8('0xb'),_0x1acaf2,_0x4c8840[_0x87d8('0x10')][_0x87d8('0x11')]);return _0x8cad29(_0x4c8840[_0x87d8('0x10')]['message']);}else{logger[_0x87d8('0xa')](_0x87d8('0xb'),_0x1acaf2,_0x87d8('0xc'));_0x8cad29(_0x4c8840[_0x87d8('0x12')][_0x87d8('0x11')]);}})['catch'](function(_0x263047){logger[_0x87d8('0x10')](_0x87d8('0xb'),_0x1acaf2,_0x263047);_0x3600e4(_0x263047);});});}exports[_0x87d8('0x13')]=function(_0x3abf9d){var _0x44599f=this;return new Promise(function(_0x1be7c4,_0x12c26b){return db[_0x87d8('0x14')][_0x87d8('0x15')]({'raw':_0x3abf9d[_0x87d8('0x16')]?_0x3abf9d[_0x87d8('0x16')][_0x87d8('0x17')]===undefined?!![]:![]:!![],'where':_0x3abf9d[_0x87d8('0x16')]?_0x3abf9d['options'][_0x87d8('0x18')]||null:null,'attributes':_0x3abf9d[_0x87d8('0x16')]?_0x3abf9d[_0x87d8('0x16')][_0x87d8('0x19')]||null:null,'include':_0x3abf9d[_0x87d8('0x16')]?_0x3abf9d['options'][_0x87d8('0x1a')]?_[_0x87d8('0x1b')](_0x3abf9d[_0x87d8('0x16')][_0x87d8('0x1a')],function(_0x16c79f){return{'model':db[_0x16c79f['model']],'as':_0x16c79f['as'],'attributes':_0x16c79f[_0x87d8('0x19')],'include':_0x16c79f['include']?_[_0x87d8('0x1b')](_0x16c79f[_0x87d8('0x1a')],function(_0x472705){return{'model':db[_0x472705[_0x87d8('0x1c')]],'as':_0x472705['as'],'attributes':_0x472705[_0x87d8('0x19')],'include':_0x472705['include']?_[_0x87d8('0x1b')](_0x472705[_0x87d8('0x1a')],function(_0x5769cd){return{'model':db[_0x5769cd['model']],'as':_0x5769cd['as'],'attributes':_0x5769cd[_0x87d8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x87d8('0x1d')](function(_0x120e77){logger[_0x87d8('0xa')](_0x87d8('0x13'),_0x3abf9d);logger['debug'](_0x87d8('0x13'),_0x3abf9d,JSON['stringify'](_0x120e77));_0x1be7c4(_0x120e77);})[_0x87d8('0x1e')](function(_0x2a5710){logger[_0x87d8('0x10')](_0x87d8('0x13'),_0x2a5710['message'],_0x3abf9d);_0x12c26b(_0x44599f[_0x87d8('0x10')](0x1f4,_0x2a5710[_0x87d8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e781fba..7fbcb5a 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x36a947,_0x1f0510){var _0x34e818=function(_0x117bca){while(--_0x117bca){_0x36a947['push'](_0x36a947['shift']());}};_0x34e818(++_0x1f0510);}(_0x14a0,0x8e));var _0x014a=function(_0x11c584,_0x21bc3a){_0x11c584=_0x11c584-0x0;var _0x3d0954=_0x14a0[_0x11c584];return _0x3d0954;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd1035c,_0x3c9c25){var _0x5b5813=function(_0x5b264d){while(--_0x5b264d){_0xd1035c['push'](_0xd1035c['shift']());}};_0x5b5813(++_0x3c9c25);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c566d,_0x55d066){_0x4c566d=_0x4c566d-0x0;var _0x33fd32=_0xb10b[_0x4c566d];return _0x33fd32;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 8a4a9cc..053d78d 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 _0x7903=['STRING','sequelize','exports','TEXT','medium','out'];(function(_0x57cea5,_0x4776a0){var _0x25d64e=function(_0x1b8f2b){while(--_0x1b8f2b){_0x57cea5['push'](_0x57cea5['shift']());}};_0x25d64e(++_0x4776a0);}(_0x7903,0xd9));var _0x3790=function(_0x4eed00,_0x3349dd){_0x4eed00=_0x4eed00-0x0;var _0xfcb43b=_0x7903[_0x4eed00];return _0xfcb43b;};'use strict';var Sequelize=require(_0x3790('0x0'));module[_0x3790('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x3790('0x2')](_0x3790('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3790('0x4')),'defaultValue':_0x3790('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3790('0x5')]},'providerResponse':{'type':Sequelize[_0x3790('0x2')]}}; \ No newline at end of file +var _0x7a65=['TEXT','ENUM','out','sequelize','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a65,0xa3));var _0x57a6=function(_0xecf235,_0xb134a3){_0xecf235=_0xecf235-0x0;var _0x243274=_0x7a65[_0xecf235];return _0x243274;};'use strict';var Sequelize=require(_0x57a6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x57a6('0x1')]},'body':{'type':Sequelize[_0x57a6('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x57a6('0x3')]('in',_0x57a6('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x57a6('0x1')]},'providerResponse':{'type':Sequelize[_0x57a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ad61f7c..d89e4f5 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 _0xa49b=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','destroy','rimraf','zip-dir'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0xa49b,0x126));var _0xba49=function(_0x3c4e56,_0xf3e167){_0x3c4e56=_0x3c4e56-0x0;var _0x2216b5=_0xa49b[_0x3c4e56];return _0x2216b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba49('0x0'));var zipdir=require(_0xba49('0x1'));var jsonpatch=require(_0xba49('0x2'));var rp=require(_0xba49('0x3'));var moment=require('moment');var BPromise=require(_0xba49('0x4'));var Mustache=require(_0xba49('0x5'));var util=require(_0xba49('0x6'));var path=require('path');var sox=require(_0xba49('0x7'));var csv=require(_0xba49('0x8'));var ejs=require(_0xba49('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba49('0xa'));var squel=require('squel');var crypto=require(_0xba49('0xb'));var jsforce=require(_0xba49('0xc'));var deskjs=require(_0xba49('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba49('0xe'));var Papa=require(_0xba49('0xf'));var Redis=require(_0xba49('0x10'));var authService=require(_0xba49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xba49('0x12'));var hardwareService=require(_0xba49('0x13'));var logger=require(_0xba49('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xba49('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5249cd,_0x324539){_0x324539=_0x324539||0xcc;return function(_0x498a91){if(_0x498a91){return _0x5249cd['sendStatus'](_0x324539);}return _0x5249cd[_0xba49('0x16')](_0x324539)[_0xba49('0x17')]();};}function respondWithResult(_0x1ad55f,_0x33b1c8){_0x33b1c8=_0x33b1c8||0xc8;return function(_0x5cc5b2){if(_0x5cc5b2){return _0x1ad55f[_0xba49('0x16')](_0x33b1c8)[_0xba49('0x18')](_0x5cc5b2);}};}function respondWithFilteredResult(_0x483d0e,_0x51979b){return function(_0xc1053a){if(_0xc1053a){var _0x1e11e4=typeof _0x51979b[_0xba49('0x19')]===_0xba49('0x1a')&&typeof _0x51979b['limit']===_0xba49('0x1a');var _0x38c584=_0xc1053a[_0xba49('0x1b')];var _0x5cc0fe=_0x1e11e4?0x0:_0x51979b[_0xba49('0x19')];var _0x3a0854=_0x1e11e4?_0xc1053a[_0xba49('0x1b')]:_0x51979b[_0xba49('0x19')]+_0x51979b['limit'];var _0x2dc548;if(_0x3a0854>=_0x38c584){_0x3a0854=_0x38c584;_0x2dc548=0xc8;}else{_0x2dc548=0xce;}_0x483d0e['status'](_0x2dc548);return _0x483d0e[_0xba49('0x1c')]('Content-Range',_0x5cc0fe+'-'+_0x3a0854+'/'+_0x38c584)[_0xba49('0x18')](_0xc1053a);}return null;};}function patchUpdates(_0x36b21b){return function(_0x4524e2){try{jsonpatch[_0xba49('0x1d')](_0x4524e2,_0x36b21b,!![]);}catch(_0x11cb39){return BPromise[_0xba49('0x1e')](_0x11cb39);}return _0x4524e2[_0xba49('0x1f')]();};}function saveUpdates(_0x331ec2,_0x2abc3b){return function(_0x4f1f1d){if(_0x4f1f1d){return _0x4f1f1d['update'](_0x331ec2)[_0xba49('0x20')](function(_0x42670c){return _0x42670c;});}return null;};}function removeEntity(_0x479f81,_0x54c9cd){return function(_0x5711ed){if(_0x5711ed){return _0x5711ed['destroy']()[_0xba49('0x20')](function(){_0x479f81[_0xba49('0x16')](0xcc)[_0xba49('0x17')]();});}};}function handleEntityNotFound(_0x14a43c,_0x81f0aa){return function(_0x34c92b){if(!_0x34c92b){_0x14a43c[_0xba49('0x21')](0x194);}return _0x34c92b;};}function handleError(_0x216e1e,_0x51345d){_0x51345d=_0x51345d||0x1f4;return function(_0x437357){logger[_0xba49('0x22')](_0x437357[_0xba49('0x23')]);if(_0x437357['name']){delete _0x437357[_0xba49('0x24')];}_0x216e1e[_0xba49('0x16')](_0x51345d)[_0xba49('0x25')](_0x437357);};}exports['index']=function(_0x214e20,_0x15f9ac){var _0x529415={},_0x2c0854={},_0x3d62af={'count':0x0,'rows':[]};var _0x18e661=_[_0xba49('0x26')](db[_0xba49('0x27')][_0xba49('0x28')],function(_0x5ea525){return{'name':_0x5ea525[_0xba49('0x29')],'type':_0x5ea525['type'][_0xba49('0x2a')]};});_0x2c0854[_0xba49('0x2b')]=_[_0xba49('0x26')](_0x18e661,'name');_0x2c0854[_0xba49('0x2c')]=_[_0xba49('0x2d')](_0x214e20[_0xba49('0x2c')]);_0x2c0854['filters']=_[_0xba49('0x2e')](_0x2c0854[_0xba49('0x2b')],_0x2c0854['query']);_0x529415[_0xba49('0x2f')]=_[_0xba49('0x2e')](_0x2c0854[_0xba49('0x2b')],qs['fields'](_0x214e20['query'][_0xba49('0x30')]));_0x529415[_0xba49('0x2f')]=_0x529415[_0xba49('0x2f')][_0xba49('0x31')]?_0x529415[_0xba49('0x2f')]:_0x2c0854[_0xba49('0x2b')];if(!_0x214e20['query'][_0xba49('0x32')](_0xba49('0x33'))){_0x529415['limit']=qs[_0xba49('0x34')](_0x214e20['query']['limit']);_0x529415[_0xba49('0x19')]=qs['offset'](_0x214e20[_0xba49('0x2c')][_0xba49('0x19')]);}_0x529415[_0xba49('0x35')]=qs[_0xba49('0x36')](_0x214e20[_0xba49('0x2c')][_0xba49('0x36')]);_0x529415[_0xba49('0x37')]=qs[_0xba49('0x38')](_[_0xba49('0x39')](_0x214e20[_0xba49('0x2c')],_0x2c0854['filters']),_0x18e661);if(_0x214e20[_0xba49('0x2c')][_0xba49('0x3a')]){_0x529415[_0xba49('0x37')]=_[_0xba49('0x3b')](_0x529415[_0xba49('0x37')],{'$or':_[_0xba49('0x26')](_0x18e661,function(_0x1a438f){if(_0x1a438f['type']!==_0xba49('0x3c')){var _0x500fd2={};_0x500fd2[_0x1a438f[_0xba49('0x24')]]={'$like':'%'+_0x214e20['query']['filter']+'%'};return _0x500fd2;}})});}_0x529415=_[_0xba49('0x3b')]({},_0x529415,_0x214e20[_0xba49('0x3d')]);var _0x28e5fa={'where':_0x529415['where']};return db['SquareMessage']['count'](_0x28e5fa)[_0xba49('0x20')](function(_0x567c33){_0x3d62af[_0xba49('0x1b')]=_0x567c33;if(_0x214e20[_0xba49('0x2c')]['includeAll']){_0x529415[_0xba49('0x3e')]=[{'all':!![]}];}return db[_0xba49('0x27')][_0xba49('0x3f')](_0x529415);})[_0xba49('0x20')](function(_0x1911d1){_0x3d62af[_0xba49('0x40')]=_0x1911d1;return _0x3d62af;})['then'](respondWithFilteredResult(_0x15f9ac,_0x529415))['catch'](handleError(_0x15f9ac,null));};exports[_0xba49('0x41')]=function(_0x265c3c,_0x3810d1){var _0x1d61af={'raw':!![],'where':{'id':_0x265c3c[_0xba49('0x42')]['id']}},_0x3c2a61={};_0x3c2a61[_0xba49('0x2b')]=_[_0xba49('0x2d')](db[_0xba49('0x27')][_0xba49('0x28')]);_0x3c2a61[_0xba49('0x2c')]=_[_0xba49('0x2d')](_0x265c3c[_0xba49('0x2c')]);_0x3c2a61[_0xba49('0x38')]=_['intersection'](_0x3c2a61[_0xba49('0x2b')],_0x3c2a61[_0xba49('0x2c')]);_0x1d61af[_0xba49('0x2f')]=_['intersection'](_0x3c2a61[_0xba49('0x2b')],qs[_0xba49('0x30')](_0x265c3c['query']['fields']));_0x1d61af[_0xba49('0x2f')]=_0x1d61af['attributes'][_0xba49('0x31')]?_0x1d61af[_0xba49('0x2f')]:_0x3c2a61[_0xba49('0x2b')];if(_0x265c3c[_0xba49('0x2c')][_0xba49('0x43')]){_0x1d61af[_0xba49('0x3e')]=[{'all':!![]}];}_0x1d61af=_['merge']({},_0x1d61af,_0x265c3c[_0xba49('0x3d')]);return db[_0xba49('0x27')][_0xba49('0x44')](_0x1d61af)[_0xba49('0x20')](handleEntityNotFound(_0x3810d1,null))['then'](respondWithResult(_0x3810d1,null))[_0xba49('0x45')](handleError(_0x3810d1,null));};exports[_0xba49('0x46')]=function(_0xd899bb,_0x5a811e){return db['SquareMessage'][_0xba49('0x46')](_0xd899bb[_0xba49('0x47')],{})[_0xba49('0x20')](respondWithResult(_0x5a811e,0xc9))['catch'](handleError(_0x5a811e,null));};exports[_0xba49('0x48')]=function(_0x21a49b,_0xd94990){if(_0x21a49b['body']['id']){delete _0x21a49b[_0xba49('0x47')]['id'];}return db[_0xba49('0x27')][_0xba49('0x44')]({'where':{'id':_0x21a49b[_0xba49('0x42')]['id']}})[_0xba49('0x20')](handleEntityNotFound(_0xd94990,null))[_0xba49('0x20')](saveUpdates(_0x21a49b['body'],null))['then'](respondWithResult(_0xd94990,null))['catch'](handleError(_0xd94990,null));};exports[_0xba49('0x49')]=function(_0x34aed7,_0x529fe6){return db[_0xba49('0x27')][_0xba49('0x44')]({'where':{'id':_0x34aed7[_0xba49('0x42')]['id']}})[_0xba49('0x20')](handleEntityNotFound(_0x529fe6,null))['then'](removeEntity(_0x529fe6,null))[_0xba49('0x45')](handleError(_0x529fe6,null));}; \ No newline at end of file +var _0xa051=['length','order','sort','where','filter','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields'];(function(_0x553489,_0x4bf2b3){var _0x21d271=function(_0x2daef6){while(--_0x2daef6){_0x553489['push'](_0x553489['shift']());}};_0x21d271(++_0x4bf2b3);}(_0xa051,0x189));var _0x1a05=function(_0xb4bed,_0x4789c1){_0xb4bed=_0xb4bed-0x0;var _0x380182=_0xa051[_0xb4bed];return _0x380182;};'use strict';var emlformat=require(_0x1a05('0x0'));var rimraf=require(_0x1a05('0x1'));var zipdir=require(_0x1a05('0x2'));var jsonpatch=require(_0x1a05('0x3'));var rp=require(_0x1a05('0x4'));var moment=require(_0x1a05('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1a05('0x6'));var util=require(_0x1a05('0x7'));var path=require(_0x1a05('0x8'));var sox=require('sox');var csv=require(_0x1a05('0x9'));var ejs=require(_0x1a05('0xa'));var fs=require('fs');var fs_extra=require(_0x1a05('0xb'));var _=require(_0x1a05('0xc'));var squel=require(_0x1a05('0xd'));var crypto=require(_0x1a05('0xe'));var jsforce=require(_0x1a05('0xf'));var deskjs=require(_0x1a05('0x10'));var toCsv=require(_0x1a05('0x9'));var querystring=require('querystring');var Papa=require(_0x1a05('0x11'));var Redis=require(_0x1a05('0x12'));var authService=require(_0x1a05('0x13'));var qs=require(_0x1a05('0x14'));var as=require(_0x1a05('0x15'));var hardwareService=require(_0x1a05('0x16'));var logger=require(_0x1a05('0x17'))(_0x1a05('0x18'));var utils=require(_0x1a05('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1a05('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32d6cc,_0x4a97b9){_0x4a97b9=_0x4a97b9||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x32d6cc[_0x1a05('0x1b')](_0x4a97b9);}return _0x32d6cc[_0x1a05('0x1c')](_0x4a97b9)[_0x1a05('0x1d')]();};}function respondWithResult(_0x1ee753,_0x1ee392){_0x1ee392=_0x1ee392||0xc8;return function(_0x1a618d){if(_0x1a618d){return _0x1ee753[_0x1a05('0x1c')](_0x1ee392)[_0x1a05('0x1e')](_0x1a618d);}};}function respondWithFilteredResult(_0x42b8a4,_0x5449e3){return function(_0x5ddbbf){if(_0x5ddbbf){var _0x5db0e0=typeof _0x5449e3[_0x1a05('0x1f')]==='undefined'&&typeof _0x5449e3['limit']===_0x1a05('0x20');var _0x3ab033=_0x5ddbbf[_0x1a05('0x21')];var _0x2aa415=_0x5db0e0?0x0:_0x5449e3[_0x1a05('0x1f')];var _0x394b73=_0x5db0e0?_0x5ddbbf[_0x1a05('0x21')]:_0x5449e3[_0x1a05('0x1f')]+_0x5449e3['limit'];var _0x42763c;if(_0x394b73>=_0x3ab033){_0x394b73=_0x3ab033;_0x42763c=0xc8;}else{_0x42763c=0xce;}_0x42b8a4[_0x1a05('0x1c')](_0x42763c);return _0x42b8a4[_0x1a05('0x22')](_0x1a05('0x23'),_0x2aa415+'-'+_0x394b73+'/'+_0x3ab033)[_0x1a05('0x1e')](_0x5ddbbf);}return null;};}function patchUpdates(_0x350976){return function(_0x242dad){try{jsonpatch[_0x1a05('0x24')](_0x242dad,_0x350976,!![]);}catch(_0x12399e){return BPromise[_0x1a05('0x25')](_0x12399e);}return _0x242dad[_0x1a05('0x26')]();};}function saveUpdates(_0x6427b2,_0x1414e1){return function(_0x2a9b0b){if(_0x2a9b0b){return _0x2a9b0b[_0x1a05('0x27')](_0x6427b2)[_0x1a05('0x28')](function(_0x267db2){return _0x267db2;});}return null;};}function removeEntity(_0x378e70,_0x306171){return function(_0x4470ad){if(_0x4470ad){return _0x4470ad[_0x1a05('0x29')]()['then'](function(){_0x378e70[_0x1a05('0x1c')](0xcc)[_0x1a05('0x1d')]();});}};}function handleEntityNotFound(_0x49ee98,_0x4260e6){return function(_0x108de8){if(!_0x108de8){_0x49ee98[_0x1a05('0x1b')](0x194);}return _0x108de8;};}function handleError(_0x1f17a8,_0xf86745){_0xf86745=_0xf86745||0x1f4;return function(_0x29a95c){logger[_0x1a05('0x2a')](_0x29a95c[_0x1a05('0x2b')]);if(_0x29a95c['name']){delete _0x29a95c['name'];}_0x1f17a8[_0x1a05('0x1c')](_0xf86745)[_0x1a05('0x2c')](_0x29a95c);};}exports['index']=function(_0x1992da,_0x352bc5){var _0x2fa244={},_0x44c97c={},_0x39d209={'count':0x0,'rows':[]};var _0x1b5c8a=_[_0x1a05('0x2d')](db['SquareMessage'][_0x1a05('0x2e')],function(_0x5296ca){return{'name':_0x5296ca['fieldName'],'type':_0x5296ca[_0x1a05('0x2f')][_0x1a05('0x30')]};});_0x44c97c[_0x1a05('0x31')]=_['map'](_0x1b5c8a,_0x1a05('0x32'));_0x44c97c[_0x1a05('0x33')]=_[_0x1a05('0x34')](_0x1992da[_0x1a05('0x33')]);_0x44c97c[_0x1a05('0x35')]=_[_0x1a05('0x36')](_0x44c97c[_0x1a05('0x31')],_0x44c97c[_0x1a05('0x33')]);_0x2fa244[_0x1a05('0x37')]=_[_0x1a05('0x36')](_0x44c97c[_0x1a05('0x31')],qs[_0x1a05('0x38')](_0x1992da[_0x1a05('0x33')]['fields']));_0x2fa244['attributes']=_0x2fa244[_0x1a05('0x37')][_0x1a05('0x39')]?_0x2fa244[_0x1a05('0x37')]:_0x44c97c['model'];if(!_0x1992da[_0x1a05('0x33')]['hasOwnProperty']('nolimit')){_0x2fa244['limit']=qs['limit'](_0x1992da[_0x1a05('0x33')]['limit']);_0x2fa244[_0x1a05('0x1f')]=qs['offset'](_0x1992da[_0x1a05('0x33')][_0x1a05('0x1f')]);}_0x2fa244[_0x1a05('0x3a')]=qs[_0x1a05('0x3b')](_0x1992da[_0x1a05('0x33')]['sort']);_0x2fa244[_0x1a05('0x3c')]=qs[_0x1a05('0x35')](_['pick'](_0x1992da[_0x1a05('0x33')],_0x44c97c[_0x1a05('0x35')]),_0x1b5c8a);if(_0x1992da[_0x1a05('0x33')][_0x1a05('0x3d')]){_0x2fa244[_0x1a05('0x3c')]=_[_0x1a05('0x3e')](_0x2fa244[_0x1a05('0x3c')],{'$or':_['map'](_0x1b5c8a,function(_0x53a64b){if(_0x53a64b[_0x1a05('0x2f')]!==_0x1a05('0x3f')){var _0x13c8c1={};_0x13c8c1[_0x53a64b[_0x1a05('0x32')]]={'$like':'%'+_0x1992da[_0x1a05('0x33')][_0x1a05('0x3d')]+'%'};return _0x13c8c1;}})});}_0x2fa244=_['merge']({},_0x2fa244,_0x1992da['options']);var _0x5b4eb3={'where':_0x2fa244[_0x1a05('0x3c')]};return db[_0x1a05('0x40')][_0x1a05('0x21')](_0x5b4eb3)[_0x1a05('0x28')](function(_0x1e3e0d){_0x39d209[_0x1a05('0x21')]=_0x1e3e0d;if(_0x1992da[_0x1a05('0x33')][_0x1a05('0x41')]){_0x2fa244[_0x1a05('0x42')]=[{'all':!![]}];}return db[_0x1a05('0x40')][_0x1a05('0x43')](_0x2fa244);})[_0x1a05('0x28')](function(_0x4c8383){_0x39d209[_0x1a05('0x44')]=_0x4c8383;return _0x39d209;})[_0x1a05('0x28')](respondWithFilteredResult(_0x352bc5,_0x2fa244))['catch'](handleError(_0x352bc5,null));};exports[_0x1a05('0x45')]=function(_0x3f35a3,_0x1c3406){var _0x4880b3={'raw':!![],'where':{'id':_0x3f35a3[_0x1a05('0x46')]['id']}},_0x582b96={};_0x582b96[_0x1a05('0x31')]=_['keys'](db['SquareMessage']['rawAttributes']);_0x582b96[_0x1a05('0x33')]=_[_0x1a05('0x34')](_0x3f35a3[_0x1a05('0x33')]);_0x582b96['filters']=_[_0x1a05('0x36')](_0x582b96['model'],_0x582b96[_0x1a05('0x33')]);_0x4880b3[_0x1a05('0x37')]=_['intersection'](_0x582b96[_0x1a05('0x31')],qs[_0x1a05('0x38')](_0x3f35a3['query'][_0x1a05('0x38')]));_0x4880b3[_0x1a05('0x37')]=_0x4880b3[_0x1a05('0x37')][_0x1a05('0x39')]?_0x4880b3['attributes']:_0x582b96[_0x1a05('0x31')];if(_0x3f35a3[_0x1a05('0x33')]['includeAll']){_0x4880b3['include']=[{'all':!![]}];}_0x4880b3=_[_0x1a05('0x3e')]({},_0x4880b3,_0x3f35a3['options']);return db[_0x1a05('0x40')]['find'](_0x4880b3)[_0x1a05('0x28')](handleEntityNotFound(_0x1c3406,null))[_0x1a05('0x28')](respondWithResult(_0x1c3406,null))['catch'](handleError(_0x1c3406,null));};exports[_0x1a05('0x47')]=function(_0x490f61,_0x16d729){return db['SquareMessage'][_0x1a05('0x47')](_0x490f61[_0x1a05('0x48')],{})[_0x1a05('0x28')](respondWithResult(_0x16d729,0xc9))[_0x1a05('0x49')](handleError(_0x16d729,null));};exports[_0x1a05('0x27')]=function(_0x49bda3,_0x8128ce){if(_0x49bda3['body']['id']){delete _0x49bda3[_0x1a05('0x48')]['id'];}return db[_0x1a05('0x40')][_0x1a05('0x4a')]({'where':{'id':_0x49bda3[_0x1a05('0x46')]['id']}})[_0x1a05('0x28')](handleEntityNotFound(_0x8128ce,null))['then'](saveUpdates(_0x49bda3[_0x1a05('0x48')],null))[_0x1a05('0x28')](respondWithResult(_0x8128ce,null))[_0x1a05('0x49')](handleError(_0x8128ce,null));};exports['destroy']=function(_0x499697,_0x3d6c69){return db[_0x1a05('0x40')]['find']({'where':{'id':_0x499697[_0x1a05('0x46')]['id']}})[_0x1a05('0x28')](handleEntityNotFound(_0x3d6c69,null))[_0x1a05('0x28')](removeEntity(_0x3d6c69,null))['catch'](handleError(_0x3d6c69,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4495944..1d0576b 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 _0xd75d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define','SquareMessage','square_messages'];(function(_0x2a3a1e,_0x23c7e7){var _0x3fb157=function(_0x329123){while(--_0x329123){_0x2a3a1e['push'](_0x2a3a1e['shift']());}};_0x3fb157(++_0x23c7e7);}(_0xd75d,0xe7));var _0xdd75=function(_0xd75381,_0x557296){_0xd75381=_0xd75381-0x0;var _0x20463a=_0xd75d[_0xd75381];return _0x20463a;};'use strict';var _=require(_0xdd75('0x0'));var util=require(_0xdd75('0x1'));var logger=require(_0xdd75('0x2'))(_0xdd75('0x3'));var moment=require('moment');var BPromise=require(_0xdd75('0x4'));var rp=require(_0xdd75('0x5'));var fs=require('fs');var path=require(_0xdd75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xdd75('0x7')]=function(_0x29f641,_0x14ad7d){return _0x29f641[_0xdd75('0x8')](_0xdd75('0x9'),attributes,{'tableName':_0xdd75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabaf=['path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise'];(function(_0x2f4000,_0x513d52){var _0x624b2a=function(_0x3a58a0){while(--_0x3a58a0){_0x2f4000['push'](_0x2f4000['shift']());}};_0x624b2a(++_0x513d52);}(_0xabaf,0xa0));var _0xfaba=function(_0x1dde34,_0x5dc607){_0x1dde34=_0x1dde34-0x0;var _0x10f092=_0xabaf[_0x1dde34];return _0x10f092;};'use strict';var _=require(_0xfaba('0x0'));var util=require(_0xfaba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfaba('0x2'));var BPromise=require(_0xfaba('0x3'));var rp=require(_0xfaba('0x4'));var fs=require('fs');var path=require(_0xfaba('0x5'));var rimraf=require(_0xfaba('0x6'));var config=require(_0xfaba('0x7'));var attributes=require(_0xfaba('0x8'));module['exports']=function(_0x21ea14,_0x27d1d2){return _0x21ea14['define'](_0xfaba('0x9'),attributes,{'tableName':_0xfaba('0xa'),'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 851e8c8..75cfd90 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 _0x42ea=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SquareMessage','create','body','options','raw','CreateSquareMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x15123f,_0x1522ea){var _0x17a280=function(_0x5a8c4){while(--_0x5a8c4){_0x15123f['push'](_0x15123f['shift']());}};_0x17a280(++_0x1522ea);}(_0x42ea,0x6e));var _0xa42e=function(_0x3a78e2,_0x4dbe20){_0x3a78e2=_0x3a78e2-0x0;var _0x2f80ea=_0x42ea[_0x3a78e2];return _0x2f80ea;};'use strict';var _=require(_0xa42e('0x0'));var util=require(_0xa42e('0x1'));var moment=require(_0xa42e('0x2'));var BPromise=require(_0xa42e('0x3'));var rs=require(_0xa42e('0x4'));var fs=require('fs');var Redis=require(_0xa42e('0x5'));var db=require(_0xa42e('0x6'))['db'];var utils=require(_0xa42e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa42e('0x8'));var jayson=require(_0xa42e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a98ac,_0x51cc74,_0x49770b){return new BPromise(function(_0x3cb995,_0x57bf07){return client[_0xa42e('0xa')](_0x1a98ac,_0x49770b)[_0xa42e('0xb')](function(_0x3a0408){logger[_0xa42e('0xc')](_0xa42e('0xd'),_0x51cc74,'request\x20sent');logger[_0xa42e('0xe')](_0xa42e('0xf'),_0x51cc74,_0xa42e('0x10'),JSON[_0xa42e('0x11')](_0x3a0408));if(_0x3a0408[_0xa42e('0x12')]){if(_0x3a0408[_0xa42e('0x12')][_0xa42e('0x13')]===0x1f4){logger[_0xa42e('0x12')](_0xa42e('0xd'),_0x51cc74,_0x3a0408[_0xa42e('0x12')][_0xa42e('0x14')]);return _0x57bf07(_0x3a0408[_0xa42e('0x12')]['message']);}logger[_0xa42e('0x12')](_0xa42e('0xd'),_0x51cc74,_0x3a0408[_0xa42e('0x12')][_0xa42e('0x14')]);return _0x3cb995(_0x3a0408['error'][_0xa42e('0x14')]);}else{logger[_0xa42e('0xc')]('SquareMessage,\x20%s,\x20%s',_0x51cc74,'request\x20sent');_0x3cb995(_0x3a0408[_0xa42e('0x15')][_0xa42e('0x14')]);}})['catch'](function(_0xd4b384){logger[_0xa42e('0x12')]('SquareMessage,\x20%s,\x20%s',_0x51cc74,_0xd4b384);_0x57bf07(_0xd4b384);});});}exports['CreateSquareMessage']=function(_0x4caf89){var _0x359c63=this;return new Promise(function(_0x42000c,_0x58d1dd){return db[_0xa42e('0x16')][_0xa42e('0x17')](_0x4caf89[_0xa42e('0x18')],{'raw':_0x4caf89[_0xa42e('0x19')]?_0x4caf89[_0xa42e('0x19')][_0xa42e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a7b43){logger[_0xa42e('0xc')](_0xa42e('0x1b'),_0x4caf89);logger[_0xa42e('0xe')](_0xa42e('0x1b'),_0x4caf89,JSON[_0xa42e('0x11')](_0x4a7b43));_0x42000c(_0x4a7b43);})[_0xa42e('0x1c')](function(_0x1348e2){logger[_0xa42e('0x12')](_0xa42e('0x1b'),_0x1348e2['message'],_0x4caf89);_0x58d1dd(_0x359c63[_0xa42e('0x12')](0x1f4,_0x1348e2[_0xa42e('0x14')]));});});}; \ No newline at end of file +var _0x81b6=['then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x1e4929,_0x28f49d){var _0x1132b2=function(_0x585d9e){while(--_0x585d9e){_0x1e4929['push'](_0x1e4929['shift']());}};_0x1132b2(++_0x28f49d);}(_0x81b6,0x139));var _0x681b=function(_0xa32ada,_0x33cbde){_0xa32ada=_0xa32ada-0x0;var _0x2c95c8=_0x81b6[_0xa32ada];return _0x2c95c8;};'use strict';var _=require(_0x681b('0x0'));var util=require(_0x681b('0x1'));var moment=require(_0x681b('0x2'));var BPromise=require(_0x681b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681b('0x4'));var db=require(_0x681b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x681b('0x6'))(_0x681b('0x7'));var config=require(_0x681b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x681b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e6da,_0x4416c9,_0x20dbf6){return new BPromise(function(_0x580195,_0x459f8d){return client[_0x681b('0xa')](_0x45e6da,_0x20dbf6)[_0x681b('0xb')](function(_0x508095){logger[_0x681b('0xc')](_0x681b('0xd'),_0x4416c9,_0x681b('0xe'));logger[_0x681b('0xf')](_0x681b('0x10'),_0x4416c9,'request\x20sent',JSON['stringify'](_0x508095));if(_0x508095[_0x681b('0x11')]){if(_0x508095[_0x681b('0x11')]['code']===0x1f4){logger[_0x681b('0x11')](_0x681b('0xd'),_0x4416c9,_0x508095[_0x681b('0x11')][_0x681b('0x12')]);return _0x459f8d(_0x508095[_0x681b('0x11')][_0x681b('0x12')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x4416c9,_0x508095[_0x681b('0x11')][_0x681b('0x12')]);return _0x580195(_0x508095[_0x681b('0x11')][_0x681b('0x12')]);}else{logger[_0x681b('0xc')](_0x681b('0xd'),_0x4416c9,'request\x20sent');_0x580195(_0x508095[_0x681b('0x13')][_0x681b('0x12')]);}})[_0x681b('0x14')](function(_0x4af855){logger[_0x681b('0x11')](_0x681b('0xd'),_0x4416c9,_0x4af855);_0x459f8d(_0x4af855);});});}exports['CreateSquareMessage']=function(_0x212b17){var _0x365be6=this;return new Promise(function(_0x2a989f,_0x13a8c0){return db[_0x681b('0x15')][_0x681b('0x16')](_0x212b17[_0x681b('0x17')],{'raw':_0x212b17[_0x681b('0x18')]?_0x212b17[_0x681b('0x18')][_0x681b('0x19')]===undefined?!![]:![]:!![]})[_0x681b('0xb')](function(_0x2a928c){logger[_0x681b('0xc')]('CreateSquareMessage',_0x212b17);logger[_0x681b('0xf')](_0x681b('0x1a'),_0x212b17,JSON['stringify'](_0x2a928c));_0x2a989f(_0x2a928c);})[_0x681b('0x14')](function(_0x27fa43){logger[_0x681b('0x11')](_0x681b('0x1a'),_0x27fa43[_0x681b('0x12')],_0x212b17);_0x13a8c0(_0x365be6['error'](0x1f4,_0x27fa43[_0x681b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a89ced1..786dca2 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 _0x184d=['test','create','put','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','15s'];(function(_0xecefa6,_0x57a405){var _0x4b2147=function(_0x40baca){while(--_0x40baca){_0xecefa6['push'](_0xecefa6['shift']());}};_0x4b2147(++_0x57a405);}(_0x184d,0x191));var _0xd184=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x184d[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xd184('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd184('0x1'));var express=require('express');var router=express[_0xd184('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd184('0x3'));var interaction=require(_0xd184('0x4'));var config=require(_0xd184('0x5'));var controller=require(_0xd184('0x6'));router[_0xd184('0x7')]('/',auth['isAuthenticated'](),controller[_0xd184('0x8')]);router[_0xd184('0x7')](_0xd184('0x9'),auth[_0xd184('0xa')](),controller[_0xd184('0xb')]);router[_0xd184('0x7')]('/:id/test',auth[_0xd184('0xa')](),timeout(_0xd184('0xc')),controller[_0xd184('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd184('0xe')]);router[_0xd184('0xf')]('/:id',auth[_0xd184('0xa')](),controller['update']);router[_0xd184('0x10')](_0xd184('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xd184('0x11')]=router; \ No newline at end of file +var _0x89df=['/:id','show','/:id/test','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x89df,0x121));var _0xf89d=function(_0x22ea4c,_0x9f8f58){_0x22ea4c=_0x22ea4c-0x0;var _0xb8a6be=_0x89df[_0x22ea4c];return _0xb8a6be;};'use strict';var multer=require(_0xf89d('0x0'));var util=require(_0xf89d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf89d('0x2'));var router=express[_0xf89d('0x3')]();var fs_extra=require(_0xf89d('0x4'));var auth=require(_0xf89d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf89d('0x6'));var controller=require(_0xf89d('0x7'));router['get']('/',auth[_0xf89d('0x8')](),controller[_0xf89d('0x9')]);router[_0xf89d('0xa')](_0xf89d('0xb'),auth['isAuthenticated'](),controller[_0xf89d('0xc')]);router['get'](_0xf89d('0xd'),auth[_0xf89d('0x8')](),timeout('15s'),controller['test']);router[_0xf89d('0xe')]('/',auth[_0xf89d('0x8')](),controller[_0xf89d('0xf')]);router[_0xf89d('0x10')](_0xf89d('0xb'),auth[_0xf89d('0x8')](),controller['update']);router[_0xf89d('0x11')](_0xf89d('0xb'),auth[_0xf89d('0x8')](),controller[_0xf89d('0x12')]);module[_0xf89d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1083b8d..6cd58c5 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 _0xd87c=['exports','STRING','name','sequelize'];(function(_0x272d8a,_0x45184b){var _0x26286e=function(_0x93beaa){while(--_0x93beaa){_0x272d8a['push'](_0x272d8a['shift']());}};_0x26286e(++_0x45184b);}(_0xd87c,0x18f));var _0xcd87=function(_0x1230f3,_0xd566cb){_0x1230f3=_0x1230f3-0x0;var _0x1b6b1f=_0xd87c[_0x1230f3];return _0x1b6b1f;};'use strict';var Sequelize=require(_0xcd87('0x0'));module[_0xcd87('0x1')]={'name':{'type':Sequelize[_0xcd87('0x2')],'unique':_0xcd87('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xcd87('0x2')]},'description':{'type':Sequelize[_0xcd87('0x2')]}}; \ No newline at end of file +var _0x2af9=['exports','STRING','name','sequelize'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x2af9,0xbb));var _0x92af=function(_0x160ade,_0x1aef25){_0x160ade=_0x160ade-0x0;var _0x598eb4=_0x2af9[_0x160ade];return _0x598eb4;};'use strict';var Sequelize=require(_0x92af('0x0'));module[_0x92af('0x1')]={'name':{'type':Sequelize[_0x92af('0x2')],'unique':_0x92af('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x92af('0x2')]},'description':{'type':Sequelize[_0x92af('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 11a3639..b4601a7 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 _0xa9ab=['update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','SquareOdbc','findAll','catch','params','keys','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','find','userProfileId','autoAssociation','dsn','odbc','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject'];(function(_0x79031b,_0x227b18){var _0x4f962a=function(_0x1a26ec){while(--_0x1a26ec){_0x79031b['push'](_0x79031b['shift']());}};_0x4f962a(++_0x227b18);}(_0xa9ab,0x81));var _0xba9a=function(_0x51b362,_0x2a3af3){_0x51b362=_0x51b362-0x0;var _0x18bd6=_0xa9ab[_0x51b362];return _0x18bd6;};'use strict';var emlformat=require(_0xba9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba9a('0x1'));var jsonpatch=require(_0xba9a('0x2'));var rp=require(_0xba9a('0x3'));var moment=require('moment');var BPromise=require(_0xba9a('0x4'));var Mustache=require(_0xba9a('0x5'));var util=require(_0xba9a('0x6'));var path=require(_0xba9a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xba9a('0x8'));var fs=require('fs');var fs_extra=require(_0xba9a('0x9'));var _=require(_0xba9a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba9a('0xb'));var deskjs=require(_0xba9a('0xc'));var toCsv=require(_0xba9a('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba9a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xba9a('0xf'));var hardwareService=require(_0xba9a('0x10'));var logger=require(_0xba9a('0x11'))('api');var utils=require(_0xba9a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xba9a('0x13'));var db=require(_0xba9a('0x14'))['db'];function respondWithStatusCode(_0x56634d,_0x24da91){_0x24da91=_0x24da91||0xcc;return function(_0x191359){if(_0x191359){return _0x56634d['sendStatus'](_0x24da91);}return _0x56634d[_0xba9a('0x15')](_0x24da91)[_0xba9a('0x16')]();};}function respondWithResult(_0x5fb1e5,_0x8ba5a7){_0x8ba5a7=_0x8ba5a7||0xc8;return function(_0x3de36a){if(_0x3de36a){return _0x5fb1e5[_0xba9a('0x15')](_0x8ba5a7)[_0xba9a('0x17')](_0x3de36a);}};}function respondWithFilteredResult(_0x2c7a73,_0x2687e0){return function(_0x131e70){if(_0x131e70){var _0x1de922=typeof _0x2687e0[_0xba9a('0x18')]===_0xba9a('0x19')&&typeof _0x2687e0['limit']===_0xba9a('0x19');var _0x1795ba=_0x131e70[_0xba9a('0x1a')];var _0x3d5eca=_0x1de922?0x0:_0x2687e0[_0xba9a('0x18')];var _0x1f6fe4=_0x1de922?_0x131e70[_0xba9a('0x1a')]:_0x2687e0['offset']+_0x2687e0[_0xba9a('0x1b')];var _0x5a6f32;if(_0x1f6fe4>=_0x1795ba){_0x1f6fe4=_0x1795ba;_0x5a6f32=0xc8;}else{_0x5a6f32=0xce;}_0x2c7a73[_0xba9a('0x15')](_0x5a6f32);return _0x2c7a73[_0xba9a('0x1c')](_0xba9a('0x1d'),_0x3d5eca+'-'+_0x1f6fe4+'/'+_0x1795ba)['json'](_0x131e70);}return null;};}function patchUpdates(_0x49f4ba){return function(_0x9d1bb4){try{jsonpatch['apply'](_0x9d1bb4,_0x49f4ba,!![]);}catch(_0x447263){return BPromise[_0xba9a('0x1e')](_0x447263);}return _0x9d1bb4['save']();};}function saveUpdates(_0x737eb7,_0x3a7c54){return function(_0x1d258c){if(_0x1d258c){return _0x1d258c[_0xba9a('0x1f')](_0x737eb7)[_0xba9a('0x20')](function(_0x4a5b8d){return _0x4a5b8d;});}return null;};}function removeEntity(_0x93a7f7,_0x2bbeb1){return function(_0x857048){if(_0x857048){return _0x857048[_0xba9a('0x21')]()[_0xba9a('0x20')](function(){var _0x5edfa5=_0x857048[_0xba9a('0x22')]({'plain':!![]});var _0x297164='ODBC';return db[_0xba9a('0x23')][_0xba9a('0x21')]({'where':{'type':_0x297164,'resourceId':_0x5edfa5['id']}})[_0xba9a('0x20')](function(){return _0x857048;});})[_0xba9a('0x20')](function(){_0x93a7f7[_0xba9a('0x15')](0xcc)[_0xba9a('0x16')]();});}};}function handleEntityNotFound(_0x3c824c,_0x18890e){return function(_0x5ad889){if(!_0x5ad889){_0x3c824c[_0xba9a('0x24')](0x194);}return _0x5ad889;};}function handleError(_0x4005bb,_0x1da085){_0x1da085=_0x1da085||0x1f4;return function(_0xc12989){logger[_0xba9a('0x25')](_0xc12989[_0xba9a('0x26')]);if(_0xc12989[_0xba9a('0x27')]){delete _0xc12989[_0xba9a('0x27')];}_0x4005bb[_0xba9a('0x15')](_0x1da085)[_0xba9a('0x28')](_0xc12989);};}exports[_0xba9a('0x29')]=function(_0x255c30,_0x23443c){var _0x554c7c={},_0x4da1d2={},_0x5617ff={'count':0x0,'rows':[]};var _0x194306=_[_0xba9a('0x2a')](db['SquareOdbc']['rawAttributes'],function(_0x115105){return{'name':_0x115105[_0xba9a('0x2b')],'type':_0x115105[_0xba9a('0x2c')][_0xba9a('0x2d')]};});_0x4da1d2[_0xba9a('0x2e')]=_[_0xba9a('0x2a')](_0x194306,_0xba9a('0x27'));_0x4da1d2[_0xba9a('0x2f')]=_['keys'](_0x255c30['query']);_0x4da1d2[_0xba9a('0x30')]=_[_0xba9a('0x31')](_0x4da1d2[_0xba9a('0x2e')],_0x4da1d2[_0xba9a('0x2f')]);_0x554c7c['attributes']=_['intersection'](_0x4da1d2[_0xba9a('0x2e')],qs[_0xba9a('0x32')](_0x255c30['query'][_0xba9a('0x32')]));_0x554c7c[_0xba9a('0x33')]=_0x554c7c['attributes'][_0xba9a('0x34')]?_0x554c7c['attributes']:_0x4da1d2[_0xba9a('0x2e')];if(!_0x255c30[_0xba9a('0x2f')]['hasOwnProperty'](_0xba9a('0x35'))){_0x554c7c[_0xba9a('0x1b')]=qs[_0xba9a('0x1b')](_0x255c30['query'][_0xba9a('0x1b')]);_0x554c7c[_0xba9a('0x18')]=qs[_0xba9a('0x18')](_0x255c30[_0xba9a('0x2f')]['offset']);}_0x554c7c[_0xba9a('0x36')]=qs['sort'](_0x255c30[_0xba9a('0x2f')]['sort']);_0x554c7c[_0xba9a('0x37')]=qs[_0xba9a('0x30')](_[_0xba9a('0x38')](_0x255c30[_0xba9a('0x2f')],_0x4da1d2[_0xba9a('0x30')]),_0x194306);if(_0x255c30[_0xba9a('0x2f')][_0xba9a('0x39')]){_0x554c7c['where']=_[_0xba9a('0x3a')](_0x554c7c['where'],{'$or':_[_0xba9a('0x2a')](_0x194306,function(_0x292b81){if(_0x292b81['type']!==_0xba9a('0x3b')){var _0x3c75f8={};_0x3c75f8[_0x292b81[_0xba9a('0x27')]]={'$like':'%'+_0x255c30[_0xba9a('0x2f')][_0xba9a('0x39')]+'%'};return _0x3c75f8;}})});}_0x554c7c=_['merge']({},_0x554c7c,_0x255c30['options']);var _0x252d3a={'where':_0x554c7c[_0xba9a('0x37')]};return db['SquareOdbc']['count'](_0x252d3a)['then'](function(_0x50c765){_0x5617ff['count']=_0x50c765;if(_0x255c30[_0xba9a('0x2f')][_0xba9a('0x3c')]){_0x554c7c[_0xba9a('0x3d')]=[{'all':!![]}];}return db[_0xba9a('0x3e')][_0xba9a('0x3f')](_0x554c7c);})[_0xba9a('0x20')](function(_0xb2b2f0){_0x5617ff['rows']=_0xb2b2f0;return _0x5617ff;})[_0xba9a('0x20')](respondWithFilteredResult(_0x23443c,_0x554c7c))[_0xba9a('0x40')](handleError(_0x23443c,null));};exports['show']=function(_0x19bfe1,_0x2ab95){var _0x2eac23={'raw':!![],'where':{'id':_0x19bfe1[_0xba9a('0x41')]['id']}},_0x1ee1c7={};_0x1ee1c7[_0xba9a('0x2e')]=_[_0xba9a('0x42')](db[_0xba9a('0x3e')][_0xba9a('0x43')]);_0x1ee1c7['query']=_[_0xba9a('0x42')](_0x19bfe1['query']);_0x1ee1c7[_0xba9a('0x30')]=_[_0xba9a('0x31')](_0x1ee1c7[_0xba9a('0x2e')],_0x1ee1c7[_0xba9a('0x2f')]);_0x2eac23[_0xba9a('0x33')]=_[_0xba9a('0x31')](_0x1ee1c7[_0xba9a('0x2e')],qs['fields'](_0x19bfe1[_0xba9a('0x2f')][_0xba9a('0x32')]));_0x2eac23['attributes']=_0x2eac23[_0xba9a('0x33')][_0xba9a('0x34')]?_0x2eac23['attributes']:_0x1ee1c7[_0xba9a('0x2e')];if(_0x19bfe1[_0xba9a('0x2f')]['includeAll']){_0x2eac23[_0xba9a('0x3d')]=[{'all':!![]}];}_0x2eac23=_[_0xba9a('0x3a')]({},_0x2eac23,_0x19bfe1[_0xba9a('0x44')]);return db[_0xba9a('0x3e')]['find'](_0x2eac23)[_0xba9a('0x20')](handleEntityNotFound(_0x2ab95,null))['then'](respondWithResult(_0x2ab95,null))[_0xba9a('0x40')](handleError(_0x2ab95,null));};exports[_0xba9a('0x45')]=function(_0x3fb774,_0x39948d){return db[_0xba9a('0x3e')][_0xba9a('0x45')](_0x3fb774[_0xba9a('0x46')],{})[_0xba9a('0x20')](function(_0x1bcbc9){var _0x321a35=_0x3fb774[_0xba9a('0x47')][_0xba9a('0x22')]({'plain':!![]});if(!_0x321a35)throw new Error(_0xba9a('0x48'));if(_0x321a35[_0xba9a('0x49')]===_0xba9a('0x47')){var _0x19dc61=_0x1bcbc9[_0xba9a('0x22')]({'plain':!![]});var _0x3fcd32=_0xba9a('0x4a');return db['UserProfileSection'][_0xba9a('0x4b')]({'where':{'name':_0x3fcd32,'userProfileId':_0x321a35[_0xba9a('0x4c')]},'raw':!![]})['then'](function(_0x5d6e6f){if(_0x5d6e6f&&_0x5d6e6f[_0xba9a('0x4d')]===0x0){return db['UserProfileResource'][_0xba9a('0x45')]({'name':_0x19dc61['name'],'resourceId':_0x19dc61['id'],'type':_0x5d6e6f[_0xba9a('0x27')],'sectionId':_0x5d6e6f['id']},{})['then'](function(){return _0x1bcbc9;});}else{return _0x1bcbc9;}})[_0xba9a('0x40')](function(_0x225e62){logger[_0xba9a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x225e62);throw _0x225e62;});}return _0x1bcbc9;})['then'](respondWithResult(_0x39948d,0xc9))[_0xba9a('0x40')](handleError(_0x39948d,null));};exports[_0xba9a('0x1f')]=function(_0x1afada,_0x4d9224){if(_0x1afada[_0xba9a('0x46')]['id']){delete _0x1afada[_0xba9a('0x46')]['id'];}return db['SquareOdbc'][_0xba9a('0x4b')]({'where':{'id':_0x1afada['params']['id']}})[_0xba9a('0x20')](handleEntityNotFound(_0x4d9224,null))[_0xba9a('0x20')](saveUpdates(_0x1afada[_0xba9a('0x46')],null))[_0xba9a('0x20')](respondWithResult(_0x4d9224,null))[_0xba9a('0x40')](handleError(_0x4d9224,null));};exports[_0xba9a('0x21')]=function(_0x3e58d6,_0x3fcf78){return db['SquareOdbc']['find']({'where':{'id':_0x3e58d6[_0xba9a('0x41')]['id']}})[_0xba9a('0x20')](handleEntityNotFound(_0x3fcf78,null))[_0xba9a('0x20')](removeEntity(_0x3fcf78,null))[_0xba9a('0x40')](handleError(_0x3fcf78,null));};exports['test']=function(_0x2fce3b,_0x3b5f9e,_0x1ab5a2){var _0x4ffe5b;return db[_0xba9a('0x3e')][_0xba9a('0x4b')]({'where':{'id':_0x2fce3b['params']['id']},'attributes':['id',_0xba9a('0x4e')]})[_0xba9a('0x20')](handleEntityNotFound(_0x3b5f9e,null))[_0xba9a('0x20')](function(_0x1a27f9){if(_0x1a27f9){var _0x1b2708=require(_0xba9a('0x4f'))();_0x1b2708['openSync'](_0x1a27f9['dsn']);_0x1b2708['closeSync']();return _0x1a27f9;}})[_0xba9a('0x20')](respondWithResult(_0x3b5f9e,null))['catch'](handleError(_0x3b5f9e,null));}; \ No newline at end of file +var _0x3052=['stack','send','map','key','name','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','findAll','rows','catch','rawAttributes','fields','include','options','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','params','test','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0x3052,0x132));var _0x2305=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3052[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x2305('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2305('0x1'));var jsonpatch=require(_0x2305('0x2'));var rp=require(_0x2305('0x3'));var moment=require(_0x2305('0x4'));var BPromise=require(_0x2305('0x5'));var Mustache=require(_0x2305('0x6'));var util=require(_0x2305('0x7'));var path=require(_0x2305('0x8'));var sox=require(_0x2305('0x9'));var csv=require(_0x2305('0xa'));var ejs=require(_0x2305('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2305('0xc'));var squel=require(_0x2305('0xd'));var crypto=require(_0x2305('0xe'));var jsforce=require(_0x2305('0xf'));var deskjs=require(_0x2305('0x10'));var toCsv=require(_0x2305('0xa'));var querystring=require(_0x2305('0x11'));var Papa=require(_0x2305('0x12'));var Redis=require(_0x2305('0x13'));var authService=require(_0x2305('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2305('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2305('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2305('0x17'))['db'];function respondWithStatusCode(_0x5e0c0a,_0x3b1051){_0x3b1051=_0x3b1051||0xcc;return function(_0x4db627){if(_0x4db627){return _0x5e0c0a['sendStatus'](_0x3b1051);}return _0x5e0c0a[_0x2305('0x18')](_0x3b1051)[_0x2305('0x19')]();};}function respondWithResult(_0x26495c,_0x45af69){_0x45af69=_0x45af69||0xc8;return function(_0x341613){if(_0x341613){return _0x26495c[_0x2305('0x18')](_0x45af69)[_0x2305('0x1a')](_0x341613);}};}function respondWithFilteredResult(_0x109fdb,_0x59ee34){return function(_0x13204e){if(_0x13204e){var _0x3a518d=typeof _0x59ee34[_0x2305('0x1b')]===_0x2305('0x1c')&&typeof _0x59ee34[_0x2305('0x1d')]===_0x2305('0x1c');var _0x1d7b79=_0x13204e[_0x2305('0x1e')];var _0xe08dfe=_0x3a518d?0x0:_0x59ee34[_0x2305('0x1b')];var _0x336f81=_0x3a518d?_0x13204e[_0x2305('0x1e')]:_0x59ee34['offset']+_0x59ee34[_0x2305('0x1d')];var _0x2a8460;if(_0x336f81>=_0x1d7b79){_0x336f81=_0x1d7b79;_0x2a8460=0xc8;}else{_0x2a8460=0xce;}_0x109fdb[_0x2305('0x18')](_0x2a8460);return _0x109fdb[_0x2305('0x1f')](_0x2305('0x20'),_0xe08dfe+'-'+_0x336f81+'/'+_0x1d7b79)['json'](_0x13204e);}return null;};}function patchUpdates(_0x29df15){return function(_0x5ccb8a){try{jsonpatch[_0x2305('0x21')](_0x5ccb8a,_0x29df15,!![]);}catch(_0x4a3f70){return BPromise[_0x2305('0x22')](_0x4a3f70);}return _0x5ccb8a[_0x2305('0x23')]();};}function saveUpdates(_0x39dbbc,_0x8a1720){return function(_0x13f464){if(_0x13f464){return _0x13f464['update'](_0x39dbbc)[_0x2305('0x24')](function(_0x221b3a){return _0x221b3a;});}return null;};}function removeEntity(_0x41581a,_0x187f8f){return function(_0x138344){if(_0x138344){return _0x138344[_0x2305('0x25')]()[_0x2305('0x24')](function(){var _0xc61ffa=_0x138344[_0x2305('0x26')]({'plain':!![]});var _0x3e6f72=_0x2305('0x27');return db[_0x2305('0x28')][_0x2305('0x25')]({'where':{'type':_0x3e6f72,'resourceId':_0xc61ffa['id']}})[_0x2305('0x24')](function(){return _0x138344;});})[_0x2305('0x24')](function(){_0x41581a['status'](0xcc)[_0x2305('0x19')]();});}};}function handleEntityNotFound(_0x3822f6,_0x4c6093){return function(_0x163ee8){if(!_0x163ee8){_0x3822f6['sendStatus'](0x194);}return _0x163ee8;};}function handleError(_0x36e30c,_0x546f9d){_0x546f9d=_0x546f9d||0x1f4;return function(_0x548090){logger[_0x2305('0x29')](_0x548090[_0x2305('0x2a')]);if(_0x548090['name']){delete _0x548090['name'];}_0x36e30c[_0x2305('0x18')](_0x546f9d)[_0x2305('0x2b')](_0x548090);};}exports['index']=function(_0x129ca6,_0x19132b){var _0x4b1e42={},_0x35b340={},_0x5579ce={'count':0x0,'rows':[]};var _0x443ae4=_[_0x2305('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x4f69c3){return{'name':_0x4f69c3['fieldName'],'type':_0x4f69c3['type'][_0x2305('0x2d')]};});_0x35b340['model']=_[_0x2305('0x2c')](_0x443ae4,_0x2305('0x2e'));_0x35b340['query']=_[_0x2305('0x2f')](_0x129ca6[_0x2305('0x30')]);_0x35b340[_0x2305('0x31')]=_[_0x2305('0x32')](_0x35b340[_0x2305('0x33')],_0x35b340[_0x2305('0x30')]);_0x4b1e42[_0x2305('0x34')]=_['intersection'](_0x35b340[_0x2305('0x33')],qs['fields'](_0x129ca6[_0x2305('0x30')]['fields']));_0x4b1e42[_0x2305('0x34')]=_0x4b1e42[_0x2305('0x34')][_0x2305('0x35')]?_0x4b1e42[_0x2305('0x34')]:_0x35b340[_0x2305('0x33')];if(!_0x129ca6[_0x2305('0x30')][_0x2305('0x36')](_0x2305('0x37'))){_0x4b1e42[_0x2305('0x1d')]=qs[_0x2305('0x1d')](_0x129ca6[_0x2305('0x30')][_0x2305('0x1d')]);_0x4b1e42[_0x2305('0x1b')]=qs[_0x2305('0x1b')](_0x129ca6[_0x2305('0x30')][_0x2305('0x1b')]);}_0x4b1e42[_0x2305('0x38')]=qs[_0x2305('0x39')](_0x129ca6[_0x2305('0x30')]['sort']);_0x4b1e42[_0x2305('0x3a')]=qs[_0x2305('0x31')](_[_0x2305('0x3b')](_0x129ca6['query'],_0x35b340[_0x2305('0x31')]),_0x443ae4);if(_0x129ca6[_0x2305('0x30')][_0x2305('0x3c')]){_0x4b1e42[_0x2305('0x3a')]=_[_0x2305('0x3d')](_0x4b1e42['where'],{'$or':_[_0x2305('0x2c')](_0x443ae4,function(_0x5225c8){if(_0x5225c8['type']!==_0x2305('0x3e')){var _0x52f743={};_0x52f743[_0x5225c8['name']]={'$like':'%'+_0x129ca6['query'][_0x2305('0x3c')]+'%'};return _0x52f743;}})});}_0x4b1e42=_[_0x2305('0x3d')]({},_0x4b1e42,_0x129ca6['options']);var _0x542c19={'where':_0x4b1e42[_0x2305('0x3a')]};return db['SquareOdbc'][_0x2305('0x1e')](_0x542c19)[_0x2305('0x24')](function(_0x20be6e){_0x5579ce[_0x2305('0x1e')]=_0x20be6e;if(_0x129ca6[_0x2305('0x30')]['includeAll']){_0x4b1e42['include']=[{'all':!![]}];}return db[_0x2305('0x3f')][_0x2305('0x40')](_0x4b1e42);})[_0x2305('0x24')](function(_0x334abf){_0x5579ce[_0x2305('0x41')]=_0x334abf;return _0x5579ce;})[_0x2305('0x24')](respondWithFilteredResult(_0x19132b,_0x4b1e42))[_0x2305('0x42')](handleError(_0x19132b,null));};exports['show']=function(_0x42af83,_0x2d37bf){var _0x47d062={'raw':!![],'where':{'id':_0x42af83['params']['id']}},_0x441564={};_0x441564['model']=_[_0x2305('0x2f')](db[_0x2305('0x3f')][_0x2305('0x43')]);_0x441564[_0x2305('0x30')]=_[_0x2305('0x2f')](_0x42af83[_0x2305('0x30')]);_0x441564[_0x2305('0x31')]=_[_0x2305('0x32')](_0x441564['model'],_0x441564[_0x2305('0x30')]);_0x47d062[_0x2305('0x34')]=_[_0x2305('0x32')](_0x441564[_0x2305('0x33')],qs[_0x2305('0x44')](_0x42af83[_0x2305('0x30')][_0x2305('0x44')]));_0x47d062[_0x2305('0x34')]=_0x47d062[_0x2305('0x34')]['length']?_0x47d062[_0x2305('0x34')]:_0x441564[_0x2305('0x33')];if(_0x42af83[_0x2305('0x30')]['includeAll']){_0x47d062[_0x2305('0x45')]=[{'all':!![]}];}_0x47d062=_['merge']({},_0x47d062,_0x42af83[_0x2305('0x46')]);return db[_0x2305('0x3f')][_0x2305('0x47')](_0x47d062)[_0x2305('0x24')](handleEntityNotFound(_0x2d37bf,null))[_0x2305('0x24')](respondWithResult(_0x2d37bf,null))[_0x2305('0x42')](handleError(_0x2d37bf,null));};exports[_0x2305('0x48')]=function(_0x35b6da,_0x54737b){return db[_0x2305('0x3f')][_0x2305('0x48')](_0x35b6da[_0x2305('0x49')],{})[_0x2305('0x24')](function(_0x27ac14){var _0xa906b8=_0x35b6da['user'][_0x2305('0x26')]({'plain':!![]});if(!_0xa906b8)throw new Error(_0x2305('0x4a'));if(_0xa906b8[_0x2305('0x4b')]===_0x2305('0x4c')){var _0x52ce8a=_0x27ac14[_0x2305('0x26')]({'plain':!![]});var _0x3ead97=_0x2305('0x27');return db[_0x2305('0x4d')]['find']({'where':{'name':_0x3ead97,'userProfileId':_0xa906b8[_0x2305('0x4e')]},'raw':!![]})[_0x2305('0x24')](function(_0x2f82c4){if(_0x2f82c4&&_0x2f82c4[_0x2305('0x4f')]===0x0){return db['UserProfileResource'][_0x2305('0x48')]({'name':_0x52ce8a[_0x2305('0x2e')],'resourceId':_0x52ce8a['id'],'type':_0x2f82c4[_0x2305('0x2e')],'sectionId':_0x2f82c4['id']},{})[_0x2305('0x24')](function(){return _0x27ac14;});}else{return _0x27ac14;}})[_0x2305('0x42')](function(_0x38dacc){logger[_0x2305('0x29')](_0x2305('0x50'),_0x38dacc);throw _0x38dacc;});}return _0x27ac14;})[_0x2305('0x24')](respondWithResult(_0x54737b,0xc9))[_0x2305('0x42')](handleError(_0x54737b,null));};exports[_0x2305('0x51')]=function(_0x1581ef,_0x34a86e){if(_0x1581ef[_0x2305('0x49')]['id']){delete _0x1581ef[_0x2305('0x49')]['id'];}return db[_0x2305('0x3f')]['find']({'where':{'id':_0x1581ef['params']['id']}})[_0x2305('0x24')](handleEntityNotFound(_0x34a86e,null))[_0x2305('0x24')](saveUpdates(_0x1581ef['body'],null))[_0x2305('0x24')](respondWithResult(_0x34a86e,null))['catch'](handleError(_0x34a86e,null));};exports[_0x2305('0x25')]=function(_0x4ff5c6,_0x436a70){return db[_0x2305('0x3f')][_0x2305('0x47')]({'where':{'id':_0x4ff5c6[_0x2305('0x52')]['id']}})[_0x2305('0x24')](handleEntityNotFound(_0x436a70,null))[_0x2305('0x24')](removeEntity(_0x436a70,null))[_0x2305('0x42')](handleError(_0x436a70,null));};exports[_0x2305('0x53')]=function(_0x3b21de,_0x8a6d0a,_0x5544f4){var _0x4d9dec;return db['SquareOdbc'][_0x2305('0x47')]({'where':{'id':_0x3b21de[_0x2305('0x52')]['id']},'attributes':['id','dsn']})[_0x2305('0x24')](handleEntityNotFound(_0x8a6d0a,null))[_0x2305('0x24')](function(_0xfb160f){if(_0xfb160f){var _0x259ed1=require(_0x2305('0x54'))();_0x259ed1[_0x2305('0x55')](_0xfb160f['dsn']);_0x259ed1[_0x2305('0x56')]();return _0xfb160f;}})[_0x2305('0x24')](respondWithResult(_0x8a6d0a,null))['catch'](handleError(_0x8a6d0a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f3ef3d1..e3ed2e1 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 _0x2b1f=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0x1c43aa,_0xff2696){var _0x514c3c=function(_0x3afbf0){while(--_0x3afbf0){_0x1c43aa['push'](_0x1c43aa['shift']());}};_0x514c3c(++_0xff2696);}(_0x2b1f,0x1b8));var _0xf2b1=function(_0x30bd01,_0x557a2c){_0x30bd01=_0x30bd01-0x0;var _0x44cdc3=_0x2b1f[_0x30bd01];return _0x44cdc3;};'use strict';var _=require(_0xf2b1('0x0'));var util=require('util');var logger=require(_0xf2b1('0x1'))(_0xf2b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2b1('0x3'));var rimraf=require(_0xf2b1('0x4'));var config=require(_0xf2b1('0x5'));var attributes=require('./squareOdbc.attributes');module[_0xf2b1('0x6')]=function(_0x4bd417,_0x59d086){return _0x4bd417[_0xf2b1('0x7')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff4=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc'];(function(_0x1eca1f,_0x11fb8d){var _0x20e9f4=function(_0x5be6fe){while(--_0x5be6fe){_0x1eca1f['push'](_0x1eca1f['shift']());}};_0x20e9f4(++_0x11fb8d);}(_0xeff4,0x1ef));var _0x4eff=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xeff4[_0xf2f332];return _0x56cce3;};'use strict';var _=require(_0x4eff('0x0'));var util=require(_0x4eff('0x1'));var logger=require('../../config/logger')(_0x4eff('0x2'));var moment=require(_0x4eff('0x3'));var BPromise=require(_0x4eff('0x4'));var rp=require(_0x4eff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4eff('0x6'));var attributes=require(_0x4eff('0x7'));module[_0x4eff('0x8')]=function(_0x1dd5b7,_0x43d0d0){return _0x1dd5b7[_0x4eff('0x9')]('SquareOdbc',attributes,{'tableName':_0x4eff('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 7e1fb64..704cb33 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 _0xd8d6=['message','catch','SquareOdbc','options','where','include','map','model','attributes','ShowSquareOdbc','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1eb9fa,_0x18abb6){var _0x5780da=function(_0x36ccfe){while(--_0x36ccfe){_0x1eb9fa['push'](_0x1eb9fa['shift']());}};_0x5780da(++_0x18abb6);}(_0xd8d6,0xb2));var _0x6d8d=function(_0x104d4d,_0x59a530){_0x104d4d=_0x104d4d-0x0;var _0x450b41=_0xd8d6[_0x104d4d];return _0x450b41;};'use strict';var _=require(_0x6d8d('0x0'));var util=require('util');var moment=require(_0x6d8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d8d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d8d('0x3'))['db'];var utils=require(_0x6d8d('0x4'));var logger=require(_0x6d8d('0x5'))(_0x6d8d('0x6'));var config=require(_0x6d8d('0x7'));var jayson=require(_0x6d8d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x261e49,_0x38b69d,_0x4b5b79){return new BPromise(function(_0x1f41ae,_0x4d5cbc){return client[_0x6d8d('0x9')](_0x261e49,_0x4b5b79)[_0x6d8d('0xa')](function(_0x2f48d2){logger[_0x6d8d('0xb')](_0x6d8d('0xc'),_0x38b69d,_0x6d8d('0xd'));logger[_0x6d8d('0xe')](_0x6d8d('0xf'),_0x38b69d,_0x6d8d('0xd'),JSON[_0x6d8d('0x10')](_0x2f48d2));if(_0x2f48d2[_0x6d8d('0x11')]){if(_0x2f48d2[_0x6d8d('0x11')]['code']===0x1f4){logger[_0x6d8d('0x11')](_0x6d8d('0xc'),_0x38b69d,_0x2f48d2[_0x6d8d('0x11')]['message']);return _0x4d5cbc(_0x2f48d2[_0x6d8d('0x11')][_0x6d8d('0x12')]);}logger['error'](_0x6d8d('0xc'),_0x38b69d,_0x2f48d2[_0x6d8d('0x11')][_0x6d8d('0x12')]);return _0x1f41ae(_0x2f48d2[_0x6d8d('0x11')]['message']);}else{logger[_0x6d8d('0xb')](_0x6d8d('0xc'),_0x38b69d,_0x6d8d('0xd'));_0x1f41ae(_0x2f48d2['result'][_0x6d8d('0x12')]);}})[_0x6d8d('0x13')](function(_0x2e2e9f){logger[_0x6d8d('0x11')](_0x6d8d('0xc'),_0x38b69d,_0x2e2e9f);_0x4d5cbc(_0x2e2e9f);});});}exports['ShowSquareOdbc']=function(_0x9def22){var _0x5e1740=this;return new Promise(function(_0x16b590,_0x4a50b8){return db[_0x6d8d('0x14')]['find']({'raw':_0x9def22[_0x6d8d('0x15')]?_0x9def22['options']['raw']===undefined?!![]:![]:!![],'where':_0x9def22[_0x6d8d('0x15')]?_0x9def22[_0x6d8d('0x15')][_0x6d8d('0x16')]||null:null,'attributes':_0x9def22[_0x6d8d('0x15')]?_0x9def22[_0x6d8d('0x15')]['attributes']||null:null,'include':_0x9def22[_0x6d8d('0x15')]?_0x9def22['options'][_0x6d8d('0x17')]?_[_0x6d8d('0x18')](_0x9def22[_0x6d8d('0x15')][_0x6d8d('0x17')],function(_0x89d7d1){return{'model':db[_0x89d7d1[_0x6d8d('0x19')]],'as':_0x89d7d1['as'],'attributes':_0x89d7d1[_0x6d8d('0x1a')],'include':_0x89d7d1[_0x6d8d('0x17')]?_[_0x6d8d('0x18')](_0x89d7d1[_0x6d8d('0x17')],function(_0x1bc9c9){return{'model':db[_0x1bc9c9[_0x6d8d('0x19')]],'as':_0x1bc9c9['as'],'attributes':_0x1bc9c9[_0x6d8d('0x1a')],'include':_0x1bc9c9['include']?_[_0x6d8d('0x18')](_0x1bc9c9[_0x6d8d('0x17')],function(_0x288b95){return{'model':db[_0x288b95[_0x6d8d('0x19')]],'as':_0x288b95['as'],'attributes':_0x288b95['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e1dfb){logger[_0x6d8d('0xb')](_0x6d8d('0x1b'),_0x9def22);logger[_0x6d8d('0xe')]('ShowSquareOdbc',_0x9def22,JSON[_0x6d8d('0x10')](_0x2e1dfb));_0x16b590(_0x2e1dfb);})[_0x6d8d('0x13')](function(_0x3c1e61){logger[_0x6d8d('0x11')](_0x6d8d('0x1b'),_0x3c1e61[_0x6d8d('0x12')],_0x9def22);_0x4a50b8(_0x5e1740[_0x6d8d('0x11')](0x1f4,_0x3c1e61['message']));});});}; \ No newline at end of file +var _0xac61=['request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client'];(function(_0x283d8e,_0x53c68c){var _0x202ef8=function(_0xa48787){while(--_0xa48787){_0x283d8e['push'](_0x283d8e['shift']());}};_0x202ef8(++_0x53c68c);}(_0xac61,0x124));var _0x1ac6=function(_0x5db08f,_0x5cba25){_0x5db08f=_0x5db08f-0x0;var _0x508cca=_0xac61[_0x5db08f];return _0x508cca;};'use strict';var _=require('lodash');var util=require(_0x1ac6('0x0'));var moment=require(_0x1ac6('0x1'));var BPromise=require(_0x1ac6('0x2'));var rs=require(_0x1ac6('0x3'));var fs=require('fs');var Redis=require(_0x1ac6('0x4'));var db=require(_0x1ac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1ac6('0x6'));var client=jayson[_0x1ac6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9583,_0x5b9840,_0x5eb8cc){return new BPromise(function(_0x98db65,_0x9b5153){return client[_0x1ac6('0x8')](_0x4e9583,_0x5eb8cc)[_0x1ac6('0x9')](function(_0x48b85e){logger[_0x1ac6('0xa')](_0x1ac6('0xb'),_0x5b9840,_0x1ac6('0xc'));logger[_0x1ac6('0xd')](_0x1ac6('0xe'),_0x5b9840,_0x1ac6('0xc'),JSON[_0x1ac6('0xf')](_0x48b85e));if(_0x48b85e['error']){if(_0x48b85e['error'][_0x1ac6('0x10')]===0x1f4){logger[_0x1ac6('0x11')](_0x1ac6('0xb'),_0x5b9840,_0x48b85e[_0x1ac6('0x11')]['message']);return _0x9b5153(_0x48b85e['error'][_0x1ac6('0x12')]);}logger[_0x1ac6('0x11')](_0x1ac6('0xb'),_0x5b9840,_0x48b85e['error'][_0x1ac6('0x12')]);return _0x98db65(_0x48b85e[_0x1ac6('0x11')][_0x1ac6('0x12')]);}else{logger[_0x1ac6('0xa')](_0x1ac6('0xb'),_0x5b9840,'request\x20sent');_0x98db65(_0x48b85e[_0x1ac6('0x13')][_0x1ac6('0x12')]);}})[_0x1ac6('0x14')](function(_0x39afe5){logger['error'](_0x1ac6('0xb'),_0x5b9840,_0x39afe5);_0x9b5153(_0x39afe5);});});}exports[_0x1ac6('0x15')]=function(_0x542c80){var _0x59c02e=this;return new Promise(function(_0x53ec9f,_0x18229b){return db['SquareOdbc'][_0x1ac6('0x16')]({'raw':_0x542c80['options']?_0x542c80[_0x1ac6('0x17')][_0x1ac6('0x18')]===undefined?!![]:![]:!![],'where':_0x542c80[_0x1ac6('0x17')]?_0x542c80['options'][_0x1ac6('0x19')]||null:null,'attributes':_0x542c80[_0x1ac6('0x17')]?_0x542c80[_0x1ac6('0x17')][_0x1ac6('0x1a')]||null:null,'include':_0x542c80[_0x1ac6('0x17')]?_0x542c80[_0x1ac6('0x17')][_0x1ac6('0x1b')]?_[_0x1ac6('0x1c')](_0x542c80[_0x1ac6('0x17')][_0x1ac6('0x1b')],function(_0x5b025c){return{'model':db[_0x5b025c[_0x1ac6('0x1d')]],'as':_0x5b025c['as'],'attributes':_0x5b025c[_0x1ac6('0x1a')],'include':_0x5b025c[_0x1ac6('0x1b')]?_[_0x1ac6('0x1c')](_0x5b025c[_0x1ac6('0x1b')],function(_0x19f11c){return{'model':db[_0x19f11c[_0x1ac6('0x1d')]],'as':_0x19f11c['as'],'attributes':_0x19f11c[_0x1ac6('0x1a')],'include':_0x19f11c[_0x1ac6('0x1b')]?_[_0x1ac6('0x1c')](_0x19f11c[_0x1ac6('0x1b')],function(_0x15d4c8){return{'model':db[_0x15d4c8[_0x1ac6('0x1d')]],'as':_0x15d4c8['as'],'attributes':_0x15d4c8[_0x1ac6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1ac6('0x9')](function(_0x46b60a){logger[_0x1ac6('0xa')](_0x1ac6('0x15'),_0x542c80);logger[_0x1ac6('0xd')]('ShowSquareOdbc',_0x542c80,JSON['stringify'](_0x46b60a));_0x53ec9f(_0x46b60a);})['catch'](function(_0x9835a){logger['error'](_0x1ac6('0x15'),_0x9835a[_0x1ac6('0x12')],_0x542c80);_0x18229b(_0x59c02e[_0x1ac6('0x11')](0x1f4,_0x9835a[_0x1ac6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2b56610..fa905a1 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 _0x5d3b=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','show','post','create','put','/:id','exports','multer','util','path','express','fs-extra'];(function(_0x542688,_0x1033e5){var _0x5b1273=function(_0x34fb5a){while(--_0x34fb5a){_0x542688['push'](_0x542688['shift']());}};_0x5b1273(++_0x1033e5);}(_0x5d3b,0xa5));var _0xb5d3=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0x5d3b[_0x5ec9db];return _0xfc7061;};'use strict';var multer=require(_0xb5d3('0x0'));var util=require(_0xb5d3('0x1'));var path=require(_0xb5d3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5d3('0x3'));var router=express['Router']();var fs_extra=require(_0xb5d3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb5d3('0x5'));var config=require(_0xb5d3('0x6'));var controller=require(_0xb5d3('0x7'));router[_0xb5d3('0x8')]('/',auth['isAuthenticated'](),controller[_0xb5d3('0x9')]);router[_0xb5d3('0x8')]('/:id',auth[_0xb5d3('0xa')](),controller[_0xb5d3('0xb')]);router[_0xb5d3('0xc')]('/',auth[_0xb5d3('0xa')](),controller[_0xb5d3('0xd')]);router[_0xb5d3('0xe')](_0xb5d3('0xf'),auth[_0xb5d3('0xa')](),controller['update']);router['delete'](_0xb5d3('0xf'),auth[_0xb5d3('0xa')](),controller['destroy']);module[_0xb5d3('0x10')]=router; \ No newline at end of file +var _0xa1f0=['./squareProject.controller','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2beb86,_0x5afdba){var _0x5d52ba=function(_0x36ae0d){while(--_0x36ae0d){_0x2beb86['push'](_0x2beb86['shift']());}};_0x5d52ba(++_0x5afdba);}(_0xa1f0,0x1e9));var _0x0a1f=function(_0x3cf460,_0x43aa23){_0x3cf460=_0x3cf460-0x0;var _0xa7135b=_0xa1f0[_0x3cf460];return _0xa7135b;};'use strict';var multer=require(_0x0a1f('0x0'));var util=require('util');var path=require(_0x0a1f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a1f('0x2'));var router=express[_0x0a1f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a1f('0x4'));var interaction=require(_0x0a1f('0x5'));var config=require('../../config/environment');var controller=require(_0x0a1f('0x6'));router['get']('/',auth[_0x0a1f('0x7')](),controller[_0x0a1f('0x8')]);router['get'](_0x0a1f('0x9'),auth[_0x0a1f('0x7')](),controller[_0x0a1f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0a1f('0xb')](_0x0a1f('0x9'),auth['isAuthenticated'](),controller[_0x0a1f('0xc')]);router[_0x0a1f('0xd')](_0x0a1f('0x9'),auth[_0x0a1f('0x7')](),controller[_0x0a1f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4527e4b..f8720dc 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 _0xcfb8=['toString','BLOB','production','utf8','DATE','sequelize','exports','name','STRING','long','preproduction','getDataValue'];(function(_0x49b74f,_0x259681){var _0x52fdb1=function(_0x27047c){while(--_0x27047c){_0x49b74f['push'](_0x49b74f['shift']());}};_0x52fdb1(++_0x259681);}(_0xcfb8,0x1c1));var _0x8cfb=function(_0x506d28,_0xaff916){_0x506d28=_0x506d28-0x0;var _0x20145f=_0xcfb8[_0x506d28];return _0x20145f;};'use strict';var Sequelize=require(_0x8cfb('0x0'));module[_0x8cfb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8cfb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8cfb('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8cfb('0x4')),'get':function(){if(this['getDataValue'](_0x8cfb('0x5'))){return this[_0x8cfb('0x6')](_0x8cfb('0x5'))[_0x8cfb('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x8cfb('0x8')](_0x8cfb('0x4')),'get':function(){if(this['getDataValue'](_0x8cfb('0x9'))){return this[_0x8cfb('0x6')]('production')[_0x8cfb('0x7')](_0x8cfb('0xa'));}}},'savedAt':{'type':Sequelize[_0x8cfb('0xb')]},'publishedAt':{'type':Sequelize[_0x8cfb('0xb')]}}; \ No newline at end of file +var _0x89f5=['preproduction','toString','utf8','BLOB','long','production','DATE','sequelize','exports','STRING','name','TEXT','getDataValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x89f5,0x118));var _0x589f=function(_0x18d5e5,_0x78b2ef){_0x18d5e5=_0x18d5e5-0x0;var _0xa7acd5=_0x89f5[_0x18d5e5];return _0xa7acd5;};'use strict';var Sequelize=require(_0x589f('0x0'));module[_0x589f('0x1')]={'name':{'type':Sequelize[_0x589f('0x2')],'unique':_0x589f('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x589f('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x589f('0x5')](_0x589f('0x6'))){return this[_0x589f('0x5')](_0x589f('0x6'))[_0x589f('0x7')](_0x589f('0x8'));}}},'production':{'type':Sequelize[_0x589f('0x9')](_0x589f('0xa')),'get':function(){if(this[_0x589f('0x5')](_0x589f('0xb'))){return this[_0x589f('0x5')]('production')['toString'](_0x589f('0x8'));}}},'savedAt':{'type':Sequelize[_0x589f('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5493792..d3e9f5c 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 _0xee19=['SquareProjects','publish','agi','stringify','end','sendStatus','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','get','pick','production','params','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','set','update','then','destroy'];(function(_0x3b6bab,_0x4dd853){var _0x3f6478=function(_0x43f887){while(--_0x43f887){_0x3b6bab['push'](_0x3b6bab['shift']());}};_0x3f6478(++_0x4dd853);}(_0xee19,0x1cf));var _0x9ee1=function(_0x51971a,_0x3fb54a){_0x51971a=_0x51971a-0x0;var _0x1897ce=_0xee19[_0x51971a];return _0x1897ce;};'use strict';var _=require(_0x9ee1('0x0'));var Redis=require(_0x9ee1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9ee1('0x2'))(_0x9ee1('0x3'));var config=require('../../config/environment');var db=require(_0x9ee1('0x4'))['db'];config['redis']=_['defaults'](config[_0x9ee1('0x5')],{'host':_0x9ee1('0x6'),'port':0x18eb});var socket=require(_0x9ee1('0x7'))(new Redis(config[_0x9ee1('0x5')]));require(_0x9ee1('0x8'))[_0x9ee1('0x9')](socket);function respondWithResult(_0x255d8a,_0x130adc){_0x130adc=_0x130adc||0xc8;return function(_0x16d17e){if(_0x16d17e){return _0x255d8a['status'](_0x130adc)[_0x9ee1('0xa')](_0x16d17e);}};}function respondWithFilteredResult(_0x5a25c2,_0x54cf2d){return function(_0x24dd8d){if(_0x24dd8d){var _0x403a17=typeof _0x54cf2d[_0x9ee1('0xb')]==='undefined'&&typeof _0x54cf2d[_0x9ee1('0xc')]===_0x9ee1('0xd');var _0x36782c=_0x24dd8d[_0x9ee1('0xe')];var _0xf5e351=_0x403a17?0x0:_0x54cf2d[_0x9ee1('0xb')];var _0x4324e9=_0x403a17?_0x24dd8d[_0x9ee1('0xe')]:_0x54cf2d[_0x9ee1('0xb')]+_0x54cf2d[_0x9ee1('0xc')];var _0x24f417;if(_0x4324e9>=_0x36782c){_0x4324e9=_0x36782c;_0x24f417=0xc8;}else{_0x24f417=0xce;}_0x5a25c2[_0x9ee1('0xf')](_0x24f417);return _0x5a25c2[_0x9ee1('0x10')]('Content-Range',_0xf5e351+'-'+_0x4324e9+'/'+_0x36782c)[_0x9ee1('0xa')](_0x24dd8d);}return null;};}function saveUpdates(_0x289d51){return function(_0x27c2f8){if(_0x27c2f8){return _0x27c2f8[_0x9ee1('0x11')](_0x289d51)[_0x9ee1('0x12')](function(_0x5e2f96){return _0x5e2f96;});}return null;};}function removeEntity(_0x35cf55){return function(_0x3ade6f){if(_0x3ade6f){return _0x3ade6f[_0x9ee1('0x13')]()[_0x9ee1('0x12')](function(){var _0x2f8e3e=_0x3ade6f['get']({'plain':!![]});var _0x48bfae=_0x9ee1('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x48bfae,'resourceId':_0x2f8e3e['id']}})['then'](function(){return _0x3ade6f;});})[_0x9ee1('0x12')](function(){var _0x574876=new Redis(config[_0x9ee1('0x5')]);_0x574876[_0x9ee1('0x15')](_0x9ee1('0x16'),JSON[_0x9ee1('0x17')]({'id':_0x3ade6f['id'],'deleted':!![]}));})[_0x9ee1('0x12')](function(){_0x35cf55[_0x9ee1('0xf')](0xcc)[_0x9ee1('0x18')]();});}};}function handleEntityNotFound(_0x3a35e){return function(_0x3d932b){if(!_0x3d932b){_0x3a35e[_0x9ee1('0x19')](0x194);}return _0x3d932b;};}function handleError(_0x23eec5,_0x156fab){_0x156fab=_0x156fab||0x1f4;return function(_0x4053c9){logger['error'](_0x4053c9[_0x9ee1('0x1a')]);if(_0x4053c9[_0x9ee1('0x1b')]){delete _0x4053c9[_0x9ee1('0x1b')];}_0x23eec5[_0x9ee1('0xf')](_0x156fab)[_0x9ee1('0x1c')](_0x4053c9);};}exports['index']=function(_0x1f42b8,_0x105322){var _0x465bf8={},_0x48746b={},_0x45cca3={'count':0x0,'rows':[]};var _0x4ae4ec=_[_0x9ee1('0x1d')](db[_0x9ee1('0x1e')][_0x9ee1('0x1f')],function(_0x4d0a83){return{'name':_0x4d0a83[_0x9ee1('0x20')],'type':_0x4d0a83[_0x9ee1('0x21')][_0x9ee1('0x22')]};});_0x48746b[_0x9ee1('0x23')]=_[_0x9ee1('0x1d')](_0x4ae4ec,_0x9ee1('0x1b'));_0x48746b[_0x9ee1('0x24')]=_['keys'](_0x1f42b8[_0x9ee1('0x24')]);_0x48746b[_0x9ee1('0x25')]=_['intersection'](_0x48746b[_0x9ee1('0x23')],_0x48746b[_0x9ee1('0x24')]);_0x465bf8['attributes']=_[_0x9ee1('0x26')](_0x48746b['model'],qs[_0x9ee1('0x27')](_0x1f42b8[_0x9ee1('0x24')][_0x9ee1('0x27')]));_0x465bf8['attributes']=_0x465bf8[_0x9ee1('0x28')][_0x9ee1('0x29')]?_0x465bf8[_0x9ee1('0x28')]:_0x48746b[_0x9ee1('0x23')];if(!_0x1f42b8[_0x9ee1('0x24')]['hasOwnProperty']('nolimit')){_0x465bf8[_0x9ee1('0xc')]=qs['limit'](_0x1f42b8[_0x9ee1('0x24')][_0x9ee1('0xc')]);_0x465bf8[_0x9ee1('0xb')]=qs[_0x9ee1('0xb')](_0x1f42b8[_0x9ee1('0x24')][_0x9ee1('0xb')]);}_0x465bf8[_0x9ee1('0x2a')]=qs['sort'](_0x1f42b8['query'][_0x9ee1('0x2b')]);_0x465bf8[_0x9ee1('0x2c')]=qs['filters'](_['pick'](_0x1f42b8['query'],_0x48746b[_0x9ee1('0x25')]),_0x4ae4ec);if(_0x1f42b8[_0x9ee1('0x24')][_0x9ee1('0x2d')]){_0x465bf8[_0x9ee1('0x2c')]=_['merge'](_0x465bf8['where'],{'$or':_['map'](_0x4ae4ec,function(_0x27cb03){if(_0x27cb03[_0x9ee1('0x21')]!==_0x9ee1('0x2e')){var _0x547513={};_0x547513[_0x27cb03[_0x9ee1('0x1b')]]={'$like':'%'+_0x1f42b8[_0x9ee1('0x24')][_0x9ee1('0x2d')]+'%'};return _0x547513;}})});}_0x465bf8=_[_0x9ee1('0x2f')]({},_0x465bf8,_0x1f42b8[_0x9ee1('0x30')]);var _0x5a7266={'where':_0x465bf8[_0x9ee1('0x2c')]};return db[_0x9ee1('0x1e')][_0x9ee1('0xe')](_0x5a7266)['then'](function(_0x458d89){_0x45cca3[_0x9ee1('0xe')]=_0x458d89;if(_0x1f42b8[_0x9ee1('0x24')]['includeAll']){_0x465bf8['include']=[{'all':!![]}];}return db[_0x9ee1('0x1e')][_0x9ee1('0x31')](_0x465bf8);})['then'](function(_0x2576cd){_0x45cca3[_0x9ee1('0x32')]=_0x2576cd;return _0x45cca3;})[_0x9ee1('0x12')](respondWithFilteredResult(_0x105322,_0x465bf8))[_0x9ee1('0x33')](handleError(_0x105322,null));};exports[_0x9ee1('0x34')]=function(_0x37f56d,_0x44573a){var _0x200a06={'raw':![],'where':{'id':_0x37f56d['params']['id']}},_0x148ff7={};_0x148ff7[_0x9ee1('0x23')]=_['keys'](db[_0x9ee1('0x1e')][_0x9ee1('0x1f')]);_0x148ff7['query']=_[_0x9ee1('0x35')](_0x37f56d[_0x9ee1('0x24')]);_0x148ff7[_0x9ee1('0x25')]=_[_0x9ee1('0x26')](_0x148ff7[_0x9ee1('0x23')],_0x148ff7[_0x9ee1('0x24')]);_0x200a06[_0x9ee1('0x28')]=_['intersection'](_0x148ff7[_0x9ee1('0x23')],qs[_0x9ee1('0x27')](_0x37f56d[_0x9ee1('0x24')][_0x9ee1('0x27')]));_0x200a06[_0x9ee1('0x28')]=_0x200a06[_0x9ee1('0x28')]['length']?_0x200a06['attributes']:_0x148ff7[_0x9ee1('0x23')];if(_0x37f56d[_0x9ee1('0x24')][_0x9ee1('0x36')]){_0x200a06[_0x9ee1('0x37')]=[{'all':!![]}];}_0x200a06=_[_0x9ee1('0x2f')]({},_0x200a06,_0x37f56d[_0x9ee1('0x30')]);return db['SquareProject'][_0x9ee1('0x38')](_0x200a06)[_0x9ee1('0x12')](handleEntityNotFound(_0x44573a,null))['then'](respondWithResult(_0x44573a,null))['catch'](handleError(_0x44573a,null));};exports[_0x9ee1('0x39')]=function(_0xaf5d73,_0x195038){return db[_0x9ee1('0x1e')][_0x9ee1('0x39')](_0xaf5d73['body'],{})[_0x9ee1('0x12')](function(_0x23ec95){var _0x336be6=_0xaf5d73['user']['get']({'plain':!![]});if(!_0x336be6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x336be6['role']===_0x9ee1('0x3a')){var _0xc92a78=_0x23ec95['get']({'plain':!![]});var _0x9e8a2d='SquareProjects';return db[_0x9ee1('0x3b')]['find']({'where':{'name':_0x9e8a2d,'userProfileId':_0x336be6[_0x9ee1('0x3c')]},'raw':!![]})['then'](function(_0x5106a5){if(_0x5106a5&&_0x5106a5[_0x9ee1('0x3d')]===0x0){return db[_0x9ee1('0x3e')][_0x9ee1('0x39')]({'name':_0xc92a78[_0x9ee1('0x1b')],'resourceId':_0xc92a78['id'],'type':_0x5106a5[_0x9ee1('0x1b')],'sectionId':_0x5106a5['id']},{})[_0x9ee1('0x12')](function(){return _0x23ec95;});}else{return _0x23ec95;}})[_0x9ee1('0x33')](function(_0xdfd887){logger['error'](_0x9ee1('0x3f'),_0xdfd887);throw _0xdfd887;});}return _0x23ec95;})[_0x9ee1('0x12')](respondWithResult(_0x195038,0xc9))[_0x9ee1('0x33')](handleError(_0x195038,null));};exports[_0x9ee1('0x11')]=function(_0x1bb9a2,_0x3039eb){if(_0x1bb9a2[_0x9ee1('0x40')]['id']){delete _0x1bb9a2[_0x9ee1('0x40')]['id'];}return db[_0x9ee1('0x1e')][_0x9ee1('0x38')]({'where':{'id':_0x1bb9a2['params']['id']}})[_0x9ee1('0x12')](handleEntityNotFound(_0x3039eb,null))[_0x9ee1('0x12')](saveUpdates(_0x1bb9a2[_0x9ee1('0x40')],null))[_0x9ee1('0x12')](function(_0x2d1826){if(!_0x2d1826)return;var _0x25884f=_0x2d1826[_0x9ee1('0x41')]({'plain':!![]});return _0x25884f;})['then'](function(_0x168caa){var _0x2e43c5=new Redis(config['redis']);_0x2e43c5[_0x9ee1('0x15')](_0x9ee1('0x16'),JSON[_0x9ee1('0x17')](_[_0x9ee1('0x42')](_0x168caa,['id',_0x9ee1('0x1b'),_0x9ee1('0x43')])));return _0x168caa;})[_0x9ee1('0x12')](respondWithResult(_0x3039eb,null))[_0x9ee1('0x33')](handleError(_0x3039eb,null));};exports[_0x9ee1('0x13')]=function(_0x345956,_0x3903ef){return db['SquareProject']['find']({'where':{'id':_0x345956[_0x9ee1('0x44')]['id']}})[_0x9ee1('0x12')](handleEntityNotFound(_0x3903ef,null))['then'](removeEntity(_0x3903ef,null))['catch'](handleError(_0x3903ef,null));}; \ No newline at end of file +var _0xd773=['lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','SquareProject','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','find','params','production'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd773,0x159));var _0x3d77=function(_0x5c87fa,_0x17733f){_0x5c87fa=_0x5c87fa-0x0;var _0x46c0f1=_0xd773[_0x5c87fa];return _0x46c0f1;};'use strict';var _=require(_0x3d77('0x0'));var Redis=require('ioredis');var qs=require(_0x3d77('0x1'));var logger=require(_0x3d77('0x2'))(_0x3d77('0x3'));var config=require(_0x3d77('0x4'));var db=require(_0x3d77('0x5'))['db'];config['redis']=_[_0x3d77('0x6')](config[_0x3d77('0x7')],{'host':_0x3d77('0x8'),'port':0x18eb});var socket=require(_0x3d77('0x9'))(new Redis(config[_0x3d77('0x7')]));require(_0x3d77('0xa'))[_0x3d77('0xb')](socket);function respondWithResult(_0x51d036,_0x25c986){_0x25c986=_0x25c986||0xc8;return function(_0x496877){if(_0x496877){return _0x51d036['status'](_0x25c986)['json'](_0x496877);}};}function respondWithFilteredResult(_0x27ca64,_0xdee489){return function(_0x44eb7d){if(_0x44eb7d){var _0x2cd141=typeof _0xdee489[_0x3d77('0xc')]===_0x3d77('0xd')&&typeof _0xdee489[_0x3d77('0xe')]==='undefined';var _0x5aadc3=_0x44eb7d[_0x3d77('0xf')];var _0x5472e3=_0x2cd141?0x0:_0xdee489[_0x3d77('0xc')];var _0x5b0453=_0x2cd141?_0x44eb7d[_0x3d77('0xf')]:_0xdee489[_0x3d77('0xc')]+_0xdee489[_0x3d77('0xe')];var _0x173a5d;if(_0x5b0453>=_0x5aadc3){_0x5b0453=_0x5aadc3;_0x173a5d=0xc8;}else{_0x173a5d=0xce;}_0x27ca64[_0x3d77('0x10')](_0x173a5d);return _0x27ca64[_0x3d77('0x11')](_0x3d77('0x12'),_0x5472e3+'-'+_0x5b0453+'/'+_0x5aadc3)[_0x3d77('0x13')](_0x44eb7d);}return null;};}function saveUpdates(_0x29aa66){return function(_0x48060b){if(_0x48060b){return _0x48060b[_0x3d77('0x14')](_0x29aa66)[_0x3d77('0x15')](function(_0x1d1e39){return _0x1d1e39;});}return null;};}function removeEntity(_0x374146){return function(_0xc2dd6a){if(_0xc2dd6a){return _0xc2dd6a[_0x3d77('0x16')]()[_0x3d77('0x15')](function(){var _0x2569c5=_0xc2dd6a[_0x3d77('0x17')]({'plain':!![]});var _0x2dced4=_0x3d77('0x18');return db[_0x3d77('0x19')]['destroy']({'where':{'type':_0x2dced4,'resourceId':_0x2569c5['id']}})['then'](function(){return _0xc2dd6a;});})[_0x3d77('0x15')](function(){var _0x34094a=new Redis(config[_0x3d77('0x7')]);_0x34094a[_0x3d77('0x1a')](_0x3d77('0x1b'),JSON[_0x3d77('0x1c')]({'id':_0xc2dd6a['id'],'deleted':!![]}));})[_0x3d77('0x15')](function(){_0x374146[_0x3d77('0x10')](0xcc)[_0x3d77('0x1d')]();});}};}function handleEntityNotFound(_0x4f43e4){return function(_0x1d4c16){if(!_0x1d4c16){_0x4f43e4[_0x3d77('0x1e')](0x194);}return _0x1d4c16;};}function handleError(_0x5cb831,_0xec558){_0xec558=_0xec558||0x1f4;return function(_0x3433e1){logger[_0x3d77('0x1f')](_0x3433e1['stack']);if(_0x3433e1[_0x3d77('0x20')]){delete _0x3433e1['name'];}_0x5cb831[_0x3d77('0x10')](_0xec558)[_0x3d77('0x21')](_0x3433e1);};}exports['index']=function(_0x59b6a5,_0x45f42e){var _0x2650d3={},_0xa9e2bf={},_0x2bbd66={'count':0x0,'rows':[]};var _0x52244d=_['map'](db[_0x3d77('0x22')][_0x3d77('0x23')],function(_0x1f3343){return{'name':_0x1f3343['fieldName'],'type':_0x1f3343[_0x3d77('0x24')]['key']};});_0xa9e2bf[_0x3d77('0x25')]=_[_0x3d77('0x26')](_0x52244d,'name');_0xa9e2bf[_0x3d77('0x27')]=_[_0x3d77('0x28')](_0x59b6a5[_0x3d77('0x27')]);_0xa9e2bf[_0x3d77('0x29')]=_[_0x3d77('0x2a')](_0xa9e2bf['model'],_0xa9e2bf[_0x3d77('0x27')]);_0x2650d3['attributes']=_[_0x3d77('0x2a')](_0xa9e2bf[_0x3d77('0x25')],qs[_0x3d77('0x2b')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2b')]));_0x2650d3['attributes']=_0x2650d3[_0x3d77('0x2c')]['length']?_0x2650d3[_0x3d77('0x2c')]:_0xa9e2bf['model'];if(!_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2d')]('nolimit')){_0x2650d3[_0x3d77('0xe')]=qs['limit'](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0xe')]);_0x2650d3[_0x3d77('0xc')]=qs[_0x3d77('0xc')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0xc')]);}_0x2650d3[_0x3d77('0x2e')]=qs[_0x3d77('0x2f')](_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x2f')]);_0x2650d3['where']=qs[_0x3d77('0x29')](_[_0x3d77('0x30')](_0x59b6a5['query'],_0xa9e2bf[_0x3d77('0x29')]),_0x52244d);if(_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x31')]){_0x2650d3[_0x3d77('0x32')]=_[_0x3d77('0x33')](_0x2650d3[_0x3d77('0x32')],{'$or':_['map'](_0x52244d,function(_0x11f6f1){if(_0x11f6f1['type']!=='VIRTUAL'){var _0x19385c={};_0x19385c[_0x11f6f1[_0x3d77('0x20')]]={'$like':'%'+_0x59b6a5['query']['filter']+'%'};return _0x19385c;}})});}_0x2650d3=_['merge']({},_0x2650d3,_0x59b6a5[_0x3d77('0x34')]);var _0x3c4411={'where':_0x2650d3[_0x3d77('0x32')]};return db['SquareProject']['count'](_0x3c4411)['then'](function(_0x22f153){_0x2bbd66[_0x3d77('0xf')]=_0x22f153;if(_0x59b6a5[_0x3d77('0x27')][_0x3d77('0x35')]){_0x2650d3[_0x3d77('0x36')]=[{'all':!![]}];}return db[_0x3d77('0x22')][_0x3d77('0x37')](_0x2650d3);})['then'](function(_0x28e958){_0x2bbd66[_0x3d77('0x38')]=_0x28e958;return _0x2bbd66;})[_0x3d77('0x15')](respondWithFilteredResult(_0x45f42e,_0x2650d3))['catch'](handleError(_0x45f42e,null));};exports['show']=function(_0x5d4a8d,_0x4afb4b){var _0x4f1347={'raw':![],'where':{'id':_0x5d4a8d['params']['id']}},_0x3a4aa4={};_0x3a4aa4[_0x3d77('0x25')]=_[_0x3d77('0x28')](db[_0x3d77('0x22')][_0x3d77('0x23')]);_0x3a4aa4[_0x3d77('0x27')]=_[_0x3d77('0x28')](_0x5d4a8d[_0x3d77('0x27')]);_0x3a4aa4[_0x3d77('0x29')]=_['intersection'](_0x3a4aa4['model'],_0x3a4aa4['query']);_0x4f1347[_0x3d77('0x2c')]=_[_0x3d77('0x2a')](_0x3a4aa4[_0x3d77('0x25')],qs[_0x3d77('0x2b')](_0x5d4a8d[_0x3d77('0x27')][_0x3d77('0x2b')]));_0x4f1347[_0x3d77('0x2c')]=_0x4f1347[_0x3d77('0x2c')][_0x3d77('0x39')]?_0x4f1347[_0x3d77('0x2c')]:_0x3a4aa4[_0x3d77('0x25')];if(_0x5d4a8d['query'][_0x3d77('0x35')]){_0x4f1347[_0x3d77('0x36')]=[{'all':!![]}];}_0x4f1347=_[_0x3d77('0x33')]({},_0x4f1347,_0x5d4a8d[_0x3d77('0x34')]);return db[_0x3d77('0x22')]['find'](_0x4f1347)[_0x3d77('0x15')](handleEntityNotFound(_0x4afb4b,null))[_0x3d77('0x15')](respondWithResult(_0x4afb4b,null))[_0x3d77('0x3a')](handleError(_0x4afb4b,null));};exports['create']=function(_0x4d4f83,_0x3f7a52){return db['SquareProject'][_0x3d77('0x3b')](_0x4d4f83[_0x3d77('0x3c')],{})[_0x3d77('0x15')](function(_0x2190c1){var _0x3af783=_0x4d4f83['user'][_0x3d77('0x17')]({'plain':!![]});if(!_0x3af783)throw new Error(_0x3d77('0x3d'));if(_0x3af783[_0x3d77('0x3e')]===_0x3d77('0x3f')){var _0x475097=_0x2190c1['get']({'plain':!![]});var _0xf3317c='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0xf3317c,'userProfileId':_0x3af783[_0x3d77('0x40')]},'raw':!![]})[_0x3d77('0x15')](function(_0x1b2e61){if(_0x1b2e61&&_0x1b2e61[_0x3d77('0x41')]===0x0){return db[_0x3d77('0x19')][_0x3d77('0x3b')]({'name':_0x475097[_0x3d77('0x20')],'resourceId':_0x475097['id'],'type':_0x1b2e61[_0x3d77('0x20')],'sectionId':_0x1b2e61['id']},{})[_0x3d77('0x15')](function(){return _0x2190c1;});}else{return _0x2190c1;}})[_0x3d77('0x3a')](function(_0x12e56b){logger[_0x3d77('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12e56b);throw _0x12e56b;});}return _0x2190c1;})[_0x3d77('0x15')](respondWithResult(_0x3f7a52,0xc9))[_0x3d77('0x3a')](handleError(_0x3f7a52,null));};exports[_0x3d77('0x14')]=function(_0x50e98c,_0x1b6ef0){if(_0x50e98c[_0x3d77('0x3c')]['id']){delete _0x50e98c[_0x3d77('0x3c')]['id'];}return db[_0x3d77('0x22')][_0x3d77('0x42')]({'where':{'id':_0x50e98c[_0x3d77('0x43')]['id']}})[_0x3d77('0x15')](handleEntityNotFound(_0x1b6ef0,null))[_0x3d77('0x15')](saveUpdates(_0x50e98c[_0x3d77('0x3c')],null))[_0x3d77('0x15')](function(_0xc11a20){if(!_0xc11a20)return;var _0xa74122=_0xc11a20[_0x3d77('0x17')]({'plain':!![]});return _0xa74122;})[_0x3d77('0x15')](function(_0x10e2b0){var _0x201803=new Redis(config[_0x3d77('0x7')]);_0x201803['publish'](_0x3d77('0x1b'),JSON[_0x3d77('0x1c')](_[_0x3d77('0x30')](_0x10e2b0,['id','name',_0x3d77('0x44')])));return _0x10e2b0;})['then'](respondWithResult(_0x1b6ef0,null))[_0x3d77('0x3a')](handleError(_0x1b6ef0,null));};exports[_0x3d77('0x16')]=function(_0x1621df,_0x2396d6){return db['SquareProject']['find']({'where':{'id':_0x1621df[_0x3d77('0x43')]['id']}})[_0x3d77('0x15')](handleEntityNotFound(_0x2396d6,null))[_0x3d77('0x15')](removeEntity(_0x2396d6,null))[_0x3d77('0x3a')](handleError(_0x2396d6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 062eb93..b962142 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 _0x9cd7=['hasOwnProperty','hook','exports','events','SquareProject','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cd7,0x10b));var _0x79cd=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x9cd7[_0x34bd34];return _0x4e36d6;};'use strict';var EventEmitter=require(_0x79cd('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x79cd('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x79cd('0x2'),'afterDestroy':_0x79cd('0x3')};function emitEvent(_0x23d00e){return function(_0x23d58d,_0x4d581f,_0x4df77d){SquareProjectEvents[_0x79cd('0x4')](_0x23d00e+':'+_0x23d58d['id'],_0x23d58d);SquareProjectEvents[_0x79cd('0x4')](_0x23d00e,_0x23d58d);_0x4df77d(null);};}for(var e in events){if(events[_0x79cd('0x5')](e)){var event=events[e];SquareProject[_0x79cd('0x6')](e,emitEvent(event));}}module[_0x79cd('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xbb15=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','update'];(function(_0x5c487a,_0x5c9117){var _0x220ea8=function(_0x26e549){while(--_0x26e549){_0x5c487a['push'](_0x5c487a['shift']());}};_0x220ea8(++_0x5c9117);}(_0xbb15,0x152));var _0x5bb1=function(_0x38232d,_0x26d579){_0x38232d=_0x38232d-0x0;var _0x34ca7b=_0xbb15[_0x38232d];return _0x34ca7b;};'use strict';var EventEmitter=require(_0x5bb1('0x0'));var SquareProject=require(_0x5bb1('0x1'))['db'][_0x5bb1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5bb1('0x3'),'afterDestroy':_0x5bb1('0x4')};function emitEvent(_0x58d8b5){return function(_0x212090,_0x23d04b,_0x3af8bc){SquareProjectEvents['emit'](_0x58d8b5+':'+_0x212090['id'],_0x212090);SquareProjectEvents[_0x5bb1('0x5')](_0x58d8b5,_0x212090);_0x3af8bc(null);};}for(var e in events){if(events[_0x5bb1('0x6')](e)){var event=events[e];SquareProject[_0x5bb1('0x7')](e,emitEvent(event));}}module[_0x5bb1('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a99600c..6cce95a 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 _0xa3e5=['preproduction','savedAt','format','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed'];(function(_0x1e36fd,_0x47d470){var _0x588503=function(_0x1642d1){while(--_0x1642d1){_0x1e36fd['push'](_0x1e36fd['shift']());}};_0x588503(++_0x47d470);}(_0xa3e5,0x181));var _0x5a3e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa3e5[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x5a3e('0x0'));var util=require(_0x5a3e('0x1'));var logger=require(_0x5a3e('0x2'))(_0x5a3e('0x3'));var moment=require(_0x5a3e('0x4'));var BPromise=require(_0x5a3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a3e('0x6'));var rimraf=require(_0x5a3e('0x7'));var config=require(_0x5a3e('0x8'));var attributes=require(_0x5a3e('0x9'));module['exports']=function(_0x29faf6,_0x1899e5){return _0x29faf6[_0x5a3e('0xa')](_0x5a3e('0xb'),attributes,{'tableName':_0x5a3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29660d,_0x1e397e,_0x527831){if(_0x29660d[_0x5a3e('0xd')](_0x5a3e('0xe'))){_0x29660d[_0x5a3e('0xf')]=moment()[_0x5a3e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x29660d[_0x5a3e('0xd')](_0x5a3e('0x11'))){_0x29660d[_0x5a3e('0x12')]=moment()[_0x5a3e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x527831(null,_0x29660d);}}});}; \ No newline at end of file +var _0x4bd4=['changed','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','preproduction','savedAt'];(function(_0x14d37b,_0x431724){var _0x1109cd=function(_0x21901f){while(--_0x21901f){_0x14d37b['push'](_0x14d37b['shift']());}};_0x1109cd(++_0x431724);}(_0x4bd4,0x114));var _0x44bd=function(_0x16962c,_0x51be18){_0x16962c=_0x16962c-0x0;var _0x32b0c9=_0x4bd4[_0x16962c];return _0x32b0c9;};'use strict';var _=require('lodash');var util=require(_0x44bd('0x0'));var logger=require(_0x44bd('0x1'))('api');var moment=require(_0x44bd('0x2'));var BPromise=require(_0x44bd('0x3'));var rp=require(_0x44bd('0x4'));var fs=require('fs');var path=require(_0x44bd('0x5'));var rimraf=require(_0x44bd('0x6'));var config=require(_0x44bd('0x7'));var attributes=require(_0x44bd('0x8'));module[_0x44bd('0x9')]=function(_0x5433a4,_0x3bb4fa){return _0x5433a4['define']('SquareProject',attributes,{'tableName':_0x44bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ac853,_0x324e6f,_0x10fdf){if(_0x1ac853['changed'](_0x44bd('0xb'))){_0x1ac853[_0x44bd('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1ac853[_0x44bd('0xd')]('production')){_0x1ac853[_0x44bd('0xe')]=moment()[_0x44bd('0xf')](_0x44bd('0x10'));}_0x10fdf(null,_0x1ac853);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 23b0bde..c522813 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 _0x8b93=['debug','stringify','catch','error','message','ShowSquareProject','SquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','map','model','include','then','info'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x8b93,0x17c));var _0x38b9=function(_0x5ce18b,_0x2efeeb){_0x5ce18b=_0x5ce18b-0x0;var _0x492352=_0x8b93[_0x5ce18b];return _0x492352;};'use strict';var _=require(_0x38b9('0x0'));var Redis=require(_0x38b9('0x1'));var db=require(_0x38b9('0x2'))['db'];var logger=require(_0x38b9('0x3'))(_0x38b9('0x4'));var config=require(_0x38b9('0x5'));config[_0x38b9('0x6')]=_[_0x38b9('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x38b9('0x8'))(new Redis(config[_0x38b9('0x6')]));require(_0x38b9('0x9'))[_0x38b9('0xa')](socket);exports[_0x38b9('0xb')]=function(_0x5af796){var _0x1c2964=this;return new Promise(function(_0x5cd56b,_0x46a7bd){return db['SquareProject'][_0x38b9('0xc')]({'raw':_0x5af796['options']?_0x5af796[_0x38b9('0xd')][_0x38b9('0xe')]===undefined?!![]:![]:!![],'where':_0x5af796[_0x38b9('0xd')]?_0x5af796[_0x38b9('0xd')][_0x38b9('0xf')]||null:null,'attributes':_0x5af796[_0x38b9('0xd')]?_0x5af796[_0x38b9('0xd')][_0x38b9('0x10')]||null:null,'limit':_0x5af796[_0x38b9('0xd')]?_0x5af796[_0x38b9('0xd')][_0x38b9('0x11')]||null:null,'include':_0x5af796[_0x38b9('0xd')]?_0x5af796[_0x38b9('0xd')]['include']?_[_0x38b9('0x12')](_0x5af796['options']['include'],function(_0x5eab28){return{'model':db[_0x5eab28[_0x38b9('0x13')]],'as':_0x5eab28['as'],'attributes':_0x5eab28['attributes'],'include':_0x5eab28[_0x38b9('0x14')]?_[_0x38b9('0x12')](_0x5eab28[_0x38b9('0x14')],function(_0x49debd){return{'model':db[_0x49debd[_0x38b9('0x13')]],'as':_0x49debd['as'],'attributes':_0x49debd[_0x38b9('0x10')],'include':_0x49debd['include']?_['map'](_0x49debd[_0x38b9('0x14')],function(_0x4878f9){return{'model':db[_0x4878f9['model']],'as':_0x4878f9['as'],'attributes':_0x4878f9[_0x38b9('0x10')]};}):[]};}):[]};}):[]:[]})[_0x38b9('0x15')](function(_0x5c43cc){logger[_0x38b9('0x16')](_0x38b9('0xb'),_0x5af796);logger[_0x38b9('0x17')](_0x38b9('0xb'),_0x5af796,JSON[_0x38b9('0x18')](_0x5c43cc));_0x5cd56b(_0x5c43cc);})[_0x38b9('0x19')](function(_0x16755d){logger[_0x38b9('0x1a')](_0x38b9('0xb'),_0x16755d[_0x38b9('0x1b')],_0x5af796);_0x46a7bd(_0x1c2964['error'](0x1f4,_0x16755d['message']));});});};exports[_0x38b9('0x1c')]=function(_0x45f598){var _0x557163=this;return new Promise(function(_0x36b513,_0x4b77f4){return db[_0x38b9('0x1d')][_0x38b9('0x1e')]({'raw':_0x45f598['options']?_0x45f598[_0x38b9('0xd')][_0x38b9('0xe')]===undefined?!![]:![]:!![],'where':_0x45f598[_0x38b9('0xd')]?_0x45f598[_0x38b9('0xd')][_0x38b9('0xf')]||null:null,'attributes':_0x45f598[_0x38b9('0xd')]?_0x45f598['options'][_0x38b9('0x10')]||null:null,'include':_0x45f598[_0x38b9('0xd')]?_0x45f598[_0x38b9('0xd')][_0x38b9('0x14')]?_[_0x38b9('0x12')](_0x45f598[_0x38b9('0xd')][_0x38b9('0x14')],function(_0x19d5ba){return{'model':db[_0x19d5ba[_0x38b9('0x13')]],'as':_0x19d5ba['as'],'attributes':_0x19d5ba['attributes'],'include':_0x19d5ba[_0x38b9('0x14')]?_[_0x38b9('0x12')](_0x19d5ba[_0x38b9('0x14')],function(_0x11758a){return{'model':db[_0x11758a[_0x38b9('0x13')]],'as':_0x11758a['as'],'attributes':_0x11758a[_0x38b9('0x10')],'include':_0x11758a['include']?_[_0x38b9('0x12')](_0x11758a[_0x38b9('0x14')],function(_0x5462ad){return{'model':db[_0x5462ad[_0x38b9('0x13')]],'as':_0x5462ad['as'],'attributes':_0x5462ad[_0x38b9('0x10')]};}):[]};}):[]};}):[]:[]})[_0x38b9('0x15')](function(_0x4fb015){logger[_0x38b9('0x16')](_0x38b9('0x1c'),_0x45f598);logger[_0x38b9('0x17')](_0x38b9('0x1c'),_0x45f598,JSON[_0x38b9('0x18')](_0x4fb015));_0x36b513(_0x4fb015);})[_0x38b9('0x19')](function(_0x3f7ee3){logger[_0x38b9('0x1a')](_0x38b9('0x1c'),_0x3f7ee3[_0x38b9('0x1b')],_0x45f598);_0x4b77f4(_0x557163['error'](0x1f4,_0x3f7ee3[_0x38b9('0x1b')]));});});}; \ No newline at end of file +var _0xdff6=['defaults','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','info','lodash','rpc','redis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdff6,0x1e3));var _0x6dff=function(_0x229c16,_0x46f7de){_0x229c16=_0x229c16-0x0;var _0x119271=_0xdff6[_0x229c16];return _0x119271;};'use strict';var _=require(_0x6dff('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6dff('0x1'));var config=require('../../config/environment');config[_0x6dff('0x2')]=_[_0x6dff('0x3')](config[_0x6dff('0x2')],{'host':_0x6dff('0x4'),'port':0x18eb});var socket=require(_0x6dff('0x5'))(new Redis(config[_0x6dff('0x2')]));require(_0x6dff('0x6'))[_0x6dff('0x7')](socket);exports['GetSquareProjects']=function(_0x2f9cf9){var _0x5df43f=this;return new Promise(function(_0x3ce03e,_0x37c736){return db[_0x6dff('0x8')][_0x6dff('0x9')]({'raw':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xb')]===undefined?!![]:![]:!![],'where':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xc')]||null:null,'attributes':_0x2f9cf9[_0x6dff('0xa')]?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xd')]||null:null,'limit':_0x2f9cf9['options']?_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xe')]||null:null,'include':_0x2f9cf9['options']?_0x2f9cf9['options'][_0x6dff('0xf')]?_[_0x6dff('0x10')](_0x2f9cf9[_0x6dff('0xa')][_0x6dff('0xf')],function(_0x2a7612){return{'model':db[_0x2a7612[_0x6dff('0x11')]],'as':_0x2a7612['as'],'attributes':_0x2a7612[_0x6dff('0xd')],'include':_0x2a7612['include']?_[_0x6dff('0x10')](_0x2a7612[_0x6dff('0xf')],function(_0x284734){return{'model':db[_0x284734[_0x6dff('0x11')]],'as':_0x284734['as'],'attributes':_0x284734[_0x6dff('0xd')],'include':_0x284734['include']?_[_0x6dff('0x10')](_0x284734[_0x6dff('0xf')],function(_0x199503){return{'model':db[_0x199503[_0x6dff('0x11')]],'as':_0x199503['as'],'attributes':_0x199503[_0x6dff('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6dff('0x12')](function(_0x5e097e){logger['info'](_0x6dff('0x13'),_0x2f9cf9);logger[_0x6dff('0x14')](_0x6dff('0x13'),_0x2f9cf9,JSON[_0x6dff('0x15')](_0x5e097e));_0x3ce03e(_0x5e097e);})[_0x6dff('0x16')](function(_0x419095){logger[_0x6dff('0x17')](_0x6dff('0x13'),_0x419095['message'],_0x2f9cf9);_0x37c736(_0x5df43f[_0x6dff('0x17')](0x1f4,_0x419095[_0x6dff('0x18')]));});});};exports[_0x6dff('0x19')]=function(_0x1869d6){var _0x185dc8=this;return new Promise(function(_0x135e65,_0x33852d){return db[_0x6dff('0x8')]['find']({'raw':_0x1869d6[_0x6dff('0xa')]?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xb')]===undefined?!![]:![]:!![],'where':_0x1869d6['options']?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xc')]||null:null,'attributes':_0x1869d6[_0x6dff('0xa')]?_0x1869d6[_0x6dff('0xa')][_0x6dff('0xd')]||null:null,'include':_0x1869d6[_0x6dff('0xa')]?_0x1869d6['options'][_0x6dff('0xf')]?_['map'](_0x1869d6[_0x6dff('0xa')]['include'],function(_0x4d1ad6){return{'model':db[_0x4d1ad6[_0x6dff('0x11')]],'as':_0x4d1ad6['as'],'attributes':_0x4d1ad6[_0x6dff('0xd')],'include':_0x4d1ad6[_0x6dff('0xf')]?_['map'](_0x4d1ad6[_0x6dff('0xf')],function(_0x49a60d){return{'model':db[_0x49a60d[_0x6dff('0x11')]],'as':_0x49a60d['as'],'attributes':_0x49a60d[_0x6dff('0xd')],'include':_0x49a60d[_0x6dff('0xf')]?_[_0x6dff('0x10')](_0x49a60d['include'],function(_0x4bd693){return{'model':db[_0x4bd693[_0x6dff('0x11')]],'as':_0x4bd693['as'],'attributes':_0x4bd693[_0x6dff('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6dff('0x12')](function(_0x47500c){logger[_0x6dff('0x1a')](_0x6dff('0x19'),_0x1869d6);logger[_0x6dff('0x14')](_0x6dff('0x19'),_0x1869d6,JSON['stringify'](_0x47500c));_0x135e65(_0x47500c);})[_0x6dff('0x16')](function(_0x2da6ad){logger[_0x6dff('0x17')]('ShowSquareProject',_0x2da6ad[_0x6dff('0x18')],_0x1869d6);_0x33852d(_0x185dc8[_0x6dff('0x17')](0x1f4,_0x2da6ad[_0x6dff('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3537f4a..170c99d 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 _0x534b=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x534b,0x101));var _0xb534=function(_0x1905c2,_0x4893aa){_0x1905c2=_0x1905c2-0x0;var _0x31c8fd=_0x534b[_0x1905c2];return _0x31c8fd;};'use strict';var SquareProjectEvents=require(_0xb534('0x0'));var events=[_0xb534('0x1'),_0xb534('0x2'),_0xb534('0x3')];function createListener(_0x2aa465,_0x3bb845){return function(_0xbfdeb0){_0x3bb845[_0xb534('0x4')](_0x2aa465,_0xbfdeb0);};}function removeListener(_0x1e358d,_0x49547a){return function(){SquareProjectEvents[_0xb534('0x5')](_0x1e358d,_0x49547a);};}exports[_0xb534('0x6')]=function(_0x12590f){for(var _0x3a2daf=0x0,_0x32f68b=events[_0xb534('0x7')];_0x3a2daf<_0x32f68b;_0x3a2daf++){var _0x229f65=events[_0x3a2daf];var _0x1c3740=createListener(_0xb534('0x8')+_0x229f65,_0x12590f);SquareProjectEvents['on'](_0x229f65,_0x1c3740);}}; \ No newline at end of file +var _0xc775=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc775,0xf4));var _0x5c77=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc775[_0x2c91e9];return _0x13f0ff;};'use strict';var SquareProjectEvents=require(_0x5c77('0x0'));var events=[_0x5c77('0x1'),_0x5c77('0x2'),_0x5c77('0x3')];function createListener(_0x18800c,_0x3d7c27){return function(_0x570f1e){_0x3d7c27[_0x5c77('0x4')](_0x18800c,_0x570f1e);};}function removeListener(_0x48c469,_0x48f1b8){return function(){SquareProjectEvents[_0x5c77('0x5')](_0x48c469,_0x48f1b8);};}exports[_0x5c77('0x6')]=function(_0x4e83f8){for(var _0x2c3dbb=0x0,_0x3f62e5=events[_0x5c77('0x7')];_0x2c3dbb<_0x3f62e5;_0x2c3dbb++){var _0x513aa1=events[_0x2c3dbb];var _0x2a0191=createListener(_0x5c77('0x8')+_0x513aa1,_0x4e83f8);SquareProjectEvents['on'](_0x513aa1,_0x2a0191);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index bf41789..1750eea 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x436116,_0x19b30e){var _0x31852e=function(_0x43cfc6){while(--_0x43cfc6){_0x436116['push'](_0x436116['shift']());}};_0x31852e(++_0x19b30e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18840e,_0x401ea5){_0x18840e=_0x18840e-0x0;var _0xaf8f05=_0x1cb9[_0x18840e];return _0xaf8f05;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d5368,_0x58aa56){var _0x48784b=function(_0x308222){while(--_0x308222){_0x4d5368['push'](_0x4d5368['shift']());}};_0x48784b(++_0x58aa56);}(_0xf494,0x1c6));var _0x4f49=function(_0x38dd9b,_0x2f1eba){_0x38dd9b=_0x38dd9b-0x0;var _0x21b228=_0xf494[_0x38dd9b];return _0x21b228;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8797277..3a6f8c0 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 _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x90de2c,_0x3c1ece){var _0x1fd42c=function(_0x245c74){while(--_0x245c74){_0x90de2c['push'](_0x90de2c['shift']());}};_0x1fd42c(++_0x3c1ece);}(_0x814b,0x1a2));var _0xb814=function(_0x1dd2cc,_0x36ddfe){_0x1dd2cc=_0x1dd2cc-0x0;var _0x305d8e=_0x814b[_0x1dd2cc];return _0x305d8e;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x3e2b8e,_0x53e3c0){var _0x469666=function(_0x188883){while(--_0x188883){_0x3e2b8e['push'](_0x3e2b8e['shift']());}};_0x469666(++_0x53e3c0);}(_0xee14,0x13a));var _0x4ee1=function(_0xa8068a,_0x1d1b42){_0xa8068a=_0xa8068a-0x0;var _0x47f944=_0xee14[_0xa8068a];return _0x47f944;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6218323..58772ed 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 _0x3d96=['model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SquareRecording','rawAttributes','fieldName','type','key'];(function(_0x3a6cca,_0x217c1){var _0x20134b=function(_0x1f3b69){while(--_0x1f3b69){_0x3a6cca['push'](_0x3a6cca['shift']());}};_0x20134b(++_0x217c1);}(_0x3d96,0xf3));var _0x63d9=function(_0x285845,_0xd706b4){_0x285845=_0x285845-0x0;var _0xae20f3=_0x3d96[_0x285845];return _0xae20f3;};'use strict';var emlformat=require(_0x63d9('0x0'));var rimraf=require(_0x63d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63d9('0x2'));var rp=require(_0x63d9('0x3'));var moment=require(_0x63d9('0x4'));var BPromise=require(_0x63d9('0x5'));var Mustache=require(_0x63d9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x63d9('0x7'));var csv=require(_0x63d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63d9('0x9'));var _=require(_0x63d9('0xa'));var squel=require(_0x63d9('0xb'));var crypto=require(_0x63d9('0xc'));var jsforce=require(_0x63d9('0xd'));var deskjs=require(_0x63d9('0xe'));var toCsv=require(_0x63d9('0x8'));var querystring=require(_0x63d9('0xf'));var Papa=require(_0x63d9('0x10'));var Redis=require(_0x63d9('0x11'));var authService=require(_0x63d9('0x12'));var qs=require(_0x63d9('0x13'));var as=require(_0x63d9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x63d9('0x15'));var config=require(_0x63d9('0x16'));var licenseUtil=require(_0x63d9('0x17'));var db=require(_0x63d9('0x18'))['db'];function respondWithStatusCode(_0x2b98d3,_0x58ff13){_0x58ff13=_0x58ff13||0xcc;return function(_0x4028b4){if(_0x4028b4){return _0x2b98d3[_0x63d9('0x19')](_0x58ff13);}return _0x2b98d3[_0x63d9('0x1a')](_0x58ff13)[_0x63d9('0x1b')]();};}function respondWithResult(_0x25d53c,_0x149288){_0x149288=_0x149288||0xc8;return function(_0x13a4c0){if(_0x13a4c0){return _0x25d53c['status'](_0x149288)[_0x63d9('0x1c')](_0x13a4c0);}};}function respondWithFilteredResult(_0x5bb18c,_0x596378){return function(_0x505c0a){if(_0x505c0a){var _0x2ea5de=typeof _0x596378[_0x63d9('0x1d')]===_0x63d9('0x1e')&&typeof _0x596378['limit']===_0x63d9('0x1e');var _0x5af553=_0x505c0a[_0x63d9('0x1f')];var _0x3faf8f=_0x2ea5de?0x0:_0x596378[_0x63d9('0x1d')];var _0x68a313=_0x2ea5de?_0x505c0a[_0x63d9('0x1f')]:_0x596378['offset']+_0x596378[_0x63d9('0x20')];var _0x3b353f;if(_0x68a313>=_0x5af553){_0x68a313=_0x5af553;_0x3b353f=0xc8;}else{_0x3b353f=0xce;}_0x5bb18c[_0x63d9('0x1a')](_0x3b353f);return _0x5bb18c['set'](_0x63d9('0x21'),_0x3faf8f+'-'+_0x68a313+'/'+_0x5af553)['json'](_0x505c0a);}return null;};}function patchUpdates(_0x1cd4d6){return function(_0x18a795){try{jsonpatch[_0x63d9('0x22')](_0x18a795,_0x1cd4d6,!![]);}catch(_0x15b65f){return BPromise[_0x63d9('0x23')](_0x15b65f);}return _0x18a795[_0x63d9('0x24')]();};}function saveUpdates(_0x3afb6b,_0x46ec62){return function(_0x2a2529){if(_0x2a2529){return _0x2a2529[_0x63d9('0x25')](_0x3afb6b)[_0x63d9('0x26')](function(_0x58458e){return _0x58458e;});}return null;};}function removeEntity(_0xbdd13a,_0x751395){return function(_0x1b1ff9){if(_0x1b1ff9){return _0x1b1ff9[_0x63d9('0x27')]()['then'](function(){_0xbdd13a[_0x63d9('0x1a')](0xcc)[_0x63d9('0x1b')]();});}};}function handleEntityNotFound(_0x3a6124,_0x3ceecf){return function(_0x2afb85){if(!_0x2afb85){_0x3a6124[_0x63d9('0x19')](0x194);}return _0x2afb85;};}function handleError(_0x12ddcd,_0x5a4cea){_0x5a4cea=_0x5a4cea||0x1f4;return function(_0x1a059c){logger['error'](_0x1a059c[_0x63d9('0x28')]);if(_0x1a059c[_0x63d9('0x29')]){delete _0x1a059c[_0x63d9('0x29')];}_0x12ddcd[_0x63d9('0x1a')](_0x5a4cea)['send'](_0x1a059c);};}exports[_0x63d9('0x2a')]=function(_0x28d3b1,_0x2d140f){var _0x2352c3={},_0x408951={},_0x364b1d={'count':0x0,'rows':[]};var _0xd0c2d4=_['map'](db[_0x63d9('0x2b')][_0x63d9('0x2c')],function(_0x3fbf3f){return{'name':_0x3fbf3f[_0x63d9('0x2d')],'type':_0x3fbf3f[_0x63d9('0x2e')][_0x63d9('0x2f')]};});_0x408951[_0x63d9('0x30')]=_[_0x63d9('0x31')](_0xd0c2d4,_0x63d9('0x29'));_0x408951[_0x63d9('0x32')]=_['keys'](_0x28d3b1[_0x63d9('0x32')]);_0x408951[_0x63d9('0x33')]=_[_0x63d9('0x34')](_0x408951[_0x63d9('0x30')],_0x408951['query']);_0x2352c3[_0x63d9('0x35')]=_[_0x63d9('0x34')](_0x408951[_0x63d9('0x30')],qs[_0x63d9('0x36')](_0x28d3b1[_0x63d9('0x32')]['fields']));_0x2352c3[_0x63d9('0x35')]=_0x2352c3[_0x63d9('0x35')][_0x63d9('0x37')]?_0x2352c3[_0x63d9('0x35')]:_0x408951[_0x63d9('0x30')];if(!_0x28d3b1['query'][_0x63d9('0x38')]('nolimit')){_0x2352c3[_0x63d9('0x20')]=qs[_0x63d9('0x20')](_0x28d3b1[_0x63d9('0x32')]['limit']);_0x2352c3['offset']=qs[_0x63d9('0x1d')](_0x28d3b1['query']['offset']);}_0x2352c3[_0x63d9('0x39')]=qs[_0x63d9('0x3a')](_0x28d3b1['query'][_0x63d9('0x3a')]);_0x2352c3[_0x63d9('0x3b')]=qs['filters'](_[_0x63d9('0x3c')](_0x28d3b1[_0x63d9('0x32')],_0x408951['filters']),_0xd0c2d4);if(_0x28d3b1[_0x63d9('0x32')][_0x63d9('0x3d')]){_0x2352c3[_0x63d9('0x3b')]=_[_0x63d9('0x3e')](_0x2352c3[_0x63d9('0x3b')],{'$or':_[_0x63d9('0x31')](_0xd0c2d4,function(_0x105fdb){if(_0x105fdb['type']!==_0x63d9('0x3f')){var _0x1e9e60={};_0x1e9e60[_0x105fdb['name']]={'$like':'%'+_0x28d3b1[_0x63d9('0x32')][_0x63d9('0x3d')]+'%'};return _0x1e9e60;}})});}_0x2352c3=_['merge']({},_0x2352c3,_0x28d3b1[_0x63d9('0x40')]);var _0x34306d={'where':_0x2352c3['where']};return db[_0x63d9('0x2b')][_0x63d9('0x1f')](_0x34306d)[_0x63d9('0x26')](function(_0x1cd850){_0x364b1d[_0x63d9('0x1f')]=_0x1cd850;if(_0x28d3b1[_0x63d9('0x32')]['includeAll']){_0x2352c3[_0x63d9('0x41')]=[{'all':!![]}];}return db[_0x63d9('0x2b')][_0x63d9('0x42')](_0x2352c3);})['then'](function(_0x511a90){_0x364b1d['rows']=_0x511a90;return _0x364b1d;})[_0x63d9('0x26')](respondWithFilteredResult(_0x2d140f,_0x2352c3))[_0x63d9('0x43')](handleError(_0x2d140f,null));};exports[_0x63d9('0x44')]=function(_0x5089e6,_0x26c7c4){var _0x2a54ae={'raw':!![],'where':{'id':_0x5089e6[_0x63d9('0x45')]['id']}},_0x43c844={};_0x43c844['model']=_[_0x63d9('0x46')](db[_0x63d9('0x2b')][_0x63d9('0x2c')]);_0x43c844[_0x63d9('0x32')]=_['keys'](_0x5089e6[_0x63d9('0x32')]);_0x43c844[_0x63d9('0x33')]=_[_0x63d9('0x34')](_0x43c844[_0x63d9('0x30')],_0x43c844[_0x63d9('0x32')]);_0x2a54ae[_0x63d9('0x35')]=_['intersection'](_0x43c844[_0x63d9('0x30')],qs['fields'](_0x5089e6['query']['fields']));_0x2a54ae[_0x63d9('0x35')]=_0x2a54ae[_0x63d9('0x35')][_0x63d9('0x37')]?_0x2a54ae[_0x63d9('0x35')]:_0x43c844[_0x63d9('0x30')];if(_0x5089e6[_0x63d9('0x32')][_0x63d9('0x47')]){_0x2a54ae[_0x63d9('0x41')]=[{'all':!![]}];}_0x2a54ae=_['merge']({},_0x2a54ae,_0x5089e6[_0x63d9('0x40')]);return db[_0x63d9('0x2b')][_0x63d9('0x48')](_0x2a54ae)[_0x63d9('0x26')](handleEntityNotFound(_0x26c7c4,null))[_0x63d9('0x26')](respondWithResult(_0x26c7c4,null))['catch'](handleError(_0x26c7c4,null));};exports[_0x63d9('0x49')]=function(_0x328527,_0x497b26){return db[_0x63d9('0x2b')][_0x63d9('0x49')](_0x328527['body'],{})['then'](respondWithResult(_0x497b26,0xc9))[_0x63d9('0x43')](handleError(_0x497b26,null));};exports[_0x63d9('0x25')]=function(_0x23daa8,_0x46e489){if(_0x23daa8[_0x63d9('0x4a')]['id']){delete _0x23daa8[_0x63d9('0x4a')]['id'];}return db[_0x63d9('0x2b')][_0x63d9('0x48')]({'where':{'id':_0x23daa8[_0x63d9('0x45')]['id']}})[_0x63d9('0x26')](handleEntityNotFound(_0x46e489,null))[_0x63d9('0x26')](saveUpdates(_0x23daa8['body'],null))['then'](respondWithResult(_0x46e489,null))[_0x63d9('0x43')](handleError(_0x46e489,null));};exports[_0x63d9('0x4b')]=function(_0x570007,_0x46f06b,_0xfe5a0e){var _0x553061=require(_0x63d9('0x4c'));var _0x32d40c=![];var _0x3ac892={};if(_0x570007['query'][_0x63d9('0x2e')]&&_0x570007[_0x63d9('0x32')][_0x63d9('0x2e')]===_0x63d9('0x4d')){_0x3ac892['uniqueid']=_0x570007[_0x63d9('0x45')]['id'];}else{_0x3ac892['id']=_0x570007[_0x63d9('0x45')]['id'];}return db[_0x63d9('0x2b')][_0x63d9('0x48')]({'where':_0x3ac892,'attributes':['id',_0x63d9('0x4e'),'filename'],'raw':!![]})[_0x63d9('0x26')](handleEntityNotFound(_0x46f06b,null))['then'](function(_0x4de7c9){if(_0x4de7c9){var _0x32aa61=_0x4de7c9['savePath'];var _0x1590d4=util[_0x63d9('0x4f')]('%s.cypher',_0x32aa61);if(fs[_0x63d9('0x50')](_0x1590d4)){_0x32d40c=!![];return _0x553061[_0x63d9('0x51')](_0x1590d4,_0x32aa61,config['secrets']['recording'])['then'](function(){return _0x4de7c9;});}return _0x4de7c9;}})[_0x63d9('0x26')](function(_0x575ceb){if(_0x575ceb){var _0x237ff9=_0x575ceb[_0x63d9('0x4e')];if(!fs[_0x63d9('0x50')](_0x237ff9)){throw new db[(_0x63d9('0x52'))][(_0x63d9('0x53'))](_0x63d9('0x54'));}if(_0x575ceb[_0x63d9('0x55')]){return _0x46f06b[_0x63d9('0x4b')](_0x237ff9,_0x575ceb[_0x63d9('0x55')]+path[_0x63d9('0x56')](_0x237ff9),function(){if(_0x32d40c){fs['unlink'](_0x237ff9);}});}else{return _0x46f06b[_0x63d9('0x4b')](_0x237ff9,function(_0x48d382){if(_0x32d40c){fs[_0x63d9('0x57')](_0x237ff9);}});}}})[_0x63d9('0x43')](function(_0xf33474){if(_0xf33474['message']===_0x63d9('0x54')){_0x46f06b['status'](0x194)['send'](_0x63d9('0x58'));}else{return handleError(_0x46f06b,null);}});};exports[_0x63d9('0x27')]=function(_0x53af07,_0x224ad4){return db[_0x63d9('0x2b')][_0x63d9('0x48')]({'where':{'id':_0x53af07[_0x63d9('0x45')]['id']}})['then'](function(_0x1432a7){if(_['isNil'](_0x1432a7)){throw new ReferenceError(_0x63d9('0x59'));}return _0x1432a7;})[_0x63d9('0x26')](function(_0x3f9711){var _0x373e50=_0x3f9711[_0x63d9('0x4e')];logger[_0x63d9('0x5a')](_0x63d9('0x5b'),_0x373e50);if(!_['isNil'](_0x3f9711[_0x63d9('0x4e')])&&fs[_0x63d9('0x50')](_0x373e50)){logger[_0x63d9('0x5a')](_0x63d9('0x5c')+_0x373e50+_0x63d9('0x5d'));fs[_0x63d9('0x5e')](_0x373e50);}_0x373e50=_0x373e50+_0x63d9('0x5f');if(!_[_0x63d9('0x60')](_0x3f9711[_0x63d9('0x4e')])&&fs[_0x63d9('0x50')](_0x373e50)){logger['info'](_0x63d9('0x5c')+_0x373e50+_0x63d9('0x5d'));fs[_0x63d9('0x5e')](_0x373e50);}return _0x3f9711;})[_0x63d9('0x26')](function(_0x3a2577){if(!_0x3a2577)throw new InternalError();return _0x3a2577[_0x63d9('0x27')]();})[_0x63d9('0x26')](function(){_0x224ad4[_0x63d9('0x1a')](0xcc)['end']();})[_0x63d9('0x43')](handleError(_0x224ad4,null));}; \ No newline at end of file +var _0x8801=['../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','keys','find','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','send','isNil','Entity\x20not\x20found','info','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x74ec52,_0x12f517){var _0x37ea87=function(_0x281dbb){while(--_0x281dbb){_0x74ec52['push'](_0x74ec52['shift']());}};_0x37ea87(++_0x12f517);}(_0x8801,0x1a7));var _0x1880=function(_0xb41545,_0x2141db){_0xb41545=_0xb41545-0x0;var _0x1ccd69=_0x8801[_0xb41545];return _0x1ccd69;};'use strict';var emlformat=require(_0x1880('0x0'));var rimraf=require(_0x1880('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1880('0x2'));var moment=require(_0x1880('0x3'));var BPromise=require(_0x1880('0x4'));var Mustache=require(_0x1880('0x5'));var util=require(_0x1880('0x6'));var path=require('path');var sox=require(_0x1880('0x7'));var csv=require(_0x1880('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1880('0x9'));var squel=require(_0x1880('0xa'));var crypto=require(_0x1880('0xb'));var jsforce=require(_0x1880('0xc'));var deskjs=require(_0x1880('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1880('0xe'));var Papa=require(_0x1880('0xf'));var Redis=require(_0x1880('0x10'));var authService=require(_0x1880('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1880('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1880('0x13'))('api');var utils=require(_0x1880('0x14'));var config=require(_0x1880('0x15'));var licenseUtil=require(_0x1880('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b45e9,_0x2b97d4){_0x2b97d4=_0x2b97d4||0xcc;return function(_0x557f94){if(_0x557f94){return _0x2b45e9['sendStatus'](_0x2b97d4);}return _0x2b45e9[_0x1880('0x17')](_0x2b97d4)[_0x1880('0x18')]();};}function respondWithResult(_0x1d5d23,_0x39e9c7){_0x39e9c7=_0x39e9c7||0xc8;return function(_0x266dcd){if(_0x266dcd){return _0x1d5d23[_0x1880('0x17')](_0x39e9c7)[_0x1880('0x19')](_0x266dcd);}};}function respondWithFilteredResult(_0x995d6f,_0x349e74){return function(_0x2f92c9){if(_0x2f92c9){var _0x4e6341=typeof _0x349e74['offset']===_0x1880('0x1a')&&typeof _0x349e74[_0x1880('0x1b')]===_0x1880('0x1a');var _0x251b87=_0x2f92c9['count'];var _0x3ecd98=_0x4e6341?0x0:_0x349e74[_0x1880('0x1c')];var _0x3df8a7=_0x4e6341?_0x2f92c9[_0x1880('0x1d')]:_0x349e74[_0x1880('0x1c')]+_0x349e74[_0x1880('0x1b')];var _0x632c5f;if(_0x3df8a7>=_0x251b87){_0x3df8a7=_0x251b87;_0x632c5f=0xc8;}else{_0x632c5f=0xce;}_0x995d6f[_0x1880('0x17')](_0x632c5f);return _0x995d6f[_0x1880('0x1e')](_0x1880('0x1f'),_0x3ecd98+'-'+_0x3df8a7+'/'+_0x251b87)[_0x1880('0x19')](_0x2f92c9);}return null;};}function patchUpdates(_0x55452e){return function(_0x5ca4db){try{jsonpatch[_0x1880('0x20')](_0x5ca4db,_0x55452e,!![]);}catch(_0x2bb481){return BPromise[_0x1880('0x21')](_0x2bb481);}return _0x5ca4db['save']();};}function saveUpdates(_0x390636,_0x59734b){return function(_0x2d87ef){if(_0x2d87ef){return _0x2d87ef[_0x1880('0x22')](_0x390636)[_0x1880('0x23')](function(_0x5c9ca3){return _0x5c9ca3;});}return null;};}function removeEntity(_0x33a965,_0x5ce87d){return function(_0x263bc4){if(_0x263bc4){return _0x263bc4[_0x1880('0x24')]()[_0x1880('0x23')](function(){_0x33a965[_0x1880('0x17')](0xcc)[_0x1880('0x18')]();});}};}function handleEntityNotFound(_0x55e06b,_0x43924c){return function(_0x4c5b4f){if(!_0x4c5b4f){_0x55e06b[_0x1880('0x25')](0x194);}return _0x4c5b4f;};}function handleError(_0xd3d9d9,_0xd5117d){_0xd5117d=_0xd5117d||0x1f4;return function(_0x488a16){logger[_0x1880('0x26')](_0x488a16[_0x1880('0x27')]);if(_0x488a16[_0x1880('0x28')]){delete _0x488a16[_0x1880('0x28')];}_0xd3d9d9['status'](_0xd5117d)['send'](_0x488a16);};}exports['index']=function(_0x3f908c,_0x49f581){var _0x242c1c={},_0x20e235={},_0x3b9c74={'count':0x0,'rows':[]};var _0x477f11=_[_0x1880('0x29')](db[_0x1880('0x2a')][_0x1880('0x2b')],function(_0x150cae){return{'name':_0x150cae[_0x1880('0x2c')],'type':_0x150cae[_0x1880('0x2d')]['key']};});_0x20e235[_0x1880('0x2e')]=_['map'](_0x477f11,_0x1880('0x28'));_0x20e235[_0x1880('0x2f')]=_['keys'](_0x3f908c[_0x1880('0x2f')]);_0x20e235[_0x1880('0x30')]=_[_0x1880('0x31')](_0x20e235[_0x1880('0x2e')],_0x20e235[_0x1880('0x2f')]);_0x242c1c[_0x1880('0x32')]=_[_0x1880('0x31')](_0x20e235[_0x1880('0x2e')],qs[_0x1880('0x33')](_0x3f908c['query']['fields']));_0x242c1c[_0x1880('0x32')]=_0x242c1c[_0x1880('0x32')][_0x1880('0x34')]?_0x242c1c[_0x1880('0x32')]:_0x20e235[_0x1880('0x2e')];if(!_0x3f908c['query'][_0x1880('0x35')]('nolimit')){_0x242c1c[_0x1880('0x1b')]=qs['limit'](_0x3f908c['query'][_0x1880('0x1b')]);_0x242c1c['offset']=qs['offset'](_0x3f908c['query']['offset']);}_0x242c1c['order']=qs[_0x1880('0x36')](_0x3f908c[_0x1880('0x2f')][_0x1880('0x36')]);_0x242c1c[_0x1880('0x37')]=qs[_0x1880('0x30')](_['pick'](_0x3f908c[_0x1880('0x2f')],_0x20e235[_0x1880('0x30')]),_0x477f11);if(_0x3f908c[_0x1880('0x2f')]['filter']){_0x242c1c[_0x1880('0x37')]=_[_0x1880('0x38')](_0x242c1c[_0x1880('0x37')],{'$or':_[_0x1880('0x29')](_0x477f11,function(_0x46bc37){if(_0x46bc37[_0x1880('0x2d')]!==_0x1880('0x39')){var _0x55d775={};_0x55d775[_0x46bc37['name']]={'$like':'%'+_0x3f908c[_0x1880('0x2f')][_0x1880('0x3a')]+'%'};return _0x55d775;}})});}_0x242c1c=_['merge']({},_0x242c1c,_0x3f908c[_0x1880('0x3b')]);var _0x214293={'where':_0x242c1c[_0x1880('0x37')]};return db['SquareRecording']['count'](_0x214293)['then'](function(_0x407454){_0x3b9c74['count']=_0x407454;if(_0x3f908c[_0x1880('0x2f')]['includeAll']){_0x242c1c[_0x1880('0x3c')]=[{'all':!![]}];}return db[_0x1880('0x2a')][_0x1880('0x3d')](_0x242c1c);})['then'](function(_0x587d8d){_0x3b9c74['rows']=_0x587d8d;return _0x3b9c74;})[_0x1880('0x23')](respondWithFilteredResult(_0x49f581,_0x242c1c))[_0x1880('0x3e')](handleError(_0x49f581,null));};exports[_0x1880('0x3f')]=function(_0x3b2e05,_0x15dfe8){var _0x40e433={'raw':!![],'where':{'id':_0x3b2e05[_0x1880('0x40')]['id']}},_0xf0f741={};_0xf0f741['model']=_[_0x1880('0x41')](db[_0x1880('0x2a')][_0x1880('0x2b')]);_0xf0f741[_0x1880('0x2f')]=_[_0x1880('0x41')](_0x3b2e05[_0x1880('0x2f')]);_0xf0f741[_0x1880('0x30')]=_[_0x1880('0x31')](_0xf0f741['model'],_0xf0f741[_0x1880('0x2f')]);_0x40e433[_0x1880('0x32')]=_[_0x1880('0x31')](_0xf0f741[_0x1880('0x2e')],qs[_0x1880('0x33')](_0x3b2e05['query'][_0x1880('0x33')]));_0x40e433['attributes']=_0x40e433['attributes'][_0x1880('0x34')]?_0x40e433[_0x1880('0x32')]:_0xf0f741[_0x1880('0x2e')];if(_0x3b2e05[_0x1880('0x2f')]['includeAll']){_0x40e433['include']=[{'all':!![]}];}_0x40e433=_[_0x1880('0x38')]({},_0x40e433,_0x3b2e05[_0x1880('0x3b')]);return db['SquareRecording'][_0x1880('0x42')](_0x40e433)[_0x1880('0x23')](handleEntityNotFound(_0x15dfe8,null))['then'](respondWithResult(_0x15dfe8,null))[_0x1880('0x3e')](handleError(_0x15dfe8,null));};exports[_0x1880('0x43')]=function(_0x305317,_0x280041){return db[_0x1880('0x2a')]['create'](_0x305317[_0x1880('0x44')],{})[_0x1880('0x23')](respondWithResult(_0x280041,0xc9))[_0x1880('0x3e')](handleError(_0x280041,null));};exports[_0x1880('0x22')]=function(_0x4f3562,_0x5e01de){if(_0x4f3562[_0x1880('0x44')]['id']){delete _0x4f3562[_0x1880('0x44')]['id'];}return db[_0x1880('0x2a')][_0x1880('0x42')]({'where':{'id':_0x4f3562['params']['id']}})[_0x1880('0x23')](handleEntityNotFound(_0x5e01de,null))['then'](saveUpdates(_0x4f3562['body'],null))[_0x1880('0x23')](respondWithResult(_0x5e01de,null))[_0x1880('0x3e')](handleError(_0x5e01de,null));};exports[_0x1880('0x45')]=function(_0x485518,_0x49016f,_0x28adf2){var _0x511876=require('../../components/encryptor');var _0x371e63=![];var _0x126c3f={};if(_0x485518[_0x1880('0x2f')][_0x1880('0x2d')]&&_0x485518[_0x1880('0x2f')][_0x1880('0x2d')]===_0x1880('0x46')){_0x126c3f['uniqueid']=_0x485518[_0x1880('0x40')]['id'];}else{_0x126c3f['id']=_0x485518[_0x1880('0x40')]['id'];}return db[_0x1880('0x2a')][_0x1880('0x42')]({'where':_0x126c3f,'attributes':['id',_0x1880('0x47'),'filename'],'raw':!![]})[_0x1880('0x23')](handleEntityNotFound(_0x49016f,null))[_0x1880('0x23')](function(_0x3d6fe3){if(_0x3d6fe3){var _0x4eb7b1=_0x3d6fe3[_0x1880('0x47')];var _0x5d399b=util[_0x1880('0x48')](_0x1880('0x49'),_0x4eb7b1);if(fs[_0x1880('0x4a')](_0x5d399b)){_0x371e63=!![];return _0x511876[_0x1880('0x4b')](_0x5d399b,_0x4eb7b1,config['secrets'][_0x1880('0x4c')])[_0x1880('0x23')](function(){return _0x3d6fe3;});}return _0x3d6fe3;}})[_0x1880('0x23')](function(_0x2709ae){if(_0x2709ae){var _0x36984f=_0x2709ae[_0x1880('0x47')];if(!fs[_0x1880('0x4a')](_0x36984f)){throw new db['Sequelize'][(_0x1880('0x4d'))](_0x1880('0x4e'));}if(_0x2709ae[_0x1880('0x4f')]){return _0x49016f['download'](_0x36984f,_0x2709ae[_0x1880('0x4f')]+path[_0x1880('0x50')](_0x36984f),function(){if(_0x371e63){fs[_0x1880('0x51')](_0x36984f);}});}else{return _0x49016f['download'](_0x36984f,function(_0x29d7ff){if(_0x371e63){fs[_0x1880('0x51')](_0x36984f);}});}}})[_0x1880('0x3e')](function(_0x25642a){if(_0x25642a['message']==='SquareRecording\x20not\x20found'){_0x49016f[_0x1880('0x17')](0x194)[_0x1880('0x52')]('Not\x20found');}else{return handleError(_0x49016f,null);}});};exports[_0x1880('0x24')]=function(_0x331501,_0x27eb00){return db[_0x1880('0x2a')]['find']({'where':{'id':_0x331501[_0x1880('0x40')]['id']}})['then'](function(_0x5596ab){if(_[_0x1880('0x53')](_0x5596ab)){throw new ReferenceError(_0x1880('0x54'));}return _0x5596ab;})[_0x1880('0x23')](function(_0x41b645){var _0x52d440=_0x41b645[_0x1880('0x47')];logger[_0x1880('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x52d440);if(!_[_0x1880('0x53')](_0x41b645['savePath'])&&fs[_0x1880('0x4a')](_0x52d440)){logger['info']('File:\x20\x22'+_0x52d440+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1880('0x56')](_0x52d440);}_0x52d440=_0x52d440+_0x1880('0x57');if(!_[_0x1880('0x53')](_0x41b645[_0x1880('0x47')])&&fs[_0x1880('0x4a')](_0x52d440)){logger['info'](_0x1880('0x58')+_0x52d440+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1880('0x56')](_0x52d440);}return _0x41b645;})['then'](function(_0x235c68){if(!_0x235c68)throw new InternalError();return _0x235c68['destroy']();})[_0x1880('0x23')](function(){_0x27eb00[_0x1880('0x17')](0xcc)[_0x1880('0x18')]();})[_0x1880('0x3e')](handleError(_0x27eb00,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fb83255..91dd146 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 _0x06ae=['path','rimraf','../../config/environment','define','SquareRecording','square_recordings','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a8207,_0x576621){var _0x4bc774=function(_0x228d2e){while(--_0x228d2e){_0x1a8207['push'](_0x1a8207['shift']());}};_0x4bc774(++_0x576621);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var logger=require(_0xe06a('0x1'))(_0xe06a('0x2'));var moment=require(_0xe06a('0x3'));var BPromise=require(_0xe06a('0x4'));var rp=require(_0xe06a('0x5'));var fs=require('fs');var path=require(_0xe06a('0x6'));var rimraf=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x50e6cf,_0x1df79f){return _0x50e6cf[_0xe06a('0x9')](_0xe06a('0xa'),attributes,{'tableName':_0xe06a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96fd=['../../config/environment','exports','define','SquareRecording','square_recordings','util','api','moment','request-promise','path','rimraf'];(function(_0x4ade26,_0x4f6553){var _0x5e9fe6=function(_0x1d007a){while(--_0x1d007a){_0x4ade26['push'](_0x4ade26['shift']());}};_0x5e9fe6(++_0x4f6553);}(_0x96fd,0x1e9));var _0xd96f=function(_0x470c75,_0x5d3269){_0x470c75=_0x470c75-0x0;var _0x3f2aec=_0x96fd[_0x470c75];return _0x3f2aec;};'use strict';var _=require('lodash');var util=require(_0xd96f('0x0'));var logger=require('../../config/logger')(_0xd96f('0x1'));var moment=require(_0xd96f('0x2'));var BPromise=require('bluebird');var rp=require(_0xd96f('0x3'));var fs=require('fs');var path=require(_0xd96f('0x4'));var rimraf=require(_0xd96f('0x5'));var config=require(_0xd96f('0x6'));var attributes=require('./squareRecording.attributes');module[_0xd96f('0x7')]=function(_0xee38ce,_0x5d65d1){return _0xee38ce[_0xd96f('0x8')](_0xd96f('0x9'),attributes,{'tableName':_0xd96f('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 8c9b47e..6b25175 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 _0x444f=['message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20e702,_0x37eafd){var _0x4cd3a0=function(_0x90105a){while(--_0x90105a){_0x20e702['push'](_0x20e702['shift']());}};_0x4cd3a0(++_0x37eafd);}(_0x444f,0x116));var _0xf444=function(_0x573ea2,_0x1517e4){_0x573ea2=_0x573ea2-0x0;var _0x2dc6ab=_0x444f[_0x573ea2];return _0x2dc6ab;};'use strict';var _=require(_0xf444('0x0'));var util=require(_0xf444('0x1'));var moment=require('moment');var BPromise=require(_0xf444('0x2'));var rs=require(_0xf444('0x3'));var fs=require('fs');var Redis=require(_0xf444('0x4'));var db=require(_0xf444('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf444('0x6'))(_0xf444('0x7'));var config=require(_0xf444('0x8'));var jayson=require(_0xf444('0x9'));var client=jayson[_0xf444('0xa')][_0xf444('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f948a,_0x3311df,_0x4f973d){return new BPromise(function(_0x133682,_0x402d57){return client[_0xf444('0xc')](_0x1f948a,_0x4f973d)[_0xf444('0xd')](function(_0x324e30){logger[_0xf444('0xe')](_0xf444('0xf'),_0x3311df,_0xf444('0x10'));logger[_0xf444('0x11')](_0xf444('0x12'),_0x3311df,'request\x20sent',JSON[_0xf444('0x13')](_0x324e30));if(_0x324e30[_0xf444('0x14')]){if(_0x324e30[_0xf444('0x14')][_0xf444('0x15')]===0x1f4){logger[_0xf444('0x14')](_0xf444('0xf'),_0x3311df,_0x324e30['error'][_0xf444('0x16')]);return _0x402d57(_0x324e30[_0xf444('0x14')]['message']);}logger[_0xf444('0x14')](_0xf444('0xf'),_0x3311df,_0x324e30[_0xf444('0x14')]['message']);return _0x133682(_0x324e30[_0xf444('0x14')][_0xf444('0x16')]);}else{logger[_0xf444('0xe')](_0xf444('0xf'),_0x3311df,'request\x20sent');_0x133682(_0x324e30[_0xf444('0x17')][_0xf444('0x16')]);}})[_0xf444('0x18')](function(_0x2d65a3){logger[_0xf444('0x14')](_0xf444('0xf'),_0x3311df,_0x2d65a3);_0x402d57(_0x2d65a3);});});}exports[_0xf444('0x19')]=function(_0x553d14){var _0x4e3aeb=this;return new Promise(function(_0xef0b34,_0x32e650){return db[_0xf444('0x1a')][_0xf444('0x1b')](_0x553d14['body'],{'raw':_0x553d14[_0xf444('0x1c')]?_0x553d14[_0xf444('0x1c')][_0xf444('0x1d')]===undefined?!![]:![]:!![]})[_0xf444('0xd')](function(_0x39f6f2){logger[_0xf444('0xe')](_0xf444('0x19'),_0x553d14);logger[_0xf444('0x11')](_0xf444('0x19'),_0x553d14,JSON[_0xf444('0x13')](_0x39f6f2));_0xef0b34(_0x39f6f2);})[_0xf444('0x18')](function(_0xc5c517){logger[_0xf444('0x14')](_0xf444('0x19'),_0xc5c517[_0xf444('0x16')],_0x553d14);_0x32e650(_0x4e3aeb['error'](0x1f4,_0xc5c517[_0xf444('0x16')]));});});}; \ No newline at end of file +var _0x2379=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x269305,_0x485ee0){var _0x25673a=function(_0x621633){while(--_0x621633){_0x269305['push'](_0x269305['shift']());}};_0x25673a(++_0x485ee0);}(_0x2379,0x14f));var _0x9237=function(_0x558aa4,_0x5c5dc7){_0x558aa4=_0x558aa4-0x0;var _0x5100c4=_0x2379[_0x558aa4];return _0x5100c4;};'use strict';var _=require(_0x9237('0x0'));var util=require(_0x9237('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9237('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9237('0x3'))['db'];var utils=require(_0x9237('0x4'));var logger=require(_0x9237('0x5'))(_0x9237('0x6'));var config=require(_0x9237('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9237('0x8')][_0x9237('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a90c,_0x47ba95,_0x26d91b){return new BPromise(function(_0x235bf7,_0x1183b5){return client[_0x9237('0xa')](_0x46a90c,_0x26d91b)[_0x9237('0xb')](function(_0x15f180){logger[_0x9237('0xc')](_0x9237('0xd'),_0x47ba95,_0x9237('0xe'));logger[_0x9237('0xf')](_0x9237('0x10'),_0x47ba95,_0x9237('0xe'),JSON[_0x9237('0x11')](_0x15f180));if(_0x15f180['error']){if(_0x15f180['error'][_0x9237('0x12')]===0x1f4){logger[_0x9237('0x13')](_0x9237('0xd'),_0x47ba95,_0x15f180['error'][_0x9237('0x14')]);return _0x1183b5(_0x15f180[_0x9237('0x13')]['message']);}logger[_0x9237('0x13')](_0x9237('0xd'),_0x47ba95,_0x15f180[_0x9237('0x13')][_0x9237('0x14')]);return _0x235bf7(_0x15f180[_0x9237('0x13')][_0x9237('0x14')]);}else{logger[_0x9237('0xc')]('SquareRecording,\x20%s,\x20%s',_0x47ba95,_0x9237('0xe'));_0x235bf7(_0x15f180[_0x9237('0x15')][_0x9237('0x14')]);}})[_0x9237('0x16')](function(_0x45296c){logger[_0x9237('0x13')](_0x9237('0xd'),_0x47ba95,_0x45296c);_0x1183b5(_0x45296c);});});}exports[_0x9237('0x17')]=function(_0x2437d2){var _0xfb3e71=this;return new Promise(function(_0x418d62,_0x57a88e){return db[_0x9237('0x18')]['create'](_0x2437d2[_0x9237('0x19')],{'raw':_0x2437d2['options']?_0x2437d2[_0x9237('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9237('0xb')](function(_0x51d3b0){logger[_0x9237('0xc')](_0x9237('0x17'),_0x2437d2);logger[_0x9237('0xf')](_0x9237('0x17'),_0x2437d2,JSON[_0x9237('0x11')](_0x51d3b0));_0x418d62(_0x51d3b0);})[_0x9237('0x16')](function(_0x32d58d){logger[_0x9237('0x13')](_0x9237('0x17'),_0x32d58d['message'],_0x2437d2);_0x57a88e(_0xfb3e71['error'](0x1f4,_0x32d58d[_0x9237('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d69bd48..715ee86 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x32edac,_0x4520ce){var _0x45a78a=function(_0x1453fd){while(--_0x1453fd){_0x32edac['push'](_0x32edac['shift']());}};_0x45a78a(++_0x4520ce);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +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(_0x3b330e,_0x350e11){var _0xa61a79=function(_0x370470){while(--_0x370470){_0x3b330e['push'](_0x3b330e['shift']());}};_0xa61a79(++_0x350e11);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 52bae5f..ce6fb3c 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 _0xeb26=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x38a530,_0x59a169){var _0x247238=function(_0x25316d){while(--_0x25316d){_0x38a530['push'](_0x38a530['shift']());}};_0x247238(++_0x59a169);}(_0xeb26,0xbb));var _0x6eb2=function(_0x5c2ee9,_0xa81b37){_0x5c2ee9=_0x5c2ee9-0x0;var _0x103687=_0xeb26[_0x5c2ee9];return _0x103687;};'use strict';var Sequelize=require(_0x6eb2('0x0'));module[_0x6eb2('0x1')]={'network':{'type':Sequelize[_0x6eb2('0x2')]},'network_script':{'type':Sequelize[_0x6eb2('0x2')]},'request':{'type':Sequelize[_0x6eb2('0x2')]},'channel':{'type':Sequelize[_0x6eb2('0x2')]},'language':{'type':Sequelize[_0x6eb2('0x2')]},'type':{'type':Sequelize[_0x6eb2('0x2')]},'uniqueid':{'type':Sequelize[_0x6eb2('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6eb2('0x2')]},'calleridname':{'type':Sequelize[_0x6eb2('0x2')]},'callingpres':{'type':Sequelize[_0x6eb2('0x2')]},'callingani2':{'type':Sequelize[_0x6eb2('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x6eb2('0x2')]},'dnid':{'type':Sequelize[_0x6eb2('0x2')]},'rdnis':{'type':Sequelize[_0x6eb2('0x2')]},'context':{'type':Sequelize[_0x6eb2('0x2')]},'extension':{'type':Sequelize[_0x6eb2('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6eb2('0x2')]},'accountcode':{'type':Sequelize[_0x6eb2('0x2')]},'threadid':{'type':Sequelize[_0x6eb2('0x2')]},'project_name':{'type':Sequelize[_0x6eb2('0x2')]},'joinAt':{'type':Sequelize[_0x6eb2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6eb2('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x45fd=['exports','STRING','DATE','BOOLEAN'];(function(_0x38e3a4,_0x25dc05){var _0xae3d09=function(_0x4899ef){while(--_0x4899ef){_0x38e3a4['push'](_0x38e3a4['shift']());}};_0xae3d09(++_0x25dc05);}(_0x45fd,0x1e0));var _0xd45f=function(_0x351ef7,_0x59f56d){_0x351ef7=_0x351ef7-0x0;var _0x565086=_0x45fd[_0x351ef7];return _0x565086;};'use strict';var Sequelize=require('sequelize');module[_0xd45f('0x0')]={'network':{'type':Sequelize[_0xd45f('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd45f('0x1')]},'language':{'type':Sequelize[_0xd45f('0x1')]},'type':{'type':Sequelize[_0xd45f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd45f('0x1')]},'callerid':{'type':Sequelize[_0xd45f('0x1')]},'calleridname':{'type':Sequelize[_0xd45f('0x1')]},'callingpres':{'type':Sequelize[_0xd45f('0x1')]},'callingani2':{'type':Sequelize[_0xd45f('0x1')]},'callington':{'type':Sequelize[_0xd45f('0x1')]},'callingtns':{'type':Sequelize[_0xd45f('0x1')]},'dnid':{'type':Sequelize[_0xd45f('0x1')]},'rdnis':{'type':Sequelize[_0xd45f('0x1')]},'context':{'type':Sequelize[_0xd45f('0x1')]},'extension':{'type':Sequelize[_0xd45f('0x1')]},'priority':{'type':Sequelize[_0xd45f('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xd45f('0x1')]},'project_name':{'type':Sequelize[_0xd45f('0x1')]},'joinAt':{'type':Sequelize[_0xd45f('0x2')]},'leaveAt':{'type':Sequelize[_0xd45f('0x2')]},'bot':{'type':Sequelize[_0xd45f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index fee9b1c..16853f3 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 _0x4408=['../../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','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0xe21db6,_0x324d33){var _0x3b45f8=function(_0x36ad38){while(--_0x36ad38){_0xe21db6['push'](_0xe21db6['shift']());}};_0x3b45f8(++_0x324d33);}(_0x4408,0xd9));var _0x8440=function(_0x370ab8,_0x9491f7){_0x370ab8=_0x370ab8-0x0;var _0x3f0209=_0x4408[_0x370ab8];return _0x3f0209;};'use strict';var emlformat=require(_0x8440('0x0'));var rimraf=require(_0x8440('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8440('0x2'));var rp=require(_0x8440('0x3'));var moment=require(_0x8440('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8440('0x5'));var util=require(_0x8440('0x6'));var path=require(_0x8440('0x7'));var sox=require(_0x8440('0x8'));var csv=require(_0x8440('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8440('0xa'));var _=require('lodash');var squel=require(_0x8440('0xb'));var crypto=require(_0x8440('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8440('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8440('0xe'));var Papa=require(_0x8440('0xf'));var Redis=require(_0x8440('0x10'));var authService=require(_0x8440('0x11'));var qs=require(_0x8440('0x12'));var as=require(_0x8440('0x13'));var hardwareService=require(_0x8440('0x14'));var logger=require(_0x8440('0x15'))(_0x8440('0x16'));var utils=require(_0x8440('0x17'));var config=require(_0x8440('0x18'));var licenseUtil=require(_0x8440('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8bf1,_0x330d3b){_0x330d3b=_0x330d3b||0xcc;return function(_0x36274b){if(_0x36274b){return _0x1f8bf1[_0x8440('0x1a')](_0x330d3b);}return _0x1f8bf1[_0x8440('0x1b')](_0x330d3b)[_0x8440('0x1c')]();};}function respondWithResult(_0x3f8327,_0x36d484){_0x36d484=_0x36d484||0xc8;return function(_0x172c30){if(_0x172c30){return _0x3f8327[_0x8440('0x1b')](_0x36d484)[_0x8440('0x1d')](_0x172c30);}};}function respondWithFilteredResult(_0x93da6b,_0x511c4d){return function(_0x591587){if(_0x591587){var _0x2d6664=typeof _0x511c4d[_0x8440('0x1e')]===_0x8440('0x1f')&&typeof _0x511c4d[_0x8440('0x20')]===_0x8440('0x1f');var _0x26fce9=_0x591587[_0x8440('0x21')];var _0x479ec2=_0x2d6664?0x0:_0x511c4d['offset'];var _0x169611=_0x2d6664?_0x591587[_0x8440('0x21')]:_0x511c4d[_0x8440('0x1e')]+_0x511c4d[_0x8440('0x20')];var _0x3376b8;if(_0x169611>=_0x26fce9){_0x169611=_0x26fce9;_0x3376b8=0xc8;}else{_0x3376b8=0xce;}_0x93da6b[_0x8440('0x1b')](_0x3376b8);return _0x93da6b[_0x8440('0x22')](_0x8440('0x23'),_0x479ec2+'-'+_0x169611+'/'+_0x26fce9)['json'](_0x591587);}return null;};}function patchUpdates(_0x3df83d){return function(_0x224192){try{jsonpatch['apply'](_0x224192,_0x3df83d,!![]);}catch(_0x224d4c){return BPromise[_0x8440('0x24')](_0x224d4c);}return _0x224192[_0x8440('0x25')]();};}function saveUpdates(_0x35e0fb,_0x58c0a5){return function(_0x58d0ad){if(_0x58d0ad){return _0x58d0ad[_0x8440('0x26')](_0x35e0fb)[_0x8440('0x27')](function(_0x48c64e){return _0x48c64e;});}return null;};}function removeEntity(_0x52af19,_0x28e87c){return function(_0x1bbdf6){if(_0x1bbdf6){return _0x1bbdf6[_0x8440('0x28')]()[_0x8440('0x27')](function(){_0x52af19[_0x8440('0x1b')](0xcc)[_0x8440('0x1c')]();});}};}function handleEntityNotFound(_0x530ff2,_0x19d066){return function(_0xafa3ab){if(!_0xafa3ab){_0x530ff2['sendStatus'](0x194);}return _0xafa3ab;};}function handleError(_0x197763,_0x41044a){_0x41044a=_0x41044a||0x1f4;return function(_0x18dce2){logger[_0x8440('0x29')](_0x18dce2[_0x8440('0x2a')]);if(_0x18dce2[_0x8440('0x2b')]){delete _0x18dce2[_0x8440('0x2b')];}_0x197763[_0x8440('0x1b')](_0x41044a)[_0x8440('0x2c')](_0x18dce2);};}exports['index']=function(_0x4f0829,_0x58b46a){var _0x3979f8={},_0x33d552={},_0x53a371={'count':0x0,'rows':[]};var _0x371523=_[_0x8440('0x2d')](db[_0x8440('0x2e')][_0x8440('0x2f')],function(_0x3b0dcc){return{'name':_0x3b0dcc['fieldName'],'type':_0x3b0dcc['type']['key']};});_0x33d552[_0x8440('0x30')]=_[_0x8440('0x2d')](_0x371523,_0x8440('0x2b'));_0x33d552[_0x8440('0x31')]=_[_0x8440('0x32')](_0x4f0829[_0x8440('0x31')]);_0x33d552[_0x8440('0x33')]=_['intersection'](_0x33d552[_0x8440('0x30')],_0x33d552[_0x8440('0x31')]);_0x3979f8[_0x8440('0x34')]=_[_0x8440('0x35')](_0x33d552[_0x8440('0x30')],qs[_0x8440('0x36')](_0x4f0829[_0x8440('0x31')][_0x8440('0x36')]));_0x3979f8['attributes']=_0x3979f8[_0x8440('0x34')][_0x8440('0x37')]?_0x3979f8['attributes']:_0x33d552[_0x8440('0x30')];if(!_0x4f0829[_0x8440('0x31')][_0x8440('0x38')](_0x8440('0x39'))){_0x3979f8['limit']=qs[_0x8440('0x20')](_0x4f0829['query']['limit']);_0x3979f8['offset']=qs['offset'](_0x4f0829[_0x8440('0x31')][_0x8440('0x1e')]);}_0x3979f8[_0x8440('0x3a')]=qs[_0x8440('0x3b')](_0x4f0829[_0x8440('0x31')][_0x8440('0x3b')]);_0x3979f8[_0x8440('0x3c')]=qs[_0x8440('0x33')](_[_0x8440('0x3d')](_0x4f0829[_0x8440('0x31')],_0x33d552[_0x8440('0x33')]),_0x371523);if(_0x4f0829[_0x8440('0x31')][_0x8440('0x3e')]){_0x3979f8[_0x8440('0x3c')]=_[_0x8440('0x3f')](_0x3979f8[_0x8440('0x3c')],{'$or':_['map'](_0x371523,function(_0x5acc50){if(_0x5acc50[_0x8440('0x40')]!==_0x8440('0x41')){var _0x2a7976={};_0x2a7976[_0x5acc50[_0x8440('0x2b')]]={'$like':'%'+_0x4f0829['query'][_0x8440('0x3e')]+'%'};return _0x2a7976;}})});}_0x3979f8=_[_0x8440('0x3f')]({},_0x3979f8,_0x4f0829[_0x8440('0x42')]);var _0x5ea43c={'where':_0x3979f8[_0x8440('0x3c')]};return db[_0x8440('0x2e')][_0x8440('0x21')](_0x5ea43c)[_0x8440('0x27')](function(_0x45c8fd){_0x53a371['count']=_0x45c8fd;if(_0x4f0829[_0x8440('0x31')]['includeAll']){_0x3979f8[_0x8440('0x43')]=[{'all':!![]}];}return db[_0x8440('0x2e')][_0x8440('0x44')](_0x3979f8);})[_0x8440('0x27')](function(_0x21b256){_0x53a371[_0x8440('0x45')]=_0x21b256;return _0x53a371;})['then'](respondWithFilteredResult(_0x58b46a,_0x3979f8))[_0x8440('0x46')](handleError(_0x58b46a,null));};exports[_0x8440('0x47')]=function(_0x24f289,_0x22252f){var _0x115e0f={'raw':!![],'where':{'id':_0x24f289[_0x8440('0x48')]['id']}},_0x57a65c={};_0x57a65c[_0x8440('0x30')]=_[_0x8440('0x32')](db[_0x8440('0x2e')][_0x8440('0x2f')]);_0x57a65c[_0x8440('0x31')]=_[_0x8440('0x32')](_0x24f289[_0x8440('0x31')]);_0x57a65c[_0x8440('0x33')]=_['intersection'](_0x57a65c[_0x8440('0x30')],_0x57a65c['query']);_0x115e0f[_0x8440('0x34')]=_[_0x8440('0x35')](_0x57a65c[_0x8440('0x30')],qs[_0x8440('0x36')](_0x24f289[_0x8440('0x31')][_0x8440('0x36')]));_0x115e0f[_0x8440('0x34')]=_0x115e0f[_0x8440('0x34')][_0x8440('0x37')]?_0x115e0f[_0x8440('0x34')]:_0x57a65c[_0x8440('0x30')];if(_0x24f289['query'][_0x8440('0x49')]){_0x115e0f[_0x8440('0x43')]=[{'all':!![]}];}_0x115e0f=_[_0x8440('0x3f')]({},_0x115e0f,_0x24f289[_0x8440('0x42')]);return db[_0x8440('0x2e')][_0x8440('0x4a')](_0x115e0f)[_0x8440('0x27')](handleEntityNotFound(_0x22252f,null))[_0x8440('0x27')](respondWithResult(_0x22252f,null))[_0x8440('0x46')](handleError(_0x22252f,null));};exports[_0x8440('0x4b')]=function(_0x3bf7b8,_0x3e3fcf){return db['SquareReport'][_0x8440('0x4b')](_0x3bf7b8[_0x8440('0x4c')],{})[_0x8440('0x27')](respondWithResult(_0x3e3fcf,0xc9))[_0x8440('0x46')](handleError(_0x3e3fcf,null));};exports[_0x8440('0x26')]=function(_0x2d9608,_0x251cc9){if(_0x2d9608['body']['id']){delete _0x2d9608[_0x8440('0x4c')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x2d9608[_0x8440('0x48')]['id']}})[_0x8440('0x27')](handleEntityNotFound(_0x251cc9,null))[_0x8440('0x27')](saveUpdates(_0x2d9608[_0x8440('0x4c')],null))[_0x8440('0x27')](respondWithResult(_0x251cc9,null))[_0x8440('0x46')](handleError(_0x251cc9,null));};exports['destroy']=function(_0xbaad46,_0x368d31){return db[_0x8440('0x2e')][_0x8440('0x4a')]({'where':{'id':_0xbaad46[_0x8440('0x48')]['id']}})[_0x8440('0x27')](handleEntityNotFound(_0x368d31,null))[_0x8440('0x27')](removeEntity(_0x368d31,null))[_0x8440('0x46')](handleError(_0x368d31,null));};exports['describe']=function(_0x1640fd,_0x229091){return db[_0x8440('0x2e')][_0x8440('0x4d')]()['then'](respondWithResult(_0x229091,null))[_0x8440('0x46')](handleError(_0x229091,null));}; \ No newline at end of file +var _0x5958=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','type','key','model','query','keys'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5958,0x155));var _0x8595=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x5958[_0x577519];return _0x5b12f7;};'use strict';var emlformat=require(_0x8595('0x0'));var rimraf=require(_0x8595('0x1'));var zipdir=require(_0x8595('0x2'));var jsonpatch=require(_0x8595('0x3'));var rp=require(_0x8595('0x4'));var moment=require(_0x8595('0x5'));var BPromise=require(_0x8595('0x6'));var Mustache=require(_0x8595('0x7'));var util=require(_0x8595('0x8'));var path=require(_0x8595('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8595('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8595('0xb'));var squel=require(_0x8595('0xc'));var crypto=require(_0x8595('0xd'));var jsforce=require(_0x8595('0xe'));var deskjs=require(_0x8595('0xf'));var toCsv=require(_0x8595('0x10'));var querystring=require(_0x8595('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8595('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8595('0x13'));var hardwareService=require(_0x8595('0x14'));var logger=require(_0x8595('0x15'))(_0x8595('0x16'));var utils=require(_0x8595('0x17'));var config=require(_0x8595('0x18'));var licenseUtil=require(_0x8595('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5db4e8,_0x5e40cb){_0x5e40cb=_0x5e40cb||0xcc;return function(_0xc1630d){if(_0xc1630d){return _0x5db4e8['sendStatus'](_0x5e40cb);}return _0x5db4e8['status'](_0x5e40cb)['end']();};}function respondWithResult(_0x23306f,_0xf67155){_0xf67155=_0xf67155||0xc8;return function(_0x14fd07){if(_0x14fd07){return _0x23306f[_0x8595('0x1a')](_0xf67155)[_0x8595('0x1b')](_0x14fd07);}};}function respondWithFilteredResult(_0x3206aa,_0x4a0be1){return function(_0x28028d){if(_0x28028d){var _0x34cf0c=typeof _0x4a0be1[_0x8595('0x1c')]==='undefined'&&typeof _0x4a0be1[_0x8595('0x1d')]===_0x8595('0x1e');var _0x29aa98=_0x28028d[_0x8595('0x1f')];var _0x4b3522=_0x34cf0c?0x0:_0x4a0be1[_0x8595('0x1c')];var _0x2de54a=_0x34cf0c?_0x28028d['count']:_0x4a0be1['offset']+_0x4a0be1['limit'];var _0x3d5263;if(_0x2de54a>=_0x29aa98){_0x2de54a=_0x29aa98;_0x3d5263=0xc8;}else{_0x3d5263=0xce;}_0x3206aa[_0x8595('0x1a')](_0x3d5263);return _0x3206aa[_0x8595('0x20')](_0x8595('0x21'),_0x4b3522+'-'+_0x2de54a+'/'+_0x29aa98)[_0x8595('0x1b')](_0x28028d);}return null;};}function patchUpdates(_0x50a794){return function(_0x484c86){try{jsonpatch[_0x8595('0x22')](_0x484c86,_0x50a794,!![]);}catch(_0x3e505b){return BPromise[_0x8595('0x23')](_0x3e505b);}return _0x484c86[_0x8595('0x24')]();};}function saveUpdates(_0x206bfe,_0x44fe52){return function(_0x182053){if(_0x182053){return _0x182053[_0x8595('0x25')](_0x206bfe)[_0x8595('0x26')](function(_0x417c45){return _0x417c45;});}return null;};}function removeEntity(_0xa0c119,_0x3d3d76){return function(_0x593b57){if(_0x593b57){return _0x593b57[_0x8595('0x27')]()[_0x8595('0x26')](function(){_0xa0c119[_0x8595('0x1a')](0xcc)[_0x8595('0x28')]();});}};}function handleEntityNotFound(_0x39933f,_0x30f36f){return function(_0x1fc2ee){if(!_0x1fc2ee){_0x39933f[_0x8595('0x29')](0x194);}return _0x1fc2ee;};}function handleError(_0x5ba9e3,_0x5e02b2){_0x5e02b2=_0x5e02b2||0x1f4;return function(_0x24635a){logger[_0x8595('0x2a')](_0x24635a[_0x8595('0x2b')]);if(_0x24635a['name']){delete _0x24635a[_0x8595('0x2c')];}_0x5ba9e3['status'](_0x5e02b2)[_0x8595('0x2d')](_0x24635a);};}exports[_0x8595('0x2e')]=function(_0x316d5b,_0x30bf07){var _0x3a35ed={},_0x3d42f8={},_0x3f68f8={'count':0x0,'rows':[]};var _0x4e936=_['map'](db[_0x8595('0x2f')][_0x8595('0x30')],function(_0x2c9791){return{'name':_0x2c9791['fieldName'],'type':_0x2c9791[_0x8595('0x31')][_0x8595('0x32')]};});_0x3d42f8[_0x8595('0x33')]=_['map'](_0x4e936,'name');_0x3d42f8[_0x8595('0x34')]=_[_0x8595('0x35')](_0x316d5b[_0x8595('0x34')]);_0x3d42f8['filters']=_[_0x8595('0x36')](_0x3d42f8[_0x8595('0x33')],_0x3d42f8[_0x8595('0x34')]);_0x3a35ed[_0x8595('0x37')]=_[_0x8595('0x36')](_0x3d42f8['model'],qs[_0x8595('0x38')](_0x316d5b[_0x8595('0x34')][_0x8595('0x38')]));_0x3a35ed[_0x8595('0x37')]=_0x3a35ed['attributes']['length']?_0x3a35ed[_0x8595('0x37')]:_0x3d42f8['model'];if(!_0x316d5b[_0x8595('0x34')][_0x8595('0x39')](_0x8595('0x3a'))){_0x3a35ed['limit']=qs[_0x8595('0x1d')](_0x316d5b[_0x8595('0x34')]['limit']);_0x3a35ed[_0x8595('0x1c')]=qs[_0x8595('0x1c')](_0x316d5b[_0x8595('0x34')][_0x8595('0x1c')]);}_0x3a35ed[_0x8595('0x3b')]=qs[_0x8595('0x3c')](_0x316d5b[_0x8595('0x34')][_0x8595('0x3c')]);_0x3a35ed['where']=qs[_0x8595('0x3d')](_['pick'](_0x316d5b[_0x8595('0x34')],_0x3d42f8[_0x8595('0x3d')]),_0x4e936);if(_0x316d5b[_0x8595('0x34')][_0x8595('0x3e')]){_0x3a35ed[_0x8595('0x3f')]=_['merge'](_0x3a35ed['where'],{'$or':_[_0x8595('0x40')](_0x4e936,function(_0x4836d6){if(_0x4836d6[_0x8595('0x31')]!==_0x8595('0x41')){var _0x420619={};_0x420619[_0x4836d6['name']]={'$like':'%'+_0x316d5b[_0x8595('0x34')][_0x8595('0x3e')]+'%'};return _0x420619;}})});}_0x3a35ed=_[_0x8595('0x42')]({},_0x3a35ed,_0x316d5b['options']);var _0x2a675d={'where':_0x3a35ed[_0x8595('0x3f')]};return db[_0x8595('0x2f')][_0x8595('0x1f')](_0x2a675d)[_0x8595('0x26')](function(_0x25ce02){_0x3f68f8[_0x8595('0x1f')]=_0x25ce02;if(_0x316d5b[_0x8595('0x34')][_0x8595('0x43')]){_0x3a35ed[_0x8595('0x44')]=[{'all':!![]}];}return db[_0x8595('0x2f')][_0x8595('0x45')](_0x3a35ed);})['then'](function(_0x93821c){_0x3f68f8[_0x8595('0x46')]=_0x93821c;return _0x3f68f8;})[_0x8595('0x26')](respondWithFilteredResult(_0x30bf07,_0x3a35ed))['catch'](handleError(_0x30bf07,null));};exports[_0x8595('0x47')]=function(_0x471381,_0x711cf6){var _0x5ac95d={'raw':!![],'where':{'id':_0x471381['params']['id']}},_0x1cb411={};_0x1cb411[_0x8595('0x33')]=_[_0x8595('0x35')](db['SquareReport'][_0x8595('0x30')]);_0x1cb411[_0x8595('0x34')]=_[_0x8595('0x35')](_0x471381[_0x8595('0x34')]);_0x1cb411['filters']=_[_0x8595('0x36')](_0x1cb411[_0x8595('0x33')],_0x1cb411['query']);_0x5ac95d[_0x8595('0x37')]=_[_0x8595('0x36')](_0x1cb411[_0x8595('0x33')],qs['fields'](_0x471381[_0x8595('0x34')][_0x8595('0x38')]));_0x5ac95d[_0x8595('0x37')]=_0x5ac95d[_0x8595('0x37')][_0x8595('0x48')]?_0x5ac95d['attributes']:_0x1cb411[_0x8595('0x33')];if(_0x471381[_0x8595('0x34')][_0x8595('0x43')]){_0x5ac95d[_0x8595('0x44')]=[{'all':!![]}];}_0x5ac95d=_[_0x8595('0x42')]({},_0x5ac95d,_0x471381['options']);return db['SquareReport'][_0x8595('0x49')](_0x5ac95d)[_0x8595('0x26')](handleEntityNotFound(_0x711cf6,null))[_0x8595('0x26')](respondWithResult(_0x711cf6,null))[_0x8595('0x4a')](handleError(_0x711cf6,null));};exports[_0x8595('0x4b')]=function(_0x51bbab,_0x1bf579){return db['SquareReport'][_0x8595('0x4b')](_0x51bbab[_0x8595('0x4c')],{})['then'](respondWithResult(_0x1bf579,0xc9))['catch'](handleError(_0x1bf579,null));};exports[_0x8595('0x25')]=function(_0x542a6f,_0x50f179){if(_0x542a6f['body']['id']){delete _0x542a6f['body']['id'];}return db[_0x8595('0x2f')][_0x8595('0x49')]({'where':{'id':_0x542a6f[_0x8595('0x4d')]['id']}})[_0x8595('0x26')](handleEntityNotFound(_0x50f179,null))[_0x8595('0x26')](saveUpdates(_0x542a6f[_0x8595('0x4c')],null))[_0x8595('0x26')](respondWithResult(_0x50f179,null))[_0x8595('0x4a')](handleError(_0x50f179,null));};exports[_0x8595('0x27')]=function(_0x25e0f8,_0x288abb){return db[_0x8595('0x2f')]['find']({'where':{'id':_0x25e0f8[_0x8595('0x4d')]['id']}})[_0x8595('0x26')](handleEntityNotFound(_0x288abb,null))[_0x8595('0x26')](removeEntity(_0x288abb,null))[_0x8595('0x4a')](handleError(_0x288abb,null));};exports[_0x8595('0x4e')]=function(_0x478d8c,_0x211e88){return db['SquareReport']['describe']()['then'](respondWithResult(_0x211e88,null))['catch'](handleError(_0x211e88,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index aee4c5d..654f4dd 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 _0x5b20=['SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x5b20,0xe5));var _0x05b2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b20[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var logger=require(_0x05b2('0x2'))(_0x05b2('0x3'));var moment=require(_0x05b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x05b2('0x5'));var fs=require('fs');var path=require(_0x05b2('0x6'));var rimraf=require('rimraf');var config=require(_0x05b2('0x7'));var attributes=require(_0x05b2('0x8'));module[_0x05b2('0x9')]=function(_0x486996,_0x248ed2){return _0x486996[_0x05b2('0xa')](_0x05b2('0xb'),attributes,{'tableName':_0x05b2('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x05b2('0xd'),_0x05b2('0xe')]},{'name':'leaveAt','fields':[_0x05b2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e66=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','moment','bluebird'];(function(_0x214297,_0x4f643e){var _0x1571d4=function(_0x2450fa){while(--_0x2450fa){_0x214297['push'](_0x214297['shift']());}};_0x1571d4(++_0x4f643e);}(_0x6e66,0x192));var _0x66e6=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x6e66[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66e6('0x0'))('api');var moment=require(_0x66e6('0x1'));var BPromise=require(_0x66e6('0x2'));var rp=require(_0x66e6('0x3'));var fs=require('fs');var path=require(_0x66e6('0x4'));var rimraf=require(_0x66e6('0x5'));var config=require(_0x66e6('0x6'));var attributes=require(_0x66e6('0x7'));module[_0x66e6('0x8')]=function(_0x154a9e,_0x456797){return _0x154a9e[_0x66e6('0x9')](_0x66e6('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x66e6('0xb'),'fields':[_0x66e6('0xc'),_0x66e6('0xd')]},{'name':_0x66e6('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4cfa230..e0d6eb4 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 _0x3f60=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','then','SquareReport','raw','where','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird'];(function(_0x373b82,_0xc66d54){var _0x3e134b=function(_0x197179){while(--_0x197179){_0x373b82['push'](_0x373b82['shift']());}};_0x3e134b(++_0xc66d54);}(_0x3f60,0x80));var _0x03f6=function(_0x44b827,_0x1bb1aa){_0x44b827=_0x44b827-0x0;var _0x527342=_0x3f60[_0x44b827];return _0x527342;};'use strict';var _=require(_0x03f6('0x0'));var util=require(_0x03f6('0x1'));var moment=require(_0x03f6('0x2'));var BPromise=require(_0x03f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03f6('0x4'));var db=require(_0x03f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03f6('0x6'))(_0x03f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x03f6('0x8'));var client=jayson[_0x03f6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28f84a,_0x102afd,_0x3c256e){return new BPromise(function(_0x36bf65,_0x13ed8b){return client[_0x03f6('0xa')](_0x28f84a,_0x3c256e)['then'](function(_0x3471aa){logger[_0x03f6('0xb')]('SquareReport,\x20%s,\x20%s',_0x102afd,'request\x20sent');logger[_0x03f6('0xc')](_0x03f6('0xd'),_0x102afd,_0x03f6('0xe'),JSON[_0x03f6('0xf')](_0x3471aa));if(_0x3471aa[_0x03f6('0x10')]){if(_0x3471aa[_0x03f6('0x10')][_0x03f6('0x11')]===0x1f4){logger[_0x03f6('0x10')](_0x03f6('0x12'),_0x102afd,_0x3471aa[_0x03f6('0x10')]['message']);return _0x13ed8b(_0x3471aa[_0x03f6('0x10')][_0x03f6('0x13')]);}logger[_0x03f6('0x10')](_0x03f6('0x12'),_0x102afd,_0x3471aa['error']['message']);return _0x36bf65(_0x3471aa[_0x03f6('0x10')][_0x03f6('0x13')]);}else{logger[_0x03f6('0xb')]('SquareReport,\x20%s,\x20%s',_0x102afd,_0x03f6('0xe'));_0x36bf65(_0x3471aa[_0x03f6('0x14')][_0x03f6('0x13')]);}})[_0x03f6('0x15')](function(_0x20481){logger['error']('SquareReport,\x20%s,\x20%s',_0x102afd,_0x20481);_0x13ed8b(_0x20481);});});}exports[_0x03f6('0x16')]=function(_0x43dc94){var _0x4760bf=this;return new Promise(function(_0x8c9f58,_0x5949eb){return db['SquareReport'][_0x03f6('0x17')](_0x43dc94[_0x03f6('0x18')],{'raw':_0x43dc94[_0x03f6('0x19')]?_0x43dc94[_0x03f6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x03f6('0x1a')](function(_0x10d860){logger[_0x03f6('0xb')](_0x03f6('0x16'),_0x43dc94);logger[_0x03f6('0xc')](_0x03f6('0x16'),_0x43dc94,JSON['stringify'](_0x10d860));_0x8c9f58(_0x10d860);})['catch'](function(_0x25b786){logger[_0x03f6('0x10')](_0x03f6('0x16'),_0x25b786[_0x03f6('0x13')],_0x43dc94);_0x5949eb(_0x4760bf['error'](0x1f4,_0x25b786[_0x03f6('0x13')]));});});};exports['UpdateSquareReport']=function(_0x37e326){var _0x6fd0ce=this;return new Promise(function(_0x2f4371,_0x53da59){return db[_0x03f6('0x1b')]['update'](_0x37e326[_0x03f6('0x18')],{'raw':_0x37e326['options']?_0x37e326[_0x03f6('0x19')][_0x03f6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37e326[_0x03f6('0x19')]?_0x37e326[_0x03f6('0x19')][_0x03f6('0x1d')]||null:null,'attributes':_0x37e326[_0x03f6('0x19')]?_0x37e326[_0x03f6('0x19')][_0x03f6('0x1e')]||null:null,'limit':_0x37e326[_0x03f6('0x19')]?_0x37e326['options'][_0x03f6('0x1f')]||null:null})['then'](function(_0x26c502){logger[_0x03f6('0xb')](_0x03f6('0x20'),_0x37e326);logger['debug'](_0x03f6('0x20'),_0x37e326,JSON['stringify'](_0x26c502));_0x2f4371(_0x26c502);})[_0x03f6('0x15')](function(_0x25b4a4){logger[_0x03f6('0x10')]('UpdateSquareReport',_0x25b4a4[_0x03f6('0x13')],_0x37e326);_0x53da59(_0x6fd0ce[_0x03f6('0x10')](0x1f4,_0x25b4a4[_0x03f6('0x13')]));});});}; \ No newline at end of file +var _0x3f3c=['SquareReport','create','body','options','debug','UpdateSquareReport','update','raw','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport'];(function(_0x4ed0ef,_0x324045){var _0x3e131e=function(_0x326b8a){while(--_0x326b8a){_0x4ed0ef['push'](_0x4ed0ef['shift']());}};_0x3e131e(++_0x324045);}(_0x3f3c,0x13b));var _0xc3f3=function(_0x49b297,_0x175a79){_0x49b297=_0x49b297-0x0;var _0x4d70f2=_0x3f3c[_0x49b297];return _0x4d70f2;};'use strict';var _=require(_0xc3f3('0x0'));var util=require(_0xc3f3('0x1'));var moment=require('moment');var BPromise=require(_0xc3f3('0x2'));var rs=require(_0xc3f3('0x3'));var fs=require('fs');var Redis=require(_0xc3f3('0x4'));var db=require(_0xc3f3('0x5'))['db'];var utils=require(_0xc3f3('0x6'));var logger=require(_0xc3f3('0x7'))(_0xc3f3('0x8'));var config=require(_0xc3f3('0x9'));var jayson=require(_0xc3f3('0xa'));var client=jayson[_0xc3f3('0xb')][_0xc3f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5adf18,_0x209ff1,_0x447969){return new BPromise(function(_0x5a5693,_0x49aa0d){return client[_0xc3f3('0xd')](_0x5adf18,_0x447969)[_0xc3f3('0xe')](function(_0x4cc2f5){logger[_0xc3f3('0xf')]('SquareReport,\x20%s,\x20%s',_0x209ff1,'request\x20sent');logger['debug'](_0xc3f3('0x10'),_0x209ff1,_0xc3f3('0x11'),JSON[_0xc3f3('0x12')](_0x4cc2f5));if(_0x4cc2f5[_0xc3f3('0x13')]){if(_0x4cc2f5[_0xc3f3('0x13')][_0xc3f3('0x14')]===0x1f4){logger[_0xc3f3('0x13')](_0xc3f3('0x15'),_0x209ff1,_0x4cc2f5[_0xc3f3('0x13')][_0xc3f3('0x16')]);return _0x49aa0d(_0x4cc2f5['error'][_0xc3f3('0x16')]);}logger[_0xc3f3('0x13')](_0xc3f3('0x15'),_0x209ff1,_0x4cc2f5['error'][_0xc3f3('0x16')]);return _0x5a5693(_0x4cc2f5[_0xc3f3('0x13')]['message']);}else{logger['info'](_0xc3f3('0x15'),_0x209ff1,_0xc3f3('0x11'));_0x5a5693(_0x4cc2f5['result'][_0xc3f3('0x16')]);}})[_0xc3f3('0x17')](function(_0x2ad02f){logger['error'](_0xc3f3('0x15'),_0x209ff1,_0x2ad02f);_0x49aa0d(_0x2ad02f);});});}exports[_0xc3f3('0x18')]=function(_0x300bd9){var _0x2e23c2=this;return new Promise(function(_0x5f1d86,_0xa95d30){return db[_0xc3f3('0x19')][_0xc3f3('0x1a')](_0x300bd9[_0xc3f3('0x1b')],{'raw':_0x300bd9[_0xc3f3('0x1c')]?_0x300bd9[_0xc3f3('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc3f3('0xe')](function(_0x372a23){logger[_0xc3f3('0xf')](_0xc3f3('0x18'),_0x300bd9);logger[_0xc3f3('0x1d')](_0xc3f3('0x18'),_0x300bd9,JSON[_0xc3f3('0x12')](_0x372a23));_0x5f1d86(_0x372a23);})[_0xc3f3('0x17')](function(_0x3949bf){logger[_0xc3f3('0x13')](_0xc3f3('0x18'),_0x3949bf[_0xc3f3('0x16')],_0x300bd9);_0xa95d30(_0x2e23c2[_0xc3f3('0x13')](0x1f4,_0x3949bf[_0xc3f3('0x16')]));});});};exports[_0xc3f3('0x1e')]=function(_0x291a64){var _0x44c4e0=this;return new Promise(function(_0x429018,_0x130bf5){return db[_0xc3f3('0x19')][_0xc3f3('0x1f')](_0x291a64[_0xc3f3('0x1b')],{'raw':_0x291a64[_0xc3f3('0x1c')]?_0x291a64[_0xc3f3('0x1c')][_0xc3f3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291a64[_0xc3f3('0x1c')]?_0x291a64[_0xc3f3('0x1c')]['where']||null:null,'attributes':_0x291a64[_0xc3f3('0x1c')]?_0x291a64[_0xc3f3('0x1c')][_0xc3f3('0x21')]||null:null,'limit':_0x291a64[_0xc3f3('0x1c')]?_0x291a64['options']['limit']||null:null})[_0xc3f3('0xe')](function(_0x102287){logger['info'](_0xc3f3('0x1e'),_0x291a64);logger[_0xc3f3('0x1d')](_0xc3f3('0x1e'),_0x291a64,JSON[_0xc3f3('0x12')](_0x102287));_0x429018(_0x102287);})[_0xc3f3('0x17')](function(_0x318a25){logger['error'](_0xc3f3('0x1e'),_0x318a25[_0xc3f3('0x16')],_0x291a64);_0x130bf5(_0x44c4e0[_0xc3f3('0x13')](0x1f4,_0x318a25[_0xc3f3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 714c904..01cd4ff 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 _0x558e=['create','put','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x558e,0x193));var _0xe558=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x558e[_0x1bbc08];return _0x5d825b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe558('0x0'));var timeout=require(_0xe558('0x1'));var express=require(_0xe558('0x2'));var router=express[_0xe558('0x3')]();var fs_extra=require(_0xe558('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe558('0x5'));var config=require(_0xe558('0x6'));var controller=require(_0xe558('0x7'));router[_0xe558('0x8')]('/',auth[_0xe558('0x9')](),controller[_0xe558('0xa')]);router[_0xe558('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe558('0xb')]);router[_0xe558('0x8')](_0xe558('0xc'),auth[_0xe558('0x9')](),controller[_0xe558('0xd')]);router[_0xe558('0xe')]('/',auth[_0xe558('0x9')](),controller[_0xe558('0xf')]);router[_0xe558('0x10')](_0xe558('0xc'),auth[_0xe558('0x9')](),controller['update']);router[_0xe558('0x11')]('/:id',auth[_0xe558('0x9')](),controller[_0xe558('0x12')]);module['exports']=router; \ No newline at end of file +var _0x27d2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x6f8972,_0x343da7){var _0x5677d9=function(_0x5eb51f){while(--_0x5eb51f){_0x6f8972['push'](_0x6f8972['shift']());}};_0x5677d9(++_0x343da7);}(_0x27d2,0xaf));var _0x227d=function(_0x3a9dd0,_0x137314){_0x3a9dd0=_0x3a9dd0-0x0;var _0x376138=_0x27d2[_0x3a9dd0];return _0x376138;};'use strict';var multer=require(_0x227d('0x0'));var util=require(_0x227d('0x1'));var path=require(_0x227d('0x2'));var timeout=require(_0x227d('0x3'));var express=require('express');var router=express[_0x227d('0x4')]();var fs_extra=require(_0x227d('0x5'));var auth=require(_0x227d('0x6'));var interaction=require(_0x227d('0x7'));var config=require(_0x227d('0x8'));var controller=require(_0x227d('0x9'));router[_0x227d('0xa')]('/',auth[_0x227d('0xb')](),controller[_0x227d('0xc')]);router[_0x227d('0xa')](_0x227d('0xd'),auth[_0x227d('0xb')](),controller[_0x227d('0xe')]);router['get'](_0x227d('0xf'),auth[_0x227d('0xb')](),controller[_0x227d('0x10')]);router['post']('/',auth[_0x227d('0xb')](),controller[_0x227d('0x11')]);router['put']('/:id',auth[_0x227d('0xb')](),controller['update']);router[_0x227d('0x12')](_0x227d('0xf'),auth[_0x227d('0xb')](),controller[_0x227d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 37002b5..e059b26 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 _0x9b10=['exports','STRING','TEXT','sequelize'];(function(_0x2db3a5,_0xa63093){var _0x537340=function(_0x155108){while(--_0x155108){_0x2db3a5['push'](_0x2db3a5['shift']());}};_0x537340(++_0xa63093);}(_0x9b10,0x137));var _0x09b1=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x9b10[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x09b1('0x0'));module[_0x09b1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x09b1('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x09b1('0x3')]},'project_name':{'type':Sequelize[_0x09b1('0x2')]},'callerid':{'type':Sequelize[_0x09b1('0x2')]}}; \ No newline at end of file +var _0x77f4=['TEXT','sequelize','exports','STRING'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0x77f4,0x1a1));var _0x477f=function(_0x181c90,_0x911110){_0x181c90=_0x181c90-0x0;var _0x3e399f=_0x77f4[_0x181c90];return _0x3e399f;};'use strict';var Sequelize=require(_0x477f('0x0'));module[_0x477f('0x1')]={'uniqueid':{'type':Sequelize[_0x477f('0x2')]},'node':{'type':Sequelize[_0x477f('0x2')]},'application':{'type':Sequelize[_0x477f('0x2')]},'data':{'type':Sequelize[_0x477f('0x3')]},'project_name':{'type':Sequelize[_0x477f('0x2')]},'callerid':{'type':Sequelize[_0x477f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 00c7e71..99dfa61 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 _0x7912=['rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','describe'];(function(_0x3c99e8,_0x56fedb){var _0x2edee5=function(_0x417d88){while(--_0x417d88){_0x3c99e8['push'](_0x3c99e8['shift']());}};_0x2edee5(++_0x56fedb);}(_0x7912,0x9a));var _0x2791=function(_0x34664d,_0x5a9943){_0x34664d=_0x34664d-0x0;var _0x2865cf=_0x7912[_0x34664d];return _0x2865cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2791('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2791('0x1'));var rp=require(_0x2791('0x2'));var moment=require(_0x2791('0x3'));var BPromise=require(_0x2791('0x4'));var Mustache=require('mustache');var util=require(_0x2791('0x5'));var path=require(_0x2791('0x6'));var sox=require(_0x2791('0x7'));var csv=require('to-csv');var ejs=require(_0x2791('0x8'));var fs=require('fs');var fs_extra=require(_0x2791('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2791('0xa'));var toCsv=require(_0x2791('0xb'));var querystring=require(_0x2791('0xc'));var Papa=require(_0x2791('0xd'));var Redis=require(_0x2791('0xe'));var authService=require(_0x2791('0xf'));var qs=require(_0x2791('0x10'));var as=require(_0x2791('0x11'));var hardwareService=require(_0x2791('0x12'));var logger=require(_0x2791('0x13'))(_0x2791('0x14'));var utils=require(_0x2791('0x15'));var config=require(_0x2791('0x16'));var licenseUtil=require(_0x2791('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e605,_0x51d550){_0x51d550=_0x51d550||0xcc;return function(_0x507926){if(_0x507926){return _0x43e605['sendStatus'](_0x51d550);}return _0x43e605[_0x2791('0x18')](_0x51d550)[_0x2791('0x19')]();};}function respondWithResult(_0x55e2d6,_0x26dbe0){_0x26dbe0=_0x26dbe0||0xc8;return function(_0x9544da){if(_0x9544da){return _0x55e2d6[_0x2791('0x18')](_0x26dbe0)[_0x2791('0x1a')](_0x9544da);}};}function respondWithFilteredResult(_0x1c1d43,_0x10bc3e){return function(_0x447d80){if(_0x447d80){var _0x48ed0b=typeof _0x10bc3e['offset']==='undefined'&&typeof _0x10bc3e[_0x2791('0x1b')]===_0x2791('0x1c');var _0x3252b8=_0x447d80[_0x2791('0x1d')];var _0x3360aa=_0x48ed0b?0x0:_0x10bc3e[_0x2791('0x1e')];var _0x504a80=_0x48ed0b?_0x447d80[_0x2791('0x1d')]:_0x10bc3e['offset']+_0x10bc3e[_0x2791('0x1b')];var _0x7b0014;if(_0x504a80>=_0x3252b8){_0x504a80=_0x3252b8;_0x7b0014=0xc8;}else{_0x7b0014=0xce;}_0x1c1d43['status'](_0x7b0014);return _0x1c1d43[_0x2791('0x1f')](_0x2791('0x20'),_0x3360aa+'-'+_0x504a80+'/'+_0x3252b8)['json'](_0x447d80);}return null;};}function patchUpdates(_0x4612f3){return function(_0x184ebc){try{jsonpatch[_0x2791('0x21')](_0x184ebc,_0x4612f3,!![]);}catch(_0x1f1497){return BPromise[_0x2791('0x22')](_0x1f1497);}return _0x184ebc[_0x2791('0x23')]();};}function saveUpdates(_0x40ddce,_0xf6fc1a){return function(_0x4f47a2){if(_0x4f47a2){return _0x4f47a2[_0x2791('0x24')](_0x40ddce)[_0x2791('0x25')](function(_0x1596be){return _0x1596be;});}return null;};}function removeEntity(_0x1f82c0,_0x879d4c){return function(_0x2fea67){if(_0x2fea67){return _0x2fea67[_0x2791('0x26')]()[_0x2791('0x25')](function(){_0x1f82c0[_0x2791('0x18')](0xcc)[_0x2791('0x19')]();});}};}function handleEntityNotFound(_0x1956cf,_0x21045e){return function(_0x2691c2){if(!_0x2691c2){_0x1956cf['sendStatus'](0x194);}return _0x2691c2;};}function handleError(_0x392f29,_0x28816d){_0x28816d=_0x28816d||0x1f4;return function(_0xa27b84){logger[_0x2791('0x27')](_0xa27b84[_0x2791('0x28')]);if(_0xa27b84[_0x2791('0x29')]){delete _0xa27b84[_0x2791('0x29')];}_0x392f29[_0x2791('0x18')](_0x28816d)['send'](_0xa27b84);};}exports[_0x2791('0x2a')]=function(_0x44403b,_0x39e7f4){var _0x1d062a={},_0x4b9f94={},_0x2ec58d={'count':0x0,'rows':[]};var _0x128ee7=_[_0x2791('0x2b')](db[_0x2791('0x2c')][_0x2791('0x2d')],function(_0x5bfec0){return{'name':_0x5bfec0[_0x2791('0x2e')],'type':_0x5bfec0[_0x2791('0x2f')][_0x2791('0x30')]};});_0x4b9f94[_0x2791('0x31')]=_[_0x2791('0x2b')](_0x128ee7,_0x2791('0x29'));_0x4b9f94['query']=_[_0x2791('0x32')](_0x44403b[_0x2791('0x33')]);_0x4b9f94[_0x2791('0x34')]=_['intersection'](_0x4b9f94['model'],_0x4b9f94[_0x2791('0x33')]);_0x1d062a['attributes']=_[_0x2791('0x35')](_0x4b9f94[_0x2791('0x31')],qs['fields'](_0x44403b[_0x2791('0x33')]['fields']));_0x1d062a[_0x2791('0x36')]=_0x1d062a[_0x2791('0x36')][_0x2791('0x37')]?_0x1d062a[_0x2791('0x36')]:_0x4b9f94[_0x2791('0x31')];if(!_0x44403b['query'][_0x2791('0x38')](_0x2791('0x39'))){_0x1d062a['limit']=qs[_0x2791('0x1b')](_0x44403b[_0x2791('0x33')]['limit']);_0x1d062a[_0x2791('0x1e')]=qs['offset'](_0x44403b['query']['offset']);}_0x1d062a[_0x2791('0x3a')]=qs[_0x2791('0x3b')](_0x44403b['query'][_0x2791('0x3b')]);_0x1d062a['where']=qs[_0x2791('0x34')](_[_0x2791('0x3c')](_0x44403b['query'],_0x4b9f94[_0x2791('0x34')]),_0x128ee7);if(_0x44403b[_0x2791('0x33')][_0x2791('0x3d')]){_0x1d062a[_0x2791('0x3e')]=_['merge'](_0x1d062a[_0x2791('0x3e')],{'$or':_[_0x2791('0x2b')](_0x128ee7,function(_0x995b9e){if(_0x995b9e[_0x2791('0x2f')]!==_0x2791('0x3f')){var _0x265d54={};_0x265d54[_0x995b9e[_0x2791('0x29')]]={'$like':'%'+_0x44403b[_0x2791('0x33')][_0x2791('0x3d')]+'%'};return _0x265d54;}})});}_0x1d062a=_[_0x2791('0x40')]({},_0x1d062a,_0x44403b['options']);var _0x387a0d={'where':_0x1d062a[_0x2791('0x3e')]};return db[_0x2791('0x2c')]['count'](_0x387a0d)[_0x2791('0x25')](function(_0x4f674c){_0x2ec58d[_0x2791('0x1d')]=_0x4f674c;if(_0x44403b[_0x2791('0x33')][_0x2791('0x41')]){_0x1d062a[_0x2791('0x42')]=[{'all':!![]}];}return db[_0x2791('0x2c')][_0x2791('0x43')](_0x1d062a);})['then'](function(_0x3975b8){_0x2ec58d['rows']=_0x3975b8;return _0x2ec58d;})['then'](respondWithFilteredResult(_0x39e7f4,_0x1d062a))[_0x2791('0x44')](handleError(_0x39e7f4,null));};exports[_0x2791('0x45')]=function(_0x505f98,_0x32551f){var _0x406dd1={'raw':!![],'where':{'id':_0x505f98[_0x2791('0x46')]['id']}},_0x5ae070={};_0x5ae070['model']=_[_0x2791('0x32')](db[_0x2791('0x2c')][_0x2791('0x2d')]);_0x5ae070[_0x2791('0x33')]=_[_0x2791('0x32')](_0x505f98[_0x2791('0x33')]);_0x5ae070[_0x2791('0x34')]=_['intersection'](_0x5ae070[_0x2791('0x31')],_0x5ae070[_0x2791('0x33')]);_0x406dd1['attributes']=_[_0x2791('0x35')](_0x5ae070[_0x2791('0x31')],qs['fields'](_0x505f98[_0x2791('0x33')][_0x2791('0x47')]));_0x406dd1[_0x2791('0x36')]=_0x406dd1[_0x2791('0x36')][_0x2791('0x37')]?_0x406dd1[_0x2791('0x36')]:_0x5ae070[_0x2791('0x31')];if(_0x505f98[_0x2791('0x33')][_0x2791('0x41')]){_0x406dd1[_0x2791('0x42')]=[{'all':!![]}];}_0x406dd1=_['merge']({},_0x406dd1,_0x505f98[_0x2791('0x48')]);return db[_0x2791('0x2c')][_0x2791('0x49')](_0x406dd1)[_0x2791('0x25')](handleEntityNotFound(_0x32551f,null))[_0x2791('0x25')](respondWithResult(_0x32551f,null))[_0x2791('0x44')](handleError(_0x32551f,null));};exports[_0x2791('0x4a')]=function(_0x47273a,_0x298045){return db[_0x2791('0x2c')][_0x2791('0x4a')](_0x47273a[_0x2791('0x4b')],{})[_0x2791('0x25')](respondWithResult(_0x298045,0xc9))['catch'](handleError(_0x298045,null));};exports[_0x2791('0x24')]=function(_0x18b618,_0x1b2545){if(_0x18b618[_0x2791('0x4b')]['id']){delete _0x18b618[_0x2791('0x4b')]['id'];}return db[_0x2791('0x2c')][_0x2791('0x49')]({'where':{'id':_0x18b618['params']['id']}})['then'](handleEntityNotFound(_0x1b2545,null))[_0x2791('0x25')](saveUpdates(_0x18b618[_0x2791('0x4b')],null))[_0x2791('0x25')](respondWithResult(_0x1b2545,null))['catch'](handleError(_0x1b2545,null));};exports['destroy']=function(_0x51fa74,_0x45f976){return db[_0x2791('0x2c')][_0x2791('0x49')]({'where':{'id':_0x51fa74[_0x2791('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f976,null))[_0x2791('0x25')](removeEntity(_0x45f976,null))[_0x2791('0x44')](handleError(_0x45f976,null));};exports[_0x2791('0x4c')]=function(_0xfbc7e5,_0x1d5468){return db[_0x2791('0x2c')]['describe']()[_0x2791('0x25')](respondWithResult(_0x1d5468,null))[_0x2791('0x44')](handleError(_0x1d5468,null));}; \ No newline at end of file +var _0x0611=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','name','send','index','map','SquareDetailsReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','describe','eml-format','zip-dir','moment'];(function(_0x3881b1,_0x394148){var _0x54ac67=function(_0x479c17){while(--_0x479c17){_0x3881b1['push'](_0x3881b1['shift']());}};_0x54ac67(++_0x394148);}(_0x0611,0x1b3));var _0x1061=function(_0x25fe51,_0x32f2e9){_0x25fe51=_0x25fe51-0x0;var _0xa6e866=_0x0611[_0x25fe51];return _0xa6e866;};'use strict';var emlformat=require(_0x1061('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1061('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1061('0x2'));var BPromise=require(_0x1061('0x3'));var Mustache=require('mustache');var util=require(_0x1061('0x4'));var path=require(_0x1061('0x5'));var sox=require(_0x1061('0x6'));var csv=require(_0x1061('0x7'));var ejs=require(_0x1061('0x8'));var fs=require('fs');var fs_extra=require(_0x1061('0x9'));var _=require(_0x1061('0xa'));var squel=require(_0x1061('0xb'));var crypto=require(_0x1061('0xc'));var jsforce=require(_0x1061('0xd'));var deskjs=require(_0x1061('0xe'));var toCsv=require(_0x1061('0x7'));var querystring=require(_0x1061('0xf'));var Papa=require(_0x1061('0x10'));var Redis=require(_0x1061('0x11'));var authService=require(_0x1061('0x12'));var qs=require(_0x1061('0x13'));var as=require(_0x1061('0x14'));var hardwareService=require(_0x1061('0x15'));var logger=require(_0x1061('0x16'))(_0x1061('0x17'));var utils=require(_0x1061('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1061('0x19'))['db'];function respondWithStatusCode(_0x52d01f,_0x74bef0){_0x74bef0=_0x74bef0||0xcc;return function(_0xaa9a84){if(_0xaa9a84){return _0x52d01f[_0x1061('0x1a')](_0x74bef0);}return _0x52d01f['status'](_0x74bef0)[_0x1061('0x1b')]();};}function respondWithResult(_0x12da1d,_0x25865e){_0x25865e=_0x25865e||0xc8;return function(_0x226198){if(_0x226198){return _0x12da1d[_0x1061('0x1c')](_0x25865e)['json'](_0x226198);}};}function respondWithFilteredResult(_0x2acc1b,_0x19935a){return function(_0x7788ca){if(_0x7788ca){var _0x504496=typeof _0x19935a[_0x1061('0x1d')]===_0x1061('0x1e')&&typeof _0x19935a[_0x1061('0x1f')]===_0x1061('0x1e');var _0x22cdaf=_0x7788ca[_0x1061('0x20')];var _0x156b51=_0x504496?0x0:_0x19935a[_0x1061('0x1d')];var _0x5dc262=_0x504496?_0x7788ca['count']:_0x19935a['offset']+_0x19935a[_0x1061('0x1f')];var _0x465761;if(_0x5dc262>=_0x22cdaf){_0x5dc262=_0x22cdaf;_0x465761=0xc8;}else{_0x465761=0xce;}_0x2acc1b[_0x1061('0x1c')](_0x465761);return _0x2acc1b[_0x1061('0x21')]('Content-Range',_0x156b51+'-'+_0x5dc262+'/'+_0x22cdaf)[_0x1061('0x22')](_0x7788ca);}return null;};}function patchUpdates(_0x5bc76b){return function(_0x3561b1){try{jsonpatch[_0x1061('0x23')](_0x3561b1,_0x5bc76b,!![]);}catch(_0xc928b8){return BPromise[_0x1061('0x24')](_0xc928b8);}return _0x3561b1[_0x1061('0x25')]();};}function saveUpdates(_0x3af09b,_0x3bcd7a){return function(_0x11df75){if(_0x11df75){return _0x11df75[_0x1061('0x26')](_0x3af09b)['then'](function(_0x2660bd){return _0x2660bd;});}return null;};}function removeEntity(_0x545093,_0x4c1f99){return function(_0x506d9b){if(_0x506d9b){return _0x506d9b[_0x1061('0x27')]()[_0x1061('0x28')](function(){_0x545093['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x329a26,_0x3be660){return function(_0x12294d){if(!_0x12294d){_0x329a26[_0x1061('0x1a')](0x194);}return _0x12294d;};}function handleError(_0x49cd2a,_0x1bab38){_0x1bab38=_0x1bab38||0x1f4;return function(_0x3094b6){logger['error'](_0x3094b6['stack']);if(_0x3094b6[_0x1061('0x29')]){delete _0x3094b6[_0x1061('0x29')];}_0x49cd2a['status'](_0x1bab38)[_0x1061('0x2a')](_0x3094b6);};}exports[_0x1061('0x2b')]=function(_0x15b2c5,_0x23b77e){var _0x1f0011={},_0x156e1e={},_0x1fe4bc={'count':0x0,'rows':[]};var _0x5c45b5=_[_0x1061('0x2c')](db[_0x1061('0x2d')]['rawAttributes'],function(_0x42c90c){return{'name':_0x42c90c['fieldName'],'type':_0x42c90c[_0x1061('0x2e')][_0x1061('0x2f')]};});_0x156e1e[_0x1061('0x30')]=_[_0x1061('0x2c')](_0x5c45b5,'name');_0x156e1e[_0x1061('0x31')]=_['keys'](_0x15b2c5[_0x1061('0x31')]);_0x156e1e[_0x1061('0x32')]=_[_0x1061('0x33')](_0x156e1e['model'],_0x156e1e['query']);_0x1f0011[_0x1061('0x34')]=_['intersection'](_0x156e1e[_0x1061('0x30')],qs[_0x1061('0x35')](_0x15b2c5[_0x1061('0x31')]['fields']));_0x1f0011[_0x1061('0x34')]=_0x1f0011[_0x1061('0x34')][_0x1061('0x36')]?_0x1f0011[_0x1061('0x34')]:_0x156e1e[_0x1061('0x30')];if(!_0x15b2c5[_0x1061('0x31')][_0x1061('0x37')](_0x1061('0x38'))){_0x1f0011[_0x1061('0x1f')]=qs[_0x1061('0x1f')](_0x15b2c5[_0x1061('0x31')][_0x1061('0x1f')]);_0x1f0011['offset']=qs[_0x1061('0x1d')](_0x15b2c5[_0x1061('0x31')][_0x1061('0x1d')]);}_0x1f0011['order']=qs[_0x1061('0x39')](_0x15b2c5[_0x1061('0x31')][_0x1061('0x39')]);_0x1f0011['where']=qs['filters'](_['pick'](_0x15b2c5[_0x1061('0x31')],_0x156e1e[_0x1061('0x32')]),_0x5c45b5);if(_0x15b2c5[_0x1061('0x31')]['filter']){_0x1f0011[_0x1061('0x3a')]=_[_0x1061('0x3b')](_0x1f0011[_0x1061('0x3a')],{'$or':_['map'](_0x5c45b5,function(_0x3c1d24){if(_0x3c1d24[_0x1061('0x2e')]!==_0x1061('0x3c')){var _0xaf38cb={};_0xaf38cb[_0x3c1d24[_0x1061('0x29')]]={'$like':'%'+_0x15b2c5[_0x1061('0x31')]['filter']+'%'};return _0xaf38cb;}})});}_0x1f0011=_[_0x1061('0x3b')]({},_0x1f0011,_0x15b2c5[_0x1061('0x3d')]);var _0x140a0e={'where':_0x1f0011[_0x1061('0x3a')]};return db[_0x1061('0x2d')][_0x1061('0x20')](_0x140a0e)[_0x1061('0x28')](function(_0xd4002e){_0x1fe4bc[_0x1061('0x20')]=_0xd4002e;if(_0x15b2c5[_0x1061('0x31')][_0x1061('0x3e')]){_0x1f0011[_0x1061('0x3f')]=[{'all':!![]}];}return db[_0x1061('0x2d')]['findAll'](_0x1f0011);})['then'](function(_0x5773ab){_0x1fe4bc[_0x1061('0x40')]=_0x5773ab;return _0x1fe4bc;})[_0x1061('0x28')](respondWithFilteredResult(_0x23b77e,_0x1f0011))[_0x1061('0x41')](handleError(_0x23b77e,null));};exports['show']=function(_0x2e6c33,_0x4f0d1c){var _0x2286ad={'raw':!![],'where':{'id':_0x2e6c33[_0x1061('0x42')]['id']}},_0x224b8d={};_0x224b8d['model']=_[_0x1061('0x43')](db['SquareDetailsReport'][_0x1061('0x44')]);_0x224b8d[_0x1061('0x31')]=_[_0x1061('0x43')](_0x2e6c33[_0x1061('0x31')]);_0x224b8d[_0x1061('0x32')]=_[_0x1061('0x33')](_0x224b8d[_0x1061('0x30')],_0x224b8d[_0x1061('0x31')]);_0x2286ad[_0x1061('0x34')]=_[_0x1061('0x33')](_0x224b8d['model'],qs[_0x1061('0x35')](_0x2e6c33[_0x1061('0x31')][_0x1061('0x35')]));_0x2286ad[_0x1061('0x34')]=_0x2286ad[_0x1061('0x34')][_0x1061('0x36')]?_0x2286ad[_0x1061('0x34')]:_0x224b8d[_0x1061('0x30')];if(_0x2e6c33[_0x1061('0x31')][_0x1061('0x3e')]){_0x2286ad[_0x1061('0x3f')]=[{'all':!![]}];}_0x2286ad=_[_0x1061('0x3b')]({},_0x2286ad,_0x2e6c33['options']);return db[_0x1061('0x2d')][_0x1061('0x45')](_0x2286ad)[_0x1061('0x28')](handleEntityNotFound(_0x4f0d1c,null))['then'](respondWithResult(_0x4f0d1c,null))['catch'](handleError(_0x4f0d1c,null));};exports[_0x1061('0x46')]=function(_0x202a8c,_0x4b8837){return db[_0x1061('0x2d')][_0x1061('0x46')](_0x202a8c[_0x1061('0x47')],{})[_0x1061('0x28')](respondWithResult(_0x4b8837,0xc9))[_0x1061('0x41')](handleError(_0x4b8837,null));};exports[_0x1061('0x26')]=function(_0x164a0,_0x38e2d1){if(_0x164a0[_0x1061('0x47')]['id']){delete _0x164a0[_0x1061('0x47')]['id'];}return db[_0x1061('0x2d')]['find']({'where':{'id':_0x164a0[_0x1061('0x42')]['id']}})[_0x1061('0x28')](handleEntityNotFound(_0x38e2d1,null))[_0x1061('0x28')](saveUpdates(_0x164a0[_0x1061('0x47')],null))[_0x1061('0x28')](respondWithResult(_0x38e2d1,null))['catch'](handleError(_0x38e2d1,null));};exports['destroy']=function(_0x514b60,_0xe2cdcd){return db['SquareDetailsReport'][_0x1061('0x45')]({'where':{'id':_0x514b60[_0x1061('0x42')]['id']}})[_0x1061('0x28')](handleEntityNotFound(_0xe2cdcd,null))[_0x1061('0x28')](removeEntity(_0xe2cdcd,null))[_0x1061('0x41')](handleError(_0xe2cdcd,null));};exports['describe']=function(_0x5ec724,_0x5c299a){return db[_0x1061('0x2d')][_0x1061('0x48')]()[_0x1061('0x28')](respondWithResult(_0x5c299a,null))['catch'](handleError(_0x5c299a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d8abfb0..c22136f 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 _0x51f3=['../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','SquareDetailsReport','lodash','util'];(function(_0x345fc5,_0x5a577c){var _0x1ce605=function(_0x1e75a7){while(--_0x1e75a7){_0x345fc5['push'](_0x345fc5['shift']());}};_0x1ce605(++_0x5a577c);}(_0x51f3,0x152));var _0x351f=function(_0x37d438,_0x3bfbbc){_0x37d438=_0x37d438-0x0;var _0x5cd81f=_0x51f3[_0x37d438];return _0x5cd81f;};'use strict';var _=require(_0x351f('0x0'));var util=require(_0x351f('0x1'));var logger=require(_0x351f('0x2'))(_0x351f('0x3'));var moment=require('moment');var BPromise=require(_0x351f('0x4'));var rp=require(_0x351f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x351f('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x351f('0x7')]=function(_0x4f114f,_0x3d3f6f){return _0x4f114f[_0x351f('0x8')](_0x351f('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09e0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','SquareDetailsReport','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09e0,0xbc));var _0x009e=function(_0xa35666,_0x19fb8a){_0xa35666=_0xa35666-0x0;var _0x4b2d2f=_0x09e0[_0xa35666];return _0x4b2d2f;};'use strict';var _=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var logger=require(_0x009e('0x2'))(_0x009e('0x3'));var moment=require(_0x009e('0x4'));var BPromise=require(_0x009e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x009e('0x6'));var rimraf=require(_0x009e('0x7'));var config=require(_0x009e('0x8'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x4eaeee,_0x44b243){return _0x4eaeee['define'](_0x009e('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 526e9ce..6d3d6f4 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 _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify','catch','lodash','util','bluebird'];(function(_0x57b316,_0x2c79d5){var _0x344987=function(_0x2fad5f){while(--_0x2fad5f){_0x57b316['push'](_0x57b316['shift']());}};_0x344987(++_0x2c79d5);}(_0x0b7f,0x115));var _0xf0b7=function(_0x129b6b,_0x4faf08){_0x129b6b=_0x129b6b-0x0;var _0x24d8df=_0x0b7f[_0x129b6b];return _0x24d8df;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateSquareDetailsReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});}; \ No newline at end of file +var _0x056b=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x374b8a,_0x556e28){var _0x393341=function(_0x4bbbc1){while(--_0x4bbbc1){_0x374b8a['push'](_0x374b8a['shift']());}};_0x393341(++_0x556e28);}(_0x056b,0xb6));var _0xb056=function(_0x44e5f6,_0x1cdb43){_0x44e5f6=_0x44e5f6-0x0;var _0x350e0e=_0x056b[_0x44e5f6];return _0x350e0e;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});}exports[_0xb056('0x16')]=function(_0x311eb9){var _0x48e140=this;return new Promise(function(_0x29c77e,_0x4c57e6){return db[_0xb056('0x17')][_0xb056('0x18')](_0x311eb9['body'],{'raw':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1a')]===undefined?!![]:![]:!![]})[_0xb056('0x1b')](function(_0x457b54){logger[_0xb056('0xc')]('CreateSquareDetailsReport',_0x311eb9);logger[_0xb056('0x1c')]('CreateSquareDetailsReport',_0x311eb9,JSON[_0xb056('0x10')](_0x457b54));_0x29c77e(_0x457b54);})['catch'](function(_0x324ce6){logger[_0xb056('0x11')](_0xb056('0x16'),_0x324ce6[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x324ce6[_0xb056('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 4ae723e..1072216 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 _0xb658=['get','index','isAuthenticated','express','../../components/auth/service'];(function(_0x581332,_0x588a7b){var _0xfa58b4=function(_0x1c58a6){while(--_0x1c58a6){_0x581332['push'](_0x581332['shift']());}};_0xfa58b4(++_0x588a7b);}(_0xb658,0x166));var _0x8b65=function(_0x2b0c7f,_0x311567){_0x2b0c7f=_0x2b0c7f-0x0;var _0x548837=_0xb658[_0x2b0c7f];return _0x548837;};'use strict';var express=require(_0x8b65('0x0'));var router=express['Router']();var auth=require(_0x8b65('0x1'));var controller=require('./system.controller');router[_0x8b65('0x2')]('/',auth['isAuthenticated'](),controller[_0x8b65('0x3')]);router[_0x8b65('0x2')]('/process/:pid/kill',auth[_0x8b65('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x90cf=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x3586ed,_0x505842){var _0x123785=function(_0x2953f0){while(--_0x2953f0){_0x3586ed['push'](_0x3586ed['shift']());}};_0x123785(++_0x505842);}(_0x90cf,0x1ca));var _0xf90c=function(_0x5a1fcf,_0x14f8e5){_0x5a1fcf=_0x5a1fcf-0x0;var _0x17a8cf=_0x90cf[_0x5a1fcf];return _0x17a8cf;};'use strict';var express=require(_0xf90c('0x0'));var router=express['Router']();var auth=require(_0xf90c('0x1'));var controller=require(_0xf90c('0x2'));router[_0xf90c('0x3')]('/',auth[_0xf90c('0x4')](),controller[_0xf90c('0x5')]);router['get'](_0xf90c('0x6'),auth[_0xf90c('0x4')](),controller[_0xf90c('0x7')]);module[_0xf90c('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 f10594e..4f46025 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 _0x698a=['api','util','error','inspect','name','status','send','getAllData','then','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger'];(function(_0x401ad6,_0x392d17){var _0x159ef3=function(_0x33151c){while(--_0x33151c){_0x401ad6['push'](_0x401ad6['shift']());}};_0x159ef3(++_0x392d17);}(_0x698a,0x10a));var _0xa698=function(_0x1f2d5e,_0x3957e0){_0x1f2d5e=_0x1f2d5e-0x0;var _0x19207f=_0x698a[_0x1f2d5e];return _0x19207f;};'use strict';var info=require(_0xa698('0x0'));var exec=require(_0xa698('0x1'))[_0xa698('0x2')];var logger=require(_0xa698('0x3'))(_0xa698('0x4'));var util=require(_0xa698('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x29c2b8,_0x33c713,_0x5d3816){_0x33c713=_0x33c713||0x1f4;return function(_0x2923b5){logger[_0xa698('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5d3816,_0x33c713,util[_0xa698('0x7')](_0x2923b5,{'showHidden':![],'depth':null}));delete _0x2923b5[_0xa698('0x8')];_0x29c2b8[_0xa698('0x9')](_0x33c713)[_0xa698('0xa')](_0x2923b5);};}exports['index']=function(_0x2bd8b0,_0x39937b){return info[_0xa698('0xb')]()[_0xa698('0xc')](function(_0x7689a9){return _0x39937b[_0xa698('0x9')](0xc8)['json'](_0x7689a9);})[_0xa698('0xd')](function(_0x4e3182){return _0x39937b[_0xa698('0x9')](0x1f4)[_0xa698('0xe')](_0x4e3182);});};exports[_0xa698('0xf')]=function(_0x24bb52,_0x2a459a){var _0x35ccb5=[_0xa698('0x10')];return new BPromise(function(_0x40889e,_0x4991d8){return exec(util['format'](_0xa698('0x11'),_0x24bb52[_0xa698('0x12')][_0xa698('0x13')]),function(_0x3b5473,_0x11b44b,_0x1ed66f){if(_0x3b5473){return _0x4991d8(_0x3b5473);}return _0x40889e(_0x11b44b);});})['then'](function(_0x3ed690){var _0x9097c9=![];var _0x2e79d2=_0x3ed690[_0xa698('0x14')](/\n/);for(var _0x100412=0x0,_0x258262=_0x35ccb5['length'];_0x100412<_0x258262,_0x9097c9===![];_0x100412+=0x1){if(_0x3ed690[_0xa698('0x15')](_0x35ccb5[_0x100412])>=0x0){_0x9097c9=!![];}}if(!_0x9097c9){throw new Error(util[_0xa698('0x16')](_0xa698('0x17'),_0x24bb52[_0xa698('0x12')][_0xa698('0x13')]));}process[_0xa698('0x18')](_0x24bb52[_0xa698('0x12')][_0xa698('0x13')],_0xa698('0x19'));return _0x2a459a[_0xa698('0x9')](0xc8)[_0xa698('0xe')]({'message':util[_0xa698('0x16')](_0xa698('0x1a'),_0x24bb52[_0xa698('0x12')][_0xa698('0x13')])});})[_0xa698('0xd')](handleError(_0x2a459a,null,_0xa698('0xf')));}; \ No newline at end of file +var _0xe78d=['getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','bluebird','error','inspect','name','index'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xe78d,0x117));var _0xde78=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xe78d[_0x1fcaf1];return _0x55f464;};'use strict';var info=require(_0xde78('0x0'));var exec=require('child_process')[_0xde78('0x1')];var logger=require(_0xde78('0x2'))(_0xde78('0x3'));var util=require('util');var BPromise=require(_0xde78('0x4'));var _=require('lodash');function handleError(_0x386396,_0x5ce3f7,_0x33f25a){_0x5ce3f7=_0x5ce3f7||0x1f4;return function(_0x417331){logger[_0xde78('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x33f25a,_0x5ce3f7,util[_0xde78('0x6')](_0x417331,{'showHidden':![],'depth':null}));delete _0x417331[_0xde78('0x7')];_0x386396['status'](_0x5ce3f7)['send'](_0x417331);};}exports[_0xde78('0x8')]=function(_0x41bf53,_0x27fd08){return info[_0xde78('0x9')]()[_0xde78('0xa')](function(_0x41fc3a){return _0x27fd08[_0xde78('0xb')](0xc8)[_0xde78('0xc')](_0x41fc3a);})[_0xde78('0xd')](function(_0x16e664){return _0x27fd08['status'](0x1f4)[_0xde78('0xc')](_0x16e664);});};exports[_0xde78('0xe')]=function(_0x49d431,_0x54e4f7){var _0x4765b9=[_0xde78('0xf')];return new BPromise(function(_0x14ccc1,_0x148014){return exec(util[_0xde78('0x10')](_0xde78('0x11'),_0x49d431[_0xde78('0x12')][_0xde78('0x13')]),function(_0x2a432e,_0x236f40,_0x451898){if(_0x2a432e){return _0x148014(_0x2a432e);}return _0x14ccc1(_0x236f40);});})['then'](function(_0xe37084){var _0x4735ea=![];var _0x431b07=_0xe37084['split'](/\n/);for(var _0x5cec37=0x0,_0x128a82=_0x4765b9['length'];_0x5cec37<_0x128a82,_0x4735ea===![];_0x5cec37+=0x1){if(_0xe37084[_0xde78('0x14')](_0x4765b9[_0x5cec37])>=0x0){_0x4735ea=!![];}}if(!_0x4735ea){throw new Error(util[_0xde78('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x49d431['params'][_0xde78('0x13')]));}process[_0xde78('0x15')](_0x49d431[_0xde78('0x12')][_0xde78('0x13')],_0xde78('0x16'));return _0x54e4f7[_0xde78('0xb')](0xc8)[_0xde78('0xc')]({'message':util[_0xde78('0x10')](_0xde78('0x17'),_0x49d431[_0xde78('0x12')]['pid'])});})[_0xde78('0xd')](handleError(_0x54e4f7,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 9a290c3..2e7cf5a 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 _0x34e8=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x5f4ba7,_0x18868c){var _0x122ebd=function(_0xfa9d20){while(--_0xfa9d20){_0x5f4ba7['push'](_0x5f4ba7['shift']());}};_0x122ebd(++_0x18868c);}(_0x34e8,0x12c));var _0x834e=function(_0x44eb57,_0x195081){_0x44eb57=_0x44eb57-0x0;var _0x335439=_0x34e8[_0x44eb57];return _0x335439;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0x15')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x16')]=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x49c69c,_0x2e6150){var _0x55cdd2=function(_0x12afe3){while(--_0x12afe3){_0x49c69c['push'](_0x49c69c['shift']());}};_0x55cdd2(++_0x2e6150);}(_0xa8a8,0xec));var _0x8a8a=function(_0x49ebee,_0x3395f9){_0x49ebee=_0x49ebee-0x0;var _0x151185=_0xa8a8[_0x49ebee];return _0x151185;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 52ca2f2..3ebb683 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 _0x3c81=['name','STRING','sequelize','exports'];(function(_0x2b9971,_0x4f116f){var _0x4eae53=function(_0x5820b3){while(--_0x5820b3){_0x2b9971['push'](_0x2b9971['shift']());}};_0x4eae53(++_0x4f116f);}(_0x3c81,0x102));var _0x13c8=function(_0x523fd4,_0x10ddba){_0x523fd4=_0x523fd4-0x0;var _0x132e2e=_0x3c81[_0x523fd4];return _0x132e2e;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x13c8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d5b=['#0091EA','exports','STRING','name'];(function(_0x1558ac,_0x2cb0f4){var _0x285edf=function(_0x211514){while(--_0x211514){_0x1558ac['push'](_0x1558ac['shift']());}};_0x285edf(++_0x2cb0f4);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x5eac8a,_0x1a4595){_0x5eac8a=_0x5eac8a-0x0;var _0x5c85aa=_0x9d5b[_0x5eac8a];return _0x5c85aa;};'use strict';var Sequelize=require('sequelize');module[_0xb9d5('0x0')]={'name':{'type':Sequelize[_0xb9d5('0x1')],'unique':_0xb9d5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb9d5('0x1')],'defaultValue':_0xb9d5('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b5e7736..49fe580 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 _0x59cd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','Tags','stack','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource'];(function(_0x1495bb,_0x107e01){var _0x598c2f=function(_0x14313e){while(--_0x14313e){_0x1495bb['push'](_0x1495bb['shift']());}};_0x598c2f(++_0x107e01);}(_0x59cd,0x108));var _0xd59c=function(_0x4a367f,_0x4e05f2){_0x4a367f=_0x4a367f-0x0;var _0x2bedd5=_0x59cd[_0x4a367f];return _0x2bedd5;};'use strict';var emlformat=require(_0xd59c('0x0'));var rimraf=require(_0xd59c('0x1'));var zipdir=require(_0xd59c('0x2'));var jsonpatch=require(_0xd59c('0x3'));var rp=require(_0xd59c('0x4'));var moment=require(_0xd59c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd59c('0x6'));var util=require(_0xd59c('0x7'));var path=require(_0xd59c('0x8'));var sox=require(_0xd59c('0x9'));var csv=require(_0xd59c('0xa'));var ejs=require(_0xd59c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd59c('0xc'));var squel=require(_0xd59c('0xd'));var crypto=require(_0xd59c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd59c('0xf'));var toCsv=require(_0xd59c('0xa'));var querystring=require(_0xd59c('0x10'));var Papa=require(_0xd59c('0x11'));var Redis=require(_0xd59c('0x12'));var authService=require(_0xd59c('0x13'));var qs=require(_0xd59c('0x14'));var as=require(_0xd59c('0x15'));var hardwareService=require(_0xd59c('0x16'));var logger=require(_0xd59c('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd59c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a7b9,_0x433b62){_0x433b62=_0x433b62||0xcc;return function(_0x136ba7){if(_0x136ba7){return _0x56a7b9[_0xd59c('0x19')](_0x433b62);}return _0x56a7b9[_0xd59c('0x1a')](_0x433b62)[_0xd59c('0x1b')]();};}function respondWithResult(_0x32edfd,_0x371f61){_0x371f61=_0x371f61||0xc8;return function(_0x527589){if(_0x527589){return _0x32edfd['status'](_0x371f61)[_0xd59c('0x1c')](_0x527589);}};}function respondWithFilteredResult(_0x220616,_0xdb02dd){return function(_0x24efe1){if(_0x24efe1){var _0x53962c=typeof _0xdb02dd['offset']===_0xd59c('0x1d')&&typeof _0xdb02dd['limit']==='undefined';var _0x3be561=_0x24efe1['count'];var _0x1b0ec7=_0x53962c?0x0:_0xdb02dd[_0xd59c('0x1e')];var _0xa7c4de=_0x53962c?_0x24efe1[_0xd59c('0x1f')]:_0xdb02dd[_0xd59c('0x1e')]+_0xdb02dd[_0xd59c('0x20')];var _0x44f247;if(_0xa7c4de>=_0x3be561){_0xa7c4de=_0x3be561;_0x44f247=0xc8;}else{_0x44f247=0xce;}_0x220616[_0xd59c('0x1a')](_0x44f247);return _0x220616[_0xd59c('0x21')](_0xd59c('0x22'),_0x1b0ec7+'-'+_0xa7c4de+'/'+_0x3be561)[_0xd59c('0x1c')](_0x24efe1);}return null;};}function patchUpdates(_0x5b266f){return function(_0xbffaad){try{jsonpatch[_0xd59c('0x23')](_0xbffaad,_0x5b266f,!![]);}catch(_0x43ed3a){return BPromise[_0xd59c('0x24')](_0x43ed3a);}return _0xbffaad[_0xd59c('0x25')]();};}function saveUpdates(_0x21f2c7,_0x12b850){return function(_0x2dbd5e){if(_0x2dbd5e){return _0x2dbd5e[_0xd59c('0x26')](_0x21f2c7)[_0xd59c('0x27')](function(_0x438643){return _0x438643;});}return null;};}function removeEntity(_0x3c30e7,_0x1259cb){return function(_0x3ca915){if(_0x3ca915){return _0x3ca915['destroy']()['then'](function(){var _0x56a1b7=_0x3ca915[_0xd59c('0x28')]({'plain':!![]});var _0x146ecf=_0xd59c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x146ecf,'resourceId':_0x56a1b7['id']}})[_0xd59c('0x27')](function(){return _0x3ca915;});})[_0xd59c('0x27')](function(){_0x3c30e7['status'](0xcc)[_0xd59c('0x1b')]();});}};}function handleEntityNotFound(_0x56526,_0x50dc58){return function(_0x5d7ea1){if(!_0x5d7ea1){_0x56526[_0xd59c('0x19')](0x194);}return _0x5d7ea1;};}function handleError(_0x56fcf9,_0x5e44ac){_0x5e44ac=_0x5e44ac||0x1f4;return function(_0x1e159d){logger['error'](_0x1e159d[_0xd59c('0x2a')]);if(_0x1e159d['name']){delete _0x1e159d['name'];}_0x56fcf9['status'](_0x5e44ac)[_0xd59c('0x2b')](_0x1e159d);};}exports[_0xd59c('0x2c')]=function(_0x4e2b2d,_0x18b8ff){var _0x497e33={},_0x26f579={},_0x1723d9={'count':0x0,'rows':[]};var _0x565f86=_[_0xd59c('0x2d')](db[_0xd59c('0x2e')][_0xd59c('0x2f')],function(_0x4625ef){return{'name':_0x4625ef[_0xd59c('0x30')],'type':_0x4625ef[_0xd59c('0x31')][_0xd59c('0x32')]};});_0x26f579[_0xd59c('0x33')]=_[_0xd59c('0x2d')](_0x565f86,'name');_0x26f579[_0xd59c('0x34')]=_[_0xd59c('0x35')](_0x4e2b2d[_0xd59c('0x34')]);_0x26f579['filters']=_[_0xd59c('0x36')](_0x26f579['model'],_0x26f579[_0xd59c('0x34')]);_0x497e33[_0xd59c('0x37')]=_['intersection'](_0x26f579['model'],qs['fields'](_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x38')]));_0x497e33[_0xd59c('0x37')]=_0x497e33[_0xd59c('0x37')]['length']?_0x497e33[_0xd59c('0x37')]:_0x26f579['model'];if(!_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x39')](_0xd59c('0x3a'))){_0x497e33['limit']=qs[_0xd59c('0x20')](_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x20')]);_0x497e33[_0xd59c('0x1e')]=qs[_0xd59c('0x1e')](_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x1e')]);}_0x497e33['order']=qs[_0xd59c('0x3b')](_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x3b')]);_0x497e33['where']=qs['filters'](_[_0xd59c('0x3c')](_0x4e2b2d[_0xd59c('0x34')],_0x26f579[_0xd59c('0x3d')]),_0x565f86);if(_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x3e')]){_0x497e33['where']=_[_0xd59c('0x3f')](_0x497e33[_0xd59c('0x40')],{'$or':_[_0xd59c('0x2d')](_0x565f86,function(_0x266d40){if(_0x266d40[_0xd59c('0x31')]!==_0xd59c('0x41')){var _0x557ee3={};_0x557ee3[_0x266d40[_0xd59c('0x42')]]={'$like':'%'+_0x4e2b2d[_0xd59c('0x34')]['filter']+'%'};return _0x557ee3;}})});}_0x497e33=_[_0xd59c('0x3f')]({},_0x497e33,_0x4e2b2d[_0xd59c('0x43')]);var _0x1f2be0={'where':_0x497e33['where']};return db[_0xd59c('0x2e')]['count'](_0x1f2be0)[_0xd59c('0x27')](function(_0x342f37){_0x1723d9[_0xd59c('0x1f')]=_0x342f37;if(_0x4e2b2d[_0xd59c('0x34')][_0xd59c('0x44')]){_0x497e33['include']=[{'all':!![]}];}return db['Tag'][_0xd59c('0x45')](_0x497e33);})['then'](function(_0x3b19b3){_0x1723d9[_0xd59c('0x46')]=_0x3b19b3;return _0x1723d9;})[_0xd59c('0x27')](respondWithFilteredResult(_0x18b8ff,_0x497e33))[_0xd59c('0x47')](handleError(_0x18b8ff,null));};exports[_0xd59c('0x48')]=function(_0x51f651,_0x1a2ad0){var _0x1547ad={'raw':!![],'where':{'id':_0x51f651['params']['id']}},_0x2c4931={};_0x2c4931[_0xd59c('0x33')]=_[_0xd59c('0x35')](db[_0xd59c('0x2e')]['rawAttributes']);_0x2c4931[_0xd59c('0x34')]=_['keys'](_0x51f651[_0xd59c('0x34')]);_0x2c4931[_0xd59c('0x3d')]=_[_0xd59c('0x36')](_0x2c4931[_0xd59c('0x33')],_0x2c4931[_0xd59c('0x34')]);_0x1547ad[_0xd59c('0x37')]=_[_0xd59c('0x36')](_0x2c4931[_0xd59c('0x33')],qs['fields'](_0x51f651['query'][_0xd59c('0x38')]));_0x1547ad[_0xd59c('0x37')]=_0x1547ad[_0xd59c('0x37')]['length']?_0x1547ad['attributes']:_0x2c4931['model'];if(_0x51f651[_0xd59c('0x34')]['includeAll']){_0x1547ad[_0xd59c('0x49')]=[{'all':!![]}];}_0x1547ad=_[_0xd59c('0x3f')]({},_0x1547ad,_0x51f651[_0xd59c('0x43')]);return db[_0xd59c('0x2e')][_0xd59c('0x4a')](_0x1547ad)[_0xd59c('0x27')](handleEntityNotFound(_0x1a2ad0,null))['then'](respondWithResult(_0x1a2ad0,null))['catch'](handleError(_0x1a2ad0,null));};exports['create']=function(_0x4486df,_0x4b7245){return db[_0xd59c('0x2e')]['create'](_0x4486df['body'],{})[_0xd59c('0x27')](function(_0x5b534b){var _0x342e0e=_0x4486df[_0xd59c('0x4b')][_0xd59c('0x28')]({'plain':!![]});if(!_0x342e0e)throw new Error(_0xd59c('0x4c'));if(_0x342e0e[_0xd59c('0x4d')]===_0xd59c('0x4b')){var _0x39aae2=_0x5b534b[_0xd59c('0x28')]({'plain':!![]});var _0x142842=_0xd59c('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x142842,'userProfileId':_0x342e0e['userProfileId']},'raw':!![]})[_0xd59c('0x27')](function(_0x377bd1){if(_0x377bd1&&_0x377bd1[_0xd59c('0x4e')]===0x0){return db[_0xd59c('0x4f')]['create']({'name':_0x39aae2[_0xd59c('0x42')],'resourceId':_0x39aae2['id'],'type':_0x377bd1[_0xd59c('0x42')],'sectionId':_0x377bd1['id']},{})[_0xd59c('0x27')](function(){return _0x5b534b;});}else{return _0x5b534b;}})[_0xd59c('0x47')](function(_0xde893c){logger[_0xd59c('0x50')](_0xd59c('0x51'),_0xde893c);throw _0xde893c;});}return _0x5b534b;})[_0xd59c('0x27')](respondWithResult(_0x4b7245,0xc9))[_0xd59c('0x47')](handleError(_0x4b7245,null));};exports['update']=function(_0x26bc4d,_0x32d08d){if(_0x26bc4d[_0xd59c('0x52')]['id']){delete _0x26bc4d[_0xd59c('0x52')]['id'];}return db[_0xd59c('0x2e')][_0xd59c('0x4a')]({'where':{'id':_0x26bc4d[_0xd59c('0x53')]['id']}})['then'](handleEntityNotFound(_0x32d08d,null))[_0xd59c('0x27')](saveUpdates(_0x26bc4d[_0xd59c('0x52')],null))[_0xd59c('0x27')](respondWithResult(_0x32d08d,null))[_0xd59c('0x47')](handleError(_0x32d08d,null));};exports[_0xd59c('0x54')]=function(_0x3a1377,_0x5a18ba){return db[_0xd59c('0x2e')][_0xd59c('0x4a')]({'where':{'id':_0x3a1377[_0xd59c('0x53')]['id']}})[_0xd59c('0x27')](handleEntityNotFound(_0x5a18ba,null))['then'](removeEntity(_0x5a18ba,null))[_0xd59c('0x47')](handleError(_0x5a18ba,null));};exports[_0xd59c('0x55')]=function(_0x6b4f66,_0xbe16ae){return db[_0xd59c('0x2e')][_0xd59c('0x55')]()['then'](respondWithResult(_0xbe16ae,null))[_0xd59c('0x47')](handleError(_0xbe16ae,null));}; \ No newline at end of file +var _0x24b1=['destroy','then','Tags','end','sendStatus','stack','name','send','index','map','Tag','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x5b3c65,_0x59ddcc){var _0x10a4f5=function(_0x92ff2){while(--_0x92ff2){_0x5b3c65['push'](_0x5b3c65['shift']());}};_0x10a4f5(++_0x59ddcc);}(_0x24b1,0x123));var _0x124b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x24b1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x124b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x124b('0x1'));var rp=require(_0x124b('0x2'));var moment=require(_0x124b('0x3'));var BPromise=require(_0x124b('0x4'));var Mustache=require(_0x124b('0x5'));var util=require('util');var path=require(_0x124b('0x6'));var sox=require(_0x124b('0x7'));var csv=require(_0x124b('0x8'));var ejs=require(_0x124b('0x9'));var fs=require('fs');var fs_extra=require(_0x124b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x124b('0xb'));var toCsv=require(_0x124b('0x8'));var querystring=require(_0x124b('0xc'));var Papa=require(_0x124b('0xd'));var Redis=require(_0x124b('0xe'));var authService=require(_0x124b('0xf'));var qs=require(_0x124b('0x10'));var as=require(_0x124b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x124b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x124b('0x13'));var db=require(_0x124b('0x14'))['db'];function respondWithStatusCode(_0xed0280,_0x432f70){_0x432f70=_0x432f70||0xcc;return function(_0x16e7de){if(_0x16e7de){return _0xed0280['sendStatus'](_0x432f70);}return _0xed0280[_0x124b('0x15')](_0x432f70)['end']();};}function respondWithResult(_0x33a334,_0x32f53c){_0x32f53c=_0x32f53c||0xc8;return function(_0x5a6efb){if(_0x5a6efb){return _0x33a334[_0x124b('0x15')](_0x32f53c)[_0x124b('0x16')](_0x5a6efb);}};}function respondWithFilteredResult(_0x5c491e,_0x596989){return function(_0x469b08){if(_0x469b08){var _0x5ef49b=typeof _0x596989[_0x124b('0x17')]===_0x124b('0x18')&&typeof _0x596989[_0x124b('0x19')]==='undefined';var _0x39a02f=_0x469b08[_0x124b('0x1a')];var _0x37418f=_0x5ef49b?0x0:_0x596989[_0x124b('0x17')];var _0x40aa09=_0x5ef49b?_0x469b08['count']:_0x596989[_0x124b('0x17')]+_0x596989[_0x124b('0x19')];var _0x42d2b5;if(_0x40aa09>=_0x39a02f){_0x40aa09=_0x39a02f;_0x42d2b5=0xc8;}else{_0x42d2b5=0xce;}_0x5c491e[_0x124b('0x15')](_0x42d2b5);return _0x5c491e[_0x124b('0x1b')](_0x124b('0x1c'),_0x37418f+'-'+_0x40aa09+'/'+_0x39a02f)[_0x124b('0x16')](_0x469b08);}return null;};}function patchUpdates(_0x3bc00d){return function(_0x4d9a5f){try{jsonpatch[_0x124b('0x1d')](_0x4d9a5f,_0x3bc00d,!![]);}catch(_0x6748fb){return BPromise[_0x124b('0x1e')](_0x6748fb);}return _0x4d9a5f[_0x124b('0x1f')]();};}function saveUpdates(_0x39910b,_0x250425){return function(_0x31a544){if(_0x31a544){return _0x31a544[_0x124b('0x20')](_0x39910b)['then'](function(_0x4ddec4){return _0x4ddec4;});}return null;};}function removeEntity(_0x156748,_0x301c38){return function(_0x1cc85a){if(_0x1cc85a){return _0x1cc85a[_0x124b('0x21')]()[_0x124b('0x22')](function(){var _0x340236=_0x1cc85a['get']({'plain':!![]});var _0x2760b5=_0x124b('0x23');return db['UserProfileResource'][_0x124b('0x21')]({'where':{'type':_0x2760b5,'resourceId':_0x340236['id']}})[_0x124b('0x22')](function(){return _0x1cc85a;});})[_0x124b('0x22')](function(){_0x156748[_0x124b('0x15')](0xcc)[_0x124b('0x24')]();});}};}function handleEntityNotFound(_0x35ac28,_0x57f2d8){return function(_0x1ee39){if(!_0x1ee39){_0x35ac28[_0x124b('0x25')](0x194);}return _0x1ee39;};}function handleError(_0x4d7059,_0x347b2d){_0x347b2d=_0x347b2d||0x1f4;return function(_0x272d2a){logger['error'](_0x272d2a[_0x124b('0x26')]);if(_0x272d2a[_0x124b('0x27')]){delete _0x272d2a[_0x124b('0x27')];}_0x4d7059['status'](_0x347b2d)[_0x124b('0x28')](_0x272d2a);};}exports[_0x124b('0x29')]=function(_0xf43106,_0x4f1d9a){var _0x3e78aa={},_0xe692a2={},_0x2fd3bc={'count':0x0,'rows':[]};var _0x488ec2=_[_0x124b('0x2a')](db[_0x124b('0x2b')]['rawAttributes'],function(_0x1b1bb0){return{'name':_0x1b1bb0['fieldName'],'type':_0x1b1bb0[_0x124b('0x2c')][_0x124b('0x2d')]};});_0xe692a2[_0x124b('0x2e')]=_[_0x124b('0x2a')](_0x488ec2,'name');_0xe692a2['query']=_[_0x124b('0x2f')](_0xf43106[_0x124b('0x30')]);_0xe692a2['filters']=_['intersection'](_0xe692a2['model'],_0xe692a2[_0x124b('0x30')]);_0x3e78aa[_0x124b('0x31')]=_[_0x124b('0x32')](_0xe692a2[_0x124b('0x2e')],qs[_0x124b('0x33')](_0xf43106[_0x124b('0x30')][_0x124b('0x33')]));_0x3e78aa['attributes']=_0x3e78aa['attributes'][_0x124b('0x34')]?_0x3e78aa[_0x124b('0x31')]:_0xe692a2['model'];if(!_0xf43106[_0x124b('0x30')][_0x124b('0x35')](_0x124b('0x36'))){_0x3e78aa[_0x124b('0x19')]=qs[_0x124b('0x19')](_0xf43106[_0x124b('0x30')][_0x124b('0x19')]);_0x3e78aa['offset']=qs[_0x124b('0x17')](_0xf43106[_0x124b('0x30')][_0x124b('0x17')]);}_0x3e78aa[_0x124b('0x37')]=qs[_0x124b('0x38')](_0xf43106[_0x124b('0x30')][_0x124b('0x38')]);_0x3e78aa['where']=qs[_0x124b('0x39')](_[_0x124b('0x3a')](_0xf43106[_0x124b('0x30')],_0xe692a2['filters']),_0x488ec2);if(_0xf43106['query']['filter']){_0x3e78aa[_0x124b('0x3b')]=_[_0x124b('0x3c')](_0x3e78aa['where'],{'$or':_[_0x124b('0x2a')](_0x488ec2,function(_0x5f40d9){if(_0x5f40d9[_0x124b('0x2c')]!==_0x124b('0x3d')){var _0x3924af={};_0x3924af[_0x5f40d9[_0x124b('0x27')]]={'$like':'%'+_0xf43106[_0x124b('0x30')][_0x124b('0x3e')]+'%'};return _0x3924af;}})});}_0x3e78aa=_[_0x124b('0x3c')]({},_0x3e78aa,_0xf43106[_0x124b('0x3f')]);var _0x21fb7a={'where':_0x3e78aa[_0x124b('0x3b')]};return db[_0x124b('0x2b')][_0x124b('0x1a')](_0x21fb7a)[_0x124b('0x22')](function(_0x5e0a57){_0x2fd3bc[_0x124b('0x1a')]=_0x5e0a57;if(_0xf43106['query']['includeAll']){_0x3e78aa[_0x124b('0x40')]=[{'all':!![]}];}return db['Tag'][_0x124b('0x41')](_0x3e78aa);})[_0x124b('0x22')](function(_0x300eb3){_0x2fd3bc[_0x124b('0x42')]=_0x300eb3;return _0x2fd3bc;})[_0x124b('0x22')](respondWithFilteredResult(_0x4f1d9a,_0x3e78aa))[_0x124b('0x43')](handleError(_0x4f1d9a,null));};exports[_0x124b('0x44')]=function(_0x24fa93,_0x3f1f28){var _0x48e8b1={'raw':!![],'where':{'id':_0x24fa93[_0x124b('0x45')]['id']}},_0x1ca811={};_0x1ca811['model']=_['keys'](db[_0x124b('0x2b')][_0x124b('0x46')]);_0x1ca811[_0x124b('0x30')]=_[_0x124b('0x2f')](_0x24fa93['query']);_0x1ca811[_0x124b('0x39')]=_[_0x124b('0x32')](_0x1ca811['model'],_0x1ca811[_0x124b('0x30')]);_0x48e8b1[_0x124b('0x31')]=_[_0x124b('0x32')](_0x1ca811[_0x124b('0x2e')],qs[_0x124b('0x33')](_0x24fa93[_0x124b('0x30')][_0x124b('0x33')]));_0x48e8b1[_0x124b('0x31')]=_0x48e8b1[_0x124b('0x31')][_0x124b('0x34')]?_0x48e8b1[_0x124b('0x31')]:_0x1ca811[_0x124b('0x2e')];if(_0x24fa93[_0x124b('0x30')]['includeAll']){_0x48e8b1[_0x124b('0x40')]=[{'all':!![]}];}_0x48e8b1=_[_0x124b('0x3c')]({},_0x48e8b1,_0x24fa93[_0x124b('0x3f')]);return db[_0x124b('0x2b')][_0x124b('0x47')](_0x48e8b1)[_0x124b('0x22')](handleEntityNotFound(_0x3f1f28,null))[_0x124b('0x22')](respondWithResult(_0x3f1f28,null))[_0x124b('0x43')](handleError(_0x3f1f28,null));};exports[_0x124b('0x48')]=function(_0x4c8cac,_0xf2d16b){return db['Tag'][_0x124b('0x48')](_0x4c8cac['body'],{})['then'](function(_0xa004e7){var _0x5c9a5a=_0x4c8cac['user'][_0x124b('0x49')]({'plain':!![]});if(!_0x5c9a5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c9a5a[_0x124b('0x4a')]===_0x124b('0x4b')){var _0x22474b=_0xa004e7[_0x124b('0x49')]({'plain':!![]});var _0x28f15f=_0x124b('0x23');return db[_0x124b('0x4c')][_0x124b('0x47')]({'where':{'name':_0x28f15f,'userProfileId':_0x5c9a5a[_0x124b('0x4d')]},'raw':!![]})['then'](function(_0x37aeae){if(_0x37aeae&&_0x37aeae['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x22474b[_0x124b('0x27')],'resourceId':_0x22474b['id'],'type':_0x37aeae['name'],'sectionId':_0x37aeae['id']},{})[_0x124b('0x22')](function(){return _0xa004e7;});}else{return _0xa004e7;}})[_0x124b('0x43')](function(_0x552f8e){logger['error'](_0x124b('0x4e'),_0x552f8e);throw _0x552f8e;});}return _0xa004e7;})[_0x124b('0x22')](respondWithResult(_0xf2d16b,0xc9))[_0x124b('0x43')](handleError(_0xf2d16b,null));};exports[_0x124b('0x20')]=function(_0x5df48c,_0x2ab05e){if(_0x5df48c['body']['id']){delete _0x5df48c[_0x124b('0x4f')]['id'];}return db[_0x124b('0x2b')][_0x124b('0x47')]({'where':{'id':_0x5df48c['params']['id']}})[_0x124b('0x22')](handleEntityNotFound(_0x2ab05e,null))[_0x124b('0x22')](saveUpdates(_0x5df48c[_0x124b('0x4f')],null))[_0x124b('0x22')](respondWithResult(_0x2ab05e,null))[_0x124b('0x43')](handleError(_0x2ab05e,null));};exports[_0x124b('0x21')]=function(_0x57b066,_0x1f3a46){return db[_0x124b('0x2b')][_0x124b('0x47')]({'where':{'id':_0x57b066['params']['id']}})[_0x124b('0x22')](handleEntityNotFound(_0x1f3a46,null))[_0x124b('0x22')](removeEntity(_0x1f3a46,null))[_0x124b('0x43')](handleError(_0x1f3a46,null));};exports['describe']=function(_0x5dce40,_0x484d77){return db[_0x124b('0x2b')][_0x124b('0x50')]()[_0x124b('0x22')](respondWithResult(_0x484d77,null))[_0x124b('0x43')](handleError(_0x484d77,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f93c887..5d16ab4 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 _0xe58a=['moment','path','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x3a0b7f,_0x550d3b){var _0x551562=function(_0x2f7817){while(--_0x2f7817){_0x3a0b7f['push'](_0x3a0b7f['shift']());}};_0x551562(++_0x550d3b);}(_0xe58a,0x9f));var _0xae58=function(_0x166ec5,_0x73d15e){_0x166ec5=_0x166ec5-0x0;var _0x22be48=_0xe58a[_0x166ec5];return _0x22be48;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var logger=require(_0xae58('0x2'))('api');var moment=require(_0xae58('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae58('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae58('0x5'));module['exports']=function(_0x198e0c,_0x29749a){return _0x198e0c[_0xae58('0x6')](_0xae58('0x7'),attributes,{'tableName':_0xae58('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b2=['path','rimraf','Tag','tools_tags','lodash','util','moment','bluebird','request-promise'];(function(_0x247127,_0x186596){var _0x36e3c8=function(_0x1ca6e9){while(--_0x1ca6e9){_0x247127['push'](_0x247127['shift']());}};_0x36e3c8(++_0x186596);}(_0x21b2,0x79));var _0x221b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21b2[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x221b('0x0'));var util=require(_0x221b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x221b('0x2'));var BPromise=require(_0x221b('0x3'));var rp=require(_0x221b('0x4'));var fs=require('fs');var path=require(_0x221b('0x5'));var rimraf=require(_0x221b('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x1c75e9,_0x55d8e7){return _0x1c75e9['define'](_0x221b('0x7'),attributes,{'tableName':_0x221b('0x8'),'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 b59d894..05ef846 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x51d068,_0x309292){var _0x94f736=function(_0x45321d){while(--_0x45321d){_0x51d068['push'](_0x51d068['shift']());}};_0x94f736(++_0x309292);}(_0x6aa7,0x178));var _0x76aa=function(_0x3d0120,_0x2cb75a){_0x3d0120=_0x3d0120-0x0;var _0x210a3d=_0x6aa7[_0x3d0120];return _0x210a3d;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x0a12=['error','code','message','result','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x8a14b2,_0x3a203f){var _0x1db637=function(_0x495432){while(--_0x495432){_0x8a14b2['push'](_0x8a14b2['shift']());}};_0x1db637(++_0x3a203f);}(_0x0a12,0xb8));var _0x20a1=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x0a12[_0x42bc91];return _0x3f5507;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20a1('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x20a1('0x2'));var logger=require(_0x20a1('0x3'))(_0x20a1('0x4'));var config=require(_0x20a1('0x5'));var jayson=require(_0x20a1('0x6'));var client=jayson[_0x20a1('0x7')][_0x20a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51f7db,_0x494314,_0x28ed27){return new BPromise(function(_0x52fb53,_0x548be6){return client[_0x20a1('0x9')](_0x51f7db,_0x28ed27)[_0x20a1('0xa')](function(_0x26c1df){logger[_0x20a1('0xb')](_0x20a1('0xc'),_0x494314,_0x20a1('0xd'));logger[_0x20a1('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x494314,_0x20a1('0xd'),JSON[_0x20a1('0xf')](_0x26c1df));if(_0x26c1df[_0x20a1('0x10')]){if(_0x26c1df[_0x20a1('0x10')][_0x20a1('0x11')]===0x1f4){logger[_0x20a1('0x10')]('Tag,\x20%s,\x20%s',_0x494314,_0x26c1df[_0x20a1('0x10')][_0x20a1('0x12')]);return _0x548be6(_0x26c1df[_0x20a1('0x10')][_0x20a1('0x12')]);}logger[_0x20a1('0x10')](_0x20a1('0xc'),_0x494314,_0x26c1df[_0x20a1('0x10')][_0x20a1('0x12')]);return _0x52fb53(_0x26c1df[_0x20a1('0x10')][_0x20a1('0x12')]);}else{logger[_0x20a1('0xb')](_0x20a1('0xc'),_0x494314,_0x20a1('0xd'));_0x52fb53(_0x26c1df[_0x20a1('0x13')]['message']);}})['catch'](function(_0x5b26af){logger['error']('Tag,\x20%s,\x20%s',_0x494314,_0x5b26af);_0x548be6(_0x5b26af);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 323d6f4..0cff6fe 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 b010c75..cd74396 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 _0x2032=['name','exports','STRING'];(function(_0x27df53,_0x81d0d2){var _0x4cb1cf=function(_0x38869f){while(--_0x38869f){_0x27df53['push'](_0x27df53['shift']());}};_0x4cb1cf(++_0x81d0d2);}(_0x2032,0xd9));var _0x2203=function(_0x48f146,_0x77c316){_0x48f146=_0x48f146-0x0;var _0x4472f5=_0x2032[_0x48f146];return _0x4472f5;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x168e83,_0xd7f4d8){var _0x5557f7=function(_0x1ce3de){while(--_0x1ce3de){_0x168e83['push'](_0x168e83['shift']());}};_0x5557f7(++_0xd7f4d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3f18ad2..9c54121 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 _0xd6fb=['../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','count','set','reject','update','sendStatus','stack','name','send','index','map','Team','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','then','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','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','UserFaxQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','UserProfileResource','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','ids','Voice','Chat','Mail','Fax','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','findAll','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','VoicePrefixId','addAgents','spread','isArray','Openchannel','removeAgents','Queue:remove','TeamVoicePrefix','getAgents','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd6fb,0x1a1));var _0xbd6f=function(_0x2c95ff,_0x2ec2f9){_0x2c95ff=_0x2c95ff-0x0;var _0x3a1dc7=_0xd6fb[_0x2c95ff];return _0x3a1dc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd6f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd6f('0x1'));var BPromise=require(_0xbd6f('0x2'));var Mustache=require(_0xbd6f('0x3'));var util=require(_0xbd6f('0x4'));var path=require(_0xbd6f('0x5'));var sox=require('sox');var csv=require(_0xbd6f('0x6'));var ejs=require(_0xbd6f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd6f('0x8'));var squel=require(_0xbd6f('0x9'));var crypto=require(_0xbd6f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbd6f('0xb'));var toCsv=require(_0xbd6f('0x6'));var querystring=require(_0xbd6f('0xc'));var Papa=require('papaparse');var Redis=require(_0xbd6f('0xd'));var authService=require(_0xbd6f('0xe'));var qs=require(_0xbd6f('0xf'));var as=require(_0xbd6f('0x10'));var hardwareService=require(_0xbd6f('0x11'));var logger=require(_0xbd6f('0x12'))('api');var utils=require(_0xbd6f('0x13'));var config=require(_0xbd6f('0x14'));var licenseUtil=require(_0xbd6f('0x15'));var db=require(_0xbd6f('0x16'))['db'];config[_0xbd6f('0x17')]=_[_0xbd6f('0x18')](config[_0xbd6f('0x17')],{'host':_0xbd6f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd6f('0x17')]));require('./team.socket')[_0xbd6f('0x1a')](socket);function respondWithStatusCode(_0x1f30d4,_0xf44944){_0xf44944=_0xf44944||0xcc;return function(_0x5d2dbb){if(_0x5d2dbb){return _0x1f30d4['sendStatus'](_0xf44944);}return _0x1f30d4[_0xbd6f('0x1b')](_0xf44944)[_0xbd6f('0x1c')]();};}function respondWithResult(_0x6a40e0,_0x22ae55){_0x22ae55=_0x22ae55||0xc8;return function(_0x33712a){if(_0x33712a){return _0x6a40e0[_0xbd6f('0x1b')](_0x22ae55)[_0xbd6f('0x1d')](_0x33712a);}};}function respondWithFilteredResult(_0x5a9fef,_0x3d6dad){return function(_0x5c3095){if(_0x5c3095){var _0x48cd5b=typeof _0x3d6dad[_0xbd6f('0x1e')]===_0xbd6f('0x1f')&&typeof _0x3d6dad[_0xbd6f('0x20')]===_0xbd6f('0x1f');var _0x52a8d5=_0x5c3095[_0xbd6f('0x21')];var _0x2d1103=_0x48cd5b?0x0:_0x3d6dad[_0xbd6f('0x1e')];var _0x2ec97d=_0x48cd5b?_0x5c3095[_0xbd6f('0x21')]:_0x3d6dad['offset']+_0x3d6dad[_0xbd6f('0x20')];var _0x3b7684;if(_0x2ec97d>=_0x52a8d5){_0x2ec97d=_0x52a8d5;_0x3b7684=0xc8;}else{_0x3b7684=0xce;}_0x5a9fef['status'](_0x3b7684);return _0x5a9fef[_0xbd6f('0x22')]('Content-Range',_0x2d1103+'-'+_0x2ec97d+'/'+_0x52a8d5)[_0xbd6f('0x1d')](_0x5c3095);}return null;};}function patchUpdates(_0xb7b8e8){return function(_0xd706be){try{jsonpatch['apply'](_0xd706be,_0xb7b8e8,!![]);}catch(_0x4bd0e3){return BPromise[_0xbd6f('0x23')](_0x4bd0e3);}return _0xd706be['save']();};}function saveUpdates(_0x4ec07f,_0x428f4c){return function(_0x10d077){if(_0x10d077){return _0x10d077[_0xbd6f('0x24')](_0x4ec07f)['then'](function(_0x3714cf){return _0x3714cf;});}return null;};}function handleEntityNotFound(_0x294dab,_0xc09a4f){return function(_0x5199e1){if(!_0x5199e1){_0x294dab[_0xbd6f('0x25')](0x194);}return _0x5199e1;};}function handleError(_0x5024fa,_0x4539dd){_0x4539dd=_0x4539dd||0x1f4;return function(_0x113b7e){logger['error'](_0x113b7e[_0xbd6f('0x26')]);if(_0x113b7e[_0xbd6f('0x27')]){delete _0x113b7e[_0xbd6f('0x27')];}_0x5024fa[_0xbd6f('0x1b')](_0x4539dd)[_0xbd6f('0x28')](_0x113b7e);};}exports[_0xbd6f('0x29')]=function(_0x24337f,_0x29c1a5){var _0x2ab19e={},_0x407d76={},_0x43525a={'count':0x0,'rows':[]};var _0x42d0f1=_[_0xbd6f('0x2a')](db[_0xbd6f('0x2b')][_0xbd6f('0x2c')],function(_0x5b288c){return{'name':_0x5b288c[_0xbd6f('0x2d')],'type':_0x5b288c['type'][_0xbd6f('0x2e')]};});_0x407d76['model']=_[_0xbd6f('0x2a')](_0x42d0f1,'name');_0x407d76[_0xbd6f('0x2f')]=_[_0xbd6f('0x30')](_0x24337f[_0xbd6f('0x2f')]);_0x407d76['filters']=_['intersection'](_0x407d76[_0xbd6f('0x31')],_0x407d76[_0xbd6f('0x2f')]);_0x2ab19e[_0xbd6f('0x32')]=_[_0xbd6f('0x33')](_0x407d76[_0xbd6f('0x31')],qs[_0xbd6f('0x34')](_0x24337f['query']['fields']));_0x2ab19e['attributes']=_0x2ab19e[_0xbd6f('0x32')][_0xbd6f('0x35')]?_0x2ab19e[_0xbd6f('0x32')]:_0x407d76['model'];if(!_0x24337f[_0xbd6f('0x2f')][_0xbd6f('0x36')]('nolimit')){_0x2ab19e['limit']=qs[_0xbd6f('0x20')](_0x24337f['query']['limit']);_0x2ab19e['offset']=qs[_0xbd6f('0x1e')](_0x24337f[_0xbd6f('0x2f')][_0xbd6f('0x1e')]);}_0x2ab19e[_0xbd6f('0x37')]=qs[_0xbd6f('0x38')](_0x24337f['query']['sort']);_0x2ab19e[_0xbd6f('0x39')]=qs[_0xbd6f('0x3a')](_[_0xbd6f('0x3b')](_0x24337f[_0xbd6f('0x2f')],_0x407d76[_0xbd6f('0x3a')]),_0x42d0f1);if(_0x24337f['query'][_0xbd6f('0x3c')]){_0x2ab19e['where']=_[_0xbd6f('0x3d')](_0x2ab19e[_0xbd6f('0x39')],{'$or':_[_0xbd6f('0x2a')](_0x42d0f1,function(_0x3109d2){if(_0x3109d2['type']!==_0xbd6f('0x3e')){var _0x495cd9={};_0x495cd9[_0x3109d2['name']]={'$like':'%'+_0x24337f[_0xbd6f('0x2f')]['filter']+'%'};return _0x495cd9;}})});}_0x2ab19e=_['merge']({},_0x2ab19e,_0x24337f['options']);var _0x2fa9fe={'where':_0x2ab19e[_0xbd6f('0x39')]};return db[_0xbd6f('0x2b')][_0xbd6f('0x21')](_0x2fa9fe)['then'](function(_0x25adb2){_0x43525a[_0xbd6f('0x21')]=_0x25adb2;if(_0x24337f['query'][_0xbd6f('0x3f')]){_0x2ab19e[_0xbd6f('0x40')]=[{'all':!![]}];}return db[_0xbd6f('0x2b')]['findAll'](_0x2ab19e);})['then'](function(_0x3b6f0e){_0x43525a[_0xbd6f('0x41')]=_0x3b6f0e;return _0x43525a;})[_0xbd6f('0x42')](respondWithFilteredResult(_0x29c1a5,_0x2ab19e))[_0xbd6f('0x43')](handleError(_0x29c1a5,null));};exports[_0xbd6f('0x44')]=function(_0x539a8d,_0x51bea4){var _0x530822={'raw':![],'where':{'id':_0x539a8d['params']['id']}},_0x5c3ec1={};_0x5c3ec1['model']=_['keys'](db['Team'][_0xbd6f('0x2c')]);_0x5c3ec1['query']=_['keys'](_0x539a8d[_0xbd6f('0x2f')]);_0x5c3ec1[_0xbd6f('0x3a')]=_[_0xbd6f('0x33')](_0x5c3ec1[_0xbd6f('0x31')],_0x5c3ec1['query']);_0x530822[_0xbd6f('0x32')]=_[_0xbd6f('0x33')](_0x5c3ec1['model'],qs['fields'](_0x539a8d['query'][_0xbd6f('0x34')]));_0x530822[_0xbd6f('0x32')]=_0x530822[_0xbd6f('0x32')]['length']?_0x530822[_0xbd6f('0x32')]:_0x5c3ec1[_0xbd6f('0x31')];if(_0x539a8d[_0xbd6f('0x2f')]['includeAll']){_0x530822[_0xbd6f('0x40')]=[{'all':!![]}];}_0x530822=_[_0xbd6f('0x3d')]({},_0x530822,_0x539a8d[_0xbd6f('0x45')]);return db[_0xbd6f('0x2b')][_0xbd6f('0x46')](_0x530822)[_0xbd6f('0x42')](handleEntityNotFound(_0x51bea4,null))[_0xbd6f('0x42')](respondWithResult(_0x51bea4,null))[_0xbd6f('0x43')](handleError(_0x51bea4,null));};exports[_0xbd6f('0x47')]=function(_0x5a8ced,_0x3ba127){return db[_0xbd6f('0x2b')][_0xbd6f('0x47')](_0x5a8ced[_0xbd6f('0x48')],{})[_0xbd6f('0x42')](function(_0x236b10){var _0x138427=_0x5a8ced[_0xbd6f('0x49')]['get']({'plain':!![]});if(!_0x138427)throw new Error(_0xbd6f('0x4a'));if(_0x138427[_0xbd6f('0x4b')]===_0xbd6f('0x49')){var _0xc11a40=_0x236b10[_0xbd6f('0x4c')]({'plain':!![]});var _0x49ef12=_0xbd6f('0x4d');return db[_0xbd6f('0x4e')][_0xbd6f('0x46')]({'where':{'name':_0x49ef12,'userProfileId':_0x138427[_0xbd6f('0x4f')]},'raw':!![]})['then'](function(_0x4508a4){if(_0x4508a4&&_0x4508a4[_0xbd6f('0x50')]===0x0){return db['UserProfileResource'][_0xbd6f('0x47')]({'name':_0xc11a40[_0xbd6f('0x27')],'resourceId':_0xc11a40['id'],'type':_0x4508a4[_0xbd6f('0x27')],'sectionId':_0x4508a4['id']},{})[_0xbd6f('0x42')](function(){return _0x236b10;});}else{return _0x236b10;}})[_0xbd6f('0x43')](function(_0x2668fd){logger[_0xbd6f('0x51')](_0xbd6f('0x52'),_0x2668fd);throw _0x2668fd;});}return _0x236b10;})[_0xbd6f('0x42')](respondWithResult(_0x3ba127,0xc9))[_0xbd6f('0x43')](handleError(_0x3ba127,null));};exports[_0xbd6f('0x24')]=function(_0x4e22ab,_0x1932ae){if(_0x4e22ab[_0xbd6f('0x48')]['id']){delete _0x4e22ab[_0xbd6f('0x48')]['id'];}return db[_0xbd6f('0x2b')]['find']({'where':{'id':_0x4e22ab['params']['id']}})[_0xbd6f('0x42')](handleEntityNotFound(_0x1932ae,null))[_0xbd6f('0x42')](saveUpdates(_0x4e22ab['body'],null))[_0xbd6f('0x42')](respondWithResult(_0x1932ae,null))[_0xbd6f('0x43')](handleError(_0x1932ae,null));};exports[_0xbd6f('0x53')]=function(_0x1ec562,_0x139249){var _0x2715c7=_0x1ec562[_0xbd6f('0x54')]['id'];var _0x3f766d=[];return db['sequelize'][_0xbd6f('0x55')](function(_0xf29f95){var _0x1d1e24=_0xbd6f('0x56')+_0x2715c7;return db[_0xbd6f('0x57')][_0xbd6f('0x2f')](_0x1d1e24,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95})[_0xbd6f('0x42')](function(_0x109b94){_0x3f766d=_[_0xbd6f('0x2a')](_0x109b94,function(_0x4f814f){return Number(_0x4f814f[_0xbd6f('0x5b')]);});})[_0xbd6f('0x42')](function(){var _0x29e7e0=_0xbd6f('0x5c')+_0x2715c7;return db[_0xbd6f('0x57')]['query'](_0x29e7e0,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x5918e0){var _0x4bf653=_[_0xbd6f('0x2a')](_0x5918e0,function(_0x519acf){return Number(_0x519acf['VoiceQueueId']);});return db['UserVoiceQueue'][_0xbd6f('0x53')]({'where':{'UserId':{'$in':_0x3f766d},'VoiceQueueId':{'$in':_0x4bf653}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0x5bf5ac=_0xbd6f('0x5d')+_0x2715c7;return db[_0xbd6f('0x57')][_0xbd6f('0x2f')](_0x5bf5ac,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x166d9e){var _0x1cc15a=_[_0xbd6f('0x2a')](_0x166d9e,function(_0x303a7e){return Number(_0x303a7e[_0xbd6f('0x5e')]);});return db[_0xbd6f('0x5f')][_0xbd6f('0x53')]({'where':{'UserId':{'$in':_0x3f766d},'MailQueueId':{'$in':_0x1cc15a}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0x5ab0a2='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2715c7;return db['sequelize'][_0xbd6f('0x2f')](_0x5ab0a2,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95});})['then'](function(_0x275352){var _0x151277=_[_0xbd6f('0x2a')](_0x275352,function(_0x57830f){return Number(_0x57830f['SmsQueueId']);});return db[_0xbd6f('0x60')]['destroy']({'where':{'UserId':{'$in':_0x3f766d},'SmsQueueId':{'$in':_0x151277}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0xf7fb48=_0xbd6f('0x61')+_0x2715c7;return db[_0xbd6f('0x57')][_0xbd6f('0x2f')](_0xf7fb48,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')]['SELECT'],'raw':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x25752b){var _0xaf8862=_[_0xbd6f('0x2a')](_0x25752b,function(_0x1d6ba0){return Number(_0x1d6ba0[_0xbd6f('0x62')]);});return db[_0xbd6f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x3f766d},'ChatQueueId':{'$in':_0xaf8862}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0x38806b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2715c7;return db[_0xbd6f('0x57')][_0xbd6f('0x2f')](_0x38806b,{'type':db[_0xbd6f('0x58')]['QueryTypes'][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x33bdf3){var _0x36531f=_[_0xbd6f('0x2a')](_0x33bdf3,function(_0xbb654e){return Number(_0xbb654e['FaxQueueId']);});return db[_0xbd6f('0x64')][_0xbd6f('0x53')]({'where':{'UserId':{'$in':_0x3f766d},'FaxQueueId':{'$in':_0x36531f}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0x1c48d2='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2715c7;return db[_0xbd6f('0x57')]['query'](_0x1c48d2,{'type':db[_0xbd6f('0x58')][_0xbd6f('0x59')][_0xbd6f('0x5a')],'raw':!![],'transaction':_0xf29f95});})['then'](function(_0x7f57b2){var _0x55ef9b=_['map'](_0x7f57b2,function(_0x2c2b63){return Number(_0x2c2b63['OpenchannelQueueId']);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x3f766d},'OpenchannelQueueId':{'$in':_0x55ef9b}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){var _0x5d5f65=_0xbd6f('0x65')+_0x2715c7;return db['sequelize'][_0xbd6f('0x2f')](_0x5d5f65,{'type':db[_0xbd6f('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x3b0b1f){var _0x44f855=_[_0xbd6f('0x2a')](_0x3b0b1f,function(_0x5070d9){return Number(_0x5070d9[_0xbd6f('0x66')]);});return db['UserWhatsappQueue'][_0xbd6f('0x53')]({'where':{'UserId':{'$in':_0x3f766d},'WhatsappQueueId':{'$in':_0x44f855}},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){return db['TeamVoicePrefix'][_0xbd6f('0x46')]({'where':{'TeamId':_0x2715c7}});})[_0xbd6f('0x42')](function(_0x5adb4d){if(_0x5adb4d===null){return;}return db[_0xbd6f('0x67')][_0xbd6f('0x53')]({'where':{'UserId':{'$in':_0x3f766d},'VoicePrefixId':_0x5adb4d['VoicePrefixId']},'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(){return db[_0xbd6f('0x2b')][_0xbd6f('0x53')]({'where':{'id':_0x2715c7},'cascade':!![],'transaction':_0xf29f95});})[_0xbd6f('0x42')](function(_0x112a20){if(_0x112a20===0x0){_0x139249[_0xbd6f('0x25')](0x194);}else{return db[_0xbd6f('0x68')]['destroy']({'where':{'type':_0xbd6f('0x4d'),'resourceId':_0x2715c7},'cascade':!![],'transaction':_0xf29f95})[_0xbd6f('0x42')](function(){_0x139249[_0xbd6f('0x1b')](0xcc)[_0xbd6f('0x1c')]();});}})['catch'](function(_0x5b5588){_0x139249[_0xbd6f('0x1b')](0x1f4)[_0xbd6f('0x28')](_0x5b5588);});});};exports[_0xbd6f('0x69')]=function(_0x10e572,_0x9916e5,_0x17bbf7){return db[_0xbd6f('0x2b')][_0xbd6f('0x6a')]({'where':{'id':_0x10e572[_0xbd6f('0x54')]['id']}})[_0xbd6f('0x42')](handleEntityNotFound(_0x9916e5,null))['then'](function(_0x3ad48e){if(!_0x10e572[_0xbd6f('0x2f')]['channel']||!utils[_0xbd6f('0x6b')](_0x10e572['query'][_0xbd6f('0x6c')])){throw new db[(_0xbd6f('0x58'))][(_0xbd6f('0x6d'))](_0xbd6f('0x6e'));}var _0x3bfd6c={};var _0x3bc220={};_0x3bc220[_0xbd6f('0x31')]=_[_0xbd6f('0x30')](db[_[_0xbd6f('0x6f')](_0x10e572[_0xbd6f('0x2f')][_0xbd6f('0x6c')][_0xbd6f('0x70')]())+_0xbd6f('0x71')][_0xbd6f('0x2c')]);_0x3bc220[_0xbd6f('0x2f')]=_[_0xbd6f('0x30')](_0x10e572[_0xbd6f('0x2f')]);_0x3bc220[_0xbd6f('0x3a')]=_[_0xbd6f('0x33')](_0x3bc220[_0xbd6f('0x31')],_0x3bc220[_0xbd6f('0x2f')]);_0x3bfd6c[_0xbd6f('0x32')]=_[_0xbd6f('0x33')](_0x3bc220[_0xbd6f('0x31')],qs[_0xbd6f('0x34')](_0x10e572['query'][_0xbd6f('0x34')]));_0x3bfd6c[_0xbd6f('0x32')]=_0x3bfd6c['attributes']['length']?_0x3bfd6c[_0xbd6f('0x32')]:_0x3bc220[_0xbd6f('0x31')];_0x3bfd6c[_0xbd6f('0x20')]=qs[_0xbd6f('0x20')](_0x10e572['query']['limit']);_0x3bfd6c[_0xbd6f('0x1e')]=qs[_0xbd6f('0x1e')](_0x10e572[_0xbd6f('0x2f')]['offset']);_0x3bfd6c[_0xbd6f('0x37')]=qs[_0xbd6f('0x38')](_0x10e572[_0xbd6f('0x2f')]['sort']);_0x3bfd6c[_0xbd6f('0x39')]=qs['filters'](_[_0xbd6f('0x3b')](_0x10e572[_0xbd6f('0x2f')],_0x3bc220[_0xbd6f('0x3a')]));_0x3bfd6c=_['merge']({},_0x3bfd6c,_0x10e572['options']);return _0x3ad48e['get'+_['capitalize'](_0x10e572[_0xbd6f('0x2f')][_0xbd6f('0x6c')][_0xbd6f('0x70')]())+_0xbd6f('0x72')](_0x3bfd6c);})[_0xbd6f('0x42')](respondWithResult(_0x9916e5,null))[_0xbd6f('0x43')](handleError(_0x9916e5,null));};exports['addQueues']=function(_0x5ed771,_0x516e6a,_0x5dbf0d){return db[_0xbd6f('0x2b')]['findOne']({'where':{'id':_0x5ed771[_0xbd6f('0x54')]['id']}})['then'](function(_0xa8e4ce){if(_0xa8e4ce){if(!_0x5ed771[_0xbd6f('0x48')]['channel']||!utils['isValidChannel'](_0x5ed771[_0xbd6f('0x48')][_0xbd6f('0x6c')])){throw new db[(_0xbd6f('0x58'))][(_0xbd6f('0x6d'))](_0xbd6f('0x6e'));}return _0xa8e4ce['add'+_[_0xbd6f('0x6f')](_0x5ed771[_0xbd6f('0x48')][_0xbd6f('0x6c')][_0xbd6f('0x70')]())+_0xbd6f('0x72')](_0x5ed771['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x516e6a,null))[_0xbd6f('0x42')](respondWithStatusCode(_0x516e6a,null))['catch'](handleError(_0x516e6a,null));};exports['removeQueues']=function(_0x5e32e2,_0x5e7799,_0x4368ac){return db[_0xbd6f('0x2b')][_0xbd6f('0x6a')]({'where':{'id':_0x5e32e2[_0xbd6f('0x54')]['id']}})[_0xbd6f('0x42')](function(_0xa1d834){if(_0xa1d834){if(!_0x5e32e2[_0xbd6f('0x2f')]['channel']||!utils[_0xbd6f('0x6b')](_0x5e32e2[_0xbd6f('0x2f')]['channel'])){throw new db[(_0xbd6f('0x58'))]['ValidationError'](_0xbd6f('0x6e'));}return _0xa1d834['remove'+_['capitalize'](_0x5e32e2[_0xbd6f('0x2f')]['channel'][_0xbd6f('0x70')]())+_0xbd6f('0x72')](_0x5e32e2['query'][_0xbd6f('0x73')]);}return null;})[_0xbd6f('0x42')](handleEntityNotFound(_0x5e7799,null))['then'](respondWithStatusCode(_0x5e7799,null))[_0xbd6f('0x43')](handleError(_0x5e7799,null));};exports['addAgents']=function(_0x4cc2d7,_0x2255a6){var _0x412c92=_['isArray'](_0x4cc2d7[_0xbd6f('0x48')][_0xbd6f('0x73')])?_0x4cc2d7[_0xbd6f('0x48')][_0xbd6f('0x73')]:[_0x4cc2d7[_0xbd6f('0x48')][_0xbd6f('0x73')]];var _0x819a57=_0x4cc2d7[_0xbd6f('0x54')]['id'];return db[_0xbd6f('0x2b')][_0xbd6f('0x46')]({'where':{'id':_0x819a57}})[_0xbd6f('0x42')](handleEntityNotFound(_0x2255a6,null))[_0xbd6f('0x42')](function(_0x4cb1da){if(_0x4cb1da){var _0x2b4f3e=[_0xbd6f('0x74'),_0xbd6f('0x75'),_0xbd6f('0x76'),'Sms',_0xbd6f('0x77'),'Openchannel',_0xbd6f('0x78')];return db[_0xbd6f('0x57')]['transaction'](function(_0x19b10e){var _0xf1525d=_['map'](_0x2b4f3e,function(_0xdc4466){var _0xc598af={'attributes':['id',_0xbd6f('0x27')]};if(_0xdc4466===_0xbd6f('0x74')){_0xc598af[_0xbd6f('0x79')]={'attributes':[_0xbd6f('0x7a')]};}return _0x4cb1da[_0xbd6f('0x4c')+_0xdc4466+_0xbd6f('0x72')](_0xc598af)[_0xbd6f('0x42')](function(_0x4784d6){var _0xbe2794=_[_0xbd6f('0x2a')](_0x4784d6,function(_0x301dac){var _0x5468cb=_[_0xbd6f('0x2a')](_0x412c92,function(_0x50f9d7){var _0x1e423a={'where':{'UserId':_0x50f9d7,[_0xdc4466+_0xbd6f('0x7b')]:_0x301dac['id']},'transaction':_0x19b10e};if(_0xdc4466===_0xbd6f('0x74')){_0x1e423a[_0xbd6f('0x18')]={'penalty':_0x301dac[_0xbd6f('0x7c')][_0xbd6f('0x7a')]};}return db[_0xbd6f('0x7d')+_0xdc4466+_0xbd6f('0x71')][_0xbd6f('0x7e')](_0x1e423a)['then'](function(){socket['emit'](_0xbd6f('0x49')+_0xdc4466+'Queue:save',{'UserId':_0x50f9d7,[_0xdc4466+_0xbd6f('0x7b')]:_0x301dac['id']});if(_0xdc4466!==_0xbd6f('0x74')){return;}return db[_0xbd6f('0x7d')][_0xbd6f('0x7f')]({'where':{'id':_0x412c92,'online':0x1},'attributes':['id','name',_0xbd6f('0x80'),'voicePause',_0xbd6f('0x81')],'raw':!![]})[_0xbd6f('0x42')](function(_0x4a4aea){var _0x6fbd2e=_[_0xbd6f('0x2a')](_0x4a4aea,function(_0x16fa26){return db[_0xbd6f('0x82')][_0xbd6f('0x83')]({'membername':_0x16fa26['name'],'UserId':_0x16fa26['id'],'queue_name':_0x301dac[_0xbd6f('0x27')],'VoiceQueueId':_0x301dac['id'],'interface':_[_0xbd6f('0x84')](_0x16fa26[_0xbd6f('0x81')])?util[_0xbd6f('0x85')](_0xbd6f('0x86'),_0x16fa26['name']):_0x16fa26['interface'],'paused':_0x16fa26[_0xbd6f('0x87')]||![],'penalty':_0x301dac[_0xbd6f('0x7c')][_0xbd6f('0x7a')]},{'transaction':_0x19b10e});});return Promise[_0xbd6f('0x88')](_0x6fbd2e);});});});return Promise[_0xbd6f('0x88')](_0x5468cb);});return Promise[_0xbd6f('0x88')](_0xbe2794);})[_0xbd6f('0x42')](function(){return db['TeamVoicePrefix'][_0xbd6f('0x6a')]({'where':{'teamId':_0x819a57}})[_0xbd6f('0x42')](function(_0x446a53){if(_0x446a53){var _0x20118b=_['map'](_0x412c92,function(_0x41f094){db[_0xbd6f('0x67')][_0xbd6f('0x83')]({'UserId':_0x41f094,'VoicePrefixId':_0x446a53[_0xbd6f('0x89')]});});return Promise[_0xbd6f('0x88')](_0x20118b);}});});});return Promise[_0xbd6f('0x88')](_0xf1525d)['then'](function(){return _0x4cb1da[_0xbd6f('0x8a')](_0x412c92,{'transaction':_0x19b10e})[_0xbd6f('0x8b')](function(_0xe50f24){return _0xe50f24;});});});}})[_0xbd6f('0x42')](respondWithResult(_0x2255a6,null))['catch'](handleError(_0x2255a6,null));};exports['removeAgents']=function(_0x4b681a,_0x481844){var _0x26965f=_[_0xbd6f('0x8c')](_0x4b681a[_0xbd6f('0x2f')][_0xbd6f('0x73')])?_0x4b681a[_0xbd6f('0x2f')]['ids']:[_0x4b681a['query'][_0xbd6f('0x73')]];var _0x3c132c=_0x4b681a[_0xbd6f('0x54')]['id'];return db['Team'][_0xbd6f('0x46')]({'where':{'id':_0x3c132c}})[_0xbd6f('0x42')](handleEntityNotFound(_0x481844,null))[_0xbd6f('0x42')](function(_0x1c74be){if(_0x1c74be){var _0x438c74=['Voice',_0xbd6f('0x75'),'Mail','Sms',_0xbd6f('0x77'),_0xbd6f('0x8d'),_0xbd6f('0x78')];return db[_0xbd6f('0x57')]['transaction'](function(_0x1c5019){var _0x112898=_[_0xbd6f('0x2a')](_0x438c74,function(_0x2e16a2){var _0x1aaebc={'attributes':['id',_0xbd6f('0x27')]};return _0x1c74be['get'+_0x2e16a2+_0xbd6f('0x72')](_0x1aaebc)[_0xbd6f('0x42')](function(_0x359804){var _0x105bf4=_[_0xbd6f('0x2a')](_0x359804,function(_0x3f1d83){return _0x3f1d83[_0xbd6f('0x8e')](_0x26965f,{'transaction':_0x1c5019})[_0xbd6f('0x42')](function(){var _0x3f2cfb=_[_0xbd6f('0x2a')](_0x26965f,function(_0x266002){socket['emit'](_0xbd6f('0x49')+_0x2e16a2+_0xbd6f('0x8f'),{'UserId':Number(_0x266002),[_0x2e16a2+_0xbd6f('0x7b')]:_0x3f1d83['id']});if(_0x2e16a2!==_0xbd6f('0x74')){return;}return db[_0xbd6f('0x82')]['destroy']({'where':{'VoiceQueueId':_0x3f1d83['id'],'UserId':_0x266002},'transaction':_0x1c5019});});return Promise[_0xbd6f('0x88')](_0x3f2cfb);});});return Promise[_0xbd6f('0x88')](_0x105bf4);});});return Promise[_0xbd6f('0x88')](_0x112898)[_0xbd6f('0x42')](function(){return _0x1c74be[_0xbd6f('0x8e')](_0x26965f,{'transaction':_0x1c5019});})['then'](function(){return db[_0xbd6f('0x90')]['findOne']({'where':{'teamId':_0x3c132c}})[_0xbd6f('0x42')](function(_0x11ef7b){if(_0x11ef7b){var _0x5016c7=_[_0xbd6f('0x2a')](_0x26965f,function(_0x696767){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x696767,'VoicePrefixId':_0x11ef7b[_0xbd6f('0x89')]}});});return Promise[_0xbd6f('0x88')](_0x5016c7);}});});});}})['then'](respondWithStatusCode(_0x481844,null))[_0xbd6f('0x43')](handleError(_0x481844,null));};exports[_0xbd6f('0x91')]=function(_0x1a7489,_0x15c6d1,_0x4c8fc9){var _0x211122={};var _0xeac48a={};var _0x58db90;var _0x190ba8;return db[_0xbd6f('0x2b')][_0xbd6f('0x6a')]({'where':{'id':_0x1a7489[_0xbd6f('0x54')]['id']}})['then'](handleEntityNotFound(_0x15c6d1,null))[_0xbd6f('0x42')](function(_0x31bd1b){if(_0x31bd1b){_0x58db90=_0x31bd1b;_0xeac48a['model']=_['keys'](db[_0xbd6f('0x7d')]['rawAttributes']);_0xeac48a[_0xbd6f('0x2f')]=_['keys'](_0x1a7489['query']);_0xeac48a['filters']=_[_0xbd6f('0x33')](_0xeac48a['model'],_0xeac48a['query']);_0x211122[_0xbd6f('0x32')]=_[_0xbd6f('0x33')](_0xeac48a[_0xbd6f('0x31')],qs[_0xbd6f('0x34')](_0x1a7489['query']['fields']));_0x211122[_0xbd6f('0x32')]=_0x211122['attributes'][_0xbd6f('0x35')]?_0x211122[_0xbd6f('0x32')]:_0xeac48a[_0xbd6f('0x31')];_0x211122['order']=qs[_0xbd6f('0x38')](_0x1a7489['query'][_0xbd6f('0x38')]);_0x211122[_0xbd6f('0x39')]=qs['filters'](_[_0xbd6f('0x3b')](_0x1a7489[_0xbd6f('0x2f')],_0xeac48a[_0xbd6f('0x3a')]));if(_0x1a7489[_0xbd6f('0x2f')][_0xbd6f('0x3c')]){_0x211122[_0xbd6f('0x39')]=_[_0xbd6f('0x3d')](_0x211122['where'],{'$or':_[_0xbd6f('0x2a')](_0x211122[_0xbd6f('0x32')],function(_0x3c4f34){var _0x57ddd2={};_0x57ddd2[_0x3c4f34]={'$like':'%'+_0x1a7489[_0xbd6f('0x2f')]['filter']+'%'};return _0x57ddd2;})});}_0x211122=_['merge']({},_0x211122,_0x1a7489[_0xbd6f('0x45')]);return _0x58db90[_0xbd6f('0x91')](_0x211122);}})['then'](function(_0x582bca){if(_0x582bca){_0x190ba8=_0x582bca['length'];if(!_0x1a7489[_0xbd6f('0x2f')][_0xbd6f('0x36')]('nolimit')){_0x211122[_0xbd6f('0x20')]=qs[_0xbd6f('0x20')](_0x1a7489['query'][_0xbd6f('0x20')]);_0x211122[_0xbd6f('0x1e')]=qs[_0xbd6f('0x1e')](_0x1a7489[_0xbd6f('0x2f')][_0xbd6f('0x1e')]);}return _0x58db90[_0xbd6f('0x91')](_0x211122);}})[_0xbd6f('0x42')](function(_0x1d017b){if(_0x1d017b){return _0x1d017b?{'count':_0x190ba8,'rows':_0x1d017b}:null;}})[_0xbd6f('0x42')](respondWithResult(_0x15c6d1,null))['catch'](handleError(_0x15c6d1,null));}; \ No newline at end of file +var _0xe569=['where','merge','type','options','includeAll','include','findAll','rows','show','find','create','body','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','params','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','Teams','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','penalty','User','user','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','VoicePrefixId','removeAgents','Fax','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','squel','crypto','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','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','index','map','Team','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe569,0x18e));var _0x9e56=function(_0x311e77,_0x49a459){_0x311e77=_0x311e77-0x0;var _0x559c54=_0xe569[_0x311e77];return _0x559c54;};'use strict';var emlformat=require(_0x9e56('0x0'));var rimraf=require(_0x9e56('0x1'));var zipdir=require(_0x9e56('0x2'));var jsonpatch=require(_0x9e56('0x3'));var rp=require(_0x9e56('0x4'));var moment=require(_0x9e56('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e56('0x6'));var util=require('util');var path=require(_0x9e56('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9e56('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e56('0x9'));var crypto=require(_0x9e56('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9e56('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9e56('0xc'));var Papa=require(_0x9e56('0xd'));var Redis=require(_0x9e56('0xe'));var authService=require(_0x9e56('0xf'));var qs=require(_0x9e56('0x10'));var as=require(_0x9e56('0x11'));var hardwareService=require(_0x9e56('0x12'));var logger=require('../../config/logger')(_0x9e56('0x13'));var utils=require(_0x9e56('0x14'));var config=require(_0x9e56('0x15'));var licenseUtil=require(_0x9e56('0x16'));var db=require(_0x9e56('0x17'))['db'];config['redis']=_[_0x9e56('0x18')](config[_0x9e56('0x19')],{'host':_0x9e56('0x1a'),'port':0x18eb});var socket=require(_0x9e56('0x1b'))(new Redis(config[_0x9e56('0x19')]));require('./team.socket')[_0x9e56('0x1c')](socket);function respondWithStatusCode(_0x4aadea,_0x4180dd){_0x4180dd=_0x4180dd||0xcc;return function(_0x2eea3f){if(_0x2eea3f){return _0x4aadea[_0x9e56('0x1d')](_0x4180dd);}return _0x4aadea['status'](_0x4180dd)[_0x9e56('0x1e')]();};}function respondWithResult(_0x42aca1,_0x2a2ed2){_0x2a2ed2=_0x2a2ed2||0xc8;return function(_0x5083c2){if(_0x5083c2){return _0x42aca1[_0x9e56('0x1f')](_0x2a2ed2)[_0x9e56('0x20')](_0x5083c2);}};}function respondWithFilteredResult(_0x2c333b,_0x2c33b8){return function(_0x2c8d59){if(_0x2c8d59){var _0x355c14=typeof _0x2c33b8['offset']===_0x9e56('0x21')&&typeof _0x2c33b8['limit']===_0x9e56('0x21');var _0x32c06d=_0x2c8d59[_0x9e56('0x22')];var _0x55a94f=_0x355c14?0x0:_0x2c33b8[_0x9e56('0x23')];var _0x5e17c2=_0x355c14?_0x2c8d59[_0x9e56('0x22')]:_0x2c33b8[_0x9e56('0x23')]+_0x2c33b8[_0x9e56('0x24')];var _0x3add53;if(_0x5e17c2>=_0x32c06d){_0x5e17c2=_0x32c06d;_0x3add53=0xc8;}else{_0x3add53=0xce;}_0x2c333b[_0x9e56('0x1f')](_0x3add53);return _0x2c333b[_0x9e56('0x25')](_0x9e56('0x26'),_0x55a94f+'-'+_0x5e17c2+'/'+_0x32c06d)['json'](_0x2c8d59);}return null;};}function patchUpdates(_0x8f2dd3){return function(_0x272ae9){try{jsonpatch['apply'](_0x272ae9,_0x8f2dd3,!![]);}catch(_0xa526c){return BPromise[_0x9e56('0x27')](_0xa526c);}return _0x272ae9['save']();};}function saveUpdates(_0x14324b,_0x191c74){return function(_0x536aa9){if(_0x536aa9){return _0x536aa9['update'](_0x14324b)[_0x9e56('0x28')](function(_0x1d86cd){return _0x1d86cd;});}return null;};}function handleEntityNotFound(_0x579b3d,_0x5eafdc){return function(_0xa1432e){if(!_0xa1432e){_0x579b3d[_0x9e56('0x1d')](0x194);}return _0xa1432e;};}function handleError(_0x282aad,_0x2499b6){_0x2499b6=_0x2499b6||0x1f4;return function(_0x15b1e9){logger[_0x9e56('0x29')](_0x15b1e9[_0x9e56('0x2a')]);if(_0x15b1e9['name']){delete _0x15b1e9[_0x9e56('0x2b')];}_0x282aad['status'](_0x2499b6)[_0x9e56('0x2c')](_0x15b1e9);};}exports[_0x9e56('0x2d')]=function(_0x6ed22b,_0x5f19c8){var _0x59a71a={},_0x232985={},_0x1252e0={'count':0x0,'rows':[]};var _0xe5aca2=_[_0x9e56('0x2e')](db[_0x9e56('0x2f')][_0x9e56('0x30')],function(_0x7142f9){return{'name':_0x7142f9['fieldName'],'type':_0x7142f9['type'][_0x9e56('0x31')]};});_0x232985[_0x9e56('0x32')]=_['map'](_0xe5aca2,_0x9e56('0x2b'));_0x232985[_0x9e56('0x33')]=_[_0x9e56('0x34')](_0x6ed22b['query']);_0x232985[_0x9e56('0x35')]=_[_0x9e56('0x36')](_0x232985[_0x9e56('0x32')],_0x232985[_0x9e56('0x33')]);_0x59a71a[_0x9e56('0x37')]=_[_0x9e56('0x36')](_0x232985[_0x9e56('0x32')],qs[_0x9e56('0x38')](_0x6ed22b['query'][_0x9e56('0x38')]));_0x59a71a['attributes']=_0x59a71a[_0x9e56('0x37')][_0x9e56('0x39')]?_0x59a71a[_0x9e56('0x37')]:_0x232985[_0x9e56('0x32')];if(!_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x3a')](_0x9e56('0x3b'))){_0x59a71a[_0x9e56('0x24')]=qs[_0x9e56('0x24')](_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x24')]);_0x59a71a[_0x9e56('0x23')]=qs['offset'](_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x23')]);}_0x59a71a[_0x9e56('0x3c')]=qs['sort'](_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x3d')]);_0x59a71a['where']=qs[_0x9e56('0x35')](_[_0x9e56('0x3e')](_0x6ed22b['query'],_0x232985[_0x9e56('0x35')]),_0xe5aca2);if(_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x3f')]){_0x59a71a[_0x9e56('0x40')]=_[_0x9e56('0x41')](_0x59a71a[_0x9e56('0x40')],{'$or':_[_0x9e56('0x2e')](_0xe5aca2,function(_0x54a636){if(_0x54a636[_0x9e56('0x42')]!=='VIRTUAL'){var _0x557d59={};_0x557d59[_0x54a636[_0x9e56('0x2b')]]={'$like':'%'+_0x6ed22b['query']['filter']+'%'};return _0x557d59;}})});}_0x59a71a=_[_0x9e56('0x41')]({},_0x59a71a,_0x6ed22b[_0x9e56('0x43')]);var _0x204755={'where':_0x59a71a[_0x9e56('0x40')]};return db[_0x9e56('0x2f')][_0x9e56('0x22')](_0x204755)[_0x9e56('0x28')](function(_0x47c034){_0x1252e0[_0x9e56('0x22')]=_0x47c034;if(_0x6ed22b[_0x9e56('0x33')][_0x9e56('0x44')]){_0x59a71a[_0x9e56('0x45')]=[{'all':!![]}];}return db[_0x9e56('0x2f')][_0x9e56('0x46')](_0x59a71a);})[_0x9e56('0x28')](function(_0x3781e7){_0x1252e0[_0x9e56('0x47')]=_0x3781e7;return _0x1252e0;})[_0x9e56('0x28')](respondWithFilteredResult(_0x5f19c8,_0x59a71a))['catch'](handleError(_0x5f19c8,null));};exports[_0x9e56('0x48')]=function(_0x40cd6d,_0x97ccb3){var _0x47c5f5={'raw':![],'where':{'id':_0x40cd6d['params']['id']}},_0x693023={};_0x693023[_0x9e56('0x32')]=_[_0x9e56('0x34')](db['Team'][_0x9e56('0x30')]);_0x693023[_0x9e56('0x33')]=_[_0x9e56('0x34')](_0x40cd6d[_0x9e56('0x33')]);_0x693023[_0x9e56('0x35')]=_[_0x9e56('0x36')](_0x693023[_0x9e56('0x32')],_0x693023['query']);_0x47c5f5['attributes']=_[_0x9e56('0x36')](_0x693023['model'],qs[_0x9e56('0x38')](_0x40cd6d[_0x9e56('0x33')]['fields']));_0x47c5f5[_0x9e56('0x37')]=_0x47c5f5['attributes']['length']?_0x47c5f5[_0x9e56('0x37')]:_0x693023[_0x9e56('0x32')];if(_0x40cd6d[_0x9e56('0x33')][_0x9e56('0x44')]){_0x47c5f5[_0x9e56('0x45')]=[{'all':!![]}];}_0x47c5f5=_[_0x9e56('0x41')]({},_0x47c5f5,_0x40cd6d[_0x9e56('0x43')]);return db[_0x9e56('0x2f')][_0x9e56('0x49')](_0x47c5f5)[_0x9e56('0x28')](handleEntityNotFound(_0x97ccb3,null))[_0x9e56('0x28')](respondWithResult(_0x97ccb3,null))['catch'](handleError(_0x97ccb3,null));};exports[_0x9e56('0x4a')]=function(_0x23aa66,_0x178b94){return db['Team'][_0x9e56('0x4a')](_0x23aa66[_0x9e56('0x4b')],{})[_0x9e56('0x28')](function(_0x214a47){var _0x40bbc6=_0x23aa66['user']['get']({'plain':!![]});if(!_0x40bbc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40bbc6[_0x9e56('0x4c')]==='user'){var _0x3a3371=_0x214a47[_0x9e56('0x4d')]({'plain':!![]});var _0x156f73='Teams';return db[_0x9e56('0x4e')][_0x9e56('0x49')]({'where':{'name':_0x156f73,'userProfileId':_0x40bbc6[_0x9e56('0x4f')]},'raw':!![]})[_0x9e56('0x28')](function(_0x586dc9){if(_0x586dc9&&_0x586dc9[_0x9e56('0x50')]===0x0){return db[_0x9e56('0x51')][_0x9e56('0x4a')]({'name':_0x3a3371['name'],'resourceId':_0x3a3371['id'],'type':_0x586dc9[_0x9e56('0x2b')],'sectionId':_0x586dc9['id']},{})[_0x9e56('0x28')](function(){return _0x214a47;});}else{return _0x214a47;}})[_0x9e56('0x52')](function(_0x5c5c35){logger[_0x9e56('0x29')](_0x9e56('0x53'),_0x5c5c35);throw _0x5c5c35;});}return _0x214a47;})['then'](respondWithResult(_0x178b94,0xc9))['catch'](handleError(_0x178b94,null));};exports[_0x9e56('0x54')]=function(_0x4d42a9,_0x52e814){if(_0x4d42a9[_0x9e56('0x4b')]['id']){delete _0x4d42a9[_0x9e56('0x4b')]['id'];}return db[_0x9e56('0x2f')][_0x9e56('0x49')]({'where':{'id':_0x4d42a9['params']['id']}})[_0x9e56('0x28')](handleEntityNotFound(_0x52e814,null))[_0x9e56('0x28')](saveUpdates(_0x4d42a9['body'],null))[_0x9e56('0x28')](respondWithResult(_0x52e814,null))['catch'](handleError(_0x52e814,null));};exports[_0x9e56('0x55')]=function(_0x44693e,_0x10e9ea){var _0x20a338=_0x44693e[_0x9e56('0x56')]['id'];var _0x74aa7f=[];return db['sequelize']['transaction'](function(_0x483f15){var _0x1c7d6f=_0x9e56('0x57')+_0x20a338;return db[_0x9e56('0x58')][_0x9e56('0x33')](_0x1c7d6f,{'type':db[_0x9e56('0x59')][_0x9e56('0x5a')][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15})['then'](function(_0x110844){_0x74aa7f=_[_0x9e56('0x2e')](_0x110844,function(_0x428b09){return Number(_0x428b09[_0x9e56('0x5c')]);});})[_0x9e56('0x28')](function(){var _0x16ba74=_0x9e56('0x5d')+_0x20a338;return db['sequelize'][_0x9e56('0x33')](_0x16ba74,{'type':db['Sequelize'][_0x9e56('0x5a')][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x3a54cd){var _0x44285d=_[_0x9e56('0x2e')](_0x3a54cd,function(_0x86b869){return Number(_0x86b869['VoiceQueueId']);});return db[_0x9e56('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x74aa7f},'VoiceQueueId':{'$in':_0x44285d}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x3e16eb='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x20a338;return db[_0x9e56('0x58')]['query'](_0x3e16eb,{'type':db[_0x9e56('0x59')]['QueryTypes'][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x2f816a){var _0x2b70dc=_[_0x9e56('0x2e')](_0x2f816a,function(_0xb686de){return Number(_0xb686de[_0x9e56('0x5f')]);});return db['UserMailQueue'][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'MailQueueId':{'$in':_0x2b70dc}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x38be52=_0x9e56('0x60')+_0x20a338;return db['sequelize'][_0x9e56('0x33')](_0x38be52,{'type':db[_0x9e56('0x59')][_0x9e56('0x5a')][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x5e832a){var _0x4d293d=_[_0x9e56('0x2e')](_0x5e832a,function(_0x1b0231){return Number(_0x1b0231['SmsQueueId']);});return db[_0x9e56('0x61')][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'SmsQueueId':{'$in':_0x4d293d}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x362168=_0x9e56('0x62')+_0x20a338;return db[_0x9e56('0x58')][_0x9e56('0x33')](_0x362168,{'type':db[_0x9e56('0x59')][_0x9e56('0x5a')]['SELECT'],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0xc2e2b7){var _0x425b0d=_[_0x9e56('0x2e')](_0xc2e2b7,function(_0x350bd2){return Number(_0x350bd2[_0x9e56('0x63')]);});return db[_0x9e56('0x64')][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'ChatQueueId':{'$in':_0x425b0d}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x4e9913=_0x9e56('0x65')+_0x20a338;return db[_0x9e56('0x58')][_0x9e56('0x33')](_0x4e9913,{'type':db['Sequelize'][_0x9e56('0x5a')][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x4437f4){var _0x573cf8=_[_0x9e56('0x2e')](_0x4437f4,function(_0x22878a){return Number(_0x22878a[_0x9e56('0x66')]);});return db['UserFaxQueue'][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'FaxQueueId':{'$in':_0x573cf8}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x38079d=_0x9e56('0x67')+_0x20a338;return db[_0x9e56('0x58')]['query'](_0x38079d,{'type':db[_0x9e56('0x59')]['QueryTypes'][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x5b8629){var _0x527716=_['map'](_0x5b8629,function(_0x2b6d72){return Number(_0x2b6d72[_0x9e56('0x68')]);});return db[_0x9e56('0x69')][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'OpenchannelQueueId':{'$in':_0x527716}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){var _0x1d774e=_0x9e56('0x6a')+_0x20a338;return db[_0x9e56('0x58')][_0x9e56('0x33')](_0x1d774e,{'type':db[_0x9e56('0x59')][_0x9e56('0x5a')][_0x9e56('0x5b')],'raw':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x18167e){var _0x4d8edf=_[_0x9e56('0x2e')](_0x18167e,function(_0x57da40){return Number(_0x57da40[_0x9e56('0x6b')]);});return db['UserWhatsappQueue'][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'WhatsappQueueId':{'$in':_0x4d8edf}},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){return db[_0x9e56('0x6c')][_0x9e56('0x49')]({'where':{'TeamId':_0x20a338}});})[_0x9e56('0x28')](function(_0x418f0f){if(_0x418f0f===null){return;}return db[_0x9e56('0x6d')][_0x9e56('0x55')]({'where':{'UserId':{'$in':_0x74aa7f},'VoicePrefixId':_0x418f0f['VoicePrefixId']},'transaction':_0x483f15});})[_0x9e56('0x28')](function(){return db['Team'][_0x9e56('0x55')]({'where':{'id':_0x20a338},'cascade':!![],'transaction':_0x483f15});})[_0x9e56('0x28')](function(_0x6be307){if(_0x6be307===0x0){_0x10e9ea['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x9e56('0x55')]({'where':{'type':_0x9e56('0x6e'),'resourceId':_0x20a338},'cascade':!![],'transaction':_0x483f15})[_0x9e56('0x28')](function(){_0x10e9ea[_0x9e56('0x1f')](0xcc)[_0x9e56('0x1e')]();});}})[_0x9e56('0x52')](function(_0x228e8a){_0x10e9ea['status'](0x1f4)[_0x9e56('0x2c')](_0x228e8a);});});};exports[_0x9e56('0x6f')]=function(_0x236475,_0x1bda6b,_0xa16b9b){return db[_0x9e56('0x2f')][_0x9e56('0x70')]({'where':{'id':_0x236475[_0x9e56('0x56')]['id']}})[_0x9e56('0x28')](handleEntityNotFound(_0x1bda6b,null))[_0x9e56('0x28')](function(_0x3075a1){if(!_0x236475[_0x9e56('0x33')][_0x9e56('0x71')]||!utils['isValidChannel'](_0x236475['query'][_0x9e56('0x71')])){throw new db[(_0x9e56('0x59'))][(_0x9e56('0x72'))](_0x9e56('0x73'));}var _0x550644={};var _0x14b3bd={};_0x14b3bd[_0x9e56('0x32')]=_[_0x9e56('0x34')](db[_[_0x9e56('0x74')](_0x236475[_0x9e56('0x33')]['channel'][_0x9e56('0x75')]())+_0x9e56('0x76')][_0x9e56('0x30')]);_0x14b3bd[_0x9e56('0x33')]=_[_0x9e56('0x34')](_0x236475['query']);_0x14b3bd[_0x9e56('0x35')]=_[_0x9e56('0x36')](_0x14b3bd[_0x9e56('0x32')],_0x14b3bd[_0x9e56('0x33')]);_0x550644[_0x9e56('0x37')]=_[_0x9e56('0x36')](_0x14b3bd[_0x9e56('0x32')],qs[_0x9e56('0x38')](_0x236475[_0x9e56('0x33')][_0x9e56('0x38')]));_0x550644[_0x9e56('0x37')]=_0x550644[_0x9e56('0x37')]['length']?_0x550644['attributes']:_0x14b3bd[_0x9e56('0x32')];_0x550644[_0x9e56('0x24')]=qs[_0x9e56('0x24')](_0x236475[_0x9e56('0x33')][_0x9e56('0x24')]);_0x550644[_0x9e56('0x23')]=qs[_0x9e56('0x23')](_0x236475[_0x9e56('0x33')][_0x9e56('0x23')]);_0x550644[_0x9e56('0x3c')]=qs[_0x9e56('0x3d')](_0x236475[_0x9e56('0x33')][_0x9e56('0x3d')]);_0x550644[_0x9e56('0x40')]=qs['filters'](_[_0x9e56('0x3e')](_0x236475['query'],_0x14b3bd[_0x9e56('0x35')]));_0x550644=_[_0x9e56('0x41')]({},_0x550644,_0x236475[_0x9e56('0x43')]);return _0x3075a1['get'+_[_0x9e56('0x74')](_0x236475[_0x9e56('0x33')]['channel'][_0x9e56('0x75')]())+_0x9e56('0x77')](_0x550644);})['then'](respondWithResult(_0x1bda6b,null))['catch'](handleError(_0x1bda6b,null));};exports[_0x9e56('0x78')]=function(_0x28bae8,_0x446394,_0x42d3cd){return db[_0x9e56('0x2f')][_0x9e56('0x70')]({'where':{'id':_0x28bae8[_0x9e56('0x56')]['id']}})[_0x9e56('0x28')](function(_0x44e3eb){if(_0x44e3eb){if(!_0x28bae8['body'][_0x9e56('0x71')]||!utils[_0x9e56('0x79')](_0x28bae8[_0x9e56('0x4b')][_0x9e56('0x71')])){throw new db[(_0x9e56('0x59'))]['ValidationError'](_0x9e56('0x73'));}return _0x44e3eb['add'+_[_0x9e56('0x74')](_0x28bae8[_0x9e56('0x4b')][_0x9e56('0x71')][_0x9e56('0x75')]())+'Queues'](_0x28bae8[_0x9e56('0x4b')][_0x9e56('0x7a')]);}return null;})[_0x9e56('0x28')](handleEntityNotFound(_0x446394,null))[_0x9e56('0x28')](respondWithStatusCode(_0x446394,null))['catch'](handleError(_0x446394,null));};exports[_0x9e56('0x7b')]=function(_0x23d6f2,_0x3f3962,_0x58afb5){return db['Team'][_0x9e56('0x70')]({'where':{'id':_0x23d6f2[_0x9e56('0x56')]['id']}})[_0x9e56('0x28')](function(_0x181148){if(_0x181148){if(!_0x23d6f2[_0x9e56('0x33')]['channel']||!utils['isValidChannel'](_0x23d6f2[_0x9e56('0x33')][_0x9e56('0x71')])){throw new db['Sequelize'][(_0x9e56('0x72'))](_0x9e56('0x73'));}return _0x181148[_0x9e56('0x7c')+_[_0x9e56('0x74')](_0x23d6f2[_0x9e56('0x33')]['channel'][_0x9e56('0x75')]())+_0x9e56('0x77')](_0x23d6f2[_0x9e56('0x33')]['ids']);}return null;})['then'](handleEntityNotFound(_0x3f3962,null))[_0x9e56('0x28')](respondWithStatusCode(_0x3f3962,null))[_0x9e56('0x52')](handleError(_0x3f3962,null));};exports[_0x9e56('0x7d')]=function(_0x40e69a,_0x114826){var _0x23aeed=_[_0x9e56('0x7e')](_0x40e69a['body'][_0x9e56('0x7a')])?_0x40e69a[_0x9e56('0x4b')][_0x9e56('0x7a')]:[_0x40e69a['body']['ids']];var _0x4daac7=_0x40e69a['params']['id'];return db[_0x9e56('0x2f')][_0x9e56('0x49')]({'where':{'id':_0x4daac7}})[_0x9e56('0x28')](handleEntityNotFound(_0x114826,null))[_0x9e56('0x28')](function(_0x21c61a){if(_0x21c61a){var _0x36ac12=[_0x9e56('0x7f'),_0x9e56('0x80'),_0x9e56('0x81'),_0x9e56('0x82'),'Fax',_0x9e56('0x83'),_0x9e56('0x84')];return db[_0x9e56('0x58')][_0x9e56('0x85')](function(_0x11cef6){var _0xc792f8=_[_0x9e56('0x2e')](_0x36ac12,function(_0x3d6134){var _0x388482={'attributes':['id','name']};if(_0x3d6134===_0x9e56('0x7f')){_0x388482[_0x9e56('0x86')]={'attributes':['penalty']};}return _0x21c61a['get'+_0x3d6134+'Queues'](_0x388482)[_0x9e56('0x28')](function(_0x549116){var _0x36f925=_[_0x9e56('0x2e')](_0x549116,function(_0x185a27){var _0x259dc9=_[_0x9e56('0x2e')](_0x23aeed,function(_0x501d9a){var _0x3cc1a6={'where':{'UserId':_0x501d9a,[_0x3d6134+_0x9e56('0x87')]:_0x185a27['id']},'transaction':_0x11cef6};if(_0x3d6134===_0x9e56('0x7f')){_0x3cc1a6[_0x9e56('0x18')]={'penalty':_0x185a27[_0x9e56('0x88')][_0x9e56('0x89')]};}return db[_0x9e56('0x8a')+_0x3d6134+_0x9e56('0x76')]['findOrCreate'](_0x3cc1a6)[_0x9e56('0x28')](function(){socket['emit'](_0x9e56('0x8b')+_0x3d6134+_0x9e56('0x8c'),{'UserId':_0x501d9a,[_0x3d6134+_0x9e56('0x87')]:_0x185a27['id']});if(_0x3d6134!==_0x9e56('0x7f')){return;}return db[_0x9e56('0x8a')][_0x9e56('0x46')]({'where':{'id':_0x23aeed,'online':0x1},'attributes':['id',_0x9e56('0x2b'),_0x9e56('0x8d'),'voicePause',_0x9e56('0x8e')],'raw':!![]})[_0x9e56('0x28')](function(_0x689aa){var _0x31a19e=_[_0x9e56('0x2e')](_0x689aa,function(_0x4b95ce){return db[_0x9e56('0x8f')][_0x9e56('0x90')]({'membername':_0x4b95ce['name'],'UserId':_0x4b95ce['id'],'queue_name':_0x185a27[_0x9e56('0x2b')],'VoiceQueueId':_0x185a27['id'],'interface':_[_0x9e56('0x91')](_0x4b95ce[_0x9e56('0x8e')])?util[_0x9e56('0x92')](_0x9e56('0x93'),_0x4b95ce[_0x9e56('0x2b')]):_0x4b95ce['interface'],'paused':_0x4b95ce[_0x9e56('0x94')]||![],'penalty':_0x185a27['TeamVoiceQueue'][_0x9e56('0x89')]},{'transaction':_0x11cef6});});return Promise[_0x9e56('0x95')](_0x31a19e);});});});return Promise[_0x9e56('0x95')](_0x259dc9);});return Promise['all'](_0x36f925);})[_0x9e56('0x28')](function(){return db[_0x9e56('0x6c')]['findOne']({'where':{'teamId':_0x4daac7}})[_0x9e56('0x28')](function(_0x386946){if(_0x386946){var _0x526ef5=_[_0x9e56('0x2e')](_0x23aeed,function(_0x41a8fc){db['UserVoicePrefix'][_0x9e56('0x90')]({'UserId':_0x41a8fc,'VoicePrefixId':_0x386946[_0x9e56('0x96')]});});return Promise[_0x9e56('0x95')](_0x526ef5);}});});});return Promise[_0x9e56('0x95')](_0xc792f8)['then'](function(){return _0x21c61a[_0x9e56('0x7d')](_0x23aeed,{'transaction':_0x11cef6})['spread'](function(_0x5b306d){return _0x5b306d;});});});}})[_0x9e56('0x28')](respondWithResult(_0x114826,null))[_0x9e56('0x52')](handleError(_0x114826,null));};exports[_0x9e56('0x97')]=function(_0xa63fc7,_0x414e3d){var _0x55f129=_[_0x9e56('0x7e')](_0xa63fc7[_0x9e56('0x33')]['ids'])?_0xa63fc7[_0x9e56('0x33')]['ids']:[_0xa63fc7[_0x9e56('0x33')][_0x9e56('0x7a')]];var _0x5db997=_0xa63fc7[_0x9e56('0x56')]['id'];return db[_0x9e56('0x2f')][_0x9e56('0x49')]({'where':{'id':_0x5db997}})[_0x9e56('0x28')](handleEntityNotFound(_0x414e3d,null))[_0x9e56('0x28')](function(_0x43cb99){if(_0x43cb99){var _0x594971=[_0x9e56('0x7f'),_0x9e56('0x80'),_0x9e56('0x81'),'Sms',_0x9e56('0x98'),_0x9e56('0x83'),_0x9e56('0x84')];return db['sequelize'][_0x9e56('0x85')](function(_0x1e8d7a){var _0x5c329b=_[_0x9e56('0x2e')](_0x594971,function(_0x1b2ea8){var _0x3472c0={'attributes':['id',_0x9e56('0x2b')]};return _0x43cb99[_0x9e56('0x4d')+_0x1b2ea8+_0x9e56('0x77')](_0x3472c0)[_0x9e56('0x28')](function(_0x420898){var _0x30591b=_[_0x9e56('0x2e')](_0x420898,function(_0x22aa99){return _0x22aa99[_0x9e56('0x97')](_0x55f129,{'transaction':_0x1e8d7a})[_0x9e56('0x28')](function(){var _0x5d73cf=_[_0x9e56('0x2e')](_0x55f129,function(_0x14dbba){socket['emit'](_0x9e56('0x8b')+_0x1b2ea8+'Queue:remove',{'UserId':Number(_0x14dbba),[_0x1b2ea8+_0x9e56('0x87')]:_0x22aa99['id']});if(_0x1b2ea8!==_0x9e56('0x7f')){return;}return db['UserVoiceQueueRt'][_0x9e56('0x55')]({'where':{'VoiceQueueId':_0x22aa99['id'],'UserId':_0x14dbba},'transaction':_0x1e8d7a});});return Promise[_0x9e56('0x95')](_0x5d73cf);});});return Promise[_0x9e56('0x95')](_0x30591b);});});return Promise[_0x9e56('0x95')](_0x5c329b)[_0x9e56('0x28')](function(){return _0x43cb99[_0x9e56('0x97')](_0x55f129,{'transaction':_0x1e8d7a});})[_0x9e56('0x28')](function(){return db['TeamVoicePrefix'][_0x9e56('0x70')]({'where':{'teamId':_0x5db997}})[_0x9e56('0x28')](function(_0x450556){if(_0x450556){var _0x4b0a41=_[_0x9e56('0x2e')](_0x55f129,function(_0x2eee9a){db[_0x9e56('0x6d')][_0x9e56('0x55')]({'where':{'UserId':_0x2eee9a,'VoicePrefixId':_0x450556['VoicePrefixId']}});});return Promise[_0x9e56('0x95')](_0x4b0a41);}});});});}})[_0x9e56('0x28')](respondWithStatusCode(_0x414e3d,null))[_0x9e56('0x52')](handleError(_0x414e3d,null));};exports[_0x9e56('0x99')]=function(_0x3bf4b7,_0x5ccc36,_0x4769fb){var _0x26d019={};var _0x537938={};var _0xebda39;var _0x80a5af;return db[_0x9e56('0x2f')]['findOne']({'where':{'id':_0x3bf4b7['params']['id']}})[_0x9e56('0x28')](handleEntityNotFound(_0x5ccc36,null))[_0x9e56('0x28')](function(_0x3da6f1){if(_0x3da6f1){_0xebda39=_0x3da6f1;_0x537938[_0x9e56('0x32')]=_[_0x9e56('0x34')](db[_0x9e56('0x8a')][_0x9e56('0x30')]);_0x537938[_0x9e56('0x33')]=_['keys'](_0x3bf4b7[_0x9e56('0x33')]);_0x537938['filters']=_['intersection'](_0x537938['model'],_0x537938[_0x9e56('0x33')]);_0x26d019[_0x9e56('0x37')]=_['intersection'](_0x537938['model'],qs[_0x9e56('0x38')](_0x3bf4b7[_0x9e56('0x33')][_0x9e56('0x38')]));_0x26d019[_0x9e56('0x37')]=_0x26d019[_0x9e56('0x37')][_0x9e56('0x39')]?_0x26d019['attributes']:_0x537938[_0x9e56('0x32')];_0x26d019[_0x9e56('0x3c')]=qs[_0x9e56('0x3d')](_0x3bf4b7[_0x9e56('0x33')][_0x9e56('0x3d')]);_0x26d019[_0x9e56('0x40')]=qs[_0x9e56('0x35')](_[_0x9e56('0x3e')](_0x3bf4b7[_0x9e56('0x33')],_0x537938[_0x9e56('0x35')]));if(_0x3bf4b7['query']['filter']){_0x26d019[_0x9e56('0x40')]=_[_0x9e56('0x41')](_0x26d019[_0x9e56('0x40')],{'$or':_[_0x9e56('0x2e')](_0x26d019[_0x9e56('0x37')],function(_0x12771f){var _0xc834d0={};_0xc834d0[_0x12771f]={'$like':'%'+_0x3bf4b7[_0x9e56('0x33')]['filter']+'%'};return _0xc834d0;})});}_0x26d019=_[_0x9e56('0x41')]({},_0x26d019,_0x3bf4b7[_0x9e56('0x43')]);return _0xebda39[_0x9e56('0x99')](_0x26d019);}})['then'](function(_0x5351c8){if(_0x5351c8){_0x80a5af=_0x5351c8['length'];if(!_0x3bf4b7[_0x9e56('0x33')][_0x9e56('0x3a')]('nolimit')){_0x26d019[_0x9e56('0x24')]=qs['limit'](_0x3bf4b7[_0x9e56('0x33')][_0x9e56('0x24')]);_0x26d019[_0x9e56('0x23')]=qs['offset'](_0x3bf4b7[_0x9e56('0x33')][_0x9e56('0x23')]);}return _0xebda39[_0x9e56('0x99')](_0x26d019);}})['then'](function(_0x1bab60){if(_0x1bab60){return _0x1bab60?{'count':_0x80a5af,'rows':_0x1bab60}:null;}})[_0x9e56('0x28')](respondWithResult(_0x5ccc36,null))['catch'](handleError(_0x5ccc36,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f1e8c20..a5af1a9 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 _0x5eb0=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x141f88,_0x2db303){var _0x436d8a=function(_0x487bc0){while(--_0x487bc0){_0x141f88['push'](_0x141f88['shift']());}};_0x436d8a(++_0x2db303);}(_0x5eb0,0x66));var _0x05eb=function(_0x4ac0c4,_0x150917){_0x4ac0c4=_0x4ac0c4-0x0;var _0xb23ee6=_0x5eb0[_0x4ac0c4];return _0xb23ee6;};'use strict';var EventEmitter=require(_0x05eb('0x0'));var Team=require(_0x05eb('0x1'))['db'][_0x05eb('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x05eb('0x3')](0x0);var events={'afterCreate':_0x05eb('0x4'),'afterUpdate':_0x05eb('0x5'),'afterDestroy':_0x05eb('0x6')};function emitEvent(_0x1fa8c5){return function(_0x5c8161,_0x3ffde4,_0x4e7757){TeamEvents['emit'](_0x1fa8c5+':'+_0x5c8161['id'],_0x5c8161);TeamEvents[_0x05eb('0x7')](_0x1fa8c5,_0x5c8161);_0x4e7757(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x05eb('0x8')](e,emitEvent(event));}}module[_0x05eb('0x9')]=TeamEvents; \ No newline at end of file +var _0x1d1f=['hook','exports','events','../../mysqldb','Team','save','update','remove','emit','hasOwnProperty'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x1d1f,0xd4));var _0xf1d1=function(_0x51a8b3,_0x35a867){_0x51a8b3=_0x51a8b3-0x0;var _0x370673=_0x1d1f[_0x51a8b3];return _0x370673;};'use strict';var EventEmitter=require(_0xf1d1('0x0'));var Team=require(_0xf1d1('0x1'))['db'][_0xf1d1('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1d1('0x3'),'afterUpdate':_0xf1d1('0x4'),'afterDestroy':_0xf1d1('0x5')};function emitEvent(_0x259d7a){return function(_0x2c67c8,_0x217c53,_0x478df6){TeamEvents['emit'](_0x259d7a+':'+_0x2c67c8['id'],_0x2c67c8);TeamEvents[_0xf1d1('0x6')](_0x259d7a,_0x2c67c8);_0x478df6(null);};}for(var e in events){if(events[_0xf1d1('0x7')](e)){var event=events[e];Team[_0xf1d1('0x8')](e,emitEvent(event));}}module[_0xf1d1('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 45523de..133eb2c 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 _0xa046=['Openchannel','Sms','Voice','resolve','all','lodash','get','then','map','setDataValue','catch','teams','Chat'];(function(_0x586e32,_0x154e9e){var _0x42f8b1=function(_0x31b758){while(--_0x31b758){_0x586e32['push'](_0x586e32['shift']());}};_0x42f8b1(++_0x154e9e);}(_0xa046,0x14a));var _0x6a04=function(_0x4604e1,_0x2d7cb2){_0x4604e1=_0x4604e1-0x0;var _0x3b2b80=_0xa046[_0x4604e1];return _0x3b2b80;};'use strict';var _=require(_0x6a04('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x1d80ee,_0x12be59){var _0x2288cf=_0x6a04('0x1')+_0x12be59+'Queues';return _0x1d80ee[_0x2288cf]()[_0x6a04('0x2')](function(_0x5f20cf){return _[_0x6a04('0x3')](_0x5f20cf,function(_0x3927e8){_0x3927e8[_0x6a04('0x4')]('channel',_0x12be59);return _0x3927e8;});})[_0x6a04('0x5')](function(_0x42075c){throw _0x42075c;});}module['exports']=function(_0x5dcfb6){return _0x5dcfb6['define']('Team',attributes,{'tableName':_0x6a04('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x53acdf=this;var _0x24892d=[_0x6a04('0x7'),'Fax','Mail',_0x6a04('0x8'),_0x6a04('0x9'),_0x6a04('0xa'),'Whatsapp'];return Promise[_0x6a04('0xb')]()[_0x6a04('0x2')](function(){var _0x4b404c=_['map'](_0x24892d,function(_0x5ed853){return getQueuesByChannel(_0x53acdf,_0x5ed853);});return Promise[_0x6a04('0xc')](_0x4b404c);})['catch'](function(_0x17cd21){throw _0x17cd21;});}}});}; \ No newline at end of file +var _0x0fc2=['resolve','all','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x0fc2,0xfe));var _0x20fc=function(_0x494467,_0x459459){_0x494467=_0x494467-0x0;var _0x331b9b=_0x0fc2[_0x494467];return _0x331b9b;};'use strict';var _=require('lodash');var attributes=require(_0x20fc('0x0'));function getQueuesByChannel(_0xbf5d86,_0x22e2af){var _0x2d25a5='get'+_0x22e2af+_0x20fc('0x1');return _0xbf5d86[_0x2d25a5]()[_0x20fc('0x2')](function(_0x1e8b28){return _[_0x20fc('0x3')](_0x1e8b28,function(_0x582a37){_0x582a37[_0x20fc('0x4')](_0x20fc('0x5'),_0x22e2af);return _0x582a37;});})[_0x20fc('0x6')](function(_0x248a6f){throw _0x248a6f;});}module[_0x20fc('0x7')]=function(_0x51e341){return _0x51e341[_0x20fc('0x8')]('Team',attributes,{'tableName':_0x20fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x17a234=this;var _0x4661e4=[_0x20fc('0xa'),_0x20fc('0xb'),_0x20fc('0xc'),_0x20fc('0xd'),_0x20fc('0xe'),'Voice',_0x20fc('0xf')];return Promise[_0x20fc('0x10')]()[_0x20fc('0x2')](function(){var _0x5aeebf=_[_0x20fc('0x3')](_0x4661e4,function(_0x57f588){return getQueuesByChannel(_0x17a234,_0x57f588);});return Promise[_0x20fc('0x11')](_0x5aeebf);})['catch'](function(_0x5e1623){throw _0x5e1623;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d50b628..8200491 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 _0x2454=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./team.socket','register','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2454,0xd1));var _0x4245=function(_0xa2c960,_0xfd47ac){_0xa2c960=_0xa2c960-0x0;var _0x1f91d1=_0x2454[_0xa2c960];return _0x1f91d1;};'use strict';var _=require(_0x4245('0x0'));var util=require(_0x4245('0x1'));var moment=require(_0x4245('0x2'));var BPromise=require(_0x4245('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4245('0x4'));var db=require(_0x4245('0x5'))['db'];var utils=require(_0x4245('0x6'));var logger=require(_0x4245('0x7'))(_0x4245('0x8'));var config=require(_0x4245('0x9'));var jayson=require(_0x4245('0xa'));var client=jayson[_0x4245('0xb')]['http']({'port':0x232a});config['redis']=_[_0x4245('0xc')](config[_0x4245('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4245('0xe'))(new Redis(config['redis']));require(_0x4245('0xf'))[_0x4245('0x10')](socket);function respondWithRpcPromise(_0x31ad83,_0x44f755,_0x2544b5){return new BPromise(function(_0x237cc8,_0x5e365d){return client['request'](_0x31ad83,_0x2544b5)[_0x4245('0x11')](function(_0x10cf5b){logger[_0x4245('0x12')]('Team,\x20%s,\x20%s',_0x44f755,_0x4245('0x13'));logger[_0x4245('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x44f755,_0x4245('0x13'),JSON[_0x4245('0x15')](_0x10cf5b));if(_0x10cf5b[_0x4245('0x16')]){if(_0x10cf5b['error']['code']===0x1f4){logger['error'](_0x4245('0x17'),_0x44f755,_0x10cf5b[_0x4245('0x16')][_0x4245('0x18')]);return _0x5e365d(_0x10cf5b[_0x4245('0x16')][_0x4245('0x18')]);}logger[_0x4245('0x16')](_0x4245('0x17'),_0x44f755,_0x10cf5b[_0x4245('0x16')][_0x4245('0x18')]);return _0x237cc8(_0x10cf5b[_0x4245('0x16')][_0x4245('0x18')]);}else{logger[_0x4245('0x12')](_0x4245('0x17'),_0x44f755,_0x4245('0x13'));_0x237cc8(_0x10cf5b[_0x4245('0x19')][_0x4245('0x18')]);}})[_0x4245('0x1a')](function(_0x315198){logger[_0x4245('0x16')](_0x4245('0x17'),_0x44f755,_0x315198);_0x5e365d(_0x315198);});});} \ No newline at end of file +var _0xe4eb=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then'];(function(_0x4b1475,_0x41bf4c){var _0x3153e6=function(_0x185eac){while(--_0x185eac){_0x4b1475['push'](_0x4b1475['shift']());}};_0x3153e6(++_0x41bf4c);}(_0xe4eb,0x9b));var _0xbe4e=function(_0x7816ac,_0x372d82){_0x7816ac=_0x7816ac-0x0;var _0x531068=_0xe4eb[_0x7816ac];return _0x531068;};'use strict';var _=require(_0xbe4e('0x0'));var util=require(_0xbe4e('0x1'));var moment=require('moment');var BPromise=require(_0xbe4e('0x2'));var rs=require(_0xbe4e('0x3'));var fs=require('fs');var Redis=require(_0xbe4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe4e('0x5'));var logger=require(_0xbe4e('0x6'))(_0xbe4e('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe4e('0x8'));var client=jayson[_0xbe4e('0x9')][_0xbe4e('0xa')]({'port':0x232a});config[_0xbe4e('0xb')]=_[_0xbe4e('0xc')](config[_0xbe4e('0xb')],{'host':_0xbe4e('0xd'),'port':0x18eb});var socket=require(_0xbe4e('0xe'))(new Redis(config[_0xbe4e('0xb')]));require(_0xbe4e('0xf'))[_0xbe4e('0x10')](socket);function respondWithRpcPromise(_0x5c5b77,_0x3dce32,_0x3829b0){return new BPromise(function(_0x515e1c,_0x49f82e){return client[_0xbe4e('0x11')](_0x5c5b77,_0x3829b0)[_0xbe4e('0x12')](function(_0x360b28){logger['info'](_0xbe4e('0x13'),_0x3dce32,_0xbe4e('0x14'));logger[_0xbe4e('0x15')](_0xbe4e('0x16'),_0x3dce32,'request\x20sent',JSON[_0xbe4e('0x17')](_0x360b28));if(_0x360b28[_0xbe4e('0x18')]){if(_0x360b28[_0xbe4e('0x18')][_0xbe4e('0x19')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x3dce32,_0x360b28[_0xbe4e('0x18')]['message']);return _0x49f82e(_0x360b28[_0xbe4e('0x18')][_0xbe4e('0x1a')]);}logger[_0xbe4e('0x18')]('Team,\x20%s,\x20%s',_0x3dce32,_0x360b28['error'][_0xbe4e('0x1a')]);return _0x515e1c(_0x360b28[_0xbe4e('0x18')][_0xbe4e('0x1a')]);}else{logger[_0xbe4e('0x1b')](_0xbe4e('0x13'),_0x3dce32,_0xbe4e('0x14'));_0x515e1c(_0x360b28[_0xbe4e('0x1c')][_0xbe4e('0x1a')]);}})['catch'](function(_0x2a0d09){logger[_0xbe4e('0x18')](_0xbe4e('0x13'),_0x3dce32,_0x2a0d09);_0x49f82e(_0x2a0d09);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 53a6275..9ec98e5 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 _0x43b7=['register','length','./team.events','update','removeListener'];(function(_0x387fe4,_0x186656){var _0x43c1c1=function(_0x19ab90){while(--_0x19ab90){_0x387fe4['push'](_0x387fe4['shift']());}};_0x43c1c1(++_0x186656);}(_0x43b7,0x183));var _0x743b=function(_0x3a2bbc,_0x2e77e1){_0x3a2bbc=_0x3a2bbc-0x0;var _0xb4fb2d=_0x43b7[_0x3a2bbc];return _0xb4fb2d;};'use strict';var TeamEvents=require(_0x743b('0x0'));var events=['save','remove',_0x743b('0x1')];function createListener(_0x56d9c3,_0x2e177a){return function(_0x320b11){_0x2e177a['emit'](_0x56d9c3,_0x320b11);};}function removeListener(_0x5f0319,_0x45a9a7){return function(){TeamEvents[_0x743b('0x2')](_0x5f0319,_0x45a9a7);};}exports[_0x743b('0x3')]=function(_0x2e8cd2){for(var _0x8d405=0x0,_0x1b25ec=events[_0x743b('0x4')];_0x8d405<_0x1b25ec;_0x8d405++){var _0x515ed3=events[_0x8d405];var _0x542c29=createListener('team:'+_0x515ed3,_0x2e8cd2);TeamEvents['on'](_0x515ed3,_0x542c29);}}; \ No newline at end of file +var _0x553e=['team:','./team.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x553e,0x10f));var _0xe553=function(_0x2e5ca8,_0x14accb){_0x2e5ca8=_0x2e5ca8-0x0;var _0x85d0e3=_0x553e[_0x2e5ca8];return _0x85d0e3;};'use strict';var TeamEvents=require(_0xe553('0x0'));var events=[_0xe553('0x1'),_0xe553('0x2'),_0xe553('0x3')];function createListener(_0x1bd31a,_0x1c6ff9){return function(_0x4fe0af){_0x1c6ff9[_0xe553('0x4')](_0x1bd31a,_0x4fe0af);};}function removeListener(_0x1492b2,_0x249d2e){return function(){TeamEvents[_0xe553('0x5')](_0x1492b2,_0x249d2e);};}exports[_0xe553('0x6')]=function(_0x1c2149){for(var _0x325813=0x0,_0x4c7741=events[_0xe553('0x7')];_0x325813<_0x4c7741;_0x325813++){var _0x2daac8=events[_0x325813];var _0x2edbc5=createListener(_0xe553('0x8')+_0x2daac8,_0x1c2149);TeamEvents['on'](_0x2daac8,_0x2edbc5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index f528c94..4748a08 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 _0xe3db=['exports','INTEGER','sequelize'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xe3db,0xc8));var _0xbe3d=function(_0x2467a6,_0x358a29){_0x2467a6=_0x2467a6-0x0;var _0x1c37c3=_0xe3db[_0x2467a6];return _0x1c37c3;};'use strict';var Sequelize=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xbe3d('0x2')]}}; \ No newline at end of file +var _0x668b=['exports','INTEGER','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x668b,0x140));var _0xb668=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x668b[_0x2f57b2];return _0x5ace77;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 095c421..a7be661 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 _0x9af1=['../../config/environment','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x31c222,_0x5eb2d4){var _0x442b04=function(_0x13dd73){while(--_0x13dd73){_0x31c222['push'](_0x31c222['shift']());}};_0x442b04(++_0x5eb2d4);}(_0x9af1,0x68));var _0x19af=function(_0x5878aa,_0x32bf6a){_0x5878aa=_0x5878aa-0x0;var _0x1243fd=_0x9af1[_0x5878aa];return _0x1243fd;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var logger=require(_0x19af('0x2'))('api');var moment=require(_0x19af('0x3'));var BPromise=require(_0x19af('0x4'));var rp=require(_0x19af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19af('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x19af('0x7')]=function(_0x157fc9,_0x41a50f){return _0x157fc9[_0x19af('0x8')](_0x19af('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a79=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger'];(function(_0xf7a843,_0x37021e){var _0x255bfb=function(_0x45d454){while(--_0x45d454){_0xf7a843['push'](_0xf7a843['shift']());}};_0x255bfb(++_0x37021e);}(_0x3a79,0xca));var _0x93a7=function(_0x10d07c,_0xca15e6){_0x10d07c=_0x10d07c-0x0;var _0x8a7c4a=_0x3a79[_0x10d07c];return _0x8a7c4a;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var logger=require(_0x93a7('0x1'))('api');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rp=require(_0x93a7('0x4'));var fs=require('fs');var path=require(_0x93a7('0x5'));var rimraf=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));var attributes=require(_0x93a7('0x8'));module['exports']=function(_0x2976b2,_0x4efb20){return _0x2976b2[_0x93a7('0x9')](_0x93a7('0xa'),attributes,{'tableName':_0x93a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c3bdb38..cb228e8 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x375de5,_0x474675){var _0x5cb54e=function(_0x130331){while(--_0x130331){_0x375de5['push'](_0x375de5['shift']());}};_0x5cb54e(++_0x474675);}(_0xe706,0xa3));var _0x6e70=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xe706[_0x1903aa];return _0x51fe28;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x439ae8,_0x47fc0a){var _0x13f5dc=function(_0x42ec75){while(--_0x42ec75){_0x439ae8['push'](_0x439ae8['shift']());}};_0x13f5dc(++_0x47fc0a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xcb91[_0x2d61ac];return _0x3f7d3c;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2ddf13e..2b366bf 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 _0x6b60=['exports'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x6b60,0xe9));var _0x06b6=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x6b60[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require('sequelize');module[_0x06b6('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9cf1=['exports'];(function(_0x5a4779,_0x414192){var _0xa96b80=function(_0x3a07e5){while(--_0x3a07e5){_0x5a4779['push'](_0x5a4779['shift']());}};_0xa96b80(++_0x414192);}(_0x9cf1,0xc1));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x19cf('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 8707ef3..6a13dfc 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 _0xcf95=['TeamVoiceQueue','lodash','util','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var util=require(_0x5cf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5cf9('0x2'));var rp=require(_0x5cf9('0x3'));var fs=require('fs');var path=require(_0x5cf9('0x4'));var rimraf=require(_0x5cf9('0x5'));var config=require('../../config/environment');var attributes=require(_0x5cf9('0x6'));module[_0x5cf9('0x7')]=function(_0x5b060f,_0x498d14){return _0x5b060f[_0x5cf9('0x8')](_0x5cf9('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9658=['team_has_voice_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','TeamVoiceQueue'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x9658,0x6f));var _0x8965=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x9658[_0x4c05da];return _0x1614db;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var logger=require(_0x8965('0x1'))(_0x8965('0x2'));var moment=require('moment');var BPromise=require(_0x8965('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8965('0x4'));var rimraf=require(_0x8965('0x5'));var config=require(_0x8965('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x8965('0x7')]=function(_0x20493e,_0x1d0745){return _0x20493e[_0x8965('0x8')](_0x8965('0x9'),attributes,{'tableName':_0x8965('0xa'),'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 7f28d12..d795a05 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 _0x87e6=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x320f49,_0x3a28d9){var _0x5c5e1a=function(_0x2398ca){while(--_0x2398ca){_0x320f49['push'](_0x320f49['shift']());}};_0x5c5e1a(++_0x3a28d9);}(_0x87e6,0x1a3));var _0x687e=function(_0x24cbb7,_0xf71bbd){_0x24cbb7=_0x24cbb7-0x0;var _0x22ddd2=_0x87e6[_0x24cbb7];return _0x22ddd2;};'use strict';var _=require(_0x687e('0x0'));var util=require(_0x687e('0x1'));var moment=require(_0x687e('0x2'));var BPromise=require(_0x687e('0x3'));var rs=require(_0x687e('0x4'));var fs=require('fs');var Redis=require(_0x687e('0x5'));var db=require(_0x687e('0x6'))['db'];var utils=require(_0x687e('0x7'));var logger=require(_0x687e('0x8'))(_0x687e('0x9'));var config=require('../../config/environment');var jayson=require(_0x687e('0xa'));var client=jayson[_0x687e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5eec,_0xf19ed2,_0x2b50f0){return new BPromise(function(_0x2f074a,_0x7cf8cb){return client[_0x687e('0xc')](_0x4d5eec,_0x2b50f0)[_0x687e('0xd')](function(_0x61b4c3){logger[_0x687e('0xe')](_0x687e('0xf'),_0xf19ed2,_0x687e('0x10'));logger['debug'](_0x687e('0x11'),_0xf19ed2,_0x687e('0x10'),JSON[_0x687e('0x12')](_0x61b4c3));if(_0x61b4c3[_0x687e('0x13')]){if(_0x61b4c3['error'][_0x687e('0x14')]===0x1f4){logger[_0x687e('0x13')](_0x687e('0xf'),_0xf19ed2,_0x61b4c3[_0x687e('0x13')][_0x687e('0x15')]);return _0x7cf8cb(_0x61b4c3[_0x687e('0x13')]['message']);}logger['error'](_0x687e('0xf'),_0xf19ed2,_0x61b4c3['error']['message']);return _0x2f074a(_0x61b4c3[_0x687e('0x13')][_0x687e('0x15')]);}else{logger[_0x687e('0xe')](_0x687e('0xf'),_0xf19ed2,_0x687e('0x10'));_0x2f074a(_0x61b4c3['result'][_0x687e('0x15')]);}})[_0x687e('0x16')](function(_0x445942){logger[_0x687e('0x13')](_0x687e('0xf'),_0xf19ed2,_0x445942);_0x7cf8cb(_0x445942);});});} \ No newline at end of file +var _0xd200=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xfd9e5b,_0x1885d2){var _0x41e4ef=function(_0x4a90ad){while(--_0x4a90ad){_0xfd9e5b['push'](_0xfd9e5b['shift']());}};_0x41e4ef(++_0x1885d2);}(_0xd200,0x7d));var _0x0d20=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xd200[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x0d20('0x0'));var util=require(_0x0d20('0x1'));var moment=require(_0x0d20('0x2'));var BPromise=require(_0x0d20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d20('0x4'));var db=require(_0x0d20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d20('0x6'))('rpc');var config=require(_0x0d20('0x7'));var jayson=require(_0x0d20('0x8'));var client=jayson[_0x0d20('0x9')][_0x0d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd4c4,_0x1c779c,_0x564056){return new BPromise(function(_0x2ab54b,_0x1a1be6){return client[_0x0d20('0xb')](_0x3bd4c4,_0x564056)[_0x0d20('0xc')](function(_0x209575){logger[_0x0d20('0xd')](_0x0d20('0xe'),_0x1c779c,_0x0d20('0xf'));logger[_0x0d20('0x10')](_0x0d20('0x11'),_0x1c779c,_0x0d20('0xf'),JSON[_0x0d20('0x12')](_0x209575));if(_0x209575[_0x0d20('0x13')]){if(_0x209575[_0x0d20('0x13')][_0x0d20('0x14')]===0x1f4){logger[_0x0d20('0x13')](_0x0d20('0xe'),_0x1c779c,_0x209575[_0x0d20('0x13')][_0x0d20('0x15')]);return _0x1a1be6(_0x209575[_0x0d20('0x13')][_0x0d20('0x15')]);}logger[_0x0d20('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1c779c,_0x209575[_0x0d20('0x13')]['message']);return _0x2ab54b(_0x209575[_0x0d20('0x13')][_0x0d20('0x15')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x1c779c,_0x0d20('0xf'));_0x2ab54b(_0x209575['result'][_0x0d20('0x15')]);}})[_0x0d20('0x16')](function(_0x2cc8c6){logger[_0x0d20('0x13')](_0x0d20('0xe'),_0x1c779c,_0x2cc8c6);_0x1a1be6(_0x2cc8c6);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dfe2dda..a085eea 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 _0x297f=['delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x2b3825,_0x41bb86){var _0x4734be=function(_0x41a0cc){while(--_0x41a0cc){_0x2b3825['push'](_0x2b3825['shift']());}};_0x4734be(++_0x41bb86);}(_0x297f,0x1f0));var _0xf297=function(_0x557d8b,_0x1cc9c1){_0x557d8b=_0x557d8b-0x0;var _0x416d86=_0x297f[_0x557d8b];return _0x416d86;};'use strict';var multer=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf297('0x2'));var router=express[_0xf297('0x3')]();var fs_extra=require(_0xf297('0x4'));var auth=require(_0xf297('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf297('0x6'));var controller=require('./template.controller');router[_0xf297('0x7')]('/',auth[_0xf297('0x8')](),controller[_0xf297('0x9')]);router['get']('/:id',auth[_0xf297('0x8')](),controller[_0xf297('0xa')]);router[_0xf297('0xb')]('/',auth['isAuthenticated'](),controller[_0xf297('0xc')]);router[_0xf297('0xd')]('/:id',auth[_0xf297('0x8')](),controller['update']);router[_0xf297('0xe')](_0xf297('0xf'),auth[_0xf297('0x8')](),controller['destroy']);module[_0xf297('0x10')]=router; \ No newline at end of file +var _0x8277=['update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0xa6a194,_0x4f794d){var _0xd70b88=function(_0x5dbde8){while(--_0x5dbde8){_0xa6a194['push'](_0xa6a194['shift']());}};_0xd70b88(++_0x4f794d);}(_0x8277,0xcf));var _0x7827=function(_0x4cb272,_0x52c0e9){_0x4cb272=_0x4cb272-0x0;var _0x57b4aa=_0x8277[_0x4cb272];return _0x57b4aa;};'use strict';var multer=require('multer');var util=require(_0x7827('0x0'));var path=require(_0x7827('0x1'));var timeout=require('connect-timeout');var express=require(_0x7827('0x2'));var router=express[_0x7827('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7827('0x4'));var interaction=require(_0x7827('0x5'));var config=require('../../config/environment');var controller=require(_0x7827('0x6'));router[_0x7827('0x7')]('/',auth[_0x7827('0x8')](),controller['index']);router[_0x7827('0x7')](_0x7827('0x9'),auth[_0x7827('0x8')](),controller[_0x7827('0xa')]);router[_0x7827('0xb')]('/',auth[_0x7827('0x8')](),controller[_0x7827('0xc')]);router[_0x7827('0xd')](_0x7827('0x9'),auth[_0x7827('0x8')](),controller[_0x7827('0xe')]);router[_0x7827('0xf')](_0x7827('0x9'),auth[_0x7827('0x8')](),controller['destroy']);module[_0x7827('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 5344126..9ab8595 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 _0xc0c7=['sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc0c7,0x166));var _0x7c0c=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xc0c7[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0x7c0c('0x0'));module[_0x7c0c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x48d1=['TEXT','sequelize','exports','STRING'];(function(_0x6260ec,_0x29f68d){var _0x366726=function(_0x4c5028){while(--_0x4c5028){_0x6260ec['push'](_0x6260ec['shift']());}};_0x366726(++_0x29f68d);}(_0x48d1,0x11d));var _0x148d=function(_0xb1e0e9,_0x3a5da4){_0xb1e0e9=_0xb1e0e9-0x0;var _0x1466e2=_0x48d1[_0xb1e0e9];return _0x1466e2;};'use strict';var Sequelize=require(_0x148d('0x0'));module[_0x148d('0x1')]={'name':{'type':Sequelize[_0x148d('0x2')]},'description':{'type':Sequelize[_0x148d('0x2')]},'html':{'type':Sequelize[_0x148d('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 3900b99..c734f1e 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 _0x61c2=['Template','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','include','find','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','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','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map'];(function(_0xbf23b4,_0x14c39c){var _0x24dfb2=function(_0x5abaac){while(--_0x5abaac){_0xbf23b4['push'](_0xbf23b4['shift']());}};_0x24dfb2(++_0x14c39c);}(_0x61c2,0x72));var _0x261c=function(_0x2fa835,_0x3eb916){_0x2fa835=_0x2fa835-0x0;var _0x327121=_0x61c2[_0x2fa835];return _0x327121;};'use strict';var emlformat=require(_0x261c('0x0'));var rimraf=require(_0x261c('0x1'));var zipdir=require(_0x261c('0x2'));var jsonpatch=require(_0x261c('0x3'));var rp=require('request-promise');var moment=require(_0x261c('0x4'));var BPromise=require(_0x261c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x261c('0x6'));var sox=require('sox');var csv=require(_0x261c('0x7'));var ejs=require(_0x261c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x261c('0x9'));var squel=require(_0x261c('0xa'));var crypto=require(_0x261c('0xb'));var jsforce=require(_0x261c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x261c('0x7'));var querystring=require(_0x261c('0xd'));var Papa=require(_0x261c('0xe'));var Redis=require(_0x261c('0xf'));var authService=require(_0x261c('0x10'));var qs=require(_0x261c('0x11'));var as=require(_0x261c('0x12'));var hardwareService=require(_0x261c('0x13'));var logger=require(_0x261c('0x14'))(_0x261c('0x15'));var utils=require('../../config/utils');var config=require(_0x261c('0x16'));var licenseUtil=require(_0x261c('0x17'));var db=require(_0x261c('0x18'))['db'];function respondWithStatusCode(_0x209a73,_0x9a1ba4){_0x9a1ba4=_0x9a1ba4||0xcc;return function(_0x5ae3d9){if(_0x5ae3d9){return _0x209a73[_0x261c('0x19')](_0x9a1ba4);}return _0x209a73[_0x261c('0x1a')](_0x9a1ba4)[_0x261c('0x1b')]();};}function respondWithResult(_0x52d738,_0x345b8a){_0x345b8a=_0x345b8a||0xc8;return function(_0x7b9195){if(_0x7b9195){return _0x52d738[_0x261c('0x1a')](_0x345b8a)['json'](_0x7b9195);}};}function respondWithFilteredResult(_0x5d7737,_0x39a4e3){return function(_0x53f570){if(_0x53f570){var _0x18d8f2=typeof _0x39a4e3[_0x261c('0x1c')]==='undefined'&&typeof _0x39a4e3[_0x261c('0x1d')]===_0x261c('0x1e');var _0x2f401f=_0x53f570['count'];var _0x117a6f=_0x18d8f2?0x0:_0x39a4e3['offset'];var _0x176230=_0x18d8f2?_0x53f570[_0x261c('0x1f')]:_0x39a4e3[_0x261c('0x1c')]+_0x39a4e3['limit'];var _0x2b12e1;if(_0x176230>=_0x2f401f){_0x176230=_0x2f401f;_0x2b12e1=0xc8;}else{_0x2b12e1=0xce;}_0x5d7737[_0x261c('0x1a')](_0x2b12e1);return _0x5d7737[_0x261c('0x20')](_0x261c('0x21'),_0x117a6f+'-'+_0x176230+'/'+_0x2f401f)[_0x261c('0x22')](_0x53f570);}return null;};}function patchUpdates(_0x563c3d){return function(_0x4709d2){try{jsonpatch[_0x261c('0x23')](_0x4709d2,_0x563c3d,!![]);}catch(_0x440147){return BPromise[_0x261c('0x24')](_0x440147);}return _0x4709d2[_0x261c('0x25')]();};}function saveUpdates(_0x4cf6e9,_0xa18919){return function(_0x1547af){if(_0x1547af){return _0x1547af[_0x261c('0x26')](_0x4cf6e9)['then'](function(_0x531138){return _0x531138;});}return null;};}function removeEntity(_0xecd334,_0x338ee5){return function(_0x25e498){if(_0x25e498){return _0x25e498[_0x261c('0x27')]()[_0x261c('0x28')](function(){var _0x5c760a=_0x25e498[_0x261c('0x29')]({'plain':!![]});var _0x38acee=_0x261c('0x2a');return db[_0x261c('0x2b')][_0x261c('0x27')]({'where':{'type':_0x38acee,'resourceId':_0x5c760a['id']}})['then'](function(){return _0x25e498;});})[_0x261c('0x28')](function(){_0xecd334['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x309697,_0x465fb0){return function(_0xf1e802){if(!_0xf1e802){_0x309697['sendStatus'](0x194);}return _0xf1e802;};}function handleError(_0x473323,_0xf85e1f){_0xf85e1f=_0xf85e1f||0x1f4;return function(_0x3cb55e){logger[_0x261c('0x2c')](_0x3cb55e[_0x261c('0x2d')]);if(_0x3cb55e[_0x261c('0x2e')]){delete _0x3cb55e[_0x261c('0x2e')];}_0x473323[_0x261c('0x1a')](_0xf85e1f)[_0x261c('0x2f')](_0x3cb55e);};}exports[_0x261c('0x30')]=function(_0x5a8faf,_0x7e01e6){var _0x34e742={},_0x5db8f5={},_0x3437cd={'count':0x0,'rows':[]};var _0x23153d=_[_0x261c('0x31')](db[_0x261c('0x32')][_0x261c('0x33')],function(_0x4766b5){return{'name':_0x4766b5['fieldName'],'type':_0x4766b5[_0x261c('0x34')]['key']};});_0x5db8f5[_0x261c('0x35')]=_['map'](_0x23153d,_0x261c('0x2e'));_0x5db8f5['query']=_[_0x261c('0x36')](_0x5a8faf[_0x261c('0x37')]);_0x5db8f5['filters']=_[_0x261c('0x38')](_0x5db8f5['model'],_0x5db8f5['query']);_0x34e742[_0x261c('0x39')]=_['intersection'](_0x5db8f5[_0x261c('0x35')],qs[_0x261c('0x3a')](_0x5a8faf['query'][_0x261c('0x3a')]));_0x34e742['attributes']=_0x34e742[_0x261c('0x39')][_0x261c('0x3b')]?_0x34e742[_0x261c('0x39')]:_0x5db8f5[_0x261c('0x35')];if(!_0x5a8faf[_0x261c('0x37')][_0x261c('0x3c')]('nolimit')){_0x34e742[_0x261c('0x1d')]=qs[_0x261c('0x1d')](_0x5a8faf['query'][_0x261c('0x1d')]);_0x34e742[_0x261c('0x1c')]=qs[_0x261c('0x1c')](_0x5a8faf[_0x261c('0x37')][_0x261c('0x1c')]);}_0x34e742[_0x261c('0x3d')]=qs[_0x261c('0x3e')](_0x5a8faf[_0x261c('0x37')][_0x261c('0x3e')]);_0x34e742[_0x261c('0x3f')]=qs[_0x261c('0x40')](_[_0x261c('0x41')](_0x5a8faf[_0x261c('0x37')],_0x5db8f5['filters']),_0x23153d);if(_0x5a8faf[_0x261c('0x37')][_0x261c('0x42')]){_0x34e742[_0x261c('0x3f')]=_[_0x261c('0x43')](_0x34e742[_0x261c('0x3f')],{'$or':_[_0x261c('0x31')](_0x23153d,function(_0x143768){if(_0x143768[_0x261c('0x34')]!==_0x261c('0x44')){var _0x5cdf48={};_0x5cdf48[_0x143768['name']]={'$like':'%'+_0x5a8faf[_0x261c('0x37')][_0x261c('0x42')]+'%'};return _0x5cdf48;}})});}_0x34e742=_[_0x261c('0x43')]({},_0x34e742,_0x5a8faf['options']);var _0x1c136e={'where':_0x34e742['where']};return db['Template']['count'](_0x1c136e)[_0x261c('0x28')](function(_0x43fde7){_0x3437cd['count']=_0x43fde7;if(_0x5a8faf[_0x261c('0x37')]['includeAll']){_0x34e742['include']=[{'all':!![]}];}return db['Template'][_0x261c('0x45')](_0x34e742);})[_0x261c('0x28')](function(_0x4c2d6b){_0x3437cd[_0x261c('0x46')]=_0x4c2d6b;return _0x3437cd;})[_0x261c('0x28')](respondWithFilteredResult(_0x7e01e6,_0x34e742))[_0x261c('0x47')](handleError(_0x7e01e6,null));};exports[_0x261c('0x48')]=function(_0x42f10d,_0x38eb5c){var _0x4528ec={'raw':!![],'where':{'id':_0x42f10d[_0x261c('0x49')]['id']}},_0x137641={};_0x137641[_0x261c('0x35')]=_['keys'](db[_0x261c('0x32')][_0x261c('0x33')]);_0x137641['query']=_[_0x261c('0x36')](_0x42f10d[_0x261c('0x37')]);_0x137641[_0x261c('0x40')]=_['intersection'](_0x137641[_0x261c('0x35')],_0x137641[_0x261c('0x37')]);_0x4528ec[_0x261c('0x39')]=_[_0x261c('0x38')](_0x137641[_0x261c('0x35')],qs[_0x261c('0x3a')](_0x42f10d['query']['fields']));_0x4528ec['attributes']=_0x4528ec[_0x261c('0x39')][_0x261c('0x3b')]?_0x4528ec['attributes']:_0x137641[_0x261c('0x35')];if(_0x42f10d[_0x261c('0x37')]['includeAll']){_0x4528ec[_0x261c('0x4a')]=[{'all':!![]}];}_0x4528ec=_[_0x261c('0x43')]({},_0x4528ec,_0x42f10d['options']);return db[_0x261c('0x32')][_0x261c('0x4b')](_0x4528ec)['then'](handleEntityNotFound(_0x38eb5c,null))['then'](respondWithResult(_0x38eb5c,null))[_0x261c('0x47')](handleError(_0x38eb5c,null));};exports[_0x261c('0x4c')]=function(_0x6bd6d9,_0x472e55){return db[_0x261c('0x32')][_0x261c('0x4c')](_0x6bd6d9[_0x261c('0x4d')],{})['then'](function(_0x457075){var _0x41fa71=_0x6bd6d9['user'][_0x261c('0x29')]({'plain':!![]});if(!_0x41fa71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41fa71['role']==='user'){var _0x569a50=_0x457075[_0x261c('0x29')]({'plain':!![]});var _0x1ff731=_0x261c('0x2a');return db[_0x261c('0x4e')]['find']({'where':{'name':_0x1ff731,'userProfileId':_0x41fa71[_0x261c('0x4f')]},'raw':!![]})[_0x261c('0x28')](function(_0x305458){if(_0x305458&&_0x305458[_0x261c('0x50')]===0x0){return db[_0x261c('0x2b')][_0x261c('0x4c')]({'name':_0x569a50[_0x261c('0x2e')],'resourceId':_0x569a50['id'],'type':_0x305458[_0x261c('0x2e')],'sectionId':_0x305458['id']},{})['then'](function(){return _0x457075;});}else{return _0x457075;}})[_0x261c('0x47')](function(_0x1933f3){logger[_0x261c('0x2c')](_0x261c('0x51'),_0x1933f3);throw _0x1933f3;});}return _0x457075;})[_0x261c('0x28')](respondWithResult(_0x472e55,0xc9))[_0x261c('0x47')](handleError(_0x472e55,null));};exports[_0x261c('0x26')]=function(_0x71d9e5,_0x4a2825){if(_0x71d9e5[_0x261c('0x4d')]['id']){delete _0x71d9e5[_0x261c('0x4d')]['id'];}return db[_0x261c('0x32')][_0x261c('0x4b')]({'where':{'id':_0x71d9e5['params']['id']}})['then'](handleEntityNotFound(_0x4a2825,null))['then'](saveUpdates(_0x71d9e5[_0x261c('0x4d')],null))['then'](respondWithResult(_0x4a2825,null))['catch'](handleError(_0x4a2825,null));};exports[_0x261c('0x27')]=function(_0x19dacb,_0x2f1ce2){return db[_0x261c('0x32')][_0x261c('0x4b')]({'where':{'id':_0x19dacb[_0x261c('0x49')]['id']}})[_0x261c('0x28')](handleEntityNotFound(_0x2f1ce2,null))[_0x261c('0x28')](removeEntity(_0x2f1ce2,null))[_0x261c('0x47')](handleError(_0x2f1ce2,null));}; \ No newline at end of file +var _0x5cb6=['where','options','Template','includeAll','include','findAll','show','params','keys','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge'];(function(_0x2cb501,_0x5e6552){var _0x5b8ae2=function(_0x78ed19){while(--_0x78ed19){_0x2cb501['push'](_0x2cb501['shift']());}};_0x5b8ae2(++_0x5e6552);}(_0x5cb6,0x15b));var _0x65cb=function(_0xd46227,_0x18477f){_0xd46227=_0xd46227-0x0;var _0x2a980d=_0x5cb6[_0xd46227];return _0x2a980d;};'use strict';var emlformat=require(_0x65cb('0x0'));var rimraf=require(_0x65cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65cb('0x2'));var moment=require('moment');var BPromise=require(_0x65cb('0x3'));var Mustache=require(_0x65cb('0x4'));var util=require(_0x65cb('0x5'));var path=require(_0x65cb('0x6'));var sox=require(_0x65cb('0x7'));var csv=require('to-csv');var ejs=require(_0x65cb('0x8'));var fs=require('fs');var fs_extra=require(_0x65cb('0x9'));var _=require(_0x65cb('0xa'));var squel=require(_0x65cb('0xb'));var crypto=require(_0x65cb('0xc'));var jsforce=require(_0x65cb('0xd'));var deskjs=require(_0x65cb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x65cb('0xf'));var Redis=require(_0x65cb('0x10'));var authService=require(_0x65cb('0x11'));var qs=require(_0x65cb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65cb('0x13'));var logger=require(_0x65cb('0x14'))(_0x65cb('0x15'));var utils=require(_0x65cb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x65cb('0x17'));var db=require(_0x65cb('0x18'))['db'];function respondWithStatusCode(_0x30331f,_0x50241b){_0x50241b=_0x50241b||0xcc;return function(_0x49c49b){if(_0x49c49b){return _0x30331f['sendStatus'](_0x50241b);}return _0x30331f[_0x65cb('0x19')](_0x50241b)[_0x65cb('0x1a')]();};}function respondWithResult(_0x2702d4,_0x32cac1){_0x32cac1=_0x32cac1||0xc8;return function(_0x724df0){if(_0x724df0){return _0x2702d4[_0x65cb('0x19')](_0x32cac1)[_0x65cb('0x1b')](_0x724df0);}};}function respondWithFilteredResult(_0x411fca,_0x500638){return function(_0x5927b0){if(_0x5927b0){var _0x203e04=typeof _0x500638[_0x65cb('0x1c')]===_0x65cb('0x1d')&&typeof _0x500638[_0x65cb('0x1e')]==='undefined';var _0x5f572e=_0x5927b0[_0x65cb('0x1f')];var _0x12c1ce=_0x203e04?0x0:_0x500638['offset'];var _0x28d939=_0x203e04?_0x5927b0['count']:_0x500638[_0x65cb('0x1c')]+_0x500638['limit'];var _0x274ab3;if(_0x28d939>=_0x5f572e){_0x28d939=_0x5f572e;_0x274ab3=0xc8;}else{_0x274ab3=0xce;}_0x411fca[_0x65cb('0x19')](_0x274ab3);return _0x411fca[_0x65cb('0x20')]('Content-Range',_0x12c1ce+'-'+_0x28d939+'/'+_0x5f572e)[_0x65cb('0x1b')](_0x5927b0);}return null;};}function patchUpdates(_0x1a2761){return function(_0x3bab64){try{jsonpatch[_0x65cb('0x21')](_0x3bab64,_0x1a2761,!![]);}catch(_0x29d961){return BPromise[_0x65cb('0x22')](_0x29d961);}return _0x3bab64[_0x65cb('0x23')]();};}function saveUpdates(_0x2d58cf,_0x4ffba9){return function(_0x2f1f6d){if(_0x2f1f6d){return _0x2f1f6d[_0x65cb('0x24')](_0x2d58cf)[_0x65cb('0x25')](function(_0x276750){return _0x276750;});}return null;};}function removeEntity(_0x213591,_0x2c33d1){return function(_0x30b279){if(_0x30b279){return _0x30b279['destroy']()[_0x65cb('0x25')](function(){var _0x30ce34=_0x30b279[_0x65cb('0x26')]({'plain':!![]});var _0x451f7d='Templates';return db['UserProfileResource'][_0x65cb('0x27')]({'where':{'type':_0x451f7d,'resourceId':_0x30ce34['id']}})[_0x65cb('0x25')](function(){return _0x30b279;});})[_0x65cb('0x25')](function(){_0x213591[_0x65cb('0x19')](0xcc)[_0x65cb('0x1a')]();});}};}function handleEntityNotFound(_0x3ba0c2,_0x33327f){return function(_0x5a6f70){if(!_0x5a6f70){_0x3ba0c2[_0x65cb('0x28')](0x194);}return _0x5a6f70;};}function handleError(_0x11da11,_0xf74189){_0xf74189=_0xf74189||0x1f4;return function(_0x16ca07){logger[_0x65cb('0x29')](_0x16ca07[_0x65cb('0x2a')]);if(_0x16ca07[_0x65cb('0x2b')]){delete _0x16ca07[_0x65cb('0x2b')];}_0x11da11[_0x65cb('0x19')](_0xf74189)[_0x65cb('0x2c')](_0x16ca07);};}exports[_0x65cb('0x2d')]=function(_0xf6b80f,_0x333746){var _0xb9f54e={},_0xafc950={},_0x1c6f2d={'count':0x0,'rows':[]};var _0xe32a3b=_['map'](db['Template'][_0x65cb('0x2e')],function(_0x57085f){return{'name':_0x57085f[_0x65cb('0x2f')],'type':_0x57085f[_0x65cb('0x30')]['key']};});_0xafc950[_0x65cb('0x31')]=_[_0x65cb('0x32')](_0xe32a3b,_0x65cb('0x2b'));_0xafc950[_0x65cb('0x33')]=_['keys'](_0xf6b80f[_0x65cb('0x33')]);_0xafc950['filters']=_['intersection'](_0xafc950[_0x65cb('0x31')],_0xafc950['query']);_0xb9f54e[_0x65cb('0x34')]=_[_0x65cb('0x35')](_0xafc950[_0x65cb('0x31')],qs[_0x65cb('0x36')](_0xf6b80f[_0x65cb('0x33')]['fields']));_0xb9f54e[_0x65cb('0x34')]=_0xb9f54e[_0x65cb('0x34')][_0x65cb('0x37')]?_0xb9f54e[_0x65cb('0x34')]:_0xafc950['model'];if(!_0xf6b80f[_0x65cb('0x33')][_0x65cb('0x38')](_0x65cb('0x39'))){_0xb9f54e[_0x65cb('0x1e')]=qs[_0x65cb('0x1e')](_0xf6b80f[_0x65cb('0x33')]['limit']);_0xb9f54e[_0x65cb('0x1c')]=qs[_0x65cb('0x1c')](_0xf6b80f[_0x65cb('0x33')][_0x65cb('0x1c')]);}_0xb9f54e[_0x65cb('0x3a')]=qs[_0x65cb('0x3b')](_0xf6b80f[_0x65cb('0x33')][_0x65cb('0x3b')]);_0xb9f54e['where']=qs[_0x65cb('0x3c')](_['pick'](_0xf6b80f['query'],_0xafc950[_0x65cb('0x3c')]),_0xe32a3b);if(_0xf6b80f[_0x65cb('0x33')][_0x65cb('0x3d')]){_0xb9f54e['where']=_[_0x65cb('0x3e')](_0xb9f54e[_0x65cb('0x3f')],{'$or':_[_0x65cb('0x32')](_0xe32a3b,function(_0x1af852){if(_0x1af852[_0x65cb('0x30')]!=='VIRTUAL'){var _0x334632={};_0x334632[_0x1af852[_0x65cb('0x2b')]]={'$like':'%'+_0xf6b80f['query'][_0x65cb('0x3d')]+'%'};return _0x334632;}})});}_0xb9f54e=_[_0x65cb('0x3e')]({},_0xb9f54e,_0xf6b80f[_0x65cb('0x40')]);var _0x782171={'where':_0xb9f54e[_0x65cb('0x3f')]};return db[_0x65cb('0x41')]['count'](_0x782171)[_0x65cb('0x25')](function(_0x486c6e){_0x1c6f2d[_0x65cb('0x1f')]=_0x486c6e;if(_0xf6b80f['query'][_0x65cb('0x42')]){_0xb9f54e[_0x65cb('0x43')]=[{'all':!![]}];}return db['Template'][_0x65cb('0x44')](_0xb9f54e);})['then'](function(_0x2091f1){_0x1c6f2d['rows']=_0x2091f1;return _0x1c6f2d;})[_0x65cb('0x25')](respondWithFilteredResult(_0x333746,_0xb9f54e))['catch'](handleError(_0x333746,null));};exports[_0x65cb('0x45')]=function(_0x525d8b,_0x20468e){var _0x4d49d7={'raw':!![],'where':{'id':_0x525d8b[_0x65cb('0x46')]['id']}},_0x43c895={};_0x43c895[_0x65cb('0x31')]=_[_0x65cb('0x47')](db[_0x65cb('0x41')]['rawAttributes']);_0x43c895['query']=_[_0x65cb('0x47')](_0x525d8b[_0x65cb('0x33')]);_0x43c895[_0x65cb('0x3c')]=_[_0x65cb('0x35')](_0x43c895[_0x65cb('0x31')],_0x43c895[_0x65cb('0x33')]);_0x4d49d7[_0x65cb('0x34')]=_[_0x65cb('0x35')](_0x43c895['model'],qs[_0x65cb('0x36')](_0x525d8b[_0x65cb('0x33')][_0x65cb('0x36')]));_0x4d49d7[_0x65cb('0x34')]=_0x4d49d7[_0x65cb('0x34')][_0x65cb('0x37')]?_0x4d49d7[_0x65cb('0x34')]:_0x43c895[_0x65cb('0x31')];if(_0x525d8b[_0x65cb('0x33')]['includeAll']){_0x4d49d7[_0x65cb('0x43')]=[{'all':!![]}];}_0x4d49d7=_['merge']({},_0x4d49d7,_0x525d8b[_0x65cb('0x40')]);return db[_0x65cb('0x41')]['find'](_0x4d49d7)[_0x65cb('0x25')](handleEntityNotFound(_0x20468e,null))[_0x65cb('0x25')](respondWithResult(_0x20468e,null))[_0x65cb('0x48')](handleError(_0x20468e,null));};exports['create']=function(_0x2e50f4,_0x329f04){return db[_0x65cb('0x41')]['create'](_0x2e50f4[_0x65cb('0x49')],{})['then'](function(_0x12d8bc){var _0x22c499=_0x2e50f4[_0x65cb('0x4a')][_0x65cb('0x26')]({'plain':!![]});if(!_0x22c499)throw new Error(_0x65cb('0x4b'));if(_0x22c499[_0x65cb('0x4c')]===_0x65cb('0x4a')){var _0x820813=_0x12d8bc['get']({'plain':!![]});var _0x357a3b=_0x65cb('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x357a3b,'userProfileId':_0x22c499[_0x65cb('0x4e')]},'raw':!![]})[_0x65cb('0x25')](function(_0x57d5fe){if(_0x57d5fe&&_0x57d5fe['autoAssociation']===0x0){return db[_0x65cb('0x4f')][_0x65cb('0x50')]({'name':_0x820813[_0x65cb('0x2b')],'resourceId':_0x820813['id'],'type':_0x57d5fe[_0x65cb('0x2b')],'sectionId':_0x57d5fe['id']},{})[_0x65cb('0x25')](function(){return _0x12d8bc;});}else{return _0x12d8bc;}})[_0x65cb('0x48')](function(_0x36430f){logger[_0x65cb('0x29')](_0x65cb('0x51'),_0x36430f);throw _0x36430f;});}return _0x12d8bc;})['then'](respondWithResult(_0x329f04,0xc9))['catch'](handleError(_0x329f04,null));};exports[_0x65cb('0x24')]=function(_0x3dc53e,_0x456e4c){if(_0x3dc53e['body']['id']){delete _0x3dc53e[_0x65cb('0x49')]['id'];}return db['Template']['find']({'where':{'id':_0x3dc53e[_0x65cb('0x46')]['id']}})[_0x65cb('0x25')](handleEntityNotFound(_0x456e4c,null))[_0x65cb('0x25')](saveUpdates(_0x3dc53e[_0x65cb('0x49')],null))[_0x65cb('0x25')](respondWithResult(_0x456e4c,null))['catch'](handleError(_0x456e4c,null));};exports[_0x65cb('0x27')]=function(_0x521e2f,_0x3947f0){return db[_0x65cb('0x41')]['find']({'where':{'id':_0x521e2f[_0x65cb('0x46')]['id']}})[_0x65cb('0x25')](handleEntityNotFound(_0x3947f0,null))[_0x65cb('0x25')](removeEntity(_0x3947f0,null))[_0x65cb('0x48')](handleError(_0x3947f0,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 60a782f..131725e 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 _0xdb69=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb69,0xe5));var _0x9db6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdb69[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x9db6('0x0'));var util=require(_0x9db6('0x1'));var logger=require(_0x9db6('0x2'))(_0x9db6('0x3'));var moment=require(_0x9db6('0x4'));var BPromise=require(_0x9db6('0x5'));var rp=require(_0x9db6('0x6'));var fs=require('fs');var path=require(_0x9db6('0x7'));var rimraf=require(_0x9db6('0x8'));var config=require(_0x9db6('0x9'));var attributes=require(_0x9db6('0xa'));module[_0x9db6('0xb')]=function(_0x5b7316,_0x3eef67){return _0x5b7316['define']('Template',attributes,{'tableName':_0x9db6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1c0=['./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x37882e,_0x2685b9){var _0x31fa8f=function(_0x1e4852){while(--_0x1e4852){_0x37882e['push'](_0x37882e['shift']());}};_0x31fa8f(++_0x2685b9);}(_0xd1c0,0x157));var _0x0d1c=function(_0x31bdb9,_0x2a06aa){_0x31bdb9=_0x31bdb9-0x0;var _0x5edf15=_0xd1c0[_0x31bdb9];return _0x5edf15;};'use strict';var _=require(_0x0d1c('0x0'));var util=require(_0x0d1c('0x1'));var logger=require('../../config/logger')(_0x0d1c('0x2'));var moment=require(_0x0d1c('0x3'));var BPromise=require(_0x0d1c('0x4'));var rp=require(_0x0d1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d1c('0x6'));var config=require(_0x0d1c('0x7'));var attributes=require(_0x0d1c('0x8'));module[_0x0d1c('0x9')]=function(_0x319f96,_0x1cface){return _0x319f96[_0x0d1c('0xa')](_0x0d1c('0xb'),attributes,{'tableName':_0x0d1c('0xc'),'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 95047c3..8f69cb6 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 _0x45d2=['Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','http','request','info','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45d2,0xec));var _0x245d=function(_0x508716,_0x4909ba){_0x508716=_0x508716-0x0;var _0x2c771e=_0x45d2[_0x508716];return _0x2c771e;};'use strict';var _=require(_0x245d('0x0'));var util=require(_0x245d('0x1'));var moment=require(_0x245d('0x2'));var BPromise=require(_0x245d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x245d('0x4'));var db=require(_0x245d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x245d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x245d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44078e,_0xbecb61,_0xadce94){return new BPromise(function(_0x56cab4,_0x2977af){return client[_0x245d('0x8')](_0x44078e,_0xadce94)['then'](function(_0x26db53){logger[_0x245d('0x9')]('Template,\x20%s,\x20%s',_0xbecb61,_0x245d('0xa'));logger[_0x245d('0xb')](_0x245d('0xc'),_0xbecb61,'request\x20sent',JSON[_0x245d('0xd')](_0x26db53));if(_0x26db53[_0x245d('0xe')]){if(_0x26db53[_0x245d('0xe')][_0x245d('0xf')]===0x1f4){logger[_0x245d('0xe')](_0x245d('0x10'),_0xbecb61,_0x26db53['error'][_0x245d('0x11')]);return _0x2977af(_0x26db53[_0x245d('0xe')][_0x245d('0x11')]);}logger[_0x245d('0xe')](_0x245d('0x10'),_0xbecb61,_0x26db53[_0x245d('0xe')][_0x245d('0x11')]);return _0x56cab4(_0x26db53[_0x245d('0xe')]['message']);}else{logger[_0x245d('0x9')](_0x245d('0x10'),_0xbecb61,'request\x20sent');_0x56cab4(_0x26db53[_0x245d('0x12')][_0x245d('0x11')]);}})['catch'](function(_0x25e476){logger[_0x245d('0xe')](_0x245d('0x10'),_0xbecb61,_0x25e476);_0x2977af(_0x25e476);});});}exports[_0x245d('0x13')]=function(_0x39777e){var _0x4168b4=this;return new Promise(function(_0x22b08a,_0x34b8e1){return db[_0x245d('0x14')][_0x245d('0x15')]({'raw':_0x39777e[_0x245d('0x16')]?_0x39777e[_0x245d('0x16')][_0x245d('0x17')]===undefined?!![]:![]:!![],'where':_0x39777e['options']?_0x39777e['options']['where']||null:null,'attributes':_0x39777e[_0x245d('0x16')]?_0x39777e['options'][_0x245d('0x18')]||null:null,'limit':_0x39777e[_0x245d('0x16')]?_0x39777e[_0x245d('0x16')][_0x245d('0x19')]||null:null,'include':_0x39777e['options']?_0x39777e[_0x245d('0x16')][_0x245d('0x1a')]?_[_0x245d('0x1b')](_0x39777e[_0x245d('0x16')][_0x245d('0x1a')],function(_0xec4862){return{'model':db[_0xec4862['model']],'as':_0xec4862['as'],'attributes':_0xec4862[_0x245d('0x18')],'include':_0xec4862[_0x245d('0x1a')]?_[_0x245d('0x1b')](_0xec4862[_0x245d('0x1a')],function(_0x5727e4){return{'model':db[_0x5727e4[_0x245d('0x1c')]],'as':_0x5727e4['as'],'attributes':_0x5727e4[_0x245d('0x18')],'include':_0x5727e4[_0x245d('0x1a')]?_[_0x245d('0x1b')](_0x5727e4['include'],function(_0x29ef3e){return{'model':db[_0x29ef3e[_0x245d('0x1c')]],'as':_0x29ef3e['as'],'attributes':_0x29ef3e[_0x245d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x245d('0x1d')](function(_0x341aa2){logger['info']('GetTemplate',_0x39777e);logger[_0x245d('0xb')](_0x245d('0x13'),_0x39777e,JSON[_0x245d('0xd')](_0x341aa2));_0x22b08a(_0x341aa2);})[_0x245d('0x1e')](function(_0x268b15){logger[_0x245d('0xe')](_0x245d('0x13'),_0x268b15[_0x245d('0x11')],_0x39777e);_0x34b8e1(_0x4168b4[_0x245d('0xe')](0x1f4,_0x268b15[_0x245d('0x11')]));});});}; \ No newline at end of file +var _0xbb05=['include','model','attributes','map','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','Template','findAll','raw','options','where','limit'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xbb05,0xa5));var _0x5bb0=function(_0x5ed2b6,_0x55edac){_0x5ed2b6=_0x5ed2b6-0x0;var _0x9b25d5=_0xbb05[_0x5ed2b6];return _0x9b25d5;};'use strict';var _=require('lodash');var util=require(_0x5bb0('0x0'));var moment=require(_0x5bb0('0x1'));var BPromise=require(_0x5bb0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bb0('0x3'));var db=require(_0x5bb0('0x4'))['db'];var utils=require(_0x5bb0('0x5'));var logger=require(_0x5bb0('0x6'))(_0x5bb0('0x7'));var config=require(_0x5bb0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5bb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ab813,_0x102e05,_0x5af534){return new BPromise(function(_0x21941c,_0x40e82c){return client[_0x5bb0('0xa')](_0x5ab813,_0x5af534)[_0x5bb0('0xb')](function(_0x1c61cb){logger[_0x5bb0('0xc')](_0x5bb0('0xd'),_0x102e05,_0x5bb0('0xe'));logger['debug'](_0x5bb0('0xf'),_0x102e05,_0x5bb0('0xe'),JSON['stringify'](_0x1c61cb));if(_0x1c61cb[_0x5bb0('0x10')]){if(_0x1c61cb[_0x5bb0('0x10')][_0x5bb0('0x11')]===0x1f4){logger[_0x5bb0('0x10')]('Template,\x20%s,\x20%s',_0x102e05,_0x1c61cb[_0x5bb0('0x10')]['message']);return _0x40e82c(_0x1c61cb[_0x5bb0('0x10')][_0x5bb0('0x12')]);}logger[_0x5bb0('0x10')](_0x5bb0('0xd'),_0x102e05,_0x1c61cb['error']['message']);return _0x21941c(_0x1c61cb[_0x5bb0('0x10')][_0x5bb0('0x12')]);}else{logger[_0x5bb0('0xc')](_0x5bb0('0xd'),_0x102e05,_0x5bb0('0xe'));_0x21941c(_0x1c61cb['result']['message']);}})[_0x5bb0('0x13')](function(_0xad590b){logger[_0x5bb0('0x10')](_0x5bb0('0xd'),_0x102e05,_0xad590b);_0x40e82c(_0xad590b);});});}exports[_0x5bb0('0x14')]=function(_0x99a9b9){var _0x36657d=this;return new Promise(function(_0x416c6e,_0x429a23){return db[_0x5bb0('0x15')][_0x5bb0('0x16')]({'raw':_0x99a9b9['options']?_0x99a9b9['options'][_0x5bb0('0x17')]===undefined?!![]:![]:!![],'where':_0x99a9b9[_0x5bb0('0x18')]?_0x99a9b9[_0x5bb0('0x18')][_0x5bb0('0x19')]||null:null,'attributes':_0x99a9b9['options']?_0x99a9b9[_0x5bb0('0x18')]['attributes']||null:null,'limit':_0x99a9b9[_0x5bb0('0x18')]?_0x99a9b9['options'][_0x5bb0('0x1a')]||null:null,'include':_0x99a9b9[_0x5bb0('0x18')]?_0x99a9b9[_0x5bb0('0x18')][_0x5bb0('0x1b')]?_['map'](_0x99a9b9[_0x5bb0('0x18')]['include'],function(_0x420642){return{'model':db[_0x420642[_0x5bb0('0x1c')]],'as':_0x420642['as'],'attributes':_0x420642[_0x5bb0('0x1d')],'include':_0x420642[_0x5bb0('0x1b')]?_['map'](_0x420642[_0x5bb0('0x1b')],function(_0x92e016){return{'model':db[_0x92e016[_0x5bb0('0x1c')]],'as':_0x92e016['as'],'attributes':_0x92e016[_0x5bb0('0x1d')],'include':_0x92e016[_0x5bb0('0x1b')]?_[_0x5bb0('0x1e')](_0x92e016[_0x5bb0('0x1b')],function(_0x2992d8){return{'model':db[_0x2992d8[_0x5bb0('0x1c')]],'as':_0x2992d8['as'],'attributes':_0x2992d8[_0x5bb0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f3d8d){logger['info'](_0x5bb0('0x14'),_0x99a9b9);logger[_0x5bb0('0x1f')](_0x5bb0('0x14'),_0x99a9b9,JSON['stringify'](_0x2f3d8d));_0x416c6e(_0x2f3d8d);})[_0x5bb0('0x13')](function(_0x55ab35){logger[_0x5bb0('0x10')](_0x5bb0('0x14'),_0x55ab35['message'],_0x99a9b9);_0x429a23(_0x36657d[_0x5bb0('0x10')](0x1f4,_0x55ab35[_0x5bb0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 781db52..14bf56b 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 _0x2d07=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','/:id/any_conditions','isAuthenticated','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','update','delete'];(function(_0x356005,_0x411466){var _0x2bb35b=function(_0x449cfb){while(--_0x449cfb){_0x356005['push'](_0x356005['shift']());}};_0x2bb35b(++_0x411466);}(_0x2d07,0x13a));var _0x72d0=function(_0x37fcda,_0x2f5aa1){_0x37fcda=_0x37fcda-0x0;var _0xf5ed91=_0x2d07[_0x37fcda];return _0xf5ed91;};'use strict';var multer=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var path=require('path');var timeout=require(_0x72d0('0x2'));var express=require(_0x72d0('0x3'));var router=express['Router']();var fs_extra=require(_0x72d0('0x4'));var auth=require(_0x72d0('0x5'));var interaction=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var controller=require(_0x72d0('0x8'));router[_0x72d0('0x9')]('/',auth['isAuthenticated'](),controller[_0x72d0('0xa')]);router[_0x72d0('0x9')](_0x72d0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x72d0('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router[_0x72d0('0x9')](_0x72d0('0xc'),auth[_0x72d0('0xd')](),controller[_0x72d0('0xe')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x72d0('0xf')]);router[_0x72d0('0x10')]('/',auth[_0x72d0('0xd')](),controller[_0x72d0('0x11')]);router[_0x72d0('0x10')]('/:id/all_conditions',auth[_0x72d0('0xd')](),controller[_0x72d0('0x12')]);router[_0x72d0('0x10')]('/:id/any_conditions',auth[_0x72d0('0xd')](),controller[_0x72d0('0x13')]);router[_0x72d0('0x10')](_0x72d0('0x14'),auth[_0x72d0('0xd')](),controller[_0x72d0('0x15')]);router['put'](_0x72d0('0xb'),auth[_0x72d0('0xd')](),controller[_0x72d0('0x16')]);router[_0x72d0('0x17')](_0x72d0('0xb'),auth[_0x72d0('0xd')](),controller[_0x72d0('0x18')]);module[_0x72d0('0x19')]=router; \ No newline at end of file +var _0x6e7d=['getActions','post','create','addAllCondition','addAnyCondition','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0x25d4e5,_0x30b67f){var _0x44d116=function(_0x3011c2){while(--_0x3011c2){_0x25d4e5['push'](_0x25d4e5['shift']());}};_0x44d116(++_0x30b67f);}(_0x6e7d,0x1a0));var _0xd6e7=function(_0x412fe3,_0x1aded6){_0x412fe3=_0x412fe3-0x0;var _0x4343a6=_0x6e7d[_0x412fe3];return _0x4343a6;};'use strict';var multer=require(_0xd6e7('0x0'));var util=require(_0xd6e7('0x1'));var path=require(_0xd6e7('0x2'));var timeout=require(_0xd6e7('0x3'));var express=require(_0xd6e7('0x4'));var router=express[_0xd6e7('0x5')]();var fs_extra=require(_0xd6e7('0x6'));var auth=require(_0xd6e7('0x7'));var interaction=require(_0xd6e7('0x8'));var config=require(_0xd6e7('0x9'));var controller=require(_0xd6e7('0xa'));router[_0xd6e7('0xb')]('/',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0xd')]);router[_0xd6e7('0xb')]('/:id',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0xe')]);router[_0xd6e7('0xb')](_0xd6e7('0xf'),auth[_0xd6e7('0xc')](),controller['getAllConditions']);router[_0xd6e7('0xb')](_0xd6e7('0x10'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x11')]);router[_0xd6e7('0xb')](_0xd6e7('0x12'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x13')]);router[_0xd6e7('0x14')]('/',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x15')]);router['post'](_0xd6e7('0xf'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x16')]);router[_0xd6e7('0x14')](_0xd6e7('0x10'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x17')]);router[_0xd6e7('0x14')](_0xd6e7('0x12'),auth['isAuthenticated'](),controller['addAction']);router[_0xd6e7('0x18')](_0xd6e7('0x19'),auth['isAuthenticated'](),controller[_0xd6e7('0x1a')]);router[_0xd6e7('0x1b')](_0xd6e7('0x19'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 438f6c7..232a13c 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 _0xca9e=['STRING','sequelize'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xca9e,0x127));var _0xeca9=function(_0x40eeb1,_0x25506f){_0x40eeb1=_0x40eeb1-0x0;var _0x1d7cac=_0xca9e[_0x40eeb1];return _0x1d7cac;};'use strict';var Sequelize=require(_0xeca9('0x0'));module['exports']={'name':{'type':Sequelize[_0xeca9('0x1')]},'channel':{'type':Sequelize[_0xeca9('0x1')]},'description':{'type':Sequelize[_0xeca9('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd91c=['sequelize','exports','STRING'];(function(_0x5768b1,_0x44a684){var _0x1759cc=function(_0x24e925){while(--_0x24e925){_0x5768b1['push'](_0x5768b1['shift']());}};_0x1759cc(++_0x44a684);}(_0xd91c,0x156));var _0xcd91=function(_0x3ca830,_0x389e80){_0x3ca830=_0x3ca830-0x0;var _0x47c7ac=_0xd91c[_0x3ca830];return _0x47c7ac;};'use strict';var Sequelize=require(_0xcd91('0x0'));module[_0xcd91('0x1')]={'name':{'type':Sequelize[_0xcd91('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3d46d44..16e2d78 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 _0xc90f=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Triggers','destroy','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x11b9be,_0x3a8373){var _0x32057d=function(_0x4da603){while(--_0x4da603){_0x11b9be['push'](_0x11b9be['shift']());}};_0x32057d(++_0x3a8373);}(_0xc90f,0x1a1));var _0xfc90=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xc90f[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc90('0x0'));var zipdir=require(_0xfc90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc90('0x2'));var BPromise=require(_0xfc90('0x3'));var Mustache=require(_0xfc90('0x4'));var util=require(_0xfc90('0x5'));var path=require('path');var sox=require(_0xfc90('0x6'));var csv=require('to-csv');var ejs=require(_0xfc90('0x7'));var fs=require('fs');var fs_extra=require(_0xfc90('0x8'));var _=require(_0xfc90('0x9'));var squel=require('squel');var crypto=require(_0xfc90('0xa'));var jsforce=require(_0xfc90('0xb'));var deskjs=require(_0xfc90('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc90('0xd'));var Redis=require(_0xfc90('0xe'));var authService=require(_0xfc90('0xf'));var qs=require(_0xfc90('0x10'));var as=require(_0xfc90('0x11'));var hardwareService=require(_0xfc90('0x12'));var logger=require(_0xfc90('0x13'))(_0xfc90('0x14'));var utils=require('../../config/utils');var config=require(_0xfc90('0x15'));var licenseUtil=require(_0xfc90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f8ee,_0x42d824){_0x42d824=_0x42d824||0xcc;return function(_0x214e1c){if(_0x214e1c){return _0x16f8ee[_0xfc90('0x17')](_0x42d824);}return _0x16f8ee['status'](_0x42d824)[_0xfc90('0x18')]();};}function respondWithResult(_0x221759,_0x39b22c){_0x39b22c=_0x39b22c||0xc8;return function(_0x4c1f3f){if(_0x4c1f3f){return _0x221759[_0xfc90('0x19')](_0x39b22c)[_0xfc90('0x1a')](_0x4c1f3f);}};}function respondWithFilteredResult(_0x3b28f4,_0x49e2ca){return function(_0x1bf613){if(_0x1bf613){var _0xf77e2e=typeof _0x49e2ca[_0xfc90('0x1b')]===_0xfc90('0x1c')&&typeof _0x49e2ca[_0xfc90('0x1d')]===_0xfc90('0x1c');var _0x49931f=_0x1bf613[_0xfc90('0x1e')];var _0x45e522=_0xf77e2e?0x0:_0x49e2ca[_0xfc90('0x1b')];var _0x4981ff=_0xf77e2e?_0x1bf613[_0xfc90('0x1e')]:_0x49e2ca[_0xfc90('0x1b')]+_0x49e2ca[_0xfc90('0x1d')];var _0x5b2e9c;if(_0x4981ff>=_0x49931f){_0x4981ff=_0x49931f;_0x5b2e9c=0xc8;}else{_0x5b2e9c=0xce;}_0x3b28f4[_0xfc90('0x19')](_0x5b2e9c);return _0x3b28f4[_0xfc90('0x1f')](_0xfc90('0x20'),_0x45e522+'-'+_0x4981ff+'/'+_0x49931f)['json'](_0x1bf613);}return null;};}function patchUpdates(_0x5d2089){return function(_0x57b0ff){try{jsonpatch[_0xfc90('0x21')](_0x57b0ff,_0x5d2089,!![]);}catch(_0x2810fe){return BPromise[_0xfc90('0x22')](_0x2810fe);}return _0x57b0ff['save']();};}function saveUpdates(_0x3e4091,_0x49dff0){return function(_0x328b66){if(_0x328b66){return _0x328b66[_0xfc90('0x23')](_0x3e4091)[_0xfc90('0x24')](function(_0x3cc2c9){return _0x3cc2c9;});}return null;};}function removeEntity(_0x42607e,_0x16a054){return function(_0x36bf30){if(_0x36bf30){return _0x36bf30['destroy']()['then'](function(){var _0x3fcdb2=_0x36bf30[_0xfc90('0x25')]({'plain':!![]});var _0x6dd651=_0xfc90('0x26');return db['UserProfileResource'][_0xfc90('0x27')]({'where':{'type':_0x6dd651,'resourceId':_0x3fcdb2['id']}})[_0xfc90('0x24')](function(){return _0x36bf30;});})[_0xfc90('0x24')](function(){_0x42607e[_0xfc90('0x19')](0xcc)[_0xfc90('0x18')]();});}};}function handleEntityNotFound(_0x32f134,_0x192604){return function(_0x5491fe){if(!_0x5491fe){_0x32f134[_0xfc90('0x17')](0x194);}return _0x5491fe;};}function handleError(_0xeb3b54,_0xdc3c3b){_0xdc3c3b=_0xdc3c3b||0x1f4;return function(_0x6fd14b){logger['error'](_0x6fd14b['stack']);if(_0x6fd14b[_0xfc90('0x28')]){delete _0x6fd14b[_0xfc90('0x28')];}_0xeb3b54[_0xfc90('0x19')](_0xdc3c3b)[_0xfc90('0x29')](_0x6fd14b);};}exports[_0xfc90('0x2a')]=function(_0x4e0c93,_0x3a67a2){var _0x2ea493={},_0x100c8d={},_0x2bbf46={'count':0x0,'rows':[]};var _0x3ce7d4=_[_0xfc90('0x2b')](db[_0xfc90('0x2c')][_0xfc90('0x2d')],function(_0x11a7b9){return{'name':_0x11a7b9[_0xfc90('0x2e')],'type':_0x11a7b9['type'][_0xfc90('0x2f')]};});_0x100c8d[_0xfc90('0x30')]=_['map'](_0x3ce7d4,'name');_0x100c8d[_0xfc90('0x31')]=_[_0xfc90('0x32')](_0x4e0c93[_0xfc90('0x31')]);_0x100c8d['filters']=_[_0xfc90('0x33')](_0x100c8d[_0xfc90('0x30')],_0x100c8d['query']);_0x2ea493[_0xfc90('0x34')]=_[_0xfc90('0x33')](_0x100c8d[_0xfc90('0x30')],qs[_0xfc90('0x35')](_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x35')]));_0x2ea493[_0xfc90('0x34')]=_0x2ea493[_0xfc90('0x34')][_0xfc90('0x36')]?_0x2ea493[_0xfc90('0x34')]:_0x100c8d[_0xfc90('0x30')];if(!_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x37')](_0xfc90('0x38'))){_0x2ea493[_0xfc90('0x1d')]=qs[_0xfc90('0x1d')](_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x1d')]);_0x2ea493[_0xfc90('0x1b')]=qs[_0xfc90('0x1b')](_0x4e0c93['query'][_0xfc90('0x1b')]);}_0x2ea493[_0xfc90('0x39')]=qs['sort'](_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x3a')]);_0x2ea493['where']=qs['filters'](_[_0xfc90('0x3b')](_0x4e0c93['query'],_0x100c8d[_0xfc90('0x3c')]),_0x3ce7d4);if(_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x3d')]){_0x2ea493[_0xfc90('0x3e')]=_[_0xfc90('0x3f')](_0x2ea493[_0xfc90('0x3e')],{'$or':_[_0xfc90('0x2b')](_0x3ce7d4,function(_0x158175){if(_0x158175[_0xfc90('0x40')]!==_0xfc90('0x41')){var _0x522183={};_0x522183[_0x158175[_0xfc90('0x28')]]={'$like':'%'+_0x4e0c93['query'][_0xfc90('0x3d')]+'%'};return _0x522183;}})});}_0x2ea493=_[_0xfc90('0x3f')]({},_0x2ea493,_0x4e0c93[_0xfc90('0x42')]);var _0x468c86={'where':_0x2ea493[_0xfc90('0x3e')]};return db[_0xfc90('0x2c')][_0xfc90('0x1e')](_0x468c86)['then'](function(_0x4b295f){_0x2bbf46[_0xfc90('0x1e')]=_0x4b295f;if(_0x4e0c93[_0xfc90('0x31')][_0xfc90('0x43')]){_0x2ea493['include']=[{'all':!![]}];}return db[_0xfc90('0x2c')][_0xfc90('0x44')](_0x2ea493);})[_0xfc90('0x24')](function(_0x4124c3){_0x2bbf46['rows']=_0x4124c3;return _0x2bbf46;})['then'](respondWithFilteredResult(_0x3a67a2,_0x2ea493))[_0xfc90('0x45')](handleError(_0x3a67a2,null));};exports['show']=function(_0x1ef84a,_0x2fe027){var _0x578e92={'raw':![],'where':{'id':_0x1ef84a[_0xfc90('0x46')]['id']}},_0x5082a0={};_0x5082a0['model']=_['keys'](db[_0xfc90('0x2c')][_0xfc90('0x2d')]);_0x5082a0['query']=_[_0xfc90('0x32')](_0x1ef84a[_0xfc90('0x31')]);_0x5082a0[_0xfc90('0x3c')]=_[_0xfc90('0x33')](_0x5082a0[_0xfc90('0x30')],_0x5082a0[_0xfc90('0x31')]);_0x578e92[_0xfc90('0x34')]=_['intersection'](_0x5082a0[_0xfc90('0x30')],qs[_0xfc90('0x35')](_0x1ef84a['query']['fields']));_0x578e92[_0xfc90('0x34')]=_0x578e92[_0xfc90('0x34')]['length']?_0x578e92[_0xfc90('0x34')]:_0x5082a0['model'];if(_0x1ef84a['query']['includeAll']){_0x578e92[_0xfc90('0x47')]=[{'all':!![]}];}_0x578e92=_[_0xfc90('0x3f')]({},_0x578e92,_0x1ef84a[_0xfc90('0x42')]);return db[_0xfc90('0x2c')][_0xfc90('0x48')](_0x578e92)[_0xfc90('0x24')](handleEntityNotFound(_0x2fe027,null))['then'](respondWithResult(_0x2fe027,null))[_0xfc90('0x45')](handleError(_0x2fe027,null));};exports[_0xfc90('0x49')]=function(_0x3233ff,_0xbddc8a){return db[_0xfc90('0x2c')]['create'](_0x3233ff[_0xfc90('0x4a')],{})[_0xfc90('0x24')](function(_0x1ae4b1){var _0x40a9ef=_0x3233ff[_0xfc90('0x4b')]['get']({'plain':!![]});if(!_0x40a9ef)throw new Error(_0xfc90('0x4c'));if(_0x40a9ef[_0xfc90('0x4d')]===_0xfc90('0x4b')){var _0x1552bc=_0x1ae4b1['get']({'plain':!![]});var _0x433705=_0xfc90('0x26');return db[_0xfc90('0x4e')]['find']({'where':{'name':_0x433705,'userProfileId':_0x40a9ef['userProfileId']},'raw':!![]})[_0xfc90('0x24')](function(_0x2c7ff6){if(_0x2c7ff6&&_0x2c7ff6[_0xfc90('0x4f')]===0x0){return db[_0xfc90('0x50')][_0xfc90('0x49')]({'name':_0x1552bc[_0xfc90('0x28')],'resourceId':_0x1552bc['id'],'type':_0x2c7ff6[_0xfc90('0x28')],'sectionId':_0x2c7ff6['id']},{})['then'](function(){return _0x1ae4b1;});}else{return _0x1ae4b1;}})['catch'](function(_0x42e835){logger[_0xfc90('0x51')](_0xfc90('0x52'),_0x42e835);throw _0x42e835;});}return _0x1ae4b1;})[_0xfc90('0x24')](respondWithResult(_0xbddc8a,0xc9))[_0xfc90('0x45')](handleError(_0xbddc8a,null));};exports['update']=function(_0x110dc2,_0x136aa0){if(_0x110dc2['body']['id']){delete _0x110dc2[_0xfc90('0x4a')]['id'];}return db[_0xfc90('0x2c')][_0xfc90('0x48')]({'where':{'id':_0x110dc2[_0xfc90('0x46')]['id']}})[_0xfc90('0x24')](handleEntityNotFound(_0x136aa0,null))[_0xfc90('0x24')](saveUpdates(_0x110dc2[_0xfc90('0x4a')],null))['then'](respondWithResult(_0x136aa0,null))[_0xfc90('0x45')](handleError(_0x136aa0,null));};exports[_0xfc90('0x27')]=function(_0x2b5202,_0x530297){return db[_0xfc90('0x2c')][_0xfc90('0x48')]({'where':{'id':_0x2b5202[_0xfc90('0x46')]['id']}})[_0xfc90('0x24')](handleEntityNotFound(_0x530297,null))[_0xfc90('0x24')](removeEntity(_0x530297,null))['catch'](handleError(_0x530297,null));};exports[_0xfc90('0x53')]=function(_0x30bb5f,_0x21ebf6,_0x12f269){if(_0x30bb5f['body']['id']){delete _0x30bb5f['body']['id'];}return db[_0xfc90('0x2c')]['find']({'where':{'id':_0x30bb5f['params']['id']}})['then'](handleEntityNotFound(_0x21ebf6,null))['then'](function(_0x39c6ae){if(_0x39c6ae){_0x30bb5f[_0xfc90('0x4a')][_0xfc90('0x54')]=_0x39c6ae['id'];return db[_0xfc90('0x55')]['create'](_0x30bb5f[_0xfc90('0x4a')]);}})[_0xfc90('0x24')](respondWithResult(_0x21ebf6,null))[_0xfc90('0x45')](handleError(_0x21ebf6,null));};exports[_0xfc90('0x56')]=function(_0x1226f3,_0x3bb090,_0x2b0687){if(_0x1226f3[_0xfc90('0x4a')]['id']){delete _0x1226f3[_0xfc90('0x4a')]['id'];}return db[_0xfc90('0x2c')][_0xfc90('0x48')]({'where':{'id':_0x1226f3[_0xfc90('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bb090,null))[_0xfc90('0x24')](function(_0x23498d){if(_0x23498d){_0x1226f3[_0xfc90('0x4a')]['TriggerAnyId']=_0x23498d['id'];return db[_0xfc90('0x55')]['create'](_0x1226f3['body']);}})[_0xfc90('0x24')](respondWithResult(_0x3bb090,null))[_0xfc90('0x45')](handleError(_0x3bb090,null));};exports[_0xfc90('0x57')]=function(_0x12b71e,_0x3411a8,_0x2d49b6){var _0x320329={};var _0x981ea3={};var _0x296b91;var _0x1cdeef;return db['Trigger'][_0xfc90('0x58')]({'where':{'id':_0x12b71e[_0xfc90('0x46')]['id']}})[_0xfc90('0x24')](handleEntityNotFound(_0x3411a8,null))[_0xfc90('0x24')](function(_0x1fb9a4){if(_0x1fb9a4){_0x296b91=_0x1fb9a4;_0x981ea3[_0xfc90('0x30')]=_['keys'](db['Condition'][_0xfc90('0x2d')]);_0x981ea3[_0xfc90('0x31')]=_[_0xfc90('0x32')](_0x12b71e['query']);_0x981ea3[_0xfc90('0x3c')]=_[_0xfc90('0x33')](_0x981ea3['model'],_0x981ea3[_0xfc90('0x31')]);_0x320329['attributes']=_[_0xfc90('0x33')](_0x981ea3['model'],qs[_0xfc90('0x35')](_0x12b71e[_0xfc90('0x31')][_0xfc90('0x35')]));_0x320329[_0xfc90('0x34')]=_0x320329[_0xfc90('0x34')][_0xfc90('0x36')]?_0x320329['attributes']:_0x981ea3['model'];_0x320329[_0xfc90('0x39')]=qs[_0xfc90('0x3a')](_0x12b71e['query']['sort']);_0x320329['where']=qs[_0xfc90('0x3c')](_[_0xfc90('0x3b')](_0x12b71e['query'],_0x981ea3[_0xfc90('0x3c')]));if(_0x12b71e[_0xfc90('0x31')][_0xfc90('0x3d')]){_0x320329[_0xfc90('0x3e')]=_[_0xfc90('0x3f')](_0x320329['where'],{'$or':_[_0xfc90('0x2b')](_0x320329[_0xfc90('0x34')],function(_0x1add71){var _0x3fb5b9={};_0x3fb5b9[_0x1add71]={'$like':'%'+_0x12b71e['query'][_0xfc90('0x3d')]+'%'};return _0x3fb5b9;})});}_0x320329=_[_0xfc90('0x3f')]({},_0x320329,_0x12b71e['options']);return _0x296b91[_0xfc90('0x57')](_0x320329);}})[_0xfc90('0x24')](function(_0x122578){if(_0x122578){_0x1cdeef=_0x122578[_0xfc90('0x36')];if(!_0x12b71e['query'][_0xfc90('0x37')](_0xfc90('0x38'))){_0x320329[_0xfc90('0x1d')]=qs[_0xfc90('0x1d')](_0x12b71e[_0xfc90('0x31')][_0xfc90('0x1d')]);_0x320329[_0xfc90('0x1b')]=qs[_0xfc90('0x1b')](_0x12b71e[_0xfc90('0x31')][_0xfc90('0x1b')]);}return _0x296b91[_0xfc90('0x57')](_0x320329);}})[_0xfc90('0x24')](function(_0x3d61f2){if(_0x3d61f2){return _0x3d61f2?{'count':_0x1cdeef,'rows':_0x3d61f2}:null;}})[_0xfc90('0x24')](respondWithResult(_0x3411a8,null))['catch'](handleError(_0x3411a8,null));};exports[_0xfc90('0x59')]=function(_0x41f24a,_0x55fdb1,_0x12144c){var _0x26daf9={};var _0x3c1628={};var _0x5099bc;var _0x148e82;return db[_0xfc90('0x2c')][_0xfc90('0x58')]({'where':{'id':_0x41f24a[_0xfc90('0x46')]['id']}})[_0xfc90('0x24')](handleEntityNotFound(_0x55fdb1,null))[_0xfc90('0x24')](function(_0x3d9633){if(_0x3d9633){_0x5099bc=_0x3d9633;_0x3c1628[_0xfc90('0x30')]=_[_0xfc90('0x32')](db['Condition'][_0xfc90('0x2d')]);_0x3c1628[_0xfc90('0x31')]=_[_0xfc90('0x32')](_0x41f24a[_0xfc90('0x31')]);_0x3c1628[_0xfc90('0x3c')]=_[_0xfc90('0x33')](_0x3c1628[_0xfc90('0x30')],_0x3c1628[_0xfc90('0x31')]);_0x26daf9[_0xfc90('0x34')]=_[_0xfc90('0x33')](_0x3c1628['model'],qs['fields'](_0x41f24a[_0xfc90('0x31')][_0xfc90('0x35')]));_0x26daf9['attributes']=_0x26daf9[_0xfc90('0x34')][_0xfc90('0x36')]?_0x26daf9[_0xfc90('0x34')]:_0x3c1628[_0xfc90('0x30')];_0x26daf9[_0xfc90('0x39')]=qs[_0xfc90('0x3a')](_0x41f24a['query'][_0xfc90('0x3a')]);_0x26daf9[_0xfc90('0x3e')]=qs[_0xfc90('0x3c')](_[_0xfc90('0x3b')](_0x41f24a[_0xfc90('0x31')],_0x3c1628[_0xfc90('0x3c')]));if(_0x41f24a[_0xfc90('0x31')][_0xfc90('0x3d')]){_0x26daf9[_0xfc90('0x3e')]=_[_0xfc90('0x3f')](_0x26daf9[_0xfc90('0x3e')],{'$or':_[_0xfc90('0x2b')](_0x26daf9[_0xfc90('0x34')],function(_0x4a461c){var _0x52df59={};_0x52df59[_0x4a461c]={'$like':'%'+_0x41f24a['query'][_0xfc90('0x3d')]+'%'};return _0x52df59;})});}_0x26daf9=_[_0xfc90('0x3f')]({},_0x26daf9,_0x41f24a[_0xfc90('0x42')]);return _0x5099bc[_0xfc90('0x59')](_0x26daf9);}})[_0xfc90('0x24')](function(_0x13da49){if(_0x13da49){_0x148e82=_0x13da49[_0xfc90('0x36')];if(!_0x41f24a['query'][_0xfc90('0x37')](_0xfc90('0x38'))){_0x26daf9[_0xfc90('0x1d')]=qs[_0xfc90('0x1d')](_0x41f24a[_0xfc90('0x31')][_0xfc90('0x1d')]);_0x26daf9[_0xfc90('0x1b')]=qs['offset'](_0x41f24a[_0xfc90('0x31')][_0xfc90('0x1b')]);}return _0x5099bc[_0xfc90('0x59')](_0x26daf9);}})[_0xfc90('0x24')](function(_0x1c1fcd){if(_0x1c1fcd){return _0x1c1fcd?{'count':_0x148e82,'rows':_0x1c1fcd}:null;}})['then'](respondWithResult(_0x55fdb1,null))[_0xfc90('0x45')](handleError(_0x55fdb1,null));};exports[_0xfc90('0x5a')]=function(_0x3b2855,_0x24408b,_0x4e3d1f){if(_0x3b2855[_0xfc90('0x4a')]['id']){delete _0x3b2855['body']['id'];}return db[_0xfc90('0x2c')][_0xfc90('0x48')]({'where':{'id':_0x3b2855[_0xfc90('0x46')]['id']}})[_0xfc90('0x24')](handleEntityNotFound(_0x24408b,null))[_0xfc90('0x24')](function(_0x4daa2b){if(_0x4daa2b){_0x3b2855['body'][_0xfc90('0x5b')]=_0x4daa2b['id'];return db[_0xfc90('0x5c')]['create'](_0x3b2855[_0xfc90('0x4a')]);}})[_0xfc90('0x24')](respondWithResult(_0x24408b,null))[_0xfc90('0x45')](handleError(_0x24408b,null));};exports[_0xfc90('0x5d')]=function(_0x18208e,_0x113e55,_0x5a8881){var _0x30955b={};var _0x5ab890={};var _0x300477;var _0x15c6a0;return db[_0xfc90('0x2c')][_0xfc90('0x58')]({'where':{'id':_0x18208e[_0xfc90('0x46')]['id']}})['then'](handleEntityNotFound(_0x113e55,null))[_0xfc90('0x24')](function(_0x3bba2a){if(_0x3bba2a){_0x300477=_0x3bba2a;_0x5ab890[_0xfc90('0x30')]=_[_0xfc90('0x32')](db[_0xfc90('0x5c')][_0xfc90('0x2d')]);_0x5ab890['query']=_['keys'](_0x18208e['query']);_0x5ab890['filters']=_[_0xfc90('0x33')](_0x5ab890[_0xfc90('0x30')],_0x5ab890[_0xfc90('0x31')]);_0x30955b[_0xfc90('0x34')]=_[_0xfc90('0x33')](_0x5ab890[_0xfc90('0x30')],qs['fields'](_0x18208e[_0xfc90('0x31')][_0xfc90('0x35')]));_0x30955b[_0xfc90('0x34')]=_0x30955b[_0xfc90('0x34')]['length']?_0x30955b[_0xfc90('0x34')]:_0x5ab890['model'];_0x30955b[_0xfc90('0x39')]=qs[_0xfc90('0x3a')](_0x18208e['query'][_0xfc90('0x3a')]);_0x30955b[_0xfc90('0x3e')]=qs[_0xfc90('0x3c')](_[_0xfc90('0x3b')](_0x18208e['query'],_0x5ab890[_0xfc90('0x3c')]));if(_0x18208e['query'][_0xfc90('0x3d')]){_0x30955b['where']=_[_0xfc90('0x3f')](_0x30955b['where'],{'$or':_[_0xfc90('0x2b')](_0x30955b['attributes'],function(_0x2c97bf){var _0x3b850c={};_0x3b850c[_0x2c97bf]={'$like':'%'+_0x18208e['query'][_0xfc90('0x3d')]+'%'};return _0x3b850c;})});}_0x30955b=_['merge']({},_0x30955b,_0x18208e[_0xfc90('0x42')]);return _0x300477[_0xfc90('0x5d')](_0x30955b);}})['then'](function(_0x12077a){if(_0x12077a){_0x15c6a0=_0x12077a[_0xfc90('0x36')];if(!_0x18208e['query'][_0xfc90('0x37')]('nolimit')){_0x30955b[_0xfc90('0x1d')]=qs[_0xfc90('0x1d')](_0x18208e[_0xfc90('0x31')]['limit']);_0x30955b['offset']=qs[_0xfc90('0x1b')](_0x18208e[_0xfc90('0x31')][_0xfc90('0x1b')]);}return _0x300477['getActions'](_0x30955b);}})['then'](function(_0x1d8275){if(_0x1d8275){return _0x1d8275?{'count':_0x15c6a0,'rows':_0x1d8275}:null;}})[_0xfc90('0x24')](respondWithResult(_0x113e55,null))[_0xfc90('0x45')](handleError(_0x113e55,null));}; \ No newline at end of file +var _0x68e6=['keys','includeAll','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','update','body','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','hasOwnProperty','nolimit','getAnyConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','then','get','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','Trigger','findAll','rows','catch','show','params'];(function(_0x272bb4,_0x2cc93e){var _0x308454=function(_0x3ce38e){while(--_0x3ce38e){_0x272bb4['push'](_0x272bb4['shift']());}};_0x308454(++_0x2cc93e);}(_0x68e6,0x171));var _0x668e=function(_0x1bfdae,_0x251340){_0x1bfdae=_0x1bfdae-0x0;var _0x1f75b6=_0x68e6[_0x1bfdae];return _0x1f75b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x668e('0x0'));var zipdir=require(_0x668e('0x1'));var jsonpatch=require(_0x668e('0x2'));var rp=require(_0x668e('0x3'));var moment=require(_0x668e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x668e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x668e('0x6'));var ejs=require(_0x668e('0x7'));var fs=require('fs');var fs_extra=require(_0x668e('0x8'));var _=require(_0x668e('0x9'));var squel=require(_0x668e('0xa'));var crypto=require('crypto');var jsforce=require(_0x668e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x668e('0x6'));var querystring=require('querystring');var Papa=require(_0x668e('0xc'));var Redis=require(_0x668e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x668e('0xe'));var as=require(_0x668e('0xf'));var hardwareService=require(_0x668e('0x10'));var logger=require('../../config/logger')(_0x668e('0x11'));var utils=require(_0x668e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x668e('0x13'));var db=require(_0x668e('0x14'))['db'];function respondWithStatusCode(_0x297278,_0x5d769f){_0x5d769f=_0x5d769f||0xcc;return function(_0x5484e1){if(_0x5484e1){return _0x297278[_0x668e('0x15')](_0x5d769f);}return _0x297278['status'](_0x5d769f)[_0x668e('0x16')]();};}function respondWithResult(_0x3bfc59,_0x4dc047){_0x4dc047=_0x4dc047||0xc8;return function(_0x329163){if(_0x329163){return _0x3bfc59[_0x668e('0x17')](_0x4dc047)[_0x668e('0x18')](_0x329163);}};}function respondWithFilteredResult(_0x1babc7,_0x175c8b){return function(_0x3da6f2){if(_0x3da6f2){var _0x49c612=typeof _0x175c8b[_0x668e('0x19')]===_0x668e('0x1a')&&typeof _0x175c8b[_0x668e('0x1b')]===_0x668e('0x1a');var _0xc019c=_0x3da6f2[_0x668e('0x1c')];var _0x519ed5=_0x49c612?0x0:_0x175c8b['offset'];var _0x57e7d7=_0x49c612?_0x3da6f2[_0x668e('0x1c')]:_0x175c8b[_0x668e('0x19')]+_0x175c8b['limit'];var _0x59096f;if(_0x57e7d7>=_0xc019c){_0x57e7d7=_0xc019c;_0x59096f=0xc8;}else{_0x59096f=0xce;}_0x1babc7[_0x668e('0x17')](_0x59096f);return _0x1babc7[_0x668e('0x1d')]('Content-Range',_0x519ed5+'-'+_0x57e7d7+'/'+_0xc019c)['json'](_0x3da6f2);}return null;};}function patchUpdates(_0x3d6aa0){return function(_0x3731a0){try{jsonpatch['apply'](_0x3731a0,_0x3d6aa0,!![]);}catch(_0x229678){return BPromise['reject'](_0x229678);}return _0x3731a0['save']();};}function saveUpdates(_0xf11e35,_0x15878e){return function(_0x3ae15e){if(_0x3ae15e){return _0x3ae15e['update'](_0xf11e35)[_0x668e('0x1e')](function(_0x3e18ee){return _0x3e18ee;});}return null;};}function removeEntity(_0xfbfde6,_0x28c602){return function(_0x3a6f2b){if(_0x3a6f2b){return _0x3a6f2b['destroy']()[_0x668e('0x1e')](function(){var _0xba355=_0x3a6f2b[_0x668e('0x1f')]({'plain':!![]});var _0x37e4ad='Triggers';return db['UserProfileResource'][_0x668e('0x20')]({'where':{'type':_0x37e4ad,'resourceId':_0xba355['id']}})[_0x668e('0x1e')](function(){return _0x3a6f2b;});})[_0x668e('0x1e')](function(){_0xfbfde6[_0x668e('0x17')](0xcc)[_0x668e('0x16')]();});}};}function handleEntityNotFound(_0x32aeb9,_0x20704d){return function(_0x527974){if(!_0x527974){_0x32aeb9['sendStatus'](0x194);}return _0x527974;};}function handleError(_0x3dd453,_0x26d4dd){_0x26d4dd=_0x26d4dd||0x1f4;return function(_0x1575f7){logger[_0x668e('0x21')](_0x1575f7[_0x668e('0x22')]);if(_0x1575f7[_0x668e('0x23')]){delete _0x1575f7[_0x668e('0x23')];}_0x3dd453[_0x668e('0x17')](_0x26d4dd)[_0x668e('0x24')](_0x1575f7);};}exports[_0x668e('0x25')]=function(_0x4e2d42,_0x43d2d1){var _0x57a81b={},_0x365248={},_0x1d3103={'count':0x0,'rows':[]};var _0x4c5e0b=_[_0x668e('0x26')](db['Trigger'][_0x668e('0x27')],function(_0x532a81){return{'name':_0x532a81[_0x668e('0x28')],'type':_0x532a81[_0x668e('0x29')]['key']};});_0x365248[_0x668e('0x2a')]=_[_0x668e('0x26')](_0x4c5e0b,_0x668e('0x23'));_0x365248[_0x668e('0x2b')]=_['keys'](_0x4e2d42[_0x668e('0x2b')]);_0x365248[_0x668e('0x2c')]=_[_0x668e('0x2d')](_0x365248[_0x668e('0x2a')],_0x365248[_0x668e('0x2b')]);_0x57a81b['attributes']=_[_0x668e('0x2d')](_0x365248[_0x668e('0x2a')],qs[_0x668e('0x2e')](_0x4e2d42[_0x668e('0x2b')]['fields']));_0x57a81b[_0x668e('0x2f')]=_0x57a81b[_0x668e('0x2f')][_0x668e('0x30')]?_0x57a81b[_0x668e('0x2f')]:_0x365248[_0x668e('0x2a')];if(!_0x4e2d42[_0x668e('0x2b')]['hasOwnProperty']('nolimit')){_0x57a81b[_0x668e('0x1b')]=qs[_0x668e('0x1b')](_0x4e2d42[_0x668e('0x2b')][_0x668e('0x1b')]);_0x57a81b[_0x668e('0x19')]=qs[_0x668e('0x19')](_0x4e2d42['query'][_0x668e('0x19')]);}_0x57a81b['order']=qs[_0x668e('0x31')](_0x4e2d42[_0x668e('0x2b')][_0x668e('0x31')]);_0x57a81b[_0x668e('0x32')]=qs['filters'](_[_0x668e('0x33')](_0x4e2d42[_0x668e('0x2b')],_0x365248[_0x668e('0x2c')]),_0x4c5e0b);if(_0x4e2d42[_0x668e('0x2b')][_0x668e('0x34')]){_0x57a81b['where']=_[_0x668e('0x35')](_0x57a81b[_0x668e('0x32')],{'$or':_[_0x668e('0x26')](_0x4c5e0b,function(_0x210524){if(_0x210524[_0x668e('0x29')]!==_0x668e('0x36')){var _0x45df1a={};_0x45df1a[_0x210524[_0x668e('0x23')]]={'$like':'%'+_0x4e2d42['query'][_0x668e('0x34')]+'%'};return _0x45df1a;}})});}_0x57a81b=_[_0x668e('0x35')]({},_0x57a81b,_0x4e2d42['options']);var _0x49e3b8={'where':_0x57a81b[_0x668e('0x32')]};return db[_0x668e('0x37')][_0x668e('0x1c')](_0x49e3b8)[_0x668e('0x1e')](function(_0x1eecc9){_0x1d3103[_0x668e('0x1c')]=_0x1eecc9;if(_0x4e2d42[_0x668e('0x2b')]['includeAll']){_0x57a81b['include']=[{'all':!![]}];}return db[_0x668e('0x37')][_0x668e('0x38')](_0x57a81b);})[_0x668e('0x1e')](function(_0x59e4cf){_0x1d3103[_0x668e('0x39')]=_0x59e4cf;return _0x1d3103;})[_0x668e('0x1e')](respondWithFilteredResult(_0x43d2d1,_0x57a81b))[_0x668e('0x3a')](handleError(_0x43d2d1,null));};exports[_0x668e('0x3b')]=function(_0x2695c2,_0x2f5e79){var _0x2ac7cc={'raw':![],'where':{'id':_0x2695c2[_0x668e('0x3c')]['id']}},_0x2dccb8={};_0x2dccb8[_0x668e('0x2a')]=_['keys'](db[_0x668e('0x37')][_0x668e('0x27')]);_0x2dccb8[_0x668e('0x2b')]=_[_0x668e('0x3d')](_0x2695c2[_0x668e('0x2b')]);_0x2dccb8[_0x668e('0x2c')]=_[_0x668e('0x2d')](_0x2dccb8[_0x668e('0x2a')],_0x2dccb8[_0x668e('0x2b')]);_0x2ac7cc['attributes']=_[_0x668e('0x2d')](_0x2dccb8[_0x668e('0x2a')],qs['fields'](_0x2695c2[_0x668e('0x2b')][_0x668e('0x2e')]));_0x2ac7cc['attributes']=_0x2ac7cc['attributes']['length']?_0x2ac7cc[_0x668e('0x2f')]:_0x2dccb8['model'];if(_0x2695c2[_0x668e('0x2b')][_0x668e('0x3e')]){_0x2ac7cc[_0x668e('0x3f')]=[{'all':!![]}];}_0x2ac7cc=_[_0x668e('0x35')]({},_0x2ac7cc,_0x2695c2[_0x668e('0x40')]);return db['Trigger']['find'](_0x2ac7cc)[_0x668e('0x1e')](handleEntityNotFound(_0x2f5e79,null))[_0x668e('0x1e')](respondWithResult(_0x2f5e79,null))[_0x668e('0x3a')](handleError(_0x2f5e79,null));};exports[_0x668e('0x41')]=function(_0x5742b1,_0x2bf6da){return db[_0x668e('0x37')][_0x668e('0x41')](_0x5742b1['body'],{})[_0x668e('0x1e')](function(_0x14d6ca){var _0x40712b=_0x5742b1[_0x668e('0x42')][_0x668e('0x1f')]({'plain':!![]});if(!_0x40712b)throw new Error(_0x668e('0x43'));if(_0x40712b[_0x668e('0x44')]==='user'){var _0x115dd0=_0x14d6ca[_0x668e('0x1f')]({'plain':!![]});var _0x2cd6e5='Triggers';return db['UserProfileSection'][_0x668e('0x45')]({'where':{'name':_0x2cd6e5,'userProfileId':_0x40712b[_0x668e('0x46')]},'raw':!![]})[_0x668e('0x1e')](function(_0x3ab28e){if(_0x3ab28e&&_0x3ab28e[_0x668e('0x47')]===0x0){return db[_0x668e('0x48')][_0x668e('0x41')]({'name':_0x115dd0[_0x668e('0x23')],'resourceId':_0x115dd0['id'],'type':_0x3ab28e[_0x668e('0x23')],'sectionId':_0x3ab28e['id']},{})[_0x668e('0x1e')](function(){return _0x14d6ca;});}else{return _0x14d6ca;}})[_0x668e('0x3a')](function(_0x23a088){logger[_0x668e('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a088);throw _0x23a088;});}return _0x14d6ca;})[_0x668e('0x1e')](respondWithResult(_0x2bf6da,0xc9))[_0x668e('0x3a')](handleError(_0x2bf6da,null));};exports[_0x668e('0x49')]=function(_0x4f5b73,_0x40bcca){if(_0x4f5b73[_0x668e('0x4a')]['id']){delete _0x4f5b73['body']['id'];}return db[_0x668e('0x37')][_0x668e('0x45')]({'where':{'id':_0x4f5b73[_0x668e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x40bcca,null))['then'](saveUpdates(_0x4f5b73[_0x668e('0x4a')],null))[_0x668e('0x1e')](respondWithResult(_0x40bcca,null))[_0x668e('0x3a')](handleError(_0x40bcca,null));};exports[_0x668e('0x20')]=function(_0x11fc36,_0x5ee253){return db[_0x668e('0x37')][_0x668e('0x45')]({'where':{'id':_0x11fc36[_0x668e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5ee253,null))[_0x668e('0x1e')](removeEntity(_0x5ee253,null))['catch'](handleError(_0x5ee253,null));};exports['addAllCondition']=function(_0x303951,_0x264224,_0x1d33df){if(_0x303951['body']['id']){delete _0x303951[_0x668e('0x4a')]['id'];}return db[_0x668e('0x37')][_0x668e('0x45')]({'where':{'id':_0x303951['params']['id']}})[_0x668e('0x1e')](handleEntityNotFound(_0x264224,null))[_0x668e('0x1e')](function(_0x59f737){if(_0x59f737){_0x303951['body'][_0x668e('0x4b')]=_0x59f737['id'];return db[_0x668e('0x4c')][_0x668e('0x41')](_0x303951[_0x668e('0x4a')]);}})[_0x668e('0x1e')](respondWithResult(_0x264224,null))['catch'](handleError(_0x264224,null));};exports[_0x668e('0x4d')]=function(_0x116c32,_0x16ed58,_0x5302d6){if(_0x116c32[_0x668e('0x4a')]['id']){delete _0x116c32[_0x668e('0x4a')]['id'];}return db[_0x668e('0x37')][_0x668e('0x45')]({'where':{'id':_0x116c32[_0x668e('0x3c')]['id']}})[_0x668e('0x1e')](handleEntityNotFound(_0x16ed58,null))[_0x668e('0x1e')](function(_0x5c40f9){if(_0x5c40f9){_0x116c32[_0x668e('0x4a')]['TriggerAnyId']=_0x5c40f9['id'];return db[_0x668e('0x4c')][_0x668e('0x41')](_0x116c32['body']);}})['then'](respondWithResult(_0x16ed58,null))[_0x668e('0x3a')](handleError(_0x16ed58,null));};exports['getAllConditions']=function(_0x193caf,_0x4a5301,_0x131d79){var _0x2d9fa0={};var _0x4cfcb1={};var _0x3b94c7;var _0x4377eb;return db[_0x668e('0x37')][_0x668e('0x4e')]({'where':{'id':_0x193caf['params']['id']}})[_0x668e('0x1e')](handleEntityNotFound(_0x4a5301,null))[_0x668e('0x1e')](function(_0x1808cc){if(_0x1808cc){_0x3b94c7=_0x1808cc;_0x4cfcb1[_0x668e('0x2a')]=_[_0x668e('0x3d')](db[_0x668e('0x4c')]['rawAttributes']);_0x4cfcb1[_0x668e('0x2b')]=_['keys'](_0x193caf['query']);_0x4cfcb1[_0x668e('0x2c')]=_['intersection'](_0x4cfcb1[_0x668e('0x2a')],_0x4cfcb1[_0x668e('0x2b')]);_0x2d9fa0['attributes']=_[_0x668e('0x2d')](_0x4cfcb1['model'],qs[_0x668e('0x2e')](_0x193caf[_0x668e('0x2b')][_0x668e('0x2e')]));_0x2d9fa0[_0x668e('0x2f')]=_0x2d9fa0[_0x668e('0x2f')]['length']?_0x2d9fa0[_0x668e('0x2f')]:_0x4cfcb1[_0x668e('0x2a')];_0x2d9fa0[_0x668e('0x4f')]=qs['sort'](_0x193caf['query'][_0x668e('0x31')]);_0x2d9fa0['where']=qs[_0x668e('0x2c')](_[_0x668e('0x33')](_0x193caf[_0x668e('0x2b')],_0x4cfcb1[_0x668e('0x2c')]));if(_0x193caf[_0x668e('0x2b')]['filter']){_0x2d9fa0[_0x668e('0x32')]=_[_0x668e('0x35')](_0x2d9fa0[_0x668e('0x32')],{'$or':_['map'](_0x2d9fa0[_0x668e('0x2f')],function(_0x4c29e3){var _0x1d5ff4={};_0x1d5ff4[_0x4c29e3]={'$like':'%'+_0x193caf['query']['filter']+'%'};return _0x1d5ff4;})});}_0x2d9fa0=_[_0x668e('0x35')]({},_0x2d9fa0,_0x193caf['options']);return _0x3b94c7[_0x668e('0x50')](_0x2d9fa0);}})[_0x668e('0x1e')](function(_0x51c4a9){if(_0x51c4a9){_0x4377eb=_0x51c4a9[_0x668e('0x30')];if(!_0x193caf[_0x668e('0x2b')][_0x668e('0x51')](_0x668e('0x52'))){_0x2d9fa0[_0x668e('0x1b')]=qs[_0x668e('0x1b')](_0x193caf['query'][_0x668e('0x1b')]);_0x2d9fa0[_0x668e('0x19')]=qs[_0x668e('0x19')](_0x193caf[_0x668e('0x2b')][_0x668e('0x19')]);}return _0x3b94c7['getAllConditions'](_0x2d9fa0);}})['then'](function(_0x9a1e4b){if(_0x9a1e4b){return _0x9a1e4b?{'count':_0x4377eb,'rows':_0x9a1e4b}:null;}})[_0x668e('0x1e')](respondWithResult(_0x4a5301,null))[_0x668e('0x3a')](handleError(_0x4a5301,null));};exports[_0x668e('0x53')]=function(_0x231d57,_0x1ae2fb,_0x566c3f){var _0x35e46b={};var _0x357491={};var _0x3fc3b0;var _0x2b620a;return db[_0x668e('0x37')][_0x668e('0x4e')]({'where':{'id':_0x231d57['params']['id']}})[_0x668e('0x1e')](handleEntityNotFound(_0x1ae2fb,null))[_0x668e('0x1e')](function(_0x270a97){if(_0x270a97){_0x3fc3b0=_0x270a97;_0x357491['model']=_[_0x668e('0x3d')](db[_0x668e('0x4c')][_0x668e('0x27')]);_0x357491[_0x668e('0x2b')]=_[_0x668e('0x3d')](_0x231d57[_0x668e('0x2b')]);_0x357491['filters']=_['intersection'](_0x357491['model'],_0x357491[_0x668e('0x2b')]);_0x35e46b[_0x668e('0x2f')]=_[_0x668e('0x2d')](_0x357491[_0x668e('0x2a')],qs[_0x668e('0x2e')](_0x231d57[_0x668e('0x2b')]['fields']));_0x35e46b[_0x668e('0x2f')]=_0x35e46b[_0x668e('0x2f')][_0x668e('0x30')]?_0x35e46b['attributes']:_0x357491[_0x668e('0x2a')];_0x35e46b['order']=qs['sort'](_0x231d57[_0x668e('0x2b')]['sort']);_0x35e46b[_0x668e('0x32')]=qs[_0x668e('0x2c')](_[_0x668e('0x33')](_0x231d57[_0x668e('0x2b')],_0x357491['filters']));if(_0x231d57[_0x668e('0x2b')][_0x668e('0x34')]){_0x35e46b[_0x668e('0x32')]=_[_0x668e('0x35')](_0x35e46b['where'],{'$or':_[_0x668e('0x26')](_0x35e46b[_0x668e('0x2f')],function(_0x3a7a6a){var _0x1e0bf1={};_0x1e0bf1[_0x3a7a6a]={'$like':'%'+_0x231d57[_0x668e('0x2b')][_0x668e('0x34')]+'%'};return _0x1e0bf1;})});}_0x35e46b=_[_0x668e('0x35')]({},_0x35e46b,_0x231d57[_0x668e('0x40')]);return _0x3fc3b0['getAnyConditions'](_0x35e46b);}})[_0x668e('0x1e')](function(_0x2c56a4){if(_0x2c56a4){_0x2b620a=_0x2c56a4[_0x668e('0x30')];if(!_0x231d57['query'][_0x668e('0x51')](_0x668e('0x52'))){_0x35e46b[_0x668e('0x1b')]=qs[_0x668e('0x1b')](_0x231d57[_0x668e('0x2b')][_0x668e('0x1b')]);_0x35e46b[_0x668e('0x19')]=qs[_0x668e('0x19')](_0x231d57[_0x668e('0x2b')][_0x668e('0x19')]);}return _0x3fc3b0['getAnyConditions'](_0x35e46b);}})[_0x668e('0x1e')](function(_0x56b102){if(_0x56b102){return _0x56b102?{'count':_0x2b620a,'rows':_0x56b102}:null;}})[_0x668e('0x1e')](respondWithResult(_0x1ae2fb,null))[_0x668e('0x3a')](handleError(_0x1ae2fb,null));};exports['addAction']=function(_0x58b91d,_0x504ff1,_0x1b1cf3){if(_0x58b91d[_0x668e('0x4a')]['id']){delete _0x58b91d[_0x668e('0x4a')]['id'];}return db[_0x668e('0x37')][_0x668e('0x45')]({'where':{'id':_0x58b91d['params']['id']}})['then'](handleEntityNotFound(_0x504ff1,null))['then'](function(_0x241672){if(_0x241672){_0x58b91d[_0x668e('0x4a')]['TriggerId']=_0x241672['id'];return db[_0x668e('0x54')][_0x668e('0x41')](_0x58b91d[_0x668e('0x4a')]);}})['then'](respondWithResult(_0x504ff1,null))[_0x668e('0x3a')](handleError(_0x504ff1,null));};exports['getActions']=function(_0x4c1717,_0x5d25df,_0x93f0d4){var _0x298c3d={};var _0x3202d0={};var _0x1f267f;var _0x3504ff;return db[_0x668e('0x37')][_0x668e('0x4e')]({'where':{'id':_0x4c1717[_0x668e('0x3c')]['id']}})[_0x668e('0x1e')](handleEntityNotFound(_0x5d25df,null))[_0x668e('0x1e')](function(_0x161c4b){if(_0x161c4b){_0x1f267f=_0x161c4b;_0x3202d0[_0x668e('0x2a')]=_[_0x668e('0x3d')](db[_0x668e('0x54')][_0x668e('0x27')]);_0x3202d0[_0x668e('0x2b')]=_[_0x668e('0x3d')](_0x4c1717[_0x668e('0x2b')]);_0x3202d0['filters']=_[_0x668e('0x2d')](_0x3202d0[_0x668e('0x2a')],_0x3202d0[_0x668e('0x2b')]);_0x298c3d[_0x668e('0x2f')]=_[_0x668e('0x2d')](_0x3202d0[_0x668e('0x2a')],qs['fields'](_0x4c1717[_0x668e('0x2b')][_0x668e('0x2e')]));_0x298c3d[_0x668e('0x2f')]=_0x298c3d[_0x668e('0x2f')][_0x668e('0x30')]?_0x298c3d[_0x668e('0x2f')]:_0x3202d0[_0x668e('0x2a')];_0x298c3d[_0x668e('0x4f')]=qs['sort'](_0x4c1717[_0x668e('0x2b')]['sort']);_0x298c3d[_0x668e('0x32')]=qs[_0x668e('0x2c')](_[_0x668e('0x33')](_0x4c1717['query'],_0x3202d0['filters']));if(_0x4c1717[_0x668e('0x2b')]['filter']){_0x298c3d[_0x668e('0x32')]=_[_0x668e('0x35')](_0x298c3d[_0x668e('0x32')],{'$or':_[_0x668e('0x26')](_0x298c3d['attributes'],function(_0x24e180){var _0x9f6b6d={};_0x9f6b6d[_0x24e180]={'$like':'%'+_0x4c1717[_0x668e('0x2b')][_0x668e('0x34')]+'%'};return _0x9f6b6d;})});}_0x298c3d=_[_0x668e('0x35')]({},_0x298c3d,_0x4c1717[_0x668e('0x40')]);return _0x1f267f[_0x668e('0x55')](_0x298c3d);}})[_0x668e('0x1e')](function(_0x814741){if(_0x814741){_0x3504ff=_0x814741['length'];if(!_0x4c1717[_0x668e('0x2b')][_0x668e('0x51')]('nolimit')){_0x298c3d['limit']=qs[_0x668e('0x1b')](_0x4c1717[_0x668e('0x2b')]['limit']);_0x298c3d[_0x668e('0x19')]=qs['offset'](_0x4c1717[_0x668e('0x2b')][_0x668e('0x19')]);}return _0x1f267f[_0x668e('0x55')](_0x298c3d);}})[_0x668e('0x1e')](function(_0xeaf59){if(_0xeaf59){return _0xeaf59?{'count':_0x3504ff,'rows':_0xeaf59}:null;}})[_0x668e('0x1e')](respondWithResult(_0x5d25df,null))[_0x668e('0x3a')](handleError(_0x5d25df,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 24cc6f0..e3f2609 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 _0x165d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x10d914,_0x57bc1f){var _0x40f437=function(_0x3e3275){while(--_0x3e3275){_0x10d914['push'](_0x10d914['shift']());}};_0x40f437(++_0x57bc1f);}(_0x165d,0x14a));var _0xd165=function(_0x3567a1,_0x28aed2){_0x3567a1=_0x3567a1-0x0;var _0x5dba0f=_0x165d[_0x3567a1];return _0x5dba0f;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var logger=require(_0xd165('0x2'))(_0xd165('0x3'));var moment=require(_0xd165('0x4'));var BPromise=require(_0xd165('0x5'));var rp=require(_0xd165('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x5435f9,_0x42d256){return _0x5435f9[_0xd165('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf185=['define','Trigger','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports'];(function(_0x507e17,_0x4a2920){var _0x404728=function(_0x54a7dd){while(--_0x54a7dd){_0x507e17['push'](_0x507e17['shift']());}};_0x404728(++_0x4a2920);}(_0xf185,0x1be));var _0x5f18=function(_0x43ce1f,_0x55f120){_0x43ce1f=_0x43ce1f-0x0;var _0x140a5b=_0xf185[_0x43ce1f];return _0x140a5b;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require(_0x5f18('0x5'));var fs=require('fs');var path=require(_0x5f18('0x6'));var rimraf=require('rimraf');var config=require(_0x5f18('0x7'));var attributes=require(_0x5f18('0x8'));module[_0x5f18('0x9')]=function(_0x1cac08,_0x5b7cc5){return _0x1cac08[_0x5f18('0xa')](_0x5f18('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 27bca6d..bcc4ba0 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 _0x39f7=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','Trigger','options','raw','where','limit','include','map','model','attributes','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x39f7,0xcf));var _0x739f=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x39f7[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0x739f('0x0'));var util=require(_0x739f('0x1'));var moment=require(_0x739f('0x2'));var BPromise=require(_0x739f('0x3'));var rs=require(_0x739f('0x4'));var fs=require('fs');var Redis=require(_0x739f('0x5'));var db=require(_0x739f('0x6'))['db'];var utils=require(_0x739f('0x7'));var logger=require(_0x739f('0x8'))(_0x739f('0x9'));var config=require('../../config/environment');var jayson=require(_0x739f('0xa'));var client=jayson[_0x739f('0xb')][_0x739f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf0655,_0x5b2f7a,_0x3d69f0){return new BPromise(function(_0x1f749f,_0x4b1883){return client[_0x739f('0xd')](_0xcf0655,_0x3d69f0)[_0x739f('0xe')](function(_0x3b0971){logger[_0x739f('0xf')](_0x739f('0x10'),_0x5b2f7a,_0x739f('0x11'));logger[_0x739f('0x12')](_0x739f('0x13'),_0x5b2f7a,_0x739f('0x11'),JSON['stringify'](_0x3b0971));if(_0x3b0971['error']){if(_0x3b0971[_0x739f('0x14')][_0x739f('0x15')]===0x1f4){logger[_0x739f('0x14')](_0x739f('0x10'),_0x5b2f7a,_0x3b0971['error'][_0x739f('0x16')]);return _0x4b1883(_0x3b0971[_0x739f('0x14')][_0x739f('0x16')]);}logger[_0x739f('0x14')](_0x739f('0x10'),_0x5b2f7a,_0x3b0971[_0x739f('0x14')]['message']);return _0x1f749f(_0x3b0971[_0x739f('0x14')]['message']);}else{logger[_0x739f('0xf')]('Trigger,\x20%s,\x20%s',_0x5b2f7a,'request\x20sent');_0x1f749f(_0x3b0971['result'][_0x739f('0x16')]);}})[_0x739f('0x17')](function(_0x4301ee){logger[_0x739f('0x14')]('Trigger,\x20%s,\x20%s',_0x5b2f7a,_0x4301ee);_0x4b1883(_0x4301ee);});});}exports[_0x739f('0x18')]=function(_0x5bf985){var _0x3c4ce9=this;return new Promise(function(_0x97e35a,_0x3abb70){return db[_0x739f('0x19')]['findAll']({'raw':_0x5bf985[_0x739f('0x1a')]?_0x5bf985[_0x739f('0x1a')][_0x739f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bf985[_0x739f('0x1a')]?_0x5bf985['options'][_0x739f('0x1c')]||null:null,'attributes':_0x5bf985[_0x739f('0x1a')]?_0x5bf985[_0x739f('0x1a')]['attributes']||null:null,'limit':_0x5bf985[_0x739f('0x1a')]?_0x5bf985[_0x739f('0x1a')][_0x739f('0x1d')]||null:null,'include':_0x5bf985[_0x739f('0x1a')]?_0x5bf985[_0x739f('0x1a')][_0x739f('0x1e')]?_[_0x739f('0x1f')](_0x5bf985['options'][_0x739f('0x1e')],function(_0x32a012){return{'model':db[_0x32a012[_0x739f('0x20')]],'as':_0x32a012['as'],'attributes':_0x32a012[_0x739f('0x21')],'include':_0x32a012[_0x739f('0x1e')]?_[_0x739f('0x1f')](_0x32a012[_0x739f('0x1e')],function(_0x23f57f){return{'model':db[_0x23f57f['model']],'as':_0x23f57f['as'],'attributes':_0x23f57f[_0x739f('0x21')],'include':_0x23f57f[_0x739f('0x1e')]?_[_0x739f('0x1f')](_0x23f57f['include'],function(_0x130dd2){return{'model':db[_0x130dd2[_0x739f('0x20')]],'as':_0x130dd2['as'],'attributes':_0x130dd2[_0x739f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x739f('0xe')](function(_0x2c335){logger[_0x739f('0xf')](_0x739f('0x18'),_0x5bf985);logger[_0x739f('0x12')]('GetTrigger',_0x5bf985,JSON[_0x739f('0x22')](_0x2c335));_0x97e35a(_0x2c335);})[_0x739f('0x17')](function(_0x281508){logger[_0x739f('0x14')](_0x739f('0x18'),_0x281508[_0x739f('0x16')],_0x5bf985);_0x3abb70(_0x3c4ce9[_0x739f('0x14')](0x1f4,_0x281508['message']));});});};exports[_0x739f('0x23')]=function(_0x584b93){var _0x5793c7=this;return new Promise(function(_0xf6fb52,_0x16ff7f){return db['Trigger'][_0x739f('0x24')]({'raw':_0x584b93[_0x739f('0x1a')]?_0x584b93[_0x739f('0x1a')][_0x739f('0x1b')]===undefined?!![]:![]:!![],'where':_0x584b93[_0x739f('0x1a')]?_0x584b93[_0x739f('0x1a')][_0x739f('0x1c')]||null:null,'attributes':_0x584b93[_0x739f('0x1a')]?_0x584b93[_0x739f('0x1a')][_0x739f('0x21')]||null:null,'include':_0x584b93['options']?_0x584b93[_0x739f('0x1a')][_0x739f('0x1e')]?_[_0x739f('0x1f')](_0x584b93[_0x739f('0x1a')]['include'],function(_0x4cbe5a){return{'model':db[_0x4cbe5a[_0x739f('0x20')]],'as':_0x4cbe5a['as'],'attributes':_0x4cbe5a[_0x739f('0x21')],'include':_0x4cbe5a['include']?_[_0x739f('0x1f')](_0x4cbe5a[_0x739f('0x1e')],function(_0x39de51){return{'model':db[_0x39de51[_0x739f('0x20')]],'as':_0x39de51['as'],'attributes':_0x39de51['attributes'],'include':_0x39de51['include']?_[_0x739f('0x1f')](_0x39de51[_0x739f('0x1e')],function(_0x429932){return{'model':db[_0x429932['model']],'as':_0x429932['as'],'attributes':_0x429932[_0x739f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x739f('0xe')](function(_0x39d473){logger['info'](_0x739f('0x23'),_0x584b93);logger['debug']('ShowTrigger',_0x584b93,JSON[_0x739f('0x22')](_0x39d473));_0xf6fb52(_0x39d473);})[_0x739f('0x17')](function(_0xc57746){logger[_0x739f('0x14')](_0x739f('0x23'),_0xc57746[_0x739f('0x16')],_0x584b93);_0x16ff7f(_0x5793c7[_0x739f('0x14')](0x1f4,_0xc57746['message']));});});}; \ No newline at end of file +var _0x80e4=['../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','Trigger','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x80e4,0x8f));var _0x480e=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x80e4[_0x569caa];return _0x44cb5a;};'use strict';var _=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var moment=require(_0x480e('0x2'));var BPromise=require('bluebird');var rs=require(_0x480e('0x3'));var fs=require('fs');var Redis=require(_0x480e('0x4'));var db=require(_0x480e('0x5'))['db'];var utils=require(_0x480e('0x6'));var logger=require(_0x480e('0x7'))(_0x480e('0x8'));var config=require(_0x480e('0x9'));var jayson=require(_0x480e('0xa'));var client=jayson[_0x480e('0xb')][_0x480e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e6039,_0x3aebd1,_0xaabda6){return new BPromise(function(_0x14782d,_0x131221){return client[_0x480e('0xd')](_0x5e6039,_0xaabda6)['then'](function(_0x2183d4){logger[_0x480e('0xe')](_0x480e('0xf'),_0x3aebd1,_0x480e('0x10'));logger[_0x480e('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3aebd1,_0x480e('0x10'),JSON[_0x480e('0x12')](_0x2183d4));if(_0x2183d4['error']){if(_0x2183d4['error'][_0x480e('0x13')]===0x1f4){logger['error'](_0x480e('0xf'),_0x3aebd1,_0x2183d4['error'][_0x480e('0x14')]);return _0x131221(_0x2183d4[_0x480e('0x15')]['message']);}logger[_0x480e('0x15')]('Trigger,\x20%s,\x20%s',_0x3aebd1,_0x2183d4['error'][_0x480e('0x14')]);return _0x14782d(_0x2183d4[_0x480e('0x15')][_0x480e('0x14')]);}else{logger[_0x480e('0xe')](_0x480e('0xf'),_0x3aebd1,'request\x20sent');_0x14782d(_0x2183d4[_0x480e('0x16')][_0x480e('0x14')]);}})[_0x480e('0x17')](function(_0xbef29f){logger[_0x480e('0x15')](_0x480e('0xf'),_0x3aebd1,_0xbef29f);_0x131221(_0xbef29f);});});}exports['GetTrigger']=function(_0x39c6c1){var _0x112d97=this;return new Promise(function(_0x208817,_0x23ddd0){return db['Trigger'][_0x480e('0x18')]({'raw':_0x39c6c1[_0x480e('0x19')]?_0x39c6c1[_0x480e('0x19')][_0x480e('0x1a')]===undefined?!![]:![]:!![],'where':_0x39c6c1['options']?_0x39c6c1['options'][_0x480e('0x1b')]||null:null,'attributes':_0x39c6c1[_0x480e('0x19')]?_0x39c6c1[_0x480e('0x19')][_0x480e('0x1c')]||null:null,'limit':_0x39c6c1[_0x480e('0x19')]?_0x39c6c1[_0x480e('0x19')][_0x480e('0x1d')]||null:null,'include':_0x39c6c1[_0x480e('0x19')]?_0x39c6c1[_0x480e('0x19')][_0x480e('0x1e')]?_[_0x480e('0x1f')](_0x39c6c1[_0x480e('0x19')]['include'],function(_0x374e11){return{'model':db[_0x374e11[_0x480e('0x20')]],'as':_0x374e11['as'],'attributes':_0x374e11[_0x480e('0x1c')],'include':_0x374e11[_0x480e('0x1e')]?_[_0x480e('0x1f')](_0x374e11[_0x480e('0x1e')],function(_0x1eafd4){return{'model':db[_0x1eafd4[_0x480e('0x20')]],'as':_0x1eafd4['as'],'attributes':_0x1eafd4[_0x480e('0x1c')],'include':_0x1eafd4[_0x480e('0x1e')]?_['map'](_0x1eafd4[_0x480e('0x1e')],function(_0x2272eb){return{'model':db[_0x2272eb[_0x480e('0x20')]],'as':_0x2272eb['as'],'attributes':_0x2272eb[_0x480e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x480e('0x21')](function(_0x4b6f45){logger[_0x480e('0xe')]('GetTrigger',_0x39c6c1);logger[_0x480e('0x11')]('GetTrigger',_0x39c6c1,JSON[_0x480e('0x12')](_0x4b6f45));_0x208817(_0x4b6f45);})['catch'](function(_0x3c9dd8){logger[_0x480e('0x15')](_0x480e('0x22'),_0x3c9dd8[_0x480e('0x14')],_0x39c6c1);_0x23ddd0(_0x112d97[_0x480e('0x15')](0x1f4,_0x3c9dd8['message']));});});};exports[_0x480e('0x23')]=function(_0x3d2d44){var _0x4f0a74=this;return new Promise(function(_0x47c929,_0x51e37d){return db[_0x480e('0x24')][_0x480e('0x25')]({'raw':_0x3d2d44['options']?_0x3d2d44['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d2d44[_0x480e('0x19')]?_0x3d2d44['options']['where']||null:null,'attributes':_0x3d2d44[_0x480e('0x19')]?_0x3d2d44['options'][_0x480e('0x1c')]||null:null,'include':_0x3d2d44['options']?_0x3d2d44['options']['include']?_[_0x480e('0x1f')](_0x3d2d44[_0x480e('0x19')]['include'],function(_0x18f19b){return{'model':db[_0x18f19b[_0x480e('0x20')]],'as':_0x18f19b['as'],'attributes':_0x18f19b[_0x480e('0x1c')],'include':_0x18f19b['include']?_['map'](_0x18f19b['include'],function(_0x599f2a){return{'model':db[_0x599f2a['model']],'as':_0x599f2a['as'],'attributes':_0x599f2a[_0x480e('0x1c')],'include':_0x599f2a[_0x480e('0x1e')]?_['map'](_0x599f2a[_0x480e('0x1e')],function(_0xd9dd1f){return{'model':db[_0xd9dd1f[_0x480e('0x20')]],'as':_0xd9dd1f['as'],'attributes':_0xd9dd1f[_0x480e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd78a60){logger[_0x480e('0xe')]('ShowTrigger',_0x3d2d44);logger[_0x480e('0x11')](_0x480e('0x23'),_0x3d2d44,JSON[_0x480e('0x12')](_0xd78a60));_0x47c929(_0xd78a60);})['catch'](function(_0x15e8d7){logger[_0x480e('0x15')](_0x480e('0x23'),_0x15e8d7[_0x480e('0x14')],_0x3d2d44);_0x51e37d(_0x4f0a74[_0x480e('0x15')](0x1f4,_0x15e8d7['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 29ae99d..881039c 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 _0xe2f1=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','/:id','post','clone','create'];(function(_0x43ef0e,_0x5c8c64){var _0x4d7032=function(_0x540a4c){while(--_0x540a4c){_0x43ef0e['push'](_0x43ef0e['shift']());}};_0x4d7032(++_0x5c8c64);}(_0xe2f1,0xcd));var _0x1e2f=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xe2f1[_0xc0d9bc];return _0x32ff73;};'use strict';var multer=require('multer');var util=require(_0x1e2f('0x0'));var path=require(_0x1e2f('0x1'));var timeout=require(_0x1e2f('0x2'));var express=require(_0x1e2f('0x3'));var router=express[_0x1e2f('0x4')]();var fs_extra=require(_0x1e2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e2f('0x6'));var config=require('../../config/environment');var controller=require(_0x1e2f('0x7'));router['get']('/',auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x9')]);router[_0x1e2f('0xa')](_0x1e2f('0xb'),auth[_0x1e2f('0x8')](),controller['show']);router[_0x1e2f('0xc')]('/:id/clone',auth[_0x1e2f('0x8')](),controller[_0x1e2f('0xd')]);router[_0x1e2f('0xc')]('/',auth[_0x1e2f('0x8')](),controller[_0x1e2f('0xe')]);router[_0x1e2f('0xf')]('/:id',auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x10')]);router[_0x1e2f('0x11')](_0x1e2f('0xb'),auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x12')]);module[_0x1e2f('0x13')]=router; \ No newline at end of file +var _0x8aa3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','/:id','show','/:id/clone','clone','post','create','put','update','delete','exports','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8aa3,0x138));var _0x38aa=function(_0x553662,_0x4a91aa){_0x553662=_0x553662-0x0;var _0x4d992f=_0x8aa3[_0x553662];return _0x4d992f;};'use strict';var multer=require(_0x38aa('0x0'));var util=require(_0x38aa('0x1'));var path=require(_0x38aa('0x2'));var timeout=require(_0x38aa('0x3'));var express=require(_0x38aa('0x4'));var router=express[_0x38aa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x38aa('0x6'));var interaction=require(_0x38aa('0x7'));var config=require(_0x38aa('0x8'));var controller=require(_0x38aa('0x9'));router['get']('/',auth[_0x38aa('0xa')](),controller['index']);router['get'](_0x38aa('0xb'),auth[_0x38aa('0xa')](),controller[_0x38aa('0xc')]);router['post'](_0x38aa('0xd'),auth[_0x38aa('0xa')](),controller[_0x38aa('0xe')]);router[_0x38aa('0xf')]('/',auth[_0x38aa('0xa')](),controller[_0x38aa('0x10')]);router[_0x38aa('0x11')](_0x38aa('0xb'),auth[_0x38aa('0xa')](),controller[_0x38aa('0x12')]);router[_0x38aa('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x38aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 034a652..e0ede86 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 _0x69e4=['ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','uac','uas','pai','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','nat','split'];(function(_0x635e28,_0x4eecc1){var _0x5bb9dc=function(_0x4e4486){while(--_0x4e4486){_0x635e28['push'](_0x635e28['shift']());}};_0x5bb9dc(++_0x4eecc1);}(_0x69e4,0xd4));var _0x469e=function(_0x4a1327,_0x3642ab){_0x4a1327=_0x4a1327-0x0;var _0x2fcd03=_0x69e4[_0x4a1327];return _0x2fcd03;};'use strict';var Sequelize=require(_0x469e('0x0'));module['exports']={'name':{'type':Sequelize[_0x469e('0x1')],'allowNull':![],'unique':_0x469e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x4'),_0x469e('0x5'),_0x469e('0x6')),'allowNull':![],'defaultValue':_0x469e('0x4')},'context':{'type':Sequelize[_0x469e('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x7'),_0x469e('0x8'),_0x469e('0x9'),_0x469e('0xa'),_0x469e('0xb'),_0x469e('0xc'),_0x469e('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x469e('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x469e('0x1')]},'remotesecret':{'type':Sequelize[_0x469e('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x469e('0xe'),'set':function(_0x1c18f7){this['setDataValue'](_0x469e('0xf'),_0x1c18f7?_0x1c18f7[_0x469e('0x10')](','):null);},'get':function(){return this[_0x469e('0x11')](_0x469e('0xf'))?this[_0x469e('0x11')](_0x469e('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x469e('0x12'),_0x469e('0x13'),_0x469e('0x14'),_0x469e('0x15'),'auto'),'defaultValue':_0x469e('0x12')},'directmedia':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no',_0x469e('0x17'),'update',_0x469e('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x469e('0x1')]},'nat':{'type':Sequelize[_0x469e('0x1')],'defaultValue':_0x469e('0x19'),'set':function(_0x25e588){this['setDataValue']('nat',_0x25e588?_0x25e588[_0x469e('0x10')](','):null);},'get':function(){return this[_0x469e('0x11')](_0x469e('0x1a'))?this[_0x469e('0x11')]('nat')[_0x469e('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x469e('0x1')]},'namedcallgroup':{'type':Sequelize[_0x469e('0x1')]},'pickupgroup':{'type':Sequelize[_0x469e('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x469e('0x1')]},'language':{'type':Sequelize[_0x469e('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x469e('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x469e('0x1c'),'set':function(_0x352b45){this[_0x469e('0x1d')]('allow',_0x352b45?_0x352b45['join'](';'):_0x469e('0x1c'));},'get':function(){return this['getDataValue'](_0x469e('0x1e'))?this[_0x469e('0x11')](_0x469e('0x1e'))['split'](';'):null;},'comment':_0x469e('0x1f')},'autoframing':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'insecure':{'type':Sequelize[_0x469e('0x1')],'defaultValue':_0x469e('0x20'),'set':function(_0x190da9){this[_0x469e('0x1d')]('insecure',_0x190da9?_0x190da9[_0x469e('0x10')](','):null);},'get':function(){return this[_0x469e('0x11')](_0x469e('0x21'))?this['getDataValue'](_0x469e('0x21'))[_0x469e('0x1b')](','):null;},'comment':_0x469e('0x22')},'trustrpid':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x469e('0x23'))},'promiscredir':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x469e('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x469e('0x24')},'amaflags':{'type':Sequelize[_0x469e('0x1')]},'callcounter':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x469e('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x469e('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x469e('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x469e('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'mailbox':{'type':Sequelize[_0x469e('0x1')]},'session_timers':{'type':Sequelize[_0x469e('0x3')]('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x469e('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x469e('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x26'),'uas'),'defaultValue':_0x469e('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x469e('0x1')]},'regexten':{'type':Sequelize[_0x469e('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x469e('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x469e('0x16')},'keepalive':{'type':Sequelize[_0x469e('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x469e('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x469e('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x469e('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x469e('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x469e('0x3')]('yes','no',_0x469e('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x469e('0x1')]},'callbackextension':{'type':Sequelize[_0x469e('0x1')]},'timert1':{'type':Sequelize[_0x469e('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x469e('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x469e('0x1')]},'contactdeny':{'type':Sequelize[_0x469e('0x1')]},'contactacl':{'type':Sequelize[_0x469e('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x469e('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x469e('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'force_avp':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'icesupport':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no','fingerprint',_0x469e('0x29'))},'dtlsrekey':{'type':Sequelize[_0x469e('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x469e('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x469e('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x469e('0x1')]},'dtlssetup':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x2a'),_0x469e('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x469e('0x1')]},'usereqphone':{'type':Sequelize[_0x469e('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x469e('0x1')]},'recordofffeature':{'type':Sequelize[_0x469e('0x1')]},'call_limit':{'type':Sequelize[_0x469e('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x469e('0x3')](_0x469e('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x469e('0x16'),'no')},'vmexten':{'type':Sequelize[_0x469e('0x1')]},'mohinterpret':{'type':Sequelize[_0x469e('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x469e('0x2c')},'canreinvite':{'type':Sequelize[_0x469e('0x3')]('yes','no',_0x469e('0x17'),_0x469e('0x2d'),_0x469e('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x469e('0x1')]},'otherFields':{'type':Sequelize[_0x469e('0x1')]},'active':{'type':Sequelize[_0x469e('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x469e('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x50fe=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','setDataValue','transport','getDataValue'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x50fe,0x92));var _0xe50f=function(_0x44e24e,_0x3078c4){_0x44e24e=_0x44e24e-0x0;var _0x267b96=_0x50fe[_0x44e24e];return _0x267b96;};'use strict';var Sequelize=require(_0xe50f('0x0'));module[_0xe50f('0x1')]={'name':{'type':Sequelize[_0xe50f('0x2')],'allowNull':![],'unique':_0xe50f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x5'),_0xe50f('0x6'),_0xe50f('0x7')),'allowNull':![],'defaultValue':_0xe50f('0x5')},'context':{'type':Sequelize[_0xe50f('0x2')],'allowNull':![],'defaultValue':_0xe50f('0x8')},'callingpres':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x9'),_0xe50f('0xa'),_0xe50f('0xb'),_0xe50f('0xc'),_0xe50f('0xd'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xe50f('0xe'))},'deny':{'type':Sequelize[_0xe50f('0x2')]},'permit':{'type':Sequelize[_0xe50f('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xe50f('0x2')]},'remotesecret':{'type':Sequelize[_0xe50f('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xe50f('0xf'),'set':function(_0x338c0c){this[_0xe50f('0x10')](_0xe50f('0x11'),_0x338c0c?_0x338c0c['join'](','):null);},'get':function(){return this[_0xe50f('0x12')](_0xe50f('0x11'))?this['getDataValue'](_0xe50f('0x11'))[_0xe50f('0x13')](','):null;},'comment':_0xe50f('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe50f('0x15'),_0xe50f('0x16'),_0xe50f('0x17'),'inband',_0xe50f('0x18')),'defaultValue':_0xe50f('0x15')},'directmedia':{'type':Sequelize[_0xe50f('0x4')]('yes','no',_0xe50f('0x19'),_0xe50f('0x1a'),_0xe50f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe50f('0x2')]},'directmediadeny':{'type':Sequelize[_0xe50f('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x2ce469){this['setDataValue'](_0xe50f('0x1d'),_0x2ce469?_0x2ce469['join'](','):null);},'get':function(){return this[_0xe50f('0x12')](_0xe50f('0x1d'))?this['getDataValue'](_0xe50f('0x1d'))[_0xe50f('0x13')](','):null;},'comment':_0xe50f('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe50f('0x2')]},'pickupgroup':{'type':Sequelize[_0xe50f('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe50f('0x2')]},'language':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe50f('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':_0xe50f('0x1f')},'allow':{'type':Sequelize[_0xe50f('0x2')],'allowNull':![],'defaultValue':_0xe50f('0x20'),'set':function(_0x4e099e){this[_0xe50f('0x10')](_0xe50f('0x21'),_0x4e099e?_0x4e099e[_0xe50f('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe50f('0x12')](_0xe50f('0x21'))?this[_0xe50f('0x12')]('allow')[_0xe50f('0x13')](';'):null;},'comment':_0xe50f('0x23')},'autoframing':{'type':Sequelize[_0xe50f('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':_0xe50f('0x24'),'set':function(_0x451cfe){this[_0xe50f('0x10')](_0xe50f('0x25'),_0x451cfe?_0x451cfe['join'](','):null);},'get':function(){return this['getDataValue'](_0xe50f('0x25'))?this['getDataValue'](_0xe50f('0x25'))[_0xe50f('0x13')](','):null;},'comment':_0xe50f('0x26')},'trustrpid':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe50f('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe50f('0x4')]('yes','no',_0xe50f('0x27'))},'promiscredir':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe50f('0x2')]},'callerid':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':_0xe50f('0x28')},'amaflags':{'type':Sequelize[_0xe50f('0x2')]},'callcounter':{'type':Sequelize[_0xe50f('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xe50f('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xe50f('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe50f('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0xe50f('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no',_0xe50f('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe50f('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe50f('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xe50f('0x2b'),_0xe50f('0x2c'),_0xe50f('0x2d'))},'session_expires':{'type':Sequelize[_0xe50f('0x29')](0xb)},'session_minse':{'type':Sequelize[_0xe50f('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0xe50f('0x4')]('uac',_0xe50f('0x2e')),'defaultValue':_0xe50f('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0xe50f('0x2')]},'regexten':{'type':Sequelize[_0xe50f('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe50f('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no'),'defaultValue':_0xe50f('0x1c')},'keepalive':{'type':Sequelize[_0xe50f('0x29')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe50f('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe50f('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe50f('0x29')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xe50f('0x1c'),'no',_0xe50f('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe50f('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xe50f('0x29')](0xb)},'timerb':{'type':Sequelize[_0xe50f('0x29')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe50f('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe50f('0x2')]},'maxforwards':{'type':Sequelize[_0xe50f('0x29')](0xb)},'encryption':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe50f('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xe50f('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe50f('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no',_0xe50f('0x30'),_0xe50f('0x31'))},'dtlsrekey':{'type':Sequelize[_0xe50f('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe50f('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xe50f('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x32'),_0xe50f('0x33'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe50f('0x2')]},'usereqphone':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe50f('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xe50f('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0xe50f('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xe50f('0x2')]},'mohinterpret':{'type':Sequelize[_0xe50f('0x2')]},'mohsuggest':{'type':Sequelize[_0xe50f('0x2')]},'parkinglot':{'type':Sequelize[_0xe50f('0x2')]},'description':{'type':Sequelize[_0xe50f('0x2')]},'host':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':_0xe50f('0x34')},'canreinvite':{'type':Sequelize[_0xe50f('0x4')](_0xe50f('0x1c'),'no','nonat','update',_0xe50f('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe50f('0x2')]},'otherFields':{'type':Sequelize[_0xe50f('0x2')]},'active':{'type':Sequelize[_0xe50f('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe50f('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5d7affb..9b2cf70 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 _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3ac83e,_0x5e584e){var _0x1fc751=function(_0x198920){while(--_0x198920){_0x3ac83e['push'](_0x3ac83e['shift']());}};_0x1fc751(++_0x5e584e);}(_0xbec5,0xe5));var _0x5bec=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0xbec5[_0x284a61];return _0x220e3c;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,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(_0x3fe0fe,_0x3bdc49){var _0x5c11f4=function(_0x127973){while(--_0x127973){_0x3fe0fe['push'](_0x3fe0fe['shift']());}};_0x5c11f4(++_0x3bdc49);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1e3525,_0x59e0fe){_0x1e3525=_0x1e3525-0x0;var _0x1664b1=_0x9bde[_0x1e3525];return _0x1664b1;};'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 971af7d..e1e0467 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 _0xf886=['Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x1ea332,_0x190a9c){var _0x23e291=function(_0x3f6e65){while(--_0x3f6e65){_0x1ea332['push'](_0x1ea332['shift']());}};_0x23e291(++_0x190a9c);}(_0xf886,0x64));var _0x6f88=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xf886[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x6f88('0x0'));var util=require(_0x6f88('0x1'));var logger=require(_0x6f88('0x2'))('api');var moment=require(_0x6f88('0x3'));var BPromise=require(_0x6f88('0x4'));var rp=require(_0x6f88('0x5'));var fs=require('fs');var path=require(_0x6f88('0x6'));var rimraf=require(_0x6f88('0x7'));var config=require(_0x6f88('0x8'));var attributes=require(_0x6f88('0x9'));module[_0x6f88('0xa')]=function(_0x5d0a94,_0x5c0921){return _0x5d0a94[_0x6f88('0xb')](_0x6f88('0xc'),attributes,{'tableName':_0x6f88('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6b9=['request-promise','path','rimraf','./trunk.attributes','exports','define','lodash','api','moment'];(function(_0x4f7887,_0xec1fc0){var _0x76cf9c=function(_0x54c51e){while(--_0x54c51e){_0x4f7887['push'](_0x4f7887['shift']());}};_0x76cf9c(++_0xec1fc0);}(_0xd6b9,0xd5));var _0x9d6b=function(_0x419647,_0x10275f){_0x419647=_0x419647-0x0;var _0x1229c7=_0xd6b9[_0x419647];return _0x1229c7;};'use strict';var _=require(_0x9d6b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d6b('0x1'));var moment=require(_0x9d6b('0x2'));var BPromise=require('bluebird');var rp=require(_0x9d6b('0x3'));var fs=require('fs');var path=require(_0x9d6b('0x4'));var rimraf=require(_0x9d6b('0x5'));var config=require('../../config/environment');var attributes=require(_0x9d6b('0x6'));module[_0x9d6b('0x7')]=function(_0xaf0eb4,_0x43e43f){return _0xaf0eb4[_0x9d6b('0x8')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index dc7a60c..f633f3f 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 _0x0994=['result','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','Trunk','ShowTrunk','debug','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message'];(function(_0x2967f7,_0x4f9bff){var _0x205198=function(_0x18e46f){while(--_0x18e46f){_0x2967f7['push'](_0x2967f7['shift']());}};_0x205198(++_0x4f9bff);}(_0x0994,0xb1));var _0x4099=function(_0x22a96e,_0x100624){_0x22a96e=_0x22a96e-0x0;var _0xfbb257=_0x0994[_0x22a96e];return _0xfbb257;};'use strict';var _=require('lodash');var util=require(_0x4099('0x0'));var moment=require(_0x4099('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4099('0x2'));var logger=require(_0x4099('0x3'))('rpc');var config=require(_0x4099('0x4'));var jayson=require(_0x4099('0x5'));var client=jayson[_0x4099('0x6')][_0x4099('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17f8b9,_0x39fbae,_0x5504d2){return new BPromise(function(_0x5cb272,_0x1fee97){return client['request'](_0x17f8b9,_0x5504d2)['then'](function(_0x359540){logger[_0x4099('0x8')]('Trunk,\x20%s,\x20%s',_0x39fbae,_0x4099('0x9'));logger['debug'](_0x4099('0xa'),_0x39fbae,'request\x20sent',JSON['stringify'](_0x359540));if(_0x359540[_0x4099('0xb')]){if(_0x359540['error'][_0x4099('0xc')]===0x1f4){logger[_0x4099('0xb')](_0x4099('0xd'),_0x39fbae,_0x359540['error'][_0x4099('0xe')]);return _0x1fee97(_0x359540['error'][_0x4099('0xe')]);}logger[_0x4099('0xb')](_0x4099('0xd'),_0x39fbae,_0x359540[_0x4099('0xb')][_0x4099('0xe')]);return _0x5cb272(_0x359540[_0x4099('0xb')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x39fbae,'request\x20sent');_0x5cb272(_0x359540[_0x4099('0xf')][_0x4099('0xe')]);}})[_0x4099('0x10')](function(_0x4eed47){logger[_0x4099('0xb')](_0x4099('0xd'),_0x39fbae,_0x4eed47);_0x1fee97(_0x4eed47);});});}exports[_0x4099('0x11')]=function(_0x4977c6){var _0x41aefe=this;return new Promise(function(_0x582cd2,_0x4845a6){return db['Trunk'][_0x4099('0x12')]({'raw':_0x4977c6[_0x4099('0x13')]?_0x4977c6[_0x4099('0x13')][_0x4099('0x14')]===undefined?!![]:![]:!![],'where':_0x4977c6[_0x4099('0x13')]?_0x4977c6['options'][_0x4099('0x15')]||null:null,'attributes':_0x4977c6[_0x4099('0x13')]?_0x4977c6[_0x4099('0x13')][_0x4099('0x16')]||null:null,'limit':_0x4977c6['options']?_0x4977c6[_0x4099('0x13')][_0x4099('0x17')]||null:null,'include':_0x4977c6[_0x4099('0x13')]?_0x4977c6[_0x4099('0x13')][_0x4099('0x18')]?_[_0x4099('0x19')](_0x4977c6[_0x4099('0x13')][_0x4099('0x18')],function(_0x3498b2){return{'model':db[_0x3498b2[_0x4099('0x1a')]],'as':_0x3498b2['as'],'attributes':_0x3498b2[_0x4099('0x16')],'include':_0x3498b2[_0x4099('0x18')]?_[_0x4099('0x19')](_0x3498b2['include'],function(_0x3ddd65){return{'model':db[_0x3ddd65['model']],'as':_0x3ddd65['as'],'attributes':_0x3ddd65['attributes'],'include':_0x3ddd65['include']?_['map'](_0x3ddd65['include'],function(_0x4b37bf){return{'model':db[_0x4b37bf[_0x4099('0x1a')]],'as':_0x4b37bf['as'],'attributes':_0x4b37bf[_0x4099('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4099('0x1b')](function(_0x1d0124){logger[_0x4099('0x8')](_0x4099('0x11'),_0x4977c6);logger['debug'](_0x4099('0x11'),_0x4977c6,JSON[_0x4099('0x1c')](_0x1d0124));_0x582cd2(_0x1d0124);})[_0x4099('0x10')](function(_0x4dbaa8){logger[_0x4099('0xb')](_0x4099('0x11'),_0x4dbaa8['message'],_0x4977c6);_0x4845a6(_0x41aefe[_0x4099('0xb')](0x1f4,_0x4dbaa8[_0x4099('0xe')]));});});};exports['ShowTrunk']=function(_0x2efd6d){var _0x32460f=this;return new Promise(function(_0xd9ffe5,_0x5a3cc9){return db[_0x4099('0x1d')]['find']({'raw':_0x2efd6d[_0x4099('0x13')]?_0x2efd6d[_0x4099('0x13')][_0x4099('0x14')]===undefined?!![]:![]:!![],'where':_0x2efd6d[_0x4099('0x13')]?_0x2efd6d[_0x4099('0x13')][_0x4099('0x15')]||null:null,'attributes':_0x2efd6d[_0x4099('0x13')]?_0x2efd6d[_0x4099('0x13')][_0x4099('0x16')]||null:null,'include':_0x2efd6d[_0x4099('0x13')]?_0x2efd6d[_0x4099('0x13')]['include']?_[_0x4099('0x19')](_0x2efd6d[_0x4099('0x13')][_0x4099('0x18')],function(_0x3a0613){return{'model':db[_0x3a0613[_0x4099('0x1a')]],'as':_0x3a0613['as'],'attributes':_0x3a0613[_0x4099('0x16')],'include':_0x3a0613[_0x4099('0x18')]?_['map'](_0x3a0613[_0x4099('0x18')],function(_0x5ae6db){return{'model':db[_0x5ae6db['model']],'as':_0x5ae6db['as'],'attributes':_0x5ae6db[_0x4099('0x16')],'include':_0x5ae6db['include']?_[_0x4099('0x19')](_0x5ae6db[_0x4099('0x18')],function(_0x436571){return{'model':db[_0x436571[_0x4099('0x1a')]],'as':_0x436571['as'],'attributes':_0x436571[_0x4099('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4099('0x1b')](function(_0x3bbeb4){logger[_0x4099('0x8')](_0x4099('0x1e'),_0x2efd6d);logger[_0x4099('0x1f')](_0x4099('0x1e'),_0x2efd6d,JSON['stringify'](_0x3bbeb4));_0xd9ffe5(_0x3bbeb4);})[_0x4099('0x10')](function(_0x339376){logger['error']('ShowTrunk',_0x339376[_0x4099('0xe')],_0x2efd6d);_0x5a3cc9(_0x32460f[_0x4099('0xb')](0x1f4,_0x339376['message']));});});}; \ No newline at end of file +var _0x4360=['message','result','catch','findAll','options','raw','attributes','include','map','model','GetTrunk','ShowTrunk','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x429076,_0x31cac9){var _0xc24dc6=function(_0x4558fb){while(--_0x4558fb){_0x429076['push'](_0x429076['shift']());}};_0xc24dc6(++_0x31cac9);}(_0x4360,0x68));var _0x0436=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x4360[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x0436('0x0'));var util=require('util');var moment=require(_0x0436('0x1'));var BPromise=require('bluebird');var rs=require(_0x0436('0x2'));var fs=require('fs');var Redis=require(_0x0436('0x3'));var db=require(_0x0436('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0436('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0436('0x6')][_0x0436('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x552a05,_0x5b6605,_0x1767a5){return new BPromise(function(_0x5ec33d,_0x4536d4){return client['request'](_0x552a05,_0x1767a5)[_0x0436('0x8')](function(_0x2b94cf){logger[_0x0436('0x9')](_0x0436('0xa'),_0x5b6605,'request\x20sent');logger[_0x0436('0xb')](_0x0436('0xc'),_0x5b6605,_0x0436('0xd'),JSON[_0x0436('0xe')](_0x2b94cf));if(_0x2b94cf['error']){if(_0x2b94cf[_0x0436('0xf')]['code']===0x1f4){logger['error'](_0x0436('0xa'),_0x5b6605,_0x2b94cf['error'][_0x0436('0x10')]);return _0x4536d4(_0x2b94cf['error'][_0x0436('0x10')]);}logger[_0x0436('0xf')](_0x0436('0xa'),_0x5b6605,_0x2b94cf[_0x0436('0xf')]['message']);return _0x5ec33d(_0x2b94cf[_0x0436('0xf')][_0x0436('0x10')]);}else{logger['info'](_0x0436('0xa'),_0x5b6605,_0x0436('0xd'));_0x5ec33d(_0x2b94cf[_0x0436('0x11')][_0x0436('0x10')]);}})[_0x0436('0x12')](function(_0x3c2a66){logger[_0x0436('0xf')](_0x0436('0xa'),_0x5b6605,_0x3c2a66);_0x4536d4(_0x3c2a66);});});}exports['GetTrunk']=function(_0x50fb56){var _0x120921=this;return new Promise(function(_0x1b7ea7,_0x15dbf2){return db['Trunk'][_0x0436('0x13')]({'raw':_0x50fb56[_0x0436('0x14')]?_0x50fb56[_0x0436('0x14')][_0x0436('0x15')]===undefined?!![]:![]:!![],'where':_0x50fb56[_0x0436('0x14')]?_0x50fb56[_0x0436('0x14')]['where']||null:null,'attributes':_0x50fb56[_0x0436('0x14')]?_0x50fb56[_0x0436('0x14')][_0x0436('0x16')]||null:null,'limit':_0x50fb56[_0x0436('0x14')]?_0x50fb56['options']['limit']||null:null,'include':_0x50fb56[_0x0436('0x14')]?_0x50fb56['options'][_0x0436('0x17')]?_[_0x0436('0x18')](_0x50fb56[_0x0436('0x14')][_0x0436('0x17')],function(_0x4d4b87){return{'model':db[_0x4d4b87[_0x0436('0x19')]],'as':_0x4d4b87['as'],'attributes':_0x4d4b87[_0x0436('0x16')],'include':_0x4d4b87[_0x0436('0x17')]?_[_0x0436('0x18')](_0x4d4b87[_0x0436('0x17')],function(_0x442196){return{'model':db[_0x442196[_0x0436('0x19')]],'as':_0x442196['as'],'attributes':_0x442196[_0x0436('0x16')],'include':_0x442196[_0x0436('0x17')]?_[_0x0436('0x18')](_0x442196[_0x0436('0x17')],function(_0x517666){return{'model':db[_0x517666[_0x0436('0x19')]],'as':_0x517666['as'],'attributes':_0x517666['attributes']};}):[]};}):[]};}):[]:[]})[_0x0436('0x8')](function(_0x14fc78){logger[_0x0436('0x9')](_0x0436('0x1a'),_0x50fb56);logger['debug'](_0x0436('0x1a'),_0x50fb56,JSON['stringify'](_0x14fc78));_0x1b7ea7(_0x14fc78);})[_0x0436('0x12')](function(_0x3c2f9a){logger[_0x0436('0xf')](_0x0436('0x1a'),_0x3c2f9a[_0x0436('0x10')],_0x50fb56);_0x15dbf2(_0x120921[_0x0436('0xf')](0x1f4,_0x3c2f9a[_0x0436('0x10')]));});});};exports[_0x0436('0x1b')]=function(_0x4294c8){var _0x19f4bd=this;return new Promise(function(_0x227c8c,_0x141e65){return db['Trunk'][_0x0436('0x1c')]({'raw':_0x4294c8['options']?_0x4294c8['options'][_0x0436('0x15')]===undefined?!![]:![]:!![],'where':_0x4294c8[_0x0436('0x14')]?_0x4294c8[_0x0436('0x14')][_0x0436('0x1d')]||null:null,'attributes':_0x4294c8['options']?_0x4294c8[_0x0436('0x14')]['attributes']||null:null,'include':_0x4294c8[_0x0436('0x14')]?_0x4294c8[_0x0436('0x14')]['include']?_[_0x0436('0x18')](_0x4294c8[_0x0436('0x14')]['include'],function(_0x82d647){return{'model':db[_0x82d647[_0x0436('0x19')]],'as':_0x82d647['as'],'attributes':_0x82d647[_0x0436('0x16')],'include':_0x82d647['include']?_['map'](_0x82d647['include'],function(_0x426bf2){return{'model':db[_0x426bf2[_0x0436('0x19')]],'as':_0x426bf2['as'],'attributes':_0x426bf2[_0x0436('0x16')],'include':_0x426bf2[_0x0436('0x17')]?_[_0x0436('0x18')](_0x426bf2[_0x0436('0x17')],function(_0x2f1ca7){return{'model':db[_0x2f1ca7[_0x0436('0x19')]],'as':_0x2f1ca7['as'],'attributes':_0x2f1ca7[_0x0436('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0436('0x8')](function(_0x406f83){logger['info'](_0x0436('0x1b'),_0x4294c8);logger[_0x0436('0xb')](_0x0436('0x1b'),_0x4294c8,JSON['stringify'](_0x406f83));_0x227c8c(_0x406f83);})[_0x0436('0x12')](function(_0x152ab1){logger[_0x0436('0xf')](_0x0436('0x1b'),_0x152ab1[_0x0436('0x10')],_0x4294c8);_0x141e65(_0x19f4bd[_0x0436('0xf')](0x1f4,_0x152ab1['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 057819a..3871442 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 _0x6f75=['express','Router','../../components/auth/service','/:id','isAuthenticated','update'];(function(_0x290b22,_0x307bd6){var _0x4ca772=function(_0x1c3200){while(--_0x1c3200){_0x290b22['push'](_0x290b22['shift']());}};_0x4ca772(++_0x307bd6);}(_0x6f75,0x8a));var _0x56f7=function(_0x51b34b,_0x49bfd8){_0x51b34b=_0x51b34b-0x0;var _0x267fd1=_0x6f75[_0x51b34b];return _0x267fd1;};'use strict';var express=require(_0x56f7('0x0'));var router=express[_0x56f7('0x1')]();var auth=require(_0x56f7('0x2'));var controller=require('./user-setting.controller');router['put'](_0x56f7('0x3'),auth[_0x56f7('0x4')](),controller[_0x56f7('0x5')]);module['exports']=router; \ No newline at end of file +var _0x6ce2=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router','../../components/auth/service'];(function(_0x4574d9,_0x224f1a){var _0x30cea4=function(_0x4d26a5){while(--_0x4d26a5){_0x4574d9['push'](_0x4574d9['shift']());}};_0x30cea4(++_0x224f1a);}(_0x6ce2,0xf5));var _0x26ce=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6ce2[_0x2dea24];return _0x309d58;};'use strict';var express=require(_0x26ce('0x0'));var router=express[_0x26ce('0x1')]();var auth=require(_0x26ce('0x2'));var controller=require(_0x26ce('0x3'));router[_0x26ce('0x4')]('/:id',auth[_0x26ce('0x5')](),controller[_0x26ce('0x6')]);module[_0x26ce('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index df3c357..20013dc 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 _0x692e=['DATE','INTEGER','UserId','error','warning','info','exports','BOOLEAN','TEXT'];(function(_0xb18ed,_0x10a675){var _0x4ee4a7=function(_0x5e0ba7){while(--_0x5e0ba7){_0xb18ed['push'](_0xb18ed['shift']());}};_0x4ee4a7(++_0x10a675);}(_0x692e,0x12c));var _0xe692=function(_0x9d4500,_0x3283bc){_0x9d4500=_0x9d4500-0x0;var _0x3b64a1=_0x692e[_0x9d4500];return _0x3b64a1;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xe692('0x0'),_0xe692('0x1'),_0xe692('0x2'),'debug'];module[_0xe692('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe692('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe692('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe692('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe692('0x7')],'unique':_0xe692('0x8')}}; \ No newline at end of file +var _0x4925=['UserId','warning','info','debug','exports','ENUM','TEXT','DATE','INTEGER'];(function(_0x5a1b19,_0x439970){var _0x5040a1=function(_0x23b7ce){while(--_0x23b7ce){_0x5a1b19['push'](_0x5a1b19['shift']());}};_0x5040a1(++_0x439970);}(_0x4925,0xeb));var _0x5492=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x4925[_0x368587];return _0x42d33c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x5492('0x0'),_0x5492('0x1'),_0x5492('0x2')];module[_0x5492('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5492('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5492('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5492('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5492('0x7')],'unique':_0x5492('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 53c5179..e91c008 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 _0xd0b5=['../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','then','sendStatus','error','stack','name','send','update','role','admin','params','find','catch'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x598489,_0x246ab6){_0x598489=_0x598489-0x0;var _0x48f6b9=_0xd0b5[_0x598489];return _0x48f6b9;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var config=require('../../config/environment');var db=require(_0x5d0b('0x2'))['db'];var socket=require(_0x5d0b('0x3'))(new Redis(config[_0x5d0b('0x4')]));require(_0x5d0b('0x5'))[_0x5d0b('0x6')](socket);config[_0x5d0b('0x4')]=_[_0x5d0b('0x7')](config[_0x5d0b('0x4')],{'host':_0x5d0b('0x8'),'port':0x18eb});function respondWithResult(_0x1db3b1,_0x2582f3){_0x2582f3=_0x2582f3||0xc8;return function(_0x1407d6){if(_0x1407d6){return _0x1db3b1[_0x5d0b('0x9')](_0x2582f3)['json'](_0x1407d6);}};}function saveUpdates(_0x270b84){return function(_0x48a3cf){if(_0x48a3cf){return _0x48a3cf['update'](_0x270b84)[_0x5d0b('0xa')](function(_0x2a21e2){return _0x2a21e2;});}return null;};}function handleEntityNotFound(_0x4f885a){return function(_0x164716){if(!_0x164716){_0x4f885a[_0x5d0b('0xb')](0x194);}return _0x164716;};}function handleError(_0x5e30dd,_0x13e95b){_0x13e95b=_0x13e95b||0x1f4;return function(_0x1c16d5){logger[_0x5d0b('0xc')](_0x1c16d5[_0x5d0b('0xd')]);if(_0x1c16d5[_0x5d0b('0xe')]){delete _0x1c16d5[_0x5d0b('0xe')];}_0x5e30dd['status'](_0x13e95b)[_0x5d0b('0xf')](_0x1c16d5);};}exports[_0x5d0b('0x10')]=function(_0x10d9aa,_0x263300){if(_0x10d9aa['user'][_0x5d0b('0x11')]!==_0x5d0b('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x10d9aa[_0x5d0b('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0x5d0b('0x14')]({'where':{'id':_0x10d9aa[_0x5d0b('0x13')]['id']}})[_0x5d0b('0xa')](handleEntityNotFound(_0x263300,null))[_0x5d0b('0xa')](saveUpdates(_0x10d9aa['body'],null))[_0x5d0b('0xa')](respondWithResult(_0x263300,null))[_0x5d0b('0x15')](handleError(_0x263300,null));}; \ No newline at end of file +var _0x4f17=['then','error','stack','name','send','update','user','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','status','json'];(function(_0x34fd4f,_0x4f9ead){var _0x17e0c4=function(_0x4b1ebd){while(--_0x4b1ebd){_0x34fd4f['push'](_0x34fd4f['shift']());}};_0x17e0c4(++_0x4f9ead);}(_0x4f17,0x9e));var _0x74f1=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x4f17[_0x4a45b4];return _0x1a99c9;};'use strict';var _=require(_0x74f1('0x0'));var Redis=require('ioredis');var logger=require(_0x74f1('0x1'))(_0x74f1('0x2'));var config=require('../../config/environment');var db=require(_0x74f1('0x3'))['db'];var socket=require(_0x74f1('0x4'))(new Redis(config[_0x74f1('0x5')]));require(_0x74f1('0x6'))[_0x74f1('0x7')](socket);config['redis']=_['defaults'](config[_0x74f1('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0xe54c30,_0x51effb){_0x51effb=_0x51effb||0xc8;return function(_0x34ec03){if(_0x34ec03){return _0xe54c30[_0x74f1('0x8')](_0x51effb)[_0x74f1('0x9')](_0x34ec03);}};}function saveUpdates(_0x5377d3){return function(_0x31b7ec){if(_0x31b7ec){return _0x31b7ec['update'](_0x5377d3)[_0x74f1('0xa')](function(_0x554b90){return _0x554b90;});}return null;};}function handleEntityNotFound(_0x1b116c){return function(_0xe9a857){if(!_0xe9a857){_0x1b116c['sendStatus'](0x194);}return _0xe9a857;};}function handleError(_0x5f1fc3,_0x28307c){_0x28307c=_0x28307c||0x1f4;return function(_0x14484a){logger[_0x74f1('0xb')](_0x14484a[_0x74f1('0xc')]);if(_0x14484a[_0x74f1('0xd')]){delete _0x14484a[_0x74f1('0xd')];}_0x5f1fc3[_0x74f1('0x8')](_0x28307c)[_0x74f1('0xe')](_0x14484a);};}exports[_0x74f1('0xf')]=function(_0x16ba86,_0x4f34fd){if(_0x16ba86[_0x74f1('0x10')]['role']!==_0x74f1('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x16ba86[_0x74f1('0x12')]['id'])))throw new Error(_0x74f1('0x13'));return db[_0x74f1('0x14')][_0x74f1('0x15')]({'where':{'id':_0x16ba86[_0x74f1('0x12')]['id']}})['then'](handleEntityNotFound(_0x4f34fd,null))[_0x74f1('0xa')](saveUpdates(_0x16ba86[_0x74f1('0x16')],null))['then'](respondWithResult(_0x4f34fd,null))[_0x74f1('0x17')](handleError(_0x4f34fd,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 1083717..85a0767 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 _0x6501=['UserSetting','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xb9a1b9,_0x4678bc){var _0x248d6e=function(_0x4c2085){while(--_0x4c2085){_0xb9a1b9['push'](_0xb9a1b9['shift']());}};_0x248d6e(++_0x4678bc);}(_0x6501,0x8e));var _0x1650=function(_0x1b720a,_0x495792){_0x1b720a=_0x1b720a-0x0;var _0x4978d5=_0x6501[_0x1b720a];return _0x4978d5;};'use strict';var EventEmitter=require(_0x1650('0x0'));var UserSetting=require(_0x1650('0x1'))['db'][_0x1650('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1650('0x3'),'afterUpdate':_0x1650('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8826cc){return function(_0x2def7a,_0x3ffcd8,_0xc3f0ae){UserSettingEvents[_0x1650('0x5')](_0x8826cc+':'+_0x2def7a['id'],_0x2def7a);UserSettingEvents['emit'](_0x8826cc,_0x2def7a);_0xc3f0ae(null);};}for(var e in events){if(events[_0x1650('0x6')](e)){var event=events[e];UserSetting[_0x1650('0x7')](e,emitEvent(event));}}module[_0x1650('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x12e0=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x12e0,0x15e));var _0x012e=function(_0x289aaf,_0x2615f6){_0x289aaf=_0x289aaf-0x0;var _0x1c0f18=_0x12e0[_0x289aaf];return _0x1c0f18;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x012e('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x012e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x012e('0x2')};function emitEvent(_0xf28032){return function(_0x1be8a5,_0x5d1501,_0x24a853){UserSettingEvents[_0x012e('0x3')](_0xf28032+':'+_0x1be8a5['id'],_0x1be8a5);UserSettingEvents[_0x012e('0x3')](_0xf28032,_0x1be8a5);_0x24a853(null);};}for(var e in events){if(events[_0x012e('0x4')](e)){var event=events[e];UserSetting[_0x012e('0x5')](e,emitEvent(event));}}module[_0x012e('0x6')]=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 41e529e..4de44e1 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 _0x4c71=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x566f77,_0x275098){var _0x1e94a6=function(_0x571676){while(--_0x571676){_0x566f77['push'](_0x566f77['shift']());}};_0x1e94a6(++_0x275098);}(_0x4c71,0x12b));var _0x14c7=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4c71[_0x5d2803];return _0xdcad2c;};'use strict';var attributes=require(_0x14c7('0x0'));module[_0x14c7('0x1')]=function(_0x581a30){return _0x581a30[_0x14c7('0x2')](_0x14c7('0x3'),attributes,{'tableName':_0x14c7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b1786){if(!_0x2b1786[_0x14c7('0x5')])_0x2b1786['clientSideLoggingEnabledSince']=null;else if(_0x2b1786[_0x14c7('0x6')]===null)_0x2b1786[_0x14c7('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xde56=['./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xde56,0x144));var _0x6de5=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xde56[_0x1fc1f9];return _0x4987ca;};'use strict';var attributes=require(_0x6de5('0x0'));module['exports']=function(_0x43ccd3){return _0x43ccd3[_0x6de5('0x1')](_0x6de5('0x2'),attributes,{'tableName':_0x6de5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2484e4){if(!_0x2484e4[_0x6de5('0x4')])_0x2484e4[_0x6de5('0x5')]=null;else if(_0x2484e4[_0x6de5('0x5')]===null)_0x2484e4[_0x6de5('0x5')]=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 23bf37f..e985357 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 _0x2b98=['UserId','length','user-setting:','save','remove','update','emit','user-setting:update'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2b98,0x1f3));var _0x82b9=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x2b98[_0x75f869];return _0x10af8b;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x82b9('0x0'),_0x82b9('0x1'),_0x82b9('0x2')];function createListener(_0x2f2cf9,_0x40f1aa){return function(_0x5e8e0b){_0x40f1aa[_0x82b9('0x3')](_0x2f2cf9,_0x5e8e0b);if(_0x2f2cf9===_0x82b9('0x4')){_0x40f1aa[_0x82b9('0x3')]('user-setting:update:user-'+_0x5e8e0b[_0x82b9('0x5')],_0x5e8e0b);}};}exports['register']=function(_0x14548d){for(var _0x55314f=0x0,_0x461888=events[_0x82b9('0x6')];_0x55314f<_0x461888;_0x55314f++){var _0x367cae=events[_0x55314f];var _0x3be5a4=createListener(_0x82b9('0x7')+_0x367cae,_0x14548d);UserSettingEvents['on'](_0x367cae,_0x3be5a4);}}; \ No newline at end of file +var _0xdd33=['user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','register'];(function(_0xc4893f,_0x345db5){var _0x551475=function(_0x28344c){while(--_0x28344c){_0xc4893f['push'](_0xc4893f['shift']());}};_0x551475(++_0x345db5);}(_0xdd33,0x106));var _0x3dd3=function(_0x1f4145,_0xe8ea30){_0x1f4145=_0x1f4145-0x0;var _0x74d92b=_0xdd33[_0x1f4145];return _0x74d92b;};'use strict';var UserSettingEvents=require(_0x3dd3('0x0'));var events=[_0x3dd3('0x1'),_0x3dd3('0x2'),_0x3dd3('0x3')];function createListener(_0x4d9f53,_0x4c16af){return function(_0x14204d){_0x4c16af[_0x3dd3('0x4')](_0x4d9f53,_0x14204d);if(_0x4d9f53===_0x3dd3('0x5')){_0x4c16af['emit'](_0x3dd3('0x6')+_0x14204d['UserId'],_0x14204d);}};}exports[_0x3dd3('0x7')]=function(_0x4233be){for(var _0x2e1077=0x0,_0x5aa7fa=events['length'];_0x2e1077<_0x5aa7fa;_0x2e1077++){var _0xddb3d0=events[_0x2e1077];var _0x201b5c=createListener(_0x3dd3('0x8')+_0xddb3d0,_0x4233be);UserSettingEvents['on'](_0xddb3d0,_0x201b5c);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1ef7b67..fc363e2 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 _0x8d04=['/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','/:id/queues','addQueues','join','root','server/files/images/','format','%s-%s','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x9df3a0,_0x575fda){var _0x50a335=function(_0x17dc1d){while(--_0x17dc1d){_0x9df3a0['push'](_0x9df3a0['shift']());}};_0x50a335(++_0x575fda);}(_0x8d04,0xc2));var _0x48d0=function(_0x5a454a,_0x3880bb){_0x5a454a=_0x5a454a-0x0;var _0x274ada=_0x8d04[_0x5a454a];return _0x274ada;};'use strict';var multer=require(_0x48d0('0x0'));var util=require(_0x48d0('0x1'));var path=require('path');var timeout=require(_0x48d0('0x2'));var express=require(_0x48d0('0x3'));var router=express[_0x48d0('0x4')]();var fs_extra=require(_0x48d0('0x5'));var auth=require(_0x48d0('0x6'));var interaction=require(_0x48d0('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x48d0('0x8')]('/',auth[_0x48d0('0x9')](),controller[_0x48d0('0xa')]);router[_0x48d0('0x8')](_0x48d0('0xb'),auth[_0x48d0('0x9')](),controller[_0x48d0('0xc')]);router[_0x48d0('0x8')](_0x48d0('0xd'),auth[_0x48d0('0x9')](),controller[_0x48d0('0xe')]);router[_0x48d0('0x8')](_0x48d0('0xf'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x10')]);router['get'](_0x48d0('0x11'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x12')]);router[_0x48d0('0x8')](_0x48d0('0x13'),controller[_0x48d0('0x14')]);router[_0x48d0('0x8')]('/:id/open_tabs',auth[_0x48d0('0x9')](),controller[_0x48d0('0x15')]);router['get'](_0x48d0('0x16'),auth['isAuthenticated'](),controller[_0x48d0('0x17')]);router[_0x48d0('0x8')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0x48d0('0x9')](),controller['getVoiceQueuesRt']);router[_0x48d0('0x8')](_0x48d0('0x18'),auth[_0x48d0('0x9')](),controller['getGroups']);router[_0x48d0('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x48d0('0x19')]);router[_0x48d0('0x8')](_0x48d0('0x1a'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x1b')]);router[_0x48d0('0x8')](_0x48d0('0x1c'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x1d')]);router[_0x48d0('0x8')](_0x48d0('0x1e'),auth[_0x48d0('0x9')](),controller['getOpenchannelInteractions']);router['get'](_0x48d0('0x1f'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x20')]);router[_0x48d0('0x8')](_0x48d0('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router['get'](_0x48d0('0x22'),auth['isAuthenticated'](),controller[_0x48d0('0x23')]);router[_0x48d0('0x8')](_0x48d0('0x24'),auth['isAuthenticated'](),controller[_0x48d0('0x25')]);router[_0x48d0('0x8')](_0x48d0('0x26'),auth['isAuthenticated'](),controller['getTeams']);router[_0x48d0('0x8')](_0x48d0('0x27'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x28')]);router[_0x48d0('0x8')](_0x48d0('0x29'),auth[_0x48d0('0x9')](),controller['getAgents']);router[_0x48d0('0x8')](_0x48d0('0x2a'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get'](_0x48d0('0x2b'),auth[_0x48d0('0x9')](),controller['getFaxAccounts']);router[_0x48d0('0x8')](_0x48d0('0x2c'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x2d')]);router['get'](_0x48d0('0x2e'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x2f')]);router['get'](_0x48d0('0x30'),auth['isAuthenticated'](),controller[_0x48d0('0x31')]);router[_0x48d0('0x8')](_0x48d0('0x32'),auth['isAuthenticated'](),controller[_0x48d0('0x33')]);router['get'](_0x48d0('0x34'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x35')]);router[_0x48d0('0x8')](_0x48d0('0x36'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x37')]);router[_0x48d0('0x8')](_0x48d0('0x38'),auth[_0x48d0('0x9')](),controller['getApiKey']);router[_0x48d0('0x39')](_0x48d0('0x16'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x3a')]);router[_0x48d0('0x39')]('/',auth[_0x48d0('0x9')](),controller[_0x48d0('0x3b')]);router[_0x48d0('0x39')](_0x48d0('0x3c'),auth['isAuthenticated'](),controller['bulkCreate']);router['post'](_0x48d0('0x3d'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x444dbf,_0x267c33,_0x5bc744){_0x5bc744(null,path[_0x48d0('0x3f')](config[_0x48d0('0x40')],_0x48d0('0x41')));},'filename':function(_0x4471fd,_0x1cf01d,_0x48e7a7){_0x48e7a7(null,util[_0x48d0('0x42')](_0x48d0('0x43'),Date['now'](),_0x1cf01d[_0x48d0('0x44')]));}})});router[_0x48d0('0x39')](_0x48d0('0x13'),upload[_0x48d0('0x45')](_0x48d0('0x46')),controller['addAvatar']);router[_0x48d0('0x39')](_0x48d0('0x47'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x48')]);router[_0x48d0('0x39')](_0x48d0('0x49'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x4a')]);router[_0x48d0('0x39')](_0x48d0('0x4b'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x4c')]);router[_0x48d0('0x39')]('/:id/unpause',auth[_0x48d0('0x9')](),controller[_0x48d0('0x4d')]);router['post'](_0x48d0('0x26'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x4e')]);router['post']('/:id/chat_interactions',auth[_0x48d0('0x9')](),controller[_0x48d0('0x4f')]);router[_0x48d0('0x39')](_0x48d0('0x50'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x51')]);router[_0x48d0('0x39')](_0x48d0('0x52'),auth[_0x48d0('0x9')](),controller['addFaxInteractions']);router[_0x48d0('0x39')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x48d0('0x39')](_0x48d0('0x53'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x54')]);router[_0x48d0('0x39')](_0x48d0('0x55'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x56')]);router['post'](_0x48d0('0x2b'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x57')]);router[_0x48d0('0x39')](_0x48d0('0x2c'),auth[_0x48d0('0x9')](),controller['addMailAccounts']);router['post'](_0x48d0('0x2e'),auth[_0x48d0('0x9')](),controller['addOpenchannelAccounts']);router[_0x48d0('0x39')](_0x48d0('0x30'),auth['isAuthenticated'](),controller[_0x48d0('0x58')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x48d0('0x59')]);router[_0x48d0('0x39')](_0x48d0('0x34'),auth['isAuthenticated'](),controller[_0x48d0('0x5a')]);router[_0x48d0('0x39')](_0x48d0('0x38'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x5b')]);router[_0x48d0('0x5c')](_0x48d0('0x11'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x5d')]);router[_0x48d0('0x5c')](_0x48d0('0x5e'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x5f')]);router['delete'](_0x48d0('0x3d'),auth['isAuthenticated'](),controller[_0x48d0('0x60')]);router[_0x48d0('0x61')](_0x48d0('0x26'),auth[_0x48d0('0x9')](),controller['removeTeams']);router[_0x48d0('0x61')](_0x48d0('0x11'),auth[_0x48d0('0x9')](),controller['destroy']);router[_0x48d0('0x61')](_0x48d0('0x62'),auth['isAuthenticated'](),controller[_0x48d0('0x63')]);router['delete'](_0x48d0('0x50'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x64')]);router[_0x48d0('0x61')](_0x48d0('0x52'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x65')]);router[_0x48d0('0x61')](_0x48d0('0x66'),auth[_0x48d0('0x9')](),controller['removeSmsInteractions']);router[_0x48d0('0x61')](_0x48d0('0x53'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x67')]);router[_0x48d0('0x61')](_0x48d0('0x55'),auth[_0x48d0('0x9')](),controller['removeWhatsappInteractions']);router[_0x48d0('0x61')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x48d0('0x2c'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x68')]);router['delete']('/:id/openchannel_accounts',auth[_0x48d0('0x9')](),controller[_0x48d0('0x69')]);router['delete'](_0x48d0('0x30'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x6a')]);router[_0x48d0('0x61')](_0x48d0('0x32'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x6b')]);router[_0x48d0('0x61')](_0x48d0('0x34'),auth[_0x48d0('0x9')](),controller[_0x48d0('0x6c')]);router[_0x48d0('0x61')](_0x48d0('0x38'),auth['isAuthenticated'](),controller[_0x48d0('0x6d')]);router[_0x48d0('0x39')]('/:id/messengerSoundNotification',auth[_0x48d0('0x9')](),controller[_0x48d0('0x6e')]);module[_0x48d0('0x6f')]=router; \ No newline at end of file +var _0x61e1=['removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','/:id/messengerSoundNotification','messengerSoundNotification','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','post','addContacts','create','/:id/queues','addQueues','join','root','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeChatInteractions'];(function(_0x3f29f2,_0x1385d1){var _0x2007aa=function(_0x5a737d){while(--_0x5a737d){_0x3f29f2['push'](_0x3f29f2['shift']());}};_0x2007aa(++_0x1385d1);}(_0x61e1,0x7c));var _0x161e=function(_0x4f60c7,_0x5f09e3){_0x4f60c7=_0x4f60c7-0x0;var _0x38f9f3=_0x61e1[_0x4f60c7];return _0x38f9f3;};'use strict';var multer=require(_0x161e('0x0'));var util=require('util');var path=require(_0x161e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x161e('0x2'));var auth=require(_0x161e('0x3'));var interaction=require(_0x161e('0x4'));var config=require('../../config/environment');var controller=require(_0x161e('0x5'));router['get']('/',auth[_0x161e('0x6')](),controller[_0x161e('0x7')]);router[_0x161e('0x8')](_0x161e('0x9'),auth['isAuthenticated'](),controller[_0x161e('0xa')]);router['get'](_0x161e('0xb'),auth['isAuthenticated'](),controller[_0x161e('0xc')]);router[_0x161e('0x8')](_0x161e('0xd'),auth['isAuthenticated'](),controller[_0x161e('0xe')]);router['get'](_0x161e('0xf'),auth[_0x161e('0x6')](),controller[_0x161e('0x10')]);router['get'](_0x161e('0x11'),controller[_0x161e('0x12')]);router[_0x161e('0x8')](_0x161e('0x13'),auth['isAuthenticated'](),controller[_0x161e('0x14')]);router[_0x161e('0x8')](_0x161e('0x15'),auth[_0x161e('0x6')](),controller[_0x161e('0x16')]);router[_0x161e('0x8')]('/:id/queues',auth[_0x161e('0x6')](),controller['getQueues']);router[_0x161e('0x8')](_0x161e('0x17'),auth[_0x161e('0x6')](),controller[_0x161e('0x18')]);router[_0x161e('0x8')](_0x161e('0x19'),auth[_0x161e('0x6')](),controller[_0x161e('0x1a')]);router[_0x161e('0x8')](_0x161e('0x1b'),auth[_0x161e('0x6')](),controller['getRecordings']);router[_0x161e('0x8')](_0x161e('0x1c'),auth[_0x161e('0x6')](),controller['getScreenRecordings']);router[_0x161e('0x8')]('/:id/chat/interactions',auth[_0x161e('0x6')](),controller[_0x161e('0x1d')]);router[_0x161e('0x8')](_0x161e('0x1e'),auth[_0x161e('0x6')](),controller['getOpenchannelInteractions']);router[_0x161e('0x8')](_0x161e('0x1f'),auth[_0x161e('0x6')](),controller[_0x161e('0x20')]);router[_0x161e('0x8')](_0x161e('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router['get'](_0x161e('0x22'),auth[_0x161e('0x6')](),controller[_0x161e('0x23')]);router[_0x161e('0x8')](_0x161e('0x24'),auth[_0x161e('0x6')](),controller[_0x161e('0x25')]);router[_0x161e('0x8')]('/:id/teams',auth[_0x161e('0x6')](),controller[_0x161e('0x26')]);router[_0x161e('0x8')](_0x161e('0x27'),auth['isAuthenticated'](),controller[_0x161e('0x28')]);router[_0x161e('0x8')](_0x161e('0x29'),auth[_0x161e('0x6')](),controller[_0x161e('0x2a')]);router[_0x161e('0x8')](_0x161e('0x2b'),auth['isAuthenticated'](),controller[_0x161e('0x2c')]);router[_0x161e('0x8')](_0x161e('0x2d'),auth['isAuthenticated'](),controller[_0x161e('0x2e')]);router[_0x161e('0x8')](_0x161e('0x2f'),auth[_0x161e('0x6')](),controller[_0x161e('0x30')]);router[_0x161e('0x8')](_0x161e('0x31'),auth['isAuthenticated'](),controller[_0x161e('0x32')]);router[_0x161e('0x8')]('/:id/sms_accounts',auth[_0x161e('0x6')](),controller[_0x161e('0x33')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x161e('0x34')]);router[_0x161e('0x8')](_0x161e('0x35'),auth[_0x161e('0x6')](),controller[_0x161e('0x36')]);router[_0x161e('0x8')]('/:id/scheduled_calls',auth[_0x161e('0x6')](),controller[_0x161e('0x37')]);router[_0x161e('0x8')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x161e('0x38')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x161e('0x39')]);router[_0x161e('0x38')]('/',auth['isAuthenticated'](),controller[_0x161e('0x3a')]);router[_0x161e('0x38')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0x161e('0x38')](_0x161e('0x3b'),auth['isAuthenticated'](),controller[_0x161e('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53e44d,_0xbda67c,_0xf4f464){_0xf4f464(null,path[_0x161e('0x3d')](config[_0x161e('0x3e')],'server/files/images/'));},'filename':function(_0x135b32,_0x84587d,_0x473f6d){_0x473f6d(null,util[_0x161e('0x3f')](_0x161e('0x40'),Date['now'](),_0x84587d[_0x161e('0x41')]));}})});router[_0x161e('0x38')]('/:id/avatar',upload[_0x161e('0x42')](_0x161e('0x43')),controller[_0x161e('0x44')]);router[_0x161e('0x38')](_0x161e('0x45'),auth[_0x161e('0x6')](),controller[_0x161e('0x46')]);router[_0x161e('0x38')](_0x161e('0x47'),auth['isAuthenticated'](),controller['logout']);router[_0x161e('0x38')](_0x161e('0x48'),auth[_0x161e('0x6')](),controller['pause']);router[_0x161e('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x161e('0x49')]);router[_0x161e('0x38')](_0x161e('0x4a'),auth[_0x161e('0x6')](),controller[_0x161e('0x4b')]);router['post'](_0x161e('0x4c'),auth[_0x161e('0x6')](),controller[_0x161e('0x4d')]);router['post'](_0x161e('0x4e'),auth[_0x161e('0x6')](),controller['addMailInteractions']);router[_0x161e('0x38')](_0x161e('0x4f'),auth[_0x161e('0x6')](),controller['addFaxInteractions']);router['post'](_0x161e('0x50'),auth[_0x161e('0x6')](),controller['addSmsInteractions']);router['post'](_0x161e('0x51'),auth[_0x161e('0x6')](),controller['addOpenchannelInteractions']);router[_0x161e('0x38')](_0x161e('0x52'),auth[_0x161e('0x6')](),controller[_0x161e('0x53')]);router[_0x161e('0x38')](_0x161e('0x2d'),auth[_0x161e('0x6')](),controller[_0x161e('0x54')]);router['post'](_0x161e('0x2f'),auth['isAuthenticated'](),controller[_0x161e('0x55')]);router[_0x161e('0x38')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x161e('0x38')](_0x161e('0x56'),auth[_0x161e('0x6')](),controller[_0x161e('0x57')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x161e('0x58')]);router['post']('/:id/whatsapp_accounts',auth[_0x161e('0x6')](),controller[_0x161e('0x59')]);router[_0x161e('0x38')]('/:id/api_key',auth[_0x161e('0x6')](),controller[_0x161e('0x5a')]);router[_0x161e('0x5b')](_0x161e('0xf'),auth['isAuthenticated'](),controller[_0x161e('0x5c')]);router[_0x161e('0x5b')](_0x161e('0x5d'),auth[_0x161e('0x6')](),controller[_0x161e('0x5e')]);router[_0x161e('0x5f')](_0x161e('0x3b'),auth[_0x161e('0x6')](),controller['removeQueues']);router[_0x161e('0x5f')](_0x161e('0x4a'),auth[_0x161e('0x6')](),controller['removeTeams']);router['delete'](_0x161e('0xf'),auth[_0x161e('0x6')](),controller[_0x161e('0x60')]);router[_0x161e('0x5f')](_0x161e('0x4c'),auth[_0x161e('0x6')](),controller[_0x161e('0x61')]);router['delete'](_0x161e('0x4e'),auth[_0x161e('0x6')](),controller[_0x161e('0x62')]);router[_0x161e('0x5f')](_0x161e('0x4f'),auth[_0x161e('0x6')](),controller[_0x161e('0x63')]);router[_0x161e('0x5f')](_0x161e('0x50'),auth[_0x161e('0x6')](),controller[_0x161e('0x64')]);router[_0x161e('0x5f')](_0x161e('0x51'),auth['isAuthenticated'](),controller[_0x161e('0x65')]);router[_0x161e('0x5f')](_0x161e('0x52'),auth[_0x161e('0x6')](),controller[_0x161e('0x66')]);router[_0x161e('0x5f')](_0x161e('0x2d'),auth[_0x161e('0x6')](),controller[_0x161e('0x67')]);router['delete'](_0x161e('0x2f'),auth[_0x161e('0x6')](),controller[_0x161e('0x68')]);router[_0x161e('0x5f')]('/:id/openchannel_accounts',auth[_0x161e('0x6')](),controller['removeOpenchannelAccounts']);router[_0x161e('0x5f')](_0x161e('0x56'),auth[_0x161e('0x6')](),controller['removeSmsAccounts']);router['delete'](_0x161e('0x69'),auth[_0x161e('0x6')](),controller[_0x161e('0x6a')]);router[_0x161e('0x5f')]('/:id/whatsapp_accounts',auth[_0x161e('0x6')](),controller[_0x161e('0x6b')]);router[_0x161e('0x5f')](_0x161e('0x6c'),auth[_0x161e('0x6')](),controller['removeApiKey']);router['post'](_0x161e('0x6d'),auth[_0x161e('0x6')](),controller[_0x161e('0x6e')]);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 8b59fd7..9516361 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 _0x47a1=['moment','util','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','nonat','TEXT','showWebBar','get','wss','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x47a1,0x1bd));var _0x147a=function(_0x19ddc2,_0x4ba44a){_0x19ddc2=_0x19ddc2-0x0;var _0x926bd4=_0x47a1[_0x19ddc2];return _0x926bd4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x147a('0x0'));var util=require(_0x147a('0x1'));var _=require(_0x147a('0x2'));module[_0x147a('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x147a('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x193ed4){this[_0x147a('0x5')](_0x147a('0x4'),_0x193ed4);this[_0x147a('0x5')](_0x147a('0x6'),_0x193ed4);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x147a('0x7')],'allowNull':![],'set':function(_0x1366ee){this[_0x147a('0x5')](_0x147a('0x8'),_0x1366ee);this[_0x147a('0x5')](_0x147a('0x9'),util[_0x147a('0xa')]('\x22%s\x22\x20<%s>',_0x1366ee,this[_0x147a('0xb')](_0x147a('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x147a('0x7')],'allowNull':![],'unique':_0x147a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x38c50e){if(_0x38c50e){this[_0x147a('0x5')](_0x147a('0xd'),_0x38c50e[_0x147a('0xe')]());}}},'role':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x10'),_0x147a('0x11'),_0x147a('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x147a('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x147a('0x7')],'defaultValue':_0x147a('0x13')},'internal':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2b8f32){this[_0x147a('0x5')](_0x147a('0xc'),_0x2b8f32);this[_0x147a('0x5')]('accountcode',_0x2b8f32);this[_0x147a('0x5')](_0x147a('0x9'),util[_0x147a('0xa')](_0x147a('0x15'),this['getDataValue'](_0x147a('0x8')),_0x2b8f32));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x147a('0x7')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x147a('0x16')]},'voicePause':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x147a('0x7')],'defaultValue':_0x147a('0x18')},'lastPauseAt':{'type':Sequelize[_0x147a('0x16')]},'chatCapacity':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x147a('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x147a('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x147a('0x19')},'ipaddr':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x147a('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x1a'),'user',_0x147a('0x1b')),'allowNull':!![],'defaultValue':_0x147a('0x1a')},'context':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![],'defaultValue':_0x147a('0x1c')},'callingpres':{'type':Sequelize[_0x147a('0xf')]('ALLOWED_NOT_SCREENED',_0x147a('0x1d'),_0x147a('0x1e'),_0x147a('0x1f'),'PROHIB_NOT_SCREENED',_0x147a('0x20'),_0x147a('0x21'),_0x147a('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![],'defaultValue':_0x147a('0x23'),'set':function(_0x119742){this[_0x147a('0x5')]('transport',_0x119742?_0x119742[_0x147a('0x24')](','):null);},'get':function(){return this[_0x147a('0xb')]('transport')?this[_0x147a('0xb')](_0x147a('0x25'))[_0x147a('0x26')](','):null;},'comment':_0x147a('0x27')},'dtmfmode':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x28'),_0x147a('0x29'),'shortinfo',_0x147a('0x2a'),_0x147a('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no','nonat',_0x147a('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![],'defaultValue':_0x147a('0x2e'),'set':function(_0x4f022f){this['setDataValue'](_0x147a('0x2f'),_0x4f022f?_0x4f022f['join'](','):null);},'get':function(){return this[_0x147a('0xb')](_0x147a('0x2f'))?this['getDataValue'](_0x147a('0x2f'))[_0x147a('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x147a('0x7')]},'namedcallgroup':{'type':Sequelize[_0x147a('0x7')]},'pickupgroup':{'type':Sequelize[_0x147a('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x147a('0x7')]},'language':{'type':Sequelize[_0x147a('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x147a('0x7')],'allowNull':![],'defaultValue':_0x147a('0x30'),'set':function(_0x2b57d3){this[_0x147a('0x5')](_0x147a('0x31'),_0x2b57d3?_0x2b57d3[_0x147a('0x24')](';'):_0x147a('0x30'));},'get':function(){return this[_0x147a('0xb')](_0x147a('0x31'))?this['getDataValue'](_0x147a('0x31'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![],'set':function(_0x1a780c){this[_0x147a('0x5')]('insecure',_0x1a780c?_0x1a780c[_0x147a('0x24')](','):null);},'get':function(){return this[_0x147a('0xb')](_0x147a('0x32'))?this[_0x147a('0xb')](_0x147a('0x32'))[_0x147a('0x26')](','):null;},'comment':_0x147a('0x33')},'trustrpid':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no',_0x147a('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x147a('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![],'defaultValue':_0x147a('0x35')},'amaflags':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x147a('0x2c')},'busylevel':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x147a('0x2c'),'no',_0x147a('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x147a('0x37'),_0x147a('0x38'),_0x147a('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x3a'),_0x147a('0x3b')),'allowNull':!![],'defaultValue':_0x147a('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x147a('0x2c')},'keepalive':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x147a('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x147a('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x147a('0x2c'),'no',_0x147a('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x3d'),_0x147a('0x3e'),_0x147a('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x147a('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x147a('0xf')](_0x147a('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x147a('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x147a('0xf')]('yes','no',_0x147a('0x40'),_0x147a('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x147a('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x147a('0x41')]},'showWebBar':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0,'set':function(_0x6710df){this[_0x147a('0x5')](_0x147a('0x42'),_0x6710df);var _0xc78034=this[_0x147a('0x43')]({'plain':!![]});switch(_0x6710df){case 0x0:case 0x1:var _0x16a49b=_0xc78034['transport']?_['isArray'](_0xc78034['transport'])?_0xc78034[_0x147a('0x25')][_0x147a('0x24')]():_0xc78034[_0x147a('0x25')]:'udp';if(_0x16a49b===_0x147a('0x44')){_0x16a49b=_0x147a('0x23');}this[_0x147a('0x5')](_0x147a('0x25'),_0x16a49b);this[_0x147a('0x5')]('encryption','no');this[_0x147a('0x5')](_0x147a('0x45'),null);this[_0x147a('0x5')](_0x147a('0x46'),null);this['setDataValue'](_0x147a('0x47'),null);this[_0x147a('0x5')]('dtlsenable',null);this['setDataValue'](_0x147a('0x48'),null);this['setDataValue'](_0x147a('0x49'),null);this['setDataValue'](_0x147a('0x4a'),null);this['setDataValue'](_0x147a('0x4b'),null);this[_0x147a('0x5')](_0x147a('0x4c'),'no');break;case 0x2:this[_0x147a('0x5')]('transport',_0x147a('0x44'));this['setDataValue']('encryption',_0x147a('0x2c'));this[_0x147a('0x5')](_0x147a('0x45'),_0x147a('0x2c'));this[_0x147a('0x5')](_0x147a('0x46'),_0x147a('0x2c'));this[_0x147a('0x5')](_0x147a('0x47'),_0x147a('0x2c'));this[_0x147a('0x5')](_0x147a('0x4d'),_0x147a('0x2c'));this[_0x147a('0x5')](_0x147a('0x48'),'no');this[_0x147a('0x5')](_0x147a('0x49'),_0x147a('0x3f'));this[_0x147a('0x5')]('dtlscertfile',_0xc78034[_0x147a('0x4a')]||_0x147a('0x4e'));this['setDataValue'](_0x147a('0x4b'),_0xc78034['dtlsprivatekey']||_0x147a('0x4f'));this[_0x147a('0x5')](_0x147a('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x147a('0x41')],'set':function(_0x176d9a){this[_0x147a('0x5')](_0x147a('0x50'),_0x176d9a?_0x176d9a[_0x147a('0x24')](','):[]);},'get':function(){return this[_0x147a('0xb')]('permissions')?_['map'](this['getDataValue'](_0x147a('0x50'))[_0x147a('0x26')](','),function(_0x25f9de){return parseInt(_0x25f9de,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x147a('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x147a('0x7')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x147a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x147a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x147a('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x147a('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x147a('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x147a('0xb')](_0x147a('0x51'))?this['getDataValue'](_0x147a('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x147a('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x147a('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![],'set':function(_0x383653){if(typeof _0x383653==='string'){var _0x433984=_0x383653==='1'?!![]:_0x383653==='0'?![]:_0x383653===_0x147a('0x52')?!![]:_0x383653===_0x147a('0x53')?![]:![];this[_0x147a('0x5')](_0x147a('0x54'),_0x433984);}else{this[_0x147a('0x5')](_0x147a('0x54'),_0x383653);}}},'blocked':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![],'set':function(_0x598e99){this[_0x147a('0x5')](_0x147a('0x55'),_0x598e99);if(_0x598e99===!![]){this['setDataValue'](_0x147a('0x56'),moment());this['setDataValue'](_0x147a('0x57'),0x0);}else{this['setDataValue'](_0x147a('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x147a('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x147a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x147a('0x14')](0x5)[_0x147a('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x147a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x147a('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x147a('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x147a('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfa1d=['auto','outgoing','force_rport,comedia','join','nat','all','ulaw;alaw;gsm','allow','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uas','fingerprint','certificate','actpass','TEXT','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','dtlsprivatekey','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xfa1d,0x184));var _0xdfa1=function(_0xa191b8,_0x35c3a7){_0xa191b8=_0xa191b8-0x0;var _0x305fcd=_0xfa1d[_0xa191b8];return _0x305fcd;};'use strict';var Sequelize=require(_0xdfa1('0x0'));var moment=require(_0xdfa1('0x1'));var util=require(_0xdfa1('0x2'));var _=require(_0xdfa1('0x3'));module[_0xdfa1('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdfa1('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2572a9){this[_0xdfa1('0x6')](_0xdfa1('0x5'),_0x2572a9);this[_0xdfa1('0x6')](_0xdfa1('0x7'),_0x2572a9);},'comment':_0xdfa1('0x8')},'fullname':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':![],'set':function(_0x2d3e5e){this['setDataValue'](_0xdfa1('0xa'),_0x2d3e5e);this['setDataValue'](_0xdfa1('0xb'),util[_0xdfa1('0xc')]('\x22%s\x22\x20<%s>',_0x2d3e5e,this[_0xdfa1('0xd')](_0xdfa1('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':![],'unique':_0xdfa1('0xf'),'validate':{'isEmail':!![]},'set':function(_0x871719){if(_0x871719){this[_0xdfa1('0x6')](_0xdfa1('0xf'),_0x871719[_0xdfa1('0x10')]());}}},'role':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x12'),'user',_0xdfa1('0x13'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdfa1('0x9')],'defaultValue':_0xdfa1('0x14')},'internal':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x8b6970){this['setDataValue'](_0xdfa1('0xe'),_0x8b6970);this[_0xdfa1('0x6')](_0xdfa1('0x16'),_0x8b6970);this[_0xdfa1('0x6')]('callerid',util[_0xdfa1('0xc')](_0xdfa1('0x17'),this['getDataValue']('fullname'),_0x8b6970));}},'salt':{'type':Sequelize[_0xdfa1('0x9')]},'phone':{'type':Sequelize[_0xdfa1('0x9')]},'mobile':{'type':Sequelize[_0xdfa1('0x9')]},'address':{'type':Sequelize[_0xdfa1('0x9')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xdfa1('0x9')]},'city':{'type':Sequelize[_0xdfa1('0x9')]},'country':{'type':Sequelize[_0xdfa1('0x9')]},'online':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdfa1('0x19')]},'voicePause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdfa1('0x9')],'defaultValue':_0xdfa1('0x1a')},'lastPauseAt':{'type':Sequelize[_0xdfa1('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdfa1('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdfa1('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'host':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![],'defaultValue':_0xdfa1('0x1b')},'ipaddr':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdfa1('0x11')]('friend','user',_0xdfa1('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdfa1('0x1d')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xdfa1('0x1e'),_0xdfa1('0x1f'),_0xdfa1('0x20'),_0xdfa1('0x21'),_0xdfa1('0x22'),'PROHIB_FAILED_SCREEN',_0xdfa1('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![],'defaultValue':_0xdfa1('0x24'),'set':function(_0x451441){this['setDataValue']('transport',_0x451441?_0x451441['join'](','):null);},'get':function(){return this['getDataValue'](_0xdfa1('0x25'))?this[_0xdfa1('0xd')]('transport')[_0xdfa1('0x26')](','):null;},'comment':_0xdfa1('0x27')},'dtmfmode':{'type':Sequelize[_0xdfa1('0x11')]('rfc2833',_0xdfa1('0x28'),'shortinfo',_0xdfa1('0x29'),_0xdfa1('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0xdfa1('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![],'defaultValue':_0xdfa1('0x2c'),'set':function(_0x2c7954){this['setDataValue']('nat',_0x2c7954?_0x2c7954[_0xdfa1('0x2d')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xdfa1('0xd')](_0xdfa1('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xdfa1('0x9')]},'namedcallgroup':{'type':Sequelize[_0xdfa1('0x9')]},'pickupgroup':{'type':Sequelize[_0xdfa1('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xdfa1('0x9')]},'language':{'type':Sequelize[_0xdfa1('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':![],'defaultValue':_0xdfa1('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdfa1('0x30'),'set':function(_0x3027e5){this[_0xdfa1('0x6')](_0xdfa1('0x31'),_0x3027e5?_0x3027e5['join'](';'):_0xdfa1('0x30'));},'get':function(){return this[_0xdfa1('0xd')]('allow')?this[_0xdfa1('0xd')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x387358){this[_0xdfa1('0x6')]('insecure',_0x387358?_0x387358[_0xdfa1('0x2d')](','):null);},'get':function(){return this['getDataValue'](_0xdfa1('0x33'))?this[_0xdfa1('0xd')]('insecure')['split'](','):null;},'comment':_0xdfa1('0x34')},'trustrpid':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no',_0xdfa1('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdfa1('0x36')},'amaflags':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0xdfa1('0x32')},'busylevel':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no',_0xdfa1('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x38'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdfa1('0x11')]('uac',_0xdfa1('0x39')),'allowNull':!![],'defaultValue':_0xdfa1('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![],'defaultValue':_0xdfa1('0x32')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xdfa1('0x32'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no',_0xdfa1('0x3a'),_0xdfa1('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdfa1('0x11')]('active','passive',_0xdfa1('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdfa1('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdfa1('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdfa1('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xdfa1('0x19')]},'passwordResetAt':{'type':Sequelize[_0xdfa1('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdfa1('0x3d')]},'showWebBar':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0,'set':function(_0x17107a){this[_0xdfa1('0x6')]('showWebBar',_0x17107a);var _0x59ef22=this[_0xdfa1('0x3e')]({'plain':!![]});switch(_0x17107a){case 0x0:case 0x1:var _0x3a143b=_0x59ef22['transport']?_[_0xdfa1('0x3f')](_0x59ef22[_0xdfa1('0x25')])?_0x59ef22['transport'][_0xdfa1('0x2d')]():_0x59ef22[_0xdfa1('0x25')]:_0xdfa1('0x24');if(_0x3a143b===_0xdfa1('0x40')){_0x3a143b='udp';}this[_0xdfa1('0x6')](_0xdfa1('0x25'),_0x3a143b);this[_0xdfa1('0x6')](_0xdfa1('0x41'),'no');this['setDataValue'](_0xdfa1('0x42'),null);this[_0xdfa1('0x6')](_0xdfa1('0x43'),null);this[_0xdfa1('0x6')](_0xdfa1('0x44'),null);this[_0xdfa1('0x6')](_0xdfa1('0x45'),null);this[_0xdfa1('0x6')](_0xdfa1('0x46'),null);this[_0xdfa1('0x6')](_0xdfa1('0x47'),null);this[_0xdfa1('0x6')](_0xdfa1('0x48'),null);this[_0xdfa1('0x6')]('dtlsprivatekey',null);this[_0xdfa1('0x6')](_0xdfa1('0x49'),'no');break;case 0x2:this[_0xdfa1('0x6')](_0xdfa1('0x25'),_0xdfa1('0x40'));this['setDataValue'](_0xdfa1('0x41'),_0xdfa1('0x32'));this[_0xdfa1('0x6')](_0xdfa1('0x42'),_0xdfa1('0x32'));this[_0xdfa1('0x6')](_0xdfa1('0x43'),_0xdfa1('0x32'));this[_0xdfa1('0x6')](_0xdfa1('0x44'),_0xdfa1('0x32'));this[_0xdfa1('0x6')](_0xdfa1('0x45'),_0xdfa1('0x32'));this[_0xdfa1('0x6')](_0xdfa1('0x46'),'no');this[_0xdfa1('0x6')]('dtlssetup',_0xdfa1('0x3c'));this[_0xdfa1('0x6')](_0xdfa1('0x48'),_0x59ef22[_0xdfa1('0x48')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0xdfa1('0x4a'),_0x59ef22['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xdfa1('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xdfa1('0x3d')],'set':function(_0x292d33){this[_0xdfa1('0x6')]('permissions',_0x292d33?_0x292d33[_0xdfa1('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xdfa1('0x4b'))?_['map'](this[_0xdfa1('0xd')](_0xdfa1('0x4b'))[_0xdfa1('0x26')](','),function(_0x14c1dd){return parseInt(_0x14c1dd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdfa1('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdfa1('0x9')]},'phoneBarBusyNumber':{'type':Sequelize[_0xdfa1('0x9')]},'phoneBarUnconditional':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdfa1('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdfa1('0x11')](_0xdfa1('0x32'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdfa1('0x9')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdfa1('0x4c')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xdfa1('0xd')](_0xdfa1('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xdfa1('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdfa1('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5151cc){if(typeof _0x5151cc===_0xdfa1('0x4e')){var _0xe072fb=_0x5151cc==='1'?!![]:_0x5151cc==='0'?![]:_0x5151cc===_0xdfa1('0x4f')?!![]:_0x5151cc===_0xdfa1('0x50')?![]:![];this[_0xdfa1('0x6')](_0xdfa1('0x51'),_0xe072fb);}else{this[_0xdfa1('0x6')](_0xdfa1('0x51'),_0x5151cc);}}},'blocked':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![],'set':function(_0x5438e5){this['setDataValue'](_0xdfa1('0x52'),_0x5438e5);if(_0x5438e5===!![]){this[_0xdfa1('0x6')](_0xdfa1('0x53'),moment());this[_0xdfa1('0x6')](_0xdfa1('0x54'),0x0);}else{this[_0xdfa1('0x6')](_0xdfa1('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0xdfa1('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdfa1('0x15')](0x5)[_0xdfa1('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xdfa1('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdfa1('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 40350ce..046adc5 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 _0x9dc8=['body','describe','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)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','100','111','114','115','Unauthorized','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','create','telephone','findAll','isEmpty','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Setting','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','penalty','spread','QueueId','toLowerCase','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','sms','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tags','color','tag','getQueues','model','keys','Queue','rawAttributes','intersection','order','sort','filters','pick','nolimit','getVoiceQueuesRt','fields','ChatGroup','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','faxPause','openchannelPause','smsPause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gt','$lt','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','firstName','lastName','CmContact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','ringing','teams','queues','inbound','flatten','toString','lower','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','enabled','moment','util','path','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','../../config/license/util','../../errors/api','APIForbiddenrror','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','role','emit','userNotification:recalc:','destroy','get','Users','Agents','agent','Telephones','filter','map','value','includes','find','name','UserProfileResource','end','send','fieldName','key','password','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','User','query','includeAll','include','userSetting','true','UserSetting','attributes','rows','openTabs','length','push','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','params','merge','options'];(function(_0x100547,_0x153b0c){var _0x2d638f=function(_0x1d86b8){while(--_0x1d86b8){_0x100547['push'](_0x100547['shift']());}};_0x2d638f(++_0x153b0c);}(_0x9dc8,0x135));var _0x89dc=function(_0x451f8b,_0x2d4b30){_0x451f8b=_0x451f8b-0x0;var _0x5d693b=_0x9dc8[_0x451f8b];return _0x5d693b;};'use strict';var moment=require(_0x89dc('0x0'));var util=require(_0x89dc('0x1'));var path=require(_0x89dc('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var jayson=require(_0x89dc('0x3'));var authService=require(_0x89dc('0x4'));var contacts=require(_0x89dc('0x5'));var qs=require(_0x89dc('0x6'));var rta=require(_0x89dc('0x7'));var logger=require(_0x89dc('0x8'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x89dc('0x9'));var APIBadRequestError=require(_0x89dc('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x89dc('0xa'))['APINotFoundError'];var APIForbiddenError=require('../../errors/api')[_0x89dc('0xb')];var APIHandleError=require(_0x89dc('0xa'))['handleError'];var db=require(_0x89dc('0xc'))['db'];var socket=require(_0x89dc('0xd'))(new Redis(config[_0x89dc('0xe')]));require(_0x89dc('0xf'))[_0x89dc('0x10')](socket);config['redis']=_[_0x89dc('0x11')](config[_0x89dc('0xe')],{'host':_0x89dc('0x12'),'port':0x18eb});var amiClient=jayson[_0x89dc('0x13')][_0x89dc('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x27813f,_0x271170){_0x271170=_0x271170||0xcc;return function(_0x2b2fd7){if(_0x2b2fd7){return _0x27813f[_0x89dc('0x15')](_0x271170);}return _0x27813f['status'](_0x271170)['end']();};}function respondWithResult(_0xec25e9,_0x1439b0){_0x1439b0=_0x1439b0||0xc8;return function(_0x2f348f){if(_0x2f348f){return _0xec25e9[_0x89dc('0x16')](_0x1439b0)['json'](_0x2f348f);}};}function respondWithFilteredResult(_0x3ac2b9,_0x201c77){return function(_0x362b93){if(_0x362b93){var _0x352c06=typeof _0x201c77['offset']==='undefined'&&typeof _0x201c77['limit']===_0x89dc('0x17');var _0x1f6455=_0x362b93[_0x89dc('0x18')];var _0x166eaf=_0x352c06?0x0:_0x201c77[_0x89dc('0x19')];var _0x4a88bd=_0x352c06?_0x362b93[_0x89dc('0x18')]:_0x201c77['offset']+_0x201c77[_0x89dc('0x1a')];var _0x339856;if(_0x4a88bd>=_0x1f6455){_0x4a88bd=_0x1f6455;_0x339856=0xc8;}else{_0x339856=0xce;}_0x3ac2b9[_0x89dc('0x16')](_0x339856);return _0x3ac2b9[_0x89dc('0x1b')](_0x89dc('0x1c'),_0x166eaf+'-'+_0x4a88bd+'/'+_0x1f6455)[_0x89dc('0x1d')](_0x362b93);}return null;};}function respondWithRpcPromise(_0xd3048f,_0x276709,_0x53645a,_0x39d8f6){return new Promise(function(_0x1aeaa3,_0x13731b){var _0x6b052c=_0x39d8f6||amiClient;return _0x6b052c[_0x89dc('0x1e')](_0xd3048f,_0x53645a)[_0x89dc('0x1f')](function(_0x574696){logger[_0x89dc('0x20')](_0x89dc('0x21'),_0x276709,'request\x20sent');logger[_0x89dc('0x22')](_0x89dc('0x23'),_0x276709,_0x89dc('0x24'),JSON[_0x89dc('0x25')](_0x574696));if(_0x574696['error']){if(_0x574696[_0x89dc('0x26')][_0x89dc('0x27')]===0x1f4){logger[_0x89dc('0x26')]('User,\x20%s,\x20%s',_0x276709,_0x574696[_0x89dc('0x26')][_0x89dc('0x28')]);return _0x13731b(_0x574696[_0x89dc('0x26')][_0x89dc('0x28')]);}logger[_0x89dc('0x26')]('User,\x20%s,\x20%s',_0x276709,_0x574696[_0x89dc('0x26')]['message']);return _0x1aeaa3(_0x574696[_0x89dc('0x26')][_0x89dc('0x28')]);}else{logger[_0x89dc('0x20')]('User,\x20%s,\x20%s',_0x276709,_0x89dc('0x24'));_0x1aeaa3(_0x574696[_0x89dc('0x29')]['message']);}})[_0x89dc('0x2a')](function(_0x42312a){logger[_0x89dc('0x26')](_0x89dc('0x21'),_0x276709,_0x42312a);_0x13731b(_0x42312a);});});}function saveUpdates(_0x299976){return function(_0x4c5598){if(_0x4c5598){return _0x4c5598[_0x89dc('0x2b')](_0x299976)[_0x89dc('0x1f')](function(_0x337aff){if(_0x337aff[_0x89dc('0x2c')]==='agent'){socket[_0x89dc('0x2d')](_0x89dc('0x2e')+_0x337aff['id'],_0x337aff);}return _0x337aff;});}return null;};}function removeEntity(_0xbc4fba,_0x1b62ce){return function(_0x5bb76e){if(_0x5bb76e){return _0x5bb76e[_0x89dc('0x2f')]({'transaction':_0x1b62ce})[_0x89dc('0x1f')](function(){var _0xd78ffd=_0x5bb76e[_0x89dc('0x30')]({'plain':!![]});if(_0xd78ffd[_0x89dc('0x2c')]==='admin')return;var _0x3110a1=[{'name':_0x89dc('0x31'),'value':'user','ignore':!![]},{'name':_0x89dc('0x32'),'value':_0x89dc('0x33'),'ignore':![]},{'name':_0x89dc('0x34'),'value':'telephone','ignore':![]}];var _0x129311=_(_0x3110a1)[_0x89dc('0x35')]('ignore')[_0x89dc('0x36')](_0x89dc('0x37'))[_0x89dc('0x37')]();if(_[_0x89dc('0x38')](_0x129311,_0xd78ffd[_0x89dc('0x2c')])){return;}var _0x245d1f=_[_0x89dc('0x39')](_0x3110a1,[_0x89dc('0x37'),_0xd78ffd[_0x89dc('0x2c')]])[_0x89dc('0x3a')];return db[_0x89dc('0x3b')][_0x89dc('0x2f')]({'where':{'type':_0x245d1f,'resourceId':_0xd78ffd['id']},'transaction':_0x1b62ce})[_0x89dc('0x1f')](function(){return _0x5bb76e;});})[_0x89dc('0x1f')](function(){_0xbc4fba[_0x89dc('0x16')](0xcc)[_0x89dc('0x3c')]();});}};}function handleEntityNotFound(_0x1ce94c){return function(_0x326857){if(!_0x326857){_0x1ce94c[_0x89dc('0x15')](0x194);}return _0x326857;};}function handleError(_0x28723f,_0x46484e){_0x46484e=_0x46484e||0x1f4;return function(_0x504a10){logger[_0x89dc('0x26')](_0x504a10['stack']);if(_0x504a10[_0x89dc('0x3a')]){delete _0x504a10[_0x89dc('0x3a')];}_0x28723f[_0x89dc('0x16')](_0x46484e)[_0x89dc('0x3d')](_0x504a10);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x89dc('0x36')](function(_0x408fe1){return{'name':_0x408fe1[_0x89dc('0x3e')],'type':_0x408fe1['type'][_0x89dc('0x3f')]};})['filter'](function(_0x1a81cc){return![_0x89dc('0x40'),'salt',_0x89dc('0x41'),_0x89dc('0x42'),_0x89dc('0x43'),_0x89dc('0x44')][_0x89dc('0x38')](_0x1a81cc[_0x89dc('0x3a')]);})[_0x89dc('0x37')]();}exports[_0x89dc('0x45')]=function(_0x31d1a7,_0x164431){var _0x4d3919={},_0xdfe279={'count':0x0,'rows':[]};var _0x1c412f=getUserAttributes();_0x4d3919=qs[_0x89dc('0x46')](_0x1c412f,_0x31d1a7);var _0x28789a={'where':_0x4d3919[_0x89dc('0x47')]};return db[_0x89dc('0x48')][_0x89dc('0x18')](_0x28789a)[_0x89dc('0x1f')](function(_0x1ec80c){_0xdfe279[_0x89dc('0x18')]=_0x1ec80c;if(_0x31d1a7[_0x89dc('0x49')][_0x89dc('0x4a')]){_0x4d3919[_0x89dc('0x4b')]=[{'all':!![]}];}if(_0x31d1a7[_0x89dc('0x49')][_0x89dc('0x4c')]===_0x89dc('0x4d')){_0x4d3919[_0x89dc('0x4b')]=[{'model':db[_0x89dc('0x4e')],'as':'userSetting'}];}if(!_[_0x89dc('0x38')](_0x4d3919[_0x89dc('0x4f')],'id')){_0x4d3919[_0x89dc('0x4f')]['push']('id');}return db[_0x89dc('0x48')]['findAll'](_0x4d3919);})[_0x89dc('0x1f')](function(_0x511b03){_0xdfe279[_0x89dc('0x50')]=_0x511b03;if(_0x31d1a7[_0x89dc('0x49')][_0x89dc('0x51')]===_0x89dc('0x4d')){var _0x1c35c5=[];for(var _0x453778=0x0;_0x453778<_0xdfe279[_0x89dc('0x50')][_0x89dc('0x52')];_0x453778++){_0x1c35c5[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x54'),_0xdfe279['rows'][_0x453778][_0x89dc('0x55')]));_0x1c35c5[_0x89dc('0x53')](get_open_tabs('sms',_0xdfe279[_0x89dc('0x50')][_0x453778][_0x89dc('0x55')]));_0x1c35c5['push'](get_open_tabs(_0x89dc('0x56'),_0xdfe279[_0x89dc('0x50')][_0x453778]['dataValues']));_0x1c35c5[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x57'),_0xdfe279[_0x89dc('0x50')][_0x453778][_0x89dc('0x55')]));_0x1c35c5[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x58'),_0xdfe279[_0x89dc('0x50')][_0x453778][_0x89dc('0x55')]));_0x1c35c5[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x59'),_0xdfe279[_0x89dc('0x50')][_0x453778][_0x89dc('0x55')]));}return Promise[_0x89dc('0x5a')](_0x1c35c5)['then'](function(){return _0xdfe279;});}else{return _0xdfe279;}})['then'](respondWithFilteredResult(_0x164431,_0x4d3919))['catch'](handleError(_0x164431,null));};exports[_0x89dc('0x5b')]=function(_0x37eb2f,_0x5c837d){var _0x946813=getUserAttributes();_0x37eb2f[_0x89dc('0x49')]['id']=_0x37eb2f[_0x89dc('0x5c')]['id'];var _0x548b28=qs['getOptions'](_0x946813,_0x37eb2f);if(_0x37eb2f[_0x89dc('0x49')][_0x89dc('0x4a')]){_0x548b28[_0x89dc('0x4b')]=[{'all':!![]}];}if(_0x37eb2f[_0x89dc('0x49')][_0x89dc('0x4c')]===_0x89dc('0x4d')){_0x548b28[_0x89dc('0x4b')]=[{'model':db[_0x89dc('0x4e')],'as':_0x89dc('0x4c')}];}_0x548b28=_[_0x89dc('0x5d')]({},_0x548b28,_0x37eb2f[_0x89dc('0x5e')]);if(!_['includes'](_0x548b28[_0x89dc('0x4f')],'id')){_0x548b28[_0x89dc('0x4f')][_0x89dc('0x53')]('id');}return db[_0x89dc('0x48')][_0x89dc('0x39')](_0x548b28)[_0x89dc('0x1f')](handleEntityNotFound(_0x5c837d,null))[_0x89dc('0x1f')](function(_0xa62071){var _0x13387d=[];values=_0xa62071;if(_0x37eb2f['query'][_0x89dc('0x51')]===_0x89dc('0x4d')){_0x13387d[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x54'),_0xa62071[_0x89dc('0x55')]));_0x13387d[_0x89dc('0x53')](get_open_tabs('sms',_0xa62071['dataValues']));_0x13387d[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x58'),_0xa62071[_0x89dc('0x55')]));_0x13387d[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x59'),_0xa62071['dataValues']));_0x13387d[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x56'),_0xa62071[_0x89dc('0x55')]));_0x13387d[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x57'),_0xa62071[_0x89dc('0x55')]));return Promise['all'](_0x13387d);}else{return values;}})[_0x89dc('0x1f')](function(){return values;})['then'](respondWithResult(_0x5c837d,null))[_0x89dc('0x2a')](handleError(_0x5c837d,null));};exports[_0x89dc('0x2b')]=function(_0x210b1d,_0x21e0e7){if(_0x210b1d[_0x89dc('0x5f')]['id']){delete _0x210b1d[_0x89dc('0x5f')]['id'];}delete _0x210b1d['body'][_0x89dc('0x2c')];return db[_0x89dc('0x48')][_0x89dc('0x39')]({'where':{'id':_0x210b1d[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x21e0e7,null))[_0x89dc('0x1f')](saveUpdates(_0x210b1d[_0x89dc('0x5f')],null))[_0x89dc('0x1f')](respondWithResult(_0x21e0e7,null))[_0x89dc('0x2a')](handleError(_0x21e0e7,null));};exports[_0x89dc('0x60')]=function(_0xd1b22f,_0x575f68){return db[_0x89dc('0x48')][_0x89dc('0x60')]()[_0x89dc('0x1f')](respondWithResult(_0x575f68,null))[_0x89dc('0x2a')](handleError(_0x575f68,null));};exports[_0x89dc('0x61')]=function(_0x399a1f,_0x3875c4){return db['User'][_0x89dc('0x39')]({'where':{'id':_0x399a1f['params']['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x3875c4,null))[_0x89dc('0x1f')](function(_0x3de616){if(_0x3de616){return _0x3de616[_0x89dc('0x61')](_0x399a1f[_0x89dc('0x5f')][_0x89dc('0x62')],_[_0x89dc('0x63')](_0x399a1f[_0x89dc('0x5f')],[_0x89dc('0x62'),'id'])||{});}})[_0x89dc('0x1f')](respondWithResult(_0x3875c4,null))[_0x89dc('0x2a')](handleError(_0x3875c4,null));};function validateUser(_0x303c3e){return new Promise(function(_0x8971b1,_0x3e65df){if(_0x303c3e[_0x89dc('0x64')])return _0x8971b1(_0x303c3e);return db['Setting'][_0x89dc('0x65')](0x1)[_0x89dc('0x1f')](function(_0x269dc3){if(_0x269dc3[_0x89dc('0x66')])authService[_0x89dc('0x67')](_0x303c3e[_0x89dc('0x40')]);db[_0x89dc('0x48')][_0x89dc('0x68')](_0x89dc('0x64'))[_0x89dc('0x1f')](function(_0x4c560f){if(_[_0x89dc('0x69')](_0x4c560f)){_0x303c3e[_0x89dc('0x64')]=_0x269dc3[_0x89dc('0x6a')]||0x1;return;}if(_[_0x89dc('0x69')](_0x269dc3[_0x89dc('0x6a')])||_0x269dc3[_0x89dc('0x6a')]===_0x4c560f){_0x303c3e[_0x89dc('0x64')]=_0x4c560f+0x1;return;}if(_0x269dc3[_0x89dc('0x6a')]>_0x4c560f){_0x303c3e[_0x89dc('0x64')]=_0x269dc3['min_internal'];return;}return db[_0x89dc('0x6b')][_0x89dc('0x49')](_0x89dc('0x6c'),{'type':db[_0x89dc('0x6b')][_0x89dc('0x6d')][_0x89dc('0x6e')]})[_0x89dc('0x1f')](function(_0xedbfd1){if(_0xedbfd1&&_0xedbfd1[_0x89dc('0x52')]){for(var _0x56044c=0x0,_0x4ef3bb=_0xedbfd1[_0x89dc('0x52')];_0x56044c<_0x4ef3bb&&_[_0x89dc('0x69')](_0x303c3e[_0x89dc('0x64')]);_0x56044c++){if(_0x269dc3['min_internal']<=_0xedbfd1[_0x56044c][_0x89dc('0x6f')]){_0x303c3e[_0x89dc('0x64')]=_0xedbfd1[_0x56044c][_0x89dc('0x6f')];}else if(_0x269dc3['min_internal']>_0xedbfd1[_0x56044c][_0x89dc('0x6f')]&&_0x269dc3[_0x89dc('0x6a')]<=_0xedbfd1[_0x56044c]['to']){_0x303c3e[_0x89dc('0x64')]=_0x269dc3[_0x89dc('0x6a')];}}}if(_[_0x89dc('0x69')](_0x303c3e[_0x89dc('0x64')])){_0x303c3e['internal']=_0x4c560f+0x1;}return _0x8971b1(_0x303c3e);});});})[_0x89dc('0x2a')](function(_0xa0461e){_0x3e65df(_0xa0461e);});});}function updateUser(_0x20ebae){return new Promise(function(_0x39fd5f,_0x104773){try{if(_0x20ebae[_0x89dc('0x70')]){_0x20ebae[_0x89dc('0x71')]=_0x20ebae[_0x89dc('0x64')];_0x20ebae[_0x89dc('0x72')]={'mailbox':_0x20ebae[_0x89dc('0x64')],'password':_0x20ebae[_0x89dc('0x40')],'fullname':_0x20ebae[_0x89dc('0x73')],'email':_0x20ebae[_0x89dc('0x74')]};}if(_0x20ebae[_0x89dc('0x2c')]==='agent'){if(!_0x20ebae[_0x89dc('0x75')])_0x20ebae[_0x89dc('0x75')]=['101',_0x89dc('0x76'),_0x89dc('0x77'),_0x89dc('0x78'),_0x89dc('0x79'),_0x89dc('0x7a'),_0x89dc('0x7b'),_0x89dc('0x7c'),_0x89dc('0x7d'),'108','109',_0x89dc('0x7e'),_0x89dc('0x7f'),_0x89dc('0x80'),_0x89dc('0x81')];}_0x39fd5f(_0x20ebae);}catch(_0x4789e0){_0x104773(_0x4789e0);}});}exports['create']=function(_0xfd24dc,_0x2b3ba6){if(_0xfd24dc['user']['role']===_0x89dc('0x33'))throw new Error(_0x89dc('0x82'));if(_0xfd24dc[_0x89dc('0x5f')][_0x89dc('0x2c')]===_0x89dc('0x83')&&_0xfd24dc['user'][_0x89dc('0x2c')]!==_0x89dc('0x84')){throw new Error(_0x89dc('0x85'));}if(_0xfd24dc[_0x89dc('0x5f')]['role']===_0x89dc('0x84')&&_0xfd24dc['user']['role']!==_0x89dc('0x84')){throw new Error(_0x89dc('0x86'));}return licenseUtil[_0x89dc('0x87')]([_0xfd24dc[_0x89dc('0x5f')]])[_0x89dc('0x1f')](function(){return validateUser(_0xfd24dc[_0x89dc('0x5f')]);})[_0x89dc('0x1f')](function(_0x438f0f){return updateUser(_0x438f0f)[_0x89dc('0x1f')](function(_0x2b29d2){if(_0x2b29d2[_0x89dc('0x2c')]===_0x89dc('0x84')){_0x2b29d2['settingsEnabled']=_0xfd24dc[_0x89dc('0x83')][_0x89dc('0x88')];delete _0x2b29d2[_0x89dc('0x89')];}return _0x2b29d2;});})[_0x89dc('0x1f')](function(_0x369b2b){return db[_0x89dc('0x48')]['create'](_0x369b2b,{'include':[{'model':db[_0x89dc('0x72')],'as':_0x89dc('0x72')}]});})[_0x89dc('0x1f')](function(_0x5bc671){if(_0xfd24dc[_0x89dc('0x5f')]['role']===_0x89dc('0x83'))return _0x5bc671;if(_0xfd24dc['user'][_0x89dc('0x2c')]!==_0x89dc('0x83'))return _0x5bc671;return db[_0x89dc('0x8a')][_0x89dc('0x39')]({'where':{'name':_0x5bc671[_0x89dc('0x2c')]===_0x89dc('0x33')?_0x89dc('0x32'):_0x89dc('0x34'),'userProfileId':_0xfd24dc[_0x89dc('0x83')]['userProfileId']},'raw':!![]})[_0x89dc('0x1f')](function(_0x20b6c7){if(!_0x20b6c7||_0x20b6c7[_0x89dc('0x8b')]!=0x0)return _0x5bc671;return db['UserProfileResource']['create']({'name':_0x5bc671[_0x89dc('0x3a')],'resourceId':_0x5bc671['id'],'type':_0x20b6c7['name'],'sectionId':_0x20b6c7['id']},{})[_0x89dc('0x1f')](function(){return _0x5bc671;});})[_0x89dc('0x2a')](function(_0x8cda02){logger[_0x89dc('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8cda02);throw _0x8cda02;});})[_0x89dc('0x1f')](respondWithResult(_0x2b3ba6,0xc9))[_0x89dc('0x2a')](handleError(_0x2b3ba6,null));};exports[_0x89dc('0x8c')]=function(_0x566559,_0x273dfc){var _0x2b64c3=_0x566559['body'];var _0x323800=[];if(_0x566559[_0x89dc('0x83')][_0x89dc('0x2c')]===_0x89dc('0x33'))throw new Error(_0x89dc('0x82'));if(_[_0x89dc('0x8d')](_0x2b64c3,['role',_0x89dc('0x83')])&&_0x566559[_0x89dc('0x83')][_0x89dc('0x2c')]!=='admin'){throw new Error(_0x89dc('0x85'));}if(_[_0x89dc('0x8d')](_0x2b64c3,['role',_0x89dc('0x84')])&&_0x566559[_0x89dc('0x83')][_0x89dc('0x2c')]!==_0x89dc('0x84')){throw new Error(_0x89dc('0x8e'));}return licenseUtil[_0x89dc('0x87')](_0x2b64c3)[_0x89dc('0x1f')](function(){return validateUser(_0x2b64c3[0x0]);})[_0x89dc('0x1f')](function(){for(var _0x124f32=0x1;_0x124f32<_0x2b64c3[_0x89dc('0x52')];_0x124f32++){var _0xbf19a0=_0x2b64c3[_0x124f32-0x1][_0x89dc('0x64')];if(!_0x2b64c3[_0x124f32][_0x89dc('0x64')])_0x2b64c3[_0x124f32][_0x89dc('0x64')]=_0xbf19a0+0x1;_0x323800['push'](validateUser(_0x2b64c3[_0x124f32]));}return Promise[_0x89dc('0x5a')](_0x323800);})[_0x89dc('0x1f')](function(){_0x323800=[];for(var _0x2d1352=0x0;_0x2d1352<_0x2b64c3['length'];_0x2d1352++){_0x323800[_0x89dc('0x53')](updateUser(_0x2b64c3[_0x2d1352]));}return Promise[_0x89dc('0x5a')](_0x323800);})['then'](function(){_0x323800=_0x2b64c3[_0x89dc('0x36')](function(_0x39bc51){return db[_0x89dc('0x48')][_0x89dc('0x8f')](_0x39bc51,{'include':[{'model':db[_0x89dc('0x72')],'as':_0x89dc('0x72')}]})[_0x89dc('0x1f')](function(_0x36e984){_0x39bc51['id']=_0x36e984['id'];return _0x39bc51;});});return Promise[_0x89dc('0x5a')](_0x323800);})[_0x89dc('0x1f')](function(_0x5b0df7){if(_0x566559[_0x89dc('0x5f')][_0x89dc('0x2c')]===_0x89dc('0x83'))return _0x5b0df7;if(_0x566559[_0x89dc('0x83')][_0x89dc('0x2c')]!=='user')return _0x5b0df7;var _0x5c5590=_[_0x89dc('0x8d')](_0x5b0df7,function(_0x48bd73){return _0x48bd73[_0x89dc('0x2c')]===_0x89dc('0x33')||_0x48bd73[_0x89dc('0x2c')]===_0x89dc('0x90');});if(!_0x5c5590)return _0x5b0df7;return db[_0x89dc('0x8a')][_0x89dc('0x91')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x566559[_0x89dc('0x83')][_0x89dc('0x89')]},'raw':!![]})['then'](function(_0x34b56b){if(_[_0x89dc('0x92')](_0x34b56b)||!_[_0x89dc('0x8d')](_0x34b56b,[_0x89dc('0x8b'),0x0]))return _0x5b0df7;_0x323800=[];var _0x160547=_(_0x34b56b)[_0x89dc('0x36')](function(_0x14845b){if(_0x14845b[_0x89dc('0x8b')]===0x1)return;return _0x14845b['name']===_0x89dc('0x32')?_0x89dc('0x33'):'telephone';})['compact']()[_0x89dc('0x37')]();for(var _0x172d83=0x0;_0x172d83<_0x5b0df7[_0x89dc('0x52')];_0x172d83++){if(!_[_0x89dc('0x38')](_0x160547,_0x5b0df7[_0x172d83]['role']))return;var _0x4342dd=_0x5b0df7[_0x172d83][_0x89dc('0x2c')]==='agent'?_0x89dc('0x32'):_0x89dc('0x34');_0x323800[_0x89dc('0x53')](db['UserProfileResource'][_0x89dc('0x8f')]({'name':_0x5b0df7[_0x172d83][_0x89dc('0x3a')],'resourceId':_0x5b0df7[_0x172d83]['id'],'type':_0x4342dd,'sectionId':_[_0x89dc('0x39')](_0x34b56b,[_0x89dc('0x3a'),_0x4342dd])['id']},{}));}return Promise['all'](_0x323800);});})[_0x89dc('0x1f')](respondWithResult(_0x273dfc,0xc9))['catch'](handleError(_0x273dfc,null));};exports[_0x89dc('0x93')]=function(_0x5ddba1,_0x3e0200){if(_0x5ddba1[_0x89dc('0x5f')]['id']){delete _0x5ddba1[_0x89dc('0x5f')]['id'];}return db[_0x89dc('0x48')][_0x89dc('0x39')]({'where':{'id':_0x5ddba1['params']['id']}})['then'](function(_0x49ad88){if(!_0x49ad88)return null;if(_0x49ad88['id']===_0x5ddba1[_0x89dc('0x83')]['id']){if(!_0x5ddba1[_0x89dc('0x5f')]['oldPassword']||!_0x5ddba1['body'][_0x89dc('0x94')]){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))](_0x89dc('0x97'));}if(!_0x49ad88[_0x89dc('0x98')](_0x5ddba1[_0x89dc('0x5f')][_0x89dc('0x99')])){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))]('Wrong\x20credentials');}if(_0x5ddba1[_0x89dc('0x5f')]['oldPassword']===_0x5ddba1[_0x89dc('0x5f')][_0x89dc('0x94')]){throw new db['Sequelize']['ValidationError'](_0x89dc('0x9a'));}}else if(_0x5ddba1[_0x89dc('0x83')][_0x89dc('0x2c')]===_0x89dc('0x84')){if(!_0x5ddba1[_0x89dc('0x5f')][_0x89dc('0x94')]){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5ddba1['user'][_0x89dc('0x2c')]===_0x89dc('0x83')){if(!_0x5ddba1['body'][_0x89dc('0x94')]){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x49ad88['role']!==_0x89dc('0x33')){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))]('Unauthorized');}}else{throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))](_0x89dc('0x82'));}return _0x49ad88;})[_0x89dc('0x1f')](handleEntityNotFound(_0x3e0200,null))[_0x89dc('0x1f')](function(_0x2b85d3){return db[_0x89dc('0x9b')]['findOne']({'attributes':['id','securePassword',_0x89dc('0x9c'),_0x89dc('0x9d')]})[_0x89dc('0x1f')](function(_0x858470){if(_0x858470['securePassword'])authService[_0x89dc('0x67')](_0x5ddba1['body'][_0x89dc('0x94')]);if(!_0x858470[_0x89dc('0x9c')]||!_0x2b85d3[_0x89dc('0x41')])return _0x2b85d3;authService[_0x89dc('0x9e')](_0x5ddba1[_0x89dc('0x5f')]['newPassword'],_0x2b85d3[_0x89dc('0x41')],_0x858470[_0x89dc('0x9d')]);return _0x2b85d3;})[_0x89dc('0x1f')](saveUpdates({'password':_0x5ddba1[_0x89dc('0x5f')][_0x89dc('0x94')],'passwordResetAt':_0x5ddba1[_0x89dc('0x83')]['id']==_0x5ddba1[_0x89dc('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x89dc('0x9f')](_0x5ddba1[_0x89dc('0x5f')]['newPassword'],_0x2b85d3[_0x89dc('0x41')])},null));})['then'](respondWithResult(_0x3e0200,null))['catch'](handleError(_0x3e0200,null));};exports[_0x89dc('0xa0')]=function(_0x3d4277,_0x2c76ea){var _0xce88d1=_0x3d4277[_0x89dc('0x5f')][_0x89dc('0xa1')];return db[_0x89dc('0x48')][_0x89dc('0x39')]({'where':{'id':_0x3d4277[_0x89dc('0x5c')]['id']},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0x2c'),_0x89dc('0xa2'),_0x89dc('0xa3'),'voicePause',_0x89dc('0xa4')]})[_0x89dc('0x1f')](handleEntityNotFound(_0x2c76ea,null))[_0x89dc('0x1f')](function(_0x4c8f02){if(_0x4c8f02){if(!utils[_0x89dc('0xa5')](_0xce88d1)){throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))](_0x89dc('0xa6'));}return _0x4c8f02[_0x89dc('0xa7')+_[_0x89dc('0xa8')](_0xce88d1['toLowerCase']())+'Queues'](_0x3d4277[_0x89dc('0x5f')][_0x89dc('0x62')],{'penalty':_0x3d4277['body'][_0x89dc('0xa9')]||0x0})[_0x89dc('0xaa')](function(_0x11b41a){for(var _0xd223d6=0x0;_0xd223d6<_0x3d4277['body'][_0x89dc('0x62')][_0x89dc('0x52')];_0xd223d6+=0x1){var _0xb6aae1={'UserId':Number(_0x3d4277[_0x89dc('0x5c')]['id'])};_0xb6aae1[_[_0x89dc('0xa8')](_0xce88d1['toLowerCase']())+_0x89dc('0xab')]=Number(_0x3d4277['body'][_0x89dc('0x62')][_0xd223d6]);socket[_0x89dc('0x2d')](_0x89dc('0x83')+_['capitalize'](_0xce88d1[_0x89dc('0xac')]())+_0x89dc('0xad'),_0xb6aae1);}return _0x11b41a;})[_0x89dc('0x1f')](function(){if(_0xce88d1===_0x89dc('0xae')){return db[_0x89dc('0xaf')][_0x89dc('0x91')]({'where':{'id':_0x3d4277[_0x89dc('0x5f')][_0x89dc('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x89dc('0x1f')](function(_0x11876b){var _0x5dd6ad=_0x4c8f02[_0x89dc('0x30')]({'plain':!![]});var _0x3de636=[];if(_0xce88d1===_0x89dc('0xae')&&_0x5dd6ad[_0x89dc('0x2c')]===_0x89dc('0x33')&&_0x5dd6ad[_0x89dc('0xa2')]){for(let _0x2dc7eb=0x0;_0x2dc7eb<_0x11876b[_0x89dc('0x52')];_0x2dc7eb+=0x1){_0x3de636[_0x89dc('0x53')]({'membername':_0x5dd6ad['name'],'UserId':_0x5dd6ad['id'],'queue_name':_0x11876b[_0x2dc7eb][_0x89dc('0x3a')],'VoiceQueueId':_0x11876b[_0x2dc7eb]['id'],'interface':_['isNil'](_0x5dd6ad[_0x89dc('0xa4')])?util[_0x89dc('0xb0')](_0x89dc('0xb1'),_0x5dd6ad['name']):_0x5dd6ad[_0x89dc('0xa4')],'paused':_0x5dd6ad[_0x89dc('0xb2')]||![],'penalty':_0x3d4277[_0x89dc('0x5f')][_0x89dc('0xa9')]||0x0});}return Promise[_0x89dc('0x5a')](_0x3de636[_0x89dc('0x36')](function(_0x103d4c){return db[_0x89dc('0xb3')][_0x89dc('0xb4')](_0x103d4c);}));}return _0x4c8f02;});}})[_0x89dc('0x1f')](respondWithStatusCode(_0x2c76ea,null))[_0x89dc('0x2a')](handleError(_0x2c76ea,null));};exports[_0x89dc('0xb5')]=function(_0x1afac1,_0x3440df){var _0xab391a,_0x422ee0;return db['User'][_0x89dc('0x39')]({'where':{'id':_0x1afac1[_0x89dc('0x5c')]['id']},'attributes':['id',_0x89dc('0x3a'),'role']})['then'](handleEntityNotFound(_0x3440df,null))[_0x89dc('0x1f')](function(_0x543f57){if(_0x543f57){_0xab391a=_0x543f57;if(!_0x1afac1['query']['channel']||!utils[_0x89dc('0xa5')](_0x1afac1[_0x89dc('0x49')][_0x89dc('0xa1')])){throw new db[(_0x89dc('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x543f57[_0x89dc('0xb6')+_[_0x89dc('0xa8')](_0x1afac1[_0x89dc('0x49')][_0x89dc('0xa1')][_0x89dc('0xac')]())+_0x89dc('0xb7')](_0x1afac1[_0x89dc('0x49')][_0x89dc('0x62')]);}})['then'](function(_0x2ec2b7){if(_['isArray'](_0x1afac1['query'][_0x89dc('0x62')])){for(var _0x11a039=0x0;_0x11a039<_0x1afac1[_0x89dc('0x49')][_0x89dc('0x62')]['length'];_0x11a039+=0x1){_0x422ee0={'UserId':Number(_0x1afac1['params']['id'])};_0x422ee0[_['capitalize'](_0x1afac1[_0x89dc('0x49')][_0x89dc('0xa1')]['toLowerCase']())+_0x89dc('0xab')]=Number(_0x1afac1['query']['ids'][_0x11a039]);socket[_0x89dc('0x2d')](_0x89dc('0x83')+_['capitalize'](_0x1afac1['query']['channel']['toLowerCase']())+_0x89dc('0xb8'),_0x422ee0);}}else{_0x422ee0={'UserId':Number(_0x1afac1[_0x89dc('0x5c')]['id'])};_0x422ee0[_[_0x89dc('0xa8')](_0x1afac1['query'][_0x89dc('0xa1')][_0x89dc('0xac')]())+_0x89dc('0xab')]=Number(_0x1afac1[_0x89dc('0x49')][_0x89dc('0x62')]);socket[_0x89dc('0x2d')](_0x89dc('0x83')+_[_0x89dc('0xa8')](_0x1afac1[_0x89dc('0x49')][_0x89dc('0xa1')][_0x89dc('0xac')]())+_0x89dc('0xb8'),_0x422ee0);}return _0x2ec2b7;})[_0x89dc('0x1f')](function(){if(_0x1afac1['query'][_0x89dc('0xa1')]===_0x89dc('0xae')){return db[_0x89dc('0xb3')][_0x89dc('0x2f')]({'where':{'UserId':_0x1afac1['params']['id'],'VoiceQueueId':_0x1afac1[_0x89dc('0x49')][_0x89dc('0x62')]},'individualHooks':!![]})[_0x89dc('0x1f')](function(){return _0xab391a;});}return _0xab391a;})[_0x89dc('0x1f')](respondWithStatusCode(_0x3440df,null))[_0x89dc('0x2a')](handleError(_0x3440df,null));};exports[_0x89dc('0xb9')]=function(_0x5a875d,_0x1f3d0b){_0x5a875d[_0x89dc('0x5f')][_0x89dc('0xba')]=_0x5a875d[_0x89dc('0xbb')][_0x89dc('0xbc')];return db['User'][_0x89dc('0x39')]({'where':{'id':_0x5a875d[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x1f3d0b,null))[_0x89dc('0x1f')](saveUpdates(_0x5a875d[_0x89dc('0x5f')],null))[_0x89dc('0x1f')](respondWithResult(_0x1f3d0b,null))[_0x89dc('0x2a')](handleError(_0x1f3d0b,null));};exports[_0x89dc('0xbd')]=function(_0x1c7dce,_0x3defda){var _0x575d17=path['join'](config[_0x89dc('0xbe')],_0x89dc('0xbf'));return db[_0x89dc('0x48')]['find']({'where':{'id':_0x1c7dce[_0x89dc('0x5c')]['id']},'attributes':['id',_0x89dc('0xba')],'raw':!![]})[_0x89dc('0x1f')](handleEntityNotFound(_0x3defda,null))['then'](function(_0x10e04f){if(_0x10e04f){if(_[_0x89dc('0x69')](_0x10e04f['userpic'])){return _0x3defda[_0x89dc('0xc0')](_0x575d17);}else{if(!fs[_0x89dc('0xc1')](path[_0x89dc('0xc2')](config[_0x89dc('0xbe')],'server/files/images/',_0x10e04f['userpic']))){return _0x3defda[_0x89dc('0xc0')](_0x575d17);}return _0x3defda[_0x89dc('0xc0')](path['join'](config[_0x89dc('0xbe')],'server/files/images/',_0x10e04f['userpic']));}}})[_0x89dc('0x2a')](handleError(_0x3defda,null));};exports['getOpenTabs']=function(_0x3c9ab3,_0x1cbcc4){return db[_0x89dc('0x48')]['find']({'where':{'id':_0x3c9ab3[_0x89dc('0x5c')]['id']},'attributes':['id']})[_0x89dc('0x1f')](handleEntityNotFound(_0x1cbcc4,null))[_0x89dc('0x1f')](function(_0xa7830e){var _0x126402=[];values=_0xa7830e[_0x89dc('0x55')];_0x126402['push'](get_open_tabs(_0x89dc('0x54'),_0xa7830e['dataValues']));_0x126402['push'](get_open_tabs(_0x89dc('0xc3'),_0xa7830e[_0x89dc('0x55')]));_0x126402[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x58'),_0xa7830e[_0x89dc('0x55')]));_0x126402[_0x89dc('0x53')](get_open_tabs('whatsapp',_0xa7830e[_0x89dc('0x55')]));_0x126402[_0x89dc('0x53')](get_open_tabs(_0x89dc('0x56'),_0xa7830e[_0x89dc('0x55')]));_0x126402[_0x89dc('0x53')](get_open_tabs('mail',_0xa7830e['dataValues']));return Promise[_0x89dc('0x5a')](_0x126402);})[_0x89dc('0x1f')](function(_0x96a5f6){if(_0x96a5f6){var _0x4e360=_[_0x89dc('0x36')](values[_0x89dc('0xc4')],function(_0xe9343a){return{'channel':_0x89dc('0xc5'),'id':_0xe9343a['id'],'createdAt':_0xe9343a[_0x89dc('0xc6')]};});var _0x76f517=_[_0x89dc('0x36')](values[_0x89dc('0xc7')],function(_0x31353c){return{'channel':'FAX','id':_0x31353c['id'],'createdAt':_0x31353c[_0x89dc('0xc6')]};});var _0x4f5848=_[_0x89dc('0x36')](values[_0x89dc('0xc8')],function(_0x29c211){return{'channel':_0x89dc('0xc9'),'id':_0x29c211['id'],'createdAt':_0x29c211[_0x89dc('0xc6')]};});var _0xa95337=_['map'](values[_0x89dc('0xca')],function(_0x394049){return{'channel':'MAIL','id':_0x394049['id'],'createdAt':_0x394049[_0x89dc('0xc6')]};});var _0x19a9e2=_[_0x89dc('0x36')](values[_0x89dc('0xcb')],function(_0x5f12f6){return{'channel':_0x89dc('0xcc'),'id':_0x5f12f6['id'],'createdAt':_0x5f12f6['createdAt']};});var _0x212812=_[_0x89dc('0x36')](values[_0x89dc('0xcd')],function(_0x55c9b2){return{'channel':_0x89dc('0xce'),'id':_0x55c9b2['id'],'createdAt':_0x55c9b2[_0x89dc('0xc6')]};});var _0x5ecc3c=_[_0x89dc('0xcf')](_0x4e360,_0x76f517,_0x4f5848,_0xa95337,_0x19a9e2,_0x212812);var _0x42dca8={'count':_0x5ecc3c['length'],'rows':_0x5ecc3c};return _0x42dca8;}else return null;})[_0x89dc('0x1f')](respondWithResult(_0x1cbcc4,null))['catch'](handleError(_0x1cbcc4,null));};exports[_0x89dc('0xd0')]=function(_0x96d255,_0x5f51eb){var _0x558aa2={};return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x96d255[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](function(_0x187656){if(!_0x187656){throw new APINotFoundError(util[_0x89dc('0xb0')](_0x89dc('0xd2'),_0x96d255['params']['id']));}return contacts['describe']();})[_0x89dc('0x1f')](function(_0x3bccc5){_0x96d255['query']['User']=_0x96d255[_0x89dc('0x5c')]['id'];_0x558aa2=qs[_0x89dc('0x46')](_0x3bccc5,_0x96d255);if(_0x96d255[_0x89dc('0x49')][_0x89dc('0xd3')]('includeAll')){_0x558aa2['include']=[{'model':db[_0x89dc('0xd4')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x89dc('0xd5'),'attributes':['id',_0x89dc('0x3a'),_0x89dc('0xd6')],'where':_0x96d255['query']['tag']?{'id':_0x96d255[_0x89dc('0x49')][_0x89dc('0xd7')]}:undefined,'required':_0x96d255['query']['tag']?!![]:![]}];}return contacts[_0x89dc('0x91')](_0x96d255[_0x89dc('0x49')],_0x96d255[_0x89dc('0x83')],_0x558aa2,_0x3bccc5);})[_0x89dc('0x1f')](respondWithFilteredResult(_0x5f51eb,_0x558aa2))[_0x89dc('0x2a')](APIHandleError(_0x5f51eb));};exports[_0x89dc('0xd8')]=function(_0xbe14fd,_0x186d53){var _0x148e15;var _0x20ba5e={};var _0x2e93bd;return db[_0x89dc('0x48')]['findOne']({'where':{'id':_0xbe14fd[_0x89dc('0x5c')]['id']},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0x2c')]})[_0x89dc('0x1f')](handleEntityNotFound(_0x186d53,null))['then'](function(_0x18e17f){if(!utils[_0x89dc('0xa5')](_0xbe14fd[_0x89dc('0x49')]['channel'])){throw new db['Sequelize'][(_0x89dc('0x96'))](_0x89dc('0xa6'));}_0x148e15=_0x18e17f;var _0x14294a={};_0x14294a[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_[_0x89dc('0xa8')](_0xbe14fd[_0x89dc('0x49')][_0x89dc('0xa1')])+_0x89dc('0xdb')][_0x89dc('0xdc')]);_0x14294a['query']=_['keys'](_0xbe14fd[_0x89dc('0x49')]);_0x14294a['filters']=_[_0x89dc('0xdd')](_0x14294a[_0x89dc('0xd9')],_0x14294a[_0x89dc('0x49')]);_0x20ba5e['attributes']=_['intersection'](_0x14294a['model'],qs['fields'](_0xbe14fd[_0x89dc('0x49')]['fields']));_0x20ba5e[_0x89dc('0x4f')]=_0x20ba5e['attributes'][_0x89dc('0x52')]?_0x20ba5e[_0x89dc('0x4f')]:_0x14294a[_0x89dc('0xd9')];_0x20ba5e[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0xbe14fd[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x20ba5e[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0xbe14fd[_0x89dc('0x49')],_0x14294a['filters']));if(_0xbe14fd['query'][_0x89dc('0x35')]){_0x20ba5e[_0x89dc('0x47')]=_['merge'](_0x20ba5e[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x20ba5e[_0x89dc('0x4f')],function(_0xb2a842){var _0x550030={};_0x550030[_0xb2a842]={'$like':'%'+_0xbe14fd[_0x89dc('0x49')]['filter']+'%'};return _0x550030;})});}_0x20ba5e=_[_0x89dc('0x5d')]({},_0x20ba5e,_0xbe14fd[_0x89dc('0x5e')]);switch(_0x148e15['role']){case _0x89dc('0x84'):return db[_[_0x89dc('0xa8')](_0xbe14fd[_0x89dc('0x49')][_0x89dc('0xa1')])+'Queue'][_0x89dc('0x91')](_0x20ba5e);case _0x89dc('0x83'):case _0x89dc('0x33'):return _0x148e15[_0x89dc('0x30')+_['capitalize'](_0xbe14fd['query'][_0x89dc('0xa1')])+_0x89dc('0xb7')](_0x20ba5e);default:throw new db[(_0x89dc('0x95'))][(_0x89dc('0x96'))]('Unknown\x20role');}})[_0x89dc('0x1f')](function(_0x46c9be){_0x2e93bd=_0x46c9be[_0x89dc('0x52')];if(!_0xbe14fd[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x20ba5e['limit']=qs['limit'](_0xbe14fd['query'][_0x89dc('0x1a')]);_0x20ba5e[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0xbe14fd['query'][_0x89dc('0x19')]);}switch(_0x148e15['role']){case'admin':return db[_[_0x89dc('0xa8')](_0xbe14fd[_0x89dc('0x49')]['channel'])+_0x89dc('0xdb')][_0x89dc('0x91')](_0x20ba5e);case _0x89dc('0x83'):case _0x89dc('0x33'):return _0x148e15[_0x89dc('0x30')+_[_0x89dc('0xa8')](_0xbe14fd['query'][_0x89dc('0xa1')])+_0x89dc('0xb7')](_0x20ba5e);}})[_0x89dc('0x1f')](function(_0xcd117c){return{'count':_0x2e93bd,'rows':_0xcd117c};})[_0x89dc('0x1f')](respondWithResult(_0x186d53,null))[_0x89dc('0x2a')](handleError(_0x186d53,null));};exports[_0x89dc('0xe3')]=function(_0x3a85cc,_0x1622da){var _0xaa84f6={};var _0x400ec4={};var _0x361d3c;var _0xdf9b21;return db['User'][_0x89dc('0xd1')]({'where':{'id':_0x3a85cc[_0x89dc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1622da,null))[_0x89dc('0x1f')](function(_0x4095a5){if(_0x4095a5){_0x361d3c=_0x4095a5;_0x400ec4['model']=_[_0x89dc('0xda')](db['UserVoiceQueueRt']['rawAttributes']);_0x400ec4[_0x89dc('0x49')]=_[_0x89dc('0xda')](_0x3a85cc[_0x89dc('0x49')]);_0x400ec4['filters']=_[_0x89dc('0xdd')](_0x400ec4['model'],_0x400ec4['query']);_0xaa84f6[_0x89dc('0x4f')]=_['intersection'](_0x400ec4[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x3a85cc[_0x89dc('0x49')]['fields']));_0xaa84f6[_0x89dc('0x4f')]=_0xaa84f6[_0x89dc('0x4f')]['length']?_0xaa84f6[_0x89dc('0x4f')]:_0x400ec4['model'];_0xaa84f6[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x3a85cc[_0x89dc('0x49')][_0x89dc('0xdf')]);_0xaa84f6[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x3a85cc[_0x89dc('0x49')],_0x400ec4[_0x89dc('0xe0')]));if(_0x3a85cc['query'][_0x89dc('0x35')]){_0xaa84f6[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0xaa84f6[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0xaa84f6[_0x89dc('0x4f')],function(_0x31be7a){var _0x3f4974={};_0x3f4974[_0x31be7a]={'$like':'%'+_0x3a85cc[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0x3f4974;})});}_0xaa84f6=_['merge']({},_0xaa84f6,_0x3a85cc['options']);return _0x361d3c['getVoiceQueuesRt'](_0xaa84f6);}})['then'](function(_0x2db045){if(_0x2db045){_0xdf9b21=_0x2db045[_0x89dc('0x52')];if(!_0x3a85cc[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0xaa84f6['limit']=qs[_0x89dc('0x1a')](_0x3a85cc[_0x89dc('0x49')][_0x89dc('0x1a')]);_0xaa84f6[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x3a85cc[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x361d3c[_0x89dc('0xe3')](_0xaa84f6);}})[_0x89dc('0x1f')](function(_0x3d495d){if(_0x3d495d){return _0x3d495d?{'count':_0xdf9b21,'rows':_0x3d495d}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x1622da,null))[_0x89dc('0x2a')](handleError(_0x1622da,null));};exports['getGroups']=function(_0x15b7c2,_0x384a8e){var _0x28f823={};var _0x511812={};var _0x5f0d64;var _0x5a3db6;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x15b7c2['params']['id']}})['then'](handleEntityNotFound(_0x384a8e,null))[_0x89dc('0x1f')](function(_0x483b0a){if(_0x483b0a){_0x5f0d64=_0x483b0a;_0x511812[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0xe5')][_0x89dc('0xdc')]);_0x511812[_0x89dc('0x49')]=_[_0x89dc('0xda')](_0x15b7c2['query']);_0x511812[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x511812[_0x89dc('0xd9')],_0x511812[_0x89dc('0x49')]);_0x28f823[_0x89dc('0x4f')]=_[_0x89dc('0xdd')](_0x511812[_0x89dc('0xd9')],qs['fields'](_0x15b7c2[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x28f823[_0x89dc('0x4f')]=_0x28f823[_0x89dc('0x4f')]['length']?_0x28f823[_0x89dc('0x4f')]:_0x511812[_0x89dc('0xd9')];_0x28f823['order']=qs[_0x89dc('0xdf')](_0x15b7c2[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x28f823[_0x89dc('0x47')]=qs['filters'](_['pick'](_0x15b7c2[_0x89dc('0x49')],_0x511812[_0x89dc('0xe0')]));if(_0x15b7c2[_0x89dc('0x49')][_0x89dc('0x35')]){_0x28f823[_0x89dc('0x47')]=_['merge'](_0x28f823[_0x89dc('0x47')],{'$or':_['map'](_0x28f823['attributes'],function(_0x23c064){var _0xee05c5={};_0xee05c5[_0x23c064]={'$like':'%'+_0x15b7c2[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0xee05c5;})});}_0x28f823=_[_0x89dc('0x5d')]({},_0x28f823,_0x15b7c2[_0x89dc('0x5e')]);return _0x5f0d64[_0x89dc('0xe6')](_0x28f823);}})['then'](function(_0x7019bc){if(_0x7019bc){_0x5a3db6=_0x7019bc[_0x89dc('0x52')];if(!_0x15b7c2[_0x89dc('0x49')][_0x89dc('0xd3')]('nolimit')){_0x28f823[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x15b7c2[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x28f823[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x15b7c2[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x5f0d64[_0x89dc('0xe6')](_0x28f823);}})[_0x89dc('0x1f')](function(_0x2061af){if(_0x2061af){return _0x2061af?{'count':_0x5a3db6,'rows':_0x2061af}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x384a8e,null))[_0x89dc('0x2a')](handleError(_0x384a8e,null));};exports['getRecordings']=function(_0x1c5aa1,_0x176d2e){var _0x2c5e1e={'raw':!![],'where':{}};var _0x558692={};var _0x2a1b51={'count':0x0,'rows':[]};return db[_0x89dc('0x48')]['findOne']({'where':{'id':_0x1c5aa1[_0x89dc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x176d2e,null))['then'](function(_0x45b75d){if(_0x45b75d){_0x558692[_0x89dc('0xd9')]=_['keys'](db[_0x89dc('0xe7')][_0x89dc('0xdc')]);_0x558692['query']=_[_0x89dc('0xda')](_0x1c5aa1[_0x89dc('0x49')]);_0x558692[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x558692[_0x89dc('0xd9')],_0x558692[_0x89dc('0x49')]);_0x2c5e1e[_0x89dc('0x4f')]=_[_0x89dc('0xdd')](_0x558692[_0x89dc('0xd9')],qs['fields'](_0x1c5aa1['query'][_0x89dc('0xe4')]));_0x2c5e1e[_0x89dc('0x4f')]=_0x2c5e1e[_0x89dc('0x4f')][_0x89dc('0x52')]?_0x2c5e1e[_0x89dc('0x4f')]:_0x558692[_0x89dc('0xd9')];if(!_0x1c5aa1['query'][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x2c5e1e[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x1c5aa1[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x2c5e1e['offset']=qs['offset'](_0x1c5aa1[_0x89dc('0x49')][_0x89dc('0x19')]);}_0x2c5e1e[_0x89dc('0xde')]=qs['sort'](_0x1c5aa1['query'][_0x89dc('0xdf')]);_0x2c5e1e['where']=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x1c5aa1[_0x89dc('0x49')],_0x558692[_0x89dc('0xe0')]));_0x2c5e1e[_0x89dc('0x47')][_0x89dc('0xe8')]=_0x45b75d['id'];if(_0x1c5aa1[_0x89dc('0x49')][_0x89dc('0x35')]){_0x2c5e1e[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x2c5e1e[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x2c5e1e[_0x89dc('0x4f')],function(_0x3aaa97){var _0x84450={};_0x84450[_0x3aaa97]={'$like':'%'+_0x1c5aa1[_0x89dc('0x49')]['filter']+'%'};return _0x84450;})});}_0x2c5e1e=_[_0x89dc('0x5d')]({},_0x2c5e1e,_0x1c5aa1[_0x89dc('0x5e')]);return db['VoiceRecording'][_0x89dc('0x18')]({'where':_0x2c5e1e['where']})['then'](function(_0x4d66d9){_0x2a1b51[_0x89dc('0x18')]=_0x4d66d9;if(_0x1c5aa1[_0x89dc('0x49')][_0x89dc('0x4a')]){_0x2c5e1e['include']=[{'all':!![]}];}return db[_0x89dc('0xe7')][_0x89dc('0x91')](_0x2c5e1e);})[_0x89dc('0x1f')](function(_0x54bafe){_0x2a1b51['rows']=_0x54bafe;return _0x2a1b51;});}})[_0x89dc('0x1f')](respondWithFilteredResult(_0x176d2e,_0x2c5e1e))[_0x89dc('0x2a')](handleError(_0x176d2e,null));};exports[_0x89dc('0xe9')]=function(_0x41b46f,_0x4209ee){var _0x1a6d46={'raw':!![],'where':{}};var _0xf407c5={};var _0x4b248d={'count':0x0,'rows':[]};return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x41b46f['params']['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x4209ee,null))['then'](function(_0x1b8512){if(_0x1b8512){_0xf407c5[_0x89dc('0xd9')]=_['keys'](db[_0x89dc('0xea')][_0x89dc('0xdc')]);_0xf407c5[_0x89dc('0x49')]=_[_0x89dc('0xda')](_0x41b46f[_0x89dc('0x49')]);_0xf407c5['filters']=_[_0x89dc('0xdd')](_0xf407c5['model'],_0xf407c5[_0x89dc('0x49')]);_0x1a6d46[_0x89dc('0x4f')]=_[_0x89dc('0xdd')](_0xf407c5['model'],qs['fields'](_0x41b46f[_0x89dc('0x49')]['fields']));_0x1a6d46[_0x89dc('0x4f')]=_0x1a6d46[_0x89dc('0x4f')][_0x89dc('0x52')]?_0x1a6d46[_0x89dc('0x4f')]:_0xf407c5[_0x89dc('0xd9')];if(!_0x41b46f[_0x89dc('0x49')]['hasOwnProperty']('nolimit')){_0x1a6d46[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x41b46f[_0x89dc('0x49')]['limit']);_0x1a6d46[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x41b46f[_0x89dc('0x49')][_0x89dc('0x19')]);}_0x1a6d46[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x41b46f['query'][_0x89dc('0xdf')]);_0x1a6d46[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x41b46f[_0x89dc('0x49')],_0xf407c5[_0x89dc('0xe0')]));_0x1a6d46[_0x89dc('0x47')][_0x89dc('0xe8')]=_0x1b8512['id'];if(_0x41b46f[_0x89dc('0x49')][_0x89dc('0x35')]){_0x1a6d46[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x1a6d46[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x1a6d46[_0x89dc('0x4f')],function(_0x52238a){var _0x2fb93c={};_0x2fb93c[_0x52238a]={'$like':'%'+_0x41b46f[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0x2fb93c;})});}_0x1a6d46=_[_0x89dc('0x5d')]({},_0x1a6d46,_0x41b46f[_0x89dc('0x5e')]);return db[_0x89dc('0xea')][_0x89dc('0x18')]({'where':_0x1a6d46['where']})['then'](function(_0x53e268){_0x4b248d[_0x89dc('0x18')]=_0x53e268;if(_0x41b46f[_0x89dc('0x49')]['includeAll']){_0x1a6d46[_0x89dc('0x4b')]=[{'all':!![]}];}return db[_0x89dc('0xea')][_0x89dc('0x91')](_0x1a6d46);})[_0x89dc('0x1f')](function(_0x2505ab){_0x4b248d[_0x89dc('0x50')]=_0x2505ab;return _0x4b248d;});}})[_0x89dc('0x1f')](respondWithFilteredResult(_0x4209ee,_0x1a6d46))[_0x89dc('0x2a')](handleError(_0x4209ee,null));};exports[_0x89dc('0xeb')]=function(_0x2985a7,_0x13c686){var _0x22f1c3={};var _0x10512f={};var _0x1b1898;var _0x2e5d83;return db['User']['findOne']({'where':{'id':_0x2985a7['params']['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x13c686,null))[_0x89dc('0x1f')](function(_0x34415a){if(_0x34415a){_0x1b1898=_0x34415a;_0x10512f[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0xec')][_0x89dc('0xdc')]);_0x10512f['query']=_[_0x89dc('0xda')](_0x2985a7['query']);_0x10512f[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x10512f['model'],_0x10512f[_0x89dc('0x49')]);_0x22f1c3[_0x89dc('0x4f')]=_['intersection'](_0x10512f[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x2985a7['query'][_0x89dc('0xe4')]));_0x22f1c3[_0x89dc('0x4f')]=_0x22f1c3[_0x89dc('0x4f')]['length']?_0x22f1c3[_0x89dc('0x4f')]:_0x10512f['model'];_0x22f1c3[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x2985a7['query'][_0x89dc('0xdf')]);_0x22f1c3[_0x89dc('0x47')]=qs['filters'](_[_0x89dc('0xe1')](_0x2985a7[_0x89dc('0x49')],_0x10512f[_0x89dc('0xe0')]));if(_0x2985a7[_0x89dc('0x49')][_0x89dc('0x35')]){_0x22f1c3[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x22f1c3[_0x89dc('0x47')],{'$or':_['map'](_0x22f1c3[_0x89dc('0x4f')],function(_0x89ffee){var _0x556de1={};_0x556de1[_0x89ffee]={'$like':'%'+_0x2985a7[_0x89dc('0x49')]['filter']+'%'};return _0x556de1;})});}_0x22f1c3=_['merge']({},_0x22f1c3,_0x2985a7[_0x89dc('0x5e')]);return _0x1b1898['getChatInteractions'](_0x22f1c3);}})[_0x89dc('0x1f')](function(_0x5aa61d){if(_0x5aa61d){_0x2e5d83=_0x5aa61d['length'];if(!_0x2985a7[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x22f1c3[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x2985a7[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x22f1c3[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x2985a7[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x1b1898['getChatInteractions'](_0x22f1c3);}})[_0x89dc('0x1f')](function(_0x4097f1){if(_0x4097f1){return _0x4097f1?{'count':_0x2e5d83,'rows':_0x4097f1}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x13c686,null))['catch'](handleError(_0x13c686,null));};exports[_0x89dc('0xed')]=function(_0x7bf630,_0x3b07fb){var _0x251392={};var _0x1abcdf={};var _0xa8ba2f;var _0x553a50;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x7bf630['params']['id']}})['then'](handleEntityNotFound(_0x3b07fb,null))[_0x89dc('0x1f')](function(_0x4ec25e){if(_0x4ec25e){_0xa8ba2f=_0x4ec25e;_0x1abcdf['model']=_[_0x89dc('0xda')](db[_0x89dc('0xee')][_0x89dc('0xdc')]);_0x1abcdf['query']=_[_0x89dc('0xda')](_0x7bf630[_0x89dc('0x49')]);_0x1abcdf[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x1abcdf[_0x89dc('0xd9')],_0x1abcdf[_0x89dc('0x49')]);_0x251392[_0x89dc('0x4f')]=_[_0x89dc('0xdd')](_0x1abcdf[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x7bf630['query'][_0x89dc('0xe4')]));_0x251392['attributes']=_0x251392[_0x89dc('0x4f')]['length']?_0x251392[_0x89dc('0x4f')]:_0x1abcdf['model'];_0x251392[_0x89dc('0xde')]=qs['sort'](_0x7bf630[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x251392['where']=qs['filters'](_[_0x89dc('0xe1')](_0x7bf630[_0x89dc('0x49')],_0x1abcdf[_0x89dc('0xe0')]));if(_0x7bf630[_0x89dc('0x49')][_0x89dc('0x35')]){_0x251392[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x251392[_0x89dc('0x47')],{'$or':_['map'](_0x251392['attributes'],function(_0x596926){var _0x48abf0={};_0x48abf0[_0x596926]={'$like':'%'+_0x7bf630['query'][_0x89dc('0x35')]+'%'};return _0x48abf0;})});}_0x251392=_['merge']({},_0x251392,_0x7bf630[_0x89dc('0x5e')]);return _0xa8ba2f[_0x89dc('0xed')](_0x251392);}})[_0x89dc('0x1f')](function(_0x12c509){if(_0x12c509){_0x553a50=_0x12c509['length'];if(!_0x7bf630[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x251392[_0x89dc('0x1a')]=qs['limit'](_0x7bf630['query'][_0x89dc('0x1a')]);_0x251392[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x7bf630['query'][_0x89dc('0x19')]);}return _0xa8ba2f[_0x89dc('0xed')](_0x251392);}})[_0x89dc('0x1f')](function(_0x491180){if(_0x491180){return _0x491180?{'count':_0x553a50,'rows':_0x491180}:null;}})['then'](respondWithResult(_0x3b07fb,null))[_0x89dc('0x2a')](handleError(_0x3b07fb,null));};exports[_0x89dc('0xef')]=function(_0x441d00,_0x5968c8){var _0x19f0a1={'raw':!![],'where':{}};var _0x1e7800={};var _0x5499cb={'count':0x0,'rows':[]};return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x441d00[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x5968c8,null))[_0x89dc('0x1f')](function(_0x6a728f){if(_0x6a728f){_0x1e7800['model']=_[_0x89dc('0xda')](db[_0x89dc('0xf0')][_0x89dc('0xdc')]);_0x1e7800['query']=_['keys'](_0x441d00[_0x89dc('0x49')]);_0x1e7800[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x1e7800[_0x89dc('0xd9')],_0x1e7800[_0x89dc('0x49')]);_0x19f0a1['attributes']=_[_0x89dc('0xdd')](_0x1e7800[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x441d00['query'][_0x89dc('0xe4')]));_0x19f0a1[_0x89dc('0x4f')]=_0x19f0a1[_0x89dc('0x4f')]['length']?_0x19f0a1['attributes']:_0x1e7800['model'];if(!_0x441d00['query'][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x19f0a1[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x441d00[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x19f0a1['offset']=qs[_0x89dc('0x19')](_0x441d00[_0x89dc('0x49')][_0x89dc('0x19')]);}_0x19f0a1['order']=qs['sort'](_0x441d00[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x19f0a1[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_['pick'](_0x441d00[_0x89dc('0x49')],_0x1e7800[_0x89dc('0xe0')]));_0x19f0a1[_0x89dc('0x47')][_0x89dc('0xe8')]=_0x6a728f['id'];if(_0x441d00[_0x89dc('0x49')][_0x89dc('0x35')]){_0x19f0a1[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x19f0a1[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x19f0a1['attributes'],function(_0x3807a2){var _0x5a2faa={};_0x5a2faa[_0x3807a2]={'$like':'%'+_0x441d00['query'][_0x89dc('0x35')]+'%'};return _0x5a2faa;})});}_0x19f0a1=_[_0x89dc('0x5d')]({},_0x19f0a1,_0x441d00['options']);return db[_0x89dc('0xf0')][_0x89dc('0x18')]({'where':_0x19f0a1[_0x89dc('0x47')]})['then'](function(_0x8a8b73){_0x5499cb[_0x89dc('0x18')]=_0x8a8b73;if(_0x441d00[_0x89dc('0x49')][_0x89dc('0x4a')]){_0x19f0a1[_0x89dc('0x4b')]=[{'all':!![]}];}return db['MailInteraction'][_0x89dc('0x91')](_0x19f0a1);})[_0x89dc('0x1f')](function(_0x3fe222){_0x5499cb[_0x89dc('0x50')]=_0x3fe222;return _0x5499cb;});}})[_0x89dc('0x1f')](respondWithFilteredResult(_0x5968c8,_0x19f0a1))[_0x89dc('0x2a')](handleError(_0x5968c8,null));};exports[_0x89dc('0xf1')]=function(_0x553c55,_0x801f65){var _0x1a5d78={};var _0x5060a7={};var _0x3b3cf8;var _0x460cbe;return db[_0x89dc('0x48')]['findOne']({'where':{'id':_0x553c55[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x801f65,null))['then'](function(_0x2c76be){if(_0x2c76be){_0x3b3cf8=_0x2c76be;_0x5060a7[_0x89dc('0xd9')]=_['keys'](db[_0x89dc('0xf2')][_0x89dc('0xdc')]);_0x5060a7['query']=_[_0x89dc('0xda')](_0x553c55[_0x89dc('0x49')]);_0x5060a7[_0x89dc('0xe0')]=_['intersection'](_0x5060a7[_0x89dc('0xd9')],_0x5060a7['query']);_0x1a5d78[_0x89dc('0x4f')]=_[_0x89dc('0xdd')](_0x5060a7[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x553c55[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x1a5d78[_0x89dc('0x4f')]=_0x1a5d78[_0x89dc('0x4f')]['length']?_0x1a5d78[_0x89dc('0x4f')]:_0x5060a7[_0x89dc('0xd9')];_0x1a5d78['order']=qs[_0x89dc('0xdf')](_0x553c55[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x1a5d78[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x553c55[_0x89dc('0x49')],_0x5060a7[_0x89dc('0xe0')]));if(_0x553c55[_0x89dc('0x49')][_0x89dc('0x35')]){_0x1a5d78[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x1a5d78[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x1a5d78[_0x89dc('0x4f')],function(_0x380d6b){var _0xcf4b84={};_0xcf4b84[_0x380d6b]={'$like':'%'+_0x553c55[_0x89dc('0x49')]['filter']+'%'};return _0xcf4b84;})});}_0x1a5d78=_['merge']({},_0x1a5d78,_0x553c55['options']);return _0x3b3cf8['getSmsInteractions'](_0x1a5d78);}})[_0x89dc('0x1f')](function(_0x1434ac){if(_0x1434ac){_0x460cbe=_0x1434ac['length'];if(!_0x553c55['query'][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x1a5d78[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x553c55[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x1a5d78['offset']=qs[_0x89dc('0x19')](_0x553c55[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x3b3cf8[_0x89dc('0xf1')](_0x1a5d78);}})[_0x89dc('0x1f')](function(_0x233859){if(_0x233859){return _0x233859?{'count':_0x460cbe,'rows':_0x233859}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x801f65,null))[_0x89dc('0x2a')](handleError(_0x801f65,null));};exports[_0x89dc('0xf3')]=function(_0x19718e,_0x17cdfe){var _0x44c623={};var _0x1bbd7b={};var _0x3ba64b;var _0x4f52c0;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x19718e[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x17cdfe,null))[_0x89dc('0x1f')](function(_0x183034){if(_0x183034){_0x3ba64b=_0x183034;_0x1bbd7b[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0xf4')][_0x89dc('0xdc')]);_0x1bbd7b[_0x89dc('0x49')]=_['keys'](_0x19718e[_0x89dc('0x49')]);_0x1bbd7b[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x1bbd7b['model'],_0x1bbd7b[_0x89dc('0x49')]);_0x44c623['attributes']=_['intersection'](_0x1bbd7b['model'],qs[_0x89dc('0xe4')](_0x19718e[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x44c623[_0x89dc('0x4f')]=_0x44c623[_0x89dc('0x4f')][_0x89dc('0x52')]?_0x44c623[_0x89dc('0x4f')]:_0x1bbd7b[_0x89dc('0xd9')];_0x44c623[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x19718e['query']['sort']);_0x44c623[_0x89dc('0x47')]=qs['filters'](_[_0x89dc('0xe1')](_0x19718e['query'],_0x1bbd7b[_0x89dc('0xe0')]));if(_0x19718e[_0x89dc('0x49')][_0x89dc('0x35')]){_0x44c623[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x44c623['where'],{'$or':_[_0x89dc('0x36')](_0x44c623[_0x89dc('0x4f')],function(_0x292dd2){var _0x172202={};_0x172202[_0x292dd2]={'$like':'%'+_0x19718e[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0x172202;})});}_0x44c623=_[_0x89dc('0x5d')]({},_0x44c623,_0x19718e[_0x89dc('0x5e')]);return _0x3ba64b['getFaxInteractions'](_0x44c623);}})[_0x89dc('0x1f')](function(_0x216599){if(_0x216599){_0x4f52c0=_0x216599['length'];if(!_0x19718e[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x44c623[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x19718e['query'][_0x89dc('0x1a')]);_0x44c623['offset']=qs['offset'](_0x19718e[_0x89dc('0x49')]['offset']);}return _0x3ba64b[_0x89dc('0xf3')](_0x44c623);}})[_0x89dc('0x1f')](function(_0x57bf7e){if(_0x57bf7e){return _0x57bf7e?{'count':_0x4f52c0,'rows':_0x57bf7e}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x17cdfe,null))[_0x89dc('0x2a')](handleError(_0x17cdfe,null));};exports['getWhatsappInteractions']=function(_0x156cc2,_0x37552d){var _0x3bb690={};var _0x539bdd={};var _0x736336;var _0xc8d352;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x156cc2[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x37552d,null))[_0x89dc('0x1f')](function(_0xa086a1){if(_0xa086a1){_0x736336=_0xa086a1;_0x539bdd[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0xf5')]['rawAttributes']);_0x539bdd[_0x89dc('0x49')]=_['keys'](_0x156cc2['query']);_0x539bdd[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x539bdd['model'],_0x539bdd['query']);_0x3bb690[_0x89dc('0x4f')]=_['intersection'](_0x539bdd[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0x156cc2[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x3bb690[_0x89dc('0x4f')]=_0x3bb690[_0x89dc('0x4f')]['length']?_0x3bb690[_0x89dc('0x4f')]:_0x539bdd[_0x89dc('0xd9')];_0x3bb690[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x156cc2[_0x89dc('0x49')]['sort']);_0x3bb690['where']=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x156cc2['query'],_0x539bdd[_0x89dc('0xe0')]));if(_0x156cc2[_0x89dc('0x49')][_0x89dc('0x35')]){_0x3bb690['where']=_[_0x89dc('0x5d')](_0x3bb690['where'],{'$or':_[_0x89dc('0x36')](_0x3bb690[_0x89dc('0x4f')],function(_0x7203b6){var _0x576040={};_0x576040[_0x7203b6]={'$like':'%'+_0x156cc2[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0x576040;})});}_0x3bb690=_['merge']({},_0x3bb690,_0x156cc2[_0x89dc('0x5e')]);return _0x736336[_0x89dc('0xf6')](_0x3bb690);}})[_0x89dc('0x1f')](function(_0x22992e){if(_0x22992e){_0xc8d352=_0x22992e[_0x89dc('0x52')];if(!_0x156cc2[_0x89dc('0x49')][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x3bb690[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x156cc2[_0x89dc('0x49')]['limit']);_0x3bb690[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0x156cc2[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x736336[_0x89dc('0xf6')](_0x3bb690);}})[_0x89dc('0x1f')](function(_0x516890){if(_0x516890){return _0x516890?{'count':_0xc8d352,'rows':_0x516890}:null;}})['then'](respondWithResult(_0x37552d,null))['catch'](handleError(_0x37552d,null));};exports[_0x89dc('0xf7')]=function(_0x407b87,_0x266b2c,_0x407df0){var _0x2d1fc4;var _0x437d49;var _0x6277bf;var _0x9a96c2=!_['isNil'](_0x407b87[_0x89dc('0x5c')]['id'])?_0x407b87['params']['id']:!_[_0x89dc('0x69')](_0x407b87[_0x89dc('0x83')]['id'])?_0x407b87['user']['id']:null;return db[_0x89dc('0x48')][_0x89dc('0x39')]({'where':{'id':_0x9a96c2,'role':{'$or':[_0x89dc('0x84'),'user',_0x89dc('0x33')]}},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0xf8'),'mobile',_0x89dc('0x2c'),_0x89dc('0x64'),_0x89dc('0xa3')]})[_0x89dc('0x1f')](function(_0xdcae16){if(_0xdcae16){if(_0xdcae16[_0x89dc('0x2c')]===_0x89dc('0x33')){_0x2d1fc4=_0xdcae16;if(_0x407b87[_0x89dc('0x5f')][_0x89dc('0xa4')]){_0x6277bf=util['format'](_0x89dc('0xf9'),_0x2d1fc4[_0x407b87[_0x89dc('0x5f')][_0x89dc('0xa4')]]);}else if(_0x407b87['body']['intrf']){_0x6277bf=util[_0x89dc('0xb0')](_0x89dc('0xb1'),_0x407b87[_0x89dc('0x5f')][_0x89dc('0xfa')]);}else{_0x6277bf=util[_0x89dc('0xb0')](_0x89dc('0xb1'),_0x2d1fc4[_0x89dc('0x3a')]);}socket['to'](util[_0x89dc('0xb0')]('user:%s',_0x2d1fc4[_0x89dc('0x3a')]))[_0x89dc('0x2d')](_0x89dc('0xfb'),{'user':{'id':_0x2d1fc4['id'],'name':_0x2d1fc4[_0x89dc('0x3a')]},'ip':_0x407b87[_0x89dc('0xfc')][_0x89dc('0xfd')]||_0x407b87[_0x89dc('0xfe')]['remoteAddress']||_0x407b87[_0x89dc('0xff')][_0x89dc('0x100')]||_0x407b87[_0x89dc('0xfe')][_0x89dc('0xff')][_0x89dc('0x100')]});return db[_0x89dc('0xb3')][_0x89dc('0x2f')]({'where':{'membername':_0x2d1fc4[_0x89dc('0x3a')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x89dc('0x96'))](_0x89dc('0x101'));}})[_0x89dc('0x1f')](function(){if(_0x2d1fc4){return _0x2d1fc4[_0x89dc('0x102')]({'raw':!![]});}})[_0x89dc('0x1f')](function(_0x1b6509){if(_0x2d1fc4){if(_0x1b6509){_0x437d49=_0x1b6509;if(_0x437d49[_0x89dc('0x52')]){var _0x4c9d65=_0x437d49[_0x89dc('0x36')](function(_0x3fae37){var _0x32af75={'membername':_0x2d1fc4['name'],'UserId':_0x2d1fc4['id'],'queue_name':_0x3fae37[_0x89dc('0x3a')],'VoiceQueueId':_0x3fae37['id'],'interface':_0x6277bf,'paused':_0x2d1fc4[_0x89dc('0xa3')]||![],'penalty':_0x3fae37[_0x89dc('0x103')]||0x0};return db[_0x89dc('0xb3')][_0x89dc('0xb4')](_0x32af75);});return Promise['all'](_0x4c9d65);}}}})[_0x89dc('0x1f')](function(){if(_0x2d1fc4){return db[_0x89dc('0x104')]['findAll']({'where':{'membername':_0x2d1fc4[_0x89dc('0x3a')],'exitAt':null}});}})[_0x89dc('0x1f')](function(_0x5e592e){if(_0x2d1fc4){var _0x5bc4a8=[];_0x5e592e[_0x89dc('0x105')](function(_0x14b27a){_0x5bc4a8[_0x89dc('0x53')](_0x14b27a[_0x89dc('0x2b')]({'exitAt':moment()[_0x89dc('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x89dc('0x5a')](_0x5bc4a8);}})[_0x89dc('0x1f')](function(){if(_0x2d1fc4){var _0x25aa55=[];var _0x1fcb9d=[];var _0x5a3cb4=utils[_0x89dc('0x106')]();var _0x178e77={'membername':_0x2d1fc4['name'],'interface':_0x6277bf,'enterAt':moment()[_0x89dc('0xb0')](_0x89dc('0x107')),'role':_0x2d1fc4[_0x89dc('0x2c')],'internal':_0x2d1fc4[_0x89dc('0x64')]};_0x5a3cb4[_0x89dc('0x105')](function(_0x45a5e7){_0x25aa55[_0x89dc('0x53')](_['merge']({'channel':_0x45a5e7,'type':_0x89dc('0x108'),'data1':_0x407b87['body'][_0x89dc('0x109')],'data2':_0x6277bf},_0x178e77));if(_0x2d1fc4[_0x89dc('0xa3')]){_0x1fcb9d[_0x89dc('0x53')](_[_0x89dc('0x5d')]({'channel':_0x45a5e7,'type':_0x89dc('0x10a'),'data1':'LOGININPAUSE'},_0x178e77));}});return db['MemberReport'][_0x89dc('0x8c')](_0x25aa55[_0x89dc('0xcf')](_0x1fcb9d),{'individualHooks':!![]});}})[_0x89dc('0x1f')](function(){if(_0x2d1fc4){return _0x2d1fc4[_0x89dc('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x89dc('0xb0')](_0x89dc('0x107')),'voicePause':_0x2d1fc4[_0x89dc('0xa3')]||![],'mailPause':_0x2d1fc4[_0x89dc('0xa3')]||![],'chatPause':_0x2d1fc4['loginInPause']||![],'faxPause':_0x2d1fc4[_0x89dc('0xa3')]||![],'smsPause':_0x2d1fc4[_0x89dc('0xa3')]||![],'openchannelPause':_0x2d1fc4[_0x89dc('0xa3')]||![],'whatsappPause':_0x2d1fc4[_0x89dc('0xa3')]||![],'pauseType':_0x2d1fc4[_0x89dc('0xa3')]?_0x89dc('0x10b'):null,'interface':_0x6277bf,'lastPauseAt':moment()['format'](_0x89dc('0x107'))});}})[_0x89dc('0x1f')](function(_0xd04e70){if(_0x407b87[_0x89dc('0x10c')]){return _0x407df0();}else{return Promise[_0x89dc('0x10d')](_0xd04e70)[_0x89dc('0x1f')](respondWithResult(_0x266b2c,null));}})['catch'](handleError(_0x266b2c,null));};exports[_0x89dc('0x10e')]=function(_0x30e8a2,_0x2d6cd0){var _0x59b235;return db['User'][_0x89dc('0x39')]({'where':{'id':_0x30e8a2[_0x89dc('0x5c')]['id'],'role':'agent'},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0x2c')]})[_0x89dc('0x1f')](handleEntityNotFound(_0x2d6cd0,null))[_0x89dc('0x1f')](function(_0xc75b58){if(_0xc75b58){_0x59b235=_0xc75b58;return db[_0x89dc('0xb3')]['destroy']({'where':{'membername':_0x59b235[_0x89dc('0x3a')]},'individualHooks':!![]});}})[_0x89dc('0x1f')](function(){return db['MemberReport'][_0x89dc('0x91')]({'where':{'membername':_0x59b235[_0x89dc('0x3a')],'exitAt':null}});})[_0x89dc('0x1f')](function(_0x37f84c){var _0x2d474a=[];_0x37f84c['forEach'](function(_0x40f942){_0x2d474a['push'](_0x40f942[_0x89dc('0x2b')]({'exitAt':moment()[_0x89dc('0xb0')](_0x89dc('0x107'))}));});return Promise['all'](_0x2d474a);})[_0x89dc('0x1f')](function(){return _0x59b235['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2d6cd0,null))[_0x89dc('0x2a')](handleError(_0x2d6cd0,null));};exports[_0x89dc('0x10f')]=function(_0x431c22,_0x56af56){var _0x455ab6;return db[_0x89dc('0xb3')][_0x89dc('0x2b')]({'paused':0x1},{'where':{'UserId':_0x431c22['params']['id']},'individualHooks':!![]})[_0x89dc('0x1f')](function(){return db[_0x89dc('0x48')][_0x89dc('0x39')]({'where':{'id':_0x431c22['params']['id'],'role':_0x89dc('0x33')},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0x2c'),_0x89dc('0x64'),_0x89dc('0xa4'),_0x89dc('0xa2')]});})[_0x89dc('0x1f')](handleEntityNotFound(_0x56af56,null))['then'](function(_0x2d6fc8){if(_0x2d6fc8){_0x455ab6=_0x2d6fc8;return respondWithRpcPromise(_0x89dc('0x110'),'pause',{'id':_0x455ab6['id'],'name':_0x455ab6[_0x89dc('0x3a')],'pause':!![]});}})[_0x89dc('0x1f')](function(){if(_0x455ab6){return db[_0x89dc('0x104')]['findAll']({'where':{'membername':_0x455ab6[_0x89dc('0x3a')],'type':'PAUSE','exitAt':null}});}})[_0x89dc('0x1f')](function(_0x751d5a){if(_0x751d5a[_0x89dc('0x52')]){var _0x42c9ad=moment()[_0x89dc('0xb0')](_0x89dc('0x107'));for(var _0x5a5500=0x0,_0x18f42b=_0x751d5a[_0x89dc('0x52')];_0x5a5500<_0x18f42b;_0x5a5500++){_0x751d5a[_0x5a5500][_0x89dc('0x111')]({'exitAt':_0x42c9ad});}}})[_0x89dc('0x1f')](function(){var _0x4be42f=[];var _0x464e6b=utils[_0x89dc('0x106')]();_0x464e6b[_0x89dc('0x105')](function(_0x52f78e){_0x4be42f['push']({'channel':_0x52f78e,'membername':_0x455ab6[_0x89dc('0x3a')],'interface':_['isNil'](_0x455ab6[_0x89dc('0xa4')])?util[_0x89dc('0xb0')](_0x89dc('0xb1'),_0x455ab6[_0x89dc('0x3a')]):_0x455ab6[_0x89dc('0xa4')],'type':_0x89dc('0x10a'),'enterAt':moment()['format'](_0x89dc('0x107')),'data1':_0x431c22[_0x89dc('0x5f')][_0x89dc('0x112')]||_0x89dc('0x113'),'role':_0x455ab6['role'],'internal':_0x455ab6[_0x89dc('0x64')]});});return db[_0x89dc('0x104')][_0x89dc('0x8c')](_0x4be42f,{'individualHooks':!![]});})['then'](function(){return _0x455ab6[_0x89dc('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x431c22[_0x89dc('0x5f')][_0x89dc('0x112')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x89dc('0xb0')](_0x89dc('0x107'))});})[_0x89dc('0x1f')](respondWithResult(_0x56af56,null))[_0x89dc('0x2a')](handleError(_0x56af56,null));};exports[_0x89dc('0x114')]=function(_0x20504c,_0x267c4e){if(_0x20504c['body'][_0x89dc('0xa1')]&&!utils[_0x89dc('0xa5')](_0x20504c[_0x89dc('0x5f')]['channel'])){throw new APIBadRequestError(util[_0x89dc('0xb0')](_0x89dc('0x115'),_0x20504c[_0x89dc('0x5f')][_0x89dc('0xa1')]));}return db[_0x89dc('0x48')]['find']({'where':{'id':_0x20504c[_0x89dc('0x5c')]['id']},'attributes':['id',_0x89dc('0x3a'),_0x89dc('0x2c'),_0x89dc('0x64'),'interface',_0x89dc('0xa2'),_0x89dc('0xb2'),_0x89dc('0x116'),'chatPause',_0x89dc('0x117'),_0x89dc('0x118'),_0x89dc('0x119'),'whatsappPause','pauseType','lastPauseAt']})[_0x89dc('0x1f')](function(_0x34b679){if(!_0x34b679){throw new APINotFoundError(util[_0x89dc('0xb0')](_0x89dc('0xd2'),_0x20504c[_0x89dc('0x5c')]['id']));}return _0x34b679[_0x89dc('0x114')](_0x20504c[_0x89dc('0x5f')]['channel']);})[_0x89dc('0x1f')](respondWithResult(_0x267c4e,null))[_0x89dc('0x2a')](APIHandleError(_0x267c4e));};exports[_0x89dc('0x11a')]=function(_0x19582a,_0x1e683c){var _0x175b0b={};var _0x4d2b56={};var _0x53ddbb;var _0x21add3;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x19582a[_0x89dc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1e683c,null))[_0x89dc('0x1f')](function(_0x31dcca){if(_0x31dcca){_0x53ddbb=_0x31dcca;_0x4d2b56['model']=_['keys'](db[_0x89dc('0x11b')][_0x89dc('0xdc')]);_0x4d2b56[_0x89dc('0x49')]=_['keys'](_0x19582a['query']);_0x4d2b56['filters']=_[_0x89dc('0xdd')](_0x4d2b56['model'],_0x4d2b56[_0x89dc('0x49')]);_0x175b0b['attributes']=_[_0x89dc('0xdd')](_0x4d2b56[_0x89dc('0xd9')],qs['fields'](_0x19582a[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x175b0b[_0x89dc('0x4f')]=_0x175b0b['attributes'][_0x89dc('0x52')]?_0x175b0b[_0x89dc('0x4f')]:_0x4d2b56['model'];_0x175b0b['order']=qs[_0x89dc('0xdf')](_0x19582a['query'][_0x89dc('0xdf')]);_0x175b0b[_0x89dc('0x47')]=qs['filters'](_[_0x89dc('0xe1')](_0x19582a[_0x89dc('0x49')],_0x4d2b56[_0x89dc('0xe0')]));if(_0x19582a[_0x89dc('0x49')][_0x89dc('0x35')]){_0x175b0b[_0x89dc('0x47')]=_['merge'](_0x175b0b[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x175b0b['attributes'],function(_0x20b3eb){var _0xd2d1c={};_0xd2d1c[_0x20b3eb]={'$like':'%'+_0x19582a[_0x89dc('0x49')][_0x89dc('0x35')]+'%'};return _0xd2d1c;})});}_0x175b0b=_[_0x89dc('0x5d')]({},_0x175b0b,_0x19582a['options']);return _0x53ddbb['getTeams'](_0x175b0b);}})[_0x89dc('0x1f')](function(_0x4a3677){if(_0x4a3677){_0x21add3=_0x4a3677[_0x89dc('0x52')];if(!_0x19582a['query'][_0x89dc('0xd3')](_0x89dc('0xe2'))){_0x175b0b[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0x19582a[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x175b0b['offset']=qs['offset'](_0x19582a[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x53ddbb[_0x89dc('0x11a')](_0x175b0b);}})[_0x89dc('0x1f')](function(_0x4f3717){if(_0x4f3717){return _0x4f3717?{'count':_0x21add3,'rows':_0x4f3717}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x1e683c,null))[_0x89dc('0x2a')](handleError(_0x1e683c,null));};exports[_0x89dc('0x11c')]=function(_0x504f12,_0x1ebc5f){var _0x101dbb=_0x504f12[_0x89dc('0x5c')]['id'];var _0x1c592a=_0x504f12[_0x89dc('0x5f')]?_0x504f12[_0x89dc('0x5f')][_0x89dc('0x62')]:null;var _0x583bf4=[];return Promise['resolve']()['then'](function(){if(!_0x1c592a)throw new APIBadRequestError(_0x89dc('0x11d'));})[_0x89dc('0x1f')](function(){return db[_0x89dc('0x48')]['findOne']({'where':{'id':_0x101dbb}});})[_0x89dc('0x1f')](function(_0x326cb2){if(!_0x326cb2)throw new APINotFoundError(util[_0x89dc('0xb0')](_0x89dc('0xd2'),_0x504f12['params']['id']));return db[_0x89dc('0x6b')][_0x89dc('0x11e')](function(_0x1df5c8){return _0x326cb2[_0x89dc('0x11c')](_0x1c592a,{'transaction':_0x1df5c8})['then'](function(){return db['Team'][_0x89dc('0x91')]({'where':{'id':{'$in':_0x1c592a}}});})[_0x89dc('0x1f')](function(_0x44462f){var _0x478612=_[_0x89dc('0x36')](_0x44462f,function(_0x15b505){return _0x15b505[_0x89dc('0x11f')]();});return Promise[_0x89dc('0x5a')](_0x478612);})['then'](function(_0x4dd152){_0x583bf4=_[_0x89dc('0x120')](_0x4dd152);var _0x5da2c8=_[_0x89dc('0x36')](_0x583bf4,function(_0x48ea33){return _0x48ea33[_0x89dc('0x121')](_0x326cb2['id'],{'transaction':_0x1df5c8});});return Promise['all'](_0x5da2c8);})[_0x89dc('0x1f')](function(){if(!_0x326cb2['online'])return;var _0x327512=_[_0x89dc('0x35')](_0x583bf4,function(_0x1d7844){return _0x1d7844[_0x89dc('0x122')](_0x89dc('0xa1'))===_0x89dc('0x123');});var _0x25e8b6=_[_0x89dc('0x36')](_0x327512,function(_0x17cf0f){return db[_0x89dc('0xb3')][_0x89dc('0xb4')]({'membername':_0x326cb2[_0x89dc('0x3a')],'UserId':_0x326cb2['id'],'queue_name':_0x17cf0f[_0x89dc('0x3a')],'VoiceQueueId':_0x17cf0f['id'],'interface':_['isNil'](_0x326cb2[_0x89dc('0xa4')])?util[_0x89dc('0xb0')](_0x89dc('0xb1'),_0x326cb2[_0x89dc('0x3a')]):_0x326cb2[_0x89dc('0xa4')],'paused':_0x326cb2[_0x89dc('0xb2')]||![],'penalty':_0x326cb2[_0x89dc('0xa9')]},{'transaction':_0x1df5c8});});return Promise['all'](_0x25e8b6);})[_0x89dc('0x1f')](function(){return db[_0x89dc('0x124')][_0x89dc('0x91')]({'where':{'teamId':{'$in':_0x1c592a}}});})[_0x89dc('0x1f')](function(_0x216bfa){var _0xe79db8=_['map'](_0x216bfa,function(_0x354f30){return db[_0x89dc('0x125')][_0x89dc('0x8f')]({'UserId':_0x326cb2['id'],'VoicePrefixId':_0x354f30[_0x89dc('0x126')]},{'transaction':_0x1df5c8});});return Promise[_0x89dc('0x5a')](_0xe79db8);});});})[_0x89dc('0x1f')](function(){for(var _0x438897=0x0;_0x438897<_0x583bf4[_0x89dc('0x52')];_0x438897++){var _0x37ac13=_0x583bf4[_0x438897][_0x89dc('0x122')](_0x89dc('0xa1'));var _0x5bd3ef=_0x37ac13+_0x89dc('0xab');socket[_0x89dc('0x2d')](_0x89dc('0x83')+_0x37ac13+_0x89dc('0xad'),{'UserId':_0x101dbb,['queueField']:_0x583bf4[_0x438897]['id']});}})[_0x89dc('0x1f')](respondWithStatusCode(_0x1ebc5f,null))[_0x89dc('0x2a')](APIHandleError(_0x1ebc5f));};exports['removeTeams']=function(_0x185931,_0x48d67d){var _0x285a89=_0x185931[_0x89dc('0x5c')]['id'];var _0x41ddd9=null;if(_0x185931[_0x89dc('0x49')][_0x89dc('0x62')]){_0x41ddd9=_[_0x89dc('0x127')](_0x185931['query'][_0x89dc('0x62')])?_0x185931['query'][_0x89dc('0x62')]:[_0x185931[_0x89dc('0x49')][_0x89dc('0x62')]];}var _0x16951d=[];return Promise[_0x89dc('0x10d')]()[_0x89dc('0x1f')](function(){if(!_0x41ddd9)throw new APIBadRequestError(_0x89dc('0x128'));})['then'](function(){return db['User'][_0x89dc('0xd1')]({'where':{'id':_0x285a89}});})[_0x89dc('0x1f')](function(_0x6f8eed){if(!_0x6f8eed)throw new APINotFoundError(util['format'](_0x89dc('0xd2'),_0x185931[_0x89dc('0x5c')]['id']));return db[_0x89dc('0x6b')][_0x89dc('0x11e')](function(_0x206ce8){return _0x6f8eed[_0x89dc('0x129')](_0x41ddd9,{'transaction':_0x206ce8})[_0x89dc('0x1f')](function(){return db[_0x89dc('0x11b')][_0x89dc('0x91')]({'where':{'id':{'$in':_0x41ddd9}}});})[_0x89dc('0x1f')](function(_0x34edda){var _0x5cb5f1=_[_0x89dc('0x36')](_0x34edda,function(_0x497dc2){return _0x497dc2['getAssociatedQueues']();});return Promise[_0x89dc('0x5a')](_0x5cb5f1);})[_0x89dc('0x1f')](function(_0x487760){_0x16951d=_['flattenDeep'](_0x487760);var _0x4efb7d=_[_0x89dc('0x36')](_0x16951d,function(_0x4f6aa2){return _0x4f6aa2[_0x89dc('0x12a')](_0x6f8eed['id'],{'transaction':_0x206ce8});});return Promise['all'](_0x4efb7d);})['then'](function(){if(!_0x6f8eed[_0x89dc('0xa2')])return;var _0x368e0a=_[_0x89dc('0x35')](_0x16951d,function(_0x1fd39f){return _0x1fd39f[_0x89dc('0x122')](_0x89dc('0xa1'))===_0x89dc('0x123');});var _0x546f21=_['map'](_0x368e0a,function(_0x2ebcfe){return db[_0x89dc('0xb3')]['destroy']({'where':{'VoiceQueueId':_0x2ebcfe['id'],'UserId':_0x6f8eed['id']},'transaction':_0x206ce8});});return Promise[_0x89dc('0x5a')](_0x546f21);})['then'](function(){return db['TeamVoicePrefix'][_0x89dc('0x91')]({'where':{'teamId':{'$in':_0x41ddd9}}});})[_0x89dc('0x1f')](function(_0x4c968e){var _0x1c8d30=_[_0x89dc('0x36')](_0x4c968e,function(_0x1aa226){return db[_0x89dc('0x125')][_0x89dc('0x2f')]({'where':{'UserId':_0x6f8eed['id'],'VoicePrefixId':_0x1aa226[_0x89dc('0x126')]}},{'transaction':_0x206ce8});});return Promise[_0x89dc('0x5a')](_0x1c8d30);});});})['then'](function(){for(var _0xea6e32=0x0;_0xea6e32<_0x16951d[_0x89dc('0x52')];_0xea6e32++){var _0x5e6969=_0x16951d[_0xea6e32][_0x89dc('0x122')](_0x89dc('0xa1'));var _0x4c71ef=_0x5e6969+'QueueId';socket[_0x89dc('0x2d')](_0x89dc('0x83')+_0x5e6969+_0x89dc('0xb8'),{'UserId':_0x285a89,['queueField']:_0x16951d[_0xea6e32]['id']});}})[_0x89dc('0x1f')](respondWithStatusCode(_0x48d67d,null))[_0x89dc('0x2a')](APIHandleError(_0x48d67d));};exports['getLists']=function(_0xddc342,_0x565aee){var _0x1d3803={};var _0x3f34c3={};var _0x550a7c;var _0x5a15d4;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0xddc342[_0x89dc('0x5c')]['id']}})[_0x89dc('0x1f')](handleEntityNotFound(_0x565aee,null))['then'](function(_0x329398){if(_0x329398){_0x550a7c=_0x329398;_0x3f34c3[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0xd4')][_0x89dc('0xdc')]);_0x3f34c3['query']=_[_0x89dc('0xda')](_0xddc342['query']);_0x3f34c3[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x3f34c3[_0x89dc('0xd9')],_0x3f34c3['query']);_0x1d3803['attributes']=_['intersection'](_0x3f34c3[_0x89dc('0xd9')],qs[_0x89dc('0xe4')](_0xddc342[_0x89dc('0x49')][_0x89dc('0xe4')]));_0x1d3803['attributes']=_0x1d3803[_0x89dc('0x4f')][_0x89dc('0x52')]?_0x1d3803[_0x89dc('0x4f')]:_0x3f34c3['model'];_0x1d3803[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0xddc342[_0x89dc('0x49')][_0x89dc('0xdf')]);_0x1d3803['where']=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0xddc342[_0x89dc('0x49')],_0x3f34c3['filters']));if(_0xddc342['query'][_0x89dc('0x35')]){_0x1d3803['where']=_['merge'](_0x1d3803[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x1d3803[_0x89dc('0x4f')],function(_0x162e77){var _0x10973a={};_0x10973a[_0x162e77]={'$like':'%'+_0xddc342['query'][_0x89dc('0x35')]+'%'};return _0x10973a;})});}_0x1d3803=_[_0x89dc('0x5d')]({},_0x1d3803,_0xddc342[_0x89dc('0x5e')]);return _0x550a7c[_0x89dc('0x12b')](_0x1d3803);}})[_0x89dc('0x1f')](function(_0x1d823f){if(_0x1d823f){_0x5a15d4=_0x1d823f[_0x89dc('0x52')];if(!_0xddc342[_0x89dc('0x49')]['hasOwnProperty'](_0x89dc('0xe2'))){_0x1d3803[_0x89dc('0x1a')]=qs[_0x89dc('0x1a')](_0xddc342[_0x89dc('0x49')][_0x89dc('0x1a')]);_0x1d3803[_0x89dc('0x19')]=qs[_0x89dc('0x19')](_0xddc342[_0x89dc('0x49')][_0x89dc('0x19')]);}return _0x550a7c[_0x89dc('0x12b')](_0x1d3803);}})['then'](function(_0x4e4be0){if(_0x4e4be0){return _0x4e4be0?{'count':_0x5a15d4,'rows':_0x4e4be0}:null;}})[_0x89dc('0x1f')](respondWithResult(_0x565aee,null))[_0x89dc('0x2a')](handleError(_0x565aee,null));};exports[_0x89dc('0x12c')]=function(_0x273013,_0x4d5af9){var _0x57175d={};var _0x542023={};var _0x4372fb;return db[_0x89dc('0x48')][_0x89dc('0xd1')]({'where':{'id':_0x273013[_0x89dc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d5af9,null))[_0x89dc('0x1f')](function(_0x296d43){if(_0x296d43){_0x4372fb=_0x296d43;_0x542023[_0x89dc('0xd9')]=_[_0x89dc('0xda')](db[_0x89dc('0x48')][_0x89dc('0xdc')]);_0x542023[_0x89dc('0x49')]=_[_0x89dc('0xda')](_0x273013[_0x89dc('0x49')]);_0x542023[_0x89dc('0xe0')]=_[_0x89dc('0xdd')](_0x542023[_0x89dc('0xd9')],_0x542023['query']);_0x57175d['attributes']=_['intersection'](_0x542023['model'],qs['fields'](_0x273013[_0x89dc('0x49')]['fields']));_0x57175d[_0x89dc('0x4f')]=_0x57175d['attributes'][_0x89dc('0x52')]?_0x57175d[_0x89dc('0x4f')]:_0x542023[_0x89dc('0xd9')];_0x57175d[_0x89dc('0xde')]=qs[_0x89dc('0xdf')](_0x273013['query'][_0x89dc('0xdf')]);_0x57175d[_0x89dc('0x47')]=qs[_0x89dc('0xe0')](_[_0x89dc('0xe1')](_0x273013[_0x89dc('0x49')],_0x542023[_0x89dc('0xe0')]));if(_0x273013['query']['filter']){_0x57175d[_0x89dc('0x47')]=_[_0x89dc('0x5d')](_0x57175d[_0x89dc('0x47')],{'$or':_[_0x89dc('0x36')](_0x57175d[_0x89dc('0x4f')],function(_0x3207ba){var _0x571502={};_0x571502[_0x3207ba]={'$like':'%'+_0x273013[_0x89dc('0x49')]['filter']+'%'};return _0x571502;})});}_0x57175d[_0x89dc('0xd9')]=db[_0x89dc('0x48')];_0x57175d['as']=_0x89dc('0x32');_0x57175d=_[_0x89dc('0x5d')]({},_0x57175d,_0x273013[_0x89dc('0x5e')]);return _0x4372fb[_0x89dc('0x102')]({'include':[_0x57175d]});}})['then'](function(_0x14d523){if(_0x14d523){var _0x41f120={},_0xa174cb=[];for(var _0x46949b=0x0;_0x46949b<_0x14d523[_0x89dc('0x52')];_0x46949b+=0x1){for(var _0x226441=0x0,_0x3af944;_0x226441<_0x14d523[_0x46949b]['Agents'][_0x89dc('0x52')];_0x226441+=0x1){_0x3af944=_0x14d523[_0x46949b][_0x89dc('0x32')][_0x226441][_0x89dc('0x30')]({'plain':!![]});_0x41f120[_0x3af944['id']]=_0x3af944;}}_0x41f120=_[_0x89dc('0x12d')](_0x41f120);for(var _0x26e257=qs[_0x89dc('0x19')](_0x273013['query']['offset']);_0x26e257<_0x41f120['length']&&_0xa174cb['length']=_0x14f76a){_0x150f01=_0x14f76a;_0x1cae39=0xc8;}else{_0x1cae39=0xce;}_0x30c21c[_0x84a6('0x16')](_0x1cae39);return _0x30c21c[_0x84a6('0x1d')](_0x84a6('0x1e'),_0x3a15e5+'-'+_0x150f01+'/'+_0x14f76a)['json'](_0x2e047c);}return null;};}function respondWithRpcPromise(_0x6e5c0d,_0x451750,_0x1cdc19,_0x1cdc1a){return new Promise(function(_0x28081b,_0x2eecdb){var _0x59e933=_0x1cdc1a||amiClient;return _0x59e933[_0x84a6('0x1f')](_0x6e5c0d,_0x1cdc19)['then'](function(_0x3fd4f7){logger[_0x84a6('0x20')](_0x84a6('0x21'),_0x451750,'request\x20sent');logger[_0x84a6('0x22')](_0x84a6('0x23'),_0x451750,_0x84a6('0x24'),JSON[_0x84a6('0x25')](_0x3fd4f7));if(_0x3fd4f7['error']){if(_0x3fd4f7[_0x84a6('0x26')][_0x84a6('0x27')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x451750,_0x3fd4f7[_0x84a6('0x26')][_0x84a6('0x28')]);return _0x2eecdb(_0x3fd4f7['error']['message']);}logger['error'](_0x84a6('0x21'),_0x451750,_0x3fd4f7[_0x84a6('0x26')][_0x84a6('0x28')]);return _0x28081b(_0x3fd4f7[_0x84a6('0x26')][_0x84a6('0x28')]);}else{logger['info'](_0x84a6('0x21'),_0x451750,'request\x20sent');_0x28081b(_0x3fd4f7['result'][_0x84a6('0x28')]);}})[_0x84a6('0x29')](function(_0x1b7fec){logger['error'](_0x84a6('0x21'),_0x451750,_0x1b7fec);_0x2eecdb(_0x1b7fec);});});}function saveUpdates(_0x350da8){return function(_0x188990){if(_0x188990){return _0x188990[_0x84a6('0x2a')](_0x350da8)[_0x84a6('0x2b')](function(_0x32a3ad){if(_0x32a3ad[_0x84a6('0x2c')]===_0x84a6('0x2d')){socket[_0x84a6('0x2e')]('userNotification:recalc:'+_0x32a3ad['id'],_0x32a3ad);}return _0x32a3ad;});}return null;};}function removeEntity(_0x4edcc6,_0x5463d0){return function(_0x37b514){if(_0x37b514){return _0x37b514[_0x84a6('0x2f')]({'transaction':_0x5463d0})[_0x84a6('0x2b')](function(){var _0x37cf19=_0x37b514['get']({'plain':!![]});if(_0x37cf19[_0x84a6('0x2c')]===_0x84a6('0x30'))return;var _0x51896c=[{'name':_0x84a6('0x31'),'value':_0x84a6('0x32'),'ignore':!![]},{'name':'Agents','value':_0x84a6('0x2d'),'ignore':![]},{'name':'Telephones','value':_0x84a6('0x33'),'ignore':![]}];var _0x32d2c5=_(_0x51896c)[_0x84a6('0x34')](_0x84a6('0x35'))[_0x84a6('0x36')](_0x84a6('0x37'))[_0x84a6('0x37')]();if(_[_0x84a6('0x38')](_0x32d2c5,_0x37cf19[_0x84a6('0x2c')])){return;}var _0x3401eb=_[_0x84a6('0x39')](_0x51896c,[_0x84a6('0x37'),_0x37cf19['role']])[_0x84a6('0x3a')];return db[_0x84a6('0x3b')][_0x84a6('0x2f')]({'where':{'type':_0x3401eb,'resourceId':_0x37cf19['id']},'transaction':_0x5463d0})[_0x84a6('0x2b')](function(){return _0x37b514;});})[_0x84a6('0x2b')](function(){_0x4edcc6['status'](0xcc)[_0x84a6('0x17')]();});}};}function handleEntityNotFound(_0xfb50f8){return function(_0x1b20d3){if(!_0x1b20d3){_0xfb50f8['sendStatus'](0x194);}return _0x1b20d3;};}function handleError(_0x3f9488,_0x3ba584){_0x3ba584=_0x3ba584||0x1f4;return function(_0x421ebd){logger[_0x84a6('0x26')](_0x421ebd[_0x84a6('0x3c')]);if(_0x421ebd[_0x84a6('0x3a')]){delete _0x421ebd[_0x84a6('0x3a')];}_0x3f9488[_0x84a6('0x16')](_0x3ba584)['send'](_0x421ebd);};}function getUserAttributes(){return _(db[_0x84a6('0x3d')][_0x84a6('0x3e')])['map'](function(_0x254bec){return{'name':_0x254bec[_0x84a6('0x3f')],'type':_0x254bec['type'][_0x84a6('0x40')]};})['filter'](function(_0x2adbf6){return!['password',_0x84a6('0x41'),_0x84a6('0x42'),_0x84a6('0x43'),_0x84a6('0x44'),'md5secret']['includes'](_0x2adbf6[_0x84a6('0x3a')]);})[_0x84a6('0x37')]();}exports[_0x84a6('0x45')]=function(_0x16207d,_0xa16e00){var _0x2051d1={},_0x4713f0={'count':0x0,'rows':[]};var _0x269c38=getUserAttributes();_0x2051d1=qs[_0x84a6('0x46')](_0x269c38,_0x16207d);var _0x18ce51={'where':_0x2051d1['where']};return db[_0x84a6('0x3d')][_0x84a6('0x1c')](_0x18ce51)['then'](function(_0x3501ec){_0x4713f0[_0x84a6('0x1c')]=_0x3501ec;if(_0x16207d[_0x84a6('0x47')]['includeAll']){_0x2051d1['include']=[{'all':!![]}];}if(_0x16207d[_0x84a6('0x47')][_0x84a6('0x48')]===_0x84a6('0x49')){_0x2051d1['include']=[{'model':db[_0x84a6('0x4a')],'as':'userSetting'}];}if(!_[_0x84a6('0x38')](_0x2051d1[_0x84a6('0x4b')],'id')){_0x2051d1[_0x84a6('0x4b')][_0x84a6('0x4c')]('id');}return db['User'][_0x84a6('0x4d')](_0x2051d1);})[_0x84a6('0x2b')](function(_0xe6b155){_0x4713f0[_0x84a6('0x4e')]=_0xe6b155;if(_0x16207d[_0x84a6('0x47')][_0x84a6('0x4f')]===_0x84a6('0x49')){var _0x3da1d1=[];for(var _0x47332d=0x0;_0x47332d<_0x4713f0['rows'][_0x84a6('0x50')];_0x47332d++){_0x3da1d1[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x51'),_0x4713f0[_0x84a6('0x4e')][_0x47332d][_0x84a6('0x52')]));_0x3da1d1['push'](get_open_tabs(_0x84a6('0x53'),_0x4713f0[_0x84a6('0x4e')][_0x47332d]['dataValues']));_0x3da1d1[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x54'),_0x4713f0[_0x84a6('0x4e')][_0x47332d][_0x84a6('0x52')]));_0x3da1d1[_0x84a6('0x4c')](get_open_tabs('mail',_0x4713f0[_0x84a6('0x4e')][_0x47332d][_0x84a6('0x52')]));_0x3da1d1['push'](get_open_tabs(_0x84a6('0x55'),_0x4713f0['rows'][_0x47332d][_0x84a6('0x52')]));_0x3da1d1[_0x84a6('0x4c')](get_open_tabs('whatsapp',_0x4713f0['rows'][_0x47332d][_0x84a6('0x52')]));}return Promise[_0x84a6('0x56')](_0x3da1d1)[_0x84a6('0x2b')](function(){return _0x4713f0;});}else{return _0x4713f0;}})['then'](respondWithFilteredResult(_0xa16e00,_0x2051d1))[_0x84a6('0x29')](handleError(_0xa16e00,null));};exports[_0x84a6('0x57')]=function(_0x33fd99,_0x205bab){var _0x489dba=getUserAttributes();_0x33fd99[_0x84a6('0x47')]['id']=_0x33fd99[_0x84a6('0x58')]['id'];var _0x554cff=qs[_0x84a6('0x46')](_0x489dba,_0x33fd99);if(_0x33fd99['query'][_0x84a6('0x59')]){_0x554cff['include']=[{'all':!![]}];}if(_0x33fd99['query'][_0x84a6('0x48')]===_0x84a6('0x49')){_0x554cff[_0x84a6('0x5a')]=[{'model':db[_0x84a6('0x4a')],'as':'userSetting'}];}_0x554cff=_[_0x84a6('0x5b')]({},_0x554cff,_0x33fd99[_0x84a6('0x5c')]);if(!_[_0x84a6('0x38')](_0x554cff['attributes'],'id')){_0x554cff['attributes'][_0x84a6('0x4c')]('id');}return db[_0x84a6('0x3d')][_0x84a6('0x39')](_0x554cff)[_0x84a6('0x2b')](handleEntityNotFound(_0x205bab,null))[_0x84a6('0x2b')](function(_0x23f3c1){var _0x2bd409=[];values=_0x23f3c1;if(_0x33fd99[_0x84a6('0x47')][_0x84a6('0x4f')]===_0x84a6('0x49')){_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x51'),_0x23f3c1[_0x84a6('0x52')]));_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x53'),_0x23f3c1[_0x84a6('0x52')]));_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x55'),_0x23f3c1[_0x84a6('0x52')]));_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x5d'),_0x23f3c1[_0x84a6('0x52')]));_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x54'),_0x23f3c1[_0x84a6('0x52')]));_0x2bd409[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x5e'),_0x23f3c1[_0x84a6('0x52')]));return Promise[_0x84a6('0x56')](_0x2bd409);}else{return values;}})[_0x84a6('0x2b')](function(){return values;})[_0x84a6('0x2b')](respondWithResult(_0x205bab,null))[_0x84a6('0x29')](handleError(_0x205bab,null));};exports[_0x84a6('0x2a')]=function(_0x40d4f0,_0x1142a9){if(_0x40d4f0['body']['id']){delete _0x40d4f0[_0x84a6('0x5f')]['id'];}delete _0x40d4f0[_0x84a6('0x5f')][_0x84a6('0x2c')];return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x40d4f0[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x1142a9,null))['then'](saveUpdates(_0x40d4f0[_0x84a6('0x5f')],null))[_0x84a6('0x2b')](respondWithResult(_0x1142a9,null))[_0x84a6('0x29')](handleError(_0x1142a9,null));};exports[_0x84a6('0x60')]=function(_0x56f873,_0x10e79a){return db[_0x84a6('0x3d')][_0x84a6('0x60')]()[_0x84a6('0x2b')](respondWithResult(_0x10e79a,null))[_0x84a6('0x29')](handleError(_0x10e79a,null));};exports[_0x84a6('0x61')]=function(_0x3eb512,_0x248e33){return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x3eb512['params']['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x248e33,null))[_0x84a6('0x2b')](function(_0x3296a1){if(_0x3296a1){return _0x3296a1[_0x84a6('0x61')](_0x3eb512['body'][_0x84a6('0x62')],_[_0x84a6('0x63')](_0x3eb512['body'],[_0x84a6('0x62'),'id'])||{});}})[_0x84a6('0x2b')](respondWithResult(_0x248e33,null))[_0x84a6('0x29')](handleError(_0x248e33,null));};function validateUser(_0x69fb63){return new Promise(function(_0x5ef470,_0x35e5ca){if(_0x69fb63['internal'])return _0x5ef470(_0x69fb63);return db[_0x84a6('0x64')][_0x84a6('0x65')](0x1)[_0x84a6('0x2b')](function(_0x23f78b){if(_0x23f78b[_0x84a6('0x66')])authService[_0x84a6('0x67')](_0x69fb63[_0x84a6('0x68')]);db[_0x84a6('0x3d')][_0x84a6('0x69')](_0x84a6('0x6a'))[_0x84a6('0x2b')](function(_0x3e31df){if(_[_0x84a6('0x6b')](_0x3e31df)){_0x69fb63['internal']=_0x23f78b[_0x84a6('0x6c')]||0x1;return;}if(_[_0x84a6('0x6b')](_0x23f78b[_0x84a6('0x6c')])||_0x23f78b[_0x84a6('0x6c')]===_0x3e31df){_0x69fb63[_0x84a6('0x6a')]=_0x3e31df+0x1;return;}if(_0x23f78b[_0x84a6('0x6c')]>_0x3e31df){_0x69fb63[_0x84a6('0x6a')]=_0x23f78b[_0x84a6('0x6c')];return;}return db['sequelize'][_0x84a6('0x47')](_0x84a6('0x6d'),{'type':db[_0x84a6('0x6e')][_0x84a6('0x6f')]['SELECT']})[_0x84a6('0x2b')](function(_0x14852f){if(_0x14852f&&_0x14852f[_0x84a6('0x50')]){for(var _0x323044=0x0,_0x4f64fe=_0x14852f[_0x84a6('0x50')];_0x323044<_0x4f64fe&&_[_0x84a6('0x6b')](_0x69fb63[_0x84a6('0x6a')]);_0x323044++){if(_0x23f78b['min_internal']<=_0x14852f[_0x323044][_0x84a6('0x70')]){_0x69fb63[_0x84a6('0x6a')]=_0x14852f[_0x323044][_0x84a6('0x70')];}else if(_0x23f78b['min_internal']>_0x14852f[_0x323044][_0x84a6('0x70')]&&_0x23f78b['min_internal']<=_0x14852f[_0x323044]['to']){_0x69fb63[_0x84a6('0x6a')]=_0x23f78b[_0x84a6('0x6c')];}}}if(_[_0x84a6('0x6b')](_0x69fb63[_0x84a6('0x6a')])){_0x69fb63[_0x84a6('0x6a')]=_0x3e31df+0x1;}return _0x5ef470(_0x69fb63);});});})['catch'](function(_0x2cd118){_0x35e5ca(_0x2cd118);});});}function updateUser(_0x3fb5f3){return new Promise(function(_0x1040a,_0x35c48f){try{if(_0x3fb5f3[_0x84a6('0x71')]){_0x3fb5f3['mailbox']=_0x3fb5f3[_0x84a6('0x6a')];_0x3fb5f3[_0x84a6('0x72')]={'mailbox':_0x3fb5f3[_0x84a6('0x6a')],'password':_0x3fb5f3['password'],'fullname':_0x3fb5f3['fullname'],'email':_0x3fb5f3[_0x84a6('0x73')]};}if(_0x3fb5f3[_0x84a6('0x2c')]==='agent'){if(!_0x3fb5f3['permissions'])_0x3fb5f3[_0x84a6('0x74')]=[_0x84a6('0x75'),'102',_0x84a6('0x76'),_0x84a6('0x77'),_0x84a6('0x78'),_0x84a6('0x79'),_0x84a6('0x7a'),_0x84a6('0x7b'),_0x84a6('0x7c'),_0x84a6('0x7d'),_0x84a6('0x7e'),_0x84a6('0x7f'),_0x84a6('0x80'),_0x84a6('0x81'),'115'];}_0x1040a(_0x3fb5f3);}catch(_0x4d4761){_0x35c48f(_0x4d4761);}});}exports['create']=function(_0x1259b7,_0x585100){if(_0x1259b7[_0x84a6('0x32')][_0x84a6('0x2c')]==='agent')throw new Error('Unauthorized');if(_0x1259b7[_0x84a6('0x5f')]['role']===_0x84a6('0x32')&&_0x1259b7['user'][_0x84a6('0x2c')]!==_0x84a6('0x30')){throw new Error(_0x84a6('0x82'));}if(_0x1259b7[_0x84a6('0x5f')][_0x84a6('0x2c')]===_0x84a6('0x30')&&_0x1259b7[_0x84a6('0x32')][_0x84a6('0x2c')]!==_0x84a6('0x30')){throw new Error(_0x84a6('0x83'));}return licenseUtil[_0x84a6('0x84')]([_0x1259b7[_0x84a6('0x5f')]])[_0x84a6('0x2b')](function(){return validateUser(_0x1259b7[_0x84a6('0x5f')]);})[_0x84a6('0x2b')](function(_0x278497){return updateUser(_0x278497)['then'](function(_0x50e02f){if(_0x50e02f['role']==='admin'){_0x50e02f['settingsEnabled']=_0x1259b7[_0x84a6('0x32')][_0x84a6('0x85')];delete _0x50e02f[_0x84a6('0x86')];}return _0x50e02f;});})[_0x84a6('0x2b')](function(_0x16c34f){return db[_0x84a6('0x3d')][_0x84a6('0x87')](_0x16c34f,{'include':[{'model':db[_0x84a6('0x72')],'as':_0x84a6('0x72')}]});})['then'](function(_0x2fe200){if(_0x1259b7[_0x84a6('0x5f')][_0x84a6('0x2c')]===_0x84a6('0x32'))return _0x2fe200;if(_0x1259b7[_0x84a6('0x32')][_0x84a6('0x2c')]!==_0x84a6('0x32'))return _0x2fe200;return db['UserProfileSection'][_0x84a6('0x39')]({'where':{'name':_0x2fe200['role']==='agent'?'Agents':_0x84a6('0x88'),'userProfileId':_0x1259b7[_0x84a6('0x32')][_0x84a6('0x86')]},'raw':!![]})[_0x84a6('0x2b')](function(_0x9e0d18){if(!_0x9e0d18||_0x9e0d18[_0x84a6('0x89')]!=0x0)return _0x2fe200;return db[_0x84a6('0x3b')][_0x84a6('0x87')]({'name':_0x2fe200[_0x84a6('0x3a')],'resourceId':_0x2fe200['id'],'type':_0x9e0d18[_0x84a6('0x3a')],'sectionId':_0x9e0d18['id']},{})[_0x84a6('0x2b')](function(){return _0x2fe200;});})[_0x84a6('0x29')](function(_0x188513){logger[_0x84a6('0x26')](_0x84a6('0x8a'),_0x188513);throw _0x188513;});})[_0x84a6('0x2b')](respondWithResult(_0x585100,0xc9))[_0x84a6('0x29')](handleError(_0x585100,null));};exports[_0x84a6('0x8b')]=function(_0x4218ac,_0x5a3545){var _0x4509e1=_0x4218ac[_0x84a6('0x5f')];var _0x84ae1a=[];if(_0x4218ac[_0x84a6('0x32')][_0x84a6('0x2c')]===_0x84a6('0x2d'))throw new Error('Unauthorized');if(_[_0x84a6('0x8c')](_0x4509e1,[_0x84a6('0x2c'),_0x84a6('0x32')])&&_0x4218ac[_0x84a6('0x32')][_0x84a6('0x2c')]!==_0x84a6('0x30')){throw new Error(_0x84a6('0x82'));}if(_[_0x84a6('0x8c')](_0x4509e1,[_0x84a6('0x2c'),_0x84a6('0x30')])&&_0x4218ac['user']['role']!==_0x84a6('0x30')){throw new Error(_0x84a6('0x8d'));}return licenseUtil[_0x84a6('0x84')](_0x4509e1)['then'](function(){return validateUser(_0x4509e1[0x0]);})[_0x84a6('0x2b')](function(){for(var _0x5f2f5d=0x1;_0x5f2f5d<_0x4509e1[_0x84a6('0x50')];_0x5f2f5d++){var _0x55c30f=_0x4509e1[_0x5f2f5d-0x1][_0x84a6('0x6a')];if(!_0x4509e1[_0x5f2f5d]['internal'])_0x4509e1[_0x5f2f5d][_0x84a6('0x6a')]=_0x55c30f+0x1;_0x84ae1a[_0x84a6('0x4c')](validateUser(_0x4509e1[_0x5f2f5d]));}return Promise[_0x84a6('0x56')](_0x84ae1a);})[_0x84a6('0x2b')](function(){_0x84ae1a=[];for(var _0x457e29=0x0;_0x457e29<_0x4509e1[_0x84a6('0x50')];_0x457e29++){_0x84ae1a[_0x84a6('0x4c')](updateUser(_0x4509e1[_0x457e29]));}return Promise[_0x84a6('0x56')](_0x84ae1a);})[_0x84a6('0x2b')](function(){_0x84ae1a=_0x4509e1[_0x84a6('0x36')](function(_0x5d9213){return db['User'][_0x84a6('0x87')](_0x5d9213,{'include':[{'model':db[_0x84a6('0x72')],'as':_0x84a6('0x72')}]})['then'](function(_0x2aaa62){_0x5d9213['id']=_0x2aaa62['id'];return _0x5d9213;});});return Promise[_0x84a6('0x56')](_0x84ae1a);})['then'](function(_0x52c98f){if(_0x4218ac[_0x84a6('0x5f')]['role']===_0x84a6('0x32'))return _0x52c98f;if(_0x4218ac['user'][_0x84a6('0x2c')]!==_0x84a6('0x32'))return _0x52c98f;var _0x1c04f5=_[_0x84a6('0x8c')](_0x52c98f,function(_0x519c2){return _0x519c2[_0x84a6('0x2c')]==='agent'||_0x519c2[_0x84a6('0x2c')]===_0x84a6('0x33');});if(!_0x1c04f5)return _0x52c98f;return db['UserProfileSection'][_0x84a6('0x4d')]({'where':{'name':{'$or':[_0x84a6('0x8e'),'Telephones']},'userProfileId':_0x4218ac[_0x84a6('0x32')][_0x84a6('0x86')]},'raw':!![]})[_0x84a6('0x2b')](function(_0xa2aa97){if(_[_0x84a6('0x8f')](_0xa2aa97)||!_['some'](_0xa2aa97,[_0x84a6('0x89'),0x0]))return _0x52c98f;_0x84ae1a=[];var _0x5a2344=_(_0xa2aa97)[_0x84a6('0x36')](function(_0x5b8b65){if(_0x5b8b65[_0x84a6('0x89')]===0x1)return;return _0x5b8b65[_0x84a6('0x3a')]===_0x84a6('0x8e')?_0x84a6('0x2d'):_0x84a6('0x33');})[_0x84a6('0x90')]()[_0x84a6('0x37')]();for(var _0x1aff30=0x0;_0x1aff30<_0x52c98f[_0x84a6('0x50')];_0x1aff30++){if(!_[_0x84a6('0x38')](_0x5a2344,_0x52c98f[_0x1aff30]['role']))return;var _0x24608a=_0x52c98f[_0x1aff30][_0x84a6('0x2c')]==='agent'?_0x84a6('0x8e'):_0x84a6('0x88');_0x84ae1a[_0x84a6('0x4c')](db[_0x84a6('0x3b')][_0x84a6('0x87')]({'name':_0x52c98f[_0x1aff30]['name'],'resourceId':_0x52c98f[_0x1aff30]['id'],'type':_0x24608a,'sectionId':_[_0x84a6('0x39')](_0xa2aa97,[_0x84a6('0x3a'),_0x24608a])['id']},{}));}return Promise[_0x84a6('0x56')](_0x84ae1a);});})[_0x84a6('0x2b')](respondWithResult(_0x5a3545,0xc9))[_0x84a6('0x29')](handleError(_0x5a3545,null));};exports['changePassword']=function(_0x5c11cc,_0x41c6f4){if(_0x5c11cc[_0x84a6('0x5f')]['id']){delete _0x5c11cc[_0x84a6('0x5f')]['id'];}return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x5c11cc[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](function(_0x153e54){if(!_0x153e54)return null;if(_0x153e54['id']===_0x5c11cc[_0x84a6('0x32')]['id']){if(!_0x5c11cc[_0x84a6('0x5f')][_0x84a6('0x91')]||!_0x5c11cc[_0x84a6('0x5f')][_0x84a6('0x92')]){throw new db['Sequelize'][(_0x84a6('0x93'))](_0x84a6('0x94'));}if(!_0x153e54['authenticate'](_0x5c11cc[_0x84a6('0x5f')][_0x84a6('0x91')])){throw new db[(_0x84a6('0x95'))][(_0x84a6('0x93'))](_0x84a6('0x96'));}if(_0x5c11cc[_0x84a6('0x5f')][_0x84a6('0x91')]===_0x5c11cc[_0x84a6('0x5f')]['newPassword']){throw new db[(_0x84a6('0x95'))][(_0x84a6('0x93'))](_0x84a6('0x97'));}}else if(_0x5c11cc[_0x84a6('0x32')][_0x84a6('0x2c')]===_0x84a6('0x30')){if(!_0x5c11cc['body'][_0x84a6('0x92')]){throw new db[(_0x84a6('0x95'))][(_0x84a6('0x93'))](_0x84a6('0x98'));}}else if(_0x5c11cc['user'][_0x84a6('0x2c')]===_0x84a6('0x32')){if(!_0x5c11cc['body'][_0x84a6('0x92')]){throw new db['Sequelize'][(_0x84a6('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x153e54['role']!==_0x84a6('0x2d')){throw new db[(_0x84a6('0x95'))][(_0x84a6('0x93'))](_0x84a6('0x99'));}}else{throw new db[(_0x84a6('0x95'))][(_0x84a6('0x93'))](_0x84a6('0x99'));}return _0x153e54;})[_0x84a6('0x2b')](handleEntityNotFound(_0x41c6f4,null))[_0x84a6('0x2b')](function(_0xe04bb7){return db[_0x84a6('0x64')][_0x84a6('0x9a')]({'attributes':['id',_0x84a6('0x66'),_0x84a6('0x9b'),_0x84a6('0x9c')]})[_0x84a6('0x2b')](function(_0x19d0e8){if(_0x19d0e8[_0x84a6('0x66')])authService[_0x84a6('0x67')](_0x5c11cc[_0x84a6('0x5f')][_0x84a6('0x92')]);if(!_0x19d0e8[_0x84a6('0x9b')]||!_0xe04bb7[_0x84a6('0x42')])return _0xe04bb7;authService['validatePasswordHistory'](_0x5c11cc['body'][_0x84a6('0x92')],_0xe04bb7[_0x84a6('0x42')],_0x19d0e8[_0x84a6('0x9c')]);return _0xe04bb7;})[_0x84a6('0x2b')](saveUpdates({'password':_0x5c11cc[_0x84a6('0x5f')]['newPassword'],'passwordResetAt':_0x5c11cc['user']['id']==_0x5c11cc[_0x84a6('0x58')]['id']?moment():null,'previousPasswords':authService[_0x84a6('0x9d')](_0x5c11cc[_0x84a6('0x5f')]['newPassword'],_0xe04bb7[_0x84a6('0x42')])},null));})[_0x84a6('0x2b')](respondWithResult(_0x41c6f4,null))[_0x84a6('0x29')](handleError(_0x41c6f4,null));};exports[_0x84a6('0x9e')]=function(_0x3e8205,_0x349546){var _0x36e067=_0x3e8205['body'][_0x84a6('0x9f')];return db['User']['find']({'where':{'id':_0x3e8205[_0x84a6('0x58')]['id']},'attributes':['id',_0x84a6('0x3a'),_0x84a6('0x2c'),_0x84a6('0xa0'),'loginInPause',_0x84a6('0xa1'),_0x84a6('0xa2')]})[_0x84a6('0x2b')](handleEntityNotFound(_0x349546,null))['then'](function(_0xdb8354){if(_0xdb8354){if(!utils[_0x84a6('0xa3')](_0x36e067)){throw new db[(_0x84a6('0x95'))]['ValidationError'](_0x84a6('0xa4'));}return _0xdb8354['add'+_[_0x84a6('0xa5')](_0x36e067[_0x84a6('0xa6')]())+_0x84a6('0xa7')](_0x3e8205['body'][_0x84a6('0x62')],{'penalty':_0x3e8205['body'][_0x84a6('0xa8')]||0x0})['spread'](function(_0x50408d){for(var _0x48c7a9=0x0;_0x48c7a9<_0x3e8205['body']['ids'][_0x84a6('0x50')];_0x48c7a9+=0x1){var _0x3da285={'UserId':Number(_0x3e8205[_0x84a6('0x58')]['id'])};_0x3da285[_[_0x84a6('0xa5')](_0x36e067['toLowerCase']())+_0x84a6('0xa9')]=Number(_0x3e8205[_0x84a6('0x5f')][_0x84a6('0x62')][_0x48c7a9]);socket[_0x84a6('0x2e')](_0x84a6('0x32')+_[_0x84a6('0xa5')](_0x36e067[_0x84a6('0xa6')]())+_0x84a6('0xaa'),_0x3da285);}return _0x50408d;})[_0x84a6('0x2b')](function(){if(_0x36e067===_0x84a6('0xab')){return db['VoiceQueue']['findAll']({'where':{'id':_0x3e8205['body'][_0x84a6('0x62')]||[]},'raw':!![],'attributes':['id',_0x84a6('0x3a')]});}})[_0x84a6('0x2b')](function(_0x5c44cc){var _0x2a99c2=_0xdb8354[_0x84a6('0xac')]({'plain':!![]});var _0x208b16=[];if(_0x36e067===_0x84a6('0xab')&&_0x2a99c2[_0x84a6('0x2c')]===_0x84a6('0x2d')&&_0x2a99c2[_0x84a6('0xa0')]){for(let _0x3d8189=0x0;_0x3d8189<_0x5c44cc[_0x84a6('0x50')];_0x3d8189+=0x1){_0x208b16[_0x84a6('0x4c')]({'membername':_0x2a99c2[_0x84a6('0x3a')],'UserId':_0x2a99c2['id'],'queue_name':_0x5c44cc[_0x3d8189][_0x84a6('0x3a')],'VoiceQueueId':_0x5c44cc[_0x3d8189]['id'],'interface':_[_0x84a6('0x6b')](_0x2a99c2[_0x84a6('0xa2')])?util[_0x84a6('0xad')](_0x84a6('0xae'),_0x2a99c2[_0x84a6('0x3a')]):_0x2a99c2[_0x84a6('0xa2')],'paused':_0x2a99c2['voicePause']||![],'penalty':_0x3e8205[_0x84a6('0x5f')][_0x84a6('0xa8')]||0x0});}return Promise['all'](_0x208b16[_0x84a6('0x36')](function(_0x2805ab){return db[_0x84a6('0xaf')][_0x84a6('0xb0')](_0x2805ab);}));}return _0xdb8354;});}})[_0x84a6('0x2b')](respondWithStatusCode(_0x349546,null))[_0x84a6('0x29')](handleError(_0x349546,null));};exports[_0x84a6('0xb1')]=function(_0x117a39,_0x55427b){var _0x4b690a,_0x44f7e2;return db[_0x84a6('0x3d')]['find']({'where':{'id':_0x117a39[_0x84a6('0x58')]['id']},'attributes':['id',_0x84a6('0x3a'),'role']})[_0x84a6('0x2b')](handleEntityNotFound(_0x55427b,null))[_0x84a6('0x2b')](function(_0x297533){if(_0x297533){_0x4b690a=_0x297533;if(!_0x117a39[_0x84a6('0x47')]['channel']||!utils[_0x84a6('0xa3')](_0x117a39['query']['channel'])){throw new db[(_0x84a6('0x95'))]['ValidationError'](_0x84a6('0xa4'));}return _0x297533[_0x84a6('0xb2')+_[_0x84a6('0xa5')](_0x117a39[_0x84a6('0x47')][_0x84a6('0x9f')][_0x84a6('0xa6')]())+_0x84a6('0xa7')](_0x117a39[_0x84a6('0x47')][_0x84a6('0x62')]);}})[_0x84a6('0x2b')](function(_0x3d85b7){if(_[_0x84a6('0xb3')](_0x117a39[_0x84a6('0x47')][_0x84a6('0x62')])){for(var _0x40a07b=0x0;_0x40a07b<_0x117a39[_0x84a6('0x47')][_0x84a6('0x62')]['length'];_0x40a07b+=0x1){_0x44f7e2={'UserId':Number(_0x117a39[_0x84a6('0x58')]['id'])};_0x44f7e2[_[_0x84a6('0xa5')](_0x117a39['query'][_0x84a6('0x9f')][_0x84a6('0xa6')]())+'QueueId']=Number(_0x117a39['query'][_0x84a6('0x62')][_0x40a07b]);socket['emit'](_0x84a6('0x32')+_[_0x84a6('0xa5')](_0x117a39[_0x84a6('0x47')][_0x84a6('0x9f')][_0x84a6('0xa6')]())+_0x84a6('0xb4'),_0x44f7e2);}}else{_0x44f7e2={'UserId':Number(_0x117a39['params']['id'])};_0x44f7e2[_[_0x84a6('0xa5')](_0x117a39[_0x84a6('0x47')][_0x84a6('0x9f')][_0x84a6('0xa6')]())+_0x84a6('0xa9')]=Number(_0x117a39[_0x84a6('0x47')][_0x84a6('0x62')]);socket['emit'](_0x84a6('0x32')+_[_0x84a6('0xa5')](_0x117a39['query'][_0x84a6('0x9f')][_0x84a6('0xa6')]())+'Queue:remove',_0x44f7e2);}return _0x3d85b7;})[_0x84a6('0x2b')](function(){if(_0x117a39[_0x84a6('0x47')]['channel']==='voice'){return db[_0x84a6('0xaf')]['destroy']({'where':{'UserId':_0x117a39['params']['id'],'VoiceQueueId':_0x117a39['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x4b690a;});}return _0x4b690a;})[_0x84a6('0x2b')](respondWithStatusCode(_0x55427b,null))[_0x84a6('0x29')](handleError(_0x55427b,null));};exports[_0x84a6('0xb5')]=function(_0x23256e,_0x2654e9){_0x23256e['body']['userpic']=_0x23256e[_0x84a6('0xb6')]['filename'];return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x23256e[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x2654e9,null))[_0x84a6('0x2b')](saveUpdates(_0x23256e[_0x84a6('0x5f')],null))[_0x84a6('0x2b')](respondWithResult(_0x2654e9,null))['catch'](handleError(_0x2654e9,null));};exports[_0x84a6('0xb7')]=function(_0x490bbd,_0x3fd538){var _0x3c407e=path['join'](config[_0x84a6('0xb8')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x490bbd[_0x84a6('0x58')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3fd538,null))[_0x84a6('0x2b')](function(_0x3b6118){if(_0x3b6118){if(_[_0x84a6('0x6b')](_0x3b6118[_0x84a6('0xb9')])){return _0x3fd538['download'](_0x3c407e);}else{if(!fs[_0x84a6('0xba')](path['join'](config[_0x84a6('0xb8')],'server/files/images/',_0x3b6118[_0x84a6('0xb9')]))){return _0x3fd538['download'](_0x3c407e);}return _0x3fd538['download'](path[_0x84a6('0xbb')](config[_0x84a6('0xb8')],_0x84a6('0xbc'),_0x3b6118[_0x84a6('0xb9')]));}}})[_0x84a6('0x29')](handleError(_0x3fd538,null));};exports[_0x84a6('0xbd')]=function(_0x5e8642,_0x5515e0){return db['User']['find']({'where':{'id':_0x5e8642[_0x84a6('0x58')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5515e0,null))[_0x84a6('0x2b')](function(_0x50fc87){var _0x685101=[];values=_0x50fc87[_0x84a6('0x52')];_0x685101[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x51'),_0x50fc87['dataValues']));_0x685101[_0x84a6('0x4c')](get_open_tabs('sms',_0x50fc87[_0x84a6('0x52')]));_0x685101[_0x84a6('0x4c')](get_open_tabs('openchannel',_0x50fc87[_0x84a6('0x52')]));_0x685101['push'](get_open_tabs(_0x84a6('0x5d'),_0x50fc87[_0x84a6('0x52')]));_0x685101[_0x84a6('0x4c')](get_open_tabs(_0x84a6('0x54'),_0x50fc87['dataValues']));_0x685101['push'](get_open_tabs(_0x84a6('0x5e'),_0x50fc87['dataValues']));return Promise['all'](_0x685101);})[_0x84a6('0x2b')](function(_0x45a2aa){if(_0x45a2aa){var _0x1ee46f=_[_0x84a6('0x36')](values['ChatOpenTabs'],function(_0xac49a5){return{'channel':'CHAT','id':_0xac49a5['id'],'createdAt':_0xac49a5['createdAt']};});var _0x3a5089=_['map'](values[_0x84a6('0xbe')],function(_0x20ae27){return{'channel':_0x84a6('0xbf'),'id':_0x20ae27['id'],'createdAt':_0x20ae27[_0x84a6('0xc0')]};});var _0x1ca90a=_['map'](values[_0x84a6('0xc1')],function(_0x533851){return{'channel':_0x84a6('0xc2'),'id':_0x533851['id'],'createdAt':_0x533851[_0x84a6('0xc0')]};});var _0x1ce617=_[_0x84a6('0x36')](values[_0x84a6('0xc3')],function(_0x1b6653){return{'channel':_0x84a6('0xc4'),'id':_0x1b6653['id'],'createdAt':_0x1b6653[_0x84a6('0xc0')]};});var _0xbdbf08=_[_0x84a6('0x36')](values[_0x84a6('0xc5')],function(_0x3501db){return{'channel':_0x84a6('0xc6'),'id':_0x3501db['id'],'createdAt':_0x3501db['createdAt']};});var _0x23fed0=_[_0x84a6('0x36')](values['WhatsappOpenTabs'],function(_0x3ce191){return{'channel':_0x84a6('0xc7'),'id':_0x3ce191['id'],'createdAt':_0x3ce191[_0x84a6('0xc0')]};});var _0x94e3e5=_[_0x84a6('0xc8')](_0x1ee46f,_0x3a5089,_0x1ca90a,_0x1ce617,_0xbdbf08,_0x23fed0);var _0x2aee3b={'count':_0x94e3e5['length'],'rows':_0x94e3e5};return _0x2aee3b;}else return null;})[_0x84a6('0x2b')](respondWithResult(_0x5515e0,null))['catch'](handleError(_0x5515e0,null));};exports[_0x84a6('0xc9')]=function(_0xbc361e,_0x5cad58){var _0x78f6d8={};return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0xbc361e['params']['id']}})['then'](function(_0x4bfab5){if(!_0x4bfab5){throw new APINotFoundError(util['format'](_0x84a6('0xca'),_0xbc361e[_0x84a6('0x58')]['id']));}return contacts[_0x84a6('0x60')]();})['then'](function(_0x434082){_0xbc361e[_0x84a6('0x47')]['User']=_0xbc361e['params']['id'];_0x78f6d8=qs[_0x84a6('0x46')](_0x434082,_0xbc361e);if(_0xbc361e['query']['hasOwnProperty']('includeAll')){_0x78f6d8[_0x84a6('0x5a')]=[{'model':db[_0x84a6('0xcb')],'as':_0x84a6('0xcc'),'required':![]},{'model':db[_0x84a6('0xcd')],'as':_0x84a6('0xce'),'attributes':['id','name',_0x84a6('0xcf')],'where':_0xbc361e[_0x84a6('0x47')][_0x84a6('0xd0')]?{'id':_0xbc361e[_0x84a6('0x47')][_0x84a6('0xd0')]}:undefined,'required':_0xbc361e[_0x84a6('0x47')][_0x84a6('0xd0')]?!![]:![]}];}return contacts[_0x84a6('0x4d')](_0xbc361e[_0x84a6('0x47')],_0xbc361e[_0x84a6('0x32')],_0x78f6d8,_0x434082);})['then'](respondWithFilteredResult(_0x5cad58,_0x78f6d8))[_0x84a6('0x29')](APIHandleError(_0x5cad58));};exports[_0x84a6('0xd1')]=function(_0x3ee297,_0x3241a5){var _0x45b5fe;var _0x4351ed={};var _0x112485;return db['User'][_0x84a6('0x9a')]({'where':{'id':_0x3ee297[_0x84a6('0x58')]['id']},'attributes':['id',_0x84a6('0x3a'),'role']})[_0x84a6('0x2b')](handleEntityNotFound(_0x3241a5,null))[_0x84a6('0x2b')](function(_0xed74a4){if(!utils[_0x84a6('0xa3')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0x9f')])){throw new db['Sequelize']['ValidationError'](_0x84a6('0xa4'));}_0x45b5fe=_0xed74a4;var _0x7672a3={};_0x7672a3['model']=_[_0x84a6('0xd2')](db[_[_0x84a6('0xa5')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0x9f')])+'Queue'][_0x84a6('0x3e')]);_0x7672a3[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x3ee297[_0x84a6('0x47')]);_0x7672a3[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x7672a3[_0x84a6('0xd5')],_0x7672a3['query']);_0x4351ed['attributes']=_[_0x84a6('0xd4')](_0x7672a3[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x4351ed[_0x84a6('0x4b')]=_0x4351ed[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x4351ed[_0x84a6('0x4b')]:_0x7672a3[_0x84a6('0xd5')];_0x4351ed['order']=qs[_0x84a6('0xd7')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x4351ed['where']=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x3ee297[_0x84a6('0x47')],_0x7672a3[_0x84a6('0xd3')]));if(_0x3ee297['query'][_0x84a6('0x34')]){_0x4351ed[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x4351ed[_0x84a6('0xd9')],{'$or':_['map'](_0x4351ed['attributes'],function(_0x3fdd91){var _0x3dfec9={};_0x3dfec9[_0x3fdd91]={'$like':'%'+_0x3ee297['query'][_0x84a6('0x34')]+'%'};return _0x3dfec9;})});}_0x4351ed=_[_0x84a6('0x5b')]({},_0x4351ed,_0x3ee297['options']);switch(_0x45b5fe['role']){case _0x84a6('0x30'):return db[_[_0x84a6('0xa5')](_0x3ee297[_0x84a6('0x47')]['channel'])+_0x84a6('0xda')]['findAll'](_0x4351ed);case _0x84a6('0x32'):case _0x84a6('0x2d'):return _0x45b5fe[_0x84a6('0xac')+_['capitalize'](_0x3ee297[_0x84a6('0x47')]['channel'])+_0x84a6('0xa7')](_0x4351ed);default:throw new db['Sequelize'][(_0x84a6('0x93'))](_0x84a6('0xdb'));}})[_0x84a6('0x2b')](function(_0x5d5bc1){_0x112485=_0x5d5bc1[_0x84a6('0x50')];if(!_0x3ee297[_0x84a6('0x47')][_0x84a6('0xdc')]('nolimit')){_0x4351ed[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x4351ed[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x3ee297[_0x84a6('0x47')][_0x84a6('0x19')]);}switch(_0x45b5fe[_0x84a6('0x2c')]){case _0x84a6('0x30'):return db[_[_0x84a6('0xa5')](_0x3ee297[_0x84a6('0x47')]['channel'])+_0x84a6('0xda')]['findAll'](_0x4351ed);case'user':case _0x84a6('0x2d'):return _0x45b5fe[_0x84a6('0xac')+_['capitalize'](_0x3ee297[_0x84a6('0x47')][_0x84a6('0x9f')])+_0x84a6('0xa7')](_0x4351ed);}})[_0x84a6('0x2b')](function(_0xae0428){return{'count':_0x112485,'rows':_0xae0428};})[_0x84a6('0x2b')](respondWithResult(_0x3241a5,null))[_0x84a6('0x29')](handleError(_0x3241a5,null));};exports['getVoiceQueuesRt']=function(_0x348c25,_0x28d70b){var _0x9cb7e7={};var _0xe91c58={};var _0x569101;var _0x1a7c0e;return db['User'][_0x84a6('0x9a')]({'where':{'id':_0x348c25['params']['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x28d70b,null))[_0x84a6('0x2b')](function(_0x5859a4){if(_0x5859a4){_0x569101=_0x5859a4;_0xe91c58[_0x84a6('0xd5')]=_['keys'](db[_0x84a6('0xaf')]['rawAttributes']);_0xe91c58[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x348c25[_0x84a6('0x47')]);_0xe91c58[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0xe91c58[_0x84a6('0xd5')],_0xe91c58['query']);_0x9cb7e7[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0xe91c58['model'],qs[_0x84a6('0xd6')](_0x348c25['query']['fields']));_0x9cb7e7['attributes']=_0x9cb7e7['attributes']['length']?_0x9cb7e7['attributes']:_0xe91c58[_0x84a6('0xd5')];_0x9cb7e7[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0x348c25[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x9cb7e7[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_['pick'](_0x348c25[_0x84a6('0x47')],_0xe91c58[_0x84a6('0xd3')]));if(_0x348c25[_0x84a6('0x47')]['filter']){_0x9cb7e7[_0x84a6('0xd9')]=_['merge'](_0x9cb7e7[_0x84a6('0xd9')],{'$or':_['map'](_0x9cb7e7[_0x84a6('0x4b')],function(_0x4982de){var _0x3095bc={};_0x3095bc[_0x4982de]={'$like':'%'+_0x348c25[_0x84a6('0x47')]['filter']+'%'};return _0x3095bc;})});}_0x9cb7e7=_[_0x84a6('0x5b')]({},_0x9cb7e7,_0x348c25[_0x84a6('0x5c')]);return _0x569101[_0x84a6('0xde')](_0x9cb7e7);}})[_0x84a6('0x2b')](function(_0x41b873){if(_0x41b873){_0x1a7c0e=_0x41b873[_0x84a6('0x50')];if(!_0x348c25[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x9cb7e7['limit']=qs[_0x84a6('0x1a')](_0x348c25[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x9cb7e7[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x348c25[_0x84a6('0x47')]['offset']);}return _0x569101[_0x84a6('0xde')](_0x9cb7e7);}})[_0x84a6('0x2b')](function(_0x16f6bc){if(_0x16f6bc){return _0x16f6bc?{'count':_0x1a7c0e,'rows':_0x16f6bc}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x28d70b,null))[_0x84a6('0x29')](handleError(_0x28d70b,null));};exports[_0x84a6('0xe0')]=function(_0x3d1f05,_0x5cd3e8){var _0x5e79c3={};var _0x3ee9c0={};var _0x4a2c30;var _0x1631b7;return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0x3d1f05[_0x84a6('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cd3e8,null))['then'](function(_0x41c177){if(_0x41c177){_0x4a2c30=_0x41c177;_0x3ee9c0[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db['ChatGroup'][_0x84a6('0x3e')]);_0x3ee9c0['query']=_[_0x84a6('0xd2')](_0x3d1f05[_0x84a6('0x47')]);_0x3ee9c0[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x3ee9c0[_0x84a6('0xd5')],_0x3ee9c0['query']);_0x5e79c3[_0x84a6('0x4b')]=_['intersection'](_0x3ee9c0[_0x84a6('0xd5')],qs['fields'](_0x3d1f05[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x5e79c3[_0x84a6('0x4b')]=_0x5e79c3[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x5e79c3['attributes']:_0x3ee9c0[_0x84a6('0xd5')];_0x5e79c3['order']=qs['sort'](_0x3d1f05['query'][_0x84a6('0xd7')]);_0x5e79c3[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x3d1f05['query'],_0x3ee9c0[_0x84a6('0xd3')]));if(_0x3d1f05[_0x84a6('0x47')][_0x84a6('0x34')]){_0x5e79c3[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x5e79c3[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x5e79c3[_0x84a6('0x4b')],function(_0x2dd02b){var _0x55e16f={};_0x55e16f[_0x2dd02b]={'$like':'%'+_0x3d1f05[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x55e16f;})});}_0x5e79c3=_[_0x84a6('0x5b')]({},_0x5e79c3,_0x3d1f05['options']);return _0x4a2c30[_0x84a6('0xe0')](_0x5e79c3);}})[_0x84a6('0x2b')](function(_0x2794bd){if(_0x2794bd){_0x1631b7=_0x2794bd['length'];if(!_0x3d1f05[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x5e79c3[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x3d1f05[_0x84a6('0x47')]['limit']);_0x5e79c3['offset']=qs[_0x84a6('0x19')](_0x3d1f05[_0x84a6('0x47')][_0x84a6('0x19')]);}return _0x4a2c30[_0x84a6('0xe0')](_0x5e79c3);}})[_0x84a6('0x2b')](function(_0xc9ba20){if(_0xc9ba20){return _0xc9ba20?{'count':_0x1631b7,'rows':_0xc9ba20}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x5cd3e8,null))['catch'](handleError(_0x5cd3e8,null));};exports[_0x84a6('0xe1')]=function(_0x4b8943,_0x2fe8df){var _0x53cf9d={'raw':!![],'where':{}};var _0x5bfb02={};var _0x5921aa={'count':0x0,'rows':[]};return db[_0x84a6('0x3d')]['findOne']({'where':{'id':_0x4b8943[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x2fe8df,null))[_0x84a6('0x2b')](function(_0x837885){if(_0x837885){_0x5bfb02[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db[_0x84a6('0xe2')][_0x84a6('0x3e')]);_0x5bfb02[_0x84a6('0x47')]=_['keys'](_0x4b8943[_0x84a6('0x47')]);_0x5bfb02[_0x84a6('0xd3')]=_['intersection'](_0x5bfb02[_0x84a6('0xd5')],_0x5bfb02['query']);_0x53cf9d[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x5bfb02[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x4b8943[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x53cf9d['attributes']=_0x53cf9d[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x53cf9d[_0x84a6('0x4b')]:_0x5bfb02['model'];if(!_0x4b8943[_0x84a6('0x47')][_0x84a6('0xdc')]('nolimit')){_0x53cf9d['limit']=qs[_0x84a6('0x1a')](_0x4b8943[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x53cf9d[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x4b8943[_0x84a6('0x47')][_0x84a6('0x19')]);}_0x53cf9d[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0x4b8943[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x53cf9d[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_['pick'](_0x4b8943[_0x84a6('0x47')],_0x5bfb02['filters']));_0x53cf9d['where']['UserId']=_0x837885['id'];if(_0x4b8943['query'][_0x84a6('0x34')]){_0x53cf9d['where']=_['merge'](_0x53cf9d[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x53cf9d[_0x84a6('0x4b')],function(_0x8251ad){var _0x50ee1a={};_0x50ee1a[_0x8251ad]={'$like':'%'+_0x4b8943['query'][_0x84a6('0x34')]+'%'};return _0x50ee1a;})});}_0x53cf9d=_['merge']({},_0x53cf9d,_0x4b8943['options']);return db[_0x84a6('0xe2')][_0x84a6('0x1c')]({'where':_0x53cf9d['where']})[_0x84a6('0x2b')](function(_0xf823f4){_0x5921aa[_0x84a6('0x1c')]=_0xf823f4;if(_0x4b8943['query']['includeAll']){_0x53cf9d['include']=[{'all':!![]}];}return db[_0x84a6('0xe2')]['findAll'](_0x53cf9d);})[_0x84a6('0x2b')](function(_0x248611){_0x5921aa[_0x84a6('0x4e')]=_0x248611;return _0x5921aa;});}})[_0x84a6('0x2b')](respondWithFilteredResult(_0x2fe8df,_0x53cf9d))[_0x84a6('0x29')](handleError(_0x2fe8df,null));};exports[_0x84a6('0xe3')]=function(_0x26427f,_0x5715ee){var _0x2b6a10={'raw':!![],'where':{}};var _0x2831f5={};var _0x350d52={'count':0x0,'rows':[]};return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0x26427f[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x5715ee,null))['then'](function(_0x12ba0b){if(_0x12ba0b){_0x2831f5[_0x84a6('0xd5')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x2831f5[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x26427f[_0x84a6('0x47')]);_0x2831f5[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x2831f5[_0x84a6('0xd5')],_0x2831f5[_0x84a6('0x47')]);_0x2b6a10[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x2831f5[_0x84a6('0xd5')],qs['fields'](_0x26427f[_0x84a6('0x47')]['fields']));_0x2b6a10[_0x84a6('0x4b')]=_0x2b6a10[_0x84a6('0x4b')]['length']?_0x2b6a10[_0x84a6('0x4b')]:_0x2831f5[_0x84a6('0xd5')];if(!_0x26427f['query'][_0x84a6('0xdc')]('nolimit')){_0x2b6a10[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x26427f[_0x84a6('0x47')]['limit']);_0x2b6a10[_0x84a6('0x19')]=qs['offset'](_0x26427f[_0x84a6('0x47')][_0x84a6('0x19')]);}_0x2b6a10[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0x26427f[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x2b6a10[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x26427f[_0x84a6('0x47')],_0x2831f5[_0x84a6('0xd3')]));_0x2b6a10['where'][_0x84a6('0xe4')]=_0x12ba0b['id'];if(_0x26427f[_0x84a6('0x47')][_0x84a6('0x34')]){_0x2b6a10['where']=_['merge'](_0x2b6a10[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x2b6a10[_0x84a6('0x4b')],function(_0x156656){var _0x2ff731={};_0x2ff731[_0x156656]={'$like':'%'+_0x26427f[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x2ff731;})});}_0x2b6a10=_['merge']({},_0x2b6a10,_0x26427f[_0x84a6('0x5c')]);return db['ScreenRecording']['count']({'where':_0x2b6a10[_0x84a6('0xd9')]})[_0x84a6('0x2b')](function(_0x2365cc){_0x350d52[_0x84a6('0x1c')]=_0x2365cc;if(_0x26427f[_0x84a6('0x47')][_0x84a6('0x59')]){_0x2b6a10[_0x84a6('0x5a')]=[{'all':!![]}];}return db[_0x84a6('0xe5')][_0x84a6('0x4d')](_0x2b6a10);})[_0x84a6('0x2b')](function(_0x4d9115){_0x350d52[_0x84a6('0x4e')]=_0x4d9115;return _0x350d52;});}})[_0x84a6('0x2b')](respondWithFilteredResult(_0x5715ee,_0x2b6a10))[_0x84a6('0x29')](handleError(_0x5715ee,null));};exports['getChatInteractions']=function(_0x14f84a,_0x76f819){var _0x263465={};var _0x382feb={};var _0x18832c;var _0x45bd38;return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0x14f84a['params']['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x76f819,null))[_0x84a6('0x2b')](function(_0x15ae06){if(_0x15ae06){_0x18832c=_0x15ae06;_0x382feb['model']=_['keys'](db['ChatInteraction'][_0x84a6('0x3e')]);_0x382feb[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x14f84a['query']);_0x382feb[_0x84a6('0xd3')]=_['intersection'](_0x382feb['model'],_0x382feb['query']);_0x263465[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x382feb[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x14f84a['query']['fields']));_0x263465[_0x84a6('0x4b')]=_0x263465['attributes']['length']?_0x263465[_0x84a6('0x4b')]:_0x382feb[_0x84a6('0xd5')];_0x263465['order']=qs['sort'](_0x14f84a[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x263465['where']=qs['filters'](_['pick'](_0x14f84a[_0x84a6('0x47')],_0x382feb[_0x84a6('0xd3')]));if(_0x14f84a[_0x84a6('0x47')][_0x84a6('0x34')]){_0x263465[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x263465[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x263465[_0x84a6('0x4b')],function(_0x313876){var _0xdd3a6b={};_0xdd3a6b[_0x313876]={'$like':'%'+_0x14f84a['query'][_0x84a6('0x34')]+'%'};return _0xdd3a6b;})});}_0x263465=_[_0x84a6('0x5b')]({},_0x263465,_0x14f84a[_0x84a6('0x5c')]);return _0x18832c['getChatInteractions'](_0x263465);}})[_0x84a6('0x2b')](function(_0x4786bf){if(_0x4786bf){_0x45bd38=_0x4786bf['length'];if(!_0x14f84a['query'][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x263465[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x14f84a[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x263465[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x14f84a[_0x84a6('0x47')]['offset']);}return _0x18832c['getChatInteractions'](_0x263465);}})[_0x84a6('0x2b')](function(_0x486d5f){if(_0x486d5f){return _0x486d5f?{'count':_0x45bd38,'rows':_0x486d5f}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x76f819,null))[_0x84a6('0x29')](handleError(_0x76f819,null));};exports[_0x84a6('0xe6')]=function(_0xb1ac92,_0x3795d3){var _0x5d4dfc={};var _0x4e7956={};var _0x3ea7a4;var _0x410374;return db['User'][_0x84a6('0x9a')]({'where':{'id':_0xb1ac92['params']['id']}})['then'](handleEntityNotFound(_0x3795d3,null))[_0x84a6('0x2b')](function(_0x1cb54a){if(_0x1cb54a){_0x3ea7a4=_0x1cb54a;_0x4e7956[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db[_0x84a6('0xe7')][_0x84a6('0x3e')]);_0x4e7956[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0xb1ac92['query']);_0x4e7956[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x4e7956[_0x84a6('0xd5')],_0x4e7956[_0x84a6('0x47')]);_0x5d4dfc[_0x84a6('0x4b')]=_['intersection'](_0x4e7956['model'],qs[_0x84a6('0xd6')](_0xb1ac92[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x5d4dfc['attributes']=_0x5d4dfc['attributes'][_0x84a6('0x50')]?_0x5d4dfc['attributes']:_0x4e7956['model'];_0x5d4dfc[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0xb1ac92[_0x84a6('0x47')]['sort']);_0x5d4dfc[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0xb1ac92[_0x84a6('0x47')],_0x4e7956[_0x84a6('0xd3')]));if(_0xb1ac92[_0x84a6('0x47')]['filter']){_0x5d4dfc[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x5d4dfc['where'],{'$or':_[_0x84a6('0x36')](_0x5d4dfc[_0x84a6('0x4b')],function(_0x29cb87){var _0x4313a5={};_0x4313a5[_0x29cb87]={'$like':'%'+_0xb1ac92[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x4313a5;})});}_0x5d4dfc=_[_0x84a6('0x5b')]({},_0x5d4dfc,_0xb1ac92[_0x84a6('0x5c')]);return _0x3ea7a4[_0x84a6('0xe6')](_0x5d4dfc);}})[_0x84a6('0x2b')](function(_0xb9db8e){if(_0xb9db8e){_0x410374=_0xb9db8e[_0x84a6('0x50')];if(!_0xb1ac92[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x5d4dfc[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0xb1ac92[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x5d4dfc[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0xb1ac92[_0x84a6('0x47')][_0x84a6('0x19')]);}return _0x3ea7a4[_0x84a6('0xe6')](_0x5d4dfc);}})[_0x84a6('0x2b')](function(_0x581bc0){if(_0x581bc0){return _0x581bc0?{'count':_0x410374,'rows':_0x581bc0}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x3795d3,null))['catch'](handleError(_0x3795d3,null));};exports['getMailInteractions']=function(_0x4a5f2c,_0x442e9f){var _0x46cdeb={'raw':!![],'where':{}};var _0x49f9df={};var _0x1b7027={'count':0x0,'rows':[]};return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0x4a5f2c[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x442e9f,null))['then'](function(_0x20fcb7){if(_0x20fcb7){_0x49f9df[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db[_0x84a6('0xe8')][_0x84a6('0x3e')]);_0x49f9df[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x4a5f2c[_0x84a6('0x47')]);_0x49f9df[_0x84a6('0xd3')]=_['intersection'](_0x49f9df['model'],_0x49f9df[_0x84a6('0x47')]);_0x46cdeb[_0x84a6('0x4b')]=_['intersection'](_0x49f9df[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x4a5f2c['query'][_0x84a6('0xd6')]));_0x46cdeb[_0x84a6('0x4b')]=_0x46cdeb['attributes']['length']?_0x46cdeb[_0x84a6('0x4b')]:_0x49f9df[_0x84a6('0xd5')];if(!_0x4a5f2c[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x46cdeb[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x4a5f2c['query'][_0x84a6('0x1a')]);_0x46cdeb[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x4a5f2c[_0x84a6('0x47')][_0x84a6('0x19')]);}_0x46cdeb[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0x4a5f2c['query'][_0x84a6('0xd7')]);_0x46cdeb[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x4a5f2c[_0x84a6('0x47')],_0x49f9df[_0x84a6('0xd3')]));_0x46cdeb['where'][_0x84a6('0xe4')]=_0x20fcb7['id'];if(_0x4a5f2c[_0x84a6('0x47')][_0x84a6('0x34')]){_0x46cdeb[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x46cdeb['where'],{'$or':_[_0x84a6('0x36')](_0x46cdeb['attributes'],function(_0x2904e6){var _0x548c50={};_0x548c50[_0x2904e6]={'$like':'%'+_0x4a5f2c[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x548c50;})});}_0x46cdeb=_[_0x84a6('0x5b')]({},_0x46cdeb,_0x4a5f2c[_0x84a6('0x5c')]);return db['MailInteraction'][_0x84a6('0x1c')]({'where':_0x46cdeb['where']})['then'](function(_0xc45235){_0x1b7027[_0x84a6('0x1c')]=_0xc45235;if(_0x4a5f2c[_0x84a6('0x47')][_0x84a6('0x59')]){_0x46cdeb[_0x84a6('0x5a')]=[{'all':!![]}];}return db['MailInteraction'][_0x84a6('0x4d')](_0x46cdeb);})[_0x84a6('0x2b')](function(_0x1d32b4){_0x1b7027['rows']=_0x1d32b4;return _0x1b7027;});}})[_0x84a6('0x2b')](respondWithFilteredResult(_0x442e9f,_0x46cdeb))[_0x84a6('0x29')](handleError(_0x442e9f,null));};exports[_0x84a6('0xe9')]=function(_0x16c4fc,_0x2862d4){var _0x6f7c5={};var _0x3d4ca6={};var _0x50bfd4;var _0x5a2fd4;return db['User']['findOne']({'where':{'id':_0x16c4fc[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x2862d4,null))[_0x84a6('0x2b')](function(_0x4f007e){if(_0x4f007e){_0x50bfd4=_0x4f007e;_0x3d4ca6[_0x84a6('0xd5')]=_['keys'](db[_0x84a6('0xea')][_0x84a6('0x3e')]);_0x3d4ca6['query']=_[_0x84a6('0xd2')](_0x16c4fc[_0x84a6('0x47')]);_0x3d4ca6[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x3d4ca6[_0x84a6('0xd5')],_0x3d4ca6[_0x84a6('0x47')]);_0x6f7c5[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x3d4ca6[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x16c4fc[_0x84a6('0x47')]['fields']));_0x6f7c5['attributes']=_0x6f7c5[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x6f7c5[_0x84a6('0x4b')]:_0x3d4ca6[_0x84a6('0xd5')];_0x6f7c5['order']=qs[_0x84a6('0xd7')](_0x16c4fc[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x6f7c5[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x16c4fc[_0x84a6('0x47')],_0x3d4ca6[_0x84a6('0xd3')]));if(_0x16c4fc[_0x84a6('0x47')]['filter']){_0x6f7c5[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x6f7c5[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x6f7c5[_0x84a6('0x4b')],function(_0x3870d3){var _0xc3f18f={};_0xc3f18f[_0x3870d3]={'$like':'%'+_0x16c4fc[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0xc3f18f;})});}_0x6f7c5=_[_0x84a6('0x5b')]({},_0x6f7c5,_0x16c4fc['options']);return _0x50bfd4[_0x84a6('0xe9')](_0x6f7c5);}})[_0x84a6('0x2b')](function(_0x2447ed){if(_0x2447ed){_0x5a2fd4=_0x2447ed['length'];if(!_0x16c4fc[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x6f7c5[_0x84a6('0x1a')]=qs['limit'](_0x16c4fc[_0x84a6('0x47')]['limit']);_0x6f7c5['offset']=qs[_0x84a6('0x19')](_0x16c4fc[_0x84a6('0x47')][_0x84a6('0x19')]);}return _0x50bfd4['getSmsInteractions'](_0x6f7c5);}})[_0x84a6('0x2b')](function(_0x3089ac){if(_0x3089ac){return _0x3089ac?{'count':_0x5a2fd4,'rows':_0x3089ac}:null;}})['then'](respondWithResult(_0x2862d4,null))[_0x84a6('0x29')](handleError(_0x2862d4,null));};exports['getFaxInteractions']=function(_0x1350ae,_0x56ce05){var _0x44f8dc={};var _0x29a72c={};var _0x196129;var _0x4b8755;return db['User']['findOne']({'where':{'id':_0x1350ae[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x56ce05,null))['then'](function(_0x4fb123){if(_0x4fb123){_0x196129=_0x4fb123;_0x29a72c['model']=_[_0x84a6('0xd2')](db[_0x84a6('0xeb')]['rawAttributes']);_0x29a72c[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x1350ae[_0x84a6('0x47')]);_0x29a72c[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x29a72c[_0x84a6('0xd5')],_0x29a72c[_0x84a6('0x47')]);_0x44f8dc[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x29a72c[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x1350ae[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x44f8dc[_0x84a6('0x4b')]=_0x44f8dc[_0x84a6('0x4b')]['length']?_0x44f8dc['attributes']:_0x29a72c[_0x84a6('0xd5')];_0x44f8dc[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0x1350ae[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x44f8dc[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_['pick'](_0x1350ae[_0x84a6('0x47')],_0x29a72c[_0x84a6('0xd3')]));if(_0x1350ae[_0x84a6('0x47')][_0x84a6('0x34')]){_0x44f8dc[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x44f8dc[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x44f8dc['attributes'],function(_0x2983b3){var _0x31f1bc={};_0x31f1bc[_0x2983b3]={'$like':'%'+_0x1350ae[_0x84a6('0x47')]['filter']+'%'};return _0x31f1bc;})});}_0x44f8dc=_[_0x84a6('0x5b')]({},_0x44f8dc,_0x1350ae[_0x84a6('0x5c')]);return _0x196129[_0x84a6('0xec')](_0x44f8dc);}})[_0x84a6('0x2b')](function(_0x59ed90){if(_0x59ed90){_0x4b8755=_0x59ed90[_0x84a6('0x50')];if(!_0x1350ae['query'][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x44f8dc['limit']=qs[_0x84a6('0x1a')](_0x1350ae[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x44f8dc[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x1350ae['query'][_0x84a6('0x19')]);}return _0x196129[_0x84a6('0xec')](_0x44f8dc);}})[_0x84a6('0x2b')](function(_0x581b79){if(_0x581b79){return _0x581b79?{'count':_0x4b8755,'rows':_0x581b79}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x56ce05,null))[_0x84a6('0x29')](handleError(_0x56ce05,null));};exports[_0x84a6('0xed')]=function(_0x17650a,_0x40cecd){var _0x567c31={};var _0x3aea20={};var _0x30db3a;var _0x327780;return db['User'][_0x84a6('0x9a')]({'where':{'id':_0x17650a['params']['id']}})['then'](handleEntityNotFound(_0x40cecd,null))[_0x84a6('0x2b')](function(_0x2ac2a7){if(_0x2ac2a7){_0x30db3a=_0x2ac2a7;_0x3aea20[_0x84a6('0xd5')]=_['keys'](db[_0x84a6('0xee')][_0x84a6('0x3e')]);_0x3aea20[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x17650a[_0x84a6('0x47')]);_0x3aea20[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x3aea20[_0x84a6('0xd5')],_0x3aea20[_0x84a6('0x47')]);_0x567c31[_0x84a6('0x4b')]=_['intersection'](_0x3aea20['model'],qs[_0x84a6('0xd6')](_0x17650a[_0x84a6('0x47')][_0x84a6('0xd6')]));_0x567c31[_0x84a6('0x4b')]=_0x567c31[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x567c31[_0x84a6('0x4b')]:_0x3aea20[_0x84a6('0xd5')];_0x567c31[_0x84a6('0xdd')]=qs['sort'](_0x17650a[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x567c31[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x17650a[_0x84a6('0x47')],_0x3aea20['filters']));if(_0x17650a[_0x84a6('0x47')][_0x84a6('0x34')]){_0x567c31['where']=_[_0x84a6('0x5b')](_0x567c31['where'],{'$or':_[_0x84a6('0x36')](_0x567c31[_0x84a6('0x4b')],function(_0x533e52){var _0x44118f={};_0x44118f[_0x533e52]={'$like':'%'+_0x17650a[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x44118f;})});}_0x567c31=_[_0x84a6('0x5b')]({},_0x567c31,_0x17650a['options']);return _0x30db3a[_0x84a6('0xed')](_0x567c31);}})[_0x84a6('0x2b')](function(_0x42457e){if(_0x42457e){_0x327780=_0x42457e[_0x84a6('0x50')];if(!_0x17650a[_0x84a6('0x47')][_0x84a6('0xdc')](_0x84a6('0xdf'))){_0x567c31[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x17650a[_0x84a6('0x47')]['limit']);_0x567c31[_0x84a6('0x19')]=qs[_0x84a6('0x19')](_0x17650a[_0x84a6('0x47')][_0x84a6('0x19')]);}return _0x30db3a['getWhatsappInteractions'](_0x567c31);}})[_0x84a6('0x2b')](function(_0x5b2cb7){if(_0x5b2cb7){return _0x5b2cb7?{'count':_0x327780,'rows':_0x5b2cb7}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x40cecd,null))['catch'](handleError(_0x40cecd,null));};exports['login']=function(_0x510719,_0x28f834,_0x435ccc){var _0x21bdd8;var _0x3d7617;var _0x411f89;var _0x2ba1fd=!_[_0x84a6('0x6b')](_0x510719['params']['id'])?_0x510719[_0x84a6('0x58')]['id']:!_[_0x84a6('0x6b')](_0x510719['user']['id'])?_0x510719[_0x84a6('0x32')]['id']:null;return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x2ba1fd,'role':{'$or':[_0x84a6('0x30'),_0x84a6('0x32'),_0x84a6('0x2d')]}},'attributes':['id',_0x84a6('0x3a'),_0x84a6('0xef'),_0x84a6('0xf0'),_0x84a6('0x2c'),'internal',_0x84a6('0xf1')]})[_0x84a6('0x2b')](function(_0x4a5877){if(_0x4a5877){if(_0x4a5877[_0x84a6('0x2c')]===_0x84a6('0x2d')){_0x21bdd8=_0x4a5877;if(_0x510719[_0x84a6('0x5f')][_0x84a6('0xa2')]){_0x411f89=util[_0x84a6('0xad')](_0x84a6('0xf2'),_0x21bdd8[_0x510719[_0x84a6('0x5f')][_0x84a6('0xa2')]]);}else if(_0x510719[_0x84a6('0x5f')][_0x84a6('0xf3')]){_0x411f89=util[_0x84a6('0xad')]('SIP/%s',_0x510719[_0x84a6('0x5f')]['intrf']);}else{_0x411f89=util[_0x84a6('0xad')](_0x84a6('0xae'),_0x21bdd8[_0x84a6('0x3a')]);}socket['to'](util[_0x84a6('0xad')]('user:%s',_0x21bdd8[_0x84a6('0x3a')]))['emit'](_0x84a6('0xf4'),{'user':{'id':_0x21bdd8['id'],'name':_0x21bdd8['name']},'ip':_0x510719[_0x84a6('0xf5')][_0x84a6('0xf6')]||_0x510719['connection'][_0x84a6('0xf7')]||_0x510719[_0x84a6('0xf8')][_0x84a6('0xf7')]||_0x510719[_0x84a6('0xf9')][_0x84a6('0xf8')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x84a6('0x2f')]({'where':{'membername':_0x21bdd8[_0x84a6('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0x84a6('0x95'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x84a6('0x2b')](function(){if(_0x21bdd8){return _0x21bdd8[_0x84a6('0xfa')]({'raw':!![]});}})[_0x84a6('0x2b')](function(_0x202919){if(_0x21bdd8){if(_0x202919){_0x3d7617=_0x202919;if(_0x3d7617[_0x84a6('0x50')]){var _0xb518ad=_0x3d7617[_0x84a6('0x36')](function(_0xfe71e1){var _0x596379={'membername':_0x21bdd8['name'],'UserId':_0x21bdd8['id'],'queue_name':_0xfe71e1[_0x84a6('0x3a')],'VoiceQueueId':_0xfe71e1['id'],'interface':_0x411f89,'paused':_0x21bdd8[_0x84a6('0xf1')]||![],'penalty':_0xfe71e1[_0x84a6('0xfb')]||0x0};return db[_0x84a6('0xaf')][_0x84a6('0xb0')](_0x596379);});return Promise[_0x84a6('0x56')](_0xb518ad);}}}})[_0x84a6('0x2b')](function(){if(_0x21bdd8){return db[_0x84a6('0xfc')][_0x84a6('0x4d')]({'where':{'membername':_0x21bdd8['name'],'exitAt':null}});}})[_0x84a6('0x2b')](function(_0x3e7818){if(_0x21bdd8){var _0x10be12=[];_0x3e7818[_0x84a6('0xfd')](function(_0x38eb15){_0x10be12[_0x84a6('0x4c')](_0x38eb15[_0x84a6('0x2a')]({'exitAt':moment()[_0x84a6('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x84a6('0x56')](_0x10be12);}})['then'](function(){if(_0x21bdd8){var _0x42fc5e=[];var _0x3871a0=[];var _0x4e3867=utils['getChannels']();var _0x1251e4={'membername':_0x21bdd8[_0x84a6('0x3a')],'interface':_0x411f89,'enterAt':moment()[_0x84a6('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x21bdd8['role'],'internal':_0x21bdd8[_0x84a6('0x6a')]};_0x4e3867[_0x84a6('0xfd')](function(_0x1ff4ae){_0x42fc5e[_0x84a6('0x4c')](_[_0x84a6('0x5b')]({'channel':_0x1ff4ae,'type':_0x84a6('0xfe'),'data1':_0x510719[_0x84a6('0x5f')][_0x84a6('0xff')],'data2':_0x411f89},_0x1251e4));if(_0x21bdd8[_0x84a6('0xf1')]){_0x3871a0[_0x84a6('0x4c')](_[_0x84a6('0x5b')]({'channel':_0x1ff4ae,'type':_0x84a6('0x100'),'data1':_0x84a6('0x101')},_0x1251e4));}});return db[_0x84a6('0xfc')]['bulkCreate'](_0x42fc5e[_0x84a6('0xc8')](_0x3871a0),{'individualHooks':!![]});}})['then'](function(){if(_0x21bdd8){return _0x21bdd8['update']({'online':!![],'lastLoginAt':moment()[_0x84a6('0xad')](_0x84a6('0x102')),'voicePause':_0x21bdd8[_0x84a6('0xf1')]||![],'mailPause':_0x21bdd8['loginInPause']||![],'chatPause':_0x21bdd8[_0x84a6('0xf1')]||![],'faxPause':_0x21bdd8[_0x84a6('0xf1')]||![],'smsPause':_0x21bdd8[_0x84a6('0xf1')]||![],'openchannelPause':_0x21bdd8['loginInPause']||![],'whatsappPause':_0x21bdd8['loginInPause']||![],'pauseType':_0x21bdd8[_0x84a6('0xf1')]?'LOGININPAUSE':null,'interface':_0x411f89,'lastPauseAt':moment()[_0x84a6('0xad')](_0x84a6('0x102'))});}})[_0x84a6('0x2b')](function(_0x35d307){if(_0x510719[_0x84a6('0x103')]){return _0x435ccc();}else{return Promise[_0x84a6('0x104')](_0x35d307)[_0x84a6('0x2b')](respondWithResult(_0x28f834,null));}})[_0x84a6('0x29')](handleError(_0x28f834,null));};exports[_0x84a6('0x105')]=function(_0x1d97d1,_0x55ace4){var _0x4d0ef4;return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x1d97d1[_0x84a6('0x58')]['id'],'role':_0x84a6('0x2d')},'attributes':['id','name','role']})[_0x84a6('0x2b')](handleEntityNotFound(_0x55ace4,null))['then'](function(_0x598f4a){if(_0x598f4a){_0x4d0ef4=_0x598f4a;return db[_0x84a6('0xaf')][_0x84a6('0x2f')]({'where':{'membername':_0x4d0ef4['name']},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x84a6('0x4d')]({'where':{'membername':_0x4d0ef4[_0x84a6('0x3a')],'exitAt':null}});})[_0x84a6('0x2b')](function(_0x50a75b){var _0xfec72b=[];_0x50a75b[_0x84a6('0xfd')](function(_0x5c6ce9){_0xfec72b[_0x84a6('0x4c')](_0x5c6ce9[_0x84a6('0x2a')]({'exitAt':moment()[_0x84a6('0xad')](_0x84a6('0x102'))}));});return Promise[_0x84a6('0x56')](_0xfec72b);})['then'](function(){return _0x4d0ef4[_0x84a6('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x84a6('0x2b')](respondWithResult(_0x55ace4,null))['catch'](handleError(_0x55ace4,null));};exports['pause']=function(_0x239c22,_0x221bd9){var _0x2a7e4c;return db[_0x84a6('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x239c22[_0x84a6('0x58')]['id']},'individualHooks':!![]})[_0x84a6('0x2b')](function(){return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x239c22[_0x84a6('0x58')]['id'],'role':_0x84a6('0x2d')},'attributes':['id',_0x84a6('0x3a'),_0x84a6('0x2c'),_0x84a6('0x6a'),_0x84a6('0xa2'),_0x84a6('0xa0')]});})['then'](handleEntityNotFound(_0x221bd9,null))[_0x84a6('0x2b')](function(_0x4357a0){if(_0x4357a0){_0x2a7e4c=_0x4357a0;return respondWithRpcPromise(_0x84a6('0x106'),_0x84a6('0x107'),{'id':_0x2a7e4c['id'],'name':_0x2a7e4c['name'],'pause':!![]});}})[_0x84a6('0x2b')](function(){if(_0x2a7e4c){return db[_0x84a6('0xfc')][_0x84a6('0x4d')]({'where':{'membername':_0x2a7e4c[_0x84a6('0x3a')],'type':_0x84a6('0x100'),'exitAt':null}});}})[_0x84a6('0x2b')](function(_0x3425a4){if(_0x3425a4['length']){var _0x183adc=moment()[_0x84a6('0xad')](_0x84a6('0x102'));for(var _0x2627e7=0x0,_0x4ef25b=_0x3425a4['length'];_0x2627e7<_0x4ef25b;_0x2627e7++){_0x3425a4[_0x2627e7]['updateAttributes']({'exitAt':_0x183adc});}}})[_0x84a6('0x2b')](function(){var _0x2166a7=[];var _0x405523=utils[_0x84a6('0x108')]();_0x405523[_0x84a6('0xfd')](function(_0x3d73c8){_0x2166a7[_0x84a6('0x4c')]({'channel':_0x3d73c8,'membername':_0x2a7e4c[_0x84a6('0x3a')],'interface':_[_0x84a6('0x6b')](_0x2a7e4c[_0x84a6('0xa2')])?util['format']('SIP/%s',_0x2a7e4c[_0x84a6('0x3a')]):_0x2a7e4c[_0x84a6('0xa2')],'type':_0x84a6('0x100'),'enterAt':moment()[_0x84a6('0xad')](_0x84a6('0x102')),'data1':_0x239c22[_0x84a6('0x5f')][_0x84a6('0x109')]||_0x84a6('0x10a'),'role':_0x2a7e4c[_0x84a6('0x2c')],'internal':_0x2a7e4c[_0x84a6('0x6a')]});});return db[_0x84a6('0xfc')][_0x84a6('0x8b')](_0x2166a7,{'individualHooks':!![]});})['then'](function(){return _0x2a7e4c[_0x84a6('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x239c22['body'][_0x84a6('0x109')]||_0x84a6('0x10a'),'lastPauseAt':moment()[_0x84a6('0xad')](_0x84a6('0x102'))});})[_0x84a6('0x2b')](respondWithResult(_0x221bd9,null))[_0x84a6('0x29')](handleError(_0x221bd9,null));};exports['unpause']=function(_0x36b3fc,_0x409416){if(_0x36b3fc[_0x84a6('0x5f')][_0x84a6('0x9f')]&&!utils[_0x84a6('0xa3')](_0x36b3fc[_0x84a6('0x5f')][_0x84a6('0x9f')])){throw new APIBadRequestError(util[_0x84a6('0xad')](_0x84a6('0x10b'),_0x36b3fc['body'][_0x84a6('0x9f')]));}return db[_0x84a6('0x3d')][_0x84a6('0x39')]({'where':{'id':_0x36b3fc[_0x84a6('0x58')]['id']},'attributes':['id',_0x84a6('0x3a'),_0x84a6('0x2c'),_0x84a6('0x6a'),_0x84a6('0xa2'),_0x84a6('0xa0'),_0x84a6('0xa1'),_0x84a6('0x10c'),_0x84a6('0x10d'),_0x84a6('0x10e'),_0x84a6('0x10f'),_0x84a6('0x110'),_0x84a6('0x111'),'pauseType',_0x84a6('0x112')]})[_0x84a6('0x2b')](function(_0x441c8c){if(!_0x441c8c){throw new APINotFoundError(util['format'](_0x84a6('0xca'),_0x36b3fc[_0x84a6('0x58')]['id']));}return _0x441c8c[_0x84a6('0x113')](_0x36b3fc['body']['channel']);})[_0x84a6('0x2b')](respondWithResult(_0x409416,null))[_0x84a6('0x29')](APIHandleError(_0x409416));};exports[_0x84a6('0x114')]=function(_0x52fe21,_0x3db081){var _0x2dbaa2={};var _0xcba731={};var _0x1e61e;var _0x5cb65a;return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0x52fe21[_0x84a6('0x58')]['id']}})['then'](handleEntityNotFound(_0x3db081,null))[_0x84a6('0x2b')](function(_0x146d69){if(_0x146d69){_0x1e61e=_0x146d69;_0xcba731[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db['Team'][_0x84a6('0x3e')]);_0xcba731[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x52fe21['query']);_0xcba731['filters']=_[_0x84a6('0xd4')](_0xcba731[_0x84a6('0xd5')],_0xcba731['query']);_0x2dbaa2[_0x84a6('0x4b')]=_['intersection'](_0xcba731[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0x52fe21[_0x84a6('0x47')]['fields']));_0x2dbaa2['attributes']=_0x2dbaa2[_0x84a6('0x4b')]['length']?_0x2dbaa2[_0x84a6('0x4b')]:_0xcba731[_0x84a6('0xd5')];_0x2dbaa2['order']=qs['sort'](_0x52fe21['query']['sort']);_0x2dbaa2[_0x84a6('0xd9')]=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0x52fe21[_0x84a6('0x47')],_0xcba731[_0x84a6('0xd3')]));if(_0x52fe21[_0x84a6('0x47')][_0x84a6('0x34')]){_0x2dbaa2[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x2dbaa2[_0x84a6('0xd9')],{'$or':_[_0x84a6('0x36')](_0x2dbaa2[_0x84a6('0x4b')],function(_0x422e01){var _0x4afb37={};_0x4afb37[_0x422e01]={'$like':'%'+_0x52fe21[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x4afb37;})});}_0x2dbaa2=_[_0x84a6('0x5b')]({},_0x2dbaa2,_0x52fe21[_0x84a6('0x5c')]);return _0x1e61e[_0x84a6('0x114')](_0x2dbaa2);}})[_0x84a6('0x2b')](function(_0x3dcb3b){if(_0x3dcb3b){_0x5cb65a=_0x3dcb3b['length'];if(!_0x52fe21[_0x84a6('0x47')]['hasOwnProperty']('nolimit')){_0x2dbaa2[_0x84a6('0x1a')]=qs['limit'](_0x52fe21[_0x84a6('0x47')][_0x84a6('0x1a')]);_0x2dbaa2[_0x84a6('0x19')]=qs['offset'](_0x52fe21[_0x84a6('0x47')][_0x84a6('0x19')]);}return _0x1e61e[_0x84a6('0x114')](_0x2dbaa2);}})[_0x84a6('0x2b')](function(_0x4d324b){if(_0x4d324b){return _0x4d324b?{'count':_0x5cb65a,'rows':_0x4d324b}:null;}})[_0x84a6('0x2b')](respondWithResult(_0x3db081,null))[_0x84a6('0x29')](handleError(_0x3db081,null));};exports[_0x84a6('0x115')]=function(_0x44ddc6,_0x3a4ac0){var _0x26bcf9=_0x44ddc6[_0x84a6('0x58')]['id'];var _0x281fe7=_0x44ddc6[_0x84a6('0x5f')]?_0x44ddc6[_0x84a6('0x5f')]['ids']:null;var _0x57979d=[];return Promise[_0x84a6('0x104')]()[_0x84a6('0x2b')](function(){if(!_0x281fe7)throw new APIBadRequestError(_0x84a6('0x116'));})[_0x84a6('0x2b')](function(){return db[_0x84a6('0x3d')]['findOne']({'where':{'id':_0x26bcf9}});})[_0x84a6('0x2b')](function(_0x2b4e1d){if(!_0x2b4e1d)throw new APINotFoundError(util[_0x84a6('0xad')]('User\x20with\x20id\x20%s\x20not\x20found',_0x44ddc6['params']['id']));return db[_0x84a6('0x6e')][_0x84a6('0x117')](function(_0x5a6ee6){return _0x2b4e1d[_0x84a6('0x115')](_0x281fe7,{'transaction':_0x5a6ee6})['then'](function(){return db[_0x84a6('0x118')][_0x84a6('0x4d')]({'where':{'id':{'$in':_0x281fe7}}});})[_0x84a6('0x2b')](function(_0x288ca2){var _0x3c99ef=_[_0x84a6('0x36')](_0x288ca2,function(_0x38d1a7){return _0x38d1a7[_0x84a6('0x119')]();});return Promise[_0x84a6('0x56')](_0x3c99ef);})[_0x84a6('0x2b')](function(_0x469e03){_0x57979d=_['flattenDeep'](_0x469e03);var _0x5102cf=_[_0x84a6('0x36')](_0x57979d,function(_0x3577ea){return _0x3577ea[_0x84a6('0x11a')](_0x2b4e1d['id'],{'transaction':_0x5a6ee6});});return Promise['all'](_0x5102cf);})[_0x84a6('0x2b')](function(){if(!_0x2b4e1d['online'])return;var _0x5e7641=_['filter'](_0x57979d,function(_0x1e759c){return _0x1e759c[_0x84a6('0x11b')](_0x84a6('0x9f'))==='Voice';});var _0x5377b3=_[_0x84a6('0x36')](_0x5e7641,function(_0x4d703d){return db[_0x84a6('0xaf')][_0x84a6('0xb0')]({'membername':_0x2b4e1d[_0x84a6('0x3a')],'UserId':_0x2b4e1d['id'],'queue_name':_0x4d703d[_0x84a6('0x3a')],'VoiceQueueId':_0x4d703d['id'],'interface':_['isNil'](_0x2b4e1d[_0x84a6('0xa2')])?util[_0x84a6('0xad')]('SIP/%s',_0x2b4e1d['name']):_0x2b4e1d[_0x84a6('0xa2')],'paused':_0x2b4e1d[_0x84a6('0xa1')]||![],'penalty':_0x2b4e1d[_0x84a6('0xa8')]},{'transaction':_0x5a6ee6});});return Promise['all'](_0x5377b3);})[_0x84a6('0x2b')](function(){return db['TeamVoicePrefix'][_0x84a6('0x4d')]({'where':{'teamId':{'$in':_0x281fe7}}});})[_0x84a6('0x2b')](function(_0x3b32b1){var _0x352d11=_[_0x84a6('0x36')](_0x3b32b1,function(_0x345867){return db[_0x84a6('0x11c')][_0x84a6('0x87')]({'UserId':_0x2b4e1d['id'],'VoicePrefixId':_0x345867[_0x84a6('0x11d')]},{'transaction':_0x5a6ee6});});return Promise[_0x84a6('0x56')](_0x352d11);});});})[_0x84a6('0x2b')](function(){for(var _0xf66a54=0x0;_0xf66a54<_0x57979d[_0x84a6('0x50')];_0xf66a54++){var _0xd5dbea=_0x57979d[_0xf66a54][_0x84a6('0x11b')](_0x84a6('0x9f'));var _0x55a8a7=_0xd5dbea+'QueueId';socket['emit'](_0x84a6('0x32')+_0xd5dbea+_0x84a6('0xaa'),{'UserId':_0x26bcf9,['queueField']:_0x57979d[_0xf66a54]['id']});}})[_0x84a6('0x2b')](respondWithStatusCode(_0x3a4ac0,null))[_0x84a6('0x29')](APIHandleError(_0x3a4ac0));};exports[_0x84a6('0x11e')]=function(_0x3e1d3a,_0x36657f){var _0x44a7d2=_0x3e1d3a[_0x84a6('0x58')]['id'];var _0x42e1d7=null;if(_0x3e1d3a[_0x84a6('0x47')][_0x84a6('0x62')]){_0x42e1d7=_['isArray'](_0x3e1d3a[_0x84a6('0x47')][_0x84a6('0x62')])?_0x3e1d3a[_0x84a6('0x47')]['ids']:[_0x3e1d3a[_0x84a6('0x47')][_0x84a6('0x62')]];}var _0x2b22f8=[];return Promise[_0x84a6('0x104')]()[_0x84a6('0x2b')](function(){if(!_0x42e1d7)throw new APIBadRequestError(_0x84a6('0x11f'));})[_0x84a6('0x2b')](function(){return db[_0x84a6('0x3d')]['findOne']({'where':{'id':_0x44a7d2}});})[_0x84a6('0x2b')](function(_0x214451){if(!_0x214451)throw new APINotFoundError(util[_0x84a6('0xad')](_0x84a6('0xca'),_0x3e1d3a[_0x84a6('0x58')]['id']));return db[_0x84a6('0x6e')][_0x84a6('0x117')](function(_0x314093){return _0x214451[_0x84a6('0x11e')](_0x42e1d7,{'transaction':_0x314093})[_0x84a6('0x2b')](function(){return db[_0x84a6('0x118')][_0x84a6('0x4d')]({'where':{'id':{'$in':_0x42e1d7}}});})[_0x84a6('0x2b')](function(_0x19798a){var _0x49e7b1=_['map'](_0x19798a,function(_0x152d75){return _0x152d75['getAssociatedQueues']();});return Promise[_0x84a6('0x56')](_0x49e7b1);})[_0x84a6('0x2b')](function(_0x1f6565){_0x2b22f8=_[_0x84a6('0x120')](_0x1f6565);var _0x41d6f5=_[_0x84a6('0x36')](_0x2b22f8,function(_0x32f290){return _0x32f290[_0x84a6('0x121')](_0x214451['id'],{'transaction':_0x314093});});return Promise[_0x84a6('0x56')](_0x41d6f5);})[_0x84a6('0x2b')](function(){if(!_0x214451[_0x84a6('0xa0')])return;var _0x33e6bc=_[_0x84a6('0x34')](_0x2b22f8,function(_0x19c18f){return _0x19c18f['getDataValue'](_0x84a6('0x9f'))===_0x84a6('0x122');});var _0x1dc179=_['map'](_0x33e6bc,function(_0x4307f2){return db[_0x84a6('0xaf')][_0x84a6('0x2f')]({'where':{'VoiceQueueId':_0x4307f2['id'],'UserId':_0x214451['id']},'transaction':_0x314093});});return Promise[_0x84a6('0x56')](_0x1dc179);})[_0x84a6('0x2b')](function(){return db[_0x84a6('0x123')][_0x84a6('0x4d')]({'where':{'teamId':{'$in':_0x42e1d7}}});})[_0x84a6('0x2b')](function(_0x35d565){var _0x1d9a77=_[_0x84a6('0x36')](_0x35d565,function(_0x1bafa2){return db[_0x84a6('0x11c')][_0x84a6('0x2f')]({'where':{'UserId':_0x214451['id'],'VoicePrefixId':_0x1bafa2[_0x84a6('0x11d')]}},{'transaction':_0x314093});});return Promise[_0x84a6('0x56')](_0x1d9a77);});});})['then'](function(){for(var _0x42aa40=0x0;_0x42aa40<_0x2b22f8[_0x84a6('0x50')];_0x42aa40++){var _0x209dc7=_0x2b22f8[_0x42aa40][_0x84a6('0x11b')]('channel');var _0x499ea9=_0x209dc7+_0x84a6('0xa9');socket[_0x84a6('0x2e')](_0x84a6('0x32')+_0x209dc7+'Queue:remove',{'UserId':_0x44a7d2,['queueField']:_0x2b22f8[_0x42aa40]['id']});}})[_0x84a6('0x2b')](respondWithStatusCode(_0x36657f,null))[_0x84a6('0x29')](APIHandleError(_0x36657f));};exports[_0x84a6('0x124')]=function(_0x40f99f,_0x37b447){var _0xe1a2b9={};var _0x232326={};var _0x2dc437;var _0x5dfc81;return db[_0x84a6('0x3d')]['findOne']({'where':{'id':_0x40f99f[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x37b447,null))[_0x84a6('0x2b')](function(_0x2841c5){if(_0x2841c5){_0x2dc437=_0x2841c5;_0x232326[_0x84a6('0xd5')]=_['keys'](db[_0x84a6('0xcb')][_0x84a6('0x3e')]);_0x232326[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0x40f99f[_0x84a6('0x47')]);_0x232326[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x232326['model'],_0x232326['query']);_0xe1a2b9[_0x84a6('0x4b')]=_['intersection'](_0x232326[_0x84a6('0xd5')],qs['fields'](_0x40f99f[_0x84a6('0x47')][_0x84a6('0xd6')]));_0xe1a2b9[_0x84a6('0x4b')]=_0xe1a2b9['attributes'][_0x84a6('0x50')]?_0xe1a2b9[_0x84a6('0x4b')]:_0x232326['model'];_0xe1a2b9['order']=qs[_0x84a6('0xd7')](_0x40f99f[_0x84a6('0x47')]['sort']);_0xe1a2b9['where']=qs[_0x84a6('0xd3')](_['pick'](_0x40f99f[_0x84a6('0x47')],_0x232326[_0x84a6('0xd3')]));if(_0x40f99f[_0x84a6('0x47')][_0x84a6('0x34')]){_0xe1a2b9[_0x84a6('0xd9')]=_['merge'](_0xe1a2b9['where'],{'$or':_[_0x84a6('0x36')](_0xe1a2b9[_0x84a6('0x4b')],function(_0x36f8b0){var _0x58b03b={};_0x58b03b[_0x36f8b0]={'$like':'%'+_0x40f99f[_0x84a6('0x47')][_0x84a6('0x34')]+'%'};return _0x58b03b;})});}_0xe1a2b9=_[_0x84a6('0x5b')]({},_0xe1a2b9,_0x40f99f['options']);return _0x2dc437[_0x84a6('0x124')](_0xe1a2b9);}})['then'](function(_0x4d4822){if(_0x4d4822){_0x5dfc81=_0x4d4822[_0x84a6('0x50')];if(!_0x40f99f[_0x84a6('0x47')]['hasOwnProperty'](_0x84a6('0xdf'))){_0xe1a2b9[_0x84a6('0x1a')]=qs[_0x84a6('0x1a')](_0x40f99f[_0x84a6('0x47')][_0x84a6('0x1a')]);_0xe1a2b9['offset']=qs[_0x84a6('0x19')](_0x40f99f['query'][_0x84a6('0x19')]);}return _0x2dc437['getLists'](_0xe1a2b9);}})['then'](function(_0x542a83){if(_0x542a83){return _0x542a83?{'count':_0x5dfc81,'rows':_0x542a83}:null;}})['then'](respondWithResult(_0x37b447,null))[_0x84a6('0x29')](handleError(_0x37b447,null));};exports[_0x84a6('0x125')]=function(_0xbdf025,_0x4188ae){var _0x27394c={};var _0x25a436={};var _0x5e4ad9;return db[_0x84a6('0x3d')][_0x84a6('0x9a')]({'where':{'id':_0xbdf025[_0x84a6('0x58')]['id']}})[_0x84a6('0x2b')](handleEntityNotFound(_0x4188ae,null))[_0x84a6('0x2b')](function(_0x502f4d){if(_0x502f4d){_0x5e4ad9=_0x502f4d;_0x25a436[_0x84a6('0xd5')]=_[_0x84a6('0xd2')](db[_0x84a6('0x3d')][_0x84a6('0x3e')]);_0x25a436[_0x84a6('0x47')]=_[_0x84a6('0xd2')](_0xbdf025[_0x84a6('0x47')]);_0x25a436[_0x84a6('0xd3')]=_[_0x84a6('0xd4')](_0x25a436[_0x84a6('0xd5')],_0x25a436[_0x84a6('0x47')]);_0x27394c[_0x84a6('0x4b')]=_[_0x84a6('0xd4')](_0x25a436[_0x84a6('0xd5')],qs[_0x84a6('0xd6')](_0xbdf025[_0x84a6('0x47')]['fields']));_0x27394c[_0x84a6('0x4b')]=_0x27394c[_0x84a6('0x4b')][_0x84a6('0x50')]?_0x27394c[_0x84a6('0x4b')]:_0x25a436[_0x84a6('0xd5')];_0x27394c[_0x84a6('0xdd')]=qs[_0x84a6('0xd7')](_0xbdf025[_0x84a6('0x47')][_0x84a6('0xd7')]);_0x27394c['where']=qs[_0x84a6('0xd3')](_[_0x84a6('0xd8')](_0xbdf025[_0x84a6('0x47')],_0x25a436[_0x84a6('0xd3')]));if(_0xbdf025['query'][_0x84a6('0x34')]){_0x27394c[_0x84a6('0xd9')]=_[_0x84a6('0x5b')](_0x27394c['where'],{'$or':_[_0x84a6('0x36')](_0x27394c[_0x84a6('0x4b')],function(_0x1434e6){var _0x494131={};_0x494131[_0x1434e6]={'$like':'%'+_0xbdf025['query'][_0x84a6('0x34')]+'%'};return _0x494131;})});}_0x27394c[_0x84a6('0xd5')]=db[_0x84a6('0x3d')];_0x27394c['as']=_0x84a6('0x8e');_0x27394c=_['merge']({},_0x27394c,_0xbdf025['options']);return _0x5e4ad9[_0x84a6('0xfa')]({'include':[_0x27394c]});}})[_0x84a6('0x2b')](function(_0x1fa8e5){if(_0x1fa8e5){var _0x223f12={},_0x4033de=[];for(var _0x181856=0x0;_0x181856<_0x1fa8e5[_0x84a6('0x50')];_0x181856+=0x1){for(var _0x2b3888=0x0,_0x3efe80;_0x2b3888<_0x1fa8e5[_0x181856][_0x84a6('0x8e')][_0x84a6('0x50')];_0x2b3888+=0x1){_0x3efe80=_0x1fa8e5[_0x181856][_0x84a6('0x8e')][_0x2b3888]['get']({'plain':!![]});_0x223f12[_0x3efe80['id']]=_0x3efe80;}}_0x223f12=_['values'](_0x223f12);for(var _0x579450=qs[_0x84a6('0x19')](_0xbdf025[_0x84a6('0x47')]['offset']);_0x579450<_0x223f12['length']&&_0x4033de[_0x84a6('0x50')]=_0x49fd65[_0xd0ef('0x4f')]){throw new Error(_0xd0ef('0x50'));}})['then'](function(){if(_0x54e21b){return db[_0xd0ef('0x22')][_0xd0ef('0x45')]({'where':{'membername':_0x54e21b[_0xd0ef('0x20')]},'individualHooks':!![]});}})[_0xd0ef('0x1b')](function(){if(_0x54e21b){return _0x54e21b[_0xd0ef('0x51')]({'raw':!![]});}})['then'](function(_0x38a313){if(_0x54e21b){if(_0x38a313){var _0x280426=[];_0x2ae68c=_0x38a313;if(_0x2ae68c['length']){for(var _0x481e77=0x0;_0x481e77<_0x2ae68c[_0xd0ef('0x52')];_0x481e77++){_0x280426[_0xd0ef('0x47')](db[_0xd0ef('0x22')]['upsert']({'membername':_0x54e21b['name'],'UserId':_0x54e21b['id'],'queue_name':_0x2ae68c[_0x481e77]['name'],'VoiceQueueId':_0x2ae68c[_0x481e77]['id'],'interface':_0x5ccdda,'paused':_0x54e21b['loginInPause']||![],'penalty':_0x2ae68c[_0x481e77][_0xd0ef('0x53')]||0x0}));}return BPromise[_0xd0ef('0x48')](_0x280426);}}}})[_0xd0ef('0x1b')](function(){if(_0x54e21b){return db[_0xd0ef('0x24')][_0xd0ef('0x25')]({'where':{'membername':_0x54e21b[_0xd0ef('0x20')],'exitAt':null}});}})[_0xd0ef('0x1b')](function(_0x1efa6f){if(_0x54e21b){if(_0x1efa6f&&_0x1efa6f[_0xd0ef('0x52')]){var _0x40542f=[];_0x1efa6f['forEach'](function(_0x319a59){_0x40542f[_0xd0ef('0x47')](_0x319a59[_0xd0ef('0x23')]({'exitAt':moment()[_0xd0ef('0x27')](_0xd0ef('0x28'))}));});return BPromise[_0xd0ef('0x48')](_0x40542f);}}})['then'](function(){if(_0x54e21b){var _0x46798c=[];var _0x255f14=[];var _0x41c46c=utils[_0xd0ef('0x2a')]();var _0x25ab95={'membername':_0x54e21b[_0xd0ef('0x20')],'interface':_0x5ccdda,'enterAt':moment()['format'](_0xd0ef('0x28')),'role':_0x54e21b[_0xd0ef('0x31')],'internal':_0x54e21b[_0xd0ef('0x32')]};_0x41c46c[_0xd0ef('0x46')](function(_0x54077c){_0x46798c[_0xd0ef('0x47')](_[_0xd0ef('0x54')]({'channel':_0x54077c,'type':_0xd0ef('0x55'),'data1':_0xd0ef('0x56'),'data2':_0x5ccdda},_0x25ab95));if(_0x54e21b[_0xd0ef('0x57')]){_0x255f14[_0xd0ef('0x47')](_['merge']({'channel':_0x54077c,'type':'PAUSE','data1':'LOGININPAUSE'},_0x25ab95));}});return db['MemberReport'][_0xd0ef('0x34')](_0x46798c[_0xd0ef('0x58')](_0x255f14),{'individualHooks':!![]});}})[_0xd0ef('0x1b')](function(){if(_0x54e21b){return _0x54e21b[_0xd0ef('0x23')]({'online':!![],'lastLoginAt':moment()[_0xd0ef('0x27')](_0xd0ef('0x28')),'voicePause':_0x54e21b[_0xd0ef('0x57')]||![],'mailPause':_0x54e21b['loginInPause']||![],'chatPause':_0x54e21b[_0xd0ef('0x57')]||![],'faxPause':_0x54e21b[_0xd0ef('0x57')]||![],'smsPause':_0x54e21b[_0xd0ef('0x57')]||![],'openchannelPause':_0x54e21b['loginInPause']||![],'pauseType':_0x54e21b[_0xd0ef('0x57')]?_0xd0ef('0x59'):null,'lastPauseAt':moment()[_0xd0ef('0x27')](_0xd0ef('0x28')),'interface':_0x5ccdda});}})['then'](function(_0xe2f831){_0x29894b(_0xe2f831);})['catch'](function(_0x1bd11b){_0x54615f(_0x1c3f07[_0xd0ef('0x17')](0x1f4,_0x1bd11b[_0xd0ef('0x18')]));});});}; \ No newline at end of file +var _0xa735=['MemberReport','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','faxPause','smsPause','pauseType','lastPauseAt','params','unpause','system','LogoutUser','destroy','all','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','localhost','socket.io-emitter','redis','./user.socket','register','User','findAll','options','attributes','limit','include','map','model','then','info','GetUser','catch','message','error','ShowUser','find','raw','where','debug','PauseUser','name','role','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','PAUSE','length','format','getChannels','forEach','push','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid'];(function(_0x1033b3,_0x2278c2){var _0x4deb09=function(_0x3c24f9){while(--_0x3c24f9){_0x1033b3['push'](_0x1033b3['shift']());}};_0x4deb09(++_0x2278c2);}(_0xa735,0x76));var _0x5a73=function(_0x20dff4,_0x585fe0){_0x20dff4=_0x20dff4-0x0;var _0x91bf78=_0xa735[_0x20dff4];return _0x91bf78;};'use strict';var _=require(_0x5a73('0x0'));var util=require(_0x5a73('0x1'));var moment=require(_0x5a73('0x2'));var BPromise=require('bluebird');var Redis=require(_0x5a73('0x3'));var db=require(_0x5a73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a73('0x5'))(_0x5a73('0x6'));var config=require(_0x5a73('0x7'));config['redis']=_[_0x5a73('0x8')](config['redis'],{'host':_0x5a73('0x9'),'port':0x18eb});var socket=require(_0x5a73('0xa'))(new Redis(config[_0x5a73('0xb')]));require(_0x5a73('0xc'))[_0x5a73('0xd')](socket);exports['GetUser']=function(_0xca8555){var _0x33e6cd=this;return new Promise(function(_0x22de0c,_0x35bcf2){return db[_0x5a73('0xe')][_0x5a73('0xf')]({'raw':_0xca8555[_0x5a73('0x10')]?_0xca8555['options']['raw']===undefined?!![]:![]:!![],'where':_0xca8555[_0x5a73('0x10')]?_0xca8555['options']['where']||null:null,'attributes':_0xca8555['options']?_0xca8555[_0x5a73('0x10')][_0x5a73('0x11')]||null:null,'limit':_0xca8555['options']?_0xca8555[_0x5a73('0x10')][_0x5a73('0x12')]||null:null,'include':_0xca8555[_0x5a73('0x10')]?_0xca8555[_0x5a73('0x10')][_0x5a73('0x13')]?_[_0x5a73('0x14')](_0xca8555['options'][_0x5a73('0x13')],function(_0x241535){return{'model':db[_0x241535[_0x5a73('0x15')]],'as':_0x241535['as'],'attributes':_0x241535['attributes'],'include':_0x241535[_0x5a73('0x13')]?_[_0x5a73('0x14')](_0x241535[_0x5a73('0x13')],function(_0x85a82c){return{'model':db[_0x85a82c[_0x5a73('0x15')]],'as':_0x85a82c['as'],'attributes':_0x85a82c[_0x5a73('0x11')],'include':_0x85a82c[_0x5a73('0x13')]?_['map'](_0x85a82c[_0x5a73('0x13')],function(_0x58943b){return{'model':db[_0x58943b['model']],'as':_0x58943b['as'],'attributes':_0x58943b[_0x5a73('0x11')]};}):[]};}):[]};}):[]:[]})[_0x5a73('0x16')](function(_0x50ad45){logger[_0x5a73('0x17')](_0x5a73('0x18'),_0xca8555);logger['debug'](_0x5a73('0x18'),_0xca8555,JSON['stringify'](_0x50ad45));_0x22de0c(_0x50ad45);})[_0x5a73('0x19')](function(_0x4679fb){logger['error'](_0x5a73('0x18'),_0x4679fb[_0x5a73('0x1a')],_0xca8555);_0x35bcf2(_0x33e6cd[_0x5a73('0x1b')](0x1f4,_0x4679fb[_0x5a73('0x1a')]));});});};exports[_0x5a73('0x1c')]=function(_0x448b00){var _0x243ba5=this;return new Promise(function(_0x57a00f,_0x5d0e8d){return db[_0x5a73('0xe')][_0x5a73('0x1d')]({'raw':_0x448b00[_0x5a73('0x10')]?_0x448b00['options'][_0x5a73('0x1e')]===undefined?!![]:![]:!![],'where':_0x448b00[_0x5a73('0x10')]?_0x448b00['options'][_0x5a73('0x1f')]||null:null,'attributes':_0x448b00[_0x5a73('0x10')]?_0x448b00['options'][_0x5a73('0x11')]||null:null,'include':_0x448b00[_0x5a73('0x10')]?_0x448b00[_0x5a73('0x10')]['include']?_[_0x5a73('0x14')](_0x448b00[_0x5a73('0x10')][_0x5a73('0x13')],function(_0x4e8c38){return{'model':db[_0x4e8c38[_0x5a73('0x15')]],'as':_0x4e8c38['as'],'attributes':_0x4e8c38[_0x5a73('0x11')],'include':_0x4e8c38['include']?_[_0x5a73('0x14')](_0x4e8c38[_0x5a73('0x13')],function(_0x597020){return{'model':db[_0x597020['model']],'as':_0x597020['as'],'attributes':_0x597020[_0x5a73('0x11')],'include':_0x597020['include']?_['map'](_0x597020['include'],function(_0x7447b9){return{'model':db[_0x7447b9[_0x5a73('0x15')]],'as':_0x7447b9['as'],'attributes':_0x7447b9[_0x5a73('0x11')]};}):[]};}):[]};}):[]:[]})[_0x5a73('0x16')](function(_0x56b4ae){logger[_0x5a73('0x17')]('ShowUser',_0x448b00);logger[_0x5a73('0x20')](_0x5a73('0x1c'),_0x448b00,JSON['stringify'](_0x56b4ae));_0x57a00f(_0x56b4ae);})[_0x5a73('0x19')](function(_0x15f966){logger[_0x5a73('0x1b')](_0x5a73('0x1c'),_0x15f966[_0x5a73('0x1a')],_0x448b00);_0x5d0e8d(_0x243ba5[_0x5a73('0x1b')](0x1f4,_0x15f966[_0x5a73('0x1a')]));});});};exports[_0x5a73('0x21')]=function(_0x4c4e01){var _0x50c498;return db[_0x5a73('0xe')][_0x5a73('0x1d')]({'where':_0x4c4e01[_0x5a73('0x10')]['where']||{},'attributes':['id',_0x5a73('0x22'),_0x5a73('0x23'),_0x5a73('0x24'),_0x5a73('0x25')]})[_0x5a73('0x16')](function(_0x26f30e){if(!_0x26f30e){throw new Error(util['format'](_0x5a73('0x26'),_0x4c4e01['params']['id']));}_0x50c498=_0x26f30e;return db[_0x5a73('0x27')][_0x5a73('0x28')]({'paused':0x1},{'where':{'UserId':_0x50c498['id']},'individualHooks':!![]});})[_0x5a73('0x16')](function(){return db['MemberReport'][_0x5a73('0xf')]({'where':{'membername':_0x50c498[_0x5a73('0x22')],'type':_0x5a73('0x29'),'exitAt':null}});})[_0x5a73('0x16')](function(_0x5cc886){if(_0x5cc886&&_0x5cc886[_0x5a73('0x2a')]){var _0x2e86ac=moment()[_0x5a73('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x449cae=0x0,_0x1fafa0=_0x5cc886[_0x5a73('0x2a')];_0x449cae<_0x1fafa0;_0x449cae++){_0x5cc886[_0x449cae]['updateAttributes']({'exitAt':_0x2e86ac});}}})[_0x5a73('0x16')](function(){var _0x3d364a=[];var _0x22ad3f=utils[_0x5a73('0x2c')]();_0x22ad3f[_0x5a73('0x2d')](function(_0x35fa6f){_0x3d364a[_0x5a73('0x2e')]({'channel':_0x35fa6f,'membername':_0x50c498[_0x5a73('0x22')],'interface':_['isNil'](_0x50c498[_0x5a73('0x25')])?util[_0x5a73('0x2b')](_0x5a73('0x2f'),_0x50c498[_0x5a73('0x22')]):_0x50c498['interface'],'type':_0x5a73('0x29'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4c4e01[_0x5a73('0x30')][_0x5a73('0x31')]||_0x5a73('0x32'),'role':_0x50c498[_0x5a73('0x23')],'internal':_0x50c498['internal'],'uniqueid':_0x4c4e01[_0x5a73('0x30')][_0x5a73('0x33')]||null});});return db[_0x5a73('0x34')][_0x5a73('0x35')](_0x3d364a,{'individualHooks':!![]});})[_0x5a73('0x16')](function(){return _0x50c498['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4c4e01[_0x5a73('0x30')]['type']||_0x5a73('0x32'),'lastPauseAt':moment()[_0x5a73('0x2b')](_0x5a73('0x36'))});})['catch'](function(_0x2fd197){throw _0x2fd197;});};exports['UnpauseUser']=function(_0x18496e){return Promise[_0x5a73('0x37')]()[_0x5a73('0x16')](function(){if(_0x18496e['body'][_0x5a73('0x38')]&&!utils['isValidChannel'](_0x18496e[_0x5a73('0x30')][_0x5a73('0x38')])){throw new Error(util[_0x5a73('0x2b')](_0x5a73('0x39'),_0x18496e['body'][_0x5a73('0x38')]));}return db[_0x5a73('0xe')][_0x5a73('0x3a')]({'where':_0x18496e[_0x5a73('0x10')][_0x5a73('0x1f')]||{},'attributes':['id','name','role',_0x5a73('0x24'),_0x5a73('0x25'),_0x5a73('0x3b'),'voicePause',_0x5a73('0x3c'),'chatPause',_0x5a73('0x3d'),'openchannelPause',_0x5a73('0x3e'),'whatsappPause',_0x5a73('0x3f'),_0x5a73('0x40')]});})[_0x5a73('0x16')](function(_0x801d5b){if(!_0x801d5b){throw new Error(util[_0x5a73('0x2b')]('User\x20with\x20id\x20%s\x20not\x20found',_0x18496e[_0x5a73('0x41')]['id']));}return _0x801d5b[_0x5a73('0x42')](_0x18496e[_0x5a73('0x30')][_0x5a73('0x38')],_0x5a73('0x43'));})[_0x5a73('0x19')](function(_0x4ca54b){throw _0x4ca54b;});};exports[_0x5a73('0x44')]=function(_0x366aa8){var _0xc4d5ca=this;return new Promise(function(_0x208c6a,_0x17267f){var _0x3e9ed0;return db['User'][_0x5a73('0x3a')]({'where':_0x366aa8[_0x5a73('0x10')][_0x5a73('0x1f')]||{},'attributes':['id',_0x5a73('0x22')]})[_0x5a73('0x16')](function(_0x2d123e){if(_0x2d123e){_0x3e9ed0=_0x2d123e;return db[_0x5a73('0x27')][_0x5a73('0x45')]({'where':{'membername':_0x3e9ed0[_0x5a73('0x22')]},'individualHooks':!![]});}})[_0x5a73('0x16')](function(){if(_0x3e9ed0){return db[_0x5a73('0x34')]['findAll']({'where':{'membername':_0x3e9ed0[_0x5a73('0x22')],'exitAt':null}});}})[_0x5a73('0x16')](function(_0x1f6fa9){if(_0x3e9ed0){if(_0x1f6fa9&&_0x1f6fa9[_0x5a73('0x2a')]){var _0x268709=[];_0x1f6fa9[_0x5a73('0x2d')](function(_0x4c09e7){_0x268709['push'](_0x4c09e7['update']({'exitAt':moment()['format'](_0x5a73('0x36'))}));});return BPromise[_0x5a73('0x46')](_0x268709);}}})[_0x5a73('0x16')](function(){if(_0x3e9ed0){return _0x3e9ed0['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x52707c){_0x208c6a(_0x52707c);})['catch'](function(_0x2a1027){_0x17267f(_0xc4d5ca[_0x5a73('0x1b')](0x1f4,_0x2a1027['message']));});});};exports['LoginUser']=function(_0x32244a){var _0x2d9dd9=this;return new Promise(function(_0x3d2e1,_0x82548f){var _0x38a8a4;var _0xe5a823;var _0x40de31;var _0x2d1a2d;return db[_0x5a73('0xe')][_0x5a73('0x3a')]({'where':_0x32244a['options'][_0x5a73('0x1f')]||{},'attributes':['id',_0x5a73('0x22'),'role',_0x5a73('0x47'),'phone',_0x5a73('0x24'),_0x5a73('0x48'),'interface']})[_0x5a73('0x16')](function(_0x3064cc){if(_0x3064cc){_0x38a8a4=_0x3064cc;_0x2d1a2d=_0x32244a['body'][_0x5a73('0x25')]?_0x32244a['body'][_0x5a73('0x25')]:util['format'](_0x5a73('0x2f'),_0x38a8a4[_0x5a73('0x22')]);return db[_0x5a73('0xe')][_0x5a73('0x49')]({'where':{'role':_0x5a73('0x4a'),'online':!![],'id':{'$ne':_0x38a8a4['id']}}});}})[_0x5a73('0x16')](function(_0x5d2f2f){if(_0x5d2f2f){_0x40de31=_0x5d2f2f;return require('../../config/license/util')[_0x5a73('0x4b')]();}})[_0x5a73('0x16')](function(_0x57d2b2){if(_0x57d2b2&&_0x57d2b2[_0x5a73('0x4c')]&&_0x40de31>=_0x57d2b2[_0x5a73('0x4c')]){throw new Error(_0x5a73('0x4d'));}})[_0x5a73('0x16')](function(){if(_0x38a8a4){return db[_0x5a73('0x27')][_0x5a73('0x45')]({'where':{'membername':_0x38a8a4['name']},'individualHooks':!![]});}})['then'](function(){if(_0x38a8a4){return _0x38a8a4[_0x5a73('0x4e')]({'raw':!![]});}})[_0x5a73('0x16')](function(_0x296003){if(_0x38a8a4){if(_0x296003){var _0x2b6540=[];_0xe5a823=_0x296003;if(_0xe5a823[_0x5a73('0x2a')]){for(var _0xad6f04=0x0;_0xad6f04<_0xe5a823['length'];_0xad6f04++){_0x2b6540['push'](db['UserVoiceQueueRt'][_0x5a73('0x4f')]({'membername':_0x38a8a4[_0x5a73('0x22')],'UserId':_0x38a8a4['id'],'queue_name':_0xe5a823[_0xad6f04]['name'],'VoiceQueueId':_0xe5a823[_0xad6f04]['id'],'interface':_0x2d1a2d,'paused':_0x38a8a4[_0x5a73('0x48')]||![],'penalty':_0xe5a823[_0xad6f04][_0x5a73('0x50')]||0x0}));}return BPromise[_0x5a73('0x46')](_0x2b6540);}}}})[_0x5a73('0x16')](function(){if(_0x38a8a4){return db[_0x5a73('0x34')][_0x5a73('0xf')]({'where':{'membername':_0x38a8a4[_0x5a73('0x22')],'exitAt':null}});}})['then'](function(_0xf81a60){if(_0x38a8a4){if(_0xf81a60&&_0xf81a60[_0x5a73('0x2a')]){var _0x325480=[];_0xf81a60['forEach'](function(_0x55f4ab){_0x325480[_0x5a73('0x2e')](_0x55f4ab[_0x5a73('0x28')]({'exitAt':moment()['format'](_0x5a73('0x36'))}));});return BPromise[_0x5a73('0x46')](_0x325480);}}})['then'](function(){if(_0x38a8a4){var _0x407d82=[];var _0xfef2e=[];var _0x20c9aa=utils['getChannels']();var _0x18080d={'membername':_0x38a8a4[_0x5a73('0x22')],'interface':_0x2d1a2d,'enterAt':moment()[_0x5a73('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x38a8a4[_0x5a73('0x23')],'internal':_0x38a8a4[_0x5a73('0x24')]};_0x20c9aa[_0x5a73('0x2d')](function(_0x3a4174){_0x407d82['push'](_[_0x5a73('0x51')]({'channel':_0x3a4174,'type':_0x5a73('0x52'),'data1':_0x5a73('0x53'),'data2':_0x2d1a2d},_0x18080d));if(_0x38a8a4[_0x5a73('0x48')]){_0xfef2e[_0x5a73('0x2e')](_[_0x5a73('0x51')]({'channel':_0x3a4174,'type':'PAUSE','data1':_0x5a73('0x54')},_0x18080d));}});return db['MemberReport'][_0x5a73('0x35')](_0x407d82['concat'](_0xfef2e),{'individualHooks':!![]});}})[_0x5a73('0x16')](function(){if(_0x38a8a4){return _0x38a8a4[_0x5a73('0x28')]({'online':!![],'lastLoginAt':moment()[_0x5a73('0x2b')](_0x5a73('0x36')),'voicePause':_0x38a8a4[_0x5a73('0x48')]||![],'mailPause':_0x38a8a4['loginInPause']||![],'chatPause':_0x38a8a4[_0x5a73('0x48')]||![],'faxPause':_0x38a8a4[_0x5a73('0x48')]||![],'smsPause':_0x38a8a4[_0x5a73('0x48')]||![],'openchannelPause':_0x38a8a4[_0x5a73('0x48')]||![],'pauseType':_0x38a8a4[_0x5a73('0x48')]?_0x5a73('0x54'):null,'lastPauseAt':moment()['format'](_0x5a73('0x36')),'interface':_0x2d1a2d});}})[_0x5a73('0x16')](function(_0x42c3c9){_0x3d2e1(_0x42c3c9);})[_0x5a73('0x19')](function(_0x5d54bf){_0x82548f(_0x2d9dd9[_0x5a73('0x1b')](0x1f4,_0x5d54bf[_0x5a73('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 38586f1..d7da419 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 _0x50c0=['register','length','./user.events','save','remove','update','emit','removeListener'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x50c0,0x15a));var _0x050c=function(_0x133804,_0x46eafb){_0x133804=_0x133804-0x0;var _0x45b070=_0x50c0[_0x133804];return _0x45b070;};'use strict';var UserEvents=require(_0x050c('0x0'));var events=[_0x050c('0x1'),_0x050c('0x2'),_0x050c('0x3')];function createListener(_0x664e59,_0x172c11){return function(_0xd6d89b){_0x172c11[_0x050c('0x4')](_0x664e59,_0xd6d89b);};}function removeListener(_0x1dc5a6,_0xab8d6a){return function(){UserEvents[_0x050c('0x5')](_0x1dc5a6,_0xab8d6a);};}exports[_0x050c('0x6')]=function(_0x24f279){for(var _0x216098=0x0,_0x4c6aca=events[_0x050c('0x7')];_0x216098<_0x4c6aca;_0x216098++){var _0x49b9c5=events[_0x216098];var _0x1c48f0=createListener('user:'+_0x49b9c5,_0x24f279);UserEvents['on'](_0x49b9c5,_0x1c48f0);}}; \ No newline at end of file +var _0x2216=['user:','./user.events','remove','emit','removeListener','register','length'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x2216,0x1d6));var _0x6221=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x2216[_0x2b10c6];return _0x3789d2;};'use strict';var UserEvents=require(_0x6221('0x0'));var events=['save',_0x6221('0x1'),'update'];function createListener(_0x526901,_0x3ad98c){return function(_0xf55868){_0x3ad98c[_0x6221('0x2')](_0x526901,_0xf55868);};}function removeListener(_0x838669,_0x24fff8){return function(){UserEvents[_0x6221('0x3')](_0x838669,_0x24fff8);};}exports[_0x6221('0x4')]=function(_0x5bf642){for(var _0x1921ae=0x0,_0x18cb26=events[_0x6221('0x5')];_0x1921ae<_0x18cb26;_0x1921ae++){var _0x2afcbe=events[_0x1921ae];var _0x11fa08=createListener(_0x6221('0x6')+_0x2afcbe,_0x5bf642);UserEvents['on'](_0x2afcbe,_0x11fa08);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2aa9ee8..794318d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x39ff9c,_0x35d13a){var _0x4ff2d2=function(_0x4017d4){while(--_0x4017d4){_0x39ff9c['push'](_0x39ff9c['shift']());}};_0x4ff2d2(++_0x35d13a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14c716,_0x13c096){var _0x6f1942=function(_0x364b63){while(--_0x364b63){_0x14c716['push'](_0x14c716['shift']());}};_0x6f1942(++_0x13c096);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4af7cd6..e1ba0b4 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 _0xa26d=['INTEGER','sequelize'];(function(_0x405344,_0xf16b4e){var _0x457580=function(_0x30f125){while(--_0x30f125){_0x405344['push'](_0x405344['shift']());}};_0x457580(++_0xf16b4e);}(_0xa26d,0x1d7));var _0xda26=function(_0x521157,_0x4ba61d){_0x521157=_0x521157-0x0;var _0x4c57b9=_0xa26d[_0x521157];return _0x4c57b9;};'use strict';var Sequelize=require(_0xda26('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xda26('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbfec=['sequelize','exports','INTEGER'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbfec,0x1b3));var _0xcbfe=function(_0xf30d0a,_0x2fdbea){_0xf30d0a=_0xf30d0a-0x0;var _0x3a7146=_0xbfec[_0xf30d0a];return _0x3a7146;};'use strict';var Sequelize=require(_0xcbfe('0x0'));module[_0xcbfe('0x1')]={'penalty':{'type':Sequelize[_0xcbfe('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 dbf5a3f..b2ddaac 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 _0xf376=['../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x392a0c,_0x54e824){var _0x1fc019=function(_0x2c68d6){while(--_0x2c68d6){_0x392a0c['push'](_0x392a0c['shift']());}};_0x1fc019(++_0x54e824);}(_0xf376,0x195));var _0x6f37=function(_0x3cc6f9,_0x371571){_0x3cc6f9=_0x3cc6f9-0x0;var _0x706501=_0xf376[_0x3cc6f9];return _0x706501;};'use strict';var _=require(_0x6f37('0x0'));var util=require('util');var logger=require(_0x6f37('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f37('0x2'));var fs=require('fs');var path=require(_0x6f37('0x3'));var rimraf=require(_0x6f37('0x4'));var config=require(_0x6f37('0x5'));var attributes=require(_0x6f37('0x6'));module['exports']=function(_0x42c7d9,_0xbb35a4){return _0x42c7d9[_0x6f37('0x7')](_0x6f37('0x8'),attributes,{'tableName':_0x6f37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf7=['./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0xdbf7,0x163));var _0x7dbf=function(_0x497775,_0x23f63a){_0x497775=_0x497775-0x0;var _0x22de52=_0xdbf7[_0x497775];return _0x22de52;};'use strict';var _=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var logger=require(_0x7dbf('0x2'))(_0x7dbf('0x3'));var moment=require(_0x7dbf('0x4'));var BPromise=require(_0x7dbf('0x5'));var rp=require(_0x7dbf('0x6'));var fs=require('fs');var path=require(_0x7dbf('0x7'));var rimraf=require(_0x7dbf('0x8'));var config=require('../../config/environment');var attributes=require(_0x7dbf('0x9'));module[_0x7dbf('0xa')]=function(_0x30065e,_0x56c6ae){return _0x30065e[_0x7dbf('0xb')]('UserChatQueue',attributes,{'tableName':_0x7dbf('0xc'),'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 9441971..3e0bdea 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 _0x0be6=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16120a,_0x160670){var _0x2604e6=function(_0x83764e){while(--_0x83764e){_0x16120a['push'](_0x16120a['shift']());}};_0x2604e6(++_0x160670);}(_0x0be6,0x197));var _0x60be=function(_0x9e1bde,_0x3a35db){_0x9e1bde=_0x9e1bde-0x0;var _0x5e27d6=_0x0be6[_0x9e1bde];return _0x5e27d6;};'use strict';var _=require(_0x60be('0x0'));var util=require(_0x60be('0x1'));var moment=require(_0x60be('0x2'));var BPromise=require(_0x60be('0x3'));var rs=require(_0x60be('0x4'));var fs=require('fs');var Redis=require(_0x60be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x60be('0x6'));var logger=require(_0x60be('0x7'))(_0x60be('0x8'));var config=require(_0x60be('0x9'));var jayson=require(_0x60be('0xa'));var client=jayson[_0x60be('0xb')][_0x60be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15ba45,_0x39675f,_0x33202a){return new BPromise(function(_0x2cdd14,_0x21def3){return client[_0x60be('0xd')](_0x15ba45,_0x33202a)[_0x60be('0xe')](function(_0x50219c){logger['info'](_0x60be('0xf'),_0x39675f,_0x60be('0x10'));logger[_0x60be('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x39675f,_0x60be('0x10'),JSON[_0x60be('0x12')](_0x50219c));if(_0x50219c['error']){if(_0x50219c[_0x60be('0x13')][_0x60be('0x14')]===0x1f4){logger[_0x60be('0x13')](_0x60be('0xf'),_0x39675f,_0x50219c['error'][_0x60be('0x15')]);return _0x21def3(_0x50219c[_0x60be('0x13')][_0x60be('0x15')]);}logger[_0x60be('0x13')](_0x60be('0xf'),_0x39675f,_0x50219c[_0x60be('0x13')][_0x60be('0x15')]);return _0x2cdd14(_0x50219c[_0x60be('0x13')]['message']);}else{logger[_0x60be('0x16')](_0x60be('0xf'),_0x39675f,_0x60be('0x10'));_0x2cdd14(_0x50219c[_0x60be('0x17')][_0x60be('0x15')]);}})[_0x60be('0x18')](function(_0x596180){logger[_0x60be('0x13')](_0x60be('0xf'),_0x39675f,_0x596180);_0x21def3(_0x596180);});});} \ No newline at end of file +var _0xbbfe=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4dd6dc,_0xac151e){var _0x3bdc54=function(_0x59ebed){while(--_0x59ebed){_0x4dd6dc['push'](_0x4dd6dc['shift']());}};_0x3bdc54(++_0xac151e);}(_0xbbfe,0x127));var _0xebbf=function(_0x31c32d,_0x340550){_0x31c32d=_0x31c32d-0x0;var _0x47b7f0=_0xbbfe[_0x31c32d];return _0x47b7f0;};'use strict';var _=require('lodash');var util=require(_0xebbf('0x0'));var moment=require(_0xebbf('0x1'));var BPromise=require(_0xebbf('0x2'));var rs=require(_0xebbf('0x3'));var fs=require('fs');var Redis=require(_0xebbf('0x4'));var db=require(_0xebbf('0x5'))['db'];var utils=require(_0xebbf('0x6'));var logger=require(_0xebbf('0x7'))('rpc');var config=require(_0xebbf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xebbf('0x9')][_0xebbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9089,_0x4b63fb,_0x2b09b5){return new BPromise(function(_0xa27bb9,_0x49908c){return client['request'](_0x3c9089,_0x2b09b5)[_0xebbf('0xb')](function(_0x4ef272){logger[_0xebbf('0xc')](_0xebbf('0xd'),_0x4b63fb,'request\x20sent');logger[_0xebbf('0xe')](_0xebbf('0xf'),_0x4b63fb,_0xebbf('0x10'),JSON[_0xebbf('0x11')](_0x4ef272));if(_0x4ef272['error']){if(_0x4ef272[_0xebbf('0x12')][_0xebbf('0x13')]===0x1f4){logger[_0xebbf('0x12')](_0xebbf('0xd'),_0x4b63fb,_0x4ef272['error']['message']);return _0x49908c(_0x4ef272[_0xebbf('0x12')]['message']);}logger['error'](_0xebbf('0xd'),_0x4b63fb,_0x4ef272['error'][_0xebbf('0x14')]);return _0xa27bb9(_0x4ef272[_0xebbf('0x12')][_0xebbf('0x14')]);}else{logger[_0xebbf('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x4b63fb,'request\x20sent');_0xa27bb9(_0x4ef272[_0xebbf('0x15')][_0xebbf('0x14')]);}})[_0xebbf('0x16')](function(_0x3811c2){logger[_0xebbf('0x12')](_0xebbf('0xd'),_0x4b63fb,_0x3811c2);_0x49908c(_0x3811c2);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c873a0d..18be556 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2e4ac8,_0x5cd8a1){var _0x196018=function(_0x4d52a6){while(--_0x4d52a6){_0x2e4ac8['push'](_0x2e4ac8['shift']());}};_0x196018(++_0x5cd8a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x147345,_0xe58f37){var _0x55bb34=function(_0x455371){while(--_0x455371){_0x147345['push'](_0x147345['shift']());}};_0x55bb34(++_0xe58f37);}(_0x70e0,0x17b));var _0x070e=function(_0x4cd2f3,_0x13e353){_0x4cd2f3=_0x4cd2f3-0x0;var _0x264fa7=_0x70e0[_0x4cd2f3];return _0x264fa7;};'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 315a52c..7f320a1 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 _0x6fca=['exports','INTEGER','sequelize'];(function(_0x1444fa,_0x55feb3){var _0x2d8802=function(_0x38d7c7){while(--_0x38d7c7){_0x1444fa['push'](_0x1444fa['shift']());}};_0x2d8802(++_0x55feb3);}(_0x6fca,0x10d));var _0xa6fc=function(_0x568a4d,_0x441a16){_0x568a4d=_0x568a4d-0x0;var _0xffa4b3=_0x6fca[_0x568a4d];return _0xffa4b3;};'use strict';var Sequelize=require(_0xa6fc('0x0'));module[_0xa6fc('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6fc('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8724=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8724,0x90));var _0x4872=function(_0x191d76,_0x3aae8e){_0x191d76=_0x191d76-0x0;var _0x4cb86b=_0x8724[_0x191d76];return _0x4cb86b;};'use strict';var Sequelize=require(_0x4872('0x0'));module[_0x4872('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4872('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 137dfbd..0912d09 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 _0xb98a=['../../config/logger','moment','request-promise','path','rimraf','./userFaxQueue.attributes','define','user_has_fax_queues','util'];(function(_0x4e6179,_0x298b88){var _0xc742d3=function(_0x480ff6){while(--_0x480ff6){_0x4e6179['push'](_0x4e6179['shift']());}};_0xc742d3(++_0x298b88);}(_0xb98a,0x104));var _0xab98=function(_0x748f64,_0x1ab840){_0x748f64=_0x748f64-0x0;var _0x50a19c=_0xb98a[_0x748f64];return _0x50a19c;};'use strict';var _=require('lodash');var util=require(_0xab98('0x0'));var logger=require(_0xab98('0x1'))('api');var moment=require(_0xab98('0x2'));var BPromise=require('bluebird');var rp=require(_0xab98('0x3'));var fs=require('fs');var path=require(_0xab98('0x4'));var rimraf=require(_0xab98('0x5'));var config=require('../../config/environment');var attributes=require(_0xab98('0x6'));module['exports']=function(_0x1a6d0e,_0x1bdb55){return _0x1a6d0e[_0xab98('0x7')]('UserFaxQueue',attributes,{'tableName':_0xab98('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeea=['../../config/environment','UserFaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfeea,0x70));var _0xafee=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xfeea[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xafee('0x0'));var util=require(_0xafee('0x1'));var logger=require(_0xafee('0x2'))('api');var moment=require(_0xafee('0x3'));var BPromise=require(_0xafee('0x4'));var rp=require(_0xafee('0x5'));var fs=require('fs');var path=require(_0xafee('0x6'));var rimraf=require(_0xafee('0x7'));var config=require(_0xafee('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x1a2d1c,_0x226b7a){return _0x1a2d1c['define'](_0xafee('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index fe07fc5..4b9103b 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 _0x812a=['request\x20sent','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug'];(function(_0x5596ec,_0x4aa524){var _0x508a30=function(_0xdd9f3e){while(--_0xdd9f3e){_0x5596ec['push'](_0x5596ec['shift']());}};_0x508a30(++_0x4aa524);}(_0x812a,0xc4));var _0xa812=function(_0x41e264,_0x3baf9a){_0x41e264=_0x41e264-0x0;var _0x42ac0c=_0x812a[_0x41e264];return _0x42ac0c;};'use strict';var _=require(_0xa812('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa812('0x1'));var rs=require(_0xa812('0x2'));var fs=require('fs');var Redis=require(_0xa812('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa812('0x4'));var logger=require(_0xa812('0x5'))('rpc');var config=require(_0xa812('0x6'));var jayson=require(_0xa812('0x7'));var client=jayson[_0xa812('0x8')][_0xa812('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x64571c,_0x639a23,_0x3e8ae6){return new BPromise(function(_0x317b99,_0x3b77bd){return client[_0xa812('0xa')](_0x64571c,_0x3e8ae6)[_0xa812('0xb')](function(_0x17dc03){logger['info'](_0xa812('0xc'),_0x639a23,'request\x20sent');logger[_0xa812('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x639a23,_0xa812('0xe'),JSON[_0xa812('0xf')](_0x17dc03));if(_0x17dc03['error']){if(_0x17dc03['error']['code']===0x1f4){logger[_0xa812('0x10')](_0xa812('0xc'),_0x639a23,_0x17dc03[_0xa812('0x10')]['message']);return _0x3b77bd(_0x17dc03['error']['message']);}logger[_0xa812('0x10')](_0xa812('0xc'),_0x639a23,_0x17dc03[_0xa812('0x10')]['message']);return _0x317b99(_0x17dc03['error'][_0xa812('0x11')]);}else{logger[_0xa812('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x639a23,'request\x20sent');_0x317b99(_0x17dc03[_0xa812('0x13')]['message']);}})[_0xa812('0x14')](function(_0x1914d5){logger[_0xa812('0x10')](_0xa812('0xc'),_0x639a23,_0x1914d5);_0x3b77bd(_0x1914d5);});});} \ No newline at end of file +var _0xce74=['UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x1417dc,_0x209c6b){var _0x3c4024=function(_0x4f4a83){while(--_0x4f4a83){_0x1417dc['push'](_0x1417dc['shift']());}};_0x3c4024(++_0x209c6b);}(_0xce74,0x171));var _0x4ce7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xce74[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x4ce7('0x0'));var moment=require('moment');var BPromise=require(_0x4ce7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ce7('0x2'));var db=require(_0x4ce7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ce7('0x4'))(_0x4ce7('0x5'));var config=require(_0x4ce7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ce7('0x7')][_0x4ce7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b0c8c,_0x2be2c2,_0x5d4ed9){return new BPromise(function(_0x574043,_0x433d63){return client['request'](_0x5b0c8c,_0x5d4ed9)[_0x4ce7('0x9')](function(_0x16b8c3){logger[_0x4ce7('0xa')](_0x4ce7('0xb'),_0x2be2c2,'request\x20sent');logger[_0x4ce7('0xc')](_0x4ce7('0xd'),_0x2be2c2,_0x4ce7('0xe'),JSON['stringify'](_0x16b8c3));if(_0x16b8c3[_0x4ce7('0xf')]){if(_0x16b8c3['error'][_0x4ce7('0x10')]===0x1f4){logger[_0x4ce7('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x2be2c2,_0x16b8c3[_0x4ce7('0xf')][_0x4ce7('0x11')]);return _0x433d63(_0x16b8c3['error'][_0x4ce7('0x11')]);}logger['error'](_0x4ce7('0xb'),_0x2be2c2,_0x16b8c3[_0x4ce7('0xf')][_0x4ce7('0x11')]);return _0x574043(_0x16b8c3[_0x4ce7('0xf')][_0x4ce7('0x11')]);}else{logger[_0x4ce7('0xa')](_0x4ce7('0xb'),_0x2be2c2,'request\x20sent');_0x574043(_0x16b8c3['result'][_0x4ce7('0x11')]);}})[_0x4ce7('0x12')](function(_0x4d138d){logger['error'](_0x4ce7('0xb'),_0x2be2c2,_0x4d138d);_0x433d63(_0x4d138d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dd00be9..1e35e34 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c9c2e,_0x1e7d40){var _0x269196=function(_0x1cb3c7){while(--_0x1cb3c7){_0x3c9c2e['push'](_0x3c9c2e['shift']());}};_0x269196(++_0x1e7d40);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x88342d,_0xe0feb3){var _0x238708=function(_0x38cc18){while(--_0x38cc18){_0x88342d['push'](_0x88342d['shift']());}};_0x238708(++_0xe0feb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index eb80f53..72d6f6d 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 _0x5f98=['sequelize','INTEGER'];(function(_0x34d171,_0x2dca17){var _0x35612a=function(_0x385f80){while(--_0x385f80){_0x34d171['push'](_0x34d171['shift']());}};_0x35612a(++_0x2dca17);}(_0x5f98,0x164));var _0x85f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f98[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x85f9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x85f9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x68f8=['INTEGER','sequelize','exports'];(function(_0x5ef723,_0xe21568){var _0x326f0d=function(_0x43f443){while(--_0x43f443){_0x5ef723['push'](_0x5ef723['shift']());}};_0x326f0d(++_0xe21568);}(_0x68f8,0x154));var _0x868f=function(_0x49b4d6,_0x1de371){_0x49b4d6=_0x49b4d6-0x0;var _0x59f6db=_0x68f8[_0x49b4d6];return _0x59f6db;};'use strict';var Sequelize=require(_0x868f('0x0'));module[_0x868f('0x1')]={'penalty':{'type':Sequelize[_0x868f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 72316aa..8c4e9bf 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 _0x6a97=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x6a97,0x7f));var _0x76a9=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x6a97[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x76a9('0x0'));var util=require(_0x76a9('0x1'));var logger=require(_0x76a9('0x2'))(_0x76a9('0x3'));var moment=require(_0x76a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x76a9('0x5'));var fs=require('fs');var path=require(_0x76a9('0x6'));var rimraf=require(_0x76a9('0x7'));var config=require(_0x76a9('0x8'));var attributes=require(_0x76a9('0x9'));module[_0x76a9('0xa')]=function(_0x3d097c,_0x2cec9e){return _0x3d097c['define'](_0x76a9('0xb'),attributes,{'tableName':_0x76a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6436=['rimraf','../../config/environment','exports','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','path'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6436,0xec));var _0x6643=function(_0x2c8d00,_0x51caf5){_0x2c8d00=_0x2c8d00-0x0;var _0x90dd85=_0x6436[_0x2c8d00];return _0x90dd85;};'use strict';var _=require(_0x6643('0x0'));var util=require(_0x6643('0x1'));var logger=require(_0x6643('0x2'))(_0x6643('0x3'));var moment=require(_0x6643('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6643('0x5'));var rimraf=require(_0x6643('0x6'));var config=require(_0x6643('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x6643('0x8')]=function(_0x1346db,_0x49fbf1){return _0x1346db['define'](_0x6643('0x9'),attributes,{'tableName':_0x6643('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 8b67edc..14f25bc 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x5e048b,_0xd45d8f){var _0x2fe688=function(_0x56080b){while(--_0x56080b){_0x5e048b['push'](_0x5e048b['shift']());}};_0x2fe688(++_0xd45d8f);}(_0x3e74,0x175));var _0x43e7=function(_0x4ebab2,_0x168b93){_0x4ebab2=_0x4ebab2-0x0;var _0x1d15c9=_0x3e74[_0x4ebab2];return _0x1d15c9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x33db28,_0x3f27ec){var _0x588298=function(_0x1073a8){while(--_0x1073a8){_0x33db28['push'](_0x33db28['shift']());}};_0x588298(++_0x3f27ec);}(_0x6aa7,0x178));var _0x76aa=function(_0x5dac31,_0x2db3c2){_0x5dac31=_0x5dac31-0x0;var _0x19bf07=_0x6aa7[_0x5dac31];return _0x19bf07;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d676d16..12f5237 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 _0xaad4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path'];(function(_0x526f2d,_0x43b673){var _0x362a0a=function(_0x4f15f2){while(--_0x4f15f2){_0x526f2d['push'](_0x526f2d['shift']());}};_0x362a0a(++_0x43b673);}(_0xaad4,0x169));var _0x4aad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaad4[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x4aad('0x0'));var util=require(_0x4aad('0x1'));var path=require(_0x4aad('0x2'));var timeout=require('connect-timeout');var express=require(_0x4aad('0x3'));var router=express[_0x4aad('0x4')]();var fs_extra=require(_0x4aad('0x5'));var auth=require(_0x4aad('0x6'));var interaction=require(_0x4aad('0x7'));var config=require(_0x4aad('0x8'));var controller=require(_0x4aad('0x9'));router[_0x4aad('0xa')]('/',auth[_0x4aad('0xb')](),controller[_0x4aad('0xc')]);module[_0x4aad('0xd')]=router; \ No newline at end of file +var _0x2f74=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated'];(function(_0xbcf5d7,_0x133fd8){var _0x1c03d5=function(_0x29ab5e){while(--_0x29ab5e){_0xbcf5d7['push'](_0xbcf5d7['shift']());}};_0x1c03d5(++_0x133fd8);}(_0x2f74,0x64));var _0x42f7=function(_0x44960d,_0x27ab5f){_0x44960d=_0x44960d-0x0;var _0x370dbf=_0x2f74[_0x44960d];return _0x370dbf;};'use strict';var multer=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var path=require(_0x42f7('0x2'));var timeout=require(_0x42f7('0x3'));var express=require('express');var router=express[_0x42f7('0x4')]();var fs_extra=require(_0x42f7('0x5'));var auth=require(_0x42f7('0x6'));var interaction=require(_0x42f7('0x7'));var config=require('../../config/environment');var controller=require(_0x42f7('0x8'));router['post']('/',auth[_0x42f7('0x9')](),controller['sendUserNotification']);module[_0x42f7('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 77b94dd..15c6bd6 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 _0x7437=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x7437,0x1bb));var _0x7743=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x7437[_0x311f44];return _0x46f1e6;};'use strict';var Sequelize=require(_0x7743('0x0'));module['exports']={'body':{'type':Sequelize[_0x7743('0x1')]},'senderName':{'type':Sequelize[_0x7743('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x7743('0x2')]},'beep':{'type':Sequelize[_0x7743('0x3')]}}; \ No newline at end of file +var _0x01fc=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0xa10d4d,_0x25d7fb){var _0x5a4c41=function(_0x5ca574){while(--_0x5ca574){_0xa10d4d['push'](_0xa10d4d['shift']());}};_0x5a4c41(++_0x25d7fb);}(_0x01fc,0x16d));var _0xc01f=function(_0x2bfd2a,_0x47aa13){_0x2bfd2a=_0x2bfd2a-0x0;var _0x2ecae7=_0x01fc[_0x2bfd2a];return _0x2ecae7;};'use strict';var Sequelize=require(_0xc01f('0x0'));module[_0xc01f('0x1')]={'body':{'type':Sequelize[_0xc01f('0x2')]},'senderName':{'type':Sequelize[_0xc01f('0x3')]},'recipientsId':{'type':Sequelize[_0xc01f('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc01f('0x3')]},'beep':{'type':Sequelize[_0xc01f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5f4fd0b..01d95c9 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 _0x02a3=['html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','ids','replace','Queue','push','union','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','error','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x02a3,0xcc));var _0x302a=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x02a3[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0x302a('0x0'));var rimraf=require(_0x302a('0x1'));var zipdir=require(_0x302a('0x2'));var jsonpatch=require(_0x302a('0x3'));var rp=require('request-promise');var moment=require(_0x302a('0x4'));var BPromise=require(_0x302a('0x5'));var Mustache=require('mustache');var util=require(_0x302a('0x6'));var path=require(_0x302a('0x7'));var sox=require(_0x302a('0x8'));var csv=require(_0x302a('0x9'));var ejs=require(_0x302a('0xa'));var fs=require('fs');var fs_extra=require(_0x302a('0xb'));var _=require(_0x302a('0xc'));var squel=require('squel');var crypto=require(_0x302a('0xd'));var jsforce=require(_0x302a('0xe'));var deskjs=require(_0x302a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x302a('0x10'));var Papa=require(_0x302a('0x11'));var Redis=require(_0x302a('0x12'));var authService=require(_0x302a('0x13'));var qs=require(_0x302a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x302a('0x15'));var utils=require(_0x302a('0x16'));var config=require(_0x302a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x302a('0x18'))['db'];config[_0x302a('0x19')]=_['defaults'](config[_0x302a('0x19')],{'host':_0x302a('0x1a'),'port':0x18eb});var socket=require(_0x302a('0x1b'))(new Redis(config['redis']));require('./userNotification.socket')[_0x302a('0x1c')](socket);function respondWithStatusCode(_0x54a3e1,_0x564e79){_0x564e79=_0x564e79||0xcc;return function(_0x2d0269){if(_0x2d0269){return _0x54a3e1[_0x302a('0x1d')](_0x564e79);}return _0x54a3e1[_0x302a('0x1e')](_0x564e79)[_0x302a('0x1f')]();};}function respondWithResult(_0x49959a,_0x4f21dc){_0x4f21dc=_0x4f21dc||0xc8;return function(_0x52d8d1){if(_0x52d8d1){return _0x49959a[_0x302a('0x1e')](_0x4f21dc)[_0x302a('0x20')](_0x52d8d1);}};}function respondWithFilteredResult(_0x320c8a,_0x3665fa){return function(_0x1064cf){if(_0x1064cf){var _0x324296=typeof _0x3665fa[_0x302a('0x21')]===_0x302a('0x22')&&typeof _0x3665fa['limit']===_0x302a('0x22');var _0xedf98e=_0x1064cf[_0x302a('0x23')];var _0x48294e=_0x324296?0x0:_0x3665fa[_0x302a('0x21')];var _0x101ff4=_0x324296?_0x1064cf[_0x302a('0x23')]:_0x3665fa[_0x302a('0x21')]+_0x3665fa[_0x302a('0x24')];var _0x24ea2a;if(_0x101ff4>=_0xedf98e){_0x101ff4=_0xedf98e;_0x24ea2a=0xc8;}else{_0x24ea2a=0xce;}_0x320c8a[_0x302a('0x1e')](_0x24ea2a);return _0x320c8a[_0x302a('0x25')]('Content-Range',_0x48294e+'-'+_0x101ff4+'/'+_0xedf98e)['json'](_0x1064cf);}return null;};}function patchUpdates(_0x2a192a){return function(_0xda103f){try{jsonpatch[_0x302a('0x26')](_0xda103f,_0x2a192a,!![]);}catch(_0x30ff93){return BPromise[_0x302a('0x27')](_0x30ff93);}return _0xda103f[_0x302a('0x28')]();};}function saveUpdates(_0xc717d9,_0x3615ab){return function(_0x45659f){if(_0x45659f){return _0x45659f['update'](_0xc717d9)[_0x302a('0x29')](function(_0x407a5a){return _0x407a5a;});}return null;};}function removeEntity(_0x5a88a1,_0x3d01e8){return function(_0x347ee6){if(_0x347ee6){return _0x347ee6['destroy']()['then'](function(){_0x5a88a1['status'](0xcc)[_0x302a('0x1f')]();});}};}function handleEntityNotFound(_0x25216b,_0x43f475){return function(_0x1feaed){if(!_0x1feaed){_0x25216b[_0x302a('0x1d')](0x194);}return _0x1feaed;};}function handleError(_0xd10165,_0x23b2d3){_0x23b2d3=_0x23b2d3||0x1f4;return function(_0x3db011){logger['error'](_0x3db011[_0x302a('0x2a')]);if(_0x3db011[_0x302a('0x2b')]){delete _0x3db011[_0x302a('0x2b')];}_0xd10165[_0x302a('0x1e')](_0x23b2d3)[_0x302a('0x2c')](_0x3db011);};}exports[_0x302a('0x2d')]=function(_0x16ba4d,_0x321f6b,_0x510202){if(!_0x16ba4d[_0x302a('0x2e')][_0x302a('0x2f')](_0x302a('0x30'))&&!_0x16ba4d['body'][_0x302a('0x2f')](_0x302a('0x31'))){throw new db['Sequelize'][(_0x302a('0x32'))](_0x302a('0x33'));}else{if(_0x16ba4d[_0x302a('0x2e')][_0x302a('0x2f')](_0x302a('0x31'))&&!_0x16ba4d[_0x302a('0x2e')]['hasOwnProperty'](_0x302a('0x34'))){throw new db['Sequelize'][(_0x302a('0x32'))](_0x302a('0x35'));}if(!_0x16ba4d[_0x302a('0x2e')][_0x302a('0x2f')](_0x302a('0x36'))){throw new db[(_0x302a('0x37'))][(_0x302a('0x32'))](_0x302a('0x38'));}else{try{var _0x3efdb1=JSON[_0x302a('0x39')](_0x16ba4d[_0x302a('0x2e')][_0x302a('0x36')]);}catch(_0x23a1dd){logger[_0x302a('0x3a')](_0x23a1dd);throw new db[(_0x302a('0x37'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0xdd2535=['chatqueue','faxqueue',_0x302a('0x3b'),_0x302a('0x3c'),_0x302a('0x3d'),_0x302a('0x3e'),_0x302a('0x3f'),'team',_0x302a('0x40')];if(_['some'](_0x3efdb1,function(_0x11472c){return!_[_0x302a('0x41')](_0xdd2535,_0x11472c[_0x302a('0x42')][_0x302a('0x43')]());})){throw new db[(_0x302a('0x37'))][(_0x302a('0x32'))](_0x302a('0x44'));}}}var _0x1aed22={};_0x1aed22[_0x302a('0x45')]=_0x16ba4d[_0x302a('0x2e')][_0x302a('0x2f')](_0x302a('0x45'))?_0x16ba4d[_0x302a('0x2e')][_0x302a('0x45')]:_0x16ba4d['user'][_0x302a('0x46')];_0x1aed22['recipientsDescription']=_[_0x302a('0x47')](_0x16ba4d[_0x302a('0x2e')][_0x302a('0x48')])?null:_0x16ba4d['body'][_0x302a('0x48')];_0x1aed22[_0x302a('0x49')]=_0x16ba4d['body'][_0x302a('0x49')]||![];_0x1aed22[_0x302a('0x4a')]=_0x16ba4d['user']['id'];return getContent(_0x16ba4d[_0x302a('0x2e')])[_0x302a('0x29')](function(_0x107ca3){_0x1aed22[_0x302a('0x2e')]=_0x107ca3;return getRecipients(_0x3efdb1);})['then'](function(_0x4540c5){_0x1aed22['recipientsId']=_[_0x302a('0x4b')](_0x4540c5)['join'](',');return db['sequelize']['transaction'](function(_0x1e1aad){return db[_0x302a('0x4c')][_0x302a('0x4d')](_0x1aed22,{'raw':!![],'transaction':_0x1e1aad})[_0x302a('0x29')](function(_0x1d3390){var _0x45a2c9={'sender':_0x1aed22[_0x302a('0x45')],'description':_0x1aed22[_0x302a('0x48')],'content':_0x1aed22[_0x302a('0x2e')],'beep':_0x1aed22[_0x302a('0x49')]};_0x4540c5[_0x302a('0x4e')](function(_0x39fee3){_0x45a2c9[_0x302a('0x4f')]=_0x39fee3;socket[_0x302a('0x50')](_0x302a('0x51'),_0x45a2c9);});return _0x1d3390;});});})[_0x302a('0x29')](respondWithResult(_0x321f6b,0xc9))[_0x302a('0x52')](handleError(_0x321f6b,null));};function getContent(_0x156176){return new BPromise(function(_0x35ddce,_0x181c76){if(_0x156176[_0x302a('0x30')]){_0x35ddce(_0x156176[_0x302a('0x30')]);return;}return db[_0x302a('0x53')]['findOne']({'attributes':[_0x302a('0x54')],'where':{'id':_0x156176[_0x302a('0x31')]},'raw':!![]})[_0x302a('0x29')](function(_0x1520c2){if(!_0x1520c2)throw new db[(_0x302a('0x37'))][(_0x302a('0x32'))](_0x302a('0x55'));var _0x1fb663=Mustache[_0x302a('0x56')](_0x1520c2[_0x302a('0x54')],_0x156176[_0x302a('0x34')]);_0x35ddce(_0x1fb663);})['catch'](function(_0x2740d3){_0x181c76(_0x2740d3);});});}function getRecipients(_0x1e291e){return new BPromise(function(_0x4569f4,_0x117645){var _0x579704=[];var _0x3a9aaa=[];_0x1e291e['forEach'](function(_0x3bb72b){var _0xd1b1aa=_['startCase'](_0x3bb72b[_0x302a('0x42')][_0x302a('0x43')]());if(_0xd1b1aa===_0x302a('0x57')){_0x579704=_['union'](_0x579704,_0x3bb72b[_0x302a('0x58')]);}else{if(_[_0x302a('0x41')](_0xd1b1aa,'queue'))_0xd1b1aa=_0xd1b1aa[_0x302a('0x59')]('queue',_0x302a('0x5a'));_0x3bb72b[_0x302a('0x58')][_0x302a('0x4e')](function(_0x8207fa){_0x3a9aaa[_0x302a('0x5b')](getAgents(_0xd1b1aa,_0x8207fa));});}});return BPromise['all'](_0x3a9aaa)[_0x302a('0x29')](function(_0x590616){_0x579704=_[_0x302a('0x5c')](_0x579704,_['flatten'](_0x590616));_0x4569f4(_0x579704);})[_0x302a('0x52')](function(_0x3c270c){_0x117645(_0x3c270c);});});}function getAgents(_0x234d86,_0x41c24b){return new BPromise(function(_0x1fe37a,_0x48c98c){return db[_0x234d86][_0x302a('0x5d')]({'where':{'id':_0x41c24b}})[_0x302a('0x29')](function(_0x3b5d4d){return _0x3b5d4d[_0x302a('0x5e')]({'attributes':['id'],'raw':!![]})[_0x302a('0x29')](function(_0x4f7f20){var _0x456b92=_[_0x302a('0x5f')](_0x4f7f20,'id');_0x1fe37a(_0x456b92);});})[_0x302a('0x52')](function(_0x4dda50){_0x48c98c(_0x4dda50);});});} \ No newline at end of file +var _0xf8ea=['map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','transaction','UserNotification','forEach','recipient','userNotification:send','catch','text','Template','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','replace','queue','Queue','push','all','flatten','getAgents'];(function(_0x1e7ddc,_0x1a8d9b){var _0x18346b=function(_0x264fe4){while(--_0x264fe4){_0x1e7ddc['push'](_0x1e7ddc['shift']());}};_0x18346b(++_0x1a8d9b);}(_0xf8ea,0x67));var _0xaf8e=function(_0x338b18,_0x14aacf){_0x338b18=_0x338b18-0x0;var _0x9c459a=_0xf8ea[_0x338b18];return _0x9c459a;};'use strict';var emlformat=require(_0xaf8e('0x0'));var rimraf=require(_0xaf8e('0x1'));var zipdir=require(_0xaf8e('0x2'));var jsonpatch=require(_0xaf8e('0x3'));var rp=require('request-promise');var moment=require(_0xaf8e('0x4'));var BPromise=require(_0xaf8e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf8e('0x6'));var fs=require('fs');var fs_extra=require(_0xaf8e('0x7'));var _=require(_0xaf8e('0x8'));var squel=require(_0xaf8e('0x9'));var crypto=require(_0xaf8e('0xa'));var jsforce=require(_0xaf8e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaf8e('0xc'));var querystring=require(_0xaf8e('0xd'));var Papa=require(_0xaf8e('0xe'));var Redis=require(_0xaf8e('0xf'));var authService=require(_0xaf8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf8e('0x11'));var hardwareService=require(_0xaf8e('0x12'));var logger=require(_0xaf8e('0x13'))(_0xaf8e('0x14'));var utils=require(_0xaf8e('0x15'));var config=require(_0xaf8e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xaf8e('0x17')]=_[_0xaf8e('0x18')](config[_0xaf8e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf8e('0x19'))(new Redis(config[_0xaf8e('0x17')]));require(_0xaf8e('0x1a'))[_0xaf8e('0x1b')](socket);function respondWithStatusCode(_0x267e3e,_0x1793e3){_0x1793e3=_0x1793e3||0xcc;return function(_0x2de613){if(_0x2de613){return _0x267e3e[_0xaf8e('0x1c')](_0x1793e3);}return _0x267e3e[_0xaf8e('0x1d')](_0x1793e3)[_0xaf8e('0x1e')]();};}function respondWithResult(_0x28f62b,_0x2fe744){_0x2fe744=_0x2fe744||0xc8;return function(_0x208549){if(_0x208549){return _0x28f62b[_0xaf8e('0x1d')](_0x2fe744)[_0xaf8e('0x1f')](_0x208549);}};}function respondWithFilteredResult(_0x31f759,_0x9fb02e){return function(_0x2e1121){if(_0x2e1121){var _0x3026d4=typeof _0x9fb02e[_0xaf8e('0x20')]===_0xaf8e('0x21')&&typeof _0x9fb02e[_0xaf8e('0x22')]==='undefined';var _0x1caf04=_0x2e1121[_0xaf8e('0x23')];var _0x342b03=_0x3026d4?0x0:_0x9fb02e[_0xaf8e('0x20')];var _0x1ec56d=_0x3026d4?_0x2e1121[_0xaf8e('0x23')]:_0x9fb02e[_0xaf8e('0x20')]+_0x9fb02e[_0xaf8e('0x22')];var _0x190dea;if(_0x1ec56d>=_0x1caf04){_0x1ec56d=_0x1caf04;_0x190dea=0xc8;}else{_0x190dea=0xce;}_0x31f759['status'](_0x190dea);return _0x31f759[_0xaf8e('0x24')](_0xaf8e('0x25'),_0x342b03+'-'+_0x1ec56d+'/'+_0x1caf04)[_0xaf8e('0x1f')](_0x2e1121);}return null;};}function patchUpdates(_0x12ab5c){return function(_0x3a5ef9){try{jsonpatch[_0xaf8e('0x26')](_0x3a5ef9,_0x12ab5c,!![]);}catch(_0x5f3665){return BPromise[_0xaf8e('0x27')](_0x5f3665);}return _0x3a5ef9['save']();};}function saveUpdates(_0x28f0cd,_0x51999a){return function(_0x5d9200){if(_0x5d9200){return _0x5d9200[_0xaf8e('0x28')](_0x28f0cd)[_0xaf8e('0x29')](function(_0x30e357){return _0x30e357;});}return null;};}function removeEntity(_0x5e1825,_0x363e7d){return function(_0x7f880f){if(_0x7f880f){return _0x7f880f[_0xaf8e('0x2a')]()[_0xaf8e('0x29')](function(){_0x5e1825['status'](0xcc)[_0xaf8e('0x1e')]();});}};}function handleEntityNotFound(_0x53e3f8,_0xc8f181){return function(_0x5b1953){if(!_0x5b1953){_0x53e3f8[_0xaf8e('0x1c')](0x194);}return _0x5b1953;};}function handleError(_0x15a3da,_0x227548){_0x227548=_0x227548||0x1f4;return function(_0x4ad84d){logger[_0xaf8e('0x2b')](_0x4ad84d[_0xaf8e('0x2c')]);if(_0x4ad84d[_0xaf8e('0x2d')]){delete _0x4ad84d[_0xaf8e('0x2d')];}_0x15a3da[_0xaf8e('0x1d')](_0x227548)[_0xaf8e('0x2e')](_0x4ad84d);};}exports[_0xaf8e('0x2f')]=function(_0x8b36a2,_0x20f1e8,_0x53679f){if(!_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x31')]('text')&&!_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x31')]('TemplateId')){throw new db[(_0xaf8e('0x32'))][(_0xaf8e('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x31')]('TemplateId')&&!_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x31')](_0xaf8e('0x34'))){throw new db['Sequelize'][(_0xaf8e('0x33'))](_0xaf8e('0x35'));}if(!_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x31')]('recipients')){throw new db[(_0xaf8e('0x32'))][(_0xaf8e('0x33'))](_0xaf8e('0x36'));}else{try{var _0x24b9bd=JSON[_0xaf8e('0x37')](_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x38')]);}catch(_0x13e5e4){logger[_0xaf8e('0x2b')](_0x13e5e4);throw new db[(_0xaf8e('0x32'))][(_0xaf8e('0x33'))](_0xaf8e('0x39'));}var _0x4647c9=[_0xaf8e('0x3a'),_0xaf8e('0x3b'),_0xaf8e('0x3c'),_0xaf8e('0x3d'),_0xaf8e('0x3e'),_0xaf8e('0x3f'),_0xaf8e('0x40'),'team',_0xaf8e('0x41')];if(_['some'](_0x24b9bd,function(_0x1fb4c6){return!_[_0xaf8e('0x42')](_0x4647c9,_0x1fb4c6[_0xaf8e('0x43')][_0xaf8e('0x44')]());})){throw new db[(_0xaf8e('0x32'))][(_0xaf8e('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x203409={};_0x203409[_0xaf8e('0x45')]=_0x8b36a2[_0xaf8e('0x30')]['hasOwnProperty'](_0xaf8e('0x45'))?_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x45')]:_0x8b36a2[_0xaf8e('0x41')][_0xaf8e('0x46')];_0x203409[_0xaf8e('0x47')]=_[_0xaf8e('0x48')](_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x47')])?null:_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x47')];_0x203409['beep']=_0x8b36a2[_0xaf8e('0x30')][_0xaf8e('0x49')]||![];_0x203409[_0xaf8e('0x4a')]=_0x8b36a2['user']['id'];return getContent(_0x8b36a2[_0xaf8e('0x30')])['then'](function(_0x11f319){_0x203409[_0xaf8e('0x30')]=_0x11f319;return getRecipients(_0x24b9bd);})[_0xaf8e('0x29')](function(_0x4d2a03){_0x203409['recipientsId']=_[_0xaf8e('0x4b')](_0x4d2a03)[_0xaf8e('0x4c')](',');return db['sequelize'][_0xaf8e('0x4d')](function(_0x3f2aca){return db[_0xaf8e('0x4e')]['create'](_0x203409,{'raw':!![],'transaction':_0x3f2aca})[_0xaf8e('0x29')](function(_0x5d1bca){var _0x20bcc2={'sender':_0x203409[_0xaf8e('0x45')],'description':_0x203409[_0xaf8e('0x47')],'content':_0x203409['body'],'beep':_0x203409[_0xaf8e('0x49')]};_0x4d2a03[_0xaf8e('0x4f')](function(_0x2cb7eb){_0x20bcc2[_0xaf8e('0x50')]=_0x2cb7eb;socket['emit'](_0xaf8e('0x51'),_0x20bcc2);});return _0x5d1bca;});});})[_0xaf8e('0x29')](respondWithResult(_0x20f1e8,0xc9))[_0xaf8e('0x52')](handleError(_0x20f1e8,null));};function getContent(_0x118768){return new BPromise(function(_0x5dffd6,_0x2cf6b1){if(_0x118768[_0xaf8e('0x53')]){_0x5dffd6(_0x118768[_0xaf8e('0x53')]);return;}return db[_0xaf8e('0x54')][_0xaf8e('0x55')]({'attributes':['html'],'where':{'id':_0x118768[_0xaf8e('0x56')]},'raw':!![]})[_0xaf8e('0x29')](function(_0xa8e8e6){if(!_0xa8e8e6)throw new db[(_0xaf8e('0x32'))][(_0xaf8e('0x33'))](_0xaf8e('0x57'));var _0x14b2e9=Mustache[_0xaf8e('0x58')](_0xa8e8e6[_0xaf8e('0x59')],_0x118768[_0xaf8e('0x34')]);_0x5dffd6(_0x14b2e9);})[_0xaf8e('0x52')](function(_0x493a7e){_0x2cf6b1(_0x493a7e);});});}function getRecipients(_0x50e6b8){return new BPromise(function(_0x4f40c3,_0x27763f){var _0x51b746=[];var _0x38fdb4=[];_0x50e6b8[_0xaf8e('0x4f')](function(_0x3b145a){var _0x18a3e9=_[_0xaf8e('0x5a')](_0x3b145a[_0xaf8e('0x43')][_0xaf8e('0x44')]());if(_0x18a3e9===_0xaf8e('0x5b')){_0x51b746=_[_0xaf8e('0x5c')](_0x51b746,_0x3b145a[_0xaf8e('0x5d')]);}else{if(_[_0xaf8e('0x42')](_0x18a3e9,'queue'))_0x18a3e9=_0x18a3e9[_0xaf8e('0x5e')](_0xaf8e('0x5f'),_0xaf8e('0x60'));_0x3b145a[_0xaf8e('0x5d')][_0xaf8e('0x4f')](function(_0x4d115b){_0x38fdb4[_0xaf8e('0x61')](getAgents(_0x18a3e9,_0x4d115b));});}});return BPromise[_0xaf8e('0x62')](_0x38fdb4)['then'](function(_0xe5e4bc){_0x51b746=_[_0xaf8e('0x5c')](_0x51b746,_[_0xaf8e('0x63')](_0xe5e4bc));_0x4f40c3(_0x51b746);})[_0xaf8e('0x52')](function(_0x21ba25){_0x27763f(_0x21ba25);});});}function getAgents(_0x434772,_0x3d95c3){return new BPromise(function(_0x40e685,_0x53e5b2){return db[_0x434772]['findOne']({'where':{'id':_0x3d95c3}})[_0xaf8e('0x29')](function(_0x34f97f){return _0x34f97f[_0xaf8e('0x64')]({'attributes':['id'],'raw':!![]})[_0xaf8e('0x29')](function(_0x76e218){var _0x13eb45=_[_0xaf8e('0x65')](_0x76e218,'id');_0x40e685(_0x13eb45);});})['catch'](function(_0x3f56b9){_0x53e5b2(_0x3f56b9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 84ea052..616de59 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 _0x1067=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0x1067,0x6a));var _0x7106=function(_0x185f94,_0x216238){_0x185f94=_0x185f94-0x0;var _0x34a698=_0x1067[_0x185f94];return _0x34a698;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7106('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7106('0x1')](0x0);var events={'afterCreate':_0x7106('0x2'),'afterUpdate':_0x7106('0x3'),'afterDestroy':_0x7106('0x4')};function emitEvent(_0x1378a0){return function(_0x115416,_0x360ab7,_0x1e7345){UserNotificationEvents[_0x7106('0x5')](_0x1378a0+':'+_0x115416['id'],_0x115416);UserNotificationEvents['emit'](_0x1378a0,_0x115416);_0x1e7345(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x7106('0x6')](e,emitEvent(event));}}module[_0x7106('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x9995=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1eb2ae,_0x558eb1){var _0x18c719=function(_0x246766){while(--_0x246766){_0x1eb2ae['push'](_0x1eb2ae['shift']());}};_0x18c719(++_0x558eb1);}(_0x9995,0x101));var _0x5999=function(_0xb3688c,_0x2a2b1a){_0xb3688c=_0xb3688c-0x0;var _0x1220a6=_0x9995[_0xb3688c];return _0x1220a6;};'use strict';var EventEmitter=require(_0x5999('0x0'));var UserNotification=require(_0x5999('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5999('0x2')](0x0);var events={'afterCreate':_0x5999('0x3'),'afterUpdate':_0x5999('0x4'),'afterDestroy':_0x5999('0x5')};function emitEvent(_0x286506){return function(_0x4c0c09,_0x2ecec1,_0x2d4c80){UserNotificationEvents[_0x5999('0x6')](_0x286506+':'+_0x4c0c09['id'],_0x4c0c09);UserNotificationEvents[_0x5999('0x6')](_0x286506,_0x4c0c09);_0x2d4c80(null);};}for(var e in events){if(events[_0x5999('0x7')](e)){var event=events[e];UserNotification[_0x5999('0x8')](e,emitEvent(event));}}module[_0x5999('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 4001545..ca4689f 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 _0x0274=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','exports','UserNotification','userNotifications','utf8mb4'];(function(_0x50d9b3,_0x4f5865){var _0x9f69c1=function(_0x117dd3){while(--_0x117dd3){_0x50d9b3['push'](_0x50d9b3['shift']());}};_0x9f69c1(++_0x4f5865);}(_0x0274,0x1e1));var _0x4027=function(_0x34e6c2,_0x57a7f0){_0x34e6c2=_0x34e6c2-0x0;var _0x299fbf=_0x0274[_0x34e6c2];return _0x299fbf;};'use strict';var _=require(_0x4027('0x0'));var util=require('util');var logger=require(_0x4027('0x1'))('api');var moment=require(_0x4027('0x2'));var BPromise=require(_0x4027('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4027('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x4027('0x5')]=function(_0x44c8be,_0x580079){return _0x44c8be['define'](_0x4027('0x6'),attributes,{'tableName':_0x4027('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4027('0x8'),'collate':_0x4027('0x9')});}; \ No newline at end of file +var _0x14fb=['moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5408ba,_0x3bfcaf){var _0x4b0a94=function(_0x5727c3){while(--_0x5727c3){_0x5408ba['push'](_0x5408ba['shift']());}};_0x4b0a94(++_0x3bfcaf);}(_0x14fb,0x77));var _0xb14f=function(_0x134476,_0x221f8d){_0x134476=_0x134476-0x0;var _0x226b66=_0x14fb[_0x134476];return _0x226b66;};'use strict';var _=require(_0xb14f('0x0'));var util=require('util');var logger=require(_0xb14f('0x1'))('api');var moment=require(_0xb14f('0x2'));var BPromise=require(_0xb14f('0x3'));var rp=require(_0xb14f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb14f('0x5'));var attributes=require(_0xb14f('0x6'));module['exports']=function(_0x37df0a,_0x33b94d){return _0x37df0a['define'](_0xb14f('0x7'),attributes,{'tableName':_0xb14f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb14f('0x9'),'collate':_0xb14f('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 2e4ba1b..1781663 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 _0x9974=['register','then','info','request\x20sent','debug','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./userNotification.socket'];(function(_0x3e0d44,_0xc4f9ff){var _0x297f42=function(_0xb5a246){while(--_0xb5a246){_0x3e0d44['push'](_0x3e0d44['shift']());}};_0x297f42(++_0xc4f9ff);}(_0x9974,0x165));var _0x4997=function(_0xf71a04,_0x5ded86){_0xf71a04=_0xf71a04-0x0;var _0x4890fd=_0x9974[_0xf71a04];return _0x4890fd;};'use strict';var _=require(_0x4997('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4997('0x1'));var db=require(_0x4997('0x2'))['db'];var utils=require(_0x4997('0x3'));var logger=require(_0x4997('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4997('0x5'));var client=jayson[_0x4997('0x6')][_0x4997('0x7')]({'port':0x232a});config[_0x4997('0x8')]=_[_0x4997('0x9')](config[_0x4997('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4997('0x8')]));require(_0x4997('0xa'))[_0x4997('0xb')](socket);function respondWithRpcPromise(_0xbf4a4f,_0x16039c,_0x11bf40){return new BPromise(function(_0x2d0e87,_0x35eb40){return client['request'](_0xbf4a4f,_0x11bf40)[_0x4997('0xc')](function(_0x30ae13){logger[_0x4997('0xd')]('UserNotification,\x20%s,\x20%s',_0x16039c,_0x4997('0xe'));logger[_0x4997('0xf')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x16039c,_0x4997('0xe'),JSON[_0x4997('0x10')](_0x30ae13));if(_0x30ae13[_0x4997('0x11')]){if(_0x30ae13['error'][_0x4997('0x12')]===0x1f4){logger[_0x4997('0x11')](_0x4997('0x13'),_0x16039c,_0x30ae13[_0x4997('0x11')]['message']);return _0x35eb40(_0x30ae13['error'][_0x4997('0x14')]);}logger['error'](_0x4997('0x13'),_0x16039c,_0x30ae13['error']['message']);return _0x2d0e87(_0x30ae13[_0x4997('0x11')][_0x4997('0x14')]);}else{logger[_0x4997('0xd')](_0x4997('0x13'),_0x16039c,_0x4997('0xe'));_0x2d0e87(_0x30ae13[_0x4997('0x15')][_0x4997('0x14')]);}})[_0x4997('0x16')](function(_0x8db8f5){logger[_0x4997('0x11')](_0x4997('0x13'),_0x16039c,_0x8db8f5);_0x35eb40(_0x8db8f5);});});} \ No newline at end of file +var _0x2dc6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','request\x20sent','debug','stringify','error','UserNotification,\x20%s,\x20%s','message','info','lodash'];(function(_0xb7368b,_0xf11033){var _0x37d43b=function(_0x4562ed){while(--_0x4562ed){_0xb7368b['push'](_0xb7368b['shift']());}};_0x37d43b(++_0xf11033);}(_0x2dc6,0x1d3));var _0x62dc=function(_0x327c17,_0x55fe50){_0x327c17=_0x327c17-0x0;var _0x52de75=_0x2dc6[_0x327c17];return _0x52de75;};'use strict';var _=require(_0x62dc('0x0'));var util=require(_0x62dc('0x1'));var moment=require(_0x62dc('0x2'));var BPromise=require(_0x62dc('0x3'));var rs=require(_0x62dc('0x4'));var fs=require('fs');var Redis=require(_0x62dc('0x5'));var db=require(_0x62dc('0x6'))['db'];var utils=require(_0x62dc('0x7'));var logger=require('../../config/logger')(_0x62dc('0x8'));var config=require(_0x62dc('0x9'));var jayson=require(_0x62dc('0xa'));var client=jayson[_0x62dc('0xb')]['http']({'port':0x232a});config[_0x62dc('0xc')]=_[_0x62dc('0xd')](config['redis'],{'host':_0x62dc('0xe'),'port':0x18eb});var socket=require(_0x62dc('0xf'))(new Redis(config['redis']));require(_0x62dc('0x10'))['register'](socket);function respondWithRpcPromise(_0x4aecc3,_0xc4daeb,_0x3459f9){return new BPromise(function(_0x287645,_0x3b3e36){return client[_0x62dc('0x11')](_0x4aecc3,_0x3459f9)[_0x62dc('0x12')](function(_0xd87b8d){logger['info']('UserNotification,\x20%s,\x20%s',_0xc4daeb,_0x62dc('0x13'));logger[_0x62dc('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xc4daeb,_0x62dc('0x13'),JSON[_0x62dc('0x15')](_0xd87b8d));if(_0xd87b8d[_0x62dc('0x16')]){if(_0xd87b8d[_0x62dc('0x16')]['code']===0x1f4){logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);return _0x3b3e36(_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);}logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);return _0x287645(_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);}else{logger[_0x62dc('0x19')](_0x62dc('0x17'),_0xc4daeb,_0x62dc('0x13'));_0x287645(_0xd87b8d['result'][_0x62dc('0x18')]);}})['catch'](function(_0x2bb7e4){logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0x2bb7e4);_0x3b3e36(_0x2bb7e4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 61e94aa..db22f34 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 _0x80e2=['register','length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x462753,_0x18db45){var _0x241048=function(_0x165ef6){while(--_0x165ef6){_0x462753['push'](_0x462753['shift']());}};_0x241048(++_0x18db45);}(_0x80e2,0x1e0));var _0x280e=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x80e2[_0x51b0dc];return _0x13fa89;};'use strict';var UserNotificationEvents=require(_0x280e('0x0'));var events=[_0x280e('0x1'),_0x280e('0x2'),_0x280e('0x3')];function createListener(_0x50b99c,_0x3ffe78){return function(_0x8ab651){_0x3ffe78[_0x280e('0x4')](_0x50b99c,_0x8ab651);};}function removeListener(_0x4efec4,_0x60830e){return function(){UserNotificationEvents[_0x280e('0x5')](_0x4efec4,_0x60830e);};}exports[_0x280e('0x6')]=function(_0x2fa600){for(var _0x57a717=0x0,_0x4f4f6a=events[_0x280e('0x7')];_0x57a717<_0x4f4f6a;_0x57a717++){var _0x2e4c1d=events[_0x57a717];var _0x352a4a=createListener(_0x280e('0x8')+_0x2e4c1d,_0x2fa600);UserNotificationEvents['on'](_0x2e4c1d,_0x352a4a);}}; \ No newline at end of file +var _0x3d6f=['./userNotification.events','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x20bdce,_0x346728){var _0x49f358=function(_0x357a64){while(--_0x357a64){_0x20bdce['push'](_0x20bdce['shift']());}};_0x49f358(++_0x346728);}(_0x3d6f,0x1e0));var _0xf3d6=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x3d6f[_0x22b39b];return _0x280e1d;};'use strict';var UserNotificationEvents=require(_0xf3d6('0x0'));var events=['save',_0xf3d6('0x1'),_0xf3d6('0x2')];function createListener(_0x5f42f0,_0x4fcdee){return function(_0x36522d){_0x4fcdee[_0xf3d6('0x3')](_0x5f42f0,_0x36522d);};}function removeListener(_0x5bcbe0,_0x5c08f0){return function(){UserNotificationEvents[_0xf3d6('0x4')](_0x5bcbe0,_0x5c08f0);};}exports[_0xf3d6('0x5')]=function(_0x3fb00a){for(var _0x3d9c0d=0x0,_0x176467=events[_0xf3d6('0x6')];_0x3d9c0d<_0x176467;_0x3d9c0d++){var _0xa0fc1b=events[_0x3d9c0d];var _0x14b1a4=createListener(_0xf3d6('0x7')+_0xa0fc1b,_0x3fb00a);UserNotificationEvents['on'](_0xa0fc1b,_0x14b1a4);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d24ba83..4ecf4ea 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(_0x3735ac,_0x5e09fe){var _0x5299bb=function(_0x19d895){while(--_0x19d895){_0x3735ac['push'](_0x3735ac['shift']());}};_0x5299bb(++_0x5e09fe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4c0b67,_0x5f38b0){var _0x130d72=function(_0x13e601){while(--_0x13e601){_0x4c0b67['push'](_0x4c0b67['shift']());}};_0x130d72(++_0x5f38b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 22dbeec..aa3a7f0 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 _0xa149=['INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa149,0xb5));var _0x9a14=function(_0x1ac4a4,_0x446c14){_0x1ac4a4=_0x1ac4a4-0x0;var _0x2c613b=_0xa149[_0x1ac4a4];return _0x2c613b;};'use strict';var Sequelize=require(_0x9a14('0x0'));module[_0x9a14('0x1')]={'penalty':{'type':Sequelize[_0x9a14('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb447=['INTEGER'];(function(_0x549a09,_0x2fe584){var _0x3ef978=function(_0x245752){while(--_0x245752){_0x549a09['push'](_0x549a09['shift']());}};_0x3ef978(++_0x2fe584);}(_0xb447,0x16e));var _0x7b44=function(_0x33364e,_0x954958){_0x33364e=_0x33364e-0x0;var _0xe02e02=_0xb447[_0x33364e];return _0xe02e02;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7b44('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 f01ed42..a933b4c 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 _0xe806=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe806,0x1dd));var _0x6e80=function(_0xc984b4,_0x26487c){_0xc984b4=_0xc984b4-0x0;var _0x2af115=_0xe806[_0xc984b4];return _0x2af115;};'use strict';var _=require(_0x6e80('0x0'));var util=require(_0x6e80('0x1'));var logger=require('../../config/logger')(_0x6e80('0x2'));var moment=require(_0x6e80('0x3'));var BPromise=require(_0x6e80('0x4'));var rp=require(_0x6e80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e80('0x6'));var config=require(_0x6e80('0x7'));var attributes=require(_0x6e80('0x8'));module[_0x6e80('0x9')]=function(_0x242675,_0x1d6209){return _0x242675['define'](_0x6e80('0xa'),attributes,{'tableName':_0x6e80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8e=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3ad173,_0x453d04){var _0x1da4f2=function(_0x4b1b7c){while(--_0x4b1b7c){_0x3ad173['push'](_0x3ad173['shift']());}};_0x1da4f2(++_0x453d04);}(_0x4b8e,0x165));var _0xe4b8=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0x4b8e[_0x27c25f];return _0x2da4c4;};'use strict';var _=require(_0xe4b8('0x0'));var util=require(_0xe4b8('0x1'));var logger=require(_0xe4b8('0x2'))(_0xe4b8('0x3'));var moment=require(_0xe4b8('0x4'));var BPromise=require(_0xe4b8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe4b8('0x6'));var config=require(_0xe4b8('0x7'));var attributes=require(_0xe4b8('0x8'));module[_0xe4b8('0x9')]=function(_0x1db275,_0x31f95f){return _0x1db275['define'](_0xe4b8('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c020602..07267bf 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 _0x7df1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x7df1,0x1c4));var _0x17df=function(_0x2c77f9,_0x403ab6){_0x2c77f9=_0x2c77f9-0x0;var _0x288757=_0x7df1[_0x2c77f9];return _0x288757;};'use strict';var _=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var moment=require('moment');var BPromise=require(_0x17df('0x2'));var rs=require(_0x17df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17df('0x4'))['db'];var utils=require(_0x17df('0x5'));var logger=require(_0x17df('0x6'))(_0x17df('0x7'));var config=require(_0x17df('0x8'));var jayson=require(_0x17df('0x9'));var client=jayson[_0x17df('0xa')][_0x17df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549ea2,_0x3e4969,_0x4e0683){return new BPromise(function(_0x556b7c,_0x399f4a){return client[_0x17df('0xc')](_0x549ea2,_0x4e0683)[_0x17df('0xd')](function(_0x363ea0){logger[_0x17df('0xe')](_0x17df('0xf'),_0x3e4969,_0x17df('0x10'));logger[_0x17df('0x11')](_0x17df('0x12'),_0x3e4969,_0x17df('0x10'),JSON['stringify'](_0x363ea0));if(_0x363ea0['error']){if(_0x363ea0[_0x17df('0x13')][_0x17df('0x14')]===0x1f4){logger[_0x17df('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3e4969,_0x363ea0[_0x17df('0x13')][_0x17df('0x15')]);return _0x399f4a(_0x363ea0[_0x17df('0x13')][_0x17df('0x15')]);}logger['error'](_0x17df('0xf'),_0x3e4969,_0x363ea0[_0x17df('0x13')][_0x17df('0x15')]);return _0x556b7c(_0x363ea0[_0x17df('0x13')][_0x17df('0x15')]);}else{logger[_0x17df('0xe')](_0x17df('0xf'),_0x3e4969,_0x17df('0x10'));_0x556b7c(_0x363ea0[_0x17df('0x16')][_0x17df('0x15')]);}})[_0x17df('0x17')](function(_0x1c4f74){logger[_0x17df('0x13')](_0x17df('0xf'),_0x3e4969,_0x1c4f74);_0x399f4a(_0x1c4f74);});});} \ No newline at end of file +var _0x72aa=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x13ea1a,_0x261e2f){var _0x6767b=function(_0x135439){while(--_0x135439){_0x13ea1a['push'](_0x13ea1a['shift']());}};_0x6767b(++_0x261e2f);}(_0x72aa,0xab));var _0xa72a=function(_0x4ef583,_0x1c8832){_0x4ef583=_0x4ef583-0x0;var _0x307dcb=_0x72aa[_0x4ef583];return _0x307dcb;};'use strict';var _=require(_0xa72a('0x0'));var util=require(_0xa72a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa72a('0x2'));var fs=require('fs');var Redis=require(_0xa72a('0x3'));var db=require(_0xa72a('0x4'))['db'];var utils=require(_0xa72a('0x5'));var logger=require(_0xa72a('0x6'))(_0xa72a('0x7'));var config=require(_0xa72a('0x8'));var jayson=require(_0xa72a('0x9'));var client=jayson[_0xa72a('0xa')][_0xa72a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42116d,_0xfc7dbc,_0x3c3243){return new BPromise(function(_0x5f200d,_0x4b8f0a){return client['request'](_0x42116d,_0x3c3243)[_0xa72a('0xc')](function(_0x27a935){logger[_0xa72a('0xd')](_0xa72a('0xe'),_0xfc7dbc,_0xa72a('0xf'));logger['debug'](_0xa72a('0x10'),_0xfc7dbc,_0xa72a('0xf'),JSON['stringify'](_0x27a935));if(_0x27a935[_0xa72a('0x11')]){if(_0x27a935[_0xa72a('0x11')][_0xa72a('0x12')]===0x1f4){logger[_0xa72a('0x11')](_0xa72a('0xe'),_0xfc7dbc,_0x27a935[_0xa72a('0x11')][_0xa72a('0x13')]);return _0x4b8f0a(_0x27a935['error'][_0xa72a('0x13')]);}logger[_0xa72a('0x11')](_0xa72a('0xe'),_0xfc7dbc,_0x27a935['error'][_0xa72a('0x13')]);return _0x5f200d(_0x27a935['error'][_0xa72a('0x13')]);}else{logger[_0xa72a('0xd')](_0xa72a('0xe'),_0xfc7dbc,'request\x20sent');_0x5f200d(_0x27a935[_0xa72a('0x14')][_0xa72a('0x13')]);}})[_0xa72a('0x15')](function(_0x46d7f3){logger[_0xa72a('0x11')](_0xa72a('0xe'),_0xfc7dbc,_0x46d7f3);_0x4b8f0a(_0x46d7f3);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 5d94d37..a6856e5 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 _0x6bf2=['post','/:id/clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','/:id/sections','/:id/resources','getResources'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x6bf2,0x1e6));var _0x26bf=function(_0x5a9d94,_0x2c9dd1){_0x5a9d94=_0x5a9d94-0x0;var _0x395979=_0x6bf2[_0x5a9d94];return _0x395979;};'use strict';var multer=require(_0x26bf('0x0'));var util=require('util');var path=require(_0x26bf('0x1'));var timeout=require(_0x26bf('0x2'));var express=require(_0x26bf('0x3'));var router=express['Router']();var fs_extra=require(_0x26bf('0x4'));var auth=require(_0x26bf('0x5'));var interaction=require(_0x26bf('0x6'));var config=require(_0x26bf('0x7'));var controller=require(_0x26bf('0x8'));router[_0x26bf('0x9')]('/',auth['isAuthenticated'](),controller[_0x26bf('0xa')]);router[_0x26bf('0x9')]('/describe',auth[_0x26bf('0xb')](),controller[_0x26bf('0xc')]);router[_0x26bf('0x9')](_0x26bf('0xd'),auth[_0x26bf('0xb')](),controller[_0x26bf('0xe')]);router['get'](_0x26bf('0xf'),auth[_0x26bf('0xb')](),controller['getSections']);router['get'](_0x26bf('0x10'),auth[_0x26bf('0xb')](),controller[_0x26bf('0x11')]);router[_0x26bf('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x26bf('0x13'),auth[_0x26bf('0xb')](),controller['clone']);router['post'](_0x26bf('0xf'),auth[_0x26bf('0xb')](),controller[_0x26bf('0x14')]);router['post'](_0x26bf('0x10'),auth[_0x26bf('0xb')](),controller['addResources']);router[_0x26bf('0x15')](_0x26bf('0xd'),auth[_0x26bf('0xb')](),controller[_0x26bf('0x16')]);router[_0x26bf('0x17')](_0x26bf('0xd'),auth['isAuthenticated'](),controller[_0x26bf('0x18')]);router['delete']('/:id/sections',auth[_0x26bf('0xb')](),controller[_0x26bf('0x19')]);router[_0x26bf('0x17')](_0x26bf('0x10'),auth[_0x26bf('0xb')](),controller[_0x26bf('0x1a')]);module[_0x26bf('0x1b')]=router; \ No newline at end of file +var _0x39ad=['/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','/:id/sections','addSections','delete','destroy','removeSections','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x39ad,0x107));var _0xd39a=function(_0x2db714,_0x16f3c5){_0x2db714=_0x2db714-0x0;var _0xac2750=_0x39ad[_0x2db714];return _0xac2750;};'use strict';var multer=require('multer');var util=require(_0xd39a('0x0'));var path=require(_0xd39a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd39a('0x2'));var router=express[_0xd39a('0x3')]();var fs_extra=require(_0xd39a('0x4'));var auth=require(_0xd39a('0x5'));var interaction=require(_0xd39a('0x6'));var config=require(_0xd39a('0x7'));var controller=require(_0xd39a('0x8'));router[_0xd39a('0x9')]('/',auth[_0xd39a('0xa')](),controller['index']);router[_0xd39a('0x9')](_0xd39a('0xb'),auth[_0xd39a('0xa')](),controller['describe']);router[_0xd39a('0x9')](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller[_0xd39a('0xd')]);router[_0xd39a('0x9')]('/:id/sections',auth[_0xd39a('0xa')](),controller[_0xd39a('0xe')]);router[_0xd39a('0x9')](_0xd39a('0xf'),auth['isAuthenticated'](),controller[_0xd39a('0x10')]);router[_0xd39a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd39a('0x11')](_0xd39a('0x12'),auth['isAuthenticated'](),controller[_0xd39a('0x13')]);router['post'](_0xd39a('0x14'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x15')]);router[_0xd39a('0x11')]('/:id/resources',auth[_0xd39a('0xa')](),controller['addResources']);router['put'](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller['update']);router[_0xd39a('0x16')](_0xd39a('0xc'),auth[_0xd39a('0xa')](),controller[_0xd39a('0x17')]);router[_0xd39a('0x16')](_0xd39a('0x14'),auth['isAuthenticated'](),controller[_0xd39a('0x18')]);router[_0xd39a('0x16')](_0xd39a('0xf'),auth[_0xd39a('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2076af9..a21074b 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 _0x08a4=['name','getDataValue','crudPermissions','split','BOOLEAN','sequelize','STRING'];(function(_0x34b939,_0x4fc8c0){var _0x1d6eff=function(_0x4c5cbc){while(--_0x4c5cbc){_0x34b939['push'](_0x34b939['shift']());}};_0x1d6eff(++_0x4fc8c0);}(_0x08a4,0xbb));var _0x408a=function(_0x3188bd,_0x119115){_0x3188bd=_0x3188bd-0x0;var _0x292df7=_0x08a4[_0x3188bd];return _0x292df7;};'use strict';var Sequelize=require(_0x408a('0x0'));module['exports']={'name':{'type':Sequelize[_0x408a('0x1')],'allowNull':![],'unique':_0x408a('0x2')},'crudPermissions':{'type':Sequelize[_0x408a('0x1')],'set':function(_0x57cc98){this['setDataValue']('crudPermissions',_0x57cc98?_0x57cc98['join'](''):[]);},'get':function(){return this[_0x408a('0x3')](_0x408a('0x4'))?this['getDataValue'](_0x408a('0x4'))[_0x408a('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x408a('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x408a('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x408a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x408a('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x408a('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x408a('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x033e=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x25098d,_0x51009b){var _0x3f2c96=function(_0x3453ad){while(--_0x3453ad){_0x25098d['push'](_0x25098d['shift']());}};_0x3f2c96(++_0x51009b);}(_0x033e,0x94));var _0xe033=function(_0x19754a,_0x3050aa){_0x19754a=_0x19754a-0x0;var _0x4f8f3f=_0x033e[_0x19754a];return _0x4f8f3f;};'use strict';var Sequelize=require('sequelize');module[_0xe033('0x0')]={'name':{'type':Sequelize[_0xe033('0x1')],'allowNull':![],'unique':_0xe033('0x2')},'crudPermissions':{'type':Sequelize[_0xe033('0x1')],'set':function(_0x22db91){this[_0xe033('0x3')](_0xe033('0x4'),_0x22db91?_0x22db91[_0xe033('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xe033('0x4'))?this[_0xe033('0x6')](_0xe033('0x4'))[_0xe033('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe033('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe033('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e8bc9a6..f2a737f 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 _0xbcb6=['UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','describe','addSections','sectionId','push','removeSections','includes','isEmpty','subsections','enabled','concat','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','name','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','get','omit','updatedAt','crudPermissions','sequelize','transaction'];(function(_0x576c6c,_0x216e0a){var _0x4b1248=function(_0x5dd989){while(--_0x5dd989){_0x576c6c['push'](_0x576c6c['shift']());}};_0x4b1248(++_0x216e0a);}(_0xbcb6,0x8c));var _0x6bcb=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0xbcb6[_0x3db0ba];return _0x2d8e9a;};'use strict';var emlformat=require(_0x6bcb('0x0'));var rimraf=require(_0x6bcb('0x1'));var zipdir=require(_0x6bcb('0x2'));var jsonpatch=require(_0x6bcb('0x3'));var rp=require(_0x6bcb('0x4'));var moment=require('moment');var BPromise=require(_0x6bcb('0x5'));var Mustache=require(_0x6bcb('0x6'));var util=require(_0x6bcb('0x7'));var path=require('path');var sox=require(_0x6bcb('0x8'));var csv=require(_0x6bcb('0x9'));var ejs=require(_0x6bcb('0xa'));var fs=require('fs');var fs_extra=require(_0x6bcb('0xb'));var _=require(_0x6bcb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6bcb('0xd'));var toCsv=require(_0x6bcb('0x9'));var querystring=require(_0x6bcb('0xe'));var Papa=require(_0x6bcb('0xf'));var Redis=require('ioredis');var authService=require(_0x6bcb('0x10'));var qs=require(_0x6bcb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bcb('0x12'))(_0x6bcb('0x13'));var utils=require(_0x6bcb('0x14'));var config=require(_0x6bcb('0x15'));var licenseUtil=require(_0x6bcb('0x16'));var db=require(_0x6bcb('0x17'))['db'];config[_0x6bcb('0x18')]=_['defaults'](config['redis'],{'host':_0x6bcb('0x19'),'port':0x18eb});var socket=require(_0x6bcb('0x1a'))(new Redis(config[_0x6bcb('0x18')]));require(_0x6bcb('0x1b'))[_0x6bcb('0x1c')](socket);function respondWithStatusCode(_0x18eeea,_0x3d2520){_0x3d2520=_0x3d2520||0xcc;return function(_0x4b24a5){if(_0x4b24a5){return _0x18eeea['sendStatus'](_0x3d2520);}return _0x18eeea[_0x6bcb('0x1d')](_0x3d2520)[_0x6bcb('0x1e')]();};}function respondWithResult(_0x538dda,_0xa7108a){_0xa7108a=_0xa7108a||0xc8;return function(_0x6be56){if(_0x6be56){return _0x538dda['status'](_0xa7108a)[_0x6bcb('0x1f')](_0x6be56);}};}function respondWithFilteredResult(_0x2d9f7a,_0x1a60e4){return function(_0x5cb5cc){if(_0x5cb5cc){var _0x23b5a5=typeof _0x1a60e4[_0x6bcb('0x20')]===_0x6bcb('0x21')&&typeof _0x1a60e4[_0x6bcb('0x22')]===_0x6bcb('0x21');var _0x1b44c0=_0x5cb5cc[_0x6bcb('0x23')];var _0x343470=_0x23b5a5?0x0:_0x1a60e4[_0x6bcb('0x20')];var _0x170fbf=_0x23b5a5?_0x5cb5cc[_0x6bcb('0x23')]:_0x1a60e4['offset']+_0x1a60e4[_0x6bcb('0x22')];var _0x317540;if(_0x170fbf>=_0x1b44c0){_0x170fbf=_0x1b44c0;_0x317540=0xc8;}else{_0x317540=0xce;}_0x2d9f7a[_0x6bcb('0x1d')](_0x317540);return _0x2d9f7a[_0x6bcb('0x24')](_0x6bcb('0x25'),_0x343470+'-'+_0x170fbf+'/'+_0x1b44c0)['json'](_0x5cb5cc);}return null;};}function patchUpdates(_0x5d1409){return function(_0x35f5d1){try{jsonpatch['apply'](_0x35f5d1,_0x5d1409,!![]);}catch(_0x5c4f97){return BPromise['reject'](_0x5c4f97);}return _0x35f5d1[_0x6bcb('0x26')]();};}function saveUpdates(_0xb30071,_0x139307){return function(_0x1c8ad0){if(_0x1c8ad0){return _0x1c8ad0[_0x6bcb('0x27')](_0xb30071)[_0x6bcb('0x28')](function(_0xdad56a){return _0xdad56a;});}return null;};}function removeEntity(_0x40711a,_0x2cf408){return function(_0x3eb783){if(_0x3eb783){return _0x3eb783[_0x6bcb('0x29')]()[_0x6bcb('0x28')](function(){_0x40711a[_0x6bcb('0x1d')](0xcc)[_0x6bcb('0x1e')]();});}};}function handleEntityNotFound(_0x50567d,_0x3833f1){return function(_0x4bf402){if(!_0x4bf402){_0x50567d[_0x6bcb('0x2a')](0x194);}return _0x4bf402;};}function handleError(_0x2f1004,_0x12653c){_0x12653c=_0x12653c||0x1f4;return function(_0x346f8c){logger[_0x6bcb('0x2b')](_0x346f8c['stack']);if(_0x346f8c[_0x6bcb('0x2c')]){delete _0x346f8c[_0x6bcb('0x2c')];}_0x2f1004[_0x6bcb('0x1d')](_0x12653c)['send'](_0x346f8c);};}exports['index']=function(_0x15b4ea,_0x34d60e){var _0x11efac={},_0x258641={},_0x1c615e={'count':0x0,'rows':[]};var _0x3ae46d=_[_0x6bcb('0x2d')](db[_0x6bcb('0x2e')][_0x6bcb('0x2f')],function(_0x1d56e4){return{'name':_0x1d56e4[_0x6bcb('0x30')],'type':_0x1d56e4[_0x6bcb('0x31')][_0x6bcb('0x32')]};});_0x258641[_0x6bcb('0x33')]=_[_0x6bcb('0x2d')](_0x3ae46d,_0x6bcb('0x2c'));_0x258641['query']=_[_0x6bcb('0x34')](_0x15b4ea['query']);_0x258641['filters']=_['intersection'](_0x258641[_0x6bcb('0x33')],_0x258641[_0x6bcb('0x35')]);_0x11efac[_0x6bcb('0x36')]=_[_0x6bcb('0x37')](_0x258641['model'],qs[_0x6bcb('0x38')](_0x15b4ea[_0x6bcb('0x35')][_0x6bcb('0x38')]));_0x11efac['attributes']=_0x11efac[_0x6bcb('0x36')][_0x6bcb('0x39')]?_0x11efac['attributes']:_0x258641['model'];if(!_0x15b4ea['query'][_0x6bcb('0x3a')]('nolimit')){_0x11efac['limit']=qs['limit'](_0x15b4ea[_0x6bcb('0x35')][_0x6bcb('0x22')]);_0x11efac[_0x6bcb('0x20')]=qs[_0x6bcb('0x20')](_0x15b4ea['query'][_0x6bcb('0x20')]);}_0x11efac[_0x6bcb('0x3b')]=qs['sort'](_0x15b4ea[_0x6bcb('0x35')]['sort']);_0x11efac[_0x6bcb('0x3c')]=qs[_0x6bcb('0x3d')](_['pick'](_0x15b4ea[_0x6bcb('0x35')],_0x258641['filters']),_0x3ae46d);if(_0x15b4ea[_0x6bcb('0x35')][_0x6bcb('0x3e')]){_0x11efac[_0x6bcb('0x3c')]=_[_0x6bcb('0x3f')](_0x11efac[_0x6bcb('0x3c')],{'$or':_[_0x6bcb('0x2d')](_0x3ae46d,function(_0x9bd279){if(_0x9bd279[_0x6bcb('0x31')]!==_0x6bcb('0x40')){var _0x31ada1={};_0x31ada1[_0x9bd279[_0x6bcb('0x2c')]]={'$like':'%'+_0x15b4ea['query'][_0x6bcb('0x3e')]+'%'};return _0x31ada1;}})});}_0x11efac=_['merge']({},_0x11efac,_0x15b4ea[_0x6bcb('0x41')]);var _0x2303e1={'where':_0x11efac[_0x6bcb('0x3c')]};return db[_0x6bcb('0x2e')]['count'](_0x2303e1)[_0x6bcb('0x28')](function(_0x3fd5f1){_0x1c615e[_0x6bcb('0x23')]=_0x3fd5f1;if(_0x15b4ea[_0x6bcb('0x35')]['includeAll']){_0x11efac[_0x6bcb('0x42')]=[{'all':!![]}];}return db[_0x6bcb('0x2e')][_0x6bcb('0x43')](_0x11efac);})[_0x6bcb('0x28')](function(_0x420d1a){_0x1c615e[_0x6bcb('0x44')]=_0x420d1a;return _0x1c615e;})['then'](respondWithFilteredResult(_0x34d60e,_0x11efac))['catch'](handleError(_0x34d60e,null));};exports[_0x6bcb('0x45')]=function(_0x47790c,_0x2f117e){var _0x826ec2={'raw':![],'where':{'id':_0x47790c[_0x6bcb('0x46')]['id']}},_0x1ab6f5={};_0x1ab6f5[_0x6bcb('0x33')]=_[_0x6bcb('0x34')](db[_0x6bcb('0x2e')]['rawAttributes']);_0x1ab6f5['query']=_[_0x6bcb('0x34')](_0x47790c[_0x6bcb('0x35')]);_0x1ab6f5[_0x6bcb('0x3d')]=_[_0x6bcb('0x37')](_0x1ab6f5[_0x6bcb('0x33')],_0x1ab6f5[_0x6bcb('0x35')]);_0x826ec2[_0x6bcb('0x36')]=_[_0x6bcb('0x37')](_0x1ab6f5[_0x6bcb('0x33')],qs[_0x6bcb('0x38')](_0x47790c[_0x6bcb('0x35')]['fields']));_0x826ec2[_0x6bcb('0x36')]=_0x826ec2[_0x6bcb('0x36')]['length']?_0x826ec2[_0x6bcb('0x36')]:_0x1ab6f5[_0x6bcb('0x33')];if(_0x47790c[_0x6bcb('0x35')][_0x6bcb('0x47')]){_0x826ec2[_0x6bcb('0x42')]=[{'all':!![]}];}_0x826ec2=_[_0x6bcb('0x3f')]({},_0x826ec2,_0x47790c[_0x6bcb('0x41')]);return db[_0x6bcb('0x2e')][_0x6bcb('0x48')](_0x826ec2)[_0x6bcb('0x28')](handleEntityNotFound(_0x2f117e,null))[_0x6bcb('0x28')](respondWithResult(_0x2f117e,null))[_0x6bcb('0x49')](handleError(_0x2f117e,null));};exports['create']=function(_0x5bff7a,_0x35e9c){return db['UserProfile'][_0x6bcb('0x4a')](_0x5bff7a[_0x6bcb('0x4b')],{})[_0x6bcb('0x28')](respondWithResult(_0x35e9c,0xc9))[_0x6bcb('0x49')](handleError(_0x35e9c,null));};exports['clone']=function(_0x5ef666,_0x1ae1d8){var _0xaac7b={'where':{'id':_0x5ef666[_0x6bcb('0x46')]['id']}},_0x5f52ba={};_0x5f52ba[_0x6bcb('0x33')]=_[_0x6bcb('0x34')](db[_0x6bcb('0x2e')][_0x6bcb('0x2f')]);_0xaac7b['attributes']=_[_0x6bcb('0x37')](_0x5f52ba[_0x6bcb('0x33')],qs[_0x6bcb('0x38')](_0x5ef666['query'][_0x6bcb('0x38')]));_0xaac7b[_0x6bcb('0x36')]=_0xaac7b[_0x6bcb('0x36')][_0x6bcb('0x39')]?_0xaac7b[_0x6bcb('0x36')]:_0x5f52ba[_0x6bcb('0x33')];if(_0x5ef666['query'][_0x6bcb('0x47')]){_0xaac7b[_0x6bcb('0x42')]=[{'all':!![]}];}_0xaac7b=_[_0x6bcb('0x3f')]({},_0xaac7b,_0x5ef666[_0x6bcb('0x41')]);return db['UserProfile'][_0x6bcb('0x48')](_0xaac7b)['then'](handleEntityNotFound(_0x1ae1d8,null))['then'](function(_0xa0542){if(_0xa0542){var _0x313f69=_0xa0542[_0x6bcb('0x4c')]({'plain':!![]});_0x313f69=qs[_0x6bcb('0x4d')](_0x313f69,['id','createdAt',_0x6bcb('0x4e'),_0x6bcb('0x4f')]);_0x5ef666[_0x6bcb('0x4b')]=_[_0x6bcb('0x4d')](_0x5ef666['body'],['id','createdAt',_0x6bcb('0x4e')]);return db[_0x6bcb('0x50')][_0x6bcb('0x51')](function(_0x4ad19a){return db[_0x6bcb('0x2e')]['create'](_[_0x6bcb('0x3f')](_0x313f69,_0x5ef666['body']),{'include':_0x5ef666[_0x6bcb('0x35')][_0x6bcb('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x4ad19a})[_0x6bcb('0x28')](function(_0x5dbb20){var _0x1e8104=_0x5dbb20[_0x6bcb('0x4c')]({'plain':!![]});return db[_0x6bcb('0x52')]['findAll']({'where':{'userProfileId':_0x5ef666[_0x6bcb('0x46')]['id']},'raw':!![]})['then'](function(_0x32cd73){if(_0x32cd73){return BPromise[_0x6bcb('0x53')](_0x32cd73,function(_0x2d7b2f){return new BPromise(function(_0x40f33f,_0x84bbbd){if(_0x2d7b2f['autoAssociation']===null||_0x2d7b2f[_0x6bcb('0x54')]===0x1)_0x40f33f(null);return db[_0x6bcb('0x55')][_0x6bcb('0x43')]({'where':{'sectionId':_0x2d7b2f['id']},'raw':!![]})[_0x6bcb('0x28')](function(_0x159819){var _0x27699a=_[_0x6bcb('0x2d')](_0x159819,function(_0x2a8618){return qs['omit'](_0x2a8618,['id',_0x6bcb('0x56'),_0x6bcb('0x4e'),'sectionId']);});_0x40f33f(_0x27699a);})[_0x6bcb('0x49')](function(_0x1c7e73){_0x84bbbd(_0x1c7e73);});})[_0x6bcb('0x28')](function(_0xdc9015){var _0x503378=qs[_0x6bcb('0x4d')](_0x2d7b2f,['id','createdAt',_0x6bcb('0x4e')]);_0x503378[_0x6bcb('0x57')]=_0x1e8104['id'];if(_0xdc9015)_0x503378[_0x6bcb('0x58')]=_0xdc9015;return _0x503378;})['then'](function(_0x4d16ed){return db[_0x6bcb('0x52')][_0x6bcb('0x4a')](_0x4d16ed,{'include':[{'model':db[_0x6bcb('0x55')],'as':_0x6bcb('0x58')}],'raw':!![],'transaction':_0x4ad19a});});})[_0x6bcb('0x28')](function(){return _0x1e8104;});}});});});}})[_0x6bcb('0x28')](respondWithResult(_0x1ae1d8,0xc9))[_0x6bcb('0x49')](handleError(_0x1ae1d8,null));};exports[_0x6bcb('0x27')]=function(_0x5e7204,_0x525265){if(_0x5e7204[_0x6bcb('0x4b')]['id']){delete _0x5e7204[_0x6bcb('0x4b')]['id'];}return db['UserProfile'][_0x6bcb('0x48')]({'where':{'id':_0x5e7204[_0x6bcb('0x46')]['id']}})['then'](handleEntityNotFound(_0x525265,null))[_0x6bcb('0x28')](saveUpdates(_0x5e7204[_0x6bcb('0x4b')],null))[_0x6bcb('0x28')](respondWithResult(_0x525265,null))[_0x6bcb('0x49')](handleError(_0x525265,null));};exports[_0x6bcb('0x29')]=function(_0x2c5e7b,_0x402e3b){return db['UserProfile'][_0x6bcb('0x48')]({'where':{'id':_0x2c5e7b[_0x6bcb('0x46')]['id']}})[_0x6bcb('0x28')](handleEntityNotFound(_0x402e3b,null))['then'](removeEntity(_0x402e3b,null))[_0x6bcb('0x49')](handleError(_0x402e3b,null));};exports[_0x6bcb('0x59')]=function(_0x54191e,_0x483b39){return db['UserProfile'][_0x6bcb('0x59')]()[_0x6bcb('0x28')](respondWithResult(_0x483b39,null))[_0x6bcb('0x49')](handleError(_0x483b39,null));};exports[_0x6bcb('0x5a')]=function(_0x3de0dd,_0x4c5a02){var _0x2803b4=_0x3de0dd[_0x6bcb('0x4b')];return db[_0x6bcb('0x2e')]['find']({'where':{'id':_0x3de0dd[_0x6bcb('0x46')]['id']}})[_0x6bcb('0x28')](handleEntityNotFound(_0x4c5a02,null))[_0x6bcb('0x28')](function(_0x204fea){if(_0x204fea){return db[_0x6bcb('0x50')][_0x6bcb('0x51')](function(_0x536eb8){return db[_0x6bcb('0x52')][_0x6bcb('0x29')]({'where':{'userProfileId':_0x3de0dd[_0x6bcb('0x46')]['id'],'sectionId':_[_0x6bcb('0x2d')](_0x2803b4,function(_0xaad930){return _0xaad930[_0x6bcb('0x5b')];})},'transaction':_0x536eb8})[_0x6bcb('0x28')](function(){var _0x4ff0e7=_['map'](_0x2803b4,function(_0x33e399){_0x33e399[_0x6bcb('0x57')]=_0x3de0dd[_0x6bcb('0x46')]['id'];return _0x33e399;});var _0x5b74da=[];return BPromise[_0x6bcb('0x53')](_0x4ff0e7,function(_0x2dc360){return db['UserProfileSection'][_0x6bcb('0x4a')](_0x2dc360,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x536eb8})[_0x6bcb('0x28')](function(_0x26432d){_0x5b74da[_0x6bcb('0x5c')](_0x26432d['get']({'plain':!![]}));});})[_0x6bcb('0x28')](function(){return _0x5b74da;});});});}})[_0x6bcb('0x28')](function(_0x2e7a4c){return _0x2e7a4c;})[_0x6bcb('0x28')](respondWithResult(_0x4c5a02,null))[_0x6bcb('0x49')](handleError(_0x4c5a02,null));};exports[_0x6bcb('0x5d')]=function(_0x67992f,_0x1022fd){var _0x3a566e;return db[_0x6bcb('0x2e')][_0x6bcb('0x48')]({'where':{'id':_0x67992f[_0x6bcb('0x46')]['id']},'attributes':['id',_0x6bcb('0x2c')]})[_0x6bcb('0x28')](handleEntityNotFound(_0x1022fd,null))[_0x6bcb('0x28')](function(_0x5a5eed){if(_0x5a5eed){_0x3a566e=_0x5a5eed;return db[_0x6bcb('0x52')][_0x6bcb('0x29')]({'where':{'userProfileId':_0x67992f[_0x6bcb('0x46')]['id'],'sectionId':_0x67992f[_0x6bcb('0x35')]['ids']}});}})[_0x6bcb('0x28')](function(){return _0x3a566e;})[_0x6bcb('0x28')](respondWithStatusCode(_0x1022fd,null))[_0x6bcb('0x49')](handleError(_0x1022fd,null));};exports['getSections']=function(_0x486947,_0x13ebf3){var _0x2a67f3=[];var _0x369145=[];return db[_0x6bcb('0x52')][_0x6bcb('0x43')]({'where':{'userProfileId':_0x486947['params']['id']},'raw':!![]})['then'](function(_0x2fda37){_0x2a67f3=_[_0x6bcb('0x3e')](_0x2fda37,function(_0x13001e){return _0x13001e['enabled']===0x1||_[_0x6bcb('0x5e')]([0x3eb,0x709],_0x13001e[_0x6bcb('0x5b')]);});if(!_[_0x6bcb('0x5f')](_0x2a67f3)){return _[_0x6bcb('0x2d')](_0x2a67f3,function(_0x1afee2){return _0x1afee2[_0x6bcb('0x5b')];});}else{return;}})[_0x6bcb('0x28')](function(_0x3711d8){if(_0x3711d8)_0x369145=_0x3711d8;if(_[_0x6bcb('0x5e')](_0x369145,0x64)){var _0x40026f=_[_0x6bcb('0x48')](_0x2a67f3,{'sectionId':0x64});return hasDefaultDashboard(_0x40026f)[_0x6bcb('0x28')](function(_0x80cf7f){return _['map'](_0x2a67f3,function(_0x3d27b9){if(_0x3d27b9[_0x6bcb('0x5b')]===0x64){_0x3d27b9[_0x6bcb('0x60')]=_0x80cf7f;}return _0x3d27b9;});});}else{return;}})[_0x6bcb('0x28')](function(_0x35c2c8){if(_0x35c2c8)_0x2a67f3=_0x35c2c8;if(_[_0x6bcb('0x5e')](_0x369145,0x3eb)){var _0x304e2d=_[_0x6bcb('0x48')](_0x2a67f3,{'sectionId':0x3eb});return getCustomDashboards(_0x304e2d)[_0x6bcb('0x28')](function(_0x150985){return _[_0x6bcb('0x2d')](_0x2a67f3,function(_0x23de37){if(_0x304e2d[_0x6bcb('0x61')]){if(_0x23de37[_0x6bcb('0x5b')]===0x3eb){_0x23de37[_0x6bcb('0x60')]=_0x150985;}}else{if(_0x23de37[_0x6bcb('0x5b')]===0x64){if(!_0x23de37[_0x6bcb('0x60')]){_0x23de37['subsections']=[];}_0x23de37[_0x6bcb('0x60')]=_0x23de37['subsections'][_0x6bcb('0x62')](_0x150985);}}return _0x23de37;});});}else{return;}})[_0x6bcb('0x28')](function(_0x2691b7){if(_0x2691b7)_0x2a67f3=_0x2691b7;if(_[_0x6bcb('0x5e')](_0x369145,0x709)){var _0x5a1b17=_[_0x6bcb('0x48')](_0x2a67f3,{'sectionId':0x709});return getPlugins(_0x5a1b17)[_0x6bcb('0x28')](function(_0x4dd71c){if(_0x5a1b17[_0x6bcb('0x61')]){return _[_0x6bcb('0x2d')](_0x2a67f3,function(_0x5f18e1){if(_0x5f18e1[_0x6bcb('0x5b')]===0x709){_0x5f18e1['subsections']=_0x4dd71c;}return _0x5f18e1;});}else{var _0x546ba8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4dd71c};var _0x582494=_[_0x6bcb('0x2d')](_0x2a67f3);_0x582494['push'](_0x546ba8);return _0x582494;}});}else{return;}})[_0x6bcb('0x28')](function(_0x3b4646){if(_0x3b4646)_0x2a67f3=_0x3b4646;return _[_0x6bcb('0x3e')](_0x2a67f3,[_0x6bcb('0x61'),0x1]);})['then'](respondWithResult(_0x13ebf3,null))['catch'](handleError(_0x13ebf3,null));};function hasDefaultDashboard(_0x2969f5){var _0x569b6e=[0x65];return new BPromise(function(_0x1a22d1,_0x14bdec){try{if(_0x2969f5[_0x6bcb('0x54')]){_0x1a22d1(_0x569b6e);}else{return db[_0x6bcb('0x55')]['findOne']({'where':{'sectionId':_0x2969f5['id']},'raw':!![]})[_0x6bcb('0x28')](function(_0x54b070){_0x54b070?_0x1a22d1(_0x569b6e):_0x1a22d1();});}}catch(_0x26d3a1){_0x14bdec(_0x26d3a1);}});}function getCustomDashboards(_0x348bc2){var _0x4c1022=[];return new BPromise(function(_0x21b744,_0x48f266){try{if(_0x348bc2[_0x6bcb('0x54')]){return db[_0x6bcb('0x63')][_0x6bcb('0x43')]({'raw':!![]})['then'](function(_0x38cc64){_0x38cc64[_0x6bcb('0x64')](function(_0x4fcaf6){_0x4c1022[_0x6bcb('0x5c')](_0x4fcaf6['id']+0x1869f);});_0x21b744(_0x4c1022);});}else{return db[_0x6bcb('0x55')][_0x6bcb('0x43')]({'where':{'sectionId':_0x348bc2['id']},'raw':!![]})[_0x6bcb('0x28')](function(_0x308e43){_0x308e43[_0x6bcb('0x64')](function(_0x3fb53a){_0x4c1022[_0x6bcb('0x5c')](_0x3fb53a[_0x6bcb('0x65')]+0x1869f);});_0x21b744(_0x4c1022);});}}catch(_0x27121f){_0x48f266(_0x27121f);}});}function getPlugins(_0x52d94b){var _0x103ca4=[];return new BPromise(function(_0x3a51a5,_0x11ff05){try{if(_0x52d94b['autoAssociation']){return db[_0x6bcb('0x66')][_0x6bcb('0x43')]({'raw':!![]})['then'](function(_0x5a0625){_0x5a0625[_0x6bcb('0x64')](function(_0xa60301){_0x103ca4[_0x6bcb('0x5c')](_0xa60301['id']+0x15b38);});_0x3a51a5(_0x103ca4);});}else{return db[_0x6bcb('0x55')][_0x6bcb('0x43')]({'where':{'sectionId':_0x52d94b['id']},'raw':!![]})['then'](function(_0x2a253b){_0x2a253b['forEach'](function(_0x40222d){_0x103ca4[_0x6bcb('0x5c')](_0x40222d[_0x6bcb('0x65')]+0x15b38);});_0x3a51a5(_0x103ca4);});}}catch(_0x4e7c56){_0x11ff05(_0x4e7c56);}});}exports[_0x6bcb('0x67')]=function(_0x388246,_0x1bf744){return db[_0x6bcb('0x2e')]['find']({'where':{'id':_0x388246['params']['id']}})['then'](handleEntityNotFound(_0x1bf744,null))[_0x6bcb('0x28')](function(_0x2af78a){if(_0x2af78a){return db[_0x6bcb('0x50')]['transaction'](function(_0x41c308){return db['UserProfileSection'][_0x6bcb('0x43')]({'where':{'userProfileId':_0x388246['params']['id']},'attributes':['id'],'raw':!![]})[_0x6bcb('0x28')](function(_0x436d3c){if(_0x436d3c){return db['UserProfileSection'][_0x6bcb('0x29')]({'where':{'userProfileId':_0x388246[_0x6bcb('0x46')]['id'],'id':_[_0x6bcb('0x2d')](_0x436d3c,function(_0x345d2c){return _0x345d2c['id'];})},'transaction':_0x41c308});}})['then'](function(_0x23d185){var _0x2c8a3e=_[_0x6bcb('0x2d')](_0x388246[_0x6bcb('0x4b')],function(_0x1a1bce){_0x1a1bce[_0x6bcb('0x57')]=_0x388246['params']['id'];return _0x1a1bce;});return db[_0x6bcb('0x52')]['bulkCreate'](_0x2c8a3e,{'raw':!![],'transaction':_0x41c308});})[_0x6bcb('0x28')](function(_0x551680){var _0x350e27=_['filter'](_['map'](_0x551680,function(_0x289b0b){return _0x289b0b[_0x6bcb('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x350e27){return db[_0x6bcb('0x52')][_0x6bcb('0x43')]({'where':{'userProfileId':_0x388246['params']['id'],'sectionId':_[_0x6bcb('0x2d')](_0x350e27,function(_0x2ae111){return _0x2ae111[_0x6bcb('0x5b')];})},'attributes':['id',_0x6bcb('0x5b')],'raw':!![]})[_0x6bcb('0x28')](function(_0x57983a){var _0x462035=_['map'](_0x388246[_0x6bcb('0x4b')],function(_0x3e6f2c){_0x3e6f2c[_0x6bcb('0x57')]=_0x388246[_0x6bcb('0x46')]['id'];return _0x3e6f2c;});return db['UserProfileResource'][_0x6bcb('0x68')](_0x462035,{'raw':!![],'transaction':_0x41c308});});}})[_0x6bcb('0x49')](handleError(_0x1bf744,null));});}})['then'](function(_0x8afcf5){var _0xd14c23=_[_0x6bcb('0x2d')](_0x8afcf5,function(_0x35e7fb){return _0x35e7fb[_0x6bcb('0x4c')]({'plain':!![]});});})[_0x6bcb('0x28')](respondWithResult(_0x1bf744,null))[_0x6bcb('0x49')](handleError(_0x1bf744,null));};exports[_0x6bcb('0x69')]=function(_0x587b2a,_0x287bd8,_0xf0ae0c){return db[_0x6bcb('0x2e')][_0x6bcb('0x48')]({'where':{'id':_0x587b2a[_0x6bcb('0x46')]['id']}})['then'](handleEntityNotFound(_0x287bd8,null))[_0x6bcb('0x28')](function(_0xd5d6f1){if(_0xd5d6f1){return _0xd5d6f1[_0x6bcb('0x69')](_0x587b2a[_0x6bcb('0x35')][_0x6bcb('0x6a')]);}})[_0x6bcb('0x28')](respondWithStatusCode(_0x287bd8,null))[_0x6bcb('0x49')](handleError(_0x287bd8,null));};exports[_0x6bcb('0x6b')]=function(_0x55b29b,_0x4da5a4){var _0xa82d4f={};if(!_0x55b29b[_0x6bcb('0x35')][_0x6bcb('0x6c')])throw new Error('Missing\x20section\x20parameter');if(!_0x55b29b['query'][_0x6bcb('0x3a')](_0x6bcb('0x6d'))){_0xa82d4f[_0x6bcb('0x22')]=qs[_0x6bcb('0x22')](_0x55b29b[_0x6bcb('0x35')]['limit']);_0xa82d4f[_0x6bcb('0x20')]=qs[_0x6bcb('0x20')](_0x55b29b[_0x6bcb('0x35')][_0x6bcb('0x20')]);}return db[_0x6bcb('0x2e')]['find']({'where':{'id':_0x55b29b[_0x6bcb('0x46')]['id']}})[_0x6bcb('0x28')](function(_0x348d26){if(!_0x348d26)throw new Error(_0x6bcb('0x6e')+_0x55b29b['params']['id']);return db[_0x6bcb('0x2e')][_0x6bcb('0x6b')](_0x55b29b);})[_0x6bcb('0x28')](respondWithFilteredResult(_0x4da5a4,_0xa82d4f))[_0x6bcb('0x49')](handleError(_0x4da5a4,null));}; \ No newline at end of file +var _0xa667=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','length','options','find','body','clone','params','createdAt','updatedAt','omit','sequelize','create','includeAll','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','removeSections','ids','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','push','addResources','removeResources','getResources','Missing\x20section\x20parameter','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2489de,_0x1e1ad2){var _0x36c6a3=function(_0x3ccdc9){while(--_0x3ccdc9){_0x2489de['push'](_0x2489de['shift']());}};_0x36c6a3(++_0x1e1ad2);}(_0xa667,0x13c));var _0x7a66=function(_0x20b556,_0x31f130){_0x20b556=_0x20b556-0x0;var _0x548e68=_0xa667[_0x20b556];return _0x548e68;};'use strict';var emlformat=require(_0x7a66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a66('0x1'));var jsonpatch=require(_0x7a66('0x2'));var rp=require(_0x7a66('0x3'));var moment=require(_0x7a66('0x4'));var BPromise=require(_0x7a66('0x5'));var Mustache=require(_0x7a66('0x6'));var util=require(_0x7a66('0x7'));var path=require(_0x7a66('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a66('0x9'));var fs=require('fs');var fs_extra=require(_0x7a66('0xa'));var _=require(_0x7a66('0xb'));var squel=require(_0x7a66('0xc'));var crypto=require(_0x7a66('0xd'));var jsforce=require(_0x7a66('0xe'));var deskjs=require(_0x7a66('0xf'));var toCsv=require(_0x7a66('0x10'));var querystring=require(_0x7a66('0x11'));var Papa=require(_0x7a66('0x12'));var Redis=require(_0x7a66('0x13'));var authService=require(_0x7a66('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7a66('0x15'));var hardwareService=require(_0x7a66('0x16'));var logger=require(_0x7a66('0x17'))('api');var utils=require(_0x7a66('0x18'));var config=require(_0x7a66('0x19'));var licenseUtil=require(_0x7a66('0x1a'));var db=require('../../mysqldb')['db'];config[_0x7a66('0x1b')]=_[_0x7a66('0x1c')](config[_0x7a66('0x1b')],{'host':_0x7a66('0x1d'),'port':0x18eb});var socket=require(_0x7a66('0x1e'))(new Redis(config[_0x7a66('0x1b')]));require(_0x7a66('0x1f'))['register'](socket);function respondWithStatusCode(_0x5e50f9,_0x446ba5){_0x446ba5=_0x446ba5||0xcc;return function(_0x5de626){if(_0x5de626){return _0x5e50f9[_0x7a66('0x20')](_0x446ba5);}return _0x5e50f9[_0x7a66('0x21')](_0x446ba5)[_0x7a66('0x22')]();};}function respondWithResult(_0xf76e3e,_0xd1a6d0){_0xd1a6d0=_0xd1a6d0||0xc8;return function(_0x522b69){if(_0x522b69){return _0xf76e3e[_0x7a66('0x21')](_0xd1a6d0)['json'](_0x522b69);}};}function respondWithFilteredResult(_0x378309,_0x5214af){return function(_0x152657){if(_0x152657){var _0x3cde56=typeof _0x5214af[_0x7a66('0x23')]==='undefined'&&typeof _0x5214af['limit']==='undefined';var _0x574939=_0x152657[_0x7a66('0x24')];var _0x5528cb=_0x3cde56?0x0:_0x5214af[_0x7a66('0x23')];var _0x29e4d5=_0x3cde56?_0x152657[_0x7a66('0x24')]:_0x5214af[_0x7a66('0x23')]+_0x5214af[_0x7a66('0x25')];var _0x35d08d;if(_0x29e4d5>=_0x574939){_0x29e4d5=_0x574939;_0x35d08d=0xc8;}else{_0x35d08d=0xce;}_0x378309[_0x7a66('0x21')](_0x35d08d);return _0x378309[_0x7a66('0x26')](_0x7a66('0x27'),_0x5528cb+'-'+_0x29e4d5+'/'+_0x574939)[_0x7a66('0x28')](_0x152657);}return null;};}function patchUpdates(_0x2ec3b1){return function(_0x512cfc){try{jsonpatch[_0x7a66('0x29')](_0x512cfc,_0x2ec3b1,!![]);}catch(_0x1b96af){return BPromise[_0x7a66('0x2a')](_0x1b96af);}return _0x512cfc[_0x7a66('0x2b')]();};}function saveUpdates(_0x53194d,_0x2d1810){return function(_0x425b6d){if(_0x425b6d){return _0x425b6d['update'](_0x53194d)[_0x7a66('0x2c')](function(_0x2f13f9){return _0x2f13f9;});}return null;};}function removeEntity(_0x8d010c,_0x98423d){return function(_0x5ae6ae){if(_0x5ae6ae){return _0x5ae6ae['destroy']()['then'](function(){_0x8d010c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4b1f,_0x373e64){return function(_0x448bec){if(!_0x448bec){_0x3e4b1f[_0x7a66('0x20')](0x194);}return _0x448bec;};}function handleError(_0x2e8381,_0x3c4709){_0x3c4709=_0x3c4709||0x1f4;return function(_0xdd71f3){logger[_0x7a66('0x2d')](_0xdd71f3[_0x7a66('0x2e')]);if(_0xdd71f3[_0x7a66('0x2f')]){delete _0xdd71f3[_0x7a66('0x2f')];}_0x2e8381[_0x7a66('0x21')](_0x3c4709)[_0x7a66('0x30')](_0xdd71f3);};}exports[_0x7a66('0x31')]=function(_0x3618c9,_0x531702){var _0x424c04={},_0x2d2fb8={},_0x28413a={'count':0x0,'rows':[]};var _0x592468=_[_0x7a66('0x32')](db[_0x7a66('0x33')][_0x7a66('0x34')],function(_0x45c2b7){return{'name':_0x45c2b7[_0x7a66('0x35')],'type':_0x45c2b7['type'][_0x7a66('0x36')]};});_0x2d2fb8[_0x7a66('0x37')]=_['map'](_0x592468,_0x7a66('0x2f'));_0x2d2fb8[_0x7a66('0x38')]=_[_0x7a66('0x39')](_0x3618c9[_0x7a66('0x38')]);_0x2d2fb8[_0x7a66('0x3a')]=_[_0x7a66('0x3b')](_0x2d2fb8[_0x7a66('0x37')],_0x2d2fb8[_0x7a66('0x38')]);_0x424c04[_0x7a66('0x3c')]=_[_0x7a66('0x3b')](_0x2d2fb8[_0x7a66('0x37')],qs[_0x7a66('0x3d')](_0x3618c9[_0x7a66('0x38')][_0x7a66('0x3d')]));_0x424c04[_0x7a66('0x3c')]=_0x424c04[_0x7a66('0x3c')]['length']?_0x424c04[_0x7a66('0x3c')]:_0x2d2fb8['model'];if(!_0x3618c9['query']['hasOwnProperty'](_0x7a66('0x3e'))){_0x424c04[_0x7a66('0x25')]=qs[_0x7a66('0x25')](_0x3618c9[_0x7a66('0x38')][_0x7a66('0x25')]);_0x424c04['offset']=qs[_0x7a66('0x23')](_0x3618c9['query'][_0x7a66('0x23')]);}_0x424c04[_0x7a66('0x3f')]=qs['sort'](_0x3618c9['query'][_0x7a66('0x40')]);_0x424c04[_0x7a66('0x41')]=qs[_0x7a66('0x3a')](_[_0x7a66('0x42')](_0x3618c9[_0x7a66('0x38')],_0x2d2fb8[_0x7a66('0x3a')]),_0x592468);if(_0x3618c9[_0x7a66('0x38')][_0x7a66('0x43')]){_0x424c04[_0x7a66('0x41')]=_[_0x7a66('0x44')](_0x424c04[_0x7a66('0x41')],{'$or':_[_0x7a66('0x32')](_0x592468,function(_0x466962){if(_0x466962['type']!=='VIRTUAL'){var _0x38d750={};_0x38d750[_0x466962[_0x7a66('0x2f')]]={'$like':'%'+_0x3618c9['query'][_0x7a66('0x43')]+'%'};return _0x38d750;}})});}_0x424c04=_[_0x7a66('0x44')]({},_0x424c04,_0x3618c9['options']);var _0x3742d9={'where':_0x424c04[_0x7a66('0x41')]};return db[_0x7a66('0x33')]['count'](_0x3742d9)[_0x7a66('0x2c')](function(_0x3a71a1){_0x28413a['count']=_0x3a71a1;if(_0x3618c9['query']['includeAll']){_0x424c04[_0x7a66('0x45')]=[{'all':!![]}];}return db[_0x7a66('0x33')][_0x7a66('0x46')](_0x424c04);})['then'](function(_0x3bf242){_0x28413a[_0x7a66('0x47')]=_0x3bf242;return _0x28413a;})[_0x7a66('0x2c')](respondWithFilteredResult(_0x531702,_0x424c04))[_0x7a66('0x48')](handleError(_0x531702,null));};exports[_0x7a66('0x49')]=function(_0x350a36,_0x2290e5){var _0x481820={'raw':![],'where':{'id':_0x350a36['params']['id']}},_0x3ce7fe={};_0x3ce7fe[_0x7a66('0x37')]=_[_0x7a66('0x39')](db[_0x7a66('0x33')][_0x7a66('0x34')]);_0x3ce7fe[_0x7a66('0x38')]=_['keys'](_0x350a36[_0x7a66('0x38')]);_0x3ce7fe[_0x7a66('0x3a')]=_[_0x7a66('0x3b')](_0x3ce7fe[_0x7a66('0x37')],_0x3ce7fe[_0x7a66('0x38')]);_0x481820['attributes']=_[_0x7a66('0x3b')](_0x3ce7fe[_0x7a66('0x37')],qs[_0x7a66('0x3d')](_0x350a36[_0x7a66('0x38')][_0x7a66('0x3d')]));_0x481820[_0x7a66('0x3c')]=_0x481820[_0x7a66('0x3c')][_0x7a66('0x4a')]?_0x481820[_0x7a66('0x3c')]:_0x3ce7fe[_0x7a66('0x37')];if(_0x350a36[_0x7a66('0x38')]['includeAll']){_0x481820['include']=[{'all':!![]}];}_0x481820=_[_0x7a66('0x44')]({},_0x481820,_0x350a36[_0x7a66('0x4b')]);return db[_0x7a66('0x33')][_0x7a66('0x4c')](_0x481820)[_0x7a66('0x2c')](handleEntityNotFound(_0x2290e5,null))[_0x7a66('0x2c')](respondWithResult(_0x2290e5,null))[_0x7a66('0x48')](handleError(_0x2290e5,null));};exports['create']=function(_0x416922,_0xee3e0){return db[_0x7a66('0x33')]['create'](_0x416922[_0x7a66('0x4d')],{})['then'](respondWithResult(_0xee3e0,0xc9))['catch'](handleError(_0xee3e0,null));};exports[_0x7a66('0x4e')]=function(_0x565c87,_0x155eba){var _0x4b769a={'where':{'id':_0x565c87[_0x7a66('0x4f')]['id']}},_0x1307e4={};_0x1307e4[_0x7a66('0x37')]=_['keys'](db[_0x7a66('0x33')][_0x7a66('0x34')]);_0x4b769a['attributes']=_[_0x7a66('0x3b')](_0x1307e4[_0x7a66('0x37')],qs[_0x7a66('0x3d')](_0x565c87[_0x7a66('0x38')][_0x7a66('0x3d')]));_0x4b769a['attributes']=_0x4b769a[_0x7a66('0x3c')]['length']?_0x4b769a[_0x7a66('0x3c')]:_0x1307e4['model'];if(_0x565c87[_0x7a66('0x38')]['includeAll']){_0x4b769a[_0x7a66('0x45')]=[{'all':!![]}];}_0x4b769a=_[_0x7a66('0x44')]({},_0x4b769a,_0x565c87[_0x7a66('0x4b')]);return db['UserProfile'][_0x7a66('0x4c')](_0x4b769a)[_0x7a66('0x2c')](handleEntityNotFound(_0x155eba,null))[_0x7a66('0x2c')](function(_0x555d56){if(_0x555d56){var _0x3fada7=_0x555d56['get']({'plain':!![]});_0x3fada7=qs['omit'](_0x3fada7,['id',_0x7a66('0x50'),_0x7a66('0x51'),'crudPermissions']);_0x565c87['body']=_[_0x7a66('0x52')](_0x565c87[_0x7a66('0x4d')],['id',_0x7a66('0x50'),_0x7a66('0x51')]);return db[_0x7a66('0x53')]['transaction'](function(_0xd004df){return db[_0x7a66('0x33')][_0x7a66('0x54')](_[_0x7a66('0x44')](_0x3fada7,_0x565c87[_0x7a66('0x4d')]),{'include':_0x565c87[_0x7a66('0x38')][_0x7a66('0x55')]?[{'all':!![]}]:undefined,'transaction':_0xd004df})[_0x7a66('0x2c')](function(_0x33c1a0){var _0x42e0f4=_0x33c1a0[_0x7a66('0x56')]({'plain':!![]});return db[_0x7a66('0x57')][_0x7a66('0x46')]({'where':{'userProfileId':_0x565c87[_0x7a66('0x4f')]['id']},'raw':!![]})[_0x7a66('0x2c')](function(_0x4fc18f){if(_0x4fc18f){return BPromise[_0x7a66('0x58')](_0x4fc18f,function(_0x1578bd){return new BPromise(function(_0x5dbb84,_0x315d03){if(_0x1578bd[_0x7a66('0x59')]===null||_0x1578bd[_0x7a66('0x59')]===0x1)_0x5dbb84(null);return db[_0x7a66('0x5a')]['findAll']({'where':{'sectionId':_0x1578bd['id']},'raw':!![]})[_0x7a66('0x2c')](function(_0x15573d){var _0x4e9502=_['map'](_0x15573d,function(_0x5424bb){return qs[_0x7a66('0x52')](_0x5424bb,['id','createdAt',_0x7a66('0x51'),_0x7a66('0x5b')]);});_0x5dbb84(_0x4e9502);})[_0x7a66('0x48')](function(_0x39f0ad){_0x315d03(_0x39f0ad);});})['then'](function(_0xa71bb){var _0x4ebdcc=qs[_0x7a66('0x52')](_0x1578bd,['id',_0x7a66('0x50'),_0x7a66('0x51')]);_0x4ebdcc[_0x7a66('0x5c')]=_0x42e0f4['id'];if(_0xa71bb)_0x4ebdcc[_0x7a66('0x5d')]=_0xa71bb;return _0x4ebdcc;})[_0x7a66('0x2c')](function(_0x489fd){return db['UserProfileSection'][_0x7a66('0x54')](_0x489fd,{'include':[{'model':db[_0x7a66('0x5a')],'as':_0x7a66('0x5d')}],'raw':!![],'transaction':_0xd004df});});})[_0x7a66('0x2c')](function(){return _0x42e0f4;});}});});});}})[_0x7a66('0x2c')](respondWithResult(_0x155eba,0xc9))[_0x7a66('0x48')](handleError(_0x155eba,null));};exports['update']=function(_0x4f940d,_0x43bea0){if(_0x4f940d[_0x7a66('0x4d')]['id']){delete _0x4f940d[_0x7a66('0x4d')]['id'];}return db[_0x7a66('0x33')][_0x7a66('0x4c')]({'where':{'id':_0x4f940d['params']['id']}})[_0x7a66('0x2c')](handleEntityNotFound(_0x43bea0,null))[_0x7a66('0x2c')](saveUpdates(_0x4f940d[_0x7a66('0x4d')],null))['then'](respondWithResult(_0x43bea0,null))[_0x7a66('0x48')](handleError(_0x43bea0,null));};exports[_0x7a66('0x5e')]=function(_0x22bfaf,_0x10de6a){return db['UserProfile']['find']({'where':{'id':_0x22bfaf['params']['id']}})[_0x7a66('0x2c')](handleEntityNotFound(_0x10de6a,null))['then'](removeEntity(_0x10de6a,null))[_0x7a66('0x48')](handleError(_0x10de6a,null));};exports[_0x7a66('0x5f')]=function(_0x34c568,_0x30e1f7){return db[_0x7a66('0x33')][_0x7a66('0x5f')]()['then'](respondWithResult(_0x30e1f7,null))[_0x7a66('0x48')](handleError(_0x30e1f7,null));};exports[_0x7a66('0x60')]=function(_0x3438b1,_0x57967d){var _0x19eeca=_0x3438b1[_0x7a66('0x4d')];return db['UserProfile'][_0x7a66('0x4c')]({'where':{'id':_0x3438b1[_0x7a66('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57967d,null))[_0x7a66('0x2c')](function(_0x4acc89){if(_0x4acc89){return db[_0x7a66('0x53')]['transaction'](function(_0x408ea9){return db[_0x7a66('0x57')][_0x7a66('0x5e')]({'where':{'userProfileId':_0x3438b1['params']['id'],'sectionId':_['map'](_0x19eeca,function(_0x5207b5){return _0x5207b5['sectionId'];})},'transaction':_0x408ea9})['then'](function(){var _0x354548=_['map'](_0x19eeca,function(_0x283efb){_0x283efb['userProfileId']=_0x3438b1[_0x7a66('0x4f')]['id'];return _0x283efb;});var _0xb686a3=[];return BPromise[_0x7a66('0x58')](_0x354548,function(_0x2ab1a9){return db[_0x7a66('0x57')]['create'](_0x2ab1a9,{'include':[{'model':db['UserProfileResource'],'as':_0x7a66('0x5d')}],'raw':!![],'transaction':_0x408ea9})[_0x7a66('0x2c')](function(_0x198bee){_0xb686a3['push'](_0x198bee[_0x7a66('0x56')]({'plain':!![]}));});})[_0x7a66('0x2c')](function(){return _0xb686a3;});});});}})[_0x7a66('0x2c')](function(_0x5e9684){return _0x5e9684;})[_0x7a66('0x2c')](respondWithResult(_0x57967d,null))[_0x7a66('0x48')](handleError(_0x57967d,null));};exports[_0x7a66('0x61')]=function(_0x42263a,_0x4308ab){var _0x4120ce;return db[_0x7a66('0x33')][_0x7a66('0x4c')]({'where':{'id':_0x42263a['params']['id']},'attributes':['id',_0x7a66('0x2f')]})['then'](handleEntityNotFound(_0x4308ab,null))[_0x7a66('0x2c')](function(_0xba95f9){if(_0xba95f9){_0x4120ce=_0xba95f9;return db['UserProfileSection'][_0x7a66('0x5e')]({'where':{'userProfileId':_0x42263a['params']['id'],'sectionId':_0x42263a[_0x7a66('0x38')][_0x7a66('0x62')]}});}})[_0x7a66('0x2c')](function(){return _0x4120ce;})[_0x7a66('0x2c')](respondWithStatusCode(_0x4308ab,null))[_0x7a66('0x48')](handleError(_0x4308ab,null));};exports[_0x7a66('0x63')]=function(_0x258fd0,_0x287454){var _0xfcff5a=[];var _0x42288f=[];return db['UserProfileSection'][_0x7a66('0x46')]({'where':{'userProfileId':_0x258fd0[_0x7a66('0x4f')]['id']},'raw':!![]})['then'](function(_0xf37f1e){_0xfcff5a=_[_0x7a66('0x43')](_0xf37f1e,function(_0x5af540){return _0x5af540[_0x7a66('0x64')]===0x1||_[_0x7a66('0x65')]([0x3eb,0x709],_0x5af540[_0x7a66('0x5b')]);});if(!_['isEmpty'](_0xfcff5a)){return _['map'](_0xfcff5a,function(_0x399bee){return _0x399bee[_0x7a66('0x5b')];});}else{return;}})['then'](function(_0x1dba4b){if(_0x1dba4b)_0x42288f=_0x1dba4b;if(_[_0x7a66('0x65')](_0x42288f,0x64)){var _0xda5837=_[_0x7a66('0x4c')](_0xfcff5a,{'sectionId':0x64});return hasDefaultDashboard(_0xda5837)['then'](function(_0x343bbd){return _['map'](_0xfcff5a,function(_0x874464){if(_0x874464[_0x7a66('0x5b')]===0x64){_0x874464[_0x7a66('0x66')]=_0x343bbd;}return _0x874464;});});}else{return;}})['then'](function(_0x306147){if(_0x306147)_0xfcff5a=_0x306147;if(_[_0x7a66('0x65')](_0x42288f,0x3eb)){var _0x1cf598=_['find'](_0xfcff5a,{'sectionId':0x3eb});return getCustomDashboards(_0x1cf598)[_0x7a66('0x2c')](function(_0x414312){return _['map'](_0xfcff5a,function(_0x3d2dc2){if(_0x1cf598[_0x7a66('0x64')]){if(_0x3d2dc2[_0x7a66('0x5b')]===0x3eb){_0x3d2dc2['subsections']=_0x414312;}}else{if(_0x3d2dc2[_0x7a66('0x5b')]===0x64){if(!_0x3d2dc2[_0x7a66('0x66')]){_0x3d2dc2[_0x7a66('0x66')]=[];}_0x3d2dc2[_0x7a66('0x66')]=_0x3d2dc2['subsections']['concat'](_0x414312);}}return _0x3d2dc2;});});}else{return;}})[_0x7a66('0x2c')](function(_0x38ad0e){if(_0x38ad0e)_0xfcff5a=_0x38ad0e;if(_[_0x7a66('0x65')](_0x42288f,0x709)){var _0x15eafe=_['find'](_0xfcff5a,{'sectionId':0x709});return getPlugins(_0x15eafe)[_0x7a66('0x2c')](function(_0x1c071f){if(_0x15eafe[_0x7a66('0x64')]){return _[_0x7a66('0x32')](_0xfcff5a,function(_0x2d5e91){if(_0x2d5e91[_0x7a66('0x5b')]===0x709){_0x2d5e91[_0x7a66('0x66')]=_0x1c071f;}return _0x2d5e91;});}else{var _0xf61500={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1c071f};var _0x3b7631=_[_0x7a66('0x32')](_0xfcff5a);_0x3b7631['push'](_0xf61500);return _0x3b7631;}});}else{return;}})[_0x7a66('0x2c')](function(_0x40e56d){if(_0x40e56d)_0xfcff5a=_0x40e56d;return _[_0x7a66('0x43')](_0xfcff5a,[_0x7a66('0x64'),0x1]);})[_0x7a66('0x2c')](respondWithResult(_0x287454,null))[_0x7a66('0x48')](handleError(_0x287454,null));};function hasDefaultDashboard(_0x70caa6){var _0x298e1a=[0x65];return new BPromise(function(_0x23e6c4,_0x51a4c7){try{if(_0x70caa6['autoAssociation']){_0x23e6c4(_0x298e1a);}else{return db[_0x7a66('0x5a')][_0x7a66('0x67')]({'where':{'sectionId':_0x70caa6['id']},'raw':!![]})[_0x7a66('0x2c')](function(_0x3ef3d8){_0x3ef3d8?_0x23e6c4(_0x298e1a):_0x23e6c4();});}}catch(_0x39c59a){_0x51a4c7(_0x39c59a);}});}function getCustomDashboards(_0x58b1e2){var _0x3ef4d5=[];return new BPromise(function(_0x9b86f7,_0x30a4e2){try{if(_0x58b1e2[_0x7a66('0x59')]){return db[_0x7a66('0x68')][_0x7a66('0x46')]({'raw':!![]})[_0x7a66('0x2c')](function(_0x2affe2){_0x2affe2[_0x7a66('0x69')](function(_0x3d16b8){_0x3ef4d5['push'](_0x3d16b8['id']+0x1869f);});_0x9b86f7(_0x3ef4d5);});}else{return db[_0x7a66('0x5a')][_0x7a66('0x46')]({'where':{'sectionId':_0x58b1e2['id']},'raw':!![]})[_0x7a66('0x2c')](function(_0x1b3a2c){_0x1b3a2c['forEach'](function(_0xb081f4){_0x3ef4d5['push'](_0xb081f4[_0x7a66('0x6a')]+0x1869f);});_0x9b86f7(_0x3ef4d5);});}}catch(_0x4418f2){_0x30a4e2(_0x4418f2);}});}function getPlugins(_0x497095){var _0x367d1a=[];return new BPromise(function(_0x146224,_0xf7b254){try{if(_0x497095[_0x7a66('0x59')]){return db['Plugin'][_0x7a66('0x46')]({'raw':!![]})[_0x7a66('0x2c')](function(_0x1a40e9){_0x1a40e9[_0x7a66('0x69')](function(_0x966b87){_0x367d1a[_0x7a66('0x6b')](_0x966b87['id']+0x15b38);});_0x146224(_0x367d1a);});}else{return db['UserProfileResource'][_0x7a66('0x46')]({'where':{'sectionId':_0x497095['id']},'raw':!![]})[_0x7a66('0x2c')](function(_0x24457d){_0x24457d[_0x7a66('0x69')](function(_0x166427){_0x367d1a[_0x7a66('0x6b')](_0x166427[_0x7a66('0x6a')]+0x15b38);});_0x146224(_0x367d1a);});}}catch(_0x442543){_0xf7b254(_0x442543);}});}exports[_0x7a66('0x6c')]=function(_0xcd1480,_0x405e30){return db[_0x7a66('0x33')]['find']({'where':{'id':_0xcd1480['params']['id']}})['then'](handleEntityNotFound(_0x405e30,null))[_0x7a66('0x2c')](function(_0x21c30e){if(_0x21c30e){return db[_0x7a66('0x53')]['transaction'](function(_0x53129b){return db[_0x7a66('0x57')][_0x7a66('0x46')]({'where':{'userProfileId':_0xcd1480[_0x7a66('0x4f')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3611a1){if(_0x3611a1){return db['UserProfileSection'][_0x7a66('0x5e')]({'where':{'userProfileId':_0xcd1480[_0x7a66('0x4f')]['id'],'id':_[_0x7a66('0x32')](_0x3611a1,function(_0x1118fc){return _0x1118fc['id'];})},'transaction':_0x53129b});}})[_0x7a66('0x2c')](function(_0x1b779e){var _0x49726f=_['map'](_0xcd1480[_0x7a66('0x4d')],function(_0x3ff44b){_0x3ff44b[_0x7a66('0x5c')]=_0xcd1480[_0x7a66('0x4f')]['id'];return _0x3ff44b;});return db[_0x7a66('0x57')]['bulkCreate'](_0x49726f,{'raw':!![],'transaction':_0x53129b});})['then'](function(_0x707eec){var _0x27faf6=_['filter'](_['map'](_0x707eec,function(_0x576cd1){return _0x576cd1[_0x7a66('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x27faf6){return db[_0x7a66('0x57')][_0x7a66('0x46')]({'where':{'userProfileId':_0xcd1480[_0x7a66('0x4f')]['id'],'sectionId':_[_0x7a66('0x32')](_0x27faf6,function(_0x44d2a7){return _0x44d2a7['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x7a66('0x2c')](function(_0x3d8752){var _0xd3dad7=_[_0x7a66('0x32')](_0xcd1480[_0x7a66('0x4d')],function(_0x11c49f){_0x11c49f[_0x7a66('0x5c')]=_0xcd1480[_0x7a66('0x4f')]['id'];return _0x11c49f;});return db[_0x7a66('0x5a')]['bulkCreate'](_0xd3dad7,{'raw':!![],'transaction':_0x53129b});});}})['catch'](handleError(_0x405e30,null));});}})[_0x7a66('0x2c')](function(_0x42c8f1){var _0xe6ffae=_[_0x7a66('0x32')](_0x42c8f1,function(_0x10f62d){return _0x10f62d[_0x7a66('0x56')]({'plain':!![]});});})[_0x7a66('0x2c')](respondWithResult(_0x405e30,null))[_0x7a66('0x48')](handleError(_0x405e30,null));};exports['removeResources']=function(_0x540566,_0x317804,_0xacd86c){return db[_0x7a66('0x33')][_0x7a66('0x4c')]({'where':{'id':_0x540566[_0x7a66('0x4f')]['id']}})['then'](handleEntityNotFound(_0x317804,null))[_0x7a66('0x2c')](function(_0x15b885){if(_0x15b885){return _0x15b885[_0x7a66('0x6d')](_0x540566[_0x7a66('0x38')][_0x7a66('0x62')]);}})[_0x7a66('0x2c')](respondWithStatusCode(_0x317804,null))[_0x7a66('0x48')](handleError(_0x317804,null));};exports[_0x7a66('0x6e')]=function(_0x468fd7,_0x645efd){var _0xe0a89={};if(!_0x468fd7[_0x7a66('0x38')]['section'])throw new Error(_0x7a66('0x6f'));if(!_0x468fd7[_0x7a66('0x38')][_0x7a66('0x70')]('nolimit')){_0xe0a89[_0x7a66('0x25')]=qs['limit'](_0x468fd7[_0x7a66('0x38')][_0x7a66('0x25')]);_0xe0a89['offset']=qs[_0x7a66('0x23')](_0x468fd7[_0x7a66('0x38')][_0x7a66('0x23')]);}return db[_0x7a66('0x33')][_0x7a66('0x4c')]({'where':{'id':_0x468fd7[_0x7a66('0x4f')]['id']}})[_0x7a66('0x2c')](function(_0x391168){if(!_0x391168)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x468fd7[_0x7a66('0x4f')]['id']);return db[_0x7a66('0x33')][_0x7a66('0x6e')](_0x468fd7);})[_0x7a66('0x2c')](respondWithFilteredResult(_0x645efd,_0xe0a89))['catch'](handleError(_0x645efd,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e4ce06e..deef6f4 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 _0xc14a=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xc498b3,_0x5610b4){var _0x1e2530=function(_0x5c6e08){while(--_0x5c6e08){_0xc498b3['push'](_0xc498b3['shift']());}};_0x1e2530(++_0x5610b4);}(_0xc14a,0xa9));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0xac14('0x0'));var UserProfile=require(_0xac14('0x1'))['db'][_0xac14('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xac14('0x3')](0x0);var events={'afterCreate':_0xac14('0x4'),'afterUpdate':'update','afterDestroy':_0xac14('0x5')};function emitEvent(_0x21c4da){return function(_0x53f3d1,_0x412485,_0x525320){UserProfileEvents[_0xac14('0x6')](_0x21c4da+':'+_0x53f3d1['id'],_0x53f3d1);UserProfileEvents[_0xac14('0x6')](_0x21c4da,_0x53f3d1);_0x525320(null);};}for(var e in events){if(events[_0xac14('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xac14('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x7eff=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf7ef('0x0'))['db'][_0xf7ef('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf7ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7ef('0x3'),'afterDestroy':_0xf7ef('0x4')};function emitEvent(_0xc0c7ba){return function(_0x4db614,_0x58a651,_0x4a4573){UserProfileEvents[_0xf7ef('0x5')](_0xc0c7ba+':'+_0x4db614['id'],_0x4db614);UserProfileEvents[_0xf7ef('0x5')](_0xc0c7ba,_0x4db614);_0x4a4573(null);};}for(var e in events){if(events[_0xf7ef('0x6')](e)){var event=events[e];UserProfile[_0xf7ef('0x7')](e,emitEvent(event));}}module[_0xf7ef('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3b1fc1b..ce9b41a 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 _0x5e37=['rows','ids','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','then','map','catch','model','findAll','associatedResources','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','squarerecordings','SquareRecording','SquareProjects','name','projectName','projects','JscriptyProject','contacts','parentSections','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','VoiceQueues','queue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueue','users','agents','Users','role','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers','variables','Variable','Plugin','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','ui.','InteractionId','from','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','reportId','DefaultReports','CustomReports','count'];(function(_0x338894,_0x5d3e45){var _0x17544e=function(_0x4a6918){while(--_0x4a6918){_0x338894['push'](_0x338894['shift']());}};_0x17544e(++_0x5d3e45);}(_0x5e37,0x196));var _0x75e3=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x5e37[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0x75e3('0x0'));var attributes=require(_0x75e3('0x1'));var squel=require('squel');module['exports']=function(_0x41ae0b){var _0x486ca9=_0x41ae0b[_0x75e3('0x2')];function _0x107d89(_0x58b5cb,_0x429eb3){return new Promise(function(_0x2a1960,_0x17c540){if(!_0x429eb3)return _0x2a1960(null);var _0x2c3a74=_0x429eb3[_0x75e3('0x3')]?{[_0x429eb3[_0x75e3('0x3')][_0x75e3('0x4')]]:_0x429eb3[_0x75e3('0x3')][_0x75e3('0x5')]}:undefined;return _0x486ca9[_0x58b5cb]['findAll']({'where':_0x2c3a74,'raw':!![]})[_0x75e3('0x6')](function(_0x165076){_0x429eb3['associatedResources']=_[_0x75e3('0x7')](_0x165076,'id');_0x2a1960(_0x429eb3);})[_0x75e3('0x8')](function(_0x4b4fa3){_0x17c540(_0x4b4fa3);});});}function _0x3f2be4(_0x54fbae,_0x27f8f6){return new Promise(function(_0x352a23,_0x3f4018){var _0x5492d3=_0x54fbae['filter']?{[_0x54fbae[_0x75e3('0x3')][_0x75e3('0x4')]]:_0x54fbae[_0x75e3('0x3')]['value']}:undefined;return _0x486ca9[_0x54fbae[_0x75e3('0x9')]][_0x75e3('0xa')]({'where':_0x5492d3,'raw':!![]})[_0x75e3('0x6')](function(_0x57ed1a){_0x27f8f6[_0x75e3('0xb')]=_[_0x75e3('0x7')](_0x57ed1a,function(_0x365632){return _0x365632['name'];});_0x352a23(_0x27f8f6);})[_0x75e3('0x8')](function(_0x4b8814){_0x3f4018(_0x4b8814);});});}function _0x14fafb(_0x4f76cf,_0x43081e,_0x5dc6d8){if(!_0x43081e)return Promise[_0x75e3('0xc')](null);return new Promise(function(_0x527868,_0x244fd6){return _0x486ca9['UserProfileResource']['findAll']({'where':{'sectionId':_0x43081e['id']},'raw':!![]})[_0x75e3('0x6')](function(_0xb2310){if(_0x4f76cf[_0x75e3('0x4')]&&_0x4f76cf[_0x75e3('0x4')]!=='id'){_0x43081e['associatedResources']=_[_0x75e3('0x7')](_0xb2310,function(_0x31bcbf){return _0x31bcbf[_0x4f76cf['field']];});}else{if(_0x5dc6d8===_0x75e3('0xd')){_0x43081e[_0x75e3('0xb')]=_[_0x75e3('0x7')](_0xb2310,function(_0x1c7430){return{'id':_0x1c7430[_0x75e3('0xe')],'type':_0x1c7430[_0x75e3('0xf')]};});}else{_0x43081e[_0x75e3('0xb')]=_[_0x75e3('0x7')](_0xb2310,function(_0x15c35e){return _0x15c35e[_0x75e3('0xe')];});}}_0x527868(_0x43081e);})['catch'](function(_0x387f8b){_0x244fd6(_0x387f8b);});});}function _0x3e6d57(_0x4a4ec9,_0x2f046d){var _0x518bb1={'parentSections':[]};switch(_0x4a4ec9[_0x75e3('0x10')]()){case _0x75e3('0x11'):_0x518bb1['childModel']=_0x75e3('0x12');break;case _0x75e3('0x13'):_0x518bb1[_0x75e3('0x14')]='SquareOdbc';break;case _0x75e3('0x15'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x16');_0x518bb1['parentSections']=[{'name':_0x75e3('0x17'),'field':_0x75e3('0x18'),'foreignKey':_0x75e3('0x19')}];break;case _0x75e3('0x1a'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x1b');break;case _0x75e3('0x1c'):_0x518bb1[_0x75e3('0x14')]='CmContact';_0x518bb1[_0x75e3('0x1d')]=[{'name':'Lists','field':'id','foreignKey':_0x75e3('0x1e')}];break;case _0x75e3('0x1f'):_0x518bb1[_0x75e3('0x14')]='CmList';break;case _0x75e3('0x20'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x21');break;case _0x75e3('0x22'):_0x518bb1['childModel']='CmCustomField';break;case _0x75e3('0x23'):_0x518bb1['childModel']='ChatQueue';break;case _0x75e3('0x24'):_0x518bb1[_0x75e3('0x14')]='ChatWebsite';break;case _0x75e3('0x25'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x26');break;case _0x75e3('0x27'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x28');break;case _0x75e3('0x29'):case'internalroutes':case _0x75e3('0x2a'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x2b');break;case'contexts':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x2c');break;case _0x75e3('0x2d'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x2e');break;case _0x75e3('0x2f'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x30');_0x518bb1[_0x75e3('0x1d')]=[{'name':_0x75e3('0x31'),'field':_0x75e3('0x18'),'foreignKey':_0x75e3('0x32'),'model':_0x75e3('0x33'),'filter':{'field':'role','value':[_0x75e3('0x34')]}},{'name':'Telephones','field':'name','foreignKey':_0x75e3('0x32'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':_0x75e3('0x35'),'field':_0x75e3('0x18'),'foreignKey':_0x75e3('0x36'),'model':'VoiceQueue','filter':{'field':_0x75e3('0xf'),'value':[_0x75e3('0x37')]}},{'name':_0x75e3('0x38'),'field':'name','foreignKey':_0x75e3('0x36'),'model':'VoiceQueue','filter':{'field':_0x75e3('0xf'),'value':[_0x75e3('0x39')]}}];break;case _0x75e3('0x3a'):_0x518bb1[_0x75e3('0x14')]='VoiceMusicOnHold';break;case _0x75e3('0x3b'):_0x518bb1['childModel']=_0x75e3('0x3c');break;case _0x75e3('0x3d'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x3e');break;case _0x75e3('0x3f'):_0x518bb1['childModel']=_0x75e3('0x40');break;case _0x75e3('0x41'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x42');break;case'mailaccounts':_0x518bb1['childModel']=_0x75e3('0x43');break;case'mailsubstatuses':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x44');break;case _0x75e3('0x45'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x46');break;case _0x75e3('0x47'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x48');break;case'smsqueues':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x49');break;case _0x75e3('0x4a'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x4b');break;case'whatsappqueues':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x4c');break;case'whatsappaccounts':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x4d');break;case'teams':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x4e');break;case _0x75e3('0x4f'):case _0x75e3('0x50'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x51');if(_0x2f046d){_0x518bb1[_0x75e3('0x1d')]=[{'name':_0x75e3('0x35')},{'name':_0x75e3('0x38')}];}break;case _0x75e3('0x52'):case _0x75e3('0x53'):case'telephones':_0x518bb1['childModel']='User';if(_0x2f046d){_0x518bb1[_0x75e3('0x1d')]=[{'name':_0x75e3('0x54'),'filter':{'field':_0x75e3('0x55'),'value':[_0x75e3('0x56'),_0x75e3('0x57')]},'ignore':!![]},{'name':_0x75e3('0x31')},{'name':_0x75e3('0x58')}];}break;case _0x75e3('0x59'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x5a');break;case _0x75e3('0x5b'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x5c');break;case _0x75e3('0x5d'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x5e');break;case _0x75e3('0x5f'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x60');break;case _0x75e3('0x61'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x62');break;case _0x75e3('0x63'):_0x518bb1[_0x75e3('0x14')]='ZohoAccount';break;case _0x75e3('0x64'):_0x518bb1['childModel']='User';break;case _0x75e3('0x65'):_0x518bb1['childModel']=_0x75e3('0x66');break;case _0x75e3('0x67'):_0x518bb1[_0x75e3('0x14')]='Disposition';break;case _0x75e3('0x68'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x69');break;case _0x75e3('0x6a'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x6b');break;case'pauses':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x6c');break;case'scheduler':_0x518bb1['childModel']=_0x75e3('0x6d');break;case _0x75e3('0x6e'):_0x518bb1['childModel']=_0x75e3('0x6f');break;case _0x75e3('0x70'):_0x518bb1['childModel']='Tag';break;case _0x75e3('0x71'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x72');break;case _0x75e3('0x73'):_0x518bb1[_0x75e3('0x14')]='Trigger';break;case'trunks':_0x518bb1['childModel']='Trunk';break;case _0x75e3('0x74'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x75');break;case'plugins':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x76');break;case'extractedreports':_0x518bb1[_0x75e3('0x14')]=_0x75e3('0xd');_0x518bb1['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x75e3('0x77'):_0x518bb1[_0x75e3('0x14')]=_0x75e3('0x78');break;}return _0x518bb1;}function _0x2c59f4(_0x3739be,_0x28da4d){var _0x311adf=_0x3739be[_0x75e3('0x79')](0x0)[_0x75e3('0x7a')]()+_0x3739be[_0x75e3('0x7b')](0x1);var _0x22104d={'type':_0x486ca9[_0x75e3('0x7c')]['QueryTypes'][_0x75e3('0x7d')],'raw':!![]};return new Promise(function(_0x2e2bd3,_0x3dd6e3){var _0x489bb5=squel['select']()[_0x75e3('0x4')](_0x75e3('0x7e')+_0x311adf+_0x75e3('0x7f'),'id')[_0x75e3('0x4')]('ui.createdAt')[_0x75e3('0x80')]('user_has_'+_0x3739be+_0x75e3('0x81'),'ui')['where']('ui.UserId\x20=\x20?',_0x28da4d['id']);return _0x486ca9[_0x75e3('0x82')][_0x75e3('0x83')](_0x489bb5[_0x75e3('0x84')](),_0x22104d)[_0x75e3('0x6')](function(_0x3f20b8){_0x28da4d[_0x311adf+_0x75e3('0x85')]=_0x3f20b8;_0x2e2bd3(_0x3f20b8);})[_0x75e3('0x8')](function(_0x5216be){_0x3dd6e3(_0x5216be);});});}return _0x41ae0b[_0x75e3('0x86')](_0x75e3('0x87'),attributes,{'tableName':_0x75e3('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x12297a){var _0x1053e0=require(_0x75e3('0x89'));var _0x4453a9={'raw':_0x12297a[_0x75e3('0x83')][_0x75e3('0x8a')],'where':{}};var _0x4c3b38={};var _0x4b2f6d={'count':0x0,'rows':[]};var _0x2ac0f8=_0x12297a[_0x75e3('0x83')][_0x75e3('0x8b')];var _0x428e27=_0x12297a[_0x75e3('0x83')]['mergeResources']||![];var _0x486db3=_0x3e6d57(_0x2ac0f8,_0x428e27);if(!_0x486db3[_0x75e3('0x14')])throw new Error(_0x75e3('0x8c')+_0x2ac0f8+'\x27');var _0x3768bf=[{'name':_0x2ac0f8}];if(!_[_0x75e3('0x8d')](_0x486db3[_0x75e3('0x1d')]))_0x3768bf=_0x486db3[_0x75e3('0x1d')];var _0xc136b8=[];for(var _0x32aa6d=0x0;_0x32aa6d<_0x3768bf[_0x75e3('0x8e')];_0x32aa6d++){_0xc136b8[_0x75e3('0x8f')](_0x486ca9[_0x75e3('0x90')][_0x75e3('0x91')]({'where':{'userProfileId':_0x12297a[_0x75e3('0x92')]['id'],'name':_0x3768bf[_0x32aa6d][_0x75e3('0x18')]},'raw':!![]}));}return Promise[_0x75e3('0x93')](_0xc136b8)[_0x75e3('0x6')](function(_0x141636){var _0x4fa693=_[_0x75e3('0x3')](_0x141636,function(_0x273966){return _0x273966?_0x273966:undefined;});var _0x4450c7=_[_0x75e3('0x3')](_0x3768bf,[_0x75e3('0x94'),!![]]);var _0x2507b7=_[_0x75e3('0x8d')](_0x4fa693)&&_[_0x75e3('0x8d')](_0x4450c7)?null:_[_0x75e3('0x95')](_0x4450c7,_0x4fa693);if(!_0x2507b7)return null;var _0x191ad1=[];for(var _0x58dbf2=0x0;_0x58dbf2<_0x2507b7['length'];_0x58dbf2++){var _0x3e5530=_['find'](_0x3768bf,function(_0x242428){return _0x2507b7[_0x58dbf2]?_0x242428[_0x75e3('0x18')]===_0x2507b7[_0x58dbf2][_0x75e3('0x18')]:null;});if(_0x3e5530){if(_0x2507b7[_0x58dbf2][_0x75e3('0x94')]){_0x191ad1['push'](_0x107d89(_0x486db3[_0x75e3('0x14')],_0x2507b7[_0x58dbf2]));}else{if(!_0x2507b7[_0x58dbf2]['autoAssociation']){_0x191ad1[_0x75e3('0x8f')](_0x14fafb(_0x3e5530,_0x2507b7[_0x58dbf2],_0x486db3[_0x75e3('0x14')]));}else{if(_0x3e5530[_0x75e3('0x9')]){_0x191ad1[_0x75e3('0x8f')](_0x3f2be4(_0x3e5530,_0x2507b7[_0x58dbf2]));}}}}}return Promise['all'](_0x191ad1);})['then'](function(_0x4799b5){var _0x1eb480=_0x4799b5;var _0x35536d=null;if(_0x1eb480){_0x35536d=_0x1eb480[_0x75e3('0x8e')]===0x1?_0x1eb480[0x0]:null;}if(!_0x35536d&&!_0x1eb480)return _0x4b2f6d;var _0x5db3ef=_0x486ca9[_0x486db3[_0x75e3('0x14')]][_0x75e3('0x96')];_0x4c3b38[_0x75e3('0x9')]=_[_0x75e3('0x97')](_0x5db3ef);_0x4c3b38[_0x75e3('0x83')]=_[_0x75e3('0x97')](_0x12297a[_0x75e3('0x83')]);_0x4c3b38[_0x75e3('0x98')]=_[_0x75e3('0x99')](_0x4c3b38[_0x75e3('0x9')],_0x4c3b38[_0x75e3('0x83')]);_0x4453a9[_0x75e3('0x9a')]=_[_0x75e3('0x99')](_0x4c3b38[_0x75e3('0x9')],_0x1053e0[_0x75e3('0x9b')](_0x12297a['query'][_0x75e3('0x9b')]));_0x4453a9['attributes']=_0x4453a9[_0x75e3('0x9a')][_0x75e3('0x8e')]?_0x4453a9[_0x75e3('0x9a')]:_0x4c3b38[_0x75e3('0x9')];if(!_0x12297a['query'][_0x75e3('0x9c')](_0x75e3('0x9d'))){_0x4453a9[_0x75e3('0x9e')]=_0x1053e0[_0x75e3('0x9e')](_0x12297a[_0x75e3('0x83')][_0x75e3('0x9e')]);_0x4453a9[_0x75e3('0x9f')]=_0x1053e0[_0x75e3('0x9f')](_0x12297a[_0x75e3('0x83')][_0x75e3('0x9f')]);}_0x4453a9[_0x75e3('0xa0')]=_0x1053e0['sort'](_0x12297a[_0x75e3('0x83')][_0x75e3('0xa1')]);_0x4453a9[_0x75e3('0xa2')]=_0x1053e0[_0x75e3('0x98')](_[_0x75e3('0xa3')](_0x12297a['query'],_0x4c3b38['filters']));if(_0x12297a[_0x75e3('0x83')]['filter']){_0x4453a9[_0x75e3('0xa2')]=_[_0x75e3('0xa4')](_0x4453a9['where'],{'$or':_['map'](_0x5db3ef,function(_0x15aaec){if(_0x15aaec[_0x75e3('0xf')][_0x75e3('0xa5')]!==_0x75e3('0xa6')){var _0x51ad1a={};_0x51ad1a[_0x15aaec[_0x75e3('0x4')]]={'$like':'%'+_0x12297a['query'][_0x75e3('0x3')]+'%'};return _0x51ad1a;}})});}var _0xe57894=[];var _0x3a744a=null;var _0x2a3a94={};if(_0x35536d){_0x3a744a=_[_0x75e3('0x91')](_0x3768bf,[_0x75e3('0x18'),_0x35536d['name']]);if(_0x3a744a['field']){_0x2a3a94={};if(_0x486db3[_0x75e3('0x14')]===_0x75e3('0xd')){_0x2a3a94[_0x3a744a[_0x75e3('0xa7')]]=_['map'](_0x35536d[_0x75e3('0xb')],'id');}else{_0x2a3a94[_0x3a744a[_0x75e3('0xa7')]]=_0x35536d[_0x75e3('0xb')];}_0xe57894[_0x75e3('0x8f')](_0x2a3a94);}else{_0x4453a9[_0x75e3('0xa2')]['id']=_0x35536d[_0x75e3('0xb')];}}else{for(var _0x40cc33=0x0;_0x40cc33<_0x1eb480[_0x75e3('0x8e')];_0x40cc33++){_0x3a744a=_['find'](_0x3768bf,[_0x75e3('0x18'),_0x1eb480[_0x40cc33][_0x75e3('0x18')]]);if(_0x3a744a[_0x75e3('0x4')]){_0x2a3a94={};_0x2a3a94[_0x3a744a[_0x75e3('0xa7')]]=_0x1eb480[_0x40cc33]['associatedResources'];_0xe57894['push'](_0x2a3a94);}else{if(!_0x4453a9[_0x75e3('0xa2')]['id'])_0x4453a9[_0x75e3('0xa2')]['id']=[];_0x1eb480[_0x40cc33]['associatedResources'][_0x75e3('0xa8')](function(_0x36e1e2){_0x4453a9[_0x75e3('0xa2')]['id'][_0x75e3('0x8f')](_0x36e1e2);});}}}if(!_[_0x75e3('0x8d')](_0xe57894)){_0x4453a9[_0x75e3('0xa2')]=_['merge'](_0x4453a9[_0x75e3('0xa2')],{'$and':{'$or':_0xe57894}});}_0x4453a9=_[_0x75e3('0xa4')]({},_0x4453a9,_0x12297a[_0x75e3('0xa9')]);if(_0x35536d&&!_0x35536d[_0x75e3('0xaa')]&&_0x486db3['childModel']===_0x75e3('0xd')){if(_0x12297a[_0x75e3('0x83')][_0x75e3('0xab')]){_0x4453a9[_0x75e3('0xac')]=[{'all':!![]}];}return _0x486ca9[_0x486db3[_0x75e3('0x14')]][_0x75e3('0xa')](_0x4453a9)['then'](function(_0x24198f){var _0x43f8f3=[];_0x24198f[_0x75e3('0xa8')](function(_0x49368a){var _0x10b234;switch(_0x49368a[_0x75e3('0xad')]){case _0x75e3('0xae'):_0x10b234=_[_0x75e3('0x91')](_0x35536d[_0x75e3('0xb')],function(_0xa019ca){return _0xa019ca['id']===_0x49368a[_0x75e3('0xaf')]&&_0xa019ca['type']===_0x75e3('0xb0');});break;case'custom':_0x10b234=_[_0x75e3('0x91')](_0x35536d[_0x75e3('0xb')],function(_0x10bfaf){return _0x10bfaf['id']===_0x49368a['reportId']&&_0x10bfaf[_0x75e3('0xf')]===_0x75e3('0xb1');});break;}if(_0x10b234)_0x43f8f3[_0x75e3('0x8f')](_0x49368a);});_0x4b2f6d[_0x75e3('0xb2')]=_0x43f8f3[_0x75e3('0x8e')];_0x4b2f6d[_0x75e3('0xb3')]=_0x43f8f3;return _0x4b2f6d;});}else{if(!_['isEmpty'](_0x12297a[_0x75e3('0x83')][_0x75e3('0xb4')])){_0x4453a9[_0x75e3('0xa2')]['id']=_0x4453a9[_0x75e3('0xa2')]['id']?_['intersection'](_0x4453a9[_0x75e3('0xa2')]['id'],_0x12297a['query'][_0x75e3('0xb4')]):_0x12297a[_0x75e3('0x83')][_0x75e3('0xb4')];if(_0x12297a[_0x75e3('0x83')]['customSorting']){_0x4453a9['order']=_0x12297a[_0x75e3('0x83')]['customSorting'];}}if(_0x12297a[_0x75e3('0x83')][_0x75e3('0xb5')]){_0x4453a9['where']=_[_0x75e3('0xa4')](_0x4453a9['where'],{'$and':_0x12297a[_0x75e3('0x83')]['extraQueryConditions']});}return _0x486ca9[_0x486db3[_0x75e3('0x14')]][_0x75e3('0xb2')]({'where':_0x4453a9[_0x75e3('0xa2')]})[_0x75e3('0x6')](function(_0x3264ba){_0x4b2f6d[_0x75e3('0xb2')]=_0x3264ba;if(_0x12297a[_0x75e3('0x83')][_0x75e3('0xab')]){if(_0x486db3[_0x75e3('0x14')]===_0x75e3('0xb6')){_0x4453a9[_0x75e3('0xac')]=[{'model':_0x486ca9['Tag'],'as':_0x75e3('0xb7'),'attributes':['id',_0x75e3('0x18'),_0x75e3('0xb8')],'required':_0x12297a[_0x75e3('0x83')][_0x75e3('0xb9')]?!![]:![]},{'model':_0x486ca9['Tag'],'as':_0x75e3('0xba'),'attributes':['id',_0x75e3('0x18'),_0x75e3('0xb8')],'through':_0x12297a[_0x75e3('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x12297a[_0x75e3('0x83')][_0x75e3('0xb9')]||undefined}}:{},'required':_0x12297a['query'][_0x75e3('0xb9')]?!![]:![]}];}else{_0x4453a9['include']=[{'all':!![]}];}}return _0x486ca9[_0x486db3['childModel']][_0x75e3('0xa')](_0x4453a9);})[_0x75e3('0x6')](function(_0x592f61){_0x4b2f6d[_0x75e3('0xb3')]=_0x592f61;if(_0x2ac0f8===_0x75e3('0x31')&&_0x12297a[_0x75e3('0x83')][_0x75e3('0xbb')]===_0x75e3('0xbc')){var _0x2c8bfd=[];for(var _0x34d816=0x0;_0x34d816<_0x4b2f6d[_0x75e3('0xb3')][_0x75e3('0x8e')];_0x34d816++){_0x2c8bfd[_0x75e3('0x8f')](_0x2c59f4(_0x75e3('0xbd'),_0x4b2f6d['rows'][_0x34d816]['dataValues']));_0x2c8bfd[_0x75e3('0x8f')](_0x2c59f4('sms',_0x4b2f6d['rows'][_0x34d816][_0x75e3('0xbe')]));_0x2c8bfd[_0x75e3('0x8f')](_0x2c59f4(_0x75e3('0xbf'),_0x4b2f6d[_0x75e3('0xb3')][_0x34d816][_0x75e3('0xbe')]));_0x2c8bfd[_0x75e3('0x8f')](_0x2c59f4(_0x75e3('0xc0'),_0x4b2f6d[_0x75e3('0xb3')][_0x34d816][_0x75e3('0xbe')]));_0x2c8bfd[_0x75e3('0x8f')](_0x2c59f4(_0x75e3('0xc1'),_0x4b2f6d['rows'][_0x34d816][_0x75e3('0xbe')]));_0x2c8bfd['push'](_0x2c59f4(_0x75e3('0xc2'),_0x4b2f6d[_0x75e3('0xb3')][_0x34d816][_0x75e3('0xbe')]));}return Promise['all'](_0x2c8bfd)[_0x75e3('0x6')](function(){return _0x4b2f6d;});}return _0x4b2f6d;});}});}}});}; \ No newline at end of file +var _0xab24=['SquareProject','odbc','squarerecordings','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','voicequeues','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','reportId','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','user_profiles','../../components/parsers/qs','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','key','VIRTUAL','foreignKey','forEach','merge','options','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','ThroughTags','tag','openTabs','true','dataValues','fax','mail','openchannel','all','lodash','./userProfile.attributes','squel','filter','field','value','then','map','model','findAll','associatedResources','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0xab24,0x166));var _0x4ab2=function(_0x32794d,_0x105cec){_0x32794d=_0x32794d-0x0;var _0x27d893=_0xab24[_0x32794d];return _0x27d893;};'use strict';var _=require(_0x4ab2('0x0'));var attributes=require(_0x4ab2('0x1'));var squel=require(_0x4ab2('0x2'));module['exports']=function(_0x35b1aa){var _0x4d9e0a=_0x35b1aa['models'];function _0x3b89f3(_0x4e7845,_0xe40ac){return new Promise(function(_0x209b0e,_0x4041ce){if(!_0xe40ac)return _0x209b0e(null);var _0x34e7d6=_0xe40ac[_0x4ab2('0x3')]?{[_0xe40ac[_0x4ab2('0x3')][_0x4ab2('0x4')]]:_0xe40ac[_0x4ab2('0x3')][_0x4ab2('0x5')]}:undefined;return _0x4d9e0a[_0x4e7845]['findAll']({'where':_0x34e7d6,'raw':!![]})[_0x4ab2('0x6')](function(_0x452a74){_0xe40ac['associatedResources']=_[_0x4ab2('0x7')](_0x452a74,'id');_0x209b0e(_0xe40ac);})['catch'](function(_0x17debe){_0x4041ce(_0x17debe);});});}function _0x57115b(_0x2f8322,_0x5c90c7){return new Promise(function(_0x5be0a8,_0x707c91){var _0x44ca06=_0x2f8322[_0x4ab2('0x3')]?{[_0x2f8322[_0x4ab2('0x3')][_0x4ab2('0x4')]]:_0x2f8322[_0x4ab2('0x3')][_0x4ab2('0x5')]}:undefined;return _0x4d9e0a[_0x2f8322[_0x4ab2('0x8')]][_0x4ab2('0x9')]({'where':_0x44ca06,'raw':!![]})[_0x4ab2('0x6')](function(_0xdaec1b){_0x5c90c7[_0x4ab2('0xa')]=_[_0x4ab2('0x7')](_0xdaec1b,function(_0x1220e6){return _0x1220e6[_0x4ab2('0xb')];});_0x5be0a8(_0x5c90c7);})[_0x4ab2('0xc')](function(_0x39587d){_0x707c91(_0x39587d);});});}function _0x544844(_0x31c9db,_0x39c19e,_0x14ed0d){if(!_0x39c19e)return Promise[_0x4ab2('0xd')](null);return new Promise(function(_0x54f0eb,_0x3e3098){return _0x4d9e0a[_0x4ab2('0xe')][_0x4ab2('0x9')]({'where':{'sectionId':_0x39c19e['id']},'raw':!![]})[_0x4ab2('0x6')](function(_0x2c9a7c){if(_0x31c9db[_0x4ab2('0x4')]&&_0x31c9db[_0x4ab2('0x4')]!=='id'){_0x39c19e[_0x4ab2('0xa')]=_['map'](_0x2c9a7c,function(_0x22a0dd){return _0x22a0dd[_0x31c9db['field']];});}else{if(_0x14ed0d==='AnalyticExtractedReport'){_0x39c19e[_0x4ab2('0xa')]=_[_0x4ab2('0x7')](_0x2c9a7c,function(_0x3275d9){return{'id':_0x3275d9[_0x4ab2('0xf')],'type':_0x3275d9[_0x4ab2('0x10')]};});}else{_0x39c19e['associatedResources']=_[_0x4ab2('0x7')](_0x2c9a7c,function(_0x9a21d0){return _0x9a21d0[_0x4ab2('0xf')];});}}_0x54f0eb(_0x39c19e);})['catch'](function(_0x315e06){_0x3e3098(_0x315e06);});});}function _0x13e198(_0xb127df,_0x25fd3f){var _0x5da73d={'parentSections':[]};switch(_0xb127df[_0x4ab2('0x11')]()){case'squareprojects':_0x5da73d['childModel']=_0x4ab2('0x12');break;case _0x4ab2('0x13'):_0x5da73d['childModel']='SquareOdbc';break;case _0x4ab2('0x14'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x16');_0x5da73d[_0x4ab2('0x17')]=[{'name':_0x4ab2('0x18'),'field':_0x4ab2('0xb'),'foreignKey':_0x4ab2('0x19')}];break;case _0x4ab2('0x1a'):_0x5da73d['childModel']='JscriptyProject';break;case _0x4ab2('0x1b'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x1c');_0x5da73d[_0x4ab2('0x17')]=[{'name':_0x4ab2('0x1d'),'field':'id','foreignKey':_0x4ab2('0x1e')}];break;case _0x4ab2('0x1f'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x20');break;case _0x4ab2('0x21'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x22');break;case _0x4ab2('0x23'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x24');break;case _0x4ab2('0x25'):_0x5da73d[_0x4ab2('0x15')]='ChatQueue';break;case _0x4ab2('0x26'):_0x5da73d['childModel']=_0x4ab2('0x27');break;case'faxqueues':_0x5da73d[_0x4ab2('0x15')]='FaxQueue';break;case _0x4ab2('0x28'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x29');break;case _0x4ab2('0x2a'):case'internalroutes':case _0x4ab2('0x2b'):_0x5da73d['childModel']=_0x4ab2('0x2c');break;case _0x4ab2('0x2d'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x2e');break;case _0x4ab2('0x2f'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x30');break;case _0x4ab2('0x31'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x32');_0x5da73d[_0x4ab2('0x17')]=[{'name':_0x4ab2('0x33'),'field':_0x4ab2('0xb'),'foreignKey':'membername','model':_0x4ab2('0x34'),'filter':{'field':_0x4ab2('0x35'),'value':[_0x4ab2('0x36')]}},{'name':_0x4ab2('0x37'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x4ab2('0x35'),'value':[_0x4ab2('0x38')]}},{'name':'VoiceQueues','field':_0x4ab2('0xb'),'foreignKey':_0x4ab2('0x39'),'model':_0x4ab2('0x3a'),'filter':{'field':_0x4ab2('0x10'),'value':[_0x4ab2('0x3b')]}},{'name':'QueueCampaigns','field':_0x4ab2('0xb'),'foreignKey':_0x4ab2('0x39'),'model':_0x4ab2('0x3a'),'filter':{'field':_0x4ab2('0x10'),'value':['outbound']}}];break;case _0x4ab2('0x3c'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x3d');break;case _0x4ab2('0x3e'):_0x5da73d['childModel']=_0x4ab2('0x3f');break;case _0x4ab2('0x40'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x41');break;case'ivrcampaigns':_0x5da73d[_0x4ab2('0x15')]='Campaign';break;case'mailqueues':_0x5da73d['childModel']=_0x4ab2('0x42');break;case _0x4ab2('0x43'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x44');break;case'mailsubstatuses':_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x45');break;case _0x4ab2('0x46'):_0x5da73d['childModel']='OpenchannelQueue';break;case _0x4ab2('0x47'):_0x5da73d[_0x4ab2('0x15')]='OpenchannelAccount';break;case _0x4ab2('0x48'):_0x5da73d[_0x4ab2('0x15')]='SmsQueue';break;case _0x4ab2('0x49'):_0x5da73d[_0x4ab2('0x15')]='SmsAccount';break;case _0x4ab2('0x4a'):_0x5da73d['childModel']=_0x4ab2('0x4b');break;case _0x4ab2('0x4c'):_0x5da73d[_0x4ab2('0x15')]='WhatsappAccount';break;case'teams':_0x5da73d[_0x4ab2('0x15')]='Team';break;case _0x4ab2('0x4d'):case'queuecampaigns':_0x5da73d[_0x4ab2('0x15')]='VoiceQueue';if(_0x25fd3f){_0x5da73d[_0x4ab2('0x17')]=[{'name':'VoiceQueues'},{'name':_0x4ab2('0x4e')}];}break;case _0x4ab2('0x4f'):case _0x4ab2('0x50'):case _0x4ab2('0x51'):_0x5da73d['childModel']='User';if(_0x25fd3f){_0x5da73d['parentSections']=[{'name':_0x4ab2('0x52'),'filter':{'field':'role','value':[_0x4ab2('0x53'),_0x4ab2('0x54')]},'ignore':!![]},{'name':_0x4ab2('0x33')},{'name':'Telephones'}];}break;case _0x4ab2('0x55'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x56');break;case _0x4ab2('0x57'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x58');break;case _0x4ab2('0x59'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x5a');break;case _0x4ab2('0x5b'):_0x5da73d['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x5c');break;case _0x4ab2('0x5d'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x5e');break;case _0x4ab2('0x5f'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x34');break;case'cannedanswers':_0x5da73d['childModel']=_0x4ab2('0x60');break;case _0x4ab2('0x61'):_0x5da73d['childModel']=_0x4ab2('0x62');break;case _0x4ab2('0x63'):_0x5da73d['childModel']='Dashboard';break;case _0x4ab2('0x64'):_0x5da73d['childModel']=_0x4ab2('0x65');break;case _0x4ab2('0x66'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x67');break;case _0x4ab2('0x68'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x69');break;case _0x4ab2('0x6a'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x6b');break;case _0x4ab2('0x6c'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x6d');break;case _0x4ab2('0x6e'):_0x5da73d[_0x4ab2('0x15')]='Template';break;case _0x4ab2('0x6f'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x70');break;case _0x4ab2('0x71'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x72');break;case _0x4ab2('0x73'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x74');break;case _0x4ab2('0x75'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x76');break;case _0x4ab2('0x77'):_0x5da73d[_0x4ab2('0x15')]=_0x4ab2('0x78');_0x5da73d['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x4ab2('0x79')}];break;case'metrics':_0x5da73d[_0x4ab2('0x15')]='AnalyticMetric';break;}return _0x5da73d;}function _0x10a30f(_0x4ce8bd,_0x2bfc19){var _0xc03b5b=_0x4ce8bd['charAt'](0x0)[_0x4ab2('0x7a')]()+_0x4ce8bd[_0x4ab2('0x7b')](0x1);var _0x1533a7={'type':_0x4d9e0a['Sequelize'][_0x4ab2('0x7c')][_0x4ab2('0x7d')],'raw':!![]};return new Promise(function(_0x475e3f,_0x1c071e){var _0x5c33d0=squel['select']()[_0x4ab2('0x4')](_0x4ab2('0x7e')+_0xc03b5b+_0x4ab2('0x7f'),'id')['field'](_0x4ab2('0x80'))['from'](_0x4ab2('0x81')+_0x4ce8bd+_0x4ab2('0x82'),'ui')[_0x4ab2('0x83')](_0x4ab2('0x84'),_0x2bfc19['id']);return _0x4d9e0a[_0x4ab2('0x85')]['query'](_0x5c33d0['toString'](),_0x1533a7)[_0x4ab2('0x6')](function(_0x30f3cc){_0x2bfc19[_0xc03b5b+_0x4ab2('0x86')]=_0x30f3cc;_0x475e3f(_0x30f3cc);})[_0x4ab2('0xc')](function(_0x33616c){_0x1c071e(_0x33616c);});});}return _0x35b1aa[_0x4ab2('0x87')]('UserProfile',attributes,{'tableName':_0x4ab2('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x403c3a){var _0x1a0862=require(_0x4ab2('0x89'));var _0x4d14a={'raw':_0x403c3a[_0x4ab2('0x8a')]['raw'],'where':{}};var _0x4ec20c={};var _0x40a363={'count':0x0,'rows':[]};var _0x1e0987=_0x403c3a[_0x4ab2('0x8a')]['section'];var _0x3dbf70=_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0x8b')]||![];var _0x3df2b4=_0x13e198(_0x1e0987,_0x3dbf70);if(!_0x3df2b4[_0x4ab2('0x15')])throw new Error(_0x4ab2('0x8c')+_0x1e0987+'\x27');var _0x14b3ab=[{'name':_0x1e0987}];if(!_[_0x4ab2('0x8d')](_0x3df2b4[_0x4ab2('0x17')]))_0x14b3ab=_0x3df2b4[_0x4ab2('0x17')];var _0x3c179a=[];for(var _0x4fd619=0x0;_0x4fd619<_0x14b3ab[_0x4ab2('0x8e')];_0x4fd619++){_0x3c179a[_0x4ab2('0x8f')](_0x4d9e0a[_0x4ab2('0x90')][_0x4ab2('0x91')]({'where':{'userProfileId':_0x403c3a[_0x4ab2('0x92')]['id'],'name':_0x14b3ab[_0x4fd619][_0x4ab2('0xb')]},'raw':!![]}));}return Promise['all'](_0x3c179a)['then'](function(_0x2e676c){var _0x1d3dc8=_[_0x4ab2('0x3')](_0x2e676c,function(_0x59b3d8){return _0x59b3d8?_0x59b3d8:undefined;});var _0x879068=_[_0x4ab2('0x3')](_0x14b3ab,['ignore',!![]]);var _0x46d5da=_[_0x4ab2('0x8d')](_0x1d3dc8)&&_[_0x4ab2('0x8d')](_0x879068)?null:_['union'](_0x879068,_0x1d3dc8);if(!_0x46d5da)return null;var _0x4dc76a=[];for(var _0x3e91c9=0x0;_0x3e91c9<_0x46d5da[_0x4ab2('0x8e')];_0x3e91c9++){var _0x3f913a=_[_0x4ab2('0x91')](_0x14b3ab,function(_0x51b12a){return _0x46d5da[_0x3e91c9]?_0x51b12a['name']===_0x46d5da[_0x3e91c9][_0x4ab2('0xb')]:null;});if(_0x3f913a){if(_0x46d5da[_0x3e91c9][_0x4ab2('0x93')]){_0x4dc76a[_0x4ab2('0x8f')](_0x3b89f3(_0x3df2b4[_0x4ab2('0x15')],_0x46d5da[_0x3e91c9]));}else{if(!_0x46d5da[_0x3e91c9][_0x4ab2('0x94')]){_0x4dc76a['push'](_0x544844(_0x3f913a,_0x46d5da[_0x3e91c9],_0x3df2b4[_0x4ab2('0x15')]));}else{if(_0x3f913a[_0x4ab2('0x8')]){_0x4dc76a[_0x4ab2('0x8f')](_0x57115b(_0x3f913a,_0x46d5da[_0x3e91c9]));}}}}}return Promise['all'](_0x4dc76a);})[_0x4ab2('0x6')](function(_0x450942){var _0x21c822=_0x450942;var _0x355b97=null;if(_0x21c822){_0x355b97=_0x21c822[_0x4ab2('0x8e')]===0x1?_0x21c822[0x0]:null;}if(!_0x355b97&&!_0x21c822)return _0x40a363;var _0x231b6a=_0x4d9e0a[_0x3df2b4[_0x4ab2('0x15')]][_0x4ab2('0x95')];_0x4ec20c[_0x4ab2('0x8')]=_[_0x4ab2('0x96')](_0x231b6a);_0x4ec20c['query']=_[_0x4ab2('0x96')](_0x403c3a[_0x4ab2('0x8a')]);_0x4ec20c['filters']=_[_0x4ab2('0x97')](_0x4ec20c['model'],_0x4ec20c['query']);_0x4d14a[_0x4ab2('0x98')]=_[_0x4ab2('0x97')](_0x4ec20c[_0x4ab2('0x8')],_0x1a0862[_0x4ab2('0x99')](_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0x99')]));_0x4d14a[_0x4ab2('0x98')]=_0x4d14a['attributes'][_0x4ab2('0x8e')]?_0x4d14a['attributes']:_0x4ec20c['model'];if(!_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0x9a')](_0x4ab2('0x9b'))){_0x4d14a[_0x4ab2('0x9c')]=_0x1a0862[_0x4ab2('0x9c')](_0x403c3a[_0x4ab2('0x8a')]['limit']);_0x4d14a[_0x4ab2('0x9d')]=_0x1a0862['offset'](_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0x9d')]);}_0x4d14a[_0x4ab2('0x9e')]=_0x1a0862[_0x4ab2('0x9f')](_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0x9f')]);_0x4d14a[_0x4ab2('0x83')]=_0x1a0862[_0x4ab2('0xa0')](_[_0x4ab2('0xa1')](_0x403c3a['query'],_0x4ec20c[_0x4ab2('0xa0')]));if(_0x403c3a['query']['filter']){_0x4d14a[_0x4ab2('0x83')]=_['merge'](_0x4d14a[_0x4ab2('0x83')],{'$or':_[_0x4ab2('0x7')](_0x231b6a,function(_0xd76124){if(_0xd76124[_0x4ab2('0x10')][_0x4ab2('0xa2')]!==_0x4ab2('0xa3')){var _0x48cc6e={};_0x48cc6e[_0xd76124[_0x4ab2('0x4')]]={'$like':'%'+_0x403c3a['query'][_0x4ab2('0x3')]+'%'};return _0x48cc6e;}})});}var _0xa896f4=[];var _0x2c8773=null;var _0x1f73eb={};if(_0x355b97){_0x2c8773=_['find'](_0x14b3ab,['name',_0x355b97[_0x4ab2('0xb')]]);if(_0x2c8773[_0x4ab2('0x4')]){_0x1f73eb={};if(_0x3df2b4[_0x4ab2('0x15')]===_0x4ab2('0x78')){_0x1f73eb[_0x2c8773[_0x4ab2('0xa4')]]=_[_0x4ab2('0x7')](_0x355b97[_0x4ab2('0xa')],'id');}else{_0x1f73eb[_0x2c8773['foreignKey']]=_0x355b97[_0x4ab2('0xa')];}_0xa896f4[_0x4ab2('0x8f')](_0x1f73eb);}else{_0x4d14a['where']['id']=_0x355b97[_0x4ab2('0xa')];}}else{for(var _0x35734f=0x0;_0x35734f<_0x21c822[_0x4ab2('0x8e')];_0x35734f++){_0x2c8773=_[_0x4ab2('0x91')](_0x14b3ab,[_0x4ab2('0xb'),_0x21c822[_0x35734f][_0x4ab2('0xb')]]);if(_0x2c8773[_0x4ab2('0x4')]){_0x1f73eb={};_0x1f73eb[_0x2c8773[_0x4ab2('0xa4')]]=_0x21c822[_0x35734f][_0x4ab2('0xa')];_0xa896f4['push'](_0x1f73eb);}else{if(!_0x4d14a[_0x4ab2('0x83')]['id'])_0x4d14a[_0x4ab2('0x83')]['id']=[];_0x21c822[_0x35734f]['associatedResources'][_0x4ab2('0xa5')](function(_0x442c71){_0x4d14a[_0x4ab2('0x83')]['id'][_0x4ab2('0x8f')](_0x442c71);});}}}if(!_[_0x4ab2('0x8d')](_0xa896f4)){_0x4d14a[_0x4ab2('0x83')]=_[_0x4ab2('0xa6')](_0x4d14a['where'],{'$and':{'$or':_0xa896f4}});}_0x4d14a=_[_0x4ab2('0xa6')]({},_0x4d14a,_0x403c3a[_0x4ab2('0xa7')]);if(_0x355b97&&!_0x355b97[_0x4ab2('0x94')]&&_0x3df2b4['childModel']===_0x4ab2('0x78')){if(_0x403c3a[_0x4ab2('0x8a')]['includeAll']){_0x4d14a[_0x4ab2('0xa8')]=[{'all':!![]}];}return _0x4d9e0a[_0x3df2b4['childModel']]['findAll'](_0x4d14a)[_0x4ab2('0x6')](function(_0xcd7c65){var _0x2248e0=[];_0xcd7c65[_0x4ab2('0xa5')](function(_0x3ac8d1){var _0x298c5e;switch(_0x3ac8d1['reportType']){case'default':_0x298c5e=_[_0x4ab2('0x91')](_0x355b97[_0x4ab2('0xa')],function(_0x5e812d){return _0x5e812d['id']===_0x3ac8d1[_0x4ab2('0x79')]&&_0x5e812d['type']===_0x4ab2('0xa9');});break;case _0x4ab2('0xaa'):_0x298c5e=_[_0x4ab2('0x91')](_0x355b97[_0x4ab2('0xa')],function(_0x4d6398){return _0x4d6398['id']===_0x3ac8d1[_0x4ab2('0x79')]&&_0x4d6398[_0x4ab2('0x10')]===_0x4ab2('0xab');});break;}if(_0x298c5e)_0x2248e0[_0x4ab2('0x8f')](_0x3ac8d1);});_0x40a363[_0x4ab2('0xac')]=_0x2248e0[_0x4ab2('0x8e')];_0x40a363[_0x4ab2('0xad')]=_0x2248e0;return _0x40a363;});}else{if(!_[_0x4ab2('0x8d')](_0x403c3a[_0x4ab2('0x8a')]['ids'])){_0x4d14a[_0x4ab2('0x83')]['id']=_0x4d14a['where']['id']?_[_0x4ab2('0x97')](_0x4d14a[_0x4ab2('0x83')]['id'],_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xae')]):_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xae')];if(_0x403c3a['query'][_0x4ab2('0xaf')]){_0x4d14a[_0x4ab2('0x9e')]=_0x403c3a[_0x4ab2('0x8a')]['customSorting'];}}if(_0x403c3a['query']['extraQueryConditions']){_0x4d14a[_0x4ab2('0x83')]=_[_0x4ab2('0xa6')](_0x4d14a[_0x4ab2('0x83')],{'$and':_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xb0')]});}return _0x4d9e0a[_0x3df2b4[_0x4ab2('0x15')]][_0x4ab2('0xac')]({'where':_0x4d14a[_0x4ab2('0x83')]})['then'](function(_0x1eb3f3){_0x40a363[_0x4ab2('0xac')]=_0x1eb3f3;if(_0x403c3a[_0x4ab2('0x8a')]['includeAll']){if(_0x3df2b4['childModel']===_0x4ab2('0x1c')){_0x4d14a[_0x4ab2('0xa8')]=[{'model':_0x4d9e0a[_0x4ab2('0x6d')],'as':_0x4ab2('0xb1'),'attributes':['id',_0x4ab2('0xb'),_0x4ab2('0xb2')],'required':_0x403c3a[_0x4ab2('0x8a')]['tag']?!![]:![]},{'model':_0x4d9e0a[_0x4ab2('0x6d')],'as':_0x4ab2('0xb3'),'attributes':['id',_0x4ab2('0xb'),_0x4ab2('0xb2')],'through':_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xb4')]?{'attributes':[],'where':{'TagId':_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xb4')]||undefined}}:{},'required':_0x403c3a['query']['tag']?!![]:![]}];}else{_0x4d14a[_0x4ab2('0xa8')]=[{'all':!![]}];}}return _0x4d9e0a[_0x3df2b4[_0x4ab2('0x15')]]['findAll'](_0x4d14a);})['then'](function(_0x7550e2){_0x40a363[_0x4ab2('0xad')]=_0x7550e2;if(_0x1e0987===_0x4ab2('0x33')&&_0x403c3a[_0x4ab2('0x8a')][_0x4ab2('0xb5')]===_0x4ab2('0xb6')){var _0x324a29=[];for(var _0x3cad9e=0x0;_0x3cad9e<_0x40a363[_0x4ab2('0xad')]['length'];_0x3cad9e++){_0x324a29['push'](_0x10a30f('chat',_0x40a363[_0x4ab2('0xad')][_0x3cad9e][_0x4ab2('0xb7')]));_0x324a29[_0x4ab2('0x8f')](_0x10a30f('sms',_0x40a363[_0x4ab2('0xad')][_0x3cad9e]['dataValues']));_0x324a29['push'](_0x10a30f(_0x4ab2('0xb8'),_0x40a363[_0x4ab2('0xad')][_0x3cad9e]['dataValues']));_0x324a29['push'](_0x10a30f(_0x4ab2('0xb9'),_0x40a363[_0x4ab2('0xad')][_0x3cad9e][_0x4ab2('0xb7')]));_0x324a29[_0x4ab2('0x8f')](_0x10a30f(_0x4ab2('0xba'),_0x40a363[_0x4ab2('0xad')][_0x3cad9e]['dataValues']));_0x324a29['push'](_0x10a30f('whatsapp',_0x40a363[_0x4ab2('0xad')][_0x3cad9e]['dataValues']));}return Promise[_0x4ab2('0xbb')](_0x324a29)[_0x4ab2('0x6')](function(){return _0x40a363;});}return _0x40a363;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5b34034..d6536a2 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 _0x1d63=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','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','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f0d21,_0x337d41){var _0x3e47c0=function(_0x29be1){while(--_0x29be1){_0x2f0d21['push'](_0x2f0d21['shift']());}};_0x3e47c0(++_0x337d41);}(_0x1d63,0xa4));var _0x31d6=function(_0x4cade2,_0x14a2ae){_0x4cade2=_0x4cade2-0x0;var _0x42dd0c=_0x1d63[_0x4cade2];return _0x42dd0c;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var moment=require(_0x31d6('0x2'));var BPromise=require(_0x31d6('0x3'));var rs=require(_0x31d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x5'))['db'];var utils=require(_0x31d6('0x6'));var logger=require(_0x31d6('0x7'))(_0x31d6('0x8'));var config=require(_0x31d6('0x9'));var jayson=require(_0x31d6('0xa'));var client=jayson[_0x31d6('0xb')]['http']({'port':0x232a});config[_0x31d6('0xc')]=_[_0x31d6('0xd')](config['redis'],{'host':_0x31d6('0xe'),'port':0x18eb});var socket=require(_0x31d6('0xf'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x2962d5,_0x341424,_0x309039){return new BPromise(function(_0x5f00b8,_0x12d5cc){return client[_0x31d6('0x10')](_0x2962d5,_0x309039)[_0x31d6('0x11')](function(_0x2e79f9){logger[_0x31d6('0x12')]('UserProfile,\x20%s,\x20%s',_0x341424,_0x31d6('0x13'));logger[_0x31d6('0x14')](_0x31d6('0x15'),_0x341424,_0x31d6('0x13'),JSON[_0x31d6('0x16')](_0x2e79f9));if(_0x2e79f9[_0x31d6('0x17')]){if(_0x2e79f9['error'][_0x31d6('0x18')]===0x1f4){logger[_0x31d6('0x17')](_0x31d6('0x19'),_0x341424,_0x2e79f9[_0x31d6('0x17')]['message']);return _0x12d5cc(_0x2e79f9[_0x31d6('0x17')]['message']);}logger[_0x31d6('0x17')](_0x31d6('0x19'),_0x341424,_0x2e79f9[_0x31d6('0x17')][_0x31d6('0x1a')]);return _0x5f00b8(_0x2e79f9[_0x31d6('0x17')][_0x31d6('0x1a')]);}else{logger['info'](_0x31d6('0x19'),_0x341424,_0x31d6('0x13'));_0x5f00b8(_0x2e79f9[_0x31d6('0x1b')][_0x31d6('0x1a')]);}})[_0x31d6('0x1c')](function(_0x19a279){logger['error'](_0x31d6('0x19'),_0x341424,_0x19a279);_0x12d5cc(_0x19a279);});});} \ No newline at end of file +var _0xadb5=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xadb5,0xad));var _0x5adb=function(_0x32cdd3,_0xf12f9e){_0x32cdd3=_0x32cdd3-0x0;var _0x22bef3=_0xadb5[_0x32cdd3];return _0x22bef3;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('UserProfile,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 288a572..5dc7e96 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 _0x9dbc=['emit','removeListener','register','length','./userProfile.events','remove','update'];(function(_0x31c6b6,_0x2f484c){var _0x2d994a=function(_0x52cc63){while(--_0x52cc63){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x2d994a(++_0x2f484c);}(_0x9dbc,0x6d));var _0xc9db=function(_0x3db4df,_0x1e53fe){_0x3db4df=_0x3db4df-0x0;var _0x4c6ec4=_0x9dbc[_0x3db4df];return _0x4c6ec4;};'use strict';var UserProfileEvents=require(_0xc9db('0x0'));var events=['save',_0xc9db('0x1'),_0xc9db('0x2')];function createListener(_0x385795,_0x13142d){return function(_0x3d61b4){_0x13142d[_0xc9db('0x3')](_0x385795,_0x3d61b4);};}function removeListener(_0x293d20,_0x102c79){return function(){UserProfileEvents[_0xc9db('0x4')](_0x293d20,_0x102c79);};}exports[_0xc9db('0x5')]=function(_0x509bc7){for(var _0x13b6d6=0x0,_0x2f30eb=events[_0xc9db('0x6')];_0x13b6d6<_0x2f30eb;_0x13b6d6++){var _0x6f110a=events[_0x13b6d6];var _0x455326=createListener('userProfile:'+_0x6f110a,_0x509bc7);UserProfileEvents['on'](_0x6f110a,_0x455326);}}; \ No newline at end of file +var _0x2f9b=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x3a4866,_0x555def){var _0x48700d=function(_0x12dde4){while(--_0x12dde4){_0x3a4866['push'](_0x3a4866['shift']());}};_0x48700d(++_0x555def);}(_0x2f9b,0x1e1));var _0xb2f9=function(_0x3cd4c8,_0x338769){_0x3cd4c8=_0x3cd4c8-0x0;var _0x532030=_0x2f9b[_0x3cd4c8];return _0x532030;};'use strict';var UserProfileEvents=require(_0xb2f9('0x0'));var events=[_0xb2f9('0x1'),_0xb2f9('0x2'),_0xb2f9('0x3')];function createListener(_0x27d05f,_0x203b2a){return function(_0x500774){_0x203b2a[_0xb2f9('0x4')](_0x27d05f,_0x500774);};}function removeListener(_0x32cd3e,_0x1660fe){return function(){UserProfileEvents[_0xb2f9('0x5')](_0x32cd3e,_0x1660fe);};}exports[_0xb2f9('0x6')]=function(_0x10e10){for(var _0x1ed197=0x0,_0x563574=events['length'];_0x1ed197<_0x563574;_0x1ed197++){var _0x167e12=events[_0x1ed197];var _0x20e461=createListener(_0xb2f9('0x7')+_0x167e12,_0x10e10);UserProfileEvents['on'](_0x167e12,_0x20e461);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5fd0d45..ff73fde 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 _0x5871=['/describe','/:id','show','create','update','delete','exports','path','connect-timeout','Router','../../components/auth/service','./userProfileResource.controller','isAuthenticated','get'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5871,0x173));var _0x1587=function(_0x84316,_0x2cf428){_0x84316=_0x84316-0x0;var _0x5bced7=_0x5871[_0x84316];return _0x5bced7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1587('0x0'));var timeout=require(_0x1587('0x1'));var express=require('express');var router=express[_0x1587('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1587('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1587('0x4'));router['get']('/',auth[_0x1587('0x5')](),controller['index']);router[_0x1587('0x6')](_0x1587('0x7'),auth[_0x1587('0x5')](),controller['describe']);router[_0x1587('0x6')](_0x1587('0x8'),auth[_0x1587('0x5')](),controller[_0x1587('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1587('0xa')]);router['put'](_0x1587('0x8'),auth['isAuthenticated'](),controller[_0x1587('0xb')]);router[_0x1587('0xc')](_0x1587('0x8'),auth[_0x1587('0x5')](),controller['destroy']);module[_0x1587('0xd')]=router; \ No newline at end of file +var _0xe611=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0xe611,0x153));var _0x1e61=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe611[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x1e61('0x0'));var util=require(_0x1e61('0x1'));var path=require(_0x1e61('0x2'));var timeout=require(_0x1e61('0x3'));var express=require(_0x1e61('0x4'));var router=express[_0x1e61('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1e61('0x6'));var interaction=require(_0x1e61('0x7'));var config=require(_0x1e61('0x8'));var controller=require(_0x1e61('0x9'));router[_0x1e61('0xa')]('/',auth[_0x1e61('0xb')](),controller[_0x1e61('0xc')]);router[_0x1e61('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x1e61('0xd')]);router[_0x1e61('0xa')](_0x1e61('0xe'),auth[_0x1e61('0xb')](),controller[_0x1e61('0xf')]);router[_0x1e61('0x10')]('/',auth[_0x1e61('0xb')](),controller['create']);router[_0x1e61('0x11')](_0x1e61('0xe'),auth['isAuthenticated'](),controller[_0x1e61('0x12')]);router[_0x1e61('0x13')](_0x1e61('0xe'),auth[_0x1e61('0xb')](),controller['destroy']);module[_0x1e61('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7a7a366..a6273bb 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 _0x893d=['exports','STRING','sequelize'];(function(_0xf39b7d,_0x4a9dc2){var _0x29e7de=function(_0x5a5584){while(--_0x5a5584){_0xf39b7d['push'](_0xf39b7d['shift']());}};_0x29e7de(++_0x4a9dc2);}(_0x893d,0x1f4));var _0xd893=function(_0xbfdbf,_0x306bda){_0xbfdbf=_0xbfdbf-0x0;var _0x409398=_0x893d[_0xbfdbf];return _0x409398;};'use strict';var Sequelize=require(_0xd893('0x0'));module[_0xd893('0x1')]={'name':{'type':Sequelize[_0xd893('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd893('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1402=['INTEGER','sequelize','exports'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x1402,0x1ea));var _0x2140=function(_0x353b9d,_0x2c89df){_0x353b9d=_0x353b9d-0x0;var _0x22fde7=_0x1402[_0x353b9d];return _0x22fde7;};'use strict';var Sequelize=require(_0x2140('0x0'));module[_0x2140('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2140('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2db5c41..ca3574c 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 _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x5ed7f1,_0xaa2a4){var _0x432629=function(_0x103732){while(--_0x103732){_0x5ed7f1['push'](_0x5ed7f1['shift']());}};_0x432629(++_0xaa2a4);}(_0x2ef3,0xba));var _0x32ef=function(_0xd4928b,_0x1d0518){_0xd4928b=_0xd4928b-0x0;var _0x4451ee=_0x2ef3[_0xd4928b];return _0x4451ee;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['UserProfileResource'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['UserProfileResource'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['UserProfileResource']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0x2a07=['index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0x1628b3,_0x5f1805){_0x1628b3=_0x1628b3-0x0;var _0x4bad95=_0x2a07[_0x1628b3];return _0x4bad95;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['UserProfileResource'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['UserProfileResource']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a43d9da..e7328de 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 _0xc0b7=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId','lodash','util'];(function(_0x141604,_0x891222){var _0x47faa8=function(_0x155956){while(--_0x155956){_0x141604['push'](_0x141604['shift']());}};_0x47faa8(++_0x891222);}(_0xc0b7,0xca));var _0x7c0b=function(_0x1d143d,_0x50f94b){_0x1d143d=_0x1d143d-0x0;var _0x2e6458=_0xc0b7[_0x1d143d];return _0x2e6458;};'use strict';var _=require(_0x7c0b('0x0'));var util=require(_0x7c0b('0x1'));var logger=require(_0x7c0b('0x2'))('api');var moment=require(_0x7c0b('0x3'));var BPromise=require(_0x7c0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c0b('0x5'));var config=require(_0x7c0b('0x6'));var attributes=require(_0x7c0b('0x7'));module[_0x7c0b('0x8')]=function(_0x3972e1,_0x4f737c){return _0x3972e1['define'](_0x7c0b('0x9'),attributes,{'tableName':_0x7c0b('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7c0b('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdce3=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources'];(function(_0x1c9326,_0x4f65bd){var _0x33e2e4=function(_0x34bceb){while(--_0x34bceb){_0x1c9326['push'](_0x1c9326['shift']());}};_0x33e2e4(++_0x4f65bd);}(_0xdce3,0x8a));var _0x3dce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdce3[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3dce('0x0'));var util=require(_0x3dce('0x1'));var logger=require(_0x3dce('0x2'))(_0x3dce('0x3'));var moment=require(_0x3dce('0x4'));var BPromise=require(_0x3dce('0x5'));var rp=require(_0x3dce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dce('0x7'));var config=require(_0x3dce('0x8'));var attributes=require(_0x3dce('0x9'));module[_0x3dce('0xa')]=function(_0x4caaae,_0x453291){return _0x4caaae['define']('UserProfileResource',attributes,{'tableName':_0x3dce('0xb'),'paranoid':![],'indexes':[{'name':_0x3dce('0xc'),'fields':[_0x3dce('0xd'),_0x3dce('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index fc6f3b7..c82384f 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 _0xcd6e=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xcd6e,0x198));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecd6('0x0'));var util=require(_0xecd6('0x1'));var moment=require(_0xecd6('0x2'));var BPromise=require(_0xecd6('0x3'));var rs=require(_0xecd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xecd6('0x5'));var logger=require(_0xecd6('0x6'))(_0xecd6('0x7'));var config=require(_0xecd6('0x8'));var jayson=require(_0xecd6('0x9'));var client=jayson['client'][_0xecd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x347ea3,_0x353f07,_0xbbafe0){return new BPromise(function(_0x1af632,_0x1f7e96){return client[_0xecd6('0xb')](_0x347ea3,_0xbbafe0)[_0xecd6('0xc')](function(_0xc1c93){logger[_0xecd6('0xd')](_0xecd6('0xe'),_0x353f07,_0xecd6('0xf'));logger[_0xecd6('0x10')](_0xecd6('0x11'),_0x353f07,_0xecd6('0xf'),JSON[_0xecd6('0x12')](_0xc1c93));if(_0xc1c93[_0xecd6('0x13')]){if(_0xc1c93[_0xecd6('0x13')][_0xecd6('0x14')]===0x1f4){logger[_0xecd6('0x13')](_0xecd6('0xe'),_0x353f07,_0xc1c93[_0xecd6('0x13')][_0xecd6('0x15')]);return _0x1f7e96(_0xc1c93[_0xecd6('0x13')]['message']);}logger[_0xecd6('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x353f07,_0xc1c93['error']['message']);return _0x1af632(_0xc1c93['error']['message']);}else{logger[_0xecd6('0xd')](_0xecd6('0xe'),_0x353f07,_0xecd6('0xf'));_0x1af632(_0xc1c93['result']['message']);}})['catch'](function(_0x1a2c83){logger[_0xecd6('0x13')](_0xecd6('0xe'),_0x353f07,_0x1a2c83);_0x1f7e96(_0x1a2c83);});});} \ No newline at end of file +var _0xfb3f=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfb3f,0x102));var _0xffb3=function(_0x3d6a07,_0xb27745){_0x3d6a07=_0x3d6a07-0x0;var _0xf770ed=_0xfb3f[_0x3d6a07];return _0xf770ed;};'use strict';var _=require(_0xffb3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xffb3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffb3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xffb3('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xffb3('0x4'));var jayson=require(_0xffb3('0x5'));var client=jayson[_0xffb3('0x6')][_0xffb3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3945fe,_0x3fc425,_0x3dee46){return new BPromise(function(_0x1bb562,_0x236438){return client[_0xffb3('0x8')](_0x3945fe,_0x3dee46)[_0xffb3('0x9')](function(_0x773115){logger[_0xffb3('0xa')](_0xffb3('0xb'),_0x3fc425,_0xffb3('0xc'));logger['debug'](_0xffb3('0xd'),_0x3fc425,'request\x20sent',JSON[_0xffb3('0xe')](_0x773115));if(_0x773115[_0xffb3('0xf')]){if(_0x773115[_0xffb3('0xf')]['code']===0x1f4){logger[_0xffb3('0xf')](_0xffb3('0xb'),_0x3fc425,_0x773115[_0xffb3('0xf')][_0xffb3('0x10')]);return _0x236438(_0x773115[_0xffb3('0xf')][_0xffb3('0x10')]);}logger['error'](_0xffb3('0xb'),_0x3fc425,_0x773115[_0xffb3('0xf')][_0xffb3('0x10')]);return _0x1bb562(_0x773115[_0xffb3('0xf')][_0xffb3('0x10')]);}else{logger[_0xffb3('0xa')](_0xffb3('0xb'),_0x3fc425,_0xffb3('0xc'));_0x1bb562(_0x773115[_0xffb3('0x11')][_0xffb3('0x10')]);}})[_0xffb3('0x12')](function(_0x3139a7){logger[_0xffb3('0xf')](_0xffb3('0xb'),_0x3fc425,_0x3139a7);_0x236438(_0x3139a7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3dd89d5..2a48e3f 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 _0x9867=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get'];(function(_0x617b52,_0x460e19){var _0x447bb4=function(_0x55885a){while(--_0x55885a){_0x617b52['push'](_0x617b52['shift']());}};_0x447bb4(++_0x460e19);}(_0x9867,0x75));var _0x7986=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9867[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7986('0x0'));var util=require(_0x7986('0x1'));var path=require('path');var timeout=require(_0x7986('0x2'));var express=require('express');var router=express[_0x7986('0x3')]();var fs_extra=require(_0x7986('0x4'));var auth=require(_0x7986('0x5'));var interaction=require(_0x7986('0x6'));var config=require('../../config/environment');var controller=require(_0x7986('0x7'));router[_0x7986('0x8')]('/',auth[_0x7986('0x9')](),controller[_0x7986('0xa')]);router['get']('/describe',auth[_0x7986('0x9')](),controller[_0x7986('0xb')]);router[_0x7986('0x8')](_0x7986('0xc'),auth[_0x7986('0x9')](),controller[_0x7986('0xd')]);router[_0x7986('0xe')]('/',auth[_0x7986('0x9')](),controller[_0x7986('0xf')]);router[_0x7986('0x10')](_0x7986('0xc'),auth[_0x7986('0x9')](),controller[_0x7986('0x11')]);router[_0x7986('0x12')](_0x7986('0xc'),auth[_0x7986('0x9')](),controller[_0x7986('0x13')]);module[_0x7986('0x14')]=router; \ No newline at end of file +var _0xb5be=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','show','post','create','put','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x479fdc,_0x6de744){var _0x2d9586=function(_0x173ec7){while(--_0x173ec7){_0x479fdc['push'](_0x479fdc['shift']());}};_0x2d9586(++_0x6de744);}(_0xb5be,0x8d));var _0xeb5b=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb5be[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0xeb5b('0x0'));var path=require(_0xeb5b('0x1'));var timeout=require(_0xeb5b('0x2'));var express=require(_0xeb5b('0x3'));var router=express['Router']();var fs_extra=require(_0xeb5b('0x4'));var auth=require(_0xeb5b('0x5'));var interaction=require(_0xeb5b('0x6'));var config=require(_0xeb5b('0x7'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xeb5b('0x8')](),controller[_0xeb5b('0x9')]);router['get']('/describe',auth[_0xeb5b('0x8')](),controller[_0xeb5b('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeb5b('0xb')]);router[_0xeb5b('0xc')]('/',auth[_0xeb5b('0x8')](),controller[_0xeb5b('0xd')]);router[_0xeb5b('0xe')]('/:id',auth[_0xeb5b('0x8')](),controller['update']);router[_0xeb5b('0xf')](_0xeb5b('0x10'),auth[_0xeb5b('0x8')](),controller[_0xeb5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 93a726a..ba04ac1 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 _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x1e0bee,_0x62f689){var _0x266289=function(_0x1dce7f){while(--_0x1dce7f){_0x1e0bee['push'](_0x1e0bee['shift']());}};_0x266289(++_0x62f689);}(_0xb9a7,0x112));var _0x7b9a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb9a7[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file +var _0x7916=['getDataValue','sequelize','STRING','BOOLEAN','crudPermissions'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x7916,0x128));var _0x6791=function(_0x323576,_0x83b9fa){_0x323576=_0x323576-0x0;var _0xfbe143=_0x7916[_0x323576];return _0xfbe143;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x6791('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x6791('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6791('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6791('0x1')],'set':function(_0x330476){this['setDataValue'](_0x6791('0x3'),_0x330476?_0x330476['join'](''):[]);},'get':function(){return this[_0x6791('0x4')](_0x6791('0x3'))?this['getDataValue'](_0x6791('0x3'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6f74d7b..0e71cb7 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 _0x719f=['name','index','map','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','type','VIRTUAL','filter','options','UserProfileSection','findAll','rows','catch','show','includeAll','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack'];(function(_0x2b7ddf,_0x2496af){var _0x4c0378=function(_0x188558){while(--_0x188558){_0x2b7ddf['push'](_0x2b7ddf['shift']());}};_0x4c0378(++_0x2496af);}(_0x719f,0x1ba));var _0xf719=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x719f[_0x16337a];return _0x422365;};'use strict';var emlformat=require(_0xf719('0x0'));var rimraf=require(_0xf719('0x1'));var zipdir=require(_0xf719('0x2'));var jsonpatch=require(_0xf719('0x3'));var rp=require('request-promise');var moment=require(_0xf719('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf719('0x5'));var util=require('util');var path=require(_0xf719('0x6'));var sox=require(_0xf719('0x7'));var csv=require(_0xf719('0x8'));var ejs=require(_0xf719('0x9'));var fs=require('fs');var fs_extra=require(_0xf719('0xa'));var _=require(_0xf719('0xb'));var squel=require('squel');var crypto=require(_0xf719('0xc'));var jsforce=require(_0xf719('0xd'));var deskjs=require(_0xf719('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf719('0xf'));var Papa=require(_0xf719('0x10'));var Redis=require(_0xf719('0x11'));var authService=require(_0xf719('0x12'));var qs=require(_0xf719('0x13'));var as=require(_0xf719('0x14'));var hardwareService=require(_0xf719('0x15'));var logger=require(_0xf719('0x16'))(_0xf719('0x17'));var utils=require(_0xf719('0x18'));var config=require(_0xf719('0x19'));var licenseUtil=require(_0xf719('0x1a'));var db=require(_0xf719('0x1b'))['db'];function respondWithStatusCode(_0x29415f,_0x1351f4){_0x1351f4=_0x1351f4||0xcc;return function(_0x264fab){if(_0x264fab){return _0x29415f[_0xf719('0x1c')](_0x1351f4);}return _0x29415f[_0xf719('0x1d')](_0x1351f4)[_0xf719('0x1e')]();};}function respondWithResult(_0x6762af,_0x1d600d){_0x1d600d=_0x1d600d||0xc8;return function(_0x15c9a7){if(_0x15c9a7){return _0x6762af[_0xf719('0x1d')](_0x1d600d)[_0xf719('0x1f')](_0x15c9a7);}};}function respondWithFilteredResult(_0x1a70fd,_0x2f2815){return function(_0x3d6f5e){if(_0x3d6f5e){var _0x9ce4c7=typeof _0x2f2815[_0xf719('0x20')]===_0xf719('0x21')&&typeof _0x2f2815['limit']===_0xf719('0x21');var _0x5431e3=_0x3d6f5e[_0xf719('0x22')];var _0x57663c=_0x9ce4c7?0x0:_0x2f2815[_0xf719('0x20')];var _0x4bdedc=_0x9ce4c7?_0x3d6f5e['count']:_0x2f2815[_0xf719('0x20')]+_0x2f2815[_0xf719('0x23')];var _0x3c390b;if(_0x4bdedc>=_0x5431e3){_0x4bdedc=_0x5431e3;_0x3c390b=0xc8;}else{_0x3c390b=0xce;}_0x1a70fd[_0xf719('0x1d')](_0x3c390b);return _0x1a70fd[_0xf719('0x24')](_0xf719('0x25'),_0x57663c+'-'+_0x4bdedc+'/'+_0x5431e3)['json'](_0x3d6f5e);}return null;};}function patchUpdates(_0x1f2012){return function(_0x57b2d2){try{jsonpatch[_0xf719('0x26')](_0x57b2d2,_0x1f2012,!![]);}catch(_0x44f7a7){return BPromise['reject'](_0x44f7a7);}return _0x57b2d2[_0xf719('0x27')]();};}function saveUpdates(_0x32412a,_0x266328){return function(_0x515029){if(_0x515029){return _0x515029[_0xf719('0x28')](_0x32412a)[_0xf719('0x29')](function(_0x3d4685){return _0x3d4685;});}return null;};}function removeEntity(_0x322f6b,_0x482e03){return function(_0x4991f5){if(_0x4991f5){return _0x4991f5['destroy']()[_0xf719('0x29')](function(){_0x322f6b[_0xf719('0x1d')](0xcc)[_0xf719('0x1e')]();});}};}function handleEntityNotFound(_0x4d2236,_0x7ba153){return function(_0x21cc27){if(!_0x21cc27){_0x4d2236[_0xf719('0x1c')](0x194);}return _0x21cc27;};}function handleError(_0x2871d2,_0x3a1dfc){_0x3a1dfc=_0x3a1dfc||0x1f4;return function(_0x5e49b3){logger[_0xf719('0x2a')](_0x5e49b3[_0xf719('0x2b')]);if(_0x5e49b3[_0xf719('0x2c')]){delete _0x5e49b3['name'];}_0x2871d2['status'](_0x3a1dfc)['send'](_0x5e49b3);};}exports[_0xf719('0x2d')]=function(_0x1f2b87,_0x535d88){var _0x5ca2cc={},_0xa6cc73={},_0x2a99c4={'count':0x0,'rows':[]};var _0x2d48f5=_[_0xf719('0x2e')](db['UserProfileSection'][_0xf719('0x2f')],function(_0x77920b){return{'name':_0x77920b[_0xf719('0x30')],'type':_0x77920b['type'][_0xf719('0x31')]};});_0xa6cc73[_0xf719('0x32')]=_[_0xf719('0x2e')](_0x2d48f5,_0xf719('0x2c'));_0xa6cc73['query']=_[_0xf719('0x33')](_0x1f2b87[_0xf719('0x34')]);_0xa6cc73['filters']=_['intersection'](_0xa6cc73['model'],_0xa6cc73[_0xf719('0x34')]);_0x5ca2cc[_0xf719('0x35')]=_[_0xf719('0x36')](_0xa6cc73['model'],qs['fields'](_0x1f2b87['query'][_0xf719('0x37')]));_0x5ca2cc['attributes']=_0x5ca2cc[_0xf719('0x35')][_0xf719('0x38')]?_0x5ca2cc['attributes']:_0xa6cc73[_0xf719('0x32')];if(!_0x1f2b87[_0xf719('0x34')][_0xf719('0x39')](_0xf719('0x3a'))){_0x5ca2cc[_0xf719('0x23')]=qs[_0xf719('0x23')](_0x1f2b87[_0xf719('0x34')]['limit']);_0x5ca2cc[_0xf719('0x20')]=qs[_0xf719('0x20')](_0x1f2b87[_0xf719('0x34')][_0xf719('0x20')]);}_0x5ca2cc[_0xf719('0x3b')]=qs[_0xf719('0x3c')](_0x1f2b87[_0xf719('0x34')][_0xf719('0x3c')]);_0x5ca2cc['where']=qs['filters'](_[_0xf719('0x3d')](_0x1f2b87[_0xf719('0x34')],_0xa6cc73[_0xf719('0x3e')]),_0x2d48f5);if(_0x1f2b87[_0xf719('0x34')]['filter']){_0x5ca2cc[_0xf719('0x3f')]=_[_0xf719('0x40')](_0x5ca2cc[_0xf719('0x3f')],{'$or':_[_0xf719('0x2e')](_0x2d48f5,function(_0x1a055c){if(_0x1a055c[_0xf719('0x41')]!==_0xf719('0x42')){var _0x5b8bad={};_0x5b8bad[_0x1a055c[_0xf719('0x2c')]]={'$like':'%'+_0x1f2b87[_0xf719('0x34')][_0xf719('0x43')]+'%'};return _0x5b8bad;}})});}_0x5ca2cc=_[_0xf719('0x40')]({},_0x5ca2cc,_0x1f2b87[_0xf719('0x44')]);var _0x360b19={'where':_0x5ca2cc[_0xf719('0x3f')]};return db[_0xf719('0x45')][_0xf719('0x22')](_0x360b19)[_0xf719('0x29')](function(_0x91a8ad){_0x2a99c4[_0xf719('0x22')]=_0x91a8ad;if(_0x1f2b87[_0xf719('0x34')]['includeAll']){_0x5ca2cc['include']=[{'all':!![]}];}return db[_0xf719('0x45')][_0xf719('0x46')](_0x5ca2cc);})[_0xf719('0x29')](function(_0x29ef7a){_0x2a99c4[_0xf719('0x47')]=_0x29ef7a;return _0x2a99c4;})['then'](respondWithFilteredResult(_0x535d88,_0x5ca2cc))[_0xf719('0x48')](handleError(_0x535d88,null));};exports[_0xf719('0x49')]=function(_0x1facab,_0x47afbb){var _0x26fbe9={'raw':![],'where':{'id':_0x1facab['params']['id']}},_0x435c05={};_0x435c05['model']=_[_0xf719('0x33')](db['UserProfileSection']['rawAttributes']);_0x435c05[_0xf719('0x34')]=_[_0xf719('0x33')](_0x1facab[_0xf719('0x34')]);_0x435c05['filters']=_[_0xf719('0x36')](_0x435c05[_0xf719('0x32')],_0x435c05[_0xf719('0x34')]);_0x26fbe9[_0xf719('0x35')]=_[_0xf719('0x36')](_0x435c05[_0xf719('0x32')],qs[_0xf719('0x37')](_0x1facab[_0xf719('0x34')][_0xf719('0x37')]));_0x26fbe9['attributes']=_0x26fbe9[_0xf719('0x35')][_0xf719('0x38')]?_0x26fbe9[_0xf719('0x35')]:_0x435c05['model'];if(_0x1facab[_0xf719('0x34')][_0xf719('0x4a')]){_0x26fbe9['include']=[{'all':!![]}];}_0x26fbe9=_[_0xf719('0x40')]({},_0x26fbe9,_0x1facab['options']);return db[_0xf719('0x45')]['find'](_0x26fbe9)['then'](handleEntityNotFound(_0x47afbb,null))[_0xf719('0x29')](respondWithResult(_0x47afbb,null))[_0xf719('0x48')](handleError(_0x47afbb,null));};exports['create']=function(_0x38e61d,_0x12f97b){return db[_0xf719('0x45')][_0xf719('0x4b')](_0x38e61d[_0xf719('0x4c')],{})[_0xf719('0x29')](respondWithResult(_0x12f97b,0xc9))[_0xf719('0x48')](handleError(_0x12f97b,null));};exports[_0xf719('0x28')]=function(_0x2be033,_0x4d1920){if(_0x2be033[_0xf719('0x4c')]['id']){delete _0x2be033['body']['id'];}return db[_0xf719('0x45')][_0xf719('0x4d')]({'where':{'id':_0x2be033[_0xf719('0x4e')]['id']}})[_0xf719('0x29')](handleEntityNotFound(_0x4d1920,null))[_0xf719('0x29')](saveUpdates(_0x2be033[_0xf719('0x4c')],null))['then'](respondWithResult(_0x4d1920,null))['catch'](handleError(_0x4d1920,null));};exports[_0xf719('0x4f')]=function(_0x95bd83,_0x4ff11e){return db['UserProfileSection'][_0xf719('0x4d')]({'where':{'id':_0x95bd83[_0xf719('0x4e')]['id']}})[_0xf719('0x29')](handleEntityNotFound(_0x4ff11e,null))[_0xf719('0x29')](removeEntity(_0x4ff11e,null))[_0xf719('0x48')](handleError(_0x4ff11e,null));};exports[_0xf719('0x50')]=function(_0x19894a,_0x3b81ea){return db[_0xf719('0x45')][_0xf719('0x50')]()[_0xf719('0x29')](respondWithResult(_0x3b81ea,null))[_0xf719('0x48')](handleError(_0x3b81ea,null));}; \ No newline at end of file +var _0xdc99=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key'];(function(_0x3ad08c,_0x38ccf5){var _0x42edf4=function(_0x55d0f5){while(--_0x55d0f5){_0x3ad08c['push'](_0x3ad08c['shift']());}};_0x42edf4(++_0x38ccf5);}(_0xdc99,0x141));var _0x9dc9=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xdc99[_0x289e64];return _0x30246c;};'use strict';var emlformat=require(_0x9dc9('0x0'));var rimraf=require(_0x9dc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dc9('0x2'));var rp=require(_0x9dc9('0x3'));var moment=require(_0x9dc9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9dc9('0x5'));var util=require(_0x9dc9('0x6'));var path=require('path');var sox=require(_0x9dc9('0x7'));var csv=require(_0x9dc9('0x8'));var ejs=require(_0x9dc9('0x9'));var fs=require('fs');var fs_extra=require(_0x9dc9('0xa'));var _=require(_0x9dc9('0xb'));var squel=require(_0x9dc9('0xc'));var crypto=require(_0x9dc9('0xd'));var jsforce=require(_0x9dc9('0xe'));var deskjs=require(_0x9dc9('0xf'));var toCsv=require(_0x9dc9('0x8'));var querystring=require(_0x9dc9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9dc9('0x11'));var qs=require(_0x9dc9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dc9('0x13'));var logger=require(_0x9dc9('0x14'))(_0x9dc9('0x15'));var utils=require(_0x9dc9('0x16'));var config=require(_0x9dc9('0x17'));var licenseUtil=require(_0x9dc9('0x18'));var db=require(_0x9dc9('0x19'))['db'];function respondWithStatusCode(_0x1f2a63,_0x445afd){_0x445afd=_0x445afd||0xcc;return function(_0xd45d87){if(_0xd45d87){return _0x1f2a63[_0x9dc9('0x1a')](_0x445afd);}return _0x1f2a63[_0x9dc9('0x1b')](_0x445afd)[_0x9dc9('0x1c')]();};}function respondWithResult(_0x5c01dd,_0x1c94d6){_0x1c94d6=_0x1c94d6||0xc8;return function(_0x385e40){if(_0x385e40){return _0x5c01dd[_0x9dc9('0x1b')](_0x1c94d6)[_0x9dc9('0x1d')](_0x385e40);}};}function respondWithFilteredResult(_0x4db32d,_0x36baad){return function(_0x490f39){if(_0x490f39){var _0x8c463a=typeof _0x36baad[_0x9dc9('0x1e')]===_0x9dc9('0x1f')&&typeof _0x36baad[_0x9dc9('0x20')]===_0x9dc9('0x1f');var _0x2aca72=_0x490f39[_0x9dc9('0x21')];var _0x15717e=_0x8c463a?0x0:_0x36baad[_0x9dc9('0x1e')];var _0x272814=_0x8c463a?_0x490f39[_0x9dc9('0x21')]:_0x36baad['offset']+_0x36baad[_0x9dc9('0x20')];var _0x5eafb3;if(_0x272814>=_0x2aca72){_0x272814=_0x2aca72;_0x5eafb3=0xc8;}else{_0x5eafb3=0xce;}_0x4db32d[_0x9dc9('0x1b')](_0x5eafb3);return _0x4db32d['set'](_0x9dc9('0x22'),_0x15717e+'-'+_0x272814+'/'+_0x2aca72)[_0x9dc9('0x1d')](_0x490f39);}return null;};}function patchUpdates(_0x379481){return function(_0x57ba3c){try{jsonpatch[_0x9dc9('0x23')](_0x57ba3c,_0x379481,!![]);}catch(_0x49db0c){return BPromise['reject'](_0x49db0c);}return _0x57ba3c['save']();};}function saveUpdates(_0x4a68b9,_0x5b83d5){return function(_0x4074bc){if(_0x4074bc){return _0x4074bc[_0x9dc9('0x24')](_0x4a68b9)[_0x9dc9('0x25')](function(_0x1fb7c5){return _0x1fb7c5;});}return null;};}function removeEntity(_0x325209,_0x5492de){return function(_0x7f89e6){if(_0x7f89e6){return _0x7f89e6[_0x9dc9('0x26')]()['then'](function(){_0x325209[_0x9dc9('0x1b')](0xcc)[_0x9dc9('0x1c')]();});}};}function handleEntityNotFound(_0x3ca834,_0x36943e){return function(_0x3dd6f7){if(!_0x3dd6f7){_0x3ca834[_0x9dc9('0x1a')](0x194);}return _0x3dd6f7;};}function handleError(_0x56ca9c,_0x458996){_0x458996=_0x458996||0x1f4;return function(_0x96650){logger[_0x9dc9('0x27')](_0x96650[_0x9dc9('0x28')]);if(_0x96650[_0x9dc9('0x29')]){delete _0x96650['name'];}_0x56ca9c[_0x9dc9('0x1b')](_0x458996)[_0x9dc9('0x2a')](_0x96650);};}exports[_0x9dc9('0x2b')]=function(_0xcc703a,_0x4b9a66){var _0x235633={},_0x49a05c={},_0x11ad24={'count':0x0,'rows':[]};var _0x4bca5c=_[_0x9dc9('0x2c')](db[_0x9dc9('0x2d')][_0x9dc9('0x2e')],function(_0x4038ff){return{'name':_0x4038ff['fieldName'],'type':_0x4038ff[_0x9dc9('0x2f')][_0x9dc9('0x30')]};});_0x49a05c['model']=_[_0x9dc9('0x2c')](_0x4bca5c,_0x9dc9('0x29'));_0x49a05c['query']=_[_0x9dc9('0x31')](_0xcc703a[_0x9dc9('0x32')]);_0x49a05c[_0x9dc9('0x33')]=_[_0x9dc9('0x34')](_0x49a05c[_0x9dc9('0x35')],_0x49a05c[_0x9dc9('0x32')]);_0x235633[_0x9dc9('0x36')]=_[_0x9dc9('0x34')](_0x49a05c[_0x9dc9('0x35')],qs[_0x9dc9('0x37')](_0xcc703a[_0x9dc9('0x32')]['fields']));_0x235633[_0x9dc9('0x36')]=_0x235633['attributes'][_0x9dc9('0x38')]?_0x235633[_0x9dc9('0x36')]:_0x49a05c[_0x9dc9('0x35')];if(!_0xcc703a['query'][_0x9dc9('0x39')]('nolimit')){_0x235633[_0x9dc9('0x20')]=qs['limit'](_0xcc703a[_0x9dc9('0x32')][_0x9dc9('0x20')]);_0x235633[_0x9dc9('0x1e')]=qs[_0x9dc9('0x1e')](_0xcc703a['query'][_0x9dc9('0x1e')]);}_0x235633[_0x9dc9('0x3a')]=qs['sort'](_0xcc703a[_0x9dc9('0x32')]['sort']);_0x235633[_0x9dc9('0x3b')]=qs[_0x9dc9('0x33')](_[_0x9dc9('0x3c')](_0xcc703a[_0x9dc9('0x32')],_0x49a05c[_0x9dc9('0x33')]),_0x4bca5c);if(_0xcc703a[_0x9dc9('0x32')][_0x9dc9('0x3d')]){_0x235633[_0x9dc9('0x3b')]=_['merge'](_0x235633[_0x9dc9('0x3b')],{'$or':_[_0x9dc9('0x2c')](_0x4bca5c,function(_0x26669e){if(_0x26669e[_0x9dc9('0x2f')]!=='VIRTUAL'){var _0x22f03e={};_0x22f03e[_0x26669e[_0x9dc9('0x29')]]={'$like':'%'+_0xcc703a['query'][_0x9dc9('0x3d')]+'%'};return _0x22f03e;}})});}_0x235633=_[_0x9dc9('0x3e')]({},_0x235633,_0xcc703a[_0x9dc9('0x3f')]);var _0x2ff581={'where':_0x235633['where']};return db[_0x9dc9('0x2d')][_0x9dc9('0x21')](_0x2ff581)['then'](function(_0x2add8d){_0x11ad24[_0x9dc9('0x21')]=_0x2add8d;if(_0xcc703a[_0x9dc9('0x32')][_0x9dc9('0x40')]){_0x235633[_0x9dc9('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9dc9('0x42')](_0x235633);})[_0x9dc9('0x25')](function(_0x9f6e90){_0x11ad24[_0x9dc9('0x43')]=_0x9f6e90;return _0x11ad24;})[_0x9dc9('0x25')](respondWithFilteredResult(_0x4b9a66,_0x235633))['catch'](handleError(_0x4b9a66,null));};exports[_0x9dc9('0x44')]=function(_0x5ab35d,_0xed8943){var _0x5f30d9={'raw':![],'where':{'id':_0x5ab35d[_0x9dc9('0x45')]['id']}},_0x54bb4f={};_0x54bb4f[_0x9dc9('0x35')]=_[_0x9dc9('0x31')](db[_0x9dc9('0x2d')][_0x9dc9('0x2e')]);_0x54bb4f['query']=_[_0x9dc9('0x31')](_0x5ab35d[_0x9dc9('0x32')]);_0x54bb4f['filters']=_['intersection'](_0x54bb4f[_0x9dc9('0x35')],_0x54bb4f[_0x9dc9('0x32')]);_0x5f30d9[_0x9dc9('0x36')]=_[_0x9dc9('0x34')](_0x54bb4f[_0x9dc9('0x35')],qs[_0x9dc9('0x37')](_0x5ab35d[_0x9dc9('0x32')][_0x9dc9('0x37')]));_0x5f30d9[_0x9dc9('0x36')]=_0x5f30d9[_0x9dc9('0x36')][_0x9dc9('0x38')]?_0x5f30d9[_0x9dc9('0x36')]:_0x54bb4f[_0x9dc9('0x35')];if(_0x5ab35d['query'][_0x9dc9('0x40')]){_0x5f30d9[_0x9dc9('0x41')]=[{'all':!![]}];}_0x5f30d9=_[_0x9dc9('0x3e')]({},_0x5f30d9,_0x5ab35d['options']);return db[_0x9dc9('0x2d')][_0x9dc9('0x46')](_0x5f30d9)[_0x9dc9('0x25')](handleEntityNotFound(_0xed8943,null))[_0x9dc9('0x25')](respondWithResult(_0xed8943,null))[_0x9dc9('0x47')](handleError(_0xed8943,null));};exports['create']=function(_0x345984,_0x1180ec){return db[_0x9dc9('0x2d')][_0x9dc9('0x48')](_0x345984[_0x9dc9('0x49')],{})[_0x9dc9('0x25')](respondWithResult(_0x1180ec,0xc9))[_0x9dc9('0x47')](handleError(_0x1180ec,null));};exports[_0x9dc9('0x24')]=function(_0x4f5fdb,_0x81f3f4){if(_0x4f5fdb['body']['id']){delete _0x4f5fdb[_0x9dc9('0x49')]['id'];}return db[_0x9dc9('0x2d')][_0x9dc9('0x46')]({'where':{'id':_0x4f5fdb[_0x9dc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x81f3f4,null))[_0x9dc9('0x25')](saveUpdates(_0x4f5fdb['body'],null))[_0x9dc9('0x25')](respondWithResult(_0x81f3f4,null))[_0x9dc9('0x47')](handleError(_0x81f3f4,null));};exports[_0x9dc9('0x26')]=function(_0x4678ba,_0x22959f){return db['UserProfileSection'][_0x9dc9('0x46')]({'where':{'id':_0x4678ba['params']['id']}})[_0x9dc9('0x25')](handleEntityNotFound(_0x22959f,null))[_0x9dc9('0x25')](removeEntity(_0x22959f,null))[_0x9dc9('0x47')](handleError(_0x22959f,null));};exports['describe']=function(_0x42f507,_0x2a4dde){return db[_0x9dc9('0x2d')]['describe']()[_0x9dc9('0x25')](respondWithResult(_0x2a4dde,null))['catch'](handleError(_0x2a4dde,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index da2c8d0..5688673 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','lodash','util'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x1a37,0xb4));var _0x71a3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x1a37[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1da=['../../config/logger','api','moment','bluebird','path','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xd1da,0x143));var _0xad1d=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xd1da[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0xad1d('0x0'));var util=require(_0xad1d('0x1'));var logger=require(_0xad1d('0x2'))(_0xad1d('0x3'));var moment=require(_0xad1d('0x4'));var BPromise=require(_0xad1d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad1d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad1d('0x7'));module['exports']=function(_0xbb5e23,_0x38079c){return _0xbb5e23[_0xad1d('0x8')](_0xad1d('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xad1d('0xa'),'fields':[_0xad1d('0xb'),_0xad1d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c56ca2d..65392b0 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 _0x0ef2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0xbbeaac,_0x2da9a0){var _0x11ca51=function(_0x5e7eb4){while(--_0x5e7eb4){_0xbbeaac['push'](_0xbbeaac['shift']());}};_0x11ca51(++_0x2da9a0);}(_0x0ef2,0x169));var _0x20ef=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x0ef2[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x20ef('0x0'));var util=require(_0x20ef('0x1'));var moment=require(_0x20ef('0x2'));var BPromise=require(_0x20ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20ef('0x5'));var logger=require(_0x20ef('0x6'))(_0x20ef('0x7'));var config=require(_0x20ef('0x8'));var jayson=require(_0x20ef('0x9'));var client=jayson[_0x20ef('0xa')][_0x20ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c99f6,_0x13d704,_0xcc0a0){return new BPromise(function(_0x3908da,_0x516667){return client[_0x20ef('0xc')](_0x1c99f6,_0xcc0a0)[_0x20ef('0xd')](function(_0x2c0c00){logger[_0x20ef('0xe')](_0x20ef('0xf'),_0x13d704,_0x20ef('0x10'));logger[_0x20ef('0x11')](_0x20ef('0x12'),_0x13d704,'request\x20sent',JSON['stringify'](_0x2c0c00));if(_0x2c0c00[_0x20ef('0x13')]){if(_0x2c0c00[_0x20ef('0x13')][_0x20ef('0x14')]===0x1f4){logger[_0x20ef('0x13')](_0x20ef('0xf'),_0x13d704,_0x2c0c00[_0x20ef('0x13')]['message']);return _0x516667(_0x2c0c00[_0x20ef('0x13')]['message']);}logger[_0x20ef('0x13')](_0x20ef('0xf'),_0x13d704,_0x2c0c00[_0x20ef('0x13')][_0x20ef('0x15')]);return _0x3908da(_0x2c0c00['error'][_0x20ef('0x15')]);}else{logger[_0x20ef('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x13d704,_0x20ef('0x10'));_0x3908da(_0x2c0c00[_0x20ef('0x16')]['message']);}})['catch'](function(_0x2497ac){logger['error'](_0x20ef('0xf'),_0x13d704,_0x2497ac);_0x516667(_0x2497ac);});});} \ No newline at end of file +var _0x3863=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s'];(function(_0x120933,_0xece472){var _0x5b486c=function(_0x30c913){while(--_0x30c913){_0x120933['push'](_0x120933['shift']());}};_0x5b486c(++_0xece472);}(_0x3863,0x72));var _0x3386=function(_0x43550b,_0x323e5f){_0x43550b=_0x43550b-0x0;var _0x50995c=_0x3863[_0x43550b];return _0x50995c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3386('0x0'));var BPromise=require(_0x3386('0x1'));var rs=require(_0x3386('0x2'));var fs=require('fs');var Redis=require(_0x3386('0x3'));var db=require(_0x3386('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3386('0x5'));var config=require(_0x3386('0x6'));var jayson=require(_0x3386('0x7'));var client=jayson[_0x3386('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244320,_0x3d64e9,_0x32797d){return new BPromise(function(_0x556749,_0x19c22f){return client[_0x3386('0x9')](_0x244320,_0x32797d)[_0x3386('0xa')](function(_0x2bd856){logger['info'](_0x3386('0xb'),_0x3d64e9,_0x3386('0xc'));logger[_0x3386('0xd')](_0x3386('0xe'),_0x3d64e9,_0x3386('0xc'),JSON['stringify'](_0x2bd856));if(_0x2bd856[_0x3386('0xf')]){if(_0x2bd856[_0x3386('0xf')][_0x3386('0x10')]===0x1f4){logger[_0x3386('0xf')](_0x3386('0xb'),_0x3d64e9,_0x2bd856[_0x3386('0xf')][_0x3386('0x11')]);return _0x19c22f(_0x2bd856[_0x3386('0xf')]['message']);}logger['error'](_0x3386('0xb'),_0x3d64e9,_0x2bd856[_0x3386('0xf')][_0x3386('0x11')]);return _0x556749(_0x2bd856[_0x3386('0xf')][_0x3386('0x11')]);}else{logger['info'](_0x3386('0xb'),_0x3d64e9,_0x3386('0xc'));_0x556749(_0x2bd856['result'][_0x3386('0x11')]);}})['catch'](function(_0x1f5e9d){logger[_0x3386('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x3d64e9,_0x1f5e9d);_0x19c22f(_0x1f5e9d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fadbe53..3b7813b 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1f2f61,_0x586f2f){var _0x10dabc=function(_0x3233b5){while(--_0x3233b5){_0x1f2f61['push'](_0x1f2f61['shift']());}};_0x10dabc(++_0x586f2f);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ba105,_0xf97073){var _0x5eee7b=function(_0x242611){while(--_0x242611){_0x4ba105['push'](_0x4ba105['shift']());}};_0x5eee7b(++_0xf97073);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 1381ef5..19d9b8f 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 _0x7d55=['sequelize','exports','INTEGER'];(function(_0x3e5a32,_0x3cc871){var _0x375d0f=function(_0x412032){while(--_0x412032){_0x3e5a32['push'](_0x3e5a32['shift']());}};_0x375d0f(++_0x3cc871);}(_0x7d55,0x1bc));var _0x57d5=function(_0x2ae973,_0x339da3){_0x2ae973=_0x2ae973-0x0;var _0x6813bf=_0x7d55[_0x2ae973];return _0x6813bf;};'use strict';var Sequelize=require(_0x57d5('0x0'));module[_0x57d5('0x1')]={'penalty':{'type':Sequelize[_0x57d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x523a=['exports','INTEGER','sequelize'];(function(_0x27f5e5,_0x37e1be){var _0x20ca4b=function(_0x551f85){while(--_0x551f85){_0x27f5e5['push'](_0x27f5e5['shift']());}};_0x20ca4b(++_0x37e1be);}(_0x523a,0x7a));var _0xa523=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x523a[_0x4017b0];return _0x5ed4f7;};'use strict';var Sequelize=require(_0xa523('0x0'));module[_0xa523('0x1')]={'penalty':{'type':Sequelize[_0xa523('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index db87c07..80b63ca 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eba=['user_has_sms_queues','util','../../config/logger','api','moment','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0x2eba,0xc7));var _0xa2eb=function(_0x1f55f7,_0x4f8eef){_0x1f55f7=_0x1f55f7-0x0;var _0x47cc15=_0x2eba[_0x1f55f7];return _0x47cc15;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('UserSmsQueue',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6363=['define','UserSmsQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x507c45,_0x56e974){var _0x56616e=function(_0x51a43f){while(--_0x51a43f){_0x507c45['push'](_0x507c45['shift']());}};_0x56616e(++_0x56e974);}(_0x6363,0x13a));var _0x3636=function(_0x185ce2,_0x10576b){_0x185ce2=_0x185ce2-0x0;var _0x342504=_0x6363[_0x185ce2];return _0x342504;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var logger=require(_0x3636('0x1'))(_0x3636('0x2'));var moment=require(_0x3636('0x3'));var BPromise=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var fs=require('fs');var path=require(_0x3636('0x6'));var rimraf=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var attributes=require(_0x3636('0x9'));module[_0x3636('0xa')]=function(_0x15728f,_0x1f94ef){return _0x15728f[_0x3636('0xb')](_0x3636('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 25f2222..6a666eb 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 _0x05a4=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x05a4,0x12e));var _0x405a=function(_0x35a592,_0x205618){_0x35a592=_0x35a592-0x0;var _0x477175=_0x05a4[_0x35a592];return _0x477175;};'use strict';var _=require(_0x405a('0x0'));var util=require(_0x405a('0x1'));var moment=require('moment');var BPromise=require(_0x405a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x405a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x405a('0x4'));var logger=require('../../config/logger')(_0x405a('0x5'));var config=require(_0x405a('0x6'));var jayson=require(_0x405a('0x7'));var client=jayson[_0x405a('0x8')][_0x405a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b54e6,_0x19678e,_0x597431){return new BPromise(function(_0x4e7024,_0x2ae104){return client[_0x405a('0xa')](_0x3b54e6,_0x597431)[_0x405a('0xb')](function(_0x480e1a){logger[_0x405a('0xc')](_0x405a('0xd'),_0x19678e,_0x405a('0xe'));logger['debug'](_0x405a('0xf'),_0x19678e,_0x405a('0xe'),JSON['stringify'](_0x480e1a));if(_0x480e1a[_0x405a('0x10')]){if(_0x480e1a[_0x405a('0x10')][_0x405a('0x11')]===0x1f4){logger[_0x405a('0x10')](_0x405a('0xd'),_0x19678e,_0x480e1a[_0x405a('0x10')][_0x405a('0x12')]);return _0x2ae104(_0x480e1a['error'][_0x405a('0x12')]);}logger[_0x405a('0x10')](_0x405a('0xd'),_0x19678e,_0x480e1a[_0x405a('0x10')][_0x405a('0x12')]);return _0x4e7024(_0x480e1a['error'][_0x405a('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x19678e,'request\x20sent');_0x4e7024(_0x480e1a[_0x405a('0x13')][_0x405a('0x12')]);}})[_0x405a('0x14')](function(_0x5e0c5f){logger[_0x405a('0x10')](_0x405a('0xd'),_0x19678e,_0x5e0c5f);_0x2ae104(_0x5e0c5f);});});} \ No newline at end of file +var _0xc414=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0xa44287,_0x4bddbf){var _0x32b0f9=function(_0x1bfd5a){while(--_0x1bfd5a){_0xa44287['push'](_0xa44287['shift']());}};_0x32b0f9(++_0x4bddbf);}(_0xc414,0x185));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c41('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4c41('0x1'));var rs=require(_0x4c41('0x2'));var fs=require('fs');var Redis=require(_0x4c41('0x3'));var db=require(_0x4c41('0x4'))['db'];var utils=require(_0x4c41('0x5'));var logger=require(_0x4c41('0x6'))('rpc');var config=require(_0x4c41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4c41('0x8')][_0x4c41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371c80,_0x596d81,_0x408ccb){return new BPromise(function(_0x2a04ca,_0x357461){return client['request'](_0x371c80,_0x408ccb)['then'](function(_0x1db64b){logger[_0x4c41('0xa')](_0x4c41('0xb'),_0x596d81,_0x4c41('0xc'));logger[_0x4c41('0xd')](_0x4c41('0xe'),_0x596d81,_0x4c41('0xc'),JSON['stringify'](_0x1db64b));if(_0x1db64b['error']){if(_0x1db64b[_0x4c41('0xf')][_0x4c41('0x10')]===0x1f4){logger[_0x4c41('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x596d81,_0x1db64b[_0x4c41('0xf')]['message']);return _0x357461(_0x1db64b[_0x4c41('0xf')]['message']);}logger['error'](_0x4c41('0xb'),_0x596d81,_0x1db64b[_0x4c41('0xf')][_0x4c41('0x11')]);return _0x2a04ca(_0x1db64b[_0x4c41('0xf')][_0x4c41('0x11')]);}else{logger['info'](_0x4c41('0xb'),_0x596d81,_0x4c41('0xc'));_0x2a04ca(_0x1db64b[_0x4c41('0x12')]['message']);}})['catch'](function(_0x271786){logger[_0x4c41('0xf')](_0x4c41('0xb'),_0x596d81,_0x271786);_0x357461(_0x271786);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 930e2f1..e92e6a0 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 _0xb517=['INTEGER','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb517,0x124));var _0x7b51=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xb517[_0x96f74c];return _0x379222;};'use strict';var Sequelize=require(_0x7b51('0x0'));module[_0x7b51('0x1')]={'UserId':{'type':Sequelize[_0x7b51('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7b51('0x2')]}}; \ No newline at end of file +var _0x5b80=['sequelize','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5b80,0x154));var _0x05b8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5b80[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x05b8('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x05b8('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x05b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1d2c739..fbe57b6 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(_0x272ec5,_0x399bd6){var _0x4d878c=function(_0x354701){while(--_0x354701){_0x272ec5['push'](_0x272ec5['shift']());}};_0x4d878c(++_0x399bd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x421c57,_0x4872a1){var _0x36d27e=function(_0x4d3c9a){while(--_0x4d3c9a){_0x421c57['push'](_0x421c57['shift']());}};_0x36d27e(++_0x4872a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 baa8448..2ef2ec0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x44a159,_0x4e375f){var _0x260613=function(_0x2ca964){while(--_0x2ca964){_0x44a159['push'](_0x44a159['shift']());}};_0x260613(++_0x4e375f);}(_0x70e0,0x17b));var _0x070e=function(_0x474619,_0x124b80){_0x474619=_0x474619-0x0;var _0x17d5ea=_0x70e0[_0x474619];return _0x17d5ea;};'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(_0x5bb765,_0x555cf7){var _0x210f22=function(_0xf8e5fa){while(--_0xf8e5fa){_0x5bb765['push'](_0x5bb765['shift']());}};_0x210f22(++_0x555cf7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xcb91[_0x5311a1];return _0x2acb9f;};'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 7d07cc6..b11cbc7 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 _0x5c87=['INTEGER','sequelize'];(function(_0x427627,_0x1d9f73){var _0xcaac7b=function(_0x684084){while(--_0x684084){_0x427627['push'](_0x427627['shift']());}};_0xcaac7b(++_0x1d9f73);}(_0x5c87,0x77));var _0x75c8=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x5c87[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0x75c8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x75c8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x33c8=['sequelize','exports','INTEGER'];(function(_0x3d0c4c,_0x5b599e){var _0x2f4241=function(_0x5d76cd){while(--_0x5d76cd){_0x3d0c4c['push'](_0x3d0c4c['shift']());}};_0x2f4241(++_0x5b599e);}(_0x33c8,0xb7));var _0x833c=function(_0x3e8578,_0x445a8b){_0x3e8578=_0x3e8578-0x0;var _0x3b122a=_0x33c8[_0x3e8578];return _0x3b122a;};'use strict';var Sequelize=require(_0x833c('0x0'));module[_0x833c('0x1')]={'penalty':{'type':Sequelize[_0x833c('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 f6c36e7..8ee1ea9 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 _0xdce9=['path','rimraf','./userVoiceQueue.attributes','define','UserVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4df449,_0x44892c){var _0x546aa8=function(_0x257af7){while(--_0x257af7){_0x4df449['push'](_0x4df449['shift']());}};_0x546aa8(++_0x44892c);}(_0xdce9,0x89));var _0x9dce=function(_0x21c618,_0x58390c){_0x21c618=_0x21c618-0x0;var _0x4f6d0f=_0xdce9[_0x21c618];return _0x4f6d0f;};'use strict';var _=require(_0x9dce('0x0'));var util=require(_0x9dce('0x1'));var logger=require(_0x9dce('0x2'))('api');var moment=require(_0x9dce('0x3'));var BPromise=require(_0x9dce('0x4'));var rp=require(_0x9dce('0x5'));var fs=require('fs');var path=require(_0x9dce('0x6'));var rimraf=require(_0x9dce('0x7'));var config=require('../../config/environment');var attributes=require(_0x9dce('0x8'));module['exports']=function(_0x2b4be8,_0x4fd226){return _0x2b4be8[_0x9dce('0x9')](_0x9dce('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0c8=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','util','api','bluebird'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xa0c8,0x6b));var _0x8a0c=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xa0c8[_0x40911a];return _0x27e8e3;};'use strict';var _=require('lodash');var util=require(_0x8a0c('0x0'));var logger=require('../../config/logger')(_0x8a0c('0x1'));var moment=require('moment');var BPromise=require(_0x8a0c('0x2'));var rp=require(_0x8a0c('0x3'));var fs=require('fs');var path=require(_0x8a0c('0x4'));var rimraf=require(_0x8a0c('0x5'));var config=require(_0x8a0c('0x6'));var attributes=require(_0x8a0c('0x7'));module[_0x8a0c('0x8')]=function(_0x4884bc,_0xf84aaf){return _0x4884bc['define'](_0x8a0c('0x9'),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 3eced76..c0546cf 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 _0x4122=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x37ab79,_0x2b5f2b){var _0x3afcc6=function(_0x2e1d93){while(--_0x2e1d93){_0x37ab79['push'](_0x37ab79['shift']());}};_0x3afcc6(++_0x2b5f2b);}(_0x4122,0x1aa));var _0x2412=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4122[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x2412('0x0'));var moment=require('moment');var BPromise=require(_0x2412('0x1'));var rs=require(_0x2412('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2412('0x3'))['db'];var utils=require(_0x2412('0x4'));var logger=require(_0x2412('0x5'))('rpc');var config=require(_0x2412('0x6'));var jayson=require(_0x2412('0x7'));var client=jayson[_0x2412('0x8')][_0x2412('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10b793,_0x29678a,_0x5b812b){return new BPromise(function(_0x56e4dc,_0x203bf6){return client[_0x2412('0xa')](_0x10b793,_0x5b812b)['then'](function(_0xb06d41){logger['info'](_0x2412('0xb'),_0x29678a,_0x2412('0xc'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x29678a,_0x2412('0xc'),JSON[_0x2412('0xd')](_0xb06d41));if(_0xb06d41[_0x2412('0xe')]){if(_0xb06d41['error'][_0x2412('0xf')]===0x1f4){logger['error'](_0x2412('0xb'),_0x29678a,_0xb06d41['error'][_0x2412('0x10')]);return _0x203bf6(_0xb06d41[_0x2412('0xe')][_0x2412('0x10')]);}logger['error'](_0x2412('0xb'),_0x29678a,_0xb06d41[_0x2412('0xe')][_0x2412('0x10')]);return _0x56e4dc(_0xb06d41[_0x2412('0xe')][_0x2412('0x10')]);}else{logger['info'](_0x2412('0xb'),_0x29678a,_0x2412('0xc'));_0x56e4dc(_0xb06d41[_0x2412('0x11')][_0x2412('0x10')]);}})[_0x2412('0x12')](function(_0x5b2535){logger[_0x2412('0xe')](_0x2412('0xb'),_0x29678a,_0x5b2535);_0x203bf6(_0x5b2535);});});} \ No newline at end of file +var _0xb427=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb427,0x139));var _0x7b42=function(_0x48ba83,_0x51041d){_0x48ba83=_0x48ba83-0x0;var _0x55aa96=_0xb427[_0x48ba83];return _0x55aa96;};'use strict';var _=require('lodash');var util=require(_0x7b42('0x0'));var moment=require(_0x7b42('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b42('0x2'));var fs=require('fs');var Redis=require(_0x7b42('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7b42('0x4'))(_0x7b42('0x5'));var config=require(_0x7b42('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b42('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa7e09d,_0x441a98,_0x373384){return new BPromise(function(_0x282c51,_0x236dde){return client['request'](_0xa7e09d,_0x373384)['then'](function(_0x261ccc){logger['info'](_0x7b42('0x8'),_0x441a98,_0x7b42('0x9'));logger[_0x7b42('0xa')](_0x7b42('0xb'),_0x441a98,'request\x20sent',JSON[_0x7b42('0xc')](_0x261ccc));if(_0x261ccc[_0x7b42('0xd')]){if(_0x261ccc['error'][_0x7b42('0xe')]===0x1f4){logger[_0x7b42('0xd')](_0x7b42('0x8'),_0x441a98,_0x261ccc['error'][_0x7b42('0xf')]);return _0x236dde(_0x261ccc[_0x7b42('0xd')]['message']);}logger[_0x7b42('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x441a98,_0x261ccc[_0x7b42('0xd')][_0x7b42('0xf')]);return _0x282c51(_0x261ccc[_0x7b42('0xd')][_0x7b42('0xf')]);}else{logger[_0x7b42('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x441a98,'request\x20sent');_0x282c51(_0x261ccc['result'][_0x7b42('0xf')]);}})['catch'](function(_0x3adae0){logger[_0x7b42('0xd')](_0x7b42('0x8'),_0x441a98,_0x3adae0);_0x236dde(_0x3adae0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7e56a2f..a55f9cd 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1f773e,_0x180c80){var _0x38217f=function(_0x134aef){while(--_0x134aef){_0x1f773e['push'](_0x1f773e['shift']());}};_0x38217f(++_0x180c80);}(_0x70e0,0x17b));var _0x070e=function(_0x6001e0,_0x3abc09){_0x6001e0=_0x6001e0-0x0;var _0x5bd5d2=_0x70e0[_0x6001e0];return _0x5bd5d2;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ad6e4,_0x103161){var _0x11e62a=function(_0x10dc1e){while(--_0x10dc1e){_0x4ad6e4['push'](_0x4ad6e4['shift']());}};_0x11e62a(++_0x103161);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5ba81ef..a8d2f70 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 _0x8ac0=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x30e375,_0x1d460d){var _0x4c1f5e=function(_0x5df863){while(--_0x5df863){_0x30e375['push'](_0x30e375['shift']());}};_0x4c1f5e(++_0x1d460d);}(_0x8ac0,0x1d5));var _0x08ac=function(_0x14bb40,_0xf1abe3){_0x14bb40=_0x14bb40-0x0;var _0x5881a0=_0x8ac0[_0x14bb40];return _0x5881a0;};'use strict';var Sequelize=require(_0x08ac('0x0'));module[_0x08ac('0x1')]={'uniqueid':{'type':Sequelize[_0x08ac('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x08ac('0x3')},'membername':{'type':Sequelize[_0x08ac('0x4')],'allowNull':![],'comment':_0x08ac('0x3')},'UserId':{'type':Sequelize[_0x08ac('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x08ac('0x5'),'comment':_0x08ac('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x08ac('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x08ac('0x2')](0xb),'defaultValue':0x0,'comment':_0x08ac('0x3')},'paused':{'type':Sequelize[_0x08ac('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x392b=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','sequelize'];(function(_0x4ee2a4,_0x31c175){var _0x413f3f=function(_0x3ed232){while(--_0x3ed232){_0x4ee2a4['push'](_0x4ee2a4['shift']());}};_0x413f3f(++_0x31c175);}(_0x392b,0x162));var _0xb392=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x392b[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb392('0x0'));module[_0xb392('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb392('0x2')},'membername':{'type':Sequelize[_0xb392('0x3')],'allowNull':![],'comment':_0xb392('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb392('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xb392('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb392('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xb392('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xb392('0x2')},'penalty':{'type':Sequelize[_0xb392('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb392('0x4')](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 a0af43c..1020023 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 _0xc095=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hook','exports','events'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0xc095,0x179));var _0x5c09=function(_0xda852a,_0x2fc3f5){_0xda852a=_0xda852a-0x0;var _0x3e322f=_0xc095[_0xda852a];return _0x3e322f;};'use strict';var EventEmitter=require(_0x5c09('0x0'));var UserVoiceQueueRt=require(_0x5c09('0x1'))['db'][_0x5c09('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c09('0x3'),'afterUpdate':_0x5c09('0x4'),'afterDestroy':_0x5c09('0x5')};function emitEvent(_0x517ad6){return function(_0x39c5a5,_0x294396,_0x2e3a83){UserVoiceQueueRtEvents[_0x5c09('0x6')](_0x517ad6+':'+_0x39c5a5['id'],_0x39c5a5);UserVoiceQueueRtEvents['emit'](_0x517ad6,_0x39c5a5);_0x2e3a83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5c09('0x7')](e,emitEvent(event));}}module[_0x5c09('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd02d=['emit','exports','events','../../mysqldb','update','remove'];(function(_0x3b5993,_0x312c93){var _0x2fb3fc=function(_0x5dd336){while(--_0x5dd336){_0x3b5993['push'](_0x3b5993['shift']());}};_0x2fb3fc(++_0x312c93);}(_0xd02d,0x80));var _0xdd02=function(_0x52b914,_0x52bcd3){_0x52b914=_0x52b914-0x0;var _0x21e041=_0xd02d[_0x52b914];return _0x21e041;};'use strict';var EventEmitter=require(_0xdd02('0x0'));var UserVoiceQueueRt=require(_0xdd02('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd02('0x2'),'afterDestroy':_0xdd02('0x3')};function emitEvent(_0x2e453d){return function(_0x232ec2,_0x264704,_0xb59828){UserVoiceQueueRtEvents[_0xdd02('0x4')](_0x2e453d+':'+_0x232ec2['id'],_0x232ec2);UserVoiceQueueRtEvents['emit'](_0x2e453d,_0x232ec2);_0xb59828(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xdd02('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 99c652c..37fa7de 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 _0x9b74=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0xd7c76f,_0x1aacb0){var _0x23b7e2=function(_0x2fc43e){while(--_0x2fc43e){_0xd7c76f['push'](_0xd7c76f['shift']());}};_0x23b7e2(++_0x1aacb0);}(_0x9b74,0x18b));var _0x49b7=function(_0x59507a,_0x1dd92d){_0x59507a=_0x59507a-0x0;var _0x29b9b6=_0x9b74[_0x59507a];return _0x29b9b6;};'use strict';var _=require(_0x49b7('0x0'));var util=require(_0x49b7('0x1'));var logger=require(_0x49b7('0x2'))(_0x49b7('0x3'));var moment=require(_0x49b7('0x4'));var BPromise=require(_0x49b7('0x5'));var rp=require(_0x49b7('0x6'));var fs=require('fs');var path=require(_0x49b7('0x7'));var rimraf=require(_0x49b7('0x8'));var config=require(_0x49b7('0x9'));var attributes=require(_0x49b7('0xa'));module['exports']=function(_0x1805f5,_0xbfeb28){return _0x1805f5[_0x49b7('0xb')](_0x49b7('0xc'),attributes,{'tableName':_0x49b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb713=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb713,0x1cd));var _0x3b71=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0xb713[_0x1b76e6];return _0x333b53;};'use strict';var _=require('lodash');var util=require(_0x3b71('0x0'));var logger=require(_0x3b71('0x1'))(_0x3b71('0x2'));var moment=require(_0x3b71('0x3'));var BPromise=require(_0x3b71('0x4'));var rp=require(_0x3b71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b71('0x6'));var attributes=require(_0x3b71('0x7'));module[_0x3b71('0x8')]=function(_0xdfc5f9,_0x698f4b){return _0xdfc5f9[_0x3b71('0x9')](_0x3b71('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','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 1902f4e..2d399fc 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 _0x8d4c=['literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT'];(function(_0x502de4,_0x1ed8b5){var _0x2d0130=function(_0x1a68b2){while(--_0x1a68b2){_0x502de4['push'](_0x502de4['shift']());}};_0x2d0130(++_0x1ed8b5);}(_0x8d4c,0x133));var _0xc8d4=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x8d4c[_0x29e2af];return _0x1ea06a;};'use strict';var _=require(_0xc8d4('0x0'));var util=require(_0xc8d4('0x1'));var moment=require(_0xc8d4('0x2'));var BPromise=require(_0xc8d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8d4('0x5'));var logger=require(_0xc8d4('0x6'))(_0xc8d4('0x7'));var config=require(_0xc8d4('0x8'));var jayson=require(_0xc8d4('0x9'));var client=jayson[_0xc8d4('0xa')][_0xc8d4('0xb')]({'port':0x232a});config['redis']=_[_0xc8d4('0xc')](config['redis'],{'host':_0xc8d4('0xd'),'port':0x18eb});var socket=require(_0xc8d4('0xe'))(new Redis(config[_0xc8d4('0xf')]));require(_0xc8d4('0x10'))['register'](socket);function respondWithRpcPromise(_0x120a29,_0x2b67c0,_0x9c8377){return new BPromise(function(_0x18902b,_0x560a23){return client['request'](_0x120a29,_0x9c8377)[_0xc8d4('0x11')](function(_0x4f2339){logger[_0xc8d4('0x12')](_0xc8d4('0x13'),_0x2b67c0,_0xc8d4('0x14'));logger[_0xc8d4('0x15')](_0xc8d4('0x16'),_0x2b67c0,_0xc8d4('0x14'),JSON[_0xc8d4('0x17')](_0x4f2339));if(_0x4f2339[_0xc8d4('0x18')]){if(_0x4f2339[_0xc8d4('0x18')][_0xc8d4('0x19')]===0x1f4){logger['error'](_0xc8d4('0x13'),_0x2b67c0,_0x4f2339[_0xc8d4('0x18')][_0xc8d4('0x1a')]);return _0x560a23(_0x4f2339[_0xc8d4('0x18')]['message']);}logger['error'](_0xc8d4('0x13'),_0x2b67c0,_0x4f2339[_0xc8d4('0x18')][_0xc8d4('0x1a')]);return _0x18902b(_0x4f2339[_0xc8d4('0x18')][_0xc8d4('0x1a')]);}else{logger[_0xc8d4('0x12')](_0xc8d4('0x13'),_0x2b67c0,_0xc8d4('0x14'));_0x18902b(_0x4f2339['result']['message']);}})[_0xc8d4('0x1b')](function(_0x5116d9){logger[_0xc8d4('0x18')](_0xc8d4('0x13'),_0x2b67c0,_0x5116d9);_0x560a23(_0x5116d9);});});}exports[_0xc8d4('0x1c')]=function(_0x46cbae){var _0x244c82=this;return new Promise(function(_0x17f297,_0x563a22){return db[_0xc8d4('0x1d')][_0xc8d4('0x1e')]({'raw':_0x46cbae['options']?_0x46cbae[_0xc8d4('0x1f')][_0xc8d4('0x20')]===undefined?!![]:![]:!![],'where':_0x46cbae[_0xc8d4('0x1f')]?_0x46cbae[_0xc8d4('0x1f')]['where']||null:null,'attributes':[[db[_0xc8d4('0x21')]['fn'](_0xc8d4('0x22'),db[_0xc8d4('0x21')]['fn']('IF',db[_0xc8d4('0x21')][_0xc8d4('0x23')](_0xc8d4('0x24')))),_0xc8d4('0x25')]]})['then'](function(_0x29686f){logger[_0xc8d4('0x12')](_0xc8d4('0x1c'),_0x46cbae);logger[_0xc8d4('0x15')](_0xc8d4('0x1c'),_0x46cbae,JSON['stringify'](_0x29686f));_0x17f297(_0x29686f);})[_0xc8d4('0x1b')](function(_0x466534){logger[_0xc8d4('0x18')]('GetVoiceQueueRtPauses',_0x466534[_0xc8d4('0x1a')],_0x46cbae);_0x563a22(_0x244c82['error'](0x1f4,_0x466534['message']));});});}; \ No newline at end of file +var _0x5958=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5958,0xe7));var _0x8595=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x5958[_0x49c057];return _0xd8f0e6;};'use strict';var _=require('lodash');var util=require(_0x8595('0x0'));var moment=require(_0x8595('0x1'));var BPromise=require(_0x8595('0x2'));var rs=require(_0x8595('0x3'));var fs=require('fs');var Redis=require(_0x8595('0x4'));var db=require(_0x8595('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8595('0x6'))(_0x8595('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8595('0x8')][_0x8595('0x9')]({'port':0x232a});config[_0x8595('0xa')]=_['defaults'](config[_0x8595('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8595('0xb'))(new Redis(config[_0x8595('0xa')]));require(_0x8595('0xc'))[_0x8595('0xd')](socket);function respondWithRpcPromise(_0x243c6f,_0x927972,_0x27aae3){return new BPromise(function(_0x5bd41c,_0x5231c7){return client['request'](_0x243c6f,_0x27aae3)['then'](function(_0xf4a226){logger['info'](_0x8595('0xe'),_0x927972,_0x8595('0xf'));logger[_0x8595('0x10')](_0x8595('0x11'),_0x927972,_0x8595('0xf'),JSON[_0x8595('0x12')](_0xf4a226));if(_0xf4a226[_0x8595('0x13')]){if(_0xf4a226[_0x8595('0x13')][_0x8595('0x14')]===0x1f4){logger['error'](_0x8595('0xe'),_0x927972,_0xf4a226['error'][_0x8595('0x15')]);return _0x5231c7(_0xf4a226[_0x8595('0x13')][_0x8595('0x15')]);}logger['error'](_0x8595('0xe'),_0x927972,_0xf4a226[_0x8595('0x13')][_0x8595('0x15')]);return _0x5bd41c(_0xf4a226['error'][_0x8595('0x15')]);}else{logger['info'](_0x8595('0xe'),_0x927972,'request\x20sent');_0x5bd41c(_0xf4a226[_0x8595('0x16')][_0x8595('0x15')]);}})[_0x8595('0x17')](function(_0x3f0853){logger[_0x8595('0x13')](_0x8595('0xe'),_0x927972,_0x3f0853);_0x5231c7(_0x3f0853);});});}exports[_0x8595('0x18')]=function(_0x58f28a){var _0x4e937e=this;return new Promise(function(_0x441f28,_0x5702e3){return db[_0x8595('0x19')]['findAll']({'raw':_0x58f28a[_0x8595('0x1a')]?_0x58f28a['options']['raw']===undefined?!![]:![]:!![],'where':_0x58f28a['options']?_0x58f28a[_0x8595('0x1a')][_0x8595('0x1b')]||null:null,'attributes':[[db[_0x8595('0x1c')]['fn'](_0x8595('0x1d'),db[_0x8595('0x1c')]['fn']('IF',db[_0x8595('0x1c')][_0x8595('0x1e')](_0x8595('0x1f')))),_0x8595('0x20')]]})['then'](function(_0x3d0f14){logger['info'](_0x8595('0x18'),_0x58f28a);logger[_0x8595('0x10')](_0x8595('0x18'),_0x58f28a,JSON['stringify'](_0x3d0f14));_0x441f28(_0x3d0f14);})[_0x8595('0x17')](function(_0x1c3d5f){logger['error'](_0x8595('0x18'),_0x1c3d5f[_0x8595('0x15')],_0x58f28a);_0x5702e3(_0x4e937e[_0x8595('0x13')](0x1f4,_0x1c3d5f[_0x8595('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 62189df..648f43a 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 _0xfc9b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x33b892,_0x546e55){var _0x59e599=function(_0x67b8f5){while(--_0x67b8f5){_0x33b892['push'](_0x33b892['shift']());}};_0x59e599(++_0x546e55);}(_0xfc9b,0x74));var _0xbfc9=function(_0x52a4fd,_0xc0044c){_0x52a4fd=_0x52a4fd-0x0;var _0x26da5f=_0xfc9b[_0x52a4fd];return _0x26da5f;};'use strict';var UserVoiceQueueRtEvents=require(_0xbfc9('0x0'));var events=[_0xbfc9('0x1'),_0xbfc9('0x2'),_0xbfc9('0x3')];function createListener(_0x29639e,_0x4618f9){return function(_0x397d76){_0x4618f9['emit'](_0x29639e,_0x397d76);};}function removeListener(_0x2eedb4,_0x49e470){return function(){UserVoiceQueueRtEvents[_0xbfc9('0x4')](_0x2eedb4,_0x49e470);};}exports[_0xbfc9('0x5')]=function(_0x523ff1){for(var _0x1dbece=0x0,_0x266c05=events[_0xbfc9('0x6')];_0x1dbece<_0x266c05;_0x1dbece++){var _0xe288d1=events[_0x1dbece];var _0x4e0f74=createListener(_0xbfc9('0x7')+_0xe288d1,_0x523ff1);UserVoiceQueueRtEvents['on'](_0xe288d1,_0x4e0f74);}}; \ No newline at end of file +var _0x36bb=['remove','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x34b664,_0x2d4252){var _0x2a666d=function(_0x1a840b){while(--_0x1a840b){_0x34b664['push'](_0x34b664['shift']());}};_0x2a666d(++_0x2d4252);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xb36b('0x0'));var events=[_0xb36b('0x1'),_0xb36b('0x2'),'update'];function createListener(_0x1d6c2e,_0xa54c6){return function(_0x9267f4){_0xa54c6[_0xb36b('0x3')](_0x1d6c2e,_0x9267f4);};}function removeListener(_0x311671,_0x3d57d7){return function(){UserVoiceQueueRtEvents[_0xb36b('0x4')](_0x311671,_0x3d57d7);};}exports[_0xb36b('0x5')]=function(_0x439ccc){for(var _0x418837=0x0,_0x181f45=events[_0xb36b('0x6')];_0x418837<_0x181f45;_0x418837++){var _0x229483=events[_0x418837];var _0x30e907=createListener(_0xb36b('0x7')+_0x229483,_0x439ccc);UserVoiceQueueRtEvents['on'](_0x229483,_0x30e907);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9e1573f..e881298 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x106866,_0x101c9a){var _0x3a050b=function(_0x329b53){while(--_0x329b53){_0x106866['push'](_0x106866['shift']());}};_0x3a050b(++_0x101c9a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x6f7cd,_0x5c8a20){var _0x1dd92a=function(_0x165422){while(--_0x165422){_0x6f7cd['push'](_0x6f7cd['shift']());}};_0x1dd92a(++_0x5c8a20);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1b2ecac..b1bd6d9 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 _0x56f3=['INTEGER','exports'];(function(_0x4564f9,_0x2253d0){var _0x5b5f1f=function(_0x2a4212){while(--_0x2a4212){_0x4564f9['push'](_0x4564f9['shift']());}};_0x5b5f1f(++_0x2253d0);}(_0x56f3,0x87));var _0x356f=function(_0x2c84a7,_0x4864f7){_0x2c84a7=_0x2c84a7-0x0;var _0x236fc6=_0x56f3[_0x2c84a7];return _0x236fc6;};'use strict';var Sequelize=require('sequelize');module[_0x356f('0x0')]={'penalty':{'type':Sequelize[_0x356f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a4c=['INTEGER','sequelize','exports'];(function(_0x29471c,_0x5d446f){var _0xa83112=function(_0x1d7eb1){while(--_0x1d7eb1){_0x29471c['push'](_0x29471c['shift']());}};_0xa83112(++_0x5d446f);}(_0x7a4c,0x1cf));var _0xc7a4=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x7a4c[_0x4afac5];return _0x2404b3;};'use strict';var Sequelize=require(_0xc7a4('0x0'));module[_0xc7a4('0x1')]={'penalty':{'type':Sequelize[_0xc7a4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 15784ab..c137aa4 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 _0x89f2=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','lodash'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x89f2,0x81));var _0x289f=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x89f2[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var logger=require(_0x289f('0x2'))(_0x289f('0x3'));var moment=require(_0x289f('0x4'));var BPromise=require(_0x289f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x289f('0x6'));var rimraf=require(_0x289f('0x7'));var config=require(_0x289f('0x8'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x32f915,_0x19f109){return _0x32f915[_0x289f('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da9=['rimraf','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','api','moment','bluebird','request-promise','path'];(function(_0x364e2b,_0x30b028){var _0x943fef=function(_0x3454a5){while(--_0x3454a5){_0x364e2b['push'](_0x364e2b['shift']());}};_0x943fef(++_0x30b028);}(_0x5da9,0x69));var _0x95da=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x5da9[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x95da('0x0'));var moment=require(_0x95da('0x1'));var BPromise=require(_0x95da('0x2'));var rp=require(_0x95da('0x3'));var fs=require('fs');var path=require(_0x95da('0x4'));var rimraf=require(_0x95da('0x5'));var config=require(_0x95da('0x6'));var attributes=require(_0x95da('0x7'));module['exports']=function(_0xe440a1,_0x188e6e){return _0xe440a1[_0x95da('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x95da('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 5be00c0..a5bb4e4 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 _0xf3d2=['info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xf3d2,0x13e));var _0x2f3d=function(_0x405022,_0x2377a8){_0x405022=_0x405022-0x0;var _0x3b29e7=_0xf3d2[_0x405022];return _0x3b29e7;};'use strict';var _=require('lodash');var util=require(_0x2f3d('0x0'));var moment=require(_0x2f3d('0x1'));var BPromise=require(_0x2f3d('0x2'));var rs=require(_0x2f3d('0x3'));var fs=require('fs');var Redis=require(_0x2f3d('0x4'));var db=require(_0x2f3d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f3d('0x6'))(_0x2f3d('0x7'));var config=require(_0x2f3d('0x8'));var jayson=require(_0x2f3d('0x9'));var client=jayson['client'][_0x2f3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20a44f,_0x793e10,_0x49d67b){return new BPromise(function(_0x32dc1d,_0x1aee7e){return client[_0x2f3d('0xb')](_0x20a44f,_0x49d67b)['then'](function(_0x339791){logger[_0x2f3d('0xc')](_0x2f3d('0xd'),_0x793e10,'request\x20sent');logger[_0x2f3d('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x793e10,'request\x20sent',JSON[_0x2f3d('0xf')](_0x339791));if(_0x339791[_0x2f3d('0x10')]){if(_0x339791['error'][_0x2f3d('0x11')]===0x1f4){logger['error'](_0x2f3d('0xd'),_0x793e10,_0x339791['error'][_0x2f3d('0x12')]);return _0x1aee7e(_0x339791[_0x2f3d('0x10')][_0x2f3d('0x12')]);}logger[_0x2f3d('0x10')](_0x2f3d('0xd'),_0x793e10,_0x339791['error'][_0x2f3d('0x12')]);return _0x32dc1d(_0x339791['error']['message']);}else{logger[_0x2f3d('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x793e10,_0x2f3d('0x13'));_0x32dc1d(_0x339791[_0x2f3d('0x14')][_0x2f3d('0x12')]);}})[_0x2f3d('0x15')](function(_0x3c5adb){logger[_0x2f3d('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x793e10,_0x3c5adb);_0x1aee7e(_0x3c5adb);});});} \ No newline at end of file +var _0xcfdf=['then','info','debug','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xcfdf,0x160));var _0xfcfd=function(_0x697236,_0x56391f){_0x697236=_0x697236-0x0;var _0x47aad4=_0xcfdf[_0x697236];return _0x47aad4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcfd('0x0'));var BPromise=require(_0xfcfd('0x1'));var rs=require(_0xfcfd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcfd('0x3'))['db'];var utils=require(_0xfcfd('0x4'));var logger=require(_0xfcfd('0x5'))('rpc');var config=require(_0xfcfd('0x6'));var jayson=require(_0xfcfd('0x7'));var client=jayson['client'][_0xfcfd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41375a,_0x45dc00,_0x138aee){return new BPromise(function(_0x47dac9,_0x19b95e){return client['request'](_0x41375a,_0x138aee)[_0xfcfd('0x9')](function(_0x2c6fe6){logger[_0xfcfd('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x45dc00,'request\x20sent');logger[_0xfcfd('0xb')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x45dc00,_0xfcfd('0xc'),JSON[_0xfcfd('0xd')](_0x2c6fe6));if(_0x2c6fe6[_0xfcfd('0xe')]){if(_0x2c6fe6[_0xfcfd('0xe')][_0xfcfd('0xf')]===0x1f4){logger[_0xfcfd('0xe')](_0xfcfd('0x10'),_0x45dc00,_0x2c6fe6[_0xfcfd('0xe')][_0xfcfd('0x11')]);return _0x19b95e(_0x2c6fe6[_0xfcfd('0xe')][_0xfcfd('0x11')]);}logger[_0xfcfd('0xe')](_0xfcfd('0x10'),_0x45dc00,_0x2c6fe6['error'][_0xfcfd('0x11')]);return _0x47dac9(_0x2c6fe6[_0xfcfd('0xe')]['message']);}else{logger[_0xfcfd('0xa')](_0xfcfd('0x10'),_0x45dc00,'request\x20sent');_0x47dac9(_0x2c6fe6[_0xfcfd('0x12')]['message']);}})['catch'](function(_0xf69719){logger[_0xfcfd('0xe')](_0xfcfd('0x10'),_0x45dc00,_0xf69719);_0x19b95e(_0xf69719);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a8cc16a..9b7f533 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 _0x8ece=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4f0e26,_0x451f27){var _0x4cf962=function(_0x57496c){while(--_0x57496c){_0x4f0e26['push'](_0x4f0e26['shift']());}};_0x4cf962(++_0x451f27);}(_0x8ece,0x195));var _0xe8ec=function(_0x201aca,_0x21c20d){_0x201aca=_0x201aca-0x0;var _0xd08049=_0x8ece[_0x201aca];return _0xd08049;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8ec('0xf')]);router['put'](_0xe8ec('0xc'),auth['isAuthenticated'](),controller[_0xe8ec('0x10')]);router[_0xe8ec('0x11')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);module[_0xe8ec('0x13')]=router; \ No newline at end of file +var _0x7a72=['express','fs-extra','../../components/interaction/service','./variable.controller','isAuthenticated','index','post','create','put','update','delete','destroy','util','path'];(function(_0x5e8ff6,_0x4e7317){var _0x2d6b90=function(_0xa7225b){while(--_0xa7225b){_0x5e8ff6['push'](_0x5e8ff6['shift']());}};_0x2d6b90(++_0x4e7317);}(_0x7a72,0x1be));var _0x27a7=function(_0x10b445,_0x437c4e){_0x10b445=_0x10b445-0x0;var _0xcfedbc=_0x7a72[_0x10b445];return _0xcfedbc;};'use strict';var multer=require('multer');var util=require(_0x27a7('0x0'));var path=require(_0x27a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x27a7('0x2'));var router=express['Router']();var fs_extra=require(_0x27a7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x27a7('0x4'));var config=require('../../config/environment');var controller=require(_0x27a7('0x5'));router['get']('/',auth[_0x27a7('0x6')](),controller[_0x27a7('0x7')]);router['get']('/:id',auth[_0x27a7('0x6')](),controller['show']);router[_0x27a7('0x8')]('/',auth[_0x27a7('0x6')](),controller[_0x27a7('0x9')]);router[_0x27a7('0xa')]('/:id',auth[_0x27a7('0x6')](),controller[_0x27a7('0xb')]);router[_0x27a7('0xc')]('/:id',auth[_0x27a7('0x6')](),controller[_0x27a7('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index dc9bc39..e12d691 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 _0x2365=['name','sequelize','exports','STRING'];(function(_0x1da5e7,_0x4f8daf){var _0x248832=function(_0x1649e3){while(--_0x1649e3){_0x1da5e7['push'](_0x1da5e7['shift']());}};_0x248832(++_0x4f8daf);}(_0x2365,0x111));var _0x5236=function(_0x1ed20f,_0x16d891){_0x1ed20f=_0x1ed20f-0x0;var _0x47599e=_0x2365[_0x1ed20f];return _0x47599e;};'use strict';var Sequelize=require(_0x5236('0x0'));module[_0x5236('0x1')]={'name':{'type':Sequelize[_0x5236('0x2')],'unique':_0x5236('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5236('0x2')]}}; \ No newline at end of file +var _0x04ad=['STRING','name'];(function(_0x39be58,_0x4a5561){var _0xee2f2f=function(_0x4ec3c1){while(--_0x4ec3c1){_0x39be58['push'](_0x39be58['shift']());}};_0xee2f2f(++_0x4a5561);}(_0x04ad,0x1d2));var _0xd04a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04ad[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd04a('0x0')],'unique':_0xd04a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd04a('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 496a7f4..4d723de 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 _0x1406=['undefined','limit','count','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','type','VIRTUAL','options','Variable','includeAll','include','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','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','status','end','offset'];(function(_0x5664ea,_0x4cb50b){var _0x23152c=function(_0x5625a9){while(--_0x5625a9){_0x5664ea['push'](_0x5664ea['shift']());}};_0x23152c(++_0x4cb50b);}(_0x1406,0xc4));var _0x6140=function(_0x58fc6f,_0x30e851){_0x58fc6f=_0x58fc6f-0x0;var _0x1186db=_0x1406[_0x58fc6f];return _0x1186db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6140('0x0'));var jsonpatch=require(_0x6140('0x1'));var rp=require(_0x6140('0x2'));var moment=require(_0x6140('0x3'));var BPromise=require(_0x6140('0x4'));var Mustache=require('mustache');var util=require(_0x6140('0x5'));var path=require('path');var sox=require(_0x6140('0x6'));var csv=require(_0x6140('0x7'));var ejs=require(_0x6140('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6140('0x9'));var jsforce=require(_0x6140('0xa'));var deskjs=require(_0x6140('0xb'));var toCsv=require(_0x6140('0x7'));var querystring=require(_0x6140('0xc'));var Papa=require('papaparse');var Redis=require(_0x6140('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6140('0xe'));var as=require(_0x6140('0xf'));var hardwareService=require(_0x6140('0x10'));var logger=require(_0x6140('0x11'))(_0x6140('0x12'));var utils=require(_0x6140('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6140('0x14'));var db=require(_0x6140('0x15'))['db'];function respondWithStatusCode(_0x47c600,_0x3e65da){_0x3e65da=_0x3e65da||0xcc;return function(_0xfc2bba){if(_0xfc2bba){return _0x47c600[_0x6140('0x16')](_0x3e65da);}return _0x47c600[_0x6140('0x17')](_0x3e65da)[_0x6140('0x18')]();};}function respondWithResult(_0x56833c,_0x141c9e){_0x141c9e=_0x141c9e||0xc8;return function(_0x349cd9){if(_0x349cd9){return _0x56833c['status'](_0x141c9e)['json'](_0x349cd9);}};}function respondWithFilteredResult(_0x254eca,_0x3b27e7){return function(_0x411f7d){if(_0x411f7d){var _0x4385b2=typeof _0x3b27e7[_0x6140('0x19')]===_0x6140('0x1a')&&typeof _0x3b27e7[_0x6140('0x1b')]===_0x6140('0x1a');var _0x1f0e09=_0x411f7d[_0x6140('0x1c')];var _0x259a82=_0x4385b2?0x0:_0x3b27e7[_0x6140('0x19')];var _0x23128c=_0x4385b2?_0x411f7d[_0x6140('0x1c')]:_0x3b27e7[_0x6140('0x19')]+_0x3b27e7[_0x6140('0x1b')];var _0x228416;if(_0x23128c>=_0x1f0e09){_0x23128c=_0x1f0e09;_0x228416=0xc8;}else{_0x228416=0xce;}_0x254eca['status'](_0x228416);return _0x254eca['set'](_0x6140('0x1d'),_0x259a82+'-'+_0x23128c+'/'+_0x1f0e09)['json'](_0x411f7d);}return null;};}function patchUpdates(_0x236994){return function(_0x5be1e9){try{jsonpatch['apply'](_0x5be1e9,_0x236994,!![]);}catch(_0x153e6a){return BPromise[_0x6140('0x1e')](_0x153e6a);}return _0x5be1e9[_0x6140('0x1f')]();};}function saveUpdates(_0x2482d9,_0x50db53){return function(_0x466dfd){if(_0x466dfd){return _0x466dfd[_0x6140('0x20')](_0x2482d9)[_0x6140('0x21')](function(_0x171cb9){return _0x171cb9;});}return null;};}function removeEntity(_0x482fa3,_0x6265ab){return function(_0x56c07a){if(_0x56c07a){return _0x56c07a['destroy']()[_0x6140('0x21')](function(){var _0x589589=_0x56c07a[_0x6140('0x22')]({'plain':!![]});var _0x167046='Variables';return db[_0x6140('0x23')][_0x6140('0x24')]({'where':{'type':_0x167046,'resourceId':_0x589589['id']}})['then'](function(){return _0x56c07a;});})['then'](function(){_0x482fa3[_0x6140('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10560c,_0x829ee3){return function(_0x59299e){if(!_0x59299e){_0x10560c[_0x6140('0x16')](0x194);}return _0x59299e;};}function handleError(_0x4575ba,_0x5616bc){_0x5616bc=_0x5616bc||0x1f4;return function(_0x1e1dbc){logger[_0x6140('0x25')](_0x1e1dbc[_0x6140('0x26')]);if(_0x1e1dbc['name']){delete _0x1e1dbc[_0x6140('0x27')];}_0x4575ba[_0x6140('0x17')](_0x5616bc)[_0x6140('0x28')](_0x1e1dbc);};}exports['index']=function(_0x4f94a2,_0x4df2d4){var _0x362749={},_0x10e460={},_0x4b3485={'count':0x0,'rows':[]};var _0x14799f=_[_0x6140('0x29')](db['Variable'][_0x6140('0x2a')],function(_0x390417){return{'name':_0x390417['fieldName'],'type':_0x390417['type'][_0x6140('0x2b')]};});_0x10e460[_0x6140('0x2c')]=_[_0x6140('0x29')](_0x14799f,_0x6140('0x27'));_0x10e460[_0x6140('0x2d')]=_[_0x6140('0x2e')](_0x4f94a2[_0x6140('0x2d')]);_0x10e460['filters']=_[_0x6140('0x2f')](_0x10e460['model'],_0x10e460[_0x6140('0x2d')]);_0x362749[_0x6140('0x30')]=_[_0x6140('0x2f')](_0x10e460[_0x6140('0x2c')],qs['fields'](_0x4f94a2[_0x6140('0x2d')][_0x6140('0x31')]));_0x362749['attributes']=_0x362749[_0x6140('0x30')][_0x6140('0x32')]?_0x362749[_0x6140('0x30')]:_0x10e460[_0x6140('0x2c')];if(!_0x4f94a2[_0x6140('0x2d')]['hasOwnProperty'](_0x6140('0x33'))){_0x362749[_0x6140('0x1b')]=qs[_0x6140('0x1b')](_0x4f94a2['query']['limit']);_0x362749[_0x6140('0x19')]=qs['offset'](_0x4f94a2[_0x6140('0x2d')]['offset']);}_0x362749[_0x6140('0x34')]=qs[_0x6140('0x35')](_0x4f94a2[_0x6140('0x2d')][_0x6140('0x35')]);_0x362749['where']=qs['filters'](_[_0x6140('0x36')](_0x4f94a2[_0x6140('0x2d')],_0x10e460['filters']),_0x14799f);if(_0x4f94a2['query']['filter']){_0x362749['where']=_[_0x6140('0x37')](_0x362749[_0x6140('0x38')],{'$or':_['map'](_0x14799f,function(_0x3d2d63){if(_0x3d2d63[_0x6140('0x39')]!==_0x6140('0x3a')){var _0x29627f={};_0x29627f[_0x3d2d63[_0x6140('0x27')]]={'$like':'%'+_0x4f94a2[_0x6140('0x2d')]['filter']+'%'};return _0x29627f;}})});}_0x362749=_[_0x6140('0x37')]({},_0x362749,_0x4f94a2[_0x6140('0x3b')]);var _0x5c368d={'where':_0x362749[_0x6140('0x38')]};return db[_0x6140('0x3c')][_0x6140('0x1c')](_0x5c368d)['then'](function(_0x4bae71){_0x4b3485[_0x6140('0x1c')]=_0x4bae71;if(_0x4f94a2[_0x6140('0x2d')][_0x6140('0x3d')]){_0x362749[_0x6140('0x3e')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x362749);})[_0x6140('0x21')](function(_0x2e5147){_0x4b3485['rows']=_0x2e5147;return _0x4b3485;})[_0x6140('0x21')](respondWithFilteredResult(_0x4df2d4,_0x362749))[_0x6140('0x3f')](handleError(_0x4df2d4,null));};exports['show']=function(_0x6747bd,_0x469518){var _0xd025f2={'raw':!![],'where':{'id':_0x6747bd[_0x6140('0x40')]['id']}},_0x3e1122={};_0x3e1122[_0x6140('0x2c')]=_['keys'](db['Variable'][_0x6140('0x2a')]);_0x3e1122[_0x6140('0x2d')]=_[_0x6140('0x2e')](_0x6747bd[_0x6140('0x2d')]);_0x3e1122['filters']=_[_0x6140('0x2f')](_0x3e1122[_0x6140('0x2c')],_0x3e1122[_0x6140('0x2d')]);_0xd025f2['attributes']=_[_0x6140('0x2f')](_0x3e1122['model'],qs[_0x6140('0x31')](_0x6747bd['query'][_0x6140('0x31')]));_0xd025f2['attributes']=_0xd025f2[_0x6140('0x30')][_0x6140('0x32')]?_0xd025f2['attributes']:_0x3e1122[_0x6140('0x2c')];if(_0x6747bd['query'][_0x6140('0x3d')]){_0xd025f2[_0x6140('0x3e')]=[{'all':!![]}];}_0xd025f2=_[_0x6140('0x37')]({},_0xd025f2,_0x6747bd[_0x6140('0x3b')]);return db['Variable']['find'](_0xd025f2)[_0x6140('0x21')](handleEntityNotFound(_0x469518,null))[_0x6140('0x21')](respondWithResult(_0x469518,null))[_0x6140('0x3f')](handleError(_0x469518,null));};exports['create']=function(_0x326c58,_0xb3aac2){return db['Variable'][_0x6140('0x41')](_0x326c58['body'],{})[_0x6140('0x21')](function(_0x5bbae2){var _0x5385d3=_0x326c58[_0x6140('0x42')][_0x6140('0x22')]({'plain':!![]});if(!_0x5385d3)throw new Error(_0x6140('0x43'));if(_0x5385d3[_0x6140('0x44')]===_0x6140('0x42')){var _0x31d32f=_0x5bbae2[_0x6140('0x22')]({'plain':!![]});var _0x3bf196=_0x6140('0x45');return db[_0x6140('0x46')]['find']({'where':{'name':_0x3bf196,'userProfileId':_0x5385d3[_0x6140('0x47')]},'raw':!![]})[_0x6140('0x21')](function(_0x5de35e){if(_0x5de35e&&_0x5de35e['autoAssociation']===0x0){return db[_0x6140('0x23')][_0x6140('0x41')]({'name':_0x31d32f[_0x6140('0x27')],'resourceId':_0x31d32f['id'],'type':_0x5de35e['name'],'sectionId':_0x5de35e['id']},{})[_0x6140('0x21')](function(){return _0x5bbae2;});}else{return _0x5bbae2;}})[_0x6140('0x3f')](function(_0x39b7d1){logger[_0x6140('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39b7d1);throw _0x39b7d1;});}return _0x5bbae2;})[_0x6140('0x21')](respondWithResult(_0xb3aac2,0xc9))[_0x6140('0x3f')](handleError(_0xb3aac2,null));};exports[_0x6140('0x20')]=function(_0x361248,_0x1b4b0d){if(_0x361248['body']['id']){delete _0x361248[_0x6140('0x48')]['id'];}return db[_0x6140('0x3c')][_0x6140('0x49')]({'where':{'id':_0x361248[_0x6140('0x40')]['id']}})[_0x6140('0x21')](handleEntityNotFound(_0x1b4b0d,null))['then'](saveUpdates(_0x361248[_0x6140('0x48')],null))['then'](respondWithResult(_0x1b4b0d,null))[_0x6140('0x3f')](handleError(_0x1b4b0d,null));};exports[_0x6140('0x24')]=function(_0x2953a8,_0x166b6a){return db[_0x6140('0x3c')][_0x6140('0x49')]({'where':{'id':_0x2953a8['params']['id']}})[_0x6140('0x21')](handleEntityNotFound(_0x166b6a,null))[_0x6140('0x21')](removeEntity(_0x166b6a,null))[_0x6140('0x3f')](handleError(_0x166b6a,null));}; \ No newline at end of file +var _0x471e=['nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','keys','fields','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Variables','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','hasOwnProperty'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x471e,0x1dc));var _0xe471=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x471e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xe471('0x0'));var rimraf=require(_0xe471('0x1'));var zipdir=require(_0xe471('0x2'));var jsonpatch=require(_0xe471('0x3'));var rp=require(_0xe471('0x4'));var moment=require(_0xe471('0x5'));var BPromise=require(_0xe471('0x6'));var Mustache=require(_0xe471('0x7'));var util=require(_0xe471('0x8'));var path=require(_0xe471('0x9'));var sox=require(_0xe471('0xa'));var csv=require(_0xe471('0xb'));var ejs=require(_0xe471('0xc'));var fs=require('fs');var fs_extra=require(_0xe471('0xd'));var _=require(_0xe471('0xe'));var squel=require('squel');var crypto=require(_0xe471('0xf'));var jsforce=require(_0xe471('0x10'));var deskjs=require(_0xe471('0x11'));var toCsv=require(_0xe471('0xb'));var querystring=require(_0xe471('0x12'));var Papa=require(_0xe471('0x13'));var Redis=require(_0xe471('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe471('0x15'));var as=require(_0xe471('0x16'));var hardwareService=require(_0xe471('0x17'));var logger=require(_0xe471('0x18'))(_0xe471('0x19'));var utils=require(_0xe471('0x1a'));var config=require(_0xe471('0x1b'));var licenseUtil=require(_0xe471('0x1c'));var db=require(_0xe471('0x1d'))['db'];function respondWithStatusCode(_0x2e7675,_0x585ec1){_0x585ec1=_0x585ec1||0xcc;return function(_0x3291d9){if(_0x3291d9){return _0x2e7675[_0xe471('0x1e')](_0x585ec1);}return _0x2e7675[_0xe471('0x1f')](_0x585ec1)[_0xe471('0x20')]();};}function respondWithResult(_0x187796,_0x2de4a8){_0x2de4a8=_0x2de4a8||0xc8;return function(_0x59aeec){if(_0x59aeec){return _0x187796['status'](_0x2de4a8)[_0xe471('0x21')](_0x59aeec);}};}function respondWithFilteredResult(_0x5e34c0,_0x1c32c7){return function(_0x42fb1c){if(_0x42fb1c){var _0x439144=typeof _0x1c32c7[_0xe471('0x22')]===_0xe471('0x23')&&typeof _0x1c32c7[_0xe471('0x24')]==='undefined';var _0x3dae6f=_0x42fb1c[_0xe471('0x25')];var _0x3545b1=_0x439144?0x0:_0x1c32c7[_0xe471('0x22')];var _0x304cfe=_0x439144?_0x42fb1c[_0xe471('0x25')]:_0x1c32c7[_0xe471('0x22')]+_0x1c32c7[_0xe471('0x24')];var _0x348e86;if(_0x304cfe>=_0x3dae6f){_0x304cfe=_0x3dae6f;_0x348e86=0xc8;}else{_0x348e86=0xce;}_0x5e34c0[_0xe471('0x1f')](_0x348e86);return _0x5e34c0[_0xe471('0x26')](_0xe471('0x27'),_0x3545b1+'-'+_0x304cfe+'/'+_0x3dae6f)['json'](_0x42fb1c);}return null;};}function patchUpdates(_0xd067d4){return function(_0x5bf952){try{jsonpatch[_0xe471('0x28')](_0x5bf952,_0xd067d4,!![]);}catch(_0x410d3b){return BPromise[_0xe471('0x29')](_0x410d3b);}return _0x5bf952[_0xe471('0x2a')]();};}function saveUpdates(_0x2e04d7,_0x4a7ad7){return function(_0x725c76){if(_0x725c76){return _0x725c76[_0xe471('0x2b')](_0x2e04d7)[_0xe471('0x2c')](function(_0xba69f1){return _0xba69f1;});}return null;};}function removeEntity(_0x282bb2,_0x52ba75){return function(_0x58fe8e){if(_0x58fe8e){return _0x58fe8e['destroy']()[_0xe471('0x2c')](function(){var _0x1ce7b3=_0x58fe8e['get']({'plain':!![]});var _0x4f3eff=_0xe471('0x2d');return db[_0xe471('0x2e')]['destroy']({'where':{'type':_0x4f3eff,'resourceId':_0x1ce7b3['id']}})[_0xe471('0x2c')](function(){return _0x58fe8e;});})['then'](function(){_0x282bb2[_0xe471('0x1f')](0xcc)[_0xe471('0x20')]();});}};}function handleEntityNotFound(_0x3ccb46,_0x34a591){return function(_0x3977c2){if(!_0x3977c2){_0x3ccb46[_0xe471('0x1e')](0x194);}return _0x3977c2;};}function handleError(_0x303374,_0x34648f){_0x34648f=_0x34648f||0x1f4;return function(_0x4c6c99){logger[_0xe471('0x2f')](_0x4c6c99[_0xe471('0x30')]);if(_0x4c6c99[_0xe471('0x31')]){delete _0x4c6c99[_0xe471('0x31')];}_0x303374[_0xe471('0x1f')](_0x34648f)[_0xe471('0x32')](_0x4c6c99);};}exports[_0xe471('0x33')]=function(_0x594c2b,_0x293ce2){var _0x1a13cb={},_0xb43893={},_0x561de7={'count':0x0,'rows':[]};var _0x5aa166=_['map'](db[_0xe471('0x34')][_0xe471('0x35')],function(_0x4ae986){return{'name':_0x4ae986[_0xe471('0x36')],'type':_0x4ae986[_0xe471('0x37')][_0xe471('0x38')]};});_0xb43893[_0xe471('0x39')]=_[_0xe471('0x3a')](_0x5aa166,_0xe471('0x31'));_0xb43893[_0xe471('0x3b')]=_['keys'](_0x594c2b['query']);_0xb43893[_0xe471('0x3c')]=_['intersection'](_0xb43893[_0xe471('0x39')],_0xb43893['query']);_0x1a13cb['attributes']=_[_0xe471('0x3d')](_0xb43893[_0xe471('0x39')],qs['fields'](_0x594c2b[_0xe471('0x3b')]['fields']));_0x1a13cb[_0xe471('0x3e')]=_0x1a13cb[_0xe471('0x3e')]['length']?_0x1a13cb[_0xe471('0x3e')]:_0xb43893['model'];if(!_0x594c2b[_0xe471('0x3b')][_0xe471('0x3f')](_0xe471('0x40'))){_0x1a13cb['limit']=qs['limit'](_0x594c2b[_0xe471('0x3b')][_0xe471('0x24')]);_0x1a13cb[_0xe471('0x22')]=qs[_0xe471('0x22')](_0x594c2b['query'][_0xe471('0x22')]);}_0x1a13cb['order']=qs[_0xe471('0x41')](_0x594c2b[_0xe471('0x3b')][_0xe471('0x41')]);_0x1a13cb[_0xe471('0x42')]=qs[_0xe471('0x3c')](_['pick'](_0x594c2b[_0xe471('0x3b')],_0xb43893['filters']),_0x5aa166);if(_0x594c2b[_0xe471('0x3b')][_0xe471('0x43')]){_0x1a13cb['where']=_['merge'](_0x1a13cb[_0xe471('0x42')],{'$or':_['map'](_0x5aa166,function(_0x3ee3d7){if(_0x3ee3d7[_0xe471('0x37')]!=='VIRTUAL'){var _0x416494={};_0x416494[_0x3ee3d7[_0xe471('0x31')]]={'$like':'%'+_0x594c2b[_0xe471('0x3b')][_0xe471('0x43')]+'%'};return _0x416494;}})});}_0x1a13cb=_[_0xe471('0x44')]({},_0x1a13cb,_0x594c2b[_0xe471('0x45')]);var _0x361220={'where':_0x1a13cb['where']};return db[_0xe471('0x34')]['count'](_0x361220)['then'](function(_0x5c9b0a){_0x561de7[_0xe471('0x25')]=_0x5c9b0a;if(_0x594c2b[_0xe471('0x3b')][_0xe471('0x46')]){_0x1a13cb[_0xe471('0x47')]=[{'all':!![]}];}return db[_0xe471('0x34')][_0xe471('0x48')](_0x1a13cb);})[_0xe471('0x2c')](function(_0xf28a5d){_0x561de7[_0xe471('0x49')]=_0xf28a5d;return _0x561de7;})[_0xe471('0x2c')](respondWithFilteredResult(_0x293ce2,_0x1a13cb))[_0xe471('0x4a')](handleError(_0x293ce2,null));};exports['show']=function(_0x27ee59,_0x1bf9d3){var _0x3bc1bc={'raw':!![],'where':{'id':_0x27ee59['params']['id']}},_0x572b5c={};_0x572b5c[_0xe471('0x39')]=_[_0xe471('0x4b')](db[_0xe471('0x34')][_0xe471('0x35')]);_0x572b5c[_0xe471('0x3b')]=_[_0xe471('0x4b')](_0x27ee59[_0xe471('0x3b')]);_0x572b5c[_0xe471('0x3c')]=_[_0xe471('0x3d')](_0x572b5c['model'],_0x572b5c[_0xe471('0x3b')]);_0x3bc1bc[_0xe471('0x3e')]=_[_0xe471('0x3d')](_0x572b5c[_0xe471('0x39')],qs[_0xe471('0x4c')](_0x27ee59[_0xe471('0x3b')]['fields']));_0x3bc1bc[_0xe471('0x3e')]=_0x3bc1bc[_0xe471('0x3e')][_0xe471('0x4d')]?_0x3bc1bc['attributes']:_0x572b5c[_0xe471('0x39')];if(_0x27ee59[_0xe471('0x3b')][_0xe471('0x46')]){_0x3bc1bc['include']=[{'all':!![]}];}_0x3bc1bc=_[_0xe471('0x44')]({},_0x3bc1bc,_0x27ee59[_0xe471('0x45')]);return db[_0xe471('0x34')]['find'](_0x3bc1bc)[_0xe471('0x2c')](handleEntityNotFound(_0x1bf9d3,null))[_0xe471('0x2c')](respondWithResult(_0x1bf9d3,null))[_0xe471('0x4a')](handleError(_0x1bf9d3,null));};exports[_0xe471('0x4e')]=function(_0x38a1b1,_0x55ab43){return db[_0xe471('0x34')][_0xe471('0x4e')](_0x38a1b1[_0xe471('0x4f')],{})[_0xe471('0x2c')](function(_0x15b76c){var _0x3d0ee4=_0x38a1b1[_0xe471('0x50')][_0xe471('0x51')]({'plain':!![]});if(!_0x3d0ee4)throw new Error(_0xe471('0x52'));if(_0x3d0ee4[_0xe471('0x53')]===_0xe471('0x50')){var _0x4ca733=_0x15b76c[_0xe471('0x51')]({'plain':!![]});var _0x28aa92=_0xe471('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x28aa92,'userProfileId':_0x3d0ee4[_0xe471('0x54')]},'raw':!![]})[_0xe471('0x2c')](function(_0x14ca23){if(_0x14ca23&&_0x14ca23[_0xe471('0x55')]===0x0){return db[_0xe471('0x2e')][_0xe471('0x4e')]({'name':_0x4ca733[_0xe471('0x31')],'resourceId':_0x4ca733['id'],'type':_0x14ca23['name'],'sectionId':_0x14ca23['id']},{})[_0xe471('0x2c')](function(){return _0x15b76c;});}else{return _0x15b76c;}})[_0xe471('0x4a')](function(_0x5efabb){logger['error'](_0xe471('0x56'),_0x5efabb);throw _0x5efabb;});}return _0x15b76c;})[_0xe471('0x2c')](respondWithResult(_0x55ab43,0xc9))[_0xe471('0x4a')](handleError(_0x55ab43,null));};exports[_0xe471('0x2b')]=function(_0x7e8a1d,_0x11b24a){if(_0x7e8a1d[_0xe471('0x4f')]['id']){delete _0x7e8a1d['body']['id'];}return db['Variable'][_0xe471('0x57')]({'where':{'id':_0x7e8a1d[_0xe471('0x58')]['id']}})[_0xe471('0x2c')](handleEntityNotFound(_0x11b24a,null))[_0xe471('0x2c')](saveUpdates(_0x7e8a1d[_0xe471('0x4f')],null))['then'](respondWithResult(_0x11b24a,null))[_0xe471('0x4a')](handleError(_0x11b24a,null));};exports[_0xe471('0x59')]=function(_0x44dead,_0x3a3506){return db['Variable'][_0xe471('0x57')]({'where':{'id':_0x44dead['params']['id']}})[_0xe471('0x2c')](handleEntityNotFound(_0x3a3506,null))[_0xe471('0x2c')](removeEntity(_0x3a3506,null))['catch'](handleError(_0x3a3506,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 24dd7d6..c3c5acf 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 _0x5cd1=['rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','path'];(function(_0x1f15bb,_0x4663fb){var _0x3a49ef=function(_0x5aa13c){while(--_0x5aa13c){_0x1f15bb['push'](_0x1f15bb['shift']());}};_0x3a49ef(++_0x4663fb);}(_0x5cd1,0xd2));var _0x15cd=function(_0x401523,_0x21e3fa){_0x401523=_0x401523-0x0;var _0x1da839=_0x5cd1[_0x401523];return _0x1da839;};'use strict';var _=require(_0x15cd('0x0'));var util=require(_0x15cd('0x1'));var logger=require(_0x15cd('0x2'))(_0x15cd('0x3'));var moment=require(_0x15cd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15cd('0x5'));var rimraf=require(_0x15cd('0x6'));var config=require(_0x15cd('0x7'));var attributes=require(_0x15cd('0x8'));module['exports']=function(_0x2dd106,_0x43d513){return _0x2dd106[_0x15cd('0x9')](_0x15cd('0xa'),attributes,{'tableName':_0x15cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d79=['../../config/logger','api','moment','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util'];(function(_0x5c846d,_0x5c02ce){var _0xd064e4=function(_0x5631f3){while(--_0x5631f3){_0x5c846d['push'](_0x5c846d['shift']());}};_0xd064e4(++_0x5c02ce);}(_0x2d79,0x14e));var _0x92d7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2d79[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x92d7('0x0'));var util=require(_0x92d7('0x1'));var logger=require(_0x92d7('0x2'))(_0x92d7('0x3'));var moment=require(_0x92d7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x92d7('0x5'));var rimraf=require(_0x92d7('0x6'));var config=require(_0x92d7('0x7'));var attributes=require(_0x92d7('0x8'));module['exports']=function(_0xed752e,_0x5b5a68){return _0xed752e[_0x92d7('0x9')](_0x92d7('0xa'),attributes,{'tableName':_0x92d7('0xb'),'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 5fc174b..67c3f8d 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x21aa5b,_0x2c808f){var _0x2ca4c8=function(_0x5819e5){while(--_0x5819e5){_0x21aa5b['push'](_0x21aa5b['shift']());}};_0x2ca4c8(++_0x2c808f);}(_0x3e74,0x175));var _0x43e7=function(_0x220845,_0x48cfb5){_0x220845=_0x220845-0x0;var _0x10afb1=_0x3e74[_0x220845];return _0x10afb1;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x3e74,0x175));var _0x43e7=function(_0x282aa0,_0x16ecf4){_0x282aa0=_0x282aa0-0x0;var _0x437faa=_0x3e74[_0x282aa0];return _0x437faa;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0525138..e6f213b 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 _0xe983=['/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','canUpdate','fetch','/reset','isAuthenticated','reset'];(function(_0x2a0abb,_0x44e097){var _0x5b90fb=function(_0x2276e6){while(--_0x2276e6){_0x2a0abb['push'](_0x2a0abb['shift']());}};_0x5b90fb(++_0x44e097);}(_0xe983,0x1e3));var _0x3e98=function(_0xc32c0b,_0x323bd3){_0xc32c0b=_0xc32c0b-0x0;var _0x1216b4=_0xe983[_0xc32c0b];return _0x1216b4;};'use strict';var express=require(_0x3e98('0x0'));var router=express[_0x3e98('0x1')]();var auth=require(_0x3e98('0x2'));var controller=require(_0x3e98('0x3'));router[_0x3e98('0x4')]('/',controller['index']);router[_0x3e98('0x4')]('/fetch',auth['isAuthenticated'](),auth[_0x3e98('0x5')](),controller[_0x3e98('0x6')]);router[_0x3e98('0x4')](_0x3e98('0x7'),auth[_0x3e98('0x8')](),auth['canUpdate'](),controller[_0x3e98('0x9')]);router['get'](_0x3e98('0xa'),auth['isAuthenticated'](),auth[_0x3e98('0x5')](),controller[_0x3e98('0xb')]);router[_0x3e98('0x4')](_0x3e98('0xc'),auth[_0x3e98('0x8')](),controller[_0x3e98('0xd')]);router[_0x3e98('0x4')](_0x3e98('0xe'),controller[_0x3e98('0xf')]);module[_0x3e98('0x10')]=router; \ No newline at end of file +var _0x9b1b=['express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','exports'];(function(_0x4fd7cf,_0xaf817d){var _0x195b66=function(_0x4ac52a){while(--_0x4ac52a){_0x4fd7cf['push'](_0x4fd7cf['shift']());}};_0x195b66(++_0xaf817d);}(_0x9b1b,0xe0));var _0xb9b1=function(_0x4f5081,_0x14688d){_0x4f5081=_0x4f5081-0x0;var _0x2c212f=_0x9b1b[_0x4f5081];return _0x2c212f;};'use strict';var express=require(_0xb9b1('0x0'));var router=express[_0xb9b1('0x1')]();var auth=require(_0xb9b1('0x2'));var controller=require(_0xb9b1('0x3'));router[_0xb9b1('0x4')]('/',controller['index']);router[_0xb9b1('0x4')](_0xb9b1('0x5'),auth[_0xb9b1('0x6')](),auth[_0xb9b1('0x7')](),controller[_0xb9b1('0x8')]);router[_0xb9b1('0x4')](_0xb9b1('0x9'),auth[_0xb9b1('0x6')](),auth[_0xb9b1('0x7')](),controller[_0xb9b1('0xa')]);router[_0xb9b1('0x4')](_0xb9b1('0xb'),auth[_0xb9b1('0x6')](),auth[_0xb9b1('0x7')](),controller[_0xb9b1('0xc')]);router[_0xb9b1('0x4')](_0xb9b1('0xd'),auth['isAuthenticated'](),controller[_0xb9b1('0xe')]);router[_0xb9b1('0x4')]('/migrations',controller['migrations']);module[_0xb9b1('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 b39690c..76223c5 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 _0xdece=['root','migrations','length','replace','.js','exports','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0xdece,0x1a8));var _0xedec=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdece[_0x4e676e];return _0x336a3c;};'use strict';var Umzug=require(_0xedec('0x0'));var path=require(_0xedec('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xedec('0x2'));var compareVersions=require(_0xedec('0x3'));var exec=require(_0xedec('0x4'))[_0xedec('0x5')];var db=require(_0xedec('0x6'))['db'];var config=require(_0xedec('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xedec('0x8'))('update');var git=require('simple-git')(config['root']);exports['index']=function(_0x9969eb,_0x23d8cd){var _0x2fb9e5={'current':module['exports'][_0xedec('0x2')],'phonebar':0x2};if(_0x9969eb[_0xedec('0x9')]&&_0x9969eb[_0xedec('0x9')][_0xedec('0xa')]){return git[_0xedec('0xb')]()[_0xedec('0xc')](function(_0x4e3a3f,_0x31f8e9){_0x2fb9e5[_0xedec('0xa')]=(_0x4e3a3f?module['exports'][_0xedec('0x2')]:_0x31f8e9[_0xedec('0xa')])||_0xedec('0xd');return _0x23d8cd[_0xedec('0xe')](0xc8)[_0xedec('0xf')](_0x2fb9e5);});}else{return _0x23d8cd['status'](0xc8)[_0xedec('0xf')](_0x2fb9e5);}};exports[_0xedec('0xb')]=function(_0x16fc20,_0xbe4d47){return git[_0xedec('0xb')]([_0xedec('0x10'),_0xedec('0x11')],function(_0x13c7f4){if(_0x13c7f4){logger['error'](_0x13c7f4);return _0xbe4d47[_0xedec('0xe')](0x1f4)['json'](_0x13c7f4);}logger[_0xedec('0x12')](_0xedec('0x13'));return _0xbe4d47[_0xedec('0xe')](0xc8)[_0xedec('0xf')]({'output':_0xedec('0x14')});});};exports[_0xedec('0x15')]=function(_0x526abb,_0x492024){return git[_0xedec('0x15')]([_0xedec('0x16'),_0xedec('0x17')],function(_0x282a9b){if(_0x282a9b){logger[_0xedec('0x18')](_0x282a9b);return _0x492024[_0xedec('0xe')](0x1f4)['json'](_0x282a9b);}logger[_0xedec('0x12')](_0xedec('0x19'));return _0x492024[_0xedec('0xe')](0xc8)[_0xedec('0xf')]({'output':_0xedec('0x1a')});});};exports['pull']=function(_0x289e51,_0x56b3c0){exec(_0xedec('0x1b'),function(_0x9c7f19,_0x127dc8,_0x5255db){logger['info'](_0x127dc8);logger[_0xedec('0x12')](_0x5255db);if(_0x9c7f19){logger[_0xedec('0x18')](_0x9c7f19);return _0x56b3c0['status'](0x1f4)[_0xedec('0xf')](_0x9c7f19);}return _0x56b3c0[_0xedec('0xe')](0xc8)[_0xedec('0xf')]({'output':_0x127dc8});});};exports[_0xedec('0x1c')]=function(_0x10b9a1,_0x346897){return pm2[_0xedec('0x1c')](_0xedec('0x1d'))[_0xedec('0x1e')](function(_0x4c032b){logger['info'](_0xedec('0x1f'),_0x4c032b);return _0x346897[_0xedec('0xe')](0xc8)[_0xedec('0xf')]({'output':_0xedec('0x20')});})['catch'](function(_0x2fbac8){logger[_0xedec('0x18')](_0x2fbac8);return _0x346897[_0xedec('0xe')](0x1f4)[_0xedec('0xf')](_0x2fbac8);});};exports['migrations']=function(_0x50e450,_0x2a5fde){var _0x42560b=fs[_0xedec('0x21')](path[_0xedec('0x22')](config[_0xedec('0x23')],'server',_0xedec('0x24')));var _0x9110f=[];for(var _0x522267=0x0;_0x522267<_0x42560b[_0xedec('0x25')];_0x522267++){var _0x3382f3=_0x42560b[_0x522267][_0xedec('0x26')](_0xedec('0x27'),'');if(compareVersions(module[_0xedec('0x28')][_0xedec('0x2')],_0x3382f3)===-0x1){_0x9110f['push'](_0x3382f3);}}if(_0x9110f[_0xedec('0x25')]){var _0x3072d6=_0x9110f['sort'](compareVersions);var _0x3bf58d=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xedec('0x29')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xedec('0x2a')]['getQueryInterface'](),db[_0xedec('0x2a')][_0xedec('0x2b')],function(){throw new Error(_0xedec('0x2c'));}],'path':path[_0xedec('0x22')](config[_0xedec('0x23')],_0xedec('0x2d'),_0xedec('0x24')),'pattern':/\.js$/}});_0x3bf58d['up']({'migrations':_[_0xedec('0x2e')](_0x3072d6,function(_0x21085a){return _0x21085a+'.js';})})[_0xedec('0x1e')](function(){return _0x2a5fde['status'](0xc8)[_0xedec('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xedec('0x2')]+'\x20to\x20'+_[_0xedec('0x2f')](_0x3072d6),'migrations':_[_0xedec('0x22')](_0x3072d6)});})[_0xedec('0x30')](function(_0x1fb2b4){if(_0x1fb2b4 instanceof db[_0xedec('0x2a')][_0xedec('0x31')]){return _0x2a5fde['status'](0xc8)[_0xedec('0xf')]({'output':_0xedec('0x32')});}else{return _0x2a5fde[_0xedec('0xe')](0x1f4)[_0xedec('0xf')](_0x1fb2b4);}});}else{return _0x2a5fde[_0xedec('0xe')](0xc8)[_0xedec('0xf')]({'output':_0xedec('0x32')});}}; \ No newline at end of file +var _0x131a=['json','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status'];(function(_0x389822,_0x1ec9fe){var _0xc095c1=function(_0x2646ba){while(--_0x2646ba){_0x389822['push'](_0x389822['shift']());}};_0xc095c1(++_0x1ec9fe);}(_0x131a,0x91));var _0xa131=function(_0x33500b,_0x311471){_0x33500b=_0x33500b-0x0;var _0x49aa24=_0x131a[_0x33500b];return _0x49aa24;};'use strict';var Umzug=require(_0xa131('0x0'));var path=require(_0xa131('0x1'));var fs=require('fs');var _=require(_0xa131('0x2'));var pkginfo=require('pkginfo')(module,_0xa131('0x3'));var compareVersions=require(_0xa131('0x4'));var exec=require(_0xa131('0x5'))[_0xa131('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xa131('0x7'));var pm2=require(_0xa131('0x8'));var logger=require('../../config/logger')(_0xa131('0x9'));var git=require(_0xa131('0xa'))(config[_0xa131('0xb')]);exports[_0xa131('0xc')]=function(_0x3ecd28,_0x27fe5c){var _0x25d245={'current':module[_0xa131('0xd')][_0xa131('0x3')],'phonebar':0x2};if(_0x3ecd28[_0xa131('0xe')]&&_0x3ecd28[_0xa131('0xe')][_0xa131('0xf')]){return git[_0xa131('0x10')]()[_0xa131('0x11')](function(_0x4956df,_0x5067dd){_0x25d245['latest']=(_0x4956df?module['exports'][_0xa131('0x3')]:_0x5067dd[_0xa131('0xf')])||_0xa131('0x12');return _0x27fe5c[_0xa131('0x13')](0xc8)[_0xa131('0x14')](_0x25d245);});}else{return _0x27fe5c[_0xa131('0x13')](0xc8)[_0xa131('0x14')](_0x25d245);}};exports['fetch']=function(_0x1d01e8,_0x4f8075){return git[_0xa131('0x10')](['origin',_0xa131('0x15')],function(_0x887f31){if(_0x887f31){logger[_0xa131('0x16')](_0x887f31);return _0x4f8075[_0xa131('0x13')](0x1f4)['json'](_0x887f31);}logger['info'](_0xa131('0x17'));return _0x4f8075['status'](0xc8)[_0xa131('0x14')]({'output':_0xa131('0x18')});});};exports[_0xa131('0x19')]=function(_0x391db8,_0x431329){return git['reset']([_0xa131('0x1a'),'FETCH_HEAD'],function(_0x2d230a){if(_0x2d230a){logger['error'](_0x2d230a);return _0x431329[_0xa131('0x13')](0x1f4)[_0xa131('0x14')](_0x2d230a);}logger['info'](_0xa131('0x1b'));return _0x431329['status'](0xc8)[_0xa131('0x14')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x177a2d,_0x3fe65f){exec(_0xa131('0x1c'),function(_0x2b67e1,_0x536fa9,_0x19fa32){logger[_0xa131('0x1d')](_0x536fa9);logger['info'](_0x19fa32);if(_0x2b67e1){logger[_0xa131('0x16')](_0x2b67e1);return _0x3fe65f[_0xa131('0x13')](0x1f4)['json'](_0x2b67e1);}return _0x3fe65f['status'](0xc8)[_0xa131('0x14')]({'output':_0x536fa9});});};exports['restart']=function(_0x1f8e36,_0xc9738c){return pm2[_0xa131('0x1e')](_0xa131('0x1f'))[_0xa131('0x20')](function(_0x47dc0d){logger[_0xa131('0x1d')](_0xa131('0x21'),_0x47dc0d);return _0xc9738c[_0xa131('0x13')](0xc8)[_0xa131('0x14')]({'output':_0xa131('0x22')});})[_0xa131('0x23')](function(_0x3646ee){logger[_0xa131('0x16')](_0x3646ee);return _0xc9738c['status'](0x1f4)['json'](_0x3646ee);});};exports['migrations']=function(_0x32d258,_0x3e8b65){var _0x3e38a5=fs[_0xa131('0x24')](path[_0xa131('0x25')](config[_0xa131('0xb')],_0xa131('0x26'),'migrations'));var _0x3eb294=[];for(var _0x52ecf2=0x0;_0x52ecf2<_0x3e38a5[_0xa131('0x27')];_0x52ecf2++){var _0x29b8e4=_0x3e38a5[_0x52ecf2][_0xa131('0x28')]('.js','');if(compareVersions(module['exports'][_0xa131('0x3')],_0x29b8e4)===-0x1){_0x3eb294[_0xa131('0x29')](_0x29b8e4);}}if(_0x3eb294['length']){var _0x39d136=_0x3eb294[_0xa131('0x2a')](compareVersions);var _0x455b27=new Umzug({'storage':_0xa131('0x2b'),'storageOptions':{'model':db[_0xa131('0x2c')],'modelName':_0xa131('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xa131('0x2b')][_0xa131('0x2d')](),db[_0xa131('0x2b')][_0xa131('0x2e')],function(){throw new Error(_0xa131('0x2f'));}],'path':path[_0xa131('0x25')](config['root'],_0xa131('0x26'),_0xa131('0x30')),'pattern':/\.js$/}});_0x455b27['up']({'migrations':_[_0xa131('0x31')](_0x39d136,function(_0xa34193){return _0xa34193+_0xa131('0x32');})})[_0xa131('0x20')](function(){return _0x3e8b65[_0xa131('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xa131('0xd')]['version']+_0xa131('0x33')+_[_0xa131('0x34')](_0x39d136),'migrations':_[_0xa131('0x25')](_0x39d136)});})[_0xa131('0x23')](function(_0xedc3){if(_0xedc3 instanceof db[_0xa131('0x2b')][_0xa131('0x35')]){return _0x3e8b65[_0xa131('0x13')](0xc8)[_0xa131('0x14')]({'output':_0xa131('0x36')});}else{return _0x3e8b65[_0xa131('0x13')](0x1f4)[_0xa131('0x14')](_0xedc3);}});}else{return _0x3e8b65['status'](0xc8)[_0xa131('0x14')]({'output':_0xa131('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ab62052..22435e7 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 _0x400b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x400b,0x15a));var _0xb400=function(_0xcd8c7a,_0x3ef9ea){_0xcd8c7a=_0xcd8c7a-0x0;var _0x58d7a1=_0x400b[_0xcd8c7a];return _0x58d7a1;};'use strict';var multer=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var path=require(_0xb400('0x2'));var timeout=require(_0xb400('0x3'));var express=require(_0xb400('0x4'));var router=express[_0xb400('0x5')]();var fs_extra=require(_0xb400('0x6'));var auth=require(_0xb400('0x7'));var interaction=require(_0xb400('0x8'));var config=require('../../config/environment');var controller=require(_0xb400('0x9'));router[_0xb400('0xa')]('/',auth[_0xb400('0xb')](),controller[_0xb400('0xc')]);router['get'](_0xb400('0xd'),auth[_0xb400('0xb')](),controller[_0xb400('0xe')]);router[_0xb400('0xa')](_0xb400('0xf'),auth['isAuthenticated'](),controller[_0xb400('0x10')]);router[_0xb400('0x11')]('/',auth['isAuthenticated'](),controller[_0xb400('0x12')]);router['put'](_0xb400('0xf'),auth['isAuthenticated'](),controller[_0xb400('0x13')]);router[_0xb400('0x14')](_0xb400('0xf'),auth[_0xb400('0xb')](),controller['destroy']);module[_0xb400('0x15')]=router; \ No newline at end of file +var _0x30a6=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x65f9a9,_0x476219){var _0x3afb57=function(_0x50cf82){while(--_0x50cf82){_0x65f9a9['push'](_0x65f9a9['shift']());}};_0x3afb57(++_0x476219);}(_0x30a6,0xbc));var _0x630a=function(_0x4adc11,_0x183f25){_0x4adc11=_0x4adc11-0x0;var _0x3ffbea=_0x30a6[_0x4adc11];return _0x3ffbea;};'use strict';var multer=require(_0x630a('0x0'));var util=require(_0x630a('0x1'));var path=require(_0x630a('0x2'));var timeout=require(_0x630a('0x3'));var express=require(_0x630a('0x4'));var router=express['Router']();var fs_extra=require(_0x630a('0x5'));var auth=require(_0x630a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x630a('0x7'));var controller=require(_0x630a('0x8'));router[_0x630a('0x9')]('/',auth[_0x630a('0xa')](),controller[_0x630a('0xb')]);router[_0x630a('0x9')](_0x630a('0xc'),auth['isAuthenticated'](),controller[_0x630a('0xd')]);router[_0x630a('0x9')](_0x630a('0xe'),auth[_0x630a('0xa')](),controller[_0x630a('0xf')]);router[_0x630a('0x10')]('/',auth[_0x630a('0xa')](),controller[_0x630a('0x11')]);router[_0x630a('0x12')](_0x630a('0xe'),auth[_0x630a('0xa')](),controller[_0x630a('0x13')]);router['delete'](_0x630a('0xe'),auth['isAuthenticated'](),controller[_0x630a('0x14')]);module[_0x630a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 75c4bdb..d7090f6 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 _0xda2d=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x13146c,_0x2b49fd){var _0x401e88=function(_0x10a605){while(--_0x10a605){_0x13146c['push'](_0x13146c['shift']());}};_0x401e88(++_0x2b49fd);}(_0xda2d,0x102));var _0xdda2=function(_0x4db55c,_0x5928d3){_0x4db55c=_0x4db55c-0x0;var _0x294a02=_0xda2d[_0x4db55c];return _0x294a02;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'type':{'type':Sequelize[_0xdda2('0x1')]},'uniqueid':{'type':Sequelize[_0xdda2('0x1')]},'calleridnum':{'type':Sequelize[_0xdda2('0x1')]},'calleridname':{'type':Sequelize[_0xdda2('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xdda2('0x2')]},'agentconnectAt':{'type':Sequelize[_0xdda2('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xdda2('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xdda2('0x2')]},'agentdumpAt':{'type':Sequelize[_0xdda2('0x2')]},'holdtime':{'type':Sequelize[_0xdda2('0x3')]},'agentcomplete':{'type':Sequelize[_0xdda2('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xdda2('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xdda2('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdda2('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdda2('0x3')]},'reason':{'type':Sequelize[_0xdda2('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdda2('0x1')]},'channelstate':{'type':Sequelize[_0xdda2('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdda2('0x1')]},'connectedlinenum':{'type':Sequelize[_0xdda2('0x1')]},'connectedlinename':{'type':Sequelize[_0xdda2('0x1')]},'language':{'type':Sequelize[_0xdda2('0x1')]},'accountcode':{'type':Sequelize[_0xdda2('0x1')]},'context':{'type':Sequelize[_0xdda2('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdda2('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xdda2('0x1')]},'destcalleridnum':{'type':Sequelize[_0xdda2('0x1')]},'destcalleridname':{'type':Sequelize[_0xdda2('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xdda2('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xdda2('0x1')]},'destlanguage':{'type':Sequelize[_0xdda2('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xdda2('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xdda2('0x1')]},'destuniqueid':{'type':Sequelize[_0xdda2('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdda2('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xdda2('0x1')]},'transfer':{'type':Sequelize[_0xdda2('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xdda2('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1280=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1280,0xac));var _0x0128=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x1280[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x0128('0x0'));module['exports']={'type':{'type':Sequelize[_0x0128('0x1')]},'uniqueid':{'type':Sequelize[_0x0128('0x1')]},'calleridnum':{'type':Sequelize[_0x0128('0x1')]},'calleridname':{'type':Sequelize[_0x0128('0x1')]},'queue':{'type':Sequelize[_0x0128('0x1')]},'interface':{'type':Sequelize[_0x0128('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0128('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0128('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x0128('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x0128('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0128('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0128('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0128('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0128('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0128('0x4')]},'reason':{'type':Sequelize[_0x0128('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0128('0x1')]},'channelstate':{'type':Sequelize[_0x0128('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0128('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0128('0x1')]},'accountcode':{'type':Sequelize[_0x0128('0x1')]},'context':{'type':Sequelize[_0x0128('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0128('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0128('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0128('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0128('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0128('0x1')]},'destaccountcode':{'type':Sequelize[_0x0128('0x1')]},'destcontext':{'type':Sequelize[_0x0128('0x1')]},'destexten':{'type':Sequelize[_0x0128('0x1')]},'destpriority':{'type':Sequelize[_0x0128('0x1')]},'destuniqueid':{'type':Sequelize[_0x0128('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x0128('0x1')]},'transfer':{'type':Sequelize[_0x0128('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0128('0x1')],'comment':_0x0128('0x5')},'transferexten':{'type':Sequelize[_0x0128('0x1')]},'transferuniqueid':{'type':Sequelize[_0x0128('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 6e1393f..9822f3a 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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 99be7a6..ccfae49 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 _0x861c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x167d8c,_0x4fac6b){var _0x427618=function(_0x552724){while(--_0x552724){_0x167d8c['push'](_0x167d8c['shift']());}};_0x427618(++_0x4fac6b);}(_0x861c,0xdb));var _0xc861=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x861c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var logger=require(_0xc861('0x2'))(_0xc861('0x3'));var moment=require(_0xc861('0x4'));var BPromise=require(_0xc861('0x5'));var rp=require(_0xc861('0x6'));var fs=require('fs');var path=require(_0xc861('0x7'));var rimraf=require(_0xc861('0x8'));var config=require(_0xc861('0x9'));var attributes=require(_0xc861('0xa'));module[_0xc861('0xb')]=function(_0x562f12,_0xc3b5fd){return _0x562f12[_0xc861('0xc')](_0xc861('0xd'),attributes,{'tableName':_0xc861('0xe'),'paranoid':![],'indexes':[{'fields':[_0xc861('0xf'),_0xc861('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e17=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2c2bd7,_0x47b411){var _0x5946c9=function(_0x2401e2){while(--_0x2401e2){_0x2c2bd7['push'](_0x2c2bd7['shift']());}};_0x5946c9(++_0x47b411);}(_0x0e17,0xd6));var _0x70e1=function(_0xb29a48,_0x5aa4cc){_0xb29a48=_0xb29a48-0x0;var _0xe53ab0=_0x0e17[_0xb29a48];return _0xe53ab0;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var logger=require(_0x70e1('0x2'))(_0x70e1('0x3'));var moment=require(_0x70e1('0x4'));var BPromise=require(_0x70e1('0x5'));var rp=require(_0x70e1('0x6'));var fs=require('fs');var path=require(_0x70e1('0x7'));var rimraf=require(_0x70e1('0x8'));var config=require(_0x70e1('0x9'));var attributes=require(_0x70e1('0xa'));module[_0x70e1('0xb')]=function(_0x4cb0b1,_0xc64213){return _0x4cb0b1[_0x70e1('0xc')](_0x70e1('0xd'),attributes,{'tableName':_0x70e1('0xe'),'paranoid':![],'indexes':[{'fields':[_0x70e1('0xf'),_0x70e1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9084238..4858428 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 _0xf1fa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','update','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird'];(function(_0x3c121a,_0x128f23){var _0x1108b5=function(_0x1ca55e){while(--_0x1ca55e){_0x3c121a['push'](_0x3c121a['shift']());}};_0x1108b5(++_0x128f23);}(_0xf1fa,0xa7));var _0xaf1f=function(_0x1a2063,_0x28b76c){_0x1a2063=_0x1a2063-0x0;var _0x478854=_0xf1fa[_0x1a2063];return _0x478854;};'use strict';var _=require('lodash');var util=require(_0xaf1f('0x0'));var moment=require(_0xaf1f('0x1'));var BPromise=require(_0xaf1f('0x2'));var rs=require(_0xaf1f('0x3'));var fs=require('fs');var Redis=require(_0xaf1f('0x4'));var db=require(_0xaf1f('0x5'))['db'];var utils=require(_0xaf1f('0x6'));var logger=require(_0xaf1f('0x7'))('rpc');var config=require(_0xaf1f('0x8'));var jayson=require(_0xaf1f('0x9'));var client=jayson[_0xaf1f('0xa')][_0xaf1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f834,_0x586ae7,_0x2b918b){return new BPromise(function(_0x2b125c,_0xa1c0a8){return client['request'](_0x36f834,_0x2b918b)['then'](function(_0x387f1b){logger[_0xaf1f('0xc')](_0xaf1f('0xd'),_0x586ae7,_0xaf1f('0xe'));logger[_0xaf1f('0xf')](_0xaf1f('0x10'),_0x586ae7,_0xaf1f('0xe'),JSON[_0xaf1f('0x11')](_0x387f1b));if(_0x387f1b[_0xaf1f('0x12')]){if(_0x387f1b[_0xaf1f('0x12')][_0xaf1f('0x13')]===0x1f4){logger[_0xaf1f('0x12')](_0xaf1f('0xd'),_0x586ae7,_0x387f1b[_0xaf1f('0x12')][_0xaf1f('0x14')]);return _0xa1c0a8(_0x387f1b[_0xaf1f('0x12')][_0xaf1f('0x14')]);}logger[_0xaf1f('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x586ae7,_0x387f1b[_0xaf1f('0x12')][_0xaf1f('0x14')]);return _0x2b125c(_0x387f1b[_0xaf1f('0x12')][_0xaf1f('0x14')]);}else{logger[_0xaf1f('0xc')](_0xaf1f('0xd'),_0x586ae7,_0xaf1f('0xe'));_0x2b125c(_0x387f1b[_0xaf1f('0x15')][_0xaf1f('0x14')]);}})[_0xaf1f('0x16')](function(_0x5d8c9a){logger['error'](_0xaf1f('0xd'),_0x586ae7,_0x5d8c9a);_0xa1c0a8(_0x5d8c9a);});});}exports[_0xaf1f('0x17')]=function(_0x4596d9){var _0xcd3f9d=this;return new Promise(function(_0x48873f,_0x3f44c3){return db[_0xaf1f('0x18')][_0xaf1f('0x19')](_0x4596d9[_0xaf1f('0x1a')],{'raw':_0x4596d9[_0xaf1f('0x1b')]?_0x4596d9['options'][_0xaf1f('0x1c')]===undefined?!![]:![]:!![]})[_0xaf1f('0x1d')](function(_0x404666){logger['info'](_0xaf1f('0x17'),_0x4596d9);logger['debug'](_0xaf1f('0x17'),_0x4596d9,JSON['stringify'](_0x404666));_0x48873f(_0x404666);})[_0xaf1f('0x16')](function(_0x2f1ded){logger[_0xaf1f('0x12')](_0xaf1f('0x17'),_0x2f1ded[_0xaf1f('0x14')],_0x4596d9);_0x3f44c3(_0xcd3f9d['error'](0x1f4,_0x2f1ded[_0xaf1f('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x34f00){var _0x1663cf=this;return new Promise(function(_0x3330db,_0xc8658e){return db[_0xaf1f('0x18')][_0xaf1f('0x1e')](_0x34f00['body'],{'raw':_0x34f00[_0xaf1f('0x1b')]?_0x34f00[_0xaf1f('0x1b')][_0xaf1f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f00['options']?_0x34f00[_0xaf1f('0x1b')]['where']||null:null,'attributes':_0x34f00[_0xaf1f('0x1b')]?_0x34f00[_0xaf1f('0x1b')][_0xaf1f('0x1f')]||null:null,'limit':_0x34f00['options']?_0x34f00[_0xaf1f('0x1b')][_0xaf1f('0x20')]||null:null})[_0xaf1f('0x1d')](function(_0x96def7){logger[_0xaf1f('0xc')](_0xaf1f('0x21'),_0x34f00);logger[_0xaf1f('0xf')](_0xaf1f('0x21'),_0x34f00,JSON[_0xaf1f('0x11')](_0x96def7));_0x3330db(_0x96def7);})[_0xaf1f('0x16')](function(_0x5c1c90){logger[_0xaf1f('0x12')](_0xaf1f('0x21'),_0x5c1c90[_0xaf1f('0x14')],_0x34f00);_0xc8658e(_0x1663cf[_0xaf1f('0x12')](0x1f4,_0x5c1c90[_0xaf1f('0x14')]));});});}; \ No newline at end of file +var _0x21f0=['result','VoiceAgentReport','body','options','CreateVoiceAgentReport','catch','raw','attributes','limit','UpdateVoiceAgentReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3cf8a2,_0x274643){var _0xed3b07=function(_0x29b517){while(--_0x29b517){_0x3cf8a2['push'](_0x3cf8a2['shift']());}};_0xed3b07(++_0x274643);}(_0x21f0,0x1da));var _0x021f=function(_0x7287a3,_0x12dd92){_0x7287a3=_0x7287a3-0x0;var _0xc22b00=_0x21f0[_0x7287a3];return _0xc22b00;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x021f('0x0'));var rs=require(_0x021f('0x1'));var fs=require('fs');var Redis=require(_0x021f('0x2'));var db=require(_0x021f('0x3'))['db'];var utils=require(_0x021f('0x4'));var logger=require(_0x021f('0x5'))('rpc');var config=require(_0x021f('0x6'));var jayson=require(_0x021f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3984a1,_0x160977,_0x23287d){return new BPromise(function(_0x230457,_0x4f4b34){return client[_0x021f('0x8')](_0x3984a1,_0x23287d)[_0x021f('0x9')](function(_0x3304b5){logger['info'](_0x021f('0xa'),_0x160977,_0x021f('0xb'));logger[_0x021f('0xc')](_0x021f('0xd'),_0x160977,_0x021f('0xb'),JSON[_0x021f('0xe')](_0x3304b5));if(_0x3304b5['error']){if(_0x3304b5[_0x021f('0xf')][_0x021f('0x10')]===0x1f4){logger[_0x021f('0xf')](_0x021f('0xa'),_0x160977,_0x3304b5['error'][_0x021f('0x11')]);return _0x4f4b34(_0x3304b5[_0x021f('0xf')][_0x021f('0x11')]);}logger[_0x021f('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x160977,_0x3304b5['error'][_0x021f('0x11')]);return _0x230457(_0x3304b5[_0x021f('0xf')][_0x021f('0x11')]);}else{logger[_0x021f('0x12')](_0x021f('0xa'),_0x160977,'request\x20sent');_0x230457(_0x3304b5[_0x021f('0x13')]['message']);}})['catch'](function(_0x5749c4){logger['error'](_0x021f('0xa'),_0x160977,_0x5749c4);_0x4f4b34(_0x5749c4);});});}exports['CreateVoiceAgentReport']=function(_0x39d9b7){var _0x419b63=this;return new Promise(function(_0x1b5084,_0x1af63d){return db[_0x021f('0x14')]['create'](_0x39d9b7[_0x021f('0x15')],{'raw':_0x39d9b7[_0x021f('0x16')]?_0x39d9b7[_0x021f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x021f('0x9')](function(_0xfa22ab){logger[_0x021f('0x12')]('CreateVoiceAgentReport',_0x39d9b7);logger[_0x021f('0xc')](_0x021f('0x17'),_0x39d9b7,JSON['stringify'](_0xfa22ab));_0x1b5084(_0xfa22ab);})[_0x021f('0x18')](function(_0x4e6e8a){logger[_0x021f('0xf')](_0x021f('0x17'),_0x4e6e8a[_0x021f('0x11')],_0x39d9b7);_0x1af63d(_0x419b63[_0x021f('0xf')](0x1f4,_0x4e6e8a[_0x021f('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x462dcc){var _0x430307=this;return new Promise(function(_0x1d069a,_0x2fc2f0){return db[_0x021f('0x14')]['update'](_0x462dcc[_0x021f('0x15')],{'raw':_0x462dcc[_0x021f('0x16')]?_0x462dcc[_0x021f('0x16')][_0x021f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x462dcc[_0x021f('0x16')]?_0x462dcc[_0x021f('0x16')]['where']||null:null,'attributes':_0x462dcc['options']?_0x462dcc[_0x021f('0x16')][_0x021f('0x1a')]||null:null,'limit':_0x462dcc[_0x021f('0x16')]?_0x462dcc[_0x021f('0x16')][_0x021f('0x1b')]||null:null})[_0x021f('0x9')](function(_0x222028){logger[_0x021f('0x12')](_0x021f('0x1c'),_0x462dcc);logger[_0x021f('0xc')](_0x021f('0x1c'),_0x462dcc,JSON[_0x021f('0xe')](_0x222028));_0x1d069a(_0x222028);})['catch'](function(_0x45e200){logger[_0x021f('0xf')](_0x021f('0x1c'),_0x45e200[_0x021f('0x11')],_0x462dcc);_0x2fc2f0(_0x430307[_0x021f('0xf')](0x1f4,_0x45e200['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 54d0a45..486f466 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 _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x35ed15,_0x4256f9){var _0x5e9001=function(_0x4570ef){while(--_0x4570ef){_0x35ed15['push'](_0x35ed15['shift']());}};_0x5e9001(++_0x4256f9);}(_0x5178,0x171));var _0x8517=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5178[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2d17=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2d17,0x17e));var _0x72d1=function(_0x838721,_0x908b6f){_0x838721=_0x838721-0x0;var _0x5ec0b9=_0x2d17[_0x838721];return _0x5ec0b9;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./voiceCallReport.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xe')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x12')]);module[_0x72d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0969ca3..a19b4cf 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 _0x68ee=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x68ee,0xd3));var _0xe68e=function(_0x132282,_0x463665){_0x132282=_0x132282-0x0;var _0x4cc233=_0x68ee[_0x132282];return _0x4cc233;};'use strict';var Sequelize=require(_0xe68e('0x0'));module[_0xe68e('0x1')]={'uniqueid':{'type':Sequelize[_0xe68e('0x2')]},'type':{'type':Sequelize[_0xe68e('0x3')](_0xe68e('0x4'),_0xe68e('0x5'),_0xe68e('0x6'),_0xe68e('0x7'),'outbound-fax',_0xe68e('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe68e('0x2')]},'source':{'type':Sequelize[_0xe68e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xe68e('0x2')]},'callerid':{'type':Sequelize[_0xe68e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xe68e('0x2')]},'lastapplication':{'type':Sequelize[_0xe68e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe68e('0x9')]},'systemanswertime':{'type':Sequelize[_0xe68e('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe68e('0x9')]},'duration':{'type':Sequelize[_0xe68e('0xa')]},'billableseconds':{'type':Sequelize[_0xe68e('0xa')]},'mohtime':{'type':Sequelize[_0xe68e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe68e('0x2')]},'amaflags':{'type':Sequelize[_0xe68e('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xe68e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe68e('0x2')]},'note':{'type':Sequelize[_0xe68e('0x2')]},'prefix':{'type':Sequelize[_0xe68e('0x2')]},'routeid':{'type':Sequelize[_0xe68e('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35d2=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer'];(function(_0x2cc915,_0x285475){var _0x53eaa9=function(_0x5ec657){while(--_0x5ec657){_0x2cc915['push'](_0x2cc915['shift']());}};_0x53eaa9(++_0x285475);}(_0x35d2,0xd4));var _0x235d=function(_0x4c09c9,_0x4ea03b){_0x4c09c9=_0x4c09c9-0x0;var _0x4aabff=_0x35d2[_0x4c09c9];return _0x4aabff;};'use strict';var Sequelize=require(_0x235d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x235d('0x1')]},'type':{'type':Sequelize[_0x235d('0x2')](_0x235d('0x3'),_0x235d('0x4'),'outbound',_0x235d('0x5'),_0x235d('0x6'),_0x235d('0x7'))},'tag':{'type':Sequelize[_0x235d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x235d('0x1')]},'destination':{'type':Sequelize[_0x235d('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x235d('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x235d('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x235d('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x235d('0x9')]},'answertime':{'type':Sequelize[_0x235d('0x9')]},'endtime':{'type':Sequelize[_0x235d('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x235d('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x235d('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x235d('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x235d('0x1')]},'note':{'type':Sequelize[_0x235d('0x1')]},'prefix':{'type':Sequelize[_0x235d('0x1')]},'routeid':{'type':Sequelize[_0x235d('0xa')]},'sipcallid':{'type':Sequelize[_0x235d('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 16a63eb..e13187f 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x2ef3,0xba));var _0x32ef=function(_0x2dff3f,_0x56419f){_0x2dff3f=_0x2dff3f-0x0;var _0x474093=_0x2ef3[_0x2dff3f];return _0x474093;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2ef3,0xba));var _0x32ef=function(_0x27f278,_0x33cb8d){_0x27f278=_0x27f278-0x0;var _0x5007c4=_0x2ef3[_0x27f278];return _0x5007c4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 2094eb7..c05d3d0 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 _0x6611=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x19e6dd,_0x1f7da6){var _0x494352=function(_0x1a6c35){while(--_0x1a6c35){_0x19e6dd['push'](_0x19e6dd['shift']());}};_0x494352(++_0x1f7da6);}(_0x6611,0xdd));var _0x1661=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6611[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1661('0x0'));var logger=require(_0x1661('0x1'))(_0x1661('0x2'));var moment=require(_0x1661('0x3'));var BPromise=require(_0x1661('0x4'));var rp=require(_0x1661('0x5'));var fs=require('fs');var path=require(_0x1661('0x6'));var rimraf=require(_0x1661('0x7'));var config=require(_0x1661('0x8'));var attributes=require(_0x1661('0x9'));module[_0x1661('0xa')]=function(_0x1e5dab,_0x58781d){return _0x1e5dab['define'](_0x1661('0xb'),attributes,{'tableName':_0x1661('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x45eb=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x198013,_0x251bc9){var _0xdde9a=function(_0x13ddb8){while(--_0x13ddb8){_0x198013['push'](_0x198013['shift']());}};_0xdde9a(++_0x251bc9);}(_0x45eb,0xc4));var _0xb45e=function(_0x3bfe06,_0x2a3b39){_0x3bfe06=_0x3bfe06-0x0;var _0x33228b=_0x45eb[_0x3bfe06];return _0x33228b;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var logger=require(_0xb45e('0x2'))(_0xb45e('0x3'));var moment=require(_0xb45e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb45e('0x5'));var fs=require('fs');var path=require(_0xb45e('0x6'));var rimraf=require(_0xb45e('0x7'));var config=require(_0xb45e('0x8'));var attributes=require(_0xb45e('0x9'));module[_0xb45e('0xa')]=function(_0x2dfa3e,_0xab2812){return _0x2dfa3e[_0xb45e('0xb')](_0xb45e('0xc'),attributes,{'tableName':_0xb45e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xb45e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9a84aaf..0e9c733 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 _0xbc5c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','options','raw','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','then','stringify','UpdateVoiceCallReport','body','where','bluebird'];(function(_0x41e3ae,_0x1fa1fc){var _0x31c1d2=function(_0x44eda4){while(--_0x44eda4){_0x41e3ae['push'](_0x41e3ae['shift']());}};_0x31c1d2(++_0x1fa1fc);}(_0xbc5c,0x93));var _0xcbc5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbc5c[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcbc5('0x0'));var rs=require(_0xcbc5('0x1'));var fs=require('fs');var Redis=require(_0xcbc5('0x2'));var db=require(_0xcbc5('0x3'))['db'];var utils=require(_0xcbc5('0x4'));var logger=require(_0xcbc5('0x5'))(_0xcbc5('0x6'));var config=require(_0xcbc5('0x7'));var jayson=require(_0xcbc5('0x8'));var client=jayson[_0xcbc5('0x9')][_0xcbc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28438c,_0x255197,_0x2b0c0f){return new BPromise(function(_0x38c695,_0x26ee90){return client[_0xcbc5('0xb')](_0x28438c,_0x2b0c0f)['then'](function(_0x43c997){logger[_0xcbc5('0xc')](_0xcbc5('0xd'),_0x255197,_0xcbc5('0xe'));logger[_0xcbc5('0xf')](_0xcbc5('0x10'),_0x255197,'request\x20sent',JSON['stringify'](_0x43c997));if(_0x43c997['error']){if(_0x43c997[_0xcbc5('0x11')]['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x255197,_0x43c997[_0xcbc5('0x11')]['message']);return _0x26ee90(_0x43c997[_0xcbc5('0x11')]['message']);}logger[_0xcbc5('0x11')](_0xcbc5('0xd'),_0x255197,_0x43c997['error'][_0xcbc5('0x12')]);return _0x38c695(_0x43c997[_0xcbc5('0x11')][_0xcbc5('0x12')]);}else{logger[_0xcbc5('0xc')](_0xcbc5('0xd'),_0x255197,_0xcbc5('0xe'));_0x38c695(_0x43c997[_0xcbc5('0x13')][_0xcbc5('0x12')]);}})[_0xcbc5('0x14')](function(_0x13cbdc){logger[_0xcbc5('0x11')](_0xcbc5('0xd'),_0x255197,_0x13cbdc);_0x26ee90(_0x13cbdc);});});}exports['GetVoiceCallReport']=function(_0x552e6c){var _0x35f0ae=this;return new Promise(function(_0x2db21a,_0x5894b9){return db['VoiceCallReport']['findAll']({'raw':_0x552e6c[_0xcbc5('0x15')]?_0x552e6c[_0xcbc5('0x15')][_0xcbc5('0x16')]===undefined?!![]:![]:!![],'where':_0x552e6c[_0xcbc5('0x15')]?_0x552e6c[_0xcbc5('0x15')]['where']||null:null,'attributes':_0x552e6c[_0xcbc5('0x15')]?_0x552e6c[_0xcbc5('0x15')][_0xcbc5('0x17')]||null:null,'limit':_0x552e6c[_0xcbc5('0x15')]?_0x552e6c['options'][_0xcbc5('0x18')]||null:null,'include':_0x552e6c[_0xcbc5('0x15')]?_0x552e6c[_0xcbc5('0x15')][_0xcbc5('0x19')]?_[_0xcbc5('0x1a')](_0x552e6c['options'][_0xcbc5('0x19')],function(_0x3de7ac){return{'model':db[_0x3de7ac['model']],'as':_0x3de7ac['as'],'attributes':_0x3de7ac['attributes'],'include':_0x3de7ac[_0xcbc5('0x19')]?_[_0xcbc5('0x1a')](_0x3de7ac[_0xcbc5('0x19')],function(_0x58ed1e){return{'model':db[_0x58ed1e[_0xcbc5('0x1b')]],'as':_0x58ed1e['as'],'attributes':_0x58ed1e[_0xcbc5('0x17')],'include':_0x58ed1e[_0xcbc5('0x19')]?_['map'](_0x58ed1e[_0xcbc5('0x19')],function(_0x341576){return{'model':db[_0x341576[_0xcbc5('0x1b')]],'as':_0x341576['as'],'attributes':_0x341576[_0xcbc5('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x116780){logger[_0xcbc5('0xc')](_0xcbc5('0x1c'),_0x552e6c);logger['debug']('GetVoiceCallReport',_0x552e6c,JSON['stringify'](_0x116780));_0x2db21a(_0x116780);})[_0xcbc5('0x14')](function(_0x15f8d2){logger[_0xcbc5('0x11')](_0xcbc5('0x1c'),_0x15f8d2[_0xcbc5('0x12')],_0x552e6c);_0x5894b9(_0x35f0ae['error'](0x1f4,_0x15f8d2[_0xcbc5('0x12')]));});});};exports[_0xcbc5('0x1d')]=function(_0x4c9dcb){var _0x501c8d=this;return new Promise(function(_0x2400d0,_0x3e4eea){return db[_0xcbc5('0x1e')][_0xcbc5('0x1f')](_0x4c9dcb['body'],{'raw':_0x4c9dcb['options']?_0x4c9dcb['options']['raw']===undefined?!![]:![]:!![]})[_0xcbc5('0x20')](function(_0x5964dc){logger[_0xcbc5('0xc')](_0xcbc5('0x1d'),_0x4c9dcb);logger[_0xcbc5('0xf')]('CreateVoiceCallReport',_0x4c9dcb,JSON[_0xcbc5('0x21')](_0x5964dc));_0x2400d0(_0x5964dc);})[_0xcbc5('0x14')](function(_0xd5f646){logger[_0xcbc5('0x11')](_0xcbc5('0x1d'),_0xd5f646['message'],_0x4c9dcb);_0x3e4eea(_0x501c8d[_0xcbc5('0x11')](0x1f4,_0xd5f646['message']));});});};exports[_0xcbc5('0x22')]=function(_0xaa5e75){var _0x3a310a=this;return new Promise(function(_0x31a387,_0x236b62){return db[_0xcbc5('0x1e')]['update'](_0xaa5e75[_0xcbc5('0x23')],{'raw':_0xaa5e75[_0xcbc5('0x15')]?_0xaa5e75[_0xcbc5('0x15')][_0xcbc5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa5e75[_0xcbc5('0x15')]?_0xaa5e75['options'][_0xcbc5('0x24')]||null:null,'attributes':_0xaa5e75[_0xcbc5('0x15')]?_0xaa5e75[_0xcbc5('0x15')][_0xcbc5('0x17')]||null:null,'limit':_0xaa5e75[_0xcbc5('0x15')]?_0xaa5e75[_0xcbc5('0x15')][_0xcbc5('0x18')]||null:null})[_0xcbc5('0x20')](function(_0x189227){logger[_0xcbc5('0xc')](_0xcbc5('0x22'),_0xaa5e75);logger[_0xcbc5('0xf')](_0xcbc5('0x22'),_0xaa5e75,JSON[_0xcbc5('0x21')](_0x189227));_0x31a387(_0x189227);})[_0xcbc5('0x14')](function(_0x3d7b6b){logger[_0xcbc5('0x11')](_0xcbc5('0x22'),_0x3d7b6b[_0xcbc5('0x12')],_0xaa5e75);_0x236b62(_0x3a310a['error'](0x1f4,_0x3d7b6b['message']));});});}; \ No newline at end of file +var _0x1022=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x55882e,_0xbb0f49){var _0x2f5f33=function(_0x4e9fd7){while(--_0x4e9fd7){_0x55882e['push'](_0x55882e['shift']());}};_0x2f5f33(++_0xbb0f49);}(_0x1022,0xfd));var _0x2102=function(_0x4a5d53,_0x49c54c){_0x4a5d53=_0x4a5d53-0x0;var _0x528677=_0x1022[_0x4a5d53];return _0x528677;};'use strict';var _=require(_0x2102('0x0'));var util=require(_0x2102('0x1'));var moment=require('moment');var BPromise=require(_0x2102('0x2'));var rs=require(_0x2102('0x3'));var fs=require('fs');var Redis=require(_0x2102('0x4'));var db=require(_0x2102('0x5'))['db'];var utils=require(_0x2102('0x6'));var logger=require(_0x2102('0x7'))(_0x2102('0x8'));var config=require('../../config/environment');var jayson=require(_0x2102('0x9'));var client=jayson[_0x2102('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1927ed,_0x2cb660,_0x2c57b5){return new BPromise(function(_0xff4f74,_0x5409c3){return client[_0x2102('0xb')](_0x1927ed,_0x2c57b5)[_0x2102('0xc')](function(_0x880aa){logger[_0x2102('0xd')](_0x2102('0xe'),_0x2cb660,_0x2102('0xf'));logger[_0x2102('0x10')](_0x2102('0x11'),_0x2cb660,_0x2102('0xf'),JSON[_0x2102('0x12')](_0x880aa));if(_0x880aa[_0x2102('0x13')]){if(_0x880aa['error']['code']===0x1f4){logger['error'](_0x2102('0xe'),_0x2cb660,_0x880aa[_0x2102('0x13')][_0x2102('0x14')]);return _0x5409c3(_0x880aa[_0x2102('0x13')][_0x2102('0x14')]);}logger[_0x2102('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x2cb660,_0x880aa[_0x2102('0x13')][_0x2102('0x14')]);return _0xff4f74(_0x880aa[_0x2102('0x13')][_0x2102('0x14')]);}else{logger[_0x2102('0xd')](_0x2102('0xe'),_0x2cb660,_0x2102('0xf'));_0xff4f74(_0x880aa['result'][_0x2102('0x14')]);}})[_0x2102('0x15')](function(_0x38d455){logger['error'](_0x2102('0xe'),_0x2cb660,_0x38d455);_0x5409c3(_0x38d455);});});}exports[_0x2102('0x16')]=function(_0x2c7e24){var _0x446760=this;return new Promise(function(_0x117ba9,_0x21d614){return db[_0x2102('0x17')]['findAll']({'raw':_0x2c7e24[_0x2102('0x18')]?_0x2c7e24['options'][_0x2102('0x19')]===undefined?!![]:![]:!![],'where':_0x2c7e24[_0x2102('0x18')]?_0x2c7e24[_0x2102('0x18')][_0x2102('0x1a')]||null:null,'attributes':_0x2c7e24['options']?_0x2c7e24[_0x2102('0x18')][_0x2102('0x1b')]||null:null,'limit':_0x2c7e24[_0x2102('0x18')]?_0x2c7e24[_0x2102('0x18')][_0x2102('0x1c')]||null:null,'include':_0x2c7e24[_0x2102('0x18')]?_0x2c7e24[_0x2102('0x18')]['include']?_[_0x2102('0x1d')](_0x2c7e24[_0x2102('0x18')][_0x2102('0x1e')],function(_0x569e0b){return{'model':db[_0x569e0b['model']],'as':_0x569e0b['as'],'attributes':_0x569e0b[_0x2102('0x1b')],'include':_0x569e0b[_0x2102('0x1e')]?_[_0x2102('0x1d')](_0x569e0b[_0x2102('0x1e')],function(_0x9f8d4b){return{'model':db[_0x9f8d4b[_0x2102('0x1f')]],'as':_0x9f8d4b['as'],'attributes':_0x9f8d4b[_0x2102('0x1b')],'include':_0x9f8d4b[_0x2102('0x1e')]?_[_0x2102('0x1d')](_0x9f8d4b[_0x2102('0x1e')],function(_0x56496d){return{'model':db[_0x56496d[_0x2102('0x1f')]],'as':_0x56496d['as'],'attributes':_0x56496d[_0x2102('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2102('0xc')](function(_0x2f93db){logger['info'](_0x2102('0x16'),_0x2c7e24);logger[_0x2102('0x10')](_0x2102('0x16'),_0x2c7e24,JSON[_0x2102('0x12')](_0x2f93db));_0x117ba9(_0x2f93db);})['catch'](function(_0x52e0b9){logger['error'](_0x2102('0x16'),_0x52e0b9[_0x2102('0x14')],_0x2c7e24);_0x21d614(_0x446760[_0x2102('0x13')](0x1f4,_0x52e0b9[_0x2102('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x2c713e){var _0x74521c=this;return new Promise(function(_0x29cdb4,_0x57b628){return db[_0x2102('0x17')][_0x2102('0x20')](_0x2c713e['body'],{'raw':_0x2c713e['options']?_0x2c713e[_0x2102('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2102('0xc')](function(_0x4ee236){logger[_0x2102('0xd')]('CreateVoiceCallReport',_0x2c713e);logger[_0x2102('0x10')](_0x2102('0x21'),_0x2c713e,JSON[_0x2102('0x12')](_0x4ee236));_0x29cdb4(_0x4ee236);})[_0x2102('0x15')](function(_0xfe2000){logger[_0x2102('0x13')](_0x2102('0x21'),_0xfe2000[_0x2102('0x14')],_0x2c713e);_0x57b628(_0x74521c[_0x2102('0x13')](0x1f4,_0xfe2000[_0x2102('0x14')]));});});};exports[_0x2102('0x22')]=function(_0x50999c){var _0x1ab060=this;return new Promise(function(_0x25d4f4,_0x44f9ac){return db[_0x2102('0x17')][_0x2102('0x23')](_0x50999c[_0x2102('0x24')],{'raw':_0x50999c[_0x2102('0x18')]?_0x50999c['options'][_0x2102('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50999c[_0x2102('0x18')]?_0x50999c[_0x2102('0x18')][_0x2102('0x1a')]||null:null,'attributes':_0x50999c[_0x2102('0x18')]?_0x50999c[_0x2102('0x18')]['attributes']||null:null,'limit':_0x50999c[_0x2102('0x18')]?_0x50999c[_0x2102('0x18')]['limit']||null:null})[_0x2102('0xc')](function(_0x216999){logger[_0x2102('0xd')](_0x2102('0x22'),_0x50999c);logger[_0x2102('0x10')]('UpdateVoiceCallReport',_0x50999c,JSON['stringify'](_0x216999));_0x25d4f4(_0x216999);})[_0x2102('0x15')](function(_0x5aef2b){logger['error'](_0x2102('0x22'),_0x5aef2b[_0x2102('0x14')],_0x50999c);_0x44f9ac(_0x1ab060[_0x2102('0x13')](0x1f4,_0x5aef2b[_0x2102('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1a68d4b..475785f 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 _0xa35f=['exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x174c66,_0x119100){var _0x447e3a=function(_0xbe3feb){while(--_0xbe3feb){_0x174c66['push'](_0x174c66['shift']());}};_0x447e3a(++_0x119100);}(_0xa35f,0xa3));var _0xfa35=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0xa35f[_0x562faa];return _0xc70f59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa35('0x0'));var timeout=require('connect-timeout');var express=require(_0xfa35('0x1'));var router=express[_0xfa35('0x2')]();var fs_extra=require(_0xfa35('0x3'));var auth=require(_0xfa35('0x4'));var interaction=require(_0xfa35('0x5'));var config=require(_0xfa35('0x6'));var controller=require(_0xfa35('0x7'));router[_0xfa35('0x8')]('/',auth[_0xfa35('0x9')](),controller[_0xfa35('0xa')]);router[_0xfa35('0x8')](_0xfa35('0xb'),auth[_0xfa35('0x9')](),controller['show']);router[_0xfa35('0xc')]('/',auth[_0xfa35('0x9')](),controller[_0xfa35('0xd')]);router[_0xfa35('0xe')](_0xfa35('0xb'),auth[_0xfa35('0x9')](),controller[_0xfa35('0xf')]);router[_0xfa35('0x10')](_0xfa35('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa35('0x11')]=router; \ No newline at end of file +var _0xb09e=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete'];(function(_0x2fd78f,_0x35d522){var _0x242719=function(_0x4167bd){while(--_0x4167bd){_0x2fd78f['push'](_0x2fd78f['shift']());}};_0x242719(++_0x35d522);}(_0xb09e,0xf9));var _0xeb09=function(_0x1ccf4f,_0x18ce33){_0x1ccf4f=_0x1ccf4f-0x0;var _0x3f747c=_0xb09e[_0x1ccf4f];return _0x3f747c;};'use strict';var multer=require(_0xeb09('0x0'));var util=require(_0xeb09('0x1'));var path=require(_0xeb09('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb09('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeb09('0x4'));var interaction=require(_0xeb09('0x5'));var config=require(_0xeb09('0x6'));var controller=require(_0xeb09('0x7'));router['get']('/',auth[_0xeb09('0x8')](),controller[_0xeb09('0x9')]);router[_0xeb09('0xa')](_0xeb09('0xb'),auth['isAuthenticated'](),controller[_0xeb09('0xc')]);router[_0xeb09('0xd')]('/',auth[_0xeb09('0x8')](),controller[_0xeb09('0xe')]);router['put'](_0xeb09('0xb'),auth['isAuthenticated'](),controller[_0xeb09('0xf')]);router[_0xeb09('0x10')]('/:id',auth[_0xeb09('0x8')](),controller[_0xeb09('0x11')]);module[_0xeb09('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5bc3a47..5887b19 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 _0xd6e0=['name','setDataValue','options','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x1efb37,_0x36569f){var _0x154cb0=function(_0x575ea4){while(--_0x575ea4){_0x1efb37['push'](_0x1efb37['shift']());}};_0x154cb0(++_0x36569f);}(_0xd6e0,0x19d));var _0x0d6e=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xd6e0[_0x34232c];return _0x4d4f4e;};'use strict';var Sequelize=require(_0x0d6e('0x0'));module[_0x0d6e('0x1')]={'name':{'type':Sequelize[_0x0d6e('0x2')]},'prefix':{'type':Sequelize[_0x0d6e('0x2')],'unique':_0x0d6e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0d6e('0x2')],'set':function(_0x53d638){this[_0x0d6e('0x4')](_0x0d6e('0x5'),_0x53d638?_0x53d638['join'](''):[]);},'get':function(){return this[_0x0d6e('0x6')](_0x0d6e('0x5'))?this[_0x0d6e('0x6')](_0x0d6e('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x0d6e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0d6e('0x2')]},'record':{'type':Sequelize[_0x0d6e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d6e('0x2')]}}; \ No newline at end of file +var _0x323a=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x546d17,_0x5141a0){var _0x1b3bdf=function(_0x52df26){while(--_0x52df26){_0x546d17['push'](_0x546d17['shift']());}};_0x1b3bdf(++_0x5141a0);}(_0x323a,0xf7));var _0xa323=function(_0x26afef,_0x1acfa8){_0x26afef=_0x26afef-0x0;var _0x2d158b=_0x323a[_0x26afef];return _0x2d158b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xa323('0x0')],'unique':_0xa323('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xa323('0x0')],'set':function(_0x3858ba){this[_0xa323('0x2')](_0xa323('0x3'),_0x3858ba?_0x3858ba[_0xa323('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xa323('0x5')](_0xa323('0x3'))[_0xa323('0x6')](''):[];}},'auth':{'type':Sequelize[_0xa323('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xa323('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa323('0x0')]},'description':{'type':Sequelize[_0xa323('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 28e8c6d..134b7c9 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 _0xe205=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x2fe959,_0x351d77){var _0x2f6ace=function(_0x4ede54){while(--_0x4ede54){_0x2fe959['push'](_0x2fe959['shift']());}};_0x2f6ace(++_0x351d77);}(_0xe205,0xa7));var _0x5e20=function(_0x20bcea,_0x3bd892){_0x20bcea=_0x20bcea-0x0;var _0x5eaaca=_0xe205[_0x20bcea];return _0x5eaaca;};'use strict';var emlformat=require(_0x5e20('0x0'));var rimraf=require(_0x5e20('0x1'));var zipdir=require(_0x5e20('0x2'));var jsonpatch=require(_0x5e20('0x3'));var rp=require(_0x5e20('0x4'));var moment=require(_0x5e20('0x5'));var BPromise=require(_0x5e20('0x6'));var Mustache=require(_0x5e20('0x7'));var util=require(_0x5e20('0x8'));var path=require('path');var sox=require(_0x5e20('0x9'));var csv=require(_0x5e20('0xa'));var ejs=require(_0x5e20('0xb'));var fs=require('fs');var fs_extra=require(_0x5e20('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xa'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=typeof _0x148ada[_0x5e20('0x1d')]===_0x5e20('0x1e')&&typeof _0x148ada[_0x5e20('0x1f')]===_0x5e20('0x1e');var _0x2f194b=_0x294df8[_0x5e20('0x20')];var _0x1cc706=_0x542b3c?0x0:_0x148ada[_0x5e20('0x1d')];var _0x4d3e4a=_0x542b3c?_0x294df8[_0x5e20('0x20')]:_0x148ada[_0x5e20('0x1d')]+_0x148ada['limit'];var _0x295eb3;if(_0x4d3e4a>=_0x2f194b){_0x4d3e4a=_0x2f194b;_0x295eb3=0xc8;}else{_0x295eb3=0xce;}_0x275026[_0x5e20('0x1b')](_0x295eb3);return _0x275026[_0x5e20('0x21')](_0x5e20('0x22'),_0x1cc706+'-'+_0x4d3e4a+'/'+_0x2f194b)['json'](_0x294df8);}return null;};}function patchUpdates(_0x2954fc){return function(_0x50f222){try{jsonpatch['apply'](_0x50f222,_0x2954fc,!![]);}catch(_0x57c7c5){return BPromise['reject'](_0x57c7c5);}return _0x50f222[_0x5e20('0x23')]();};}function saveUpdates(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x24')](_0x5cca90)[_0x5e20('0x25')](function(_0x3ef7fa){return _0x3ef7fa;});}return null;};}function removeEntity(_0x2d4614,_0x4c5732){return function(_0x15705f){if(_0x15705f){return _0x15705f['destroy']()['then'](function(){var _0x33993a=_0x15705f[_0x5e20('0x26')]({'plain':!![]});var _0x2bae08=_0x5e20('0x27');return db[_0x5e20('0x28')][_0x5e20('0x29')]({'where':{'type':_0x2bae08,'resourceId':_0x33993a['id']}})[_0x5e20('0x25')](function(){return _0x15705f;});})['then'](function(){_0x2d4614[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x238758,_0x3032ef){return function(_0x4c799d){if(!_0x4c799d){_0x238758[_0x5e20('0x19')](0x194);}return _0x4c799d;};}function handleError(_0x2c5d80,_0x37f09a){_0x37f09a=_0x37f09a||0x1f4;return function(_0x222e7a){logger[_0x5e20('0x2a')](_0x222e7a[_0x5e20('0x2b')]);if(_0x222e7a['name']){delete _0x222e7a[_0x5e20('0x2c')];}_0x2c5d80[_0x5e20('0x1b')](_0x37f09a)['send'](_0x222e7a);};}exports[_0x5e20('0x2d')]=function(_0x21d1d8,_0x335f1e){var _0x4196a3={},_0x1548c8={},_0x395a27={'count':0x0,'rows':[]};var _0x4ff715=_[_0x5e20('0x2e')](db[_0x5e20('0x2f')][_0x5e20('0x30')],function(_0x5f2f1d){return{'name':_0x5f2f1d[_0x5e20('0x31')],'type':_0x5f2f1d[_0x5e20('0x32')][_0x5e20('0x33')]};});_0x1548c8[_0x5e20('0x34')]=_[_0x5e20('0x2e')](_0x4ff715,_0x5e20('0x2c'));_0x1548c8[_0x5e20('0x35')]=_['keys'](_0x21d1d8[_0x5e20('0x35')]);_0x1548c8[_0x5e20('0x36')]=_[_0x5e20('0x37')](_0x1548c8['model'],_0x1548c8[_0x5e20('0x35')]);_0x4196a3[_0x5e20('0x38')]=_[_0x5e20('0x37')](_0x1548c8[_0x5e20('0x34')],qs[_0x5e20('0x39')](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x39')]));_0x4196a3[_0x5e20('0x38')]=_0x4196a3[_0x5e20('0x38')][_0x5e20('0x3a')]?_0x4196a3[_0x5e20('0x38')]:_0x1548c8[_0x5e20('0x34')];if(!_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3b')]('nolimit')){_0x4196a3[_0x5e20('0x1f')]=qs['limit'](_0x21d1d8['query'][_0x5e20('0x1f')]);_0x4196a3[_0x5e20('0x1d')]=qs['offset'](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x1d')]);}_0x4196a3['order']=qs[_0x5e20('0x3c')](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3c')]);_0x4196a3[_0x5e20('0x3d')]=qs[_0x5e20('0x36')](_[_0x5e20('0x3e')](_0x21d1d8[_0x5e20('0x35')],_0x1548c8[_0x5e20('0x36')]),_0x4ff715);if(_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3f')]){_0x4196a3[_0x5e20('0x3d')]=_[_0x5e20('0x40')](_0x4196a3[_0x5e20('0x3d')],{'$or':_[_0x5e20('0x2e')](_0x4ff715,function(_0x5ad136){if(_0x5ad136[_0x5e20('0x32')]!==_0x5e20('0x41')){var _0x17feb4={};_0x17feb4[_0x5ad136['name']]={'$like':'%'+_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3f')]+'%'};return _0x17feb4;}})});}_0x4196a3=_[_0x5e20('0x40')]({},_0x4196a3,_0x21d1d8[_0x5e20('0x42')]);var _0x39018d={'where':_0x4196a3['where']};return db[_0x5e20('0x2f')][_0x5e20('0x20')](_0x39018d)[_0x5e20('0x25')](function(_0x24c05f){_0x395a27[_0x5e20('0x20')]=_0x24c05f;if(_0x21d1d8[_0x5e20('0x35')]['includeAll']){_0x4196a3[_0x5e20('0x43')]=[{'all':!![]}];}return db[_0x5e20('0x2f')][_0x5e20('0x44')](_0x4196a3);})['then'](function(_0x2b031d){_0x395a27[_0x5e20('0x45')]=_0x2b031d;return _0x395a27;})[_0x5e20('0x25')](respondWithFilteredResult(_0x335f1e,_0x4196a3))[_0x5e20('0x46')](handleError(_0x335f1e,null));};exports[_0x5e20('0x47')]=function(_0x336d61,_0x113133){var _0x3edea7={'raw':![],'where':{'id':_0x336d61[_0x5e20('0x48')]['id']}},_0x5c9504={};_0x5c9504[_0x5e20('0x34')]=_[_0x5e20('0x49')](db['VoiceChanSpy'][_0x5e20('0x30')]);_0x5c9504['query']=_[_0x5e20('0x49')](_0x336d61[_0x5e20('0x35')]);_0x5c9504[_0x5e20('0x36')]=_[_0x5e20('0x37')](_0x5c9504[_0x5e20('0x34')],_0x5c9504['query']);_0x3edea7[_0x5e20('0x38')]=_['intersection'](_0x5c9504['model'],qs[_0x5e20('0x39')](_0x336d61[_0x5e20('0x35')][_0x5e20('0x39')]));_0x3edea7[_0x5e20('0x38')]=_0x3edea7[_0x5e20('0x38')][_0x5e20('0x3a')]?_0x3edea7[_0x5e20('0x38')]:_0x5c9504['model'];if(_0x336d61['query'][_0x5e20('0x4a')]){_0x3edea7[_0x5e20('0x43')]=[{'all':!![]}];}_0x3edea7=_['merge']({},_0x3edea7,_0x336d61[_0x5e20('0x42')]);return db[_0x5e20('0x2f')][_0x5e20('0x4b')](_0x3edea7)[_0x5e20('0x25')](handleEntityNotFound(_0x113133,null))[_0x5e20('0x25')](respondWithResult(_0x113133,null))['catch'](handleError(_0x113133,null));};exports[_0x5e20('0x4c')]=function(_0x245b52,_0x25491e){return db[_0x5e20('0x2f')][_0x5e20('0x4c')](_0x245b52[_0x5e20('0x4d')],{})[_0x5e20('0x25')](function(_0x4485bb){var _0x4fb004=_0x245b52['user']['get']({'plain':!![]});if(!_0x4fb004)throw new Error(_0x5e20('0x4e'));if(_0x4fb004[_0x5e20('0x4f')]==='user'){var _0x4392ca=_0x4485bb['get']({'plain':!![]});var _0x61a3f1='ChanSpies';return db[_0x5e20('0x50')]['find']({'where':{'name':_0x61a3f1,'userProfileId':_0x4fb004[_0x5e20('0x51')]},'raw':!![]})[_0x5e20('0x25')](function(_0x285d2e){if(_0x285d2e&&_0x285d2e[_0x5e20('0x52')]===0x0){return db[_0x5e20('0x28')][_0x5e20('0x4c')]({'name':_0x4392ca[_0x5e20('0x2c')],'resourceId':_0x4392ca['id'],'type':_0x285d2e[_0x5e20('0x2c')],'sectionId':_0x285d2e['id']},{})[_0x5e20('0x25')](function(){return _0x4485bb;});}else{return _0x4485bb;}})[_0x5e20('0x46')](function(_0x13b716){logger[_0x5e20('0x2a')](_0x5e20('0x53'),_0x13b716);throw _0x13b716;});}return _0x4485bb;})[_0x5e20('0x25')](respondWithResult(_0x25491e,0xc9))[_0x5e20('0x46')](handleError(_0x25491e,null));};exports[_0x5e20('0x24')]=function(_0x1619fa,_0x1ace56){if(_0x1619fa['body']['id']){delete _0x1619fa['body']['id'];}return db[_0x5e20('0x2f')]['find']({'where':{'id':_0x1619fa[_0x5e20('0x48')]['id']}})[_0x5e20('0x25')](handleEntityNotFound(_0x1ace56,null))[_0x5e20('0x25')](saveUpdates(_0x1619fa['body'],null))[_0x5e20('0x25')](respondWithResult(_0x1ace56,null))[_0x5e20('0x46')](handleError(_0x1ace56,null));};exports[_0x5e20('0x29')]=function(_0x5d0345,_0x5d2aa2){return db['VoiceChanSpy'][_0x5e20('0x4b')]({'where':{'id':_0x5d0345[_0x5e20('0x48')]['id']}})[_0x5e20('0x25')](handleEntityNotFound(_0x5d2aa2,null))[_0x5e20('0x25')](removeEntity(_0x5d2aa2,null))[_0x5e20('0x46')](handleError(_0x5d2aa2,null));}; \ No newline at end of file +var _0x175e=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','include','findAll','rows','catch','show','params','intersection','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x44a4df,_0x2cbb03){var _0x376c50=function(_0x23b74a){while(--_0x23b74a){_0x44a4df['push'](_0x44a4df['shift']());}};_0x376c50(++_0x2cbb03);}(_0x175e,0xe6));var _0xe175=function(_0x5468f0,_0x1adb2a){_0x5468f0=_0x5468f0-0x0;var _0x542ebf=_0x175e[_0x5468f0];return _0x542ebf;};'use strict';var emlformat=require(_0xe175('0x0'));var rimraf=require(_0xe175('0x1'));var zipdir=require(_0xe175('0x2'));var jsonpatch=require(_0xe175('0x3'));var rp=require(_0xe175('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe175('0x5'));var util=require(_0xe175('0x6'));var path=require(_0xe175('0x7'));var sox=require(_0xe175('0x8'));var csv=require(_0xe175('0x9'));var ejs=require(_0xe175('0xa'));var fs=require('fs');var fs_extra=require(_0xe175('0xb'));var _=require(_0xe175('0xc'));var squel=require(_0xe175('0xd'));var crypto=require(_0xe175('0xe'));var jsforce=require(_0xe175('0xf'));var deskjs=require(_0xe175('0x10'));var toCsv=require(_0xe175('0x9'));var querystring=require(_0xe175('0x11'));var Papa=require(_0xe175('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe175('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe175('0x14'));var logger=require(_0xe175('0x15'))(_0xe175('0x16'));var utils=require(_0xe175('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe175('0x18'))['db'];function respondWithStatusCode(_0x4d7c59,_0x4b1b9b){_0x4b1b9b=_0x4b1b9b||0xcc;return function(_0x43eeb4){if(_0x43eeb4){return _0x4d7c59[_0xe175('0x19')](_0x4b1b9b);}return _0x4d7c59[_0xe175('0x1a')](_0x4b1b9b)[_0xe175('0x1b')]();};}function respondWithResult(_0x439252,_0x4d2f51){_0x4d2f51=_0x4d2f51||0xc8;return function(_0x1e5477){if(_0x1e5477){return _0x439252[_0xe175('0x1a')](_0x4d2f51)[_0xe175('0x1c')](_0x1e5477);}};}function respondWithFilteredResult(_0x297f95,_0x3a0677){return function(_0x20660b){if(_0x20660b){var _0x20ac70=typeof _0x3a0677['offset']===_0xe175('0x1d')&&typeof _0x3a0677[_0xe175('0x1e')]===_0xe175('0x1d');var _0x5e9047=_0x20660b[_0xe175('0x1f')];var _0x3f9bc3=_0x20ac70?0x0:_0x3a0677[_0xe175('0x20')];var _0xc5219c=_0x20ac70?_0x20660b[_0xe175('0x1f')]:_0x3a0677[_0xe175('0x20')]+_0x3a0677['limit'];var _0x466fe9;if(_0xc5219c>=_0x5e9047){_0xc5219c=_0x5e9047;_0x466fe9=0xc8;}else{_0x466fe9=0xce;}_0x297f95[_0xe175('0x1a')](_0x466fe9);return _0x297f95[_0xe175('0x21')](_0xe175('0x22'),_0x3f9bc3+'-'+_0xc5219c+'/'+_0x5e9047)['json'](_0x20660b);}return null;};}function patchUpdates(_0x291bc4){return function(_0x1d0d6c){try{jsonpatch[_0xe175('0x23')](_0x1d0d6c,_0x291bc4,!![]);}catch(_0x57dcf9){return BPromise[_0xe175('0x24')](_0x57dcf9);}return _0x1d0d6c[_0xe175('0x25')]();};}function saveUpdates(_0x57ef02,_0xb10d29){return function(_0x4f6115){if(_0x4f6115){return _0x4f6115[_0xe175('0x26')](_0x57ef02)[_0xe175('0x27')](function(_0x1bc8c9){return _0x1bc8c9;});}return null;};}function removeEntity(_0x20dd39,_0x2e02c0){return function(_0x3b2111){if(_0x3b2111){return _0x3b2111[_0xe175('0x28')]()[_0xe175('0x27')](function(){var _0x40e3c2=_0x3b2111['get']({'plain':!![]});var _0x5c54dd=_0xe175('0x29');return db[_0xe175('0x2a')][_0xe175('0x28')]({'where':{'type':_0x5c54dd,'resourceId':_0x40e3c2['id']}})[_0xe175('0x27')](function(){return _0x3b2111;});})[_0xe175('0x27')](function(){_0x20dd39[_0xe175('0x1a')](0xcc)[_0xe175('0x1b')]();});}};}function handleEntityNotFound(_0xfe8b24,_0x139b5c){return function(_0x1261cc){if(!_0x1261cc){_0xfe8b24[_0xe175('0x19')](0x194);}return _0x1261cc;};}function handleError(_0x28b1b9,_0x1a1412){_0x1a1412=_0x1a1412||0x1f4;return function(_0x207548){logger['error'](_0x207548['stack']);if(_0x207548[_0xe175('0x2b')]){delete _0x207548[_0xe175('0x2b')];}_0x28b1b9[_0xe175('0x1a')](_0x1a1412)[_0xe175('0x2c')](_0x207548);};}exports[_0xe175('0x2d')]=function(_0x1fefc2,_0xf7c95a){var _0x526bbd={},_0x45e61c={},_0xd854d5={'count':0x0,'rows':[]};var _0x37d071=_[_0xe175('0x2e')](db[_0xe175('0x2f')][_0xe175('0x30')],function(_0x46849e){return{'name':_0x46849e[_0xe175('0x31')],'type':_0x46849e['type'][_0xe175('0x32')]};});_0x45e61c[_0xe175('0x33')]=_[_0xe175('0x2e')](_0x37d071,_0xe175('0x2b'));_0x45e61c['query']=_[_0xe175('0x34')](_0x1fefc2[_0xe175('0x35')]);_0x45e61c['filters']=_['intersection'](_0x45e61c[_0xe175('0x33')],_0x45e61c[_0xe175('0x35')]);_0x526bbd[_0xe175('0x36')]=_['intersection'](_0x45e61c[_0xe175('0x33')],qs[_0xe175('0x37')](_0x1fefc2[_0xe175('0x35')][_0xe175('0x37')]));_0x526bbd[_0xe175('0x36')]=_0x526bbd[_0xe175('0x36')][_0xe175('0x38')]?_0x526bbd[_0xe175('0x36')]:_0x45e61c[_0xe175('0x33')];if(!_0x1fefc2[_0xe175('0x35')][_0xe175('0x39')](_0xe175('0x3a'))){_0x526bbd[_0xe175('0x1e')]=qs['limit'](_0x1fefc2['query'][_0xe175('0x1e')]);_0x526bbd['offset']=qs[_0xe175('0x20')](_0x1fefc2['query'][_0xe175('0x20')]);}_0x526bbd[_0xe175('0x3b')]=qs['sort'](_0x1fefc2[_0xe175('0x35')]['sort']);_0x526bbd[_0xe175('0x3c')]=qs[_0xe175('0x3d')](_['pick'](_0x1fefc2[_0xe175('0x35')],_0x45e61c['filters']),_0x37d071);if(_0x1fefc2[_0xe175('0x35')][_0xe175('0x3e')]){_0x526bbd['where']=_['merge'](_0x526bbd['where'],{'$or':_['map'](_0x37d071,function(_0x4d9ebf){if(_0x4d9ebf['type']!=='VIRTUAL'){var _0x1f350c={};_0x1f350c[_0x4d9ebf[_0xe175('0x2b')]]={'$like':'%'+_0x1fefc2[_0xe175('0x35')][_0xe175('0x3e')]+'%'};return _0x1f350c;}})});}_0x526bbd=_['merge']({},_0x526bbd,_0x1fefc2['options']);var _0x11f4e9={'where':_0x526bbd[_0xe175('0x3c')]};return db[_0xe175('0x2f')]['count'](_0x11f4e9)[_0xe175('0x27')](function(_0x3374b6){_0xd854d5['count']=_0x3374b6;if(_0x1fefc2[_0xe175('0x35')]['includeAll']){_0x526bbd[_0xe175('0x3f')]=[{'all':!![]}];}return db[_0xe175('0x2f')][_0xe175('0x40')](_0x526bbd);})['then'](function(_0x4464e4){_0xd854d5[_0xe175('0x41')]=_0x4464e4;return _0xd854d5;})[_0xe175('0x27')](respondWithFilteredResult(_0xf7c95a,_0x526bbd))[_0xe175('0x42')](handleError(_0xf7c95a,null));};exports[_0xe175('0x43')]=function(_0x318ec0,_0x551400){var _0xde4780={'raw':![],'where':{'id':_0x318ec0[_0xe175('0x44')]['id']}},_0x102657={};_0x102657['model']=_['keys'](db[_0xe175('0x2f')][_0xe175('0x30')]);_0x102657['query']=_['keys'](_0x318ec0['query']);_0x102657['filters']=_[_0xe175('0x45')](_0x102657[_0xe175('0x33')],_0x102657[_0xe175('0x35')]);_0xde4780[_0xe175('0x36')]=_[_0xe175('0x45')](_0x102657[_0xe175('0x33')],qs[_0xe175('0x37')](_0x318ec0[_0xe175('0x35')][_0xe175('0x37')]));_0xde4780[_0xe175('0x36')]=_0xde4780['attributes'][_0xe175('0x38')]?_0xde4780[_0xe175('0x36')]:_0x102657[_0xe175('0x33')];if(_0x318ec0['query'][_0xe175('0x46')]){_0xde4780[_0xe175('0x3f')]=[{'all':!![]}];}_0xde4780=_[_0xe175('0x47')]({},_0xde4780,_0x318ec0['options']);return db['VoiceChanSpy'][_0xe175('0x48')](_0xde4780)[_0xe175('0x27')](handleEntityNotFound(_0x551400,null))['then'](respondWithResult(_0x551400,null))[_0xe175('0x42')](handleError(_0x551400,null));};exports[_0xe175('0x49')]=function(_0x10d06e,_0x4e8cda){return db[_0xe175('0x2f')]['create'](_0x10d06e[_0xe175('0x4a')],{})[_0xe175('0x27')](function(_0x41cabe){var _0x23dade=_0x10d06e[_0xe175('0x4b')]['get']({'plain':!![]});if(!_0x23dade)throw new Error(_0xe175('0x4c'));if(_0x23dade[_0xe175('0x4d')]===_0xe175('0x4b')){var _0x319a09=_0x41cabe[_0xe175('0x4e')]({'plain':!![]});var _0x47c62c=_0xe175('0x29');return db[_0xe175('0x4f')][_0xe175('0x48')]({'where':{'name':_0x47c62c,'userProfileId':_0x23dade[_0xe175('0x50')]},'raw':!![]})[_0xe175('0x27')](function(_0x2c0835){if(_0x2c0835&&_0x2c0835['autoAssociation']===0x0){return db[_0xe175('0x2a')][_0xe175('0x49')]({'name':_0x319a09['name'],'resourceId':_0x319a09['id'],'type':_0x2c0835[_0xe175('0x2b')],'sectionId':_0x2c0835['id']},{})[_0xe175('0x27')](function(){return _0x41cabe;});}else{return _0x41cabe;}})[_0xe175('0x42')](function(_0x10c983){logger[_0xe175('0x51')](_0xe175('0x52'),_0x10c983);throw _0x10c983;});}return _0x41cabe;})[_0xe175('0x27')](respondWithResult(_0x4e8cda,0xc9))['catch'](handleError(_0x4e8cda,null));};exports['update']=function(_0x5b541c,_0x1c2352){if(_0x5b541c[_0xe175('0x4a')]['id']){delete _0x5b541c[_0xe175('0x4a')]['id'];}return db[_0xe175('0x2f')][_0xe175('0x48')]({'where':{'id':_0x5b541c[_0xe175('0x44')]['id']}})[_0xe175('0x27')](handleEntityNotFound(_0x1c2352,null))[_0xe175('0x27')](saveUpdates(_0x5b541c['body'],null))[_0xe175('0x27')](respondWithResult(_0x1c2352,null))[_0xe175('0x42')](handleError(_0x1c2352,null));};exports['destroy']=function(_0x13202c,_0x22ac87){return db[_0xe175('0x2f')][_0xe175('0x48')]({'where':{'id':_0x13202c[_0xe175('0x44')]['id']}})['then'](handleEntityNotFound(_0x22ac87,null))['then'](removeEntity(_0x22ac87,null))[_0xe175('0x42')](handleError(_0x22ac87,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5dda859..8e06f0d 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 _0x57b1=['User','findAll','then','catch','models','define','VoiceExtension','bulkCreate','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','length','concat','internal'];(function(_0x46aa6f,_0xf7b072){var _0x44759c=function(_0x97a501){while(--_0x97a501){_0x46aa6f['push'](_0x46aa6f['shift']());}};_0x44759c(++_0xf7b072);}(_0x57b1,0x15c));var _0x157b=function(_0x460a97,_0x351b54){_0x460a97=_0x460a97-0x0;var _0x3707e1=_0x57b1[_0x460a97];return _0x3707e1;};'use strict';var _=require('lodash');var util=require(_0x157b('0x0'));var BPromise=require(_0x157b('0x1'));var attributes=require(_0x157b('0x2'));var getUserApplications=function(_0xee48c9,_0x2c29c3,_0x1d36f8){var _0x4b60b5=0x1;var _0x1335fa=[];var _0x554120={'context':_0x2c29c3[_0x157b('0x3')]||_0x157b('0x4'),'exten':util[_0x157b('0x5')]('%s%s',_0xee48c9[_0x157b('0x6')],_0x1d36f8),'type':_0x157b('0x7'),'isApp':![],'ChanSpyId':_0xee48c9['id'],'UserId':_0x2c29c3['id']};_0x1335fa[_0x157b('0x8')](_[_0x157b('0x9')]({'app':_0x157b('0xa'),'appdata':util[_0x157b('0x5')](_0x157b('0xb'),'chanspy'),'priority':_0x4b60b5++},_0x554120));if(_0xee48c9[_0x157b('0xc')]){_0x1335fa[_0x157b('0x8')](_[_0x157b('0x9')]({'app':_0x157b('0xd'),'appdata':util['format'](_0x157b('0xe'),_0xee48c9[_0x157b('0xf')]),'priority':_0x4b60b5++},_0x554120));}if(_0xee48c9[_0x157b('0x10')]){_0x1335fa[_0x157b('0x8')](_[_0x157b('0x9')]({'app':_0x157b('0x11'),'appdata':_0xee48c9[_0x157b('0x12')],'priority':_0x4b60b5++},_0x554120));}_0x1335fa[_0x157b('0x8')](_[_0x157b('0x9')]({'app':_0x157b('0x13'),'appdata':util[_0x157b('0x5')]('SIP/%s,%s',_0x2c29c3[_0x157b('0x14')],_0xee48c9[_0x157b('0x15')]?_0xee48c9[_0x157b('0x15')][_0x157b('0x16')](''):''),'priority':_0x4b60b5++},_0x554120));if(_0xee48c9['record']){_0x1335fa[_0x157b('0x8')](_[_0x157b('0x9')]({'app':'StopMixMonitor','priority':_0x4b60b5++},_0x554120));}return _0x1335fa;};var getChanSpyApplications=function(_0x522ede,_0x543d60){var _0x51d4fb=[];for(var _0x22444b=0x0,_0xe886f9=0x1;_0x22444b<_0x543d60[_0x157b('0x17')];_0x22444b++,_0xe886f9=0x1){_0x51d4fb=_0x51d4fb[_0x157b('0x18')](getUserApplications(_0x522ede,_0x543d60[_0x22444b],_0x543d60[_0x22444b][_0x157b('0x19')]));if(_0x543d60[_0x22444b][_0x157b('0x19')]!=_0x543d60[_0x22444b][_0x157b('0x14')]){_0x51d4fb=_0x51d4fb[_0x157b('0x18')](getUserApplications(_0x522ede,_0x543d60[_0x22444b],_0x543d60[_0x22444b][_0x157b('0x14')]));}}return _0x51d4fb;};var getChanSpyPromise=function(_0x192236,_0x379710){return new BPromise(function(_0x1b9ebc,_0x16d74f){return _0x192236[_0x157b('0x1a')][_0x157b('0x1b')]({'attributes':['id',_0x157b('0x14'),_0x157b('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x157b('0x1c')](function(_0x5ca47c){if(_0x5ca47c){return _0x1b9ebc(getChanSpyApplications(_0x379710,_0x5ca47c));}return _0x1b9ebc([]);})[_0x157b('0x1d')](function(_0x867eba){_0x16d74f(_0x867eba);});});};module['exports']=function(_0x254241,_0x3662c1){var _0xfcf77c=_0x254241[_0x157b('0x1e')];return _0x254241[_0x157b('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b7968,_0x159343,_0x273070){return getChanSpyPromise(_0xfcf77c,_0x2b7968)[_0x157b('0x1c')](function(_0x26f71c){if(_0x26f71c&&_0x26f71c[_0x157b('0x17')]){return _0xfcf77c[_0x157b('0x20')][_0x157b('0x21')](_0x26f71c);}})[_0x157b('0x1c')](function(){_0x273070();})[_0x157b('0x1d')](function(_0x31fbf){_0x273070(_0x31fbf);});},'afterUpdate':function(_0x311172,_0xc08acd,_0x27dca6){return _0xfcf77c[_0x157b('0x20')]['destroy']({'where':{'ChanSpyId':_0x311172['id']}})[_0x157b('0x1c')](function(){return getChanSpyPromise(_0xfcf77c,_0x311172);})[_0x157b('0x1c')](function(_0x4845ae){if(_0x4845ae&&_0x4845ae[_0x157b('0x17')]){return _0xfcf77c[_0x157b('0x20')]['bulkCreate'](_0x4845ae);}})[_0x157b('0x1c')](function(){_0x27dca6();})['catch'](function(_0x136e86){_0x27dca6(_0x136e86);});},'afterDestroy':function(_0x4c5f21,_0x2cb065,_0x9ab9b8){return _0xfcf77c[_0x157b('0x20')]['destroy']({'where':{'ChanSpyId':_0x4c5f21['id']}})[_0x157b('0x1c')](function(){_0x9ab9b8();})[_0x157b('0x1d')](function(_0x3987e7){_0x9ab9b8(_0x3987e7);});}}});}; \ No newline at end of file +var _0x9fa1=['bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x27eea7,_0x62ede5){var _0x1489ba=function(_0x1cc7e2){while(--_0x1cc7e2){_0x27eea7['push'](_0x27eea7['shift']());}};_0x1489ba(++_0x62ede5);}(_0x9fa1,0x12f));var _0x19fa=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9fa1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x19fa('0x0'));var util=require('util');var BPromise=require(_0x19fa('0x1'));var attributes=require(_0x19fa('0x2'));var getUserApplications=function(_0x2b731a,_0x3a7eb4,_0x1ced55){var _0x153318=0x1;var _0x3653dd=[];var _0xba8642={'context':_0x3a7eb4[_0x19fa('0x3')]||_0x19fa('0x4'),'exten':util[_0x19fa('0x5')](_0x19fa('0x6'),_0x2b731a['prefix'],_0x1ced55),'type':'system','isApp':![],'ChanSpyId':_0x2b731a['id'],'UserId':_0x3a7eb4['id']};_0x3653dd['push'](_[_0x19fa('0x7')]({'app':_0x19fa('0x8'),'appdata':util[_0x19fa('0x5')](_0x19fa('0x9'),_0x19fa('0xa')),'priority':_0x153318++},_0xba8642));if(_0x2b731a['record']){_0x3653dd[_0x19fa('0xb')](_[_0x19fa('0x7')]({'app':_0x19fa('0xc'),'appdata':util['format'](_0x19fa('0xd'),_0x2b731a[_0x19fa('0xe')]),'priority':_0x153318++},_0xba8642));}if(_0x2b731a[_0x19fa('0xf')]){_0x3653dd['push'](_[_0x19fa('0x7')]({'app':_0x19fa('0x10'),'appdata':_0x2b731a[_0x19fa('0x11')],'priority':_0x153318++},_0xba8642));}_0x3653dd['push'](_[_0x19fa('0x7')]({'app':_0x19fa('0x12'),'appdata':util[_0x19fa('0x5')](_0x19fa('0x13'),_0x3a7eb4['name'],_0x2b731a[_0x19fa('0x14')]?_0x2b731a['options'][_0x19fa('0x15')](''):''),'priority':_0x153318++},_0xba8642));if(_0x2b731a['record']){_0x3653dd['push'](_[_0x19fa('0x7')]({'app':_0x19fa('0x16'),'priority':_0x153318++},_0xba8642));}return _0x3653dd;};var getChanSpyApplications=function(_0x422cd7,_0xae596b){var _0x1a67a1=[];for(var _0x4ba625=0x0,_0x254ca2=0x1;_0x4ba625<_0xae596b[_0x19fa('0x17')];_0x4ba625++,_0x254ca2=0x1){_0x1a67a1=_0x1a67a1[_0x19fa('0x18')](getUserApplications(_0x422cd7,_0xae596b[_0x4ba625],_0xae596b[_0x4ba625][_0x19fa('0x19')]));if(_0xae596b[_0x4ba625]['internal']!=_0xae596b[_0x4ba625]['name']){_0x1a67a1=_0x1a67a1['concat'](getUserApplications(_0x422cd7,_0xae596b[_0x4ba625],_0xae596b[_0x4ba625][_0x19fa('0x1a')]));}}return _0x1a67a1;};var getChanSpyPromise=function(_0xd7a808,_0x589dc6){return new BPromise(function(_0x2b943f,_0x5bd23d){return _0xd7a808[_0x19fa('0x1b')]['findAll']({'attributes':['id',_0x19fa('0x1a'),_0x19fa('0x19')],'where':{'role':_0x19fa('0x1c'),'chanspy':!![]},'raw':!![]})[_0x19fa('0x1d')](function(_0x64bea1){if(_0x64bea1){return _0x2b943f(getChanSpyApplications(_0x589dc6,_0x64bea1));}return _0x2b943f([]);})[_0x19fa('0x1e')](function(_0x174c1f){_0x5bd23d(_0x174c1f);});});};module[_0x19fa('0x1f')]=function(_0x53fa3a,_0x23020e){var _0x16a621=_0x53fa3a['models'];return _0x53fa3a[_0x19fa('0x20')](_0x19fa('0x21'),attributes,{'tableName':_0x19fa('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x256f56,_0x3ffbbe,_0x32fa32){return getChanSpyPromise(_0x16a621,_0x256f56)[_0x19fa('0x1d')](function(_0x44e9b1){if(_0x44e9b1&&_0x44e9b1[_0x19fa('0x17')]){return _0x16a621[_0x19fa('0x23')][_0x19fa('0x24')](_0x44e9b1);}})[_0x19fa('0x1d')](function(){_0x32fa32();})['catch'](function(_0x4e316){_0x32fa32(_0x4e316);});},'afterUpdate':function(_0x19c581,_0x458bfe,_0x3329ee){return _0x16a621[_0x19fa('0x23')][_0x19fa('0x25')]({'where':{'ChanSpyId':_0x19c581['id']}})[_0x19fa('0x1d')](function(){return getChanSpyPromise(_0x16a621,_0x19c581);})[_0x19fa('0x1d')](function(_0x28b84c){if(_0x28b84c&&_0x28b84c[_0x19fa('0x17')]){return _0x16a621[_0x19fa('0x23')]['bulkCreate'](_0x28b84c);}})[_0x19fa('0x1d')](function(){_0x3329ee();})['catch'](function(_0x39a6c6){_0x3329ee(_0x39a6c6);});},'afterDestroy':function(_0x34d806,_0x3ce212,_0x377ffa){return _0x16a621[_0x19fa('0x23')]['destroy']({'where':{'ChanSpyId':_0x34d806['id']}})['then'](function(){_0x377ffa();})[_0x19fa('0x1e')](function(_0x19c99b){_0x377ffa(_0x19c99b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 90a4e18..3c3b5e4 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 _0x6ae2=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x633c61,_0xa7f8dc){_0x633c61=_0x633c61-0x0;var _0x3cd8ea=_0x6ae2[_0x633c61];return _0x3cd8ea;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var moment=require(_0x26ae('0x2'));var BPromise=require(_0x26ae('0x3'));var rs=require(_0x26ae('0x4'));var fs=require('fs');var Redis=require(_0x26ae('0x5'));var db=require(_0x26ae('0x6'))['db'];var utils=require(_0x26ae('0x7'));var logger=require(_0x26ae('0x8'))('rpc');var config=require(_0x26ae('0x9'));var jayson=require(_0x26ae('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13cb27,_0xde4226,_0x473907){return new BPromise(function(_0x151de3,_0x3bc9de){return client[_0x26ae('0xb')](_0x13cb27,_0x473907)[_0x26ae('0xc')](function(_0x4b3eca){logger[_0x26ae('0xd')](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));logger[_0x26ae('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0xde4226,_0x26ae('0xf'),JSON['stringify'](_0x4b3eca));if(_0x4b3eca[_0x26ae('0x11')]){if(_0x4b3eca['error']['code']===0x1f4){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x3bc9de(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x151de3(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}else{logger['info'](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));_0x151de3(_0x4b3eca['result'][_0x26ae('0x12')]);}})[_0x26ae('0x13')](function(_0x4f71d8){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4f71d8);_0x3bc9de(_0x4f71d8);});});} \ No newline at end of file +var _0xee4f=['VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x17eae6,_0x35d0d5){var _0x164e8d=function(_0x53699d){while(--_0x53699d){_0x17eae6['push'](_0x17eae6['shift']());}};_0x164e8d(++_0x35d0d5);}(_0xee4f,0xad));var _0xfee4=function(_0xc4de87,_0x2568a2){_0xc4de87=_0xc4de87-0x0;var _0x26cc12=_0xee4f[_0xc4de87];return _0x26cc12;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 7fcd9e3..90d1aeb 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 _0x99e5=['get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller'];(function(_0x1bb80d,_0x4b83d7){var _0x4db601=function(_0x12cd97){while(--_0x12cd97){_0x1bb80d['push'](_0x1bb80d['shift']());}};_0x4db601(++_0x4b83d7);}(_0x99e5,0x161));var _0x599e=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x99e5[_0x50f392];return _0x5926f2;};'use strict';var multer=require(_0x599e('0x0'));var util=require(_0x599e('0x1'));var path=require(_0x599e('0x2'));var timeout=require('connect-timeout');var express=require(_0x599e('0x3'));var router=express['Router']();var fs_extra=require(_0x599e('0x4'));var auth=require(_0x599e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x599e('0x6'));var controller=require(_0x599e('0x7'));router[_0x599e('0x8')]('/',auth[_0x599e('0x9')](),controller[_0x599e('0xa')]);router['get']('/:id',auth[_0x599e('0x9')](),controller[_0x599e('0xb')]);router[_0x599e('0xc')]('/',auth[_0x599e('0x9')](),controller[_0x599e('0xd')]);router['put'](_0x599e('0xe'),auth[_0x599e('0x9')](),controller[_0x599e('0xf')]);router[_0x599e('0x10')](_0x599e('0xe'),auth[_0x599e('0x9')](),controller[_0x599e('0x11')]);module[_0x599e('0x12')]=router; \ No newline at end of file +var _0x3e1c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e1c,0x13a));var _0xc3e1=function(_0x3582fb,_0x402fc1){_0x3582fb=_0x3582fb-0x0;var _0x45b3fc=_0x3e1c[_0x3582fb];return _0x45b3fc;};'use strict';var multer=require(_0xc3e1('0x0'));var util=require(_0xc3e1('0x1'));var path=require(_0xc3e1('0x2'));var timeout=require(_0xc3e1('0x3'));var express=require('express');var router=express[_0xc3e1('0x4')]();var fs_extra=require(_0xc3e1('0x5'));var auth=require(_0xc3e1('0x6'));var interaction=require(_0xc3e1('0x7'));var config=require(_0xc3e1('0x8'));var controller=require(_0xc3e1('0x9'));router[_0xc3e1('0xa')]('/',auth['isAuthenticated'](),controller[_0xc3e1('0xb')]);router[_0xc3e1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc3e1('0xc')]);router[_0xc3e1('0xd')]('/',auth[_0xc3e1('0xe')](),controller[_0xc3e1('0xf')]);router[_0xc3e1('0x10')](_0xc3e1('0x11'),auth[_0xc3e1('0xe')](),controller[_0xc3e1('0x12')]);router[_0xc3e1('0x13')](_0xc3e1('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8ff4708..fb50876 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 _0xb5b0=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x4845af,_0x361c34){var _0x280247=function(_0x35436a){while(--_0x35436a){_0x4845af['push'](_0x4845af['shift']());}};_0x280247(++_0x361c34);}(_0xb5b0,0x1bd));var _0x0b5b=function(_0x543df4,_0x80acde){_0x543df4=_0x543df4-0x0;var _0x222670=_0xb5b0[_0x543df4];return _0x222670;};'use strict';var Sequelize=require(_0x0b5b('0x0'));module[_0x0b5b('0x1')]={'name':{'type':Sequelize[_0x0b5b('0x2')],'unique':_0x0b5b('0x3')},'description':{'type':Sequelize[_0x0b5b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0b5b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x608f=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x116538,_0x1d9449){var _0x521263=function(_0xc68ee7){while(--_0xc68ee7){_0x116538['push'](_0x116538['shift']());}};_0x521263(++_0x1d9449);}(_0x608f,0x7d));var _0xf608=function(_0x4bf513,_0x407de5){_0x4bf513=_0x4bf513-0x0;var _0xbcccdd=_0x608f[_0x4bf513];return _0xbcccdd;};'use strict';var Sequelize=require(_0xf608('0x0'));module[_0xf608('0x1')]={'name':{'type':Sequelize[_0xf608('0x2')],'unique':_0xf608('0x3')},'description':{'type':Sequelize[_0xf608('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf608('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 28d88c7..92e5b20 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 _0x56bb=['stack','name','index','map','VoiceContext','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','render','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','Contexts','UserProfileResource','destroy'];(function(_0x3fff80,_0x48f187){var _0x3a87e1=function(_0x1723f3){while(--_0x1723f3){_0x3fff80['push'](_0x3fff80['shift']());}};_0x3a87e1(++_0x48f187);}(_0x56bb,0x9f));var _0xb56b=function(_0x523bf4,_0x447f6b){_0x523bf4=_0x523bf4-0x0;var _0x3eb434=_0x56bb[_0x523bf4];return _0x3eb434;};'use strict';var emlformat=require(_0xb56b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb56b('0x1'));var jsonpatch=require(_0xb56b('0x2'));var rp=require(_0xb56b('0x3'));var moment=require('moment');var BPromise=require(_0xb56b('0x4'));var Mustache=require(_0xb56b('0x5'));var util=require(_0xb56b('0x6'));var path=require(_0xb56b('0x7'));var sox=require(_0xb56b('0x8'));var csv=require('to-csv');var ejs=require(_0xb56b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb56b('0xa'));var squel=require(_0xb56b('0xb'));var crypto=require(_0xb56b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb56b('0xd'));var toCsv=require(_0xb56b('0xe'));var querystring=require(_0xb56b('0xf'));var Papa=require(_0xb56b('0x10'));var Redis=require(_0xb56b('0x11'));var authService=require(_0xb56b('0x12'));var qs=require(_0xb56b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb56b('0x14'));var logger=require(_0xb56b('0x15'))('api');var utils=require(_0xb56b('0x16'));var config=require(_0xb56b('0x17'));var licenseUtil=require(_0xb56b('0x18'));var db=require(_0xb56b('0x19'))['db'];var jayson=require(_0xb56b('0x1a'));var client=jayson['client'][_0xb56b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3d2c01,_0x5bb311,_0xbee406,_0x79a6c){return new BPromise(function(_0x184e12,_0x541bb0){var _0x89e418=_0x79a6c||client;return _0x89e418[_0xb56b('0x1c')](_0x3d2c01,_0xbee406)[_0xb56b('0x1d')](function(_0x13acda){logger[_0xb56b('0x1e')](_0xb56b('0x1f'),_0x5bb311,_0xb56b('0x20'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5bb311,_0xb56b('0x20'),JSON['stringify'](_0x13acda));if(_0x13acda[_0xb56b('0x21')]){if(_0x13acda['error'][_0xb56b('0x22')]===0x1f4){logger['error'](_0xb56b('0x1f'),_0x5bb311,_0x13acda['error']['message']);return _0x541bb0(_0x13acda[_0xb56b('0x21')][_0xb56b('0x23')]);}logger[_0xb56b('0x21')](_0xb56b('0x1f'),_0x5bb311,_0x13acda[_0xb56b('0x21')]['message']);return _0x184e12(_0x13acda[_0xb56b('0x21')]['message']);}else{logger[_0xb56b('0x1e')](_0xb56b('0x1f'),_0x5bb311,'request\x20sent');_0x184e12(_0x13acda['result'][_0xb56b('0x23')]);}})[_0xb56b('0x24')](function(_0x2f2ed8){logger[_0xb56b('0x21')](_0xb56b('0x1f'),_0x5bb311,_0x2f2ed8);_0x541bb0(_0x2f2ed8);});});}function respondWithStatusCode(_0x64db70,_0x4c4043){_0x4c4043=_0x4c4043||0xcc;return function(_0x2c189c){if(_0x2c189c){return _0x64db70[_0xb56b('0x25')](_0x4c4043);}return _0x64db70[_0xb56b('0x26')](_0x4c4043)[_0xb56b('0x27')]();};}function respondWithResult(_0x248354,_0x45605b){_0x45605b=_0x45605b||0xc8;return function(_0x2f092b){if(_0x2f092b){return _0x248354[_0xb56b('0x26')](_0x45605b)[_0xb56b('0x28')](_0x2f092b);}};}function respondWithFilteredResult(_0x2a3252,_0x4c6dc9){return function(_0x4d8780){if(_0x4d8780){var _0x2dd135=typeof _0x4c6dc9[_0xb56b('0x29')]==='undefined'&&typeof _0x4c6dc9[_0xb56b('0x2a')]===_0xb56b('0x2b');var _0x114a68=_0x4d8780[_0xb56b('0x2c')];var _0xc3c470=_0x2dd135?0x0:_0x4c6dc9[_0xb56b('0x29')];var _0x5488ae=_0x2dd135?_0x4d8780[_0xb56b('0x2c')]:_0x4c6dc9[_0xb56b('0x29')]+_0x4c6dc9['limit'];var _0x4f18a0;if(_0x5488ae>=_0x114a68){_0x5488ae=_0x114a68;_0x4f18a0=0xc8;}else{_0x4f18a0=0xce;}_0x2a3252[_0xb56b('0x26')](_0x4f18a0);return _0x2a3252[_0xb56b('0x2d')](_0xb56b('0x2e'),_0xc3c470+'-'+_0x5488ae+'/'+_0x114a68)[_0xb56b('0x28')](_0x4d8780);}return null;};}function patchUpdates(_0xd58198){return function(_0x3acf2b){try{jsonpatch[_0xb56b('0x2f')](_0x3acf2b,_0xd58198,!![]);}catch(_0x4bb01a){return BPromise[_0xb56b('0x30')](_0x4bb01a);}return _0x3acf2b[_0xb56b('0x31')]();};}function saveUpdates(_0x1a1c22,_0x16d1b8){return function(_0x40c548){if(_0x40c548){return _0x40c548['update'](_0x1a1c22)[_0xb56b('0x1d')](function(_0x15d8e7){return _0x15d8e7;});}return null;};}function removeEntity(_0x5a8406,_0x2973fe){return function(_0x2b58ee){if(_0x2b58ee){return _0x2b58ee['destroy']()['then'](function(){var _0x517cb1=_0x2b58ee['get']({'plain':!![]});var _0x48c743=_0xb56b('0x32');return db[_0xb56b('0x33')][_0xb56b('0x34')]({'where':{'type':_0x48c743,'resourceId':_0x517cb1['id']}})[_0xb56b('0x1d')](function(){return _0x2b58ee;});})[_0xb56b('0x1d')](function(){_0x5a8406[_0xb56b('0x26')](0xcc)[_0xb56b('0x27')]();});}};}function handleEntityNotFound(_0x56740b,_0x59022f){return function(_0x2caae0){if(!_0x2caae0){_0x56740b[_0xb56b('0x25')](0x194);}return _0x2caae0;};}function handleError(_0x350c72,_0x416011){_0x416011=_0x416011||0x1f4;return function(_0x4a1b46){logger[_0xb56b('0x21')](_0x4a1b46[_0xb56b('0x35')]);if(_0x4a1b46[_0xb56b('0x36')]){delete _0x4a1b46[_0xb56b('0x36')];}_0x350c72[_0xb56b('0x26')](_0x416011)['send'](_0x4a1b46);};}exports[_0xb56b('0x37')]=function(_0x3e4a49,_0x3684d7){var _0x491399={},_0xc29660={},_0x361781={'count':0x0,'rows':[]};var _0x4a6f67=_[_0xb56b('0x38')](db[_0xb56b('0x39')][_0xb56b('0x3a')],function(_0x728a95){return{'name':_0x728a95[_0xb56b('0x3b')],'type':_0x728a95['type'][_0xb56b('0x3c')]};});_0xc29660['model']=_[_0xb56b('0x38')](_0x4a6f67,_0xb56b('0x36'));_0xc29660[_0xb56b('0x3d')]=_[_0xb56b('0x3e')](_0x3e4a49[_0xb56b('0x3d')]);_0xc29660[_0xb56b('0x3f')]=_[_0xb56b('0x40')](_0xc29660[_0xb56b('0x41')],_0xc29660['query']);_0x491399['attributes']=_['intersection'](_0xc29660[_0xb56b('0x41')],qs['fields'](_0x3e4a49[_0xb56b('0x3d')][_0xb56b('0x42')]));_0x491399[_0xb56b('0x43')]=_0x491399[_0xb56b('0x43')][_0xb56b('0x44')]?_0x491399[_0xb56b('0x43')]:_0xc29660[_0xb56b('0x41')];if(!_0x3e4a49[_0xb56b('0x3d')][_0xb56b('0x45')](_0xb56b('0x46'))){_0x491399['limit']=qs[_0xb56b('0x2a')](_0x3e4a49['query'][_0xb56b('0x2a')]);_0x491399['offset']=qs['offset'](_0x3e4a49[_0xb56b('0x3d')]['offset']);}_0x491399[_0xb56b('0x47')]=qs[_0xb56b('0x48')](_0x3e4a49[_0xb56b('0x3d')][_0xb56b('0x48')]);_0x491399[_0xb56b('0x49')]=qs[_0xb56b('0x3f')](_[_0xb56b('0x4a')](_0x3e4a49['query'],_0xc29660['filters']),_0x4a6f67);if(_0x3e4a49[_0xb56b('0x3d')][_0xb56b('0x4b')]){_0x491399[_0xb56b('0x49')]=_[_0xb56b('0x4c')](_0x491399[_0xb56b('0x49')],{'$or':_[_0xb56b('0x38')](_0x4a6f67,function(_0x2f76a5){if(_0x2f76a5['type']!==_0xb56b('0x4d')){var _0x27878c={};_0x27878c[_0x2f76a5[_0xb56b('0x36')]]={'$like':'%'+_0x3e4a49['query'][_0xb56b('0x4b')]+'%'};return _0x27878c;}})});}_0x491399=_[_0xb56b('0x4c')]({},_0x491399,_0x3e4a49[_0xb56b('0x4e')]);var _0x11b905={'where':_0x491399[_0xb56b('0x49')]};return db['VoiceContext'][_0xb56b('0x2c')](_0x11b905)['then'](function(_0x1270b6){_0x361781[_0xb56b('0x2c')]=_0x1270b6;if(_0x3e4a49[_0xb56b('0x3d')]['includeAll']){_0x491399[_0xb56b('0x4f')]=[{'all':!![]}];}return db[_0xb56b('0x39')][_0xb56b('0x50')](_0x491399);})[_0xb56b('0x1d')](function(_0x16c6bf){_0x361781[_0xb56b('0x51')]=_0x16c6bf;return _0x361781;})['then'](respondWithFilteredResult(_0x3684d7,_0x491399))[_0xb56b('0x24')](handleError(_0x3684d7,null));};exports[_0xb56b('0x52')]=function(_0x2da11b,_0x3ac2a4){var _0x359f77={'raw':![],'where':{'id':_0x2da11b[_0xb56b('0x53')]['id']}},_0x1a4a7d={};_0x1a4a7d[_0xb56b('0x41')]=_['keys'](db[_0xb56b('0x39')][_0xb56b('0x3a')]);_0x1a4a7d[_0xb56b('0x3d')]=_[_0xb56b('0x3e')](_0x2da11b[_0xb56b('0x3d')]);_0x1a4a7d[_0xb56b('0x3f')]=_[_0xb56b('0x40')](_0x1a4a7d[_0xb56b('0x41')],_0x1a4a7d[_0xb56b('0x3d')]);_0x359f77[_0xb56b('0x43')]=_[_0xb56b('0x40')](_0x1a4a7d[_0xb56b('0x41')],qs[_0xb56b('0x42')](_0x2da11b[_0xb56b('0x3d')][_0xb56b('0x42')]));_0x359f77['attributes']=_0x359f77[_0xb56b('0x43')][_0xb56b('0x44')]?_0x359f77[_0xb56b('0x43')]:_0x1a4a7d[_0xb56b('0x41')];if(_0x2da11b[_0xb56b('0x3d')][_0xb56b('0x54')]){_0x359f77['include']=[{'all':!![]}];}_0x359f77=_['merge']({},_0x359f77,_0x2da11b['options']);return db[_0xb56b('0x39')][_0xb56b('0x55')](_0x359f77)[_0xb56b('0x1d')](handleEntityNotFound(_0x3ac2a4,null))[_0xb56b('0x1d')](respondWithResult(_0x3ac2a4,null))[_0xb56b('0x24')](handleError(_0x3ac2a4,null));};exports[_0xb56b('0x56')]=function(_0x367ba2,_0x52598a,_0x25e092){var _0x5bfab5;return db['VoiceContext'][_0xb56b('0x56')](_0x367ba2[_0xb56b('0x57')],{'raw':!![]})[_0xb56b('0x1d')](function(_0x20c62a){_0x5bfab5=_0x20c62a;return db[_0xb56b('0x39')]['findAll']({'raw':!![]});})[_0xb56b('0x1d')](function(_0x19e78d){var _0x75f4bf=fs[_0xb56b('0x58')](path['join'](config[_0xb56b('0x59')],_0xb56b('0x5a')),_0xb56b('0x5b'));var _0x4d49a0=ejs['render'](_0x75f4bf,{'contexts':_0x19e78d||[]});fs['writeFileSync'](_0xb56b('0x5c'),_0x4d49a0);})[_0xb56b('0x1d')](function(){return respondWithRpcPromise(_0xb56b('0x5d'),_0xb56b('0x56'),{'module':_0xb56b('0x5e')});})[_0xb56b('0x1d')](function(){var _0x5ba3f2=_0x367ba2[_0xb56b('0x5f')][_0xb56b('0x60')]({'plain':!![]});if(!_0x5ba3f2)throw new Error(_0xb56b('0x61'));if(_0x5ba3f2[_0xb56b('0x62')]==='user'){var _0x53dfb3=_0x5bfab5[_0xb56b('0x60')]({'plain':!![]});return db[_0xb56b('0x63')][_0xb56b('0x55')]({'where':{'name':_0xb56b('0x32'),'userProfileId':_0x5ba3f2[_0xb56b('0x64')]},'raw':!![]})[_0xb56b('0x1d')](function(_0x489004){if(_0x489004&&_0x489004['autoAssociation']===0x0){return db[_0xb56b('0x33')][_0xb56b('0x56')]({'name':_0x53dfb3[_0xb56b('0x36')],'resourceId':_0x53dfb3['id'],'type':_0x489004[_0xb56b('0x36')],'sectionId':_0x489004['id']},{})['then'](function(){return _0x5bfab5;});}else{return _0x5bfab5;}})['catch'](function(_0x55f327){logger['error'](_0xb56b('0x65'),_0x55f327);throw _0x55f327;});}return _0x5bfab5;})['then'](respondWithResult(_0x52598a,0xc9))[_0xb56b('0x24')](handleError(_0x52598a,null));};exports[_0xb56b('0x66')]=function(_0x457ff8,_0x2f9225,_0x450681){var _0x38ae68;return db[_0xb56b('0x39')][_0xb56b('0x55')]({'where':{'id':_0x457ff8[_0xb56b('0x53')]['id']}})[_0xb56b('0x1d')](handleEntityNotFound(_0x2f9225,null))[_0xb56b('0x1d')](saveUpdates(_0x457ff8[_0xb56b('0x57')],null))[_0xb56b('0x1d')](function(_0x590fa1){if(_0x590fa1){_0x38ae68=_0x590fa1;return db['VoiceContext'][_0xb56b('0x50')]({'raw':!![]});}})[_0xb56b('0x1d')](function(_0x4e597b){var _0x1e31f3=fs[_0xb56b('0x58')](path[_0xb56b('0x67')](config[_0xb56b('0x59')],_0xb56b('0x5a')),_0xb56b('0x5b'));var _0x1fdffd=ejs['render'](_0x1e31f3,{'contexts':_0x4e597b||[]});fs['writeFileSync'](_0xb56b('0x5c'),_0x1fdffd);})[_0xb56b('0x1d')](function(){return respondWithRpcPromise(_0xb56b('0x5d'),_0xb56b('0x66'),{'module':_0xb56b('0x5e')});})[_0xb56b('0x1d')](function(){return _0x38ae68;})['then'](respondWithResult(_0x2f9225,null))[_0xb56b('0x24')](handleError(_0x2f9225,null));};exports['destroy']=function(_0x12a8f7,_0x2ea1bb,_0x3e638b){var _0x22d111;return db['VoiceContext']['find']({'where':{'id':_0x12a8f7[_0xb56b('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ea1bb,null))[_0xb56b('0x1d')](removeEntity(_0x2ea1bb,null))[_0xb56b('0x1d')](function(){return db[_0xb56b('0x39')][_0xb56b('0x50')]({'raw':!![]});})[_0xb56b('0x1d')](function(_0x361e0b){var _0x4eb5b8=fs[_0xb56b('0x58')](path[_0xb56b('0x67')](config[_0xb56b('0x59')],_0xb56b('0x5a')),'utf8');var _0x40d5af=ejs[_0xb56b('0x68')](_0x4eb5b8,{'contexts':_0x361e0b});fs[_0xb56b('0x69')](_0xb56b('0x5c'),_0x40d5af);return respondWithRpcPromise('Reload',_0xb56b('0x34'),{'module':'chan_sip.so'});})[_0xb56b('0x24')](handleError(_0x2ea1bb,null));}; \ No newline at end of file +var _0xc00b=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','options','find','create','body','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','role','user','UserProfileSection','userProfileId','autoAssociation','server/files/templates/context.ejs','readFileSync','eml-format','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'];(function(_0x2b6372,_0x1a5f09){var _0x479331=function(_0x121d6b){while(--_0x121d6b){_0x2b6372['push'](_0x2b6372['shift']());}};_0x479331(++_0x1a5f09);}(_0xc00b,0x199));var _0xbc00=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0xc00b[_0x5cb367];return _0x279365;};'use strict';var emlformat=require(_0xbc00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc00('0x1'));var jsonpatch=require(_0xbc00('0x2'));var rp=require(_0xbc00('0x3'));var moment=require(_0xbc00('0x4'));var BPromise=require(_0xbc00('0x5'));var Mustache=require(_0xbc00('0x6'));var util=require(_0xbc00('0x7'));var path=require(_0xbc00('0x8'));var sox=require(_0xbc00('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc00('0xa'));var _=require(_0xbc00('0xb'));var squel=require(_0xbc00('0xc'));var crypto=require(_0xbc00('0xd'));var jsforce=require(_0xbc00('0xe'));var deskjs=require(_0xbc00('0xf'));var toCsv=require(_0xbc00('0x10'));var querystring=require(_0xbc00('0x11'));var Papa=require(_0xbc00('0x12'));var Redis=require(_0xbc00('0x13'));var authService=require(_0xbc00('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbc00('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbc00('0x16'));var utils=require(_0xbc00('0x17'));var config=require(_0xbc00('0x18'));var licenseUtil=require(_0xbc00('0x19'));var db=require(_0xbc00('0x1a'))['db'];var jayson=require(_0xbc00('0x1b'));var client=jayson[_0xbc00('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x99c645,_0xd58ae7,_0x23dc9d,_0x23de76){return new BPromise(function(_0x3729a7,_0x21d483){var _0x323293=_0x23de76||client;return _0x323293[_0xbc00('0x1d')](_0x99c645,_0x23dc9d)[_0xbc00('0x1e')](function(_0x5c47a1){logger[_0xbc00('0x1f')]('VoiceContext,\x20%s,\x20%s',_0xd58ae7,'request\x20sent');logger[_0xbc00('0x20')](_0xbc00('0x21'),_0xd58ae7,_0xbc00('0x22'),JSON[_0xbc00('0x23')](_0x5c47a1));if(_0x5c47a1[_0xbc00('0x24')]){if(_0x5c47a1[_0xbc00('0x24')]['code']===0x1f4){logger[_0xbc00('0x24')](_0xbc00('0x25'),_0xd58ae7,_0x5c47a1[_0xbc00('0x24')][_0xbc00('0x26')]);return _0x21d483(_0x5c47a1['error'][_0xbc00('0x26')]);}logger[_0xbc00('0x24')]('VoiceContext,\x20%s,\x20%s',_0xd58ae7,_0x5c47a1[_0xbc00('0x24')][_0xbc00('0x26')]);return _0x3729a7(_0x5c47a1['error'][_0xbc00('0x26')]);}else{logger[_0xbc00('0x1f')](_0xbc00('0x25'),_0xd58ae7,'request\x20sent');_0x3729a7(_0x5c47a1[_0xbc00('0x27')][_0xbc00('0x26')]);}})['catch'](function(_0x369911){logger['error']('VoiceContext,\x20%s,\x20%s',_0xd58ae7,_0x369911);_0x21d483(_0x369911);});});}function respondWithStatusCode(_0x36c07d,_0x255569){_0x255569=_0x255569||0xcc;return function(_0x3622c4){if(_0x3622c4){return _0x36c07d[_0xbc00('0x28')](_0x255569);}return _0x36c07d[_0xbc00('0x29')](_0x255569)[_0xbc00('0x2a')]();};}function respondWithResult(_0xaa3868,_0x3888d6){_0x3888d6=_0x3888d6||0xc8;return function(_0xac1e22){if(_0xac1e22){return _0xaa3868[_0xbc00('0x29')](_0x3888d6)[_0xbc00('0x2b')](_0xac1e22);}};}function respondWithFilteredResult(_0x2f87c5,_0x3ada61){return function(_0x1e8e58){if(_0x1e8e58){var _0x530843=typeof _0x3ada61[_0xbc00('0x2c')]==='undefined'&&typeof _0x3ada61[_0xbc00('0x2d')]===_0xbc00('0x2e');var _0x2ae5a5=_0x1e8e58[_0xbc00('0x2f')];var _0x4637ee=_0x530843?0x0:_0x3ada61['offset'];var _0x87ff4f=_0x530843?_0x1e8e58[_0xbc00('0x2f')]:_0x3ada61[_0xbc00('0x2c')]+_0x3ada61[_0xbc00('0x2d')];var _0x53a935;if(_0x87ff4f>=_0x2ae5a5){_0x87ff4f=_0x2ae5a5;_0x53a935=0xc8;}else{_0x53a935=0xce;}_0x2f87c5['status'](_0x53a935);return _0x2f87c5[_0xbc00('0x30')]('Content-Range',_0x4637ee+'-'+_0x87ff4f+'/'+_0x2ae5a5)['json'](_0x1e8e58);}return null;};}function patchUpdates(_0x3c5130){return function(_0x179524){try{jsonpatch[_0xbc00('0x31')](_0x179524,_0x3c5130,!![]);}catch(_0x4f82c5){return BPromise[_0xbc00('0x32')](_0x4f82c5);}return _0x179524[_0xbc00('0x33')]();};}function saveUpdates(_0x13607e,_0x53c909){return function(_0x420d23){if(_0x420d23){return _0x420d23[_0xbc00('0x34')](_0x13607e)['then'](function(_0x37c0e8){return _0x37c0e8;});}return null;};}function removeEntity(_0x3b3d6c,_0x525a99){return function(_0x476493){if(_0x476493){return _0x476493[_0xbc00('0x35')]()[_0xbc00('0x1e')](function(){var _0x1d0ca7=_0x476493['get']({'plain':!![]});var _0x41724c=_0xbc00('0x36');return db[_0xbc00('0x37')]['destroy']({'where':{'type':_0x41724c,'resourceId':_0x1d0ca7['id']}})[_0xbc00('0x1e')](function(){return _0x476493;});})[_0xbc00('0x1e')](function(){_0x3b3d6c[_0xbc00('0x29')](0xcc)[_0xbc00('0x2a')]();});}};}function handleEntityNotFound(_0x68a0fc,_0x334eb4){return function(_0x519a3e){if(!_0x519a3e){_0x68a0fc[_0xbc00('0x28')](0x194);}return _0x519a3e;};}function handleError(_0x344404,_0x46ee17){_0x46ee17=_0x46ee17||0x1f4;return function(_0x57d44d){logger[_0xbc00('0x24')](_0x57d44d[_0xbc00('0x38')]);if(_0x57d44d[_0xbc00('0x39')]){delete _0x57d44d[_0xbc00('0x39')];}_0x344404['status'](_0x46ee17)[_0xbc00('0x3a')](_0x57d44d);};}exports[_0xbc00('0x3b')]=function(_0x4be399,_0x457972){var _0x1f57a9={},_0x448226={},_0xd74511={'count':0x0,'rows':[]};var _0x5c902f=_[_0xbc00('0x3c')](db[_0xbc00('0x3d')][_0xbc00('0x3e')],function(_0x48280d){return{'name':_0x48280d[_0xbc00('0x3f')],'type':_0x48280d[_0xbc00('0x40')][_0xbc00('0x41')]};});_0x448226[_0xbc00('0x42')]=_['map'](_0x5c902f,'name');_0x448226[_0xbc00('0x43')]=_[_0xbc00('0x44')](_0x4be399[_0xbc00('0x43')]);_0x448226[_0xbc00('0x45')]=_['intersection'](_0x448226['model'],_0x448226[_0xbc00('0x43')]);_0x1f57a9[_0xbc00('0x46')]=_[_0xbc00('0x47')](_0x448226[_0xbc00('0x42')],qs[_0xbc00('0x48')](_0x4be399[_0xbc00('0x43')][_0xbc00('0x48')]));_0x1f57a9[_0xbc00('0x46')]=_0x1f57a9[_0xbc00('0x46')][_0xbc00('0x49')]?_0x1f57a9[_0xbc00('0x46')]:_0x448226[_0xbc00('0x42')];if(!_0x4be399[_0xbc00('0x43')][_0xbc00('0x4a')](_0xbc00('0x4b'))){_0x1f57a9['limit']=qs['limit'](_0x4be399[_0xbc00('0x43')]['limit']);_0x1f57a9[_0xbc00('0x2c')]=qs[_0xbc00('0x2c')](_0x4be399[_0xbc00('0x43')][_0xbc00('0x2c')]);}_0x1f57a9[_0xbc00('0x4c')]=qs[_0xbc00('0x4d')](_0x4be399[_0xbc00('0x43')][_0xbc00('0x4d')]);_0x1f57a9[_0xbc00('0x4e')]=qs['filters'](_['pick'](_0x4be399[_0xbc00('0x43')],_0x448226[_0xbc00('0x45')]),_0x5c902f);if(_0x4be399[_0xbc00('0x43')][_0xbc00('0x4f')]){_0x1f57a9[_0xbc00('0x4e')]=_['merge'](_0x1f57a9[_0xbc00('0x4e')],{'$or':_[_0xbc00('0x3c')](_0x5c902f,function(_0x5d0168){if(_0x5d0168[_0xbc00('0x40')]!==_0xbc00('0x50')){var _0x1ebf9b={};_0x1ebf9b[_0x5d0168['name']]={'$like':'%'+_0x4be399[_0xbc00('0x43')][_0xbc00('0x4f')]+'%'};return _0x1ebf9b;}})});}_0x1f57a9=_[_0xbc00('0x51')]({},_0x1f57a9,_0x4be399['options']);var _0x1ee589={'where':_0x1f57a9[_0xbc00('0x4e')]};return db[_0xbc00('0x3d')][_0xbc00('0x2f')](_0x1ee589)[_0xbc00('0x1e')](function(_0x4f2427){_0xd74511['count']=_0x4f2427;if(_0x4be399[_0xbc00('0x43')][_0xbc00('0x52')]){_0x1f57a9['include']=[{'all':!![]}];}return db[_0xbc00('0x3d')][_0xbc00('0x53')](_0x1f57a9);})[_0xbc00('0x1e')](function(_0x1d536a){_0xd74511[_0xbc00('0x54')]=_0x1d536a;return _0xd74511;})[_0xbc00('0x1e')](respondWithFilteredResult(_0x457972,_0x1f57a9))[_0xbc00('0x55')](handleError(_0x457972,null));};exports['show']=function(_0xa0ca75,_0x3e05fc){var _0x493b2c={'raw':![],'where':{'id':_0xa0ca75[_0xbc00('0x56')]['id']}},_0x2704b5={};_0x2704b5['model']=_[_0xbc00('0x44')](db[_0xbc00('0x3d')][_0xbc00('0x3e')]);_0x2704b5[_0xbc00('0x43')]=_[_0xbc00('0x44')](_0xa0ca75[_0xbc00('0x43')]);_0x2704b5['filters']=_[_0xbc00('0x47')](_0x2704b5['model'],_0x2704b5['query']);_0x493b2c[_0xbc00('0x46')]=_['intersection'](_0x2704b5[_0xbc00('0x42')],qs['fields'](_0xa0ca75[_0xbc00('0x43')][_0xbc00('0x48')]));_0x493b2c[_0xbc00('0x46')]=_0x493b2c[_0xbc00('0x46')][_0xbc00('0x49')]?_0x493b2c[_0xbc00('0x46')]:_0x2704b5[_0xbc00('0x42')];if(_0xa0ca75[_0xbc00('0x43')][_0xbc00('0x52')]){_0x493b2c['include']=[{'all':!![]}];}_0x493b2c=_[_0xbc00('0x51')]({},_0x493b2c,_0xa0ca75[_0xbc00('0x57')]);return db[_0xbc00('0x3d')][_0xbc00('0x58')](_0x493b2c)['then'](handleEntityNotFound(_0x3e05fc,null))[_0xbc00('0x1e')](respondWithResult(_0x3e05fc,null))[_0xbc00('0x55')](handleError(_0x3e05fc,null));};exports[_0xbc00('0x59')]=function(_0x221c1b,_0x585d11,_0x32641f){var _0x1fa585;return db[_0xbc00('0x3d')][_0xbc00('0x59')](_0x221c1b[_0xbc00('0x5a')],{'raw':!![]})[_0xbc00('0x1e')](function(_0x4ea33b){_0x1fa585=_0x4ea33b;return db[_0xbc00('0x3d')]['findAll']({'raw':!![]});})[_0xbc00('0x1e')](function(_0x36b2d2){var _0x3b3b74=fs['readFileSync'](path[_0xbc00('0x5b')](config[_0xbc00('0x5c')],'server/files/templates/context.ejs'),_0xbc00('0x5d'));var _0x3f1c53=ejs[_0xbc00('0x5e')](_0x3b3b74,{'contexts':_0x36b2d2||[]});fs[_0xbc00('0x5f')](_0xbc00('0x60'),_0x3f1c53);})[_0xbc00('0x1e')](function(){return respondWithRpcPromise(_0xbc00('0x61'),_0xbc00('0x59'),{'module':_0xbc00('0x62')});})[_0xbc00('0x1e')](function(){var _0x412112=_0x221c1b['user'][_0xbc00('0x63')]({'plain':!![]});if(!_0x412112)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x412112[_0xbc00('0x64')]===_0xbc00('0x65')){var _0x41dd3d=_0x1fa585['get']({'plain':!![]});return db[_0xbc00('0x66')]['find']({'where':{'name':_0xbc00('0x36'),'userProfileId':_0x412112[_0xbc00('0x67')]},'raw':!![]})[_0xbc00('0x1e')](function(_0xb35866){if(_0xb35866&&_0xb35866[_0xbc00('0x68')]===0x0){return db[_0xbc00('0x37')][_0xbc00('0x59')]({'name':_0x41dd3d[_0xbc00('0x39')],'resourceId':_0x41dd3d['id'],'type':_0xb35866[_0xbc00('0x39')],'sectionId':_0xb35866['id']},{})['then'](function(){return _0x1fa585;});}else{return _0x1fa585;}})[_0xbc00('0x55')](function(_0x2d66d0){logger[_0xbc00('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d66d0);throw _0x2d66d0;});}return _0x1fa585;})[_0xbc00('0x1e')](respondWithResult(_0x585d11,0xc9))[_0xbc00('0x55')](handleError(_0x585d11,null));};exports[_0xbc00('0x34')]=function(_0x38c9db,_0x1945c0,_0x117d51){var _0x3f9543;return db[_0xbc00('0x3d')][_0xbc00('0x58')]({'where':{'id':_0x38c9db[_0xbc00('0x56')]['id']}})[_0xbc00('0x1e')](handleEntityNotFound(_0x1945c0,null))[_0xbc00('0x1e')](saveUpdates(_0x38c9db['body'],null))['then'](function(_0x11b963){if(_0x11b963){_0x3f9543=_0x11b963;return db[_0xbc00('0x3d')]['findAll']({'raw':!![]});}})[_0xbc00('0x1e')](function(_0x5a90d4){var _0x51b6ce=fs['readFileSync'](path[_0xbc00('0x5b')](config[_0xbc00('0x5c')],_0xbc00('0x69')),_0xbc00('0x5d'));var _0x4231ea=ejs['render'](_0x51b6ce,{'contexts':_0x5a90d4||[]});fs[_0xbc00('0x5f')](_0xbc00('0x60'),_0x4231ea);})[_0xbc00('0x1e')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xbc00('0x62')});})[_0xbc00('0x1e')](function(){return _0x3f9543;})[_0xbc00('0x1e')](respondWithResult(_0x1945c0,null))[_0xbc00('0x55')](handleError(_0x1945c0,null));};exports['destroy']=function(_0x401c34,_0x4df793,_0x197921){var _0x53dfea;return db[_0xbc00('0x3d')]['find']({'where':{'id':_0x401c34[_0xbc00('0x56')]['id']}})[_0xbc00('0x1e')](handleEntityNotFound(_0x4df793,null))[_0xbc00('0x1e')](removeEntity(_0x4df793,null))[_0xbc00('0x1e')](function(){return db[_0xbc00('0x3d')][_0xbc00('0x53')]({'raw':!![]});})['then'](function(_0x1ede63){var _0x170165=fs[_0xbc00('0x6a')](path[_0xbc00('0x5b')](config['root'],_0xbc00('0x69')),_0xbc00('0x5d'));var _0x1011cf=ejs[_0xbc00('0x5e')](_0x170165,{'contexts':_0x1ede63});fs[_0xbc00('0x5f')](_0xbc00('0x60'),_0x1011cf);return respondWithRpcPromise('Reload',_0xbc00('0x35'),{'module':_0xbc00('0x62')});})[_0xbc00('0x55')](handleError(_0x4df793,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c72ddfd..8972012 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 _0xf3b1=['./voiceContext.attributes','exports','VoiceContext','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0xd95b29,_0x1c1831){var _0x38e058=function(_0x2084d6){while(--_0x2084d6){_0xd95b29['push'](_0xd95b29['shift']());}};_0x38e058(++_0x1c1831);}(_0xf3b1,0x1b1));var _0x1f3b=function(_0xb79225,_0x8df86a){_0xb79225=_0xb79225-0x0;var _0x4ca477=_0xf3b1[_0xb79225];return _0x4ca477;};'use strict';var _=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var logger=require('../../config/logger')(_0x1f3b('0x2'));var moment=require(_0x1f3b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f3b('0x4'));var fs=require('fs');var path=require(_0x1f3b('0x5'));var rimraf=require(_0x1f3b('0x6'));var config=require('../../config/environment');var attributes=require(_0x1f3b('0x7'));module[_0x1f3b('0x8')]=function(_0x4931b5,_0x43f36e){return _0x4931b5['define'](_0x1f3b('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26c2=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x1e3fae,_0x34807c){var _0x226530=function(_0x10b16c){while(--_0x10b16c){_0x1e3fae['push'](_0x1e3fae['shift']());}};_0x226530(++_0x34807c);}(_0x26c2,0x1d6));var _0x226c=function(_0x499658,_0x5ec3c5){_0x499658=_0x499658-0x0;var _0x5df093=_0x26c2[_0x499658];return _0x5df093;};'use strict';var _=require('lodash');var util=require(_0x226c('0x0'));var logger=require(_0x226c('0x1'))(_0x226c('0x2'));var moment=require(_0x226c('0x3'));var BPromise=require('bluebird');var rp=require(_0x226c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x226c('0x5'));var config=require(_0x226c('0x6'));var attributes=require(_0x226c('0x7'));module[_0x226c('0x8')]=function(_0x2a5393,_0x114e59){return _0x2a5393[_0x226c('0x9')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index c5bc083..b666f85 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 _0x3256=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x2ab8f6,_0x36883e){var _0x454ed6=function(_0x416e89){while(--_0x416e89){_0x2ab8f6['push'](_0x2ab8f6['shift']());}};_0x454ed6(++_0x36883e);}(_0x3256,0xee));var _0x6325=function(_0x2de2a1,_0x4f61c3){_0x2de2a1=_0x2de2a1-0x0;var _0x17b417=_0x3256[_0x2de2a1];return _0x17b417;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6325('0x0'));var BPromise=require(_0x6325('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6325('0x2'));var db=require(_0x6325('0x3'))['db'];var utils=require(_0x6325('0x4'));var logger=require(_0x6325('0x5'))('rpc');var config=require(_0x6325('0x6'));var jayson=require(_0x6325('0x7'));var client=jayson[_0x6325('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cc7df,_0x4fcdb1,_0x517d18){return new BPromise(function(_0x2c45e1,_0x5ba6d1){return client[_0x6325('0x9')](_0x2cc7df,_0x517d18)[_0x6325('0xa')](function(_0x36ebb7){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4fcdb1,_0x6325('0xb'));logger[_0x6325('0xc')](_0x6325('0xd'),_0x4fcdb1,_0x6325('0xb'),JSON[_0x6325('0xe')](_0x36ebb7));if(_0x36ebb7[_0x6325('0xf')]){if(_0x36ebb7[_0x6325('0xf')][_0x6325('0x10')]===0x1f4){logger[_0x6325('0xf')](_0x6325('0x11'),_0x4fcdb1,_0x36ebb7[_0x6325('0xf')][_0x6325('0x12')]);return _0x5ba6d1(_0x36ebb7['error']['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x4fcdb1,_0x36ebb7[_0x6325('0xf')][_0x6325('0x12')]);return _0x2c45e1(_0x36ebb7[_0x6325('0xf')][_0x6325('0x12')]);}else{logger[_0x6325('0x13')](_0x6325('0x11'),_0x4fcdb1,_0x6325('0xb'));_0x2c45e1(_0x36ebb7['result'][_0x6325('0x12')]);}})[_0x6325('0x14')](function(_0x135fb6){logger[_0x6325('0xf')](_0x6325('0x11'),_0x4fcdb1,_0x135fb6);_0x5ba6d1(_0x135fb6);});});} \ No newline at end of file +var _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x584da8,_0x4944c4){var _0x4da924=function(_0x348f16){while(--_0x348f16){_0x584da8['push'](_0x584da8['shift']());}};_0x4da924(++_0x4944c4);}(_0x505d,0x93));var _0xd505=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x505d[_0x12bcf7];return _0x2825a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('VoiceContext,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3b22e3e..c0ba288 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 _0x2843=['./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4fc5f8,_0x47e645){var _0x33be96=function(_0x470840){while(--_0x470840){_0x4fc5f8['push'](_0x4fc5f8['shift']());}};_0x33be96(++_0x47e645);}(_0x2843,0x6a));var _0x3284=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x2843[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0x3284('0x0'));var util=require(_0x3284('0x1'));var path=require(_0x3284('0x2'));var timeout=require(_0x3284('0x3'));var express=require(_0x3284('0x4'));var router=express[_0x3284('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3284('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3284('0x7'));var controller=require(_0x3284('0x8'));router[_0x3284('0x9')]('/',auth[_0x3284('0xa')](),controller[_0x3284('0xb')]);router[_0x3284('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3284('0xc')]);router['get'](_0x3284('0xd'),auth[_0x3284('0xa')](),controller['show']);router['post']('/',auth[_0x3284('0xa')](),controller[_0x3284('0xe')]);router[_0x3284('0xf')](_0x3284('0xd'),auth[_0x3284('0xa')](),controller[_0x3284('0x10')]);router[_0x3284('0x11')](_0x3284('0xd'),auth[_0x3284('0xa')](),controller['destroy']);module[_0x3284('0x12')]=router; \ No newline at end of file +var _0x3e3a=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','destroy','exports','multer','util'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x3e3a,0x17a));var _0xa3e3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3e3a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xa3e3('0x0'));var util=require(_0xa3e3('0x1'));var path=require(_0xa3e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3e3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3e3('0x4'));var interaction=require(_0xa3e3('0x5'));var config=require(_0xa3e3('0x6'));var controller=require(_0xa3e3('0x7'));router['get']('/',auth[_0xa3e3('0x8')](),controller[_0xa3e3('0x9')]);router[_0xa3e3('0xa')](_0xa3e3('0xb'),auth[_0xa3e3('0x8')](),controller['describe']);router[_0xa3e3('0xa')](_0xa3e3('0xc'),auth[_0xa3e3('0x8')](),controller[_0xa3e3('0xd')]);router[_0xa3e3('0xe')]('/',auth[_0xa3e3('0x8')](),controller[_0xa3e3('0xf')]);router[_0xa3e3('0x10')]('/:id',auth[_0xa3e3('0x8')](),controller['update']);router['delete'](_0xa3e3('0xc'),auth[_0xa3e3('0x8')](),controller[_0xa3e3('0x11')]);module[_0xa3e3('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f31efe6..6ff13f1 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 _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4f0808,_0x594e97){_0x4f0808=_0x4f0808-0x0;var _0x3b67cc=_0xd6d6[_0x4f0808];return _0x3b67cc;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x19865a,_0x3de183){var _0x4b0795=function(_0x2f74fc){while(--_0x2f74fc){_0x19865a['push'](_0x19865a['shift']());}};_0x4b0795(++_0x3de183);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f1ca0,_0x31ff13){_0x4f1ca0=_0x4f1ca0-0x0;var _0x543532=_0x9bde[_0x4f1ca0];return _0x543532;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7958e81..5c55f3f 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 _0xddb8=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5e2a11,_0xa5534){var _0x1d12f1=function(_0x164128){while(--_0x164128){_0x5e2a11['push'](_0x5e2a11['shift']());}};_0x1d12f1(++_0xa5534);}(_0xddb8,0x17f));var _0x8ddb=function(_0x27ac14,_0x366181){_0x27ac14=_0x27ac14-0x0;var _0x214cff=_0xddb8[_0x27ac14];return _0x214cff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ddb('0x0'));var zipdir=require(_0x8ddb('0x1'));var jsonpatch=require(_0x8ddb('0x2'));var rp=require(_0x8ddb('0x3'));var moment=require(_0x8ddb('0x4'));var BPromise=require(_0x8ddb('0x5'));var Mustache=require(_0x8ddb('0x6'));var util=require(_0x8ddb('0x7'));var path=require(_0x8ddb('0x8'));var sox=require(_0x8ddb('0x9'));var csv=require(_0x8ddb('0xa'));var ejs=require(_0x8ddb('0xb'));var fs=require('fs');var fs_extra=require(_0x8ddb('0xc'));var _=require(_0x8ddb('0xd'));var squel=require(_0x8ddb('0xe'));var crypto=require(_0x8ddb('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8ddb('0x10'));var toCsv=require(_0x8ddb('0xa'));var querystring=require(_0x8ddb('0x11'));var Papa=require(_0x8ddb('0x12'));var Redis=require(_0x8ddb('0x13'));var authService=require(_0x8ddb('0x14'));var qs=require(_0x8ddb('0x15'));var as=require(_0x8ddb('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ddb('0x17'));var utils=require(_0x8ddb('0x18'));var config=require(_0x8ddb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ddb('0x1a'))['db'];function respondWithStatusCode(_0x5422eb,_0xe6bb78){_0xe6bb78=_0xe6bb78||0xcc;return function(_0x255ee1){if(_0x255ee1){return _0x5422eb[_0x8ddb('0x1b')](_0xe6bb78);}return _0x5422eb['status'](_0xe6bb78)[_0x8ddb('0x1c')]();};}function respondWithResult(_0x24585a,_0x414161){_0x414161=_0x414161||0xc8;return function(_0x43fc23){if(_0x43fc23){return _0x24585a[_0x8ddb('0x1d')](_0x414161)[_0x8ddb('0x1e')](_0x43fc23);}};}function respondWithFilteredResult(_0x14cd7b,_0x44a24d){return function(_0x8a6eeb){if(_0x8a6eeb){var _0x48ec14=typeof _0x44a24d[_0x8ddb('0x1f')]===_0x8ddb('0x20')&&typeof _0x44a24d[_0x8ddb('0x21')]===_0x8ddb('0x20');var _0x3db0b6=_0x8a6eeb[_0x8ddb('0x22')];var _0x4e3909=_0x48ec14?0x0:_0x44a24d['offset'];var _0x2cd7fd=_0x48ec14?_0x8a6eeb['count']:_0x44a24d['offset']+_0x44a24d[_0x8ddb('0x21')];var _0x1aa7a9;if(_0x2cd7fd>=_0x3db0b6){_0x2cd7fd=_0x3db0b6;_0x1aa7a9=0xc8;}else{_0x1aa7a9=0xce;}_0x14cd7b['status'](_0x1aa7a9);return _0x14cd7b[_0x8ddb('0x23')](_0x8ddb('0x24'),_0x4e3909+'-'+_0x2cd7fd+'/'+_0x3db0b6)['json'](_0x8a6eeb);}return null;};}function patchUpdates(_0x40b58c){return function(_0x17c5ff){try{jsonpatch[_0x8ddb('0x25')](_0x17c5ff,_0x40b58c,!![]);}catch(_0x4d91ec){return BPromise[_0x8ddb('0x26')](_0x4d91ec);}return _0x17c5ff[_0x8ddb('0x27')]();};}function saveUpdates(_0x5d5f26,_0x242cbb){return function(_0x526b3e){if(_0x526b3e){return _0x526b3e[_0x8ddb('0x28')](_0x5d5f26)[_0x8ddb('0x29')](function(_0x510ca9){return _0x510ca9;});}return null;};}function removeEntity(_0x369dc0,_0x4b2154){return function(_0xbd9f03){if(_0xbd9f03){return _0xbd9f03['destroy']()['then'](function(){_0x369dc0[_0x8ddb('0x1d')](0xcc)[_0x8ddb('0x1c')]();});}};}function handleEntityNotFound(_0x21173f,_0x213c47){return function(_0x3194fa){if(!_0x3194fa){_0x21173f[_0x8ddb('0x1b')](0x194);}return _0x3194fa;};}function handleError(_0x3cd6a9,_0x43b8d5){_0x43b8d5=_0x43b8d5||0x1f4;return function(_0x2d3277){logger['error'](_0x2d3277[_0x8ddb('0x2a')]);if(_0x2d3277[_0x8ddb('0x2b')]){delete _0x2d3277[_0x8ddb('0x2b')];}_0x3cd6a9[_0x8ddb('0x1d')](_0x43b8d5)[_0x8ddb('0x2c')](_0x2d3277);};}exports[_0x8ddb('0x2d')]=function(_0x2b49fa,_0x6f7727){var _0x4c9339={},_0x50856e={},_0x31f2d1={'count':0x0,'rows':[]};var _0x179063=_['map'](db[_0x8ddb('0x2e')][_0x8ddb('0x2f')],function(_0x1e97b8){return{'name':_0x1e97b8[_0x8ddb('0x30')],'type':_0x1e97b8[_0x8ddb('0x31')][_0x8ddb('0x32')]};});_0x50856e[_0x8ddb('0x33')]=_[_0x8ddb('0x34')](_0x179063,_0x8ddb('0x2b'));_0x50856e['query']=_['keys'](_0x2b49fa['query']);_0x50856e[_0x8ddb('0x35')]=_[_0x8ddb('0x36')](_0x50856e[_0x8ddb('0x33')],_0x50856e[_0x8ddb('0x37')]);_0x4c9339['attributes']=_[_0x8ddb('0x36')](_0x50856e['model'],qs[_0x8ddb('0x38')](_0x2b49fa[_0x8ddb('0x37')]['fields']));_0x4c9339['attributes']=_0x4c9339[_0x8ddb('0x39')][_0x8ddb('0x3a')]?_0x4c9339[_0x8ddb('0x39')]:_0x50856e[_0x8ddb('0x33')];if(!_0x2b49fa[_0x8ddb('0x37')][_0x8ddb('0x3b')]('nolimit')){_0x4c9339['limit']=qs[_0x8ddb('0x21')](_0x2b49fa['query'][_0x8ddb('0x21')]);_0x4c9339[_0x8ddb('0x1f')]=qs[_0x8ddb('0x1f')](_0x2b49fa[_0x8ddb('0x37')][_0x8ddb('0x1f')]);}_0x4c9339['order']=qs[_0x8ddb('0x3c')](_0x2b49fa[_0x8ddb('0x37')][_0x8ddb('0x3c')]);_0x4c9339['where']=qs[_0x8ddb('0x35')](_[_0x8ddb('0x3d')](_0x2b49fa['query'],_0x50856e[_0x8ddb('0x35')]),_0x179063);if(_0x2b49fa['query'][_0x8ddb('0x3e')]){_0x4c9339[_0x8ddb('0x3f')]=_['merge'](_0x4c9339['where'],{'$or':_[_0x8ddb('0x34')](_0x179063,function(_0x37b568){if(_0x37b568[_0x8ddb('0x31')]!==_0x8ddb('0x40')){var _0x4abc1d={};_0x4abc1d[_0x37b568[_0x8ddb('0x2b')]]={'$like':'%'+_0x2b49fa[_0x8ddb('0x37')][_0x8ddb('0x3e')]+'%'};return _0x4abc1d;}})});}_0x4c9339=_[_0x8ddb('0x41')]({},_0x4c9339,_0x2b49fa[_0x8ddb('0x42')]);var _0x2671b7={'where':_0x4c9339[_0x8ddb('0x3f')]};return db['VoiceDialReport'][_0x8ddb('0x22')](_0x2671b7)[_0x8ddb('0x29')](function(_0x1ab9ba){_0x31f2d1[_0x8ddb('0x22')]=_0x1ab9ba;if(_0x2b49fa['query'][_0x8ddb('0x43')]){_0x4c9339['include']=[{'all':!![]}];}return db[_0x8ddb('0x2e')][_0x8ddb('0x44')](_0x4c9339);})[_0x8ddb('0x29')](function(_0xf28d17){_0x31f2d1[_0x8ddb('0x45')]=_0xf28d17;return _0x31f2d1;})[_0x8ddb('0x29')](respondWithFilteredResult(_0x6f7727,_0x4c9339))['catch'](handleError(_0x6f7727,null));};exports['show']=function(_0x3ddc17,_0x4be48a){var _0x5b10be={'raw':!![],'where':{'id':_0x3ddc17[_0x8ddb('0x46')]['id']}},_0x483af2={};_0x483af2[_0x8ddb('0x33')]=_[_0x8ddb('0x47')](db[_0x8ddb('0x2e')][_0x8ddb('0x2f')]);_0x483af2[_0x8ddb('0x37')]=_[_0x8ddb('0x47')](_0x3ddc17['query']);_0x483af2[_0x8ddb('0x35')]=_[_0x8ddb('0x36')](_0x483af2[_0x8ddb('0x33')],_0x483af2[_0x8ddb('0x37')]);_0x5b10be[_0x8ddb('0x39')]=_['intersection'](_0x483af2[_0x8ddb('0x33')],qs[_0x8ddb('0x38')](_0x3ddc17[_0x8ddb('0x37')][_0x8ddb('0x38')]));_0x5b10be[_0x8ddb('0x39')]=_0x5b10be[_0x8ddb('0x39')][_0x8ddb('0x3a')]?_0x5b10be[_0x8ddb('0x39')]:_0x483af2[_0x8ddb('0x33')];if(_0x3ddc17[_0x8ddb('0x37')][_0x8ddb('0x43')]){_0x5b10be[_0x8ddb('0x48')]=[{'all':!![]}];}_0x5b10be=_[_0x8ddb('0x41')]({},_0x5b10be,_0x3ddc17['options']);return db[_0x8ddb('0x2e')][_0x8ddb('0x49')](_0x5b10be)[_0x8ddb('0x29')](handleEntityNotFound(_0x4be48a,null))['then'](respondWithResult(_0x4be48a,null))[_0x8ddb('0x4a')](handleError(_0x4be48a,null));};exports[_0x8ddb('0x4b')]=function(_0x14d5eb,_0x23366b){return db[_0x8ddb('0x2e')]['create'](_0x14d5eb['body'],{})['then'](respondWithResult(_0x23366b,0xc9))[_0x8ddb('0x4a')](handleError(_0x23366b,null));};exports[_0x8ddb('0x28')]=function(_0x39dbdb,_0x135c21){if(_0x39dbdb[_0x8ddb('0x4c')]['id']){delete _0x39dbdb[_0x8ddb('0x4c')]['id'];}return db[_0x8ddb('0x2e')][_0x8ddb('0x49')]({'where':{'id':_0x39dbdb[_0x8ddb('0x46')]['id']}})[_0x8ddb('0x29')](handleEntityNotFound(_0x135c21,null))[_0x8ddb('0x29')](saveUpdates(_0x39dbdb['body'],null))[_0x8ddb('0x29')](respondWithResult(_0x135c21,null))[_0x8ddb('0x4a')](handleError(_0x135c21,null));};exports[_0x8ddb('0x4d')]=function(_0x44852c,_0x41b4b8){return db['VoiceDialReport'][_0x8ddb('0x49')]({'where':{'id':_0x44852c['params']['id']}})[_0x8ddb('0x29')](handleEntityNotFound(_0x41b4b8,null))[_0x8ddb('0x29')](removeEntity(_0x41b4b8,null))[_0x8ddb('0x4a')](handleError(_0x41b4b8,null));};exports[_0x8ddb('0x4e')]=function(_0xdbc20d,_0xfa7215){return db[_0x8ddb('0x2e')]['describe']()[_0x8ddb('0x29')](respondWithResult(_0xfa7215,null))[_0x8ddb('0x4a')](handleError(_0xfa7215,null));}; \ No newline at end of file +var _0x9274=['keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','VoiceDialReport','includeAll','findAll','rows','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map'];(function(_0x2c8f5f,_0x5193d7){var _0x3f77e3=function(_0x27bb49){while(--_0x27bb49){_0x2c8f5f['push'](_0x2c8f5f['shift']());}};_0x3f77e3(++_0x5193d7);}(_0x9274,0x18d));var _0x4927=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9274[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4927('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4927('0x1'));var jsonpatch=require(_0x4927('0x2'));var rp=require(_0x4927('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4927('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4927('0x5'));var fs=require('fs');var fs_extra=require(_0x4927('0x6'));var _=require(_0x4927('0x7'));var squel=require('squel');var crypto=require(_0x4927('0x8'));var jsforce=require(_0x4927('0x9'));var deskjs=require(_0x4927('0xa'));var toCsv=require(_0x4927('0xb'));var querystring=require(_0x4927('0xc'));var Papa=require(_0x4927('0xd'));var Redis=require(_0x4927('0xe'));var authService=require(_0x4927('0xf'));var qs=require(_0x4927('0x10'));var as=require(_0x4927('0x11'));var hardwareService=require(_0x4927('0x12'));var logger=require(_0x4927('0x13'))(_0x4927('0x14'));var utils=require(_0x4927('0x15'));var config=require(_0x4927('0x16'));var licenseUtil=require(_0x4927('0x17'));var db=require(_0x4927('0x18'))['db'];function respondWithStatusCode(_0x40181c,_0x4c69f5){_0x4c69f5=_0x4c69f5||0xcc;return function(_0x4af806){if(_0x4af806){return _0x40181c[_0x4927('0x19')](_0x4c69f5);}return _0x40181c[_0x4927('0x1a')](_0x4c69f5)[_0x4927('0x1b')]();};}function respondWithResult(_0x1f4204,_0x1176c7){_0x1176c7=_0x1176c7||0xc8;return function(_0x1672a2){if(_0x1672a2){return _0x1f4204[_0x4927('0x1a')](_0x1176c7)[_0x4927('0x1c')](_0x1672a2);}};}function respondWithFilteredResult(_0x21adac,_0xc36d2f){return function(_0x535592){if(_0x535592){var _0x1b7c0a=typeof _0xc36d2f[_0x4927('0x1d')]===_0x4927('0x1e')&&typeof _0xc36d2f[_0x4927('0x1f')]==='undefined';var _0xc40b5a=_0x535592[_0x4927('0x20')];var _0x1b6e84=_0x1b7c0a?0x0:_0xc36d2f[_0x4927('0x1d')];var _0x3ebef0=_0x1b7c0a?_0x535592[_0x4927('0x20')]:_0xc36d2f[_0x4927('0x1d')]+_0xc36d2f[_0x4927('0x1f')];var _0x45f763;if(_0x3ebef0>=_0xc40b5a){_0x3ebef0=_0xc40b5a;_0x45f763=0xc8;}else{_0x45f763=0xce;}_0x21adac[_0x4927('0x1a')](_0x45f763);return _0x21adac['set']('Content-Range',_0x1b6e84+'-'+_0x3ebef0+'/'+_0xc40b5a)[_0x4927('0x1c')](_0x535592);}return null;};}function patchUpdates(_0x3f1970){return function(_0x3c2736){try{jsonpatch[_0x4927('0x21')](_0x3c2736,_0x3f1970,!![]);}catch(_0xf4ae4b){return BPromise['reject'](_0xf4ae4b);}return _0x3c2736[_0x4927('0x22')]();};}function saveUpdates(_0x51c7d1,_0x593df4){return function(_0x57de21){if(_0x57de21){return _0x57de21[_0x4927('0x23')](_0x51c7d1)[_0x4927('0x24')](function(_0x406c12){return _0x406c12;});}return null;};}function removeEntity(_0x364392,_0x3c2dd6){return function(_0x4e8a6b){if(_0x4e8a6b){return _0x4e8a6b['destroy']()[_0x4927('0x24')](function(){_0x364392['status'](0xcc)[_0x4927('0x1b')]();});}};}function handleEntityNotFound(_0x506d7b,_0x1ed42c){return function(_0x3d101f){if(!_0x3d101f){_0x506d7b[_0x4927('0x19')](0x194);}return _0x3d101f;};}function handleError(_0x24809,_0x1e09b6){_0x1e09b6=_0x1e09b6||0x1f4;return function(_0x47a82f){logger['error'](_0x47a82f[_0x4927('0x25')]);if(_0x47a82f['name']){delete _0x47a82f[_0x4927('0x26')];}_0x24809['status'](_0x1e09b6)[_0x4927('0x27')](_0x47a82f);};}exports[_0x4927('0x28')]=function(_0x297f1e,_0x31da61){var _0x290707={},_0x400a5b={},_0x154391={'count':0x0,'rows':[]};var _0x5e94c0=_['map'](db['VoiceDialReport'][_0x4927('0x29')],function(_0x21955a){return{'name':_0x21955a[_0x4927('0x2a')],'type':_0x21955a[_0x4927('0x2b')][_0x4927('0x2c')]};});_0x400a5b[_0x4927('0x2d')]=_[_0x4927('0x2e')](_0x5e94c0,_0x4927('0x26'));_0x400a5b['query']=_[_0x4927('0x2f')](_0x297f1e[_0x4927('0x30')]);_0x400a5b[_0x4927('0x31')]=_[_0x4927('0x32')](_0x400a5b[_0x4927('0x2d')],_0x400a5b['query']);_0x290707['attributes']=_[_0x4927('0x32')](_0x400a5b[_0x4927('0x2d')],qs['fields'](_0x297f1e[_0x4927('0x30')][_0x4927('0x33')]));_0x290707[_0x4927('0x34')]=_0x290707[_0x4927('0x34')][_0x4927('0x35')]?_0x290707[_0x4927('0x34')]:_0x400a5b['model'];if(!_0x297f1e[_0x4927('0x30')]['hasOwnProperty'](_0x4927('0x36'))){_0x290707[_0x4927('0x1f')]=qs['limit'](_0x297f1e[_0x4927('0x30')][_0x4927('0x1f')]);_0x290707[_0x4927('0x1d')]=qs[_0x4927('0x1d')](_0x297f1e['query']['offset']);}_0x290707[_0x4927('0x37')]=qs['sort'](_0x297f1e[_0x4927('0x30')][_0x4927('0x38')]);_0x290707[_0x4927('0x39')]=qs[_0x4927('0x31')](_[_0x4927('0x3a')](_0x297f1e[_0x4927('0x30')],_0x400a5b[_0x4927('0x31')]),_0x5e94c0);if(_0x297f1e[_0x4927('0x30')]['filter']){_0x290707[_0x4927('0x39')]=_['merge'](_0x290707[_0x4927('0x39')],{'$or':_[_0x4927('0x2e')](_0x5e94c0,function(_0x4f7e97){if(_0x4f7e97[_0x4927('0x2b')]!==_0x4927('0x3b')){var _0x4c686e={};_0x4c686e[_0x4f7e97[_0x4927('0x26')]]={'$like':'%'+_0x297f1e[_0x4927('0x30')][_0x4927('0x3c')]+'%'};return _0x4c686e;}})});}_0x290707=_[_0x4927('0x3d')]({},_0x290707,_0x297f1e[_0x4927('0x3e')]);var _0x306c40={'where':_0x290707[_0x4927('0x39')]};return db[_0x4927('0x3f')][_0x4927('0x20')](_0x306c40)[_0x4927('0x24')](function(_0x54bdf1){_0x154391[_0x4927('0x20')]=_0x54bdf1;if(_0x297f1e[_0x4927('0x30')][_0x4927('0x40')]){_0x290707['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x4927('0x41')](_0x290707);})[_0x4927('0x24')](function(_0x5ec0c8){_0x154391[_0x4927('0x42')]=_0x5ec0c8;return _0x154391;})['then'](respondWithFilteredResult(_0x31da61,_0x290707))['catch'](handleError(_0x31da61,null));};exports['show']=function(_0x199bd2,_0x1da5fe){var _0x47af5c={'raw':!![],'where':{'id':_0x199bd2[_0x4927('0x43')]['id']}},_0x2a9be7={};_0x2a9be7[_0x4927('0x2d')]=_[_0x4927('0x2f')](db['VoiceDialReport'][_0x4927('0x29')]);_0x2a9be7[_0x4927('0x30')]=_[_0x4927('0x2f')](_0x199bd2['query']);_0x2a9be7[_0x4927('0x31')]=_['intersection'](_0x2a9be7[_0x4927('0x2d')],_0x2a9be7['query']);_0x47af5c[_0x4927('0x34')]=_[_0x4927('0x32')](_0x2a9be7['model'],qs[_0x4927('0x33')](_0x199bd2[_0x4927('0x30')]['fields']));_0x47af5c[_0x4927('0x34')]=_0x47af5c['attributes'][_0x4927('0x35')]?_0x47af5c[_0x4927('0x34')]:_0x2a9be7['model'];if(_0x199bd2['query'][_0x4927('0x40')]){_0x47af5c['include']=[{'all':!![]}];}_0x47af5c=_[_0x4927('0x3d')]({},_0x47af5c,_0x199bd2['options']);return db[_0x4927('0x3f')][_0x4927('0x44')](_0x47af5c)['then'](handleEntityNotFound(_0x1da5fe,null))['then'](respondWithResult(_0x1da5fe,null))[_0x4927('0x45')](handleError(_0x1da5fe,null));};exports[_0x4927('0x46')]=function(_0x4dca7c,_0x3d05dd){return db[_0x4927('0x3f')][_0x4927('0x46')](_0x4dca7c['body'],{})[_0x4927('0x24')](respondWithResult(_0x3d05dd,0xc9))[_0x4927('0x45')](handleError(_0x3d05dd,null));};exports[_0x4927('0x23')]=function(_0x343499,_0x255f77){if(_0x343499['body']['id']){delete _0x343499[_0x4927('0x47')]['id'];}return db['VoiceDialReport'][_0x4927('0x44')]({'where':{'id':_0x343499[_0x4927('0x43')]['id']}})['then'](handleEntityNotFound(_0x255f77,null))[_0x4927('0x24')](saveUpdates(_0x343499[_0x4927('0x47')],null))[_0x4927('0x24')](respondWithResult(_0x255f77,null))['catch'](handleError(_0x255f77,null));};exports[_0x4927('0x48')]=function(_0x4d18aa,_0x47fc48){return db['VoiceDialReport']['find']({'where':{'id':_0x4d18aa[_0x4927('0x43')]['id']}})[_0x4927('0x24')](handleEntityNotFound(_0x47fc48,null))[_0x4927('0x24')](removeEntity(_0x47fc48,null))[_0x4927('0x45')](handleError(_0x47fc48,null));};exports[_0x4927('0x49')]=function(_0x54de7e,_0x55d057){return db[_0x4927('0x3f')][_0x4927('0x49')]()[_0x4927('0x24')](respondWithResult(_0x55d057,null))[_0x4927('0x45')](handleError(_0x55d057,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c67e533..f1bf33e 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 _0x17a0=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3e99cb,_0x1d2fe0){var _0x1bc729=function(_0x40006f){while(--_0x40006f){_0x3e99cb['push'](_0x3e99cb['shift']());}};_0x1bc729(++_0x1d2fe0);}(_0x17a0,0x165));var _0x017a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x17a0[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x017a('0x0'));var logger=require(_0x017a('0x1'))(_0x017a('0x2'));var moment=require('moment');var BPromise=require(_0x017a('0x3'));var rp=require(_0x017a('0x4'));var fs=require('fs');var path=require(_0x017a('0x5'));var rimraf=require(_0x017a('0x6'));var config=require('../../config/environment');var attributes=require(_0x017a('0x7'));module[_0x017a('0x8')]=function(_0x3fccd9,_0x8d767f){return _0x3fccd9[_0x017a('0x9')](_0x017a('0xa'),attributes,{'tableName':_0x017a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x017a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x039d=['VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x301adb,_0x2632bc){var _0xa95832=function(_0x53ec46){while(--_0x53ec46){_0x301adb['push'](_0x301adb['shift']());}};_0xa95832(++_0x2632bc);}(_0x039d,0x87));var _0xd039=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x039d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd039('0x0'));var util=require(_0xd039('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd039('0x2'));var BPromise=require(_0xd039('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd039('0x4'));var config=require(_0xd039('0x5'));var attributes=require(_0xd039('0x6'));module['exports']=function(_0x35c75b,_0x7fc0c5){return _0x35c75b[_0xd039('0x7')](_0xd039('0x8'),attributes,{'tableName':_0xd039('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd039('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 70fc684..b91852d 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 _0x71da=['limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateVoiceDialReport','options','then','debug','UpdateVoiceDialReport','VoiceDialReport','update','body','raw','where','attributes'];(function(_0x5c2680,_0x410a0c){var _0x3a52f0=function(_0x27fb6c){while(--_0x27fb6c){_0x5c2680['push'](_0x5c2680['shift']());}};_0x3a52f0(++_0x410a0c);}(_0x71da,0xbb));var _0xa71d=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0x71da[_0x2aaa60];return _0x2e3fa5;};'use strict';var _=require('lodash');var util=require(_0xa71d('0x0'));var moment=require(_0xa71d('0x1'));var BPromise=require(_0xa71d('0x2'));var rs=require(_0xa71d('0x3'));var fs=require('fs');var Redis=require(_0xa71d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa71d('0x5'));var logger=require('../../config/logger')(_0xa71d('0x6'));var config=require(_0xa71d('0x7'));var jayson=require(_0xa71d('0x8'));var client=jayson['client'][_0xa71d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ec52,_0x52a5e7,_0x395f64){return new BPromise(function(_0x36e541,_0x47a30b){return client['request'](_0x11ec52,_0x395f64)['then'](function(_0x2fcd19){logger['info'](_0xa71d('0xa'),_0x52a5e7,_0xa71d('0xb'));logger['debug'](_0xa71d('0xc'),_0x52a5e7,_0xa71d('0xb'),JSON[_0xa71d('0xd')](_0x2fcd19));if(_0x2fcd19[_0xa71d('0xe')]){if(_0x2fcd19['error']['code']===0x1f4){logger[_0xa71d('0xe')](_0xa71d('0xa'),_0x52a5e7,_0x2fcd19[_0xa71d('0xe')]['message']);return _0x47a30b(_0x2fcd19['error'][_0xa71d('0xf')]);}logger[_0xa71d('0xe')](_0xa71d('0xa'),_0x52a5e7,_0x2fcd19[_0xa71d('0xe')][_0xa71d('0xf')]);return _0x36e541(_0x2fcd19[_0xa71d('0xe')][_0xa71d('0xf')]);}else{logger[_0xa71d('0x10')](_0xa71d('0xa'),_0x52a5e7,_0xa71d('0xb'));_0x36e541(_0x2fcd19[_0xa71d('0x11')][_0xa71d('0xf')]);}})[_0xa71d('0x12')](function(_0x42dc86){logger[_0xa71d('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x52a5e7,_0x42dc86);_0x47a30b(_0x42dc86);});});}exports[_0xa71d('0x13')]=function(_0xd59139){var _0x25c3d6=this;return new Promise(function(_0x2ae450,_0x3e5269){return db['VoiceDialReport']['create'](_0xd59139['body'],{'raw':_0xd59139[_0xa71d('0x14')]?_0xd59139[_0xa71d('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xa71d('0x15')](function(_0x303e40){logger['info']('CreateVoiceDialReport',_0xd59139);logger[_0xa71d('0x16')](_0xa71d('0x13'),_0xd59139,JSON[_0xa71d('0xd')](_0x303e40));_0x2ae450(_0x303e40);})['catch'](function(_0x5055ca){logger[_0xa71d('0xe')](_0xa71d('0x13'),_0x5055ca[_0xa71d('0xf')],_0xd59139);_0x3e5269(_0x25c3d6['error'](0x1f4,_0x5055ca[_0xa71d('0xf')]));});});};exports[_0xa71d('0x17')]=function(_0x3655ea){var _0x30591c=this;return new Promise(function(_0x44cb35,_0x13d52c){return db[_0xa71d('0x18')][_0xa71d('0x19')](_0x3655ea[_0xa71d('0x1a')],{'raw':_0x3655ea[_0xa71d('0x14')]?_0x3655ea['options'][_0xa71d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3655ea[_0xa71d('0x14')]?_0x3655ea[_0xa71d('0x14')][_0xa71d('0x1c')]||null:null,'attributes':_0x3655ea['options']?_0x3655ea['options'][_0xa71d('0x1d')]||null:null,'limit':_0x3655ea[_0xa71d('0x14')]?_0x3655ea[_0xa71d('0x14')][_0xa71d('0x1e')]||null:null})[_0xa71d('0x15')](function(_0x29d45c){logger[_0xa71d('0x10')](_0xa71d('0x17'),_0x3655ea);logger[_0xa71d('0x16')](_0xa71d('0x17'),_0x3655ea,JSON[_0xa71d('0xd')](_0x29d45c));_0x44cb35(_0x29d45c);})[_0xa71d('0x12')](function(_0x2d1faa){logger[_0xa71d('0xe')](_0xa71d('0x17'),_0x2d1faa[_0xa71d('0xf')],_0x3655ea);_0x13d52c(_0x30591c[_0xa71d('0xe')](0x1f4,_0x2d1faa[_0xa71d('0xf')]));});});}; \ No newline at end of file +var _0x9dfd=['rpc','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','create','body','options','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x45036a,_0x13006c){var _0x173c34=function(_0x9024a){while(--_0x9024a){_0x45036a['push'](_0x45036a['shift']());}};_0x173c34(++_0x13006c);}(_0x9dfd,0x11b));var _0xd9df=function(_0x11b828,_0x2e771c){_0x11b828=_0x11b828-0x0;var _0x23dac2=_0x9dfd[_0x11b828];return _0x23dac2;};'use strict';var _=require(_0xd9df('0x0'));var util=require(_0xd9df('0x1'));var moment=require(_0xd9df('0x2'));var BPromise=require(_0xd9df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9df('0x5'));var logger=require(_0xd9df('0x6'))(_0xd9df('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd9df('0x8')][_0xd9df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa10f18,_0x108109,_0x4a9ca2){return new BPromise(function(_0xd00355,_0x101996){return client[_0xd9df('0xa')](_0xa10f18,_0x4a9ca2)[_0xd9df('0xb')](function(_0x5a5b12){logger[_0xd9df('0xc')](_0xd9df('0xd'),_0x108109,'request\x20sent');logger[_0xd9df('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x108109,_0xd9df('0xf'),JSON[_0xd9df('0x10')](_0x5a5b12));if(_0x5a5b12[_0xd9df('0x11')]){if(_0x5a5b12[_0xd9df('0x11')]['code']===0x1f4){logger[_0xd9df('0x11')](_0xd9df('0xd'),_0x108109,_0x5a5b12[_0xd9df('0x11')]['message']);return _0x101996(_0x5a5b12[_0xd9df('0x11')][_0xd9df('0x12')]);}logger['error'](_0xd9df('0xd'),_0x108109,_0x5a5b12[_0xd9df('0x11')][_0xd9df('0x12')]);return _0xd00355(_0x5a5b12['error'][_0xd9df('0x12')]);}else{logger[_0xd9df('0xc')](_0xd9df('0xd'),_0x108109,_0xd9df('0xf'));_0xd00355(_0x5a5b12['result'][_0xd9df('0x12')]);}})['catch'](function(_0x4b1890){logger[_0xd9df('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x108109,_0x4b1890);_0x101996(_0x4b1890);});});}exports['CreateVoiceDialReport']=function(_0x3a0e2a){var _0x5824bc=this;return new Promise(function(_0x13dfc9,_0x5f356c){return db['VoiceDialReport'][_0xd9df('0x13')](_0x3a0e2a[_0xd9df('0x14')],{'raw':_0x3a0e2a[_0xd9df('0x15')]?_0x3a0e2a[_0xd9df('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2d80cd){logger[_0xd9df('0xc')](_0xd9df('0x16'),_0x3a0e2a);logger[_0xd9df('0xe')](_0xd9df('0x16'),_0x3a0e2a,JSON[_0xd9df('0x10')](_0x2d80cd));_0x13dfc9(_0x2d80cd);})[_0xd9df('0x17')](function(_0x2adc37){logger[_0xd9df('0x11')](_0xd9df('0x16'),_0x2adc37[_0xd9df('0x12')],_0x3a0e2a);_0x5f356c(_0x5824bc[_0xd9df('0x11')](0x1f4,_0x2adc37[_0xd9df('0x12')]));});});};exports[_0xd9df('0x18')]=function(_0x48d62d){var _0x3dd3fd=this;return new Promise(function(_0x224b7b,_0x1f3cce){return db['VoiceDialReport'][_0xd9df('0x19')](_0x48d62d['body'],{'raw':_0x48d62d['options']?_0x48d62d['options'][_0xd9df('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d62d['options']?_0x48d62d[_0xd9df('0x15')][_0xd9df('0x1b')]||null:null,'attributes':_0x48d62d['options']?_0x48d62d['options'][_0xd9df('0x1c')]||null:null,'limit':_0x48d62d['options']?_0x48d62d[_0xd9df('0x15')]['limit']||null:null})['then'](function(_0x505ac1){logger[_0xd9df('0xc')](_0xd9df('0x18'),_0x48d62d);logger[_0xd9df('0xe')](_0xd9df('0x18'),_0x48d62d,JSON[_0xd9df('0x10')](_0x505ac1));_0x224b7b(_0x505ac1);})['catch'](function(_0x79f941){logger[_0xd9df('0x11')](_0xd9df('0x18'),_0x79f941[_0xd9df('0x12')],_0x48d62d);_0x1f3cce(_0x3dd3fd[_0xd9df('0x11')](0x1f4,_0x79f941['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 368004c..0a440e0 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 _0xfd67=['util','path','express','fs-extra','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','destroy','exports'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xfd67,0xea));var _0x7fd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd67[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x7fd6('0x0'));var path=require(_0x7fd6('0x1'));var timeout=require('connect-timeout');var express=require(_0x7fd6('0x2'));var router=express['Router']();var fs_extra=require(_0x7fd6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7fd6('0x4'));var controller=require(_0x7fd6('0x5'));router[_0x7fd6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7fd6('0x6')](_0x7fd6('0x7'),auth[_0x7fd6('0x8')](),controller[_0x7fd6('0x9')]);router[_0x7fd6('0xa')]('/',auth['isAuthenticated'](),controller[_0x7fd6('0xb')]);router['post'](_0x7fd6('0xc'),auth[_0x7fd6('0x8')](),controller['addApplications']);router[_0x7fd6('0xd')](_0x7fd6('0x7'),auth[_0x7fd6('0x8')](),controller[_0x7fd6('0xe')]);router[_0x7fd6('0xf')](_0x7fd6('0x7'),auth[_0x7fd6('0x8')](),controller[_0x7fd6('0x10')]);module[_0x7fd6('0x11')]=router; \ No newline at end of file +var _0xe585=['path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/:id','show','post','/:id/applications','destroy','exports','multer'];(function(_0x100167,_0x430982){var _0x1346d1=function(_0xe33622){while(--_0xe33622){_0x100167['push'](_0x100167['shift']());}};_0x1346d1(++_0x430982);}(_0xe585,0x109));var _0x5e58=function(_0xeb955e,_0x4eaa5d){_0xeb955e=_0xeb955e-0x0;var _0x292b43=_0xe585[_0xeb955e];return _0x292b43;};'use strict';var multer=require(_0x5e58('0x0'));var util=require('util');var path=require(_0x5e58('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e58('0x2'));var router=express[_0x5e58('0x3')]();var fs_extra=require(_0x5e58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e58('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x5e58('0x6')](),controller['index']);router[_0x5e58('0x7')](_0x5e58('0x8'),auth['isAuthenticated'](),controller[_0x5e58('0x9')]);router[_0x5e58('0xa')]('/',auth[_0x5e58('0x6')](),controller['create']);router[_0x5e58('0xa')](_0x5e58('0xb'),auth[_0x5e58('0x6')](),controller['addApplications']);router['put'](_0x5e58('0x8'),auth[_0x5e58('0x6')](),controller['update']);router['delete']('/:id',auth[_0x5e58('0x6')](),controller[_0x5e58('0xc')]);module[_0x5e58('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2364d1d..f3e1b70 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 _0xc2f2=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','STRING','compositeIndex','ENUM','inbound','outbound'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0xc2f2,0x11b));var _0x2c2f=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xc2f2[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x2c2f('0x0'));module['exports']={'context':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![],'unique':_0x2c2f('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![],'unique':_0x2c2f('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x2c2f('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x2c2f('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2c2f('0x3')](_0x2c2f('0x4'),_0x2c2f('0x5'),_0x2c2f('0x6'),_0x2c2f('0x7'),_0x2c2f('0x8'),_0x2c2f('0x9'),_0x2c2f('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![],'defaultValue':_0x2c2f('0xb')},'IntervalId':{'type':Sequelize[_0x2c2f('0xc')]},'isApp':{'type':Sequelize[_0x2c2f('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2c2f('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x2c2f('0x1')],'defaultValue':_0x2c2f('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a4a7a){return this[_0x2c2f('0xf')](_0x2c2f('0x10'));}},'alias':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x24fe=['exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','inbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL'];(function(_0x4af746,_0x5569d0){var _0x48999d=function(_0xde700c){while(--_0xde700c){_0x4af746['push'](_0x4af746['shift']());}};_0x48999d(++_0x5569d0);}(_0x24fe,0x143));var _0xe24f=function(_0x330a28,_0x1cf022){_0x330a28=_0x330a28-0x0;var _0x3b25fb=_0x24fe[_0x330a28];return _0x3b25fb;};'use strict';var Sequelize=require('sequelize');module[_0xe24f('0x0')]={'context':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![],'unique':_0xe24f('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![],'unique':_0xe24f('0x2')},'priority':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xe24f('0x2')},'tag':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![],'defaultValue':_0xe24f('0x3')},'appdata':{'type':Sequelize[_0xe24f('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe24f('0x4')](_0xe24f('0x5'),'outbound','internal',_0xe24f('0x6'),'outbound-fax',_0xe24f('0x7'),_0xe24f('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xe24f('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe24f('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xe24f('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe24f('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe24f('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xe24f('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe24f('0xb')]},'recordingFormat':{'type':Sequelize[_0xe24f('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xe24f('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe24f('0xc')],'get':function(_0x4ea1dc){return this['getDataValue'](_0xe24f('0xd'));}},'alias':{'type':Sequelize[_0xe24f('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 d755b9c..48b25c9 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 _0x1269=['InternalRoutes','internal','filter','ignore','value','type','find','name','destroy','end','error','send','index','map','VoiceExtension','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','params','body','outbound','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes'];(function(_0x384900,_0x528c2c){var _0x285256=function(_0x1e007c){while(--_0x1e007c){_0x384900['push'](_0x384900['shift']());}};_0x285256(++_0x528c2c);}(_0x1269,0xed));var _0x9126=function(_0x27af08,_0x192c31){_0x27af08=_0x27af08-0x0;var _0x49eb8e=_0x1269[_0x27af08];return _0x49eb8e;};'use strict';var _=require(_0x9126('0x0'));var Redis=require('ioredis');var qs=require(_0x9126('0x1'));var logger=require(_0x9126('0x2'))(_0x9126('0x3'));var config=require(_0x9126('0x4'));var db=require('../../mysqldb')['db'];config[_0x9126('0x5')]=_[_0x9126('0x6')](config[_0x9126('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x9126('0x7'))(new Redis(config['redis']));require(_0x9126('0x8'))[_0x9126('0x9')](socket);function respondWithStatusCode(_0x32d199,_0x68b678){_0x68b678=_0x68b678||0xcc;return function(_0x3e7bfc){if(_0x3e7bfc){return _0x32d199[_0x9126('0xa')](_0x68b678);}return _0x32d199[_0x9126('0xb')](_0x68b678)['end']();};}function respondWithResult(_0x376a38,_0x13586c){_0x13586c=_0x13586c||0xc8;return function(_0x56590c){if(_0x56590c){return _0x376a38['status'](_0x13586c)[_0x9126('0xc')](_0x56590c);}};}function respondWithFilteredResult(_0xa7ed7a,_0x4121c9){return function(_0x3fe9b2){if(_0x3fe9b2){var _0x6a8d7f=typeof _0x4121c9[_0x9126('0xd')]===_0x9126('0xe')&&typeof _0x4121c9[_0x9126('0xf')]===_0x9126('0xe');var _0x233fa4=_0x3fe9b2[_0x9126('0x10')];var _0x4b4156=_0x6a8d7f?0x0:_0x4121c9[_0x9126('0xd')];var _0x1d6fe7=_0x6a8d7f?_0x3fe9b2['count']:_0x4121c9['offset']+_0x4121c9['limit'];var _0x20645a;if(_0x1d6fe7>=_0x233fa4){_0x1d6fe7=_0x233fa4;_0x20645a=0xc8;}else{_0x20645a=0xce;}_0xa7ed7a[_0x9126('0xb')](_0x20645a);return _0xa7ed7a[_0x9126('0x11')](_0x9126('0x12'),_0x4b4156+'-'+_0x1d6fe7+'/'+_0x233fa4)[_0x9126('0xc')](_0x3fe9b2);}return null;};}function removeEntity(_0x1a1ac7){return function(_0x265339){if(_0x265339){return _0x265339['destroy']()[_0x9126('0x13')](function(){var _0x59a10e=_0x265339[_0x9126('0x14')]({'plain':!![]});var _0x332fdd=[{'name':_0x9126('0x15'),'value':_0x9126('0x16'),'ignore':![]},{'name':_0x9126('0x17'),'value':'outbound','ignore':![]},{'name':_0x9126('0x18'),'value':_0x9126('0x19'),'ignore':![]}];var _0x3a43a7=_(_0x332fdd)[_0x9126('0x1a')](_0x9126('0x1b'))['map'](_0x9126('0x1c'))['value']();if(_['includes'](_0x3a43a7,_0x59a10e[_0x9126('0x1d')])){return;}var _0x50186f=_[_0x9126('0x1e')](_0x332fdd,[_0x9126('0x1c'),_0x59a10e['type']])[_0x9126('0x1f')];return db['UserProfileResource'][_0x9126('0x20')]({'where':{'type':_0x50186f,'resourceId':_0x59a10e['id']}})['then'](function(){return _0x265339;});})[_0x9126('0x13')](function(){_0x1a1ac7['status'](0xcc)[_0x9126('0x21')]();});}};}function handleEntityNotFound(_0x3306ce){return function(_0x2bc151){if(!_0x2bc151){_0x3306ce[_0x9126('0xa')](0x194);}return _0x2bc151;};}function handleError(_0x7a8b6e,_0x21e251){_0x21e251=_0x21e251||0x1f4;return function(_0x4fe23d){logger[_0x9126('0x22')](_0x4fe23d['stack']);if(_0x4fe23d[_0x9126('0x1f')]){delete _0x4fe23d[_0x9126('0x1f')];}_0x7a8b6e[_0x9126('0xb')](_0x21e251)[_0x9126('0x23')](_0x4fe23d);};}exports[_0x9126('0x24')]=function(_0x4d918b,_0x2aaaf8){var _0x125aa1={},_0x4c95a2={},_0x117b08={'count':0x0,'rows':[]};var _0x1a84c2=_[_0x9126('0x25')](db[_0x9126('0x26')][_0x9126('0x27')],function(_0x5c51ba){return{'name':_0x5c51ba['fieldName'],'type':_0x5c51ba[_0x9126('0x1d')][_0x9126('0x28')]};});_0x4c95a2[_0x9126('0x29')]=_[_0x9126('0x25')](_0x1a84c2,'name');_0x4c95a2[_0x9126('0x2a')]=_['keys'](_0x4d918b[_0x9126('0x2a')]);_0x4c95a2[_0x9126('0x2b')]=_[_0x9126('0x2c')](_0x4c95a2[_0x9126('0x29')],_0x4c95a2[_0x9126('0x2a')]);_0x125aa1[_0x9126('0x2d')]=_[_0x9126('0x2c')](_0x4c95a2[_0x9126('0x29')],qs[_0x9126('0x2e')](_0x4d918b['query']['fields']));_0x125aa1['attributes']=_0x125aa1['attributes'][_0x9126('0x2f')]?_0x125aa1[_0x9126('0x2d')]:_0x4c95a2[_0x9126('0x29')];if(!_0x4d918b[_0x9126('0x2a')][_0x9126('0x30')](_0x9126('0x31'))){_0x125aa1[_0x9126('0xf')]=qs['limit'](_0x4d918b[_0x9126('0x2a')][_0x9126('0xf')]);_0x125aa1[_0x9126('0xd')]=qs[_0x9126('0xd')](_0x4d918b[_0x9126('0x2a')][_0x9126('0xd')]);}_0x125aa1[_0x9126('0x32')]=qs[_0x9126('0x33')](_0x4d918b[_0x9126('0x2a')][_0x9126('0x33')]);_0x125aa1[_0x9126('0x34')]=qs[_0x9126('0x2b')](_[_0x9126('0x35')](_0x4d918b['query'],_0x4c95a2[_0x9126('0x2b')]),_0x1a84c2);if(_0x4d918b[_0x9126('0x2a')][_0x9126('0x1a')]){_0x125aa1[_0x9126('0x34')]=_[_0x9126('0x36')](_0x125aa1['where'],{'$or':_[_0x9126('0x25')](_0x1a84c2,function(_0x46de64){if(_0x46de64[_0x9126('0x1d')]!==_0x9126('0x37')){var _0x53b20d={};_0x53b20d[_0x46de64[_0x9126('0x1f')]]={'$like':'%'+_0x4d918b[_0x9126('0x2a')][_0x9126('0x1a')]+'%'};return _0x53b20d;}})});}_0x125aa1=_[_0x9126('0x36')]({},_0x125aa1,_0x4d918b['options']);var _0x28e6b9={'where':_0x125aa1[_0x9126('0x34')]};return db['VoiceExtension'][_0x9126('0x10')](_0x28e6b9)['then'](function(_0x1de421){_0x117b08[_0x9126('0x10')]=_0x1de421;if(_0x4d918b[_0x9126('0x2a')][_0x9126('0x38')]){_0x125aa1[_0x9126('0x39')]=[{'all':!![]}];}return db[_0x9126('0x26')][_0x9126('0x3a')](_0x125aa1);})[_0x9126('0x13')](function(_0x479943){_0x117b08[_0x9126('0x3b')]=_0x479943;return _0x117b08;})[_0x9126('0x13')](respondWithFilteredResult(_0x2aaaf8,_0x125aa1))[_0x9126('0x3c')](handleError(_0x2aaaf8,null));};exports[_0x9126('0x3d')]=function(_0x2ac9ba,_0x5d7d22){var _0x437640={'raw':![],'where':{'id':_0x2ac9ba['params']['id']}},_0x2ba4a9={};_0x2ba4a9[_0x9126('0x29')]=_[_0x9126('0x3e')](db[_0x9126('0x26')]['rawAttributes']);_0x2ba4a9[_0x9126('0x2a')]=_[_0x9126('0x3e')](_0x2ac9ba['query']);_0x2ba4a9[_0x9126('0x2b')]=_['intersection'](_0x2ba4a9[_0x9126('0x29')],_0x2ba4a9[_0x9126('0x2a')]);_0x437640[_0x9126('0x2d')]=_[_0x9126('0x2c')](_0x2ba4a9[_0x9126('0x29')],qs[_0x9126('0x2e')](_0x2ac9ba[_0x9126('0x2a')]['fields']));_0x437640[_0x9126('0x2d')]=_0x437640[_0x9126('0x2d')][_0x9126('0x2f')]?_0x437640['attributes']:_0x2ba4a9[_0x9126('0x29')];if(_0x2ac9ba['query'][_0x9126('0x38')]){_0x437640[_0x9126('0x39')]=[{'all':!![]}];}_0x437640=_[_0x9126('0x36')]({},_0x437640,_0x2ac9ba['options']);return db[_0x9126('0x26')][_0x9126('0x1e')](_0x437640)[_0x9126('0x13')](handleEntityNotFound(_0x5d7d22,null))[_0x9126('0x13')](respondWithResult(_0x5d7d22,null))[_0x9126('0x3c')](handleError(_0x5d7d22,null));};exports[_0x9126('0x20')]=function(_0x1a3300,_0x5728db){return db['VoiceExtension'][_0x9126('0x1e')]({'where':{'id':_0x1a3300[_0x9126('0x3f')]['id']}})[_0x9126('0x13')](handleEntityNotFound(_0x5728db,null))[_0x9126('0x13')](removeEntity(_0x5728db,null))[_0x9126('0x3c')](handleError(_0x5728db,null));};exports['create']=function(_0xbd103c,_0x21e531){if(_0xbd103c[_0x9126('0x40')]['type']===_0x9126('0x41')&&!_['startsWith'](_0xbd103c[_0x9126('0x40')][_0x9126('0x42')],'_')){_0xbd103c['body'][_0x9126('0x42')]='_'[_0x9126('0x43')](_0xbd103c[_0x9126('0x40')]['exten']);}return db[_0x9126('0x26')][_0x9126('0x44')](_0xbd103c['body'],{'raw':![]})[_0x9126('0x13')](function(_0x3d1997){var _0x2254ad=_0xbd103c[_0x9126('0x45')][_0x9126('0x14')]({'plain':!![]});if(!_0x2254ad)throw new Error(_0x9126('0x46'));if(_0x2254ad[_0x9126('0x47')]===_0x9126('0x45')){var _0x589030=_0x3d1997[_0x9126('0x14')]({'plain':!![]});var _0x285a98=[{'name':_0x9126('0x15'),'value':_0x9126('0x16')},{'name':'OutboundRoutes','value':_0x9126('0x41')},{'name':'InternalRoutes','value':'internal'}];var _0x5aaea9=_[_0x9126('0x1e')](_0x285a98,[_0x9126('0x1c'),_0x589030[_0x9126('0x1d')]])[_0x9126('0x1f')];return db[_0x9126('0x48')]['find']({'where':{'name':_0x5aaea9,'userProfileId':_0x2254ad['userProfileId']},'raw':!![]})['then'](function(_0x5f543d){if(_0x5f543d&&_0x5f543d['autoAssociation']===0x0){return db[_0x9126('0x49')]['create']({'name':_0x589030[_0x9126('0x1f')],'resourceId':_0x589030['id'],'type':_0x5f543d[_0x9126('0x1f')],'sectionId':_0x5f543d['id']},{})['then'](function(){return _0x3d1997;});}else{return _0x3d1997;}})['catch'](function(_0x3fe989){logger[_0x9126('0x22')](_0x9126('0x4a'),_0x3fe989);throw _0x3fe989;});}return _0x3d1997;})[_0x9126('0x13')](respondWithResult(_0x21e531,0xc9))[_0x9126('0x3c')](handleError(_0x21e531,null));};exports['update']=function(_0x1501f0,_0x49e322){if(_0x1501f0[_0x9126('0x40')]['id']){delete _0x1501f0[_0x9126('0x40')]['id'];}return db[_0x9126('0x26')]['find']({'where':{'id':_0x1501f0[_0x9126('0x3f')]['id']}})[_0x9126('0x13')](handleEntityNotFound(_0x49e322,null))[_0x9126('0x13')](function(_0x17a1df){if(_0x17a1df){return db[_0x9126('0x26')]['update'](_['pick'](_0x1501f0[_0x9126('0x40')],[_0x9126('0x42'),_0x9126('0x4b'),_0x9126('0x4c'),'recordingFormat','cutdigits','mandatoryDisposition','alias']),{'where':{'context':_0x17a1df[_0x9126('0x4b')],'exten':_0x17a1df[_0x9126('0x42')]},'individualHooks':!![]})['then'](function(_0x3ebd58){return _0x3ebd58;});}return null;})[_0x9126('0x13')](respondWithStatusCode(_0x49e322,null))[_0x9126('0x3c')](handleError(_0x49e322,null));};exports['addApplications']=function(_0x174054,_0x1e248e){var _0x22b589=_0x174054[_0x9126('0x3f')]['id'];var _0xa4de9e=_0x174054[_0x9126('0x40')];var _0x2f74a1=0xc8;var _0x16987d=null;return db[_0x9126('0x4d')]['transaction']({'isolationLevel':db[_0x9126('0x4d')][_0x9126('0x4e')][_0x9126('0x4f')][_0x9126('0x50')]},function(_0x163989){return db[_0x9126('0x26')][_0x9126('0x51')]({'where':{'id':_0x22b589},'transaction':_0x163989})[_0x9126('0x13')](function(_0x195c83){if(_0x195c83){return db[_0x9126('0x26')][_0x9126('0x20')]({'where':{'VoiceExtensionId':_0x22b589},'transaction':_0x163989})[_0x9126('0x13')](function(){var _0x504fb1=_['map'](_0xa4de9e,function(_0x464593){_0x464593['VoiceExtensionId']=_0x22b589;_0x464593['isApp']=!![];return _0x464593;});return _0x195c83['createRouting'](_0x504fb1);})[_0x9126('0x13')](function(_0x87a17b){return db['VoiceExtension'][_0x9126('0x52')](_0x87a17b,{'transaction':_0x163989});});}else{_0x2f74a1=0x194;_0x16987d=[];}});})['then'](function(){if(_0x2f74a1!==0x194){return db[_0x9126('0x26')][_0x9126('0x53')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22b589},'order':_0x9126('0x54')})['then'](function(_0x6353af){_0x16987d=_0x6353af;});}})['catch'](function(_0x3a92ed){_0x2f74a1=0x1f4;logger[_0x9126('0x22')](_0x3a92ed[_0x9126('0x55')]);if(_0x3a92ed[_0x9126('0x1f')]){delete _0x3a92ed['name'];}_0x16987d=_0x3a92ed;})[_0x9126('0x56')](function(){if(_0x16987d===null){_0x1e248e[_0x9126('0xa')](_0x2f74a1);}else{if(_0x2f74a1===0x1f4){_0x1e248e[_0x9126('0xb')](_0x2f74a1)[_0x9126('0x23')](_0x16987d);}else{_0x1e248e[_0x9126('0xb')](_0x2f74a1)[_0x9126('0xc')](_0x16987d);}}});}; \ No newline at end of file +var _0x56da=['createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','send','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','count','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','body','startsWith','exten','concat','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp'];(function(_0x5499d9,_0x1abd4f){var _0x52054c=function(_0x2205bc){while(--_0x2205bc){_0x5499d9['push'](_0x5499d9['shift']());}};_0x52054c(++_0x1abd4f);}(_0x56da,0x119));var _0xa56d=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0x56da[_0x53be66];return _0x9e5520;};'use strict';var _=require(_0xa56d('0x0'));var Redis=require('ioredis');var qs=require(_0xa56d('0x1'));var logger=require(_0xa56d('0x2'))('api');var config=require(_0xa56d('0x3'));var db=require(_0xa56d('0x4'))['db'];config[_0xa56d('0x5')]=_[_0xa56d('0x6')](config[_0xa56d('0x5')],{'host':_0xa56d('0x7'),'port':0x18eb});var socket=require(_0xa56d('0x8'))(new Redis(config[_0xa56d('0x5')]));require(_0xa56d('0x9'))[_0xa56d('0xa')](socket);function respondWithStatusCode(_0xf696b6,_0x53f682){_0x53f682=_0x53f682||0xcc;return function(_0x577926){if(_0x577926){return _0xf696b6[_0xa56d('0xb')](_0x53f682);}return _0xf696b6[_0xa56d('0xc')](_0x53f682)[_0xa56d('0xd')]();};}function respondWithResult(_0x100015,_0x1b33bb){_0x1b33bb=_0x1b33bb||0xc8;return function(_0x4d576b){if(_0x4d576b){return _0x100015['status'](_0x1b33bb)[_0xa56d('0xe')](_0x4d576b);}};}function respondWithFilteredResult(_0x37a76a,_0x252138){return function(_0x47988a){if(_0x47988a){var _0x21fb21=typeof _0x252138[_0xa56d('0xf')]===_0xa56d('0x10')&&typeof _0x252138['limit']===_0xa56d('0x10');var _0x44bfd8=_0x47988a[_0xa56d('0x11')];var _0x1d89e6=_0x21fb21?0x0:_0x252138[_0xa56d('0xf')];var _0x27a6ae=_0x21fb21?_0x47988a[_0xa56d('0x11')]:_0x252138[_0xa56d('0xf')]+_0x252138['limit'];var _0x37293d;if(_0x27a6ae>=_0x44bfd8){_0x27a6ae=_0x44bfd8;_0x37293d=0xc8;}else{_0x37293d=0xce;}_0x37a76a[_0xa56d('0xc')](_0x37293d);return _0x37a76a['set']('Content-Range',_0x1d89e6+'-'+_0x27a6ae+'/'+_0x44bfd8)[_0xa56d('0xe')](_0x47988a);}return null;};}function removeEntity(_0x17d8ab){return function(_0x20f901){if(_0x20f901){return _0x20f901[_0xa56d('0x12')]()[_0xa56d('0x13')](function(){var _0x5883ae=_0x20f901[_0xa56d('0x14')]({'plain':!![]});var _0x4e3e18=[{'name':_0xa56d('0x15'),'value':_0xa56d('0x16'),'ignore':![]},{'name':_0xa56d('0x17'),'value':_0xa56d('0x18'),'ignore':![]},{'name':_0xa56d('0x19'),'value':_0xa56d('0x1a'),'ignore':![]}];var _0x4abc54=_(_0x4e3e18)[_0xa56d('0x1b')]('ignore')[_0xa56d('0x1c')](_0xa56d('0x1d'))[_0xa56d('0x1d')]();if(_[_0xa56d('0x1e')](_0x4abc54,_0x5883ae[_0xa56d('0x1f')])){return;}var _0x271fe7=_[_0xa56d('0x20')](_0x4e3e18,[_0xa56d('0x1d'),_0x5883ae[_0xa56d('0x1f')]])['name'];return db[_0xa56d('0x21')][_0xa56d('0x12')]({'where':{'type':_0x271fe7,'resourceId':_0x5883ae['id']}})[_0xa56d('0x13')](function(){return _0x20f901;});})['then'](function(){_0x17d8ab['status'](0xcc)[_0xa56d('0xd')]();});}};}function handleEntityNotFound(_0x5f28b8){return function(_0x5e947d){if(!_0x5e947d){_0x5f28b8[_0xa56d('0xb')](0x194);}return _0x5e947d;};}function handleError(_0xd9e30,_0x17b917){_0x17b917=_0x17b917||0x1f4;return function(_0x2fe90e){logger[_0xa56d('0x22')](_0x2fe90e[_0xa56d('0x23')]);if(_0x2fe90e[_0xa56d('0x24')]){delete _0x2fe90e[_0xa56d('0x24')];}_0xd9e30[_0xa56d('0xc')](_0x17b917)['send'](_0x2fe90e);};}exports[_0xa56d('0x25')]=function(_0x377741,_0x2b182f){var _0x3f8402={},_0x45e40c={},_0x212ed9={'count':0x0,'rows':[]};var _0x13617e=_[_0xa56d('0x1c')](db[_0xa56d('0x26')][_0xa56d('0x27')],function(_0xb446a0){return{'name':_0xb446a0['fieldName'],'type':_0xb446a0[_0xa56d('0x1f')][_0xa56d('0x28')]};});_0x45e40c[_0xa56d('0x29')]=_['map'](_0x13617e,_0xa56d('0x24'));_0x45e40c[_0xa56d('0x2a')]=_[_0xa56d('0x2b')](_0x377741[_0xa56d('0x2a')]);_0x45e40c[_0xa56d('0x2c')]=_[_0xa56d('0x2d')](_0x45e40c[_0xa56d('0x29')],_0x45e40c[_0xa56d('0x2a')]);_0x3f8402[_0xa56d('0x2e')]=_[_0xa56d('0x2d')](_0x45e40c['model'],qs[_0xa56d('0x2f')](_0x377741[_0xa56d('0x2a')]['fields']));_0x3f8402[_0xa56d('0x2e')]=_0x3f8402[_0xa56d('0x2e')]['length']?_0x3f8402[_0xa56d('0x2e')]:_0x45e40c[_0xa56d('0x29')];if(!_0x377741[_0xa56d('0x2a')][_0xa56d('0x30')](_0xa56d('0x31'))){_0x3f8402[_0xa56d('0x32')]=qs[_0xa56d('0x32')](_0x377741[_0xa56d('0x2a')]['limit']);_0x3f8402['offset']=qs[_0xa56d('0xf')](_0x377741[_0xa56d('0x2a')]['offset']);}_0x3f8402['order']=qs[_0xa56d('0x33')](_0x377741[_0xa56d('0x2a')][_0xa56d('0x33')]);_0x3f8402['where']=qs[_0xa56d('0x2c')](_[_0xa56d('0x34')](_0x377741[_0xa56d('0x2a')],_0x45e40c[_0xa56d('0x2c')]),_0x13617e);if(_0x377741['query'][_0xa56d('0x1b')]){_0x3f8402[_0xa56d('0x35')]=_['merge'](_0x3f8402[_0xa56d('0x35')],{'$or':_['map'](_0x13617e,function(_0x5f3269){if(_0x5f3269['type']!==_0xa56d('0x36')){var _0x51261a={};_0x51261a[_0x5f3269[_0xa56d('0x24')]]={'$like':'%'+_0x377741[_0xa56d('0x2a')][_0xa56d('0x1b')]+'%'};return _0x51261a;}})});}_0x3f8402=_[_0xa56d('0x37')]({},_0x3f8402,_0x377741[_0xa56d('0x38')]);var _0xe15df5={'where':_0x3f8402[_0xa56d('0x35')]};return db['VoiceExtension'][_0xa56d('0x11')](_0xe15df5)[_0xa56d('0x13')](function(_0xc27452){_0x212ed9[_0xa56d('0x11')]=_0xc27452;if(_0x377741[_0xa56d('0x2a')]['includeAll']){_0x3f8402[_0xa56d('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa56d('0x3a')](_0x3f8402);})[_0xa56d('0x13')](function(_0x69e9bd){_0x212ed9[_0xa56d('0x3b')]=_0x69e9bd;return _0x212ed9;})['then'](respondWithFilteredResult(_0x2b182f,_0x3f8402))[_0xa56d('0x3c')](handleError(_0x2b182f,null));};exports[_0xa56d('0x3d')]=function(_0x138271,_0x435aa0){var _0x216448={'raw':![],'where':{'id':_0x138271[_0xa56d('0x3e')]['id']}},_0x3d4971={};_0x3d4971[_0xa56d('0x29')]=_[_0xa56d('0x2b')](db[_0xa56d('0x26')]['rawAttributes']);_0x3d4971[_0xa56d('0x2a')]=_[_0xa56d('0x2b')](_0x138271['query']);_0x3d4971[_0xa56d('0x2c')]=_[_0xa56d('0x2d')](_0x3d4971['model'],_0x3d4971[_0xa56d('0x2a')]);_0x216448[_0xa56d('0x2e')]=_['intersection'](_0x3d4971[_0xa56d('0x29')],qs[_0xa56d('0x2f')](_0x138271[_0xa56d('0x2a')][_0xa56d('0x2f')]));_0x216448['attributes']=_0x216448[_0xa56d('0x2e')]['length']?_0x216448[_0xa56d('0x2e')]:_0x3d4971[_0xa56d('0x29')];if(_0x138271[_0xa56d('0x2a')][_0xa56d('0x3f')]){_0x216448[_0xa56d('0x39')]=[{'all':!![]}];}_0x216448=_[_0xa56d('0x37')]({},_0x216448,_0x138271[_0xa56d('0x38')]);return db['VoiceExtension'][_0xa56d('0x20')](_0x216448)[_0xa56d('0x13')](handleEntityNotFound(_0x435aa0,null))[_0xa56d('0x13')](respondWithResult(_0x435aa0,null))['catch'](handleError(_0x435aa0,null));};exports[_0xa56d('0x12')]=function(_0x4f83a9,_0x5ef811){return db[_0xa56d('0x26')][_0xa56d('0x20')]({'where':{'id':_0x4f83a9['params']['id']}})[_0xa56d('0x13')](handleEntityNotFound(_0x5ef811,null))[_0xa56d('0x13')](removeEntity(_0x5ef811,null))['catch'](handleError(_0x5ef811,null));};exports['create']=function(_0x5fb71a,_0x1befe1){if(_0x5fb71a[_0xa56d('0x40')][_0xa56d('0x1f')]===_0xa56d('0x18')&&!_[_0xa56d('0x41')](_0x5fb71a[_0xa56d('0x40')][_0xa56d('0x42')],'_')){_0x5fb71a['body'][_0xa56d('0x42')]='_'[_0xa56d('0x43')](_0x5fb71a[_0xa56d('0x40')]['exten']);}return db[_0xa56d('0x26')][_0xa56d('0x44')](_0x5fb71a[_0xa56d('0x40')],{'raw':![]})[_0xa56d('0x13')](function(_0x9735c7){var _0x1ec121=_0x5fb71a[_0xa56d('0x45')][_0xa56d('0x14')]({'plain':!![]});if(!_0x1ec121)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ec121[_0xa56d('0x46')]===_0xa56d('0x45')){var _0x2e0ff6=_0x9735c7[_0xa56d('0x14')]({'plain':!![]});var _0x266d49=[{'name':_0xa56d('0x15'),'value':'inbound'},{'name':_0xa56d('0x17'),'value':_0xa56d('0x18')},{'name':_0xa56d('0x19'),'value':_0xa56d('0x1a')}];var _0x6e7327=_[_0xa56d('0x20')](_0x266d49,[_0xa56d('0x1d'),_0x2e0ff6['type']])[_0xa56d('0x24')];return db[_0xa56d('0x47')][_0xa56d('0x20')]({'where':{'name':_0x6e7327,'userProfileId':_0x1ec121[_0xa56d('0x48')]},'raw':!![]})[_0xa56d('0x13')](function(_0x427beb){if(_0x427beb&&_0x427beb['autoAssociation']===0x0){return db[_0xa56d('0x21')]['create']({'name':_0x2e0ff6['name'],'resourceId':_0x2e0ff6['id'],'type':_0x427beb[_0xa56d('0x24')],'sectionId':_0x427beb['id']},{})['then'](function(){return _0x9735c7;});}else{return _0x9735c7;}})[_0xa56d('0x3c')](function(_0x80e6d9){logger[_0xa56d('0x22')](_0xa56d('0x49'),_0x80e6d9);throw _0x80e6d9;});}return _0x9735c7;})[_0xa56d('0x13')](respondWithResult(_0x1befe1,0xc9))[_0xa56d('0x3c')](handleError(_0x1befe1,null));};exports['update']=function(_0x17a5da,_0x41a8b0){if(_0x17a5da[_0xa56d('0x40')]['id']){delete _0x17a5da[_0xa56d('0x40')]['id'];}return db['VoiceExtension'][_0xa56d('0x20')]({'where':{'id':_0x17a5da['params']['id']}})[_0xa56d('0x13')](handleEntityNotFound(_0x41a8b0,null))['then'](function(_0x366af5){if(_0x366af5){return db[_0xa56d('0x26')][_0xa56d('0x4a')](_[_0xa56d('0x34')](_0x17a5da['body'],[_0xa56d('0x42'),_0xa56d('0x4b'),_0xa56d('0x4c'),_0xa56d('0x4d'),'cutdigits',_0xa56d('0x4e'),_0xa56d('0x4f')]),{'where':{'context':_0x366af5[_0xa56d('0x4b')],'exten':_0x366af5[_0xa56d('0x42')]},'individualHooks':!![]})[_0xa56d('0x13')](function(_0x569059){return _0x569059;});}return null;})['then'](respondWithStatusCode(_0x41a8b0,null))['catch'](handleError(_0x41a8b0,null));};exports['addApplications']=function(_0xfa79a6,_0x40dc05){var _0x39db86=_0xfa79a6['params']['id'];var _0x429b9b=_0xfa79a6['body'];var _0x576397=0xc8;var _0x3e5931=null;return db[_0xa56d('0x50')][_0xa56d('0x51')]({'isolationLevel':db[_0xa56d('0x50')][_0xa56d('0x52')][_0xa56d('0x53')][_0xa56d('0x54')]},function(_0x50d10b){return db[_0xa56d('0x26')][_0xa56d('0x55')]({'where':{'id':_0x39db86},'transaction':_0x50d10b})[_0xa56d('0x13')](function(_0x494d5f){if(_0x494d5f){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x39db86},'transaction':_0x50d10b})[_0xa56d('0x13')](function(){var _0x506dbd=_[_0xa56d('0x1c')](_0x429b9b,function(_0xbb514a){_0xbb514a['VoiceExtensionId']=_0x39db86;_0xbb514a[_0xa56d('0x56')]=!![];return _0xbb514a;});return _0x494d5f[_0xa56d('0x57')](_0x506dbd);})[_0xa56d('0x13')](function(_0x270ef0){return db[_0xa56d('0x26')][_0xa56d('0x58')](_0x270ef0,{'transaction':_0x50d10b});});}else{_0x576397=0x194;_0x3e5931=[];}});})[_0xa56d('0x13')](function(){if(_0x576397!==0x194){return db[_0xa56d('0x26')][_0xa56d('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x39db86},'order':_0xa56d('0x5a')})[_0xa56d('0x13')](function(_0x381b84){_0x3e5931=_0x381b84;});}})['catch'](function(_0xb3ab7e){_0x576397=0x1f4;logger['error'](_0xb3ab7e['stack']);if(_0xb3ab7e[_0xa56d('0x24')]){delete _0xb3ab7e[_0xa56d('0x24')];}_0x3e5931=_0xb3ab7e;})['finally'](function(){if(_0x3e5931===null){_0x40dc05[_0xa56d('0xb')](_0x576397);}else{if(_0x576397===0x1f4){_0x40dc05[_0xa56d('0xc')](_0x576397)[_0xa56d('0x5b')](_0x3e5931);}else{_0x40dc05[_0xa56d('0xc')](_0x576397)[_0xa56d('0xe')](_0x3e5931);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 439b94e..6f9ac92 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 _0xc5ca=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x48c549,_0x226975){var _0x56e2d9=function(_0x14628c){while(--_0x14628c){_0x48c549['push'](_0x48c549['shift']());}};_0x56e2d9(++_0x226975);}(_0xc5ca,0x7f));var _0xac5c=function(_0x486cf7,_0x1fd468){_0x486cf7=_0x486cf7-0x0;var _0x177937=_0xc5ca[_0x486cf7];return _0x177937;};'use strict';var EventEmitter=require(_0xac5c('0x0'));var VoiceExtension=require(_0xac5c('0x1'))['db'][_0xac5c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xac5c('0x3')](0x0);var events={'afterCreate':_0xac5c('0x4'),'afterUpdate':_0xac5c('0x5'),'afterDestroy':_0xac5c('0x6')};function emitEvent(_0x952bd3){return function(_0xd25bb3,_0x5a2561,_0x4d257a){VoiceExtensionEvents[_0xac5c('0x7')](_0x952bd3+':'+_0xd25bb3['id'],_0xd25bb3);VoiceExtensionEvents[_0xac5c('0x7')](_0x952bd3,_0xd25bb3);_0x4d257a(null);};}for(var e in events){if(events[_0xac5c('0x8')](e)){var event=events[e];VoiceExtension[_0xac5c('0x9')](e,emitEvent(event));}}module[_0xac5c('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0d70=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x0d70,0x105));var _0x00d7=function(_0x584ed9,_0x20b653){_0x584ed9=_0x584ed9-0x0;var _0x2d34aa=_0x0d70[_0x584ed9];return _0x2d34aa;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x00d7('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x00d7('0x1')](0x0);var events={'afterCreate':_0x00d7('0x2'),'afterUpdate':_0x00d7('0x3'),'afterDestroy':_0x00d7('0x4')};function emitEvent(_0x3b6b06){return function(_0x3c95e5,_0x1dbeb1,_0x5f5140){VoiceExtensionEvents['emit'](_0x3b6b06+':'+_0x3c95e5['id'],_0x3c95e5);VoiceExtensionEvents[_0x00d7('0x5')](_0x3b6b06,_0x3c95e5);_0x5f5140(null);};}for(var e in events){if(events[_0x00d7('0x6')](e)){var event=events[e];VoiceExtension[_0x00d7('0x7')](e,emitEvent(event));}}module[_0x00d7('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 9bc6ed0..e7ebfa9 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 _0x7b3a=['outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','hasOwnProperty','answer','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','define','voice_extensions','get','Hangup','lodash','exports','type','Set','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x3bba82,_0x5463fb){var _0x3f47f0=function(_0x28ed78){while(--_0x28ed78){_0x3bba82['push'](_0x3bba82['shift']());}};_0x3f47f0(++_0x5463fb);}(_0x7b3a,0x93));var _0xa7b3=function(_0x53b911,_0x4b8ad4){_0x53b911=_0x53b911-0x0;var _0x43c0b5=_0x7b3a[_0x53b911];return _0x43c0b5;};'use strict';var _=require(_0xa7b3('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xa7b3('0x1')]=function(_0x4e809c){var _0x96238b=_0x4e809c['models'];function _0x58986f(_0x49f6f4){var _0x28af8b=0x2;var _0x444e13=[{'type':_0x49f6f4[_0xa7b3('0x2')],'app':_0xa7b3('0x3'),'appdata':'CDR(type)='+_0x49f6f4[_0xa7b3('0x2')],'context':_0x49f6f4[_0xa7b3('0x4')],'exten':_0x49f6f4[_0xa7b3('0x5')],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']},{'type':_0x49f6f4[_0xa7b3('0x2')],'app':_0x49f6f4['alias']?_0xa7b3('0x3'):_0xa7b3('0x6'),'appdata':_0x49f6f4[_0xa7b3('0x7')]?_0xa7b3('0x8')+_0x49f6f4['alias']:_0xa7b3('0x9'),'context':_0x49f6f4['context'],'exten':_0x49f6f4['exten'],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']}];if(_0x49f6f4[_0xa7b3('0x2')]===_0xa7b3('0xa')){_0x444e13[_0xa7b3('0xb')]({'type':_0xa7b3('0xa'),'app':'Set','appdata':_0xa7b3('0xc')+_0x49f6f4['id'],'context':_0x49f6f4[_0xa7b3('0x4')],'exten':_0x49f6f4[_0xa7b3('0x5')],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']});}_0x444e13[_0xa7b3('0xb')]({'type':_0x49f6f4[_0xa7b3('0x2')],'app':_0xa7b3('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x49f6f4[_0xa7b3('0x4')],'exten':_0x49f6f4[_0xa7b3('0x5')],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']},{'type':_0x49f6f4[_0xa7b3('0x2')],'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0xd'),'context':_0x49f6f4['context'],'exten':_0x49f6f4['exten'],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']},{'type':_0x49f6f4[_0xa7b3('0x2')],'app':'Set','appdata':_0xa7b3('0xe'),'context':_0x49f6f4[_0xa7b3('0x4')],'exten':_0x49f6f4['exten'],'priority':_0x28af8b++,'VoiceExtensionId':_0x49f6f4['id']});return _0x444e13;}function _0xd6ef97(_0x3f4bdb){var _0x383605=0x2;var _0x219ac5=[{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x10'),'context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb['exten'],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0x3f4bdb[_0xa7b3('0x7')]?'Set':_0xa7b3('0x6'),'appdata':_0x3f4bdb['alias']?'CDR(routeAlias)='+_0x3f4bdb[_0xa7b3('0x7')]:'No\x20alias\x20set','context':_0x3f4bdb['context'],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x11')+(_0x3f4bdb[_0xa7b3('0x12')]?_0xa7b3('0x13')+_0x3f4bdb[_0xa7b3('0x12')]+'}':_0xa7b3('0x14')),'context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0xc')+_0x3f4bdb['id'],'context':_0x3f4bdb['context'],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':'outbound','app':_0xa7b3('0x15'),'appdata':_0xa7b3('0x16')+(_0x383605+0x2)+_0xa7b3('0x17')+(_0x383605+0x1)+')','context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0x3f4bdb[_0xa7b3('0x12')]?_0xa7b3('0x18')+_0x3f4bdb[_0xa7b3('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x19'),'context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':'outbound','app':_0xa7b3('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0xe'),'context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':'Set','appdata':'outboundrouteid='+_0x3f4bdb['id'],'context':_0x3f4bdb[_0xa7b3('0x4')],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']}];if(_0x3f4bdb['hasOwnProperty']('recordingFormat')&&_0x3f4bdb[_0xa7b3('0x1a')]!==_0xa7b3('0x1b')){_0x219ac5[_0xa7b3('0xb')]({'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x1c'),'context':_0x3f4bdb['context'],'exten':_0x3f4bdb['exten'],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']},{'type':_0xa7b3('0xf'),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x1d')+_0x3f4bdb[_0xa7b3('0x1a')]||_0xa7b3('0x1e'),'context':_0x3f4bdb['context'],'exten':_0x3f4bdb[_0xa7b3('0x5')],'priority':_0x383605++,'VoiceExtensionId':_0x3f4bdb['id']});}return _0x219ac5;}function _0x27d087(_0x4c5956,_0x27f3c7){var _0x1f56e5=[{'name':_0xa7b3('0x1f'),'param':0x0},{'name':_0xa7b3('0x20'),'param':0x1},{'name':_0xa7b3('0x21'),'param':0x2},{'name':_0xa7b3('0x22'),'param':0x3}];var _0x4ad836={};var _0xb8c28b=_0x27f3c7[_0xa7b3('0x23')](',');var _0x853c15=[];for(var _0x39479c=0x0;_0x39479c<_0x1f56e5[_0xa7b3('0x24')];_0x39479c++){switch(_0x1f56e5[_0x39479c][_0xa7b3('0x25')]){case _0xa7b3('0x1f'):_0x4ad836[_0xa7b3('0x1f')]=_0xb8c28b[_0x1f56e5[_0x39479c][_0xa7b3('0x26')]][_0xa7b3('0x23')]('/')[0x1];_0x4ad836[_0xa7b3('0x27')]=_0xb8c28b[_0x1f56e5[_0x39479c][_0xa7b3('0x26')]][_0xa7b3('0x23')]('/')[0x2];_0x4ad836['prefix']=_0x4ad836['phone']?_0x4ad836[_0xa7b3('0x27')][_0xa7b3('0x23')]('$')[0x0]:undefined;_0x4ad836['phone']=_0x4c5956[_0xa7b3('0x12')]?(_0x4ad836[_0xa7b3('0x28')]||'')+'${EXTEN:'+_0x4c5956['cutdigits']+'}':(_0x4ad836[_0xa7b3('0x28')]||'')+'${EXTEN}';_0x853c15[_0x1f56e5[_0x39479c][_0xa7b3('0x26')]]=[_0xa7b3('0x29'),_0x4ad836[_0xa7b3('0x1f')],_0x4ad836['phone']][_0xa7b3('0x2a')]('/');break;case _0xa7b3('0x21'):_0x4ad836[_0xa7b3('0x21')]=_0xb8c28b[_0x1f56e5[_0x39479c]['param']];if(_0x4c5956[_0xa7b3('0x1a')]!==_0xa7b3('0x1b')){if(_0x4ad836[_0xa7b3('0x21')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x4ad836[_0xa7b3('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x4ad836[_0xa7b3('0x21')]=_0x4ad836[_0xa7b3('0x21')][_0xa7b3('0x2b')](_0xa7b3('0x2c'),'');}_0x853c15[_0x1f56e5[_0x39479c][_0xa7b3('0x26')]]=_0x4ad836[_0xa7b3('0x21')];break;default:_0x853c15[_0x1f56e5[_0x39479c]['param']]=_0xb8c28b[_0x1f56e5[_0x39479c][_0xa7b3('0x26')]];}}return _0x853c15[_0xa7b3('0x2a')](',');}function _0x255de4(_0x3d3a39,_0x540d42,_0x128259){return new Promise(function(_0x3a0f1c,_0x52eba4){var _0x4b04fd=[];if(_[_0xa7b3('0x2d')](_0x540d42))return _0x3a0f1c(_0x4b04fd);_0x96238b[_0xa7b3('0x2e')]['findAll']({'attributes':['id',_0xa7b3('0x2f'),'IntervalId'],'raw':!![]})[_0xa7b3('0x30')](function(_0x1e1696){for(var _0x3edaa4=0x0,_0x56c46c=0x0;_0x3edaa4<_0x540d42[_0xa7b3('0x24')];_0x3edaa4++,_0x56c46c=0x0){var _0x214779=_0x540d42[_0x3edaa4];var _0x2a7038=[];var _0x42fd90=[];delete _0x214779['id'];if(_0x214779[_0xa7b3('0x2f')]!==_0xa7b3('0x31')){_0x214779[_0xa7b3('0x32')]=[_0x214779[_0xa7b3('0x2f')]];}else{_0x214779[_0xa7b3('0x32')]=_0x214779[_0xa7b3('0x33')]?_[_0xa7b3('0x34')](_[_0xa7b3('0x35')](_0x1e1696,{'IntervalId':_0x214779['IntervalId']}),'interval'):[];}_0x214779[_0xa7b3('0x4')]=_0x3d3a39[_0xa7b3('0x4')];_0x214779[_0xa7b3('0x5')]=_0x3d3a39[_0xa7b3('0x5')];if(_0x214779[_0xa7b3('0x2')])_0x214779['type']=_0x214779[_0xa7b3('0x2')][_0xa7b3('0x36')]();if(_0x3d3a39['type']==='outbound'){if(_0x214779['hasOwnProperty'](_0xa7b3('0x37'))&&_0x214779['tag']&&_0x214779['tag']!=='--'){_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779[_0xa7b3('0x2')][_0xa7b3('0x36')](),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x38')+_0x214779[_0xa7b3('0x37')],'context':_0x3d3a39[_0xa7b3('0x4')],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')]+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});}_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779[_0xa7b3('0x2')]['toLowerCase'](),'app':_0xa7b3('0x15'),'appdata':_0xa7b3('0x39')+(_0x214779['callerID']?'Set(CALLERID(all)='+_0x214779[_0xa7b3('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3d3a39['context'],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779[_0xa7b3('0x32')]['length']+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});}else{if(_0x214779[_0xa7b3('0x3b')](_0xa7b3('0x3c'))){if(['queue','playback'][_0xa7b3('0x3d')](_0x214779[_0xa7b3('0x3e')]['toLowerCase']())&&_0x214779[_0xa7b3('0x3f')]!==_0xa7b3('0x40')){if(_0x214779[_0xa7b3('0x3c')]){_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779['type']['toLowerCase'](),'app':_0xa7b3('0x15'),'appdata':_0xa7b3('0x41'),'context':_0x3d3a39[_0xa7b3('0x4')],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')]+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779[_0xa7b3('0x2')]['toLowerCase'](),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x42'),'context':_0x3d3a39[_0xa7b3('0x4')],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')]+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});}else{_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779[_0xa7b3('0x2')][_0xa7b3('0x36')](),'app':_0xa7b3('0x15'),'appdata':_0xa7b3('0x43'),'context':_0x3d3a39[_0xa7b3('0x4')],'exten':_0x3d3a39['exten'],'priority':_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')]+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});_0x2a7038[_0xa7b3('0xb')]({'type':_0x214779[_0xa7b3('0x2')]['toLowerCase'](),'app':_0xa7b3('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3d3a39['context'],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779[_0xa7b3('0x32')]['length']+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});}}}}for(var _0x545860=0x0;_0x545860<_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')];_0x545860++){var _0x4da888=_0x128259+_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')];var _0x2181ad=_0x545860===_0x214779[_0xa7b3('0x32')][_0xa7b3('0x24')]-0x1?_0x128259+_0x2a7038['length']+_0x42fd90[_0xa7b3('0x24')]+0x2:_0x128259+_0x545860+0x1;_0x2a7038[_0xa7b3('0x44')](_0x545860,0x0,{'type':_0x3d3a39['type'],'app':_0xa7b3('0x45'),'appdata':_0x214779[_0xa7b3('0x32')][_0x545860]+'?'+_0x3d3a39[_0xa7b3('0x4')]+_0xa7b3('0x46')+_0x4da888+':'+_0x3d3a39[_0xa7b3('0x4')]+',${EXTEN},'+_0x2181ad,'exten':_0x3d3a39[_0xa7b3('0x5')],'context':_0x3d3a39[_0xa7b3('0x4')],'priority':_0x128259+_0x545860,'VoiceExtensionId':_0x3d3a39['id']});}if(_0x214779[_0xa7b3('0x3f')]==='outboundDial'){_0x214779[_0xa7b3('0x47')]=_0x27d087(_0x3d3a39,_0x214779[_0xa7b3('0x47')]);}if(_0x214779[_0xa7b3('0x3f')]===_0xa7b3('0x48')){_0x2a7038['push']({'type':_0x214779[_0xa7b3('0x2')][_0xa7b3('0x36')](),'app':_0xa7b3('0x3'),'appdata':_0xa7b3('0x49'),'context':_0x3d3a39[_0xa7b3('0x4')],'exten':_0x3d3a39[_0xa7b3('0x5')],'priority':_0x214779['intervals'][_0xa7b3('0x24')]+_0x128259+_0x56c46c++,'VoiceExtensionId':_0x3d3a39['id']});}_0x214779['priority']=_0x2a7038[_0xa7b3('0x24')]?_[_0xa7b3('0x4a')](_0x2a7038)[_0xa7b3('0x4b')]+0x1:_0x128259;_0x4b04fd=_[_0xa7b3('0x4c')](_0x4b04fd,_0x2a7038,[_0x214779],_0x42fd90);_0x128259=_[_0xa7b3('0x4a')](_0x4b04fd)[_0xa7b3('0x4b')]+0x1;}return _0x3a0f1c(_0x4b04fd);})['catch'](function(_0x2a77e8){_0x52eba4(_0x2a77e8);});});}return _0x4e809c[_0xa7b3('0x4d')]('VoiceExtension',attributes,{'tableName':_0xa7b3('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x7c215c){var _0x5c8f81=this[_0xa7b3('0x4f')]({'plain':!![]});var _0x1a1c2b=_0x5c8f81['type']==='outbound'?_0xd6ef97(_0x5c8f81):_0x58986f(_0x5c8f81);return _0x255de4(_0x5c8f81,_0x7c215c,_['last'](_0x1a1c2b)[_0xa7b3('0x4b')]+0x1)[_0xa7b3('0x30')](function(_0x3b07de){var _0x9b60da=_['concat'](_0x1a1c2b,_0x3b07de);_0x9b60da[_0xa7b3('0xb')]({'type':_0x5c8f81[_0xa7b3('0x2')],'app':_0xa7b3('0x50'),'exten':_0x5c8f81['exten'],'context':_0x5c8f81[_0xa7b3('0x4')],'priority':_['last'](_0x9b60da)[_0xa7b3('0x4b')]+0x1,'VoiceExtensionId':_0x5c8f81['id']});return _0x9b60da;});}}});}; \ No newline at end of file +var _0x5235=['U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','intervals','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','options','split','length','param','phone','prefix','none','indexOf'];(function(_0x86a73e,_0x21d8a9){var _0x21f65e=function(_0x2b28fa){while(--_0x2b28fa){_0x86a73e['push'](_0x86a73e['shift']());}};_0x21f65e(++_0x21d8a9);}(_0x5235,0x17f));var _0x5523=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x5235[_0x178f52];return _0x556f99;};'use strict';var _=require(_0x5523('0x0'));var attributes=require(_0x5523('0x1'));module[_0x5523('0x2')]=function(_0x5f2a2a){var _0x48b9c8=_0x5f2a2a[_0x5523('0x3')];function _0x4112e1(_0x3010d4){var _0x49207=0x2;var _0x2137e7=[{'type':_0x3010d4[_0x5523('0x4')],'app':_0x5523('0x5'),'appdata':_0x5523('0x6')+_0x3010d4[_0x5523('0x4')],'context':_0x3010d4[_0x5523('0x7')],'exten':_0x3010d4[_0x5523('0x8')],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']},{'type':_0x3010d4[_0x5523('0x4')],'app':_0x3010d4[_0x5523('0x9')]?'Set':_0x5523('0xa'),'appdata':_0x3010d4[_0x5523('0x9')]?_0x5523('0xb')+_0x3010d4[_0x5523('0x9')]:_0x5523('0xc'),'context':_0x3010d4[_0x5523('0x7')],'exten':_0x3010d4[_0x5523('0x8')],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']}];if(_0x3010d4[_0x5523('0x4')]===_0x5523('0xd')){_0x2137e7[_0x5523('0xe')]({'type':'inbound','app':_0x5523('0x5'),'appdata':_0x5523('0xf')+_0x3010d4['id'],'context':_0x3010d4[_0x5523('0x7')],'exten':_0x3010d4[_0x5523('0x8')],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']});}_0x2137e7[_0x5523('0xe')]({'type':_0x3010d4['type'],'app':_0x5523('0x5'),'appdata':_0x5523('0x10'),'context':_0x3010d4['context'],'exten':_0x3010d4['exten'],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']},{'type':_0x3010d4['type'],'app':_0x5523('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3010d4[_0x5523('0x7')],'exten':_0x3010d4[_0x5523('0x8')],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']},{'type':_0x3010d4[_0x5523('0x4')],'app':_0x5523('0x5'),'appdata':_0x5523('0x11'),'context':_0x3010d4[_0x5523('0x7')],'exten':_0x3010d4[_0x5523('0x8')],'priority':_0x49207++,'VoiceExtensionId':_0x3010d4['id']});return _0x2137e7;}function _0x2982bb(_0x3593bf){var _0x15388b=0x2;var _0x1574c0=[{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':_0x5523('0x13'),'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf['exten'],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x3593bf[_0x5523('0x9')]?_0x5523('0x5'):_0x5523('0xa'),'appdata':_0x3593bf['alias']?_0x5523('0xb')+_0x3593bf[_0x5523('0x9')]:'No\x20alias\x20set','context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':_0x5523('0x14')+(_0x3593bf[_0x5523('0x15')]?_0x5523('0x16')+_0x3593bf[_0x5523('0x15')]+'}':_0x5523('0x17')),'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf['exten'],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':_0x5523('0xf')+_0x3593bf['id'],'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x18'),'appdata':_0x5523('0x19')+(_0x15388b+0x2)+_0x5523('0x1a')+(_0x15388b+0x1)+')','context':_0x3593bf['context'],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':_0x3593bf[_0x5523('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x3593bf['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf['exten'],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':'outbound','app':'Set','appdata':_0x5523('0x10'),'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3593bf['context'],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':'outbound','app':'Set','appdata':_0x5523('0x11'),'context':_0x3593bf['context'],'exten':_0x3593bf['exten'],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':'outbound','app':_0x5523('0x5'),'appdata':_0x5523('0x1b')+_0x3593bf['id'],'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']}];if(_0x3593bf[_0x5523('0x1c')]('recordingFormat')&&_0x3593bf['recordingFormat']!=='none'){_0x1574c0[_0x5523('0xe')]({'type':'outbound','app':_0x5523('0x5'),'appdata':_0x5523('0x1d'),'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']},{'type':_0x5523('0x12'),'app':_0x5523('0x5'),'appdata':_0x5523('0x1e')+_0x3593bf[_0x5523('0x1f')]||_0x5523('0x20'),'context':_0x3593bf[_0x5523('0x7')],'exten':_0x3593bf[_0x5523('0x8')],'priority':_0x15388b++,'VoiceExtensionId':_0x3593bf['id']});}return _0x1574c0;}function _0x164fc7(_0x3ea9fe,_0x5e5c86){var _0x4ec24d=[{'name':_0x5523('0x21'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x5523('0x22'),'param':0x2},{'name':'url','param':0x3}];var _0xc745a9={};var _0x35d5f5=_0x5e5c86[_0x5523('0x23')](',');var _0x2e80b8=[];for(var _0x5ac976=0x0;_0x5ac976<_0x4ec24d[_0x5523('0x24')];_0x5ac976++){switch(_0x4ec24d[_0x5ac976]['name']){case'trunk':_0xc745a9[_0x5523('0x21')]=_0x35d5f5[_0x4ec24d[_0x5ac976][_0x5523('0x25')]][_0x5523('0x23')]('/')[0x1];_0xc745a9[_0x5523('0x26')]=_0x35d5f5[_0x4ec24d[_0x5ac976][_0x5523('0x25')]]['split']('/')[0x2];_0xc745a9[_0x5523('0x27')]=_0xc745a9[_0x5523('0x26')]?_0xc745a9[_0x5523('0x26')][_0x5523('0x23')]('$')[0x0]:undefined;_0xc745a9[_0x5523('0x26')]=_0x3ea9fe[_0x5523('0x15')]?(_0xc745a9['prefix']||'')+_0x5523('0x16')+_0x3ea9fe[_0x5523('0x15')]+'}':(_0xc745a9[_0x5523('0x27')]||'')+'${EXTEN}';_0x2e80b8[_0x4ec24d[_0x5ac976][_0x5523('0x25')]]=['SIP',_0xc745a9[_0x5523('0x21')],_0xc745a9[_0x5523('0x26')]]['join']('/');break;case _0x5523('0x22'):_0xc745a9[_0x5523('0x22')]=_0x35d5f5[_0x4ec24d[_0x5ac976][_0x5523('0x25')]];if(_0x3ea9fe[_0x5523('0x1f')]!==_0x5523('0x28')){if(_0xc745a9[_0x5523('0x22')][_0x5523('0x29')](_0x5523('0x2a'))<0x0){_0xc745a9['options']+=_0x5523('0x2a');}}else{_0xc745a9['options']=_0xc745a9[_0x5523('0x22')][_0x5523('0x2b')](_0x5523('0x2a'),'');}_0x2e80b8[_0x4ec24d[_0x5ac976][_0x5523('0x25')]]=_0xc745a9[_0x5523('0x22')];break;default:_0x2e80b8[_0x4ec24d[_0x5ac976][_0x5523('0x25')]]=_0x35d5f5[_0x4ec24d[_0x5ac976][_0x5523('0x25')]];}}return _0x2e80b8['join'](',');}function _0x544acb(_0x589e7a,_0x551a69,_0x40785c){return new Promise(function(_0x32ef79,_0x278687){var _0x57f6ab=[];if(_[_0x5523('0x2c')](_0x551a69))return _0x32ef79(_0x57f6ab);_0x48b9c8[_0x5523('0x2d')][_0x5523('0x2e')]({'attributes':['id',_0x5523('0x2f'),_0x5523('0x30')],'raw':!![]})[_0x5523('0x31')](function(_0x51bd60){for(var _0x52cd28=0x0,_0x300110=0x0;_0x52cd28<_0x551a69['length'];_0x52cd28++,_0x300110=0x0){var _0x227d79=_0x551a69[_0x52cd28];var _0x11e989=[];var _0x56cdf4=[];delete _0x227d79['id'];if(_0x227d79[_0x5523('0x2f')]!==_0x5523('0x32')){_0x227d79['intervals']=[_0x227d79[_0x5523('0x2f')]];}else{_0x227d79['intervals']=_0x227d79[_0x5523('0x30')]?_[_0x5523('0x33')](_[_0x5523('0x34')](_0x51bd60,{'IntervalId':_0x227d79[_0x5523('0x30')]}),_0x5523('0x2f')):[];}_0x227d79[_0x5523('0x7')]=_0x589e7a[_0x5523('0x7')];_0x227d79[_0x5523('0x8')]=_0x589e7a[_0x5523('0x8')];if(_0x227d79['type'])_0x227d79[_0x5523('0x4')]=_0x227d79[_0x5523('0x4')][_0x5523('0x35')]();if(_0x589e7a[_0x5523('0x4')]===_0x5523('0x12')){if(_0x227d79[_0x5523('0x1c')](_0x5523('0x36'))&&_0x227d79[_0x5523('0x36')]&&_0x227d79[_0x5523('0x36')]!=='--'){_0x11e989[_0x5523('0xe')]({'type':_0x227d79[_0x5523('0x4')][_0x5523('0x35')](),'app':_0x5523('0x5'),'appdata':_0x5523('0x37')+_0x227d79[_0x5523('0x36')],'context':_0x589e7a[_0x5523('0x7')],'exten':_0x589e7a[_0x5523('0x8')],'priority':_0x227d79['intervals'][_0x5523('0x24')]+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});}_0x11e989['push']({'type':_0x227d79[_0x5523('0x4')][_0x5523('0x35')](),'app':_0x5523('0x18'),'appdata':_0x5523('0x38')+(_0x227d79[_0x5523('0x39')]?_0x5523('0x3a')+_0x227d79[_0x5523('0x39')]+')':_0x5523('0x3b')),'context':_0x589e7a['context'],'exten':_0x589e7a['exten'],'priority':_0x227d79['intervals'][_0x5523('0x24')]+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});}else{if(_0x227d79['hasOwnProperty'](_0x5523('0x3c'))){if([_0x5523('0x3d'),_0x5523('0x3e')][_0x5523('0x3f')](_0x227d79[_0x5523('0x40')]['toLowerCase']())&&_0x227d79[_0x5523('0x41')]!==_0x5523('0x42')){if(_0x227d79[_0x5523('0x3c')]){_0x11e989[_0x5523('0xe')]({'type':_0x227d79[_0x5523('0x4')][_0x5523('0x35')](),'app':_0x5523('0x18'),'appdata':_0x5523('0x43'),'context':_0x589e7a[_0x5523('0x7')],'exten':_0x589e7a[_0x5523('0x8')],'priority':_0x227d79[_0x5523('0x44')]['length']+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});_0x11e989[_0x5523('0xe')]({'type':_0x227d79['type'][_0x5523('0x35')](),'app':'Set','appdata':_0x5523('0x45'),'context':_0x589e7a[_0x5523('0x7')],'exten':_0x589e7a[_0x5523('0x8')],'priority':_0x227d79['intervals'][_0x5523('0x24')]+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});}else{_0x11e989[_0x5523('0xe')]({'type':_0x227d79[_0x5523('0x4')][_0x5523('0x35')](),'app':_0x5523('0x18'),'appdata':_0x5523('0x46'),'context':_0x589e7a['context'],'exten':_0x589e7a[_0x5523('0x8')],'priority':_0x227d79['intervals']['length']+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});_0x11e989['push']({'type':_0x227d79[_0x5523('0x4')][_0x5523('0x35')](),'app':_0x5523('0x5'),'appdata':_0x5523('0x47'),'context':_0x589e7a[_0x5523('0x7')],'exten':_0x589e7a['exten'],'priority':_0x227d79[_0x5523('0x44')]['length']+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});}}}}for(var _0x4df31f=0x0;_0x4df31f<_0x227d79[_0x5523('0x44')][_0x5523('0x24')];_0x4df31f++){var _0x5d7f71=_0x40785c+_0x227d79[_0x5523('0x44')][_0x5523('0x24')];var _0x4c58a3=_0x4df31f===_0x227d79[_0x5523('0x44')][_0x5523('0x24')]-0x1?_0x40785c+_0x11e989['length']+_0x56cdf4[_0x5523('0x24')]+0x2:_0x40785c+_0x4df31f+0x1;_0x11e989[_0x5523('0x48')](_0x4df31f,0x0,{'type':_0x589e7a['type'],'app':'GotoIfTime','appdata':_0x227d79[_0x5523('0x44')][_0x4df31f]+'?'+_0x589e7a[_0x5523('0x7')]+_0x5523('0x49')+_0x5d7f71+':'+_0x589e7a['context']+',${EXTEN},'+_0x4c58a3,'exten':_0x589e7a[_0x5523('0x8')],'context':_0x589e7a[_0x5523('0x7')],'priority':_0x40785c+_0x4df31f,'VoiceExtensionId':_0x589e7a['id']});}if(_0x227d79[_0x5523('0x41')]===_0x5523('0x4a')){_0x227d79['appdata']=_0x164fc7(_0x589e7a,_0x227d79[_0x5523('0x4b')]);}if(_0x227d79['appType']===_0x5523('0x4c')){_0x11e989[_0x5523('0xe')]({'type':_0x227d79[_0x5523('0x4')]['toLowerCase'](),'app':_0x5523('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x589e7a[_0x5523('0x7')],'exten':_0x589e7a[_0x5523('0x8')],'priority':_0x227d79['intervals'][_0x5523('0x24')]+_0x40785c+_0x300110++,'VoiceExtensionId':_0x589e7a['id']});}_0x227d79[_0x5523('0x4d')]=_0x11e989[_0x5523('0x24')]?_[_0x5523('0x4e')](_0x11e989)[_0x5523('0x4d')]+0x1:_0x40785c;_0x57f6ab=_[_0x5523('0x4f')](_0x57f6ab,_0x11e989,[_0x227d79],_0x56cdf4);_0x40785c=_[_0x5523('0x4e')](_0x57f6ab)['priority']+0x1;}return _0x32ef79(_0x57f6ab);})[_0x5523('0x50')](function(_0x314a9c){_0x278687(_0x314a9c);});});}return _0x5f2a2a[_0x5523('0x51')](_0x5523('0x52'),attributes,{'tableName':_0x5523('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4c692b){var _0x349b11=this[_0x5523('0x54')]({'plain':!![]});var _0x5ae1dc=_0x349b11[_0x5523('0x4')]==='outbound'?_0x2982bb(_0x349b11):_0x4112e1(_0x349b11);return _0x544acb(_0x349b11,_0x4c692b,_[_0x5523('0x4e')](_0x5ae1dc)[_0x5523('0x4d')]+0x1)['then'](function(_0x1c643d){var _0x943c2f=_[_0x5523('0x4f')](_0x5ae1dc,_0x1c643d);_0x943c2f['push']({'type':_0x349b11['type'],'app':'Hangup','exten':_0x349b11[_0x5523('0x8')],'context':_0x349b11[_0x5523('0x7')],'priority':_['last'](_0x943c2f)[_0x5523('0x4d')]+0x1,'VoiceExtensionId':_0x349b11['id']});return _0x943c2f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 61fc6dc..3834cca 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 _0x1228=['socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension','VoiceExtension','options','raw','where','limit','include','map','model','attributes','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x38e47a,_0xc032eb){var _0x1b0649=function(_0x392ba2){while(--_0x392ba2){_0x38e47a['push'](_0x38e47a['shift']());}};_0x1b0649(++_0xc032eb);}(_0x1228,0x12f));var _0x8122=function(_0x4287e9,_0x31f01c){_0x4287e9=_0x4287e9-0x0;var _0x2f8390=_0x1228[_0x4287e9];return _0x2f8390;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});}exports[_0x8122('0x18')]=function(_0x5a5a57){var _0x5df55f=this;return new Promise(function(_0x1162a8,_0x174321){return db[_0x8122('0x19')]['findAll']({'raw':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1c')]||null:null,'attributes':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')]['attributes']||null:null,'limit':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57['options'][_0x8122('0x1d')]||null:null,'include':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')],function(_0x2708a5){return{'model':db[_0x2708a5[_0x8122('0x20')]],'as':_0x2708a5['as'],'attributes':_0x2708a5['attributes'],'include':_0x2708a5[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x2708a5[_0x8122('0x1e')],function(_0xc90a18){return{'model':db[_0xc90a18[_0x8122('0x20')]],'as':_0xc90a18['as'],'attributes':_0xc90a18[_0x8122('0x21')],'include':_0xc90a18[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0xc90a18[_0x8122('0x1e')],function(_0x4610b1){return{'model':db[_0x4610b1['model']],'as':_0x4610b1['as'],'attributes':_0x4610b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8122('0xf')](function(_0x264ccf){logger['info']('GetVoiceExtension',_0x5a5a57);logger[_0x8122('0x22')](_0x8122('0x18'),_0x5a5a57,JSON[_0x8122('0x13')](_0x264ccf));_0x1162a8(_0x264ccf);})['catch'](function(_0x4c8339){logger[_0x8122('0x14')](_0x8122('0x18'),_0x4c8339[_0x8122('0x17')],_0x5a5a57);_0x174321(_0x5df55f[_0x8122('0x14')](0x1f4,_0x4c8339[_0x8122('0x17')]));});});}; \ No newline at end of file +var _0x4f5a=['include','map','model','GetVoiceExtension','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','info','debug','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','VoiceExtension','options','raw','where','attributes','limit'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x164adc,_0x28824a){_0x164adc=_0x164adc-0x0;var _0x3aae12=_0x4f5a[_0x164adc];return _0x3aae12;};'use strict';var _=require(_0xa4f5('0x0'));var util=require(_0xa4f5('0x1'));var moment=require('moment');var BPromise=require(_0xa4f5('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(_0xa4f5('0x3'))(_0xa4f5('0x4'));var config=require('../../config/environment');var jayson=require(_0xa4f5('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa4f5('0x6')](config[_0xa4f5('0x7')],{'host':_0xa4f5('0x8'),'port':0x18eb});var socket=require(_0xa4f5('0x9'))(new Redis(config[_0xa4f5('0x7')]));require('./voiceExtension.socket')[_0xa4f5('0xa')](socket);function respondWithRpcPromise(_0x545ccb,_0x518a50,_0x3b61e0){return new BPromise(function(_0x4a27f2,_0xae1fee){return client[_0xa4f5('0xb')](_0x545ccb,_0x3b61e0)[_0xa4f5('0xc')](function(_0xb73ffe){logger[_0xa4f5('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x518a50,'request\x20sent');logger[_0xa4f5('0xe')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x518a50,_0xa4f5('0xf'),JSON[_0xa4f5('0x10')](_0xb73ffe));if(_0xb73ffe[_0xa4f5('0x11')]){if(_0xb73ffe[_0xa4f5('0x11')][_0xa4f5('0x12')]===0x1f4){logger['error'](_0xa4f5('0x13'),_0x518a50,_0xb73ffe[_0xa4f5('0x11')][_0xa4f5('0x14')]);return _0xae1fee(_0xb73ffe['error'][_0xa4f5('0x14')]);}logger['error'](_0xa4f5('0x13'),_0x518a50,_0xb73ffe[_0xa4f5('0x11')]['message']);return _0x4a27f2(_0xb73ffe[_0xa4f5('0x11')][_0xa4f5('0x14')]);}else{logger[_0xa4f5('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x518a50,_0xa4f5('0xf'));_0x4a27f2(_0xb73ffe[_0xa4f5('0x15')][_0xa4f5('0x14')]);}})['catch'](function(_0x315408){logger[_0xa4f5('0x11')](_0xa4f5('0x13'),_0x518a50,_0x315408);_0xae1fee(_0x315408);});});}exports['GetVoiceExtension']=function(_0x34d201){var _0x16818d=this;return new Promise(function(_0x2a569c,_0x2b3f57){return db[_0xa4f5('0x16')]['findAll']({'raw':_0x34d201[_0xa4f5('0x17')]?_0x34d201['options'][_0xa4f5('0x18')]===undefined?!![]:![]:!![],'where':_0x34d201[_0xa4f5('0x17')]?_0x34d201[_0xa4f5('0x17')][_0xa4f5('0x19')]||null:null,'attributes':_0x34d201['options']?_0x34d201[_0xa4f5('0x17')][_0xa4f5('0x1a')]||null:null,'limit':_0x34d201[_0xa4f5('0x17')]?_0x34d201[_0xa4f5('0x17')][_0xa4f5('0x1b')]||null:null,'include':_0x34d201[_0xa4f5('0x17')]?_0x34d201['options'][_0xa4f5('0x1c')]?_[_0xa4f5('0x1d')](_0x34d201[_0xa4f5('0x17')]['include'],function(_0x3cebfd){return{'model':db[_0x3cebfd[_0xa4f5('0x1e')]],'as':_0x3cebfd['as'],'attributes':_0x3cebfd[_0xa4f5('0x1a')],'include':_0x3cebfd[_0xa4f5('0x1c')]?_[_0xa4f5('0x1d')](_0x3cebfd['include'],function(_0x2d348a){return{'model':db[_0x2d348a['model']],'as':_0x2d348a['as'],'attributes':_0x2d348a[_0xa4f5('0x1a')],'include':_0x2d348a[_0xa4f5('0x1c')]?_[_0xa4f5('0x1d')](_0x2d348a['include'],function(_0x115869){return{'model':db[_0x115869[_0xa4f5('0x1e')]],'as':_0x115869['as'],'attributes':_0x115869[_0xa4f5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x233eed){logger[_0xa4f5('0xd')](_0xa4f5('0x1f'),_0x34d201);logger['debug'](_0xa4f5('0x1f'),_0x34d201,JSON['stringify'](_0x233eed));_0x2a569c(_0x233eed);})[_0xa4f5('0x20')](function(_0x5eb754){logger[_0xa4f5('0x11')](_0xa4f5('0x1f'),_0x5eb754['message'],_0x34d201);_0x2b3f57(_0x16818d[_0xa4f5('0x11')](0x1f4,_0x5eb754['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 04ec2c2..1182d28 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x304f39,_0x8d26df){var _0x3d2608=function(_0x431358){while(--_0x431358){_0x304f39['push'](_0x304f39['shift']());}};_0x3d2608(++_0x8d26df);}(_0x7a54,0x106));var _0x47a5=function(_0x210fc3,_0x5197f0){_0x210fc3=_0x210fc3-0x0;var _0x36f77f=_0x7a54[_0x210fc3];return _0x36f77f;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x58125b,_0x58be3f){var _0x4a502a=function(_0x4e9b0f){while(--_0x4e9b0f){_0x58125b['push'](_0x58125b['shift']());}};_0x4a502a(++_0x58be3f);}(_0xf494,0x1c6));var _0x4f49=function(_0x755acf,_0x5da49f){_0x755acf=_0x755acf-0x0;var _0xdbea7=_0xf494[_0x755acf];return _0xdbea7;};'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 c4f46a4..94cf6fc 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 _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post','create','put','update'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x7046,0x144));var _0x6704=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7046[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6704('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0xe')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x10')](_0x6704('0xc'),auth[_0x6704('0xa')](),controller[_0x6704('0x11')]);router['delete'](_0x6704('0xc'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router; \ No newline at end of file +var _0xfcf0=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put'];(function(_0x4339ff,_0x48c25a){var _0x285fa5=function(_0x4add55){while(--_0x4add55){_0x4339ff['push'](_0x4339ff['shift']());}};_0x285fa5(++_0x48c25a);}(_0xfcf0,0x138));var _0x0fcf=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0xfcf0[_0xa4928c];return _0x27cc29;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x10')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x11')]('/:id',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);router[_0x0fcf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);module[_0x0fcf('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 867066e..46588de 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 _0xa018=['exports','STRING','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa018,0x1ef));var _0x8a01=function(_0x1a29c8,_0x4490b7){_0x1a29c8=_0x1a29c8-0x0;var _0x5e6869=_0xa018[_0x1a29c8];return _0x5e6869;};'use strict';var Sequelize=require(_0x8a01('0x0'));module[_0x8a01('0x1')]={'customer_id':{'type':Sequelize[_0x8a01('0x2')]},'context':{'type':Sequelize[_0x8a01('0x2')],'defaultValue':'from-voicemail','unique':_0x8a01('0x3')},'mailbox':{'type':Sequelize[_0x8a01('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8a01('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8a01('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2f12a2){this['setDataValue'](_0x8a01('0x4'),typeof _0x2f12a2===_0x8a01('0x5')&&_0x2f12a2[_0x8a01('0x6')]()?_0x2f12a2[_0x8a01('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x8a01('0x2')],'defaultValue':_0x8a01('0x7')},'attach':{'type':Sequelize[_0x8a01('0x8')](_0x8a01('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':_0x8a01('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8a01('0x2')]},'callback':{'type':Sequelize[_0x8a01('0x2')]},'review':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8a01('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8a01('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8a01('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8a01('0x8')](_0x8a01('0x9'),'no'),'defaultValue':_0x8a01('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8a01('0x8')](_0x8a01('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8a01('0x9'),'no'),'defaultValue':_0x8a01('0x9'),'allowNull':![]},'stamp':{'type':_0x8a01('0xb')},'emailsubject':{'type':Sequelize[_0x8a01('0x2')]},'emailbody':{'type':Sequelize[_0x8a01('0x2')]},'maxsecs':{'type':Sequelize[_0x8a01('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8a01('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8a01('0xd')],'get':function(){return this['getDataValue'](_0x8a01('0xe'))+'\x20-\x20'+this[_0x8a01('0xf')]('mailbox');}}}; \ No newline at end of file +var _0xad5c=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad5c,0xef));var _0xcad5=function(_0x5e8406,_0x179ea2){_0x5e8406=_0x5e8406-0x0;var _0x516ca2=_0xad5c[_0x5e8406];return _0x516ca2;};'use strict';var Sequelize=require('sequelize');module[_0xcad5('0x0')]={'customer_id':{'type':Sequelize[_0xcad5('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xcad5('0x2'),'unique':_0xcad5('0x3')},'mailbox':{'type':Sequelize[_0xcad5('0x1')],'defaultValue':'','allowNull':![],'unique':_0xcad5('0x3')},'password':{'type':Sequelize[_0xcad5('0x1')]},'fullname':{'type':Sequelize[_0xcad5('0x1')]},'email':{'type':Sequelize[_0xcad5('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4ee82e){this[_0xcad5('0x4')](_0xcad5('0x5'),typeof _0x4ee82e===_0xcad5('0x6')&&_0x4ee82e[_0xcad5('0x7')]()?_0x4ee82e[_0xcad5('0x7')]():null);}},'pager':{'type':Sequelize[_0xcad5('0x1')]},'tz':{'type':Sequelize[_0xcad5('0x1')],'defaultValue':_0xcad5('0x8')},'attach':{'type':Sequelize[_0xcad5('0x9')]('yes','no'),'defaultValue':_0xcad5('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':_0xcad5('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xcad5('0x1')]},'review':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xcad5('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xcad5('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xcad5('0x9')](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xcad5('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xcad5('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xcad5('0xc')},'emailsubject':{'type':Sequelize[_0xcad5('0x1')]},'emailbody':{'type':Sequelize[_0xcad5('0x1')]},'maxsecs':{'type':Sequelize[_0xcad5('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xcad5('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xcad5('0xe')],'get':function(){return this[_0xcad5('0xf')](_0xcad5('0x10'))+_0xcad5('0x11')+this[_0xcad5('0xf')](_0xcad5('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index dee024f..736668a 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 _0x5423=['offset','undefined','count','limit','set','Content-Range','reject','destroy','get','Voicemails','UserProfileResource','then','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','params','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xd025b8,_0x223fd9){var _0x2b9daf=function(_0x82ee38){while(--_0x82ee38){_0xd025b8['push'](_0xd025b8['shift']());}};_0x2b9daf(++_0x223fd9);}(_0x5423,0xe3));var _0x3542=function(_0x50f2d6,_0x49805f){_0x50f2d6=_0x50f2d6-0x0;var _0x27316e=_0x5423[_0x50f2d6];return _0x27316e;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){var _0x160caa=_0x5d05b2[_0x3542('0x24')]({'plain':!![]});var _0x1e0723=_0x3542('0x25');return db[_0x3542('0x26')][_0x3542('0x23')]({'where':{'type':_0x1e0723,'resourceId':_0x160caa['id']}})[_0x3542('0x27')](function(){return _0x5d05b2;});})[_0x3542('0x27')](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0xfdfe62,_0x4462c4){return function(_0x220021){if(!_0x220021){_0xfdfe62[_0x3542('0x18')](0x194);}return _0x220021;};}function handleError(_0x1cab35,_0x39050a){_0x39050a=_0x39050a||0x1f4;return function(_0x303412){logger[_0x3542('0x28')](_0x303412[_0x3542('0x29')]);if(_0x303412['name']){delete _0x303412[_0x3542('0x2a')];}_0x1cab35[_0x3542('0x19')](_0x39050a)[_0x3542('0x2b')](_0x303412);};}exports['index']=function(_0x402c97,_0xc6f23b){var _0x2e883a={},_0x30b5e8={},_0x5c882f={'count':0x0,'rows':[]};var _0x5a274b=_[_0x3542('0x2c')](db[_0x3542('0x2d')][_0x3542('0x2e')],function(_0x44e8f7){return{'name':_0x44e8f7[_0x3542('0x2f')],'type':_0x44e8f7[_0x3542('0x30')][_0x3542('0x31')]};});_0x30b5e8['model']=_['map'](_0x5a274b,_0x3542('0x2a'));_0x30b5e8['query']=_['keys'](_0x402c97[_0x3542('0x32')]);_0x30b5e8['filters']=_['intersection'](_0x30b5e8[_0x3542('0x33')],_0x30b5e8[_0x3542('0x32')]);_0x2e883a[_0x3542('0x34')]=_['intersection'](_0x30b5e8[_0x3542('0x33')],qs['fields'](_0x402c97[_0x3542('0x32')][_0x3542('0x35')]));_0x2e883a['attributes']=_0x2e883a[_0x3542('0x34')]['length']?_0x2e883a[_0x3542('0x34')]:_0x30b5e8[_0x3542('0x33')];if(!_0x402c97[_0x3542('0x32')]['hasOwnProperty'](_0x3542('0x36'))){_0x2e883a['limit']=qs[_0x3542('0x1f')](_0x402c97[_0x3542('0x32')][_0x3542('0x1f')]);_0x2e883a[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x402c97[_0x3542('0x32')][_0x3542('0x1c')]);}_0x2e883a[_0x3542('0x37')]=qs[_0x3542('0x38')](_0x402c97[_0x3542('0x32')][_0x3542('0x38')]);_0x2e883a[_0x3542('0x39')]=qs[_0x3542('0x3a')](_['pick'](_0x402c97[_0x3542('0x32')],_0x30b5e8['filters']),_0x5a274b);if(_0x402c97['query'][_0x3542('0x3b')]){_0x2e883a[_0x3542('0x39')]=_[_0x3542('0x3c')](_0x2e883a[_0x3542('0x39')],{'$or':_[_0x3542('0x2c')](_0x5a274b,function(_0x21aec3){if(_0x21aec3[_0x3542('0x30')]!==_0x3542('0x3d')){var _0x53eac6={};_0x53eac6[_0x21aec3[_0x3542('0x2a')]]={'$like':'%'+_0x402c97['query'][_0x3542('0x3b')]+'%'};return _0x53eac6;}})});}_0x2e883a=_[_0x3542('0x3c')]({},_0x2e883a,_0x402c97['options']);var _0x371aba={'where':_0x2e883a[_0x3542('0x39')]};return db['VoiceMail'][_0x3542('0x1e')](_0x371aba)[_0x3542('0x27')](function(_0x5e1b29){_0x5c882f[_0x3542('0x1e')]=_0x5e1b29;if(_0x402c97[_0x3542('0x32')][_0x3542('0x3e')]){_0x2e883a[_0x3542('0x3f')]=[{'all':!![]}];}return db[_0x3542('0x2d')][_0x3542('0x40')](_0x2e883a);})[_0x3542('0x27')](function(_0x4bf45a){_0x5c882f['rows']=_0x4bf45a;return _0x5c882f;})[_0x3542('0x27')](respondWithFilteredResult(_0xc6f23b,_0x2e883a))[_0x3542('0x41')](handleError(_0xc6f23b,null));};exports[_0x3542('0x42')]=function(_0xdeebd3,_0x170749){var _0x53a024={'raw':!![],'where':{'id':_0xdeebd3['params']['id']}},_0x3e6a49={};_0x3e6a49[_0x3542('0x33')]=_[_0x3542('0x43')](db[_0x3542('0x2d')]['rawAttributes']);_0x3e6a49[_0x3542('0x32')]=_[_0x3542('0x43')](_0xdeebd3['query']);_0x3e6a49[_0x3542('0x3a')]=_[_0x3542('0x44')](_0x3e6a49[_0x3542('0x33')],_0x3e6a49[_0x3542('0x32')]);_0x53a024[_0x3542('0x34')]=_[_0x3542('0x44')](_0x3e6a49[_0x3542('0x33')],qs[_0x3542('0x35')](_0xdeebd3['query']['fields']));_0x53a024['attributes']=_0x53a024[_0x3542('0x34')][_0x3542('0x45')]?_0x53a024[_0x3542('0x34')]:_0x3e6a49[_0x3542('0x33')];if(_0xdeebd3[_0x3542('0x32')][_0x3542('0x3e')]){_0x53a024[_0x3542('0x3f')]=[{'all':!![]}];}_0x53a024=_['merge']({},_0x53a024,_0xdeebd3[_0x3542('0x46')]);return db[_0x3542('0x2d')][_0x3542('0x47')](_0x53a024)[_0x3542('0x27')](handleEntityNotFound(_0x170749,null))['then'](respondWithResult(_0x170749,null))[_0x3542('0x41')](handleError(_0x170749,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){return db[_0x3542('0x2d')][_0x3542('0x48')](_0x55b43a[_0x3542('0x49')],{})[_0x3542('0x27')](function(_0x244f3a){var _0x1a2ecf=_0x55b43a[_0x3542('0x4a')]['get']({'plain':!![]});if(!_0x1a2ecf)throw new Error(_0x3542('0x4b'));if(_0x1a2ecf[_0x3542('0x4c')]===_0x3542('0x4a')){var _0x392c6e=_0x244f3a[_0x3542('0x24')]({'plain':!![]});var _0x28be34=_0x3542('0x25');return db[_0x3542('0x4d')][_0x3542('0x47')]({'where':{'name':_0x28be34,'userProfileId':_0x1a2ecf['userProfileId']},'raw':!![]})['then'](function(_0x15af28){if(_0x15af28&&_0x15af28['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x392c6e[_0x3542('0x2a')],'resourceId':_0x392c6e['id'],'type':_0x15af28[_0x3542('0x2a')],'sectionId':_0x15af28['id']},{})[_0x3542('0x27')](function(){return _0x244f3a;});}else{return _0x244f3a;}})['catch'](function(_0x2db495){logger[_0x3542('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2db495);throw _0x2db495;});}return _0x244f3a;})[_0x3542('0x27')](respondWithResult(_0x528f8c,0xc9))[_0x3542('0x41')](handleError(_0x528f8c,null));};exports[_0x3542('0x4e')]=function(_0x196c59,_0x179249){if(_0x196c59['body']['id']){delete _0x196c59[_0x3542('0x49')]['id'];}return db[_0x3542('0x2d')][_0x3542('0x47')]({'where':{'id':_0x196c59[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x179249,null))['then'](saveUpdates(_0x196c59['body'],null))[_0x3542('0x27')](respondWithResult(_0x179249,null))[_0x3542('0x41')](handleError(_0x179249,null));};exports[_0x3542('0x23')]=function(_0x5de994,_0x1dfac3){return db[_0x3542('0x2d')][_0x3542('0x47')]({'where':{'id':_0x5de994[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x1dfac3,null))['then'](removeEntity(_0x1dfac3,null))['catch'](handleError(_0x1dfac3,null));};exports[_0x3542('0x50')]=function(_0x4cd6fd,_0x1fd8c8,_0x3610b7){return db['VoiceMail'][_0x3542('0x51')]({'where':{'id':_0x4cd6fd[_0x3542('0x4f')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x1fd8c8,null))[_0x3542('0x27')](function(_0x60b9c0){var _0x52a75b;var _0x4cb73f={},_0x271dd0={};_0x271dd0['model']=_[_0x3542('0x43')](db[_0x3542('0x52')][_0x3542('0x2e')]);_0x271dd0['query']=_[_0x3542('0x43')](_0x4cd6fd[_0x3542('0x32')]);_0x271dd0[_0x3542('0x3a')]=_[_0x3542('0x44')](_0x271dd0[_0x3542('0x33')],_0x271dd0[_0x3542('0x32')]);_0x4cb73f['attributes']=_[_0x3542('0x44')](_0x271dd0[_0x3542('0x33')],qs[_0x3542('0x35')](_0x4cd6fd[_0x3542('0x32')][_0x3542('0x35')]));_0x4cb73f[_0x3542('0x34')]=_0x4cb73f['attributes'][_0x3542('0x45')]?_0x4cb73f[_0x3542('0x34')]:_0x271dd0[_0x3542('0x33')];if(!_0x4cd6fd[_0x3542('0x32')]['hasOwnProperty'](_0x3542('0x36'))){_0x4cb73f[_0x3542('0x1f')]=qs['limit'](_0x4cd6fd['query'][_0x3542('0x1f')]);_0x4cb73f['offset']=qs[_0x3542('0x1c')](_0x4cd6fd['query']['offset']);}_0x4cb73f[_0x3542('0x37')]=qs[_0x3542('0x38')](_0x4cd6fd[_0x3542('0x32')][_0x3542('0x38')]);_0x4cb73f[_0x3542('0x39')]=qs[_0x3542('0x3a')](_[_0x3542('0x53')](_0x4cd6fd['query'],_0x271dd0[_0x3542('0x3a')]));if(_0x4cd6fd[_0x3542('0x32')][_0x3542('0x3b')]){_0x4cb73f[_0x3542('0x39')]=_[_0x3542('0x3c')](_0x4cb73f['where'],{'$or':_[_0x3542('0x2c')](_0x4cb73f[_0x3542('0x34')],function(_0x2c5546){var _0x361c42={};_0x361c42[_0x2c5546]={'$like':'%'+_0x4cd6fd[_0x3542('0x32')][_0x3542('0x3b')]+'%'};return _0x361c42;})});}_0x4cb73f[_0x3542('0x39')]=_['merge'](_0x4cb73f[_0x3542('0x39')],{'mailboxuser':_0x60b9c0['mailbox']});_0x4cb73f=_[_0x3542('0x3c')]({},_0x4cb73f,_0x4cd6fd[_0x3542('0x46')]);return db[_0x3542('0x52')][_0x3542('0x54')](_0x4cb73f)['then'](respondWithFilteredResult(_0x1fd8c8,_0x4cb73f));})['catch'](handleError(_0x1fd8c8,null));}; \ No newline at end of file +var _0xd87e=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','name','map','VoiceMail','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x306594,_0x1488e9){var _0x5a627f=function(_0x3e4319){while(--_0x3e4319){_0x306594['push'](_0x306594['shift']());}};_0x5a627f(++_0x1488e9);}(_0xd87e,0x1bf));var _0xed87=function(_0x286fdc,_0x54551d){_0x286fdc=_0x286fdc-0x0;var _0x11fe49=_0xd87e[_0x286fdc];return _0x11fe49;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){var _0x5d15b3=_0x27799a[_0xed87('0x25')]({'plain':!![]});var _0x3c22b7=_0xed87('0x26');return db[_0xed87('0x27')][_0xed87('0x24')]({'where':{'type':_0x3c22b7,'resourceId':_0x5d15b3['id']}})[_0xed87('0x23')](function(){return _0x27799a;});})[_0xed87('0x23')](function(){_0x3d1641[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x38f5c,_0x469181){return function(_0x341a35){if(!_0x341a35){_0x38f5c[_0xed87('0x18')](0x194);}return _0x341a35;};}function handleError(_0x2b86e2,_0x4dfaf2){_0x4dfaf2=_0x4dfaf2||0x1f4;return function(_0xb32b1c){logger[_0xed87('0x28')](_0xb32b1c['stack']);if(_0xb32b1c[_0xed87('0x29')]){delete _0xb32b1c[_0xed87('0x29')];}_0x2b86e2[_0xed87('0x19')](_0x4dfaf2)['send'](_0xb32b1c);};}exports['index']=function(_0xd0efba,_0x428b75){var _0x21ab8a={},_0x549a19={},_0x37d45a={'count':0x0,'rows':[]};var _0x3b87e3=_[_0xed87('0x2a')](db[_0xed87('0x2b')][_0xed87('0x2c')],function(_0x46b9f9){return{'name':_0x46b9f9[_0xed87('0x2d')],'type':_0x46b9f9[_0xed87('0x2e')][_0xed87('0x2f')]};});_0x549a19['model']=_[_0xed87('0x2a')](_0x3b87e3,_0xed87('0x29'));_0x549a19['query']=_[_0xed87('0x30')](_0xd0efba['query']);_0x549a19[_0xed87('0x31')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],_0x549a19[_0xed87('0x34')]);_0x21ab8a[_0xed87('0x35')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],qs[_0xed87('0x36')](_0xd0efba[_0xed87('0x34')][_0xed87('0x36')]));_0x21ab8a[_0xed87('0x35')]=_0x21ab8a['attributes'][_0xed87('0x37')]?_0x21ab8a[_0xed87('0x35')]:_0x549a19['model'];if(!_0xd0efba[_0xed87('0x34')]['hasOwnProperty'](_0xed87('0x38'))){_0x21ab8a[_0xed87('0x1e')]=qs['limit'](_0xd0efba[_0xed87('0x34')][_0xed87('0x1e')]);_0x21ab8a[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0xd0efba[_0xed87('0x34')]['offset']);}_0x21ab8a[_0xed87('0x39')]=qs['sort'](_0xd0efba[_0xed87('0x34')]['sort']);_0x21ab8a[_0xed87('0x3a')]=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0xd0efba[_0xed87('0x34')],_0x549a19[_0xed87('0x31')]),_0x3b87e3);if(_0xd0efba[_0xed87('0x34')][_0xed87('0x3c')]){_0x21ab8a[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0x21ab8a['where'],{'$or':_['map'](_0x3b87e3,function(_0xa6714a){if(_0xa6714a[_0xed87('0x2e')]!==_0xed87('0x3e')){var _0x325112={};_0x325112[_0xa6714a[_0xed87('0x29')]]={'$like':'%'+_0xd0efba[_0xed87('0x34')]['filter']+'%'};return _0x325112;}})});}_0x21ab8a=_[_0xed87('0x3d')]({},_0x21ab8a,_0xd0efba[_0xed87('0x3f')]);var _0x1c49b0={'where':_0x21ab8a['where']};return db[_0xed87('0x2b')][_0xed87('0x1f')](_0x1c49b0)[_0xed87('0x23')](function(_0x1b0092){_0x37d45a[_0xed87('0x1f')]=_0x1b0092;if(_0xd0efba[_0xed87('0x34')][_0xed87('0x40')]){_0x21ab8a[_0xed87('0x41')]=[{'all':!![]}];}return db[_0xed87('0x2b')][_0xed87('0x42')](_0x21ab8a);})['then'](function(_0x7e6cbb){_0x37d45a[_0xed87('0x43')]=_0x7e6cbb;return _0x37d45a;})[_0xed87('0x23')](respondWithFilteredResult(_0x428b75,_0x21ab8a))['catch'](handleError(_0x428b75,null));};exports['show']=function(_0xa31eec,_0x7aa7fa){var _0x40cd98={'raw':!![],'where':{'id':_0xa31eec['params']['id']}},_0x41a658={};_0x41a658[_0xed87('0x33')]=_[_0xed87('0x30')](db['VoiceMail'][_0xed87('0x2c')]);_0x41a658[_0xed87('0x34')]=_[_0xed87('0x30')](_0xa31eec[_0xed87('0x34')]);_0x41a658[_0xed87('0x31')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],_0x41a658[_0xed87('0x34')]);_0x40cd98[_0xed87('0x35')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],qs['fields'](_0xa31eec[_0xed87('0x34')][_0xed87('0x36')]));_0x40cd98[_0xed87('0x35')]=_0x40cd98[_0xed87('0x35')][_0xed87('0x37')]?_0x40cd98[_0xed87('0x35')]:_0x41a658[_0xed87('0x33')];if(_0xa31eec[_0xed87('0x34')][_0xed87('0x40')]){_0x40cd98[_0xed87('0x41')]=[{'all':!![]}];}_0x40cd98=_[_0xed87('0x3d')]({},_0x40cd98,_0xa31eec[_0xed87('0x3f')]);return db[_0xed87('0x2b')][_0xed87('0x44')](_0x40cd98)[_0xed87('0x23')](handleEntityNotFound(_0x7aa7fa,null))[_0xed87('0x23')](respondWithResult(_0x7aa7fa,null))[_0xed87('0x45')](handleError(_0x7aa7fa,null));};exports['create']=function(_0x2c7bef,_0x1a68a7){return db[_0xed87('0x2b')]['create'](_0x2c7bef[_0xed87('0x46')],{})[_0xed87('0x23')](function(_0x54bc95){var _0x33e736=_0x2c7bef[_0xed87('0x47')][_0xed87('0x25')]({'plain':!![]});if(!_0x33e736)throw new Error(_0xed87('0x48'));if(_0x33e736['role']===_0xed87('0x47')){var _0x436e15=_0x54bc95[_0xed87('0x25')]({'plain':!![]});var _0x272a07=_0xed87('0x26');return db[_0xed87('0x49')][_0xed87('0x44')]({'where':{'name':_0x272a07,'userProfileId':_0x33e736[_0xed87('0x4a')]},'raw':!![]})[_0xed87('0x23')](function(_0x251d4e){if(_0x251d4e&&_0x251d4e[_0xed87('0x4b')]===0x0){return db[_0xed87('0x27')][_0xed87('0x4c')]({'name':_0x436e15['name'],'resourceId':_0x436e15['id'],'type':_0x251d4e[_0xed87('0x29')],'sectionId':_0x251d4e['id']},{})['then'](function(){return _0x54bc95;});}else{return _0x54bc95;}})[_0xed87('0x45')](function(_0x329973){logger[_0xed87('0x28')](_0xed87('0x4d'),_0x329973);throw _0x329973;});}return _0x54bc95;})[_0xed87('0x23')](respondWithResult(_0x1a68a7,0xc9))[_0xed87('0x45')](handleError(_0x1a68a7,null));};exports[_0xed87('0x4e')]=function(_0xccdbb6,_0x3b413d){if(_0xccdbb6[_0xed87('0x46')]['id']){delete _0xccdbb6['body']['id'];}return db[_0xed87('0x2b')][_0xed87('0x44')]({'where':{'id':_0xccdbb6[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3b413d,null))[_0xed87('0x23')](saveUpdates(_0xccdbb6[_0xed87('0x46')],null))[_0xed87('0x23')](respondWithResult(_0x3b413d,null))[_0xed87('0x45')](handleError(_0x3b413d,null));};exports[_0xed87('0x24')]=function(_0x367ff4,_0x32db1f){return db['VoiceMail']['find']({'where':{'id':_0x367ff4[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x32db1f,null))[_0xed87('0x23')](removeEntity(_0x32db1f,null))[_0xed87('0x45')](handleError(_0x32db1f,null));};exports[_0xed87('0x50')]=function(_0x4dd840,_0x7e6738,_0x1ddd72){return db[_0xed87('0x2b')][_0xed87('0x51')]({'where':{'id':_0x4dd840[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x7e6738,null))[_0xed87('0x23')](function(_0x1391a2){var _0x2ffffa;var _0xf4ec55={},_0x3feebb={};_0x3feebb[_0xed87('0x33')]=_[_0xed87('0x30')](db[_0xed87('0x52')]['rawAttributes']);_0x3feebb[_0xed87('0x34')]=_[_0xed87('0x30')](_0x4dd840[_0xed87('0x34')]);_0x3feebb[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3feebb[_0xed87('0x33')],_0x3feebb[_0xed87('0x34')]);_0xf4ec55[_0xed87('0x35')]=_['intersection'](_0x3feebb[_0xed87('0x33')],qs[_0xed87('0x36')](_0x4dd840[_0xed87('0x34')][_0xed87('0x36')]));_0xf4ec55[_0xed87('0x35')]=_0xf4ec55[_0xed87('0x35')]['length']?_0xf4ec55['attributes']:_0x3feebb[_0xed87('0x33')];if(!_0x4dd840[_0xed87('0x34')][_0xed87('0x53')](_0xed87('0x38'))){_0xf4ec55[_0xed87('0x1e')]=qs[_0xed87('0x1e')](_0x4dd840[_0xed87('0x34')][_0xed87('0x1e')]);_0xf4ec55['offset']=qs[_0xed87('0x1c')](_0x4dd840['query'][_0xed87('0x1c')]);}_0xf4ec55[_0xed87('0x39')]=qs['sort'](_0x4dd840[_0xed87('0x34')][_0xed87('0x54')]);_0xf4ec55['where']=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0x4dd840[_0xed87('0x34')],_0x3feebb[_0xed87('0x31')]));if(_0x4dd840[_0xed87('0x34')]['filter']){_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'$or':_[_0xed87('0x2a')](_0xf4ec55['attributes'],function(_0x58279a){var _0x3a6ab6={};_0x3a6ab6[_0x58279a]={'$like':'%'+_0x4dd840[_0xed87('0x34')]['filter']+'%'};return _0x3a6ab6;})});}_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'mailboxuser':_0x1391a2[_0xed87('0x55')]});_0xf4ec55=_[_0xed87('0x3d')]({},_0xf4ec55,_0x4dd840[_0xed87('0x3f')]);return db[_0xed87('0x52')][_0xed87('0x56')](_0xf4ec55)[_0xed87('0x23')](respondWithFilteredResult(_0x7e6738,_0xf4ec55));})[_0xed87('0x45')](handleError(_0x7e6738,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b71a6c7..2875925 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 _0xd644=['bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','context','lodash','../../config/logger','api','moment'];(function(_0x31426e,_0x18db78){var _0x412e1b=function(_0x1b2917){while(--_0x1b2917){_0x31426e['push'](_0x31426e['shift']());}};_0x412e1b(++_0x18db78);}(_0xd644,0x175));var _0x4d64=function(_0x46f065,_0x5e4398){_0x46f065=_0x46f065-0x0;var _0x1ed60b=_0xd644[_0x46f065];return _0x1ed60b;};'use strict';var _=require(_0x4d64('0x0'));var util=require('util');var logger=require(_0x4d64('0x1'))(_0x4d64('0x2'));var moment=require(_0x4d64('0x3'));var BPromise=require(_0x4d64('0x4'));var rp=require(_0x4d64('0x5'));var fs=require('fs');var path=require(_0x4d64('0x6'));var rimraf=require('rimraf');var config=require(_0x4d64('0x7'));var attributes=require(_0x4d64('0x8'));module['exports']=function(_0x279080,_0x1ad77c){return _0x279080[_0x4d64('0x9')](_0x4d64('0xa'),attributes,{'tableName':_0x4d64('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x4d64('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','lodash','util'];(function(_0x7356ce,_0x5f2f5c){var _0x2da25b=function(_0x49728a){while(--_0x49728a){_0x7356ce['push'](_0x7356ce['shift']());}};_0x2da25b(++_0x5f2f5c);}(_0x7a52,0x73));var _0x27a5=function(_0x82b790,_0x4e5468){_0x82b790=_0x82b790-0x0;var _0x555942=_0x7a52[_0x82b790];return _0x555942;};'use strict';var _=require(_0x27a5('0x0'));var util=require(_0x27a5('0x1'));var logger=require(_0x27a5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x27a5('0x3'));var rp=require(_0x27a5('0x4'));var fs=require('fs');var path=require(_0x27a5('0x5'));var rimraf=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var attributes=require('./voiceMail.attributes');module[_0x27a5('0x8')]=function(_0xb13ab5,_0x268aa1){return _0xb13ab5[_0x27a5('0x9')](_0x27a5('0xa'),attributes,{'tableName':_0x27a5('0xb'),'paranoid':![],'indexes':[{'name':_0x27a5('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 872c599..5ac70a0 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 _0xff4f=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x5f07ed,_0x199d29){var _0x395e73=function(_0x4924b5){while(--_0x4924b5){_0x5f07ed['push'](_0x5f07ed['shift']());}};_0x395e73(++_0x199d29);}(_0xff4f,0x188));var _0xfff4=function(_0x3fdb0f,_0x32a671){_0x3fdb0f=_0x3fdb0f-0x0;var _0x259912=_0xff4f[_0x3fdb0f];return _0x259912;};'use strict';var _=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var moment=require(_0xfff4('0x2'));var BPromise=require(_0xfff4('0x3'));var rs=require(_0xfff4('0x4'));var fs=require('fs');var Redis=require(_0xfff4('0x5'));var db=require(_0xfff4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfff4('0x7'))(_0xfff4('0x8'));var config=require(_0xfff4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfff4('0xa')][_0xfff4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2429bc,_0x4ec87a,_0x44d201){return new BPromise(function(_0x1aa97e,_0x5b0c36){return client[_0xfff4('0xc')](_0x2429bc,_0x44d201)[_0xfff4('0xd')](function(_0x871ef2){logger[_0xfff4('0xe')](_0xfff4('0xf'),_0x4ec87a,_0xfff4('0x10'));logger['debug'](_0xfff4('0x11'),_0x4ec87a,_0xfff4('0x10'),JSON[_0xfff4('0x12')](_0x871ef2));if(_0x871ef2['error']){if(_0x871ef2[_0xfff4('0x13')][_0xfff4('0x14')]===0x1f4){logger['error'](_0xfff4('0xf'),_0x4ec87a,_0x871ef2['error']['message']);return _0x5b0c36(_0x871ef2[_0xfff4('0x13')][_0xfff4('0x15')]);}logger[_0xfff4('0x13')](_0xfff4('0xf'),_0x4ec87a,_0x871ef2['error'][_0xfff4('0x15')]);return _0x1aa97e(_0x871ef2['error'][_0xfff4('0x15')]);}else{logger[_0xfff4('0xe')](_0xfff4('0xf'),_0x4ec87a,'request\x20sent');_0x1aa97e(_0x871ef2[_0xfff4('0x16')][_0xfff4('0x15')]);}})[_0xfff4('0x17')](function(_0x136d84){logger['error'](_0xfff4('0xf'),_0x4ec87a,_0x136d84);_0x5b0c36(_0x136d84);});});} \ No newline at end of file +var _0x7d15=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x26acc4,_0x2eea3a){var _0x518163=function(_0x1dd81d){while(--_0x1dd81d){_0x26acc4['push'](_0x26acc4['shift']());}};_0x518163(++_0x2eea3a);}(_0x7d15,0x1a1));var _0x57d1=function(_0x42c602,_0x23966c){_0x42c602=_0x42c602-0x0;var _0x3ce0f5=_0x7d15[_0x42c602];return _0x3ce0f5;};'use strict';var _=require('lodash');var util=require(_0x57d1('0x0'));var moment=require(_0x57d1('0x1'));var BPromise=require(_0x57d1('0x2'));var rs=require(_0x57d1('0x3'));var fs=require('fs');var Redis=require(_0x57d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x57d1('0x5'));var logger=require('../../config/logger')(_0x57d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x57d1('0x7'));var client=jayson[_0x57d1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3588ef,_0x2e7134,_0x178ea0){return new BPromise(function(_0x19d27d,_0x479a99){return client['request'](_0x3588ef,_0x178ea0)[_0x57d1('0x9')](function(_0x2f863c){logger[_0x57d1('0xa')]('VoiceMail,\x20%s,\x20%s',_0x2e7134,_0x57d1('0xb'));logger[_0x57d1('0xc')](_0x57d1('0xd'),_0x2e7134,_0x57d1('0xb'),JSON[_0x57d1('0xe')](_0x2f863c));if(_0x2f863c[_0x57d1('0xf')]){if(_0x2f863c[_0x57d1('0xf')][_0x57d1('0x10')]===0x1f4){logger[_0x57d1('0xf')](_0x57d1('0x11'),_0x2e7134,_0x2f863c['error'][_0x57d1('0x12')]);return _0x479a99(_0x2f863c[_0x57d1('0xf')][_0x57d1('0x12')]);}logger[_0x57d1('0xf')](_0x57d1('0x11'),_0x2e7134,_0x2f863c[_0x57d1('0xf')]['message']);return _0x19d27d(_0x2f863c[_0x57d1('0xf')][_0x57d1('0x12')]);}else{logger[_0x57d1('0xa')](_0x57d1('0x11'),_0x2e7134,_0x57d1('0xb'));_0x19d27d(_0x2f863c[_0x57d1('0x13')][_0x57d1('0x12')]);}})[_0x57d1('0x14')](function(_0x549f03){logger[_0x57d1('0xf')](_0x57d1('0x11'),_0x2e7134,_0x549f03);_0x479a99(_0x549f03);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 84d5e89..99bf0e1 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 _0xe460=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/download','download','create','update','destroy'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0xe460,0xd0));var _0x0e46=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xe460[_0x576d8a];return _0x3dc3ef;};'use strict';var multer=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var path=require(_0x0e46('0x2'));var timeout=require(_0x0e46('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e46('0x4'));var auth=require(_0x0e46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e46('0x6'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0e46('0x7')](_0x0e46('0x8'),auth[_0x0e46('0x9')](),controller[_0x0e46('0xa')]);router[_0x0e46('0x7')](_0x0e46('0xb'),auth[_0x0e46('0x9')](),controller[_0x0e46('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e46('0xd')]);router['put'](_0x0e46('0x8'),auth['isAuthenticated'](),controller[_0x0e46('0xe')]);router['delete'](_0x0e46('0x8'),auth[_0x0e46('0x9')](),controller[_0x0e46('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc567=['update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','/:id','get','download','post','create'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc567,0x1df));var _0x7c56=function(_0x4a75f1,_0x46c4ff){_0x4a75f1=_0x4a75f1-0x0;var _0x4bb702=_0xc567[_0x4a75f1];return _0x4bb702;};'use strict';var multer=require(_0x7c56('0x0'));var util=require(_0x7c56('0x1'));var path=require(_0x7c56('0x2'));var timeout=require(_0x7c56('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c56('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c56('0x5'));var config=require(_0x7c56('0x6'));var controller=require(_0x7c56('0x7'));router['get']('/',auth[_0x7c56('0x8')](),controller['index']);router['get'](_0x7c56('0x9'),auth[_0x7c56('0x8')](),controller['show']);router[_0x7c56('0xa')]('/:id/download',auth[_0x7c56('0x8')](),controller[_0x7c56('0xb')]);router[_0x7c56('0xc')]('/',auth[_0x7c56('0x8')](),controller[_0x7c56('0xd')]);router['put'](_0x7c56('0x9'),auth[_0x7c56('0x8')](),controller[_0x7c56('0xe')]);router[_0x7c56('0xf')](_0x7c56('0x9'),auth[_0x7c56('0x8')](),controller[_0x7c56('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1eb0f96..5d1192f 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 _0x4c59=['BLOB','long','TIMESTAMP','literal','exports','getDataValue','INTEGER','STRING'];(function(_0x1d1eb3,_0x2295dd){var _0x260770=function(_0x4d6bcd){while(--_0x4d6bcd){_0x1d1eb3['push'](_0x1d1eb3['shift']());}};_0x260770(++_0x2295dd);}(_0x4c59,0x74));var _0x94c5=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0x4c59[_0x4f6afc];return _0x256eeb;};'use strict';var Sequelize=require('sequelize');module[_0x94c5('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x414834){return this[_0x94c5('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x94c5('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x94c5('0x4')](_0x94c5('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x94c5('0x3')],'defaultValue':''},'stamp':{'type':_0x94c5('0x6'),'defaultValue':Sequelize[_0x94c5('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xfbab=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x5ddc29,_0x2898a8){var _0x49e850=function(_0x3ce460){while(--_0x3ce460){_0x5ddc29['push'](_0x5ddc29['shift']());}};_0x49e850(++_0x2898a8);}(_0xfbab,0x92));var _0xbfba=function(_0x56810c,_0x54142d){_0x56810c=_0x56810c-0x0;var _0x486a97=_0xfbab[_0x56810c];return _0x486a97;};'use strict';var Sequelize=require(_0xbfba('0x0'));module[_0xbfba('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4dd9c0){return this[_0xbfba('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xbfba('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbfba('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xbfba('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xbfba('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xbfba('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xbfba('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xbfba('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xbfba('0x6'),'defaultValue':Sequelize[_0xbfba('0x7')](_0xbfba('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 127cc8b..16384fd 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 _0x29a0=['pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','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','offset','undefined','count','limit','set','reject','save','then','destroy','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x465cfe,_0x98daf6){var _0x1d879a=function(_0xbf3fcd){while(--_0xbf3fcd){_0x465cfe['push'](_0x465cfe['shift']());}};_0x1d879a(++_0x98daf6);}(_0x29a0,0x6b));var _0x029a=function(_0x2bc088,_0x2a7e15){_0x2bc088=_0x2bc088-0x0;var _0x26e019=_0x29a0[_0x2bc088];return _0x26e019;};'use strict';var emlformat=require(_0x029a('0x0'));var rimraf=require(_0x029a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x029a('0x2'));var BPromise=require(_0x029a('0x3'));var Mustache=require('mustache');var util=require(_0x029a('0x4'));var path=require(_0x029a('0x5'));var sox=require(_0x029a('0x6'));var csv=require(_0x029a('0x7'));var ejs=require(_0x029a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x029a('0x9'));var squel=require('squel');var crypto=require(_0x029a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x029a('0xb'));var toCsv=require(_0x029a('0x7'));var querystring=require(_0x029a('0xc'));var Papa=require(_0x029a('0xd'));var Redis=require(_0x029a('0xe'));var authService=require(_0x029a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x029a('0x10'));var hardwareService=require(_0x029a('0x11'));var logger=require(_0x029a('0x12'))(_0x029a('0x13'));var utils=require(_0x029a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x029a('0x15'));var db=require(_0x029a('0x16'))['db'];function respondWithStatusCode(_0x397d3d,_0x5549ed){_0x5549ed=_0x5549ed||0xcc;return function(_0x1e073f){if(_0x1e073f){return _0x397d3d[_0x029a('0x17')](_0x5549ed);}return _0x397d3d[_0x029a('0x18')](_0x5549ed)[_0x029a('0x19')]();};}function respondWithResult(_0x3733c3,_0x36bba8){_0x36bba8=_0x36bba8||0xc8;return function(_0x4bdca3){if(_0x4bdca3){return _0x3733c3[_0x029a('0x18')](_0x36bba8)[_0x029a('0x1a')](_0x4bdca3);}};}function respondWithFilteredResult(_0x224e12,_0x566d68){return function(_0x570f50){if(_0x570f50){var _0x2d6530=typeof _0x566d68[_0x029a('0x1b')]===_0x029a('0x1c')&&typeof _0x566d68['limit']===_0x029a('0x1c');var _0x3f9ac4=_0x570f50['count'];var _0x596e1a=_0x2d6530?0x0:_0x566d68[_0x029a('0x1b')];var _0xf6d9cd=_0x2d6530?_0x570f50[_0x029a('0x1d')]:_0x566d68['offset']+_0x566d68[_0x029a('0x1e')];var _0x5a9a09;if(_0xf6d9cd>=_0x3f9ac4){_0xf6d9cd=_0x3f9ac4;_0x5a9a09=0xc8;}else{_0x5a9a09=0xce;}_0x224e12[_0x029a('0x18')](_0x5a9a09);return _0x224e12[_0x029a('0x1f')]('Content-Range',_0x596e1a+'-'+_0xf6d9cd+'/'+_0x3f9ac4)['json'](_0x570f50);}return null;};}function patchUpdates(_0x32070c){return function(_0x15d6e3){try{jsonpatch['apply'](_0x15d6e3,_0x32070c,!![]);}catch(_0x5c8318){return BPromise[_0x029a('0x20')](_0x5c8318);}return _0x15d6e3[_0x029a('0x21')]();};}function saveUpdates(_0x5bf71b,_0x112d72){return function(_0x4a35e2){if(_0x4a35e2){return _0x4a35e2['update'](_0x5bf71b)[_0x029a('0x22')](function(_0x9c2143){return _0x9c2143;});}return null;};}function removeEntity(_0x1ffef0,_0x3db926){return function(_0x256fe2){if(_0x256fe2){return _0x256fe2[_0x029a('0x23')]()['then'](function(){_0x1ffef0[_0x029a('0x18')](0xcc)[_0x029a('0x19')]();});}};}function handleEntityNotFound(_0x12bda2,_0x15df9e){return function(_0x31837b){if(!_0x31837b){_0x12bda2[_0x029a('0x17')](0x194);}return _0x31837b;};}function handleError(_0x542c65,_0x3491f5){_0x3491f5=_0x3491f5||0x1f4;return function(_0x4b8071){logger[_0x029a('0x24')](_0x4b8071['stack']);if(_0x4b8071[_0x029a('0x25')]){delete _0x4b8071[_0x029a('0x25')];}_0x542c65['status'](_0x3491f5)['send'](_0x4b8071);};}exports[_0x029a('0x26')]=function(_0x2f1420,_0x29859b){var _0xfbd62={},_0x11bf66={},_0x351845={'count':0x0,'rows':[]};var _0x4ebec9=_[_0x029a('0x27')](db[_0x029a('0x28')][_0x029a('0x29')],function(_0x1ad7b8){return{'name':_0x1ad7b8[_0x029a('0x2a')],'type':_0x1ad7b8[_0x029a('0x2b')][_0x029a('0x2c')]};});_0x11bf66[_0x029a('0x2d')]=_[_0x029a('0x2e')](_['map'](_0x4ebec9,_0x029a('0x25')),['name']);_0x11bf66[_0x029a('0x2f')]=_[_0x029a('0x30')](_0x2f1420[_0x029a('0x2f')]);_0x11bf66[_0x029a('0x31')]=_[_0x029a('0x32')](_0x11bf66[_0x029a('0x2d')],_0x11bf66['query']);_0xfbd62['attributes']=_[_0x029a('0x32')](_0x11bf66[_0x029a('0x2d')],qs['fields'](_0x2f1420['query'][_0x029a('0x33')]));_0xfbd62[_0x029a('0x34')]=_0xfbd62['attributes'][_0x029a('0x35')]?_0xfbd62['attributes']:_0x11bf66[_0x029a('0x2d')];if(!_0x2f1420[_0x029a('0x2f')][_0x029a('0x36')]('nolimit')){_0xfbd62[_0x029a('0x1e')]=qs[_0x029a('0x1e')](_0x2f1420[_0x029a('0x2f')][_0x029a('0x1e')]);_0xfbd62[_0x029a('0x1b')]=qs['offset'](_0x2f1420[_0x029a('0x2f')][_0x029a('0x1b')]);}_0xfbd62[_0x029a('0x37')]=qs[_0x029a('0x38')](_0x2f1420['query'][_0x029a('0x38')]);_0xfbd62['where']=qs[_0x029a('0x31')](_[_0x029a('0x39')](_0x2f1420[_0x029a('0x2f')],_0x11bf66[_0x029a('0x31')]),_0x4ebec9);if(_0x2f1420[_0x029a('0x2f')][_0x029a('0x3a')]){_0xfbd62[_0x029a('0x3b')]=_[_0x029a('0x3c')](_0xfbd62[_0x029a('0x3b')],{'$or':_['map'](_0x4ebec9,function(_0x31f3a2){if(_0x31f3a2[_0x029a('0x2b')]!=='VIRTUAL'){var _0xfdb00b={};_0xfdb00b[_0x31f3a2[_0x029a('0x25')]]={'$like':'%'+_0x2f1420['query']['filter']+'%'};return _0xfdb00b;}})});}_0xfbd62=_['merge']({},_0xfbd62,_0x2f1420[_0x029a('0x3d')]);var _0x21cfd3={'where':_0xfbd62['where']};return db['VoiceMailMessage'][_0x029a('0x1d')](_0x21cfd3)[_0x029a('0x22')](function(_0x36ed7d){_0x351845[_0x029a('0x1d')]=_0x36ed7d;if(_0x2f1420[_0x029a('0x2f')][_0x029a('0x3e')]){_0xfbd62[_0x029a('0x3f')]=[{'all':!![]}];}return db[_0x029a('0x28')][_0x029a('0x40')](_0xfbd62);})['then'](function(_0x196a42){_0x351845[_0x029a('0x41')]=_0x196a42;return _0x351845;})[_0x029a('0x22')](respondWithFilteredResult(_0x29859b,_0xfbd62))[_0x029a('0x42')](handleError(_0x29859b,null));};exports[_0x029a('0x43')]=function(_0x2399a2,_0xe70a55){var _0x3d2e81={'raw':!![],'where':{'id':_0x2399a2['params']['id']}},_0x74a90={};_0x74a90['model']=_[_0x029a('0x30')](db[_0x029a('0x28')][_0x029a('0x29')]);_0x74a90[_0x029a('0x2f')]=_[_0x029a('0x30')](_0x2399a2[_0x029a('0x2f')]);_0x74a90[_0x029a('0x31')]=_['intersection'](_0x74a90['model'],_0x74a90[_0x029a('0x2f')]);_0x3d2e81[_0x029a('0x34')]=_[_0x029a('0x32')](_0x74a90[_0x029a('0x2d')],qs[_0x029a('0x33')](_0x2399a2['query'][_0x029a('0x33')]));_0x3d2e81[_0x029a('0x34')]=_0x3d2e81[_0x029a('0x34')][_0x029a('0x35')]?_0x3d2e81[_0x029a('0x34')]:_0x74a90[_0x029a('0x2d')];if(_0x2399a2[_0x029a('0x2f')][_0x029a('0x3e')]){_0x3d2e81['include']=[{'all':!![]}];}_0x3d2e81=_['merge']({},_0x3d2e81,_0x2399a2[_0x029a('0x3d')]);return db[_0x029a('0x28')]['find'](_0x3d2e81)[_0x029a('0x22')](handleEntityNotFound(_0xe70a55,null))[_0x029a('0x22')](respondWithResult(_0xe70a55,null))[_0x029a('0x42')](handleError(_0xe70a55,null));};exports[_0x029a('0x44')]=function(_0x385d03,_0x49251a){return db[_0x029a('0x28')][_0x029a('0x44')](_0x385d03[_0x029a('0x45')],{})[_0x029a('0x22')](respondWithResult(_0x49251a,0xc9))[_0x029a('0x42')](handleError(_0x49251a,null));};exports[_0x029a('0x46')]=function(_0x453fe1,_0x79eb8c){if(_0x453fe1['body']['id']){delete _0x453fe1[_0x029a('0x45')]['id'];}return db['VoiceMailMessage'][_0x029a('0x47')]({'where':{'id':_0x453fe1[_0x029a('0x48')]['id']}})[_0x029a('0x22')](handleEntityNotFound(_0x79eb8c,null))[_0x029a('0x22')](saveUpdates(_0x453fe1[_0x029a('0x45')],null))[_0x029a('0x22')](respondWithResult(_0x79eb8c,null))[_0x029a('0x42')](handleError(_0x79eb8c,null));};exports[_0x029a('0x23')]=function(_0x6f82e2,_0x1fed46){return db['VoiceMailMessage'][_0x029a('0x47')]({'where':{'id':_0x6f82e2[_0x029a('0x48')]['id']}})[_0x029a('0x22')](handleEntityNotFound(_0x1fed46,null))[_0x029a('0x22')](removeEntity(_0x1fed46,null))[_0x029a('0x42')](handleError(_0x1fed46,null));};exports[_0x029a('0x49')]=function(_0x212744,_0x571962,_0x40556d){return db[_0x029a('0x28')][_0x029a('0x47')]({'where':{'id':_0x212744[_0x029a('0x48')]['id']},'attributes':['id',_0x029a('0x4a'),_0x029a('0x4b')]})['then'](handleEntityNotFound(_0x571962,null))[_0x029a('0x22')](function(_0x3f6d41){if(_0x3f6d41){if(!_0x3f6d41[_0x029a('0x4a')]){throw new db[(_0x029a('0x4c'))][(_0x029a('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x1d9568={'Content-Type':_0x029a('0x4e'),'Content-Disposition':_0x029a('0x4f')};if(_0x3f6d41[_0x029a('0x4b')]){_0x1d9568['Content-Disposition']=_0x029a('0x50')+_0x3f6d41[_0x029a('0x4b')]+_0x029a('0x51');}_0x571962[_0x029a('0x1f')](_0x1d9568);return _0x571962['send'](new Buffer(_0x3f6d41[_0x029a('0x4a')]));}})[_0x029a('0x42')](handleError(_0x571962,null));}; \ No newline at end of file +var _0xdf3f=['sort','pick','where','merge','VIRTUAL','filter','VoiceMailMessage','include','findAll','rows','catch','show','params','options','find','create','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xdf3f,0xbc));var _0xfdf3=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xdf3f[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0xfdf3('0x0'));var rimraf=require(_0xfdf3('0x1'));var zipdir=require(_0xfdf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdf3('0x3'));var moment=require(_0xfdf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfdf3('0x5'));var util=require(_0xfdf3('0x6'));var path=require(_0xfdf3('0x7'));var sox=require(_0xfdf3('0x8'));var csv=require(_0xfdf3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdf3('0xa'));var _=require(_0xfdf3('0xb'));var squel=require('squel');var crypto=require(_0xfdf3('0xc'));var jsforce=require(_0xfdf3('0xd'));var deskjs=require(_0xfdf3('0xe'));var toCsv=require(_0xfdf3('0x9'));var querystring=require(_0xfdf3('0xf'));var Papa=require(_0xfdf3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfdf3('0x11'));var as=require(_0xfdf3('0x12'));var hardwareService=require(_0xfdf3('0x13'));var logger=require(_0xfdf3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfdf3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2be102,_0x368d7b){_0x368d7b=_0x368d7b||0xcc;return function(_0x1a24e4){if(_0x1a24e4){return _0x2be102[_0xfdf3('0x16')](_0x368d7b);}return _0x2be102['status'](_0x368d7b)[_0xfdf3('0x17')]();};}function respondWithResult(_0x494635,_0x5c19dd){_0x5c19dd=_0x5c19dd||0xc8;return function(_0x4886e0){if(_0x4886e0){return _0x494635[_0xfdf3('0x18')](_0x5c19dd)[_0xfdf3('0x19')](_0x4886e0);}};}function respondWithFilteredResult(_0x2816ac,_0x4748e1){return function(_0x41f51b){if(_0x41f51b){var _0x1860a8=typeof _0x4748e1['offset']===_0xfdf3('0x1a')&&typeof _0x4748e1[_0xfdf3('0x1b')]===_0xfdf3('0x1a');var _0x4b9849=_0x41f51b[_0xfdf3('0x1c')];var _0x26c5fa=_0x1860a8?0x0:_0x4748e1['offset'];var _0x42a7f8=_0x1860a8?_0x41f51b[_0xfdf3('0x1c')]:_0x4748e1[_0xfdf3('0x1d')]+_0x4748e1['limit'];var _0x2da9ec;if(_0x42a7f8>=_0x4b9849){_0x42a7f8=_0x4b9849;_0x2da9ec=0xc8;}else{_0x2da9ec=0xce;}_0x2816ac[_0xfdf3('0x18')](_0x2da9ec);return _0x2816ac['set'](_0xfdf3('0x1e'),_0x26c5fa+'-'+_0x42a7f8+'/'+_0x4b9849)['json'](_0x41f51b);}return null;};}function patchUpdates(_0x2d5205){return function(_0x2970c9){try{jsonpatch[_0xfdf3('0x1f')](_0x2970c9,_0x2d5205,!![]);}catch(_0x1df8a5){return BPromise[_0xfdf3('0x20')](_0x1df8a5);}return _0x2970c9[_0xfdf3('0x21')]();};}function saveUpdates(_0x1210f9,_0x4225f3){return function(_0x57a012){if(_0x57a012){return _0x57a012[_0xfdf3('0x22')](_0x1210f9)[_0xfdf3('0x23')](function(_0x44ad35){return _0x44ad35;});}return null;};}function removeEntity(_0x3be68d,_0x43ef76){return function(_0x33fabd){if(_0x33fabd){return _0x33fabd[_0xfdf3('0x24')]()['then'](function(){_0x3be68d['status'](0xcc)[_0xfdf3('0x17')]();});}};}function handleEntityNotFound(_0x216ac4,_0x48825){return function(_0xcd6b4){if(!_0xcd6b4){_0x216ac4[_0xfdf3('0x16')](0x194);}return _0xcd6b4;};}function handleError(_0x3ecbcb,_0x275802){_0x275802=_0x275802||0x1f4;return function(_0x2b58d2){logger[_0xfdf3('0x25')](_0x2b58d2[_0xfdf3('0x26')]);if(_0x2b58d2[_0xfdf3('0x27')]){delete _0x2b58d2[_0xfdf3('0x27')];}_0x3ecbcb['status'](_0x275802)['send'](_0x2b58d2);};}exports['index']=function(_0x125da7,_0x1057cd){var _0x35a1ea={},_0x197b41={},_0x3e1c87={'count':0x0,'rows':[]};var _0xfdb47f=_[_0xfdf3('0x28')](db['VoiceMailMessage'][_0xfdf3('0x29')],function(_0xc883db){return{'name':_0xc883db[_0xfdf3('0x2a')],'type':_0xc883db[_0xfdf3('0x2b')][_0xfdf3('0x2c')]};});_0x197b41[_0xfdf3('0x2d')]=_[_0xfdf3('0x2e')](_['map'](_0xfdb47f,_0xfdf3('0x27')),['name']);_0x197b41[_0xfdf3('0x2f')]=_[_0xfdf3('0x30')](_0x125da7[_0xfdf3('0x2f')]);_0x197b41[_0xfdf3('0x31')]=_[_0xfdf3('0x32')](_0x197b41[_0xfdf3('0x2d')],_0x197b41[_0xfdf3('0x2f')]);_0x35a1ea[_0xfdf3('0x33')]=_['intersection'](_0x197b41[_0xfdf3('0x2d')],qs[_0xfdf3('0x34')](_0x125da7[_0xfdf3('0x2f')][_0xfdf3('0x34')]));_0x35a1ea[_0xfdf3('0x33')]=_0x35a1ea[_0xfdf3('0x33')][_0xfdf3('0x35')]?_0x35a1ea['attributes']:_0x197b41[_0xfdf3('0x2d')];if(!_0x125da7[_0xfdf3('0x2f')][_0xfdf3('0x36')]('nolimit')){_0x35a1ea[_0xfdf3('0x1b')]=qs[_0xfdf3('0x1b')](_0x125da7[_0xfdf3('0x2f')][_0xfdf3('0x1b')]);_0x35a1ea[_0xfdf3('0x1d')]=qs['offset'](_0x125da7[_0xfdf3('0x2f')]['offset']);}_0x35a1ea['order']=qs[_0xfdf3('0x37')](_0x125da7[_0xfdf3('0x2f')][_0xfdf3('0x37')]);_0x35a1ea['where']=qs[_0xfdf3('0x31')](_[_0xfdf3('0x38')](_0x125da7[_0xfdf3('0x2f')],_0x197b41[_0xfdf3('0x31')]),_0xfdb47f);if(_0x125da7[_0xfdf3('0x2f')]['filter']){_0x35a1ea[_0xfdf3('0x39')]=_[_0xfdf3('0x3a')](_0x35a1ea[_0xfdf3('0x39')],{'$or':_[_0xfdf3('0x28')](_0xfdb47f,function(_0x1f9705){if(_0x1f9705[_0xfdf3('0x2b')]!==_0xfdf3('0x3b')){var _0x400dd5={};_0x400dd5[_0x1f9705['name']]={'$like':'%'+_0x125da7[_0xfdf3('0x2f')][_0xfdf3('0x3c')]+'%'};return _0x400dd5;}})});}_0x35a1ea=_['merge']({},_0x35a1ea,_0x125da7['options']);var _0x365212={'where':_0x35a1ea[_0xfdf3('0x39')]};return db[_0xfdf3('0x3d')][_0xfdf3('0x1c')](_0x365212)[_0xfdf3('0x23')](function(_0xb05c57){_0x3e1c87[_0xfdf3('0x1c')]=_0xb05c57;if(_0x125da7[_0xfdf3('0x2f')]['includeAll']){_0x35a1ea[_0xfdf3('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xfdf3('0x3f')](_0x35a1ea);})[_0xfdf3('0x23')](function(_0x2c9438){_0x3e1c87[_0xfdf3('0x40')]=_0x2c9438;return _0x3e1c87;})['then'](respondWithFilteredResult(_0x1057cd,_0x35a1ea))[_0xfdf3('0x41')](handleError(_0x1057cd,null));};exports[_0xfdf3('0x42')]=function(_0x3eb340,_0x4cbc60){var _0x321caa={'raw':!![],'where':{'id':_0x3eb340[_0xfdf3('0x43')]['id']}},_0x5b14ab={};_0x5b14ab[_0xfdf3('0x2d')]=_[_0xfdf3('0x30')](db['VoiceMailMessage'][_0xfdf3('0x29')]);_0x5b14ab[_0xfdf3('0x2f')]=_[_0xfdf3('0x30')](_0x3eb340[_0xfdf3('0x2f')]);_0x5b14ab[_0xfdf3('0x31')]=_[_0xfdf3('0x32')](_0x5b14ab[_0xfdf3('0x2d')],_0x5b14ab[_0xfdf3('0x2f')]);_0x321caa[_0xfdf3('0x33')]=_[_0xfdf3('0x32')](_0x5b14ab[_0xfdf3('0x2d')],qs[_0xfdf3('0x34')](_0x3eb340[_0xfdf3('0x2f')][_0xfdf3('0x34')]));_0x321caa[_0xfdf3('0x33')]=_0x321caa[_0xfdf3('0x33')]['length']?_0x321caa[_0xfdf3('0x33')]:_0x5b14ab['model'];if(_0x3eb340['query']['includeAll']){_0x321caa[_0xfdf3('0x3e')]=[{'all':!![]}];}_0x321caa=_[_0xfdf3('0x3a')]({},_0x321caa,_0x3eb340[_0xfdf3('0x44')]);return db[_0xfdf3('0x3d')][_0xfdf3('0x45')](_0x321caa)[_0xfdf3('0x23')](handleEntityNotFound(_0x4cbc60,null))[_0xfdf3('0x23')](respondWithResult(_0x4cbc60,null))['catch'](handleError(_0x4cbc60,null));};exports[_0xfdf3('0x46')]=function(_0x413c9f,_0xcefd09){return db[_0xfdf3('0x3d')]['create'](_0x413c9f[_0xfdf3('0x47')],{})[_0xfdf3('0x23')](respondWithResult(_0xcefd09,0xc9))['catch'](handleError(_0xcefd09,null));};exports['update']=function(_0x163639,_0x33bf83){if(_0x163639[_0xfdf3('0x47')]['id']){delete _0x163639[_0xfdf3('0x47')]['id'];}return db['VoiceMailMessage'][_0xfdf3('0x45')]({'where':{'id':_0x163639[_0xfdf3('0x43')]['id']}})['then'](handleEntityNotFound(_0x33bf83,null))[_0xfdf3('0x23')](saveUpdates(_0x163639[_0xfdf3('0x47')],null))[_0xfdf3('0x23')](respondWithResult(_0x33bf83,null))[_0xfdf3('0x41')](handleError(_0x33bf83,null));};exports[_0xfdf3('0x24')]=function(_0x55d18a,_0x124207){return db[_0xfdf3('0x3d')]['find']({'where':{'id':_0x55d18a[_0xfdf3('0x43')]['id']}})['then'](handleEntityNotFound(_0x124207,null))[_0xfdf3('0x23')](removeEntity(_0x124207,null))[_0xfdf3('0x41')](handleError(_0x124207,null));};exports[_0xfdf3('0x48')]=function(_0x8836d1,_0x3e85a6,_0x14b188){return db['VoiceMailMessage'][_0xfdf3('0x45')]({'where':{'id':_0x8836d1[_0xfdf3('0x43')]['id']},'attributes':['id',_0xfdf3('0x49'),_0xfdf3('0x4a')]})[_0xfdf3('0x23')](handleEntityNotFound(_0x3e85a6,null))[_0xfdf3('0x23')](function(_0x8e8577){if(_0x8e8577){if(!_0x8e8577['recording']){throw new db['Sequelize']['ValidationError'](_0xfdf3('0x4b'));}var _0x56603e={'Content-Type':_0xfdf3('0x4c'),'Content-Disposition':_0xfdf3('0x4d')};if(_0x8e8577[_0xfdf3('0x4a')]){_0x56603e['Content-Disposition']=_0xfdf3('0x4e')+_0x8e8577[_0xfdf3('0x4a')]+_0xfdf3('0x4f');}_0x3e85a6['set'](_0x56603e);return _0x3e85a6[_0xfdf3('0x50')](new Buffer(_0x8e8577[_0xfdf3('0x49')]));}})[_0xfdf3('0x41')](handleError(_0x3e85a6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index cc09134..647d472 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 _0x3d6f=['../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1beece,_0x42d8ff){var _0x250492=function(_0x25f195){while(--_0x25f195){_0x1beece['push'](_0x1beece['shift']());}};_0x250492(++_0x42d8ff);}(_0x3d6f,0x131));var _0xf3d6=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x3d6f[_0x461c18];return _0x35501c;};'use strict';var _=require(_0xf3d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf3d6('0x1'));var moment=require(_0xf3d6('0x2'));var BPromise=require(_0xf3d6('0x3'));var rp=require(_0xf3d6('0x4'));var fs=require('fs');var path=require(_0xf3d6('0x5'));var rimraf=require(_0xf3d6('0x6'));var config=require(_0xf3d6('0x7'));var attributes=require(_0xf3d6('0x8'));module['exports']=function(_0x21cbc9,_0x3b9b91){return _0x21cbc9[_0xf3d6('0x9')](_0xf3d6('0xa'),attributes,{'tableName':_0xf3d6('0xb'),'paranoid':![],'indexes':[{'name':_0xf3d6('0xc'),'fields':[_0xf3d6('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbae7=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xbae7,0x111));var _0x7bae=function(_0x113855,_0x2bd31b){_0x113855=_0x113855-0x0;var _0x229a37=_0xbae7[_0x113855];return _0x229a37;};'use strict';var _=require(_0x7bae('0x0'));var util=require('util');var logger=require(_0x7bae('0x1'))(_0x7bae('0x2'));var moment=require('moment');var BPromise=require(_0x7bae('0x3'));var rp=require(_0x7bae('0x4'));var fs=require('fs');var path=require(_0x7bae('0x5'));var rimraf=require(_0x7bae('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bae('0x7'));module[_0x7bae('0x8')]=function(_0x28da4f,_0x4692fa){return _0x28da4f['define'](_0x7bae('0x9'),attributes,{'tableName':_0x7bae('0xa'),'paranoid':![],'indexes':[{'name':_0x7bae('0xb'),'fields':[_0x7bae('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d86c1e0..8d8f0f4 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 _0xd847=['VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xd847,0x14b));var _0x7d84=function(_0x243a18,_0x566c36){_0x243a18=_0x243a18-0x0;var _0x2e40c9=_0xd847[_0x243a18];return _0x2e40c9;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var moment=require(_0x7d84('0x2'));var BPromise=require(_0x7d84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d84('0x4'));var db=require(_0x7d84('0x5'))['db'];var utils=require(_0x7d84('0x6'));var logger=require(_0x7d84('0x7'))('rpc');var config=require(_0x7d84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe17b58,_0xa6053d,_0x53fbef){return new BPromise(function(_0x54ae0d,_0x37479e){return client['request'](_0xe17b58,_0x53fbef)[_0x7d84('0xa')](function(_0x56e4b7){logger['info'](_0x7d84('0xb'),_0xa6053d,'request\x20sent');logger['debug'](_0x7d84('0xc'),_0xa6053d,'request\x20sent',JSON[_0x7d84('0xd')](_0x56e4b7));if(_0x56e4b7[_0x7d84('0xe')]){if(_0x56e4b7['error'][_0x7d84('0xf')]===0x1f4){logger[_0x7d84('0xe')](_0x7d84('0xb'),_0xa6053d,_0x56e4b7[_0x7d84('0xe')][_0x7d84('0x10')]);return _0x37479e(_0x56e4b7[_0x7d84('0xe')][_0x7d84('0x10')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xa6053d,_0x56e4b7[_0x7d84('0xe')][_0x7d84('0x10')]);return _0x54ae0d(_0x56e4b7[_0x7d84('0xe')][_0x7d84('0x10')]);}else{logger['info'](_0x7d84('0xb'),_0xa6053d,_0x7d84('0x11'));_0x54ae0d(_0x56e4b7[_0x7d84('0x12')][_0x7d84('0x10')]);}})['catch'](function(_0x208e22){logger[_0x7d84('0xe')](_0x7d84('0xb'),_0xa6053d,_0x208e22);_0x37479e(_0x208e22);});});} \ No newline at end of file +var _0x323a=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x405cde,_0x1b3bb0){var _0x14bce7=function(_0x61cb5f){while(--_0x61cb5f){_0x405cde['push'](_0x405cde['shift']());}};_0x14bce7(++_0x1b3bb0);}(_0x323a,0x73));var _0xa323=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x323a[_0x1d291d];return _0x44cc4e;};'use strict';var _=require(_0xa323('0x0'));var util=require('util');var moment=require(_0xa323('0x1'));var BPromise=require(_0xa323('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa323('0x3'));var db=require(_0xa323('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa323('0x5'));var config=require(_0xa323('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa323('0x7')][_0xa323('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ef98b,_0x4aaafb,_0x2e7676){return new BPromise(function(_0x388426,_0x5a8935){return client[_0xa323('0x9')](_0x3ef98b,_0x2e7676)[_0xa323('0xa')](function(_0x2282a8){logger[_0xa323('0xb')](_0xa323('0xc'),_0x4aaafb,_0xa323('0xd'));logger['debug'](_0xa323('0xe'),_0x4aaafb,'request\x20sent',JSON[_0xa323('0xf')](_0x2282a8));if(_0x2282a8[_0xa323('0x10')]){if(_0x2282a8['error'][_0xa323('0x11')]===0x1f4){logger['error'](_0xa323('0xc'),_0x4aaafb,_0x2282a8[_0xa323('0x10')][_0xa323('0x12')]);return _0x5a8935(_0x2282a8[_0xa323('0x10')]['message']);}logger[_0xa323('0x10')](_0xa323('0xc'),_0x4aaafb,_0x2282a8['error'][_0xa323('0x12')]);return _0x388426(_0x2282a8['error'][_0xa323('0x12')]);}else{logger['info'](_0xa323('0xc'),_0x4aaafb,_0xa323('0xd'));_0x388426(_0x2282a8[_0xa323('0x13')][_0xa323('0x12')]);}})[_0xa323('0x14')](function(_0x16594e){logger[_0xa323('0x10')](_0xa323('0xc'),_0x4aaafb,_0x16594e);_0x5a8935(_0x16594e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 96ed284..9a89002 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 _0x856c=['/:id','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/sounds','post','create','put'];(function(_0xde5d8a,_0x4afa17){var _0x2b3040=function(_0x112a1e){while(--_0x112a1e){_0xde5d8a['push'](_0xde5d8a['shift']());}};_0x2b3040(++_0x4afa17);}(_0x856c,0xcf));var _0xc856=function(_0x4dc9e2,_0x9b0f3e){_0x4dc9e2=_0x4dc9e2-0x0;var _0x54219e=_0x856c[_0x4dc9e2];return _0x54219e;};'use strict';var multer=require('multer');var util=require(_0xc856('0x0'));var path=require(_0xc856('0x1'));var timeout=require('connect-timeout');var express=require(_0xc856('0x2'));var router=express[_0xc856('0x3')]();var fs_extra=require(_0xc856('0x4'));var auth=require(_0xc856('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc856('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xc856('0x7')]('/',auth[_0xc856('0x8')](),controller['index']);router[_0xc856('0x7')]('/:id',auth[_0xc856('0x8')](),controller[_0xc856('0x9')]);router[_0xc856('0x7')](_0xc856('0xa'),auth['isAuthenticated'](),controller['getSounds']);router[_0xc856('0xb')]('/',auth['isAuthenticated'](),controller[_0xc856('0xc')]);router['post'](_0xc856('0xa'),auth[_0xc856('0x8')](),controller['addSound']);router[_0xc856('0xd')](_0xc856('0xe'),auth['isAuthenticated'](),controller[_0xc856('0xf')]);router[_0xc856('0x10')](_0xc856('0xe'),auth[_0xc856('0x8')](),controller['destroy']);router[_0xc856('0x10')]('/:id/sounds/:id2',auth[_0xc856('0x8')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x5159=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','update','delete','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5159,0x1e1));var _0x9515=function(_0x497257,_0x334058){_0x497257=_0x497257-0x0;var _0x6ced29=_0x5159[_0x497257];return _0x6ced29;};'use strict';var multer=require(_0x9515('0x0'));var util=require(_0x9515('0x1'));var path=require(_0x9515('0x2'));var timeout=require('connect-timeout');var express=require(_0x9515('0x3'));var router=express[_0x9515('0x4')]();var fs_extra=require(_0x9515('0x5'));var auth=require(_0x9515('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9515('0x7'));var controller=require(_0x9515('0x8'));router[_0x9515('0x9')]('/',auth[_0x9515('0xa')](),controller[_0x9515('0xb')]);router[_0x9515('0x9')](_0x9515('0xc'),auth[_0x9515('0xa')](),controller[_0x9515('0xd')]);router[_0x9515('0x9')](_0x9515('0xe'),auth[_0x9515('0xa')](),controller[_0x9515('0xf')]);router['post']('/',auth[_0x9515('0xa')](),controller[_0x9515('0x10')]);router[_0x9515('0x11')](_0x9515('0xe'),auth[_0x9515('0xa')](),controller['addSound']);router['put']('/:id',auth[_0x9515('0xa')](),controller[_0x9515('0x12')]);router[_0x9515('0x13')](_0x9515('0xc'),auth[_0x9515('0xa')](),controller['destroy']);router[_0x9515('0x13')]('/:id/sounds/:id2',auth[_0x9515('0xa')](),controller['removeSound']);module[_0x9515('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4b8cc8f..c74e2c2 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 _0x2104=['ENUM','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x5e4e1b,_0x191eb1){var _0x58173e=function(_0x1e9c44){while(--_0x1e9c44){_0x5e4e1b['push'](_0x5e4e1b['shift']());}};_0x58173e(++_0x191eb1);}(_0x2104,0x110));var _0x4210=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x2104[_0x188d31];return _0x30ed33;};'use strict';var Sequelize=require(_0x4210('0x0'));module[_0x4210('0x1')]={'name':{'type':Sequelize[_0x4210('0x2')],'allowNull':![],'unique':_0x4210('0x3')},'mode':{'type':Sequelize[_0x4210('0x4')]('custom','files',_0x4210('0x5'),_0x4210('0x6'),_0x4210('0x7'),_0x4210('0x8')),'allowNull':!![],'defaultValue':_0x4210('0x9')},'directory':{'type':Sequelize[_0x4210('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4210('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4210('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4210('0x2')],'allowNull':!![],'defaultValue':_0x4210('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4210('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a01=['custom','files','mp3nb','quietmp3nb','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x50844d,_0x586c1e){var _0x1aef1c=function(_0x43b4c5){while(--_0x43b4c5){_0x50844d['push'](_0x50844d['shift']());}};_0x1aef1c(++_0x586c1e);}(_0x8a01,0x96));var _0x18a0=function(_0x534563,_0x434f5c){_0x534563=_0x534563-0x0;var _0x33b4d6=_0x8a01[_0x534563];return _0x33b4d6;};'use strict';var Sequelize=require(_0x18a0('0x0'));module[_0x18a0('0x1')]={'name':{'type':Sequelize[_0x18a0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x18a0('0x3')](_0x18a0('0x4'),_0x18a0('0x5'),_0x18a0('0x6'),_0x18a0('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x18a0('0x5')},'directory':{'type':Sequelize[_0x18a0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x18a0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x18a0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x18a0('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x18a0('0x9')},'defaultEntry':{'type':Sequelize[_0x18a0('0xa')],'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 8530dc8..a4ae9b6 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 _0xfbd1=['Sound','server/files/sounds/converted','%s.%s','basename','save_name','format','converted_format','Sequelize','removeSound','findOne','id2','createdAt','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','ValidationError','message','addSound'];(function(_0x2d992c,_0x4d6498){var _0x3033e2=function(_0x59c910){while(--_0x59c910){_0x2d992c['push'](_0x2d992c['shift']());}};_0x3033e2(++_0x4d6498);}(_0xfbd1,0xed));var _0x1fbd=function(_0x34311c,_0x52a317){_0x34311c=_0x34311c-0x0;var _0x4b8b35=_0xfbd1[_0x34311c];return _0x4b8b35;};'use strict';var emlformat=require(_0x1fbd('0x0'));var rimraf=require(_0x1fbd('0x1'));var zipdir=require(_0x1fbd('0x2'));var jsonpatch=require(_0x1fbd('0x3'));var rp=require('request-promise');var moment=require(_0x1fbd('0x4'));var BPromise=require(_0x1fbd('0x5'));var Mustache=require(_0x1fbd('0x6'));var util=require(_0x1fbd('0x7'));var path=require(_0x1fbd('0x8'));var sox=require(_0x1fbd('0x9'));var csv=require(_0x1fbd('0xa'));var ejs=require(_0x1fbd('0xb'));var fs=require('fs');var fs_extra=require(_0x1fbd('0xc'));var _=require(_0x1fbd('0xd'));var squel=require(_0x1fbd('0xe'));var crypto=require('crypto');var jsforce=require(_0x1fbd('0xf'));var deskjs=require(_0x1fbd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1fbd('0x11'));var Redis=require('ioredis');var authService=require(_0x1fbd('0x12'));var qs=require(_0x1fbd('0x13'));var as=require(_0x1fbd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fbd('0x15'));var utils=require(_0x1fbd('0x16'));var config=require(_0x1fbd('0x17'));var licenseUtil=require(_0x1fbd('0x18'));var db=require(_0x1fbd('0x19'))['db'];function respondWithStatusCode(_0x34fc91,_0x99b3cf){_0x99b3cf=_0x99b3cf||0xcc;return function(_0x380015){if(_0x380015){return _0x34fc91[_0x1fbd('0x1a')](_0x99b3cf);}return _0x34fc91['status'](_0x99b3cf)[_0x1fbd('0x1b')]();};}function respondWithResult(_0x44aafd,_0x5bcb81){_0x5bcb81=_0x5bcb81||0xc8;return function(_0x2cfa68){if(_0x2cfa68){return _0x44aafd[_0x1fbd('0x1c')](_0x5bcb81)['json'](_0x2cfa68);}};}function respondWithFilteredResult(_0x553006,_0x2eedc3){return function(_0x5332cf){if(_0x5332cf){var _0x36770a=typeof _0x2eedc3[_0x1fbd('0x1d')]===_0x1fbd('0x1e')&&typeof _0x2eedc3[_0x1fbd('0x1f')]===_0x1fbd('0x1e');var _0x15e087=_0x5332cf[_0x1fbd('0x20')];var _0x4af3d0=_0x36770a?0x0:_0x2eedc3['offset'];var _0x544417=_0x36770a?_0x5332cf[_0x1fbd('0x20')]:_0x2eedc3[_0x1fbd('0x1d')]+_0x2eedc3['limit'];var _0x135666;if(_0x544417>=_0x15e087){_0x544417=_0x15e087;_0x135666=0xc8;}else{_0x135666=0xce;}_0x553006[_0x1fbd('0x1c')](_0x135666);return _0x553006[_0x1fbd('0x21')]('Content-Range',_0x4af3d0+'-'+_0x544417+'/'+_0x15e087)[_0x1fbd('0x22')](_0x5332cf);}return null;};}function patchUpdates(_0x168a89){return function(_0x4c13ef){try{jsonpatch[_0x1fbd('0x23')](_0x4c13ef,_0x168a89,!![]);}catch(_0x2831e2){return BPromise[_0x1fbd('0x24')](_0x2831e2);}return _0x4c13ef[_0x1fbd('0x25')]();};}function saveUpdates(_0x553ba5,_0x5e91f0){return function(_0x5dda24){if(_0x5dda24){return _0x5dda24[_0x1fbd('0x26')](_0x553ba5)['then'](function(_0x2ae9){return _0x2ae9;});}return null;};}function removeEntity(_0x1ceddc,_0x2107be){return function(_0x59cac3){if(_0x59cac3){return _0x59cac3['destroy']()[_0x1fbd('0x27')](function(){var _0xb61a6f=_0x59cac3[_0x1fbd('0x28')]({'plain':!![]});var _0x566e5c=_0x1fbd('0x29');return db[_0x1fbd('0x2a')][_0x1fbd('0x2b')]({'where':{'type':_0x566e5c,'resourceId':_0xb61a6f['id']}})[_0x1fbd('0x27')](function(){return _0x59cac3;});})['then'](function(){_0x1ceddc[_0x1fbd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf4ff70,_0x20fb54){return function(_0x1f9f2d){if(!_0x1f9f2d){_0xf4ff70['sendStatus'](0x194);}return _0x1f9f2d;};}function handleError(_0x40f018,_0x45e5df){_0x45e5df=_0x45e5df||0x1f4;return function(_0x24b274){logger[_0x1fbd('0x2c')](_0x24b274['stack']);if(_0x24b274[_0x1fbd('0x2d')]){delete _0x24b274[_0x1fbd('0x2d')];}_0x40f018[_0x1fbd('0x1c')](_0x45e5df)[_0x1fbd('0x2e')](_0x24b274);};}exports['index']=function(_0xd348ea,_0x578901){var _0x44d2fd={},_0x4b986b={},_0x1b616f={'count':0x0,'rows':[]};var _0x2a38b3=_[_0x1fbd('0x2f')](db[_0x1fbd('0x30')][_0x1fbd('0x31')],function(_0x4454f7){return{'name':_0x4454f7[_0x1fbd('0x32')],'type':_0x4454f7['type'][_0x1fbd('0x33')]};});_0x4b986b[_0x1fbd('0x34')]=_[_0x1fbd('0x2f')](_0x2a38b3,_0x1fbd('0x2d'));_0x4b986b['query']=_[_0x1fbd('0x35')](_0xd348ea[_0x1fbd('0x36')]);_0x4b986b[_0x1fbd('0x37')]=_[_0x1fbd('0x38')](_0x4b986b['model'],_0x4b986b[_0x1fbd('0x36')]);_0x44d2fd[_0x1fbd('0x39')]=_['intersection'](_0x4b986b[_0x1fbd('0x34')],qs[_0x1fbd('0x3a')](_0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x3a')]));_0x44d2fd[_0x1fbd('0x39')]=_0x44d2fd['attributes'][_0x1fbd('0x3b')]?_0x44d2fd[_0x1fbd('0x39')]:_0x4b986b[_0x1fbd('0x34')];if(!_0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x3c')](_0x1fbd('0x3d'))){_0x44d2fd[_0x1fbd('0x1f')]=qs[_0x1fbd('0x1f')](_0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x1f')]);_0x44d2fd[_0x1fbd('0x1d')]=qs[_0x1fbd('0x1d')](_0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x1d')]);}_0x44d2fd[_0x1fbd('0x3e')]=qs[_0x1fbd('0x3f')](_0xd348ea['query'][_0x1fbd('0x3f')]);delete _0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x3f')];_0x44d2fd[_0x1fbd('0x40')]=qs[_0x1fbd('0x37')](_[_0x1fbd('0x41')](_0xd348ea[_0x1fbd('0x36')],_0x4b986b[_0x1fbd('0x37')]),_0x2a38b3);if(_0xd348ea[_0x1fbd('0x36')][_0x1fbd('0x42')]){_0x44d2fd[_0x1fbd('0x40')]=_[_0x1fbd('0x43')](_0x44d2fd['where'],{'$or':_['map'](_0x2a38b3,function(_0x28d7ad){if(_0x28d7ad[_0x1fbd('0x44')]!==_0x1fbd('0x45')){var _0x4a52ea={};_0x4a52ea[_0x28d7ad[_0x1fbd('0x2d')]]={'$like':'%'+_0xd348ea[_0x1fbd('0x36')]['filter']+'%'};return _0x4a52ea;}})});}_0x44d2fd=_[_0x1fbd('0x43')]({},_0x44d2fd,_0xd348ea[_0x1fbd('0x46')]);var _0x1f26da={'where':_0x44d2fd['where']};return db[_0x1fbd('0x30')][_0x1fbd('0x20')](_0x1f26da)['then'](function(_0xb8b936){_0x1b616f['count']=_0xb8b936;if(_0xd348ea['query'][_0x1fbd('0x47')]){_0x44d2fd[_0x1fbd('0x48')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1fbd('0x49')](_0x44d2fd);})['then'](function(_0x2fc432){_0x1b616f[_0x1fbd('0x4a')]=_0x2fc432;return _0x1b616f;})[_0x1fbd('0x27')](respondWithFilteredResult(_0x578901,_0x44d2fd))['catch'](handleError(_0x578901,null));};exports['show']=function(_0xed1dc0,_0x45ec58){var _0xe3a654={'raw':![],'where':{'id':_0xed1dc0[_0x1fbd('0x4b')]['id']}},_0x56f16a={};_0x56f16a[_0x1fbd('0x34')]=_['keys'](db[_0x1fbd('0x30')][_0x1fbd('0x31')]);_0x56f16a[_0x1fbd('0x36')]=_['keys'](_0xed1dc0['query']);_0x56f16a[_0x1fbd('0x37')]=_['intersection'](_0x56f16a[_0x1fbd('0x34')],_0x56f16a[_0x1fbd('0x36')]);_0xe3a654[_0x1fbd('0x39')]=_[_0x1fbd('0x38')](_0x56f16a[_0x1fbd('0x34')],qs['fields'](_0xed1dc0[_0x1fbd('0x36')][_0x1fbd('0x3a')]));_0xe3a654[_0x1fbd('0x39')]=_0xe3a654['attributes'][_0x1fbd('0x3b')]?_0xe3a654[_0x1fbd('0x39')]:_0x56f16a[_0x1fbd('0x34')];if(_0xed1dc0[_0x1fbd('0x36')][_0x1fbd('0x47')]){_0xe3a654[_0x1fbd('0x48')]=[{'all':!![]}];}_0xe3a654=_['merge']({},_0xe3a654,_0xed1dc0[_0x1fbd('0x46')]);return db['VoiceMusicOnHold'][_0x1fbd('0x4c')](_0xe3a654)[_0x1fbd('0x27')](handleEntityNotFound(_0x45ec58,null))[_0x1fbd('0x27')](respondWithResult(_0x45ec58,null))[_0x1fbd('0x4d')](handleError(_0x45ec58,null));};exports['update']=function(_0x2e2647,_0x306dc0){if(_0x2e2647[_0x1fbd('0x4e')]['id']){delete _0x2e2647[_0x1fbd('0x4e')]['id'];}return db[_0x1fbd('0x30')][_0x1fbd('0x4c')]({'where':{'id':_0x2e2647['params']['id']}})[_0x1fbd('0x27')](handleEntityNotFound(_0x306dc0,null))[_0x1fbd('0x27')](saveUpdates(_0x2e2647[_0x1fbd('0x4e')],null))['then'](respondWithResult(_0x306dc0,null))[_0x1fbd('0x4d')](handleError(_0x306dc0,null));};exports[_0x1fbd('0x4f')]=function(_0x4c42e3,_0x16e1e7,_0x2f9768){return db[_0x1fbd('0x50')][_0x1fbd('0x51')](function(_0x1bd7c9){if(_0x4c42e3[_0x1fbd('0x4e')]['mode']===_0x1fbd('0x52')){_0x4c42e3[_0x1fbd('0x4e')][_0x1fbd('0x53')]=path[_0x1fbd('0x54')](config[_0x1fbd('0x55')],_0x1fbd('0x56'),_0x4c42e3['body'][_0x1fbd('0x2d')]);}return db['VoiceMusicOnHold'][_0x1fbd('0x4f')](_0x4c42e3[_0x1fbd('0x4e')],{'transaction':_0x1bd7c9})[_0x1fbd('0x27')](function(_0x3f19c9){if(_0x4c42e3[_0x1fbd('0x4e')][_0x1fbd('0x57')]===_0x1fbd('0x52')){fs[_0x1fbd('0x58')](_0x3f19c9[_0x1fbd('0x53')],parseInt('0777',0x8));}var _0x11f69c=_0x4c42e3['user'][_0x1fbd('0x28')]({'plain':!![]});if(!_0x11f69c)throw new Error(_0x1fbd('0x59'));if(_0x11f69c[_0x1fbd('0x5a')]==='user'){var _0x1fb0cc=_0x3f19c9[_0x1fbd('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x1fbd('0x4c')]({'where':{'name':_0x1fbd('0x29'),'userProfileId':_0x11f69c[_0x1fbd('0x5b')]},'raw':!![]})[_0x1fbd('0x27')](function(_0x2035fd){if(_0x2035fd&&_0x2035fd['autoAssociation']===0x0){return db[_0x1fbd('0x2a')][_0x1fbd('0x4f')]({'name':_0x1fb0cc[_0x1fbd('0x2d')],'resourceId':_0x1fb0cc['id'],'type':_0x2035fd['name'],'sectionId':_0x2035fd['id']},{})[_0x1fbd('0x27')](function(){return _0x3f19c9;});}else{return _0x3f19c9;}})['catch'](function(_0xde0951){logger[_0x1fbd('0x2c')](_0x1fbd('0x5c'),_0xde0951);});}return _0x3f19c9;});})['then'](respondWithResult(_0x16e1e7,0xc9))[_0x1fbd('0x4d')](handleError(_0x16e1e7,null));};exports[_0x1fbd('0x2b')]=function(_0x52d3ef,_0x19ea8a,_0x2607a5){var _0x4e73b3;return db['VoiceMusicOnHold'][_0x1fbd('0x4c')]({'where':{'id':_0x52d3ef[_0x1fbd('0x4b')]['id']}})['then'](function(_0x399b14){if(_0x399b14){return db[_0x1fbd('0x50')][_0x1fbd('0x51')](function(_0x4d536c){return _0x399b14[_0x1fbd('0x2b')]({'transaction':_0x4d536c,'raw':!![]})[_0x1fbd('0x27')](function(_0x6c55b5){if(_0x6c55b5[_0x1fbd('0x53')]){fs[_0x1fbd('0x5d')](_0x6c55b5['directory'])[_0x1fbd('0x5e')](function(_0x38bee2){fs[_0x1fbd('0x5f')](path[_0x1fbd('0x54')](_0x6c55b5[_0x1fbd('0x53')],_0x38bee2));});fs['rmdirSync'](_0x6c55b5[_0x1fbd('0x53')]);}return _0x6c55b5;});})[_0x1fbd('0x4d')](function(_0x5799ae){throw new db['Sequelize'][(_0x1fbd('0x60'))](_0x5799ae[_0x1fbd('0x61')]);});}})[_0x1fbd('0x27')](handleEntityNotFound(_0x19ea8a,null))[_0x1fbd('0x27')](removeEntity(_0x19ea8a,null))[_0x1fbd('0x4d')](handleError(_0x19ea8a,null));};exports[_0x1fbd('0x62')]=function(_0x1c3236,_0x3b0369,_0x422c6f){return db['sequelize'][_0x1fbd('0x51')](function(_0x5484ed){var _0x4c1ae8;return db['VoiceMusicOnHold'][_0x1fbd('0x4c')]({'where':{'id':_0x1c3236[_0x1fbd('0x4b')]['id']}})['then'](function(_0x1a8335){if(_0x1a8335){_0x4c1ae8=_0x1a8335;return _0x1a8335['addSound'](_0x1c3236[_0x1fbd('0x4e')]['id'],{'transaction':_0x5484ed});}})[_0x1fbd('0x27')](function(_0x495c2d){if(_0x495c2d){return db[_0x1fbd('0x63')]['findOne']({'where':{'id':_0x1c3236[_0x1fbd('0x4e')]['id']},'attributes':['id',_0x1fbd('0x2d'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0x1fbd('0x27')](function(_0x2f22cd){if(_0x2f22cd){var _0x275b5b=path[_0x1fbd('0x54')](config[_0x1fbd('0x55')],_0x1fbd('0x64'),util['format'](_0x1fbd('0x65'),path[_0x1fbd('0x66')](_0x2f22cd[_0x1fbd('0x67')],path['extname'](_0x2f22cd['save_name'])),_0x2f22cd['converted_format']));var _0x31ee5f=path[_0x1fbd('0x54')](config[_0x1fbd('0x55')],_0x1fbd('0x56'),_0x4c1ae8['name'],util[_0x1fbd('0x68')](_0x1fbd('0x65'),_0x2f22cd[_0x1fbd('0x2d')],_0x2f22cd[_0x1fbd('0x69')]));fs['symlinkSync'](_0x275b5b,_0x31ee5f);return _0x2f22cd;}})['catch'](function(_0x399f2d){throw new db[(_0x1fbd('0x6a'))][(_0x1fbd('0x60'))](_0x399f2d[_0x1fbd('0x61')]);});})[_0x1fbd('0x27')](handleEntityNotFound(_0x3b0369,null))[_0x1fbd('0x27')](respondWithResult(_0x3b0369,0xc9))[_0x1fbd('0x4d')](handleError(_0x3b0369,null));};exports[_0x1fbd('0x6b')]=function(_0x45e87b,_0x52e035,_0x26ee4e){return db[_0x1fbd('0x50')][_0x1fbd('0x51')](function(_0x312435){var _0x39f8b9;return db[_0x1fbd('0x30')][_0x1fbd('0x6c')]({'where':{'id':_0x45e87b[_0x1fbd('0x4b')]['id']}})[_0x1fbd('0x27')](handleEntityNotFound(_0x52e035,null))[_0x1fbd('0x27')](function(_0x3c1ae3){if(_0x3c1ae3){_0x39f8b9=_0x3c1ae3;return _0x3c1ae3['removeSound'](_0x45e87b[_0x1fbd('0x4b')][_0x1fbd('0x6d')]);}})[_0x1fbd('0x27')](function(_0x5dce8b){if(_0x5dce8b){return db[_0x1fbd('0x63')]['findOne']({'where':{'id':_0x45e87b[_0x1fbd('0x4b')]['id2']},'attributes':['id',_0x1fbd('0x2d'),_0x1fbd('0x67'),_0x1fbd('0x69'),_0x1fbd('0x6e')],'raw':!![]});}})[_0x1fbd('0x27')](function(_0x481c88){if(_0x481c88){fs[_0x1fbd('0x5f')](path['join'](_0x39f8b9[_0x1fbd('0x53')],util['format'](_0x1fbd('0x65'),_0x481c88[_0x1fbd('0x2d')],_0x481c88['converted_format'])));return _0x481c88;}})[_0x1fbd('0x4d')](function(_0x1d7f64){throw new db[(_0x1fbd('0x6a'))][(_0x1fbd('0x60'))](_0x1d7f64[_0x1fbd('0x61')]);});})[_0x1fbd('0x27')](handleEntityNotFound(_0x52e035,null))[_0x1fbd('0x27')](respondWithStatusCode(_0x52e035,0xcc))[_0x1fbd('0x4d')](handleError(_0x52e035,null));};exports[_0x1fbd('0x6f')]=function(_0x147076,_0x4fbd96,_0x52ba68){var _0x1dcd0f={};var _0x2f9b09={};var _0x1a1c82;var _0x27830b;return db['VoiceMusicOnHold'][_0x1fbd('0x6c')]({'where':{'id':_0x147076['params']['id']}})[_0x1fbd('0x27')](handleEntityNotFound(_0x4fbd96,null))[_0x1fbd('0x27')](function(_0x4a9ece){if(_0x4a9ece){_0x1a1c82=_0x4a9ece;_0x2f9b09[_0x1fbd('0x34')]=_[_0x1fbd('0x35')](db[_0x1fbd('0x63')][_0x1fbd('0x31')]);_0x2f9b09['query']=_[_0x1fbd('0x35')](_0x147076[_0x1fbd('0x36')]);_0x2f9b09['filters']=_[_0x1fbd('0x38')](_0x2f9b09[_0x1fbd('0x34')],_0x2f9b09[_0x1fbd('0x36')]);_0x1dcd0f[_0x1fbd('0x39')]=_['intersection'](_0x2f9b09[_0x1fbd('0x34')],qs[_0x1fbd('0x3a')](_0x147076['query'][_0x1fbd('0x3a')]));_0x1dcd0f['attributes']=_0x1dcd0f['attributes']['length']?_0x1dcd0f[_0x1fbd('0x39')]:_0x2f9b09[_0x1fbd('0x34')];_0x1dcd0f[_0x1fbd('0x3e')]=qs[_0x1fbd('0x3f')](_0x147076[_0x1fbd('0x36')]['sort']);_0x1dcd0f[_0x1fbd('0x40')]=qs['filters'](_[_0x1fbd('0x41')](_0x147076[_0x1fbd('0x36')],_0x2f9b09[_0x1fbd('0x37')]));if(_0x147076[_0x1fbd('0x36')][_0x1fbd('0x42')]){_0x1dcd0f[_0x1fbd('0x40')]=_[_0x1fbd('0x43')](_0x1dcd0f[_0x1fbd('0x40')],{'$or':_[_0x1fbd('0x2f')](_0x1dcd0f[_0x1fbd('0x39')],function(_0x123532){var _0x2d07ec={};_0x2d07ec[_0x123532]={'$like':'%'+_0x147076[_0x1fbd('0x36')][_0x1fbd('0x42')]+'%'};return _0x2d07ec;})});}_0x1dcd0f=_[_0x1fbd('0x43')]({},_0x1dcd0f,_0x147076['options']);return _0x1a1c82['getSounds'](_0x1dcd0f);}})[_0x1fbd('0x27')](function(_0x594b01){if(_0x594b01){_0x27830b=_0x594b01['length'];if(!_0x147076['query'][_0x1fbd('0x3c')](_0x1fbd('0x3d'))){_0x1dcd0f[_0x1fbd('0x1f')]=qs[_0x1fbd('0x1f')](_0x147076[_0x1fbd('0x36')][_0x1fbd('0x1f')]);_0x1dcd0f[_0x1fbd('0x1d')]=qs[_0x1fbd('0x1d')](_0x147076[_0x1fbd('0x36')][_0x1fbd('0x1d')]);}return _0x1a1c82[_0x1fbd('0x6f')](_0x1dcd0f);}})[_0x1fbd('0x27')](function(_0x99dc92){if(_0x99dc92){return _0x99dc92?{'count':_0x27830b,'rows':_0x99dc92}:null;}})['then'](respondWithResult(_0x4fbd96,null))[_0x1fbd('0x4d')](handleError(_0x4fbd96,null));}; \ No newline at end of file +var _0xc44f=['message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','getSounds','hasOwnProperty','limit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','mode','directory','join','root','server/files/moh','create','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError'];(function(_0x9a799f,_0x410b64){var _0xa3578=function(_0x290ca6){while(--_0x290ca6){_0x9a799f['push'](_0x9a799f['shift']());}};_0xa3578(++_0x410b64);}(_0xc44f,0x7b));var _0xfc44=function(_0x298227,_0x4aca91){_0x298227=_0x298227-0x0;var _0x259b72=_0xc44f[_0x298227];return _0x259b72;};'use strict';var emlformat=require(_0xfc44('0x0'));var rimraf=require(_0xfc44('0x1'));var zipdir=require(_0xfc44('0x2'));var jsonpatch=require(_0xfc44('0x3'));var rp=require(_0xfc44('0x4'));var moment=require(_0xfc44('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc44('0x6'));var util=require(_0xfc44('0x7'));var path=require(_0xfc44('0x8'));var sox=require('sox');var csv=require(_0xfc44('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('crypto');var jsforce=require(_0xfc44('0xa'));var deskjs=require(_0xfc44('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc44('0xc'));var Redis=require(_0xfc44('0xd'));var authService=require(_0xfc44('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc44('0xf'));var logger=require('../../config/logger')(_0xfc44('0x10'));var utils=require(_0xfc44('0x11'));var config=require(_0xfc44('0x12'));var licenseUtil=require(_0xfc44('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247c32,_0x581b0a){_0x581b0a=_0x581b0a||0xcc;return function(_0x4f189e){if(_0x4f189e){return _0x247c32[_0xfc44('0x14')](_0x581b0a);}return _0x247c32[_0xfc44('0x15')](_0x581b0a)['end']();};}function respondWithResult(_0x3454d4,_0x2bb269){_0x2bb269=_0x2bb269||0xc8;return function(_0x4c4f6f){if(_0x4c4f6f){return _0x3454d4[_0xfc44('0x15')](_0x2bb269)[_0xfc44('0x16')](_0x4c4f6f);}};}function respondWithFilteredResult(_0x2ae5c5,_0x5973ae){return function(_0x440bd0){if(_0x440bd0){var _0xf45410=typeof _0x5973ae[_0xfc44('0x17')]===_0xfc44('0x18')&&typeof _0x5973ae['limit']===_0xfc44('0x18');var _0x19a8ce=_0x440bd0['count'];var _0x31704f=_0xf45410?0x0:_0x5973ae['offset'];var _0x581e7d=_0xf45410?_0x440bd0[_0xfc44('0x19')]:_0x5973ae[_0xfc44('0x17')]+_0x5973ae['limit'];var _0x55e8d6;if(_0x581e7d>=_0x19a8ce){_0x581e7d=_0x19a8ce;_0x55e8d6=0xc8;}else{_0x55e8d6=0xce;}_0x2ae5c5[_0xfc44('0x15')](_0x55e8d6);return _0x2ae5c5[_0xfc44('0x1a')]('Content-Range',_0x31704f+'-'+_0x581e7d+'/'+_0x19a8ce)['json'](_0x440bd0);}return null;};}function patchUpdates(_0x5d6bec){return function(_0x13d117){try{jsonpatch[_0xfc44('0x1b')](_0x13d117,_0x5d6bec,!![]);}catch(_0x1896e3){return BPromise['reject'](_0x1896e3);}return _0x13d117[_0xfc44('0x1c')]();};}function saveUpdates(_0x2004f1,_0x559ee4){return function(_0x83018d){if(_0x83018d){return _0x83018d[_0xfc44('0x1d')](_0x2004f1)[_0xfc44('0x1e')](function(_0x5b1b1e){return _0x5b1b1e;});}return null;};}function removeEntity(_0x3e1a4c,_0x206df0){return function(_0xf0ba03){if(_0xf0ba03){return _0xf0ba03[_0xfc44('0x1f')]()[_0xfc44('0x1e')](function(){var _0x43080e=_0xf0ba03[_0xfc44('0x20')]({'plain':!![]});var _0x59085e='MusicOnHolds';return db[_0xfc44('0x21')][_0xfc44('0x1f')]({'where':{'type':_0x59085e,'resourceId':_0x43080e['id']}})[_0xfc44('0x1e')](function(){return _0xf0ba03;});})[_0xfc44('0x1e')](function(){_0x3e1a4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e5bf,_0x1d731b){return function(_0x5d2729){if(!_0x5d2729){_0x39e5bf[_0xfc44('0x14')](0x194);}return _0x5d2729;};}function handleError(_0x37ea9a,_0x101f85){_0x101f85=_0x101f85||0x1f4;return function(_0xf1930e){logger[_0xfc44('0x22')](_0xf1930e[_0xfc44('0x23')]);if(_0xf1930e[_0xfc44('0x24')]){delete _0xf1930e[_0xfc44('0x24')];}_0x37ea9a[_0xfc44('0x15')](_0x101f85)[_0xfc44('0x25')](_0xf1930e);};}exports['index']=function(_0x1d51a1,_0x25e444){var _0x48410d={},_0x131749={},_0x60fb8c={'count':0x0,'rows':[]};var _0x4b0d7f=_[_0xfc44('0x26')](db[_0xfc44('0x27')][_0xfc44('0x28')],function(_0x56cfea){return{'name':_0x56cfea['fieldName'],'type':_0x56cfea[_0xfc44('0x29')]['key']};});_0x131749['model']=_[_0xfc44('0x26')](_0x4b0d7f,'name');_0x131749['query']=_[_0xfc44('0x2a')](_0x1d51a1[_0xfc44('0x2b')]);_0x131749[_0xfc44('0x2c')]=_[_0xfc44('0x2d')](_0x131749['model'],_0x131749[_0xfc44('0x2b')]);_0x48410d[_0xfc44('0x2e')]=_[_0xfc44('0x2d')](_0x131749[_0xfc44('0x2f')],qs[_0xfc44('0x30')](_0x1d51a1[_0xfc44('0x2b')][_0xfc44('0x30')]));_0x48410d[_0xfc44('0x2e')]=_0x48410d['attributes'][_0xfc44('0x31')]?_0x48410d['attributes']:_0x131749['model'];if(!_0x1d51a1['query']['hasOwnProperty'](_0xfc44('0x32'))){_0x48410d['limit']=qs['limit'](_0x1d51a1[_0xfc44('0x2b')]['limit']);_0x48410d['offset']=qs[_0xfc44('0x17')](_0x1d51a1[_0xfc44('0x2b')][_0xfc44('0x17')]);}_0x48410d[_0xfc44('0x33')]=qs[_0xfc44('0x34')](_0x1d51a1['query']['sort']);delete _0x1d51a1['query']['sort'];_0x48410d['where']=qs[_0xfc44('0x2c')](_[_0xfc44('0x35')](_0x1d51a1[_0xfc44('0x2b')],_0x131749[_0xfc44('0x2c')]),_0x4b0d7f);if(_0x1d51a1['query'][_0xfc44('0x36')]){_0x48410d[_0xfc44('0x37')]=_[_0xfc44('0x38')](_0x48410d[_0xfc44('0x37')],{'$or':_['map'](_0x4b0d7f,function(_0x47f6d0){if(_0x47f6d0[_0xfc44('0x29')]!=='VIRTUAL'){var _0x40abd3={};_0x40abd3[_0x47f6d0[_0xfc44('0x24')]]={'$like':'%'+_0x1d51a1[_0xfc44('0x2b')][_0xfc44('0x36')]+'%'};return _0x40abd3;}})});}_0x48410d=_[_0xfc44('0x38')]({},_0x48410d,_0x1d51a1[_0xfc44('0x39')]);var _0x3d15c8={'where':_0x48410d[_0xfc44('0x37')]};return db['VoiceMusicOnHold'][_0xfc44('0x19')](_0x3d15c8)[_0xfc44('0x1e')](function(_0x2cbae1){_0x60fb8c[_0xfc44('0x19')]=_0x2cbae1;if(_0x1d51a1[_0xfc44('0x2b')][_0xfc44('0x3a')]){_0x48410d[_0xfc44('0x3b')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xfc44('0x3c')](_0x48410d);})['then'](function(_0x4765df){_0x60fb8c[_0xfc44('0x3d')]=_0x4765df;return _0x60fb8c;})[_0xfc44('0x1e')](respondWithFilteredResult(_0x25e444,_0x48410d))[_0xfc44('0x3e')](handleError(_0x25e444,null));};exports[_0xfc44('0x3f')]=function(_0x12a55f,_0x44ad3e){var _0x51c87d={'raw':![],'where':{'id':_0x12a55f['params']['id']}},_0x5059e9={};_0x5059e9[_0xfc44('0x2f')]=_[_0xfc44('0x2a')](db[_0xfc44('0x27')]['rawAttributes']);_0x5059e9['query']=_[_0xfc44('0x2a')](_0x12a55f[_0xfc44('0x2b')]);_0x5059e9[_0xfc44('0x2c')]=_[_0xfc44('0x2d')](_0x5059e9[_0xfc44('0x2f')],_0x5059e9['query']);_0x51c87d['attributes']=_[_0xfc44('0x2d')](_0x5059e9[_0xfc44('0x2f')],qs[_0xfc44('0x30')](_0x12a55f[_0xfc44('0x2b')][_0xfc44('0x30')]));_0x51c87d[_0xfc44('0x2e')]=_0x51c87d[_0xfc44('0x2e')][_0xfc44('0x31')]?_0x51c87d[_0xfc44('0x2e')]:_0x5059e9['model'];if(_0x12a55f[_0xfc44('0x2b')][_0xfc44('0x3a')]){_0x51c87d[_0xfc44('0x3b')]=[{'all':!![]}];}_0x51c87d=_[_0xfc44('0x38')]({},_0x51c87d,_0x12a55f[_0xfc44('0x39')]);return db[_0xfc44('0x27')][_0xfc44('0x40')](_0x51c87d)[_0xfc44('0x1e')](handleEntityNotFound(_0x44ad3e,null))['then'](respondWithResult(_0x44ad3e,null))[_0xfc44('0x3e')](handleError(_0x44ad3e,null));};exports[_0xfc44('0x1d')]=function(_0x4d8a76,_0x48d353){if(_0x4d8a76[_0xfc44('0x41')]['id']){delete _0x4d8a76['body']['id'];}return db[_0xfc44('0x27')][_0xfc44('0x40')]({'where':{'id':_0x4d8a76[_0xfc44('0x42')]['id']}})['then'](handleEntityNotFound(_0x48d353,null))[_0xfc44('0x1e')](saveUpdates(_0x4d8a76[_0xfc44('0x41')],null))['then'](respondWithResult(_0x48d353,null))['catch'](handleError(_0x48d353,null));};exports['create']=function(_0x4f1fd5,_0x379ce0,_0x5d5e55){return db['sequelize']['transaction'](function(_0x1874bc){if(_0x4f1fd5[_0xfc44('0x41')][_0xfc44('0x43')]==='files'){_0x4f1fd5[_0xfc44('0x41')][_0xfc44('0x44')]=path[_0xfc44('0x45')](config[_0xfc44('0x46')],_0xfc44('0x47'),_0x4f1fd5[_0xfc44('0x41')][_0xfc44('0x24')]);}return db['VoiceMusicOnHold'][_0xfc44('0x48')](_0x4f1fd5['body'],{'transaction':_0x1874bc})[_0xfc44('0x1e')](function(_0x1ba5ea){if(_0x4f1fd5['body']['mode']===_0xfc44('0x49')){fs[_0xfc44('0x4a')](_0x1ba5ea['directory'],parseInt(_0xfc44('0x4b'),0x8));}var _0x8a9595=_0x4f1fd5['user'][_0xfc44('0x20')]({'plain':!![]});if(!_0x8a9595)throw new Error(_0xfc44('0x4c'));if(_0x8a9595[_0xfc44('0x4d')]===_0xfc44('0x4e')){var _0x3e2cc6=_0x1ba5ea['get']({'plain':!![]});return db[_0xfc44('0x4f')][_0xfc44('0x40')]({'where':{'name':_0xfc44('0x50'),'userProfileId':_0x8a9595['userProfileId']},'raw':!![]})[_0xfc44('0x1e')](function(_0x59912b){if(_0x59912b&&_0x59912b['autoAssociation']===0x0){return db[_0xfc44('0x21')][_0xfc44('0x48')]({'name':_0x3e2cc6[_0xfc44('0x24')],'resourceId':_0x3e2cc6['id'],'type':_0x59912b[_0xfc44('0x24')],'sectionId':_0x59912b['id']},{})[_0xfc44('0x1e')](function(){return _0x1ba5ea;});}else{return _0x1ba5ea;}})[_0xfc44('0x3e')](function(_0x4110c7){logger[_0xfc44('0x22')](_0xfc44('0x51'),_0x4110c7);});}return _0x1ba5ea;});})[_0xfc44('0x1e')](respondWithResult(_0x379ce0,0xc9))[_0xfc44('0x3e')](handleError(_0x379ce0,null));};exports['destroy']=function(_0x3f934e,_0x449127,_0x329784){var _0x5cada9;return db[_0xfc44('0x27')][_0xfc44('0x40')]({'where':{'id':_0x3f934e[_0xfc44('0x42')]['id']}})[_0xfc44('0x1e')](function(_0x15a378){if(_0x15a378){return db[_0xfc44('0x52')][_0xfc44('0x53')](function(_0x2ffb82){return _0x15a378['destroy']({'transaction':_0x2ffb82,'raw':!![]})['then'](function(_0x512e24){if(_0x512e24[_0xfc44('0x44')]){fs['readdirSync'](_0x512e24[_0xfc44('0x44')])[_0xfc44('0x54')](function(_0x1b492a){fs[_0xfc44('0x55')](path['join'](_0x512e24[_0xfc44('0x44')],_0x1b492a));});fs[_0xfc44('0x56')](_0x512e24[_0xfc44('0x44')]);}return _0x512e24;});})['catch'](function(_0x2d7337){throw new db[(_0xfc44('0x57'))][(_0xfc44('0x58'))](_0x2d7337[_0xfc44('0x59')]);});}})[_0xfc44('0x1e')](handleEntityNotFound(_0x449127,null))[_0xfc44('0x1e')](removeEntity(_0x449127,null))['catch'](handleError(_0x449127,null));};exports[_0xfc44('0x5a')]=function(_0x4b5fed,_0x3f0b9b,_0x13de57){return db['sequelize']['transaction'](function(_0x24cc40){var _0x5ac9c9;return db[_0xfc44('0x27')][_0xfc44('0x40')]({'where':{'id':_0x4b5fed[_0xfc44('0x42')]['id']}})[_0xfc44('0x1e')](function(_0xbcd341){if(_0xbcd341){_0x5ac9c9=_0xbcd341;return _0xbcd341[_0xfc44('0x5a')](_0x4b5fed[_0xfc44('0x41')]['id'],{'transaction':_0x24cc40});}})[_0xfc44('0x1e')](function(_0x422e1d){if(_0x422e1d){return db[_0xfc44('0x5b')][_0xfc44('0x5c')]({'where':{'id':_0x4b5fed[_0xfc44('0x41')]['id']},'attributes':['id',_0xfc44('0x24'),_0xfc44('0x5d'),_0xfc44('0x5e'),_0xfc44('0x5f')],'raw':!![]});}})[_0xfc44('0x1e')](function(_0x14a33b){if(_0x14a33b){var _0x24b582=path['join'](config['root'],_0xfc44('0x60'),util[_0xfc44('0x61')](_0xfc44('0x62'),path[_0xfc44('0x63')](_0x14a33b['save_name'],path[_0xfc44('0x64')](_0x14a33b[_0xfc44('0x5d')])),_0x14a33b['converted_format']));var _0x9cd91e=path[_0xfc44('0x45')](config[_0xfc44('0x46')],_0xfc44('0x47'),_0x5ac9c9['name'],util[_0xfc44('0x61')](_0xfc44('0x62'),_0x14a33b['name'],_0x14a33b[_0xfc44('0x5e')]));fs['symlinkSync'](_0x24b582,_0x9cd91e);return _0x14a33b;}})[_0xfc44('0x3e')](function(_0x21cf2f){throw new db[(_0xfc44('0x57'))][(_0xfc44('0x58'))](_0x21cf2f['message']);});})[_0xfc44('0x1e')](handleEntityNotFound(_0x3f0b9b,null))['then'](respondWithResult(_0x3f0b9b,0xc9))[_0xfc44('0x3e')](handleError(_0x3f0b9b,null));};exports['removeSound']=function(_0x3020c1,_0x55a111,_0x2ea3ee){return db[_0xfc44('0x52')][_0xfc44('0x53')](function(_0x4e350e){var _0x5fe243;return db[_0xfc44('0x27')][_0xfc44('0x5c')]({'where':{'id':_0x3020c1['params']['id']}})[_0xfc44('0x1e')](handleEntityNotFound(_0x55a111,null))['then'](function(_0x417a0b){if(_0x417a0b){_0x5fe243=_0x417a0b;return _0x417a0b[_0xfc44('0x65')](_0x3020c1[_0xfc44('0x42')][_0xfc44('0x66')]);}})[_0xfc44('0x1e')](function(_0x9725){if(_0x9725){return db['Sound'][_0xfc44('0x5c')]({'where':{'id':_0x3020c1[_0xfc44('0x42')][_0xfc44('0x66')]},'attributes':['id',_0xfc44('0x24'),_0xfc44('0x5d'),'converted_format',_0xfc44('0x5f')],'raw':!![]});}})[_0xfc44('0x1e')](function(_0x51f6d6){if(_0x51f6d6){fs[_0xfc44('0x55')](path[_0xfc44('0x45')](_0x5fe243['directory'],util[_0xfc44('0x61')](_0xfc44('0x62'),_0x51f6d6[_0xfc44('0x24')],_0x51f6d6[_0xfc44('0x5e')])));return _0x51f6d6;}})[_0xfc44('0x3e')](function(_0x5e2268){throw new db[(_0xfc44('0x57'))][(_0xfc44('0x58'))](_0x5e2268[_0xfc44('0x59')]);});})[_0xfc44('0x1e')](handleEntityNotFound(_0x55a111,null))[_0xfc44('0x1e')](respondWithStatusCode(_0x55a111,0xcc))[_0xfc44('0x3e')](handleError(_0x55a111,null));};exports[_0xfc44('0x67')]=function(_0x31185e,_0x4121b9,_0x317dac){var _0x340878={};var _0x4a04e9={};var _0x148f2e;var _0x4710c5;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x31185e['params']['id']}})[_0xfc44('0x1e')](handleEntityNotFound(_0x4121b9,null))[_0xfc44('0x1e')](function(_0x4045fc){if(_0x4045fc){_0x148f2e=_0x4045fc;_0x4a04e9[_0xfc44('0x2f')]=_[_0xfc44('0x2a')](db['Sound'][_0xfc44('0x28')]);_0x4a04e9['query']=_[_0xfc44('0x2a')](_0x31185e['query']);_0x4a04e9['filters']=_[_0xfc44('0x2d')](_0x4a04e9['model'],_0x4a04e9[_0xfc44('0x2b')]);_0x340878[_0xfc44('0x2e')]=_[_0xfc44('0x2d')](_0x4a04e9[_0xfc44('0x2f')],qs[_0xfc44('0x30')](_0x31185e[_0xfc44('0x2b')][_0xfc44('0x30')]));_0x340878[_0xfc44('0x2e')]=_0x340878['attributes'][_0xfc44('0x31')]?_0x340878[_0xfc44('0x2e')]:_0x4a04e9['model'];_0x340878['order']=qs[_0xfc44('0x34')](_0x31185e[_0xfc44('0x2b')]['sort']);_0x340878[_0xfc44('0x37')]=qs[_0xfc44('0x2c')](_['pick'](_0x31185e[_0xfc44('0x2b')],_0x4a04e9[_0xfc44('0x2c')]));if(_0x31185e[_0xfc44('0x2b')]['filter']){_0x340878['where']=_[_0xfc44('0x38')](_0x340878[_0xfc44('0x37')],{'$or':_[_0xfc44('0x26')](_0x340878[_0xfc44('0x2e')],function(_0x141a93){var _0x32dd69={};_0x32dd69[_0x141a93]={'$like':'%'+_0x31185e['query'][_0xfc44('0x36')]+'%'};return _0x32dd69;})});}_0x340878=_[_0xfc44('0x38')]({},_0x340878,_0x31185e[_0xfc44('0x39')]);return _0x148f2e[_0xfc44('0x67')](_0x340878);}})[_0xfc44('0x1e')](function(_0x4f7845){if(_0x4f7845){_0x4710c5=_0x4f7845['length'];if(!_0x31185e[_0xfc44('0x2b')][_0xfc44('0x68')](_0xfc44('0x32'))){_0x340878[_0xfc44('0x69')]=qs[_0xfc44('0x69')](_0x31185e[_0xfc44('0x2b')]['limit']);_0x340878[_0xfc44('0x17')]=qs[_0xfc44('0x17')](_0x31185e[_0xfc44('0x2b')][_0xfc44('0x17')]);}return _0x148f2e['getSounds'](_0x340878);}})[_0xfc44('0x1e')](function(_0xb4df26){if(_0xb4df26){return _0xb4df26?{'count':_0x4710c5,'rows':_0xb4df26}:null;}})[_0xfc44('0x1e')](respondWithResult(_0x4121b9,null))[_0xfc44('0x3e')](handleError(_0x4121b9,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3e261d3..608c44f 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 _0xd60e=['rimraf','../../config/environment','exports','define','voice_musiconhold','lodash','util','bluebird','path'];(function(_0x257a8d,_0x3a7ad6){var _0x840c00=function(_0x44da10){while(--_0x44da10){_0x257a8d['push'](_0x257a8d['shift']());}};_0x840c00(++_0x3a7ad6);}(_0xd60e,0xef));var _0xed60=function(_0x5ac4b1,_0x5a4b23){_0x5ac4b1=_0x5ac4b1-0x0;var _0x54694c=_0xd60e[_0x5ac4b1];return _0x54694c;};'use strict';var _=require(_0xed60('0x0'));var util=require(_0xed60('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xed60('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed60('0x3'));var rimraf=require(_0xed60('0x4'));var config=require(_0xed60('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xed60('0x6')]=function(_0x281c9d,_0x56f462){return _0x281c9d[_0xed60('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xed60('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30bf=['../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','../../config/logger','api','moment','path'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x30bf,0xca));var _0xf30b=function(_0x5f4a87,_0x28c11c){_0x5f4a87=_0x5f4a87-0x0;var _0x5d28c5=_0x30bf[_0x5f4a87];return _0x5d28c5;};'use strict';var _=require(_0xf30b('0x0'));var util=require('util');var logger=require(_0xf30b('0x1'))(_0xf30b('0x2'));var moment=require(_0xf30b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf30b('0x4'));var rimraf=require('rimraf');var config=require(_0xf30b('0x5'));var attributes=require(_0xf30b('0x6'));module[_0xf30b('0x7')]=function(_0x1ef7ea,_0x26dd8b){return _0x1ef7ea['define'](_0xf30b('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 3905877..9bf86c3 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18d682,_0x203b08){var _0x9fecf=function(_0x15e5af){while(--_0x15e5af){_0x18d682['push'](_0x18d682['shift']());}};_0x9fecf(++_0x203b08);}(_0x70e0,0x17b));var _0x070e=function(_0x147f4c,_0x1f46e1){_0x147f4c=_0x147f4c-0x0;var _0x16ac2f=_0x70e0[_0x147f4c];return _0x16ac2f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3bc388,_0x71568f){var _0x3acf13=function(_0x471a7a){while(--_0x471a7a){_0x3bc388['push'](_0x3bc388['shift']());}};_0x3acf13(++_0x71568f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 494b81c..92aca12 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 _0xe94a=['/:id','show','/:id/users','getAgents','/:id/teams','create','addAgents','post','addTeams','update','destroy','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x15c655,_0xcacf6f){var _0x482e4e=function(_0x401580){while(--_0x401580){_0x15c655['push'](_0x15c655['shift']());}};_0x482e4e(++_0xcacf6f);}(_0xe94a,0x1c7));var _0xae94=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0xe94a[_0x562faa];return _0xc70f59;};'use strict';var multer=require(_0xae94('0x0'));var util=require(_0xae94('0x1'));var path=require(_0xae94('0x2'));var timeout=require('connect-timeout');var express=require(_0xae94('0x3'));var router=express[_0xae94('0x4')]();var fs_extra=require(_0xae94('0x5'));var auth=require(_0xae94('0x6'));var interaction=require(_0xae94('0x7'));var config=require(_0xae94('0x8'));var controller=require('./voicePrefix.controller');router[_0xae94('0x9')]('/',auth[_0xae94('0xa')](),controller[_0xae94('0xb')]);router[_0xae94('0x9')](_0xae94('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xae94('0x9')](_0xae94('0xd'),auth['isAuthenticated'](),controller[_0xae94('0xe')]);router[_0xae94('0x9')](_0xae94('0xf'),auth[_0xae94('0xa')](),controller[_0xae94('0x10')]);router[_0xae94('0x9')](_0xae94('0x11'),auth[_0xae94('0xa')](),controller['getTeams']);router['post']('/',auth[_0xae94('0xa')](),controller[_0xae94('0x12')]);router['post'](_0xae94('0xf'),auth['isAuthenticated'](),controller[_0xae94('0x13')]);router[_0xae94('0x14')](_0xae94('0x11'),auth[_0xae94('0xa')](),controller[_0xae94('0x15')]);router['put'](_0xae94('0xd'),auth[_0xae94('0xa')](),controller[_0xae94('0x16')]);router['delete'](_0xae94('0xd'),auth['isAuthenticated'](),controller[_0xae94('0x17')]);router['delete'](_0xae94('0xf'),auth[_0xae94('0xa')](),controller['removeAgents']);router['delete'](_0xae94('0x11'),auth[_0xae94('0xa')](),controller[_0xae94('0x18')]);module[_0xae94('0x19')]=router; \ No newline at end of file +var _0xe5d5=['index','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x16558a,_0x2931fb){var _0x1c56f8=function(_0x23a50e){while(--_0x23a50e){_0x16558a['push'](_0x16558a['shift']());}};_0x1c56f8(++_0x2931fb);}(_0xe5d5,0x156));var _0x5e5d=function(_0x57a94d,_0x4f3f95){_0x57a94d=_0x57a94d-0x0;var _0x109b53=_0xe5d5[_0x57a94d];return _0x109b53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var fs_extra=require(_0x5e5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var controller=require(_0x5e5d('0x5'));router[_0x5e5d('0x6')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x8')]);router[_0x5e5d('0x6')](_0x5e5d('0x9'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xa')]);router[_0x5e5d('0x6')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xc')]);router['get'](_0x5e5d('0xd'),auth['isAuthenticated'](),controller[_0x5e5d('0xe')]);router[_0x5e5d('0x6')]('/:id/teams',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xf')]);router[_0x5e5d('0x10')]('/',auth[_0x5e5d('0x7')](),controller['create']);router['post'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller['addAgents']);router[_0x5e5d('0x10')](_0x5e5d('0x11'),auth['isAuthenticated'](),controller[_0x5e5d('0x12')]);router[_0x5e5d('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5e5d('0x14')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x15')]);router['delete'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x16')]);router[_0x5e5d('0x14')](_0x5e5d('0x11'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x17')]);module[_0x5e5d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8479c15..f7828b0 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 _0xfb79=['exports','STRING','VIRTUAL','system-','name','INTEGER'];(function(_0x134de4,_0x49c839){var _0xe97f36=function(_0x2ffa31){while(--_0x2ffa31){_0x134de4['push'](_0x134de4['shift']());}};_0xe97f36(++_0x49c839);}(_0xfb79,0x102));var _0x9fb7=function(_0x5d96ec,_0x39248f){_0x5d96ec=_0x5d96ec-0x0;var _0x350f30=_0xfb79[_0x5d96ec];return _0x350f30;};'use strict';var Sequelize=require('sequelize');module[_0x9fb7('0x0')]={'name':{'type':Sequelize[_0x9fb7('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x9fb7('0x2')],'get':function(_0x29b008){return _0x9fb7('0x3')+this['getDataValue'](_0x9fb7('0x4'))+'-';}},'description':{'type':Sequelize[_0x9fb7('0x1')]},'callerIdAll':{'type':Sequelize[_0x9fb7('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x9fb7('0x5')]}}; \ No newline at end of file +var _0x0a5d=['getDataValue','INTEGER','sequelize','STRING','name','system-'];(function(_0x318650,_0x36befa){var _0x225c90=function(_0x3c8007){while(--_0x3c8007){_0x318650['push'](_0x318650['shift']());}};_0x225c90(++_0x36befa);}(_0x0a5d,0x80));var _0xd0a5=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x0a5d[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require(_0xd0a5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0a5('0x1')],'allowNull':![],'unique':_0xd0a5('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e568a){return _0xd0a5('0x3')+this[_0xd0a5('0x4')](_0xd0a5('0x2'))+'-';}},'description':{'type':Sequelize[_0xd0a5('0x1')]},'callerIdAll':{'type':Sequelize[_0xd0a5('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xd0a5('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c3bf69e..5900d8f 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 _0x373d=['team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','describe','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','omit','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','userVoicePrefix:save','field','tq.TeamId','from'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x373d,0x1e2));var _0xd373=function(_0x12f1c0,_0x57cc1f){_0x12f1c0=_0x12f1c0-0x0;var _0x56c50e=_0x373d[_0x12f1c0];return _0x56c50e;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);function respondWithStatusCode(_0x23ed86,_0x28b2bf){_0x28b2bf=_0x28b2bf||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x23ed86[_0xd373('0x19')](_0x28b2bf);}return _0x23ed86[_0xd373('0x1a')](_0x28b2bf)[_0xd373('0x1b')]();};}function respondWithResult(_0x2c5854,_0x3a5316){_0x3a5316=_0x3a5316||0xc8;return function(_0x263ae3){if(_0x263ae3){return _0x2c5854[_0xd373('0x1a')](_0x3a5316)['json'](_0x263ae3);}};}function respondWithFilteredResult(_0x1e26cf,_0x5eab00){return function(_0x460259){if(_0x460259){var _0x36d47a=typeof _0x5eab00['offset']===_0xd373('0x1c')&&typeof _0x5eab00['limit']==='undefined';var _0x23fada=_0x460259[_0xd373('0x1d')];var _0x167597=_0x36d47a?0x0:_0x5eab00[_0xd373('0x1e')];var _0x16b147=_0x36d47a?_0x460259[_0xd373('0x1d')]:_0x5eab00['offset']+_0x5eab00[_0xd373('0x1f')];var _0xd808f8;if(_0x16b147>=_0x23fada){_0x16b147=_0x23fada;_0xd808f8=0xc8;}else{_0xd808f8=0xce;}_0x1e26cf[_0xd373('0x1a')](_0xd808f8);return _0x1e26cf[_0xd373('0x20')](_0xd373('0x21'),_0x167597+'-'+_0x16b147+'/'+_0x23fada)[_0xd373('0x22')](_0x460259);}return null;};}function patchUpdates(_0x4f64bd){return function(_0x355fca){try{jsonpatch[_0xd373('0x23')](_0x355fca,_0x4f64bd,!![]);}catch(_0x157f81){return BPromise[_0xd373('0x24')](_0x157f81);}return _0x355fca[_0xd373('0x25')]();};}function saveUpdates(_0x238ffd,_0x466a03){return function(_0x109e4c){if(_0x109e4c){return _0x109e4c[_0xd373('0x26')](_0x238ffd)[_0xd373('0x27')](function(_0x437110){return _0x437110;});}return null;};}function removeEntity(_0x34f05a,_0x388182){return function(_0x420a30){if(_0x420a30){return _0x420a30[_0xd373('0x28')]()[_0xd373('0x27')](function(){var _0x50b987=_0x420a30[_0xd373('0x29')]({'plain':!![]});var _0x3e657b=_0xd373('0x2a');return db[_0xd373('0x2b')][_0xd373('0x28')]({'where':{'type':_0x3e657b,'resourceId':_0x50b987['id']}})[_0xd373('0x27')](function(){return _0x420a30;});})[_0xd373('0x27')](function(){_0x34f05a[_0xd373('0x1a')](0xcc)[_0xd373('0x1b')]();});}};}function handleEntityNotFound(_0x158825,_0xbc420b){return function(_0x2ee37c){if(!_0x2ee37c){_0x158825[_0xd373('0x19')](0x194);}return _0x2ee37c;};}function handleError(_0x5287e7,_0x7ca56e){_0x7ca56e=_0x7ca56e||0x1f4;return function(_0x490842){logger['error'](_0x490842[_0xd373('0x2c')]);if(_0x490842[_0xd373('0x2d')]){delete _0x490842[_0xd373('0x2d')];}_0x5287e7[_0xd373('0x1a')](_0x7ca56e)[_0xd373('0x2e')](_0x490842);};}exports['index']=function(_0x6659f6,_0x104156){var _0x4e17c9={},_0x102c3a={},_0x8e4884={'count':0x0,'rows':[]};var _0x146e24=_[_0xd373('0x2f')](db[_0xd373('0x30')][_0xd373('0x31')],function(_0x364c01){return{'name':_0x364c01[_0xd373('0x32')],'type':_0x364c01[_0xd373('0x33')]['key']};});_0x102c3a[_0xd373('0x34')]=_[_0xd373('0x2f')](_0x146e24,_0xd373('0x2d'));_0x102c3a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x6659f6[_0xd373('0x35')]);_0x102c3a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],_0x102c3a[_0xd373('0x35')]);_0x4e17c9[_0xd373('0x39')]=_[_0xd373('0x38')](_0x102c3a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x6659f6[_0xd373('0x35')]['fields']));_0x4e17c9[_0xd373('0x39')]=_0x4e17c9[_0xd373('0x39')][_0xd373('0x3b')]?_0x4e17c9[_0xd373('0x39')]:_0x102c3a['model'];if(!_0x6659f6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x4e17c9[_0xd373('0x1f')]=qs[_0xd373('0x1f')](_0x6659f6[_0xd373('0x35')]['limit']);_0x4e17c9['offset']=qs[_0xd373('0x1e')](_0x6659f6['query'][_0xd373('0x1e')]);}_0x4e17c9[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x6659f6['query'][_0xd373('0x3f')]);_0x4e17c9[_0xd373('0x40')]=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0x6659f6['query'],_0x102c3a['filters']),_0x146e24);if(_0x6659f6['query'][_0xd373('0x42')]){_0x4e17c9['where']=_[_0xd373('0x43')](_0x4e17c9[_0xd373('0x40')],{'$or':_['map'](_0x146e24,function(_0x4e8734){if(_0x4e8734['type']!==_0xd373('0x44')){var _0x43a4b8={};_0x43a4b8[_0x4e8734[_0xd373('0x2d')]]={'$like':'%'+_0x6659f6['query']['filter']+'%'};return _0x43a4b8;}})});}_0x4e17c9=_[_0xd373('0x43')]({},_0x4e17c9,_0x6659f6[_0xd373('0x45')]);var _0x51efee={'where':_0x4e17c9[_0xd373('0x40')]};return db[_0xd373('0x30')][_0xd373('0x1d')](_0x51efee)[_0xd373('0x27')](function(_0x2d8c7d){_0x8e4884['count']=_0x2d8c7d;if(_0x6659f6['query'][_0xd373('0x46')]){_0x4e17c9[_0xd373('0x47')]=[{'all':!![]}];}return db[_0xd373('0x30')][_0xd373('0x48')](_0x4e17c9);})['then'](function(_0x29725c){_0x8e4884['rows']=_0x29725c;return _0x8e4884;})[_0xd373('0x27')](respondWithFilteredResult(_0x104156,_0x4e17c9))[_0xd373('0x49')](handleError(_0x104156,null));};exports[_0xd373('0x4a')]=function(_0xfb2922,_0x15cd1f){var _0x54afd4={'raw':![],'where':{'id':_0xfb2922[_0xd373('0x4b')]['id']}},_0x42744d={};_0x42744d['model']=_[_0xd373('0x36')](db[_0xd373('0x30')][_0xd373('0x31')]);_0x42744d[_0xd373('0x35')]=_[_0xd373('0x36')](_0xfb2922[_0xd373('0x35')]);_0x42744d[_0xd373('0x37')]=_[_0xd373('0x38')](_0x42744d[_0xd373('0x34')],_0x42744d[_0xd373('0x35')]);_0x54afd4['attributes']=_['intersection'](_0x42744d[_0xd373('0x34')],qs['fields'](_0xfb2922[_0xd373('0x35')]['fields']));_0x54afd4['attributes']=_0x54afd4['attributes'][_0xd373('0x3b')]?_0x54afd4[_0xd373('0x39')]:_0x42744d[_0xd373('0x34')];if(_0xfb2922[_0xd373('0x35')][_0xd373('0x46')]){_0x54afd4[_0xd373('0x47')]=[{'all':!![]}];}_0x54afd4=_[_0xd373('0x43')]({},_0x54afd4,_0xfb2922['options']);return db[_0xd373('0x30')]['find'](_0x54afd4)[_0xd373('0x27')](handleEntityNotFound(_0x15cd1f,null))[_0xd373('0x27')](respondWithResult(_0x15cd1f,null))['catch'](handleError(_0x15cd1f,null));};exports[_0xd373('0x28')]=function(_0x5ca39c,_0x46a582){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x5ca39c[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x46a582,null))['then'](removeEntity(_0x46a582,null))['catch'](handleError(_0x46a582,null));};exports['describe']=function(_0x3a2192,_0x384e23){return db['VoicePrefix'][_0xd373('0x4d')]()[_0xd373('0x27')](respondWithResult(_0x384e23,null))['catch'](handleError(_0x384e23,null));};exports[_0xd373('0x4e')]=function(_0xb6b583,_0x102101){var _0x473af2;return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0xc255ec){return db[_0xd373('0x30')][_0xd373('0x4e')](_0xb6b583[_0xd373('0x51')],{'transaction':_0xc255ec})[_0xd373('0x27')](function(_0x5b88ea){_0x473af2=_0x5b88ea['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x473af2['VoiceExtensionId']},'raw':!![]})['then'](function(_0x409246){return createVoicePrefixExtensions(_0x473af2,_0x409246,_0xc255ec);});});})[_0xd373('0x27')](function(){var _0x5b2ae9=_0xb6b583['user']['get']({'plain':!![]});if(!_0x5b2ae9)throw new Error(_0xd373('0x52'));if(_0x5b2ae9[_0xd373('0x53')]==='user'){var _0x52fa5b=_0x473af2;return db[_0xd373('0x54')][_0xd373('0x4c')]({'where':{'name':_0xd373('0x2a'),'userProfileId':_0x5b2ae9[_0xd373('0x55')]},'raw':!![]})[_0xd373('0x27')](function(_0x59da03){if(_0x59da03&&_0x59da03[_0xd373('0x56')]===0x0){return db[_0xd373('0x2b')][_0xd373('0x4e')]({'name':_0x52fa5b[_0xd373('0x2d')],'resourceId':_0x52fa5b['id'],'type':_0x59da03[_0xd373('0x2d')],'sectionId':_0x59da03['id']},{})[_0xd373('0x27')](function(){return _0x473af2;});}else{return _0x473af2;}})[_0xd373('0x49')](function(_0x2e4298){logger[_0xd373('0x57')](_0xd373('0x58'),_0x2e4298);throw _0x2e4298;});}return _0x473af2;})[_0xd373('0x27')](respondWithResult(_0x102101,null))[_0xd373('0x49')](handleError(_0x102101,null));};function Extension(_0x213b3c,_0x42e45d,_0x13f139,_0x4cb143){this[_0xd373('0x59')]=_0xd373('0x5a');this[_0xd373('0x5b')]=_0x213b3c;this['app']=_0x13f139;this[_0xd373('0x33')]='system';this[_0xd373('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd373('0x5d')]=_0x42e45d;this[_0xd373('0x5e')]=_0x4cb143;}function createVoicePrefixExtensions(_0x427f68,_0x19924a,_0x41c327){return new BPromise(function(_0x1ac620,_0xa47b76){var _0xaaf7fa=new Extension(formatPrefixName(_0x427f68[_0xd373('0x5f')]),0x1,_0xd373('0x60'),_0xd373('0x61'));_0xaaf7fa[_0xd373('0x62')]=_0x427f68['id'];return db[_0xd373('0x63')][_0xd373('0x4e')](_0xaaf7fa,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x2e7edb){var _0x1379e5=_0x2e7edb[_0xd373('0x29')]({'plain':!![]});var _0x209e76=_[_0xd373('0x2f')](addVoicePrefixExtensions(_0x427f68,_0x19924a),function(_0x295e09){_0x295e09[_0xd373('0x64')]=_0x1379e5['id'];_0x295e09[_0xd373('0x62')]=_0x427f68['id'];return _0x295e09;});return db[_0xd373('0x63')][_0xd373('0x65')](_0x209e76,{'transaction':_0x41c327})[_0xd373('0x27')](function(_0x547a8a){if(!_0x547a8a){return _0xa47b76(_0xd373('0x66'));}else{return _0x1ac620(_0x547a8a);}})[_0xd373('0x49')](function(_0x5fdc16){return _0xa47b76(_0x5fdc16);});});;});};function addVoicePrefixExtensions(_0x4a7d01,_0x38068a){var _0x2d9019=[];var _0x33320c=formatPrefixName(_0x4a7d01[_0xd373('0x5f')]);_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x2,_0xd373('0x68'),_0xd373('0x69')+_0x4a7d01['name']));if(_0x4a7d01[_0xd373('0x6a')]){_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x68'),_0xd373('0x6b')+_0x4a7d01[_0xd373('0x6a')]));}else{_0x2d9019[_0xd373('0x67')](new Extension(_0x33320c,0x3,_0xd373('0x60'),_0xd373('0x6c')));}_0x2d9019['push'](new Extension(_0x33320c,0x4,_0xd373('0x6d'),_0x38068a['context']+','+_0xd373('0x6e')+(0x8+_0x4a7d01[_0xd373('0x2d')][_0xd373('0x3b')])+'}'+','+0x1));return _0x2d9019;}function formatPrefixName(_0x2a9582){var _0x36e7cc='_';for(var _0x32c044=0x0;_0x32c044<_0x2a9582[_0xd373('0x3b')];_0x32c044++){if(_0x2a9582[_0xd373('0x6f')](_0x32c044)=='-'){_0x36e7cc+=_0x2a9582['charAt'](_0x32c044);}else{_0x36e7cc+='['+_0x2a9582[_0xd373('0x6f')](_0x32c044)+']';}}_0x36e7cc+='.';return _0x36e7cc;}exports['update']=function(_0x40f5ad,_0x27fcbe,_0x310a65){var _0x3ce679=_0x40f5ad[_0xd373('0x51')];_0x3ce679[_0xd373('0x5f')]=_0xd373('0x70')+_0x3ce679['name']+'-';return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x3d375d){return db['VoicePrefix'][_0xd373('0x26')](_0x3ce679,{'where':{'id':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x28')]({'where':{'VoicePrefixId':_0x3ce679['id']},'transaction':_0x3d375d})[_0xd373('0x27')](function(){return db[_0xd373('0x63')][_0xd373('0x4c')]({'where':{'id':_0x3ce679[_0xd373('0x64')]},'raw':!![]})[_0xd373('0x27')](function(_0x727541){return createVoicePrefixExtensions(_0x3ce679,_0x727541,_0x3d375d);});});});})[_0xd373('0x27')](function(){return db[_0xd373('0x30')]['findById'](_0x3ce679['id']);})[_0xd373('0x27')](respondWithResult(_0x27fcbe,null))[_0xd373('0x49')](handleError(_0x27fcbe,null));};exports[_0xd373('0x71')]=function(_0x506f49,_0x377147,_0x365028){return db[_0xd373('0x30')]['find']({'where':{'id':_0x506f49[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x377147,null))[_0xd373('0x27')](function(_0x26821a){if(_0x26821a){return _0x26821a[_0xd373('0x71')](_0x506f49[_0xd373('0x51')]['ids'],_[_0xd373('0x72')](_0x506f49['body'],[_0xd373('0x73'),'id'])||{})[_0xd373('0x74')](function(_0x140ec4){for(var _0xb658db=0x0;_0xb658db<_0x506f49[_0xd373('0x51')][_0xd373('0x73')]['length'];_0xb658db+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x506f49[_0xd373('0x51')]['ids'][_0xb658db]),'VoicePrefixId':Number(_0x506f49['params']['id'])});}return _0x140ec4;});}})[_0xd373('0x27')](respondWithResult(_0x377147,null))[_0xd373('0x49')](handleError(_0x377147,null));};exports[_0xd373('0x76')]=function(_0x32b739,_0x5a5651,_0x546a07){return db[_0xd373('0x30')][_0xd373('0x4c')]({'where':{'id':_0x32b739[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5a5651,null))[_0xd373('0x27')](function(_0x1a30eb){if(_0x1a30eb){return _0x1a30eb[_0xd373('0x76')](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])[_0xd373('0x27')](function(){if(_['isArray'](_0x32b739[_0xd373('0x35')][_0xd373('0x73')])){for(var _0x1576e5=0x0;_0x1576e5<_0x32b739[_0xd373('0x35')][_0xd373('0x73')][_0xd373('0x3b')];_0x1576e5+=0x1){socket[_0xd373('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x32b739[_0xd373('0x35')]['ids'][_0x1576e5]),'VoicePrefixId':Number(_0x32b739['params']['id'])});}}else{socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':Number(_0x32b739[_0xd373('0x35')][_0xd373('0x73')]),'VoicePrefixId':Number(_0x32b739[_0xd373('0x4b')]['id'])});}});}})[_0xd373('0x27')](respondWithStatusCode(_0x5a5651,null))['catch'](handleError(_0x5a5651,null));};exports[_0xd373('0x78')]=function(_0x19eb94,_0x6114a5,_0x52ab87){var _0x467ac8={};var _0x2c543a={};var _0x1a5666;var _0x47ae4c;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0x19eb94[_0xd373('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6114a5,null))[_0xd373('0x27')](function(_0x288295){if(_0x288295){_0x1a5666=_0x288295;_0x2c543a[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7a')][_0xd373('0x31')]);_0x2c543a[_0xd373('0x35')]=_[_0xd373('0x36')](_0x19eb94[_0xd373('0x35')]);_0x2c543a[_0xd373('0x37')]=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],_0x2c543a[_0xd373('0x35')]);_0x467ac8['attributes']=_[_0xd373('0x38')](_0x2c543a[_0xd373('0x34')],qs[_0xd373('0x3a')](_0x19eb94['query'][_0xd373('0x3a')]));_0x467ac8[_0xd373('0x39')]=_0x467ac8['attributes'][_0xd373('0x3b')]?_0x467ac8['attributes']:_0x2c543a[_0xd373('0x34')];_0x467ac8[_0xd373('0x3e')]=qs[_0xd373('0x3f')](_0x19eb94[_0xd373('0x35')][_0xd373('0x3f')]);_0x467ac8[_0xd373('0x40')]=qs['filters'](_[_0xd373('0x41')](_0x19eb94['query'],_0x2c543a[_0xd373('0x37')]));if(_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]){_0x467ac8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x467ac8['where'],{'$or':_[_0xd373('0x2f')](_0x467ac8[_0xd373('0x39')],function(_0x232b78){var _0x12ffc0={};_0x12ffc0[_0x232b78]={'$like':'%'+_0x19eb94[_0xd373('0x35')][_0xd373('0x42')]+'%'};return _0x12ffc0;})});}_0x467ac8=_['merge']({},_0x467ac8,_0x19eb94[_0xd373('0x45')]);return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})[_0xd373('0x27')](function(_0x4b32b6){if(_0x4b32b6){_0x47ae4c=_0x4b32b6[_0xd373('0x3b')];if(!_0x19eb94[_0xd373('0x35')]['hasOwnProperty'](_0xd373('0x3d'))){_0x467ac8['limit']=qs[_0xd373('0x1f')](_0x19eb94['query']['limit']);_0x467ac8[_0xd373('0x1e')]=qs[_0xd373('0x1e')](_0x19eb94[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x1a5666[_0xd373('0x78')](_0x467ac8);}})['then'](function(_0x3ae4c8){if(_0x3ae4c8){return _0x3ae4c8?{'count':_0x47ae4c,'rows':_0x3ae4c8}:null;}})['then'](respondWithResult(_0x6114a5,null))[_0xd373('0x49')](handleError(_0x6114a5,null));};exports[_0xd373('0x7b')]=function(_0xc8f4e6,_0x5c951e,_0x113671){var _0x5621d8={};var _0x30549e={};var _0x633ba0;var _0xa854a2;return db[_0xd373('0x30')][_0xd373('0x79')]({'where':{'id':_0xc8f4e6['params']['id']}})[_0xd373('0x27')](handleEntityNotFound(_0x5c951e,null))[_0xd373('0x27')](function(_0x39327f){if(_0x39327f){_0x633ba0=_0x39327f;_0x30549e[_0xd373('0x34')]=_[_0xd373('0x36')](db[_0xd373('0x7c')][_0xd373('0x31')]);_0x30549e['query']=_[_0xd373('0x36')](_0xc8f4e6[_0xd373('0x35')]);_0x30549e[_0xd373('0x37')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],_0x30549e[_0xd373('0x35')]);_0x5621d8[_0xd373('0x39')]=_[_0xd373('0x38')](_0x30549e[_0xd373('0x34')],qs[_0xd373('0x3a')](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3a')]));_0x5621d8[_0xd373('0x39')]=_0x5621d8[_0xd373('0x39')][_0xd373('0x3b')]?_0x5621d8[_0xd373('0x39')]:_0x30549e[_0xd373('0x34')];_0x5621d8['order']=qs[_0xd373('0x3f')](_0xc8f4e6[_0xd373('0x35')]['sort']);_0x5621d8['where']=qs[_0xd373('0x37')](_[_0xd373('0x41')](_0xc8f4e6['query'],_0x30549e[_0xd373('0x37')]));if(_0xc8f4e6[_0xd373('0x35')][_0xd373('0x42')]){_0x5621d8[_0xd373('0x40')]=_[_0xd373('0x43')](_0x5621d8[_0xd373('0x40')],{'$or':_[_0xd373('0x2f')](_0x5621d8[_0xd373('0x39')],function(_0x3cc904){var _0x6e6c7e={};_0x6e6c7e[_0x3cc904]={'$like':'%'+_0xc8f4e6[_0xd373('0x35')]['filter']+'%'};return _0x6e6c7e;})});}_0x5621d8=_['merge']({},_0x5621d8,_0xc8f4e6[_0xd373('0x45')]);return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x3785b7){if(_0x3785b7){_0xa854a2=_0x3785b7[_0xd373('0x3b')];if(!_0xc8f4e6[_0xd373('0x35')][_0xd373('0x3c')](_0xd373('0x3d'))){_0x5621d8[_0xd373('0x1f')]=qs['limit'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1f')]);_0x5621d8[_0xd373('0x1e')]=qs['offset'](_0xc8f4e6[_0xd373('0x35')][_0xd373('0x1e')]);}return _0x633ba0[_0xd373('0x7b')](_0x5621d8);}})['then'](function(_0x6463cd){if(_0x6463cd){return _0x6463cd?{'count':_0xa854a2,'rows':_0x6463cd}:null;}})[_0xd373('0x27')](respondWithResult(_0x5c951e,null))['catch'](handleError(_0x5c951e,null));};exports[_0xd373('0x7d')]=function(_0x2da0cd,_0x48624a,_0x316348){var _0x48ee3b=_0x2da0cd[_0xd373('0x51')][_0xd373('0x73')];var _0x3b6ba5;return db['Team']['findAll']({'where':{'id':_0x48ee3b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd373('0x7e'),'attributes':['id','name',_0xd373('0x7f'),_0xd373('0x80'),'interface'],'raw':!![]}]})[_0xd373('0x27')](function(_0x5be460){if(_0x5be460){_0x3b6ba5=_0x5be460;var _0x449d06=_[_0xd373('0x81')](_0x5be460,function(_0x15eb3d){var _0x1031eb=_0x15eb3d[_0xd373('0x29')]({'plain':!![]});return _0x1031eb[_0xd373('0x7e')];});return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x2da0cd['params']['id']}})[_0xd373('0x27')](function(_0x41faec){return db[_0xd373('0x4f')][_0xd373('0x50')](function(_0x39606d){return _0x41faec[_0xd373('0x7d')](_0x48ee3b,{'transaction':_0x39606d})['then'](function(){return BPromise[_0xd373('0x82')](_0x3b6ba5,function(_0x424a53){return db[_0xd373('0x83')]['upsert']({'TeamId':_0x424a53['id'],'VoicePrefixId':_0x2da0cd[_0xd373('0x4b')]['id']},{'transaction':_0x39606d});});})[_0xd373('0x27')](function(){return BPromise[_0xd373('0x82')](_0x449d06,function(_0x2f1dc0){return db[_0xd373('0x84')][_0xd373('0x85')]({'where':{'UserId':_0x2f1dc0['id'],'VoicePrefixId':_0x2da0cd['params']['id']},'transaction':_0x39606d});});})[_0xd373('0x27')](function(){_0x449d06['forEach'](function(_0x447ea9){socket[_0xd373('0x75')](_0xd373('0x86'),{'UserId':_0x447ea9['id'],'VoicePrefixId':_0x41faec['id']});});});});});}})[_0xd373('0x27')](respondWithStatusCode(_0x48624a,null))['catch'](handleError(_0x48624a,null));};exports['removeTeams']=function(_0x22e0bd,_0x44fbef,_0x3c9e20){return db[_0xd373('0x7c')][_0xd373('0x48')]({'where':{'id':_0x22e0bd[_0xd373('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd373('0x7a')],'as':_0xd373('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44fbef,null))[_0xd373('0x27')](function(_0x2225b2){var _0x2d5326=_['map'](_0x2225b2,'id');var _0x259610=[];var _0x747622=[];var _0x5233a2=squel['select']();_0x5233a2[_0xd373('0x87')](_0xd373('0x88'))[_0xd373('0x89')](_0xd373('0x8a'),'tq')[_0xd373('0x8b')](_0xd373('0x8c'),'ut',_0xd373('0x8d'))['where'](_0xd373('0x8e'),_0x22e0bd[_0xd373('0x4b')]['id']);for(var _0x11e4a9=0x0;_0x11e4a9<_0x2225b2[_0xd373('0x3b')];_0x11e4a9+=0x1){let _0x7b49b6=_0x2225b2[_0x11e4a9];for(var _0x4d9ab3=0x0;_0x4d9ab3<_0x7b49b6[_0xd373('0x7e')][_0xd373('0x3b')];_0x4d9ab3+=0x1){let _0x4c924d=_0x7b49b6[_0xd373('0x7e')][_0x4d9ab3];var _0x494de8=_0x5233a2[_0xd373('0x8f')]();_0x494de8[_0xd373('0x40')](_0xd373('0x90'),_0x4c924d['id']);_0x747622[_0xd373('0x67')](db[_0xd373('0x4f')][_0xd373('0x35')](_0x494de8[_0xd373('0x91')](),{'type':db[_0xd373('0x4f')]['QueryTypes'][_0xd373('0x92')]})[_0xd373('0x27')](function(_0x13b085){if(_0x13b085[_0xd373('0x3b')]===0x1){return _0x4c924d['id'];}else{var _0x392bd2=_[_0xd373('0x93')](_['map'](_0x13b085,_0xd373('0x94')),function(_0x10ac87){return _[_0xd373('0x95')](_0x2d5326,_0x10ac87);});if(_0x392bd2){return _0x4c924d['id'];}}}));}}return BPromise[_0xd373('0x96')](_0x747622)[_0xd373('0x27')](function(_0x20fa2e){_0x259610=_(_0x259610)[_0xd373('0x97')](_0x20fa2e)[_0xd373('0x98')]()[_0xd373('0x99')]();return db['VoicePrefix'][_0xd373('0x4c')]({'where':{'id':_0x22e0bd[_0xd373('0x4b')]['id']}})[_0xd373('0x27')](function(_0x536c81){return db[_0xd373('0x4f')]['transaction'](function(_0x4ca4f9){return _0x536c81[_0xd373('0x9a')](_0x22e0bd['query'][_0xd373('0x73')],{'transaction':_0x4ca4f9})['then'](function(){if(!_['isEmpty'](_0x259610)){return _0x536c81['removeAgents'](_0x259610,{'transaction':_0x4ca4f9});}})['then'](function(){_0x259610['forEach'](function(_0x1de658){socket[_0xd373('0x75')](_0xd373('0x77'),{'UserId':_0x1de658,'VoicePrefixId':_0x536c81['id']});});});});});});})[_0xd373('0x27')](respondWithStatusCode(_0x44fbef,null))['catch'](handleError(_0x44fbef,null));}; \ No newline at end of file +var _0xd4a2=['appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','nolimit','getTeams','Team','Agents','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','include','options','find','catch','params','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a2,0x173));var _0x2d4a=function(_0xdf5aa2,_0x490190){_0xdf5aa2=_0xdf5aa2-0x0;var _0x2901b4=_0xd4a2[_0xdf5aa2];return _0x2901b4;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x2a1d0f,_0x5b6c4f){_0x5b6c4f=_0x5b6c4f||0xcc;return function(_0x11c64a){if(_0x11c64a){return _0x2a1d0f[_0x2d4a('0x1b')](_0x5b6c4f);}return _0x2a1d0f[_0x2d4a('0x1c')](_0x5b6c4f)[_0x2d4a('0x1d')]();};}function respondWithResult(_0x4c5287,_0x5f825d){_0x5f825d=_0x5f825d||0xc8;return function(_0x5a6378){if(_0x5a6378){return _0x4c5287[_0x2d4a('0x1c')](_0x5f825d)['json'](_0x5a6378);}};}function respondWithFilteredResult(_0x435687,_0xd1dd52){return function(_0x2188b2){if(_0x2188b2){var _0x388371=typeof _0xd1dd52['offset']==='undefined'&&typeof _0xd1dd52['limit']===_0x2d4a('0x1e');var _0x1966d1=_0x2188b2[_0x2d4a('0x1f')];var _0x419df5=_0x388371?0x0:_0xd1dd52[_0x2d4a('0x20')];var _0x2e4069=_0x388371?_0x2188b2['count']:_0xd1dd52['offset']+_0xd1dd52[_0x2d4a('0x21')];var _0x1f3e17;if(_0x2e4069>=_0x1966d1){_0x2e4069=_0x1966d1;_0x1f3e17=0xc8;}else{_0x1f3e17=0xce;}_0x435687[_0x2d4a('0x1c')](_0x1f3e17);return _0x435687[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x419df5+'-'+_0x2e4069+'/'+_0x1966d1)[_0x2d4a('0x24')](_0x2188b2);}return null;};}function patchUpdates(_0x22dd0b){return function(_0xa43fb1){try{jsonpatch['apply'](_0xa43fb1,_0x22dd0b,!![]);}catch(_0x26e7b8){return BPromise[_0x2d4a('0x25')](_0x26e7b8);}return _0xa43fb1[_0x2d4a('0x26')]();};}function saveUpdates(_0x42d813,_0x2c845c){return function(_0xed2822){if(_0xed2822){return _0xed2822[_0x2d4a('0x27')](_0x42d813)[_0x2d4a('0x28')](function(_0x54c910){return _0x54c910;});}return null;};}function removeEntity(_0x544b9b,_0x5cc7d8){return function(_0x2bb9f0){if(_0x2bb9f0){return _0x2bb9f0['destroy']()[_0x2d4a('0x28')](function(){var _0x3a2fd3=_0x2bb9f0[_0x2d4a('0x29')]({'plain':!![]});var _0x1d2fa6=_0x2d4a('0x2a');return db[_0x2d4a('0x2b')][_0x2d4a('0x2c')]({'where':{'type':_0x1d2fa6,'resourceId':_0x3a2fd3['id']}})[_0x2d4a('0x28')](function(){return _0x2bb9f0;});})['then'](function(){_0x544b9b[_0x2d4a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221602,_0x9bac28){return function(_0xc497ce){if(!_0xc497ce){_0x221602[_0x2d4a('0x1b')](0x194);}return _0xc497ce;};}function handleError(_0x101382,_0x1dfc5d){_0x1dfc5d=_0x1dfc5d||0x1f4;return function(_0x25ac5c){logger[_0x2d4a('0x2d')](_0x25ac5c['stack']);if(_0x25ac5c[_0x2d4a('0x2e')]){delete _0x25ac5c[_0x2d4a('0x2e')];}_0x101382[_0x2d4a('0x1c')](_0x1dfc5d)[_0x2d4a('0x2f')](_0x25ac5c);};}exports[_0x2d4a('0x30')]=function(_0x57bf71,_0x217653){var _0x31d8ae={},_0x27015d={},_0x24bcc2={'count':0x0,'rows':[]};var _0x2bb93d=_['map'](db[_0x2d4a('0x31')][_0x2d4a('0x32')],function(_0x46b623){return{'name':_0x46b623[_0x2d4a('0x33')],'type':_0x46b623[_0x2d4a('0x34')][_0x2d4a('0x35')]};});_0x27015d['model']=_[_0x2d4a('0x36')](_0x2bb93d,_0x2d4a('0x2e'));_0x27015d[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x57bf71[_0x2d4a('0x37')]);_0x27015d['filters']=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],_0x27015d['query']);_0x31d8ae[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0x31d8ae['attributes']=_0x31d8ae[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x31d8ae[_0x2d4a('0x3b')]:_0x27015d[_0x2d4a('0x3a')];if(!_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3e')]('nolimit')){_0x31d8ae['limit']=qs[_0x2d4a('0x21')](_0x57bf71['query'][_0x2d4a('0x21')]);_0x31d8ae[_0x2d4a('0x20')]=qs['offset'](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x20')]);}_0x31d8ae[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0x31d8ae[_0x2d4a('0x41')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x57bf71[_0x2d4a('0x37')],_0x27015d[_0x2d4a('0x42')]),_0x2bb93d);if(_0x57bf71['query'][_0x2d4a('0x44')]){_0x31d8ae[_0x2d4a('0x41')]=_[_0x2d4a('0x45')](_0x31d8ae[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0x2bb93d,function(_0x483a40){if(_0x483a40['type']!=='VIRTUAL'){var _0x5af510={};_0x5af510[_0x483a40[_0x2d4a('0x2e')]]={'$like':'%'+_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x44')]+'%'};return _0x5af510;}})});}_0x31d8ae=_[_0x2d4a('0x45')]({},_0x31d8ae,_0x57bf71['options']);var _0x155f2d={'where':_0x31d8ae[_0x2d4a('0x41')]};return db['VoicePrefix'][_0x2d4a('0x1f')](_0x155f2d)[_0x2d4a('0x28')](function(_0x8a9375){_0x24bcc2[_0x2d4a('0x1f')]=_0x8a9375;if(_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x31d8ae['include']=[{'all':!![]}];}return db[_0x2d4a('0x31')][_0x2d4a('0x47')](_0x31d8ae);})[_0x2d4a('0x28')](function(_0x365399){_0x24bcc2[_0x2d4a('0x48')]=_0x365399;return _0x24bcc2;})[_0x2d4a('0x28')](respondWithFilteredResult(_0x217653,_0x31d8ae))['catch'](handleError(_0x217653,null));};exports[_0x2d4a('0x49')]=function(_0x1f08a3,_0x10b723){var _0x4e1901={'raw':![],'where':{'id':_0x1f08a3['params']['id']}},_0x2585db={};_0x2585db[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x31')][_0x2d4a('0x32')]);_0x2585db[_0x2d4a('0x37')]=_['keys'](_0x1f08a3['query']);_0x2585db[_0x2d4a('0x42')]=_[_0x2d4a('0x39')](_0x2585db['model'],_0x2585db[_0x2d4a('0x37')]);_0x4e1901['attributes']=_[_0x2d4a('0x39')](_0x2585db[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x1f08a3['query'][_0x2d4a('0x3c')]));_0x4e1901['attributes']=_0x4e1901[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4e1901[_0x2d4a('0x3b')]:_0x2585db[_0x2d4a('0x3a')];if(_0x1f08a3[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x4e1901[_0x2d4a('0x4a')]=[{'all':!![]}];}_0x4e1901=_[_0x2d4a('0x45')]({},_0x4e1901,_0x1f08a3[_0x2d4a('0x4b')]);return db[_0x2d4a('0x31')][_0x2d4a('0x4c')](_0x4e1901)['then'](handleEntityNotFound(_0x10b723,null))[_0x2d4a('0x28')](respondWithResult(_0x10b723,null))[_0x2d4a('0x4d')](handleError(_0x10b723,null));};exports[_0x2d4a('0x2c')]=function(_0x1467ab,_0x2d2e24){return db['VoicePrefix'][_0x2d4a('0x4c')]({'where':{'id':_0x1467ab[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2d2e24,null))[_0x2d4a('0x28')](removeEntity(_0x2d2e24,null))[_0x2d4a('0x4d')](handleError(_0x2d2e24,null));};exports['describe']=function(_0x4b9a52,_0x43e74a){return db[_0x2d4a('0x31')]['describe']()[_0x2d4a('0x28')](respondWithResult(_0x43e74a,null))[_0x2d4a('0x4d')](handleError(_0x43e74a,null));};exports[_0x2d4a('0x4f')]=function(_0x19109b,_0x52a468){var _0x31576d;return db['sequelize'][_0x2d4a('0x50')](function(_0x3fe91b){return db[_0x2d4a('0x31')][_0x2d4a('0x4f')](_0x19109b[_0x2d4a('0x51')],{'transaction':_0x3fe91b})[_0x2d4a('0x28')](function(_0x25fb59){_0x31576d=_0x25fb59[_0x2d4a('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x2d4a('0x4c')]({'where':{'id':_0x31576d[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x67ddff){return createVoicePrefixExtensions(_0x31576d,_0x67ddff,_0x3fe91b);});});})[_0x2d4a('0x28')](function(){var _0x334d6a=_0x19109b[_0x2d4a('0x53')][_0x2d4a('0x29')]({'plain':!![]});if(!_0x334d6a)throw new Error(_0x2d4a('0x54'));if(_0x334d6a[_0x2d4a('0x55')]===_0x2d4a('0x53')){var _0x113bc4=_0x31576d;return db[_0x2d4a('0x56')][_0x2d4a('0x4c')]({'where':{'name':_0x2d4a('0x2a'),'userProfileId':_0x334d6a[_0x2d4a('0x57')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x4cce5e){if(_0x4cce5e&&_0x4cce5e[_0x2d4a('0x58')]===0x0){return db[_0x2d4a('0x2b')]['create']({'name':_0x113bc4[_0x2d4a('0x2e')],'resourceId':_0x113bc4['id'],'type':_0x4cce5e[_0x2d4a('0x2e')],'sectionId':_0x4cce5e['id']},{})[_0x2d4a('0x28')](function(){return _0x31576d;});}else{return _0x31576d;}})[_0x2d4a('0x4d')](function(_0x165c00){logger[_0x2d4a('0x2d')](_0x2d4a('0x59'),_0x165c00);throw _0x165c00;});}return _0x31576d;})[_0x2d4a('0x28')](respondWithResult(_0x52a468,null))[_0x2d4a('0x4d')](handleError(_0x52a468,null));};function Extension(_0x352b50,_0x346f2b,_0x302323,_0x5c7cf9){this[_0x2d4a('0x5a')]=_0x2d4a('0x5b');this['exten']=_0x352b50;this[_0x2d4a('0x5c')]=_0x302323;this[_0x2d4a('0x34')]=_0x2d4a('0x5d');this[_0x2d4a('0x5e')]=_0x2d4a('0x5f');this[_0x2d4a('0x60')]=_0x346f2b;this[_0x2d4a('0x61')]=_0x5c7cf9;}function createVoicePrefixExtensions(_0x43e6a6,_0x1034d2,_0x282df8){return new BPromise(function(_0x5bbc96,_0x2bd137){var _0x8ae6bd=new Extension(formatPrefixName(_0x43e6a6[_0x2d4a('0x62')]),0x1,'NoOp',_0x2d4a('0x63'));_0x8ae6bd[_0x2d4a('0x64')]=_0x43e6a6['id'];return db[_0x2d4a('0x65')][_0x2d4a('0x4f')](_0x8ae6bd,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x278bbc){var _0x7e2699=_0x278bbc[_0x2d4a('0x29')]({'plain':!![]});var _0x1ed616=_['map'](addVoicePrefixExtensions(_0x43e6a6,_0x1034d2),function(_0x21b8e9){_0x21b8e9[_0x2d4a('0x52')]=_0x7e2699['id'];_0x21b8e9[_0x2d4a('0x64')]=_0x43e6a6['id'];return _0x21b8e9;});return db[_0x2d4a('0x65')][_0x2d4a('0x66')](_0x1ed616,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x53f52b){if(!_0x53f52b){return _0x2bd137(_0x2d4a('0x67'));}else{return _0x5bbc96(_0x53f52b);}})[_0x2d4a('0x4d')](function(_0x22707f){return _0x2bd137(_0x22707f);});});;});};function addVoicePrefixExtensions(_0x4809af,_0x465c89){var _0x442691=[];var _0x4f4a09=formatPrefixName(_0x4809af[_0x2d4a('0x62')]);_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x2,'Set',_0x2d4a('0x69')+_0x4809af['name']));if(_0x4809af['callerIdAll']){_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6a'),_0x2d4a('0x6b')+_0x4809af[_0x2d4a('0x6c')]));}else{_0x442691['push'](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6d'),_0x2d4a('0x6e')));}_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x4,_0x2d4a('0x6f'),_0x465c89['context']+','+'${EXTEN:'+(0x8+_0x4809af[_0x2d4a('0x2e')][_0x2d4a('0x3d')])+'}'+','+0x1));return _0x442691;}function formatPrefixName(_0x2a2441){var _0x2aa9e8='_';for(var _0x9e6321=0x0;_0x9e6321<_0x2a2441[_0x2d4a('0x3d')];_0x9e6321++){if(_0x2a2441[_0x2d4a('0x70')](_0x9e6321)=='-'){_0x2aa9e8+=_0x2a2441['charAt'](_0x9e6321);}else{_0x2aa9e8+='['+_0x2a2441[_0x2d4a('0x70')](_0x9e6321)+']';}}_0x2aa9e8+='.';return _0x2aa9e8;}exports[_0x2d4a('0x27')]=function(_0xf3d514,_0x398439,_0x59810d){var _0x299bdf=_0xf3d514[_0x2d4a('0x51')];_0x299bdf[_0x2d4a('0x62')]=_0x2d4a('0x71')+_0x299bdf['name']+'-';return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x55d565){return db[_0x2d4a('0x31')][_0x2d4a('0x27')](_0x299bdf,{'where':{'id':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db['VoiceExtension'][_0x2d4a('0x2c')]({'where':{'VoicePrefixId':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db[_0x2d4a('0x65')][_0x2d4a('0x4c')]({'where':{'id':_0x299bdf[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x3bc965){return createVoicePrefixExtensions(_0x299bdf,_0x3bc965,_0x55d565);});});});})['then'](function(){return db[_0x2d4a('0x31')][_0x2d4a('0x73')](_0x299bdf['id']);})[_0x2d4a('0x28')](respondWithResult(_0x398439,null))[_0x2d4a('0x4d')](handleError(_0x398439,null));};exports[_0x2d4a('0x74')]=function(_0x55ebbb,_0x38e623,_0x5aead3){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x55ebbb[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x38e623,null))[_0x2d4a('0x28')](function(_0x2ba9c2){if(_0x2ba9c2){return _0x2ba9c2[_0x2d4a('0x74')](_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')],_[_0x2d4a('0x76')](_0x55ebbb['body'],[_0x2d4a('0x75'),'id'])||{})['spread'](function(_0x3d7d7d){for(var _0x3c284d=0x0;_0x3c284d<_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x3c284d+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':Number(_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x3c284d]),'VoicePrefixId':Number(_0x55ebbb['params']['id'])});}return _0x3d7d7d;});}})[_0x2d4a('0x28')](respondWithResult(_0x38e623,null))[_0x2d4a('0x4d')](handleError(_0x38e623,null));};exports[_0x2d4a('0x79')]=function(_0xcdf787,_0x574285,_0x36d253){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0xcdf787[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x574285,null))[_0x2d4a('0x28')](function(_0x5769be){if(_0x5769be){return _0x5769be[_0x2d4a('0x79')](_0xcdf787[_0x2d4a('0x37')]['ids'])[_0x2d4a('0x28')](function(){if(_[_0x2d4a('0x7a')](_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')])){for(var _0x429579=0x0;_0x429579<_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x429579+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787['query'][_0x2d4a('0x75')][_0x429579]),'VoicePrefixId':Number(_0xcdf787['params']['id'])});}}else{socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')]),'VoicePrefixId':Number(_0xcdf787[_0x2d4a('0x4e')]['id'])});}});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x574285,null))[_0x2d4a('0x4d')](handleError(_0x574285,null));};exports['getAgents']=function(_0x119c59,_0x2ebb9e,_0xc11b2e){var _0xfc7b53={};var _0x47377e={};var _0x5e7f23;var _0x4ebda1;return db['VoicePrefix'][_0x2d4a('0x7c')]({'where':{'id':_0x119c59[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2ebb9e,null))['then'](function(_0x135f58){if(_0x135f58){_0x5e7f23=_0x135f58;_0x47377e[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x7d')][_0x2d4a('0x32')]);_0x47377e[_0x2d4a('0x37')]=_['keys'](_0x119c59[_0x2d4a('0x37')]);_0x47377e['filters']=_[_0x2d4a('0x39')](_0x47377e[_0x2d4a('0x3a')],_0x47377e['query']);_0xfc7b53[_0x2d4a('0x3b')]=_['intersection'](_0x47377e['model'],qs['fields'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0xfc7b53[_0x2d4a('0x3b')]=_0xfc7b53['attributes'][_0x2d4a('0x3d')]?_0xfc7b53[_0x2d4a('0x3b')]:_0x47377e[_0x2d4a('0x3a')];_0xfc7b53[_0x2d4a('0x3f')]=qs['sort'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0xfc7b53['where']=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x119c59['query'],_0x47377e[_0x2d4a('0x42')]));if(_0x119c59['query']['filter']){_0xfc7b53[_0x2d4a('0x41')]=_['merge'](_0xfc7b53[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0xfc7b53[_0x2d4a('0x3b')],function(_0x44d3b3){var _0x5e939f={};_0x5e939f[_0x44d3b3]={'$like':'%'+_0x119c59[_0x2d4a('0x37')]['filter']+'%'};return _0x5e939f;})});}_0xfc7b53=_[_0x2d4a('0x45')]({},_0xfc7b53,_0x119c59[_0x2d4a('0x4b')]);return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x45f6b7){if(_0x45f6b7){_0x4ebda1=_0x45f6b7['length'];if(!_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0xfc7b53['limit']=qs[_0x2d4a('0x21')](_0x119c59['query']['limit']);_0xfc7b53[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x20')]);}return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x2bffb4){if(_0x2bffb4){return _0x2bffb4?{'count':_0x4ebda1,'rows':_0x2bffb4}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x2ebb9e,null))[_0x2d4a('0x4d')](handleError(_0x2ebb9e,null));};exports[_0x2d4a('0x80')]=function(_0x5ecf3e,_0x16c4fd,_0x2b29b1){var _0x4647cb={};var _0x10d86c={};var _0x36b067;var _0x1cb5b3;return db[_0x2d4a('0x31')][_0x2d4a('0x7c')]({'where':{'id':_0x5ecf3e['params']['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x16c4fd,null))[_0x2d4a('0x28')](function(_0xa4c947){if(_0xa4c947){_0x36b067=_0xa4c947;_0x10d86c['model']=_[_0x2d4a('0x38')](db['Team'][_0x2d4a('0x32')]);_0x10d86c[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x5ecf3e[_0x2d4a('0x37')]);_0x10d86c['filters']=_[_0x2d4a('0x39')](_0x10d86c['model'],_0x10d86c[_0x2d4a('0x37')]);_0x4647cb[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x10d86c['model'],qs[_0x2d4a('0x3c')](_0x5ecf3e['query'][_0x2d4a('0x3c')]));_0x4647cb[_0x2d4a('0x3b')]=_0x4647cb[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4647cb[_0x2d4a('0x3b')]:_0x10d86c[_0x2d4a('0x3a')];_0x4647cb[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x5ecf3e[_0x2d4a('0x37')]['sort']);_0x4647cb['where']=qs['filters'](_[_0x2d4a('0x43')](_0x5ecf3e['query'],_0x10d86c[_0x2d4a('0x42')]));if(_0x5ecf3e['query'][_0x2d4a('0x44')]){_0x4647cb[_0x2d4a('0x41')]=_['merge'](_0x4647cb['where'],{'$or':_[_0x2d4a('0x36')](_0x4647cb['attributes'],function(_0x279c26){var _0x643012={};_0x643012[_0x279c26]={'$like':'%'+_0x5ecf3e[_0x2d4a('0x37')]['filter']+'%'};return _0x643012;})});}_0x4647cb=_[_0x2d4a('0x45')]({},_0x4647cb,_0x5ecf3e[_0x2d4a('0x4b')]);return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x1c3c0f){if(_0x1c3c0f){_0x1cb5b3=_0x1c3c0f[_0x2d4a('0x3d')];if(!_0x5ecf3e[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0x4647cb[_0x2d4a('0x21')]=qs[_0x2d4a('0x21')](_0x5ecf3e[_0x2d4a('0x37')]['limit']);_0x4647cb[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x5ecf3e[_0x2d4a('0x37')]['offset']);}return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x250a9c){if(_0x250a9c){return _0x250a9c?{'count':_0x1cb5b3,'rows':_0x250a9c}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x16c4fd,null))[_0x2d4a('0x4d')](handleError(_0x16c4fd,null));};exports['addTeams']=function(_0x438769,_0x1483af,_0x5413c1){var _0x2d5122=_0x438769['body'][_0x2d4a('0x75')];var _0x1cd7fd;return db[_0x2d4a('0x81')][_0x2d4a('0x47')]({'where':{'id':_0x2d5122},'attributes':['id'],'include':[{'model':db[_0x2d4a('0x7d')],'as':_0x2d4a('0x82'),'attributes':['id',_0x2d4a('0x2e'),'online',_0x2d4a('0x83'),_0x2d4a('0x84')],'raw':!![]}]})[_0x2d4a('0x28')](function(_0x1e5be2){if(_0x1e5be2){_0x1cd7fd=_0x1e5be2;var _0x139e4e=_[_0x2d4a('0x85')](_0x1e5be2,function(_0x58b196){var _0x23577f=_0x58b196[_0x2d4a('0x29')]({'plain':!![]});return _0x23577f[_0x2d4a('0x82')];});return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x438769['params']['id']}})['then'](function(_0x3e276d){return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x2fee11){return _0x3e276d[_0x2d4a('0x86')](_0x2d5122,{'transaction':_0x2fee11})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x1cd7fd,function(_0x1adcbc){return db[_0x2d4a('0x88')]['upsert']({'TeamId':_0x1adcbc['id'],'VoicePrefixId':_0x438769['params']['id']},{'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x139e4e,function(_0x3b4585){return db[_0x2d4a('0x89')][_0x2d4a('0x8a')]({'where':{'UserId':_0x3b4585['id'],'VoicePrefixId':_0x438769[_0x2d4a('0x4e')]['id']},'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){_0x139e4e[_0x2d4a('0x8b')](function(_0x12914d){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':_0x12914d['id'],'VoicePrefixId':_0x3e276d['id']});});});});});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x1483af,null))['catch'](handleError(_0x1483af,null));};exports['removeTeams']=function(_0x51cba2,_0x448b4d,_0x4cefec){return db['Team'][_0x2d4a('0x47')]({'where':{'id':_0x51cba2[_0x2d4a('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2d4a('0x28')](handleEntityNotFound(_0x448b4d,null))[_0x2d4a('0x28')](function(_0x1e05c5){var _0x3e199a=_[_0x2d4a('0x36')](_0x1e05c5,'id');var _0x357dfc=[];var _0xd80165=[];var _0x448664=squel[_0x2d4a('0x8c')]();_0x448664[_0x2d4a('0x8d')]('tq.TeamId')[_0x2d4a('0x8e')](_0x2d4a('0x8f'),'tq')[_0x2d4a('0x90')](_0x2d4a('0x91'),'ut',_0x2d4a('0x92'))[_0x2d4a('0x41')]('VoicePrefixId\x20=\x20?',_0x51cba2[_0x2d4a('0x4e')]['id']);for(var _0x3030e1=0x0;_0x3030e1<_0x1e05c5['length'];_0x3030e1+=0x1){let _0xc5500=_0x1e05c5[_0x3030e1];for(var _0xe198b=0x0;_0xe198b<_0xc5500['Agents']['length'];_0xe198b+=0x1){let _0x497b03=_0xc5500['Agents'][_0xe198b];var _0xb81202=_0x448664['clone']();_0xb81202[_0x2d4a('0x41')](_0x2d4a('0x93'),_0x497b03['id']);_0xd80165[_0x2d4a('0x68')](db[_0x2d4a('0x72')][_0x2d4a('0x37')](_0xb81202[_0x2d4a('0x94')](),{'type':db[_0x2d4a('0x72')]['QueryTypes'][_0x2d4a('0x95')]})['then'](function(_0x2b6040){if(_0x2b6040[_0x2d4a('0x3d')]===0x1){return _0x497b03['id'];}else{var _0x137c57=_[_0x2d4a('0x96')](_[_0x2d4a('0x36')](_0x2b6040,_0x2d4a('0x97')),function(_0x29108f){return _['includes'](_0x3e199a,_0x29108f);});if(_0x137c57){return _0x497b03['id'];}}}));}}return BPromise[_0x2d4a('0x98')](_0xd80165)['then'](function(_0x1d4cc3){_0x357dfc=_(_0x357dfc)[_0x2d4a('0x99')](_0x1d4cc3)[_0x2d4a('0x9a')]()['value']();return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x51cba2[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](function(_0x108cd1){return db[_0x2d4a('0x72')]['transaction'](function(_0x29a294){return _0x108cd1['removeTeams'](_0x51cba2[_0x2d4a('0x37')]['ids'],{'transaction':_0x29a294})['then'](function(){if(!_[_0x2d4a('0x9b')](_0x357dfc)){return _0x108cd1['removeAgents'](_0x357dfc,{'transaction':_0x29a294});}})['then'](function(){_0x357dfc[_0x2d4a('0x8b')](function(_0x206717){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':_0x206717,'VoicePrefixId':_0x108cd1['id']});});});});});});})[_0x2d4a('0x28')](respondWithStatusCode(_0x448b4d,null))[_0x2d4a('0x4d')](handleError(_0x448b4d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9f7abb5..53aed32 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 _0xe526=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x311eb0,_0x469a4e){var _0x511d58=function(_0x2996ea){while(--_0x2996ea){_0x311eb0['push'](_0x311eb0['shift']());}};_0x511d58(++_0x469a4e);}(_0xe526,0x1c2));var _0x6e52=function(_0x2000b5,_0x581fb7){_0x2000b5=_0x2000b5-0x0;var _0x1aa0f3=_0xe526[_0x2000b5];return _0x1aa0f3;};'use strict';var EventEmitter=require(_0x6e52('0x0'));var VoicePrefix=require(_0x6e52('0x1'))['db'][_0x6e52('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6e52('0x3')](0x0);var events={'afterCreate':_0x6e52('0x4'),'afterUpdate':_0x6e52('0x5'),'afterDestroy':_0x6e52('0x6')};function emitEvent(_0x57bb4d){return function(_0x42fc1c,_0x3cd040,_0xe85d8e){VoicePrefixEvents[_0x6e52('0x7')](_0x57bb4d+':'+_0x42fc1c['id'],_0x42fc1c);VoicePrefixEvents[_0x6e52('0x7')](_0x57bb4d,_0x42fc1c);_0xe85d8e(null);};}for(var e in events){if(events[_0x6e52('0x8')](e)){var event=events[e];VoicePrefix[_0x6e52('0x9')](e,emitEvent(event));}}module[_0x6e52('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x7ec8=['hook','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4cce5d,_0x301413){var _0x20b734=function(_0x110d95){while(--_0x110d95){_0x4cce5d['push'](_0x4cce5d['shift']());}};_0x20b734(++_0x301413);}(_0x7ec8,0xd3));var _0x87ec=function(_0x24cf9b,_0x19a454){_0x24cf9b=_0x24cf9b-0x0;var _0x48735d=_0x7ec8[_0x24cf9b];return _0x48735d;};'use strict';var EventEmitter=require(_0x87ec('0x0'));var VoicePrefix=require(_0x87ec('0x1'))['db'][_0x87ec('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x87ec('0x3')](0x0);var events={'afterCreate':_0x87ec('0x4'),'afterUpdate':_0x87ec('0x5'),'afterDestroy':_0x87ec('0x6')};function emitEvent(_0x4f598f){return function(_0x314878,_0x3a2ebe,_0x2d7f3b){VoicePrefixEvents[_0x87ec('0x7')](_0x4f598f+':'+_0x314878['id'],_0x314878);VoicePrefixEvents[_0x87ec('0x7')](_0x4f598f,_0x314878);_0x2d7f3b(null);};}for(var e in events){if(events[_0x87ec('0x8')](e)){var event=events[e];VoicePrefix[_0x87ec('0x9')](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 e96b506..8536b9c 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 _0x9bb0=['moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','util','api'];(function(_0x459648,_0x59fb25){var _0xc987bb=function(_0x24119f){while(--_0x24119f){_0x459648['push'](_0x459648['shift']());}};_0xc987bb(++_0x59fb25);}(_0x9bb0,0x11b));var _0x09bb=function(_0x122cc1,_0x5c956e){_0x122cc1=_0x122cc1-0x0;var _0x1e33af=_0x9bb0[_0x122cc1];return _0x1e33af;};'use strict';var _=require(_0x09bb('0x0'));var util=require(_0x09bb('0x1'));var logger=require('../../config/logger')(_0x09bb('0x2'));var moment=require(_0x09bb('0x3'));var BPromise=require(_0x09bb('0x4'));var rp=require(_0x09bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09bb('0x6'));var config=require(_0x09bb('0x7'));var attributes=require(_0x09bb('0x8'));module['exports']=function(_0x36ec2c,_0x4ed5f6){return _0x36ec2c[_0x09bb('0x9')](_0x09bb('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x518c=['define','VoicePrefix','voice_prefixes','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x42afc2,_0xc569e9){var _0xe56aa1=function(_0x12778e){while(--_0x12778e){_0x42afc2['push'](_0x42afc2['shift']());}};_0xe56aa1(++_0xc569e9);}(_0x518c,0x116));var _0xc518=function(_0xfee9e3,_0x3189f1){_0xfee9e3=_0xfee9e3-0x0;var _0x3762b5=_0x518c[_0xfee9e3];return _0x3762b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc518('0x0'));var moment=require('moment');var BPromise=require(_0xc518('0x1'));var rp=require(_0xc518('0x2'));var fs=require('fs');var path=require(_0xc518('0x3'));var rimraf=require(_0xc518('0x4'));var config=require(_0xc518('0x5'));var attributes=require(_0xc518('0x6'));module[_0xc518('0x7')]=function(_0x23a4c0,_0x3e1474){return _0x23a4c0[_0xc518('0x8')](_0xc518('0x9'),attributes,{'tableName':_0xc518('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index c576726..384052d 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 _0x6ab9=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x4fb18a,_0x4186a3){var _0x13bf76=function(_0x48d884){while(--_0x48d884){_0x4fb18a['push'](_0x4fb18a['shift']());}};_0x13bf76(++_0x4186a3);}(_0x6ab9,0x19a));var _0x96ab=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x6ab9[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var moment=require('moment');var BPromise=require(_0x96ab('0x2'));var rs=require(_0x96ab('0x3'));var fs=require('fs');var Redis=require(_0x96ab('0x4'));var db=require(_0x96ab('0x5'))['db'];var utils=require(_0x96ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96ab('0x7'));var jayson=require(_0x96ab('0x8'));var client=jayson[_0x96ab('0x9')]['http']({'port':0x232a});config[_0x96ab('0xa')]=_[_0x96ab('0xb')](config['redis'],{'host':_0x96ab('0xc'),'port':0x18eb});var socket=require(_0x96ab('0xd'))(new Redis(config[_0x96ab('0xa')]));require(_0x96ab('0xe'))[_0x96ab('0xf')](socket);function respondWithRpcPromise(_0x2dfc50,_0xdc00cb,_0x84fd1e){return new BPromise(function(_0x3ef79e,_0x9a19d7){return client[_0x96ab('0x10')](_0x2dfc50,_0x84fd1e)[_0x96ab('0x11')](function(_0x43658c){logger['info'](_0x96ab('0x12'),_0xdc00cb,'request\x20sent');logger[_0x96ab('0x13')](_0x96ab('0x14'),_0xdc00cb,_0x96ab('0x15'),JSON[_0x96ab('0x16')](_0x43658c));if(_0x43658c[_0x96ab('0x17')]){if(_0x43658c[_0x96ab('0x17')][_0x96ab('0x18')]===0x1f4){logger[_0x96ab('0x17')](_0x96ab('0x12'),_0xdc00cb,_0x43658c[_0x96ab('0x17')][_0x96ab('0x19')]);return _0x9a19d7(_0x43658c['error']['message']);}logger[_0x96ab('0x17')](_0x96ab('0x12'),_0xdc00cb,_0x43658c[_0x96ab('0x17')]['message']);return _0x3ef79e(_0x43658c[_0x96ab('0x17')][_0x96ab('0x19')]);}else{logger['info'](_0x96ab('0x12'),_0xdc00cb,'request\x20sent');_0x3ef79e(_0x43658c[_0x96ab('0x1a')][_0x96ab('0x19')]);}})[_0x96ab('0x1b')](function(_0x23f826){logger[_0x96ab('0x17')](_0x96ab('0x12'),_0xdc00cb,_0x23f826);_0x9a19d7(_0x23f826);});});} \ No newline at end of file +var _0xca84=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca84,0xf5));var _0x4ca8=function(_0xaf0a50,_0x5663d8){_0xaf0a50=_0xaf0a50-0x0;var _0x4cd234=_0xca84[_0xaf0a50];return _0x4cd234;};'use strict';var _=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var moment=require(_0x4ca8('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ca8('0x3'));var fs=require('fs');var Redis=require(_0x4ca8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ca8('0x5'));var logger=require(_0x4ca8('0x6'))(_0x4ca8('0x7'));var config=require(_0x4ca8('0x8'));var jayson=require(_0x4ca8('0x9'));var client=jayson[_0x4ca8('0xa')][_0x4ca8('0xb')]({'port':0x232a});config[_0x4ca8('0xc')]=_[_0x4ca8('0xd')](config[_0x4ca8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ca8('0xe'))(new Redis(config['redis']));require(_0x4ca8('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f1198,_0x57db27,_0x41991d){return new BPromise(function(_0x53ffa,_0x3cc932){return client[_0x4ca8('0x10')](_0x2f1198,_0x41991d)[_0x4ca8('0x11')](function(_0x45e7d0){logger[_0x4ca8('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x57db27,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x57db27,_0x4ca8('0x13'),JSON['stringify'](_0x45e7d0));if(_0x45e7d0[_0x4ca8('0x14')]){if(_0x45e7d0[_0x4ca8('0x14')]['code']===0x1f4){logger['error'](_0x4ca8('0x15'),_0x57db27,_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);return _0x3cc932(_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);}logger[_0x4ca8('0x14')](_0x4ca8('0x15'),_0x57db27,_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);return _0x53ffa(_0x45e7d0[_0x4ca8('0x14')][_0x4ca8('0x16')]);}else{logger[_0x4ca8('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x57db27,_0x4ca8('0x13'));_0x53ffa(_0x45e7d0[_0x4ca8('0x17')][_0x4ca8('0x16')]);}})[_0x4ca8('0x18')](function(_0x28fe2b){logger['error'](_0x4ca8('0x15'),_0x57db27,_0x28fe2b);_0x3cc932(_0x28fe2b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8b3bfdb..7767065 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 _0xea70=['length','voicePrefix:','./voicePrefix.events','save','remove','removeListener','register'];(function(_0x10ebb4,_0xc1c637){var _0x3681ac=function(_0x4354ba){while(--_0x4354ba){_0x10ebb4['push'](_0x10ebb4['shift']());}};_0x3681ac(++_0xc1c637);}(_0xea70,0x175));var _0x0ea7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xea70[_0x4565bf];return _0x5610ba;};'use strict';var VoicePrefixEvents=require(_0x0ea7('0x0'));var events=[_0x0ea7('0x1'),_0x0ea7('0x2'),'update'];function createListener(_0x28ddf0,_0x499815){return function(_0x2fad00){_0x499815['emit'](_0x28ddf0,_0x2fad00);};}function removeListener(_0x425623,_0x3138eb){return function(){VoicePrefixEvents[_0x0ea7('0x3')](_0x425623,_0x3138eb);};}exports[_0x0ea7('0x4')]=function(_0x168372){for(var _0x489be9=0x0,_0x144497=events[_0x0ea7('0x5')];_0x489be9<_0x144497;_0x489be9++){var _0x51b516=events[_0x489be9];var _0x48dedd=createListener(_0x0ea7('0x6')+_0x51b516,_0x168372);VoicePrefixEvents['on'](_0x51b516,_0x48dedd);}}; \ No newline at end of file +var _0xfe60=['removeListener','register','length','voicePrefix:','save','update','emit'];(function(_0x2f4069,_0x74eb6c){var _0x4e5d90=function(_0x56fedf){while(--_0x56fedf){_0x2f4069['push'](_0x2f4069['shift']());}};_0x4e5d90(++_0x74eb6c);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x23a608,_0x35d4f0){_0x23a608=_0x23a608-0x0;var _0x89c004=_0xfe60[_0x23a608];return _0x89c004;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x0fe6('0x0'),'remove',_0x0fe6('0x1')];function createListener(_0xb94e65,_0x43c7c1){return function(_0x4aa401){_0x43c7c1[_0x0fe6('0x2')](_0xb94e65,_0x4aa401);};}function removeListener(_0x244c56,_0x402912){return function(){VoicePrefixEvents[_0x0fe6('0x3')](_0x244c56,_0x402912);};}exports[_0x0fe6('0x4')]=function(_0x1281fc){for(var _0x13b947=0x0,_0x21775d=events[_0x0fe6('0x5')];_0x13b947<_0x21775d;_0x13b947++){var _0x24e88f=events[_0x13b947];var _0x58d620=createListener(_0x0fe6('0x6')+_0x24e88f,_0x1281fc);VoicePrefixEvents['on'](_0x24e88f,_0x58d620);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 15b2c7d..872530b 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x5982a5,_0x3dc07b){var _0x159c80=function(_0x274c92){while(--_0x274c92){_0x5982a5['push'](_0x5982a5['shift']());}};_0x159c80(++_0x3dc07b);}(_0xb10b,0x12a));var _0xbb10=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xb10b[_0x54c9dd];return _0x855156;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xb10b,0x12a));var _0xbb10=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0xb10b[_0x179c4a];return _0x5d1879;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 84c531a..ade5c29 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 _0x4bc1=['wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','ENUM','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear'];(function(_0x12e540,_0x26d444){var _0x521358=function(_0x5eaef2){while(--_0x5eaef2){_0x12e540['push'](_0x12e540['shift']());}};_0x521358(++_0x26d444);}(_0x4bc1,0xa2));var _0x14bc=function(_0x4ffe11,_0x1fe759){_0x4ffe11=_0x4ffe11-0x0;var _0x1926a6=_0x4bc1[_0x4ffe11];return _0x1926a6;};'use strict';var Sequelize=require(_0x14bc('0x0'));module[_0x14bc('0x1')]={'name':{'type':Sequelize[_0x14bc('0x2')],'allowNull':![],'unique':_0x14bc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x14bc('0x4'),_0x14bc('0x5')),'allowNull':![],'defaultValue':_0x14bc('0x4')},'musiconhold':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':_0x14bc('0x6')},'announce':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x14bc('0x7'),_0x14bc('0x8'),_0x14bc('0x9'),'random',_0x14bc('0xa'),_0x14bc('0xb'),_0x14bc('0xc'),_0x14bc('0xd')),'allowNull':![],'defaultValue':_0x14bc('0x7'),'set':function(_0x27ae31){this[_0x14bc('0xe')](_0x14bc('0xf'),_0x27ae31?_0x27ae31:'rrmemory');},'get':function(){var _0x193a42=this[_0x14bc('0x10')]('type');var _0x3c60f1=this['getDataValue'](_0x14bc('0x11'));var _0x530f7b=this[_0x14bc('0x10')](_0x14bc('0xf'));if(_0x193a42==='outbound'){if(_0x3c60f1===_0x14bc('0x12')){return null;}if(_0x3c60f1===_0x14bc('0x13')&&![_0x14bc('0xa'),_0x14bc('0x14')][_0x14bc('0x15')](_0x530f7b)){this[_0x14bc('0xe')](_0x14bc('0xf'),'rrmemory');}}return _0x530f7b;}},'servicelevel':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x14bc('0x16')](0xb)},'timeout':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x14bc('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':_0x14bc('0x18')},'autopause':{'type':Sequelize['ENUM'](_0x14bc('0x18'),'no',_0x14bc('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x14bc('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x14bc('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':_0x14bc('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x14bc('0x2')]},'queue_youarenext':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x14bc('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x14bc('0x2')]},'queue_quantity1':{'type':Sequelize[_0x14bc('0x2')]},'queue_quantity2':{'type':Sequelize[_0x14bc('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x14bc('0x2')]},'queue_less_than':{'type':Sequelize[_0x14bc('0x2')]},'periodic_announce':{'type':Sequelize[_0x14bc('0x1a')],'set':function(_0x6f73c1){this[_0x14bc('0xe')](_0x14bc('0x1b'),_0x6f73c1?_0x6f73c1[_0x14bc('0x1c')](','):[]);},'get':function(){return this[_0x14bc('0x10')](_0x14bc('0x1b'))?this['getDataValue'](_0x14bc('0x1b'))[_0x14bc('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':'yes','set':function(_0x5348e6){this[_0x14bc('0xe')](_0x14bc('0x1e'),_0x5348e6?_0x5348e6[_0x14bc('0x1c')](','):undefined);},'get':function(){return this[_0x14bc('0x10')](_0x14bc('0x1e'))?this[_0x14bc('0x10')](_0x14bc('0x1e'))[_0x14bc('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':'no','set':function(_0x3fad8d){this[_0x14bc('0xe')](_0x14bc('0x1f'),_0x3fad8d?_0x3fad8d[_0x14bc('0x1c')](','):undefined);},'get':function(){return this[_0x14bc('0x10')]('leavewhenempty')?this[_0x14bc('0x10')](_0x14bc('0x1f'))[_0x14bc('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x14bc('0x17')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x14bc('0x2')]},'description':{'type':Sequelize[_0x14bc('0x2')]},'acw':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':0x0,'set':function(_0x44c37f){this['setDataValue'](_0x14bc('0x21'),_0x44c37f);if(_0x44c37f){if(this[_0x14bc('0x10')](_0x14bc('0x22'))<0x2){this[_0x14bc('0xe')](_0x14bc('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x14bc('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':0x0,'comment':_0x14bc('0x23')},'dialMethod':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x12'),_0x14bc('0x24'),_0x14bc('0x25'),_0x14bc('0x26'),_0x14bc('0x13')),'defaultValue':_0x14bc('0x24'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x14bc('0x16')](0x4)[_0x14bc('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x14bc('0x28')},'dialLimitQueue':{'type':Sequelize[_0x14bc('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x14bc('0x29')},'dialPowerLevel':{'type':Sequelize[_0x14bc('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x14bc('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x14bc('0x17')](_0x14bc('0x2c'),_0x14bc('0x2d')),'defaultValue':_0x14bc('0x2d'),'comment':_0x14bc('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x14bc('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x14bc('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x14bc('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x30')},'dialQueueOptions':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':_0x14bc('0x31'),'comment':_0x14bc('0x32')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x14bc('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'comment':_0x14bc('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x39')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x14bc('0x3a')},'dialTimezone':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':_0x14bc('0x3b')},'dialPrefix':{'type':Sequelize[_0x14bc('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x14bc('0x3c'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':0x0,'comment':_0x14bc('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0x14bc('0x16')](0x9)[_0x14bc('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x14bc('0x16')](0x9)[_0x14bc('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x14bc('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x14bc('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x14bc('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x14bc('0x16')](0x9)[_0x14bc('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x14bc('0x40')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x14bc('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x14bc('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x14bc('0x16')](0x9)[_0x14bc('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x14bc('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x14bc('0x16')](0x9)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x14bc('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x14bc('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x14bc('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x14bc('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':0x0,'comment':_0x14bc('0x45')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x14bc('0x46'),_0x14bc('0x47')),'defaultValue':_0x14bc('0x46')},'dialQueueProject2':{'type':Sequelize[_0x14bc('0x2')],'comment':_0x14bc('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x14bc('0x48')},'dialCutDigit':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x14bc('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x14bc('0x16')](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x50')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14bc('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x14bc('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14bc('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x14bc('0x16')],'allowNull':!![],'comment':_0x14bc('0x54')},'mandatoryDisposition':{'type':Sequelize[_0x14bc('0x20')],'defaultValue':![],'comment':_0x14bc('0x55'),'set':function(_0x407f52){if(!_0x407f52)this['setDataValue'](_0x14bc('0x56'),null);this[_0x14bc('0xe')]('mandatoryDisposition',_0x407f52);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x14bc('0x16')](0x3)[_0x14bc('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x14bc('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x14bc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf592=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','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)','#Congestion\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)','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','outbound','inbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.'];(function(_0x45a11e,_0x201134){var _0x54229c=function(_0x5a68e3){while(--_0x5a68e3){_0x45a11e['push'](_0x45a11e['shift']());}};_0x54229c(++_0x201134);}(_0xf592,0x83));var _0x2f59=function(_0x38b31d,_0x3ab5e6){_0x38b31d=_0x38b31d-0x0;var _0x5dbbe5=_0xf592[_0x38b31d];return _0x5dbbe5;};'use strict';var Sequelize=require(_0x2f59('0x0'));module[_0x2f59('0x1')]={'name':{'type':Sequelize[_0x2f59('0x2')],'allowNull':![],'unique':_0x2f59('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x2f59('0x4')),'allowNull':![],'defaultValue':_0x2f59('0x5')},'musiconhold':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':_0x2f59('0x6')},'announce':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2f59('0x7')]('rr',_0x2f59('0x8'),_0x2f59('0x9'),_0x2f59('0xa'),_0x2f59('0xb'),_0x2f59('0xc'),_0x2f59('0xd'),_0x2f59('0xe'),_0x2f59('0xf')),'allowNull':![],'defaultValue':_0x2f59('0x8'),'set':function(_0x4a0ff6){this[_0x2f59('0x10')](_0x2f59('0x11'),_0x4a0ff6?_0x4a0ff6:'rrmemory');},'get':function(){var _0x5390ac=this[_0x2f59('0x12')](_0x2f59('0x13'));var _0x1f0a55=this[_0x2f59('0x12')]('dialMethod');var _0x41b2ec=this['getDataValue'](_0x2f59('0x11'));if(_0x5390ac==='outbound'){if(_0x1f0a55===_0x2f59('0x14')){return null;}if(_0x1f0a55===_0x2f59('0x15')&&![_0x2f59('0xc'),_0x2f59('0x16')][_0x2f59('0x17')](_0x41b2ec)){this['setDataValue'](_0x2f59('0x11'),'rrmemory');}}return _0x41b2ec;}},'servicelevel':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2f59('0x18')](0xb)},'timeout':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2f59('0x2')]},'weight':{'type':Sequelize[_0x2f59('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x2f59('0x19'),'no'),'defaultValue':_0x2f59('0x19')},'autopause':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2f59('0x7')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2f59('0x7')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no'),'defaultValue':_0x2f59('0x19')},'announce_holdtime':{'type':Sequelize[_0x2f59('0x7')]('yes','no',_0x2f59('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x2f59('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2f59('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2f59('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2f59('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2f59('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2f59('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x2f59('0x1b')],'set':function(_0x4567f9){this[_0x2f59('0x10')]('periodic_announce',_0x4567f9?_0x4567f9[_0x2f59('0x1c')](','):[]);},'get':function(){return this[_0x2f59('0x12')](_0x2f59('0x1d'))?this[_0x2f59('0x12')](_0x2f59('0x1d'))[_0x2f59('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':_0x2f59('0x19'),'set':function(_0x496a28){this[_0x2f59('0x10')](_0x2f59('0x1f'),_0x496a28?_0x496a28[_0x2f59('0x1c')](','):undefined);},'get':function(){return this[_0x2f59('0x12')](_0x2f59('0x1f'))?this['getDataValue']('joinempty')[_0x2f59('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':'no','set':function(_0x5855b4){this[_0x2f59('0x10')](_0x2f59('0x20'),_0x5855b4?_0x5855b4[_0x2f59('0x1c')](','):undefined);},'get':function(){return this[_0x2f59('0x12')](_0x2f59('0x20'))?this[_0x2f59('0x12')](_0x2f59('0x20'))[_0x2f59('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2f59('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x2f59('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2f59('0x2')]},'description':{'type':Sequelize[_0x2f59('0x2')]},'acw':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':0x0,'set':function(_0x2a5c53){this[_0x2f59('0x10')](_0x2f59('0x22'),_0x2a5c53);if(_0x2a5c53){if(this[_0x2f59('0x12')](_0x2f59('0x23'))<0x2){this[_0x2f59('0x10')](_0x2f59('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2f59('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':0x0,'comment':_0x2f59('0x24')},'dialMethod':{'type':Sequelize[_0x2f59('0x7')](_0x2f59('0x14'),_0x2f59('0x25'),_0x2f59('0x26'),_0x2f59('0x27'),_0x2f59('0x15')),'defaultValue':_0x2f59('0x25'),'comment':_0x2f59('0x28')},'dialLimitChannel':{'type':Sequelize[_0x2f59('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f59('0x29')},'dialLimitQueue':{'type':Sequelize[_0x2f59('0x18')](0x4)[_0x2f59('0x2a')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x2f59('0x2b')](0x2)[_0x2f59('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2f59('0x2c')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x2f59('0x2d'),'dropRate'),'defaultValue':_0x2f59('0x2e'),'comment':_0x2f59('0x2f')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2f59('0x2b')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2f59('0x30')},'dialPredictiveInterval':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2f59('0x31')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2f59('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2f59('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2f59('0x18')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x32')},'dialQueueOptions':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':_0x2f59('0x33'),'comment':_0x2f59('0x34')},'dialQueueTimeout':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x35')},'dialQueueProject':{'type':Sequelize[_0x2f59('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x36')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'comment':_0x2f59('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2f59('0x3a')},'dialTimezone':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2f59('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2f59('0x7')]('always',_0x2f59('0x3b'),_0x2f59('0x3c')),'defaultValue':_0x2f59('0x3d')},'dialAMDActive':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f59('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x2f59('0x18')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2f59('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2f59('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f59('0x41')},'dialAMDMinWordLength':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2f59('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2f59('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2f59('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f59('0x45')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2f59('0x18')](0x9)[_0x2f59('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2f59('0x7')]('DESC','ASC'),'defaultValue':_0x2f59('0x46')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2f59('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2f59('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f59('0x48')},'dialCutDigit':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f59('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f59('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2f59('0x18')](0x5)[_0x2f59('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f59('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x2f59('0x52')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2f59('0x53'),'set':function(_0x53d5a1){if(!_0x53d5a1)this['setDataValue'](_0x2f59('0x54'),null);this['setDataValue'](_0x2f59('0x55'),_0x53d5a1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2f59('0x18')](0x3)[_0x2f59('0x2a')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2f59('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 87c92ea..4daab5a 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(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _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(_0x38da9f,_0xe3d9bb){var _0x384494=function(_0x265884){while(--_0x265884){_0x38da9f['push'](_0x38da9f['shift']());}};_0x384494(++_0xe3d9bb);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 821a8e8..d75b475 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 _0xa462=['save','update','remove','emit','hasOwnProperty','exports','VoiceQueue','setMaxListeners'];(function(_0x3911a0,_0x399077){var _0xf3dd14=function(_0x40561d){while(--_0x40561d){_0x3911a0['push'](_0x3911a0['shift']());}};_0xf3dd14(++_0x399077);}(_0xa462,0xd6));var _0x2a46=function(_0x2b0f18,_0x244f85){_0x2b0f18=_0x2b0f18-0x0;var _0x3569e7=_0xa462[_0x2b0f18];return _0x3569e7;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x2a46('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2a46('0x1')](0x0);var events={'afterCreate':_0x2a46('0x2'),'afterUpdate':_0x2a46('0x3'),'afterDestroy':_0x2a46('0x4')};function emitEvent(_0x96c48b){return function(_0x2575bc,_0xbb43fa,_0x5f7a27){VoiceQueueEvents[_0x2a46('0x5')](_0x96c48b+':'+_0x2575bc['id'],_0x2575bc);VoiceQueueEvents[_0x2a46('0x5')](_0x96c48b,_0x2575bc);_0x5f7a27(null);};}for(var e in events){if(events[_0x2a46('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x2a46('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x05aa=['hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x8e54,_0x30b8dd){var _0x36020f=function(_0x24f242){while(--_0x24f242){_0x8e54['push'](_0x8e54['shift']());}};_0x36020f(++_0x30b8dd);}(_0x05aa,0x106));var _0xa05a=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x05aa[_0x2080a3];return _0x8d7d17;};'use strict';var EventEmitter=require(_0xa05a('0x0'));var VoiceQueue=require(_0xa05a('0x1'))['db'][_0xa05a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa05a('0x3')](0x0);var events={'afterCreate':_0xa05a('0x4'),'afterUpdate':_0xa05a('0x5'),'afterDestroy':_0xa05a('0x6')};function emitEvent(_0x49f6bf){return function(_0x4d4deb,_0x3d8fbe,_0x31d748){VoiceQueueEvents[_0xa05a('0x7')](_0x49f6bf+':'+_0x4d4deb['id'],_0x4d4deb);VoiceQueueEvents[_0xa05a('0x7')](_0x49f6bf,_0x4d4deb);_0x31d748(null);};}for(var e in events){if(events[_0xa05a('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa05a('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fd15131..563bcda 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x3e74,0x175));var _0x43e7=function(_0x39d338,_0x5dc573){_0x39d338=_0x39d338-0x0;var _0x259a1b=_0x3e74[_0x39d338];return _0x259a1b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x55ca,0x126));var _0xa55c=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0x55ca[_0x871ef5];return _0x1f62ea;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e7ccb69..2e028eb 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 _0x0325=['where','attributes','include','map','model','GetVoiceQueue','debug','ShowVoiceQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','request','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','VoiceQueue','findAll','options','raw'];(function(_0x44a3e1,_0x4084b4){var _0x493faa=function(_0x406529){while(--_0x406529){_0x44a3e1['push'](_0x44a3e1['shift']());}};_0x493faa(++_0x4084b4);}(_0x0325,0x167));var _0x5032=function(_0x244184,_0x6ad738){_0x244184=_0x244184-0x0;var _0x555f6d=_0x0325[_0x244184];return _0x555f6d;};'use strict';var _=require(_0x5032('0x0'));var util=require(_0x5032('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5032('0x2'));var fs=require('fs');var Redis=require(_0x5032('0x3'));var db=require(_0x5032('0x4'))['db'];var utils=require(_0x5032('0x5'));var logger=require(_0x5032('0x6'))(_0x5032('0x7'));var config=require(_0x5032('0x8'));var jayson=require(_0x5032('0x9'));var client=jayson[_0x5032('0xa')][_0x5032('0xb')]({'port':0x232a});config[_0x5032('0xc')]=_[_0x5032('0xd')](config[_0x5032('0xc')],{'host':_0x5032('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5032('0xf'))['register'](socket);function respondWithRpcPromise(_0x132b8b,_0x1adbac,_0x3046d6){return new BPromise(function(_0x398dcd,_0xe551e2){return client[_0x5032('0x10')](_0x132b8b,_0x3046d6)['then'](function(_0x53c769){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x1adbac,_0x5032('0x11'));logger['debug'](_0x5032('0x12'),_0x1adbac,_0x5032('0x11'),JSON[_0x5032('0x13')](_0x53c769));if(_0x53c769['error']){if(_0x53c769[_0x5032('0x14')][_0x5032('0x15')]===0x1f4){logger[_0x5032('0x14')](_0x5032('0x16'),_0x1adbac,_0x53c769[_0x5032('0x14')]['message']);return _0xe551e2(_0x53c769[_0x5032('0x14')][_0x5032('0x17')]);}logger[_0x5032('0x14')](_0x5032('0x16'),_0x1adbac,_0x53c769['error'][_0x5032('0x17')]);return _0x398dcd(_0x53c769[_0x5032('0x14')][_0x5032('0x17')]);}else{logger[_0x5032('0x18')](_0x5032('0x16'),_0x1adbac,_0x5032('0x11'));_0x398dcd(_0x53c769[_0x5032('0x19')]['message']);}})[_0x5032('0x1a')](function(_0xb9490e){logger['error'](_0x5032('0x16'),_0x1adbac,_0xb9490e);_0xe551e2(_0xb9490e);});});}exports['GetVoiceQueue']=function(_0x11d532){var _0x55668d=this;return new Promise(function(_0x4b642c,_0x4eb20b){return db[_0x5032('0x1b')][_0x5032('0x1c')]({'raw':_0x11d532[_0x5032('0x1d')]?_0x11d532[_0x5032('0x1d')][_0x5032('0x1e')]===undefined?!![]:![]:!![],'where':_0x11d532[_0x5032('0x1d')]?_0x11d532['options'][_0x5032('0x1f')]||null:null,'attributes':_0x11d532[_0x5032('0x1d')]?_0x11d532[_0x5032('0x1d')][_0x5032('0x20')]||null:null,'limit':_0x11d532[_0x5032('0x1d')]?_0x11d532[_0x5032('0x1d')]['limit']||null:null,'include':_0x11d532[_0x5032('0x1d')]?_0x11d532[_0x5032('0x1d')][_0x5032('0x21')]?_[_0x5032('0x22')](_0x11d532[_0x5032('0x1d')][_0x5032('0x21')],function(_0x2fc82d){return{'model':db[_0x2fc82d[_0x5032('0x23')]],'as':_0x2fc82d['as'],'attributes':_0x2fc82d[_0x5032('0x20')],'include':_0x2fc82d[_0x5032('0x21')]?_[_0x5032('0x22')](_0x2fc82d[_0x5032('0x21')],function(_0x4c3857){return{'model':db[_0x4c3857[_0x5032('0x23')]],'as':_0x4c3857['as'],'attributes':_0x4c3857[_0x5032('0x20')],'include':_0x4c3857[_0x5032('0x21')]?_['map'](_0x4c3857[_0x5032('0x21')],function(_0x325758){return{'model':db[_0x325758['model']],'as':_0x325758['as'],'attributes':_0x325758[_0x5032('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bedb){logger[_0x5032('0x18')](_0x5032('0x24'),_0x11d532);logger[_0x5032('0x25')](_0x5032('0x24'),_0x11d532,JSON[_0x5032('0x13')](_0x18bedb));_0x4b642c(_0x18bedb);})[_0x5032('0x1a')](function(_0x5acb8f){logger[_0x5032('0x14')]('GetVoiceQueue',_0x5acb8f[_0x5032('0x17')],_0x11d532);_0x4eb20b(_0x55668d['error'](0x1f4,_0x5acb8f[_0x5032('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x28cc7b){var _0x3331f0=this;return new Promise(function(_0x37ac9d,_0x887d0){return db[_0x5032('0x1b')]['find']({'raw':_0x28cc7b[_0x5032('0x1d')]?_0x28cc7b[_0x5032('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28cc7b['options']?_0x28cc7b[_0x5032('0x1d')][_0x5032('0x1f')]||null:null,'attributes':_0x28cc7b['options']?_0x28cc7b['options'][_0x5032('0x20')]||null:null,'include':_0x28cc7b['options']?_0x28cc7b[_0x5032('0x1d')][_0x5032('0x21')]?_[_0x5032('0x22')](_0x28cc7b[_0x5032('0x1d')][_0x5032('0x21')],function(_0x3b462e){return{'model':db[_0x3b462e[_0x5032('0x23')]],'as':_0x3b462e['as'],'attributes':_0x3b462e[_0x5032('0x20')],'include':_0x3b462e[_0x5032('0x21')]?_[_0x5032('0x22')](_0x3b462e[_0x5032('0x21')],function(_0x192f2e){return{'model':db[_0x192f2e[_0x5032('0x23')]],'as':_0x192f2e['as'],'attributes':_0x192f2e[_0x5032('0x20')],'include':_0x192f2e[_0x5032('0x21')]?_[_0x5032('0x22')](_0x192f2e[_0x5032('0x21')],function(_0x29ae55){return{'model':db[_0x29ae55[_0x5032('0x23')]],'as':_0x29ae55['as'],'attributes':_0x29ae55[_0x5032('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5423d2){logger['info'](_0x5032('0x26'),_0x28cc7b);logger[_0x5032('0x25')](_0x5032('0x26'),_0x28cc7b,JSON['stringify'](_0x5423d2));_0x37ac9d(_0x5423d2);})[_0x5032('0x1a')](function(_0x5ef610){logger['error'](_0x5032('0x26'),_0x5ef610['message'],_0x28cc7b);_0x887d0(_0x3331f0[_0x5032('0x14')](0x1f4,_0x5ef610[_0x5032('0x17')]));});});}; \ No newline at end of file +var _0x6f7b=['catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','map','include','model','ShowVoiceQueue','find','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueue,\x20%s,\x20%s','message'];(function(_0x5b214a,_0xc69096){var _0x4216b9=function(_0x1e0cd0){while(--_0x1e0cd0){_0x5b214a['push'](_0x5b214a['shift']());}};_0x4216b9(++_0xc69096);}(_0x6f7b,0x135));var _0xb6f7=function(_0xa5e64d,_0x31d8d8){_0xa5e64d=_0xa5e64d-0x0;var _0x4a6b15=_0x6f7b[_0xa5e64d];return _0x4a6b15;};'use strict';var _=require(_0xb6f7('0x0'));var util=require('util');var moment=require(_0xb6f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6f7('0x4'))(_0xb6f7('0x5'));var config=require(_0xb6f7('0x6'));var jayson=require(_0xb6f7('0x7'));var client=jayson[_0xb6f7('0x8')]['http']({'port':0x232a});config[_0xb6f7('0x9')]=_[_0xb6f7('0xa')](config[_0xb6f7('0x9')],{'host':_0xb6f7('0xb'),'port':0x18eb});var socket=require(_0xb6f7('0xc'))(new Redis(config['redis']));require(_0xb6f7('0xd'))['register'](socket);function respondWithRpcPromise(_0x141a58,_0x368fa4,_0x24044d){return new BPromise(function(_0x3a9c54,_0x50e65f){return client[_0xb6f7('0xe')](_0x141a58,_0x24044d)[_0xb6f7('0xf')](function(_0x1d4136){logger[_0xb6f7('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x368fa4,_0xb6f7('0x11'));logger[_0xb6f7('0x12')](_0xb6f7('0x13'),_0x368fa4,_0xb6f7('0x11'),JSON[_0xb6f7('0x14')](_0x1d4136));if(_0x1d4136['error']){if(_0x1d4136[_0xb6f7('0x15')]['code']===0x1f4){logger[_0xb6f7('0x15')](_0xb6f7('0x16'),_0x368fa4,_0x1d4136[_0xb6f7('0x15')][_0xb6f7('0x17')]);return _0x50e65f(_0x1d4136['error'][_0xb6f7('0x17')]);}logger[_0xb6f7('0x15')](_0xb6f7('0x16'),_0x368fa4,_0x1d4136[_0xb6f7('0x15')][_0xb6f7('0x17')]);return _0x3a9c54(_0x1d4136[_0xb6f7('0x15')][_0xb6f7('0x17')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x368fa4,_0xb6f7('0x11'));_0x3a9c54(_0x1d4136['result'][_0xb6f7('0x17')]);}})[_0xb6f7('0x18')](function(_0x13a413){logger[_0xb6f7('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x368fa4,_0x13a413);_0x50e65f(_0x13a413);});});}exports[_0xb6f7('0x19')]=function(_0x35bd2a){var _0x3384e6=this;return new Promise(function(_0x5c2a30,_0x12c6b8){return db[_0xb6f7('0x1a')][_0xb6f7('0x1b')]({'raw':_0x35bd2a[_0xb6f7('0x1c')]?_0x35bd2a['options'][_0xb6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x35bd2a[_0xb6f7('0x1c')]?_0x35bd2a[_0xb6f7('0x1c')][_0xb6f7('0x1e')]||null:null,'attributes':_0x35bd2a[_0xb6f7('0x1c')]?_0x35bd2a[_0xb6f7('0x1c')][_0xb6f7('0x1f')]||null:null,'limit':_0x35bd2a[_0xb6f7('0x1c')]?_0x35bd2a[_0xb6f7('0x1c')]['limit']||null:null,'include':_0x35bd2a[_0xb6f7('0x1c')]?_0x35bd2a[_0xb6f7('0x1c')]['include']?_[_0xb6f7('0x20')](_0x35bd2a[_0xb6f7('0x1c')]['include'],function(_0x4f76d4){return{'model':db[_0x4f76d4['model']],'as':_0x4f76d4['as'],'attributes':_0x4f76d4[_0xb6f7('0x1f')],'include':_0x4f76d4[_0xb6f7('0x21')]?_['map'](_0x4f76d4[_0xb6f7('0x21')],function(_0x575198){return{'model':db[_0x575198['model']],'as':_0x575198['as'],'attributes':_0x575198['attributes'],'include':_0x575198[_0xb6f7('0x21')]?_[_0xb6f7('0x20')](_0x575198[_0xb6f7('0x21')],function(_0x6597cd){return{'model':db[_0x6597cd[_0xb6f7('0x22')]],'as':_0x6597cd['as'],'attributes':_0x6597cd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x67b7d2){logger[_0xb6f7('0x10')]('GetVoiceQueue',_0x35bd2a);logger[_0xb6f7('0x12')](_0xb6f7('0x19'),_0x35bd2a,JSON[_0xb6f7('0x14')](_0x67b7d2));_0x5c2a30(_0x67b7d2);})['catch'](function(_0x3b11a7){logger[_0xb6f7('0x15')]('GetVoiceQueue',_0x3b11a7[_0xb6f7('0x17')],_0x35bd2a);_0x12c6b8(_0x3384e6[_0xb6f7('0x15')](0x1f4,_0x3b11a7[_0xb6f7('0x17')]));});});};exports[_0xb6f7('0x23')]=function(_0x3bf342){var _0x14ace7=this;return new Promise(function(_0x14694a,_0x307e1e){return db[_0xb6f7('0x1a')][_0xb6f7('0x24')]({'raw':_0x3bf342['options']?_0x3bf342[_0xb6f7('0x1c')][_0xb6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3bf342[_0xb6f7('0x1c')]?_0x3bf342['options']['where']||null:null,'attributes':_0x3bf342[_0xb6f7('0x1c')]?_0x3bf342[_0xb6f7('0x1c')][_0xb6f7('0x1f')]||null:null,'include':_0x3bf342[_0xb6f7('0x1c')]?_0x3bf342['options'][_0xb6f7('0x21')]?_[_0xb6f7('0x20')](_0x3bf342['options'][_0xb6f7('0x21')],function(_0x14d710){return{'model':db[_0x14d710[_0xb6f7('0x22')]],'as':_0x14d710['as'],'attributes':_0x14d710[_0xb6f7('0x1f')],'include':_0x14d710['include']?_['map'](_0x14d710[_0xb6f7('0x21')],function(_0x25d674){return{'model':db[_0x25d674[_0xb6f7('0x22')]],'as':_0x25d674['as'],'attributes':_0x25d674[_0xb6f7('0x1f')],'include':_0x25d674[_0xb6f7('0x21')]?_[_0xb6f7('0x20')](_0x25d674['include'],function(_0x2588d3){return{'model':db[_0x2588d3[_0xb6f7('0x22')]],'as':_0x2588d3['as'],'attributes':_0x2588d3[_0xb6f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb6f7('0xf')](function(_0x4775c9){logger[_0xb6f7('0x10')](_0xb6f7('0x23'),_0x3bf342);logger[_0xb6f7('0x12')]('ShowVoiceQueue',_0x3bf342,JSON[_0xb6f7('0x14')](_0x4775c9));_0x14694a(_0x4775c9);})['catch'](function(_0x56d99f){logger[_0xb6f7('0x15')]('ShowVoiceQueue',_0x56d99f[_0xb6f7('0x17')],_0x3bf342);_0x307e1e(_0x14ace7[_0xb6f7('0x15')](0x1f4,_0x56d99f[_0xb6f7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7215e27..6ce6e39 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 _0x22ca=['remove','update','emit','length','voiceQueue:','save'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x22ca,0x179));var _0xa22c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x22ca[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa22c('0x0'),_0xa22c('0x1'),_0xa22c('0x2')];function createListener(_0x2d01ad,_0x39792c){return function(_0x1cd48b){_0x39792c[_0xa22c('0x3')](_0x2d01ad,_0x1cd48b);};}function removeListener(_0x4faabc,_0x2321c4){return function(){VoiceQueueEvents['removeListener'](_0x4faabc,_0x2321c4);};}exports['register']=function(_0x572523){for(var _0x45c95d=0x0,_0x40c5a0=events[_0xa22c('0x4')];_0x45c95d<_0x40c5a0;_0x45c95d++){var _0x5a9819=events[_0x45c95d];var _0x1fbbe6=createListener(_0xa22c('0x5')+_0x5a9819,_0x572523);VoiceQueueEvents['on'](_0x5a9819,_0x1fbbe6);}}; \ No newline at end of file +var _0x883e=['length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x192113,_0x31c040){var _0x5df563=function(_0x23e120){while(--_0x23e120){_0x192113['push'](_0x192113['shift']());}};_0x5df563(++_0x31c040);}(_0x883e,0x1a6));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xe883('0x0'),_0xe883('0x1'),_0xe883('0x2')];function createListener(_0x32825c,_0x5dc720){return function(_0x243fea){_0x5dc720[_0xe883('0x3')](_0x32825c,_0x243fea);};}function removeListener(_0x3c8fbc,_0x4fc91f){return function(){VoiceQueueEvents[_0xe883('0x4')](_0x3c8fbc,_0x4fc91f);};}exports['register']=function(_0x551cba){for(var _0x3eeff0=0x0,_0x3a0f5f=events[_0xe883('0x5')];_0x3eeff0<_0x3a0f5f;_0x3eeff0++){var _0x3e1b6f=events[_0x3eeff0];var _0x5018c7=createListener(_0xe883('0x6')+_0x3e1b6f,_0x551cba);VoiceQueueEvents['on'](_0x3e1b6f,_0x5018c7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4fb3810..760efb8 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 _0x8177=['post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','getVoiceQueuesReport','show'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x8177,0x16f));var _0x7817=function(_0xbef6c4,_0x413772){_0xbef6c4=_0xbef6c4-0x0;var _0x26c3e7=_0x8177[_0xbef6c4];return _0x26c3e7;};'use strict';var multer=require('multer');var util=require(_0x7817('0x0'));var path=require(_0x7817('0x1'));var timeout=require(_0x7817('0x2'));var express=require(_0x7817('0x3'));var router=express[_0x7817('0x4')]();var fs_extra=require(_0x7817('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7817('0x6'));var config=require(_0x7817('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x7817('0x8')](),controller['index']);router['get'](_0x7817('0x9'),auth['isAuthenticated'](),controller[_0x7817('0xa')]);router['get']('/index',auth['isAuthenticated'](),controller[_0x7817('0xb')]);router['get']('/:id',auth[_0x7817('0x8')](),controller[_0x7817('0xc')]);router[_0x7817('0xd')]('/',auth[_0x7817('0x8')](),controller[_0x7817('0xe')]);router[_0x7817('0xf')]('/:id',auth[_0x7817('0x8')](),controller[_0x7817('0x10')]);router['delete']('/:id',auth[_0x7817('0x8')](),controller[_0x7817('0x11')]);module[_0x7817('0x12')]=router; \ No newline at end of file +var _0x06b1=['show','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x62c0ec,_0x1005b9){var _0x54a7b8=function(_0x2428b9){while(--_0x2428b9){_0x62c0ec['push'](_0x62c0ec['shift']());}};_0x54a7b8(++_0x1005b9);}(_0x06b1,0x78));var _0x106b=function(_0x52d5c8,_0x3e4f41){_0x52d5c8=_0x52d5c8-0x0;var _0x398237=_0x06b1[_0x52d5c8];return _0x398237;};'use strict';var multer=require('multer');var util=require(_0x106b('0x0'));var path=require(_0x106b('0x1'));var timeout=require('connect-timeout');var express=require(_0x106b('0x2'));var router=express[_0x106b('0x3')]();var fs_extra=require(_0x106b('0x4'));var auth=require(_0x106b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x106b('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x106b('0x7')]('/',auth[_0x106b('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x106b('0x9')]);router['get'](_0x106b('0xa'),auth['isAuthenticated'](),controller[_0x106b('0xb')]);router[_0x106b('0x7')](_0x106b('0xc'),auth['isAuthenticated'](),controller[_0x106b('0xd')]);router['post']('/',auth[_0x106b('0x8')](),controller[_0x106b('0xe')]);router[_0x106b('0xf')](_0x106b('0xc'),auth[_0x106b('0x8')](),controller[_0x106b('0x10')]);router['delete'](_0x106b('0xc'),auth[_0x106b('0x8')](),controller[_0x106b('0x11')]);module[_0x106b('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 993e1f1..2d95ff4 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 _0xb23e=['STRING','DATE','queuecallerjoinAt','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb23e,0x1b9));var _0xeb23=function(_0x4f4283,_0x103425){_0x4f4283=_0x4f4283-0x0;var _0x3f356f=_0xb23e[_0x4f4283];return _0x3f356f;};'use strict';var Sequelize=require(_0xeb23('0x0'));var moment=require(_0xeb23('0x1'));module[_0xeb23('0x2')]={'type':{'type':Sequelize[_0xeb23('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xeb23('0x3')]},'calleridname':{'type':Sequelize[_0xeb23('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xeb23('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xeb23('0x4')],'set':function(_0x38a18a){var _0x3179e8=moment(_0x38a18a);var _0x3794f3=moment(this['getDataValue'](_0xeb23('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5ba6fe=_0x3179e8['diff'](_0x3794f3,_0xeb23('0x6'));this[_0xeb23('0x7')](_0xeb23('0x8'),_0x38a18a);this[_0xeb23('0x7')]('holdtime',_0x5ba6fe||null);}},'position':{'type':Sequelize[_0xeb23('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xeb23('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xeb23('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xeb23('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xeb23('0x4')]},'queuecallerexit':{'type':Sequelize[_0xeb23('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xeb23('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xeb23('0x9')]},'channel':{'type':Sequelize[_0xeb23('0x3')]},'connectedlinenum':{'type':Sequelize[_0xeb23('0x3')]},'connectedlinename':{'type':Sequelize[_0xeb23('0x3')]},'accountcode':{'type':Sequelize[_0xeb23('0x3')]},'context':{'type':Sequelize[_0xeb23('0x3')]},'exten':{'type':Sequelize[_0xeb23('0x3')]},'priority':{'type':Sequelize[_0xeb23('0x3')]},'holdtime':{'type':Sequelize[_0xeb23('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb23('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xeb23('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xeb23('0xb')},'transferexten':{'type':Sequelize[_0xeb23('0x3')]},'transferuniqueid':{'type':Sequelize[_0xeb23('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xeb23('0x3')]},'thirdDisposition':{'type':Sequelize[_0xeb23('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xeb23('0x3')]}}; \ No newline at end of file +var _0x353c=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue'];(function(_0x54a565,_0x1e9a5a){var _0x1053b8=function(_0x5df191){while(--_0x5df191){_0x54a565['push'](_0x54a565['shift']());}};_0x1053b8(++_0x1e9a5a);}(_0x353c,0xc8));var _0xc353=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x353c[_0x4f6d08];return _0x53a9c6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc353('0x0')]},'calleridnum':{'type':Sequelize[_0xc353('0x0')]},'calleridname':{'type':Sequelize[_0xc353('0x0')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xc353('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0xc353('0x1')],'set':function(_0x5a52dc){var _0x58c39f=moment(_0x5a52dc);var _0x4204a5=moment(this[_0xc353('0x2')](_0xc353('0x3')))[_0xc353('0x4')](_0xc353('0x5'));var _0x5f3bf0=_0x58c39f[_0xc353('0x6')](_0x4204a5,_0xc353('0x7'));this['setDataValue'](_0xc353('0x8'),_0x5a52dc);this[_0xc353('0x9')](_0xc353('0xa'),_0x5f3bf0||null);}},'position':{'type':Sequelize[_0xc353('0xb')]},'count':{'type':Sequelize[_0xc353('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xc353('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc353('0x1')]},'queuecallercomplete':{'type':Sequelize[_0xc353('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc353('0x1')]},'queuecallerexit':{'type':Sequelize[_0xc353('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc353('0x1')]},'queuecallerexitreason':{'type':Sequelize[_0xc353('0x0')],'comment':_0xc353('0xd')},'originalposition':{'type':Sequelize[_0xc353('0xb')]},'channel':{'type':Sequelize[_0xc353('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc353('0x0')]},'connectedlinename':{'type':Sequelize[_0xc353('0x0')]},'accountcode':{'type':Sequelize[_0xc353('0x0')]},'context':{'type':Sequelize[_0xc353('0x0')]},'exten':{'type':Sequelize[_0xc353('0x0')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xc353('0xb')]},'mohtime':{'type':Sequelize[_0xc353('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc353('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc353('0x0')]},'transfer':{'type':Sequelize[_0xc353('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc353('0x0')],'comment':_0xc353('0xe')},'transferexten':{'type':Sequelize[_0xc353('0x0')]},'transferuniqueid':{'type':Sequelize[_0xc353('0x0')]},'disposition':{'type':Sequelize[_0xc353('0x0')]},'secondDisposition':{'type':Sequelize[_0xc353('0x0')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xc353('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 7380720..2265962 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 _0x7152=['register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getVoiceQueuesReport','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x7152,0x8a));var _0x2715=function(_0x498c78,_0x2eab48){_0x498c78=_0x498c78-0x0;var _0xb7697f=_0x7152[_0x498c78];return _0xb7697f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2715('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2715('0x1'));var rp=require(_0x2715('0x2'));var moment=require(_0x2715('0x3'));var BPromise=require(_0x2715('0x4'));var Mustache=require(_0x2715('0x5'));var util=require('util');var path=require(_0x2715('0x6'));var sox=require(_0x2715('0x7'));var csv=require(_0x2715('0x8'));var ejs=require(_0x2715('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2715('0xa'));var squel=require(_0x2715('0xb'));var crypto=require(_0x2715('0xc'));var jsforce=require(_0x2715('0xd'));var deskjs=require(_0x2715('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2715('0xf'));var authService=require(_0x2715('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2715('0x11'));var hardwareService=require(_0x2715('0x12'));var logger=require(_0x2715('0x13'))(_0x2715('0x14'));var utils=require(_0x2715('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2715('0x16'));var db=require('../../mysqldb')['db'];config[_0x2715('0x17')]=_[_0x2715('0x18')](config[_0x2715('0x17')],{'host':_0x2715('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2715('0x17')]));require('./voiceQueueReport.socket')[_0x2715('0x1a')](socket);function respondWithStatusCode(_0xa76097,_0x205194){_0x205194=_0x205194||0xcc;return function(_0x4c4f0a){if(_0x4c4f0a){return _0xa76097[_0x2715('0x1b')](_0x205194);}return _0xa76097['status'](_0x205194)['end']();};}function respondWithResult(_0x25fd99,_0x4634da){_0x4634da=_0x4634da||0xc8;return function(_0xff9968){if(_0xff9968){return _0x25fd99[_0x2715('0x1c')](_0x4634da)[_0x2715('0x1d')](_0xff9968);}};}function respondWithFilteredResult(_0x5f19b8,_0x4f934b){return function(_0x921ef5){if(_0x921ef5){var _0xade852=typeof _0x4f934b[_0x2715('0x1e')]===_0x2715('0x1f')&&typeof _0x4f934b['limit']===_0x2715('0x1f');var _0xc80cc=_0x921ef5[_0x2715('0x20')];var _0x5c40f7=_0xade852?0x0:_0x4f934b[_0x2715('0x1e')];var _0xa61281=_0xade852?_0x921ef5[_0x2715('0x20')]:_0x4f934b[_0x2715('0x1e')]+_0x4f934b[_0x2715('0x21')];var _0x38683d;if(_0xa61281>=_0xc80cc){_0xa61281=_0xc80cc;_0x38683d=0xc8;}else{_0x38683d=0xce;}_0x5f19b8[_0x2715('0x1c')](_0x38683d);return _0x5f19b8[_0x2715('0x22')](_0x2715('0x23'),_0x5c40f7+'-'+_0xa61281+'/'+_0xc80cc)[_0x2715('0x1d')](_0x921ef5);}return null;};}function patchUpdates(_0x3737a9){return function(_0x1eef92){try{jsonpatch[_0x2715('0x24')](_0x1eef92,_0x3737a9,!![]);}catch(_0x2e734b){return BPromise['reject'](_0x2e734b);}return _0x1eef92[_0x2715('0x25')]();};}function saveUpdates(_0x592716,_0x3a0550){return function(_0x262bb1){if(_0x262bb1){return _0x262bb1[_0x2715('0x26')](_0x592716)['then'](function(_0x4cde6f){return _0x4cde6f;});}return null;};}function removeEntity(_0x3ffb35,_0x1ee953){return function(_0x21d606){if(_0x21d606){return _0x21d606[_0x2715('0x27')]()[_0x2715('0x28')](function(){_0x3ffb35[_0x2715('0x1c')](0xcc)[_0x2715('0x29')]();});}};}function handleEntityNotFound(_0x3e7088,_0x1f6971){return function(_0x5de12e){if(!_0x5de12e){_0x3e7088[_0x2715('0x1b')](0x194);}return _0x5de12e;};}function handleError(_0x33a146,_0x2cc17e){_0x2cc17e=_0x2cc17e||0x1f4;return function(_0x19b998){logger[_0x2715('0x2a')](_0x19b998[_0x2715('0x2b')]);if(_0x19b998[_0x2715('0x2c')]){delete _0x19b998[_0x2715('0x2c')];}_0x33a146[_0x2715('0x1c')](_0x2cc17e)[_0x2715('0x2d')](_0x19b998);};}exports[_0x2715('0x2e')]=function(_0x2567d5,_0x4d744e){var _0x42e5af={},_0x38191a={},_0x49df57={'count':0x0,'rows':[]};var _0x32bcf1=_[_0x2715('0x2f')](db[_0x2715('0x30')][_0x2715('0x31')],function(_0x8dc71b){return{'name':_0x8dc71b[_0x2715('0x32')],'type':_0x8dc71b[_0x2715('0x33')][_0x2715('0x34')]};});_0x38191a[_0x2715('0x35')]=_['map'](_0x32bcf1,_0x2715('0x2c'));_0x38191a['query']=_[_0x2715('0x36')](_0x2567d5['query']);_0x38191a[_0x2715('0x37')]=_[_0x2715('0x38')](_0x38191a['model'],_0x38191a[_0x2715('0x39')]);_0x42e5af[_0x2715('0x3a')]=_['intersection'](_0x38191a['model'],qs[_0x2715('0x3b')](_0x2567d5['query'][_0x2715('0x3b')]));_0x42e5af['attributes']=_0x42e5af['attributes'][_0x2715('0x3c')]?_0x42e5af[_0x2715('0x3a')]:_0x38191a[_0x2715('0x35')];if(!_0x2567d5['query']['hasOwnProperty'](_0x2715('0x3d'))){_0x42e5af[_0x2715('0x21')]=qs[_0x2715('0x21')](_0x2567d5[_0x2715('0x39')][_0x2715('0x21')]);_0x42e5af['offset']=qs['offset'](_0x2567d5['query'][_0x2715('0x1e')]);}_0x42e5af[_0x2715('0x3e')]=qs['sort'](_0x2567d5[_0x2715('0x39')][_0x2715('0x3f')]);_0x42e5af[_0x2715('0x40')]=qs[_0x2715('0x37')](_[_0x2715('0x41')](_0x2567d5[_0x2715('0x39')],_0x38191a[_0x2715('0x37')]),_0x32bcf1);if(_0x2567d5[_0x2715('0x39')][_0x2715('0x42')]){_0x42e5af[_0x2715('0x40')]=_['merge'](_0x42e5af[_0x2715('0x40')],{'$or':_[_0x2715('0x2f')](_0x32bcf1,function(_0x3339d6){if(_0x3339d6[_0x2715('0x33')]!==_0x2715('0x43')){var _0x1ed730={};_0x1ed730[_0x3339d6['name']]={'$like':'%'+_0x2567d5['query']['filter']+'%'};return _0x1ed730;}})});}_0x42e5af=_[_0x2715('0x44')]({},_0x42e5af,_0x2567d5[_0x2715('0x45')]);var _0x336506={'where':_0x42e5af['where']};return db[_0x2715('0x30')][_0x2715('0x20')](_0x336506)['then'](function(_0x47f325){_0x49df57[_0x2715('0x20')]=_0x47f325;if(_0x2567d5[_0x2715('0x39')]['includeAll']){_0x42e5af[_0x2715('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x2715('0x47')](_0x42e5af);})[_0x2715('0x28')](function(_0xd361fc){_0x49df57[_0x2715('0x48')]=_0xd361fc;return _0x49df57;})[_0x2715('0x28')](respondWithFilteredResult(_0x4d744e,_0x42e5af))[_0x2715('0x49')](handleError(_0x4d744e,null));};exports[_0x2715('0x4a')]=function(_0x173d06,_0x5de318){var _0x4cf9b1={'raw':![],'where':{'id':_0x173d06[_0x2715('0x4b')]['id']}},_0x56f323={};_0x56f323[_0x2715('0x35')]=_[_0x2715('0x36')](db[_0x2715('0x30')][_0x2715('0x31')]);_0x56f323['query']=_[_0x2715('0x36')](_0x173d06[_0x2715('0x39')]);_0x56f323[_0x2715('0x37')]=_['intersection'](_0x56f323[_0x2715('0x35')],_0x56f323[_0x2715('0x39')]);_0x4cf9b1[_0x2715('0x3a')]=_[_0x2715('0x38')](_0x56f323[_0x2715('0x35')],qs[_0x2715('0x3b')](_0x173d06[_0x2715('0x39')]['fields']));_0x4cf9b1[_0x2715('0x3a')]=_0x4cf9b1['attributes']['length']?_0x4cf9b1[_0x2715('0x3a')]:_0x56f323[_0x2715('0x35')];if(_0x173d06[_0x2715('0x39')][_0x2715('0x4c')]){_0x4cf9b1['include']=[{'all':!![]}];}_0x4cf9b1=_[_0x2715('0x44')]({},_0x4cf9b1,_0x173d06[_0x2715('0x45')]);return db[_0x2715('0x30')][_0x2715('0x4d')](_0x4cf9b1)[_0x2715('0x28')](handleEntityNotFound(_0x5de318,null))[_0x2715('0x28')](respondWithResult(_0x5de318,null))[_0x2715('0x49')](handleError(_0x5de318,null));};exports[_0x2715('0x4e')]=function(_0x234934,_0x29039b){return db[_0x2715('0x30')][_0x2715('0x4e')](_0x234934[_0x2715('0x4f')],{})[_0x2715('0x28')](respondWithResult(_0x29039b,0xc9))['catch'](handleError(_0x29039b,null));};exports[_0x2715('0x26')]=function(_0xbf0c89,_0x2d982e){if(_0xbf0c89[_0x2715('0x4f')]['id']){delete _0xbf0c89[_0x2715('0x4f')]['id'];}return db[_0x2715('0x30')][_0x2715('0x4d')]({'where':{'id':_0xbf0c89['params']['id']}})[_0x2715('0x28')](handleEntityNotFound(_0x2d982e,null))[_0x2715('0x28')](saveUpdates(_0xbf0c89[_0x2715('0x4f')],null))[_0x2715('0x28')](respondWithResult(_0x2d982e,null))['catch'](handleError(_0x2d982e,null));};exports[_0x2715('0x27')]=function(_0x261702,_0x48f11d){return db[_0x2715('0x30')][_0x2715('0x4d')]({'where':{'id':_0x261702[_0x2715('0x4b')]['id']}})[_0x2715('0x28')](handleEntityNotFound(_0x48f11d,null))['then'](removeEntity(_0x48f11d,null))[_0x2715('0x49')](handleError(_0x48f11d,null));};exports['describe']=function(_0xe9e5c4,_0x562cdd){return db[_0x2715('0x30')]['describe']()[_0x2715('0x28')](respondWithResult(_0x562cdd,null))[_0x2715('0x49')](handleError(_0x562cdd,null));};exports[_0x2715('0x50')]=function(_0x291439,_0x5e53c9){var _0x1d347c={},_0x43707e={},_0x42a837={'count':0x0,'rows':[]};_0x43707e[_0x2715('0x35')]=_[_0x2715('0x36')](db[_0x2715('0x30')][_0x2715('0x31')]);_0x43707e['query']=_[_0x2715('0x36')](_0x291439['query']);_0x43707e[_0x2715('0x37')]=_[_0x2715('0x38')](_0x43707e[_0x2715('0x35')],_0x43707e[_0x2715('0x39')]);_0x1d347c['attributes']=_[_0x2715('0x38')](_0x43707e[_0x2715('0x35')],qs[_0x2715('0x3b')](_0x291439[_0x2715('0x39')]['fields']));_0x1d347c['attributes']=_0x1d347c[_0x2715('0x3a')][_0x2715('0x3c')]?_0x1d347c[_0x2715('0x3a')]:_0x43707e[_0x2715('0x35')];if(!_0x291439['query'][_0x2715('0x51')](_0x2715('0x3d'))){_0x1d347c[_0x2715('0x21')]=qs[_0x2715('0x21')](_0x291439['query'][_0x2715('0x21')]);_0x1d347c['offset']=qs['offset'](_0x291439[_0x2715('0x39')][_0x2715('0x1e')]);}_0x1d347c[_0x2715('0x3e')]=qs[_0x2715('0x3f')](_0x291439['query'][_0x2715('0x3f')]);_0x1d347c[_0x2715('0x40')]=qs[_0x2715('0x37')](_['pick'](_0x291439[_0x2715('0x39')],_0x43707e['filters']));if(_0x291439[_0x2715('0x39')][_0x2715('0x42')]){_0x1d347c['where']=_['merge'](_0x1d347c[_0x2715('0x40')],{'$or':_[_0x2715('0x2f')](_0x1d347c[_0x2715('0x3a')],function(_0x4c764a){var _0x33bec3={};_0x33bec3[_0x4c764a]={'$like':'%'+_0x291439['query']['filter']+'%'};return _0x33bec3;})});}_0x1d347c=_[_0x2715('0x44')]({},_0x1d347c,_0x291439[_0x2715('0x45')]);var _0x572fd5={'where':_0x1d347c[_0x2715('0x40')]};return db['VoiceQueueReport'][_0x2715('0x20')](_0x572fd5)[_0x2715('0x28')](function(_0x46bf1c){_0x42a837['count']=_0x46bf1c;if(_0x291439['query']['includeAll']){_0x1d347c[_0x2715('0x46')]=[{'all':!![]}];}return db[_0x2715('0x30')][_0x2715('0x47')](_0x1d347c);})['then'](function(_0x38ebcb){_0x42a837[_0x2715('0x48')]=_0x38ebcb;return _0x42a837;})[_0x2715('0x28')](respondWithFilteredResult(_0x5e53c9,_0x1d347c,'getVoiceQueuesReport'))[_0x2715('0x49')](handleError(_0x5e53c9,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x4a56=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','describe','getVoiceQueuesReport','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','rawAttributes'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0x4a56,0x17d));var _0x64a5=function(_0xcb749e,_0xaf4b68){_0xcb749e=_0xcb749e-0x0;var _0x218026=_0x4a56[_0xcb749e];return _0x218026;};'use strict';var emlformat=require(_0x64a5('0x0'));var rimraf=require(_0x64a5('0x1'));var zipdir=require(_0x64a5('0x2'));var jsonpatch=require(_0x64a5('0x3'));var rp=require('request-promise');var moment=require(_0x64a5('0x4'));var BPromise=require(_0x64a5('0x5'));var Mustache=require(_0x64a5('0x6'));var util=require(_0x64a5('0x7'));var path=require(_0x64a5('0x8'));var sox=require(_0x64a5('0x9'));var csv=require(_0x64a5('0xa'));var ejs=require(_0x64a5('0xb'));var fs=require('fs');var fs_extra=require(_0x64a5('0xc'));var _=require(_0x64a5('0xd'));var squel=require(_0x64a5('0xe'));var crypto=require(_0x64a5('0xf'));var jsforce=require(_0x64a5('0x10'));var deskjs=require(_0x64a5('0x11'));var toCsv=require(_0x64a5('0xa'));var querystring=require(_0x64a5('0x12'));var Papa=require(_0x64a5('0x13'));var Redis=require(_0x64a5('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x64a5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64a5('0x16'));var logger=require(_0x64a5('0x17'))(_0x64a5('0x18'));var utils=require(_0x64a5('0x19'));var config=require(_0x64a5('0x1a'));var licenseUtil=require(_0x64a5('0x1b'));var db=require(_0x64a5('0x1c'))['db'];config[_0x64a5('0x1d')]=_[_0x64a5('0x1e')](config[_0x64a5('0x1d')],{'host':_0x64a5('0x1f'),'port':0x18eb});var socket=require(_0x64a5('0x20'))(new Redis(config[_0x64a5('0x1d')]));require(_0x64a5('0x21'))[_0x64a5('0x22')](socket);function respondWithStatusCode(_0x19c98b,_0x28c868){_0x28c868=_0x28c868||0xcc;return function(_0x2241d0){if(_0x2241d0){return _0x19c98b[_0x64a5('0x23')](_0x28c868);}return _0x19c98b[_0x64a5('0x24')](_0x28c868)[_0x64a5('0x25')]();};}function respondWithResult(_0x102fee,_0x2806e8){_0x2806e8=_0x2806e8||0xc8;return function(_0x3be069){if(_0x3be069){return _0x102fee['status'](_0x2806e8)[_0x64a5('0x26')](_0x3be069);}};}function respondWithFilteredResult(_0x1f26d5,_0x4f4688){return function(_0xa65915){if(_0xa65915){var _0xc2a854=typeof _0x4f4688[_0x64a5('0x27')]==='undefined'&&typeof _0x4f4688[_0x64a5('0x28')]==='undefined';var _0x430678=_0xa65915[_0x64a5('0x29')];var _0x5f50d6=_0xc2a854?0x0:_0x4f4688['offset'];var _0x97c081=_0xc2a854?_0xa65915[_0x64a5('0x29')]:_0x4f4688[_0x64a5('0x27')]+_0x4f4688['limit'];var _0xfd8e29;if(_0x97c081>=_0x430678){_0x97c081=_0x430678;_0xfd8e29=0xc8;}else{_0xfd8e29=0xce;}_0x1f26d5['status'](_0xfd8e29);return _0x1f26d5[_0x64a5('0x2a')](_0x64a5('0x2b'),_0x5f50d6+'-'+_0x97c081+'/'+_0x430678)[_0x64a5('0x26')](_0xa65915);}return null;};}function patchUpdates(_0x1ee36f){return function(_0x7d0369){try{jsonpatch[_0x64a5('0x2c')](_0x7d0369,_0x1ee36f,!![]);}catch(_0x2f1805){return BPromise[_0x64a5('0x2d')](_0x2f1805);}return _0x7d0369[_0x64a5('0x2e')]();};}function saveUpdates(_0x3efdd0,_0x19c0be){return function(_0xd19de1){if(_0xd19de1){return _0xd19de1['update'](_0x3efdd0)['then'](function(_0x34e90a){return _0x34e90a;});}return null;};}function removeEntity(_0x2f8509,_0x22c71b){return function(_0x3b0f72){if(_0x3b0f72){return _0x3b0f72[_0x64a5('0x2f')]()[_0x64a5('0x30')](function(){_0x2f8509[_0x64a5('0x24')](0xcc)[_0x64a5('0x25')]();});}};}function handleEntityNotFound(_0x4210ba,_0x2fc57a){return function(_0x46d4ea){if(!_0x46d4ea){_0x4210ba[_0x64a5('0x23')](0x194);}return _0x46d4ea;};}function handleError(_0x37f4dd,_0x26ca6e){_0x26ca6e=_0x26ca6e||0x1f4;return function(_0x9ef9f8){logger['error'](_0x9ef9f8[_0x64a5('0x31')]);if(_0x9ef9f8['name']){delete _0x9ef9f8[_0x64a5('0x32')];}_0x37f4dd['status'](_0x26ca6e)['send'](_0x9ef9f8);};}exports[_0x64a5('0x33')]=function(_0xc277fd,_0x2da54d){var _0x14d229={},_0x448a2b={},_0x446cb9={'count':0x0,'rows':[]};var _0x24aeab=_[_0x64a5('0x34')](db['VoiceQueueReport'][_0x64a5('0x35')],function(_0x38ab14){return{'name':_0x38ab14['fieldName'],'type':_0x38ab14['type']['key']};});_0x448a2b[_0x64a5('0x36')]=_['map'](_0x24aeab,_0x64a5('0x32'));_0x448a2b[_0x64a5('0x37')]=_[_0x64a5('0x38')](_0xc277fd[_0x64a5('0x37')]);_0x448a2b[_0x64a5('0x39')]=_[_0x64a5('0x3a')](_0x448a2b[_0x64a5('0x36')],_0x448a2b['query']);_0x14d229[_0x64a5('0x3b')]=_[_0x64a5('0x3a')](_0x448a2b['model'],qs[_0x64a5('0x3c')](_0xc277fd[_0x64a5('0x37')][_0x64a5('0x3c')]));_0x14d229['attributes']=_0x14d229[_0x64a5('0x3b')][_0x64a5('0x3d')]?_0x14d229[_0x64a5('0x3b')]:_0x448a2b[_0x64a5('0x36')];if(!_0xc277fd[_0x64a5('0x37')][_0x64a5('0x3e')](_0x64a5('0x3f'))){_0x14d229[_0x64a5('0x28')]=qs[_0x64a5('0x28')](_0xc277fd[_0x64a5('0x37')][_0x64a5('0x28')]);_0x14d229[_0x64a5('0x27')]=qs[_0x64a5('0x27')](_0xc277fd[_0x64a5('0x37')][_0x64a5('0x27')]);}_0x14d229[_0x64a5('0x40')]=qs[_0x64a5('0x41')](_0xc277fd[_0x64a5('0x37')][_0x64a5('0x41')]);_0x14d229[_0x64a5('0x42')]=qs['filters'](_[_0x64a5('0x43')](_0xc277fd[_0x64a5('0x37')],_0x448a2b[_0x64a5('0x39')]),_0x24aeab);if(_0xc277fd[_0x64a5('0x37')][_0x64a5('0x44')]){_0x14d229['where']=_[_0x64a5('0x45')](_0x14d229['where'],{'$or':_[_0x64a5('0x34')](_0x24aeab,function(_0x5ac7af){if(_0x5ac7af[_0x64a5('0x46')]!==_0x64a5('0x47')){var _0x1c7404={};_0x1c7404[_0x5ac7af[_0x64a5('0x32')]]={'$like':'%'+_0xc277fd[_0x64a5('0x37')]['filter']+'%'};return _0x1c7404;}})});}_0x14d229=_[_0x64a5('0x45')]({},_0x14d229,_0xc277fd['options']);var _0x556c1d={'where':_0x14d229[_0x64a5('0x42')]};return db[_0x64a5('0x48')][_0x64a5('0x29')](_0x556c1d)['then'](function(_0x51afb3){_0x446cb9[_0x64a5('0x29')]=_0x51afb3;if(_0xc277fd[_0x64a5('0x37')][_0x64a5('0x49')]){_0x14d229[_0x64a5('0x4a')]=[{'all':!![]}];}return db[_0x64a5('0x48')][_0x64a5('0x4b')](_0x14d229);})[_0x64a5('0x30')](function(_0xb11903){_0x446cb9[_0x64a5('0x4c')]=_0xb11903;return _0x446cb9;})[_0x64a5('0x30')](respondWithFilteredResult(_0x2da54d,_0x14d229))[_0x64a5('0x4d')](handleError(_0x2da54d,null));};exports[_0x64a5('0x4e')]=function(_0x16046c,_0x4bd44f){var _0x284514={'raw':![],'where':{'id':_0x16046c[_0x64a5('0x4f')]['id']}},_0x2923b7={};_0x2923b7[_0x64a5('0x36')]=_[_0x64a5('0x38')](db[_0x64a5('0x48')][_0x64a5('0x35')]);_0x2923b7['query']=_[_0x64a5('0x38')](_0x16046c[_0x64a5('0x37')]);_0x2923b7['filters']=_[_0x64a5('0x3a')](_0x2923b7[_0x64a5('0x36')],_0x2923b7['query']);_0x284514[_0x64a5('0x3b')]=_[_0x64a5('0x3a')](_0x2923b7['model'],qs['fields'](_0x16046c[_0x64a5('0x37')][_0x64a5('0x3c')]));_0x284514[_0x64a5('0x3b')]=_0x284514[_0x64a5('0x3b')]['length']?_0x284514[_0x64a5('0x3b')]:_0x2923b7[_0x64a5('0x36')];if(_0x16046c[_0x64a5('0x37')]['includeAll']){_0x284514['include']=[{'all':!![]}];}_0x284514=_[_0x64a5('0x45')]({},_0x284514,_0x16046c[_0x64a5('0x50')]);return db[_0x64a5('0x48')]['find'](_0x284514)[_0x64a5('0x30')](handleEntityNotFound(_0x4bd44f,null))[_0x64a5('0x30')](respondWithResult(_0x4bd44f,null))[_0x64a5('0x4d')](handleError(_0x4bd44f,null));};exports[_0x64a5('0x51')]=function(_0x29925a,_0x4dc157){return db['VoiceQueueReport'][_0x64a5('0x51')](_0x29925a[_0x64a5('0x52')],{})[_0x64a5('0x30')](respondWithResult(_0x4dc157,0xc9))[_0x64a5('0x4d')](handleError(_0x4dc157,null));};exports[_0x64a5('0x53')]=function(_0x4701e0,_0x1f5366){if(_0x4701e0[_0x64a5('0x52')]['id']){delete _0x4701e0[_0x64a5('0x52')]['id'];}return db[_0x64a5('0x48')][_0x64a5('0x54')]({'where':{'id':_0x4701e0['params']['id']}})[_0x64a5('0x30')](handleEntityNotFound(_0x1f5366,null))[_0x64a5('0x30')](saveUpdates(_0x4701e0['body'],null))[_0x64a5('0x30')](respondWithResult(_0x1f5366,null))[_0x64a5('0x4d')](handleError(_0x1f5366,null));};exports['destroy']=function(_0x29c41c,_0x1e0439){return db['VoiceQueueReport'][_0x64a5('0x54')]({'where':{'id':_0x29c41c[_0x64a5('0x4f')]['id']}})[_0x64a5('0x30')](handleEntityNotFound(_0x1e0439,null))['then'](removeEntity(_0x1e0439,null))['catch'](handleError(_0x1e0439,null));};exports['describe']=function(_0x218c45,_0xbb662e){return db[_0x64a5('0x48')][_0x64a5('0x55')]()['then'](respondWithResult(_0xbb662e,null))[_0x64a5('0x4d')](handleError(_0xbb662e,null));};exports[_0x64a5('0x56')]=function(_0x50f622,_0x2dd882){var _0x5b39e1={},_0x59b915={},_0x325a86={'count':0x0,'rows':[]};_0x59b915['model']=_[_0x64a5('0x38')](db[_0x64a5('0x48')]['rawAttributes']);_0x59b915[_0x64a5('0x37')]=_[_0x64a5('0x38')](_0x50f622[_0x64a5('0x37')]);_0x59b915[_0x64a5('0x39')]=_[_0x64a5('0x3a')](_0x59b915[_0x64a5('0x36')],_0x59b915[_0x64a5('0x37')]);_0x5b39e1['attributes']=_[_0x64a5('0x3a')](_0x59b915[_0x64a5('0x36')],qs['fields'](_0x50f622['query']['fields']));_0x5b39e1[_0x64a5('0x3b')]=_0x5b39e1[_0x64a5('0x3b')][_0x64a5('0x3d')]?_0x5b39e1[_0x64a5('0x3b')]:_0x59b915[_0x64a5('0x36')];if(!_0x50f622[_0x64a5('0x37')][_0x64a5('0x3e')](_0x64a5('0x3f'))){_0x5b39e1[_0x64a5('0x28')]=qs['limit'](_0x50f622[_0x64a5('0x37')][_0x64a5('0x28')]);_0x5b39e1[_0x64a5('0x27')]=qs['offset'](_0x50f622[_0x64a5('0x37')]['offset']);}_0x5b39e1[_0x64a5('0x40')]=qs[_0x64a5('0x41')](_0x50f622[_0x64a5('0x37')][_0x64a5('0x41')]);_0x5b39e1[_0x64a5('0x42')]=qs[_0x64a5('0x39')](_['pick'](_0x50f622[_0x64a5('0x37')],_0x59b915[_0x64a5('0x39')]));if(_0x50f622[_0x64a5('0x37')][_0x64a5('0x44')]){_0x5b39e1['where']=_[_0x64a5('0x45')](_0x5b39e1[_0x64a5('0x42')],{'$or':_[_0x64a5('0x34')](_0x5b39e1[_0x64a5('0x3b')],function(_0x43bda6){var _0x38d874={};_0x38d874[_0x43bda6]={'$like':'%'+_0x50f622['query']['filter']+'%'};return _0x38d874;})});}_0x5b39e1=_[_0x64a5('0x45')]({},_0x5b39e1,_0x50f622['options']);var _0x5c3172={'where':_0x5b39e1[_0x64a5('0x42')]};return db[_0x64a5('0x48')][_0x64a5('0x29')](_0x5c3172)['then'](function(_0x206a64){_0x325a86['count']=_0x206a64;if(_0x50f622['query'][_0x64a5('0x49')]){_0x5b39e1[_0x64a5('0x4a')]=[{'all':!![]}];}return db[_0x64a5('0x48')][_0x64a5('0x4b')](_0x5b39e1);})[_0x64a5('0x30')](function(_0x23c94b){_0x325a86[_0x64a5('0x4c')]=_0x23c94b;return _0x325a86;})[_0x64a5('0x30')](respondWithFilteredResult(_0x2dd882,_0x5b39e1,'getVoiceQueuesReport'))[_0x64a5('0x4d')](handleError(_0x2dd882,null,_0x64a5('0x56')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f466a26..e51dca6 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 _0xbdee=['hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit'];(function(_0x5ed781,_0x530807){var _0x45000d=function(_0x281f3a){while(--_0x281f3a){_0x5ed781['push'](_0x5ed781['shift']());}};_0x45000d(++_0x530807);}(_0xbdee,0xaa));var _0xebde=function(_0x5c39ec,_0x324bef){_0x5c39ec=_0x5c39ec-0x0;var _0x1a2a44=_0xbdee[_0x5c39ec];return _0x1a2a44;};'use strict';var EventEmitter=require(_0xebde('0x0'));var VoiceQueueReport=require(_0xebde('0x1'))['db'][_0xebde('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xebde('0x3')](0x0);var events={'afterCreate':_0xebde('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e7fdc){return function(_0x3e9861,_0x5008c3,_0x1b5c21){VoiceQueueReportEvents[_0xebde('0x5')](_0x4e7fdc+':'+_0x3e9861['id'],_0x3e9861);VoiceQueueReportEvents[_0xebde('0x5')](_0x4e7fdc,_0x3e9861);_0x1b5c21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xebde('0x6')](e,emitEvent(event));}}module[_0xebde('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb854=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','exports'];(function(_0x57d740,_0x50be99){var _0x6607ef=function(_0x908bd0){while(--_0x908bd0){_0x57d740['push'](_0x57d740['shift']());}};_0x6607ef(++_0x50be99);}(_0xb854,0x14d));var _0x4b85=function(_0x21d1f1,_0xc82f5f){_0x21d1f1=_0x21d1f1-0x0;var _0x4732df=_0xb854[_0x21d1f1];return _0x4732df;};'use strict';var EventEmitter=require(_0x4b85('0x0'));var VoiceQueueReport=require(_0x4b85('0x1'))['db'][_0x4b85('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4b85('0x3')](0x0);var events={'afterCreate':_0x4b85('0x4'),'afterUpdate':_0x4b85('0x5'),'afterDestroy':_0x4b85('0x6')};function emitEvent(_0x41dac7){return function(_0x4d0fc1,_0x3dfe08,_0x2610dd){VoiceQueueReportEvents[_0x4b85('0x7')](_0x41dac7+':'+_0x4d0fc1['id'],_0x4d0fc1);VoiceQueueReportEvents['emit'](_0x41dac7,_0x4d0fc1);_0x2610dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x4b85('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 53cb164..9f6adbd 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 _0x0b48=['util','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x508794,_0x20e88c){var _0x2df96a=function(_0x355e29){while(--_0x355e29){_0x508794['push'](_0x508794['shift']());}};_0x2df96a(++_0x20e88c);}(_0x0b48,0xf1));var _0x80b4=function(_0xb25243,_0x462a9f){_0xb25243=_0xb25243-0x0;var _0x36d17d=_0x0b48[_0xb25243];return _0x36d17d;};'use strict';var _=require(_0x80b4('0x0'));var util=require(_0x80b4('0x1'));var logger=require('../../config/logger')(_0x80b4('0x2'));var moment=require('moment');var BPromise=require(_0x80b4('0x3'));var rp=require(_0x80b4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80b4('0x5'));var config=require(_0x80b4('0x6'));var attributes=require(_0x80b4('0x7'));module[_0x80b4('0x8')]=function(_0x1120ea,_0xc4da2e){return _0x1120ea[_0x80b4('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x80b4('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9cb=['calleridnum','lodash','util','api','moment','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xe9cb,0x197));var _0xbe9c=function(_0x9ddad9,_0x4d475c){_0x9ddad9=_0x9ddad9-0x0;var _0x363c96=_0xe9cb[_0x9ddad9];return _0x363c96;};'use strict';var _=require(_0xbe9c('0x0'));var util=require(_0xbe9c('0x1'));var logger=require('../../config/logger')(_0xbe9c('0x2'));var moment=require(_0xbe9c('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe9c('0x4'));var fs=require('fs');var path=require(_0xbe9c('0x5'));var rimraf=require(_0xbe9c('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe9c('0x7'));module[_0xbe9c('0x8')]=function(_0x510737,_0x4a6ca3){return _0x510737[_0xbe9c('0x9')](_0xbe9c('0xa'),attributes,{'tableName':_0xbe9c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbe9c('0xc')]},{'fields':[_0xbe9c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fa855eb..1d7eab0 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 _0xba32=['where','attributes','limit','map','include','model','debug','catch','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','request\x20sent','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','info','result','GetVoiceQueueReport','options','raw'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xba32,0x126));var _0x2ba3=function(_0x37e848,_0x418405){_0x37e848=_0x37e848-0x0;var _0x512fe7=_0xba32[_0x37e848];return _0x512fe7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ba3('0x0'));var BPromise=require('bluebird');var rs=require(_0x2ba3('0x1'));var fs=require('fs');var Redis=require(_0x2ba3('0x2'));var db=require(_0x2ba3('0x3'))['db'];var utils=require(_0x2ba3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ba3('0x5'));var jayson=require(_0x2ba3('0x6'));var client=jayson[_0x2ba3('0x7')][_0x2ba3('0x8')]({'port':0x232a});config[_0x2ba3('0x9')]=_[_0x2ba3('0xa')](config[_0x2ba3('0x9')],{'host':_0x2ba3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ba3('0x9')]));require(_0x2ba3('0xc'))[_0x2ba3('0xd')](socket);function respondWithRpcPromise(_0x3c7aaa,_0x48d5bf,_0x1c0c92){return new BPromise(function(_0x4fece9,_0xf68684){return client[_0x2ba3('0xe')](_0x3c7aaa,_0x1c0c92)[_0x2ba3('0xf')](function(_0x5f5cd8){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x48d5bf,_0x2ba3('0x10'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x48d5bf,_0x2ba3('0x10'),JSON[_0x2ba3('0x11')](_0x5f5cd8));if(_0x5f5cd8[_0x2ba3('0x12')]){if(_0x5f5cd8[_0x2ba3('0x12')]['code']===0x1f4){logger[_0x2ba3('0x12')](_0x2ba3('0x13'),_0x48d5bf,_0x5f5cd8[_0x2ba3('0x12')][_0x2ba3('0x14')]);return _0xf68684(_0x5f5cd8[_0x2ba3('0x12')]['message']);}logger[_0x2ba3('0x12')](_0x2ba3('0x13'),_0x48d5bf,_0x5f5cd8[_0x2ba3('0x12')][_0x2ba3('0x14')]);return _0x4fece9(_0x5f5cd8[_0x2ba3('0x12')][_0x2ba3('0x14')]);}else{logger[_0x2ba3('0x15')](_0x2ba3('0x13'),_0x48d5bf,_0x2ba3('0x10'));_0x4fece9(_0x5f5cd8[_0x2ba3('0x16')][_0x2ba3('0x14')]);}})['catch'](function(_0xb03244){logger[_0x2ba3('0x12')](_0x2ba3('0x13'),_0x48d5bf,_0xb03244);_0xf68684(_0xb03244);});});}exports[_0x2ba3('0x17')]=function(_0x4a0e84){var _0x1d699e=this;return new Promise(function(_0x3de33e,_0x1e2189){return db['VoiceQueueReport']['findAll']({'raw':_0x4a0e84[_0x2ba3('0x18')]?_0x4a0e84['options'][_0x2ba3('0x19')]===undefined?!![]:![]:!![],'where':_0x4a0e84[_0x2ba3('0x18')]?_0x4a0e84['options'][_0x2ba3('0x1a')]||null:null,'attributes':_0x4a0e84[_0x2ba3('0x18')]?_0x4a0e84['options'][_0x2ba3('0x1b')]||null:null,'limit':_0x4a0e84[_0x2ba3('0x18')]?_0x4a0e84['options'][_0x2ba3('0x1c')]||null:null,'include':_0x4a0e84[_0x2ba3('0x18')]?_0x4a0e84[_0x2ba3('0x18')]['include']?_[_0x2ba3('0x1d')](_0x4a0e84['options'][_0x2ba3('0x1e')],function(_0x237ef2){return{'model':db[_0x237ef2['model']],'as':_0x237ef2['as'],'attributes':_0x237ef2['attributes'],'include':_0x237ef2['include']?_[_0x2ba3('0x1d')](_0x237ef2[_0x2ba3('0x1e')],function(_0x49f8c3){return{'model':db[_0x49f8c3[_0x2ba3('0x1f')]],'as':_0x49f8c3['as'],'attributes':_0x49f8c3[_0x2ba3('0x1b')],'include':_0x49f8c3[_0x2ba3('0x1e')]?_[_0x2ba3('0x1d')](_0x49f8c3[_0x2ba3('0x1e')],function(_0x1d58ea){return{'model':db[_0x1d58ea[_0x2ba3('0x1f')]],'as':_0x1d58ea['as'],'attributes':_0x1d58ea[_0x2ba3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2ba3('0xf')](function(_0x726312){logger[_0x2ba3('0x15')](_0x2ba3('0x17'),_0x4a0e84);logger[_0x2ba3('0x20')](_0x2ba3('0x17'),_0x4a0e84,JSON[_0x2ba3('0x11')](_0x726312));_0x3de33e(_0x726312);})[_0x2ba3('0x21')](function(_0x2e14da){logger[_0x2ba3('0x12')](_0x2ba3('0x17'),_0x2e14da[_0x2ba3('0x14')],_0x4a0e84);_0x1e2189(_0x1d699e[_0x2ba3('0x12')](0x1f4,_0x2e14da[_0x2ba3('0x14')]));});});};exports[_0x2ba3('0x22')]=function(_0x55af8d){var _0x4d42b0=this;return new Promise(function(_0x1a5bd8,_0x2e6c77){return db[_0x2ba3('0x23')][_0x2ba3('0x24')](_0x55af8d['body'],{'raw':_0x55af8d[_0x2ba3('0x18')]?_0x55af8d[_0x2ba3('0x18')][_0x2ba3('0x19')]===undefined?!![]:![]:!![]})[_0x2ba3('0xf')](function(_0x2f5c66){logger[_0x2ba3('0x15')](_0x2ba3('0x22'),_0x55af8d);logger[_0x2ba3('0x20')]('CreateVoiceQueueReport',_0x55af8d,JSON[_0x2ba3('0x11')](_0x2f5c66));_0x1a5bd8(_0x2f5c66);})[_0x2ba3('0x21')](function(_0x1b85fd){logger[_0x2ba3('0x12')]('CreateVoiceQueueReport',_0x1b85fd[_0x2ba3('0x14')],_0x55af8d);_0x2e6c77(_0x4d42b0[_0x2ba3('0x12')](0x1f4,_0x1b85fd[_0x2ba3('0x14')]));});});};exports[_0x2ba3('0x25')]=function(_0x249c3f){var _0x17df2a=this;return new Promise(function(_0x1638b6,_0x3cbc56){return db[_0x2ba3('0x23')][_0x2ba3('0x26')](_0x249c3f[_0x2ba3('0x27')],{'raw':_0x249c3f[_0x2ba3('0x18')]?_0x249c3f[_0x2ba3('0x18')][_0x2ba3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x249c3f['options']?_0x249c3f[_0x2ba3('0x18')][_0x2ba3('0x1a')]||null:null,'attributes':_0x249c3f[_0x2ba3('0x18')]?_0x249c3f['options']['attributes']||null:null,'limit':_0x249c3f['options']?_0x249c3f[_0x2ba3('0x18')][_0x2ba3('0x1c')]||null:null})[_0x2ba3('0xf')](function(_0x1d4508){logger[_0x2ba3('0x15')]('UpdateVoiceQueueReport',_0x249c3f);logger['debug']('UpdateVoiceQueueReport',_0x249c3f,JSON[_0x2ba3('0x11')](_0x1d4508));_0x1638b6(_0x1d4508);})[_0x2ba3('0x21')](function(_0xc8114){logger['error'](_0x2ba3('0x25'),_0xc8114[_0x2ba3('0x14')],_0x249c3f);_0x3cbc56(_0x17df2a[_0x2ba3('0x12')](0x1f4,_0xc8114[_0x2ba3('0x14')]));});});}; \ No newline at end of file +var _0x4174=['VoiceQueueReport','findAll','options','raw','where','limit','map','include','model','attributes','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueueReport,\x20%s,\x20%s','GetVoiceQueueReport'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x4174,0x68));var _0x4417=function(_0x248171,_0x57a024){_0x248171=_0x248171-0x0;var _0x4f3b09=_0x4174[_0x248171];return _0x4f3b09;};'use strict';var _=require(_0x4417('0x0'));var util=require(_0x4417('0x1'));var moment=require(_0x4417('0x2'));var BPromise=require(_0x4417('0x3'));var rs=require(_0x4417('0x4'));var fs=require('fs');var Redis=require(_0x4417('0x5'));var db=require(_0x4417('0x6'))['db'];var utils=require(_0x4417('0x7'));var logger=require(_0x4417('0x8'))(_0x4417('0x9'));var config=require(_0x4417('0xa'));var jayson=require(_0x4417('0xb'));var client=jayson['client'][_0x4417('0xc')]({'port':0x232a});config[_0x4417('0xd')]=_[_0x4417('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4417('0xf'))(new Redis(config['redis']));require(_0x4417('0x10'))[_0x4417('0x11')](socket);function respondWithRpcPromise(_0xfed86e,_0x54c7de,_0x1bbe32){return new BPromise(function(_0x94cf8b,_0x4d4661){return client[_0x4417('0x12')](_0xfed86e,_0x1bbe32)[_0x4417('0x13')](function(_0x2e2473){logger[_0x4417('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x54c7de,_0x4417('0x15'));logger[_0x4417('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x54c7de,_0x4417('0x15'),JSON[_0x4417('0x17')](_0x2e2473));if(_0x2e2473[_0x4417('0x18')]){if(_0x2e2473['error'][_0x4417('0x19')]===0x1f4){logger[_0x4417('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x54c7de,_0x2e2473[_0x4417('0x18')][_0x4417('0x1a')]);return _0x4d4661(_0x2e2473[_0x4417('0x18')]['message']);}logger[_0x4417('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x54c7de,_0x2e2473['error']['message']);return _0x94cf8b(_0x2e2473['error']['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x54c7de,_0x4417('0x15'));_0x94cf8b(_0x2e2473[_0x4417('0x1b')][_0x4417('0x1a')]);}})[_0x4417('0x1c')](function(_0x1245f6){logger[_0x4417('0x18')](_0x4417('0x1d'),_0x54c7de,_0x1245f6);_0x4d4661(_0x1245f6);});});}exports[_0x4417('0x1e')]=function(_0x2c9435){var _0x4a155d=this;return new Promise(function(_0x5ff1b3,_0xcf2645){return db[_0x4417('0x1f')][_0x4417('0x20')]({'raw':_0x2c9435['options']?_0x2c9435[_0x4417('0x21')][_0x4417('0x22')]===undefined?!![]:![]:!![],'where':_0x2c9435[_0x4417('0x21')]?_0x2c9435[_0x4417('0x21')][_0x4417('0x23')]||null:null,'attributes':_0x2c9435[_0x4417('0x21')]?_0x2c9435[_0x4417('0x21')]['attributes']||null:null,'limit':_0x2c9435[_0x4417('0x21')]?_0x2c9435[_0x4417('0x21')][_0x4417('0x24')]||null:null,'include':_0x2c9435[_0x4417('0x21')]?_0x2c9435[_0x4417('0x21')]['include']?_[_0x4417('0x25')](_0x2c9435[_0x4417('0x21')][_0x4417('0x26')],function(_0x2c29d4){return{'model':db[_0x2c29d4[_0x4417('0x27')]],'as':_0x2c29d4['as'],'attributes':_0x2c29d4[_0x4417('0x28')],'include':_0x2c29d4[_0x4417('0x26')]?_[_0x4417('0x25')](_0x2c29d4[_0x4417('0x26')],function(_0x443def){return{'model':db[_0x443def[_0x4417('0x27')]],'as':_0x443def['as'],'attributes':_0x443def['attributes'],'include':_0x443def['include']?_[_0x4417('0x25')](_0x443def[_0x4417('0x26')],function(_0x268097){return{'model':db[_0x268097[_0x4417('0x27')]],'as':_0x268097['as'],'attributes':_0x268097['attributes']};}):[]};}):[]};}):[]:[]})[_0x4417('0x13')](function(_0x54e8cd){logger[_0x4417('0x14')](_0x4417('0x1e'),_0x2c9435);logger[_0x4417('0x16')](_0x4417('0x1e'),_0x2c9435,JSON['stringify'](_0x54e8cd));_0x5ff1b3(_0x54e8cd);})[_0x4417('0x1c')](function(_0x4aa700){logger[_0x4417('0x18')](_0x4417('0x1e'),_0x4aa700['message'],_0x2c9435);_0xcf2645(_0x4a155d[_0x4417('0x18')](0x1f4,_0x4aa700[_0x4417('0x1a')]));});});};exports[_0x4417('0x29')]=function(_0x4ed8f4){var _0xfde672=this;return new Promise(function(_0x46e5af,_0xa41d82){return db[_0x4417('0x1f')][_0x4417('0x2a')](_0x4ed8f4['body'],{'raw':_0x4ed8f4[_0x4417('0x21')]?_0x4ed8f4[_0x4417('0x21')][_0x4417('0x22')]===undefined?!![]:![]:!![]})[_0x4417('0x13')](function(_0x2f73e8){logger[_0x4417('0x14')](_0x4417('0x29'),_0x4ed8f4);logger[_0x4417('0x16')](_0x4417('0x29'),_0x4ed8f4,JSON['stringify'](_0x2f73e8));_0x46e5af(_0x2f73e8);})[_0x4417('0x1c')](function(_0x170c69){logger[_0x4417('0x18')](_0x4417('0x29'),_0x170c69[_0x4417('0x1a')],_0x4ed8f4);_0xa41d82(_0xfde672['error'](0x1f4,_0x170c69['message']));});});};exports[_0x4417('0x2b')]=function(_0x3a23b4){var _0x3a7501=this;return new Promise(function(_0x5ee9d9,_0x25c7bc){return db[_0x4417('0x1f')]['update'](_0x3a23b4[_0x4417('0x2c')],{'raw':_0x3a23b4[_0x4417('0x21')]?_0x3a23b4[_0x4417('0x21')][_0x4417('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a23b4['options']?_0x3a23b4[_0x4417('0x21')][_0x4417('0x23')]||null:null,'attributes':_0x3a23b4[_0x4417('0x21')]?_0x3a23b4[_0x4417('0x21')][_0x4417('0x28')]||null:null,'limit':_0x3a23b4['options']?_0x3a23b4[_0x4417('0x21')][_0x4417('0x24')]||null:null})[_0x4417('0x13')](function(_0x1c626c){logger['info'](_0x4417('0x2b'),_0x3a23b4);logger[_0x4417('0x16')](_0x4417('0x2b'),_0x3a23b4,JSON[_0x4417('0x17')](_0x1c626c));_0x5ee9d9(_0x1c626c);})[_0x4417('0x1c')](function(_0x53672d){logger[_0x4417('0x18')](_0x4417('0x2b'),_0x53672d[_0x4417('0x1a')],_0x3a23b4);_0x25c7bc(_0x3a7501[_0x4417('0x18')](0x1f4,_0x53672d[_0x4417('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index d2ce48b..fc0d3ed 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 _0xfd7b=['removeListener','register','length','save','remove','update','emit'];(function(_0xc7adfa,_0x2d929d){var _0x203646=function(_0x470ce9){while(--_0x470ce9){_0xc7adfa['push'](_0xc7adfa['shift']());}};_0x203646(++_0x2d929d);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xfd7b[_0x234ae1];return _0x227ba0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xbfd7('0x0'),_0xbfd7('0x1'),_0xbfd7('0x2')];function createListener(_0x27db01,_0x1ea39e){return function(_0x1f9ae1){_0x1ea39e[_0xbfd7('0x3')](_0x27db01,_0x1f9ae1);};}function removeListener(_0x221ad1,_0x249e59){return function(){VoiceQueueReportEvents[_0xbfd7('0x4')](_0x221ad1,_0x249e59);};}exports[_0xbfd7('0x5')]=function(_0x2ad158){for(var _0x639dd4=0x0,_0x5f3067=events[_0xbfd7('0x6')];_0x639dd4<_0x5f3067;_0x639dd4++){var _0x48f2aa=events[_0x639dd4];var _0x33dab1=createListener('voiceQueueReport:'+_0x48f2aa,_0x2ad158);VoiceQueueReportEvents['on'](_0x48f2aa,_0x33dab1);}}; \ No newline at end of file +var _0x2a76=['remove','update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a76,0xde));var _0x62a7=function(_0x1cdb0e,_0x551cb1){_0x1cdb0e=_0x1cdb0e-0x0;var _0x311983=_0x2a76[_0x1cdb0e];return _0x311983;};'use strict';var VoiceQueueReportEvents=require(_0x62a7('0x0'));var events=[_0x62a7('0x1'),_0x62a7('0x2'),_0x62a7('0x3')];function createListener(_0x42601f,_0x1cbd7c){return function(_0x108f6f){_0x1cbd7c[_0x62a7('0x4')](_0x42601f,_0x108f6f);};}function removeListener(_0x44abef,_0x28e476){return function(){VoiceQueueReportEvents[_0x62a7('0x5')](_0x44abef,_0x28e476);};}exports['register']=function(_0x3aa52a){for(var _0x5a2c8f=0x0,_0x10a163=events[_0x62a7('0x6')];_0x5a2c8f<_0x10a163;_0x5a2c8f++){var _0x520e2a=events[_0x5a2c8f];var _0x5af567=createListener(_0x62a7('0x7')+_0x520e2a,_0x3aa52a);VoiceQueueReportEvents['on'](_0x520e2a,_0x5af567);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b552720..832e5fd 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 _0x7aa2=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x7aa2,0x132));var _0x27aa=function(_0x5650d7,_0x51f443){_0x5650d7=_0x5650d7-0x0;var _0x42431d=_0x7aa2[_0x5650d7];return _0x42431d;};'use strict';var multer=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var path=require(_0x27aa('0x2'));var timeout=require(_0x27aa('0x3'));var express=require(_0x27aa('0x4'));var router=express[_0x27aa('0x5')]();var fs_extra=require(_0x27aa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x27aa('0x7'));var config=require(_0x27aa('0x8'));var controller=require(_0x27aa('0x9'));router['get']('/',auth[_0x27aa('0xa')](),controller[_0x27aa('0xb')]);router[_0x27aa('0xc')](_0x27aa('0xd'),auth[_0x27aa('0xa')](),controller[_0x27aa('0xe')]);router['post']('/',auth[_0x27aa('0xa')](),controller[_0x27aa('0xf')]);router[_0x27aa('0x10')](_0x27aa('0xd'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x11')]);router[_0x27aa('0x12')]('/:id',auth[_0x27aa('0xa')](),controller[_0x27aa('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3aa2=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4e4be0,_0x4b1549){var _0x4c0efd=function(_0x4eb504){while(--_0x4eb504){_0x4e4be0['push'](_0x4e4be0['shift']());}};_0x4c0efd(++_0x4b1549);}(_0x3aa2,0xd3));var _0x23aa=function(_0x105c6a,_0x48c736){_0x105c6a=_0x105c6a-0x0;var _0x5b844d=_0x3aa2[_0x105c6a];return _0x5b844d;};'use strict';var multer=require('multer');var util=require(_0x23aa('0x0'));var path=require(_0x23aa('0x1'));var timeout=require(_0x23aa('0x2'));var express=require('express');var router=express[_0x23aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x23aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x23aa('0x5'));var controller=require(_0x23aa('0x6'));router[_0x23aa('0x7')]('/',auth[_0x23aa('0x8')](),controller[_0x23aa('0x9')]);router[_0x23aa('0x7')](_0x23aa('0xa'),auth[_0x23aa('0x8')](),controller['show']);router[_0x23aa('0xb')]('/',auth['isAuthenticated'](),controller[_0x23aa('0xc')]);router[_0x23aa('0xd')]('/:id',auth[_0x23aa('0x8')](),controller[_0x23aa('0xe')]);router[_0x23aa('0xf')]('/:id',auth[_0x23aa('0x8')](),controller[_0x23aa('0x10')]);module[_0x23aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6ea9755..2e2efbd 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 _0x23f6=['sequelize','moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2eb60b,_0x9542ca){var _0x1b6a31=function(_0xe8e192){while(--_0xe8e192){_0x2eb60b['push'](_0x2eb60b['shift']());}};_0x1b6a31(++_0x9542ca);}(_0x23f6,0x13e));var _0x623f=function(_0x79c952,_0x2511eb){_0x79c952=_0x79c952-0x0;var _0x2964d1=_0x23f6[_0x79c952];return _0x2964d1;};'use strict';var Sequelize=require(_0x623f('0x0'));var moment=require(_0x623f('0x1'));module[_0x623f('0x2')]={'time':{'type':Sequelize[_0x623f('0x3')]},'callid':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x623f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x623f('0x4')](_0x623f('0x5'))}}; \ No newline at end of file +var _0x5ec3=['exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x19b2ce,_0x52020c){var _0x26f638=function(_0x25fca3){while(--_0x25fca3){_0x19b2ce['push'](_0x19b2ce['shift']());}};_0x26f638(++_0x52020c);}(_0x5ec3,0xea));var _0x35ec=function(_0x3f8c3a,_0x1c5829){_0x3f8c3a=_0x3f8c3a-0x0;var _0x30f387=_0x5ec3[_0x3f8c3a];return _0x30f387;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35ec('0x0'));module[_0x35ec('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x35ec('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x35ec('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x35ec('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x35ec('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x35ec('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x35ec('0x3')](_0x35ec('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 335ae1d..cf6a3c2 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 _0xd6c6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x55e9e9,_0x1afc74){var _0x39cb0c=function(_0x4c02f3){while(--_0x4c02f3){_0x55e9e9['push'](_0x55e9e9['shift']());}};_0x39cb0c(++_0x1afc74);}(_0xd6c6,0xd7));var _0x6d6c=function(_0x2bbae6,_0x3e36df){_0x2bbae6=_0x2bbae6-0x0;var _0x47f128=_0xd6c6[_0x2bbae6];return _0x47f128;};'use strict';var emlformat=require(_0x6d6c('0x0'));var rimraf=require(_0x6d6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d6c('0x2'));var rp=require(_0x6d6c('0x3'));var moment=require(_0x6d6c('0x4'));var BPromise=require(_0x6d6c('0x5'));var Mustache=require(_0x6d6c('0x6'));var util=require(_0x6d6c('0x7'));var path=require(_0x6d6c('0x8'));var sox=require(_0x6d6c('0x9'));var csv=require(_0x6d6c('0xa'));var ejs=require(_0x6d6c('0xb'));var fs=require('fs');var fs_extra=require(_0x6d6c('0xc'));var _=require(_0x6d6c('0xd'));var squel=require(_0x6d6c('0xe'));var crypto=require(_0x6d6c('0xf'));var jsforce=require(_0x6d6c('0x10'));var deskjs=require(_0x6d6c('0x11'));var toCsv=require(_0x6d6c('0xa'));var querystring=require(_0x6d6c('0x12'));var Papa=require(_0x6d6c('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d6c('0x14'));var as=require(_0x6d6c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d6c('0x16'))('api');var utils=require(_0x6d6c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6d6c('0x18'));var db=require(_0x6d6c('0x19'))['db'];function respondWithStatusCode(_0x26de55,_0x1c7aab){_0x1c7aab=_0x1c7aab||0xcc;return function(_0x363516){if(_0x363516){return _0x26de55[_0x6d6c('0x1a')](_0x1c7aab);}return _0x26de55[_0x6d6c('0x1b')](_0x1c7aab)['end']();};}function respondWithResult(_0x276b63,_0x40eca7){_0x40eca7=_0x40eca7||0xc8;return function(_0x39b709){if(_0x39b709){return _0x276b63[_0x6d6c('0x1b')](_0x40eca7)[_0x6d6c('0x1c')](_0x39b709);}};}function respondWithFilteredResult(_0x5b080d,_0x4ed475){return function(_0x2bb990){if(_0x2bb990){var _0x51214b=typeof _0x4ed475[_0x6d6c('0x1d')]===_0x6d6c('0x1e')&&typeof _0x4ed475[_0x6d6c('0x1f')]===_0x6d6c('0x1e');var _0x1195a4=_0x2bb990[_0x6d6c('0x20')];var _0xb94d8f=_0x51214b?0x0:_0x4ed475[_0x6d6c('0x1d')];var _0x56abdc=_0x51214b?_0x2bb990[_0x6d6c('0x20')]:_0x4ed475[_0x6d6c('0x1d')]+_0x4ed475['limit'];var _0x221c28;if(_0x56abdc>=_0x1195a4){_0x56abdc=_0x1195a4;_0x221c28=0xc8;}else{_0x221c28=0xce;}_0x5b080d[_0x6d6c('0x1b')](_0x221c28);return _0x5b080d[_0x6d6c('0x21')]('Content-Range',_0xb94d8f+'-'+_0x56abdc+'/'+_0x1195a4)[_0x6d6c('0x1c')](_0x2bb990);}return null;};}function patchUpdates(_0x1544c5){return function(_0x5ee10f){try{jsonpatch[_0x6d6c('0x22')](_0x5ee10f,_0x1544c5,!![]);}catch(_0x536d14){return BPromise[_0x6d6c('0x23')](_0x536d14);}return _0x5ee10f['save']();};}function saveUpdates(_0x25e774,_0x4a0e09){return function(_0x19dba9){if(_0x19dba9){return _0x19dba9[_0x6d6c('0x24')](_0x25e774)[_0x6d6c('0x25')](function(_0xd5d6d3){return _0xd5d6d3;});}return null;};}function removeEntity(_0x35df78,_0x1d6e6e){return function(_0x51fba0){if(_0x51fba0){return _0x51fba0['destroy']()[_0x6d6c('0x25')](function(){_0x35df78[_0x6d6c('0x1b')](0xcc)[_0x6d6c('0x26')]();});}};}function handleEntityNotFound(_0x2d9f01,_0x2293cc){return function(_0x1435a4){if(!_0x1435a4){_0x2d9f01[_0x6d6c('0x1a')](0x194);}return _0x1435a4;};}function handleError(_0x5cedae,_0x4f277b){_0x4f277b=_0x4f277b||0x1f4;return function(_0x26ee40){logger[_0x6d6c('0x27')](_0x26ee40[_0x6d6c('0x28')]);if(_0x26ee40[_0x6d6c('0x29')]){delete _0x26ee40[_0x6d6c('0x29')];}_0x5cedae[_0x6d6c('0x1b')](_0x4f277b)['send'](_0x26ee40);};}exports['index']=function(_0x4f84f3,_0x2489c6){var _0x15c2c6={},_0x1648e5={},_0x250a2b={'count':0x0,'rows':[]};var _0x3d21b8=_[_0x6d6c('0x2a')](db[_0x6d6c('0x2b')][_0x6d6c('0x2c')],function(_0x30927d){return{'name':_0x30927d[_0x6d6c('0x2d')],'type':_0x30927d['type'][_0x6d6c('0x2e')]};});_0x1648e5[_0x6d6c('0x2f')]=_['map'](_0x3d21b8,'name');_0x1648e5[_0x6d6c('0x30')]=_['keys'](_0x4f84f3[_0x6d6c('0x30')]);_0x1648e5['filters']=_[_0x6d6c('0x31')](_0x1648e5[_0x6d6c('0x2f')],_0x1648e5[_0x6d6c('0x30')]);_0x15c2c6[_0x6d6c('0x32')]=_[_0x6d6c('0x31')](_0x1648e5[_0x6d6c('0x2f')],qs['fields'](_0x4f84f3['query'][_0x6d6c('0x33')]));_0x15c2c6[_0x6d6c('0x32')]=_0x15c2c6[_0x6d6c('0x32')][_0x6d6c('0x34')]?_0x15c2c6[_0x6d6c('0x32')]:_0x1648e5[_0x6d6c('0x2f')];if(!_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x35')](_0x6d6c('0x36'))){_0x15c2c6[_0x6d6c('0x1f')]=qs[_0x6d6c('0x1f')](_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x1f')]);_0x15c2c6[_0x6d6c('0x1d')]=qs['offset'](_0x4f84f3[_0x6d6c('0x30')]['offset']);}_0x15c2c6[_0x6d6c('0x37')]=qs['sort'](_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x38')]);_0x15c2c6[_0x6d6c('0x39')]=qs[_0x6d6c('0x3a')](_['pick'](_0x4f84f3['query'],_0x1648e5[_0x6d6c('0x3a')]),_0x3d21b8);if(_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x3b')]){_0x15c2c6[_0x6d6c('0x39')]=_[_0x6d6c('0x3c')](_0x15c2c6[_0x6d6c('0x39')],{'$or':_[_0x6d6c('0x2a')](_0x3d21b8,function(_0x1b6853){if(_0x1b6853[_0x6d6c('0x3d')]!==_0x6d6c('0x3e')){var _0x279efc={};_0x279efc[_0x1b6853[_0x6d6c('0x29')]]={'$like':'%'+_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x3b')]+'%'};return _0x279efc;}})});}_0x15c2c6=_['merge']({},_0x15c2c6,_0x4f84f3[_0x6d6c('0x3f')]);var _0x285123={'where':_0x15c2c6[_0x6d6c('0x39')]};return db[_0x6d6c('0x2b')][_0x6d6c('0x20')](_0x285123)[_0x6d6c('0x25')](function(_0x432553){_0x250a2b[_0x6d6c('0x20')]=_0x432553;if(_0x4f84f3[_0x6d6c('0x30')][_0x6d6c('0x40')]){_0x15c2c6[_0x6d6c('0x41')]=[{'all':!![]}];}return db[_0x6d6c('0x2b')][_0x6d6c('0x42')](_0x15c2c6);})['then'](function(_0xef65de){_0x250a2b[_0x6d6c('0x43')]=_0xef65de;return _0x250a2b;})[_0x6d6c('0x25')](respondWithFilteredResult(_0x2489c6,_0x15c2c6))[_0x6d6c('0x44')](handleError(_0x2489c6,null));};exports[_0x6d6c('0x45')]=function(_0x3caf24,_0x2f1390){var _0x4ef60a={'raw':!![],'where':{'id':_0x3caf24['params']['id']}},_0x4b2331={};_0x4b2331[_0x6d6c('0x2f')]=_[_0x6d6c('0x46')](db[_0x6d6c('0x2b')][_0x6d6c('0x2c')]);_0x4b2331['query']=_[_0x6d6c('0x46')](_0x3caf24[_0x6d6c('0x30')]);_0x4b2331[_0x6d6c('0x3a')]=_[_0x6d6c('0x31')](_0x4b2331[_0x6d6c('0x2f')],_0x4b2331[_0x6d6c('0x30')]);_0x4ef60a[_0x6d6c('0x32')]=_[_0x6d6c('0x31')](_0x4b2331[_0x6d6c('0x2f')],qs['fields'](_0x3caf24[_0x6d6c('0x30')][_0x6d6c('0x33')]));_0x4ef60a[_0x6d6c('0x32')]=_0x4ef60a['attributes']['length']?_0x4ef60a[_0x6d6c('0x32')]:_0x4b2331[_0x6d6c('0x2f')];if(_0x3caf24[_0x6d6c('0x30')]['includeAll']){_0x4ef60a[_0x6d6c('0x41')]=[{'all':!![]}];}_0x4ef60a=_['merge']({},_0x4ef60a,_0x3caf24[_0x6d6c('0x3f')]);return db['VoiceQueuesLog']['find'](_0x4ef60a)['then'](handleEntityNotFound(_0x2f1390,null))['then'](respondWithResult(_0x2f1390,null))[_0x6d6c('0x44')](handleError(_0x2f1390,null));};exports[_0x6d6c('0x47')]=function(_0x358ff7,_0x261624){return db['VoiceQueuesLog'][_0x6d6c('0x47')](_0x358ff7[_0x6d6c('0x48')],{})[_0x6d6c('0x25')](respondWithResult(_0x261624,0xc9))[_0x6d6c('0x44')](handleError(_0x261624,null));};exports[_0x6d6c('0x24')]=function(_0x49996c,_0x51c83b){if(_0x49996c[_0x6d6c('0x48')]['id']){delete _0x49996c[_0x6d6c('0x48')]['id'];}return db['VoiceQueuesLog'][_0x6d6c('0x49')]({'where':{'id':_0x49996c[_0x6d6c('0x4a')]['id']}})[_0x6d6c('0x25')](handleEntityNotFound(_0x51c83b,null))[_0x6d6c('0x25')](saveUpdates(_0x49996c[_0x6d6c('0x48')],null))['then'](respondWithResult(_0x51c83b,null))['catch'](handleError(_0x51c83b,null));};exports[_0x6d6c('0x4b')]=function(_0x4b4d40,_0x18d4c4){return db[_0x6d6c('0x2b')][_0x6d6c('0x49')]({'where':{'id':_0x4b4d40[_0x6d6c('0x4a')]['id']}})[_0x6d6c('0x25')](handleEntityNotFound(_0x18d4c4,null))['then'](removeEntity(_0x18d4c4,null))[_0x6d6c('0x44')](handleError(_0x18d4c4,null));}; \ No newline at end of file +var _0x6b55=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model'];(function(_0x363f05,_0x4b6f15){var _0x2f86d3=function(_0x49acc8){while(--_0x49acc8){_0x363f05['push'](_0x363f05['shift']());}};_0x2f86d3(++_0x4b6f15);}(_0x6b55,0x69));var _0x56b5=function(_0x4f83ca,_0x3be647){_0x4f83ca=_0x4f83ca-0x0;var _0x5ea5ac=_0x6b55[_0x4f83ca];return _0x5ea5ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56b5('0x0'));var zipdir=require(_0x56b5('0x1'));var jsonpatch=require(_0x56b5('0x2'));var rp=require(_0x56b5('0x3'));var moment=require(_0x56b5('0x4'));var BPromise=require(_0x56b5('0x5'));var Mustache=require(_0x56b5('0x6'));var util=require(_0x56b5('0x7'));var path=require(_0x56b5('0x8'));var sox=require('sox');var csv=require(_0x56b5('0x9'));var ejs=require(_0x56b5('0xa'));var fs=require('fs');var fs_extra=require(_0x56b5('0xb'));var _=require(_0x56b5('0xc'));var squel=require('squel');var crypto=require(_0x56b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x56b5('0xe'));var toCsv=require(_0x56b5('0x9'));var querystring=require('querystring');var Papa=require(_0x56b5('0xf'));var Redis=require(_0x56b5('0x10'));var authService=require(_0x56b5('0x11'));var qs=require(_0x56b5('0x12'));var as=require(_0x56b5('0x13'));var hardwareService=require(_0x56b5('0x14'));var logger=require('../../config/logger')(_0x56b5('0x15'));var utils=require(_0x56b5('0x16'));var config=require(_0x56b5('0x17'));var licenseUtil=require(_0x56b5('0x18'));var db=require(_0x56b5('0x19'))['db'];function respondWithStatusCode(_0x28b748,_0x1223e2){_0x1223e2=_0x1223e2||0xcc;return function(_0xa950a9){if(_0xa950a9){return _0x28b748['sendStatus'](_0x1223e2);}return _0x28b748['status'](_0x1223e2)['end']();};}function respondWithResult(_0x20678c,_0x459100){_0x459100=_0x459100||0xc8;return function(_0x2d08f9){if(_0x2d08f9){return _0x20678c[_0x56b5('0x1a')](_0x459100)[_0x56b5('0x1b')](_0x2d08f9);}};}function respondWithFilteredResult(_0x30de32,_0x266279){return function(_0x4726a5){if(_0x4726a5){var _0x23b299=typeof _0x266279[_0x56b5('0x1c')]===_0x56b5('0x1d')&&typeof _0x266279[_0x56b5('0x1e')]==='undefined';var _0x2cf506=_0x4726a5[_0x56b5('0x1f')];var _0x22660d=_0x23b299?0x0:_0x266279[_0x56b5('0x1c')];var _0x1d41eb=_0x23b299?_0x4726a5[_0x56b5('0x1f')]:_0x266279[_0x56b5('0x1c')]+_0x266279['limit'];var _0x59681b;if(_0x1d41eb>=_0x2cf506){_0x1d41eb=_0x2cf506;_0x59681b=0xc8;}else{_0x59681b=0xce;}_0x30de32[_0x56b5('0x1a')](_0x59681b);return _0x30de32['set'](_0x56b5('0x20'),_0x22660d+'-'+_0x1d41eb+'/'+_0x2cf506)[_0x56b5('0x1b')](_0x4726a5);}return null;};}function patchUpdates(_0x4e26cf){return function(_0x163366){try{jsonpatch[_0x56b5('0x21')](_0x163366,_0x4e26cf,!![]);}catch(_0x1e4e48){return BPromise[_0x56b5('0x22')](_0x1e4e48);}return _0x163366[_0x56b5('0x23')]();};}function saveUpdates(_0x5bb240,_0x3eed88){return function(_0x171285){if(_0x171285){return _0x171285['update'](_0x5bb240)[_0x56b5('0x24')](function(_0x333d52){return _0x333d52;});}return null;};}function removeEntity(_0x44af08,_0x41841c){return function(_0x4aaba2){if(_0x4aaba2){return _0x4aaba2[_0x56b5('0x25')]()[_0x56b5('0x24')](function(){_0x44af08[_0x56b5('0x1a')](0xcc)[_0x56b5('0x26')]();});}};}function handleEntityNotFound(_0x3c119d,_0x31571a){return function(_0x2e745a){if(!_0x2e745a){_0x3c119d[_0x56b5('0x27')](0x194);}return _0x2e745a;};}function handleError(_0x4d9a0e,_0xadd59){_0xadd59=_0xadd59||0x1f4;return function(_0x41a611){logger[_0x56b5('0x28')](_0x41a611[_0x56b5('0x29')]);if(_0x41a611[_0x56b5('0x2a')]){delete _0x41a611[_0x56b5('0x2a')];}_0x4d9a0e[_0x56b5('0x1a')](_0xadd59)[_0x56b5('0x2b')](_0x41a611);};}exports[_0x56b5('0x2c')]=function(_0x103ccc,_0xe7b684){var _0x543056={},_0x3423ac={},_0x3098dc={'count':0x0,'rows':[]};var _0x43b325=_[_0x56b5('0x2d')](db[_0x56b5('0x2e')][_0x56b5('0x2f')],function(_0x115097){return{'name':_0x115097['fieldName'],'type':_0x115097[_0x56b5('0x30')][_0x56b5('0x31')]};});_0x3423ac[_0x56b5('0x32')]=_[_0x56b5('0x2d')](_0x43b325,'name');_0x3423ac[_0x56b5('0x33')]=_[_0x56b5('0x34')](_0x103ccc[_0x56b5('0x33')]);_0x3423ac[_0x56b5('0x35')]=_['intersection'](_0x3423ac[_0x56b5('0x32')],_0x3423ac[_0x56b5('0x33')]);_0x543056[_0x56b5('0x36')]=_[_0x56b5('0x37')](_0x3423ac[_0x56b5('0x32')],qs['fields'](_0x103ccc[_0x56b5('0x33')][_0x56b5('0x38')]));_0x543056[_0x56b5('0x36')]=_0x543056[_0x56b5('0x36')]['length']?_0x543056[_0x56b5('0x36')]:_0x3423ac[_0x56b5('0x32')];if(!_0x103ccc[_0x56b5('0x33')][_0x56b5('0x39')](_0x56b5('0x3a'))){_0x543056[_0x56b5('0x1e')]=qs[_0x56b5('0x1e')](_0x103ccc[_0x56b5('0x33')][_0x56b5('0x1e')]);_0x543056[_0x56b5('0x1c')]=qs[_0x56b5('0x1c')](_0x103ccc['query'][_0x56b5('0x1c')]);}_0x543056[_0x56b5('0x3b')]=qs[_0x56b5('0x3c')](_0x103ccc['query'][_0x56b5('0x3c')]);_0x543056['where']=qs[_0x56b5('0x35')](_[_0x56b5('0x3d')](_0x103ccc['query'],_0x3423ac['filters']),_0x43b325);if(_0x103ccc[_0x56b5('0x33')][_0x56b5('0x3e')]){_0x543056[_0x56b5('0x3f')]=_[_0x56b5('0x40')](_0x543056['where'],{'$or':_[_0x56b5('0x2d')](_0x43b325,function(_0x578b15){if(_0x578b15[_0x56b5('0x30')]!=='VIRTUAL'){var _0x2b601f={};_0x2b601f[_0x578b15[_0x56b5('0x2a')]]={'$like':'%'+_0x103ccc['query'][_0x56b5('0x3e')]+'%'};return _0x2b601f;}})});}_0x543056=_[_0x56b5('0x40')]({},_0x543056,_0x103ccc['options']);var _0xe88515={'where':_0x543056[_0x56b5('0x3f')]};return db[_0x56b5('0x2e')][_0x56b5('0x1f')](_0xe88515)[_0x56b5('0x24')](function(_0x5c92b9){_0x3098dc['count']=_0x5c92b9;if(_0x103ccc[_0x56b5('0x33')][_0x56b5('0x41')]){_0x543056[_0x56b5('0x42')]=[{'all':!![]}];}return db[_0x56b5('0x2e')][_0x56b5('0x43')](_0x543056);})['then'](function(_0x500a9f){_0x3098dc[_0x56b5('0x44')]=_0x500a9f;return _0x3098dc;})['then'](respondWithFilteredResult(_0xe7b684,_0x543056))[_0x56b5('0x45')](handleError(_0xe7b684,null));};exports[_0x56b5('0x46')]=function(_0x4fc411,_0x3b25db){var _0xb57f22={'raw':!![],'where':{'id':_0x4fc411[_0x56b5('0x47')]['id']}},_0x49e3d0={};_0x49e3d0[_0x56b5('0x32')]=_[_0x56b5('0x34')](db[_0x56b5('0x2e')]['rawAttributes']);_0x49e3d0[_0x56b5('0x33')]=_[_0x56b5('0x34')](_0x4fc411[_0x56b5('0x33')]);_0x49e3d0['filters']=_[_0x56b5('0x37')](_0x49e3d0['model'],_0x49e3d0['query']);_0xb57f22[_0x56b5('0x36')]=_[_0x56b5('0x37')](_0x49e3d0[_0x56b5('0x32')],qs[_0x56b5('0x38')](_0x4fc411['query'][_0x56b5('0x38')]));_0xb57f22[_0x56b5('0x36')]=_0xb57f22[_0x56b5('0x36')][_0x56b5('0x48')]?_0xb57f22[_0x56b5('0x36')]:_0x49e3d0[_0x56b5('0x32')];if(_0x4fc411['query'][_0x56b5('0x41')]){_0xb57f22[_0x56b5('0x42')]=[{'all':!![]}];}_0xb57f22=_[_0x56b5('0x40')]({},_0xb57f22,_0x4fc411[_0x56b5('0x49')]);return db[_0x56b5('0x2e')]['find'](_0xb57f22)[_0x56b5('0x24')](handleEntityNotFound(_0x3b25db,null))[_0x56b5('0x24')](respondWithResult(_0x3b25db,null))[_0x56b5('0x45')](handleError(_0x3b25db,null));};exports['create']=function(_0x4e534b,_0x3eb3e5){return db[_0x56b5('0x2e')][_0x56b5('0x4a')](_0x4e534b[_0x56b5('0x4b')],{})[_0x56b5('0x24')](respondWithResult(_0x3eb3e5,0xc9))[_0x56b5('0x45')](handleError(_0x3eb3e5,null));};exports[_0x56b5('0x4c')]=function(_0x41e54d,_0x4697bc){if(_0x41e54d[_0x56b5('0x4b')]['id']){delete _0x41e54d[_0x56b5('0x4b')]['id'];}return db['VoiceQueuesLog'][_0x56b5('0x4d')]({'where':{'id':_0x41e54d[_0x56b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4697bc,null))[_0x56b5('0x24')](saveUpdates(_0x41e54d[_0x56b5('0x4b')],null))[_0x56b5('0x24')](respondWithResult(_0x4697bc,null))[_0x56b5('0x45')](handleError(_0x4697bc,null));};exports['destroy']=function(_0x541ee2,_0x1d3dd4){return db[_0x56b5('0x2e')][_0x56b5('0x4d')]({'where':{'id':_0x541ee2['params']['id']}})[_0x56b5('0x24')](handleEntityNotFound(_0x1d3dd4,null))[_0x56b5('0x24')](removeEntity(_0x1d3dd4,null))['catch'](handleError(_0x1d3dd4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 260a63b..29d39ea 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 _0x8ce3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8ce3,0xc3));var _0x38ce=function(_0xeaf92d,_0x26a3bf){_0xeaf92d=_0xeaf92d-0x0;var _0x573a6a=_0x8ce3[_0xeaf92d];return _0x573a6a;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[{'name':_0x38ce('0xc'),'fields':['event',_0x38ce('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7da1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','event_dtm','event','dtm','../../config/logger'];(function(_0x255edb,_0x1fe389){var _0x40faee=function(_0x283132){while(--_0x283132){_0x255edb['push'](_0x255edb['shift']());}};_0x40faee(++_0x1fe389);}(_0x7da1,0x1bb));var _0x17da=function(_0x2da2ff,_0x237cbc){_0x2da2ff=_0x2da2ff-0x0;var _0x445e3b=_0x7da1[_0x2da2ff];return _0x445e3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x17da('0x0'))(_0x17da('0x1'));var moment=require(_0x17da('0x2'));var BPromise=require(_0x17da('0x3'));var rp=require(_0x17da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17da('0x5'));var config=require(_0x17da('0x6'));var attributes=require(_0x17da('0x7'));module['exports']=function(_0x365669,_0x348d0f){return _0x365669[_0x17da('0x8')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x17da('0x9'),'fields':[_0x17da('0xa'),_0x17da('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4c0d0df..353ca38 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 _0xf109=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x42e94f,_0x192d00){var _0x13efd6=function(_0x1562e6){while(--_0x1562e6){_0x42e94f['push'](_0x42e94f['shift']());}};_0x13efd6(++_0x192d00);}(_0xf109,0xce));var _0x9f10=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xf109[_0x1589dd];return _0x1bddd1;};'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')]('VoiceQueuesLog,\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')]('VoiceQueuesLog,\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);});});} \ No newline at end of file +var _0x9b8c=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','info'];(function(_0x265a7a,_0x373bc7){var _0x499008=function(_0x162c64){while(--_0x162c64){_0x265a7a['push'](_0x265a7a['shift']());}};_0x499008(++_0x373bc7);}(_0x9b8c,0x16f));var _0xc9b8=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x9b8c[_0x50e40b];return _0x2608b7;};'use strict';var _=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var moment=require(_0xc9b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9b8('0x3'));var fs=require('fs');var Redis=require(_0xc9b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9b8('0x5'));var logger=require('../../config/logger')(_0xc9b8('0x6'));var config=require('../../config/environment');var jayson=require(_0xc9b8('0x7'));var client=jayson[_0xc9b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3602e7,_0x24547a,_0x4f1ba2){return new BPromise(function(_0x1b977c,_0x2999c2){return client[_0xc9b8('0x9')](_0x3602e7,_0x4f1ba2)['then'](function(_0x1574c3){logger[_0xc9b8('0xa')](_0xc9b8('0xb'),_0x24547a,_0xc9b8('0xc'));logger[_0xc9b8('0xd')](_0xc9b8('0xe'),_0x24547a,_0xc9b8('0xc'),JSON[_0xc9b8('0xf')](_0x1574c3));if(_0x1574c3[_0xc9b8('0x10')]){if(_0x1574c3[_0xc9b8('0x10')][_0xc9b8('0x11')]===0x1f4){logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x1574c3[_0xc9b8('0x10')]['message']);return _0x2999c2(_0x1574c3[_0xc9b8('0x10')][_0xc9b8('0x12')]);}logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x1574c3['error']['message']);return _0x1b977c(_0x1574c3[_0xc9b8('0x10')]['message']);}else{logger[_0xc9b8('0xa')](_0xc9b8('0xb'),_0x24547a,_0xc9b8('0xc'));_0x1b977c(_0x1574c3[_0xc9b8('0x13')][_0xc9b8('0x12')]);}})[_0xc9b8('0x14')](function(_0x2eaa7e){logger[_0xc9b8('0x10')](_0xc9b8('0xb'),_0x24547a,_0x2eaa7e);_0x2999c2(_0x2eaa7e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 31c3f2a..40599bd 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 _0x52f0=['/:id/transcribe','post','create','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x2419c9,_0x262667){var _0x7605e=function(_0x1e5c11){while(--_0x1e5c11){_0x2419c9['push'](_0x2419c9['shift']());}};_0x7605e(++_0x262667);}(_0x52f0,0x17f));var _0x052f=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0x52f0[_0x53618a];return _0x588ddb;};'use strict';var multer=require(_0x052f('0x0'));var util=require(_0x052f('0x1'));var path=require(_0x052f('0x2'));var timeout=require(_0x052f('0x3'));var express=require('express');var router=express[_0x052f('0x4')]();var fs_extra=require(_0x052f('0x5'));var auth=require(_0x052f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x052f('0x7'));var controller=require('./voiceRecording.controller');router[_0x052f('0x8')]('/',auth[_0x052f('0x9')](),controller[_0x052f('0xa')]);router[_0x052f('0x8')](_0x052f('0xb'),auth[_0x052f('0x9')](),controller[_0x052f('0xc')]);router['get'](_0x052f('0xd'),auth['isAuthenticated'](),controller[_0x052f('0xe')]);router[_0x052f('0x8')](_0x052f('0xf'),auth[_0x052f('0x9')](),controller['download']);router['get']('/:id/downloads',controller['downloads']);router['get'](_0x052f('0x10'),auth[_0x052f('0x9')](),controller['downloadTranscribe']);router[_0x052f('0x11')]('/',auth[_0x052f('0x9')](),controller[_0x052f('0x12')]);router[_0x052f('0x11')](_0x052f('0x10'),auth[_0x052f('0x9')](),controller['runTranscribe']);router['put'](_0x052f('0xd'),auth['isAuthenticated'](),controller[_0x052f('0x13')]);router[_0x052f('0x14')](_0x052f('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc736=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','exports','multer','util','connect-timeout','express'];(function(_0x4eeb2d,_0xf6603){var _0x23e78f=function(_0x4b7f8b){while(--_0x4b7f8b){_0x4eeb2d['push'](_0x4eeb2d['shift']());}};_0x23e78f(++_0xf6603);}(_0xc736,0x1dc));var _0x6c73=function(_0x3b6c0a,_0x21372d){_0x3b6c0a=_0x3b6c0a-0x0;var _0x37fe27=_0xc736[_0x3b6c0a];return _0x37fe27;};'use strict';var multer=require(_0x6c73('0x0'));var util=require(_0x6c73('0x1'));var path=require('path');var timeout=require(_0x6c73('0x2'));var express=require(_0x6c73('0x3'));var router=express[_0x6c73('0x4')]();var fs_extra=require(_0x6c73('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c73('0x6'));var config=require(_0x6c73('0x7'));var controller=require('./voiceRecording.controller');router[_0x6c73('0x8')]('/',auth[_0x6c73('0x9')](),controller[_0x6c73('0xa')]);router[_0x6c73('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6c73('0x8')](_0x6c73('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6c73('0x8')](_0x6c73('0xc'),auth[_0x6c73('0x9')](),controller[_0x6c73('0xd')]);router['get'](_0x6c73('0xe'),controller[_0x6c73('0xf')]);router[_0x6c73('0x8')](_0x6c73('0x10'),auth[_0x6c73('0x9')](),controller[_0x6c73('0x11')]);router[_0x6c73('0x12')]('/',auth[_0x6c73('0x9')](),controller[_0x6c73('0x13')]);router[_0x6c73('0x12')]('/:id/transcribe',auth[_0x6c73('0x9')](),controller[_0x6c73('0x14')]);router[_0x6c73('0x15')](_0x6c73('0xb'),auth[_0x6c73('0x9')](),controller[_0x6c73('0x16')]);router['delete'](_0x6c73('0xb'),auth[_0x6c73('0x9')](),controller['destroy']);module[_0x6c73('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4ea2d5d..17362ac 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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 8025f05..b1bff0c 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 _0xedb0=['Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','VoiceRecording','fieldName','model','differenceBy','format','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','download','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x303a74,_0x2a17e5){var _0x5c401d=function(_0x579ddb){while(--_0x579ddb){_0x303a74['push'](_0x303a74['shift']());}};_0x5c401d(++_0x2a17e5);}(_0xedb0,0x17b));var _0x0edb=function(_0xc9dd01,_0xf6179b){_0xc9dd01=_0xc9dd01-0x0;var _0x48dd64=_0xedb0[_0xc9dd01];return _0x48dd64;};'use strict';var emlformat=require(_0x0edb('0x0'));var rimraf=require(_0x0edb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0edb('0x2'));var rp=require(_0x0edb('0x3'));var moment=require(_0x0edb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0edb('0x5'));var util=require(_0x0edb('0x6'));var path=require(_0x0edb('0x7'));var sox=require(_0x0edb('0x8'));var csv=require(_0x0edb('0x9'));var ejs=require(_0x0edb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0edb('0xb'));var jsforce=require(_0x0edb('0xc'));var deskjs=require(_0x0edb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0edb('0xe'));var Papa=require(_0x0edb('0xf'));var AWS=require(_0x0edb('0x10'));var uuidv4=require(_0x0edb('0x11'));var Redis=require(_0x0edb('0x12'));var authService=require(_0x0edb('0x13'));var qs=require(_0x0edb('0x14'));var as=require(_0x0edb('0x15'));var hardwareService=require(_0x0edb('0x16'));var logger=require('../../config/logger')(_0x0edb('0x17'));var utils=require(_0x0edb('0x18'));var config=require(_0x0edb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0edb('0x1a'))['db'];function respondWithStatusCode(_0x7fdd1b,_0x26d3b4){_0x26d3b4=_0x26d3b4||0xcc;return function(_0x4c8fab){if(_0x4c8fab){return _0x7fdd1b[_0x0edb('0x1b')](_0x26d3b4);}return _0x7fdd1b[_0x0edb('0x1c')](_0x26d3b4)[_0x0edb('0x1d')]();};}function respondWithResult(_0x2bebc4,_0x38ca8a){_0x38ca8a=_0x38ca8a||0xc8;return function(_0xe07297){if(_0xe07297){return _0x2bebc4[_0x0edb('0x1c')](_0x38ca8a)[_0x0edb('0x1e')](_0xe07297);}};}function respondWithFilteredResult(_0x54dee4,_0x4cef8f){return function(_0x4f1f08){if(_0x4f1f08){var _0x333f32=typeof _0x4cef8f[_0x0edb('0x1f')]===_0x0edb('0x20')&&typeof _0x4cef8f[_0x0edb('0x21')]===_0x0edb('0x20');var _0x5eb1e6=_0x4f1f08[_0x0edb('0x22')];var _0x369106=_0x333f32?0x0:_0x4cef8f['offset'];var _0x29292f=_0x333f32?_0x4f1f08[_0x0edb('0x22')]:_0x4cef8f[_0x0edb('0x1f')]+_0x4cef8f[_0x0edb('0x21')];var _0x815c48;if(_0x29292f>=_0x5eb1e6){_0x29292f=_0x5eb1e6;_0x815c48=0xc8;}else{_0x815c48=0xce;}_0x54dee4[_0x0edb('0x1c')](_0x815c48);return _0x54dee4['set'](_0x0edb('0x23'),_0x369106+'-'+_0x29292f+'/'+_0x5eb1e6)[_0x0edb('0x1e')](_0x4f1f08);}return null;};}function patchUpdates(_0x283459){return function(_0x134a8a){try{jsonpatch[_0x0edb('0x24')](_0x134a8a,_0x283459,!![]);}catch(_0xf198be){return BPromise[_0x0edb('0x25')](_0xf198be);}return _0x134a8a[_0x0edb('0x26')]();};}function saveUpdates(_0x5f1736,_0x20bbf9){return function(_0x39ba40){if(_0x39ba40){return _0x39ba40['update'](_0x5f1736)[_0x0edb('0x27')](function(_0x20f4e0){return _0x20f4e0;});}return null;};}function removeEntity(_0x344b0f,_0x5cb2ec){return function(_0x550993){if(_0x550993){return _0x550993[_0x0edb('0x28')]()[_0x0edb('0x27')](function(){_0x344b0f[_0x0edb('0x1c')](0xcc)[_0x0edb('0x1d')]();});}};}function handleEntityNotFound(_0x1cb957,_0x20ce0e){return function(_0x263926){if(!_0x263926){_0x1cb957['sendStatus'](0x194);}return _0x263926;};}function handleError(_0x589ecc,_0x5e33ff){_0x5e33ff=_0x5e33ff||0x1f4;return function(_0x37f412){logger['error'](_0x37f412['stack']);if(_0x37f412['name']){delete _0x37f412[_0x0edb('0x29')];}_0x589ecc[_0x0edb('0x1c')](_0x5e33ff)[_0x0edb('0x2a')](_0x37f412);};}exports[_0x0edb('0x2b')]=function(_0x5bed9b,_0x3bf701){var _0x252031={},_0x35e19f={},_0x349e36={'count':0x0,'rows':[]};var _0x1dcf20=_[_0x0edb('0x2c')](db[_0x0edb('0x2d')]['rawAttributes'],function(_0x31d273){return{'name':_0x31d273[_0x0edb('0x2e')],'type':_0x31d273['type']['key']};});_0x35e19f[_0x0edb('0x2f')]=_[_0x0edb('0x30')](_[_0x0edb('0x2c')](_0x1dcf20,_0x0edb('0x29')),[_0x0edb('0x31')]);_0x35e19f['query']=_[_0x0edb('0x32')](_0x5bed9b[_0x0edb('0x33')]);_0x35e19f[_0x0edb('0x34')]=_[_0x0edb('0x35')](_0x35e19f[_0x0edb('0x2f')],_0x35e19f[_0x0edb('0x33')]);_0x252031['attributes']=_[_0x0edb('0x35')](_0x35e19f[_0x0edb('0x2f')],qs[_0x0edb('0x36')](_0x5bed9b[_0x0edb('0x33')][_0x0edb('0x36')]));_0x252031[_0x0edb('0x37')]=_0x252031[_0x0edb('0x37')]['length']?_0x252031[_0x0edb('0x37')]:_0x35e19f['model'];if(!_0x5bed9b[_0x0edb('0x33')][_0x0edb('0x38')](_0x0edb('0x39'))){_0x252031['limit']=qs[_0x0edb('0x21')](_0x5bed9b['query'][_0x0edb('0x21')]);_0x252031[_0x0edb('0x1f')]=qs[_0x0edb('0x1f')](_0x5bed9b[_0x0edb('0x33')][_0x0edb('0x1f')]);}_0x252031[_0x0edb('0x3a')]=qs[_0x0edb('0x3b')](_0x5bed9b[_0x0edb('0x33')]['sort']);_0x252031[_0x0edb('0x3c')]=qs[_0x0edb('0x34')](_[_0x0edb('0x3d')](_0x5bed9b[_0x0edb('0x33')],_0x35e19f[_0x0edb('0x34')]),_0x1dcf20);if(_0x5bed9b[_0x0edb('0x33')]['filter']){_0x252031['where']=_[_0x0edb('0x3e')](_0x252031[_0x0edb('0x3c')],{'$or':_[_0x0edb('0x2c')](_0x1dcf20,function(_0x165e4b){if(_0x165e4b['type']!=='VIRTUAL'){var _0xd4e88e={};_0xd4e88e[_0x165e4b[_0x0edb('0x29')]]={'$like':'%'+_0x5bed9b['query'][_0x0edb('0x3f')]+'%'};return _0xd4e88e;}})});}_0x252031=_[_0x0edb('0x3e')]({},_0x252031,_0x5bed9b[_0x0edb('0x40')]);var _0x112590={'where':_0x252031[_0x0edb('0x3c')]};return db[_0x0edb('0x2d')]['count'](_0x112590)[_0x0edb('0x27')](function(_0xe57552){_0x349e36[_0x0edb('0x22')]=_0xe57552;if(_0x5bed9b['query']['includeAll']){_0x252031[_0x0edb('0x41')]=[{'all':!![]}];}return db[_0x0edb('0x2d')][_0x0edb('0x42')](_0x252031);})[_0x0edb('0x27')](function(_0x3901b5){_0x349e36[_0x0edb('0x43')]=_0x3901b5;return _0x349e36;})[_0x0edb('0x27')](respondWithFilteredResult(_0x3bf701,_0x252031))[_0x0edb('0x44')](handleError(_0x3bf701,null));};exports[_0x0edb('0x45')]=function(_0x470f3b,_0x5af8be){var _0x4c7d76={'raw':![],'where':{'id':_0x470f3b[_0x0edb('0x46')]['id']}},_0x5448d9={};_0x5448d9[_0x0edb('0x2f')]=_[_0x0edb('0x32')](db[_0x0edb('0x2d')]['rawAttributes']);_0x5448d9[_0x0edb('0x33')]=_[_0x0edb('0x32')](_0x470f3b[_0x0edb('0x33')]);_0x5448d9[_0x0edb('0x34')]=_['intersection'](_0x5448d9[_0x0edb('0x2f')],_0x5448d9['query']);_0x4c7d76[_0x0edb('0x37')]=_[_0x0edb('0x35')](_0x5448d9[_0x0edb('0x2f')],qs[_0x0edb('0x36')](_0x470f3b[_0x0edb('0x33')][_0x0edb('0x36')]));_0x4c7d76[_0x0edb('0x37')]=_0x4c7d76[_0x0edb('0x37')]['length']?_0x4c7d76[_0x0edb('0x37')]:_0x5448d9[_0x0edb('0x2f')];if(_0x470f3b['query'][_0x0edb('0x47')]){_0x4c7d76[_0x0edb('0x41')]=[{'all':!![]}];}_0x4c7d76=_[_0x0edb('0x3e')]({},_0x4c7d76,_0x470f3b[_0x0edb('0x40')]);return db[_0x0edb('0x2d')][_0x0edb('0x48')](_0x4c7d76)[_0x0edb('0x27')](handleEntityNotFound(_0x5af8be,null))[_0x0edb('0x27')](respondWithResult(_0x5af8be,null))[_0x0edb('0x44')](handleError(_0x5af8be,null));};exports[_0x0edb('0x49')]=function(_0x4accdf,_0x4310a2){return db[_0x0edb('0x2d')][_0x0edb('0x49')](_0x4accdf[_0x0edb('0x4a')],{})[_0x0edb('0x27')](respondWithResult(_0x4310a2,0xc9))[_0x0edb('0x44')](handleError(_0x4310a2,null));};exports[_0x0edb('0x4b')]=function(_0x476b20,_0x50a5a1){if(_0x476b20[_0x0edb('0x4a')]['id']){delete _0x476b20['body']['id'];}return db[_0x0edb('0x2d')]['find']({'where':{'id':_0x476b20['params']['id']}})[_0x0edb('0x27')](handleEntityNotFound(_0x50a5a1,null))[_0x0edb('0x27')](saveUpdates(_0x476b20['body'],null))[_0x0edb('0x27')](respondWithResult(_0x50a5a1,null))[_0x0edb('0x44')](handleError(_0x50a5a1,null));};exports[_0x0edb('0x4c')]=function(_0x294bf4,_0x4a7321){return db[_0x0edb('0x2d')][_0x0edb('0x4c')]()[_0x0edb('0x27')](respondWithResult(_0x4a7321,null))[_0x0edb('0x44')](handleError(_0x4a7321,null));};exports[_0x0edb('0x4d')]=function(_0x4d17cc,_0x30de9d,_0x588a1d){var _0x294ce2=require('../../components/encryptor');var _0x437f24=![];var _0xf50f00={};if(_0x4d17cc['query']['type']&&_0x4d17cc[_0x0edb('0x33')][_0x0edb('0x4e')]===_0x0edb('0x4f')){_0xf50f00[_0x0edb('0x4f')]=_0x4d17cc['params']['id'];}else{_0xf50f00['id']=_0x4d17cc['params']['id'];}return db[_0x0edb('0x2d')][_0x0edb('0x48')]({'where':_0xf50f00,'attributes':['id','value'],'raw':!![]})[_0x0edb('0x27')](handleEntityNotFound(_0x30de9d,null))[_0x0edb('0x27')](function(_0x5d1dd3){if(_0x5d1dd3){var _0x51a4db=_0x5d1dd3[_0x0edb('0x50')];var _0x4b3326=util[_0x0edb('0x31')]('%s.cypher',_0x51a4db);if(fs[_0x0edb('0x51')](_0x4b3326)){_0x437f24=!![];return _0x294ce2[_0x0edb('0x52')](_0x4b3326,_0x51a4db,config[_0x0edb('0x53')][_0x0edb('0x54')])[_0x0edb('0x27')](function(){return _0x5d1dd3;});}return _0x5d1dd3;}})['then'](function(_0x52c814){if(_0x52c814){var _0x41db9f=_0x52c814['value'];if(!fs[_0x0edb('0x51')](_0x41db9f)){throw new db[(_0x0edb('0x55'))][(_0x0edb('0x56'))](_0x0edb('0x57'));}if(_0x52c814['filename']){return _0x30de9d[_0x0edb('0x4d')](_0x41db9f,_0x52c814[_0x0edb('0x58')]+path[_0x0edb('0x59')](_0x41db9f),function(){if(_0x437f24){fs[_0x0edb('0x5a')](_0x41db9f);}});}else{return _0x30de9d['download'](_0x41db9f,function(_0x650564){if(_0x437f24){fs[_0x0edb('0x5a')](_0x41db9f);}});}}})['catch'](function(_0x5da6f1){if(_0x5da6f1[_0x0edb('0x5b')]===_0x0edb('0x57')){_0x30de9d['status'](0x194)['send'](_0x0edb('0x5c'));}else{return handleError(_0x30de9d,null);}});};exports[_0x0edb('0x5d')]=function(_0x5b9cc6,_0x5f3dc0,_0xf30c87){var _0xe9d910=require('../../components/encryptor');var _0x27b3b4=![];var _0x5e710e={'$and':[db[_0x0edb('0x5e')]['where'](db['sequelize']['fn'](_0x0edb('0x5f'),db['sequelize'][_0x0edb('0x60')](_0x0edb('0x4f'))),_0x5b9cc6[_0x0edb('0x33')][_0x0edb('0x61')])]};if(_0x5b9cc6[_0x0edb('0x33')]['type']&&_0x5b9cc6[_0x0edb('0x33')]['type']===_0x0edb('0x4f')){_0x5e710e[_0x0edb('0x62')][_0x0edb('0x63')]({'uniqueid':_0x5b9cc6[_0x0edb('0x46')]['id']});}else{_0x5e710e['$and']['push']({'id':_0x5b9cc6[_0x0edb('0x46')]['id']});}return db['VoiceRecording'][_0x0edb('0x48')]({'where':_0x5e710e,'attributes':['id','value'],'raw':!![]})[_0x0edb('0x27')](handleEntityNotFound(_0x5f3dc0,null))['then'](function(_0x5a7282){if(_0x5a7282){var _0x556ecc=util['format'](_0x0edb('0x64'),_0x5a7282[_0x0edb('0x50')]);if(fs[_0x0edb('0x51')](_0x556ecc)){_0x27b3b4=!![];return _0xe9d910['decryptFile'](_0x556ecc,_0x5a7282['value'],config['secrets'][_0x0edb('0x54')])['then'](function(){return _0x5a7282;});}return _0x5a7282;}})['then'](function(_0x3c7eff){if(_0x3c7eff){if(!fs[_0x0edb('0x51')](_0x3c7eff['value'])){throw new db[(_0x0edb('0x55'))][(_0x0edb('0x56'))](_0x0edb('0x57'));}if(_0x3c7eff[_0x0edb('0x58')]){return _0x5f3dc0[_0x0edb('0x4d')](_0x3c7eff[_0x0edb('0x50')],_0x3c7eff['filename']+path[_0x0edb('0x59')](_0x3c7eff[_0x0edb('0x50')]),function(){if(_0x27b3b4){fs['unlink'](_0x3c7eff[_0x0edb('0x50')]);}});}else{return _0x5f3dc0[_0x0edb('0x4d')](_0x3c7eff[_0x0edb('0x50')],function(_0xc747c2){if(_0x27b3b4){fs[_0x0edb('0x5a')](_0x3c7eff[_0x0edb('0x50')]);}});}}})['catch'](handleError(_0x5f3dc0,null));};exports[_0x0edb('0x28')]=function(_0xd0b1a7,_0x35d873){return db['VoiceRecording'][_0x0edb('0x48')]({'where':{'id':_0xd0b1a7['params']['id']}})[_0x0edb('0x27')](function(_0x5d8d84){if(_[_0x0edb('0x65')](_0x5d8d84)){throw new ReferenceError(_0x0edb('0x66'));}return _0x5d8d84;})[_0x0edb('0x27')](function(_0xccec74){var _0x6b14b7=_0xccec74[_0x0edb('0x50')];logger[_0x0edb('0x67')](_0x0edb('0x68'),_0x6b14b7);if(!_[_0x0edb('0x65')](_0xccec74[_0x0edb('0x50')])&&fs[_0x0edb('0x51')](_0x6b14b7)){logger[_0x0edb('0x67')](_0x0edb('0x69')+_0x6b14b7+_0x0edb('0x6a'));fs[_0x0edb('0x6b')](_0x6b14b7);}_0x6b14b7=_0x6b14b7+_0x0edb('0x6c');if(!_[_0x0edb('0x65')](_0xccec74['value'])&&fs[_0x0edb('0x51')](_0x6b14b7)){logger[_0x0edb('0x67')](_0x0edb('0x69')+_0x6b14b7+_0x0edb('0x6a'));fs['unlinkSync'](_0x6b14b7);}return _0xccec74;})[_0x0edb('0x27')](function(_0x38206c){if(!_0x38206c)throw new InternalError();return _0x38206c[_0x0edb('0x28')]();})['then'](function(){_0x35d873[_0x0edb('0x1c')](0xcc)[_0x0edb('0x1d')]();})[_0x0edb('0x44')](handleError(_0x35d873,null));};function getBucketslist(_0x23476d,_0x22819d,_0x5ab9b7){return new Promise(function(_0x47c23a,_0x39a1a6){var _0x30cdb7=new AWS['S3']({'accessKeyId':_0x22819d,'secretAccessKey':_0x23476d,'region':_0x5ab9b7});_0x30cdb7[_0x0edb('0x6d')]({},function(_0x1685fb,_0x2d0f65){if(_0x1685fb){return _0x39a1a6(_0x1685fb);}else{return _0x47c23a(_0x2d0f65);}});});}function createBucket(_0x13a79f,_0x4161cf,_0x32571c,_0x370f63){return new Promise(function(_0x9e51a1,_0x287b39){var _0x4ee5e9=new AWS['S3']({'accessKeyId':_0x4161cf,'secretAccessKey':_0x13a79f,'region':_0x32571c});_0x4ee5e9['createBucket']({'Bucket':_0x370f63},function(_0x56a060,_0x243ee4){if(_0x56a060){return _0x287b39(_0x56a060);}else{return _0x9e51a1(_0x243ee4);}});});}function uploadFile(_0x4c52da,_0x216dab,_0x31fc07,_0x41d1cc,_0x1d9d2c,_0x159d03){return new Promise(function(_0x14a117,_0x115224){var _0xeebca0=new AWS['S3']({'accessKeyId':_0x216dab,'secretAccessKey':_0x4c52da,'region':_0x31fc07});_0xeebca0[_0x0edb('0x6e')]({'Bucket':_0x41d1cc,'Key':_0x1d9d2c,'Body':_0x159d03},function(_0x3608e6,_0x4dfed6){if(_0x3608e6){return _0x115224(_0x3608e6);}else{return _0x14a117(_0x4dfed6);}});});}function startTranscribe(_0x4ad5ef,_0x27c5cb,_0x1d32bc,_0x3dbd97,_0x52cb0e,_0x3af32d){return new Promise(function(_0x9e1bbb,_0x4cdf96){var _0x2a9597=new AWS[(_0x0edb('0x6f'))]({'accessKeyId':_0x27c5cb,'secretAccessKey':_0x4ad5ef,'region':_0x1d32bc});_0x2a9597[_0x0edb('0x70')]({'TranscriptionJobName':_0x3dbd97,'LanguageCode':_0x52cb0e,'Media':{'MediaFileUri':_0x3af32d}},function(_0x123333,_0x553324){if(_0x123333){return _0x4cdf96(_0x123333);}else{return _0x9e1bbb(_0x553324);}});});}function transcribe(_0x315e67,_0x4c3d4a,_0x3370f9,_0x157bc7,_0x22984f,_0x1f1072,_0x260846){return new Promise(function(_0x1e9199,_0x12a505){var _0x4676cd={};logger['info'](util[_0x0edb('0x31')](_0x0edb('0x71'),_0x315e67,_0x22984f));return uploadFile(_0x4c3d4a,_0x3370f9,_0x157bc7,_0x22984f,path['basename'](_0x1f1072),fs[_0x0edb('0x72')](_0x1f1072))[_0x0edb('0x27')](function(_0x42256d){logger[_0x0edb('0x67')](util[_0x0edb('0x31')](_0x0edb('0x73'),_0x315e67,_0x22984f,_0x42256d[_0x0edb('0x74')]));_0x4676cd['bucket']=_0x42256d[_0x0edb('0x75')];_0x4676cd[_0x0edb('0x76')]=_0x42256d['Location'];logger[_0x0edb('0x67')](util[_0x0edb('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x315e67));return startTranscribe(_0x4c3d4a,_0x3370f9,_0x157bc7,uuidv4(),_0x260846,_0x42256d['Location']);})[_0x0edb('0x27')](function(_0x5a32da){logger[_0x0edb('0x67')](util['format'](_0x0edb('0x77'),_0x315e67,_0x5a32da[_0x0edb('0x78')]['TranscriptionJobName']));_0x4676cd[_0x0edb('0x79')]=_0x5a32da[_0x0edb('0x78')][_0x0edb('0x7a')];_0x4676cd[_0x0edb('0x7b')]=_0x5a32da[_0x0edb('0x78')][_0x0edb('0x7c')];return _0x1e9199(_0x4676cd);})[_0x0edb('0x44')](function(_0xb2a4d){return _0x12a505(_0xb2a4d);});});}exports[_0x0edb('0x7d')]=function(_0x280156,_0x5c29a2,_0x23a4db){var _0x4c8322;var _0x4425f9;var _0x49643e;var _0x43e866=require(_0x0edb('0x7e'));return db[_0x0edb('0x2d')][_0x0edb('0x7f')]({'where':{'id':_0x280156[_0x0edb('0x46')]['id']}})['then'](function(_0x2edb00){if(_0x2edb00){var _0x5d4b4a=util['format']('%s.cypher',_0x2edb00[_0x0edb('0x50')]);if(fs['existsSync'](_0x5d4b4a)){cypher=!![];return _0x43e866[_0x0edb('0x52')](_0x5d4b4a,_0x2edb00[_0x0edb('0x50')],config[_0x0edb('0x53')]['recording'])[_0x0edb('0x27')](function(){return _0x2edb00;});}return _0x2edb00;}})['then'](function(_0x9d7024){if(!_0x9d7024){throw new db['Sequelize'][(_0x0edb('0x56'))](_0x0edb('0x80'));}_0x4425f9=_0x9d7024;return db['Setting'][_0x0edb('0x7f')]({'where':{'id':0x1}});})[_0x0edb('0x27')](handleEntityNotFound(_0x5c29a2,null))[_0x0edb('0x27')](function(_0x59a8ec){if(_0x59a8ec){_0x4c8322=_0x59a8ec;if(!_0x4c8322[_0x0edb('0x81')]||!_0x4c8322[_0x0edb('0x82')]||!_0x4c8322['transcribeRegion']||!_0x4c8322['language']||!_0x4c8322['bucket']){throw new db[(_0x0edb('0x55'))][(_0x0edb('0x56'))]('Transcribe\x20not\x20configured');}if(_0x280156[_0x0edb('0x4a')][_0x0edb('0x83')]&&(!_0x4c8322[_0x0edb('0x84')]||!_0x4c8322[_0x0edb('0x85')]||!_0x4c8322[_0x0edb('0x86')]||!_0x4c8322[_0x0edb('0x87')]||!_0x4c8322[_0x0edb('0x88')])){throw new db['Sequelize'][(_0x0edb('0x56'))](_0x0edb('0x89'));}return db['CloudProvider']['findOne']({'where':{'id':_0x4c8322['transcribeAccountId']}});}})[_0x0edb('0x27')](function(_0x4dd876){if(!_0x4dd876){throw new db['Sequelize'][(_0x0edb('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4dd876[_0x0edb('0x8a')]||!_0x4dd876[_0x0edb('0x8b')]){throw new db['Sequelize'][(_0x0edb('0x56'))](_0x0edb('0x8c'));}_0x49643e=_0x4dd876;return getBucketslist(_0x49643e[_0x0edb('0x8a')],_0x49643e['data2'],_0x4c8322[_0x0edb('0x8d')]);})['then'](function(_0x194963){if(_0x194963&&_0x194963[_0x0edb('0x8e')]){var _0x421ebf=_[_0x0edb('0x48')](_0x194963['Buckets'],function(_0x2c4d73){return _0x2c4d73[_0x0edb('0x8f')]===_0x4c8322[_0x0edb('0x88')];});if(!_0x421ebf){logger['info'](util[_0x0edb('0x31')](_0x0edb('0x90'),_0x280156[_0x0edb('0x46')]['id'],_0x4c8322[_0x0edb('0x88')]));return createBucket(_0x49643e[_0x0edb('0x8a')],_0x49643e['data2'],_0x4c8322[_0x0edb('0x8d')],_0x4c8322[_0x0edb('0x88')]);}logger['info'](util[_0x0edb('0x31')](_0x0edb('0x91'),_0x280156[_0x0edb('0x46')]['id'],_0x4c8322[_0x0edb('0x88')]));return;}})[_0x0edb('0x27')](function(_0x48df28){if(_0x4425f9[_0x0edb('0x7b')]===_0x0edb('0x92')){return transcribe(_0x280156[_0x0edb('0x46')]['id'],_0x49643e[_0x0edb('0x8a')],_0x49643e[_0x0edb('0x8b')],_0x4c8322[_0x0edb('0x8d')],_0x4c8322[_0x0edb('0x88')],_0x4425f9[_0x0edb('0x50')],_0x4c8322['language']);}else{logger[_0x0edb('0x67')](util[_0x0edb('0x31')](_0x0edb('0x93'),_0x280156[_0x0edb('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0edb('0x27')](function(_0x3b8caa){if(_0x3b8caa){_0x3b8caa[_0x0edb('0x94')]=_0x280156['body'][_0x0edb('0x83')];return _0x4425f9[_0x0edb('0x95')](_0x3b8caa);}})[_0x0edb('0x27')](respondWithResult(_0x5c29a2,null))[_0x0edb('0x44')](handleError(_0x5c29a2,null));};function writeFile(_0x2194db,_0x5a5616){return new Promise(function(_0x49ea15,_0x3e253a){fs[_0x0edb('0x96')](_0x5a5616,_0x2194db,function(_0x2ee2ec,_0x427c88){if(_0x2ee2ec){return _0x3e253a(_0x2ee2ec);}else{return _0x49ea15(_0x427c88);}});});}exports[_0x0edb('0x97')]=function(_0x44cd65,_0x334e6d,_0x49c696){return db[_0x0edb('0x2d')][_0x0edb('0x7f')]({'where':{'id':_0x44cd65['params']['id']}})[_0x0edb('0x27')](handleEntityNotFound(_0x334e6d))[_0x0edb('0x27')](function(_0x5602b2){if(_0x5602b2&&_0x5602b2[_0x0edb('0x98')]){var _0x5cbdbe=_0x5602b2['fileText'];var _0x255dc5=config[_0x0edb('0x99')]+_0x0edb('0x9a')+_0x5602b2['id']+_0x0edb('0x9b');if(fs[_0x0edb('0x51')](_0x255dc5)){return _0x255dc5;}return writeFile(_0x5cbdbe,_0x255dc5)['then'](function(){return _0x255dc5;});}else{throw new db[(_0x0edb('0x55'))]['ValidationError'](_0x0edb('0x9c'));}})[_0x0edb('0x27')](function(_0x4e871f){return _0x334e6d[_0x0edb('0x4d')](_0x4e871f);})[_0x0edb('0x44')](handleError(_0x334e6d));}; \ No newline at end of file +var _0xf4fc=['limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','VoiceRecording','type','key','model','map','query','intersection','attributes','fields','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','show','keys','rawAttributes','includeAll','include','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','params','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','format','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','request-promise','moment','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf4fc,0x1a2));var _0xcf4f=function(_0x32c435,_0x50d77a){_0x32c435=_0x32c435-0x0;var _0x419637=_0xf4fc[_0x32c435];return _0x419637;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf4f('0x0'));var moment=require(_0xcf4f('0x1'));var BPromise=require(_0xcf4f('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcf4f('0x3'));var csv=require(_0xcf4f('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf4f('0x5'));var _=require('lodash');var squel=require(_0xcf4f('0x6'));var crypto=require(_0xcf4f('0x7'));var jsforce=require(_0xcf4f('0x8'));var deskjs=require(_0xcf4f('0x9'));var toCsv=require(_0xcf4f('0x4'));var querystring=require(_0xcf4f('0xa'));var Papa=require(_0xcf4f('0xb'));var AWS=require(_0xcf4f('0xc'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xcf4f('0xd'));var qs=require(_0xcf4f('0xe'));var as=require(_0xcf4f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf4f('0x10'));var utils=require(_0xcf4f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf4f('0x12'));var db=require(_0xcf4f('0x13'))['db'];function respondWithStatusCode(_0x40e524,_0x1f8ebe){_0x1f8ebe=_0x1f8ebe||0xcc;return function(_0x2c5115){if(_0x2c5115){return _0x40e524['sendStatus'](_0x1f8ebe);}return _0x40e524[_0xcf4f('0x14')](_0x1f8ebe)[_0xcf4f('0x15')]();};}function respondWithResult(_0x14e509,_0x36437b){_0x36437b=_0x36437b||0xc8;return function(_0x397911){if(_0x397911){return _0x14e509['status'](_0x36437b)[_0xcf4f('0x16')](_0x397911);}};}function respondWithFilteredResult(_0x47e8c5,_0x475265){return function(_0x29b1e0){if(_0x29b1e0){var _0x480a8d=typeof _0x475265[_0xcf4f('0x17')]===_0xcf4f('0x18')&&typeof _0x475265['limit']===_0xcf4f('0x18');var _0x18a478=_0x29b1e0[_0xcf4f('0x19')];var _0x29e816=_0x480a8d?0x0:_0x475265[_0xcf4f('0x17')];var _0x46118c=_0x480a8d?_0x29b1e0[_0xcf4f('0x19')]:_0x475265[_0xcf4f('0x17')]+_0x475265[_0xcf4f('0x1a')];var _0x3fee89;if(_0x46118c>=_0x18a478){_0x46118c=_0x18a478;_0x3fee89=0xc8;}else{_0x3fee89=0xce;}_0x47e8c5[_0xcf4f('0x14')](_0x3fee89);return _0x47e8c5[_0xcf4f('0x1b')](_0xcf4f('0x1c'),_0x29e816+'-'+_0x46118c+'/'+_0x18a478)[_0xcf4f('0x16')](_0x29b1e0);}return null;};}function patchUpdates(_0x586498){return function(_0x834fd7){try{jsonpatch[_0xcf4f('0x1d')](_0x834fd7,_0x586498,!![]);}catch(_0x35e538){return BPromise['reject'](_0x35e538);}return _0x834fd7[_0xcf4f('0x1e')]();};}function saveUpdates(_0x30c327,_0x19e738){return function(_0x3d36eb){if(_0x3d36eb){return _0x3d36eb[_0xcf4f('0x1f')](_0x30c327)['then'](function(_0x2dfcfc){return _0x2dfcfc;});}return null;};}function removeEntity(_0x2dfb96,_0x13fad4){return function(_0x2d2cdb){if(_0x2d2cdb){return _0x2d2cdb['destroy']()[_0xcf4f('0x20')](function(){_0x2dfb96[_0xcf4f('0x14')](0xcc)[_0xcf4f('0x15')]();});}};}function handleEntityNotFound(_0xe4f94d,_0x35c083){return function(_0x4ca7ae){if(!_0x4ca7ae){_0xe4f94d[_0xcf4f('0x21')](0x194);}return _0x4ca7ae;};}function handleError(_0x4292d,_0x5843cc){_0x5843cc=_0x5843cc||0x1f4;return function(_0x40c2dd){logger[_0xcf4f('0x22')](_0x40c2dd[_0xcf4f('0x23')]);if(_0x40c2dd['name']){delete _0x40c2dd[_0xcf4f('0x24')];}_0x4292d[_0xcf4f('0x14')](_0x5843cc)[_0xcf4f('0x25')](_0x40c2dd);};}exports['index']=function(_0x2b551b,_0x4807bd){var _0x372765={},_0x557fa9={},_0x5f43d6={'count':0x0,'rows':[]};var _0x2adfd3=_['map'](db[_0xcf4f('0x26')]['rawAttributes'],function(_0x45e355){return{'name':_0x45e355['fieldName'],'type':_0x45e355[_0xcf4f('0x27')][_0xcf4f('0x28')]};});_0x557fa9[_0xcf4f('0x29')]=_['differenceBy'](_[_0xcf4f('0x2a')](_0x2adfd3,_0xcf4f('0x24')),['format']);_0x557fa9[_0xcf4f('0x2b')]=_['keys'](_0x2b551b[_0xcf4f('0x2b')]);_0x557fa9['filters']=_[_0xcf4f('0x2c')](_0x557fa9[_0xcf4f('0x29')],_0x557fa9['query']);_0x372765[_0xcf4f('0x2d')]=_['intersection'](_0x557fa9['model'],qs[_0xcf4f('0x2e')](_0x2b551b[_0xcf4f('0x2b')][_0xcf4f('0x2e')]));_0x372765[_0xcf4f('0x2d')]=_0x372765['attributes']['length']?_0x372765['attributes']:_0x557fa9['model'];if(!_0x2b551b[_0xcf4f('0x2b')]['hasOwnProperty']('nolimit')){_0x372765[_0xcf4f('0x1a')]=qs['limit'](_0x2b551b[_0xcf4f('0x2b')][_0xcf4f('0x1a')]);_0x372765[_0xcf4f('0x17')]=qs[_0xcf4f('0x17')](_0x2b551b['query'][_0xcf4f('0x17')]);}_0x372765[_0xcf4f('0x2f')]=qs[_0xcf4f('0x30')](_0x2b551b[_0xcf4f('0x2b')][_0xcf4f('0x30')]);_0x372765[_0xcf4f('0x31')]=qs[_0xcf4f('0x32')](_['pick'](_0x2b551b[_0xcf4f('0x2b')],_0x557fa9[_0xcf4f('0x32')]),_0x2adfd3);if(_0x2b551b[_0xcf4f('0x2b')][_0xcf4f('0x33')]){_0x372765[_0xcf4f('0x31')]=_[_0xcf4f('0x34')](_0x372765['where'],{'$or':_[_0xcf4f('0x2a')](_0x2adfd3,function(_0x1955c1){if(_0x1955c1[_0xcf4f('0x27')]!==_0xcf4f('0x35')){var _0x70efac={};_0x70efac[_0x1955c1['name']]={'$like':'%'+_0x2b551b[_0xcf4f('0x2b')][_0xcf4f('0x33')]+'%'};return _0x70efac;}})});}_0x372765=_['merge']({},_0x372765,_0x2b551b[_0xcf4f('0x36')]);var _0xfdd181={'where':_0x372765[_0xcf4f('0x31')]};return db[_0xcf4f('0x26')]['count'](_0xfdd181)[_0xcf4f('0x20')](function(_0x3bb0c2){_0x5f43d6[_0xcf4f('0x19')]=_0x3bb0c2;if(_0x2b551b['query']['includeAll']){_0x372765['include']=[{'all':!![]}];}return db[_0xcf4f('0x26')][_0xcf4f('0x37')](_0x372765);})[_0xcf4f('0x20')](function(_0x40d5cc){_0x5f43d6[_0xcf4f('0x38')]=_0x40d5cc;return _0x5f43d6;})[_0xcf4f('0x20')](respondWithFilteredResult(_0x4807bd,_0x372765))['catch'](handleError(_0x4807bd,null));};exports[_0xcf4f('0x39')]=function(_0x30df0e,_0xe28543){var _0x358e14={'raw':![],'where':{'id':_0x30df0e['params']['id']}},_0x587794={};_0x587794[_0xcf4f('0x29')]=_[_0xcf4f('0x3a')](db[_0xcf4f('0x26')][_0xcf4f('0x3b')]);_0x587794[_0xcf4f('0x2b')]=_[_0xcf4f('0x3a')](_0x30df0e[_0xcf4f('0x2b')]);_0x587794[_0xcf4f('0x32')]=_[_0xcf4f('0x2c')](_0x587794[_0xcf4f('0x29')],_0x587794['query']);_0x358e14[_0xcf4f('0x2d')]=_[_0xcf4f('0x2c')](_0x587794['model'],qs[_0xcf4f('0x2e')](_0x30df0e[_0xcf4f('0x2b')]['fields']));_0x358e14[_0xcf4f('0x2d')]=_0x358e14[_0xcf4f('0x2d')]['length']?_0x358e14[_0xcf4f('0x2d')]:_0x587794[_0xcf4f('0x29')];if(_0x30df0e['query'][_0xcf4f('0x3c')]){_0x358e14[_0xcf4f('0x3d')]=[{'all':!![]}];}_0x358e14=_[_0xcf4f('0x34')]({},_0x358e14,_0x30df0e['options']);return db[_0xcf4f('0x26')][_0xcf4f('0x3e')](_0x358e14)[_0xcf4f('0x20')](handleEntityNotFound(_0xe28543,null))[_0xcf4f('0x20')](respondWithResult(_0xe28543,null))[_0xcf4f('0x3f')](handleError(_0xe28543,null));};exports[_0xcf4f('0x40')]=function(_0x553a7d,_0x36bfa4){return db[_0xcf4f('0x26')][_0xcf4f('0x40')](_0x553a7d['body'],{})[_0xcf4f('0x20')](respondWithResult(_0x36bfa4,0xc9))[_0xcf4f('0x3f')](handleError(_0x36bfa4,null));};exports['update']=function(_0x462e46,_0x441d3a){if(_0x462e46['body']['id']){delete _0x462e46[_0xcf4f('0x41')]['id'];}return db[_0xcf4f('0x26')][_0xcf4f('0x3e')]({'where':{'id':_0x462e46['params']['id']}})[_0xcf4f('0x20')](handleEntityNotFound(_0x441d3a,null))[_0xcf4f('0x20')](saveUpdates(_0x462e46[_0xcf4f('0x41')],null))[_0xcf4f('0x20')](respondWithResult(_0x441d3a,null))['catch'](handleError(_0x441d3a,null));};exports[_0xcf4f('0x42')]=function(_0x148956,_0x2b173f){return db[_0xcf4f('0x26')][_0xcf4f('0x42')]()[_0xcf4f('0x20')](respondWithResult(_0x2b173f,null))['catch'](handleError(_0x2b173f,null));};exports[_0xcf4f('0x43')]=function(_0x483822,_0x1d77eb,_0x2a5d5b){var _0x593d4f=require(_0xcf4f('0x44'));var _0x5f1a00=![];var _0x564a77={};if(_0x483822[_0xcf4f('0x2b')][_0xcf4f('0x27')]&&_0x483822['query']['type']===_0xcf4f('0x45')){_0x564a77['uniqueid']=_0x483822[_0xcf4f('0x46')]['id'];}else{_0x564a77['id']=_0x483822['params']['id'];}return db[_0xcf4f('0x26')]['find']({'where':_0x564a77,'attributes':['id','value'],'raw':!![]})[_0xcf4f('0x20')](handleEntityNotFound(_0x1d77eb,null))[_0xcf4f('0x20')](function(_0x44f750){if(_0x44f750){var _0x5da24c=_0x44f750['value'];var _0x172ff4=util['format']('%s.cypher',_0x5da24c);if(fs[_0xcf4f('0x47')](_0x172ff4)){_0x5f1a00=!![];return _0x593d4f[_0xcf4f('0x48')](_0x172ff4,_0x5da24c,config[_0xcf4f('0x49')][_0xcf4f('0x4a')])[_0xcf4f('0x20')](function(){return _0x44f750;});}return _0x44f750;}})[_0xcf4f('0x20')](function(_0x42cdf5){if(_0x42cdf5){var _0x186e61=_0x42cdf5[_0xcf4f('0x4b')];if(!fs[_0xcf4f('0x47')](_0x186e61)){throw new db[(_0xcf4f('0x4c'))][(_0xcf4f('0x4d'))](_0xcf4f('0x4e'));}if(_0x42cdf5[_0xcf4f('0x4f')]){return _0x1d77eb[_0xcf4f('0x43')](_0x186e61,_0x42cdf5['filename']+path[_0xcf4f('0x50')](_0x186e61),function(){if(_0x5f1a00){fs[_0xcf4f('0x51')](_0x186e61);}});}else{return _0x1d77eb['download'](_0x186e61,function(_0x3938f0){if(_0x5f1a00){fs[_0xcf4f('0x51')](_0x186e61);}});}}})[_0xcf4f('0x3f')](function(_0x2b92b0){if(_0x2b92b0['message']===_0xcf4f('0x4e')){_0x1d77eb[_0xcf4f('0x14')](0x194)[_0xcf4f('0x25')](_0xcf4f('0x52'));}else{return handleError(_0x1d77eb,null);}});};exports[_0xcf4f('0x53')]=function(_0x1f478a,_0x4ec8c8,_0x35cd50){var _0x303a2a=require(_0xcf4f('0x44'));var _0x27e2c8=![];var _0x156b47={'$and':[db['sequelize'][_0xcf4f('0x31')](db[_0xcf4f('0x54')]['fn'](_0xcf4f('0x55'),db[_0xcf4f('0x54')][_0xcf4f('0x56')](_0xcf4f('0x45'))),_0x1f478a[_0xcf4f('0x2b')][_0xcf4f('0x57')])]};if(_0x1f478a['query'][_0xcf4f('0x27')]&&_0x1f478a[_0xcf4f('0x2b')][_0xcf4f('0x27')]===_0xcf4f('0x45')){_0x156b47[_0xcf4f('0x58')][_0xcf4f('0x59')]({'uniqueid':_0x1f478a[_0xcf4f('0x46')]['id']});}else{_0x156b47['$and'][_0xcf4f('0x59')]({'id':_0x1f478a[_0xcf4f('0x46')]['id']});}return db['VoiceRecording'][_0xcf4f('0x3e')]({'where':_0x156b47,'attributes':['id',_0xcf4f('0x4b')],'raw':!![]})[_0xcf4f('0x20')](handleEntityNotFound(_0x4ec8c8,null))[_0xcf4f('0x20')](function(_0x31cf5b){if(_0x31cf5b){var _0x140615=util[_0xcf4f('0x5a')]('%s.cypher',_0x31cf5b[_0xcf4f('0x4b')]);if(fs[_0xcf4f('0x47')](_0x140615)){_0x27e2c8=!![];return _0x303a2a[_0xcf4f('0x48')](_0x140615,_0x31cf5b[_0xcf4f('0x4b')],config[_0xcf4f('0x49')][_0xcf4f('0x4a')])['then'](function(){return _0x31cf5b;});}return _0x31cf5b;}})[_0xcf4f('0x20')](function(_0x53e5a3){if(_0x53e5a3){if(!fs['existsSync'](_0x53e5a3[_0xcf4f('0x4b')])){throw new db['Sequelize'][(_0xcf4f('0x4d'))](_0xcf4f('0x4e'));}if(_0x53e5a3['filename']){return _0x4ec8c8[_0xcf4f('0x43')](_0x53e5a3['value'],_0x53e5a3[_0xcf4f('0x4f')]+path[_0xcf4f('0x50')](_0x53e5a3['value']),function(){if(_0x27e2c8){fs['unlink'](_0x53e5a3['value']);}});}else{return _0x4ec8c8[_0xcf4f('0x43')](_0x53e5a3['value'],function(_0x55e1bc){if(_0x27e2c8){fs[_0xcf4f('0x51')](_0x53e5a3[_0xcf4f('0x4b')]);}});}}})[_0xcf4f('0x3f')](handleError(_0x4ec8c8,null));};exports[_0xcf4f('0x5b')]=function(_0x498081,_0xe01321){return db['VoiceRecording'][_0xcf4f('0x3e')]({'where':{'id':_0x498081[_0xcf4f('0x46')]['id']}})[_0xcf4f('0x20')](function(_0x4db4fe){if(_[_0xcf4f('0x5c')](_0x4db4fe)){throw new ReferenceError(_0xcf4f('0x5d'));}return _0x4db4fe;})['then'](function(_0x11edd7){var _0x4c7373=_0x11edd7[_0xcf4f('0x4b')];logger[_0xcf4f('0x5e')](_0xcf4f('0x5f'),_0x4c7373);if(!_[_0xcf4f('0x5c')](_0x11edd7['value'])&&fs[_0xcf4f('0x47')](_0x4c7373)){logger['info'](_0xcf4f('0x60')+_0x4c7373+_0xcf4f('0x61'));fs['unlinkSync'](_0x4c7373);}_0x4c7373=_0x4c7373+_0xcf4f('0x62');if(!_['isNil'](_0x11edd7[_0xcf4f('0x4b')])&&fs[_0xcf4f('0x47')](_0x4c7373)){logger[_0xcf4f('0x5e')]('File:\x20\x22'+_0x4c7373+_0xcf4f('0x61'));fs[_0xcf4f('0x63')](_0x4c7373);}return _0x11edd7;})[_0xcf4f('0x20')](function(_0x3ae59e){if(!_0x3ae59e)throw new InternalError();return _0x3ae59e[_0xcf4f('0x5b')]();})[_0xcf4f('0x20')](function(){_0xe01321[_0xcf4f('0x14')](0xcc)[_0xcf4f('0x15')]();})['catch'](handleError(_0xe01321,null));};function getBucketslist(_0x50dcd1,_0x5b8d5c,_0x51d0c2){return new Promise(function(_0xe7c43d,_0x4bbd55){var _0x981dde=new AWS['S3']({'accessKeyId':_0x5b8d5c,'secretAccessKey':_0x50dcd1,'region':_0x51d0c2});_0x981dde[_0xcf4f('0x64')]({},function(_0x328312,_0x2d7eaa){if(_0x328312){return _0x4bbd55(_0x328312);}else{return _0xe7c43d(_0x2d7eaa);}});});}function createBucket(_0x509ad6,_0x47a70,_0x298d51,_0x56b636){return new Promise(function(_0x2b2eca,_0x5821ad){var _0x5c20d2=new AWS['S3']({'accessKeyId':_0x47a70,'secretAccessKey':_0x509ad6,'region':_0x298d51});_0x5c20d2['createBucket']({'Bucket':_0x56b636},function(_0x3b525b,_0x81fcbc){if(_0x3b525b){return _0x5821ad(_0x3b525b);}else{return _0x2b2eca(_0x81fcbc);}});});}function uploadFile(_0x3e04bb,_0x5d0be0,_0x26ca08,_0x3f372b,_0x59b66e,_0x557bf0){return new Promise(function(_0x1f79d1,_0x3f8b12){var _0x562218=new AWS['S3']({'accessKeyId':_0x5d0be0,'secretAccessKey':_0x3e04bb,'region':_0x26ca08});_0x562218[_0xcf4f('0x65')]({'Bucket':_0x3f372b,'Key':_0x59b66e,'Body':_0x557bf0},function(_0x384193,_0x5b818b){if(_0x384193){return _0x3f8b12(_0x384193);}else{return _0x1f79d1(_0x5b818b);}});});}function startTranscribe(_0x2cf42f,_0x52a63f,_0x4ce874,_0x32bde4,_0x2bf1a2,_0xbbadc9){return new Promise(function(_0x2efc96,_0x25b5f5){var _0x46a3d4=new AWS[(_0xcf4f('0x66'))]({'accessKeyId':_0x52a63f,'secretAccessKey':_0x2cf42f,'region':_0x4ce874});_0x46a3d4[_0xcf4f('0x67')]({'TranscriptionJobName':_0x32bde4,'LanguageCode':_0x2bf1a2,'Media':{'MediaFileUri':_0xbbadc9}},function(_0xa74d72,_0x42f9cb){if(_0xa74d72){return _0x25b5f5(_0xa74d72);}else{return _0x2efc96(_0x42f9cb);}});});}function transcribe(_0x28153a,_0x4a42ee,_0xe871d,_0x2ca2c1,_0x2aa7fe,_0x1e89aa,_0x5f7f3f){return new Promise(function(_0x57c26d,_0x12fd69){var _0x45847a={};logger[_0xcf4f('0x5e')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x28153a,_0x2aa7fe));return uploadFile(_0x4a42ee,_0xe871d,_0x2ca2c1,_0x2aa7fe,path['basename'](_0x1e89aa),fs[_0xcf4f('0x68')](_0x1e89aa))[_0xcf4f('0x20')](function(_0x4b3a20){logger[_0xcf4f('0x5e')](util[_0xcf4f('0x5a')](_0xcf4f('0x69'),_0x28153a,_0x2aa7fe,_0x4b3a20[_0xcf4f('0x6a')]));_0x45847a['bucket']=_0x4b3a20[_0xcf4f('0x6b')];_0x45847a['location']=_0x4b3a20[_0xcf4f('0x6a')];logger['info'](util[_0xcf4f('0x5a')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x28153a));return startTranscribe(_0x4a42ee,_0xe871d,_0x2ca2c1,uuidv4(),_0x5f7f3f,_0x4b3a20[_0xcf4f('0x6a')]);})['then'](function(_0x112927){logger['info'](util[_0xcf4f('0x5a')](_0xcf4f('0x6c'),_0x28153a,_0x112927[_0xcf4f('0x6d')][_0xcf4f('0x6e')]));_0x45847a[_0xcf4f('0x6f')]=_0x112927['TranscriptionJob']['TranscriptionJobName'];_0x45847a[_0xcf4f('0x70')]=_0x112927[_0xcf4f('0x6d')][_0xcf4f('0x71')];return _0x57c26d(_0x45847a);})[_0xcf4f('0x3f')](function(_0x3caa7e){return _0x12fd69(_0x3caa7e);});});}exports[_0xcf4f('0x72')]=function(_0x24a39d,_0x5bf335,_0x527fa3){var _0xa0b0ad;var _0x39971a;var _0x415933;var _0x3db3fc=require(_0xcf4f('0x44'));return db[_0xcf4f('0x26')]['findOne']({'where':{'id':_0x24a39d[_0xcf4f('0x46')]['id']}})['then'](function(_0x2c8600){if(_0x2c8600){var _0x65a50=util['format'](_0xcf4f('0x73'),_0x2c8600[_0xcf4f('0x4b')]);if(fs[_0xcf4f('0x47')](_0x65a50)){cypher=!![];return _0x3db3fc['decryptFile'](_0x65a50,_0x2c8600['value'],config['secrets']['recording'])[_0xcf4f('0x20')](function(){return _0x2c8600;});}return _0x2c8600;}})[_0xcf4f('0x20')](function(_0x40dca0){if(!_0x40dca0){throw new db[(_0xcf4f('0x4c'))]['ValidationError'](_0xcf4f('0x74'));}_0x39971a=_0x40dca0;return db[_0xcf4f('0x75')][_0xcf4f('0x76')]({'where':{'id':0x1}});})[_0xcf4f('0x20')](handleEntityNotFound(_0x5bf335,null))[_0xcf4f('0x20')](function(_0x673000){if(_0x673000){_0xa0b0ad=_0x673000;if(!_0xa0b0ad['transcribe']||!_0xa0b0ad['transcribeAccountId']||!_0xa0b0ad[_0xcf4f('0x77')]||!_0xa0b0ad['language']||!_0xa0b0ad[_0xcf4f('0x78')]){throw new db[(_0xcf4f('0x4c'))][(_0xcf4f('0x4d'))](_0xcf4f('0x79'));}if(_0x24a39d[_0xcf4f('0x41')]['runSentiment']&&(!_0xa0b0ad[_0xcf4f('0x7a')]||!_0xa0b0ad['sentimentAccountId']||!_0xa0b0ad[_0xcf4f('0x7b')]||!_0xa0b0ad[_0xcf4f('0x7c')]||!_0xa0b0ad['bucket'])){throw new db[(_0xcf4f('0x4c'))]['ValidationError'](_0xcf4f('0x7d'));}return db[_0xcf4f('0x7e')][_0xcf4f('0x76')]({'where':{'id':_0xa0b0ad[_0xcf4f('0x7f')]}});}})['then'](function(_0x8d7c2f){if(!_0x8d7c2f){throw new db[(_0xcf4f('0x4c'))]['ValidationError'](_0xcf4f('0x80'));}if(!_0x8d7c2f[_0xcf4f('0x81')]||!_0x8d7c2f[_0xcf4f('0x82')]){throw new db['Sequelize']['ValidationError'](_0xcf4f('0x83'));}_0x415933=_0x8d7c2f;return getBucketslist(_0x415933[_0xcf4f('0x81')],_0x415933[_0xcf4f('0x82')],_0xa0b0ad[_0xcf4f('0x77')]);})[_0xcf4f('0x20')](function(_0x24fe0e){if(_0x24fe0e&&_0x24fe0e[_0xcf4f('0x84')]){var _0x1f7176=_['find'](_0x24fe0e['Buckets'],function(_0x4516b3){return _0x4516b3[_0xcf4f('0x85')]===_0xa0b0ad[_0xcf4f('0x78')];});if(!_0x1f7176){logger['info'](util[_0xcf4f('0x5a')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x24a39d[_0xcf4f('0x46')]['id'],_0xa0b0ad[_0xcf4f('0x78')]));return createBucket(_0x415933[_0xcf4f('0x81')],_0x415933[_0xcf4f('0x82')],_0xa0b0ad[_0xcf4f('0x77')],_0xa0b0ad[_0xcf4f('0x78')]);}logger[_0xcf4f('0x5e')](util['format'](_0xcf4f('0x86'),_0x24a39d['params']['id'],_0xa0b0ad[_0xcf4f('0x78')]));return;}})[_0xcf4f('0x20')](function(_0x36a264){if(_0x39971a['transcribeStatus']===_0xcf4f('0x87')){return transcribe(_0x24a39d[_0xcf4f('0x46')]['id'],_0x415933['data1'],_0x415933[_0xcf4f('0x82')],_0xa0b0ad[_0xcf4f('0x77')],_0xa0b0ad[_0xcf4f('0x78')],_0x39971a[_0xcf4f('0x4b')],_0xa0b0ad[_0xcf4f('0x7c')]);}else{logger[_0xcf4f('0x5e')](util[_0xcf4f('0x5a')](_0xcf4f('0x88'),_0x24a39d[_0xcf4f('0x46')]['id']));return{'transcribeStatus':_0xcf4f('0x89')};}})[_0xcf4f('0x20')](function(_0x5abdb1){if(_0x5abdb1){_0x5abdb1[_0xcf4f('0x8a')]=_0x24a39d[_0xcf4f('0x41')][_0xcf4f('0x8b')];return _0x39971a[_0xcf4f('0x8c')](_0x5abdb1);}})[_0xcf4f('0x20')](respondWithResult(_0x5bf335,null))[_0xcf4f('0x3f')](handleError(_0x5bf335,null));};function writeFile(_0x597cc3,_0x2a2bf7){return new Promise(function(_0x4694f7,_0x292d13){fs[_0xcf4f('0x8d')](_0x2a2bf7,_0x597cc3,function(_0x38ca50,_0x2064a6){if(_0x38ca50){return _0x292d13(_0x38ca50);}else{return _0x4694f7(_0x2064a6);}});});}exports[_0xcf4f('0x8e')]=function(_0x4d33f1,_0x17ef37,_0x54d945){return db[_0xcf4f('0x26')][_0xcf4f('0x76')]({'where':{'id':_0x4d33f1[_0xcf4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x17ef37))[_0xcf4f('0x20')](function(_0x3c64e8){if(_0x3c64e8&&_0x3c64e8['fileText']){var _0xe9a54e=_0x3c64e8[_0xcf4f('0x8f')];var _0xd0b803=config[_0xcf4f('0x90')]+_0xcf4f('0x91')+_0x3c64e8['id']+_0xcf4f('0x92');if(fs[_0xcf4f('0x47')](_0xd0b803)){return _0xd0b803;}return writeFile(_0xe9a54e,_0xd0b803)[_0xcf4f('0x20')](function(){return _0xd0b803;});}else{throw new db[(_0xcf4f('0x4c'))][(_0xcf4f('0x4d'))](_0xcf4f('0x93'));}})[_0xcf4f('0x20')](function(_0x35db84){return _0x17ef37['download'](_0x35db84);})[_0xcf4f('0x3f')](handleError(_0x17ef37));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index bd64f40..abb6425 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 _0x53d5=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x42e8f0,_0x4ac7a5){var _0x132549=function(_0xb160fe){while(--_0xb160fe){_0x42e8f0['push'](_0x42e8f0['shift']());}};_0x132549(++_0x4ac7a5);}(_0x53d5,0x1cc));var _0x553d=function(_0x2c53fb,_0x7d12aa){_0x2c53fb=_0x2c53fb-0x0;var _0x292493=_0x53d5[_0x2c53fb];return _0x292493;};'use strict';var attributes=require(_0x553d('0x0'));module[_0x553d('0x1')]=function(_0x217b81,_0x619750){return _0x217b81[_0x553d('0x2')](_0x553d('0x3'),attributes,{'tableName':_0x553d('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x553d('0x5')]},{'name':_0x553d('0x6'),'fields':[_0x553d('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe13a=['transcribeStatus','exports','define','voice_recordings','uniqueid'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe13a,0x178));var _0xae13=function(_0x3aeb33,_0x1bd181){_0x3aeb33=_0x3aeb33-0x0;var _0x46bfde=_0xe13a[_0x3aeb33];return _0x46bfde;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xae13('0x0')]=function(_0x2da5ca,_0x3dd3e8){return _0x2da5ca[_0xae13('0x1')]('VoiceRecording',attributes,{'tableName':_0xae13('0x2'),'paranoid':![],'indexes':[{'name':_0xae13('0x3'),'fields':[_0xae13('0x3')]},{'name':_0xae13('0x4'),'fields':[_0xae13('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 66d4c86..e28c4af 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 _0x958a=['unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher'];(function(_0x229e4a,_0x42c4d3){var _0x5e363a=function(_0x1d5257){while(--_0x1d5257){_0x229e4a['push'](_0x229e4a['shift']());}};_0x5e363a(++_0x42c4d3);}(_0x958a,0x128));var _0xa958=function(_0xb8cd5b,_0x5ee873){_0xb8cd5b=_0xb8cd5b-0x0;var _0x3984fe=_0x958a[_0xb8cd5b];return _0x3984fe;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')](_0x4eadc9[_0xa958('0x1a')],{'raw':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')][_0xa958('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eadc9['options']?_0x4eadc9['options'][_0xa958('0x1d')]||null:null,'attributes':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['attributes']||null:null,'limit':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['limit']||null:null})[_0xa958('0xb')](function(_0x401175){logger['info']('UpdateVoiceRecording',_0x4eadc9);logger[_0xa958('0xf')](_0xa958('0x17'),_0x4eadc9,JSON['stringify'](_0x401175));_0x70d13e(_0x401175);})[_0xa958('0x16')](function(_0x27097a){logger[_0xa958('0x12')](_0xa958('0x17'),_0x27097a[_0xa958('0x14')],_0x4eadc9);_0x52a184(_0x3a053f[_0xa958('0x12')](0x1f4,_0x27097a['message']));});});};exports[_0xa958('0x1e')]=function(_0x48ef34){var _0x43df63=this;return new Promise(function(_0x3c2ea3,_0x32ea36){var _0x18f600=require(_0xa958('0x1f'));var _0xddc7f6;return db[_0xa958('0x20')][_0xa958('0x21')]({'attributes':['id',_0xa958('0x22')],'where':{'id':0x1},'raw':!![]})[_0xa958('0xb')](function(_0x4c4c37){_0xddc7f6=_0x4c4c37;return db['VoiceRecording'][_0xa958('0x23')](_0x48ef34['body']);})[_0xa958('0xb')](function(_0x1b76de){if(_0xddc7f6['callRecordingEncryption']&&fs[_0xa958('0x24')](_0x1b76de[_0xa958('0x25')])){var _0x179bc2=util[_0xa958('0x26')](_0xa958('0x27'),_0x1b76de['value']);return _0x18f600['encryptFile'](_0x1b76de[_0xa958('0x25')],_0x179bc2,config['secrets']['recording'])[_0xa958('0xb')](function(){fs[_0xa958('0x28')](_0x1b76de[_0xa958('0x25')]);logger[_0xa958('0xc')](_0xa958('0x29'));return _0x1b76de;});}return _0x1b76de;})[_0xa958('0xb')](function(_0x516a2f){logger[_0xa958('0xc')]('CreateVoiceRecording',_0x48ef34);logger['debug'](_0xa958('0x1e'),_0x48ef34,JSON[_0xa958('0x11')](_0x516a2f));_0x3c2ea3(_0x516a2f);})[_0xa958('0x16')](function(_0x1cc55d){logger[_0xa958('0x12')](_0xa958('0x1e'),_0x1cc55d[_0xa958('0x14')],_0x48ef34);_0x32ea36(_0x43df63[_0xa958('0x12')](0x1f4,_0x1cc55d['message']));});});}; \ No newline at end of file +var _0x4137=['attributes','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','VoiceRecording','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','UpdateVoiceRecording','update','body','options','where'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['VoiceRecording'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['limit']||null:null})['then'](function(_0x138508){logger['info'](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x138508));_0x2a3417(_0x138508);})[_0x7413('0x1d')](function(_0x346ce8){logger[_0x7413('0x13')](_0x7413('0x17'),_0x346ce8[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e['error'](0x1f4,_0x346ce8['message']));});});};exports[_0x7413('0x1e')]=function(_0x48c2dc){var _0x46c895=this;return new Promise(function(_0x71cbb4,_0x463b21){var _0x4c2e90=require(_0x7413('0x1f'));var _0x896552;return db[_0x7413('0x20')][_0x7413('0x21')]({'attributes':['id',_0x7413('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7413('0x23')](function(_0x5eb4d9){_0x896552=_0x5eb4d9;return db[_0x7413('0x24')]['create'](_0x48c2dc[_0x7413('0x19')]);})[_0x7413('0x23')](function(_0xae2969){if(_0x896552[_0x7413('0x22')]&&fs[_0x7413('0x25')](_0xae2969[_0x7413('0x26')])){var _0x5bb3ea=util[_0x7413('0x27')](_0x7413('0x28'),_0xae2969[_0x7413('0x26')]);return _0x4c2e90[_0x7413('0x29')](_0xae2969[_0x7413('0x26')],_0x5bb3ea,config[_0x7413('0x2a')][_0x7413('0x2b')])['then'](function(){fs[_0x7413('0x2c')](_0xae2969[_0x7413('0x26')]);logger[_0x7413('0xe')](_0x7413('0x2d'));return _0xae2969;});}return _0xae2969;})[_0x7413('0x23')](function(_0x51d676){logger[_0x7413('0xe')]('CreateVoiceRecording',_0x48c2dc);logger[_0x7413('0x10')](_0x7413('0x1e'),_0x48c2dc,JSON[_0x7413('0x12')](_0x51d676));_0x71cbb4(_0x51d676);})['catch'](function(_0xe6b096){logger['error'](_0x7413('0x1e'),_0xe6b096[_0x7413('0x16')],_0x48c2dc);_0x463b21(_0x46c895['error'](0x1f4,_0xe6b096['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 371d691..a9e83a0 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 _0x1be2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x25402e,_0x1ab8f2){var _0x168dbb=function(_0x440845){while(--_0x440845){_0x25402e['push'](_0x25402e['shift']());}};_0x168dbb(++_0x1ab8f2);}(_0x1be2,0x123));var _0x21be=function(_0x34d97d,_0x510bec){_0x34d97d=_0x34d97d-0x0;var _0x3e1c84=_0x1be2[_0x34d97d];return _0x3e1c84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x21be('0x0'));var timeout=require(_0x21be('0x1'));var express=require(_0x21be('0x2'));var router=express[_0x21be('0x3')]();var fs_extra=require(_0x21be('0x4'));var auth=require(_0x21be('0x5'));var interaction=require(_0x21be('0x6'));var config=require(_0x21be('0x7'));var controller=require(_0x21be('0x8'));router[_0x21be('0x9')]('/',auth[_0x21be('0xa')](),controller[_0x21be('0xb')]);router['get'](_0x21be('0xc'),auth[_0x21be('0xa')](),controller[_0x21be('0xd')]);router[_0x21be('0x9')](_0x21be('0xe'),auth[_0x21be('0xa')](),controller[_0x21be('0xf')]);router['post']('/',auth[_0x21be('0xa')](),controller[_0x21be('0x10')]);router['put'](_0x21be('0xe'),auth[_0x21be('0xa')](),controller[_0x21be('0x11')]);router[_0x21be('0x12')](_0x21be('0xe'),auth[_0x21be('0xa')](),controller[_0x21be('0x13')]);module[_0x21be('0x14')]=router; \ No newline at end of file +var _0x97a5=['../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2a6,_0x3b8d74){var _0x51db8c=function(_0x220abf){while(--_0x220abf){_0x3a2a6['push'](_0x3a2a6['shift']());}};_0x51db8c(++_0x3b8d74);}(_0x97a5,0x1b0));var _0x597a=function(_0xd1179e,_0x5c65de){_0xd1179e=_0xd1179e-0x0;var _0x1c7c8e=_0x97a5[_0xd1179e];return _0x1c7c8e;};'use strict';var multer=require('multer');var util=require(_0x597a('0x0'));var path=require(_0x597a('0x1'));var timeout=require(_0x597a('0x2'));var express=require(_0x597a('0x3'));var router=express[_0x597a('0x4')]();var fs_extra=require(_0x597a('0x5'));var auth=require(_0x597a('0x6'));var interaction=require(_0x597a('0x7'));var config=require(_0x597a('0x8'));var controller=require(_0x597a('0x9'));router[_0x597a('0xa')]('/',auth['isAuthenticated'](),controller[_0x597a('0xb')]);router['get'](_0x597a('0xc'),auth[_0x597a('0xd')](),controller[_0x597a('0xe')]);router['get'](_0x597a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x597a('0x10')]('/',auth[_0x597a('0xd')](),controller[_0x597a('0x11')]);router[_0x597a('0x12')]('/:id',auth[_0x597a('0xd')](),controller[_0x597a('0x13')]);router[_0x597a('0x14')](_0x597a('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x597a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 920bd39..de210cc 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 _0x11dc=['sequelize','moment','exports','ENUM','blind','STRING'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x11dc,0x156));var _0xc11d=function(_0x64bec,_0x37225c){_0x64bec=_0x64bec-0x0;var _0x46b9c6=_0x11dc[_0x64bec];return _0x46b9c6;};'use strict';var Sequelize=require(_0xc11d('0x0'));var moment=require(_0xc11d('0x1'));module[_0xc11d('0x2')]={'type':{'type':Sequelize[_0xc11d('0x3')](_0xc11d('0x4'),'attended')},'result':{'type':Sequelize[_0xc11d('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xc11d('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xc11d('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xc11d('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xc11d('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xc11d('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc11d('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc11d('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xc11d('0x5')]},'transfereecontext':{'type':Sequelize[_0xc11d('0x5')]},'transfereeexten':{'type':Sequelize[_0xc11d('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xc11d('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xc11d('0x5')]},'extension':{'type':Sequelize[_0xc11d('0x5')]}}; \ No newline at end of file +var _0xc817=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x4d7c86,_0x9b62a6){var _0x59443d=function(_0x5af971){while(--_0x5af971){_0x4d7c86['push'](_0x4d7c86['shift']());}};_0x59443d(++_0x9b62a6);}(_0xc817,0x1b9));var _0x7c81=function(_0xe11aeb,_0x7ac135){_0xe11aeb=_0xe11aeb-0x0;var _0x174cef=_0xc817[_0xe11aeb];return _0x174cef;};'use strict';var Sequelize=require(_0x7c81('0x0'));var moment=require(_0x7c81('0x1'));module[_0x7c81('0x2')]={'type':{'type':Sequelize[_0x7c81('0x3')](_0x7c81('0x4'),_0x7c81('0x5'))},'result':{'type':Sequelize[_0x7c81('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x7c81('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x7c81('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7c81('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x7c81('0x6')]},'transferercontext':{'type':Sequelize[_0x7c81('0x6')]},'transfererexten':{'type':Sequelize[_0x7c81('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x7c81('0x6')]},'transfereechannel':{'type':Sequelize[_0x7c81('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x7c81('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7c81('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x7c81('0x6')]},'transfereeexten':{'type':Sequelize[_0x7c81('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x7c81('0x6')]},'isexternal':{'type':Sequelize[_0x7c81('0x3')](_0x7c81('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e781932..08e6253 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 _0x72b0=['key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport'];(function(_0x259c4c,_0x155319){var _0xeb9acb=function(_0x4a4379){while(--_0x4a4379){_0x259c4c['push'](_0x259c4c['shift']());}};_0xeb9acb(++_0x155319);}(_0x72b0,0x18a));var _0x072b=function(_0x191bf5,_0x1dbfa7){_0x191bf5=_0x191bf5-0x0;var _0x3a466d=_0x72b0[_0x191bf5];return _0x3a466d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x072b('0x0'));var zipdir=require(_0x072b('0x1'));var jsonpatch=require(_0x072b('0x2'));var rp=require(_0x072b('0x3'));var moment=require(_0x072b('0x4'));var BPromise=require(_0x072b('0x5'));var Mustache=require('mustache');var util=require(_0x072b('0x6'));var path=require(_0x072b('0x7'));var sox=require(_0x072b('0x8'));var csv=require(_0x072b('0x9'));var ejs=require(_0x072b('0xa'));var fs=require('fs');var fs_extra=require(_0x072b('0xb'));var _=require(_0x072b('0xc'));var squel=require('squel');var crypto=require(_0x072b('0xd'));var jsforce=require(_0x072b('0xe'));var deskjs=require(_0x072b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x072b('0x10'));var Papa=require(_0x072b('0x11'));var Redis=require('ioredis');var authService=require(_0x072b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x072b('0x13'));var logger=require(_0x072b('0x14'))(_0x072b('0x15'));var utils=require(_0x072b('0x16'));var config=require(_0x072b('0x17'));var licenseUtil=require(_0x072b('0x18'));var db=require(_0x072b('0x19'))['db'];function respondWithStatusCode(_0x417714,_0x3986db){_0x3986db=_0x3986db||0xcc;return function(_0x3c2863){if(_0x3c2863){return _0x417714[_0x072b('0x1a')](_0x3986db);}return _0x417714[_0x072b('0x1b')](_0x3986db)['end']();};}function respondWithResult(_0x4cc3ff,_0x441733){_0x441733=_0x441733||0xc8;return function(_0x352b70){if(_0x352b70){return _0x4cc3ff[_0x072b('0x1b')](_0x441733)[_0x072b('0x1c')](_0x352b70);}};}function respondWithFilteredResult(_0x1e898d,_0x331170){return function(_0xb2fe60){if(_0xb2fe60){var _0x21cd40=typeof _0x331170[_0x072b('0x1d')]==='undefined'&&typeof _0x331170['limit']==='undefined';var _0x4529d3=_0xb2fe60[_0x072b('0x1e')];var _0x5ebd0a=_0x21cd40?0x0:_0x331170[_0x072b('0x1d')];var _0x387131=_0x21cd40?_0xb2fe60[_0x072b('0x1e')]:_0x331170[_0x072b('0x1d')]+_0x331170['limit'];var _0x55db79;if(_0x387131>=_0x4529d3){_0x387131=_0x4529d3;_0x55db79=0xc8;}else{_0x55db79=0xce;}_0x1e898d[_0x072b('0x1b')](_0x55db79);return _0x1e898d['set'](_0x072b('0x1f'),_0x5ebd0a+'-'+_0x387131+'/'+_0x4529d3)[_0x072b('0x1c')](_0xb2fe60);}return null;};}function patchUpdates(_0x364d29){return function(_0x395fbc){try{jsonpatch[_0x072b('0x20')](_0x395fbc,_0x364d29,!![]);}catch(_0x227db3){return BPromise[_0x072b('0x21')](_0x227db3);}return _0x395fbc['save']();};}function saveUpdates(_0x5c8cd4,_0x4f400d){return function(_0x5e28e7){if(_0x5e28e7){return _0x5e28e7[_0x072b('0x22')](_0x5c8cd4)[_0x072b('0x23')](function(_0x465f4b){return _0x465f4b;});}return null;};}function removeEntity(_0x5a4970,_0x4f245a){return function(_0x4f8feb){if(_0x4f8feb){return _0x4f8feb[_0x072b('0x24')]()[_0x072b('0x23')](function(){_0x5a4970[_0x072b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x400826,_0x3bbfd9){return function(_0x167ccd){if(!_0x167ccd){_0x400826[_0x072b('0x1a')](0x194);}return _0x167ccd;};}function handleError(_0x5b8431,_0x2aa60e){_0x2aa60e=_0x2aa60e||0x1f4;return function(_0x39a080){logger[_0x072b('0x25')](_0x39a080[_0x072b('0x26')]);if(_0x39a080['name']){delete _0x39a080[_0x072b('0x27')];}_0x5b8431[_0x072b('0x1b')](_0x2aa60e)[_0x072b('0x28')](_0x39a080);};}exports[_0x072b('0x29')]=function(_0x22deeb,_0x4396d8){var _0x1f77b4={},_0x3f805e={},_0x3b6674={'count':0x0,'rows':[]};var _0x2321bf=_[_0x072b('0x2a')](db[_0x072b('0x2b')]['rawAttributes'],function(_0x1c6176){return{'name':_0x1c6176['fieldName'],'type':_0x1c6176['type'][_0x072b('0x2c')]};});_0x3f805e[_0x072b('0x2d')]=_['map'](_0x2321bf,_0x072b('0x27'));_0x3f805e[_0x072b('0x2e')]=_['keys'](_0x22deeb[_0x072b('0x2e')]);_0x3f805e[_0x072b('0x2f')]=_['intersection'](_0x3f805e[_0x072b('0x2d')],_0x3f805e['query']);_0x1f77b4['attributes']=_[_0x072b('0x30')](_0x3f805e[_0x072b('0x2d')],qs[_0x072b('0x31')](_0x22deeb[_0x072b('0x2e')][_0x072b('0x31')]));_0x1f77b4[_0x072b('0x32')]=_0x1f77b4[_0x072b('0x32')][_0x072b('0x33')]?_0x1f77b4[_0x072b('0x32')]:_0x3f805e['model'];if(!_0x22deeb['query']['hasOwnProperty'](_0x072b('0x34'))){_0x1f77b4['limit']=qs[_0x072b('0x35')](_0x22deeb['query'][_0x072b('0x35')]);_0x1f77b4[_0x072b('0x1d')]=qs['offset'](_0x22deeb[_0x072b('0x2e')][_0x072b('0x1d')]);}_0x1f77b4[_0x072b('0x36')]=qs[_0x072b('0x37')](_0x22deeb[_0x072b('0x2e')]['sort']);_0x1f77b4[_0x072b('0x38')]=qs[_0x072b('0x2f')](_['pick'](_0x22deeb[_0x072b('0x2e')],_0x3f805e[_0x072b('0x2f')]),_0x2321bf);if(_0x22deeb[_0x072b('0x2e')][_0x072b('0x39')]){_0x1f77b4['where']=_[_0x072b('0x3a')](_0x1f77b4[_0x072b('0x38')],{'$or':_[_0x072b('0x2a')](_0x2321bf,function(_0x4a9e0e){if(_0x4a9e0e['type']!==_0x072b('0x3b')){var _0x372e90={};_0x372e90[_0x4a9e0e[_0x072b('0x27')]]={'$like':'%'+_0x22deeb[_0x072b('0x2e')][_0x072b('0x39')]+'%'};return _0x372e90;}})});}_0x1f77b4=_[_0x072b('0x3a')]({},_0x1f77b4,_0x22deeb['options']);var _0x539df1={'where':_0x1f77b4[_0x072b('0x38')]};return db[_0x072b('0x2b')][_0x072b('0x1e')](_0x539df1)[_0x072b('0x23')](function(_0x1cd411){_0x3b6674[_0x072b('0x1e')]=_0x1cd411;if(_0x22deeb[_0x072b('0x2e')][_0x072b('0x3c')]){_0x1f77b4[_0x072b('0x3d')]=[{'all':!![]}];}return db[_0x072b('0x2b')][_0x072b('0x3e')](_0x1f77b4);})[_0x072b('0x23')](function(_0x5e49d3){_0x3b6674[_0x072b('0x3f')]=_0x5e49d3;return _0x3b6674;})[_0x072b('0x23')](respondWithFilteredResult(_0x4396d8,_0x1f77b4))[_0x072b('0x40')](handleError(_0x4396d8,null));};exports['show']=function(_0x172995,_0x443edb){var _0x93ab05={'raw':!![],'where':{'id':_0x172995['params']['id']}},_0x51eb88={};_0x51eb88[_0x072b('0x2d')]=_[_0x072b('0x41')](db[_0x072b('0x2b')][_0x072b('0x42')]);_0x51eb88[_0x072b('0x2e')]=_[_0x072b('0x41')](_0x172995[_0x072b('0x2e')]);_0x51eb88[_0x072b('0x2f')]=_[_0x072b('0x30')](_0x51eb88[_0x072b('0x2d')],_0x51eb88['query']);_0x93ab05['attributes']=_[_0x072b('0x30')](_0x51eb88[_0x072b('0x2d')],qs[_0x072b('0x31')](_0x172995['query'][_0x072b('0x31')]));_0x93ab05[_0x072b('0x32')]=_0x93ab05[_0x072b('0x32')]['length']?_0x93ab05[_0x072b('0x32')]:_0x51eb88[_0x072b('0x2d')];if(_0x172995[_0x072b('0x2e')][_0x072b('0x3c')]){_0x93ab05[_0x072b('0x3d')]=[{'all':!![]}];}_0x93ab05=_[_0x072b('0x3a')]({},_0x93ab05,_0x172995[_0x072b('0x43')]);return db['VoiceTransferReport']['find'](_0x93ab05)[_0x072b('0x23')](handleEntityNotFound(_0x443edb,null))['then'](respondWithResult(_0x443edb,null))[_0x072b('0x40')](handleError(_0x443edb,null));};exports[_0x072b('0x44')]=function(_0x4959a1,_0xcbc537){return db['VoiceTransferReport'][_0x072b('0x44')](_0x4959a1['body'],{})['then'](respondWithResult(_0xcbc537,0xc9))['catch'](handleError(_0xcbc537,null));};exports['update']=function(_0x4e1496,_0x48335b){if(_0x4e1496[_0x072b('0x45')]['id']){delete _0x4e1496['body']['id'];}return db[_0x072b('0x2b')][_0x072b('0x46')]({'where':{'id':_0x4e1496[_0x072b('0x47')]['id']}})['then'](handleEntityNotFound(_0x48335b,null))[_0x072b('0x23')](saveUpdates(_0x4e1496[_0x072b('0x45')],null))[_0x072b('0x23')](respondWithResult(_0x48335b,null))[_0x072b('0x40')](handleError(_0x48335b,null));};exports[_0x072b('0x24')]=function(_0x306803,_0x3dc5fd){return db[_0x072b('0x2b')][_0x072b('0x46')]({'where':{'id':_0x306803[_0x072b('0x47')]['id']}})[_0x072b('0x23')](handleEntityNotFound(_0x3dc5fd,null))[_0x072b('0x23')](removeEntity(_0x3dc5fd,null))[_0x072b('0x40')](handleError(_0x3dc5fd,null));};exports[_0x072b('0x48')]=function(_0x6c3ced,_0x572976){return db[_0x072b('0x2b')][_0x072b('0x48')]()['then'](respondWithResult(_0x572976,null))[_0x072b('0x40')](handleError(_0x572976,null));}; \ No newline at end of file +var _0x02e1=['merge','options','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0xc07bc6,_0x3f0045){var _0x570a45=function(_0x1961f1){while(--_0x1961f1){_0xc07bc6['push'](_0xc07bc6['shift']());}};_0x570a45(++_0x3f0045);}(_0x02e1,0x145));var _0x102e=function(_0x114a0a,_0x445be4){_0x114a0a=_0x114a0a-0x0;var _0x2541e3=_0x02e1[_0x114a0a];return _0x2541e3;};'use strict';var emlformat=require(_0x102e('0x0'));var rimraf=require(_0x102e('0x1'));var zipdir=require(_0x102e('0x2'));var jsonpatch=require(_0x102e('0x3'));var rp=require(_0x102e('0x4'));var moment=require(_0x102e('0x5'));var BPromise=require(_0x102e('0x6'));var Mustache=require(_0x102e('0x7'));var util=require('util');var path=require(_0x102e('0x8'));var sox=require(_0x102e('0x9'));var csv=require(_0x102e('0xa'));var ejs=require(_0x102e('0xb'));var fs=require('fs');var fs_extra=require(_0x102e('0xc'));var _=require(_0x102e('0xd'));var squel=require('squel');var crypto=require(_0x102e('0xe'));var jsforce=require(_0x102e('0xf'));var deskjs=require(_0x102e('0x10'));var toCsv=require(_0x102e('0xa'));var querystring=require(_0x102e('0x11'));var Papa=require(_0x102e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x102e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x102e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x102e('0x15'));var config=require(_0x102e('0x16'));var licenseUtil=require(_0x102e('0x17'));var db=require(_0x102e('0x18'))['db'];function respondWithStatusCode(_0x5361a9,_0x26e081){_0x26e081=_0x26e081||0xcc;return function(_0x1c37f1){if(_0x1c37f1){return _0x5361a9[_0x102e('0x19')](_0x26e081);}return _0x5361a9[_0x102e('0x1a')](_0x26e081)['end']();};}function respondWithResult(_0x23cf70,_0x695a6){_0x695a6=_0x695a6||0xc8;return function(_0xe67f91){if(_0xe67f91){return _0x23cf70['status'](_0x695a6)[_0x102e('0x1b')](_0xe67f91);}};}function respondWithFilteredResult(_0x38bf17,_0x3d78a3){return function(_0x3d7037){if(_0x3d7037){var _0x3a230a=typeof _0x3d78a3[_0x102e('0x1c')]===_0x102e('0x1d')&&typeof _0x3d78a3[_0x102e('0x1e')]==='undefined';var _0x378b55=_0x3d7037[_0x102e('0x1f')];var _0x20583b=_0x3a230a?0x0:_0x3d78a3[_0x102e('0x1c')];var _0x51ac49=_0x3a230a?_0x3d7037[_0x102e('0x1f')]:_0x3d78a3[_0x102e('0x1c')]+_0x3d78a3[_0x102e('0x1e')];var _0x447406;if(_0x51ac49>=_0x378b55){_0x51ac49=_0x378b55;_0x447406=0xc8;}else{_0x447406=0xce;}_0x38bf17[_0x102e('0x1a')](_0x447406);return _0x38bf17[_0x102e('0x20')](_0x102e('0x21'),_0x20583b+'-'+_0x51ac49+'/'+_0x378b55)['json'](_0x3d7037);}return null;};}function patchUpdates(_0x1efd10){return function(_0x3e6df2){try{jsonpatch[_0x102e('0x22')](_0x3e6df2,_0x1efd10,!![]);}catch(_0x4542f2){return BPromise[_0x102e('0x23')](_0x4542f2);}return _0x3e6df2[_0x102e('0x24')]();};}function saveUpdates(_0x551ef9,_0xb05dc5){return function(_0x325f3d){if(_0x325f3d){return _0x325f3d[_0x102e('0x25')](_0x551ef9)['then'](function(_0x30ef1b){return _0x30ef1b;});}return null;};}function removeEntity(_0x18eb23,_0x625240){return function(_0x2297c7){if(_0x2297c7){return _0x2297c7[_0x102e('0x26')]()[_0x102e('0x27')](function(){_0x18eb23['status'](0xcc)[_0x102e('0x28')]();});}};}function handleEntityNotFound(_0x31e055,_0x7cf5a1){return function(_0x3522c2){if(!_0x3522c2){_0x31e055[_0x102e('0x19')](0x194);}return _0x3522c2;};}function handleError(_0x534c2d,_0x59d5de){_0x59d5de=_0x59d5de||0x1f4;return function(_0x330ebe){logger[_0x102e('0x29')](_0x330ebe['stack']);if(_0x330ebe[_0x102e('0x2a')]){delete _0x330ebe['name'];}_0x534c2d[_0x102e('0x1a')](_0x59d5de)[_0x102e('0x2b')](_0x330ebe);};}exports[_0x102e('0x2c')]=function(_0x14d31b,_0x422217){var _0x3b95bb={},_0xe98b27={},_0x56c829={'count':0x0,'rows':[]};var _0x5c011a=_[_0x102e('0x2d')](db[_0x102e('0x2e')]['rawAttributes'],function(_0xc97846){return{'name':_0xc97846[_0x102e('0x2f')],'type':_0xc97846[_0x102e('0x30')][_0x102e('0x31')]};});_0xe98b27[_0x102e('0x32')]=_[_0x102e('0x2d')](_0x5c011a,'name');_0xe98b27[_0x102e('0x33')]=_[_0x102e('0x34')](_0x14d31b['query']);_0xe98b27[_0x102e('0x35')]=_[_0x102e('0x36')](_0xe98b27[_0x102e('0x32')],_0xe98b27[_0x102e('0x33')]);_0x3b95bb[_0x102e('0x37')]=_[_0x102e('0x36')](_0xe98b27['model'],qs[_0x102e('0x38')](_0x14d31b[_0x102e('0x33')][_0x102e('0x38')]));_0x3b95bb[_0x102e('0x37')]=_0x3b95bb['attributes'][_0x102e('0x39')]?_0x3b95bb[_0x102e('0x37')]:_0xe98b27[_0x102e('0x32')];if(!_0x14d31b[_0x102e('0x33')][_0x102e('0x3a')](_0x102e('0x3b'))){_0x3b95bb[_0x102e('0x1e')]=qs[_0x102e('0x1e')](_0x14d31b[_0x102e('0x33')]['limit']);_0x3b95bb[_0x102e('0x1c')]=qs[_0x102e('0x1c')](_0x14d31b[_0x102e('0x33')][_0x102e('0x1c')]);}_0x3b95bb[_0x102e('0x3c')]=qs[_0x102e('0x3d')](_0x14d31b[_0x102e('0x33')]['sort']);_0x3b95bb['where']=qs[_0x102e('0x35')](_[_0x102e('0x3e')](_0x14d31b[_0x102e('0x33')],_0xe98b27[_0x102e('0x35')]),_0x5c011a);if(_0x14d31b[_0x102e('0x33')][_0x102e('0x3f')]){_0x3b95bb['where']=_['merge'](_0x3b95bb[_0x102e('0x40')],{'$or':_['map'](_0x5c011a,function(_0x5e5807){if(_0x5e5807[_0x102e('0x30')]!=='VIRTUAL'){var _0x598d0c={};_0x598d0c[_0x5e5807[_0x102e('0x2a')]]={'$like':'%'+_0x14d31b[_0x102e('0x33')]['filter']+'%'};return _0x598d0c;}})});}_0x3b95bb=_[_0x102e('0x41')]({},_0x3b95bb,_0x14d31b[_0x102e('0x42')]);var _0x308036={'where':_0x3b95bb[_0x102e('0x40')]};return db[_0x102e('0x2e')][_0x102e('0x1f')](_0x308036)[_0x102e('0x27')](function(_0x25f22d){_0x56c829[_0x102e('0x1f')]=_0x25f22d;if(_0x14d31b[_0x102e('0x33')]['includeAll']){_0x3b95bb[_0x102e('0x43')]=[{'all':!![]}];}return db[_0x102e('0x2e')][_0x102e('0x44')](_0x3b95bb);})[_0x102e('0x27')](function(_0x5ba7bf){_0x56c829[_0x102e('0x45')]=_0x5ba7bf;return _0x56c829;})[_0x102e('0x27')](respondWithFilteredResult(_0x422217,_0x3b95bb))[_0x102e('0x46')](handleError(_0x422217,null));};exports[_0x102e('0x47')]=function(_0x30bfff,_0x13d264){var _0x392658={'raw':!![],'where':{'id':_0x30bfff[_0x102e('0x48')]['id']}},_0x1ed85d={};_0x1ed85d['model']=_[_0x102e('0x34')](db[_0x102e('0x2e')][_0x102e('0x49')]);_0x1ed85d[_0x102e('0x33')]=_[_0x102e('0x34')](_0x30bfff[_0x102e('0x33')]);_0x1ed85d[_0x102e('0x35')]=_[_0x102e('0x36')](_0x1ed85d[_0x102e('0x32')],_0x1ed85d[_0x102e('0x33')]);_0x392658['attributes']=_[_0x102e('0x36')](_0x1ed85d[_0x102e('0x32')],qs[_0x102e('0x38')](_0x30bfff[_0x102e('0x33')]['fields']));_0x392658['attributes']=_0x392658[_0x102e('0x37')]['length']?_0x392658['attributes']:_0x1ed85d['model'];if(_0x30bfff[_0x102e('0x33')]['includeAll']){_0x392658['include']=[{'all':!![]}];}_0x392658=_[_0x102e('0x41')]({},_0x392658,_0x30bfff[_0x102e('0x42')]);return db['VoiceTransferReport']['find'](_0x392658)['then'](handleEntityNotFound(_0x13d264,null))['then'](respondWithResult(_0x13d264,null))[_0x102e('0x46')](handleError(_0x13d264,null));};exports[_0x102e('0x4a')]=function(_0x516a94,_0x245e32){return db[_0x102e('0x2e')][_0x102e('0x4a')](_0x516a94[_0x102e('0x4b')],{})[_0x102e('0x27')](respondWithResult(_0x245e32,0xc9))[_0x102e('0x46')](handleError(_0x245e32,null));};exports[_0x102e('0x25')]=function(_0x352699,_0x2ffefb){if(_0x352699[_0x102e('0x4b')]['id']){delete _0x352699[_0x102e('0x4b')]['id'];}return db[_0x102e('0x2e')][_0x102e('0x4c')]({'where':{'id':_0x352699[_0x102e('0x48')]['id']}})[_0x102e('0x27')](handleEntityNotFound(_0x2ffefb,null))[_0x102e('0x27')](saveUpdates(_0x352699['body'],null))[_0x102e('0x27')](respondWithResult(_0x2ffefb,null))[_0x102e('0x46')](handleError(_0x2ffefb,null));};exports[_0x102e('0x26')]=function(_0x22ecad,_0x38699a){return db[_0x102e('0x2e')][_0x102e('0x4c')]({'where':{'id':_0x22ecad[_0x102e('0x48')]['id']}})['then'](handleEntityNotFound(_0x38699a,null))['then'](removeEntity(_0x38699a,null))['catch'](handleError(_0x38699a,null));};exports[_0x102e('0x4d')]=function(_0x1a4209,_0xe7f553){return db['VoiceTransferReport'][_0x102e('0x4d')]()[_0x102e('0x27')](respondWithResult(_0xe7f553,null))[_0x102e('0x46')](handleError(_0xe7f553,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index bb6ceff..884b85c 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 _0xbacd=['report_call_transfer','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceTransferReport'];(function(_0x2e897d,_0xded2d1){var _0x31fddb=function(_0x192774){while(--_0x192774){_0x2e897d['push'](_0x2e897d['shift']());}};_0x31fddb(++_0xded2d1);}(_0xbacd,0x114));var _0xdbac=function(_0x5753fd,_0x14a318){_0x5753fd=_0x5753fd-0x0;var _0x557faa=_0xbacd[_0x5753fd];return _0x557faa;};'use strict';var _=require('lodash');var util=require(_0xdbac('0x0'));var logger=require('../../config/logger')(_0xdbac('0x1'));var moment=require(_0xdbac('0x2'));var BPromise=require(_0xdbac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbac('0x4'));var rimraf=require(_0xdbac('0x5'));var config=require(_0xdbac('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xdbac('0x7')]=function(_0x5bc8bb,_0x1b6e04){return _0x5bc8bb[_0xdbac('0x8')](_0xdbac('0x9'),attributes,{'tableName':_0xdbac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c04=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8c04,0x14d));var _0x48c0=function(_0x46c3c2,_0x16566f){_0x46c3c2=_0x46c3c2-0x0;var _0x572aab=_0x8c04[_0x46c3c2];return _0x572aab;};'use strict';var _=require(_0x48c0('0x0'));var util=require(_0x48c0('0x1'));var logger=require(_0x48c0('0x2'))(_0x48c0('0x3'));var moment=require(_0x48c0('0x4'));var BPromise=require(_0x48c0('0x5'));var rp=require(_0x48c0('0x6'));var fs=require('fs');var path=require(_0x48c0('0x7'));var rimraf=require(_0x48c0('0x8'));var config=require(_0x48c0('0x9'));var attributes=require('./voiceTransferReport.attributes');module[_0x48c0('0xa')]=function(_0x47ee41,_0xfd2e32){return _0x47ee41[_0x48c0('0xb')]('VoiceTransferReport',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 b43a315..aecd746 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 _0x3fec=['raw','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options'];(function(_0x2923e0,_0xe88675){var _0x1b780e=function(_0x26b804){while(--_0x26b804){_0x2923e0['push'](_0x2923e0['shift']());}};_0x1b780e(++_0xe88675);}(_0x3fec,0x79));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc3fe('0x0'));var util=require(_0xc3fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3fe('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3fe('0x3'));var logger=require(_0xc3fe('0x4'))(_0xc3fe('0x5'));var config=require(_0xc3fe('0x6'));var jayson=require(_0xc3fe('0x7'));var client=jayson['client'][_0xc3fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5725f3,_0x509825,_0x4a1ef2){return new BPromise(function(_0x5b8a29,_0x333fa3){return client['request'](_0x5725f3,_0x4a1ef2)['then'](function(_0x317356){logger[_0xc3fe('0x9')](_0xc3fe('0xa'),_0x509825,'request\x20sent');logger[_0xc3fe('0xb')](_0xc3fe('0xc'),_0x509825,_0xc3fe('0xd'),JSON['stringify'](_0x317356));if(_0x317356[_0xc3fe('0xe')]){if(_0x317356[_0xc3fe('0xe')][_0xc3fe('0xf')]===0x1f4){logger['error'](_0xc3fe('0xa'),_0x509825,_0x317356[_0xc3fe('0xe')]['message']);return _0x333fa3(_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);}logger[_0xc3fe('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x509825,_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);return _0x5b8a29(_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);}else{logger[_0xc3fe('0x9')](_0xc3fe('0xa'),_0x509825,_0xc3fe('0xd'));_0x5b8a29(_0x317356[_0xc3fe('0x11')]['message']);}})[_0xc3fe('0x12')](function(_0x2401af){logger[_0xc3fe('0xe')](_0xc3fe('0xa'),_0x509825,_0x2401af);_0x333fa3(_0x2401af);});});}exports[_0xc3fe('0x13')]=function(_0xe5cb83){var _0x1bba78=this;return new Promise(function(_0x27428f,_0x465b10){return db[_0xc3fe('0x14')]['create'](_0xe5cb83[_0xc3fe('0x15')],{'raw':_0xe5cb83[_0xc3fe('0x16')]?_0xe5cb83['options'][_0xc3fe('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x50c77c){logger[_0xc3fe('0x9')](_0xc3fe('0x13'),_0xe5cb83);logger[_0xc3fe('0xb')]('CreateVoiceTransferReport',_0xe5cb83,JSON['stringify'](_0x50c77c));_0x27428f(_0x50c77c);})[_0xc3fe('0x12')](function(_0x15d1b1){logger[_0xc3fe('0xe')](_0xc3fe('0x13'),_0x15d1b1[_0xc3fe('0x10')],_0xe5cb83);_0x465b10(_0x1bba78[_0xc3fe('0xe')](0x1f4,_0x15d1b1['message']));});});}; \ No newline at end of file +var _0xc000=['info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1005cf,_0x19a257){var _0x527c9b=function(_0x267fb9){while(--_0x267fb9){_0x1005cf['push'](_0x1005cf['shift']());}};_0x527c9b(++_0x19a257);}(_0xc000,0xef));var _0x0c00=function(_0x160b0e,_0x2ee575){_0x160b0e=_0x160b0e-0x0;var _0x396ba4=_0xc000[_0x160b0e];return _0x396ba4;};'use strict';var _=require(_0x0c00('0x0'));var util=require(_0x0c00('0x1'));var moment=require(_0x0c00('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c00('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c00('0x4'));var logger=require(_0x0c00('0x5'))(_0x0c00('0x6'));var config=require(_0x0c00('0x7'));var jayson=require(_0x0c00('0x8'));var client=jayson[_0x0c00('0x9')][_0x0c00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x816919,_0x292684,_0x537f45){return new BPromise(function(_0x4839d2,_0x12265e){return client[_0x0c00('0xb')](_0x816919,_0x537f45)[_0x0c00('0xc')](function(_0x316b08){logger[_0x0c00('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x292684,_0x0c00('0xe'));logger['debug'](_0x0c00('0xf'),_0x292684,'request\x20sent',JSON[_0x0c00('0x10')](_0x316b08));if(_0x316b08[_0x0c00('0x11')]){if(_0x316b08[_0x0c00('0x11')][_0x0c00('0x12')]===0x1f4){logger[_0x0c00('0x11')](_0x0c00('0x13'),_0x292684,_0x316b08[_0x0c00('0x11')][_0x0c00('0x14')]);return _0x12265e(_0x316b08[_0x0c00('0x11')][_0x0c00('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x292684,_0x316b08[_0x0c00('0x11')][_0x0c00('0x14')]);return _0x4839d2(_0x316b08[_0x0c00('0x11')]['message']);}else{logger['info'](_0x0c00('0x13'),_0x292684,'request\x20sent');_0x4839d2(_0x316b08[_0x0c00('0x15')]['message']);}})['catch'](function(_0xd3d875){logger[_0x0c00('0x11')](_0x0c00('0x13'),_0x292684,_0xd3d875);_0x12265e(_0xd3d875);});});}exports['CreateVoiceTransferReport']=function(_0x52af01){var _0x82422f=this;return new Promise(function(_0x1c1952,_0x2283b8){return db[_0x0c00('0x16')][_0x0c00('0x17')](_0x52af01['body'],{'raw':_0x52af01[_0x0c00('0x18')]?_0x52af01[_0x0c00('0x18')][_0x0c00('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12ed2a){logger[_0x0c00('0xd')](_0x0c00('0x1a'),_0x52af01);logger['debug'](_0x0c00('0x1a'),_0x52af01,JSON[_0x0c00('0x10')](_0x12ed2a));_0x1c1952(_0x12ed2a);})[_0x0c00('0x1b')](function(_0x4be3d9){logger[_0x0c00('0x11')](_0x0c00('0x1a'),_0x4be3d9[_0x0c00('0x14')],_0x52af01);_0x2283b8(_0x82422f[_0x0c00('0x11')](0x1f4,_0x4be3d9['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ab301ef..838ef5f 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 _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x4663cf,_0x4045b2){var _0x5e7f76=function(_0x1e01ae){while(--_0x1e01ae){_0x4663cf['push'](_0x4663cf['shift']());}};_0x5e7f76(++_0x4045b2);}(_0x9bde,0xe1));var _0xe9bd=function(_0x43abb0,_0x319ea3){_0x43abb0=_0x43abb0-0x0;var _0x5e14ae=_0x9bde[_0x43abb0];return _0x5e14ae;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0x34e8,0x12c));var _0x834e=function(_0x3f3610,_0x8bc998){_0x3f3610=_0x3f3610-0x0;var _0x1eeb6d=_0x34e8[_0x3f3610];return _0x1eeb6d;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 045c0a2..c69f731 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 _0xbf6e=['bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','agent','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','../../config/environment','util'];(function(_0x47c8a7,_0x1706cc){var _0x350704=function(_0x6b483f){while(--_0x6b483f){_0x47c8a7['push'](_0x47c8a7['shift']());}};_0x350704(++_0x1706cc);}(_0xbf6e,0x149));var _0xebf6=function(_0x1f1611,_0x8e92b0){_0x1f1611=_0x1f1611-0x0;var _0xd79ac6=_0xbf6e[_0x1f1611];return _0xd79ac6;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xebf6('0x0'))['db'];var config=require(_0xebf6('0x1'));var util=require(_0xebf6('0x2'));var BPromise=require(_0xebf6('0x3'));var jayson=require(_0xebf6('0x4'));var amiClient=jayson[_0xebf6('0x5')][_0xebf6('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0xebf6('0x7'));var Redis=require(_0xebf6('0x8'));config[_0xebf6('0x9')]=_[_0xebf6('0xa')](config[_0xebf6('0x9')],{'host':_0xebf6('0xb'),'port':0x18eb});var io=require(_0xebf6('0xc'))(new Redis(config['redis']));var Schema=require(_0xebf6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'callNumber':{'type':'string','required':[!![],_0xebf6('0x10')]},'callerId':{'type':_0xebf6('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xebf6('0x11'),'required':[!![],_0xebf6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xebf6('0xf')]}});function emit(_0x2c980f,_0xb164a1,_0x642167){logger[_0xebf6('0x13')](_0x2c980f,_0xb164a1,JSON[_0xebf6('0x14')](_0x642167));io['to'](_0x2c980f)[_0xebf6('0x15')](_0xb164a1,_0x642167);}function handleError(_0x2dc96f){return function(_0x2d3984){console[_0xebf6('0x16')]('handleError:',_0x2d3984,_0x2d3984 instanceof RangeError);logger['error'](_0x2d3984[_0xebf6('0x17')]);if(_0x2d3984 instanceof RangeError){if(_0x2d3984[_0xebf6('0x18')]){delete _0x2d3984[_0xebf6('0x18')];}_0x2dc96f[_0xebf6('0x19')](0x194)[_0xebf6('0x1a')](_0x2d3984);}else{if(_0x2d3984[_0xebf6('0x18')]){delete _0x2d3984[_0xebf6('0x18')];}_0x2dc96f[_0xebf6('0x19')](0x1f4)['send'](_0x2d3984);}};}function checkError(){return function(_0xbe39dd){if(!_0xbe39dd){throw new RangeError(_0xebf6('0x1b'));}return _0xbe39dd;};}function respondWithRpcPromise(_0x377934,_0x23d487){return new BPromise(function(_0x6303ac,_0x14c8ac){var _0x2f419e=amiClient;return _0x2f419e[_0xebf6('0x1c')](_0x377934,_0x23d487)[_0xebf6('0x1d')](function(_0x2e32c6){if(_0x2e32c6[_0xebf6('0x1e')]){if(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x1f')]===0x1f4){return _0x14c8ac(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x20')]);}return _0x6303ac(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x20')]);}else{_0x6303ac(_0x2e32c6[_0xebf6('0x21')]);}})[_0xebf6('0x22')](function(_0x4dadf7){_0x14c8ac(_0x4dadf7);});});}function getAgent(_0x58fb66){return db[_0xebf6('0x23')]['findOne']({'where':{'id':_0x58fb66,'role':_0xebf6('0x24')}})[_0xebf6('0x1d')](checkError());}function getAgentCheckSession(_0x5a01ea,_0x4f39eb){return new BPromise(function(_0x37950c,_0x40ae57){var _0x3c3d5c=respondWithRpcPromise(_0xebf6('0x25'));var _0xedaaeb=getAgent(_0x5a01ea);Promise[_0xebf6('0x26')]([_0x3c3d5c,_0xedaaeb])[_0xebf6('0x1d')](function(_0x7551ce){var _0x4c3495=_0x7551ce[0x0];var _0x37cd67=_0x7551ce[0x1];var _0x78cdf0=_['filter'](_0x4c3495[_0xebf6('0x27')],function(_0x28bbea){return _0x28bbea['UserId']==_0x37cd67['id']&&_0x28bbea[_0xebf6('0x28')]==_0x4f39eb;});if(_0x78cdf0[_0xebf6('0x29')]==0x1){_0x37950c(_0x37cd67);}else{_0x40ae57(new RangeError(_0xebf6('0x2a')+_0x4f39eb+_0xebf6('0x2b')));}});});}exports[_0xebf6('0x2c')]=function(_0x41da63,_0x4907d0){logger[_0xebf6('0x13')](_0xebf6('0x2d'),_0x41da63['body']);var _0x534142=originateValidation[_0xebf6('0xd')](_0x41da63[_0xebf6('0x2e')]);if(_0x534142['length']>0x0){return _0x4907d0[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x534142);}var _0x4d736c=_0x41da63[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x12bd27=_0x41da63['body'][_0xebf6('0x31')];var _0x20192c=_0x41da63[_0xebf6('0x2e')][_0xebf6('0x32')];var _0x4b6d95=_0x41da63['body'][_0xebf6('0x33')];return getAgent(_0x4d736c)[_0xebf6('0x1d')](function(_0x562f76){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x562f76['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x562f76[_0xebf6('0x18')]),_0xebf6('0x37'),{'callNumber':_0x12bd27,'callerId':_0x20192c,'callbackUrl':_0x4b6d95});return _0x4907d0[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x38')});})['catch'](handleError(_0x4907d0));};exports[_0xebf6('0x39')]=function(_0x54702d,_0xafef4d){logger[_0xebf6('0x13')](_0xebf6('0x3a'),_0x54702d[_0xebf6('0x2e')]);var _0x2f1236=hangupValidation[_0xebf6('0xd')](_0x54702d['body']);if(_0x2f1236[_0xebf6('0x29')]>0x0){return _0xafef4d[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x2f1236);}var _0x144b41=_0x54702d[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x49f089=_0x54702d[_0xebf6('0x2e')][_0xebf6('0x28')];return getAgent(_0x144b41)[_0xebf6('0x1d')](function(_0x111ff7){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x111ff7['name']);emit(util['format']('user:%s',_0x111ff7[_0xebf6('0x18')]),_0xebf6('0x3b'),{'sessionId':_0x49f089});return _0xafef4d[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x3c')});})[_0xebf6('0x22')](handleError(_0xafef4d));};exports[_0xebf6('0x3d')]=function(_0x5ca582,_0x8cca55){logger[_0xebf6('0x13')]('answer\x20fired:',_0x5ca582[_0xebf6('0x2e')]);var _0x1de50e=answerValidation[_0xebf6('0xd')](_0x5ca582['body']);if(_0x1de50e[_0xebf6('0x29')]>0x0){return _0x8cca55['status'](0x190)['json'](_0x1de50e);}var _0x256552=_0x5ca582[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x2ac140=_0x5ca582['body'][_0xebf6('0x28')];return getAgent(_0x256552)['then'](function(_0x4483d2){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x4483d2[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')]('user:%s',_0x4483d2['name']),_0xebf6('0x3e'),{'sessionId':_0x2ac140});return _0x8cca55[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'error':![],'message':_0xebf6('0x3f')});})['catch'](handleError(_0x8cca55));};exports[_0xebf6('0x40')]=function(_0x21999e,_0x41c4ce){logger[_0xebf6('0x13')](_0xebf6('0x41'),_0x21999e[_0xebf6('0x2e')]);var _0x45e0f1=holdValidation['validate'](_0x21999e[_0xebf6('0x2e')]);if(_0x45e0f1[_0xebf6('0x29')]>0x0){return _0x41c4ce[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x45e0f1);}var _0x166664=_0x21999e[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x56b26b=_0x21999e[_0xebf6('0x2e')]['sessionId'];return getAgent(_0x166664)[_0xebf6('0x1d')](function(_0x31d8ba){logger['info'](_0xebf6('0x34'),_0x31d8ba['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x31d8ba[_0xebf6('0x18')]),_0xebf6('0x42'),{'sessionId':_0x56b26b});return _0x41c4ce[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x43')});})[_0xebf6('0x22')](handleError(_0x41c4ce));};exports['unhold']=function(_0x1f98fd,_0x2765f2){logger[_0xebf6('0x13')](_0xebf6('0x44'),_0x1f98fd[_0xebf6('0x2e')]);var _0x549892=unholdValidation[_0xebf6('0xd')](_0x1f98fd[_0xebf6('0x2e')]);if(_0x549892[_0xebf6('0x29')]>0x0){return _0x2765f2[_0xebf6('0x19')](0x190)['json'](_0x549892);}var _0x3629aa=_0x1f98fd[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x303997=_0x1f98fd[_0xebf6('0x2e')][_0xebf6('0x28')];return getAgent(_0x3629aa)[_0xebf6('0x1d')](function(_0x9184ce){logger[_0xebf6('0x13')]('entityFound:',_0x9184ce[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x9184ce['name']),_0xebf6('0x45'),{'sessionId':_0x303997});return _0x2765f2['status'](0xc8)['json']({'error':![],'message':_0xebf6('0x46')});})[_0xebf6('0x22')](handleError(_0x2765f2));};exports[_0xebf6('0x47')]=function(_0x32baee,_0x13c447){logger['info'](_0xebf6('0x48'),_0x13c447['body']);var _0x4ed306=callsValidation['validate'](_0x32baee[_0xebf6('0x2e')]);if(_0x4ed306[_0xebf6('0x29')]>0x0){return _0x13c447['status'](0x190)[_0xebf6('0x2f')](_0x4ed306);}var _0x151476=_0x32baee[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x3a4b20=respondWithRpcPromise(_0xebf6('0x25'));var _0x246f9f=getAgent(_0x151476);return Promise['all']([_0x3a4b20,_0x246f9f])[_0xebf6('0x1d')](function(_0xddf329){var _0x40d85f=_0xddf329[0x0];var _0x3101c2=_0xddf329[0x1];var _0x39637b=_[_0xebf6('0x49')](_0x40d85f['rows'],function(_0x44a46f){return _0x44a46f[_0xebf6('0x4a')]==_0x3101c2['id'];});return _0x13c447[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'count':_0x39637b[_0xebf6('0x29')],'rows':_0x39637b});})[_0xebf6('0x22')](handleError(_0x13c447));};exports['conference']=function(_0x33c973,_0x193e5b){logger[_0xebf6('0x13')](_0xebf6('0x4b'),_0x33c973[_0xebf6('0x2e')]);var _0x537751=conferenceValidation[_0xebf6('0xd')](_0x33c973[_0xebf6('0x2e')]);if(_0x537751[_0xebf6('0x29')]>0x0){return _0x193e5b[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x537751);}var _0x6c43e4=_0x33c973[_0xebf6('0x2e')][_0xebf6('0x30')];return getAgent(_0x6c43e4)[_0xebf6('0x1d')](function(_0x3debd2){logger[_0xebf6('0x13')]('entityFound:',_0x3debd2[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x3debd2[_0xebf6('0x18')]),_0xebf6('0x4c'));return _0x193e5b[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x4d')});})['catch'](handleError(_0x193e5b));};exports[_0xebf6('0x4e')]=function(_0x34fa02,_0x10272b){logger[_0xebf6('0x13')](_0xebf6('0x4f'),_0x34fa02[_0xebf6('0x2e')]);var _0x398074=transferValidation['validate'](_0x34fa02['body']);if(_0x398074[_0xebf6('0x29')]>0x0){return _0x10272b[_0xebf6('0x19')](0x190)['json'](_0x398074);}var _0x3dc02c=_0x34fa02[_0xebf6('0x2e')]['userId'];var _0x3bee09=_0x34fa02[_0xebf6('0x2e')]['sessionId'];var _0x35a5c4=_0x34fa02[_0xebf6('0x2e')][_0xebf6('0x50')];return getAgent(_0x3dc02c)[_0xebf6('0x1d')](function(_0x345763){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x345763['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x345763[_0xebf6('0x18')]),_0xebf6('0x51'),{'sessionId':_0x3bee09,'transferNumber':_0x35a5c4});return _0x10272b[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'error':![],'message':_0xebf6('0x52')});})[_0xebf6('0x22')](handleError(_0x10272b));}; \ No newline at end of file +var _0x8d9b=['sessionId','length','sessionId\x20','\x20not\x20found!','info','body','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','all','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','client','../../config/logger','webbarapi','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','User','findOne','agent','VoiceChannels','filter','rows','UserId'];(function(_0x57e10e,_0x10b329){var _0x210c2a=function(_0x373b7f){while(--_0x373b7f){_0x57e10e['push'](_0x57e10e['shift']());}};_0x210c2a(++_0x10b329);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xb8d9('0x0'));var fs=require('fs');var _=require(_0xb8d9('0x1'));var db=require(_0xb8d9('0x2'))['db'];var config=require(_0xb8d9('0x3'));var util=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xb8d9('0x5')]['http']({'port':0x232a});var logger=require(_0xb8d9('0x6'))(_0xb8d9('0x7'));var Redis=require('ioredis');config['redis']=_['defaults'](config[_0xb8d9('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xb8d9('0x9'));var originateValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'callNumber':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xd')]},'callerId':{'type':_0xb8d9('0xc')},'callbackUrl':{'type':_0xb8d9('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xe')]},'transferNumber':{'type':_0xb8d9('0xc'),'required':[!![],_0xb8d9('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':_0xb8d9('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb8d9('0xa'),'required':[!![],_0xb8d9('0xb')]}});function emit(_0x283780,_0x5081dc,_0x542141){logger['info'](_0x283780,_0x5081dc,JSON[_0xb8d9('0x10')](_0x542141));io['to'](_0x283780)[_0xb8d9('0x11')](_0x5081dc,_0x542141);}function handleError(_0x25e939){return function(_0x1183e4){console['log'](_0xb8d9('0x12'),_0x1183e4,_0x1183e4 instanceof RangeError);logger['error'](_0x1183e4[_0xb8d9('0x13')]);if(_0x1183e4 instanceof RangeError){if(_0x1183e4[_0xb8d9('0x14')]){delete _0x1183e4[_0xb8d9('0x14')];}_0x25e939[_0xb8d9('0x15')](0x194)[_0xb8d9('0x16')](_0x1183e4);}else{if(_0x1183e4['name']){delete _0x1183e4['name'];}_0x25e939['status'](0x1f4)[_0xb8d9('0x16')](_0x1183e4);}};}function checkError(){return function(_0x43071d){if(!_0x43071d){throw new RangeError(_0xb8d9('0x17'));}return _0x43071d;};}function respondWithRpcPromise(_0x32fd09,_0x3f4ea7){return new BPromise(function(_0x48c504,_0x963afa){var _0x430794=amiClient;return _0x430794[_0xb8d9('0x18')](_0x32fd09,_0x3f4ea7)[_0xb8d9('0x19')](function(_0x3cefe3){if(_0x3cefe3[_0xb8d9('0x1a')]){if(_0x3cefe3[_0xb8d9('0x1a')][_0xb8d9('0x1b')]===0x1f4){return _0x963afa(_0x3cefe3[_0xb8d9('0x1a')][_0xb8d9('0x1c')]);}return _0x48c504(_0x3cefe3['error'][_0xb8d9('0x1c')]);}else{_0x48c504(_0x3cefe3['result']);}})['catch'](function(_0x1eb6ee){_0x963afa(_0x1eb6ee);});});}function getAgent(_0x1b6e1e){return db[_0xb8d9('0x1d')][_0xb8d9('0x1e')]({'where':{'id':_0x1b6e1e,'role':_0xb8d9('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x241041,_0x282db6){return new BPromise(function(_0x3111aa,_0x4928c3){var _0x2d1439=respondWithRpcPromise(_0xb8d9('0x20'));var _0x336918=getAgent(_0x241041);Promise['all']([_0x2d1439,_0x336918])[_0xb8d9('0x19')](function(_0x12a043){var _0x523e6c=_0x12a043[0x0];var _0x344e27=_0x12a043[0x1];var _0x6cd7f6=_[_0xb8d9('0x21')](_0x523e6c[_0xb8d9('0x22')],function(_0x358e4d){return _0x358e4d[_0xb8d9('0x23')]==_0x344e27['id']&&_0x358e4d[_0xb8d9('0x24')]==_0x282db6;});if(_0x6cd7f6[_0xb8d9('0x25')]==0x1){_0x3111aa(_0x344e27);}else{_0x4928c3(new RangeError(_0xb8d9('0x26')+_0x282db6+_0xb8d9('0x27')));}});});}exports['originate']=function(_0x2097b0,_0x374def){logger[_0xb8d9('0x28')]('originate\x20fired:',_0x2097b0[_0xb8d9('0x29')]);var _0x79b29f=originateValidation[_0xb8d9('0x9')](_0x2097b0[_0xb8d9('0x29')]);if(_0x79b29f[_0xb8d9('0x25')]>0x0){return _0x374def[_0xb8d9('0x15')](0x190)['json'](_0x79b29f);}var _0x5a3c81=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0xaf13b=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2b')];var _0x32e83e=_0x2097b0['body']['callerId'];var _0x4425f3=_0x2097b0[_0xb8d9('0x29')][_0xb8d9('0x2c')];return getAgent(_0x5a3c81)['then'](function(_0x3866b2){logger['info'](_0xb8d9('0x2d'),_0x3866b2[_0xb8d9('0x14')]);emit(util[_0xb8d9('0x2e')]('user:%s',_0x3866b2[_0xb8d9('0x14')]),_0xb8d9('0x2f'),{'callNumber':_0xaf13b,'callerId':_0x32e83e,'callbackUrl':_0x4425f3});return _0x374def['status'](0xc8)['json']({'error':![],'message':_0xb8d9('0x30')});})[_0xb8d9('0x31')](handleError(_0x374def));};exports[_0xb8d9('0x32')]=function(_0x3b6f59,_0x43b0fb){logger[_0xb8d9('0x28')](_0xb8d9('0x33'),_0x3b6f59[_0xb8d9('0x29')]);var _0x926585=hangupValidation[_0xb8d9('0x9')](_0x3b6f59[_0xb8d9('0x29')]);if(_0x926585[_0xb8d9('0x25')]>0x0){return _0x43b0fb[_0xb8d9('0x15')](0x190)[_0xb8d9('0x34')](_0x926585);}var _0x593a22=_0x3b6f59['body'][_0xb8d9('0x2a')];var _0x2cba84=_0x3b6f59[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x593a22)['then'](function(_0x4b1d71){logger[_0xb8d9('0x28')]('entityFound:',_0x4b1d71[_0xb8d9('0x14')]);emit(util['format'](_0xb8d9('0x35'),_0x4b1d71['name']),_0xb8d9('0x36'),{'sessionId':_0x2cba84});return _0x43b0fb[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':'hangup\x20executed!'});})[_0xb8d9('0x31')](handleError(_0x43b0fb));};exports[_0xb8d9('0x37')]=function(_0x109d02,_0x5a07db){logger['info']('answer\x20fired:',_0x109d02['body']);var _0x4f7393=answerValidation[_0xb8d9('0x9')](_0x109d02[_0xb8d9('0x29')]);if(_0x4f7393[_0xb8d9('0x25')]>0x0){return _0x5a07db['status'](0x190)['json'](_0x4f7393);}var _0x142e54=_0x109d02['body'][_0xb8d9('0x2a')];var _0x25ae38=_0x109d02[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x142e54)[_0xb8d9('0x19')](function(_0x573793){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0x573793['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0x573793['name']),'webbar:answer',{'sessionId':_0x25ae38});return _0x5a07db[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x38')});})[_0xb8d9('0x31')](handleError(_0x5a07db));};exports[_0xb8d9('0x39')]=function(_0x533ba7,_0x252570){logger[_0xb8d9('0x28')](_0xb8d9('0x3a'),_0x533ba7[_0xb8d9('0x29')]);var _0x2a0772=holdValidation[_0xb8d9('0x9')](_0x533ba7['body']);if(_0x2a0772[_0xb8d9('0x25')]>0x0){return _0x252570[_0xb8d9('0x15')](0x190)[_0xb8d9('0x34')](_0x2a0772);}var _0xc65f27=_0x533ba7[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x59a26d=_0x533ba7[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0xc65f27)['then'](function(_0x212310){logger[_0xb8d9('0x28')]('entityFound:',_0x212310['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0x212310[_0xb8d9('0x14')]),_0xb8d9('0x3b'),{'sessionId':_0x59a26d});return _0x252570[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x3c')});})['catch'](handleError(_0x252570));};exports[_0xb8d9('0x3d')]=function(_0x431c21,_0x341d9d){logger['info'](_0xb8d9('0x3e'),_0x431c21[_0xb8d9('0x29')]);var _0x57a93a=unholdValidation['validate'](_0x431c21[_0xb8d9('0x29')]);if(_0x57a93a[_0xb8d9('0x25')]>0x0){return _0x341d9d['status'](0x190)[_0xb8d9('0x34')](_0x57a93a);}var _0x34fb98=_0x431c21[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x58e40e=_0x431c21[_0xb8d9('0x29')][_0xb8d9('0x24')];return getAgent(_0x34fb98)[_0xb8d9('0x19')](function(_0x24b093){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0x24b093[_0xb8d9('0x14')]);emit(util['format'](_0xb8d9('0x35'),_0x24b093['name']),_0xb8d9('0x3f'),{'sessionId':_0x58e40e});return _0x341d9d[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':'unhold\x20executed!'});})[_0xb8d9('0x31')](handleError(_0x341d9d));};exports[_0xb8d9('0x40')]=function(_0x9d42a1,_0x34afd3){logger[_0xb8d9('0x28')](_0xb8d9('0x41'),_0x34afd3[_0xb8d9('0x29')]);var _0x3480d1=callsValidation[_0xb8d9('0x9')](_0x9d42a1[_0xb8d9('0x29')]);if(_0x3480d1[_0xb8d9('0x25')]>0x0){return _0x34afd3['status'](0x190)[_0xb8d9('0x34')](_0x3480d1);}var _0x758b6d=_0x9d42a1[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x5c1a14=respondWithRpcPromise(_0xb8d9('0x20'));var _0x20e625=getAgent(_0x758b6d);return Promise[_0xb8d9('0x42')]([_0x5c1a14,_0x20e625])[_0xb8d9('0x19')](function(_0x3bb503){var _0x52512d=_0x3bb503[0x0];var _0x11ccbc=_0x3bb503[0x1];var _0x4b80ab=_[_0xb8d9('0x21')](_0x52512d[_0xb8d9('0x22')],function(_0x1f6e31){return _0x1f6e31[_0xb8d9('0x23')]==_0x11ccbc['id'];});return _0x34afd3[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'count':_0x4b80ab[_0xb8d9('0x25')],'rows':_0x4b80ab});})['catch'](handleError(_0x34afd3));};exports[_0xb8d9('0x43')]=function(_0x1c6ad9,_0x5f008d){logger[_0xb8d9('0x28')]('conference\x20fired:',_0x1c6ad9[_0xb8d9('0x29')]);var _0x2ca703=conferenceValidation['validate'](_0x1c6ad9[_0xb8d9('0x29')]);if(_0x2ca703[_0xb8d9('0x25')]>0x0){return _0x5f008d['status'](0x190)[_0xb8d9('0x34')](_0x2ca703);}var _0x20ca5f=_0x1c6ad9['body'][_0xb8d9('0x2a')];return getAgent(_0x20ca5f)['then'](function(_0xffeec3){logger[_0xb8d9('0x28')](_0xb8d9('0x2d'),_0xffeec3[_0xb8d9('0x14')]);emit(util[_0xb8d9('0x2e')]('user:%s',_0xffeec3['name']),'webbar:conference');return _0x5f008d[_0xb8d9('0x15')](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x44')});})[_0xb8d9('0x31')](handleError(_0x5f008d));};exports[_0xb8d9('0x45')]=function(_0x182111,_0x15972e){logger[_0xb8d9('0x28')](_0xb8d9('0x46'),_0x182111[_0xb8d9('0x29')]);var _0x360b05=transferValidation[_0xb8d9('0x9')](_0x182111[_0xb8d9('0x29')]);if(_0x360b05[_0xb8d9('0x25')]>0x0){return _0x15972e['status'](0x190)[_0xb8d9('0x34')](_0x360b05);}var _0x7a813f=_0x182111[_0xb8d9('0x29')][_0xb8d9('0x2a')];var _0x2fd242=_0x182111['body'][_0xb8d9('0x24')];var _0x2fb1a9=_0x182111['body'][_0xb8d9('0x47')];return getAgent(_0x7a813f)[_0xb8d9('0x19')](function(_0xe18819){logger['info'](_0xb8d9('0x2d'),_0xe18819['name']);emit(util[_0xb8d9('0x2e')](_0xb8d9('0x35'),_0xe18819[_0xb8d9('0x14')]),_0xb8d9('0x48'),{'sessionId':_0x2fd242,'transferNumber':_0x2fb1a9});return _0x15972e['status'](0xc8)[_0xb8d9('0x34')]({'error':![],'message':_0xb8d9('0x49')});})[_0xb8d9('0x31')](handleError(_0x15972e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ea0ddbd..dd19d69 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 _0x1b9f=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addApplications','notify','/:id/send','send','update','destroy','delete','removeAnswers','exports','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x1ef734,_0x1831e6){var _0x42ec4e=function(_0x59b014){while(--_0x59b014){_0x1ef734['push'](_0x1ef734['shift']());}};_0x42ec4e(++_0x1831e6);}(_0x1b9f,0x9b));var _0xf1b9=function(_0x8aa6cb,_0x593d76){_0x8aa6cb=_0x8aa6cb-0x0;var _0x5e7186=_0x1b9f[_0x8aa6cb];return _0x5e7186;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf1b9('0x0'));var express=require(_0xf1b9('0x1'));var router=express['Router']();var fs_extra=require(_0xf1b9('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xf1b9('0x3'));var config=require(_0xf1b9('0x4'));var controller=require(_0xf1b9('0x5'));router[_0xf1b9('0x6')]('/',auth['isAuthenticated'](),controller[_0xf1b9('0x7')]);router['get'](_0xf1b9('0x8'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0xa')]);router[_0xf1b9('0x6')](_0xf1b9('0xb'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0xc')]);router[_0xf1b9('0x6')](_0xf1b9('0xd'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0xe')]);router['get'](_0xf1b9('0xf'),auth['isAuthenticated'](),controller[_0xf1b9('0x10')]);router['get'](_0xf1b9('0x11'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x12')]);router[_0xf1b9('0x6')](_0xf1b9('0x13'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x14')]);router[_0xf1b9('0x15')]('/',auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x16')]);router[_0xf1b9('0x15')](_0xf1b9('0xd'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x17')]);router[_0xf1b9('0x15')](_0xf1b9('0xf'),auth[_0xf1b9('0x9')](),controller['addAnswer']);router[_0xf1b9('0x15')](_0xf1b9('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf1b9('0x15')](_0xf1b9('0x13'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x18')]);router[_0xf1b9('0x15')]('/:id/notify',controller[_0xf1b9('0x19')]);router['post'](_0xf1b9('0x1a'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x1b')]);router['put']('/:id',auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x1c')]);router['delete'](_0xf1b9('0xb'),auth[_0xf1b9('0x9')](),controller[_0xf1b9('0x1d')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf1b9('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf1b9('0x1f')]);router['delete'](_0xf1b9('0x11'),auth[_0xf1b9('0x9')](),controller['removeAgents']);module[_0xf1b9('0x20')]=router; \ No newline at end of file +var _0x4e6a=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x25d452,_0x191c8b){var _0xff9d68=function(_0x1da815){while(--_0x1da815){_0x25d452['push'](_0x25d452['shift']());}};_0xff9d68(++_0x191c8b);}(_0x4e6a,0x19c));var _0xa4e6=function(_0x3cdb3c,_0x5f1ef4){_0x3cdb3c=_0x3cdb3c-0x0;var _0x41ad66=_0x4e6a[_0x3cdb3c];return _0x41ad66;};'use strict';var multer=require(_0xa4e6('0x0'));var util=require(_0xa4e6('0x1'));var path=require('path');var timeout=require(_0xa4e6('0x2'));var express=require(_0xa4e6('0x3'));var router=express[_0xa4e6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa4e6('0x5'));var interaction=require(_0xa4e6('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xa4e6('0x7')]('/',auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x9')]);router['get'](_0xa4e6('0xa'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0xb')]);router[_0xa4e6('0x7')]('/:id',auth[_0xa4e6('0x8')](),controller[_0xa4e6('0xc')]);router[_0xa4e6('0x7')](_0xa4e6('0xd'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0xe')]);router[_0xa4e6('0x7')](_0xa4e6('0xf'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x10')]);router[_0xa4e6('0x7')](_0xa4e6('0x11'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x12')]);router[_0xa4e6('0x7')](_0xa4e6('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa4e6('0x14')]('/',auth['isAuthenticated'](),controller[_0xa4e6('0x15')]);router[_0xa4e6('0x14')](_0xa4e6('0xd'),auth['isAuthenticated'](),controller[_0xa4e6('0x16')]);router[_0xa4e6('0x14')](_0xa4e6('0xf'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x17')]);router[_0xa4e6('0x14')](_0xa4e6('0x11'),auth[_0xa4e6('0x8')](),controller['addAgents']);router[_0xa4e6('0x14')](_0xa4e6('0x13'),auth['isAuthenticated'](),controller[_0xa4e6('0x18')]);router[_0xa4e6('0x14')](_0xa4e6('0x19'),controller[_0xa4e6('0x1a')]);router[_0xa4e6('0x14')](_0xa4e6('0x1b'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x1c')]);router[_0xa4e6('0x1d')](_0xa4e6('0x1e'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x1f')]);router[_0xa4e6('0x20')](_0xa4e6('0x1e'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x21')]);router['delete'](_0xa4e6('0xd'),auth[_0xa4e6('0x8')](),controller[_0xa4e6('0x22')]);router[_0xa4e6('0x20')](_0xa4e6('0xf'),auth['isAuthenticated'](),controller[_0xa4e6('0x23')]);router['delete'](_0xa4e6('0x11'),auth['isAuthenticated'](),controller[_0xa4e6('0x24')]);module[_0xa4e6('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 23a482b..c92d7fa 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 _0x22f2=['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','name','generate','ENUM'];(function(_0x5e016f,_0x1c874c){var _0x19f6b7=function(_0x24d344){while(--_0x24d344){_0x5e016f['push'](_0x5e016f['shift']());}};_0x19f6b7(++_0x1c874c);}(_0x22f2,0xd6));var _0x222f=function(_0x1ff527,_0x54b6d2){_0x1ff527=_0x1ff527-0x0;var _0x51cc75=_0x22f2[_0x1ff527];return _0x51cc75;};'use strict';var Sequelize=require(_0x222f('0x0'));var rs=require(_0x222f('0x1'));module[_0x222f('0x2')]={'name':{'type':Sequelize[_0x222f('0x3')],'unique':_0x222f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x222f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x222f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x222f('0x3')],'defaultValue':function(){return rs[_0x222f('0x5')]();}},'phone':{'type':Sequelize[_0x222f('0x3')]},'type':{'type':Sequelize[_0x222f('0x6')]('twilio',_0x222f('0x7'))},'accountSid':{'type':Sequelize[_0x222f('0x3')]},'baseUrl':{'type':Sequelize[_0x222f('0x3')]},'authToken':{'type':Sequelize[_0x222f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x222f('0x8')],'defaultValue':function(){return _0x222f('0x9');}},'notificationSound':{'type':Sequelize[_0x222f('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x222f('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x222f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x222f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x222f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x222f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x222f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x222f('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x222f('0xd'),'set':function(_0x18c958){if(!_0x18c958){this[_0x222f('0xe')](_0x222f('0xf'),null);}this[_0x222f('0xe')](_0x222f('0x10'),_0x18c958);}},'description':{'type':Sequelize[_0x222f('0x3')]}}; \ No newline at end of file +var _0x692c=['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','exports','STRING','name','generate','ENUM','twilio'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x692c,0x166));var _0xc692=function(_0xe3c52e,_0xbda941){_0xe3c52e=_0xe3c52e-0x0;var _0x5d077d=_0x692c[_0xe3c52e];return _0x5d077d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xc692('0x0')]={'name':{'type':Sequelize[_0xc692('0x1')],'unique':_0xc692('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xc692('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xc692('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc692('0x3')]();}},'phone':{'type':Sequelize[_0xc692('0x1')]},'type':{'type':Sequelize[_0xc692('0x4')](_0xc692('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0xc692('0x1')]},'baseUrl':{'type':Sequelize[_0xc692('0x1')]},'authToken':{'type':Sequelize[_0xc692('0x1')]},'notificationTemplate':{'type':Sequelize[_0xc692('0x6')],'defaultValue':function(){return _0xc692('0x7');}},'notificationSound':{'type':Sequelize[_0xc692('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc692('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc692('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc692('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc692('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc692('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc692('0x9')],'comment':_0xc692('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xc692('0x8')],'defaultValue':![],'comment':_0xc692('0xb'),'set':function(_0x12cd91){if(!_0x12cd91){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xc692('0xc')]('mandatoryDisposition',_0x12cd91);}},'description':{'type':Sequelize[_0xc692('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ef68a1b..8cd0b7c 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 _0xccc2=['http','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','WhatsappAccounts','UserProfileResource','end','name','send','index','Pause','WhatsappAccount','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','map','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','notify','account','sinch','statuses','state','WhatsappMessage','message_id','applications','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from','From','Body','messageId','MessageSid','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','entity\x20found','twilio','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','push','eml-format','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xccc2,0xa2));var _0x2ccc=function(_0x4642e0,_0x1e350c){_0x4642e0=_0x4642e0-0x0;var _0x1f4f11=_0xccc2[_0x4642e0];return _0x1f4f11;};'use strict';var emlformat=require(_0x2ccc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ccc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ccc('0x2'));var Mustache=require('mustache');var util=require(_0x2ccc('0x3'));var path=require('path');var sox=require(_0x2ccc('0x4'));var csv=require(_0x2ccc('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ccc('0x6'));var _=require(_0x2ccc('0x7'));var squel=require(_0x2ccc('0x8'));var crypto=require(_0x2ccc('0x9'));var jsforce=require(_0x2ccc('0xa'));var deskjs=require(_0x2ccc('0xb'));var toCsv=require(_0x2ccc('0x5'));var querystring=require(_0x2ccc('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ccc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2ccc('0xe'));var hardwareService=require(_0x2ccc('0xf'));var logger=require(_0x2ccc('0x10'))(_0x2ccc('0x11'));var utils=require(_0x2ccc('0x12'));var config=require(_0x2ccc('0x13'));var licenseUtil=require(_0x2ccc('0x14'));var db=require(_0x2ccc('0x15'))['db'];config[_0x2ccc('0x16')]=_[_0x2ccc('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2ccc('0x18'))(new Redis(config[_0x2ccc('0x16')]));require(_0x2ccc('0x19'))[_0x2ccc('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2ccc('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0xdcf4fb,_0x590ce9,_0x413e48,_0x32359c){return new BPromise(function(_0x57ed8e,_0x3b654e){var _0x2810de=_0x32359c||client;return _0x2810de['request'](_0xdcf4fb,_0x413e48)['then'](function(_0x45bbb6){logger['info'](_0x2ccc('0x1c'),_0x590ce9,'request\x20sent');logger[_0x2ccc('0x1d')](_0x2ccc('0x1e'),_0x590ce9,_0x2ccc('0x1f'),JSON[_0x2ccc('0x20')](_0x45bbb6));if(_0x45bbb6['error']){if(_0x45bbb6[_0x2ccc('0x21')][_0x2ccc('0x22')]===0x1f4){logger[_0x2ccc('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x590ce9,_0x45bbb6[_0x2ccc('0x21')][_0x2ccc('0x23')]);return _0x3b654e(_0x45bbb6[_0x2ccc('0x21')]['message']);}logger['error'](_0x2ccc('0x1c'),_0x590ce9,_0x45bbb6['error'][_0x2ccc('0x23')]);return _0x57ed8e(_0x45bbb6['error']['message']);}else{logger[_0x2ccc('0x24')](_0x2ccc('0x1c'),_0x590ce9,'request\x20sent');_0x57ed8e(_0x45bbb6[_0x2ccc('0x25')][_0x2ccc('0x23')]);}})['catch'](function(_0x546be0){logger[_0x2ccc('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x590ce9,_0x546be0);_0x3b654e(_0x546be0);});});}function respondWithStatusCode(_0x486b5d,_0x4b9f0e){_0x4b9f0e=_0x4b9f0e||0xcc;return function(_0x1f72e1){if(_0x1f72e1){return _0x486b5d[_0x2ccc('0x26')](_0x4b9f0e);}return _0x486b5d[_0x2ccc('0x27')](_0x4b9f0e)['end']();};}function respondWithResult(_0x22307e,_0xdf99cf){_0xdf99cf=_0xdf99cf||0xc8;return function(_0x118b31){if(_0x118b31){return _0x22307e['status'](_0xdf99cf)['json'](_0x118b31);}};}function respondWithFilteredResult(_0x400640,_0x2837ea){return function(_0x2571d2){if(_0x2571d2){var _0x5acf4a=typeof _0x2837ea[_0x2ccc('0x28')]===_0x2ccc('0x29')&&typeof _0x2837ea[_0x2ccc('0x2a')]==='undefined';var _0x39c327=_0x2571d2[_0x2ccc('0x2b')];var _0x16fc2d=_0x5acf4a?0x0:_0x2837ea[_0x2ccc('0x28')];var _0x3c0cdb=_0x5acf4a?_0x2571d2['count']:_0x2837ea['offset']+_0x2837ea[_0x2ccc('0x2a')];var _0x4d84b6;if(_0x3c0cdb>=_0x39c327){_0x3c0cdb=_0x39c327;_0x4d84b6=0xc8;}else{_0x4d84b6=0xce;}_0x400640[_0x2ccc('0x27')](_0x4d84b6);return _0x400640[_0x2ccc('0x2c')](_0x2ccc('0x2d'),_0x16fc2d+'-'+_0x3c0cdb+'/'+_0x39c327)[_0x2ccc('0x2e')](_0x2571d2);}return null;};}function patchUpdates(_0xb9d696){return function(_0xa35f6){try{jsonpatch['apply'](_0xa35f6,_0xb9d696,!![]);}catch(_0x275258){return BPromise['reject'](_0x275258);}return _0xa35f6[_0x2ccc('0x2f')]();};}function saveUpdates(_0x582cc7,_0xc4028c){return function(_0x133adb){if(_0x133adb){return _0x133adb[_0x2ccc('0x30')](_0x582cc7)['then'](function(_0x19cc33){return _0x19cc33;});}return null;};}function removeEntity(_0x3860ec,_0x45581b){return function(_0x2f3b0f){if(_0x2f3b0f){return _0x2f3b0f[_0x2ccc('0x31')]()[_0x2ccc('0x32')](function(){var _0x1efe44=_0x2f3b0f['get']({'plain':!![]});var _0x225cb9=_0x2ccc('0x33');return db[_0x2ccc('0x34')]['destroy']({'where':{'type':_0x225cb9,'resourceId':_0x1efe44['id']}})['then'](function(){return _0x2f3b0f;});})[_0x2ccc('0x32')](function(){_0x3860ec[_0x2ccc('0x27')](0xcc)[_0x2ccc('0x35')]();});}};}function handleEntityNotFound(_0x446122,_0x28d88c){return function(_0x27acee){if(!_0x27acee){_0x446122['sendStatus'](0x194);}return _0x27acee;};}function handleError(_0x59b76c,_0x43f58b){_0x43f58b=_0x43f58b||0x1f4;return function(_0x54285c){logger[_0x2ccc('0x21')](_0x54285c['stack']);if(_0x54285c[_0x2ccc('0x36')]){delete _0x54285c['name'];}_0x59b76c[_0x2ccc('0x27')](_0x43f58b)[_0x2ccc('0x37')](_0x54285c);};}exports[_0x2ccc('0x38')]=function(_0x42c758,_0x3e9953){var _0x3e4b51={'include':[{'model':db[_0x2ccc('0x39')],'as':'mandatoryDispositionPause'}]},_0x54f2cb={},_0xfba141={'count':0x0,'rows':[]};var _0x57ddb4=_['map'](db[_0x2ccc('0x3a')][_0x2ccc('0x3b')],function(_0x1ba643){return{'name':_0x1ba643['fieldName'],'type':_0x1ba643[_0x2ccc('0x3c')]['key']};});_0x54f2cb[_0x2ccc('0x3d')]=_['map'](_0x57ddb4,'name');_0x54f2cb['query']=_[_0x2ccc('0x3e')](_0x42c758[_0x2ccc('0x3f')]);_0x54f2cb[_0x2ccc('0x40')]=_[_0x2ccc('0x41')](_0x54f2cb[_0x2ccc('0x3d')],_0x54f2cb[_0x2ccc('0x3f')]);_0x3e4b51[_0x2ccc('0x42')]=_[_0x2ccc('0x41')](_0x54f2cb[_0x2ccc('0x3d')],qs[_0x2ccc('0x43')](_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x43')]));_0x3e4b51['attributes']=_0x3e4b51[_0x2ccc('0x42')][_0x2ccc('0x44')]?_0x3e4b51[_0x2ccc('0x42')]:_0x54f2cb['model'];if(!_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x45')](_0x2ccc('0x46'))){_0x3e4b51[_0x2ccc('0x2a')]=qs['limit'](_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x2a')]);_0x3e4b51[_0x2ccc('0x28')]=qs[_0x2ccc('0x28')](_0x42c758[_0x2ccc('0x3f')]['offset']);}_0x3e4b51[_0x2ccc('0x47')]=qs[_0x2ccc('0x48')](_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x48')]);_0x3e4b51[_0x2ccc('0x49')]=qs[_0x2ccc('0x40')](_[_0x2ccc('0x4a')](_0x42c758[_0x2ccc('0x3f')],_0x54f2cb[_0x2ccc('0x40')]),_0x57ddb4);if(_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x4b')]){_0x3e4b51[_0x2ccc('0x49')]=_[_0x2ccc('0x4c')](_0x3e4b51[_0x2ccc('0x49')],{'$or':_['map'](_0x57ddb4,function(_0x2960ae){if(_0x2960ae['type']!==_0x2ccc('0x4d')){var _0x6d2cb3={};_0x6d2cb3[_0x2960ae[_0x2ccc('0x36')]]={'$like':'%'+_0x42c758[_0x2ccc('0x3f')][_0x2ccc('0x4b')]+'%'};return _0x6d2cb3;}})});}_0x3e4b51=_[_0x2ccc('0x4c')]({},_0x3e4b51,_0x42c758[_0x2ccc('0x4e')]);var _0x508010={'where':_0x3e4b51[_0x2ccc('0x49')]};return db[_0x2ccc('0x3a')][_0x2ccc('0x2b')](_0x508010)[_0x2ccc('0x32')](function(_0x496980){_0xfba141[_0x2ccc('0x2b')]=_0x496980;if(_0x42c758['query'][_0x2ccc('0x4f')]){_0x3e4b51[_0x2ccc('0x50')]=[{'all':!![]}];}return db[_0x2ccc('0x3a')][_0x2ccc('0x51')](_0x3e4b51);})[_0x2ccc('0x32')](function(_0x2807cc){_0xfba141[_0x2ccc('0x52')]=_0x2807cc;return _0xfba141;})['then'](respondWithFilteredResult(_0x3e9953,_0x3e4b51))['catch'](handleError(_0x3e9953,null));};exports[_0x2ccc('0x53')]=function(_0x448ecf,_0x27dcb3){var _0x2b8e46={'raw':![],'where':{'id':_0x448ecf['params']['id']},'include':[{'model':db['Pause'],'as':_0x2ccc('0x54')}]},_0x28563d={};_0x28563d[_0x2ccc('0x3d')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x28563d[_0x2ccc('0x3f')]=_[_0x2ccc('0x3e')](_0x448ecf['query']);_0x28563d[_0x2ccc('0x40')]=_[_0x2ccc('0x41')](_0x28563d['model'],_0x28563d[_0x2ccc('0x3f')]);_0x2b8e46[_0x2ccc('0x42')]=_[_0x2ccc('0x41')](_0x28563d['model'],qs['fields'](_0x448ecf[_0x2ccc('0x3f')]['fields']));_0x2b8e46['attributes']=_0x2b8e46['attributes']['length']?_0x2b8e46[_0x2ccc('0x42')]:_0x28563d[_0x2ccc('0x3d')];if(_0x448ecf['query'][_0x2ccc('0x4f')]){_0x2b8e46[_0x2ccc('0x50')]=[{'all':!![]}];}_0x2b8e46=_[_0x2ccc('0x4c')]({},_0x2b8e46,_0x448ecf[_0x2ccc('0x4e')]);return db[_0x2ccc('0x3a')][_0x2ccc('0x55')](_0x2b8e46)[_0x2ccc('0x32')](handleEntityNotFound(_0x27dcb3,null))[_0x2ccc('0x32')](respondWithResult(_0x27dcb3,null))['catch'](handleError(_0x27dcb3,null));};exports[_0x2ccc('0x56')]=function(_0x3c6be3,_0x4aa117){return db[_0x2ccc('0x3a')]['create'](_0x3c6be3[_0x2ccc('0x57')],{})[_0x2ccc('0x32')](function(_0x33cdc0){var _0x1dc5f5=_0x3c6be3[_0x2ccc('0x58')][_0x2ccc('0x59')]({'plain':!![]});if(!_0x1dc5f5)throw new Error(_0x2ccc('0x5a'));if(_0x1dc5f5[_0x2ccc('0x5b')]===_0x2ccc('0x58')){var _0x3b5a51=_0x33cdc0[_0x2ccc('0x59')]({'plain':!![]});var _0x31bc87='WhatsappAccounts';return db['UserProfileSection'][_0x2ccc('0x55')]({'where':{'name':_0x31bc87,'userProfileId':_0x1dc5f5[_0x2ccc('0x5c')]},'raw':!![]})[_0x2ccc('0x32')](function(_0x169210){if(_0x169210&&_0x169210[_0x2ccc('0x5d')]===0x0){return db[_0x2ccc('0x34')][_0x2ccc('0x56')]({'name':_0x3b5a51['name'],'resourceId':_0x3b5a51['id'],'type':_0x169210[_0x2ccc('0x36')],'sectionId':_0x169210['id']},{})[_0x2ccc('0x32')](function(){return _0x33cdc0;});}else{return _0x33cdc0;}})[_0x2ccc('0x5e')](function(_0x1233b4){logger[_0x2ccc('0x21')](_0x2ccc('0x5f'),_0x1233b4);throw _0x1233b4;});}return _0x33cdc0;})[_0x2ccc('0x32')](respondWithResult(_0x4aa117,0xc9))[_0x2ccc('0x5e')](handleError(_0x4aa117,null));};exports[_0x2ccc('0x30')]=function(_0x1c86c4,_0x5902dc){if(_0x1c86c4[_0x2ccc('0x57')]['id']){delete _0x1c86c4[_0x2ccc('0x57')]['id'];}return db[_0x2ccc('0x3a')]['find']({'where':{'id':_0x1c86c4[_0x2ccc('0x60')]['id']},'include':[{'model':db[_0x2ccc('0x39')],'as':'mandatoryDispositionPause'}]})[_0x2ccc('0x32')](handleEntityNotFound(_0x5902dc,null))[_0x2ccc('0x32')](saveUpdates(_0x1c86c4[_0x2ccc('0x57')],null))['then'](respondWithResult(_0x5902dc,null))['catch'](handleError(_0x5902dc,null));};exports[_0x2ccc('0x31')]=function(_0x584351,_0x255b83){return db[_0x2ccc('0x3a')]['find']({'where':{'id':_0x584351[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x255b83,null))[_0x2ccc('0x32')](removeEntity(_0x255b83,null))[_0x2ccc('0x5e')](handleError(_0x255b83,null));};exports[_0x2ccc('0x61')]=function(_0x1dbdac,_0x1e8191){return db[_0x2ccc('0x3a')][_0x2ccc('0x61')]()['then'](respondWithResult(_0x1e8191,null))[_0x2ccc('0x5e')](handleError(_0x1e8191,null));};exports[_0x2ccc('0x62')]=function(_0xfefaa,_0x173258,_0xd8c135){if(_0xfefaa[_0x2ccc('0x57')]['id']){delete _0xfefaa[_0x2ccc('0x57')]['id'];}return db[_0x2ccc('0x3a')][_0x2ccc('0x55')]({'where':{'id':_0xfefaa[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x173258,null))[_0x2ccc('0x32')](function(_0x257365){if(_0x257365){_0xfefaa[_0x2ccc('0x57')][_0x2ccc('0x63')]=_0x257365['id'];return db[_0x2ccc('0x64')][_0x2ccc('0x56')](_0xfefaa[_0x2ccc('0x57')]);}})['then'](respondWithResult(_0x173258,null))[_0x2ccc('0x5e')](handleError(_0x173258,null));};exports[_0x2ccc('0x65')]=function(_0x48910f,_0x38e299,_0xa0340b){var _0x5826e8={'raw':![],'where':{}};var _0x32e49c={};var _0x542b17={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2ccc('0x66')]({'where':{'id':_0x48910f[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x38e299,null))[_0x2ccc('0x32')](function(_0x3c16d6){if(_0x3c16d6){_0x32e49c[_0x2ccc('0x3d')]=_[_0x2ccc('0x3e')](db[_0x2ccc('0x64')][_0x2ccc('0x3b')]);_0x32e49c[_0x2ccc('0x3f')]=_[_0x2ccc('0x3e')](_0x48910f[_0x2ccc('0x3f')]);_0x32e49c['filters']=_[_0x2ccc('0x41')](_0x32e49c[_0x2ccc('0x3d')],_0x32e49c[_0x2ccc('0x3f')]);_0x5826e8[_0x2ccc('0x42')]=_[_0x2ccc('0x41')](_0x32e49c['model'],qs[_0x2ccc('0x43')](_0x48910f['query'][_0x2ccc('0x43')]));_0x5826e8[_0x2ccc('0x42')]=_0x5826e8[_0x2ccc('0x42')][_0x2ccc('0x44')]?_0x5826e8[_0x2ccc('0x42')]:_0x32e49c['model'];if(!_0x48910f['query'][_0x2ccc('0x45')]('nolimit')){_0x5826e8[_0x2ccc('0x2a')]=qs[_0x2ccc('0x2a')](_0x48910f[_0x2ccc('0x3f')][_0x2ccc('0x2a')]);_0x5826e8['offset']=qs[_0x2ccc('0x28')](_0x48910f[_0x2ccc('0x3f')][_0x2ccc('0x28')]);}_0x5826e8[_0x2ccc('0x47')]=qs['sort'](_0x48910f[_0x2ccc('0x3f')][_0x2ccc('0x48')]);_0x5826e8['where']=qs[_0x2ccc('0x40')](_['pick'](_0x48910f['query'],_0x32e49c[_0x2ccc('0x40')]));_0x5826e8[_0x2ccc('0x49')][_0x2ccc('0x63')]=_0x3c16d6['id'];if(_0x48910f['query']['filter']){_0x5826e8[_0x2ccc('0x49')]=_['merge'](_0x5826e8[_0x2ccc('0x49')],{'$or':_[_0x2ccc('0x67')](_0x5826e8[_0x2ccc('0x42')],function(_0x3b9546){var _0x2d0acf={};_0x2d0acf[_0x3b9546]={'$like':'%'+_0x48910f[_0x2ccc('0x3f')][_0x2ccc('0x4b')]+'%'};return _0x2d0acf;})});}_0x5826e8=_[_0x2ccc('0x4c')]({},_0x5826e8,_0x48910f[_0x2ccc('0x4e')]);return db['Disposition'][_0x2ccc('0x2b')]({'where':_0x5826e8[_0x2ccc('0x49')]})['then'](function(_0x5a4064){_0x542b17['count']=_0x5a4064;if(_0x48910f[_0x2ccc('0x3f')][_0x2ccc('0x4f')]){_0x5826e8['include']=[{'all':!![]}];}return db[_0x2ccc('0x64')][_0x2ccc('0x51')](_0x5826e8);})[_0x2ccc('0x32')](function(_0x4b2916){_0x542b17[_0x2ccc('0x52')]=_0x4b2916;return _0x542b17;});}})[_0x2ccc('0x32')](respondWithFilteredResult(_0x38e299,_0x5826e8))[_0x2ccc('0x5e')](handleError(_0x38e299,null));};exports[_0x2ccc('0x68')]=function(_0x466820,_0x376bb3,_0x5a4a41){return db[_0x2ccc('0x3a')]['find']({'where':{'id':_0x466820[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x376bb3,null))[_0x2ccc('0x32')](function(_0x263751){if(_0x263751){return _0x263751[_0x2ccc('0x68')](_0x466820['query'][_0x2ccc('0x69')]);}})[_0x2ccc('0x32')](respondWithStatusCode(_0x376bb3,null))['catch'](handleError(_0x376bb3,null));};exports[_0x2ccc('0x6a')]=function(_0x2f5d6b,_0x34ab58,_0x511bb9){if(_0x2f5d6b[_0x2ccc('0x57')]['id']){delete _0x2f5d6b['body']['id'];}return db['WhatsappAccount'][_0x2ccc('0x55')]({'where':{'id':_0x2f5d6b[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x34ab58,null))[_0x2ccc('0x32')](function(_0x7e85c2){if(_0x7e85c2){_0x2f5d6b[_0x2ccc('0x57')][_0x2ccc('0x63')]=_0x7e85c2['id'];return db[_0x2ccc('0x6b')][_0x2ccc('0x56')](_0x2f5d6b[_0x2ccc('0x57')]);}})[_0x2ccc('0x32')](respondWithResult(_0x34ab58,null))['catch'](handleError(_0x34ab58,null));};exports[_0x2ccc('0x6c')]=function(_0x190dcd,_0x55c58d,_0x29f0a0){var _0x13d3ca={'raw':![],'where':{}};var _0x5336e9={};var _0x2c9c16={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2ccc('0x66')]({'where':{'id':_0x190dcd[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x55c58d,null))[_0x2ccc('0x32')](function(_0x2b6ebf){if(_0x2b6ebf){_0x5336e9[_0x2ccc('0x3d')]=_[_0x2ccc('0x3e')](db[_0x2ccc('0x6b')][_0x2ccc('0x3b')]);_0x5336e9[_0x2ccc('0x3f')]=_[_0x2ccc('0x3e')](_0x190dcd['query']);_0x5336e9[_0x2ccc('0x40')]=_[_0x2ccc('0x41')](_0x5336e9[_0x2ccc('0x3d')],_0x5336e9['query']);_0x13d3ca['attributes']=_['intersection'](_0x5336e9[_0x2ccc('0x3d')],qs['fields'](_0x190dcd['query']['fields']));_0x13d3ca['attributes']=_0x13d3ca[_0x2ccc('0x42')][_0x2ccc('0x44')]?_0x13d3ca['attributes']:_0x5336e9[_0x2ccc('0x3d')];if(!_0x190dcd[_0x2ccc('0x3f')][_0x2ccc('0x45')](_0x2ccc('0x46'))){_0x13d3ca['limit']=qs[_0x2ccc('0x2a')](_0x190dcd['query'][_0x2ccc('0x2a')]);_0x13d3ca[_0x2ccc('0x28')]=qs[_0x2ccc('0x28')](_0x190dcd['query'][_0x2ccc('0x28')]);}_0x13d3ca[_0x2ccc('0x47')]=qs['sort'](_0x190dcd[_0x2ccc('0x3f')]['sort']);_0x13d3ca['where']=qs[_0x2ccc('0x40')](_['pick'](_0x190dcd['query'],_0x5336e9[_0x2ccc('0x40')]));_0x13d3ca['where'][_0x2ccc('0x63')]=_0x2b6ebf['id'];if(_0x190dcd['query']['filter']){_0x13d3ca['where']=_[_0x2ccc('0x4c')](_0x13d3ca[_0x2ccc('0x49')],{'$or':_[_0x2ccc('0x67')](_0x13d3ca[_0x2ccc('0x42')],function(_0x31a19f){var _0x55c54b={};_0x55c54b[_0x31a19f]={'$like':'%'+_0x190dcd[_0x2ccc('0x3f')][_0x2ccc('0x4b')]+'%'};return _0x55c54b;})});}_0x13d3ca=_[_0x2ccc('0x4c')]({},_0x13d3ca,_0x190dcd[_0x2ccc('0x4e')]);return db['CannedAnswer'][_0x2ccc('0x2b')]({'where':_0x13d3ca['where']})[_0x2ccc('0x32')](function(_0x598946){_0x2c9c16[_0x2ccc('0x2b')]=_0x598946;if(_0x190dcd['query'][_0x2ccc('0x4f')]){_0x13d3ca[_0x2ccc('0x50')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x13d3ca);})[_0x2ccc('0x32')](function(_0x547954){_0x2c9c16['rows']=_0x547954;return _0x2c9c16;});}})['then'](respondWithFilteredResult(_0x55c58d,_0x13d3ca))[_0x2ccc('0x5e')](handleError(_0x55c58d,null));};exports['removeAnswers']=function(_0x4731f8,_0x2a70b2,_0x300965){return db[_0x2ccc('0x3a')][_0x2ccc('0x55')]({'where':{'id':_0x4731f8[_0x2ccc('0x60')]['id']}})['then'](handleEntityNotFound(_0x2a70b2,null))['then'](function(_0x5120ba){if(_0x5120ba){return _0x5120ba['removeAnswers'](_0x4731f8[_0x2ccc('0x3f')][_0x2ccc('0x69')]);}})['then'](respondWithStatusCode(_0x2a70b2,null))[_0x2ccc('0x5e')](handleError(_0x2a70b2,null));};exports[_0x2ccc('0x6d')]=function(_0x8303eb,_0x12aea3,_0x49ede0){return db[_0x2ccc('0x3a')]['find']({'where':{'id':_0x8303eb[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x12aea3,null))[_0x2ccc('0x32')](function(_0x2a05e2){if(_0x2a05e2){return _0x2a05e2[_0x2ccc('0x6d')](_0x8303eb[_0x2ccc('0x57')][_0x2ccc('0x69')],_['omit'](_0x8303eb[_0x2ccc('0x57')],[_0x2ccc('0x69'),'id'])||{})[_0x2ccc('0x6e')](function(_0xe11549){for(var _0xb685e8=0x0;_0xb685e8<_0x8303eb[_0x2ccc('0x57')][_0x2ccc('0x69')][_0x2ccc('0x44')];_0xb685e8+=0x1){socket[_0x2ccc('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x8303eb[_0x2ccc('0x57')]['ids'][_0xb685e8]),'WhatsappAccountId':Number(_0x8303eb[_0x2ccc('0x60')]['id'])});}return _0xe11549;});}})[_0x2ccc('0x32')](respondWithResult(_0x12aea3,null))[_0x2ccc('0x5e')](handleError(_0x12aea3,null));};exports['removeAgents']=function(_0x2341bb,_0x44f8e6,_0x54410a){return db[_0x2ccc('0x3a')][_0x2ccc('0x55')]({'where':{'id':_0x2341bb[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x44f8e6,null))['then'](function(_0x40fe8d){if(_0x40fe8d){return _0x40fe8d[_0x2ccc('0x70')](_0x2341bb['query'][_0x2ccc('0x69')])[_0x2ccc('0x32')](function(){if(_[_0x2ccc('0x71')](_0x2341bb['query'][_0x2ccc('0x69')])){for(var _0x14b4e7=0x0;_0x14b4e7<_0x2341bb[_0x2ccc('0x3f')][_0x2ccc('0x69')][_0x2ccc('0x44')];_0x14b4e7+=0x1){socket[_0x2ccc('0x6f')](_0x2ccc('0x72'),{'UserId':Number(_0x2341bb['query'][_0x2ccc('0x69')][_0x14b4e7]),'WhatsappAccountId':Number(_0x2341bb['params']['id'])});}}else{socket[_0x2ccc('0x6f')](_0x2ccc('0x72'),{'UserId':Number(_0x2341bb[_0x2ccc('0x3f')][_0x2ccc('0x69')]),'WhatsappAccountId':Number(_0x2341bb[_0x2ccc('0x60')]['id'])});}});}})[_0x2ccc('0x32')](respondWithStatusCode(_0x44f8e6,null))[_0x2ccc('0x5e')](handleError(_0x44f8e6,null));};exports[_0x2ccc('0x73')]=function(_0x1564e0,_0x177ee0,_0x296e33){var _0x588b9e={};var _0x51cb59={};var _0xd72468;var _0x4e4366;return db[_0x2ccc('0x3a')][_0x2ccc('0x66')]({'where':{'id':_0x1564e0['params']['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x177ee0,null))['then'](function(_0x22a0c9){if(_0x22a0c9){_0xd72468=_0x22a0c9;_0x51cb59[_0x2ccc('0x3d')]=_['keys'](db['User'][_0x2ccc('0x3b')]);_0x51cb59[_0x2ccc('0x3f')]=_[_0x2ccc('0x3e')](_0x1564e0[_0x2ccc('0x3f')]);_0x51cb59[_0x2ccc('0x40')]=_[_0x2ccc('0x41')](_0x51cb59[_0x2ccc('0x3d')],_0x51cb59[_0x2ccc('0x3f')]);_0x588b9e[_0x2ccc('0x42')]=_[_0x2ccc('0x41')](_0x51cb59[_0x2ccc('0x3d')],qs[_0x2ccc('0x43')](_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x43')]));_0x588b9e['attributes']=_0x588b9e[_0x2ccc('0x42')][_0x2ccc('0x44')]?_0x588b9e[_0x2ccc('0x42')]:_0x51cb59[_0x2ccc('0x3d')];_0x588b9e['order']=qs['sort'](_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x48')]);_0x588b9e[_0x2ccc('0x49')]=qs[_0x2ccc('0x40')](_[_0x2ccc('0x4a')](_0x1564e0['query'],_0x51cb59[_0x2ccc('0x40')]));if(_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x4b')]){_0x588b9e['where']=_[_0x2ccc('0x4c')](_0x588b9e[_0x2ccc('0x49')],{'$or':_[_0x2ccc('0x67')](_0x588b9e[_0x2ccc('0x42')],function(_0x1ef515){var _0x58a117={};_0x58a117[_0x1ef515]={'$like':'%'+_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x4b')]+'%'};return _0x58a117;})});}_0x588b9e=_[_0x2ccc('0x4c')]({},_0x588b9e,_0x1564e0[_0x2ccc('0x4e')]);return _0xd72468[_0x2ccc('0x73')](_0x588b9e);}})[_0x2ccc('0x32')](function(_0xc6f352){if(_0xc6f352){_0x4e4366=_0xc6f352[_0x2ccc('0x44')];if(!_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x45')](_0x2ccc('0x46'))){_0x588b9e[_0x2ccc('0x2a')]=qs[_0x2ccc('0x2a')](_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x2a')]);_0x588b9e[_0x2ccc('0x28')]=qs[_0x2ccc('0x28')](_0x1564e0[_0x2ccc('0x3f')][_0x2ccc('0x28')]);}return _0xd72468[_0x2ccc('0x73')](_0x588b9e);}})[_0x2ccc('0x32')](function(_0x3b930f){if(_0x3b930f){return _0x3b930f?{'count':_0x4e4366,'rows':_0x3b930f}:null;}})[_0x2ccc('0x32')](respondWithResult(_0x177ee0,null))['catch'](handleError(_0x177ee0,null));};exports[_0x2ccc('0x74')]=function(_0x57a760,_0x2275b8){var _0x3de4fc=_0x57a760['params']['id'];var _0x47e5be=_0x57a760['body'];var _0x43f058=0xc8;var _0x28508b=null;return db[_0x2ccc('0x75')][_0x2ccc('0x76')]({'isolationLevel':db['sequelize'][_0x2ccc('0x77')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x49d994){return db[_0x2ccc('0x3a')][_0x2ccc('0x66')]({'where':{'id':_0x3de4fc},'transaction':_0x49d994})[_0x2ccc('0x32')](function(_0x511c0c){if(_0x511c0c){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x3de4fc},'transaction':_0x49d994})[_0x2ccc('0x32')](function(){var _0x12f6ea=_['map'](_0x47e5be,function(_0x2944af){_0x2944af[_0x2ccc('0x63')]=_0x3de4fc;return _0x2944af;});return db[_0x2ccc('0x78')]['bulkCreate'](_0x12f6ea,{'transaction':_0x49d994});});}else{_0x43f058=0x194;_0x28508b=[];}});})[_0x2ccc('0x32')](function(){if(_0x43f058!==0x194){return db[_0x2ccc('0x78')][_0x2ccc('0x79')]({'where':{'WhatsappAccountId':_0x3de4fc},'order':_0x2ccc('0x7a')})['then'](function(_0x2287b4){_0x28508b=_0x2287b4;});}})[_0x2ccc('0x5e')](function(_0x576d25){_0x43f058=0x1f4;logger[_0x2ccc('0x21')](_0x576d25[_0x2ccc('0x7b')]);if(_0x576d25[_0x2ccc('0x36')]){delete _0x576d25[_0x2ccc('0x36')];}_0x28508b=_0x576d25;})[_0x2ccc('0x7c')](function(){if(_0x28508b===null){_0x2275b8[_0x2ccc('0x26')](_0x43f058);}else{if(_0x43f058===0x1f4){_0x2275b8[_0x2ccc('0x27')](_0x43f058)['send'](_0x28508b);}else{_0x2275b8[_0x2ccc('0x27')](_0x43f058)[_0x2ccc('0x2e')](_0x28508b);}}});};exports['getApplications']=function(_0x2963b1,_0x224599,_0x48f1eb){var _0x312117={};var _0x40b307={};var _0x19fb38;var _0x28f6dc;return db[_0x2ccc('0x3a')]['findOne']({'where':{'id':_0x2963b1[_0x2ccc('0x60')]['id']}})[_0x2ccc('0x32')](handleEntityNotFound(_0x224599,null))[_0x2ccc('0x32')](function(_0x2402ea){if(_0x2402ea){_0x19fb38=_0x2402ea;_0x40b307[_0x2ccc('0x3d')]=_[_0x2ccc('0x3e')](db[_0x2ccc('0x78')][_0x2ccc('0x3b')]);_0x40b307[_0x2ccc('0x3f')]=_['keys'](_0x2963b1[_0x2ccc('0x3f')]);_0x40b307[_0x2ccc('0x40')]=_[_0x2ccc('0x41')](_0x40b307[_0x2ccc('0x3d')],_0x40b307[_0x2ccc('0x3f')]);_0x312117['attributes']=_[_0x2ccc('0x41')](_0x40b307[_0x2ccc('0x3d')],qs[_0x2ccc('0x43')](_0x2963b1[_0x2ccc('0x3f')][_0x2ccc('0x43')]));_0x312117['attributes']=_0x312117[_0x2ccc('0x42')][_0x2ccc('0x44')]?_0x312117[_0x2ccc('0x42')]:_0x40b307[_0x2ccc('0x3d')];_0x312117[_0x2ccc('0x47')]=qs[_0x2ccc('0x48')](_0x2963b1[_0x2ccc('0x3f')][_0x2ccc('0x48')]);_0x312117[_0x2ccc('0x49')]=qs['filters'](_[_0x2ccc('0x4a')](_0x2963b1[_0x2ccc('0x3f')],_0x40b307[_0x2ccc('0x40')]));if(_0x2963b1['query'][_0x2ccc('0x4b')]){_0x312117[_0x2ccc('0x49')]=_[_0x2ccc('0x4c')](_0x312117[_0x2ccc('0x49')],{'$or':_[_0x2ccc('0x67')](_0x312117[_0x2ccc('0x42')],function(_0x2434d6){var _0x45fb79={};_0x45fb79[_0x2434d6]={'$like':'%'+_0x2963b1[_0x2ccc('0x3f')]['filter']+'%'};return _0x45fb79;})});}_0x312117=_[_0x2ccc('0x4c')]({},_0x312117,_0x2963b1['options']);return _0x19fb38['getApplications'](_0x312117);}})[_0x2ccc('0x32')](function(_0x464294){if(_0x464294){_0x28f6dc=_0x464294['length'];if(!_0x2963b1[_0x2ccc('0x3f')][_0x2ccc('0x45')]('nolimit')){_0x312117[_0x2ccc('0x2a')]=qs['limit'](_0x2963b1[_0x2ccc('0x3f')][_0x2ccc('0x2a')]);_0x312117[_0x2ccc('0x28')]=qs[_0x2ccc('0x28')](_0x2963b1[_0x2ccc('0x3f')]['offset']);}return _0x19fb38[_0x2ccc('0x7d')](_0x312117);}})[_0x2ccc('0x32')](function(_0x19f1b9){if(_0x19f1b9){return _0x19f1b9?{'count':_0x28f6dc,'rows':_0x19f1b9}:null;}})[_0x2ccc('0x32')](respondWithResult(_0x224599,null))[_0x2ccc('0x5e')](handleError(_0x224599,null));};exports[_0x2ccc('0x7e')]=function(_0x2d5dd9,_0x5d94b4,_0x16c7c3){var _0x119693={'channel':'whatsapp'};var _0x26791b=[];var _0x2a2ded=[];var _0x1ddf77={};return db[_0x2ccc('0x3a')]['find']({'where':{'id':_0x2d5dd9[_0x2ccc('0x60')]['id']},'include':[{'model':db[_0x2ccc('0x78')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x5d94b4,null))['then'](function(_0x3dd2d4){_0x119693[_0x2ccc('0x7f')]=_0x3dd2d4;if(_0x119693[_0x2ccc('0x7f')]&&_0x119693[_0x2ccc('0x7f')]['type']===_0x2ccc('0x80')&&_0x2d5dd9[_0x2ccc('0x57')]['statuses']){if(_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x81')]['length']===0x0)return;if(_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x81')][0x0][_0x2ccc('0x82')]!=='read')return;return db[_0x2ccc('0x83')][_0x2ccc('0x30')]({'read':!![],'readAt':_0x2d5dd9[_0x2ccc('0x57')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x2d5dd9['body'][_0x2ccc('0x81')][0x0][_0x2ccc('0x84')]},'individualHooks':!![]})[_0x2ccc('0x32')](function(_0x3eccb1){return _0x5d94b4[_0x2ccc('0x27')](0xc8)[_0x2ccc('0x2e')](_0x3eccb1);});}_0x119693[_0x2ccc('0x85')]=_[_0x2ccc('0x86')](_0x3dd2d4['Applications'],[_0x2ccc('0x7a')],[_0x2ccc('0x87')]);if(_0x119693[_0x2ccc('0x7f')][_0x2ccc('0x88')]){delete _0x119693[_0x2ccc('0x7f')]['Applications'];}return db[_0x2ccc('0x89')]['describe']()['then'](function(_0x259eb1){if(!_0x259eb1){throw new db[(_0x2ccc('0x8a'))][(_0x2ccc('0x8b'))]('no\x20available\x20attributes');}_0x26791b=_[_0x2ccc('0x8c')](_['keys'](_0x259eb1),[_0x2ccc('0x8d'),_0x2ccc('0x8e')]);_0x2a2ded=_[_0x2ccc('0x8c')](_[_0x2ccc('0x3e')](_0x259eb1),[_0x2ccc('0x8d'),_0x2ccc('0x8e'),'CompanyId',_0x2ccc('0x8f')]);_0x119693[_0x2ccc('0x57')]={'mapKey':'mobile'};if(_0x119693[_0x2ccc('0x7f')]&&_0x119693[_0x2ccc('0x7f')][_0x2ccc('0x3c')]==='twilio'){_0x119693['body'][_0x2ccc('0x90')]=_0x2d5dd9['body'][_0x2ccc('0x91')]['replace']('whatsapp:','');_0x119693[_0x2ccc('0x57')][_0x2ccc('0x57')]=_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x92')];_0x119693[_0x2ccc('0x57')][_0x2ccc('0x93')]=_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x94')];}if(_0x119693[_0x2ccc('0x7f')]&&_0x119693['account'][_0x2ccc('0x3c')]===_0x2ccc('0x80')){_0x119693['body'][_0x2ccc('0x90')]=_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x95')][0x0]['from'];_0x119693['body'][_0x2ccc('0x57')]=_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x95')][0x0]['message'][_0x2ccc('0x57')];_0x119693[_0x2ccc('0x57')]['messageId']=_0x2d5dd9[_0x2ccc('0x57')][_0x2ccc('0x95')][0x0][_0x2ccc('0x84')];}if(_0x119693['body']['id']){delete _0x119693[_0x2ccc('0x57')]['id'];}if(_['isNil'](_0x119693[_0x2ccc('0x57')]['from'])){throw new db['Sequelize'][(_0x2ccc('0x8b'))](_0x2ccc('0x96'));}if(_[_0x2ccc('0x97')](_0x119693[_0x2ccc('0x57')]['body'])||_0x119693[_0x2ccc('0x57')]['body']===''){throw new db[(_0x2ccc('0x8a'))][(_0x2ccc('0x8b'))](_0x2ccc('0x98'));}if(_[_0x2ccc('0x97')](_0x119693[_0x2ccc('0x57')][_0x2ccc('0x99')])){throw new db[(_0x2ccc('0x8a'))][(_0x2ccc('0x8b'))](_0x2ccc('0x9a')+_0x2a2ded);}if(!_[_0x2ccc('0x9b')](_0x2a2ded,_0x119693[_0x2ccc('0x57')][_0x2ccc('0x99')])){throw new db[(_0x2ccc('0x8a'))][(_0x2ccc('0x8b'))](_0x2ccc('0x9c')+_0x2a2ded);}_0x1ddf77[_0x119693[_0x2ccc('0x57')][_0x2ccc('0x99')]]=_0x119693[_0x2ccc('0x57')][_0x2ccc('0x90')];return db[_0x2ccc('0x9d')]['find']({'where':{'id':_0x119693[_0x2ccc('0x7f')][_0x2ccc('0x8f')]},'include':[{'model':db[_0x2ccc('0x89')],'as':_0x2ccc('0x9e'),'where':_0x1ddf77,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x2ccc('0x32')](handleEntityNotFound(_0x5d94b4,null))[_0x2ccc('0x32')](function(_0x1d09e1){if(_0x1d09e1){_0x119693[_0x2ccc('0x9f')]=_[_0x2ccc('0xa0')](_0x1d09e1,['Contacts']);if(_0x1d09e1['Contacts'][_0x2ccc('0x44')]){return _0x1d09e1['Contacts'][0x0];}var _0x2e8224=_[_0x2ccc('0x17')](_0x119693[_0x2ccc('0x57')],{'firstName':_0x119693[_0x2ccc('0x57')][_0x2ccc('0x90')],'ListId':_0x1d09e1['id']});_0x2e8224[_0x119693[_0x2ccc('0x57')][_0x2ccc('0x99')]]=_0x119693[_0x2ccc('0x57')][_0x2ccc('0x90')];return db[_0x2ccc('0x89')][_0x2ccc('0x56')](_0x2e8224,{'fields':_0x26791b,'raw':!![]});}})[_0x2ccc('0x32')](handleEntityNotFound(_0x5d94b4,null))[_0x2ccc('0x32')](function(_0x32b118){if(_0x32b118){_0x119693[_0x2ccc('0xa1')]=_0x32b118;var _0x1ccedb={'ContactId':_0x32b118['id'],'phone':_0x119693[_0x2ccc('0x57')][_0x2ccc('0x90')],'WhatsappAccountId':_0x2d5dd9['params']['id']};var _0x22c886={'ContactId':_0x32b118['id'],'WhatsappAccountId':_0x2d5dd9[_0x2ccc('0x60')]['id'],'closed':![]};return db[_0x2ccc('0xa2')][_0x2ccc('0x55')]({'where':_0x22c886})['then'](function(_0x3d11f2){if(_0x3d11f2){return[_0x3d11f2,![]];}return db[_0x2ccc('0xa2')]['create'](_0x1ccedb)[_0x2ccc('0x32')](function(_0x1cb7cb){return[_0x1cb7cb,!![]];});});}})[_0x2ccc('0x6e')](function(_0x5d938a,_0x1a8b8a){_0x119693[_0x2ccc('0xa3')]=_0x5d938a[_0x2ccc('0x59')]({'plain':!![]});_0x119693[_0x2ccc('0xa3')][_0x2ccc('0xa4')]=![];if(_0x1a8b8a){if(_0x119693[_0x2ccc('0x7f')]['autoclose']){_0x119693[_0x2ccc('0x85')]['push']({'id':0x0,'priority':_0x119693['applications']['length']+0x1,'app':_0x2ccc('0xa5'),'appdata':_0x2ccc('0xa6'),'interval':_0x2ccc('0xa7')});}_0x119693['interaction'][_0x2ccc('0xa4')]=!![];}return db[_0x2ccc('0x83')]['create']({'phone':_0x119693[_0x2ccc('0x57')][_0x2ccc('0x90')],'messageId':_0x119693[_0x2ccc('0x57')][_0x2ccc('0x93')],'body':_0x119693[_0x2ccc('0x57')][_0x2ccc('0x57')],'WhatsappAccountId':_0x2d5dd9['params']['id'],'WhatsappInteractionId':_0x5d938a['id'],'direction':'in','ContactId':_0x5d938a['ContactId'],'AttachmentId':_0x119693[_0x2ccc('0x57')][_0x2ccc('0xa8')]});})[_0x2ccc('0x32')](function(_0xb2a598){_0x119693[_0x2ccc('0x23')]=_0xb2a598;if(!_0x119693[_0x2ccc('0xa3')]['UserId'])return;return db[_0x2ccc('0xa9')][_0x2ccc('0x55')]({'attributes':['id',_0x2ccc('0x36')],'where':{'id':_0x119693[_0x2ccc('0xa3')][_0x2ccc('0xaa')]}});})[_0x2ccc('0x32')](function(_0xe3e353){if(_0xe3e353){_0x119693[_0x2ccc('0x85')][_0x2ccc('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe3e353['name']+','+(_0x119693[_0x2ccc('0x7f')][_0x2ccc('0xac')]||0xa),'interval':'*,*,*,*'});}if(!_0x119693[_0x2ccc('0xa3')][_0x2ccc('0xad')])return;return db[_0x2ccc('0xae')][_0x2ccc('0x55')]({'attributes':['id',_0x2ccc('0x36')],'where':{'id':_0x119693[_0x2ccc('0xa3')][_0x2ccc('0xad')]}});})[_0x2ccc('0x32')](function(_0x224cb7){if(_0x224cb7){_0x119693[_0x2ccc('0x85')][_0x2ccc('0xab')]({'id':0x0,'priority':0x1,'app':_0x2ccc('0xaf'),'appdata':_0x224cb7[_0x2ccc('0x36')]+','+(_0x119693['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x2ccc('0xa7')});}return respondWithRpcPromise(_0x2ccc('0xb0'),_0x2ccc('0xb1'),_0x119693);})[_0x2ccc('0x32')](function(_0x45ef2b){if(_0x45ef2b){var _0xadf823=0xc8;var _0x3cad10='receiveMessage';logger[_0x2ccc('0x24')](_0x2ccc('0x1e'),_0x3cad10,_0xadf823,_0x2ccc('0xb2'));logger[_0x2ccc('0x1d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3cad10,_0xadf823,'entity\x20found',JSON[_0x2ccc('0x20')](_0x45ef2b));if(_0x119693[_0x2ccc('0x7f')]['type']===_0x2ccc('0xb3')){return _0x5d94b4['status'](_0xadf823)['set']('Content-Type',_0x2ccc('0xb4'))['send'](_0x2ccc('0xb5'));}else{return _0x5d94b4[_0x2ccc('0x27')](_0xadf823)[_0x2ccc('0x2e')](_0x45ef2b);}}});})[_0x2ccc('0x5e')](handleError(_0x5d94b4,null));};exports['send']=function(_0x401f68,_0x2fbe11,_0x2fb5db){var _0x413a06,_0x40a039,_0x396f76;if(_['isNil'](_0x401f68['body'][_0x2ccc('0x57')])||_0x401f68[_0x2ccc('0x57')]['body']===''){throw new db[(_0x2ccc('0x8a'))][(_0x2ccc('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2ccc('0x97')](_0x401f68[_0x2ccc('0x57')]['to'])){throw new db['Sequelize'][(_0x2ccc('0x8b'))](_0x2ccc('0xb6'));}_0x413a06=_0x401f68[_0x2ccc('0x57')]['to'];return db[_0x2ccc('0x3a')][_0x2ccc('0x55')]({'where':{'id':_0x401f68[_0x2ccc('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x2ccc('0xb7'),'include':[{'model':db['CmContact'],'as':_0x2ccc('0x9e'),'where':{'mobile':_0x413a06},'limit':0x1,'order':[[_0x2ccc('0x8e'),_0x2ccc('0xb8')]]}]}]})[_0x2ccc('0x32')](handleEntityNotFound(_0x2fbe11,null))[_0x2ccc('0x32')](function(_0x413461){if(_0x413461&&_0x413461[_0x2ccc('0xb7')]){_0x40a039=_0x413461[_0x2ccc('0x59')]({'plain':!![]});if(_0x40a039[_0x2ccc('0xb7')]&&_0x40a039[_0x2ccc('0xb7')][_0x2ccc('0x9e')]['length']){return _0x40a039[_0x2ccc('0xb7')][_0x2ccc('0x9e')][0x0];}return db[_0x2ccc('0x89')][_0x2ccc('0x56')](_[_0x2ccc('0x17')](_0x401f68['body'],{'firstName':_0x413a06,'mobile':_0x413a06,'phone':_0x413a06,'ListId':_0x40a039['ListId']}));}})[_0x2ccc('0x32')](handleEntityNotFound(_0x2fbe11,null))[_0x2ccc('0x32')](function(_0x3b7f05){if(_0x3b7f05){_0x396f76=_0x3b7f05;return db[_0x2ccc('0xa2')][_0x2ccc('0x55')]({'where':{'ContactId':_0x396f76['id'],'closed':![],'WhatsappAccountId':_0x40a039['id']}})[_0x2ccc('0x32')](function(_0x16803c){if(_0x16803c){return[_0x16803c,![]];}return db[_0x2ccc('0xa2')][_0x2ccc('0x56')]({'UserId':_0x401f68[_0x2ccc('0x58')]['id'],'ContactId':_0x396f76['id'],'WhatsappAccountId':_0x40a039['id'],'phone':_0x413a06,'firstMsgDirection':_0x2ccc('0xb9'),'Messages':[_[_0x2ccc('0x4c')](_0x401f68['body'],{'read':![],'body':_0x401f68[_0x2ccc('0x57')][_0x2ccc('0x57')],'phone':_0x413a06,'WhatsappAccountId':_0x40a039['id'],'UserId':_0x401f68[_0x2ccc('0x58')]['id'],'ContactId':_0x396f76['id']})]},{'include':[{'model':db[_0x2ccc('0x83')],'as':_0x2ccc('0xba')}]})[_0x2ccc('0x32')](function(_0x481786){return[_0x481786,!![]];});});}})[_0x2ccc('0x6e')](function(_0x3b22b4,_0x437250){if(_0x437250){return _0x3b22b4;}return db[_0x2ccc('0x83')]['create'](_[_0x2ccc('0x4c')](_0x401f68[_0x2ccc('0x57')],{'read':![],'body':_0x401f68[_0x2ccc('0x57')][_0x2ccc('0x57')],'phone':_0x413a06,'WhatsappAccountId':_0x40a039['id'],'WhatsappInteractionId':_0x3b22b4['id'],'UserId':_0x401f68[_0x2ccc('0x58')]['id'],'ContactId':_0x396f76['id']}))[_0x2ccc('0x32')](function(_0xcc796a){_0x3b22b4[_0x2ccc('0xbb')]['Messages']=[];_0x3b22b4[_0x2ccc('0xbb')][_0x2ccc('0xba')][_0x2ccc('0xbc')](_0xcc796a['dataValues']);return _0x3b22b4;});})[_0x2ccc('0x32')](respondWithResult(_0x2fbe11,null))[_0x2ccc('0x5e')](handleError(_0x2fbe11,null));}; \ No newline at end of file +var _0x726f=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','request','then','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','sendStatus','status','json','undefined','limit','offset','set','reject','save','destroy','get','UserProfileResource','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','count','includeAll','include','rows','params','Pause','options','find','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','catch','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','stack','finally','getApplications','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','Body','messageId','notifications','message_id','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','UserId','waitForTheAssignedAgent','queueId','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','send','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x726f,0xa2));var _0xf726=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x726f[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xf726('0x0'));var rimraf=require(_0xf726('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf726('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf726('0x3'));var Mustache=require(_0xf726('0x4'));var util=require(_0xf726('0x5'));var path=require(_0xf726('0x6'));var sox=require(_0xf726('0x7'));var csv=require(_0xf726('0x8'));var ejs=require(_0xf726('0x9'));var fs=require('fs');var fs_extra=require(_0xf726('0xa'));var _=require(_0xf726('0xb'));var squel=require(_0xf726('0xc'));var crypto=require(_0xf726('0xd'));var jsforce=require(_0xf726('0xe'));var deskjs=require(_0xf726('0xf'));var toCsv=require(_0xf726('0x8'));var querystring=require(_0xf726('0x10'));var Papa=require(_0xf726('0x11'));var Redis=require(_0xf726('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf726('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf726('0x14'));var config=require(_0xf726('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf726('0x16'))['db'];config[_0xf726('0x17')]=_[_0xf726('0x18')](config[_0xf726('0x17')],{'host':_0xf726('0x19'),'port':0x18eb});var socket=require(_0xf726('0x1a'))(new Redis(config[_0xf726('0x17')]));require(_0xf726('0x1b'))['register'](socket);var jayson=require(_0xf726('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3d5cbf,_0x359cbf,_0x5dee54,_0x942f6c){return new BPromise(function(_0x13c001,_0x6c89cc){var _0x545e84=_0x942f6c||client;return _0x545e84[_0xf726('0x1d')](_0x3d5cbf,_0x5dee54)[_0xf726('0x1e')](function(_0x1a849b){logger['info'](_0xf726('0x1f'),_0x359cbf,'request\x20sent');logger[_0xf726('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x359cbf,_0xf726('0x21'),JSON['stringify'](_0x1a849b));if(_0x1a849b[_0xf726('0x22')]){if(_0x1a849b[_0xf726('0x22')][_0xf726('0x23')]===0x1f4){logger['error'](_0xf726('0x1f'),_0x359cbf,_0x1a849b['error'][_0xf726('0x24')]);return _0x6c89cc(_0x1a849b[_0xf726('0x22')]['message']);}logger[_0xf726('0x22')](_0xf726('0x1f'),_0x359cbf,_0x1a849b[_0xf726('0x22')][_0xf726('0x24')]);return _0x13c001(_0x1a849b[_0xf726('0x22')][_0xf726('0x24')]);}else{logger[_0xf726('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x359cbf,_0xf726('0x21'));_0x13c001(_0x1a849b['result'][_0xf726('0x24')]);}})['catch'](function(_0x5e01e9){logger[_0xf726('0x22')](_0xf726('0x1f'),_0x359cbf,_0x5e01e9);_0x6c89cc(_0x5e01e9);});});}function respondWithStatusCode(_0x9a0a3c,_0x3877af){_0x3877af=_0x3877af||0xcc;return function(_0x11015e){if(_0x11015e){return _0x9a0a3c[_0xf726('0x26')](_0x3877af);}return _0x9a0a3c['status'](_0x3877af)['end']();};}function respondWithResult(_0x5cad1c,_0x470be4){_0x470be4=_0x470be4||0xc8;return function(_0x4f6607){if(_0x4f6607){return _0x5cad1c[_0xf726('0x27')](_0x470be4)[_0xf726('0x28')](_0x4f6607);}};}function respondWithFilteredResult(_0x54c057,_0x417362){return function(_0x291869){if(_0x291869){var _0x152b29=typeof _0x417362['offset']===_0xf726('0x29')&&typeof _0x417362[_0xf726('0x2a')]===_0xf726('0x29');var _0xfbb649=_0x291869['count'];var _0x1f33d0=_0x152b29?0x0:_0x417362[_0xf726('0x2b')];var _0x3c6859=_0x152b29?_0x291869['count']:_0x417362[_0xf726('0x2b')]+_0x417362[_0xf726('0x2a')];var _0x21c276;if(_0x3c6859>=_0xfbb649){_0x3c6859=_0xfbb649;_0x21c276=0xc8;}else{_0x21c276=0xce;}_0x54c057['status'](_0x21c276);return _0x54c057[_0xf726('0x2c')]('Content-Range',_0x1f33d0+'-'+_0x3c6859+'/'+_0xfbb649)[_0xf726('0x28')](_0x291869);}return null;};}function patchUpdates(_0xa91bb3){return function(_0x30a951){try{jsonpatch['apply'](_0x30a951,_0xa91bb3,!![]);}catch(_0x985282){return BPromise[_0xf726('0x2d')](_0x985282);}return _0x30a951[_0xf726('0x2e')]();};}function saveUpdates(_0x17a046,_0x33c6a7){return function(_0x36791a){if(_0x36791a){return _0x36791a['update'](_0x17a046)[_0xf726('0x1e')](function(_0x53a1e8){return _0x53a1e8;});}return null;};}function removeEntity(_0x335b00,_0x232ac2){return function(_0x3aac79){if(_0x3aac79){return _0x3aac79[_0xf726('0x2f')]()[_0xf726('0x1e')](function(){var _0x3a338c=_0x3aac79[_0xf726('0x30')]({'plain':!![]});var _0x535268='WhatsappAccounts';return db[_0xf726('0x31')]['destroy']({'where':{'type':_0x535268,'resourceId':_0x3a338c['id']}})[_0xf726('0x1e')](function(){return _0x3aac79;});})[_0xf726('0x1e')](function(){_0x335b00[_0xf726('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x492f8a,_0x2894c3){return function(_0xe2c1fd){if(!_0xe2c1fd){_0x492f8a[_0xf726('0x26')](0x194);}return _0xe2c1fd;};}function handleError(_0x1097be,_0x2e7ce5){_0x2e7ce5=_0x2e7ce5||0x1f4;return function(_0x56b62d){logger[_0xf726('0x22')](_0x56b62d['stack']);if(_0x56b62d[_0xf726('0x32')]){delete _0x56b62d[_0xf726('0x32')];}_0x1097be['status'](_0x2e7ce5)['send'](_0x56b62d);};}exports['index']=function(_0x29ff81,_0x12e5e4){var _0x84fbe1={'include':[{'model':db['Pause'],'as':_0xf726('0x33')}]},_0x425ebb={},_0x34ae20={'count':0x0,'rows':[]};var _0x579d17=_[_0xf726('0x34')](db[_0xf726('0x35')][_0xf726('0x36')],function(_0x57c682){return{'name':_0x57c682[_0xf726('0x37')],'type':_0x57c682['type']['key']};});_0x425ebb[_0xf726('0x38')]=_[_0xf726('0x34')](_0x579d17,_0xf726('0x32'));_0x425ebb[_0xf726('0x39')]=_[_0xf726('0x3a')](_0x29ff81['query']);_0x425ebb[_0xf726('0x3b')]=_[_0xf726('0x3c')](_0x425ebb[_0xf726('0x38')],_0x425ebb[_0xf726('0x39')]);_0x84fbe1[_0xf726('0x3d')]=_[_0xf726('0x3c')](_0x425ebb[_0xf726('0x38')],qs['fields'](_0x29ff81[_0xf726('0x39')][_0xf726('0x3e')]));_0x84fbe1[_0xf726('0x3d')]=_0x84fbe1[_0xf726('0x3d')][_0xf726('0x3f')]?_0x84fbe1[_0xf726('0x3d')]:_0x425ebb[_0xf726('0x38')];if(!_0x29ff81['query'][_0xf726('0x40')](_0xf726('0x41'))){_0x84fbe1['limit']=qs['limit'](_0x29ff81[_0xf726('0x39')][_0xf726('0x2a')]);_0x84fbe1['offset']=qs[_0xf726('0x2b')](_0x29ff81['query'][_0xf726('0x2b')]);}_0x84fbe1[_0xf726('0x42')]=qs[_0xf726('0x43')](_0x29ff81[_0xf726('0x39')][_0xf726('0x43')]);_0x84fbe1[_0xf726('0x44')]=qs[_0xf726('0x3b')](_[_0xf726('0x45')](_0x29ff81[_0xf726('0x39')],_0x425ebb[_0xf726('0x3b')]),_0x579d17);if(_0x29ff81['query']['filter']){_0x84fbe1[_0xf726('0x44')]=_[_0xf726('0x46')](_0x84fbe1['where'],{'$or':_[_0xf726('0x34')](_0x579d17,function(_0x3cdd4a){if(_0x3cdd4a[_0xf726('0x47')]!=='VIRTUAL'){var _0x2c2f19={};_0x2c2f19[_0x3cdd4a[_0xf726('0x32')]]={'$like':'%'+_0x29ff81[_0xf726('0x39')][_0xf726('0x48')]+'%'};return _0x2c2f19;}})});}_0x84fbe1=_[_0xf726('0x46')]({},_0x84fbe1,_0x29ff81['options']);var _0x5b6c38={'where':_0x84fbe1[_0xf726('0x44')]};return db[_0xf726('0x35')][_0xf726('0x49')](_0x5b6c38)[_0xf726('0x1e')](function(_0x4e0d81){_0x34ae20['count']=_0x4e0d81;if(_0x29ff81['query'][_0xf726('0x4a')]){_0x84fbe1[_0xf726('0x4b')]=[{'all':!![]}];}return db[_0xf726('0x35')]['findAll'](_0x84fbe1);})[_0xf726('0x1e')](function(_0x2b35d8){_0x34ae20[_0xf726('0x4c')]=_0x2b35d8;return _0x34ae20;})[_0xf726('0x1e')](respondWithFilteredResult(_0x12e5e4,_0x84fbe1))['catch'](handleError(_0x12e5e4,null));};exports['show']=function(_0x3e5561,_0xb9f953){var _0x552a40={'raw':![],'where':{'id':_0x3e5561[_0xf726('0x4d')]['id']},'include':[{'model':db[_0xf726('0x4e')],'as':_0xf726('0x33')}]},_0x344f51={};_0x344f51[_0xf726('0x38')]=_[_0xf726('0x3a')](db[_0xf726('0x35')][_0xf726('0x36')]);_0x344f51[_0xf726('0x39')]=_[_0xf726('0x3a')](_0x3e5561['query']);_0x344f51[_0xf726('0x3b')]=_[_0xf726('0x3c')](_0x344f51[_0xf726('0x38')],_0x344f51['query']);_0x552a40[_0xf726('0x3d')]=_[_0xf726('0x3c')](_0x344f51[_0xf726('0x38')],qs['fields'](_0x3e5561[_0xf726('0x39')]['fields']));_0x552a40['attributes']=_0x552a40['attributes'][_0xf726('0x3f')]?_0x552a40[_0xf726('0x3d')]:_0x344f51[_0xf726('0x38')];if(_0x3e5561['query'][_0xf726('0x4a')]){_0x552a40[_0xf726('0x4b')]=[{'all':!![]}];}_0x552a40=_[_0xf726('0x46')]({},_0x552a40,_0x3e5561[_0xf726('0x4f')]);return db[_0xf726('0x35')][_0xf726('0x50')](_0x552a40)[_0xf726('0x1e')](handleEntityNotFound(_0xb9f953,null))[_0xf726('0x1e')](respondWithResult(_0xb9f953,null))['catch'](handleError(_0xb9f953,null));};exports['create']=function(_0x560dfc,_0x425f35){return db[_0xf726('0x35')][_0xf726('0x51')](_0x560dfc[_0xf726('0x52')],{})[_0xf726('0x1e')](function(_0x26bb26){var _0x5b60a3=_0x560dfc['user'][_0xf726('0x30')]({'plain':!![]});if(!_0x5b60a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b60a3[_0xf726('0x53')]===_0xf726('0x54')){var _0x28fdea=_0x26bb26[_0xf726('0x30')]({'plain':!![]});var _0xb62fc1='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0xb62fc1,'userProfileId':_0x5b60a3[_0xf726('0x55')]},'raw':!![]})['then'](function(_0x52afda){if(_0x52afda&&_0x52afda[_0xf726('0x56')]===0x0){return db[_0xf726('0x31')][_0xf726('0x51')]({'name':_0x28fdea[_0xf726('0x32')],'resourceId':_0x28fdea['id'],'type':_0x52afda['name'],'sectionId':_0x52afda['id']},{})[_0xf726('0x1e')](function(){return _0x26bb26;});}else{return _0x26bb26;}})['catch'](function(_0x243b67){logger[_0xf726('0x22')](_0xf726('0x57'),_0x243b67);throw _0x243b67;});}return _0x26bb26;})[_0xf726('0x1e')](respondWithResult(_0x425f35,0xc9))['catch'](handleError(_0x425f35,null));};exports[_0xf726('0x58')]=function(_0x2a8f40,_0x33f530){if(_0x2a8f40[_0xf726('0x52')]['id']){delete _0x2a8f40[_0xf726('0x52')]['id'];}return db[_0xf726('0x35')][_0xf726('0x50')]({'where':{'id':_0x2a8f40[_0xf726('0x4d')]['id']},'include':[{'model':db[_0xf726('0x4e')],'as':_0xf726('0x33')}]})[_0xf726('0x1e')](handleEntityNotFound(_0x33f530,null))['then'](saveUpdates(_0x2a8f40[_0xf726('0x52')],null))['then'](respondWithResult(_0x33f530,null))[_0xf726('0x59')](handleError(_0x33f530,null));};exports[_0xf726('0x2f')]=function(_0x16ba28,_0x48aace){return db['WhatsappAccount'][_0xf726('0x50')]({'where':{'id':_0x16ba28['params']['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x48aace,null))[_0xf726('0x1e')](removeEntity(_0x48aace,null))[_0xf726('0x59')](handleError(_0x48aace,null));};exports[_0xf726('0x5a')]=function(_0x3b4754,_0xfe3926){return db['WhatsappAccount'][_0xf726('0x5a')]()['then'](respondWithResult(_0xfe3926,null))[_0xf726('0x59')](handleError(_0xfe3926,null));};exports[_0xf726('0x5b')]=function(_0x27348a,_0x4d99d6,_0x29dfe7){if(_0x27348a['body']['id']){delete _0x27348a[_0xf726('0x52')]['id'];}return db['WhatsappAccount'][_0xf726('0x50')]({'where':{'id':_0x27348a[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x4d99d6,null))[_0xf726('0x1e')](function(_0x1a9ffb){if(_0x1a9ffb){_0x27348a['body'][_0xf726('0x5c')]=_0x1a9ffb['id'];return db['Disposition']['create'](_0x27348a[_0xf726('0x52')]);}})[_0xf726('0x1e')](respondWithResult(_0x4d99d6,null))[_0xf726('0x59')](handleError(_0x4d99d6,null));};exports[_0xf726('0x5d')]=function(_0x553ee4,_0x4d5391,_0x922a84){var _0x39d27c={'raw':![],'where':{}};var _0x281c45={};var _0x5e680e={'count':0x0,'rows':[]};return db[_0xf726('0x35')][_0xf726('0x5e')]({'where':{'id':_0x553ee4[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x4d5391,null))['then'](function(_0x2a2ef1){if(_0x2a2ef1){_0x281c45['model']=_['keys'](db[_0xf726('0x5f')][_0xf726('0x36')]);_0x281c45[_0xf726('0x39')]=_['keys'](_0x553ee4[_0xf726('0x39')]);_0x281c45[_0xf726('0x3b')]=_[_0xf726('0x3c')](_0x281c45[_0xf726('0x38')],_0x281c45[_0xf726('0x39')]);_0x39d27c[_0xf726('0x3d')]=_[_0xf726('0x3c')](_0x281c45[_0xf726('0x38')],qs[_0xf726('0x3e')](_0x553ee4[_0xf726('0x39')][_0xf726('0x3e')]));_0x39d27c[_0xf726('0x3d')]=_0x39d27c[_0xf726('0x3d')][_0xf726('0x3f')]?_0x39d27c[_0xf726('0x3d')]:_0x281c45[_0xf726('0x38')];if(!_0x553ee4[_0xf726('0x39')][_0xf726('0x40')](_0xf726('0x41'))){_0x39d27c[_0xf726('0x2a')]=qs[_0xf726('0x2a')](_0x553ee4[_0xf726('0x39')]['limit']);_0x39d27c[_0xf726('0x2b')]=qs['offset'](_0x553ee4[_0xf726('0x39')][_0xf726('0x2b')]);}_0x39d27c[_0xf726('0x42')]=qs[_0xf726('0x43')](_0x553ee4[_0xf726('0x39')][_0xf726('0x43')]);_0x39d27c[_0xf726('0x44')]=qs[_0xf726('0x3b')](_[_0xf726('0x45')](_0x553ee4[_0xf726('0x39')],_0x281c45[_0xf726('0x3b')]));_0x39d27c['where']['WhatsappAccountId']=_0x2a2ef1['id'];if(_0x553ee4[_0xf726('0x39')][_0xf726('0x48')]){_0x39d27c[_0xf726('0x44')]=_[_0xf726('0x46')](_0x39d27c[_0xf726('0x44')],{'$or':_['map'](_0x39d27c[_0xf726('0x3d')],function(_0x7c0858){var _0x41555b={};_0x41555b[_0x7c0858]={'$like':'%'+_0x553ee4[_0xf726('0x39')][_0xf726('0x48')]+'%'};return _0x41555b;})});}_0x39d27c=_[_0xf726('0x46')]({},_0x39d27c,_0x553ee4[_0xf726('0x4f')]);return db[_0xf726('0x5f')]['count']({'where':_0x39d27c[_0xf726('0x44')]})[_0xf726('0x1e')](function(_0xde9deb){_0x5e680e[_0xf726('0x49')]=_0xde9deb;if(_0x553ee4[_0xf726('0x39')][_0xf726('0x4a')]){_0x39d27c[_0xf726('0x4b')]=[{'all':!![]}];}return db[_0xf726('0x5f')][_0xf726('0x60')](_0x39d27c);})['then'](function(_0x2b8e6c){_0x5e680e[_0xf726('0x4c')]=_0x2b8e6c;return _0x5e680e;});}})[_0xf726('0x1e')](respondWithFilteredResult(_0x4d5391,_0x39d27c))['catch'](handleError(_0x4d5391,null));};exports[_0xf726('0x61')]=function(_0x2f5d52,_0x17655e,_0x88598a){return db[_0xf726('0x35')][_0xf726('0x50')]({'where':{'id':_0x2f5d52[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x17655e,null))[_0xf726('0x1e')](function(_0x495cb2){if(_0x495cb2){return _0x495cb2[_0xf726('0x61')](_0x2f5d52[_0xf726('0x39')][_0xf726('0x62')]);}})[_0xf726('0x1e')](respondWithStatusCode(_0x17655e,null))[_0xf726('0x59')](handleError(_0x17655e,null));};exports[_0xf726('0x63')]=function(_0x4b2a38,_0xf8d6c8,_0x549014){if(_0x4b2a38[_0xf726('0x52')]['id']){delete _0x4b2a38[_0xf726('0x52')]['id'];}return db[_0xf726('0x35')][_0xf726('0x50')]({'where':{'id':_0x4b2a38[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0xf8d6c8,null))[_0xf726('0x1e')](function(_0x413052){if(_0x413052){_0x4b2a38[_0xf726('0x52')][_0xf726('0x5c')]=_0x413052['id'];return db[_0xf726('0x64')]['create'](_0x4b2a38[_0xf726('0x52')]);}})['then'](respondWithResult(_0xf8d6c8,null))[_0xf726('0x59')](handleError(_0xf8d6c8,null));};exports[_0xf726('0x65')]=function(_0x5b7859,_0x5ac314,_0x50da3d){var _0x365cdb={'raw':![],'where':{}};var _0x1135d3={};var _0x59b282={'count':0x0,'rows':[]};return db[_0xf726('0x35')][_0xf726('0x5e')]({'where':{'id':_0x5b7859[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x5ac314,null))[_0xf726('0x1e')](function(_0x598445){if(_0x598445){_0x1135d3[_0xf726('0x38')]=_['keys'](db[_0xf726('0x64')][_0xf726('0x36')]);_0x1135d3[_0xf726('0x39')]=_[_0xf726('0x3a')](_0x5b7859['query']);_0x1135d3[_0xf726('0x3b')]=_[_0xf726('0x3c')](_0x1135d3[_0xf726('0x38')],_0x1135d3['query']);_0x365cdb['attributes']=_['intersection'](_0x1135d3[_0xf726('0x38')],qs['fields'](_0x5b7859[_0xf726('0x39')][_0xf726('0x3e')]));_0x365cdb[_0xf726('0x3d')]=_0x365cdb[_0xf726('0x3d')]['length']?_0x365cdb[_0xf726('0x3d')]:_0x1135d3['model'];if(!_0x5b7859[_0xf726('0x39')][_0xf726('0x40')](_0xf726('0x41'))){_0x365cdb[_0xf726('0x2a')]=qs[_0xf726('0x2a')](_0x5b7859[_0xf726('0x39')][_0xf726('0x2a')]);_0x365cdb[_0xf726('0x2b')]=qs[_0xf726('0x2b')](_0x5b7859[_0xf726('0x39')][_0xf726('0x2b')]);}_0x365cdb[_0xf726('0x42')]=qs['sort'](_0x5b7859['query'][_0xf726('0x43')]);_0x365cdb[_0xf726('0x44')]=qs[_0xf726('0x3b')](_[_0xf726('0x45')](_0x5b7859[_0xf726('0x39')],_0x1135d3['filters']));_0x365cdb[_0xf726('0x44')]['WhatsappAccountId']=_0x598445['id'];if(_0x5b7859[_0xf726('0x39')][_0xf726('0x48')]){_0x365cdb['where']=_['merge'](_0x365cdb[_0xf726('0x44')],{'$or':_['map'](_0x365cdb['attributes'],function(_0x1f9c0d){var _0x37eb8a={};_0x37eb8a[_0x1f9c0d]={'$like':'%'+_0x5b7859[_0xf726('0x39')]['filter']+'%'};return _0x37eb8a;})});}_0x365cdb=_[_0xf726('0x46')]({},_0x365cdb,_0x5b7859['options']);return db[_0xf726('0x64')][_0xf726('0x49')]({'where':_0x365cdb[_0xf726('0x44')]})[_0xf726('0x1e')](function(_0x3d5d84){_0x59b282[_0xf726('0x49')]=_0x3d5d84;if(_0x5b7859[_0xf726('0x39')][_0xf726('0x4a')]){_0x365cdb['include']=[{'all':!![]}];}return db[_0xf726('0x64')]['findAll'](_0x365cdb);})[_0xf726('0x1e')](function(_0x2417cd){_0x59b282[_0xf726('0x4c')]=_0x2417cd;return _0x59b282;});}})[_0xf726('0x1e')](respondWithFilteredResult(_0x5ac314,_0x365cdb))[_0xf726('0x59')](handleError(_0x5ac314,null));};exports[_0xf726('0x66')]=function(_0x4f6690,_0x152e43,_0x379f7c){return db[_0xf726('0x35')]['find']({'where':{'id':_0x4f6690[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x152e43,null))[_0xf726('0x1e')](function(_0x2af6e2){if(_0x2af6e2){return _0x2af6e2[_0xf726('0x66')](_0x4f6690[_0xf726('0x39')]['ids']);}})[_0xf726('0x1e')](respondWithStatusCode(_0x152e43,null))[_0xf726('0x59')](handleError(_0x152e43,null));};exports['addAgents']=function(_0x550cf8,_0x54d38f,_0x9c59b0){return db[_0xf726('0x35')]['find']({'where':{'id':_0x550cf8[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x54d38f,null))[_0xf726('0x1e')](function(_0x3470c9){if(_0x3470c9){return _0x3470c9[_0xf726('0x67')](_0x550cf8[_0xf726('0x52')][_0xf726('0x62')],_[_0xf726('0x68')](_0x550cf8[_0xf726('0x52')],[_0xf726('0x62'),'id'])||{})[_0xf726('0x69')](function(_0x5f33cb){for(var _0x6a2672=0x0;_0x6a2672<_0x550cf8['body'][_0xf726('0x62')][_0xf726('0x3f')];_0x6a2672+=0x1){socket[_0xf726('0x6a')]('userWhatsappAccount:save',{'UserId':Number(_0x550cf8[_0xf726('0x52')][_0xf726('0x62')][_0x6a2672]),'WhatsappAccountId':Number(_0x550cf8[_0xf726('0x4d')]['id'])});}return _0x5f33cb;});}})[_0xf726('0x1e')](respondWithResult(_0x54d38f,null))['catch'](handleError(_0x54d38f,null));};exports[_0xf726('0x6b')]=function(_0x65f38c,_0x26365b,_0x2a4f6f){return db['WhatsappAccount'][_0xf726('0x50')]({'where':{'id':_0x65f38c[_0xf726('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26365b,null))[_0xf726('0x1e')](function(_0x2b7136){if(_0x2b7136){return _0x2b7136[_0xf726('0x6b')](_0x65f38c[_0xf726('0x39')]['ids'])['then'](function(){if(_[_0xf726('0x6c')](_0x65f38c['query']['ids'])){for(var _0x59628c=0x0;_0x59628c<_0x65f38c['query'][_0xf726('0x62')][_0xf726('0x3f')];_0x59628c+=0x1){socket[_0xf726('0x6a')]('userWhatsappAccount:remove',{'UserId':Number(_0x65f38c[_0xf726('0x39')]['ids'][_0x59628c]),'WhatsappAccountId':Number(_0x65f38c[_0xf726('0x4d')]['id'])});}}else{socket[_0xf726('0x6a')]('userWhatsappAccount:remove',{'UserId':Number(_0x65f38c['query'][_0xf726('0x62')]),'WhatsappAccountId':Number(_0x65f38c[_0xf726('0x4d')]['id'])});}});}})[_0xf726('0x1e')](respondWithStatusCode(_0x26365b,null))['catch'](handleError(_0x26365b,null));};exports[_0xf726('0x6d')]=function(_0x1701c7,_0x1136f5,_0xe0181){var _0x46e38d={};var _0x48bbad={};var _0x4b9e5b;var _0x1ec513;return db[_0xf726('0x35')][_0xf726('0x5e')]({'where':{'id':_0x1701c7[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x1136f5,null))[_0xf726('0x1e')](function(_0x37024d){if(_0x37024d){_0x4b9e5b=_0x37024d;_0x48bbad[_0xf726('0x38')]=_[_0xf726('0x3a')](db[_0xf726('0x6e')][_0xf726('0x36')]);_0x48bbad[_0xf726('0x39')]=_['keys'](_0x1701c7[_0xf726('0x39')]);_0x48bbad['filters']=_[_0xf726('0x3c')](_0x48bbad['model'],_0x48bbad[_0xf726('0x39')]);_0x46e38d[_0xf726('0x3d')]=_['intersection'](_0x48bbad['model'],qs[_0xf726('0x3e')](_0x1701c7['query'][_0xf726('0x3e')]));_0x46e38d[_0xf726('0x3d')]=_0x46e38d[_0xf726('0x3d')]['length']?_0x46e38d[_0xf726('0x3d')]:_0x48bbad[_0xf726('0x38')];_0x46e38d[_0xf726('0x42')]=qs['sort'](_0x1701c7[_0xf726('0x39')][_0xf726('0x43')]);_0x46e38d[_0xf726('0x44')]=qs[_0xf726('0x3b')](_[_0xf726('0x45')](_0x1701c7[_0xf726('0x39')],_0x48bbad['filters']));if(_0x1701c7[_0xf726('0x39')][_0xf726('0x48')]){_0x46e38d[_0xf726('0x44')]=_[_0xf726('0x46')](_0x46e38d[_0xf726('0x44')],{'$or':_[_0xf726('0x34')](_0x46e38d[_0xf726('0x3d')],function(_0x535eed){var _0x1e88d0={};_0x1e88d0[_0x535eed]={'$like':'%'+_0x1701c7[_0xf726('0x39')][_0xf726('0x48')]+'%'};return _0x1e88d0;})});}_0x46e38d=_[_0xf726('0x46')]({},_0x46e38d,_0x1701c7['options']);return _0x4b9e5b['getAgents'](_0x46e38d);}})[_0xf726('0x1e')](function(_0x426cb7){if(_0x426cb7){_0x1ec513=_0x426cb7[_0xf726('0x3f')];if(!_0x1701c7['query'][_0xf726('0x40')]('nolimit')){_0x46e38d[_0xf726('0x2a')]=qs['limit'](_0x1701c7[_0xf726('0x39')][_0xf726('0x2a')]);_0x46e38d[_0xf726('0x2b')]=qs[_0xf726('0x2b')](_0x1701c7[_0xf726('0x39')]['offset']);}return _0x4b9e5b['getAgents'](_0x46e38d);}})[_0xf726('0x1e')](function(_0x242c4e){if(_0x242c4e){return _0x242c4e?{'count':_0x1ec513,'rows':_0x242c4e}:null;}})['then'](respondWithResult(_0x1136f5,null))[_0xf726('0x59')](handleError(_0x1136f5,null));};exports[_0xf726('0x6f')]=function(_0x1bde96,_0x5a2603){var _0x4c2349=_0x1bde96[_0xf726('0x4d')]['id'];var _0x55fba5=_0x1bde96[_0xf726('0x52')];var _0x51b84c=0xc8;var _0x4ae9f0=null;return db[_0xf726('0x70')][_0xf726('0x71')]({'isolationLevel':db[_0xf726('0x70')][_0xf726('0x72')]['ISOLATION_LEVELS'][_0xf726('0x73')]},function(_0x1ec8b5){return db[_0xf726('0x35')][_0xf726('0x5e')]({'where':{'id':_0x4c2349},'transaction':_0x1ec8b5})['then'](function(_0xe55e1f){if(_0xe55e1f){return db['WhatsappApplication'][_0xf726('0x2f')]({'where':{'WhatsappAccountId':_0x4c2349},'transaction':_0x1ec8b5})[_0xf726('0x1e')](function(){var _0x5d1c1d=_['map'](_0x55fba5,function(_0x8de12e){_0x8de12e['WhatsappAccountId']=_0x4c2349;return _0x8de12e;});return db['WhatsappApplication'][_0xf726('0x74')](_0x5d1c1d,{'transaction':_0x1ec8b5});});}else{_0x51b84c=0x194;_0x4ae9f0=[];}});})[_0xf726('0x1e')](function(){if(_0x51b84c!==0x194){return db[_0xf726('0x75')][_0xf726('0x76')]({'where':{'WhatsappAccountId':_0x4c2349},'order':'priority'})['then'](function(_0x5b4259){_0x4ae9f0=_0x5b4259;});}})[_0xf726('0x59')](function(_0x130ab3){_0x51b84c=0x1f4;logger[_0xf726('0x22')](_0x130ab3[_0xf726('0x77')]);if(_0x130ab3[_0xf726('0x32')]){delete _0x130ab3[_0xf726('0x32')];}_0x4ae9f0=_0x130ab3;})[_0xf726('0x78')](function(){if(_0x4ae9f0===null){_0x5a2603[_0xf726('0x26')](_0x51b84c);}else{if(_0x51b84c===0x1f4){_0x5a2603[_0xf726('0x27')](_0x51b84c)['send'](_0x4ae9f0);}else{_0x5a2603[_0xf726('0x27')](_0x51b84c)[_0xf726('0x28')](_0x4ae9f0);}}});};exports[_0xf726('0x79')]=function(_0x2d27a6,_0x2a8072,_0x24cfd7){var _0x140bd4={};var _0x560b72={};var _0x531510;var _0x174873;return db['WhatsappAccount']['findOne']({'where':{'id':_0x2d27a6[_0xf726('0x4d')]['id']}})[_0xf726('0x1e')](handleEntityNotFound(_0x2a8072,null))[_0xf726('0x1e')](function(_0x14a5ab){if(_0x14a5ab){_0x531510=_0x14a5ab;_0x560b72['model']=_[_0xf726('0x3a')](db[_0xf726('0x75')][_0xf726('0x36')]);_0x560b72[_0xf726('0x39')]=_[_0xf726('0x3a')](_0x2d27a6[_0xf726('0x39')]);_0x560b72[_0xf726('0x3b')]=_[_0xf726('0x3c')](_0x560b72[_0xf726('0x38')],_0x560b72[_0xf726('0x39')]);_0x140bd4['attributes']=_['intersection'](_0x560b72[_0xf726('0x38')],qs[_0xf726('0x3e')](_0x2d27a6[_0xf726('0x39')][_0xf726('0x3e')]));_0x140bd4[_0xf726('0x3d')]=_0x140bd4[_0xf726('0x3d')][_0xf726('0x3f')]?_0x140bd4[_0xf726('0x3d')]:_0x560b72['model'];_0x140bd4[_0xf726('0x42')]=qs['sort'](_0x2d27a6[_0xf726('0x39')][_0xf726('0x43')]);_0x140bd4[_0xf726('0x44')]=qs[_0xf726('0x3b')](_[_0xf726('0x45')](_0x2d27a6['query'],_0x560b72[_0xf726('0x3b')]));if(_0x2d27a6['query'][_0xf726('0x48')]){_0x140bd4[_0xf726('0x44')]=_[_0xf726('0x46')](_0x140bd4['where'],{'$or':_[_0xf726('0x34')](_0x140bd4[_0xf726('0x3d')],function(_0x47c1f2){var _0x574ec5={};_0x574ec5[_0x47c1f2]={'$like':'%'+_0x2d27a6[_0xf726('0x39')]['filter']+'%'};return _0x574ec5;})});}_0x140bd4=_[_0xf726('0x46')]({},_0x140bd4,_0x2d27a6[_0xf726('0x4f')]);return _0x531510['getApplications'](_0x140bd4);}})['then'](function(_0x649cb1){if(_0x649cb1){_0x174873=_0x649cb1[_0xf726('0x3f')];if(!_0x2d27a6[_0xf726('0x39')][_0xf726('0x40')](_0xf726('0x41'))){_0x140bd4[_0xf726('0x2a')]=qs[_0xf726('0x2a')](_0x2d27a6[_0xf726('0x39')][_0xf726('0x2a')]);_0x140bd4[_0xf726('0x2b')]=qs['offset'](_0x2d27a6['query']['offset']);}return _0x531510[_0xf726('0x79')](_0x140bd4);}})[_0xf726('0x1e')](function(_0x424e83){if(_0x424e83){return _0x424e83?{'count':_0x174873,'rows':_0x424e83}:null;}})[_0xf726('0x1e')](respondWithResult(_0x2a8072,null))[_0xf726('0x59')](handleError(_0x2a8072,null));};exports['notify']=function(_0x362f98,_0x551dd9,_0x2c79a1){var _0x2a4d18={'channel':_0xf726('0x7a')};var _0x1cc270=[];var _0xd5ea85=[];var _0x5c9200={};return db[_0xf726('0x35')]['find']({'where':{'id':_0x362f98[_0xf726('0x4d')]['id']},'include':[{'model':db[_0xf726('0x75')],'as':_0xf726('0x7b')}]})[_0xf726('0x1e')](handleEntityNotFound(_0x551dd9,null))[_0xf726('0x1e')](function(_0x42791e){_0x2a4d18[_0xf726('0x7c')]=_0x42791e;if(_0x2a4d18['account']&&_0x2a4d18[_0xf726('0x7c')]['type']===_0xf726('0x7d')&&_0x362f98['body'][_0xf726('0x7e')]){if(_0x362f98[_0xf726('0x52')][_0xf726('0x7e')]['length']===0x0)return;if(_0x362f98['body']['statuses'][0x0]['state']!==_0xf726('0x7f'))return;return db[_0xf726('0x80')][_0xf726('0x58')]({'read':!![],'readAt':_0x362f98['body']['statuses'][0x0][_0xf726('0x81')]},{'where':{'messageId':_0x362f98[_0xf726('0x52')][_0xf726('0x7e')][0x0]['message_id']},'individualHooks':!![]})[_0xf726('0x1e')](function(_0x4f578e){return _0x551dd9['status'](0xc8)[_0xf726('0x28')](_0x4f578e);});}_0x2a4d18[_0xf726('0x82')]=_[_0xf726('0x83')](_0x42791e['Applications'],['priority'],[_0xf726('0x84')]);if(_0x2a4d18['account'][_0xf726('0x7b')]){delete _0x2a4d18['account'][_0xf726('0x7b')];}return db['CmContact'][_0xf726('0x5a')]()[_0xf726('0x1e')](function(_0x16cc1d){if(!_0x16cc1d){throw new db[(_0xf726('0x85'))][(_0xf726('0x86'))](_0xf726('0x87'));}_0x1cc270=_[_0xf726('0x88')](_['keys'](_0x16cc1d),[_0xf726('0x89'),_0xf726('0x8a')]);_0xd5ea85=_[_0xf726('0x88')](_[_0xf726('0x3a')](_0x16cc1d),[_0xf726('0x89'),_0xf726('0x8a'),'CompanyId',_0xf726('0x8b')]);_0x2a4d18[_0xf726('0x52')]={'mapKey':_0xf726('0x8c')};if(_0x2a4d18[_0xf726('0x7c')]&&_0x2a4d18[_0xf726('0x7c')][_0xf726('0x47')]===_0xf726('0x8d')){_0x2a4d18[_0xf726('0x52')][_0xf726('0x8e')]=_0x362f98[_0xf726('0x52')][_0xf726('0x8f')][_0xf726('0x90')]('whatsapp:','');_0x2a4d18['body'][_0xf726('0x52')]=_0x362f98['body'][_0xf726('0x91')];_0x2a4d18[_0xf726('0x52')][_0xf726('0x92')]=_0x362f98[_0xf726('0x52')]['MessageSid'];}if(_0x2a4d18['account']&&_0x2a4d18[_0xf726('0x7c')][_0xf726('0x47')]===_0xf726('0x7d')){_0x2a4d18[_0xf726('0x52')][_0xf726('0x8e')]=_0x362f98[_0xf726('0x52')][_0xf726('0x93')][0x0][_0xf726('0x8e')];_0x2a4d18['body'][_0xf726('0x52')]=_0x362f98[_0xf726('0x52')]['notifications'][0x0][_0xf726('0x24')][_0xf726('0x52')];_0x2a4d18['body'][_0xf726('0x92')]=_0x362f98[_0xf726('0x52')]['notifications'][0x0][_0xf726('0x94')];}if(_0x2a4d18[_0xf726('0x52')]['id']){delete _0x2a4d18[_0xf726('0x52')]['id'];}if(_['isNil'](_0x2a4d18[_0xf726('0x52')][_0xf726('0x8e')])){throw new db['Sequelize'][(_0xf726('0x86'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2a4d18[_0xf726('0x52')][_0xf726('0x52')])||_0x2a4d18[_0xf726('0x52')][_0xf726('0x52')]===''){throw new db['Sequelize'][(_0xf726('0x86'))](_0xf726('0x95'));}if(_[_0xf726('0x96')](_0x2a4d18[_0xf726('0x52')]['mapKey'])){throw new db['Sequelize'][(_0xf726('0x86'))](_0xf726('0x97')+_0xd5ea85);}if(!_[_0xf726('0x98')](_0xd5ea85,_0x2a4d18['body'][_0xf726('0x99')])){throw new db[(_0xf726('0x85'))][(_0xf726('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd5ea85);}_0x5c9200[_0x2a4d18[_0xf726('0x52')]['mapKey']]=_0x2a4d18[_0xf726('0x52')][_0xf726('0x8e')];return db[_0xf726('0x9a')]['find']({'where':{'id':_0x2a4d18[_0xf726('0x7c')]['ListId']},'include':[{'model':db[_0xf726('0x9b')],'as':_0xf726('0x9c'),'where':_0x5c9200,'limit':0x1,'order':[[_0xf726('0x8a'),_0xf726('0x9d')]]}]});})[_0xf726('0x1e')](handleEntityNotFound(_0x551dd9,null))[_0xf726('0x1e')](function(_0x31d7a0){if(_0x31d7a0){_0x2a4d18[_0xf726('0x9e')]=_[_0xf726('0x68')](_0x31d7a0,[_0xf726('0x9c')]);if(_0x31d7a0[_0xf726('0x9c')][_0xf726('0x3f')]){return _0x31d7a0[_0xf726('0x9c')][0x0];}var _0x47915d=_[_0xf726('0x18')](_0x2a4d18[_0xf726('0x52')],{'firstName':_0x2a4d18[_0xf726('0x52')][_0xf726('0x8e')],'ListId':_0x31d7a0['id']});_0x47915d[_0x2a4d18[_0xf726('0x52')][_0xf726('0x99')]]=_0x2a4d18['body'][_0xf726('0x8e')];return db['CmContact'][_0xf726('0x51')](_0x47915d,{'fields':_0x1cc270,'raw':!![]});}})[_0xf726('0x1e')](handleEntityNotFound(_0x551dd9,null))[_0xf726('0x1e')](function(_0x197c90){if(_0x197c90){_0x2a4d18[_0xf726('0x9f')]=_0x197c90;var _0x474f67={'ContactId':_0x197c90['id'],'phone':_0x2a4d18['body'][_0xf726('0x8e')],'WhatsappAccountId':_0x362f98[_0xf726('0x4d')]['id']};var _0x272f74={'ContactId':_0x197c90['id'],'WhatsappAccountId':_0x362f98[_0xf726('0x4d')]['id'],'closed':![]};return db[_0xf726('0xa0')][_0xf726('0x50')]({'where':_0x272f74})['then'](function(_0x14b856){if(_0x14b856){return[_0x14b856,![]];}return db[_0xf726('0xa0')][_0xf726('0x51')](_0x474f67)[_0xf726('0x1e')](function(_0x1dbb1f){return[_0x1dbb1f,!![]];});});}})[_0xf726('0x69')](function(_0x38216d,_0x20b115){_0x2a4d18[_0xf726('0xa1')]=_0x38216d[_0xf726('0x30')]({'plain':!![]});_0x2a4d18[_0xf726('0xa1')][_0xf726('0xa2')]=![];if(_0x20b115){if(_0x2a4d18[_0xf726('0x7c')][_0xf726('0xa3')]){_0x2a4d18[_0xf726('0x82')]['push']({'id':0x0,'priority':_0x2a4d18[_0xf726('0x82')][_0xf726('0x3f')]+0x1,'app':_0xf726('0xa4'),'appdata':_0xf726('0xa5'),'interval':_0xf726('0xa6')});}_0x2a4d18['interaction'][_0xf726('0xa2')]=!![];}return db[_0xf726('0x80')][_0xf726('0x51')]({'phone':_0x2a4d18['body']['from'],'messageId':_0x2a4d18[_0xf726('0x52')]['messageId'],'body':_0x2a4d18[_0xf726('0x52')]['body'],'WhatsappAccountId':_0x362f98[_0xf726('0x4d')]['id'],'WhatsappInteractionId':_0x38216d['id'],'direction':'in','ContactId':_0x38216d[_0xf726('0xa7')],'AttachmentId':_0x2a4d18[_0xf726('0x52')]['AttachmentId']});})['then'](function(_0x212dce){_0x2a4d18['message']=_0x212dce;if(!_0x2a4d18[_0xf726('0xa1')][_0xf726('0xa8')])return;return db[_0xf726('0x6e')][_0xf726('0x50')]({'attributes':['id',_0xf726('0x32')],'where':{'id':_0x2a4d18['interaction'][_0xf726('0xa8')]}});})[_0xf726('0x1e')](function(_0xe9e1e0){if(_0xe9e1e0){_0x2a4d18[_0xf726('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe9e1e0[_0xf726('0x32')]+','+(_0x2a4d18['account'][_0xf726('0xa9')]||0xa),'interval':_0xf726('0xa6')});}if(!_0x2a4d18['interaction'][_0xf726('0xaa')])return;return db['WhatsappQueue'][_0xf726('0x50')]({'attributes':['id',_0xf726('0x32')],'where':{'id':_0x2a4d18[_0xf726('0xa1')][_0xf726('0xaa')]}});})[_0xf726('0x1e')](function(_0xe2df87){if(_0xe2df87){_0x2a4d18['applications'][_0xf726('0xab')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xe2df87['name']+','+(_0x2a4d18[_0xf726('0x7c')][_0xf726('0xac')]||0x12c),'interval':_0xf726('0xa6')});}return respondWithRpcPromise(_0xf726('0xad'),_0xf726('0xae'),_0x2a4d18);})[_0xf726('0x1e')](function(_0x34c45e){if(_0x34c45e){var _0x542f7a=0xc8;var _0x3d81a7=_0xf726('0xaf');logger[_0xf726('0x25')](_0xf726('0xb0'),_0x3d81a7,_0x542f7a,'entity\x20found');logger['debug'](_0xf726('0xb1'),_0x3d81a7,_0x542f7a,_0xf726('0xb2'),JSON['stringify'](_0x34c45e));if(_0x2a4d18['account']['type']===_0xf726('0x8d')){return _0x551dd9[_0xf726('0x27')](_0x542f7a)[_0xf726('0x2c')]('Content-Type','text/xml')[_0xf726('0xb3')]('\x0a');}else{return _0x551dd9[_0xf726('0x27')](_0x542f7a)['json'](_0x34c45e);}}});})[_0xf726('0x59')](handleError(_0x551dd9,null));};exports[_0xf726('0xb3')]=function(_0x2257db,_0xf9e36a,_0x37efd4){var _0x25cb40,_0x57012f,_0x54248c;if(_['isNil'](_0x2257db['body'][_0xf726('0x52')])||_0x2257db[_0xf726('0x52')]['body']===''){throw new db[(_0xf726('0x85'))][(_0xf726('0x86'))](_0xf726('0x95'));}if(_[_0xf726('0x96')](_0x2257db['body']['to'])){throw new db[(_0xf726('0x85'))]['ValidationError'](_0xf726('0xb4'));}_0x25cb40=_0x2257db[_0xf726('0x52')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x2257db[_0xf726('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0xf726('0xb5'),'include':[{'model':db[_0xf726('0x9b')],'as':'Contacts','where':{'mobile':_0x25cb40},'limit':0x1,'order':[[_0xf726('0x8a'),_0xf726('0x9d')]]}]}]})[_0xf726('0x1e')](handleEntityNotFound(_0xf9e36a,null))[_0xf726('0x1e')](function(_0x30a7ad){if(_0x30a7ad&&_0x30a7ad['List']){_0x57012f=_0x30a7ad[_0xf726('0x30')]({'plain':!![]});if(_0x57012f[_0xf726('0xb5')]&&_0x57012f[_0xf726('0xb5')]['Contacts'][_0xf726('0x3f')]){return _0x57012f[_0xf726('0xb5')][_0xf726('0x9c')][0x0];}return db[_0xf726('0x9b')][_0xf726('0x51')](_['defaults'](_0x2257db[_0xf726('0x52')],{'firstName':_0x25cb40,'mobile':_0x25cb40,'phone':_0x25cb40,'ListId':_0x57012f['ListId']}));}})[_0xf726('0x1e')](handleEntityNotFound(_0xf9e36a,null))['then'](function(_0x530068){if(_0x530068){_0x54248c=_0x530068;return db[_0xf726('0xa0')][_0xf726('0x50')]({'where':{'ContactId':_0x54248c['id'],'closed':![],'WhatsappAccountId':_0x57012f['id']}})[_0xf726('0x1e')](function(_0x60f8ea){if(_0x60f8ea){return[_0x60f8ea,![]];}return db[_0xf726('0xa0')][_0xf726('0x51')]({'UserId':_0x2257db[_0xf726('0x54')]['id'],'ContactId':_0x54248c['id'],'WhatsappAccountId':_0x57012f['id'],'phone':_0x25cb40,'firstMsgDirection':_0xf726('0xb6'),'Messages':[_[_0xf726('0x46')](_0x2257db[_0xf726('0x52')],{'read':![],'body':_0x2257db['body'][_0xf726('0x52')],'phone':_0x25cb40,'WhatsappAccountId':_0x57012f['id'],'UserId':_0x2257db[_0xf726('0x54')]['id'],'ContactId':_0x54248c['id']})]},{'include':[{'model':db[_0xf726('0x80')],'as':_0xf726('0xb7')}]})[_0xf726('0x1e')](function(_0x4f805d){return[_0x4f805d,!![]];});});}})[_0xf726('0x69')](function(_0x626171,_0xb1288a){if(_0xb1288a){return _0x626171;}return db[_0xf726('0x80')][_0xf726('0x51')](_[_0xf726('0x46')](_0x2257db[_0xf726('0x52')],{'read':![],'body':_0x2257db[_0xf726('0x52')][_0xf726('0x52')],'phone':_0x25cb40,'WhatsappAccountId':_0x57012f['id'],'WhatsappInteractionId':_0x626171['id'],'UserId':_0x2257db[_0xf726('0x54')]['id'],'ContactId':_0x54248c['id']}))[_0xf726('0x1e')](function(_0x3e6755){_0x626171[_0xf726('0xb8')][_0xf726('0xb7')]=[];_0x626171[_0xf726('0xb8')][_0xf726('0xb7')][_0xf726('0xb9')](_0x3e6755[_0xf726('0xb8')]);return _0x626171;});})[_0xf726('0x1e')](respondWithResult(_0xf9e36a,null))[_0xf726('0x59')](handleError(_0xf9e36a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8b5138b..2b99ae9 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 _0x1423=['hasOwnProperty','hook','exports','events','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1423,0x1c3));var _0x3142=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1423[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3142('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3142('0x1'),'afterUpdate':_0x3142('0x2'),'afterDestroy':_0x3142('0x3')};function emitEvent(_0x254efc){return function(_0x41dda5,_0x3dc93e,_0x4515e7){WhatsappAccountEvents[_0x3142('0x4')](_0x254efc+':'+_0x41dda5['id'],_0x41dda5);WhatsappAccountEvents[_0x3142('0x4')](_0x254efc,_0x41dda5);_0x4515e7(null);};}for(var e in events){if(events[_0x3142('0x5')](e)){var event=events[e];WhatsappAccount[_0x3142('0x6')](e,emitEvent(event));}}module[_0x3142('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1b9d=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x4c6a39,_0x4e1ed0){var _0x3c0aa5=function(_0x4535b1){while(--_0x4535b1){_0x4c6a39['push'](_0x4c6a39['shift']());}};_0x3c0aa5(++_0x4e1ed0);}(_0x1b9d,0xb6));var _0xd1b9=function(_0x12b93f,_0x599896){_0x12b93f=_0x12b93f-0x0;var _0x175640=_0x1b9d[_0x12b93f];return _0x175640;};'use strict';var EventEmitter=require(_0xd1b9('0x0'));var WhatsappAccount=require(_0xd1b9('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd1b9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4665f9){return function(_0x29a6d2,_0x39296b,_0x1887e7){WhatsappAccountEvents[_0xd1b9('0x3')](_0x4665f9+':'+_0x29a6d2['id'],_0x29a6d2);WhatsappAccountEvents[_0xd1b9('0x3')](_0x4665f9,_0x29a6d2);_0x1887e7(null);};}for(var e in events){if(events[_0xd1b9('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xd1b9('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 3433959..fcd9c4c 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 _0x8624=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount'];(function(_0x2856b1,_0x340e15){var _0x399b4d=function(_0x305577){while(--_0x305577){_0x2856b1['push'](_0x2856b1['shift']());}};_0x399b4d(++_0x340e15);}(_0x8624,0x1d4));var _0x4862=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x8624[_0x8a0140];return _0x1be8a8;};'use strict';var _=require(_0x4862('0x0'));var util=require(_0x4862('0x1'));var logger=require(_0x4862('0x2'))(_0x4862('0x3'));var moment=require(_0x4862('0x4'));var BPromise=require(_0x4862('0x5'));var rp=require(_0x4862('0x6'));var fs=require('fs');var path=require(_0x4862('0x7'));var rimraf=require(_0x4862('0x8'));var config=require(_0x4862('0x9'));var attributes=require(_0x4862('0xa'));module['exports']=function(_0x47b967,_0x34d834){return _0x47b967[_0x4862('0xb')](_0x4862('0xc'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd53=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappAccount.attributes','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xfd53,0x162));var _0x3fd5=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xfd53[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x3fd5('0x0'));var util=require(_0x3fd5('0x1'));var logger=require(_0x3fd5('0x2'))(_0x3fd5('0x3'));var moment=require(_0x3fd5('0x4'));var BPromise=require(_0x3fd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fd5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fd5('0x7'));module[_0x3fd5('0x8')]=function(_0x2fb8ef,_0x152199){return _0x2fb8ef['define'](_0x3fd5('0x9'),attributes,{'tableName':_0x3fd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0fc331f..e2aafcf 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 _0x3c19=['./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','map','then','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5a0790,_0x5affbc){var _0x1e7e87=function(_0x3bc5d6){while(--_0x3bc5d6){_0x5a0790['push'](_0x5a0790['shift']());}};_0x1e7e87(++_0x5affbc);}(_0x3c19,0x11b));var _0x93c1=function(_0x53872d,_0x5798f2){_0x53872d=_0x53872d-0x0;var _0x3fa9e0=_0x3c19[_0x53872d];return _0x3fa9e0;};'use strict';var _=require(_0x93c1('0x0'));var util=require(_0x93c1('0x1'));var moment=require(_0x93c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93c1('0x3'));var db=require(_0x93c1('0x4'))['db'];var utils=require(_0x93c1('0x5'));var logger=require(_0x93c1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93c1('0x7'));var client=jayson[_0x93c1('0x8')][_0x93c1('0x9')]({'port':0x232a});config[_0x93c1('0xa')]=_['defaults'](config[_0x93c1('0xa')],{'host':_0x93c1('0xb'),'port':0x18eb});var socket=require(_0x93c1('0xc'))(new Redis(config[_0x93c1('0xa')]));require(_0x93c1('0xd'))[_0x93c1('0xe')](socket);function respondWithRpcPromise(_0x1e5d50,_0x5b6214,_0x1e8ce4){return new BPromise(function(_0x5299bc,_0x4a49d3){return client[_0x93c1('0xf')](_0x1e5d50,_0x1e8ce4)['then'](function(_0xb8d36b){logger[_0x93c1('0x10')](_0x93c1('0x11'),_0x5b6214,_0x93c1('0x12'));logger[_0x93c1('0x13')](_0x93c1('0x14'),_0x5b6214,'request\x20sent',JSON['stringify'](_0xb8d36b));if(_0xb8d36b[_0x93c1('0x15')]){if(_0xb8d36b['error'][_0x93c1('0x16')]===0x1f4){logger[_0x93c1('0x15')](_0x93c1('0x11'),_0x5b6214,_0xb8d36b[_0x93c1('0x15')][_0x93c1('0x17')]);return _0x4a49d3(_0xb8d36b[_0x93c1('0x15')]['message']);}logger['error'](_0x93c1('0x11'),_0x5b6214,_0xb8d36b[_0x93c1('0x15')]['message']);return _0x5299bc(_0xb8d36b[_0x93c1('0x15')][_0x93c1('0x17')]);}else{logger[_0x93c1('0x10')](_0x93c1('0x11'),_0x5b6214,_0x93c1('0x12'));_0x5299bc(_0xb8d36b[_0x93c1('0x18')][_0x93c1('0x17')]);}})['catch'](function(_0x50777c){logger[_0x93c1('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5b6214,_0x50777c);_0x4a49d3(_0x50777c);});});}exports[_0x93c1('0x19')]=function(_0x3ff067){var _0x5c7d7b=this;return new Promise(function(_0x804d20,_0x5911c3){return db['WhatsappAccount'][_0x93c1('0x1a')]({'raw':_0x3ff067[_0x93c1('0x1b')]?_0x3ff067['options'][_0x93c1('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ff067['options']?_0x3ff067[_0x93c1('0x1b')][_0x93c1('0x1d')]||null:null,'attributes':_0x3ff067[_0x93c1('0x1b')]?_0x3ff067[_0x93c1('0x1b')][_0x93c1('0x1e')]||null:null,'include':_0x3ff067['options']?_0x3ff067[_0x93c1('0x1b')][_0x93c1('0x1f')]?_['map'](_0x3ff067['options'][_0x93c1('0x1f')],function(_0x34ce7a){return{'model':db[_0x34ce7a['model']],'as':_0x34ce7a['as'],'attributes':_0x34ce7a[_0x93c1('0x1e')],'include':_0x34ce7a[_0x93c1('0x1f')]?_['map'](_0x34ce7a['include'],function(_0x2c9182){return{'model':db[_0x2c9182[_0x93c1('0x20')]],'as':_0x2c9182['as'],'attributes':_0x2c9182['attributes'],'include':_0x2c9182[_0x93c1('0x1f')]?_[_0x93c1('0x21')](_0x2c9182[_0x93c1('0x1f')],function(_0x165390){return{'model':db[_0x165390[_0x93c1('0x20')]],'as':_0x165390['as'],'attributes':_0x165390['attributes']};}):[]};}):[]};}):[]:[]})[_0x93c1('0x22')](function(_0x18b822){logger[_0x93c1('0x10')](_0x93c1('0x19'),_0x3ff067);logger['debug']('ShowWhatsappAccount',_0x3ff067,JSON[_0x93c1('0x23')](_0x18b822));_0x804d20(_0x18b822);})[_0x93c1('0x24')](function(_0x233054){logger[_0x93c1('0x15')](_0x93c1('0x19'),_0x233054[_0x93c1('0x17')],_0x3ff067);_0x5911c3(_0x5c7d7b[_0x93c1('0x15')](0x1f4,_0x233054[_0x93c1('0x17')]));});});}; \ No newline at end of file +var _0x9285=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9285,0x1a0));var _0x5928=function(_0x1d1288,_0x5e728a){_0x1d1288=_0x1d1288-0x0;var _0x495ebd=_0x9285[_0x1d1288];return _0x495ebd;};'use strict';var _=require(_0x5928('0x0'));var util=require(_0x5928('0x1'));var moment=require(_0x5928('0x2'));var BPromise=require(_0x5928('0x3'));var rs=require(_0x5928('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5928('0x5'));var logger=require(_0x5928('0x6'))(_0x5928('0x7'));var config=require(_0x5928('0x8'));var jayson=require(_0x5928('0x9'));var client=jayson[_0x5928('0xa')][_0x5928('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5928('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5928('0xd'))[_0x5928('0xe')](socket);function respondWithRpcPromise(_0x29f67a,_0x4ff427,_0x40e4aa){return new BPromise(function(_0x3f16e0,_0x1324ab){return client[_0x5928('0xf')](_0x29f67a,_0x40e4aa)[_0x5928('0x10')](function(_0x41e3e0){logger[_0x5928('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x4ff427,_0x5928('0x12'));logger[_0x5928('0x13')](_0x5928('0x14'),_0x4ff427,_0x5928('0x12'),JSON[_0x5928('0x15')](_0x41e3e0));if(_0x41e3e0[_0x5928('0x16')]){if(_0x41e3e0['error'][_0x5928('0x17')]===0x1f4){logger[_0x5928('0x16')](_0x5928('0x18'),_0x4ff427,_0x41e3e0[_0x5928('0x16')]['message']);return _0x1324ab(_0x41e3e0['error'][_0x5928('0x19')]);}logger['error'](_0x5928('0x18'),_0x4ff427,_0x41e3e0[_0x5928('0x16')]['message']);return _0x3f16e0(_0x41e3e0[_0x5928('0x16')][_0x5928('0x19')]);}else{logger[_0x5928('0x11')](_0x5928('0x18'),_0x4ff427,_0x5928('0x12'));_0x3f16e0(_0x41e3e0[_0x5928('0x1a')][_0x5928('0x19')]);}})[_0x5928('0x1b')](function(_0x56b477){logger[_0x5928('0x16')](_0x5928('0x18'),_0x4ff427,_0x56b477);_0x1324ab(_0x56b477);});});}exports['ShowWhatsappAccount']=function(_0x22e82d){var _0x4deee0=this;return new Promise(function(_0x304f62,_0x2d0a99){return db[_0x5928('0x1c')][_0x5928('0x1d')]({'raw':_0x22e82d[_0x5928('0x1e')]?_0x22e82d[_0x5928('0x1e')][_0x5928('0x1f')]===undefined?!![]:![]:!![],'where':_0x22e82d[_0x5928('0x1e')]?_0x22e82d[_0x5928('0x1e')][_0x5928('0x20')]||null:null,'attributes':_0x22e82d[_0x5928('0x1e')]?_0x22e82d[_0x5928('0x1e')][_0x5928('0x21')]||null:null,'include':_0x22e82d[_0x5928('0x1e')]?_0x22e82d[_0x5928('0x1e')][_0x5928('0x22')]?_['map'](_0x22e82d['options'][_0x5928('0x22')],function(_0x31f1cc){return{'model':db[_0x31f1cc[_0x5928('0x23')]],'as':_0x31f1cc['as'],'attributes':_0x31f1cc['attributes'],'include':_0x31f1cc[_0x5928('0x22')]?_[_0x5928('0x24')](_0x31f1cc['include'],function(_0x5ba05e){return{'model':db[_0x5ba05e[_0x5928('0x23')]],'as':_0x5ba05e['as'],'attributes':_0x5ba05e[_0x5928('0x21')],'include':_0x5ba05e[_0x5928('0x22')]?_['map'](_0x5ba05e['include'],function(_0x52c164){return{'model':db[_0x52c164[_0x5928('0x23')]],'as':_0x52c164['as'],'attributes':_0x52c164[_0x5928('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5928('0x10')](function(_0x37dbb2){logger['info'](_0x5928('0x25'),_0x22e82d);logger[_0x5928('0x13')](_0x5928('0x25'),_0x22e82d,JSON[_0x5928('0x15')](_0x37dbb2));_0x304f62(_0x37dbb2);})[_0x5928('0x1b')](function(_0x297a28){logger[_0x5928('0x16')](_0x5928('0x25'),_0x297a28[_0x5928('0x19')],_0x22e82d);_0x2d0a99(_0x4deee0['error'](0x1f4,_0x297a28['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 14aee67..406d4d6 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 _0x855f=['emit','register','./whatsappAccount.events','save','remove','update'];(function(_0x42cc6e,_0x33a0d7){var _0x2f9c58=function(_0x4becd7){while(--_0x4becd7){_0x42cc6e['push'](_0x42cc6e['shift']());}};_0x2f9c58(++_0x33a0d7);}(_0x855f,0x104));var _0xf855=function(_0x58b024,_0x598058){_0x58b024=_0x58b024-0x0;var _0x25af81=_0x855f[_0x58b024];return _0x25af81;};'use strict';var WhatsappAccountEvents=require(_0xf855('0x0'));var events=[_0xf855('0x1'),_0xf855('0x2'),_0xf855('0x3')];function createListener(_0x56b586,_0x4ba0fc){return function(_0x620582){_0x4ba0fc[_0xf855('0x4')](_0x56b586,_0x620582);};}function removeListener(_0x2af30b,_0xe3d30c){return function(){WhatsappAccountEvents['removeListener'](_0x2af30b,_0xe3d30c);};}exports[_0xf855('0x5')]=function(_0x2427ad){for(var _0x594560=0x0,_0x2b38c6=events['length'];_0x594560<_0x2b38c6;_0x594560++){var _0x26a99f=events[_0x594560];var _0x3b418b=createListener('whatsappAccount:'+_0x26a99f,_0x2427ad);WhatsappAccountEvents['on'](_0x26a99f,_0x3b418b);}}; \ No newline at end of file +var _0x3148=['emit','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x3148,0x144));var _0x8314=function(_0x9f303f,_0x130e64){_0x9f303f=_0x9f303f-0x0;var _0x1d64bd=_0x3148[_0x9f303f];return _0x1d64bd;};'use strict';var WhatsappAccountEvents=require(_0x8314('0x0'));var events=[_0x8314('0x1'),_0x8314('0x2'),_0x8314('0x3')];function createListener(_0xe23f9c,_0x38c820){return function(_0x47c3aa){_0x38c820[_0x8314('0x4')](_0xe23f9c,_0x47c3aa);};}function removeListener(_0x5957f4,_0x412b12){return function(){WhatsappAccountEvents['removeListener'](_0x5957f4,_0x412b12);};}exports[_0x8314('0x5')]=function(_0x28a6a5){for(var _0xc622e9=0x0,_0x4d9a7f=events[_0x8314('0x6')];_0xc622e9<_0x4d9a7f;_0xc622e9++){var _0x5a02a7=events[_0xc622e9];var _0x5ccb69=createListener(_0x8314('0x7')+_0x5a02a7,_0x28a6a5);WhatsappAccountEvents['on'](_0x5a02a7,_0x5ccb69);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c7a8a86..315c572 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 _0x901c=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer'];(function(_0x4a500b,_0x65d0e7){var _0x13c3ea=function(_0x5d1dcb){while(--_0x5d1dcb){_0x4a500b['push'](_0x4a500b['shift']());}};_0x13c3ea(++_0x65d0e7);}(_0x901c,0x179));var _0xc901=function(_0x41e468,_0x318929){_0x41e468=_0x41e468-0x0;var _0x2bd26=_0x901c[_0x41e468];return _0x2bd26;};'use strict';var multer=require(_0xc901('0x0'));var util=require('util');var path=require(_0xc901('0x1'));var timeout=require('connect-timeout');var express=require(_0xc901('0x2'));var router=express[_0xc901('0x3')]();var fs_extra=require(_0xc901('0x4'));var auth=require(_0xc901('0x5'));var interaction=require(_0xc901('0x6'));var config=require(_0xc901('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc901('0x8')]('/',auth['isAuthenticated'](),controller[_0xc901('0x9')]);router[_0xc901('0x8')](_0xc901('0xa'),auth[_0xc901('0xb')](),controller[_0xc901('0xc')]);router[_0xc901('0xd')]('/',auth[_0xc901('0xb')](),controller['create']);router[_0xc901('0xe')](_0xc901('0xa'),auth[_0xc901('0xb')](),controller[_0xc901('0xf')]);router[_0xc901('0x10')]('/:id',auth[_0xc901('0xb')](),controller['destroy']);module[_0xc901('0x11')]=router; \ No newline at end of file +var _0xa910=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4b11d8,_0x14aba9){var _0x3c09d5=function(_0x40cb5a){while(--_0x40cb5a){_0x4b11d8['push'](_0x4b11d8['shift']());}};_0x3c09d5(++_0x14aba9);}(_0xa910,0x11e));var _0x0a91=function(_0x116f38,_0x2c3634){_0x116f38=_0x116f38-0x0;var _0x30c212=_0xa910[_0x116f38];return _0x30c212;};'use strict';var multer=require('multer');var util=require(_0x0a91('0x0'));var path=require(_0x0a91('0x1'));var timeout=require(_0x0a91('0x2'));var express=require(_0x0a91('0x3'));var router=express[_0x0a91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a91('0x5'));var interaction=require(_0x0a91('0x6'));var config=require(_0x0a91('0x7'));var controller=require(_0x0a91('0x8'));router[_0x0a91('0x9')]('/',auth[_0x0a91('0xa')](),controller[_0x0a91('0xb')]);router[_0x0a91('0x9')](_0x0a91('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0a91('0xd')]('/',auth['isAuthenticated'](),controller[_0x0a91('0xe')]);router[_0x0a91('0xf')](_0x0a91('0xc'),auth[_0x0a91('0xa')](),controller[_0x0a91('0x10')]);router[_0x0a91('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0a91('0x12')]);module[_0x0a91('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 836c6e3..dc2507e 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 _0xbebb=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x5d4963,_0x14173c){var _0x2ec117=function(_0x32477b){while(--_0x32477b){_0x5d4963['push'](_0x5d4963['shift']());}};_0x2ec117(++_0x14173c);}(_0xbebb,0x101));var _0xbbeb=function(_0x5a0593,_0x18c56b){_0x5a0593=_0x5a0593-0x0;var _0x1567dd=_0xbebb[_0x5a0593];return _0x1567dd;};'use strict';var Sequelize=require(_0xbbeb('0x0'));module[_0xbbeb('0x1')]={'priority':{'type':Sequelize[_0xbbeb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbbeb('0x3')],'allowNull':![],'defaultValue':_0xbbeb('0x4')},'appdata':{'type':Sequelize[_0xbbeb('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbbeb('0x3')],'defaultValue':_0xbbeb('0x6')}}; \ No newline at end of file +var _0x0440=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5a38d4,_0x4ae8eb){var _0x345b05=function(_0x41a586){while(--_0x41a586){_0x5a38d4['push'](_0x5a38d4['shift']());}};_0x345b05(++_0x4ae8eb);}(_0x0440,0x152));var _0x0044=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0x0440[_0x4d6bfd];return _0x243a46;};'use strict';var Sequelize=require(_0x0044('0x0'));module[_0x0044('0x1')]={'priority':{'type':Sequelize[_0x0044('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0044('0x3')],'allowNull':![],'defaultValue':_0x0044('0x4')},'appdata':{'type':Sequelize[_0x0044('0x5')]()},'description':{'type':Sequelize[_0x0044('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0044('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e485882..a3ec942 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 _0x38b2=['rawAttributes','type','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','show','create','body','catch','find','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','count','set','apply','reject','save','update','end','error','stack','name','send','index','map','WhatsappApplication'];(function(_0xc731bb,_0x5891d4){var _0xfe197d=function(_0x2cd6a7){while(--_0x2cd6a7){_0xc731bb['push'](_0xc731bb['shift']());}};_0xfe197d(++_0x5891d4);}(_0x38b2,0xf6));var _0x238b=function(_0x4c96db,_0x290ab2){_0x4c96db=_0x4c96db-0x0;var _0x4c30dc=_0x38b2[_0x4c96db];return _0x4c30dc;};'use strict';var emlformat=require(_0x238b('0x0'));var rimraf=require(_0x238b('0x1'));var zipdir=require(_0x238b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x238b('0x3'));var BPromise=require(_0x238b('0x4'));var Mustache=require('mustache');var util=require(_0x238b('0x5'));var path=require('path');var sox=require(_0x238b('0x6'));var csv=require(_0x238b('0x7'));var ejs=require(_0x238b('0x8'));var fs=require('fs');var fs_extra=require(_0x238b('0x9'));var _=require('lodash');var squel=require(_0x238b('0xa'));var crypto=require(_0x238b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x238b('0xc'));var toCsv=require(_0x238b('0x7'));var querystring=require(_0x238b('0xd'));var Papa=require(_0x238b('0xe'));var Redis=require(_0x238b('0xf'));var authService=require(_0x238b('0x10'));var qs=require(_0x238b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x238b('0x12'));var logger=require(_0x238b('0x13'))(_0x238b('0x14'));var utils=require(_0x238b('0x15'));var config=require(_0x238b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x238b('0x17'))['db'];function respondWithStatusCode(_0x1280d5,_0x3a080c){_0x3a080c=_0x3a080c||0xcc;return function(_0x42af62){if(_0x42af62){return _0x1280d5['sendStatus'](_0x3a080c);}return _0x1280d5['status'](_0x3a080c)['end']();};}function respondWithResult(_0x1a04f2,_0x65d8d2){_0x65d8d2=_0x65d8d2||0xc8;return function(_0x438be2){if(_0x438be2){return _0x1a04f2[_0x238b('0x18')](_0x65d8d2)[_0x238b('0x19')](_0x438be2);}};}function respondWithFilteredResult(_0x68824,_0x406840){return function(_0x24d857){if(_0x24d857){var _0x49d9fd=typeof _0x406840[_0x238b('0x1a')]==='undefined'&&typeof _0x406840[_0x238b('0x1b')]==='undefined';var _0x2ada3b=_0x24d857['count'];var _0x92d5b4=_0x49d9fd?0x0:_0x406840[_0x238b('0x1a')];var _0x37bfd8=_0x49d9fd?_0x24d857[_0x238b('0x1c')]:_0x406840[_0x238b('0x1a')]+_0x406840[_0x238b('0x1b')];var _0x576fae;if(_0x37bfd8>=_0x2ada3b){_0x37bfd8=_0x2ada3b;_0x576fae=0xc8;}else{_0x576fae=0xce;}_0x68824[_0x238b('0x18')](_0x576fae);return _0x68824[_0x238b('0x1d')]('Content-Range',_0x92d5b4+'-'+_0x37bfd8+'/'+_0x2ada3b)['json'](_0x24d857);}return null;};}function patchUpdates(_0xeb6834){return function(_0x162754){try{jsonpatch[_0x238b('0x1e')](_0x162754,_0xeb6834,!![]);}catch(_0x8ee6){return BPromise[_0x238b('0x1f')](_0x8ee6);}return _0x162754[_0x238b('0x20')]();};}function saveUpdates(_0xb1ad7a,_0x2b8e7c){return function(_0x367285){if(_0x367285){return _0x367285[_0x238b('0x21')](_0xb1ad7a)['then'](function(_0x59c751){return _0x59c751;});}return null;};}function removeEntity(_0x1f29da,_0x1ae511){return function(_0x4d214c){if(_0x4d214c){return _0x4d214c['destroy']()['then'](function(){_0x1f29da[_0x238b('0x18')](0xcc)[_0x238b('0x22')]();});}};}function handleEntityNotFound(_0xe167de,_0xa29a15){return function(_0x22d5e9){if(!_0x22d5e9){_0xe167de['sendStatus'](0x194);}return _0x22d5e9;};}function handleError(_0x4a6dd4,_0x436303){_0x436303=_0x436303||0x1f4;return function(_0x3c9e76){logger[_0x238b('0x23')](_0x3c9e76[_0x238b('0x24')]);if(_0x3c9e76[_0x238b('0x25')]){delete _0x3c9e76[_0x238b('0x25')];}_0x4a6dd4['status'](_0x436303)[_0x238b('0x26')](_0x3c9e76);};}exports[_0x238b('0x27')]=function(_0x1c7a56,_0x43b85f){var _0x103ca8={},_0x2a0728={},_0x2aaf83={'count':0x0,'rows':[]};var _0xf277bd=_[_0x238b('0x28')](db[_0x238b('0x29')][_0x238b('0x2a')],function(_0xf0d1bb){return{'name':_0xf0d1bb['fieldName'],'type':_0xf0d1bb[_0x238b('0x2b')]['key']};});_0x2a0728[_0x238b('0x2c')]=_[_0x238b('0x28')](_0xf277bd,_0x238b('0x25'));_0x2a0728['query']=_['keys'](_0x1c7a56['query']);_0x2a0728['filters']=_[_0x238b('0x2d')](_0x2a0728['model'],_0x2a0728[_0x238b('0x2e')]);_0x103ca8[_0x238b('0x2f')]=_[_0x238b('0x2d')](_0x2a0728[_0x238b('0x2c')],qs[_0x238b('0x30')](_0x1c7a56['query']['fields']));_0x103ca8[_0x238b('0x2f')]=_0x103ca8[_0x238b('0x2f')][_0x238b('0x31')]?_0x103ca8['attributes']:_0x2a0728[_0x238b('0x2c')];if(!_0x1c7a56[_0x238b('0x2e')][_0x238b('0x32')](_0x238b('0x33'))){_0x103ca8['limit']=qs[_0x238b('0x1b')](_0x1c7a56['query'][_0x238b('0x1b')]);_0x103ca8[_0x238b('0x1a')]=qs[_0x238b('0x1a')](_0x1c7a56[_0x238b('0x2e')][_0x238b('0x1a')]);}_0x103ca8[_0x238b('0x34')]=qs[_0x238b('0x35')](_0x1c7a56[_0x238b('0x2e')][_0x238b('0x35')]);_0x103ca8['where']=qs[_0x238b('0x36')](_[_0x238b('0x37')](_0x1c7a56[_0x238b('0x2e')],_0x2a0728[_0x238b('0x36')]),_0xf277bd);if(_0x1c7a56[_0x238b('0x2e')][_0x238b('0x38')]){_0x103ca8[_0x238b('0x39')]=_['merge'](_0x103ca8[_0x238b('0x39')],{'$or':_[_0x238b('0x28')](_0xf277bd,function(_0x1447ec){if(_0x1447ec[_0x238b('0x2b')]!=='VIRTUAL'){var _0xb4a0d5={};_0xb4a0d5[_0x1447ec['name']]={'$like':'%'+_0x1c7a56[_0x238b('0x2e')]['filter']+'%'};return _0xb4a0d5;}})});}_0x103ca8=_[_0x238b('0x3a')]({},_0x103ca8,_0x1c7a56[_0x238b('0x3b')]);var _0xcec411={'where':_0x103ca8[_0x238b('0x39')]};return db['WhatsappApplication']['count'](_0xcec411)[_0x238b('0x3c')](function(_0x5938a5){_0x2aaf83[_0x238b('0x1c')]=_0x5938a5;if(_0x1c7a56['query'][_0x238b('0x3d')]){_0x103ca8[_0x238b('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x238b('0x3f')](_0x103ca8);})[_0x238b('0x3c')](function(_0x1fbff5){_0x2aaf83[_0x238b('0x40')]=_0x1fbff5;return _0x2aaf83;})[_0x238b('0x3c')](respondWithFilteredResult(_0x43b85f,_0x103ca8))['catch'](handleError(_0x43b85f,null));};exports[_0x238b('0x41')]=function(_0x27eda5,_0x299585){var _0x5053ee={'raw':!![],'where':{'id':_0x27eda5['params']['id']}},_0x247967={};_0x247967[_0x238b('0x2c')]=_['keys'](db[_0x238b('0x29')][_0x238b('0x2a')]);_0x247967['query']=_['keys'](_0x27eda5[_0x238b('0x2e')]);_0x247967[_0x238b('0x36')]=_['intersection'](_0x247967[_0x238b('0x2c')],_0x247967[_0x238b('0x2e')]);_0x5053ee['attributes']=_['intersection'](_0x247967[_0x238b('0x2c')],qs['fields'](_0x27eda5[_0x238b('0x2e')][_0x238b('0x30')]));_0x5053ee[_0x238b('0x2f')]=_0x5053ee[_0x238b('0x2f')][_0x238b('0x31')]?_0x5053ee[_0x238b('0x2f')]:_0x247967[_0x238b('0x2c')];if(_0x27eda5[_0x238b('0x2e')][_0x238b('0x3d')]){_0x5053ee['include']=[{'all':!![]}];}_0x5053ee=_['merge']({},_0x5053ee,_0x27eda5['options']);return db[_0x238b('0x29')]['find'](_0x5053ee)['then'](handleEntityNotFound(_0x299585,null))[_0x238b('0x3c')](respondWithResult(_0x299585,null))['catch'](handleError(_0x299585,null));};exports[_0x238b('0x42')]=function(_0x515e4e,_0x426699){return db[_0x238b('0x29')][_0x238b('0x42')](_0x515e4e[_0x238b('0x43')],{})[_0x238b('0x3c')](respondWithResult(_0x426699,0xc9))[_0x238b('0x44')](handleError(_0x426699,null));};exports[_0x238b('0x21')]=function(_0x1d325f,_0x1b1b26){if(_0x1d325f[_0x238b('0x43')]['id']){delete _0x1d325f[_0x238b('0x43')]['id'];}return db[_0x238b('0x29')][_0x238b('0x45')]({'where':{'id':_0x1d325f[_0x238b('0x46')]['id']}})[_0x238b('0x3c')](handleEntityNotFound(_0x1b1b26,null))[_0x238b('0x3c')](saveUpdates(_0x1d325f[_0x238b('0x43')],null))[_0x238b('0x3c')](respondWithResult(_0x1b1b26,null))[_0x238b('0x44')](handleError(_0x1b1b26,null));};exports[_0x238b('0x47')]=function(_0x4cdc02,_0x4a9357){return db[_0x238b('0x29')][_0x238b('0x45')]({'where':{'id':_0x4cdc02[_0x238b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a9357,null))[_0x238b('0x3c')](removeEntity(_0x4a9357,null))[_0x238b('0x44')](handleError(_0x4a9357,null));}; \ No newline at end of file +var _0x6b19=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x464251,_0x41951f){var _0x47b041=function(_0x425376){while(--_0x425376){_0x464251['push'](_0x464251['shift']());}};_0x47b041(++_0x41951f);}(_0x6b19,0xf4));var _0x96b1=function(_0x337f6b,_0x1d9663){_0x337f6b=_0x337f6b-0x0;var _0x5409a9=_0x6b19[_0x337f6b];return _0x5409a9;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96b1('0x1'));var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require(_0x96b1('0x3'));var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require('path');var sox=require(_0x96b1('0x7'));var csv=require(_0x96b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require(_0x96b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x96b1('0xb'));var deskjs=require(_0x96b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0xd'));var Papa=require(_0x96b1('0xe'));var Redis=require(_0x96b1('0xf'));var authService=require(_0x96b1('0x10'));var qs=require(_0x96b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96b1('0x13'));var db=require(_0x96b1('0x14'))['db'];function respondWithStatusCode(_0x16ee32,_0x1d942a){_0x1d942a=_0x1d942a||0xcc;return function(_0x2d7569){if(_0x2d7569){return _0x16ee32['sendStatus'](_0x1d942a);}return _0x16ee32[_0x96b1('0x15')](_0x1d942a)[_0x96b1('0x16')]();};}function respondWithResult(_0xe809b6,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xc8;return function(_0x28b596){if(_0x28b596){return _0xe809b6[_0x96b1('0x15')](_0x2dbaac)[_0x96b1('0x17')](_0x28b596);}};}function respondWithFilteredResult(_0x1e5fdf,_0x3ba832){return function(_0x5772d3){if(_0x5772d3){var _0x2e9615=typeof _0x3ba832[_0x96b1('0x18')]===_0x96b1('0x19')&&typeof _0x3ba832[_0x96b1('0x1a')]===_0x96b1('0x19');var _0x23852a=_0x5772d3[_0x96b1('0x1b')];var _0x41227b=_0x2e9615?0x0:_0x3ba832[_0x96b1('0x18')];var _0x44cc44=_0x2e9615?_0x5772d3[_0x96b1('0x1b')]:_0x3ba832['offset']+_0x3ba832['limit'];var _0x151178;if(_0x44cc44>=_0x23852a){_0x44cc44=_0x23852a;_0x151178=0xc8;}else{_0x151178=0xce;}_0x1e5fdf['status'](_0x151178);return _0x1e5fdf['set'](_0x96b1('0x1c'),_0x41227b+'-'+_0x44cc44+'/'+_0x23852a)[_0x96b1('0x17')](_0x5772d3);}return null;};}function patchUpdates(_0x2bb819){return function(_0x4f0d78){try{jsonpatch[_0x96b1('0x1d')](_0x4f0d78,_0x2bb819,!![]);}catch(_0x3954e3){return BPromise[_0x96b1('0x1e')](_0x3954e3);}return _0x4f0d78[_0x96b1('0x1f')]();};}function saveUpdates(_0x1e1436,_0x276919){return function(_0x416022){if(_0x416022){return _0x416022[_0x96b1('0x20')](_0x1e1436)[_0x96b1('0x21')](function(_0x3a17d3){return _0x3a17d3;});}return null;};}function removeEntity(_0x2acd58,_0x1b0f88){return function(_0x295f05){if(_0x295f05){return _0x295f05[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){_0x2acd58[_0x96b1('0x15')](0xcc)[_0x96b1('0x16')]();});}};}function handleEntityNotFound(_0x5b19b6,_0x3f5049){return function(_0x226603){if(!_0x226603){_0x5b19b6[_0x96b1('0x23')](0x194);}return _0x226603;};}function handleError(_0x321863,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x2ad760){logger['error'](_0x2ad760['stack']);if(_0x2ad760[_0x96b1('0x24')]){delete _0x2ad760['name'];}_0x321863[_0x96b1('0x15')](_0x3b7492)[_0x96b1('0x25')](_0x2ad760);};}exports[_0x96b1('0x26')]=function(_0x106864,_0x4e4426){var _0x59fc7c={},_0x45c20e={},_0x9fc960={'count':0x0,'rows':[]};var _0x5a9332=_[_0x96b1('0x27')](db[_0x96b1('0x28')][_0x96b1('0x29')],function(_0x2262ad){return{'name':_0x2262ad[_0x96b1('0x2a')],'type':_0x2262ad[_0x96b1('0x2b')]['key']};});_0x45c20e[_0x96b1('0x2c')]=_[_0x96b1('0x27')](_0x5a9332,_0x96b1('0x24'));_0x45c20e[_0x96b1('0x2d')]=_[_0x96b1('0x2e')](_0x106864[_0x96b1('0x2d')]);_0x45c20e[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x45c20e['model'],_0x45c20e[_0x96b1('0x2d')]);_0x59fc7c[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x45c20e[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x59fc7c[_0x96b1('0x31')]=_0x59fc7c['attributes'][_0x96b1('0x33')]?_0x59fc7c[_0x96b1('0x31')]:_0x45c20e[_0x96b1('0x2c')];if(!_0x106864['query']['hasOwnProperty'](_0x96b1('0x34'))){_0x59fc7c[_0x96b1('0x1a')]=qs['limit'](_0x106864['query']['limit']);_0x59fc7c[_0x96b1('0x18')]=qs[_0x96b1('0x18')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x18')]);}_0x59fc7c[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_0x106864[_0x96b1('0x2d')]['sort']);_0x59fc7c[_0x96b1('0x37')]=qs['filters'](_['pick'](_0x106864[_0x96b1('0x2d')],_0x45c20e[_0x96b1('0x2f')]),_0x5a9332);if(_0x106864['query'][_0x96b1('0x38')]){_0x59fc7c[_0x96b1('0x37')]=_[_0x96b1('0x39')](_0x59fc7c[_0x96b1('0x37')],{'$or':_[_0x96b1('0x27')](_0x5a9332,function(_0x49a5d7){if(_0x49a5d7[_0x96b1('0x2b')]!==_0x96b1('0x3a')){var _0x35ea21={};_0x35ea21[_0x49a5d7['name']]={'$like':'%'+_0x106864[_0x96b1('0x2d')]['filter']+'%'};return _0x35ea21;}})});}_0x59fc7c=_[_0x96b1('0x39')]({},_0x59fc7c,_0x106864['options']);var _0x53e072={'where':_0x59fc7c[_0x96b1('0x37')]};return db[_0x96b1('0x28')][_0x96b1('0x1b')](_0x53e072)[_0x96b1('0x21')](function(_0x4833c0){_0x9fc960[_0x96b1('0x1b')]=_0x4833c0;if(_0x106864[_0x96b1('0x2d')][_0x96b1('0x3b')]){_0x59fc7c[_0x96b1('0x3c')]=[{'all':!![]}];}return db[_0x96b1('0x28')][_0x96b1('0x3d')](_0x59fc7c);})[_0x96b1('0x21')](function(_0x52c232){_0x9fc960[_0x96b1('0x3e')]=_0x52c232;return _0x9fc960;})[_0x96b1('0x21')](respondWithFilteredResult(_0x4e4426,_0x59fc7c))[_0x96b1('0x3f')](handleError(_0x4e4426,null));};exports[_0x96b1('0x40')]=function(_0x50949f,_0x101253){var _0x40adda={'raw':!![],'where':{'id':_0x50949f[_0x96b1('0x41')]['id']}},_0x40a022={};_0x40a022[_0x96b1('0x2c')]=_[_0x96b1('0x2e')](db[_0x96b1('0x28')]['rawAttributes']);_0x40a022[_0x96b1('0x2d')]=_['keys'](_0x50949f[_0x96b1('0x2d')]);_0x40a022[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],_0x40a022[_0x96b1('0x2d')]);_0x40adda[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x50949f[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x40adda[_0x96b1('0x31')]=_0x40adda['attributes']['length']?_0x40adda[_0x96b1('0x31')]:_0x40a022['model'];if(_0x50949f['query'][_0x96b1('0x3b')]){_0x40adda['include']=[{'all':!![]}];}_0x40adda=_[_0x96b1('0x39')]({},_0x40adda,_0x50949f[_0x96b1('0x42')]);return db[_0x96b1('0x28')]['find'](_0x40adda)[_0x96b1('0x21')](handleEntityNotFound(_0x101253,null))[_0x96b1('0x21')](respondWithResult(_0x101253,null))[_0x96b1('0x3f')](handleError(_0x101253,null));};exports[_0x96b1('0x43')]=function(_0x584582,_0x27be9f){return db['WhatsappApplication'][_0x96b1('0x43')](_0x584582[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x27be9f,0xc9))[_0x96b1('0x3f')](handleError(_0x27be9f,null));};exports[_0x96b1('0x20')]=function(_0x3070da,_0x248844){if(_0x3070da[_0x96b1('0x44')]['id']){delete _0x3070da['body']['id'];}return db[_0x96b1('0x28')][_0x96b1('0x45')]({'where':{'id':_0x3070da['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x248844,null))[_0x96b1('0x21')](saveUpdates(_0x3070da[_0x96b1('0x44')],null))[_0x96b1('0x21')](respondWithResult(_0x248844,null))[_0x96b1('0x3f')](handleError(_0x248844,null));};exports[_0x96b1('0x22')]=function(_0x404848,_0x2159ba){return db[_0x96b1('0x28')]['find']({'where':{'id':_0x404848[_0x96b1('0x41')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x2159ba,null))[_0x96b1('0x21')](removeEntity(_0x2159ba,null))[_0x96b1('0x3f')](handleError(_0x2159ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 27d77b9..3dd5a9e 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 _0xeb0d=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','lodash','moment','bluebird','path','rimraf'];(function(_0x53f608,_0x256def){var _0x495b7d=function(_0x467eab){while(--_0x467eab){_0x53f608['push'](_0x53f608['shift']());}};_0x495b7d(++_0x256def);}(_0xeb0d,0xe2));var _0xdeb0=function(_0xfc88e5,_0x36cd00){_0xfc88e5=_0xfc88e5-0x0;var _0x10b302=_0xeb0d[_0xfc88e5];return _0x10b302;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('WhatsappApplication',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdeb0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ef6=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x20c8ce,_0xa61012){var _0xcfee30=function(_0x3d3fb0){while(--_0x3d3fb0){_0x20c8ce['push'](_0x20c8ce['shift']());}};_0xcfee30(++_0xa61012);}(_0x8ef6,0xf2));var _0x68ef=function(_0x90d726,_0x344465){_0x90d726=_0x90d726-0x0;var _0x319270=_0x8ef6[_0x90d726];return _0x319270;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x68ef('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 5eeba28..95b5ff9 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 _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x261bcb,_0x10b150){var _0x223820=function(_0x22b551){while(--_0x22b551){_0x261bcb['push'](_0x261bcb['shift']());}};_0x223820(++_0x10b150);}(_0x98a8,0x12c));var _0x898a=function(_0x18f925,_0x923aec){_0x18f925=_0x18f925-0x0;var _0x1f1be6=_0x98a8[_0x18f925];return _0x1f1be6;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','WhatsappApplication,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x42c354,_0x17e3e7){var _0x562f9c=function(_0x3aee59){while(--_0x3aee59){_0x42c354['push'](_0x42c354['shift']());}};_0x562f9c(++_0x17e3e7);}(_0x3e74,0x175));var _0x43e7=function(_0x100d20,_0x2e2105){_0x100d20=_0x100d20-0x0;var _0x1e07ce=_0x3e74[_0x100d20];return _0x1e07ce;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e4c5460..e92950e 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 _0x7278=['/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x4ae077,_0x39c0f0){var _0x8964e2=function(_0x2a0e70){while(--_0x2a0e70){_0x4ae077['push'](_0x4ae077['shift']());}};_0x8964e2(++_0x39c0f0);}(_0x7278,0x161));var _0x8727=function(_0x486c8f,_0x1cc73b){_0x486c8f=_0x486c8f-0x0;var _0x236d79=_0x7278[_0x486c8f];return _0x236d79;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8727('0xa')](_0x8727('0xe'),auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0xa')](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router['post']('/',auth[_0x8727('0xb')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')]('/:id/messages',auth[_0x8727('0xb')](),controller[_0x8727('0x14')]);router['post'](_0x8727('0x15'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')](_0x8727('0x17'),_0x8727('0x18')),controller[_0x8727('0x19')]);router[_0x8727('0x1a')](_0x8727('0x1b'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')]('whatsapp',_0x8727('0x1c')),controller[_0x8727('0x1d')]);router[_0x8727('0x1e')](_0x8727('0x1b'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8727('0x1f')]);router['delete'](_0x8727('0x15'),auth[_0x8727('0xb')](),controller[_0x8727('0x20')]);module[_0x8727('0x21')]=router; \ No newline at end of file +var _0x2b83=['getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','removeTags','exports','util','path','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','/:id/messages'];(function(_0x86e74a,_0x27b1ea){var _0x46471f=function(_0x23d3a5){while(--_0x23d3a5){_0x86e74a['push'](_0x86e74a['shift']());}};_0x46471f(++_0x27b1ea);}(_0x2b83,0x1d3));var _0x32b8=function(_0x25888a,_0x4ee702){_0x25888a=_0x25888a-0x0;var _0x49be59=_0x2b83[_0x25888a];return _0x49be59;};'use strict';var multer=require('multer');var util=require(_0x32b8('0x0'));var path=require(_0x32b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var fs_extra=require(_0x32b8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32b8('0x5'));var controller=require(_0x32b8('0x6'));router['get']('/',auth[_0x32b8('0x7')](),controller['index']);router[_0x32b8('0x8')](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xa')]);router['get'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['show']);router['get'](_0x32b8('0xc'),auth['isAuthenticated'](),controller[_0x32b8('0xd')]);router[_0x32b8('0x8')](_0x32b8('0xe'),auth[_0x32b8('0x7')](),controller['download']);router[_0x32b8('0xf')]('/',auth[_0x32b8('0x7')](),controller['create']);router['post'](_0x32b8('0xc'),auth['isAuthenticated'](),controller[_0x32b8('0x10')]);router['post'](_0x32b8('0x11'),auth[_0x32b8('0x7')](),interaction[_0x32b8('0x12')](_0x32b8('0x13'),_0x32b8('0x14')),controller['addTags']);router['put'](_0x32b8('0xb'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x32b8('0x15')),controller['update']);router['delete'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),interaction[_0x32b8('0x12')](_0x32b8('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x32b8('0x11'),auth[_0x32b8('0x7')](),controller[_0x32b8('0x16')]);module[_0x32b8('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f7d00ac..9be9be3 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 _0x29b6=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x7629e,_0x40c972){var _0x19569b=function(_0xa62841){while(--_0xa62841){_0x7629e['push'](_0x7629e['shift']());}};_0x19569b(++_0x40c972);}(_0x29b6,0x17e));var _0x629b=function(_0x564443,_0x11ff8e){_0x564443=_0x564443-0x0;var _0x53c545=_0x29b6[_0x564443];return _0x53c545;};'use strict';var Sequelize=require(_0x629b('0x0'));var moment=require(_0x629b('0x1'));module[_0x629b('0x2')]={'closed':{'type':Sequelize[_0x629b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x629b('0x4')]},'disposition':{'type':Sequelize[_0x629b('0x5')]},'secondDisposition':{'type':Sequelize[_0x629b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x629b('0x5')]},'note':{'type':Sequelize[_0x629b('0x5')]},'phone':{'type':Sequelize[_0x629b('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x629b('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x629b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x629b('0x6')]('in',_0x629b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x629b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcd6f=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x56945c,_0x41d81f){_0x56945c=_0x56945c-0x0;var _0x1af939=_0xcd6f[_0x56945c];return _0x1af939;};'use strict';var Sequelize=require(_0xfcd6('0x0'));var moment=require(_0xfcd6('0x1'));module[_0xfcd6('0x2')]={'closed':{'type':Sequelize[_0xfcd6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfcd6('0x4')]},'disposition':{'type':Sequelize[_0xfcd6('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfcd6('0x5')]},'note':{'type':Sequelize[_0xfcd6('0x5')]},'phone':{'type':Sequelize[_0xfcd6('0x5')]},'read1stAt':{'type':Sequelize[_0xfcd6('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfcd6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfcd6('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfcd6('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfcd6('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2e6c549..5363828 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 _0xe61c=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','WhatsappMessage','fields','hasOwnProperty','offset','order','sort','pick','where','WhatsappInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','lastName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','mkdirSync','Whatsapp','Account','Owner','closed','closedAt','filter','basename','existsSync','pipe','createWriteStream','direction','out','System','Contact','firstName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','moment','bluebird','util','lodash','../../components/interaction/service'];(function(_0xeb1349,_0x5014b9){var _0x2ae143=function(_0x17bb1f){while(--_0x17bb1f){_0xeb1349['push'](_0xeb1349['shift']());}};_0x2ae143(++_0x5014b9);}(_0xe61c,0xee));var _0xce61=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0xe61c[_0x2eac4f];return _0x58f73b;};'use strict';var rimraf=require(_0xce61('0x0'));var zipdir=require('zip-dir');var moment=require(_0xce61('0x1'));var BPromise=require(_0xce61('0x2'));var util=require(_0xce61('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce61('0x4'));var Redis=require('ioredis');var interaction=require(_0xce61('0x5'));var qs=require(_0xce61('0x6'));var pdf=require(_0xce61('0x7'));var logger=require(_0xce61('0x8'))(_0xce61('0x9'));var config=require(_0xce61('0xa'));var db=require(_0xce61('0xb'))['db'];config['redis']=_[_0xce61('0xc')](config[_0xce61('0xd')],{'host':_0xce61('0xe'),'port':0x18eb});var socket=require(_0xce61('0xf'))(new Redis(config[_0xce61('0xd')]));require(_0xce61('0x10'))[_0xce61('0x11')](socket);function respondWithStatusCode(_0x4c5b02,_0x64a2fd){_0x64a2fd=_0x64a2fd||0xcc;return function(_0x3f764d){if(_0x3f764d){return _0x4c5b02['sendStatus'](_0x64a2fd);}return _0x4c5b02[_0xce61('0x12')](_0x64a2fd)[_0xce61('0x13')]();};}function respondWithResult(_0x50a936,_0x32e03e){_0x32e03e=_0x32e03e||0xc8;return function(_0x52c063){if(_0x52c063){return _0x50a936[_0xce61('0x12')](_0x32e03e)[_0xce61('0x14')](_0x52c063);}};}function respondWithFilteredResult(_0x5e45f1,_0x2a3019){return function(_0x4ec131){if(_0x4ec131){var _0x28ea5f=typeof _0x2a3019['offset']===_0xce61('0x15')&&typeof _0x2a3019[_0xce61('0x16')]===_0xce61('0x15');var _0x3185ae=_0x4ec131[_0xce61('0x17')];var _0x486f1f=_0x28ea5f?0x0:_0x2a3019['offset'];var _0x330cae=_0x28ea5f?_0x4ec131['count']:_0x2a3019['offset']+_0x2a3019[_0xce61('0x16')];var _0x15151b;if(_0x330cae>=_0x3185ae){_0x330cae=_0x3185ae;_0x15151b=0xc8;}else{_0x15151b=0xce;}_0x5e45f1[_0xce61('0x12')](_0x15151b);return _0x5e45f1['set'](_0xce61('0x18'),_0x486f1f+'-'+_0x330cae+'/'+_0x3185ae)['json'](_0x4ec131);}return null;};}function saveUpdates(_0x3df071){return function(_0xafb99e){if(_0xafb99e){return _0xafb99e[_0xce61('0x19')](_0x3df071)[_0xce61('0x1a')](function(_0x3e30fa){return _0x3e30fa;});}return null;};}function removeEntity(_0x2c9ec7){return function(_0xea8db2){if(_0xea8db2){return _0xea8db2[_0xce61('0x1b')]()['then'](function(){_0x2c9ec7['status'](0xcc)[_0xce61('0x13')]();});}};}function handleEntityNotFound(_0x570ba2){return function(_0x336ff9){if(!_0x336ff9){_0x570ba2[_0xce61('0x1c')](0x194);}return _0x336ff9;};}function handleError(_0x41bf1d,_0x115466){_0x115466=_0x115466||0x1f4;return function(_0x44cfbd){logger[_0xce61('0x1d')](_0x44cfbd[_0xce61('0x1e')]);if(_0x44cfbd[_0xce61('0x1f')]){delete _0x44cfbd['name'];}_0x41bf1d['status'](_0x115466)[_0xce61('0x20')](_0x44cfbd);};}exports[_0xce61('0x21')]=function(_0x202c09,_0x15b6e7){var _0x2cf24c={};var _0x2241b2=_[_0xce61('0x22')](db[_0xce61('0x23')][_0xce61('0x24')],function(_0x2758e4){return{'name':_0x2758e4['fieldName'],'type':_0x2758e4[_0xce61('0x25')]['key']};});_0x2cf24c=qs[_0xce61('0x26')](_0x2241b2,_0x202c09);return interaction[_0xce61('0x27')](_0xce61('0x28'),_0x202c09[_0xce61('0x29')],_0x202c09[_0xce61('0x2a')],_0x2cf24c,_0x2241b2)['then'](respondWithFilteredResult(_0x15b6e7,_0x2cf24c))[_0xce61('0x2b')](handleError(_0x15b6e7,null));};exports[_0xce61('0x2c')]=function(_0x51af87,_0x4e9020){var _0x5cb588={'raw':![],'where':{'id':_0x51af87[_0xce61('0x2d')]['id']}},_0x1d6220={};_0x1d6220[_0xce61('0x2e')]=_[_0xce61('0x2f')](db[_0xce61('0x23')]['rawAttributes']);_0x1d6220[_0xce61('0x29')]=_[_0xce61('0x2f')](_0x51af87['query']);_0x1d6220[_0xce61('0x30')]=_[_0xce61('0x31')](_0x1d6220['model'],_0x1d6220[_0xce61('0x29')]);_0x5cb588[_0xce61('0x32')]=_['intersection'](_0x1d6220[_0xce61('0x2e')],qs['fields'](_0x51af87[_0xce61('0x29')]['fields']));_0x5cb588['attributes']=_0x5cb588['attributes'][_0xce61('0x33')]?_0x5cb588[_0xce61('0x32')]:_0x1d6220[_0xce61('0x2e')];if(_0x51af87[_0xce61('0x29')][_0xce61('0x34')]){_0x5cb588[_0xce61('0x35')]=[{'all':!![]}];}_0x5cb588=_[_0xce61('0x36')]({},_0x5cb588,_0x51af87[_0xce61('0x37')]);return db[_0xce61('0x23')][_0xce61('0x38')](_0x5cb588)[_0xce61('0x1a')](handleEntityNotFound(_0x4e9020,null))[_0xce61('0x1a')](respondWithResult(_0x4e9020,null))[_0xce61('0x2b')](handleError(_0x4e9020,null));};exports[_0xce61('0x39')]=function(_0x2d1854,_0xa8705b){return db[_0xce61('0x23')][_0xce61('0x39')](_0x2d1854[_0xce61('0x3a')],{})[_0xce61('0x1a')](respondWithResult(_0xa8705b,0xc9))['catch'](handleError(_0xa8705b,null));};exports[_0xce61('0x19')]=function(_0x152856,_0x2a2e21){if(_0x152856['body']['id']){delete _0x152856['body']['id'];}return db['WhatsappInteraction'][_0xce61('0x38')]({'where':{'id':_0x152856[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x2a2e21,null))[_0xce61('0x1a')](saveUpdates(_0x152856[_0xce61('0x3a')],null))[_0xce61('0x1a')](respondWithResult(_0x2a2e21,null))[_0xce61('0x2b')](handleError(_0x2a2e21,null));};exports[_0xce61('0x1b')]=function(_0x12de3d,_0x4c4403){return db['WhatsappInteraction'][_0xce61('0x38')]({'where':{'id':_0x12de3d[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x4c4403,null))[_0xce61('0x1a')](removeEntity(_0x4c4403,null))[_0xce61('0x2b')](handleError(_0x4c4403,null));};exports['describe']=function(_0x1ab744,_0x107eec){return db[_0xce61('0x23')][_0xce61('0x3b')]()[_0xce61('0x1a')](respondWithResult(_0x107eec,null))[_0xce61('0x2b')](handleError(_0x107eec,null));};exports['addMessage']=function(_0x441a34,_0x106539){return db['WhatsappMessage']['find']({'where':{'id':_0x441a34[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x106539,null))[_0xce61('0x1a')](function(_0x4580e8){if(_0x4580e8){return _0x4580e8[_0xce61('0x3c')](_0x441a34['body'][_0xce61('0x3d')],_['omit'](_0x441a34[_0xce61('0x3a')],[_0xce61('0x3d'),'id'])||{});}})[_0xce61('0x1a')](respondWithResult(_0x106539,null))[_0xce61('0x2b')](handleError(_0x106539,null));};exports['getMessages']=function(_0x482e0d,_0x4db82d){var _0x4410c5={'raw':![],'where':{}};var _0x513ce9={};var _0x294442={'count':0x0,'rows':[]};return db[_0xce61('0x23')]['findOne']({'where':{'id':_0x482e0d[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x4db82d,null))['then'](function(_0x22da74){if(_0x22da74){_0x513ce9[_0xce61('0x2e')]=_[_0xce61('0x2f')](db[_0xce61('0x3e')]['rawAttributes']);_0x513ce9[_0xce61('0x29')]=_[_0xce61('0x2f')](_0x482e0d[_0xce61('0x29')]);_0x513ce9['filters']=_[_0xce61('0x31')](_0x513ce9['model'],_0x513ce9[_0xce61('0x29')]);_0x4410c5[_0xce61('0x32')]=_[_0xce61('0x31')](_0x513ce9[_0xce61('0x2e')],qs[_0xce61('0x3f')](_0x482e0d['query'][_0xce61('0x3f')]));_0x4410c5[_0xce61('0x32')]=_0x4410c5[_0xce61('0x32')]['length']?_0x4410c5['attributes']:_0x513ce9[_0xce61('0x2e')];if(!_0x482e0d[_0xce61('0x29')][_0xce61('0x40')]('nolimit')){_0x4410c5[_0xce61('0x16')]=qs[_0xce61('0x16')](_0x482e0d[_0xce61('0x29')][_0xce61('0x16')]);_0x4410c5[_0xce61('0x41')]=qs[_0xce61('0x41')](_0x482e0d[_0xce61('0x29')][_0xce61('0x41')]);}_0x4410c5[_0xce61('0x42')]=qs[_0xce61('0x43')](_0x482e0d['query']['sort']);_0x4410c5['where']=qs[_0xce61('0x30')](_[_0xce61('0x44')](_0x482e0d[_0xce61('0x29')],_0x513ce9[_0xce61('0x30')]));_0x4410c5[_0xce61('0x45')][_0xce61('0x46')]=_0x22da74['id'];if(_0x482e0d[_0xce61('0x29')]['filter']){_0x4410c5[_0xce61('0x45')]=_[_0xce61('0x36')](_0x4410c5[_0xce61('0x45')],{'$or':_['map'](_0x4410c5['attributes'],function(_0x5d3e5e){var _0x3dfdcb={};_0x3dfdcb[_0x5d3e5e]={'$like':'%'+_0x482e0d[_0xce61('0x29')]['filter']+'%'};return _0x3dfdcb;})});}if(_0x482e0d['query'][_0xce61('0x47')]){var _0x51a7d3=_0x482e0d[_0xce61('0x29')]['$gte'][_0xce61('0x48')](',');var _0x5de1bd={};_0x5de1bd[_0x51a7d3[0x0]]={'$gte':moment(_0x51a7d3[0x1])[_0xce61('0x49')](_0xce61('0x4a'))};_0x4410c5[_0xce61('0x45')]=_['merge'](_0x4410c5[_0xce61('0x45')],_0x5de1bd);}_0x4410c5=_[_0xce61('0x36')]({},_0x4410c5,_0x482e0d[_0xce61('0x37')]);return db[_0xce61('0x3e')][_0xce61('0x17')]({'where':_0x4410c5[_0xce61('0x45')]})[_0xce61('0x1a')](function(_0x12953b){_0x294442[_0xce61('0x17')]=_0x12953b;if(_0x482e0d[_0xce61('0x29')]['includeAll']){_0x4410c5[_0xce61('0x35')]=[{'all':!![]}];}return db[_0xce61('0x3e')][_0xce61('0x27')](_0x4410c5);})[_0xce61('0x1a')](function(_0x2173e1){_0x294442[_0xce61('0x4b')]=_0x2173e1;return _0x294442;});}})[_0xce61('0x1a')](respondWithFilteredResult(_0x4db82d,_0x4410c5))['catch'](handleError(_0x4db82d,null));};exports[_0xce61('0x4c')]=function(_0x4db7e2,_0x25701e){return db['WhatsappInteraction'][_0xce61('0x38')]({'where':{'id':_0x4db7e2[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x25701e,null))[_0xce61('0x1a')](function(_0xe6c182){if(_0xe6c182){return _0xe6c182['setTags'](_0x4db7e2[_0xce61('0x3a')]['ids'],_[_0xce61('0x4d')](_0x4db7e2[_0xce61('0x3a')],[_0xce61('0x3d'),'id'])||{})[_0xce61('0x4e')](function(){return db['Tag'][_0xce61('0x27')]({'attributes':['id',_0xce61('0x1f'),_0xce61('0x4f')],'where':{'id':_0x4db7e2[_0xce61('0x3a')][_0xce61('0x3d')]}});})[_0xce61('0x1a')](function(_0x24f663){socket[_0xce61('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x4db7e2[_0xce61('0x2d')]['id']),'tags':_0x24f663||[]});return{'id':Number(_0x4db7e2[_0xce61('0x2d')]['id']),'tags':_0x24f663||[]};});}})[_0xce61('0x1a')](respondWithResult(_0x25701e,null))[_0xce61('0x2b')](handleError(_0x25701e,null));};exports['removeTags']=function(_0x1d71c8,_0x5a7815){return db[_0xce61('0x23')][_0xce61('0x38')]({'where':{'id':_0x1d71c8[_0xce61('0x2d')]['id']}})[_0xce61('0x1a')](handleEntityNotFound(_0x5a7815,null))[_0xce61('0x1a')](function(_0x3e7ac1){if(_0x3e7ac1){return _0x3e7ac1[_0xce61('0x51')](_0x1d71c8[_0xce61('0x29')]['ids']);}})[_0xce61('0x1a')](respondWithStatusCode(_0x5a7815,null))[_0xce61('0x2b')](handleError(_0x5a7815,null));};exports['download']=function(_0x3d2ac7,_0x14a290){var _0x35797b=moment()[_0xce61('0x52')]()[_0xce61('0x53')]();var _0x332f39=path[_0xce61('0x54')](config[_0xce61('0x55')],_0xce61('0x56'),_0xce61('0x57'),_0xce61('0x58'));var _0x2f65cc=path['join'](config[_0xce61('0x55')],_0xce61('0x56'),_0xce61('0x57'),_0xce61('0x59'));var _0x1d9284=path[_0xce61('0x54')](_0x332f39,_0x35797b);var _0x112985=util[_0xce61('0x49')]('transcript-%d-%s.zip',_0x3d2ac7[_0xce61('0x2d')]['id'],_0x35797b);var _0x1a55f7=path[_0xce61('0x54')](_0x332f39,_0x112985);var _0x406cad=[];_0x406cad[_0xce61('0x5a')]({'model':db[_0xce61('0x5b')],'as':'User','attributes':['id',_0xce61('0x5c')],'raw':!![]});_0x406cad[_0xce61('0x5a')]({'model':db[_0xce61('0x5d')],'as':'Contact','attributes':['id','firstName',_0xce61('0x5e')],'raw':!![]});if(_0x3d2ac7[_0xce61('0x29')][_0xce61('0x59')]){_0x406cad[_0xce61('0x5a')]({'model':db[_0xce61('0x5f')],'as':_0xce61('0x5f'),'raw':!![]});}var _0x576415=[{'model':db[_0xce61('0x3e')],'as':_0xce61('0x60'),'attributes':['id',_0xce61('0x3a'),_0xce61('0x61'),'direction',_0xce61('0x62'),_0xce61('0x63')],'include':_0x406cad}];_0x576415['push']({'model':db[_0xce61('0x64')],'as':'Account','attributes':['id','name']});_0x576415[_0xce61('0x5a')]({'model':db[_0xce61('0x5b')],'as':'Owner','attributes':['id',_0xce61('0x5c')]});return db[_0xce61('0x23')]['find']({'where':{'id':_0x3d2ac7[_0xce61('0x2d')]['id']},'include':_0x576415})[_0xce61('0x1a')](handleEntityNotFound(_0x14a290,null))['then'](function(_0x4b936d){if(_0x4b936d){var _0x508ae4=_0x4b936d['get']({'plain':!![]});fs[_0xce61('0x65')](_0x1d9284);var _0x3f65fb={'channel':_0xce61('0x66'),'account':_0x508ae4[_0xce61('0x67')]['name'],'agent':_0x508ae4['Owner']?_0x508ae4[_0xce61('0x68')][_0xce61('0x5c')]:'N.A.','createdAt':moment(_0x508ae4[_0xce61('0x61')])[_0xce61('0x49')](_0xce61('0x4a'))[_0xce61('0x53')](),'closedAt':_0x508ae4[_0xce61('0x69')]?moment(_0x508ae4[_0xce61('0x6a')])[_0xce61('0x49')](_0xce61('0x4a'))[_0xce61('0x53')]():'','disposition':_0x508ae4['disposition'],'messages':_(_0x508ae4[_0xce61('0x60')])[_0xce61('0x6b')]({'secret':![]})[_0xce61('0x22')](function(_0x226419){if(_0x226419[_0xce61('0x5f')]){var _0x1f631d=path[_0xce61('0x54')](_0x2f65cc,_0x226419[_0xce61('0x5f')][_0xce61('0x6c')]);if(fs[_0xce61('0x6d')](_0x1f631d)){fs['createReadStream'](_0x1f631d)[_0xce61('0x6e')](fs[_0xce61('0x6f')](path['join'](_0x1d9284,_0x226419[_0xce61('0x5f')][_0xce61('0x6c')])));}}return{'date':moment(_0x226419[_0xce61('0x61')])[_0xce61('0x49')](_0xce61('0x4a'))['toString'](),'sender':_0x226419[_0xce61('0x70')]===_0xce61('0x71')?_0x226419[_0xce61('0x5b')]?_0x226419['User'][_0xce61('0x5c')]:_0xce61('0x72'):_0x226419[_0xce61('0x73')][_0xce61('0x74')]+(_0x226419['Contact'][_0xce61('0x5e')]?'\x20'+_0x226419[_0xce61('0x73')][_0xce61('0x5e')]:''),'body':_0x226419[_0xce61('0x5f')]?_0x226419[_0xce61('0x5f')][_0xce61('0x6c')]:_0x226419[_0xce61('0x3a')],'direction':_0x226419[_0xce61('0x70')]==='out'?'A':'C','secret':_0x226419[_0xce61('0x62')],'read':_0x226419[_0xce61('0x63')],'attachment':_0x226419[_0xce61('0x5f')]};})['value']()};return ejs[_0xce61('0x75')](path[_0xce61('0x54')](config[_0xce61('0x55')],_0xce61('0x56'),'views',_0xce61('0x76')),{'interaction':_0x3f65fb})['then'](function(_0x2a16ed){var _0x373096=path[_0xce61('0x54')](_0x1d9284,_0xce61('0x77')+_0x508ae4['id']+'-'+_0x35797b+_0xce61('0x78'));var _0x13f89b={'path':_0x373096,'channel':'Whatsapp','interactionId':_0x508ae4['id']};return pdf[_0xce61('0x79')](_0x2a16ed,_0x13f89b);})[_0xce61('0x1a')](function(){return new BPromise(function(_0x4b7264,_0x555d36){zipdir(_0x1d9284,{'saveTo':_0x1a55f7},function(_0x27ddd2,_0x4b9e63){if(_0x27ddd2)return _0x555d36(_0x27ddd2);return _0x4b7264(_0x4b9e63);});})[_0xce61('0x1a')](function(){return new BPromise(function(_0xe1528b,_0x389e6){rimraf(_0x1d9284,function(_0x48e4f7){if(_0x48e4f7)_0x389e6(_0x48e4f7);return _0xe1528b();});});})[_0xce61('0x1a')](function(){return _0x14a290['download'](_0x1a55f7,_0x112985,function(_0x5b215a){if(_0x5b215a){console['log']('err',_0x5b215a);}else{fs['unlinkSync'](_0x1a55f7);}});});});}else{return _0x14a290['sendStatus'](0xc8);}})[_0xce61('0x2b')](handleError(_0x14a290,null));}; \ No newline at end of file +var _0xf891=['createdAt','secret','read','Account','Owner','get','mkdirSync','Whatsapp','name','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction','out','System','Contact','lastName','value','renderFile','downloadInteraction.ejs','.pdf','log','err','rimraf','zip-dir','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','index','map','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','options','WhatsappInteraction','create','body','find','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','hasOwnProperty','sort','where','pick','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','ids','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','User','fullname','push','CmContact','firstName','Attachment','Messages'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xf891,0x93));var _0x1f89=function(_0x50f7e3,_0x3d5f19){_0x50f7e3=_0x50f7e3-0x0;var _0x159b5b=_0xf891[_0x50f7e3];return _0x159b5b;};'use strict';var rimraf=require(_0x1f89('0x0'));var zipdir=require(_0x1f89('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1f89('0x2'));var path=require(_0x1f89('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f89('0x4'));var Redis=require('ioredis');var interaction=require(_0x1f89('0x5'));var qs=require(_0x1f89('0x6'));var pdf=require(_0x1f89('0x7'));var logger=require('../../config/logger')(_0x1f89('0x8'));var config=require(_0x1f89('0x9'));var db=require('../../mysqldb')['db'];config[_0x1f89('0xa')]=_[_0x1f89('0xb')](config[_0x1f89('0xa')],{'host':_0x1f89('0xc'),'port':0x18eb});var socket=require(_0x1f89('0xd'))(new Redis(config[_0x1f89('0xa')]));require(_0x1f89('0xe'))['register'](socket);function respondWithStatusCode(_0x23446e,_0x13d0c1){_0x13d0c1=_0x13d0c1||0xcc;return function(_0x3efaf){if(_0x3efaf){return _0x23446e[_0x1f89('0xf')](_0x13d0c1);}return _0x23446e[_0x1f89('0x10')](_0x13d0c1)[_0x1f89('0x11')]();};}function respondWithResult(_0x416c48,_0x25eb55){_0x25eb55=_0x25eb55||0xc8;return function(_0x592df0){if(_0x592df0){return _0x416c48[_0x1f89('0x10')](_0x25eb55)[_0x1f89('0x12')](_0x592df0);}};}function respondWithFilteredResult(_0x453de7,_0x538472){return function(_0x49cf61){if(_0x49cf61){var _0x501f53=typeof _0x538472[_0x1f89('0x13')]===_0x1f89('0x14')&&typeof _0x538472[_0x1f89('0x15')]==='undefined';var _0x5460ee=_0x49cf61[_0x1f89('0x16')];var _0x48c9e1=_0x501f53?0x0:_0x538472['offset'];var _0x5956bd=_0x501f53?_0x49cf61[_0x1f89('0x16')]:_0x538472[_0x1f89('0x13')]+_0x538472[_0x1f89('0x15')];var _0x594f61;if(_0x5956bd>=_0x5460ee){_0x5956bd=_0x5460ee;_0x594f61=0xc8;}else{_0x594f61=0xce;}_0x453de7[_0x1f89('0x10')](_0x594f61);return _0x453de7[_0x1f89('0x17')](_0x1f89('0x18'),_0x48c9e1+'-'+_0x5956bd+'/'+_0x5460ee)['json'](_0x49cf61);}return null;};}function saveUpdates(_0x55cc06){return function(_0x1126ed){if(_0x1126ed){return _0x1126ed[_0x1f89('0x19')](_0x55cc06)[_0x1f89('0x1a')](function(_0x3f6487){return _0x3f6487;});}return null;};}function removeEntity(_0x2e2ac4){return function(_0x54ac31){if(_0x54ac31){return _0x54ac31[_0x1f89('0x1b')]()[_0x1f89('0x1a')](function(){_0x2e2ac4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d9e6){return function(_0x5e2aab){if(!_0x5e2aab){_0x21d9e6[_0x1f89('0xf')](0x194);}return _0x5e2aab;};}function handleError(_0x18971f,_0x1b1d30){_0x1b1d30=_0x1b1d30||0x1f4;return function(_0x19fc5d){logger[_0x1f89('0x1c')](_0x19fc5d['stack']);if(_0x19fc5d['name']){delete _0x19fc5d['name'];}_0x18971f[_0x1f89('0x10')](_0x1b1d30)['send'](_0x19fc5d);};}exports[_0x1f89('0x1d')]=function(_0xf2d1a1,_0xe64cbb){var _0x3a9fa8={};var _0x5a46e5=_[_0x1f89('0x1e')](db['WhatsappInteraction'][_0x1f89('0x1f')],function(_0xd8266b){return{'name':_0xd8266b[_0x1f89('0x20')],'type':_0xd8266b[_0x1f89('0x21')][_0x1f89('0x22')]};});_0x3a9fa8=qs['getOptions'](_0x5a46e5,_0xf2d1a1);return interaction[_0x1f89('0x23')](_0x1f89('0x24'),_0xf2d1a1[_0x1f89('0x25')],_0xf2d1a1[_0x1f89('0x26')],_0x3a9fa8,_0x5a46e5)[_0x1f89('0x1a')](respondWithFilteredResult(_0xe64cbb,_0x3a9fa8))[_0x1f89('0x27')](handleError(_0xe64cbb,null));};exports[_0x1f89('0x28')]=function(_0x4866cc,_0x4386cd){var _0x4535c0={'raw':![],'where':{'id':_0x4866cc[_0x1f89('0x29')]['id']}},_0x4e7246={};_0x4e7246[_0x1f89('0x2a')]=_[_0x1f89('0x2b')](db['WhatsappInteraction'][_0x1f89('0x1f')]);_0x4e7246[_0x1f89('0x25')]=_[_0x1f89('0x2b')](_0x4866cc[_0x1f89('0x25')]);_0x4e7246[_0x1f89('0x2c')]=_[_0x1f89('0x2d')](_0x4e7246[_0x1f89('0x2a')],_0x4e7246['query']);_0x4535c0['attributes']=_[_0x1f89('0x2d')](_0x4e7246[_0x1f89('0x2a')],qs['fields'](_0x4866cc[_0x1f89('0x25')][_0x1f89('0x2e')]));_0x4535c0[_0x1f89('0x2f')]=_0x4535c0[_0x1f89('0x2f')]['length']?_0x4535c0['attributes']:_0x4e7246[_0x1f89('0x2a')];if(_0x4866cc[_0x1f89('0x25')][_0x1f89('0x30')]){_0x4535c0['include']=[{'all':!![]}];}_0x4535c0=_[_0x1f89('0x31')]({},_0x4535c0,_0x4866cc[_0x1f89('0x32')]);return db[_0x1f89('0x33')]['find'](_0x4535c0)[_0x1f89('0x1a')](handleEntityNotFound(_0x4386cd,null))['then'](respondWithResult(_0x4386cd,null))[_0x1f89('0x27')](handleError(_0x4386cd,null));};exports['create']=function(_0xb7823,_0x16002f){return db[_0x1f89('0x33')][_0x1f89('0x34')](_0xb7823[_0x1f89('0x35')],{})['then'](respondWithResult(_0x16002f,0xc9))[_0x1f89('0x27')](handleError(_0x16002f,null));};exports[_0x1f89('0x19')]=function(_0xe158fd,_0x1dda06){if(_0xe158fd[_0x1f89('0x35')]['id']){delete _0xe158fd['body']['id'];}return db['WhatsappInteraction'][_0x1f89('0x36')]({'where':{'id':_0xe158fd[_0x1f89('0x29')]['id']}})['then'](handleEntityNotFound(_0x1dda06,null))[_0x1f89('0x1a')](saveUpdates(_0xe158fd[_0x1f89('0x35')],null))['then'](respondWithResult(_0x1dda06,null))[_0x1f89('0x27')](handleError(_0x1dda06,null));};exports[_0x1f89('0x1b')]=function(_0x29f55d,_0x4805f6){return db[_0x1f89('0x33')][_0x1f89('0x36')]({'where':{'id':_0x29f55d[_0x1f89('0x29')]['id']}})[_0x1f89('0x1a')](handleEntityNotFound(_0x4805f6,null))[_0x1f89('0x1a')](removeEntity(_0x4805f6,null))[_0x1f89('0x27')](handleError(_0x4805f6,null));};exports['describe']=function(_0x5e0e43,_0x116dbc){return db[_0x1f89('0x33')][_0x1f89('0x37')]()['then'](respondWithResult(_0x116dbc,null))[_0x1f89('0x27')](handleError(_0x116dbc,null));};exports[_0x1f89('0x38')]=function(_0x232294,_0x4fcd10){return db[_0x1f89('0x39')][_0x1f89('0x36')]({'where':{'id':_0x232294[_0x1f89('0x29')]['id']}})[_0x1f89('0x1a')](handleEntityNotFound(_0x4fcd10,null))[_0x1f89('0x1a')](function(_0x4dbf07){if(_0x4dbf07){return _0x4dbf07[_0x1f89('0x38')](_0x232294['body']['ids'],_[_0x1f89('0x3a')](_0x232294[_0x1f89('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x4fcd10,null))['catch'](handleError(_0x4fcd10,null));};exports[_0x1f89('0x3b')]=function(_0x3548b8,_0x4ac40d){var _0x2cb2f={'raw':![],'where':{}};var _0x4092d9={};var _0xcd329f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1f89('0x3c')]({'where':{'id':_0x3548b8[_0x1f89('0x29')]['id']}})['then'](handleEntityNotFound(_0x4ac40d,null))[_0x1f89('0x1a')](function(_0x21a10a){if(_0x21a10a){_0x4092d9[_0x1f89('0x2a')]=_['keys'](db[_0x1f89('0x39')][_0x1f89('0x1f')]);_0x4092d9['query']=_[_0x1f89('0x2b')](_0x3548b8[_0x1f89('0x25')]);_0x4092d9[_0x1f89('0x2c')]=_[_0x1f89('0x2d')](_0x4092d9[_0x1f89('0x2a')],_0x4092d9['query']);_0x2cb2f[_0x1f89('0x2f')]=_[_0x1f89('0x2d')](_0x4092d9[_0x1f89('0x2a')],qs['fields'](_0x3548b8[_0x1f89('0x25')][_0x1f89('0x2e')]));_0x2cb2f[_0x1f89('0x2f')]=_0x2cb2f[_0x1f89('0x2f')]['length']?_0x2cb2f['attributes']:_0x4092d9[_0x1f89('0x2a')];if(!_0x3548b8['query'][_0x1f89('0x3d')]('nolimit')){_0x2cb2f[_0x1f89('0x15')]=qs[_0x1f89('0x15')](_0x3548b8[_0x1f89('0x25')][_0x1f89('0x15')]);_0x2cb2f['offset']=qs[_0x1f89('0x13')](_0x3548b8[_0x1f89('0x25')][_0x1f89('0x13')]);}_0x2cb2f['order']=qs['sort'](_0x3548b8['query'][_0x1f89('0x3e')]);_0x2cb2f[_0x1f89('0x3f')]=qs[_0x1f89('0x2c')](_[_0x1f89('0x40')](_0x3548b8[_0x1f89('0x25')],_0x4092d9[_0x1f89('0x2c')]));_0x2cb2f['where'][_0x1f89('0x41')]=_0x21a10a['id'];if(_0x3548b8[_0x1f89('0x25')][_0x1f89('0x42')]){_0x2cb2f['where']=_[_0x1f89('0x31')](_0x2cb2f[_0x1f89('0x3f')],{'$or':_[_0x1f89('0x1e')](_0x2cb2f[_0x1f89('0x2f')],function(_0x46d47e){var _0x585811={};_0x585811[_0x46d47e]={'$like':'%'+_0x3548b8[_0x1f89('0x25')][_0x1f89('0x42')]+'%'};return _0x585811;})});}if(_0x3548b8[_0x1f89('0x25')]['$gte']){var _0xe20365=_0x3548b8[_0x1f89('0x25')][_0x1f89('0x43')]['split'](',');var _0x5d138e={};_0x5d138e[_0xe20365[0x0]]={'$gte':moment(_0xe20365[0x1])[_0x1f89('0x44')](_0x1f89('0x45'))};_0x2cb2f[_0x1f89('0x3f')]=_[_0x1f89('0x31')](_0x2cb2f['where'],_0x5d138e);}_0x2cb2f=_['merge']({},_0x2cb2f,_0x3548b8[_0x1f89('0x32')]);return db[_0x1f89('0x39')][_0x1f89('0x16')]({'where':_0x2cb2f[_0x1f89('0x3f')]})['then'](function(_0x4a6e83){_0xcd329f[_0x1f89('0x16')]=_0x4a6e83;if(_0x3548b8['query'][_0x1f89('0x30')]){_0x2cb2f[_0x1f89('0x46')]=[{'all':!![]}];}return db[_0x1f89('0x39')][_0x1f89('0x23')](_0x2cb2f);})[_0x1f89('0x1a')](function(_0x4991a2){_0xcd329f[_0x1f89('0x47')]=_0x4991a2;return _0xcd329f;});}})[_0x1f89('0x1a')](respondWithFilteredResult(_0x4ac40d,_0x2cb2f))['catch'](handleError(_0x4ac40d,null));};exports[_0x1f89('0x48')]=function(_0x13606a,_0x3037d0){return db[_0x1f89('0x33')][_0x1f89('0x36')]({'where':{'id':_0x13606a[_0x1f89('0x29')]['id']}})[_0x1f89('0x1a')](handleEntityNotFound(_0x3037d0,null))[_0x1f89('0x1a')](function(_0x14bceb){if(_0x14bceb){return _0x14bceb['setTags'](_0x13606a['body']['ids'],_[_0x1f89('0x3a')](_0x13606a[_0x1f89('0x35')],[_0x1f89('0x49'),'id'])||{})['spread'](function(){return db[_0x1f89('0x4a')][_0x1f89('0x23')]({'attributes':['id','name',_0x1f89('0x4b')],'where':{'id':_0x13606a[_0x1f89('0x35')]['ids']}});})[_0x1f89('0x1a')](function(_0x5e4a70){socket[_0x1f89('0x4c')](_0x1f89('0x4d'),{'id':Number(_0x13606a['params']['id']),'tags':_0x5e4a70||[]});return{'id':Number(_0x13606a[_0x1f89('0x29')]['id']),'tags':_0x5e4a70||[]};});}})[_0x1f89('0x1a')](respondWithResult(_0x3037d0,null))[_0x1f89('0x27')](handleError(_0x3037d0,null));};exports[_0x1f89('0x4e')]=function(_0x1ddaf6,_0xebfd37){return db['WhatsappInteraction'][_0x1f89('0x36')]({'where':{'id':_0x1ddaf6[_0x1f89('0x29')]['id']}})[_0x1f89('0x1a')](handleEntityNotFound(_0xebfd37,null))[_0x1f89('0x1a')](function(_0x5a5e8a){if(_0x5a5e8a){return _0x5a5e8a[_0x1f89('0x4e')](_0x1ddaf6['query'][_0x1f89('0x49')]);}})[_0x1f89('0x1a')](respondWithStatusCode(_0xebfd37,null))[_0x1f89('0x27')](handleError(_0xebfd37,null));};exports[_0x1f89('0x4f')]=function(_0x3467ef,_0x2e4255){var _0x31f8b2=moment()[_0x1f89('0x50')]()[_0x1f89('0x51')]();var _0x4d6bb3=path[_0x1f89('0x52')](config['root'],_0x1f89('0x53'),_0x1f89('0x54'),_0x1f89('0x55'));var _0x172a0b=path[_0x1f89('0x52')](config[_0x1f89('0x56')],_0x1f89('0x53'),_0x1f89('0x54'),_0x1f89('0x57'));var _0x4e4f62=path[_0x1f89('0x52')](_0x4d6bb3,_0x31f8b2);var _0x275c6d=util[_0x1f89('0x44')]('transcript-%d-%s.zip',_0x3467ef[_0x1f89('0x29')]['id'],_0x31f8b2);var _0x5ac2ef=path[_0x1f89('0x52')](_0x4d6bb3,_0x275c6d);var _0x2a634d=[];_0x2a634d['push']({'model':db[_0x1f89('0x58')],'as':_0x1f89('0x58'),'attributes':['id',_0x1f89('0x59')],'raw':!![]});_0x2a634d[_0x1f89('0x5a')]({'model':db[_0x1f89('0x5b')],'as':'Contact','attributes':['id',_0x1f89('0x5c'),'lastName'],'raw':!![]});if(_0x3467ef['query'][_0x1f89('0x57')]){_0x2a634d[_0x1f89('0x5a')]({'model':db[_0x1f89('0x5d')],'as':_0x1f89('0x5d'),'raw':!![]});}var _0x3f3e3a=[{'model':db[_0x1f89('0x39')],'as':_0x1f89('0x5e'),'attributes':['id','body',_0x1f89('0x5f'),'direction',_0x1f89('0x60'),_0x1f89('0x61')],'include':_0x2a634d}];_0x3f3e3a['push']({'model':db['WhatsappAccount'],'as':_0x1f89('0x62'),'attributes':['id','name']});_0x3f3e3a['push']({'model':db[_0x1f89('0x58')],'as':_0x1f89('0x63'),'attributes':['id','fullname']});return db[_0x1f89('0x33')][_0x1f89('0x36')]({'where':{'id':_0x3467ef['params']['id']},'include':_0x3f3e3a})[_0x1f89('0x1a')](handleEntityNotFound(_0x2e4255,null))[_0x1f89('0x1a')](function(_0x151b5d){if(_0x151b5d){var _0x347e11=_0x151b5d[_0x1f89('0x64')]({'plain':!![]});fs[_0x1f89('0x65')](_0x4e4f62);var _0x21e57d={'channel':_0x1f89('0x66'),'account':_0x347e11[_0x1f89('0x62')][_0x1f89('0x67')],'agent':_0x347e11[_0x1f89('0x63')]?_0x347e11[_0x1f89('0x63')][_0x1f89('0x59')]:'N.A.','createdAt':moment(_0x347e11[_0x1f89('0x5f')])[_0x1f89('0x44')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1f89('0x51')](),'closedAt':_0x347e11['closed']?moment(_0x347e11[_0x1f89('0x68')])['format'](_0x1f89('0x45'))['toString']():'','disposition':_0x347e11[_0x1f89('0x69')],'messages':_(_0x347e11[_0x1f89('0x5e')])['filter']({'secret':![]})[_0x1f89('0x1e')](function(_0x17c58b){if(_0x17c58b['Attachment']){var _0x2800ba=path[_0x1f89('0x52')](_0x172a0b,_0x17c58b[_0x1f89('0x5d')][_0x1f89('0x6a')]);if(fs[_0x1f89('0x6b')](_0x2800ba)){fs['createReadStream'](_0x2800ba)[_0x1f89('0x6c')](fs[_0x1f89('0x6d')](path[_0x1f89('0x52')](_0x4e4f62,_0x17c58b[_0x1f89('0x5d')]['basename'])));}}return{'date':moment(_0x17c58b['createdAt'])[_0x1f89('0x44')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x17c58b[_0x1f89('0x6e')]===_0x1f89('0x6f')?_0x17c58b[_0x1f89('0x58')]?_0x17c58b[_0x1f89('0x58')][_0x1f89('0x59')]:_0x1f89('0x70'):_0x17c58b['Contact']['firstName']+(_0x17c58b[_0x1f89('0x71')][_0x1f89('0x72')]?'\x20'+_0x17c58b[_0x1f89('0x71')][_0x1f89('0x72')]:''),'body':_0x17c58b['Attachment']?_0x17c58b[_0x1f89('0x5d')][_0x1f89('0x6a')]:_0x17c58b[_0x1f89('0x35')],'direction':_0x17c58b['direction']==='out'?'A':'C','secret':_0x17c58b['secret'],'read':_0x17c58b[_0x1f89('0x61')],'attachment':_0x17c58b[_0x1f89('0x5d')]};})[_0x1f89('0x73')]()};return ejs[_0x1f89('0x74')](path[_0x1f89('0x52')](config[_0x1f89('0x56')],_0x1f89('0x53'),'views',_0x1f89('0x75')),{'interaction':_0x21e57d})[_0x1f89('0x1a')](function(_0x2f6126){var _0x4c3cf0=path[_0x1f89('0x52')](_0x4e4f62,'transcript-'+_0x347e11['id']+'-'+_0x31f8b2+_0x1f89('0x76'));var _0x115f62={'path':_0x4c3cf0,'channel':_0x1f89('0x66'),'interactionId':_0x347e11['id']};return pdf['createPdfFromHTML'](_0x2f6126,_0x115f62);})[_0x1f89('0x1a')](function(){return new BPromise(function(_0xaabbb6,_0x557f99){zipdir(_0x4e4f62,{'saveTo':_0x5ac2ef},function(_0x40deec,_0x443399){if(_0x40deec)return _0x557f99(_0x40deec);return _0xaabbb6(_0x443399);});})[_0x1f89('0x1a')](function(){return new BPromise(function(_0x5b5870,_0x31139f){rimraf(_0x4e4f62,function(_0x4dc277){if(_0x4dc277)_0x31139f(_0x4dc277);return _0x5b5870();});});})[_0x1f89('0x1a')](function(){return _0x2e4255[_0x1f89('0x4f')](_0x5ac2ef,_0x275c6d,function(_0x41cbed){if(_0x41cbed){console[_0x1f89('0x77')](_0x1f89('0x78'),_0x41cbed);}else{fs['unlinkSync'](_0x5ac2ef);}});});});}else{return _0x2e4255[_0x1f89('0xf')](0xc8);}})[_0x1f89('0x27')](handleError(_0x2e4255,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d863bfb..de9f3fe 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 _0x7794=['save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x16a33b,_0x1e7f53){var _0x4d2277=function(_0x356977){while(--_0x356977){_0x16a33b['push'](_0x16a33b['shift']());}};_0x4d2277(++_0x1e7f53);}(_0x7794,0x7b));var _0x4779=function(_0x1fbfba,_0x1d6348){_0x1fbfba=_0x1fbfba-0x0;var _0x1cb949=_0x7794[_0x1fbfba];return _0x1cb949;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x4779('0x0'))['db'][_0x4779('0x1')];var WhatsappMessage=require(_0x4779('0x0'))['db'][_0x4779('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4779('0x3'),'afterUpdate':_0x4779('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40e5f9){return function(_0x54dc7f,_0x59d1bf,_0x53fd58){_0x54dc7f[_0x4779('0x5')]({'attributes':['id'],'raw':!![]})[_0x4779('0x6')](function(_0x523c93){_0x54dc7f[_0x4779('0x7')](_0x4779('0x8'),_0x523c93[_0x4779('0x9')](function(_0x20e2af){return{'id':_0x20e2af['id']};}));return WhatsappMessage[_0x4779('0xa')]({'where':{'WhatsappInteractionId':_0x54dc7f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4779('0x6')](function(_0x42e4c0){_0x54dc7f['setDataValue'](_0x4779('0xb'),_0x42e4c0[_0x4779('0xc')]);WhatsappInteractionEvents[_0x4779('0xd')](_0x40e5f9+':'+_0x54dc7f['id'],_0x54dc7f);WhatsappInteractionEvents[_0x4779('0xd')](_0x40e5f9,_0x54dc7f);_0x53fd58(null);})[_0x4779('0xe')](_0x53fd58(null));};}for(var e in events){if(events[_0x4779('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4779('0x10')](e,emitEvent(event));}}module[_0x4779('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6324=['WhatsappInteraction','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xa80908,_0x1fbb08){var _0x1e8bed=function(_0x4e45b7){while(--_0x4e45b7){_0xa80908['push'](_0xa80908['shift']());}};_0x1e8bed(++_0x1fbb08);}(_0x6324,0x142));var _0x4632=function(_0x22d68a,_0x3f6978){_0x22d68a=_0x22d68a-0x0;var _0x131c53=_0x6324[_0x22d68a];return _0x131c53;};'use strict';var EventEmitter=require(_0x4632('0x0'));var WhatsappInteraction=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var WhatsappMessage=require(_0x4632('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13b218){return function(_0x592e39,_0x140bc7,_0x24aba6){_0x592e39[_0x4632('0x5')]({'attributes':['id'],'raw':!![]})[_0x4632('0x6')](function(_0x4a15b2){_0x592e39[_0x4632('0x7')](_0x4632('0x8'),_0x4a15b2[_0x4632('0x9')](function(_0x5a523b){return{'id':_0x5a523b['id']};}));return WhatsappMessage[_0x4632('0xa')]({'where':{'WhatsappInteractionId':_0x592e39['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4632('0x6')](function(_0x47a518){_0x592e39['setDataValue'](_0x4632('0xb'),_0x47a518[_0x4632('0xc')]);WhatsappInteractionEvents[_0x4632('0xd')](_0x13b218+':'+_0x592e39['id'],_0x592e39);WhatsappInteractionEvents[_0x4632('0xd')](_0x13b218,_0x592e39);_0x24aba6(null);})[_0x4632('0xe')](_0x24aba6(null));};}for(var e in events){if(events[_0x4632('0xf')](e)){var event=events[e];WhatsappInteraction[_0x4632('0x10')](e,emitEvent(event));}}module[_0x4632('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 634e0c0..246d7d3 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 _0x3d70=['./whatsappInteraction.attributes','define','WhatsappInteraction','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x275e93,_0x482f38){var _0x37cf52=function(_0x74579e){while(--_0x74579e){_0x275e93['push'](_0x275e93['shift']());}};_0x37cf52(++_0x482f38);}(_0x3d70,0xf6));var _0x03d7=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0x3d70[_0xe1a3a5];return _0x362646;};'use strict';var _=require('lodash');var util=require(_0x03d7('0x0'));var logger=require(_0x03d7('0x1'))(_0x03d7('0x2'));var moment=require('moment');var BPromise=require(_0x03d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03d7('0x4'));var rimraf=require(_0x03d7('0x5'));var config=require('../../config/environment');var attributes=require(_0x03d7('0x6'));module['exports']=function(_0x4728d0,_0xdfabac){return _0x4728d0[_0x03d7('0x7')](_0x03d7('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x233035,_0x34bc56,_0x2bb58c){if(_0x233035['changed'](_0x03d7('0x9'))){_0x233035[_0x03d7('0xa')]=moment()['format'](_0x03d7('0xb'));}_0x2bb58c(null,_0x233035);}}});}; \ No newline at end of file +var _0xe5b8=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','changed','closed'];(function(_0x38729c,_0x259e2a){var _0x590303=function(_0x422f21){while(--_0x422f21){_0x38729c['push'](_0x38729c['shift']());}};_0x590303(++_0x259e2a);}(_0xe5b8,0x12f));var _0x8e5b=function(_0x1ccf1c,_0x4d3782){_0x1ccf1c=_0x1ccf1c-0x0;var _0x333789=_0xe5b8[_0x1ccf1c];return _0x333789;};'use strict';var _=require(_0x8e5b('0x0'));var util=require(_0x8e5b('0x1'));var logger=require('../../config/logger')(_0x8e5b('0x2'));var moment=require('moment');var BPromise=require(_0x8e5b('0x3'));var rp=require(_0x8e5b('0x4'));var fs=require('fs');var path=require(_0x8e5b('0x5'));var rimraf=require(_0x8e5b('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e5b('0x7'));module[_0x8e5b('0x8')]=function(_0x291cbb,_0x673e31){return _0x291cbb[_0x8e5b('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5319,_0x2cd032,_0x2b04c9){if(_0x1e5319[_0x8e5b('0xa')](_0x8e5b('0xb'))){_0x1e5319[_0x8e5b('0xc')]=moment()[_0x8e5b('0xd')](_0x8e5b('0xe'));}_0x2b04c9(null,_0x1e5319);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 66c8017..1a097ff 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 _0xba60=['message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x30b057,_0x1d1505){var _0x331671=function(_0x30bcdf){while(--_0x30bcdf){_0x30b057['push'](_0x30b057['shift']());}};_0x331671(++_0x1d1505);}(_0xba60,0x15a));var _0x0ba6=function(_0x4b5c91,_0x73283d){_0x4b5c91=_0x4b5c91-0x0;var _0x596f37=_0xba60[_0x4b5c91];return _0x596f37;};'use strict';var _=require(_0x0ba6('0x0'));var util=require('util');var moment=require(_0x0ba6('0x1'));var BPromise=require(_0x0ba6('0x2'));var rs=require(_0x0ba6('0x3'));var fs=require('fs');var Redis=require(_0x0ba6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ba6('0x5'));var logger=require(_0x0ba6('0x6'))(_0x0ba6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ba6('0x8'));var client=jayson[_0x0ba6('0x9')][_0x0ba6('0xa')]({'port':0x232a});config[_0x0ba6('0xb')]=_[_0x0ba6('0xc')](config[_0x0ba6('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x0ba6('0xd')](socket);function respondWithRpcPromise(_0x4a2a9d,_0x53ff90,_0x579ff1){return new BPromise(function(_0x516397,_0x309977){return client['request'](_0x4a2a9d,_0x579ff1)[_0x0ba6('0xe')](function(_0x4dab54){logger[_0x0ba6('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x53ff90,_0x0ba6('0x10'));logger[_0x0ba6('0x11')](_0x0ba6('0x12'),_0x53ff90,_0x0ba6('0x10'),JSON[_0x0ba6('0x13')](_0x4dab54));if(_0x4dab54[_0x0ba6('0x14')]){if(_0x4dab54[_0x0ba6('0x14')][_0x0ba6('0x15')]===0x1f4){logger[_0x0ba6('0x14')](_0x0ba6('0x16'),_0x53ff90,_0x4dab54[_0x0ba6('0x14')][_0x0ba6('0x17')]);return _0x309977(_0x4dab54[_0x0ba6('0x14')][_0x0ba6('0x17')]);}logger['error'](_0x0ba6('0x16'),_0x53ff90,_0x4dab54['error'][_0x0ba6('0x17')]);return _0x516397(_0x4dab54[_0x0ba6('0x14')][_0x0ba6('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x53ff90,'request\x20sent');_0x516397(_0x4dab54[_0x0ba6('0x18')][_0x0ba6('0x17')]);}})[_0x0ba6('0x19')](function(_0x484bc8){logger[_0x0ba6('0x14')](_0x0ba6('0x16'),_0x53ff90,_0x484bc8);_0x309977(_0x484bc8);});});}exports[_0x0ba6('0x1a')]=function(_0x11e3b4){var _0x33ffc0=this;return new Promise(function(_0x2c8dae,_0x21b418){return db[_0x0ba6('0x1b')][_0x0ba6('0x1c')](_0x11e3b4[_0x0ba6('0x1d')],{'raw':_0x11e3b4[_0x0ba6('0x1e')]?_0x11e3b4[_0x0ba6('0x1e')][_0x0ba6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e3b4['options']?_0x11e3b4[_0x0ba6('0x1e')]['where']||null:null,'attributes':_0x11e3b4[_0x0ba6('0x1e')]?_0x11e3b4[_0x0ba6('0x1e')][_0x0ba6('0x20')]||null:null,'limit':_0x11e3b4['options']?_0x11e3b4[_0x0ba6('0x1e')]['limit']||null:null})[_0x0ba6('0xe')](function(_0x14ccda){logger[_0x0ba6('0xf')](_0x0ba6('0x1a'),_0x11e3b4);logger[_0x0ba6('0x11')](_0x0ba6('0x1a'),_0x11e3b4,JSON[_0x0ba6('0x13')](_0x14ccda));_0x2c8dae(_0x14ccda);})[_0x0ba6('0x19')](function(_0x76b5d8){logger[_0x0ba6('0x14')](_0x0ba6('0x1a'),_0x76b5d8['message'],_0x11e3b4);_0x21b418(_0x33ffc0[_0x0ba6('0x14')](0x1f4,_0x76b5d8[_0x0ba6('0x17')]));});});};exports[_0x0ba6('0x21')]=function(_0x524787){return new Promise(function(_0x1610ef,_0x586b8d){return db[_0x0ba6('0x1b')][_0x0ba6('0x22')]({'where':_0x524787[_0x0ba6('0x1e')]?_0x524787[_0x0ba6('0x1e')][_0x0ba6('0x23')]||null:null})[_0x0ba6('0xe')](function(_0x146c95){if(_0x146c95){return _0x146c95[_0x0ba6('0x24')](_0x524787[_0x0ba6('0x1d')][_0x0ba6('0x25')],_[_0x0ba6('0x26')](_0x524787[_0x0ba6('0x1d')],[_0x0ba6('0x25'),'id'])||{});}})[_0x0ba6('0x27')](function(_0x1571ec){logger[_0x0ba6('0xf')](_0x0ba6('0x28'),_0x524787);logger['debug'](_0x0ba6('0x28'),_0x524787,JSON[_0x0ba6('0x13')](_0x1571ec));_0x1610ef(_0x1571ec);})['catch'](function(_0x1aa6e9){logger[_0x0ba6('0x14')]('AddTags',_0x1aa6e9['message'],_0x524787);_0x586b8d(_this[_0x0ba6('0x14')](0x1f4,_0x1aa6e9[_0x0ba6('0x17')]));});});}; \ No newline at end of file +var _0xd41a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','ids','omit','spread','info','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x36d470,_0xd60712){var _0x10cb5f=function(_0x396367){while(--_0x396367){_0x36d470['push'](_0x36d470['shift']());}};_0x10cb5f(++_0xd60712);}(_0xd41a,0x17d));var _0xad41=function(_0x35d649,_0x37210f){_0x35d649=_0x35d649-0x0;var _0x541bc4=_0xd41a[_0x35d649];return _0x541bc4;};'use strict';var _=require('lodash');var util=require(_0xad41('0x0'));var moment=require(_0xad41('0x1'));var BPromise=require(_0xad41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad41('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad41('0x4'));var logger=require(_0xad41('0x5'))(_0xad41('0x6'));var config=require(_0xad41('0x7'));var jayson=require(_0xad41('0x8'));var client=jayson[_0xad41('0x9')][_0xad41('0xa')]({'port':0x232a});config[_0xad41('0xb')]=_[_0xad41('0xc')](config['redis'],{'host':_0xad41('0xd'),'port':0x18eb});var socket=require(_0xad41('0xe'))(new Redis(config[_0xad41('0xb')]));require(_0xad41('0xf'))[_0xad41('0x10')](socket);function respondWithRpcPromise(_0x479369,_0x25b3cd,_0x2851e9){return new BPromise(function(_0x15a35d,_0xa273a0){return client['request'](_0x479369,_0x2851e9)[_0xad41('0x11')](function(_0x5cbda4){logger['info'](_0xad41('0x12'),_0x25b3cd,'request\x20sent');logger[_0xad41('0x13')](_0xad41('0x14'),_0x25b3cd,_0xad41('0x15'),JSON[_0xad41('0x16')](_0x5cbda4));if(_0x5cbda4[_0xad41('0x17')]){if(_0x5cbda4[_0xad41('0x17')]['code']===0x1f4){logger[_0xad41('0x17')](_0xad41('0x12'),_0x25b3cd,_0x5cbda4['error'][_0xad41('0x18')]);return _0xa273a0(_0x5cbda4[_0xad41('0x17')][_0xad41('0x18')]);}logger[_0xad41('0x17')](_0xad41('0x12'),_0x25b3cd,_0x5cbda4['error']['message']);return _0x15a35d(_0x5cbda4[_0xad41('0x17')][_0xad41('0x18')]);}else{logger['info'](_0xad41('0x12'),_0x25b3cd,'request\x20sent');_0x15a35d(_0x5cbda4[_0xad41('0x19')]['message']);}})[_0xad41('0x1a')](function(_0x2f498a){logger['error'](_0xad41('0x12'),_0x25b3cd,_0x2f498a);_0xa273a0(_0x2f498a);});});}exports[_0xad41('0x1b')]=function(_0x1993f7){var _0x5a5f1d=this;return new Promise(function(_0x2394bd,_0x2d86ab){return db[_0xad41('0x1c')][_0xad41('0x1d')](_0x1993f7[_0xad41('0x1e')],{'raw':_0x1993f7[_0xad41('0x1f')]?_0x1993f7[_0xad41('0x1f')][_0xad41('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1993f7[_0xad41('0x1f')]?_0x1993f7[_0xad41('0x1f')]['where']||null:null,'attributes':_0x1993f7['options']?_0x1993f7[_0xad41('0x1f')][_0xad41('0x21')]||null:null,'limit':_0x1993f7[_0xad41('0x1f')]?_0x1993f7[_0xad41('0x1f')][_0xad41('0x22')]||null:null})[_0xad41('0x11')](function(_0x230e4b){logger['info'](_0xad41('0x1b'),_0x1993f7);logger[_0xad41('0x13')]('UpdateWhatsappInteraction',_0x1993f7,JSON[_0xad41('0x16')](_0x230e4b));_0x2394bd(_0x230e4b);})[_0xad41('0x1a')](function(_0x1bfe8f){logger[_0xad41('0x17')]('UpdateWhatsappInteraction',_0x1bfe8f['message'],_0x1993f7);_0x2d86ab(_0x5a5f1d[_0xad41('0x17')](0x1f4,_0x1bfe8f[_0xad41('0x18')]));});});};exports[_0xad41('0x23')]=function(_0x2836db){return new Promise(function(_0x1fbd8d,_0x79451f){return db[_0xad41('0x1c')][_0xad41('0x24')]({'where':_0x2836db[_0xad41('0x1f')]?_0x2836db[_0xad41('0x1f')][_0xad41('0x25')]||null:null})[_0xad41('0x11')](function(_0x1c83dc){if(_0x1c83dc){return _0x1c83dc['addTags'](_0x2836db[_0xad41('0x1e')][_0xad41('0x26')],_[_0xad41('0x27')](_0x2836db[_0xad41('0x1e')],[_0xad41('0x26'),'id'])||{});}})[_0xad41('0x28')](function(_0x54d04a){logger[_0xad41('0x29')]('AddTags',_0x2836db);logger[_0xad41('0x13')](_0xad41('0x2a'),_0x2836db,JSON[_0xad41('0x16')](_0x54d04a));_0x1fbd8d(_0x54d04a);})['catch'](function(_0x2f2c5a){logger[_0xad41('0x17')](_0xad41('0x2a'),_0x2f2c5a['message'],_0x2836db);_0x79451f(_this['error'](0x1f4,_0x2f2c5a[_0xad41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bfa6073..2c48db7 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 _0xbb00=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x142b6d,_0x23672c){var _0x33a18f=function(_0x46783b){while(--_0x46783b){_0x142b6d['push'](_0x142b6d['shift']());}};_0x33a18f(++_0x23672c);}(_0xbb00,0xa4));var _0x0bb0=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0xbb00[_0x3c4087];return _0x23ad1f;};'use strict';var WhatsappInteractionEvents=require(_0x0bb0('0x0'));var events=[_0x0bb0('0x1'),_0x0bb0('0x2'),_0x0bb0('0x3')];function createListener(_0x105342,_0x1cd164){return function(_0x538265){_0x1cd164[_0x0bb0('0x4')](_0x105342,_0x538265);};}function removeListener(_0x1c14d2,_0x5f57e6){return function(){WhatsappInteractionEvents[_0x0bb0('0x5')](_0x1c14d2,_0x5f57e6);};}exports['register']=function(_0xa900f){for(var _0x59a075=0x0,_0x204ff3=events[_0x0bb0('0x6')];_0x59a075<_0x204ff3;_0x59a075++){var _0x275810=events[_0x59a075];var _0x6759d4=createListener(_0x0bb0('0x7')+_0x275810,_0xa900f);WhatsappInteractionEvents['on'](_0x275810,_0x6759d4);}}; \ No newline at end of file +var _0xc8c2=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5ea98f,_0x78ec2c){var _0x5ad1f0=function(_0x1b1f43){while(--_0x1b1f43){_0x5ea98f['push'](_0x5ea98f['shift']());}};_0x5ad1f0(++_0x78ec2c);}(_0xc8c2,0x1bc));var _0x2c8c=function(_0x4f7786,_0x4ffc01){_0x4f7786=_0x4f7786-0x0;var _0x42fbb9=_0xc8c2[_0x4f7786];return _0x42fbb9;};'use strict';var WhatsappInteractionEvents=require(_0x2c8c('0x0'));var events=[_0x2c8c('0x1'),_0x2c8c('0x2'),_0x2c8c('0x3')];function createListener(_0x4a7214,_0x4c2f96){return function(_0x56f3b){_0x4c2f96[_0x2c8c('0x4')](_0x4a7214,_0x56f3b);};}function removeListener(_0x546258,_0x51d575){return function(){WhatsappInteractionEvents[_0x2c8c('0x5')](_0x546258,_0x51d575);};}exports[_0x2c8c('0x6')]=function(_0x4c7ba4){for(var _0x191477=0x0,_0x529b18=events[_0x2c8c('0x7')];_0x191477<_0x529b18;_0x191477++){var _0x419034=events[_0x191477];var _0x52e6d0=createListener(_0x2c8c('0x8')+_0x419034,_0x4c7ba4);WhatsappInteractionEvents['on'](_0x419034,_0x52e6d0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7e92b2a..28ebbb8 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 _0xc4de=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','status','put','update','/:id/accept','accept','reject'];(function(_0x54839c,_0x26a656){var _0x25e07b=function(_0x152abb){while(--_0x152abb){_0x54839c['push'](_0x54839c['shift']());}};_0x25e07b(++_0x26a656);}(_0xc4de,0x9f));var _0xec4d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xc4de[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0xec4d('0x0'));var util=require(_0xec4d('0x1'));var path=require('path');var timeout=require(_0xec4d('0x2'));var express=require(_0xec4d('0x3'));var router=express['Router']();var fs_extra=require(_0xec4d('0x4'));var auth=require(_0xec4d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec4d('0x6'));router[_0xec4d('0x7')]('/',auth[_0xec4d('0x8')](),controller[_0xec4d('0x9')]);router[_0xec4d('0x7')](_0xec4d('0xa'),auth[_0xec4d('0x8')](),controller[_0xec4d('0xb')]);router[_0xec4d('0x7')](_0xec4d('0xc'),auth[_0xec4d('0x8')](),controller[_0xec4d('0xd')]);router[_0xec4d('0xe')]('/',auth['isAuthenticated'](),interaction[_0xec4d('0xf')]('whatsapp',_0xec4d('0x10')),controller['create']);router[_0xec4d('0xe')]('/:id/status',controller[_0xec4d('0x11')]);router[_0xec4d('0x12')](_0xec4d('0xc'),auth[_0xec4d('0x8')](),controller[_0xec4d('0x13')]);router[_0xec4d('0x12')](_0xec4d('0x14'),auth['isAuthenticated'](),controller[_0xec4d('0x15')]);router[_0xec4d('0x12')]('/:id/reject',auth[_0xec4d('0x8')](),controller[_0xec4d('0x16')]);router[_0xec4d('0x17')]('/:id',auth[_0xec4d('0x8')](),controller[_0xec4d('0x18')]);module[_0xec4d('0x19')]=router; \ No newline at end of file +var _0xe98a=['update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','put'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xe98a,0x18e));var _0xae98=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0xe98a[_0x462fe4];return _0x82b23a;};'use strict';var multer=require(_0xae98('0x0'));var util=require(_0xae98('0x1'));var path=require(_0xae98('0x2'));var timeout=require(_0xae98('0x3'));var express=require(_0xae98('0x4'));var router=express[_0xae98('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xae98('0x6'));var interaction=require(_0xae98('0x7'));var config=require(_0xae98('0x8'));var controller=require(_0xae98('0x9'));router[_0xae98('0xa')]('/',auth[_0xae98('0xb')](),controller[_0xae98('0xc')]);router['get'](_0xae98('0xd'),auth[_0xae98('0xb')](),controller['describe']);router[_0xae98('0xa')](_0xae98('0xe'),auth[_0xae98('0xb')](),controller[_0xae98('0xf')]);router[_0xae98('0x10')]('/',auth[_0xae98('0xb')](),interaction['tracked'](_0xae98('0x11'),_0xae98('0x12')),controller[_0xae98('0x13')]);router['post'](_0xae98('0x14'),controller['status']);router[_0xae98('0x15')]('/:id',auth[_0xae98('0xb')](),controller[_0xae98('0x16')]);router[_0xae98('0x15')](_0xae98('0x17'),auth[_0xae98('0xb')](),controller['accept']);router[_0xae98('0x15')](_0xae98('0x18'),auth[_0xae98('0xb')](),controller['reject']);router[_0xae98('0x19')](_0xae98('0xe'),auth[_0xae98('0xb')](),controller[_0xae98('0x1a')]);module[_0xae98('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 2ce27e0..44a393d 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 _0xfb30=['exports','medium','BOOLEAN','out','STRING','DATE','TEXT','sequelize'];(function(_0x541c90,_0x53c0da){var _0x1ae4f9=function(_0x22059e){while(--_0x22059e){_0x541c90['push'](_0x541c90['shift']());}};_0x1ae4f9(++_0x53c0da);}(_0xfb30,0x167));var _0x0fb3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb30[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x0fb3('0x0'));module[_0x0fb3('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0fb3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0fb3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x0fb3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0fb3('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0fb3('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0fb3('0x5')]},'providerResponse':{'type':Sequelize[_0x0fb3('0x7')]}}; \ No newline at end of file +var _0x5996=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0xa01961,_0x26eeb8){var _0x20e4f7=function(_0x25409f){while(--_0x25409f){_0xa01961['push'](_0xa01961['shift']());}};_0x20e4f7(++_0x26eeb8);}(_0x5996,0x1c9));var _0x6599=function(_0x5ac30f,_0x413ed5){_0x5ac30f=_0x5ac30f-0x0;var _0x19ce25=_0x5996[_0x5ac30f];return _0x19ce25;};'use strict';var Sequelize=require(_0x6599('0x0'));module[_0x6599('0x1')]={'body':{'type':Sequelize[_0x6599('0x2')](_0x6599('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6599('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6599('0x5')]('in',_0x6599('0x6')),'defaultValue':_0x6599('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6599('0x7')](0xbe)},'phone':{'type':Sequelize[_0x6599('0x7')]},'readAt':{'type':Sequelize[_0x6599('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6599('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9c00f35..7b7250a 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 _0xfa37=['sequelize','SELECT','User','agent','interface','channel','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','contact','fullname','email','internal','SIP/%s','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','name','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','includeAll','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','read1stAt','[WHATSAPPMESSAGE: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'];(function(_0x8ea2d1,_0x373583){var _0x4cb6db=function(_0x1e802b){while(--_0x1e802b){_0x8ea2d1['push'](_0x8ea2d1['shift']());}};_0x4cb6db(++_0x373583);}(_0xfa37,0x128));var _0x7fa3=function(_0x591796,_0x4a1624){_0x591796=_0x591796-0x0;var _0x3ed4cf=_0xfa37[_0x591796];return _0x3ed4cf;};'use strict';var emlformat=require(_0x7fa3('0x0'));var rimraf=require(_0x7fa3('0x1'));var zipdir=require(_0x7fa3('0x2'));var jsonpatch=require(_0x7fa3('0x3'));var rp=require(_0x7fa3('0x4'));var moment=require(_0x7fa3('0x5'));var BPromise=require(_0x7fa3('0x6'));var Mustache=require('mustache');var util=require(_0x7fa3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7fa3('0x8'));var ejs=require(_0x7fa3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fa3('0xa'));var squel=require('squel');var crypto=require(_0x7fa3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fa3('0xc'));var toCsv=require(_0x7fa3('0x8'));var querystring=require('querystring');var Papa=require(_0x7fa3('0xd'));var Redis=require(_0x7fa3('0xe'));var authService=require(_0x7fa3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7fa3('0x10'));var hardwareService=require(_0x7fa3('0x11'));var logger=require(_0x7fa3('0x12'))('api');var utils=require(_0x7fa3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7fa3('0x14'));var db=require(_0x7fa3('0x15'))['db'];config[_0x7fa3('0x16')]=_[_0x7fa3('0x17')](config[_0x7fa3('0x16')],{'host':_0x7fa3('0x18'),'port':0x18eb});var socket=require(_0x7fa3('0x19'))(new Redis(config['redis']));require(_0x7fa3('0x1a'))[_0x7fa3('0x1b')](socket);var jayson=require(_0x7fa3('0x1c'));var client=jayson[_0x7fa3('0x1d')][_0x7fa3('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7fa3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xefaadb,_0x5be0da,_0x4c0818,_0x13eb69){return new BPromise(function(_0x5c93c2,_0x915f28){var _0x9477e9=_0x13eb69||client;return _0x9477e9[_0x7fa3('0x1f')](_0xefaadb,_0x4c0818)[_0x7fa3('0x20')](function(_0x10bd2c){logger[_0x7fa3('0x21')](_0x7fa3('0x22'),_0x5be0da,_0x7fa3('0x23'));logger[_0x7fa3('0x24')](_0x7fa3('0x25'),_0x5be0da,'request\x20sent',JSON[_0x7fa3('0x26')](_0x10bd2c));if(_0x10bd2c[_0x7fa3('0x27')]){if(_0x10bd2c['error']['code']===0x1f4){logger[_0x7fa3('0x27')](_0x7fa3('0x22'),_0x5be0da,_0x10bd2c[_0x7fa3('0x27')][_0x7fa3('0x28')]);return _0x915f28(_0x10bd2c['error'][_0x7fa3('0x28')]);}logger[_0x7fa3('0x27')](_0x7fa3('0x22'),_0x5be0da,_0x10bd2c[_0x7fa3('0x27')][_0x7fa3('0x28')]);return _0x5c93c2(_0x10bd2c['error'][_0x7fa3('0x28')]);}else{logger['info'](_0x7fa3('0x22'),_0x5be0da,_0x7fa3('0x23'));_0x5c93c2(_0x10bd2c[_0x7fa3('0x29')]['message']);}})[_0x7fa3('0x2a')](function(_0xf0c986){logger[_0x7fa3('0x27')](_0x7fa3('0x22'),_0x5be0da,_0xf0c986);_0x915f28(_0xf0c986);});});}function respondWithStatusCode(_0xdaf64c,_0x571843){_0x571843=_0x571843||0xcc;return function(_0x7b0a1e){if(_0x7b0a1e){return _0xdaf64c[_0x7fa3('0x2b')](_0x571843);}return _0xdaf64c[_0x7fa3('0x2c')](_0x571843)[_0x7fa3('0x2d')]();};}function respondWithResult(_0x429584,_0x3bfd32){_0x3bfd32=_0x3bfd32||0xc8;return function(_0x1fd0b9){if(_0x1fd0b9){return _0x429584['status'](_0x3bfd32)[_0x7fa3('0x2e')](_0x1fd0b9);}};}function respondWithFilteredResult(_0x3e1dc7,_0x444de6){return function(_0x2887f9){if(_0x2887f9){var _0x4fb1d7=typeof _0x444de6[_0x7fa3('0x2f')]===_0x7fa3('0x30')&&typeof _0x444de6['limit']==='undefined';var _0x59cf87=_0x2887f9['count'];var _0x30fe46=_0x4fb1d7?0x0:_0x444de6['offset'];var _0x4dbfff=_0x4fb1d7?_0x2887f9[_0x7fa3('0x31')]:_0x444de6[_0x7fa3('0x2f')]+_0x444de6[_0x7fa3('0x32')];var _0x2c0cfb;if(_0x4dbfff>=_0x59cf87){_0x4dbfff=_0x59cf87;_0x2c0cfb=0xc8;}else{_0x2c0cfb=0xce;}_0x3e1dc7[_0x7fa3('0x2c')](_0x2c0cfb);return _0x3e1dc7[_0x7fa3('0x33')](_0x7fa3('0x34'),_0x30fe46+'-'+_0x4dbfff+'/'+_0x59cf87)['json'](_0x2887f9);}return null;};}function patchUpdates(_0x17428b){return function(_0x2b89ab){try{jsonpatch[_0x7fa3('0x35')](_0x2b89ab,_0x17428b,!![]);}catch(_0x532f67){return BPromise[_0x7fa3('0x36')](_0x532f67);}return _0x2b89ab['save']();};}function saveUpdates(_0x5d3be6,_0x129e76){return function(_0x4c4788){if(_0x4c4788){return _0x4c4788['update'](_0x5d3be6)[_0x7fa3('0x20')](function(_0x2bd6d2){return _0x2bd6d2;});}return null;};}function removeEntity(_0x3bb792,_0x5541a4){return function(_0x49714d){if(_0x49714d){return _0x49714d[_0x7fa3('0x37')]()[_0x7fa3('0x20')](function(){_0x3bb792['status'](0xcc)[_0x7fa3('0x2d')]();});}};}function handleEntityNotFound(_0x544855,_0x59b5fe){return function(_0x43c553){if(!_0x43c553){_0x544855['sendStatus'](0x194);}return _0x43c553;};}function handleError(_0x226019,_0x26c29a){_0x26c29a=_0x26c29a||0x1f4;return function(_0x24b655){logger['error'](_0x24b655['stack']);if(_0x24b655['name']){delete _0x24b655[_0x7fa3('0x38')];}_0x226019[_0x7fa3('0x2c')](_0x26c29a)['send'](_0x24b655);};}exports[_0x7fa3('0x39')]=function(_0xf5cc16,_0x53a342){var _0x26c28e={},_0x178279={},_0x950e30={'count':0x0,'rows':[]};var _0x3709fc=_[_0x7fa3('0x3a')](db[_0x7fa3('0x3b')][_0x7fa3('0x3c')],function(_0x2e2076){return{'name':_0x2e2076['fieldName'],'type':_0x2e2076[_0x7fa3('0x3d')][_0x7fa3('0x3e')]};});_0x178279[_0x7fa3('0x3f')]=_[_0x7fa3('0x3a')](_0x3709fc,_0x7fa3('0x38'));_0x178279[_0x7fa3('0x40')]=_[_0x7fa3('0x41')](_0xf5cc16['query']);_0x178279[_0x7fa3('0x42')]=_['intersection'](_0x178279[_0x7fa3('0x3f')],_0x178279['query']);_0x26c28e[_0x7fa3('0x43')]=_[_0x7fa3('0x44')](_0x178279[_0x7fa3('0x3f')],qs[_0x7fa3('0x45')](_0xf5cc16[_0x7fa3('0x40')]['fields']));_0x26c28e[_0x7fa3('0x43')]=_0x26c28e[_0x7fa3('0x43')][_0x7fa3('0x46')]?_0x26c28e[_0x7fa3('0x43')]:_0x178279['model'];if(!_0xf5cc16[_0x7fa3('0x40')][_0x7fa3('0x47')](_0x7fa3('0x48'))){_0x26c28e[_0x7fa3('0x32')]=qs['limit'](_0xf5cc16[_0x7fa3('0x40')][_0x7fa3('0x32')]);_0x26c28e[_0x7fa3('0x2f')]=qs[_0x7fa3('0x2f')](_0xf5cc16[_0x7fa3('0x40')][_0x7fa3('0x2f')]);}_0x26c28e['order']=qs[_0x7fa3('0x49')](_0xf5cc16[_0x7fa3('0x40')][_0x7fa3('0x49')]);_0x26c28e[_0x7fa3('0x4a')]=qs[_0x7fa3('0x42')](_[_0x7fa3('0x4b')](_0xf5cc16[_0x7fa3('0x40')],_0x178279[_0x7fa3('0x42')]),_0x3709fc);if(_0xf5cc16['query'][_0x7fa3('0x4c')]){_0x26c28e[_0x7fa3('0x4a')]=_['merge'](_0x26c28e['where'],{'$or':_[_0x7fa3('0x3a')](_0x3709fc,function(_0x36cae4){if(_0x36cae4[_0x7fa3('0x3d')]!==_0x7fa3('0x4d')){var _0x1d0eaf={};_0x1d0eaf[_0x36cae4[_0x7fa3('0x38')]]={'$like':'%'+_0xf5cc16['query'][_0x7fa3('0x4c')]+'%'};return _0x1d0eaf;}})});}_0x26c28e=_[_0x7fa3('0x4e')]({},_0x26c28e,_0xf5cc16['options']);var _0x533e37={'where':_0x26c28e[_0x7fa3('0x4a')]};return db[_0x7fa3('0x3b')][_0x7fa3('0x31')](_0x533e37)[_0x7fa3('0x20')](function(_0x3b4773){_0x950e30[_0x7fa3('0x31')]=_0x3b4773;if(_0xf5cc16['query']['includeAll']){_0x26c28e[_0x7fa3('0x4f')]=[{'all':!![]}];}return db[_0x7fa3('0x3b')][_0x7fa3('0x50')](_0x26c28e);})[_0x7fa3('0x20')](function(_0x19ab37){_0x950e30[_0x7fa3('0x51')]=_0x19ab37;return _0x950e30;})['then'](respondWithFilteredResult(_0x53a342,_0x26c28e))[_0x7fa3('0x2a')](handleError(_0x53a342,null));};exports[_0x7fa3('0x52')]=function(_0x346fea,_0x24cef7){var _0x1d314e={'raw':!![],'where':{'id':_0x346fea[_0x7fa3('0x53')]['id']}},_0x49dcad={};_0x49dcad['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x49dcad['query']=_['keys'](_0x346fea[_0x7fa3('0x40')]);_0x49dcad['filters']=_[_0x7fa3('0x44')](_0x49dcad[_0x7fa3('0x3f')],_0x49dcad['query']);_0x1d314e['attributes']=_[_0x7fa3('0x44')](_0x49dcad[_0x7fa3('0x3f')],qs[_0x7fa3('0x45')](_0x346fea[_0x7fa3('0x40')]['fields']));_0x1d314e[_0x7fa3('0x43')]=_0x1d314e['attributes'][_0x7fa3('0x46')]?_0x1d314e[_0x7fa3('0x43')]:_0x49dcad[_0x7fa3('0x3f')];if(_0x346fea[_0x7fa3('0x40')][_0x7fa3('0x54')]){_0x1d314e[_0x7fa3('0x4f')]=[{'all':!![]}];}_0x1d314e=_[_0x7fa3('0x4e')]({},_0x1d314e,_0x346fea['options']);return db['WhatsappMessage'][_0x7fa3('0x55')](_0x1d314e)[_0x7fa3('0x20')](handleEntityNotFound(_0x24cef7,null))[_0x7fa3('0x20')](respondWithResult(_0x24cef7,null))['catch'](handleError(_0x24cef7,null));};exports[_0x7fa3('0x56')]=function(_0x446c14,_0x6af115){return db[_0x7fa3('0x3b')][_0x7fa3('0x56')](_0x446c14['body'],{})['then'](respondWithResult(_0x6af115,0xc9))[_0x7fa3('0x2a')](handleError(_0x6af115,null));};exports[_0x7fa3('0x57')]=function(_0x4ee9c1,_0x1da2de){if(_0x4ee9c1[_0x7fa3('0x58')]['id']){delete _0x4ee9c1[_0x7fa3('0x58')]['id'];}return db[_0x7fa3('0x3b')][_0x7fa3('0x55')]({'where':{'id':_0x4ee9c1[_0x7fa3('0x53')]['id']}})[_0x7fa3('0x20')](handleEntityNotFound(_0x1da2de,null))['then'](saveUpdates(_0x4ee9c1[_0x7fa3('0x58')],null))[_0x7fa3('0x20')](respondWithResult(_0x1da2de,null))['catch'](handleError(_0x1da2de,null));};exports[_0x7fa3('0x37')]=function(_0x145796,_0x5c7dcb){return db['WhatsappMessage'][_0x7fa3('0x55')]({'where':{'id':_0x145796[_0x7fa3('0x53')]['id']}})[_0x7fa3('0x20')](handleEntityNotFound(_0x5c7dcb,null))[_0x7fa3('0x20')](removeEntity(_0x5c7dcb,null))[_0x7fa3('0x2a')](handleError(_0x5c7dcb,null));};exports[_0x7fa3('0x59')]=function(_0x414d8f,_0x745d69){return db[_0x7fa3('0x3b')]['describe']()['then'](respondWithResult(_0x745d69,null))[_0x7fa3('0x2a')](handleError(_0x745d69,null));};var interaction_log=require(_0x7fa3('0x12'))(_0x7fa3('0x5a'));exports[_0x7fa3('0x5b')]=function(_0x5e89ee,_0x581295,_0x20e113){var _0x280d31={'agent':{},'channel':_0x7fa3('0x5c')};if(_0x5e89ee[_0x7fa3('0x58')]['id']){delete _0x5e89ee['body']['id'];}_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x5d')]=!![];_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x5e')]=moment()[_0x7fa3('0x5f')](_0x7fa3('0x60'));_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x61')]=_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x61')]||_0x5e89ee[_0x7fa3('0x62')]['id'];_0x280d31['agent']['id']=_0x5e89ee['body'][_0x7fa3('0x61')];return db[_0x7fa3('0x3b')][_0x7fa3('0x55')]({'where':{'id':_0x5e89ee['params']['id'],'UserId':null}})[_0x7fa3('0x20')](handleEntityNotFound(_0x581295,null))['then'](saveUpdates(_0x5e89ee['body'],null))[_0x7fa3('0x20')](function(_0x53decf){if(_0x53decf){_0x280d31[_0x7fa3('0x28')]=_0x53decf[_0x7fa3('0x63')]({'plain':!![]});return db[_0x7fa3('0x64')][_0x7fa3('0x55')]({'where':{'id':_0x53decf['WhatsappInteractionId']}});}return null;})[_0x7fa3('0x20')](handleEntityNotFound(_0x581295,null))[_0x7fa3('0x20')](function(_0xd908b6){if(_0xd908b6){return _0xd908b6[_0x7fa3('0x57')]({'UserId':_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x61')],'read1stAt':_['isNil'](_0xd908b6[_0x7fa3('0x65')])?moment()[_0x7fa3('0x5f')](_0x7fa3('0x60')):undefined});}return null;})['then'](function(_0x3a7618){if(_0x3a7618){_0x280d31['interaction']=_0x3a7618[_0x7fa3('0x63')]({'plain':!![]});interaction_log[_0x7fa3('0x21')](_0x7fa3('0x66'),_0x5e89ee['user']['id'],_0x5e89ee[_0x7fa3('0x62')][_0x7fa3('0x38')],_0x5e89ee[_0x7fa3('0x62')][_0x7fa3('0x67')],_0x280d31[_0x7fa3('0x68')]['id'],_0x5e89ee['body']?JSON[_0x7fa3('0x26')](_0x5e89ee[_0x7fa3('0x58')]):_0x7fa3('0x69'));return respondWithRpcPromise(_0x7fa3('0x6a'),'acceptMessage',_0x280d31);}return null;})[_0x7fa3('0x20')](function(_0x4a4b6d){var _0x3b34b6=_0x7fa3('0x6b')+_0x4a4b6d['message'][_0x7fa3('0x6c')];return db[_0x7fa3('0x6d')]['query'](_0x3b34b6,{'type':db['Sequelize']['QueryTypes'][_0x7fa3('0x6e')],'raw':!![]})[_0x7fa3('0x20')](function(_0x317ba4){return _0x317ba4;});})[_0x7fa3('0x20')](function(_0x57dfee){if(_0x57dfee){_0x280d31[_0x7fa3('0x28')]['contact']=_0x57dfee[0x0];if(!_0x5e89ee[_0x7fa3('0x58')][_0x7fa3('0x61')])return;return db[_0x7fa3('0x6f')][_0x7fa3('0x55')]({'where':{'id':_0x5e89ee['body']['UserId'],'role':_0x7fa3('0x70')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x7fa3('0x20')](function(_0x13faff){if(!_0x13faff)return null;_0x280d31[_0x7fa3('0x28')][_0x7fa3('0x70')]=_0x13faff;return _0x280d31;})[_0x7fa3('0x20')](function(_0x4dca8b){if(_0x4dca8b){if(_0x5e89ee[_0x7fa3('0x58')]['manual']){_0x280d31[_0x7fa3('0x28')][_0x7fa3('0x71')]=util[_0x7fa3('0x5f')]('SIP/%s',_0x5e89ee[_0x7fa3('0x62')][_0x7fa3('0x38')]);_0x280d31[_0x7fa3('0x28')]['channel']=_0x280d31[_0x7fa3('0x72')];_0x280d31[_0x7fa3('0x28')]['motionChannel']=_0x280d31[_0x7fa3('0x72')];_0x280d31[_0x7fa3('0x28')]['event']=_0x7fa3('0x5b');return respondWithRpcPromise(_0x7fa3('0x73'),'EventManager',{'event':_0x7fa3('0x74'),'message':_0x280d31[_0x7fa3('0x28')]},client9002)[_0x7fa3('0x20')](function(){return _0x280d31;});}return _0x280d31;}return null;})[_0x7fa3('0x20')](respondWithResult(_0x581295,null))[_0x7fa3('0x2a')](handleError(_0x581295,null));};var interaction_log=require('../../config/logger')(_0x7fa3('0x5a'));exports[_0x7fa3('0x36')]=function(_0x47281d,_0x3ab0a8,_0x16a727){var _0x548f4f={'agent':{},'channel':'whatsapp'};if(_0x47281d[_0x7fa3('0x58')]['id']){delete _0x47281d[_0x7fa3('0x58')]['id'];}_0x47281d[_0x7fa3('0x58')][_0x7fa3('0x61')]=_0x47281d['body'][_0x7fa3('0x61')]||_0x47281d['user']['id'];_0x548f4f['agent']['id']=_0x47281d[_0x7fa3('0x58')][_0x7fa3('0x61')];return db[_0x7fa3('0x3b')][_0x7fa3('0x55')]({'where':{'id':_0x47281d[_0x7fa3('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ab0a8,null))[_0x7fa3('0x20')](function(_0x473893){if(_0x473893){_0x548f4f['message']=_0x473893[_0x7fa3('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x7fa3('0x55')]({'where':{'id':_0x473893[_0x7fa3('0x75')]}});}return null;})[_0x7fa3('0x20')](handleEntityNotFound(_0x3ab0a8,null))[_0x7fa3('0x20')](function(_0x67c59d){if(_0x67c59d){_0x548f4f[_0x7fa3('0x68')]=_0x67c59d[_0x7fa3('0x63')]({'plain':!![]});interaction_log['info'](_0x7fa3('0x76'),_0x47281d[_0x7fa3('0x62')]['id'],_0x47281d['user'][_0x7fa3('0x38')],_0x47281d['user']['role'],_0x548f4f[_0x7fa3('0x68')]['id'],_0x47281d['body']?JSON[_0x7fa3('0x26')](_0x47281d[_0x7fa3('0x58')]):'null');return respondWithRpcPromise(_0x7fa3('0x77'),'rejectMessage',_0x548f4f);}return null;})['then'](function(_0x2fbff0){var _0x350ba8=_0x7fa3('0x6b')+_0x2fbff0[_0x7fa3('0x28')][_0x7fa3('0x6c')];return db[_0x7fa3('0x6d')][_0x7fa3('0x40')](_0x350ba8,{'type':db['Sequelize'][_0x7fa3('0x78')]['SELECT'],'raw':!![]})[_0x7fa3('0x20')](function(_0x2fd142){return _0x2fd142;});})['then'](function(_0x51e8b0){if(_0x51e8b0){_0x548f4f['message'][_0x7fa3('0x79')]=_0x51e8b0[0x0];if(!_0x47281d[_0x7fa3('0x58')][_0x7fa3('0x61')])return;return db[_0x7fa3('0x6f')][_0x7fa3('0x55')]({'where':{'id':_0x47281d[_0x7fa3('0x58')][_0x7fa3('0x61')],'role':_0x7fa3('0x70')},'attributes':['id','name',_0x7fa3('0x7a'),_0x7fa3('0x7b'),_0x7fa3('0x7c')],'raw':!![]});}return null;})[_0x7fa3('0x20')](function(_0x2b9c7e){if(!_0x2b9c7e)return null;_0x548f4f[_0x7fa3('0x28')][_0x7fa3('0x70')]=_0x2b9c7e;return _0x548f4f;})['then'](function(_0x7797c9){if(_0x7797c9){_0x7797c9[_0x7fa3('0x28')][_0x7fa3('0x71')]=util['format'](_0x7fa3('0x7d'),_0x47281d[_0x7fa3('0x62')][_0x7fa3('0x38')]);_0x7797c9[_0x7fa3('0x28')][_0x7fa3('0x72')]=_0x548f4f[_0x7fa3('0x72')];_0x7797c9[_0x7fa3('0x28')][_0x7fa3('0x7e')]=_0x548f4f['channel'];_0x7797c9['message']['event']=_0x7fa3('0x36');respondWithRpcPromise('EventManager',_0x7fa3('0x73'),{'event':_0x7fa3('0x7f'),'message':_0x7797c9[_0x7fa3('0x28')]},client9002);return _0x548f4f;}return null;})['then'](respondWithResult(_0x3ab0a8,null))[_0x7fa3('0x2a')](handleError(_0x3ab0a8,null));};exports[_0x7fa3('0x2c')]=function(_0x2d1908,_0x1b65ab,_0x4cbe8d){if(_0x2d1908[_0x7fa3('0x58')]['id']){delete _0x2d1908['body']['id'];}var _0x1841b;return db['WhatsappMessage']['find']({'where':{'id':_0x2d1908['params']['id']}})['then'](handleEntityNotFound(_0x1b65ab,null))['then'](function(_0x30f6ee){if(_0x30f6ee){_0x1841b=_0x30f6ee;return db[_0x7fa3('0x80')]['find']({'where':{'id':_0x30f6ee[_0x7fa3('0x81')]}});}})[_0x7fa3('0x20')](handleEntityNotFound(_0x1b65ab,null))[_0x7fa3('0x20')](function(_0x418078){if(_0x418078){logger[_0x7fa3('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x7fa3('0x2c'),'received\x20delivery\x20report\x20from',_0x418078['type'],util[_0x7fa3('0x82')](_0x2d1908['body'],{'showHidden':![],'depth':null}));switch(_0x418078[_0x7fa3('0x3d')]){case _0x7fa3('0x83'):if(_0x2d1908[_0x7fa3('0x58')][_0x7fa3('0x84')]&&_0x2d1908['body'][_0x7fa3('0x84')]===_0x1841b[_0x7fa3('0x85')]&&_0x2d1908[_0x7fa3('0x58')]['MessageStatus']&&_0x2d1908[_0x7fa3('0x58')]['MessageStatus']===_0x7fa3('0x5d')){return _0x1841b[_0x7fa3('0x57')]({'read':!![]});}else{logger[_0x7fa3('0x27')](_0x7fa3('0x86'),_0x7fa3('0x2c'),_0x7fa3('0x83'),util['inspect'](_0x2d1908['body'],{'showHidden':![],'depth':null}));}break;}return _0x1841b;}})[_0x7fa3('0x20')](respondWithResult(_0x1b65ab,null))[_0x7fa3('0x2a')](handleError(_0x1b65ab,null));}; \ No newline at end of file +var _0xb1f9=['describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','channel','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','WhatsappMessage','includeAll','include','rows','params','keys','options','create','body','update','find'];(function(_0x40a85a,_0x5393c8){var _0x4c1213=function(_0x540e3c){while(--_0x540e3c){_0x40a85a['push'](_0x40a85a['shift']());}};_0x4c1213(++_0x5393c8);}(_0xb1f9,0x1e3));var _0x9b1f=function(_0xb7dd5c,_0x14bcff){_0xb7dd5c=_0xb7dd5c-0x0;var _0x1442b3=_0xb1f9[_0xb7dd5c];return _0x1442b3;};'use strict';var emlformat=require(_0x9b1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9b1f('0x2'));var BPromise=require(_0x9b1f('0x3'));var Mustache=require(_0x9b1f('0x4'));var util=require(_0x9b1f('0x5'));var path=require(_0x9b1f('0x6'));var sox=require(_0x9b1f('0x7'));var csv=require(_0x9b1f('0x8'));var ejs=require(_0x9b1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9b1f('0xa'));var _=require(_0x9b1f('0xb'));var squel=require('squel');var crypto=require(_0x9b1f('0xc'));var jsforce=require(_0x9b1f('0xd'));var deskjs=require(_0x9b1f('0xe'));var toCsv=require(_0x9b1f('0x8'));var querystring=require(_0x9b1f('0xf'));var Papa=require(_0x9b1f('0x10'));var Redis=require(_0x9b1f('0x11'));var authService=require(_0x9b1f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9b1f('0x13'));var hardwareService=require(_0x9b1f('0x14'));var logger=require(_0x9b1f('0x15'))(_0x9b1f('0x16'));var utils=require(_0x9b1f('0x17'));var config=require(_0x9b1f('0x18'));var licenseUtil=require(_0x9b1f('0x19'));var db=require('../../mysqldb')['db'];config[_0x9b1f('0x1a')]=_[_0x9b1f('0x1b')](config[_0x9b1f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b1f('0x1c'))(new Redis(config[_0x9b1f('0x1a')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9b1f('0x1d')][_0x9b1f('0x1e')]({'port':0x232c});var client9002=jayson[_0x9b1f('0x1d')][_0x9b1f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2ba691,_0x2c28eb,_0x178813,_0x5dba7e){return new BPromise(function(_0x3de0bd,_0x255b35){var _0x25f98b=_0x5dba7e||client;return _0x25f98b[_0x9b1f('0x1f')](_0x2ba691,_0x178813)['then'](function(_0x526595){logger[_0x9b1f('0x20')](_0x9b1f('0x21'),_0x2c28eb,'request\x20sent');logger['debug'](_0x9b1f('0x22'),_0x2c28eb,_0x9b1f('0x23'),JSON[_0x9b1f('0x24')](_0x526595));if(_0x526595['error']){if(_0x526595['error'][_0x9b1f('0x25')]===0x1f4){logger[_0x9b1f('0x26')](_0x9b1f('0x21'),_0x2c28eb,_0x526595[_0x9b1f('0x26')]['message']);return _0x255b35(_0x526595[_0x9b1f('0x26')]['message']);}logger[_0x9b1f('0x26')](_0x9b1f('0x21'),_0x2c28eb,_0x526595[_0x9b1f('0x26')][_0x9b1f('0x27')]);return _0x3de0bd(_0x526595[_0x9b1f('0x26')][_0x9b1f('0x27')]);}else{logger[_0x9b1f('0x20')](_0x9b1f('0x21'),_0x2c28eb,_0x9b1f('0x23'));_0x3de0bd(_0x526595[_0x9b1f('0x28')]['message']);}})[_0x9b1f('0x29')](function(_0xa6f394){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2c28eb,_0xa6f394);_0x255b35(_0xa6f394);});});}function respondWithStatusCode(_0x5cf4ab,_0x3a797b){_0x3a797b=_0x3a797b||0xcc;return function(_0x5dbdba){if(_0x5dbdba){return _0x5cf4ab[_0x9b1f('0x2a')](_0x3a797b);}return _0x5cf4ab[_0x9b1f('0x2b')](_0x3a797b)['end']();};}function respondWithResult(_0x3d9aa0,_0x1994db){_0x1994db=_0x1994db||0xc8;return function(_0x294c1b){if(_0x294c1b){return _0x3d9aa0[_0x9b1f('0x2b')](_0x1994db)[_0x9b1f('0x2c')](_0x294c1b);}};}function respondWithFilteredResult(_0x1bcd8a,_0x24f0df){return function(_0x1b7b8d){if(_0x1b7b8d){var _0x239a94=typeof _0x24f0df[_0x9b1f('0x2d')]===_0x9b1f('0x2e')&&typeof _0x24f0df[_0x9b1f('0x2f')]===_0x9b1f('0x2e');var _0x26727b=_0x1b7b8d[_0x9b1f('0x30')];var _0x352863=_0x239a94?0x0:_0x24f0df[_0x9b1f('0x2d')];var _0x1d92dc=_0x239a94?_0x1b7b8d[_0x9b1f('0x30')]:_0x24f0df[_0x9b1f('0x2d')]+_0x24f0df[_0x9b1f('0x2f')];var _0x33d1f5;if(_0x1d92dc>=_0x26727b){_0x1d92dc=_0x26727b;_0x33d1f5=0xc8;}else{_0x33d1f5=0xce;}_0x1bcd8a['status'](_0x33d1f5);return _0x1bcd8a[_0x9b1f('0x31')]('Content-Range',_0x352863+'-'+_0x1d92dc+'/'+_0x26727b)[_0x9b1f('0x2c')](_0x1b7b8d);}return null;};}function patchUpdates(_0x404aec){return function(_0x183474){try{jsonpatch[_0x9b1f('0x32')](_0x183474,_0x404aec,!![]);}catch(_0x5d7d7d){return BPromise[_0x9b1f('0x33')](_0x5d7d7d);}return _0x183474['save']();};}function saveUpdates(_0x140977,_0x4cbfab){return function(_0x5d259f){if(_0x5d259f){return _0x5d259f['update'](_0x140977)[_0x9b1f('0x34')](function(_0x53e03f){return _0x53e03f;});}return null;};}function removeEntity(_0x360b66,_0x1fabb4){return function(_0x50f8d3){if(_0x50f8d3){return _0x50f8d3[_0x9b1f('0x35')]()[_0x9b1f('0x34')](function(){_0x360b66[_0x9b1f('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318e20,_0xadde7){return function(_0x57418c){if(!_0x57418c){_0x318e20[_0x9b1f('0x2a')](0x194);}return _0x57418c;};}function handleError(_0x4df32d,_0x32e469){_0x32e469=_0x32e469||0x1f4;return function(_0x235dd7){logger[_0x9b1f('0x26')](_0x235dd7[_0x9b1f('0x36')]);if(_0x235dd7[_0x9b1f('0x37')]){delete _0x235dd7[_0x9b1f('0x37')];}_0x4df32d['status'](_0x32e469)[_0x9b1f('0x38')](_0x235dd7);};}exports[_0x9b1f('0x39')]=function(_0x3af26d,_0x130641){var _0x4ab665={},_0x4973b3={},_0x30b513={'count':0x0,'rows':[]};var _0xd7948=_[_0x9b1f('0x3a')](db['WhatsappMessage'][_0x9b1f('0x3b')],function(_0x501827){return{'name':_0x501827[_0x9b1f('0x3c')],'type':_0x501827[_0x9b1f('0x3d')][_0x9b1f('0x3e')]};});_0x4973b3[_0x9b1f('0x3f')]=_['map'](_0xd7948,'name');_0x4973b3['query']=_['keys'](_0x3af26d[_0x9b1f('0x40')]);_0x4973b3['filters']=_[_0x9b1f('0x41')](_0x4973b3[_0x9b1f('0x3f')],_0x4973b3[_0x9b1f('0x40')]);_0x4ab665[_0x9b1f('0x42')]=_['intersection'](_0x4973b3[_0x9b1f('0x3f')],qs[_0x9b1f('0x43')](_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x43')]));_0x4ab665['attributes']=_0x4ab665[_0x9b1f('0x42')][_0x9b1f('0x44')]?_0x4ab665[_0x9b1f('0x42')]:_0x4973b3[_0x9b1f('0x3f')];if(!_0x3af26d[_0x9b1f('0x40')]['hasOwnProperty'](_0x9b1f('0x45'))){_0x4ab665[_0x9b1f('0x2f')]=qs[_0x9b1f('0x2f')](_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x2f')]);_0x4ab665[_0x9b1f('0x2d')]=qs[_0x9b1f('0x2d')](_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x2d')]);}_0x4ab665[_0x9b1f('0x46')]=qs['sort'](_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x47')]);_0x4ab665[_0x9b1f('0x48')]=qs[_0x9b1f('0x49')](_[_0x9b1f('0x4a')](_0x3af26d['query'],_0x4973b3[_0x9b1f('0x49')]),_0xd7948);if(_0x3af26d['query'][_0x9b1f('0x4b')]){_0x4ab665[_0x9b1f('0x48')]=_['merge'](_0x4ab665['where'],{'$or':_[_0x9b1f('0x3a')](_0xd7948,function(_0x5004e2){if(_0x5004e2[_0x9b1f('0x3d')]!==_0x9b1f('0x4c')){var _0x42ac22={};_0x42ac22[_0x5004e2['name']]={'$like':'%'+_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x4b')]+'%'};return _0x42ac22;}})});}_0x4ab665=_[_0x9b1f('0x4d')]({},_0x4ab665,_0x3af26d['options']);var _0x3510fc={'where':_0x4ab665['where']};return db[_0x9b1f('0x4e')]['count'](_0x3510fc)[_0x9b1f('0x34')](function(_0x1042af){_0x30b513[_0x9b1f('0x30')]=_0x1042af;if(_0x3af26d[_0x9b1f('0x40')][_0x9b1f('0x4f')]){_0x4ab665[_0x9b1f('0x50')]=[{'all':!![]}];}return db[_0x9b1f('0x4e')]['findAll'](_0x4ab665);})[_0x9b1f('0x34')](function(_0x3f50aa){_0x30b513[_0x9b1f('0x51')]=_0x3f50aa;return _0x30b513;})['then'](respondWithFilteredResult(_0x130641,_0x4ab665))[_0x9b1f('0x29')](handleError(_0x130641,null));};exports['show']=function(_0xc99063,_0x42a4e0){var _0x262ba3={'raw':!![],'where':{'id':_0xc99063[_0x9b1f('0x52')]['id']}},_0x2410eb={};_0x2410eb[_0x9b1f('0x3f')]=_['keys'](db['WhatsappMessage'][_0x9b1f('0x3b')]);_0x2410eb[_0x9b1f('0x40')]=_[_0x9b1f('0x53')](_0xc99063[_0x9b1f('0x40')]);_0x2410eb[_0x9b1f('0x49')]=_[_0x9b1f('0x41')](_0x2410eb[_0x9b1f('0x3f')],_0x2410eb[_0x9b1f('0x40')]);_0x262ba3['attributes']=_['intersection'](_0x2410eb['model'],qs[_0x9b1f('0x43')](_0xc99063[_0x9b1f('0x40')]['fields']));_0x262ba3[_0x9b1f('0x42')]=_0x262ba3['attributes'][_0x9b1f('0x44')]?_0x262ba3[_0x9b1f('0x42')]:_0x2410eb['model'];if(_0xc99063[_0x9b1f('0x40')][_0x9b1f('0x4f')]){_0x262ba3[_0x9b1f('0x50')]=[{'all':!![]}];}_0x262ba3=_[_0x9b1f('0x4d')]({},_0x262ba3,_0xc99063[_0x9b1f('0x54')]);return db[_0x9b1f('0x4e')]['find'](_0x262ba3)[_0x9b1f('0x34')](handleEntityNotFound(_0x42a4e0,null))['then'](respondWithResult(_0x42a4e0,null))[_0x9b1f('0x29')](handleError(_0x42a4e0,null));};exports[_0x9b1f('0x55')]=function(_0xe4678a,_0x26b22c){return db['WhatsappMessage'][_0x9b1f('0x55')](_0xe4678a[_0x9b1f('0x56')],{})[_0x9b1f('0x34')](respondWithResult(_0x26b22c,0xc9))[_0x9b1f('0x29')](handleError(_0x26b22c,null));};exports[_0x9b1f('0x57')]=function(_0x19c6d4,_0x6465ae){if(_0x19c6d4[_0x9b1f('0x56')]['id']){delete _0x19c6d4['body']['id'];}return db[_0x9b1f('0x4e')][_0x9b1f('0x58')]({'where':{'id':_0x19c6d4[_0x9b1f('0x52')]['id']}})[_0x9b1f('0x34')](handleEntityNotFound(_0x6465ae,null))[_0x9b1f('0x34')](saveUpdates(_0x19c6d4[_0x9b1f('0x56')],null))[_0x9b1f('0x34')](respondWithResult(_0x6465ae,null))[_0x9b1f('0x29')](handleError(_0x6465ae,null));};exports[_0x9b1f('0x35')]=function(_0x6d5805,_0x1ff426){return db[_0x9b1f('0x4e')][_0x9b1f('0x58')]({'where':{'id':_0x6d5805[_0x9b1f('0x52')]['id']}})[_0x9b1f('0x34')](handleEntityNotFound(_0x1ff426,null))[_0x9b1f('0x34')](removeEntity(_0x1ff426,null))['catch'](handleError(_0x1ff426,null));};exports['describe']=function(_0x59f616,_0x123690){return db['WhatsappMessage'][_0x9b1f('0x59')]()[_0x9b1f('0x34')](respondWithResult(_0x123690,null))[_0x9b1f('0x29')](handleError(_0x123690,null));};var interaction_log=require('../../config/logger')(_0x9b1f('0x5a'));exports[_0x9b1f('0x5b')]=function(_0x57e31c,_0xdf2042,_0x49d405){var _0x2fc050={'agent':{},'channel':_0x9b1f('0x5c')};if(_0x57e31c[_0x9b1f('0x56')]['id']){delete _0x57e31c[_0x9b1f('0x56')]['id'];}_0x57e31c[_0x9b1f('0x56')]['read']=!![];_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x5d')]=moment()[_0x9b1f('0x5e')](_0x9b1f('0x5f'));_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x60')]=_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x60')]||_0x57e31c[_0x9b1f('0x61')]['id'];_0x2fc050['agent']['id']=_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x60')];return db[_0x9b1f('0x4e')]['find']({'where':{'id':_0x57e31c['params']['id'],'UserId':null}})[_0x9b1f('0x34')](handleEntityNotFound(_0xdf2042,null))[_0x9b1f('0x34')](saveUpdates(_0x57e31c[_0x9b1f('0x56')],null))[_0x9b1f('0x34')](function(_0x5ab1b1){if(_0x5ab1b1){_0x2fc050[_0x9b1f('0x27')]=_0x5ab1b1[_0x9b1f('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5ab1b1['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xdf2042,null))[_0x9b1f('0x34')](function(_0x32bddf){if(_0x32bddf){return _0x32bddf[_0x9b1f('0x57')]({'UserId':_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x60')],'read1stAt':_[_0x9b1f('0x63')](_0x32bddf[_0x9b1f('0x64')])?moment()[_0x9b1f('0x5e')](_0x9b1f('0x5f')):undefined});}return null;})[_0x9b1f('0x34')](function(_0x22bf8b){if(_0x22bf8b){_0x2fc050[_0x9b1f('0x65')]=_0x22bf8b['get']({'plain':!![]});interaction_log['info'](_0x9b1f('0x66'),_0x57e31c[_0x9b1f('0x61')]['id'],_0x57e31c[_0x9b1f('0x61')]['name'],_0x57e31c[_0x9b1f('0x61')][_0x9b1f('0x67')],_0x2fc050[_0x9b1f('0x65')]['id'],_0x57e31c['body']?JSON[_0x9b1f('0x24')](_0x57e31c['body']):'null');return respondWithRpcPromise(_0x9b1f('0x68'),_0x9b1f('0x69'),_0x2fc050);}return null;})['then'](function(_0x9ca2c3){var _0x8d7427=_0x9b1f('0x6a')+_0x9ca2c3[_0x9b1f('0x27')]['ContactId'];return db[_0x9b1f('0x6b')][_0x9b1f('0x40')](_0x8d7427,{'type':db['Sequelize'][_0x9b1f('0x6c')]['SELECT'],'raw':!![]})[_0x9b1f('0x34')](function(_0x530d17){return _0x530d17;});})[_0x9b1f('0x34')](function(_0x20a9cb){if(_0x20a9cb){_0x2fc050['message'][_0x9b1f('0x6d')]=_0x20a9cb[0x0];if(!_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x60')])return;return db[_0x9b1f('0x6e')]['find']({'where':{'id':_0x57e31c[_0x9b1f('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x9b1f('0x37'),_0x9b1f('0x6f'),_0x9b1f('0x70'),_0x9b1f('0x71')],'raw':!![]});}return null;})['then'](function(_0x478426){if(!_0x478426)return null;_0x2fc050[_0x9b1f('0x27')][_0x9b1f('0x72')]=_0x478426;return _0x2fc050;})[_0x9b1f('0x34')](function(_0x38a17f){if(_0x38a17f){if(_0x57e31c[_0x9b1f('0x56')][_0x9b1f('0x73')]){_0x2fc050[_0x9b1f('0x27')][_0x9b1f('0x74')]=util[_0x9b1f('0x5e')](_0x9b1f('0x75'),_0x57e31c[_0x9b1f('0x61')]['name']);_0x2fc050['message']['channel']=_0x2fc050['channel'];_0x2fc050['message'][_0x9b1f('0x76')]=_0x2fc050['channel'];_0x2fc050[_0x9b1f('0x27')][_0x9b1f('0x77')]='accept';return respondWithRpcPromise(_0x9b1f('0x78'),_0x9b1f('0x78'),{'event':_0x9b1f('0x79'),'message':_0x2fc050['message']},client9002)[_0x9b1f('0x34')](function(){return _0x2fc050;});}return _0x2fc050;}return null;})[_0x9b1f('0x34')](respondWithResult(_0xdf2042,null))['catch'](handleError(_0xdf2042,null));};var interaction_log=require(_0x9b1f('0x15'))(_0x9b1f('0x5a'));exports[_0x9b1f('0x33')]=function(_0xbd76a1,_0x2de1c8,_0x11e251){var _0x3f946c={'agent':{},'channel':_0x9b1f('0x5c')};if(_0xbd76a1[_0x9b1f('0x56')]['id']){delete _0xbd76a1[_0x9b1f('0x56')]['id'];}_0xbd76a1[_0x9b1f('0x56')][_0x9b1f('0x60')]=_0xbd76a1[_0x9b1f('0x56')][_0x9b1f('0x60')]||_0xbd76a1['user']['id'];_0x3f946c[_0x9b1f('0x72')]['id']=_0xbd76a1[_0x9b1f('0x56')]['UserId'];return db[_0x9b1f('0x4e')][_0x9b1f('0x58')]({'where':{'id':_0xbd76a1[_0x9b1f('0x52')]['id'],'UserId':null}})[_0x9b1f('0x34')](handleEntityNotFound(_0x2de1c8,null))[_0x9b1f('0x34')](function(_0x161572){if(_0x161572){_0x3f946c[_0x9b1f('0x27')]=_0x161572[_0x9b1f('0x62')]({'plain':!![]});return db[_0x9b1f('0x7a')]['find']({'where':{'id':_0x161572['WhatsappInteractionId']}});}return null;})[_0x9b1f('0x34')](handleEntityNotFound(_0x2de1c8,null))[_0x9b1f('0x34')](function(_0x5495bf){if(_0x5495bf){_0x3f946c[_0x9b1f('0x65')]=_0x5495bf[_0x9b1f('0x62')]({'plain':!![]});interaction_log[_0x9b1f('0x20')](_0x9b1f('0x7b'),_0xbd76a1[_0x9b1f('0x61')]['id'],_0xbd76a1[_0x9b1f('0x61')][_0x9b1f('0x37')],_0xbd76a1[_0x9b1f('0x61')][_0x9b1f('0x67')],_0x3f946c[_0x9b1f('0x65')]['id'],_0xbd76a1[_0x9b1f('0x56')]?JSON[_0x9b1f('0x24')](_0xbd76a1['body']):_0x9b1f('0x7c'));return respondWithRpcPromise(_0x9b1f('0x7d'),_0x9b1f('0x7e'),_0x3f946c);}return null;})[_0x9b1f('0x34')](function(_0x2e1adb){var _0x549e5b=_0x9b1f('0x6a')+_0x2e1adb[_0x9b1f('0x27')][_0x9b1f('0x7f')];return db['sequelize'][_0x9b1f('0x40')](_0x549e5b,{'type':db[_0x9b1f('0x80')]['QueryTypes'][_0x9b1f('0x81')],'raw':!![]})[_0x9b1f('0x34')](function(_0x476033){return _0x476033;});})[_0x9b1f('0x34')](function(_0x1aea14){if(_0x1aea14){_0x3f946c['message'][_0x9b1f('0x6d')]=_0x1aea14[0x0];if(!_0xbd76a1[_0x9b1f('0x56')][_0x9b1f('0x60')])return;return db['User']['find']({'where':{'id':_0xbd76a1['body'][_0x9b1f('0x60')],'role':'agent'},'attributes':['id',_0x9b1f('0x37'),_0x9b1f('0x6f'),_0x9b1f('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x573187){if(!_0x573187)return null;_0x3f946c[_0x9b1f('0x27')][_0x9b1f('0x72')]=_0x573187;return _0x3f946c;})[_0x9b1f('0x34')](function(_0x6d9456){if(_0x6d9456){_0x6d9456[_0x9b1f('0x27')]['interface']=util['format'](_0x9b1f('0x75'),_0xbd76a1[_0x9b1f('0x61')][_0x9b1f('0x37')]);_0x6d9456[_0x9b1f('0x27')][_0x9b1f('0x82')]=_0x3f946c['channel'];_0x6d9456['message'][_0x9b1f('0x76')]=_0x3f946c[_0x9b1f('0x82')];_0x6d9456['message'][_0x9b1f('0x77')]='reject';respondWithRpcPromise(_0x9b1f('0x78'),_0x9b1f('0x78'),{'event':'rejectmessage','message':_0x6d9456['message']},client9002);return _0x3f946c;}return null;})['then'](respondWithResult(_0x2de1c8,null))[_0x9b1f('0x29')](handleError(_0x2de1c8,null));};exports['status']=function(_0x1c7efb,_0x29d096,_0x3cf52b){if(_0x1c7efb[_0x9b1f('0x56')]['id']){delete _0x1c7efb[_0x9b1f('0x56')]['id'];}var _0x4761a3;return db['WhatsappMessage'][_0x9b1f('0x58')]({'where':{'id':_0x1c7efb[_0x9b1f('0x52')]['id']}})[_0x9b1f('0x34')](handleEntityNotFound(_0x29d096,null))[_0x9b1f('0x34')](function(_0x13e629){if(_0x13e629){_0x4761a3=_0x13e629;return db[_0x9b1f('0x83')][_0x9b1f('0x58')]({'where':{'id':_0x13e629[_0x9b1f('0x84')]}});}})[_0x9b1f('0x34')](handleEntityNotFound(_0x29d096,null))['then'](function(_0x4fbb50){if(_0x4fbb50){logger[_0x9b1f('0x85')](_0x9b1f('0x86'),_0x9b1f('0x2b'),_0x9b1f('0x87'),_0x4fbb50[_0x9b1f('0x3d')],util[_0x9b1f('0x88')](_0x1c7efb[_0x9b1f('0x56')],{'showHidden':![],'depth':null}));switch(_0x4fbb50[_0x9b1f('0x3d')]){case _0x9b1f('0x89'):if(_0x1c7efb[_0x9b1f('0x56')][_0x9b1f('0x8a')]&&_0x1c7efb[_0x9b1f('0x56')][_0x9b1f('0x8a')]===_0x4761a3[_0x9b1f('0x8b')]&&_0x1c7efb['body'][_0x9b1f('0x8c')]&&_0x1c7efb[_0x9b1f('0x56')][_0x9b1f('0x8c')]===_0x9b1f('0x8d')){return _0x4761a3['update']({'read':!![]});}else{logger['error'](_0x9b1f('0x8e'),_0x9b1f('0x2b'),_0x9b1f('0x89'),util[_0x9b1f('0x88')](_0x1c7efb[_0x9b1f('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x4761a3;}})[_0x9b1f('0x34')](respondWithResult(_0x29d096,null))['catch'](handleError(_0x29d096,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e224d04..b69c793 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 _0x94df=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x94df,0xa3));var _0xf94d=function(_0x50a62f,_0x2bdd7f){_0x50a62f=_0x50a62f-0x0;var _0x3d410b=_0x94df[_0x50a62f];return _0x3d410b;};'use strict';var EventEmitter=require(_0xf94d('0x0'));var WhatsappMessage=require(_0xf94d('0x1'))['db'][_0xf94d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf94d('0x3')](0x0);var events={'afterCreate':_0xf94d('0x4'),'afterUpdate':_0xf94d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x468c7e){return function(_0x1ca087,_0x1aa1b1,_0x29b6fd){WhatsappMessageEvents[_0xf94d('0x6')](_0x468c7e+':'+_0x1ca087['id'],_0x1ca087);WhatsappMessageEvents[_0xf94d('0x6')](_0x468c7e,_0x1ca087);_0x29b6fd(null);};}for(var e in events){if(events[_0xf94d('0x7')](e)){var event=events[e];WhatsappMessage[_0xf94d('0x8')](e,emitEvent(event));}}module[_0xf94d('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0102=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage'];(function(_0x2d7d38,_0x591db1){var _0x4b082f=function(_0x23a874){while(--_0x23a874){_0x2d7d38['push'](_0x2d7d38['shift']());}};_0x4b082f(++_0x591db1);}(_0x0102,0x186));var _0x2010=function(_0x30efef,_0x2b2ffe){_0x30efef=_0x30efef-0x0;var _0x4ad3d0=_0x0102[_0x30efef];return _0x4ad3d0;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2010('0x0'))['db'][_0x2010('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2010('0x2')](0x0);var events={'afterCreate':_0x2010('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x575b0a){return function(_0x4e30b3,_0x59082d,_0x22e49f){WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a+':'+_0x4e30b3['id'],_0x4e30b3);WhatsappMessageEvents[_0x2010('0x4')](_0x575b0a,_0x4e30b3);_0x22e49f(null);};}for(var e in events){if(events[_0x2010('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x2010('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index afcfeb4..2825d5a 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 _0x6e04=['findOne','WhatsappInteractionId','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','Bearer\x20','statuses','message_id','err','finally','utf8mb4','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction'];(function(_0x3df1a2,_0xebccd6){var _0x3a4e57=function(_0x59799e){while(--_0x59799e){_0x3df1a2['push'](_0x3df1a2['shift']());}};_0x3a4e57(++_0xebccd6);}(_0x6e04,0x1bb));var _0x46e0=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x6e04[_0x4bd06e];return _0x85ebb;};'use strict';var _=require('lodash');var util=require(_0x46e0('0x0'));var logger=require(_0x46e0('0x1'))('api');var moment=require(_0x46e0('0x2'));var BPromise=require('bluebird');var rp=require(_0x46e0('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x46e0('0x4'));var config=require(_0x46e0('0x5'));var attributes=require(_0x46e0('0x6'));module[_0x46e0('0x7')]=function(_0x199660,_0x386ac3){return _0x199660[_0x46e0('0x8')](_0x46e0('0x9'),attributes,{'tableName':_0x46e0('0xa'),'paranoid':![],'indexes':[{'name':_0x46e0('0xb'),'fields':[_0x46e0('0xb')]},{'name':_0x46e0('0xc'),'fields':[_0x46e0('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41fc77,_0x24ca5b,_0x344d68){var _0x2d08a3=_0x199660[_0x46e0('0xe')];var _0x21c5c8=_0x41fc77['get']({'plain':!![]});if(_0x21c5c8[_0x46e0('0xf')][_0x46e0('0x10')]()==='in'||_0x21c5c8[_0x46e0('0xf')][_0x46e0('0x10')]()===_0x46e0('0x11')&&!_0x21c5c8['secret']&&!_[_0x46e0('0x12')](_0x21c5c8[_0x46e0('0x13')])){_0x2d08a3[_0x46e0('0x14')][_0x46e0('0x15')]({'where':{'id':_0x21c5c8[_0x46e0('0x16')]}})['then'](function(_0x4405ef){if(_0x4405ef){_0x4405ef[_0x46e0('0x17')]({'lastMsgAt':_0x21c5c8[_0x46e0('0x18')],'lastMsgDirection':_0x21c5c8[_0x46e0('0xf')][_0x46e0('0x10')]()});}})[_0x46e0('0x19')](function(_0x51ce94){console[_0x46e0('0x1a')](_0x51ce94);});}if(_0x21c5c8[_0x46e0('0xf')]===_0x46e0('0x11')&&!_0x21c5c8[_0x46e0('0x1b')]){var _0x5b0baa;_0x2d08a3[_0x46e0('0x1c')][_0x46e0('0x1d')]({'where':{'id':_0x21c5c8[_0x46e0('0x1e')]},'raw':!![]})[_0x46e0('0x1f')](function(_0x430e82){_0x5b0baa=_0x430e82;if(_0x5b0baa&&_0x5b0baa[_0x46e0('0x20')]){switch(_0x5b0baa[_0x46e0('0x20')]){case'twilio':var _0xc490b8=require(_0x46e0('0x21'));if(_0x5b0baa[_0x46e0('0x22')]&&_0x5b0baa['authToken']&&_0x5b0baa[_0x46e0('0x23')]){var _0x230fb0=new _0xc490b8(_0x5b0baa[_0x46e0('0x22')],_0x5b0baa[_0x46e0('0x24')]);_0x230fb0[_0x46e0('0x25')][_0x46e0('0x26')]({'body':_0x21c5c8['body'],'to':_0x46e0('0x27')+_0x21c5c8['phone'],'from':_0x46e0('0x27')+_0x5b0baa['phone'],'statusCallback':_0x5b0baa[_0x46e0('0x28')]+_0x46e0('0x29')+_0x21c5c8['id']+_0x46e0('0x2a')+_0x5b0baa[_0x46e0('0x2b')]})[_0x46e0('0x1f')](function(_0x518d76){if(_0x518d76[_0x46e0('0x2c')]){return _0x41fc77['update']({'messageId':_0x518d76[_0x46e0('0x2c')]});}})[_0x46e0('0x19')](function(_0x454af8){logger[_0x46e0('0x1a')](_0x46e0('0x2d'),_0x46e0('0x2e'),'twilio',util[_0x46e0('0x2f')](_0x454af8,{'showHidden':![],'depth':null}));});}else{logger[_0x46e0('0x1a')](_0x46e0('0x2d'),_0x46e0('0x2e'),'twilio',_0x46e0('0x30'));}break;case _0x46e0('0x31'):var _0x2c06af=_0x5b0baa[_0x46e0('0x22')];var _0xb847cc=_0x5b0baa[_0x46e0('0x24')];var _0x280a31=_0x5b0baa[_0x46e0('0x32')]+_0x46e0('0x33')+_0x2c06af+'/messages/';var _0x5a8a8b={'to':[_0x21c5c8[_0x46e0('0x23')]],'message':{'type':'text','text':_0x21c5c8[_0x46e0('0xd')]}};var _0x16e2d3={'method':'POST','uri':_0x280a31,'headers':{'Authorization':_0x46e0('0x34')+_0xb847cc,'Content-Type':'application/json'},'body':_0x5a8a8b,'json':!![]};rp(_0x16e2d3)[_0x46e0('0x1f')](function(_0x28ef58){if(_0x28ef58[_0x46e0('0x35')][0x0][_0x46e0('0x36')]){return _0x41fc77[_0x46e0('0x17')]({'messageId':_0x28ef58['statuses'][0x0][_0x46e0('0x36')]});}})[_0x46e0('0x19')](function(_0x2ff5d5){logger[_0x46e0('0x37')]('WhatsappMessage,\x20%s',_0x2ff5d5);});break;}}})[_0x46e0('0x38')](function(){_0x344d68();});}else{_0x344d68();}}},'charset':_0x46e0('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb254=['sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','Bearer\x20','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','update','createdAt','WhatsappAccount','find','WhatsappAccountId','then','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/status?token='];(function(_0x3d0d9c,_0x4cba8e){var _0x2bc8cf=function(_0x275d0b){while(--_0x275d0b){_0x3d0d9c['push'](_0x3d0d9c['shift']());}};_0x2bc8cf(++_0x4cba8e);}(_0xb254,0x1b9));var _0x4b25=function(_0x178342,_0x3e6cd2){_0x178342=_0x178342-0x0;var _0x5667c9=_0xb254[_0x178342];return _0x5667c9;};'use strict';var _=require('lodash');var util=require(_0x4b25('0x0'));var logger=require(_0x4b25('0x1'))(_0x4b25('0x2'));var moment=require(_0x4b25('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b25('0x4'));var fetch=require(_0x4b25('0x5'));var fs=require('fs');var path=require(_0x4b25('0x6'));var rimraf=require(_0x4b25('0x7'));var config=require('../../config/environment');var attributes=require(_0x4b25('0x8'));module[_0x4b25('0x9')]=function(_0x387002,_0x1940d4){return _0x387002[_0x4b25('0xa')]('WhatsappMessage',attributes,{'tableName':_0x4b25('0xb'),'paranoid':![],'indexes':[{'name':_0x4b25('0xc'),'fields':[_0x4b25('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x4b25('0xd')],'type':_0x4b25('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xde30a6,_0x245669,_0x4ace7f){var _0x209fb0=_0x387002['models'];var _0x1f9049=_0xde30a6[_0x4b25('0xf')]({'plain':!![]});if(_0x1f9049[_0x4b25('0x10')][_0x4b25('0x11')]()==='in'||_0x1f9049['direction'][_0x4b25('0x11')]()===_0x4b25('0x12')&&!_0x1f9049[_0x4b25('0x13')]&&!_['isNil'](_0x1f9049[_0x4b25('0x14')])){_0x209fb0['WhatsappInteraction']['findOne']({'where':{'id':_0x1f9049[_0x4b25('0x15')]}})['then'](function(_0x567544){if(_0x567544){_0x567544[_0x4b25('0x16')]({'lastMsgAt':_0x1f9049[_0x4b25('0x17')],'lastMsgDirection':_0x1f9049[_0x4b25('0x10')][_0x4b25('0x11')]()});}})['catch'](function(_0x3aef0b){console['error'](_0x3aef0b);});}if(_0x1f9049[_0x4b25('0x10')]===_0x4b25('0x12')&&!_0x1f9049['secret']){var _0x59ca30;_0x209fb0[_0x4b25('0x18')][_0x4b25('0x19')]({'where':{'id':_0x1f9049[_0x4b25('0x1a')]},'raw':!![]})[_0x4b25('0x1b')](function(_0x2f77d9){_0x59ca30=_0x2f77d9;if(_0x59ca30&&_0x59ca30['type']){switch(_0x59ca30['type']){case _0x4b25('0x1c'):var _0x53ae1c=require(_0x4b25('0x1c'));if(_0x59ca30[_0x4b25('0x1d')]&&_0x59ca30[_0x4b25('0x1e')]&&_0x59ca30[_0x4b25('0x1f')]){var _0x5b62be=new _0x53ae1c(_0x59ca30[_0x4b25('0x1d')],_0x59ca30[_0x4b25('0x1e')]);_0x5b62be[_0x4b25('0x20')][_0x4b25('0x21')]({'body':_0x1f9049[_0x4b25('0xd')],'to':_0x4b25('0x22')+_0x1f9049[_0x4b25('0x1f')],'from':_0x4b25('0x22')+_0x59ca30[_0x4b25('0x1f')],'statusCallback':_0x59ca30['remote']+'/api/whatsapp/messages/'+_0x1f9049['id']+_0x4b25('0x23')+_0x59ca30['token']})[_0x4b25('0x1b')](function(_0x5455e6){if(_0x5455e6[_0x4b25('0x24')]){return _0xde30a6[_0x4b25('0x16')]({'messageId':_0x5455e6['sid']});}})['catch'](function(_0x20d03d){logger[_0x4b25('0x25')](_0x4b25('0x26'),_0x4b25('0x27'),_0x4b25('0x1c'),util['inspect'](_0x20d03d,{'showHidden':![],'depth':null}));});}else{logger[_0x4b25('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4b25('0x27'),_0x4b25('0x1c'),_0x4b25('0x28'));}break;case _0x4b25('0x29'):var _0x205745=_0x59ca30[_0x4b25('0x1d')];var _0x10cfcb=_0x59ca30[_0x4b25('0x1e')];var _0x3827f5=_0x59ca30['baseUrl']+_0x4b25('0x2a')+_0x205745+'/messages/';var _0x5f57f7={'to':[_0x1f9049[_0x4b25('0x1f')]],'message':{'type':_0x4b25('0x2b'),'text':_0x1f9049[_0x4b25('0xd')]}};var _0x14fd8e={'method':'POST','uri':_0x3827f5,'headers':{'Authorization':_0x4b25('0x2c')+_0x10cfcb,'Content-Type':'application/json'},'body':_0x5f57f7,'json':!![]};rp(_0x14fd8e)['then'](function(_0x5c5797){if(_0x5c5797[_0x4b25('0x2d')][0x0][_0x4b25('0x2e')]){return _0xde30a6[_0x4b25('0x16')]({'messageId':_0x5c5797[_0x4b25('0x2d')][0x0][_0x4b25('0x2e')]});}})[_0x4b25('0x2f')](function(_0x4bc3e8){logger[_0x4b25('0x30')](_0x4b25('0x31'),_0x4bc3e8);});break;}}})[_0x4b25('0x32')](function(){_0x4ace7f();});}else{_0x4ace7f();}}},'charset':_0x4b25('0x33'),'collate':_0x4b25('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index dabaa17..57c2628 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 _0xd1c3=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','WhatsappMessage','create','options','CreateWhatsappMessage'];(function(_0x176310,_0x3be311){var _0x599180=function(_0x3cc268){while(--_0x3cc268){_0x176310['push'](_0x176310['shift']());}};_0x599180(++_0x3be311);}(_0xd1c3,0x1e6));var _0x3d1c=function(_0x452e44,_0x571c8e){_0x452e44=_0x452e44-0x0;var _0x3ac761=_0xd1c3[_0x452e44];return _0x3ac761;};'use strict';var _=require('lodash');var util=require(_0x3d1c('0x0'));var moment=require(_0x3d1c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d1c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d1c('0x3'))['db'];var utils=require(_0x3d1c('0x4'));var logger=require('../../config/logger')(_0x3d1c('0x5'));var config=require(_0x3d1c('0x6'));var jayson=require(_0x3d1c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3d1c('0x8')]=_['defaults'](config['redis'],{'host':_0x3d1c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d1c('0x8')]));require(_0x3d1c('0xa'))[_0x3d1c('0xb')](socket);function respondWithRpcPromise(_0x106838,_0x25a543,_0x25cb8f){return new BPromise(function(_0x505fbb,_0x374fca){return client[_0x3d1c('0xc')](_0x106838,_0x25cb8f)[_0x3d1c('0xd')](function(_0x162487){logger[_0x3d1c('0xe')](_0x3d1c('0xf'),_0x25a543,_0x3d1c('0x10'));logger[_0x3d1c('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x25a543,_0x3d1c('0x10'),JSON[_0x3d1c('0x12')](_0x162487));if(_0x162487[_0x3d1c('0x13')]){if(_0x162487[_0x3d1c('0x13')]['code']===0x1f4){logger[_0x3d1c('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x25a543,_0x162487[_0x3d1c('0x13')][_0x3d1c('0x14')]);return _0x374fca(_0x162487[_0x3d1c('0x13')][_0x3d1c('0x14')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x25a543,_0x162487[_0x3d1c('0x13')][_0x3d1c('0x14')]);return _0x505fbb(_0x162487[_0x3d1c('0x13')][_0x3d1c('0x14')]);}else{logger[_0x3d1c('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x25a543,_0x3d1c('0x10'));_0x505fbb(_0x162487[_0x3d1c('0x15')][_0x3d1c('0x14')]);}})[_0x3d1c('0x16')](function(_0x331353){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x25a543,_0x331353);_0x374fca(_0x331353);});});}exports['CreateWhatsappMessage']=function(_0xb336e6){var _0x3b4de2=this;return new Promise(function(_0x42b321,_0x4855dc){return db[_0x3d1c('0x17')][_0x3d1c('0x18')](_0xb336e6['body'],{'raw':_0xb336e6[_0x3d1c('0x19')]?_0xb336e6['options']['raw']===undefined?!![]:![]:!![]})[_0x3d1c('0xd')](function(_0x506fb2){logger[_0x3d1c('0xe')]('CreateWhatsappMessage',_0xb336e6);logger[_0x3d1c('0x11')](_0x3d1c('0x1a'),_0xb336e6,JSON[_0x3d1c('0x12')](_0x506fb2));_0x42b321(_0x506fb2);})[_0x3d1c('0x16')](function(_0x581e34){logger['error'](_0x3d1c('0x1a'),_0x581e34[_0x3d1c('0x14')],_0xb336e6);_0x4855dc(_0x3b4de2[_0x3d1c('0x13')](0x1f4,_0x581e34[_0x3d1c('0x14')]));});});}; \ No newline at end of file +var _0x3d47=['WhatsappMessage','create','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateWhatsappMessage'];(function(_0x27bd34,_0x54c1c7){var _0x5dd8c9=function(_0x4df6fa){while(--_0x4df6fa){_0x27bd34['push'](_0x27bd34['shift']());}};_0x5dd8c9(++_0x54c1c7);}(_0x3d47,0xa5));var _0x73d4=function(_0x3bdebd,_0x73cd86){_0x3bdebd=_0x3bdebd-0x0;var _0x869b6b=_0x3d47[_0x3bdebd];return _0x869b6b;};'use strict';var _=require(_0x73d4('0x0'));var util=require(_0x73d4('0x1'));var moment=require('moment');var BPromise=require(_0x73d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73d4('0x3'))['db'];var utils=require(_0x73d4('0x4'));var logger=require(_0x73d4('0x5'))(_0x73d4('0x6'));var config=require(_0x73d4('0x7'));var jayson=require(_0x73d4('0x8'));var client=jayson['client'][_0x73d4('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x73d4('0xa'),'port':0x18eb});var socket=require(_0x73d4('0xb'))(new Redis(config['redis']));require(_0x73d4('0xc'))[_0x73d4('0xd')](socket);function respondWithRpcPromise(_0x1676a6,_0x44d88f,_0x5291c0){return new BPromise(function(_0x261129,_0x3dcab2){return client[_0x73d4('0xe')](_0x1676a6,_0x5291c0)[_0x73d4('0xf')](function(_0x24cda6){logger[_0x73d4('0x10')](_0x73d4('0x11'),_0x44d88f,'request\x20sent');logger[_0x73d4('0x12')](_0x73d4('0x13'),_0x44d88f,_0x73d4('0x14'),JSON['stringify'](_0x24cda6));if(_0x24cda6[_0x73d4('0x15')]){if(_0x24cda6[_0x73d4('0x15')][_0x73d4('0x16')]===0x1f4){logger[_0x73d4('0x15')](_0x73d4('0x11'),_0x44d88f,_0x24cda6[_0x73d4('0x15')][_0x73d4('0x17')]);return _0x3dcab2(_0x24cda6[_0x73d4('0x15')][_0x73d4('0x17')]);}logger['error'](_0x73d4('0x11'),_0x44d88f,_0x24cda6[_0x73d4('0x15')][_0x73d4('0x17')]);return _0x261129(_0x24cda6[_0x73d4('0x15')][_0x73d4('0x17')]);}else{logger[_0x73d4('0x10')](_0x73d4('0x11'),_0x44d88f,'request\x20sent');_0x261129(_0x24cda6[_0x73d4('0x18')][_0x73d4('0x17')]);}})[_0x73d4('0x19')](function(_0x31c78e){logger[_0x73d4('0x15')](_0x73d4('0x11'),_0x44d88f,_0x31c78e);_0x3dcab2(_0x31c78e);});});}exports[_0x73d4('0x1a')]=function(_0x248d4b){var _0x497760=this;return new Promise(function(_0xdccced,_0x411e21){return db[_0x73d4('0x1b')][_0x73d4('0x1c')](_0x248d4b[_0x73d4('0x1d')],{'raw':_0x248d4b[_0x73d4('0x1e')]?_0x248d4b[_0x73d4('0x1e')][_0x73d4('0x1f')]===undefined?!![]:![]:!![]})[_0x73d4('0xf')](function(_0x549756){logger[_0x73d4('0x10')]('CreateWhatsappMessage',_0x248d4b);logger[_0x73d4('0x12')](_0x73d4('0x1a'),_0x248d4b,JSON['stringify'](_0x549756));_0xdccced(_0x549756);})['catch'](function(_0x15211e){logger['error'](_0x73d4('0x1a'),_0x15211e[_0x73d4('0x17')],_0x248d4b);_0x411e21(_0x497760[_0x73d4('0x15')](0x1f4,_0x15211e[_0x73d4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 73ed6d0..6ff1429 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 _0xb8c6=['whatsappMessage:','save','remove','update','emit','removeListener','length'];(function(_0x3f8ba3,_0x4fe833){var _0x1c2e73=function(_0x2aeacf){while(--_0x2aeacf){_0x3f8ba3['push'](_0x3f8ba3['shift']());}};_0x1c2e73(++_0x4fe833);}(_0xb8c6,0xda));var _0x6b8c=function(_0x3ec594,_0x448834){_0x3ec594=_0x3ec594-0x0;var _0x21f286=_0xb8c6[_0x3ec594];return _0x21f286;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x6b8c('0x0'),_0x6b8c('0x1'),_0x6b8c('0x2')];function createListener(_0x4bbf1d,_0x26ea6b){return function(_0x56378d){_0x26ea6b[_0x6b8c('0x3')](_0x4bbf1d,_0x56378d);};}function removeListener(_0x5333da,_0x32489c){return function(){WhatsappMessageEvents[_0x6b8c('0x4')](_0x5333da,_0x32489c);};}exports['register']=function(_0x2e5f98){for(var _0x3e0408=0x0,_0x28f6f6=events[_0x6b8c('0x5')];_0x3e0408<_0x28f6f6;_0x3e0408++){var _0x20f79f=events[_0x3e0408];var _0x2c0b33=createListener(_0x6b8c('0x6')+_0x20f79f,_0x2e5f98);WhatsappMessageEvents['on'](_0x20f79f,_0x2c0b33);}}; \ No newline at end of file +var _0xad19=['./whatsappMessage.events','save','remove','update','emit','register','length'];(function(_0xe62f70,_0x412aad){var _0x383e2f=function(_0x233784){while(--_0x233784){_0xe62f70['push'](_0xe62f70['shift']());}};_0x383e2f(++_0x412aad);}(_0xad19,0x85));var _0x9ad1=function(_0x11c44c,_0x3a5a1d){_0x11c44c=_0x11c44c-0x0;var _0x44c792=_0xad19[_0x11c44c];return _0x44c792;};'use strict';var WhatsappMessageEvents=require(_0x9ad1('0x0'));var events=[_0x9ad1('0x1'),_0x9ad1('0x2'),_0x9ad1('0x3')];function createListener(_0x361061,_0x3c3790){return function(_0x28f7f4){_0x3c3790[_0x9ad1('0x4')](_0x361061,_0x28f7f4);};}function removeListener(_0x1b5e35,_0x3dcb1d){return function(){WhatsappMessageEvents['removeListener'](_0x1b5e35,_0x3dcb1d);};}exports[_0x9ad1('0x5')]=function(_0x3d5290){for(var _0x11c804=0x0,_0x198987=events[_0x9ad1('0x6')];_0x11c804<_0x198987;_0x11c804++){var _0x4cdbd6=events[_0x11c804];var _0x1258fb=createListener('whatsappMessage:'+_0x4cdbd6,_0x3d5290);WhatsappMessageEvents['on'](_0x4cdbd6,_0x1258fb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 63ec7c7..43efe27 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 _0xa958=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x4e92cc,_0x446a66){var _0x2f3da9=function(_0x58bc65){while(--_0x58bc65){_0x4e92cc['push'](_0x4e92cc['shift']());}};_0x2f3da9(++_0x446a66);}(_0xa958,0x116));var _0x8a95=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa958[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x8a95('0x0'));var util=require(_0x8a95('0x1'));var path=require(_0x8a95('0x2'));var timeout=require(_0x8a95('0x3'));var express=require(_0x8a95('0x4'));var router=express['Router']();var fs_extra=require(_0x8a95('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a95('0x6'));var config=require(_0x8a95('0x7'));var controller=require(_0x8a95('0x8'));router[_0x8a95('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a95('0xa')]);router[_0x8a95('0x9')](_0x8a95('0xb'),auth[_0x8a95('0xc')](),controller[_0x8a95('0xd')]);router['get'](_0x8a95('0xe'),auth[_0x8a95('0xc')](),controller[_0x8a95('0xf')]);router['get'](_0x8a95('0x10'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x11')]);router[_0x8a95('0x9')](_0x8a95('0x12'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x13')]);router[_0x8a95('0x9')](_0x8a95('0x14'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x15')]);router[_0x8a95('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a95('0x16')](_0x8a95('0x12'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x17')]);router[_0x8a95('0x16')](_0x8a95('0x14'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x18')]);router[_0x8a95('0x19')](_0x8a95('0xe'),auth[_0x8a95('0xc')](),controller[_0x8a95('0x1a')]);router[_0x8a95('0x1b')](_0x8a95('0xe'),auth['isAuthenticated'](),controller[_0x8a95('0x1c')]);router['delete'](_0x8a95('0x12'),auth['isAuthenticated'](),controller[_0x8a95('0x1d')]);router[_0x8a95('0x1b')]('/:id/users',auth[_0x8a95('0xc')](),controller[_0x8a95('0x1e')]);module[_0x8a95('0x1f')]=router; \ No newline at end of file +var _0x4178=['isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x6d3638,_0x888b7c){var _0x1a1f02=function(_0x2bc30e){while(--_0x2bc30e){_0x6d3638['push'](_0x6d3638['shift']());}};_0x1a1f02(++_0x888b7c);}(_0x4178,0x1b7));var _0x8417=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4178[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x8417('0x0'));var util=require(_0x8417('0x1'));var path=require(_0x8417('0x2'));var timeout=require('connect-timeout');var express=require(_0x8417('0x3'));var router=express[_0x8417('0x4')]();var fs_extra=require(_0x8417('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8417('0x6'));var config=require(_0x8417('0x7'));var controller=require(_0x8417('0x8'));router['get']('/',auth[_0x8417('0x9')](),controller['index']);router[_0x8417('0xa')](_0x8417('0xb'),auth[_0x8417('0x9')](),controller[_0x8417('0xc')]);router[_0x8417('0xa')](_0x8417('0xd'),auth['isAuthenticated'](),controller[_0x8417('0xe')]);router[_0x8417('0xa')](_0x8417('0xf'),auth[_0x8417('0x9')](),controller[_0x8417('0x10')]);router[_0x8417('0xa')](_0x8417('0x11'),auth[_0x8417('0x9')](),controller[_0x8417('0x12')]);router['get']('/:id/users',auth[_0x8417('0x9')](),controller[_0x8417('0x13')]);router['post']('/',auth[_0x8417('0x9')](),controller[_0x8417('0x14')]);router[_0x8417('0x15')](_0x8417('0x11'),auth[_0x8417('0x9')](),controller[_0x8417('0x16')]);router['post'](_0x8417('0x17'),auth[_0x8417('0x9')](),controller[_0x8417('0x18')]);router[_0x8417('0x19')](_0x8417('0xd'),auth['isAuthenticated'](),controller[_0x8417('0x1a')]);router[_0x8417('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8417('0x1c')]);router['delete']('/:id/teams',auth[_0x8417('0x9')](),controller[_0x8417('0x1d')]);router[_0x8417('0x1b')]('/:id/users',auth[_0x8417('0x9')](),controller[_0x8417('0x1e')]);module[_0x8417('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d3d38e2..d6dfaaf 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 _0xde2c=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x5972eb,_0xb79770){var _0x314a72=function(_0x586ebf){while(--_0x586ebf){_0x5972eb['push'](_0x5972eb['shift']());}};_0x314a72(++_0xb79770);}(_0xde2c,0x7f));var _0xcde2=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xde2c[_0x46ae5a];return _0x434986;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'name':{'type':Sequelize[_0xcde2('0x2')],'unique':_0xcde2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcde2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcde2('0x5')](_0xcde2('0x6'),_0xcde2('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xcde2('0x2')]}}; \ No newline at end of file +var _0xfa12=['roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x522fef,_0x2002b3){_0x522fef=_0x522fef-0x0;var _0x58ddd7=_0xfa12[_0x522fef];return _0x58ddd7;};'use strict';var Sequelize=require(_0x2fa1('0x0'));module[_0x2fa1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2fa1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2fa1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fa1('0x4')](_0x2fa1('0x5'),'beepall',_0x2fa1('0x6'))},'description':{'type':Sequelize[_0x2fa1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dc4880c..90229aa 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 _0x2ce7=['../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','set','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','send','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','order','sort','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','pick','getTeams','nolimit','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','removeTeams','ids','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis'];(function(_0x5192d3,_0x420f97){var _0x3341c6=function(_0x17c0e1){while(--_0x17c0e1){_0x5192d3['push'](_0x5192d3['shift']());}};_0x3341c6(++_0x420f97);}(_0x2ce7,0x166));var _0x72ce=function(_0x551867,_0x51706a){_0x551867=_0x551867-0x0;var _0x58b257=_0x2ce7[_0x551867];return _0x58b257;};'use strict';var BPromise=require(_0x72ce('0x0'));var util=require(_0x72ce('0x1'));var _=require(_0x72ce('0x2'));var squel=require(_0x72ce('0x3'));var Redis=require(_0x72ce('0x4'));var qs=require(_0x72ce('0x5'));var logger=require(_0x72ce('0x6'))('api');var config=require(_0x72ce('0x7'));var db=require('../../mysqldb')['db'];config[_0x72ce('0x8')]=_['defaults'](config[_0x72ce('0x8')],{'host':_0x72ce('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x72ce('0xa'))[_0x72ce('0xb')](socket);function respondWithStatusCode(_0x317c31,_0x2c214b){_0x2c214b=_0x2c214b||0xcc;return function(_0x51290f){if(_0x51290f){return _0x317c31['sendStatus'](_0x2c214b);}return _0x317c31[_0x72ce('0xc')](_0x2c214b)[_0x72ce('0xd')]();};}function respondWithResult(_0x4332cd,_0x330c42){_0x330c42=_0x330c42||0xc8;return function(_0x33e045){if(_0x33e045){return _0x4332cd[_0x72ce('0xc')](_0x330c42)[_0x72ce('0xe')](_0x33e045);}};}function respondWithFilteredResult(_0x1d588a,_0x3644f5){return function(_0x59695f){if(_0x59695f){var _0x216de7=typeof _0x3644f5[_0x72ce('0xf')]===_0x72ce('0x10')&&typeof _0x3644f5[_0x72ce('0x11')]==='undefined';var _0x13e7d9=_0x59695f[_0x72ce('0x12')];var _0x51d5cc=_0x216de7?0x0:_0x3644f5[_0x72ce('0xf')];var _0x219b66=_0x216de7?_0x59695f[_0x72ce('0x12')]:_0x3644f5[_0x72ce('0xf')]+_0x3644f5[_0x72ce('0x11')];var _0x35c4c3;if(_0x219b66>=_0x13e7d9){_0x219b66=_0x13e7d9;_0x35c4c3=0xc8;}else{_0x35c4c3=0xce;}_0x1d588a[_0x72ce('0xc')](_0x35c4c3);return _0x1d588a[_0x72ce('0x13')]('Content-Range',_0x51d5cc+'-'+_0x219b66+'/'+_0x13e7d9)[_0x72ce('0xe')](_0x59695f);}return null;};}function saveUpdates(_0x4c8efa){return function(_0x13eb26){if(_0x13eb26){return _0x13eb26['update'](_0x4c8efa)['then'](function(_0x381ee){return _0x381ee;});}return null;};}function removeEntity(_0x49f5dd){return function(_0x3de0e1){if(_0x3de0e1){return _0x3de0e1[_0x72ce('0x14')]()[_0x72ce('0x15')](function(){var _0x42dcc8=_0x3de0e1[_0x72ce('0x16')]({'plain':!![]});var _0xfc0cbc=_0x72ce('0x17');return db[_0x72ce('0x18')][_0x72ce('0x14')]({'where':{'type':_0xfc0cbc,'resourceId':_0x42dcc8['id']}})[_0x72ce('0x15')](function(){return _0x3de0e1;});})[_0x72ce('0x15')](function(){_0x49f5dd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x597a75){return function(_0x5ce02c){if(!_0x5ce02c){_0x597a75[_0x72ce('0x19')](0x194);}return _0x5ce02c;};}function handleError(_0x4355f,_0x1718df){_0x1718df=_0x1718df||0x1f4;return function(_0x42e8d6){logger[_0x72ce('0x1a')](_0x42e8d6['stack']);if(_0x42e8d6['name']){delete _0x42e8d6['name'];}_0x4355f[_0x72ce('0xc')](_0x1718df)[_0x72ce('0x1b')](_0x42e8d6);};}exports['index']=function(_0x341bb1,_0x20b49d){var _0x10cdb0={};var _0x3bc405={'count':0x0,'rows':[]};var _0x1a0c90=_[_0x72ce('0x1c')](db[_0x72ce('0x1d')][_0x72ce('0x1e')],function(_0x3ed802){return{'name':_0x3ed802[_0x72ce('0x1f')],'type':_0x3ed802['type'][_0x72ce('0x20')]};});_0x10cdb0=qs[_0x72ce('0x21')](_0x1a0c90,_0x341bb1);var _0x17449c={'where':_0x10cdb0[_0x72ce('0x22')]};return db[_0x72ce('0x1d')]['count'](_0x17449c)[_0x72ce('0x15')](function(_0x337c8b){_0x3bc405['count']=_0x337c8b;_0x10cdb0[_0x72ce('0x23')]=qs[_0x72ce('0x23')](_0x341bb1[_0x72ce('0x24')]);return db['WhatsappQueue'][_0x72ce('0x25')](_0x10cdb0);})[_0x72ce('0x15')](function(_0x3849f6){_0x3bc405['rows']=_0x3849f6;return _0x3bc405;})['then'](respondWithFilteredResult(_0x20b49d,_0x10cdb0))[_0x72ce('0x26')](handleError(_0x20b49d,null));};exports[_0x72ce('0x27')]=function(_0x3270e6,_0x493041){var _0x1b9c6b={'raw':!![],'where':{'id':_0x3270e6[_0x72ce('0x28')]['id']}},_0x1ea6a2={};_0x1ea6a2[_0x72ce('0x29')]=_[_0x72ce('0x2a')](db[_0x72ce('0x1d')][_0x72ce('0x1e')]);_0x1ea6a2[_0x72ce('0x24')]=_[_0x72ce('0x2a')](_0x3270e6[_0x72ce('0x24')]);_0x1ea6a2[_0x72ce('0x2b')]=_[_0x72ce('0x2c')](_0x1ea6a2[_0x72ce('0x29')],_0x1ea6a2[_0x72ce('0x24')]);_0x1b9c6b[_0x72ce('0x2d')]=_[_0x72ce('0x2c')](_0x1ea6a2[_0x72ce('0x29')],qs[_0x72ce('0x2e')](_0x3270e6[_0x72ce('0x24')][_0x72ce('0x2e')]));_0x1b9c6b[_0x72ce('0x2d')]=_0x1b9c6b[_0x72ce('0x2d')]['length']?_0x1b9c6b[_0x72ce('0x2d')]:_0x1ea6a2[_0x72ce('0x29')];if(_0x3270e6[_0x72ce('0x24')]['includeAll']){_0x1b9c6b['include']=[{'all':!![]}];}_0x1b9c6b=_[_0x72ce('0x2f')]({},_0x1b9c6b,_0x3270e6[_0x72ce('0x30')]);return db['WhatsappQueue'][_0x72ce('0x31')](_0x1b9c6b)[_0x72ce('0x15')](handleEntityNotFound(_0x493041,null))['then'](respondWithResult(_0x493041,null))[_0x72ce('0x26')](handleError(_0x493041,null));};exports[_0x72ce('0x32')]=function(_0x3fddfa,_0x119787){return db[_0x72ce('0x1d')]['create'](_0x3fddfa[_0x72ce('0x33')],{})[_0x72ce('0x15')](function(_0x1af557){var _0x32787e=_0x3fddfa[_0x72ce('0x34')][_0x72ce('0x16')]({'plain':!![]});if(!_0x32787e)throw new Error(_0x72ce('0x35'));if(_0x32787e['role']===_0x72ce('0x34')){var _0x327a6c=_0x1af557[_0x72ce('0x16')]({'plain':!![]});var _0x8f3f1f=_0x72ce('0x17');return db[_0x72ce('0x36')]['find']({'where':{'name':_0x8f3f1f,'userProfileId':_0x32787e[_0x72ce('0x37')]},'raw':!![]})[_0x72ce('0x15')](function(_0x2fc17a){if(_0x2fc17a&&_0x2fc17a['autoAssociation']===0x0){return db[_0x72ce('0x18')][_0x72ce('0x32')]({'name':_0x327a6c[_0x72ce('0x38')],'resourceId':_0x327a6c['id'],'type':_0x2fc17a[_0x72ce('0x38')],'sectionId':_0x2fc17a['id']},{})[_0x72ce('0x15')](function(){return _0x1af557;});}else{return _0x1af557;}})[_0x72ce('0x26')](function(_0x349805){logger['error'](_0x72ce('0x39'),_0x349805);throw _0x349805;});}return _0x1af557;})[_0x72ce('0x15')](respondWithResult(_0x119787,0xc9))[_0x72ce('0x26')](handleError(_0x119787,null));};exports['update']=function(_0x384b0b,_0x112641){if(_0x384b0b[_0x72ce('0x33')]['id']){delete _0x384b0b[_0x72ce('0x33')]['id'];}return db[_0x72ce('0x1d')][_0x72ce('0x31')]({'where':{'id':_0x384b0b[_0x72ce('0x28')]['id']}})[_0x72ce('0x15')](handleEntityNotFound(_0x112641,null))[_0x72ce('0x15')](saveUpdates(_0x384b0b['body'],null))[_0x72ce('0x15')](respondWithResult(_0x112641,null))[_0x72ce('0x26')](handleError(_0x112641,null));};exports[_0x72ce('0x14')]=function(_0x24f70a,_0x209519){return db['WhatsappQueue'][_0x72ce('0x31')]({'where':{'id':_0x24f70a[_0x72ce('0x28')]['id']}})[_0x72ce('0x15')](handleEntityNotFound(_0x209519,null))[_0x72ce('0x15')](removeEntity(_0x209519,null))[_0x72ce('0x26')](handleError(_0x209519,null));};exports['describe']=function(_0x3d3a1d,_0x2cda6a){return db[_0x72ce('0x1d')][_0x72ce('0x3a')]()[_0x72ce('0x15')](respondWithResult(_0x2cda6a,null))['catch'](handleError(_0x2cda6a,null));};exports[_0x72ce('0x3b')]=function(_0x41ec9e,_0x59a99e){var _0x5e32e2={'raw':!![],'where':{}},_0x43bb77={},_0x26ce67;return db[_0x72ce('0x1d')][_0x72ce('0x3c')]({'where':{'id':_0x41ec9e[_0x72ce('0x28')]['id']}})['then'](handleEntityNotFound(_0x59a99e,null))['then'](function(_0x432558){if(_0x432558){_0x26ce67=_0x432558['get']({'plain':!![]});_0x43bb77[_0x72ce('0x29')]=_[_0x72ce('0x2a')](db[_0x72ce('0x3d')][_0x72ce('0x1e')]);_0x43bb77['query']=_[_0x72ce('0x2a')](_0x41ec9e[_0x72ce('0x24')]);_0x43bb77[_0x72ce('0x2b')]=_[_0x72ce('0x2c')](_0x43bb77[_0x72ce('0x29')],_0x43bb77['query']);_0x5e32e2['attributes']=_['intersection'](_0x43bb77[_0x72ce('0x29')],qs[_0x72ce('0x2e')](_0x41ec9e[_0x72ce('0x24')][_0x72ce('0x2e')]));_0x5e32e2[_0x72ce('0x2d')]=_0x5e32e2['attributes'][_0x72ce('0x3e')]?_0x5e32e2[_0x72ce('0x2d')]:_0x43bb77['model'];if(!_0x41ec9e[_0x72ce('0x24')][_0x72ce('0x3f')]('nolimit')){_0x5e32e2[_0x72ce('0x11')]=qs[_0x72ce('0x11')](_0x41ec9e[_0x72ce('0x24')]['limit']);_0x5e32e2[_0x72ce('0xf')]=qs[_0x72ce('0xf')](_0x41ec9e[_0x72ce('0x24')]['offset']);}_0x5e32e2[_0x72ce('0x40')]=qs[_0x72ce('0x41')](_0x41ec9e[_0x72ce('0x24')][_0x72ce('0x41')]);_0x5e32e2[_0x72ce('0x22')]=qs['filters'](_['pick'](_0x41ec9e['query'],_0x43bb77[_0x72ce('0x2b')]));_0x5e32e2['where'][_0x72ce('0x42')]=_0x432558['id'];if(_0x41ec9e[_0x72ce('0x24')]['filter']){_0x5e32e2[_0x72ce('0x22')]=_[_0x72ce('0x2f')](_0x5e32e2[_0x72ce('0x22')],{'$or':_[_0x72ce('0x1c')](_0x5e32e2[_0x72ce('0x2d')],function(_0x4c083a){var _0x304c6d={};_0x304c6d[_0x4c083a]={'$like':'%'+_0x41ec9e['query'][_0x72ce('0x43')]+'%'};return _0x304c6d;})});}_0x5e32e2=_[_0x72ce('0x2f')]({},_0x5e32e2,_0x41ec9e['options']);return db['UserWhatsappQueue'][_0x72ce('0x25')](_0x5e32e2);}})['then'](function(_0x8365ea){if(_0x8365ea){return db[_0x72ce('0x44')][_0x72ce('0x45')]({'where':{'id':_[_0x72ce('0x1c')](_0x8365ea,_0x72ce('0x46')),'role':_0x72ce('0x47')},'attributes':['id',_0x72ce('0x38'),_0x72ce('0x48'),_0x72ce('0x49'),_0x72ce('0x4a')]});}})[_0x72ce('0x15')](function(_0x5bc4c0){if(_0x5bc4c0){return{'count':_0x5bc4c0[_0x72ce('0x12')],'rows':_[_0x72ce('0x1c')](_0x5bc4c0[_0x72ce('0x4b')],function(_0x36c885){return{'membername':_0x36c885['name'],'UserId':_0x36c885['id'],'queue_name':_0x26ce67['name'],'WhatsappQueueId':_0x26ce67['id'],'interface':util[_0x72ce('0x4c')](_0x72ce('0x4d'),_0x72ce('0x4e'),_0x36c885[_0x72ce('0x38')]),'penalty':0x0,'paused':_0x36c885[_0x72ce('0x48')],'createdAt':_0x36c885[_0x72ce('0x4a')],'updatedAt':_0x36c885['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x72ce('0x15')](respondWithFilteredResult(_0x59a99e,_0x5e32e2))[_0x72ce('0x26')](handleError(_0x59a99e,null));};exports['getTeams']=function(_0x13ff50,_0x4712af){var _0x156c92={};var _0xc6e452={};var _0x39abdf;var _0x34bd3d;return db[_0x72ce('0x1d')]['findOne']({'where':{'id':_0x13ff50[_0x72ce('0x28')]['id']}})[_0x72ce('0x15')](handleEntityNotFound(_0x4712af,null))['then'](function(_0x4be50b){if(_0x4be50b){_0x39abdf=_0x4be50b;_0xc6e452[_0x72ce('0x29')]=_['keys'](db[_0x72ce('0x4f')][_0x72ce('0x1e')]);_0xc6e452[_0x72ce('0x24')]=_[_0x72ce('0x2a')](_0x13ff50['query']);_0xc6e452[_0x72ce('0x2b')]=_[_0x72ce('0x2c')](_0xc6e452[_0x72ce('0x29')],_0xc6e452[_0x72ce('0x24')]);_0x156c92[_0x72ce('0x2d')]=_[_0x72ce('0x2c')](_0xc6e452['model'],qs['fields'](_0x13ff50[_0x72ce('0x24')][_0x72ce('0x2e')]));_0x156c92[_0x72ce('0x2d')]=_0x156c92['attributes']['length']?_0x156c92[_0x72ce('0x2d')]:_0xc6e452[_0x72ce('0x29')];_0x156c92['order']=qs[_0x72ce('0x41')](_0x13ff50[_0x72ce('0x24')][_0x72ce('0x41')]);_0x156c92[_0x72ce('0x22')]=qs[_0x72ce('0x2b')](_[_0x72ce('0x50')](_0x13ff50[_0x72ce('0x24')],_0xc6e452[_0x72ce('0x2b')]));if(_0x13ff50[_0x72ce('0x24')][_0x72ce('0x43')]){_0x156c92['where']=_[_0x72ce('0x2f')](_0x156c92[_0x72ce('0x22')],{'$or':_['map'](_0x156c92[_0x72ce('0x2d')],function(_0x1f5875){var _0x85537c={};_0x85537c[_0x1f5875]={'$like':'%'+_0x13ff50[_0x72ce('0x24')][_0x72ce('0x43')]+'%'};return _0x85537c;})});}_0x156c92=_[_0x72ce('0x2f')]({},_0x156c92,_0x13ff50['options']);return _0x39abdf[_0x72ce('0x51')](_0x156c92);}})['then'](function(_0x87b1c4){if(_0x87b1c4){_0x34bd3d=_0x87b1c4[_0x72ce('0x3e')];if(!_0x13ff50['query']['hasOwnProperty'](_0x72ce('0x52'))){_0x156c92[_0x72ce('0x11')]=qs['limit'](_0x13ff50[_0x72ce('0x24')][_0x72ce('0x11')]);_0x156c92[_0x72ce('0xf')]=qs[_0x72ce('0xf')](_0x13ff50[_0x72ce('0x24')][_0x72ce('0xf')]);}return _0x39abdf[_0x72ce('0x51')](_0x156c92);}})[_0x72ce('0x15')](function(_0x344fa1){if(_0x344fa1){return _0x344fa1?{'count':_0x34bd3d,'rows':_0x344fa1}:null;}})[_0x72ce('0x15')](respondWithResult(_0x4712af,null))[_0x72ce('0x26')](handleError(_0x4712af,null));};exports['addTeams']=function(_0x1c8255,_0x289ceb){var _0x1b5aa6=_0x1c8255['body']['ids'];return db[_0x72ce('0x4f')][_0x72ce('0x25')]({'where':{'id':_0x1b5aa6},'attributes':['id'],'include':[{'model':db[_0x72ce('0x44')],'as':_0x72ce('0x53'),'attributes':['id','name',_0x72ce('0x54'),'voicePause',_0x72ce('0x55')],'raw':!![]}]})[_0x72ce('0x15')](function(_0x3659db){if(_0x3659db){var _0x3e246e=_[_0x72ce('0x56')](_0x3659db,function(_0xbec129){var _0x2c9af5=_0xbec129[_0x72ce('0x16')]({'plain':!![]});return _0x2c9af5[_0x72ce('0x53')];});return db[_0x72ce('0x1d')]['find']({'where':{'id':_0x1c8255[_0x72ce('0x28')]['id']}})[_0x72ce('0x15')](function(_0x363b2e){return db[_0x72ce('0x57')][_0x72ce('0x58')](function(_0x2648ee){return _0x363b2e[_0x72ce('0x59')](_0x1b5aa6,{'transaction':_0x2648ee})['then'](function(){return BPromise[_0x72ce('0x5a')](_0x3e246e,function(_0x1c7e7b){return db[_0x72ce('0x3d')]['findOrCreate']({'where':{'UserId':_0x1c7e7b['id'],'WhatsappQueueId':_0x1c8255['params']['id']},'transaction':_0x2648ee});});})['then'](function(){_0x3e246e[_0x72ce('0x5b')](function(_0x5a484b){socket[_0x72ce('0x5c')]('userWhatsappQueue:save',{'UserId':_0x5a484b['id'],'WhatsappQueueId':_0x363b2e['id']});});});});});}})['then'](respondWithStatusCode(_0x289ceb,null))[_0x72ce('0x26')](handleError(_0x289ceb,null));};exports[_0x72ce('0x5d')]=function(_0x3e063d,_0x14eca7){return db[_0x72ce('0x4f')]['findAll']({'where':{'id':_0x3e063d[_0x72ce('0x24')][_0x72ce('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x72ce('0x44')],'as':_0x72ce('0x53'),'attributes':['id'],'raw':!![]}]})[_0x72ce('0x15')](handleEntityNotFound(_0x14eca7,null))[_0x72ce('0x15')](function(_0x17a6bb){var _0x4abd40=_[_0x72ce('0x1c')](_0x17a6bb,'id');var _0x187a8f=[];var _0x59c15a=[];var _0x48ad7c=squel[_0x72ce('0x5f')]();_0x48ad7c[_0x72ce('0x60')]('tq.TeamId')[_0x72ce('0x61')](_0x72ce('0x62'),'tq')[_0x72ce('0x63')](_0x72ce('0x64'),'ut',_0x72ce('0x65'))[_0x72ce('0x22')](_0x72ce('0x66'),_0x3e063d['params']['id']);for(var _0x55bf94=0x0;_0x55bf94<_0x17a6bb[_0x72ce('0x3e')];_0x55bf94+=0x1){let _0x5211f4=_0x17a6bb[_0x55bf94];for(var _0x4602ab=0x0;_0x4602ab<_0x5211f4[_0x72ce('0x53')]['length'];_0x4602ab+=0x1){let _0xcfc7c=_0x5211f4[_0x72ce('0x53')][_0x4602ab];var _0x56e0b4=_0x48ad7c['clone']();_0x56e0b4[_0x72ce('0x22')](_0x72ce('0x67'),_0xcfc7c['id']);_0x59c15a['push'](db[_0x72ce('0x57')][_0x72ce('0x24')](_0x56e0b4[_0x72ce('0x68')](),{'type':db[_0x72ce('0x57')][_0x72ce('0x69')][_0x72ce('0x6a')]})[_0x72ce('0x15')](function(_0x207cac){if(_0x207cac[_0x72ce('0x3e')]===0x1){return _0xcfc7c['id'];}else{var _0x2bd065=_['every'](_[_0x72ce('0x1c')](_0x207cac,_0x72ce('0x6b')),function(_0x29a0be){return _[_0x72ce('0x6c')](_0x4abd40,_0x29a0be);});if(_0x2bd065){return _0xcfc7c['id'];}}}));}}return BPromise[_0x72ce('0x6d')](_0x59c15a)[_0x72ce('0x15')](function(_0x1818c0){_0x187a8f=_(_0x187a8f)['union'](_0x1818c0)[_0x72ce('0x6e')]()[_0x72ce('0x6f')]();return db[_0x72ce('0x1d')][_0x72ce('0x31')]({'where':{'id':_0x3e063d[_0x72ce('0x28')]['id']}})[_0x72ce('0x15')](function(_0x24d9bd){return db['sequelize'][_0x72ce('0x58')](function(_0x3f422e){return _0x24d9bd[_0x72ce('0x5d')](_0x3e063d[_0x72ce('0x24')][_0x72ce('0x5e')],{'transaction':_0x3f422e})[_0x72ce('0x15')](function(){if(!_[_0x72ce('0x70')](_0x187a8f)){return _0x24d9bd[_0x72ce('0x71')](_0x187a8f,{'transaction':_0x3f422e});}})[_0x72ce('0x15')](function(){_0x187a8f[_0x72ce('0x5b')](function(_0x203fc6){socket['emit'](_0x72ce('0x72'),{'UserId':_0x203fc6,'WhatsappQueueId':_0x24d9bd['id']});});});});});});})[_0x72ce('0x15')](respondWithStatusCode(_0x14eca7,null))[_0x72ce('0x26')](handleError(_0x14eca7,null));};exports['addAgents']=function(_0x2cf59c,_0x38b83e){return db['WhatsappQueue'][_0x72ce('0x31')]({'where':{'id':_0x2cf59c[_0x72ce('0x28')]['id']}})['then'](handleEntityNotFound(_0x38b83e,null))[_0x72ce('0x15')](function(_0x3ddcfd){if(_0x3ddcfd){return _0x3ddcfd[_0x72ce('0x73')](_0x2cf59c[_0x72ce('0x33')][_0x72ce('0x5e')],_[_0x72ce('0x74')](_0x2cf59c[_0x72ce('0x33')],[_0x72ce('0x5e'),'id'])||{})[_0x72ce('0x75')](function(_0x2ccea3){for(var _0x15459a=0x0;_0x15459a<_0x2cf59c['body']['ids'][_0x72ce('0x3e')];_0x15459a+=0x1){socket[_0x72ce('0x5c')](_0x72ce('0x76'),{'UserId':Number(_0x2cf59c['body']['ids'][_0x15459a]),'WhatsappQueueId':Number(_0x2cf59c[_0x72ce('0x28')]['id'])});}return _0x2ccea3;});}})[_0x72ce('0x15')](respondWithResult(_0x38b83e,null))[_0x72ce('0x26')](handleError(_0x38b83e,null));};exports[_0x72ce('0x71')]=function(_0x67f7,_0x356b03){return db['WhatsappQueue'][_0x72ce('0x31')]({'where':{'id':_0x67f7['params']['id']}})[_0x72ce('0x15')](handleEntityNotFound(_0x356b03,null))[_0x72ce('0x15')](function(_0x1a700a){if(_0x1a700a){return _0x1a700a['removeAgents'](_0x67f7[_0x72ce('0x24')][_0x72ce('0x5e')])[_0x72ce('0x15')](function(){if(_[_0x72ce('0x77')](_0x67f7[_0x72ce('0x24')]['ids'])){for(var _0x5c613f=0x0;_0x5c613f<_0x67f7['query'][_0x72ce('0x5e')][_0x72ce('0x3e')];_0x5c613f+=0x1){socket[_0x72ce('0x5c')](_0x72ce('0x72'),{'UserId':Number(_0x67f7[_0x72ce('0x24')][_0x72ce('0x5e')][_0x5c613f]),'WhatsappQueueId':Number(_0x67f7['params']['id'])});}}else{socket['emit'](_0x72ce('0x72'),{'UserId':Number(_0x67f7[_0x72ce('0x24')][_0x72ce('0x5e')]),'WhatsappQueueId':Number(_0x67f7[_0x72ce('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x356b03,null))[_0x72ce('0x26')](handleError(_0x356b03,null));};exports[_0x72ce('0x78')]=function(_0x6dbaab,_0x4a679e){var _0x50652b={};var _0x488b78={};var _0xd6eadf;var _0x599a96;return db[_0x72ce('0x1d')][_0x72ce('0x3c')]({'where':{'id':_0x6dbaab[_0x72ce('0x28')]['id']}})['then'](handleEntityNotFound(_0x4a679e,null))[_0x72ce('0x15')](function(_0x1a0bd2){if(_0x1a0bd2){_0xd6eadf=_0x1a0bd2;_0x488b78['model']=_[_0x72ce('0x2a')](db[_0x72ce('0x44')]['rawAttributes']);_0x488b78[_0x72ce('0x24')]=_[_0x72ce('0x2a')](_0x6dbaab[_0x72ce('0x24')]);_0x488b78['filters']=_[_0x72ce('0x2c')](_0x488b78['model'],_0x488b78[_0x72ce('0x24')]);_0x50652b[_0x72ce('0x2d')]=_[_0x72ce('0x2c')](_0x488b78[_0x72ce('0x29')],qs[_0x72ce('0x2e')](_0x6dbaab[_0x72ce('0x24')][_0x72ce('0x2e')]));_0x50652b[_0x72ce('0x2d')]=_0x50652b[_0x72ce('0x2d')]['length']?_0x50652b[_0x72ce('0x2d')]:_0x488b78[_0x72ce('0x29')];_0x50652b[_0x72ce('0x40')]=qs[_0x72ce('0x41')](_0x6dbaab[_0x72ce('0x24')][_0x72ce('0x41')]);_0x50652b[_0x72ce('0x22')]=qs[_0x72ce('0x2b')](_['pick'](_0x6dbaab['query'],_0x488b78[_0x72ce('0x2b')]));if(_0x6dbaab[_0x72ce('0x24')][_0x72ce('0x43')]){_0x50652b[_0x72ce('0x22')]=_[_0x72ce('0x2f')](_0x50652b[_0x72ce('0x22')],{'$or':_['map'](_0x50652b[_0x72ce('0x2d')],function(_0x50b3ea){var _0x515d88={};_0x515d88[_0x50b3ea]={'$like':'%'+_0x6dbaab[_0x72ce('0x24')]['filter']+'%'};return _0x515d88;})});}_0x50652b=_[_0x72ce('0x2f')]({},_0x50652b,_0x6dbaab[_0x72ce('0x30')]);return _0xd6eadf[_0x72ce('0x78')](_0x50652b);}})['then'](function(_0x2ed51f){if(_0x2ed51f){_0x599a96=_0x2ed51f[_0x72ce('0x3e')];if(!_0x6dbaab[_0x72ce('0x24')][_0x72ce('0x3f')](_0x72ce('0x52'))){_0x50652b[_0x72ce('0x11')]=qs['limit'](_0x6dbaab[_0x72ce('0x24')]['limit']);_0x50652b[_0x72ce('0xf')]=qs[_0x72ce('0xf')](_0x6dbaab[_0x72ce('0x24')][_0x72ce('0xf')]);}return _0xd6eadf[_0x72ce('0x78')](_0x50652b);}})[_0x72ce('0x15')](function(_0x90a397){if(_0x90a397){return _0x90a397?{'count':_0x599a96,'rows':_0x90a397}:null;}})[_0x72ce('0x15')](respondWithResult(_0x4a679e,null))[_0x72ce('0x26')](handleError(_0x4a679e,null));}; \ No newline at end of file +var _0xc704=['getMembers','keys','filters','nolimit','order','sort','pick','filter','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','index','map','WhatsappQueue','key','getOptions','where','include','findAll','rows','catch','show','params','model','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','get','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0xc86eac,_0x3ca973){var _0x42d0ab=function(_0x402fdb){while(--_0x402fdb){_0xc86eac['push'](_0xc86eac['shift']());}};_0x42d0ab(++_0x3ca973);}(_0xc704,0xb4));var _0x4c70=function(_0x35329f,_0x1f40f6){_0x35329f=_0x35329f-0x0;var _0x36ae9a=_0xc704[_0x35329f];return _0x36ae9a;};'use strict';var BPromise=require(_0x4c70('0x0'));var util=require('util');var _=require(_0x4c70('0x1'));var squel=require(_0x4c70('0x2'));var Redis=require(_0x4c70('0x3'));var qs=require(_0x4c70('0x4'));var logger=require(_0x4c70('0x5'))(_0x4c70('0x6'));var config=require(_0x4c70('0x7'));var db=require(_0x4c70('0x8'))['db'];config[_0x4c70('0x9')]=_[_0x4c70('0xa')](config[_0x4c70('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c70('0xb'))(new Redis(config['redis']));require(_0x4c70('0xc'))[_0x4c70('0xd')](socket);function respondWithStatusCode(_0x4ecc0f,_0x23f99a){_0x23f99a=_0x23f99a||0xcc;return function(_0x5a0677){if(_0x5a0677){return _0x4ecc0f['sendStatus'](_0x23f99a);}return _0x4ecc0f[_0x4c70('0xe')](_0x23f99a)[_0x4c70('0xf')]();};}function respondWithResult(_0x4e7a97,_0x70afb3){_0x70afb3=_0x70afb3||0xc8;return function(_0x5ddef5){if(_0x5ddef5){return _0x4e7a97[_0x4c70('0xe')](_0x70afb3)[_0x4c70('0x10')](_0x5ddef5);}};}function respondWithFilteredResult(_0x3cc874,_0x4aacec){return function(_0x5996bf){if(_0x5996bf){var _0x37aee2=typeof _0x4aacec[_0x4c70('0x11')]===_0x4c70('0x12')&&typeof _0x4aacec['limit']===_0x4c70('0x12');var _0x1fb186=_0x5996bf[_0x4c70('0x13')];var _0x14c692=_0x37aee2?0x0:_0x4aacec[_0x4c70('0x11')];var _0x4b47fc=_0x37aee2?_0x5996bf[_0x4c70('0x13')]:_0x4aacec[_0x4c70('0x11')]+_0x4aacec[_0x4c70('0x14')];var _0x346181;if(_0x4b47fc>=_0x1fb186){_0x4b47fc=_0x1fb186;_0x346181=0xc8;}else{_0x346181=0xce;}_0x3cc874[_0x4c70('0xe')](_0x346181);return _0x3cc874[_0x4c70('0x15')](_0x4c70('0x16'),_0x14c692+'-'+_0x4b47fc+'/'+_0x1fb186)['json'](_0x5996bf);}return null;};}function saveUpdates(_0x26b1fa){return function(_0x4ba630){if(_0x4ba630){return _0x4ba630[_0x4c70('0x17')](_0x26b1fa)[_0x4c70('0x18')](function(_0x4014d2){return _0x4014d2;});}return null;};}function removeEntity(_0xa00099){return function(_0x4f8baf){if(_0x4f8baf){return _0x4f8baf[_0x4c70('0x19')]()[_0x4c70('0x18')](function(){var _0x1c35c4=_0x4f8baf['get']({'plain':!![]});var _0x3c08ec=_0x4c70('0x1a');return db[_0x4c70('0x1b')]['destroy']({'where':{'type':_0x3c08ec,'resourceId':_0x1c35c4['id']}})[_0x4c70('0x18')](function(){return _0x4f8baf;});})[_0x4c70('0x18')](function(){_0xa00099[_0x4c70('0xe')](0xcc)[_0x4c70('0xf')]();});}};}function handleEntityNotFound(_0x270bf4){return function(_0x56d445){if(!_0x56d445){_0x270bf4[_0x4c70('0x1c')](0x194);}return _0x56d445;};}function handleError(_0x36a0f0,_0x504dd8){_0x504dd8=_0x504dd8||0x1f4;return function(_0x92db6d){logger[_0x4c70('0x1d')](_0x92db6d[_0x4c70('0x1e')]);if(_0x92db6d[_0x4c70('0x1f')]){delete _0x92db6d[_0x4c70('0x1f')];}_0x36a0f0[_0x4c70('0xe')](_0x504dd8)['send'](_0x92db6d);};}exports[_0x4c70('0x20')]=function(_0x1b91be,_0x431131){var _0x559504={};var _0x4836d6={'count':0x0,'rows':[]};var _0x4e87ea=_[_0x4c70('0x21')](db[_0x4c70('0x22')]['rawAttributes'],function(_0x4816e6){return{'name':_0x4816e6['fieldName'],'type':_0x4816e6['type'][_0x4c70('0x23')]};});_0x559504=qs[_0x4c70('0x24')](_0x4e87ea,_0x1b91be);var _0x564a62={'where':_0x559504[_0x4c70('0x25')]};return db[_0x4c70('0x22')]['count'](_0x564a62)[_0x4c70('0x18')](function(_0x4d19dd){_0x4836d6[_0x4c70('0x13')]=_0x4d19dd;_0x559504['include']=qs[_0x4c70('0x26')](_0x1b91be['query']);return db['WhatsappQueue'][_0x4c70('0x27')](_0x559504);})[_0x4c70('0x18')](function(_0x572483){_0x4836d6[_0x4c70('0x28')]=_0x572483;return _0x4836d6;})[_0x4c70('0x18')](respondWithFilteredResult(_0x431131,_0x559504))[_0x4c70('0x29')](handleError(_0x431131,null));};exports[_0x4c70('0x2a')]=function(_0x4442a7,_0x308430){var _0x393dd9={'raw':!![],'where':{'id':_0x4442a7[_0x4c70('0x2b')]['id']}},_0x432063={};_0x432063[_0x4c70('0x2c')]=_['keys'](db['WhatsappQueue'][_0x4c70('0x2d')]);_0x432063[_0x4c70('0x2e')]=_['keys'](_0x4442a7[_0x4c70('0x2e')]);_0x432063['filters']=_[_0x4c70('0x2f')](_0x432063['model'],_0x432063[_0x4c70('0x2e')]);_0x393dd9['attributes']=_[_0x4c70('0x2f')](_0x432063['model'],qs[_0x4c70('0x30')](_0x4442a7[_0x4c70('0x2e')][_0x4c70('0x30')]));_0x393dd9[_0x4c70('0x31')]=_0x393dd9['attributes'][_0x4c70('0x32')]?_0x393dd9[_0x4c70('0x31')]:_0x432063[_0x4c70('0x2c')];if(_0x4442a7['query'][_0x4c70('0x33')]){_0x393dd9[_0x4c70('0x26')]=[{'all':!![]}];}_0x393dd9=_[_0x4c70('0x34')]({},_0x393dd9,_0x4442a7[_0x4c70('0x35')]);return db[_0x4c70('0x22')][_0x4c70('0x36')](_0x393dd9)[_0x4c70('0x18')](handleEntityNotFound(_0x308430,null))[_0x4c70('0x18')](respondWithResult(_0x308430,null))[_0x4c70('0x29')](handleError(_0x308430,null));};exports[_0x4c70('0x37')]=function(_0x21568f,_0x8181d0){return db[_0x4c70('0x22')][_0x4c70('0x37')](_0x21568f[_0x4c70('0x38')],{})[_0x4c70('0x18')](function(_0x37421e){var _0x357a7e=_0x21568f['user'][_0x4c70('0x39')]({'plain':!![]});if(!_0x357a7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x357a7e[_0x4c70('0x3a')]===_0x4c70('0x3b')){var _0x38c4ce=_0x37421e[_0x4c70('0x39')]({'plain':!![]});var _0x4eb2fd=_0x4c70('0x1a');return db['UserProfileSection'][_0x4c70('0x36')]({'where':{'name':_0x4eb2fd,'userProfileId':_0x357a7e[_0x4c70('0x3c')]},'raw':!![]})[_0x4c70('0x18')](function(_0x1c4dc9){if(_0x1c4dc9&&_0x1c4dc9[_0x4c70('0x3d')]===0x0){return db['UserProfileResource'][_0x4c70('0x37')]({'name':_0x38c4ce[_0x4c70('0x1f')],'resourceId':_0x38c4ce['id'],'type':_0x1c4dc9[_0x4c70('0x1f')],'sectionId':_0x1c4dc9['id']},{})[_0x4c70('0x18')](function(){return _0x37421e;});}else{return _0x37421e;}})[_0x4c70('0x29')](function(_0x73324){logger['error'](_0x4c70('0x3e'),_0x73324);throw _0x73324;});}return _0x37421e;})[_0x4c70('0x18')](respondWithResult(_0x8181d0,0xc9))['catch'](handleError(_0x8181d0,null));};exports[_0x4c70('0x17')]=function(_0x212981,_0x276d8a){if(_0x212981[_0x4c70('0x38')]['id']){delete _0x212981[_0x4c70('0x38')]['id'];}return db[_0x4c70('0x22')][_0x4c70('0x36')]({'where':{'id':_0x212981[_0x4c70('0x2b')]['id']}})[_0x4c70('0x18')](handleEntityNotFound(_0x276d8a,null))['then'](saveUpdates(_0x212981[_0x4c70('0x38')],null))['then'](respondWithResult(_0x276d8a,null))['catch'](handleError(_0x276d8a,null));};exports['destroy']=function(_0x56a2c8,_0x1e2fe7){return db['WhatsappQueue'][_0x4c70('0x36')]({'where':{'id':_0x56a2c8[_0x4c70('0x2b')]['id']}})[_0x4c70('0x18')](handleEntityNotFound(_0x1e2fe7,null))['then'](removeEntity(_0x1e2fe7,null))[_0x4c70('0x29')](handleError(_0x1e2fe7,null));};exports[_0x4c70('0x3f')]=function(_0xed7b9b,_0x5ebfb7){return db[_0x4c70('0x22')]['describe']()[_0x4c70('0x18')](respondWithResult(_0x5ebfb7,null))[_0x4c70('0x29')](handleError(_0x5ebfb7,null));};exports[_0x4c70('0x40')]=function(_0x4b5fa8,_0xdf7ee4){var _0x1b2caf={'raw':!![],'where':{}},_0x4852a1={},_0x515fa8;return db[_0x4c70('0x22')]['findOne']({'where':{'id':_0x4b5fa8['params']['id']}})[_0x4c70('0x18')](handleEntityNotFound(_0xdf7ee4,null))['then'](function(_0x2dc594){if(_0x2dc594){_0x515fa8=_0x2dc594[_0x4c70('0x39')]({'plain':!![]});_0x4852a1[_0x4c70('0x2c')]=_[_0x4c70('0x41')](db['UserWhatsappQueue'][_0x4c70('0x2d')]);_0x4852a1[_0x4c70('0x2e')]=_['keys'](_0x4b5fa8[_0x4c70('0x2e')]);_0x4852a1[_0x4c70('0x42')]=_[_0x4c70('0x2f')](_0x4852a1['model'],_0x4852a1['query']);_0x1b2caf[_0x4c70('0x31')]=_[_0x4c70('0x2f')](_0x4852a1['model'],qs[_0x4c70('0x30')](_0x4b5fa8['query']['fields']));_0x1b2caf[_0x4c70('0x31')]=_0x1b2caf['attributes'][_0x4c70('0x32')]?_0x1b2caf['attributes']:_0x4852a1[_0x4c70('0x2c')];if(!_0x4b5fa8['query']['hasOwnProperty'](_0x4c70('0x43'))){_0x1b2caf[_0x4c70('0x14')]=qs[_0x4c70('0x14')](_0x4b5fa8[_0x4c70('0x2e')]['limit']);_0x1b2caf['offset']=qs[_0x4c70('0x11')](_0x4b5fa8['query'][_0x4c70('0x11')]);}_0x1b2caf[_0x4c70('0x44')]=qs[_0x4c70('0x45')](_0x4b5fa8[_0x4c70('0x2e')][_0x4c70('0x45')]);_0x1b2caf[_0x4c70('0x25')]=qs[_0x4c70('0x42')](_[_0x4c70('0x46')](_0x4b5fa8[_0x4c70('0x2e')],_0x4852a1['filters']));_0x1b2caf[_0x4c70('0x25')]['WhatsappQueueId']=_0x2dc594['id'];if(_0x4b5fa8[_0x4c70('0x2e')][_0x4c70('0x47')]){_0x1b2caf[_0x4c70('0x25')]=_['merge'](_0x1b2caf[_0x4c70('0x25')],{'$or':_[_0x4c70('0x21')](_0x1b2caf[_0x4c70('0x31')],function(_0x2b21db){var _0x5b2af0={};_0x5b2af0[_0x2b21db]={'$like':'%'+_0x4b5fa8['query']['filter']+'%'};return _0x5b2af0;})});}_0x1b2caf=_[_0x4c70('0x34')]({},_0x1b2caf,_0x4b5fa8[_0x4c70('0x35')]);return db[_0x4c70('0x48')][_0x4c70('0x27')](_0x1b2caf);}})[_0x4c70('0x18')](function(_0x19878d){if(_0x19878d){return db[_0x4c70('0x49')][_0x4c70('0x4a')]({'where':{'id':_['map'](_0x19878d,_0x4c70('0x4b')),'role':_0x4c70('0x4c')},'attributes':['id',_0x4c70('0x1f'),_0x4c70('0x4d'),_0x4c70('0x4e'),_0x4c70('0x4f')]});}})[_0x4c70('0x18')](function(_0x2733c9){if(_0x2733c9){return{'count':_0x2733c9['count'],'rows':_[_0x4c70('0x21')](_0x2733c9[_0x4c70('0x28')],function(_0x369b2d){return{'membername':_0x369b2d[_0x4c70('0x1f')],'UserId':_0x369b2d['id'],'queue_name':_0x515fa8[_0x4c70('0x1f')],'WhatsappQueueId':_0x515fa8['id'],'interface':util['format']('%s/%s','SIP',_0x369b2d[_0x4c70('0x1f')]),'penalty':0x0,'paused':_0x369b2d[_0x4c70('0x4d')],'createdAt':_0x369b2d[_0x4c70('0x4f')],'updatedAt':_0x369b2d[_0x4c70('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4c70('0x18')](respondWithFilteredResult(_0xdf7ee4,_0x1b2caf))[_0x4c70('0x29')](handleError(_0xdf7ee4,null));};exports[_0x4c70('0x50')]=function(_0x4bb6e4,_0x43eb1f){var _0x593edf={};var _0x598c51={};var _0x27c0a7;var _0xe0610b;return db[_0x4c70('0x22')]['findOne']({'where':{'id':_0x4bb6e4['params']['id']}})['then'](handleEntityNotFound(_0x43eb1f,null))[_0x4c70('0x18')](function(_0x357bd9){if(_0x357bd9){_0x27c0a7=_0x357bd9;_0x598c51['model']=_[_0x4c70('0x41')](db[_0x4c70('0x51')][_0x4c70('0x2d')]);_0x598c51['query']=_[_0x4c70('0x41')](_0x4bb6e4[_0x4c70('0x2e')]);_0x598c51[_0x4c70('0x42')]=_[_0x4c70('0x2f')](_0x598c51[_0x4c70('0x2c')],_0x598c51['query']);_0x593edf[_0x4c70('0x31')]=_[_0x4c70('0x2f')](_0x598c51[_0x4c70('0x2c')],qs[_0x4c70('0x30')](_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x30')]));_0x593edf['attributes']=_0x593edf[_0x4c70('0x31')]['length']?_0x593edf[_0x4c70('0x31')]:_0x598c51['model'];_0x593edf[_0x4c70('0x44')]=qs['sort'](_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x45')]);_0x593edf[_0x4c70('0x25')]=qs[_0x4c70('0x42')](_[_0x4c70('0x46')](_0x4bb6e4[_0x4c70('0x2e')],_0x598c51['filters']));if(_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x47')]){_0x593edf['where']=_[_0x4c70('0x34')](_0x593edf[_0x4c70('0x25')],{'$or':_[_0x4c70('0x21')](_0x593edf[_0x4c70('0x31')],function(_0x503e78){var _0x527294={};_0x527294[_0x503e78]={'$like':'%'+_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x47')]+'%'};return _0x527294;})});}_0x593edf=_[_0x4c70('0x34')]({},_0x593edf,_0x4bb6e4[_0x4c70('0x35')]);return _0x27c0a7[_0x4c70('0x50')](_0x593edf);}})['then'](function(_0x2d27ed){if(_0x2d27ed){_0xe0610b=_0x2d27ed[_0x4c70('0x32')];if(!_0x4bb6e4['query']['hasOwnProperty'](_0x4c70('0x43'))){_0x593edf['limit']=qs['limit'](_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x14')]);_0x593edf[_0x4c70('0x11')]=qs[_0x4c70('0x11')](_0x4bb6e4[_0x4c70('0x2e')][_0x4c70('0x11')]);}return _0x27c0a7['getTeams'](_0x593edf);}})[_0x4c70('0x18')](function(_0x6cfd77){if(_0x6cfd77){return _0x6cfd77?{'count':_0xe0610b,'rows':_0x6cfd77}:null;}})[_0x4c70('0x18')](respondWithResult(_0x43eb1f,null))[_0x4c70('0x29')](handleError(_0x43eb1f,null));};exports['addTeams']=function(_0x3c099c,_0x525659){var _0x57d80a=_0x3c099c[_0x4c70('0x38')][_0x4c70('0x52')];return db['Team']['findAll']({'where':{'id':_0x57d80a},'attributes':['id'],'include':[{'model':db[_0x4c70('0x49')],'as':'Agents','attributes':['id','name',_0x4c70('0x53'),_0x4c70('0x54'),_0x4c70('0x55')],'raw':!![]}]})[_0x4c70('0x18')](function(_0x3e18b7){if(_0x3e18b7){var _0xe42f21=_[_0x4c70('0x56')](_0x3e18b7,function(_0x539893){var _0x3c0c42=_0x539893[_0x4c70('0x39')]({'plain':!![]});return _0x3c0c42[_0x4c70('0x57')];});return db[_0x4c70('0x22')][_0x4c70('0x36')]({'where':{'id':_0x3c099c['params']['id']}})['then'](function(_0x4f3455){return db[_0x4c70('0x58')][_0x4c70('0x59')](function(_0x15bcef){return _0x4f3455[_0x4c70('0x5a')](_0x57d80a,{'transaction':_0x15bcef})[_0x4c70('0x18')](function(){return BPromise[_0x4c70('0x5b')](_0xe42f21,function(_0x3a8010){return db[_0x4c70('0x48')][_0x4c70('0x5c')]({'where':{'UserId':_0x3a8010['id'],'WhatsappQueueId':_0x3c099c[_0x4c70('0x2b')]['id']},'transaction':_0x15bcef});});})[_0x4c70('0x18')](function(){_0xe42f21[_0x4c70('0x5d')](function(_0x44a251){socket[_0x4c70('0x5e')](_0x4c70('0x5f'),{'UserId':_0x44a251['id'],'WhatsappQueueId':_0x4f3455['id']});});});});});}})[_0x4c70('0x18')](respondWithStatusCode(_0x525659,null))['catch'](handleError(_0x525659,null));};exports[_0x4c70('0x60')]=function(_0x169d64,_0x37619c){return db['Team'][_0x4c70('0x27')]({'where':{'id':_0x169d64[_0x4c70('0x2e')][_0x4c70('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4c70('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37619c,null))['then'](function(_0x134214){var _0xb82ce=_['map'](_0x134214,'id');var _0x355904=[];var _0x44b0ad=[];var _0x551136=squel[_0x4c70('0x61')]();_0x551136[_0x4c70('0x62')](_0x4c70('0x63'))[_0x4c70('0x64')](_0x4c70('0x65'),'tq')['join'](_0x4c70('0x66'),'ut',_0x4c70('0x67'))[_0x4c70('0x25')](_0x4c70('0x68'),_0x169d64[_0x4c70('0x2b')]['id']);for(var _0x44850c=0x0;_0x44850c<_0x134214['length'];_0x44850c+=0x1){let _0x3a9d6b=_0x134214[_0x44850c];for(var _0x49013a=0x0;_0x49013a<_0x3a9d6b[_0x4c70('0x57')][_0x4c70('0x32')];_0x49013a+=0x1){let _0xbe649d=_0x3a9d6b[_0x4c70('0x57')][_0x49013a];var _0x5b0c40=_0x551136[_0x4c70('0x69')]();_0x5b0c40[_0x4c70('0x25')]('ut.UserId\x20=\x20?',_0xbe649d['id']);_0x44b0ad[_0x4c70('0x6a')](db['sequelize'][_0x4c70('0x2e')](_0x5b0c40['toString'](),{'type':db[_0x4c70('0x58')][_0x4c70('0x6b')][_0x4c70('0x6c')]})[_0x4c70('0x18')](function(_0x303980){if(_0x303980[_0x4c70('0x32')]===0x1){return _0xbe649d['id'];}else{var _0x4f6405=_[_0x4c70('0x6d')](_[_0x4c70('0x21')](_0x303980,_0x4c70('0x6e')),function(_0x5152f6){return _[_0x4c70('0x6f')](_0xb82ce,_0x5152f6);});if(_0x4f6405){return _0xbe649d['id'];}}}));}}return BPromise['all'](_0x44b0ad)['then'](function(_0x52213b){_0x355904=_(_0x355904)['union'](_0x52213b)['compact']()[_0x4c70('0x70')]();return db[_0x4c70('0x22')][_0x4c70('0x36')]({'where':{'id':_0x169d64['params']['id']}})[_0x4c70('0x18')](function(_0x8d6cab){return db[_0x4c70('0x58')][_0x4c70('0x59')](function(_0x3e48a6){return _0x8d6cab[_0x4c70('0x60')](_0x169d64[_0x4c70('0x2e')][_0x4c70('0x52')],{'transaction':_0x3e48a6})['then'](function(){if(!_[_0x4c70('0x71')](_0x355904)){return _0x8d6cab['removeAgents'](_0x355904,{'transaction':_0x3e48a6});}})[_0x4c70('0x18')](function(){_0x355904[_0x4c70('0x5d')](function(_0x5778ee){socket[_0x4c70('0x5e')](_0x4c70('0x72'),{'UserId':_0x5778ee,'WhatsappQueueId':_0x8d6cab['id']});});});});});});})[_0x4c70('0x18')](respondWithStatusCode(_0x37619c,null))[_0x4c70('0x29')](handleError(_0x37619c,null));};exports[_0x4c70('0x73')]=function(_0x48b0bb,_0x3395ef){return db['WhatsappQueue']['find']({'where':{'id':_0x48b0bb[_0x4c70('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3395ef,null))[_0x4c70('0x18')](function(_0x421ea1){if(_0x421ea1){return _0x421ea1['addAgents'](_0x48b0bb[_0x4c70('0x38')]['ids'],_[_0x4c70('0x74')](_0x48b0bb[_0x4c70('0x38')],[_0x4c70('0x52'),'id'])||{})[_0x4c70('0x75')](function(_0x38e853){for(var _0x50c7d7=0x0;_0x50c7d7<_0x48b0bb[_0x4c70('0x38')]['ids'][_0x4c70('0x32')];_0x50c7d7+=0x1){socket[_0x4c70('0x5e')](_0x4c70('0x5f'),{'UserId':Number(_0x48b0bb[_0x4c70('0x38')][_0x4c70('0x52')][_0x50c7d7]),'WhatsappQueueId':Number(_0x48b0bb[_0x4c70('0x2b')]['id'])});}return _0x38e853;});}})[_0x4c70('0x18')](respondWithResult(_0x3395ef,null))[_0x4c70('0x29')](handleError(_0x3395ef,null));};exports[_0x4c70('0x76')]=function(_0x1111f9,_0x9092d9){return db['WhatsappQueue']['find']({'where':{'id':_0x1111f9[_0x4c70('0x2b')]['id']}})[_0x4c70('0x18')](handleEntityNotFound(_0x9092d9,null))[_0x4c70('0x18')](function(_0x2042a3){if(_0x2042a3){return _0x2042a3['removeAgents'](_0x1111f9[_0x4c70('0x2e')][_0x4c70('0x52')])[_0x4c70('0x18')](function(){if(_[_0x4c70('0x77')](_0x1111f9['query'][_0x4c70('0x52')])){for(var _0x13742d=0x0;_0x13742d<_0x1111f9[_0x4c70('0x2e')][_0x4c70('0x52')][_0x4c70('0x32')];_0x13742d+=0x1){socket[_0x4c70('0x5e')](_0x4c70('0x72'),{'UserId':Number(_0x1111f9[_0x4c70('0x2e')]['ids'][_0x13742d]),'WhatsappQueueId':Number(_0x1111f9['params']['id'])});}}else{socket[_0x4c70('0x5e')](_0x4c70('0x72'),{'UserId':Number(_0x1111f9[_0x4c70('0x2e')][_0x4c70('0x52')]),'WhatsappQueueId':Number(_0x1111f9['params']['id'])});}});}})[_0x4c70('0x18')](respondWithStatusCode(_0x9092d9,null))['catch'](handleError(_0x9092d9,null));};exports[_0x4c70('0x78')]=function(_0x496787,_0x25706c){var _0x56f613={};var _0x320ada={};var _0x5c3ae4;var _0x5aea12;return db[_0x4c70('0x22')][_0x4c70('0x79')]({'where':{'id':_0x496787[_0x4c70('0x2b')]['id']}})[_0x4c70('0x18')](handleEntityNotFound(_0x25706c,null))['then'](function(_0x5bec11){if(_0x5bec11){_0x5c3ae4=_0x5bec11;_0x320ada['model']=_['keys'](db[_0x4c70('0x49')]['rawAttributes']);_0x320ada[_0x4c70('0x2e')]=_[_0x4c70('0x41')](_0x496787[_0x4c70('0x2e')]);_0x320ada[_0x4c70('0x42')]=_[_0x4c70('0x2f')](_0x320ada['model'],_0x320ada[_0x4c70('0x2e')]);_0x56f613['attributes']=_[_0x4c70('0x2f')](_0x320ada[_0x4c70('0x2c')],qs[_0x4c70('0x30')](_0x496787[_0x4c70('0x2e')][_0x4c70('0x30')]));_0x56f613['attributes']=_0x56f613[_0x4c70('0x31')][_0x4c70('0x32')]?_0x56f613[_0x4c70('0x31')]:_0x320ada[_0x4c70('0x2c')];_0x56f613['order']=qs['sort'](_0x496787['query']['sort']);_0x56f613[_0x4c70('0x25')]=qs[_0x4c70('0x42')](_[_0x4c70('0x46')](_0x496787[_0x4c70('0x2e')],_0x320ada[_0x4c70('0x42')]));if(_0x496787['query']['filter']){_0x56f613[_0x4c70('0x25')]=_[_0x4c70('0x34')](_0x56f613[_0x4c70('0x25')],{'$or':_['map'](_0x56f613['attributes'],function(_0x14e462){var _0x485e1e={};_0x485e1e[_0x14e462]={'$like':'%'+_0x496787['query'][_0x4c70('0x47')]+'%'};return _0x485e1e;})});}_0x56f613=_[_0x4c70('0x34')]({},_0x56f613,_0x496787['options']);return _0x5c3ae4[_0x4c70('0x78')](_0x56f613);}})['then'](function(_0x572984){if(_0x572984){_0x5aea12=_0x572984[_0x4c70('0x32')];if(!_0x496787['query']['hasOwnProperty'](_0x4c70('0x43'))){_0x56f613[_0x4c70('0x14')]=qs[_0x4c70('0x14')](_0x496787[_0x4c70('0x2e')][_0x4c70('0x14')]);_0x56f613[_0x4c70('0x11')]=qs[_0x4c70('0x11')](_0x496787['query'][_0x4c70('0x11')]);}return _0x5c3ae4[_0x4c70('0x78')](_0x56f613);}})['then'](function(_0x12fff9){if(_0x12fff9){return _0x12fff9?{'count':_0x5aea12,'rows':_0x12fff9}:null;}})['then'](respondWithResult(_0x25706c,null))[_0x4c70('0x29')](handleError(_0x25706c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5071d05..4c4c7a6 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 _0x6c0c=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x114bf1,_0x16ac4a){var _0x58072f=function(_0x377d8a){while(--_0x377d8a){_0x114bf1['push'](_0x114bf1['shift']());}};_0x58072f(++_0x16ac4a);}(_0x6c0c,0x1da));var _0xc6c0=function(_0x7f5c81,_0x3e5830){_0x7f5c81=_0x7f5c81-0x0;var _0x219e62=_0x6c0c[_0x7f5c81];return _0x219e62;};'use strict';var EventEmitter=require(_0xc6c0('0x0'));var WhatsappQueue=require(_0xc6c0('0x1'))['db'][_0xc6c0('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc6c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc6c0('0x4')};function emitEvent(_0x37cffe){return function(_0x26b102,_0x420b6b,_0x2246d6){WhatsappQueueEvents[_0xc6c0('0x5')](_0x37cffe+':'+_0x26b102['id'],_0x26b102);WhatsappQueueEvents[_0xc6c0('0x5')](_0x37cffe,_0x26b102);_0x2246d6(null);};}for(var e in events){if(events[_0xc6c0('0x6')](e)){var event=events[e];WhatsappQueue[_0xc6c0('0x7')](e,emitEvent(event));}}module[_0xc6c0('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb0f9=['update','hook','exports','WhatsappQueue','setMaxListeners','save'];(function(_0x7464a9,_0x5763d9){var _0xc5e924=function(_0x4144e0){while(--_0x4144e0){_0x7464a9['push'](_0x7464a9['shift']());}};_0xc5e924(++_0x5763d9);}(_0xb0f9,0x141));var _0x9b0f=function(_0x375f38,_0x20495d){_0x375f38=_0x375f38-0x0;var _0x5b6dfa=_0xb0f9[_0x375f38];return _0x5b6dfa;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x9b0f('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9b0f('0x1')](0x0);var events={'afterCreate':_0x9b0f('0x2'),'afterUpdate':_0x9b0f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d7324){return function(_0x3e9d24,_0x1e596a,_0x459167){WhatsappQueueEvents['emit'](_0x2d7324+':'+_0x3e9d24['id'],_0x3e9d24);WhatsappQueueEvents['emit'](_0x2d7324,_0x3e9d24);_0x459167(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9b0f('0x4')](e,emitEvent(event));}}module[_0x9b0f('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 731ac21..1f13bfa 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 _0xe6ba=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x346027,_0x250e85){var _0x18ce3c=function(_0x2e63ae){while(--_0x2e63ae){_0x346027['push'](_0x346027['shift']());}};_0x18ce3c(++_0x250e85);}(_0xe6ba,0x1f3));var _0xae6b=function(_0x2f2a2b,_0x6e1556){_0x2f2a2b=_0x2f2a2b-0x0;var _0x3ab7e3=_0xe6ba[_0x2f2a2b];return _0x3ab7e3;};'use strict';var _=require(_0xae6b('0x0'));var util=require(_0xae6b('0x1'));var logger=require(_0xae6b('0x2'))(_0xae6b('0x3'));var moment=require(_0xae6b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae6b('0x5'));var rimraf=require(_0xae6b('0x6'));var config=require(_0xae6b('0x7'));var attributes=require(_0xae6b('0x8'));module[_0xae6b('0x9')]=function(_0x506931,_0x5c1546){return _0x506931['define'](_0xae6b('0xa'),attributes,{'tableName':_0xae6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35a2=['define','whatsapp_queues','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x228b08,_0x3d2f7c){var _0x2b9a29=function(_0x4e6306){while(--_0x4e6306){_0x228b08['push'](_0x228b08['shift']());}};_0x2b9a29(++_0x3d2f7c);}(_0x35a2,0x12b));var _0x235a=function(_0x5e4dd4,_0x10a1d8){_0x5e4dd4=_0x5e4dd4-0x0;var _0x314312=_0x35a2[_0x5e4dd4];return _0x314312;};'use strict';var _=require(_0x235a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x235a('0x1'));var moment=require(_0x235a('0x2'));var BPromise=require(_0x235a('0x3'));var rp=require(_0x235a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x235a('0x5'));var config=require(_0x235a('0x6'));var attributes=require(_0x235a('0x7'));module[_0x235a('0x8')]=function(_0x48b79e,_0x2aea67){return _0x48b79e[_0x235a('0x9')]('WhatsappQueue',attributes,{'tableName':_0x235a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9e14319..2f1276d 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 _0xaeda=['defaults','redis','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xaeda,0x6b));var _0xaaed=function(_0xc012e8,_0x2bf3f3){_0xc012e8=_0xc012e8-0x0;var _0x57119b=_0xaeda[_0xc012e8];return _0x57119b;};'use strict';var _=require(_0xaaed('0x0'));var util=require(_0xaaed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaaed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaaed('0x3'));var logger=require(_0xaaed('0x4'))(_0xaaed('0x5'));var config=require(_0xaaed('0x6'));var jayson=require(_0xaaed('0x7'));var client=jayson[_0xaaed('0x8')][_0xaaed('0x9')]({'port':0x232a});config['redis']=_[_0xaaed('0xa')](config[_0xaaed('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaed('0xb')]));require(_0xaaed('0xc'))[_0xaaed('0xd')](socket);function respondWithRpcPromise(_0x365fbf,_0x554172,_0x4e2e0b){return new BPromise(function(_0x48f9e3,_0x53014c){return client[_0xaaed('0xe')](_0x365fbf,_0x4e2e0b)[_0xaaed('0xf')](function(_0x1d448a){logger[_0xaaed('0x10')](_0xaaed('0x11'),_0x554172,_0xaaed('0x12'));logger[_0xaaed('0x13')](_0xaaed('0x14'),_0x554172,'request\x20sent',JSON[_0xaaed('0x15')](_0x1d448a));if(_0x1d448a[_0xaaed('0x16')]){if(_0x1d448a['error'][_0xaaed('0x17')]===0x1f4){logger[_0xaaed('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x554172,_0x1d448a[_0xaaed('0x16')][_0xaaed('0x18')]);return _0x53014c(_0x1d448a[_0xaaed('0x16')]['message']);}logger[_0xaaed('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x554172,_0x1d448a[_0xaaed('0x16')]['message']);return _0x48f9e3(_0x1d448a[_0xaaed('0x16')][_0xaaed('0x18')]);}else{logger[_0xaaed('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x554172,_0xaaed('0x12'));_0x48f9e3(_0x1d448a['result'][_0xaaed('0x18')]);}})[_0xaaed('0x19')](function(_0x41e374){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x554172,_0x41e374);_0x53014c(_0x41e374);});});}exports[_0xaaed('0x1a')]=function(_0x5f2f4b){var _0x201cb4=this;return new Promise(function(_0x5b9f7b,_0xf77f78){return db[_0xaaed('0x1b')][_0xaaed('0x1c')]({'raw':_0x5f2f4b[_0xaaed('0x1d')]?_0x5f2f4b[_0xaaed('0x1d')][_0xaaed('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f2f4b[_0xaaed('0x1d')]?_0x5f2f4b[_0xaaed('0x1d')][_0xaaed('0x1f')]||null:null,'attributes':_0x5f2f4b[_0xaaed('0x1d')]?_0x5f2f4b[_0xaaed('0x1d')][_0xaaed('0x20')]||null:null,'limit':_0x5f2f4b[_0xaaed('0x1d')]?_0x5f2f4b['options'][_0xaaed('0x21')]||null:null,'include':_0x5f2f4b['options']?_0x5f2f4b[_0xaaed('0x1d')][_0xaaed('0x22')]?_[_0xaaed('0x23')](_0x5f2f4b['options'][_0xaaed('0x22')],function(_0x3e888d){return{'model':db[_0x3e888d['model']],'as':_0x3e888d['as'],'attributes':_0x3e888d['attributes'],'include':_0x3e888d[_0xaaed('0x22')]?_['map'](_0x3e888d[_0xaaed('0x22')],function(_0x4f560a){return{'model':db[_0x4f560a[_0xaaed('0x24')]],'as':_0x4f560a['as'],'attributes':_0x4f560a[_0xaaed('0x20')],'include':_0x4f560a[_0xaaed('0x22')]?_[_0xaaed('0x23')](_0x4f560a[_0xaaed('0x22')],function(_0x18594d){return{'model':db[_0x18594d['model']],'as':_0x18594d['as'],'attributes':_0x18594d['attributes']};}):[]};}):[]};}):[]:[]})[_0xaaed('0xf')](function(_0x164af6){logger[_0xaaed('0x10')](_0xaaed('0x1a'),_0x5f2f4b);logger['debug'](_0xaaed('0x1a'),_0x5f2f4b,JSON[_0xaaed('0x15')](_0x164af6));_0x5b9f7b(_0x164af6);})[_0xaaed('0x19')](function(_0x35159d){logger[_0xaaed('0x16')](_0xaaed('0x1a'),_0x35159d[_0xaaed('0x18')],_0x5f2f4b);_0xf77f78(_0x201cb4[_0xaaed('0x16')](0x1f4,_0x35159d[_0xaaed('0x18')]));});});};exports[_0xaaed('0x25')]=function(_0x234f81){var _0x3d23c9=this;return new Promise(function(_0x54d8b1,_0xa8276a){return db[_0xaaed('0x1b')][_0xaaed('0x26')]({'raw':_0x234f81[_0xaaed('0x1d')]?_0x234f81[_0xaaed('0x1d')][_0xaaed('0x1e')]===undefined?!![]:![]:!![],'where':_0x234f81[_0xaaed('0x1d')]?_0x234f81['options']['where']||null:null,'attributes':_0x234f81[_0xaaed('0x1d')]?_0x234f81[_0xaaed('0x1d')][_0xaaed('0x20')]||null:null,'include':_0x234f81[_0xaaed('0x1d')]?_0x234f81[_0xaaed('0x1d')][_0xaaed('0x22')]?_['map'](_0x234f81[_0xaaed('0x1d')][_0xaaed('0x22')],function(_0x3508f2){return{'model':db[_0x3508f2[_0xaaed('0x24')]],'as':_0x3508f2['as'],'attributes':_0x3508f2['attributes'],'include':_0x3508f2[_0xaaed('0x22')]?_[_0xaaed('0x23')](_0x3508f2[_0xaaed('0x22')],function(_0x1e8d2f){return{'model':db[_0x1e8d2f[_0xaaed('0x24')]],'as':_0x1e8d2f['as'],'attributes':_0x1e8d2f[_0xaaed('0x20')],'include':_0x1e8d2f[_0xaaed('0x22')]?_[_0xaaed('0x23')](_0x1e8d2f[_0xaaed('0x22')],function(_0x106472){return{'model':db[_0x106472['model']],'as':_0x106472['as'],'attributes':_0x106472[_0xaaed('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaaed('0xf')](function(_0x355d6b){logger[_0xaaed('0x10')](_0xaaed('0x25'),_0x234f81);logger[_0xaaed('0x13')](_0xaaed('0x25'),_0x234f81,JSON[_0xaaed('0x15')](_0x355d6b));_0x54d8b1(_0x355d6b);})[_0xaaed('0x19')](function(_0x259c79){logger[_0xaaed('0x16')](_0xaaed('0x25'),_0x259c79[_0xaaed('0x18')],_0x234f81);_0xa8276a(_0x3d23c9[_0xaaed('0x16')](0x1f4,_0x259c79[_0xaaed('0x18')]));});});}; \ No newline at end of file +var _0xb0bc=['WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','include','map','attributes','model','GetWhatsappQueue','ShowWhatsappQueue','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','./whatsappQueue.socket','request','then','info'];(function(_0x4b0211,_0x17f347){var _0x1906fc=function(_0x9e2459){while(--_0x9e2459){_0x4b0211['push'](_0x4b0211['shift']());}};_0x1906fc(++_0x17f347);}(_0xb0bc,0x12c));var _0xcb0b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb0bc[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xcb0b('0x0'));var moment=require(_0xcb0b('0x1'));var BPromise=require(_0xcb0b('0x2'));var rs=require(_0xcb0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb0b('0x4'))['db'];var utils=require(_0xcb0b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb0b('0x6'));var jayson=require(_0xcb0b('0x7'));var client=jayson['client'][_0xcb0b('0x8')]({'port':0x232a});config[_0xcb0b('0x9')]=_[_0xcb0b('0xa')](config[_0xcb0b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb0b('0x9')]));require(_0xcb0b('0xb'))['register'](socket);function respondWithRpcPromise(_0x3bcd86,_0x8acfd7,_0xb0e80d){return new BPromise(function(_0x58d205,_0x8815f4){return client[_0xcb0b('0xc')](_0x3bcd86,_0xb0e80d)[_0xcb0b('0xd')](function(_0x22358a){logger[_0xcb0b('0xe')](_0xcb0b('0xf'),_0x8acfd7,'request\x20sent');logger[_0xcb0b('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x8acfd7,_0xcb0b('0x11'),JSON[_0xcb0b('0x12')](_0x22358a));if(_0x22358a['error']){if(_0x22358a[_0xcb0b('0x13')][_0xcb0b('0x14')]===0x1f4){logger[_0xcb0b('0x13')](_0xcb0b('0xf'),_0x8acfd7,_0x22358a[_0xcb0b('0x13')][_0xcb0b('0x15')]);return _0x8815f4(_0x22358a[_0xcb0b('0x13')][_0xcb0b('0x15')]);}logger[_0xcb0b('0x13')](_0xcb0b('0xf'),_0x8acfd7,_0x22358a[_0xcb0b('0x13')][_0xcb0b('0x15')]);return _0x58d205(_0x22358a['error'][_0xcb0b('0x15')]);}else{logger[_0xcb0b('0xe')](_0xcb0b('0xf'),_0x8acfd7,_0xcb0b('0x11'));_0x58d205(_0x22358a[_0xcb0b('0x16')][_0xcb0b('0x15')]);}})[_0xcb0b('0x17')](function(_0x5ab869){logger[_0xcb0b('0x13')](_0xcb0b('0xf'),_0x8acfd7,_0x5ab869);_0x8815f4(_0x5ab869);});});}exports['GetWhatsappQueue']=function(_0x2d2b93){var _0x40cebf=this;return new Promise(function(_0x30f02e,_0x4fbaa8){return db[_0xcb0b('0x18')][_0xcb0b('0x19')]({'raw':_0x2d2b93[_0xcb0b('0x1a')]?_0x2d2b93[_0xcb0b('0x1a')][_0xcb0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d2b93[_0xcb0b('0x1a')]?_0x2d2b93[_0xcb0b('0x1a')]['where']||null:null,'attributes':_0x2d2b93[_0xcb0b('0x1a')]?_0x2d2b93['options']['attributes']||null:null,'limit':_0x2d2b93[_0xcb0b('0x1a')]?_0x2d2b93[_0xcb0b('0x1a')]['limit']||null:null,'include':_0x2d2b93[_0xcb0b('0x1a')]?_0x2d2b93[_0xcb0b('0x1a')][_0xcb0b('0x1c')]?_[_0xcb0b('0x1d')](_0x2d2b93[_0xcb0b('0x1a')]['include'],function(_0x1af393){return{'model':db[_0x1af393['model']],'as':_0x1af393['as'],'attributes':_0x1af393[_0xcb0b('0x1e')],'include':_0x1af393[_0xcb0b('0x1c')]?_[_0xcb0b('0x1d')](_0x1af393[_0xcb0b('0x1c')],function(_0x182154){return{'model':db[_0x182154[_0xcb0b('0x1f')]],'as':_0x182154['as'],'attributes':_0x182154[_0xcb0b('0x1e')],'include':_0x182154[_0xcb0b('0x1c')]?_[_0xcb0b('0x1d')](_0x182154[_0xcb0b('0x1c')],function(_0x1bec28){return{'model':db[_0x1bec28[_0xcb0b('0x1f')]],'as':_0x1bec28['as'],'attributes':_0x1bec28['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9bf472){logger[_0xcb0b('0xe')](_0xcb0b('0x20'),_0x2d2b93);logger[_0xcb0b('0x10')]('GetWhatsappQueue',_0x2d2b93,JSON['stringify'](_0x9bf472));_0x30f02e(_0x9bf472);})[_0xcb0b('0x17')](function(_0xfe7b22){logger[_0xcb0b('0x13')](_0xcb0b('0x20'),_0xfe7b22[_0xcb0b('0x15')],_0x2d2b93);_0x4fbaa8(_0x40cebf[_0xcb0b('0x13')](0x1f4,_0xfe7b22['message']));});});};exports[_0xcb0b('0x21')]=function(_0x4abe6c){var _0x17d4e2=this;return new Promise(function(_0x354b3e,_0x4930d4){return db['WhatsappQueue']['find']({'raw':_0x4abe6c[_0xcb0b('0x1a')]?_0x4abe6c[_0xcb0b('0x1a')][_0xcb0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4abe6c[_0xcb0b('0x1a')]?_0x4abe6c[_0xcb0b('0x1a')][_0xcb0b('0x22')]||null:null,'attributes':_0x4abe6c['options']?_0x4abe6c[_0xcb0b('0x1a')][_0xcb0b('0x1e')]||null:null,'include':_0x4abe6c[_0xcb0b('0x1a')]?_0x4abe6c[_0xcb0b('0x1a')][_0xcb0b('0x1c')]?_[_0xcb0b('0x1d')](_0x4abe6c[_0xcb0b('0x1a')][_0xcb0b('0x1c')],function(_0x54e648){return{'model':db[_0x54e648[_0xcb0b('0x1f')]],'as':_0x54e648['as'],'attributes':_0x54e648[_0xcb0b('0x1e')],'include':_0x54e648[_0xcb0b('0x1c')]?_['map'](_0x54e648[_0xcb0b('0x1c')],function(_0x5d6f4c){return{'model':db[_0x5d6f4c[_0xcb0b('0x1f')]],'as':_0x5d6f4c['as'],'attributes':_0x5d6f4c[_0xcb0b('0x1e')],'include':_0x5d6f4c[_0xcb0b('0x1c')]?_['map'](_0x5d6f4c[_0xcb0b('0x1c')],function(_0x1ca4e8){return{'model':db[_0x1ca4e8[_0xcb0b('0x1f')]],'as':_0x1ca4e8['as'],'attributes':_0x1ca4e8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7128ab){logger[_0xcb0b('0xe')]('ShowWhatsappQueue',_0x4abe6c);logger[_0xcb0b('0x10')]('ShowWhatsappQueue',_0x4abe6c,JSON[_0xcb0b('0x12')](_0x7128ab));_0x354b3e(_0x7128ab);})[_0xcb0b('0x17')](function(_0x589c8a){logger[_0xcb0b('0x13')]('ShowWhatsappQueue',_0x589c8a[_0xcb0b('0x15')],_0x4abe6c);_0x4930d4(_0x17d4e2['error'](0x1f4,_0x589c8a[_0xcb0b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7e4726e..ff7898d 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 _0xbb6d=['save','remove','emit','removeListener','length','./whatsappQueue.events'];(function(_0x44bbda,_0x29e7a4){var _0x80b727=function(_0x394d8a){while(--_0x394d8a){_0x44bbda['push'](_0x44bbda['shift']());}};_0x80b727(++_0x29e7a4);}(_0xbb6d,0xf5));var _0xdbb6=function(_0x52f914,_0x3af39e){_0x52f914=_0x52f914-0x0;var _0x257b98=_0xbb6d[_0x52f914];return _0x257b98;};'use strict';var WhatsappQueueEvents=require(_0xdbb6('0x0'));var events=[_0xdbb6('0x1'),_0xdbb6('0x2'),'update'];function createListener(_0x3c924b,_0x30d8ad){return function(_0x1f7e23){_0x30d8ad[_0xdbb6('0x3')](_0x3c924b,_0x1f7e23);};}function removeListener(_0x3b1186,_0x5c3a98){return function(){WhatsappQueueEvents[_0xdbb6('0x4')](_0x3b1186,_0x5c3a98);};}exports['register']=function(_0x3008d6){for(var _0x1dc5a3=0x0,_0x3af8cb=events[_0xdbb6('0x5')];_0x1dc5a3<_0x3af8cb;_0x1dc5a3++){var _0x562e44=events[_0x1dc5a3];var _0x548916=createListener('whatsappQueue:'+_0x562e44,_0x3008d6);WhatsappQueueEvents['on'](_0x562e44,_0x548916);}}; \ No newline at end of file +var _0x6e87=['./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x5552c7,_0x3fc755){var _0x5ad7ca=function(_0x40ee17){while(--_0x40ee17){_0x5552c7['push'](_0x5552c7['shift']());}};_0x5ad7ca(++_0x3fc755);}(_0x6e87,0xb4));var _0x76e8=function(_0xa51ba0,_0x3bf58d){_0xa51ba0=_0xa51ba0-0x0;var _0x17f343=_0x6e87[_0xa51ba0];return _0x17f343;};'use strict';var WhatsappQueueEvents=require(_0x76e8('0x0'));var events=[_0x76e8('0x1'),_0x76e8('0x2'),_0x76e8('0x3')];function createListener(_0x4668ab,_0x25db1e){return function(_0x229afa){_0x25db1e['emit'](_0x4668ab,_0x229afa);};}function removeListener(_0x3f56f4,_0x41474d){return function(){WhatsappQueueEvents[_0x76e8('0x4')](_0x3f56f4,_0x41474d);};}exports[_0x76e8('0x5')]=function(_0x12a084){for(var _0x5c2624=0x0,_0xe9fca5=events['length'];_0x5c2624<_0xe9fca5;_0x5c2624++){var _0xc13f35=events[_0x5c2624];var _0x477a50=createListener('whatsappQueue:'+_0xc13f35,_0x12a084);WhatsappQueueEvents['on'](_0xc13f35,_0x477a50);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index da04d3f..46ec1cc 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 _0xee6e=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','create','update','/:id'];(function(_0x14374c,_0x2a36a3){var _0x2293d3=function(_0x1298c9){while(--_0x1298c9){_0x14374c['push'](_0x14374c['shift']());}};_0x2293d3(++_0x2a36a3);}(_0xee6e,0xb5));var _0xeee6=function(_0x1a929f,_0x7d9dd3){_0x1a929f=_0x1a929f-0x0;var _0x161ec5=_0xee6e[_0x1a929f];return _0x161ec5;};'use strict';var multer=require('multer');var util=require(_0xeee6('0x0'));var path=require(_0xeee6('0x1'));var timeout=require(_0xeee6('0x2'));var express=require('express');var router=express[_0xeee6('0x3')]();var fs_extra=require(_0xeee6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeee6('0x5'));var config=require(_0xeee6('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xeee6('0x7')]('/',auth[_0xeee6('0x8')](),controller['index']);router['get'](_0xeee6('0x9'),auth['isAuthenticated'](),controller[_0xeee6('0xa')]);router['get']('/:id',auth[_0xeee6('0x8')](),controller['show']);router['post']('/',auth[_0xeee6('0x8')](),controller[_0xeee6('0xb')]);router['put']('/:id',auth[_0xeee6('0x8')](),controller[_0xeee6('0xc')]);router['delete'](_0xeee6('0xd'),auth[_0xeee6('0x8')](),controller[_0xeee6('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa7ca=['fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3875e2,_0x156f6c){var _0x4182fe=function(_0x5ea2ae){while(--_0x5ea2ae){_0x3875e2['push'](_0x3875e2['shift']());}};_0x4182fe(++_0x156f6c);}(_0xa7ca,0x9b));var _0xaa7c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa7ca[_0x47b58b];return _0x46bebe;};'use strict';var multer=require('multer');var util=require(_0xaa7c('0x0'));var path=require(_0xaa7c('0x1'));var timeout=require(_0xaa7c('0x2'));var express=require(_0xaa7c('0x3'));var router=express[_0xaa7c('0x4')]();var fs_extra=require(_0xaa7c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaa7c('0x6'));var config=require('../../config/environment');var controller=require(_0xaa7c('0x7'));router['get']('/',auth[_0xaa7c('0x8')](),controller['index']);router[_0xaa7c('0x9')](_0xaa7c('0xa'),auth[_0xaa7c('0x8')](),controller[_0xaa7c('0xb')]);router[_0xaa7c('0x9')](_0xaa7c('0xc'),auth[_0xaa7c('0x8')](),controller[_0xaa7c('0xd')]);router[_0xaa7c('0xe')]('/',auth[_0xaa7c('0x8')](),controller[_0xaa7c('0xf')]);router['put'](_0xaa7c('0xc'),auth['isAuthenticated'](),controller[_0xaa7c('0x10')]);router[_0xaa7c('0x11')]('/:id',auth[_0xaa7c('0x8')](),controller[_0xaa7c('0x12')]);module[_0xaa7c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0f71520..9cda4c2 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1bf9ef,_0x2720d6){var _0x317d46=function(_0x404300){while(--_0x404300){_0x1bf9ef['push'](_0x1bf9ef['shift']());}};_0x317d46(++_0x2720d6);}(_0x7a54,0x106));var _0x47a5=function(_0xa74f07,_0x50a60a){_0xa74f07=_0xa74f07-0x0;var _0xbc3c37=_0x7a54[_0xa74f07];return _0xbc3c37;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4b8e55,_0x4103fe){var _0x1b017f=function(_0x3b53df){while(--_0x3b53df){_0x4b8e55['push'](_0x4b8e55['shift']());}};_0x1b017f(++_0x4103fe);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 c5da947..f05c2ee 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0x4c0b02,_0x52efc9){var _0x6d9c9c=function(_0x1afdc1){while(--_0x1afdc1){_0x4c0b02['push'](_0x4c0b02['shift']());}};_0x6d9c9c(++_0x52efc9);}(_0x3266,0x6a));var _0x6326=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x3266[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file +var _0x57f8=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','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','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x57f8,0x198));var _0x857f=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0x57f8[_0x1e1d07];return _0x225dce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));};exports['describe']=function(_0x5464f4,_0x13ef75){return db[_0x857f('0x2f')][_0x857f('0x4d')]()[_0x857f('0x28')](respondWithResult(_0x13ef75,null))[_0x857f('0x47')](handleError(_0x13ef75,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0f4e37d..c1f9f4f 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 _0x9e8e=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e8e,0x7f));var _0xe9e8=function(_0x1948d7,_0x1410d6){_0x1948d7=_0x1948d7-0x0;var _0x5f5f02=_0x9e8e[_0x1948d7];return _0x5f5f02;};'use strict';var _=require(_0xe9e8('0x0'));var util=require('util');var logger=require(_0xe9e8('0x1'))(_0xe9e8('0x2'));var moment=require(_0xe9e8('0x3'));var BPromise=require(_0xe9e8('0x4'));var rp=require(_0xe9e8('0x5'));var fs=require('fs');var path=require(_0xe9e8('0x6'));var rimraf=require(_0xe9e8('0x7'));var config=require(_0xe9e8('0x8'));var attributes=require(_0xe9e8('0x9'));module[_0xe9e8('0xa')]=function(_0x1e0e57,_0x3b7f9f){return _0x1e0e57['define']('WhatsappQueueReport',attributes,{'tableName':_0xe9e8('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3578=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define'];(function(_0x245e9c,_0x3846b6){var _0x423cb0=function(_0x5acac9){while(--_0x5acac9){_0x245e9c['push'](_0x245e9c['shift']());}};_0x423cb0(++_0x3846b6);}(_0x3578,0x1d1));var _0x8357=function(_0x2ef1a5,_0x316aac){_0x2ef1a5=_0x2ef1a5-0x0;var _0x268769=_0x3578[_0x2ef1a5];return _0x268769;};'use strict';var _=require(_0x8357('0x0'));var util=require(_0x8357('0x1'));var logger=require(_0x8357('0x2'))(_0x8357('0x3'));var moment=require(_0x8357('0x4'));var BPromise=require('bluebird');var rp=require(_0x8357('0x5'));var fs=require('fs');var path=require(_0x8357('0x6'));var rimraf=require(_0x8357('0x7'));var config=require(_0x8357('0x8'));var attributes=require(_0x8357('0x9'));module['exports']=function(_0x19bd69,_0x3bac0c){return _0x19bd69[_0x8357('0xa')](_0x8357('0xb'),attributes,{'tableName':_0x8357('0xc'),'paranoid':![],'indexes':[{'name':_0x8357('0xd'),'fields':[_0x8357('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 bccb645..f1b697f 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 _0x0626=['WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch'];(function(_0x39d9ec,_0x4ed6e5){var _0x499ff0=function(_0x565eaf){while(--_0x565eaf){_0x39d9ec['push'](_0x39d9ec['shift']());}};_0x499ff0(++_0x4ed6e5);}(_0x0626,0x1bc));var _0x6062=function(_0x46e671,_0x459ff0){_0x46e671=_0x46e671-0x0;var _0x3471d1=_0x0626[_0x46e671];return _0x3471d1;};'use strict';var _=require(_0x6062('0x0'));var util=require(_0x6062('0x1'));var moment=require('moment');var BPromise=require(_0x6062('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6062('0x3'));var db=require(_0x6062('0x4'))['db'];var utils=require(_0x6062('0x5'));var logger=require('../../config/logger')(_0x6062('0x6'));var config=require(_0x6062('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6062('0x8')][_0x6062('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36810a,_0xb6db80,_0x20a3d3){return new BPromise(function(_0x2e8dc1,_0x50b081){return client['request'](_0x36810a,_0x20a3d3)[_0x6062('0xa')](function(_0xe7d878){logger[_0x6062('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0xb6db80,_0x6062('0xc'));logger[_0x6062('0xd')](_0x6062('0xe'),_0xb6db80,'request\x20sent',JSON[_0x6062('0xf')](_0xe7d878));if(_0xe7d878[_0x6062('0x10')]){if(_0xe7d878[_0x6062('0x10')]['code']===0x1f4){logger[_0x6062('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xb6db80,_0xe7d878[_0x6062('0x10')][_0x6062('0x11')]);return _0x50b081(_0xe7d878[_0x6062('0x10')][_0x6062('0x11')]);}logger['error'](_0x6062('0x12'),_0xb6db80,_0xe7d878[_0x6062('0x10')]['message']);return _0x2e8dc1(_0xe7d878[_0x6062('0x10')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xb6db80,'request\x20sent');_0x2e8dc1(_0xe7d878[_0x6062('0x13')][_0x6062('0x11')]);}})[_0x6062('0x14')](function(_0x5f42ce){logger[_0x6062('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xb6db80,_0x5f42ce);_0x50b081(_0x5f42ce);});});}exports['CreateWhatsappQueueReport']=function(_0x350514){var _0x455973=this;return new Promise(function(_0x39dafb,_0x13341a){return db[_0x6062('0x15')]['create'](_0x350514[_0x6062('0x16')],{'raw':_0x350514['options']?_0x350514[_0x6062('0x17')][_0x6062('0x18')]===undefined?!![]:![]:!![]})[_0x6062('0xa')](function(_0x449267){logger[_0x6062('0xb')](_0x6062('0x19'),_0x350514);logger[_0x6062('0xd')](_0x6062('0x19'),_0x350514,JSON[_0x6062('0xf')](_0x449267));_0x39dafb(_0x449267);})[_0x6062('0x14')](function(_0x548364){logger[_0x6062('0x10')](_0x6062('0x19'),_0x548364['message'],_0x350514);_0x13341a(_0x455973['error'](0x1f4,_0x548364['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x51c1fb){var _0x78aa99=this;return new Promise(function(_0x55854d,_0x58ad3d){return db[_0x6062('0x15')][_0x6062('0x1a')](_0x51c1fb[_0x6062('0x16')],{'raw':_0x51c1fb[_0x6062('0x17')]?_0x51c1fb[_0x6062('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51c1fb['options']?_0x51c1fb['options'][_0x6062('0x1b')]||null:null,'attributes':_0x51c1fb[_0x6062('0x17')]?_0x51c1fb[_0x6062('0x17')][_0x6062('0x1c')]||null:null,'limit':_0x51c1fb[_0x6062('0x17')]?_0x51c1fb[_0x6062('0x17')][_0x6062('0x1d')]||null:null})['then'](function(_0x419113){logger[_0x6062('0xb')]('UpdateWhatsappQueueReport',_0x51c1fb);logger[_0x6062('0xd')](_0x6062('0x1e'),_0x51c1fb,JSON[_0x6062('0xf')](_0x419113));_0x55854d(_0x419113);})[_0x6062('0x14')](function(_0x28c4c7){logger[_0x6062('0x10')]('UpdateWhatsappQueueReport',_0x28c4c7[_0x6062('0x11')],_0x51c1fb);_0x58ad3d(_0x78aa99[_0x6062('0x10')](0x1f4,_0x28c4c7[_0x6062('0x11')]));});});}; \ No newline at end of file +var _0x6052=['body','options','raw','CreateWhatsappQueueReport','debug','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x475fe4,_0xf71dd5){var _0x4a7c71=function(_0x3f77f9){while(--_0x3f77f9){_0x475fe4['push'](_0x475fe4['shift']());}};_0x4a7c71(++_0xf71dd5);}(_0x6052,0x177));var _0x2605=function(_0x39802c,_0x1b48a7){_0x39802c=_0x39802c-0x0;var _0x433333=_0x6052[_0x39802c];return _0x433333;};'use strict';var _=require(_0x2605('0x0'));var util=require(_0x2605('0x1'));var moment=require(_0x2605('0x2'));var BPromise=require(_0x2605('0x3'));var rs=require(_0x2605('0x4'));var fs=require('fs');var Redis=require(_0x2605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2605('0x6'));var logger=require(_0x2605('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2605('0x8'));var client=jayson[_0x2605('0x9')][_0x2605('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9f26,_0x505730,_0x3d1b93){return new BPromise(function(_0x48e9f,_0x234a04){return client[_0x2605('0xb')](_0x3c9f26,_0x3d1b93)[_0x2605('0xc')](function(_0xbd2c4d){logger[_0x2605('0xd')](_0x2605('0xe'),_0x505730,_0x2605('0xf'));logger['debug'](_0x2605('0x10'),_0x505730,'request\x20sent',JSON['stringify'](_0xbd2c4d));if(_0xbd2c4d[_0x2605('0x11')]){if(_0xbd2c4d[_0x2605('0x11')][_0x2605('0x12')]===0x1f4){logger[_0x2605('0x11')](_0x2605('0xe'),_0x505730,_0xbd2c4d[_0x2605('0x11')][_0x2605('0x13')]);return _0x234a04(_0xbd2c4d[_0x2605('0x11')][_0x2605('0x13')]);}logger[_0x2605('0x11')](_0x2605('0xe'),_0x505730,_0xbd2c4d[_0x2605('0x11')][_0x2605('0x13')]);return _0x48e9f(_0xbd2c4d[_0x2605('0x11')][_0x2605('0x13')]);}else{logger[_0x2605('0xd')](_0x2605('0xe'),_0x505730,_0x2605('0xf'));_0x48e9f(_0xbd2c4d[_0x2605('0x14')][_0x2605('0x13')]);}})['catch'](function(_0x349bb5){logger[_0x2605('0x11')](_0x2605('0xe'),_0x505730,_0x349bb5);_0x234a04(_0x349bb5);});});}exports['CreateWhatsappQueueReport']=function(_0x2c93a5){var _0x3f665f=this;return new Promise(function(_0x832af1,_0x4a163f){return db['WhatsappQueueReport']['create'](_0x2c93a5[_0x2605('0x15')],{'raw':_0x2c93a5[_0x2605('0x16')]?_0x2c93a5[_0x2605('0x16')][_0x2605('0x17')]===undefined?!![]:![]:!![]})[_0x2605('0xc')](function(_0xfe3d5c){logger[_0x2605('0xd')](_0x2605('0x18'),_0x2c93a5);logger[_0x2605('0x19')]('CreateWhatsappQueueReport',_0x2c93a5,JSON[_0x2605('0x1a')](_0xfe3d5c));_0x832af1(_0xfe3d5c);})['catch'](function(_0x249bfb){logger['error']('CreateWhatsappQueueReport',_0x249bfb[_0x2605('0x13')],_0x2c93a5);_0x4a163f(_0x3f665f[_0x2605('0x11')](0x1f4,_0x249bfb[_0x2605('0x13')]));});});};exports[_0x2605('0x1b')]=function(_0x2d0c05){var _0x466007=this;return new Promise(function(_0x142ef9,_0x60c676){return db[_0x2605('0x1c')][_0x2605('0x1d')](_0x2d0c05['body'],{'raw':_0x2d0c05['options']?_0x2d0c05[_0x2605('0x16')][_0x2605('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0c05['options']?_0x2d0c05[_0x2605('0x16')][_0x2605('0x1e')]||null:null,'attributes':_0x2d0c05['options']?_0x2d0c05[_0x2605('0x16')]['attributes']||null:null,'limit':_0x2d0c05[_0x2605('0x16')]?_0x2d0c05[_0x2605('0x16')][_0x2605('0x1f')]||null:null})[_0x2605('0xc')](function(_0x1ee2d7){logger[_0x2605('0xd')](_0x2605('0x1b'),_0x2d0c05);logger[_0x2605('0x19')]('UpdateWhatsappQueueReport',_0x2d0c05,JSON[_0x2605('0x1a')](_0x1ee2d7));_0x142ef9(_0x1ee2d7);})[_0x2605('0x20')](function(_0xac5b86){logger[_0x2605('0x11')](_0x2605('0x1b'),_0xac5b86[_0x2605('0x13')],_0x2d0c05);_0x60c676(_0x466007['error'](0x1f4,_0xac5b86['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a1ee8d2..8cb7c32 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 _0xd32e=['/:id','post','create','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1ffca3,_0x5d16d8){var _0x1d1522=function(_0x5b5219){while(--_0x5b5219){_0x1ffca3['push'](_0x1ffca3['shift']());}};_0x1d1522(++_0x5d16d8);}(_0xd32e,0x195));var _0xed32=function(_0x44b7fd,_0x1531e5){_0x44b7fd=_0x44b7fd-0x0;var _0x35dabd=_0xd32e[_0x44b7fd];return _0x35dabd;};'use strict';var multer=require(_0xed32('0x0'));var util=require(_0xed32('0x1'));var path=require(_0xed32('0x2'));var timeout=require(_0xed32('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xed32('0x4'));var auth=require(_0xed32('0x5'));var interaction=require(_0xed32('0x6'));var config=require(_0xed32('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xed32('0x8')]('/',auth[_0xed32('0x9')](),controller[_0xed32('0xa')]);router[_0xed32('0x8')]('/describe',auth[_0xed32('0x9')](),controller['describe']);router[_0xed32('0x8')](_0xed32('0xb'),auth[_0xed32('0x9')](),controller['show']);router[_0xed32('0xc')]('/',auth[_0xed32('0x9')](),controller[_0xed32('0xd')]);router['put'](_0xed32('0xb'),auth[_0xed32('0x9')](),controller['update']);router[_0xed32('0xe')]('/:id',auth[_0xed32('0x9')](),controller['destroy']);module[_0xed32('0xf')]=router; \ No newline at end of file +var _0x9411=['../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x9411,0x116));var _0x1941=function(_0x1f44fa,_0x30213e){_0x1f44fa=_0x1f44fa-0x0;var _0xf924cc=_0x9411[_0x1f44fa];return _0xf924cc;};'use strict';var multer=require(_0x1941('0x0'));var util=require(_0x1941('0x1'));var path=require(_0x1941('0x2'));var timeout=require(_0x1941('0x3'));var express=require(_0x1941('0x4'));var router=express[_0x1941('0x5')]();var fs_extra=require(_0x1941('0x6'));var auth=require(_0x1941('0x7'));var interaction=require(_0x1941('0x8'));var config=require('../../config/environment');var controller=require(_0x1941('0x9'));router['get']('/',auth[_0x1941('0xa')](),controller[_0x1941('0xb')]);router[_0x1941('0xc')]('/describe',auth[_0x1941('0xa')](),controller[_0x1941('0xd')]);router[_0x1941('0xc')](_0x1941('0xe'),auth['isAuthenticated'](),controller[_0x1941('0xf')]);router['post']('/',auth[_0x1941('0xa')](),controller[_0x1941('0x10')]);router[_0x1941('0x11')]('/:id',auth[_0x1941('0xa')](),controller[_0x1941('0x12')]);router[_0x1941('0x13')](_0x1941('0xe'),auth[_0x1941('0xa')](),controller[_0x1941('0x14')]);module[_0x1941('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d10e15e..6843df7 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 _0xe0dd=['ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x230600,_0x5c1b0c){var _0x1d1848=function(_0x54642d){while(--_0x54642d){_0x230600['push'](_0x230600['shift']());}};_0x1d1848(++_0x5c1b0c);}(_0xe0dd,0x163));var _0xde0d=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0xe0dd[_0x3522c8];return _0x22f498;};'use strict';var Sequelize=require(_0xde0d('0x0'));module[_0xde0d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xde0d('0x2')](_0xde0d('0x3'),_0xde0d('0x4'),_0xde0d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xde0d('0x6')]}}; \ No newline at end of file +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x5412bb,_0x549bbe){var _0xe625b6=function(_0x2e1d03){while(--_0x2e1d03){_0x5412bb['push'](_0x5412bb['shift']());}};_0xe625b6(++_0x549bbe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2a58f15..29626bf 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 _0x45d5=['catch','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','name','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','WhatsappTransferReport','show','filters','includeAll','include','find','create','body'];(function(_0x217c01,_0x6b0908){var _0x2dab32=function(_0x4c4bcd){while(--_0x4c4bcd){_0x217c01['push'](_0x217c01['shift']());}};_0x2dab32(++_0x6b0908);}(_0x45d5,0x1d1));var _0x545d=function(_0x43a4ea,_0x1c155e){_0x43a4ea=_0x43a4ea-0x0;var _0x1f17e3=_0x45d5[_0x43a4ea];return _0x1f17e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x545d('0x0'));var zipdir=require(_0x545d('0x1'));var jsonpatch=require(_0x545d('0x2'));var rp=require(_0x545d('0x3'));var moment=require(_0x545d('0x4'));var BPromise=require(_0x545d('0x5'));var Mustache=require(_0x545d('0x6'));var util=require('util');var path=require(_0x545d('0x7'));var sox=require(_0x545d('0x8'));var csv=require(_0x545d('0x9'));var ejs=require(_0x545d('0xa'));var fs=require('fs');var fs_extra=require(_0x545d('0xb'));var _=require(_0x545d('0xc'));var squel=require(_0x545d('0xd'));var crypto=require(_0x545d('0xe'));var jsforce=require(_0x545d('0xf'));var deskjs=require(_0x545d('0x10'));var toCsv=require(_0x545d('0x9'));var querystring=require(_0x545d('0x11'));var Papa=require(_0x545d('0x12'));var Redis=require(_0x545d('0x13'));var authService=require(_0x545d('0x14'));var qs=require(_0x545d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x545d('0x16'));var logger=require(_0x545d('0x17'))(_0x545d('0x18'));var utils=require(_0x545d('0x19'));var config=require(_0x545d('0x1a'));var licenseUtil=require(_0x545d('0x1b'));var db=require(_0x545d('0x1c'))['db'];function respondWithStatusCode(_0x179ab8,_0x3b8137){_0x3b8137=_0x3b8137||0xcc;return function(_0x2765c8){if(_0x2765c8){return _0x179ab8['sendStatus'](_0x3b8137);}return _0x179ab8[_0x545d('0x1d')](_0x3b8137)[_0x545d('0x1e')]();};}function respondWithResult(_0x2bede8,_0x37fb91){_0x37fb91=_0x37fb91||0xc8;return function(_0x4df46f){if(_0x4df46f){return _0x2bede8[_0x545d('0x1d')](_0x37fb91)[_0x545d('0x1f')](_0x4df46f);}};}function respondWithFilteredResult(_0x161e59,_0x14acdc){return function(_0x17d8a9){if(_0x17d8a9){var _0x4d45df=typeof _0x14acdc[_0x545d('0x20')]===_0x545d('0x21')&&typeof _0x14acdc[_0x545d('0x22')]===_0x545d('0x21');var _0xeda6cc=_0x17d8a9['count'];var _0x9c7853=_0x4d45df?0x0:_0x14acdc[_0x545d('0x20')];var _0x3fdca6=_0x4d45df?_0x17d8a9[_0x545d('0x23')]:_0x14acdc[_0x545d('0x20')]+_0x14acdc['limit'];var _0x31815a;if(_0x3fdca6>=_0xeda6cc){_0x3fdca6=_0xeda6cc;_0x31815a=0xc8;}else{_0x31815a=0xce;}_0x161e59['status'](_0x31815a);return _0x161e59[_0x545d('0x24')](_0x545d('0x25'),_0x9c7853+'-'+_0x3fdca6+'/'+_0xeda6cc)[_0x545d('0x1f')](_0x17d8a9);}return null;};}function patchUpdates(_0xb71f3b){return function(_0x40b27a){try{jsonpatch[_0x545d('0x26')](_0x40b27a,_0xb71f3b,!![]);}catch(_0x5729e2){return BPromise[_0x545d('0x27')](_0x5729e2);}return _0x40b27a[_0x545d('0x28')]();};}function saveUpdates(_0x2933af,_0x30acf2){return function(_0x3b8cff){if(_0x3b8cff){return _0x3b8cff[_0x545d('0x29')](_0x2933af)[_0x545d('0x2a')](function(_0x5ac93e){return _0x5ac93e;});}return null;};}function removeEntity(_0x3c3c0e,_0x26392f){return function(_0x2f4512){if(_0x2f4512){return _0x2f4512[_0x545d('0x2b')]()[_0x545d('0x2a')](function(){_0x3c3c0e[_0x545d('0x1d')](0xcc)[_0x545d('0x1e')]();});}};}function handleEntityNotFound(_0x1fb6e7,_0x5eb538){return function(_0x217f4a){if(!_0x217f4a){_0x1fb6e7[_0x545d('0x2c')](0x194);}return _0x217f4a;};}function handleError(_0xee5c27,_0x593cc7){_0x593cc7=_0x593cc7||0x1f4;return function(_0x171b41){logger['error'](_0x171b41[_0x545d('0x2d')]);if(_0x171b41[_0x545d('0x2e')]){delete _0x171b41[_0x545d('0x2e')];}_0xee5c27[_0x545d('0x1d')](_0x593cc7)['send'](_0x171b41);};}exports['index']=function(_0xf96603,_0xbc2bd1){var _0x2ec396={},_0x4629c3={},_0x29dbc4={'count':0x0,'rows':[]};var _0x47b530=_['map'](db['WhatsappTransferReport'][_0x545d('0x2f')],function(_0x5700e9){return{'name':_0x5700e9[_0x545d('0x30')],'type':_0x5700e9[_0x545d('0x31')][_0x545d('0x32')]};});_0x4629c3['model']=_[_0x545d('0x33')](_0x47b530,_0x545d('0x2e'));_0x4629c3[_0x545d('0x34')]=_['keys'](_0xf96603[_0x545d('0x34')]);_0x4629c3['filters']=_[_0x545d('0x35')](_0x4629c3[_0x545d('0x36')],_0x4629c3[_0x545d('0x34')]);_0x2ec396[_0x545d('0x37')]=_['intersection'](_0x4629c3[_0x545d('0x36')],qs[_0x545d('0x38')](_0xf96603[_0x545d('0x34')]['fields']));_0x2ec396[_0x545d('0x37')]=_0x2ec396[_0x545d('0x37')][_0x545d('0x39')]?_0x2ec396[_0x545d('0x37')]:_0x4629c3['model'];if(!_0xf96603[_0x545d('0x34')]['hasOwnProperty'](_0x545d('0x3a'))){_0x2ec396[_0x545d('0x22')]=qs['limit'](_0xf96603[_0x545d('0x34')][_0x545d('0x22')]);_0x2ec396[_0x545d('0x20')]=qs['offset'](_0xf96603['query'][_0x545d('0x20')]);}_0x2ec396[_0x545d('0x3b')]=qs[_0x545d('0x3c')](_0xf96603[_0x545d('0x34')][_0x545d('0x3c')]);_0x2ec396[_0x545d('0x3d')]=qs['filters'](_['pick'](_0xf96603[_0x545d('0x34')],_0x4629c3['filters']),_0x47b530);if(_0xf96603[_0x545d('0x34')][_0x545d('0x3e')]){_0x2ec396['where']=_['merge'](_0x2ec396[_0x545d('0x3d')],{'$or':_['map'](_0x47b530,function(_0x15cbd0){if(_0x15cbd0['type']!==_0x545d('0x3f')){var _0x2acb40={};_0x2acb40[_0x15cbd0[_0x545d('0x2e')]]={'$like':'%'+_0xf96603[_0x545d('0x34')][_0x545d('0x3e')]+'%'};return _0x2acb40;}})});}_0x2ec396=_[_0x545d('0x40')]({},_0x2ec396,_0xf96603[_0x545d('0x41')]);var _0x56ce6a={'where':_0x2ec396[_0x545d('0x3d')]};return db[_0x545d('0x42')][_0x545d('0x23')](_0x56ce6a)['then'](function(_0x23e6aa){_0x29dbc4[_0x545d('0x23')]=_0x23e6aa;if(_0xf96603[_0x545d('0x34')]['includeAll']){_0x2ec396['include']=[{'all':!![]}];}return db[_0x545d('0x42')]['findAll'](_0x2ec396);})[_0x545d('0x2a')](function(_0x49a977){_0x29dbc4['rows']=_0x49a977;return _0x29dbc4;})['then'](respondWithFilteredResult(_0xbc2bd1,_0x2ec396))['catch'](handleError(_0xbc2bd1,null));};exports[_0x545d('0x43')]=function(_0x26c995,_0x109dbd){var _0x73c6b={'raw':!![],'where':{'id':_0x26c995['params']['id']}},_0x1a5534={};_0x1a5534['model']=_['keys'](db[_0x545d('0x42')]['rawAttributes']);_0x1a5534['query']=_['keys'](_0x26c995[_0x545d('0x34')]);_0x1a5534[_0x545d('0x44')]=_['intersection'](_0x1a5534['model'],_0x1a5534[_0x545d('0x34')]);_0x73c6b[_0x545d('0x37')]=_[_0x545d('0x35')](_0x1a5534[_0x545d('0x36')],qs[_0x545d('0x38')](_0x26c995['query'][_0x545d('0x38')]));_0x73c6b[_0x545d('0x37')]=_0x73c6b['attributes'][_0x545d('0x39')]?_0x73c6b[_0x545d('0x37')]:_0x1a5534[_0x545d('0x36')];if(_0x26c995[_0x545d('0x34')][_0x545d('0x45')]){_0x73c6b[_0x545d('0x46')]=[{'all':!![]}];}_0x73c6b=_[_0x545d('0x40')]({},_0x73c6b,_0x26c995[_0x545d('0x41')]);return db[_0x545d('0x42')][_0x545d('0x47')](_0x73c6b)['then'](handleEntityNotFound(_0x109dbd,null))[_0x545d('0x2a')](respondWithResult(_0x109dbd,null))['catch'](handleError(_0x109dbd,null));};exports[_0x545d('0x48')]=function(_0x4b5507,_0x55f506){return db['WhatsappTransferReport'][_0x545d('0x48')](_0x4b5507[_0x545d('0x49')],{})[_0x545d('0x2a')](respondWithResult(_0x55f506,0xc9))[_0x545d('0x4a')](handleError(_0x55f506,null));};exports['update']=function(_0x3830f4,_0x105d58){if(_0x3830f4[_0x545d('0x49')]['id']){delete _0x3830f4[_0x545d('0x49')]['id'];}return db['WhatsappTransferReport'][_0x545d('0x47')]({'where':{'id':_0x3830f4[_0x545d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x105d58,null))[_0x545d('0x2a')](saveUpdates(_0x3830f4[_0x545d('0x49')],null))['then'](respondWithResult(_0x105d58,null))[_0x545d('0x4a')](handleError(_0x105d58,null));};exports[_0x545d('0x2b')]=function(_0x24b3ba,_0x54a773){return db[_0x545d('0x42')]['find']({'where':{'id':_0x24b3ba[_0x545d('0x4b')]['id']}})[_0x545d('0x2a')](handleEntityNotFound(_0x54a773,null))[_0x545d('0x2a')](removeEntity(_0x54a773,null))[_0x545d('0x4a')](handleError(_0x54a773,null));};exports[_0x545d('0x4c')]=function(_0xa0df84,_0x417076){return db['WhatsappTransferReport'][_0x545d('0x4c')]()['then'](respondWithResult(_0x417076,null))[_0x545d('0x4a')](handleError(_0x417076,null));}; \ No newline at end of file +var _0x7cc1=['type','VIRTUAL','filter','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7cc1,0x199));var _0x17cc=function(_0x1e4b53,_0x7bc5c7){_0x1e4b53=_0x1e4b53-0x0;var _0x2b177e=_0x7cc1[_0x1e4b53];return _0x2b177e;};'use strict';var emlformat=require(_0x17cc('0x0'));var rimraf=require(_0x17cc('0x1'));var zipdir=require(_0x17cc('0x2'));var jsonpatch=require(_0x17cc('0x3'));var rp=require('request-promise');var moment=require(_0x17cc('0x4'));var BPromise=require(_0x17cc('0x5'));var Mustache=require(_0x17cc('0x6'));var util=require(_0x17cc('0x7'));var path=require(_0x17cc('0x8'));var sox=require(_0x17cc('0x9'));var csv=require('to-csv');var ejs=require(_0x17cc('0xa'));var fs=require('fs');var fs_extra=require(_0x17cc('0xb'));var _=require('lodash');var squel=require(_0x17cc('0xc'));var crypto=require(_0x17cc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x17cc('0xe'));var Papa=require(_0x17cc('0xf'));var Redis=require(_0x17cc('0x10'));var authService=require(_0x17cc('0x11'));var qs=require(_0x17cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x17cc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x17cc('0x14'));var db=require(_0x17cc('0x15'))['db'];function respondWithStatusCode(_0x65a364,_0x76a029){_0x76a029=_0x76a029||0xcc;return function(_0x5bd018){if(_0x5bd018){return _0x65a364['sendStatus'](_0x76a029);}return _0x65a364[_0x17cc('0x16')](_0x76a029)['end']();};}function respondWithResult(_0x3527b8,_0x48c2ba){_0x48c2ba=_0x48c2ba||0xc8;return function(_0x536496){if(_0x536496){return _0x3527b8[_0x17cc('0x16')](_0x48c2ba)[_0x17cc('0x17')](_0x536496);}};}function respondWithFilteredResult(_0x56e7c8,_0x55ea89){return function(_0x578dba){if(_0x578dba){var _0xb20f71=typeof _0x55ea89[_0x17cc('0x18')]===_0x17cc('0x19')&&typeof _0x55ea89[_0x17cc('0x1a')]===_0x17cc('0x19');var _0x17f71a=_0x578dba['count'];var _0x31fc7e=_0xb20f71?0x0:_0x55ea89[_0x17cc('0x18')];var _0xd3334c=_0xb20f71?_0x578dba[_0x17cc('0x1b')]:_0x55ea89['offset']+_0x55ea89[_0x17cc('0x1a')];var _0x597bc0;if(_0xd3334c>=_0x17f71a){_0xd3334c=_0x17f71a;_0x597bc0=0xc8;}else{_0x597bc0=0xce;}_0x56e7c8[_0x17cc('0x16')](_0x597bc0);return _0x56e7c8[_0x17cc('0x1c')](_0x17cc('0x1d'),_0x31fc7e+'-'+_0xd3334c+'/'+_0x17f71a)['json'](_0x578dba);}return null;};}function patchUpdates(_0x4fa193){return function(_0x12d646){try{jsonpatch[_0x17cc('0x1e')](_0x12d646,_0x4fa193,!![]);}catch(_0x5511a3){return BPromise[_0x17cc('0x1f')](_0x5511a3);}return _0x12d646[_0x17cc('0x20')]();};}function saveUpdates(_0x5696f2,_0x39d220){return function(_0x4f632e){if(_0x4f632e){return _0x4f632e['update'](_0x5696f2)[_0x17cc('0x21')](function(_0x39c660){return _0x39c660;});}return null;};}function removeEntity(_0x56a6d1,_0x436fac){return function(_0xace29f){if(_0xace29f){return _0xace29f['destroy']()['then'](function(){_0x56a6d1[_0x17cc('0x16')](0xcc)[_0x17cc('0x22')]();});}};}function handleEntityNotFound(_0x3bb88c,_0x571a3e){return function(_0x5e249a){if(!_0x5e249a){_0x3bb88c[_0x17cc('0x23')](0x194);}return _0x5e249a;};}function handleError(_0x1b2b47,_0x2e6067){_0x2e6067=_0x2e6067||0x1f4;return function(_0x14167e){logger[_0x17cc('0x24')](_0x14167e[_0x17cc('0x25')]);if(_0x14167e[_0x17cc('0x26')]){delete _0x14167e[_0x17cc('0x26')];}_0x1b2b47[_0x17cc('0x16')](_0x2e6067)[_0x17cc('0x27')](_0x14167e);};}exports[_0x17cc('0x28')]=function(_0x914617,_0x9a8f17){var _0x3e9d16={},_0x15b4b1={},_0x5c9dbf={'count':0x0,'rows':[]};var _0x59a4dc=_[_0x17cc('0x29')](db['WhatsappTransferReport']['rawAttributes'],function(_0x4ad6e5){return{'name':_0x4ad6e5[_0x17cc('0x2a')],'type':_0x4ad6e5['type'][_0x17cc('0x2b')]};});_0x15b4b1[_0x17cc('0x2c')]=_[_0x17cc('0x29')](_0x59a4dc,_0x17cc('0x26'));_0x15b4b1[_0x17cc('0x2d')]=_[_0x17cc('0x2e')](_0x914617[_0x17cc('0x2d')]);_0x15b4b1['filters']=_[_0x17cc('0x2f')](_0x15b4b1[_0x17cc('0x2c')],_0x15b4b1['query']);_0x3e9d16[_0x17cc('0x30')]=_[_0x17cc('0x2f')](_0x15b4b1[_0x17cc('0x2c')],qs['fields'](_0x914617[_0x17cc('0x2d')][_0x17cc('0x31')]));_0x3e9d16[_0x17cc('0x30')]=_0x3e9d16[_0x17cc('0x30')][_0x17cc('0x32')]?_0x3e9d16['attributes']:_0x15b4b1[_0x17cc('0x2c')];if(!_0x914617['query'][_0x17cc('0x33')](_0x17cc('0x34'))){_0x3e9d16[_0x17cc('0x1a')]=qs[_0x17cc('0x1a')](_0x914617['query']['limit']);_0x3e9d16[_0x17cc('0x18')]=qs['offset'](_0x914617[_0x17cc('0x2d')]['offset']);}_0x3e9d16[_0x17cc('0x35')]=qs[_0x17cc('0x36')](_0x914617[_0x17cc('0x2d')]['sort']);_0x3e9d16['where']=qs[_0x17cc('0x37')](_[_0x17cc('0x38')](_0x914617[_0x17cc('0x2d')],_0x15b4b1['filters']),_0x59a4dc);if(_0x914617[_0x17cc('0x2d')]['filter']){_0x3e9d16[_0x17cc('0x39')]=_[_0x17cc('0x3a')](_0x3e9d16[_0x17cc('0x39')],{'$or':_['map'](_0x59a4dc,function(_0x2fe285){if(_0x2fe285[_0x17cc('0x3b')]!==_0x17cc('0x3c')){var _0x459866={};_0x459866[_0x2fe285[_0x17cc('0x26')]]={'$like':'%'+_0x914617[_0x17cc('0x2d')][_0x17cc('0x3d')]+'%'};return _0x459866;}})});}_0x3e9d16=_['merge']({},_0x3e9d16,_0x914617[_0x17cc('0x3e')]);var _0x33bfa3={'where':_0x3e9d16[_0x17cc('0x39')]};return db[_0x17cc('0x3f')]['count'](_0x33bfa3)[_0x17cc('0x21')](function(_0x4d0745){_0x5c9dbf[_0x17cc('0x1b')]=_0x4d0745;if(_0x914617[_0x17cc('0x2d')][_0x17cc('0x40')]){_0x3e9d16[_0x17cc('0x41')]=[{'all':!![]}];}return db[_0x17cc('0x3f')][_0x17cc('0x42')](_0x3e9d16);})[_0x17cc('0x21')](function(_0x364f8d){_0x5c9dbf[_0x17cc('0x43')]=_0x364f8d;return _0x5c9dbf;})[_0x17cc('0x21')](respondWithFilteredResult(_0x9a8f17,_0x3e9d16))['catch'](handleError(_0x9a8f17,null));};exports[_0x17cc('0x44')]=function(_0x1609f1,_0x494728){var _0x570501={'raw':!![],'where':{'id':_0x1609f1[_0x17cc('0x45')]['id']}},_0x25b71d={};_0x25b71d[_0x17cc('0x2c')]=_['keys'](db[_0x17cc('0x3f')][_0x17cc('0x46')]);_0x25b71d[_0x17cc('0x2d')]=_['keys'](_0x1609f1[_0x17cc('0x2d')]);_0x25b71d[_0x17cc('0x37')]=_[_0x17cc('0x2f')](_0x25b71d[_0x17cc('0x2c')],_0x25b71d[_0x17cc('0x2d')]);_0x570501['attributes']=_[_0x17cc('0x2f')](_0x25b71d[_0x17cc('0x2c')],qs['fields'](_0x1609f1['query'][_0x17cc('0x31')]));_0x570501[_0x17cc('0x30')]=_0x570501['attributes']['length']?_0x570501['attributes']:_0x25b71d[_0x17cc('0x2c')];if(_0x1609f1[_0x17cc('0x2d')][_0x17cc('0x40')]){_0x570501[_0x17cc('0x41')]=[{'all':!![]}];}_0x570501=_[_0x17cc('0x3a')]({},_0x570501,_0x1609f1[_0x17cc('0x3e')]);return db[_0x17cc('0x3f')][_0x17cc('0x47')](_0x570501)['then'](handleEntityNotFound(_0x494728,null))['then'](respondWithResult(_0x494728,null))[_0x17cc('0x48')](handleError(_0x494728,null));};exports['create']=function(_0x1b3768,_0x1b14f2){return db['WhatsappTransferReport'][_0x17cc('0x49')](_0x1b3768['body'],{})[_0x17cc('0x21')](respondWithResult(_0x1b14f2,0xc9))[_0x17cc('0x48')](handleError(_0x1b14f2,null));};exports[_0x17cc('0x4a')]=function(_0x385cdc,_0x49a170){if(_0x385cdc['body']['id']){delete _0x385cdc[_0x17cc('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x17cc('0x47')]({'where':{'id':_0x385cdc[_0x17cc('0x45')]['id']}})[_0x17cc('0x21')](handleEntityNotFound(_0x49a170,null))[_0x17cc('0x21')](saveUpdates(_0x385cdc[_0x17cc('0x4b')],null))[_0x17cc('0x21')](respondWithResult(_0x49a170,null))[_0x17cc('0x48')](handleError(_0x49a170,null));};exports[_0x17cc('0x4c')]=function(_0x5a8736,_0x22ea13){return db[_0x17cc('0x3f')]['find']({'where':{'id':_0x5a8736[_0x17cc('0x45')]['id']}})[_0x17cc('0x21')](handleEntityNotFound(_0x22ea13,null))[_0x17cc('0x21')](removeEntity(_0x22ea13,null))['catch'](handleError(_0x22ea13,null));};exports['describe']=function(_0x435608,_0x105ec4){return db[_0x17cc('0x3f')][_0x17cc('0x4d')]()[_0x17cc('0x21')](respondWithResult(_0x105ec4,null))['catch'](handleError(_0x105ec4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fe7f3bf..d6ae5c3 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 _0x6ad1=['path','rimraf','../../config/environment','exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a23b4,_0x320479){var _0x4123ad=function(_0x434780){while(--_0x434780){_0x5a23b4['push'](_0x5a23b4['shift']());}};_0x4123ad(++_0x320479);}(_0x6ad1,0xd6));var _0x16ad=function(_0x216eb0,_0xec9873){_0x216eb0=_0x216eb0-0x0;var _0x1d45d7=_0x6ad1[_0x216eb0];return _0x1d45d7;};'use strict';var _=require(_0x16ad('0x0'));var util=require(_0x16ad('0x1'));var logger=require(_0x16ad('0x2'))(_0x16ad('0x3'));var moment=require(_0x16ad('0x4'));var BPromise=require(_0x16ad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16ad('0x6'));var rimraf=require(_0x16ad('0x7'));var config=require(_0x16ad('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x16ad('0x9')]=function(_0x4ef8c5,_0x2a9263){return _0x4ef8c5['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x16ad('0xa'),'fields':[_0x16ad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb441=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x53f531,_0x202e60){var _0x312f00=function(_0x2a9014){while(--_0x2a9014){_0x53f531['push'](_0x53f531['shift']());}};_0x312f00(++_0x202e60);}(_0xb441,0x121));var _0x1b44=function(_0x556560,_0x46d944){_0x556560=_0x556560-0x0;var _0x3ac301=_0xb441[_0x556560];return _0x3ac301;};'use strict';var _=require(_0x1b44('0x0'));var util=require(_0x1b44('0x1'));var logger=require(_0x1b44('0x2'))(_0x1b44('0x3'));var moment=require(_0x1b44('0x4'));var BPromise=require('bluebird');var rp=require(_0x1b44('0x5'));var fs=require('fs');var path=require(_0x1b44('0x6'));var rimraf=require('rimraf');var config=require(_0x1b44('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x1f05c8,_0x502456){return _0x1f05c8[_0x1b44('0x8')](_0x1b44('0x9'),attributes,{'tableName':_0x1b44('0xa'),'paranoid':![],'indexes':[{'name':_0x1b44('0xb'),'fields':[_0x1b44('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 45415b4..e7cd7ce 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 _0xad14=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad14,0x123));var _0x4ad1=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xad14[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var moment=require(_0x4ad1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ad1('0x3'));var fs=require('fs');var Redis=require(_0x4ad1('0x4'));var db=require(_0x4ad1('0x5'))['db'];var utils=require(_0x4ad1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ad1('0x7'));var jayson=require(_0x4ad1('0x8'));var client=jayson[_0x4ad1('0x9')][_0x4ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4ba1,_0x5e0f02,_0x4f9506){return new BPromise(function(_0x1227d1,_0x6d8ee8){return client[_0x4ad1('0xb')](_0x5b4ba1,_0x4f9506)['then'](function(_0x1e8a22){logger['info'](_0x4ad1('0xc'),_0x5e0f02,_0x4ad1('0xd'));logger[_0x4ad1('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x5e0f02,_0x4ad1('0xd'),JSON[_0x4ad1('0xf')](_0x1e8a22));if(_0x1e8a22[_0x4ad1('0x10')]){if(_0x1e8a22[_0x4ad1('0x10')][_0x4ad1('0x11')]===0x1f4){logger[_0x4ad1('0x10')](_0x4ad1('0xc'),_0x5e0f02,_0x1e8a22['error']['message']);return _0x6d8ee8(_0x1e8a22[_0x4ad1('0x10')][_0x4ad1('0x12')]);}logger[_0x4ad1('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5e0f02,_0x1e8a22[_0x4ad1('0x10')]['message']);return _0x1227d1(_0x1e8a22[_0x4ad1('0x10')][_0x4ad1('0x12')]);}else{logger[_0x4ad1('0x13')](_0x4ad1('0xc'),_0x5e0f02,_0x4ad1('0xd'));_0x1227d1(_0x1e8a22[_0x4ad1('0x14')]['message']);}})[_0x4ad1('0x15')](function(_0x29e6fa){logger['error'](_0x4ad1('0xc'),_0x5e0f02,_0x29e6fa);_0x6d8ee8(_0x29e6fa);});});} \ No newline at end of file +var _0xdfa5=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdfa5,0x17a));var _0x5dfa=function(_0x2e15cf,_0x4d7201){_0x2e15cf=_0x2e15cf-0x0;var _0x1a2590=_0xdfa5[_0x2e15cf];return _0x1a2590;};'use strict';var _=require('lodash');var util=require(_0x5dfa('0x0'));var moment=require(_0x5dfa('0x1'));var BPromise=require(_0x5dfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dfa('0x3'));var db=require(_0x5dfa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dfa('0x5'))('rpc');var config=require(_0x5dfa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5dfa('0x7')][_0x5dfa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x220e93,_0xb040cf,_0xc7c2a3){return new BPromise(function(_0x505d4f,_0x30a831){return client[_0x5dfa('0x9')](_0x220e93,_0xc7c2a3)[_0x5dfa('0xa')](function(_0x14b31e){logger[_0x5dfa('0xb')](_0x5dfa('0xc'),_0xb040cf,_0x5dfa('0xd'));logger[_0x5dfa('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xb040cf,_0x5dfa('0xd'),JSON[_0x5dfa('0xf')](_0x14b31e));if(_0x14b31e['error']){if(_0x14b31e[_0x5dfa('0x10')][_0x5dfa('0x11')]===0x1f4){logger[_0x5dfa('0x10')](_0x5dfa('0xc'),_0xb040cf,_0x14b31e[_0x5dfa('0x10')][_0x5dfa('0x12')]);return _0x30a831(_0x14b31e[_0x5dfa('0x10')]['message']);}logger[_0x5dfa('0x10')](_0x5dfa('0xc'),_0xb040cf,_0x14b31e[_0x5dfa('0x10')]['message']);return _0x505d4f(_0x14b31e[_0x5dfa('0x10')]['message']);}else{logger[_0x5dfa('0xb')](_0x5dfa('0xc'),_0xb040cf,_0x5dfa('0xd'));_0x505d4f(_0x14b31e[_0x5dfa('0x13')][_0x5dfa('0x12')]);}})[_0x5dfa('0x14')](function(_0x379e88){logger[_0x5dfa('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0xb040cf,_0x379e88);_0x30a831(_0x379e88);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4fe49d9..47d2423 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c52=['start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','status','online','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','seedDB','default','then','listen','info'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x8c52,0x7e));var _0x28c5=function(_0x2cfbcf,_0x2cf96f){_0x2cfbcf=_0x2cfbcf-0x0;var _0x41fc13=_0x8c52[_0x2cfbcf];return _0x41fc13;};'use strict';var _=require(_0x28c5('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x28c5('0x1'));var checkLicense=require(_0x28c5('0x2'));var rpc=require(_0x28c5('0x3'));var config=require(_0x28c5('0x4'));var logger=require(_0x28c5('0x5'))(_0x28c5('0x6'));var pm2=require(_0x28c5('0x7'));var pm2Config=require(_0x28c5('0x8'));var schedule=require(_0x28c5('0x9'));var chat=require(_0x28c5('0xa'));var whatsapp=require(_0x28c5('0xb'));var transcribe=require(_0x28c5('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize']['sync']()['then'](function(){if(config[_0x28c5('0xd')]){return seedDb[_0x28c5('0xe')]();}})[_0x28c5('0xf')](function(){return checkLicense['default']();})[_0x28c5('0xf')](function(){return rpc[_0x28c5('0x10')]();})['then'](function(_0x3c4bba){logger[_0x28c5('0x11')](_0x3c4bba);return chat[_0x28c5('0x12')]();})[_0x28c5('0xf')](function(){return whatsapp[_0x28c5('0x12')]();})[_0x28c5('0xf')](function(){return schedule[_0x28c5('0x12')]();})[_0x28c5('0xf')](function(){return transcribe[_0x28c5('0x12')]();})[_0x28c5('0xf')](function(){return provider['start']();})[_0x28c5('0xf')](function(_0x4a4b01){logger[_0x28c5('0x11')](_0x4a4b01);return pm2[_0x28c5('0x12')](pm2Config);})['then'](function(_0x4520ea){var _0x236732=_0x4520ea[_0x28c5('0x13')](function(_0x20f186){return typeof _0x20f186[_0x28c5('0x14')]===_0x28c5('0x15')&&_0x20f186[_0x28c5('0x14')]>=0x0;});if(_0x236732[_0x28c5('0x16')]>0x0){throw new Error(_0x236732['length']+_0x28c5('0x17')+_[_0x28c5('0x18')](_0x236732,function(_0x19fc7f){return'\x22'+_0x19fc7f[_0x28c5('0x19')][_0x28c5('0x1a')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x28c5('0x18')](_[_0x28c5('0x13')](_0x4520ea,{'status':'online'}),_0x28c5('0x1a'))[_0x28c5('0x1b')]());logger['info']('Offline\x20apps:',_['map'](_[_0x28c5('0x13')](_0x4520ea,function(_0x21ffab){return _0x21ffab[_0x28c5('0x1c')]!==_0x28c5('0x1d');}),_0x28c5('0x1a'))[_0x28c5('0x1b')]()||_0x28c5('0x1e'));console[_0x28c5('0x1f')](_0x28c5('0x20'));})['catch'](function(_0x26c44d){console[_0x28c5('0x1f')](_0x28c5('0x21'),_0x26c44d);logger[_0x28c5('0x22')](_0x28c5('0x23'),_0x26c44d);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x3fa4=['./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','filter','online','name','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','lodash','./rpc','./config/environment','./config/logger','app'];(function(_0x53c5fb,_0x398f51){var _0x16ceab=function(_0x1b029a){while(--_0x1b029a){_0x53c5fb['push'](_0x53c5fb['shift']());}};_0x16ceab(++_0x398f51);}(_0x3fa4,0xf0));var _0x43fa=function(_0x4cfcbc,_0x5a7784){_0x4cfcbc=_0x4cfcbc-0x0;var _0x4ad589=_0x3fa4[_0x4cfcbc];return _0x4ad589;};'use strict';var _=require(_0x43fa('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x43fa('0x1'));var config=require(_0x43fa('0x2'));var logger=require(_0x43fa('0x3'))(_0x43fa('0x4'));var pm2=require(_0x43fa('0x5'));var pm2Config=require(_0x43fa('0x6'));var schedule=require(_0x43fa('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x43fa('0x8'));var transcribe=require(_0x43fa('0x9'));var provider=require(_0x43fa('0xa'));function main(){return db['sequelize'][_0x43fa('0xb')]()[_0x43fa('0xc')](function(){if(config[_0x43fa('0xd')]){return seedDb['default']();}})[_0x43fa('0xc')](function(){return checkLicense[_0x43fa('0xe')]();})['then'](function(){return rpc['listen']();})[_0x43fa('0xc')](function(_0x388c29){logger[_0x43fa('0xf')](_0x388c29);return chat[_0x43fa('0x10')]();})[_0x43fa('0xc')](function(){return whatsapp['start']();})[_0x43fa('0xc')](function(){return schedule[_0x43fa('0x10')]();})[_0x43fa('0xc')](function(){return transcribe['start']();})[_0x43fa('0xc')](function(){return provider[_0x43fa('0x10')]();})[_0x43fa('0xc')](function(_0x529c85){logger[_0x43fa('0xf')](_0x529c85);return pm2['start'](pm2Config);})['then'](function(_0x4fba54){var _0x36e063=_0x4fba54['filter'](function(_0x1a898a){return typeof _0x1a898a[_0x43fa('0x11')]==='number'&&_0x1a898a[_0x43fa('0x11')]>=0x0;});if(_0x36e063[_0x43fa('0x12')]>0x0){throw new Error(_0x36e063[_0x43fa('0x12')]+_0x43fa('0x13')+_[_0x43fa('0x14')](_0x36e063,function(_0x53c04c){return'\x22'+_0x53c04c['pm2_env']['name']+'\x22';}));}logger[_0x43fa('0xf')](_0x43fa('0x15'),_[_0x43fa('0x14')](_[_0x43fa('0x16')](_0x4fba54,{'status':_0x43fa('0x17')}),_0x43fa('0x18'))[_0x43fa('0x19')]());logger[_0x43fa('0xf')](_0x43fa('0x1a'),_['map'](_[_0x43fa('0x16')](_0x4fba54,function(_0x551528){return _0x551528[_0x43fa('0x1b')]!==_0x43fa('0x17');}),_0x43fa('0x18'))['join']()||_0x43fa('0x1c'));console[_0x43fa('0x1d')](_0x43fa('0x1e'));})[_0x43fa('0x1f')](function(_0x194936){console[_0x43fa('0x1d')](_0x43fa('0x20'),_0x194936);logger[_0x43fa('0x21')](_0x43fa('0x22'),_0x194936);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 2f65b5c..9e9a20b 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 _0x6570=['json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','authenticate','pass','status','Wrong\x20credentials.','Bearer','apikey','getUuid','query','find','Setting','allowedLoginAttempts','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','length','splice','unshift','join','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','unmanaged'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6570,0xdb));var _0x0657=function(_0x17d987,_0x55be23){_0x17d987=_0x17d987-0x0;var _0x453d32=_0x6570[_0x17d987];return _0x453d32;};'use strict';var db=require(_0x0657('0x0'))['db'];var config=require(_0x0657('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x0657('0x2'));var encryptor=require(_0x0657('0x3'));var _=require(_0x0657('0x4'));var jwt=require(_0x0657('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x0657('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x0657('0x7'));var BPromise=require(_0x0657('0x8'));var util=require(_0x0657('0x9'));var moment=require(_0x0657('0xa'));var validateJwt=expressJwt({'secret':config[_0x0657('0xb')][_0x0657('0xc')]});var userAttributes=['id',_0x0657('0xd'),_0x0657('0xe'),_0x0657('0xf'),_0x0657('0x10'),_0x0657('0x11'),_0x0657('0x12'),_0x0657('0x13'),'md5secret','voicePause','chatPause',_0x0657('0x14'),_0x0657('0x15'),_0x0657('0x16'),_0x0657('0x17'),_0x0657('0x18'),_0x0657('0x19'),_0x0657('0x1a'),_0x0657('0x1b'),_0x0657('0x1c'),_0x0657('0x1d'),_0x0657('0x1e'),'alias','phoneBarAutoAnswer',_0x0657('0x1f'),_0x0657('0x20'),_0x0657('0x21'),_0x0657('0x22'),'phoneBarEnableSettings',_0x0657('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x0657('0x24'),_0x0657('0x25'),_0x0657('0x26'),_0x0657('0x27'),_0x0657('0x28'),_0x0657('0x29'),'wssPort','downloadVoiceRecordings',_0x0657('0x2a'),_0x0657('0x2b'),'ignorePauseForPreviewCalls',_0x0657('0x2c'),_0x0657('0x2d'),_0x0657('0x2e'),_0x0657('0x2f'),_0x0657('0x30'),_0x0657('0x31'),_0x0657('0x32'),'openchannelAutoanswer',_0x0657('0x33'),_0x0657('0x34'),_0x0657('0x35'),_0x0657('0x36'),_0x0657('0x37'),_0x0657('0x38')];exports[_0x0657('0x39')]=function(){return this[_0x0657('0x3a')](!![])[_0x0657('0x3b')](function(_0x1c28c2,_0x19ec34,_0x36aed4){if(_0x1c28c2[_0x0657('0x3c')]){_0x36aed4();}else{return db[_0x0657('0x3d')][_0x0657('0x3e')]({'where':{'id':_0x1c28c2[_0x0657('0x3f')]['id']},'attributes':['id',_0x0657('0x40'),_0x0657('0x41')],'raw':!![]})[_0x0657('0x42')](function(_0x3e193e){if(_0x3e193e&&_0x3e193e[_0x0657('0x40')]&&!_0x1c28c2['query'][_0x0657('0x43')]){return _0x19ec34['status'](_0x3e193e['disposition']===_0x0657('0x44')?0x195:0x193)[_0x0657('0x45')]({'message':_0x3e193e['disposition']==='unmanaged'?_0x0657('0x46'):_0x0657('0x47')});}else{_0x36aed4();}})[_0x0657('0x48')](function(_0xf4ffc8){_0x36aed4(_0xf4ffc8);});}});};exports[_0x0657('0x3a')]=function isAuthenticated(_0x457053){return compose()[_0x0657('0x3b')](function(_0x52cb19,_0x49022d,_0x4fae5d){var _0x4db80c;if(_0x52cb19[_0x0657('0x49')][_0x0657('0x4a')]){if(_[_0x0657('0x4b')](_0x52cb19[_0x0657('0x49')][_0x0657('0x4a')],'Basic')){var _0x199ba3=basicAuth(_0x52cb19);db[_0x0657('0x4c')]['find']({'where':{'name':_0x199ba3[_0x0657('0xf')]}})['then'](function(_0x1f8c42){if(!_0x1f8c42||!_0x1f8c42[_0x0657('0x4d')](_0x199ba3[_0x0657('0x4e')])){return _0x49022d[_0x0657('0x4f')](0x191)[_0x0657('0x45')]({'message':_0x0657('0x50')});}_0x52cb19[_0x0657('0x3c')]={'id':_0x1f8c42['id']};_0x4fae5d();})[_0x0657('0x48')](function(_0x20468a){_0x4fae5d(_0x20468a);});}else if(_[_0x0657('0x4b')](_0x52cb19[_0x0657('0x49')][_0x0657('0x4a')],_0x0657('0x51'))){validateJwt(_0x52cb19,_0x49022d,_0x4fae5d);}else{if(_0x457053){_0x4fae5d();}else{return _0x49022d['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x52cb19['query'][_0x0657('0x52')]){try{var _0x45da9c={'audience':hardwareConf[_0x0657('0x53')](),'issuer':hardwareConf[_0x0657('0x53')]()};verifyJwt(_0x52cb19[_0x0657('0x54')][_0x0657('0x52')],_0x45da9c)[_0x0657('0x42')](function(_0x15b847){return db[_0x0657('0x4c')][_0x0657('0x55')]({'where':{'id':_0x15b847['sub']}})['then'](function(_0x262dae){_0x4db80c=_0x262dae;return db[_0x0657('0x56')][_0x0657('0x3e')]({'where':{'id':0x1},'attributes':[_0x0657('0x57'),'blockDuration'],'raw':!![]});})[_0x0657('0x42')](function(_0x486df9){if(!_0x4db80c||!_['isEqual'](_0x4db80c[_0x0657('0x58')],_0x15b847['nonce'])){return _0x49022d[_0x0657('0x4f')](0x191)[_0x0657('0x45')]({'message':_0x0657('0x59')});}if(_0x4db80c[_0x0657('0x5a')]){return _0x49022d[_0x0657('0x4f')](0x191)['json']({'message':_0x0657('0x5b')});}if(_0x4db80c[_0x0657('0x5c')]){if(_0x486df9[_0x0657('0x5d')]>0x0){if(moment(_0x4db80c[_0x0657('0x5e')])[_0x0657('0x5f')](_0x486df9['blockDuration'],'minutes')>moment()){return _0x49022d[_0x0657('0x4f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x49022d[_0x0657('0x4f')](0x191)[_0x0657('0x45')]({'message':_0x0657('0x5b')});}}_0x52cb19[_0x0657('0x3c')]={'id':_0x4db80c['id']};_0x4fae5d();});})[_0x0657('0x48')](function(){return _0x49022d[_0x0657('0x4f')](0x191)[_0x0657('0x45')]({'message':_0x0657('0x5b')});});}catch(_0x2651df){_0x4fae5d(_0x2651df);}}else if(_0x457053){_0x4fae5d();}else{return _0x49022d[_0x0657('0x4f')](0x193)['json']({'message':_0x0657('0x60')});}})['use'](function(_0x45022e,_0x3c81a1,_0x1e77ca){if(_0x45022e[_0x0657('0x3c')]){db[_0x0657('0x4c')]['find']({'where':{'id':_0x45022e[_0x0657('0x3c')]['id']},'attributes':userAttributes})[_0x0657('0x42')](function(_0x41b73a){if(!_0x41b73a){return _0x3c81a1['status'](0x194)[_0x0657('0x45')]({'message':_0x0657('0x61')});}_0x45022e[_0x0657('0x3c')]=_0x41b73a;_0x1e77ca();})[_0x0657('0x48')](function(_0x924f3c){_0x1e77ca(_0x924f3c);});}else if(_0x457053){_0x1e77ca();}else{return _0x3c81a1[_0x0657('0x4f')](0x194)[_0x0657('0x45')]({'message':_0x0657('0x62')});}});};exports[_0x0657('0x63')]=function canUpdate(){return compose()[_0x0657('0x3b')](function(_0x3383c6,_0x38c9de,_0x2ff119){return licenseUtil[_0x0657('0x64')]()[_0x0657('0x42')](function(_0x243c33){if(_0x243c33[_0x0657('0x65')]){_0x2ff119();}else{return _0x38c9de[_0x0657('0x4f')](0x193)['json']({'message':_0x0657('0x66')});}})['catch'](function(_0xd1459){_0x2ff119(_0xd1459);});});};exports[_0x0657('0x67')]=function isWebrtcLicence(){return compose()['use'](function(_0x4b6498,_0xdadc3a,_0x3afb60){return licenseUtil[_0x0657('0x64')]()[_0x0657('0x42')](function(_0x5debfb){if(_0x5debfb[_0x0657('0x68')]){_0x3afb60();}else{return _0xdadc3a[_0x0657('0x4f')](0x193)[_0x0657('0x45')]({'message':_0x0657('0x66')});}})[_0x0657('0x48')](function(_0x48450e){_0x3afb60(_0x48450e);});});};exports[_0x0657('0x69')]=function(_0x2373a0,_0x2d7f47,_0x1679ec){_0x2373a0[_0x0657('0x69')]=!![];return _0x1679ec();};exports[_0x0657('0x6a')]=function signToken(_0x5136b1){return signJwt(_0x5136b1);};exports[_0x0657('0x6b')]=function(_0xb2e01d,_0x360658){if(!_0xb2e01d['user']){return _0x360658['status'](0x194)[_0x0657('0x45')]({'message':_0x0657('0x6c')});}var _0x35d47e={'payload':{'id':_0xb2e01d[_0x0657('0x3c')]['id'],'role':_0xb2e01d[_0x0657('0x3c')][_0x0657('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x35d47e)['then'](function(_0x2e997f){_0x360658[_0x0657('0x6d')](_0x0657('0x6e'),_0x2e997f);_0x360658[_0x0657('0x6f')](_0x0657('0x70'));})['catch'](function(_0x36385d){return _0x360658[_0x0657('0x4f')](0x1f4)[_0x0657('0x71')](_0x36385d);});};exports['retrieveApiKey']=function(_0x555a9b){if(_[_0x0657('0x72')](_0x555a9b[_0x0657('0x58')])||_[_0x0657('0x72')](_0x555a9b[_0x0657('0x73')])){return null;}else{return createJwt(_0x555a9b);}};exports[_0x0657('0x74')]=function(_0x5d856b){_0x5d856b[_0x0657('0x58')]=generateNonce();_0x5d856b[_0x0657('0x73')]=generateIssuedAt();return createJwt(_0x5d856b);};exports[_0x0657('0x75')]=function(_0x247cd0,_0x4416c6){var _0x3ab6e8=_0x247cd0[_0x0657('0x54')][_0x0657('0x52')];if(_0x3ab6e8){var _0x85c50b={'nonce':_0x4416c6[_0x0657('0x58')],'iat':_0x4416c6[_0x0657('0x73')],'audience':hardwareConf[_0x0657('0x53')](),'issuer':hardwareConf[_0x0657('0x53')]()};return verifyJwt(_0x3ab6e8,_0x85c50b)['then'](function(){return generateApiKey(_0x4416c6);});}else{throw{'message':_0x0657('0x76')};}};exports[_0x0657('0x77')]=function(_0x1b1aed){var _0x1a8e83=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1a8e83[_0x0657('0x78')](_0x1b1aed))throw new db[(_0x0657('0x79'))][(_0x0657('0x7a'))](_0x0657('0x7b'));return;};exports[_0x0657('0x7c')]=function(_0x20b47e,_0x3eb8cf,_0x3833fa){var _0x46af52=encryptor[_0x0657('0x7d')](_0x3eb8cf)[_0x0657('0x7e')](',');for(var _0x413ba1=0x0;_0x413ba1<_0x3833fa;_0x413ba1++){if(!_0x46af52[_0x413ba1])break;if(_0x20b47e[_0x0657('0x7f')]()===_0x46af52[_0x413ba1]['toLowerCase']()){var _0x2a7e94=util[_0x0657('0x80')](_0x0657('0x81'),_0x3833fa);if(_0x3833fa===0x1){_0x2a7e94=_0x0657('0x82');}throw new db[(_0x0657('0x79'))][(_0x0657('0x7a'))](_0x2a7e94);}}return;};exports['updatePasswordsHistory']=function(_0x3d457f,_0x208c8c){var _0x5b820b=_0x208c8c?encryptor[_0x0657('0x7d')](_0x208c8c)[_0x0657('0x7e')](','):[];if(_0x5b820b[_0x0657('0x83')]===0x5){_0x5b820b[_0x0657('0x84')](-0x1,0x1);}_0x5b820b[_0x0657('0x85')](_0x3d457f);return encryptor['encryptString'](_0x5b820b[_0x0657('0x86')](','));};function signJwt(_0x430ecf){var _0x35a658=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x429c87=_0x430ecf['secret']||config[_0x0657('0xb')][_0x0657('0xc')];return new BPromise(function(_0x41fd54,_0x410e74){_0x35a658(_0x430ecf[_0x0657('0x87')],_0x429c87,_0x430ecf[_0x0657('0x88')])[_0x0657('0x42')](function(_0x289759){_0x41fd54(_0x289759);})['catch'](function(_0x2d4bd4){_0x410e74(_0x2d4bd4);});});}function verifyJwt(_0x23c727,_0x257072,_0x1f0bc2){var _0x13458f=BPromise[_0x0657('0x89')](jwt[_0x0657('0x8a')],{'context':jwt});var _0x530d26=_0x1f0bc2||config[_0x0657('0xb')]['session'];return new BPromise(function(_0x543616,_0x296d8c){_0x13458f(_0x23c727,_0x530d26,_0x257072)[_0x0657('0x42')](function(_0x2ce4a0){_0x543616(_0x2ce4a0);})[_0x0657('0x48')](function(_0x10fa43){_0x296d8c(_0x10fa43);});});}function generateNonce(){return crypto[_0x0657('0x8b')](0x10)[_0x0657('0x8c')](_0x0657('0x8d'));}function generateIssuedAt(){return Math[_0x0657('0x8e')](Date[_0x0657('0x8f')]()/0x3e8)[_0x0657('0x8c')]();}function createJwt(_0x284e86){var _0xdde326={'payload':{'iat':_0x284e86['apiKeyIat'],'nonce':_0x284e86[_0x0657('0x58')]},'options':{'algorithm':'HS512','subject':_0x284e86['id']['toString'](),'issuer':hardwareConf[_0x0657('0x53')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xdde326)[_0x0657('0x42')](function(_0x1e07e1){return{'iat':_0x284e86[_0x0657('0x73')],'nonce':_0x284e86[_0x0657('0x58')],'token':_0x1e07e1};});} \ No newline at end of file +var _0x9d94=['isWebrtcLicence','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','test','Sequelize','ValidationError','validatePasswordHistory','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.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','options','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','user','ChatInteraction','findOne','then','closed','query','status','json','disposition','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9d94,0x1db));var _0x49d9=function(_0x4a2fc5,_0x489168){_0x4a2fc5=_0x4a2fc5-0x0;var _0x271b59=_0x9d94[_0x4a2fc5];return _0x271b59;};'use strict';var db=require(_0x49d9('0x0'))['db'];var config=require(_0x49d9('0x1'));var hardwareConf=require(_0x49d9('0x2'));var licenseUtil=require(_0x49d9('0x3'));var encryptor=require(_0x49d9('0x4'));var _=require(_0x49d9('0x5'));var jwt=require(_0x49d9('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x49d9('0x7'));var basicAuth=require(_0x49d9('0x8'));var crypto=require(_0x49d9('0x9'));var BPromise=require(_0x49d9('0xa'));var util=require(_0x49d9('0xb'));var moment=require(_0x49d9('0xc'));var validateJwt=expressJwt({'secret':config[_0x49d9('0xd')]['session']});var userAttributes=['id',_0x49d9('0xe'),_0x49d9('0xf'),_0x49d9('0x10'),'internal',_0x49d9('0x11'),_0x49d9('0x12'),_0x49d9('0x13'),_0x49d9('0x14'),_0x49d9('0x15'),_0x49d9('0x16'),_0x49d9('0x17'),'faxPause',_0x49d9('0x18'),_0x49d9('0x19'),_0x49d9('0x1a'),'showWebBar','lastLoginAt',_0x49d9('0x1b'),_0x49d9('0x1c'),'allowmessenger','passwordResetAt',_0x49d9('0x1d'),_0x49d9('0x1e'),_0x49d9('0x1f'),_0x49d9('0x20'),_0x49d9('0x21'),_0x49d9('0x22'),_0x49d9('0x23'),'phoneBarExpires',_0x49d9('0x24'),_0x49d9('0x25'),_0x49d9('0x26'),_0x49d9('0x27'),_0x49d9('0x28'),_0x49d9('0x29'),_0x49d9('0x2a'),'settingsEnabled',_0x49d9('0x2b'),_0x49d9('0x2c'),'downloadOmnichannelInteractions',_0x49d9('0x2d'),'ignorePauseForPreviewCalls',_0x49d9('0x2e'),_0x49d9('0x2f'),_0x49d9('0x30'),_0x49d9('0x31'),_0x49d9('0x32'),'smsAutoanswer',_0x49d9('0x33'),_0x49d9('0x34'),_0x49d9('0x35'),'faxAutoanswer',_0x49d9('0x36'),_0x49d9('0x37'),_0x49d9('0x38'),_0x49d9('0x39')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x8c211f,_0x19f8d3,_0x5dc961){if(_0x8c211f[_0x49d9('0x3a')]){_0x5dc961();}else{return db[_0x49d9('0x3b')][_0x49d9('0x3c')]({'where':{'id':_0x8c211f['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49d9('0x3d')](function(_0x2475d3){if(_0x2475d3&&_0x2475d3[_0x49d9('0x3e')]&&!_0x8c211f[_0x49d9('0x3f')]['forceDownload']){return _0x19f8d3[_0x49d9('0x40')](_0x2475d3['disposition']==='unmanaged'?0x195:0x193)[_0x49d9('0x41')]({'message':_0x2475d3[_0x49d9('0x42')]===_0x49d9('0x43')?_0x49d9('0x44'):_0x49d9('0x45')});}else{_0x5dc961();}})[_0x49d9('0x46')](function(_0xe9cd7f){_0x5dc961(_0xe9cd7f);});}});};exports[_0x49d9('0x47')]=function isAuthenticated(_0x6885e3){return compose()[_0x49d9('0x48')](function(_0x6d280e,_0x8973c1,_0x1971a8){var _0xf4b1ae;if(_0x6d280e[_0x49d9('0x49')][_0x49d9('0x4a')]){if(_[_0x49d9('0x4b')](_0x6d280e[_0x49d9('0x49')][_0x49d9('0x4a')],_0x49d9('0x4c'))){var _0x5d0844=basicAuth(_0x6d280e);db['User'][_0x49d9('0x4d')]({'where':{'name':_0x5d0844['name']}})['then'](function(_0x4afb08){if(!_0x4afb08||!_0x4afb08[_0x49d9('0x4e')](_0x5d0844[_0x49d9('0x4f')])){return _0x8973c1[_0x49d9('0x40')](0x191)[_0x49d9('0x41')]({'message':_0x49d9('0x50')});}_0x6d280e['user']={'id':_0x4afb08['id']};_0x1971a8();})['catch'](function(_0x41ad11){_0x1971a8(_0x41ad11);});}else if(_[_0x49d9('0x4b')](_0x6d280e['headers'][_0x49d9('0x4a')],'Bearer')){validateJwt(_0x6d280e,_0x8973c1,_0x1971a8);}else{if(_0x6885e3){_0x1971a8();}else{return _0x8973c1[_0x49d9('0x40')](0x193)['json']({'message':_0x49d9('0x51')});}}}else if(_0x6d280e[_0x49d9('0x3f')][_0x49d9('0x52')]){try{var _0x52fc3f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x49d9('0x53')]()};verifyJwt(_0x6d280e['query']['apikey'],_0x52fc3f)[_0x49d9('0x3d')](function(_0x53f818){return db[_0x49d9('0x54')][_0x49d9('0x4d')]({'where':{'id':_0x53f818[_0x49d9('0x55')]}})[_0x49d9('0x3d')](function(_0x166b36){_0xf4b1ae=_0x166b36;return db[_0x49d9('0x56')][_0x49d9('0x3c')]({'where':{'id':0x1},'attributes':[_0x49d9('0x57'),_0x49d9('0x58')],'raw':!![]});})[_0x49d9('0x3d')](function(_0x581ad1){if(!_0xf4b1ae||!_[_0x49d9('0x59')](_0xf4b1ae[_0x49d9('0x5a')],_0x53f818[_0x49d9('0x5b')])){return _0x8973c1[_0x49d9('0x40')](0x191)[_0x49d9('0x41')]({'message':_0x49d9('0x5c')});}if(_0xf4b1ae[_0x49d9('0x5d')]){return _0x8973c1[_0x49d9('0x40')](0x191)[_0x49d9('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xf4b1ae[_0x49d9('0x5e')]){if(_0x581ad1['blockDuration']>0x0){if(moment(_0xf4b1ae[_0x49d9('0x5f')])[_0x49d9('0x60')](_0x581ad1[_0x49d9('0x58')],_0x49d9('0x61'))>moment()){return _0x8973c1[_0x49d9('0x40')](0x191)['json']({'message':_0x49d9('0x62')});}}else{return _0x8973c1[_0x49d9('0x40')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x6d280e[_0x49d9('0x3a')]={'id':_0xf4b1ae['id']};_0x1971a8();});})[_0x49d9('0x46')](function(){return _0x8973c1['status'](0x191)[_0x49d9('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x46fe02){_0x1971a8(_0x46fe02);}}else if(_0x6885e3){_0x1971a8();}else{return _0x8973c1[_0x49d9('0x40')](0x193)[_0x49d9('0x41')]({'message':_0x49d9('0x51')});}})[_0x49d9('0x48')](function(_0x13efff,_0x5eec6f,_0x104ac4){if(_0x13efff[_0x49d9('0x3a')]){db[_0x49d9('0x54')]['find']({'where':{'id':_0x13efff[_0x49d9('0x3a')]['id']},'attributes':userAttributes})[_0x49d9('0x3d')](function(_0x4ad675){if(!_0x4ad675){return _0x5eec6f[_0x49d9('0x40')](0x194)['json']({'message':_0x49d9('0x63')});}_0x13efff['user']=_0x4ad675;_0x104ac4();})[_0x49d9('0x46')](function(_0x2c28e2){_0x104ac4(_0x2c28e2);});}else if(_0x6885e3){_0x104ac4();}else{return _0x5eec6f[_0x49d9('0x40')](0x194)[_0x49d9('0x41')]({'message':_0x49d9('0x64')});}});};exports[_0x49d9('0x65')]=function canUpdate(){return compose()['use'](function(_0x54181a,_0x137058,_0x598723){return licenseUtil[_0x49d9('0x66')]()[_0x49d9('0x3d')](function(_0x54d267){if(_0x54d267[_0x49d9('0x67')]){_0x598723();}else{return _0x137058[_0x49d9('0x40')](0x193)[_0x49d9('0x41')]({'message':_0x49d9('0x68')});}})[_0x49d9('0x46')](function(_0x5b2843){_0x598723(_0x5b2843);});});};exports[_0x49d9('0x69')]=function isWebrtcLicence(){return compose()[_0x49d9('0x48')](function(_0x530536,_0x4e310c,_0x3cf908){return licenseUtil[_0x49d9('0x66')]()['then'](function(_0x3dac5d){if(_0x3dac5d['webrtc']){_0x3cf908();}else{return _0x4e310c[_0x49d9('0x40')](0x193)[_0x49d9('0x41')]({'message':'Forbidden'});}})[_0x49d9('0x46')](function(_0x3e5931){_0x3cf908(_0x3e5931);});});};exports[_0x49d9('0x6a')]=function(_0x707b78,_0x4658a3,_0x2a34f9){_0x707b78[_0x49d9('0x6a')]=!![];return _0x2a34f9();};exports[_0x49d9('0x6b')]=function signToken(_0x264920){return signJwt(_0x264920);};exports[_0x49d9('0x6c')]=function(_0xbb7cfd,_0x2b3c9e){if(!_0xbb7cfd[_0x49d9('0x3a')]){return _0x2b3c9e[_0x49d9('0x40')](0x194)[_0x49d9('0x41')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xc1099d={'payload':{'id':_0xbb7cfd['user']['id'],'role':_0xbb7cfd[_0x49d9('0x3a')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xc1099d)[_0x49d9('0x3d')](function(_0x28e792){_0x2b3c9e[_0x49d9('0x6d')](_0x49d9('0x6e'),_0x28e792);_0x2b3c9e[_0x49d9('0x6f')](_0x49d9('0x70'));})[_0x49d9('0x46')](function(_0x47abc6){return _0x2b3c9e['status'](0x1f4)['send'](_0x47abc6);});};exports[_0x49d9('0x71')]=function(_0xa0dc9b){if(_[_0x49d9('0x72')](_0xa0dc9b[_0x49d9('0x5a')])||_[_0x49d9('0x72')](_0xa0dc9b['apiKeyIat'])){return null;}else{return createJwt(_0xa0dc9b);}};exports[_0x49d9('0x73')]=function(_0x2f1ccf){_0x2f1ccf[_0x49d9('0x5a')]=generateNonce();_0x2f1ccf[_0x49d9('0x74')]=generateIssuedAt();return createJwt(_0x2f1ccf);};exports[_0x49d9('0x75')]=function(_0x544d92,_0x5975ea){var _0x47fbb0=_0x544d92[_0x49d9('0x3f')][_0x49d9('0x52')];if(_0x47fbb0){var _0x22e3f5={'nonce':_0x5975ea[_0x49d9('0x5a')],'iat':_0x5975ea[_0x49d9('0x74')],'audience':hardwareConf[_0x49d9('0x53')](),'issuer':hardwareConf[_0x49d9('0x53')]()};return verifyJwt(_0x47fbb0,_0x22e3f5)[_0x49d9('0x3d')](function(){return generateApiKey(_0x5975ea);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x1b4e8b){var _0x25bdee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x25bdee[_0x49d9('0x76')](_0x1b4e8b))throw new db[(_0x49d9('0x77'))][(_0x49d9('0x78'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x49d9('0x79')]=function(_0x3accfd,_0x2b5912,_0xfacc05){var _0x35e5a7=encryptor['decryptString'](_0x2b5912)['split'](',');for(var _0x27b8aa=0x0;_0x27b8aa<_0xfacc05;_0x27b8aa++){if(!_0x35e5a7[_0x27b8aa])break;if(_0x3accfd[_0x49d9('0x7a')]()===_0x35e5a7[_0x27b8aa]['toLowerCase']()){var _0x25a34b=util[_0x49d9('0x7b')](_0x49d9('0x7c'),_0xfacc05);if(_0xfacc05===0x1){_0x25a34b=_0x49d9('0x7d');}throw new db[(_0x49d9('0x77'))][(_0x49d9('0x78'))](_0x25a34b);}}return;};exports[_0x49d9('0x7e')]=function(_0x13f33b,_0x2ab251){var _0x1b7ddb=_0x2ab251?encryptor['decryptString'](_0x2ab251)[_0x49d9('0x7f')](','):[];if(_0x1b7ddb[_0x49d9('0x80')]===0x5){_0x1b7ddb[_0x49d9('0x81')](-0x1,0x1);}_0x1b7ddb[_0x49d9('0x82')](_0x13f33b);return encryptor[_0x49d9('0x83')](_0x1b7ddb[_0x49d9('0x84')](','));};function signJwt(_0x1cea61){var _0x4d9ed9=BPromise[_0x49d9('0x85')](jwt[_0x49d9('0x86')],{'context':jwt});var _0x147337=_0x1cea61[_0x49d9('0x87')]||config['secrets'][_0x49d9('0x88')];return new BPromise(function(_0x469c35,_0xf72009){_0x4d9ed9(_0x1cea61[_0x49d9('0x89')],_0x147337,_0x1cea61[_0x49d9('0x8a')])[_0x49d9('0x3d')](function(_0x3b831e){_0x469c35(_0x3b831e);})[_0x49d9('0x46')](function(_0x4ed08e){_0xf72009(_0x4ed08e);});});}function verifyJwt(_0x52ae33,_0x26fbbc,_0x261d7a){var _0x1a37cd=BPromise[_0x49d9('0x85')](jwt['verify'],{'context':jwt});var _0x19a310=_0x261d7a||config[_0x49d9('0xd')][_0x49d9('0x88')];return new BPromise(function(_0x588df4,_0x39a88b){_0x1a37cd(_0x52ae33,_0x19a310,_0x26fbbc)['then'](function(_0x2b8da9){_0x588df4(_0x2b8da9);})[_0x49d9('0x46')](function(_0x22e7c0){_0x39a88b(_0x22e7c0);});});}function generateNonce(){return crypto[_0x49d9('0x8b')](0x10)[_0x49d9('0x8c')](_0x49d9('0x8d'));}function generateIssuedAt(){return Math[_0x49d9('0x8e')](Date[_0x49d9('0x8f')]()/0x3e8)[_0x49d9('0x8c')]();}function createJwt(_0x17126e){var _0x121dac={'payload':{'iat':_0x17126e['apiKeyIat'],'nonce':_0x17126e[_0x49d9('0x5a')]},'options':{'algorithm':_0x49d9('0x90'),'subject':_0x17126e['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x49d9('0x53')]()}};return signJwt(_0x121dac)['then'](function(_0x553b73){return{'iat':_0x17126e[_0x49d9('0x74')],'nonce':_0x17126e['apiKeyNonce'],'token':_0x553b73};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index d029640..371f310 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 _0x957f=['countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','./sql-utils','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','where','default','fields','filter','user','tags','skip','ids','tag'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x957f,0x10f));var _0xf957=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0x957f[_0x179b74];return _0x268f76;};'use strict';var _=require(_0xf957('0x0'));var sqlUtils=require(_0xf957('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x488023,_0x225d9d,_0x48c2da,_0x67d867){var _0x4abc38={'count':0x0,'rows':[]};var _0x4027ef=sqlUtils[_0xf957('0x2')](_0x225d9d,_0x488023);if(_0x4027ef){return Promise[_0xf957('0x3')](_0x4abc38);}var _0x16e34b=sqlUtils[_0xf957('0x4')]();var _0x59a734={};var _0x48cf3c=![];var _0x3145d9=![];return Promise[_0xf957('0x3')]()[_0xf957('0x5')](function(){if(_0x488023['search']){return sqlUtils[_0xf957('0x6')](_0x488023[_0xf957('0x7')],_0x67d867);}else{return sqlUtils['parseQueryParameters'](_0x488023,_0x67d867);}})['then'](function(_0x162ed6){_0x16e34b[_0xf957('0x8')](_0x162ed6[_0xf957('0x9')]);_0x16e34b[_0xf957('0x8')](_0x162ed6[_0xf957('0xa')]);_0x16e34b[_0xf957('0x8')](_0x162ed6[_0xf957('0xb')]);_0x16e34b['where'](_0x162ed6[_0xf957('0xc')]['clause']);_0x59a734=_0x162ed6[_0xf957('0xd')];_0x3145d9=_0x162ed6[_0xf957('0xc')][_0xf957('0xe')];return sqlUtils['checkListsRestrictions'](_0x225d9d,_0x488023,_0x3145d9);})[_0xf957('0x5')](function(_0x4f199b){_0x16e34b[_0xf957('0x8')](_0x4f199b);var _0x4067ae=_0x488023[_0xf957('0x7')]?_0x59a734[_0xf957('0xf')]:_0x488023[_0xf957('0x10')];_0x48cf3c=_0x4067ae?!![]:![];return sqlUtils[_0xf957('0x11')](_0x16e34b,_0x4067ae);})[_0xf957('0x5')](function(_0x301824){_0x4abc38[_0xf957('0x12')]=_0x301824;if(_0x4abc38[_0xf957('0x12')]===0x0){return;}if(_0x488023[_0xf957('0x13')]){_0x3145d9=!![];}return sqlUtils[_0xf957('0x14')](_0x16e34b,_0x488023[_0xf957('0xa')],_0x48c2da,_0x48cf3c,_0x59a734[_0xf957('0x15')],_0x3145d9);})[_0xf957('0x5')](function(_0x3fc914){if(!_0x3fc914){return[];}return sqlUtils[_0xf957('0x16')](_0x3fc914,_0x488023,_0x48c2da);})[_0xf957('0x5')](function(_0x30feff){_0x4abc38[_0xf957('0x17')]=_0x30feff;return _0x4abc38;})[_0xf957('0x18')](function(_0x4b74a8){throw _0x4b74a8;});};exports[_0xf957('0x19')]=function(){var _0x409516={};var _0x441c65=[];return db[_0xf957('0x1a')][_0xf957('0x19')]()[_0xf957('0x5')](function(_0x1e739b){_0x409516=_0x1e739b;var _0x1c0fb5=Object[_0xf957('0x1b')](_0x409516)[_0xf957('0xb')](function(_0xb86df6){return _['startsWith'](_0xb86df6,_0xf957('0x1c'))?_0xb86df6:undefined;});var _0x39631a=_0x1c0fb5[_0xf957('0x1d')](function(_0x5b9e4d){return db[_0xf957('0x1e')][_0xf957('0x1f')]({'where':{'id':_0x5b9e4d['slice'](0x3)},'raw':!![]});});return Promise[_0xf957('0x20')](_0x39631a);})[_0xf957('0x5')](function(_0x315db0){for(var _0x3db9c4=0x0;_0x3db9c4<_0x315db0[_0xf957('0x21')];_0x3db9c4++){if(_0x315db0[_0x3db9c4]){var _0x13ab6f=_0xf957('0x1c')+_0x315db0[_0x3db9c4]['id'];_0x409516[_0x13ab6f][_0xf957('0x22')]=_0x315db0[_0x3db9c4]['type'];}}_0x441c65=_[_0xf957('0x1d')](Object[_0xf957('0x1b')](_0x409516),function(_0x3e4eaf){return{'name':_0x3e4eaf,'type':_0x409516[_0x3e4eaf][_0xf957('0x23')]};});return _0x441c65;})[_0xf957('0x18')](function(_0x4cca20){throw _0x4cca20;});}; \ No newline at end of file +var _0xfa20=['skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','skip','checkListsRestrictions','count','User','buildContactsQuery','getFilteredContacts','describe','keys','startsWith','cf_','map','findOne','slice','all','fieldType','type','catch','lodash','./sql-utils','findAll'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfa20,0x168));var _0x0fa2=function(_0x51f796,_0x1c9b4a){_0x51f796=_0x51f796-0x0;var _0x40b047=_0xfa20[_0x51f796];return _0x40b047;};'use strict';var _=require(_0x0fa2('0x0'));var sqlUtils=require(_0x0fa2('0x1'));var db=require('../../mysqldb')['db'];exports[_0x0fa2('0x2')]=function(_0x13a7ab,_0x497294,_0x436faa,_0x4a0693){var _0x5d69f3={'count':0x0,'rows':[]};var _0x39ce96=sqlUtils[_0x0fa2('0x3')](_0x497294,_0x13a7ab);if(_0x39ce96){return Promise[_0x0fa2('0x4')](_0x5d69f3);}var _0x4bcb01=sqlUtils[_0x0fa2('0x5')]();var _0x47366c={};var _0x32957a=![];var _0x475bb9=![];return Promise[_0x0fa2('0x4')]()['then'](function(){if(_0x13a7ab[_0x0fa2('0x6')]){return sqlUtils[_0x0fa2('0x7')](_0x13a7ab[_0x0fa2('0x6')],_0x4a0693);}else{return sqlUtils[_0x0fa2('0x8')](_0x13a7ab,_0x4a0693);}})[_0x0fa2('0x9')](function(_0x5e1cac){_0x4bcb01[_0x0fa2('0xa')](_0x5e1cac[_0x0fa2('0xb')]);_0x4bcb01[_0x0fa2('0xa')](_0x5e1cac[_0x0fa2('0xc')]);_0x4bcb01[_0x0fa2('0xa')](_0x5e1cac[_0x0fa2('0xd')]);_0x4bcb01[_0x0fa2('0xa')](_0x5e1cac[_0x0fa2('0xe')][_0x0fa2('0xf')]);_0x47366c=_0x5e1cac['tags'];_0x475bb9=_0x5e1cac['user'][_0x0fa2('0x10')];return sqlUtils[_0x0fa2('0x11')](_0x497294,_0x13a7ab,_0x475bb9);})[_0x0fa2('0x9')](function(_0x4ab785){_0x4bcb01['where'](_0x4ab785);var _0x4d142f=_0x13a7ab['search']?_0x47366c['ids']:_0x13a7ab['tag'];_0x32957a=_0x4d142f?!![]:![];return sqlUtils['countFilteredContacts'](_0x4bcb01,_0x4d142f);})[_0x0fa2('0x9')](function(_0x41e07a){_0x5d69f3[_0x0fa2('0x12')]=_0x41e07a;if(_0x5d69f3[_0x0fa2('0x12')]===0x0){return;}if(_0x13a7ab[_0x0fa2('0x13')]){_0x475bb9=!![];}return sqlUtils[_0x0fa2('0x14')](_0x4bcb01,_0x13a7ab[_0x0fa2('0xc')],_0x436faa,_0x32957a,_0x47366c[_0x0fa2('0xf')],_0x475bb9);})['then'](function(_0x32ad2e){if(!_0x32ad2e){return[];}return sqlUtils[_0x0fa2('0x15')](_0x32ad2e,_0x13a7ab,_0x436faa);})[_0x0fa2('0x9')](function(_0x2e8b43){_0x5d69f3['rows']=_0x2e8b43;return _0x5d69f3;})['catch'](function(_0x2f667b){throw _0x2f667b;});};exports[_0x0fa2('0x16')]=function(){var _0x3bd123={};var _0x282216=[];return db['CmContact'][_0x0fa2('0x16')]()[_0x0fa2('0x9')](function(_0x1f1e7d){_0x3bd123=_0x1f1e7d;var _0x39a588=Object[_0x0fa2('0x17')](_0x3bd123)[_0x0fa2('0xd')](function(_0x38d893){return _[_0x0fa2('0x18')](_0x38d893,_0x0fa2('0x19'))?_0x38d893:undefined;});var _0xb68233=_0x39a588[_0x0fa2('0x1a')](function(_0x221a18){return db['CmCustomField'][_0x0fa2('0x1b')]({'where':{'id':_0x221a18[_0x0fa2('0x1c')](0x3)},'raw':!![]});});return Promise[_0x0fa2('0x1d')](_0xb68233);})['then'](function(_0x2c393e){for(var _0x539dd2=0x0;_0x539dd2<_0x2c393e['length'];_0x539dd2++){if(_0x2c393e[_0x539dd2]){var _0x31458a=_0x0fa2('0x19')+_0x2c393e[_0x539dd2]['id'];_0x3bd123[_0x31458a][_0x0fa2('0x1e')]=_0x2c393e[_0x539dd2][_0x0fa2('0x1f')];}}_0x282216=_[_0x0fa2('0x1a')](Object['keys'](_0x3bd123),function(_0x58a228){return{'name':_0x58a228,'type':_0x3bd123[_0x58a228]['type']};});return _0x282216;})[_0x0fa2('0x20')](function(_0x2561a6){throw _0x2561a6;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index f68ce51..61a66d5 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 _0xefcf=['find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','text','value','start','end','Tag','map','clause','tags','ids','User','user','and','uc.UserId\x20=\x20?','some','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','query','Tags','clone','COUNT(*)','isEmpty','toString','exports','lodash','squel','../interaction/utils','../../mysqldb','role','agent','search','ListId','true','from','where','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions'];(function(_0x534163,_0x43fba4){var _0x5de81a=function(_0x49e8c1){while(--_0x49e8c1){_0x534163['push'](_0x534163['shift']());}};_0x5de81a(++_0x43fba4);}(_0xefcf,0x1da));var _0xfefc=function(_0x13d5bc,_0x3fce3c){_0x13d5bc=_0x13d5bc-0x0;var _0x4b8a40=_0xefcf[_0x13d5bc];return _0x4b8a40;};'use strict';var _=require(_0xfefc('0x0'));var squel=require(_0xfefc('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xfefc('0x2'));var db=require(_0xfefc('0x3'))['db'];function skipContactsQuery(_0x596a96,_0x480065){var _0x2dd927=![];if(_0x596a96[_0xfefc('0x4')]===_0xfefc('0x5')&&!_0x480065[_0xfefc('0x6')]&&!_0x480065[_0xfefc('0x7')]&&_0x480065['autocomplete']!==_0xfefc('0x8')){_0x2dd927=!![];}return _0x2dd927;}function getContactsSubquery(){return squel['select']()[_0xfefc('0x9')]('cm_contacts','c')[_0xfefc('0xa')](_0xfefc('0xb'));}function applyJoinClauses(_0x482b27,_0x4b59d4){var _0x1295fa=_0x4b59d4?'c':'subqry';_0x482b27['left_join'](_0xfefc('0xc'),'uc',_0xfefc('0xd')+_0x1295fa+_0xfefc('0xe'))[_0xfefc('0xf')](_0xfefc('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x1295fa+_0xfefc('0xe'))[_0xfefc('0xf')]('tools_tags','t',_0xfefc('0x11'));return _0x482b27;}function addFieldsToQuery(_0x4618d4,_0x26368e,_0x2b42a9,_0x25a567,_0x3b7b22){var _0x3d1bf8=_0x3b7b22?'c':_0xfefc('0x12');if(!_0x26368e){_0x26368e=['id',_0xfefc('0x13'),_0xfefc('0x14'),_0xfefc('0x15'),_0xfefc('0x16'),_0xfefc('0x17'),_0xfefc('0x18'),'ListId','CompanyId','createdAt','updatedAt',_0xfefc('0x19'),_0xfefc('0x1a')];}else if(!_0x26368e[_0xfefc('0x1b')]('id')){_0x26368e[_0xfefc('0x1c')]('id');}var _0x4b0082=_0x2b42a9&&_0x3b7b22||!_0x2b42a9&&!_0x3b7b22;if(_0x25a567){_0x4b0082=_0x25a567&&_0x3b7b22||!_0x25a567&&!_0x3b7b22;}_0x26368e[_0xfefc('0x1d')](function(_0x3af273){if(_0x3af273===_0xfefc('0x1a')){if(_0x4b0082){_0x4618d4[_0xfefc('0x1e')](_0xfefc('0x1f'),_0x3af273);}else if(_0x2b42a9||_0x25a567){_0x4618d4[_0xfefc('0x1e')](_0x3d1bf8+'.'+_0x3af273);}}else{_0x4618d4['field'](_0x3d1bf8+'.'+_0x3af273);}});return _0x4618d4;}function getSqlClauses(){var _0xa28966={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xfefc('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xfefc('0x20')](),'skip':![]}};return _0xa28966;}function parseTagParameter(_0x2534e8){var _0x2e8aaa=squel[_0xfefc('0x20')]();if(_0x2534e8){var _0x2bf31e=utils[_0xfefc('0x21')](_0x2534e8);_0x2bf31e[_0xfefc('0x1d')](function(_0x3607e3){_0x2e8aaa['or'](_0xfefc('0x22'),'%,'+_0x3607e3+',%');});}return _0x2e8aaa;}function parseSearchFilter(_0x2f5316){var _0x2f4e64=squel['expr']();if(_0x2f5316){var _0x13e8fd=_0x2f5316[_0xfefc('0x23')]('\x5c','\x5c\x5c')[_0xfefc('0x23')](/'/g,'\x27\x27');if(_0x13e8fd[_0xfefc('0x24')]('\x20')[_0xfefc('0x25')]>0x1){_0x2f4e64['or'](_0xfefc('0x26'),qs[_0xfefc('0x27')](_0x13e8fd,!![]),null);}else{if(qs['isNumeric'](_0x13e8fd)){_0x2f4e64['or'](_0xfefc('0x28'),_0x13e8fd+'%');_0x2f4e64['or']('c.phone\x20LIKE\x20?',_0x13e8fd+'%');_0x2f4e64['or'](_0xfefc('0x29'),_0x13e8fd+'%');_0x2f4e64['or']('c.fax\x20LIKE\x20?',_0x13e8fd+'%');}else if(qs['isEmail'](_0x13e8fd)){_0x2f4e64['or']('c.email\x20LIKE\x20?',_0x13e8fd+'%');}else{_0x2f4e64['or']('c.firstName\x20LIKE\x20?','%'+_0x13e8fd+'%');_0x2f4e64['or'](_0xfefc('0x2a'),'%'+_0x13e8fd+'%');_0x2f4e64['or'](_0xfefc('0x2b'),'%'+_0x13e8fd+'%');}}}return _0x2f4e64;}function parseAdvancedSearchFilter(_0x3770ce,_0x40f9f5){var _0x44db15=getSqlClauses();var _0x2e9f1b=as[_0xfefc('0x2c')](_0x3770ce);var _0x84abdd=_0x2e9f1b['sqlOperator'];for(var _0x122c69=0x0;_0x122c69<_0x2e9f1b[_0xfefc('0x2d')][_0xfefc('0x25')];_0x122c69++){var _0x36452e=_0x2e9f1b[_0xfefc('0x2d')][_0x122c69];var _0xabe9c9='c';var _0x4be7ba=_[_0xfefc('0x2e')](_0x40f9f5,[_0xfefc('0x2f'),_0x36452e[_0xfefc('0x1e')]]);if(_0x4be7ba){if(_0x36452e[_0xfefc('0x1e')]===_0xfefc('0x30')||_0x4be7ba[_0xfefc('0x31')]===_0xfefc('0x32')){_0x36452e[_0xfefc('0x33')]=_0xfefc('0x34');}var _0x16628d=as['buildExpression'](_0xabe9c9,_0x4be7ba[_0xfefc('0x35')],_0x36452e);_0x44db15[_0xfefc('0x36')][_0x84abdd](_0x16628d[_0xfefc('0x37')],_0x16628d[_0xfefc('0x38')][_0xfefc('0x39')],_0x16628d[_0xfefc('0x38')][_0xfefc('0x3a')]);}else{if(_0x36452e[_0xfefc('0x1e')]===_0xfefc('0x3b')){var _0x508258=_0x36452e[_0xfefc('0x38')][_0xfefc('0x24')](',')[_0xfefc('0x3c')](function(_0xdfb5f4){return Number(_0xdfb5f4);});var _0x5ee254=parseTagParameter(_0x508258);_0x44db15['tags'][_0xfefc('0x3d')]['and'](_0x5ee254);_0x44db15[_0xfefc('0x3e')][_0xfefc('0x3f')]=_0x508258;}else if(_0x36452e[_0xfefc('0x1e')]===_0xfefc('0x40')){_0x44db15[_0xfefc('0x41')][_0xfefc('0x3d')][_0xfefc('0x42')](_0xfefc('0x43'),_0x36452e[_0xfefc('0x38')]);_0x44db15[_0xfefc('0x41')]['skip']=!![];}}}return _0x44db15;}function parseModelFields(_0x2b3c46,_0x6ed9d2){var _0x36d094=squel[_0xfefc('0x20')]();var _0x61db0=_(_0x2b3c46)['keys']()['map'](function(_0x22a5f2){return _[_0xfefc('0x44')](_0x6ed9d2,[_0xfefc('0x2f'),_0x22a5f2])?_0x22a5f2:undefined;})['compact']()['value']();if(_0x2b3c46['Contact']){_0x61db0[_0xfefc('0x1c')]('Contact');}if(_0x2b3c46['User']){_0x61db0[_0xfefc('0x1c')](_0xfefc('0x40'));}if(_0x61db0['length']>0x0){_0x61db0['forEach'](function(_0x3511bd){if(_0x3511bd===_0xfefc('0x7')){_0x36d094[_0xfefc('0x42')](_0xfefc('0x45'),[][_0xfefc('0x46')](_0x2b3c46[_0x3511bd]));}else if(_0x3511bd==='Contact'){var _0x35210c='%'+_0x2b3c46[_0x3511bd]+'%';_0x36d094['and'](_0xfefc('0x47'),_0x35210c);}else if(_0x3511bd===_0xfefc('0x40')){_0x36d094[_0xfefc('0x42')](_0xfefc('0x43'),_0x2b3c46[_0x3511bd]);}else{_0x36d094['and']('c.'+_0x3511bd+_0xfefc('0x48'),_0x2b3c46[_0x3511bd]);}});}return _0x36d094;}function parseQueryParameters(_0x530c53,_0x394c2c){var _0x1e7a6a=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x530c53,_0x394c2c);})[_0xfefc('0x49')](function(_0x40bb93){_0x1e7a6a[_0xfefc('0x4a')][_0xfefc('0x42')](_0x40bb93);return parseTagParameter(_0x530c53[_0xfefc('0x4b')]);})['then'](function(_0x132b6e){_0x1e7a6a[_0xfefc('0x3e')][_0xfefc('0x3d')][_0xfefc('0x42')](_0x132b6e);return parseSearchFilter(_0x530c53[_0xfefc('0x4c')]);})[_0xfefc('0x49')](function(_0x3857ab){_0x1e7a6a[_0xfefc('0x4c')]=_0x3857ab;return _0x1e7a6a;});}function checkListsRestrictions(_0x2c0020,_0x2ed854,_0x13b29a){var _0x11490e=squel[_0xfefc('0x20')]();return Promise[_0xfefc('0x4d')]()['then'](function(){if(_0x2ed854[_0xfefc('0x6')]&&_0x2c0020[_0xfefc('0x4')]===_0xfefc('0x5')&&!_0x13b29a){return _0x2c0020[_0xfefc('0x4e')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4b6ba1){if(_0x4b6ba1){if(_0x4b6ba1['length']===0x0){_0x11490e[_0xfefc('0x42')](_0xfefc('0x4f'));}else{_0x11490e[_0xfefc('0x42')]('c.ListId\x20IN\x20?',_[_0xfefc('0x3c')](_0x4b6ba1,'id'));}}})['then'](function(){return _0x11490e;});}function buildContactsQuery(_0x371759,_0x1ff8b0,_0x16c1d7,_0xad634e,_0xffe268,_0x32acbf){if(_0x1ff8b0){_0x1ff8b0=_0x16c1d7[_0xfefc('0x50')];}_0x371759=addFieldsToQuery(_0x371759,_0x1ff8b0,_0xad634e,_0x32acbf,!![]);var _0x4b3d26=squel[_0xfefc('0x51')]();_0x4b3d26=addFieldsToQuery(_0x4b3d26,_0x1ff8b0,_0xad634e,_0x32acbf,![]);if(_0xad634e||_0x32acbf){_0x371759=applyJoinClauses(_0x371759,!![]);_0x371759[_0xfefc('0x52')](_0xfefc('0x53'));if(_0x16c1d7['limit']){_0x4b3d26[_0xfefc('0x54')](_0x16c1d7[_0xfefc('0x54')]);}if(_0x16c1d7[_0xfefc('0x55')]){_0x4b3d26[_0xfefc('0x55')](_0x16c1d7[_0xfefc('0x55')]);}}else{_0x4b3d26=applyJoinClauses(_0x4b3d26,![]);_0x4b3d26[_0xfefc('0x52')](_0xfefc('0x56'));if(_0x16c1d7[_0xfefc('0x54')]){_0x371759[_0xfefc('0x54')](_0x16c1d7[_0xfefc('0x54')]);}if(_0x16c1d7[_0xfefc('0x55')]){_0x371759[_0xfefc('0x55')](_0x16c1d7['offset']);}}_0x4b3d26[_0xfefc('0x57')](_0xffe268);if(_0x16c1d7[_0xfefc('0x58')]){_0x16c1d7[_0xfefc('0x58')][_0xfefc('0x1d')](function(_0x462ec1){_0x371759['order']('c.'+_0x462ec1[0x0],_0x462ec1[0x1]===_0xfefc('0x59')?![]:!![]);_0x4b3d26[_0xfefc('0x58')](_0xfefc('0x5a')+_0x462ec1[0x0],_0x462ec1[0x1]===_0xfefc('0x59')?![]:!![]);});}_0x4b3d26[_0xfefc('0x9')](_0x371759,_0xfefc('0x12'));return _0x4b3d26;}function getFilteredContacts(_0x23bc45){var _0xc2b839=[];return db['Tag']['findAll']({'attributes':['id','name',_0xfefc('0x5b')],'raw':!![]})['then'](function(_0x318340){_0xc2b839=_[_0xfefc('0x5c')](_0x318340,'id');var _0x256f85={'type':db[_0xfefc('0x5d')][_0xfefc('0x5e')][_0xfefc('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xfefc('0x60')][_0xfefc('0x61')](_0x23bc45['toString'](),_0x256f85);})[_0xfefc('0x49')](function(_0x29d94a){_0x29d94a['forEach'](function(_0x502e11){if(_0x502e11[_0xfefc('0x1a')]){_0x502e11[_0xfefc('0x62')]=[];_0x502e11[_0xfefc('0x1a')][_0xfefc('0x24')](',')[_0xfefc('0x1d')](function(_0x2c766d){_0x502e11[_0xfefc('0x62')][_0xfefc('0x1c')](_0xc2b839[_0x2c766d]);});}delete _0x502e11['TagIds'];});return _0x29d94a;});}function countFilteredContacts(_0x5c529c,_0x579b2b){var _0x520ab8=_0x5c529c[_0xfefc('0x63')]();_0x520ab8[_0xfefc('0x1e')](_0xfefc('0x64'));_0x520ab8=applyJoinClauses(_0x520ab8,!![]);_0x5c529c[_0xfefc('0x52')]('c.id');var _0x54d1e8=utils[_0xfefc('0x21')](_0x579b2b);if(!_[_0xfefc('0x65')](_0x54d1e8)){_0x520ab8[_0xfefc('0xa')]('t.id\x20IN\x20?',_0x54d1e8);}var _0x465b38={'type':db[_0xfefc('0x5d')]['QueryTypes'][_0xfefc('0x5f')],'raw':!![]};return db['sequelize'][_0xfefc('0x61')](_0x520ab8[_0xfefc('0x66')](),_0x465b38)[_0xfefc('0x49')](function(_0x1b98b3){return _0x1b98b3[0x0][_0xfefc('0x64')];});}module[_0xfefc('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x2fa3=['keyBy','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','Sequelize','sequelize','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','dateOfBirth','fieldType','castTo','DATE','buildExpression','default','start','value','end','Tag','map','tags','ids','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','name','color'];(function(_0x284050,_0x3ea975){var _0x74e261=function(_0x3f9ace){while(--_0x3f9ace){_0x284050['push'](_0x284050['shift']());}};_0x74e261(++_0x3ea975);}(_0x2fa3,0xf4));var _0x32fa=function(_0x2efc25,_0x403b2f){_0x2efc25=_0x2efc25-0x0;var _0xe5238f=_0x2fa3[_0x2efc25];return _0xe5238f;};'use strict';var _=require(_0x32fa('0x0'));var squel=require(_0x32fa('0x1'));var as=require(_0x32fa('0x2'));var qs=require(_0x32fa('0x3'));var utils=require(_0x32fa('0x4'));var db=require(_0x32fa('0x5'))['db'];function skipContactsQuery(_0xbf4515,_0x16e3b9){var _0x59343b=![];if(_0xbf4515[_0x32fa('0x6')]===_0x32fa('0x7')&&!_0x16e3b9[_0x32fa('0x8')]&&!_0x16e3b9[_0x32fa('0x9')]&&_0x16e3b9[_0x32fa('0xa')]!==_0x32fa('0xb')){_0x59343b=!![];}return _0x59343b;}function getContactsSubquery(){return squel[_0x32fa('0xc')]()[_0x32fa('0xd')](_0x32fa('0xe'),'c')[_0x32fa('0xf')](_0x32fa('0x10'));}function applyJoinClauses(_0x18d807,_0x3364ac){var _0x122a4f=_0x3364ac?'c':_0x32fa('0x11');_0x18d807[_0x32fa('0x12')]('cm_user_has_contacts','uc',_0x32fa('0x13')+_0x122a4f+_0x32fa('0x14'))['left_join'](_0x32fa('0x15'),'ct',_0x32fa('0x16')+_0x122a4f+_0x32fa('0x14'))[_0x32fa('0x12')](_0x32fa('0x17'),'t',_0x32fa('0x18'));return _0x18d807;}function addFieldsToQuery(_0xe9f570,_0x2c00cc,_0x3f49b9,_0x187c96,_0x50aac5){var _0x43e62e=_0x50aac5?'c':_0x32fa('0x11');if(!_0x2c00cc){_0x2c00cc=['id',_0x32fa('0x19'),_0x32fa('0x1a'),_0x32fa('0x1b'),_0x32fa('0x1c'),_0x32fa('0x1d'),_0x32fa('0x1e'),_0x32fa('0x9'),_0x32fa('0x1f'),'createdAt',_0x32fa('0x20'),_0x32fa('0x21'),_0x32fa('0x22')];}else if(!_0x2c00cc[_0x32fa('0x23')]('id')){_0x2c00cc[_0x32fa('0x24')]('id');}var _0x36cde6=_0x3f49b9&&_0x50aac5||!_0x3f49b9&&!_0x50aac5;if(_0x187c96){_0x36cde6=_0x187c96&&_0x50aac5||!_0x187c96&&!_0x50aac5;}_0x2c00cc[_0x32fa('0x25')](function(_0x18ace7){if(_0x18ace7===_0x32fa('0x22')){if(_0x36cde6){_0xe9f570[_0x32fa('0x26')](_0x32fa('0x27'),_0x18ace7);}else if(_0x3f49b9||_0x187c96){_0xe9f570[_0x32fa('0x26')](_0x43e62e+'.'+_0x18ace7);}}else{_0xe9f570['field'](_0x43e62e+'.'+_0x18ace7);}});return _0xe9f570;}function getSqlClauses(){var _0x22615d={'default':squel[_0x32fa('0x28')](),'fields':squel[_0x32fa('0x28')](),'filter':squel[_0x32fa('0x28')](),'tags':{'clause':squel[_0x32fa('0x28')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x22615d;}function parseTagParameter(_0x4cfb08){var _0x35222e=squel['expr']();if(_0x4cfb08){var _0x63f43e=utils[_0x32fa('0x29')](_0x4cfb08);_0x63f43e[_0x32fa('0x25')](function(_0x3b8bd5){_0x35222e['or'](_0x32fa('0x2a'),'%,'+_0x3b8bd5+',%');});}return _0x35222e;}function parseSearchFilter(_0x3b380d){var _0x22854d=squel[_0x32fa('0x28')]();if(_0x3b380d){var _0x4fdbbb=_0x3b380d[_0x32fa('0x2b')]('\x5c','\x5c\x5c')[_0x32fa('0x2b')](/'/g,'\x27\x27');if(_0x4fdbbb[_0x32fa('0x2c')]('\x20')['length']>0x1){_0x22854d['or'](_0x32fa('0x2d'),qs[_0x32fa('0x2e')](_0x4fdbbb,!![]),null);}else{if(qs['isNumeric'](_0x4fdbbb)){_0x22854d['or'](_0x32fa('0x2f'),_0x4fdbbb+'%');_0x22854d['or'](_0x32fa('0x30'),_0x4fdbbb+'%');_0x22854d['or'](_0x32fa('0x31'),_0x4fdbbb+'%');_0x22854d['or'](_0x32fa('0x32'),_0x4fdbbb+'%');}else if(qs[_0x32fa('0x33')](_0x4fdbbb)){_0x22854d['or'](_0x32fa('0x34'),_0x4fdbbb+'%');}else{_0x22854d['or'](_0x32fa('0x35'),'%'+_0x4fdbbb+'%');_0x22854d['or'](_0x32fa('0x36'),'%'+_0x4fdbbb+'%');_0x22854d['or']('c.email\x20LIKE\x20?','%'+_0x4fdbbb+'%');}}}return _0x22854d;}function parseAdvancedSearchFilter(_0x2e1940,_0x1d47df){var _0x107b74=getSqlClauses();var _0x411217=as[_0x32fa('0x37')](_0x2e1940);var _0x116438=_0x411217[_0x32fa('0x38')];for(var _0x588526=0x0;_0x588526<_0x411217[_0x32fa('0x39')][_0x32fa('0x3a')];_0x588526++){var _0x11256d=_0x411217['conditions'][_0x588526];var _0x4c31c2='c';var _0x32272d=_['find'](_0x1d47df,['name',_0x11256d[_0x32fa('0x26')]]);if(_0x32272d){if(_0x11256d[_0x32fa('0x26')]===_0x32fa('0x3b')||_0x32272d[_0x32fa('0x3c')]==='datetime'){_0x11256d[_0x32fa('0x3d')]=_0x32fa('0x3e');}var _0xf7cbf6=as[_0x32fa('0x3f')](_0x4c31c2,_0x32272d['type'],_0x11256d);_0x107b74[_0x32fa('0x40')][_0x116438](_0xf7cbf6['text'],_0xf7cbf6['value'][_0x32fa('0x41')],_0xf7cbf6[_0x32fa('0x42')][_0x32fa('0x43')]);}else{if(_0x11256d['field']===_0x32fa('0x44')){var _0x4df33b=_0x11256d[_0x32fa('0x42')][_0x32fa('0x2c')](',')[_0x32fa('0x45')](function(_0x1dbe5e){return Number(_0x1dbe5e);});var _0xc7e71f=parseTagParameter(_0x4df33b);_0x107b74[_0x32fa('0x46')]['clause']['and'](_0xc7e71f);_0x107b74[_0x32fa('0x46')][_0x32fa('0x47')]=_0x4df33b;}else if(_0x11256d[_0x32fa('0x26')]===_0x32fa('0x48')){_0x107b74[_0x32fa('0x49')][_0x32fa('0x4a')][_0x32fa('0x4b')](_0x32fa('0x4c'),_0x11256d[_0x32fa('0x42')]);_0x107b74[_0x32fa('0x49')][_0x32fa('0x4d')]=!![];}}}return _0x107b74;}function parseModelFields(_0x3dd628,_0x1734d4){var _0xcbf681=squel[_0x32fa('0x28')]();var _0x13f1cc=_(_0x3dd628)[_0x32fa('0x4e')]()[_0x32fa('0x45')](function(_0x274369){return _[_0x32fa('0x4f')](_0x1734d4,['name',_0x274369])?_0x274369:undefined;})[_0x32fa('0x50')]()[_0x32fa('0x42')]();if(_0x3dd628[_0x32fa('0x51')]){_0x13f1cc[_0x32fa('0x24')](_0x32fa('0x51'));}if(_0x3dd628['User']){_0x13f1cc['push'](_0x32fa('0x48'));}if(_0x13f1cc[_0x32fa('0x3a')]>0x0){_0x13f1cc[_0x32fa('0x25')](function(_0x4e51ac){if(_0x4e51ac===_0x32fa('0x9')){_0xcbf681[_0x32fa('0x4b')](_0x32fa('0x52'),[]['concat'](_0x3dd628[_0x4e51ac]));}else if(_0x4e51ac===_0x32fa('0x51')){var _0x588156='%'+_0x3dd628[_0x4e51ac]+'%';_0xcbf681[_0x32fa('0x4b')](_0x32fa('0x53'),_0x588156);}else if(_0x4e51ac===_0x32fa('0x48')){_0xcbf681['and'](_0x32fa('0x4c'),_0x3dd628[_0x4e51ac]);}else{_0xcbf681[_0x32fa('0x4b')]('c.'+_0x4e51ac+_0x32fa('0x54'),_0x3dd628[_0x4e51ac]);}});}return _0xcbf681;}function parseQueryParameters(_0x5be13e,_0x3d1898){var _0x215f22=getSqlClauses();return Promise[_0x32fa('0x55')]()[_0x32fa('0x56')](function(){return parseModelFields(_0x5be13e,_0x3d1898);})[_0x32fa('0x56')](function(_0x5b6232){_0x215f22[_0x32fa('0x57')][_0x32fa('0x4b')](_0x5b6232);return parseTagParameter(_0x5be13e[_0x32fa('0x58')]);})[_0x32fa('0x56')](function(_0x4f36a3){_0x215f22[_0x32fa('0x46')][_0x32fa('0x4a')][_0x32fa('0x4b')](_0x4f36a3);return parseSearchFilter(_0x5be13e[_0x32fa('0x59')]);})[_0x32fa('0x56')](function(_0x40dcd3){_0x215f22[_0x32fa('0x59')]=_0x40dcd3;return _0x215f22;});}function checkListsRestrictions(_0x39bb2b,_0x225247,_0x1adb87){var _0x41e15b=squel[_0x32fa('0x28')]();return Promise[_0x32fa('0x55')]()[_0x32fa('0x56')](function(){if(_0x225247[_0x32fa('0x8')]&&_0x39bb2b[_0x32fa('0x6')]===_0x32fa('0x7')&&!_0x1adb87){return _0x39bb2b[_0x32fa('0x5a')]({'attributes':['id'],'raw':!![]});}})[_0x32fa('0x56')](function(_0x3d745e){if(_0x3d745e){if(_0x3d745e['length']===0x0){_0x41e15b[_0x32fa('0x4b')](_0x32fa('0x5b'));}else{_0x41e15b[_0x32fa('0x4b')](_0x32fa('0x52'),_['map'](_0x3d745e,'id'));}}})[_0x32fa('0x56')](function(){return _0x41e15b;});}function buildContactsQuery(_0x53a20b,_0x2b016f,_0x346528,_0x2aa51e,_0x2b1b98,_0x1468af){if(_0x2b016f){_0x2b016f=_0x346528[_0x32fa('0x5c')];}_0x53a20b=addFieldsToQuery(_0x53a20b,_0x2b016f,_0x2aa51e,_0x1468af,!![]);var _0x69306d=squel['select']();_0x69306d=addFieldsToQuery(_0x69306d,_0x2b016f,_0x2aa51e,_0x1468af,![]);if(_0x2aa51e||_0x1468af){_0x53a20b=applyJoinClauses(_0x53a20b,!![]);_0x53a20b[_0x32fa('0x5d')]('c.id');if(_0x346528[_0x32fa('0x5e')]){_0x69306d[_0x32fa('0x5e')](_0x346528['limit']);}if(_0x346528[_0x32fa('0x5f')]){_0x69306d['offset'](_0x346528[_0x32fa('0x5f')]);}}else{_0x69306d=applyJoinClauses(_0x69306d,![]);_0x69306d['group'](_0x32fa('0x60'));if(_0x346528['limit']){_0x53a20b['limit'](_0x346528[_0x32fa('0x5e')]);}if(_0x346528[_0x32fa('0x5f')]){_0x53a20b[_0x32fa('0x5f')](_0x346528['offset']);}}_0x69306d[_0x32fa('0x61')](_0x2b1b98);if(_0x346528[_0x32fa('0x62')]){_0x346528['order'][_0x32fa('0x25')](function(_0x212c6c){_0x53a20b['order']('c.'+_0x212c6c[0x0],_0x212c6c[0x1]===_0x32fa('0x63')?![]:!![]);_0x69306d['order'](_0x32fa('0x64')+_0x212c6c[0x0],_0x212c6c[0x1]===_0x32fa('0x63')?![]:!![]);});}_0x69306d['from'](_0x53a20b,_0x32fa('0x11'));return _0x69306d;}function getFilteredContacts(_0xb92c1a){var _0xc4cff6=[];return db['Tag'][_0x32fa('0x65')]({'attributes':['id',_0x32fa('0x66'),_0x32fa('0x67')],'raw':!![]})[_0x32fa('0x56')](function(_0x1cc980){_0xc4cff6=_[_0x32fa('0x68')](_0x1cc980,'id');var _0x4a5d3f={'type':db['Sequelize'][_0x32fa('0x69')][_0x32fa('0x6a')],'model':db[_0x32fa('0x6b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x32fa('0x6c')](_0xb92c1a[_0x32fa('0x6d')](),_0x4a5d3f);})[_0x32fa('0x56')](function(_0xdc75fb){_0xdc75fb[_0x32fa('0x25')](function(_0x17a218){if(_0x17a218[_0x32fa('0x22')]){_0x17a218[_0x32fa('0x6e')]=[];_0x17a218[_0x32fa('0x22')][_0x32fa('0x2c')](',')[_0x32fa('0x25')](function(_0x5e8365){_0x17a218[_0x32fa('0x6e')][_0x32fa('0x24')](_0xc4cff6[_0x5e8365]);});}delete _0x17a218[_0x32fa('0x22')];});return _0xdc75fb;});}function countFilteredContacts(_0x83f963,_0x338f66){var _0x4697a7=_0x83f963[_0x32fa('0x6f')]();_0x4697a7[_0x32fa('0x26')]('COUNT(*)');_0x4697a7=applyJoinClauses(_0x4697a7,!![]);_0x83f963['group']('c.id');var _0x4912f4=utils[_0x32fa('0x29')](_0x338f66);if(!_['isEmpty'](_0x4912f4)){_0x4697a7[_0x32fa('0xf')]('t.id\x20IN\x20?',_0x4912f4);}var _0x4418b9={'type':db[_0x32fa('0x70')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x32fa('0x71')][_0x32fa('0x6c')](_0x4697a7[_0x32fa('0x6d')](),_0x4418b9)[_0x32fa('0x56')](function(_0x211c54){return _0x211c54[0x0][_0x32fa('0x72')];});}module[_0x32fa('0x73')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 0eed608..cad3dad 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 _0x5838=['encryptString','createCipher','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','write','end','final','binary','close','unlink','createDecipher'];(function(_0x58c8f3,_0x15d60c){var _0x3bcfb9=function(_0x463b1c){while(--_0x463b1c){_0x58c8f3['push'](_0x58c8f3['shift']());}};_0x3bcfb9(++_0x15d60c);}(_0x5838,0x6c));var _0x8583=function(_0x520822,_0x208b36){_0x520822=_0x520822-0x0;var _0x3d8cb6=_0x5838[_0x520822];return _0x3d8cb6;};'use strict';var crypto=require(_0x8583('0x0'));var fs=require('fs');var BPromise=require(_0x8583('0x1'));var _=require(_0x8583('0x2'));var config=require(_0x8583('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8583('0x4')][_0x8583('0x5')],'algorithm':_0x8583('0x6')};const fileOptions={'algorithm':_0x8583('0x7')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8583('0x8')][_0x8583('0x9')]);if(isSupported){fileOptions[_0x8583('0x9')]=config[_0x8583('0x8')][_0x8583('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8583('0xa')](',\x20');logger[_0x8583('0xb')](config[_0x8583('0x8')][_0x8583('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4b56b1){return AES_SUPPORTED_RX[_0x8583('0xc')](_0x4b56b1);}function getSupportedCiphers(){return crypto[_0x8583('0xd')]()[_0x8583('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x14db96){return getSupportedCiphers()['indexOf'](_0x14db96)>-0x1;}function combineOptions(_0x5bd0b2){var _0x451e06={};for(var _0x1fd6e1 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1fd6e1)){_0x451e06[_0x1fd6e1]=fileOptions[_0x1fd6e1];}}if(_0x5bd0b2){for(var _0x607612 in _0x5bd0b2){if(_0x5bd0b2[_0x8583('0xf')](_0x607612)){_0x451e06[_0x607612]=_0x5bd0b2[_0x607612];}}}return _0x451e06;}exports[_0x8583('0x10')]=function(_0x2fe57a,_0x408327,_0x195b85,_0x6100){return new BPromise(function(_0x5b55be,_0x1c91b3){_0x6100=combineOptions(_0x6100);var _0x385d6f=new Buffer(_0x195b85);var _0x70bf14=fs[_0x8583('0x11')](_0x2fe57a);var _0x5cf9a7=fs[_0x8583('0x12')](_0x408327);var _0x57d219=crypto['createCipher'](_0x6100[_0x8583('0x9')],_0x385d6f);_0x70bf14['on'](_0x8583('0x13'),function(_0x211197){var _0x245fec=new Buffer(_0x57d219[_0x8583('0x14')](_0x211197),'binary');_0x5cf9a7[_0x8583('0x15')](_0x245fec);});_0x70bf14['on'](_0x8583('0x16'),function(){try{var _0x3cc42b=new Buffer(_0x57d219[_0x8583('0x17')](_0x8583('0x18')),_0x8583('0x18'));_0x5cf9a7['write'](_0x3cc42b);_0x5cf9a7[_0x8583('0x16')]();_0x5cf9a7['on'](_0x8583('0x19'),function(){return _0x5b55be(_0x408327);});}catch(_0x5a229f){fs[_0x8583('0x1a')](_0x408327);return _0x1c91b3(_0x5a229f);}});});};exports['decryptFile']=function(_0x4a4250,_0x14be2a,_0x59788e,_0x2a8e0f){return new BPromise(function(_0x4d419e,_0xb02c32){_0x2a8e0f=combineOptions(_0x2a8e0f);var _0x38dc6e=new Buffer(_0x59788e);var _0x5adbd0=fs[_0x8583('0x11')](_0x4a4250);var _0x5aef95=fs[_0x8583('0x12')](_0x14be2a);var _0x233ec2=crypto[_0x8583('0x1b')](_0x2a8e0f[_0x8583('0x9')],_0x38dc6e);_0x5adbd0['on'](_0x8583('0x13'),function(_0x54e199){var _0x2205ab=new Buffer(_0x233ec2[_0x8583('0x14')](_0x54e199),_0x8583('0x18'));_0x5aef95['write'](_0x2205ab);});_0x5adbd0['on'](_0x8583('0x16'),function(){try{var _0x4dd0d0=new Buffer(_0x233ec2[_0x8583('0x17')](_0x8583('0x18')),_0x8583('0x18'));_0x5aef95[_0x8583('0x15')](_0x4dd0d0);_0x5aef95[_0x8583('0x16')]();_0x5aef95['on'](_0x8583('0x19'),function(){return _0x4d419e(_0x14be2a);});}catch(_0x3e3ef1){fs['unlink'](_0x14be2a);return _0xb02c32(_0x3e3ef1);}});});};exports[_0x8583('0x1c')]=function(_0x3ad5e7,_0x540c96,_0x2a3b65){var _0x292174=_0x2a3b65||stringOptions[_0x8583('0x9')];var _0x53d817=_0x540c96||stringOptions['secret'];var _0x5865aa=crypto[_0x8583('0x1d')](_0x292174,_0x53d817);var _0x4dd182=_0x5865aa[_0x8583('0x14')](_0x3ad5e7,_0x8583('0x1e'),_0x8583('0x1f'));_0x4dd182+=_0x5865aa[_0x8583('0x17')]('base64');return _0x4dd182;};exports[_0x8583('0x20')]=function(_0x51f5c3,_0xd6970d,_0x32015d){var _0x1aa339=_0x32015d||stringOptions[_0x8583('0x9')];var _0x326f5b=_0xd6970d||stringOptions[_0x8583('0x21')];var _0x39a8ad=crypto[_0x8583('0x1b')](_0x1aa339,_0x326f5b);var _0xa16022=_0x39a8ad[_0x8583('0x14')](_0x51f5c3,_0x8583('0x1f'),'utf8');_0xa16022+=_0x39a8ad[_0x8583('0x17')](_0x8583('0x1e'));return _0xa16022;}; \ No newline at end of file +var _0xbc0d=['indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','end','final','binary','write','close','unlink','createWriteStream','update','secret','utf8','base64','decryptString','createDecipher','crypto','lodash','../../config/environment','../../config/logger','app','secrets','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter'];(function(_0x1610a4,_0x416bf5){var _0x476d45=function(_0x4d409b){while(--_0x4d409b){_0x1610a4['push'](_0x1610a4['shift']());}};_0x476d45(++_0x416bf5);}(_0xbc0d,0x9b));var _0xdbc0=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xbc0d[_0x585d81];return _0x1aca0d;};'use strict';var crypto=require(_0xdbc0('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xdbc0('0x1'));var config=require(_0xdbc0('0x2'));var logger=require(_0xdbc0('0x3'))(_0xdbc0('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xdbc0('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xdbc0('0x6')};if(config[_0xdbc0('0x7')]&&config[_0xdbc0('0x7')][_0xdbc0('0x8')]){var isSupported=isAlgorithmSupported(config[_0xdbc0('0x7')]['algorithm']);if(isSupported){fileOptions[_0xdbc0('0x8')]=config[_0xdbc0('0x7')][_0xdbc0('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xdbc0('0x9')](',\x20');logger[_0xdbc0('0xa')](config[_0xdbc0('0x7')]['algorithm'],_0xdbc0('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1d14ba){return AES_SUPPORTED_RX[_0xdbc0('0xc')](_0x1d14ba);}function getSupportedCiphers(){return crypto[_0xdbc0('0xd')]()[_0xdbc0('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x2489b1){return getSupportedCiphers()[_0xdbc0('0xf')](_0x2489b1)>-0x1;}function combineOptions(_0x28afab){var _0x39c039={};for(var _0x4a0be3 in fileOptions){if(fileOptions[_0xdbc0('0x10')](_0x4a0be3)){_0x39c039[_0x4a0be3]=fileOptions[_0x4a0be3];}}if(_0x28afab){for(var _0x8c4c05 in _0x28afab){if(_0x28afab['hasOwnProperty'](_0x8c4c05)){_0x39c039[_0x8c4c05]=_0x28afab[_0x8c4c05];}}}return _0x39c039;}exports[_0xdbc0('0x11')]=function(_0x31f010,_0x12ed9a,_0x33f965,_0x2c8e69){return new BPromise(function(_0x46ac84,_0x1f546b){_0x2c8e69=combineOptions(_0x2c8e69);var _0x38bdb8=new Buffer(_0x33f965);var _0x5600ce=fs[_0xdbc0('0x12')](_0x31f010);var _0x461571=fs['createWriteStream'](_0x12ed9a);var _0x595a7e=crypto[_0xdbc0('0x13')](_0x2c8e69['algorithm'],_0x38bdb8);_0x5600ce['on'](_0xdbc0('0x14'),function(_0x30a371){var _0x3406a4=new Buffer(_0x595a7e['update'](_0x30a371),'binary');_0x461571['write'](_0x3406a4);});_0x5600ce['on'](_0xdbc0('0x15'),function(){try{var _0x4546bc=new Buffer(_0x595a7e[_0xdbc0('0x16')](_0xdbc0('0x17')),_0xdbc0('0x17'));_0x461571[_0xdbc0('0x18')](_0x4546bc);_0x461571[_0xdbc0('0x15')]();_0x461571['on'](_0xdbc0('0x19'),function(){return _0x46ac84(_0x12ed9a);});}catch(_0x574f10){fs[_0xdbc0('0x1a')](_0x12ed9a);return _0x1f546b(_0x574f10);}});});};exports['decryptFile']=function(_0x49eb88,_0x10bade,_0x4b1150,_0x478735){return new BPromise(function(_0x215be7,_0x164a23){_0x478735=combineOptions(_0x478735);var _0x215be9=new Buffer(_0x4b1150);var _0x52f8aa=fs[_0xdbc0('0x12')](_0x49eb88);var _0x51b647=fs[_0xdbc0('0x1b')](_0x10bade);var _0x1f4480=crypto['createDecipher'](_0x478735[_0xdbc0('0x8')],_0x215be9);_0x52f8aa['on'](_0xdbc0('0x14'),function(_0x3d15e9){var _0x2a57b6=new Buffer(_0x1f4480[_0xdbc0('0x1c')](_0x3d15e9),_0xdbc0('0x17'));_0x51b647[_0xdbc0('0x18')](_0x2a57b6);});_0x52f8aa['on'](_0xdbc0('0x15'),function(){try{var _0x5dcd0d=new Buffer(_0x1f4480['final'](_0xdbc0('0x17')),_0xdbc0('0x17'));_0x51b647[_0xdbc0('0x18')](_0x5dcd0d);_0x51b647[_0xdbc0('0x15')]();_0x51b647['on']('close',function(){return _0x215be7(_0x10bade);});}catch(_0x434d54){fs[_0xdbc0('0x1a')](_0x10bade);return _0x164a23(_0x434d54);}});});};exports['encryptString']=function(_0x5026e3,_0x57aa41,_0x424f05){var _0x21004d=_0x424f05||stringOptions['algorithm'];var _0x1aabf6=_0x57aa41||stringOptions[_0xdbc0('0x1d')];var _0x137821=crypto[_0xdbc0('0x13')](_0x21004d,_0x1aabf6);var _0x4eb14f=_0x137821[_0xdbc0('0x1c')](_0x5026e3,_0xdbc0('0x1e'),_0xdbc0('0x1f'));_0x4eb14f+=_0x137821[_0xdbc0('0x16')]('base64');return _0x4eb14f;};exports[_0xdbc0('0x20')]=function(_0x410d17,_0x397fe3,_0x570ff4){var _0x2111a4=_0x570ff4||stringOptions[_0xdbc0('0x8')];var _0x545ab2=_0x397fe3||stringOptions[_0xdbc0('0x1d')];var _0x29aba9=crypto[_0xdbc0('0x21')](_0x2111a4,_0x545ab2);var _0x200700=_0x29aba9['update'](_0x410d17,_0xdbc0('0x1f'),_0xdbc0('0x1e'));_0x200700+=_0x29aba9['final'](_0xdbc0('0x1e'));return _0x200700;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a10bd51..af41acd 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 _0xbe96=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','each','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeCsv','sequelize'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xbe96,0xd6));var _0x6be9=function(_0x2050bf,_0x487981){_0x2050bf=_0x2050bf-0x0;var _0x210dc9=_0xbe96[_0x2050bf];return _0x210dc9;};'use strict';var util=require(_0x6be9('0x0'));var path=require(_0x6be9('0x1'));var _=require(_0x6be9('0x2'));var csv=require(_0x6be9('0x3'));var fs=require('fs');var BPromise=require(_0x6be9('0x4'));var zipdir=require(_0x6be9('0x5'));var rimraf=require(_0x6be9('0x6'));var db=require(_0x6be9('0x7'))['db'];var dbH=require(_0x6be9('0x7'))[_0x6be9('0x8')];var logger=require(_0x6be9('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6be9('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6be9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x13cd31,_0xe95c0b){var _0x3c46cf={'status':_0x13cd31};var _0x1742e2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe95c0b){_0x3c46cf[_0x6be9('0xb')]=_0xe95c0b;}return db['AnalyticExtractedReport']['update'](_0x3c46cf,_0x1742e2);}function main(){var _0x145b5d=0x1388;var _0x4892c9;logger[_0x6be9('0xc')](util[_0x6be9('0xd')](_0x6be9('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6be9('0xf')][_0x6be9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6be9('0x11'),'splitSizeCsv']})[_0x6be9('0x12')](function(_0x4f46fa){if(_0x4f46fa){_0x4892c9=_0x4f46fa;_0x145b5d=_0x4892c9[_0x6be9('0x13')]||0x1388;}})[_0x6be9('0x12')](function(){return dbH[_0x6be9('0x14')][_0x6be9('0x15')](util['format'](_0x6be9('0x16'),QUERY),{'type':dbH[_0x6be9('0x14')][_0x6be9('0x17')][_0x6be9('0x18')]});})[_0x6be9('0x12')](function(_0x52f343){if(!_0x52f343[0x0]['num']){return analyticExtractedReport('Empty');}var _0x5b1865=[];var _0x11fd37=0x0;if(_0x4892c9[_0x6be9('0x11')]){if(_0x52f343&&_0x52f343[_0x6be9('0x19')]){var _0x21dd46=_[_0x6be9('0x1a')](_0x52f343[0x0][_0x6be9('0x1b')]/_0x145b5d);var _0xcd22=Number[_0x6be9('0x1c')](_0x52f343[0x0][_0x6be9('0x1b')]/_0x145b5d)?_0x52f343[0x0][_0x6be9('0x1b')]%_0x145b5d:0x0;_0x21dd46[_0x6be9('0x1d')](function(_0x35ce95){if(_0x35ce95>0x0){_0x11fd37+=_0x145b5d;}_0x5b1865[_0x6be9('0x1e')](dbH['sequelize'][_0x6be9('0x15')](util[_0x6be9('0xd')](_0x6be9('0x1f'),QUERY,_0x145b5d,_0x11fd37),{'type':dbH['sequelize'][_0x6be9('0x17')]['SELECT']}));});if(_0xcd22>0x0){_0x11fd37+=_0x145b5d;_0x5b1865[_0x6be9('0x1e')](dbH['sequelize'][_0x6be9('0x15')](util[_0x6be9('0xd')](_0x6be9('0x1f'),QUERY,_0xcd22,_0x11fd37),{'type':dbH[_0x6be9('0x14')][_0x6be9('0x17')][_0x6be9('0x18')]}));}}}else{_0x5b1865[_0x6be9('0x1e')](dbH[_0x6be9('0x14')][_0x6be9('0x15')](QUERY,{'type':dbH[_0x6be9('0x14')]['QueryTypes'][_0x6be9('0x18')]}));}var _0xa29c31=path[_0x6be9('0x20')](PATH);var _0x151706=path['basename'](PATH,_0x6be9('0x21'));var _0x304360=_0x4892c9[_0x6be9('0x11')]&&_0x5b1865['length']>0x1;var _0x532b20=[];if(!fs[_0x6be9('0x22')](path[_0x6be9('0x23')](_0xa29c31,_0x151706))&&_0x304360){fs['mkdirSync'](path[_0x6be9('0x23')](_0xa29c31,_0x151706));}return BPromise[_0x6be9('0x24')](_0x5b1865,function(_0x2b81d5){_0x532b20[_0x6be9('0x1e')](_0x2b81d5);})['then'](function(){for(var _0x36af64=0x0;_0x36af64<_0x532b20[_0x6be9('0x19')];_0x36af64+=0x1){var _0xf170fc;var _0x1400b3=_0x532b20[_0x36af64];if(_0x304360){_0xf170fc=path[_0x6be9('0x23')](_0xa29c31,_0x151706,util[_0x6be9('0xd')]('%s%d.%s',_0x151706,_0x36af64,'csv'));}else{_0xf170fc=path[_0x6be9('0x23')](_0xa29c31,util[_0x6be9('0xd')](_0x6be9('0x25'),_0x151706,_0x6be9('0x26')));}fs[_0x6be9('0x27')](_0xf170fc,csv(_0x1400b3));}})[_0x6be9('0x12')](function(){if(_0x304360){return new Promise(function(_0x2d3d7c){zipdir(path[_0x6be9('0x23')](_0xa29c31,_0x151706),{'saveTo':path[_0x6be9('0x23')](_0xa29c31,util[_0x6be9('0xd')]('%s.%s',_0x151706,_0x6be9('0x28')))},function(_0x477ddb,_0xf6918e){rimraf(path[_0x6be9('0x23')](_0xa29c31,_0x151706),function(){});_0x2d3d7c(_0x6be9('0x29'));});});}})[_0x6be9('0x12')](function(){logger['info'](util[_0x6be9('0xd')](_0x6be9('0x2a'),EXTRACTED_REPORT_ID,_0x6be9('0x2b')));return analyticExtractedReport('Completed',_0x304360?util[_0x6be9('0xd')](_0x6be9('0x25'),_0x151706,_0x304360?'zip':_0x6be9('0x26')):null);});})[_0x6be9('0x2c')](function(_0x4b2826){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x6be9('0x2d')](_0x4b2826,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x6be9('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5244=['inspect','finally','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch'];(function(_0x53be4f,_0x22ed95){var _0xb71b8a=function(_0x3f7b1b){while(--_0x3f7b1b){_0x53be4f['push'](_0x53be4f['shift']());}};_0xb71b8a(++_0x22ed95);}(_0x5244,0x1d8));var _0x4524=function(_0xdd640,_0x469ad3){_0xdd640=_0xdd640-0x0;var _0x108420=_0x5244[_0xdd640];return _0x108420;};'use strict';var util=require('util');var path=require(_0x4524('0x0'));var _=require(_0x4524('0x1'));var csv=require(_0x4524('0x2'));var fs=require('fs');var BPromise=require(_0x4524('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x4524('0x4'));var db=require(_0x4524('0x5'))['db'];var dbH=require(_0x4524('0x5'))['dbH'];var logger=require(_0x4524('0x6'))(_0x4524('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x4524('0x8')][0x2]);var QUERY=process[_0x4524('0x8')][0x3];var PATH=process[_0x4524('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fe2a6,_0x69ede3){var _0x2fef7d={'status':_0x3fe2a6};var _0x12349b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x69ede3){_0x2fef7d['savename']=_0x69ede3;}return db[_0x4524('0x9')]['update'](_0x2fef7d,_0x12349b);}function main(){var _0x4eab0e=0x1388;var _0x19480f;logger[_0x4524('0xa')](util[_0x4524('0xb')](_0x4524('0xc'),EXTRACTED_REPORT_ID,_0x4524('0xd')));return db[_0x4524('0xe')][_0x4524('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4524('0x10')]})['then'](function(_0x1a5c08){if(_0x1a5c08){_0x19480f=_0x1a5c08;_0x4eab0e=_0x19480f['splitSizeCsv']||0x1388;}})[_0x4524('0x11')](function(){return dbH[_0x4524('0x12')]['query'](util['format'](_0x4524('0x13'),QUERY),{'type':dbH[_0x4524('0x12')]['QueryTypes'][_0x4524('0x14')]});})['then'](function(_0x1a51e1){if(!_0x1a51e1[0x0][_0x4524('0x15')]){return analyticExtractedReport(_0x4524('0x16'));}var _0x3a8bec=[];var _0x28c757=0x0;if(_0x19480f[_0x4524('0x17')]){if(_0x1a51e1&&_0x1a51e1[_0x4524('0x18')]){var _0x274063=_[_0x4524('0x19')](_0x1a51e1[0x0][_0x4524('0x15')]/_0x4eab0e);var _0x20061a=Number[_0x4524('0x1a')](_0x1a51e1[0x0][_0x4524('0x15')]/_0x4eab0e)?_0x1a51e1[0x0][_0x4524('0x15')]%_0x4eab0e:0x0;_0x274063[_0x4524('0x1b')](function(_0x4316cf){if(_0x4316cf>0x0){_0x28c757+=_0x4eab0e;}_0x3a8bec[_0x4524('0x1c')](dbH['sequelize']['query'](util[_0x4524('0xb')](_0x4524('0x1d'),QUERY,_0x4eab0e,_0x28c757),{'type':dbH[_0x4524('0x12')][_0x4524('0x1e')][_0x4524('0x14')]}));});if(_0x20061a>0x0){_0x28c757+=_0x4eab0e;_0x3a8bec[_0x4524('0x1c')](dbH[_0x4524('0x12')]['query'](util[_0x4524('0xb')](_0x4524('0x1d'),QUERY,_0x20061a,_0x28c757),{'type':dbH[_0x4524('0x12')][_0x4524('0x1e')]['SELECT']}));}}}else{_0x3a8bec[_0x4524('0x1c')](dbH[_0x4524('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0x4524('0x1e')][_0x4524('0x14')]}));}var _0x305205=path['dirname'](PATH);var _0x308f32=path[_0x4524('0x1f')](PATH,_0x4524('0x20'));var _0x478e98=_0x19480f[_0x4524('0x17')]&&_0x3a8bec[_0x4524('0x18')]>0x1;var _0x21e707=[];if(!fs[_0x4524('0x21')](path[_0x4524('0x22')](_0x305205,_0x308f32))&&_0x478e98){fs['mkdirSync'](path[_0x4524('0x22')](_0x305205,_0x308f32));}return BPromise[_0x4524('0x23')](_0x3a8bec,function(_0x31d237){_0x21e707['push'](_0x31d237);})[_0x4524('0x11')](function(){for(var _0x34d5e4=0x0;_0x34d5e4<_0x21e707[_0x4524('0x18')];_0x34d5e4+=0x1){var _0x382766;var _0x1e459b=_0x21e707[_0x34d5e4];if(_0x478e98){_0x382766=path[_0x4524('0x22')](_0x305205,_0x308f32,util[_0x4524('0xb')](_0x4524('0x24'),_0x308f32,_0x34d5e4,_0x4524('0x25')));}else{_0x382766=path[_0x4524('0x22')](_0x305205,util[_0x4524('0xb')]('%s.%s',_0x308f32,'csv'));}fs[_0x4524('0x26')](_0x382766,csv(_0x1e459b));}})[_0x4524('0x11')](function(){if(_0x478e98){return new Promise(function(_0x572571){zipdir(path[_0x4524('0x22')](_0x305205,_0x308f32),{'saveTo':path[_0x4524('0x22')](_0x305205,util[_0x4524('0xb')]('%s.%s',_0x308f32,_0x4524('0x27')))},function(_0x44ebe8,_0x29a85e){rimraf(path[_0x4524('0x22')](_0x305205,_0x308f32),function(){});_0x572571(_0x4524('0x28'));});});}})['then'](function(){logger[_0x4524('0xa')](util[_0x4524('0xb')](_0x4524('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x4524('0x2a'),_0x478e98?util[_0x4524('0xb')](_0x4524('0x2b'),_0x308f32,_0x478e98?'zip':'csv'):null);});})[_0x4524('0x2c')](function(_0x2717ea){logger[_0x4524('0xa')](util[_0x4524('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4524('0xd')),util[_0x4524('0x2d')](_0x2717ea,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4524('0x2e')](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 4a13bb8..974b47f 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 _0x5007=['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','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','tableHeader','toString','value','fill','length','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','Arial','black','right','num','Empty','Setting','splitSizePdf','then','range','sequelize','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','split','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','PDF'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5007,0x1c4));var _0x7500=function(_0x4a99ab,_0xc1b539){_0x4a99ab=_0x4a99ab-0x0;var _0x1b3d67=_0x5007[_0x4a99ab];return _0x1b3d67;};'use strict';var _=require(_0x7500('0x0'));var fs=require('fs');var util=require(_0x7500('0x1'));var path=require(_0x7500('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x7500('0x3'));var PdfPrinter=require(_0x7500('0x4'));var zipdir=require(_0x7500('0x5'));var rimraf=require(_0x7500('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x7500('0x7'));var db=require(_0x7500('0x8'))['db'];var dbH=require(_0x7500('0x8'))['dbH'];var logger=require(_0x7500('0x9'))(_0x7500('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x7500('0xb')][0x2]);var QUERY=process[_0x7500('0xb')][0x3];var PATH=process[_0x7500('0xb')][0x4];var NAME=process[_0x7500('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x39cdc5,_0xeaa09b){var _0x5373d1={'status':_0x39cdc5};var _0x2a8be0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xeaa09b){_0x5373d1[_0x7500('0xc')]=_0xeaa09b;}return db[_0x7500('0xd')]['update'](_0x5373d1,_0x2a8be0);}function getHeaders(_0x20d197){return _[_0x7500('0xe')](_0x20d197,function(_0x45f2cf){return{'text':_0x45f2cf,'style':_0x7500('0xf')};});}function getRows(_0x51beee,_0x5854b4){return _[_0x7500('0xe')](_0x5854b4,function(_0x4cf0b8){return _(_0x4cf0b8)['pick'](_0x51beee)[_0x7500('0xe')](function(_0x4e7c9b){return _0x4e7c9b?_[_0x7500('0x10')](_0x4e7c9b):'';})[_0x7500('0x11')]();});}function createTable(_0xe84548,_0x4f1a39){var _0x59ec59={'widths':_[_0x7500('0x12')](Array(_0xe84548[_0x7500('0x13')]),0x91),'heights':function(_0x1c4da8){return _0x1c4da8===0x0?_0x7500('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x29fc0a=getHeaders(_0xe84548);_0x59ec59[_0x7500('0x15')][_0x7500('0x16')](_0x29fc0a);var _0x46166d=getRows(_0xe84548,_0x4f1a39);_0x59ec59[_0x7500('0x15')]=_0x59ec59[_0x7500('0x15')][_0x7500('0x17')](_0x46166d);return _0x59ec59;}function createTables(_0x2eb084){var _0x1d29b5=[];var _0x1df4cd=_[_0x7500('0x18')](Object['keys'](_0x2eb084[0x0]),0x5);_0x1df4cd[_0x7500('0x19')](function(_0x424db8){_0x1d29b5[_0x7500('0x16')](createTable(_0x424db8,_0x2eb084));});return _0x1d29b5;}function getPDFDocDefinition(_0x269e8d){var _0x1895a0=util[_0x7500('0x1a')](_0x7500('0x1b'),NAME,EXTRACTED_REPORT[_0x7500('0x1c')],moment(EXTRACTED_REPORT[_0x7500('0x1d')])[_0x7500('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x7500('0x1e')])['format'](FORMAT));var _0x41c61b=[];for(var _0x4eba12=0x0;_0x4eba12<_0x269e8d['length'];_0x4eba12++){var _0x11a294=[];if(_0x4eba12===0x0){_0x11a294[_0x7500('0x16')]({'text':_0x1895a0,'style':_0x7500('0x1f')});}var _0x50887c={'table':_0x269e8d[_0x4eba12]};if(_0x4eba12>0x0){_0x50887c[_0x7500('0x20')]='before';_0x50887c['margin']=[0x0,0x46,0x0,0x0];}_0x11a294['push'](_0x50887c);_0x41c61b[_0x7500('0x16')](_0x11a294);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x41c61b,'footer':function(_0x467d52,_0x55df48){return{'text':_0x467d52[_0x7500('0x10')]()+'\x20/\x20'+_0x55df48,'style':'footer'};},'defaultStyle':{'font':_0x7500('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7500('0x22')},'footer':{'alignment':_0x7500('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x38ffcb){var _0x2f8904=0x1388;var _0xd60663;if(!_0x38ffcb[0x0][_0x7500('0x24')]){return analyticExtractedReport(_0x7500('0x25'));}return db[_0x7500('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7500('0x27')]})[_0x7500('0x28')](function(_0x4d52b8){if(_0x4d52b8){_0xd60663=_0x4d52b8;_0x2f8904=_0xd60663[_0x7500('0x27')]||0x3e8;}})[_0x7500('0x28')](function(){var _0x3b0ab0=[];var _0x5adb92=0x0;if(_0xd60663['split']){if(_0x38ffcb&&_0x38ffcb[_0x7500('0x13')]){var _0x360e10=_[_0x7500('0x29')](_0x38ffcb[0x0][_0x7500('0x24')]/_0x2f8904);var _0x1c8bcc=Number['isInteger'](_0x38ffcb[0x0]['num']/_0x2f8904)?_0x38ffcb[0x0][_0x7500('0x24')]%_0x2f8904:0x0;_0x360e10[_0x7500('0x19')](function(_0x451534){if(_0x451534>0x0){_0x5adb92+=_0x2f8904;}_0x3b0ab0[_0x7500('0x16')](dbH[_0x7500('0x2a')]['query'](util[_0x7500('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2f8904,_0x5adb92),{'type':dbH[_0x7500('0x2a')]['QueryTypes'][_0x7500('0x2b')]}));});if(_0x1c8bcc>0x0){_0x5adb92+=_0x2f8904;_0x3b0ab0[_0x7500('0x16')](dbH[_0x7500('0x2a')][_0x7500('0x2c')](util[_0x7500('0x1a')](_0x7500('0x2d'),QUERY,_0x1c8bcc,_0x5adb92),{'type':dbH['sequelize']['QueryTypes'][_0x7500('0x2b')]}));}}}else{_0x3b0ab0['push'](dbH[_0x7500('0x2a')][_0x7500('0x2c')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x7500('0x2b')]}));}var _0x531496=path['dirname'](PATH);var _0x23a345=path[_0x7500('0x2e')](PATH,_0x7500('0x2f'));var _0x4430f0=_0xd60663[_0x7500('0x30')]&&_0x3b0ab0[_0x7500('0x13')]>0x1;var _0x6a7872=[];if(!fs[_0x7500('0x31')](path[_0x7500('0x32')](_0x531496,_0x23a345))&&_0x4430f0){fs[_0x7500('0x33')](path['join'](_0x531496,_0x23a345));}return BPromise['each'](_0x3b0ab0,function(_0x228f30){_0x6a7872[_0x7500('0x16')](_0x228f30);})[_0x7500('0x28')](function(){var _0x31df1d=[];for(var _0x1104d5=0x0;_0x1104d5<_0x6a7872[_0x7500('0x13')];_0x1104d5+=0x1){var _0x24832e=_0x6a7872[_0x1104d5];var _0x2f4d5e=createTables(_[_0x7500('0x34')](_0x24832e));var _0x13e610;var _0x3c301f=getPDFDocDefinition(_0x2f4d5e);var _0x56838a=getPDFPrinter();var _0x573600=_0x56838a[_0x7500('0x35')](_0x3c301f);if(_0x4430f0){_0x13e610=path['join'](_0x531496,_0x23a345,util[_0x7500('0x1a')](_0x7500('0x36'),_0x23a345,_0x1104d5,'pdf'));}else{_0x13e610=path['join'](_0x531496,util['format'](_0x7500('0x37'),_0x23a345,_0x7500('0x38')));}_0x31df1d[_0x7500('0x16')](writePDFDocument(_0x573600,_0x13e610));}return Promise[_0x7500('0x39')](_0x31df1d);})[_0x7500('0x28')](function(){if(_0x4430f0){return new Promise(function(_0x79b37a){zipdir(path['join'](_0x531496,_0x23a345),{'saveTo':path[_0x7500('0x32')](_0x531496,util['format']('%s.%s',_0x23a345,_0x7500('0x3a')))},function(){rimraf(path[_0x7500('0x32')](_0x531496,_0x23a345),function(){});_0x79b37a(_0x7500('0x3b'));});});}})[_0x7500('0x28')](function(){if(!_0x4430f0)return;rimraf(path[_0x7500('0x32')](_0x531496,_0x23a345),function(){});})[_0x7500('0x28')](function(){logger[_0x7500('0x3c')](util[_0x7500('0x1a')](_0x7500('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x7500('0x3e'),_0x4430f0?util[_0x7500('0x1a')](_0x7500('0x37'),_0x23a345,_0x4430f0?_0x7500('0x3a'):_0x7500('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7500('0x3c')](util[_0x7500('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7500('0x3f')));return db['AnalyticExtractedReport'][_0x7500('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7500('0x28')](function(_0x26e276){EXTRACTED_REPORT=_0x26e276;return dbH[_0x7500('0x2a')][_0x7500('0x2c')](util[_0x7500('0x1a')](_0x7500('0x41'),QUERY),{'type':dbH[_0x7500('0x2a')]['QueryTypes'][_0x7500('0x2b')]});})[_0x7500('0x28')](extractReport)['catch'](function(_0x388792){logger['info'](util[_0x7500('0x1a')](_0x7500('0x42'),EXTRACTED_REPORT_ID,_0x7500('0x3f')),util[_0x7500('0x43')](_0x388792,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7500('0x44')](function(){process[_0x7500('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x34780f=new PdfPrinter({'Arial':{'normal':__dirname+_0x7500('0x46'),'bold':__dirname+_0x7500('0x47'),'italics':__dirname+_0x7500('0x48'),'bolditalics':__dirname+_0x7500('0x49')}});return _0x34780f;}function getPDFDocDefinitionFromHTML(_0x245e36,_0x4ebc66){var _0x279c87=util[_0x7500('0x1a')](_0x7500('0x4a'),_0x4ebc66[_0x7500('0x4b')],_0x4ebc66['interactionId']);var _0x47e600=moment()[_0x7500('0x1a')](_0x7500('0x4c'))[_0x7500('0x10')]();var _0x523696=htmlToPdfmake(_0x245e36,{'window':window,'tableAutoSize':!![]});return{'content':[_0x523696],'defaultStyle':{'font':_0x7500('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7500('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7500('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7500('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x7500('0x1f')}];},'footer':function(_0xd1185,_0x54695a){return[{'text':util[_0x7500('0x1a')](_0x7500('0x4e'),_0x279c87,_0xd1185,_0x54695a,_0x47e600),'style':_0x7500('0x4f')}];}};}function writePDFDocument(_0x51a816,_0x446621){return new Promise(function(_0x491463,_0x175e12){var _0x290d93=_0x51a816['pipe'](fs[_0x7500('0x50')](_0x446621));_0x290d93['on'](_0x7500('0x51'),function(){_0x491463(_0x7500('0x51'));});_0x290d93['on'](_0x7500('0x52'),function(_0x5d80bb){_0x175e12(_0x5d80bb);});_0x51a816[_0x7500('0x53')]();});}exports[_0x7500('0x54')]=function(_0x20b73a,_0x1be4a3){var _0xe6aa4e=getPDFPrinter();var _0x26fe08=getPDFDocDefinitionFromHTML(_0x20b73a,_0x1be4a3);var _0x219d2a=_0xe6aa4e[_0x7500('0x35')](_0x26fe08);return writePDFDocument(_0x219d2a,_0x1be4a3[_0x7500('0x2')])[_0x7500('0x55')](function(_0x4b2d66){throw _0x4b2d66;});}; \ No newline at end of file +var _0x8a69=['finish','error','end','createPdfKitDocument','lodash','util','path','moment','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','map','toString','value','body','push','concat','chunk','keys','format','length','header','pageBreak','before','landscape','\x20/\x20','footer','black','right','num','Setting','splitSizePdf','then','split','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','basename','existsSync','join','each','%s%d.%s','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','Arial','center','Interaction\x20Transcript','pipe','createWriteStream'];(function(_0x2f757d,_0x1b8fc6){var _0x5be5b9=function(_0x19c334){while(--_0x19c334){_0x2f757d['push'](_0x2f757d['shift']());}};_0x5be5b9(++_0x1b8fc6);}(_0x8a69,0x144));var _0x98a6=function(_0x144cd5,_0x358733){_0x144cd5=_0x144cd5-0x0;var _0x1b793c=_0x8a69[_0x144cd5];return _0x1b793c;};'use strict';var _=require(_0x98a6('0x0'));var fs=require('fs');var util=require(_0x98a6('0x1'));var path=require(_0x98a6('0x2'));var moment=require(_0x98a6('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x98a6('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x98a6('0x5'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x98a6('0x6')];var BPromise=require(_0x98a6('0x7'));var db=require(_0x98a6('0x8'))['db'];var dbH=require(_0x98a6('0x8'))[_0x98a6('0x9')];var logger=require(_0x98a6('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x98a6('0xb')][0x2]);var QUERY=process[_0x98a6('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x98a6('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14581c,_0x26c5b3){var _0x815906={'status':_0x14581c};var _0x785aad={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26c5b3){_0x815906['savename']=_0x26c5b3;}return db[_0x98a6('0xc')][_0x98a6('0xd')](_0x815906,_0x785aad);}function getHeaders(_0x296fae){return _['map'](_0x296fae,function(_0x390501){return{'text':_0x390501,'style':'tableHeader'};});}function getRows(_0x19f1b0,_0x21acb4){return _[_0x98a6('0xe')](_0x21acb4,function(_0x4de801){return _(_0x4de801)['pick'](_0x19f1b0)[_0x98a6('0xe')](function(_0x2ed547){return _0x2ed547?_[_0x98a6('0xf')](_0x2ed547):'';})[_0x98a6('0x10')]();});}function createTable(_0x50c62a,_0xe51473){var _0xd075a0={'widths':_['fill'](Array(_0x50c62a['length']),0x91),'heights':function(_0x39960f){return _0x39960f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d9e50=getHeaders(_0x50c62a);_0xd075a0[_0x98a6('0x11')][_0x98a6('0x12')](_0x2d9e50);var _0x26922b=getRows(_0x50c62a,_0xe51473);_0xd075a0[_0x98a6('0x11')]=_0xd075a0['body'][_0x98a6('0x13')](_0x26922b);return _0xd075a0;}function createTables(_0x4fe80e){var _0x516357=[];var _0x3447a0=_[_0x98a6('0x14')](Object[_0x98a6('0x15')](_0x4fe80e[0x0]),0x5);_0x3447a0['forEach'](function(_0x455772){_0x516357[_0x98a6('0x12')](createTable(_0x455772,_0x4fe80e));});return _0x516357;}function getPDFDocDefinition(_0x28a1d9){var _0x258393=util[_0x98a6('0x16')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x98a6('0x16')](FORMAT));var _0x2f7079=[];for(var _0x1884df=0x0;_0x1884df<_0x28a1d9[_0x98a6('0x17')];_0x1884df++){var _0x50e701=[];if(_0x1884df===0x0){_0x50e701[_0x98a6('0x12')]({'text':_0x258393,'style':_0x98a6('0x18')});}var _0x4b1ce5={'table':_0x28a1d9[_0x1884df]};if(_0x1884df>0x0){_0x4b1ce5[_0x98a6('0x19')]=_0x98a6('0x1a');_0x4b1ce5['margin']=[0x0,0x46,0x0,0x0];}_0x50e701[_0x98a6('0x12')](_0x4b1ce5);_0x2f7079[_0x98a6('0x12')](_0x50e701);}return{'pageSize':'A4','pageOrientation':_0x98a6('0x1b'),'content':_0x2f7079,'footer':function(_0x4f3102,_0x3427b1){return{'text':_0x4f3102[_0x98a6('0xf')]()+_0x98a6('0x1c')+_0x3427b1,'style':_0x98a6('0x1d')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x98a6('0x1e')},'footer':{'alignment':_0x98a6('0x1f'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x572399){var _0x4586eb=0x1388;var _0x304a1b;if(!_0x572399[0x0][_0x98a6('0x20')]){return analyticExtractedReport('Empty');}return db[_0x98a6('0x21')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x98a6('0x22')]})[_0x98a6('0x23')](function(_0x26b54e){if(_0x26b54e){_0x304a1b=_0x26b54e;_0x4586eb=_0x304a1b[_0x98a6('0x22')]||0x3e8;}})[_0x98a6('0x23')](function(){var _0x1714c6=[];var _0x1dcbdc=0x0;if(_0x304a1b[_0x98a6('0x24')]){if(_0x572399&&_0x572399[_0x98a6('0x17')]){var _0x565746=_[_0x98a6('0x25')](_0x572399[0x0][_0x98a6('0x20')]/_0x4586eb);var _0x522574=Number[_0x98a6('0x26')](_0x572399[0x0][_0x98a6('0x20')]/_0x4586eb)?_0x572399[0x0][_0x98a6('0x20')]%_0x4586eb:0x0;_0x565746[_0x98a6('0x27')](function(_0x3913a0){if(_0x3913a0>0x0){_0x1dcbdc+=_0x4586eb;}_0x1714c6[_0x98a6('0x12')](dbH['sequelize']['query'](util[_0x98a6('0x16')](_0x98a6('0x28'),QUERY,_0x4586eb,_0x1dcbdc),{'type':dbH[_0x98a6('0x29')][_0x98a6('0x2a')][_0x98a6('0x2b')]}));});if(_0x522574>0x0){_0x1dcbdc+=_0x4586eb;_0x1714c6[_0x98a6('0x12')](dbH[_0x98a6('0x29')][_0x98a6('0x2c')](util[_0x98a6('0x16')](_0x98a6('0x28'),QUERY,_0x522574,_0x1dcbdc),{'type':dbH[_0x98a6('0x29')]['QueryTypes'][_0x98a6('0x2b')]}));}}}else{_0x1714c6['push'](dbH['sequelize'][_0x98a6('0x2c')](QUERY,{'type':dbH[_0x98a6('0x29')][_0x98a6('0x2a')][_0x98a6('0x2b')]}));}var _0x3590c3=path[_0x98a6('0x2d')](PATH);var _0x480842=path[_0x98a6('0x2e')](PATH,'.pdf');var _0x31b301=_0x304a1b['split']&&_0x1714c6[_0x98a6('0x17')]>0x1;var _0xdbe669=[];if(!fs[_0x98a6('0x2f')](path[_0x98a6('0x30')](_0x3590c3,_0x480842))&&_0x31b301){fs['mkdirSync'](path[_0x98a6('0x30')](_0x3590c3,_0x480842));}return BPromise[_0x98a6('0x31')](_0x1714c6,function(_0x1ea7e6){_0xdbe669[_0x98a6('0x12')](_0x1ea7e6);})[_0x98a6('0x23')](function(){var _0x331a19=[];for(var _0x3bf04b=0x0;_0x3bf04b<_0xdbe669['length'];_0x3bf04b+=0x1){var _0x330131=_0xdbe669[_0x3bf04b];var _0x1719f7=createTables(_['flatten'](_0x330131));var _0x2e8de9;var _0x565880=getPDFDocDefinition(_0x1719f7);var _0x16daf7=getPDFPrinter();var _0x34aa1c=_0x16daf7['createPdfKitDocument'](_0x565880);if(_0x31b301){_0x2e8de9=path[_0x98a6('0x30')](_0x3590c3,_0x480842,util[_0x98a6('0x16')](_0x98a6('0x32'),_0x480842,_0x3bf04b,'pdf'));}else{_0x2e8de9=path[_0x98a6('0x30')](_0x3590c3,util[_0x98a6('0x16')](_0x98a6('0x33'),_0x480842,'pdf'));}_0x331a19[_0x98a6('0x12')](writePDFDocument(_0x34aa1c,_0x2e8de9));}return Promise[_0x98a6('0x34')](_0x331a19);})[_0x98a6('0x23')](function(){if(_0x31b301){return new Promise(function(_0x46d15e){zipdir(path[_0x98a6('0x30')](_0x3590c3,_0x480842),{'saveTo':path[_0x98a6('0x30')](_0x3590c3,util[_0x98a6('0x16')](_0x98a6('0x33'),_0x480842,_0x98a6('0x35')))},function(){rimraf(path[_0x98a6('0x30')](_0x3590c3,_0x480842),function(){});_0x46d15e(_0x98a6('0x36'));});});}})[_0x98a6('0x23')](function(){if(!_0x31b301)return;rimraf(path[_0x98a6('0x30')](_0x3590c3,_0x480842),function(){});})[_0x98a6('0x23')](function(){logger[_0x98a6('0x37')](util[_0x98a6('0x16')](_0x98a6('0x38'),EXTRACTED_REPORT_ID,_0x98a6('0x39')));return analyticExtractedReport(_0x98a6('0x3a'),_0x31b301?util[_0x98a6('0x16')]('%s.%s',_0x480842,_0x31b301?'zip':_0x98a6('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x98a6('0x3c'),EXTRACTED_REPORT_ID,_0x98a6('0x39')));return db['AnalyticExtractedReport'][_0x98a6('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x98a6('0x23')](function(_0x543ad3){EXTRACTED_REPORT=_0x543ad3;return dbH[_0x98a6('0x29')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x98a6('0x29')][_0x98a6('0x2a')][_0x98a6('0x2b')]});})[_0x98a6('0x23')](extractReport)[_0x98a6('0x3e')](function(_0x293101){logger[_0x98a6('0x37')](util['format'](_0x98a6('0x3f'),EXTRACTED_REPORT_ID,'PDF'),util[_0x98a6('0x40')](_0x293101,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x98a6('0x41'));})[_0x98a6('0x42')](function(){process[_0x98a6('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x135b5e=new PdfPrinter({'Arial':{'normal':__dirname+_0x98a6('0x44'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x98a6('0x45'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x135b5e;}function getPDFDocDefinitionFromHTML(_0x5ca26f,_0x433c61){var _0x576726=util[_0x98a6('0x16')](_0x98a6('0x46'),_0x433c61['channel'],_0x433c61['interactionId']);var _0x11cd82=moment()['format']('YYYY-MM-DD')[_0x98a6('0xf')]();var _0x234373=htmlToPdfmake(_0x5ca26f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x234373],'defaultStyle':{'font':_0x98a6('0x47')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x98a6('0x48'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x98a6('0x48'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x98a6('0x48')}},'header':function(){return[{'text':_0x98a6('0x49'),'style':'header'}];},'footer':function(_0x17f974,_0x3a4b6a){return[{'text':util[_0x98a6('0x16')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x576726,_0x17f974,_0x3a4b6a,_0x11cd82),'style':'footer'}];}};}function writePDFDocument(_0x5678eb,_0x26b909){return new Promise(function(_0x1ae7c8,_0x4991c0){var _0x4dffd4=_0x5678eb[_0x98a6('0x4a')](fs[_0x98a6('0x4b')](_0x26b909));_0x4dffd4['on'](_0x98a6('0x4c'),function(){_0x1ae7c8('finish');});_0x4dffd4['on'](_0x98a6('0x4d'),function(_0x2b57ee){_0x4991c0(_0x2b57ee);});_0x5678eb[_0x98a6('0x4e')]();});}exports['createPdfFromHTML']=function(_0x31eecd,_0x183b52){var _0x45506c=getPDFPrinter();var _0x1ef2d8=getPDFDocDefinitionFromHTML(_0x31eecd,_0x183b52);var _0x3313e9=_0x45506c[_0x98a6('0x4f')](_0x1ef2d8);return writePDFDocument(_0x3313e9,_0x183b52['path'])[_0x98a6('0x3e')](function(_0x1e6705){throw _0x1e6705;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0dd17b3..6a16fd9 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 _0x4170=['lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','format','sequelize','QueryTypes','SELECT','num','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','finally','exit','util','path'];(function(_0x434849,_0x27a13a){var _0x265681=function(_0x45b575){while(--_0x45b575){_0x434849['push'](_0x434849['shift']());}};_0x265681(++_0x27a13a);}(_0x4170,0x166));var _0x0417=function(_0x4107f0,_0x2bcb0c){_0x4107f0=_0x4107f0-0x0;var _0x247ea7=_0x4170[_0x4107f0];return _0x247ea7;};'use strict';var util=require(_0x0417('0x0'));var path=require(_0x0417('0x1'));var _=require(_0x0417('0x2'));var fs=require('fs');var json2xls=require(_0x0417('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x0417('0x4'));var rimraf=require(_0x0417('0x5'));var db=require(_0x0417('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x0417('0x7'))(_0x0417('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0417('0x9')][0x2]);var QUERY=process[_0x0417('0x9')][0x3];var PATH=process[_0x0417('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x253547,_0x363cd9){var _0x55eed0={'status':_0x253547};var _0x5e9399={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x363cd9){_0x55eed0['savename']=_0x363cd9;}return db[_0x0417('0xa')][_0x0417('0xb')](_0x55eed0,_0x5e9399);}function main(){var _0x1cb3f4=0x1388;var _0x88fe46;logger['info'](util['format'](_0x0417('0xc'),EXTRACTED_REPORT_ID,_0x0417('0xd')));return db[_0x0417('0xe')][_0x0417('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0417('0x10'),_0x0417('0x11')]})['then'](function(_0x2ebb97){if(_0x2ebb97){_0x88fe46=_0x2ebb97;_0x1cb3f4=_0x88fe46['splitSizeXlsx']||0x1388;}})[_0x0417('0x12')](function(){return dbH['sequelize']['query'](util[_0x0417('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')][_0x0417('0x16')]});})['then'](function(_0x1a2060){if(!_0x1a2060[0x0][_0x0417('0x17')]){return analyticExtractedReport('Empty');}var _0x2a779a=[];var _0x3221bd=0x0;if(_0x88fe46[_0x0417('0x10')]){if(_0x1a2060&&_0x1a2060[_0x0417('0x18')]){var _0xdb60d=_[_0x0417('0x19')](_0x1a2060[0x0]['num']/_0x1cb3f4);var _0x4bb5a3=Number['isInteger'](_0x1a2060[0x0][_0x0417('0x17')]/_0x1cb3f4)?_0x1a2060[0x0][_0x0417('0x17')]%_0x1cb3f4:0x0;_0xdb60d[_0x0417('0x1a')](function(_0x2ee500){if(_0x2ee500>0x0){_0x3221bd+=_0x1cb3f4;}_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1cb3f4,_0x3221bd),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')][_0x0417('0x16')]}));});if(_0x4bb5a3>0x0){_0x3221bd+=_0x1cb3f4;_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')][_0x0417('0x1c')](util[_0x0417('0x13')](_0x0417('0x1d'),QUERY,_0x4bb5a3,_0x3221bd),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')]['SELECT']}));}}}else{_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')][_0x0417('0x1c')](QUERY,{'type':dbH[_0x0417('0x14')][_0x0417('0x15')]['SELECT']}));}var _0x508683=path[_0x0417('0x1e')](PATH);var _0x1a92fd=path['basename'](PATH,'.xlsx');var _0x490883=_0x88fe46[_0x0417('0x10')]&&_0x2a779a['length']>0x1;var _0x32f073=[];if(!fs[_0x0417('0x1f')](path[_0x0417('0x20')](_0x508683,_0x1a92fd))&&_0x490883){fs[_0x0417('0x21')](path[_0x0417('0x20')](_0x508683,_0x1a92fd));}return BPromise['each'](_0x2a779a,function(_0x36cf27){_0x32f073[_0x0417('0x1b')](_0x36cf27);})['then'](function(){for(var _0x47df20=0x0;_0x47df20<_0x32f073[_0x0417('0x18')];_0x47df20+=0x1){var _0x59cc2d;var _0x54dbb4=_0x32f073[_0x47df20];if(_0x490883){_0x59cc2d=path[_0x0417('0x20')](_0x508683,_0x1a92fd,util[_0x0417('0x13')](_0x0417('0x22'),_0x1a92fd,_0x47df20,_0x0417('0x23')));}else{_0x59cc2d=path[_0x0417('0x20')](_0x508683,util[_0x0417('0x13')](_0x0417('0x24'),_0x1a92fd,'xlsx'));}fs['writeFileSync'](_0x59cc2d,json2xls(_0x54dbb4),'binary');}})[_0x0417('0x12')](function(){if(_0x490883){return new Promise(function(_0x153e16){zipdir(path[_0x0417('0x20')](_0x508683,_0x1a92fd),{'saveTo':path['join'](_0x508683,util['format'](_0x0417('0x24'),_0x1a92fd,_0x0417('0x25')))},function(_0x1f4e5f,_0x3d4c10){rimraf(path[_0x0417('0x20')](_0x508683,_0x1a92fd),function(){});_0x153e16('zip\x20finished');});});}})['then'](function(){logger['info'](util['format'](_0x0417('0x26'),EXTRACTED_REPORT_ID,_0x0417('0xd')));return analyticExtractedReport(_0x0417('0x27'),_0x490883?util['format']('%s.%s',_0x1a92fd,_0x490883?_0x0417('0x25'):'xlsx'):null);});})[_0x0417('0x28')](function(_0x2c5b89){logger[_0x0417('0x29')](util[_0x0417('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x0417('0x2a')](_0x2c5b89,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0417('0x2b')](function(){process[_0x0417('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3bb4=['argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','query','push','QueryTypes','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%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','Failed','finally','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0x2fa9da,_0x2fb5ee){var _0x5ae45b=function(_0x352d8b){while(--_0x352d8b){_0x2fa9da['push'](_0x2fa9da['shift']());}};_0x5ae45b(++_0x2fb5ee);}(_0x3bb4,0x87));var _0x43bb=function(_0x5776b1,_0x67df5c){_0x5776b1=_0x5776b1-0x0;var _0x44d1a9=_0x3bb4[_0x5776b1];return _0x44d1a9;};'use strict';var util=require(_0x43bb('0x0'));var path=require(_0x43bb('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x43bb('0x2'));var BPromise=require(_0x43bb('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x43bb('0x4'));var db=require(_0x43bb('0x5'))['db'];var dbH=require(_0x43bb('0x5'))[_0x43bb('0x6')];var logger=require(_0x43bb('0x7'))(_0x43bb('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x43bb('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x380b48,_0x5400a4){var _0x27ae9c={'status':_0x380b48};var _0x4d5eca={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5400a4){_0x27ae9c['savename']=_0x5400a4;}return db[_0x43bb('0xa')]['update'](_0x27ae9c,_0x4d5eca);}function main(){var _0x1a604f=0x1388;var _0x3858ce;logger[_0x43bb('0xb')](util[_0x43bb('0xc')](_0x43bb('0xd'),EXTRACTED_REPORT_ID,_0x43bb('0xe')));return db[_0x43bb('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x43bb('0x10'),_0x43bb('0x11')]})[_0x43bb('0x12')](function(_0x55f70c){if(_0x55f70c){_0x3858ce=_0x55f70c;_0x1a604f=_0x3858ce['splitSizeXlsx']||0x1388;}})[_0x43bb('0x12')](function(){return dbH[_0x43bb('0x13')]['query'](util[_0x43bb('0xc')](_0x43bb('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x43bb('0x15')]});})['then'](function(_0x2644be){if(!_0x2644be[0x0][_0x43bb('0x16')]){return analyticExtractedReport(_0x43bb('0x17'));}var _0x16e3c8=[];var _0x2c7182=0x0;if(_0x3858ce['split']){if(_0x2644be&&_0x2644be[_0x43bb('0x18')]){var _0x15c6cc=_[_0x43bb('0x19')](_0x2644be[0x0][_0x43bb('0x16')]/_0x1a604f);var _0x5012cb=Number[_0x43bb('0x1a')](_0x2644be[0x0][_0x43bb('0x16')]/_0x1a604f)?_0x2644be[0x0]['num']%_0x1a604f:0x0;_0x15c6cc[_0x43bb('0x1b')](function(_0x29e12c){if(_0x29e12c>0x0){_0x2c7182+=_0x1a604f;}_0x16e3c8['push'](dbH[_0x43bb('0x13')][_0x43bb('0x1c')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1a604f,_0x2c7182),{'type':dbH[_0x43bb('0x13')]['QueryTypes']['SELECT']}));});if(_0x5012cb>0x0){_0x2c7182+=_0x1a604f;_0x16e3c8[_0x43bb('0x1d')](dbH[_0x43bb('0x13')][_0x43bb('0x1c')](util[_0x43bb('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5012cb,_0x2c7182),{'type':dbH[_0x43bb('0x13')][_0x43bb('0x1e')][_0x43bb('0x15')]}));}}}else{_0x16e3c8[_0x43bb('0x1d')](dbH['sequelize'][_0x43bb('0x1c')](QUERY,{'type':dbH[_0x43bb('0x13')]['QueryTypes'][_0x43bb('0x15')]}));}var _0x14b5eb=path[_0x43bb('0x1f')](PATH);var _0x51b79c=path['basename'](PATH,_0x43bb('0x20'));var _0x558b93=_0x3858ce[_0x43bb('0x10')]&&_0x16e3c8[_0x43bb('0x18')]>0x1;var _0x7d7de8=[];if(!fs[_0x43bb('0x21')](path[_0x43bb('0x22')](_0x14b5eb,_0x51b79c))&&_0x558b93){fs[_0x43bb('0x23')](path['join'](_0x14b5eb,_0x51b79c));}return BPromise[_0x43bb('0x24')](_0x16e3c8,function(_0x1a0d24){_0x7d7de8[_0x43bb('0x1d')](_0x1a0d24);})[_0x43bb('0x12')](function(){for(var _0xa86634=0x0;_0xa86634<_0x7d7de8[_0x43bb('0x18')];_0xa86634+=0x1){var _0x54729b;var _0x1e1c22=_0x7d7de8[_0xa86634];if(_0x558b93){_0x54729b=path[_0x43bb('0x22')](_0x14b5eb,_0x51b79c,util[_0x43bb('0xc')](_0x43bb('0x25'),_0x51b79c,_0xa86634,_0x43bb('0x26')));}else{_0x54729b=path[_0x43bb('0x22')](_0x14b5eb,util['format']('%s.%s',_0x51b79c,_0x43bb('0x26')));}fs[_0x43bb('0x27')](_0x54729b,json2xls(_0x1e1c22),_0x43bb('0x28'));}})[_0x43bb('0x12')](function(){if(_0x558b93){return new Promise(function(_0x1d1b5e){zipdir(path[_0x43bb('0x22')](_0x14b5eb,_0x51b79c),{'saveTo':path[_0x43bb('0x22')](_0x14b5eb,util['format'](_0x43bb('0x29'),_0x51b79c,_0x43bb('0x2a')))},function(_0x2674e2,_0x4e7785){rimraf(path[_0x43bb('0x22')](_0x14b5eb,_0x51b79c),function(){});_0x1d1b5e('zip\x20finished');});});}})['then'](function(){logger[_0x43bb('0xb')](util['format'](_0x43bb('0x2b'),EXTRACTED_REPORT_ID,_0x43bb('0xe')));return analyticExtractedReport('Completed',_0x558b93?util[_0x43bb('0xc')]('%s.%s',_0x51b79c,_0x558b93?_0x43bb('0x2a'):_0x43bb('0x26')):null);});})[_0x43bb('0x2c')](function(_0x441656){logger['info'](util[_0x43bb('0xc')](_0x43bb('0x2d'),EXTRACTED_REPORT_ID,_0x43bb('0xe')),util['inspect'](_0x441656,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x43bb('0x2e'));})[_0x43bb('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ff5f4eb..60f3f45 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 _0x1fdb=['${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','*,*,*,*','tag','callerID','ExecIf','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','exten','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x1fdb,0x143));var _0xb1fd=function(_0x3bbdc6,_0x38a238){_0x3bbdc6=_0x3bbdc6-0x0;var _0x333327=_0x1fdb[_0x3bbdc6];return _0x333327;};'use strict';var _=require(_0xb1fd('0x0'));var util=require(_0xb1fd('0x1'));function rewrite(_0x323430,_0x4ce157){var _0x1e2620=this;return _0x323430[_0xb1fd('0x2')][_0xb1fd('0x3')][_0xb1fd('0x4')]({'raw':!![]})[_0xb1fd('0x5')](function(_0x383688){_0x1e2620[_0xb1fd('0x6')]=_0x383688;return _0x323430['models'][_0xb1fd('0x7')][_0xb1fd('0x4')]({'where':{'IntervalId':_0x4ce157[_0xb1fd('0x8')]},'raw':!![]});})[_0xb1fd('0x5')](function(_0x5cd5d2){return _0x323430[_0xb1fd('0x2')][_0xb1fd('0x7')][_0xb1fd('0x4')]({'where':{'exten':{'$in':_[_0xb1fd('0x9')](_[_0xb1fd('0xa')](_0x5cd5d2,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xb1fd('0x5')](function(_0xc76662){var _0x478524=_[_0xb1fd('0xb')](_0xc76662,{'priority':'1'});var _0x5cddc8=_[_0xb1fd('0xb')](_0xc76662,{'isApp':0x1});var _0x47afc4=_['groupBy'](_0x5cddc8,'exten');var _0x1595eb=[_0xb1fd('0xc'),_0xb1fd('0xd')];var _0x198565=[];var _0xd29736=[];for(var _0x25894e in _0x47afc4){if(_0x47afc4[_0xb1fd('0xe')](_0x25894e)){_0x1e2620[_0xb1fd('0xf')]=0x2;_0x1e2620[_0xb1fd('0x10')]=[];_0x1e2620[_0xb1fd('0x11')]=_[_0xb1fd('0x12')](_0x478524,{'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')]});_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':util[_0xb1fd('0x17')](_0xb1fd('0x18'),_0x47afc4[_0x25894e][0x0]['type']),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});if(_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')]===_0xb1fd('0x1b')){_0x1e2620[_0xb1fd('0x10')]['push']({'type':_0x47afc4[_0x25894e][0x0]['type'],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x1c')+_0x47afc4[_0x25894e][0x0]['VoiceExtensionId'],'context':_0x47afc4[_0x25894e][0x0]['context'],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});}else if(_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')]===_0xb1fd('0x1d')){if(_0x1e2620[_0xb1fd('0x11')]){_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':'CDR(destination)='+(_0x1e2620['extension'][_0xb1fd('0x1e')]?_0xb1fd('0x1f')+_0x1e2620[_0xb1fd('0x11')][_0xb1fd('0x1e')]+'}':_0xb1fd('0x20')),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620['priority']++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});}_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0]['type'],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x1c')+_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')],'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0]['exten'],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0]['VoiceExtensionId']});var _0x50a4ae=_0x1e2620[_0xb1fd('0xf')]++;_0x1e2620[_0xb1fd('0x10')]['push']({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':'ExecIf','appdata':_0xb1fd('0x21')+(_0x50a4ae+0x2)+_0xb1fd('0x22')+(_0x50a4ae+0x1)+')','context':_0x47afc4[_0x25894e][0x0]['context'],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x50a4ae,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0]['VoiceExtensionId']});if(_0x1e2620[_0xb1fd('0x11')]){_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0]['type'],'app':_0xb1fd('0x16'),'appdata':_0x1e2620[_0xb1fd('0x11')]['cutdigits']?_0xb1fd('0x23')+_0x1e2620[_0xb1fd('0x11')]['cutdigits']+'}':_0xb1fd('0x24'),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});}_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x25')+_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')],'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620['priority']++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0]['VoiceExtensionId']});if(_0x1e2620['extension']&&_0x1e2620[_0xb1fd('0x11')][_0xb1fd('0xe')](_0xb1fd('0x26'))&&_0x1e2620[_0xb1fd('0x11')][_0xb1fd('0x26')]!=='none'){_0x1e2620['extensions'][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':'Set','appdata':_0xb1fd('0x27'),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});_0x1e2620['extensions'][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':'Set','appdata':_0xb1fd('0x28')+_0x1e2620[_0xb1fd('0x11')][_0xb1fd('0x26')]||_0xb1fd('0x29'),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});}}_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x2a'),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});_0x1e2620['extensions']['push']({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x2b'),'context':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x19')],'exten':_0x47afc4[_0x25894e][0x0]['exten'],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});_0x1e2620[_0xb1fd('0x10')][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x47afc4[_0x25894e][0x0]['context'],'exten':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x13')],'priority':_0x1e2620[_0xb1fd('0xf')]++,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0]['VoiceExtensionId']});for(var _0x106038=0x0,_0x234763=0x0;_0x106038<_0x47afc4[_0x25894e]['length'];_0x106038+=0x1,_0x234763=0x0){var _0x269f48=_0x47afc4[_0x25894e][_0x106038];if(_0x269f48[_0xb1fd('0x15')]){_0x269f48[_0xb1fd('0x15')]=_0x269f48[_0xb1fd('0x15')][_0xb1fd('0x2c')]();}var _0x4bffe8=[];var _0x19c5cd=[];delete _0x269f48['id'];delete _0x269f48[_0xb1fd('0x2d')];delete _0x269f48['updatedAt'];var _0x386e37=_0x269f48[_0xb1fd('0x2e')]!==_0xb1fd('0x2f')?[_0x269f48[_0xb1fd('0x2e')]]:_0x269f48[_0xb1fd('0x8')]?_['map'](_['filter'](_0x1e2620[_0xb1fd('0x6')],{'IntervalId':_0x269f48[_0xb1fd('0x8')]}),_0xb1fd('0x2e')):[];if(_0x269f48[_0xb1fd('0xe')](_0xb1fd('0x30'))){if(_0x269f48['tag']&&_0x269f48[_0xb1fd('0x30')]!=='--'){_0x4bffe8[_0xb1fd('0x14')]({'type':_0x269f48[_0xb1fd('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x269f48[_0xb1fd('0x30')],'context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48[_0xb1fd('0x13')],'priority':_0x386e37['length']+_0x1e2620[_0xb1fd('0xf')]+_0x234763++,'VoiceExtensionId':_0x269f48['VoiceExtensionId']});}}if(_0x269f48[_0xb1fd('0x15')]===_0xb1fd('0x1d')&&_0x269f48['hasOwnProperty'](_0xb1fd('0x31'))){if(_0x269f48[_0xb1fd('0x31')]){_0x4bffe8['push']({'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x269f48['callerID']+')','context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48['exten'],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620[_0xb1fd('0xf')]+_0x234763++,'VoiceExtensionId':_0x269f48[_0xb1fd('0x1a')]});}else{_0x4bffe8['push']({'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x32'),'appdata':_0xb1fd('0x34'),'context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48['exten'],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620[_0xb1fd('0xf')]+_0x234763++,'VoiceExtensionId':_0x269f48['VoiceExtensionId']});}}if(_0x269f48[_0xb1fd('0xe')](_0xb1fd('0x35'))){if(_0x1595eb[_0xb1fd('0x36')](_0x269f48['app'][_0xb1fd('0x2c')]())>=0x0&&_0x269f48[_0xb1fd('0x37')]!==_0xb1fd('0x38')){if(_0x269f48[_0xb1fd('0x35')]){_0x4bffe8[_0xb1fd('0x14')]({'type':_0x269f48['type'],'app':'ExecIf','appdata':_0xb1fd('0x39'),'context':_0x269f48['context'],'exten':_0x269f48[_0xb1fd('0x13')],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620[_0xb1fd('0xf')]+_0x234763++,'VoiceExtensionId':_0x269f48[_0xb1fd('0x1a')]});_0x4bffe8[_0xb1fd('0x14')]({'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48[_0xb1fd('0x13')],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620['priority']+_0x234763++,'VoiceExtensionId':_0x269f48['VoiceExtensionId']});}else{_0x4bffe8[_0xb1fd('0x14')]({'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x32'),'appdata':_0xb1fd('0x3a'),'context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48[_0xb1fd('0x13')],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620['priority']+_0x234763++,'VoiceExtensionId':_0x269f48[_0xb1fd('0x1a')]});_0x4bffe8[_0xb1fd('0x14')]({'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x16'),'appdata':_0xb1fd('0x3b'),'context':_0x269f48[_0xb1fd('0x19')],'exten':_0x269f48['exten'],'priority':_0x386e37[_0xb1fd('0x33')]+_0x1e2620[_0xb1fd('0xf')]+_0x234763++,'VoiceExtensionId':_0x269f48[_0xb1fd('0x1a')]});}}}for(var _0x4fdfe2=0x0;_0x4fdfe2<_0x386e37[_0xb1fd('0x33')];_0x4fdfe2+=0x1){var _0x414f97=_0x1e2620['priority']+_0x386e37[_0xb1fd('0x33')];var _0x545272=_0x4fdfe2===_0x386e37['length']-0x1?_0x1e2620[_0xb1fd('0xf')]+_0x4bffe8[_0xb1fd('0x33')]+_0x19c5cd[_0xb1fd('0x33')]+0x2:_0x1e2620[_0xb1fd('0xf')]+_0x4fdfe2+0x1;_0x4bffe8[_0xb1fd('0x3c')](_0x4fdfe2,0x0,{'type':_0x269f48[_0xb1fd('0x15')],'app':_0xb1fd('0x3d'),'appdata':_0x386e37[_0x4fdfe2]+'?'+_0x269f48[_0xb1fd('0x19')]+_0xb1fd('0x3e')+_0x414f97+':'+_0x269f48['context']+_0xb1fd('0x3e')+_0x545272,'exten':_0x269f48[_0xb1fd('0x13')],'context':_0x269f48[_0xb1fd('0x19')],'priority':_0x1e2620['priority']+_0x4fdfe2,'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});}_0x269f48[_0xb1fd('0xf')]=_0x4bffe8[_0xb1fd('0x33')]?_['last'](_0x4bffe8)[_0xb1fd('0xf')]+0x1:_0x1e2620['priority'];_0x1e2620[_0xb1fd('0xf')]=(_0x19c5cd[_0xb1fd('0x33')]?_[_0xb1fd('0x3f')](_0x19c5cd)[_0xb1fd('0xf')]:_0x269f48[_0xb1fd('0xf')])+0x1;_0x1e2620[_0xb1fd('0x10')]=_['concat'](_0x1e2620[_0xb1fd('0x10')],_0x4bffe8,[_0x269f48],_0x19c5cd);}_0x1e2620['extensions'][_0xb1fd('0x14')]({'type':_0x47afc4[_0x25894e][0x0]['type'],'app':_0xb1fd('0x40'),'exten':_0x47afc4[_0x25894e][0x0]['exten'],'context':_0x47afc4[_0x25894e][0x0]['context'],'priority':_0x1e2620[_0xb1fd('0xf')],'VoiceExtensionId':_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]});_0x198565[_0xb1fd('0x14')](_0x47afc4[_0x25894e][0x0][_0xb1fd('0x1a')]);_0xd29736=_[_0xb1fd('0x41')](_0xd29736,_0x1e2620[_0xb1fd('0x10')]);}}return _0x323430[_0xb1fd('0x42')](function(_0x1dd50f){return _0x323430[_0xb1fd('0x2')][_0xb1fd('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x198565}},'transaction':_0x1dd50f})[_0xb1fd('0x5')](function(_0x4fd022){return _0x323430[_0xb1fd('0x2')][_0xb1fd('0x7')][_0xb1fd('0x43')](_[_0xb1fd('0x44')](_0xd29736,_0xb1fd('0xf')),{'transaction':_0x1dd50f});});});})[_0xb1fd('0x45')](function(_0x5349d0){console['error'](_0x5349d0);});}exports[_0xb1fd('0x46')]=rewrite; \ No newline at end of file +var _0x1324=['bulkCreate','sortBy','catch','error','lodash','Interval','then','intervals','models','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extension','find','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','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)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy'];(function(_0x322396,_0x22f066){var _0x8e2d92=function(_0x112724){while(--_0x112724){_0x322396['push'](_0x322396['shift']());}};_0x8e2d92(++_0x22f066);}(_0x1324,0x1ba));var _0x4132=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0x1324[_0x2bfa06];return _0x58811b;};'use strict';var _=require(_0x4132('0x0'));var util=require('util');function rewrite(_0x51eae7,_0x236ee3){var _0x227fe0=this;return _0x51eae7['models'][_0x4132('0x1')]['findAll']({'raw':!![]})[_0x4132('0x2')](function(_0x29d3a0){_0x227fe0[_0x4132('0x3')]=_0x29d3a0;return _0x51eae7[_0x4132('0x4')][_0x4132('0x5')][_0x4132('0x6')]({'where':{'IntervalId':_0x236ee3['IntervalId']},'raw':!![]});})[_0x4132('0x2')](function(_0x390800){return _0x51eae7['models'][_0x4132('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x4132('0x7')](_[_0x4132('0x8')](_0x390800,_0x4132('0x9')))}},'order':[{'raw':_0x4132('0xa')}],'raw':!![]});})[_0x4132('0x2')](function(_0x1bcfe6){var _0x2dd87f=_[_0x4132('0xb')](_0x1bcfe6,{'priority':'1'});var _0xaec1c3=_['filter'](_0x1bcfe6,{'isApp':0x1});var _0xdbf06a=_[_0x4132('0xc')](_0xaec1c3,_0x4132('0x9'));var _0x37d976=[_0x4132('0xd'),'playback'];var _0x4da3f5=[];var _0xd4223f=[];for(var _0x11d47c in _0xdbf06a){if(_0xdbf06a[_0x4132('0xe')](_0x11d47c)){_0x227fe0[_0x4132('0xf')]=0x2;_0x227fe0['extensions']=[];_0x227fe0[_0x4132('0x10')]=_[_0x4132('0x11')](_0x2dd87f,{'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')]});_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0]['type'],'app':_0x4132('0x14'),'appdata':util[_0x4132('0x15')](_0x4132('0x16'),_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')]),'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0]['exten'],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});if(_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')]===_0x4132('0x1a')){_0x227fe0['extensions']['push']({'type':_0xdbf06a[_0x11d47c][0x0]['type'],'app':_0x4132('0x14'),'appdata':_0x4132('0x1b')+_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')],'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0]['exten'],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0]['VoiceExtensionId']});}else if(_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')]===_0x4132('0x1c')){if(_0x227fe0[_0x4132('0x10')]){_0x227fe0[_0x4132('0x12')]['push']({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x1d')+(_0x227fe0['extension'][_0x4132('0x1e')]?_0x4132('0x1f')+_0x227fe0['extension'][_0x4132('0x1e')]+'}':_0x4132('0x20')),'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0]['VoiceExtensionId']});}_0x227fe0['extensions'][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x1b')+_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')],'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0]['VoiceExtensionId']});var _0x2bba02=_0x227fe0[_0x4132('0xf')]++;_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x21'),'appdata':_0x4132('0x22')+(_0x2bba02+0x2)+_0x4132('0x23')+(_0x2bba02+0x1)+')','context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x2bba02,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});if(_0x227fe0['extension']){_0x227fe0['extensions']['push']({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x227fe0[_0x4132('0x10')]['cutdigits']?_0x4132('0x24')+_0x227fe0[_0x4132('0x10')][_0x4132('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});}_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x25')+_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')],'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});if(_0x227fe0['extension']&&_0x227fe0[_0x4132('0x10')]['hasOwnProperty']('recordingFormat')&&_0x227fe0['extension'][_0x4132('0x26')]!=='none'){_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':'Set','appdata':_0x4132('0x27'),'context':_0xdbf06a[_0x11d47c][0x0]['context'],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0]['type'],'app':_0x4132('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x227fe0[_0x4132('0x10')][_0x4132('0x26')]||_0x4132('0x28'),'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});}}_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x29'),'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0]['VoiceExtensionId']});_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x2a'),'context':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x18')],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0[_0x4132('0xf')]++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0]['type'],'app':_0x4132('0x14'),'appdata':_0x4132('0x2b'),'context':_0xdbf06a[_0x11d47c][0x0]['context'],'exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'priority':_0x227fe0['priority']++,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});for(var _0x28764e=0x0,_0x18a0dd=0x0;_0x28764e<_0xdbf06a[_0x11d47c][_0x4132('0x2c')];_0x28764e+=0x1,_0x18a0dd=0x0){var _0xbc51a2=_0xdbf06a[_0x11d47c][_0x28764e];if(_0xbc51a2[_0x4132('0x17')]){_0xbc51a2[_0x4132('0x17')]=_0xbc51a2[_0x4132('0x17')][_0x4132('0x2d')]();}var _0x136ba2=[];var _0x189788=[];delete _0xbc51a2['id'];delete _0xbc51a2[_0x4132('0x2e')];delete _0xbc51a2[_0x4132('0x2f')];var _0x3dfd51=_0xbc51a2['interval']!==_0x4132('0x30')?[_0xbc51a2[_0x4132('0x31')]]:_0xbc51a2[_0x4132('0x32')]?_['map'](_[_0x4132('0xb')](_0x227fe0[_0x4132('0x3')],{'IntervalId':_0xbc51a2[_0x4132('0x32')]}),_0x4132('0x31')):[];if(_0xbc51a2[_0x4132('0xe')](_0x4132('0x33'))){if(_0xbc51a2[_0x4132('0x33')]&&_0xbc51a2[_0x4132('0x33')]!=='--'){_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x34')+_0xbc51a2[_0x4132('0x33')],'context':_0xbc51a2['context'],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51['length']+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2[_0x4132('0x19')]});}}if(_0xbc51a2['type']===_0x4132('0x1c')&&_0xbc51a2[_0x4132('0xe')](_0x4132('0x35'))){if(_0xbc51a2[_0x4132('0x35')]){_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x21'),'appdata':_0x4132('0x36')+_0xbc51a2[_0x4132('0x35')]+')','context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2[_0x4132('0x19')]});}else{_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x21'),'appdata':_0x4132('0x37'),'context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2['VoiceExtensionId']});}}if(_0xbc51a2[_0x4132('0xe')](_0x4132('0x38'))){if(_0x37d976['indexOf'](_0xbc51a2[_0x4132('0x39')]['toLowerCase']())>=0x0&&_0xbc51a2[_0x4132('0x3a')]!==_0x4132('0x3b')){if(_0xbc51a2['answer']){_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2['type'],'app':_0x4132('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2['VoiceExtensionId']});_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x3c'),'context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0['priority']+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2['VoiceExtensionId']});}else{_0x136ba2[_0x4132('0x13')]({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x21'),'appdata':_0x4132('0x3d'),'context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2[_0x4132('0x19')]});_0x136ba2['push']({'type':_0xbc51a2[_0x4132('0x17')],'app':_0x4132('0x14'),'appdata':_0x4132('0x3e'),'context':_0xbc51a2[_0x4132('0x18')],'exten':_0xbc51a2[_0x4132('0x9')],'priority':_0x3dfd51[_0x4132('0x2c')]+_0x227fe0[_0x4132('0xf')]+_0x18a0dd++,'VoiceExtensionId':_0xbc51a2[_0x4132('0x19')]});}}}for(var _0x12ce08=0x0;_0x12ce08<_0x3dfd51[_0x4132('0x2c')];_0x12ce08+=0x1){var _0x27b505=_0x227fe0[_0x4132('0xf')]+_0x3dfd51[_0x4132('0x2c')];var _0x1e89da=_0x12ce08===_0x3dfd51[_0x4132('0x2c')]-0x1?_0x227fe0[_0x4132('0xf')]+_0x136ba2[_0x4132('0x2c')]+_0x189788['length']+0x2:_0x227fe0[_0x4132('0xf')]+_0x12ce08+0x1;_0x136ba2[_0x4132('0x3f')](_0x12ce08,0x0,{'type':_0xbc51a2[_0x4132('0x17')],'app':'GotoIfTime','appdata':_0x3dfd51[_0x12ce08]+'?'+_0xbc51a2[_0x4132('0x18')]+_0x4132('0x40')+_0x27b505+':'+_0xbc51a2[_0x4132('0x18')]+_0x4132('0x40')+_0x1e89da,'exten':_0xbc51a2['exten'],'context':_0xbc51a2['context'],'priority':_0x227fe0[_0x4132('0xf')]+_0x12ce08,'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});}_0xbc51a2['priority']=_0x136ba2[_0x4132('0x2c')]?_[_0x4132('0x41')](_0x136ba2)['priority']+0x1:_0x227fe0['priority'];_0x227fe0[_0x4132('0xf')]=(_0x189788[_0x4132('0x2c')]?_[_0x4132('0x41')](_0x189788)[_0x4132('0xf')]:_0xbc51a2[_0x4132('0xf')])+0x1;_0x227fe0['extensions']=_[_0x4132('0x42')](_0x227fe0[_0x4132('0x12')],_0x136ba2,[_0xbc51a2],_0x189788);}_0x227fe0[_0x4132('0x12')][_0x4132('0x13')]({'type':_0xdbf06a[_0x11d47c][0x0]['type'],'app':'Hangup','exten':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x9')],'context':_0xdbf06a[_0x11d47c][0x0]['context'],'priority':_0x227fe0['priority'],'VoiceExtensionId':_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]});_0x4da3f5[_0x4132('0x13')](_0xdbf06a[_0x11d47c][0x0][_0x4132('0x19')]);_0xd4223f=_[_0x4132('0x42')](_0xd4223f,_0x227fe0[_0x4132('0x12')]);}}return _0x51eae7[_0x4132('0x43')](function(_0x2c97b9){return _0x51eae7[_0x4132('0x4')]['VoiceExtension'][_0x4132('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x4da3f5}},'transaction':_0x2c97b9})['then'](function(_0x5c96c0){return _0x51eae7[_0x4132('0x4')][_0x4132('0x5')][_0x4132('0x45')](_[_0x4132('0x46')](_0xd4223f,_0x4132('0xf')),{'transaction':_0x2c97b9});});});})[_0x4132('0x47')](function(_0x47de8b){console[_0x4132('0x48')](_0x47de8b);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index aa38a82..3c8dfec 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 _0x589c=['localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','catch','onlyIfOpen','VoiceQueueId','all','get','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','defaults','redis'];(function(_0xa6d7bb,_0x76d0a5){var _0xaf51ec=function(_0x29bd3c){while(--_0x29bd3c){_0xa6d7bb['push'](_0xa6d7bb['shift']());}};_0xaf51ec(++_0x76d0a5);}(_0x589c,0x149));var _0xc589=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x589c[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xc589('0x0'));var util=require('util');var _=require(_0xc589('0x1'));var fs=require('fs');var squel=require(_0xc589('0x2'));var Papa=require(_0xc589('0x3'));var Redis=require(_0xc589('0x4'));var db=require(_0xc589('0x5'))['db'];var config=require(_0xc589('0x6'));var logger=require('../../../config/logger')(_0xc589('0x7'));config['redis']=_[_0xc589('0x8')](config[_0xc589('0x9')],{'host':_0xc589('0xa'),'port':0x18eb});var socket=require(_0xc589('0xb'))(new Redis(config[_0xc589('0x9')]));require(_0xc589('0xc'))[_0xc589('0xd')](socket);try{if(!process[_0xc589('0xe')][0x2]||process['argv'][0x2]==='undefined'||process[_0xc589('0xe')][0x2]===_0xc589('0xf')){throw new Error(_0xc589('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xc589('0xe')][0x3]==='undefined'||process[_0xc589('0xe')][0x3]===_0xc589('0xf')||!process[_0xc589('0xe')][0x4]||process[_0xc589('0xe')][0x4]===_0xc589('0x11')||process[_0xc589('0xe')][0x4]===_0xc589('0xf')){throw new Error(_0xc589('0x12'));}var FIELDS=_[_0xc589('0x13')](process[_0xc589('0xe')][0x3][_0xc589('0x14')](','),process[_0xc589('0xe')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xc589('0x11')||process['argv'][0x5]===_0xc589('0xf')){throw new Error(_0xc589('0x15'));}var LISTID=process[_0xc589('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xc589('0xe')][0x6]!==_0xc589('0x11')&&process['argv'][0x6]!=='null'?process[_0xc589('0xe')][0x6]:null;var DUPLICATES=process[_0xc589('0xe')][0x7]&&process[_0xc589('0xe')][0x7]!==_0xc589('0x11')&&process[_0xc589('0xe')][0x7]!==_0xc589('0xf')?process[_0xc589('0xe')][0x7]:null;if(!process[_0xc589('0xe')][0x8]||process[_0xc589('0xe')][0x8]==='undefined'||process[_0xc589('0xe')][0x8]===_0xc589('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc589('0xe')][0x8];}catch(_0x198ced){logger['error'](_0x198ced);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(_0x418160,_0x3a34c7,_0x2fce07,_0x5b7ab7){var _0x175970={'message':_0x3a34c7};_0x175970[_0x418160]=!![];if(_0x2fce07){_0x175970['contact']=_0x2fce07;}if(_0x5b7ab7){_0x175970['index']=_0x5b7ab7;}return _0x175970;}function isEmail(_0x4c81e7){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'](_0x4c81e7);}function checkRow(_0x1dc236,_0x55a435,_0x524234){return new BPromise(function(_0x39b8cd,_0x127e13){if(_[_0xc589('0x16')](_0x1dc236)){return _0x127e13(handleCheckRowError(_0xc589('0x17'),_0xc589('0x18'),null,_0x524234));}if(_0x1dc236[_0xc589('0x19')]&&_0x1dc236[_0xc589('0x19')][_0xc589('0x1a')]){var _0x34e838=_[_0xc589('0x1b')](_0x1dc236[_0xc589('0x19')],'message')[_0xc589('0x1c')](';');return _0x127e13(handleCheckRowError(_0xc589('0x17'),_0x34e838,null,_0x524234));}var _0x22a20d={};for(var _0x6b4e49 in FIELDS){if(FIELDS[_0xc589('0x1d')](_0x6b4e49)&&FIELDS[_0x6b4e49]){_0x22a20d[_0x6b4e49]=_0x1dc236[_0xc589('0x1e')][0x0][FIELDS[_0x6b4e49]]||_0x1dc236[_0xc589('0x1e')][0x0]['\ufeff'+FIELDS[_0x6b4e49]];}}if(!_0x22a20d[_0xc589('0x1f')]){return _0x127e13(handleCheckRowError(_0xc589('0x17'),'firstName\x20not\x20specified!',null,_0x524234));}if(!_0x22a20d[_0xc589('0x20')]){return _0x127e13(handleCheckRowError('error',_0xc589('0x21'),null,_0x524234));}if(_0x22a20d[_0xc589('0x22')]){var _0x1c61d1=moment(_0x22a20d['birthDate'],'YYYY-MM-DD');if(!_0x1c61d1[_0xc589('0x23')]()){return _0x127e13(handleCheckRowError(_0xc589('0x17'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x524234));}}if(_0x22a20d[_0xc589('0x24')]){if(!isEmail(_0x22a20d[_0xc589('0x24')])){return _0x127e13(handleCheckRowError(_0xc589('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x524234));}}_0x22a20d[_0xc589('0x25')]=LISTID;_0x22a20d[_0xc589('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x55a435){var _0x2495f4={};for(var _0x3189e2=0x0,_0xea755e=DUPLICATES[_0xc589('0x1a')];_0x3189e2<_0xea755e;_0x3189e2+=0x1){_0x2495f4[DUPLICATES[_0x3189e2]]=_0x22a20d[DUPLICATES[_0x3189e2]];}var _0x5b2f69=_[_0xc589('0x27')](_0x55a435,_0x2495f4);if(_0x5b2f69){return _0x127e13(handleCheckRowError(_0xc589('0x28'),'Duplicate\x20Contact',_0x5b2f69,_0x524234));}}return db[_0xc589('0x29')][_0xc589('0x2a')](_0x22a20d,{'raw':!![],'hooks':![],'fields':_[_0xc589('0x2b')](_0x22a20d)})[_0xc589('0x2c')](function(_0x4fcf76){if(DUPLICATES&&DUPLICATES[_0xc589('0x1a')]&&_0x55a435){_0x55a435[_0xc589('0x2d')](_[_0xc589('0x2e')](_0x22a20d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4fcf76['id'];return _0x39b8cd();})['catch'](function(_0x3a0b79){return _0x127e13(handleCheckRowError(_0xc589('0x17'),_0xc589('0x2f')+(_0x3a0b79[_0xc589('0x30')]||JSON['stringify'](_0x3a0b79)),null,_0x524234));});});}function checkHopper(){function _0x217fe0(){return function(_0x2ae4bb){logger[_0xc589('0x17')](_0xc589('0x31'),_0xc589('0x32'),util[_0xc589('0x33')](_0x2ae4bb,{'showHidden':![],'depth':null}));};}var _0x8ed8b2=function(_0x2e73a4,_0x1c86ea){var _0x18067a=squel[_0xc589('0x34')]()['into'](_0xc589('0x35'))[_0xc589('0x36')]([_0xc589('0x20'),_0xc589('0x37'),_0xc589('0x38'),_0xc589('0x25'),_0x1c86ea,_0xc589('0x39'),'updatedAt'],squel['select']()['field'](_0xc589('0x20'),_0xc589('0x20'))[_0xc589('0x3a')](_0xc589('0x3b'),'scheduledAt')['field']('id',_0xc589('0x38'))[_0xc589('0x3a')](LISTID['toString'](),_0xc589('0x25'))[_0xc589('0x3a')](_0x2e73a4['id'][_0xc589('0x3c')](),_0x1c86ea)[_0xc589('0x3a')]('NOW()',_0xc589('0x39'))['field'](_0xc589('0x3b'),_0xc589('0x3d'))[_0xc589('0x3e')](_0xc589('0x3f'))[_0xc589('0x40')](_0xc589('0x41'))['where'](_0xc589('0x42'),LISTID['toString']())[_0xc589('0x40')](_0xc589('0x43'))[_0xc589('0x40')](_0xc589('0x44'),squel[_0xc589('0x45')]()[_0xc589('0x3a')](_0xc589('0x20'))[_0xc589('0x3e')](_0xc589('0x35'))[_0xc589('0x40')](_0x1c86ea+_0xc589('0x46'),_0x2e73a4['id'][_0xc589('0x3c')]())))['toString']();return _0x18067a;};var _0x2d07e6=function(_0x4f780a,_0x3f276a){var _0x393a4f=squel[_0xc589('0x34')]()[_0xc589('0x47')](_0xc589('0x35'))['fromQuery']([_0xc589('0x20'),_0xc589('0x37'),'ContactId','ListId',_0x3f276a,'createdAt',_0xc589('0x3d')],squel[_0xc589('0x45')]()[_0xc589('0x3a')]('phone',_0xc589('0x20'))[_0xc589('0x3a')](_0xc589('0x3b'),_0xc589('0x37'))[_0xc589('0x3a')]('id',_0xc589('0x38'))[_0xc589('0x3a')](LISTID['toString'](),_0xc589('0x25'))['field'](_0x4f780a['id'][_0xc589('0x3c')](),_0x3f276a)[_0xc589('0x3a')](_0xc589('0x3b'),_0xc589('0x39'))[_0xc589('0x3a')](_0xc589('0x3b'),_0xc589('0x3d'))[_0xc589('0x3e')](_0xc589('0x3f'))[_0xc589('0x40')](_0xc589('0x41'))[_0xc589('0x40')](_0xc589('0x42'),LISTID[_0xc589('0x3c')]())[_0xc589('0x40')](_0xc589('0x48'),squel[_0xc589('0x49')](hopperContacts))[_0xc589('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xc589('0x40')](_0xc589('0x44'),squel[_0xc589('0x45')]()[_0xc589('0x3a')](_0xc589('0x4a'))[_0xc589('0x3e')](_0xc589('0x4b'))[_0xc589('0x40')](_0x3f276a+_0xc589('0x46'),_0x4f780a['id'][_0xc589('0x3c')]()))[_0xc589('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc589('0x45')]()['field'](_0xc589('0x20'))[_0xc589('0x3e')](_0xc589('0x35'))[_0xc589('0x40')](_0x3f276a+_0xc589('0x46'),_0x4f780a['id'][_0xc589('0x3c')]())))[_0xc589('0x3c')]();return _0x393a4f;};function _0x3f9e96(_0x1f0532,_0x418661){var _0x50feb8=squel[_0xc589('0x34')]()['into'](_0xc589('0x35'))[_0xc589('0x36')]([_0xc589('0x20'),_0xc589('0x37'),_0xc589('0x38'),_0xc589('0x25'),_0x418661,'createdAt','updatedAt'],squel[_0xc589('0x45')]()[_0xc589('0x3a')](_0xc589('0x20'),_0xc589('0x20'))[_0xc589('0x3a')](_0xc589('0x3b'),'scheduledAt')[_0xc589('0x3a')]('id',_0xc589('0x38'))[_0xc589('0x3a')](LISTID[_0xc589('0x3c')](),_0xc589('0x25'))[_0xc589('0x3a')](_0x1f0532['id'][_0xc589('0x3c')](),_0x418661)[_0xc589('0x3a')]('NOW()',_0xc589('0x39'))[_0xc589('0x3a')]('NOW()',_0xc589('0x3d'))[_0xc589('0x3e')]('cm_contacts')[_0xc589('0x40')](_0xc589('0x41'))[_0xc589('0x40')](_0xc589('0x42'),LISTID[_0xc589('0x3c')]())[_0xc589('0x40')](_0xc589('0x48'),squel[_0xc589('0x49')](hopperContacts))[_0xc589('0x40')](_0xc589('0x43')))[_0xc589('0x3c')]();return _0x50feb8;}function _0x485a2b(_0x4914af,_0x278719){var _0x4152b3=squel[_0xc589('0x34')]()[_0xc589('0x47')](_0xc589('0x4c'))['fromQuery']([_0xc589('0x20'),'ContactId',_0xc589('0x25'),_0x278719,_0xc589('0x39'),'updatedAt'],squel[_0xc589('0x45')]()[_0xc589('0x3a')](_0xc589('0x20'),'phone')[_0xc589('0x3a')]('id',_0xc589('0x38'))[_0xc589('0x3a')](LISTID[_0xc589('0x3c')](),'ListId')[_0xc589('0x3a')](_0x4914af['id'][_0xc589('0x3c')](),_0x278719)[_0xc589('0x3a')](_0xc589('0x3b'),_0xc589('0x39'))[_0xc589('0x3a')]('NOW()','updatedAt')[_0xc589('0x3e')]('cm_contacts')[_0xc589('0x40')](_0xc589('0x41'))[_0xc589('0x40')](_0xc589('0x42'),LISTID['toString']())[_0xc589('0x40')](_0xc589('0x48'),squel[_0xc589('0x49')](hopperContacts))[_0xc589('0x40')](_0xc589('0x43')))[_0xc589('0x3c')]();return _0x4152b3;}return db[_0xc589('0x4d')][_0xc589('0x4e')]({'where':{'type':_0xc589('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc589('0x50')],'as':_0xc589('0x51'),'where':{'id':LISTID}}]})[_0xc589('0x2c')](function(_0x1c2f2e){var _0x2dd1b3=[];if(_0x1c2f2e){var _0x35db25;for(var _0x5147a2=0x0,_0x3a2bc2;_0x5147a2<_0x1c2f2e[_0xc589('0x1a')];_0x5147a2+=0x1){_0x3a2bc2=_0x1c2f2e[_0x5147a2]['get']({'plain':!![]});switch(_0x3a2bc2[_0xc589('0x52')]){case _0xc589('0x53'):_0x2dd1b3[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x2d07e6(_0x3a2bc2,'VoiceQueueId'))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));break;case _0xc589('0x57'):_0x2dd1b3[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x8ed8b2(_0x3a2bc2,_0xc589('0x58')))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));break;default:_0x2dd1b3[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x3f9e96(_0x3a2bc2,'VoiceQueueId'))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));}}}return _0x2dd1b3;})[_0xc589('0x59')]()['then'](function(){return db[_0xc589('0x4d')][_0xc589('0x4e')]({'where':{'type':_0xc589('0x4f')},'attributes':['id'],'include':[{'model':db[_0xc589('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5a169d){var _0x58cdeb=[];if(_0x5a169d){var _0x240d4e;for(var _0x1cafba=0x0,_0x1b29f9;_0x1cafba<_0x5a169d[_0xc589('0x1a')];_0x1cafba+=0x1){_0x1b29f9=_0x5a169d[_0x1cafba][_0xc589('0x5a')]({'plain':!![]});_0x58cdeb['push'](db[_0xc589('0x54')][_0xc589('0x55')](_0x485a2b(_0x1b29f9,_0xc589('0x58')))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));}}return _0x58cdeb;})[_0xc589('0x59')]();})[_0xc589('0x2c')](function(){return db[_0xc589('0x5b')][_0xc589('0x4e')]({'attributes':['id',_0xc589('0x52')],'include':[{'model':db[_0xc589('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0xc589('0x2c')](function(_0x4e6f57){var _0x65862e=[];if(_0x4e6f57){for(var _0x2d203c=0x0,_0xa73c95;_0x2d203c<_0x4e6f57[_0xc589('0x1a')];_0x2d203c+=0x1){_0xa73c95=_0x4e6f57[_0x2d203c]['get']({'plain':!![]});switch(_0xa73c95[_0xc589('0x52')]){case _0xc589('0x53'):_0x65862e['push'](db['sequelize'][_0xc589('0x55')](_0x2d07e6(_0xa73c95,_0xc589('0x5c')))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));break;case _0xc589('0x57'):_0x65862e[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x8ed8b2(_0xa73c95,_0xc589('0x5c')))['then'](function(){})['catch'](_0x217fe0()));break;default:_0x65862e[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x3f9e96(_0xa73c95,_0xc589('0x5c')))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));}}}return _0x65862e;})[_0xc589('0x59')]();})[_0xc589('0x2c')](function(){return db[_0xc589('0x5b')][_0xc589('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xc589('0x50')],'as':_0xc589('0x5d'),'where':{'id':LISTID}}]})[_0xc589('0x2c')](function(_0x3e6c54){var _0x50c6dc=[];if(_0x3e6c54){for(var _0x39044f=0x0,_0x12f333;_0x39044f<_0x3e6c54[_0xc589('0x1a')];_0x39044f+=0x1){_0x12f333=_0x3e6c54[_0x39044f][_0xc589('0x5a')]({'plain':!![]});_0x50c6dc[_0xc589('0x2d')](db[_0xc589('0x54')][_0xc589('0x55')](_0x485a2b(_0x12f333,'CampaignId'))[_0xc589('0x2c')](function(){})[_0xc589('0x56')](_0x217fe0()));}}return _0x50c6dc;})[_0xc589('0x59')]();})[_0xc589('0x56')](function(_0x266e96){logger[_0xc589('0x17')](_0xc589('0x5e'),'generalCheckHopper',_0x266e96[_0xc589('0x30')]);});}var processPromises=function(_0x1c0ecd){return BPromise[_0xc589('0x59')](promises)[_0xc589('0x2c')](function(_0x569055){})[_0xc589('0x56')](function(_0x2ca1d7){logger[_0xc589('0x17')](_0xc589('0x5f'),JSON[_0xc589('0x60')](_0x2ca1d7));})[_0xc589('0x61')](function(){socket[_0xc589('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1c0ecd){return _0x1c0ecd[_0xc589('0x63')]();}});};var endCsv=function(){return BPromise[_0xc589('0x64')]()[_0xc589('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xc589('0x2c')](function(){socket[_0xc589('0x62')](_0xc589('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc589('0x66')](FILEPATH);}catch(_0x322f51){logger[_0xc589('0x17')](_0xc589('0x67'),JSON['stringify'](_0x322f51));}finally{process['exit'](0x0);}});};process['on'](_0xc589('0x68'),function(){logger[_0xc589('0x69')](_0xc589('0x6a'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc589('0x14')](',');return db['CmContact'][_0xc589('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc589('0x2c')](function(_0x53dac6){var _0x3fd3c5=fs[_0xc589('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc589('0x6c')](_0x3fd3c5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x303915,_0x129426){total+=0x1;var _0x444f15=total;promises[_0xc589('0x2d')](checkRow(_0x303915,_0x53dac6,_0x444f15)['then'](function(){success+=0x1;})['catch'](function(_0x3147d4){if(_0x3147d4['error']){errors+=0x1;delete _0x3147d4[_0xc589('0x17')];}else if(_0x3147d4[_0xc589('0x28')]){duplicates+=0x1;delete _0x3147d4[_0xc589('0x28')];}rows[_0xc589('0x2d')](_0x3147d4);}));if(total%0xc8===0x0){_0x129426[_0xc589('0x6d')]();return processPromises(_0x129426);}},'complete':function(){return processPromises()['then'](function(){logger[_0xc589('0x69')](_0xc589('0x6e'));endCsv();});},'error':function(_0x1b6570,_0x13ca3f){logger[_0xc589('0x69')](_0xc589('0x6f'),JSON[_0xc589('0x60')](_0x1b6570));endCsv();}});})['catch'](function(_0x3eb92e){logger[_0xc589('0x17')](_0xc589('0x70'),JSON['stringify'](_0x3eb92e));});}main(); \ No newline at end of file +var _0x9a63=['isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','insert','deletedAt\x20IS\x20NULL','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','id\x20IN\x20?','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','BlackLists','all','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','birthDate'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0x9a63,0x1a1));var _0x39a6=function(_0x379ee5,_0x336c42){_0x379ee5=_0x379ee5-0x0;var _0x114694=_0x9a63[_0x379ee5];return _0x114694;};'use strict';var BPromise=require(_0x39a6('0x0'));var util=require(_0x39a6('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x39a6('0x2'));var Papa=require(_0x39a6('0x3'));var Redis=require(_0x39a6('0x4'));var db=require(_0x39a6('0x5'))['db'];var config=require(_0x39a6('0x6'));var logger=require(_0x39a6('0x7'))(_0x39a6('0x8'));config[_0x39a6('0x9')]=_[_0x39a6('0xa')](config[_0x39a6('0x9')],{'host':_0x39a6('0xb'),'port':0x18eb});var socket=require(_0x39a6('0xc'))(new Redis(config[_0x39a6('0x9')]));require(_0x39a6('0xd'))[_0x39a6('0xe')](socket);try{if(!process[_0x39a6('0xf')][0x2]||process[_0x39a6('0xf')][0x2]===_0x39a6('0x10')||process[_0x39a6('0xf')][0x2]===_0x39a6('0x11')){throw new Error(_0x39a6('0x12'));}var FILEPATH=process['argv'][0x2];if(!process[_0x39a6('0xf')][0x3]||process[_0x39a6('0xf')][0x3]===_0x39a6('0x10')||process[_0x39a6('0xf')][0x3]===_0x39a6('0x11')||!process[_0x39a6('0xf')][0x4]||process[_0x39a6('0xf')][0x4]===_0x39a6('0x10')||process[_0x39a6('0xf')][0x4]===_0x39a6('0x11')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x39a6('0x13')](process[_0x39a6('0xf')][0x3][_0x39a6('0x14')](','),process['argv'][0x4][_0x39a6('0x14')](','));if(!process[_0x39a6('0xf')][0x5]||process[_0x39a6('0xf')][0x5]===_0x39a6('0x10')||process[_0x39a6('0xf')][0x5]===_0x39a6('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x39a6('0xf')][0x5];var COMPANYID=process[_0x39a6('0xf')][0x6]&&process[_0x39a6('0xf')][0x6]!=='undefined'&&process[_0x39a6('0xf')][0x6]!==_0x39a6('0x11')?process[_0x39a6('0xf')][0x6]:null;var DUPLICATES=process[_0x39a6('0xf')][0x7]&&process[_0x39a6('0xf')][0x7]!==_0x39a6('0x10')&&process[_0x39a6('0xf')][0x7]!==_0x39a6('0x11')?process[_0x39a6('0xf')][0x7]:null;if(!process[_0x39a6('0xf')][0x8]||process[_0x39a6('0xf')][0x8]==='undefined'||process['argv'][0x8]==='null'){throw new Error(_0x39a6('0x15'));}var SOCKET_TIMESTAMP=process[_0x39a6('0xf')][0x8];}catch(_0x4ba7e0){logger['error'](_0x4ba7e0);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(_0x166a5c,_0x4067ab,_0x77f5b4,_0x2c6805){var _0x1e64f3={'message':_0x4067ab};_0x1e64f3[_0x166a5c]=!![];if(_0x77f5b4){_0x1e64f3[_0x39a6('0x16')]=_0x77f5b4;}if(_0x2c6805){_0x1e64f3[_0x39a6('0x17')]=_0x2c6805;}return _0x1e64f3;}function isEmail(_0x21149d){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))*$/[_0x39a6('0x18')](_0x21149d);}function checkRow(_0x5ab91f,_0x5ea775,_0x37c375){return new BPromise(function(_0x2dff1d,_0x211a3d){if(_[_0x39a6('0x19')](_0x5ab91f)){return _0x211a3d(handleCheckRowError('error',_0x39a6('0x1a'),null,_0x37c375));}if(_0x5ab91f[_0x39a6('0x1b')]&&_0x5ab91f['errors'][_0x39a6('0x1c')]){var _0x6cb463=_[_0x39a6('0x1d')](_0x5ab91f[_0x39a6('0x1b')],_0x39a6('0x1e'))[_0x39a6('0x1f')](';');return _0x211a3d(handleCheckRowError('error',_0x6cb463,null,_0x37c375));}var _0x33d023={};for(var _0x4eee55 in FIELDS){if(FIELDS[_0x39a6('0x20')](_0x4eee55)&&FIELDS[_0x4eee55]){_0x33d023[_0x4eee55]=_0x5ab91f[_0x39a6('0x21')][0x0][FIELDS[_0x4eee55]]||_0x5ab91f[_0x39a6('0x21')][0x0]['\ufeff'+FIELDS[_0x4eee55]];}}if(!_0x33d023[_0x39a6('0x22')]){return _0x211a3d(handleCheckRowError(_0x39a6('0x23'),_0x39a6('0x24'),null,_0x37c375));}if(!_0x33d023[_0x39a6('0x25')]){return _0x211a3d(handleCheckRowError(_0x39a6('0x23'),'phone\x20not\x20specified!',null,_0x37c375));}if(_0x33d023[_0x39a6('0x26')]){var _0x2980f5=moment(_0x33d023[_0x39a6('0x26')],'YYYY-MM-DD');if(!_0x2980f5[_0x39a6('0x27')]()){return _0x211a3d(handleCheckRowError(_0x39a6('0x23'),_0x39a6('0x28'),null,_0x37c375));}}if(_0x33d023[_0x39a6('0x29')]){if(!isEmail(_0x33d023[_0x39a6('0x29')])){return _0x211a3d(handleCheckRowError(_0x39a6('0x23'),_0x39a6('0x2a'),null,_0x37c375));}}_0x33d023[_0x39a6('0x2b')]=LISTID;_0x33d023[_0x39a6('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5ea775){var _0x1ef9fa={};for(var _0x1a88d9=0x0,_0x249152=DUPLICATES[_0x39a6('0x1c')];_0x1a88d9<_0x249152;_0x1a88d9+=0x1){_0x1ef9fa[DUPLICATES[_0x1a88d9]]=_0x33d023[DUPLICATES[_0x1a88d9]];}var _0x1eee67=_['find'](_0x5ea775,_0x1ef9fa);if(_0x1eee67){return _0x211a3d(handleCheckRowError(_0x39a6('0x2d'),_0x39a6('0x2e'),_0x1eee67,_0x37c375));}}return db[_0x39a6('0x2f')][_0x39a6('0x30')](_0x33d023,{'raw':!![],'hooks':![],'fields':_[_0x39a6('0x31')](_0x33d023)})[_0x39a6('0x32')](function(_0x321a1c){if(DUPLICATES&&DUPLICATES[_0x39a6('0x1c')]&&_0x5ea775){_0x5ea775[_0x39a6('0x33')](_[_0x39a6('0x34')](_0x33d023,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x321a1c['id'];return _0x2dff1d();})[_0x39a6('0x35')](function(_0x3152f2){return _0x211a3d(handleCheckRowError('error',_0x39a6('0x36')+(_0x3152f2['message']||JSON[_0x39a6('0x37')](_0x3152f2)),null,_0x37c375));});});}function checkHopper(){function _0x420fc5(){return function(_0x1d9315){logger['error'](_0x39a6('0x38'),_0x39a6('0x39'),util[_0x39a6('0x3a')](_0x1d9315,{'showHidden':![],'depth':null}));};}var _0x2178ef=function(_0x30f039,_0x192f71){var _0x20bb6b=squel['insert']()[_0x39a6('0x3b')](_0x39a6('0x3c'))[_0x39a6('0x3d')]([_0x39a6('0x25'),_0x39a6('0x3e'),_0x39a6('0x3f'),'ListId',_0x192f71,_0x39a6('0x40'),_0x39a6('0x41')],squel['select']()[_0x39a6('0x42')](_0x39a6('0x25'),'phone')[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x3e'))[_0x39a6('0x42')]('id',_0x39a6('0x3f'))[_0x39a6('0x42')](LISTID[_0x39a6('0x44')](),_0x39a6('0x2b'))[_0x39a6('0x42')](_0x30f039['id'][_0x39a6('0x44')](),_0x192f71)[_0x39a6('0x42')](_0x39a6('0x43'),'createdAt')[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x41'))[_0x39a6('0x45')](_0x39a6('0x46'))[_0x39a6('0x47')]('deletedAt\x20IS\x20NULL')[_0x39a6('0x47')](_0x39a6('0x48'),LISTID[_0x39a6('0x44')]())[_0x39a6('0x47')](_0x39a6('0x49'))[_0x39a6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x39a6('0x4a')]()[_0x39a6('0x42')](_0x39a6('0x25'))[_0x39a6('0x45')](_0x39a6('0x3c'))[_0x39a6('0x47')](_0x192f71+_0x39a6('0x4b'),_0x30f039['id'][_0x39a6('0x44')]())))[_0x39a6('0x44')]();return _0x20bb6b;};var _0x24aca0=function(_0x19be28,_0x25ed48){var _0x53f9b5=squel[_0x39a6('0x4c')]()[_0x39a6('0x3b')](_0x39a6('0x3c'))[_0x39a6('0x3d')]([_0x39a6('0x25'),_0x39a6('0x3e'),'ContactId','ListId',_0x25ed48,_0x39a6('0x40'),_0x39a6('0x41')],squel[_0x39a6('0x4a')]()[_0x39a6('0x42')]('phone','phone')[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x3e'))[_0x39a6('0x42')]('id',_0x39a6('0x3f'))[_0x39a6('0x42')](LISTID[_0x39a6('0x44')](),_0x39a6('0x2b'))[_0x39a6('0x42')](_0x19be28['id'][_0x39a6('0x44')](),_0x25ed48)['field'](_0x39a6('0x43'),_0x39a6('0x40'))[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x41'))[_0x39a6('0x45')](_0x39a6('0x46'))[_0x39a6('0x47')](_0x39a6('0x4d'))[_0x39a6('0x47')](_0x39a6('0x48'),LISTID[_0x39a6('0x44')]())['where']('id\x20IN\x20?',squel[_0x39a6('0x4e')](hopperContacts))[_0x39a6('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0x39a6('0x47')](_0x39a6('0x4f'),squel[_0x39a6('0x4a')]()[_0x39a6('0x42')]('calleridnum')['from'](_0x39a6('0x50'))['where'](_0x25ed48+_0x39a6('0x4b'),_0x19be28['id'][_0x39a6('0x44')]()))[_0x39a6('0x47')](_0x39a6('0x4f'),squel[_0x39a6('0x4a')]()[_0x39a6('0x42')](_0x39a6('0x25'))[_0x39a6('0x45')]('cm_hopper')[_0x39a6('0x47')](_0x25ed48+'\x20=\x20?',_0x19be28['id']['toString']())))[_0x39a6('0x44')]();return _0x53f9b5;};function _0x15f305(_0x2b007c,_0x36588f){var _0x3e67a7=squel[_0x39a6('0x4c')]()['into'](_0x39a6('0x3c'))[_0x39a6('0x3d')](['phone','scheduledAt',_0x39a6('0x3f'),_0x39a6('0x2b'),_0x36588f,_0x39a6('0x40'),_0x39a6('0x41')],squel[_0x39a6('0x4a')]()['field']('phone',_0x39a6('0x25'))[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x3e'))[_0x39a6('0x42')]('id',_0x39a6('0x3f'))[_0x39a6('0x42')](LISTID['toString'](),_0x39a6('0x2b'))['field'](_0x2b007c['id']['toString'](),_0x36588f)[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x40'))[_0x39a6('0x42')](_0x39a6('0x43'),_0x39a6('0x41'))[_0x39a6('0x45')](_0x39a6('0x46'))['where']('deletedAt\x20IS\x20NULL')[_0x39a6('0x47')]('ListId\x20=\x20?',LISTID[_0x39a6('0x44')]())[_0x39a6('0x47')](_0x39a6('0x51'),squel[_0x39a6('0x4e')](hopperContacts))[_0x39a6('0x47')](_0x39a6('0x49')))[_0x39a6('0x44')]();return _0x3e67a7;}function _0x45710c(_0x216262,_0x46e302){var _0xcd5ada=squel[_0x39a6('0x4c')]()['into']('cm_hopper_black')[_0x39a6('0x3d')](['phone',_0x39a6('0x3f'),_0x39a6('0x2b'),_0x46e302,_0x39a6('0x40'),_0x39a6('0x41')],squel[_0x39a6('0x4a')]()['field']('phone',_0x39a6('0x25'))[_0x39a6('0x42')]('id',_0x39a6('0x3f'))['field'](LISTID['toString'](),_0x39a6('0x2b'))['field'](_0x216262['id']['toString'](),_0x46e302)[_0x39a6('0x42')](_0x39a6('0x43'),'createdAt')['field'](_0x39a6('0x43'),_0x39a6('0x41'))[_0x39a6('0x45')](_0x39a6('0x46'))['where'](_0x39a6('0x4d'))[_0x39a6('0x47')](_0x39a6('0x48'),LISTID[_0x39a6('0x44')]())[_0x39a6('0x47')](_0x39a6('0x51'),squel['str'](hopperContacts))['where'](_0x39a6('0x49')))[_0x39a6('0x44')]();return _0xcd5ada;}return db[_0x39a6('0x52')][_0x39a6('0x53')]({'where':{'type':_0x39a6('0x54')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x39a6('0x55')],'as':_0x39a6('0x56'),'where':{'id':LISTID}}]})[_0x39a6('0x32')](function(_0x26587f){var _0x5501=[];if(_0x26587f){var _0x564111;for(var _0x588fd0=0x0,_0x237349;_0x588fd0<_0x26587f[_0x39a6('0x1c')];_0x588fd0+=0x1){_0x237349=_0x26587f[_0x588fd0][_0x39a6('0x57')]({'plain':!![]});switch(_0x237349[_0x39a6('0x58')]){case _0x39a6('0x59'):_0x5501[_0x39a6('0x33')](db[_0x39a6('0x5a')]['query'](_0x24aca0(_0x237349,_0x39a6('0x5b')))[_0x39a6('0x32')](function(){})['catch'](_0x420fc5()));break;case _0x39a6('0x5c'):_0x5501[_0x39a6('0x33')](db[_0x39a6('0x5a')][_0x39a6('0x5d')](_0x2178ef(_0x237349,_0x39a6('0x5b')))[_0x39a6('0x32')](function(){})[_0x39a6('0x35')](_0x420fc5()));break;default:_0x5501[_0x39a6('0x33')](db['sequelize'][_0x39a6('0x5d')](_0x15f305(_0x237349,'VoiceQueueId'))['then'](function(){})[_0x39a6('0x35')](_0x420fc5()));}}}return _0x5501;})['all']()[_0x39a6('0x32')](function(){return db[_0x39a6('0x52')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x39a6('0x55')],'as':_0x39a6('0x5e'),'where':{'id':LISTID}}]})['then'](function(_0x46c11e){var _0x5228c0=[];if(_0x46c11e){var _0x344785;for(var _0x394c35=0x0,_0xf5e73;_0x394c35<_0x46c11e['length'];_0x394c35+=0x1){_0xf5e73=_0x46c11e[_0x394c35][_0x39a6('0x57')]({'plain':!![]});_0x5228c0[_0x39a6('0x33')](db['sequelize'][_0x39a6('0x5d')](_0x45710c(_0xf5e73,_0x39a6('0x5b')))[_0x39a6('0x32')](function(){})[_0x39a6('0x35')](_0x420fc5()));}}return _0x5228c0;})[_0x39a6('0x5f')]();})[_0x39a6('0x32')](function(){return db['Campaign'][_0x39a6('0x53')]({'attributes':['id',_0x39a6('0x58')],'include':[{'model':db[_0x39a6('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x39a6('0x32')](function(_0x5af150){var _0x1caea9=[];if(_0x5af150){for(var _0x5292fc=0x0,_0x27b02d;_0x5292fc<_0x5af150[_0x39a6('0x1c')];_0x5292fc+=0x1){_0x27b02d=_0x5af150[_0x5292fc][_0x39a6('0x57')]({'plain':!![]});switch(_0x27b02d['dialCheckDuplicateType']){case _0x39a6('0x59'):_0x1caea9[_0x39a6('0x33')](db[_0x39a6('0x5a')][_0x39a6('0x5d')](_0x24aca0(_0x27b02d,'CampaignId'))[_0x39a6('0x32')](function(){})[_0x39a6('0x35')](_0x420fc5()));break;case _0x39a6('0x5c'):_0x1caea9['push'](db['sequelize'][_0x39a6('0x5d')](_0x2178ef(_0x27b02d,_0x39a6('0x60')))['then'](function(){})[_0x39a6('0x35')](_0x420fc5()));break;default:_0x1caea9['push'](db['sequelize'][_0x39a6('0x5d')](_0x15f305(_0x27b02d,_0x39a6('0x60')))[_0x39a6('0x32')](function(){})[_0x39a6('0x35')](_0x420fc5()));}}}return _0x1caea9;})[_0x39a6('0x5f')]();})[_0x39a6('0x32')](function(){return db[_0x39a6('0x61')][_0x39a6('0x53')]({'attributes':['id'],'include':[{'model':db[_0x39a6('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x39a6('0x32')](function(_0x2e19fd){var _0x5189ae=[];if(_0x2e19fd){for(var _0x58da2e=0x0,_0x302b16;_0x58da2e<_0x2e19fd[_0x39a6('0x1c')];_0x58da2e+=0x1){_0x302b16=_0x2e19fd[_0x58da2e][_0x39a6('0x57')]({'plain':!![]});_0x5189ae[_0x39a6('0x33')](db[_0x39a6('0x5a')][_0x39a6('0x5d')](_0x45710c(_0x302b16,_0x39a6('0x60')))[_0x39a6('0x32')](function(){})[_0x39a6('0x35')](_0x420fc5()));}}return _0x5189ae;})[_0x39a6('0x5f')]();})['catch'](function(_0x2df883){logger[_0x39a6('0x23')](_0x39a6('0x62'),_0x39a6('0x63'),_0x2df883['message']);});}var processPromises=function(_0x3e2778){return BPromise[_0x39a6('0x5f')](promises)[_0x39a6('0x32')](function(_0x587607){})[_0x39a6('0x35')](function(_0x4cc5b9){logger[_0x39a6('0x23')]('Error\x20processing\x20rows\x20block:',JSON[_0x39a6('0x37')](_0x4cc5b9));})['finally'](function(){socket['emit'](_0x39a6('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e2778){return _0x3e2778[_0x39a6('0x65')]();}});};var endCsv=function(){return BPromise[_0x39a6('0x66')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x39a6('0x67')](_0x39a6('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x39a6('0x68')](FILEPATH);}catch(_0x408d32){logger[_0x39a6('0x23')](_0x39a6('0x69'),JSON[_0x39a6('0x37')](_0x408d32));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x39a6('0x6a')](_0x39a6('0x6b'));endCsv();});function main(){return BPromise[_0x39a6('0x66')]()[_0x39a6('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x39a6('0x14')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x39a6('0x32')](function(_0x49a0cf){var _0x5d97ac=fs[_0x39a6('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x39a6('0x6d')](_0x5d97ac,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a14f7,_0x41a47e){total+=0x1;var _0x12c0a5=total;promises[_0x39a6('0x33')](checkRow(_0x1a14f7,_0x49a0cf,_0x12c0a5)[_0x39a6('0x32')](function(){success+=0x1;})[_0x39a6('0x35')](function(_0x1bc318){if(_0x1bc318['error']){errors+=0x1;delete _0x1bc318[_0x39a6('0x23')];}else if(_0x1bc318['duplicate']){duplicates+=0x1;delete _0x1bc318[_0x39a6('0x2d')];}rows[_0x39a6('0x33')](_0x1bc318);}));if(total%0xc8===0x0){_0x41a47e[_0x39a6('0x6e')]();return processPromises(_0x41a47e);}},'complete':function(){return processPromises()[_0x39a6('0x32')](function(){logger[_0x39a6('0x6a')](_0x39a6('0x6f'));endCsv();});},'error':function(_0xaf6279,_0x563116){logger['info'](_0x39a6('0x70'),JSON[_0x39a6('0x37')](_0xaf6279));endCsv();}});})[_0x39a6('0x35')](function(_0x70f633){logger[_0x39a6('0x23')](_0x39a6('0x71'),JSON[_0x39a6('0x37')](_0x70f633));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 36441a8..3821cf2 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 _0x6655=['header','ContactItemType','name','_description','writeFileSync','find','hasOwnProperty','data','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','orderBy','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','VoiceQueueId','voice_queues_has_cm_blacklists','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.updatedAt','into','cm_hopper_black','updatedAt','ListId\x20=\x20?','\x20=\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','scheduledat','\x22always\x22','cm_hopper.id','cm_contact_has_items.createdAt','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','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','message','sequelize','query','spread','catch','error','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','socket_timestamp','root','.csv','includes'];(function(_0x1c0029,_0x3fa67e){var _0x5b295c=function(_0x119663){while(--_0x119663){_0x1c0029['push'](_0x1c0029['shift']());}};_0x5b295c(++_0x3fa67e);}(_0x6655,0xea));var _0x5665=function(_0x49d685,_0x334e5c){_0x49d685=_0x49d685-0x0;var _0x7a8052=_0x6655[_0x49d685];return _0x7a8052;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x5665('0x0'));var BPromise=require(_0x5665('0x1'));var moment=require(_0x5665('0x2'));var squel=require('squel');var Redis=require(_0x5665('0x3'));var db=require(_0x5665('0x4'))['db'];var config=require(_0x5665('0x5'));var shared=require(_0x5665('0x6'));var logger=require(_0x5665('0x7'))('import');config[_0x5665('0x8')]=_[_0x5665('0x9')](config[_0x5665('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5665('0xa'))(new Redis(config[_0x5665('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5665('0xb')](_0x5665('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5665('0xb')](_0x5665('0xc'));function isEmail(_0x5ed74c){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))*$/[_0x5665('0xd')](_0x5ed74c);}function selectNotIn(_0x196147,_0x224917,_0x166e7c,_0xe106d6,_0x34770d){return squel[_0x5665('0xe')]()[_0x5665('0xf')](_0x5665('0x10'))[_0x5665('0x11')](_0xe106d6)['join'](_0x224917,null,_0x224917+_0x5665('0x12')+_0xe106d6+'.'+_0x166e7c)[_0x5665('0x13')](_0xe106d6+'.'+_0x166e7c+'\x20=\x20'+_0x196147+'.'+_0x166e7c)[_0x5665('0x13')](_0x224917+_0x5665('0x14')+_0x34770d['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x35ec0a,_0x2b10ad){promisesAdditionalPhones=[];return db[_0x5665('0x15')][_0x5665('0x16')]({'raw':!![],'attributes':['id',_0x5665('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5665('0x18')](function(_0x42cbcf){if(_0x42cbcf!==null){var _0x313114=[];for(var _0x168166=0x0;_0x168166<_0x42cbcf[_0x5665('0x19')];_0x168166++){var _0x2b73da=_0x42cbcf[_0x168166];_0x313114[_0x5665('0x1a')](insertAdditionalPhones(_0x2b73da));}}Promise[_0x5665('0x1b')](_0x313114)[_0x5665('0x18')](function(){_0x35ec0a({'val':0x1});});});});}function insertAdditionalPhones(_0x1dbddc){return new Promise(function(_0x332818,_0x30afda){var _0x18417d=_0x1dbddc[_0x5665('0x17')];var _0xb91534=_0x18417d[_0x5665('0x1c')](';');var _0x28008e=[];orderBy=0x0;for(var _0xf9dfa4=0x0;_0xf9dfa4<_0xb91534[_0x5665('0x19')];_0xf9dfa4++){_0x28008e[_0x5665('0x1a')](splitAdditionalPhone(_0x1dbddc['id'],_0xb91534[_0xf9dfa4]));}Promise[_0x5665('0x1b')](_0x28008e)[_0x5665('0x18')](function(){_0x332818({'val':_0xb91534['length']});});});}function splitAdditionalPhone(_0xba660f,_0xb7f16d){return new Promise(function(_0x47007a,_0x353d75){var _0xd89413=_0xb7f16d[_0x5665('0x1c')](':');var _0x54af8a=_0xd89413[0x0];var _0x4b0466=_0xd89413[0x1];if(!_[_0x5665('0x1d')](_0x4b0466)){var _0x226e08=_0x4b0466[_0x5665('0x1c')]('|');var _0x32040a=[];for(var _0x7d53fd=0x0;_0x7d53fd<_0x226e08[_0x5665('0x19')];_0x7d53fd++){if(_0x226e08[_0x7d53fd]!==''){var _0x302be9=_[_0x5665('0x1e')](promisesAdditionalPhones,{'contactId':_0xba660f,'phone':_0x226e08[_0x7d53fd]});if(_0x302be9['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xba660f,'contactTypeId':_0x54af8a,'phone':_0x226e08[_0x7d53fd],'orderBy':orderBy});}}}_0x47007a({'ok':0x1});}else _0x47007a({'res':0x0});});}function createAdditionalPhone(_0x5a13ed,_0x6df7d2,_0x134d71,_0x4e51e1){var _0x1913d4='';var _0x5285da='';var _0x4a37f0=_0x134d71[_0x5665('0x1c')]('§');_0x1913d4=_0x4a37f0[0x0];if(_0x4a37f0[_0x5665('0x19')]==0x2)_0x5285da=_0x4a37f0[0x1];return new Promise(function(_0x533c26,_0x9668c8){return db[_0x5665('0x1f')][_0x5665('0x20')]({'where':{'CmContactId':_0x5a13ed,'item':_0x1913d4}})[_0x5665('0x18')](function(_0x1f9c7b){if(_0x1f9c7b){return db[_0x5665('0x1f')][_0x5665('0x21')]({'ItemTypeId':_0x6df7d2,'description':_0x5285da,'OrderBy':_0x4e51e1},{'where':{'CmContactId':_0x5a13ed,'item':_0x1913d4}})[_0x5665('0x18')](function(_0x3403e7){_0x533c26({'res':_0x5665('0x22')});});}else{return db[_0x5665('0x1f')][_0x5665('0x23')]({'CmContactId':_0x5a13ed,'item':_0x1913d4,'description':_0x5285da,'ItemTypeId':_0x6df7d2,'OrderBy':_0x4e51e1,'ItemClass':_0x5665('0x24')})['then'](function(_0x49e4fa){_0x533c26({'res':_0x5665('0x25')});});}});});}function insertCmHopper(_0x88c9b2,_0x58584d,_0x185535,_0x35bfa7,_0x44fa93){var _0x2bab78=[_0x5665('0x26'),'cm_contacts.scheduledat','cm_contacts.id',_0x5665('0x27'),_0x58584d+'.'+_0x35bfa7,_0x5665('0x28'),'cm_contacts.updatedAt',_0x5665('0x29'),'cm_contacts.UserId','\x22'+_0x44fa93+'\x22'];return squel[_0x5665('0x2a')]()['into'](_0x5665('0x2b'))[_0x5665('0x2c')]([_0x5665('0x10'),'scheduledat',_0x5665('0x2d'),_0x5665('0x2e'),_0x35bfa7,_0x5665('0x2f'),'updatedAt',_0x5665('0x30'),_0x5665('0x31'),_0x5665('0x32')],squel[_0x5665('0xe')]()[_0x5665('0x33')](_0x2bab78)[_0x5665('0x11')](_0x58584d)[_0x5665('0x34')](_0x5665('0x35'),null,_0x5665('0x36')+_0x58584d+_0x5665('0x37'))['join'](_0x185535,null,_0x185535+_0x5665('0x12')+_0x58584d+'.'+_0x35bfa7)[_0x5665('0x13')](_0x58584d+_0x5665('0x38'),_0x88c9b2)[_0x5665('0x13')](_0x5665('0x39'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x58584d,_0x185535,_0x35bfa7,_0x5665('0x2b'),['\x22always\x22',_0x5665('0x3a')]))[_0x5665('0x13')](_0x5665('0x3b'),selectNotIn(_0x58584d,_0x185535,_0x35bfa7,_0x5665('0x2b'),['\x22always\x22'])))[_0x5665('0x3c')]();}function insertCmHopperBlack(_0x3fefdb,_0x67e71f,_0x31d886,_0x910804){var _0x34af66=[_0x5665('0x26'),_0x5665('0x3d'),_0x5665('0x27'),_0x67e71f+'.'+_0x910804,_0x5665('0x28'),_0x5665('0x3e')];return squel[_0x5665('0x2a')]()[_0x5665('0x3f')](_0x5665('0x40'))[_0x5665('0x2c')](['phone',_0x5665('0x2d'),'ListId',_0x910804,'createdAt',_0x5665('0x41')],squel[_0x5665('0xe')]()[_0x5665('0x33')](_0x34af66)[_0x5665('0x11')](_0x67e71f)[_0x5665('0x34')](_0x5665('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x67e71f+_0x5665('0x37'))[_0x5665('0x34')](_0x31d886,null,_0x31d886+_0x5665('0x12')+_0x67e71f+'.'+_0x910804)['where'](_0x67e71f+'.CmListId\x20=\x20?',_0x3fefdb)[_0x5665('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5665('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5665('0xe')]()[_0x5665('0xf')](_0x5665('0x10'))[_0x5665('0x11')](_0x5665('0x40'))['where'](_0x5665('0x42'),_0x3fefdb)[_0x5665('0x13')](_0x910804+_0x5665('0x43')+_0x67e71f+'.'+_0x910804)))[_0x5665('0x3c')]();}function insertTzCmHopper(_0x46b3e7,_0x2b94c7,_0x2199a5,_0x374498,_0x4916ca,_0x53dd2a){var _0x13fc36=[_0x5665('0x26'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x53dd2a+_0x5665('0x44'),_0x5665('0x3d'),_0x5665('0x27'),_0x2b94c7+'.'+_0x374498,'cm_contacts.createdAt',_0x5665('0x3e'),_0x5665('0x29'),_0x5665('0x45'),'\x22'+_0x4916ca+'\x22'];var _0x5615d9=squel[_0x5665('0x2a')]()['into'](_0x5665('0x2b'))[_0x5665('0x2c')]([_0x5665('0x10'),_0x5665('0x46'),_0x5665('0x2d'),_0x5665('0x2e'),_0x374498,_0x5665('0x2f'),_0x5665('0x41'),_0x5665('0x30'),'UserId',_0x5665('0x32')],squel[_0x5665('0xe')]()['fields'](_0x13fc36)[_0x5665('0x11')](_0x2b94c7)[_0x5665('0x34')](_0x5665('0x35'),null,_0x5665('0x36')+_0x2b94c7+_0x5665('0x37'))[_0x5665('0x34')](_0x2199a5,null,_0x2199a5+_0x5665('0x12')+_0x2b94c7+'.'+_0x374498)[_0x5665('0x34')](_0x53dd2a,null,_0x53dd2a+'.id\x20=\x20'+_0x2b94c7+'.'+_0x374498)[_0x5665('0x13')](_0x2b94c7+_0x5665('0x38'),_0x46b3e7)[_0x5665('0x13')](_0x5665('0x39'),NOW)[_0x5665('0x13')](_0x5665('0x3b'),selectNotIn(_0x2b94c7,_0x2199a5,_0x374498,_0x5665('0x2b'),[_0x5665('0x47'),'\x22onlyIfOpen\x22']))['where'](_0x5665('0x3b'),selectNotIn(_0x2b94c7,_0x2199a5,_0x374498,_0x5665('0x2b'),[_0x5665('0x47')])))[_0x5665('0x3c')]();return _0x5615d9;}function insertTzCmHopperBlack(_0x4f54e3,_0x37570f,_0x4e020f,_0x1c5f4f){var _0x103c39=['cm_contacts.phone',_0x5665('0x3d'),_0x5665('0x27'),_0x37570f+'.'+_0x1c5f4f,_0x5665('0x28'),_0x5665('0x3e')];return squel[_0x5665('0x2a')]()['into'](_0x5665('0x40'))['fromQuery'](['phone',_0x5665('0x2d'),'ListId',_0x1c5f4f,_0x5665('0x2f'),_0x5665('0x41')],squel[_0x5665('0xe')]()['fields'](_0x103c39)[_0x5665('0x11')](_0x37570f)['join'](_0x5665('0x35'),null,_0x5665('0x36')+_0x37570f+_0x5665('0x37'))[_0x5665('0x34')](_0x4e020f,null,_0x4e020f+_0x5665('0x12')+_0x37570f+'.'+_0x1c5f4f)[_0x5665('0x13')](_0x37570f+_0x5665('0x38'),_0x4f54e3)[_0x5665('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5665('0x13')](_0x5665('0x3b'),squel[_0x5665('0xe')]()[_0x5665('0xf')](_0x5665('0x10'))['from']('cm_hopper_black')['where'](_0x5665('0x42'),_0x4f54e3)[_0x5665('0x13')](_0x1c5f4f+_0x5665('0x43')+_0x37570f+'.'+_0x1c5f4f)))[_0x5665('0x3c')]();}function insertCmHopperAdditionalPhones(_0xbb535){var _0x56f581=[_0x5665('0x48'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x5665('0x49'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x5665('0x3f')](_0x5665('0x4a'))[_0x5665('0x2c')]([_0x5665('0x4b'),'phone',_0x5665('0x4c'),_0x5665('0x2f'),_0x5665('0x41')],squel[_0x5665('0xe')]()[_0x5665('0x33')](_0x56f581)[_0x5665('0x11')]('cm_hopper')[_0x5665('0x34')](_0x5665('0x35'),null,_0x5665('0x4d'))[_0x5665('0x34')](_0x5665('0x4e'),null,_0x5665('0x4f'))[_0x5665('0x13')](_0x5665('0x50'),_0xbb535)[_0x5665('0x13')](_0x5665('0x39'),NOW))['toString']();}function insertCmContact(_0x143b5e,_0x58da05,_0x276dd7,_0x298b6c){var _0x130cdc=_[_0x5665('0x51')](_[_0x5665('0x52')](_0x298b6c),[_0x5665('0x2e'),_0x5665('0x53'),_0x5665('0x2f'),'updatedAt','scheduledAt']);return squel['insert']()[_0x5665('0x3f')](_0x5665('0x35'))['fromQuery'](_0x130cdc,squel[_0x5665('0xe')]()[_0x5665('0x33')](_0x130cdc)[_0x5665('0x11')](_0x58da05)[_0x5665('0x13')]('('+_0x276dd7[_0x5665('0x34')](',')+')\x20NOT\x20IN\x20?',squel[_0x5665('0xe')]()[_0x5665('0x33')](_0x276dd7)['from'](_0x5665('0x35'))[_0x5665('0x13')](_0x5665('0x42'),_0x143b5e)[_0x5665('0x13')](_0x5665('0x54')))[_0x5665('0x13')](_0x5665('0x55'),squel[_0x5665('0xe')]()[_0x5665('0xf')](_0x5665('0x56'),_0x5665('0x57'))['from'](_0x58da05)[_0x5665('0x58')](_0x276dd7['join'](','))))[_0x5665('0x3c')]();}function handleStop(){logger[_0x5665('0x59')](_0x5665('0x5a'));stopped=!![];}function handleUncaughtException(_0x22602a){logger['error'](_0x22602a['message']);process[_0x5665('0x5b')](0x1);}function handleError(_0x4915b0,_0x312038){stats[_0x5665('0x5c')][_0x5665('0x1a')]({'name':_0x312038[_0x5665('0x5d')],'message':_0x312038[_0x5665('0x5e')],'row':_0x4915b0});}function handleQuery(_0x40d668){logger[_0x5665('0x59')](_0x40d668);return db[_0x5665('0x5f')][_0x5665('0x60')](_0x40d668)[_0x5665('0x61')](function(_0x59f983){results[_0x5665('0x1a')](_0x59f983);})[_0x5665('0x62')](function(_0x58ac26){logger[_0x5665('0x63')](_0x58ac26['message']);});}function updateTzCampaigns(_0x3af293){return new Promise(function(_0x1459fb,_0x4e4494){var _0x386d59=squel[_0x5665('0xe')]()[_0x5665('0x33')](['campaigns.id',_0x5665('0x64')])[_0x5665('0x11')](_0x5665('0x65'))[_0x5665('0x34')]('campaigns_has_cm_lists',null,_0x5665('0x66'))[_0x5665('0x13')](_0x5665('0x67')+_0x3af293);db[_0x5665('0x5f')]['query'](_0x386d59[_0x5665('0x3c')]())[_0x5665('0x61')](function(_0x183345){var _0x80cc1=[];for(var _0x251d01=0x0;_0x251d01<_0x183345[_0x5665('0x19')];_0x251d01++){_0x80cc1[_0x5665('0x1a')](getTimezoneData(_0x183345[_0x251d01],tmp_campaigns));}BPromise[_0x5665('0x1b')](_0x80cc1)[_0x5665('0x18')](function(){_0x1459fb({'val':0x1});});})['catch'](function(_0x4fcffa){logger[_0x5665('0x63')](_0x4fcffa[_0x5665('0x5e')]);_0x1459fb({'val':0x0});});});}function updateTzVoiceQueues(_0x3548ad){return new Promise(function(_0x36ea1d,_0x9c9860){var _0x1224e=squel[_0x5665('0xe')]()['fields'](['voice_queues.id','voice_queues.dialTimezone'])[_0x5665('0x11')]('voice_queues')['join'](_0x5665('0x68'),null,_0x5665('0x69'))[_0x5665('0x13')](_0x5665('0x6a')+_0x3548ad);db[_0x5665('0x5f')][_0x5665('0x60')](_0x1224e[_0x5665('0x3c')]())[_0x5665('0x61')](function(_0x22d53f){var _0x579632=[];for(var _0x56093f=0x0;_0x56093f<_0x22d53f[_0x5665('0x19')];_0x56093f++){_0x579632['push'](getTimezoneData(_0x22d53f[_0x56093f],tmp_voice_queues));}BPromise[_0x5665('0x1b')](_0x579632)[_0x5665('0x18')](function(){_0x36ea1d({'val':0x1});});})[_0x5665('0x62')](function(_0x1f63d9){logger[_0x5665('0x63')](_0x1f63d9[_0x5665('0x5e')]);_0x36ea1d({'val':0x0});});});}function getTimezoneData(_0x42bf10,_0x3f4777){return new Promise(function(_0x270bec,_0x1eba30){var _0x2e0da4=shared[_0x5665('0x6b')];var _0x4aa544=_0x2e0da4[_0x42bf10[_0x5665('0x6c')]];if(_[_0x5665('0x1d')](_0x4aa544)){_0x270bec({'ret':0x1});}else{var _0x207023=_0x4aa544[_0x5665('0x6d')];var _0x335525=squel[_0x5665('0x2a')]()[_0x5665('0x3f')](_0x3f4777)[_0x5665('0x6e')]('id',_0x42bf10['id'])[_0x5665('0x6e')](_0x5665('0x6f'),_0x207023)[_0x5665('0x6e')](_0x5665('0x6c'),_0x42bf10[_0x5665('0x6c')])[_0x5665('0x3c')]();return db['sequelize'][_0x5665('0x60')](_0x335525)[_0x5665('0x61')](function(_0x8de282){_0x270bec({'ret':0x1});})[_0x5665('0x62')](function(_0xd3e5ff){logger['error'](_0xd3e5ff[_0x5665('0x5e')]);_0x1eba30({'ret':0x1});});}});}function handleTZQuery(_0x290573){logger[_0x5665('0x59')](_0x290573);return db[_0x5665('0x5f')]['query'](_0x290573)['spread'](function(_0x4f7585){})[_0x5665('0x62')](function(_0x414ecd){logger[_0x5665('0x63')](_0x414ecd[_0x5665('0x5e')]);});}function main(_0xb68b5b,_0x560952,_0x4ba645,_0x596617){logger['info'](_0x5665('0x70'),_0xb68b5b,JSON['stringify'](_0x560952));process[_0x5665('0x71')](_0x5665('0x72'));var _0x4d3597=_0x560952[_0x5665('0x73')];var _0xdb20ed=_['clone'](_0x4d3597);var _0x27b354=_0x560952[_0x5665('0x74')];var _0x31935c=path[_0x5665('0x34')](config[_0x5665('0x75')],'server/files/tmp',_0x27b354+_0x5665('0x76'));hasTZ=_[_0x5665('0x52')](_0x4d3597)[_0x5665('0x77')](_0x5665('0x6c'));var _0x497387=_[_0x5665('0x52')](_0x4d3597)[_0x5665('0x34')]();logger[_0x5665('0x59')](_0x5665('0x78'),_0x497387);db[_0x5665('0x79')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x5665('0x18')](function(_0x53c4c3){for(var _0x5f5c23=0x0;_0x5f5c23<_0x53c4c3['length'];_0x5f5c23++){if(_0x53c4c3[_0x5f5c23][_0x5665('0x7a')]in _0x4d3597){contactItemTypes[_0x5665('0x1a')](_0x53c4c3[_0x5f5c23]);delete _0xdb20ed[_0x53c4c3[_0x5f5c23][_0x5665('0x7a')]];hasAdditionalPhones=!![];}for(var _0x52baa0 in _0x4d3597){if(_0x53c4c3[_0x5f5c23][_0x5665('0x7a')]+_0x5665('0x7b')===_0x52baa0){phoneDescriptions[_0x5665('0x1a')]({'itemTypeId':_0x53c4c3[_0x5f5c23]['id'],'description':_0x52baa0});delete _0xdb20ed[_0x52baa0];}}}if(hasAdditionalPhones)_0xdb20ed[_0x5665('0x17')]='';var _0x281efa=_[_0x5665('0x52')](_0xdb20ed)['join']();logger[_0x5665('0x59')]('header',_0x281efa);fs[_0x5665('0x7c')](_0x31935c,_0x281efa+'\x0a');Papa['parse'](fs['createReadStream'](_0xb68b5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5db678,_0x1b7bf2){try{for(var _0x2cd418=0x0,_0x3a4e67=[];_0x2cd418<_0x5db678['data'][_0x5665('0x19')];_0x2cd418++){stats['rows']+=0x1;if(_0x5db678[_0x5665('0x5c')][_0x2cd418]){handleError(_0x5db678['data'][_0x2cd418],_0x5db678[_0x5665('0x5c')][_0x2cd418]);}else{var _0x486b4a=[];var _0x269ee0=[];var _0x5df6f2={};for(var _0x2cb079 in _0x4d3597){let _0x4eb66f=contactItemTypes[_0x5665('0x7d')](_0xac9499=>_0xac9499['name']===_0x2cb079);let _0x2f84e6=contactItemTypes[_0x5665('0x7d')](_0x3853a9=>_0x3853a9[_0x5665('0x7a')]+_0x5665('0x7b')===_0x2cb079);if(_[_0x5665('0x1d')](_0x4eb66f)&&_[_0x5665('0x1d')](_0x2f84e6)){if(_0x4d3597[_0x5665('0x7e')](_0x2cb079)){if(_0x5db678[_0x5665('0x7f')][_0x2cd418][_0x4d3597[_0x2cb079]]){var _0x19a374=_[_0x5665('0x80')](_0x5db678[_0x5665('0x7f')][_0x2cd418][_0x4d3597[_0x2cb079]][_0x5665('0x81')](/"/g,'\x27'));switch(_0x2cb079){case _0x5665('0x46'):var _0x38085c=moment(_0x19a374,_0x5665('0xc'),!![]);if(_0x38085c['isValid']()){_0x3a4e67['push']('\x22'+_0x19a374+'\x22');}else{_0x486b4a[_0x5665('0x1a')](_0x5665('0x82'));}break;case _0x5665('0x30'):var _0x5b19aa=parseInt(_0x19a374);_0x19a374=_['isNaN'](_0x5b19aa)||_0x5b19aa<0x0||_0x5b19aa>0x4?_0x596617?0x3:0x2:_0x5b19aa;_0x3a4e67['push']('\x22'+_0x19a374+'\x22');break;case _0x5665('0x31'):var _0x358da2=parseInt(_0x19a374);if(_[_0x5665('0x83')](_0x358da2)&&_[_0x5665('0x77')](_0x4ba645,_0x358da2)){_0x3a4e67[_0x5665('0x1a')]('\x22'+_0x358da2+'\x22');}else{_0x486b4a[_0x5665('0x1a')](_0x5665('0x84'));}break;case _0x5665('0x85'):if(isEmail(_0x19a374)){_0x3a4e67['push']('\x22'+_0x19a374+'\x22');}else{_0x486b4a[_0x5665('0x1a')](_0x5665('0x86'));}break;case _0x5665('0x87'):var _0x5057cf=moment(_0x19a374,_0x5665('0x88'),!![]);if(_0x5057cf[_0x5665('0x89')]()){_0x3a4e67['push']('\x22'+_0x19a374+'\x22');}else{_0x486b4a[_0x5665('0x1a')](_0x5665('0x8a'));}break;case _0x5665('0x6c'):var _0x152111=shared[_0x5665('0x6b')];var _0x561ccc=_0x152111[_0x19a374];if(!_[_0x5665('0x1d')](_0x561ccc)){var _0x8c225e=_0x561ccc[_0x5665('0x6d')];_0x3a4e67[_0x5665('0x1a')]('\x22'+_0x19a374+'\x22');_0x3a4e67[_0x5665('0x1a')]('\x22'+_0x8c225e+'\x22');}break;default:_0x3a4e67['push']('\x22'+_0x19a374+'\x22');}}else{switch(_0x2cb079){case _0x5665('0x8b'):case _0x5665('0x10'):_0x486b4a[_0x5665('0x1a')](_0x2cb079+_0x5665('0x8c'));break;default:_0x3a4e67[_0x5665('0x1a')]('\x22\x22');}}}}else{var _0x36922b='';if(!_[_0x5665('0x1d')](_0x4eb66f)){if(!_0x5df6f2[_0x5665('0x7e')](_0x4eb66f['id'])){if(!_[_0x5665('0x1d')](_0x5db678[_0x5665('0x7f')][_0x2cd418][_0x4d3597[_0x2cb079]])){var _0x19a374=_[_0x5665('0x80')](_0x5db678[_0x5665('0x7f')][_0x2cd418][_0x4d3597[_0x2cb079]][_0x5665('0x81')](/"/g,'\x27'));var _0x43aa1d=phoneDescriptions[_0x5665('0x7d')](_0x34dd1e=>_0x34dd1e['itemTypeId']===_0x4eb66f['id']);if(!_[_0x5665('0x1d')](_0x43aa1d)){var _0x2a39ac=_[_0x5665('0x80')](_0x5db678[_0x5665('0x7f')][_0x2cd418][_0x4d3597[_0x43aa1d[_0x5665('0x8d')]]][_0x5665('0x81')](/"/g,'\x27'));if(!_[_0x5665('0x1d')](_0x2a39ac))_0x19a374=_0x19a374+'§'+_0x2a39ac;}if(_0x36922b=='')_0x36922b=_0x19a374;else _0x36922b+='|'+_0x19a374;}_0x269ee0[_0x5665('0x1a')](_0x4eb66f['id']+':'+_0x36922b);_0x5df6f2[_0x4eb66f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3a4e67['push']('\x22'+_0x269ee0[_0x5665('0x34')](';')+'\x22');}if(_0x486b4a['length']){handleError(_0x5db678[_0x5665('0x7f')][_0x2cd418],{'code':_0x5665('0x8e'),'message':_0x486b4a[_0x5665('0x34')]()});}else{fs[_0x5665('0x8f')](_0x31935c,_0x3a4e67[_0x5665('0x34')]()+'\x0a');}_0x3a4e67=[];}if(!(stats[_0x5665('0x90')]%0xc8)){socket['emit'](_0x5665('0x91')+_0x27b354,stats);stats[_0x5665('0x5c')]=[];}}if(stopped){logger[_0x5665('0x59')]('Abort\x20parser');_0x1b7bf2[_0x5665('0x92')]();}}catch(_0x46f69f){handleError(_0x5db678[_0x5665('0x7f')][_0x2cd418],{'code':_0x5665('0x93'),'message':_0x46f69f[_0x5665('0x5e')]});logger[_0x5665('0x63')](_0x5665('0x94'),_0x46f69f['message']);}},'complete':function(){try{var _0x286804=[];var _0x1a29a8=[];var _0xf780cd=_0x5665('0x35');if(_0x560952[_0x5665('0x95')]&&_0x560952[_0x5665('0x95')][_0x5665('0x19')]){_0xf780cd=_0x5665('0x96')+_0x27b354;_0x286804[_0x5665('0x1a')](_0x5665('0x97')+_0xf780cd+_0x5665('0x98'));}tmp_campaigns='campaigns_'+_0x27b354;tmp_voice_queues='voice_queues_'+_0x27b354;_0x1a29a8[_0x5665('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x5665('0x99'));_0x1a29a8['push'](_0x5665('0x97')+tmp_voice_queues+_0x5665('0x99'));BPromise[_0x5665('0x9a')](_0x1a29a8,handleTZQuery)[_0x5665('0x18')](function(_0x12b274){updateTzCampaigns(_0x560952['ListId'])[_0x5665('0x18')](function(_0x50ad51){updateTzVoiceQueues(_0x560952[_0x5665('0x2e')])['then'](function(_0x10fe85){if(hasTZ)_0x281efa=_0x281efa[_0x5665('0x81')](_0x5665('0x6c'),'dialTimezone,utcOffset');var _0x5b6db2=util[_0x5665('0xb')](_0x5665('0x9b'),_0x31935c,_0xf780cd,_0x281efa,_0x560952[_0x5665('0x2e')],_0x560952[_0x5665('0x53')]||null,NOW,NOW);if(_[_0x5665('0x1d')](_0x4d3597[_0x5665('0x46')])){_0x5b6db2+=',\x20scheduledAt\x20=\x20NOW()';}_0x286804[_0x5665('0x1a')](_0x5b6db2);if(_0x560952[_0x5665('0x95')]&&_0x560952[_0x5665('0x95')][_0x5665('0x19')]){_0x286804['push'](insertCmContact(_0x560952[_0x5665('0x2e')],_0xf780cd,_0x560952[_0x5665('0x95')],_0x4d3597));_0x286804[_0x5665('0x1a')](_0x5665('0x9c')+_0xf780cd+';');}BPromise[_0x5665('0x9a')](_0x286804,handleQuery)[_0x5665('0x18')](function(_0x212426){BPromise['all']([handleAdditionalPhones()])[_0x5665('0x18')](function(){_0x286804=[];for(var _0x5c8383=0x0;_0x5c8383\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','length'];(function(_0x427a39,_0x49e362){var _0x1bf184=function(_0x24c4ed){while(--_0x24c4ed){_0x427a39['push'](_0x427a39['shift']());}};_0x1bf184(++_0x49e362);}(_0x576e,0xa4));var _0xe576=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x576e[_0xa8883];return _0x479426;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xe576('0x0'));var util=require('util');var BPromise=require(_0xe576('0x1'));var moment=require(_0xe576('0x2'));var squel=require('squel');var Redis=require(_0xe576('0x3'));var db=require(_0xe576('0x4'))['db'];var config=require(_0xe576('0x5'));var shared=require(_0xe576('0x6'));var logger=require(_0xe576('0x7'))('import');config[_0xe576('0x8')]=_['defaults'](config[_0xe576('0x8')],{'host':_0xe576('0x9'),'port':0x18eb});var socket=require(_0xe576('0xa'))(new Redis(config[_0xe576('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xe576('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xe576('0xc'));function isEmail(_0x295c85){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))*$/[_0xe576('0xd')](_0x295c85);}function selectNotIn(_0x2ab31b,_0x54f729,_0x43e5f1,_0x4439ce,_0x1b550f){return squel['select']()[_0xe576('0xe')](_0xe576('0xf'))['from'](_0x4439ce)[_0xe576('0x10')](_0x54f729,null,_0x54f729+_0xe576('0x11')+_0x4439ce+'.'+_0x43e5f1)['where'](_0x4439ce+'.'+_0x43e5f1+_0xe576('0x12')+_0x2ab31b+'.'+_0x43e5f1)[_0xe576('0x13')](_0x54f729+'.dialCheckDuplicateType\x20IN\x20('+_0x1b550f[_0xe576('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x39b4cb,_0x2f3bf7){promisesAdditionalPhones=[];return db[_0xe576('0x14')][_0xe576('0x15')]({'raw':!![],'attributes':['id',_0xe576('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xe576('0x17')](function(_0x1cca58){if(_0x1cca58!==null){var _0x2e04ca=[];for(var _0x17e60e=0x0;_0x17e60e<_0x1cca58[_0xe576('0x18')];_0x17e60e++){var _0x48eab6=_0x1cca58[_0x17e60e];_0x2e04ca[_0xe576('0x19')](insertAdditionalPhones(_0x48eab6));}}Promise[_0xe576('0x1a')](_0x2e04ca)[_0xe576('0x17')](function(){_0x39b4cb({'val':0x1});});});});}function insertAdditionalPhones(_0x4f3e8a){return new Promise(function(_0xabd7ab,_0x4fbd13){var _0x3badc1=_0x4f3e8a['AdditionalPhones'];var _0x30e5f8=_0x3badc1[_0xe576('0x1b')](';');var _0x31397c=[];orderBy=0x0;for(var _0x4ab5e7=0x0;_0x4ab5e7<_0x30e5f8[_0xe576('0x18')];_0x4ab5e7++){_0x31397c[_0xe576('0x19')](splitAdditionalPhone(_0x4f3e8a['id'],_0x30e5f8[_0x4ab5e7]));}Promise[_0xe576('0x1a')](_0x31397c)['then'](function(){_0xabd7ab({'val':_0x30e5f8[_0xe576('0x18')]});});});}function splitAdditionalPhone(_0x1de72c,_0x509fd4){return new Promise(function(_0x2c8779,_0x45acbd){var _0x26edb0=_0x509fd4[_0xe576('0x1b')](':');var _0x5d5fad=_0x26edb0[0x0];var _0x35e2a0=_0x26edb0[0x1];if(!_[_0xe576('0x1c')](_0x35e2a0)){var _0x44558f=_0x35e2a0['split']('|');var _0x4061cb=[];for(var _0x252706=0x0;_0x252706<_0x44558f[_0xe576('0x18')];_0x252706++){if(_0x44558f[_0x252706]!==''){var _0xe4af35=_[_0xe576('0x1d')](promisesAdditionalPhones,{'contactId':_0x1de72c,'phone':_0x44558f[_0x252706]});if(_0xe4af35[_0xe576('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xe576('0x19')]({'contactId':_0x1de72c,'contactTypeId':_0x5d5fad,'phone':_0x44558f[_0x252706],'orderBy':orderBy});}}}_0x2c8779({'ok':0x1});}else _0x2c8779({'res':0x0});});}function createAdditionalPhone(_0x31804d,_0x1a7f5a,_0x144d16,_0x68f461){var _0x43c608='';var _0x68cdad='';var _0x587283=_0x144d16[_0xe576('0x1b')]('§');_0x43c608=_0x587283[0x0];if(_0x587283[_0xe576('0x18')]==0x2)_0x68cdad=_0x587283[0x1];return new Promise(function(_0x63282f,_0xaab47e){return db[_0xe576('0x1e')][_0xe576('0x1f')]({'where':{'CmContactId':_0x31804d,'item':_0x43c608}})[_0xe576('0x17')](function(_0x28b9af){if(_0x28b9af){return db[_0xe576('0x1e')][_0xe576('0x20')]({'ItemTypeId':_0x1a7f5a,'description':_0x68cdad,'OrderBy':_0x68f461},{'where':{'CmContactId':_0x31804d,'item':_0x43c608}})['then'](function(_0x111042){_0x63282f({'res':'updated'});});}else{return db[_0xe576('0x1e')][_0xe576('0x21')]({'CmContactId':_0x31804d,'item':_0x43c608,'description':_0x68cdad,'ItemTypeId':_0x1a7f5a,'OrderBy':_0x68f461,'ItemClass':_0xe576('0x22')})[_0xe576('0x17')](function(_0x226c97){_0x63282f({'res':_0xe576('0x23')});});}});});}function insertCmHopper(_0xae245d,_0x583fcb,_0x572692,_0x5b7bcb,_0x3cc1f4){var _0x5a3fb0=[_0xe576('0x24'),_0xe576('0x25'),_0xe576('0x26'),'cm_contacts.ListId',_0x583fcb+'.'+_0x5b7bcb,_0xe576('0x27'),_0xe576('0x28'),'cm_contacts.priority',_0xe576('0x29'),'\x22'+_0x3cc1f4+'\x22'];return squel[_0xe576('0x2a')]()[_0xe576('0x2b')](_0xe576('0x2c'))[_0xe576('0x2d')]([_0xe576('0xf'),_0xe576('0x2e'),'ContactId',_0xe576('0x2f'),_0x5b7bcb,_0xe576('0x30'),'updatedAt',_0xe576('0x31'),_0xe576('0x32'),_0xe576('0x33')],squel['select']()['fields'](_0x5a3fb0)[_0xe576('0x34')](_0x583fcb)[_0xe576('0x10')](_0xe576('0x35'),null,_0xe576('0x36')+_0x583fcb+'.CmListId')[_0xe576('0x10')](_0x572692,null,_0x572692+_0xe576('0x11')+_0x583fcb+'.'+_0x5b7bcb)['where'](_0x583fcb+_0xe576('0x37'),_0xae245d)['where'](_0xe576('0x38'),NOW)[_0xe576('0x13')](_0xe576('0x39'),selectNotIn(_0x583fcb,_0x572692,_0x5b7bcb,_0xe576('0x2c'),[_0xe576('0x3a'),_0xe576('0x3b')]))[_0xe576('0x13')](_0xe576('0x39'),selectNotIn(_0x583fcb,_0x572692,_0x5b7bcb,'cm_hopper',[_0xe576('0x3a')])))[_0xe576('0x3c')]();}function insertCmHopperBlack(_0x4f13c4,_0x2da48d,_0x3358d9,_0x1c73f8){var _0x1fed10=['cm_contacts.phone','cm_contacts.id',_0xe576('0x3d'),_0x2da48d+'.'+_0x1c73f8,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0xe576('0x2d')](['phone',_0xe576('0x3e'),_0xe576('0x2f'),_0x1c73f8,_0xe576('0x30'),_0xe576('0x3f')],squel['select']()[_0xe576('0x40')](_0x1fed10)['from'](_0x2da48d)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2da48d+_0xe576('0x41'))[_0xe576('0x10')](_0x3358d9,null,_0x3358d9+'.id\x20=\x20'+_0x2da48d+'.'+_0x1c73f8)[_0xe576('0x13')](_0x2da48d+_0xe576('0x37'),_0x4f13c4)[_0xe576('0x13')](_0xe576('0x38'),NOW)[_0xe576('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe576('0x42')]()[_0xe576('0xe')]('phone')[_0xe576('0x34')](_0xe576('0x43'))[_0xe576('0x13')](_0xe576('0x44'),_0x4f13c4)[_0xe576('0x13')](_0x1c73f8+_0xe576('0x12')+_0x2da48d+'.'+_0x1c73f8)))['toString']();}function insertTzCmHopper(_0x3d9b65,_0x580b70,_0x3bc5b4,_0x5c27d1,_0x8f8abd,_0x26ac5e){var _0x57c10d=[_0xe576('0x24'),_0xe576('0x45')+_0x26ac5e+_0xe576('0x46'),_0xe576('0x26'),_0xe576('0x3d'),_0x580b70+'.'+_0x5c27d1,_0xe576('0x27'),_0xe576('0x28'),_0xe576('0x47'),_0xe576('0x29'),'\x22'+_0x8f8abd+'\x22'];var _0x584777=squel[_0xe576('0x2a')]()[_0xe576('0x2b')](_0xe576('0x2c'))['fromQuery']([_0xe576('0xf'),_0xe576('0x2e'),_0xe576('0x3e'),_0xe576('0x2f'),_0x5c27d1,_0xe576('0x30'),_0xe576('0x3f'),_0xe576('0x31'),_0xe576('0x32'),_0xe576('0x33')],squel[_0xe576('0x42')]()[_0xe576('0x40')](_0x57c10d)['from'](_0x580b70)[_0xe576('0x10')]('cm_contacts',null,_0xe576('0x36')+_0x580b70+_0xe576('0x41'))[_0xe576('0x10')](_0x3bc5b4,null,_0x3bc5b4+_0xe576('0x11')+_0x580b70+'.'+_0x5c27d1)['join'](_0x26ac5e,null,_0x26ac5e+'.id\x20=\x20'+_0x580b70+'.'+_0x5c27d1)[_0xe576('0x13')](_0x580b70+_0xe576('0x37'),_0x3d9b65)['where'](_0xe576('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x580b70,_0x3bc5b4,_0x5c27d1,_0xe576('0x2c'),[_0xe576('0x3a'),_0xe576('0x3b')]))[_0xe576('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x580b70,_0x3bc5b4,_0x5c27d1,_0xe576('0x2c'),['\x22always\x22'])))[_0xe576('0x3c')]();return _0x584777;}function insertTzCmHopperBlack(_0x4fff45,_0x44606f,_0x3d854e,_0x2f4742){var _0x5ef8e9=['cm_contacts.phone',_0xe576('0x26'),'cm_contacts.ListId',_0x44606f+'.'+_0x2f4742,_0xe576('0x27'),'cm_contacts.updatedAt'];return squel[_0xe576('0x2a')]()['into'](_0xe576('0x43'))[_0xe576('0x2d')]([_0xe576('0xf'),_0xe576('0x3e'),_0xe576('0x2f'),_0x2f4742,_0xe576('0x30'),'updatedAt'],squel[_0xe576('0x42')]()['fields'](_0x5ef8e9)['from'](_0x44606f)[_0xe576('0x10')]('cm_contacts',null,_0xe576('0x36')+_0x44606f+_0xe576('0x41'))[_0xe576('0x10')](_0x3d854e,null,_0x3d854e+_0xe576('0x11')+_0x44606f+'.'+_0x2f4742)[_0xe576('0x13')](_0x44606f+_0xe576('0x37'),_0x4fff45)[_0xe576('0x13')](_0xe576('0x38'),NOW)[_0xe576('0x13')](_0xe576('0x39'),squel[_0xe576('0x42')]()[_0xe576('0xe')](_0xe576('0xf'))[_0xe576('0x34')](_0xe576('0x43'))[_0xe576('0x13')](_0xe576('0x44'),_0x4fff45)[_0xe576('0x13')](_0x2f4742+_0xe576('0x12')+_0x44606f+'.'+_0x2f4742)))[_0xe576('0x3c')]();}function insertCmHopperAdditionalPhones(_0x2250f1){var _0x337ff7=[_0xe576('0x48'),_0xe576('0x49'),_0xe576('0x4a'),_0xe576('0x4b'),_0xe576('0x4c')];return squel['insert']()['into']('cm_hopper_additional_phones')[_0xe576('0x2d')]([_0xe576('0x4d'),'phone',_0xe576('0x4e'),_0xe576('0x30'),'updatedAt'],squel[_0xe576('0x42')]()[_0xe576('0x40')](_0x337ff7)['from']('cm_hopper')[_0xe576('0x10')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xe576('0x10')](_0xe576('0x4f'),null,_0xe576('0x50'))[_0xe576('0x13')](_0xe576('0x51'),_0x2250f1)[_0xe576('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xe576('0x3c')]();}function insertCmContact(_0x39b588,_0x3f35e8,_0x32c6bd,_0x299420){var _0x29b294=_[_0xe576('0x52')](_[_0xe576('0x53')](_0x299420),[_0xe576('0x2f'),_0xe576('0x54'),'createdAt',_0xe576('0x3f'),_0xe576('0x55')]);return squel['insert']()[_0xe576('0x2b')](_0xe576('0x35'))[_0xe576('0x2d')](_0x29b294,squel['select']()[_0xe576('0x40')](_0x29b294)['from'](_0x3f35e8)['where']('('+_0x32c6bd[_0xe576('0x10')](',')+_0xe576('0x56'),squel['select']()[_0xe576('0x40')](_0x32c6bd)[_0xe576('0x34')](_0xe576('0x35'))[_0xe576('0x13')](_0xe576('0x44'),_0x39b588)[_0xe576('0x13')](_0xe576('0x57')))[_0xe576('0x13')](_0xe576('0x58'),squel[_0xe576('0x42')]()['field'](_0xe576('0x59'),_0xe576('0x5a'))[_0xe576('0x34')](_0x3f35e8)[_0xe576('0x5b')](_0x32c6bd[_0xe576('0x10')](','))))[_0xe576('0x3c')]();}function handleStop(){logger[_0xe576('0x5c')](_0xe576('0x5d'));stopped=!![];}function handleUncaughtException(_0x5652d6){logger[_0xe576('0x5e')](_0x5652d6[_0xe576('0x5f')]);process['exit'](0x1);}function handleError(_0x245dd9,_0x472baa){stats[_0xe576('0x60')][_0xe576('0x19')]({'name':_0x472baa[_0xe576('0x61')],'message':_0x472baa['message'],'row':_0x245dd9});}function handleQuery(_0x5758c0){logger[_0xe576('0x5c')](_0x5758c0);return db[_0xe576('0x62')][_0xe576('0x63')](_0x5758c0)[_0xe576('0x64')](function(_0xd87f89){results[_0xe576('0x19')](_0xd87f89);})[_0xe576('0x65')](function(_0x29e64d){logger['error'](_0x29e64d['message']);});}function updateTzCampaigns(_0x3ea069){return new Promise(function(_0x22e385,_0x2d9327){var _0xea24af=squel['select']()[_0xe576('0x40')]([_0xe576('0x66'),_0xe576('0x67')])['from'](_0xe576('0x68'))[_0xe576('0x10')](_0xe576('0x69'),null,_0xe576('0x6a'))[_0xe576('0x13')]('campaigns_has_cm_lists.CmListId='+_0x3ea069);db[_0xe576('0x62')][_0xe576('0x63')](_0xea24af[_0xe576('0x3c')]())[_0xe576('0x64')](function(_0x206c01){var _0x31beb3=[];for(var _0x20cf43=0x0;_0x20cf43<_0x206c01[_0xe576('0x18')];_0x20cf43++){_0x31beb3[_0xe576('0x19')](getTimezoneData(_0x206c01[_0x20cf43],tmp_campaigns));}BPromise[_0xe576('0x1a')](_0x31beb3)[_0xe576('0x17')](function(){_0x22e385({'val':0x1});});})[_0xe576('0x65')](function(_0x3a1df6){logger[_0xe576('0x5e')](_0x3a1df6[_0xe576('0x5f')]);_0x22e385({'val':0x0});});});}function updateTzVoiceQueues(_0x5253b8){return new Promise(function(_0x365119,_0x32632c){var _0x3d58c7=squel[_0xe576('0x42')]()[_0xe576('0x40')]([_0xe576('0x6b'),_0xe576('0x6c')])[_0xe576('0x34')]('voice_queues')[_0xe576('0x10')](_0xe576('0x6d'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xe576('0x6e')+_0x5253b8);db[_0xe576('0x62')][_0xe576('0x63')](_0x3d58c7['toString']())[_0xe576('0x64')](function(_0x397e45){var _0x3f93aa=[];for(var _0x37723a=0x0;_0x37723a<_0x397e45[_0xe576('0x18')];_0x37723a++){_0x3f93aa[_0xe576('0x19')](getTimezoneData(_0x397e45[_0x37723a],tmp_voice_queues));}BPromise[_0xe576('0x1a')](_0x3f93aa)['then'](function(){_0x365119({'val':0x1});});})[_0xe576('0x65')](function(_0x30f795){logger['error'](_0x30f795[_0xe576('0x5f')]);_0x365119({'val':0x0});});});}function getTimezoneData(_0x1624ba,_0x42b07e){return new Promise(function(_0xa8fe37,_0x10fc73){var _0x247146=shared[_0xe576('0x6f')];var _0x53bd94=_0x247146[_0x1624ba[_0xe576('0x70')]];if(_[_0xe576('0x1c')](_0x53bd94)){_0xa8fe37({'ret':0x1});}else{var _0x200470=_0x53bd94[_0xe576('0x71')];var _0x2a7b78=squel['insert']()['into'](_0x42b07e)[_0xe576('0x72')]('id',_0x1624ba['id'])[_0xe576('0x72')](_0xe576('0x73'),_0x200470)['set'](_0xe576('0x70'),_0x1624ba[_0xe576('0x70')])[_0xe576('0x3c')]();return db['sequelize'][_0xe576('0x63')](_0x2a7b78)['spread'](function(_0x3c0c55){_0xa8fe37({'ret':0x1});})[_0xe576('0x65')](function(_0x38a44b){logger[_0xe576('0x5e')](_0x38a44b[_0xe576('0x5f')]);_0x10fc73({'ret':0x1});});}});}function handleTZQuery(_0x472da0){logger[_0xe576('0x5c')](_0x472da0);return db[_0xe576('0x62')][_0xe576('0x63')](_0x472da0)[_0xe576('0x64')](function(_0x357c74){})[_0xe576('0x65')](function(_0x2f1fc3){logger[_0xe576('0x5e')](_0x2f1fc3['message']);});}function main(_0x3ae93b,_0x2e72f3,_0x34d1b8,_0x491bca){logger[_0xe576('0x5c')]('main',_0x3ae93b,JSON[_0xe576('0x74')](_0x2e72f3));process[_0xe576('0x75')](_0xe576('0x76'));var _0x147928=_0x2e72f3[_0xe576('0x77')];var _0x325604=_[_0xe576('0x78')](_0x147928);var _0x2b97f4=_0x2e72f3[_0xe576('0x79')];var _0x1b9916=path[_0xe576('0x10')](config['root'],_0xe576('0x7a'),_0x2b97f4+_0xe576('0x7b'));hasTZ=_[_0xe576('0x53')](_0x147928)['includes'](_0xe576('0x70'));var _0x49f4a0=_['keys'](_0x147928)['join']();logger['info']('header',_0x49f4a0);db[_0xe576('0x7c')][_0xe576('0x15')]({'raw':!![],'attributes':['id',_0xe576('0x7d')]})['then'](function(_0x6896fd){for(var _0x115694=0x0;_0x115694<_0x6896fd[_0xe576('0x18')];_0x115694++){if(_0x6896fd[_0x115694][_0xe576('0x7d')]in _0x147928){contactItemTypes[_0xe576('0x19')](_0x6896fd[_0x115694]);delete _0x325604[_0x6896fd[_0x115694]['name']];hasAdditionalPhones=!![];}for(var _0x2a63d9 in _0x147928){if(_0x6896fd[_0x115694][_0xe576('0x7d')]+_0xe576('0x7e')===_0x2a63d9){phoneDescriptions[_0xe576('0x19')]({'itemTypeId':_0x6896fd[_0x115694]['id'],'description':_0x2a63d9});delete _0x325604[_0x2a63d9];}}}if(hasAdditionalPhones)_0x325604['AdditionalPhones']='';var _0x4b1747=_[_0xe576('0x53')](_0x325604)['join']();logger[_0xe576('0x5c')]('header',_0x4b1747);fs[_0xe576('0x7f')](_0x1b9916,_0x4b1747+'\x0a');Papa[_0xe576('0x80')](fs[_0xe576('0x81')](_0x3ae93b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1276a0,_0x4c744f){try{for(var _0x3f06d8=0x0,_0x56cafb=[];_0x3f06d8<_0x1276a0[_0xe576('0x82')][_0xe576('0x18')];_0x3f06d8++){stats['rows']+=0x1;if(_0x1276a0[_0xe576('0x60')][_0x3f06d8]){handleError(_0x1276a0[_0xe576('0x82')][_0x3f06d8],_0x1276a0[_0xe576('0x60')][_0x3f06d8]);}else{var _0x334082=[];var _0x20400c=[];var _0x1ade27={};for(var _0x544018 in _0x147928){let _0x39194b=contactItemTypes['find'](_0x1242cf=>_0x1242cf[_0xe576('0x7d')]===_0x544018);let _0x10979b=contactItemTypes['find'](_0x4dc3e6=>_0x4dc3e6['name']+'_description'===_0x544018);if(_['isNil'](_0x39194b)&&_[_0xe576('0x1c')](_0x10979b)){if(_0x147928[_0xe576('0x83')](_0x544018)){if(_0x1276a0['data'][_0x3f06d8][_0x147928[_0x544018]]){var _0x2f0947=_['trim'](_0x1276a0['data'][_0x3f06d8][_0x147928[_0x544018]][_0xe576('0x84')](/"/g,'\x27'));switch(_0x544018){case _0xe576('0x2e'):var _0x133109=moment(_0x2f0947,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x133109[_0xe576('0x85')]()){_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');}else{_0x334082[_0xe576('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe576('0x31'):var _0x2e8951=parseInt(_0x2f0947);_0x2f0947=_[_0xe576('0x86')](_0x2e8951)||_0x2e8951<0x0||_0x2e8951>0x4?_0x491bca?0x3:0x2:_0x2e8951;_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');break;case _0xe576('0x32'):var _0x3fdc2e=parseInt(_0x2f0947);if(_[_0xe576('0x87')](_0x3fdc2e)&&_[_0xe576('0x88')](_0x34d1b8,_0x3fdc2e)){_0x56cafb[_0xe576('0x19')]('\x22'+_0x3fdc2e+'\x22');}else{_0x334082['push'](_0xe576('0x89'));}break;case _0xe576('0x8a'):if(isEmail(_0x2f0947)){_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');}else{_0x334082[_0xe576('0x19')](_0xe576('0x8b'));}break;case'dateOfBirth':var _0x1abe0b=moment(_0x2f0947,_0xe576('0x8c'),!![]);if(_0x1abe0b[_0xe576('0x85')]()){_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');}else{_0x334082[_0xe576('0x19')](_0xe576('0x8d'));}break;case'dialTimezone':var _0x38d3ab=shared[_0xe576('0x6f')];var _0x927e0a=_0x38d3ab[_0x2f0947];if(!_[_0xe576('0x1c')](_0x927e0a)){var _0x227bbc=_0x927e0a[_0xe576('0x71')];_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');_0x56cafb[_0xe576('0x19')]('\x22'+_0x227bbc+'\x22');}break;default:_0x56cafb[_0xe576('0x19')]('\x22'+_0x2f0947+'\x22');}}else{switch(_0x544018){case _0xe576('0x8e'):case'phone':_0x334082[_0xe576('0x19')](_0x544018+_0xe576('0x8f'));break;default:_0x56cafb['push']('\x22\x22');}}}}else{var _0x53f88f='';if(!_[_0xe576('0x1c')](_0x39194b)){if(!_0x1ade27['hasOwnProperty'](_0x39194b['id'])){if(!_[_0xe576('0x1c')](_0x1276a0[_0xe576('0x82')][_0x3f06d8][_0x147928[_0x544018]])){var _0x2f0947=_[_0xe576('0x90')](_0x1276a0[_0xe576('0x82')][_0x3f06d8][_0x147928[_0x544018]]['replace'](/"/g,'\x27'));var _0x5cf3e0=phoneDescriptions[_0xe576('0x91')](_0x67e59f=>_0x67e59f[_0xe576('0x92')]===_0x39194b['id']);if(!_['isNil'](_0x5cf3e0)){var _0x429cee=_['trim'](_0x1276a0[_0xe576('0x82')][_0x3f06d8][_0x147928[_0x5cf3e0['description']]][_0xe576('0x84')](/"/g,'\x27'));if(!_[_0xe576('0x1c')](_0x429cee))_0x2f0947=_0x2f0947+'§'+_0x429cee;}if(_0x53f88f=='')_0x53f88f=_0x2f0947;else _0x53f88f+='|'+_0x2f0947;}_0x20400c[_0xe576('0x19')](_0x39194b['id']+':'+_0x53f88f);_0x1ade27[_0x39194b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56cafb['push']('\x22'+_0x20400c[_0xe576('0x10')](';')+'\x22');}if(_0x334082['length']){handleError(_0x1276a0[_0xe576('0x82')][_0x3f06d8],{'code':'SystemRow','message':_0x334082[_0xe576('0x10')]()});}else{fs[_0xe576('0x93')](_0x1b9916,_0x56cafb[_0xe576('0x10')]()+'\x0a');}_0x56cafb=[];}if(!(stats['rows']%0xc8)){socket[_0xe576('0x94')](_0xe576('0x95')+_0x2b97f4,stats);stats[_0xe576('0x60')]=[];}}if(stopped){logger[_0xe576('0x5c')](_0xe576('0x96'));_0x4c744f[_0xe576('0x97')]();}}catch(_0x23c5f4){handleError(_0x1276a0['data'][_0x3f06d8],{'code':'SystemError','message':_0x23c5f4[_0xe576('0x5f')]});logger['error'](_0xe576('0x98'),_0x23c5f4[_0xe576('0x5f')]);}},'complete':function(){try{var _0x11bb52=[];var _0x2ba33b=[];var _0x4e77f1=_0xe576('0x35');if(_0x2e72f3['duplicates']&&_0x2e72f3['duplicates'][_0xe576('0x18')]){_0x4e77f1='cm_contacts_'+_0x2b97f4;_0x11bb52[_0xe576('0x19')](_0xe576('0x99')+_0x4e77f1+_0xe576('0x9a'));}tmp_campaigns=_0xe576('0x9b')+_0x2b97f4;tmp_voice_queues=_0xe576('0x9c')+_0x2b97f4;_0x2ba33b[_0xe576('0x19')](_0xe576('0x99')+tmp_campaigns+_0xe576('0x9d'));_0x2ba33b['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xe576('0x9d'));BPromise[_0xe576('0x9e')](_0x2ba33b,handleTZQuery)['then'](function(_0x48d02f){updateTzCampaigns(_0x2e72f3[_0xe576('0x2f')])[_0xe576('0x17')](function(_0x4e2f1e){updateTzVoiceQueues(_0x2e72f3['ListId'])['then'](function(_0x2f9526){if(hasTZ)_0x4b1747=_0x4b1747[_0xe576('0x84')](_0xe576('0x70'),'dialTimezone,utcOffset');var _0x4ff80b=util[_0xe576('0xb')](_0xe576('0x9f'),_0x1b9916,_0x4e77f1,_0x4b1747,_0x2e72f3['ListId'],_0x2e72f3[_0xe576('0x54')]||null,NOW,NOW);if(_[_0xe576('0x1c')](_0x147928[_0xe576('0x2e')])){_0x4ff80b+=_0xe576('0xa0');}_0x11bb52[_0xe576('0x19')](_0x4ff80b);if(_0x2e72f3['duplicates']&&_0x2e72f3[_0xe576('0xa1')][_0xe576('0x18')]){_0x11bb52[_0xe576('0x19')](insertCmContact(_0x2e72f3[_0xe576('0x2f')],_0x4e77f1,_0x2e72f3['duplicates'],_0x147928));_0x11bb52[_0xe576('0x19')](_0xe576('0xa2')+_0x4e77f1+';');}BPromise[_0xe576('0x9e')](_0x11bb52,handleQuery)[_0xe576('0x17')](function(_0x738176){BPromise[_0xe576('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x11bb52=[];for(var _0x47f422=0x0;_0x47f422\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','where','.dialCheckDuplicateType\x20IN\x20(','join','query','spread','length','isNil','phone','AdditionalPhones','push','all','error','split','filter','CmContactHasItem','findOne','then','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_hopper_black','.CmListId','ListId\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','message','errors','sequelize','catch','main','send','clone','root','server/files/tmp','.csv','ContactItemType'];(function(_0x1951fd,_0x2a91df){var _0xe45e33=function(_0x367672){while(--_0x367672){_0x1951fd['push'](_0x1951fd['shift']());}};_0xe45e33(++_0x2a91df);}(_0xc434,0x16b));var _0x4c43=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xc434[_0x2aec52];return _0x3b8835;};'use strict';var fs=require('fs');var path=require(_0x4c43('0x0'));var _=require(_0x4c43('0x1'));var Papa=require(_0x4c43('0x2'));var util=require(_0x4c43('0x3'));var BPromise=require(_0x4c43('0x4'));var moment=require(_0x4c43('0x5'));var squel=require(_0x4c43('0x6'));var Redis=require(_0x4c43('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x4c43('0x8'));var logger=require(_0x4c43('0x9'))(_0x4c43('0xa'));config[_0x4c43('0xb')]=_[_0x4c43('0xc')](config[_0x4c43('0xb')],{'host':_0x4c43('0xd'),'port':0x18eb});var socket=require(_0x4c43('0xe'))(new Redis(config[_0x4c43('0xb')]));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()[_0x4c43('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x4c43('0x10')+moment()[_0x4c43('0xf')](_0x4c43('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4fb2fc){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))*$/[_0x4c43('0x12')](_0x4fb2fc);}function selectNotIn(_0x23b930,_0x223cf0,_0x2115ae,_0x26eee2,_0x39acf3){return squel[_0x4c43('0x13')]()[_0x4c43('0x14')]('phone')[_0x4c43('0x15')](_0x26eee2)['join'](_0x223cf0,null,_0x223cf0+'.id\x20=\x20'+_0x26eee2+'.'+_0x2115ae)[_0x4c43('0x16')](_0x26eee2+'.'+_0x2115ae+'\x20=\x20'+_0x23b930+'.'+_0x2115ae)[_0x4c43('0x16')](_0x223cf0+_0x4c43('0x17')+_0x39acf3[_0x4c43('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x35fac6,_0x2ff9ad){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x4c43('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0x4c43('0x1a')](function(_0x2c75a0){if(_0x2c75a0!==null){var _0xd93120=[];for(var _0x23d4a2=0x0;_0x23d4a2<_0x2c75a0[_0x4c43('0x1b')];_0x23d4a2++){var _0x467967=_0x2c75a0[_0x23d4a2];if(!_[_0x4c43('0x1c')](_0x467967[_0x4c43('0x1d')])){if(!_[_0x4c43('0x1c')](_0x467967[_0x4c43('0x1e')]))_0xd93120[_0x4c43('0x1f')](insertAdditionalPhones(_0x467967));promisesContact[_0x4c43('0x1f')]({'contact':_0x467967});}}}Promise[_0x4c43('0x20')](_0xd93120)['then'](function(){_0x35fac6({'val':0x1});});})['catch'](function(_0x53f51d){logger[_0x4c43('0x21')](_0x53f51d['message']);});});}function insertAdditionalPhones(_0x7650d6){return new Promise(function(_0x104c6a,_0x5e5fb0){var _0x123c90=_0x7650d6['AdditionalPhones'];if(_['isNil'](_0x123c90))_0x5e5fb0({'val':0x0});else{var _0x1d6a86=_0x123c90['split'](';');var _0x276c2c=[];orderBy=0x0;for(var _0x5e1f35=0x0;_0x5e1f35<_0x1d6a86[_0x4c43('0x1b')];_0x5e1f35++){_0x276c2c[_0x4c43('0x1f')](splitAdditionalPhone(_0x7650d6['id'],_0x1d6a86[_0x5e1f35]));}Promise[_0x4c43('0x20')](_0x276c2c)['then'](function(){_0x104c6a({'val':_0x1d6a86[_0x4c43('0x1b')]});});}});}function splitAdditionalPhone(_0x3955da,_0xe31a9d){return new Promise(function(_0x3c264f,_0x15f70f){var _0x52b986=_0xe31a9d[_0x4c43('0x22')](':');var _0x436b1b=_0x52b986[0x0];var _0x1fd224=_0x52b986[0x1];if(_0x1fd224!==''){var _0x355cf9=_0x1fd224[_0x4c43('0x22')]('|');var _0x11d286=[];for(var _0x59671d=0x0;_0x59671d<_0x355cf9[_0x4c43('0x1b')];_0x59671d++){if(_0x355cf9[_0x59671d]!==''){var _0x2c08bf=_[_0x4c43('0x23')](promisesAdditionalPhones,{'contactId':_0x3955da,'phone':_0x355cf9[_0x59671d]});if(_0x2c08bf[_0x4c43('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3955da,'contactTypeId':_0x436b1b,'phone':_0x355cf9[_0x59671d],'orderBy':orderBy});}}}_0x3c264f({'ok':0x1});}else _0x3c264f({'res':0x0});});}function createAdditionalPhone(_0x355ead,_0xebf5ae,_0x31b97f,_0x3a36f0){var _0x2f0533='';var _0x38c31a='';var _0x5423be=_0x31b97f[_0x4c43('0x22')]('§');_0x2f0533=_0x5423be[0x0];if(_0x5423be[_0x4c43('0x1b')]==0x2)_0x38c31a=_0x5423be[0x1];return new Promise(function(_0x3ca787,_0x1409de){return db[_0x4c43('0x24')][_0x4c43('0x25')]({'where':{'CmContactId':_0x355ead,'item':_0x2f0533}})[_0x4c43('0x26')](function(_0x1cee04){if(_0x1cee04){return db['CmContactHasItem'][_0x4c43('0x27')]({'ItemTypeId':_0xebf5ae,'description':_0x38c31a,'OrderBy':_0x3a36f0},{'where':{'CmContactId':_0x355ead,'item':_0x2f0533}})[_0x4c43('0x26')](function(_0xccca4d){_0x3ca787({'res':_0x4c43('0x28')});});}else{return db[_0x4c43('0x24')][_0x4c43('0x29')]({'CmContactId':_0x355ead,'item':_0x2f0533,'ItemTypeId':_0xebf5ae,'description':_0x38c31a,'OrderBy':_0x3a36f0,'ItemClass':_0x4c43('0x2a')})[_0x4c43('0x26')](function(_0x4b73da){_0x3ca787({'res':_0x4c43('0x2b')});});}});});}function updateContact(_0x2e64a3){return new Promise(function(_0x62cfa3,_0x51f714){var _0x4ffe54=_0x2e64a3['id'];delete _0x2e64a3['id'];return db['CmContact']['update'](_0x2e64a3,{'where':{'id':_0x4ffe54}})['then'](function(_0x4929b4){updatedRows+=0x1;return db[_0x4c43('0x2c')]['update']({'phone':_0x2e64a3['phone']},{'where':{'ContactId':_0x4ffe54}})['then'](function(_0x4390f9){_0x62cfa3({'ret':'OK'});});});});}function insertCmHopper(_0x2be4f1,_0x10b199,_0x2a3f59,_0x24633c,_0x262940){var _0x129152=[_0x4c43('0x2d'),_0x4c43('0x2e'),'cm_contacts.id',_0x4c43('0x2f'),_0x10b199+'.'+_0x24633c,'cm_contacts.createdAt',_0x4c43('0x30'),'cm_contacts.priority',_0x4c43('0x31'),'\x22'+_0x262940+'\x22'];return squel[_0x4c43('0x32')]()[_0x4c43('0x33')](_0x4c43('0x34'))[_0x4c43('0x35')]([_0x4c43('0x1d'),_0x4c43('0x36'),_0x4c43('0x37'),_0x4c43('0x38'),_0x24633c,_0x4c43('0x39'),_0x4c43('0x3a'),_0x4c43('0x3b'),_0x4c43('0x3c'),_0x4c43('0x3d')],squel[_0x4c43('0x13')]()[_0x4c43('0x3e')](_0x129152)[_0x4c43('0x15')](_0x10b199)[_0x4c43('0x18')](_0x4c43('0x3f'),null,_0x4c43('0x40')+_0x10b199+'.CmListId')[_0x4c43('0x18')](_0x2a3f59,null,_0x2a3f59+_0x4c43('0x41')+_0x10b199+'.'+_0x24633c)[_0x4c43('0x16')](_0x10b199+_0x4c43('0x42'),_0x2be4f1)[_0x4c43('0x16')](_0x4c43('0x43'),NOW)[_0x4c43('0x16')](_0x4c43('0x44'),selectNotIn(_0x10b199,_0x2a3f59,_0x24633c,_0x4c43('0x34'),[_0x4c43('0x45'),_0x4c43('0x46')]))['where'](_0x4c43('0x44'),selectNotIn(_0x10b199,_0x2a3f59,_0x24633c,_0x4c43('0x34'),[_0x4c43('0x45')])))['toString']();}function insertCmHopperBlack(_0x51a498,_0x98fdc4,_0x3747bf,_0x55c9a4){var _0x46dd85=['cm_contacts.phone','cm_contacts.id',_0x4c43('0x2f'),_0x98fdc4+'.'+_0x55c9a4,_0x4c43('0x47'),_0x4c43('0x30')];return squel[_0x4c43('0x32')]()[_0x4c43('0x33')](_0x4c43('0x48'))[_0x4c43('0x35')](['phone',_0x4c43('0x37'),_0x4c43('0x38'),_0x55c9a4,'createdAt',_0x4c43('0x3a')],squel[_0x4c43('0x13')]()[_0x4c43('0x3e')](_0x46dd85)[_0x4c43('0x15')](_0x98fdc4)['join'](_0x4c43('0x3f'),null,_0x4c43('0x40')+_0x98fdc4+_0x4c43('0x49'))[_0x4c43('0x18')](_0x3747bf,null,_0x3747bf+'.id\x20=\x20'+_0x98fdc4+'.'+_0x55c9a4)[_0x4c43('0x16')](_0x98fdc4+_0x4c43('0x42'),_0x51a498)['where'](_0x4c43('0x43'),NOW)[_0x4c43('0x16')](_0x4c43('0x44'),squel[_0x4c43('0x13')]()[_0x4c43('0x14')]('phone')[_0x4c43('0x15')](_0x4c43('0x48'))['where'](_0x4c43('0x4a'),_0x51a498)[_0x4c43('0x16')](_0x55c9a4+'\x20=\x20?',_0x98fdc4+'.'+_0x55c9a4)))[_0x4c43('0x4b')]();}function insertCmHopperAdditionalPhones(_0x1dc193){var _0x5a5db1=['cm_hopper.id',_0x4c43('0x4c'),'cm_contact_has_items.OrderBy',_0x4c43('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0x4c43('0x32')]()[_0x4c43('0x33')]('cm_hopper_additional_phones')[_0x4c43('0x35')]([_0x4c43('0x4e'),_0x4c43('0x1d'),_0x4c43('0x4f'),_0x4c43('0x39'),_0x4c43('0x3a')],squel['select']()[_0x4c43('0x3e')](_0x5a5db1)['from'](_0x4c43('0x34'))[_0x4c43('0x18')](_0x4c43('0x3f'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x4c43('0x18')](_0x4c43('0x50'),null,_0x4c43('0x51'))[_0x4c43('0x16')](_0x4c43('0x52'),_0x1dc193)[_0x4c43('0x16')](_0x4c43('0x43'),NOW))['toString']();}function insertCmContact(_0x58a70a,_0x21d590,_0x32a3eb,_0xbf4524){var _0x2ecd44=_[_0x4c43('0x53')](_[_0x4c43('0x54')](_0xbf4524),[_0x4c43('0x38'),_0x4c43('0x55'),'createdAt','updatedAt']);return squel[_0x4c43('0x32')]()[_0x4c43('0x33')]('cm_contacts')['fromQuery'](_0x2ecd44,squel['select']()[_0x4c43('0x3e')](_0x2ecd44)[_0x4c43('0x15')](_0x21d590)[_0x4c43('0x16')]('('+_0x32a3eb[_0x4c43('0x18')](',')+_0x4c43('0x56'),squel[_0x4c43('0x13')]()[_0x4c43('0x3e')](_0x32a3eb)[_0x4c43('0x15')]('cm_contacts')[_0x4c43('0x16')]('ListId\x20=\x20?',_0x58a70a))[_0x4c43('0x16')]('id\x20IN\x20?',squel[_0x4c43('0x13')]()[_0x4c43('0x14')](_0x4c43('0x57'),_0x4c43('0x58'))['from'](_0x21d590)[_0x4c43('0x59')](_0x32a3eb[_0x4c43('0x18')](','))))[_0x4c43('0x4b')]();}function handleStop(){logger[_0x4c43('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5337ce){logger[_0x4c43('0x21')](_0x5337ce[_0x4c43('0x5b')]);process['exit'](0x1);}function handleError(_0x3e65d9,_0x4b98e4){stats[_0x4c43('0x5c')]['push']({'name':_0x4b98e4['code'],'message':_0x4b98e4[_0x4c43('0x5b')],'row':_0x3e65d9});}function handleQuery(_0x13c8d5){logger['info'](_0x13c8d5);return db[_0x4c43('0x5d')][_0x4c43('0x19')](_0x13c8d5)['spread'](function(_0x109871){results[_0x4c43('0x1f')](_0x109871);})[_0x4c43('0x5e')](function(_0x11cbb1){logger[_0x4c43('0x21')](_0x11cbb1[_0x4c43('0x5b')]);});}function main(_0xe358b5,_0x37776e,_0x35f4b3,_0x312a3c){logger[_0x4c43('0x5a')](_0x4c43('0x5f'),_0xe358b5,JSON['stringify'](_0x37776e));process[_0x4c43('0x60')]('start');var _0x37ac7b=_0x37776e['binding'];var _0xe9e745=_[_0x4c43('0x61')](_0x37ac7b);var _0x53c02b=_0x37776e['socket_timestamp'];var _0x2dc326=path[_0x4c43('0x18')](config[_0x4c43('0x62')],_0x4c43('0x63'),_0x53c02b+_0x4c43('0x64'));logger[_0x4c43('0x5a')]('body',_0x37776e);db[_0x4c43('0x65')][_0x4c43('0x66')]({'raw':!![],'attributes':['id',_0x4c43('0x67')]})[_0x4c43('0x26')](function(_0x421084){for(var _0x19f525=0x0;_0x19f525<_0x421084['length'];_0x19f525++){if(_0x421084[_0x19f525][_0x4c43('0x67')]in _0x37ac7b){contactItemTypes[_0x4c43('0x1f')](_0x421084[_0x19f525]);delete _0xe9e745[_0x421084[_0x19f525][_0x4c43('0x67')]];hasAdditionalPhones=!![];}for(var _0x4fec8c in _0x37ac7b){if(_0x421084[_0x19f525]['name']+_0x4c43('0x68')===_0x4fec8c){phoneDescriptions[_0x4c43('0x1f')]({'itemTypeId':_0x421084[_0x19f525]['id'],'description':_0x4fec8c});delete _0xe9e745[_0x4fec8c];}}}if(hasAdditionalPhones)_0xe9e745['AdditionalPhones']='';var _0x54ec1b=_['keys'](_0xe9e745)[_0x4c43('0x18')]();logger[_0x4c43('0x5a')]('header',_0x54ec1b);fs['writeFileSync'](_0x2dc326,_0x54ec1b+'\x0a');Papa[_0x4c43('0x69')](fs[_0x4c43('0x6a')](_0xe358b5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x44252b,_0x4821cf){try{for(var _0x1e2c7c=0x0,_0xea7e4=[];_0x1e2c7c<_0x44252b['data'][_0x4c43('0x1b')];_0x1e2c7c++){stats[_0x4c43('0x6b')]+=0x1;if(_0x44252b[_0x4c43('0x5c')][_0x1e2c7c]){handleError(_0x44252b['data'][_0x1e2c7c],_0x44252b[_0x4c43('0x5c')][_0x1e2c7c]);}else{var _0x926a37=[];var _0x4be428=[];var _0x4dfaaf={};for(var _0x2ea10a in _0x37ac7b){let _0x4f5fbd=contactItemTypes[_0x4c43('0x6c')](_0x4e03df=>_0x4e03df[_0x4c43('0x67')]===_0x2ea10a);let _0x15bed6=contactItemTypes[_0x4c43('0x6c')](_0x5ea664=>_0x5ea664[_0x4c43('0x67')]+_0x4c43('0x68')===_0x2ea10a);if(_[_0x4c43('0x1c')](_0x4f5fbd)&&_[_0x4c43('0x1c')](_0x15bed6)){if(_0x37ac7b['hasOwnProperty'](_0x2ea10a)){if(_0x44252b[_0x4c43('0x6d')][_0x1e2c7c][_0x37ac7b[_0x2ea10a]]){var _0x510755=_[_0x4c43('0x6e')](_0x44252b[_0x4c43('0x6d')][_0x1e2c7c][_0x37ac7b[_0x2ea10a]]['replace'](/"/g,'\x27'));switch(_0x2ea10a){case _0x4c43('0x36'):var _0xa6225f=moment(_0x510755,_0x4c43('0x6f'),!![]);if(_0xa6225f[_0x4c43('0x70')]()){_0xea7e4[_0x4c43('0x1f')]('\x22'+_0x510755+'\x22');}else{_0x926a37[_0x4c43('0x1f')](_0x4c43('0x71'));}break;case _0x4c43('0x3b'):var _0x30dffb=parseInt(_0x510755);_0x510755=_[_0x4c43('0x72')](_0x30dffb)||_0x30dffb<0x0||_0x30dffb>0x4?_0x312a3c?0x3:0x2:_0x30dffb;_0xea7e4['push']('\x22'+_0x510755+'\x22');break;case'UserId':var _0x1d3fc9=parseInt(_0x510755);if(_[_0x4c43('0x73')](_0x1d3fc9)&&_[_0x4c43('0x74')](_0x35f4b3,_0x1d3fc9)){_0xea7e4['push']('\x22'+_0x1d3fc9+'\x22');}else{_0x926a37[_0x4c43('0x1f')](_0x4c43('0x75'));}break;case _0x4c43('0x76'):if(isEmail(_0x510755)){_0xea7e4['push']('\x22'+_0x510755+'\x22');}else{_0x926a37[_0x4c43('0x1f')](_0x4c43('0x77'));}break;case _0x4c43('0x78'):var _0x52cd0b=moment(_0x510755,_0x4c43('0x79'),!![]);if(_0x52cd0b['isValid']()){_0xea7e4[_0x4c43('0x1f')]('\x22'+_0x510755+'\x22');}else{_0x926a37[_0x4c43('0x1f')](_0x4c43('0x7a'));}break;default:_0xea7e4[_0x4c43('0x1f')]('\x22'+_0x510755+'\x22');}}else{switch(_0x2ea10a){case'firstName':case _0x4c43('0x1d'):_0x926a37[_0x4c43('0x1f')](_0x2ea10a+_0x4c43('0x7b'));break;default:_0xea7e4[_0x4c43('0x1f')]('\x22\x22');}}}}else{var _0x45da3d='';if(!_[_0x4c43('0x1c')](_0x4f5fbd)){if(!_0x4dfaaf[_0x4c43('0x7c')](_0x4f5fbd['id'])){for(var _0x5c7d66=0x0;_0x5c7d66<_0x37ac7b[_0x2ea10a][_0x4c43('0x1b')];_0x5c7d66++){var _0x510755=_[_0x4c43('0x6e')](_0x44252b['data'][_0x1e2c7c][_0x37ac7b[_0x2ea10a][_0x5c7d66]][_0x4c43('0x7d')](/"/g,'\x27'));var _0x5dbac3=phoneDescriptions[_0x4c43('0x6c')](_0x4a1a55=>_0x4a1a55['itemTypeId']===_0x4f5fbd['id']);if(!_[_0x4c43('0x1c')](_0x5dbac3)){var _0xaf9989=_[_0x4c43('0x6e')](_0x44252b['data'][_0x1e2c7c][_0x37ac7b[_0x5dbac3[_0x4c43('0x7e')]][0x0]][_0x4c43('0x7d')](/"/g,'\x27'));if(!_[_0x4c43('0x1c')](_0xaf9989))_0x510755=_0x510755+'§'+_0xaf9989;}if(_0x45da3d=='')_0x45da3d=_0x510755;else _0x45da3d+='|'+_0x510755;}_0x4be428[_0x4c43('0x1f')](_0x4f5fbd['id']+':'+_0x45da3d);_0x4dfaaf[_0x4f5fbd['id']]=0x1;}}}}if(hasAdditionalPhones){_0xea7e4['push']('\x22'+_0x4be428['join'](';')+'\x22');}if(_0x926a37[_0x4c43('0x1b')]){handleError(_0x44252b['data'][_0x1e2c7c],{'code':_0x4c43('0x7f'),'message':_0x926a37[_0x4c43('0x18')]()});}else{fs[_0x4c43('0x80')](_0x2dc326,_0xea7e4[_0x4c43('0x18')]()+'\x0a');}_0xea7e4=[];}if(!(stats[_0x4c43('0x6b')]%0xc8)){socket[_0x4c43('0x81')]('contact:import:'+_0x53c02b,stats);stats[_0x4c43('0x5c')]=[];}}if(stopped){logger[_0x4c43('0x5a')](_0x4c43('0x82'));_0x4821cf['abort']();}}catch(_0x1727d8){handleError(_0x44252b[_0x4c43('0x6d')][_0x1e2c7c],{'code':_0x4c43('0x83'),'message':_0x1727d8[_0x4c43('0x5b')]});logger[_0x4c43('0x21')]('step',_0x1727d8[_0x4c43('0x5b')]);}},'complete':function(){try{var _0x4005ee=[];var _0x51fba6=tempTableName;_0x4005ee[_0x4c43('0x1f')](_0x4c43('0x84')+_0x51fba6+_0x4c43('0x85'));logger[_0x4c43('0x5a')](_0x4c43('0x86'),contactItemTypes['length']);var _0x354c06=util[_0x4c43('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2dc326,_0x51fba6,_0x54ec1b,_0x37776e[_0x4c43('0x38')],_0x37776e[_0x4c43('0x55')]||null,NOW,NOW);if(_['isNil'](_0x37ac7b[_0x4c43('0x36')])){_0x354c06+=_0x4c43('0x87');}_0x4005ee['push'](_0x354c06);BPromise[_0x4c43('0x88')](_0x4005ee,handleQuery)[_0x4c43('0x26')](function(_0x10cab2){BPromise[_0x4c43('0x20')]([handleAdditionalPhones()])[_0x4c43('0x26')](function(){_0x4005ee=[];for(var _0x2c3fe4=0x0;_0x2c3fe4\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','path','papaparse','util','bluebird','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xf108,0x1d9));var _0x8f10=function(_0x1b9c25,_0x1a05e1){_0x1b9c25=_0x1b9c25-0x0;var _0x34a3e6=_0xf108[_0x1b9c25];return _0x34a3e6;};'use strict';var fs=require('fs');var path=require(_0x8f10('0x0'));var _=require('lodash');var Papa=require(_0x8f10('0x1'));var util=require(_0x8f10('0x2'));var BPromise=require(_0x8f10('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x8f10('0x4'))['db'];var config=require(_0x8f10('0x5'));var logger=require(_0x8f10('0x6'))(_0x8f10('0x7'));config[_0x8f10('0x8')]=_[_0x8f10('0x9')](config[_0x8f10('0x8')],{'host':_0x8f10('0xa'),'port':0x18eb});var socket=require(_0x8f10('0xb'))(new Redis(config[_0x8f10('0x8')]));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()[_0x8f10('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x8f10('0xd')+moment()[_0x8f10('0xc')](_0x8f10('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1d863a){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))*$/[_0x8f10('0xf')](_0x1d863a);}function selectNotIn(_0x7003f3,_0x2e00f7,_0x3ebfd4,_0x440f86,_0x23c485){return squel[_0x8f10('0x10')]()[_0x8f10('0x11')](_0x8f10('0x12'))[_0x8f10('0x13')](_0x440f86)[_0x8f10('0x14')](_0x2e00f7,null,_0x2e00f7+'.id\x20=\x20'+_0x440f86+'.'+_0x3ebfd4)['where'](_0x440f86+'.'+_0x3ebfd4+_0x8f10('0x15')+_0x7003f3+'.'+_0x3ebfd4)[_0x8f10('0x16')](_0x2e00f7+_0x8f10('0x17')+_0x23c485[_0x8f10('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1eaced,_0x1126c5){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8f10('0x18')][_0x8f10('0x19')](_0x8f10('0x1a')+tempTableName)['spread'](function(_0x17882d){if(_0x17882d!==null){var _0x1bb31c=[];for(var _0x1af996=0x0;_0x1af996<_0x17882d['length'];_0x1af996++){var _0xcd61b4=_0x17882d[_0x1af996];if(!_[_0x8f10('0x1b')](_0xcd61b4['phone'])){if(!_[_0x8f10('0x1b')](_0xcd61b4[_0x8f10('0x1c')]))_0x1bb31c[_0x8f10('0x1d')](insertAdditionalPhones(_0xcd61b4));promisesContact[_0x8f10('0x1d')]({'contact':_0xcd61b4});}}}Promise['all'](_0x1bb31c)['then'](function(){_0x1eaced({'val':0x1});});})[_0x8f10('0x1e')](function(_0x322bba){logger[_0x8f10('0x1f')](_0x322bba[_0x8f10('0x20')]);});});}function insertAdditionalPhones(_0x301775){return new Promise(function(_0xfdb66e,_0x468fa9){var _0x3fc95d=_0x301775[_0x8f10('0x1c')];if(_[_0x8f10('0x1b')](_0x3fc95d))_0x468fa9({'val':0x0});else{var _0xb1b0e7=_0x3fc95d['split'](';');var _0x2550e1=[];orderBy=0x0;for(var _0x485e83=0x0;_0x485e83<_0xb1b0e7['length'];_0x485e83++){_0x2550e1['push'](splitAdditionalPhone(_0x301775['id'],_0xb1b0e7[_0x485e83]));}Promise[_0x8f10('0x21')](_0x2550e1)['then'](function(){_0xfdb66e({'val':_0xb1b0e7[_0x8f10('0x22')]});});}});}function splitAdditionalPhone(_0xdaa7dd,_0x2cbbf4){return new Promise(function(_0x39178d,_0x419cd7){var _0x2a823e=_0x2cbbf4[_0x8f10('0x23')](':');var _0x3f0659=_0x2a823e[0x0];var _0x20bdfa=_0x2a823e[0x1];if(_0x20bdfa!==''){var _0x44dd23=_0x20bdfa[_0x8f10('0x23')]('|');var _0x4631ac=[];for(var _0x27e2dd=0x0;_0x27e2dd<_0x44dd23[_0x8f10('0x22')];_0x27e2dd++){if(_0x44dd23[_0x27e2dd]!==''){var _0x563edc=_[_0x8f10('0x24')](promisesAdditionalPhones,{'contactId':_0xdaa7dd,'phone':_0x44dd23[_0x27e2dd]});if(_0x563edc[_0x8f10('0x22')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xdaa7dd,'contactTypeId':_0x3f0659,'phone':_0x44dd23[_0x27e2dd],'orderBy':orderBy});}}}_0x39178d({'ok':0x1});}else _0x39178d({'res':0x0});});}function createAdditionalPhone(_0x4a59ef,_0x52a708,_0x3c1685,_0x11db52){var _0x41fe92='';var _0x31033a='';var _0x88b61c=_0x3c1685['split']('§');_0x41fe92=_0x88b61c[0x0];if(_0x88b61c[_0x8f10('0x22')]==0x2)_0x31033a=_0x88b61c[0x1];return new Promise(function(_0x5098e3,_0x2f1ee1){return db[_0x8f10('0x25')][_0x8f10('0x26')]({'where':{'CmContactId':_0x4a59ef,'item':_0x41fe92}})['then'](function(_0x20b587){if(_0x20b587){return db['CmContactHasItem']['update']({'ItemTypeId':_0x52a708,'description':_0x31033a,'OrderBy':_0x11db52},{'where':{'CmContactId':_0x4a59ef,'item':_0x41fe92}})[_0x8f10('0x27')](function(_0x6b1f28){_0x5098e3({'res':_0x8f10('0x28')});});}else{return db[_0x8f10('0x25')][_0x8f10('0x29')]({'CmContactId':_0x4a59ef,'item':_0x41fe92,'ItemTypeId':_0x52a708,'description':_0x31033a,'OrderBy':_0x11db52,'ItemClass':_0x8f10('0x2a')})[_0x8f10('0x27')](function(_0x49b7c4){_0x5098e3({'res':'inserted'});});}});});}function updateContact(_0x46a875){return new Promise(function(_0x57ecb0,_0x38364b){var _0x16ea79=_0x46a875['id'];delete _0x46a875['id'];return db['CmContact']['update'](_0x46a875,{'where':{'id':_0x16ea79}})[_0x8f10('0x27')](function(_0x5a775a){updatedRows+=0x1;return db[_0x8f10('0x2b')]['update']({'phone':_0x46a875[_0x8f10('0x12')]},{'where':{'ContactId':_0x16ea79}})['then'](function(_0x5ccbce){_0x57ecb0({'ret':'OK'});});});});}function insertCmHopper(_0x3a7352,_0x5e44f0,_0x2a2337,_0x2686a2,_0x266333){var _0x3ad77c=[_0x8f10('0x2c'),'cm_contacts.scheduledat',_0x8f10('0x2d'),_0x8f10('0x2e'),_0x5e44f0+'.'+_0x2686a2,'cm_contacts.createdAt',_0x8f10('0x2f'),'cm_contacts.priority',_0x8f10('0x30'),'\x22'+_0x266333+'\x22'];return squel['insert']()[_0x8f10('0x31')]('cm_hopper')[_0x8f10('0x32')](['phone','scheduledat',_0x8f10('0x33'),'ListId',_0x2686a2,_0x8f10('0x34'),_0x8f10('0x35'),_0x8f10('0x36'),'UserId',_0x8f10('0x37')],squel[_0x8f10('0x10')]()[_0x8f10('0x38')](_0x3ad77c)[_0x8f10('0x13')](_0x5e44f0)[_0x8f10('0x14')](_0x8f10('0x39'),null,_0x8f10('0x3a')+_0x5e44f0+_0x8f10('0x3b'))['join'](_0x2a2337,null,_0x2a2337+_0x8f10('0x3c')+_0x5e44f0+'.'+_0x2686a2)[_0x8f10('0x16')](_0x5e44f0+'.CmListId\x20=\x20?',_0x3a7352)[_0x8f10('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8f10('0x16')](_0x8f10('0x3d'),selectNotIn(_0x5e44f0,_0x2a2337,_0x2686a2,_0x8f10('0x3e'),[_0x8f10('0x3f'),_0x8f10('0x40')]))[_0x8f10('0x16')](_0x8f10('0x3d'),selectNotIn(_0x5e44f0,_0x2a2337,_0x2686a2,_0x8f10('0x3e'),[_0x8f10('0x3f')])))[_0x8f10('0x41')]();}function insertCmHopperBlack(_0x14d527,_0x34299b,_0x148792,_0x3bb739){var _0x5b1fcf=[_0x8f10('0x2c'),_0x8f10('0x2d'),'cm_contacts.ListId',_0x34299b+'.'+_0x3bb739,_0x8f10('0x42'),_0x8f10('0x2f')];return squel[_0x8f10('0x43')]()[_0x8f10('0x31')](_0x8f10('0x44'))[_0x8f10('0x32')]([_0x8f10('0x12'),'ContactId',_0x8f10('0x45'),_0x3bb739,_0x8f10('0x34'),_0x8f10('0x35')],squel['select']()['fields'](_0x5b1fcf)[_0x8f10('0x13')](_0x34299b)[_0x8f10('0x14')]('cm_contacts',null,_0x8f10('0x3a')+_0x34299b+_0x8f10('0x3b'))[_0x8f10('0x14')](_0x148792,null,_0x148792+_0x8f10('0x3c')+_0x34299b+'.'+_0x3bb739)[_0x8f10('0x16')](_0x34299b+_0x8f10('0x46'),_0x14d527)['where'](_0x8f10('0x47'),NOW)[_0x8f10('0x16')](_0x8f10('0x3d'),squel['select']()[_0x8f10('0x11')](_0x8f10('0x12'))[_0x8f10('0x13')](_0x8f10('0x44'))['where'](_0x8f10('0x48'),_0x14d527)[_0x8f10('0x16')](_0x3bb739+'\x20=\x20?',_0x34299b+'.'+_0x3bb739)))[_0x8f10('0x41')]();}function insertCmHopperAdditionalPhones(_0x561991){var _0x573adc=[_0x8f10('0x49'),_0x8f10('0x4a'),_0x8f10('0x4b'),_0x8f10('0x4c'),_0x8f10('0x4d')];return squel['insert']()[_0x8f10('0x31')](_0x8f10('0x4e'))[_0x8f10('0x32')]([_0x8f10('0x4f'),_0x8f10('0x12'),_0x8f10('0x50'),_0x8f10('0x34'),_0x8f10('0x35')],squel[_0x8f10('0x10')]()[_0x8f10('0x38')](_0x573adc)[_0x8f10('0x13')](_0x8f10('0x3e'))[_0x8f10('0x14')]('cm_contacts',null,_0x8f10('0x51'))[_0x8f10('0x14')](_0x8f10('0x52'),null,_0x8f10('0x53'))[_0x8f10('0x16')](_0x8f10('0x54'),_0x561991)[_0x8f10('0x16')](_0x8f10('0x47'),NOW))[_0x8f10('0x41')]();}function insertCmContact(_0x205140,_0x2dc85a,_0x5ded27,_0x254692){var _0xd98846=_[_0x8f10('0x55')](_[_0x8f10('0x56')](_0x254692),[_0x8f10('0x45'),'CompanyId','createdAt',_0x8f10('0x35')]);return squel[_0x8f10('0x43')]()[_0x8f10('0x31')](_0x8f10('0x39'))[_0x8f10('0x32')](_0xd98846,squel[_0x8f10('0x10')]()['fields'](_0xd98846)[_0x8f10('0x13')](_0x2dc85a)[_0x8f10('0x16')]('('+_0x5ded27[_0x8f10('0x14')](',')+_0x8f10('0x57'),squel[_0x8f10('0x10')]()[_0x8f10('0x38')](_0x5ded27)[_0x8f10('0x13')](_0x8f10('0x39'))[_0x8f10('0x16')](_0x8f10('0x48'),_0x205140))[_0x8f10('0x16')](_0x8f10('0x58'),squel[_0x8f10('0x10')]()[_0x8f10('0x11')](_0x8f10('0x59'),_0x8f10('0x5a'))['from'](_0x2dc85a)[_0x8f10('0x5b')](_0x5ded27[_0x8f10('0x14')](','))))['toString']();}function handleStop(){logger[_0x8f10('0x5c')](_0x8f10('0x5d'));stopped=!![];}function handleUncaughtException(_0xb6c1c){logger[_0x8f10('0x1f')](_0xb6c1c[_0x8f10('0x20')]);process['exit'](0x1);}function handleError(_0x33ceba,_0x4a7be8){stats[_0x8f10('0x5e')][_0x8f10('0x1d')]({'name':_0x4a7be8[_0x8f10('0x5f')],'message':_0x4a7be8[_0x8f10('0x20')],'row':_0x33ceba});}function handleQuery(_0x13f8df){logger['info'](_0x13f8df);return db[_0x8f10('0x18')][_0x8f10('0x19')](_0x13f8df)[_0x8f10('0x60')](function(_0x1a5582){results[_0x8f10('0x1d')](_0x1a5582);})[_0x8f10('0x1e')](function(_0x449821){logger[_0x8f10('0x1f')](_0x449821[_0x8f10('0x20')]);});}function main(_0x5a7a81,_0x416287,_0x173fd3,_0x3432b7){logger[_0x8f10('0x5c')]('main',_0x5a7a81,JSON[_0x8f10('0x61')](_0x416287));process[_0x8f10('0x62')](_0x8f10('0x63'));var _0x338e10=_0x416287[_0x8f10('0x64')];var _0x138dbd=_[_0x8f10('0x65')](_0x338e10);var _0x4e7146=_0x416287[_0x8f10('0x66')];var _0x6dce83=path['join'](config['root'],_0x8f10('0x67'),_0x4e7146+'.csv');logger[_0x8f10('0x5c')]('body',_0x416287);db[_0x8f10('0x68')][_0x8f10('0x69')]({'raw':!![],'attributes':['id',_0x8f10('0x6a')]})[_0x8f10('0x27')](function(_0x30797e){for(var _0x3540be=0x0;_0x3540be<_0x30797e[_0x8f10('0x22')];_0x3540be++){if(_0x30797e[_0x3540be][_0x8f10('0x6a')]in _0x338e10){contactItemTypes[_0x8f10('0x1d')](_0x30797e[_0x3540be]);delete _0x138dbd[_0x30797e[_0x3540be]['name']];hasAdditionalPhones=!![];}for(var _0x5458f2 in _0x338e10){if(_0x30797e[_0x3540be][_0x8f10('0x6a')]+_0x8f10('0x6b')===_0x5458f2){phoneDescriptions[_0x8f10('0x1d')]({'itemTypeId':_0x30797e[_0x3540be]['id'],'description':_0x5458f2});delete _0x138dbd[_0x5458f2];}}}if(hasAdditionalPhones)_0x138dbd[_0x8f10('0x1c')]='';var _0xaeeab=_[_0x8f10('0x56')](_0x138dbd)[_0x8f10('0x14')]();logger['info'](_0x8f10('0x6c'),_0xaeeab);fs[_0x8f10('0x6d')](_0x6dce83,_0xaeeab+'\x0a');Papa[_0x8f10('0x6e')](fs['createReadStream'](_0x5a7a81),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2a74e8,_0x2f4c93){try{for(var _0x38a979=0x0,_0x51e486=[];_0x38a979<_0x2a74e8[_0x8f10('0x6f')][_0x8f10('0x22')];_0x38a979++){stats[_0x8f10('0x70')]+=0x1;if(_0x2a74e8[_0x8f10('0x5e')][_0x38a979]){handleError(_0x2a74e8[_0x8f10('0x6f')][_0x38a979],_0x2a74e8[_0x8f10('0x5e')][_0x38a979]);}else{var _0x41ad72=[];var _0x18bdb6=[];var _0x107dfb={};for(var _0x8cba65 in _0x338e10){let _0x549c8c=contactItemTypes[_0x8f10('0x71')](_0x12e24a=>_0x12e24a['name']===_0x8cba65);let _0x577e21=contactItemTypes[_0x8f10('0x71')](_0x249663=>_0x249663['name']+_0x8f10('0x6b')===_0x8cba65);if(_[_0x8f10('0x1b')](_0x549c8c)&&_[_0x8f10('0x1b')](_0x577e21)){if(_0x338e10[_0x8f10('0x72')](_0x8cba65)){if(_0x2a74e8['data'][_0x38a979][_0x338e10[_0x8cba65]]){var _0x24ffd4=_[_0x8f10('0x73')](_0x2a74e8['data'][_0x38a979][_0x338e10[_0x8cba65]]['replace'](/"/g,'\x27'));switch(_0x8cba65){case _0x8f10('0x74'):var _0xbf5303=moment(_0x24ffd4,_0x8f10('0x75'),!![]);if(_0xbf5303[_0x8f10('0x76')]()){_0x51e486['push']('\x22'+_0x24ffd4+'\x22');}else{_0x41ad72[_0x8f10('0x1d')](_0x8f10('0x77'));}break;case _0x8f10('0x36'):var _0x4ca8ae=parseInt(_0x24ffd4);_0x24ffd4=_['isNaN'](_0x4ca8ae)||_0x4ca8ae<0x0||_0x4ca8ae>0x4?_0x3432b7?0x3:0x2:_0x4ca8ae;_0x51e486[_0x8f10('0x1d')]('\x22'+_0x24ffd4+'\x22');break;case _0x8f10('0x78'):var _0xb81c05=parseInt(_0x24ffd4);if(_[_0x8f10('0x79')](_0xb81c05)&&_[_0x8f10('0x7a')](_0x173fd3,_0xb81c05)){_0x51e486[_0x8f10('0x1d')]('\x22'+_0xb81c05+'\x22');}else{_0x41ad72[_0x8f10('0x1d')](_0x8f10('0x7b'));}break;case _0x8f10('0x7c'):if(isEmail(_0x24ffd4)){_0x51e486[_0x8f10('0x1d')]('\x22'+_0x24ffd4+'\x22');}else{_0x41ad72[_0x8f10('0x1d')](_0x8f10('0x7d'));}break;case _0x8f10('0x7e'):var _0x476fc1=moment(_0x24ffd4,_0x8f10('0x7f'),!![]);if(_0x476fc1[_0x8f10('0x76')]()){_0x51e486[_0x8f10('0x1d')]('\x22'+_0x24ffd4+'\x22');}else{_0x41ad72[_0x8f10('0x1d')](_0x8f10('0x80'));}break;default:_0x51e486['push']('\x22'+_0x24ffd4+'\x22');}}else{switch(_0x8cba65){case'firstName':case'phone':_0x41ad72[_0x8f10('0x1d')](_0x8cba65+_0x8f10('0x81'));break;default:_0x51e486['push']('\x22\x22');}}}}else{var _0x48deac='';if(!_['isNil'](_0x549c8c)){if(!_0x107dfb[_0x8f10('0x72')](_0x549c8c['id'])){for(var _0x4ed6fc=0x0;_0x4ed6fc<_0x338e10[_0x8cba65][_0x8f10('0x22')];_0x4ed6fc++){var _0x24ffd4=_['trim'](_0x2a74e8[_0x8f10('0x6f')][_0x38a979][_0x338e10[_0x8cba65][_0x4ed6fc]][_0x8f10('0x82')](/"/g,'\x27'));var _0x120236=phoneDescriptions[_0x8f10('0x71')](_0x1b4adc=>_0x1b4adc[_0x8f10('0x83')]===_0x549c8c['id']);if(!_[_0x8f10('0x1b')](_0x120236)){var _0x5aa4e5=_[_0x8f10('0x73')](_0x2a74e8['data'][_0x38a979][_0x338e10[_0x120236[_0x8f10('0x84')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x8f10('0x1b')](_0x5aa4e5))_0x24ffd4=_0x24ffd4+'§'+_0x5aa4e5;}if(_0x48deac=='')_0x48deac=_0x24ffd4;else _0x48deac+='|'+_0x24ffd4;}_0x18bdb6[_0x8f10('0x1d')](_0x549c8c['id']+':'+_0x48deac);_0x107dfb[_0x549c8c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x51e486['push']('\x22'+_0x18bdb6[_0x8f10('0x14')](';')+'\x22');}if(_0x41ad72[_0x8f10('0x22')]){handleError(_0x2a74e8['data'][_0x38a979],{'code':_0x8f10('0x85'),'message':_0x41ad72[_0x8f10('0x14')]()});}else{fs[_0x8f10('0x86')](_0x6dce83,_0x51e486[_0x8f10('0x14')]()+'\x0a');}_0x51e486=[];}if(!(stats[_0x8f10('0x70')]%0xc8)){socket[_0x8f10('0x87')](_0x8f10('0x88')+_0x4e7146,stats);stats[_0x8f10('0x5e')]=[];}}if(stopped){logger[_0x8f10('0x5c')]('Abort\x20parser');_0x2f4c93[_0x8f10('0x89')]();}}catch(_0x29870){handleError(_0x2a74e8[_0x8f10('0x6f')][_0x38a979],{'code':_0x8f10('0x8a'),'message':_0x29870[_0x8f10('0x20')]});logger[_0x8f10('0x1f')](_0x8f10('0x8b'),_0x29870[_0x8f10('0x20')]);}},'complete':function(){try{var _0x29d01b=[];var _0x4485e9=tempTableName;_0x29d01b['push']('CREATE\x20TABLE\x20'+_0x4485e9+_0x8f10('0x8c'));logger['info'](_0x8f10('0x8d'),contactItemTypes['length']);var _0x45e94f=util[_0x8f10('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x6dce83,_0x4485e9,_0xaeeab,_0x416287[_0x8f10('0x45')],_0x416287[_0x8f10('0x8e')]||null,NOW,NOW);if(_[_0x8f10('0x1b')](_0x338e10[_0x8f10('0x74')])){_0x45e94f+=_0x8f10('0x8f');}_0x29d01b[_0x8f10('0x1d')](_0x45e94f);BPromise[_0x8f10('0x90')](_0x29d01b,handleQuery)[_0x8f10('0x27')](function(_0x457728){BPromise[_0x8f10('0x21')]([handleAdditionalPhones()])[_0x8f10('0x27')](function(){_0x29d01b=[];for(var _0x5bdf65=0x0;_0x5bdf65\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','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','Contact.lastName','Contact.email'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2e3f,0xb6));var _0xf2e3=function(_0x2f8e1e,_0x1a1c14){_0x2f8e1e=_0x2f8e1e-0x0;var _0x400373=_0x2e3f[_0x2f8e1e];return _0x400373;};'use strict';var _=require(_0xf2e3('0x0'));var squel=require(_0xf2e3('0x1'));var as=require(_0xf2e3('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xf2e3('0x3'))[_0xf2e3('0x4')];var utils=require(_0xf2e3('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x2ef9a9,_0x2fce85,_0x22af9c){var _0x17905a=![];var _0x496660=utils[_0xf2e3('0x6')](_0x2ef9a9);if(_0x2fce85[_0xf2e3('0x7')]==='agent'&&!_0x22af9c[_0xf2e3('0x8')]&&!_0x22af9c[_0x496660]){_0x17905a=!![];}return _0x17905a;}function getTagsQuery(){return squel[_0xf2e3('0x9')]()['field']('id')[_0xf2e3('0xa')](_0xf2e3('0xb'))['field'](_0xf2e3('0xc'))['from']('tools_tags');}function getUsersQuery(_0x3405f4,_0x3c7118){var _0x219fbb=utils[_0xf2e3('0xd')](_0x3405f4);var _0x4487df=_0xf2e3('0xe')+_0x3405f4+_0xf2e3('0xf');var _0x3b0553=squel[_0xf2e3('0x9')]()[_0xf2e3('0xa')]('u.id')['field'](_0xf2e3('0x10'))[_0xf2e3('0xa')](_0xf2e3('0x11')+_0x219fbb)['from'](_0x4487df,'ui')[_0xf2e3('0x12')](_0xf2e3('0x13'),'u',_0xf2e3('0x14'));if(_0x3c7118[_0xf2e3('0x15')]>0x0){_0x3b0553[_0xf2e3('0x16')](_0xf2e3('0x11')+_0x219fbb+_0xf2e3('0x17'),_[_0xf2e3('0x18')](_0x3c7118,'id'));}return _0x3b0553;}function getInteractionsQuery(_0x206d5c){var _0x377bf5=utils[_0xf2e3('0x19')](_0x206d5c);var _0x2142db=utils[_0xf2e3('0x6')](_0x206d5c);var _0x12c8ab=utils[_0xf2e3('0xd')](_0x206d5c);return squel['select']()[_0xf2e3('0x1a')](_0x377bf5[_0xf2e3('0x1b')],'i')[_0xf2e3('0x12')](_0xf2e3('0x1c'),'c',_0xf2e3('0x1d'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x377bf5['accounts'],'a',_0xf2e3('0x1e')+_0x2142db)['left_join'](_0x377bf5[_0xf2e3('0x1f')],'me',_0xf2e3('0x20')+_0x12c8ab+_0xf2e3('0x21'))[_0xf2e3('0x12')](_0x377bf5['interactionsTags'],'it',_0xf2e3('0x22')+_0x12c8ab+_0xf2e3('0x21'))[_0xf2e3('0x12')](_0xf2e3('0x23'),'t',_0xf2e3('0x24'));}function getSqlClauses(){var _0x44320b={'body':squel[_0xf2e3('0x25')](),'contact':squel['expr'](),'default':squel[_0xf2e3('0x25')](),'fields':squel[_0xf2e3('0x25')](),'filter':squel[_0xf2e3('0x25')](),'read':squel[_0xf2e3('0x25')](),'tags':{'clause':squel[_0xf2e3('0x25')](),'ids':null},'user':squel[_0xf2e3('0x25')]()};return _0x44320b;}function parseTagParameter(_0x4d438a){var _0x1efbce=squel[_0xf2e3('0x25')]();if(_0x4d438a){var _0x4f57ec=utils['getSelectedTags'](_0x4d438a);_0x4f57ec[_0xf2e3('0x26')](function(_0x4a0e7f){_0x1efbce['or'](_0xf2e3('0x27'),'%,'+_0x4a0e7f+',%');});}return _0x1efbce;}function parseReadParameter(_0x47e3fa){var _0x266c92='';if(_0x47e3fa){_0x266c92=_0xf2e3('0x28');if(_0x47e3fa==='1'){_0x266c92=_0x266c92[_0xf2e3('0x29')](_0xf2e3('0x2a'),'=');}else{_0x266c92=_0x266c92['replace'](_0xf2e3('0x2a'),'>');}}return _0x266c92;}function parseSearchFilter(_0x8216a8,_0x541dda){var _0x187fa8=squel[_0xf2e3('0x25')]();if(_0x541dda){var _0x333175=_0x541dda['replace']('\x5c','\x5c\x5c')[_0xf2e3('0x29')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x333175)){_0x187fa8['or'](_0xf2e3('0x2b'),_0x333175+'%');if([_0xf2e3('0x2c'),_0xf2e3('0x2d')][_0xf2e3('0x2e')](_0x8216a8)){_0x187fa8['or'](_0xf2e3('0x2f'),_0x333175+'%');}else if(_0x8216a8===_0xf2e3('0x30')){_0x187fa8['or'](_0xf2e3('0x31'),_0x333175+'%');}else if(_0x8216a8===_0xf2e3('0x32')){_0x187fa8['or'](_0xf2e3('0x33'),_0x333175+'%');}}else if(_0x8216a8===_0xf2e3('0x34')&&qs['isEmail'](_0x333175)){_0x187fa8['or'](_0xf2e3('0x35'),_0x333175+'%');}else{if(_0x8216a8===_0xf2e3('0x34')){_0x187fa8['or'](_0xf2e3('0x36'),qs[_0xf2e3('0x37')](_0x333175,!![]))['or'](_0xf2e3('0x38'),qs[_0xf2e3('0x37')](_0x333175));}else if(_0x8216a8!==_0xf2e3('0x30')){_0x187fa8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf2e3('0x37')](_0x333175));}_0x187fa8['or'](_0xf2e3('0x39'),qs[_0xf2e3('0x37')](_0x333175,!![]),null);}}return _0x187fa8;}function parseAdvancedSearchFilter(_0x5ea0fd,_0x11dfa8){var _0x51b91b=getSqlClauses();var _0x130c70=as[_0xf2e3('0x3a')](_0x5ea0fd);var _0x1cbd30=_0x130c70['sqlOperator'];for(var _0x4d6376=0x0;_0x4d6376<_0x130c70[_0xf2e3('0x3b')][_0xf2e3('0x15')];_0x4d6376++){var _0x1bf94b=_0x130c70[_0xf2e3('0x3b')][_0x4d6376];var _0x2aef7b='i';var _0x3edb9f=_[_0xf2e3('0x3c')](_0x11dfa8,[_0xf2e3('0xb'),_0x1bf94b[_0xf2e3('0xa')]]);if(_0x3edb9f){var _0x28ecb5=as[_0xf2e3('0x3d')](_0x2aef7b,_0x3edb9f['type'],_0x1bf94b);_0x51b91b[_0xf2e3('0x3e')][_0x1cbd30](_0x28ecb5[_0xf2e3('0x3f')],_0x28ecb5[_0xf2e3('0x40')][_0xf2e3('0x41')],_0x28ecb5['value']['end']);}else{switch(_0x1bf94b[_0xf2e3('0xa')]){case _0xf2e3('0x42'):var _0x4bf450=parseReadParameter(_0x1bf94b['value']);_0x51b91b['read'][_0xf2e3('0x43')](_0x4bf450);break;case _0xf2e3('0x44'):if(_0x1bf94b['operator']===_0xf2e3('0x45')){if(_0x1bf94b[_0xf2e3('0x40')][_0xf2e3('0x46')]('\x20')['length']>0x1){_0x51b91b[_0xf2e3('0x47')][_0x1cbd30](_0xf2e3('0x39'),qs[_0xf2e3('0x37')](_0x1bf94b[_0xf2e3('0x40')],!![]),null);}else{var _0x4a20cf='%'+_0x1bf94b[_0xf2e3('0x40')]+'%';_0x51b91b['contact'][_0x1cbd30](_0xf2e3('0x48'),_0x4a20cf,_0x4a20cf,_0x4a20cf);}}else{_0x3edb9f=_[_0xf2e3('0x3c')](_0x11dfa8,['name','ContactId']);_0x1bf94b[_0xf2e3('0xa')]=_0xf2e3('0x49');_0x28ecb5=as[_0xf2e3('0x3d')](_0x2aef7b,_0x3edb9f[_0xf2e3('0x4a')],_0x1bf94b);_0x51b91b[_0xf2e3('0x47')][_0x1cbd30](_0x28ecb5['text'],_0x28ecb5[_0xf2e3('0x40')]['start'],_0x28ecb5[_0xf2e3('0x40')]['end']);}break;case _0xf2e3('0x4b'):var _0x1d4bba=_0x1bf94b[_0xf2e3('0x40')][_0xf2e3('0x46')](',')[_0xf2e3('0x18')](function(_0x70241c){return Number(_0x70241c);});var _0x471f23=parseTagParameter(_0x1d4bba);_0x51b91b[_0xf2e3('0x4c')][_0xf2e3('0x4d')][_0xf2e3('0x43')](_0x471f23);_0x51b91b[_0xf2e3('0x4c')][_0xf2e3('0x4e')]=_0x1d4bba;break;case _0xf2e3('0x4f'):if(_0x1bf94b['operator']===_0xf2e3('0x45')){_0x51b91b['user'][_0x1cbd30](_0xf2e3('0x50'),'%'+_0x1bf94b[_0xf2e3('0x40')]+'%',null);}else{_0x3edb9f=_['find'](_0x11dfa8,['name',_0xf2e3('0x51')]);_0x1bf94b['field']=_0xf2e3('0x51');_0x28ecb5=as[_0xf2e3('0x3d')](_0x2aef7b,_0x3edb9f[_0xf2e3('0x4a')],_0x1bf94b);_0x51b91b[_0xf2e3('0x52')][_0x1cbd30](_0x28ecb5[_0xf2e3('0x3f')],_0x28ecb5[_0xf2e3('0x40')][_0xf2e3('0x41')],_0x28ecb5[_0xf2e3('0x40')][_0xf2e3('0x53')]);}break;case _0xf2e3('0x54'):case _0xf2e3('0x55'):_0x28ecb5=as[_0xf2e3('0x3d')]('me',null,_0x1bf94b);_0x51b91b[_0xf2e3('0x54')][_0x1cbd30](_0x28ecb5[_0xf2e3('0x3f')],_0x28ecb5[_0xf2e3('0x40')][_0xf2e3('0x41')],_0x28ecb5[_0xf2e3('0x40')][_0xf2e3('0x53')]);break;}}}return _0x51b91b;}function parseModelFields(_0x3b680d,_0x187f8f,_0x2b7719){var _0x100ab8=utils['getAccountFK'](_0x3b680d);var _0x295575=squel[_0xf2e3('0x25')]();var _0x4a58c3=_(_0x187f8f)[_0xf2e3('0x56')]()[_0xf2e3('0x18')](function(_0x151e33){return _['some'](_0x2b7719,['name',_0x151e33])?_0x151e33:undefined;})[_0xf2e3('0x57')]()[_0xf2e3('0x40')]();if(_0x4a58c3[_0xf2e3('0x15')]>0x0){_0x4a58c3[_0xf2e3('0x26')](function(_0x20e8f2){if(_0x20e8f2===_0x100ab8){_0x295575[_0xf2e3('0x43')]('i.'+_0x100ab8+'\x20IN\x20?',[][_0xf2e3('0x58')](_0x187f8f[_0x20e8f2]));}else if(_0x20e8f2===_0xf2e3('0x59')){var _0x20c907=JSON['parse'](_0x187f8f[_0x20e8f2])[_0xf2e3('0x5a')];var _0x22f57a=JSON[_0xf2e3('0x5b')](_0x187f8f[_0x20e8f2])[_0xf2e3('0x5c')];_0x295575[_0xf2e3('0x43')](_0xf2e3('0x5d'),_0x20c907,_0x22f57a);}else{if(_0x187f8f[_0x20e8f2]===_0xf2e3('0x5e')){_0x295575[_0xf2e3('0x43')]('i.'+_0x20e8f2+_0xf2e3('0x5f'));}else{_0x295575[_0xf2e3('0x43')]('i.'+_0x20e8f2+_0xf2e3('0x60'),_0x187f8f[_0x20e8f2]);}}});}return _0x295575;}function parseQueryParameters(_0x3b5bc8,_0x55958e,_0x5e452e){var _0x224586=getSqlClauses();return Promise[_0xf2e3('0x61')]()['then'](function(){return parseModelFields(_0x3b5bc8,_0x55958e,_0x5e452e);})[_0xf2e3('0x62')](function(_0x15b672){_0x224586[_0xf2e3('0x63')][_0xf2e3('0x43')](_0x15b672);return parseReadParameter(_0x55958e[_0xf2e3('0x64')]);})['then'](function(_0x292021){_0x224586[_0xf2e3('0x64')][_0xf2e3('0x43')](_0x292021);return parseTagParameter(_0x55958e[_0xf2e3('0x65')]);})['then'](function(_0x27879e){_0x224586[_0xf2e3('0x4c')][_0xf2e3('0x4d')]['and'](_0x27879e);return parseSearchFilter(_0x3b5bc8,_0x55958e[_0xf2e3('0x66')]);})['then'](function(_0x2dc5d5){_0x224586['filter']=_0x2dc5d5;return _0x224586;});}function checkAccountsRestrictions(_0x10d009,_0x49216d,_0x34be66){var _0x4109b8=utils[_0xf2e3('0x6')](_0x10d009);var _0x2e992d=_0xf2e3('0x67')+_[_0xf2e3('0x68')](_0x10d009)+(_0x10d009===_0xf2e3('0x69')?_0xf2e3('0x6a'):_0xf2e3('0x6b'));var _0x248181=squel[_0xf2e3('0x25')]();return Promise[_0xf2e3('0x61')]()[_0xf2e3('0x62')](function(){if(_0x34be66['search']&&_0x49216d[_0xf2e3('0x7')]==='agent'){return _0x49216d[_0x2e992d]({'attributes':['id'],'raw':!![]});}})[_0xf2e3('0x62')](function(_0x491a89){if(_0x491a89){if(_0x491a89[_0xf2e3('0x15')]===0x0){_0x248181[_0xf2e3('0x43')]('i.'+_0x4109b8+'\x20IS\x20NULL');}else{_0x248181['and']('i.'+_0x4109b8+_0xf2e3('0x17'),_[_0xf2e3('0x18')](_0x491a89,'id'));}}else if(!_0x34be66[_0x4109b8]){_0x248181[_0xf2e3('0x43')]('i.'+_0x4109b8+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x248181;});}function getClosedOrderClause(_0x2b77cc,_0x1ae4a5){var _0x104731='';var _0x6fa708=[_0xf2e3('0x6c'),_0xf2e3('0x6d'),_0xf2e3('0x6e')];if(_0x2b77cc===_0xf2e3('0x34')){_0x6fa708['unshift'](_0xf2e3('0x6f'));}if(_0x1ae4a5[_0xf2e3('0x70')]==='0'&&_0x2b77cc===_0xf2e3('0x34')){_0x104731=_0xf2e3('0x6f');}else{if(_0x1ae4a5[_0xf2e3('0x70')]==='1'){_0x6fa708['shift']();}_0x104731=_0xf2e3('0x71')+_0x6fa708[_0xf2e3('0x72')](',\x20')+')';}return _0x104731;}function getFilteredInteractions(_0x329b07,_0x57aa6b,_0x313e69,_0x4dc4d4){var _0x5213d0=utils[_0xf2e3('0xd')](_0x329b07);var _0x4b7a4c=_[_0xf2e3('0x68')](_0x329b07)+'Interaction';var _0x5471f3=[];var _0x29f184=getTagsQuery();var _0x17916f={'type':db[_0xf2e3('0x73')][_0xf2e3('0x74')]['SELECT'],'raw':!![]};var _0x85acc3=[];var _0x6f173e=[];return db[_0xf2e3('0x75')]['query'](_0x29f184['toString'](),_0x17916f)[_0xf2e3('0x62')](function(_0xcf160d){_0x5471f3=_[_0xf2e3('0x76')](_0xcf160d,'id');_0x17916f=_[_0xf2e3('0x77')](_0x17916f,{'model':db[_0x4b7a4c],'mapToModel':!![],'nest':!![]});if(_0x313e69[_0xf2e3('0x63')]){_0x4dc4d4[_0xf2e3('0x78')]['forEach'](function(_0x2ec873){_0x57aa6b[_0xf2e3('0xa')]('i.'+_0x2ec873);});}else{_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x79'),_0xf2e3('0x42'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x7a'),_0xf2e3('0x7b'));_0x57aa6b[_0xf2e3('0xa')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x329b07===_0xf2e3('0x34')){_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x7c'),_0xf2e3('0x7d'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x7e'),'contactName');_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x7f'));_0x57aa6b['field']('i.createdAt');_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x80'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x81'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x82'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x83'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x84'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x85'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x86'));_0x57aa6b['field'](_0xf2e3('0x6e'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x6d'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x6c'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x6f'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x87'));_0x57aa6b['field'](_0xf2e3('0x88'));_0x57aa6b['field'](_0xf2e3('0x89'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x8a'));}else if(_0x329b07===_0xf2e3('0x32')){_0x57aa6b[_0xf2e3('0xa')]('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',_0xf2e3('0x8b'));}else{_0x57aa6b['field'](_0xf2e3('0x8c'),_0xf2e3('0x8b'));}if(_0x329b07!==_0xf2e3('0x34')){_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x8d'));}_0x57aa6b['field']('c.firstName',_0xf2e3('0x8e'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x8f'),_0xf2e3('0x90'));_0x57aa6b[_0xf2e3('0xa')]('c.email',_0xf2e3('0x91'));_0x57aa6b[_0xf2e3('0xa')]('c.phone',_0xf2e3('0x92'));_0x57aa6b[_0xf2e3('0xa')]('c.mobile',_0xf2e3('0x93'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x94'),_0xf2e3('0x95'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x96'),_0xf2e3('0x97'));_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x98'),'Owner.internal');_0x57aa6b[_0xf2e3('0xa')](_0xf2e3('0x99'),'TagIds');}if(_0x4dc4d4[_0xf2e3('0x9a')]){_0x57aa6b[_0xf2e3('0x9a')](_0x4dc4d4['limit']);}if(_0x4dc4d4['offset']){_0x57aa6b[_0xf2e3('0x9b')](_0x4dc4d4[_0xf2e3('0x9b')]);}return db[_0xf2e3('0x75')][_0xf2e3('0x9c')](_0x57aa6b[_0xf2e3('0x9d')](),_0x17916f);})[_0xf2e3('0x62')](function(_0x529a14){_0x85acc3=_0x529a14;var _0x38840f=getUsersQuery(_0x329b07,_0x85acc3);return db['sequelize'][_0xf2e3('0x9c')](_0x38840f['toString'](),_0x17916f);})[_0xf2e3('0x62')](function(_0x5aeb80){_0x6f173e=_['groupBy'](_0x5aeb80,_0x5213d0);if(_0x329b07===_0xf2e3('0x34')){return db['Setting']['findOne']({'attributes':[_0xf2e3('0x9e')],'raw':!![]});}})['then'](function(_0x2a6933){var _0x25689a=_0x2a6933?_0x2a6933['enableEmailPreview']:undefined;var _0x3c4812=_0x85acc3[_0xf2e3('0x18')](function(_0x268b10){return updateInteraction(_0x268b10,_0x5471f3,_0x6f173e,_0x25689a);});return Promise['all'](_0x3c4812);});}function countFilteredInteractions(_0x4c5356,_0x21e63e){var _0x3cd7b0=_0x4c5356[_0xf2e3('0x9f')]();_0x3cd7b0[_0xf2e3('0xa')]('COUNT(*)');_0x3cd7b0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf2e3('0x42'));var _0x427b91=utils[_0xf2e3('0xa0')](_0x21e63e);if(!_['isEmpty'](_0x427b91)){_0x3cd7b0[_0xf2e3('0x16')](_0xf2e3('0xa1'),_0x427b91);}var _0x50a173={'type':db[_0xf2e3('0x73')][_0xf2e3('0x74')][_0xf2e3('0xa2')],'raw':!![]};return db[_0xf2e3('0x75')][_0xf2e3('0x9c')](_0x3cd7b0['toString'](),_0x50a173);}module[_0xf2e3('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x39c5=['QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','select','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','end','and','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','clause','tags','ids','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','compact','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','fields','read','filter','get','capitalize','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize'];(function(_0x2d2919,_0x572aec){var _0x49cd11=function(_0x2df841){while(--_0x2df841){_0x2d2919['push'](_0x2d2919['shift']());}};_0x49cd11(++_0x572aec);}(_0x39c5,0x193));var _0x539c=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x39c5[_0x51ed62];return _0x34aee3;};'use strict';var _=require('lodash');var squel=require(_0x539c('0x0'));var as=require(_0x539c('0x1'));var qs=require(_0x539c('0x2'));var updateInteraction=require(_0x539c('0x3'))[_0x539c('0x4')];var utils=require('./utils');var db=require(_0x539c('0x5'))['db'];function skipInteractionsQuery(_0x56521f,_0x8b63e1,_0x101731){var _0x586acc=![];var _0x28ca57=utils[_0x539c('0x6')](_0x56521f);if(_0x8b63e1[_0x539c('0x7')]===_0x539c('0x8')&&!_0x101731[_0x539c('0x9')]&&!_0x101731[_0x28ca57]){_0x586acc=!![];}return _0x586acc;}function getTagsQuery(){return squel['select']()[_0x539c('0xa')]('id')['field'](_0x539c('0xb'))[_0x539c('0xa')](_0x539c('0xc'))['from'](_0x539c('0xd'));}function getUsersQuery(_0x29190e,_0xb9f860){var _0x4c7d74=utils[_0x539c('0xe')](_0x29190e);var _0x20a41e=_0x539c('0xf')+_0x29190e+_0x539c('0x10');var _0x8d2726=squel['select']()[_0x539c('0xa')](_0x539c('0x11'))[_0x539c('0xa')](_0x539c('0x12'))[_0x539c('0xa')](_0x539c('0x13')+_0x4c7d74)['from'](_0x20a41e,'ui')['left_join'](_0x539c('0x14'),'u',_0x539c('0x15'));if(_0xb9f860[_0x539c('0x16')]>0x0){_0x8d2726[_0x539c('0x17')](_0x539c('0x13')+_0x4c7d74+_0x539c('0x18'),_[_0x539c('0x19')](_0xb9f860,'id'));}return _0x8d2726;}function getInteractionsQuery(_0x5171fc){var _0x3fa841=utils[_0x539c('0x1a')](_0x5171fc);var _0x3ce906=utils['getAccountFK'](_0x5171fc);var _0x5b9c24=utils[_0x539c('0xe')](_0x5171fc);return squel[_0x539c('0x1b')]()['from'](_0x3fa841[_0x539c('0x1c')],'i')[_0x539c('0x1d')](_0x539c('0x1e'),'c',_0x539c('0x1f'))[_0x539c('0x1d')](_0x539c('0x14'),'o',_0x539c('0x20'))[_0x539c('0x1d')](_0x3fa841['accounts'],'a',_0x539c('0x21')+_0x3ce906)[_0x539c('0x1d')](_0x3fa841['messages'],'me',_0x539c('0x22')+_0x5b9c24+'\x20=\x20i.id')['left_join'](_0x3fa841[_0x539c('0x23')],'it','it.'+_0x5b9c24+_0x539c('0x24'))[_0x539c('0x1d')](_0x539c('0xd'),'t',_0x539c('0x25'));}function getSqlClauses(){var _0x223ca6={'body':squel['expr'](),'contact':squel[_0x539c('0x26')](),'default':squel[_0x539c('0x26')](),'fields':squel['expr'](),'filter':squel[_0x539c('0x26')](),'read':squel[_0x539c('0x26')](),'tags':{'clause':squel[_0x539c('0x26')](),'ids':null},'user':squel[_0x539c('0x26')]()};return _0x223ca6;}function parseTagParameter(_0x2732e0){var _0x7e9739=squel[_0x539c('0x26')]();if(_0x2732e0){var _0xde2cb6=utils[_0x539c('0x27')](_0x2732e0);_0xde2cb6[_0x539c('0x28')](function(_0x8ff4c2){_0x7e9739['or'](_0x539c('0x29'),'%,'+_0x8ff4c2+',%');});}return _0x7e9739;}function parseReadParameter(_0x956c9e){var _0x4c01e8='';if(_0x956c9e){_0x4c01e8=_0x539c('0x2a');if(_0x956c9e==='1'){_0x4c01e8=_0x4c01e8[_0x539c('0x2b')](_0x539c('0x2c'),'=');}else{_0x4c01e8=_0x4c01e8[_0x539c('0x2b')](_0x539c('0x2c'),'>');}}return _0x4c01e8;}function parseSearchFilter(_0x4afb61,_0x523097){var _0x45df2c=squel[_0x539c('0x26')]();if(_0x523097){var _0x4ae45d=_0x523097[_0x539c('0x2b')]('\x5c','\x5c\x5c')[_0x539c('0x2b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4ae45d)){_0x45df2c['or']('i.id\x20LIKE\x20?',_0x4ae45d+'%');if(['sms',_0x539c('0x2d')][_0x539c('0x2e')](_0x4afb61)){_0x45df2c['or'](_0x539c('0x2f'),_0x4ae45d+'%');}else if(_0x4afb61===_0x539c('0x30')){_0x45df2c['or']('i.fax\x20LIKE\x20?',_0x4ae45d+'%');}else if(_0x4afb61===_0x539c('0x31')){_0x45df2c['or'](_0x539c('0x32'),_0x4ae45d+'%');}}else if(_0x4afb61==='mail'&&qs[_0x539c('0x33')](_0x4ae45d)){_0x45df2c['or'](_0x539c('0x34'),_0x4ae45d+'%');}else{if(_0x4afb61===_0x539c('0x35')){_0x45df2c['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4ae45d,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x539c('0x36')](_0x4ae45d));}else if(_0x4afb61!==_0x539c('0x30')){_0x45df2c['or'](_0x539c('0x37'),qs[_0x539c('0x36')](_0x4ae45d));}_0x45df2c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4ae45d,!![]),null);}}return _0x45df2c;}function parseAdvancedSearchFilter(_0x4a7f63,_0x4621e9){var _0x5894fa=getSqlClauses();var _0x557fb3=as[_0x539c('0x38')](_0x4a7f63);var _0x1be20f=_0x557fb3[_0x539c('0x39')];for(var _0x5146d1=0x0;_0x5146d1<_0x557fb3[_0x539c('0x3a')]['length'];_0x5146d1++){var _0xa8cbf2=_0x557fb3[_0x539c('0x3a')][_0x5146d1];var _0x252e10='i';var _0x5bca8d=_[_0x539c('0x3b')](_0x4621e9,['name',_0xa8cbf2[_0x539c('0xa')]]);if(_0x5bca8d){var _0x533d60=as[_0x539c('0x3c')](_0x252e10,_0x5bca8d[_0x539c('0x3d')],_0xa8cbf2);_0x5894fa[_0x539c('0x3e')][_0x1be20f](_0x533d60[_0x539c('0x3f')],_0x533d60[_0x539c('0x40')]['start'],_0x533d60[_0x539c('0x40')][_0x539c('0x41')]);}else{switch(_0xa8cbf2[_0x539c('0xa')]){case'unreadMessages':var _0x2c5ba0=parseReadParameter(_0xa8cbf2[_0x539c('0x40')]);_0x5894fa['read'][_0x539c('0x42')](_0x2c5ba0);break;case _0x539c('0x43'):if(_0xa8cbf2[_0x539c('0x44')]==='$substring'){if(_0xa8cbf2[_0x539c('0x40')][_0x539c('0x45')]('\x20')[_0x539c('0x16')]>0x1){_0x5894fa['contact'][_0x1be20f](_0x539c('0x46'),qs[_0x539c('0x36')](_0xa8cbf2[_0x539c('0x40')],!![]),null);}else{var _0x56c0bc='%'+_0xa8cbf2[_0x539c('0x40')]+'%';_0x5894fa[_0x539c('0x47')][_0x1be20f](_0x539c('0x48'),_0x56c0bc,_0x56c0bc,_0x56c0bc);}}else{_0x5bca8d=_['find'](_0x4621e9,[_0x539c('0xb'),_0x539c('0x49')]);_0xa8cbf2[_0x539c('0xa')]='ContactId';_0x533d60=as[_0x539c('0x3c')](_0x252e10,_0x5bca8d[_0x539c('0x3d')],_0xa8cbf2);_0x5894fa['contact'][_0x1be20f](_0x533d60['text'],_0x533d60[_0x539c('0x40')]['start'],_0x533d60[_0x539c('0x40')][_0x539c('0x41')]);}break;case _0x539c('0x4a'):var _0x4b2148=_0xa8cbf2[_0x539c('0x40')][_0x539c('0x45')](',')[_0x539c('0x19')](function(_0x4f9d06){return Number(_0x4f9d06);});var _0x3b9e41=parseTagParameter(_0x4b2148);_0x5894fa['tags'][_0x539c('0x4b')]['and'](_0x3b9e41);_0x5894fa[_0x539c('0x4c')][_0x539c('0x4d')]=_0x4b2148;break;case'User':if(_0xa8cbf2['operator']===_0x539c('0x4e')){_0x5894fa[_0x539c('0x4f')][_0x1be20f](_0x539c('0x50'),'%'+_0xa8cbf2[_0x539c('0x40')]+'%',null);}else{_0x5bca8d=_[_0x539c('0x3b')](_0x4621e9,[_0x539c('0xb'),_0x539c('0x51')]);_0xa8cbf2['field']='UserId';_0x533d60=as['buildExpression'](_0x252e10,_0x5bca8d[_0x539c('0x3d')],_0xa8cbf2);_0x5894fa[_0x539c('0x4f')][_0x1be20f](_0x533d60[_0x539c('0x3f')],_0x533d60['value'][_0x539c('0x52')],_0x533d60['value']['end']);}break;case _0x539c('0x53'):case'plainBody':_0x533d60=as['buildExpression']('me',null,_0xa8cbf2);_0x5894fa['body'][_0x1be20f](_0x533d60[_0x539c('0x3f')],_0x533d60[_0x539c('0x40')]['start'],_0x533d60[_0x539c('0x40')]['end']);break;}}}return _0x5894fa;}function parseModelFields(_0x4bc6ca,_0x5ba263,_0xa68453){var _0x5439af=utils['getAccountFK'](_0x4bc6ca);var _0x3e0d84=squel[_0x539c('0x26')]();var _0x5ef596=_(_0x5ba263)[_0x539c('0x54')]()[_0x539c('0x19')](function(_0x28282c){return _[_0x539c('0x55')](_0xa68453,['name',_0x28282c])?_0x28282c:undefined;})[_0x539c('0x56')]()[_0x539c('0x40')]();if(_0x5ef596[_0x539c('0x16')]>0x0){_0x5ef596[_0x539c('0x28')](function(_0x34ffa9){if(_0x34ffa9===_0x5439af){_0x3e0d84[_0x539c('0x42')]('i.'+_0x5439af+_0x539c('0x18'),[][_0x539c('0x57')](_0x5ba263[_0x34ffa9]));}else if(_0x34ffa9==='createdAt'){var _0x4f866d=JSON[_0x539c('0x58')](_0x5ba263[_0x34ffa9])[_0x539c('0x59')];var _0xb3c5f4=JSON[_0x539c('0x58')](_0x5ba263[_0x34ffa9])['$lte'];_0x3e0d84[_0x539c('0x42')](_0x539c('0x5a'),_0x4f866d,_0xb3c5f4);}else{if(_0x5ba263[_0x34ffa9]===_0x539c('0x5b')){_0x3e0d84['and']('i.'+_0x34ffa9+'\x20IS\x20NULL');}else{_0x3e0d84['and']('i.'+_0x34ffa9+_0x539c('0x5c'),_0x5ba263[_0x34ffa9]);}}});}return _0x3e0d84;}function parseQueryParameters(_0xb1d99d,_0x3c51d3,_0x513553){var _0x388047=getSqlClauses();return Promise['resolve']()[_0x539c('0x5d')](function(){return parseModelFields(_0xb1d99d,_0x3c51d3,_0x513553);})[_0x539c('0x5d')](function(_0x4d5adb){_0x388047[_0x539c('0x5e')][_0x539c('0x42')](_0x4d5adb);return parseReadParameter(_0x3c51d3[_0x539c('0x5f')]);})[_0x539c('0x5d')](function(_0x2aa324){_0x388047['read']['and'](_0x2aa324);return parseTagParameter(_0x3c51d3['tag']);})['then'](function(_0x5a88af){_0x388047[_0x539c('0x4c')][_0x539c('0x4b')][_0x539c('0x42')](_0x5a88af);return parseSearchFilter(_0xb1d99d,_0x3c51d3[_0x539c('0x60')]);})[_0x539c('0x5d')](function(_0x13b354){_0x388047[_0x539c('0x60')]=_0x13b354;return _0x388047;});}function checkAccountsRestrictions(_0x2b68c2,_0x54c598,_0x30382a){var _0x1691d7=utils[_0x539c('0x6')](_0x2b68c2);var _0x49dd1f=_0x539c('0x61')+_[_0x539c('0x62')](_0x2b68c2)+(_0x2b68c2===_0x539c('0x63')?_0x539c('0x64'):_0x539c('0x65'));var _0x501d5c=squel[_0x539c('0x26')]();return Promise[_0x539c('0x66')]()[_0x539c('0x5d')](function(){if(_0x30382a[_0x539c('0x9')]&&_0x54c598[_0x539c('0x7')]==='agent'){return _0x54c598[_0x49dd1f]({'attributes':['id'],'raw':!![]});}})[_0x539c('0x5d')](function(_0x1d62f8){if(_0x1d62f8){if(_0x1d62f8[_0x539c('0x16')]===0x0){_0x501d5c[_0x539c('0x42')]('i.'+_0x1691d7+'\x20IS\x20NULL');}else{_0x501d5c[_0x539c('0x42')]('i.'+_0x1691d7+_0x539c('0x18'),_['map'](_0x1d62f8,'id'));}}else if(!_0x30382a[_0x1691d7]){_0x501d5c['and']('i.'+_0x1691d7+_0x539c('0x67'));}})[_0x539c('0x5d')](function(){return _0x501d5c;});}function getClosedOrderClause(_0x497870,_0x18b1c1){var _0x31f2bb='';var _0x5550f9=['i.thirdDisposition',_0x539c('0x68'),_0x539c('0x69')];if(_0x497870===_0x539c('0x35')){_0x5550f9[_0x539c('0x6a')](_0x539c('0x6b'));}if(_0x18b1c1[_0x539c('0x6c')]==='0'&&_0x497870===_0x539c('0x35')){_0x31f2bb='i.substatus';}else{if(_0x18b1c1[_0x539c('0x6c')]==='1'){_0x5550f9[_0x539c('0x6d')]();}_0x31f2bb=_0x539c('0x6e')+_0x5550f9[_0x539c('0x6f')](',\x20')+')';}return _0x31f2bb;}function getFilteredInteractions(_0x5ba91c,_0x299ce1,_0x48966d,_0x48fb32){var _0x44278c=utils[_0x539c('0xe')](_0x5ba91c);var _0x307702=_[_0x539c('0x62')](_0x5ba91c)+'Interaction';var _0x20053a=[];var _0xd6d292=getTagsQuery();var _0x4801b0={'type':db[_0x539c('0x70')][_0x539c('0x71')][_0x539c('0x72')],'raw':!![]};var _0x2abbad=[];var _0x5f3b2e=[];return db[_0x539c('0x73')][_0x539c('0x74')](_0xd6d292[_0x539c('0x75')](),_0x4801b0)[_0x539c('0x5d')](function(_0x19e754){_0x20053a=_[_0x539c('0x76')](_0x19e754,'id');_0x4801b0=_[_0x539c('0x77')](_0x4801b0,{'model':db[_0x307702],'mapToModel':!![],'nest':!![]});if(_0x48966d[_0x539c('0x5e')]){_0x48fb32[_0x539c('0x78')]['forEach'](function(_0x331d6b){_0x299ce1[_0x539c('0xa')]('i.'+_0x331d6b);});}else{_0x299ce1['field'](_0x539c('0x79'),_0x539c('0x7a'));_0x299ce1[_0x539c('0xa')]('a.key',_0x539c('0x7b'));_0x299ce1['field'](_0x539c('0x7c'),_0x539c('0x7d'));if(_0x5ba91c===_0x539c('0x35')){_0x299ce1[_0x539c('0xa')](_0x539c('0x7e'),_0x539c('0x7f'));_0x299ce1[_0x539c('0xa')]('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',_0x539c('0x80'));_0x299ce1[_0x539c('0xa')](_0x539c('0x81'));_0x299ce1[_0x539c('0xa')](_0x539c('0x82'));_0x299ce1[_0x539c('0xa')](_0x539c('0x83'));_0x299ce1[_0x539c('0xa')](_0x539c('0x84'));_0x299ce1[_0x539c('0xa')](_0x539c('0x85'));_0x299ce1[_0x539c('0xa')](_0x539c('0x86'));_0x299ce1[_0x539c('0xa')](_0x539c('0x87'));_0x299ce1[_0x539c('0xa')](_0x539c('0x88'));_0x299ce1[_0x539c('0xa')](_0x539c('0x89'));_0x299ce1['field'](_0x539c('0x69'));_0x299ce1[_0x539c('0xa')](_0x539c('0x68'));_0x299ce1[_0x539c('0xa')](_0x539c('0x8a'));_0x299ce1[_0x539c('0xa')](_0x539c('0x6b'));_0x299ce1[_0x539c('0xa')](_0x539c('0x8b'));_0x299ce1[_0x539c('0xa')](_0x539c('0x8c'));_0x299ce1['field'](_0x539c('0x8d'));_0x299ce1['field'](_0x539c('0x8e'));}else if(_0x5ba91c==='openchannel'){_0x299ce1[_0x539c('0xa')](_0x539c('0x8f'),_0x539c('0x80'));}else{_0x299ce1['field']('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',_0x539c('0x80'));}if(_0x5ba91c!==_0x539c('0x35')){_0x299ce1[_0x539c('0xa')](_0x539c('0x90'));}_0x299ce1['field'](_0x539c('0x91'),_0x539c('0x92'));_0x299ce1[_0x539c('0xa')](_0x539c('0x93'),_0x539c('0x94'));_0x299ce1['field'](_0x539c('0x95'),_0x539c('0x96'));_0x299ce1[_0x539c('0xa')](_0x539c('0x97'),_0x539c('0x98'));_0x299ce1['field'](_0x539c('0x99'),_0x539c('0x9a'));_0x299ce1[_0x539c('0xa')](_0x539c('0x9b'),_0x539c('0x9c'));_0x299ce1[_0x539c('0xa')](_0x539c('0x9d'),'Owner.fullname');_0x299ce1[_0x539c('0xa')](_0x539c('0x9e'),_0x539c('0x9f'));_0x299ce1['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x539c('0xa0'));}if(_0x48fb32[_0x539c('0xa1')]){_0x299ce1[_0x539c('0xa1')](_0x48fb32[_0x539c('0xa1')]);}if(_0x48fb32[_0x539c('0xa2')]){_0x299ce1[_0x539c('0xa2')](_0x48fb32[_0x539c('0xa2')]);}return db[_0x539c('0x73')]['query'](_0x299ce1[_0x539c('0x75')](),_0x4801b0);})[_0x539c('0x5d')](function(_0x476944){_0x2abbad=_0x476944;var _0x1e8513=getUsersQuery(_0x5ba91c,_0x2abbad);return db[_0x539c('0x73')][_0x539c('0x74')](_0x1e8513['toString'](),_0x4801b0);})[_0x539c('0x5d')](function(_0x39029f){_0x5f3b2e=_[_0x539c('0xa3')](_0x39029f,_0x44278c);if(_0x5ba91c==='mail'){return db[_0x539c('0xa4')]['findOne']({'attributes':[_0x539c('0xa5')],'raw':!![]});}})[_0x539c('0x5d')](function(_0x1cd5a4){var _0x5ae654=_0x1cd5a4?_0x1cd5a4[_0x539c('0xa5')]:undefined;var _0x2e1513=_0x2abbad[_0x539c('0x19')](function(_0x54efbf){return updateInteraction(_0x54efbf,_0x20053a,_0x5f3b2e,_0x5ae654);});return Promise[_0x539c('0xa6')](_0x2e1513);});}function countFilteredInteractions(_0x46dd3,_0x5f10ba){var _0x1cc5e1=_0x46dd3[_0x539c('0xa7')]();_0x1cc5e1[_0x539c('0xa')](_0x539c('0xa8'));_0x1cc5e1[_0x539c('0xa')](_0x539c('0x79'),_0x539c('0x7a'));var _0x27b9f3=utils[_0x539c('0x27')](_0x5f10ba);if(!_[_0x539c('0xa9')](_0x27b9f3)){_0x1cc5e1[_0x539c('0x17')](_0x539c('0xaa'),_0x27b9f3);}var _0x38751a={'type':db[_0x539c('0x70')][_0x539c('0x71')][_0x539c('0x72')],'raw':!![]};return db['sequelize'][_0x539c('0x74')](_0x1cc5e1[_0x539c('0x75')](),_0x38751a);}module[_0x539c('0xab')]={'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 e795465..a6d6e7b 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 _0x85c7=['catch','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','push','waiting','answered','unmanaged','abandoned','total','closed','talking','disposition','UserId','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x3bf74d,_0x5c2a6b){var _0x155b00=function(_0x5f246e){while(--_0x5f246e){_0x3bf74d['push'](_0x3bf74d['shift']());}};_0x155b00(++_0x5c2a6b);}(_0x85c7,0x1c5));var _0x785c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x85c7[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x785c('0x0'));var db=require(_0x785c('0x1'))['db'];function getInteractionUsers(_0xdd7e6b,_0x4acf8f){return new Promise(function(_0x3d58de,_0x2a9a44){try{var _0x30a0fb=[];if(_0x4acf8f[_0xdd7e6b]){_0x30a0fb=_0x4acf8f[_0xdd7e6b][_0x785c('0x2')](function(_0x3d18fa){return{'id':_0x3d18fa['id'],'fullname':_0x3d18fa[_0x785c('0x3')]};});}return _0x3d58de(_0x30a0fb);}catch(_0x170911){_0x2a9a44(_0x170911);}});}function getInteractionTags(_0x1c17e5,_0x276a28){var _0x132059=[];if(_0x1c17e5){_0x1c17e5[_0x785c('0x4')](',')['forEach'](function(_0x3e95ac){_0x132059[_0x785c('0x5')](_0x276a28[_0x3e95ac]);});}return _0x132059;}function updateWaitingCounter(_0xb395d4){if(_0xb395d4['waiting']){_0xb395d4[_0x785c('0x6')]-=0x1;}}function updateInteractionCounters(_0x16cc5c){_0x16cc5c[_0x785c('0x6')]=0x0;_0x16cc5c['talking']=0x0;_0x16cc5c[_0x785c('0x7')]=0x0;_0x16cc5c[_0x785c('0x8')]=0x0;_0x16cc5c[_0x785c('0x9')]=0x0;_0x16cc5c[_0x785c('0xa')]=0x0;if(_0x16cc5c[_0x785c('0xb')]){if(_0x16cc5c['disposition']===_0x785c('0x9')){_0x16cc5c[_0x785c('0x9')]+=0x1;updateWaitingCounter(_0x16cc5c);}if(_0x16cc5c['UserId']){_0x16cc5c[_0x785c('0x7')]+=0x1;if(_0x16cc5c[_0x785c('0xc')]){_0x16cc5c['talking']-=0x1;}}else{if(_0x16cc5c[_0x785c('0xd')]){_0x16cc5c[_0x785c('0x8')]+=0x1;updateWaitingCounter(_0x16cc5c);}}}else{if(!_0x16cc5c[_0x785c('0xe')]){_0x16cc5c[_0x785c('0x6')]+=0x1;}if(_0x16cc5c[_0x785c('0xe')]){_0x16cc5c[_0x785c('0xc')]+=0x1;updateWaitingCounter(_0x16cc5c);}}_0x16cc5c[_0x785c('0xa')]+=0x1;return _0x16cc5c;}function getLastMessageText(_0x4fa15c){return db[_0x785c('0xf')][_0x785c('0x10')]({'where':{'$and':[{'MailInteractionId':_0x4fa15c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x785c('0x11')],'order':_0x785c('0x12'),'raw':!![]})[_0x785c('0x13')](function(_0x2df574){if(_0x2df574&&_0x2df574[_0x785c('0x11')]){_0x4fa15c[_0x785c('0x14')]=_[_0x785c('0x15')](_0x2df574['plainBody']);}return _0x4fa15c;})[_0x785c('0x16')](function(_0xbced69){throw _0xbced69;});}exports['updateInteraction']=function(_0x150327,_0x2f834c,_0x7c1777,_0x2aa557){return new Promise(function(_0x216fdd,_0x54b9f7){return getInteractionUsers(_0x150327['id'],_0x7c1777)[_0x785c('0x13')](function(_0x4bc21d){_0x150327['Users']=_0x4bc21d;return getInteractionTags(_0x150327[_0x785c('0x17')],_0x2f834c);})[_0x785c('0x13')](function(_0x3eb8d3){_0x150327[_0x785c('0x18')]=_0x3eb8d3;delete _0x150327['TagIds'];return updateInteractionCounters(_0x150327);})[_0x785c('0x13')](function(_0x118397){if(_0x2aa557){return getLastMessageText(_0x118397);}else{return _0x118397;}})[_0x785c('0x13')](function(_0x55acd4){_0x216fdd(_0x55acd4);})[_0x785c('0x16')](function(_0x3145c6){_0x54b9f7(_0x3145c6);});});}; \ No newline at end of file +var _0x48c3=['Tags','../../mysqldb','map','fullname','forEach','waiting','unmanaged','abandoned','closed','disposition','UserId','answered','talking','total','MailMessage','out','-id','then','lastMsgText','trimStart','plainBody','catch','Users'];(function(_0xbe8bd7,_0x276d22){var _0x3f43f7=function(_0x34794c){while(--_0x34794c){_0xbe8bd7['push'](_0xbe8bd7['shift']());}};_0x3f43f7(++_0x276d22);}(_0x48c3,0x19f));var _0x348c=function(_0x162571,_0xe3eb11){_0x162571=_0x162571-0x0;var _0xa2fc15=_0x48c3[_0x162571];return _0xa2fc15;};'use strict';var _=require('lodash');var db=require(_0x348c('0x0'))['db'];function getInteractionUsers(_0x3f64ed,_0x58bfce){return new Promise(function(_0x4520e8,_0x247e01){try{var _0x19a9c7=[];if(_0x58bfce[_0x3f64ed]){_0x19a9c7=_0x58bfce[_0x3f64ed][_0x348c('0x1')](function(_0x27ee8e){return{'id':_0x27ee8e['id'],'fullname':_0x27ee8e[_0x348c('0x2')]};});}return _0x4520e8(_0x19a9c7);}catch(_0x2255d9){_0x247e01(_0x2255d9);}});}function getInteractionTags(_0x4536da,_0x5efa68){var _0x17285c=[];if(_0x4536da){_0x4536da['split'](',')[_0x348c('0x3')](function(_0x341cee){_0x17285c['push'](_0x5efa68[_0x341cee]);});}return _0x17285c;}function updateWaitingCounter(_0x15a1f4){if(_0x15a1f4[_0x348c('0x4')]){_0x15a1f4[_0x348c('0x4')]-=0x1;}}function updateInteractionCounters(_0x39081b){_0x39081b['waiting']=0x0;_0x39081b['talking']=0x0;_0x39081b['answered']=0x0;_0x39081b[_0x348c('0x5')]=0x0;_0x39081b[_0x348c('0x6')]=0x0;_0x39081b['total']=0x0;if(_0x39081b[_0x348c('0x7')]){if(_0x39081b[_0x348c('0x8')]===_0x348c('0x6')){_0x39081b[_0x348c('0x6')]+=0x1;updateWaitingCounter(_0x39081b);}if(_0x39081b[_0x348c('0x9')]){_0x39081b[_0x348c('0xa')]+=0x1;if(_0x39081b[_0x348c('0xb')]){_0x39081b['talking']-=0x1;}}else{if(_0x39081b[_0x348c('0x8')]){_0x39081b['unmanaged']+=0x1;updateWaitingCounter(_0x39081b);}}}else{if(!_0x39081b[_0x348c('0x9')]){_0x39081b[_0x348c('0x4')]+=0x1;}if(_0x39081b[_0x348c('0x9')]){_0x39081b[_0x348c('0xb')]+=0x1;updateWaitingCounter(_0x39081b);}}_0x39081b[_0x348c('0xc')]+=0x1;return _0x39081b;}function getLastMessageText(_0x1fbc7c){return db[_0x348c('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1fbc7c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x348c('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x348c('0xf'),'raw':!![]})[_0x348c('0x10')](function(_0x5ce4bc){if(_0x5ce4bc&&_0x5ce4bc['plainBody']){_0x1fbc7c[_0x348c('0x11')]=_[_0x348c('0x12')](_0x5ce4bc[_0x348c('0x13')]);}return _0x1fbc7c;})[_0x348c('0x14')](function(_0x5b24a3){throw _0x5b24a3;});}exports['updateInteraction']=function(_0x134d8c,_0x2833eb,_0x3939a9,_0x4257a1){return new Promise(function(_0x168443,_0x3bbe9f){return getInteractionUsers(_0x134d8c['id'],_0x3939a9)[_0x348c('0x10')](function(_0x1403e8){_0x134d8c[_0x348c('0x15')]=_0x1403e8;return getInteractionTags(_0x134d8c['TagIds'],_0x2833eb);})['then'](function(_0x57b14b){_0x134d8c[_0x348c('0x16')]=_0x57b14b;delete _0x134d8c['TagIds'];return updateInteractionCounters(_0x134d8c);})[_0x348c('0x10')](function(_0x19d22a){if(_0x4257a1){return getLastMessageText(_0x19d22a);}else{return _0x19d22a;}})['then'](function(_0x129616){_0x168443(_0x129616);})['catch'](function(_0xc2df80){_0x3bbe9f(_0xc2df80);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d25c9d9..21aae90 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 _0x3fd9=['openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','toUpperCase','role','stringify','Interaction','then','info','error','exports','lodash','../../mysqldb','../../config/logger'];(function(_0x4a6382,_0x358636){var _0x23270a=function(_0x437f2b){while(--_0x437f2b){_0x4a6382['push'](_0x4a6382['shift']());}};_0x23270a(++_0x358636);}(_0x3fd9,0x129));var _0x93fd=function(_0x50cc9b,_0x3a536f){_0x50cc9b=_0x50cc9b-0x0;var _0x1338e6=_0x3fd9[_0x50cc9b];return _0x1338e6;};'use strict';var _=require(_0x93fd('0x0'));var db=require(_0x93fd('0x1'))['db'];var loggers={'openchannel':require(_0x93fd('0x2'))(_0x93fd('0x3')),'mail':require(_0x93fd('0x2'))(_0x93fd('0x4')),'fax':require(_0x93fd('0x2'))('fax-interactions'),'sms':require(_0x93fd('0x2'))(_0x93fd('0x5')),'chat':require(_0x93fd('0x2'))(_0x93fd('0x6')),'whatsapp':require(_0x93fd('0x2'))(_0x93fd('0x7'))};function getAccountFK(_0x92b167){return _[_0x93fd('0x8')](_0x92b167)+(_0x92b167==='chat'?_0x93fd('0x9'):_0x93fd('0xa'))+'Id';}function getInteractionFK(_0x5c3511){return _['capitalize'](_0x5c3511)+_0x93fd('0xb');}function getInteractionId(_0x86c9d8,_0x596c72,_0x23d19c){if(_0x86c9d8&&_0x86c9d8[_[_0x93fd('0xc')](_0x23d19c)+_0x93fd('0xb')]){return _0x86c9d8[_[_0x93fd('0xc')](_0x23d19c)+_0x93fd('0xb')];}else if(_0x86c9d8&&_0x86c9d8['id']){return _0x86c9d8['id'];}else if(_0x596c72&&_0x596c72['id']){return _0x596c72['id'];}else{return _0x93fd('0xd');}}function getInteractionsTables(_0x2c4db1){return{'accounts':_0x2c4db1+'_'+(_0x2c4db1===_0x93fd('0xe')?_0x93fd('0xf'):_0x93fd('0x10')),'interactions':_0x2c4db1+_0x93fd('0x11'),'interactionsTags':_0x2c4db1+'_interaction_has_tags','messages':_0x2c4db1+_0x93fd('0x12'),'userInteractions':_0x93fd('0x13')+_0x2c4db1+_0x93fd('0x11')};}function getSelectedTags(_0x37b5be){var _0x29039c=[];if(_0x37b5be){_0x29039c=Array[_0x93fd('0x14')](_0x37b5be)?_0x37b5be:[_0x37b5be];}return _0x29039c;}function log(_0x21c170,_0x31e8d6,_0x23a084,_0x3f8d96,_0x407ffc,_0x48275c){loggers[_0x407ffc[_0x93fd('0x15')]()][_0x21c170]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48275c[_0x93fd('0x16')](),_0x31e8d6?_0x31e8d6['id']:null,_0x31e8d6?_0x31e8d6['name']:null,_0x31e8d6?_0x31e8d6[_0x93fd('0x17')]:null,getInteractionId(_0x23a084,_0x3f8d96,_0x407ffc),_0x23a084?JSON[_0x93fd('0x18')](_0x23a084):'null');}function updateUser(_0x220eb7,_0x11bcd6,_0x20acc0,_0x15510c,_0x382d49){db[_['upperFirst'](_0x15510c)+_0x93fd('0x19')]['findOne']({'where':{'id':getInteractionId(_0x11bcd6,_0x20acc0,_0x15510c)}})['then'](function(_0x41452f){if(_0x41452f){return _0x41452f['update']({'UserId':_0x220eb7?_0x220eb7['id']:null});}})[_0x93fd('0x1a')](function(_0x177a8d){if(_0x177a8d){log(_0x93fd('0x1b'),_0x220eb7,_0x11bcd6,_0x20acc0,_0x15510c,_0x382d49);}})['catch'](function(){log(_0x93fd('0x1c'),_0x220eb7,_0x11bcd6,_0x20acc0,_0x15510c,_0x382d49);});}module[_0x93fd('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x21d7=['exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','update','then','info','catch'];(function(_0x448986,_0xf3d430){var _0xce5b6e=function(_0xca956c){while(--_0xca956c){_0x448986['push'](_0x448986['shift']());}};_0xce5b6e(++_0xf3d430);}(_0x21d7,0x106));var _0x721d=function(_0x13351c,_0x514ea2){_0x13351c=_0x13351c-0x0;var _0xe8fdf4=_0x21d7[_0x13351c];return _0xe8fdf4;};'use strict';var _=require('lodash');var db=require(_0x721d('0x0'))['db'];var loggers={'openchannel':require(_0x721d('0x1'))(_0x721d('0x2')),'mail':require(_0x721d('0x1'))(_0x721d('0x3')),'fax':require(_0x721d('0x1'))(_0x721d('0x4')),'sms':require(_0x721d('0x1'))(_0x721d('0x5')),'chat':require(_0x721d('0x1'))('chat-interactions'),'whatsapp':require(_0x721d('0x1'))(_0x721d('0x6'))};function getAccountFK(_0x168fb4){return _[_0x721d('0x7')](_0x168fb4)+(_0x168fb4===_0x721d('0x8')?_0x721d('0x9'):'Account')+'Id';}function getInteractionFK(_0xced797){return _[_0x721d('0x7')](_0xced797)+_0x721d('0xa');}function getInteractionId(_0x1653bd,_0x4f8ae2,_0x26b08d){if(_0x1653bd&&_0x1653bd[_[_0x721d('0xb')](_0x26b08d)+_0x721d('0xa')]){return _0x1653bd[_[_0x721d('0xb')](_0x26b08d)+_0x721d('0xa')];}else if(_0x1653bd&&_0x1653bd['id']){return _0x1653bd['id'];}else if(_0x4f8ae2&&_0x4f8ae2['id']){return _0x4f8ae2['id'];}else{return _0x721d('0xc');}}function getInteractionsTables(_0x1d1ffb){return{'accounts':_0x1d1ffb+'_'+(_0x1d1ffb===_0x721d('0x8')?'websites':_0x721d('0xd')),'interactions':_0x1d1ffb+_0x721d('0xe'),'interactionsTags':_0x1d1ffb+_0x721d('0xf'),'messages':_0x1d1ffb+'_messages','userInteractions':'user_has_'+_0x1d1ffb+'_interactions'};}function getSelectedTags(_0x32606b){var _0x2acba7=[];if(_0x32606b){_0x2acba7=Array[_0x721d('0x10')](_0x32606b)?_0x32606b:[_0x32606b];}return _0x2acba7;}function log(_0x3ea938,_0x4fdf0d,_0x391db3,_0x1fcd29,_0x22b7c0,_0x48589a){loggers[_0x22b7c0['toLowerCase']()][_0x3ea938](_0x721d('0x11'),_0x48589a[_0x721d('0x12')](),_0x4fdf0d?_0x4fdf0d['id']:null,_0x4fdf0d?_0x4fdf0d[_0x721d('0x13')]:null,_0x4fdf0d?_0x4fdf0d[_0x721d('0x14')]:null,getInteractionId(_0x391db3,_0x1fcd29,_0x22b7c0),_0x391db3?JSON[_0x721d('0x15')](_0x391db3):'null');}function updateUser(_0x312c8f,_0x25a372,_0x5603f9,_0x58ee0d,_0x563c24){db[_[_0x721d('0xb')](_0x58ee0d)+_0x721d('0x16')][_0x721d('0x17')]({'where':{'id':getInteractionId(_0x25a372,_0x5603f9,_0x58ee0d)}})['then'](function(_0x105e0c){if(_0x105e0c){return _0x105e0c[_0x721d('0x18')]({'UserId':_0x312c8f?_0x312c8f['id']:null});}})[_0x721d('0x19')](function(_0x1826a0){if(_0x1826a0){log(_0x721d('0x1a'),_0x312c8f,_0x25a372,_0x5603f9,_0x58ee0d,_0x563c24);}})[_0x721d('0x1b')](function(){log('error',_0x312c8f,_0x25a372,_0x5603f9,_0x58ee0d,_0x563c24);});}module[_0x721d('0x1c')]={'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 6036662..d573d40 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 _0x4358=['catch','User','admin','user','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x1274c4,_0x3a22f0){var _0x151346=function(_0x5836a2){while(--_0x5836a2){_0x1274c4['push'](_0x1274c4['shift']());}};_0x151346(++_0x3a22f0);}(_0x4358,0x65));var _0x8435=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x4358[_0x585d81];return _0x1aca0d;};'use strict';var crypto=require(_0x8435('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x8435('0x1'))['db'];var config=require(_0x8435('0x2'));function getValueFromLicense(_0x15a229,_0x4f5f24){if(_0x15a229&&_0x4f5f24){if(_0x4f5f24[_0x8435('0x3')]&&_0x4f5f24['license']){var _0x1e27f2=_0x4f5f24['data1'];var _0x364db5=_0x4f5f24['license'];var _0x5f1058=_0x1e27f2[_0x8435('0x4')]('-')[0x4];var _0x5b4eb5=_0x1e27f2['split']('-')[0x0];var _0x18e282=crypto[_0x8435('0x5')](_0x8435('0x6'),util[_0x8435('0x7')]('%s:%s:%s',_0x5f1058,_0x1e27f2,_0x5b4eb5));var _0x5b56ea=_0x18e282[_0x8435('0x8')](_0x364db5,_0x8435('0x9'),_0x8435('0xa'));_0x5b56ea+=_0x18e282[_0x8435('0xb')]('utf8');var _0x2d57c9=JSON[_0x8435('0xc')](_0x5b56ea);return _0x2d57c9['hasOwnProperty'](_0x15a229)?_0x2d57c9[_0x15a229]:null;}}return null;}function isLimit(_0x2cc43c,_0xad7ec6,_0x4e582c,_0x3cb6ba){var _0x324009=_0xad7ec6;return compose()[_0x8435('0xd')](function(_0x17afea,_0x1bd552,_0x130515){return db['License'][_0x8435('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x8435('0xf')](function(_0x1073fb){var _0x3f9a2c=getValueFromLicense(_0x2cc43c,_0x1073fb);return _0x3f9a2c?_0x3f9a2c:_0x324009;})['then'](function(_0x4c32c6){_0x324009=_0x4c32c6;return _0x4e582c['count'](_0x3cb6ba);})['then'](function(_0x3543c1){if(_0x3543c1>=_0x324009){return _0x1bd552[_0x8435('0x10')](0x193)[_0x8435('0x11')]({'message':util[_0x8435('0x7')](_0x8435('0x12'),_0x2cc43c)});}_0x130515();})[_0x8435('0x13')](function(_0x3f409e){_0x130515(_0x3f409e);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x8435('0x14')],{'where':{'$or':[{'role':_0x8435('0x15')},{'role':_0x8435('0x16')}]}});}exports[_0x8435('0x17')]=isUserLimit; \ No newline at end of file +var _0xf96d=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','hasOwnProperty','use','License','findOne','then','status','json'];(function(_0x1e0518,_0x165d09){var _0x2d6cbd=function(_0x2a4612){while(--_0x2a4612){_0x1e0518['push'](_0x1e0518['shift']());}};_0x2d6cbd(++_0x165d09);}(_0xf96d,0x13e));var _0xdf96=function(_0x1225bc,_0x1c2418){_0x1225bc=_0x1225bc-0x0;var _0x23fd99=_0xf96d[_0x1225bc];return _0x23fd99;};'use strict';var crypto=require('crypto');var util=require(_0xdf96('0x0'));var compose=require(_0xdf96('0x1'));var db=require(_0xdf96('0x2'))['db'];var config=require(_0xdf96('0x3'));function getValueFromLicense(_0x2449b1,_0x40cf9b){if(_0x2449b1&&_0x40cf9b){if(_0x40cf9b[_0xdf96('0x4')]&&_0x40cf9b[_0xdf96('0x5')]){var _0x46d54c=_0x40cf9b[_0xdf96('0x4')];var _0x51be03=_0x40cf9b['license'];var _0x244c52=_0x46d54c[_0xdf96('0x6')]('-')[0x4];var _0x121b7f=_0x46d54c[_0xdf96('0x6')]('-')[0x0];var _0xa5ada8=crypto[_0xdf96('0x7')](_0xdf96('0x8'),util[_0xdf96('0x9')]('%s:%s:%s',_0x244c52,_0x46d54c,_0x121b7f));var _0x4ad50e=_0xa5ada8[_0xdf96('0xa')](_0x51be03,'base64',_0xdf96('0xb'));_0x4ad50e+=_0xa5ada8[_0xdf96('0xc')](_0xdf96('0xb'));var _0x4da14d=JSON['parse'](_0x4ad50e);return _0x4da14d[_0xdf96('0xd')](_0x2449b1)?_0x4da14d[_0x2449b1]:null;}}return null;}function isLimit(_0x4036e2,_0x4576bd,_0x4ccb85,_0x1baee1){var _0x216d4a=_0x4576bd;return compose()[_0xdf96('0xe')](function(_0x48f878,_0x1cf224,_0x42665c){return db[_0xdf96('0xf')][_0xdf96('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xdf96('0x11')](function(_0x164ffb){var _0x4735a2=getValueFromLicense(_0x4036e2,_0x164ffb);return _0x4735a2?_0x4735a2:_0x216d4a;})[_0xdf96('0x11')](function(_0x191fc2){_0x216d4a=_0x191fc2;return _0x4ccb85['count'](_0x1baee1);})['then'](function(_0x2d3c46){if(_0x2d3c46>=_0x216d4a){return _0x1cf224[_0xdf96('0x12')](0x193)[_0xdf96('0x13')]({'message':util[_0xdf96('0x9')](_0xdf96('0x14'),_0x4036e2)});}_0x42665c();})[_0xdf96('0x15')](function(_0x29f56b){_0x42665c(_0x29f56b);});});}function isUserLimit(){return isLimit(_0xdf96('0x16'),0x1,db[_0xdf96('0x17')],{'where':{'$or':[{'role':_0xdf96('0x18')},{'role':_0xdf96('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0795a79..90602ca 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 _0x3b6b=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','split','slice','forEach','shift','match','indexOf','map','push','buildExpression','operator','$eq','$between','value','includes','add','days','format','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$lt','<\x20?','$gt','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','hours','minutes','seconds'];(function(_0x2dccd7,_0x5cf88a){var _0x395894=function(_0x206e2f){while(--_0x206e2f){_0x2dccd7['push'](_0x2dccd7['shift']());}};_0x395894(++_0x5cf88a);}(_0x3b6b,0x1e6));var _0xb3b6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b6b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb3b6('0x0'));var moment=require(_0xb3b6('0x1'));exports[_0xb3b6('0x2')]=function(_0x756b54){var _0x4b2acf={'conditions':[]};_0x4b2acf[_0xb3b6('0x3')]=_[_0xb3b6('0x4')](_0x756b54,_0xb3b6('0x5'))?'or':'and';var _0x258617=_0x756b54[_0xb3b6('0x6')](_0xb3b6('0x7'),'')[_0xb3b6('0x6')](_0xb3b6('0x5'),'')['split']('||');for(var _0x5cce33=0x0;_0x5cce33<_0x258617[_0xb3b6('0x8')];_0x5cce33++){var _0x5b792e=_0x258617[_0x5cce33][_0xb3b6('0x9')](':=');var _0x258081=_0x5b792e[0x0];var _0x789dec=_0x5b792e[_0xb3b6('0xa')](0x1);_0x789dec[_0xb3b6('0xb')](function(_0x3233e7){var _0x2b8257=_0x3233e7[_0xb3b6('0x9')]('[')[_0xb3b6('0xc')]();var _0x4b9c0b=_0x3233e7[_0xb3b6('0xd')](/\[(.*?)\]/g);_0x4b9c0b[_0xb3b6('0xb')](function(_0x1cf64a){var _0x5f572d=_0x1cf64a[_0xb3b6('0x9')]('[')['filter'](function(_0x545960){return _0x545960[_0xb3b6('0xe')](']')>-0x1;})[_0xb3b6('0xf')](function(_0x5ea601){return _0x5ea601[_0xb3b6('0x9')](']')[0x0];})[0x0];_0x4b2acf['conditions'][_0xb3b6('0x10')]({'field':_0x258081,'operator':_0x2b8257,'value':_0x5f572d});});});}return _0x4b2acf;};exports[_0xb3b6('0x11')]=function(_0x280e7e,_0x1794d5,_0x5e8c11){var _0x326913={};if(_0x1794d5==='DATE'){if(_0x5e8c11[_0xb3b6('0x12')]===_0xb3b6('0x13')){_0x5e8c11['operator']=_0xb3b6('0x14');_0x5e8c11[_0xb3b6('0x15')]+=','+_0x5e8c11[_0xb3b6('0x15')];}else if(_[_0xb3b6('0x16')](['$gt','$lte'],_0x5e8c11['operator'])){_0x5e8c11[_0xb3b6('0x15')]=moment(_0x5e8c11['value'])[_0xb3b6('0x17')](0x1,_0xb3b6('0x18'))[_0xb3b6('0x19')]('YYYY-MM-DD');}}if(_0x5e8c11[_0xb3b6('0x1a')]){_0x1794d5=_0x5e8c11[_0xb3b6('0x1a')];_0x326913['text']=_0xb3b6('0x1b')+_0x280e7e+'.'+_0x5e8c11[_0xb3b6('0x1c')]+_0xb3b6('0x1d')+_0x5e8c11['castTo']+')\x20'+parseOperator(_0x5e8c11[_0xb3b6('0x12')]);}else{_0x326913[_0xb3b6('0x1e')]=_0x280e7e+'.'+_0x5e8c11[_0xb3b6('0x1c')]+'\x20'+parseOperator(_0x5e8c11[_0xb3b6('0x12')]);}if(_['includes']([_0xb3b6('0x1f'),_0xb3b6('0x20')],_0x5e8c11[_0xb3b6('0x12')]))_0x326913[_0xb3b6('0x1e')]='('+_0x326913[_0xb3b6('0x1e')]+'\x20OR\x20'+_0x280e7e+'.'+_0x5e8c11[_0xb3b6('0x1c')]+_0xb3b6('0x21');_0x326913[_0xb3b6('0x15')]=parseValue(_0x1794d5,_0x5e8c11['operator'],_0x5e8c11['value']);return _0x326913;};function parseOperator(_0x2c6cd1){var _0xa69b82;switch(_0x2c6cd1){case _0xb3b6('0x22'):_0xa69b82=_0xb3b6('0x23');break;case'$notIn':_0xa69b82=_0xb3b6('0x24');break;case'$eq':_0xa69b82=_0xb3b6('0x25');break;case'$ne':_0xa69b82=_0xb3b6('0x26');break;case _0xb3b6('0x27'):case'$startsWith':case'$endsWith':_0xa69b82='LIKE\x20?';break;case _0xb3b6('0x28'):_0xa69b82=_0xb3b6('0x29');break;case _0xb3b6('0x2a'):_0xa69b82=_0xb3b6('0x2b');break;case'$lte':_0xa69b82=_0xb3b6('0x2c');break;case'$gte':_0xa69b82='>=\x20?';break;case'$between':_0xa69b82=_0xb3b6('0x2d');break;}return _0xa69b82;}function parseValue(_0x367b1d,_0x274c96,_0x62a972){var _0xc9bce9={'start':undefined,'end':undefined};switch(_0x274c96){case _0xb3b6('0x22'):case'$notIn':_0xc9bce9[_0xb3b6('0x2e')]=_0x62a972['split'](',');break;case _0xb3b6('0x27'):_0xc9bce9[_0xb3b6('0x2e')]='%'+_0x62a972+'%';break;case'$startsWith':_0xc9bce9[_0xb3b6('0x2e')]=_0x62a972+'%';break;case _0xb3b6('0x2f'):_0xc9bce9[_0xb3b6('0x2e')]='%'+_0x62a972;break;case _0xb3b6('0x14'):var _0x12e957=_0x62a972[_0xb3b6('0x9')](',');var _0x62a972=_0x12e957[_0xb3b6('0xc')]();var _0x3ea641=_0x12e957[_0xb3b6('0x30')]();if(_0x367b1d===_0xb3b6('0x31')){_0x62a972=moment(_0x62a972)[_0xb3b6('0x32')](0x0,!![])[_0xb3b6('0x19')]();_0x3ea641=moment(_0x3ea641)[_0xb3b6('0x32')](0x0,!![])['add'](0x17,_0xb3b6('0x33'))[_0xb3b6('0x17')](0x3b,_0xb3b6('0x34'))[_0xb3b6('0x17')](0x3b,_0xb3b6('0x35'))[_0xb3b6('0x19')]();}_0xc9bce9={'start':_0x62a972,'end':_0x3ea641};break;default:_0xc9bce9['start']=_0x62a972;break;}return _0xc9bce9;} \ No newline at end of file +var _0xa48a=['length','slice','forEach','shift','filter','map','push','buildExpression','DATE','operator','$eq','value','$lte','YYYY-MM-DD','castTo','CAST(','field','text','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','$lt','$gt','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','add','minutes','seconds','format','lodash','moment','sqlOperator','startsWith','[$or]','and','[$and]','replace','split'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0xa48a,0x13b));var _0xaa48=function(_0x21a230,_0x45719b){_0x21a230=_0x21a230-0x0;var _0x51899b=_0xa48a[_0x21a230];return _0x51899b;};'use strict';var _=require(_0xaa48('0x0'));var moment=require(_0xaa48('0x1'));exports['parseSearch']=function(_0x2da16f){var _0x506ccd={'conditions':[]};_0x506ccd[_0xaa48('0x2')]=_[_0xaa48('0x3')](_0x2da16f,_0xaa48('0x4'))?'or':_0xaa48('0x5');var _0x2c273a=_0x2da16f['replace'](_0xaa48('0x6'),'')[_0xaa48('0x7')](_0xaa48('0x4'),'')[_0xaa48('0x8')]('||');for(var _0x25e48d=0x0;_0x25e48d<_0x2c273a[_0xaa48('0x9')];_0x25e48d++){var _0x20935a=_0x2c273a[_0x25e48d][_0xaa48('0x8')](':=');var _0x53b35b=_0x20935a[0x0];var _0x6c12cc=_0x20935a[_0xaa48('0xa')](0x1);_0x6c12cc[_0xaa48('0xb')](function(_0x2b3859){var _0x26e001=_0x2b3859[_0xaa48('0x8')]('[')[_0xaa48('0xc')]();var _0x52b34f=_0x2b3859['match'](/\[(.*?)\]/g);_0x52b34f[_0xaa48('0xb')](function(_0x4693c0){var _0x154c64=_0x4693c0['split']('[')[_0xaa48('0xd')](function(_0x4d0865){return _0x4d0865['indexOf'](']')>-0x1;})[_0xaa48('0xe')](function(_0x7884ff){return _0x7884ff['split'](']')[0x0];})[0x0];_0x506ccd['conditions'][_0xaa48('0xf')]({'field':_0x53b35b,'operator':_0x26e001,'value':_0x154c64});});});}return _0x506ccd;};exports[_0xaa48('0x10')]=function(_0xcc0bdb,_0x4a6818,_0x1f2b55){var _0x5ee8cb={};if(_0x4a6818===_0xaa48('0x11')){if(_0x1f2b55[_0xaa48('0x12')]===_0xaa48('0x13')){_0x1f2b55[_0xaa48('0x12')]='$between';_0x1f2b55['value']+=','+_0x1f2b55[_0xaa48('0x14')];}else if(_['includes'](['$gt',_0xaa48('0x15')],_0x1f2b55[_0xaa48('0x12')])){_0x1f2b55['value']=moment(_0x1f2b55['value'])['add'](0x1,'days')['format'](_0xaa48('0x16'));}}if(_0x1f2b55[_0xaa48('0x17')]){_0x4a6818=_0x1f2b55[_0xaa48('0x17')];_0x5ee8cb['text']=_0xaa48('0x18')+_0xcc0bdb+'.'+_0x1f2b55[_0xaa48('0x19')]+'\x20AS\x20'+_0x1f2b55[_0xaa48('0x17')]+')\x20'+parseOperator(_0x1f2b55[_0xaa48('0x12')]);}else{_0x5ee8cb[_0xaa48('0x1a')]=_0xcc0bdb+'.'+_0x1f2b55[_0xaa48('0x19')]+'\x20'+parseOperator(_0x1f2b55[_0xaa48('0x12')]);}if(_[_0xaa48('0x1b')](['$ne',_0xaa48('0x1c')],_0x1f2b55[_0xaa48('0x12')]))_0x5ee8cb['text']='('+_0x5ee8cb[_0xaa48('0x1a')]+_0xaa48('0x1d')+_0xcc0bdb+'.'+_0x1f2b55[_0xaa48('0x19')]+_0xaa48('0x1e');_0x5ee8cb[_0xaa48('0x14')]=parseValue(_0x4a6818,_0x1f2b55['operator'],_0x1f2b55['value']);return _0x5ee8cb;};function parseOperator(_0x34ed4d){var _0x3e6fc9;switch(_0x34ed4d){case _0xaa48('0x1f'):_0x3e6fc9=_0xaa48('0x20');break;case'$notIn':_0x3e6fc9=_0xaa48('0x21');break;case _0xaa48('0x13'):_0x3e6fc9=_0xaa48('0x22');break;case _0xaa48('0x23'):_0x3e6fc9=_0xaa48('0x24');break;case _0xaa48('0x25'):case'$startsWith':case _0xaa48('0x26'):_0x3e6fc9='LIKE\x20?';break;case _0xaa48('0x27'):_0x3e6fc9='<\x20?';break;case _0xaa48('0x28'):_0x3e6fc9='>\x20?';break;case _0xaa48('0x15'):_0x3e6fc9=_0xaa48('0x29');break;case _0xaa48('0x2a'):_0x3e6fc9=_0xaa48('0x2b');break;case _0xaa48('0x2c'):_0x3e6fc9=_0xaa48('0x2d');break;}return _0x3e6fc9;}function parseValue(_0x2ed040,_0x4b1014,_0x49303b){var _0x2b673c={'start':undefined,'end':undefined};switch(_0x4b1014){case'$in':case _0xaa48('0x1c'):_0x2b673c[_0xaa48('0x2e')]=_0x49303b[_0xaa48('0x8')](',');break;case _0xaa48('0x25'):_0x2b673c['start']='%'+_0x49303b+'%';break;case _0xaa48('0x2f'):_0x2b673c[_0xaa48('0x2e')]=_0x49303b+'%';break;case _0xaa48('0x26'):_0x2b673c[_0xaa48('0x2e')]='%'+_0x49303b;break;case _0xaa48('0x2c'):var _0x4cb67e=_0x49303b[_0xaa48('0x8')](',');var _0x49303b=_0x4cb67e['shift']();var _0x39a26e=_0x4cb67e[_0xaa48('0x30')]();if(_0x2ed040===_0xaa48('0x11')){_0x49303b=moment(_0x49303b)[_0xaa48('0x31')](0x0,!![])['format']();_0x39a26e=moment(_0x39a26e)[_0xaa48('0x31')](0x0,!![])['add'](0x17,'hours')[_0xaa48('0x32')](0x3b,_0xaa48('0x33'))[_0xaa48('0x32')](0x3b,_0xaa48('0x34'))[_0xaa48('0x35')]();}_0x2b673c={'start':_0x49303b,'end':_0x39a26e};break;default:_0x2b673c[_0xaa48('0x2e')]=_0x49303b;break;}return _0x2b673c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d725be6..69c98a4 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 _0xaaae=['$id','intersection','model','attributes','offset','sort','where','pick','filter','object','columns','name','value','VIRTUAL','lower','merge','options','includeAll','include','sequelize','../../mysqldb','parse','keys','fields','raw','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','subtract','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','split','forEach','replace','push','join','getOptions','query'];(function(_0x7a319d,_0x235959){var _0x5c6b4e=function(_0x2e5b17){while(--_0x2e5b17){_0x7a319d['push'](_0x7a319d['shift']());}};_0x5c6b4e(++_0x235959);}(_0xaaae,0x10b));var _0xeaaa=function(_0x4e76f8,_0x3f2cdd){_0x4e76f8=_0x4e76f8-0x0;var _0x3cdb06=_0xaaae[_0x4e76f8];return _0x3cdb06;};'use strict';var _=require('lodash');var sequelize=require(_0xeaaa('0x0'));var moment=require('moment');var db=require(_0xeaaa('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x34f63c){var _0x2a9165=['ne'];try{var _0x395176=JSON[_0xeaaa('0x2')](_0x34f63c);var _0x464378=Object['keys'](_0x395176)[0x0];return _0x2a9165['includes'](_0x464378);}catch(_0x2cefb7){return![];}}function getOperatorValue(_0x1e6e38){var _0x2660e0=JSON[_0xeaaa('0x2')](_0x1e6e38);var _0x1de6a5=Object[_0xeaaa('0x3')](_0x2660e0)[0x0];var _0x5eb9a8=_0x2660e0[_0x1de6a5];return{['$'+_0x1de6a5]:_0x5eb9a8};}function parseIncludeModel(_0x167507){var _0x2f248e=JSON['parse'](_0x167507);return{'model':db[_0x2f248e['model']],'as':_0x2f248e['alias'],'attributes':_0x2f248e[_0xeaaa('0x4')],'raw':_0x2f248e[_0xeaaa('0x5')]};}exports[_0xeaaa('0x4')]=function(_0x3cc2f3){var _0xd990de=null;if(_0x3cc2f3){_0xd990de=_0x3cc2f3['split'](',');}return _0xd990de;};exports[_0xeaaa('0x6')]=function(_0x428a0c,_0x49d210){var _0x3714a4={};if(!_[_0xeaaa('0x7')](_0x428a0c)){_['forOwn'](_0x428a0c,function(_0x9b977e,_0x3befd1){try{if(_0x49d210){var _0x57d15f=_[_0xeaaa('0x8')](_0x49d210,{'name':_0x3befd1})||{};if(hasSequelizeOperator(_0x9b977e)){_0x3714a4[_0x3befd1]=getOperatorValue(_0x9b977e);}else if(_0x57d15f[_0xeaaa('0x9')]===_0xeaaa('0xa')&&_[_0xeaaa('0xb')](_0x9b977e)){var _0x12486f=JSON[_0xeaaa('0x2')](_0x9b977e);var _0x630cb2={'$gte':moment(moment(_0x12486f[_0xeaaa('0xc')])[_0xeaaa('0xd')](_0xeaaa('0xe')))['utc']()[_0xeaaa('0xd')](),'$lte':moment(moment(_0x12486f['$lte'])[_0xeaaa('0xd')](_0xeaaa('0xe')))['utc']()[_0xeaaa('0xf')](0x1,'s')[_0xeaaa('0xd')]()};_0x3714a4[_0x3befd1]=_0x630cb2;}else if(_0x57d15f['name']==='uniqueid'){_0x3714a4[_0x3befd1]=_0x9b977e;}else{_0x3714a4[_0x3befd1]=_['isArray'](_0x9b977e)?_0x9b977e:JSON[_0xeaaa('0x2')](_0x9b977e);}}else{_0x3714a4[_0x3befd1]=_[_0xeaaa('0x10')](_0x9b977e)?_0x9b977e:JSON[_0xeaaa('0x2')](_0x9b977e);}}catch(_0x5aa708){_0x3714a4[_0x3befd1]=_0x9b977e['split'](',');}});}return _0x3714a4;};exports[_0xeaaa('0x11')]=function(_0x166698){_0x166698=parseInt(_0x166698,0xa);if(!_0x166698||_0x166698<0x0){_0x166698=LIMIT_VALUE;}return _0x166698;};exports['offset']=function(_0x2237d4){_0x2237d4=parseInt(_0x2237d4,0xa);if(!_0x2237d4||_0x2237d4<0x0){_0x2237d4=0x0;}return _0x2237d4;};exports['sort']=function(_0x2257c2){var _0x49b7f7,_0x3a6289=null;if(_0x2257c2){_0x49b7f7=_0x2257c2['split'](',');_0x3a6289=_[_0xeaaa('0x12')](_0x49b7f7,function(_0x16b920){if(_0x16b920[_0xeaaa('0x13')]('-')===0x0){return[_0x16b920===_0xeaaa('0x14')?sequelize[_0xeaaa('0x15')](sequelize[_0xeaaa('0x16')](_0xeaaa('0x14')),_0xeaaa('0x17')):_0x16b920[_0xeaaa('0x18')](0x1),'DESC'];}else{return[_0x16b920===_0xeaaa('0x14')?sequelize['cast'](sequelize['col'](_0xeaaa('0x14')),_0xeaaa('0x17')):_0x16b920,'ASC'];}});}return _0x3a6289;};exports[_0xeaaa('0x19')]=function(_0x535b8e,_0x3a511a){if(_[_0xeaaa('0x7')](_0x535b8e)){return _0x535b8e;}if(_[_0xeaaa('0x10')](_0x535b8e)){for(var _0xcaa47c=0x0;_0xcaa47c<_0x535b8e[_0xeaaa('0x1a')];_0xcaa47c+=0x1){_0x535b8e[_0xcaa47c]=this[_0xeaaa('0x19')](_0x535b8e[_0xcaa47c],_0x3a511a);}return _0x535b8e;}if(!_['isObject'](_0x535b8e)){return _0x535b8e;}if(_[_0xeaaa('0x1b')](_0x3a511a)){_0x3a511a=[_0x3a511a];}if(!_[_0xeaaa('0x10')](_0x3a511a)){return _0x535b8e;}for(var _0x41c036=0x0;_0x41c036<_0x3a511a['length'];_0x41c036+=0x1){_[_0xeaaa('0x1c')](_0x535b8e,_0x3a511a[_0x41c036]);}for(var _0x24cc55 in _0x535b8e){if(_0x535b8e[_0xeaaa('0x1d')](_0x24cc55)){_0x535b8e[_0x24cc55]=this[_0xeaaa('0x19')](_0x535b8e[_0x24cc55],_0x3a511a);}}return _0x535b8e;};exports[_0xeaaa('0x1e')]=function(_0x3ebdb9){return _0x3ebdb9[_0xeaaa('0x1f')](RegExp(_0xeaaa('0x20')))?!![]:![];};exports[_0xeaaa('0x21')]=function(_0x125058){return _0x125058[_0xeaaa('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xeaaa('0x22')]=function(_0x7bcb4e,_0x1e36f2){var _0x421f65=[];var _0x2894ae=/[ `!@#$%^&*()_\-?~]/;var _0x386583=_0x1e36f2?'\x22{EXPR}\x22':_0xeaaa('0x23');_0x7bcb4e[_0xeaaa('0x24')](/[ ,]+/)[_0xeaaa('0x25')](function(_0x43ff07){_0x43ff07=_0x43ff07[_0xeaaa('0x26')](/([^:]")"+/g,'$1');_0x43ff07='+'+_0x43ff07+'*';var _0xe26ece=_0x43ff07[_0xeaaa('0x1f')](_0x2894ae);if(_0xe26ece){_0x43ff07='\x22'+_0x43ff07+'\x22';}_0x421f65[_0xeaaa('0x27')](_0x43ff07);});_0x386583=_0x386583['replace'](_0xeaaa('0x23'),_0x421f65[_0xeaaa('0x28')]('\x20'));return _0x386583;};exports[_0xeaaa('0x29')]=function(_0x354cfb,_0x5ad473,_0x39ef1a){var _0x309122={},_0x1b16a8={};if(_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x2b')]){_0x5ad473[_0xeaaa('0x2a')]['id']=_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x2b')];delete _0x5ad473[_0xeaaa('0x2a')]['$id'];}_0x309122['model']=_['map'](_0x354cfb,'name');_0x309122['query']=_[_0xeaaa('0x3')](_0x5ad473['query']);_0x309122[_0xeaaa('0x6')]=_[_0xeaaa('0x2c')](_0x309122[_0xeaaa('0x2d')],_0x309122[_0xeaaa('0x2a')]);_0x1b16a8[_0xeaaa('0x2e')]=_[_0xeaaa('0x2c')](_0x309122['model'],this[_0xeaaa('0x4')](_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x4')]));_0x1b16a8[_0xeaaa('0x2e')]=_0x1b16a8[_0xeaaa('0x2e')][_0xeaaa('0x1a')]?_0x1b16a8[_0xeaaa('0x2e')]:_0x309122[_0xeaaa('0x2d')];if(!_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x1d')]('nolimit')){_0x1b16a8['limit']=this[_0xeaaa('0x11')](_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x11')]);_0x1b16a8[_0xeaaa('0x2f')]=this['offset'](_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x2f')]);}_0x1b16a8['order']=this[_0xeaaa('0x30')](_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x30')]);_0x1b16a8[_0xeaaa('0x31')]=this['filters'](_[_0xeaaa('0x32')](_0x5ad473['query'],_0x309122[_0xeaaa('0x6')]),_0x354cfb);if(_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x33')]){var _0x493a87=_0x354cfb;var _0x5ef4bc=_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x33')];if(typeof _0x5ef4bc===_0xeaaa('0x34')){_0x493a87=_[_0xeaaa('0x33')](_0x354cfb,function(_0xbb6edb){return _['includes'](_0x5ef4bc[_0xeaaa('0x35')],_0xbb6edb[_0xeaaa('0x36')]);});_0x5ef4bc=_0x5ef4bc[_0xeaaa('0x37')];}_0x1b16a8[_0xeaaa('0x31')]=_['merge'](_0x1b16a8['where'],{'$or':_[_0xeaaa('0x12')](_0x493a87,function(_0x42f865){if(_0x42f865[_0xeaaa('0x9')]!==_0xeaaa('0x38')){if(_0x39ef1a){return sequelize[_0xeaaa('0x31')](sequelize['fn']('lower',sequelize[_0xeaaa('0x16')](_0x42f865[_0xeaaa('0x36')])),{'$like':sequelize['fn'](_0xeaaa('0x39'),'%'+_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x33')]+'%')});}else{var _0x1bbdd7={};_0x1bbdd7[_0x42f865['name']]={'$like':'%'+_0x5ad473[_0xeaaa('0x2a')][_0xeaaa('0x33')]+'%'};return _0x1bbdd7;}}})});}_0x1b16a8=_[_0xeaaa('0x3a')]({},_0x1b16a8,_0x5ad473[_0xeaaa('0x3b')]);return _0x1b16a8;};exports['include']=function(_0x2f6108){var _0x66f600=[];if(_0x2f6108[_0xeaaa('0x3c')]){_0x66f600[_0xeaaa('0x27')]({'all':!![]});}else if(_0x2f6108[_0xeaaa('0x3d')]){if(Array[_0xeaaa('0x10')](_0x2f6108[_0xeaaa('0x3d')])){_0x66f600=Object[_0xeaaa('0x3')](_0x2f6108[_0xeaaa('0x3d')])[_0xeaaa('0x12')](function(_0x4d62f8){return parseIncludeModel(_0x2f6108[_0xeaaa('0x3d')][_0x4d62f8]);});}else{var _0x4797f9=parseIncludeModel(_0x2f6108[_0xeaaa('0x3d')]);_0x66f600[_0xeaaa('0x27')](_0x4797f9);}}return _0x66f600;}; \ No newline at end of file +var _0x8f4e=['limit','order','where','pick','filter','object','value','merge','type','VIRTUAL','lower','options','include','includeAll','lodash','moment','../../mysqldb','parse','keys','includes','model','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','$lte','format','name','isArray','split','offset','sort','map','priority','cast','col','unsigned','substr','ASC','length','omit','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','forEach','push','replace','getOptions','query','$id','intersection','attributes','nolimit'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x8f4e,0x149));var _0xe8f4=function(_0x3a1d02,_0xe750a0){_0x3a1d02=_0x3a1d02-0x0;var _0x130aa2=_0x8f4e[_0x3a1d02];return _0x130aa2;};'use strict';var _=require(_0xe8f4('0x0'));var sequelize=require('sequelize');var moment=require(_0xe8f4('0x1'));var db=require(_0xe8f4('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x42326d){var _0x4cbe76=['ne'];try{var _0x1a9c39=JSON[_0xe8f4('0x3')](_0x42326d);var _0x3f734b=Object[_0xe8f4('0x4')](_0x1a9c39)[0x0];return _0x4cbe76[_0xe8f4('0x5')](_0x3f734b);}catch(_0xcf6d41){return![];}}function getOperatorValue(_0x4d2238){var _0x37c911=JSON[_0xe8f4('0x3')](_0x4d2238);var _0x42da60=Object[_0xe8f4('0x4')](_0x37c911)[0x0];var _0x3d6720=_0x37c911[_0x42da60];return{['$'+_0x42da60]:_0x3d6720};}function parseIncludeModel(_0x18a49e){var _0x5cc30f=JSON[_0xe8f4('0x3')](_0x18a49e);return{'model':db[_0x5cc30f[_0xe8f4('0x6')]],'as':_0x5cc30f['alias'],'attributes':_0x5cc30f['fields'],'raw':_0x5cc30f['raw']};}exports[_0xe8f4('0x7')]=function(_0x410a12){var _0x58b66b=null;if(_0x410a12){_0x58b66b=_0x410a12['split'](',');}return _0x58b66b;};exports[_0xe8f4('0x8')]=function(_0xc6fb15,_0x6c2dd8){var _0x2c5f39={};if(!_[_0xe8f4('0x9')](_0xc6fb15)){_[_0xe8f4('0xa')](_0xc6fb15,function(_0x250ed2,_0x415dd7){try{if(_0x6c2dd8){var _0x553b03=_[_0xe8f4('0xb')](_0x6c2dd8,{'name':_0x415dd7})||{};if(hasSequelizeOperator(_0x250ed2)){_0x2c5f39[_0x415dd7]=getOperatorValue(_0x250ed2);}else if(_0x553b03['type']===_0xe8f4('0xc')&&_[_0xe8f4('0xd')](_0x250ed2)){var _0xc57843=JSON[_0xe8f4('0x3')](_0x250ed2);var _0x166858={'$gte':moment(moment(_0xc57843[_0xe8f4('0xe')])['format'](_0xe8f4('0xf')))['utc']()['format'](),'$lte':moment(moment(_0xc57843[_0xe8f4('0x10')])[_0xe8f4('0x11')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')['format']()};_0x2c5f39[_0x415dd7]=_0x166858;}else if(_0x553b03[_0xe8f4('0x12')]==='uniqueid'){_0x2c5f39[_0x415dd7]=_0x250ed2;}else{_0x2c5f39[_0x415dd7]=_[_0xe8f4('0x13')](_0x250ed2)?_0x250ed2:JSON['parse'](_0x250ed2);}}else{_0x2c5f39[_0x415dd7]=_[_0xe8f4('0x13')](_0x250ed2)?_0x250ed2:JSON[_0xe8f4('0x3')](_0x250ed2);}}catch(_0x3d18d7){_0x2c5f39[_0x415dd7]=_0x250ed2[_0xe8f4('0x14')](',');}});}return _0x2c5f39;};exports['limit']=function(_0x42bb1a){_0x42bb1a=parseInt(_0x42bb1a,0xa);if(!_0x42bb1a||_0x42bb1a<0x0){_0x42bb1a=LIMIT_VALUE;}return _0x42bb1a;};exports[_0xe8f4('0x15')]=function(_0x2bbeaa){_0x2bbeaa=parseInt(_0x2bbeaa,0xa);if(!_0x2bbeaa||_0x2bbeaa<0x0){_0x2bbeaa=0x0;}return _0x2bbeaa;};exports[_0xe8f4('0x16')]=function(_0x17212e){var _0x203711,_0x489c70=null;if(_0x17212e){_0x203711=_0x17212e[_0xe8f4('0x14')](',');_0x489c70=_[_0xe8f4('0x17')](_0x203711,function(_0x3f029e){if(_0x3f029e['indexOf']('-')===0x0){return[_0x3f029e===_0xe8f4('0x18')?sequelize[_0xe8f4('0x19')](sequelize[_0xe8f4('0x1a')](_0xe8f4('0x18')),_0xe8f4('0x1b')):_0x3f029e[_0xe8f4('0x1c')](0x1),'DESC'];}else{return[_0x3f029e===_0xe8f4('0x18')?sequelize['cast'](sequelize['col']('priority'),_0xe8f4('0x1b')):_0x3f029e,_0xe8f4('0x1d')];}});}return _0x489c70;};exports['omit']=function(_0x1ee260,_0x5b0b96){if(_['isEmpty'](_0x1ee260)){return _0x1ee260;}if(_[_0xe8f4('0x13')](_0x1ee260)){for(var _0x36ec00=0x0;_0x36ec00<_0x1ee260[_0xe8f4('0x1e')];_0x36ec00+=0x1){_0x1ee260[_0x36ec00]=this[_0xe8f4('0x1f')](_0x1ee260[_0x36ec00],_0x5b0b96);}return _0x1ee260;}if(!_[_0xe8f4('0x20')](_0x1ee260)){return _0x1ee260;}if(_['isString'](_0x5b0b96)){_0x5b0b96=[_0x5b0b96];}if(!_[_0xe8f4('0x13')](_0x5b0b96)){return _0x1ee260;}for(var _0x599b29=0x0;_0x599b29<_0x5b0b96[_0xe8f4('0x1e')];_0x599b29+=0x1){_[_0xe8f4('0x21')](_0x1ee260,_0x5b0b96[_0x599b29]);}for(var _0x6665a8 in _0x1ee260){if(_0x1ee260[_0xe8f4('0x22')](_0x6665a8)){_0x1ee260[_0x6665a8]=this[_0xe8f4('0x1f')](_0x1ee260[_0x6665a8],_0x5b0b96);}}return _0x1ee260;};exports[_0xe8f4('0x23')]=function(_0x4e4881){return _0x4e4881[_0xe8f4('0x24')](RegExp(_0xe8f4('0x25')))?!![]:![];};exports['isEmail']=function(_0x12eaa2){return _0x12eaa2[_0xe8f4('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5a06fc,_0xdede90){var _0x294fbc=[];var _0x1887df=/[ `!@#$%^&*()_\-?~]/;var _0x3e60b7=_0xdede90?_0xe8f4('0x26'):_0xe8f4('0x27');_0x5a06fc[_0xe8f4('0x14')](/[ ,]+/)[_0xe8f4('0x28')](function(_0x32c32e){_0x32c32e=_0x32c32e['replace'](/([^:]")"+/g,'$1');_0x32c32e='+'+_0x32c32e+'*';var _0x857a75=_0x32c32e[_0xe8f4('0x24')](_0x1887df);if(_0x857a75){_0x32c32e='\x22'+_0x32c32e+'\x22';}_0x294fbc[_0xe8f4('0x29')](_0x32c32e);});_0x3e60b7=_0x3e60b7[_0xe8f4('0x2a')]('{EXPR}',_0x294fbc['join']('\x20'));return _0x3e60b7;};exports[_0xe8f4('0x2b')]=function(_0x58313c,_0xc6dad9,_0x39403e){var _0x470a67={},_0x5b098b={};if(_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x2d')]){_0xc6dad9[_0xe8f4('0x2c')]['id']=_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x2d')];delete _0xc6dad9['query']['$id'];}_0x470a67[_0xe8f4('0x6')]=_[_0xe8f4('0x17')](_0x58313c,_0xe8f4('0x12'));_0x470a67['query']=_['keys'](_0xc6dad9[_0xe8f4('0x2c')]);_0x470a67['filters']=_[_0xe8f4('0x2e')](_0x470a67[_0xe8f4('0x6')],_0x470a67['query']);_0x5b098b[_0xe8f4('0x2f')]=_['intersection'](_0x470a67[_0xe8f4('0x6')],this[_0xe8f4('0x7')](_0xc6dad9[_0xe8f4('0x2c')]['fields']));_0x5b098b[_0xe8f4('0x2f')]=_0x5b098b['attributes'][_0xe8f4('0x1e')]?_0x5b098b[_0xe8f4('0x2f')]:_0x470a67['model'];if(!_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x22')](_0xe8f4('0x30'))){_0x5b098b[_0xe8f4('0x31')]=this[_0xe8f4('0x31')](_0xc6dad9['query']['limit']);_0x5b098b[_0xe8f4('0x15')]=this['offset'](_0xc6dad9[_0xe8f4('0x2c')]['offset']);}_0x5b098b[_0xe8f4('0x32')]=this['sort'](_0xc6dad9[_0xe8f4('0x2c')]['sort']);_0x5b098b[_0xe8f4('0x33')]=this[_0xe8f4('0x8')](_[_0xe8f4('0x34')](_0xc6dad9[_0xe8f4('0x2c')],_0x470a67[_0xe8f4('0x8')]),_0x58313c);if(_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x35')]){var _0x1f49a2=_0x58313c;var _0x59dfac=_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x35')];if(typeof _0x59dfac===_0xe8f4('0x36')){_0x1f49a2=_['filter'](_0x58313c,function(_0x107d3f){return _[_0xe8f4('0x5')](_0x59dfac['columns'],_0x107d3f[_0xe8f4('0x12')]);});_0x59dfac=_0x59dfac[_0xe8f4('0x37')];}_0x5b098b['where']=_[_0xe8f4('0x38')](_0x5b098b[_0xe8f4('0x33')],{'$or':_[_0xe8f4('0x17')](_0x1f49a2,function(_0x1131bc){if(_0x1131bc[_0xe8f4('0x39')]!==_0xe8f4('0x3a')){if(_0x39403e){return sequelize[_0xe8f4('0x33')](sequelize['fn'](_0xe8f4('0x3b'),sequelize[_0xe8f4('0x1a')](_0x1131bc[_0xe8f4('0x12')])),{'$like':sequelize['fn'](_0xe8f4('0x3b'),'%'+_0xc6dad9[_0xe8f4('0x2c')][_0xe8f4('0x35')]+'%')});}else{var _0xadd4ef={};_0xadd4ef[_0x1131bc[_0xe8f4('0x12')]]={'$like':'%'+_0xc6dad9[_0xe8f4('0x2c')]['filter']+'%'};return _0xadd4ef;}}})});}_0x5b098b=_[_0xe8f4('0x38')]({},_0x5b098b,_0xc6dad9[_0xe8f4('0x3c')]);return _0x5b098b;};exports[_0xe8f4('0x3d')]=function(_0x89dfb4){var _0x39e4fc=[];if(_0x89dfb4[_0xe8f4('0x3e')]){_0x39e4fc['push']({'all':!![]});}else if(_0x89dfb4[_0xe8f4('0x3d')]){if(Array[_0xe8f4('0x13')](_0x89dfb4['include'])){_0x39e4fc=Object[_0xe8f4('0x4')](_0x89dfb4['include'])['map'](function(_0x3a749d){return parseIncludeModel(_0x89dfb4[_0xe8f4('0x3d')][_0x3a749d]);});}else{var _0x1cdb85=parseIncludeModel(_0x89dfb4[_0xe8f4('0x3d')]);_0x39e4fc[_0xe8f4('0x29')](_0x1cdb85);}}return _0x39e4fc;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index a70f88e..8018c38 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(_0x10f95f,_0xe0a31b){var _0x191874=function(_0x50b95a){while(--_0x50b95a){_0x10f95f['push'](_0x10f95f['shift']());}};_0x191874(++_0xe0a31b);}(_0x46ed,0x168));var _0xd46e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x46ed[_0x40a045];return _0x1a687c;};'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 _0x4819=['queue','destconnectedlinenum','omit','pick','filterAgentAttributes','role','whatsappStatusTime','chatCapacity','mailCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','routealias','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','pause','*pause','busy','isArray','startCase','Queue','findOne','getAgents','all','flatten','map','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','openchannelPause','smsPause','pauseType','globalStatus','split','fields','startsWith','ASC','fullname,internal','internal','indexOf','validateSortParameter','DESC','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime'];(function(_0xfec48e,_0x2590d9){var _0x3c354c=function(_0x1e1f75){while(--_0x1e1f75){_0xfec48e['push'](_0xfec48e['shift']());}};_0x3c354c(++_0x2590d9);}(_0x4819,0xcd));var _0x9481=function(_0x3fa4bd,_0x14a72d){_0x3fa4bd=_0x3fa4bd-0x0;var _0x358c95=_0x4819[_0x3fa4bd];return _0x358c95;};'use strict';var _=require('lodash');var jayson=require(_0x9481('0x0'));var db=require(_0x9481('0x1'))['db'];var amiClient=jayson[_0x9481('0x2')][_0x9481('0x3')]({'port':0x232a});var routingClient=jayson[_0x9481('0x2')][_0x9481('0x3')]({'port':0x232c});function isAgentPaused(_0x40a703,_0x14dc10){var _0xc39edf=[_0x40a703[_0x9481('0x4')],_0x40a703['faxPause'],_0x40a703[_0x9481('0x5')],_0x40a703['openchannelPause'],_0x40a703['smsPause'],_0x40a703[_0x9481('0x6')],_0x40a703[_0x9481('0x7')]];if(!_0x14dc10)return _[_0x9481('0x8')](_0xc39edf);var _0x3278ff=_[_0x9481('0x9')](_0xc39edf);return _0x3278ff['length']>0x0&&_0x3278ff[_0x9481('0xa')]<_0xc39edf['length']?!![]:![];}function isIdle(_0x2fabf1){return _0x2fabf1==='idle'||_0x2fabf1===_0x9481('0xb')||_0x2fabf1===_0x9481('0xc')||_0x2fabf1===_0x9481('0xd')||_[_0x9481('0xe')](_0x2fabf1);}function isAgentIdle(_0xe84f77){if(_0xe84f77[_0x9481('0xf')]!==_0x9481('0x10')&&_0xe84f77[_0x9481('0x6')]){_0xe84f77[_0x9481('0xf')]='pause';return![];}return _['every']([_0xe84f77[_0x9481('0x11')],_0xe84f77[_0x9481('0x12')],_0xe84f77[_0x9481('0x13')],_0xe84f77[_0x9481('0x14')],_0xe84f77[_0x9481('0x15')],_0xe84f77[_0x9481('0xf')],_0xe84f77[_0x9481('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x9481('0x17'),{})[_0x9481('0x18')](function(_0x5b1fe6){if(_0x5b1fe6[_0x9481('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x34108d=_0x5b1fe6[_0x9481('0x1a')];return routingClient[_0x9481('0x1b')](_0x9481('0x17'),{})['then'](function(_0x5eda66){if(_0x5eda66[_0x9481('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d0da7=_0x5eda66[_0x9481('0x1a')];return _[_0x9481('0x1c')]({},_0x34108d,_0x4d0da7);});})[_0x9481('0x1d')](function(_0x41051d){throw _0x41051d;});}exports[_0x9481('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3dc33f){var _0x55a1bd=_0x9481('0xb');if(isAgentPaused(_0x3dc33f))_0x55a1bd=_0x9481('0x1f');else if(isAgentPaused(_0x3dc33f,!![]))_0x55a1bd=_0x9481('0x20');else if(isAgentIdle(_0x3dc33f))_0x55a1bd=_0x9481('0x10');else _0x55a1bd=_0x9481('0x21');return _0x55a1bd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x215dd7,_0x294908){var _0x572599=_[_0x9481('0x22')](_0x215dd7)?_0x215dd7:[_0x215dd7];var _0xd1cd1a=_[_0x9481('0x23')](_0x294908)+_0x9481('0x24');var _0x2dc02e=_['map'](_0x572599,function(_0x91e3d9){return db[_0xd1cd1a][_0x9481('0x25')]({'where':{'id':_0x91e3d9}})['then'](function(_0x5eb4f5){if(!_0x5eb4f5)return[];return _0x5eb4f5[_0x9481('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x9481('0x27')](_0x2dc02e)['then'](function(_0x1e6f28){var _0x20ff9a=_(_0x1e6f28)[_0x9481('0x28')]()[_0x9481('0x29')]('id')['uniq']()[_0x9481('0x2a')]();return _0x20ff9a;});}exports[_0x9481('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3c2585,_0x587706,_0x1791b2){try{if(_0x587706['length']>0x0){_0x3c2585=_0x3c2585[_0x9481('0x9')](function(_0xe153ab){return _0x587706[_0x9481('0x2c')](_0xe153ab['id']);});}var _0x13ef93=_0x3c2585[_0x9481('0x9')](function(_0x53560d){var _0x2aa9ff=_0x9481('0x21');if(isAgentIdle(_0x53560d)){_0x2aa9ff=_0x9481('0x10');}return _0x2aa9ff===_0x1791b2;});return _['map'](_0x13ef93,'id');}catch(_0x56752e){throw _0x56752e;}}exports[_0x9481('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x427c25,_0x42df68,_0x2b33f8){return Promise['resolve']()['then'](function(){if(_0x42df68['length']>0x0){_0x427c25=_0x427c25[_0x9481('0x9')](function(_0x5d6c65){return _0x42df68[_0x9481('0x2c')](_0x5d6c65['id']);});}return _0x427c25;})['then'](function(){return db[_0x9481('0x2e')][_0x9481('0x2f')]({'attributes':['id',_0x9481('0x30'),_0x9481('0x31'),_0x9481('0x4'),'faxPause',_0x9481('0x5'),_0x9481('0x32'),_0x9481('0x33'),'voicePause',_0x9481('0x7'),_0x9481('0x34')],'where':{'id':{'$in':_[_0x9481('0x29')](_0x427c25,'id')}},'raw':!![]});})[_0x9481('0x18')](function(_0xdc87e6){return _0xdc87e6[_0x9481('0x29')](function(_0x5d7299){var _0x41c6a2=_['find'](_0x427c25,['id',_0x5d7299['id']]);var _0x203ef9=filterAgentAttributes(_0x41c6a2);_[_0x9481('0x1c')](_0x5d7299,_0x203ef9);_0x5d7299[_0x9481('0x35')]=getAgentStatus(_0x5d7299);return _0x5d7299;});})[_0x9481('0x18')](function(_0x2ebcbd){var _0x2face9=sortAgentsByStatus(_0x2ebcbd,_0x2b33f8);return _['map'](_0x2face9,'id');})[_0x9481('0x1d')](function(_0x15e27f){throw _0x15e27f;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5e00ad){var _0x31ea6a={'fields':[],'order':null};var _0x5ab28f=_0x5e00ad[_0x9481('0x36')](',');_0x31ea6a[_0x9481('0x37')]=_[_0x9481('0x9')](_0x5ab28f,function(_0x2a1bcf){if(!_0x2a1bcf['includes'](_0x9481('0x35'))){return!![];}_0x31ea6a['order']=_[_0x9481('0x38')](_0x2a1bcf,'-')?'DESC':_0x9481('0x39');return![];});return _0x31ea6a;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x315fb9){if(!_0x315fb9){_0x315fb9=_0x9481('0x3a');}if(_0x315fb9[_0x9481('0x2c')](_0x9481('0x31'))&&!_0x315fb9[_0x9481('0x2c')](_0x9481('0x3b'))){var _0xb6ff1=_0x315fb9['substring'](0x0,_0x315fb9[_0x9481('0x3c')](_0x9481('0x31')));_0x315fb9+=','+_0xb6ff1+_0x9481('0x3b');}return _0x315fb9;}exports[_0x9481('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x3f1b6f,_0x344e2d){var _0x2e4241=_0x3f1b6f['sort'](function(_0xf7b2e1,_0x1872ff){if(_0xf7b2e1['globalStatus']===_0x1872ff[_0x9481('0x35')]){if(_0xf7b2e1[_0x9481('0x35')]===_0x9481('0x1f')){if(_0x344e2d===_0x9481('0x3e')){return(_0xf7b2e1[_0x9481('0x34')]||'')<(_0x1872ff['pauseType']||'')||_0xf7b2e1[_0x9481('0x31')]['toLowerCase']()>_0x1872ff[_0x9481('0x31')][_0x9481('0x3f')]()?0x1:-0x1;}else{return(_0xf7b2e1['pauseType']||'')<(_0x1872ff['pauseType']||'')||_0xf7b2e1[_0x9481('0x31')][_0x9481('0x3f')]()>_0x1872ff[_0x9481('0x31')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x344e2d===_0x9481('0x3e')){return _0xf7b2e1[_0x9481('0x31')]['toLowerCase']()<_0x1872ff['fullname'][_0x9481('0x3f')]()?0x1:-0x1;}else{return _0xf7b2e1['fullname'][_0x9481('0x3f')]()<_0x1872ff[_0x9481('0x31')][_0x9481('0x3f')]()?-0x1:0x1;}}}else{if(_0x344e2d===_0x9481('0x3e')){return _0xf7b2e1[_0x9481('0x35')]<_0x1872ff['globalStatus']?0x1:-0x1;}else{return _0xf7b2e1[_0x9481('0x35')]<_0x1872ff[_0x9481('0x35')]?-0x1:0x1;}}});return _0x2e4241;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x1c98fa){var _0x35d740=[_0x9481('0x40'),_0x9481('0x41'),_0x9481('0x42'),_0x9481('0x43'),_0x9481('0x34'),_0x9481('0x43'),_0x9481('0x3b'),'address',_0x9481('0x4'),'openchannelPause','mailPause',_0x9481('0x33'),'whatsappPause',_0x9481('0x44'),_0x9481('0x6'),'chatCapacity',_0x9481('0x45'),_0x9481('0x46'),_0x9481('0x47'),_0x9481('0x48'),_0x9481('0x49'),_0x9481('0x4a'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x9481('0x4b'),_0x9481('0x4c'),_0x9481('0x4d'),_0x9481('0x11'),_0x9481('0x14'),_0x9481('0x13'),_0x9481('0x15'),_0x9481('0x16'),'faxStatus',_0x9481('0xf'),_0x9481('0x4e'),_0x9481('0x4f'),_0x9481('0x50'),_0x9481('0x51'),'whatsappStatusTime','faxStatusTime',_0x9481('0x52'),_0x9481('0x53'),_0x9481('0x54'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias'];var _0x538507=['chatPause','openchannelPause',_0x9481('0x5'),_0x9481('0x33'),'whatsappPause',_0x9481('0x44'),'voicePause',_0x9481('0x41')];var _0x229b69=_(_0x1c98fa)[_0x9481('0x55')](_0x538507)[_0x9481('0x56')](_0x35d740)[_0x9481('0x2a')]();return _0x229b69;}exports[_0x9481('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x9481('0x30'),'fullname',_0x9481('0x58'),_0x9481('0x3b'),'online',_0x9481('0x35'),_0x9481('0x40'),_0x9481('0x42'),_0x9481('0x34'),_0x9481('0x43'),'faxPause',_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x32'),_0x9481('0x33'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x11'),_0x9481('0x12'),_0x9481('0x13'),'openchannelStatus','smsStatus','voiceStatus',_0x9481('0x16'),_0x9481('0x4e'),'faxStatusTime',_0x9481('0x50'),_0x9481('0x4f'),_0x9481('0x51'),_0x9481('0x52'),_0x9481('0x59'),_0x9481('0x5a'),'faxCapacity','mailCapacity',_0x9481('0x45'),_0x9481('0x47'),_0x9481('0x48'),_0x9481('0x4a'),_0x9481('0x4d'),_0x9481('0x5b'),'openchannelCurrentCapacity','smsCurrentCapacity',_0x9481('0x4c'),'phoneBarEnableScreenRecordingByAgent',_0x9481('0x5c'),'destconnectedlinenum',_0x9481('0x5d'),_0x9481('0x53'),_0x9481('0x5e'),'screenrecording'];}exports[_0x9481('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 04c2a8a..e4f770f 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 _0x1880=['voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','concat','outbound','map','get','loggedInDb','merge','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','invalid','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1880,0x1bf));var _0x0188=function(_0x105d2e,_0xefc0f9){_0x105d2e=_0x105d2e-0x0;var _0x44969d=_0x1880[_0x105d2e];return _0x44969d;};'use strict';var _=require(_0x0188('0x0'));var jayson=require(_0x0188('0x1'));var util=require('util');var amiClient=jayson[_0x0188('0x2')][_0x0188('0x3')]({'port':0x232a});var routingClient=jayson[_0x0188('0x2')][_0x0188('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x0188('0x4'),_0x0188('0x5'),_0x0188('0x6'),_0x0188('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x0188('0x8'),'inUse',_0x0188('0x9'),'loggedInDb','notInUse','onHold','ringing',_0x0188('0xa'),_0x0188('0xb'),_0x0188('0xc'),_0x0188('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x0188('0xe'),_0x0188('0xf'),_0x0188('0x10'),_0x0188('0x11'),_0x0188('0x12'),_0x0188('0x13'),'Trunk','startPredictive',_0x0188('0x14'),_0x0188('0x15'),_0x0188('0x16'),_0x0188('0x17'),_0x0188('0x18'),_0x0188('0x19'),_0x0188('0x1a'),_0x0188('0x1b'),'predictiveIntervalAvailable',_0x0188('0x1c'),_0x0188('0x1d'),_0x0188('0x1e'),_0x0188('0x1f'),'predictiveIntervalAvgHoldtime',_0x0188('0x20')];function getRealtimeQueues(_0x51bb89,_0x599ee9){var _0x503891=_0x599ee9===_0x0188('0x21')?amiClient:routingClient;return _0x503891[_0x0188('0x22')](_['startCase'](_0x599ee9)+_0x0188('0x23'),_0x51bb89)[_0x0188('0x24')](function(_0x4a8130){if(_0x4a8130[_0x0188('0x25')])throw new Error(util[_0x0188('0x26')](_0x0188('0x27'),_0x599ee9));return _0x4a8130[_0x0188('0x28')];})[_0x0188('0x29')](function(_0x2b2d6a){throw _0x2b2d6a;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x3d410e,_0x2b2979,_0x288c4d,_0x4016f4){var _0x2faaa7=DEFAULT_QUEUE_ATTRIBUTES;if(_0x288c4d===_0x0188('0x21')){if(_0x4016f4==='inbound'){_0x2faaa7=_0x2faaa7[_0x0188('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4016f4===_0x0188('0x2b')){_0x2faaa7=_0x2faaa7[_0x0188('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3d410e[_0x0188('0x2c')](function(_0x5c4ec2){var _0x537222=_0x5c4ec2[_0x0188('0x2d')]({'plain':!![]});_0x537222[_0x0188('0x6')]=0x0;_0x537222[_0x0188('0x2e')]=0x0;_0x537222[_0x0188('0x5')]=0x0;_0x537222[_0x0188('0x4')]=0x0;_0x537222[_0x0188('0x7')]=0x0;if(_0x288c4d===_0x0188('0x21')){_0x537222[_0x0188('0xb')]=0x0;_0x537222['busy']=0x0;if(_0x4016f4===_0x0188('0x2b')){_0x537222[_0x0188('0xe')]=0x0;_0x537222[_0x0188('0xf')]=0x0;}}var _0x57c11c=_['find'](_0x2b2979,['id',_0x537222['id']]);if(_0x57c11c){_[_0x0188('0x2f')](_0x537222,_['pick'](_0x57c11c,_0x2faaa7));}return _0x537222;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x75db=['loggedIn','paused','waiting','invalid','onHold','ringInUse','talking','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','request','startCase','then','error','format','getRealtimeQueues','voice','concat','get','loggedInDb','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available'];(function(_0x14b595,_0x4fb159){var _0x4349a7=function(_0x35a8d4){while(--_0x35a8d4){_0x14b595['push'](_0x14b595['shift']());}};_0x4349a7(++_0x4fb159);}(_0x75db,0x1b2));var _0xb75d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb75d('0x0'));var jayson=require(_0xb75d('0x1'));var util=require(_0xb75d('0x2'));var amiClient=jayson[_0xb75d('0x3')][_0xb75d('0x4')]({'port':0x232a});var routingClient=jayson[_0xb75d('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xb75d('0x5'),_0xb75d('0x6'),_0xb75d('0x7'),_0xb75d('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0xb75d('0x9'),'loggedInDb','notInUse',_0xb75d('0xa'),'ringing',_0xb75d('0xb'),_0xb75d('0xc'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb75d('0xd'),_0xb75d('0xe'),_0xb75d('0xf'),_0xb75d('0x10'),'dialActive',_0xb75d('0x11'),_0xb75d('0x12'),_0xb75d('0x13'),_0xb75d('0x14'),_0xb75d('0x15'),_0xb75d('0x16'),_0xb75d('0x17'),_0xb75d('0x18'),_0xb75d('0x19'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xb75d('0x1a'),_0xb75d('0x1b'),_0xb75d('0x1c'),'predictiveIntervalDroppedCallsTimeout',_0xb75d('0x1d'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0xd9d172,_0x323307){var _0x3455cb=_0x323307==='voice'?amiClient:routingClient;return _0x3455cb[_0xb75d('0x1e')](_[_0xb75d('0x1f')](_0x323307)+'Queues',_0xd9d172)[_0xb75d('0x20')](function(_0x44d787){if(_0x44d787[_0xb75d('0x21')])throw new Error(util[_0xb75d('0x22')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x323307));return _0x44d787['result'];})['catch'](function(_0x3225d4){throw _0x3225d4;});}exports[_0xb75d('0x23')]=getRealtimeQueues;function initializeQueues(_0x4e8c72,_0x2bddab,_0x19b0db,_0x566e4a){var _0x10398f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x19b0db===_0xb75d('0x24')){if(_0x566e4a==='inbound'){_0x10398f=_0x10398f[_0xb75d('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x566e4a==='outbound'){_0x10398f=_0x10398f[_0xb75d('0x25')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4e8c72['map'](function(_0x5818c0){var _0x3cec47=_0x5818c0[_0xb75d('0x26')]({'plain':!![]});_0x3cec47[_0xb75d('0x7')]=0x0;_0x3cec47[_0xb75d('0x27')]=0x0;_0x3cec47['loggedIn']=0x0;_0x3cec47[_0xb75d('0x5')]=0x0;_0x3cec47[_0xb75d('0x8')]=0x0;if(_0x19b0db===_0xb75d('0x24')){_0x3cec47[_0xb75d('0xc')]=0x0;_0x3cec47['busy']=0x0;if(_0x566e4a==='outbound'){_0x3cec47['pTalking']=0x0;_0x3cec47['originated']=0x0;}}var _0x3f90d1=_[_0xb75d('0x28')](_0x2bddab,['id',_0x3cec47['id']]);if(_0x3f90d1){_[_0xb75d('0x29')](_0x3cec47,_[_0xb75d('0x2a')](_0x3f90d1,_0x10398f));}return _0x3cec47;});}exports[_0xb75d('0x2b')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 607623f..18743c6 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(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x58803c,_0x4a34df){var _0xf95b9b=function(_0x597eb8){while(--_0x597eb8){_0x58803c['push'](_0x58803c['shift']());}};_0xf95b9b(++_0x4a34df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 4582548..562bded 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 _0x1d8c=['ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','length','filter','internal','concat','head','mac','00:00:00:00:00:00','getFirstInterface','map','model','createHash','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x520342,_0x5a2a53){var _0x340084=function(_0x1d4a1a){while(--_0x1d4a1a){_0x520342['push'](_0x520342['shift']());}};_0x340084(++_0x5a2a53);}(_0x1d8c,0x9e));var _0xc1d8=function(_0x5ec4d5,_0x55f2a0){_0x5ec4d5=_0x5ec4d5-0x0;var _0x4811fa=_0x1d8c[_0x5ec4d5];return _0x4811fa;};'use strict';var _=require(_0xc1d8('0x0'));var os=require('os');var crypto=require(_0xc1d8('0x1'));var machine=require(_0xc1d8('0x2'));var exec=require(_0xc1d8('0x3'))[_0xc1d8('0x4')];var config=require(_0xc1d8('0x5'));function getInterfaces(){var _0x543fe1=[];var _0x2b15fc=os['networkInterfaces']();var _0x5d06dc=_[_0xc1d8('0x6')](_['keys'](_0x2b15fc));for(var _0x1f281c=0x0;_0x1f281c<_0x5d06dc[_0xc1d8('0x7')];_0x1f281c++){var _0x3c683b=_0x2b15fc[_0x5d06dc[_0x1f281c]][_0xc1d8('0x8')](function(_0x5f3581){return _0x5f3581['family']==='IPv4'&&_0x5f3581[_0xc1d8('0x9')]===![];});_0x543fe1=_0x543fe1[_0xc1d8('0xa')](_0x3c683b);}return _0x543fe1;}function getFirstInterface(){var _0x329c2f=_[_0xc1d8('0xb')](getInterfaces());return{'macAddress':_0x329c2f&&_0x329c2f[_0xc1d8('0xc')]?_0x329c2f[_0xc1d8('0xc')]:_0xc1d8('0xd'),'ipAddress':_0x329c2f&&_0x329c2f['address']?_0x329c2f['address']:'127.0.0.1'};}exports[_0xc1d8('0xe')]=getFirstInterface;function getCPUhash(){var _0x4c4529=_[_0xc1d8('0x6')](os['cpus']()[_0xc1d8('0xf')](function(_0x3f9e67){return _0x3f9e67[_0xc1d8('0x10')];}))['join'](':');return crypto[_0xc1d8('0x11')]('md5')[_0xc1d8('0x12')](_0x4c4529)['digest'](_0xc1d8('0x13'));}exports[_0xc1d8('0x14')]=function(){var _0x480f22=os[_0xc1d8('0x15')]();var _0xaea255=/[0-9a-f-]{36}/;if(config[_0xc1d8('0x16')]&&_0xaea255[_0xc1d8('0x17')](config[_0xc1d8('0x16')])){return config['licenseToken'];}else if(_0x480f22===_0xc1d8('0x18')){return exec(_0xc1d8('0x19'),{'encoding':_0xc1d8('0x1a')})[_0xc1d8('0x1b')]('\x0d\x0a','');}else{var _0x37bbac=getFirstInterface();var _0x4fdb36=getCPUhash();var _0x45a201=_0x4fdb36+'|'+os['hostname']()+'|'+_0x37bbac['macAddress']+'|'+_0x37bbac[_0xc1d8('0x1c')];var _0x243a7=crypto[_0xc1d8('0x11')]('md5')['update'](_0x45a201)[_0xc1d8('0x1d')](_0xc1d8('0x13'));return _0x243a7[_0xc1d8('0x1e')](0x0,0x8)+'-'+_0x243a7[_0xc1d8('0x1e')](0x8,0xc)+'-'+_0x243a7['substring'](0xc,0x10)+'-'+_0x243a7[_0xc1d8('0x1e')](0x10,0x14)+'-'+_0x243a7[_0xc1d8('0x1e')](0x14);}}; \ No newline at end of file +var _0x2ed6=['127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','mac','00:00:00:00:00:00','address'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x2ed6,0x8c));var _0x62ed=function(_0x268aa1,_0x350c61){_0x268aa1=_0x268aa1-0x0;var _0x445f57=_0x2ed6[_0x268aa1];return _0x445f57;};'use strict';var _=require(_0x62ed('0x0'));var os=require('os');var crypto=require(_0x62ed('0x1'));var machine=require(_0x62ed('0x2'));var exec=require(_0x62ed('0x3'))[_0x62ed('0x4')];var config=require('../environment');function getInterfaces(){var _0x13ca69=[];var _0x511239=os[_0x62ed('0x5')]();var _0x149040=_[_0x62ed('0x6')](_[_0x62ed('0x7')](_0x511239));for(var _0x323d3b=0x0;_0x323d3b<_0x149040[_0x62ed('0x8')];_0x323d3b++){var _0x5e12a2=_0x511239[_0x149040[_0x323d3b]][_0x62ed('0x9')](function(_0x1f5d2d){return _0x1f5d2d['family']===_0x62ed('0xa')&&_0x1f5d2d['internal']===![];});_0x13ca69=_0x13ca69[_0x62ed('0xb')](_0x5e12a2);}return _0x13ca69;}function getFirstInterface(){var _0x50ec54=_['head'](getInterfaces());return{'macAddress':_0x50ec54&&_0x50ec54[_0x62ed('0xc')]?_0x50ec54[_0x62ed('0xc')]:_0x62ed('0xd'),'ipAddress':_0x50ec54&&_0x50ec54[_0x62ed('0xe')]?_0x50ec54[_0x62ed('0xe')]:_0x62ed('0xf')};}exports[_0x62ed('0x10')]=getFirstInterface;function getCPUhash(){var _0x4d20f3=_['orderBy'](os[_0x62ed('0x11')]()[_0x62ed('0x12')](function(_0x4b746f){return _0x4b746f[_0x62ed('0x13')];}))['join'](':');return crypto[_0x62ed('0x14')](_0x62ed('0x15'))['update'](_0x4d20f3)['digest'](_0x62ed('0x16'));}exports[_0x62ed('0x17')]=function(){var _0x2d622b=os['platform']();var _0xe13d7b=/[0-9a-f-]{36}/;if(config[_0x62ed('0x18')]&&_0xe13d7b['test'](config['licenseToken'])){return config[_0x62ed('0x18')];}else if(_0x2d622b===_0x62ed('0x19')){return exec(_0x62ed('0x1a'),{'encoding':'utf8'})[_0x62ed('0x1b')]('\x0d\x0a','');}else{var _0x16e6b4=getFirstInterface();var _0x23596e=getCPUhash();var _0x6cdea7=_0x23596e+'|'+os['hostname']()+'|'+_0x16e6b4[_0x62ed('0x1c')]+'|'+_0x16e6b4['ipAddress'];var _0x26db60=crypto[_0x62ed('0x14')](_0x62ed('0x15'))[_0x62ed('0x1d')](_0x6cdea7)['digest'](_0x62ed('0x16'));return _0x26db60[_0x62ed('0x1e')](0x0,0x8)+'-'+_0x26db60[_0x62ed('0x1e')](0x8,0xc)+'-'+_0x26db60[_0x62ed('0x1e')](0xc,0x10)+'-'+_0x26db60[_0x62ed('0x1e')](0x10,0x14)+'-'+_0x26db60[_0x62ed('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d3122e4..ba43667 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 _0x6d71=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed'];(function(_0x45b798,_0x31a834){var _0x44c45e=function(_0x153581){while(--_0x153581){_0x45b798['push'](_0x45b798['shift']());}};_0x44c45e(++_0x31a834);}(_0x6d71,0x127));var _0x16d7=function(_0x307dbc,_0x2bc734){_0x307dbc=_0x307dbc-0x0;var _0x4f7bdd=_0x6d71[_0x307dbc];return _0x4f7bdd;};'use strict';var util=require(_0x16d7('0x0'));var moment=require(_0x16d7('0x1'));var rp=require(_0x16d7('0x2'));var BPromise=require(_0x16d7('0x3'));var pkginfo=require('pkginfo')(module,_0x16d7('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x16d7('0x5'));var logger=require('../logger')(_0x16d7('0x6'));var HOST=_0x16d7('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x498a9e){return new BPromise(function(_0x1bfb2c,_0x575da0){var _0x22ce6e=util['format'](_0x16d7('0x8'),HOST,_0x498a9e,module[_0x16d7('0x9')][_0x16d7('0x4')]);if(oldToken){_0x22ce6e=util[_0x16d7('0xa')](_0x16d7('0xb'),HOST,_0x498a9e,module[_0x16d7('0x9')][_0x16d7('0x4')],oldToken);}var _0x2c859d={'uri':_0x22ce6e,'method':_0x16d7('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x2c859d)[_0x16d7('0xd')](function(_0x362624){_0x1bfb2c(_0x362624);})['catch'](function(_0x2de95a){_0x575da0(_0x2de95a);});});}function manageLicense(_0x38d621,_0x3e61a9){var _0x42f48f=_0x3e61a9[_0x16d7('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x42f48f['data1']!==_0x38d621&&!_0x42f48f['data2']){oldToken=_0x42f48f[_0x16d7('0xf')];}httpRequest(_0x38d621)['then'](function(_0x32e01c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x32e01c[_0x16d7('0x10')]){isOldTokenSent=![];if(!_0x42f48f[_0x16d7('0x6')]&&_0x42f48f[_0x16d7('0x6')]!=_0x32e01c[_0x16d7('0x6')]||_0x42f48f['license']&&_0x42f48f['data2']){logger['info'](_0x16d7('0x11'));}if(_0x42f48f['license']&&!_0x42f48f[_0x16d7('0x12')]&&_0x42f48f[_0x16d7('0x6')]!=_0x32e01c[_0x16d7('0x6')]){logger[_0x16d7('0x13')](_0x16d7('0x14'));}if(_0x42f48f[_0x16d7('0x6')]&&!_0x42f48f[_0x16d7('0x12')]&&_0x42f48f['license']==_0x32e01c[_0x16d7('0x6')]){return _0x3e61a9;}return _0x3e61a9[_0x16d7('0x15')]({'data1':_0x38d621,'data2':null,'license':_0x32e01c[_0x16d7('0x6')]});}else{if(_0x32e01c[_0x16d7('0x6')]||_0x42f48f[_0x16d7('0x6')]){if(!_0x42f48f[_0x16d7('0x12')]){if(_0x42f48f[_0x16d7('0xf')]==_0x38d621){GRAY_PERIOD_REASON=_0x16d7('0x16');logger['info'](_0x16d7('0x17'));}else{GRAY_PERIOD_REASON=_0x16d7('0x18');logger[_0x16d7('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x42f48f[_0x16d7('0xf')],_0x38d621);}logger[_0x16d7('0x13')](_0x16d7('0x19'),GRAY_PERIOD_REASON[_0x16d7('0x1a')](),moment()['format'](_0x16d7('0x1b')));return _0x3e61a9[_0x16d7('0x15')]({'data2':encryptor[_0x16d7('0x1c')](moment()[_0x16d7('0xa')](_0x16d7('0x1b')))});}else{if(moment()[_0x16d7('0x1d')](encryptor[_0x16d7('0x1e')](_0x42f48f[_0x16d7('0x12')]),'days')>DAYS){logger[_0x16d7('0x13')](_0x16d7('0x1f'),moment()[_0x16d7('0xa')](_0x16d7('0x1b')));isOldTokenSent=![];return _0x3e61a9[_0x16d7('0x15')]({'data1':_0x38d621,'data2':null,'license':null});}}}else{if(_0x42f48f[_0x16d7('0xf')]!=_0x38d621){logger['info'](_0x16d7('0x20'),_0x42f48f[_0x16d7('0xf')],_0x38d621);return _0x3e61a9['update']({'data1':_0x38d621,'data2':null,'license':null});}}}return _0x3e61a9;})[_0x16d7('0xd')](function(_0x3a2e39){_0x3e61a9=_0x3a2e39;})[_0x16d7('0x21')](function(_0x19d7d9){logger['error'](_0x19d7d9[_0x16d7('0x22')]);})[_0x16d7('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3e61a9);},TIME);});}function defaultLicense(){var _0x33bbb5=hardware['getUuid']();if(_0x33bbb5){return db[_0x16d7('0x24')][_0x16d7('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x33bbb5}})['spread'](function(_0xb2e5c5,_0xfcdc73){logger[_0x16d7('0x13')](_0x16d7('0x26'),_0x33bbb5);manageLicense(_0x33bbb5,_0xb2e5c5);})[_0x16d7('0x21')](function(_0x5d38c8){logger['error'](_0x5d38c8['message']);});}}exports[_0x16d7('0x27')]=defaultLicense; \ No newline at end of file +var _0xc59f=['data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc59f,0xde));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xfc59('0x0'));var moment=require(_0xfc59('0x1'));var rp=require(_0xfc59('0x2'));var BPromise=require(_0xfc59('0x3'));var pkginfo=require(_0xfc59('0x4'))(module,_0xfc59('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xfc59('0x6'));var hardware=require(_0xfc59('0x7'));var logger=require('../logger')('license');var HOST=_0xfc59('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4f51f1){return new BPromise(function(_0x1884f9,_0x405514){var _0x3e9d5e=util['format'](_0xfc59('0x9'),HOST,_0x4f51f1,module[_0xfc59('0xa')][_0xfc59('0x5')]);if(oldToken){_0x3e9d5e=util[_0xfc59('0xb')](_0xfc59('0xc'),HOST,_0x4f51f1,module[_0xfc59('0xa')][_0xfc59('0x5')],oldToken);}var _0x4c5d4c={'uri':_0x3e9d5e,'method':_0xfc59('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4c5d4c)[_0xfc59('0xe')](function(_0x3671f6){_0x1884f9(_0x3671f6);})[_0xfc59('0xf')](function(_0x3ffd0a){_0x405514(_0x3ffd0a);});});}function manageLicense(_0x4c8865,_0x26b1c7){var _0x68836b=_0x26b1c7[_0xfc59('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x68836b[_0xfc59('0x11')]!==_0x4c8865&&!_0x68836b[_0xfc59('0x12')]){oldToken=_0x68836b[_0xfc59('0x11')];}httpRequest(_0x4c8865)[_0xfc59('0xe')](function(_0x19c64a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x19c64a['active']){isOldTokenSent=![];if(!_0x68836b[_0xfc59('0x13')]&&_0x68836b['license']!=_0x19c64a[_0xfc59('0x13')]||_0x68836b[_0xfc59('0x13')]&&_0x68836b[_0xfc59('0x12')]){logger[_0xfc59('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x68836b['license']&&!_0x68836b[_0xfc59('0x12')]&&_0x68836b[_0xfc59('0x13')]!=_0x19c64a[_0xfc59('0x13')]){logger['info'](_0xfc59('0x15'));}if(_0x68836b['license']&&!_0x68836b['data2']&&_0x68836b[_0xfc59('0x13')]==_0x19c64a[_0xfc59('0x13')]){return _0x26b1c7;}return _0x26b1c7['update']({'data1':_0x4c8865,'data2':null,'license':_0x19c64a[_0xfc59('0x13')]});}else{if(_0x19c64a[_0xfc59('0x13')]||_0x68836b[_0xfc59('0x13')]){if(!_0x68836b['data2']){if(_0x68836b['data1']==_0x4c8865){GRAY_PERIOD_REASON=_0xfc59('0x16');logger[_0xfc59('0x14')](_0xfc59('0x17'));}else{GRAY_PERIOD_REASON=_0xfc59('0x18');logger[_0xfc59('0x14')](_0xfc59('0x19'),_0x68836b[_0xfc59('0x11')],_0x4c8865);}logger[_0xfc59('0x14')](_0xfc59('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xfc59('0xb')](_0xfc59('0x1b')));return _0x26b1c7[_0xfc59('0x1c')]({'data2':encryptor[_0xfc59('0x1d')](moment()[_0xfc59('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xfc59('0x1e')](_0x68836b[_0xfc59('0x12')]),_0xfc59('0x1f'))>DAYS){logger[_0xfc59('0x14')](_0xfc59('0x20'),moment()[_0xfc59('0xb')](_0xfc59('0x1b')));isOldTokenSent=![];return _0x26b1c7[_0xfc59('0x1c')]({'data1':_0x4c8865,'data2':null,'license':null});}}}else{if(_0x68836b['data1']!=_0x4c8865){logger[_0xfc59('0x14')](_0xfc59('0x19'),_0x68836b[_0xfc59('0x11')],_0x4c8865);return _0x26b1c7[_0xfc59('0x1c')]({'data1':_0x4c8865,'data2':null,'license':null});}}}return _0x26b1c7;})[_0xfc59('0xe')](function(_0x542028){_0x26b1c7=_0x542028;})['catch'](function(_0x259911){logger[_0xfc59('0x21')](_0x259911[_0xfc59('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xfc59('0x23')](),_0x26b1c7);},TIME);});}function defaultLicense(){var _0x5bab41=hardware[_0xfc59('0x23')]();if(_0x5bab41){return db['License'][_0xfc59('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5bab41}})[_0xfc59('0x25')](function(_0x1201e9,_0xb47584){logger['info'](_0xfc59('0x26'),_0x5bab41);manageLicense(_0x5bab41,_0x1201e9);})['catch'](function(_0x5dd531){logger[_0xfc59('0x21')](_0x5dd531[_0xfc59('0x22')]);});}}exports[_0xfc59('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2047696..b176185 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 _0x9b0f=['Demo\x20license','getUuid','Breaking\x20license','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','uuid','machineUuid','deadline','add','days','changed','disabled','role','sequelize','COUNT','col','count','admin','user','telephone','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z'];(function(_0x35b436,_0x490050){var _0x5b3ffb=function(_0x37917a){while(--_0x37917a){_0x35b436['push'](_0x35b436['shift']());}};_0x5b3ffb(++_0x490050);}(_0x9b0f,0x1db));var _0xf9b0=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x9b0f[_0x5806c3];return _0x48ac77;};'use strict';var util=require('util');var _=require(_0xf9b0('0x0'));var moment=require(_0xf9b0('0x1'));var BPromise=require(_0xf9b0('0x2'));var hardware=require(_0xf9b0('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf9b0('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf9b0('0x5'),'machineUuid':hardware[_0xf9b0('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf9b0('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf9b0('0x7'),'machineUuid':hardware[_0xf9b0('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x512cde){return new BPromise(function(_0x2cdb3e,_0x44722f){return db['License']['find'](_['defaults'](_0x512cde,{'raw':!![],'where':{'id':0x1}}))[_0xf9b0('0x8')](function(_0x15a505){return checkLicense(_0x15a505,null);})[_0xf9b0('0x8')](function(_0x86234){_0x2cdb3e(_0x86234);return;})['catch'](function(_0x5780a0){_0x44722f(_0x5780a0);});});}function checkLicense(_0x4663d4,_0x45974d){if(!_0x4663d4){demoLicense['uuid']=_0x4663d4[_0xf9b0('0x9')];return demoLicense;}try{var _0x9d1372=_0x45974d||_0x4663d4[_0xf9b0('0xa')];if(_[_0xf9b0('0xb')](_0x9d1372)){throw new Error(_0xf9b0('0xc'));}var _0x59f9db=_0x4663d4[_0xf9b0('0x9')];var _0x227cad=_0x4663d4[_0xf9b0('0xd')];var _0x338d21=_0x59f9db[_0xf9b0('0xe')]('-')[0x4];var _0x3b745a=_0x59f9db['split']('-')[0x0];var _0x4c9636=encryptor[_0xf9b0('0xf')](_0x9d1372,util[_0xf9b0('0x10')]('%s:%s:%s',_0x338d21,_0x59f9db,_0x3b745a));var _0x1d9f6d=JSON[_0xf9b0('0x11')](_0x4c9636);_0x1d9f6d[_0xf9b0('0x12')]=![];_0x1d9f6d[_0xf9b0('0x13')]=_0x59f9db;_0x1d9f6d[_0xf9b0('0x14')]=hardware[_0xf9b0('0x6')]();if(_0x227cad){var _0x47cc28=encryptor[_0xf9b0('0xf')](_0x227cad);_0x1d9f6d['gray']=_0x47cc28;_0x1d9f6d[_0xf9b0('0x15')]=moment(_0x47cc28)[_0xf9b0('0x16')](0x7,_0xf9b0('0x17'))['format']();_0x1d9f6d['grayReason']=_0x1d9f6d[_0xf9b0('0x13')]!=_0x1d9f6d[_0xf9b0('0x14')]?_0xf9b0('0x18'):_0xf9b0('0x19');}return _0x1d9f6d;}catch(_0x27e20a){breakingLicense[_0xf9b0('0x13')]=_0x4663d4[_0xf9b0('0x9')];breakingLicense['message']=_0x27e20a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4f5870,_0x44fa36){getLicense()[_0xf9b0('0x8')](function(_0x167835){return db['User']['findAll']({'attributes':[_0xf9b0('0x1a'),[db[_0xf9b0('0x1b')]['fn'](_0xf9b0('0x1c'),db[_0xf9b0('0x1b')][_0xf9b0('0x1d')]('role')),_0xf9b0('0x1e')]],'group':_0xf9b0('0x1a'),'where':{'role':{'$or':[_0xf9b0('0x1f'),_0xf9b0('0x20'),_0xf9b0('0x21')]}},'raw':!![]})['then'](function(_0x3a7789){var _0x20adbe={'user':_0x167835['users']||0x0,'telephone':_0x167835[_0xf9b0('0x22')]||0x0};_0x3a7789[_0xf9b0('0x23')](function(_0x1842b7){var _0x4cd498=_0x1842b7[_0xf9b0('0x1a')]===_0xf9b0('0x1f')?_0xf9b0('0x20'):_0x1842b7[_0xf9b0('0x1a')];_0x20adbe[_0x4cd498]-=_0x1842b7['count'];if(_0x20adbe[_0x4cd498]<0x0)_0x20adbe[_0x4cd498]=0x0;});_0x4f5870(_0x20adbe);return;});})[_0xf9b0('0x24')](function(_0x590fb4){_0x44fa36(_0x590fb4);});});}function checkUserLimits(_0x18fea8){return new BPromise(function(_0x10b3a9,_0x517192){getLimits()[_0xf9b0('0x8')](function(_0x261355){var _0x462a2e=_[_0xf9b0('0x25')](_[_0xf9b0('0x26')](_0x18fea8,_0xf9b0('0x1a')),[_0xf9b0('0x1f'),_0xf9b0('0x20'),_0xf9b0('0x21')]);var _0xd117d9=(_0x462a2e[_0xf9b0('0x1f')]||0x0)+(_0x462a2e['user']||0x0);var _0x288623=_0x462a2e[_0xf9b0('0x21')]||0x0;if(_0xd117d9>_0x261355[_0xf9b0('0x20')])return _0x517192(_0xf9b0('0x27'));if(_0x288623>_0x261355[_0xf9b0('0x21')])return _0x517192('License\x20limit\x20reached\x20for\x20telephones');return _0x10b3a9();})['catch'](function(_0x13cac7){_0x517192(_0x13cac7);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xcfe3=['format','parse','demo','uuid','machineUuid','gray','add','changed','disabled','message','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x68e38,_0x6e83ac){var _0x48a709=function(_0x21889d){while(--_0x21889d){_0x68e38['push'](_0x68e38['shift']());}};_0x48a709(++_0x6e83ac);}(_0xcfe3,0x100));var _0x3cfe=function(_0x1f686a,_0x535ac8){_0x1f686a=_0x1f686a-0x0;var _0x45f8cc=_0xcfe3[_0x1f686a];return _0x45f8cc;};'use strict';var util=require(_0x3cfe('0x0'));var _=require(_0x3cfe('0x1'));var moment=require(_0x3cfe('0x2'));var BPromise=require(_0x3cfe('0x3'));var hardware=require(_0x3cfe('0x4'));var encryptor=require(_0x3cfe('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3cfe('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3cfe('0x7')](),'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':_0x3cfe('0x8'),'machineUuid':hardware[_0x3cfe('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3100fb){return new BPromise(function(_0x479519,_0x36ccc1){return db[_0x3cfe('0x9')]['find'](_[_0x3cfe('0xa')](_0x3100fb,{'raw':!![],'where':{'id':0x1}}))[_0x3cfe('0xb')](function(_0x387bf9){return checkLicense(_0x387bf9,null);})['then'](function(_0x36f2f7){_0x479519(_0x36f2f7);return;})[_0x3cfe('0xc')](function(_0x3a9c23){_0x36ccc1(_0x3a9c23);});});}function checkLicense(_0x313218,_0x54d7af){if(!_0x313218){demoLicense['uuid']=_0x313218[_0x3cfe('0xd')];return demoLicense;}try{var _0x1970da=_0x54d7af||_0x313218[_0x3cfe('0xe')];if(_[_0x3cfe('0xf')](_0x1970da)){throw new Error(_0x3cfe('0x10'));}var _0x4cff46=_0x313218[_0x3cfe('0xd')];var _0x2e5043=_0x313218[_0x3cfe('0x11')];var _0x57055f=_0x4cff46[_0x3cfe('0x12')]('-')[0x4];var _0x119f6f=_0x4cff46['split']('-')[0x0];var _0x4e7bb1=encryptor[_0x3cfe('0x13')](_0x1970da,util[_0x3cfe('0x14')]('%s:%s:%s',_0x57055f,_0x4cff46,_0x119f6f));var _0x337b76=JSON[_0x3cfe('0x15')](_0x4e7bb1);_0x337b76[_0x3cfe('0x16')]=![];_0x337b76[_0x3cfe('0x17')]=_0x4cff46;_0x337b76[_0x3cfe('0x18')]=hardware[_0x3cfe('0x7')]();if(_0x2e5043){var _0x21d9bf=encryptor[_0x3cfe('0x13')](_0x2e5043);_0x337b76[_0x3cfe('0x19')]=_0x21d9bf;_0x337b76['deadline']=moment(_0x21d9bf)[_0x3cfe('0x1a')](0x7,'days')['format']();_0x337b76['grayReason']=_0x337b76[_0x3cfe('0x17')]!=_0x337b76[_0x3cfe('0x18')]?_0x3cfe('0x1b'):_0x3cfe('0x1c');}return _0x337b76;}catch(_0x5df701){breakingLicense[_0x3cfe('0x17')]=_0x313218['data1'];breakingLicense['message']=_0x5df701[_0x3cfe('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x206360,_0x5e94d9){getLicense()[_0x3cfe('0xb')](function(_0xd05b2a){return db['User'][_0x3cfe('0x1e')]({'attributes':['role',[db[_0x3cfe('0x1f')]['fn'](_0x3cfe('0x20'),db['sequelize'][_0x3cfe('0x21')](_0x3cfe('0x22'))),_0x3cfe('0x23')]],'group':'role','where':{'role':{'$or':[_0x3cfe('0x24'),_0x3cfe('0x25'),_0x3cfe('0x26')]}},'raw':!![]})[_0x3cfe('0xb')](function(_0xd855b7){var _0x4f859a={'user':_0xd05b2a[_0x3cfe('0x27')]||0x0,'telephone':_0xd05b2a[_0x3cfe('0x28')]||0x0};_0xd855b7[_0x3cfe('0x29')](function(_0x4c2b77){var _0x3e8c1e=_0x4c2b77['role']==='admin'?_0x3cfe('0x25'):_0x4c2b77[_0x3cfe('0x22')];_0x4f859a[_0x3e8c1e]-=_0x4c2b77[_0x3cfe('0x23')];if(_0x4f859a[_0x3e8c1e]<0x0)_0x4f859a[_0x3e8c1e]=0x0;});_0x206360(_0x4f859a);return;});})[_0x3cfe('0xc')](function(_0x30dfc6){_0x5e94d9(_0x30dfc6);});});}function checkUserLimits(_0x391466){return new BPromise(function(_0x2aee9b,_0xa438){getLimits()[_0x3cfe('0xb')](function(_0x556ef1){var _0x3359de=_[_0x3cfe('0x2a')](_[_0x3cfe('0x2b')](_0x391466,_0x3cfe('0x22')),[_0x3cfe('0x24'),'user',_0x3cfe('0x26')]);var _0x4f7a91=(_0x3359de[_0x3cfe('0x24')]||0x0)+(_0x3359de['user']||0x0);var _0x5659bc=_0x3359de[_0x3cfe('0x26')]||0x0;if(_0x4f7a91>_0x556ef1[_0x3cfe('0x25')])return _0xa438(_0x3cfe('0x2c'));if(_0x5659bc>_0x556ef1['telephone'])return _0xa438(_0x3cfe('0x2d'));return _0x2aee9b();})['catch'](function(_0x52396f){_0xa438(_0x52396f);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index cf00a02..4292fa4 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 _0xfcbb=['http://localhost:9000','myappanuglar-secret','exports'];(function(_0x1870f8,_0x34f3d4){var _0x4e1ec0=function(_0xc62064){while(--_0xc62064){_0x1870f8['push'](_0x1870f8['shift']());}};_0x4e1ec0(++_0x34f3d4);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x3a7255,_0x3b7bcc){_0x3a7255=_0x3a7255-0x0;var _0x10b992=_0xfcbb[_0x3a7255];return _0x10b992;};'use strict';module[_0xbfcb('0x0')]={'DOMAIN':_0xbfcb('0x1'),'SESSION_SECRET':_0xbfcb('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x896e=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x40034b,_0x39fba0){var _0x771f74=function(_0x4b54ba){while(--_0x4b54ba){_0x40034b['push'](_0x40034b['shift']());}};_0x771f74(++_0x39fba0);}(_0x896e,0x1e9));var _0xe896=function(_0x22c723,_0x58dfb5){_0x22c723=_0x22c723-0x0;var _0x1ec8b5=_0x896e[_0x22c723];return _0x1ec8b5;};'use strict';module[_0xe896('0x0')]={'DOMAIN':_0xe896('0x1'),'SESSION_SECRET':_0xe896('0x2'),'GOOGLE_ID':_0xe896('0x3'),'GOOGLE_SECRET':_0xe896('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 498a83f..3a53b37 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19a5=['../utils/loggers','fileLogger'];(function(_0x22f404,_0x29c386){var _0x210a54=function(_0x4e68f2){while(--_0x4e68f2){_0x22f404['push'](_0x22f404['shift']());}};_0x210a54(++_0x29c386);}(_0x19a5,0x7a));var _0x519a=function(_0x443c29,_0x4c79e6){_0x443c29=_0x443c29-0x0;var _0x4b17bd=_0x19a5[_0x443c29];return _0x4b17bd;};'use strict';var fileLogger=require(_0x519a('0x0'))[_0x519a('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xe830=['fileLogger','exports','../utils/loggers'];(function(_0x4ba865,_0x10750e){var _0x54a36e=function(_0xd48f18){while(--_0xd48f18){_0x4ba865['push'](_0x4ba865['shift']());}};_0x54a36e(++_0x10750e);}(_0xe830,0xbf));var _0x0e83=function(_0xc7dcf6,_0x9ed6d0){_0xc7dcf6=_0xc7dcf6-0x0;var _0x19b5e5=_0xe830[_0xc7dcf6];return _0x19b5e5;};'use strict';var fileLogger=require(_0x0e83('0x0'))[_0x0e83('0x1')];module[_0x0e83('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b13abf6..f99475c 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 _0x1f91=['../../config/environment','root','legacy-libs','join','../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1f91,0xc2));var _0x11f9=function(_0x371e4c,_0x279833){_0x371e4c=_0x371e4c-0x0;var _0x4b214c=_0x1f91[_0x371e4c];return _0x4b214c;};'use strict';var path=require(_0x11f9('0x0'));var cfg=require(_0x11f9('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x11f9('0x2')],_0x11f9('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x11f9('0x4')](__dirname,_0x11f9('0x5')),'env':env},{'name':'ami','script':path[_0x11f9('0x4')](__dirname,_0x11f9('0x6')),'env':env},{'name':_0x11f9('0x7'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x11f9('0x8'),'script':path[_0x11f9('0x4')](__dirname,_0x11f9('0x9')),'env':env},{'name':_0x11f9('0xa'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x11f9('0x4')](__dirname,_0x11f9('0xb')),'env':env}]};module[_0x11f9('0xc')]=pm2config; \ No newline at end of file +var _0x294a=['../../services/email/index.js','../../services/routing/index.js','xdr','exports','path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x294a,0x100));var _0xa294=function(_0x159eab,_0x22d972){_0x159eab=_0x159eab-0x0;var _0x47e933=_0x294a[_0x159eab];return _0x47e933;};'use strict';var path=require(_0xa294('0x0'));var cfg=require(_0xa294('0x1'));var env={'NODE_PATH':path[_0xa294('0x2')](path[_0xa294('0x3')](cfg[_0xa294('0x4')],_0xa294('0x5')))};var pm2config={'apps':[{'name':'express','script':path[_0xa294('0x3')](__dirname,_0xa294('0x6')),'env':env},{'name':'ami','script':path[_0xa294('0x3')](__dirname,_0xa294('0x7')),'env':env},{'name':'agi','script':path[_0xa294('0x3')](__dirname,_0xa294('0x8')),'env':env},{'name':_0xa294('0x9'),'script':path['join'](__dirname,_0xa294('0xa')),'env':env},{'name':'routing','script':path[_0xa294('0x3')](__dirname,_0xa294('0xb')),'env':env},{'name':_0xa294('0xc'),'script':path[_0xa294('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xa294('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index be2fb99..62e4c06 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 _0x855f=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','then','disconnect','stop'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x855f,0xe3));var _0xf855=function(_0x779f77,_0xf203bb){_0x779f77=_0x779f77-0x0;var _0x28f34d=_0x855f[_0x779f77];return _0x28f34d;};'use strict';var pm2=require(_0xf855('0x0'));var BPromise=require(_0xf855('0x1'));var config=require(_0xf855('0x2'));function connect(){return new BPromise(function(_0x522fcf,_0x483a93){return pm2['connect'](function(_0xeff45d){if(_0xeff45d){return _0x483a93(_0xeff45d);}return _0x522fcf(_0xf855('0x3'));});});};exports['start']=function(_0x3db3a3){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0x5eb077,_0x433a32){return pm2['start'](_0x3db3a3,function(_0x4328b2,_0x3b6b6f){if(_0x4328b2){return _0x433a32(_0x4328b2);}pm2[_0xf855('0x5')]();return _0x5eb077(_0x3b6b6f);});});});};exports[_0xf855('0x6')]=function(_0x5ca87b){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0xf0c60,_0x39e838){return pm2[_0xf855('0x6')](_0x5ca87b,function(_0x3779eb,_0x2ab882){if(_0x3779eb){return _0x39e838(_0x3779eb);}pm2['disconnect']();return _0xf0c60(_0x2ab882);});});});};exports[_0xf855('0x7')]=function(_0xf28533){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0x378145,_0x2277bd){return pm2[_0xf855('0x7')](_0xf28533,function(_0x3beb62,_0x5b5fbb){if(_0x3beb62){return _0x2277bd(_0x3beb62);}pm2[_0xf855('0x5')]();return _0x378145(_0x5b5fbb);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x10df7d,_0x34e680){return pm2[_0xf855('0x8')](function(_0x472916,_0x1f77e6){if(_0x472916){return _0x34e680(_0x472916);}pm2[_0xf855('0x5')]();return _0x10df7d(_0x1f77e6);});});});};exports[_0xf855('0x9')]=function(_0x1c279c){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0x38a216,_0x519088){return pm2['describe'](_0x1c279c,function(_0x36ee89,_0xcde74f){if(_0x36ee89){return _0x519088(_0x36ee89);}pm2[_0xf855('0x5')]();return _0x38a216(_0xcde74f);});});});};exports[_0xf855('0xa')]=function(_0x558656){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0x5d26e6,_0x17f2f1){return pm2[_0xf855('0xa')](_0x558656,function(_0xa0c380,_0x535b61){if(_0xa0c380){return _0x17f2f1(_0xa0c380);}pm2[_0xf855('0x5')]();return _0x5d26e6(_0x535b61);});});});};exports[_0xf855('0xb')]=function(){return connect()[_0xf855('0x4')](function(){return new BPromise(function(_0x38ee58,_0x273444){return pm2[_0xf855('0xb')](function(_0x4d4350){if(_0x4d4350){return _0x273444(_0x4d4350);}return _0x38ee58(_0xf855('0xc'));});});});}; \ No newline at end of file +var _0x68f0=['delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe'];(function(_0x6503ff,_0x2b169a){var _0x22e638=function(_0x53e4c4){while(--_0x53e4c4){_0x6503ff['push'](_0x6503ff['shift']());}};_0x22e638(++_0x2b169a);}(_0x68f0,0xdf));var _0x068f=function(_0x532fef,_0x1472a3){_0x532fef=_0x532fef-0x0;var _0x4f38ca=_0x68f0[_0x532fef];return _0x4f38ca;};'use strict';var pm2=require(_0x068f('0x0'));var BPromise=require(_0x068f('0x1'));var config=require(_0x068f('0x2'));function connect(){return new BPromise(function(_0x5dd779,_0x341cb1){return pm2[_0x068f('0x3')](function(_0x275c8e){if(_0x275c8e){return _0x341cb1(_0x275c8e);}return _0x5dd779('connected');});});};exports[_0x068f('0x4')]=function(_0x22849c){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x2371c6,_0x3f20bc){return pm2[_0x068f('0x4')](_0x22849c,function(_0x2c7f06,_0x241597){if(_0x2c7f06){return _0x3f20bc(_0x2c7f06);}pm2[_0x068f('0x6')]();return _0x2371c6(_0x241597);});});});};exports[_0x068f('0x7')]=function(_0x2eb43a){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x1aa2c2,_0xb30117){return pm2[_0x068f('0x7')](_0x2eb43a,function(_0xe2f39c,_0x571b4d){if(_0xe2f39c){return _0xb30117(_0xe2f39c);}pm2['disconnect']();return _0x1aa2c2(_0x571b4d);});});});};exports[_0x068f('0x8')]=function(_0x39daee){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x3f8cde,_0x1e6985){return pm2[_0x068f('0x8')](_0x39daee,function(_0x2b3224,_0x5b6402){if(_0x2b3224){return _0x1e6985(_0x2b3224);}pm2[_0x068f('0x6')]();return _0x3f8cde(_0x5b6402);});});});};exports[_0x068f('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x363ed5,_0x571d65){return pm2[_0x068f('0x9')](function(_0x5108b0,_0x1552cb){if(_0x5108b0){return _0x571d65(_0x5108b0);}pm2['disconnect']();return _0x363ed5(_0x1552cb);});});});};exports[_0x068f('0xa')]=function(_0x124e7a){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x284f2d,_0x443267){return pm2['describe'](_0x124e7a,function(_0x56bec5,_0x59d1dc){if(_0x56bec5){return _0x443267(_0x56bec5);}pm2[_0x068f('0x6')]();return _0x284f2d(_0x59d1dc);});});});};exports[_0x068f('0xb')]=function(_0xc480cf){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x2637e4,_0xd36736){return pm2['delete'](_0xc480cf,function(_0x1229db,_0x28ccab){if(_0x1229db){return _0xd36736(_0x1229db);}pm2[_0x068f('0x6')]();return _0x2637e4(_0x28ccab);});});});};exports[_0x068f('0xc')]=function(){return connect()[_0x068f('0x5')](function(){return new BPromise(function(_0x3ae69b,_0x59ecdc){return pm2[_0x068f('0xc')](function(_0x447e4f){if(_0x447e4f){return _0x59ecdc(_0x447e4f);}return _0x3ae69b('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 02df63f..1b020dd 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 _0xf094=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','Setting','then','chatTimeout','ChatInteraction','lastMsgAt','minutes','length'];(function(_0x305f11,_0x26c4a6){var _0x14004c=function(_0x57ae06){while(--_0x57ae06){_0x305f11['push'](_0x305f11['shift']());}};_0x14004c(++_0x26c4a6);}(_0xf094,0xec));var _0x4f09=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xf094[_0x3afe18];return _0x19ed1f;};'use strict';var _=require(_0x4f09('0x0'));var moment=require(_0x4f09('0x1'));var Redis=require(_0x4f09('0x2'));var util=require(_0x4f09('0x3'));var config=require(_0x4f09('0x4'));var db=require(_0x4f09('0x5'))['db'];var logger=require(_0x4f09('0x6'))('schedule');config[_0x4f09('0x7')]=_['defaults'](config['redis'],{'host':_0x4f09('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f09('0x7')]));function closeInteractions(){var _0x22048e=0x0;var _0x1996c9=[];return db[_0x4f09('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4f09('0xa')](function(_0x3cac6a){_0x22048e=_0x3cac6a[_0x4f09('0xb')];if(_0x22048e){return db[_0x4f09('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x4f09('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3cac6a['chatTimeout'],_0x4f09('0xe'))}}});}else{return[];}})['then'](function(_0x42a079){if(_0x42a079&&_0x42a079[_0x4f09('0xf')]){_0x1996c9=_[_0x4f09('0x10')](_0x42a079||[],'id');logger[_0x4f09('0x11')](_0x4f09('0x12'),_0x1996c9[_0x4f09('0x13')]());return db[_0x4f09('0xc')][_0x4f09('0x14')]({'closeReason':'system','disposition':_0x4f09('0x15'),'closed':!![],'closedAt':moment()['format'](_0x4f09('0x16'))},{'where':{'id':_0x1996c9}});}})[_0x4f09('0xa')](function(){if(_0x1996c9&&_0x1996c9[_0x4f09('0xf')]){logger[_0x4f09('0x11')](_0x4f09('0x17'),_0x1996c9[_0x4f09('0x13')]());for(var _0x44f1c8=0x0;_0x44f1c8<_0x1996c9[_0x4f09('0xf')];_0x44f1c8++){io['emit'](_0x4f09('0x18'),{'id':_0x1996c9[_0x44f1c8],'closed':!![]});}}})[_0x4f09('0x19')](function(_0xafa17c){logger[_0x4f09('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0xafa17c?util['inspect'](_0xafa17c,{'showHidden':![],'depth':null}):'');});}exports[_0x4f09('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x773e=['timeout','format','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x26473c,_0x1ae5fa){var _0x2210ce=function(_0x183d6d){while(--_0x183d6d){_0x26473c['push'](_0x26473c['shift']());}};_0x2210ce(++_0x1ae5fa);}(_0x773e,0x12a));var _0xe773=function(_0x50ecd2,_0x5ddf30){_0x50ecd2=_0x50ecd2-0x0;var _0x4e256e=_0x773e[_0x50ecd2];return _0x4e256e;};'use strict';var _=require(_0xe773('0x0'));var moment=require(_0xe773('0x1'));var Redis=require(_0xe773('0x2'));var util=require(_0xe773('0x3'));var config=require(_0xe773('0x4'));var db=require(_0xe773('0x5'))['db'];var logger=require(_0xe773('0x6'))('schedule');config[_0xe773('0x7')]=_[_0xe773('0x8')](config[_0xe773('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe773('0x7')]));function closeInteractions(){var _0x448c84=0x0;var _0x411b33=[];return db[_0xe773('0x9')]['find']({'raw':!![],'attributes':['id',_0xe773('0xa')],'where':{'id':0x1}})[_0xe773('0xb')](function(_0x53be40){_0x448c84=_0x53be40[_0xe773('0xa')];if(_0x448c84){return db[_0xe773('0xc')][_0xe773('0xd')]({'raw':!![],'attributes':['id',_0xe773('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe773('0xf')](_0x53be40['chatTimeout'],_0xe773('0x10'))}}});}else{return[];}})[_0xe773('0xb')](function(_0x38c6a3){if(_0x38c6a3&&_0x38c6a3['length']){_0x411b33=_[_0xe773('0x11')](_0x38c6a3||[],'id');logger['info'](_0xe773('0x12'),_0x411b33[_0xe773('0x13')]());return db[_0xe773('0xc')][_0xe773('0x14')]({'closeReason':_0xe773('0x15'),'disposition':_0xe773('0x16'),'closed':!![],'closedAt':moment()[_0xe773('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x411b33}});}})[_0xe773('0xb')](function(){if(_0x411b33&&_0x411b33[_0xe773('0x18')]){logger[_0xe773('0x19')](_0xe773('0x1a'),_0x411b33[_0xe773('0x13')]());for(var _0x53e9b1=0x0;_0x53e9b1<_0x411b33[_0xe773('0x18')];_0x53e9b1++){io[_0xe773('0x1b')]('chatInteraction:update',{'id':_0x411b33[_0x53e9b1],'closed':!![]});}}})[_0xe773('0x1c')](function(_0x2e8687){logger['error'](_0xe773('0x1d'),_0x2e8687?util[_0xe773('0x1e')](_0x2e8687,{'showHidden':![],'depth':null}):'');});}exports[_0xe773('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 5ee9ff8..1cb35d0 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 _0x689a=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3901ec,_0x13deae){var _0x10f9c2=function(_0x58afda){while(--_0x58afda){_0x3901ec['push'](_0x3901ec['shift']());}};_0x10f9c2(++_0x13deae);}(_0x689a,0x107));var _0xa689=function(_0x4a4bc1,_0x742646){_0x4a4bc1=_0x4a4bc1-0x0;var _0x924cda=_0x689a[_0x4a4bc1];return _0x924cda;};'use strict';function start(){var _0x562ea4=require(_0xa689('0x0'));return _0x562ea4['startAllRefreshIntervals']();}module[_0xa689('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf490=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1b4174,_0x35eecb){var _0x35dd09=function(_0x439f24){while(--_0x439f24){_0x1b4174['push'](_0x1b4174['shift']());}};_0x35dd09(++_0x35eecb);}(_0xf490,0x91));var _0x0f49=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0xf490[_0xf35bc1];return _0xa6b162;};'use strict';function start(){var _0x2f4bb5=require(_0x0f49('0x0'));return _0x2f4bb5[_0x0f49('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b6f935e..0190ca1 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 _0xdc2b=['moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','basename','extname','zip','join','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','exists','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop','endAt','update','update\x20cron','run','path'];(function(_0x1b8beb,_0x3c0253){var _0xab297f=function(_0x144981){while(--_0x144981){_0x1b8beb['push'](_0x1b8beb['shift']());}};_0xab297f(++_0x3c0253);}(_0xdc2b,0xf8));var _0xbdc2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdc2b[_0x1d24eb];return _0x1dc576;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xbdc2('0x0'));var _=require('lodash');var moment=require(_0xbdc2('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xbdc2('0x2'));var BPromise=require(_0xbdc2('0x3'));var logger=require(_0xbdc2('0x4'))(_0xbdc2('0x5'));var db=require(_0xbdc2('0x6'))['db'];var analyticCustomReportController=require(_0xbdc2('0x7'));var analyticDefaultReportController=require(_0xbdc2('0x8'));var client=jayson[_0xbdc2('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2a37a0,_0x18d19e){return function(){logger[_0xbdc2('0xa')](_0xbdc2('0xb'),_0x2a37a0['email']);var _0x3c8c07=!![];var _0xed4ee8=_0x2a37a0[_0xbdc2('0xc')][_0xbdc2('0xd')]();var _0x21f327={'account':_0xed4ee8,'message':{'from':util[_0xbdc2('0xe')](_0xbdc2('0xf'),_0x2a37a0[_0xbdc2('0xc')][_0xbdc2('0x10')],_0x2a37a0[_0xbdc2('0xc')]['email']||_0x2a37a0['MailAccount'][_0xbdc2('0x11')]['user']),'to':_0x2a37a0[_0xbdc2('0x12')],'cc':_0x2a37a0['cc'],'bcc':_0x2a37a0[_0xbdc2('0x13')],'subject':util['format'](_0xbdc2('0x14'),_0x18d19e[_0xbdc2('0x10')],_0x2a37a0[_0xbdc2('0x15')],_0x2a37a0[_0xbdc2('0x16')])}};var _0x388dea=path['join'](__dirname,'../../files/reports');var _0x26f665=_0x18d19e[_0xbdc2('0x17')];var _0x3fcc72=util[_0xbdc2('0xe')]('%s.%s',path[_0xbdc2('0x18')](_0x18d19e[_0xbdc2('0x17')],path[_0xbdc2('0x19')](_0x18d19e[_0xbdc2('0x17')])),_0xbdc2('0x1a'));var _0x19a40b=path[_0xbdc2('0x1b')](_0x388dea,_0x26f665);var _0x5a958c=path['join'](_0x388dea,_0x3fcc72);if(fs[_0xbdc2('0x1c')](_0x19a40b)){_0x18d19e['status']=_0xbdc2('0x1d');_0x21f327[_0xbdc2('0x1e')][_0xbdc2('0x1f')]=[{'filename':_0x26f665,'path':_0x19a40b}];_0x21f327['message']['text']=util[_0xbdc2('0xe')](_0xbdc2('0x20'),JSON['stringify'](_0x18d19e,null,0x2));}else if(fs[_0xbdc2('0x1c')](_0x5a958c)){_0x18d19e[_0xbdc2('0x21')]=_0xbdc2('0x1d');_0x21f327[_0xbdc2('0x1e')]['attachments']=[{'filename':_0x3fcc72,'path':_0x5a958c}];}else{_0x21f327[_0xbdc2('0x1e')]['text']=_0xbdc2('0x22');if(!_0x2a37a0[_0xbdc2('0x23')]){_0x3c8c07=![];logger[_0xbdc2('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3c8c07){return client['request'](_0xbdc2('0x24'),_0x21f327)[_0xbdc2('0x25')](function(_0xadfe2e){if(_0xadfe2e[_0xbdc2('0x26')]){return logger['error'](_0xbdc2('0x27'),JSON['stringify'](_0xadfe2e));}return logger[_0xbdc2('0xa')](_0xbdc2('0x28'));})[_0xbdc2('0x29')](function(_0xd79c94){return logger['error'](_0xbdc2('0x27'),JSON['stringify'](_0xd79c94));});}};}function handleError(){return function(_0x511fd8){return logger[_0xbdc2('0x26')](JSON[_0xbdc2('0x2a')](_0x511fd8));};}function handleResult(_0x41037d){return function(_0x2fc03b){logger[_0xbdc2('0xa')]('data',JSON[_0xbdc2('0x2a')](_0x2fc03b));if(_0x41037d[_0xbdc2('0xc')]&&_0x41037d[_0xbdc2('0xc')][_0xbdc2('0x11')]&&!_['isNil'](_0x41037d[_0xbdc2('0x12')])){setTimeout(handleSendEmail(_0x41037d,_0x2fc03b),0x3c*0x3e8);}};}function handleJob(_0x5455c9){return function(){try{if(_[_0xbdc2('0x2b')](_0x5455c9[_0xbdc2('0x15')])){return logger[_0xbdc2('0xa')](_0xbdc2('0x2c'));}if(_[_0xbdc2('0x2b')](_0x5455c9[_0xbdc2('0x16')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0xe061b9={'startDate':moment()[_0xbdc2('0x2d')](_0x5455c9[_0xbdc2('0x15')],_0x5455c9[_0xbdc2('0x16')])[_0xbdc2('0xe')](_0xbdc2('0x2e')),'endDate':moment()[_0xbdc2('0xe')](_0xbdc2('0x2e')),'type':_0xbdc2('0x2f'),'output':_0x5455c9[_0xbdc2('0x30')],'name':_0x5455c9['name']};if(!_[_0xbdc2('0x2b')](_0x5455c9['DefaultReportId'])){logger[_0xbdc2('0xa')](_0xbdc2('0x31'),_0x5455c9['DefaultReportId']);return analyticDefaultReportController[_0xbdc2('0x32')]({'id':_0x5455c9[_0xbdc2('0x33')]},_0xe061b9)[_0xbdc2('0x25')](handleResult(_0x5455c9))[_0xbdc2('0x29')](handleError());}if(!_['isNil'](_0x5455c9['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x5455c9[_0xbdc2('0x34')]);return analyticCustomReportController['runReport']({'id':_0x5455c9[_0xbdc2('0x34')]},_0xe061b9)[_0xbdc2('0x25')](handleResult(_0x5455c9))['catch'](handleError());}}catch(_0x2e4e69){logger[_0xbdc2('0x26')](JSON[_0xbdc2('0x2a')](_0x2e4e69));}return logger[_0xbdc2('0xa')](_0xbdc2('0x35'));};}function getJobs(_0x44a901){var _0x1706d7={};if(_0x44a901){_0x1706d7['id']=_0x44a901;}return db[_0xbdc2('0x36')][_0xbdc2('0x37')]({'where':_0x1706d7,'include':[{'model':db[_0xbdc2('0xc')],'attributes':['id',_0xbdc2('0x10'),_0xbdc2('0x12')],'include':[{'model':db[_0xbdc2('0x38')],'as':_0xbdc2('0x11'),'include':[{'model':db[_0xbdc2('0x39')],'as':_0xbdc2('0x39')}]}]}]})[_0xbdc2('0x25')](function(_0x478dab){var _0x218fac=_['keys'](manager[_0xbdc2('0x3a')]);var _0x5a6c67=_[_0xbdc2('0x3b')](_0x478dab,function(_0x1c41e7){return _0x1c41e7['id'][_0xbdc2('0x3c')]();});var _0x1f67a2=_[_0xbdc2('0x3d')](_0x478dab,function(_0x24a31b){return _0x24a31b['id'][_0xbdc2('0x3c')]();});var _0x50b48d=_0x44a901?_0x5a6c67:_[_0xbdc2('0x3e')](_0x5a6c67,_0x218fac);var _0x2f2d38=_[_0xbdc2('0x3f')](_0x5a6c67,_0x218fac);var _0x53a409=_[_0xbdc2('0x3e')](_0x218fac,_0x5a6c67);var _0x2088b8;var _0x31b5d4;for(_0x2088b8=0x0;_0x2088b8<_0x53a409['length']&&!_0x44a901;_0x2088b8+=0x1){_0x31b5d4=_0x53a409[_0x2088b8]['toString']();if(manager[_0xbdc2('0x40')](_0x31b5d4)){manager['stop'](_0x31b5d4);manager[_0xbdc2('0x41')](_0x31b5d4);logger[_0xbdc2('0xa')]('delete\x20cron',_0x31b5d4);}}logger[_0xbdc2('0xa')](_0xbdc2('0x42'),JSON[_0xbdc2('0x2a')](_0x50b48d));for(_0x2088b8=0x0;_0x2088b8<_0x50b48d[_0xbdc2('0x43')];_0x2088b8+=0x1){_0x31b5d4=_0x50b48d[_0x2088b8][_0xbdc2('0x3c')]();logger['info'](_0xbdc2('0x44'),_0x31b5d4);if(_0x44a901){logger['info'](_0xbdc2('0x45'),_0x44a901);logger[_0xbdc2('0xa')](JSON[_0xbdc2('0x2a')](_0x1f67a2[_0x31b5d4]));BPromise[_0xbdc2('0x46')]()[_0xbdc2('0x25')](handleJob(_0x1f67a2[_0x31b5d4]));logger[_0xbdc2('0xa')](_0xbdc2('0x47'),_0x1f67a2[_0x31b5d4][_0xbdc2('0x10')],_0x1f67a2[_0x31b5d4]['cron']);}else if(_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]&&_0x1f67a2[_0x31b5d4][_0xbdc2('0x49')]&&moment()[_0xbdc2('0x4a')](_0x1f67a2[_0x31b5d4][_0xbdc2('0x4b')],_0x1f67a2[_0x31b5d4]['endAt'])){manager['add'](_0x31b5d4,_0x1f67a2[_0x31b5d4]['cron'],handleJob(_0x1f67a2[_0x31b5d4]));manager[_0xbdc2('0x4c')](_0x31b5d4);logger['info'](_0xbdc2('0x4d'),_0x1f67a2[_0x31b5d4]['name'],_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]);}else if(manager[_0xbdc2('0x40')](_0x31b5d4)){manager[_0xbdc2('0x4e')](_0x31b5d4);manager['deleteJob'](_0x31b5d4);logger[_0xbdc2('0xa')]('stop\x20cron',_0x1f67a2[_0x31b5d4][_0xbdc2('0x10')],_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]);}}for(_0x2088b8=0x0,_0x31b5d4;_0x2088b8<_0x2f2d38[_0xbdc2('0x43')]&&!_0x44a901;_0x2088b8+=0x1){_0x31b5d4=_0x2f2d38[_0x2088b8]['toString']();if(manager[_0xbdc2('0x40')](_0x31b5d4)){if(_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]&&_0x1f67a2[_0x31b5d4][_0xbdc2('0x49')]&&moment()[_0xbdc2('0x4a')](_0x1f67a2[_0x31b5d4][_0xbdc2('0x4b')],_0x1f67a2[_0x31b5d4][_0xbdc2('0x4f')])){manager[_0xbdc2('0x50')](_0x31b5d4,_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')],handleJob(_0x1f67a2[_0x31b5d4]));logger[_0xbdc2('0xa')](_0xbdc2('0x51'),_0x1f67a2[_0x31b5d4][_0xbdc2('0x10')],_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]);}else{manager[_0xbdc2('0x4e')](_0x31b5d4);manager[_0xbdc2('0x41')](_0x31b5d4);logger['info']('stop\x20cron',_0x1f67a2[_0x31b5d4][_0xbdc2('0x10')],_0x1f67a2[_0x31b5d4][_0xbdc2('0x48')]);}}}})[_0xbdc2('0x29')](function(_0x2ef0d3){logger['error'](JSON[_0xbdc2('0x2a')](_0x2ef0d3));});}exports[_0xbdc2('0x52')]=function(_0x2770ba){return getJobs(_0x2770ba);};exports[_0xbdc2('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x034f=['basename','zip','join','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','info','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','exists','deleteJob','delete\x20cron','toRun','length','index','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop','update','update\x20cron','stop\x20cron','start','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x034f,0xf3));var _0xf034=function(_0x1db1b4,_0x13fde4){_0x1db1b4=_0x1db1b4-0x0;var _0x19155f=_0x034f[_0x1db1b4];return _0x19155f;};'use strict';var fs=require('fs');var util=require(_0xf034('0x0'));var path=require('path');var _=require(_0xf034('0x1'));var moment=require('moment');var CronJobManager=require(_0xf034('0x2'));var jayson=require(_0xf034('0x3'));var BPromise=require(_0xf034('0x4'));var logger=require(_0xf034('0x5'))(_0xf034('0x6'));var db=require(_0xf034('0x7'))['db'];var analyticCustomReportController=require(_0xf034('0x8'));var analyticDefaultReportController=require(_0xf034('0x9'));var client=jayson[_0xf034('0xa')][_0xf034('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x48c672,_0x25a0ac){return function(){logger['info'](_0xf034('0xc'),_0x48c672[_0xf034('0xd')]);var _0x3523a7=!![];var _0x31a7a4=_0x48c672[_0xf034('0xe')][_0xf034('0xf')]();var _0x4c7db4={'account':_0x31a7a4,'message':{'from':util['format'](_0xf034('0x10'),_0x48c672[_0xf034('0xe')][_0xf034('0x11')],_0x48c672[_0xf034('0xe')][_0xf034('0xd')]||_0x48c672['MailAccount'][_0xf034('0x12')][_0xf034('0x13')]),'to':_0x48c672['email'],'cc':_0x48c672['cc'],'bcc':_0x48c672[_0xf034('0x14')],'subject':util[_0xf034('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x25a0ac[_0xf034('0x11')],_0x48c672[_0xf034('0x16')],_0x48c672[_0xf034('0x17')])}};var _0xa49925=path['join'](__dirname,_0xf034('0x18'));var _0x2c720d=_0x25a0ac[_0xf034('0x19')];var _0x163351=util[_0xf034('0x15')](_0xf034('0x1a'),path[_0xf034('0x1b')](_0x25a0ac[_0xf034('0x19')],path['extname'](_0x25a0ac['savename'])),_0xf034('0x1c'));var _0x3733c8=path['join'](_0xa49925,_0x2c720d);var _0x57ddf5=path[_0xf034('0x1d')](_0xa49925,_0x163351);if(fs['existsSync'](_0x3733c8)){_0x25a0ac[_0xf034('0x1e')]=_0xf034('0x1f');_0x4c7db4[_0xf034('0x20')][_0xf034('0x21')]=[{'filename':_0x2c720d,'path':_0x3733c8}];_0x4c7db4[_0xf034('0x20')][_0xf034('0x22')]=util[_0xf034('0x15')](_0xf034('0x23'),JSON[_0xf034('0x24')](_0x25a0ac,null,0x2));}else if(fs[_0xf034('0x25')](_0x57ddf5)){_0x25a0ac[_0xf034('0x1e')]='Sent';_0x4c7db4[_0xf034('0x20')][_0xf034('0x21')]=[{'filename':_0x163351,'path':_0x57ddf5}];}else{_0x4c7db4[_0xf034('0x20')][_0xf034('0x22')]=_0xf034('0x26');if(!_0x48c672[_0xf034('0x27')]){_0x3523a7=![];logger['info'](_0xf034('0x28'));}}if(_0x3523a7){return client[_0xf034('0x29')](_0xf034('0x2a'),_0x4c7db4)[_0xf034('0x2b')](function(_0x34c833){if(_0x34c833[_0xf034('0x2c')]){return logger[_0xf034('0x2c')](_0xf034('0x2d'),JSON[_0xf034('0x24')](_0x34c833));}return logger[_0xf034('0x2e')](_0xf034('0x2f'));})[_0xf034('0x30')](function(_0x129f55){return logger[_0xf034('0x2c')](_0xf034('0x2d'),JSON[_0xf034('0x24')](_0x129f55));});}};}function handleError(){return function(_0x177d9d){return logger[_0xf034('0x2c')](JSON[_0xf034('0x24')](_0x177d9d));};}function handleResult(_0x1b99a0){return function(_0x4345a9){logger['info'](_0xf034('0x31'),JSON[_0xf034('0x24')](_0x4345a9));if(_0x1b99a0['MailAccount']&&_0x1b99a0[_0xf034('0xe')][_0xf034('0x12')]&&!_['isNil'](_0x1b99a0[_0xf034('0xd')])){setTimeout(handleSendEmail(_0x1b99a0,_0x4345a9),0x3c*0x3e8);}};}function handleJob(_0x18b804){return function(){try{if(_['isNil'](_0x18b804[_0xf034('0x16')])){return logger[_0xf034('0x2e')](_0xf034('0x32'));}if(_[_0xf034('0x33')](_0x18b804['subtractUnit'])){return logger[_0xf034('0x2e')]('subtractUnit\x20null\x20or\x20undefined');}var _0x24eefb={'startDate':moment()['subtract'](_0x18b804[_0xf034('0x16')],_0x18b804[_0xf034('0x17')])[_0xf034('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf034('0x15')](_0xf034('0x34')),'type':_0xf034('0x35'),'output':_0x18b804[_0xf034('0x36')],'name':_0x18b804[_0xf034('0x11')]};if(!_['isNil'](_0x18b804[_0xf034('0x37')])){logger[_0xf034('0x2e')](_0xf034('0x38'),_0x18b804[_0xf034('0x37')]);return analyticDefaultReportController[_0xf034('0x39')]({'id':_0x18b804['DefaultReportId']},_0x24eefb)[_0xf034('0x2b')](handleResult(_0x18b804))[_0xf034('0x30')](handleError());}if(!_[_0xf034('0x33')](_0x18b804[_0xf034('0x3a')])){logger[_0xf034('0x2e')](_0xf034('0x3b'),_0x18b804['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x18b804[_0xf034('0x3a')]},_0x24eefb)['then'](handleResult(_0x18b804))[_0xf034('0x30')](handleError());}}catch(_0x7c41fd){logger[_0xf034('0x2c')](JSON['stringify'](_0x7c41fd));}return logger[_0xf034('0x2e')](_0xf034('0x3c'));};}function getJobs(_0x502465){var _0x2dcb3e={};if(_0x502465){_0x2dcb3e['id']=_0x502465;}return db[_0xf034('0x3d')][_0xf034('0x3e')]({'where':_0x2dcb3e,'include':[{'model':db[_0xf034('0xe')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xf034('0x3f')],'as':'CloudProvider'}]}]}]})[_0xf034('0x2b')](function(_0x199fd8){var _0x2cdc09=_[_0xf034('0x40')](manager[_0xf034('0x41')]);var _0x25d685=_[_0xf034('0x42')](_0x199fd8,function(_0x2b17b7){return _0x2b17b7['id'][_0xf034('0x43')]();});var _0x2405ba=_[_0xf034('0x44')](_0x199fd8,function(_0x5b1f57){return _0x5b1f57['id'][_0xf034('0x43')]();});var _0x290aab=_0x502465?_0x25d685:_['difference'](_0x25d685,_0x2cdc09);var _0x571565=_[_0xf034('0x45')](_0x25d685,_0x2cdc09);var _0x114174=_[_0xf034('0x46')](_0x2cdc09,_0x25d685);var _0x36a83c;var _0x27206f;for(_0x36a83c=0x0;_0x36a83c<_0x114174['length']&&!_0x502465;_0x36a83c+=0x1){_0x27206f=_0x114174[_0x36a83c][_0xf034('0x43')]();if(manager[_0xf034('0x47')](_0x27206f)){manager['stop'](_0x27206f);manager[_0xf034('0x48')](_0x27206f);logger[_0xf034('0x2e')](_0xf034('0x49'),_0x27206f);}}logger[_0xf034('0x2e')](_0xf034('0x4a'),JSON[_0xf034('0x24')](_0x290aab));for(_0x36a83c=0x0;_0x36a83c<_0x290aab[_0xf034('0x4b')];_0x36a83c+=0x1){_0x27206f=_0x290aab[_0x36a83c][_0xf034('0x43')]();logger[_0xf034('0x2e')](_0xf034('0x4c'),_0x27206f);if(_0x502465){logger['info']('my\x20id',_0x502465);logger['info'](JSON[_0xf034('0x24')](_0x2405ba[_0x27206f]));BPromise[_0xf034('0x4d')]()[_0xf034('0x2b')](handleJob(_0x2405ba[_0x27206f]));logger[_0xf034('0x2e')]('run\x20job',_0x2405ba[_0x27206f][_0xf034('0x11')],_0x2405ba[_0x27206f][_0xf034('0x4e')]);}else if(_0x2405ba[_0x27206f][_0xf034('0x4e')]&&_0x2405ba[_0x27206f][_0xf034('0x4f')]&&moment()[_0xf034('0x50')](_0x2405ba[_0x27206f][_0xf034('0x51')],_0x2405ba[_0x27206f][_0xf034('0x52')])){manager[_0xf034('0x53')](_0x27206f,_0x2405ba[_0x27206f][_0xf034('0x4e')],handleJob(_0x2405ba[_0x27206f]));manager['start'](_0x27206f);logger[_0xf034('0x2e')](_0xf034('0x54'),_0x2405ba[_0x27206f]['name'],_0x2405ba[_0x27206f]['cron']);}else if(manager[_0xf034('0x47')](_0x27206f)){manager[_0xf034('0x55')](_0x27206f);manager[_0xf034('0x48')](_0x27206f);logger[_0xf034('0x2e')]('stop\x20cron',_0x2405ba[_0x27206f][_0xf034('0x11')],_0x2405ba[_0x27206f][_0xf034('0x4e')]);}}for(_0x36a83c=0x0,_0x27206f;_0x36a83c<_0x571565[_0xf034('0x4b')]&&!_0x502465;_0x36a83c+=0x1){_0x27206f=_0x571565[_0x36a83c][_0xf034('0x43')]();if(manager[_0xf034('0x47')](_0x27206f)){if(_0x2405ba[_0x27206f][_0xf034('0x4e')]&&_0x2405ba[_0x27206f][_0xf034('0x4f')]&&moment()[_0xf034('0x50')](_0x2405ba[_0x27206f]['startAt'],_0x2405ba[_0x27206f][_0xf034('0x52')])){manager[_0xf034('0x56')](_0x27206f,_0x2405ba[_0x27206f]['cron'],handleJob(_0x2405ba[_0x27206f]));logger[_0xf034('0x2e')](_0xf034('0x57'),_0x2405ba[_0x27206f]['name'],_0x2405ba[_0x27206f]['cron']);}else{manager[_0xf034('0x55')](_0x27206f);manager[_0xf034('0x48')](_0x27206f);logger[_0xf034('0x2e')](_0xf034('0x58'),_0x2405ba[_0x27206f][_0xf034('0x11')],_0x2405ba[_0x27206f][_0xf034('0x4e')]);}}}})['catch'](function(_0x4ff637){logger[_0xf034('0x2c')](JSON['stringify'](_0x4ff637));});}exports['run']=function(_0x2a8160){return getJobs(_0x2a8160);};exports[_0xf034('0x59')]=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 c983689..34c065b 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 _0x4899=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','sentimentAccountId','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','sentimentRegion','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','COMPLETED','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','start','lodash','request-promise','bluebird','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','then','fileText','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x4899,0x74));var _0x9489=function(_0x1ae4fd,_0x3ec9cd){_0x1ae4fd=_0x1ae4fd-0x0;var _0x359c3=_0x4899[_0x1ae4fd];return _0x359c3;};var _=require(_0x9489('0x0'));var AWS=require('aws-sdk');var rp=require(_0x9489('0x1'));var util=require('util');var BPromise=require(_0x9489('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x9489('0x3'))(_0x9489('0x4'));function getTranscriptionJob(_0x2a7d88,_0x2a8d19,_0xbeb4d3,_0x49173a){return new Promise(function(_0x99c731,_0x3d7499){var _0x411ebe=new AWS[(_0x9489('0x5'))]({'accessKeyId':_0x2a8d19,'secretAccessKey':_0x2a7d88,'region':_0xbeb4d3});_0x411ebe['getTranscriptionJob']({'TranscriptionJobName':_0x49173a},function(_0x553c77,_0x1379eb){if(_0x553c77){return _0x3d7499(_0x553c77);}else{return _0x99c731(_0x1379eb);}});});}function sentiment(_0x5ec4cf,_0x3590a3,_0xb426d8,_0x52f169,_0x1dac7c){return new Promise(function(_0x12480e,_0x141c15){var _0x91d101=new AWS[(_0x9489('0x6'))]({'accessKeyId':_0x3590a3,'secretAccessKey':_0x5ec4cf,'region':_0xb426d8});_0x91d101[_0x9489('0x7')]({'Text':_0x52f169,'LanguageCode':_0x1dac7c[_0x9489('0x8')](0x0,0x2)},function(_0xae3bc6,_0x5df21d){if(_0xae3bc6){return _0x141c15(_0xae3bc6);}else{return _0x12480e(_0x5df21d);}});});}function checkTranscribeJob(_0x3fa5b7,_0x208490,_0x7368e2){var _0x5de484;return new BPromise(function(_0x532b72,_0x3ad3b4){logger[_0x9489('0x9')](util[_0x9489('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3fa5b7['id'],_0x3fa5b7[_0x9489('0xb')]));return getTranscriptionJob(_0x7368e2['data1'],_0x7368e2[_0x9489('0xc')],_0x208490['transcribeRegion'],_0x3fa5b7[_0x9489('0xb')])[_0x9489('0xd')](function(_0x1cb631){logger[_0x9489('0x9')](util[_0x9489('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3fa5b7['id'],_0x3fa5b7[_0x9489('0xb')],_0x1cb631['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x3fa5b7[_0x9489('0xe')]){switch(_0x1cb631[_0x9489('0xf')][_0x9489('0x10')]){case'COMPLETED':var _0x23ef8f={'transcribeStatus':_0x1cb631[_0x9489('0xf')]['TranscriptionJobStatus'],'fileUri':_0x1cb631['TranscriptionJob'][_0x9489('0x11')][_0x9489('0x12')]};logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x13'),_0x3fa5b7['id']));return rp({'uri':_0x1cb631[_0x9489('0xf')][_0x9489('0x11')]['TranscriptFileUri'],'json':!![]})[_0x9489('0xd')](function(_0x2f5535){logger[_0x9489('0x9')](util['format'](_0x9489('0x14'),_0x3fa5b7['id']));if(_0x2f5535&&_0x2f5535[_0x9489('0x15')]&&_0x2f5535[_0x9489('0x15')][_0x9489('0x16')]&&_0x2f5535[_0x9489('0x15')][_0x9489('0x16')]['length']){_0x23ef8f[_0x9489('0xe')]='';for(var _0xf68ab6=0x0;_0xf68ab6<_0x2f5535[_0x9489('0x15')][_0x9489('0x16')][_0x9489('0x17')];_0xf68ab6++){_0x23ef8f[_0x9489('0xe')]+=_0x2f5535[_0x9489('0x15')][_0x9489('0x16')][_0xf68ab6][_0x9489('0x18')]+'';}}return _0x3fa5b7[_0x9489('0x19')](_0x23ef8f);})[_0x9489('0xd')](function(){logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x1a'),_0x3fa5b7['id']));if(!_0x3fa5b7[_0x9489('0x1b')]){throw new db[(_0x9489('0x1c'))]['ValidationError'](_0x9489('0x1d'));}if(!_0x208490['sentiment']||!_0x208490['sentimentAccountId']||!_0x208490['sentimentRegion']||!_0x208490[_0x9489('0x1e')]||!_0x208490[_0x9489('0x1f')]){throw new db['Sequelize'][(_0x9489('0x20'))](_0x9489('0x21'));}if(!_0x23ef8f[_0x9489('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0x208490['sentimentAccountId']===_0x7368e2['id']){return _0x7368e2;}else{return db[_0x9489('0x22')]['findOne']({'where':{'id':_settings[_0x9489('0x23')]}});}})[_0x9489('0xd')](function(_0x19d472){if(!_0x19d472){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x19d472['data1']||!_0x19d472[_0x9489('0xc')]){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5de484=_0x19d472;logger[_0x9489('0x9')](util['format'](_0x9489('0x24'),_0x3fa5b7['id']));return sentiment(_0x5de484[_0x9489('0x25')],_0x5de484[_0x9489('0xc')],_0x208490[_0x9489('0x26')],_0x23ef8f['fileText'],_0x208490[_0x9489('0x1e')]);})[_0x9489('0xd')](function(_0x34f898){logger['info'](util[_0x9489('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3fa5b7['id']));return _0x3fa5b7[_0x9489('0x19')]({'sentiment':_0x34f898[_0x9489('0x27')],'sPositive':_0x34f898['SentimentScore'][_0x9489('0x28')],'sNegative':_0x34f898[_0x9489('0x29')][_0x9489('0x2a')],'sMixed':_0x34f898['SentimentScore'][_0x9489('0x2b')],'sNeutral':_0x34f898[_0x9489('0x29')][_0x9489('0x2c')]});})[_0x9489('0xd')](function(){logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x1a'),_0x3fa5b7['id']));_0x532b72();});case _0x9489('0x2d'):return _0x3fa5b7[_0x9489('0x19')]({'transcribeStatus':_0x9489('0x2d'),'failureReason':_0x1cb631[_0x9489('0xf')][_0x9489('0x2e')]})[_0x9489('0xd')](function(){logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x1a'),_0x3fa5b7['id']));_0x532b72();});default:logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x2f'),_0x3fa5b7['id']));break;}}else{return BPromise[_0x9489('0x30')]()[_0x9489('0xd')](function(){if(!_0x3fa5b7[_0x9489('0x1b')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x208490[_0x9489('0x31')]||!_0x208490[_0x9489('0x23')]||!_0x208490[_0x9489('0x26')]||!_0x208490[_0x9489('0x1e')]||!_0x208490[_0x9489('0x1f')]){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))](_0x9489('0x21'));}if(!_0x3fa5b7[_0x9489('0xe')]){throw new Error(_0x9489('0x32'));}if(_0x208490[_0x9489('0x23')]===_0x7368e2['id']){return _0x7368e2;}else{return db['CloudProvider'][_0x9489('0x33')]({'where':{'id':_settings[_0x9489('0x23')]}});}})[_0x9489('0xd')](function(_0x1b6f3e){if(!_0x1b6f3e){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))](_0x9489('0x34'));}if(!_0x1b6f3e[_0x9489('0x25')]||!_0x1b6f3e[_0x9489('0xc')]){throw new db['Sequelize'][(_0x9489('0x20'))](_0x9489('0x35'));}_0x5de484=_0x1b6f3e;logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x24'),_0x3fa5b7['id']));return sentiment(_0x5de484[_0x9489('0x25')],_0x5de484[_0x9489('0xc')],_0x208490['sentimentRegion'],_0x3fa5b7[_0x9489('0xe')],_0x208490[_0x9489('0x1e')]);})[_0x9489('0xd')](function(_0x400d04){logger[_0x9489('0x9')](util[_0x9489('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3fa5b7['id']));return _0x3fa5b7['update']({'sentiment':_0x400d04['Sentiment'],'sPositive':_0x400d04[_0x9489('0x29')][_0x9489('0x28')],'sNegative':_0x400d04[_0x9489('0x29')][_0x9489('0x2a')],'sMixed':_0x400d04[_0x9489('0x29')][_0x9489('0x2b')],'sNeutral':_0x400d04[_0x9489('0x29')][_0x9489('0x2c')],'transcribeStatus':_0x9489('0x36')});})[_0x9489('0xd')](function(){logger[_0x9489('0x9')](util[_0x9489('0xa')](_0x9489('0x1a'),_0x3fa5b7['id']));_0x532b72();});}})['catch'](function(_0x4ce544){if(_0x4ce544){if(!_0x4ce544[_0x9489('0x37')]||_0x4ce544[_0x9489('0x37')]!==_0x9489('0x38')){logger[_0x9489('0x39')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3fa5b7['id']),util[_0x9489('0x3a')](_0x4ce544,{'showHidden':![],'depth':null}));}}_0x532b72();});});}function checkTranscribe(){var _0x70372;var _0x149adf;var _0x356132;return db[_0x9489('0x3b')][_0x9489('0x3c')]({'where':{'transcribeStatus':_0x9489('0x3d')}})[_0x9489('0xd')](function(_0x25e18d){if(!_0x25e18d||!_0x25e18d[_0x9489('0x17')]){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))](_0x9489('0x3e'));}_0x70372=_0x25e18d;return db[_0x9489('0x3f')][_0x9489('0x33')]({'where':{'id':0x1}});})[_0x9489('0xd')](function(_0x346faf){if(!_0x346faf){throw new db[(_0x9489('0x1c'))][(_0x9489('0x20'))](_0x9489('0x40'));}_0x149adf=_0x346faf;if(!_0x149adf[_0x9489('0x4')]||!_0x149adf[_0x9489('0x41')]||!_0x149adf[_0x9489('0x42')]||!_0x149adf[_0x9489('0x1e')]||!_0x149adf[_0x9489('0x1f')]){throw new db['Sequelize'][(_0x9489('0x20'))](_0x9489('0x43'));}return db[_0x9489('0x22')][_0x9489('0x33')]({'where':{'id':_0x149adf[_0x9489('0x41')]}});})[_0x9489('0xd')](function(_0x1edcc1){if(!_0x1edcc1){throw new db[(_0x9489('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1edcc1[_0x9489('0x25')]||!_0x1edcc1['data2']){throw new db[(_0x9489('0x1c'))]['ValidationError'](_0x9489('0x35'));}_0x356132=_0x1edcc1;var _0x3819fe=[];_0x70372[_0x9489('0x44')](function(_0x3b5b60){_0x3819fe[_0x9489('0x45')](checkTranscribeJob(_0x3b5b60,_0x149adf,_0x356132));});return BPromise['all'](_0x3819fe);})['catch'](function(_0x52658a){if(_0x52658a){if(!_0x52658a['name']||_0x52658a['name']!==_0x9489('0x38')){logger['error'](util[_0x9489('0x3a')](_0x52658a,{'showHidden':![],'depth':null}));}}});}exports[_0x9489('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x345e=['Settings\x20not\x20available','transcribeAccountId','forEach','all','name','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','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','update','Sentiment','SentimentScore','Positive','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Negative','Neutral','catch','SequelizeValidationError','error','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting'];(function(_0x28258a,_0x22f398){var _0x4e968e=function(_0xda8c73){while(--_0xda8c73){_0x28258a['push'](_0x28258a['shift']());}};_0x4e968e(++_0x22f398);}(_0x345e,0x168));var _0xe345=function(_0x12712a,_0x70f9fe){_0x12712a=_0x12712a-0x0;var _0x2dfb46=_0x345e[_0x12712a];return _0x2dfb46;};var _=require(_0xe345('0x0'));var AWS=require(_0xe345('0x1'));var rp=require('request-promise');var util=require(_0xe345('0x2'));var BPromise=require(_0xe345('0x3'));var db=require(_0xe345('0x4'))['db'];var logger=require(_0xe345('0x5'))(_0xe345('0x6'));function getTranscriptionJob(_0x43d6fd,_0x469d06,_0x304b67,_0x414110){return new Promise(function(_0x575c38,_0x4491a9){var _0x38cc87=new AWS[(_0xe345('0x7'))]({'accessKeyId':_0x469d06,'secretAccessKey':_0x43d6fd,'region':_0x304b67});_0x38cc87[_0xe345('0x8')]({'TranscriptionJobName':_0x414110},function(_0x24f14f,_0x18f9a3){if(_0x24f14f){return _0x4491a9(_0x24f14f);}else{return _0x575c38(_0x18f9a3);}});});}function sentiment(_0x517809,_0x5912b2,_0x41bd55,_0x47382b,_0x322dc6){return new Promise(function(_0x15aa5a,_0x3d2b81){var _0x30d4d2=new AWS[(_0xe345('0x9'))]({'accessKeyId':_0x5912b2,'secretAccessKey':_0x517809,'region':_0x41bd55});_0x30d4d2[_0xe345('0xa')]({'Text':_0x47382b,'LanguageCode':_0x322dc6[_0xe345('0xb')](0x0,0x2)},function(_0x2efe39,_0x5ed9f0){if(_0x2efe39){return _0x3d2b81(_0x2efe39);}else{return _0x15aa5a(_0x5ed9f0);}});});}function checkTranscribeJob(_0xf95224,_0x1a8ced,_0x5a5df4){var _0x5d9379;return new BPromise(function(_0x2be002,_0x5bd8d6){logger[_0xe345('0xc')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xf95224['id'],_0xf95224[_0xe345('0xd')]));return getTranscriptionJob(_0x5a5df4[_0xe345('0xe')],_0x5a5df4[_0xe345('0xf')],_0x1a8ced[_0xe345('0x10')],_0xf95224[_0xe345('0xd')])[_0xe345('0x11')](function(_0x1d3717){logger[_0xe345('0xc')](util[_0xe345('0x12')](_0xe345('0x13'),_0xf95224['id'],_0xf95224['transcribeName'],_0x1d3717['TranscriptionJob'][_0xe345('0x14')]));if(!_0xf95224[_0xe345('0x15')]){switch(_0x1d3717[_0xe345('0x16')][_0xe345('0x14')]){case _0xe345('0x17'):var _0x4bed9f={'transcribeStatus':_0x1d3717[_0xe345('0x16')][_0xe345('0x14')],'fileUri':_0x1d3717['TranscriptionJob'][_0xe345('0x18')][_0xe345('0x19')]};logger[_0xe345('0xc')](util[_0xe345('0x12')](_0xe345('0x1a'),_0xf95224['id']));return rp({'uri':_0x1d3717[_0xe345('0x16')]['Transcript'][_0xe345('0x19')],'json':!![]})['then'](function(_0x176e04){logger['info'](util[_0xe345('0x12')](_0xe345('0x1b'),_0xf95224['id']));if(_0x176e04&&_0x176e04[_0xe345('0x1c')]&&_0x176e04[_0xe345('0x1c')]['transcripts']&&_0x176e04['results'][_0xe345('0x1d')][_0xe345('0x1e')]){_0x4bed9f['fileText']='';for(var _0x575c9a=0x0;_0x575c9a<_0x176e04['results'][_0xe345('0x1d')][_0xe345('0x1e')];_0x575c9a++){_0x4bed9f[_0xe345('0x15')]+=_0x176e04['results']['transcripts'][_0x575c9a][_0xe345('0x1f')]+'';}}return _0xf95224['update'](_0x4bed9f);})[_0xe345('0x11')](function(){logger[_0xe345('0xc')](util[_0xe345('0x12')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xf95224['id']));if(!_0xf95224[_0xe345('0x20')]){throw new db['Sequelize'][(_0xe345('0x21'))](_0xe345('0x22'));}if(!_0x1a8ced[_0xe345('0x23')]||!_0x1a8ced['sentimentAccountId']||!_0x1a8ced['sentimentRegion']||!_0x1a8ced[_0xe345('0x24')]||!_0x1a8ced[_0xe345('0x25')]){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))](_0xe345('0x27'));}if(!_0x4bed9f['fileText']){throw new Error(_0xe345('0x28'));}if(_0x1a8ced[_0xe345('0x29')]===_0x5a5df4['id']){return _0x5a5df4;}else{return db[_0xe345('0x2a')][_0xe345('0x2b')]({'where':{'id':_settings[_0xe345('0x29')]}});}})['then'](function(_0x163abd){if(!_0x163abd){throw new db[(_0xe345('0x26'))]['ValidationError'](_0xe345('0x2c'));}if(!_0x163abd[_0xe345('0xe')]||!_0x163abd[_0xe345('0xf')]){throw new db['Sequelize']['ValidationError'](_0xe345('0x2d'));}_0x5d9379=_0x163abd;logger[_0xe345('0xc')](util['format'](_0xe345('0x2e'),_0xf95224['id']));return sentiment(_0x5d9379[_0xe345('0xe')],_0x5d9379[_0xe345('0xf')],_0x1a8ced[_0xe345('0x2f')],_0x4bed9f[_0xe345('0x15')],_0x1a8ced[_0xe345('0x24')]);})[_0xe345('0x11')](function(_0x3ae902){logger[_0xe345('0xc')](util['format'](_0xe345('0x30'),_0xf95224['id']));return _0xf95224[_0xe345('0x31')]({'sentiment':_0x3ae902[_0xe345('0x32')],'sPositive':_0x3ae902[_0xe345('0x33')][_0xe345('0x34')],'sNegative':_0x3ae902[_0xe345('0x33')]['Negative'],'sMixed':_0x3ae902['SentimentScore']['Mixed'],'sNeutral':_0x3ae902[_0xe345('0x33')]['Neutral']});})[_0xe345('0x11')](function(){logger[_0xe345('0xc')](util[_0xe345('0x12')](_0xe345('0x35'),_0xf95224['id']));_0x2be002();});case'FAILED':return _0xf95224[_0xe345('0x31')]({'transcribeStatus':_0xe345('0x36'),'failureReason':_0x1d3717[_0xe345('0x16')]['FailureReason']})[_0xe345('0x11')](function(){logger[_0xe345('0xc')](util[_0xe345('0x12')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xf95224['id']));_0x2be002();});default:logger['info'](util[_0xe345('0x12')](_0xe345('0x37'),_0xf95224['id']));break;}}else{return BPromise[_0xe345('0x38')]()['then'](function(){if(!_0xf95224['tempSentiment']){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))](_0xe345('0x22'));}if(!_0x1a8ced[_0xe345('0x23')]||!_0x1a8ced[_0xe345('0x29')]||!_0x1a8ced[_0xe345('0x2f')]||!_0x1a8ced[_0xe345('0x24')]||!_0x1a8ced[_0xe345('0x25')]){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xf95224[_0xe345('0x15')]){throw new Error(_0xe345('0x28'));}if(_0x1a8ced[_0xe345('0x29')]===_0x5a5df4['id']){return _0x5a5df4;}else{return db[_0xe345('0x2a')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3d019c){if(!_0x3d019c){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))](_0xe345('0x2c'));}if(!_0x3d019c[_0xe345('0xe')]||!_0x3d019c[_0xe345('0xf')]){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x5d9379=_0x3d019c;logger[_0xe345('0xc')](util[_0xe345('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xf95224['id']));return sentiment(_0x5d9379['data1'],_0x5d9379[_0xe345('0xf')],_0x1a8ced[_0xe345('0x2f')],_0xf95224[_0xe345('0x15')],_0x1a8ced['language']);})[_0xe345('0x11')](function(_0x3ed152){logger['info'](util['format'](_0xe345('0x30'),_0xf95224['id']));return _0xf95224[_0xe345('0x31')]({'sentiment':_0x3ed152['Sentiment'],'sPositive':_0x3ed152['SentimentScore'][_0xe345('0x34')],'sNegative':_0x3ed152['SentimentScore'][_0xe345('0x39')],'sMixed':_0x3ed152['SentimentScore']['Mixed'],'sNeutral':_0x3ed152[_0xe345('0x33')][_0xe345('0x3a')],'transcribeStatus':_0xe345('0x17')});})[_0xe345('0x11')](function(){logger[_0xe345('0xc')](util[_0xe345('0x12')](_0xe345('0x35'),_0xf95224['id']));_0x2be002();});}})[_0xe345('0x3b')](function(_0x336cbd){if(_0x336cbd){if(!_0x336cbd['name']||_0x336cbd['name']!==_0xe345('0x3c')){logger[_0xe345('0x3d')](util[_0xe345('0x12')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xf95224['id']),util[_0xe345('0x3e')](_0x336cbd,{'showHidden':![],'depth':null}));}}_0x2be002();});});}function checkTranscribe(){var _0x4ef10;var _0x1c9821;var _0x22d1fe;return db[_0xe345('0x3f')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x132988){if(!_0x132988||!_0x132988[_0xe345('0x1e')]){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))](_0xe345('0x40'));}_0x4ef10=_0x132988;return db[_0xe345('0x41')]['findOne']({'where':{'id':0x1}});})[_0xe345('0x11')](function(_0x4a9b7f){if(!_0x4a9b7f){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))](_0xe345('0x42'));}_0x1c9821=_0x4a9b7f;if(!_0x1c9821['transcribe']||!_0x1c9821[_0xe345('0x43')]||!_0x1c9821[_0xe345('0x10')]||!_0x1c9821['language']||!_0x1c9821[_0xe345('0x25')]){throw new db[(_0xe345('0x26'))][(_0xe345('0x21'))]('Transcribe\x20not\x20configured');}return db[_0xe345('0x2a')]['findOne']({'where':{'id':_0x1c9821[_0xe345('0x43')]}});})[_0xe345('0x11')](function(_0x4e9b9f){if(!_0x4e9b9f){throw new db[(_0xe345('0x26'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4e9b9f[_0xe345('0xe')]||!_0x4e9b9f[_0xe345('0xf')]){throw new db[(_0xe345('0x26'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x22d1fe=_0x4e9b9f;var _0x50e159=[];_0x4ef10[_0xe345('0x44')](function(_0x7c7e60){_0x50e159['push'](checkTranscribeJob(_0x7c7e60,_0x1c9821,_0x22d1fe));});return BPromise[_0xe345('0x45')](_0x50e159);})[_0xe345('0x3b')](function(_0xc8f27){if(_0xc8f27){if(!_0xc8f27[_0xe345('0x46')]||_0xc8f27['name']!==_0xe345('0x3c')){logger[_0xe345('0x3d')](util[_0xe345('0x3e')](_0xc8f27,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index aad458f..60bc61d 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 _0x8f0a=['format','YYYY-MM-DD\x20HH:mm:ss','length','info','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','findAll','lastMsgAt','subtract','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x8f0a,0x1e4));var _0xa8f0=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x8f0a[_0x623e7];return _0x121131;};'use strict';var _=require(_0xa8f0('0x0'));var moment=require(_0xa8f0('0x1'));var Redis=require(_0xa8f0('0x2'));var util=require(_0xa8f0('0x3'));var config=require(_0xa8f0('0x4'));var db=require(_0xa8f0('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xa8f0('0x6')]=_[_0xa8f0('0x7')](config[_0xa8f0('0x6')],{'host':_0xa8f0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa8f0('0x6')]));function closeInteractions(){var _0x422b9e=[];return db['WhatsappInteraction'][_0xa8f0('0x9')]({'raw':!![],'attributes':['id',_0xa8f0('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa8f0('0xb')](0x18,_0xa8f0('0xc'))}}})[_0xa8f0('0xd')](function(_0x479c72){if(_0x479c72&&_0x479c72['length']){_0x422b9e=_[_0xa8f0('0xe')](_0x479c72||[],'id');logger['info'](_0xa8f0('0xf'),_0x422b9e[_0xa8f0('0x10')]());return db['WhatsappInteraction'][_0xa8f0('0x11')]({'closeReason':_0xa8f0('0x12'),'disposition':_0xa8f0('0x13'),'closed':!![],'closedAt':moment()[_0xa8f0('0x14')](_0xa8f0('0x15'))},{'where':{'id':_0x422b9e}});}})[_0xa8f0('0xd')](function(){if(_0x422b9e&&_0x422b9e[_0xa8f0('0x16')]){logger[_0xa8f0('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x422b9e['join']());for(var _0x442147=0x0;_0x442147<_0x422b9e[_0xa8f0('0x16')];_0x442147++){io['emit'](_0xa8f0('0x18'),{'id':_0x422b9e[_0x442147],'closed':!![]});}}})['catch'](function(_0x244df1){logger[_0xa8f0('0x19')](_0xa8f0('0x1a'),_0x244df1?util['inspect'](_0x244df1,{'showHidden':![],'depth':null}):'');});}exports[_0xa8f0('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe6e9=['inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x2fe321,_0x39f72a){var _0x1e97c6=function(_0x47770a){while(--_0x47770a){_0x2fe321['push'](_0x2fe321['shift']());}};_0x1e97c6(++_0x39f72a);}(_0xe6e9,0x182));var _0x9e6e=function(_0x4f1374,_0x3bd9c0){_0x4f1374=_0x4f1374-0x0;var _0x15bef3=_0xe6e9[_0x4f1374];return _0x15bef3;};'use strict';var _=require(_0x9e6e('0x0'));var moment=require(_0x9e6e('0x1'));var Redis=require(_0x9e6e('0x2'));var util=require('util');var config=require(_0x9e6e('0x3'));var db=require(_0x9e6e('0x4'))['db'];var logger=require(_0x9e6e('0x5'))(_0x9e6e('0x6'));config[_0x9e6e('0x7')]=_['defaults'](config[_0x9e6e('0x7')],{'host':_0x9e6e('0x8'),'port':0x18eb});var io=require(_0x9e6e('0x9'))(new Redis(config[_0x9e6e('0x7')]));function closeInteractions(){var _0x174aaa=[];return db['WhatsappInteraction'][_0x9e6e('0xa')]({'raw':!![],'attributes':['id',_0x9e6e('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9e6e('0xc')](0x18,_0x9e6e('0xd'))}}})[_0x9e6e('0xe')](function(_0x42b7ed){if(_0x42b7ed&&_0x42b7ed['length']){_0x174aaa=_[_0x9e6e('0xf')](_0x42b7ed||[],'id');logger[_0x9e6e('0x10')](_0x9e6e('0x11'),_0x174aaa[_0x9e6e('0x12')]());return db['WhatsappInteraction'][_0x9e6e('0x13')]({'closeReason':_0x9e6e('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x9e6e('0x15')](_0x9e6e('0x16'))},{'where':{'id':_0x174aaa}});}})[_0x9e6e('0xe')](function(){if(_0x174aaa&&_0x174aaa[_0x9e6e('0x17')]){logger['info'](_0x9e6e('0x18'),_0x174aaa[_0x9e6e('0x12')]());for(var _0x1235ab=0x0;_0x1235ab<_0x174aaa[_0x9e6e('0x17')];_0x1235ab++){io[_0x9e6e('0x19')](_0x9e6e('0x1a'),{'id':_0x174aaa[_0x1235ab],'closed':!![]});}}})[_0x9e6e('0x1b')](function(_0x6bc20c){logger[_0x9e6e('0x1c')](_0x9e6e('0x1d'),_0x6bc20c?util[_0x9e6e('0x1e')](_0x6bc20c,{'showHidden':![],'depth':null}):'');});}exports[_0x9e6e('0x1f')]=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 310de81..b800900 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf63=['CmHopper','then','finished\x20populating','hopper2','catch','util','push','innocenzo.biondo','@xcally.com','now','Innocenzo','Biondo','CmContact','destroy','bulkCreate','log'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0xdf63,0x175));var _0x3df6=function(_0x148f22,_0x5a5572){_0x148f22=_0x148f22-0x0;var _0x50ccfa=_0xdf63[_0x148f22];return _0x50ccfa;};'use strict';var util=require(_0x3df6('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3df6('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3df6('0x2')+i+_0x3df6('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x3df6('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3df6('0x4')](),'updatedAt':Date[_0x3df6('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x3df6('0x5')+i,'lastName':_0x3df6('0x6')+i,'phone':0xf879fb460+i,'email':_0x3df6('0x2')+i+_0x3df6('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3df6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x3df6('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3df6('0x4')](),'updatedAt':Date[_0x3df6('0x4')]()});}db[_0x3df6('0x7')][_0x3df6('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x3df6('0x9')](contacts);})['then'](function(){console[_0x3df6('0xa')]('finished\x20populating','contacts1');return db[_0x3df6('0xb')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper'][_0x3df6('0x9')](hopper);})[_0x3df6('0xc')](function(){console[_0x3df6('0xa')]('finished\x20populating','hopper1');return db[_0x3df6('0x7')][_0x3df6('0x9')](contacts2);})[_0x3df6('0xc')](function(){console[_0x3df6('0xa')](_0x3df6('0xd'),'contacts2');return db['CmHopper'][_0x3df6('0x9')](hopper2);})[_0x3df6('0xc')](function(){console[_0x3df6('0xa')](_0x3df6('0xd'),_0x3df6('0xe'));})[_0x3df6('0xf')](function(_0x2979db){console[_0x3df6('0xa')](_0x2979db);}); \ No newline at end of file +var _0xfa1b=['CmContact','then','bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','now','@xcally.com'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xfa1b,0x13e));var _0xbfa1=function(_0x2ed732,_0x1317b9){_0x2ed732=_0x2ed732-0x0;var _0x1d308f=_0xfa1b[_0x2ed732];return _0x1d308f;};'use strict';var util=require(_0xbfa1('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbfa1('0x1')]({'id':i,'firstName':_0xbfa1('0x2')+i,'lastName':_0xbfa1('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfa1('0x4')](),'updatedAt':Date[_0xbfa1('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbfa1('0x1')]({'id':i,'firstName':_0xbfa1('0x2')+i,'lastName':_0xbfa1('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbfa1('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbfa1('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xbfa1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbfa1('0x4')](),'updatedAt':Date[_0xbfa1('0x4')]()});}db[_0xbfa1('0x6')]['destroy']({'where':{}})[_0xbfa1('0x7')](function(){return db[_0xbfa1('0x6')][_0xbfa1('0x8')](contacts);})[_0xbfa1('0x7')](function(){console[_0xbfa1('0x9')]('finished\x20populating',_0xbfa1('0xa'));return db[_0xbfa1('0xb')][_0xbfa1('0xc')]({'where':{}});})[_0xbfa1('0x7')](function(){return db[_0xbfa1('0xb')][_0xbfa1('0x8')](hopper);})[_0xbfa1('0x7')](function(){console[_0xbfa1('0x9')](_0xbfa1('0xd'),_0xbfa1('0xe'));return db['CmContact'][_0xbfa1('0x8')](contacts2);})[_0xbfa1('0x7')](function(){console['log'](_0xbfa1('0xd'),_0xbfa1('0xf'));return db[_0xbfa1('0xb')][_0xbfa1('0x8')](hopper2);})['then'](function(){console[_0xbfa1('0x9')](_0xbfa1('0xd'),_0xbfa1('0x10'));})[_0xbfa1('0x11')](function(_0x548ce7){console['log'](_0x548ce7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3c55249..584f9e9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ae=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','password','friend','udp','wss'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x24ae,0x7c));var _0xe24a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x24ae[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0xe24a('0x0'));var db=require(_0xe24a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe24a('0x2')](_0xe24a('0x3'),_0xe24a('0x4'),i),'fullname':util[_0xe24a('0x2')]('%s%s','agent',i),'email':util[_0xe24a('0x2')]('%s%s@xcally.com',_0xe24a('0x4'),i),'role':_0xe24a('0x4'),'password':_0xe24a('0x5'),'internal':0xfa0+i,'type':_0xe24a('0x6'),'transport':[_0xe24a('0x7'),'ws',_0xe24a('0x8')],'disallow':[_0xe24a('0x9')],'allow':[_0xe24a('0xa')],'defaultuser':util[_0xe24a('0x2')](_0xe24a('0x3'),_0xe24a('0x4'),i),'encryption':_0xe24a('0xb'),'avpf':_0xe24a('0xb'),'force_avp':_0xe24a('0xb'),'icesupport':_0xe24a('0xb'),'dtlsenable':_0xe24a('0xb'),'dtlsverify':'no','dtlscertfile':_0xe24a('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xe24a('0x2')](_0xe24a('0xd'),util['format'](_0xe24a('0x3'),_0xe24a('0x4'),i),0xfa0+i)});}db[_0xe24a('0xe')]['bulkCreate'](users)[_0xe24a('0xf')](function(){console[_0xe24a('0x10')](_0xe24a('0x11'));})[_0xe24a('0x12')](function(_0x5431a6){console[_0xe24a('0x10')](_0x5431a6);}); \ No newline at end of file +var _0x3fb4=['push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3fb4,0x18e));var _0x43fb=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x3fb4[_0x307d86];return _0x361745;};'use strict';var util=require(_0x43fb('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43fb('0x1')]({'name':util[_0x43fb('0x2')](_0x43fb('0x3'),_0x43fb('0x4'),i),'fullname':util[_0x43fb('0x2')](_0x43fb('0x3'),_0x43fb('0x4'),i),'email':util[_0x43fb('0x2')]('%s%s@xcally.com','agent',i),'role':_0x43fb('0x4'),'password':_0x43fb('0x5'),'internal':0xfa0+i,'type':_0x43fb('0x6'),'transport':[_0x43fb('0x7'),'ws',_0x43fb('0x8')],'disallow':[_0x43fb('0x9')],'allow':[_0x43fb('0xa')],'defaultuser':util[_0x43fb('0x2')](_0x43fb('0x3'),_0x43fb('0x4'),i),'encryption':_0x43fb('0xb'),'avpf':_0x43fb('0xb'),'force_avp':'yes','icesupport':_0x43fb('0xb'),'dtlsenable':_0x43fb('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x43fb('0xc'),'dtlssetup':_0x43fb('0xd'),'callerid':util[_0x43fb('0x2')](_0x43fb('0xe'),util[_0x43fb('0x2')](_0x43fb('0x3'),_0x43fb('0x4'),i),0xfa0+i)});}db[_0x43fb('0xf')][_0x43fb('0x10')](users)[_0x43fb('0x11')](function(){console[_0x43fb('0x12')](_0x43fb('0x13'));})[_0x43fb('0x14')](function(_0x5e6ccd){console[_0x43fb('0x12')](_0x5e6ccd);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4a0889e..d7e4ca4 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x633b=['join','default','connection','setMaxListeners','address','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','map','where','format','length','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:outbound','ChatQueues','SmsQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','chat','fax','mail','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log'];(function(_0x18d087,_0x92c5a9){var _0xf248b3=function(_0xa9de97){while(--_0xa9de97){_0x18d087['push'](_0x18d087['shift']());}};_0xf248b3(++_0x92c5a9);}(_0x633b,0xd8));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb633('0x0'));var util=require(_0xb633('0x1'));var BPromise=require(_0xb633('0x2'));var db=require(_0xb633('0x3'))['db'];var config=require(_0xb633('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xb633('0x5'),'model':db[_0xb633('0x6')],'attributes':['id',_0xb633('0x7'),_0xb633('0x8')],'raw':!![],'where':{'role':_0xb633('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb633('0x7')],'where':{'role':_0xb633('0xa')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb633('0x7')],'where':{'role':_0xb633('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb633('0xb')],'where':{'type':_0xb633('0xc')}};function getAssociatedResources(_0x331680,_0x26c666,_0x3d4b30){return db[_0xb633('0xd')][_0xb633('0xe')]({'where':{'name':_0x331680,'userProfileId':_0x26c666},'raw':!![]})[_0xb633('0xf')](function(_0x5ce24b){if(_0x5ce24b){if(_0x5ce24b[_0xb633('0x10')]){switch(_0x331680){case _0xb633('0x11'):case'ChatQueues':case _0xb633('0x12'):case'SmsQueues':case _0xb633('0x13'):case _0xb633('0x14'):case _0xb633('0x15'):return db[_0x3d4b30]['findAll'](queryQueues);case _0xb633('0x16'):return db[_0x3d4b30][_0xb633('0x17')](queryTelephones);case _0xb633('0x18'):return db[_0x3d4b30]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x3d4b30][_0xb633('0x17')](queryCampaigns);}}else{return db[_0xb633('0x19')]['findAll']({'attributes':[_0xb633('0x1a')],'where':{'sectionId':_0x5ce24b['id']},'raw':!![]})[_0xb633('0xf')](function(_0x1bbab8){if(_0x1bbab8){var _0x215128={'where':{'id':_[_0xb633('0x1b')](_0x1bbab8,_0xb633('0x1a'))},'raw':!![]};switch(_0x3d4b30){case'User':_0x215128['where'][_0xb633('0x8')]=_0xb633('0xa');break;case'Campaign':_0x215128[_0xb633('0x1c')]['type']=_0xb633('0xc');break;}return db[_0x3d4b30]['findAll'](_0x215128);}else{return[];}});}}else{return[];}})['then'](function(_0x3fc86b){return _0x3fc86b;});}function joinOrLeaveQueues(_0x9fb5de,_0x1f181f,_0xd5d83d,_0x32dbba){_0x9fb5de[_0x1f181f](util[_0xb633('0x1d')]('%s:queue:%s',_0xd5d83d,_0x32dbba[_0xb633('0x7')]));if(_0x32dbba[_0xb633('0x5')]){for(var _0x1bb40b=0x0;_0x1bb40b<_0x32dbba[_0xb633('0x5')][_0xb633('0x1e')];_0x1bb40b+=0x1){_0x9fb5de[_0x1f181f](util[_0xb633('0x1d')]('user:%s',_0x32dbba[_0xb633('0x5')][_0x1bb40b][_0xb633('0x7')]));}}}function joinOrLeave(_0x52e011,_0x58684f,_0x393f52){var _0x4a7269;if(_0x52e011['handshake'][_0xb633('0x1f')]['id']){db[_0xb633('0x6')][_0xb633('0x20')]({'attributes':['id',_0xb633('0x7'),_0xb633('0x8'),_0xb633('0x21')],'where':{'id':_0x52e011['handshake'][_0xb633('0x1f')]['id']},'include':[{'model':db[_0xb633('0x22')],'as':_0xb633('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb633('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb633('0x25')],'as':_0xb633('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb633('0x27')],'as':_0xb633('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb633('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb633('0x2a')],'as':_0xb633('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xb633('0xf')](function(_0x3e47d1){if(_0x3e47d1){_0x4a7269=_0x3e47d1;_0x52e011[_0x58684f](util[_0xb633('0x1d')](_0xb633('0x2c'),_0x3e47d1[_0xb633('0x7')]));var _0x3a66b6=[];switch(_0x3e47d1[_0xb633('0x8')]){case _0xb633('0x2d'):_0x52e011[_0x58684f](_0xb633('0x2e'));_0x52e011[_0x58684f]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xb633('0x2f'))){delete queryQueues[_0xb633('0x2f')];}_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x31')]['findAll'](queryQueues));_0x3a66b6['push'](db[_0xb633('0x32')]['findAll'](queryQueues));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x33')]['findAll'](queryQueues));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x34')][_0xb633('0x17')](queryQueues));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x35')][_0xb633('0x17')](queryQueues));_0x3a66b6['push'](db[_0xb633('0x36')][_0xb633('0x17')](queryQueues));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x37')][_0xb633('0x17')](queryQueues));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x6')][_0xb633('0x17')](queryTelephones));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x38')][_0xb633('0x17')](queryTrunks));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x39')][_0xb633('0x17')](queryCampaigns));_0x3a66b6['push'](db[_0xb633('0x6')][_0xb633('0x17')](queryAgents));break;case _0xb633('0x3a'):_0x52e011[_0x58684f](_0xb633('0x2e'));_0x52e011[_0x58684f](_0xb633('0x3b'));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x11'),_0x3e47d1[_0xb633('0x21')],'VoiceQueue'));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x3c'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x32')));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x12'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x33')));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x3d'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x34')));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x13'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x35')));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x14'),_0x3e47d1['userProfileId'],_0xb633('0x36')));_0x3a66b6['push'](getAssociatedResources(_0xb633('0x15'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x37')));_0x3a66b6['push'](getAssociatedResources(_0xb633('0x16'),_0x3e47d1[_0xb633('0x21')],'User'));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x18'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x38')));_0x3a66b6[_0xb633('0x30')](getAssociatedResources(_0xb633('0x3e'),_0x3e47d1[_0xb633('0x21')],_0xb633('0x39')));_0x3a66b6[_0xb633('0x30')](db[_0xb633('0x6')][_0xb633('0x17')](queryAgents));break;case _0xb633('0x9'):_0x52e011[_0x58684f](_0xb633('0x2e'));_0x52e011[_0x58684f](_0xb633('0x3b'));_0x3a66b6[_0xb633('0x30')](_0x3e47d1[_0xb633('0x3f')]({'attributes':['id','name']}));_0x3a66b6[_0xb633('0x30')](_0x3e47d1[_0xb633('0x40')]({'attributes':['id',_0xb633('0x7')]}));_0x3a66b6[_0xb633('0x30')](_0x3e47d1[_0xb633('0x41')]({'attributes':['id','name']}));_0x3a66b6['push'](_0x3e47d1[_0xb633('0x42')]({'attributes':['id','name']}));_0x3a66b6['push'](_0x3e47d1['getMailQueues']({'attributes':['id','name']}));_0x3a66b6[_0xb633('0x30')](_0x3e47d1[_0xb633('0x43')]({'attributes':['id',_0xb633('0x7')]}));_0x3a66b6[_0xb633('0x30')](_0x3e47d1[_0xb633('0x44')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x3a66b6);}})[_0xb633('0xf')](function(_0xff1f58){if(_0xff1f58&&_0xff1f58[_0xb633('0x1e')]){for(var _0x2d7340=0x0;_0x2d7340<_0xff1f58[_0xb633('0x1e')];_0x2d7340+=0x1){for(var _0x262086=0x0;_0x262086<_0xff1f58[_0x2d7340][_0xb633('0x1e')];_0x262086+=0x1){switch(_0x2d7340){case 0x0:joinOrLeaveQueues(_0x52e011,_0x58684f,'voice',_0xff1f58[_0x2d7340][_0x262086]);break;case 0x1:joinOrLeaveQueues(_0x52e011,_0x58684f,_0xb633('0x45'),_0xff1f58[_0x2d7340][_0x262086]);break;case 0x2:joinOrLeaveQueues(_0x52e011,_0x58684f,_0xb633('0x46'),_0xff1f58[_0x2d7340][_0x262086]);break;case 0x3:joinOrLeaveQueues(_0x52e011,_0x58684f,'sms',_0xff1f58[_0x2d7340][_0x262086]);break;case 0x4:joinOrLeaveQueues(_0x52e011,_0x58684f,_0xb633('0x47'),_0xff1f58[_0x2d7340][_0x262086]);break;case 0x5:joinOrLeaveQueues(_0x52e011,_0x58684f,'openchannel',_0xff1f58[_0x2d7340][_0x262086]);break;case 0x6:joinOrLeaveQueues(_0x52e011,_0x58684f,'whatsapp',_0xff1f58[_0x2d7340][_0x262086]);break;case 0x7:if(_0x4a7269[_0xb633('0x8')]!==_0xb633('0x9'))_0x52e011[_0x58684f](util['format'](_0xb633('0x48'),_0xff1f58[_0x2d7340][_0x262086][_0xb633('0x7')]));break;case 0x8:if(_0x4a7269[_0xb633('0x8')]!==_0xb633('0x9'))_0x52e011[_0x58684f](util[_0xb633('0x1d')](_0xb633('0x49'),_0xff1f58[_0x2d7340][_0x262086][_0xb633('0x7')]));break;case 0x9:if(_0x4a7269[_0xb633('0x8')]!==_0xb633('0x9'))_0x52e011[_0x58684f](util[_0xb633('0x1d')]('campaign:%s:%s',_0xff1f58[_0x2d7340][_0x262086][_0xb633('0xb')],_0xff1f58[_0x2d7340][_0x262086][_0xb633('0x7')]));break;case 0xa:_0x52e011[_0x58684f](util[_0xb633('0x1d')]('user:%s',_0xff1f58[_0x2d7340][_0x262086]['name']));break;}}}}})[_0xb633('0xf')](function(){if(_0x58684f===_0xb633('0x4a')){var _0x55b7de=_[_0xb633('0x1b')](_0x4a7269[_0xb633('0x23')],'id');return _0x4a7269[_0xb633('0x4b')](_0x55b7de)[_0xb633('0xf')](function(){for(var _0x2693cb=0x0;_0x2693cb<_0x55b7de[_0xb633('0x1e')];_0x2693cb+=0x1){_0x393f52[_0xb633('0x4c')](_0xb633('0x4d'),{'ChatInteractionId':Number(_0x55b7de[_0x2693cb]),'UserId':Number(_0x4a7269['id'])});}});}})[_0xb633('0xf')](function(){if(_0x58684f===_0xb633('0x4a')){var _0x9715cb=_[_0xb633('0x1b')](_0x4a7269[_0xb633('0x4e')],'id');return _0x4a7269[_0xb633('0x4f')](_0x9715cb)[_0xb633('0xf')](function(){for(var _0x221e78=0x0;_0x221e78<_0x9715cb[_0xb633('0x1e')];_0x221e78+=0x1){_0x393f52[_0xb633('0x4c')](_0xb633('0x50'),{'MailInteractionId':Number(_0x9715cb[_0x221e78]),'UserId':Number(_0x4a7269['id'])});}});}})[_0xb633('0xf')](function(){if(_0x58684f===_0xb633('0x4a')){var _0x773da=_['map'](_0x4a7269['FaxInteractions'],'id');return _0x4a7269['removeFaxInteractions'](_0x773da)[_0xb633('0xf')](function(){for(var _0x4ec5d1=0x0;_0x4ec5d1<_0x773da[_0xb633('0x1e')];_0x4ec5d1+=0x1){_0x393f52[_0xb633('0x4c')](_0xb633('0x51'),{'FaxInteractionId':Number(_0x773da[_0x4ec5d1]),'UserId':Number(_0x4a7269['id'])});}});}})['then'](function(){if(_0x58684f===_0xb633('0x4a')){var _0x53e905=_['map'](_0x4a7269[_0xb633('0x28')],'id');return _0x4a7269[_0xb633('0x52')](_0x53e905)['then'](function(){for(var _0x42d9b4=0x0;_0x42d9b4<_0x53e905[_0xb633('0x1e')];_0x42d9b4+=0x1){_0x393f52[_0xb633('0x4c')](_0xb633('0x53'),{'SmsInteractionId':Number(_0x53e905[_0x42d9b4]),'UserId':Number(_0x4a7269['id'])});}});}})[_0xb633('0xf')](function(){if(_0x58684f===_0xb633('0x4a')){var _0xbd331e=_[_0xb633('0x1b')](_0x4a7269[_0xb633('0x54')],'id');return _0x4a7269[_0xb633('0x55')](_0xbd331e)[_0xb633('0xf')](function(){for(var _0x2dce97=0x0;_0x2dce97<_0xbd331e[_0xb633('0x1e')];_0x2dce97+=0x1){_0x393f52[_0xb633('0x4c')](_0xb633('0x56'),{'OpenchannelInteractionId':Number(_0xbd331e[_0x2dce97]),'UserId':Number(_0x4a7269['id'])});}});}})[_0xb633('0xf')](function(){if(_0x58684f===_0xb633('0x4a')){var _0x4606dd=_['map'](_0x4a7269['WhatsappInteractions'],'id');return _0x4a7269[_0xb633('0x57')](_0x4606dd)[_0xb633('0xf')](function(){for(var _0x35496c=0x0;_0x35496c<_0x4606dd[_0xb633('0x1e')];_0x35496c+=0x1){_0x393f52['emit'](_0xb633('0x58'),{'WhatsappInteractionId':Number(_0x4606dd[_0x35496c]),'UserId':Number(_0x4a7269['id'])});}});}})['catch'](function(_0x6f830e){_0x52e011[_0xb633('0x59')](_0x6f830e);});}}function onDisconnect(_0x18a3f9,_0x108843){joinOrLeave(_0x18a3f9,_0xb633('0x4a'),_0x108843);}function onConnect(_0x55a724){joinOrLeave(_0x55a724,_0xb633('0x5a'));}exports[_0xb633('0x5b')]=function(_0xba0f43){_0xba0f43['on'](_0xb633('0x5c'),function(_0x4bd993){_0x4bd993[_0xb633('0x5d')](0x0);_0x4bd993[_0xb633('0x5e')]=_0x4bd993['request'][_0xb633('0x5c')]['remoteAddress']+':'+_0x4bd993[_0xb633('0x5f')]['connection'][_0xb633('0x60')];_0x4bd993['connectedAt']=new Date();_0x4bd993[_0xb633('0x59')]=function(_0x30ce50){console[_0xb633('0x59')](_0xb633('0x61')+_0x4bd993[_0xb633('0x62')][_0xb633('0x7')]+'['+_0x4bd993['address']+']',_0x30ce50);};_0x4bd993['on'](_0xb633('0x63'),function(){onDisconnect(_0x4bd993,_0xba0f43);_0x4bd993[_0xb633('0x59')](_0xb633('0x64'));});onConnect(_0x4bd993);_0x4bd993[_0xb633('0x59')](_0xb633('0x65'));});}; \ No newline at end of file +var _0x22ca=['MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueues','MailQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','length','voice','chat','fax','sms','openchannel','telephone:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','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','join','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','telephone','Campaign','type','format','%s:queue:%s','user:%s','query','userProfileId','ChatInteraction','ChatInteractions'];(function(_0x16cee1,_0x5e28a3){var _0x1444ce=function(_0x468be7){while(--_0x468be7){_0x16cee1['push'](_0x16cee1['shift']());}};_0x1444ce(++_0x5e28a3);}(_0x22ca,0x1d9));var _0xa22c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x22ca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa22c('0x0'));var util=require(_0xa22c('0x1'));var BPromise=require(_0xa22c('0x2'));var db=require(_0xa22c('0x3'))['db'];var config=require(_0xa22c('0x4'));var queryQueues={'attributes':['id',_0xa22c('0x5')],'include':[{'as':_0xa22c('0x6'),'model':db[_0xa22c('0x7')],'attributes':['id',_0xa22c('0x5'),_0xa22c('0x8')],'raw':!![],'where':{'role':_0xa22c('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xa22c('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xa22c('0x5')],'where':{'role':_0xa22c('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x1b4222,_0x1dc195,_0xcc6938){return db[_0xa22c('0xa')][_0xa22c('0xb')]({'where':{'name':_0x1b4222,'userProfileId':_0x1dc195},'raw':!![]})['then'](function(_0x388f41){if(_0x388f41){if(_0x388f41[_0xa22c('0xc')]){switch(_0x1b4222){case'VoiceQueues':case _0xa22c('0xd'):case _0xa22c('0xe'):case _0xa22c('0xf'):case _0xa22c('0x10'):case _0xa22c('0x11'):case _0xa22c('0x12'):return db[_0xcc6938][_0xa22c('0x13')](queryQueues);case _0xa22c('0x14'):return db[_0xcc6938]['findAll'](queryTelephones);case _0xa22c('0x15'):return db[_0xcc6938][_0xa22c('0x13')](queryTrunks);case'IvrCampaigns':return db[_0xcc6938][_0xa22c('0x13')](queryCampaigns);}}else{return db[_0xa22c('0x16')]['findAll']({'attributes':[_0xa22c('0x17')],'where':{'sectionId':_0x388f41['id']},'raw':!![]})[_0xa22c('0x18')](function(_0x46c29b){if(_0x46c29b){var _0x40c950={'where':{'id':_[_0xa22c('0x19')](_0x46c29b,_0xa22c('0x17'))},'raw':!![]};switch(_0xcc6938){case _0xa22c('0x7'):_0x40c950[_0xa22c('0x1a')]['role']=_0xa22c('0x1b');break;case _0xa22c('0x1c'):_0x40c950[_0xa22c('0x1a')][_0xa22c('0x1d')]='ivr';break;}return db[_0xcc6938]['findAll'](_0x40c950);}else{return[];}});}}else{return[];}})['then'](function(_0x3d264d){return _0x3d264d;});}function joinOrLeaveQueues(_0x33c145,_0x1c801b,_0x351493,_0x929f1d){_0x33c145[_0x1c801b](util[_0xa22c('0x1e')](_0xa22c('0x1f'),_0x351493,_0x929f1d['name']));if(_0x929f1d['Agents']){for(var _0x524833=0x0;_0x524833<_0x929f1d[_0xa22c('0x6')]['length'];_0x524833+=0x1){_0x33c145[_0x1c801b](util['format'](_0xa22c('0x20'),_0x929f1d[_0xa22c('0x6')][_0x524833][_0xa22c('0x5')]));}}}function joinOrLeave(_0x5a75a9,_0x28c3d9,_0x1d0eb6){var _0x3e6b02;if(_0x5a75a9['handshake'][_0xa22c('0x21')]['id']){db[_0xa22c('0x7')]['find']({'attributes':['id',_0xa22c('0x5'),_0xa22c('0x8'),_0xa22c('0x22')],'where':{'id':_0x5a75a9['handshake'][_0xa22c('0x21')]['id']},'include':[{'model':db[_0xa22c('0x23')],'as':_0xa22c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa22c('0x25')],'as':_0xa22c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa22c('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xa22c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa22c('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa22c('0x2a')],'as':_0xa22c('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xa22c('0x18')](function(_0x391e37){if(_0x391e37){_0x3e6b02=_0x391e37;_0x5a75a9[_0x28c3d9](util[_0xa22c('0x1e')]('user:%s',_0x391e37[_0xa22c('0x5')]));var _0x3f892d=[];switch(_0x391e37['role']){case _0xa22c('0x2c'):_0x5a75a9[_0x28c3d9](_0xa22c('0x2d'));_0x5a75a9[_0x28c3d9](_0xa22c('0x2e'));if(queryQueues[_0xa22c('0x2f')](_0xa22c('0x30'))){delete queryQueues[_0xa22c('0x30')];}_0x3f892d[_0xa22c('0x31')](db[_0xa22c('0x32')]['findAll'](queryQueues));_0x3f892d[_0xa22c('0x31')](db[_0xa22c('0x33')]['findAll'](queryQueues));_0x3f892d['push'](db[_0xa22c('0x34')][_0xa22c('0x13')](queryQueues));_0x3f892d['push'](db[_0xa22c('0x35')][_0xa22c('0x13')](queryQueues));_0x3f892d[_0xa22c('0x31')](db['MailQueue'][_0xa22c('0x13')](queryQueues));_0x3f892d[_0xa22c('0x31')](db[_0xa22c('0x36')]['findAll'](queryQueues));_0x3f892d['push'](db[_0xa22c('0x37')][_0xa22c('0x13')](queryQueues));_0x3f892d[_0xa22c('0x31')](db['User'][_0xa22c('0x13')](queryTelephones));_0x3f892d[_0xa22c('0x31')](db[_0xa22c('0x38')]['findAll'](queryTrunks));_0x3f892d[_0xa22c('0x31')](db['Campaign'][_0xa22c('0x13')](queryCampaigns));_0x3f892d[_0xa22c('0x31')](db['User'][_0xa22c('0x13')](queryAgents));break;case'user':_0x5a75a9[_0x28c3d9](_0xa22c('0x2d'));_0x5a75a9[_0x28c3d9](_0xa22c('0x2e'));_0x3f892d['push'](getAssociatedResources(_0xa22c('0x39'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x32')));_0x3f892d['push'](getAssociatedResources(_0xa22c('0xd'),_0x391e37[_0xa22c('0x22')],'ChatQueue'));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0xe'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x34')));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0xf'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x35')));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0x10'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x3a')));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0x11'),_0x391e37[_0xa22c('0x22')],'OpenchannelQueue'));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0x12'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x37')));_0x3f892d[_0xa22c('0x31')](getAssociatedResources('Telephones',_0x391e37[_0xa22c('0x22')],_0xa22c('0x7')));_0x3f892d['push'](getAssociatedResources(_0xa22c('0x15'),_0x391e37[_0xa22c('0x22')],_0xa22c('0x38')));_0x3f892d[_0xa22c('0x31')](getAssociatedResources(_0xa22c('0x3b'),_0x391e37['userProfileId'],'Campaign'));_0x3f892d['push'](db[_0xa22c('0x7')][_0xa22c('0x13')](queryAgents));break;case'agent':_0x5a75a9[_0x28c3d9]('voice:inbound');_0x5a75a9[_0x28c3d9](_0xa22c('0x2e'));_0x3f892d[_0xa22c('0x31')](_0x391e37[_0xa22c('0x3c')]({'attributes':['id',_0xa22c('0x5')]}));_0x3f892d[_0xa22c('0x31')](_0x391e37[_0xa22c('0x3d')]({'attributes':['id',_0xa22c('0x5')]}));_0x3f892d[_0xa22c('0x31')](_0x391e37[_0xa22c('0x3e')]({'attributes':['id',_0xa22c('0x5')]}));_0x3f892d[_0xa22c('0x31')](_0x391e37[_0xa22c('0x3f')]({'attributes':['id','name']}));_0x3f892d[_0xa22c('0x31')](_0x391e37['getMailQueues']({'attributes':['id','name']}));_0x3f892d['push'](_0x391e37[_0xa22c('0x40')]({'attributes':['id',_0xa22c('0x5')]}));_0x3f892d['push'](_0x391e37['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xa22c('0x41')](_0x3f892d);}})[_0xa22c('0x18')](function(_0x51ca4c){if(_0x51ca4c&&_0x51ca4c[_0xa22c('0x42')]){for(var _0x53ed79=0x0;_0x53ed79<_0x51ca4c[_0xa22c('0x42')];_0x53ed79+=0x1){for(var _0x48223f=0x0;_0x48223f<_0x51ca4c[_0x53ed79][_0xa22c('0x42')];_0x48223f+=0x1){switch(_0x53ed79){case 0x0:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,_0xa22c('0x43'),_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x1:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,_0xa22c('0x44'),_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x2:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,_0xa22c('0x45'),_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x3:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,_0xa22c('0x46'),_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x4:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,'mail',_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x5:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,_0xa22c('0x47'),_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x6:joinOrLeaveQueues(_0x5a75a9,_0x28c3d9,'whatsapp',_0x51ca4c[_0x53ed79][_0x48223f]);break;case 0x7:if(_0x3e6b02[_0xa22c('0x8')]!==_0xa22c('0x9'))_0x5a75a9[_0x28c3d9](util['format'](_0xa22c('0x48'),_0x51ca4c[_0x53ed79][_0x48223f][_0xa22c('0x5')]));break;case 0x8:if(_0x3e6b02[_0xa22c('0x8')]!==_0xa22c('0x9'))_0x5a75a9[_0x28c3d9](util[_0xa22c('0x1e')]('trunk:%s',_0x51ca4c[_0x53ed79][_0x48223f][_0xa22c('0x5')]));break;case 0x9:if(_0x3e6b02['role']!==_0xa22c('0x9'))_0x5a75a9[_0x28c3d9](util[_0xa22c('0x1e')](_0xa22c('0x49'),_0x51ca4c[_0x53ed79][_0x48223f][_0xa22c('0x1d')],_0x51ca4c[_0x53ed79][_0x48223f]['name']));break;case 0xa:_0x5a75a9[_0x28c3d9](util['format'](_0xa22c('0x20'),_0x51ca4c[_0x53ed79][_0x48223f][_0xa22c('0x5')]));break;}}}}})[_0xa22c('0x18')](function(){if(_0x28c3d9==='leave'){var _0x30fc7a=_[_0xa22c('0x19')](_0x3e6b02[_0xa22c('0x24')],'id');return _0x3e6b02[_0xa22c('0x4a')](_0x30fc7a)[_0xa22c('0x18')](function(){for(var _0x59541b=0x0;_0x59541b<_0x30fc7a['length'];_0x59541b+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x4c'),{'ChatInteractionId':Number(_0x30fc7a[_0x59541b]),'UserId':Number(_0x3e6b02['id'])});}});}})[_0xa22c('0x18')](function(){if(_0x28c3d9===_0xa22c('0x4d')){var _0x10c478=_[_0xa22c('0x19')](_0x3e6b02[_0xa22c('0x26')],'id');return _0x3e6b02[_0xa22c('0x4e')](_0x10c478)[_0xa22c('0x18')](function(){for(var _0x51a3dc=0x0;_0x51a3dc<_0x10c478[_0xa22c('0x42')];_0x51a3dc+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x4f'),{'MailInteractionId':Number(_0x10c478[_0x51a3dc]),'UserId':Number(_0x3e6b02['id'])});}});}})[_0xa22c('0x18')](function(){if(_0x28c3d9===_0xa22c('0x4d')){var _0x248600=_[_0xa22c('0x19')](_0x3e6b02[_0xa22c('0x50')],'id');return _0x3e6b02[_0xa22c('0x51')](_0x248600)[_0xa22c('0x18')](function(){for(var _0x16eea0=0x0;_0x16eea0<_0x248600[_0xa22c('0x42')];_0x16eea0+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x52'),{'FaxInteractionId':Number(_0x248600[_0x16eea0]),'UserId':Number(_0x3e6b02['id'])});}});}})['then'](function(){if(_0x28c3d9===_0xa22c('0x4d')){var _0x2f521f=_[_0xa22c('0x19')](_0x3e6b02[_0xa22c('0x28')],'id');return _0x3e6b02[_0xa22c('0x53')](_0x2f521f)['then'](function(){for(var _0x46fa5f=0x0;_0x46fa5f<_0x2f521f[_0xa22c('0x42')];_0x46fa5f+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x54'),{'SmsInteractionId':Number(_0x2f521f[_0x46fa5f]),'UserId':Number(_0x3e6b02['id'])});}});}})[_0xa22c('0x18')](function(){if(_0x28c3d9==='leave'){var _0x5e84a5=_[_0xa22c('0x19')](_0x3e6b02['OpenchannelInteractions'],'id');return _0x3e6b02[_0xa22c('0x55')](_0x5e84a5)[_0xa22c('0x18')](function(){for(var _0x17f886=0x0;_0x17f886<_0x5e84a5[_0xa22c('0x42')];_0x17f886+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x56'),{'OpenchannelInteractionId':Number(_0x5e84a5[_0x17f886]),'UserId':Number(_0x3e6b02['id'])});}});}})[_0xa22c('0x18')](function(){if(_0x28c3d9===_0xa22c('0x4d')){var _0x4ecf04=_['map'](_0x3e6b02[_0xa22c('0x2b')],'id');return _0x3e6b02[_0xa22c('0x57')](_0x4ecf04)[_0xa22c('0x18')](function(){for(var _0x29ef30=0x0;_0x29ef30<_0x4ecf04[_0xa22c('0x42')];_0x29ef30+=0x1){_0x1d0eb6[_0xa22c('0x4b')](_0xa22c('0x58'),{'WhatsappInteractionId':Number(_0x4ecf04[_0x29ef30]),'UserId':Number(_0x3e6b02['id'])});}});}})[_0xa22c('0x59')](function(_0x275e9e){_0x5a75a9[_0xa22c('0x5a')](_0x275e9e);});}}function onDisconnect(_0xfe1492,_0x47eef1){joinOrLeave(_0xfe1492,_0xa22c('0x4d'),_0x47eef1);}function onConnect(_0x4d2253){joinOrLeave(_0x4d2253,_0xa22c('0x5b'));}exports['default']=function(_0x3d41e2){_0x3d41e2['on'](_0xa22c('0x5c'),function(_0x2fc99f){_0x2fc99f['setMaxListeners'](0x0);_0x2fc99f[_0xa22c('0x5d')]=_0x2fc99f[_0xa22c('0x5e')][_0xa22c('0x5c')][_0xa22c('0x5f')]+':'+_0x2fc99f[_0xa22c('0x5e')][_0xa22c('0x5c')][_0xa22c('0x60')];_0x2fc99f[_0xa22c('0x61')]=new Date();_0x2fc99f[_0xa22c('0x5a')]=function(_0x532468){console[_0xa22c('0x5a')]('SocketIO\x20'+_0x2fc99f[_0xa22c('0x62')][_0xa22c('0x5')]+'['+_0x2fc99f[_0xa22c('0x5d')]+']',_0x532468);};_0x2fc99f['on'](_0xa22c('0x63'),function(){onDisconnect(_0x2fc99f,_0x3d41e2);_0x2fc99f[_0xa22c('0x5a')](_0xa22c('0x64'));});onConnect(_0x2fc99f);_0x2fc99f[_0xa22c('0x5a')](_0xa22c('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 69aeaa9..76eac60 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 _0x64b7=['find','email','internal','length','model','hook','callback','condition','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','Trigger,\x20%s','EventManager','error','catch','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','contact','UserId','then','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','get','resolve','Sequelize','QueryTypes','changed','closed','substatus','User'];(function(_0x706d07,_0x24f858){var _0x5c3a65=function(_0xb834ac){while(--_0xb834ac){_0x706d07['push'](_0x706d07['shift']());}};_0x5c3a65(++_0x24f858);}(_0x64b7,0x120));var _0x764b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x64b7[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var db=require(_0x764b('0x0'))['db'];var jayson=require(_0x764b('0x1'));var logger=require(_0x764b('0x2'))(_0x764b('0x3'));var client=jayson[_0x764b('0x4')][_0x764b('0x5')]({'port':0x232a});var triggers=[{'channel':_0x764b('0x6'),'model':_0x764b('0x7'),'event':_0x764b('0x8'),'condition':_0x764b('0x9'),'callback':afterCreate},{'channel':_0x764b('0x6'),'model':_0x764b('0x7'),'event':'afterUpdate','condition':_0x764b('0xa'),'callback':afterUpdate},{'channel':_0x764b('0x6'),'model':_0x764b('0xb'),'event':_0x764b('0x8'),'condition':_0x764b('0xc'),'callback':afterCreateMessage},{'channel':_0x764b('0x6'),'model':'ChatOfflineMessage','event':_0x764b('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x764b('0xd'),'model':_0x764b('0xe'),'event':_0x764b('0x8'),'condition':_0x764b('0x9'),'callback':afterCreate},{'channel':_0x764b('0xd'),'model':_0x764b('0xe'),'event':_0x764b('0xf'),'condition':_0x764b('0xa'),'callback':afterUpdate},{'channel':_0x764b('0xd'),'model':'SmsMessage','event':_0x764b('0x8'),'condition':_0x764b('0xc'),'callback':afterCreateMessage},{'channel':_0x764b('0x10'),'model':_0x764b('0x11'),'event':'afterCreate','condition':_0x764b('0x9'),'callback':afterCreate},{'channel':_0x764b('0x10'),'model':'WhatsappInteraction','event':_0x764b('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x764b('0x10'),'model':_0x764b('0x12'),'event':'afterCreate','condition':_0x764b('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x764b('0x13'),'model':_0x764b('0x14'),'event':_0x764b('0xf'),'condition':_0x764b('0xa'),'callback':afterUpdate},{'channel':_0x764b('0x13'),'model':_0x764b('0x15'),'event':_0x764b('0x8'),'condition':_0x764b('0xc'),'callback':afterCreateMessage},{'channel':_0x764b('0x16'),'model':_0x764b('0x17'),'event':_0x764b('0x8'),'condition':_0x764b('0x9'),'callback':afterCreate},{'channel':_0x764b('0x16'),'model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x764b('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x764b('0x18'),'model':_0x764b('0x19'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x764b('0x19'),'event':_0x764b('0xf'),'condition':_0x764b('0xa'),'callback':afterUpdate},{'channel':_0x764b('0x18'),'model':_0x764b('0x1a'),'event':_0x764b('0x8'),'condition':_0x764b('0xc'),'callback':afterCreateMessage}];function request(_0x248831){return client[_0x764b('0x1b')]('EventManager',_0x248831)['then'](function(_0x27fe63){logger['info'](_0x764b('0x1c'),_0x764b('0x1d'),_0x27fe63);if(_0x27fe63[_0x764b('0x1e')]){if(_0x27fe63[_0x764b('0x1e')]['code']===0x1f4){logger[_0x764b('0x1e')](_0x764b('0x1c'),_0x764b('0x1d'),_0x27fe63[_0x764b('0x1e')]);}}})[_0x764b('0x1f')](function(_0x3f2f96){logger[_0x764b('0x1e')](_0x764b('0x1c'),_0x764b('0x1d'),_0x3f2f96);});}function afterCreateMessage(_0x3967a0){return function(_0x367687){_0x367687=_0x367687['get']({'plain':!![]});_0x367687[_0x764b('0x20')]=_0x3967a0;_0x367687[_0x764b('0x21')]=_0x3967a0;_0x367687[_0x764b('0x22')]=_0x367687[_0x764b('0x23')];Promise['resolve']()['then'](function(){if(typeof _0x367687[_0x764b('0x24')]===_0x764b('0x25'))return null;var _0x570f05=_0x764b('0x26')+_0x367687[_0x764b('0x24')];return db[_0x764b('0x27')][_0x764b('0x28')](_0x570f05,{'type':db['Sequelize']['QueryTypes'][_0x764b('0x29')],'raw':!![]});})['then'](function(_0x407a0d){if(_0x407a0d){_0x367687[_0x764b('0x2a')]=_0x407a0d[0x0];}if(typeof _0x367687[_0x764b('0x2b')]===_0x764b('0x25'))return;return getAgent(_0x367687[_0x764b('0x2b')]);})[_0x764b('0x2c')](function(_0x42092a){if(_0x42092a){_0x367687[_0x764b('0x2d')]=util[_0x764b('0x2e')](_0x764b('0x2f'),_0x42092a[_0x764b('0x30')]);_0x367687[_0x764b('0x31')]=_0x42092a;_0x367687[_0x764b('0x20')]=_0x3967a0;return request({'event':_0x764b('0x32'),'message':_0x367687});}else{return request({'event':_0x764b('0x33'),'message':_0x367687});}})[_0x764b('0x1f')](function(_0x487234){logger[_0x764b('0x1e')]('Trigger,\x20%s',_0x764b('0x34'),_0x487234);});};}function afterCreateOfflineMessage(_0x23a527){return function(_0x495537){_0x495537=_0x495537['get']({'plain':!![]});_0x495537['channel']=_0x23a527;_0x495537[_0x764b('0x21')]=_0x23a527;_0x495537[_0x764b('0x22')]=_0x764b('0x35');return request({'event':_0x495537[_0x764b('0x22')],'message':_0x495537});};}function afterCreate(_0x18dd2a,_0x4a3198){return function(_0x268a53){_0x268a53=_0x268a53[_0x764b('0x36')]({'plain':!![]});_0x268a53[_0x764b('0x20')]=_0x18dd2a;_0x268a53['motionChannel']=_0x18dd2a;_0x268a53[_0x764b('0x22')]='opened';Promise[_0x764b('0x37')]()['then'](function(){var _0x46a66d=_0x764b('0x26')+_0x268a53['ContactId'];return db[_0x764b('0x27')][_0x764b('0x28')](_0x46a66d,{'type':db[_0x764b('0x38')][_0x764b('0x39')][_0x764b('0x29')],'raw':!![]});})[_0x764b('0x2c')](function(_0x1e3b25){if(_0x1e3b25){_0x268a53[_0x764b('0x2a')]=_0x1e3b25[0x0];}if(typeof _0x268a53[_0x764b('0x2b')]===_0x764b('0x25'))return;return getAgent(_0x268a53['UserId']);})[_0x764b('0x2c')](function(_0xe6f7d5){if(_0xe6f7d5){_0x268a53['interface']=util[_0x764b('0x2e')](_0x764b('0x2f'),_0xe6f7d5['name']);_0x268a53['agent']=_0xe6f7d5;}return request({'event':_0x4a3198,'message':_0x268a53});})[_0x764b('0x1f')](function(_0x59b758){logger[_0x764b('0x1e')](_0x764b('0x1c'),'AfterCreate',_0x59b758);});};}function afterUpdate(_0xbd33da){return function(_0x2881c4){var _0x3f669a=_0x2881c4[_0x764b('0x3a')](_0x764b('0x3b'))&&_0x2881c4['closed'];var _0xbbd983=_0x2881c4['changed']('substatus');if(_0x3f669a||_0xbbd983){var _0x5274e5=_0x3f669a?_0x764b('0xa'):_0x764b('0x3c');var _0x582e6c=_0x2881c4[_0x764b('0x36')]({'plain':!![]});_0x582e6c[_0x764b('0x20')]=_0xbd33da;_0x582e6c[_0x764b('0x21')]=_0xbd33da;_0x582e6c['event']=_0x3f669a?_0x764b('0x3b'):'substatus';var _0x1d939d=_0x764b('0x26')+_0x582e6c[_0x764b('0x24')];return db[_0x764b('0x27')][_0x764b('0x28')](_0x1d939d,{'type':db[_0x764b('0x38')][_0x764b('0x39')][_0x764b('0x29')],'raw':!![]})[_0x764b('0x2c')](function(_0x5ed144){if(_0x5ed144){_0x582e6c[_0x764b('0x2a')]=_0x5ed144[0x0];}if(typeof _0x582e6c[_0x764b('0x2b')]===_0x764b('0x25'))return;return getAgent(_0x582e6c[_0x764b('0x2b')]);})[_0x764b('0x2c')](function(_0x2910ba){if(_0x2910ba){_0x582e6c[_0x764b('0x2d')]=util[_0x764b('0x2e')](_0x764b('0x2f'),_0x2910ba[_0x764b('0x30')]);_0x582e6c[_0x764b('0x31')]=_0x2910ba;}return request({'event':_0x5274e5,'message':_0x582e6c});})['catch'](function(_0x44c5d9){logger[_0x764b('0x1e')](_0x764b('0x1c'),'AfterUpdate',_0x44c5d9);});}};}function getAgent(_0x21103f){return db[_0x764b('0x3d')][_0x764b('0x3e')]({'where':{'id':_0x21103f},'attributes':['id',_0x764b('0x30'),'fullname',_0x764b('0x3f'),_0x764b('0x40')],'raw':!![]})[_0x764b('0x2c')](function(_0x2aa9c0){return _0x2aa9c0;});}exports['default']=function(){for(var _0x1da59f=0x0;_0x1da59f=_0xb8c496[_0x91f6('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x18c605(_0x217f5b);})[_0x91f6('0x13')](function(_0x2f20a0){_0x131fab(_0x2f20a0);});});}; \ No newline at end of file +var _0xb630=['getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','voice','mail','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb630,0x81));var _0x0b63=function(_0x381fac,_0x2c7e36){_0x381fac=_0x381fac-0x0;var _0xdb89c4=_0xb630[_0x381fac];return _0xdb89c4;};'use strict';var _=require(_0x0b63('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x0b63('0x1'));var channels=[_0x0b63('0x2'),_0x0b63('0x3'),_0x0b63('0x4'),_0x0b63('0x5'),'sms',_0x0b63('0x6'),_0x0b63('0x7')];exports[_0x0b63('0x8')]=function(){return channels;};exports[_0x0b63('0x9')]=function(_0x49a052){_0x49a052=_0x49a052[_0x0b63('0xa')]();return _['includes'](channels,_0x49a052);};exports[_0x0b63('0xb')]=function(_0x4e8e73,_0x36ce45,_0xb4f7a4,_0x286eee){var _0x40d4cd={'loginAttempts':_0x36ce45,'blocked':_0xb4f7a4};if(!_[_0x0b63('0xc')](_0x286eee)){_0x40d4cd[_0x0b63('0xd')]=_0x286eee;}return _0x4e8e73[_0x0b63('0xe')](_0x40d4cd);};exports[_0x0b63('0xf')]=function(_0x5e80d9){return new BPromise(function(_0x15df56,_0x405c96){var _0x11b13a=0x0;if(_0x5e80d9[_0x0b63('0x10')]!==_0x0b63('0x11')){_0x15df56(_0x5e80d9);}db[_0x0b63('0x12')][_0x0b63('0x13')]({'where':{'role':_0x0b63('0x11'),'online':!![],'id':{'$ne':_0x5e80d9['id']}}})[_0x0b63('0x14')](function(_0x344b37){_0x11b13a=_0x344b37;return util[_0x0b63('0xf')]();})['then'](function(_0x8e9eff){if(_0x8e9eff&&_0x8e9eff['agents']&&_0x11b13a>=_0x8e9eff[_0x0b63('0x15')]){throw Error(_0x0b63('0x16'));}_0x15df56(_0x5e80d9);})[_0x0b63('0x17')](function(_0x8b510){_0x405c96(_0x8b510);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 3ce7ade..878a3b2 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb87d=['util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','inherits','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','send'];(function(_0x5b013f,_0xddff1d){var _0x27b5d3=function(_0xf8452){while(--_0xf8452){_0x5b013f['push'](_0x5b013f['shift']());}};_0x27b5d3(++_0xddff1d);}(_0xb87d,0x180));var _0xdb87=function(_0x53a0cc,_0x1fa342){_0x53a0cc=_0x53a0cc-0x0;var _0x382e48=_0xb87d[_0x53a0cc];return _0x382e48;};'use strict';var util=require(_0xdb87('0x0'));var logger=require(_0xdb87('0x1'))(_0xdb87('0x2'));var APIError=function(_0x5042e3,_0x3cd22a){this[_0xdb87('0x3')]=_0x5042e3||_0xdb87('0x4');this[_0xdb87('0x5')]=_0x3cd22a||_0xdb87('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x977fb2){this[_0xdb87('0x3')]=_0x977fb2||_0xdb87('0x7');this[_0xdb87('0x5')]=_0xdb87('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xda3b9a){this['message']=_0xda3b9a||_0xdb87('0x8');this[_0xdb87('0x5')]=_0xdb87('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3d21e4){this[_0xdb87('0x3')]=_0x3d21e4||_0xdb87('0x9');this[_0xdb87('0x5')]=_0xdb87('0xa');util[_0xdb87('0xb')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x545750){this['message']=_0x545750||_0xdb87('0xc');this['name']=_0xdb87('0xd');this[_0xdb87('0xe')]=0x193;this[_0xdb87('0xf')]={'type':_0xdb87('0x10')};util[_0xdb87('0xb')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x219eff){this['message']=_0x219eff||_0xdb87('0x11');this[_0xdb87('0x5')]=_0xdb87('0x12');util[_0xdb87('0xb')](APIBadRequestError,APIError);};function getStatusCode(_0x194aec){switch(_0x194aec){case _0xdb87('0x7'):return 0x190;case'Forbidden',_0xdb87('0xd'):return 0x193;case _0xdb87('0xa'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1b276f){if(_0x1b276f==='Out\x20Of\x20Interval')return _0x1b276f;return null;}function handleError(_0x44a378){return function(_0xffc217){logger[_0xdb87('0x13')](_0xffc217[_0xdb87('0x14')]);var _0x294c21=getStatusCode(_0xffc217[_0xdb87('0x5')]);var _0x646178=getCustomStatusMessage(_0xffc217[_0xdb87('0x5')]);if(_0xffc217[_0xdb87('0x5')]){delete _0xffc217['name'];}if(_0x646178){_0x44a378[_0xdb87('0x15')]=_0x646178;}return _0x44a378[_0xdb87('0x16')](_0x294c21)[_0xdb87('0x17')](_0xffc217);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xe049=['inherits','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','statusMessage','status','send','util','../config/logger','api','name','Error','message','Bad\x20Request'];(function(_0x1dac6a,_0x2da806){var _0x4d4b58=function(_0x26d9b1){while(--_0x26d9b1){_0x1dac6a['push'](_0x1dac6a['shift']());}};_0x4d4b58(++_0x2da806);}(_0xe049,0x162));var _0x9e04=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe049[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x9e04('0x0'));var logger=require(_0x9e04('0x1'))(_0x9e04('0x2'));var APIError=function(_0x1f9825,_0x647453){this['message']=_0x1f9825||'Internal\x20Server\x20Error';this[_0x9e04('0x3')]=_0x647453||_0x9e04('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x2050af){this[_0x9e04('0x5')]=_0x2050af||_0x9e04('0x6');this[_0x9e04('0x3')]='Bad\x20Request';util[_0x9e04('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x15ca42){this[_0x9e04('0x5')]=_0x15ca42||'Forbidden';this[_0x9e04('0x3')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5d0119){this[_0x9e04('0x5')]=_0x5d0119||_0x9e04('0x8');this['name']=_0x9e04('0x9');util[_0x9e04('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2b6dd3){this[_0x9e04('0x5')]=_0x2b6dd3||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x9e04('0x3')]=_0x9e04('0xa');this[_0x9e04('0xb')]=0x193;this[_0x9e04('0xc')]={'type':_0x9e04('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x6660e3){this['message']=_0x6660e3||_0x9e04('0xe');this[_0x9e04('0x3')]=_0x9e04('0xf');util[_0x9e04('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x13e66a){switch(_0x13e66a){case'Bad\x20Request':return 0x190;case'Forbidden',_0x9e04('0xa'):return 0x193;case _0x9e04('0x9'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5cd927){if(_0x5cd927==='Out\x20Of\x20Interval')return _0x5cd927;return null;}function handleError(_0x4ab32b){return function(_0x55a180){logger['error'](_0x55a180['stack']);var _0x598182=getStatusCode(_0x55a180[_0x9e04('0x3')]);var _0x5332c8=getCustomStatusMessage(_0x55a180[_0x9e04('0x3')]);if(_0x55a180[_0x9e04('0x3')]){delete _0x55a180[_0x9e04('0x3')];}if(_0x5332c8){_0x4ab32b[_0x9e04('0x10')]=_0x5332c8;}return _0x4ab32b[_0x9e04('0x11')](_0x598182)[_0x9e04('0x12')](_0x55a180);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ceafae5..7f17b97 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3abc=['json','send','exports','status'];(function(_0x1ef960,_0x1d3bdd){var _0x239917=function(_0x3ac51e){while(--_0x3ac51e){_0x1ef960['push'](_0x1ef960['shift']());}};_0x239917(++_0x1d3bdd);}(_0x3abc,0x166));var _0xc3ab=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x3abc[_0x34bf97];return _0x292719;};'use strict';module[_0xc3ab('0x0')][0x194]=function pageNotFound(_0x1ab63b,_0x49d5b0){var _0x2c0cc4='404';var _0x40be31=0x194;var _0x70a29a={'status':_0x40be31};_0x49d5b0['status'](_0x70a29a[_0xc3ab('0x1')]);_0x49d5b0['render'](_0x2c0cc4,{},function(_0x25d11c,_0x4dea56){if(_0x25d11c){return _0x49d5b0[_0xc3ab('0x1')](_0x70a29a['status'])[_0xc3ab('0x2')](_0x70a29a);}_0x49d5b0[_0xc3ab('0x3')](_0x4dea56);});}; \ No newline at end of file +var _0xfdb8=['status','json','send','exports','404'];(function(_0x4097ad,_0x40273){var _0x16f266=function(_0xaa8235){while(--_0xaa8235){_0x4097ad['push'](_0x4097ad['shift']());}};_0x16f266(++_0x40273);}(_0xfdb8,0x184));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x8fdb('0x0')][0x194]=function pageNotFound(_0x5109fc,_0x38358d){var _0x163af1=_0x8fdb('0x1');var _0x2f4dea=0x194;var _0x219da8={'status':_0x2f4dea};_0x38358d[_0x8fdb('0x2')](_0x219da8[_0x8fdb('0x2')]);_0x38358d['render'](_0x163af1,{},function(_0x55d0db,_0x23a249){if(_0x55d0db){return _0x38358d[_0x8fdb('0x2')](_0x219da8['status'])[_0x8fdb('0x3')](_0x219da8);}_0x38358d[_0x8fdb('0x4')](_0x23a249);});}; \ No newline at end of file diff --git a/server/files/chat/iframe.ejs b/server/files/chat/iframe.ejs index ae3ec99..ae77249 100644 --- a/server/files/chat/iframe.ejs +++ b/server/files/chat/iframe.ejs @@ -6,7 +6,7 @@ throw new Error(`Domain "${window.location.origin}"" can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); } } catch (error) { - window.alert(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); + console.warn(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); return; } diff --git a/server/migrations/2.6.29.js b/server/migrations/2.6.29.js new file mode 100644 index 0000000..026e442 --- /dev/null +++ b/server/migrations/2.6.29.js @@ -0,0 +1,205 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +const MOTV24448 = { + /** + * Apply up migration for MOTV2-4448 + * @link https://xcally.atlassian.net/browse/MOTV2-4448 + * @param {Migration} migration + * @returns {Promise} + * @constructor + */ + up: function(migration) { + return migration.query('ALTER TABLE `chat_websites` DROP INDEX `address`') + }, + /** + * Apply down migration for MOTV2-4448 + * @link https://xcally.atlassian.net/browse/MOTV2-4448 + * @param {Migration} migration + * @returns {Promise} + * @constructor + */ + down: function(migration) { + return migration.query( + 'ALTER TABLE `chat_websites` ADD CONSTRAINT address UNIQUE(address)' + ). + catch(function() { + migration.log( + "WARNING: can't add unique constraint to chat_websites.address: the table contains duplicate values" + ) + }); + }, +} + + +module.exports = { + up: function(queryInterface /*, Sequelize */ ) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + MOTV24448.up(migration) + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function(queryInterface /*, Sequelize */ ) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + MOTV24448.down(migration) + // START FINAL + migration.final(resolve); + }); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6348526..10b987a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f6e=['Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/tag/tag.model','ContactItemType','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','UserProfile','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','FaxQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','HopperFinals','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Imap','Smtp','List','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','user_has_mail_interactions','Attachments','Interaction','ChatOfflineMessageId','IntervalId','TagId','ListId','DashboardItem','Items','Disposition','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','Messages','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','ContactId','SmsAccount','SmsAccountId','SmsInteraction','SmsInteractionId','sms_interaction_has_tags','Users','team_has_sms_queues','Answers','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','CompanyId','CmContactHasItem','Phones','CmContactId','SmsInteractions','Company','cm_contact_has_tags','CmHopperId','Agent','Campaign','CampaignId','OwnerId','All','AutomationAllId','OneAny','AutomationAnyId','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','SalesforceConfiguration','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','SugarcrmConfiguration','Configurations','Subjects','SugarcrmField','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Description','ServicenowField','Dynamics365Field','FromId','ToId','SessionId','ProjectId','ChatQueues','SmsQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','WhatsappQueueId','user','exports','sequelize','jstz','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','xC@LL1234','name','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1f6e,0x171));var _0xe1f6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f6e[_0x2641f9];return _0x585741;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xe1f6('0x0'));var _=require('lodash');var jstz=require(_0xe1f6('0x1'));var timezone=jstz['determine']();config[_0xe1f6('0x0')]=_[_0xe1f6('0x2')](config[_0xe1f6('0x0')],{'database':_0xe1f6('0x3'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xe1f6('0x4'),'port':0xcea,'dialect':_0xe1f6('0x5'),'dialectOptions':{'charset':_0xe1f6('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe1f6('0x7'),'collate':_0xe1f6('0x8')}}});config['sequelizeHistory']=_[_0xe1f6('0x2')](config[_0xe1f6('0x9')],{'database':_0xe1f6('0x3'),'username':_0xe1f6('0xa'),'password':_0xe1f6('0xb'),'options':{'host':_0xe1f6('0x4'),'port':0xcea,'dialect':_0xe1f6('0x5'),'dialectOptions':{'charset':_0xe1f6('0x6')},'logging':![],'timezone':timezone[_0xe1f6('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe1f6('0x0')][_0xe1f6('0xd')],config[_0xe1f6('0x0')][_0xe1f6('0xe')],config[_0xe1f6('0x0')][_0xe1f6('0xf')],config[_0xe1f6('0x0')][_0xe1f6('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe1f6('0x9')][_0xe1f6('0xd')],config[_0xe1f6('0x9')][_0xe1f6('0xe')],config[_0xe1f6('0x9')]['password'],config[_0xe1f6('0x9')]['options'])};db[_0xe1f6('0x11')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x13'));db[_0xe1f6('0x14')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe1f6('0x15')]=db['sequelize'][_0xe1f6('0x12')]('../api/voiceContext/voiceContext.model');db[_0xe1f6('0x16')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x17'));db[_0xe1f6('0x18')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x19'));db[_0xe1f6('0x1a')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x1b'));db['VoiceRecording']=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x1c'));db[_0xe1f6('0x1d')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x1e'));db[_0xe1f6('0x1f')]=db['sequelize'][_0xe1f6('0x12')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe1f6('0x20')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0xe1f6('0x21')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x22'));db[_0xe1f6('0x23')]=db[_0xe1f6('0x0')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xe1f6('0x24')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x25'));db[_0xe1f6('0x26')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x27'));db[_0xe1f6('0x28')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x29'));db[_0xe1f6('0x2a')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x2b'));db[_0xe1f6('0x2c')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x2d'));db[_0xe1f6('0x2e')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x2f'));db[_0xe1f6('0x30')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x31'));db[_0xe1f6('0x32')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x33'));db[_0xe1f6('0x34')]=db['sequelize']['import'](_0xe1f6('0x35'));db[_0xe1f6('0x36')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x37'));db[_0xe1f6('0x38')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x39'));db[_0xe1f6('0x3a')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x3b'));db[_0xe1f6('0x3c')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x3d'));db[_0xe1f6('0x3e')]=db['sequelize']['import'](_0xe1f6('0x3f'));db[_0xe1f6('0x40')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x41'));db[_0xe1f6('0x42')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x43'));db[_0xe1f6('0x44')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x45'));db[_0xe1f6('0x46')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x47'));db[_0xe1f6('0x48')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x49'));db[_0xe1f6('0x4a')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x4b'));db[_0xe1f6('0x4c')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x4d'));db['Dashboard']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x4e'));db['DashboardItem']=db[_0xe1f6('0x0')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xe1f6('0x4f')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x50'));db['FaxApplication']=db[_0xe1f6('0x0')]['import']('../api/faxApplication/faxApplication.model');db[_0xe1f6('0x51')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x52'));db[_0xe1f6('0x53')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x54'));db[_0xe1f6('0x55')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x56'));db['SmsAccount']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x57'));db[_0xe1f6('0x58')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x59'));db['SmsInteraction']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x5a'));db[_0xe1f6('0x5b')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x5c'));db[_0xe1f6('0x5d')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x5e'));db[_0xe1f6('0x5f')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x60'));db['OpenchannelApplication']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0xe1f6('0x61')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x62'));db[_0xe1f6('0x63')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x64'));db[_0xe1f6('0x65')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x66'));db[_0xe1f6('0x67')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x68'));db[_0xe1f6('0x69')]=db['sequelize']['import'](_0xe1f6('0x6a'));db[_0xe1f6('0x6b')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x6c'));db[_0xe1f6('0x6d')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x6e'));db[_0xe1f6('0x6f')]=db['sequelize'][_0xe1f6('0x12')]('../api/chatMessage/chatMessage.model');db[_0xe1f6('0x70')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x71'));db[_0xe1f6('0x72')]=db[_0xe1f6('0x0')]['import']('../api/chatQueue/chatQueue.model');db[_0xe1f6('0x73')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x74'));db[_0xe1f6('0x75')]=db['sequelize'][_0xe1f6('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xe1f6('0x76')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/cmCompany/cmCompany.model');db[_0xe1f6('0x77')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x78'));db[_0xe1f6('0x79')]=db['sequelize']['import'](_0xe1f6('0x7a'));db[_0xe1f6('0x7b')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x7c'));db[_0xe1f6('0x7d')]=db['sequelize'][_0xe1f6('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x7e'));db[_0xe1f6('0x7f')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x80'));db['CmCustomField']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0xe1f6('0x81')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x82'));db[_0xe1f6('0x83')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/automation/automation.model');db[_0xe1f6('0x84')]=db['sequelize']['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x85'));db[_0xe1f6('0x86')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x87'));db[_0xe1f6('0x88')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/interval/interval.model');db[_0xe1f6('0x89')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x8a'));db[_0xe1f6('0x8b')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x8c'));db[_0xe1f6('0x8d')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x8e'));db['Schedule']=db[_0xe1f6('0x0')]['import']('../api/schedule/schedule.model');db[_0xe1f6('0x8f')]=db['sequelize'][_0xe1f6('0x12')]('../api/sound/sound.model');db['Tag']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x90'));db[_0xe1f6('0x91')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xe1f6('0x92')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x93'));db[_0xe1f6('0x94')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x95'));db[_0xe1f6('0x96')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x97'));db[_0xe1f6('0x98')]=db[_0xe1f6('0x0')]['import']('../api/variable/variable.model');db['Integration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x99'));db['AnalyticCustomReport']=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x9a'));db[_0xe1f6('0x9b')]=db[_0xe1f6('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe1f6('0x9c')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x9d'));db[_0xe1f6('0x9e')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x9f'));db['AnalyticFieldReport']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe1f6('0xa0')]=db[_0xe1f6('0x0')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xa1'));db[_0xe1f6('0xa2')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xa3'));db[_0xe1f6('0xa4')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xa5'));db['SugarcrmConfiguration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xa6'));db['SugarcrmField']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xa7'));db[_0xe1f6('0xa8')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xa9'));db['DeskConfiguration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xaa'));db[_0xe1f6('0xab')]=db['sequelize'][_0xe1f6('0x12')]('../api/intDeskField/intDeskField.model');db[_0xe1f6('0xac')]=db['sequelize'][_0xe1f6('0x12')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xad'));db[_0xe1f6('0xae')]=db['sequelize']['import'](_0xe1f6('0xaf'));db[_0xe1f6('0xb0')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xb1'));db[_0xe1f6('0xb2')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xb3'));db[_0xe1f6('0xb4')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xb5'));db[_0xe1f6('0xb6')]=db[_0xe1f6('0x0')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xb7'));db[_0xe1f6('0xb8')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xb9'));db[_0xe1f6('0xba')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xbb'));db[_0xe1f6('0xbc')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xbd'));db[_0xe1f6('0xbe')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xbf'));db[_0xe1f6('0xc0')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xe1f6('0xc1')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xc2'));db['ServicenowField']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xc3'));db[_0xe1f6('0xc4')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xc5'));db[_0xe1f6('0xc6')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xc7'));db[_0xe1f6('0xc8')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xc9'));db[_0xe1f6('0xca')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xcb'));db[_0xe1f6('0xcc')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xcd'));db['Integration']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/integration/integration.model');db[_0xe1f6('0xce')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/network/network.model');db[_0xe1f6('0xcf')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xd0'));db[_0xe1f6('0xd1')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xd2'));db[_0xe1f6('0xd3')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xd4'));db[_0xe1f6('0xd5')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xd6'));db[_0xe1f6('0xd7')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xd8'));db[_0xe1f6('0xd9')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0xe1f6('0xda')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xdb'));db[_0xe1f6('0xdc')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xdd'));db[_0xe1f6('0xde')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xdf'));db[_0xe1f6('0xe0')]=db['sequelize'][_0xe1f6('0x12')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xe1'));db[_0xe1f6('0xe2')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xe3'));db[_0xe1f6('0xe4')]=db['sequelize']['import'](_0xe1f6('0xe5'));db[_0xe1f6('0xe6')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/squareMessage/squareMessage.model');db[_0xe1f6('0xe7')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xe8'));db[_0xe1f6('0xe9')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xea'));db['Campaign']=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0xeb'));db[_0xe1f6('0xec')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xed'));db[_0xe1f6('0xee')]=db['sequelize'][_0xe1f6('0x12')]('../api/attachment/attachment.model');db[_0xe1f6('0xef')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xf0'));db[_0xe1f6('0xf1')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xf2'));db['ChatTransferReport']=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xf3'));db['FaxTransferReport']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xf4'));db[_0xe1f6('0xf5')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xf6'));db[_0xe1f6('0xf7')]=db['sequelize']['import'](_0xe1f6('0xf8'));db[_0xe1f6('0xf9')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xfa'));db['VoicePrefix']=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0xfb'));db['UserProfile']=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/userProfile/userProfile.model');db[_0xe1f6('0xfc')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0xfd'));db[_0xe1f6('0xfe')]=db['sequelize'][_0xe1f6('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xe1f6('0xff')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x100'));db[_0xe1f6('0x101')]=db['sequelize'][_0xe1f6('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xe1f6('0x102')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/whatsappApplication/whatsappApplication.model');db[_0xe1f6('0x103')]=db[_0xe1f6('0x0')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe1f6('0x104')]=db['sequelize'][_0xe1f6('0x12')](_0xe1f6('0x105'));db[_0xe1f6('0x106')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x107'));db[_0xe1f6('0x108')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x109'));db[_0xe1f6('0x10a')]=db[_0xe1f6('0x0')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xe1f6('0x10b')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize'][_0xe1f6('0x12')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xe1f6('0x10c')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')](_0xe1f6('0x10d'));db[_0xe1f6('0x10e')]=db['sequelize']['import'](_0xe1f6('0x10f'));db[_0xe1f6('0x110')]=db[_0xe1f6('0x0')][_0xe1f6('0x12')]('../api/user-setting/user-setting.model');db[_0xe1f6('0x111')]=db[_0xe1f6('0x0')]['import'](_0xe1f6('0x112'));db[_0xe1f6('0x11')][_0xe1f6('0x113')](db['VoiceMail'],{'as':_0xe1f6('0x1f'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x113')](db[_0xe1f6('0x110')],{'as':_0xe1f6('0x116'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x118')],{'as':_0xe1f6('0x119'),'foreignKey':'UserId'});db[_0xe1f6('0x11')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xe1f6('0x11a'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')]['hasMany'](db['VoiceExtension'],{'as':_0xe1f6('0x11b'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe1f6('0x115')});db['User'][_0xe1f6('0x117')](db[_0xe1f6('0x11c')],{'as':_0xe1f6('0x11d'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe1f6('0x7f'),'foreignKey':'UserId'});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':_0xe1f6('0x11e'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x6d')],{'as':_0xe1f6('0x11f'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x51')],{'as':_0xe1f6('0x120'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x46')],{'as':'MailInteractions','foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x103')],{'as':_0xe1f6('0x121'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db['UserNotification'],{'as':_0xe1f6('0x122'),'foreignKey':'SenderId'});db[_0xe1f6('0x11')][_0xe1f6('0x117')](db[_0xe1f6('0x79')],{'as':_0xe1f6('0x123'),'foreignKey':_0xe1f6('0x115'),'onDelete':_0xe1f6('0x124')});db[_0xe1f6('0x11')]['belongsTo'](db[_0xe1f6('0x125')],{'as':_0xe1f6('0x125'),'foreignKey':_0xe1f6('0x126')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x73')],{'as':'Groups','through':_0xe1f6('0x128')});db['User']['belongsToMany'](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x129'),'through':_0xe1f6('0x12a')});db['User'][_0xe1f6('0x127')](db[_0xe1f6('0xf9')],{'as':'Lists','through':_0xe1f6('0x12b')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'through':_0xe1f6('0x12c')});db['User'][_0xe1f6('0x127')](db[_0xe1f6('0x46')],{'as':_0xe1f6('0x12d'),'through':'user_has_mail_interactions'});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db['ChatInteraction'],{'as':_0xe1f6('0x11f'),'through':'user_has_chat_interactions'});db[_0xe1f6('0x11')]['belongsToMany'](db['FaxInteraction'],{'as':_0xe1f6('0x120'),'through':_0xe1f6('0x12e')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0xe1f6('0x12f')});db[_0xe1f6('0x11')]['belongsToMany'](db[_0xe1f6('0x61')],{'as':_0xe1f6('0x11e'),'through':_0xe1f6('0x130')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xe1f6('0x131')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x1a')],{'as':_0xe1f6('0x132'),'through':_0xe1f6('0x2e'),'required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x133')],{'as':_0xe1f6('0x134'),'through':_0xe1f6('0x10e'),'required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x42')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User'][_0xe1f6('0x127')](db[_0xe1f6('0x72')],{'as':'ChatQueues','through':_0xe1f6('0x30'),'required':![],'hooks':!![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x55')],{'as':_0xe1f6('0x135'),'through':_0xe1f6('0x34'),'required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x5d')],{'as':'SmsQueues','through':_0xe1f6('0x36'),'required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x65')],{'as':_0xe1f6('0x136'),'through':'UserOpenchannelQueue','required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x10a')],{'as':_0xe1f6('0x137'),'through':_0xe1f6('0x3a'),'required':![]});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0xf9')],{'through':_0xe1f6('0x12b')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xe1f6('0x138')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db[_0xe1f6('0x4f')],{'as':_0xe1f6('0x139'),'through':_0xe1f6('0x13a')});db[_0xe1f6('0x11')]['belongsToMany'](db['MailAccount'],{'as':_0xe1f6('0x13b'),'through':_0xe1f6('0x13c')});db['User'][_0xe1f6('0x127')](db[_0xe1f6('0x5f')],{'as':_0xe1f6('0x13d'),'through':_0xe1f6('0x13e')});db[_0xe1f6('0x11')]['belongsToMany'](db['SmsAccount'],{'as':_0xe1f6('0x13f'),'through':_0xe1f6('0x140')});db[_0xe1f6('0x11')][_0xe1f6('0x127')](db['WhatsappAccount'],{'as':_0xe1f6('0x141'),'through':_0xe1f6('0x142')});db['VoiceChanSpy'][_0xe1f6('0x117')](db[_0xe1f6('0x16')],{'as':_0xe1f6('0x143'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x144')});db[_0xe1f6('0x15')]['hasMany'](db[_0xe1f6('0x16')],{'onDelete':'cascade'});db[_0xe1f6('0x16')][_0xe1f6('0x117')](db[_0xe1f6('0x16')],{'as':_0xe1f6('0x145'),'onDelete':_0xe1f6('0x114')});db['VoiceMusicOnHold'][_0xe1f6('0x127')](db['Sound'],{'as':_0xe1f6('0x146'),'through':_0xe1f6('0x147')});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0x2c')],{'as':_0xe1f6('0x148'),'foreignKey':'VoiceQueueId'});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0x79')],{'as':_0xe1f6('0x123'),'foreignKey':'VoiceQueueId'});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0x7d')],{'as':_0xe1f6('0x149'),'foreignKey':_0xe1f6('0x14a')});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0x11c')],{'as':_0xe1f6('0x14b'),'foreignKey':_0xe1f6('0x14a')});db[_0xe1f6('0x1a')]['hasMany'](db[_0xe1f6('0x7f')],{'as':_0xe1f6('0x7f'),'foreignKey':_0xe1f6('0x14a')});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0x7b')],{'as':_0xe1f6('0x14c'),'foreignKey':_0xe1f6('0x14a')});db[_0xe1f6('0x1a')][_0xe1f6('0x117')](db[_0xe1f6('0xd7')],{'as':_0xe1f6('0x14d'),'foreignKey':_0xe1f6('0x14a')});db[_0xe1f6('0x1a')][_0xe1f6('0x14e')](db[_0xe1f6('0x28')],{'as':_0xe1f6('0x28'),'foreignKey':_0xe1f6('0x14f')});db[_0xe1f6('0x1a')][_0xe1f6('0x14e')](db[_0xe1f6('0x28')],{'as':_0xe1f6('0x150'),'foreignKey':'TrunkBackupId'});db[_0xe1f6('0x1a')][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'as':_0xe1f6('0x88'),'foreignKey':'IntervalId'});db[_0xe1f6('0x1a')][_0xe1f6('0x14e')](db[_0xe1f6('0x89')],{'as':_0xe1f6('0x151'),'foreignKey':_0xe1f6('0x152')});db[_0xe1f6('0x1a')][_0xe1f6('0x127')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x153'),'through':'voice_queues_has_cm_lists'});db[_0xe1f6('0x1a')][_0xe1f6('0x127')](db['User'],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x2e')});db[_0xe1f6('0x1a')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'as':_0xe1f6('0x155'),'through':_0xe1f6('0x156')});db['VoiceQueue']['belongsToMany'](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x157'),'through':_0xe1f6('0x158')});db[_0xe1f6('0x118')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':'User','foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x1d')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x11'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x1f')][_0xe1f6('0x117')](db[_0xe1f6('0x159')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe1f6('0x15a'),'sourceKey':_0xe1f6('0x15b')});db[_0xe1f6('0x159')]['belongsTo'](db[_0xe1f6('0x1f')],{'foreignKey':_0xe1f6('0x15a'),'targetKey':_0xe1f6('0x15b')});db['VoiceCallReport'][_0xe1f6('0x117')](db[_0xe1f6('0x24')],{'as':_0xe1f6('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0xe1f6('0x20')]['hasMany'](db[_0xe1f6('0x23')],{'as':_0xe1f6('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0xe1f6('0x20')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x11'),'foreignKey':_0xe1f6('0x115')});db['VoiceCallReport']['belongsTo'](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':'ContactId'});db[_0xe1f6('0x3c')][_0xe1f6('0x14e')](db['MailAccount'],{'as':_0xe1f6('0x40'),'foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x3c')]['belongsTo'](db['CloudProvider'],{'as':_0xe1f6('0x10b'),'foreignKey':_0xe1f6('0x160'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x3e')][_0xe1f6('0x14e')](db['MailAccount'],{'as':_0xe1f6('0x40'),'foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x3e')][_0xe1f6('0x14e')](db[_0xe1f6('0x10b')],{'as':_0xe1f6('0x10b'),'foreignKey':_0xe1f6('0x160'),'onDelete':_0xe1f6('0x161')});db['MailAccount'][_0xe1f6('0x113')](db[_0xe1f6('0x3c')],{'as':_0xe1f6('0x162'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x40')][_0xe1f6('0x113')](db[_0xe1f6('0x3e')],{'as':_0xe1f6('0x163'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x40')][_0xe1f6('0x117')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe1f6('0x15f'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x40')][_0xe1f6('0x117')](db[_0xe1f6('0x84')],{'as':'Answers','foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x40')][_0xe1f6('0x117')](db[_0xe1f6('0x48')],{'as':'Messages','foreignKey':_0xe1f6('0x15f')});db['MailAccount'][_0xe1f6('0x117')](db['MailInteraction'],{'as':'Interactions'});db[_0xe1f6('0x40')]['hasMany'](db['MailApplication'],{'as':_0xe1f6('0x145'),'foreignKey':'MailAccountId','onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x40')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':'ListId'});db[_0xe1f6('0x40')]['belongsTo'](db['Template'],{'as':_0xe1f6('0x94'),'foreignKey':'TemplateId'});db[_0xe1f6('0x40')]['belongsTo'](db[_0xe1f6('0x89')],{'as':_0xe1f6('0x151'),'foreignKey':_0xe1f6('0x152')});db['MailAccount'][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x13c')});db[_0xe1f6('0x42')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x32')});db[_0xe1f6('0x42')][_0xe1f6('0x127')](db['Team'],{'through':_0xe1f6('0x165'),'as':'Teams'});db[_0xe1f6('0x46')][_0xe1f6('0x117')](db[_0xe1f6('0x48')],{'as':'Messages','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x166')});db['MailInteraction'][_0xe1f6('0x14e')](db[_0xe1f6('0x40')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x46')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':'ContactId'});db['MailInteraction'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x46')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x16a'),'as':_0xe1f6('0x16b')});db['MailInteraction'][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x16a'),'as':'ThroughTags'});db[_0xe1f6('0x46')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':'Users','through':_0xe1f6('0x16c'),'foreignKey':_0xe1f6('0x166')});db[_0xe1f6('0x48')][_0xe1f6('0x117')](db['Attachment'],{'as':_0xe1f6('0x16d'),'onDelete':_0xe1f6('0x114')});db['MailMessage']['belongsTo'](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x11')});db[_0xe1f6('0x48')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e')});db[_0xe1f6('0x48')][_0xe1f6('0x14e')](db[_0xe1f6('0x46')],{'as':_0xe1f6('0x16e'),'foreignKey':_0xe1f6('0x166')});db[_0xe1f6('0x48')][_0xe1f6('0x14e')](db[_0xe1f6('0x40')],{'as':'Account','foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x48')][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0xe1f6('0x48')][_0xe1f6('0x14e')](db[_0xe1f6('0x70')],{'as':'ChatOfflineMessage','foreignKey':_0xe1f6('0x16f')});db['MailApplication'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':'restrict'});db[_0xe1f6('0x4a')][_0xe1f6('0x14e')](db[_0xe1f6('0x42')],{'onDelete':'restrict'});db[_0xe1f6('0x4a')]['belongsTo'](db['MailAccount'],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x4a')][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x4a')]['belongsTo'](db[_0xe1f6('0x169')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x171')});db[_0xe1f6('0x4c')]['belongsTo'](db[_0xe1f6('0x40')],{});db[_0xe1f6('0x4c')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0x4c')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':'ContactId'});db[_0xe1f6('0x4c')]['belongsTo'](db[_0xe1f6('0x46')],{});db[_0xe1f6('0x4c')][_0xe1f6('0x14e')](db[_0xe1f6('0x48')],{});db[_0xe1f6('0x4c')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{});db[_0xe1f6('0x4c')]['belongsTo'](db[_0xe1f6('0x42')],{});db['Dashboard'][_0xe1f6('0x117')](db[_0xe1f6('0x173')],{'as':_0xe1f6('0x174'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x4f')][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':_0xe1f6('0x176'),'foreignKey':_0xe1f6('0x177'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x4f')][_0xe1f6('0x117')](db[_0xe1f6('0x84')],{'as':'Answers','foreignKey':_0xe1f6('0x177')});db[_0xe1f6('0x4f')][_0xe1f6('0x117')](db[_0xe1f6('0x51')],{'as':_0xe1f6('0x178')});db[_0xe1f6('0x4f')]['hasMany'](db[_0xe1f6('0x179')],{'as':'Applications','foreignKey':_0xe1f6('0x177'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x4f')][_0xe1f6('0x117')](db['VoiceExtension'],{'as':_0xe1f6('0x17a'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x4f')][_0xe1f6('0x117')](db[_0xe1f6('0x53')],{'as':'Messages'});db[_0xe1f6('0x4f')][_0xe1f6('0x14e')](db['Trunk'],{'as':_0xe1f6('0x28')});db[_0xe1f6('0x4f')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0x4f')]['belongsTo'](db[_0xe1f6('0x89')],{'as':_0xe1f6('0x151'),'foreignKey':_0xe1f6('0x152')});db[_0xe1f6('0x4f')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x13a')});db[_0xe1f6('0x179')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x179')][_0xe1f6('0x14e')](db[_0xe1f6('0x55')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x179')]['belongsTo'](db[_0xe1f6('0x4f')],{'onDelete':_0xe1f6('0x161')});db['FaxApplication'][_0xe1f6('0x14e')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xe1f6('0x51')][_0xe1f6('0x117')](db[_0xe1f6('0x53')],{'as':_0xe1f6('0x17b'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x17c')});db[_0xe1f6('0x51')][_0xe1f6('0x14e')](db[_0xe1f6('0x4f')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x177')});db[_0xe1f6('0x51')]['belongsTo'](db[_0xe1f6('0x77')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe1f6('0x51')]['belongsTo'](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x51')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x17d'),'as':'Tags'});db[_0xe1f6('0x51')]['belongsToMany'](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x17d'),'as':_0xe1f6('0x17e')});db[_0xe1f6('0x51')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xe1f6('0x53')][_0xe1f6('0x14e')](db['User'],{'onDelete':'cascade','as':_0xe1f6('0x11')});db[_0xe1f6('0x53')]['belongsTo'](db[_0xe1f6('0x51')],{'as':_0xe1f6('0x16e'),'foreignKey':_0xe1f6('0x17c')});db['FaxMessage'][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e')});db[_0xe1f6('0x53')][_0xe1f6('0x14e')](db[_0xe1f6('0xee')],{'as':'Attachment','foreignKey':_0xe1f6('0x17f')});db[_0xe1f6('0x53')][_0xe1f6('0x14e')](db[_0xe1f6('0x4f')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x177')});db[_0xe1f6('0x55')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':'UserFaxQueue'});db[_0xe1f6('0x55')][_0xe1f6('0x127')](db['Team'],{'through':_0xe1f6('0x180'),'as':_0xe1f6('0x155')});db[_0xe1f6('0x181')]['belongsTo'](db[_0xe1f6('0x4f')],{});db[_0xe1f6('0x181')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':'ListId'});db['FaxQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db['FaxQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x51')],{});db[_0xe1f6('0x181')][_0xe1f6('0x14e')](db[_0xe1f6('0x53')],{});db[_0xe1f6('0x181')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{});db[_0xe1f6('0x181')][_0xe1f6('0x14e')](db[_0xe1f6('0x55')],{});db[_0xe1f6('0x183')][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':_0xe1f6('0x176'),'foreignKey':_0xe1f6('0x184'),'onDelete':'cascade'});db[_0xe1f6('0x183')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe1f6('0x184')});db[_0xe1f6('0x183')][_0xe1f6('0x117')](db[_0xe1f6('0x5b')],{'as':_0xe1f6('0x17b'),'foreignKey':_0xe1f6('0x184')});db['SmsAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x185')],{'as':_0xe1f6('0x178')});db['SmsAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x58')],{'as':_0xe1f6('0x145'),'foreignKey':_0xe1f6('0x184'),'onDelete':_0xe1f6('0x114')});db['SmsAccount'][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0x183')]['belongsTo'](db[_0xe1f6('0x89')],{'as':_0xe1f6('0x151'),'foreignKey':_0xe1f6('0x152')});db[_0xe1f6('0x183')][_0xe1f6('0x127')](db['User'],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x140')});db['SmsApplication'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x58')][_0xe1f6('0x14e')](db['SmsQueue'],{'onDelete':_0xe1f6('0x161')});db['SmsApplication'][_0xe1f6('0x14e')](db[_0xe1f6('0x183')],{'onDelete':'restrict'});db['SmsApplication'][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x58')]['belongsTo'](db[_0xe1f6('0x169')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x171')});db[_0xe1f6('0x185')]['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe1f6('0x186')});db['SmsInteraction'][_0xe1f6('0x14e')](db['SmsAccount'],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x184')});db[_0xe1f6('0x185')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x185')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':'UserId'});db[_0xe1f6('0x185')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x187'),'as':_0xe1f6('0x16b')});db[_0xe1f6('0x185')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x187'),'as':_0xe1f6('0x17e')});db['SmsInteraction'][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x188'),'through':_0xe1f6('0x12f'),'foreignKey':_0xe1f6('0x186')});db[_0xe1f6('0x5b')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x11')});db[_0xe1f6('0x5b')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e')});db[_0xe1f6('0x5b')]['belongsTo'](db[_0xe1f6('0x185')],{'onDelete':'cascade','as':_0xe1f6('0x16e'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xe1f6('0x14e')](db[_0xe1f6('0x183')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x184')});db['SmsQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0xe1f6('0x36'),'foreignKey':'SmsQueueId'});db[_0xe1f6('0x5d')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'through':_0xe1f6('0x189'),'as':_0xe1f6('0x155')});db[_0xe1f6('0x5f')][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':_0xe1f6('0x176'),'foreignKey':'OpenchannelAccountId','onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x5f')][_0xe1f6('0x117')](db['CannedAnswer'],{'as':_0xe1f6('0x18a'),'foreignKey':_0xe1f6('0x18b')});db['OpenchannelAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x61')],{'as':_0xe1f6('0x178'),'foreignKey':_0xe1f6('0x18b')});db[_0xe1f6('0x5f')][_0xe1f6('0x117')](db['OpenchannelMessage'],{'as':_0xe1f6('0x17b'),'foreignKey':_0xe1f6('0x18b')});db[_0xe1f6('0x5f')][_0xe1f6('0x117')](db[_0xe1f6('0x18c')],{'as':'Applications','foreignKey':_0xe1f6('0x18b'),'onDelete':'cascade'});db[_0xe1f6('0x5f')]['belongsTo'](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xe1f6('0x14e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe1f6('0x152')});db['OpenchannelAccount'][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x18c')][_0xe1f6('0x14e')](db[_0xe1f6('0x65')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x18d')});db[_0xe1f6('0x18c')]['belongsTo'](db[_0xe1f6('0x5f')],{'onDelete':_0xe1f6('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xe1f6('0x18c')][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x18c')][_0xe1f6('0x14e')](db[_0xe1f6('0x169')],{'onDelete':_0xe1f6('0x161'),'foreignKey':'TagId'});db[_0xe1f6('0x61')]['hasMany'](db[_0xe1f6('0x63')],{'as':_0xe1f6('0x17b'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x18e')});db[_0xe1f6('0x61')][_0xe1f6('0x14e')](db[_0xe1f6('0x5f')],{'as':_0xe1f6('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xe1f6('0x61')]['belongsTo'](db[_0xe1f6('0x77')],{'as':'Contact','foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x61')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x61')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x18f'),'as':'Tags'});db[_0xe1f6('0x61')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':'openchannel_interaction_has_tags','as':_0xe1f6('0x17e')});db['OpenchannelInteraction'][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x188'),'through':_0xe1f6('0x130'),'foreignKey':_0xe1f6('0x18e')});db[_0xe1f6('0x63')][_0xe1f6('0x14e')](db['User'],{'onDelete':_0xe1f6('0x114'),'as':'User'});db[_0xe1f6('0x63')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'onDelete':_0xe1f6('0x114'),'as':'Contact'});db[_0xe1f6('0x63')][_0xe1f6('0x14e')](db['OpenchannelInteraction'],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x16e'),'foreignKey':_0xe1f6('0x18e')});db[_0xe1f6('0x63')]['belongsTo'](db[_0xe1f6('0xee')],{'as':_0xe1f6('0xee'),'foreignKey':_0xe1f6('0x17f')});db['OpenchannelMessage'][_0xe1f6('0x14e')](db[_0xe1f6('0x5f')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x18b')});db[_0xe1f6('0x65')][_0xe1f6('0x127')](db['User'],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x38'),'foreignKey':_0xe1f6('0x18d')});db[_0xe1f6('0x65')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'through':_0xe1f6('0x190'),'as':_0xe1f6('0x155')});db[_0xe1f6('0x67')][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':'Dispositions','foreignKey':_0xe1f6('0x191'),'onDelete':'cascade'});db[_0xe1f6('0x67')][_0xe1f6('0x117')](db['CannedAnswer'],{'as':_0xe1f6('0x18a'),'foreignKey':_0xe1f6('0x191')});db[_0xe1f6('0x67')][_0xe1f6('0x117')](db[_0xe1f6('0x75')],{'as':_0xe1f6('0x192')});db['ChatWebsite'][_0xe1f6('0x117')](db['ChatInteraction'],{'as':_0xe1f6('0x178')});db[_0xe1f6('0x67')][_0xe1f6('0x117')](db[_0xe1f6('0x6b')],{'as':'Applications','foreignKey':_0xe1f6('0x191'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x67')]['hasMany'](db[_0xe1f6('0x6f')],{'as':_0xe1f6('0x17b')});db[_0xe1f6('0x67')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':'List','foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0x67')][_0xe1f6('0x14e')](db['Interval'],{'as':_0xe1f6('0x88'),'foreignKey':'IntervalId'});db[_0xe1f6('0x67')]['belongsTo'](db[_0xe1f6('0x40')],{'as':'MailAccount','foreignKey':_0xe1f6('0x15f')});db[_0xe1f6('0x67')][_0xe1f6('0x14e')](db[_0xe1f6('0x89')],{'as':_0xe1f6('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe1f6('0x67')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x138')});db['OpenchannelQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x5f')],{});db[_0xe1f6('0x69')]['belongsTo'](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172')});db['OpenchannelQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe1f6('0x69')][_0xe1f6('0x14e')](db['OpenchannelInteraction'],{});db[_0xe1f6('0x69')]['belongsTo'](db[_0xe1f6('0x63')],{});db[_0xe1f6('0x69')]['belongsTo'](db[_0xe1f6('0x11')],{});db[_0xe1f6('0x69')][_0xe1f6('0x14e')](db['OpenchannelQueue'],{});db[_0xe1f6('0x6b')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db[_0xe1f6('0x6b')][_0xe1f6('0x14e')](db['ChatQueue'],{'as':'Queue','foreignKey':_0xe1f6('0x193'),'onDelete':_0xe1f6('0x161')});db['ChatApplication'][_0xe1f6('0x14e')](db['ChatWebsite'],{'as':_0xe1f6('0x194'),'foreignKey':_0xe1f6('0x191'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x6b')][_0xe1f6('0x14e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe1f6('0x171')});db[_0xe1f6('0x6d')]['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x195')});db['ChatInteraction'][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x191')});db[_0xe1f6('0x6d')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db['ChatInteraction'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x6d')][_0xe1f6('0x127')](db['Tag'],{'through':_0xe1f6('0x196'),'as':'Tags'});db[_0xe1f6('0x6d')]['belongsToMany'](db['Tag'],{'through':_0xe1f6('0x196'),'as':_0xe1f6('0x17e')});db[_0xe1f6('0x6d')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x188'),'through':_0xe1f6('0x197'),'foreignKey':_0xe1f6('0x195')});db[_0xe1f6('0x6f')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x114'),'as':'User'});db[_0xe1f6('0x6f')][_0xe1f6('0x14e')](db['CmContact'],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x6f')][_0xe1f6('0x14e')](db[_0xe1f6('0x6d')],{'onDelete':'cascade','as':_0xe1f6('0x16e'),'foreignKey':_0xe1f6('0x195')});db['ChatMessage']['belongsTo'](db[_0xe1f6('0xee')],{'as':_0xe1f6('0xee'),'foreignKey':_0xe1f6('0x17f')});db[_0xe1f6('0x6f')][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x191')});db['ChatOfflineMessage']['hasMany'](db[_0xe1f6('0xee')],{'as':_0xe1f6('0x16d'),'foreignKey':_0xe1f6('0x16f'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x70')][_0xe1f6('0x14e')](db['CmContact'],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x70')][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe1f6('0x72')]['belongsToMany'](db[_0xe1f6('0x11')],{'as':'Agents','through':_0xe1f6('0x30'),'hooks':!![]});db[_0xe1f6('0x72')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'through':_0xe1f6('0x198'),'as':_0xe1f6('0x155')});db[_0xe1f6('0x73')][_0xe1f6('0x117')](db[_0xe1f6('0xd1')],{'as':_0xe1f6('0x17b'),'foreignKey':_0xe1f6('0x199'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x73')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x148'),'through':_0xe1f6('0x128')});db['ChatProactiveAction'][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'as':_0xe1f6('0x194'),'foreignKey':_0xe1f6('0x191')});db[_0xe1f6('0x76')][_0xe1f6('0x117')](db['CmContact'],{'as':'Contacts','foreignKey':_0xe1f6('0x19a')});db[_0xe1f6('0x77')][_0xe1f6('0x117')](db[_0xe1f6('0x19b')],{'as':_0xe1f6('0x19c'),'foreignKey':_0xe1f6('0x19d')});db['CmContact'][_0xe1f6('0x117')](db[_0xe1f6('0x79')],{'as':_0xe1f6('0x123'),'foreignKey':_0xe1f6('0x182')});db['CmContact']['hasMany'](db[_0xe1f6('0x7d')],{'as':_0xe1f6('0x149'),'foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x77')][_0xe1f6('0x117')](db[_0xe1f6('0x11c')],{'as':'HopperHistories','foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x77')]['hasMany'](db[_0xe1f6('0x7f')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xe1f6('0x77')][_0xe1f6('0x117')](db[_0xe1f6('0xd7')],{'as':_0xe1f6('0x14d'),'foreignKey':'ContactId'});db['CmContact'][_0xe1f6('0x117')](db[_0xe1f6('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x161')});db['CmContact'][_0xe1f6('0x117')](db['ChatInteraction'],{'as':_0xe1f6('0x11f'),'foreignKey':_0xe1f6('0x182'),'onDelete':'restrict'});db['CmContact'][_0xe1f6('0x117')](db[_0xe1f6('0x185')],{'as':_0xe1f6('0x19e'),'foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x77')]['hasMany'](db[_0xe1f6('0x51')],{'as':'FaxInteractions','foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x77')][_0xe1f6('0x117')](db['MailInteraction'],{'as':_0xe1f6('0x12d'),'foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x77')]['belongsTo'](db[_0xe1f6('0x76')],{'as':_0xe1f6('0x19f'),'foreignKey':'CompanyId'});db[_0xe1f6('0x77')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':'List','foreignKey':_0xe1f6('0x172'),'onDelete':'cascade'});db[_0xe1f6('0x77')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x188'),'through':_0xe1f6('0x12a')});db[_0xe1f6('0x77')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'as':_0xe1f6('0x16b'),'through':_0xe1f6('0x1a0')});db[_0xe1f6('0x77')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':'cm_contact_has_tags','as':_0xe1f6('0x17e')});db['CmHopper'][_0xe1f6('0x117')](db[_0xe1f6('0x92')],{'as':'AdditionalPhones','foreignKey':_0xe1f6('0x1a1')});db[_0xe1f6('0x79')]['belongsTo'](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x79')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':'List','foreignKey':_0xe1f6('0x172'),'onDelete':_0xe1f6('0x114')});db['CmHopper'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x1a2'),'foreignKey':'UserId'});db[_0xe1f6('0x79')][_0xe1f6('0x14e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xe1f6('0x14a'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x79')][_0xe1f6('0x14e')](db[_0xe1f6('0x1a3')],{'as':'Campaign','foreignKey':_0xe1f6('0x1a4'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x79')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':'Owner','foreignKey':_0xe1f6('0x1a5')});db['CmHopperBlack'][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182'),'onDelete':_0xe1f6('0x114')});db['CmHopperBlack']['belongsTo'](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x7b')][_0xe1f6('0x14e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xe1f6('0x14a'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x7b')][_0xe1f6('0x14e')](db[_0xe1f6('0x1a3')],{'as':_0xe1f6('0x1a3'),'foreignKey':_0xe1f6('0x1a4'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x83')][_0xe1f6('0x117')](db[_0xe1f6('0x86')],{'as':{'plural':_0xe1f6('0x1a6'),'singular':'OneAll'},'foreignKey':_0xe1f6('0x1a7'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x83')]['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':_0xe1f6('0x1a8')},'foreignKey':_0xe1f6('0x1a9'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db['Automation'][_0xe1f6('0x117')](db[_0xe1f6('0x81')],{'as':_0xe1f6('0x1aa'),'foreignKey':'AutomationId','onDelete':_0xe1f6('0x114'),'hooks':!![]});db['Disposition'][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':'Dispositions','foreignKey':_0xe1f6('0x1ab'),'onDelete':_0xe1f6('0x114')});db['Interval'][_0xe1f6('0x117')](db[_0xe1f6('0x88')],{'as':_0xe1f6('0x1ac'),'foreignKey':_0xe1f6('0x170'),'onDelete':_0xe1f6('0x114'),'hooks':!![],'required':![]});db[_0xe1f6('0x88')][_0xe1f6('0x117')](db[_0xe1f6('0x16')],{'as':'Extensions','foreignKey':_0xe1f6('0x170'),'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x88')][_0xe1f6('0x117')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x88')]['hasMany'](db['ChatApplication'],{'as':_0xe1f6('0x1ad'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x88')][_0xe1f6('0x117')](db[_0xe1f6('0x179')],{'as':_0xe1f6('0x1ae'),'foreignKey':'IntervalId'});db[_0xe1f6('0x88')][_0xe1f6('0x117')](db['SmsApplication'],{'as':_0xe1f6('0x1af'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x1b0')]['belongsTo'](db['MailAccount'],{});db[_0xe1f6('0x1b0')][_0xe1f6('0x14e')](db[_0xe1f6('0x9b')],{'foreignKey':_0xe1f6('0x1b1')});db[_0xe1f6('0x1b0')][_0xe1f6('0x14e')](db[_0xe1f6('0x1b2')],{'foreignKey':_0xe1f6('0x1b3')});db[_0xe1f6('0x8f')][_0xe1f6('0x127')](db[_0xe1f6('0x18')],{'as':_0xe1f6('0x1b4'),'through':'moh_has_sounds','onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x169')][_0xe1f6('0x127')](db[_0xe1f6('0x77')],{'through':'cm_contact_has_tags'});db[_0xe1f6('0x169')][_0xe1f6('0x127')](db[_0xe1f6('0x6d')],{'through':_0xe1f6('0x196')});db['Tag'][_0xe1f6('0x127')](db['MailInteraction'],{'through':_0xe1f6('0x16a')});db[_0xe1f6('0x169')][_0xe1f6('0x127')](db[_0xe1f6('0x185')],{'through':_0xe1f6('0x187')});db[_0xe1f6('0x169')]['belongsToMany'](db[_0xe1f6('0x51')],{'through':_0xe1f6('0x17d')});db[_0xe1f6('0x169')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xe1f6('0x127')](db[_0xe1f6('0x103')],{'through':_0xe1f6('0x1b5')});db['CmContactHasItem'][_0xe1f6('0x14e')](db[_0xe1f6('0x91')],{'as':'ItemType','foreignKey':_0xe1f6('0x1b6')});db[_0xe1f6('0x92')][_0xe1f6('0x14e')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xe1f6('0x1a1')});db[_0xe1f6('0x19b')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x19d')});db[_0xe1f6('0x96')][_0xe1f6('0x117')](db[_0xe1f6('0x86')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xe1f6('0x1b7'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x96')]['hasMany'](db[_0xe1f6('0x86')],{'as':{'plural':_0xe1f6('0x1b8'),'singular':'AnyCondition'},'foreignKey':_0xe1f6('0x1b9'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x96')][_0xe1f6('0x117')](db[_0xe1f6('0x81')],{'as':_0xe1f6('0x1aa'),'foreignKey':_0xe1f6('0x1ba'),'onDelete':_0xe1f6('0x114'),'hooks':!![]});db[_0xe1f6('0x1b2')][_0xe1f6('0x117')](db[_0xe1f6('0x1bb')],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1b3'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe1f6('0x117')](db[_0xe1f6('0x1bb')],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1b1')});db[_0xe1f6('0x9e')][_0xe1f6('0x117')](db[_0xe1f6('0x1bb')],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':'MetricId'});db[_0xe1f6('0x1bb')][_0xe1f6('0x14e')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x1bd')],{'as':'Configurations','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1bd')][_0xe1f6('0x117')](db[_0xe1f6('0xa2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xe1f6('0x1bf')});db['SalesforceConfiguration'][_0xe1f6('0x117')](db[_0xe1f6('0xa2')],{'as':_0xe1f6('0x1c0'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0x1bd')][_0xe1f6('0x117')](db['SalesforceField'],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1bd')][_0xe1f6('0x14e')](db[_0xe1f6('0xa0')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0xa2')]['hasMany'](db[_0xe1f6('0xa2')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xa2')]['hasMany'](db['SalesforceField'],{'as':'Description','foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xa2')][_0xe1f6('0x14e')](db['Variable'],{'as':_0xe1f6('0x98'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x1c5')],{'as':_0xe1f6('0x1c6'),'onDelete':'cascade','foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1c5')][_0xe1f6('0x117')](db['SugarcrmField'],{'as':_0xe1f6('0x1c7'),'onDelete':'cascade','foreignKey':_0xe1f6('0x1bf')});db['SugarcrmConfiguration'][_0xe1f6('0x117')](db[_0xe1f6('0x1c8')],{'as':_0xe1f6('0x1c0'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0x1c5')][_0xe1f6('0x117')](db[_0xe1f6('0x1c8')],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1c5')][_0xe1f6('0x14e')](db[_0xe1f6('0xa4')],{'as':'Account','foreignKey':'AccountId'});db[_0xe1f6('0x1c8')][_0xe1f6('0x117')](db[_0xe1f6('0x1c8')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db['SugarcrmField'][_0xe1f6('0x117')](db[_0xe1f6('0x1c8')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xe1f6('0x117')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1c8')][_0xe1f6('0x14e')](db['Variable'],{'as':'Variable','foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xa8')][_0xe1f6('0x117')](db[_0xe1f6('0x1ca')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db['DeskConfiguration'][_0xe1f6('0x117')](db['DeskField'],{'as':_0xe1f6('0x1c7'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0x1ca')][_0xe1f6('0x117')](db['DeskField'],{'as':_0xe1f6('0x1c0'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0x1ca')][_0xe1f6('0x117')](db['DeskField'],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1ca')][_0xe1f6('0x14e')](db['DeskAccount'],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db['DeskConfiguration']['belongsToMany'](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x1cb')});db[_0xe1f6('0xab')][_0xe1f6('0x117')](db[_0xe1f6('0xab')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xab')][_0xe1f6('0x117')](db[_0xe1f6('0xab')],{'as':'Description','foreignKey':_0xe1f6('0x1c1')});db['DeskField'][_0xe1f6('0x117')](db[_0xe1f6('0xab')],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xab')][_0xe1f6('0x14e')](db[_0xe1f6('0x98')],{'as':_0xe1f6('0x98'),'foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xac')][_0xe1f6('0x117')](db[_0xe1f6('0x1cc')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1cc')]['hasMany'](db[_0xe1f6('0xae')],{'as':_0xe1f6('0x1c7'),'onDelete':'cascade','foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0x1cc')]['hasMany'](db['ZohoField'],{'as':_0xe1f6('0x1c0'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0x1cc')][_0xe1f6('0x117')](db[_0xe1f6('0xae')],{'as':_0xe1f6('0x1bc'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c2')});db['ZohoConfiguration'][_0xe1f6('0x14e')](db['ZohoAccount'],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0xae')]['hasMany'](db[_0xe1f6('0xae')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xae')][_0xe1f6('0x117')](db['ZohoField'],{'as':'Description','foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xae')][_0xe1f6('0x117')](db[_0xe1f6('0xae')],{'as':_0xe1f6('0x1c4'),'foreignKey':'FieldId'});db[_0xe1f6('0xae')][_0xe1f6('0x14e')](db[_0xe1f6('0x98')],{'as':_0xe1f6('0x98'),'foreignKey':_0xe1f6('0x1c9')});db['ZendeskAccount'][_0xe1f6('0x117')](db[_0xe1f6('0xb2')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':'AccountId'});db[_0xe1f6('0xb2')][_0xe1f6('0x117')](db[_0xe1f6('0xb4')],{'as':_0xe1f6('0x1c7'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xe1f6('0x117')](db[_0xe1f6('0xb4')],{'as':_0xe1f6('0x1c0'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xb2')][_0xe1f6('0x117')](db[_0xe1f6('0xb4')],{'as':_0xe1f6('0x1bc'),'foreignKey':'FieldId'});db[_0xe1f6('0xb2')][_0xe1f6('0x14e')](db['ZendeskAccount'],{'as':_0xe1f6('0x167'),'foreignKey':'AccountId'});db[_0xe1f6('0xb2')][_0xe1f6('0x127')](db['Tag'],{'through':_0xe1f6('0x1cd')});db[_0xe1f6('0xb4')][_0xe1f6('0x117')](db['ZendeskField'],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xb4')][_0xe1f6('0x117')](db[_0xe1f6('0xb4')],{'as':'Description','foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xb4')]['hasMany'](db[_0xe1f6('0xb4')],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xb4')][_0xe1f6('0x14e')](db['Variable'],{'as':_0xe1f6('0x98'),'foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xb6')][_0xe1f6('0x117')](db[_0xe1f6('0x1ce')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1ce')][_0xe1f6('0x117')](db['FreshdeskField'],{'as':_0xe1f6('0x1c7'),'onDelete':_0xe1f6('0x114'),'foreignKey':'SubjectId'});db[_0xe1f6('0x1ce')]['hasMany'](db[_0xe1f6('0xb8')],{'as':_0xe1f6('0x1c0'),'onDelete':_0xe1f6('0x114'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0xe1f6('0xb8')],{'as':'Fields','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1ce')]['belongsTo'](db[_0xe1f6('0xb6')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1ce')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x1cf')});db[_0xe1f6('0xb8')][_0xe1f6('0x117')](db[_0xe1f6('0xb8')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db['FreshdeskField']['hasMany'](db[_0xe1f6('0xb8')],{'as':_0xe1f6('0x1d0'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xb8')][_0xe1f6('0x117')](db[_0xe1f6('0xb8')],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db['FreshdeskField'][_0xe1f6('0x14e')](db['Variable'],{'as':_0xe1f6('0x98'),'foreignKey':'VariableId'});db[_0xe1f6('0xba')][_0xe1f6('0x117')](db[_0xe1f6('0xbc')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0xbc')]['hasMany'](db[_0xe1f6('0xbe')],{'as':_0xe1f6('0x1c7'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xbc')][_0xe1f6('0x117')](db[_0xe1f6('0xbe')],{'as':_0xe1f6('0x1c0'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xbc')][_0xe1f6('0x117')](db[_0xe1f6('0xbe')],{'as':'Fields','foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xbc')][_0xe1f6('0x14e')](db[_0xe1f6('0xba')],{'as':'Account','foreignKey':'AccountId'});db[_0xe1f6('0xbe')][_0xe1f6('0x117')](db[_0xe1f6('0xbe')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db['VtigerField'][_0xe1f6('0x117')](db[_0xe1f6('0xbe')],{'as':_0xe1f6('0x1d0'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xbe')][_0xe1f6('0x117')](db[_0xe1f6('0xbe')],{'as':'Field','foreignKey':'FieldId'});db[_0xe1f6('0xbe')][_0xe1f6('0x14e')](db[_0xe1f6('0x98')],{'as':_0xe1f6('0x98'),'foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xc0')][_0xe1f6('0x117')](db[_0xe1f6('0xc1')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db['ServicenowConfiguration'][_0xe1f6('0x117')](db['ServicenowField'],{'as':_0xe1f6('0x1c7'),'foreignKey':'SubjectId'});db[_0xe1f6('0xc1')][_0xe1f6('0x117')](db[_0xe1f6('0x1d1')],{'as':_0xe1f6('0x1c0'),'foreignKey':_0xe1f6('0x1c1')});db['ServicenowConfiguration']['hasMany'](db[_0xe1f6('0x1d1')],{'as':'Fields','foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xc1')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0x1d1')][_0xe1f6('0x117')](db[_0xe1f6('0x1d1')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0x1d1')][_0xe1f6('0x117')](db[_0xe1f6('0x1d1')],{'as':_0xe1f6('0x1d0'),'foreignKey':_0xe1f6('0x1c1')});db['ServicenowField'][_0xe1f6('0x117')](db[_0xe1f6('0x1d1')],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1d1')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['Dynamics365Account'][_0xe1f6('0x117')](db['Dynamics365Configuration'],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0xc4')]['belongsTo'](db[_0xe1f6('0x10b')],{'as':_0xe1f6('0x10b'),'foreignKey':_0xe1f6('0x160')});db[_0xe1f6('0xc6')][_0xe1f6('0x117')](db[_0xe1f6('0x1d2')],{'as':_0xe1f6('0x1c7'),'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xc6')][_0xe1f6('0x117')](db[_0xe1f6('0x1d2')],{'as':'Descriptions','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xe1f6('0x114'),'foreignKey':'FieldId'});db[_0xe1f6('0xc6')][_0xe1f6('0x14e')](db[_0xe1f6('0xc4')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db['Dynamics365Field'][_0xe1f6('0x117')](db[_0xe1f6('0x1d2')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0xe1f6('0x1d0'),'foreignKey':_0xe1f6('0x1c1')});db['Dynamics365Field'][_0xe1f6('0x117')](db[_0xe1f6('0x1d2')],{'as':_0xe1f6('0x1c4'),'foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0x1d2')][_0xe1f6('0x14e')](db['Variable'],{'as':_0xe1f6('0x98'),'foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xc8')][_0xe1f6('0x117')](db[_0xe1f6('0xca')],{'as':_0xe1f6('0x1c6'),'onDelete':_0xe1f6('0x114'),'foreignKey':'AccountId'});db[_0xe1f6('0xca')][_0xe1f6('0x117')](db['FreshsalesField'],{'as':_0xe1f6('0x1c7'),'foreignKey':'SubjectId'});db[_0xe1f6('0xca')][_0xe1f6('0x117')](db['FreshsalesField'],{'as':_0xe1f6('0x1c0'),'foreignKey':_0xe1f6('0x1c1')});db[_0xe1f6('0xca')][_0xe1f6('0x117')](db[_0xe1f6('0xcc')],{'as':_0xe1f6('0x1bc'),'foreignKey':'FieldId'});db[_0xe1f6('0xca')][_0xe1f6('0x14e')](db['FreshsalesAccount'],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1be')});db[_0xe1f6('0xcc')]['hasMany'](db[_0xe1f6('0xcc')],{'as':_0xe1f6('0x1c3'),'foreignKey':_0xe1f6('0x1bf')});db[_0xe1f6('0xcc')][_0xe1f6('0x117')](db[_0xe1f6('0xcc')],{'as':_0xe1f6('0x1d0'),'foreignKey':_0xe1f6('0x1c1')});db['FreshsalesField'][_0xe1f6('0x117')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xe1f6('0x1c2')});db[_0xe1f6('0xcc')][_0xe1f6('0x14e')](db[_0xe1f6('0x98')],{'as':'Variable','foreignKey':_0xe1f6('0x1c9')});db[_0xe1f6('0xcf')]['belongsTo'](db[_0xe1f6('0x67')],{});db[_0xe1f6('0xcf')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':'ListId'});db[_0xe1f6('0xcf')]['belongsTo'](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':'ContactId'});db[_0xe1f6('0xcf')]['belongsTo'](db[_0xe1f6('0x6d')],{});db[_0xe1f6('0xcf')][_0xe1f6('0x14e')](db[_0xe1f6('0x6f')],{});db[_0xe1f6('0xcf')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{});db[_0xe1f6('0xcf')][_0xe1f6('0x14e')](db['ChatQueue'],{});db[_0xe1f6('0xd1')]['belongsTo'](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1d3')});db[_0xe1f6('0xd1')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x1d4')});db[_0xe1f6('0xd7')][_0xe1f6('0x117')](db[_0xe1f6('0xd5')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xe1f6('0xd7')]['hasMany'](db[_0xe1f6('0xd3')],{'foreignKey':_0xe1f6('0x1d5'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0xd9')]['belongsTo'](db[_0xe1f6('0x183')],{});db[_0xe1f6('0xd9')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':'ContactId'});db[_0xe1f6('0xd9')][_0xe1f6('0x14e')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x5b')],{});db['SmsQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{});db['SmsQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x5d')],{});db[_0xe1f6('0xde')][_0xe1f6('0x117')](db[_0xe1f6('0xd7')],{'foreignKey':'ProjectId'});db[_0xe1f6('0xde')][_0xe1f6('0x117')](db[_0xe1f6('0xd5')],{'foreignKey':'ProjectId'});db[_0xe1f6('0xde')][_0xe1f6('0x117')](db[_0xe1f6('0xd3')],{'foreignKey':_0xe1f6('0x1d6')});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x12c')});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x1a')],{'through':'TeamVoiceQueue','as':_0xe1f6('0x132')});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x42')],{'through':_0xe1f6('0x165'),'as':'MailQueues'});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x72')],{'through':_0xe1f6('0x198'),'as':_0xe1f6('0x1d7')});db['Team'][_0xe1f6('0x127')](db[_0xe1f6('0x55')],{'through':_0xe1f6('0x180'),'as':_0xe1f6('0x135')});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db['SmsQueue'],{'through':_0xe1f6('0x189'),'as':_0xe1f6('0x1d8')});db['Team'][_0xe1f6('0x127')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x10a')],{'through':_0xe1f6('0x1d9'),'as':_0xe1f6('0x137')});db[_0xe1f6('0xe7')][_0xe1f6('0x127')](db[_0xe1f6('0x133')],{'through':_0xe1f6('0x10c'),'as':_0xe1f6('0x134')});db['Campaign']['hasMany'](db[_0xe1f6('0x79')],{'as':'Hoppers','foreignKey':_0xe1f6('0x1a4')});db[_0xe1f6('0x1a3')][_0xe1f6('0x117')](db['CmHopperFinal'],{'as':_0xe1f6('0x149'),'foreignKey':_0xe1f6('0x1a4')});db['Campaign'][_0xe1f6('0x117')](db[_0xe1f6('0x11c')],{'as':_0xe1f6('0x14b'),'foreignKey':_0xe1f6('0x1a4')});db[_0xe1f6('0x1a3')][_0xe1f6('0x117')](db[_0xe1f6('0x7b')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0xe1f6('0x14e')](db[_0xe1f6('0x28')],{'as':_0xe1f6('0x28'),'foreignKey':_0xe1f6('0x14f')});db[_0xe1f6('0x1a3')]['belongsTo'](db[_0xe1f6('0x28')],{'as':_0xe1f6('0x150'),'foreignKey':_0xe1f6('0x1da')});db[_0xe1f6('0x1a3')][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'as':_0xe1f6('0x88'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x1a3')][_0xe1f6('0x14e')](db[_0xe1f6('0xe2')],{'as':_0xe1f6('0xe2'),'foreignKey':_0xe1f6('0x1db')});db[_0xe1f6('0x1a3')][_0xe1f6('0x127')](db['CmList'],{'as':'Lists','through':_0xe1f6('0x1dc')});db[_0xe1f6('0x1a3')][_0xe1f6('0x127')](db['CmList'],{'as':_0xe1f6('0x157'),'through':'campaigns_has_cm_blacklists'});db[_0xe1f6('0xee')][_0xe1f6('0x14e')](db[_0xe1f6('0x70')],{'as':_0xe1f6('0x70'),'foreignKey':_0xe1f6('0x16f')});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db['MailMessage'],{});db['MailTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x46')],{});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db[_0xe1f6('0x40')],{'foreignKey':'FromMailAccountId','as':_0xe1f6('0x1dd')});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1de'),'as':_0xe1f6('0x1df')});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1e0'),'as':'ToAgent'});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db[_0xe1f6('0x42')],{'foreignKey':_0xe1f6('0x1e1'),'as':'ToQueue'});db[_0xe1f6('0xf1')][_0xe1f6('0x14e')](db[_0xe1f6('0x40')],{'foreignKey':'ToMailAccountId','as':_0xe1f6('0x1e2')});db[_0xe1f6('0x1e3')][_0xe1f6('0x14e')](db['ChatMessage'],{});db[_0xe1f6('0x1e3')][_0xe1f6('0x14e')](db[_0xe1f6('0x6d')],{});db['ChatTransferReport'][_0xe1f6('0x14e')](db['ChatWebsite'],{'foreignKey':_0xe1f6('0x1e4'),'as':_0xe1f6('0x1dd')});db[_0xe1f6('0x1e3')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':'FromUserId','as':_0xe1f6('0x1df')});db['ChatTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1e0'),'as':_0xe1f6('0x1e5')});db['ChatTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x72')],{'foreignKey':_0xe1f6('0x1e6'),'as':_0xe1f6('0x1e7')});db[_0xe1f6('0x1e3')][_0xe1f6('0x14e')](db[_0xe1f6('0x67')],{'foreignKey':_0xe1f6('0x1e8'),'as':'ToAccount'});db[_0xe1f6('0x1e9')][_0xe1f6('0x14e')](db[_0xe1f6('0x53')],{});db['FaxTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x51')],{});db[_0xe1f6('0x1e9')][_0xe1f6('0x14e')](db[_0xe1f6('0x4f')],{'foreignKey':_0xe1f6('0x1ea'),'as':_0xe1f6('0x1dd')});db['FaxTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1de'),'as':_0xe1f6('0x1df')});db[_0xe1f6('0x1e9')][_0xe1f6('0x14e')](db['User'],{'foreignKey':_0xe1f6('0x1e0'),'as':'ToAgent'});db[_0xe1f6('0x1e9')][_0xe1f6('0x14e')](db[_0xe1f6('0x55')],{'foreignKey':'ToFaxQueueId','as':_0xe1f6('0x1e7')});db[_0xe1f6('0x1e9')][_0xe1f6('0x14e')](db[_0xe1f6('0x4f')],{'foreignKey':_0xe1f6('0x1eb'),'as':_0xe1f6('0x1e2')});db['OpenchannelTransferReport']['belongsTo'](db[_0xe1f6('0x63')],{});db[_0xe1f6('0xf5')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x5f')],{'foreignKey':'FromOpenchannelAccountId','as':_0xe1f6('0x1dd')});db['OpenchannelTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1de'),'as':_0xe1f6('0x1df')});db['OpenchannelTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1e0'),'as':_0xe1f6('0x1e5')});db[_0xe1f6('0xf5')]['belongsTo'](db[_0xe1f6('0x65')],{'foreignKey':_0xe1f6('0x1ec'),'as':'ToQueue'});db[_0xe1f6('0xf5')][_0xe1f6('0x14e')](db[_0xe1f6('0x5f')],{'foreignKey':_0xe1f6('0x1ed'),'as':_0xe1f6('0x1e2')});db[_0xe1f6('0xf7')][_0xe1f6('0x14e')](db[_0xe1f6('0x5b')],{});db[_0xe1f6('0xf7')][_0xe1f6('0x14e')](db[_0xe1f6('0x185')],{});db[_0xe1f6('0xf7')][_0xe1f6('0x14e')](db[_0xe1f6('0x183')],{'foreignKey':_0xe1f6('0x1ee'),'as':'FromAccount'});db['SmsTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1de'),'as':_0xe1f6('0x1df')});db[_0xe1f6('0xf7')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1e0'),'as':'ToAgent'});db[_0xe1f6('0xf7')]['belongsTo'](db[_0xe1f6('0x5d')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xe1f6('0xf7')][_0xe1f6('0x14e')](db[_0xe1f6('0x183')],{'foreignKey':_0xe1f6('0x1ef'),'as':_0xe1f6('0x1e2')});db[_0xe1f6('0xf9')][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':_0xe1f6('0x176'),'foreignKey':'ListId','onDelete':_0xe1f6('0x114')});db[_0xe1f6('0xf9')][_0xe1f6('0x117')](db[_0xe1f6('0x1f0')],{'as':_0xe1f6('0x1f1'),'foreignKey':'ListId'});db[_0xe1f6('0xf9')]['hasMany'](db[_0xe1f6('0x77')],{'as':'Contacts','onDelete':_0xe1f6('0x114'),'foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0xf9')][_0xe1f6('0x117')](db['CmHopperFinal'],{'as':_0xe1f6('0x149'),'foreignKey':'ListId'});db[_0xe1f6('0xf9')]['hasMany'](db[_0xe1f6('0x11c')],{'as':_0xe1f6('0x11d'),'foreignKey':_0xe1f6('0x172')});db[_0xe1f6('0xf9')][_0xe1f6('0x117')](db[_0xe1f6('0x7f')],{'as':_0xe1f6('0x7f'),'foreignKey':_0xe1f6('0x172')});db['CmList']['belongsToMany'](db[_0xe1f6('0x1a')],{'as':_0xe1f6('0x1f2'),'through':_0xe1f6('0x1f3')});db['CmList']['belongsToMany'](db['User'],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x12b')});db['VoicePrefix']['hasMany'](db[_0xe1f6('0x16')],{'as':'Extensions','onDelete':'cascade'});db[_0xe1f6('0x133')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x10e')});db[_0xe1f6('0x133')][_0xe1f6('0x127')](db[_0xe1f6('0xe7')],{'through':_0xe1f6('0x10c'),'as':'Teams'});db[_0xe1f6('0x125')][_0xe1f6('0x117')](db['User'],{'as':'Users','foreignKey':_0xe1f6('0x126')});db[_0xe1f6('0x125')]['hasMany'](db[_0xe1f6('0xfc')],{'as':_0xe1f6('0x1f4'),'foreignKey':_0xe1f6('0x126'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0xfc')][_0xe1f6('0x117')](db['UserProfileResource'],{'as':_0xe1f6('0x1f5'),'foreignKey':'sectionId','onDelete':_0xe1f6('0x114')});db['WhatsappAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x175')],{'as':_0xe1f6('0x176'),'foreignKey':_0xe1f6('0x1f6'),'onDelete':_0xe1f6('0x114')});db[_0xe1f6('0x101')][_0xe1f6('0x117')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe1f6('0x1f6')});db['WhatsappAccount'][_0xe1f6('0x117')](db['WhatsappMessage'],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xe1f6('0x101')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0xe1f6('0x117')](db[_0xe1f6('0x102')],{'as':_0xe1f6('0x145'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xe1f6('0x101')][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':_0xe1f6('0x164'),'foreignKey':_0xe1f6('0x172')});db['WhatsappAccount'][_0xe1f6('0x14e')](db['Pause'],{'as':_0xe1f6('0x151'),'foreignKey':_0xe1f6('0x152')});db[_0xe1f6('0x101')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x154'),'through':_0xe1f6('0x142')});db[_0xe1f6('0x102')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x102')]['belongsTo'](db[_0xe1f6('0x10a')],{'onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x102')][_0xe1f6('0x14e')](db[_0xe1f6('0x101')],{'onDelete':'restrict'});db[_0xe1f6('0x102')][_0xe1f6('0x14e')](db[_0xe1f6('0x88')],{'onDelete':_0xe1f6('0x161'),'foreignKey':_0xe1f6('0x170')});db[_0xe1f6('0x102')][_0xe1f6('0x14e')](db['Tag'],{'onDelete':_0xe1f6('0x161'),'foreignKey':'TagId'});db[_0xe1f6('0x103')]['hasMany'](db[_0xe1f6('0x104')],{'as':_0xe1f6('0x17b'),'onDelete':'cascade','foreignKey':_0xe1f6('0x1f7')});db[_0xe1f6('0x103')][_0xe1f6('0x14e')](db[_0xe1f6('0x101')],{'as':_0xe1f6('0x167'),'foreignKey':_0xe1f6('0x1f6')});db[_0xe1f6('0x103')][_0xe1f6('0x14e')](db[_0xe1f6('0x77')],{'as':_0xe1f6('0x15e'),'foreignKey':_0xe1f6('0x182')});db['WhatsappInteraction']['belongsTo'](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x168'),'foreignKey':_0xe1f6('0x115')});db[_0xe1f6('0x103')][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':_0xe1f6('0x1b5'),'as':_0xe1f6('0x16b')});db['WhatsappInteraction'][_0xe1f6('0x127')](db[_0xe1f6('0x169')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xe1f6('0x103')][_0xe1f6('0x127')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x188'),'through':_0xe1f6('0x131'),'foreignKey':_0xe1f6('0x1f7')});db[_0xe1f6('0x104')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x11')});db[_0xe1f6('0x104')]['belongsTo'](db[_0xe1f6('0x77')],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x15e')});db[_0xe1f6('0x104')][_0xe1f6('0x14e')](db[_0xe1f6('0x103')],{'onDelete':_0xe1f6('0x114'),'as':_0xe1f6('0x16e'),'foreignKey':'WhatsappInteractionId'});db[_0xe1f6('0x104')][_0xe1f6('0x14e')](db[_0xe1f6('0x101')],{'as':_0xe1f6('0x167'),'foreignKey':'WhatsappAccountId'});db[_0xe1f6('0x106')]['belongsTo'](db[_0xe1f6('0x101')],{});db['WhatsappQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0xe1f6('0x106')]['belongsTo'](db[_0xe1f6('0x77')],{'as':'Contact','foreignKey':_0xe1f6('0x182')});db[_0xe1f6('0x106')][_0xe1f6('0x14e')](db[_0xe1f6('0x103')],{});db[_0xe1f6('0x106')][_0xe1f6('0x14e')](db[_0xe1f6('0x10a')],{});db[_0xe1f6('0x106')][_0xe1f6('0x14e')](db[_0xe1f6('0x104')],{});db['WhatsappQueueReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{});db[_0xe1f6('0x108')][_0xe1f6('0x14e')](db[_0xe1f6('0x104')],{});db['WhatsappTransferReport'][_0xe1f6('0x14e')](db[_0xe1f6('0x103')],{});db[_0xe1f6('0x108')][_0xe1f6('0x14e')](db[_0xe1f6('0x101')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0xe1f6('0x108')]['belongsTo'](db[_0xe1f6('0x101')],{'foreignKey':_0xe1f6('0x1f8'),'as':'ToAccount'});db[_0xe1f6('0x108')][_0xe1f6('0x14e')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0xe1f6('0x1e7')});db[_0xe1f6('0x108')][_0xe1f6('0x14e')](db['User'],{'foreignKey':_0xe1f6('0x1de'),'as':'FromAgent'});db[_0xe1f6('0x108')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'foreignKey':_0xe1f6('0x1e0'),'as':_0xe1f6('0x1e5')});db['WhatsappQueue']['belongsToMany'](db['User'],{'as':_0xe1f6('0x154'),'through':'UserWhatsappQueue','foreignKey':_0xe1f6('0x1f9')});db[_0xe1f6('0x10a')]['belongsToMany'](db[_0xe1f6('0xe7')],{'through':'team_has_whatsapp_queues','as':_0xe1f6('0x155')});db[_0xe1f6('0x110')][_0xe1f6('0x14e')](db[_0xe1f6('0x11')],{'as':_0xe1f6('0x1fa'),'foreignKey':_0xe1f6('0x115'),'onDelete':'cascade','hooks':!![]});db[_0xe1f6('0x10b')][_0xe1f6('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xe1f6('0x161')});db[_0xe1f6('0x10b')][_0xe1f6('0x113')](db['MailServerIn'],{'as':_0xe1f6('0x162'),'onDelete':_0xe1f6('0x161')});db['CloudProvider'][_0xe1f6('0x113')](db[_0xe1f6('0x3e')],{'as':'Smtp','onDelete':_0xe1f6('0x161')});module[_0xe1f6('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x97e4=['mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','Contact','MailServerOut','CloudProviderId','restrict','Imap','Smtp','Dispositions','MailAccountId','Messages','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','Items','Answers','FaxAccountId','FaxApplication','Exntensions','mandatoryDispositionPause','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','OpenchannelQueueReport','Agent','Queue','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Phones','Company','AdditionalPhones','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','SubjectId','Variable','Descriptions','SugarcrmField','Subject','Description','Field','VariableId','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_teams','FaxQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromAgent','FromFaxAccountId','FromAccount','FromUserId','ToFaxQueueId','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','sequelizeHistory','xC@LL1234','mysql','utf8_general_ci','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','../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','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserSetting','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','CmHopper','belongsTo','belongsToMany','Groups','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','UserVoicePrefix','MailQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccount','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMail'];(function(_0x3a08d7,_0xb3d0eb){var _0xb4a103=function(_0x3c3f6c){while(--_0x3c3f6c){_0x3a08d7['push'](_0x3a08d7['shift']());}};_0xb4a103(++_0xb3d0eb);}(_0x97e4,0x98));var _0x497e=function(_0x45b1ad,_0x215b03){_0x45b1ad=_0x45b1ad-0x0;var _0x3d5696=_0x97e4[_0x45b1ad];return _0x3d5696;};'use strict';var config=require(_0x497e('0x0'));var Sequelize=require(_0x497e('0x1'));var _=require(_0x497e('0x2'));var jstz=require('jstz');var timezone=jstz[_0x497e('0x3')]();config[_0x497e('0x1')]=_[_0x497e('0x4')](config[_0x497e('0x1')],{'database':_0x497e('0x5'),'username':_0x497e('0x6'),'password':'xC@LL1234','options':{'host':_0x497e('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x497e('0x8')},'logging':![],'timezone':timezone[_0x497e('0x9')](),'define':{'charset':_0x497e('0xa'),'collate':'utf8_general_ci'}}});config[_0x497e('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x497e('0x5'),'username':_0x497e('0x6'),'password':_0x497e('0xc'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x497e('0xd'),'dialectOptions':{'charset':_0x497e('0x8')},'logging':![],'timezone':timezone[_0x497e('0x9')](),'define':{'charset':_0x497e('0xa'),'collate':_0x497e('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x497e('0x1')][_0x497e('0xf')],config[_0x497e('0x1')]['password'],config[_0x497e('0x1')][_0x497e('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x497e('0xb')][_0x497e('0xf')],config[_0x497e('0xb')][_0x497e('0x11')],config[_0x497e('0xb')]['options'])};db[_0x497e('0x12')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x14'));db[_0x497e('0x15')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x497e('0x16')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x17'));db[_0x497e('0x18')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x19'));db[_0x497e('0x1a')]=db[_0x497e('0x1')]['import'](_0x497e('0x1b'));db[_0x497e('0x1c')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x1d'));db[_0x497e('0x1e')]=db[_0x497e('0x1')]['import'](_0x497e('0x1f'));db[_0x497e('0x20')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x497e('0x1')]['import'](_0x497e('0x21'));db[_0x497e('0x22')]=db['sequelize'][_0x497e('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize'][_0x497e('0x13')](_0x497e('0x23'));db[_0x497e('0x24')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x25'));db[_0x497e('0x26')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x497e('0x27')]=db[_0x497e('0x1')]['import'](_0x497e('0x28'));db['MemberReport']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x29'));db['Trunk']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x2a'));db[_0x497e('0x2b')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x2c'));db[_0x497e('0x2d')]=db[_0x497e('0x1')]['import'](_0x497e('0x2e'));db[_0x497e('0x2f')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x30'));db[_0x497e('0x31')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x32'));db[_0x497e('0x33')]=db['sequelize']['import']('../api/userMailQueue/userMailQueue.model');db[_0x497e('0x34')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x35'));db[_0x497e('0x36')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x497e('0x37')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x38'));db[_0x497e('0x39')]=db[_0x497e('0x1')]['import'](_0x497e('0x3a'));db[_0x497e('0x3b')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x3c'));db['MailAccount']=db['sequelize'][_0x497e('0x13')](_0x497e('0x3d'));db[_0x497e('0x3e')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x3f'));db[_0x497e('0x40')]=db['sequelize']['import'](_0x497e('0x41'));db['MailInteraction']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x42'));db[_0x497e('0x43')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x44'));db[_0x497e('0x45')]=db[_0x497e('0x1')]['import'](_0x497e('0x46'));db['MailQueueReport']=db['sequelize'][_0x497e('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x497e('0x47')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x48'));db[_0x497e('0x49')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x4a'));db['FaxAccount']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x4b'));db['FaxApplication']=db['sequelize'][_0x497e('0x13')](_0x497e('0x4c'));db['FaxInteraction']=db[_0x497e('0x1')]['import'](_0x497e('0x4d'));db[_0x497e('0x4e')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x4f'));db[_0x497e('0x50')]=db[_0x497e('0x1')]['import'](_0x497e('0x51'));db[_0x497e('0x52')]=db['sequelize']['import'](_0x497e('0x53'));db[_0x497e('0x54')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x55'));db['SmsApplication']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x56'));db[_0x497e('0x57')]=db[_0x497e('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x497e('0x58')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/smsMessage/smsMessage.model');db[_0x497e('0x59')]=db[_0x497e('0x1')]['import'](_0x497e('0x5a'));db[_0x497e('0x5b')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x5c'));db[_0x497e('0x5d')]=db['sequelize']['import'](_0x497e('0x5e'));db['OpenchannelInteraction']=db[_0x497e('0x1')]['import'](_0x497e('0x5f'));db[_0x497e('0x60')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x61'));db[_0x497e('0x62')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x497e('0x63')]=db[_0x497e('0x1')]['import'](_0x497e('0x64'));db['OpenchannelQueueReport']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x65'));db[_0x497e('0x66')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x67'));db[_0x497e('0x68')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x69'));db['ChatMessage']=db['sequelize'][_0x497e('0x13')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x6a'));db[_0x497e('0x6b')]=db[_0x497e('0x1')]['import'](_0x497e('0x6c'));db[_0x497e('0x6d')]=db[_0x497e('0x1')]['import'](_0x497e('0x6e'));db['ChatProactiveAction']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x6f'));db[_0x497e('0x70')]=db['sequelize'][_0x497e('0x13')]('../api/cmCompany/cmCompany.model');db[_0x497e('0x71')]=db[_0x497e('0x1')]['import'](_0x497e('0x72'));db['CmHopper']=db['sequelize'][_0x497e('0x13')](_0x497e('0x73'));db[_0x497e('0x74')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x75'));db[_0x497e('0x76')]=db[_0x497e('0x1')]['import'](_0x497e('0x77'));db[_0x497e('0x78')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x79'));db['ReportAgentPreview']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x497e('0x7a')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x7b'));db[_0x497e('0x7c')]=db[_0x497e('0x1')]['import']('../api/action/action.model');db[_0x497e('0x7d')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x7e'));db[_0x497e('0x7f')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x80'));db[_0x497e('0x81')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x82'));db['Condition']=db[_0x497e('0x1')]['import']('../api/condition/condition.model');db[_0x497e('0x83')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x84'));db[_0x497e('0x85')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0x497e('0x13')](_0x497e('0x86'));db[_0x497e('0x87')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x88'));db[_0x497e('0x89')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x8a'));db[_0x497e('0x8b')]=db[_0x497e('0x1')]['import'](_0x497e('0x8c'));db[_0x497e('0x8d')]=db[_0x497e('0x1')]['import'](_0x497e('0x8e'));db[_0x497e('0x8f')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x90'));db[_0x497e('0x91')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x92'));db[_0x497e('0x93')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x94'));db[_0x497e('0x95')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/template/template.model');db[_0x497e('0x96')]=db[_0x497e('0x1')]['import'](_0x497e('0x97'));db['Variable']=db['sequelize'][_0x497e('0x13')](_0x497e('0x98'));db[_0x497e('0x99')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x9a'));db[_0x497e('0x9b')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/integrationReport/integrationReport.model');db[_0x497e('0x9c')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x9d'));db['AnalyticDefaultReport']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x9e'));db[_0x497e('0x9f')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xa0'));db[_0x497e('0xa1')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x497e('0xa2')]=db['sequelize']['import'](_0x497e('0xa3'));db[_0x497e('0xa4')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xa5'));db[_0x497e('0xa6')]=db['sequelize']['import'](_0x497e('0xa7'));db[_0x497e('0xa8')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xa9'));db[_0x497e('0xaa')]=db['sequelize'][_0x497e('0x13')](_0x497e('0xab'));db[_0x497e('0xac')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xad'));db[_0x497e('0xae')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xaf'));db['SugarcrmField']=db['sequelize'][_0x497e('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x497e('0xb0')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xb1'));db[_0x497e('0xb2')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xb3'));db[_0x497e('0xb4')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/intDeskField/intDeskField.model');db[_0x497e('0xb5')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xb6'));db['ZohoConfiguration']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x497e('0xb7')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xb8'));db[_0x497e('0xb9')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xba'));db[_0x497e('0xbb')]=db[_0x497e('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x497e('0xbc')]=db['sequelize'][_0x497e('0x13')](_0x497e('0xbd'));db[_0x497e('0xbe')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xbf'));db[_0x497e('0xc0')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xc1'));db[_0x497e('0xc2')]=db['sequelize'][_0x497e('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x497e('0xc3')]=db[_0x497e('0x1')]['import'](_0x497e('0xc4'));db['VtigerConfiguration']=db['sequelize'][_0x497e('0x13')](_0x497e('0xc5'));db[_0x497e('0xc6')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xc7'));db[_0x497e('0xc8')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xc9'));db[_0x497e('0xca')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xcb'));db[_0x497e('0xcc')]=db[_0x497e('0x1')]['import'](_0x497e('0xcd'));db[_0x497e('0xce')]=db['sequelize'][_0x497e('0x13')](_0x497e('0xcf'));db[_0x497e('0xd0')]=db[_0x497e('0x1')]['import'](_0x497e('0xd1'));db[_0x497e('0xd2')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x497e('0xd3')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xd4'));db[_0x497e('0xd5')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xd6'));db[_0x497e('0xd7')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xd8'));db[_0x497e('0x99')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x9a'));db[_0x497e('0xd9')]=db[_0x497e('0x1')]['import'](_0x497e('0xda'));db[_0x497e('0xdb')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xdc'));db[_0x497e('0xdd')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xde'));db[_0x497e('0xdf')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xe0'));db['JscriptyQuestionReport']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xe1'));db[_0x497e('0xe2')]=db['sequelize'][_0x497e('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x497e('0xe3')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xe4'));db['SquareReport']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize'][_0x497e('0x13')](_0x497e('0xe5'));db[_0x497e('0xe6')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xe7'));db[_0x497e('0xe8')]=db[_0x497e('0x1')]['import'](_0x497e('0xe9'));db[_0x497e('0xea')]=db[_0x497e('0x1')]['import'](_0x497e('0xeb'));db[_0x497e('0xec')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xed'));db[_0x497e('0xee')]=db['sequelize'][_0x497e('0x13')]('../api/squareRecording/squareRecording.model');db[_0x497e('0xef')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xf0'));db[_0x497e('0xf1')]=db['sequelize'][_0x497e('0x13')](_0x497e('0xf2'));db[_0x497e('0xf3')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xf4'));db[_0x497e('0xf5')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xf6'));db['Migration']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/migration/migration.model');db[_0x497e('0xf7')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xf8'));db[_0x497e('0xf9')]=db[_0x497e('0x1')]['import']('../api/plugin/plugin.model');db[_0x497e('0xfa')]=db[_0x497e('0x1')]['import'](_0x497e('0xfb'));db['ChatTransferReport']=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xfc'));db[_0x497e('0xfd')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0xfe'));db[_0x497e('0xff')]=db['sequelize']['import'](_0x497e('0x100'));db[_0x497e('0x101')]=db[_0x497e('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x497e('0x102')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x103'));db[_0x497e('0x104')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0x497e('0x105')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x106'));db['UserProfileSection']=db['sequelize'][_0x497e('0x13')](_0x497e('0x107'));db[_0x497e('0x108')]=db['sequelize']['import'](_0x497e('0x109'));db[_0x497e('0x10a')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x10b'));db['WhatsappAccount']=db[_0x497e('0x1')]['import'](_0x497e('0x10c'));db[_0x497e('0x10d')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x10e'));db[_0x497e('0x10f')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x110'));db[_0x497e('0x111')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x112'));db[_0x497e('0x113')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x114'));db[_0x497e('0x115')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x116'));db[_0x497e('0x117')]=db[_0x497e('0x1')][_0x497e('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x497e('0x118')]=db[_0x497e('0x1')][_0x497e('0x13')](_0x497e('0x119'));db[_0x497e('0x11a')]=db['sequelize'][_0x497e('0x13')](_0x497e('0x11b'));db[_0x497e('0x11c')]=db['sequelize'][_0x497e('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x497e('0x11d')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db['MailInteractionHasTag']=db[_0x497e('0x1')][_0x497e('0x13')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x497e('0x12')]['hasOne'](db['VoiceMail'],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x497e('0x11e')});db['User'][_0x497e('0x11f')](db['UserSetting'],{'as':_0x497e('0x120'),'onDelete':'cascade','foreignKey':_0x497e('0x11e')});db['User'][_0x497e('0x121')](db[_0x497e('0x1e')],{'as':_0x497e('0x122'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')]['hasMany'](db[_0x497e('0x2d')],{'as':_0x497e('0x123'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')]['hasMany'](db[_0x497e('0x18')],{'as':_0x497e('0x124'),'onDelete':_0x497e('0x125'),'hooks':!![]});db['User'][_0x497e('0x121')](db['CmHopperFinal'],{'as':_0x497e('0x126'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')][_0x497e('0x121')](db[_0x497e('0x78')],{'as':_0x497e('0x127'),'foreignKey':'UserId'});db[_0x497e('0x12')][_0x497e('0x121')](db['ReportAgentPreview'],{'as':_0x497e('0x128'),'foreignKey':_0x497e('0x11e')});db['User']['hasMany'](db[_0x497e('0x129')],{'as':_0x497e('0x12a'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')]['hasMany'](db[_0x497e('0x68')],{'as':_0x497e('0x12b'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')][_0x497e('0x121')](db[_0x497e('0x57')],{'as':_0x497e('0x12c'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')][_0x497e('0x121')](db['FaxInteraction'],{'as':_0x497e('0x12d'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')]['hasMany'](db[_0x497e('0x12e')],{'as':_0x497e('0x12f'),'foreignKey':'UserId'});db[_0x497e('0x12')][_0x497e('0x121')](db[_0x497e('0x10f')],{'as':'WhatsappInteractions','foreignKey':_0x497e('0x11e')});db[_0x497e('0x12')]['hasMany'](db['UserNotification'],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0x497e('0x121')](db[_0x497e('0x130')],{'as':'Hoppers','foreignKey':_0x497e('0x11e'),'onDelete':'SET\x20NULL'});db[_0x497e('0x12')][_0x497e('0x131')](db[_0x497e('0x105')],{'as':_0x497e('0x105'),'foreignKey':'userProfileId'});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x6d')],{'as':_0x497e('0x133'),'through':'chat_group_has_users'});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x71')],{'as':'Contacts','through':_0x497e('0x134')});db['User'][_0x497e('0x132')](db[_0x497e('0x102')],{'as':_0x497e('0x135'),'through':_0x497e('0x136')});db[_0x497e('0x12')][_0x497e('0x132')](db['Team'],{'through':'user_has_teams'});db[_0x497e('0x12')][_0x497e('0x132')](db['MailInteraction'],{'as':'MailInteractions','through':_0x497e('0x137')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x68')],{'as':_0x497e('0x12b'),'through':_0x497e('0x138')});db[_0x497e('0x12')]['belongsToMany'](db[_0x497e('0x139')],{'as':_0x497e('0x12d'),'through':_0x497e('0x13a')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x57')],{'as':_0x497e('0x12c'),'through':_0x497e('0x13b')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x129')],{'as':'OpenchannelInteractions','through':_0x497e('0x13c')});db[_0x497e('0x12')]['belongsToMany'](db[_0x497e('0x10f')],{'as':_0x497e('0x13d'),'through':_0x497e('0x13e')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x1c')],{'as':'VoiceQueues','through':_0x497e('0x2f'),'required':![]});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x104')],{'as':'VoicePrefixes','through':_0x497e('0x13f'),'required':![]});db[_0x497e('0x12')][_0x497e('0x132')](db['MailQueue'],{'as':_0x497e('0x140'),'through':_0x497e('0x33'),'required':![]});db[_0x497e('0x12')]['belongsToMany'](db[_0x497e('0x6b')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x50')],{'as':'FaxQueues','through':_0x497e('0x34'),'required':![]});db['User'][_0x497e('0x132')](db[_0x497e('0x59')],{'as':_0x497e('0x141'),'through':_0x497e('0x36'),'required':![]});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x62')],{'as':_0x497e('0x142'),'through':_0x497e('0x37'),'required':![]});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x117')],{'as':_0x497e('0x143'),'through':_0x497e('0x39'),'required':![]});db['User'][_0x497e('0x132')](db[_0x497e('0x102')],{'through':_0x497e('0x136')});db[_0x497e('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x497e('0x144')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x145')],{'as':_0x497e('0x146'),'through':'user_has_fax_accounts'});db['User'][_0x497e('0x132')](db[_0x497e('0x147')],{'as':'MailAccounts','through':_0x497e('0x148')});db[_0x497e('0x12')][_0x497e('0x132')](db[_0x497e('0x5b')],{'as':'OpenchannelAccounts','through':_0x497e('0x149')});db[_0x497e('0x12')][_0x497e('0x132')](db['SmsAccount'],{'as':_0x497e('0x14a'),'through':_0x497e('0x14b')});db[_0x497e('0x12')]['belongsToMany'](db[_0x497e('0x14c')],{'as':_0x497e('0x14d'),'through':_0x497e('0x14e')});db[_0x497e('0x15')][_0x497e('0x121')](db[_0x497e('0x18')],{'as':_0x497e('0x14f'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x150')});db['VoiceContext'][_0x497e('0x121')](db[_0x497e('0x18')],{'onDelete':'cascade'});db[_0x497e('0x18')][_0x497e('0x121')](db[_0x497e('0x18')],{'as':_0x497e('0x151'),'onDelete':_0x497e('0x125')});db['VoiceMusicOnHold'][_0x497e('0x132')](db[_0x497e('0x8b')],{'as':'Sounds','through':_0x497e('0x152')});db[_0x497e('0x1c')]['hasMany'](db[_0x497e('0x2d')],{'as':_0x497e('0x153'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')][_0x497e('0x121')](db[_0x497e('0x130')],{'as':_0x497e('0x155'),'foreignKey':'VoiceQueueId'});db[_0x497e('0x1c')][_0x497e('0x121')](db['CmHopperFinal'],{'as':_0x497e('0x126'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')][_0x497e('0x121')](db[_0x497e('0x78')],{'as':_0x497e('0x156'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')]['hasMany'](db[_0x497e('0x128')],{'as':_0x497e('0x128'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')][_0x497e('0x121')](db[_0x497e('0x74')],{'as':_0x497e('0x157'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')][_0x497e('0x121')](db[_0x497e('0xe2')],{'as':_0x497e('0x158'),'foreignKey':_0x497e('0x154')});db[_0x497e('0x1c')]['belongsTo'](db[_0x497e('0x159')],{'as':_0x497e('0x159'),'foreignKey':_0x497e('0x15a')});db['VoiceQueue'][_0x497e('0x131')](db[_0x497e('0x159')],{'as':_0x497e('0x15b'),'foreignKey':_0x497e('0x15c')});db['VoiceQueue'][_0x497e('0x131')](db[_0x497e('0x83')],{'as':_0x497e('0x83'),'foreignKey':_0x497e('0x15d')});db[_0x497e('0x1c')]['belongsTo'](db[_0x497e('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0x497e('0x102')],{'as':_0x497e('0x135'),'through':_0x497e('0x15e')});db['VoiceQueue'][_0x497e('0x132')](db[_0x497e('0x12')],{'as':_0x497e('0x15f'),'through':'UserVoiceQueue'});db[_0x497e('0x1c')][_0x497e('0x132')](db[_0x497e('0xf1')],{'as':_0x497e('0x160'),'through':_0x497e('0x11a')});db[_0x497e('0x1c')][_0x497e('0x132')](db['CmList'],{'as':_0x497e('0x161'),'through':_0x497e('0x162')});db[_0x497e('0x1e')][_0x497e('0x131')](db['User'],{'as':'User','foreignKey':_0x497e('0x11e')});db[_0x497e('0x20')][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x12'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x163')][_0x497e('0x121')](db[_0x497e('0x22')],{'as':'Messages','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x164'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x497e('0x131')](db[_0x497e('0x163')],{'foreignKey':_0x497e('0x164'),'targetKey':_0x497e('0x165')});db['VoiceCallReport']['hasMany'](db[_0x497e('0x27')],{'as':_0x497e('0x166'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x497e('0x121')](db[_0x497e('0x26')],{'as':'AgentReports','foreignKey':_0x497e('0x167'),'constraints':![]});db[_0x497e('0x168')][_0x497e('0x131')](db[_0x497e('0x12')],{'as':'User','foreignKey':_0x497e('0x11e')});db['VoiceCallReport'][_0x497e('0x131')](db['CmContact'],{'as':_0x497e('0x169'),'foreignKey':'ContactId'});db[_0x497e('0x3b')][_0x497e('0x131')](db[_0x497e('0x147')],{'as':_0x497e('0x147'),'foreignKey':'MailAccountId'});db[_0x497e('0x3b')]['belongsTo'](db['CloudProvider'],{'as':_0x497e('0x118'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x497e('0x16a')]['belongsTo'](db[_0x497e('0x147')],{'as':_0x497e('0x147'),'foreignKey':'MailAccountId'});db[_0x497e('0x16a')][_0x497e('0x131')](db[_0x497e('0x118')],{'as':_0x497e('0x118'),'foreignKey':_0x497e('0x16b'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x147')]['hasOne'](db[_0x497e('0x3b')],{'as':_0x497e('0x16d'),'onDelete':_0x497e('0x125')});db['MailAccount'][_0x497e('0x11f')](db[_0x497e('0x16a')],{'as':_0x497e('0x16e'),'onDelete':_0x497e('0x125')});db['MailAccount'][_0x497e('0x121')](db[_0x497e('0x81')],{'as':_0x497e('0x16f'),'foreignKey':_0x497e('0x170'),'onDelete':_0x497e('0x125')});db[_0x497e('0x147')][_0x497e('0x121')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x497e('0x170')});db[_0x497e('0x147')][_0x497e('0x121')](db['MailMessage'],{'as':_0x497e('0x171'),'foreignKey':_0x497e('0x170')});db[_0x497e('0x147')]['hasMany'](db[_0x497e('0x12e')],{'as':_0x497e('0x172')});db[_0x497e('0x147')][_0x497e('0x121')](db[_0x497e('0x45')],{'as':_0x497e('0x151'),'foreignKey':_0x497e('0x170'),'onDelete':_0x497e('0x125')});db['MailAccount']['belongsTo'](db['CmList'],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x147')][_0x497e('0x131')](db[_0x497e('0x95')],{'as':_0x497e('0x95'),'foreignKey':_0x497e('0x175')});db['MailAccount'][_0x497e('0x131')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x497e('0x176')});db[_0x497e('0x147')][_0x497e('0x132')](db['User'],{'as':'Agents','through':_0x497e('0x148')});db[_0x497e('0x3e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x497e('0x33')});db['MailQueue']['belongsToMany'](db[_0x497e('0xf1')],{'through':_0x497e('0x177'),'as':_0x497e('0x160')});db[_0x497e('0x12e')][_0x497e('0x121')](db[_0x497e('0x43')],{'as':_0x497e('0x171'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x178')});db[_0x497e('0x12e')][_0x497e('0x131')](db['MailAccount'],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x170')});db['MailInteraction'][_0x497e('0x131')](db[_0x497e('0x71')],{'as':'Contact','foreignKey':_0x497e('0x17a')});db['MailInteraction'][_0x497e('0x131')](db['User'],{'as':_0x497e('0x17b'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x12e')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x17c'),'as':_0x497e('0x17d')});db['MailInteraction'][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x17c'),'as':'ThroughTags'});db[_0x497e('0x12e')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x497e('0x178')});db[_0x497e('0x43')][_0x497e('0x121')](db['Attachment'],{'as':_0x497e('0x17e'),'onDelete':'cascade'});db[_0x497e('0x43')]['belongsTo'](db['User'],{'as':_0x497e('0x12')});db[_0x497e('0x43')]['belongsTo'](db[_0x497e('0x71')],{'onDelete':'cascade','as':_0x497e('0x169')});db[_0x497e('0x43')][_0x497e('0x131')](db[_0x497e('0x12e')],{'as':_0x497e('0x17f'),'foreignKey':_0x497e('0x178')});db[_0x497e('0x43')][_0x497e('0x131')](db['MailAccount'],{'as':_0x497e('0x179'),'foreignKey':'MailAccountId'});db[_0x497e('0x43')][_0x497e('0x131')](db[_0x497e('0x63')],{'as':_0x497e('0x63'),'foreignKey':_0x497e('0x180')});db['MailMessage']['belongsTo'](db[_0x497e('0x181')],{'as':_0x497e('0x181'),'foreignKey':_0x497e('0x182')});db[_0x497e('0x45')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x497e('0x45')][_0x497e('0x131')](db[_0x497e('0x3e')],{'onDelete':'restrict'});db['MailApplication'][_0x497e('0x131')](db[_0x497e('0x147')],{'onDelete':'restrict'});db[_0x497e('0x45')]['belongsTo'](db['Interval'],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x15d')});db[_0x497e('0x45')]['belongsTo'](db[_0x497e('0x8d')],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x183')});db[_0x497e('0x184')][_0x497e('0x131')](db[_0x497e('0x147')],{});db[_0x497e('0x184')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x184')][_0x497e('0x131')](db['CmContact'],{'as':_0x497e('0x169'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x497e('0x131')](db[_0x497e('0x12e')],{});db[_0x497e('0x184')][_0x497e('0x131')](db[_0x497e('0x43')],{});db[_0x497e('0x184')]['belongsTo'](db[_0x497e('0x12')],{});db[_0x497e('0x184')]['belongsTo'](db[_0x497e('0x3e')],{});db['Dashboard'][_0x497e('0x121')](db[_0x497e('0x49')],{'as':_0x497e('0x185'),'onDelete':'cascade'});db[_0x497e('0x145')][_0x497e('0x121')](db['Disposition'],{'as':_0x497e('0x16f'),'foreignKey':'FaxAccountId','onDelete':_0x497e('0x125')});db[_0x497e('0x145')][_0x497e('0x121')](db['CannedAnswer'],{'as':_0x497e('0x186'),'foreignKey':_0x497e('0x187')});db[_0x497e('0x145')][_0x497e('0x121')](db[_0x497e('0x139')],{'as':_0x497e('0x172')});db[_0x497e('0x145')]['hasMany'](db[_0x497e('0x188')],{'as':'Applications','foreignKey':_0x497e('0x187'),'onDelete':_0x497e('0x125')});db[_0x497e('0x145')][_0x497e('0x121')](db[_0x497e('0x18')],{'as':_0x497e('0x189'),'onDelete':_0x497e('0x125')});db[_0x497e('0x145')][_0x497e('0x121')](db[_0x497e('0x4e')],{'as':_0x497e('0x171')});db[_0x497e('0x145')][_0x497e('0x131')](db[_0x497e('0x159')],{'as':_0x497e('0x159')});db['FaxAccount']['belongsTo'](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db['FaxAccount'][_0x497e('0x131')](db['Pause'],{'as':_0x497e('0x18a'),'foreignKey':_0x497e('0x176')});db['FaxAccount'][_0x497e('0x132')](db[_0x497e('0x12')],{'as':'Agents','through':_0x497e('0x18b')});db[_0x497e('0x188')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x188')]['belongsTo'](db[_0x497e('0x50')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x188')][_0x497e('0x131')](db['FaxAccount'],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x188')]['belongsTo'](db[_0x497e('0x8d')],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x183')});db['FaxInteraction'][_0x497e('0x121')](db[_0x497e('0x4e')],{'as':'Messages','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x18c')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x187')});db[_0x497e('0x139')][_0x497e('0x131')](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x139')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x497e('0x11e')});db['FaxInteraction'][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x497e('0x139')]['belongsToMany'](db[_0x497e('0x8d')],{'through':_0x497e('0x18d'),'as':'ThroughTags'});db[_0x497e('0x139')][_0x497e('0x132')](db['User'],{'as':_0x497e('0x18e'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x497e('0x4e')]['belongsTo'](db[_0x497e('0x12')],{'onDelete':'cascade','as':'User'});db[_0x497e('0x4e')][_0x497e('0x131')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x497e('0x131')](db[_0x497e('0x71')],{'onDelete':_0x497e('0x125'),'as':_0x497e('0x169')});db['FaxMessage'][_0x497e('0x131')](db['Attachment'],{'as':_0x497e('0xf7'),'foreignKey':'AttachmentId'});db[_0x497e('0x4e')][_0x497e('0x131')](db[_0x497e('0x145')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x187')});db[_0x497e('0x50')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':_0x497e('0x15f'),'through':'UserFaxQueue'});db[_0x497e('0x50')][_0x497e('0x132')](db[_0x497e('0xf1')],{'through':_0x497e('0x18f'),'as':_0x497e('0x160')});db[_0x497e('0x52')]['belongsTo'](db[_0x497e('0x145')],{});db[_0x497e('0x52')]['belongsTo'](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db['FaxQueueReport'][_0x497e('0x131')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x497e('0x52')][_0x497e('0x131')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x497e('0x131')](db[_0x497e('0x4e')],{});db[_0x497e('0x52')][_0x497e('0x131')](db[_0x497e('0x12')],{});db[_0x497e('0x52')][_0x497e('0x131')](db[_0x497e('0x50')],{});db['SmsAccount']['hasMany'](db[_0x497e('0x81')],{'as':'Dispositions','foreignKey':_0x497e('0x190'),'onDelete':'cascade'});db['SmsAccount'][_0x497e('0x121')](db[_0x497e('0x7f')],{'as':_0x497e('0x186'),'foreignKey':_0x497e('0x190')});db[_0x497e('0x54')][_0x497e('0x121')](db[_0x497e('0x58')],{'as':'Messages','foreignKey':_0x497e('0x190')});db['SmsAccount'][_0x497e('0x121')](db[_0x497e('0x57')],{'as':_0x497e('0x172')});db[_0x497e('0x54')][_0x497e('0x121')](db[_0x497e('0x191')],{'as':'Applications','foreignKey':_0x497e('0x190'),'onDelete':_0x497e('0x125')});db[_0x497e('0x54')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x54')]['belongsTo'](db[_0x497e('0x85')],{'as':_0x497e('0x18a'),'foreignKey':_0x497e('0x176')});db[_0x497e('0x54')]['belongsToMany'](db['User'],{'as':_0x497e('0x15f'),'through':_0x497e('0x14b')});db[_0x497e('0x191')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':'restrict'});db[_0x497e('0x191')][_0x497e('0x131')](db[_0x497e('0x59')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x191')][_0x497e('0x131')](db[_0x497e('0x54')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x191')][_0x497e('0x131')](db[_0x497e('0x83')],{'onDelete':_0x497e('0x16c'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x497e('0x131')](db[_0x497e('0x8d')],{'onDelete':'restrict','foreignKey':_0x497e('0x183')});db['SmsInteraction'][_0x497e('0x121')](db[_0x497e('0x58')],{'as':_0x497e('0x171'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x192')});db[_0x497e('0x57')][_0x497e('0x131')](db[_0x497e('0x54')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x190')});db[_0x497e('0x57')][_0x497e('0x131')](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x57')][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x17b'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x57')]['belongsToMany'](db[_0x497e('0x8d')],{'through':_0x497e('0x193'),'as':_0x497e('0x17d')});db['SmsInteraction'][_0x497e('0x132')](db['Tag'],{'through':_0x497e('0x193'),'as':_0x497e('0x194')});db[_0x497e('0x57')]['belongsToMany'](db['User'],{'as':_0x497e('0x18e'),'through':_0x497e('0x13b'),'foreignKey':_0x497e('0x192')});db[_0x497e('0x58')][_0x497e('0x131')](db['User'],{'as':_0x497e('0x12')});db[_0x497e('0x58')]['belongsTo'](db[_0x497e('0x71')],{'onDelete':_0x497e('0x125'),'as':_0x497e('0x169')});db[_0x497e('0x58')][_0x497e('0x131')](db[_0x497e('0x57')],{'onDelete':_0x497e('0x125'),'as':'Interaction','foreignKey':_0x497e('0x192')});db[_0x497e('0x58')]['belongsTo'](db[_0x497e('0x54')],{'as':_0x497e('0x179'),'foreignKey':'SmsAccountId'});db[_0x497e('0x59')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':_0x497e('0x15f'),'through':_0x497e('0x36'),'foreignKey':_0x497e('0x195')});db[_0x497e('0x59')]['belongsToMany'](db[_0x497e('0xf1')],{'through':_0x497e('0x196'),'as':_0x497e('0x160')});db[_0x497e('0x5b')][_0x497e('0x121')](db[_0x497e('0x81')],{'as':_0x497e('0x16f'),'foreignKey':_0x497e('0x197'),'onDelete':_0x497e('0x125')});db[_0x497e('0x5b')][_0x497e('0x121')](db[_0x497e('0x7f')],{'as':_0x497e('0x186'),'foreignKey':_0x497e('0x197')});db[_0x497e('0x5b')][_0x497e('0x121')](db[_0x497e('0x129')],{'as':_0x497e('0x172'),'foreignKey':_0x497e('0x197')});db[_0x497e('0x5b')][_0x497e('0x121')](db['OpenchannelMessage'],{'as':_0x497e('0x171'),'foreignKey':_0x497e('0x197')});db[_0x497e('0x5b')]['hasMany'](db[_0x497e('0x5d')],{'as':_0x497e('0x151'),'foreignKey':'OpenchannelAccountId','onDelete':_0x497e('0x125')});db[_0x497e('0x5b')]['belongsTo'](db[_0x497e('0x102')],{'as':'List','foreignKey':_0x497e('0x174')});db[_0x497e('0x5b')][_0x497e('0x131')](db[_0x497e('0x85')],{'as':_0x497e('0x18a'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':_0x497e('0x15f'),'through':_0x497e('0x149')});db[_0x497e('0x5d')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':_0x497e('0x16c')});db['OpenchannelApplication'][_0x497e('0x131')](db[_0x497e('0x62')],{'onDelete':_0x497e('0x16c'),'foreignKey':'OpenchannelQueueId'});db[_0x497e('0x5d')][_0x497e('0x131')](db[_0x497e('0x5b')],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x197')});db['OpenchannelApplication']['belongsTo'](db[_0x497e('0x83')],{'onDelete':'restrict','foreignKey':_0x497e('0x15d')});db[_0x497e('0x5d')][_0x497e('0x131')](db[_0x497e('0x8d')],{'onDelete':'restrict','foreignKey':_0x497e('0x183')});db['OpenchannelInteraction'][_0x497e('0x121')](db[_0x497e('0x60')],{'as':_0x497e('0x171'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x198')});db[_0x497e('0x129')][_0x497e('0x131')](db[_0x497e('0x5b')],{'as':_0x497e('0x179'),'foreignKey':'OpenchannelAccountId'});db[_0x497e('0x129')][_0x497e('0x131')](db[_0x497e('0x71')],{'as':'Contact','foreignKey':_0x497e('0x17a')});db[_0x497e('0x129')][_0x497e('0x131')](db['User'],{'as':_0x497e('0x17b'),'foreignKey':'UserId'});db[_0x497e('0x129')]['belongsToMany'](db[_0x497e('0x8d')],{'through':_0x497e('0x199'),'as':_0x497e('0x17d')});db[_0x497e('0x129')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x199'),'as':_0x497e('0x194')});db[_0x497e('0x129')]['belongsToMany'](db[_0x497e('0x12')],{'as':'Users','through':_0x497e('0x13c'),'foreignKey':'OpenchannelInteractionId'});db[_0x497e('0x60')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':'cascade','as':'User'});db[_0x497e('0x60')][_0x497e('0x131')](db[_0x497e('0x71')],{'onDelete':'cascade','as':_0x497e('0x169')});db[_0x497e('0x60')]['belongsTo'](db[_0x497e('0x129')],{'onDelete':_0x497e('0x125'),'as':'Interaction','foreignKey':_0x497e('0x198')});db['OpenchannelMessage'][_0x497e('0x131')](db[_0x497e('0xf7')],{'as':_0x497e('0xf7'),'foreignKey':_0x497e('0x19a')});db[_0x497e('0x60')][_0x497e('0x131')](db[_0x497e('0x5b')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x197')});db[_0x497e('0x62')][_0x497e('0x132')](db['User'],{'as':_0x497e('0x15f'),'through':_0x497e('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x497e('0x62')][_0x497e('0x132')](db['Team'],{'through':_0x497e('0x19b'),'as':_0x497e('0x160')});db[_0x497e('0x63')][_0x497e('0x121')](db[_0x497e('0x81')],{'as':_0x497e('0x16f'),'foreignKey':_0x497e('0x180'),'onDelete':_0x497e('0x125')});db[_0x497e('0x63')][_0x497e('0x121')](db[_0x497e('0x7f')],{'as':_0x497e('0x186'),'foreignKey':_0x497e('0x180')});db[_0x497e('0x63')][_0x497e('0x121')](db[_0x497e('0x19c')],{'as':'ProactiveActions'});db[_0x497e('0x63')][_0x497e('0x121')](db['ChatInteraction'],{'as':_0x497e('0x172')});db[_0x497e('0x63')][_0x497e('0x121')](db[_0x497e('0x66')],{'as':_0x497e('0x151'),'foreignKey':_0x497e('0x180'),'onDelete':_0x497e('0x125')});db[_0x497e('0x63')][_0x497e('0x121')](db['ChatMessage'],{'as':_0x497e('0x171')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x63')][_0x497e('0x131')](db[_0x497e('0x83')],{'as':_0x497e('0x83'),'foreignKey':'IntervalId'});db[_0x497e('0x63')][_0x497e('0x131')](db[_0x497e('0x147')],{'as':_0x497e('0x147'),'foreignKey':'MailAccountId'});db[_0x497e('0x63')][_0x497e('0x131')](db['Pause'],{'as':_0x497e('0x18a'),'foreignKey':_0x497e('0x176')});db[_0x497e('0x63')][_0x497e('0x132')](db['User'],{'as':_0x497e('0x15f'),'through':_0x497e('0x144')});db[_0x497e('0x19d')][_0x497e('0x131')](db[_0x497e('0x5b')],{});db[_0x497e('0x19d')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x19d')][_0x497e('0x131')](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db['OpenchannelQueueReport']['belongsTo'](db[_0x497e('0x129')],{});db['OpenchannelQueueReport'][_0x497e('0x131')](db[_0x497e('0x60')],{});db[_0x497e('0x19d')][_0x497e('0x131')](db[_0x497e('0x12')],{});db[_0x497e('0x19d')][_0x497e('0x131')](db[_0x497e('0x62')],{});db[_0x497e('0x66')][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x19e'),'foreignKey':_0x497e('0x11e'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x66')][_0x497e('0x131')](db[_0x497e('0x6b')],{'as':_0x497e('0x19f'),'foreignKey':'ChatQueueId','onDelete':_0x497e('0x16c')});db[_0x497e('0x66')][_0x497e('0x131')](db[_0x497e('0x63')],{'as':_0x497e('0x1a0'),'foreignKey':_0x497e('0x180'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x66')][_0x497e('0x131')](db[_0x497e('0x8d')],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x183')});db['ChatInteraction'][_0x497e('0x121')](db[_0x497e('0x1a1')],{'as':_0x497e('0x171'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1a2')});db['ChatInteraction'][_0x497e('0x131')](db[_0x497e('0x63')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x180')});db[_0x497e('0x68')][_0x497e('0x131')](db['CmContact'],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x68')]['belongsTo'](db[_0x497e('0x12')],{'as':_0x497e('0x17b'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x68')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x1a3'),'as':_0x497e('0x17d')});db[_0x497e('0x68')]['belongsToMany'](db[_0x497e('0x8d')],{'through':'chat_interaction_has_tags','as':_0x497e('0x194')});db[_0x497e('0x68')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':_0x497e('0x18e'),'through':_0x497e('0x138'),'foreignKey':_0x497e('0x1a2')});db[_0x497e('0x1a1')][_0x497e('0x131')](db['User'],{'onDelete':_0x497e('0x125'),'as':'User'});db[_0x497e('0x1a1')][_0x497e('0x131')](db[_0x497e('0x71')],{'onDelete':_0x497e('0x125'),'as':'Contact','foreignKey':'ContactId'});db[_0x497e('0x1a1')][_0x497e('0x131')](db[_0x497e('0x68')],{'onDelete':'cascade','as':_0x497e('0x17f'),'foreignKey':_0x497e('0x1a2')});db[_0x497e('0x1a1')][_0x497e('0x131')](db[_0x497e('0xf7')],{'as':_0x497e('0xf7'),'foreignKey':_0x497e('0x19a')});db[_0x497e('0x1a1')][_0x497e('0x131')](db[_0x497e('0x63')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x180')});db[_0x497e('0x181')][_0x497e('0x121')](db[_0x497e('0xf7')],{'as':_0x497e('0x17e'),'foreignKey':_0x497e('0x182'),'onDelete':'cascade','hooks':!![]});db[_0x497e('0x181')][_0x497e('0x131')](db[_0x497e('0x71')],{'onDelete':_0x497e('0x125'),'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x181')]['belongsTo'](db[_0x497e('0x63')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x180')});db[_0x497e('0x6b')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':'Agents','through':_0x497e('0x31'),'hooks':!![]});db[_0x497e('0x6b')][_0x497e('0x132')](db[_0x497e('0xf1')],{'through':_0x497e('0x1a4'),'as':_0x497e('0x160')});db['ChatGroup'][_0x497e('0x121')](db[_0x497e('0xdd')],{'as':_0x497e('0x171'),'foreignKey':_0x497e('0x1a5'),'onDelete':'cascade'});db[_0x497e('0x6d')]['belongsToMany'](db[_0x497e('0x12')],{'as':_0x497e('0x153'),'through':_0x497e('0x1a6')});db[_0x497e('0x19c')]['belongsTo'](db['ChatWebsite'],{'as':_0x497e('0x1a0'),'foreignKey':_0x497e('0x180')});db['CmCompany'][_0x497e('0x121')](db['CmContact'],{'as':_0x497e('0x1a7'),'foreignKey':_0x497e('0x1a8')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x91')],{'as':_0x497e('0x1a9'),'foreignKey':'CmContactId'});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x130')],{'as':_0x497e('0x155'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x71')][_0x497e('0x121')](db['CmHopperFinal'],{'as':_0x497e('0x126'),'foreignKey':_0x497e('0x17a')});db['CmContact'][_0x497e('0x121')](db[_0x497e('0x78')],{'as':_0x497e('0x156'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x128')],{'as':_0x497e('0x128'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0xe2')],{'as':_0x497e('0x158'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x129')],{'as':_0x497e('0x12a'),'foreignKey':_0x497e('0x17a'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x68')],{'as':_0x497e('0x12b'),'foreignKey':_0x497e('0x17a'),'onDelete':_0x497e('0x16c')});db['CmContact'][_0x497e('0x121')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x497e('0x17a'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x71')][_0x497e('0x121')](db[_0x497e('0x139')],{'as':'FaxInteractions','foreignKey':_0x497e('0x17a'),'onDelete':'restrict'});db[_0x497e('0x71')][_0x497e('0x121')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x497e('0x17a'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x71')]['belongsTo'](db['CmCompany'],{'as':_0x497e('0x1aa'),'foreignKey':_0x497e('0x1a8')});db[_0x497e('0x71')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x497e('0x71')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':_0x497e('0x18e'),'through':'cm_user_has_contacts'});db[_0x497e('0x71')]['belongsToMany'](db['Tag'],{'as':_0x497e('0x17d'),'through':'cm_contact_has_tags'});db[_0x497e('0x71')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':'cm_contact_has_tags','as':_0x497e('0x194')});db[_0x497e('0x130')][_0x497e('0x121')](db['CmHopperAdditionalPhone'],{'as':_0x497e('0x1ab'),'foreignKey':'CmHopperId'});db[_0x497e('0x130')]['belongsTo'](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a'),'onDelete':'cascade'});db[_0x497e('0x130')][_0x497e('0x131')](db['CmList'],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174'),'onDelete':'cascade'});db[_0x497e('0x130')]['belongsTo'](db['User'],{'as':_0x497e('0x19e'),'foreignKey':_0x497e('0x11e')});db[_0x497e('0x130')][_0x497e('0x131')](db[_0x497e('0x1c')],{'as':_0x497e('0x19f'),'foreignKey':_0x497e('0x154'),'onDelete':'cascade'});db['CmHopper'][_0x497e('0x131')](db[_0x497e('0xf5')],{'as':'Campaign','foreignKey':_0x497e('0x1ac'),'onDelete':_0x497e('0x125')});db['CmHopper'][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x17b'),'foreignKey':_0x497e('0x1ad')});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a'),'onDelete':_0x497e('0x125')});db[_0x497e('0x74')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174'),'onDelete':_0x497e('0x125')});db[_0x497e('0x74')][_0x497e('0x131')](db[_0x497e('0x1c')],{'as':_0x497e('0x19f'),'foreignKey':'VoiceQueueId','onDelete':_0x497e('0x125')});db['CmHopperBlack']['belongsTo'](db[_0x497e('0xf5')],{'as':_0x497e('0xf5'),'foreignKey':_0x497e('0x1ac'),'onDelete':'cascade'});db[_0x497e('0x7d')]['hasMany'](db[_0x497e('0x1ae')],{'as':{'plural':'All','singular':_0x497e('0x1af')},'foreignKey':_0x497e('0x1b0'),'onDelete':_0x497e('0x125'),'hooks':!![]});db[_0x497e('0x7d')][_0x497e('0x121')](db['Condition'],{'as':{'plural':_0x497e('0x1b1'),'singular':_0x497e('0x1b2')},'foreignKey':_0x497e('0x1b3'),'onDelete':_0x497e('0x125'),'hooks':!![]});db['Automation'][_0x497e('0x121')](db[_0x497e('0x7c')],{'as':_0x497e('0x1b4'),'foreignKey':_0x497e('0x1b5'),'onDelete':_0x497e('0x125'),'hooks':!![]});db[_0x497e('0x81')][_0x497e('0x121')](db['Disposition'],{'as':_0x497e('0x16f'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x497e('0x83')][_0x497e('0x121')](db[_0x497e('0x83')],{'as':'Intervals','foreignKey':_0x497e('0x15d'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x497e('0x83')][_0x497e('0x121')](db[_0x497e('0x18')],{'as':_0x497e('0x124'),'foreignKey':_0x497e('0x15d'),'onDelete':'restrict'});db[_0x497e('0x83')][_0x497e('0x121')](db['MailApplication'],{'as':_0x497e('0x1b6'),'foreignKey':_0x497e('0x15d')});db['Interval'][_0x497e('0x121')](db[_0x497e('0x66')],{'as':'ChatApplications','foreignKey':_0x497e('0x15d')});db[_0x497e('0x83')][_0x497e('0x121')](db[_0x497e('0x188')],{'as':'FaxApplications','foreignKey':_0x497e('0x15d')});db[_0x497e('0x83')][_0x497e('0x121')](db[_0x497e('0x191')],{'as':'SmsApplications','foreignKey':_0x497e('0x15d')});db['Schedule'][_0x497e('0x131')](db[_0x497e('0x147')],{});db[_0x497e('0x89')][_0x497e('0x131')](db[_0x497e('0x1b7')],{'foreignKey':_0x497e('0x1b8')});db[_0x497e('0x89')][_0x497e('0x131')](db['AnalyticCustomReport'],{'foreignKey':_0x497e('0x1b9')});db[_0x497e('0x8b')]['belongsToMany'](db[_0x497e('0x1a')],{'as':'Mohs','through':_0x497e('0x152'),'onDelete':_0x497e('0x16c')});db['Tag'][_0x497e('0x132')](db[_0x497e('0x71')],{'through':'cm_contact_has_tags'});db[_0x497e('0x8d')][_0x497e('0x132')](db[_0x497e('0x68')],{'through':_0x497e('0x1a3')});db[_0x497e('0x8d')][_0x497e('0x132')](db[_0x497e('0x12e')],{'through':_0x497e('0x17c')});db[_0x497e('0x8d')]['belongsToMany'](db[_0x497e('0x57')],{'through':'sms_interaction_has_tags'});db[_0x497e('0x8d')][_0x497e('0x132')](db['FaxInteraction'],{'through':_0x497e('0x18d')});db['Tag'][_0x497e('0x132')](db[_0x497e('0x129')],{'through':_0x497e('0x199')});db['Tag'][_0x497e('0x132')](db[_0x497e('0x10f')],{'through':_0x497e('0x1ba')});db['CmContactHasItem'][_0x497e('0x131')](db[_0x497e('0x8f')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0x497e('0x93')][_0x497e('0x131')](db[_0x497e('0x130')],{'as':_0x497e('0x1bb'),'foreignKey':'CmHopperId'});db[_0x497e('0x91')][_0x497e('0x131')](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x1bc')});db[_0x497e('0x96')][_0x497e('0x121')](db[_0x497e('0x1ae')],{'as':{'plural':_0x497e('0x1bd'),'singular':_0x497e('0x1be')},'foreignKey':_0x497e('0x1bf'),'onDelete':_0x497e('0x125'),'hooks':!![]});db['Trigger'][_0x497e('0x121')](db[_0x497e('0x1ae')],{'as':{'plural':_0x497e('0x1c0'),'singular':_0x497e('0x1c1')},'foreignKey':_0x497e('0x1c2'),'onDelete':'cascade','hooks':!![]});db[_0x497e('0x96')][_0x497e('0x121')](db[_0x497e('0x7c')],{'as':_0x497e('0x1b4'),'foreignKey':_0x497e('0x1c3'),'onDelete':_0x497e('0x125'),'hooks':!![]});db['AnalyticCustomReport'][_0x497e('0x121')](db[_0x497e('0xa2')],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x497e('0x1b7')][_0x497e('0x121')](db['AnalyticFieldReport'],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':'DefaultReportId'});db[_0x497e('0xa1')][_0x497e('0x121')](db[_0x497e('0xa2')],{'as':_0x497e('0x1c4'),'onDelete':'cascade','foreignKey':_0x497e('0x1c5')});db[_0x497e('0xa2')][_0x497e('0x131')](db[_0x497e('0xa1')],{'foreignKey':_0x497e('0x1c5')});db['SalesforceAccount']['hasMany'](db[_0x497e('0xa8')],{'as':_0x497e('0x1c6'),'onDelete':'cascade','foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x497e('0x1c7'),'onDelete':_0x497e('0x125'),'foreignKey':'SubjectId'});db[_0x497e('0xa8')][_0x497e('0x121')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c8')});db['SalesforceConfiguration'][_0x497e('0x121')](db['SalesforceField'],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c9')});db['SalesforceConfiguration'][_0x497e('0x131')](db[_0x497e('0xa6')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xaa')][_0x497e('0x121')](db[_0x497e('0xaa')],{'as':'Subject','foreignKey':_0x497e('0x1cb')});db['SalesforceField'][_0x497e('0x121')](db[_0x497e('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x497e('0xaa')][_0x497e('0x121')](db[_0x497e('0xaa')],{'as':'Field','foreignKey':_0x497e('0x1c9')});db['SalesforceField'][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':'Variable','foreignKey':'VariableId'});db[_0x497e('0xac')][_0x497e('0x121')](db[_0x497e('0xae')],{'as':_0x497e('0x1c6'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xae')][_0x497e('0x121')](db['SugarcrmField'],{'as':_0x497e('0x1c7'),'onDelete':_0x497e('0x125'),'foreignKey':'SubjectId'});db[_0x497e('0xae')]['hasMany'](db['SugarcrmField'],{'as':_0x497e('0x1cd'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xae')][_0x497e('0x121')](db['SugarcrmField'],{'as':_0x497e('0x1c4'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x497e('0xae')][_0x497e('0x131')](db[_0x497e('0xac')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0x1ce')][_0x497e('0x121')](db['SugarcrmField'],{'as':_0x497e('0x1cf'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0x1ce')]['hasMany'](db[_0x497e('0x1ce')],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0x1ce')]['hasMany'](db['SugarcrmField'],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0x1ce')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':_0x497e('0x1cc'),'foreignKey':'VariableId'});db[_0x497e('0xb0')]['hasMany'](db[_0x497e('0xb2')],{'as':_0x497e('0x1c6'),'onDelete':'cascade','foreignKey':_0x497e('0x1ca')});db[_0x497e('0xb2')]['hasMany'](db[_0x497e('0xb4')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x497e('0x1cb')});db[_0x497e('0xb2')]['hasMany'](db['DeskField'],{'as':_0x497e('0x1cd'),'onDelete':'cascade','foreignKey':_0x497e('0x1c8')});db[_0x497e('0xb2')]['hasMany'](db[_0x497e('0xb4')],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c9')});db['DeskConfiguration']['belongsTo'](db[_0x497e('0xb0')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xb2')]['belongsToMany'](db[_0x497e('0x8d')],{'through':'int_desk_configuration_has_tags'});db[_0x497e('0xb4')]['hasMany'](db['DeskField'],{'as':_0x497e('0x1cf'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xb4')][_0x497e('0x121')](db[_0x497e('0xb4')],{'as':'Description','foreignKey':_0x497e('0x1c8')});db['DeskField'][_0x497e('0x121')](db[_0x497e('0xb4')],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xb4')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':'Variable','foreignKey':_0x497e('0x1d2')});db[_0x497e('0xb5')][_0x497e('0x121')](db[_0x497e('0x1d3')],{'as':_0x497e('0x1c6'),'onDelete':_0x497e('0x125'),'foreignKey':'AccountId'});db[_0x497e('0x1d3')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x497e('0x1cb')});db[_0x497e('0x1d3')][_0x497e('0x121')](db[_0x497e('0xb7')],{'as':_0x497e('0x1cd'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c8')});db['ZohoConfiguration']['hasMany'](db[_0x497e('0xb7')],{'as':'Fields','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0x1d3')][_0x497e('0x131')](db[_0x497e('0xb5')],{'as':_0x497e('0x179'),'foreignKey':'AccountId'});db[_0x497e('0xb7')][_0x497e('0x121')](db['ZohoField'],{'as':_0x497e('0x1cf'),'foreignKey':'SubjectId'});db['ZohoField'][_0x497e('0x121')](db[_0x497e('0xb7')],{'as':_0x497e('0x1d0'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xb7')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':'Variable','foreignKey':'VariableId'});db[_0x497e('0xb9')][_0x497e('0x121')](db[_0x497e('0xbb')],{'as':_0x497e('0x1c6'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xbb')][_0x497e('0x121')](db[_0x497e('0xbc')],{'as':'Subjects','foreignKey':_0x497e('0x1cb')});db[_0x497e('0xbb')]['hasMany'](db[_0x497e('0xbc')],{'as':_0x497e('0x1cd'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xbb')][_0x497e('0x121')](db[_0x497e('0xbc')],{'as':_0x497e('0x1c4'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x497e('0x131')](db[_0x497e('0xb9')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xbb')][_0x497e('0x132')](db['Tag'],{'through':_0x497e('0x1d4')});db[_0x497e('0xbc')][_0x497e('0x121')](db[_0x497e('0xbc')],{'as':_0x497e('0x1cf'),'foreignKey':'SubjectId'});db[_0x497e('0xbc')][_0x497e('0x121')](db[_0x497e('0xbc')],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xbc')][_0x497e('0x121')](db[_0x497e('0xbc')],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xbc')][_0x497e('0x131')](db['Variable'],{'as':_0x497e('0x1cc'),'foreignKey':'VariableId'});db[_0x497e('0xbe')][_0x497e('0x121')](db[_0x497e('0xc0')],{'as':_0x497e('0x1c6'),'onDelete':'cascade','foreignKey':_0x497e('0x1ca')});db[_0x497e('0xc0')][_0x497e('0x121')](db[_0x497e('0xc2')],{'as':_0x497e('0x1c7'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xc0')][_0x497e('0x121')](db[_0x497e('0xc2')],{'as':_0x497e('0x1cd'),'onDelete':'cascade','foreignKey':_0x497e('0x1c8')});db[_0x497e('0xc0')][_0x497e('0x121')](db[_0x497e('0xc2')],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c9')});db['FreshdeskConfiguration'][_0x497e('0x131')](db[_0x497e('0xbe')],{'as':_0x497e('0x179'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x1d5')});db[_0x497e('0xc2')][_0x497e('0x121')](db[_0x497e('0xc2')],{'as':_0x497e('0x1cf'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x497e('0x121')](db[_0x497e('0xc2')],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db['FreshdeskField'][_0x497e('0x121')](db['FreshdeskField'],{'as':_0x497e('0x1d1'),'foreignKey':'FieldId'});db[_0x497e('0xc2')][_0x497e('0x131')](db['Variable'],{'as':_0x497e('0x1cc'),'foreignKey':_0x497e('0x1d2')});db['VtigerAccount'][_0x497e('0x121')](db[_0x497e('0x1d6')],{'as':_0x497e('0x1c6'),'onDelete':'cascade','foreignKey':_0x497e('0x1ca')});db[_0x497e('0x1d6')][_0x497e('0x121')](db[_0x497e('0xc6')],{'as':_0x497e('0x1c7'),'foreignKey':'SubjectId'});db[_0x497e('0x1d6')][_0x497e('0x121')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x497e('0x1c8')});db['VtigerConfiguration']['hasMany'](db[_0x497e('0xc6')],{'as':_0x497e('0x1c4'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0x1d6')]['belongsTo'](db['VtigerAccount'],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db['VtigerField'][_0x497e('0x121')](db[_0x497e('0xc6')],{'as':_0x497e('0x1cf'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xc6')][_0x497e('0x121')](db[_0x497e('0xc6')],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xc6')][_0x497e('0x121')](db[_0x497e('0xc6')],{'as':'Field','foreignKey':'FieldId'});db[_0x497e('0xc6')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':_0x497e('0x1cc'),'foreignKey':'VariableId'});db[_0x497e('0xc8')][_0x497e('0x121')](db[_0x497e('0xca')],{'as':_0x497e('0x1c6'),'onDelete':_0x497e('0x125'),'foreignKey':'AccountId'});db[_0x497e('0xca')]['hasMany'](db[_0x497e('0xcc')],{'as':_0x497e('0x1c7'),'foreignKey':'SubjectId'});db[_0x497e('0xca')][_0x497e('0x121')](db[_0x497e('0xcc')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x497e('0xca')][_0x497e('0x121')](db[_0x497e('0xcc')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x497e('0x131')](db['ServicenowAccount'],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xcc')][_0x497e('0x121')](db['ServicenowField'],{'as':_0x497e('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x497e('0x121')](db['ServicenowField'],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xcc')]['hasMany'](db[_0x497e('0xcc')],{'as':'Field','foreignKey':_0x497e('0x1c9')});db['ServicenowField']['belongsTo'](db[_0x497e('0x1cc')],{'as':_0x497e('0x1cc'),'foreignKey':_0x497e('0x1d2')});db['Dynamics365Account'][_0x497e('0x121')](db[_0x497e('0xd0')],{'as':'Configurations','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xce')][_0x497e('0x131')](db['CloudProvider'],{'as':_0x497e('0x118'),'foreignKey':'CloudProviderId'});db[_0x497e('0xd0')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1c7'),'onDelete':'cascade','foreignKey':_0x497e('0x1cb')});db[_0x497e('0xd0')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1cd'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xd0')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1c4'),'onDelete':_0x497e('0x125'),'foreignKey':'FieldId'});db[_0x497e('0xd0')]['belongsTo'](db[_0x497e('0xce')],{'as':'Account','foreignKey':_0x497e('0x1ca')});db[_0x497e('0xd2')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1cf'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xd2')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1d0'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xd2')][_0x497e('0x121')](db[_0x497e('0xd2')],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xd2')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':_0x497e('0x1cc'),'foreignKey':_0x497e('0x1d2')});db[_0x497e('0xd3')][_0x497e('0x121')](db[_0x497e('0xd5')],{'as':_0x497e('0x1c6'),'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xd5')][_0x497e('0x121')](db[_0x497e('0xd7')],{'as':_0x497e('0x1c7'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xd5')][_0x497e('0x121')](db[_0x497e('0xd7')],{'as':_0x497e('0x1cd'),'foreignKey':_0x497e('0x1c8')});db[_0x497e('0xd5')]['hasMany'](db[_0x497e('0xd7')],{'as':_0x497e('0x1c4'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xd5')][_0x497e('0x131')](db[_0x497e('0xd3')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1ca')});db[_0x497e('0xd7')]['hasMany'](db[_0x497e('0xd7')],{'as':_0x497e('0x1cf'),'foreignKey':_0x497e('0x1cb')});db[_0x497e('0xd7')][_0x497e('0x121')](db['FreshsalesField'],{'as':_0x497e('0x1d0'),'foreignKey':'DescriptionId'});db[_0x497e('0xd7')][_0x497e('0x121')](db['FreshsalesField'],{'as':_0x497e('0x1d1'),'foreignKey':_0x497e('0x1c9')});db[_0x497e('0xd7')][_0x497e('0x131')](db[_0x497e('0x1cc')],{'as':_0x497e('0x1cc'),'foreignKey':_0x497e('0x1d2')});db[_0x497e('0xdb')][_0x497e('0x131')](db['ChatWebsite'],{});db[_0x497e('0xdb')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':'List','foreignKey':_0x497e('0x174')});db['ChatQueueReport']['belongsTo'](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db['ChatQueueReport']['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport'][_0x497e('0x131')](db[_0x497e('0x1a1')],{});db[_0x497e('0xdb')][_0x497e('0x131')](db[_0x497e('0x12')],{});db['ChatQueueReport'][_0x497e('0x131')](db[_0x497e('0x6b')],{});db[_0x497e('0xdd')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1d7')});db[_0x497e('0xdd')][_0x497e('0x131')](db[_0x497e('0x12')],{'onDelete':'cascade','foreignKey':_0x497e('0x1d8')});db['JscriptySessionReport'][_0x497e('0x121')](db[_0x497e('0x1d9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x497e('0xe2')]['hasMany'](db[_0x497e('0xdf')],{'foreignKey':_0x497e('0x1da'),'onDelete':_0x497e('0x125')});db[_0x497e('0xe3')][_0x497e('0x131')](db[_0x497e('0x54')],{});db[_0x497e('0xe3')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0xe3')][_0x497e('0x131')](db['CmContact'],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0xe3')][_0x497e('0x131')](db[_0x497e('0x57')],{});db['SmsQueueReport'][_0x497e('0x131')](db[_0x497e('0x58')],{});db[_0x497e('0xe3')][_0x497e('0x131')](db[_0x497e('0x12')],{});db['SmsQueueReport'][_0x497e('0x131')](db[_0x497e('0x59')],{});db['JscriptyProject'][_0x497e('0x121')](db[_0x497e('0xe2')],{'foreignKey':'ProjectId'});db[_0x497e('0xe6')]['hasMany'](db[_0x497e('0x1d9')],{'foreignKey':_0x497e('0x1db')});db[_0x497e('0xe6')][_0x497e('0x121')](db[_0x497e('0xdf')],{'foreignKey':_0x497e('0x1db')});db[_0x497e('0xf1')][_0x497e('0x132')](db['User'],{'as':'Agents','through':_0x497e('0x1dc')});db[_0x497e('0xf1')][_0x497e('0x132')](db[_0x497e('0x1c')],{'through':_0x497e('0x11a'),'as':'VoiceQueues'});db['Team'][_0x497e('0x132')](db[_0x497e('0x3e')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0x497e('0x132')](db[_0x497e('0x6b')],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team'][_0x497e('0x132')](db[_0x497e('0x50')],{'through':'team_has_fax_queues','as':_0x497e('0x1dd')});db[_0x497e('0xf1')][_0x497e('0x132')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x497e('0x141')});db[_0x497e('0xf1')][_0x497e('0x132')](db[_0x497e('0x62')],{'through':_0x497e('0x19b'),'as':_0x497e('0x142')});db[_0x497e('0xf1')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x497e('0x1de'),'as':_0x497e('0x143')});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0x497e('0x11c'),'as':_0x497e('0x1df')});db[_0x497e('0xf5')]['hasMany'](db[_0x497e('0x130')],{'as':_0x497e('0x155'),'foreignKey':_0x497e('0x1ac')});db['Campaign'][_0x497e('0x121')](db[_0x497e('0x76')],{'as':_0x497e('0x126'),'foreignKey':_0x497e('0x1ac')});db[_0x497e('0xf5')][_0x497e('0x121')](db[_0x497e('0x78')],{'as':_0x497e('0x156'),'foreignKey':'CampaignId'});db[_0x497e('0xf5')][_0x497e('0x121')](db[_0x497e('0x74')],{'as':'HopperBlacks','foreignKey':_0x497e('0x1ac')});db['Campaign'][_0x497e('0x131')](db[_0x497e('0x159')],{'as':'Trunk','foreignKey':_0x497e('0x15a')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x497e('0x15b'),'foreignKey':'TrunkBackupId'});db[_0x497e('0xf5')]['belongsTo'](db[_0x497e('0x83')],{'as':_0x497e('0x83'),'foreignKey':'IntervalId'});db[_0x497e('0xf5')][_0x497e('0x131')](db[_0x497e('0xec')],{'as':_0x497e('0xec'),'foreignKey':_0x497e('0x1e0')});db[_0x497e('0xf5')][_0x497e('0x132')](db[_0x497e('0x102')],{'as':_0x497e('0x135'),'through':_0x497e('0x1e1')});db['Campaign'][_0x497e('0x132')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x497e('0xf7')]['belongsTo'](db[_0x497e('0x181')],{'as':_0x497e('0x181'),'foreignKey':'ChatOfflineMessageId'});db[_0x497e('0xfa')][_0x497e('0x131')](db[_0x497e('0x43')],{});db['MailTransferReport'][_0x497e('0x131')](db[_0x497e('0x12e')],{});db['MailTransferReport'][_0x497e('0x131')](db[_0x497e('0x147')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x497e('0xfa')][_0x497e('0x131')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x497e('0xfa')]['belongsTo'](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db[_0x497e('0xfa')]['belongsTo'](db[_0x497e('0x3e')],{'foreignKey':_0x497e('0x1e4'),'as':_0x497e('0x1e5')});db[_0x497e('0xfa')][_0x497e('0x131')](db['MailAccount'],{'foreignKey':_0x497e('0x1e6'),'as':_0x497e('0x1e7')});db[_0x497e('0x1e8')][_0x497e('0x131')](db['ChatMessage'],{});db[_0x497e('0x1e8')][_0x497e('0x131')](db['ChatInteraction'],{});db[_0x497e('0x1e8')]['belongsTo'](db[_0x497e('0x63')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0x497e('0x12')],{'foreignKey':'FromUserId','as':_0x497e('0x1e9')});db[_0x497e('0x1e8')][_0x497e('0x131')](db['User'],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db[_0x497e('0x1e8')][_0x497e('0x131')](db[_0x497e('0x6b')],{'foreignKey':'ToChatQueueId','as':_0x497e('0x1e5')});db['ChatTransferReport'][_0x497e('0x131')](db[_0x497e('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x497e('0x1e7')});db[_0x497e('0xfd')][_0x497e('0x131')](db['FaxMessage'],{});db[_0x497e('0xfd')][_0x497e('0x131')](db['FaxInteraction'],{});db[_0x497e('0xfd')][_0x497e('0x131')](db['FaxAccount'],{'foreignKey':_0x497e('0x1ea'),'as':_0x497e('0x1eb')});db[_0x497e('0xfd')][_0x497e('0x131')](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1ec'),'as':_0x497e('0x1e9')});db[_0x497e('0xfd')][_0x497e('0x131')](db['User'],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db[_0x497e('0xfd')]['belongsTo'](db[_0x497e('0x50')],{'foreignKey':_0x497e('0x1ed'),'as':'ToQueue'});db[_0x497e('0xfd')]['belongsTo'](db[_0x497e('0x145')],{'foreignKey':_0x497e('0x1ee'),'as':_0x497e('0x1e7')});db[_0x497e('0xff')][_0x497e('0x131')](db[_0x497e('0x60')],{});db[_0x497e('0xff')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x497e('0xff')][_0x497e('0x131')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x497e('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x497e('0xff')]['belongsTo'](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db[_0x497e('0xff')][_0x497e('0x131')](db[_0x497e('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0x497e('0x1e5')});db[_0x497e('0xff')][_0x497e('0x131')](db[_0x497e('0x5b')],{'foreignKey':'ToOpenchannelAccountId','as':_0x497e('0x1e7')});db[_0x497e('0x101')][_0x497e('0x131')](db[_0x497e('0x58')],{});db[_0x497e('0x101')]['belongsTo'](db[_0x497e('0x57')],{});db[_0x497e('0x101')]['belongsTo'](db[_0x497e('0x54')],{'foreignKey':_0x497e('0x1ef'),'as':'FromAccount'});db[_0x497e('0x101')]['belongsTo'](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1ec'),'as':_0x497e('0x1e9')});db['SmsTransferReport'][_0x497e('0x131')](db['User'],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db[_0x497e('0x101')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x497e('0x1f0'),'as':'ToQueue'});db['SmsTransferReport'][_0x497e('0x131')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x497e('0x102')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0x497e('0x125')});db['CmList'][_0x497e('0x121')](db[_0x497e('0x7a')],{'as':_0x497e('0x1f1'),'foreignKey':_0x497e('0x174')});db['CmList']['hasMany'](db[_0x497e('0x71')],{'as':_0x497e('0x1a7'),'onDelete':'cascade','foreignKey':_0x497e('0x174')});db[_0x497e('0x102')][_0x497e('0x121')](db[_0x497e('0x76')],{'as':_0x497e('0x126'),'foreignKey':_0x497e('0x174')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0x497e('0x127'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x102')][_0x497e('0x121')](db[_0x497e('0x128')],{'as':_0x497e('0x128'),'foreignKey':'ListId'});db[_0x497e('0x102')][_0x497e('0x132')](db['VoiceQueue'],{'as':_0x497e('0x1f2'),'through':_0x497e('0x15e')});db[_0x497e('0x102')][_0x497e('0x132')](db['User'],{'as':'Agents','through':_0x497e('0x136')});db[_0x497e('0x104')][_0x497e('0x121')](db[_0x497e('0x18')],{'as':_0x497e('0x124'),'onDelete':_0x497e('0x125')});db[_0x497e('0x104')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':'Agents','through':_0x497e('0x13f')});db[_0x497e('0x104')][_0x497e('0x132')](db['Team'],{'through':'TeamVoicePrefix','as':_0x497e('0x160')});db[_0x497e('0x105')][_0x497e('0x121')](db[_0x497e('0x12')],{'as':'Users','foreignKey':_0x497e('0x1f3')});db[_0x497e('0x105')][_0x497e('0x121')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x497e('0x1f3'),'onDelete':_0x497e('0x125')});db[_0x497e('0x1f4')][_0x497e('0x121')](db['UserProfileResource'],{'as':_0x497e('0x1f5'),'foreignKey':_0x497e('0x1f6'),'onDelete':'cascade'});db[_0x497e('0x14c')][_0x497e('0x121')](db[_0x497e('0x81')],{'as':_0x497e('0x16f'),'foreignKey':'WhatsappAccountId','onDelete':_0x497e('0x125')});db[_0x497e('0x14c')][_0x497e('0x121')](db['CannedAnswer'],{'as':_0x497e('0x186'),'foreignKey':_0x497e('0x1f7')});db[_0x497e('0x14c')][_0x497e('0x121')](db[_0x497e('0x111')],{'as':_0x497e('0x171'),'foreignKey':_0x497e('0x1f7')});db[_0x497e('0x14c')][_0x497e('0x121')](db[_0x497e('0x10f')],{'as':_0x497e('0x172')});db[_0x497e('0x14c')][_0x497e('0x121')](db['WhatsappApplication'],{'as':_0x497e('0x151'),'foreignKey':_0x497e('0x1f7'),'onDelete':'cascade'});db[_0x497e('0x14c')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db['WhatsappAccount'][_0x497e('0x131')](db['Pause'],{'as':_0x497e('0x18a'),'foreignKey':_0x497e('0x176')});db[_0x497e('0x14c')][_0x497e('0x132')](db[_0x497e('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x497e('0x10d')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x497e('0x10d')][_0x497e('0x131')](db[_0x497e('0x117')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x10d')]['belongsTo'](db[_0x497e('0x14c')],{'onDelete':_0x497e('0x16c')});db[_0x497e('0x10d')][_0x497e('0x131')](db[_0x497e('0x83')],{'onDelete':_0x497e('0x16c'),'foreignKey':'IntervalId'});db[_0x497e('0x10d')][_0x497e('0x131')](db[_0x497e('0x8d')],{'onDelete':_0x497e('0x16c'),'foreignKey':_0x497e('0x183')});db['WhatsappInteraction'][_0x497e('0x121')](db[_0x497e('0x111')],{'as':'Messages','onDelete':_0x497e('0x125'),'foreignKey':_0x497e('0x1f8')});db[_0x497e('0x10f')][_0x497e('0x131')](db[_0x497e('0x14c')],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1f7')});db['WhatsappInteraction'][_0x497e('0x131')](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db['WhatsappInteraction'][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x17b'),'foreignKey':'UserId'});db[_0x497e('0x10f')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x1ba'),'as':_0x497e('0x17d')});db[_0x497e('0x10f')][_0x497e('0x132')](db[_0x497e('0x8d')],{'through':_0x497e('0x1ba'),'as':_0x497e('0x194')});db[_0x497e('0x10f')]['belongsToMany'](db[_0x497e('0x12')],{'as':_0x497e('0x18e'),'through':_0x497e('0x13e'),'foreignKey':_0x497e('0x1f8')});db[_0x497e('0x111')][_0x497e('0x131')](db[_0x497e('0x12')],{'as':_0x497e('0x12')});db['WhatsappMessage'][_0x497e('0x131')](db[_0x497e('0x71')],{'onDelete':_0x497e('0x125'),'as':_0x497e('0x169')});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x497e('0x125'),'as':_0x497e('0x17f'),'foreignKey':_0x497e('0x1f8')});db[_0x497e('0x111')][_0x497e('0x131')](db['WhatsappAccount'],{'as':_0x497e('0x179'),'foreignKey':_0x497e('0x1f7')});db['WhatsappQueueReport'][_0x497e('0x131')](db[_0x497e('0x14c')],{});db[_0x497e('0x113')][_0x497e('0x131')](db[_0x497e('0x102')],{'as':_0x497e('0x173'),'foreignKey':_0x497e('0x174')});db[_0x497e('0x113')]['belongsTo'](db[_0x497e('0x71')],{'as':_0x497e('0x169'),'foreignKey':_0x497e('0x17a')});db[_0x497e('0x113')][_0x497e('0x131')](db[_0x497e('0x10f')],{});db[_0x497e('0x113')][_0x497e('0x131')](db[_0x497e('0x117')],{});db[_0x497e('0x113')][_0x497e('0x131')](db[_0x497e('0x111')],{});db[_0x497e('0x113')]['belongsTo'](db[_0x497e('0x12')],{});db[_0x497e('0x115')]['belongsTo'](db['WhatsappMessage'],{});db[_0x497e('0x115')]['belongsTo'](db[_0x497e('0x10f')],{});db[_0x497e('0x115')][_0x497e('0x131')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x497e('0x1eb')});db[_0x497e('0x115')][_0x497e('0x131')](db['WhatsappAccount'],{'foreignKey':_0x497e('0x1f9'),'as':_0x497e('0x1e7')});db['WhatsappTransferReport']['belongsTo'](db[_0x497e('0x117')],{'foreignKey':'ToQueueId','as':_0x497e('0x1e5')});db['WhatsappTransferReport'][_0x497e('0x131')](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1ec'),'as':_0x497e('0x1e9')});db[_0x497e('0x115')][_0x497e('0x131')](db[_0x497e('0x12')],{'foreignKey':_0x497e('0x1e2'),'as':_0x497e('0x1e3')});db['WhatsappQueue']['belongsToMany'](db[_0x497e('0x12')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x497e('0x1fa')});db[_0x497e('0x117')]['belongsToMany'](db[_0x497e('0xf1')],{'through':'team_has_whatsapp_queues','as':_0x497e('0x160')});db[_0x497e('0x11d')][_0x497e('0x131')](db['User'],{'as':'user','foreignKey':_0x497e('0x11e'),'onDelete':_0x497e('0x125'),'hooks':!![]});db[_0x497e('0x118')][_0x497e('0x11f')](db[_0x497e('0xce')],{'as':_0x497e('0xce'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x118')]['hasOne'](db[_0x497e('0x3b')],{'as':_0x497e('0x16d'),'onDelete':_0x497e('0x16c')});db[_0x497e('0x118')][_0x497e('0x11f')](db[_0x497e('0x16a')],{'as':_0x497e('0x16e'),'onDelete':_0x497e('0x16c')});module[_0x497e('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 48c04eb..357dda2 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeff2=['./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations'];(function(_0x2fc147,_0x2fbd8a){var _0x315652=function(_0x11009d){while(--_0x11009d){_0x2fc147['push'](_0x2fc147['shift']());}};_0x315652(++_0x2fbd8a);}(_0xeff2,0x180));var _0x2eff=function(_0x4a0b4f,_0x3d77ac){_0x4a0b4f=_0x4a0b4f-0x0;var _0x430511=_0xeff2[_0x4a0b4f];return _0x430511;};'use strict';var path=require('path');var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x2eff('0x0')];var clientSideLogs=require(_0x2eff('0x1'));exports[_0x2eff('0x2')]=function(_0x17aba8){return setupLoggers(_0x17aba8)['then'](function(){_0x17aba8[_0x2eff('0x3')]('/api/users',require('./api/user'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x4'),require(_0x2eff('0x5')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x6'),require('./api/voiceContext'));_0x17aba8[_0x2eff('0x3')]('/api/voice/extensions',require(_0x2eff('0x7')));_0x17aba8['use'](_0x2eff('0x8'),require(_0x2eff('0x9')));_0x17aba8[_0x2eff('0x3')]('/api/voice/queues',require('./api/voiceQueue'));_0x17aba8['use']('/api/voice/recordings',require(_0x2eff('0xa')));_0x17aba8['use'](_0x2eff('0xb'),require(_0x2eff('0xc')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xd'),require(_0x2eff('0xe')));_0x17aba8['use'](_0x2eff('0xf'),require('./api/voiceMailMessage'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x10'),require(_0x2eff('0x11')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x12'),require('./api/voiceDialReport'));_0x17aba8[_0x2eff('0x3')]('/api/voice/agents/reports',require(_0x2eff('0x13')));_0x17aba8['use']('/api/voice/queues/reports',require(_0x2eff('0x14')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x15'),require(_0x2eff('0x16')));_0x17aba8[_0x2eff('0x3')]('/api/trunks',require(_0x2eff('0x17')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x18'),require(_0x2eff('0x19')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x1a'),require(_0x2eff('0x1b')));_0x17aba8['use'](_0x2eff('0x1c'),require(_0x2eff('0x1d')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x1e'),require(_0x2eff('0x1f')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x20'),require('./api/mailSubstatus'));_0x17aba8['use']('/api/mail/interactions',require(_0x2eff('0x21')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x22'),require(_0x2eff('0x23')));_0x17aba8['use']('/api/mail/applications',require('./api/mailApplication'));_0x17aba8[_0x2eff('0x3')]('/api/mail/reports/queue',require(_0x2eff('0x24')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x25'),require(_0x2eff('0x26')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x27'),require('./api/dashboardItem'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x28'),require(_0x2eff('0x29')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x2a'),require(_0x2eff('0x2b')));_0x17aba8[_0x2eff('0x3')]('/api/fax/interactions',require(_0x2eff('0x2c')));_0x17aba8[_0x2eff('0x3')]('/api/fax/messages',require(_0x2eff('0x2d')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x2e'),require(_0x2eff('0x2f')));_0x17aba8['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x17aba8['use'](_0x2eff('0x30'),require(_0x2eff('0x31')));_0x17aba8['use']('/api/sms/applications',require(_0x2eff('0x32')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x33'),require(_0x2eff('0x34')));_0x17aba8['use'](_0x2eff('0x35'),require('./api/smsMessage'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x36'),require('./api/smsQueue'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x37'),require(_0x2eff('0x38')));_0x17aba8[_0x2eff('0x3')]('/api/openchannel/applications',require(_0x2eff('0x39')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x3a'),require('./api/openchannelInteraction'));_0x17aba8['use'](_0x2eff('0x3b'),require(_0x2eff('0x3c')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x3d'),require(_0x2eff('0x3e')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x3f'),require(_0x2eff('0x40')));_0x17aba8[_0x2eff('0x3')]('/api/openchannel/reports/queue',require(_0x2eff('0x41')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x42'),require(_0x2eff('0x43')));_0x17aba8['use']('/api/chat/interactions',require(_0x2eff('0x44')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x45'),require(_0x2eff('0x46')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x47'),require('./api/chatOfflineMessage'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x48'),require(_0x2eff('0x49')));_0x17aba8[_0x2eff('0x3')]('/api/chat/groups',require(_0x2eff('0x4a')));_0x17aba8[_0x2eff('0x3')]('/api/chat/proactive_actions',require(_0x2eff('0x4b')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x4c'),require(_0x2eff('0x4d')));_0x17aba8['use'](_0x2eff('0x4e'),require('./api/cmContact'));_0x17aba8[_0x2eff('0x3')]('/api/cm/hopper',require(_0x2eff('0x4f')));_0x17aba8[_0x2eff('0x3')]('/api/cm/hopper_black',require(_0x2eff('0x50')));_0x17aba8['use'](_0x2eff('0x51'),require(_0x2eff('0x52')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x53'),require(_0x2eff('0x54')));_0x17aba8['use']('/api/cm/custom_fields',require(_0x2eff('0x55')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x56'),require(_0x2eff('0x57')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x58'),require('./api/automation'));_0x17aba8['use'](_0x2eff('0x59'),require(_0x2eff('0x5a')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x5b'),require(_0x2eff('0x5c')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x5d'),require(_0x2eff('0x5e')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x5f'),require('./api/interval'));_0x17aba8['use'](_0x2eff('0x60'),require('./api/pause'));_0x17aba8['use'](_0x2eff('0x61'),require(_0x2eff('0x62')));_0x17aba8['use'](_0x2eff('0x63'),require(_0x2eff('0x64')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x65'),require(_0x2eff('0x66')));_0x17aba8['use'](_0x2eff('0x67'),require(_0x2eff('0x68')));_0x17aba8['use']('/api/tags',require(_0x2eff('0x69')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x6a'),require(_0x2eff('0x6b')));_0x17aba8[_0x2eff('0x3')]('/api/cm_contact_has_items',require(_0x2eff('0x6c')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x6d'),require(_0x2eff('0x6e')));_0x17aba8['use'](_0x2eff('0x6f'),require(_0x2eff('0x70')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x71'),require(_0x2eff('0x72')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x73'),require('./api/variable'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x74'),require(_0x2eff('0x75')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x76'),require(_0x2eff('0x77')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x78'),require(_0x2eff('0x79')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x7a'),require(_0x2eff('0x7b')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x7c'),require(_0x2eff('0x7d')));_0x17aba8['use'](_0x2eff('0x7e'),require(_0x2eff('0x7f')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x80'),require(_0x2eff('0x81')));_0x17aba8[_0x2eff('0x3')]('/api/analytics/tree_reports',require(_0x2eff('0x82')));_0x17aba8[_0x2eff('0x3')]('/api/integrations/salesforce/accounts',require(_0x2eff('0x83')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x84'),require(_0x2eff('0x85')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x86'),require('./api/intSalesforceField'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x87'),require(_0x2eff('0x88')));_0x17aba8[_0x2eff('0x3')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x17aba8[_0x2eff('0x3')]('/api/integrations/sugarcrm/fields',require(_0x2eff('0x89')));_0x17aba8[_0x2eff('0x3')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x8a'),require(_0x2eff('0x8b')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x8c'),require(_0x2eff('0x8d')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x8e'),require('./api/intZohoAccount'));_0x17aba8['use'](_0x2eff('0x8f'),require(_0x2eff('0x90')));_0x17aba8[_0x2eff('0x3')]('/api/integrations/zoho/fields',require(_0x2eff('0x91')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x92'),require('./api/intZendeskAccount'));_0x17aba8['use'](_0x2eff('0x93'),require(_0x2eff('0x94')));_0x17aba8[_0x2eff('0x3')]('/api/integrations/zendesk/fields',require(_0x2eff('0x95')));_0x17aba8['use'](_0x2eff('0x96'),require('./api/intFreshdeskAccount'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x97'),require(_0x2eff('0x98')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x99'),require(_0x2eff('0x9a')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x9b'),require(_0x2eff('0x9c')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x9d'),require(_0x2eff('0x9e')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0x9f'),require(_0x2eff('0xa0')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xa1'),require(_0x2eff('0xa2')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xa3'),require(_0x2eff('0xa4')));_0x17aba8['use'](_0x2eff('0xa5'),require(_0x2eff('0xa6')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xa7'),require('./api/intDynamics365Account'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xa8'),require('./api/intDynamics365Configuration'));_0x17aba8[_0x2eff('0x3')]('/api/integrations/dynamics365/fields',require(_0x2eff('0xa9')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xaa'),require(_0x2eff('0xab')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xac'),require(_0x2eff('0xad')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xae'),require(_0x2eff('0xaf')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb0'),require(_0x2eff('0xb1')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb2'),require(_0x2eff('0xb3')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb4'),require(_0x2eff('0xb5')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb6'),require(_0x2eff('0xb7')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb8'),require('./api/jscriptyQuestionReport'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xb9'),require('./api/jscriptySessionReport'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xba'),require(_0x2eff('0xbb')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xbc'),require(_0x2eff('0xbd')));_0x17aba8[_0x2eff('0x3')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x17aba8['use'](_0x2eff('0xbe'),require(_0x2eff('0xbf')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xc0'),require(_0x2eff('0xc1')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xc2'),require(_0x2eff('0xc3')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xc4'),require('./api/squareProject'));_0x17aba8['use'](_0x2eff('0xc5'),require(_0x2eff('0xc6')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xc7'),require(_0x2eff('0xc8')));_0x17aba8[_0x2eff('0x3')]('/api/teams',require('./api/team'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xc9'),require('./api/license'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xca'),require(_0x2eff('0xcb')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xcc'),require(_0x2eff('0xcd')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xce'),require('./api/attachment'));_0x17aba8['use'](_0x2eff('0xcf'),require('./api/plugin'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xd0'),require(_0x2eff('0xd1')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xd2'),require(_0x2eff('0xd3')));_0x17aba8['use'](_0x2eff('0xd4'),require('./api/faxTransferReport'));_0x17aba8[_0x2eff('0x3')]('/api/openchannel/reports/transfer',require(_0x2eff('0xd5')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xd6'),require(_0x2eff('0xd7')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xd8'),require(_0x2eff('0xd9')));_0x17aba8['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x17aba8[_0x2eff('0x3')]('/api/userProfiles',require('./api/userProfile'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xda'),require('./api/userProfileSection'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xdb'),require(_0x2eff('0xdc')));_0x17aba8[_0x2eff('0x3')]('/api/userNotifications',require(_0x2eff('0xdd')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xde'),require('./api/whatsappAccount'));_0x17aba8[_0x2eff('0x3')]('/api/whatsapp/applications',require(_0x2eff('0xdf')));_0x17aba8[_0x2eff('0x3')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xe0'),require(_0x2eff('0xe1')));_0x17aba8['use']('/api/whatsapp/reports/queue',require(_0x2eff('0xe2')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xe3'),require(_0x2eff('0xe4')));_0x17aba8['use'](_0x2eff('0xe5'),require('./api/whatsappQueue'));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xe6'),require(_0x2eff('0xe7')));_0x17aba8['use'](_0x2eff('0xe8'),require('./api/realtime'));_0x17aba8['use'](_0x2eff('0xe9'),require(_0x2eff('0xea')));_0x17aba8[_0x2eff('0x3')]('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x17aba8['use'](_0x2eff('0xeb'),require('./api/authLocal'));_0x17aba8[_0x2eff('0x3')]('/api/auth/google',require(_0x2eff('0xec')));_0x17aba8['use']('/api/auth/activedirectory',require(_0x2eff('0xed')));_0x17aba8['use'](_0x2eff('0xee'),require(_0x2eff('0xef')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xf0'),require(_0x2eff('0xf1')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xf2'),require(_0x2eff('0xf3')));_0x17aba8['use'](_0x2eff('0xf4'),require(_0x2eff('0xf5')));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xf6'),require('./api/pm2'));_0x17aba8['use'](_0x2eff('0xf7'),require(_0x2eff('0xf8')));_0x17aba8[_0x2eff('0x3')]('/api/logs',clientSideLogs);_0x17aba8[_0x2eff('0x3')]('/apidoc',express[_0x2eff('0xf9')](path[_0x2eff('0xfa')](config[_0x2eff('0xfb')],_0x2eff('0xfc'))));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xfd'),express[_0x2eff('0xf9')](path[_0x2eff('0xfa')](config[_0x2eff('0xfb')],_0x2eff('0xfd'))));_0x17aba8[_0x2eff('0x3')]('/demo',express[_0x2eff('0xf9')](path[_0x2eff('0xfa')](config[_0x2eff('0xfb')],_0x2eff('0xfe'))));_0x17aba8[_0x2eff('0x3')](_0x2eff('0xff'),express[_0x2eff('0xf9')](path[_0x2eff('0xfa')](config[_0x2eff('0xfb')],_0x2eff('0x100'),_0x2eff('0x101'))));_0x17aba8['use'](_0x2eff('0x102'),express['static'](path['join'](config['root'],_0x2eff('0x103'))));_0x17aba8[_0x2eff('0x104')](_0x2eff('0x105'))[_0x2eff('0x106')](errors[0x194]);_0x17aba8['route']('/*')[_0x2eff('0x106')](function(_0x331d0d,_0x4d1d6f){_0x4d1d6f[_0x2eff('0x107')](path[_0x2eff('0x108')](_0x17aba8[_0x2eff('0x106')](_0x2eff('0x109'))+'/index.html'));});return _0x17aba8;});}; \ No newline at end of file +var _0x7f9a=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/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/intFreshdeskConfiguration','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./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/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration'];(function(_0x287d08,_0x55ab1e){var _0x3e7834=function(_0x3cada6){while(--_0x3cada6){_0x287d08['push'](_0x287d08['shift']());}};_0x3e7834(++_0x55ab1e);}(_0x7f9a,0x1a9));var _0xa7f9=function(_0x576d62,_0x3f9db1){_0x576d62=_0x576d62-0x0;var _0x58d687=_0x7f9a[_0x576d62];return _0x58d687;};'use strict';var path=require(_0xa7f9('0x0'));var express=require(_0xa7f9('0x1'));var errors=require(_0xa7f9('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xa7f9('0x3'))[_0xa7f9('0x4')];var clientSideLogs=require(_0xa7f9('0x5'));exports[_0xa7f9('0x6')]=function(_0x5eebc9){return setupLoggers(_0x5eebc9)['then'](function(){_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x8'),require(_0xa7f9('0x9')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xa'),require(_0xa7f9('0xb')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xc'),require(_0xa7f9('0xd')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xe'),require(_0xa7f9('0xf')));_0x5eebc9['use'](_0xa7f9('0x10'),require('./api/voiceMusicOnHold'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x11'),require(_0xa7f9('0x12')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x13'),require('./api/voiceRecording'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x14'),require(_0xa7f9('0x15')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x16'),require(_0xa7f9('0x17')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x18'),require(_0xa7f9('0x19')));_0x5eebc9['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x1a'),require(_0xa7f9('0x1b')));_0x5eebc9[_0xa7f9('0x7')]('/api/voice/agents/reports',require(_0xa7f9('0x1c')));_0x5eebc9['use']('/api/voice/queues/reports',require(_0xa7f9('0x1d')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x1e'),require(_0xa7f9('0x1f')));_0x5eebc9['use'](_0xa7f9('0x20'),require(_0xa7f9('0x21')));_0x5eebc9['use']('/api/voice/transfers/reports',require(_0xa7f9('0x22')));_0x5eebc9['use'](_0xa7f9('0x23'),require(_0xa7f9('0x24')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x25'),require(_0xa7f9('0x26')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x27'),require(_0xa7f9('0x28')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x29'),require(_0xa7f9('0x2a')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x2b'),require(_0xa7f9('0x2c')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x2d'),require(_0xa7f9('0x2e')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x2f'),require('./api/mailApplication'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x30'),require(_0xa7f9('0x31')));_0x5eebc9[_0xa7f9('0x7')]('/api/dashboards',require(_0xa7f9('0x32')));_0x5eebc9['use'](_0xa7f9('0x33'),require(_0xa7f9('0x34')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x35'),require('./api/faxAccount'));_0x5eebc9[_0xa7f9('0x7')]('/api/fax/applications',require('./api/faxApplication'));_0x5eebc9['use'](_0xa7f9('0x36'),require(_0xa7f9('0x37')));_0x5eebc9['use'](_0xa7f9('0x38'),require(_0xa7f9('0x39')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x3a'),require(_0xa7f9('0x3b')));_0x5eebc9['use'](_0xa7f9('0x3c'),require(_0xa7f9('0x3d')));_0x5eebc9['use'](_0xa7f9('0x3e'),require('./api/smsAccount'));_0x5eebc9['use'](_0xa7f9('0x3f'),require(_0xa7f9('0x40')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x41'),require(_0xa7f9('0x42')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x43'),require('./api/smsMessage'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x44'),require(_0xa7f9('0x45')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x46'),require(_0xa7f9('0x47')));_0x5eebc9['use']('/api/openchannel/applications',require(_0xa7f9('0x48')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x49'),require(_0xa7f9('0x4a')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x4b'),require(_0xa7f9('0x4c')));_0x5eebc9[_0xa7f9('0x7')]('/api/openchannel/queues',require(_0xa7f9('0x4d')));_0x5eebc9[_0xa7f9('0x7')]('/api/chat/websites',require('./api/chatWebsite'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x4e'),require(_0xa7f9('0x4f')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x50'),require(_0xa7f9('0x51')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x52'),require(_0xa7f9('0x53')));_0x5eebc9['use'](_0xa7f9('0x54'),require(_0xa7f9('0x55')));_0x5eebc9[_0xa7f9('0x7')]('/api/chat/offline_messages',require(_0xa7f9('0x56')));_0x5eebc9['use']('/api/chat/queues',require(_0xa7f9('0x57')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x58'),require(_0xa7f9('0x59')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x5a'),require('./api/chatProactiveAction'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x5b'),require(_0xa7f9('0x5c')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x5d'),require('./api/cmContact'));_0x5eebc9[_0xa7f9('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x5eebc9['use'](_0xa7f9('0x5e'),require('./api/cmHopperBlack'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x5f'),require('./api/cmHopperFinal'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x60'),require(_0xa7f9('0x61')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x62'),require('./api/cmCustomField'));_0x5eebc9[_0xa7f9('0x7')]('/api/actions',require(_0xa7f9('0x63')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x64'),require('./api/automation'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x65'),require('./api/cannedAnswer'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x66'),require(_0xa7f9('0x67')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x68'),require(_0xa7f9('0x69')));_0x5eebc9['use'](_0xa7f9('0x6a'),require(_0xa7f9('0x6b')));_0x5eebc9[_0xa7f9('0x7')]('/api/pauses',require(_0xa7f9('0x6c')));_0x5eebc9['use']('/api/cdr',require(_0xa7f9('0x6d')));_0x5eebc9['use'](_0xa7f9('0x6e'),require(_0xa7f9('0x6f')));_0x5eebc9[_0xa7f9('0x7')]('/api/schedules',require(_0xa7f9('0x70')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x71'),require(_0xa7f9('0x72')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x73'),require('./api/tag'));_0x5eebc9[_0xa7f9('0x7')]('/api/contact_item_types',require(_0xa7f9('0x74')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x75'),require(_0xa7f9('0x76')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x77'),require(_0xa7f9('0x78')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x79'),require(_0xa7f9('0x7a')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x7b'),require(_0xa7f9('0x7c')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x7d'),require(_0xa7f9('0x7e')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x7f'),require(_0xa7f9('0x80')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x81'),require(_0xa7f9('0x82')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x83'),require(_0xa7f9('0x84')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x85'),require('./api/analyticDefaultReport'));_0x5eebc9['use'](_0xa7f9('0x86'),require('./api/analyticExtractedReport'));_0x5eebc9['use']('/api/analytics/metrics',require(_0xa7f9('0x87')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x88'),require(_0xa7f9('0x89')));_0x5eebc9['use'](_0xa7f9('0x8a'),require(_0xa7f9('0x8b')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x8c'),require(_0xa7f9('0x8d')));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/salesforce/configurations',require(_0xa7f9('0x8e')));_0x5eebc9['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/sugarcrm/accounts',require(_0xa7f9('0x8f')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x90'),require(_0xa7f9('0x91')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x92'),require(_0xa7f9('0x93')));_0x5eebc9['use']('/api/integrations/desk/accounts',require(_0xa7f9('0x94')));_0x5eebc9['use'](_0xa7f9('0x95'),require(_0xa7f9('0x96')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x97'),require(_0xa7f9('0x98')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x99'),require(_0xa7f9('0x9a')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x9b'),require(_0xa7f9('0x9c')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x9d'),require(_0xa7f9('0x9e')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x9f'),require(_0xa7f9('0xa0')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xa1'),require(_0xa7f9('0xa2')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xa3'),require('./api/intZendeskField'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xa4'),require(_0xa7f9('0xa5')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xa6'),require(_0xa7f9('0xa7')));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/vtiger/accounts',require(_0xa7f9('0xa8')));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/vtiger/configurations',require(_0xa7f9('0xa9')));_0x5eebc9['use'](_0xa7f9('0xaa'),require(_0xa7f9('0xab')));_0x5eebc9['use'](_0xa7f9('0xac'),require(_0xa7f9('0xad')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xae'),require(_0xa7f9('0xaf')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xb0'),require(_0xa7f9('0xb1')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xb2'),require(_0xa7f9('0xb3')));_0x5eebc9['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xb4'),require(_0xa7f9('0xb5')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xb6'),require('./api/intFreshsalesAccount'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xb7'),require(_0xa7f9('0xb8')));_0x5eebc9[_0xa7f9('0x7')]('/api/integrations/freshsales/fields',require(_0xa7f9('0xb9')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xba'),require(_0xa7f9('0xbb')));_0x5eebc9['use'](_0xa7f9('0xbc'),require(_0xa7f9('0xbd')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xbe'),require(_0xa7f9('0xbf')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xc0'),require(_0xa7f9('0xc1')));_0x5eebc9['use'](_0xa7f9('0xc2'),require('./api/jscriptyQuestionReport'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xc3'),require(_0xa7f9('0xc4')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xc5'),require('./api/smsQueueReport'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xc6'),require(_0xa7f9('0xc7')));_0x5eebc9[_0xa7f9('0x7')]('/api/square/details/reports',require(_0xa7f9('0xc8')));_0x5eebc9['use'](_0xa7f9('0xc9'),require('./api/jscriptyProject'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xca'),require('./api/setting'));_0x5eebc9[_0xa7f9('0x7')]('/api/square/odbc',require(_0xa7f9('0xcb')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xcc'),require(_0xa7f9('0xcd')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xce'),require('./api/squareRecording'));_0x5eebc9['use'](_0xa7f9('0xcf'),require(_0xa7f9('0xd0')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xd1'),require(_0xa7f9('0xd2')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xd3'),require(_0xa7f9('0xd4')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xd5'),require(_0xa7f9('0xd6')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xd7'),require(_0xa7f9('0xd8')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xd9'),require(_0xa7f9('0xda')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xdb'),require(_0xa7f9('0xdc')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xdd'),require(_0xa7f9('0xde')));_0x5eebc9[_0xa7f9('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xdf'),require(_0xa7f9('0xe0')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xe1'),require(_0xa7f9('0xe2')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xe3'),require(_0xa7f9('0xe4')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xe5'),require(_0xa7f9('0xe6')));_0x5eebc9['use'](_0xa7f9('0xe7'),require(_0xa7f9('0xe8')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xe9'),require(_0xa7f9('0xea')));_0x5eebc9['use'](_0xa7f9('0xeb'),require(_0xa7f9('0xec')));_0x5eebc9[_0xa7f9('0x7')]('/api/userProfile/resources',require(_0xa7f9('0xed')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xee'),require(_0xa7f9('0xef')));_0x5eebc9[_0xa7f9('0x7')]('/api/whatsapp/accounts',require(_0xa7f9('0xf0')));_0x5eebc9[_0xa7f9('0x7')]('/api/whatsapp/applications',require(_0xa7f9('0xf1')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xf2'),require(_0xa7f9('0xf3')));_0x5eebc9[_0xa7f9('0x7')]('/api/whatsapp/messages',require(_0xa7f9('0xf4')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xf5'),require('./api/whatsappQueueReport'));_0x5eebc9[_0xa7f9('0x7')]('/api/whatsapp/reports/transfer',require(_0xa7f9('0xf6')));_0x5eebc9['use'](_0xa7f9('0xf7'),require(_0xa7f9('0xf8')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xf9'),require(_0xa7f9('0xfa')));_0x5eebc9['use'](_0xa7f9('0xfb'),require('./api/realtime'));_0x5eebc9[_0xa7f9('0x7')]('/api/user-settings',require('./api/user-setting'));_0x5eebc9[_0xa7f9('0x7')]('/api/mail_interaction_has_tags',require(_0xa7f9('0xfc')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0xfd'),require(_0xa7f9('0xfe')));_0x5eebc9['use'](_0xa7f9('0xff'),require('./api/authGoogle'));_0x5eebc9[_0xa7f9('0x7')]('/api/auth/activedirectory',require(_0xa7f9('0x100')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x101'),require(_0xa7f9('0x102')));_0x5eebc9[_0xa7f9('0x7')]('/api/rpc',require(_0xa7f9('0x103')));_0x5eebc9[_0xa7f9('0x7')]('/api/version',require(_0xa7f9('0x104')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x105'),require(_0xa7f9('0x106')));_0x5eebc9[_0xa7f9('0x7')]('/api/pm2',require(_0xa7f9('0x107')));_0x5eebc9['use'](_0xa7f9('0x108'),require(_0xa7f9('0x109')));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x10a'),clientSideLogs);_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x10b'),express[_0xa7f9('0x10c')](path[_0xa7f9('0x10d')](config['root'],_0xa7f9('0x10b'))));_0x5eebc9[_0xa7f9('0x7')]('/www',express[_0xa7f9('0x10c')](path[_0xa7f9('0x10d')](config[_0xa7f9('0x10e')],_0xa7f9('0x10f'))));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x110'),express[_0xa7f9('0x10c')](path[_0xa7f9('0x10d')](config[_0xa7f9('0x10e')],_0xa7f9('0x110'))));_0x5eebc9['use'](_0xa7f9('0x111'),express[_0xa7f9('0x10c')](path['join'](config['root'],_0xa7f9('0x112'),_0xa7f9('0x113'))));_0x5eebc9[_0xa7f9('0x7')](_0xa7f9('0x114'),express[_0xa7f9('0x10c')](path[_0xa7f9('0x10d')](config['root'],_0xa7f9('0x115'))));_0x5eebc9[_0xa7f9('0x116')](_0xa7f9('0x117'))[_0xa7f9('0x118')](errors[0x194]);_0x5eebc9['route']('/*')[_0xa7f9('0x118')](function(_0x571d45,_0x1c78bd){_0x1c78bd['sendFile'](path[_0xa7f9('0x119')](_0x5eebc9[_0xa7f9('0x118')](_0xa7f9('0x11a'))+_0xa7f9('0x11b')));});return _0x5eebc9;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2600f11..64b1d80 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f4b=['../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc'];(function(_0x379799,_0x4ccf16){var _0x46e431=function(_0x34bd4d){while(--_0x34bd4d){_0x379799['push'](_0x379799['shift']());}};_0x46e431(++_0x4ccf16);}(_0x7f4b,0x154));var _0xb7f4=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0x7f4b[_0x545150];return _0xff7fd6;};'use strict';var jayson=require('jayson/promise');var _=require(_0xb7f4('0x0'));var config=require(_0xb7f4('0x1'));exports[_0xb7f4('0x2')]=function(){return new Promise(function(_0x28dad7,_0x284782){var _0x409675={};_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x4')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x5')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x6')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/voiceRecording/voiceRecording.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x7')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x8')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x9')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0xa')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0xb')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0xc')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/mailAccount/mailAccount.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0xd')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0xe')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/mailMessage/mailMessage.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0xf')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x10')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x11')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x12')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x13')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x14')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x15')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x16')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x17')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x18')));_0x409675=_['merge'](_0x409675,require('../api/smsQueue/smsQueue.rpc'));_0x409675=_['merge'](_0x409675,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x19')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x1a')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x1b')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x1c')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x1d')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x1e')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/chatQueue/chatQueue.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x1f')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/cmHopper/cmHopper.rpc'));_0x409675=_['merge'](_0x409675,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x20')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x21')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x22')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x23')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/pause/pause.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x24')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x25')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x26')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/trigger/trigger.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x27')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x28')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x29')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x2a')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x2b')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x2c')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x2d')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x2e')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x2f')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x30')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x31')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/setting/setting.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x32')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x33')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/squareRecording/squareRecording.rpc'));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x34')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x35')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x36')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x37')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x38')));_0x409675=_['merge'](_0x409675,require(_0xb7f4('0x39')));_0x409675=_[_0xb7f4('0x3')](_0x409675,require(_0xb7f4('0x3a')));var _0x475060=jayson[_0xb7f4('0x3b')](_0x409675)[_0xb7f4('0x3c')]();var _0x2a1755=config[_0xb7f4('0x3d')][_0xb7f4('0x3e')]||config['port']+0x1;var _0x3b32f2=config[_0xb7f4('0x3d')]['ip']||'localhost';_0x475060['on'](_0xb7f4('0x3f'),function(_0x4398e2){return _0x284782(_0x4398e2);});_0x475060['listen'](_0x2a1755,_0x3b32f2,function(){console[_0xb7f4('0x40')](_0xb7f4('0x41'),_0x3b32f2,_0x2a1755);require(_0xb7f4('0x42'))[_0xb7f4('0x43')]();return _0x28dad7(_0xb7f4('0x44')+_0x3b32f2+':'+_0x2a1755);});});}; \ No newline at end of file +var _0x82f8=['../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','listen','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc'];(function(_0x47758a,_0x32c0ab){var _0x4013df=function(_0x54ac7e){while(--_0x54ac7e){_0x47758a['push'](_0x47758a['shift']());}};_0x4013df(++_0x32c0ab);}(_0x82f8,0x157));var _0x882f=function(_0xca0c84,_0x2b67b9){_0xca0c84=_0xca0c84-0x0;var _0x1a4cd8=_0x82f8[_0xca0c84];return _0x1a4cd8;};'use strict';var jayson=require('jayson/promise');var _=require(_0x882f('0x0'));var config=require(_0x882f('0x1'));exports['listen']=function(){return new Promise(function(_0xac1624,_0x2ffd9c){var _0x106930={};_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x3')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x4')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/voiceQueue/voiceQueue.rpc'));_0x106930=_['merge'](_0x106930,require(_0x882f('0x5')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x6')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/memberReport/memberReport.rpc'));_0x106930=_['merge'](_0x106930,require(_0x882f('0x7')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x8')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x9')));_0x106930=_['merge'](_0x106930,require('../api/mailServerIn/mailServerIn.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0xa')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0xb')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0xc')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/mailMessage/mailMessage.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0xd')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0xe')));_0x106930=_['merge'](_0x106930,require('../api/faxAccount/faxAccount.rpc'));_0x106930=_['merge'](_0x106930,require(_0x882f('0xf')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x10')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x11')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x12')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/smsAccount/smsAccount.rpc'));_0x106930=_['merge'](_0x106930,require(_0x882f('0x13')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x14')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/smsQueue/smsQueue.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x15')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x16')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x17')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x18')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x106930=_['merge'](_0x106930,require('../api/chatInteraction/chatInteraction.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x19')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1a')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1b')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1c')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1d')));_0x106930=_['merge'](_0x106930,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1e')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/interval/interval.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x1f')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x20')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x21')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x22')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x23')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x24')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x25')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x26')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x27')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x28')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x29')));_0x106930=_['merge'](_0x106930,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x2a')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x2b')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x2c')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x2d')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x106930=_['merge'](_0x106930,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/squareReport/squareReport.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x2e')));_0x106930=_['merge'](_0x106930,require('../api/setting/setting.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x2f')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x30')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x31')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x32')));_0x106930=_['merge'](_0x106930,require(_0x882f('0x33')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x34')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x35')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x36')));_0x106930=_[_0x882f('0x2')](_0x106930,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x37')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x38')));_0x106930=_[_0x882f('0x2')](_0x106930,require(_0x882f('0x39')));var _0x281e89=jayson[_0x882f('0x3a')](_0x106930)['http']();var _0xc5bd03=config[_0x882f('0x3b')]['port']||config[_0x882f('0x3c')]+0x1;var _0x130df9=config[_0x882f('0x3b')]['ip']||'localhost';_0x281e89['on'](_0x882f('0x3d'),function(_0x9210e3){return _0x2ffd9c(_0x9210e3);});_0x281e89[_0x882f('0x3e')](_0xc5bd03,_0x130df9,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x130df9,_0xc5bd03);require(_0x882f('0x3f'))[_0x882f('0x40')]();return _0xac1624(_0x882f('0x41')+_0x130df9+':'+_0xc5bd03);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0ae8279..1e14d84 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 _0xb1ef=['./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xb1ef,0x93));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xfb1e('0x0'));var _=require(_0xfb1e('0x1'));var EventEmitter=require('events')[_0xfb1e('0x2')];var AGIReply=require(_0xfb1e('0x3'));var AGIError=require(_0xfb1e('0x4'));function AGIChannel(_0x2c7116){var _0xb70c57=this,_0x1ce096=new AGIReply(),_0x477ee0=![],_0x4b7622={};EventEmitter['call'](_0xb70c57);_0x2c7116[_0xfb1e('0x5')](_0xfb1e('0x6'));_0x2c7116[_0xfb1e('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ce096[_0xfb1e('0x5')]('utf8');_0x1ce096['on']('headers',function(_0x3c7643){for(var _0x106367 in _0x3c7643){_0xb70c57[_0x106367]=_0x3c7643[_0x106367];}_0xb70c57[_0xfb1e('0x8')](_0xfb1e('0x9'));});_0x1ce096['on'](_0xfb1e('0xa'),function(_0x2fbf8d){if(_0x2fbf8d[_0xfb1e('0xb')]()==_0xfb1e('0xc')){_0xb70c57['emit'](_0xfb1e('0xc'));return;}if(_0x2fbf8d[_0xfb1e('0xd')](0x0,0xb)==_0xfb1e('0xe')){_0x477ee0=!![];}if(_0x477ee0){_0x4b7622['rx']+=_0x2fbf8d+'\x0a';if(_0x2fbf8d[_0xfb1e('0xf')](_0xfb1e('0x10'))!=-0x1){_0x477ee0=![];}}else{_0x4b7622['rx']=_0x2fbf8d;}if(_0x477ee0){return;}if(typeof _0x4b7622['cb']==_0xfb1e('0x11')){var _0x2f7b2e=_0x4b7622['rx'][_0xfb1e('0xd')](0x0,0x3),_0x4f33f8=null,_0x30b991=null;_0x2f7b2e=parseInt(_0x2f7b2e);if(isNaN(_0x2f7b2e)){_0x4b7622['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2f7b2e!=0xc8){_0x4b7622['cb'](null,{'code':_0x2f7b2e,'result':-0x1,'extra':'KO'});return;}_0x4f33f8=_0x4b7622['rx'][_0xfb1e('0xd')](0x4)[_0xfb1e('0x12')](_0xfb1e('0x13'),'');if(_0x4f33f8[_0xfb1e('0x14')]('\x20')!=-0x1){_0x4f33f8=_0x4f33f8[_0xfb1e('0x15')](0x0,_0x4f33f8['indexOf']('\x20'));}if(_[_0xfb1e('0x16')](_0x4f33f8,'-1')){_0x4f33f8=parseInt(_0x4f33f8);}_0x30b991=_0x4b7622['rx'][_0xfb1e('0x17')]('\x20');if(_0x30b991[_0xfb1e('0x18')]==0x3){_0x30b991=_0x30b991[0x2][_0xfb1e('0xd')](0x1,_0x30b991[0x2][_0xfb1e('0x18')]-0x1);}else if(_0x30b991['length']>0x3){var _0x2f3d7e=/\((.+)\)/;var _0x3cf40c=_0x4b7622['rx'][_0xfb1e('0x19')](_0x2f3d7e);if(_0x3cf40c){_0x30b991=_0x3cf40c[0x1];}else{_0x30b991=null;}}else{_0x30b991=null;}_0x4b7622['cb'](null,{'code':_0x2f7b2e,'result':_0x4f33f8,'extra':_0x30b991});}});_0x2c7116['on'](_0xfb1e('0x1a'),function(_0x2b0116){_0xb70c57['emit'](_0xfb1e('0x1a'),new AGIError(_0xfb1e('0x1b'),_0x2b0116[_0xfb1e('0x1c')]));});_0x2c7116['on'](_0xfb1e('0x1d'),function(){_0xb70c57[_0xfb1e('0x8')]('close',new AGIError(_0xfb1e('0x1e')));});_0x2c7116['on']('timeout',function(){_0xb70c57['emit'](_0xfb1e('0x1f'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2c7116[_0xfb1e('0x20')]();});_0x2c7116[_0xfb1e('0x21')](_0x1ce096);this[_0xfb1e('0x22')]=function(_0x484d67,_0x548dc0){var _0x484d67=_0x484d67||'',_0x548dc0=typeof _0x548dc0==_0xfb1e('0x11')?_0x548dc0:new Function();_0x4b7622={'tx':_0x484d67,'rx':'','cb':_0x548dc0};_0x2c7116[_0xfb1e('0x23')](_0x484d67+'\x0a');},this[_0xfb1e('0x1d')]=function(){_0x2c7116[_0xfb1e('0x20')]();};}util[_0xfb1e('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x26')]=function(_0x4e24e3){return this[_0xfb1e('0x22')][_0xfb1e('0x27')](this,_0x4e24e3);};AGIChannel[_0xfb1e('0x25')]['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x28')]=function(_0x20826c,_0x4412d0,_0x3108b6){_0x20826c=_0x20826c===undefined?_0xfb1e('0x29'):_0x20826c;_0x4412d0=_0x4412d0===undefined?'5':_0x4412d0;_0x3108b6=_0x3108b6===undefined?'1':_0x3108b6;return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x2b'),_0x20826c,_0x4412d0*0x3e8,_0x3108b6));};AGIChannel['prototype'][_0xfb1e('0x2c')]=function(_0x2dfa98){_0x2dfa98=_0x2dfa98||_0xfb1e('0x2d');return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x2e'),_0x2dfa98));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x2f')]=function(_0x55a618,_0x35f2f3){if(_[_0xfb1e('0x30')](_0x35f2f3)){return this[_0xfb1e('0x26')](util['format'](_0xfb1e('0x31'),_0x55a618,_0x35f2f3['join'](',')));}return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x31'),_0x55a618,_0x35f2f3));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x32')]=function(_0x3fff90){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x33'),_0x3fff90));};AGIChannel['prototype'][_0xfb1e('0x34')]=function(_0x13b590){return this['sendRequest'](util[_0xfb1e('0x2a')](_0xfb1e('0x35'),_0x13b590));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x36')]=function(_0x8c628f){return this[_0xfb1e('0x26')](util['format']('SET\x20PRIORITY\x20%s',_0x8c628f));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0xc')]=function(){return this['sendRequest'](_0xfb1e('0x37'));};AGIChannel['prototype'][_0xfb1e('0x38')]=function(_0x3fc4de,_0x573bcc){var _0x2b375a=_['isBoolean'](_0x573bcc)||_[_0xfb1e('0x39')](_0x573bcc)?_0x573bcc[_0xfb1e('0x3a')]():_0x573bcc;return this[_0xfb1e('0x26')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3fc4de,_0x2b375a?_0x2b375a[_0xfb1e('0x3a')]()[_0xfb1e('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfb1e('0x25')]['sayNumber']=function(_0x54e3d2,_0x33514d){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x3b'),_0x54e3d2,_0x33514d));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x3c')]=function(_0x35c2ae,_0x4eb62c){return this['sendRequest'](util[_0xfb1e('0x2a')](_0xfb1e('0x3d'),_0x35c2ae,_0x4eb62c));};AGIChannel[_0xfb1e('0x25')]['sayPhonetic']=function(_0x220512,_0x166558){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x220512,_0x166558));};AGIChannel[_0xfb1e('0x25')]['continueAt']=function(_0x371a1e,_0x4800a3,_0x4787a0){_0x4800a3=_0x4800a3||this[_0xfb1e('0x3e')];_0x4787a0=_0x4787a0||0x1;this['setContext'](_0x371a1e);this[_0xfb1e('0x34')](_0x4800a3);this[_0xfb1e('0x36')](_0x4787a0);return this[_0xfb1e('0x2c')](util[_0xfb1e('0x2a')](_0xfb1e('0x3f'),_0x371a1e,_0x4800a3,_0x4787a0));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x40')]=function(_0xa8f62d){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x41'),_0xa8f62d));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x42')]=function(_0x5c423b,_0x3a935e,_0x366f46,_0x310655,_0x5c7bf3,_0x2770fd){_0x3a935e=_0x3a935e||'wav';_0x366f46=_0x366f46||'';_0x310655=_0x310655===undefined?-0x1:_0x310655==='-1'?-0x1:_0x310655*0x3e8;_0x5c7bf3=_0x5c7bf3===undefined?'':'s='+_0x5c7bf3;_0x2770fd=_0x2770fd?_0xfb1e('0x43'):'';return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x44'),_0x5c423b,_0x3a935e,_0x366f46,_0x310655,_0x2770fd,_0x5c7bf3));};AGIChannel[_0xfb1e('0x25')]['streamFile']=function(_0x2c80b7,_0x54d3e7){_0x54d3e7=_0x54d3e7||'';return this[_0xfb1e('0x26')](util['format'](_0xfb1e('0x45'),_0x2c80b7,_0x54d3e7));};AGIChannel[_0xfb1e('0x25')]['agi']=function(_0x2ff83e){return this[_0xfb1e('0x2f')]('AGI',_0x2ff83e);};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x46')]=function(_0x3da297){return this[_0xfb1e('0x2f')](_0xfb1e('0x47'),_0x3da297);};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x1a')]=function(_0x364b37,_0x51d055){this[_0xfb1e('0x2c')](util[_0xfb1e('0x2a')](_0xfb1e('0x48'),_0x364b37['id'],_0x364b37[_0xfb1e('0x49')],_0x51d055));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfb1e('0x4a')]=AGIChannel; \ No newline at end of file +var _0x109b=['events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','line','emit','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','ANSWER','beep','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','wait','WAIT','label','util','lodash'];(function(_0x7d286f,_0x1677de){var _0x3748cf=function(_0x11158d){while(--_0x11158d){_0x7d286f['push'](_0x7d286f['shift']());}};_0x3748cf(++_0x1677de);}(_0x109b,0x175));var _0xb109=function(_0x32f739,_0x5052e2){_0x32f739=_0x32f739-0x0;var _0x10463e=_0x109b[_0x32f739];return _0x10463e;};'use strict';var util=require(_0xb109('0x0'));var _=require(_0xb109('0x1'));var EventEmitter=require(_0xb109('0x2'))[_0xb109('0x3')];var AGIReply=require(_0xb109('0x4'));var AGIError=require(_0xb109('0x5'));function AGIChannel(_0x4dc44b){var _0x5c240e=this,_0x2677b6=new AGIReply(),_0x412ce6=![],_0x3e9064={};EventEmitter[_0xb109('0x6')](_0x5c240e);_0x4dc44b[_0xb109('0x7')](_0xb109('0x8'));_0x4dc44b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2677b6[_0xb109('0x7')](_0xb109('0x8'));_0x2677b6['on'](_0xb109('0x9'),function(_0x42736e){for(var _0x5d12ec in _0x42736e){_0x5c240e[_0x5d12ec]=_0x42736e[_0x5d12ec];}_0x5c240e['emit']('ready');});_0x2677b6['on'](_0xb109('0xa'),function(_0x570c04){if(_0x570c04['toLowerCase']()=='hangup'){_0x5c240e[_0xb109('0xb')]('hangup');return;}if(_0x570c04['substring'](0x0,0xb)=='520-Invalid'){_0x412ce6=!![];}if(_0x412ce6){_0x3e9064['rx']+=_0x570c04+'\x0a';if(_0x570c04[_0xb109('0xc')](_0xb109('0xd'))!=-0x1){_0x412ce6=![];}}else{_0x3e9064['rx']=_0x570c04;}if(_0x412ce6){return;}if(typeof _0x3e9064['cb']=='function'){var _0xaf4770=_0x3e9064['rx'][_0xb109('0xe')](0x0,0x3),_0x3f1885=null,_0x1126a7=null;_0xaf4770=parseInt(_0xaf4770);if(isNaN(_0xaf4770)){_0x3e9064['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb109('0xf')});return;}if(_0xaf4770!=0xc8){_0x3e9064['cb'](null,{'code':_0xaf4770,'result':-0x1,'extra':'KO'});return;}_0x3f1885=_0x3e9064['rx'][_0xb109('0xe')](0x4)[_0xb109('0x10')](_0xb109('0x11'),'');if(_0x3f1885[_0xb109('0x12')]('\x20')!=-0x1){_0x3f1885=_0x3f1885[_0xb109('0x13')](0x0,_0x3f1885[_0xb109('0x12')]('\x20'));}if(_[_0xb109('0x14')](_0x3f1885,'-1')){_0x3f1885=parseInt(_0x3f1885);}_0x1126a7=_0x3e9064['rx'][_0xb109('0x15')]('\x20');if(_0x1126a7[_0xb109('0x16')]==0x3){_0x1126a7=_0x1126a7[0x2][_0xb109('0xe')](0x1,_0x1126a7[0x2][_0xb109('0x16')]-0x1);}else if(_0x1126a7[_0xb109('0x16')]>0x3){var _0x2ea5ed=/\((.+)\)/;var _0x1ac2f6=_0x3e9064['rx'][_0xb109('0x17')](_0x2ea5ed);if(_0x1ac2f6){_0x1126a7=_0x1ac2f6[0x1];}else{_0x1126a7=null;}}else{_0x1126a7=null;}_0x3e9064['cb'](null,{'code':_0xaf4770,'result':_0x3f1885,'extra':_0x1126a7});}});_0x4dc44b['on'](_0xb109('0x18'),function(_0x514d10){_0x5c240e['emit'](_0xb109('0x18'),new AGIError(_0xb109('0x19'),_0x514d10[_0xb109('0x1a')]));});_0x4dc44b['on']('close',function(){_0x5c240e[_0xb109('0xb')](_0xb109('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4dc44b['on'](_0xb109('0x1c'),function(){_0x5c240e[_0xb109('0xb')]('timeout',new AGIError(_0xb109('0x1d')));_0x4dc44b[_0xb109('0x1e')]();});_0x4dc44b[_0xb109('0x1f')](_0x2677b6);this[_0xb109('0x20')]=function(_0x26f202,_0x3314ee){var _0x26f202=_0x26f202||'',_0x3314ee=typeof _0x3314ee=='function'?_0x3314ee:new Function();_0x3e9064={'tx':_0x26f202,'rx':'','cb':_0x3314ee};_0x4dc44b[_0xb109('0x21')](_0x26f202+'\x0a');},this[_0xb109('0x1b')]=function(){_0x4dc44b[_0xb109('0x1e')]();};}util[_0xb109('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xb109('0x23')][_0xb109('0x24')]=function(_0x4518a7){return this['command'][_0xb109('0x25')](this,_0x4518a7);};AGIChannel[_0xb109('0x23')]['answer']=function(){return this[_0xb109('0x24')](_0xb109('0x26'));};AGIChannel[_0xb109('0x23')]['getData']=function(_0x96feb4,_0x22fe35,_0x15d1dc){_0x96feb4=_0x96feb4===undefined?_0xb109('0x27'):_0x96feb4;_0x22fe35=_0x22fe35===undefined?'5':_0x22fe35;_0x15d1dc=_0x15d1dc===undefined?'1':_0x15d1dc;return this[_0xb109('0x24')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x96feb4,_0x22fe35*0x3e8,_0x15d1dc));};AGIChannel[_0xb109('0x23')]['noop']=function(_0x23905d){_0x23905d=_0x23905d||'NO\x20MESSAGE';return this[_0xb109('0x24')](util[_0xb109('0x28')](_0xb109('0x29'),_0x23905d));};AGIChannel[_0xb109('0x23')]['exec']=function(_0x4e4081,_0x47444e){if(_[_0xb109('0x2a')](_0x47444e)){return this[_0xb109('0x24')](util[_0xb109('0x28')]('EXEC\x20%s\x20%s',_0x4e4081,_0x47444e['join'](',')));}return this['sendRequest'](util['format'](_0xb109('0x2b'),_0x4e4081,_0x47444e));};AGIChannel[_0xb109('0x23')][_0xb109('0x2c')]=function(_0x2f8e24){return this[_0xb109('0x24')](util['format'](_0xb109('0x2d'),_0x2f8e24));};AGIChannel[_0xb109('0x23')]['setExtension']=function(_0x22b1c6){return this[_0xb109('0x24')](util[_0xb109('0x28')](_0xb109('0x2e'),_0x22b1c6));};AGIChannel[_0xb109('0x23')][_0xb109('0x2f')]=function(_0x550a41){return this[_0xb109('0x24')](util[_0xb109('0x28')](_0xb109('0x30'),_0x550a41));};AGIChannel['prototype']['hangup']=function(){return this[_0xb109('0x24')](_0xb109('0x31'));};AGIChannel[_0xb109('0x23')][_0xb109('0x32')]=function(_0x379fd0,_0x3ce5dd){var _0x142874=_[_0xb109('0x33')](_0x3ce5dd)||_[_0xb109('0x34')](_0x3ce5dd)?_0x3ce5dd[_0xb109('0x35')]():_0x3ce5dd;return this[_0xb109('0x24')](util[_0xb109('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x379fd0,_0x142874?_0x142874['toString']()[_0xb109('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xb109('0x36')]=function(_0x2e1d11,_0x35a15f){return this[_0xb109('0x24')](util[_0xb109('0x28')](_0xb109('0x37'),_0x2e1d11,_0x35a15f));};AGIChannel[_0xb109('0x23')][_0xb109('0x38')]=function(_0x20ed0d,_0xc8d813){return this['sendRequest'](util['format'](_0xb109('0x39'),_0x20ed0d,_0xc8d813));};AGIChannel[_0xb109('0x23')]['sayPhonetic']=function(_0xec8acb,_0x552ba9){return this['sendRequest'](util[_0xb109('0x28')](_0xb109('0x3a'),_0xec8acb,_0x552ba9));};AGIChannel['prototype'][_0xb109('0x3b')]=function(_0x64a94c,_0x36fc3f,_0xfda292){_0x36fc3f=_0x36fc3f||this[_0xb109('0x3c')];_0xfda292=_0xfda292||0x1;this[_0xb109('0x2c')](_0x64a94c);this['setExtension'](_0x36fc3f);this['setPriority'](_0xfda292);return this[_0xb109('0x3d')](util[_0xb109('0x28')](_0xb109('0x3e'),_0x64a94c,_0x36fc3f,_0xfda292));};AGIChannel['prototype']['getVariable']=function(_0x51a831){return this['sendRequest'](util[_0xb109('0x28')](_0xb109('0x3f'),_0x51a831));};AGIChannel['prototype'][_0xb109('0x40')]=function(_0x9da72,_0x1486ce,_0x5804c6,_0x1f83f1,_0x9f56f,_0x327c86){_0x1486ce=_0x1486ce||_0xb109('0x41');_0x5804c6=_0x5804c6||'';_0x1f83f1=_0x1f83f1===undefined?-0x1:_0x1f83f1==='-1'?-0x1:_0x1f83f1*0x3e8;_0x9f56f=_0x9f56f===undefined?'':'s='+_0x9f56f;_0x327c86=_0x327c86?_0xb109('0x42'):'';return this[_0xb109('0x24')](util['format'](_0xb109('0x43'),_0x9da72,_0x1486ce,_0x5804c6,_0x1f83f1,_0x327c86,_0x9f56f));};AGIChannel['prototype'][_0xb109('0x44')]=function(_0x3aef1a,_0x1e6f8b){_0x1e6f8b=_0x1e6f8b||'';return this[_0xb109('0x24')](util[_0xb109('0x28')](_0xb109('0x45'),_0x3aef1a,_0x1e6f8b));};AGIChannel['prototype'][_0xb109('0x46')]=function(_0x4ef8b0){return this[_0xb109('0x47')]('AGI',_0x4ef8b0);};AGIChannel[_0xb109('0x23')][_0xb109('0x48')]=function(_0x8b2d8d){return this[_0xb109('0x47')](_0xb109('0x49'),_0x8b2d8d);};AGIChannel[_0xb109('0x23')][_0xb109('0x18')]=function(_0x3f5778,_0x2a1857){this[_0xb109('0x3d')](util[_0xb109('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3f5778['id'],_0x3f5778[_0xb109('0x4a')],_0x2a1857));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7ddaf53..0dd879d 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 _0xe8b3=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0xe8b3,0x1db));var _0x3e8b=function(_0x3bf03f,_0xbfd44){_0x3bf03f=_0x3bf03f-0x0;var _0x29dc98=_0xe8b3[_0x3bf03f];return _0x29dc98;};'use strict';var util=require(_0x3e8b('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x3e8b('0x1'),'E_AGI_SERVER_ERROR':_0x3e8b('0x2'),'E_AGI_SERVER_CLOSE':_0x3e8b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x3e8b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x3e8b('0x5'),'E_AGI_SOCKET_CLOSE':_0x3e8b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x3e8b('0x7'),'E_AGI_COMMAND_EMPTY':_0x3e8b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3e8b('0x9'),'E_AGI_IVR_ENTRY':_0x3e8b('0xa')};function AGIError(_0x342f53){var _0x342f53=_0x342f53||null,_0x5897a6=_0x5897a6||[],_0x17c585=0x1,_0x22a194='';if(!error[_0x342f53]){_0x342f53='E_AGI_UNDEFINED';}_0x5897a6[_0x3e8b('0xb')](error[_0x342f53]);while(arguments[_0x17c585]){_0x5897a6[_0x3e8b('0xb')](arguments[_0x17c585]);_0x17c585++;}_0x22a194=util['format'][_0x3e8b('0xc')](util,_0x5897a6);this[_0x3e8b('0xd')]=_0x22a194;this['name']=_0x342f53;}module[_0x3e8b('0xe')]=AGIError; \ No newline at end of file +var _0x5427=['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.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x5427,0x16e));var _0x7542=function(_0x5959f4,_0x334a4d){_0x5959f4=_0x5959f4-0x0;var _0x54fa39=_0x5427[_0x5959f4];return _0x54fa39;};'use strict';var util=require(_0x7542('0x0'));var error={'E_AGI_UNDEFINED':_0x7542('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7542('0x2'),'E_AGI_SERVER_CLOSE':_0x7542('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7542('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7542('0x5'),'E_AGI_SOCKET_ERROR':_0x7542('0x6'),'E_AGI_SOCKET_CLOSE':_0x7542('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7542('0x8'),'E_AGI_IVR_ENTRY':_0x7542('0x9')};function AGIError(_0x456627){var _0x456627=_0x456627||null,_0x3663c7=_0x3663c7||[],_0x3ebd17=0x1,_0x34cf7a='';if(!error[_0x456627]){_0x456627='E_AGI_UNDEFINED';}_0x3663c7[_0x7542('0xa')](error[_0x456627]);while(arguments[_0x3ebd17]){_0x3663c7['push'](arguments[_0x3ebd17]);_0x3ebd17++;}_0x34cf7a=util[_0x7542('0xb')][_0x7542('0xc')](util,_0x3663c7);this[_0x7542('0xd')]=_0x34cf7a;this[_0x7542('0xe')]=_0x456627;}module[_0x7542('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 6b749fe..5903b21 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 _0x23c4=['redis','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','EventEmitter','./error','defaults'];(function(_0x3bab53,_0x46230f){var _0x1a969e=function(_0x15ecb1){while(--_0x15ecb1){_0x3bab53['push'](_0x3bab53['shift']());}};_0x1a969e(++_0x46230f);}(_0x23c4,0x1a1));var _0x423c=function(_0x67655b,_0x15ff31){_0x67655b=_0x67655b-0x0;var _0x71c09d=_0x23c4[_0x67655b];return _0x71c09d;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x423c('0x0')];var Redis=require('ioredis');var AGIError=require(_0x423c('0x1'));var config=require('../../config/environment');config['redis']=_[_0x423c('0x2')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x423c('0x3')]);sub[_0x423c('0x4')](_0x423c('0x5'),function(_0x2e3342){if(_0x2e3342)return eventEmitter[_0x423c('0x6')](_0x423c('0x7'),new AGIError(_0x423c('0x8'),_0x2e3342));});sub['on'](_0x423c('0x9'),function(_0x554e66,_0x51943c){if(_0x554e66!=='agi')return;try{var _0x3650d9=JSON[_0x423c('0xa')](_0x51943c);eventEmitter[_0x423c('0x6')](_0x423c('0xb'),_0x3650d9);}catch(_0x1ba407){eventEmitter[_0x423c('0x6')](_0x423c('0x7'),new AGIError(_0x423c('0x8'),_0x1ba407));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x2fbb=['emit','error','message','E_AGI_SERVER_ERROR','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x225455,_0x4f2550){var _0x1c7c68=function(_0x644867){while(--_0x644867){_0x225455['push'](_0x225455['shift']());}};_0x1c7c68(++_0x4f2550);}(_0x2fbb,0x1e4));var _0xb2fb=function(_0x5a6cdf,_0x56d1cd){_0x5a6cdf=_0x5a6cdf-0x0;var _0x1fdcc1=_0x2fbb[_0x5a6cdf];return _0x1fdcc1;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xb2fb('0x0')];var Redis=require(_0xb2fb('0x1'));var AGIError=require(_0xb2fb('0x2'));var config=require(_0xb2fb('0x3'));config['redis']=_['defaults'](config[_0xb2fb('0x4')],{'host':_0xb2fb('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb2fb('0x4')]);sub[_0xb2fb('0x6')](_0xb2fb('0x7'),function(_0x355cc4){if(_0x355cc4)return eventEmitter[_0xb2fb('0x8')](_0xb2fb('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x355cc4));});sub['on'](_0xb2fb('0xa'),function(_0x1a7051,_0x220e62){if(_0x1a7051!==_0xb2fb('0x7'))return;try{var _0x107a56=JSON['parse'](_0x220e62);eventEmitter[_0xb2fb('0x8')]('projectUpdate',_0x107a56);}catch(_0x280815){eventEmitter[_0xb2fb('0x8')](_0xb2fb('0x9'),new AGIError(_0xb2fb('0xb'),_0x280815));}});module['exports']={'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 77acaa1..8d6949b 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 _0x928c=['vertices','edges','addVertex','prototype','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','menu','getsecretdigits'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0x928c,0x1a0));var _0xc928=function(_0x718b2e,_0x28cb02){_0x718b2e=_0x718b2e-0x0;var _0x3513e6=_0x928c[_0x718b2e];return _0x3513e6;};'use strict';var _=require(_0xc928('0x0'));var logger=require(_0xc928('0x1'))('agi');var verticesWithRetry=[_0xc928('0x2'),'getdigits',_0xc928('0x3')];var Graph=function(){this[_0xc928('0x4')]={};this[_0xc928('0x5')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xc928('0x6')]=function(_0x246eb9){this['vertices'][_0x246eb9['id']]=_0x246eb9;this['edges'][_0x246eb9['id']]=[];};Graph[_0xc928('0x7')][_0xc928('0x8')]=function(_0x57be17,_0x17c4ec,_0x114f13){this[_0xc928('0x5')][_0x57be17][_0xc928('0x9')]({'target':_0x17c4ec,'condition':_0x114f13});this['numberOfEdges']+=0x1;};Graph[_0xc928('0x7')][_0xc928('0xa')]=function(){return _[_0xc928('0xa')](this[_0xc928('0x4')]);};Graph['prototype'][_0xc928('0xb')]=function(){return this['numberOfEdges'];};Graph[_0xc928('0x7')][_0xc928('0xc')]=function(_0x2f0d7a){return this[_0xc928('0x4')][_0x2f0d7a];};Graph[_0xc928('0x7')][_0xc928('0xd')]=function(_0xfe10ae,_0x512d71){if(!this[_0xc928('0x4')][_0xfe10ae]){return logger['info'](_0xc928('0xe'));}var _0x287864=_0x512d71(this['vertices'][_0xfe10ae]);if(!_0x287864){return logger[_0xc928('0xf')]('stop\x20traverse');}if(this[_0xc928('0x5')][_0xfe10ae]['length']===0x0){return logger[_0xc928('0xf')](_0xc928('0x10'));}for(var _0x13776c=0x0,_0x7e915a=[],_0x58f39b=![];_0x13776c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','createSquareReport','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','listening','connection','lodash','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x1a1757,_0x52d430){var _0x4f9430=function(_0x4ff842){while(--_0x4ff842){_0x1a1757['push'](_0x1a1757['shift']());}};_0x4f9430(++_0x52d430);}(_0xb4f5,0x64));var _0x5b4f=function(_0x3439ef,_0x198707){_0x3439ef=_0x3439ef-0x0;var _0x3c7937=_0xb4f5[_0x3439ef];return _0x3c7937;};'use strict';var _=require(_0x5b4f('0x0'));var syncho=require(_0x5b4f('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x5b4f('0x2'))(_0x5b4f('0x3'));var utilLicense=require(_0x5b4f('0x4'));var rpc=require(_0x5b4f('0x5'));var Project=require(_0x5b4f('0x6'));var AGIEmitter=require(_0x5b4f('0x7'))['EventEmitter'];var projects=[];config[_0x5b4f('0x3')]=_[_0x5b4f('0x8')](config[_0x5b4f('0x3')],{'ip':_0x5b4f('0x9'),'port':0x11dd});AGIEmitter['on'](_0x5b4f('0xa'),projectUpdateHandler);function connectionHandler(_0x2e6dce){process[_0x5b4f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2e6dce);agiHandler(_0x2e6dce);}catch(_0x301cb6){logger[_0x5b4f('0xc')](_0x301cb6[_0x5b4f('0xd')]);}});});}function projectUpdateHandler(_0x241293){try{var _0x2e2e2f=_['findIndex'](projects,['id',_0x241293['id']]);if(_0x2e2e2f>-0x1){if(_0x241293[_0x5b4f('0xe')]===!![]){projects[_0x5b4f('0xf')](_0x2e2e2f,0x1);}else{projects[_0x2e2e2f]=_0x241293;}}else{projects[_0x5b4f('0x10')](_0x241293);}}catch(_0x21628c){logger[_0x5b4f('0xc')](_0x21628c[_0x5b4f('0xd')]);}}function listeningHandler(){var _0x2fef07=config['env']===_0x5b4f('0x11')||![];console[_0x5b4f('0x12')](_0x5b4f('0x13'),config[_0x5b4f('0x3')]['port']);logger[_0x5b4f('0x14')](util['format'](_0x5b4f('0x15'),_0x2fef07?config[_0x5b4f('0x3')]['ip']:_0x5b4f('0x16'),config[_0x5b4f('0x3')][_0x5b4f('0x17')]));}function errorHandler(_0x47add5){if(_0x47add5&&_0x47add5[_0x5b4f('0x18')]&&_0x47add5[_0x5b4f('0x19')]){logger[_0x5b4f('0xc')](util[_0x5b4f('0x1a')]('[%s]\x20%s',_0x47add5[_0x5b4f('0x18')],_0x47add5['message']));}else{logger['error'](util[_0x5b4f('0x1a')](_0x5b4f('0x1b'),_0x47add5['stack']));}}function closeHandler(){logger['info'](util[_0x5b4f('0x1a')](_0x5b4f('0x1c'),this['arg_1'],this[_0x5b4f('0x1d')],this['callerid'],this[_0x5b4f('0x1e')],this[_0x5b4f('0x1f')]));try{createSquareReport(this);}catch(_0x19f58f){logger['error'](_0x19f58f[_0x5b4f('0xd')]);}}function timeoutHandler(){logger[_0x5b4f('0x14')](util[_0x5b4f('0x1a')](_0x5b4f('0x20'),this[_0x5b4f('0x21')],this[_0x5b4f('0x1d')],this['callerid'],this['dnid'],this[_0x5b4f('0x1f')]));}function hangupHandler(){logger[_0x5b4f('0x14')](util['format'](_0x5b4f('0x22'),this[_0x5b4f('0x21')],this[_0x5b4f('0x1d')],this[_0x5b4f('0x23')],this[_0x5b4f('0x1e')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x1e921a,_0x2f2af6){rpc[_0x5b4f('0x24')](_0x1e921a)['then'](function(_0x11e15c){if(_0x2f2af6){_0x2f2af6(null,_0x11e15c);}})[_0x5b4f('0x25')](function(_0x3223e4){if(_0x2f2af6){_0x2f2af6(null,_0x3223e4);}});}function setChannelVariables(_0x500866){for(var _0x396bc7 in _0x500866){if(_0x500866[_0x5b4f('0x26')](_0x396bc7)){if(_0x396bc7[_0x5b4f('0x27')]('agi_')===0x0){_0x500866[_0x396bc7[_0x5b4f('0x28')](0x4)]=_0x500866[_0x396bc7];delete _0x500866[_0x396bc7];}}}}function agiHandler(_0x197166){logger[_0x5b4f('0x29')](_0x5b4f('0x2a'),JSON[_0x5b4f('0x2b')](_0x197166,null,0x2));logger['info'](util[_0x5b4f('0x1a')](_0x5b4f('0x2c'),_0x197166[_0x5b4f('0x21')],_0x197166[_0x5b4f('0x1d')],_0x197166[_0x5b4f('0x23')],_0x197166['dnid'],_0x197166[_0x5b4f('0x1f')]));_0x197166['on'](_0x5b4f('0xc'),errorHandler);_0x197166['on'](_0x5b4f('0x2d'),closeHandler);_0x197166['on']('timeout',timeoutHandler);_0x197166[_0x5b4f('0x2e')]=![];_0x197166['on']('hangup',hangupHandler);var _0x5beb2a=_['find'](projects,[_0x5b4f('0x18'),_0x197166[_0x5b4f('0x21')]]);if(!_0x5beb2a)return Project[_0x5b4f('0x2f')](_0x197166);if(!_0x5beb2a[_0x5b4f('0x11')])return Project[_0x5b4f('0x30')](_0x197166);return Project[_0x5b4f('0x31')](_0x5beb2a,_0x197166);}function main(){var _0x2944aa;return utilLicense[_0x5b4f('0x32')]()[_0x5b4f('0x33')](function(_0xe0eeb9){if(!_0xe0eeb9)return;if(_0xe0eeb9[_0x5b4f('0x34')]){if(_0xe0eeb9[_0x5b4f('0x35')]&&_0xe0eeb9['callysquare']>0x0){logger[_0x5b4f('0x14')](util['format'](_0x5b4f('0x36'),_0xe0eeb9['callysquare']));_0x2944aa=_0xe0eeb9[_0x5b4f('0x35')];}else{logger[_0x5b4f('0x14')](_0x5b4f('0x37'));}}else{logger['info'](_0x5b4f('0x38'));_0x2944aa=-0x1;}})[_0x5b4f('0x33')](function(){return Project['getAll']();})[_0x5b4f('0x33')](function(_0x24b82a){projects=_0x24b82a;return;})[_0x5b4f('0x25')](function(_0x504cd9){logger[_0x5b4f('0xc')]('[LICENSE]',_0x504cd9[_0x5b4f('0xd')]);})[_0x5b4f('0x39')](function(){var _0x5c5dd3=require('./server')(config['agi'][_0x5b4f('0x17')],config['agi']['ip'],_0x2944aa);_0x5c5dd3['on']('error',errorHandler);_0x5c5dd3['on'](_0x5b4f('0x3a'),listeningHandler);_0x5c5dd3['on'](_0x5b4f('0x3b'),connectionHandler);_0x5c5dd3['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x1c75=['arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','listening','connection','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','defaults','127.0.0.1','error','stack','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x1c75,0x171));var _0x51c7=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x1c75[_0x459423];return _0x42ed14;};'use strict';var _=require(_0x51c7('0x0'));var syncho=require('syncho');var util=require(_0x51c7('0x1'));var config=require(_0x51c7('0x2'));var logger=require(_0x51c7('0x3'))(_0x51c7('0x4'));var utilLicense=require(_0x51c7('0x5'));var rpc=require('./rpc');var Project=require(_0x51c7('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x51c7('0x4')]=_[_0x51c7('0x7')](config[_0x51c7('0x4')],{'ip':_0x51c7('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x26d8d4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x26d8d4);agiHandler(_0x26d8d4);}catch(_0x412b78){logger[_0x51c7('0x9')](_0x412b78[_0x51c7('0xa')]);}});});}function projectUpdateHandler(_0x71264f){try{var _0x107c53=_['findIndex'](projects,['id',_0x71264f['id']]);if(_0x107c53>-0x1){if(_0x71264f[_0x51c7('0xb')]===!![]){projects[_0x51c7('0xc')](_0x107c53,0x1);}else{projects[_0x107c53]=_0x71264f;}}else{projects['push'](_0x71264f);}}catch(_0x2fe50d){logger[_0x51c7('0x9')](_0x2fe50d[_0x51c7('0xa')]);}}function listeningHandler(){console[_0x51c7('0xd')](_0x51c7('0xe'),config[_0x51c7('0x4')][_0x51c7('0xf')]);logger['info'](util[_0x51c7('0x10')](_0x51c7('0x11'),config['agi']['ip'],config['agi'][_0x51c7('0xf')]));}function errorHandler(_0x20fce2){if(_0x20fce2&&_0x20fce2[_0x51c7('0x12')]&&_0x20fce2[_0x51c7('0x13')]){logger[_0x51c7('0x9')](util['format'](_0x51c7('0x14'),_0x20fce2[_0x51c7('0x12')],_0x20fce2[_0x51c7('0x13')]));}else{logger['error'](util[_0x51c7('0x10')](_0x51c7('0x15'),_0x20fce2[_0x51c7('0xa')]));}}function closeHandler(){logger[_0x51c7('0x16')](util[_0x51c7('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x51c7('0x17')],this[_0x51c7('0x18')],this[_0x51c7('0x19')],this[_0x51c7('0x1a')],this[_0x51c7('0x1b')]));try{createSquareReport(this);}catch(_0x4b20ac){logger[_0x51c7('0x9')](_0x4b20ac[_0x51c7('0xa')]);}}function timeoutHandler(){logger[_0x51c7('0x16')](util['format'](_0x51c7('0x1c'),this['arg_1'],this[_0x51c7('0x18')],this['callerid'],this[_0x51c7('0x1a')],this[_0x51c7('0x1b')]));}function hangupHandler(){logger[_0x51c7('0x16')](util[_0x51c7('0x10')](_0x51c7('0x1d'),this[_0x51c7('0x17')],this[_0x51c7('0x18')],this[_0x51c7('0x19')],this['dnid'],this[_0x51c7('0x1b')]));this[_0x51c7('0x1e')]=!![];}function createSquareReport(_0x1b970c,_0x4731e2){rpc[_0x51c7('0x1f')](_0x1b970c)[_0x51c7('0x20')](function(_0x1f0883){if(_0x4731e2){_0x4731e2(null,_0x1f0883);}})['catch'](function(_0x5c3418){if(_0x4731e2){_0x4731e2(null,_0x5c3418);}});}function setChannelVariables(_0x37eca6){for(var _0x3d847f in _0x37eca6){if(_0x37eca6[_0x51c7('0x21')](_0x3d847f)){if(_0x3d847f[_0x51c7('0x22')](_0x51c7('0x23'))===0x0){_0x37eca6[_0x3d847f[_0x51c7('0x24')](0x4)]=_0x37eca6[_0x3d847f];delete _0x37eca6[_0x3d847f];}}}}function agiHandler(_0x10211c){logger[_0x51c7('0x25')](_0x51c7('0x26'),JSON['stringify'](_0x10211c,null,0x2));logger['info'](util[_0x51c7('0x10')](_0x51c7('0x27'),_0x10211c[_0x51c7('0x17')],_0x10211c[_0x51c7('0x18')],_0x10211c['callerid'],_0x10211c[_0x51c7('0x1a')],_0x10211c[_0x51c7('0x1b')]));_0x10211c['on'](_0x51c7('0x9'),errorHandler);_0x10211c['on'](_0x51c7('0x28'),closeHandler);_0x10211c['on'](_0x51c7('0x29'),timeoutHandler);_0x10211c[_0x51c7('0x1e')]=![];_0x10211c['on'](_0x51c7('0x2a'),hangupHandler);var _0x364602=_['find'](projects,['name',_0x10211c[_0x51c7('0x17')]]);if(!_0x364602)return Project[_0x51c7('0x2b')](_0x10211c);if(!_0x364602['production'])return Project[_0x51c7('0x2c')](_0x10211c);return Project['initialize'](_0x364602,_0x10211c);}function main(){var _0x28203a;return utilLicense[_0x51c7('0x2d')]()[_0x51c7('0x20')](function(_0x437110){if(!_0x437110)return;if(_0x437110[_0x51c7('0x2e')]){if(_0x437110[_0x51c7('0x2f')]&&_0x437110[_0x51c7('0x2f')]>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x437110[_0x51c7('0x2f')]));_0x28203a=_0x437110[_0x51c7('0x2f')];}else{logger[_0x51c7('0x16')](_0x51c7('0x30'));}}else{logger[_0x51c7('0x16')](_0x51c7('0x31'));_0x28203a=-0x1;}})[_0x51c7('0x20')](function(){return Project[_0x51c7('0x32')]();})[_0x51c7('0x20')](function(_0x5cc4c6){projects=_0x5cc4c6;return;})[_0x51c7('0x33')](function(_0x597e20){logger['error'](_0x51c7('0x34'),_0x597e20[_0x51c7('0xa')]);})[_0x51c7('0x35')](function(){var _0x3ae3f2=require('./server')(config['agi']['port'],config['agi']['ip'],_0x28203a);_0x3ae3f2['on'](_0x51c7('0x9'),errorHandler);_0x3ae3f2['on'](_0x51c7('0x36'),listeningHandler);_0x3ae3f2['on'](_0x51c7('0x37'),connectionHandler);_0x3ae3f2['on'](_0x51c7('0x28'),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 a0beba9..3353ab6 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 _0x44c2=['jayson/promise','client','http','request','then','error','message','catch','SendMail','bluebird'];(function(_0x49681e,_0x214fc7){var _0x1ba7df=function(_0x1f1906){while(--_0x1f1906){_0x49681e['push'](_0x49681e['shift']());}};_0x1ba7df(++_0x214fc7);}(_0x44c2,0x6d));var _0x244c=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0x44c2[_0xbc4659];return _0x5831f9;};'use strict';var BPromise=require(_0x244c('0x0'));var jayson=require(_0x244c('0x1'));var client=jayson[_0x244c('0x2')][_0x244c('0x3')]({'port':0x232b});function request(_0x4f32d8,_0x37f746){return new BPromise(function(_0x31376b,_0x4b436c){return client[_0x244c('0x4')](_0x4f32d8,_0x37f746)[_0x244c('0x5')](function(_0x2e047e){if(_0x2e047e[_0x244c('0x6')]){return _0x4b436c(_0x2e047e[_0x244c('0x6')][_0x244c('0x7')]);}else{return _0x31376b(_0x2e047e['result']);}})[_0x244c('0x8')](function(_0x32b745){return _0x4b436c(_0x32b745);});});}exports['sendMailMessage']=function(_0x4a31a4,_0x3eed83){return request(_0x244c('0x9'),{'account':_0x4a31a4,'message':_0x3eed83});}; \ No newline at end of file +var _0xcfbb=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x1645a1,_0xaaff26){var _0x496ab4=function(_0x371ad3){while(--_0x371ad3){_0x1645a1['push'](_0x1645a1['shift']());}};_0x496ab4(++_0xaaff26);}(_0xcfbb,0x170));var _0xbcfb=function(_0x6923ea,_0x4b5785){_0x6923ea=_0x6923ea-0x0;var _0x37b5d1=_0xcfbb[_0x6923ea];return _0x37b5d1;};'use strict';var BPromise=require(_0xbcfb('0x0'));var jayson=require(_0xbcfb('0x1'));var client=jayson[_0xbcfb('0x2')][_0xbcfb('0x3')]({'port':0x232b});function request(_0x27067a,_0xe23838){return new BPromise(function(_0x247642,_0x1efe92){return client['request'](_0x27067a,_0xe23838)[_0xbcfb('0x4')](function(_0x359bbf){if(_0x359bbf['error']){return _0x1efe92(_0x359bbf[_0xbcfb('0x5')][_0xbcfb('0x6')]);}else{return _0x247642(_0x359bbf[_0xbcfb('0x7')]);}})[_0xbcfb('0x8')](function(_0x5dfa29){return _0x1efe92(_0x5dfa29);});});}exports[_0xbcfb('0x9')]=function(_0x26e2b3,_0xc02da3){return request(_0xbcfb('0xa'),{'account':_0x26e2b3,'message':_0xc02da3});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 10e5338..127f819 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 _0x9dd9=['stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','debug','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','uniqueid','traverseBFS','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','addEdge','target','value','toJson','root','inspect','production','start'];(function(_0x576964,_0x3c2dc9){var _0x129325=function(_0x388c92){while(--_0x388c92){_0x576964['push'](_0x576964['shift']());}};_0x129325(++_0x3c2dc9);}(_0x9dd9,0x165));var _0x99dd=function(_0x1bd321,_0x323d83){_0x1bd321=_0x1bd321-0x0;var _0x3a70d8=_0x9dd9[_0x1bd321];return _0x3a70d8;};'use strict';var _=require('lodash');var moment=require(_0x99dd('0x0'));var parser=require(_0x99dd('0x1'));var util=require(_0x99dd('0x2'));var logger=require('../../config/logger')(_0x99dd('0x3'));var rpc=require(_0x99dd('0x4'));var mailRpc=require(_0x99dd('0x5'));var Graph=require(_0x99dd('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x99dd('0x7')](function(_0x2bdb93){logger[_0x99dd('0x8')](_0x99dd('0x9'),_0x2bdb93[_0x99dd('0xa')]);return[];});}function addVertex(_0x226977,_0x466fdf,_0x5a6b95){_0x466fdf[_0x99dd('0xb')]=_0x5a6b95;if(_0x466fdf[_0x99dd('0xc')](_0x99dd('0xd'))){_0x466fdf[_0x99dd('0xe')]=parseInt(_0x466fdf[_0x99dd('0xd')],0xa);}_0x226977[_0x99dd('0xf')](_['omit'](_0x466fdf,_0x99dd('0x10')));}function initGraph(_0x4c03fc,_0x3fd8aa){var _0x314b30=new Graph();for(var _0x14c098 in _0x4c03fc){if(_0x4c03fc['hasOwnProperty'](_0x14c098)){if(_['isArray'](_0x4c03fc[_0x14c098])){for(var _0x10d6c7=0x0;_0x10d6c7<_0x4c03fc[_0x14c098]['length'];_0x10d6c7+=0x1){addVertex(_0x314b30,_0x4c03fc[_0x14c098][_0x10d6c7],_0x14c098);}}else{addVertex(_0x314b30,_0x4c03fc[_0x14c098],_0x14c098);}}}for(var _0x4b73e3=0x0;_0x4b73e3<_0x3fd8aa[_0x99dd('0x11')];_0x4b73e3+=0x1){if(_0x3fd8aa[_0x4b73e3][_0x99dd('0x12')]&&_0x3fd8aa[_0x4b73e3]['target']){_0x314b30[_0x99dd('0x13')](_0x3fd8aa[_0x4b73e3][_0x99dd('0x12')],_0x3fd8aa[_0x4b73e3][_0x99dd('0x14')],_0x3fd8aa[_0x4b73e3][_0x99dd('0x15')]);}}return _0x314b30;}function getRoot(_0x3b4d07){return parser[_0x99dd('0x16')](_0x3b4d07,{'object':!![]})['mxGraphModel'][_0x99dd('0x17')];}function inspect(_0x4be99e){return util[_0x99dd('0x18')](_0x4be99e,{'showHidden':![],'depth':null});}function initialize(_0x246763,_0x111baf){var _0x12bb75=getRoot(_0x246763[_0x99dd('0x19')]);if(!_0x12bb75||!_0x12bb75[_0x99dd('0x1a')])return;var _0x1ceac3,_0x87c6b4,_0x3a9dfd;logger['debug'](_0x99dd('0x17'),JSON[_0x99dd('0x1b')](_0x12bb75,null,0x2));_0x111baf[_0x99dd('0x1c')]=moment()['format'](_0x99dd('0x1d'));_0x1ceac3=initGraph(_[_0x99dd('0x1e')](_0x12bb75,'mxCell'),_0x12bb75[_0x99dd('0x10')]);_0x87c6b4=new Vertices(_0x111baf,rpc,mailRpc);logger[_0x99dd('0x1f')](util[_0x99dd('0x20')](_0x99dd('0x21'),_0x111baf[_0x99dd('0x22')],_0x111baf[_0x99dd('0x23')],_0x111baf[_0x99dd('0x24')],_0x111baf[_0x99dd('0x25')],_0x111baf['uniqueid']));_0x1ceac3['traverseBFS'](_0x12bb75['start']['id'],function(_0x32d1bd){try{_0x32d1bd=_0x87c6b4[_0x99dd('0x26')](_0x32d1bd);logger['debug'](_0x99dd('0x27'),JSON[_0x99dd('0x1b')](_0x32d1bd,null,0x2));if(_0x32d1bd[_0x99dd('0xb')]===_0x99dd('0x28')){logger['info'](_0x99dd('0x29'));_0x111baf['context']=_0x32d1bd['context']||_0x111baf[_0x99dd('0x2a')];_0x111baf[_0x99dd('0x2b')]=_0x32d1bd[_0x99dd('0x2b')];_0x111baf[_0x99dd('0x2c')]=_0x32d1bd['priority']?_0x32d1bd[_0x99dd('0x2c')]-0x1:0x1;return null;}else if(_0x32d1bd&&_0x87c6b4[_0x32d1bd[_0x99dd('0xb')]]){_0x3a9dfd=_0x87c6b4[_0x32d1bd[_0x99dd('0xb')]](_0x32d1bd);logger[_0x99dd('0x1f')](_0x99dd('0x2d'),JSON['stringify'](_0x3a9dfd,null,0x2));if(_0x3a9dfd&&_0x3a9dfd[_0x99dd('0x2e')]===AGI_CODE_SUCCESS&&_0x3a9dfd[_0x99dd('0x2f')]!==AGI_RESULT_ERROR&&!_0x111baf[_0x99dd('0x30')]){logger[_0x99dd('0x31')](_0x99dd('0x2d'),inspect(_0x3a9dfd));return _['isUndefined'](_0x3a9dfd[_0x99dd('0x2f')])?null:_0x3a9dfd[_0x99dd('0x2f')][_0x99dd('0x32')]();}else{logger[_0x99dd('0x8')](_0x99dd('0x2d'),inspect(_0x3a9dfd));return null;}}else{logger[_0x99dd('0x8')](_0x99dd('0x33'));return null;}}catch(_0x13d7bc){logger['error'](_0x13d7bc['stack']);return null;}});if(_0x12bb75[_0x99dd('0x34')]){logger[_0x99dd('0x1f')](util[_0x99dd('0x20')](_0x99dd('0x35'),_0x111baf[_0x99dd('0x22')],_0x111baf['calleridname'],_0x111baf[_0x99dd('0x24')],_0x111baf['dnid'],_0x111baf[_0x99dd('0x36')]));_0x1ceac3[_0x99dd('0x37')](_0x12bb75[_0x99dd('0x34')]['id'],function(_0x3d829a){try{_0x3d829a=_0x87c6b4[_0x99dd('0x26')](_0x3d829a);logger[_0x99dd('0x31')](_0x99dd('0x27'),JSON[_0x99dd('0x1b')](_0x3d829a,null,0x2));if(_0x3d829a&&_0x87c6b4[_0x3d829a[_0x99dd('0xb')]]){_0x3a9dfd=_0x87c6b4[_0x3d829a[_0x99dd('0xb')]](_0x3d829a);if(_0x3a9dfd){logger[_0x99dd('0x31')]('response',inspect(_0x3a9dfd));return _[_0x99dd('0x38')](_0x3a9dfd[_0x99dd('0x2f')])?null:_0x3a9dfd[_0x99dd('0x2f')][_0x99dd('0x32')]();}else{logger[_0x99dd('0x8')]('response',inspect(_0x3a9dfd));return null;}}else{logger[_0x99dd('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x30022e){logger[_0x99dd('0x8')](_0x30022e[_0x99dd('0xa')]);return null;}});}logger[_0x99dd('0x1f')](util['format'](_0x99dd('0x39'),_0x111baf[_0x99dd('0x22')],_0x111baf[_0x99dd('0x23')],_0x111baf[_0x99dd('0x24')],_0x111baf['dnid'],_0x111baf['uniqueid']));logger[_0x99dd('0x1f')](util[_0x99dd('0x20')](_0x99dd('0x3a'),_0x111baf[_0x99dd('0x2a')],_0x111baf[_0x99dd('0x2b')],parseInt(_0x111baf[_0x99dd('0x2c')],0xa)+0x1));_0x111baf[_0x99dd('0x3b')](_0x111baf[_0x99dd('0x2a')],_0x111baf[_0x99dd('0x2b')],parseInt(_0x111baf[_0x99dd('0x2c')],0xa)+0x1);_0x111baf['close']();}function handleNotFound(_0x21f2a5){logger['error'](util[_0x99dd('0x20')](_0x99dd('0x3c'),_0x21f2a5[_0x99dd('0x22')]));_0x21f2a5[_0x99dd('0x3b')](_0x21f2a5[_0x99dd('0x2a')],_0x21f2a5[_0x99dd('0x2b')],parseInt(_0x21f2a5[_0x99dd('0x2c')],0xa)+0x1);_0x21f2a5[_0x99dd('0x3d')]();}function handleUnpublished(_0xffa186){logger[_0x99dd('0x8')](util[_0x99dd('0x20')](_0x99dd('0x3e'),_0xffa186['arg_1']));_0xffa186[_0x99dd('0x3b')](_0xffa186[_0x99dd('0x2a')],_0xffa186[_0x99dd('0x2b')],parseInt(_0xffa186[_0x99dd('0x2c')],0xa)+0x1);_0xffa186['close']();}module[_0x99dd('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xc7ba=['agicommand\x20not\x20found','finally','uniqueid','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','addVertex','omit','mxCell','isArray','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','debug','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0xc7ba,0x166));var _0xac7b=function(_0x948a91,_0x68a6c3){_0x948a91=_0x948a91-0x0;var _0x400c27=_0xc7ba[_0x948a91];return _0x400c27;};'use strict';var _=require(_0xac7b('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0xac7b('0x1'));var logger=require(_0xac7b('0x2'))(_0xac7b('0x3'));var rpc=require(_0xac7b('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0xac7b('0x5'));var Vertices=require(_0xac7b('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xac7b('0x7')]()['catch'](function(_0x48257b){logger[_0xac7b('0x8')](_0xac7b('0x9'),_0x48257b[_0xac7b('0xa')]);return[];});}function addVertex(_0x3f981c,_0x54840b,_0x4a6a04){_0x54840b[_0xac7b('0xb')]=_0x4a6a04;if(_0x54840b[_0xac7b('0xc')]('retry')){_0x54840b[_0xac7b('0xd')]=parseInt(_0x54840b['retry'],0xa);}_0x3f981c[_0xac7b('0xe')](_[_0xac7b('0xf')](_0x54840b,_0xac7b('0x10')));}function initGraph(_0x388378,_0x273019){var _0x209fab=new Graph();for(var _0x23900b in _0x388378){if(_0x388378[_0xac7b('0xc')](_0x23900b)){if(_[_0xac7b('0x11')](_0x388378[_0x23900b])){for(var _0x315a3a=0x0;_0x315a3a<_0x388378[_0x23900b]['length'];_0x315a3a+=0x1){addVertex(_0x209fab,_0x388378[_0x23900b][_0x315a3a],_0x23900b);}}else{addVertex(_0x209fab,_0x388378[_0x23900b],_0x23900b);}}}for(var _0x31f4fb=0x0;_0x31f4fb<_0x273019['length'];_0x31f4fb+=0x1){if(_0x273019[_0x31f4fb][_0xac7b('0x12')]&&_0x273019[_0x31f4fb][_0xac7b('0x13')]){_0x209fab[_0xac7b('0x14')](_0x273019[_0x31f4fb][_0xac7b('0x12')],_0x273019[_0x31f4fb][_0xac7b('0x13')],_0x273019[_0x31f4fb][_0xac7b('0x15')]);}}return _0x209fab;}function getRoot(_0x49b9ae){return parser[_0xac7b('0x16')](_0x49b9ae,{'object':!![]})[_0xac7b('0x17')][_0xac7b('0x18')];}function inspect(_0x4aa576){return util['inspect'](_0x4aa576,{'showHidden':![],'depth':null});}function initialize(_0x1c8769,_0x40545a){var _0x453575=getRoot(_0x1c8769[_0xac7b('0x19')]);if(!_0x453575||!_0x453575[_0xac7b('0x1a')])return;var _0x3dcb35,_0x1bcda9,_0x4075f9;logger['debug'](_0xac7b('0x18'),JSON['stringify'](_0x453575,null,0x2));_0x40545a['joinAt']=moment()[_0xac7b('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dcb35=initGraph(_[_0xac7b('0xf')](_0x453575,_0xac7b('0x10')),_0x453575[_0xac7b('0x10')]);_0x1bcda9=new Vertices(_0x40545a,rpc,mailRpc);logger[_0xac7b('0x1c')](util[_0xac7b('0x1b')](_0xac7b('0x1d'),_0x40545a[_0xac7b('0x1e')],_0x40545a[_0xac7b('0x1f')],_0x40545a[_0xac7b('0x20')],_0x40545a[_0xac7b('0x21')],_0x40545a['uniqueid']));_0x3dcb35[_0xac7b('0x22')](_0x453575[_0xac7b('0x1a')]['id'],function(_0x35347d){try{_0x35347d=_0x1bcda9['clear'](_0x35347d);logger[_0xac7b('0x23')](_0xac7b('0x24'),JSON[_0xac7b('0x25')](_0x35347d,null,0x2));if(_0x35347d[_0xac7b('0xb')]===_0xac7b('0x26')){logger[_0xac7b('0x1c')](_0xac7b('0x27'));_0x40545a[_0xac7b('0x28')]=_0x35347d[_0xac7b('0x28')]||_0x40545a['context'];_0x40545a[_0xac7b('0x29')]=_0x35347d[_0xac7b('0x29')];_0x40545a[_0xac7b('0x2a')]=_0x35347d[_0xac7b('0x2a')]?_0x35347d['priority']-0x1:0x1;return null;}else if(_0x35347d&&_0x1bcda9[_0x35347d['agicommand']]){_0x4075f9=_0x1bcda9[_0x35347d['agicommand']](_0x35347d);logger[_0xac7b('0x1c')]('response',JSON[_0xac7b('0x25')](_0x4075f9,null,0x2));if(_0x4075f9&&_0x4075f9[_0xac7b('0x2b')]===AGI_CODE_SUCCESS&&_0x4075f9[_0xac7b('0x2c')]!==AGI_RESULT_ERROR&&!_0x40545a['evtHangup']){logger[_0xac7b('0x23')](_0xac7b('0x2d'),inspect(_0x4075f9));return _[_0xac7b('0x2e')](_0x4075f9[_0xac7b('0x2c')])?null:_0x4075f9[_0xac7b('0x2c')][_0xac7b('0x2f')]();}else{logger[_0xac7b('0x8')](_0xac7b('0x2d'),inspect(_0x4075f9));return null;}}else{logger['error'](_0xac7b('0x30'));return null;}}catch(_0x303293){logger[_0xac7b('0x8')](_0x303293[_0xac7b('0xa')]);return null;}});if(_0x453575[_0xac7b('0x31')]){logger[_0xac7b('0x1c')](util[_0xac7b('0x1b')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x40545a[_0xac7b('0x1e')],_0x40545a[_0xac7b('0x1f')],_0x40545a[_0xac7b('0x20')],_0x40545a[_0xac7b('0x21')],_0x40545a[_0xac7b('0x32')]));_0x3dcb35['traverseBFS'](_0x453575[_0xac7b('0x31')]['id'],function(_0x2fad2d){try{_0x2fad2d=_0x1bcda9[_0xac7b('0x33')](_0x2fad2d);logger[_0xac7b('0x23')](_0xac7b('0x24'),JSON[_0xac7b('0x25')](_0x2fad2d,null,0x2));if(_0x2fad2d&&_0x1bcda9[_0x2fad2d[_0xac7b('0xb')]]){_0x4075f9=_0x1bcda9[_0x2fad2d[_0xac7b('0xb')]](_0x2fad2d);if(_0x4075f9){logger[_0xac7b('0x23')](_0xac7b('0x2d'),inspect(_0x4075f9));return _['isUndefined'](_0x4075f9[_0xac7b('0x2c')])?null:_0x4075f9['result'][_0xac7b('0x2f')]();}else{logger[_0xac7b('0x8')](_0xac7b('0x2d'),inspect(_0x4075f9));return null;}}else{logger[_0xac7b('0x8')](_0xac7b('0x30'));return null;}}catch(_0x19f1b4){logger[_0xac7b('0x8')](_0x19f1b4[_0xac7b('0xa')]);return null;}});}logger['info'](util[_0xac7b('0x1b')](_0xac7b('0x34'),_0x40545a[_0xac7b('0x1e')],_0x40545a[_0xac7b('0x1f')],_0x40545a[_0xac7b('0x20')],_0x40545a[_0xac7b('0x21')],_0x40545a[_0xac7b('0x32')]));logger['info'](util[_0xac7b('0x1b')](_0xac7b('0x35'),_0x40545a[_0xac7b('0x28')],_0x40545a['extension'],parseInt(_0x40545a['priority'],0xa)+0x1));_0x40545a[_0xac7b('0x36')](_0x40545a[_0xac7b('0x28')],_0x40545a[_0xac7b('0x29')],parseInt(_0x40545a[_0xac7b('0x2a')],0xa)+0x1);_0x40545a[_0xac7b('0x37')]();}function handleNotFound(_0x558112){logger[_0xac7b('0x8')](util[_0xac7b('0x1b')](_0xac7b('0x38'),_0x558112[_0xac7b('0x1e')]));_0x558112[_0xac7b('0x36')](_0x558112['context'],_0x558112[_0xac7b('0x29')],parseInt(_0x558112[_0xac7b('0x2a')],0xa)+0x1);_0x558112[_0xac7b('0x37')]();}function handleUnpublished(_0x61847){logger['error'](util[_0xac7b('0x1b')](_0xac7b('0x39'),_0x61847['arg_1']));_0x61847['continueAt'](_0x61847[_0xac7b('0x28')],_0x61847[_0xac7b('0x29')],parseInt(_0x61847['priority'],0xa)+0x1);_0x61847['close']();}module['exports']={'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 6be44dd..512f40d 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 _0x53b5=['_transform','_localBuffer','_inBody','substring','split','indexOf','slice','trim','length','emit','headers','line','exports','util','stream','call','inherits','prototype'];(function(_0x106d9b,_0x5dc768){var _0x220189=function(_0x269616){while(--_0x269616){_0x106d9b['push'](_0x106d9b['shift']());}};_0x220189(++_0x5dc768);}(_0x53b5,0xd3));var _0x553b=function(_0x104413,_0x5b60d5){_0x104413=_0x104413-0x0;var _0x2abce5=_0x53b5[_0x104413];return _0x2abce5;};'use strict';var util=require(_0x553b('0x0'));var Transform=require(_0x553b('0x1'))['Transform'];function AGIReply(_0x278896){Transform[_0x553b('0x2')](this,_0x278896);this['_localBuffer']='';this['_inBody']=![];}util[_0x553b('0x3')](AGIReply,Transform);AGIReply[_0x553b('0x4')][_0x553b('0x5')]=function(_0x6b752f,_0x4a9cf5,_0x2394d4){var _0x4749af='\x0a',_0x4bdeaa=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x58e985=-0x1,_0x1fc330=-0x1,_0x302df3='',_0x5d0732=0x0,_0x44b538='',_0x1b945f='';this[_0x553b('0x6')]+=_0x6b752f['toString']();_0x44b538=this[_0x553b('0x6')];if(!this[_0x553b('0x7')]){_0x5d0732=0x0;while(_0x4bdeaa[_0x5d0732]){while((_0x1fc330=_0x44b538['indexOf'](_0x4bdeaa[_0x5d0732]))!=-0x1){_0x302df3=_0x4bdeaa[_0x5d0732];_0x1b945f=_0x44b538[_0x553b('0x8')](0x0,_0x1fc330);_0x44b538=_0x44b538[_0x553b('0x8')](_0x1fc330+_0x302df3['length']);var _0x311062=_0x1b945f[_0x553b('0x9')](_0x4749af),_0x5dafa7=0x0,_0x46e771={},_0x239ab9='',_0x346fcf='',_0x24d766=-0x1;while(_0x311062[_0x5dafa7]){_0x24d766=_0x311062[_0x5dafa7][_0x553b('0xa')](':');if(_0x24d766!=-0x1){_0x239ab9=_0x311062[_0x5dafa7][_0x553b('0xb')](0x0,_0x24d766)[_0x553b('0xc')]();_0x346fcf=_0x311062[_0x5dafa7]['slice'](_0x24d766+0x1)[_0x553b('0xc')]();if(_0x239ab9[_0x553b('0xd')]>0x0){_0x46e771[_0x239ab9]=_0x346fcf;}}else{}_0x5dafa7++;}this[_0x553b('0xe')](_0x553b('0xf'),_0x46e771);this[_0x553b('0x7')]=!![];}_0x5d0732++;}this[_0x553b('0x6')]=_0x44b538;}else{while((_0x58e985=_0x44b538[_0x553b('0xa')](_0x4749af))!=-0x1){_0x1b945f=_0x44b538['substring'](0x0,_0x58e985);this[_0x553b('0xe')](_0x553b('0x10'),_0x1b945f);_0x44b538=_0x44b538[_0x553b('0x8')](_0x58e985+_0x4749af[_0x553b('0xd')]);}this[_0x553b('0x6')]=_0x44b538;}_0x2394d4();};module[_0x553b('0x11')]=AGIReply; \ No newline at end of file +var _0xd246=['_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','substring','indexOf','slice','trim','emit','line','length','util','Transform','call'];(function(_0xa10150,_0x104a39){var _0x32be94=function(_0x270ed9){while(--_0x270ed9){_0xa10150['push'](_0xa10150['shift']());}};_0x32be94(++_0x104a39);}(_0xd246,0x11e));var _0x6d24=function(_0x2945bf,_0x4b9ab4){_0x2945bf=_0x2945bf-0x0;var _0x1c78bb=_0xd246[_0x2945bf];return _0x1c78bb;};'use strict';var util=require(_0x6d24('0x0'));var Transform=require('stream')[_0x6d24('0x1')];function AGIReply(_0x35fc0f){Transform[_0x6d24('0x2')](this,_0x35fc0f);this[_0x6d24('0x3')]='';this['_inBody']=![];}util[_0x6d24('0x4')](AGIReply,Transform);AGIReply[_0x6d24('0x5')][_0x6d24('0x6')]=function(_0x2bd048,_0x529fed,_0x4fb38d){var _0x593baf='\x0a',_0x59247b=['\x0a\x0a',_0x6d24('0x7')],_0x1a4bc1=-0x1,_0x49d0e7=-0x1,_0x3f8233='',_0x40a6e5=0x0,_0x43ce88='',_0x4213c5='';this[_0x6d24('0x3')]+=_0x2bd048[_0x6d24('0x8')]();_0x43ce88=this[_0x6d24('0x3')];if(!this[_0x6d24('0x9')]){_0x40a6e5=0x0;while(_0x59247b[_0x40a6e5]){while((_0x49d0e7=_0x43ce88['indexOf'](_0x59247b[_0x40a6e5]))!=-0x1){_0x3f8233=_0x59247b[_0x40a6e5];_0x4213c5=_0x43ce88[_0x6d24('0xa')](0x0,_0x49d0e7);_0x43ce88=_0x43ce88[_0x6d24('0xa')](_0x49d0e7+_0x3f8233['length']);var _0x3ae953=_0x4213c5['split'](_0x593baf),_0x7a609f=0x0,_0x523001={},_0xd45888='',_0x5498ca='',_0x495292=-0x1;while(_0x3ae953[_0x7a609f]){_0x495292=_0x3ae953[_0x7a609f][_0x6d24('0xb')](':');if(_0x495292!=-0x1){_0xd45888=_0x3ae953[_0x7a609f][_0x6d24('0xc')](0x0,_0x495292)['trim']();_0x5498ca=_0x3ae953[_0x7a609f][_0x6d24('0xc')](_0x495292+0x1)[_0x6d24('0xd')]();if(_0xd45888['length']>0x0){_0x523001[_0xd45888]=_0x5498ca;}}else{}_0x7a609f++;}this[_0x6d24('0xe')]('headers',_0x523001);this[_0x6d24('0x9')]=!![];}_0x40a6e5++;}this['_localBuffer']=_0x43ce88;}else{while((_0x1a4bc1=_0x43ce88[_0x6d24('0xb')](_0x593baf))!=-0x1){_0x4213c5=_0x43ce88[_0x6d24('0xa')](0x0,_0x1a4bc1);this[_0x6d24('0xe')](_0x6d24('0xf'),_0x4213c5);_0x43ce88=_0x43ce88[_0x6d24('0xa')](_0x1a4bc1+_0x593baf[_0x6d24('0x10')]);}this['_localBuffer']=_0x43ce88;}_0x4fb38d();};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 b2acd5f..db7ec1d 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 _0x34e8=['then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request'];(function(_0x488a70,_0x4819a4){var _0x30f375=function(_0x38635d){while(--_0x38635d){_0x488a70['push'](_0x488a70['shift']());}};_0x30f375(++_0x4819a4);}(_0x34e8,0x12c));var _0x834e=function(_0x5e38c,_0x142570){_0x5e38c=_0x5e38c-0x0;var _0x3845df=_0x34e8[_0x5e38c];return _0x3845df;};'use strict';var _=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var jayson=require(_0x834e('0x2'));var client=jayson[_0x834e('0x3')]['http']({'port':0x2329});function request(_0x832422,_0x21e2e0){return new Promise(function(_0x472111,_0x31bf20){return client[_0x834e('0x4')](_0x832422,_0x21e2e0)[_0x834e('0x5')](function(_0x398bee){if(_0x398bee['error']){return _0x31bf20(_0x398bee[_0x834e('0x6')]['message']);}else{return _0x472111(_0x398bee[_0x834e('0x7')]);}})[_0x834e('0x8')](function(_0x3a3ef6){return _0x31bf20(_0x3a3ef6);});});}exports[_0x834e('0x9')]=function(){return request(_0x834e('0xa'),{'options':{'raw':![],'attributes':['id',_0x834e('0xb'),_0x834e('0xc')]}});};exports[_0x834e('0xd')]=function(_0x3bdda9){return request(_0x834e('0xe'),{'options':{'raw':![],'where':{'name':_0x3bdda9},'attributes':[_0x834e('0xc')]}});};exports[_0x834e('0xf')]=function(_0x14038b){return request(_0x834e('0x10'),{'options':{'raw':![],'where':{'id':_0x14038b},'include':[{'model':_0x834e('0x11'),'as':_0x834e('0x12'),'include':[{'model':_0x834e('0x13'),'as':'CloudProvider'}]}],'attributes':['id',_0x834e('0xb'),_0x834e('0x14')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x23848e){return request(_0x834e('0xe'),{'options':{'where':{'id':_0x23848e},'attributes':[_0x834e('0xb')]}});};exports[_0x834e('0x15')]=function(_0x50e860){return request(_0x834e('0x16'),{'options':{'where':{'id':_0x50e860},'attributes':[_0x834e('0xb')]}});};exports['getVariableById']=function(_0x316205){return request('ShowVariable',{'options':{'where':{'id':_0x316205},'attributes':[_0x834e('0xb')]}});};exports[_0x834e('0x17')]=function(_0x478afe){return request(_0x834e('0x18'),{'options':{'where':{'id':_0x478afe},'attributes':[_0x834e('0x19')]}});};exports[_0x834e('0x1a')]=function(_0x50b3f6){return request(_0x834e('0x1b'),{'options':{'where':{'id':_0x50b3f6},'attributes':[_0x834e('0xb')]}});};exports[_0x834e('0x1c')]=function(_0xb993a1){return request(_0x834e('0x1d'),{'options':{'where':{'phone':_0xb993a1[_0x834e('0x1e')]},'attributes':['id']}});};exports[_0x834e('0x1f')]=function(_0x595515){return request(_0x834e('0x20'),{'options':{'where':{'id':_0x595515},'attributes':[_0x834e('0xb')]}});};exports[_0x834e('0x21')]=function(_0x325a99){return request('ShowSound',{'options':{'where':{'id':_0x325a99},'attributes':[_0x834e('0x22')]}});};exports[_0x834e('0x23')]=function(_0x5a05c0){return request(_0x834e('0x24'),{'options':{'raw':![],'where':{'id':_0x5a05c0},'include':[{'model':_0x834e('0x25'),'as':_0x834e('0x26')}]}});};exports['getSmsAccountById']=function(_0x4e3f48){return request(_0x834e('0x27'),{'options':{'where':{'id':_0x4e3f48},'attributes':['id',_0x834e('0xb')]}});};exports['createSmsMessage']=function(_0x25ee1d){return request(_0x834e('0x28'),{'body':_0x25ee1d});};exports['createSquareDetailsReport']=function(_0x3bc4f7){return request(_0x834e('0x29'),{'body':_0x3bc4f7});};exports[_0x834e('0x2a')]=function(_0x561cd2){return request(_0x834e('0x2b'),{'body':_[_0x834e('0x2c')](_0x561cd2,{'project_name':_0x561cd2['arg_1'],'prev_project_name':_0x561cd2['arg_2']||'','is_subproject':_0x561cd2[_0x834e('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0x834e('0x2e'))})});};exports[_0x834e('0x2f')]=function(_0x3db026){return request(_0x834e('0x30'),{'body':_0x3db026});};exports[_0x834e('0x31')]=function(_0x130cc5){return request('CreateSquareMessage',{'body':_0x130cc5});};exports['createCmContact']=function(_0x4dc64a){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4dc64a[_0x834e('0x1e')],'ListId':_0x4dc64a[_0x834e('0x32')]}}})[_0x834e('0x5')](function(_0x5dacc1){if(_0x5dacc1){return _0x5dacc1;}return request(_0x834e('0x33'),{'body':_0x4dc64a});});};exports[_0x834e('0x34')]=function(_0x1f3671){return request(_0x834e('0x35'),{'options':{'where':{'id':_0x1f3671},'attributes':[_0x834e('0xb')]}});};exports[_0x834e('0x36')]=function(_0x3d149d,_0xfaf716){return request(_0x834e('0x37'),{'body':{'interface':_0xfaf716},'options':{'where':_0x3d149d}});};exports['agentPause']=function(_0xef9ec2,_0x5cad11,_0x2c75c2){return request(_0x834e('0x38'),{'body':{'type':_0x5cad11,'uniqueid':_0x2c75c2},'options':{'where':_0xef9ec2}});};exports[_0x834e('0x39')]=function(_0x2b3418){return request(_0x834e('0x3a'),{'body':{},'options':{'where':_0x2b3418}});};exports[_0x834e('0x3b')]=function(_0x4696a1){return request(_0x834e('0x3c'),{'body':{},'options':{'where':_0x4696a1}});}; \ No newline at end of file +var _0xf2cb=['getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','client','error','message','catch','getSquareProjects','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','name','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact'];(function(_0xc93926,_0x2d1292){var _0x30d7b0=function(_0x5133e6){while(--_0x5133e6){_0xc93926['push'](_0xc93926['shift']());}};_0x30d7b0(++_0x2d1292);}(_0xf2cb,0x130));var _0xbf2c=function(_0x40acd4,_0x1e2827){_0x40acd4=_0x40acd4-0x0;var _0x2c77a8=_0xf2cb[_0x40acd4];return _0x2c77a8;};'use strict';var _=require('lodash');var moment=require(_0xbf2c('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xbf2c('0x1')]['http']({'port':0x2329});function request(_0x424f04,_0x5a97a1){return new Promise(function(_0x1ecb79,_0x41c649){return client['request'](_0x424f04,_0x5a97a1)['then'](function(_0x14b5e4){if(_0x14b5e4[_0xbf2c('0x2')]){return _0x41c649(_0x14b5e4[_0xbf2c('0x2')][_0xbf2c('0x3')]);}else{return _0x1ecb79(_0x14b5e4['result']);}})[_0xbf2c('0x4')](function(_0x584a08){return _0x41c649(_0x584a08);});});}exports[_0xbf2c('0x5')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0xbf2c('0x6')]}});};exports[_0xbf2c('0x7')]=function(_0xeb0e9d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xeb0e9d},'attributes':[_0xbf2c('0x6')]}});};exports[_0xbf2c('0x8')]=function(_0x2da108){return request(_0xbf2c('0x9'),{'options':{'raw':![],'where':{'id':_0x2da108},'include':[{'model':_0xbf2c('0xa'),'as':_0xbf2c('0xb'),'include':[{'model':_0xbf2c('0xc'),'as':_0xbf2c('0xc')}]}],'attributes':['id','name',_0xbf2c('0xd')],'smtp':!![]}});};exports[_0xbf2c('0xe')]=function(_0x1a8d23){return request(_0xbf2c('0xf'),{'options':{'where':{'id':_0x1a8d23},'attributes':['name']}});};exports[_0xbf2c('0x10')]=function(_0x5a160b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5a160b},'attributes':[_0xbf2c('0x11')]}});};exports['getVariableById']=function(_0x47df49){return request(_0xbf2c('0x12'),{'options':{'where':{'id':_0x47df49},'attributes':[_0xbf2c('0x11')]}});};exports[_0xbf2c('0x13')]=function(_0x334900){return request(_0xbf2c('0x14'),{'options':{'where':{'id':_0x334900},'attributes':['dsn']}});};exports[_0xbf2c('0x15')]=function(_0x5514b0){return request(_0xbf2c('0x16'),{'options':{'where':{'id':_0x5514b0},'attributes':[_0xbf2c('0x11')]}});};exports[_0xbf2c('0x17')]=function(_0x32a44d){return request(_0xbf2c('0x18'),{'options':{'where':{'phone':_0x32a44d['phone']},'attributes':['id']}});};exports[_0xbf2c('0x19')]=function(_0x1fbfe8){return request(_0xbf2c('0x1a'),{'options':{'where':{'id':_0x1fbfe8},'attributes':[_0xbf2c('0x11')]}});};exports[_0xbf2c('0x1b')]=function(_0x102cef){return request(_0xbf2c('0x1c'),{'options':{'where':{'id':_0x102cef},'attributes':['save_name']}});};exports[_0xbf2c('0x1d')]=function(_0x2a3adf){return request(_0xbf2c('0x1e'),{'options':{'raw':![],'where':{'id':_0x2a3adf},'include':[{'model':_0xbf2c('0x1f'),'as':'Intervals'}]}});};exports[_0xbf2c('0x20')]=function(_0x1f5515){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f5515},'attributes':['id',_0xbf2c('0x11')]}});};exports[_0xbf2c('0x21')]=function(_0x3f1cdb){return request('CreateSmsMessage',{'body':_0x3f1cdb});};exports['createSquareDetailsReport']=function(_0x31b070){return request(_0xbf2c('0x22'),{'body':_0x31b070});};exports[_0xbf2c('0x23')]=function(_0x2894ce){return request(_0xbf2c('0x24'),{'body':_[_0xbf2c('0x25')](_0x2894ce,{'project_name':_0x2894ce[_0xbf2c('0x26')],'prev_project_name':_0x2894ce['arg_2']||'','is_subproject':_0x2894ce['arg_2']?!![]:![],'leaveAt':moment()[_0xbf2c('0x27')](_0xbf2c('0x28'))})});};exports[_0xbf2c('0x29')]=function(_0x4314d6){return request(_0xbf2c('0x2a'),{'body':_0x4314d6});};exports[_0xbf2c('0x2b')]=function(_0x30ca){return request(_0xbf2c('0x2c'),{'body':_0x30ca});};exports[_0xbf2c('0x2d')]=function(_0x4f3191){return request(_0xbf2c('0x2e'),{'options':{'raw':![],'where':{'phone':_0x4f3191['phone'],'ListId':_0x4f3191[_0xbf2c('0x2f')]}}})[_0xbf2c('0x30')](function(_0x40e866){if(_0x40e866){return _0x40e866;}return request(_0xbf2c('0x31'),{'body':_0x4f3191});});};exports[_0xbf2c('0x32')]=function(_0x502943){return request(_0xbf2c('0x33'),{'options':{'where':{'id':_0x502943},'attributes':[_0xbf2c('0x11')]}});};exports[_0xbf2c('0x34')]=function(_0x13e238,_0x2cc8cb){return request(_0xbf2c('0x35'),{'body':{'interface':_0x2cc8cb},'options':{'where':_0x13e238}});};exports[_0xbf2c('0x36')]=function(_0x3462dd,_0x4d731d,_0x37cf35){return request(_0xbf2c('0x37'),{'body':{'type':_0x4d731d,'uniqueid':_0x37cf35},'options':{'where':_0x3462dd}});};exports[_0xbf2c('0x38')]=function(_0x5b93aa){return request('UnpauseUser',{'body':{},'options':{'where':_0x5b93aa}});};exports[_0xbf2c('0x39')]=function(_0x24e3cf){return request(_0xbf2c('0x3a'),{'body':{},'options':{'where':_0x24e3cf}});}; \ 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 9b624b3..f44f7a1 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 _0x9a14=['exports'];(function(_0x2619cd,_0x48536f){var _0x1753a6=function(_0x365f99){while(--_0x365f99){_0x2619cd['push'](_0x2619cd['shift']());}};_0x1753a6(++_0x48536f);}(_0x9a14,0xa8));var _0x49a1=function(_0x555521,_0x48ee61){_0x555521=_0x555521-0x0;var _0x688d7d=_0x9a14[_0x555521];return _0x688d7d;};var polly=require('./polly');var lex=require('./lex');module[_0x49a1('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5a63=['./lex','./polly'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x5a63,0xe3));var _0x35a6=function(_0x356b4b,_0x3569b3){_0x356b4b=_0x356b4b-0x0;var _0x3e901a=_0x5a63[_0x356b4b];return _0x3e901a;};var polly=require(_0x35a6('0x0'));var lex=require(_0x35a6('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ae46a5a..d88ee3d 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 _0x153f=['exports','./lib/api'];(function(_0x135448,_0x4ca19f){var _0x28389e=function(_0x5a2113){while(--_0x5a2113){_0x135448['push'](_0x135448['shift']());}};_0x28389e(++_0x4ca19f);}(_0x153f,0x15b));var _0xf153=function(_0x4b1d27,_0x2d815a){_0x4b1d27=_0x4b1d27-0x0;var _0x3aa5de=_0x153f[_0x4b1d27];return _0x3aa5de;};'use strict';var lex=require(_0xf153('0x0'));module[_0xf153('0x1')]=function(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c){return lex(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c);}; \ No newline at end of file +var _0x2dae=['./lib/api'];(function(_0x21e886,_0x20dcd2){var _0x5c5b67=function(_0x33cf7b){while(--_0x33cf7b){_0x21e886['push'](_0x21e886['shift']());}};_0x5c5b67(++_0x20dcd2);}(_0x2dae,0xc3));var _0xe2da=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x2dae[_0x398294];return _0x2a872d;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ 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 89e669e..17cdbd9 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(_0x1e8bc7,_0x21f69f){var _0x5b888f=function(_0x12e1e4){while(--_0x12e1e4){_0x1e8bc7['push'](_0x1e8bc7['shift']());}};_0x5b888f(++_0x21f69f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x5258b6,_0x2fa6c9){var _0x1f08cf=function(_0x785012){while(--_0x785012){_0x5258b6['push'](_0x5258b6['shift']());}};_0x1f08cf(++_0x2fa6c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 b484458..41a77ac 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 _0x7996=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7996,0xf0));var _0x6799=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x7996[_0x5a636f];return _0x6a8cfb;};'use strict';var polly=require(_0x6799('0x0'));module[_0x6799('0x1')]=function(_0x18633c,_0xb050d4,_0x4db326,_0x59985f,_0x30dc4a,_0x3548cc,_0x3f3668){return polly(_0x18633c,_0xb050d4,_0x4db326,_0x59985f,_0x30dc4a,_0x3548cc,_0x3f3668);}; \ No newline at end of file +var _0xc32c=['exports','./lib/api'];(function(_0x4c5f11,_0x1bf5ef){var _0x25a59a=function(_0x2101e2){while(--_0x2101e2){_0x4c5f11['push'](_0x4c5f11['shift']());}};_0x25a59a(++_0x1bf5ef);}(_0xc32c,0x147));var _0xcc32=function(_0xc3ba31,_0x34c038){_0xc3ba31=_0xc3ba31-0x0;var _0x207709=_0xc32c[_0xc3ba31];return _0x207709;};'use strict';var polly=require(_0xcc32('0x0'));module[_0xcc32('0x1')]=function(_0x62dfb1,_0x323d2a,_0x30a4fc,_0x5e710d,_0xc9c455,_0x22ddb1,_0x5e8bd9){return polly(_0x62dfb1,_0x323d2a,_0x30a4fc,_0x5e710d,_0xc9c455,_0x22ddb1,_0x5e8bd9);}; \ 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 677f0db..33dcae5 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 _0x29da=['mp3','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x56272d,_0x242414){var _0x57fb66=function(_0x1f6afc){while(--_0x1f6afc){_0x56272d['push'](_0x56272d['shift']());}};_0x57fb66(++_0x242414);}(_0x29da,0x14b));var _0xa29d=function(_0x582974,_0x5968cb){_0x582974=_0x582974-0x0;var _0x364d64=_0x29da[_0x582974];return _0x364d64;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa29d('0x0'));var rs=require(_0xa29d('0x1'));var AWS=require(_0xa29d('0x2'));function pollyResult(_0x506c2e,_0x28392e,_0x322469){return new BPromise(function(_0x2f1358,_0xc5c4de){_0x506c2e['synthesizeSpeech'](_0x28392e,function(_0x55fb1c,_0x2912d4){if(_0x55fb1c){_0xc5c4de(_0x55fb1c);}else if(_0x2912d4){if(_0x2912d4[_0xa29d('0x3')]instanceof Buffer){fs[_0xa29d('0x4')](_0x322469,_0x2912d4['AudioStream'],function(_0x54a028){if(_0x54a028){_0xc5c4de(_0x54a028);}else{_0x2f1358();}});}else{_0xc5c4de(new Error(_0xa29d('0x5')));}}else{_0xc5c4de(new Error(_0xa29d('0x6')));}});});}module['exports']=function(_0x3941f1,_0xaa287a,_0x353b36,_0x234bac,_0x533dbf,_0x1642a8,_0x390324){var _0x240e47=new AWS[(_0xa29d('0x7'))]({'accessKeyId':_0x3941f1,'secretAccessKey':_0xaa287a,'region':_0x353b36});var _0x480c59={'Text':_0x533dbf,'TextType':_0x1642a8||_0xa29d('0x8'),'OutputFormat':_0xa29d('0x9'),'VoiceId':_0x234bac};return pollyResult(_0x240e47,_0x480c59,_0x390324);}; \ No newline at end of file +var _0x27f3=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','exports','text','path','bluebird','randomstring'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0x27f3,0x153));var _0x327f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x27f3[_0x36eaaa];return _0x461349;};'use strict';var fs=require('fs');var path=require(_0x327f('0x0'));var BPromise=require(_0x327f('0x1'));var rs=require(_0x327f('0x2'));var AWS=require(_0x327f('0x3'));function pollyResult(_0x1aa9f2,_0x3c1faa,_0x2ae0ca){return new BPromise(function(_0x99f04b,_0x848957){_0x1aa9f2[_0x327f('0x4')](_0x3c1faa,function(_0x4b4c97,_0x284f48){if(_0x4b4c97){_0x848957(_0x4b4c97);}else if(_0x284f48){if(_0x284f48['AudioStream']instanceof Buffer){fs[_0x327f('0x5')](_0x2ae0ca,_0x284f48[_0x327f('0x6')],function(_0x44bab2){if(_0x44bab2){_0x848957(_0x44bab2);}else{_0x99f04b();}});}else{_0x848957(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x848957(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x327f('0x7')]=function(_0x115d32,_0x4626d5,_0x57cdf6,_0x3d09be,_0x3a3c4f,_0x60b722,_0x1716b7){var _0x2476cf=new AWS['Polly']({'accessKeyId':_0x115d32,'secretAccessKey':_0x4626d5,'region':_0x57cdf6});var _0x569751={'Text':_0x3a3c4f,'TextType':_0x60b722||_0x327f('0x8'),'OutputFormat':'mp3','VoiceId':_0x3d09be};return pollyResult(_0x2476cf,_0x569751,_0x1716b7);}; \ 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 3ba28f8..025f884 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 _0xe173=['./lib/api','exports'];(function(_0x41d637,_0x3abcac){var _0x54b35a=function(_0x16a25c){while(--_0x16a25c){_0x41d637['push'](_0x41d637['shift']());}};_0x54b35a(++_0x3abcac);}(_0xe173,0x184));var _0x3e17=function(_0x7cac81,_0x4a90c8){_0x7cac81=_0x7cac81-0x0;var _0x3fb378=_0xe173[_0x7cac81];return _0x3fb378;};'use strict';var asr=require(_0x3e17('0x0'));module[_0x3e17('0x1')]=function(_0x581fff,_0xac9b88,_0x17325b,_0x1c2077){return asr(_0x581fff,_0xac9b88,_0x17325b);}; \ No newline at end of file +var _0x18f4=['./lib/api'];(function(_0x436dfc,_0x36c1bc){var _0x1e4155=function(_0x28cc3f){while(--_0x28cc3f){_0x436dfc['push'](_0x436dfc['shift']());}};_0x1e4155(++_0x36c1bc);}(_0x18f4,0x1c8));var _0x418f=function(_0x292058,_0x519b90){_0x292058=_0x292058-0x0;var _0x46adb6=_0x18f4[_0x292058];return _0x46adb6;};'use strict';var asr=require(_0x418f('0x0'));module['exports']=function(_0x2033d9,_0x815b6e,_0x252979,_0x5d4c6b){return asr(_0x2033d9,_0x815b6e,_0x252979);}; \ 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 0536f08..da4829b 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 _0x57d4=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x4c6ab4,_0x26f57e){var _0x59938c=function(_0x4cab25){while(--_0x4cab25){_0x4c6ab4['push'](_0x4c6ab4['shift']());}};_0x59938c(++_0x26f57e);}(_0x57d4,0x78));var _0x457d=function(_0x14a442,_0x5f04ff){_0x14a442=_0x14a442-0x0;var _0x291baf=_0x57d4[_0x14a442];return _0x291baf;};'use strict';var url=require(_0x457d('0x0'));var BPromise=require(_0x457d('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x457d('0x2')]=function(_0xa408c8,_0x1e26ab,_0x30a25c){return new BPromise(function(_0x1219e1,_0x3c89b2){var _0x3e2239;if(typeof _0xa408c8!==_0x457d('0x3')||_0xa408c8[_0x457d('0x4')]===0x0){return _0x3c89b2(_0x457d('0x5'));}if(typeof _0x1e26ab!==_0x457d('0x3')||_0x1e26ab['length']===0x0){return _0x3c89b2(_0x457d('0x6'));}if(typeof _0x30a25c!==_0x457d('0x7')&&(typeof _0x30a25c!=='string'||_0x30a25c['length']===0x0)){return _0x3c89b2(_0x457d('0x8'));}try{_0x3e2239=fs[_0x457d('0x9')](_0xa408c8)[_0x457d('0xa')]('base64');}catch(_0x5bc628){return _0x3c89b2(_0x5bc628);}return _0x1219e1({'method':'POST','uri':host+_0x457d('0xb')+_0x1e26ab,'body':{'config':{'encoding':_0x457d('0xc'),'sampleRateHertz':_0x457d('0xd'),'languageCode':_0x30a25c},'audio':{'content':_0x3e2239}},'json':!![]});});}; \ No newline at end of file +var _0xe5b3=['https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5b3,0x133));var _0x3e5b=function(_0x24fa8e,_0x4d8296){_0x24fa8e=_0x24fa8e-0x0;var _0x346bf5=_0xe5b3[_0x24fa8e];return _0x346bf5;};'use strict';var url=require('url');var BPromise=require(_0x3e5b('0x0'));var fs=require('fs');var host=_0x3e5b('0x1');module[_0x3e5b('0x2')]=function(_0x1c38ed,_0x2a71ef,_0x3171c5){return new BPromise(function(_0x7f1cc0,_0x1e58ed){var _0x320b1e;if(typeof _0x1c38ed!==_0x3e5b('0x3')||_0x1c38ed[_0x3e5b('0x4')]===0x0){return _0x1e58ed('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2a71ef!==_0x3e5b('0x3')||_0x2a71ef[_0x3e5b('0x4')]===0x0){return _0x1e58ed('key\x20should\x20be\x20a\x20string');}if(typeof _0x3171c5!==_0x3e5b('0x5')&&(typeof _0x3171c5!==_0x3e5b('0x3')||_0x3171c5[_0x3e5b('0x4')]===0x0)){return _0x1e58ed(_0x3e5b('0x6'));}try{_0x320b1e=fs['readFileSync'](_0x1c38ed)['toString'](_0x3e5b('0x7'));}catch(_0x3d3b6e){return _0x1e58ed(_0x3d3b6e);}return _0x7f1cc0({'method':_0x3e5b('0x8'),'uri':host+_0x3e5b('0x9')+_0x2a71ef,'body':{'config':{'encoding':_0x3e5b('0xa'),'sampleRateHertz':'8000','languageCode':_0x3171c5},'audio':{'content':_0x320b1e}},'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 10cb4be..c13f6a8 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xace2=['exports'];(function(_0x2acd04,_0x1fa448){var _0x182726=function(_0x13c376){while(--_0x13c376){_0x2acd04['push'](_0x2acd04['shift']());}};_0x182726(++_0x1fa448);}(_0xace2,0x166));var _0x2ace=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0xace2[_0x47d6dc];return _0x1a1c93;};var asr=require('./asr');module[_0x2ace('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 5b2cbe0..c60186f 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 _0x78e8=['confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','https','path','querystring','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close','unlink','download\x20error','pipe','https:','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','chmodSync','777','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','POST','then','resolve','from','audioContent','writeFile','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','info','goggleTTS\x20path','asr','uri','results','alternatives','transcript','map'];(function(_0x1b4206,_0x3eaf43){var _0x303b1a=function(_0x2ff59c){while(--_0x2ff59c){_0x1b4206['push'](_0x1b4206['shift']());}};_0x303b1a(++_0x3eaf43);}(_0x78e8,0x1df));var _0x878e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x78e8[_0x5b561d];return _0x431060;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x878e('0x0'));var fs=require('fs');var http=require('http');var https=require(_0x878e('0x1'));var md5=require('md5');var path=require(_0x878e('0x2'));var querystring=require(_0x878e('0x3'));var rp=require(_0x878e('0x4'));var rs=require(_0x878e('0x5'));var sox=require('sox');var tts=require(_0x878e('0x6'));var urlParse=require('url')[_0x878e('0x7')];var util=require(_0x878e('0x8'));var aws=require(_0x878e('0x9'));var google=require(_0x878e('0xa'));var sestek=require(_0x878e('0xb'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x878e('0xc'));var ISPEECH_API=_0x878e('0xd');function downloadFile(_0x2aaa31,_0x560c03){return new BPromise(function(_0x56571d,_0x42922a){var _0x458c2e=urlParse(_0x2aaa31);var _0x12ecd5=_0x458c2e[_0x878e('0xe')]==='https:'?https:http;var _0x4a73c4={'host':_0x458c2e[_0x878e('0xf')],'path':_0x458c2e['path'],'headers':{'user-agent':_0x878e('0x10')}};_0x12ecd5[_0x878e('0x11')](_0x4a73c4,function(_0x2b47b3){if(_0x2b47b3[_0x878e('0x12')]!==0xc8){logger[_0x878e('0x13')](_0x878e('0x14')+_0x2aaa31+_0x878e('0x15')+_0x2b47b3[_0x878e('0x12')]+'\x20('+_0x2b47b3[_0x878e('0x16')]+')');_0x42922a(new Error(_0x878e('0x14')+_0x2aaa31+_0x878e('0x15')+_0x2b47b3[_0x878e('0x12')]+'\x20('+_0x2b47b3[_0x878e('0x16')]+')'));return;}var _0x36773f=fs[_0x878e('0x17')](_0x560c03);_0x36773f['on']('finish',function(){logger['info'](_0x878e('0x18'));_0x36773f[_0x878e('0x19')](_0x56571d);});_0x36773f['on'](_0x878e('0x13'),function(_0x51683a){fs[_0x878e('0x1a')](_0x560c03);logger[_0x878e('0x13')](_0x878e('0x1b'),_0x51683a);_0x42922a(_0x51683a);});_0x2b47b3[_0x878e('0x1c')](_0x36773f);})['on'](_0x878e('0x13'),function(_0x13dd2d){logger['error'](_0x13dd2d);_0x42922a(_0x13dd2d);})['end']();});}function uploadFile(_0xa2914f){return new BPromise(function(_0x27a8ac,_0x180658){var _0x1e018c=urlParse(_0xa2914f);var _0x4714b5=_0x1e018c[_0x878e('0xe')]===_0x878e('0x1d')?https:http;var _0x1bd13f={'host':_0x1e018c['host'],'path':_0x1e018c['path'],'headers':{'user-agent':_0x878e('0x10')}};_0x4714b5[_0x878e('0x11')](_0x1bd13f,function(_0x5832cc){if(_0x5832cc[_0x878e('0x12')]!==0xc8){_0x180658(new Error(_0x878e('0x14')+_0xa2914f+'\x20failed,\x20status\x20code\x20=\x20'+_0x5832cc['statusCode']+'\x20('+_0x5832cc['statusMessage']+')'));return;}var _0xba40dd='';_0x5832cc['on'](_0x878e('0x1e'),function(_0x6abac5){_0xba40dd+=_0x6abac5;});_0x5832cc['on'](_0x878e('0x1f'),function(){_0x27a8ac(_0xba40dd);});})['on'](_0x878e('0x13'),function(_0x5b4b3e){_0x180658(_0x5b4b3e);})[_0x878e('0x1f')]();});}function convertFile(_0x47d023,_0x1eeac0){return new BPromise(function(_0x58b39b,_0x1c076d){var _0x3014fc=sox[_0x878e('0x20')](_0x47d023,_0x1eeac0,{'sampleRate':0x1f40,'format':_0x878e('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3014fc['on'](_0x878e('0x13'),function(_0xaf24c0){logger[_0x878e('0x13')](_0x878e('0x22'),_0xaf24c0);_0x1c076d(_0xaf24c0);});_0x3014fc['on']('end',function(){logger['info'](_0x878e('0x23'));_0x58b39b();});_0x3014fc[_0x878e('0x24')]();});}function base64Decode(_0x361320,_0x3445f3){var _0x3ae388=path['resolve'](__dirname,_0x878e('0x25'),rs[_0x878e('0x26')](0x4)+_0x878e('0x27'));fs[_0x878e('0x28')](_0x3ae388,_0x361320,'base64');return convertFile(_0x3ae388,_0x3445f3)['then'](function(){try{fs['unlink'](_0x3ae388);fs[_0x878e('0x29')](_0x3445f3,_0x878e('0x2a'));}catch(_0x3533d0){logger[_0x878e('0x13')](_0x3533d0);}return _0x3445f3['split']('.')[0x0];});}function base64Encode(_0x366726){var _0x3a899d=fs['readFileSync'](_0x366726);return new Buffer(_0x3a899d)[_0x878e('0x2b')](_0x878e('0x2c'));}exports[_0x878e('0x2d')]=function(_0x516c26,_0x5870c9,_0x5e5dd4,_0x55dbd0,_0x11c6cc,_0x52867e){var _0x3465d8,_0xae5e1a;var _0x41fabd=_0x878e('0x2e');var _0xeb0edc='?key='+_0x516c26;var _0x2c9a61={};if(_0x5870c9==='ssml'){_0x2c9a61[_0x878e('0x2f')]={'ssml':_0x5e5dd4};}else{_0x2c9a61[_0x878e('0x2f')]={'text':_0x5e5dd4};};_0x2c9a61[_0x878e('0x30')]={'languageCode':_0x55dbd0,'ssmlGender':_0x11c6cc};_0x2c9a61[_0x878e('0x31')]={'audioEncoding':_0x878e('0x32'),'sampleRateHertz':0x1f40};var _0x6b7b06={'url':_0x41fabd+_0x878e('0x33')+_0xeb0edc,'method':_0x878e('0x34'),'json':!![],'body':_0x2c9a61};return rp(_0x6b7b06)[_0x878e('0x35')](function(_0x37d13c){return new BPromise(function(_0x4558dc,_0x386b3a){_0x3465d8=path[_0x878e('0x36')](__dirname,_0x878e('0x25'),rs['generate'](0x4)+'.mp3');var _0x1a92a4=Buffer[_0x878e('0x37')](_0x37d13c[_0x878e('0x38')],_0x878e('0x2c'));return fs[_0x878e('0x39')](_0x3465d8,_0x1a92a4,function(_0x501db6){_0x386b3a(_0x501db6);},function(_0x372a3b){fs['chmodSync'](_0x3465d8,'777');_0x4558dc(_0x372a3b);});});})['then'](function(_0x829b91){_0xae5e1a=path['resolve'](__dirname,_0x878e('0x25'),rs[_0x878e('0x26')](0x4)+_0x878e('0x27'));return convertFile(_0x3465d8,_0xae5e1a);})[_0x878e('0x35')](function(){try{fs[_0x878e('0x1a')](_0x3465d8);fs[_0x878e('0x29')](_0xae5e1a,_0x878e('0x2a'));}catch(_0x1f8ecd){logger['error'](_0x1f8ecd);}logger['info'](_0x878e('0x3a'),_0xae5e1a['split']('.')[0x0]);return _0xae5e1a[_0x878e('0x3b')]('.')[0x0];});};exports['googleTTS']=function(_0x465473,_0x3aaaa7){var _0x408eaf=_0x878e('0x3c');var _0x4b586b,_0x2e0049;var _0x39c9e0;var _0x9ff9b5={'encoding':_0x878e('0x3d'),'method':_0x878e('0x34'),'timeout':0x2710,'url':_0x408eaf,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x878e('0x3e')+encodeURIComponent(JSON['stringify']([[[_0x878e('0x3f'),JSON[_0x878e('0x40')]([_0x465473,_0x3aaaa7||'en',![],'null']),null,_0x878e('0x41')]]]))};return rp(_0x9ff9b5)[_0x878e('0x35')](function(_0x27f72e){try{_0x39c9e0=eval(_0x27f72e[_0x878e('0x42')](0x5))[0x0][0x2];}catch(_0x35562d){throw new Error(_0x878e('0x43')+_0x27f72e[_0x878e('0x1e')]);}if(!_0x39c9e0){if(_0x465473[_0x878e('0x44')]>0xc8){throw new Error(_0x878e('0x45'));}else{throw new Error(_0x878e('0x46')+_0x3aaaa7+_0x878e('0x47'));}}try{_0x39c9e0=eval(_0x39c9e0)[0x0];}catch(_0x1223c6){throw new Error(_0x878e('0x43')+res[_0x878e('0x1e')]);}const _0x19befb=_0x39c9e0;_0x4b586b=path[_0x878e('0x36')](__dirname,_0x878e('0x25'),rs[_0x878e('0x26')](0x4)+_0x878e('0x48'));fs[_0x878e('0x28')](_0x4b586b,_0x39c9e0,{'encoding':'base64'});_0x2e0049=path['resolve'](__dirname,'tmp',rs[_0x878e('0x26')](0x4)+_0x878e('0x27'));return convertFile(_0x4b586b,_0x2e0049);})[_0x878e('0x35')](function(){try{fs[_0x878e('0x1a')](_0x4b586b);fs[_0x878e('0x29')](_0x2e0049,_0x878e('0x2a'));}catch(_0xef386b){logger['error'](_0xef386b);}logger[_0x878e('0x49')](_0x878e('0x4a'),_0x2e0049[_0x878e('0x3b')]('.')[0x0]);return _0x2e0049[_0x878e('0x3b')]('.')[0x0];});};exports['googleASR']=function(_0x1769c0,_0x2b732a,_0x109c7e){return google[_0x878e('0x4b')](_0x1769c0,_0x2b732a,_0x109c7e)['then'](function(_0x4907f6){logger[_0x878e('0x49')](_0x4907f6[_0x878e('0x4c')]);return rp(_0x4907f6);})['then'](function(_0x21f454){var _0x4d6a92='';var _0x55bdcc=0x0;try{fs[_0x878e('0x1a')](_0x1769c0);}catch(_0xf8a029){logger[_0x878e('0x13')](_0xf8a029);}if(_0x21f454&&_0x21f454[_0x878e('0x4d')]){_0x4d6a92=_0x21f454[_0x878e('0x4d')]['map'](function(_0xd87be4){return _0xd87be4&&_0xd87be4[_0x878e('0x4e')][0x0]&&_0xd87be4[_0x878e('0x4e')][0x0][_0x878e('0x4f')]?_0xd87be4[_0x878e('0x4e')][0x0]['transcript']:'';})['join']('\x0a');_0x55bdcc=_0x21f454[_0x878e('0x4d')][_0x878e('0x50')](function(_0x39d69){return _0x39d69&&_0x39d69[_0x878e('0x4e')][0x0]&&_0x39d69['alternatives'][0x0][_0x878e('0x51')]?_0x39d69[_0x878e('0x4e')][0x0][_0x878e('0x51')]:0x0;})[_0x878e('0x52')]('\x0a');}logger[_0x878e('0x49')](_0x878e('0x53'),_0x4d6a92);logger[_0x878e('0x49')]('googleASR\x20confidence',_0x55bdcc);return{'transcript':_0x4d6a92,'confidence':_0x55bdcc};})[_0x878e('0x54')](function(_0x1dcddf){logger[_0x878e('0x13')](_0x878e('0x55'),_0x1dcddf[_0x878e('0x12')],_0x1dcddf[_0x878e('0x56')],_0x1dcddf[_0x878e('0x57')]);});};exports[_0x878e('0x58')]=function(_0x19a828,_0x2bec2c,_0x413d63,_0x4f32e4){var _0x5db2ea=apiai(_0x2bec2c,{'language':_0x4f32e4||'en'});return _0x5db2ea[_0x878e('0x59')](_0x413d63,{'sessionId':md5(_0x19a828)})['then'](function(_0x5d090a){logger[_0x878e('0x49')](JSON[_0x878e('0x40')](_0x5d090a));return{'source':_0x5d090a['result']['source'],'resolvedQuery':_0x5d090a[_0x878e('0x5a')][_0x878e('0x5b')],'action':_0x5d090a['result']['action'],'actionIncomplete':_0x5d090a[_0x878e('0x5a')][_0x878e('0x5c')],'speech':_0x5d090a[_0x878e('0x5a')][_0x878e('0x5d')][_0x878e('0x5e')],'score':_0x5d090a['result'][_0x878e('0x5f')],'statusCode':_0x5d090a[_0x878e('0x60')][_0x878e('0x61')],'endConversation':_0x5d090a['result'][_0x878e('0x62')]['endConversation']||![],'isFallbackIntent':_0x5d090a['result'][_0x878e('0x62')][_0x878e('0x63')]};});};exports[_0x878e('0x64')]=function(_0x43a7f7,_0x4e6e00,_0x59c034,_0x2e4ab5,_0x1029ec,_0x3f0939){var _0x18916b=_0x2e4ab5['replace'](/\\n/g,'\x0a');var _0xe64adb={'credentials':{'private_key':_0x18916b,'client_email':_0x59c034}};var _0x1545ce=new dialogflow[(_0x878e('0x65'))](_0xe64adb);var _0x28eae7=_0x1545ce[_0x878e('0x66')](_0x4e6e00,md5(_0x43a7f7));var _0x29a41a={'session':_0x28eae7,'queryInput':{'text':{'text':_0x1029ec,'languageCode':_0x3f0939}}};return _0x1545ce[_0x878e('0x67')](_0x29a41a)[_0x878e('0x35')](function(_0x38902e){if(_0x38902e&&_0x38902e[_0x878e('0x44')]){logger[_0x878e('0x49')](_0x878e('0x68'),JSON[_0x878e('0x40')](_0x38902e));var _0x1fe8ce=_0x38902e[0x0];if(_0x1fe8ce){var _0x563071={'action':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x6a')],'allRequiredParamsPresent':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x6b')],'endConversation':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x6c')]&&_0x1fe8ce[_0x878e('0x69')][_0x878e('0x6c')][_0x878e('0x6d')]?_0x1fe8ce['queryResult'][_0x878e('0x6c')]['fields'][_0x878e('0x6e')][_0x878e('0x6f')]:![],'fulfillmentText':_0x1fe8ce['queryResult'][_0x878e('0x70')],'intentName':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x71')][_0x878e('0x56')],'intentDisplayName':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x71')]['displayName'],'isFallbackIntent':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x71')][_0x878e('0x72')],'languageCode':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x73')],'queryText':_0x1fe8ce['queryResult'][_0x878e('0x74')],'responseId':_0x1fe8ce[_0x878e('0x75')],'score':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x76')],'speech':_0x1fe8ce[_0x878e('0x69')][_0x878e('0x70')],'providerResponse':JSON[_0x878e('0x40')](_0x38902e)};return _0x563071;}}});};exports[_0x878e('0x77')]=function(_0x1a620e,_0x55cea9,_0x5e7d5f,_0x3374a6){return tilde[_0x878e('0x4b')](_0x1a620e,_0x55cea9,_0x5e7d5f,_0x3374a6)[_0x878e('0x35')](function(_0x25933d){try{fs['unlink'](_0x1a620e);}catch(_0x4a1fa6){logger['error'](_0x4a1fa6);}logger[_0x878e('0x49')](_0x878e('0x78'),_0x25933d[_0x878e('0x4f')]);logger[_0x878e('0x49')](_0x878e('0x79'),_0x25933d[_0x878e('0x51')]);return _0x25933d;});};exports['awsPolly']=function(_0x1abff2,_0x2c6e08,_0x802749,_0x2b5d8a,_0x2c18bf,_0x5c82b2){var _0x2c1a29=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x39409a;return aws[_0x878e('0x7a')](_0x1abff2,_0x2c6e08,_0x802749,_0x2b5d8a,_0x2c18bf,_0x5c82b2,_0x2c1a29)[_0x878e('0x35')](function(){_0x39409a=path[_0x878e('0x36')](__dirname,'tmp',rs[_0x878e('0x26')](0x4)+_0x878e('0x27'));return convertFile(_0x2c1a29,_0x39409a);})[_0x878e('0x35')](function(){try{fs['unlink'](_0x2c1a29);fs[_0x878e('0x29')](_0x39409a,'777');}catch(_0x41c363){logger[_0x878e('0x13')](_0x41c363);}return _0x39409a[_0x878e('0x3b')]('.')[0x0];});};exports[_0x878e('0x7b')]=function(_0x18768f,_0x5d6da5,_0xaa7951,_0x51f6c9,_0x279b71,_0x208309){return aws[_0x878e('0x7c')](_0x18768f,_0x5d6da5,_0xaa7951,_0x51f6c9,_0x279b71,_0x208309)['then'](function(_0x976413){logger[_0x878e('0x49')](JSON[_0x878e('0x40')](_0x976413));return _0x976413;});};exports[_0x878e('0x7d')]=function(_0x2475ca,_0x6f400,_0x44f8a4,_0x21d78e){var _0x478388=util[_0x878e('0x7e')](_0x878e('0x7f'),ISPEECH_API,_0x2475ca,encodeURIComponent(_0x6f400),_0x44f8a4,_0x21d78e);var _0x4980d4=path['resolve'](__dirname,_0x878e('0x25'),rs[_0x878e('0x26')](0x4)+_0x878e('0x48'));var _0x438e40;return downloadFile(_0x478388,_0x4980d4)[_0x878e('0x35')](function(){_0x438e40=path[_0x878e('0x36')](__dirname,_0x878e('0x25'),rs['generate'](0x4)+_0x878e('0x27'));return convertFile(_0x4980d4,_0x438e40);})[_0x878e('0x35')](function(){try{fs[_0x878e('0x1a')](_0x4980d4);fs[_0x878e('0x29')](_0x438e40,_0x878e('0x2a'));}catch(_0xf439a){logger[_0x878e('0x13')](_0xf439a);}return _0x438e40[_0x878e('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0x302d85,_0x55b9d2,_0xedefd6,_0x1e99b8){var _0x4f96de=util[_0x878e('0x7e')](_0x878e('0x80'),ISPEECH_API,_0x55b9d2,_0xedefd6,base64Encode(_0x302d85),_0x1e99b8?util[_0x878e('0x7e')](_0x878e('0x81'),encodeURIComponent(_0x1e99b8)):_0x878e('0x82'));return uploadFile(_0x4f96de)[_0x878e('0x35')](function(_0x2f7e2d){return querystring[_0x878e('0x7')](_0x2f7e2d);});};exports[_0x878e('0x83')]=function(_0x482814,_0x2625ca){return sestek[_0x878e('0x84')](_0x482814,_0x2625ca)[_0x878e('0x35')](function(_0x56c353){logger[_0x878e('0x49')](JSON['stringify'](_0x56c353));var _0x1cb586={'speech':_0x56c353['text'],'action':_0x56c353[_0x878e('0x85')]?_0x56c353[_0x878e('0x85')][_0x878e('0x86')]:undefined,'actiondata':_0x56c353['channelData']?_0x56c353['channelData'][_0x878e('0x87')]:undefined};if(_0x56c353[_0x878e('0x85')]&&_0x56c353[_0x878e('0x85')][_0x878e('0x88')]){return base64Decode(_0x56c353[_0x878e('0x85')][_0x878e('0x88')][_0x878e('0x89')],path[_0x878e('0x36')](__dirname,'tmp',rs[_0x878e('0x26')](0x4)+_0x878e('0x27')))[_0x878e('0x35')](function(_0x48e6f0){_0x1cb586[_0x878e('0x8a')]=_0x48e6f0;return _0x1cb586;});}return _0x1cb586;});};exports[_0x878e('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0x0ca0=['statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','finish','finish\x20download\x20file','close','end','statusMessage','data','transcode','wav','info','finish\x20to\x20convert','start','resolve','tmp','generate','base64','unlink','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','then','.mp3','from','writeFile','chmodSync','.wav','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','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','textRequest','result','action','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','name','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get'];(function(_0x351e97,_0x6dbe53){var _0x42a125=function(_0x1b6d89){while(--_0x1b6d89){_0x351e97['push'](_0x351e97['shift']());}};_0x42a125(++_0x6dbe53);}(_0x0ca0,0x6d));var _0x00ca=function(_0x34a84f,_0x1e844e){_0x34a84f=_0x34a84f-0x0;var _0x49eeda=_0x0ca0[_0x34a84f];return _0x49eeda;};'use strict';var apiai=require(_0x00ca('0x0'));var BPromise=require(_0x00ca('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x00ca('0x2'));var https=require(_0x00ca('0x3'));var md5=require(_0x00ca('0x4'));var path=require(_0x00ca('0x5'));var querystring=require(_0x00ca('0x6'));var rp=require(_0x00ca('0x7'));var rs=require('randomstring');var sox=require(_0x00ca('0x8'));var tts=require(_0x00ca('0x9'));var urlParse=require('url')[_0x00ca('0xa')];var util=require(_0x00ca('0xb'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x00ca('0xc'));var tilde=require(_0x00ca('0xd'));var logger=require(_0x00ca('0xe'))(_0x00ca('0xf'));var ISPEECH_API=_0x00ca('0x10');function downloadFile(_0x4ac981,_0x4dc602){return new BPromise(function(_0x332532,_0xaa0896){var _0x73d1bd=urlParse(_0x4ac981);var _0x5baa58=_0x73d1bd[_0x00ca('0x11')]===_0x00ca('0x12')?https:http;var _0x51ea1d={'host':_0x73d1bd[_0x00ca('0x13')],'path':_0x73d1bd[_0x00ca('0x5')],'headers':{'user-agent':_0x00ca('0x14')}};_0x5baa58[_0x00ca('0x15')](_0x51ea1d,function(_0x56c81c){if(_0x56c81c[_0x00ca('0x16')]!==0xc8){logger[_0x00ca('0x17')](_0x00ca('0x18')+_0x4ac981+'\x20failed,\x20status\x20code\x20=\x20'+_0x56c81c['statusCode']+'\x20('+_0x56c81c['statusMessage']+')');_0xaa0896(new Error(_0x00ca('0x18')+_0x4ac981+_0x00ca('0x19')+_0x56c81c['statusCode']+'\x20('+_0x56c81c['statusMessage']+')'));return;}var _0x1b8394=fs['createWriteStream'](_0x4dc602);_0x1b8394['on'](_0x00ca('0x1a'),function(){logger['info'](_0x00ca('0x1b'));_0x1b8394[_0x00ca('0x1c')](_0x332532);});_0x1b8394['on']('error',function(_0x5ab78b){fs['unlink'](_0x4dc602);logger[_0x00ca('0x17')]('download\x20error',_0x5ab78b);_0xaa0896(_0x5ab78b);});_0x56c81c['pipe'](_0x1b8394);})['on'](_0x00ca('0x17'),function(_0x428f9a){logger[_0x00ca('0x17')](_0x428f9a);_0xaa0896(_0x428f9a);})[_0x00ca('0x1d')]();});}function uploadFile(_0x46a759){return new BPromise(function(_0xb7e27d,_0x3e38d3){var _0x4fdf0f=urlParse(_0x46a759);var _0x11bab3=_0x4fdf0f[_0x00ca('0x11')]===_0x00ca('0x12')?https:http;var _0x346363={'host':_0x4fdf0f[_0x00ca('0x13')],'path':_0x4fdf0f[_0x00ca('0x5')],'headers':{'user-agent':_0x00ca('0x14')}};_0x11bab3['get'](_0x346363,function(_0x36b9bd){if(_0x36b9bd[_0x00ca('0x16')]!==0xc8){_0x3e38d3(new Error(_0x00ca('0x18')+_0x46a759+_0x00ca('0x19')+_0x36b9bd[_0x00ca('0x16')]+'\x20('+_0x36b9bd[_0x00ca('0x1e')]+')'));return;}var _0x3bee61='';_0x36b9bd['on'](_0x00ca('0x1f'),function(_0x5aed1c){_0x3bee61+=_0x5aed1c;});_0x36b9bd['on'](_0x00ca('0x1d'),function(){_0xb7e27d(_0x3bee61);});})['on'](_0x00ca('0x17'),function(_0x4116c4){_0x3e38d3(_0x4116c4);})[_0x00ca('0x1d')]();});}function convertFile(_0x5437b2,_0x50ea15){return new BPromise(function(_0x47dae8,_0xd39725){var _0x504b37=sox[_0x00ca('0x20')](_0x5437b2,_0x50ea15,{'sampleRate':0x1f40,'format':_0x00ca('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x504b37['on'](_0x00ca('0x17'),function(_0x16aa09){logger[_0x00ca('0x17')]('error\x20convert',_0x16aa09);_0xd39725(_0x16aa09);});_0x504b37['on']('end',function(){logger[_0x00ca('0x22')](_0x00ca('0x23'));_0x47dae8();});_0x504b37[_0x00ca('0x24')]();});}function base64Decode(_0x2a65b2,_0x22c1d1){var _0x2306d6=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+'.wav');fs['writeFileSync'](_0x2306d6,_0x2a65b2,_0x00ca('0x28'));return convertFile(_0x2306d6,_0x22c1d1)['then'](function(){try{fs[_0x00ca('0x29')](_0x2306d6);fs['chmodSync'](_0x22c1d1,_0x00ca('0x2a'));}catch(_0x1c1825){logger[_0x00ca('0x17')](_0x1c1825);}return _0x22c1d1[_0x00ca('0x2b')]('.')[0x0];});}function base64Encode(_0x527d08){var _0x467b66=fs[_0x00ca('0x2c')](_0x527d08);return new Buffer(_0x467b66)['toString'](_0x00ca('0x28'));}exports[_0x00ca('0x2d')]=function(_0x1d4193,_0x117f8f,_0x1b7476,_0x225cc2,_0x242550,_0x97d483){var _0x2c3082,_0x41c18b;var _0x4710ae=_0x00ca('0x2e');var _0x3334b5=_0x00ca('0x2f')+_0x1d4193;var _0x4e2e03={};if(_0x117f8f===_0x00ca('0x30')){_0x4e2e03[_0x00ca('0x31')]={'ssml':_0x1b7476};}else{_0x4e2e03['input']={'text':_0x1b7476};};_0x4e2e03[_0x00ca('0x32')]={'languageCode':_0x225cc2,'ssmlGender':_0x242550};_0x4e2e03['audioConfig']={'audioEncoding':_0x00ca('0x33'),'sampleRateHertz':0x1f40};var _0x3c730d={'url':_0x4710ae+_0x00ca('0x34')+_0x3334b5,'method':_0x00ca('0x35'),'json':!![],'body':_0x4e2e03};return rp(_0x3c730d)[_0x00ca('0x36')](function(_0x369352){return new BPromise(function(_0x1f5ab9,_0x23577e){_0x2c3082=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+_0x00ca('0x37'));var _0x113b16=Buffer[_0x00ca('0x38')](_0x369352['audioContent'],_0x00ca('0x28'));return fs[_0x00ca('0x39')](_0x2c3082,_0x113b16,function(_0x7d3638){_0x23577e(_0x7d3638);},function(_0x167f57){fs[_0x00ca('0x3a')](_0x2c3082,'777');_0x1f5ab9(_0x167f57);});});})[_0x00ca('0x36')](function(_0x31489f){_0x41c18b=path[_0x00ca('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x00ca('0x3b'));return convertFile(_0x2c3082,_0x41c18b);})['then'](function(){try{fs['unlink'](_0x2c3082);fs[_0x00ca('0x3a')](_0x41c18b,'777');}catch(_0x48c99a){logger[_0x00ca('0x17')](_0x48c99a);}logger['info'](_0x00ca('0x3c'),_0x41c18b[_0x00ca('0x2b')]('.')[0x0]);return _0x41c18b['split']('.')[0x0];});};exports[_0x00ca('0x3d')]=function(_0x3a5fb3,_0x20faa1){var _0x5b8d1c=_0x00ca('0x3e');var _0x5490b1,_0x9853de;var _0x416885;var _0x17ea28={'encoding':_0x00ca('0x3f'),'method':'POST','timeout':0x2710,'url':_0x5b8d1c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x00ca('0x40'),JSON[_0x00ca('0x41')]([_0x3a5fb3,_0x20faa1||'en',![],_0x00ca('0x42')]),null,_0x00ca('0x43')]]]))};return rp(_0x17ea28)['then'](function(_0x5ebccd){try{_0x416885=eval(_0x5ebccd[_0x00ca('0x44')](0x5))[0x0][0x2];}catch(_0x45a3ad){throw new Error(_0x00ca('0x45')+_0x5ebccd[_0x00ca('0x1f')]);}if(!_0x416885){if(_0x3a5fb3[_0x00ca('0x46')]>0xc8){throw new Error(_0x00ca('0x47'));}else{throw new Error('lang\x20\x22'+_0x20faa1+_0x00ca('0x48'));}}try{_0x416885=eval(_0x416885)[0x0];}catch(_0x51ec66){throw new Error(_0x00ca('0x45')+res[_0x00ca('0x1f')]);}const _0x43cf0=_0x416885;_0x5490b1=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+_0x00ca('0x37'));fs[_0x00ca('0x49')](_0x5490b1,_0x416885,{'encoding':_0x00ca('0x28')});_0x9853de=path['resolve'](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+'.wav');return convertFile(_0x5490b1,_0x9853de);})['then'](function(){try{fs[_0x00ca('0x29')](_0x5490b1);fs[_0x00ca('0x3a')](_0x9853de,'777');}catch(_0x3a2682){logger[_0x00ca('0x17')](_0x3a2682);}logger['info'](_0x00ca('0x4a'),_0x9853de[_0x00ca('0x2b')]('.')[0x0]);return _0x9853de[_0x00ca('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x87770d,_0x489f66,_0x1f7475){return google[_0x00ca('0x4b')](_0x87770d,_0x489f66,_0x1f7475)['then'](function(_0x29a353){logger[_0x00ca('0x22')](_0x29a353['uri']);return rp(_0x29a353);})[_0x00ca('0x36')](function(_0x5794a1){var _0xb60a9='';var _0x4a90a0=0x0;try{fs[_0x00ca('0x29')](_0x87770d);}catch(_0x34c75c){logger['error'](_0x34c75c);}if(_0x5794a1&&_0x5794a1['results']){_0xb60a9=_0x5794a1[_0x00ca('0x4c')][_0x00ca('0x4d')](function(_0x342cbf){return _0x342cbf&&_0x342cbf[_0x00ca('0x4e')][0x0]&&_0x342cbf[_0x00ca('0x4e')][0x0][_0x00ca('0x4f')]?_0x342cbf[_0x00ca('0x4e')][0x0][_0x00ca('0x4f')]:'';})['join']('\x0a');_0x4a90a0=_0x5794a1['results'][_0x00ca('0x4d')](function(_0x5145e8){return _0x5145e8&&_0x5145e8[_0x00ca('0x4e')][0x0]&&_0x5145e8[_0x00ca('0x4e')][0x0][_0x00ca('0x50')]?_0x5145e8['alternatives'][0x0][_0x00ca('0x50')]:0x0;})['join']('\x0a');}logger['info'](_0x00ca('0x51'),_0xb60a9);logger[_0x00ca('0x22')](_0x00ca('0x52'),_0x4a90a0);return{'transcript':_0xb60a9,'confidence':_0x4a90a0};})[_0x00ca('0x53')](function(_0x49691a){logger[_0x00ca('0x17')](_0x00ca('0x54'),_0x49691a[_0x00ca('0x16')],_0x49691a['name'],_0x49691a['message']);});};exports['googleDialogflow']=function(_0x3cb969,_0x4113cb,_0x12478f,_0x48c35c){var _0x28bc03=apiai(_0x4113cb,{'language':_0x48c35c||'en'});return _0x28bc03[_0x00ca('0x55')](_0x12478f,{'sessionId':md5(_0x3cb969)})[_0x00ca('0x36')](function(_0x284402){logger['info'](JSON[_0x00ca('0x41')](_0x284402));return{'source':_0x284402[_0x00ca('0x56')]['source'],'resolvedQuery':_0x284402[_0x00ca('0x56')]['resolvedQuery'],'action':_0x284402[_0x00ca('0x56')][_0x00ca('0x57')],'actionIncomplete':_0x284402[_0x00ca('0x56')][_0x00ca('0x58')],'speech':_0x284402[_0x00ca('0x56')][_0x00ca('0x59')][_0x00ca('0x5a')],'score':_0x284402[_0x00ca('0x56')]['score'],'statusCode':_0x284402['status'][_0x00ca('0x5b')],'endConversation':_0x284402[_0x00ca('0x56')][_0x00ca('0x5c')][_0x00ca('0x5d')]||![],'isFallbackIntent':_0x284402[_0x00ca('0x56')]['metadata'][_0x00ca('0x5e')]};});};exports['googleDialogflowV2']=function(_0x306b6d,_0x25ef18,_0x36e56e,_0x29843d,_0x31228c,_0x2d0831){var _0x4da2ac=_0x29843d[_0x00ca('0x5f')](/\\n/g,'\x0a');var _0x4f6cf6={'credentials':{'private_key':_0x4da2ac,'client_email':_0x36e56e}};var _0x29c0f7=new dialogflow['SessionsClient'](_0x4f6cf6);var _0x132b89=_0x29c0f7['sessionPath'](_0x25ef18,md5(_0x306b6d));var _0x2fb77e={'session':_0x132b89,'queryInput':{'text':{'text':_0x31228c,'languageCode':_0x2d0831}}};return _0x29c0f7[_0x00ca('0x60')](_0x2fb77e)[_0x00ca('0x36')](function(_0x9ad298){if(_0x9ad298&&_0x9ad298[_0x00ca('0x46')]){logger[_0x00ca('0x22')](_0x00ca('0x61'),JSON[_0x00ca('0x41')](_0x9ad298));var _0x1673be=_0x9ad298[0x0];if(_0x1673be){var _0x393a69={'action':_0x1673be[_0x00ca('0x62')][_0x00ca('0x57')],'allRequiredParamsPresent':_0x1673be[_0x00ca('0x62')][_0x00ca('0x63')],'endConversation':_0x1673be['queryResult']['diagnosticInfo']&&_0x1673be['queryResult']['diagnosticInfo'][_0x00ca('0x64')]?_0x1673be[_0x00ca('0x62')][_0x00ca('0x65')][_0x00ca('0x64')][_0x00ca('0x66')][_0x00ca('0x67')]:![],'fulfillmentText':_0x1673be['queryResult']['fulfillmentText'],'intentName':_0x1673be[_0x00ca('0x62')]['intent'][_0x00ca('0x68')],'intentDisplayName':_0x1673be[_0x00ca('0x62')][_0x00ca('0x69')][_0x00ca('0x6a')],'isFallbackIntent':_0x1673be[_0x00ca('0x62')][_0x00ca('0x69')][_0x00ca('0x6b')],'languageCode':_0x1673be['queryResult'][_0x00ca('0x6c')],'queryText':_0x1673be[_0x00ca('0x62')][_0x00ca('0x6d')],'responseId':_0x1673be[_0x00ca('0x6e')],'score':_0x1673be[_0x00ca('0x62')][_0x00ca('0x6f')],'speech':_0x1673be[_0x00ca('0x62')][_0x00ca('0x70')],'providerResponse':JSON['stringify'](_0x9ad298)};return _0x393a69;}}});};exports[_0x00ca('0x71')]=function(_0x2f5f30,_0x5b3ead,_0x3d7439,_0xabf866){return tilde[_0x00ca('0x4b')](_0x2f5f30,_0x5b3ead,_0x3d7439,_0xabf866)[_0x00ca('0x36')](function(_0xe1b3d1){try{fs[_0x00ca('0x29')](_0x2f5f30);}catch(_0x57dd0c){logger[_0x00ca('0x17')](_0x57dd0c);}logger['info']('Tilde\x20ASR\x20transcription',_0xe1b3d1[_0x00ca('0x4f')]);logger['info'](_0x00ca('0x72'),_0xe1b3d1[_0x00ca('0x50')]);return _0xe1b3d1;});};exports[_0x00ca('0x73')]=function(_0x45e22b,_0x1c9c0f,_0x4574a0,_0x3ee4bb,_0x2f830f,_0x241fe9){var _0xbf1f8b=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+_0x00ca('0x37'));var _0x4f9eff;return aws[_0x00ca('0x74')](_0x45e22b,_0x1c9c0f,_0x4574a0,_0x3ee4bb,_0x2f830f,_0x241fe9,_0xbf1f8b)[_0x00ca('0x36')](function(){_0x4f9eff=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+_0x00ca('0x3b'));return convertFile(_0xbf1f8b,_0x4f9eff);})[_0x00ca('0x36')](function(){try{fs[_0x00ca('0x29')](_0xbf1f8b);fs['chmodSync'](_0x4f9eff,_0x00ca('0x2a'));}catch(_0x113af4){logger[_0x00ca('0x17')](_0x113af4);}return _0x4f9eff['split']('.')[0x0];});};exports[_0x00ca('0x75')]=function(_0x288531,_0x3831b2,_0x1b49f3,_0x4a8c5d,_0xc51860,_0x18883d){return aws['lex'](_0x288531,_0x3831b2,_0x1b49f3,_0x4a8c5d,_0xc51860,_0x18883d)['then'](function(_0x1ec71f){logger[_0x00ca('0x22')](JSON[_0x00ca('0x41')](_0x1ec71f));return _0x1ec71f;});};exports['ispeechTTS']=function(_0x4f8758,_0x2224b5,_0x281971,_0x198333){var _0x40ac69=util[_0x00ca('0x76')](_0x00ca('0x77'),ISPEECH_API,_0x4f8758,encodeURIComponent(_0x2224b5),_0x281971,_0x198333);var _0x2caadb=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+_0x00ca('0x37'));var _0x49e6be;return downloadFile(_0x40ac69,_0x2caadb)['then'](function(){_0x49e6be=path[_0x00ca('0x25')](__dirname,_0x00ca('0x26'),rs[_0x00ca('0x27')](0x4)+'.wav');return convertFile(_0x2caadb,_0x49e6be);})[_0x00ca('0x36')](function(){try{fs[_0x00ca('0x29')](_0x2caadb);fs[_0x00ca('0x3a')](_0x49e6be,'777');}catch(_0x1e2c93){logger[_0x00ca('0x17')](_0x1e2c93);}return _0x49e6be['split']('.')[0x0];});};exports[_0x00ca('0x78')]=function(_0x117395,_0x6eb63b,_0x27dab4,_0x3414d8){var _0x2aae08=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x6eb63b,_0x27dab4,base64Encode(_0x117395),_0x3414d8?util[_0x00ca('0x76')](_0x00ca('0x79'),encodeURIComponent(_0x3414d8)):'freeform=3');return uploadFile(_0x2aae08)['then'](function(_0x287fc6){return querystring[_0x00ca('0xa')](_0x287fc6);});};exports['sestekNDA']=function(_0x4b5911,_0x132cbe){return sestek[_0x00ca('0x7a')](_0x4b5911,_0x132cbe)[_0x00ca('0x36')](function(_0x332ddf){logger[_0x00ca('0x22')](JSON[_0x00ca('0x41')](_0x332ddf));var _0xc49fb5={'speech':_0x332ddf[_0x00ca('0x7b')],'action':_0x332ddf[_0x00ca('0x7c')]?_0x332ddf[_0x00ca('0x7c')][_0x00ca('0x7d')]:undefined,'actiondata':_0x332ddf['channelData']?_0x332ddf[_0x00ca('0x7c')][_0x00ca('0x7e')]:undefined};if(_0x332ddf[_0x00ca('0x7c')]&&_0x332ddf[_0x00ca('0x7c')][_0x00ca('0x7f')]){return base64Decode(_0x332ddf[_0x00ca('0x7c')][_0x00ca('0x7f')][_0x00ca('0x80')],path[_0x00ca('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x00ca('0x3b')))[_0x00ca('0x36')](function(_0x11da75){_0xc49fb5[_0x00ca('0x81')]=_0x11da75;return _0xc49fb5;});}return _0xc49fb5;});};exports[_0x00ca('0x82')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 6708666..e4dbd3f 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 _0x96fe=['./nda','exports'];(function(_0x5eb62e,_0x1d0dc8){var _0x10b750=function(_0x4705fe){while(--_0x4705fe){_0x5eb62e['push'](_0x5eb62e['shift']());}};_0x10b750(++_0x1d0dc8);}(_0x96fe,0x1da));var _0xe96f=function(_0x50b462,_0x34e287){_0x50b462=_0x50b462-0x0;var _0x576290=_0x96fe[_0x50b462];return _0x576290;};var nda=require(_0xe96f('0x0'));module[_0xe96f('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5650=['./nda','exports'];(function(_0x1cbfc5,_0x2c7736){var _0x426122=function(_0xbdd327){while(--_0xbdd327){_0x1cbfc5['push'](_0x1cbfc5['shift']());}};_0x426122(++_0x2c7736);}(_0x5650,0x130));var _0x0565=function(_0x3f7a3d,_0x42dbfa){_0x3f7a3d=_0x3f7a3d-0x0;var _0x272beb=_0x5650[_0x3f7a3d];return _0x272beb;};var nda=require(_0x0565('0x0'));module[_0x0565('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1194997..8ca28bc 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 _0x0cfa=['resolve','ndauth_url','/token','password','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi'];(function(_0x299282,_0x248baf){var _0x5f432d=function(_0x46edaf){while(--_0x46edaf){_0x299282['push'](_0x299282['shift']());}};_0x5f432d(++_0x248baf);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x42f4c5,_0x4a5fec){_0x42f4c5=_0x42f4c5-0x0;var _0x878cbf=_0x0cfa[_0x42f4c5];return _0x878cbf;};'use strict';var rp=require(_0xa0cf('0x0'));var url=require(_0xa0cf('0x1'));var logger=require(_0xa0cf('0x2'))(_0xa0cf('0x3'));module['exports']=function(_0x525629,_0x4d8758){var _0x37c4e1={'method':'POST','uri':url[_0xa0cf('0x4')](_0x4d8758[_0xa0cf('0x5')],_0xa0cf('0x6')),'form':{'grant_type':_0xa0cf('0x7'),'username':_0x4d8758['username'],'password':_0x4d8758[_0xa0cf('0x7')]},'json':!![]};return rp(_0x37c4e1)['then'](function(_0x232245){var _0x5f0054={'method':_0xa0cf('0x8'),'uri':url['resolve'](_0x4d8758[_0xa0cf('0x9')],_0xa0cf('0xa')),'body':{'type':_0x4d8758[_0xa0cf('0xb')]||'message','channelId':_0xa0cf('0xc'),'conversation':{'id':_0x525629[_0xa0cf('0xd')]},'from':{'id':_0x525629['callerid'],'name':_0x525629['calleridname']},'recipient':{'id':_0x525629[_0xa0cf('0xe')],'name':_0x525629[_0xa0cf('0xf')]},'text':_0x4d8758[_0xa0cf('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x232245[_0xa0cf('0x11')]},'json':!![]};if(_0x4d8758[_0xa0cf('0x12')]){_0x5f0054[_0xa0cf('0x13')][_0xa0cf('0x14')][_0xa0cf('0x15')]=_0x4d8758[_0xa0cf('0x12')];}if(_0x4d8758[_0xa0cf('0x16')]=='1'){_0x5f0054['body'][_0xa0cf('0x14')][_0xa0cf('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa0cf('0x18')};}if(_0x4d8758['custom_action']){_0x5f0054[_0xa0cf('0x13')][_0xa0cf('0x14')][_0xa0cf('0x19')]=_0x4d8758[_0xa0cf('0x1a')];if(_0x4d8758[_0xa0cf('0x1b')]){_0x5f0054['body'][_0xa0cf('0x14')][_0xa0cf('0x1c')]=_0x4d8758['custom_action_data'];}}logger[_0xa0cf('0x1d')](JSON[_0xa0cf('0x1e')](_0x5f0054));return rp(_0x5f0054);});}; \ No newline at end of file +var _0xdbfc=['CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid','text','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav'];(function(_0xf4868e,_0x45a7f9){var _0x290d23=function(_0x19ac16){while(--_0x19ac16){_0xf4868e['push'](_0xf4868e['shift']());}};_0x290d23(++_0x45a7f9);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x430842,_0x30d2d7){_0x430842=_0x430842-0x0;var _0x576ea1=_0xdbfc[_0x430842];return _0x576ea1;};'use strict';var rp=require(_0xcdbf('0x0'));var url=require(_0xcdbf('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0xcdbf('0x2')]=function(_0x3067d8,_0x3db24f){var _0x3ed1e1={'method':_0xcdbf('0x3'),'uri':url[_0xcdbf('0x4')](_0x3db24f[_0xcdbf('0x5')],'/token'),'form':{'grant_type':_0xcdbf('0x6'),'username':_0x3db24f[_0xcdbf('0x7')],'password':_0x3db24f['password']},'json':!![]};return rp(_0x3ed1e1)[_0xcdbf('0x8')](function(_0x3c077d){var _0x409a4e={'method':_0xcdbf('0x3'),'uri':url['resolve'](_0x3db24f[_0xcdbf('0x9')],_0xcdbf('0xa')),'body':{'type':_0x3db24f[_0xcdbf('0xb')]||_0xcdbf('0xc'),'channelId':_0xcdbf('0xd'),'conversation':{'id':_0x3067d8['uniqueid']},'from':{'id':_0x3067d8[_0xcdbf('0xe')],'name':_0x3067d8['calleridname']},'recipient':{'id':_0x3067d8[_0xcdbf('0xf')],'name':_0x3067d8['extension']},'text':_0x3db24f[_0xcdbf('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3c077d[_0xcdbf('0x11')]},'json':!![]};if(_0x3db24f[_0xcdbf('0x12')]){_0x409a4e[_0xcdbf('0x13')]['channelData'][_0xcdbf('0x14')]=_0x3db24f['project'];}if(_0x3db24f[_0xcdbf('0x15')]=='1'){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcdbf('0x18')};}if(_0x3db24f['custom_action']){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x19')]=_0x3db24f[_0xcdbf('0x1a')];if(_0x3db24f[_0xcdbf('0x1b')]){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x1c')]=_0x3db24f[_0xcdbf('0x1b')];}}logger[_0xcdbf('0x1d')](JSON[_0xcdbf('0x1e')](_0x409a4e));return rp(_0x409a4e);});}; \ 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 e787214..197d7fa 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 _0x36b5=['./lib/api','exports'];(function(_0x29e314,_0x19d592){var _0x4c9fcb=function(_0xcb1c9){while(--_0xcb1c9){_0x29e314['push'](_0x29e314['shift']());}};_0x4c9fcb(++_0x19d592);}(_0x36b5,0x196));var _0x536b=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0x36b5[_0xb36843];return _0x227b83;};'use strict';var asr=require(_0x536b('0x0'));module[_0x536b('0x1')]=function(_0x1f2c49,_0x3dca86,_0x25fd4f,_0x342b7b){return asr(_0x1f2c49,_0x3dca86,_0x25fd4f,_0x342b7b);}; \ No newline at end of file +var _0xd186=['exports'];(function(_0x3f5bc1,_0x4dd83d){var _0x5e73e0=function(_0x3abcb3){while(--_0x3abcb3){_0x3f5bc1['push'](_0x3f5bc1['shift']());}};_0x5e73e0(++_0x4dd83d);}(_0xd186,0x133));var _0x6d18=function(_0x48c7ce,_0x5c3d69){_0x48c7ce=_0x48c7ce-0x0;var _0x3e6a24=_0xd186[_0x48c7ce];return _0x3e6a24;};'use strict';var asr=require('./lib/api');module[_0x6d18('0x0')]=function(_0x5e5367,_0x2e8081,_0x2a50cb,_0x25b7e5){return asr(_0x5e5367,_0x2e8081,_0x2a50cb,_0x25b7e5);}; \ 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 5478ed1..7e83f65 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 _0xc6bc=['moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash'];(function(_0x51c6b9,_0x150fc0){var _0x4bb8e2=function(_0x3d5e4e){while(--_0x3d5e4e){_0x51c6b9['push'](_0x51c6b9['shift']());}};_0x4bb8e2(++_0x150fc0);}(_0xc6bc,0x166));var _0xcc6b=function(_0x5cc18d,_0x1889e7){_0x5cc18d=_0x5cc18d-0x0;var _0xdb2b4b=_0xc6bc[_0x5cc18d];return _0xdb2b4b;};'use strict';var BPromise=require(_0xcc6b('0x0'));var _=require(_0xcc6b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcc6b('0x2'));var crypto=require(_0xcc6b('0x3'));var logger=require(_0xcc6b('0x4'))(_0xcc6b('0x5'));module[_0xcc6b('0x6')]=function(_0x5e80bb,_0x4dee95,_0x37d956,_0x236fe6){return new BPromise(function(_0x3832f2,_0x10d60a){logger[_0xcc6b('0x7')]('Tilde\x20URI',_0x236fe6||_0xcc6b('0x8'));var _0x1d50ff=new WebSocket(_0x236fe6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2edd07='';var _0x7e8ac7='0';var _0x414206='1';var _0xf176a0=_0xcc6b('0x9');function _0x45df37(_0x5f515b){var _0x4fc23f=crypto[_0xcc6b('0xa')](_0xcc6b('0xb'));_0x4fc23f[_0xcc6b('0xc')](_0x5f515b);return _0x4fc23f[_0xcc6b('0xd')](_0xcc6b('0xe'));}function _0x447050(){try{logger['info'](_0xcc6b('0xf'));var _0xf14fe5=moment()[_0xcc6b('0x10')]();var _0x3c15d9=_0x45df37(_0xf14fe5+_0x4dee95+_0x37d956);_0x1d50ff[_0xcc6b('0x11')](JSON[_0xcc6b('0x12')]({'appID':_0x4dee95,'timestamp':_0xf14fe5,'appKey':_0x3c15d9}));var _0x41d18e=fs[_0xcc6b('0x13')](_0x5e80bb);_0x41d18e['on'](_0xcc6b('0x14'),function(_0x1335b8){_0x1d50ff[_0xcc6b('0x11')](_0x1335b8);});_0x41d18e['on'](_0xcc6b('0x15'),function(){_0x1d50ff[_0xcc6b('0x11')](_0xcc6b('0x16'));});}catch(_0x14e7bf){logger[_0xcc6b('0x17')](_0xcc6b('0x18'),JSON['stringify'](_0x14e7bf));_0x1d50ff['terminate']();}}function _0x2b1711(_0x2a080b){try{if(_0x2a080b){var _0x325213=JSON['parse'](_0x2a080b);switch(_0x325213['status']){case 0x0:if(_0x325213[_0xcc6b('0x19')]){if(_0x325213['result']['final']){logger[_0xcc6b('0x7')](_0xcc6b('0x1a'),JSON[_0xcc6b('0x12')](_0x325213[_0xcc6b('0x19')]['hypotheses']));_0x2edd07=_0x325213['result'][_0xcc6b('0x1b')][0x0][_0xcc6b('0x1c')];_0x7e8ac7=_0x325213['result'][_0xcc6b('0x1b')][0x0][_0xcc6b('0x1d')];_0x414206='0';_0xf176a0=_0xcc6b('0x1e');_0x1d50ff[_0xcc6b('0x1f')]();}}break;case 0x1:logger['info'](_0xcc6b('0x9'));_0x414206='1';_0xf176a0='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xcc6b('0x20'));_0x414206='2';_0xf176a0=_0xcc6b('0x20');break;case 0x9:logger[_0xcc6b('0x7')](_0xcc6b('0x21'));_0x414206='9';_0xf176a0=_0xcc6b('0x21');break;case 0xa:logger['info'](_0xcc6b('0x22'));_0x414206='10';_0xf176a0='Authentication\x20failed.';break;case 0xb:logger[_0xcc6b('0x7')](_0xcc6b('0x23'));_0x414206='11';_0xf176a0='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x51e2c5){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xcc6b('0x12')](_0x51e2c5));_0x1d50ff[_0xcc6b('0x1f')]();}}function _0x700bfc(){logger[_0xcc6b('0x7')](_0xcc6b('0x24'));_0x3832f2({'transcript':_0x2edd07,'confidence':_0x7e8ac7,'status':_0x414206,'status_message':_0xf176a0});}function _0x2741f3(_0x3d3e13){logger[_0xcc6b('0x17')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x3d3e13)){logger[_0xcc6b('0x17')](_[_0xcc6b('0x25')](_0x3d3e13)?JSON[_0xcc6b('0x12')](_0x3d3e13):_0x3d3e13);}}_0x1d50ff['on'](_0xcc6b('0x26'),_0x447050);_0x1d50ff['on'](_0xcc6b('0x27'),_0x2b1711);_0x1d50ff['on'](_0xcc6b('0x15'),_0x700bfc);_0x1d50ff['on'](_0xcc6b('0x17'),_0x2741f3);});}; \ No newline at end of file +var _0xa989=['Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','error','Tilde\x20ASR\x20send\x20error','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','close','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa989,0x10b));var _0x9a98=function(_0x1c58a0,_0x22c4be){_0x1c58a0=_0x1c58a0-0x0;var _0x339d7d=_0xa989[_0x1c58a0];return _0x339d7d;};'use strict';var BPromise=require('bluebird');var _=require(_0x9a98('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9a98('0x1'));var crypto=require(_0x9a98('0x2'));var logger=require(_0x9a98('0x3'))(_0x9a98('0x4'));module[_0x9a98('0x5')]=function(_0x369470,_0x463a3e,_0x5e702f,_0xf4e460){return new BPromise(function(_0x5caa43,_0x3975e2){logger['info'](_0x9a98('0x6'),_0xf4e460||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1f22d3=new WebSocket(_0xf4e460||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x213037='';var _0x514c56='0';var _0x2d8b32='1';var _0x1dfa6a=_0x9a98('0x7');function _0x29294c(_0x12fb1d){var _0xa99b58=crypto[_0x9a98('0x8')](_0x9a98('0x9'));_0xa99b58['update'](_0x12fb1d);return _0xa99b58['digest'](_0x9a98('0xa'));}function _0x8de8b4(){try{logger[_0x9a98('0xb')](_0x9a98('0xc'));var _0x551fd9=moment()[_0x9a98('0xd')]();var _0x8ea605=_0x29294c(_0x551fd9+_0x463a3e+_0x5e702f);_0x1f22d3[_0x9a98('0xe')](JSON[_0x9a98('0xf')]({'appID':_0x463a3e,'timestamp':_0x551fd9,'appKey':_0x8ea605}));var _0x1f7109=fs['createReadStream'](_0x369470);_0x1f7109['on'](_0x9a98('0x10'),function(_0x5f0f8d){_0x1f22d3[_0x9a98('0xe')](_0x5f0f8d);});_0x1f7109['on']('close',function(){_0x1f22d3[_0x9a98('0xe')]('EOS');});}catch(_0xcb8267){logger[_0x9a98('0x11')](_0x9a98('0x12'),JSON[_0x9a98('0xf')](_0xcb8267));_0x1f22d3[_0x9a98('0x13')]();}}function _0x4d8205(_0x315d10){try{if(_0x315d10){var _0x1c1865=JSON[_0x9a98('0x14')](_0x315d10);switch(_0x1c1865[_0x9a98('0x15')]){case 0x0:if(_0x1c1865['result']){if(_0x1c1865[_0x9a98('0x16')]['final']){logger[_0x9a98('0xb')](_0x9a98('0x17'),JSON[_0x9a98('0xf')](_0x1c1865[_0x9a98('0x16')]['hypotheses']));_0x213037=_0x1c1865['result'][_0x9a98('0x18')][0x0][_0x9a98('0x19')];_0x514c56=_0x1c1865['result']['hypotheses'][0x0][_0x9a98('0x1a')];_0x2d8b32='0';_0x1dfa6a=_0x9a98('0x1b');_0x1f22d3[_0x9a98('0x13')]();}}break;case 0x1:logger[_0x9a98('0xb')](_0x9a98('0x7'));_0x2d8b32='1';_0x1dfa6a=_0x9a98('0x7');break;case 0x2:logger[_0x9a98('0xb')](_0x9a98('0x1c'));_0x2d8b32='2';_0x1dfa6a='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x9a98('0xb')](_0x9a98('0x1d'));_0x2d8b32='9';_0x1dfa6a=_0x9a98('0x1d');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2d8b32='10';_0x1dfa6a=_0x9a98('0x1e');break;case 0xb:logger['info'](_0x9a98('0x1f'));_0x2d8b32='11';_0x1dfa6a=_0x9a98('0x1f');}}}catch(_0x4ba09a){logger[_0x9a98('0x11')](_0x9a98('0x20'),JSON['stringify'](_0x4ba09a));_0x1f22d3[_0x9a98('0x13')]();}}function _0x5557a3(){logger[_0x9a98('0xb')](_0x9a98('0x21'));_0x5caa43({'transcript':_0x213037,'confidence':_0x514c56,'status':_0x2d8b32,'status_message':_0x1dfa6a});}function _0x3f2209(_0x1905c7){logger[_0x9a98('0x11')](_0x9a98('0x22'));if(!_['isNil'](_0x1905c7)){logger[_0x9a98('0x11')](_[_0x9a98('0x23')](_0x1905c7)?JSON[_0x9a98('0xf')](_0x1905c7):_0x1905c7);}}_0x1f22d3['on'](_0x9a98('0x24'),_0x8de8b4);_0x1f22d3['on'](_0x9a98('0x25'),_0x4d8205);_0x1f22d3['on'](_0x9a98('0x26'),_0x5557a3);_0x1f22d3['on'](_0x9a98('0x11'),_0x3f2209);});}; \ 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 2c36e65..476902f 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 _0xdcbb=['./asr','exports'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0xdcbb,0x16e));var _0xbdcb=function(_0x1669fb,_0x18504f){_0x1669fb=_0x1669fb-0x0;var _0x5a8eb4=_0xdcbb[_0x1669fb];return _0x5a8eb4;};var asr=require(_0xbdcb('0x0'));module[_0xbdcb('0x1')]={'asr':asr}; \ No newline at end of file +var _0x616b=['./asr'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x616b,0xe9));var _0xb616=function(_0x44c8cb,_0x2e28c7){_0x44c8cb=_0x44c8cb-0x0;var _0x3bf406=_0x616b[_0x44c8cb];return _0x3bf406;};var asr=require(_0xb616('0x0'));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 fc8fd65..41bc14c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _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(_0x57408b,_0xb7cbc5){var _0x31a897=function(_0x5810ac){while(--_0x5810ac){_0x57408b['push'](_0x57408b['shift']());}};_0x31a897(++_0xb7cbc5);}(_0xe706,0xa3));var _0x6e70=function(_0x174d8b,_0x30ed1c){_0x174d8b=_0x174d8b-0x0;var _0x2d271d=_0xe706[_0x174d8b];return _0x2d271d;};'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 b68a3c9..0442354 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 _0xb66c=['agentLogin','internal','LOCAL','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','headers','rawHeaders','parse','computedVariables','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','getVariable','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','substr','generate','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_secret_access_key','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','stringify','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','AGENT\x20%s\x20FOUND\x20BY','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','no\x20variable\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','no\x20mail\x20account\x20found','Smtp','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Skipped\x20Answer','subproject','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','getVoiceQueue','then','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','priority','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xb66c,0x175));var _0xcb66=function(_0x59bc77,_0x4556aa){_0x59bc77=_0x59bc77-0x0;var _0x19b145=_0xb66c[_0x59bc77];return _0x19b145;};'use strict';var fs=require('fs');var util=require(_0xcb66('0x0'));var _=require('lodash');var sh=require(_0xcb66('0x1'));var odbc=require('odbc')();var rs=require(_0xcb66('0x2'));var moment=require(_0xcb66('0x3'));var Mustache=require(_0xcb66('0x4'));var rp=require('request-promise');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var scripts=require(_0xcb66('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xcb66('0x9')];var verticesWithRetry=[_0xcb66('0xa'),_0xcb66('0xb'),_0xcb66('0xc')];var AGIVertices=function(_0xf7bc39,_0x58582b,_0x2c62ad){this[_0xcb66('0xd')]=_0xf7bc39;this[_0xcb66('0xe')]=_0x58582b;this[_0xcb66('0xf')]=_0x2c62ad;};AGIVertices[_0xcb66('0x10')]['getVariable']=function(_0x393bde,_0x2b32ec){this[_0xcb66('0xe')][_0xcb66('0x11')](_0x393bde)['then'](function(_0x9eda68){_0x2b32ec(null,_0x9eda68?_0x9eda68[_0xcb66('0x12')]:![]);})[_0xcb66('0x13')](function(_0x2339bb){_0x2b32ec(_0x2339bb);});};AGIVertices['prototype'][_0xcb66('0x14')]=function(_0x40c810,_0x36c846){this[_0xcb66('0xe')]['getVoiceQueueById'](_0x40c810)[_0xcb66('0x15')](function(_0x540e7e){_0x36c846(null,_0x540e7e?_0x540e7e[_0xcb66('0x12')]:![]);})['catch'](function(_0x27442d){_0x36c846(_0x27442d);});};AGIVertices['prototype']['getSquareProject']=function(_0x274aed,_0x13cfea){this[_0xcb66('0xe')][_0xcb66('0x16')](_0x274aed)['then'](function(_0x3a6e26){_0x13cfea(null,_0x3a6e26?_0x3a6e26[_0xcb66('0x12')]:![]);})[_0xcb66('0x13')](function(_0x58bca0){_0x13cfea(_0x58bca0);});};AGIVertices[_0xcb66('0x10')]['getSquareOdbc']=function(_0x4165ea,_0x41edae){this[_0xcb66('0xe')][_0xcb66('0x17')](_0x4165ea)['then'](function(_0x51990b){_0x41edae(null,_0x51990b?_0x51990b['dsn']:![]);})[_0xcb66('0x13')](function(_0x4b13d4){_0x41edae(_0x4b13d4);});};AGIVertices['prototype'][_0xcb66('0x18')]=function(_0x507d5a,_0x1c1219){this[_0xcb66('0xe')][_0xcb66('0x19')](_0x507d5a)[_0xcb66('0x15')](function(_0x1261d2){_0x1c1219(null,_0x1261d2?_0x1261d2[_0xcb66('0x12')]:![]);})[_0xcb66('0x13')](function(_0x5977e1){_0x1c1219(_0x5977e1);});};AGIVertices[_0xcb66('0x10')]['getTrunk']=function(_0x4cdcd9,_0xf89c0e){this[_0xcb66('0xe')][_0xcb66('0x1a')](_0x4cdcd9)['then'](function(_0x341554){_0xf89c0e(null,_0x341554?_0x341554[_0xcb66('0x12')]:![]);})[_0xcb66('0x13')](function(_0x40e3de){_0xf89c0e(_0x40e3de);});};AGIVertices['prototype'][_0xcb66('0x1b')]=function(_0x31560e,_0x134987){var _0x293711=this;this[_0xcb66('0xe')][_0xcb66('0x1c')](_0x31560e)[_0xcb66('0x15')](function(_0x967710){_0x134987(null,_0x967710?_0x293711[_0xcb66('0x1d')](_0x967710[_0xcb66('0x1e')]):![]);})['catch'](function(_0x2152dc){_0x134987(_0x2152dc);});};AGIVertices['prototype']['getMailAccount']=function(_0x58cd2b,_0x31a10a){this['rpc'][_0xcb66('0x1f')](_0x58cd2b)[_0xcb66('0x15')](function(_0x1b8a79){_0x31a10a(null,_0x1b8a79?_0x1b8a79:![]);})['catch'](function(_0x123787){_0x31a10a(_0x123787);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x20')]=function(_0x311ede,_0xa411e3,_0x375636){this[_0xcb66('0xf')][_0xcb66('0x20')](_0x311ede,_0xa411e3)[_0xcb66('0x15')](function(){_0x375636(null);})[_0xcb66('0x13')](function(_0x521350){_0x375636(_0x521350);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x21')]=function(_0xeba0d1,_0x5f6d80){this[_0xcb66('0xe')][_0xcb66('0x22')](_0xeba0d1)[_0xcb66('0x15')](function(_0x5a343f){if(_0x5a343f){if(_0x5a343f[_0xcb66('0x23')]){_0x5f6d80(null,[_0x5a343f[_0xcb66('0x24')]]);}else{_0x5f6d80(null,_[_0xcb66('0x25')](_0x5a343f[_0xcb66('0x26')],'interval'));}}else{_0x5f6d80(null,![]);}})[_0xcb66('0x13')](function(_0x17a21a){_0x5f6d80(_0x17a21a);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1d')]=function(_0x17152e){return util[_0xcb66('0x27')](_0xcb66('0x28'),FILES_PATH,_0x17152e);};AGIVertices[_0xcb66('0x10')][_0xcb66('0x29')]=function(_0x299156,_0x3dc592,_0x17b087){odbc['open'](_0x299156,function(_0x4d9b76){if(_0x4d9b76){logger['error'](_0xcb66('0x2a'),_0x4d9b76);_0x17b087(_0x4d9b76);}else{logger[_0xcb66('0x2b')](_0xcb66('0x2c'));odbc[_0xcb66('0x2d')](_0x3dc592,function(_0x1a2686,_0x2d8a5e){if(_0x1a2686){logger['info'](_0xcb66('0x2e'),_0x3dc592);_0x17b087(_0x1a2686);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x3dc592);odbc['close'](function(_0x411105){if(_0x411105){logger[_0xcb66('0x2f')](_0xcb66('0x30'),_0x411105);}_0x17b087(null,_0x2d8a5e);});}});}});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x31')]=function(_0x3e71a7,_0x3422b6){this[_0xcb66('0xe')][_0xcb66('0x32')](_0x3e71a7)['then'](function(_0xe45331){_0x3422b6(null,_0xe45331?_0xe45331:![]);})[_0xcb66('0x13')](function(_0x4df1b8){_0x3422b6(_0x4df1b8);});};AGIVertices['prototype'][_0xcb66('0x33')]=function(_0x1f1712,_0x4a5934){this['rpc'][_0xcb66('0x33')](_0x1f1712)['then'](function(_0x4d2049){_0x4a5934(null,_0x4d2049);})[_0xcb66('0x13')](function(_0x192bb){_0x4a5934(_0x192bb);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x34')]=function(_0x99229,_0x235862,_0x3323ee){this[_0xcb66('0xe')][_0xcb66('0x34')]({'uniqueid':this['channel']['uniqueid'],'node':_0x99229['label'],'application':_0x99229[_0xcb66('0x35')],'data':_0x235862||null,'project_name':this['channel'][_0xcb66('0x36')],'callerid':this['channel'][_0xcb66('0x37')]})[_0xcb66('0x15')](function(_0x3c3b62){if(_0x3323ee){_0x3323ee(null,_0x3c3b62);}})[_0xcb66('0x13')](function(_0x3115e2){if(_0x3323ee){_0x3323ee(_0x3115e2);}});};AGIVertices[_0xcb66('0x10')]['createSquareRecording']=function(_0x51848c,_0x437490,_0x99d85b,_0x165397){this[_0xcb66('0xe')][_0xcb66('0x38')]({'uniqueid':this[_0xcb66('0xd')][_0xcb66('0x39')],'callerid':this[_0xcb66('0xd')][_0xcb66('0x37')],'calleridname':this['channel'][_0xcb66('0x3a')],'context':this[_0xcb66('0xd')][_0xcb66('0x3b')],'extension':this[_0xcb66('0xd')]['extension'],'priority':this[_0xcb66('0xd')][_0xcb66('0x3c')],'accountcode':this[_0xcb66('0xd')]['accountcode'],'dnid':this[_0xcb66('0xd')][_0xcb66('0x3d')],'projectName':this[_0xcb66('0xd')][_0xcb66('0x36')],'saveName':_0x437490,'filename':_0x51848c['file']||_0x437490,'savePath':_0x99d85b})[_0xcb66('0x15')](function(_0xb0854f){_0x165397(null,_0xb0854f);})[_0xcb66('0x13')](function(_0x4b1d46){_0x165397(_0x4b1d46);});};AGIVertices['prototype'][_0xcb66('0x3e')]=function(_0x5defd3,_0x37262a,_0x55c6e4,_0x184653,_0x416448){this[_0xcb66('0xe')]['createSquareMessage']({'uniqueid':this[_0xcb66('0xd')]['uniqueid'],'body':_0x5defd3,'direction':_0x37262a,'providerName':_0x55c6e4,'providerResponse':_0x184653})[_0xcb66('0x15')](function(_0xe1b64d){if(_0x416448){_0x416448(null,_0xe1b64d);}})[_0xcb66('0x13')](function(_0x1f6d4d){if(_0x416448){_0x416448(_0x1f6d4d);}});};AGIVertices[_0xcb66('0x10')]['createCmContact']=function(_0x9017f4,_0x5b04ad){this[_0xcb66('0xe')][_0xcb66('0x3f')]({'firstName':_[_0xcb66('0x40')](_0x9017f4['name'])||_['isNil'](_0x9017f4['name'])?_0xcb66('0x41')+Math[_0xcb66('0x42')]():_0x9017f4[_0xcb66('0x12')],'lastName':_[_0xcb66('0x40')](_0x9017f4[_0xcb66('0x43')])||_[_0xcb66('0x44')](_0x9017f4[_0xcb66('0x43')])?null:_0x9017f4[_0xcb66('0x43')],'phone':_0x9017f4[_0xcb66('0x45')],'ListId':_0x9017f4[_0xcb66('0x46')],'scheduledat':_0x9017f4['scheduledAt'],'callbackUniqueid':this[_0xcb66('0xd')][_0xcb66('0x39')],'tags':_0xcb66('0x47'),'description':_0xcb66('0x48')+_0x9017f4['scheduledAt']['toString'](),'priority':_0x9017f4[_0xcb66('0x49')]})[_0xcb66('0x15')](function(_0x726d0f){_0x5b04ad(null,_0x726d0f);})[_0xcb66('0x13')](function(_0xff3820){_0x5b04ad(_0xff3820);});};AGIVertices[_0xcb66('0x10')]['getPause']=function(_0x3888ce,_0xf69f45){this[_0xcb66('0xe')][_0xcb66('0x4a')](_0x3888ce)['then'](function(_0x454493){_0xf69f45(null,_0x454493?_0x454493['name']:![]);})[_0xcb66('0x13')](function(_0x4b2110){_0xf69f45(_0x4b2110);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x4b')]=function(_0x146a06,_0x5cab77,_0x54e6c2){var _0x696bc1={'role':_0xcb66('0x4c')};_0x696bc1[_0x146a06]=this['channel']['callerid'];this[_0xcb66('0xe')]['agentPause'](_0x696bc1,_0x5cab77,this[_0xcb66('0xd')]['uniqueid'])[_0xcb66('0x15')](function(_0x26c39e){_0x54e6c2(null,_[_0xcb66('0x44')](_0x26c39e)?![]:!![]);})['catch'](function(_0x11c279){logger[_0xcb66('0x2f')](_0x11c279);_0x54e6c2(null,![]);});};AGIVertices['prototype'][_0xcb66('0x4d')]=function(_0x27e83c,_0x417c7e){var _0x1fd270={'role':_0xcb66('0x4c')};_0x1fd270[_0x27e83c]=this[_0xcb66('0xd')]['callerid'];this[_0xcb66('0xe')][_0xcb66('0x4d')](_0x1fd270)[_0xcb66('0x15')](function(_0x22438d){_0x417c7e(null,_[_0xcb66('0x44')](_0x22438d)?![]:!![]);})[_0xcb66('0x13')](function(_0x8913b0){logger[_0xcb66('0x2f')](_0x8913b0);_0x417c7e(null,![]);});};AGIVertices[_0xcb66('0x10')]['agentLogout']=function(_0x2cba8,_0x253ca3){var _0x25e648={'role':_0xcb66('0x4c')};_0x25e648[_0x2cba8]=this[_0xcb66('0xd')][_0xcb66('0x37')];this['rpc'][_0xcb66('0x4e')](_0x25e648)[_0xcb66('0x15')](function(_0x5c59e6){_0x253ca3(null,_[_0xcb66('0x44')](_0x5c59e6)?![]:!![]);})[_0xcb66('0x13')](function(_0x3a232f){logger[_0xcb66('0x2f')](_0x3a232f);_0x253ca3(null,![]);});};AGIVertices['prototype'][_0xcb66('0x4f')]=function(_0x33b739,_0x412eaa){var _0x5926ae={'role':_0xcb66('0x4c')};_0x5926ae[_0x33b739]=this[_0xcb66('0xd')][_0xcb66('0x37')];var _0x1462af=_0x33b739!=_0xcb66('0x50')?util[_0xcb66('0x27')]('%s/%s@from-sip/n',_0xcb66('0x51'),this[_0xcb66('0xd')][_0xcb66('0x37')]):undefined;this[_0xcb66('0xe')]['agentLogin'](_0x5926ae,_0x1462af)[_0xcb66('0x15')](function(_0x26c43c){_0x412eaa(null,_[_0xcb66('0x44')](_0x26c43c)?![]:!![]);})[_0xcb66('0x13')](function(_0x183381){logger[_0xcb66('0x2f')](_0x183381);_0x412eaa(null,![]);});};AGIVertices[_0xcb66('0x10')]['shellCommand']=function(_0x5b8f76,_0x1b7f2b){sh[_0xcb66('0x52')](_[_0xcb66('0x53')](_0x5b8f76),function(_0x43fb09,_0xaef77){var _0x11072c=_0xaef77['replace'](/(\r\n|\n|\r)/gm,'');_0x1b7f2b(null,_0x11072c);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x54')]=function(_0x19da1c,_0x534cf4){scripts[_0xcb66('0x54')](_0x19da1c[_0xcb66('0x55')],_0x19da1c['google_cloud_tts_text_type']||_0xcb66('0x56'),_0x19da1c[_0xcb66('0x56')],_0x19da1c[_0xcb66('0x57')]||_0xcb66('0x58'),_0x19da1c[_0xcb66('0x59')]||_0xcb66('0x5a'),_0x19da1c[_0xcb66('0x5b')]||_0xcb66('0x5c'))[_0xcb66('0x15')](function(_0x4277e1){_0x534cf4(null,_0x4277e1);})[_0xcb66('0x13')](function(_0x30faa6){_0x534cf4(_0x30faa6);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x5d')]=function(_0x4332f4,_0x39e86a){scripts[_0xcb66('0x5d')](_0x4332f4[_0xcb66('0x56')],_0x4332f4[_0xcb66('0x5e')]||'en',0x1)['then'](function(_0x1eebc5){_0x39e86a(null,_0x1eebc5);})['catch'](function(_0x14eada){_0x39e86a(_0x14eada);});};AGIVertices['prototype'][_0xcb66('0x5f')]=function(_0x2912c9,_0x42a71a){var _0x1a4cdb={'uri':_0x2912c9[_0xcb66('0x60')],'method':_0x2912c9[_0xcb66('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2912c9[_0xcb66('0x62')])===_0xcb66('0x63')&&parseInt(_0x2912c9[_0xcb66('0x62')])>=0x1?parseInt(_0x2912c9[_0xcb66('0x62')])*0x3e8:0x5*0x3e8};if(_[_0xcb66('0x64')]([_0xcb66('0x65'),_0xcb66('0x66')],_0x1a4cdb['method'][_0xcb66('0x67')]())){try{_0x1a4cdb[_0xcb66('0x68')]=_0x2912c9[_0xcb66('0x9')]?JSON['parse'](_0x2912c9[_0xcb66('0x9')]):{};}catch(_0x416e29){logger[_0xcb66('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x416e29);}}try{_0x1a4cdb[_0xcb66('0x69')]=_0x2912c9[_0xcb66('0x6a')]?JSON[_0xcb66('0x6b')](_0x2912c9[_0xcb66('0x6a')]):{};}catch(_0x38a3c0){logger[_0xcb66('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x38a3c0);}if(_0x2912c9[_0xcb66('0x6c')]){try{var _0x536ecf=require(_0x2912c9[_0xcb66('0x6c')])['sync'](this,_0x1a4cdb);_0x1a4cdb[_0xcb66('0x6d')]=Mustache['render'](_0x2912c9[_0xcb66('0x60')],_0x536ecf,{},['$$','$$']);if(_0x1a4cdb[_0xcb66('0x69')]){_0x1a4cdb[_0xcb66('0x69')]=JSON['parse'](Mustache[_0xcb66('0x6e')](JSON['stringify'](_0x1a4cdb[_0xcb66('0x69')]),_0x536ecf,{},['$$','$$']));}if(_0x1a4cdb[_0xcb66('0x68')]){_0x1a4cdb[_0xcb66('0x68')]=JSON[_0xcb66('0x6b')](Mustache[_0xcb66('0x6e')](JSON['stringify'](_0x1a4cdb[_0xcb66('0x68')]),_0x536ecf,{},['$$','$$']));}}catch(_0xfa72ee){logger[_0xcb66('0x2f')](_0xcb66('0x6f'),_0xfa72ee);}}rp(_0x1a4cdb)['then'](function(_0x19ac18){var _0x469b1f={'statusCode':_0x19ac18['statusCode']||0xc8,'statusMessage':_0x19ac18[_0xcb66('0x70')]||'OK','headers':_0x19ac18[_0xcb66('0x69')]||{},'body':_0x19ac18[_0xcb66('0x68')]||{}};_0x42a71a(null,_0x469b1f);})[_0xcb66('0x13')](function(_0x4be3e7){var _0x197eb8={'statusCode':_0x4be3e7[_0xcb66('0x71')]||0x1f4,'statusMessage':_0x4be3e7[_0xcb66('0x72')]||_0xcb66('0x73'),'headers':_0x4be3e7[_0xcb66('0x74')]['headers']||{},'body':_0x4be3e7[_0xcb66('0x74')][_0xcb66('0x68')]||{}};_0x42a71a(null,_0x197eb8);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x75')]=function(_0xb3a1e,_0xf7b62b){scripts[_0xcb66('0x75')](this['channel']['uniqueid'],_0xb3a1e['key'],_0xb3a1e[_0xcb66('0x56')],_0xb3a1e[_0xcb66('0x76')]||'en')['then'](function(_0x1722c6){_0xf7b62b(null,_0x1722c6);})['catch'](function(_0x3f3b1a){_0xf7b62b(_0x3f3b1a);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x77')]=function(_0x28987a,_0x4d45b2){scripts[_0xcb66('0x77')](this[_0xcb66('0xd')][_0xcb66('0x39')],_0x28987a[_0xcb66('0x78')],_0x28987a[_0xcb66('0x79')],_0x28987a['private_key'],_0x28987a['text'],_0x28987a[_0xcb66('0x7a')]||'en')['then'](function(_0x2b6166){_0x4d45b2(null,_0x2b6166);})[_0xcb66('0x13')](function(_0x3c36d2){_0x4d45b2(_0x3c36d2);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x7b')]=function(_0x2a478c,_0x5f0b8d){scripts[_0xcb66('0x7b')](this['channel'],_0x2a478c)[_0xcb66('0x15')](function(_0x3c3ec3){_0x5f0b8d(null,_0x3c3ec3);})[_0xcb66('0x13')](function(_0x23b942){_0x5f0b8d(_0x23b942);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x7c')]=function(_0x5763c7,_0x137a66){scripts[_0xcb66('0x7c')](_0x5763c7[_0xcb66('0x7d')],_0x5763c7[_0xcb66('0x56')],_0x5763c7[_0xcb66('0x7e')]||_0xcb66('0x58'),_0x5763c7[_0xcb66('0x7f')])[_0xcb66('0x15')](function(_0x56e3ef){_0x137a66(null,_0x56e3ef);})['catch'](function(_0x25c9da){_0x137a66(_0x25c9da);});};AGIVertices[_0xcb66('0x10')]['ispeechASR']=function(_0xa876b8,_0x33490d,_0x5e6799){scripts[_0xcb66('0x80')](_0x33490d,_0xa876b8['key'],_0xa876b8[_0xcb66('0x81')]||_0xcb66('0x58'),this[_0xcb66('0x82')](_0xa876b8[_0xcb66('0x83')])?_0xa876b8[_0xcb66('0x83')]:undefined)['then'](function(_0x5d512f){_0x5e6799(null,_0x5d512f);})[_0xcb66('0x13')](function(_0x3c0cb6){_0x5e6799(_0x3c0cb6);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x84')]=function(_0x3731c5,_0x4d50b1){scripts[_0xcb66('0x84')](_0x3731c5['aws_access_key_id'],_0x3731c5['aws_secret_access_key'],_0x3731c5[_0xcb66('0x85')],_0x3731c5['aws_polly_voice']||'Amy',_0x3731c5[_0xcb66('0x56')],_0x3731c5[_0xcb66('0x86')]||'text')[_0xcb66('0x15')](function(_0x134589){_0x4d50b1(null,_0x134589);})[_0xcb66('0x13')](function(_0x3acdeb){_0x4d50b1(_0x3acdeb);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x87')]=function(_0x1e21db,_0x3cb320){scripts[_0xcb66('0x87')](this[_0xcb66('0xd')][_0xcb66('0x39')],_0x1e21db['aws_access_key_id'],_0x1e21db['aws_secret_access_key'],_0x1e21db[_0xcb66('0x88')],_0x1e21db[_0xcb66('0x56')],_0x1e21db[_0xcb66('0x89')])[_0xcb66('0x15')](function(_0x16f499){_0x3cb320(null,_0x16f499);})[_0xcb66('0x13')](function(_0x16b420){_0x3cb320(_0x16b420);});};AGIVertices['prototype'][_0xcb66('0x8a')]=function(_0x49a473,_0x4f30c2,_0x590640){scripts[_0xcb66('0x8a')](_0x4f30c2,_0x49a473[_0xcb66('0x7d')],_0x49a473[_0xcb66('0x8b')]||'en-US')[_0xcb66('0x15')](function(_0x50a683){_0x590640(null,_0x50a683);})['catch'](function(_0x2c83df){_0x590640(_0x2c83df);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x8c')]=function(_0x395294,_0x2668f2,_0x5a10f9){scripts[_0xcb66('0x8c')](_0x2668f2,_0x395294[_0xcb66('0x8d')],_0x395294[_0xcb66('0x8e')],_0x395294[_0xcb66('0x6d')])[_0xcb66('0x15')](function(_0x113a9e){_0x5a10f9(null,_0x113a9e);})[_0xcb66('0x13')](function(_0x5d3772){_0x5a10f9(_0x5d3772);});};AGIVertices[_0xcb66('0x10')][_0xcb66('0x8f')]=function(_0x2f7a2a){var _0x56b9e7=_[_0xcb66('0x64')](verticesWithRetry,_0x2f7a2a[_0xcb66('0x35')])?_0x2f7a2a:_['clone'](_0x2f7a2a);for(var _0x7736a2 in _0x56b9e7){if(_0x56b9e7[_0xcb66('0x90')](_0x7736a2)){if(_0x56b9e7[_0x7736a2]&&_[_0xcb66('0x91')](_0x56b9e7[_0x7736a2])){if(_['includes'](recursiveMapAttributes,_0x7736a2)){_0x56b9e7[_0x7736a2]=this[_0xcb66('0x92')](_0x56b9e7[_0x7736a2]);}else{_0x56b9e7[_0x7736a2]=this[_0xcb66('0x93')](_0x56b9e7[_0x7736a2]);}}}}return _0x56b9e7;};AGIVertices[_0xcb66('0x10')][_0xcb66('0x94')]=function(_0x25f06c){for(var _0x5b2e1d in _0x25f06c){if(_0x25f06c[_0xcb66('0x90')](_0x5b2e1d)){if(_[_0xcb66('0x95')](_0x25f06c[_0x5b2e1d])){this[_0xcb66('0x94')](_0x25f06c[_0x5b2e1d]);}else if(_[_0xcb66('0x96')](_0x25f06c[_0x5b2e1d])){for(var _0x276be1=0x0;_0x276be1<_0x25f06c[_0x5b2e1d][_0xcb66('0x97')];_0x276be1++){this['recursiveNodeIndex'](_0x25f06c[_0x5b2e1d][_0x276be1]);}}else if(_['isString'](_0x25f06c[_0x5b2e1d])){_0x25f06c[_0x5b2e1d]=this[_0xcb66('0x93')](_0x25f06c[_0x5b2e1d]);}}}};AGIVertices[_0xcb66('0x10')][_0xcb66('0x98')]=function(_0x38b12c,_0x3bd0d7){for(var _0x42f38b in _0x38b12c){if(_0x38b12c['hasOwnProperty'](_0x42f38b)){if(_[_0xcb66('0x95')](_0x38b12c[_0x42f38b])){if(!_[_0xcb66('0x40')](_0x38b12c[_0x42f38b])){this[_0xcb66('0x98')](_0x38b12c[_0x42f38b],util[_0xcb66('0x27')](_0xcb66('0x99'),_0x3bd0d7,_0x42f38b));}}else if(_[_0xcb66('0x96')](_0x38b12c[_0x42f38b])){for(var _0x3135e7=0x0;_0x3135e7<_0x38b12c[_0x42f38b]['length'];_0x3135e7++){this[_0xcb66('0x98')](_0x38b12c[_0x42f38b][_0x3135e7],util[_0xcb66('0x27')](_0xcb66('0x99'),_0x3bd0d7,_0x42f38b+'['+_0x3135e7+']'));}}else{if(!_['isNil'](_0x38b12c[_0x42f38b])){this[_0xcb66('0xd')][_0xcb66('0x9a')](util['format']('%s.%s',_0x3bd0d7,_0x42f38b),_0x38b12c[_0x42f38b]);}}}}};AGIVertices[_0xcb66('0x10')][_0xcb66('0x92')]=function(_0x285b9c){try{var _0x51247a=JSON['parse'](_0x285b9c);this[_0xcb66('0x94')](_0x51247a);return JSON['stringify'](_0x51247a);}catch(_0x5d701a){return this[_0xcb66('0x93')](_0x285b9c);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x2b6ed1){var _0x1dbf42=_0x2b6ed1[_0xcb66('0x9b')]('{');for(var _0xf66e40=0x1;_0xf66e40<_0x1dbf42[_0xcb66('0x97')];_0xf66e40+=0x1){var _0x405765=_0x1dbf42[_0xf66e40][_0xcb66('0x9b')]('}');if(_0x405765[_0xcb66('0x97')]>0x1){_0x2b6ed1=_0x2b6ed1['replaceAll']('{'+_0x405765[0x0]+'}',this[_0xcb66('0xd')][_0xcb66('0x9c')](_0x405765[0x0])[_0xcb66('0x9d')]||_0x405765[0x0]);}}if(_0x1dbf42[_0xcb66('0x97')]===0x1){return _0x2b6ed1[_0xcb66('0x9e')]();}return this[_0xcb66('0x93')](_0x2b6ed1);};AGIVertices[_0xcb66('0x10')][_0xcb66('0x9f')]=function(_0x1a3ba8,_0x39fc6b){var _0x3e0c2c=this[_0xcb66('0xd')]['getVariable'](_0x1a3ba8);if(_0x3e0c2c[_0xcb66('0xa0')]===-0x1){return _0x3e0c2c;}logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xa1'),_0x39fc6b,_0x3e0c2c[_0xcb66('0x9d')]));return this[_0xcb66('0xd')]['setVariable'](_0x39fc6b,_0x3e0c2c['extra']);};AGIVertices['prototype'][_0xcb66('0x82')]=function(_0x5ab121){return _0x5ab121&&_0x5ab121!=='0'&&_0x5ab121!=='-1'&&_0x5ab121!=='';};AGIVertices['prototype'][_0xcb66('0xa2')]=function(_0x135046){this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x135046,'-');_0x135046[_0xcb66('0xa4')]=_0x135046[_0xcb66('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xcb66('0x10')][_0xcb66('0xa5')]=function(_0x56135d){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xa6'),_0x56135d[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x56135d[_0xcb66('0x56')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20text\x20configured');}var _0x42e664='\x22'+_0x56135d[_0xcb66('0x56')]+'\x22';if(this[_0xcb66('0x82')](_0x56135d[_0xcb66('0x74')])){_0x42e664+=','+_0x56135d[_0xcb66('0x74')];}var _0x62477d=this[_0xcb66('0xd')][_0xcb66('0x52')](_0xcb66('0xa9'),_0x42e664);if(_0x62477d['result']===-0x1){return _0x62477d;}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0xaa'),_0x42e664));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xab')]=function(_0x40ab09){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xac'),_0x40ab09['label']));if(!this[_0xcb66('0x82')](_0x40ab09['grammar'])){return this['channel']['noop'](_0xcb66('0xad'));}var _0x3cd531=_0x40ab09[_0xcb66('0xae')];if(this[_0xcb66('0x82')](_0x40ab09[_0xcb66('0x74')])){_0x3cd531+=','+_0x40ab09[_0xcb66('0x74')];}var _0x1664bc=this['channel'][_0xcb66('0x52')](_0xcb66('0xaf'),_0x3cd531);if(_0x1664bc[_0xcb66('0xa0')]===-0x1){return _0x1664bc;}var _0x1cb179=this['getAndSetVariable'](_0xcb66('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x1cb179['result']===-0x1){return _0x1cb179;}var _0x3dbff2=this[_0xcb66('0x9f')]('RECOG_INPUT()',_0xcb66('0xb1'));if(_0x3dbff2[_0xcb66('0xa0')]===-0x1){return _0x3dbff2;}var _0xf4a5bf=this[_0xcb66('0x9f')]('RECOG_INSTANCE()',_0xcb66('0xb2'));if(_0xf4a5bf[_0xcb66('0xa0')]===-0x1){return _0xf4a5bf;}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0xb3'),_0x3cd531));};AGIVertices['prototype'][_0xcb66('0x6')]=function(_0x311e56){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x311e56[_0xcb66('0xa7')]));return this[_0xcb66('0xd')]['agi']([_0x311e56[_0xcb66('0xb4')],_0x311e56[_0xcb66('0xb5')]]);};AGIVertices['prototype'][_0xcb66('0xb6')]=function(_0x2b1f71){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xb7'),_0x2b1f71[_0xcb66('0xa7')]));if(this[_0xcb66('0x82')](_0x2b1f71[_0xcb66('0x62')])){logger['info'](util[_0xcb66('0x27')](_0xcb66('0xb8'),_0x2b1f71[_0xcb66('0x62')]));var _0x22ed1d=this[_0xcb66('0xd')][_0xcb66('0xb9')](_0x2b1f71[_0xcb66('0x62')]);if(_0x22ed1d['result']===-0x1){return _0x22ed1d;}}return this[_0xcb66('0xd')][_0xcb66('0xb6')]();};AGIVertices[_0xcb66('0x10')][_0xcb66('0x47')]=function(_0x5e7a5a){logger['info'](util[_0xcb66('0x27')](_0xcb66('0xba'),_0x5e7a5a[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x5e7a5a[_0xcb66('0x46')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5e7a5a,_0xcb66('0xbb'));}_0x5e7a5a[_0xcb66('0xbc')]=moment();if(this[_0xcb66('0x82')](_0x5e7a5a[_0xcb66('0xbd')])){_0x5e7a5a[_0xcb66('0xbc')]=moment()['add'](_0x5e7a5a['delay'],'minutes');}if(!this[_0xcb66('0x82')](_0x5e7a5a[_0xcb66('0x49')])){_0x5e7a5a[_0xcb66('0x49')]=0x2;}this['createCmContact'][_0xcb66('0xa3')](this,_0x5e7a5a);return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5e7a5a['phone'],_0x5e7a5a[_0xcb66('0x46')],_0x5e7a5a['scheduledAt']));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xbe')]=function(_0x36f067){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xbf'),_0x36f067[_0xcb66('0xa7')]));var _0x4b03cc=this[_0xcb66('0xd')][_0xcb66('0x52')](_0x36f067[_0xcb66('0xc0')],_0x36f067[_0xcb66('0x74')]);if(_0x4b03cc['result']===-0x1){return _0x4b03cc;}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xc1'),_0x36f067[_0xcb66('0xc0')],_0x36f067[_0xcb66('0x74')]));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xc2')]=function(_0x166f62){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x166f62[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x166f62[_0xcb66('0x56')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xc3'));}var _0x58b6db='\x22'+_0x166f62[_0xcb66('0x56')]+'\x22';if(this[_0xcb66('0x82')](_0x166f62['options'])){_0x58b6db+=','+_0x166f62[_0xcb66('0x74')];}var _0x2869c9=this[_0xcb66('0xd')]['exec']('MRCPSynth',_0x58b6db);if(_0x2869c9[_0xcb66('0xa0')]===-0x1){return _0x2869c9;}return this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0xaa'),_0x58b6db));};AGIVertices['prototype'][_0xcb66('0xc4')]=function(_0x90c525){logger['info'](util[_0xcb66('0x27')](_0xcb66('0xc5'),_0x90c525['label']));if(!this[_0xcb66('0x82')](_0x90c525['text'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xc3'));}var _0x46eb02='\x22'+_0x90c525['text']+'\x22';if(this[_0xcb66('0x82')](_0x90c525['options'])){_0x46eb02+=','+_0x90c525[_0xcb66('0x74')];}var _0x31772e=this['channel'][_0xcb66('0x52')](_0xcb66('0xa9'),_0x46eb02);if(_0x31772e[_0xcb66('0xa0')]===-0x1){return _0x31772e;}return this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x46eb02));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xc6')]=function(_0x26359b){logger['info'](util[_0xcb66('0x27')](_0xcb66('0xc7'),_0x26359b['label']));if(!this[_0xcb66('0x82')](_0x26359b[_0xcb66('0xae')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xad'));}var _0x422855=_0x26359b[_0xcb66('0xae')];if(this[_0xcb66('0x82')](_0x26359b[_0xcb66('0x74')])){_0x422855+=','+_0x26359b[_0xcb66('0x74')];}var _0x45797c=this[_0xcb66('0xd')][_0xcb66('0x52')]('MRCPRecog',_0x422855);if(_0x45797c[_0xcb66('0xa0')]===-0x1){return _0x45797c;}var _0x2c1c5e=this[_0xcb66('0x9f')]('RECOG_CONFIDENCE()',_0xcb66('0xc8'));if(_0x2c1c5e['result']===-0x1){return _0x2c1c5e;}var _0x3a67eb=this[_0xcb66('0x9f')](_0xcb66('0xc9'),_0xcb66('0xca'));if(_0x3a67eb[_0xcb66('0xa0')]===-0x1){return _0x3a67eb;}var _0xc0a30e=this[_0xcb66('0x9f')](_0xcb66('0xcb'),_0xcb66('0xcc'));if(_0xc0a30e[_0xcb66('0xa0')]===-0x1){return _0xc0a30e;}return this['channel'][_0xcb66('0xa8')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x422855));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xcd')]=function(_0x8d83eb){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xce'),_0x8d83eb[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x8d83eb[_0xcb66('0xae')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xad'));}var _0x3752fe=_0x8d83eb[_0xcb66('0xae')];if(this[_0xcb66('0x82')](_0x8d83eb[_0xcb66('0x74')])){_0x3752fe+=','+_0x8d83eb['options'];}var _0x2245ef=this[_0xcb66('0xd')][_0xcb66('0x52')](_0xcb66('0xaf'),_0x3752fe);if(_0x2245ef['result']===-0x1){return _0x2245ef;}var _0xe4a247=this['getAndSetVariable'](_0xcb66('0xb0'),_0xcb66('0xcf'));if(_0xe4a247['result']===-0x1){return _0xe4a247;}var _0x38de32=this[_0xcb66('0x9f')](_0xcb66('0xc9'),_0xcb66('0xd0'));if(_0x38de32[_0xcb66('0xa0')]===-0x1){return _0x38de32;}var _0x743338=this[_0xcb66('0x9f')](_0xcb66('0xcb'),_0xcb66('0xd1'));if(_0x743338[_0xcb66('0xa0')]===-0x1){return _0x743338;}return this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0xb3'),_0x3752fe));};AGIVertices['prototype'][_0xcb66('0xd2')]=function(_0x203bcf){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xd3'),_0x203bcf[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x203bcf['odbc_id'])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x203bcf,_0xcb66('0xd4'));}var _0x46ae54=this[_0xcb66('0xd5')][_0xcb66('0xa3')](this,_0x203bcf[_0xcb66('0xd6')]);if(!_0x46ae54){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x203bcf,_0xcb66('0xd7'));}if(!this[_0xcb66('0x82')](_0x203bcf[_0xcb66('0x2d')])){return this[_0xcb66('0xd')]['error'](_0x203bcf,_0xcb66('0xd8'));}var _0x1ee052=_0x203bcf[_0xcb66('0x2d')][_0xcb66('0xd9')](/(\r\n|\n|\r)/gm,'\x20');this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xda'),_0x1ee052));var _0x37addb=this['getQueryOdbc'][_0xcb66('0xa3')](this,_0x46ae54,_0x1ee052);this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x203bcf,_0x1ee052);if(!this[_0xcb66('0x82')](_0x203bcf[_0xcb66('0xdb')])){return this['channel'][_0xcb66('0xa8')](_0xcb66('0xdc'));}var _0x3b8d55=this['getVariable'][_0xcb66('0xa3')](this,_0x203bcf[_0xcb66('0xdb')]);if(!_0x3b8d55){return this['channel'][_0xcb66('0x2f')](_0x203bcf,'no\x20variable\x20found');}var _0x2f55e6=this;_0x37addb[_0xcb66('0xdd')](function(_0x5d4f3c,_0x1c8e78){Object['keys'](_0x5d4f3c)[_0xcb66('0xdd')](function(_0x2de3fa){_0x2f55e6[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0xde'),_0x3b8d55,_0x1c8e78,_0x2de3fa),_0x5d4f3c[_0x2de3fa]);});});this[_0xcb66('0xd')]['setVariable'](util['format'](_0xcb66('0xdf'),_0x3b8d55),_0x37addb['length']);return this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xe0'),_0x3b8d55));};AGIVertices[_0xcb66('0x10')]['dial']=function(_0x209219){logger[_0xcb66('0xe1')](util[_0xcb66('0x27')](_0xcb66('0xe2'),_0x209219['label']));if(!this[_0xcb66('0x82')](_0x209219[_0xcb66('0xe3')])){return this[_0xcb66('0xd')]['error'](_0x209219,_0xcb66('0xe4'));}var _0x25d937=this[_0xcb66('0x18')][_0xcb66('0xa3')](this,_0x209219[_0xcb66('0xe3')]);if(!_0x25d937){return this[_0xcb66('0xd')]['error'](_0x209219,_0xcb66('0xe5'));}var _0x1895f2=this[_0xcb66('0xd')][_0xcb66('0x52')](_0xcb66('0xe6'),[util[_0xcb66('0x27')](_0xcb66('0xe7'),_0x25d937),_0x209219[_0xcb66('0x62')],_0x209219['opts'],_0x209219['url']]);if(_0x1895f2[_0xcb66('0xa0')]===-0x1){return _0x1895f2;}return this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0xe8'),_0xcb66('0xe6')));};AGIVertices['prototype']['dialogflow']=function(_0x452dfa){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xe9'),_0x452dfa['label']));if(!this['isConfigured'](_0x452dfa['key'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xea'));}if(!this[_0xcb66('0x82')](_0x452dfa[_0xcb66('0x56')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xc3'));}this['channel'][_0xcb66('0xeb')]=!![];this[_0xcb66('0x34')](_0x452dfa);this['createSquareMessage'](_0x452dfa[_0xcb66('0x56')],'in','','');this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xec'),_0x452dfa[_0xcb66('0x56')]));var _0x2b951b=this['googleDialogflow'][_0xcb66('0xa3')](this,_0x452dfa);if(_0x2b951b){for(var _0x3ec59e in _0x2b951b){if(_0x2b951b[_0xcb66('0x90')](_0x3ec59e)){this[_0xcb66('0xd')]['setVariable'](util[_0xcb66('0x27')](_0xcb66('0xed'),_0x3ec59e[_0xcb66('0x67')]()),_0x2b951b[_0x3ec59e]);}}this[_0xcb66('0x3e')](_0x2b951b['speech'],_0xcb66('0xee'),_0xcb66('0xef'),'');return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xf0'),_0x2b951b['speech']));}return this[_0xcb66('0xd')]['error'](_0x452dfa,_0xcb66('0xf1'));};AGIVertices[_0xcb66('0x10')][_0xcb66('0xf2')]=function(_0x3ddf49){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xf3'),_0x3ddf49[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x3ddf49[_0xcb66('0x78')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xf4'));}if(!this[_0xcb66('0x82')](_0x3ddf49[_0xcb66('0x79')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0xcb66('0x82')](_0x3ddf49['private_key'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xf5'));}if(!this[_0xcb66('0x82')](_0x3ddf49[_0xcb66('0x7a')])){return this[_0xcb66('0xd')]['noop'](_0xcb66('0xf6'));}if(!this[_0xcb66('0x82')](_0x3ddf49['text'])){return this[_0xcb66('0xd')]['noop']('no\x20text\x20configured');}this['channel'][_0xcb66('0xeb')]=!![];this[_0xcb66('0x34')](_0x3ddf49);this[_0xcb66('0x3e')](_0x3ddf49[_0xcb66('0x56')],'in','','');this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0xf7'),_0x3ddf49[_0xcb66('0x56')]));var _0x5a54bd=this[_0xcb66('0x77')][_0xcb66('0xa3')](this,_0x3ddf49);if(_0x5a54bd){for(var _0x272e99 in _0x5a54bd){if(_0x5a54bd['hasOwnProperty'](_0x272e99)){if(_0x272e99!==_0xcb66('0xf8')){this[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0xed'),_0x272e99[_0xcb66('0x67')]()),_0x5a54bd[_0x272e99]);}}}this[_0xcb66('0x3e')](_0x5a54bd[_0xcb66('0xf9')],'out',_0xcb66('0xf2'),_0x5a54bd[_0xcb66('0xf8')]);return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xfa'),_0x5a54bd['speech']));}return this[_0xcb66('0xd')]['error'](_0x3ddf49,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xcb66('0x10')][_0xcb66('0xfb')]=function(_0x205dc5){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0xfc'),_0x205dc5[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x205dc5['ndauth_url'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xfd'));}if(!this[_0xcb66('0x82')](_0x205dc5[_0xcb66('0xfe')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20username\x20configured');}if(!this[_0xcb66('0x82')](_0x205dc5[_0xcb66('0xff')])){return this['channel'][_0xcb66('0xa8')](_0xcb66('0x100'));}if(!this[_0xcb66('0x82')](_0x205dc5[_0xcb66('0x101')])){return this['channel'][_0xcb66('0xa8')]('no\x20text\x20configured');}this[_0xcb66('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x205dc5);this[_0xcb66('0x3e')](_0x205dc5[_0xcb66('0x56')],'in','','');this['channel'][_0xcb66('0xa8')](util['format'](_0xcb66('0x102'),_0x205dc5[_0xcb66('0x56')]));var _0x5c5b35=this[_0xcb66('0x7b')][_0xcb66('0xa3')](this,_0x205dc5);if(_0x5c5b35){for(var _0x5b1110 in _0x5c5b35){if(_0x5c5b35[_0xcb66('0x90')](_0x5b1110)){this[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')]('SESTEK_NDA_%s',_0x5b1110[_0xcb66('0x67')]()),_0x5c5b35[_0x5b1110]);}}this['createSquareMessage'](_0x5c5b35[_0xcb66('0xf9')],_0xcb66('0xee'),'sesteknda','');if(_0x5c5b35[_0xcb66('0x103')]){this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5c5b35['audiofile']));var _0x271776=this[_0xcb66('0xd')][_0xcb66('0x104')](_0x5c5b35[_0xcb66('0x103')]);try{fs[_0xcb66('0x105')](_0x5c5b35[_0xcb66('0x103')]+_0xcb66('0x106'));}catch(_0xe7310f){logger[_0xcb66('0x2f')](_0xe7310f);}return _0x271776;}else{return this['channel']['noop'](util[_0xcb66('0x27')]('SestekNDA\x20Result\x20%s',_0x5c5b35[_0xcb66('0xf9')]));}}return this[_0xcb66('0xd')]['error'](_0x205dc5,_0xcb66('0x107'));};AGIVertices[_0xcb66('0x10')]['end']=function(_0x28fdb5){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x108'),_0x28fdb5[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0xa8')]('end');};AGIVertices[_0xcb66('0x10')][_0xcb66('0x109')]=function(_0x413772){logger['info'](util['format'](_0xcb66('0x10a'),_0x413772['label']));var _0x2aab13='';if(_0x413772[_0xcb66('0x10b')]){if(!this[_0xcb66('0x82')](_0x413772['trunk_id'])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x413772,'no\x20trunk\x20selected');}else{var _0x388047=parseInt(_0x413772[_0xcb66('0x10b')],0xa);if(isNaN(_0x388047)){_0x2aab13=_0x413772['trunk_id'];}else{_0x2aab13=this[_0xcb66('0x10c')][_0xcb66('0xa3')](this,_0x413772[_0xcb66('0x10b')]);if(!_0x2aab13){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x413772,_0xcb66('0x10d'));}}}}else if(_0x413772[_0xcb66('0x10e')]){_0x2aab13=_0x413772[_0xcb66('0x10e')];}else{return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x413772,'no\x20trunk\x20selected');}var _0x4266f5=this[_0xcb66('0xd')][_0xcb66('0x52')]('DIAL',[util[_0xcb66('0x27')](_0xcb66('0x10f'),_0x2aab13,_0x413772[_0xcb66('0x45')]),_0x413772['timeout'],_0x413772[_0xcb66('0x110')],_0x413772[_0xcb66('0x60')]]);if(_0x4266f5[_0xcb66('0xa0')]===-0x1){return _0x4266f5;}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Executed\x20command\x20%s',_0xcb66('0xe6')));};AGIVertices[_0xcb66('0x10')]['finally']=function(_0x49ccd2){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x111'),_0x49ccd2[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0xa8')]('finally');};AGIVertices[_0xcb66('0x10')][_0xcb66('0xb')]=function(_0x5b66c4){logger[_0xcb66('0x2b')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5b66c4[_0xcb66('0xa7')]));if(_0x5b66c4[_0xcb66('0xa4')]===0x0){return this[_0xcb66('0xa2')](_0x5b66c4);}_0x5b66c4[_0xcb66('0xa4')]-=0x1;if(!this[_0xcb66('0x82')](_0x5b66c4[_0xcb66('0x112')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5b66c4,_0xcb66('0x113'));}var _0x308447=this[_0xcb66('0x1b')]['sync'](this,_0x5b66c4[_0xcb66('0x112')]);if(!_0x308447){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5b66c4,_0xcb66('0x114'));}if(!this[_0xcb66('0x82')](_0x5b66c4[_0xcb66('0xdb')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2f7a36=this[_0xcb66('0xd')][_0xcb66('0x115')](_0x308447,_0x5b66c4[_0xcb66('0x116')],_0x5b66c4['maxdigit']);var _0x1b800e=_0x2f7a36[_0xcb66('0xa0')]?_0x2f7a36[_0xcb66('0xa0')][_0xcb66('0x9e')]():'';logger[_0xcb66('0x2b')]('test',JSON['stringify'](_0x2f7a36));if(_0x2f7a36['result']===-0x1){this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x5b66c4,_0x1b800e);return _0x2f7a36;}else if(_0x2f7a36[_0xcb66('0x9d')]===_0xcb66('0x62')){_0x2f7a36[_0xcb66('0xa0')]=_0x1b800e[_0xcb66('0x97')]>=parseInt(_0x5b66c4[_0xcb66('0x117')])?'x':'i';}else{_0x2f7a36[_0xcb66('0xa0')]=_0x1b800e['length']>=parseInt(_0x5b66c4['mindigit'])&&_0x1b800e[_0xcb66('0x97')]<=parseInt(_0x5b66c4[_0xcb66('0x118')])?'x':'i';}var _0x223781=this[_0xcb66('0x9c')][_0xcb66('0xa3')](this,_0x5b66c4[_0xcb66('0xdb')]);if(!_0x223781){return this[_0xcb66('0xd')]['error'](_0x5b66c4,'no\x20variable\x20found');}this[_0xcb66('0xd')][_0xcb66('0x9a')](_0x223781,_0x1b800e);if(this[_0xcb66('0x82')](_0x5b66c4[_0xcb66('0x119')])){var _0x6fdb45=parseInt(_0x5b66c4[_0xcb66('0x119')],0xa);var _0x23e190=rs['generate']({'charset':'*','length':_0x6fdb45});var _0x499e54=_0x1b800e[_0xcb66('0x97')];if(_0x499e54>0x0){if(_0x499e54>_0x6fdb45){this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x5b66c4,_0x5b66c4[_0xcb66('0x11a')]==='first'?_0x23e190+_0x1b800e[_0xcb66('0x11b')](_0x6fdb45):_0x1b800e['substr'](0x0,_0x499e54-_0x6fdb45)+_0x23e190);}else{this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x5b66c4,rs[_0xcb66('0x11c')]({'charset':'*','length':_0x499e54}));}}else{this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x5b66c4,'');}}else{this[_0xcb66('0x34')]['sync'](this,_0x5b66c4,_0x1b800e);}return _0x2f7a36;};AGIVertices[_0xcb66('0x10')][_0xcb66('0xc')]=function(_0x103f37){logger[_0xcb66('0x2b')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x103f37[_0xcb66('0xa7')]));return this[_0xcb66('0xb')](_0x103f37);};AGIVertices['prototype'][_0xcb66('0x11d')]=function(_0x6f8055){logger['info'](util['format'](_0xcb66('0x11e'),_0x6f8055[_0xcb66('0xa7')]));this['createSquareDetailsReport'][_0xcb66('0xa3')](this,_0x6f8055,_0x6f8055[_0xcb66('0x11f')]);return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x120'),_0x6f8055[_0xcb66('0x11f')]));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x121')]=function(_0xad3910){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x122'),_0xad3910[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0xad3910[_0xcb66('0x123')])||!this['isConfigured'](_0xad3910['aws_secret_access_key'])){return this['channel']['noop'](_0xcb66('0x124'));}if(!this[_0xcb66('0x82')](_0xad3910[_0xcb66('0x56')])){return this['channel'][_0xcb66('0xa8')](_0xcb66('0xc3'));}this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x125'),_0xad3910[_0xcb66('0x56')]));var _0x45eae5=this[_0xcb66('0x84')]['sync'](this,_0xad3910);if(_0x45eae5){this['channel'][_0xcb66('0xa8')](util['format'](_0xcb66('0x126'),_0x45eae5));var _0x454967=this[_0xcb66('0xd')]['streamFile'](_0x45eae5);try{fs[_0xcb66('0x105')](_0x45eae5+'.wav');}catch(_0x24832c){logger[_0xcb66('0x2f')](_0x24832c);}return _0x454967;}return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0xad3910,_0xcb66('0x127'));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x128')]=function(_0x55e321){logger['info'](util[_0xcb66('0x27')](_0xcb66('0x129'),_0x55e321[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x55e321[_0xcb66('0x123')])||!this[_0xcb66('0x82')](_0x55e321[_0xcb66('0x12a')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x55e321['aws_bot_name'])){return this[_0xcb66('0xd')]['noop'](_0xcb66('0x12b'));}if(!this[_0xcb66('0x82')](_0x55e321[_0xcb66('0x56')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xc3'));}this[_0xcb66('0xd')][_0xcb66('0xeb')]=!![];this[_0xcb66('0x34')](_0x55e321);this[_0xcb66('0x3e')](_0x55e321[_0xcb66('0x56')],'in','','');this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x12c'),_0x55e321[_0xcb66('0x56')]));var _0x3a84b0=this[_0xcb66('0x87')][_0xcb66('0xa3')](this,_0x55e321);if(_0x3a84b0){for(var _0x30c2b9 in _0x3a84b0){if(_0x3a84b0[_0xcb66('0x90')](_0x30c2b9)&&_['isString'](_0x3a84b0[_0x30c2b9])){this['channel'][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x12d'),_0x30c2b9[_0xcb66('0x67')]()),_0x3a84b0[_0x30c2b9]);}}if(_[_0xcb66('0x44')](_0x3a84b0['message'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xcb66('0x3e')](_0x3a84b0[_0xcb66('0x72')],_0xcb66('0xee'),_0xcb66('0x12e'),'');return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x12f'),_0x3a84b0[_0xcb66('0x72')]));}}return this['channel']['error'](_0x55e321,_0xcb66('0x130'));};AGIVertices['prototype'][_0xcb66('0x131')]=function(_0x234bf5){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x132'),_0x234bf5[_0xcb66('0xa7')],_0x234bf5[_0xcb66('0x62')]));if(!this[_0xcb66('0x82')](_0x234bf5[_0xcb66('0x7d')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20key\x20configured');}var _0x187f4f=_0xcb66('0x133');var _0x466e59=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xcb66('0x11c')](0x4));var _0x3b0713=util[_0xcb66('0x27')](_0xcb66('0x99'),_0x466e59,_0x187f4f);var _0x4237ba=!![];if(_0x234bf5[_0xcb66('0x134')]==='NOBEEP'){_0x4237ba=![];}var _0x11b5f2=this['channel']['recordFile'](_0x466e59,_0x187f4f,_0x234bf5[_0xcb66('0x135')],_0x234bf5[_0xcb66('0x62')],undefined,_0x4237ba);if(_0x11b5f2[_0xcb66('0xa0')]!==-0x1){this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x136'),_0x3b0713));var _0x30e5fb=this[_0xcb66('0x8a')][_0xcb66('0xa3')](this,_0x234bf5,_0x3b0713);if(_0x30e5fb){for(var _0x585aba in _0x30e5fb){if(_0x30e5fb[_0xcb66('0x90')](_0x585aba)){this[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x137'),_0x585aba[_0xcb66('0x67')]()),_0x30e5fb[_0x585aba]);}}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x138'),JSON[_0xcb66('0x139')](_0x30e5fb)));}}return _0x11b5f2;};AGIVertices[_0xcb66('0x10')]['tildeasr']=function(_0x1cece0){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1cece0['label']));if(!this['isConfigured'](_0x1cece0[_0xcb66('0x8d')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0x13a'));}if(!this['isConfigured'](_0x1cece0[_0xcb66('0x8e')])){return this[_0xcb66('0xd')]['noop'](_0xcb66('0x13b'));}var _0x412515=_0xcb66('0x133');var _0x5e0001=util[_0xcb66('0x27')](_0xcb66('0x13c'),FILES_PATH,rs[_0xcb66('0x11c')](0x4));var _0x174aa6=util['format']('%s.%s',_0x5e0001,_0x412515);var _0x389aa3=!![];if(_0x1cece0[_0xcb66('0x134')]===_0xcb66('0x13d')){_0x389aa3=![];}var _0xcf8863=this[_0xcb66('0xd')][_0xcb66('0x13e')](_0x5e0001,_0x412515,_0x1cece0['intKey'],_0x1cece0[_0xcb66('0x62')],undefined,_0x389aa3);if(_0xcf8863[_0xcb66('0xa0')]!==-0x1){this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x13f'),_0x174aa6));var _0x17d2f2=this[_0xcb66('0x8c')][_0xcb66('0xa3')](this,_0x1cece0,_0x174aa6);if(_0x17d2f2){for(var _0x1aad4a in _0x17d2f2){if(_0x17d2f2[_0xcb66('0x90')](_0x1aad4a)){this[_0xcb66('0xd')]['setVariable'](util[_0xcb66('0x27')](_0xcb66('0x140'),_0x1aad4a['toUpperCase']()),_0x17d2f2[_0x1aad4a]);}}return this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')]('TildeASR\x20Result\x20%s',JSON[_0xcb66('0x139')](_0x17d2f2)));}}return _0xcf8863;};AGIVertices[_0xcb66('0x10')][_0xcb66('0x141')]=function(_0x2d6b00){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x142'),_0x2d6b00[_0xcb66('0xa7')]));return this['channel'][_0xcb66('0x143')](_0x2d6b00[_0xcb66('0x3b')],_0x2d6b00['extension'],_0x2d6b00[_0xcb66('0x3c')]);};AGIVertices[_0xcb66('0x10')][_0xcb66('0x144')]=function(_0x2337c7){logger['info'](util[_0xcb66('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2337c7['label']));if(!this[_0xcb66('0x82')](_0x2337c7[_0xcb66('0x145')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x2337c7,_0xcb66('0x146'));}try{var _0x23b351=eval(_0x2337c7[_0xcb66('0x145')])?_0xcb66('0x147'):_0xcb66('0x148');this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x149'),_0x2337c7[_0xcb66('0x145')],_0x23b351));return{'code':0xc8,'result':_0x23b351};}catch(_0x1b193d){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xcb66('0x10')]['gotoiftime']=function(_0x157291){logger[_0xcb66('0x2b')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x157291[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x157291['interval_id'])){return this['channel'][_0xcb66('0x2f')](_0x157291,_0xcb66('0x14a'));}var _0x47a606=this[_0xcb66('0x21')][_0xcb66('0xa3')](this,_0x157291[_0xcb66('0x14b')]);if(!_0x47a606){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x157291,_0xcb66('0x14c'));}for(var _0x5d63e7=0x0;_0x5d63e7<_0x47a606[_0xcb66('0x97')];_0x5d63e7+=0x1){var _0x10d862=this['channel'][_0xcb66('0x9c')](util['format'](_0xcb66('0x14d'),_0x47a606[_0x5d63e7]));if(_0x10d862[_0xcb66('0xa0')]===-0x1){return _0x10d862;}logger[_0xcb66('0x2b')](util['format'](_0xcb66('0x14e'),_0x47a606[_0x5d63e7],_0x10d862[_0xcb66('0x9d')]));if(_0x10d862['extra']===_0xcb66('0x147')){logger[_0xcb66('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0x47a606[_0x5d63e7],_0xcb66('0x147')));this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('IFTIME\x20%s\x20%s',_0x47a606[_0x5d63e7],_0xcb66('0x147')));return{'code':0xc8,'result':_0xcb66('0x147')};}else{logger['info'](util[_0xcb66('0x27')](_0xcb66('0x14e'),_0x47a606[_0x5d63e7],'false'));this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x14e'),_0x47a606[_0x5d63e7],_0xcb66('0x148')));}}return{'code':0xc8,'result':_0xcb66('0x148')};};AGIVertices[_0xcb66('0x10')]['hangup']=function(_0x105003){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x14f'),_0x105003['label']));return this[_0xcb66('0xd')]['hangup']();};AGIVertices[_0xcb66('0x10')]['ispeechasr']=function(_0xca430e){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x150'),_0xca430e[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0xca430e[_0xcb66('0x7d')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xea'));}var _0x18700b=_0xcb66('0x133');var _0x1ced4f=util['format'](_0xcb66('0x13c'),FILES_PATH,rs[_0xcb66('0x11c')](0x4));var _0xee9a3e=util[_0xcb66('0x27')]('%s.%s',_0x1ced4f,_0x18700b);var _0x268f8f=!![];if(_0xca430e['beep']===_0xcb66('0x13d')){_0x268f8f=![];}var _0x57b01c=this['channel'][_0xcb66('0x13e')](_0x1ced4f,_0x18700b,_0xca430e['intKey'],_0xca430e['timeout'],undefined,_0x268f8f);if(_0x57b01c['result']!==-0x1){this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('ispeech\x20%s\x20file\x20created',_0xee9a3e));var _0x1c410b=this[_0xcb66('0x80')]['sync'](this,_0xca430e,_0xee9a3e);if(_0x1c410b){for(var _0x7a9324 in _0x1c410b){if(_0x1c410b['hasOwnProperty'](_0x7a9324)){this[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x151'),_0x7a9324['toUpperCase']()),_0x1c410b[_0x7a9324]);}}return this['channel']['noop'](util[_0xcb66('0x27')](_0xcb66('0x152'),JSON[_0xcb66('0x139')](_0x1c410b)));}}return _0x57b01c;};AGIVertices[_0xcb66('0x10')][_0xcb66('0x153')]=function(_0x5ec6d1){logger['info'](util[_0xcb66('0x27')](_0xcb66('0x154'),_0x5ec6d1[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x5ec6d1[_0xcb66('0x7d')])){return this[_0xcb66('0xd')]['noop'](_0xcb66('0xea'));}if(!this[_0xcb66('0x82')](_0x5ec6d1['text'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xcb66('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x5ec6d1['text']));var _0x564444=this[_0xcb66('0x7c')][_0xcb66('0xa3')](this,_0x5ec6d1);if(_0x564444){this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x155'),_0x564444));var _0x385416=this[_0xcb66('0xd')][_0xcb66('0x104')](_0x564444,_0x5ec6d1['intKey']);try{fs[_0xcb66('0x105')](_0x564444+'.wav');}catch(_0x5787b4){logger[_0xcb66('0x2f')](_0x5787b4);}return _0x385416;}return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5ec6d1,_0xcb66('0x156'));};AGIVertices[_0xcb66('0x10')]['login']=function(_0x1795ad){logger[_0xcb66('0x2b')](util['format'](_0xcb66('0x157'),_0x1795ad[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x1795ad[_0xcb66('0x158')])){return this['channel'][_0xcb66('0x2f')](_0x1795ad,_0xcb66('0x159'));}logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x15a'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x1795ad[_0xcb66('0x158')]));var _0x567f05=this['agentLogin']['sync'](this,_0x1795ad['findBy']);if(_0x567f05){logger[_0xcb66('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xcb66('0xd')][_0xcb66('0x37')],_0x1795ad[_0xcb66('0x158')]));this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xcb66('0x37')],_0x1795ad[_0xcb66('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xcb66('0xd')][_0xcb66('0x37')],_0x1795ad[_0xcb66('0x158')]));this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0x15b'),this['channel']['callerid'],_0x1795ad['findBy']));return{'code':0xc8,'result':_0xcb66('0x15c')};}};AGIVertices[_0xcb66('0x10')]['logout']=function(_0x3a953f){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3a953f[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x3a953f[_0xcb66('0x158')])){return this[_0xcb66('0xd')]['error'](_0x3a953f,_0xcb66('0x159'));}logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x15a'),this[_0xcb66('0xd')]['callerid'],_0x3a953f[_0xcb66('0x158')]));var _0x59b15f=this[_0xcb66('0x4e')]['sync'](this,_0x3a953f[_0xcb66('0x158')]);if(_0x59b15f){logger['info'](util[_0xcb66('0x27')](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x3a953f[_0xcb66('0x158')]));this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x15d'),this['channel'][_0xcb66('0x37')],_0x3a953f[_0xcb66('0x158')]));return{'code':0xc8,'result':_0xcb66('0x15e')};}else{logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xcb66('0xd')][_0xcb66('0x37')],_0x3a953f[_0xcb66('0x158')]));this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0x15b'),this[_0xcb66('0xd')]['callerid'],_0x3a953f[_0xcb66('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xcb66('0x10')][_0xcb66('0x15f')]=function(_0x5e6914){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x160'),_0x5e6914['label']));if(!this[_0xcb66('0x82')](_0x5e6914[_0xcb66('0x161')])){return this[_0xcb66('0xd')]['error'](_0x5e6914,_0xcb66('0x162'));}this['channel'][_0xcb66('0xa8')](util['format'](_0xcb66('0x163'),_0x5e6914[_0xcb66('0x161')]));var _0x217ddf=eval(_0x5e6914[_0xcb66('0x161')]);if(!this['isConfigured'](_0x5e6914[_0xcb66('0xdb')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2176f7=this['getVariable'][_0xcb66('0xa3')](this,_0x5e6914[_0xcb66('0xdb')]);if(!_0x2176f7){return this['channel'][_0xcb66('0x2f')](_0x5e6914,'no\x20variable\x20found');}if(_[_0xcb66('0x96')](_0x217ddf)){var _0x20cad2=this;_0x217ddf['forEach'](function(_0x1f316a,_0x3e29c5){_0x20cad2['channel'][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x164'),_0x2176f7,_0x3e29c5),_0x1f316a);});return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('variable\x20%s[key]\x20set',_0x2176f7));}else{return this['channel']['setVariable'](_0x2176f7,_0x217ddf);}};AGIVertices[_0xcb66('0x10')][_0xcb66('0xa')]=function(_0x458b45){logger[_0xcb66('0x2b')](util['format'](_0xcb66('0x165'),_0x458b45[_0xcb66('0xa7')]));if(_0x458b45[_0xcb66('0xa4')]===0x0){return this[_0xcb66('0xa2')](_0x458b45);}_0x458b45[_0xcb66('0xa4')]-=0x1;if(!this[_0xcb66('0x82')](_0x458b45['file_id'])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x458b45,_0xcb66('0x113'));}var _0x41c507=this[_0xcb66('0x1b')][_0xcb66('0xa3')](this,_0x458b45[_0xcb66('0x112')]);if(!_0x41c507){return this['channel']['error'](_0x458b45,_0xcb66('0x114'));}var _0x16448e=this[_0xcb66('0xd')]['getData'](_0x41c507,_0x458b45['response'],_0x458b45[_0xcb66('0x166')]);var _0x1c712d=_0x16448e['result'];if(_0x16448e[_0xcb66('0xa0')]===-0x1){this[_0xcb66('0x34')]['sync'](this,_0x458b45,'-1');return _0x16448e;}else if(_0x16448e[_0xcb66('0x9d')]===_0xcb66('0x62')){_0x16448e[_0xcb66('0xa0')]=_0x16448e['result'][_0xcb66('0x97')]>0x0?_0x16448e['result']:'t';}else if(_[_0xcb66('0x40')](_0x16448e[_0xcb66('0xa0')])){_0x16448e[_0xcb66('0xa0')]='#';_0x1c712d='#';}if(!this['isConfigured'](_0x458b45[_0xcb66('0xdb')])){this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x7443df=this[_0xcb66('0x9c')]['sync'](this,_0x458b45[_0xcb66('0xdb')]);if(!_0x7443df){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x458b45,_0xcb66('0x167'));}this['channel']['setVariable'](_0x7443df,_0x1c712d);}this[_0xcb66('0x34')]['sync'](this,_0x458b45,_0x1c712d);return _0x16448e;};AGIVertices[_0xcb66('0x10')]['noop']=function(_0x52ad64){logger['info'](util['format'](_0xcb66('0x168'),_0x52ad64[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0x52ad64['output']||_0x52ad64[_0xcb66('0xa7')]);};AGIVertices[_0xcb66('0x10')]['pause']=function(_0x45a22d){logger['info'](util[_0xcb66('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x45a22d[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x45a22d[_0xcb66('0x158')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x45a22d,_0xcb66('0x159'));}logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x15a'),this[_0xcb66('0xd')]['callerid'],_0x45a22d[_0xcb66('0x158')]));var _0x13d034=this[_0xcb66('0x169')][_0xcb66('0xa3')](this,_0x45a22d['pause_id']);var _0x13bfcd=this['agentPause'][_0xcb66('0xa3')](this,_0x45a22d[_0xcb66('0x158')],_0x13d034);if(_0x13bfcd){logger['info'](util[_0xcb66('0x27')](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x45a22d['findBy']));this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x45a22d[_0xcb66('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xcb66('0x2b')](util['format'](_0xcb66('0x15b'),this['channel'][_0xcb66('0x37')],_0x45a22d['findBy']));this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x45a22d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xcb66('0x16a')]=function(_0x3bd915){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x16b'),_0x3bd915[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x3bd915[_0xcb66('0x112')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x3bd915,'no\x20file\x20audio\x20selected');}var _0x1f8b45=this[_0xcb66('0x1b')][_0xcb66('0xa3')](this,_0x3bd915[_0xcb66('0x112')]);if(!_0x1f8b45){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x3bd915,'no\x20file\x20audio\x20found');}var _0x38c268=this['channel']['exec'](_0xcb66('0x16c'),[_0x1f8b45,_0x3bd915[_0xcb66('0x110')]]);if(_0x38c268[_0xcb66('0xa0')]===-0x1){return _0x38c268;}return this['channel'][_0xcb66('0xa8')](util['format']('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x1f8b45));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x16d')]=function(_0x5b9252){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x16e'),_0x5b9252['label']));if(!this[_0xcb66('0x82')](_0x5b9252[_0xcb66('0x16f')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5b9252,_0xcb66('0x170'));}var _0x2cd34b='';var _0x500d77=parseInt(_0x5b9252['queue_id'],0xa);if(isNaN(_0x500d77)){_0x2cd34b=_0x5b9252['queue_id'];}else{_0x2cd34b=this[_0xcb66('0x14')][_0xcb66('0xa3')](this,_0x5b9252['queue_id']);if(!_0x2cd34b){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x5b9252,_0xcb66('0x171'));}}var _0xe9da2='';if(this['isConfigured'](_0x5b9252['file_id'])){var _0x2d908e=this['getSound'][_0xcb66('0xa3')](this,_0x5b9252[_0xcb66('0x112')]);if(_0x2d908e){_0xe9da2=_0x2d908e;}}this['createSquareDetailsReport'][_0xcb66('0xa3')](this,_0x5b9252,_0x2cd34b);if(_0x5b9252[_0xcb66('0x110')][_0xcb66('0x172')]('x')<0x0){_0x5b9252[_0xcb66('0x110')]+='x';}if(_0x5b9252[_0xcb66('0x110')]['indexOf']('X')<0x0){_0x5b9252[_0xcb66('0x110')]+='X';}this[_0xcb66('0xd')][_0xcb66('0x9a')](_0xcb66('0x173'),_0x2cd34b?_0x2cd34b['toLowerCase']():'');var _0x519c78=this[_0xcb66('0xd')][_0xcb66('0x52')](_0xcb66('0x174'),[_0x2cd34b,_0x5b9252['opts'],_0x5b9252[_0xcb66('0x60')],_0xe9da2,_0x5b9252['timeout'],_0x5b9252[_0xcb66('0x6')],_0x5b9252['macro'],_0x5b9252['gosub'],'',_0x5b9252[_0xcb66('0x175')]]);if(_0x519c78['result']===-0x1){return _0x519c78;}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Executed\x20command\x20%s\x20%s',_0xcb66('0x174'),_0x2cd34b));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x176')]=function(_0x292033){logger[_0xcb66('0x2b')](util['format'](_0xcb66('0x177'),_0x292033[_0xcb66('0xa7')]));var _0x19bfeb=_0x292033['recordingFormat']||'wav';var _0x29d222=util[_0xcb66('0x27')](_0xcb66('0x178'),this[_0xcb66('0xd')][_0xcb66('0x39')],rs[_0xcb66('0x11c')](0x5));var _0x373155=util['format'](_0xcb66('0x179'),FILES_PATH,_0x29d222,_0x19bfeb);var _0x2921de=util[_0xcb66('0x27')](_0xcb66('0x13c'),FILES_PATH,_0x29d222);this[_0xcb66('0x38')][_0xcb66('0xa3')](this,_0x292033,_0x29d222,_0x373155);this[_0xcb66('0xd')][_0xcb66('0x9a')](_0xcb66('0x17a'),_0x29d222);logger[_0xcb66('0x2b')](_0xcb66('0x17b'),_0x2921de,_0x19bfeb,_0x292033[_0xcb66('0x17c')],_0x292033['timeout']);return this[_0xcb66('0xd')][_0xcb66('0x13e')](_0x2921de,_0x19bfeb,_0x292033[_0xcb66('0x17c')],_0x292033[_0xcb66('0x62')],undefined,!![]);};AGIVertices['prototype'][_0xcb66('0x17d')]=function(_0x2fd975){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x17e'),_0x2fd975[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x2fd975[_0xcb66('0x60')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0x17f'));}var _0x2dd920=this[_0xcb66('0x5f')][_0xcb66('0xa3')](this,_0x2fd975);logger[_0xcb66('0x2b')](util['format']('Response:',util[_0xcb66('0x180')](_0x2dd920,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2fd975['variable_id'])){return this['channel'][_0xcb66('0xa8')](_0xcb66('0x181'));}var _0x4508d1=this[_0xcb66('0x9c')][_0xcb66('0xa3')](this,_0x2fd975['variable_id']);if(!_0x4508d1){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x2fd975,_0xcb66('0x167'));}this[_0xcb66('0xd')][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x182'),_0x4508d1),_0x2dd920['statusCode']?_0x2dd920[_0xcb66('0x71')]:_0xcb66('0x183'));this['channel'][_0xcb66('0x9a')](util[_0xcb66('0x27')](_0xcb66('0x184'),_0x4508d1),_0x2dd920[_0xcb66('0x70')]?_0x2dd920[_0xcb66('0x70')]:'OK');if(_0x2dd920[_0xcb66('0x68')]){try{this['saveRestApiResult'](_0x2dd920[_0xcb66('0x68')],_0x4508d1);}catch(_0x1381d8){logger[_0xcb66('0x2f')](util[_0xcb66('0x27')](_0xcb66('0x185'),_0x4508d1));}}return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0xe0'),_0x4508d1));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x186')]=function(_0x1f7253){logger['info'](util[_0xcb66('0x27')](_0xcb66('0x187'),_0x1f7253[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0x188')](_0x1f7253[_0xcb66('0x189')][_0xcb66('0xd9')](/\s+/g,''),_0x1f7253[_0xcb66('0x17c')]);};AGIVertices[_0xcb66('0x10')]['saynumber']=function(_0x440587){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x18a'),_0x440587[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0x18b')](_0x440587[_0xcb66('0x63')]['replace'](/\s+/g,''),_0x440587['escape_digits']);};AGIVertices[_0xcb66('0x10')][_0xcb66('0x18c')]=function(_0x4cac68){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x18d'),_0x4cac68[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0x18e')](_0x4cac68[_0xcb66('0x56')],_0x4cac68[_0xcb66('0x17c')]);};AGIVertices[_0xcb66('0x10')]['sendMail']=function(_0x837cae){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x18f'),_0x837cae[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x837cae[_0xcb66('0x190')])){return this[_0xcb66('0xd')]['noop']('no\x20mail\x20account\x20configured');}var _0x3bae4b=this[_0xcb66('0x191')][_0xcb66('0xa3')](this,_0x837cae[_0xcb66('0x190')]);if(!_0x3bae4b||!_0x3bae4b['Smtp']){return this['channel']['error'](_0x837cae,_0xcb66('0x192'));}var _0x1b1e9e={'from':util[_0xcb66('0x27')]('\x22%s\x22\x20<%s>',_0x3bae4b[_0xcb66('0x12')],_0x3bae4b['email']||_0x3bae4b[_0xcb66('0x193')]['user']),'to':_0x837cae['to']||'','cc':_0x837cae['cc']||'','bcc':_0x837cae[_0xcb66('0x194')]||'','subject':_0x837cae[_0xcb66('0x195')],'html':_0x837cae[_0xcb66('0x56')],'text':_0x837cae['text']};if(this['isConfigured'](_0x837cae[_0xcb66('0x196')])){}logger[_0xcb66('0xe1')]('sendMail\x20message',JSON[_0xcb66('0x139')](_0x1b1e9e));this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x837cae,_0x837cae[_0xcb66('0x190')]);this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3bae4b[_0xcb66('0x12')]));this[_0xcb66('0x20')][_0xcb66('0xa3')](this,_0x3bae4b[_0xcb66('0x197')],_0x1b1e9e);return this['channel'][_0xcb66('0xa8')](_0xcb66('0x198'));};AGIVertices['prototype']['sendFax']=function(_0x54242d){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x54242d[_0xcb66('0xa7')]));return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0x199'));};AGIVertices[_0xcb66('0x10')]['sendSMS']=function(_0x33c25d){logger['info'](util['format'](_0xcb66('0x19a'),_0x33c25d['label']));if(!this[_0xcb66('0x82')](_0x33c25d['sms_account_id'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')]('no\x20sms\x20account\x20configured');}var _0x471701=this[_0xcb66('0x31')][_0xcb66('0xa3')](this,_0x33c25d['sms_account_id']);if(!_0x471701){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x33c25d,_0xcb66('0x19b'));}var _0x5c13db={'body':_0x33c25d[_0xcb66('0x19c')],'phone':_0x33c25d['to']||'','SmsAccountId':_0x471701['id']};logger['debug'](_0xcb66('0x19d'),JSON['stringify'](_0x5c13db));this[_0xcb66('0x34')]['sync'](this,_0x33c25d,_0x33c25d[_0xcb66('0x19e')]);this['channel']['noop'](util[_0xcb66('0x27')](_0xcb66('0x19f'),_0x471701[_0xcb66('0x12')]));this[_0xcb66('0x33')][_0xcb66('0xa3')](this,_0x5c13db);return this[_0xcb66('0xd')]['noop'](_0xcb66('0x1a0'));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1a1')]=function(_0x107f0e){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x1a2'),_0x107f0e[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x107f0e[_0xcb66('0xdb')])){return this[_0xcb66('0xd')]['error'](_0x107f0e,_0xcb66('0x1a3'));}var _0x42f949=this['getVariable']['sync'](this,_0x107f0e[_0xcb66('0xdb')]);if(!_0x42f949){return this['channel'][_0xcb66('0x2f')](_0x107f0e,_0xcb66('0x167'));}return this['channel'][_0xcb66('0x9a')](_0x42f949,_0x107f0e[_0xcb66('0x1a4')]);};AGIVertices['prototype'][_0xcb66('0x1a5')]=function(_0xbb8975){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x1a6'),_0xbb8975[_0xcb66('0xa7')]));this[_0xcb66('0xd')]['noop']('START\x20CALLY\x20SQUARE');var _0x215f2f=this[_0xcb66('0xd')][_0xcb66('0x9c')](_0xcb66('0x1a7'));if(!_['isEmpty'](_0x215f2f[_0xcb66('0x9d')])){this[_0xcb66('0xd')][_0xcb66('0x39')]=_0x215f2f['extra'];}if(_0xbb8975[_0xcb66('0xb6')]===_0xcb66('0x1a8')){this[_0xcb66('0xd')]['noop']('Answer');return this[_0xcb66('0xd')]['answer']();}return this['channel']['noop'](_0xcb66('0x1a9'));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1aa')]=function(_0x57a726){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x57a726[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x57a726['project_id'])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x57a726,_0xcb66('0x1ab'));}var _0x470652=this[_0xcb66('0x1ac')]['sync'](this,_0x57a726['project_id']);if(!this[_0xcb66('0x82')](_0x470652)){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x57a726,util[_0xcb66('0x27')](_0xcb66('0x1ad'),_0x57a726[_0xcb66('0x1ae')]));}if(_0x470652===this[_0xcb66('0xd')]['arg_1']){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x57a726,_0xcb66('0x1af'));}this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x57a726,_0x470652);var _0x68d3b9=this[_0xcb66('0xd')][_0xcb66('0x52')](_0xcb66('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xcb66('0x6')][_0xcb66('0x1b1')]||'127.0.0.1',_0x470652,this['channel'][_0xcb66('0x36')]));if(_0x68d3b9[_0xcb66('0xa0')]===-0x1){return _0x68d3b9;}return this[_0xcb66('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xcb66('0x1b0'),_0x470652));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1b2')]=function(_0x518845){logger['info'](util[_0xcb66('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x518845[_0xcb66('0xa7')]));var _0x1a3145=this[_0xcb66('0x1b3')][_0xcb66('0xa3')](this,_0x518845[_0xcb66('0xb4')]);this[_0xcb66('0x34')][_0xcb66('0xa3')](this,_0x518845,_0x518845['command']);if(this['isConfigured'](_0x518845[_0xcb66('0xdb')])){var _0x580ab3=this[_0xcb66('0x9c')][_0xcb66('0xa3')](this,_0x518845[_0xcb66('0xdb')]);if(_0x580ab3){this[_0xcb66('0xd')]['setVariable'](_0x580ab3,_0x1a3145);return this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x1b4'),_0x518845[_0xcb66('0xb4')],_0x580ab3));}}return this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x1b5'),_0x518845['command']));};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1b6')]=function(_0x1365fb){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x1b7'),_0x1365fb['label']));_0x1365fb[_0xcb66('0x56')]=_0x1365fb[_0xcb66('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcb66('0x82')](_0x1365fb[_0xcb66('0x55')])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0x1b8'));}if(!this['isConfigured'](_0x1365fb['text'])){return this[_0xcb66('0xd')][_0xcb66('0xa8')](_0xcb66('0xc3'));}this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x1b9'),_0x1365fb['text']));var _0x1a418a=this[_0xcb66('0x54')][_0xcb66('0xa3')](this,_0x1365fb);if(_0x1a418a){this[_0xcb66('0xd')][_0xcb66('0xa8')](util['format'](_0xcb66('0x1ba'),_0x1a418a));var _0x3a7c30=this['channel']['streamFile'](_0x1a418a);try{fs[_0xcb66('0x105')](_0x1a418a+_0xcb66('0x106'));}catch(_0x280225){logger['error'](_0x280225);}return _0x3a7c30;}return this[_0xcb66('0xd')]['error'](_0x1365fb,_0xcb66('0x1bb'));};AGIVertices[_0xcb66('0x10')]['tts']=function(_0x509679){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x509679['label']));_0x509679[_0xcb66('0x56')]=_0x509679[_0xcb66('0x56')][_0xcb66('0xd9')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcb66('0x82')](_0x509679[_0xcb66('0x56')])){return this[_0xcb66('0xd')]['noop'](_0xcb66('0xc3'));}this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0x1bc'),_0x509679[_0xcb66('0x56')]));var _0x8568c6=this['googleTTS'][_0xcb66('0xa3')](this,_0x509679);if(_0x8568c6){this['channel'][_0xcb66('0xa8')](util[_0xcb66('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x8568c6));var _0x2f0935=this['channel'][_0xcb66('0x104')](_0x8568c6);try{fs[_0xcb66('0x105')](_0x8568c6+_0xcb66('0x106'));}catch(_0x357702){logger[_0xcb66('0x2f')](_0x357702);}return _0x2f0935;}return this[_0xcb66('0xd')]['error'](_0x509679,_0xcb66('0x1bd'));};AGIVertices['prototype'][_0xcb66('0x1be')]=function(_0x42ef7f){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x1bf'),_0x42ef7f[_0xcb66('0xa7')]));if(!this['isConfigured'](_0x42ef7f['findBy'])){return this['channel']['error'](_0x42ef7f,_0xcb66('0x159'));}logger['info'](util['format'](_0xcb66('0x15a'),this[_0xcb66('0xd')]['callerid'],_0x42ef7f[_0xcb66('0x158')]));var _0x270d26=this[_0xcb66('0x4d')][_0xcb66('0xa3')](this,_0x42ef7f[_0xcb66('0x158')]);if(_0x270d26){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x42ef7f[_0xcb66('0x158')]));this[_0xcb66('0xd')]['noop'](util[_0xcb66('0x27')](_0xcb66('0x15d'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x42ef7f[_0xcb66('0x158')]));return{'code':0xc8,'result':_0xcb66('0x15e')};}else{logger['info'](util[_0xcb66('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xcb66('0xd')]['callerid'],_0x42ef7f['findBy']));this[_0xcb66('0xd')][_0xcb66('0xa8')](util[_0xcb66('0x27')](_0xcb66('0x15b'),this[_0xcb66('0xd')][_0xcb66('0x37')],_0x42ef7f[_0xcb66('0x158')]));return{'code':0xc8,'result':_0xcb66('0x15c')};}};AGIVertices[_0xcb66('0x10')][_0xcb66('0x1c0')]=function(_0x339ec6){logger['info'](util[_0xcb66('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x339ec6[_0xcb66('0xa7')]));var _0x4c4438=this['channel'][_0xcb66('0x52')](_0xcb66('0x1c1'),[_0x339ec6[_0xcb66('0x1c2')],_0x339ec6[_0xcb66('0x74')]]);if(_0x4c4438['result']===-0x1){return _0x4c4438;}return this[_0xcb66('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x339ec6[_0xcb66('0x1c2')]));};AGIVertices[_0xcb66('0x10')]['vswitch']=function(_0x2a62e7){logger[_0xcb66('0x2b')](util[_0xcb66('0x27')](_0xcb66('0x1c3'),_0x2a62e7[_0xcb66('0xa7')]));if(!this[_0xcb66('0x82')](_0x2a62e7[_0xcb66('0xdb')])){return this[_0xcb66('0xd')][_0xcb66('0x2f')](_0x2a62e7,_0xcb66('0x1a3'));}var _0x43f532=this['getVariable'][_0xcb66('0xa3')](this,_0x2a62e7[_0xcb66('0xdb')]);if(!_0x43f532){return this['channel'][_0xcb66('0x2f')](_0x2a62e7,'no\x20variable\x20found');}var _0x4d49b4=this[_0xcb66('0xd')][_0xcb66('0x9c')](_0x43f532);return{'code':0xc8,'result':_0x4d49b4[_0xcb66('0x9d')]?_0x4d49b4[_0xcb66('0x9d')]:'-'};};String[_0xcb66('0x10')]['replaceAll']=function(_0x466dea,_0x14245e){return this[_0xcb66('0x9b')](_0x466dea)['join'](_0x14245e);};module['exports']=AGIVertices; \ No newline at end of file +var _0x43fd=['Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','lodash','randomstring','moment','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','isNil','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','dialogflow','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','providerResponse','out','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','getSound','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','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','failure','logout','no\x20find\x20by\x20configured','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','bcc','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes'];(function(_0x51bc76,_0x317761){var _0x3f5380=function(_0x5c0530){while(--_0x5c0530){_0x51bc76['push'](_0x51bc76['shift']());}};_0x3f5380(++_0x317761);}(_0x43fd,0x1ec));var _0xd43f=function(_0x56824e,_0x4e48ad){_0x56824e=_0x56824e-0x0;var _0xcf97ff=_0x43fd[_0x56824e];return _0xcf97ff;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xd43f('0x0'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0xd43f('0x1'));var moment=require(_0xd43f('0x2'));var Mustache=require('mustache');var rp=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var scripts=require(_0xd43f('0x6'));var FILES_PATH=_0xd43f('0x7');var recursiveMapAttributes=['rawHeaders',_0xd43f('0x8')];var verticesWithRetry=[_0xd43f('0x9'),_0xd43f('0xa'),_0xd43f('0xb')];var AGIVertices=function(_0x547e12,_0x19c71d,_0x20d066){this['channel']=_0x547e12;this[_0xd43f('0xc')]=_0x19c71d;this[_0xd43f('0xd')]=_0x20d066;};AGIVertices[_0xd43f('0xe')][_0xd43f('0xf')]=function(_0x461711,_0x5eb0bb){this[_0xd43f('0xc')][_0xd43f('0x10')](_0x461711)[_0xd43f('0x11')](function(_0x1ed31a){_0x5eb0bb(null,_0x1ed31a?_0x1ed31a[_0xd43f('0x12')]:![]);})[_0xd43f('0x13')](function(_0x22f057){_0x5eb0bb(_0x22f057);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x14')]=function(_0x1bed70,_0x1eba90){this['rpc'][_0xd43f('0x15')](_0x1bed70)[_0xd43f('0x11')](function(_0x41be43){_0x1eba90(null,_0x41be43?_0x41be43['name']:![]);})['catch'](function(_0x4a2b49){_0x1eba90(_0x4a2b49);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x16')]=function(_0x4f8862,_0x3c0953){this[_0xd43f('0xc')]['getSquareProjectById'](_0x4f8862)['then'](function(_0x4fd639){_0x3c0953(null,_0x4fd639?_0x4fd639['name']:![]);})[_0xd43f('0x13')](function(_0x19784f){_0x3c0953(_0x19784f);});};AGIVertices['prototype'][_0xd43f('0x17')]=function(_0x2a8fa5,_0x18b862){this[_0xd43f('0xc')]['getSquareOdbcById'](_0x2a8fa5)[_0xd43f('0x11')](function(_0xd3933){_0x18b862(null,_0xd3933?_0xd3933[_0xd43f('0x18')]:![]);})['catch'](function(_0x5c7cda){_0x18b862(_0x5c7cda);});};AGIVertices['prototype'][_0xd43f('0x19')]=function(_0x25007c,_0x2c1ba9){this[_0xd43f('0xc')][_0xd43f('0x1a')](_0x25007c)[_0xd43f('0x11')](function(_0x296a77){_0x2c1ba9(null,_0x296a77?_0x296a77['name']:![]);})[_0xd43f('0x13')](function(_0x4a1d8b){_0x2c1ba9(_0x4a1d8b);});};AGIVertices[_0xd43f('0xe')]['getTrunk']=function(_0x5ab88f,_0x310195){this[_0xd43f('0xc')][_0xd43f('0x1b')](_0x5ab88f)[_0xd43f('0x11')](function(_0x35acd0){_0x310195(null,_0x35acd0?_0x35acd0[_0xd43f('0x12')]:![]);})[_0xd43f('0x13')](function(_0xc2e3da){_0x310195(_0xc2e3da);});};AGIVertices[_0xd43f('0xe')]['getSound']=function(_0x26a6c9,_0x2d5915){var _0x366cf7=this;this[_0xd43f('0xc')][_0xd43f('0x1c')](_0x26a6c9)['then'](function(_0x161540){_0x2d5915(null,_0x161540?_0x366cf7[_0xd43f('0x1d')](_0x161540[_0xd43f('0x1e')]):![]);})[_0xd43f('0x13')](function(_0x1ee70d){_0x2d5915(_0x1ee70d);});};AGIVertices[_0xd43f('0xe')]['getMailAccount']=function(_0x1e54d0,_0x1f476d){this['rpc'][_0xd43f('0x1f')](_0x1e54d0)['then'](function(_0x53aae7){_0x1f476d(null,_0x53aae7?_0x53aae7:![]);})[_0xd43f('0x13')](function(_0x18472c){_0x1f476d(_0x18472c);});};AGIVertices[_0xd43f('0xe')]['sendMailMessage']=function(_0x410921,_0x23c4f7,_0x5bba3d){this['mailRpc'][_0xd43f('0x20')](_0x410921,_0x23c4f7)[_0xd43f('0x11')](function(){_0x5bba3d(null);})[_0xd43f('0x13')](function(_0x202a05){_0x5bba3d(_0x202a05);});};AGIVertices['prototype'][_0xd43f('0x21')]=function(_0x24015b,_0x134b27){this[_0xd43f('0xc')][_0xd43f('0x22')](_0x24015b)[_0xd43f('0x11')](function(_0x434b36){if(_0x434b36){if(_0x434b36['IntervalId']){_0x134b27(null,[_0x434b36[_0xd43f('0x23')]]);}else{_0x134b27(null,_['map'](_0x434b36[_0xd43f('0x24')],_0xd43f('0x23')));}}else{_0x134b27(null,![]);}})[_0xd43f('0x13')](function(_0x51b765){_0x134b27(_0x51b765);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x1d')]=function(_0x523718){return util[_0xd43f('0x25')](_0xd43f('0x26'),FILES_PATH,_0x523718);};AGIVertices[_0xd43f('0xe')]['getQueryOdbc']=function(_0x291f05,_0x13f996,_0x1c0d7f){odbc[_0xd43f('0x27')](_0x291f05,function(_0x176aac){if(_0x176aac){logger['error'](_0xd43f('0x28'),_0x176aac);_0x1c0d7f(_0x176aac);}else{logger['info'](_0xd43f('0x29'));odbc[_0xd43f('0x2a')](_0x13f996,function(_0x416030,_0x507126){if(_0x416030){logger[_0xd43f('0x2b')](_0xd43f('0x2c'),_0x13f996);_0x1c0d7f(_0x416030);}else{logger['info'](_0xd43f('0x2d'),_0x13f996);odbc['close'](function(_0x5f09b3){if(_0x5f09b3){logger[_0xd43f('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5f09b3);}_0x1c0d7f(null,_0x507126);});}});}});};AGIVertices['prototype'][_0xd43f('0x2f')]=function(_0x57c338,_0x5a633b){this[_0xd43f('0xc')][_0xd43f('0x30')](_0x57c338)[_0xd43f('0x11')](function(_0x92b404){_0x5a633b(null,_0x92b404?_0x92b404:![]);})[_0xd43f('0x13')](function(_0x5caa8c){_0x5a633b(_0x5caa8c);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x31')]=function(_0x8016ca,_0x3a823b){this[_0xd43f('0xc')][_0xd43f('0x31')](_0x8016ca)[_0xd43f('0x11')](function(_0x41f7e4){_0x3a823b(null,_0x41f7e4);})[_0xd43f('0x13')](function(_0x3929e9){_0x3a823b(_0x3929e9);});};AGIVertices[_0xd43f('0xe')]['createSquareDetailsReport']=function(_0x3c23cd,_0x33c4b5,_0x482570){this['rpc'][_0xd43f('0x32')]({'uniqueid':this[_0xd43f('0x33')][_0xd43f('0x34')],'node':_0x3c23cd['label'],'application':_0x3c23cd[_0xd43f('0x35')],'data':_0x33c4b5||null,'project_name':this[_0xd43f('0x33')][_0xd43f('0x36')],'callerid':this[_0xd43f('0x33')]['callerid']})['then'](function(_0x5e3056){if(_0x482570){_0x482570(null,_0x5e3056);}})[_0xd43f('0x13')](function(_0x156e8a){if(_0x482570){_0x482570(_0x156e8a);}});};AGIVertices['prototype'][_0xd43f('0x37')]=function(_0x710b1e,_0x2d989f,_0x425628,_0x33a644){this[_0xd43f('0xc')][_0xd43f('0x37')]({'uniqueid':this[_0xd43f('0x33')]['uniqueid'],'callerid':this[_0xd43f('0x33')][_0xd43f('0x38')],'calleridname':this[_0xd43f('0x33')][_0xd43f('0x39')],'context':this[_0xd43f('0x33')][_0xd43f('0x3a')],'extension':this[_0xd43f('0x33')][_0xd43f('0x3b')],'priority':this[_0xd43f('0x33')][_0xd43f('0x3c')],'accountcode':this[_0xd43f('0x33')]['accountcode'],'dnid':this[_0xd43f('0x33')][_0xd43f('0x3d')],'projectName':this[_0xd43f('0x33')][_0xd43f('0x36')],'saveName':_0x2d989f,'filename':_0x710b1e[_0xd43f('0x3e')]||_0x2d989f,'savePath':_0x425628})[_0xd43f('0x11')](function(_0x54eaa2){_0x33a644(null,_0x54eaa2);})[_0xd43f('0x13')](function(_0x480240){_0x33a644(_0x480240);});};AGIVertices[_0xd43f('0xe')]['createSquareMessage']=function(_0x38f9fc,_0x89fb8e,_0x16720d,_0x10129e,_0x35f659){this[_0xd43f('0xc')][_0xd43f('0x3f')]({'uniqueid':this[_0xd43f('0x33')][_0xd43f('0x34')],'body':_0x38f9fc,'direction':_0x89fb8e,'providerName':_0x16720d,'providerResponse':_0x10129e})['then'](function(_0x45f433){if(_0x35f659){_0x35f659(null,_0x45f433);}})[_0xd43f('0x13')](function(_0x3af79f){if(_0x35f659){_0x35f659(_0x3af79f);}});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x40')]=function(_0x18855c,_0x39bee7){this[_0xd43f('0xc')][_0xd43f('0x40')]({'firstName':_[_0xd43f('0x41')](_0x18855c[_0xd43f('0x12')])||_['isNil'](_0x18855c['name'])?_0xd43f('0x42')+Math[_0xd43f('0x43')]():_0x18855c[_0xd43f('0x12')],'lastName':_['isEmpty'](_0x18855c['lastName'])||_[_0xd43f('0x44')](_0x18855c[_0xd43f('0x45')])?null:_0x18855c[_0xd43f('0x45')],'phone':_0x18855c[_0xd43f('0x46')],'ListId':_0x18855c[_0xd43f('0x47')],'scheduledat':_0x18855c['scheduledAt'],'callbackUniqueid':this[_0xd43f('0x33')][_0xd43f('0x34')],'tags':_0xd43f('0x48'),'description':_0xd43f('0x49')+_0x18855c[_0xd43f('0x4a')][_0xd43f('0x4b')](),'priority':_0x18855c['callback_priority']})[_0xd43f('0x11')](function(_0x381276){_0x39bee7(null,_0x381276);})[_0xd43f('0x13')](function(_0x376d02){_0x39bee7(_0x376d02);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x4c')]=function(_0x2195ff,_0xece809){this['rpc'][_0xd43f('0x4d')](_0x2195ff)[_0xd43f('0x11')](function(_0x60a5d2){_0xece809(null,_0x60a5d2?_0x60a5d2['name']:![]);})[_0xd43f('0x13')](function(_0x1fd7ce){_0xece809(_0x1fd7ce);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x4e')]=function(_0x41588b,_0x440c35,_0x3c9303){var _0x32590d={'role':_0xd43f('0x4f')};_0x32590d[_0x41588b]=this[_0xd43f('0x33')]['callerid'];this[_0xd43f('0xc')][_0xd43f('0x4e')](_0x32590d,_0x440c35,this['channel'][_0xd43f('0x34')])[_0xd43f('0x11')](function(_0x2dec66){_0x3c9303(null,_['isNil'](_0x2dec66)?![]:!![]);})[_0xd43f('0x13')](function(_0x598609){logger[_0xd43f('0x2e')](_0x598609);_0x3c9303(null,![]);});};AGIVertices['prototype'][_0xd43f('0x50')]=function(_0x50ba0b,_0x2539d2){var _0x1378db={'role':_0xd43f('0x4f')};_0x1378db[_0x50ba0b]=this['channel']['callerid'];this[_0xd43f('0xc')][_0xd43f('0x50')](_0x1378db)['then'](function(_0x1719ae){_0x2539d2(null,_[_0xd43f('0x44')](_0x1719ae)?![]:!![]);})['catch'](function(_0xc8f239){logger[_0xd43f('0x2e')](_0xc8f239);_0x2539d2(null,![]);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x51')]=function(_0x1eb3c3,_0xfe4b97){var _0x2851dc={'role':'agent'};_0x2851dc[_0x1eb3c3]=this[_0xd43f('0x33')][_0xd43f('0x38')];this[_0xd43f('0xc')][_0xd43f('0x51')](_0x2851dc)[_0xd43f('0x11')](function(_0x18cdd9){_0xfe4b97(null,_[_0xd43f('0x44')](_0x18cdd9)?![]:!![]);})['catch'](function(_0x466958){logger[_0xd43f('0x2e')](_0x466958);_0xfe4b97(null,![]);});};AGIVertices['prototype'][_0xd43f('0x52')]=function(_0x82867a,_0x44336c){var _0x4128c0={'role':_0xd43f('0x4f')};_0x4128c0[_0x82867a]=this[_0xd43f('0x33')][_0xd43f('0x38')];var _0x553b4a=_0x82867a!=_0xd43f('0x53')?util[_0xd43f('0x25')]('%s/%s@from-sip/n',_0xd43f('0x54'),this['channel'][_0xd43f('0x38')]):undefined;this[_0xd43f('0xc')][_0xd43f('0x52')](_0x4128c0,_0x553b4a)[_0xd43f('0x11')](function(_0x32090e){_0x44336c(null,_[_0xd43f('0x44')](_0x32090e)?![]:!![]);})[_0xd43f('0x13')](function(_0x289f14){logger[_0xd43f('0x2e')](_0x289f14);_0x44336c(null,![]);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x55')]=function(_0x100960,_0x332271){sh[_0xd43f('0x56')](_['trim'](_0x100960),function(_0x3dd670,_0xecf994){var _0xad8d76=_0xecf994['replace'](/(\r\n|\n|\r)/gm,'');_0x332271(null,_0xad8d76);});};AGIVertices[_0xd43f('0xe')]['googleCloudTTS']=function(_0x16a2bf,_0xa317f2){scripts[_0xd43f('0x57')](_0x16a2bf[_0xd43f('0x58')],_0x16a2bf['google_cloud_tts_text_type']||_0xd43f('0x59'),_0x16a2bf[_0xd43f('0x59')],_0x16a2bf[_0xd43f('0x5a')]||'en-US',_0x16a2bf[_0xd43f('0x5b')]||'MALE',_0x16a2bf[_0xd43f('0x5c')]||_0xd43f('0x5d'))[_0xd43f('0x11')](function(_0x163e57){_0xa317f2(null,_0x163e57);})['catch'](function(_0x374882){_0xa317f2(_0x374882);});};AGIVertices['prototype'][_0xd43f('0x5e')]=function(_0x486eee,_0x3c47f5){scripts[_0xd43f('0x5e')](_0x486eee['text'],_0x486eee[_0xd43f('0x5f')]||'en',0x1)[_0xd43f('0x11')](function(_0x4ff065){_0x3c47f5(null,_0x4ff065);})[_0xd43f('0x13')](function(_0x5ca055){_0x3c47f5(_0x5ca055);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x60')]=function(_0x4615a1,_0x147c6b){var _0x5f30f7={'uri':_0x4615a1[_0xd43f('0x61')],'method':_0x4615a1[_0xd43f('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4615a1['timeout'])==='number'&&parseInt(_0x4615a1[_0xd43f('0x63')])>=0x1?parseInt(_0x4615a1[_0xd43f('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xd43f('0x64')](['POST',_0xd43f('0x65')],_0x5f30f7['method'][_0xd43f('0x66')]())){try{_0x5f30f7[_0xd43f('0x67')]=_0x4615a1['rawBody']?JSON[_0xd43f('0x68')](_0x4615a1[_0xd43f('0x8')]):{};}catch(_0x2d6b29){logger[_0xd43f('0x2e')](_0xd43f('0x69'),_0x2d6b29);}}try{_0x5f30f7[_0xd43f('0x6a')]=_0x4615a1[_0xd43f('0x6b')]?JSON[_0xd43f('0x68')](_0x4615a1[_0xd43f('0x6b')]):{};}catch(_0x1982bd){logger[_0xd43f('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1982bd);}if(_0x4615a1[_0xd43f('0x6c')]){try{var _0x59645c=require(_0x4615a1[_0xd43f('0x6c')])[_0xd43f('0x6d')](this,_0x5f30f7);_0x5f30f7[_0xd43f('0x6e')]=Mustache[_0xd43f('0x6f')](_0x4615a1['url'],_0x59645c,{},['$$','$$']);if(_0x5f30f7['headers']){_0x5f30f7[_0xd43f('0x6a')]=JSON[_0xd43f('0x68')](Mustache['render'](JSON[_0xd43f('0x70')](_0x5f30f7[_0xd43f('0x6a')]),_0x59645c,{},['$$','$$']));}if(_0x5f30f7[_0xd43f('0x67')]){_0x5f30f7[_0xd43f('0x67')]=JSON[_0xd43f('0x68')](Mustache[_0xd43f('0x6f')](JSON[_0xd43f('0x70')](_0x5f30f7[_0xd43f('0x67')]),_0x59645c,{},['$$','$$']));}}catch(_0x37f6af){logger[_0xd43f('0x2e')](_0xd43f('0x71'),_0x37f6af);}}rp(_0x5f30f7)[_0xd43f('0x11')](function(_0x21efee){var _0x1f7a46={'statusCode':_0x21efee[_0xd43f('0x72')]||0xc8,'statusMessage':_0x21efee[_0xd43f('0x73')]||'OK','headers':_0x21efee['headers']||{},'body':_0x21efee['body']||{}};_0x147c6b(null,_0x1f7a46);})[_0xd43f('0x13')](function(_0xc8fc9){var _0x596bde={'statusCode':_0xc8fc9[_0xd43f('0x72')]||0x1f4,'statusMessage':_0xc8fc9[_0xd43f('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xc8fc9[_0xd43f('0x75')][_0xd43f('0x6a')]||{},'body':_0xc8fc9[_0xd43f('0x75')]['body']||{}};_0x147c6b(null,_0x596bde);});};AGIVertices['prototype'][_0xd43f('0x76')]=function(_0x232d33,_0xcabad6){scripts[_0xd43f('0x76')](this[_0xd43f('0x33')][_0xd43f('0x34')],_0x232d33[_0xd43f('0x77')],_0x232d33[_0xd43f('0x59')],_0x232d33[_0xd43f('0x78')]||'en')[_0xd43f('0x11')](function(_0x31a164){_0xcabad6(null,_0x31a164);})[_0xd43f('0x13')](function(_0x534bbf){_0xcabad6(_0x534bbf);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x79')]=function(_0xdc5d65,_0x46a21c){scripts[_0xd43f('0x79')](this[_0xd43f('0x33')][_0xd43f('0x34')],_0xdc5d65['dialogflowV2_project_id'],_0xdc5d65[_0xd43f('0x7a')],_0xdc5d65[_0xd43f('0x7b')],_0xdc5d65[_0xd43f('0x59')],_0xdc5d65[_0xd43f('0x7c')]||'en')['then'](function(_0x1df30b){_0x46a21c(null,_0x1df30b);})[_0xd43f('0x13')](function(_0x37474c){_0x46a21c(_0x37474c);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x7d')]=function(_0x15c631,_0xb833d7){scripts[_0xd43f('0x7d')](this[_0xd43f('0x33')],_0x15c631)['then'](function(_0xd253bd){_0xb833d7(null,_0xd253bd);})['catch'](function(_0x3e1028){_0xb833d7(_0x3e1028);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x7e')]=function(_0x25f5fb,_0x4f7c61){scripts[_0xd43f('0x7e')](_0x25f5fb[_0xd43f('0x77')],_0x25f5fb['text'],_0x25f5fb[_0xd43f('0x7f')]||_0xd43f('0x80'),_0x25f5fb[_0xd43f('0x81')])[_0xd43f('0x11')](function(_0x145d37){_0x4f7c61(null,_0x145d37);})[_0xd43f('0x13')](function(_0x4f3d39){_0x4f7c61(_0x4f3d39);});};AGIVertices['prototype']['ispeechASR']=function(_0x40d6d3,_0x542ded,_0x10187c){scripts['ispeechASR'](_0x542ded,_0x40d6d3[_0xd43f('0x77')],_0x40d6d3[_0xd43f('0x82')]||_0xd43f('0x80'),this[_0xd43f('0x83')](_0x40d6d3[_0xd43f('0x84')])?_0x40d6d3[_0xd43f('0x84')]:undefined)[_0xd43f('0x11')](function(_0x464c42){_0x10187c(null,_0x464c42);})[_0xd43f('0x13')](function(_0x19b44c){_0x10187c(_0x19b44c);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x85')]=function(_0x229f89,_0x5b8946){scripts[_0xd43f('0x85')](_0x229f89[_0xd43f('0x86')],_0x229f89[_0xd43f('0x87')],_0x229f89[_0xd43f('0x88')],_0x229f89[_0xd43f('0x89')]||'Amy',_0x229f89[_0xd43f('0x59')],_0x229f89[_0xd43f('0x8a')]||_0xd43f('0x59'))[_0xd43f('0x11')](function(_0xe00de4){_0x5b8946(null,_0xe00de4);})[_0xd43f('0x13')](function(_0x19c24c){_0x5b8946(_0x19c24c);});};AGIVertices['prototype']['awsLex']=function(_0xb18bde,_0x23fd84){scripts[_0xd43f('0x8b')](this[_0xd43f('0x33')]['uniqueid'],_0xb18bde['aws_access_key_id'],_0xb18bde['aws_secret_access_key'],_0xb18bde['aws_lex_region'],_0xb18bde[_0xd43f('0x59')],_0xb18bde[_0xd43f('0x8c')])[_0xd43f('0x11')](function(_0x1aaaf8){_0x23fd84(null,_0x1aaaf8);})[_0xd43f('0x13')](function(_0xdaa1be){_0x23fd84(_0xdaa1be);});};AGIVertices['prototype'][_0xd43f('0x8d')]=function(_0xfa6af3,_0x59da9b,_0x4d93ba){scripts['googleASR'](_0x59da9b,_0xfa6af3[_0xd43f('0x77')],_0xfa6af3[_0xd43f('0x8e')]||'en-US')[_0xd43f('0x11')](function(_0x5e0ea8){_0x4d93ba(null,_0x5e0ea8);})[_0xd43f('0x13')](function(_0x4c975e){_0x4d93ba(_0x4c975e);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x8f')]=function(_0x4e7011,_0xcd4b3d,_0x245b22){scripts[_0xd43f('0x8f')](_0xcd4b3d,_0x4e7011['appid'],_0x4e7011['appsecret'],_0x4e7011[_0xd43f('0x6e')])['then'](function(_0x3878bf){_0x245b22(null,_0x3878bf);})[_0xd43f('0x13')](function(_0x3a8c54){_0x245b22(_0x3a8c54);});};AGIVertices[_0xd43f('0xe')][_0xd43f('0x90')]=function(_0x52c229){var _0x371eee=_['includes'](verticesWithRetry,_0x52c229[_0xd43f('0x35')])?_0x52c229:_[_0xd43f('0x91')](_0x52c229);for(var _0x547185 in _0x371eee){if(_0x371eee[_0xd43f('0x92')](_0x547185)){if(_0x371eee[_0x547185]&&_[_0xd43f('0x93')](_0x371eee[_0x547185])){if(_['includes'](recursiveMapAttributes,_0x547185)){_0x371eee[_0x547185]=this[_0xd43f('0x94')](_0x371eee[_0x547185]);}else{_0x371eee[_0x547185]=this['replaceAllVariables'](_0x371eee[_0x547185]);}}}}return _0x371eee;};AGIVertices[_0xd43f('0xe')][_0xd43f('0x95')]=function(_0x4a99c4){for(var _0x3bcc5 in _0x4a99c4){if(_0x4a99c4[_0xd43f('0x92')](_0x3bcc5)){if(_[_0xd43f('0x96')](_0x4a99c4[_0x3bcc5])){this[_0xd43f('0x95')](_0x4a99c4[_0x3bcc5]);}else if(_[_0xd43f('0x97')](_0x4a99c4[_0x3bcc5])){for(var _0x37e350=0x0;_0x37e350<_0x4a99c4[_0x3bcc5][_0xd43f('0x98')];_0x37e350++){this[_0xd43f('0x95')](_0x4a99c4[_0x3bcc5][_0x37e350]);}}else if(_[_0xd43f('0x93')](_0x4a99c4[_0x3bcc5])){_0x4a99c4[_0x3bcc5]=this['replaceAllVariables'](_0x4a99c4[_0x3bcc5]);}}}};AGIVertices[_0xd43f('0xe')][_0xd43f('0x99')]=function(_0x3598c2,_0x879099){for(var _0x493268 in _0x3598c2){if(_0x3598c2[_0xd43f('0x92')](_0x493268)){if(_[_0xd43f('0x96')](_0x3598c2[_0x493268])){if(!_['isEmpty'](_0x3598c2[_0x493268])){this[_0xd43f('0x99')](_0x3598c2[_0x493268],util[_0xd43f('0x25')](_0xd43f('0x9a'),_0x879099,_0x493268));}}else if(_[_0xd43f('0x97')](_0x3598c2[_0x493268])){for(var _0x18350f=0x0;_0x18350f<_0x3598c2[_0x493268][_0xd43f('0x98')];_0x18350f++){this['saveRestApiResult'](_0x3598c2[_0x493268][_0x18350f],util[_0xd43f('0x25')]('%s.%s',_0x879099,_0x493268+'['+_0x18350f+']'));}}else{if(!_['isNil'](_0x3598c2[_0x493268])){this[_0xd43f('0x33')][_0xd43f('0x9b')](util[_0xd43f('0x25')](_0xd43f('0x9a'),_0x879099,_0x493268),_0x3598c2[_0x493268]);}}}}};AGIVertices['prototype'][_0xd43f('0x94')]=function(_0x66b7c1){try{var _0xb0dad0=JSON[_0xd43f('0x68')](_0x66b7c1);this['recursiveNodeIndex'](_0xb0dad0);return JSON[_0xd43f('0x70')](_0xb0dad0);}catch(_0x21635f){return this['replaceAllVariables'](_0x66b7c1);}};AGIVertices['prototype'][_0xd43f('0x9c')]=function(_0xda82e6){var _0x1d08a0=_0xda82e6[_0xd43f('0x9d')]('{');for(var _0x2b8199=0x1;_0x2b8199<_0x1d08a0[_0xd43f('0x98')];_0x2b8199+=0x1){var _0x528e04=_0x1d08a0[_0x2b8199][_0xd43f('0x9d')]('}');if(_0x528e04[_0xd43f('0x98')]>0x1){_0xda82e6=_0xda82e6[_0xd43f('0x9e')]('{'+_0x528e04[0x0]+'}',this[_0xd43f('0x33')]['getVariable'](_0x528e04[0x0])[_0xd43f('0x9f')]||_0x528e04[0x0]);}}if(_0x1d08a0[_0xd43f('0x98')]===0x1){return _0xda82e6[_0xd43f('0x4b')]();}return this[_0xd43f('0x9c')](_0xda82e6);};AGIVertices['prototype']['getAndSetVariable']=function(_0x2dc9b5,_0x4746df){var _0x5e4a5d=this[_0xd43f('0x33')][_0xd43f('0xf')](_0x2dc9b5);if(_0x5e4a5d[_0xd43f('0xa0')]===-0x1){return _0x5e4a5d;}logger[_0xd43f('0x2b')](util['format'](_0xd43f('0xa1'),_0x4746df,_0x5e4a5d[_0xd43f('0x9f')]));return this[_0xd43f('0x33')]['setVariable'](_0x4746df,_0x5e4a5d[_0xd43f('0x9f')]);};AGIVertices[_0xd43f('0xe')][_0xd43f('0x83')]=function(_0x11ab5f){return _0x11ab5f&&_0x11ab5f!=='0'&&_0x11ab5f!=='-1'&&_0x11ab5f!=='';};AGIVertices[_0xd43f('0xe')][_0xd43f('0xa2')]=function(_0x293494){this['createSquareDetailsReport']['sync'](this,_0x293494,'-');_0x293494[_0xd43f('0xa3')]=_0x293494[_0xd43f('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd43f('0xe')]['mrcpsynth']=function(_0x203821){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xa4'),_0x203821[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x203821[_0xd43f('0x59')])){return this['channel'][_0xd43f('0xa6')](_0xd43f('0xa7'));}var _0x2e6641='\x22'+_0x203821[_0xd43f('0x59')]+'\x22';if(this[_0xd43f('0x83')](_0x203821['options'])){_0x2e6641+=','+_0x203821[_0xd43f('0x75')];}var _0x4fe18a=this['channel'][_0xd43f('0x56')](_0xd43f('0xa8'),_0x2e6641);if(_0x4fe18a[_0xd43f('0xa0')]===-0x1){return _0x4fe18a;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xa9'),_0x2e6641));};AGIVertices[_0xd43f('0xe')][_0xd43f('0xaa')]=function(_0x3958e3){logger['info'](util[_0xd43f('0x25')](_0xd43f('0xab'),_0x3958e3[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x3958e3[_0xd43f('0xac')])){return this['channel'][_0xd43f('0xa6')](_0xd43f('0xad'));}var _0x3b7a39=_0x3958e3[_0xd43f('0xac')];if(this[_0xd43f('0x83')](_0x3958e3[_0xd43f('0x75')])){_0x3b7a39+=','+_0x3958e3[_0xd43f('0x75')];}var _0x30be89=this[_0xd43f('0x33')]['exec']('MRCPRecog',_0x3b7a39);if(_0x30be89[_0xd43f('0xa0')]===-0x1){return _0x30be89;}var _0x5e631f=this[_0xd43f('0xae')](_0xd43f('0xaf'),_0xd43f('0xb0'));if(_0x5e631f[_0xd43f('0xa0')]===-0x1){return _0x5e631f;}var _0x48499c=this[_0xd43f('0xae')](_0xd43f('0xb1'),_0xd43f('0xb2'));if(_0x48499c['result']===-0x1){return _0x48499c;}var _0x126eae=this[_0xd43f('0xae')](_0xd43f('0xb3'),_0xd43f('0xb4'));if(_0x126eae['result']===-0x1){return _0x126eae;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3b7a39));};AGIVertices[_0xd43f('0xe')]['agi']=function(_0xff4968){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xb5'),_0xff4968[_0xd43f('0xa5')]));return this[_0xd43f('0x33')][_0xd43f('0x4')]([_0xff4968[_0xd43f('0xb6')],_0xff4968[_0xd43f('0xb7')]]);};AGIVertices[_0xd43f('0xe')]['answer']=function(_0x103e10){logger['info'](util[_0xd43f('0x25')](_0xd43f('0xb8'),_0x103e10['label']));if(this['isConfigured'](_0x103e10[_0xd43f('0x63')])){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xb9'),_0x103e10['timeout']));var _0x144bca=this[_0xd43f('0x33')]['wait'](_0x103e10[_0xd43f('0x63')]);if(_0x144bca[_0xd43f('0xa0')]===-0x1){return _0x144bca;}}return this[_0xd43f('0x33')][_0xd43f('0xba')]();};AGIVertices['prototype'][_0xd43f('0x48')]=function(_0x2fa596){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x2fa596[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x2fa596[_0xd43f('0x47')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x2fa596,_0xd43f('0xbb'));}_0x2fa596[_0xd43f('0x4a')]=moment();if(this[_0xd43f('0x83')](_0x2fa596[_0xd43f('0xbc')])){_0x2fa596['scheduledAt']=moment()['add'](_0x2fa596[_0xd43f('0xbc')],_0xd43f('0xbd'));}if(!this[_0xd43f('0x83')](_0x2fa596[_0xd43f('0xbe')])){_0x2fa596[_0xd43f('0xbe')]=0x2;}this[_0xd43f('0x40')][_0xd43f('0x6d')](this,_0x2fa596);return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xbf'),_0x2fa596[_0xd43f('0x46')],_0x2fa596[_0xd43f('0x47')],_0x2fa596[_0xd43f('0x4a')]));};AGIVertices[_0xd43f('0xe')]['custom_app']=function(_0x2c9f1e){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xc0'),_0x2c9f1e['label']));var _0x19c481=this[_0xd43f('0x33')][_0xd43f('0x56')](_0x2c9f1e[_0xd43f('0xc1')],_0x2c9f1e[_0xd43f('0x75')]);if(_0x19c481[_0xd43f('0xa0')]===-0x1){return _0x19c481;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xc2'),_0x2c9f1e[_0xd43f('0xc1')],_0x2c9f1e[_0xd43f('0x75')]));};AGIVertices[_0xd43f('0xe')][_0xd43f('0xc3')]=function(_0x59cabb){logger['info'](util['format'](_0xd43f('0xc4'),_0x59cabb['label']));if(!this['isConfigured'](_0x59cabb[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}var _0x197e6d='\x22'+_0x59cabb['text']+'\x22';if(this[_0xd43f('0x83')](_0x59cabb[_0xd43f('0x75')])){_0x197e6d+=','+_0x59cabb['options'];}var _0x248eac=this['channel'][_0xd43f('0x56')](_0xd43f('0xa8'),_0x197e6d);if(_0x248eac[_0xd43f('0xa0')]===-0x1){return _0x248eac;}return this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0xa9'),_0x197e6d));};AGIVertices['prototype'][_0xd43f('0xc5')]=function(_0x21cab8){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0xc6'),_0x21cab8['label']));if(!this['isConfigured'](_0x21cab8[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}var _0x14c71d='\x22'+_0x21cab8[_0xd43f('0x59')]+'\x22';if(this[_0xd43f('0x83')](_0x21cab8[_0xd43f('0x75')])){_0x14c71d+=','+_0x21cab8[_0xd43f('0x75')];}var _0xa7afc7=this['channel'][_0xd43f('0x56')]('MRCPSynth',_0x14c71d);if(_0xa7afc7[_0xd43f('0xa0')]===-0x1){return _0xa7afc7;}return this[_0xd43f('0x33')]['noop'](util['format'](_0xd43f('0xa9'),_0x14c71d));};AGIVertices[_0xd43f('0xe')][_0xd43f('0xc7')]=function(_0x5c8a9e){logger['info'](util[_0xd43f('0x25')](_0xd43f('0xc8'),_0x5c8a9e[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x5c8a9e[_0xd43f('0xac')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20grammar\x20configured');}var _0x503900=_0x5c8a9e['grammar'];if(this[_0xd43f('0x83')](_0x5c8a9e[_0xd43f('0x75')])){_0x503900+=','+_0x5c8a9e[_0xd43f('0x75')];}var _0x3cfe7a=this[_0xd43f('0x33')][_0xd43f('0x56')](_0xd43f('0xc9'),_0x503900);if(_0x3cfe7a[_0xd43f('0xa0')]===-0x1){return _0x3cfe7a;}var _0x1062f5=this[_0xd43f('0xae')](_0xd43f('0xaf'),_0xd43f('0xca'));if(_0x1062f5['result']===-0x1){return _0x1062f5;}var _0x3df4ed=this[_0xd43f('0xae')](_0xd43f('0xb1'),_0xd43f('0xcb'));if(_0x3df4ed['result']===-0x1){return _0x3df4ed;}var _0x210e54=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd43f('0xcc'));if(_0x210e54[_0xd43f('0xa0')]===-0x1){return _0x210e54;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0xcd'),_0x503900));};AGIVertices[_0xd43f('0xe')][_0xd43f('0xce')]=function(_0x35915c){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x35915c[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x35915c['grammar'])){return this['channel'][_0xd43f('0xa6')](_0xd43f('0xad'));}var _0x3b1e49=_0x35915c['grammar'];if(this[_0xd43f('0x83')](_0x35915c[_0xd43f('0x75')])){_0x3b1e49+=','+_0x35915c[_0xd43f('0x75')];}var _0x21669b=this[_0xd43f('0x33')][_0xd43f('0x56')](_0xd43f('0xc9'),_0x3b1e49);if(_0x21669b[_0xd43f('0xa0')]===-0x1){return _0x21669b;}var _0x651406=this[_0xd43f('0xae')](_0xd43f('0xaf'),_0xd43f('0xcf'));if(_0x651406[_0xd43f('0xa0')]===-0x1){return _0x651406;}var _0x59fbee=this[_0xd43f('0xae')](_0xd43f('0xb1'),_0xd43f('0xd0'));if(_0x59fbee[_0xd43f('0xa0')]===-0x1){return _0x59fbee;}var _0x2af8b7=this[_0xd43f('0xae')](_0xd43f('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x2af8b7[_0xd43f('0xa0')]===-0x1){return _0x2af8b7;}return this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xcd'),_0x3b1e49));};AGIVertices[_0xd43f('0xe')]['database']=function(_0xde4c9b){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xd1'),_0xde4c9b[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0xde4c9b[_0xd43f('0xd2')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0xde4c9b,'no\x20database\x20selected');}var _0x503b67=this['getSquareOdbc'][_0xd43f('0x6d')](this,_0xde4c9b[_0xd43f('0xd2')]);if(!_0x503b67){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0xde4c9b,_0xd43f('0xd3'));}if(!this[_0xd43f('0x83')](_0xde4c9b['query'])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0xde4c9b,_0xd43f('0xd4'));}var _0x5121eb=_0xde4c9b[_0xd43f('0x2a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xd5'),_0x5121eb));var _0x5ab2b9=this['getQueryOdbc']['sync'](this,_0x503b67,_0x5121eb);this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0xde4c9b,_0x5121eb);if(!this[_0xd43f('0x83')](_0xde4c9b[_0xd43f('0xd6')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xd7'));}var _0x2291ca=this[_0xd43f('0xf')][_0xd43f('0x6d')](this,_0xde4c9b[_0xd43f('0xd6')]);if(!_0x2291ca){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0xde4c9b,_0xd43f('0xd8'));}var _0x4d5210=this;_0x5ab2b9[_0xd43f('0xd9')](function(_0xc509bf,_0x1aa11f){Object[_0xd43f('0xda')](_0xc509bf)[_0xd43f('0xd9')](function(_0x54cbc0){_0x4d5210[_0xd43f('0x33')]['setVariable'](util['format'](_0xd43f('0xdb'),_0x2291ca,_0x1aa11f,_0x54cbc0),_0xc509bf[_0x54cbc0]);});});this[_0xd43f('0x33')][_0xd43f('0x9b')](util['format'](_0xd43f('0xdc'),_0x2291ca),_0x5ab2b9[_0xd43f('0x98')]);return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xdd'),_0x2291ca));};AGIVertices['prototype'][_0xd43f('0xde')]=function(_0x3682db){logger[_0xd43f('0xdf')](util[_0xd43f('0x25')](_0xd43f('0xe0'),_0x3682db['label']));if(!this[_0xd43f('0x83')](_0x3682db[_0xd43f('0xe1')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x3682db,_0xd43f('0xe2'));}var _0x46851b=this['getUser'][_0xd43f('0x6d')](this,_0x3682db['sip_id']);if(!_0x46851b){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x3682db,_0xd43f('0xe3'));}var _0x6400b2=this['channel'][_0xd43f('0x56')](_0xd43f('0xe4'),[util[_0xd43f('0x25')](_0xd43f('0xe5'),_0x46851b),_0x3682db[_0xd43f('0x63')],_0x3682db['opts'],_0x3682db[_0xd43f('0x61')]]);if(_0x6400b2[_0xd43f('0xa0')]===-0x1){return _0x6400b2;}return this[_0xd43f('0x33')]['noop'](util['format']('Executed\x20command\x20%s',_0xd43f('0xe4')));};AGIVertices[_0xd43f('0xe')]['dialogflow']=function(_0x4a79a3){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xe6'),_0x4a79a3[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x4a79a3[_0xd43f('0x77')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20key\x20configured');}if(!this[_0xd43f('0x83')](_0x4a79a3[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20text\x20configured');}this[_0xd43f('0x33')][_0xd43f('0xe7')]=!![];this[_0xd43f('0x32')](_0x4a79a3);this[_0xd43f('0x3f')](_0x4a79a3['text'],'in','','');this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xe8'),_0x4a79a3[_0xd43f('0x59')]));var _0x5b262f=this[_0xd43f('0x76')][_0xd43f('0x6d')](this,_0x4a79a3);if(_0x5b262f){for(var _0x5b93cc in _0x5b262f){if(_0x5b262f[_0xd43f('0x92')](_0x5b93cc)){this[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0xe9'),_0x5b93cc[_0xd43f('0x66')]()),_0x5b262f[_0x5b93cc]);}}this[_0xd43f('0x3f')](_0x5b262f[_0xd43f('0xea')],'out',_0xd43f('0xeb'),'');return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('Dialogflow\x20Result\x20%s',_0x5b262f[_0xd43f('0xea')]));}return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x4a79a3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xd43f('0xe')][_0xd43f('0xec')]=function(_0x82350e){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x82350e[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x82350e['dialogflowV2_project_id'])){return this[_0xd43f('0x33')]['noop'](_0xd43f('0xed'));}if(!this['isConfigured'](_0x82350e[_0xd43f('0x7a')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xee'));}if(!this[_0xd43f('0x83')](_0x82350e[_0xd43f('0x7b')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xef'));}if(!this[_0xd43f('0x83')](_0x82350e[_0xd43f('0x7c')])){return this[_0xd43f('0x33')]['noop']('no\x20anguage\x20configured');}if(!this[_0xd43f('0x83')](_0x82350e['text'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}this[_0xd43f('0x33')][_0xd43f('0xe7')]=!![];this[_0xd43f('0x32')](_0x82350e);this[_0xd43f('0x3f')](_0x82350e[_0xd43f('0x59')],'in','','');this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('Trying\x20DialogflowV2:\x20%s',_0x82350e[_0xd43f('0x59')]));var _0x4781d4=this[_0xd43f('0x79')][_0xd43f('0x6d')](this,_0x82350e);if(_0x4781d4){for(var _0x33e7ad in _0x4781d4){if(_0x4781d4[_0xd43f('0x92')](_0x33e7ad)){if(_0x33e7ad!==_0xd43f('0xf0')){this[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0xe9'),_0x33e7ad[_0xd43f('0x66')]()),_0x4781d4[_0x33e7ad]);}}}this[_0xd43f('0x3f')](_0x4781d4['speech'],_0xd43f('0xf1'),_0xd43f('0xec'),_0x4781d4[_0xd43f('0xf0')]);return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('DialogflowV2\x20Result\x20%s',_0x4781d4['speech']));}return this['channel'][_0xd43f('0x2e')](_0x82350e,_0xd43f('0xf2'));};AGIVertices[_0xd43f('0xe')]['sesteknda']=function(_0x372b2d){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0xf3'),_0x372b2d[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x372b2d[_0xd43f('0xf4')])){return this['channel'][_0xd43f('0xa6')](_0xd43f('0xf5'));}if(!this['isConfigured'](_0x372b2d['username'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xf6'));}if(!this[_0xd43f('0x83')](_0x372b2d['password'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xf7'));}if(!this[_0xd43f('0x83')](_0x372b2d[_0xd43f('0xf8')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20text\x20configured');}this['channel'][_0xd43f('0xe7')]=!![];this[_0xd43f('0x32')](_0x372b2d);this[_0xd43f('0x3f')](_0x372b2d[_0xd43f('0x59')],'in','','');this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xf9'),_0x372b2d[_0xd43f('0x59')]));var _0x51de1f=this[_0xd43f('0x7d')][_0xd43f('0x6d')](this,_0x372b2d);if(_0x51de1f){for(var _0x42f2cd in _0x51de1f){if(_0x51de1f[_0xd43f('0x92')](_0x42f2cd)){this[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0xfa'),_0x42f2cd[_0xd43f('0x66')]()),_0x51de1f[_0x42f2cd]);}}this['createSquareMessage'](_0x51de1f[_0xd43f('0xea')],_0xd43f('0xf1'),_0xd43f('0xfb'),'');if(_0x51de1f[_0xd43f('0xfc')]){this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xfd'),_0x51de1f[_0xd43f('0xfc')]));var _0x1379fe=this[_0xd43f('0x33')]['streamFile'](_0x51de1f['audiofile']);try{fs[_0xd43f('0xfe')](_0x51de1f['audiofile']+_0xd43f('0xff'));}catch(_0x4b13d0){logger[_0xd43f('0x2e')](_0x4b13d0);}return _0x1379fe;}else{return this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x100'),_0x51de1f['speech']));}}return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x372b2d,_0xd43f('0x101'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x102')]=function(_0x18fea1){logger['info'](util[_0xd43f('0x25')](_0xd43f('0x103'),_0x18fea1['label']));return this[_0xd43f('0x33')]['noop'](_0xd43f('0x102'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x104')]=function(_0x34e0b5){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x105'),_0x34e0b5[_0xd43f('0xa5')]));var _0x41f10e='';if(_0x34e0b5[_0xd43f('0x106')]){if(!this[_0xd43f('0x83')](_0x34e0b5[_0xd43f('0x106')])){return this['channel'][_0xd43f('0x2e')](_0x34e0b5,'no\x20trunk\x20selected');}else{var _0xc6952d=parseInt(_0x34e0b5[_0xd43f('0x106')],0xa);if(isNaN(_0xc6952d)){_0x41f10e=_0x34e0b5[_0xd43f('0x106')];}else{_0x41f10e=this[_0xd43f('0x107')]['sync'](this,_0x34e0b5[_0xd43f('0x106')]);if(!_0x41f10e){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x34e0b5,_0xd43f('0x108'));}}}}else if(_0x34e0b5[_0xd43f('0x109')]){_0x41f10e=_0x34e0b5[_0xd43f('0x109')];}else{return this[_0xd43f('0x33')]['error'](_0x34e0b5,_0xd43f('0x10a'));}var _0x3ff188=this['channel'][_0xd43f('0x56')](_0xd43f('0xe4'),[util[_0xd43f('0x25')](_0xd43f('0x10b'),_0x41f10e,_0x34e0b5[_0xd43f('0x46')]),_0x34e0b5['timeout'],_0x34e0b5[_0xd43f('0x10c')],_0x34e0b5['url']]);if(_0x3ff188[_0xd43f('0xa0')]===-0x1){return _0x3ff188;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x10d'),_0xd43f('0xe4')));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x10e')]=function(_0xd0fb9c){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x10f'),_0xd0fb9c[_0xd43f('0xa5')]));return this[_0xd43f('0x33')]['noop'](_0xd43f('0x10e'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0xa')]=function(_0x5ad682){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x110'),_0x5ad682[_0xd43f('0xa5')]));if(_0x5ad682['retry']===0x0){return this[_0xd43f('0xa2')](_0x5ad682);}_0x5ad682[_0xd43f('0xa3')]-=0x1;if(!this[_0xd43f('0x83')](_0x5ad682['file_id'])){return this['channel']['error'](_0x5ad682,'no\x20file\x20audio\x20selected');}var _0x2b16e5=this[_0xd43f('0x111')][_0xd43f('0x6d')](this,_0x5ad682[_0xd43f('0x112')]);if(!_0x2b16e5){return this[_0xd43f('0x33')]['error'](_0x5ad682,_0xd43f('0x113'));}if(!this['isConfigured'](_0x5ad682[_0xd43f('0xd6')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2c8e2a=this[_0xd43f('0x33')][_0xd43f('0x114')](_0x2b16e5,_0x5ad682[_0xd43f('0x115')],_0x5ad682['maxdigit']);var _0x62f69a=_0x2c8e2a['result']?_0x2c8e2a[_0xd43f('0xa0')]['toString']():'';logger[_0xd43f('0x2b')](_0xd43f('0x116'),JSON[_0xd43f('0x70')](_0x2c8e2a));if(_0x2c8e2a[_0xd43f('0xa0')]===-0x1){this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x5ad682,_0x62f69a);return _0x2c8e2a;}else if(_0x2c8e2a[_0xd43f('0x9f')]===_0xd43f('0x63')){_0x2c8e2a[_0xd43f('0xa0')]=_0x62f69a['length']>=parseInt(_0x5ad682[_0xd43f('0x117')])?'x':'i';}else{_0x2c8e2a[_0xd43f('0xa0')]=_0x62f69a['length']>=parseInt(_0x5ad682[_0xd43f('0x117')])&&_0x62f69a[_0xd43f('0x98')]<=parseInt(_0x5ad682['maxdigit'])?'x':'i';}var _0x10df6a=this['getVariable'][_0xd43f('0x6d')](this,_0x5ad682[_0xd43f('0xd6')]);if(!_0x10df6a){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x5ad682,_0xd43f('0xd8'));}this['channel'][_0xd43f('0x9b')](_0x10df6a,_0x62f69a);if(this['isConfigured'](_0x5ad682[_0xd43f('0x118')])){var _0x57109c=parseInt(_0x5ad682['hiddendigitsnum'],0xa);var _0x207755=rs['generate']({'charset':'*','length':_0x57109c});var _0xc2fbee=_0x62f69a['length'];if(_0xc2fbee>0x0){if(_0xc2fbee>_0x57109c){this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x5ad682,_0x5ad682[_0xd43f('0x119')]===_0xd43f('0x11a')?_0x207755+_0x62f69a[_0xd43f('0x11b')](_0x57109c):_0x62f69a[_0xd43f('0x11b')](0x0,_0xc2fbee-_0x57109c)+_0x207755);}else{this['createSquareDetailsReport']['sync'](this,_0x5ad682,rs[_0xd43f('0x11c')]({'charset':'*','length':_0xc2fbee}));}}else{this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x5ad682,'');}}else{this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x5ad682,_0x62f69a);}return _0x2c8e2a;};AGIVertices['prototype'][_0xd43f('0xb')]=function(_0x2c7722){logger['info'](util[_0xd43f('0x25')](_0xd43f('0x11d'),_0x2c7722[_0xd43f('0xa5')]));return this['getdigits'](_0x2c7722);};AGIVertices[_0xd43f('0xe')][_0xd43f('0x11e')]=function(_0x287845){logger['info'](util[_0xd43f('0x25')](_0xd43f('0x11f'),_0x287845[_0xd43f('0xa5')]));this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x287845,_0x287845['goalname']);return this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x120'),_0x287845[_0xd43f('0x121')]));};AGIVertices[_0xd43f('0xe')]['awspolly']=function(_0x452dc0){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x122'),_0x452dc0[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x452dc0[_0xd43f('0x86')])||!this['isConfigured'](_0x452dc0[_0xd43f('0x87')])){return this['channel']['noop'](_0xd43f('0x123'));}if(!this[_0xd43f('0x83')](_0x452dc0[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x124'),_0x452dc0[_0xd43f('0x59')]));var _0x4acc9f=this[_0xd43f('0x85')][_0xd43f('0x6d')](this,_0x452dc0);if(_0x4acc9f){this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x4acc9f));var _0x559ad7=this[_0xd43f('0x33')][_0xd43f('0x125')](_0x4acc9f);try{fs[_0xd43f('0xfe')](_0x4acc9f+_0xd43f('0xff'));}catch(_0x5edccb){logger['error'](_0x5edccb);}return _0x559ad7;}return this[_0xd43f('0x33')]['error'](_0x452dc0,_0xd43f('0x126'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x127')]=function(_0x5d8547){logger[_0xd43f('0x2b')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5d8547[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x5d8547[_0xd43f('0x86')])||!this['isConfigured'](_0x5d8547['aws_secret_access_key'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x123'));}if(!this[_0xd43f('0x83')](_0x5d8547[_0xd43f('0x8c')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x128'));}if(!this['isConfigured'](_0x5d8547[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}this[_0xd43f('0x33')]['bot']=!![];this[_0xd43f('0x32')](_0x5d8547);this[_0xd43f('0x3f')](_0x5d8547[_0xd43f('0x59')],'in','','');this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x129'),_0x5d8547[_0xd43f('0x59')]));var _0x1623f3=this[_0xd43f('0x8b')]['sync'](this,_0x5d8547);if(_0x1623f3){for(var _0x53c9d3 in _0x1623f3){if(_0x1623f3[_0xd43f('0x92')](_0x53c9d3)&&_['isString'](_0x1623f3[_0x53c9d3])){this['channel'][_0xd43f('0x9b')](util['format'](_0xd43f('0x12a'),_0x53c9d3[_0xd43f('0x66')]()),_0x1623f3[_0x53c9d3]);}}if(_[_0xd43f('0x44')](_0x1623f3[_0xd43f('0x74')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x12b'));}else{this[_0xd43f('0x3f')](_0x1623f3[_0xd43f('0x74')],_0xd43f('0xf1'),_0xd43f('0x12c'),'');return this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x12d'),_0x1623f3[_0xd43f('0x74')]));}}return this['channel']['error'](_0x5d8547,_0xd43f('0x12e'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x12f')]=function(_0x38fa52){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x38fa52[_0xd43f('0xa5')],_0x38fa52[_0xd43f('0x63')]));if(!this['isConfigured'](_0x38fa52['key'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x130'));}var _0x515e60=_0xd43f('0x131');var _0x3132a2=util[_0xd43f('0x25')](_0xd43f('0x132'),FILES_PATH,rs[_0xd43f('0x11c')](0x4));var _0x592a62=util[_0xd43f('0x25')](_0xd43f('0x9a'),_0x3132a2,_0x515e60);var _0xdb7bde=!![];if(_0x38fa52['beep']===_0xd43f('0x133')){_0xdb7bde=![];}var _0xb5608e=this[_0xd43f('0x33')][_0xd43f('0x134')](_0x3132a2,_0x515e60,_0x38fa52[_0xd43f('0x135')],_0x38fa52[_0xd43f('0x63')],undefined,_0xdb7bde);if(_0xb5608e[_0xd43f('0xa0')]!==-0x1){this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x136'),_0x592a62));var _0x2de430=this[_0xd43f('0x8d')]['sync'](this,_0x38fa52,_0x592a62);if(_0x2de430){for(var _0x555a30 in _0x2de430){if(_0x2de430[_0xd43f('0x92')](_0x555a30)){this[_0xd43f('0x33')][_0xd43f('0x9b')](util[_0xd43f('0x25')](_0xd43f('0x137'),_0x555a30['toUpperCase']()),_0x2de430[_0x555a30]);}}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x138'),JSON[_0xd43f('0x70')](_0x2de430)));}}return _0xb5608e;};AGIVertices[_0xd43f('0xe')][_0xd43f('0x139')]=function(_0x2a7ba7){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x13a'),_0x2a7ba7[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x2a7ba7[_0xd43f('0x13b')])){return this[_0xd43f('0x33')]['noop'](_0xd43f('0x13c'));}if(!this[_0xd43f('0x83')](_0x2a7ba7[_0xd43f('0x13d')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x47d583=_0xd43f('0x131');var _0x18b433=util[_0xd43f('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xd43f('0x11c')](0x4));var _0x1fc456=util[_0xd43f('0x25')]('%s.%s',_0x18b433,_0x47d583);var _0xfa6eba=!![];if(_0x2a7ba7[_0xd43f('0x13e')]===_0xd43f('0x133')){_0xfa6eba=![];}var _0x2b2b93=this[_0xd43f('0x33')][_0xd43f('0x134')](_0x18b433,_0x47d583,_0x2a7ba7[_0xd43f('0x135')],_0x2a7ba7[_0xd43f('0x63')],undefined,_0xfa6eba);if(_0x2b2b93[_0xd43f('0xa0')]!==-0x1){this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x13f'),_0x1fc456));var _0x5b4310=this[_0xd43f('0x8f')][_0xd43f('0x6d')](this,_0x2a7ba7,_0x1fc456);if(_0x5b4310){for(var _0x22f638 in _0x5b4310){if(_0x5b4310['hasOwnProperty'](_0x22f638)){this[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0x140'),_0x22f638[_0xd43f('0x66')]()),_0x5b4310[_0x22f638]);}}return this[_0xd43f('0x33')]['noop'](util['format'](_0xd43f('0x141'),JSON[_0xd43f('0x70')](_0x5b4310)));}}return _0x2b2b93;};AGIVertices[_0xd43f('0xe')][_0xd43f('0x142')]=function(_0x303647){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x303647[_0xd43f('0xa5')]));return this[_0xd43f('0x33')]['continueAt'](_0x303647[_0xd43f('0x3a')],_0x303647[_0xd43f('0x3b')],_0x303647[_0xd43f('0x3c')]);};AGIVertices[_0xd43f('0xe')]['gotoif']=function(_0x1abff4){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x143'),_0x1abff4[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x1abff4['condition'])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x1abff4,_0xd43f('0x144'));}try{var _0x1f12b9=eval(_0x1abff4['condition'])?'true':_0xd43f('0x145');this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x146'),_0x1abff4[_0xd43f('0x147')],_0x1f12b9));return{'code':0xc8,'result':_0x1f12b9};}catch(_0x2bb8f6){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xd43f('0xe')][_0xd43f('0x148')]=function(_0x259cb7){logger['info'](util['format'](_0xd43f('0x149'),_0x259cb7[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x259cb7[_0xd43f('0x14a')])){return this['channel'][_0xd43f('0x2e')](_0x259cb7,_0xd43f('0x14b'));}var _0x49daff=this[_0xd43f('0x21')][_0xd43f('0x6d')](this,_0x259cb7[_0xd43f('0x14a')]);if(!_0x49daff){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x259cb7,'no\x20intervals\x20found');}for(var _0x1f8268=0x0;_0x1f8268<_0x49daff[_0xd43f('0x98')];_0x1f8268+=0x1){var _0xbce5e=this[_0xd43f('0x33')][_0xd43f('0xf')](util['format'](_0xd43f('0x14c'),_0x49daff[_0x1f8268]));if(_0xbce5e[_0xd43f('0xa0')]===-0x1){return _0xbce5e;}logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x14d'),_0x49daff[_0x1f8268],_0xbce5e[_0xd43f('0x9f')]));if(_0xbce5e[_0xd43f('0x9f')]===_0xd43f('0x14e')){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x14d'),_0x49daff[_0x1f8268],'true'));this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('IFTIME\x20%s\x20%s',_0x49daff[_0x1f8268],_0xd43f('0x14e')));return{'code':0xc8,'result':_0xd43f('0x14e')};}else{logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x14d'),_0x49daff[_0x1f8268],_0xd43f('0x145')));this[_0xd43f('0x33')]['noop'](util['format'](_0xd43f('0x14d'),_0x49daff[_0x1f8268],_0xd43f('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd43f('0xe')][_0xd43f('0x14f')]=function(_0x107908){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x150'),_0x107908[_0xd43f('0xa5')]));return this['channel'][_0xd43f('0x14f')]();};AGIVertices['prototype'][_0xd43f('0x151')]=function(_0x3e4069){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3e4069[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x3e4069[_0xd43f('0x77')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x3f0b08='wav';var _0x129171=util[_0xd43f('0x25')](_0xd43f('0x132'),FILES_PATH,rs[_0xd43f('0x11c')](0x4));var _0x2315e5=util[_0xd43f('0x25')]('%s.%s',_0x129171,_0x3f0b08);var _0x211364=!![];if(_0x3e4069['beep']===_0xd43f('0x133')){_0x211364=![];}var _0x469bc1=this[_0xd43f('0x33')]['recordFile'](_0x129171,_0x3f0b08,_0x3e4069['intKey'],_0x3e4069['timeout'],undefined,_0x211364);if(_0x469bc1[_0xd43f('0xa0')]!==-0x1){this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')]('ispeech\x20%s\x20file\x20created',_0x2315e5));var _0x369717=this[_0xd43f('0x152')]['sync'](this,_0x3e4069,_0x2315e5);if(_0x369717){for(var _0x173817 in _0x369717){if(_0x369717[_0xd43f('0x92')](_0x173817)){this[_0xd43f('0x33')][_0xd43f('0x9b')](util['format'](_0xd43f('0x153'),_0x173817[_0xd43f('0x66')]()),_0x369717[_0x173817]);}}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x154'),JSON[_0xd43f('0x70')](_0x369717)));}}return _0x469bc1;};AGIVertices[_0xd43f('0xe')][_0xd43f('0x155')]=function(_0x1ec235){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1ec235[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x1ec235[_0xd43f('0x77')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20key\x20configured');}if(!this[_0xd43f('0x83')](_0x1ec235[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x156'),_0x1ec235[_0xd43f('0x59')]));var _0x56e925=this[_0xd43f('0x7e')][_0xd43f('0x6d')](this,_0x1ec235);if(_0x56e925){this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x157'),_0x56e925));var _0x3ca6aa=this[_0xd43f('0x33')][_0xd43f('0x125')](_0x56e925,_0x1ec235[_0xd43f('0x135')]);try{fs[_0xd43f('0xfe')](_0x56e925+_0xd43f('0xff'));}catch(_0x593aec){logger[_0xd43f('0x2e')](_0x593aec);}return _0x3ca6aa;}return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x1ec235,_0xd43f('0x158'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x159')]=function(_0x4d796a){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15a'),_0x4d796a[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x4d796a[_0xd43f('0x15b')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x4d796a,'no\x20find\x20by\x20configured');}logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x15c'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x4d796a['findBy']));var _0x2cc938=this['agentLogin'][_0xd43f('0x6d')](this,_0x4d796a[_0xd43f('0x15b')]);if(_0x2cc938){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15d'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x4d796a['findBy']));this['channel'][_0xd43f('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xd43f('0x38')],_0x4d796a[_0xd43f('0x15b')]));return{'code':0xc8,'result':_0xd43f('0x15e')};}else{logger['info'](util[_0xd43f('0x25')](_0xd43f('0x15f'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x4d796a[_0xd43f('0x15b')]));this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd43f('0x33')]['callerid'],_0x4d796a[_0xd43f('0x15b')]));return{'code':0xc8,'result':_0xd43f('0x160')};}};AGIVertices[_0xd43f('0xe')][_0xd43f('0x161')]=function(_0xcb9333){logger['info'](util[_0xd43f('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xcb9333[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0xcb9333[_0xd43f('0x15b')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0xcb9333,_0xd43f('0x162'));}logger['info'](util[_0xd43f('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd43f('0x33')][_0xd43f('0x38')],_0xcb9333[_0xd43f('0x15b')]));var _0x5ae805=this[_0xd43f('0x51')][_0xd43f('0x6d')](this,_0xcb9333[_0xd43f('0x15b')]);if(_0x5ae805){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15d'),this['channel'][_0xd43f('0x38')],_0xcb9333[_0xd43f('0x15b')]));this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd43f('0x33')][_0xd43f('0x38')],_0xcb9333['findBy']));return{'code':0xc8,'result':_0xd43f('0x15e')};}else{logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x15f'),this[_0xd43f('0x33')]['callerid'],_0xcb9333['findBy']));this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x15f'),this['channel'][_0xd43f('0x38')],_0xcb9333[_0xd43f('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x30e1f0){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x30e1f0[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x30e1f0[_0xd43f('0x163')])){return this[_0xd43f('0x33')]['error'](_0x30e1f0,_0xd43f('0x164'));}this['channel'][_0xd43f('0xa6')](util[_0xd43f('0x25')]('math\x20%s',_0x30e1f0[_0xd43f('0x163')]));var _0x2040d8=eval(_0x30e1f0[_0xd43f('0x163')]);if(!this['isConfigured'](_0x30e1f0[_0xd43f('0xd6')])){return this[_0xd43f('0x33')]['noop'](_0xd43f('0xd7'));}var _0x84bf87=this[_0xd43f('0xf')][_0xd43f('0x6d')](this,_0x30e1f0[_0xd43f('0xd6')]);if(!_0x84bf87){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x30e1f0,'no\x20variable\x20found');}if(_['isArray'](_0x2040d8)){var _0x49906f=this;_0x2040d8['forEach'](function(_0x354f7a,_0x5ed86e){_0x49906f[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0x165'),_0x84bf87,_0x5ed86e),_0x354f7a);});return this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x166'),_0x84bf87));}else{return this[_0xd43f('0x33')][_0xd43f('0x9b')](_0x84bf87,_0x2040d8);}};AGIVertices['prototype'][_0xd43f('0x9')]=function(_0x3e6cab){logger[_0xd43f('0x2b')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x3e6cab[_0xd43f('0xa5')]));if(_0x3e6cab[_0xd43f('0xa3')]===0x0){return this[_0xd43f('0xa2')](_0x3e6cab);}_0x3e6cab[_0xd43f('0xa3')]-=0x1;if(!this[_0xd43f('0x83')](_0x3e6cab[_0xd43f('0x112')])){return this[_0xd43f('0x33')]['error'](_0x3e6cab,_0xd43f('0x167'));}var _0x34fa69=this[_0xd43f('0x111')]['sync'](this,_0x3e6cab[_0xd43f('0x112')]);if(!_0x34fa69){return this['channel'][_0xd43f('0x2e')](_0x3e6cab,'no\x20file\x20audio\x20found');}var _0x45d353=this['channel'][_0xd43f('0x114')](_0x34fa69,_0x3e6cab[_0xd43f('0x115')],_0x3e6cab[_0xd43f('0x168')]);var _0x4c6e88=_0x45d353[_0xd43f('0xa0')];if(_0x45d353['result']===-0x1){this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x3e6cab,'-1');return _0x45d353;}else if(_0x45d353[_0xd43f('0x9f')]===_0xd43f('0x63')){_0x45d353[_0xd43f('0xa0')]=_0x45d353[_0xd43f('0xa0')][_0xd43f('0x98')]>0x0?_0x45d353[_0xd43f('0xa0')]:'t';}else if(_[_0xd43f('0x41')](_0x45d353[_0xd43f('0xa0')])){_0x45d353[_0xd43f('0xa0')]='#';_0x4c6e88='#';}if(!this[_0xd43f('0x83')](_0x3e6cab[_0xd43f('0xd6')])){this[_0xd43f('0x33')][_0xd43f('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x51ccb2=this[_0xd43f('0xf')][_0xd43f('0x6d')](this,_0x3e6cab[_0xd43f('0xd6')]);if(!_0x51ccb2){return this[_0xd43f('0x33')]['error'](_0x3e6cab,_0xd43f('0xd8'));}this[_0xd43f('0x33')][_0xd43f('0x9b')](_0x51ccb2,_0x4c6e88);}this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x3e6cab,_0x4c6e88);return _0x45d353;};AGIVertices[_0xd43f('0xe')]['noop']=function(_0x2f8bf6){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x169'),_0x2f8bf6['label']));return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0x2f8bf6[_0xd43f('0x16a')]||_0x2f8bf6[_0xd43f('0xa5')]);};AGIVertices[_0xd43f('0xe')][_0xd43f('0x16b')]=function(_0x3dcf3f){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x16c'),_0x3dcf3f[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x3dcf3f['findBy'])){return this['channel'][_0xd43f('0x2e')](_0x3dcf3f,'no\x20find\x20by\x20configured');}logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd43f('0x33')][_0xd43f('0x38')],_0x3dcf3f['findBy']));var _0x3de5d8=this[_0xd43f('0x4c')][_0xd43f('0x6d')](this,_0x3dcf3f['pause_id']);var _0x44b496=this['agentPause']['sync'](this,_0x3dcf3f[_0xd43f('0x15b')],_0x3de5d8);if(_0x44b496){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15d'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x3dcf3f[_0xd43f('0x15b')]));this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd43f('0x33')]['callerid'],_0x3dcf3f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15f'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x3dcf3f[_0xd43f('0x15b')]));this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x15d'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x3dcf3f[_0xd43f('0x15b')]));return{'code':0xc8,'result':_0xd43f('0x160')};}};AGIVertices[_0xd43f('0xe')][_0xd43f('0x16d')]=function(_0x7ee834){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x16e'),_0x7ee834[_0xd43f('0xa5')]));if(!this['isConfigured'](_0x7ee834[_0xd43f('0x112')])){return this['channel'][_0xd43f('0x2e')](_0x7ee834,_0xd43f('0x167'));}var _0x3a8b69=this[_0xd43f('0x111')][_0xd43f('0x6d')](this,_0x7ee834[_0xd43f('0x112')]);if(!_0x3a8b69){return this[_0xd43f('0x33')]['error'](_0x7ee834,_0xd43f('0x113'));}var _0x36d07e=this[_0xd43f('0x33')]['exec'](_0xd43f('0x16f'),[_0x3a8b69,_0x7ee834[_0xd43f('0x10c')]]);if(_0x36d07e['result']===-0x1){return _0x36d07e;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xc2'),'PLAYBACK',_0x3a8b69));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x170')]=function(_0x3a7914){logger['info'](util[_0xd43f('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x3a7914[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x3a7914[_0xd43f('0x171')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x3a7914,_0xd43f('0x172'));}var _0x262f48='';var _0x497236=parseInt(_0x3a7914[_0xd43f('0x171')],0xa);if(isNaN(_0x497236)){_0x262f48=_0x3a7914[_0xd43f('0x171')];}else{_0x262f48=this['getVoiceQueue'][_0xd43f('0x6d')](this,_0x3a7914[_0xd43f('0x171')]);if(!_0x262f48){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x3a7914,_0xd43f('0x173'));}}var _0x2e9331='';if(this['isConfigured'](_0x3a7914['file_id'])){var _0x3af747=this[_0xd43f('0x111')][_0xd43f('0x6d')](this,_0x3a7914[_0xd43f('0x112')]);if(_0x3af747){_0x2e9331=_0x3af747;}}this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x3a7914,_0x262f48);if(_0x3a7914[_0xd43f('0x10c')]['indexOf']('x')<0x0){_0x3a7914[_0xd43f('0x10c')]+='x';}if(_0x3a7914[_0xd43f('0x10c')]['indexOf']('X')<0x0){_0x3a7914['opts']+='X';}this['channel'][_0xd43f('0x9b')](_0xd43f('0x174'),_0x262f48?_0x262f48[_0xd43f('0x175')]():'');var _0x338142=this[_0xd43f('0x33')]['exec']('QUEUE',[_0x262f48,_0x3a7914['opts'],_0x3a7914[_0xd43f('0x61')],_0x2e9331,_0x3a7914['timeout'],_0x3a7914[_0xd43f('0x4')],_0x3a7914['macro'],_0x3a7914[_0xd43f('0x176')],'',_0x3a7914[_0xd43f('0x177')]]);if(_0x338142[_0xd43f('0xa0')]===-0x1){return _0x338142;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('Executed\x20command\x20%s\x20%s',_0xd43f('0x178'),_0x262f48));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x179')]=function(_0x19b003){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x19b003[_0xd43f('0xa5')]));var _0x3650ff=_0x19b003[_0xd43f('0x17a')]||_0xd43f('0x131');var _0x1217a1=util[_0xd43f('0x25')](_0xd43f('0x17b'),this['channel'][_0xd43f('0x34')],rs[_0xd43f('0x11c')](0x5));var _0x1cc1cf=util['format'](_0xd43f('0x17c'),FILES_PATH,_0x1217a1,_0x3650ff);var _0xf7e325=util['format'](_0xd43f('0x132'),FILES_PATH,_0x1217a1);this['createSquareRecording'][_0xd43f('0x6d')](this,_0x19b003,_0x1217a1,_0x1cc1cf);this[_0xd43f('0x33')][_0xd43f('0x9b')]('RECORDING_SAVENAME',_0x1217a1);logger[_0xd43f('0x2b')](_0xd43f('0x17d'),_0xf7e325,_0x3650ff,_0x19b003[_0xd43f('0x17e')],_0x19b003[_0xd43f('0x63')]);return this[_0xd43f('0x33')]['recordFile'](_0xf7e325,_0x3650ff,_0x19b003['escape_digits'],_0x19b003[_0xd43f('0x63')],undefined,!![]);};AGIVertices[_0xd43f('0xe')]['restapi']=function(_0x188e43){logger['info'](util['format'](_0xd43f('0x17f'),_0x188e43['label']));if(!this[_0xd43f('0x83')](_0x188e43['url'])){return this['channel'][_0xd43f('0xa6')](_0xd43f('0x180'));}var _0x5dbd43=this[_0xd43f('0x60')][_0xd43f('0x6d')](this,_0x188e43);logger['info'](util['format'](_0xd43f('0x181'),util[_0xd43f('0x182')](_0x5dbd43,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x188e43[_0xd43f('0xd6')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x183'));}var _0x30e1a8=this[_0xd43f('0xf')]['sync'](this,_0x188e43['variable_id']);if(!_0x30e1a8){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x188e43,_0xd43f('0xd8'));}this[_0xd43f('0x33')]['setVariable'](util[_0xd43f('0x25')](_0xd43f('0x184'),_0x30e1a8),_0x5dbd43[_0xd43f('0x72')]?_0x5dbd43[_0xd43f('0x72')]:'200');this[_0xd43f('0x33')][_0xd43f('0x9b')](util['format']('%s_STATUS_MESSAGE',_0x30e1a8),_0x5dbd43[_0xd43f('0x73')]?_0x5dbd43['statusMessage']:'OK');if(_0x5dbd43[_0xd43f('0x67')]){try{this[_0xd43f('0x99')](_0x5dbd43[_0xd43f('0x67')],_0x30e1a8);}catch(_0x2ef44d){logger[_0xd43f('0x2e')](util[_0xd43f('0x25')](_0xd43f('0x185'),_0x30e1a8));}}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('variable\x20%s\x20set',_0x30e1a8));};AGIVertices['prototype'][_0xd43f('0x186')]=function(_0x18efd7){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x18efd7[_0xd43f('0xa5')]));return this[_0xd43f('0x33')][_0xd43f('0x187')](_0x18efd7[_0xd43f('0x188')][_0xd43f('0x189')](/\s+/g,''),_0x18efd7[_0xd43f('0x17e')]);};AGIVertices[_0xd43f('0xe')]['saynumber']=function(_0xb0493f){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x18a'),_0xb0493f[_0xd43f('0xa5')]));return this['channel'][_0xd43f('0x18b')](_0xb0493f[_0xd43f('0x18c')][_0xd43f('0x189')](/\s+/g,''),_0xb0493f[_0xd43f('0x17e')]);};AGIVertices[_0xd43f('0xe')][_0xd43f('0x18d')]=function(_0x46f480){logger['info'](util[_0xd43f('0x25')](_0xd43f('0x18e'),_0x46f480['label']));return this[_0xd43f('0x33')][_0xd43f('0x18f')](_0x46f480[_0xd43f('0x59')],_0x46f480[_0xd43f('0x17e')]);};AGIVertices[_0xd43f('0xe')][_0xd43f('0x190')]=function(_0x2b35e1){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x191'),_0x2b35e1[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x2b35e1[_0xd43f('0x192')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x193'));}var _0x250886=this[_0xd43f('0x194')][_0xd43f('0x6d')](this,_0x2b35e1[_0xd43f('0x192')]);if(!_0x250886||!_0x250886[_0xd43f('0x195')]){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x2b35e1,_0xd43f('0x196'));}var _0x2d054e={'from':util[_0xd43f('0x25')]('\x22%s\x22\x20<%s>',_0x250886[_0xd43f('0x12')],_0x250886['email']||_0x250886[_0xd43f('0x195')]['user']),'to':_0x2b35e1['to']||'','cc':_0x2b35e1['cc']||'','bcc':_0x2b35e1[_0xd43f('0x197')]||'','subject':_0x2b35e1['subject'],'html':_0x2b35e1[_0xd43f('0x59')],'text':_0x2b35e1['text']};if(this[_0xd43f('0x83')](_0x2b35e1[_0xd43f('0x198')])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x2d054e));this['createSquareDetailsReport'][_0xd43f('0x6d')](this,_0x2b35e1,_0x2b35e1[_0xd43f('0x192')]);this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x250886['name']));this[_0xd43f('0x20')][_0xd43f('0x6d')](this,_0x250886['smtpOptions'],_0x2d054e);return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x199'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x19a')]=function(_0xff334a){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x19b'),_0xff334a[_0xd43f('0xa5')]));return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x19c'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x19d')]=function(_0x23babc){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x19e'),_0x23babc[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x23babc[_0xd43f('0x19f')])){return this[_0xd43f('0x33')]['noop']('no\x20sms\x20account\x20configured');}var _0x4a6be3=this[_0xd43f('0x2f')][_0xd43f('0x6d')](this,_0x23babc[_0xd43f('0x19f')]);if(!_0x4a6be3){return this['channel'][_0xd43f('0x2e')](_0x23babc,'no\x20sms\x20account\x20found');}var _0x3046fc={'body':_0x23babc[_0xd43f('0x1a0')],'phone':_0x23babc['to']||'','SmsAccountId':_0x4a6be3['id']};logger[_0xd43f('0xdf')]('sendSMS\x20message',JSON[_0xd43f('0x70')](_0x3046fc));this[_0xd43f('0x32')][_0xd43f('0x6d')](this,_0x23babc,_0x23babc[_0xd43f('0x19f')]);this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x1a1'),_0x4a6be3[_0xd43f('0x12')]));this['createSmsMessage'][_0xd43f('0x6d')](this,_0x3046fc);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd43f('0xe')]['set']=function(_0x52bc25){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x1a2'),_0x52bc25[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x52bc25[_0xd43f('0xd6')])){return this['channel'][_0xd43f('0x2e')](_0x52bc25,'no\x20variable\x20selected');}var _0x2acd5f=this['getVariable'][_0xd43f('0x6d')](this,_0x52bc25['variable_id']);if(!_0x2acd5f){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x52bc25,'no\x20variable\x20found');}return this['channel'][_0xd43f('0x9b')](_0x2acd5f,_0x52bc25[_0xd43f('0x1a3')]);};AGIVertices['prototype'][_0xd43f('0x1a4')]=function(_0x2ca2e3){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x1a5'),_0x2ca2e3['label']));this['channel'][_0xd43f('0xa6')](_0xd43f('0x1a6'));var _0x2ae059=this[_0xd43f('0x33')][_0xd43f('0xf')]('XMCS-UNIQUEID');if(!_[_0xd43f('0x41')](_0x2ae059['extra'])){this[_0xd43f('0x33')]['uniqueid']=_0x2ae059[_0xd43f('0x9f')];}if(_0x2ca2e3[_0xd43f('0xba')]===_0xd43f('0x1a7')){this[_0xd43f('0x33')][_0xd43f('0xa6')]('Answer');return this[_0xd43f('0x33')][_0xd43f('0xba')]();}return this[_0xd43f('0x33')]['noop'](_0xd43f('0x1a8'));};AGIVertices['prototype'][_0xd43f('0x1a9')]=function(_0x17e65a){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x1aa'),_0x17e65a['label']));if(!this[_0xd43f('0x83')](_0x17e65a[_0xd43f('0x1ab')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x17e65a,'no\x20subproject\x20selected');}var _0x38e1f2=this['getSquareProject'][_0xd43f('0x6d')](this,_0x17e65a[_0xd43f('0x1ab')]);if(!this[_0xd43f('0x83')](_0x38e1f2)){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x17e65a,util[_0xd43f('0x25')](_0xd43f('0x1ac'),_0x17e65a[_0xd43f('0x1ab')]));}if(_0x38e1f2===this[_0xd43f('0x33')][_0xd43f('0x36')]){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x17e65a,_0xd43f('0x1ad'));}this['createSquareDetailsReport']['sync'](this,_0x17e65a,_0x38e1f2);var _0x56c773=this[_0xd43f('0x33')][_0xd43f('0x56')](_0xd43f('0x1ae'),util['format'](_0xd43f('0x1af'),config[_0xd43f('0x4')][_0xd43f('0x1b0')]||_0xd43f('0x1b1'),_0x38e1f2,this[_0xd43f('0x33')][_0xd43f('0x36')]));if(_0x56c773['result']===-0x1){return _0x56c773;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xc2'),_0xd43f('0x1ae'),_0x38e1f2));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x1b2')]=function(_0x13671f){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x1b3'),_0x13671f[_0xd43f('0xa5')]));var _0x55ca3f=this[_0xd43f('0x55')][_0xd43f('0x6d')](this,_0x13671f[_0xd43f('0xb6')]);this[_0xd43f('0x32')]['sync'](this,_0x13671f,_0x13671f[_0xd43f('0xb6')]);if(this['isConfigured'](_0x13671f['variable_id'])){var _0x13b47f=this[_0xd43f('0xf')][_0xd43f('0x6d')](this,_0x13671f['variable_id']);if(_0x13b47f){this[_0xd43f('0x33')][_0xd43f('0x9b')](_0x13b47f,_0x55ca3f);return this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x1b4'),_0x13671f[_0xd43f('0xb6')],_0x13b47f));}}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x1b5'),_0x13671f['command']));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x1b6')]=function(_0x2a04f8){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x1b7'),_0x2a04f8[_0xd43f('0xa5')]));_0x2a04f8['text']=_0x2a04f8[_0xd43f('0x59')][_0xd43f('0x189')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2a04f8['apiKey'])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0x1b8'));}if(!this[_0xd43f('0x83')](_0x2a04f8[_0xd43f('0x59')])){return this['channel']['noop'](_0xd43f('0xa7'));}this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x1b9'),_0x2a04f8[_0xd43f('0x59')]));var _0x5739ce=this['googleCloudTTS'][_0xd43f('0x6d')](this,_0x2a04f8);if(_0x5739ce){this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x1ba'),_0x5739ce));var _0x25463a=this['channel'][_0xd43f('0x125')](_0x5739ce);try{fs[_0xd43f('0xfe')](_0x5739ce+'.wav');}catch(_0x2d6730){logger[_0xd43f('0x2e')](_0x2d6730);}return _0x25463a;}return this['channel']['error'](_0x2a04f8,_0xd43f('0x1bb'));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x1bc')]=function(_0x16dbf2){logger[_0xd43f('0x2b')](util['format'](_0xd43f('0x1bd'),_0x16dbf2[_0xd43f('0xa5')]));_0x16dbf2[_0xd43f('0x59')]=_0x16dbf2['text'][_0xd43f('0x189')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd43f('0x83')](_0x16dbf2[_0xd43f('0x59')])){return this[_0xd43f('0x33')][_0xd43f('0xa6')](_0xd43f('0xa7'));}this['channel'][_0xd43f('0xa6')](util['format'](_0xd43f('0x1be'),_0x16dbf2[_0xd43f('0x59')]));var _0x1217d7=this['googleTTS']['sync'](this,_0x16dbf2);if(_0x1217d7){this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0x1bf'),_0x1217d7));var _0x23ec35=this[_0xd43f('0x33')][_0xd43f('0x125')](_0x1217d7);try{fs['unlink'](_0x1217d7+'.wav');}catch(_0x367532){logger[_0xd43f('0x2e')](_0x367532);}return _0x23ec35;}return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x16dbf2,_0xd43f('0x1c0'));};AGIVertices['prototype'][_0xd43f('0x1c1')]=function(_0x1f7b25){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1f7b25[_0xd43f('0xa5')]));if(!this[_0xd43f('0x83')](_0x1f7b25[_0xd43f('0x15b')])){return this[_0xd43f('0x33')][_0xd43f('0x2e')](_0x1f7b25,_0xd43f('0x162'));}logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15c'),this['channel'][_0xd43f('0x38')],_0x1f7b25[_0xd43f('0x15b')]));var _0x3d4680=this[_0xd43f('0x50')]['sync'](this,_0x1f7b25[_0xd43f('0x15b')]);if(_0x3d4680){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15d'),this[_0xd43f('0x33')][_0xd43f('0x38')],_0x1f7b25['findBy']));this[_0xd43f('0x33')]['noop'](util[_0xd43f('0x25')](_0xd43f('0x15d'),this[_0xd43f('0x33')]['callerid'],_0x1f7b25[_0xd43f('0x15b')]));return{'code':0xc8,'result':_0xd43f('0x15e')};}else{logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x15f'),this['channel'][_0xd43f('0x38')],_0x1f7b25[_0xd43f('0x15b')]));this[_0xd43f('0x33')][_0xd43f('0xa6')](util['format'](_0xd43f('0x15f'),this['channel'][_0xd43f('0x38')],_0x1f7b25[_0xd43f('0x15b')]));return{'code':0xc8,'result':_0xd43f('0x160')};}};AGIVertices['prototype'][_0xd43f('0x1c2')]=function(_0x3fd2e1){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x1c3'),_0x3fd2e1['label']));var _0x42d941=this['channel'][_0xd43f('0x56')](_0xd43f('0x1c4'),[_0x3fd2e1[_0xd43f('0x1c5')],_0x3fd2e1[_0xd43f('0x75')]]);if(_0x42d941[_0xd43f('0xa0')]===-0x1){return _0x42d941;}return this[_0xd43f('0x33')][_0xd43f('0xa6')](util[_0xd43f('0x25')](_0xd43f('0xc2'),_0xd43f('0x1c4'),_0x3fd2e1[_0xd43f('0x1c5')]));};AGIVertices[_0xd43f('0xe')][_0xd43f('0x1c6')]=function(_0xe6d4d3){logger[_0xd43f('0x2b')](util[_0xd43f('0x25')](_0xd43f('0x1c7'),_0xe6d4d3[_0xd43f('0xa5')]));if(!this['isConfigured'](_0xe6d4d3[_0xd43f('0xd6')])){return this['channel']['error'](_0xe6d4d3,_0xd43f('0x1c8'));}var _0x54ddf4=this['getVariable']['sync'](this,_0xe6d4d3[_0xd43f('0xd6')]);if(!_0x54ddf4){return this['channel'][_0xd43f('0x2e')](_0xe6d4d3,'no\x20variable\x20found');}var _0x27741f=this[_0xd43f('0x33')][_0xd43f('0xf')](_0x54ddf4);return{'code':0xc8,'result':_0x27741f[_0xd43f('0x9f')]?_0x27741f[_0xd43f('0x9f')]:'-'};};String['prototype']['replaceAll']=function(_0x1fb1cc,_0x35e86f){return this[_0xd43f('0x9d')](_0x1fb1cc)[_0xd43f('0x1c9')](_0x35e86f);};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 0fa01ee..ba473b6 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 _0x82a6=['syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','updateAcw','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer'];(function(_0x5727a6,_0x57a97f){var _0x3ca94f=function(_0x3438ec){while(--_0x3438ec){_0x5727a6['push'](_0x5727a6['shift']());}};_0x3ca94f(++_0x57a97f);}(_0x82a6,0x19e));var _0x682a=function(_0x1c3e98,_0x489c1c){_0x1c3e98=_0x1c3e98-0x0;var _0x46f20e=_0x82a6[_0x1c3e98];return _0x46f20e;};'use strict';var _=require(_0x682a('0x0'));var moment=require(_0x682a('0x1'));var ami=require(_0x682a('0x2'));var logger=require(_0x682a('0x3'))(_0x682a('0x4'));var RpcUser=require(_0x682a('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x547e68){this[_0x682a('0x6')]=_0x547e68[_0x682a('0x6')];this['agents']=_0x547e68[_0x682a('0x7')];this[_0x682a('0x8')]=_0x547e68['timers'];this[_0x682a('0x9')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x682a('0xa'),this[_0x682a('0xb')][_0x682a('0xc')](this));ami['on'](_0x682a('0xd'),this[_0x682a('0xe')]['bind'](this));ami['on'](_0x682a('0xf'),this[_0x682a('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0x682a('0x11')][_0x682a('0xc')](this));ami['on'](_0x682a('0x12'),this[_0x682a('0x13')][_0x682a('0xc')](this));ami['on'](_0x682a('0x14'),this[_0x682a('0x15')][_0x682a('0xc')](this));}function getDiff(_0x5d95ec){var _0x41cf35=moment()[_0x682a('0x16')](0x0);var _0x52e490=moment(_0x5d95ec)[_0x682a('0x16')](0x0);return _0x41cf35[_0x682a('0x17')](_0x52e490,'seconds');}Acw[_0x682a('0x18')]['updateAcw']=function(_0x298cf1,_0xe3ff70){var _0x2e1ac7=this;var _0x4f1f48=getDiff(_0x2e1ac7[_0x682a('0x8')][_0x298cf1][_0x682a('0x19')]);clearTimeout(_0x2e1ac7[_0x682a('0x8')][_0x298cf1][_0x682a('0x1a')]);_0x2e1ac7[_0x682a('0x8')][_0x298cf1][_0x682a('0x1a')]=![];return RpcVoiceAgentReport[_0x682a('0x1b')]({'acwtime':_0x4f1f48},_0x2e1ac7[_0x682a('0x8')][_0x298cf1][_0x682a('0x1c')],_0x298cf1)['then'](function(_0x6a112a){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0xe3ff70,_0x4f1f48,_0x6a112a);})[_0x682a('0x1d')](function(_0x553b55){logger[_0x682a('0x1e')](_0x682a('0x1f'),_0xe3ff70,_0x553b55);})[_0x682a('0x20')](function(){delete _0x2e1ac7['timers'][_0x298cf1];});};Acw[_0x682a('0x18')][_0x682a('0x21')]=function(_0x1835aa){try{var _0x4bf4b5=this;var _0x212ef4=this['channels'][_0x1835aa]['interface'];var _0xe59653=this[_0x682a('0x9')][_0x1835aa][_0x682a('0x22')];var _0x2a0ffa=this[_0x682a('0x6')][_0xe59653];var _0x1012a3=![];var _0x3dd62a=_0x682a('0x23');if(_0x2a0ffa[_0x682a('0x24')]&&_0x2a0ffa['mandatoryDispositionPause'][_0x682a('0x25')]){_0x1012a3=!![];_0x3dd62a=_0x2a0ffa[_0x682a('0x26')][_0x682a('0x25')];}return ami[_0x682a('0x27')]({'action':'QueuePause','interface':_0x212ef4,'paused':!![],'reason':_0x3dd62a})[_0x682a('0x28')](function(){if(_0x4bf4b5['agents'][_0x212ef4]){return RpcUser[_0x682a('0x29')](_0x4bf4b5[_0x682a('0x7')][_0x212ef4]['id'])[_0x682a('0x28')](function(_0xc4e15e){if(!_0xc4e15e||_0xc4e15e[_0x682a('0x2a')]){logger[_0x682a('0x2b')](_0x682a('0x2c'),_0x1835aa,_0x212ef4,_0xe59653);return;}logger[_0x682a('0x2b')](_0x682a('0x2d'),_0x1835aa,_0x212ef4,_0xe59653);var _0x59dcf6=_0x4bf4b5[_0x682a('0x9')][_0x1835aa][_0x682a('0x2e')]&&_0x4bf4b5[_0x682a('0x9')][_0x1835aa][_0x682a('0x2f')]?_0x4bf4b5['channels'][_0x1835aa][_0x682a('0x2f')]:_0x1835aa;return RpcUser[_0x682a('0x30')](_0x4bf4b5[_0x682a('0x7')][_0x212ef4],_0x3dd62a,_0x59dcf6)[_0x682a('0x28')](function(_0x19e95e){_0x4bf4b5[_0x682a('0x6')][_0xe59653][_0x682a('0x31')]-=0x1;_0x4bf4b5[_0x682a('0x6')][_0xe59653][_0x682a('0x32')]+=0x1;return _0x19e95e;});})['then'](function(_0x1647b6){if(_0x1012a3||!_0x1647b6){return;}_0x4bf4b5['timers'][_0x212ef4]={};logger[_0x682a('0x2b')](_0x682a('0x33'),_0x1835aa,_0x4bf4b5[_0x682a('0x6')][_0xe59653][_0x682a('0x34')],_0x212ef4,_0xe59653);_0x4bf4b5[_0x682a('0x8')][_0x212ef4]['timer']=setTimeout(_0x4bf4b5['stopAcw'][_0x682a('0xc')](_0x4bf4b5,_0x212ef4),_0x4bf4b5[_0x682a('0x6')][_0xe59653][_0x682a('0x34')]*0x3e8);_0x4bf4b5['timers'][_0x212ef4]['lastPauseAt']=moment()[_0x682a('0x35')]('YYYY-MM-DD\x20HH:mm:ss');_0x4bf4b5[_0x682a('0x8')][_0x212ef4]['uniqueid']=_0x1835aa;_0x4bf4b5[_0x682a('0x8')][_0x212ef4][_0x682a('0x22')]=_0xe59653;_0x4bf4b5[_0x682a('0x8')][_0x212ef4][_0x682a('0x36')]=_0x4bf4b5[_0x682a('0x36')]['bind'](_0x4bf4b5,_0x212ef4,_0x1835aa);});}})[_0x682a('0x1d')](function(){logger[_0x682a('0x1e')](_0x682a('0x33'),_0x1835aa,_0x4bf4b5[_0x682a('0x6')][_0xe59653][_0x682a('0x34')],_0x212ef4,_0xe59653);})[_0x682a('0x20')](function(){delete _0x4bf4b5[_0x682a('0x9')][_0x1835aa];});}catch(_0x59cdef){logger[_0x682a('0x1e')](_0x682a('0x37'),_0x59cdef[_0x682a('0x38')]);}};Acw['prototype'][_0x682a('0x39')]=function(_0x43eaf7){try{var _0x4cf4f7=this;if(_0x4cf4f7['timers'][_0x43eaf7]){_0x4cf4f7[_0x682a('0x8')][_0x43eaf7][_0x682a('0x1a')]=![];var _0x56c384=_0x4cf4f7[_0x682a('0x8')][_0x43eaf7][_0x682a('0x1c')];var _0x642089=_0x4cf4f7[_0x682a('0x8')][_0x43eaf7][_0x682a('0x22')];var _0x8b1029=_0x4cf4f7['voiceQueues'][_0x642089][_0x682a('0x34')];logger[_0x682a('0x2b')](_0x682a('0x3a'),_0x56c384,_0x43eaf7);RpcUser[_0x682a('0x29')](this[_0x682a('0x7')][_0x43eaf7]['id'])[_0x682a('0x28')](function(_0x38fd30){if(_0x38fd30[_0x682a('0x3b')]===_0x682a('0x23')){return RpcUser[_0x682a('0x3c')](_0x4cf4f7[_0x682a('0x7')][_0x43eaf7]);}});RpcVoiceAgentReport[_0x682a('0x1b')]({'acwtime':_0x8b1029,'agentacw':!![]},_0x56c384,_0x43eaf7)[_0x682a('0x28')](function(_0xa99b2){logger[_0x682a('0x2b')](_0x682a('0x3d'),_0x56c384,_0x8b1029,_0xa99b2);})[_0x682a('0x1d')](function(_0x43e9bf){logger[_0x682a('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x56c384,_0x43e9bf);});}else{logger[_0x682a('0x1e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x43eaf7);if(_0x4cf4f7[_0x682a('0x8')]){logger['info'](_0x682a('0x3e'),JSON[_0x682a('0x3f')](_0x4cf4f7['timers']));}}}catch(_0x47b4b2){logger[_0x682a('0x1e')](_0x682a('0x40'),_0x47b4b2[_0x682a('0x38')]);}};Acw[_0x682a('0x18')][_0x682a('0x41')]=function(_0x54f683){try{if(this[_0x682a('0x6')][_0x54f683[_0x682a('0x22')]]&&(this[_0x682a('0x6')][_0x54f683[_0x682a('0x22')]]['acw']||this['voiceQueues'][_0x54f683[_0x682a('0x22')]][_0x682a('0x24')])){if(this['agents'][_0x54f683[_0x682a('0x42')]]){this[_0x682a('0x9')][_0x54f683[_0x682a('0x1c')]]={'queue':_0x54f683[_0x682a('0x22')],'interface':_0x54f683['interface'],'destlinkedid':_0x54f683[_0x682a('0x2f')]};}}}catch(_0x385597){logger[_0x682a('0x1e')](_0x682a('0x43'),_0x385597[_0x682a('0x38')]);}};Acw[_0x682a('0x18')][_0x682a('0x15')]=function(_0x4475fe){try{if(this[_0x682a('0x6')][_0x4475fe[_0x682a('0x22')]]&&(this[_0x682a('0x6')][_0x4475fe[_0x682a('0x22')]][_0x682a('0x4')]||this[_0x682a('0x6')][_0x4475fe['queue']][_0x682a('0x24')])){if(this[_0x682a('0x7')][_0x4475fe[_0x682a('0x42')]]){this['channels'][_0x4475fe['uniqueid']]={'queue':_0x4475fe[_0x682a('0x22')],'interface':_0x4475fe[_0x682a('0x42')]};}}}catch(_0x5dbf1d){logger[_0x682a('0x1e')](_0x682a('0x44'),_0x5dbf1d[_0x682a('0x38')]);}};Acw[_0x682a('0x18')][_0x682a('0xb')]=function(_0x394a89){try{if(this[_0x682a('0x9')][_0x394a89[_0x682a('0x1c')]]&&_[_0x682a('0x45')](this[_0x682a('0x9')][_0x394a89[_0x682a('0x1c')]][_0x682a('0x2e')])){logger[_0x682a('0x2b')](_0x682a('0x46'),_0x394a89[_0x682a('0x1c')]);this[_0x682a('0x21')](_0x394a89['uniqueid']);}else if(this['channels'][_0x394a89['linkedid']]&&_[_0x682a('0x45')](this[_0x682a('0x9')][_0x394a89['linkedid']][_0x682a('0x2e')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x394a89[_0x682a('0x47')]);this[_0x682a('0x21')](_0x394a89['linkedid']);}}catch(_0x1f4df5){logger['error'](_0x682a('0x48'),_0x1f4df5['message']);}};Acw[_0x682a('0x18')][_0x682a('0xe')]=function(_0x22f914){try{if(this['channels'][_0x22f914['uniqueid']]&&this[_0x682a('0x9')][_0x22f914[_0x682a('0x1c')]][_0x682a('0x2e')]){logger[_0x682a('0x2b')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x22f914[_0x682a('0x1c')]);this['startAcw'](_0x22f914[_0x682a('0x1c')]);}else if(this[_0x682a('0x9')][_0x22f914[_0x682a('0x47')]]&&this[_0x682a('0x9')][_0x22f914[_0x682a('0x47')]]['attended']){logger[_0x682a('0x2b')](_0x682a('0x49'),_0x22f914[_0x682a('0x47')]);this['startAcw'](_0x22f914[_0x682a('0x47')]);}}catch(_0x1e0c6){logger[_0x682a('0x1e')](_0x682a('0x4a'),_0x1e0c6[_0x682a('0x38')]);}};Acw[_0x682a('0x18')][_0x682a('0x11')]=function(_0x2c56e4){try{if(!_['isNil'](this[_0x682a('0x9')][_0x2c56e4['transfereeuniqueid']])){this[_0x682a('0x21')](_0x2c56e4[_0x682a('0x4b')]);if(this[_0x682a('0x9')][_0x2c56e4['secondtransfereruniqueid']]){this[_0x682a('0x9')][_0x2c56e4['secondtransfereruniqueid']]['attended']=!![];this[_0x682a('0x9')][_0x2c56e4[_0x682a('0x4c')]]=this['channels'][_0x2c56e4['secondtransfereruniqueid']];delete this[_0x682a('0x9')][_0x2c56e4['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x682a('0x9')][_0x2c56e4['transfertargetuniqueid']])){this[_0x682a('0x21')](_0x2c56e4[_0x682a('0x4c')]);if(this[_0x682a('0x9')][_0x2c56e4[_0x682a('0x4d')]]){this[_0x682a('0x9')][_0x2c56e4['origtransfereruniqueid']][_0x682a('0x2e')]=!![];this[_0x682a('0x9')][_0x2c56e4[_0x682a('0x4b')]]=this['channels'][_0x2c56e4[_0x682a('0x4d')]];delete this[_0x682a('0x9')][_0x2c56e4['origtransfereruniqueid']];}}}catch(_0x35ef5e){logger[_0x682a('0x1e')](_0x682a('0x4e'),_0x35ef5e['message']);}};Acw[_0x682a('0x18')]['syncBlindTransfer']=function(_0x1f63a2){try{if(this[_0x682a('0x9')][_0x1f63a2[_0x682a('0x4f')]]){logger[_0x682a('0x2b')](_0x682a('0x50'),JSON[_0x682a('0x3f')](_0x1f63a2[_0x682a('0x4f')]));this['startAcw'](_0x1f63a2[_0x682a('0x4f')]);}else if(this[_0x682a('0x9')][_0x1f63a2['transfererlinkedid']]){logger[_0x682a('0x2b')](_0x682a('0x51'),JSON[_0x682a('0x3f')](_0x1f63a2['transfererlinkedid']));this[_0x682a('0x21')](_0x1f63a2['transfererlinkedid']);}}catch(_0x61d8ed){logger['error'](_0x682a('0x52'),_0x61d8ed['message']);}};Acw[_0x682a('0x18')]['syncAgentRingNoAnswer']=function(_0x1daf43){try{if(this[_0x682a('0x6')][_0x1daf43[_0x682a('0x22')]]&&this['voiceQueues'][_0x1daf43[_0x682a('0x22')]]['autopause']==='all'){if(this[_0x682a('0x7')][_0x1daf43[_0x682a('0x42')]]){logger[_0x682a('0x2b')](_0x682a('0x53'),_0x1daf43['uniqueid'],_0x1daf43['interface'],_0x1daf43['queue']);return RpcUser[_0x682a('0x30')](this[_0x682a('0x7')][_0x1daf43['interface']],_0x682a('0x54'),_0x1daf43[_0x682a('0x1c')]);}}}catch(_0x3104c8){logger[_0x682a('0x1e')](_0x682a('0x55'),_0x3104c8[_0x682a('0x38')]);}};module['exports']=Acw; \ No newline at end of file +var _0xa1bf=['acwTimeout','[ACW][START]\x20%s','pauseType','saveUnpause','[ACW][TIMERS]','stringify','message','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDispositionPause','name','QueuePause','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','stopAcw','format','uniqueid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]'];(function(_0x444a8f,_0x362fea){var _0x2a5079=function(_0x3ddbd2){while(--_0x3ddbd2){_0x444a8f['push'](_0x444a8f['shift']());}};_0x2a5079(++_0x362fea);}(_0xa1bf,0x1c9));var _0xfa1b=function(_0x4caa51,_0x46800d){_0x4caa51=_0x4caa51-0x0;var _0x140064=_0xa1bf[_0x4caa51];return _0x140064;};'use strict';var _=require('lodash');var moment=require(_0xfa1b('0x0'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xfa1b('0x1'));var RpcUser=require(_0xfa1b('0x2'));var RpcVoiceAgentReport=require(_0xfa1b('0x3'));function Acw(_0x4ef1de){this[_0xfa1b('0x4')]=_0x4ef1de[_0xfa1b('0x4')];this[_0xfa1b('0x5')]=_0x4ef1de[_0xfa1b('0x5')];this[_0xfa1b('0x6')]=_0x4ef1de[_0xfa1b('0x6')];this[_0xfa1b('0x7')]={};ami['on']('agentconnect',this[_0xfa1b('0x8')]['bind'](this));ami['on'](_0xfa1b('0x9'),this[_0xfa1b('0xa')][_0xfa1b('0xb')](this));ami['on'](_0xfa1b('0xc'),this[_0xfa1b('0xd')][_0xfa1b('0xb')](this));ami['on']('agentringnoanswer',this[_0xfa1b('0xe')][_0xfa1b('0xb')](this));ami['on'](_0xfa1b('0xf'),this['syncAttendedTransfer'][_0xfa1b('0xb')](this));ami['on'](_0xfa1b('0x10'),this[_0xfa1b('0x11')]['bind'](this));ami['on'](_0xfa1b('0x12'),this[_0xfa1b('0x13')][_0xfa1b('0xb')](this));}function getDiff(_0x4ecce3){var _0x4236dc=moment()[_0xfa1b('0x14')](0x0);var _0x338c55=moment(_0x4ecce3)[_0xfa1b('0x14')](0x0);return _0x4236dc[_0xfa1b('0x15')](_0x338c55,_0xfa1b('0x16'));}Acw[_0xfa1b('0x17')][_0xfa1b('0x18')]=function(_0x1a94f3,_0x357f09){var _0xa2f35e=this;var _0x2969f6=getDiff(_0xa2f35e[_0xfa1b('0x6')][_0x1a94f3][_0xfa1b('0x19')]);clearTimeout(_0xa2f35e[_0xfa1b('0x6')][_0x1a94f3][_0xfa1b('0x1a')]);_0xa2f35e[_0xfa1b('0x6')][_0x1a94f3][_0xfa1b('0x1a')]=![];return RpcVoiceAgentReport[_0xfa1b('0x1b')]({'acwtime':_0x2969f6},_0xa2f35e['timers'][_0x1a94f3]['uniqueid'],_0x1a94f3)[_0xfa1b('0x1c')](function(_0x55fb95){logger['info'](_0xfa1b('0x1d'),_0x357f09,_0x2969f6,_0x55fb95);})[_0xfa1b('0x1e')](function(_0x214bd4){logger[_0xfa1b('0x1f')](_0xfa1b('0x20'),_0x357f09,_0x214bd4);})[_0xfa1b('0x21')](function(){delete _0xa2f35e[_0xfa1b('0x6')][_0x1a94f3];});};Acw[_0xfa1b('0x17')]['startAcw']=function(_0x4cb4ab){try{var _0x3ab763=this;var _0x3d7334=this[_0xfa1b('0x7')][_0x4cb4ab][_0xfa1b('0x22')];var _0x43eb0a=this['channels'][_0x4cb4ab][_0xfa1b('0x23')];var _0x559b9d=this['voiceQueues'][_0x43eb0a];var _0x1a2580=![];var _0x3d029a=_0xfa1b('0x24');if(_0x559b9d['mandatoryDisposition']&&_0x559b9d[_0xfa1b('0x25')][_0xfa1b('0x26')]){_0x1a2580=!![];_0x3d029a=_0x559b9d[_0xfa1b('0x25')][_0xfa1b('0x26')];}return ami['Action']({'action':_0xfa1b('0x27'),'interface':_0x3d7334,'paused':!![],'reason':_0x3d029a})[_0xfa1b('0x1c')](function(){if(_0x3ab763[_0xfa1b('0x5')][_0x3d7334]){return RpcUser['getAgent'](_0x3ab763[_0xfa1b('0x5')][_0x3d7334]['id'])[_0xfa1b('0x1c')](function(_0x505f65){if(!_0x505f65||_0x505f65[_0xfa1b('0x28')]){logger[_0xfa1b('0x29')](_0xfa1b('0x2a'),_0x4cb4ab,_0x3d7334,_0x43eb0a);return;}logger[_0xfa1b('0x29')](_0xfa1b('0x2b'),_0x4cb4ab,_0x3d7334,_0x43eb0a);var _0x39d40f=_0x3ab763[_0xfa1b('0x7')][_0x4cb4ab][_0xfa1b('0x2c')]&&_0x3ab763['channels'][_0x4cb4ab][_0xfa1b('0x2d')]?_0x3ab763[_0xfa1b('0x7')][_0x4cb4ab][_0xfa1b('0x2d')]:_0x4cb4ab;return RpcUser[_0xfa1b('0x2e')](_0x3ab763[_0xfa1b('0x5')][_0x3d7334],_0x3d029a,_0x39d40f)[_0xfa1b('0x1c')](function(_0x13c682){_0x3ab763[_0xfa1b('0x4')][_0x43eb0a][_0xfa1b('0x2f')]-=0x1;_0x3ab763['voiceQueues'][_0x43eb0a][_0xfa1b('0x30')]+=0x1;return _0x13c682;});})[_0xfa1b('0x1c')](function(_0x129d2a){if(_0x1a2580||!_0x129d2a){return;}_0x3ab763['timers'][_0x3d7334]={};logger[_0xfa1b('0x29')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4cb4ab,_0x3ab763['voiceQueues'][_0x43eb0a]['acwTimeout'],_0x3d7334,_0x43eb0a);_0x3ab763['timers'][_0x3d7334]['timer']=setTimeout(_0x3ab763[_0xfa1b('0x31')][_0xfa1b('0xb')](_0x3ab763,_0x3d7334),_0x3ab763['voiceQueues'][_0x43eb0a]['acwTimeout']*0x3e8);_0x3ab763[_0xfa1b('0x6')][_0x3d7334][_0xfa1b('0x19')]=moment()[_0xfa1b('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ab763[_0xfa1b('0x6')][_0x3d7334][_0xfa1b('0x33')]=_0x4cb4ab;_0x3ab763[_0xfa1b('0x6')][_0x3d7334][_0xfa1b('0x23')]=_0x43eb0a;_0x3ab763[_0xfa1b('0x6')][_0x3d7334][_0xfa1b('0x18')]=_0x3ab763['updateAcw'][_0xfa1b('0xb')](_0x3ab763,_0x3d7334,_0x4cb4ab);});}})[_0xfa1b('0x1e')](function(){logger[_0xfa1b('0x1f')](_0xfa1b('0x34'),_0x4cb4ab,_0x3ab763[_0xfa1b('0x4')][_0x43eb0a][_0xfa1b('0x35')],_0x3d7334,_0x43eb0a);})[_0xfa1b('0x21')](function(){delete _0x3ab763[_0xfa1b('0x7')][_0x4cb4ab];});}catch(_0x425f0b){logger[_0xfa1b('0x1f')](_0xfa1b('0x36'),_0x425f0b['message']);}};Acw[_0xfa1b('0x17')][_0xfa1b('0x31')]=function(_0x17aa48){try{var _0x20f7ca=this;if(_0x20f7ca[_0xfa1b('0x6')][_0x17aa48]){_0x20f7ca[_0xfa1b('0x6')][_0x17aa48]['timer']=![];var _0x5ce6c1=_0x20f7ca[_0xfa1b('0x6')][_0x17aa48][_0xfa1b('0x33')];var _0x2e4588=_0x20f7ca[_0xfa1b('0x6')][_0x17aa48][_0xfa1b('0x23')];var _0x1a0ebe=_0x20f7ca[_0xfa1b('0x4')][_0x2e4588][_0xfa1b('0x35')];logger[_0xfa1b('0x29')]('[%s][TIMER][STOP][AGENT:%s]',_0x5ce6c1,_0x17aa48);RpcUser['getAgent'](this[_0xfa1b('0x5')][_0x17aa48]['id'])[_0xfa1b('0x1c')](function(_0x441d67){if(_0x441d67[_0xfa1b('0x37')]===_0xfa1b('0x24')){return RpcUser[_0xfa1b('0x38')](_0x20f7ca[_0xfa1b('0x5')][_0x17aa48]);}});RpcVoiceAgentReport[_0xfa1b('0x1b')]({'acwtime':_0x1a0ebe,'agentacw':!![]},_0x5ce6c1,_0x17aa48)[_0xfa1b('0x1c')](function(_0xcf0bbe){logger[_0xfa1b('0x29')]('[%s][UPDATE][ACWTIME:%s]',_0x5ce6c1,_0x1a0ebe,_0xcf0bbe);})[_0xfa1b('0x1e')](function(_0x1114e2){logger[_0xfa1b('0x1f')](_0xfa1b('0x20'),_0x5ce6c1,_0x1114e2);});}else{logger[_0xfa1b('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x17aa48);if(_0x20f7ca[_0xfa1b('0x6')]){logger[_0xfa1b('0x29')](_0xfa1b('0x39'),JSON[_0xfa1b('0x3a')](_0x20f7ca[_0xfa1b('0x6')]));}}}catch(_0x4dde92){logger[_0xfa1b('0x1f')]('[ACW][STOP]\x20%s',_0x4dde92[_0xfa1b('0x3b')]);}};Acw['prototype']['syncAgentConnect']=function(_0x1f1707){try{if(this[_0xfa1b('0x4')][_0x1f1707[_0xfa1b('0x23')]]&&(this[_0xfa1b('0x4')][_0x1f1707['queue']][_0xfa1b('0x1')]||this[_0xfa1b('0x4')][_0x1f1707[_0xfa1b('0x23')]][_0xfa1b('0x3c')])){if(this[_0xfa1b('0x5')][_0x1f1707[_0xfa1b('0x22')]]){this[_0xfa1b('0x7')][_0x1f1707[_0xfa1b('0x33')]]={'queue':_0x1f1707[_0xfa1b('0x23')],'interface':_0x1f1707[_0xfa1b('0x22')],'destlinkedid':_0x1f1707[_0xfa1b('0x2d')]};}}}catch(_0x48b648){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x48b648['message']);}};Acw['prototype'][_0xfa1b('0x13')]=function(_0x5ef190){try{if(this[_0xfa1b('0x4')][_0x5ef190[_0xfa1b('0x23')]]&&(this[_0xfa1b('0x4')][_0x5ef190[_0xfa1b('0x23')]][_0xfa1b('0x1')]||this[_0xfa1b('0x4')][_0x5ef190[_0xfa1b('0x23')]][_0xfa1b('0x3c')])){if(this[_0xfa1b('0x5')][_0x5ef190[_0xfa1b('0x22')]]){this[_0xfa1b('0x7')][_0x5ef190[_0xfa1b('0x33')]]={'queue':_0x5ef190[_0xfa1b('0x23')],'interface':_0x5ef190[_0xfa1b('0x22')]};}}}catch(_0x5d58e9){logger['error'](_0xfa1b('0x3d'),_0x5d58e9[_0xfa1b('0x3b')]);}};Acw[_0xfa1b('0x17')]['syncHangupRequest']=function(_0x48d041){try{if(this[_0xfa1b('0x7')][_0x48d041[_0xfa1b('0x33')]]&&_[_0xfa1b('0x3e')](this['channels'][_0x48d041[_0xfa1b('0x33')]]['attended'])){logger[_0xfa1b('0x29')](_0xfa1b('0x3f'),_0x48d041[_0xfa1b('0x33')]);this[_0xfa1b('0x40')](_0x48d041[_0xfa1b('0x33')]);}else if(this[_0xfa1b('0x7')][_0x48d041[_0xfa1b('0x41')]]&&_[_0xfa1b('0x3e')](this['channels'][_0x48d041[_0xfa1b('0x41')]][_0xfa1b('0x2c')])){logger['info'](_0xfa1b('0x42'),_0x48d041[_0xfa1b('0x41')]);this[_0xfa1b('0x40')](_0x48d041['linkedid']);}}catch(_0x226afe){logger[_0xfa1b('0x1f')](_0xfa1b('0x43'),_0x226afe[_0xfa1b('0x3b')]);}};Acw[_0xfa1b('0x17')]['syncHangup']=function(_0x1bfd5f){try{if(this['channels'][_0x1bfd5f[_0xfa1b('0x33')]]&&this['channels'][_0x1bfd5f['uniqueid']][_0xfa1b('0x2c')]){logger[_0xfa1b('0x29')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1bfd5f['uniqueid']);this[_0xfa1b('0x40')](_0x1bfd5f[_0xfa1b('0x33')]);}else if(this[_0xfa1b('0x7')][_0x1bfd5f[_0xfa1b('0x41')]]&&this[_0xfa1b('0x7')][_0x1bfd5f[_0xfa1b('0x41')]][_0xfa1b('0x2c')]){logger[_0xfa1b('0x29')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1bfd5f['linkedid']);this['startAcw'](_0x1bfd5f['linkedid']);}}catch(_0x5a98e3){logger['error'](_0xfa1b('0x44'),_0x5a98e3[_0xfa1b('0x3b')]);}};Acw[_0xfa1b('0x17')][_0xfa1b('0x45')]=function(_0x20f746){try{if(!_[_0xfa1b('0x46')](this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x47')]])){this['startAcw'](_0x20f746[_0xfa1b('0x47')]);if(this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x48')]]){this[_0xfa1b('0x7')][_0x20f746['secondtransfereruniqueid']][_0xfa1b('0x2c')]=!![];this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x49')]]=this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x48')]];delete this['channels'][_0x20f746[_0xfa1b('0x48')]];}}else if(!_[_0xfa1b('0x46')](this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x49')]])){this[_0xfa1b('0x40')](_0x20f746[_0xfa1b('0x49')]);if(this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x4a')]]){this[_0xfa1b('0x7')][_0x20f746['origtransfereruniqueid']][_0xfa1b('0x2c')]=!![];this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x47')]]=this['channels'][_0x20f746['origtransfereruniqueid']];delete this[_0xfa1b('0x7')][_0x20f746[_0xfa1b('0x4a')]];}}}catch(_0x3962ae){logger[_0xfa1b('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x3962ae[_0xfa1b('0x3b')]);}};Acw[_0xfa1b('0x17')][_0xfa1b('0x11')]=function(_0x59bb0e){try{if(this[_0xfa1b('0x7')][_0x59bb0e[_0xfa1b('0x4b')]]){logger[_0xfa1b('0x29')](_0xfa1b('0x4c'),JSON[_0xfa1b('0x3a')](_0x59bb0e[_0xfa1b('0x4b')]));this['startAcw'](_0x59bb0e[_0xfa1b('0x4b')]);}else if(this['channels'][_0x59bb0e['transfererlinkedid']]){logger[_0xfa1b('0x29')](_0xfa1b('0x4d'),JSON[_0xfa1b('0x3a')](_0x59bb0e['transfererlinkedid']));this[_0xfa1b('0x40')](_0x59bb0e[_0xfa1b('0x4e')]);}}catch(_0x1e6b49){logger['error'](_0xfa1b('0x4f'),_0x1e6b49[_0xfa1b('0x3b')]);}};Acw[_0xfa1b('0x17')]['syncAgentRingNoAnswer']=function(_0x3b1b09){try{if(this[_0xfa1b('0x4')][_0x3b1b09['queue']]&&this[_0xfa1b('0x4')][_0x3b1b09['queue']][_0xfa1b('0x50')]==='all'){if(this[_0xfa1b('0x5')][_0x3b1b09[_0xfa1b('0x22')]]){logger[_0xfa1b('0x29')](_0xfa1b('0x51'),_0x3b1b09[_0xfa1b('0x33')],_0x3b1b09[_0xfa1b('0x22')],_0x3b1b09[_0xfa1b('0x23')]);return RpcUser[_0xfa1b('0x2e')](this[_0xfa1b('0x5')][_0x3b1b09[_0xfa1b('0x22')]],_0xfa1b('0x52'),_0x3b1b09[_0xfa1b('0x33')]);}}}catch(_0x509eba){logger[_0xfa1b('0x1f')](_0xfa1b('0x53'),_0x509eba[_0xfa1b('0x3b')]);}};module[_0xfa1b('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e779129..382fb28 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 _0xf35b=['close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','then','actionSipPeerStatus','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x155924,_0x2a5368){var _0x262e4b=function(_0x1e245a){while(--_0x1e245a){_0x155924['push'](_0x155924['shift']());}};_0x262e4b(++_0x2a5368);}(_0xf35b,0x7a));var _0xbf35=function(_0x31e04e,_0x544b93){_0x31e04e=_0x31e04e-0x0;var _0x24a3cc=_0xf35b[_0x31e04e];return _0x24a3cc;};'use strict';var Manager=require(_0xbf35('0x0'));var BPromise=require(_0xbf35('0x1'));var util=require(_0xbf35('0x2'));var logger=require(_0xbf35('0x3'))(_0xbf35('0x4'));var config=require(_0xbf35('0x5'));var ami=new Manager(config[_0xbf35('0x6')][_0xbf35('0x7')],config[_0xbf35('0x6')]['ip'],config[_0xbf35('0x6')][_0xbf35('0x8')],config[_0xbf35('0x6')][_0xbf35('0x9')],!![]);ami[_0xbf35('0xa')]();ami[_0xbf35('0xb')]=BPromise[_0xbf35('0xc')](ami[_0xbf35('0xd')]);function error(_0x2319f5){logger[_0xbf35('0xe')](util[_0xbf35('0xf')](_0xbf35('0x10'),config[_0xbf35('0x6')]['username'],config[_0xbf35('0x6')]['ip'],config[_0xbf35('0x6')][_0xbf35('0x7')],util[_0xbf35('0x11')](_0x2319f5,![],null)));}function close(){logger[_0xbf35('0xe')](util[_0xbf35('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xbf35('0x6')]['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xbf35('0x12')});};};ami[_0xbf35('0x13')]=function(){return function(){return ami[_0xbf35('0xb')]({'action':_0xbf35('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xbf35('0xb')]({'action':_0xbf35('0x15')});};};ami[_0xbf35('0x16')]=function(){return function(){return ami[_0xbf35('0xb')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbf35('0xb')]({'action':_0xbf35('0x17')});};};function connect(){logger['info'](util[_0xbf35('0xf')](_0xbf35('0x18'),config['asterisk'][_0xbf35('0x8')],config[_0xbf35('0x6')]['ip'],config[_0xbf35('0x6')][_0xbf35('0x7')]));ami['once'](_0xbf35('0xe'),error);ami[_0xbf35('0x19')](_0xbf35('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0xbf35('0x1b'),function(_0x3d3323){logger[_0xbf35('0x1c')](util[_0xbf35('0xf')](_0xbf35('0x1d'),config['asterisk'][_0xbf35('0x8')],config[_0xbf35('0x6')]['ip'],config[_0xbf35('0x6')][_0xbf35('0x7')],util['inspect'](_0x3d3323,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xbf35('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xbf35('0x6')][_0xbf35('0x8')],config['asterisk']['ip'],config[_0xbf35('0x6')][_0xbf35('0x7')]));return Promise['resolve']()['then'](ami[_0xbf35('0x1e')]())[_0xbf35('0x1f')](ami[_0xbf35('0x13')]())[_0xbf35('0x1f')](ami[_0xbf35('0x20')]())[_0xbf35('0x1f')](ami[_0xbf35('0x16')]())[_0xbf35('0x1f')](ami[_0xbf35('0x21')]())[_0xbf35('0x22')](function(_0x478dab){logger[_0xbf35('0xe')](_0xbf35('0x23'),util['inspect'](_0x478dab,{'showHidden':![],'depth':null}));});});ami['once'](_0xbf35('0xe'),error);ami['once']('close',close);module[_0xbf35('0x24')]=ami; \ No newline at end of file +var _0xae1a=['info','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','close','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xae1a,0xeb));var _0xaae1=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xae1a[_0x3ff085];return _0x2b68c3;};'use strict';var Manager=require(_0xaae1('0x0'));var BPromise=require('bluebird');var util=require(_0xaae1('0x1'));var logger=require(_0xaae1('0x2'))(_0xaae1('0x3'));var config=require(_0xaae1('0x4'));var ami=new Manager(config[_0xaae1('0x5')][_0xaae1('0x6')],config['asterisk']['ip'],config[_0xaae1('0x5')]['username'],config[_0xaae1('0x5')][_0xaae1('0x7')],!![]);ami[_0xaae1('0x8')]();ami[_0xaae1('0x9')]=BPromise['promisify'](ami[_0xaae1('0xa')]);function error(_0x571bf9){logger[_0xaae1('0xb')](util[_0xaae1('0xc')](_0xaae1('0xd'),config[_0xaae1('0x5')][_0xaae1('0xe')],config[_0xaae1('0x5')]['ip'],config['asterisk'][_0xaae1('0x6')],util['inspect'](_0x571bf9,![],null)));}function close(){logger[_0xaae1('0xb')](util['format'](_0xaae1('0xf'),config[_0xaae1('0x5')]['username'],config[_0xaae1('0x5')]['ip'],config['asterisk'][_0xaae1('0x6')]));}ami[_0xaae1('0x10')]=function(){return function(){return ami[_0xaae1('0x9')]({'action':_0xaae1('0x11')});};};ami[_0xaae1('0x12')]=function(){return function(){return ami[_0xaae1('0x9')]({'action':'devicestatelist'});};};ami[_0xaae1('0x13')]=function(){return function(){return ami[_0xaae1('0x9')]({'action':_0xaae1('0x14')});};};ami[_0xaae1('0x15')]=function(){return function(){return ami[_0xaae1('0x9')]({'action':_0xaae1('0x16')});};};ami[_0xaae1('0x17')]=function(){return function(){return ami[_0xaae1('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0xaae1('0x18')](util[_0xaae1('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xaae1('0x5')]['username'],config[_0xaae1('0x5')]['ip'],config['asterisk'][_0xaae1('0x6')]));ami[_0xaae1('0x19')](_0xaae1('0xb'),error);ami[_0xaae1('0x19')]('close',close);}ami['on'](_0xaae1('0x1a'),connect);ami['on'](_0xaae1('0x1b'),function(_0x5698e1){logger['info'](util[_0xaae1('0xc')](_0xaae1('0x1c'),config[_0xaae1('0x5')]['username'],config['asterisk']['ip'],config[_0xaae1('0x5')][_0xaae1('0x6')],util[_0xaae1('0x1d')](_0x5698e1,![],null)));});ami['on'](_0xaae1('0x1e'),function(){logger[_0xaae1('0x18')](util[_0xaae1('0xc')](_0xaae1('0x1f'),config[_0xaae1('0x5')]['username'],config[_0xaae1('0x5')]['ip'],config['asterisk'][_0xaae1('0x6')]));return Promise[_0xaae1('0x20')]()[_0xaae1('0x21')](ami[_0xaae1('0x10')]())[_0xaae1('0x21')](ami[_0xaae1('0x12')]())[_0xaae1('0x21')](ami['actionSipPeerStatus']())[_0xaae1('0x21')](ami[_0xaae1('0x15')]())[_0xaae1('0x21')](ami[_0xaae1('0x17')]())[_0xaae1('0x22')](function(_0x3cda7a){logger[_0xaae1('0xb')](_0xaae1('0x23'),util[_0xaae1('0x1d')](_0x3cda7a,{'showHidden':![],'depth':null}));});});ami['once'](_0xaae1('0xb'),error);ami[_0xaae1('0x19')](_0xaae1('0x24'),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 4818af0..14351e0 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xcb91[_0x5e9a69];return _0x5979c8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x37e1c5,_0x40d564){var _0x331c4b=function(_0x4e36f3){while(--_0x4e36f3){_0x37e1c5['push'](_0x37e1c5['shift']());}};_0x331c4b(++_0x40d564);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 01e4589..f54169d 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 _0x1189=['OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','statedesc','Drop','TIMEOUT','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','run','idHopper','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','amd','saveInDb','[syncHangupInAMD]','value','MACHINE','[syncVarSet]','membername','countmachineretry','countglobal','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','reason19\x20machine....','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangup]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','Normal\x20Clearing','[syncAgentComplete][createHistory]','[syncAgentComplete]','cause-txt','Unknown','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','nosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','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','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','loggedIn','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[checkContactBlack]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[actionOriginate]\x20','checkIsBlackList','[handlePower]','talking','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangAbandonmentRate','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20deactivated','Error','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','content','indexOf','catch','iftime\x20%s,%s','some','OVERTIME_GLOBAL_INTERVAL'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x1189,0x17f));var _0x9118=function(_0x588540,_0x1a6b5d){_0x588540=_0x588540-0x0;var _0x1c6c97=_0x1189[_0x588540];return _0x1c6c97;};'use strict';var util=require(_0x9118('0x0'));var _=require(_0x9118('0x1'));var uuid=require(_0x9118('0x2'));var moment=require(_0x9118('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x9118('0x4'));var hopperUtils=require(_0x9118('0x5'));var ut=require(_0x9118('0x6'));var config=require(_0x9118('0x7'));var logger=require(_0x9118('0x8'))(_0x9118('0x9'));var loggerBooked=require(_0x9118('0x8'))('booked');var loggerPredictive=require(_0x9118('0x8'))(_0x9118('0xa'));var loggerPredictiveCalls=require(_0x9118('0x8'))(_0x9118('0xb'));var loggerSyncQueueSummary=require(_0x9118('0x8'))(_0x9118('0xc'));var ami=require('../ami');config[_0x9118('0xd')]=_[_0x9118('0xe')](config[_0x9118('0xd')],{'host':_0x9118('0xf'),'port':0x18eb});var io=require(_0x9118('0x10'))(new Redis(config[_0x9118('0xd')]));var cmHopper=require(_0x9118('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x9118('0x12'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x9118('0x13'));var Final=require(_0x9118('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x9118('0x15'));var Hangup=require(_0x9118('0x16'));var ipAgi=process[_0x9118('0x17')][_0x9118('0x18')]||_0x9118('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9118('0x1a')][_0x9118('0x1b')]=function(_0x11b1b9){this[_0x9118('0x1c')]=this[_0x9118('0x1c')]?this[_0x9118('0x1c')]['finally'](_0x11b1b9):_0x11b1b9();};function Dialer(_0x5c403d,_0x30241a){this['sequence']=new Sequence();this[_0x9118('0x1d')]=_0x30241a;this[_0x9118('0x1e')]=_0x5c403d[_0x9118('0x1e')];this[_0x9118('0x1f')]=_0x5c403d['campaigns'];this[_0x9118('0x20')]=_0x5c403d['agents'];this[_0x9118('0x21')]=_0x5c403d['trunks'];this[_0x9118('0x22')]=config[_0x9118('0x22')]||0x2;this['channels']={};this[_0x9118('0x23')]={};this[_0x9118('0x24')]={};this[_0x9118('0x25')]={};this[_0x9118('0x26')]={};this[_0x9118('0x27')]={};this['startProgressive']={};this[_0x9118('0x28')]={};this[_0x9118('0x29')]={};this[_0x9118('0x2a')]={};this[_0x9118('0x2b')]={};ami['on'](_0x9118('0x2c'),this[_0x9118('0x2d')][_0x9118('0x2e')](this));ami['on'](_0x9118('0x2f'),this[_0x9118('0x30')][_0x9118('0x2e')](this));ami['on']('originateresponse',this[_0x9118('0x31')]['bind'](this));ami['on'](_0x9118('0x32'),this[_0x9118('0x33')][_0x9118('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x9118('0x2e')](this));ami['on'](_0x9118('0x34'),this['syncQueueSummaryComplete'][_0x9118('0x2e')](this));ami['on'](_0x9118('0x35'),this[_0x9118('0x36')][_0x9118('0x2e')](this));ami['on'](_0x9118('0x37'),this[_0x9118('0x38')][_0x9118('0x2e')](this));ami['on'](_0x9118('0x39'),this['syncVarSet'][_0x9118('0x2e')](this));ami['on'](_0x9118('0x3a'),this[_0x9118('0x3b')][_0x9118('0x2e')](this));ami['on'](_0x9118('0x3c'),this[_0x9118('0x3d')][_0x9118('0x2e')](this));this[_0x9118('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0x9118('0x3f')]()[_0x9118('0x40')](function(_0x5c1d8f){previewRecallmeReminderInterval=_0x5c1d8f[_0x9118('0x41')];});}function isNotNull(_0x4d3da7){return _0x4d3da7!==null&&!_['isUndefined'](_0x4d3da7);}function msgResponse(_0x521e48,_0x3d97b0,_0x4abf44){return{'action':_0x521e48,'response':_0x3d97b0,'message':_0x4abf44,'stack':_0x4abf44};}function emit(_0x452e13,_0x238d0a,_0x3f5093){io['to'](_0x452e13)[_0x9118('0x42')](_0x238d0a,_0x3f5093);}function emitOutboundVoiceQueueSummary(_0x38662f){if(_0x38662f[_0x9118('0x43')]==='outbound'){logger[_0x9118('0x44')](_0x9118('0x45'),util[_0x9118('0x46')](_0x38662f,{'showHidden':![],'depth':null}));emit(util['format'](_0x9118('0x47'),_0x38662f[_0x9118('0x48')]),_0x9118('0x49'),_0x38662f);}}function checkGetDataPredictive(_0x590d78){if(isNotNull(_0x590d78)&&!_[_0x9118('0x4a')](_0x590d78)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x9118('0x4b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x590d78[_0x9118('0x4c')]);loggerPredictive[_0x9118('0x4b')](_0x9118('0x4d'),_0x590d78[_0x9118('0x4e')]);loggerPredictive[_0x9118('0x4b')](_0x9118('0x4f'),_0x590d78[_0x9118('0x50')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x590d78[_0x9118('0x51')]);loggerPredictive[_0x9118('0x4b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x590d78[_0x9118('0x52')]);loggerPredictive[_0x9118('0x4b')](_0x9118('0x53'),_0x590d78['predictiveIntervalAvgTalktime']);loggerPredictive[_0x9118('0x4b')](_0x9118('0x54'));if(_0x590d78[_0x9118('0x4c')]>0x0){if(!_[_0x9118('0x55')](_0x590d78[_0x9118('0x56')])&&_0x590d78[_0x9118('0x56')]>0x0){return!![];}loggerPredictive[_0x9118('0x4b')](_0x9118('0x57'));if(!_['isUndefined'](_0x590d78[_0x9118('0x52')])&&_0x590d78['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x9118('0x58'));}else{loggerPredictive[_0x9118('0x4b')](_0x9118('0x59'));}}else{loggerPredictive[_0x9118('0x4b')](_0x9118('0x5a'));}return![];}function mergeDataErlangB(_0x4e1401){return function(_0x54db50){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x9118('0x4b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54db50[_0x9118('0x5b')]);loggerPredictive[_0x9118('0x4b')](_0x9118('0x5c'),_0x54db50['erlangCallToSecond']);loggerPredictive[_0x9118('0x4b')](_0x9118('0x5d'),_0x54db50['erlangAbandonmentRate']);loggerPredictive['info'](_0x9118('0x5e'),_0x54db50[_0x9118('0x5f')]);loggerPredictive['info'](_0x9118('0x5d'),_0x54db50[_0x9118('0x60')]);loggerPredictive['info'](_0x9118('0x54'));_[_0x9118('0x61')](_0x4e1401,_0x54db50);};}function ifInterval(_0x131d29,_0xfcaa5f){if(_['isUndefined'](_0xfcaa5f)){return![];}return utils[_0x9118('0x62')](undefined,_0xfcaa5f)<_0x131d29*0x3c;}function clearPredictiveAttributes(_0x28656e){if(_0x28656e[_0x9118('0x63')]){_0x28656e['startProgressive']=undefined;loggerPredictive[_0x9118('0x44')](_0x28656e[_0x9118('0x48')],_0x9118('0x64'));}if(_0x28656e['startPredictive']){_0x28656e[_0x9118('0x27')]=undefined;loggerPredictive[_0x9118('0x44')](_0x28656e[_0x9118('0x48')],_0x9118('0x65'));}if(_0x28656e[_0x9118('0x66')]){clearInterval(_0x28656e[_0x9118('0x66')]);_0x28656e['handlePredictive']=undefined;loggerPredictive[_0x9118('0x44')](_0x28656e[_0x9118('0x48')],_0x9118('0x67'));}}function loggerCatchPredictive(_0x1da638,_0x48bc46){return function(_0x29152e){loggerPredictive[_0x9118('0x68')](_0x48bc46[_0x9118('0x48')],_0x1da638);loggerPredictive[_0x9118('0x68')](_0x29152e[_0x9118('0x69')]);clearPredictiveAttributes(_0x48bc46);};}function loggerCatch(_0x2475a9){return function(_0x447f1b){logger[_0x9118('0x68')](_0x2475a9,util['inspect'](_0x447f1b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b6f40){return function(_0x31a1d9){if(isNotNull(_0x31a1d9)&&isNotNull(_0x31a1d9[0x0])){if(_0x31a1d9[0x0][_0x9118('0x6a')]>0x0){_0x1b6f40['message']=utils[_0x9118('0x6b')][_0x9118('0x6c')];logger['info'](_0x9118('0x6d')+_0x1b6f40['name'],_0x31a1d9[0x0]['contactsRescheduled'],'contacts');}else{_0x1b6f40[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x6f')];logger[_0x9118('0x4b')](_0x9118('0x70')+_0x1b6f40[_0x9118('0x48')]);}}};}function createObjHistory(_0x1c40d1,_0x4b0510,_0x514372,_0xa9858a,_0x1e3da9){_0x1c40d1['message']=_0x514372;var _0x59e005=new Action(_0x1c40d1,_0x4b0510);var _0x15065b=new History(_0x59e005);_0x15065b['state']=_0xa9858a;_0x15065b['statedesc']=_0x1e3da9;_0x15065b[_0x9118('0x71')]=_0x59e005[_0x9118('0x72')];return _0x15065b;}function unlockQueueStatus(_0x3edea6,_0x4018b8){setTimeout(function(){if(_[_0x9118('0x55')](_0x3edea6[_0x9118('0x73')])){loggerBooked[_0x9118('0x68')](_0x9118('0x74'),_0x4018b8);}_0x3edea6[_0x9118('0x73')]=!![];loggerBooked['info'](_0x9118('0x75'),_0x4018b8,JSON[_0x9118('0x76')](_[_0x9118('0x77')](_0x3edea6,['name',_0x9118('0x73')])));},0x1f3);}function checkInterval(_0xedc3f1){return function(){if(!isNotNull(_0xedc3f1[_0x9118('0x78')])){_0xedc3f1['message']=utils[_0x9118('0x6b')][_0x9118('0x79')];throw _0xedc3f1['name']+_0x9118('0x7a');}if(!isNotNull(_0xedc3f1[_0x9118('0x78')][_0x9118('0x7b')])){_0xedc3f1[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x79')];throw _0xedc3f1[_0x9118('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x9118('0x4a')](_0xedc3f1[_0x9118('0x78')]['Intervals']))){_0xedc3f1[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x79')];throw _0xedc3f1[_0x9118('0x48')]+_0x9118('0x7a');}};}function checkIsIVRCampaignActive(_0x53c248){return function(){if(!utils[_0x9118('0x7c')](_0x53c248)){_0x53c248[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x7d')];throw _0x53c248[_0x9118('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x237536){if(utils[_0x9118('0x7e')](_0x237536)){emit(util[_0x9118('0x7f')](_0x9118('0x80'),_0x237536['name']),_0x9118('0x81'),_0x237536);}}function loggerCatchQueueSummary(_0x34bc3b,_0x2c7208){return function(_0x337513){clearPredictiveAttributes(_0x2c7208);emitCampaignSummary(_0x2c7208);loggerSyncQueueSummary[_0x9118('0x44')](_0x34bc3b,util[_0x9118('0x46')](_0x337513,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5e03e4){if(_0x5e03e4[_0x9118('0x82')]){if(_0x5e03e4[_0x9118('0x83')]===0x0){_0x5e03e4[_0x9118('0x82')]=![];_0x5e03e4[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x7d')];loggerSyncQueueSummary[_0x9118('0x44')](_0x9118('0x84'),_0x5e03e4[_0x9118('0x48')],_0x9118('0x85'));}else{_0x5e03e4[_0x9118('0x6e')]=utils[_0x9118('0x6b')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0x9118('0x84'),_0x5e03e4[_0x9118('0x48')],_0x9118('0x86'));}emitCampaignSummary(_0x5e03e4);}}function myreject(_0x54641f){return function(_0x57c584){return _0x54641f(msgResponse('[ifTime][Action]',_0x9118('0x87'),JSON[_0x9118('0x76')](_0x57c584)));};}Dialer[_0x9118('0x1a')][_0x9118('0x88')]=function(_0x162702){return!_[_0x9118('0x55')](_0x162702)&&_0x162702&&!_[_0x9118('0x55')](_0x162702[_0x9118('0x48')])&&!_[_0x9118('0x55')](_0x162702['active'])&&_0x162702[_0x9118('0x89')]&&(this[_0x9118('0x21')][util[_0x9118('0x7f')]('SIP/%s',_0x162702[_0x9118('0x48')])][_0x9118('0x8a')]===_0x9118('0x8b')||this[_0x9118('0x21')][util[_0x9118('0x7f')](_0x9118('0x8c'),_0x162702[_0x9118('0x48')])][_0x9118('0x8a')]===_0x9118('0x8d'));};Dialer['prototype'][_0x9118('0x8e')]=function(_0x295334){var _0x39f2c0=this;return function(){if(!_0x39f2c0[_0x9118('0x88')](_0x295334[_0x9118('0x8f')])){if(!_0x39f2c0[_0x9118('0x88')](_0x295334[_0x9118('0x90')])){_0x295334[_0x9118('0x6e')]=utils[_0x9118('0x6b')]['TRUNK_NOT_REACHABLE'];throw _0x295334['name']+_0x9118('0x91');}}};};Dialer['prototype'][_0x9118('0x92')]=function(_0x510b04,_0x15a2f2,_0x2e00eb,_0x444d4a){var _0x433453=this;return function(){var _0x4fc24e=!![];return _0x433453[_0x9118('0x93')](_0x510b04,_0x15a2f2,_0x2e00eb,_0x444d4a,_0x4fc24e);};};Dialer[_0x9118('0x1a')][_0x9118('0x94')]=function(_0xc6e34f,_0xff9178,_0x212fb1,_0x5a17f4){var _0x47d793=this;return function(){var _0x13c36f=![];return _0x47d793[_0x9118('0x93')](_0xc6e34f[_0x9118('0x7b')],_0xff9178,_0x212fb1,_0x5a17f4,_0x13c36f);};};Dialer[_0x9118('0x1a')][_0x9118('0x93')]=function(_0xdb0dca,_0x506322,_0x5bcc95,_0x485912,_0x140e66){var _0x190e85=[];return new Promise(function(_0xcc5304,_0x40429f){if(!isNotNull(_0xdb0dca)){_0x485912['message']=utils[_0x9118('0x6b')][_0x9118('0x79')];return _0x40429f(msgResponse(_0x9118('0x95'),_0x9118('0x96'),_0x5bcc95+_0x9118('0x97')));}if(_[_0x9118('0x4a')](_0xdb0dca)){_0x485912[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x98')];return _0x40429f(msgResponse(_0x9118('0x95'),_0x9118('0x96'),_0x5bcc95+_0x9118('0x99')));}if(_0x506322&&_[_0x9118('0x55')](config[_0x9118('0x9a')][_0x506322])){_0x485912['message']=utils['CAMPAIGN_STATUS'][_0x9118('0x9b')];return _0x40429f(msgResponse(_0x9118('0x95'),_0x9118('0x96'),_0x5bcc95+_0x9118('0x9c')+_0x506322));}if(_[_0x9118('0x9d')](_0xdb0dca)){for(var _0x29d826=0x0;_0x29d826<_0xdb0dca[_0x9118('0x9e')];_0x29d826+=0x1){_0x190e85[_0x9118('0x9f')](ami[_0x9118('0xa0')]({'action':_0x9118('0xa1'),'command':util[_0x9118('0x7f')]('iftime\x20%s,%s',_0xdb0dca[_0x29d826][_0x9118('0xa2')],!_[_0x9118('0x55')](config['timezones'][_0x506322])?_0x506322:'')})[_0x9118('0x40')](function(_0x45f115){return _0x45f115[_0x9118('0xa3')][_0x9118('0xa4')]('true')>=0x0;})[_0x9118('0xa5')](myreject(_0x40429f)));}}else{_0x190e85['push'](ami[_0x9118('0xa0')]({'action':_0x9118('0xa1'),'command':util[_0x9118('0x7f')](_0x9118('0xa6'),_0xdb0dca,!_[_0x9118('0x55')](config[_0x9118('0x9a')][_0x506322])?_0x506322:'')})['then'](function(_0x17b746){return _0x17b746[_0x9118('0xa3')][_0x9118('0xa4')]('true')>=0x0;})[_0x9118('0xa5')](myreject(_0x40429f)));}Promise['all'](_0x190e85)[_0x9118('0x40')](function(_0x5b02fb){var _0x18de57=_[_0x9118('0xa7')](_0x5b02fb);if(_0x18de57){return _0xcc5304(_0x18de57);}else{_0x485912[_0x9118('0x6e')]=_0x140e66?utils[_0x9118('0x6b')][_0x9118('0xa8')]:utils['CAMPAIGN_STATUS'][_0x9118('0xa9')];return _0x40429f(msgResponse(_0x9118('0xaa'),_0x9118('0x96'),_0x9118('0xab')+_0x140e66+'\x20'+_0x5bcc95+'\x20Interval\x20is\x20overtime:\x20'+util[_0x9118('0x46')](_0xdb0dca,{'showHidden':![],'depth':null})+_0x9118('0xac')+_0x506322));}})[_0x9118('0xa5')](function(_0x3e20e4){return _0x40429f(msgResponse('ifTime','Failure',JSON[_0x9118('0x76')](_0x3e20e4)));});});};Dialer[_0x9118('0x1a')][_0x9118('0x3e')]=function(){var _0x11076d=this;return cmHopper[_0x9118('0xad')]({'active':![]},{'where':{'active':!![]}})[_0x9118('0x40')](function(){setInterval(function(){_0x11076d[_0x9118('0xae')]();},0x3e8);});};Dialer['prototype'][_0x9118('0xae')]=function(){var _0x5f3b01=this;var _0xf9ee69;for(var _0x27ab18 in this['campaigns']){if(typeof this['campaigns'][_0x27ab18]!==_0x9118('0xaf')){_0xf9ee69=this['campaigns'][_0x27ab18];if(utils[_0x9118('0x7e')](_0xf9ee69)&&utils[_0x9118('0x7c')](_0xf9ee69)){_0xf9ee69[_0x9118('0x82')]=!![];Promise[_0x9118('0xb0')]()[_0x9118('0x40')](checkIsIVRCampaignActive(_0xf9ee69))[_0x9118('0x40')](checkInterval(_0xf9ee69))['then'](_0x5f3b01[_0x9118('0x8e')](_0xf9ee69))[_0x9118('0x40')](_0x5f3b01['checkIfTime'](_0xf9ee69['dialGlobalInterval'],_0xf9ee69[_0x9118('0xb1')],_0xf9ee69[_0x9118('0x48')],_0xf9ee69))[_0x9118('0x40')](_0x5f3b01[_0x9118('0x94')](_0xf9ee69['Interval'],_0xf9ee69[_0x9118('0xb1')],_0xf9ee69[_0x9118('0x48')],_0xf9ee69))[_0x9118('0x40')](_0x5f3b01[_0x9118('0xb2')](_0xf9ee69))[_0x9118('0xa5')](loggerCatchQueueSummary(_0x9118('0xb3'),_0xf9ee69));}else{notSendMessagesCampaign(_0xf9ee69);}}}};Dialer['prototype'][_0x9118('0xb4')]=function(_0x5b2944){if(_0x5b2944[_0x9118('0xb5')]!==_0x9118('0xa')){clearPredictiveAttributes(_0x5b2944);}switch(_0x5b2944[_0x9118('0xb5')]){case _0x9118('0xb6'):this[_0x9118('0xb7')](_0x5b2944,0x1);break;case'power':this[_0x9118('0xb7')](_0x5b2944,_0x5b2944['dialPowerLevel']);break;case'predictive':this['predictive'](_0x5b2944);break;case _0x9118('0xb8'):this['handlePower'](_0x5b2944,0x1);break;default:logger[_0x9118('0x68')](_0x9118('0xb9'),_0x5b2944['name'],_0x9118('0xba'));}};Dialer[_0x9118('0x1a')]['ifTime']=function(_0x362e66,_0x27266f){var _0x2ab593=_0x362e66[_0x9118('0xb1')];var _0x54a2ef=_0x27266f?_0x362e66['dialGlobalInterval']:_0x362e66[_0x9118('0x78')]['Intervals'];logger[_0x9118('0xbb')](_0x9118('0xbc'),_0x54a2ef,_0x2ab593,_0x362e66[_0x9118('0x48')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x362e66[_0x9118('0x48')],_0x362e66['id']));var _0x17ae69=null;return Interval['intervalIftime'](_0x54a2ef,_0x2ab593)[_0x9118('0x40')](function(_0x18890b){if(_0x18890b===!![]){return _0x18890b;}else{_0x362e66[_0x9118('0x6e')]=_0x27266f?utils[_0x9118('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x9118('0x6b')][_0x9118('0xa9')];_0x17ae69=msgResponse(_0x9118('0xaa'),'Failure',_0x9118('0xab')+_0x27266f+'\x20'+_0x362e66[_0x9118('0x48')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x54a2ef,{'showHidden':![],'depth':null})+_0x9118('0xac')+_0x2ab593);}if(_0x17ae69!==null){logger[_0x9118('0xbb')](_0x9118('0xbd'),_0x17ae69);_0x17ae69[_0x9118('0xbe')]=_0x27266f;throw _0x17ae69;}})[_0x9118('0xa5')](function(_0x162b3d){logger[_0x9118('0x68')](_0x9118('0xbf'),_0x162b3d);throw msgResponse('[ifTime][Action]',_0x9118('0x87'),util[_0x9118('0x46')](_0x162b3d,{'showHidden':![],'depth':null}));});};Dialer[_0x9118('0x1a')][_0x9118('0x2d')]=function(_0x5871b5){if(this['voiceQueues'][_0x5871b5[_0x9118('0xc0')]]){if(this[_0x9118('0x25')][_0x5871b5[_0x9118('0xc1')]]&&this[_0x9118('0x25')][_0x5871b5[_0x9118('0xc1')]]['type']!==_0x9118('0xc2')){utils[_0x9118('0xc3')](this[_0x9118('0x1e')][_0x5871b5['queue']],_0x9118('0xc4'));this[_0x9118('0x25')][_0x5871b5[_0x9118('0xc1')]]['answertime']=moment()['format'](_0x9118('0xc5'));}}};Dialer['prototype'][_0x9118('0x33')]=function(_0x268481){var _0x2e3c54=this[_0x9118('0x25')][_0x268481['uniqueid']];if(this['voiceQueues'][_0x268481['queue']]){if(_0x2e3c54&&_0x2e3c54[_0x9118('0x43')]!=='ivr'){delete this['uniqueId'][_0x268481[_0x9118('0xc1')]];this['voiceQueues'][_0x268481[_0x9118('0xc0')]][_0x9118('0xc6')]+=0x1;var _0x4e77da=new AgentComplete(_0x2e3c54,_0x268481);if(_0x268481[_0x9118('0xc7')]===_0x9118('0xc8')){_0x4e77da[_0x9118('0xc9')]=this['voiceQueues'][_0x268481[_0x9118('0xc0')]][_0x9118('0xca')]&&this[_0x9118('0x1e')][_0x268481[_0x9118('0xc0')]][_0x9118('0xcb')]?moment()[_0x9118('0x7f')](_0x9118('0xc5')):undefined;}hopperUtils[_0x9118('0xcc')](_0x4e77da)[_0x9118('0xa5')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x9118('0xcd')](_0x4e77da)[_0x9118('0xa5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x9118('0x1a')]['syncQueueCallerAbandon']=function(_0x1a276f){var _0x3fc900=this[_0x9118('0x25')][_0x1a276f[_0x9118('0xc1')]];var _0xd864ab=this;var _0x1f4c2b=![];var _0x2e37c1;var _0x22fa16;if(this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]]){if(_0x3fc900&&_0x3fc900[_0x9118('0x43')]!==_0x9118('0xc2')){delete this[_0x9118('0x25')][_0x1a276f[_0x9118('0xc1')]];utils['decrementOriginate'](this['voiceQueues'][_0x1a276f['queue']],_0x9118('0xce'));_0x3fc900[_0x9118('0xcf')]=moment()[_0x9118('0x7f')](_0x9118('0xc5'));var _0x2aa555=new QueueCallerAbandon(_0x3fc900,_0x1a276f);if(utils[_0x9118('0x62')](_0x3fc900[_0x9118('0xcf')],_0x3fc900[_0x9118('0xd0')])>=_0x3fc900[_0x9118('0xd1')]){this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]][_0x9118('0x50')]+=0x1;this[_0x9118('0x1e')][_0x1a276f['queue']][_0x9118('0xd2')]+=0x1;this['voiceQueues'][_0x1a276f[_0x9118('0xc0')]][_0x9118('0xd3')]+=0x1;_0x2aa555[_0x9118('0xd4')]=0xa;_0x2aa555[_0x9118('0xd5')]=_0x9118('0xd6');_0x2aa555['dropreason']=_0x9118('0xd7');_0x2aa555[_0x9118('0xc9')]=this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]]['dialQueueProject2']?moment()[_0x9118('0x7f')](_0x9118('0xc5')):undefined;_0x2aa555['countdropretry']+=0x1;_0x2aa555['countglobal']+=0x1;_0x2e37c1=this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]]['dialDropRetryFrequency'];_0x22fa16=this['voiceQueues'][_0x1a276f[_0x9118('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9118('0xd8')](_0x2aa555,_0x2aa555[_0x9118('0xd4')],_0x3fc900[_0x9118('0xd9')])['then'](function(_0x23dceb){_0x1f4c2b=_0x23dceb[_0x9118('0xda')]==0x1;if(_0x2aa555[_0x9118('0xdb')]>=_0xd864ab['voiceQueues'][_0x1a276f['queue']][_0x9118('0xdc')]){_0xd864ab[_0x9118('0xdd')](_0x2aa555,_0x23dceb[_0x9118('0xda')]);}else{hopperUtils[_0x9118('0xde')]({'active':![],'countdropretry':_0x2aa555[_0x9118('0xdb')],'scheduledat':moment()[_0x9118('0xdf')](_0xd864ab[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]][_0x9118('0xe0')],'minutes')[_0x9118('0x7f')](_0x9118('0xc5')),'ContactId':_0x3fc900[_0x9118('0xe1')],'ListId':_0x3fc900[_0x9118('0xe2')],'VoiceQueueId':_0x3fc900[_0x9118('0xe3')]||undefined,'CampaignId':_0x3fc900[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0xe5')));var _0x4f56dd=new History(_0x2aa555);_0x4f56dd['state']=0xa;_0x4f56dd[_0x9118('0xd5')]='Drop';_0x4f56dd[_0x9118('0x72')]=moment()[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f56dd['endtime']=_0x4f56dd['starttime'];_0x4f56dd[_0x9118('0xe6')]=_0x2aa555['calleridname'];_0x4f56dd['calleridnum']=_0x2aa555['calleridnum'];hopperUtils[_0x9118('0xcc')](_0x4f56dd)['catch'](loggerCatch(_0x9118('0xe7')));}})['then'](function(){if(_0x1f4c2b)hopperUtils[_0x9118('0xe8')](_0x2aa555,_0x2e37c1,_0x22fa16)[_0x9118('0x40')](function(){return 0x1;});});}else{this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]][_0x9118('0x51')]+=0x1;this[_0x9118('0x1e')][_0x1a276f['queue']][_0x9118('0xe9')]+=0x1;_0x2aa555[_0x9118('0xd4')]=0xb;_0x2aa555[_0x9118('0xd5')]=_0x9118('0xea');_0x2aa555[_0x9118('0xeb')]='CALLEREXIT';_0x2aa555[_0x9118('0xec')]+=0x1;_0x2aa555['countglobal']+=0x1;_0x2e37c1=this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]]['dialAbandonedRetryFrequency'];_0x22fa16=this[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9118('0xd8')](_0x2aa555,_0x2aa555[_0x9118('0xd4')],_0x3fc900['voiceQueue'])['then'](function(_0x2d82eb){if(_0x2aa555[_0x9118('0xec')]>=_0xd864ab[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]][_0x9118('0xed')]){_0xd864ab[_0x9118('0xdd')](_0x2aa555,_0x2d82eb[_0x9118('0xda')]);}else{hopperUtils[_0x9118('0xde')]({'active':![],'countabandonedretry':_0x2aa555[_0x9118('0xec')],'scheduledat':moment()[_0x9118('0xdf')](_0xd864ab[_0x9118('0x1e')][_0x1a276f[_0x9118('0xc0')]][_0x9118('0xee')],_0x9118('0xef'))[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3fc900[_0x9118('0xe1')],'ListId':_0x3fc900[_0x9118('0xe2')],'VoiceQueueId':_0x3fc900[_0x9118('0xe3')]||undefined,'CampaignId':_0x3fc900[_0x9118('0xe4')]||undefined})['catch'](loggerCatch(_0x9118('0xf0')));var _0x2772d1=new History(_0x2aa555);_0x2772d1[_0x9118('0xd4')]=0xb;_0x2772d1['statedesc']='Abandoned';_0x2772d1[_0x9118('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2772d1['endtime']=_0x2772d1[_0x9118('0x72')];_0x2772d1[_0x9118('0xe6')]=_0x2aa555[_0x9118('0xe6')];_0x2772d1[_0x9118('0xf1')]=_0x2aa555[_0x9118('0xf1')];hopperUtils['createHistory'](_0x2772d1)[_0x9118('0xa5')](loggerCatch(_0x9118('0xf2')));}})[_0x9118('0x40')](function(){if(_0x1f4c2b)hopperUtils[_0x9118('0xe8')](_0x2aa555,_0x2e37c1,_0x22fa16)[_0x9118('0x40')](function(){return 0x1;});});}}}};Dialer[_0x9118('0x1a')]['syncNewExten']=function(_0x43539d){if(this[_0x9118('0x23')][_0x43539d[_0x9118('0xc1')]]){this[_0x9118('0x23')][_0x43539d[_0x9118('0xc1')]][_0x9118('0xf3')]=_0x43539d[_0x9118('0xf3')];}if(this['uniqueId'][_0x43539d[_0x9118('0xc1')]]){this[_0x9118('0x25')][_0x43539d[_0x9118('0xc1')]][_0x9118('0xf3')]=_0x43539d[_0x9118('0xf3')];}};Dialer[_0x9118('0x1a')][_0x9118('0x3b')]=function(_0x2babf8){if(!this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]]){return;}var _0x1f67c2=this[_0x9118('0x1e')][this[_0x9118('0x23')][_0x2babf8['actionid']][_0x9118('0xc0')]][_0x9118('0xf5')]||_0x9118('0xf6');if(_0x1f67c2===_0x9118('0xf7')){if(this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]]&&_['isNil'](this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]][_0x9118('0xf8')])&&_0x2babf8[_0x9118('0x8a')]==='1'&&_0x2babf8[_0x9118('0xf9')]==='0'){if(this[_0x9118('0x20')][_0x2babf8[_0x9118('0xfa')]]){if(!this[_0x9118('0x20')][_0x2babf8[_0x9118('0xfa')]]['locked']){this[_0x9118('0x20')][_0x2babf8[_0x9118('0xfa')]]['locked']=!![];this[_0x9118('0x23')][_0x2babf8['actionid']][_0x9118('0xf8')]=!![];this['actions'][_0x2babf8['actionid']][_0x9118('0xfa')]=_0x2babf8[_0x9118('0xfa')];}}}}else if(_0x1f67c2===_0x9118('0xf6')){if(this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]]){if(this[_0x9118('0x20')][_0x2babf8['stateinterface']]){this[_0x9118('0x23')][_0x2babf8['actionid']][_0x9118('0xfa')]=_0x2babf8[_0x9118('0xfa')];if(_[_0x9118('0xfb')](this[_0x9118('0x29')][this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]]['queue']])){this[_0x9118('0x29')][this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]][_0x9118('0xc0')]]=[];}this[_0x9118('0x29')][this[_0x9118('0x23')][_0x2babf8[_0x9118('0xf4')]][_0x9118('0xc0')]][_0x9118('0x9f')](_[_0x9118('0x61')](_[_0x9118('0x77')](this['actions'][_0x2babf8[_0x9118('0xf4')]],['idHopper',_0x9118('0xfa')]),{'status':_0x2babf8[_0x9118('0x8a')],'paused':_0x2babf8[_0x9118('0xf9')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x1e00a7){if(!this['actions'][_0x1e00a7[_0x9118('0xf4')]]){return;}var _0xa1ca36=this;var _0x6620f=this[_0x9118('0x1e')][this['actions'][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]];var _0xbbba21=_0x6620f[_0x9118('0xf5')]||_0x9118('0xf6');if(_0xbbba21===_0x9118('0xf7')){if(this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]]&&this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xfa')]){this[_0x9118('0x1d')][_0x9118('0xfc')](this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xfd')],this['actions'][_0x1e00a7['actionid']]['stateinterface'])[_0x9118('0xa5')](function(_0x345716){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x9118('0x46')](_0x345716,{'showHidden':![],'depth':null}));})[_0x9118('0xfe')](function(){utils['decrementOriginate'](_0xa1ca36[_0x9118('0x1e')][_0xa1ca36[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]],_0x9118('0xff'));_0xa1ca36[_0x9118('0x20')][_0xa1ca36[_0x9118('0x23')][_0x1e00a7['actionid']]['stateinterface']][_0x9118('0xf8')]=![];delete _0xa1ca36[_0x9118('0x23')][_0x1e00a7['actionid']];unlockQueueStatus(_0x6620f);});}else{utils[_0x9118('0xc3')](this[_0x9118('0x1e')][this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]],_0x9118('0xff'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x1e00a7[_0x9118('0xf4')]]['ContactId'],'ListId':this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xe2')],'VoiceQueueId':this['actions'][_0x1e00a7[_0x9118('0xf4')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x100')));delete this['actions'][_0x1e00a7[_0x9118('0xf4')]];unlockQueueStatus(_0x6620f);}}else if(_0xbbba21===_0x9118('0xf6')){var _0x57661b;if(this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]]&&!_[_0x9118('0x4a')](this[_0x9118('0x29')][this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]])){if(this['queueBookedRR'][_0xa1ca36[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]]){this[_0x9118('0x2a')][_0xa1ca36[_0x9118('0x23')][_0x1e00a7['actionid']]['queue']]=this['queueBookedRR'][this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]]?this[_0x9118('0x2a')][this['actions'][_0x1e00a7[_0x9118('0xf4')]]['queue']]:this[_0x9118('0x29')][this['actions'][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]]?this['queueBooked'][this['actions'][_0x1e00a7['actionid']][_0x9118('0xc0')]][_0x9118('0x101')]||0x0:0x0;}this[_0x9118('0x29')][this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]][_0x9118('0x101')]=this['queueBookedRR'][this[_0x9118('0x23')][_0x1e00a7[_0x9118('0xf4')]][_0x9118('0xc0')]];for(var _0x2fa639=0x0;_0x2fa639=_0x2a71fd[_0x9118('0x126')]){_0x43a8d0[_0x9118('0x127')](_0x4966bd,_0x4167ca,_0x5458ec,'reason19\x20machine....');}else{if(_0x4966bd['countmachineretry']>=_0x2a71fd[_0x9118('0x128')]){_0x43a8d0[_0x9118('0x129')](_0x4966bd,_0x4167ca,_0x5458ec,'reason\x2019\x20machine....');}else{hopperUtils[_0x9118('0xde')]({'active':![],'countmachineretry':_0x4966bd[_0x9118('0x11c')],'scheduledat':moment()['add'](_0x2a71fd[_0x9118('0x12a')],_0x9118('0xef'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4966bd['ContactId'],'ListId':_0x4966bd[_0x9118('0xe2')],'VoiceQueueId':_0x4966bd['VoiceQueueId']||undefined,'CampaignId':_0x4966bd[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch('[rescheduleContact][Machine]'));_0x4167ca({'reschedule':0x1});}}});}if(_0x59cc74[_0x9118('0x43')]===_0x9118('0xc2')&&this[_0x9118('0x1f')][_0x59cc74['queue']][_0x9118('0x110')]&&_0x17e621['value']==='HANGUP'){delete this[_0x9118('0x25')][_0x17e621['uniqueid']];utils[_0x9118('0xc3')](this[_0x9118('0x1f')][_0x59cc74[_0x9118('0xc0')]],_0x9118('0x11a'));_0x155a39=new Hangup(_0x59cc74,_0x17e621);_0x155a39['state']=0x12;_0x155a39[_0x9118('0xd5')]=_0x9118('0x113');_0x155a39['membername']='AMD';ami[_0x9118('0x42')](_0x9118('0x11e'),ut[_0x9118('0x11f')](_0x155a39,_0x9118('0x115')));this[_0x9118('0x116')](_0x155a39,_0x9118('0x12b'),_0x9118('0x12c'));}if(_0x59cc74[_0x9118('0x43')]===_0x9118('0xc2')&&this[_0x9118('0x1f')][_0x59cc74[_0x9118('0xc0')]][_0x9118('0x110')]&&_0x17e621['value']==='MACHINE'){return new Promise(function(_0x1bf420,_0x2a99e5){delete _0x43a8d0[_0x9118('0x25')][_0x17e621[_0x9118('0xc1')]];utils[_0x9118('0xc3')](_0x43a8d0[_0x9118('0x1f')][_0x59cc74['queue']],'[syncVarSet]');_0x43a8d0[_0x9118('0x1f')][_0x59cc74[_0x9118('0xc0')]]['outboundAnswerCallsDay']+=0x1;_0x43a8d0['campaigns'][_0x59cc74[_0x9118('0xc0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x45f8f7=_0x43a8d0[_0x9118('0x1f')][_0x59cc74[_0x9118('0xc0')]];var _0x2f9ac0=new Hangup(_0x59cc74,_0x17e621);_0x2f9ac0[_0x9118('0xd4')]=0x13;_0x2f9ac0['statedesc']=_0x9118('0x12d');_0x2f9ac0[_0x9118('0x11b')]=_0x9118('0x114');_0x2f9ac0[_0x9118('0x11c')]+=0x1;_0x2f9ac0[_0x9118('0x11d')]+=0x1;_0x2f9ac0[_0x9118('0x115')]=!![];ami['emit'](_0x9118('0x11e'),ut[_0x9118('0x11f')](_0x2f9ac0,_0x9118('0x115')));hopperUtils[_0x9118('0xcc')](_0x2f9ac0)['catch'](loggerCatch(_0x9118('0x120')));if(_0x2f9ac0['countbusyretry']+_0x2f9ac0[_0x9118('0x122')]+_0x2f9ac0['countnoanswerretry']+_0x2f9ac0['countnosuchnumberretry']+_0x2f9ac0[_0x9118('0xdb')]+_0x2f9ac0[_0x9118('0xec')]+_0x2f9ac0['countmachineretry']+_0x2f9ac0[_0x9118('0x125')]>=_0x45f8f7['dialGlobalMaxRetry']){_0x43a8d0[_0x9118('0x127')](_0x2f9ac0,_0x1bf420,_0x2a99e5,_0x9118('0x12e'));}else{if(_0x2f9ac0[_0x9118('0x11c')]>=_0x45f8f7['dialMachineMaxRetry']){_0x43a8d0[_0x9118('0x129')](_0x2f9ac0,_0x1bf420,_0x2a99e5,_0x9118('0x12f'));}else{hopperUtils[_0x9118('0xde')]({'active':![],'countmachineretry':_0x2f9ac0[_0x9118('0x11c')],'scheduledat':moment()['add'](_0x45f8f7[_0x9118('0x12a')],_0x9118('0xef'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f9ac0['ContactId'],'ListId':_0x2f9ac0[_0x9118('0xe2')],'VoiceQueueId':_0x2f9ac0[_0x9118('0xe3')]||undefined,'CampaignId':_0x2f9ac0[_0x9118('0xe4')]||undefined})['catch'](loggerCatch(_0x9118('0x130')));_0x1bf420({'reschedule':0x1});}}});}}};Dialer[_0x9118('0x1a')][_0x9118('0x36')]=function(_0x28ba28){var _0x1852b8=this[_0x9118('0x25')][_0x28ba28['uniqueid']];var _0xf56de0;if(_0x1852b8){if(_0x1852b8[_0x9118('0x43')]==='ivr'){delete this[_0x9118('0x25')][_0x28ba28[_0x9118('0xc1')]];utils[_0x9118('0xc3')](this[_0x9118('0x1f')][_0x1852b8[_0x9118('0xc0')]],_0x9118('0x131'));this[_0x9118('0x1f')][_0x1852b8[_0x9118('0xc0')]][_0x9118('0x132')]+=0x1;_0xf56de0=new Hangup(_0x1852b8,_0x28ba28);hopperUtils[_0x9118('0xcc')](_0xf56de0)[_0x9118('0xa5')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x9118('0xcd')](_0xf56de0)['catch'](loggerCatch(_0x9118('0x133')));}else{if(isNotNull(this[_0x9118('0x1e')][_0x1852b8[_0x9118('0xc0')]][_0x9118('0x134')])){delete this[_0x9118('0x25')][_0x28ba28['uniqueid']];utils[_0x9118('0xc3')](this[_0x9118('0x1e')][_0x1852b8[_0x9118('0xc0')]],_0x9118('0x131'));this[_0x9118('0x1e')][_0x1852b8[_0x9118('0xc0')]][_0x9118('0xc6')]+=0x1;this[_0x9118('0x1e')][_0x1852b8['queue']][_0x9118('0x112')]+=0x1;_0xf56de0=new Hangup(_0x1852b8,_0x28ba28);_0xf56de0[_0x9118('0xd4')]=0x10;_0xf56de0[_0x9118('0xd5')]='AnswerAGI';_0xf56de0['membername']=_0x9118('0x135');hopperUtils[_0x9118('0xcc')](_0xf56de0)[_0x9118('0xa5')](loggerCatch(_0x9118('0x136')));hopperUtils['moveContactManagedDialer'](_0xf56de0)['catch'](loggerCatch(_0x9118('0x133')));}else{delete this[_0x9118('0x25')][_0x28ba28[_0x9118('0xc1')]];utils[_0x9118('0xc3')](this['voiceQueues'][_0x1852b8[_0x9118('0xc0')]],'[syncHangup2]');if(_0x28ba28['cause-txt']===_0x9118('0x137')){this[_0x9118('0x1e')][_0x1852b8['queue']]['outboundAnswerCallsDay']+=0x1;const _0x4a9fa9=new AgentComplete(_0x1852b8,_0x28ba28);_0x4a9fa9[_0x9118('0xe4')]=this[_0x9118('0x1e')][_0x1852b8[_0x9118('0xc0')]]['id'];hopperUtils[_0x9118('0xcc')](_0x4a9fa9)[_0x9118('0xa5')](loggerCatch(_0x9118('0x138')));hopperUtils[_0x9118('0xcd')](_0x4a9fa9)['catch'](loggerCatch(_0x9118('0x139')));}else{this[_0x9118('0x1e')][_0x1852b8[_0x9118('0xc0')]]['outboundUnknownCallsDay']+=0x1;_0xf56de0=new Hangup(_0x1852b8,_0x28ba28);_0xf56de0[_0x9118('0xd4')]=0xc;_0xf56de0[_0x9118('0xd5')]=_0x28ba28[_0x9118('0x13a')];_0xf56de0['membername']=_0x9118('0x13b');hopperUtils['createHistory'](_0xf56de0)[_0x9118('0xa5')](loggerCatch(_0x9118('0x136')));hopperUtils['moveContactManagedDialer'](_0xf56de0)[_0x9118('0xa5')](loggerCatch(_0x9118('0x133')));}}}}};Dialer['prototype']['syncQueueSummary']=function(_0x24b697){var _0x1fea46=this;if(!_0x1fea46[_0x9118('0x2b')][_0x24b697[_0x9118('0x48')]]){_0x1fea46[_0x9118('0x2b')][_0x24b697[_0x9118('0x48')]]={'running':![]};}else if(_0x1fea46['queuesSummary'][_0x24b697['name']]['running']===!![]){return;}else if(_0x1fea46['queuesSummary'][_0x24b697[_0x9118('0x48')]]['running']===![]){_0x1fea46[_0x9118('0x2b')][_0x24b697['name']][_0x9118('0x13c')]=!![];}var _0x1c4de4=_0x1fea46[_0x9118('0x1e')][_0x24b697['name']];var _0xb68f26=_0x1c4de4[_0x9118('0x6e')]!==utils['CAMPAIGN_STATUS'][_0x9118('0x7d')];var _0x201983=utils[_0x9118('0x13d')](_0x1c4de4);_0x1c4de4[_0x9118('0x13e')]=utils[_0x9118('0x13f')](_0x1c4de4,_0x1fea46['trunks']);Promise[_0x9118('0xb0')]()[_0x9118('0x40')](function(){if(_0x1c4de4[_0x9118('0x13e')]===utils[_0x9118('0x6b')]['INACTIVE']){if(_0xb68f26){clearPredictiveAttributes(_0x1c4de4);_0x24b697[_0x9118('0x27')]=undefined;_0x24b697[_0x9118('0x63')]=undefined;}if(_0x1c4de4['statusMessage']===utils[_0x9118('0x6b')]['INACTIVE']){_0x24b697[_0x9118('0x140')]=0x0;_0x24b697['paused']=0x0;_0x24b697['inUse']=0x0;_0x24b697['talking']=0x0;_0x24b697[_0x9118('0x141')]=0x0;}}else if(_0x1c4de4[_0x9118('0x13e')]===utils[_0x9118('0x6b')][_0x9118('0x142')]&&!_0x201983){return _0x1fea46[_0x9118('0x95')](_0x1c4de4,!![])[_0x9118('0x40')](function(){return _0x1fea46[_0x9118('0x95')](_0x1c4de4,![]);})[_0x9118('0x40')](function(){return _0x1fea46[_0x9118('0xb4')](_0x1c4de4);})[_0x9118('0xa5')](function(_0x5336d1){loggerSyncQueueSummary[_0x9118('0x44')](_0x9118('0x143'),util[_0x9118('0x46')](_0x5336d1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1c4de4);});}else{clearPredictiveAttributes(_0x1c4de4);}})[_0x9118('0x40')](function(){var _0x1f2163=_0x24b697[_0x9118('0x144')](_0x1c4de4);if(_0x1f2163||_0x1c4de4[_0x9118('0x145')]){_0x1c4de4[_0x9118('0x145')]=![];_0x24b697[_0x9118('0x146')](_0x1c4de4);Object[_0x9118('0x147')](_0x1c4de4,_0x24b697);emitOutboundVoiceQueueSummary(_0x24b697);}_0x1fea46[_0x9118('0x2b')][_0x1c4de4[_0x9118('0x48')]][_0x9118('0x13c')]=![];})['catch'](function(_0x1ae0c1){logger['error'](_0x9118('0x143'),util[_0x9118('0x46')](_0x1ae0c1,{'showHidden':![],'depth':null}));_0x1fea46[_0x9118('0x2b')][_0x1c4de4[_0x9118('0x48')]]['running']=![];});};Dialer[_0x9118('0x1a')][_0x9118('0x148')]=_[_0x9118('0x149')](function(){var _0x2467b9=_[_0x9118('0x14a')](this[_0x9118('0x1e')],function(_0xdcb317){return _0xdcb317[_0x9118('0x14b')];});var _0x5d2455=_[_0x9118('0x14a')](this[_0x9118('0x20')],function(_0x4844d8){return _0x4844d8[_0x9118('0x14c')]&&_0x4844d8[_0x9118('0x8a')]===_0x9118('0x8b');});if(_0x2467b9[_0x9118('0x9e')]>0x0&&_0x5d2455['length']>0x0){return Promise[_0x9118('0xb0')]()[_0x9118('0x40')](cmHopper[_0x9118('0x14d')](_['map'](_0x2467b9,'id'),previewRecallmeReminderInterval,_[_0x9118('0x14e')](_0x5d2455,'id')))[_0x9118('0x40')](function(_0x48d0f7){for(var _0x1252db=0x0;_0x1252db<_0x48d0f7[_0x9118('0x9e')];_0x1252db++){var _0x48d92c=_0x48d0f7[_0x1252db][_0x9118('0x14f')][_0x9118('0x48')];if(_0x48d92c)io['to'](util[_0x9118('0x7f')](_0x9118('0x150'),_0x48d92c))[_0x9118('0x42')](_0x9118('0x151'),{'hopper':_0x48d0f7[_0x1252db]});}})[_0x9118('0xa5')](function(_0x20fb05){logger[_0x9118('0x68')](_0x9118('0x152'),_0x20fb05);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9118('0x1a')][_0x9118('0x153')]=function(){var _0x4af513=this;setInterval(function(){_0x4af513[_0x9118('0x154')](_0x4af513[_0x9118('0x25')],_0x9118('0x155'));_0x4af513[_0x9118('0x154')](_0x4af513['actions'],'[actions]');},0x32c8);};Dialer[_0x9118('0x1a')][_0x9118('0x154')]=function(_0x2bca07,_0x526df1){var _0x18aa41=this;for(var _0x33e5a7 in _0x2bca07){if(typeof _0x2bca07[_0x33e5a7]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x9118('0xfb')](_0x2bca07[_0x33e5a7])){return ami[_0x9118('0xa0')]({'action':'status','channel':_0x2bca07[_0x33e5a7][_0x9118('0xf3')]})[_0x9118('0xa5')](function(_0xe81085){if(_0xe81085[_0x9118('0x6e')]===_0x9118('0x156')){setTimeout(function(){if(_0x2bca07[_0x33e5a7]&&_0x2bca07[_0x33e5a7][_0x9118('0x43')]!==_0x9118('0xc2')){utils['decrementOriginate'](_0x18aa41['voiceQueues'][_0x2bca07[_0x33e5a7][_0x9118('0xc0')]],'[clearZombieChannels]');logger[_0x9118('0x68')](_0x9118('0x157'),_0x526df1,_0x33e5a7,_0x2bca07[_0x33e5a7][_0x9118('0xc0')]);delete _0x2bca07[_0x33e5a7];}if(_0x2bca07[_0x33e5a7]&&_0x2bca07[_0x33e5a7][_0x9118('0x43')]===_0x9118('0xc2')){utils[_0x9118('0xc3')](_0x18aa41[_0x9118('0x1f')][_0x2bca07[_0x33e5a7][_0x9118('0xc0')]],_0x9118('0x158'));logger['error'](_0x9118('0x159'),_0x526df1,_0x33e5a7,_0x2bca07[_0x33e5a7][_0x9118('0xc0')]);delete _0x2bca07[_0x33e5a7];}},0x2328);}});}});}}};Dialer['prototype'][_0x9118('0x15a')]=function(_0x516791){return Promise[_0x9118('0xb0')]()[_0x9118('0x40')](voiceQueueRt[_0x9118('0x15a')](_0x516791))[_0x9118('0xa5')](loggerCatch(_0x9118('0x15b')));};Dialer[_0x9118('0x1a')][_0x9118('0x15c')]=function(_0x1ef441,_0x4a4a5d,_0x5c3887){var _0x455e2f={'state':0x19,'statedesc':'notFound'};utils[_0x9118('0xc3')](_0x4a4a5d,'[emptyContact]'+_0x1ef441);this[_0x9118('0x116')](_[_0x9118('0x61')](_0x455e2f,_['pick'](_0x5c3887,[_0x9118('0xe1'),_0x9118('0xe2'),_0x9118('0x15d'),'VoiceQueueId',_0x9118('0xe4')])),_0x9118('0x15e'),_0x9118('0x15f'));logger['error'](_0x1ef441);};Dialer['prototype']['saveInDb']=function(_0x4ef9a1,_0x512e7b,_0xaa90b8){hopperUtils['createHistory'](_0x4ef9a1)['catch'](loggerCatch(_0x512e7b));hopperUtils[_0x9118('0xcd')](_0x4ef9a1)['catch'](loggerCatch(_0xaa90b8));};Dialer[_0x9118('0x1a')]['queueCallerAbandonCreateState']=function(_0x5449e5,_0x28ecdd){hopperUtils[_0x9118('0xcc')](_0x5449e5)[_0x9118('0xa5')](loggerCatch(_0x9118('0x138')));if(_0x28ecdd==0x0){hopperUtils['moveContactManagedDialer'](_0x5449e5)['catch'](loggerCatch(_0x9118('0x160')));}};Dialer['prototype'][_0x9118('0x152')]=function(_0x4ea547){return Promise[_0x9118('0xb0')]()[_0x9118('0x40')](cmHopper[_0x9118('0x14d')](_0x4ea547['id'],previewRecallmeReminderInterval))[_0x9118('0x40')](function(_0x2489fb){for(var _0x33cbaf=0x0;_0x33cbaf<_0x2489fb[_0x9118('0x9e')];_0x33cbaf++){var _0x3ec931=_0x2489fb[_0x33cbaf][_0x9118('0x14f')][_0x9118('0x48')];if(_0x3ec931)io['to'](util[_0x9118('0x7f')](_0x9118('0x150'),_0x3ec931))['emit'](_0x9118('0x151'),{'hopper':_0x2489fb[_0x33cbaf]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x4eb47a){var _0xe06df0=this;return function(){_0xe06df0[_0x9118('0x161')](_0x4eb47a);};};Dialer[_0x9118('0x1a')][_0x9118('0x162')]=function(_0x28e8c4,_0x56fd3f){var _0xd1d2b1=this;var _0x3bb8a5=uuid['v4']();this[_0x9118('0x23')][_0x3bb8a5]=new Action(_0x28e8c4,_0x56fd3f,_0x3bb8a5);return new Promise(function(_0x5ef633,_0x3218d0){if(_[_0x9118('0x55')](_0x28e8c4)&&typeof _0x28e8c4!==_0x9118('0x163')){return _0x3218d0(msgResponse('originate',_0x9118('0x96'),_0x9118('0x164')));}if(_[_0x9118('0x55')](_0x56fd3f['phone'])||_0x56fd3f[_0x9118('0x165')]===null){return _0x3218d0(msgResponse('originate',_0x9118('0x96'),_0x9118('0x166')));}var _0x6fdc82={'XMD-CALLERID':_0xd1d2b1['actions'][_0x3bb8a5][_0x9118('0x167')](),'XMD-AGI':_0x28e8c4['dialQueueProject']?util[_0x9118('0x7f')](_0x9118('0x168'),ipAgi,_0x28e8c4[_0x9118('0x134')]):_0x9118('0x169'),'XMD-AGIAFTER':_0x28e8c4['dialQueueProject2']?util[_0x9118('0x7f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x28e8c4[_0x9118('0xca')]):'NONE','XMD-QUEUE':utils[_0x9118('0x16a')](_0x28e8c4)?util[_0x9118('0x7f')](_0x9118('0x16b'),_0x28e8c4[_0x9118('0x48')],_0x28e8c4[_0x9118('0x16c')]||'',_0x28e8c4[_0x9118('0xcb')]?'c':'',_0x28e8c4[_0x9118('0xd1')]||0x3):_0x9118('0x169'),'XMD-CONTACTID':_0x56fd3f[_0x9118('0xe1')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xd1d2b1[_0x9118('0x23')][_0x3bb8a5][_0x9118('0x167')](),'XMD-AMD':_0x28e8c4[_0x9118('0x110')]?'ACTIVE':_0x9118('0x169'),'XMD-DESTINATION':_0x9118('0x10f')};if(_0x28e8c4['dialAMDActive']){_0x6fdc82[_0x9118('0x16d')]=_0x28e8c4[_0x9118('0x16e')]||0x9c4;_0x6fdc82[_0x9118('0x16f')]=_0x28e8c4[_0x9118('0x170')]||0x5dc;_0x6fdc82[_0x9118('0x171')]=_0x28e8c4[_0x9118('0x172')]||0x320;_0x6fdc82[_0x9118('0x173')]=_0x28e8c4[_0x9118('0x174')]||0x1388;_0x6fdc82[_0x9118('0x175')]=_0x28e8c4[_0x9118('0x176')]||0x64;_0x6fdc82[_0x9118('0x177')]=_0x28e8c4[_0x9118('0x178')]||0x32;_0x6fdc82[_0x9118('0x179')]=_0x28e8c4['dialAMDMaximumNumberOfWords']||0x3;_0x6fdc82[_0x9118('0x17a')]=_0x28e8c4[_0x9118('0x17b')]||0x100;_0x6fdc82[_0x9118('0x17c')]=_0x28e8c4['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x28e8c4)){_0x6fdc82[_0x9118('0x17d')]=_0x56fd3f[_0x9118('0xe3')];}else{_0x6fdc82[_0x9118('0x17e')]=_0x56fd3f[_0x9118('0xe4')];}var _0x5393be=utils[_0x9118('0x17f')](_0x56fd3f[_0x9118('0x180')]);Object[_0x9118('0x147')](_0x6fdc82,_0x5393be);var _0x211149=_0xd1d2b1['isTrunkReachable'](_0x28e8c4[_0x9118('0x8f')])?utils[_0x9118('0x181')](_0x28e8c4[_0x9118('0x8f')][_0x9118('0x182')],_0x28e8c4[_0x9118('0x183')],_0x28e8c4[_0x9118('0x184')]>0x0?utils[_0x9118('0x185')](_0x28e8c4[_0x9118('0x186')],_0x28e8c4[_0x9118('0x184')]):_0x28e8c4['dialOriginateCallerIdNumber']):utils[_0x9118('0x181')](_[_0x9118('0xfb')](_0x28e8c4[_0x9118('0x90')])?_0x28e8c4[_0x9118('0x8f')]['callerid']:_0x28e8c4[_0x9118('0x90')][_0x9118('0x182')],_0x28e8c4[_0x9118('0x183')],_0x28e8c4['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x9118('0x185')](_0x28e8c4[_0x9118('0x186')],_0x28e8c4[_0x9118('0x184')]):_0x28e8c4['dialOriginateCallerIdNumber']);if(_0x211149){_0x6fdc82[_0x9118('0x187')]=_0xd1d2b1[_0x9118('0x23')][_0x3bb8a5][_0x9118('0x188')]=utils[_0x9118('0x189')](_0x211149);_0x6fdc82['XMD-ORIGINATECALLERIDNUM']=_0x56fd3f['phone'];}_0x28e8c4[_0x9118('0x18a')]=_0x6fdc82;return ami[_0x9118('0xa0')]({'actionid':_0x3bb8a5,'action':_0x9118('0x18b'),'channel':_0xd1d2b1[_0x9118('0x88')](_0x28e8c4['Trunk'])?util[_0x9118('0x7f')](_0x9118('0x18c'),_0x28e8c4[_0x9118('0x8f')][_0x9118('0x48')],isNotNull(_0x28e8c4[_0x9118('0x18d')])?_0x28e8c4[_0x9118('0x18d')][_0x9118('0x18e')]()||'':'',_0x28e8c4[_0x9118('0x18f')]>0x0?_0x56fd3f[_0x9118('0x165')]['substring'](_0x28e8c4[_0x9118('0x18f')]):_0x56fd3f[_0x9118('0x165')]):util[_0x9118('0x7f')](_0x9118('0x18c'),_[_0x9118('0xfb')](_0x28e8c4[_0x9118('0x90')])?_0x28e8c4[_0x9118('0x8f')]['name']:_0x28e8c4[_0x9118('0x90')][_0x9118('0x48')],isNotNull(_0x28e8c4[_0x9118('0x18d')])?_0x28e8c4['dialPrefix'][_0x9118('0x18e')]()||'':'',_0x28e8c4[_0x9118('0x18f')]>0x0?_0x56fd3f['phone'][_0x9118('0x190')](_0x28e8c4['dialCutDigit']):_0x56fd3f[_0x9118('0x165')]),'callerid':_0x211149,'Exten':'xcally-motion-dialer','Context':_0x9118('0x191'),'Priority':'1','variable':_0x6fdc82,'timeout':(_0x28e8c4['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3bb8a5})[_0x9118('0x40')](function(_0x1b7edb){return _0x5ef633(_0x1b7edb);})[_0x9118('0xa5')](function(_0x365e0f){_0x28e8c4[_0x9118('0x192')]+=0x1;var _0x3ff7e0=new History(_0xd1d2b1[_0x9118('0x23')][_0x3bb8a5]);logger[_0x9118('0x68')](util[_0x9118('0x7f')](_0x9118('0x193'),JSON[_0x9118('0x76')](_0x365e0f)));_0x3ff7e0['state']=0xe;_0x3ff7e0[_0x9118('0xd5')]=_0x9118('0x194');_0x3ff7e0['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3ff7e0['endtime']=_0x3ff7e0[_0x9118('0x72')];hopperUtils[_0x9118('0xcc')](_0x3ff7e0)['catch'](loggerCatch(_0x9118('0x195')));_0xd1d2b1['moveContactManagedDialer'](_0x3ff7e0)[_0x9118('0xa5')](loggerCatch(_0x9118('0x195')))[_0x9118('0xfe')](function(){delete _0xd1d2b1[_0x9118('0x23')][_0x3bb8a5];return _0x3218d0(msgResponse('originate',_0x9118('0x87'),_0x9118('0x196')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x60fadd,_0x32db7d,_0x1b636b){var _0x3906c5=new History(_0x32db7d);if(_0x3906c5['countbusyretry']+_0x3906c5[_0x9118('0x122')]+_0x3906c5[_0x9118('0x123')]+_0x3906c5[_0x9118('0x124')]+_0x3906c5[_0x9118('0xdb')]+_0x3906c5['countabandonedretry']+_0x3906c5[_0x9118('0x11c')]+_0x3906c5[_0x9118('0x125')]>=_0x1b636b[_0x9118('0x126')]-0x1){return!![];}switch(_0x60fadd){case 0x3:if(_0x3906c5[_0x9118('0x123')]>=_0x1b636b[_0x9118('0x197')]-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countnoanswerretry':_0x3906c5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x9118('0xdf')](_0x1b636b[_0x9118('0x198')],_0x9118('0xef'))[_0x9118('0x7f')](_0x9118('0xc5')),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5['VoiceQueueId']||undefined,'CampaignId':_0x3906c5[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x199')));break;case 0x5:if(_0x3906c5[_0x9118('0x121')]>=_0x1b636b[_0x9118('0x19a')]-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countbusyretry':_0x3906c5[_0x9118('0x121')]+=0x1,'scheduledat':moment()[_0x9118('0xdf')](_0x1b636b[_0x9118('0x19b')],_0x9118('0xef'))[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5['ListId'],'VoiceQueueId':_0x3906c5[_0x9118('0xe3')]||undefined,'CampaignId':_0x3906c5[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x19c')));break;case 0x8:if(_0x3906c5['countcongestionretry']>=_0x1b636b[_0x9118('0x19d')]-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countcongestionretry':_0x3906c5[_0x9118('0x122')]+=0x1,'scheduledat':moment()['add'](_0x1b636b[_0x9118('0x19e')],_0x9118('0xef'))[_0x9118('0x7f')](_0x9118('0xc5')),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5[_0x9118('0xe3')]||undefined,'CampaignId':_0x3906c5[_0x9118('0xe4')]||undefined})['catch'](loggerCatch(_0x9118('0x19f')));break;case 0x0:if(_0x3906c5['countnosuchnumberretry']>=_0x1b636b['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x9118('0xde')]({'active':![],'countnosuchnumberretry':_0x3906c5[_0x9118('0x124')]+=0x1,'scheduledat':moment()['add'](_0x1b636b[_0x9118('0x1a0')],_0x9118('0xef'))[_0x9118('0x7f')](_0x9118('0xc5')),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5['ListId'],'VoiceQueueId':_0x3906c5[_0x9118('0xe3')]||undefined,'CampaignId':_0x3906c5['CampaignId']||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x1a1')));}break;case 0xa:if(_0x3906c5[_0x9118('0xdb')]>=_0x1b636b['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countdropretry':_0x3906c5[_0x9118('0xdb')]+=0x1,'scheduledat':moment()['add'](_0x1b636b[_0x9118('0xe0')],_0x9118('0xef'))[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5[_0x9118('0xe3')]||undefined,'CampaignId':_0x3906c5['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3906c5[_0x9118('0xec')]>=_0x1b636b['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countabandonedretry':_0x3906c5[_0x9118('0xec')]+=0x1,'scheduledat':moment()[_0x9118('0xdf')](_0x1b636b[_0x9118('0xee')],'minutes')['format'](_0x9118('0xc5')),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5['VoiceQueueId']||undefined,'CampaignId':_0x3906c5[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0xf0')));break;case 0x13:if(_0x3906c5[_0x9118('0x11c')]>=_0x1b636b[_0x9118('0x128')]-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countmachineretry':_0x3906c5['countmachineretry']+=0x1,'scheduledat':moment()[_0x9118('0xdf')](_0x1b636b[_0x9118('0x12a')],_0x9118('0xef'))[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3906c5['ContactId'],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5[_0x9118('0xe3')]||undefined,'CampaignId':_0x3906c5[_0x9118('0xe4')]||undefined})['catch'](loggerCatch(_0x9118('0x130')));break;case 0x14:if(_0x3906c5['countagentrejectretry']>=_0x1b636b[_0x9118('0x1a2')]-0x1){return!![];}hopperUtils[_0x9118('0xde')]({'active':![],'countagentrejectretry':_0x3906c5[_0x9118('0x125')]+=0x1,'scheduledat':moment()[_0x9118('0xdf')](_0x1b636b[_0x9118('0x1a3')],'minutes')[_0x9118('0x7f')](_0x9118('0xc5')),'ContactId':_0x3906c5[_0x9118('0xe1')],'ListId':_0x3906c5[_0x9118('0xe2')],'VoiceQueueId':_0x3906c5['VoiceQueueId']||undefined,'CampaignId':_0x3906c5['CampaignId']||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x1a4')));break;default:return!![];}};Dialer[_0x9118('0x1a')][_0x9118('0x1a5')]=function(_0x42ca19,_0x1155b3,_0x14871b){var _0x23d2d5=this;var _0x58a4f4=new History(_0x42ca19);var _0xc1a18c=![];var _0x207033;var _0x106858;return new Promise(function(_0x31a0b2,_0x104321){if(_[_0x9118('0x55')](_0x1155b3)&&typeof _0x1155b3!==_0x9118('0x163')){return _0x104321(msgResponse('[callProgressDetecting]','Failure',_0x9118('0x1a6')));}if(_['isUndefined'](_0x14871b)&&typeof _0x14871b!==_0x9118('0x163')){return _0x104321(msgResponse(_0x9118('0x1a7'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x58a4f4,_0x14871b[_0x9118('0xc7')],_0x1155b3)[_0x9118('0x40')](function(_0x38bbb9){if(_0x38bbb9['additional']==0x1)_0xc1a18c=!![];switch(_0x14871b[_0x9118('0xc7')]){case'0':_0x1155b3['outboundNoSuchCallsDay']+=0x1;_0x58a4f4['state']=0x0;_0x58a4f4[_0x9118('0xd5')]=_0x9118('0x1a8');_0x58a4f4[_0x9118('0x124')]+=0x1;_0x58a4f4[_0x9118('0x11d')]+=0x1;ami[_0x9118('0x42')]('custom:agentnosuchnumber',ut[_0x9118('0x11f')](_0x42ca19,_0x9118('0x1a9')));_0x207033=_0x1155b3['dialNoSuchNumberRetryFrequency'];_0x106858=_0x1155b3[_0x9118('0x1aa')];hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x120')));if(_0x23d2d5['checkRetriveMax'](0x0,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0x124')]>=_0x1155b3['dialNoSuchNumberMaxRetry']){_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1ab'));}else{_0x23d2d5[_0x9118('0x127')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1ab'));}}break;case'3':_0x1155b3[_0x9118('0x1ac')]+=0x1;_0x58a4f4[_0x9118('0xd4')]=0x3;_0x58a4f4[_0x9118('0xd5')]=_0x9118('0x1ad');_0x58a4f4[_0x9118('0x123')]+=0x1;_0x58a4f4['countglobal']+=0x1;var _0x1937ce=ut[_0x9118('0x1ae')](_0x42ca19,_0x1155b3);ami[_0x9118('0x42')]('custom:agentnoanswer',_0x1937ce);_0x207033=_0x1155b3[_0x9118('0x198')];_0x106858=_0x1155b3[_0x9118('0x1aa')];hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x1af')));if(_0x23d2d5[_0x9118('0x1b0')](0x3,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0x123')]>=_0x1155b3[_0x9118('0x197')]){_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1b1'));}else{_0x23d2d5['stateGlobal'](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1b1'));}}break;case'5':_0x1155b3[_0x9118('0x1b2')]+=0x1;_0x58a4f4['state']=0x5;_0x58a4f4[_0x9118('0xd5')]=_0x9118('0x1b3');_0x58a4f4[_0x9118('0x121')]+=0x1;_0x58a4f4[_0x9118('0x11d')]+=0x1;ami['emit'](_0x9118('0x1b4'),ut[_0x9118('0x11f')](_0x42ca19,'busy'));_0x207033=_0x1155b3['dialBusyRetryFrequency'];_0x106858=_0x1155b3[_0x9118('0x1aa')];hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x1b5')));if(_0x23d2d5[_0x9118('0x1b0')](0x5,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0x121')]>=_0x1155b3['dialBusyMaxRetry']){_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1b6'));}else{_0x23d2d5[_0x9118('0x127')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1b6'));}}break;case'8':_0x1155b3[_0x9118('0x1b7')]+=0x1;_0x58a4f4[_0x9118('0xd4')]=0x8;_0x58a4f4[_0x9118('0xd5')]=_0x9118('0x1b8');_0x58a4f4[_0x9118('0x122')]+=0x1;_0x58a4f4[_0x9118('0x11d')]+=0x1;_0x207033=_0x1155b3['dialCongestionRetryFrequency'];_0x106858=_0x1155b3['callAdditionalPhoneAfterMin'];ami['emit'](_0x9118('0x1b9'),ut['buildObj'](_0x42ca19,_0x9118('0x1ba')));hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x1bb')));if(_0x23d2d5['checkRetriveMax'](0x8,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0x122')]>=_0x1155b3[_0x9118('0x19d')]){_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1bc'));}else{_0x23d2d5[_0x9118('0x127')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1bc'));}}break;case'11':_0x1155b3[_0x9118('0x1bd')]+=0x1;_0x58a4f4[_0x9118('0xd4')]=0xb;_0x58a4f4[_0x9118('0xd5')]=_0x9118('0xea');_0x58a4f4[_0x9118('0xec')]+=0x1;_0x58a4f4[_0x9118('0x11d')]+=0x1;_0x207033=_0x1155b3[_0x9118('0xee')];_0x106858=_0x1155b3['callAdditionalPhoneAfterMin'];hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x23d2d5[_0x9118('0x1b0')](0xb,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0xec')]>=_0x1155b3[_0x9118('0xed')]){_0x23d2d5['createStateFinal'](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1be'));}else{_0x23d2d5['stateGlobal'](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1be'));}}break;case'20':_0x1155b3[_0x9118('0x1bf')]+=0x1;_0x58a4f4['state']=0x14;_0x58a4f4[_0x9118('0xd5')]='AgentReject';_0x58a4f4[_0x9118('0x125')]+=0x1;_0x58a4f4[_0x9118('0x11d')]+=0x1;_0x207033=_0x1155b3[_0x9118('0x1a3')];_0x106858=_0x1155b3[_0x9118('0x1aa')];ami[_0x9118('0x42')]('custom:agentreject',ut[_0x9118('0x11f')](_0x42ca19,'agentreject'));hopperUtils['createHistory'](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x1c0')));if(_0x23d2d5[_0x9118('0x1b0')](0x14,_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4['countagentrejectretry']>=_0x1155b3[_0x9118('0x1a2')]){_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1c1'));}else{_0x23d2d5[_0x9118('0x127')](_0x58a4f4,_0x31a0b2,_0x104321,_0x9118('0x1c1'));}}break;default:_0x1155b3[_0x9118('0x1c2')]+=0x1;_0x58a4f4[_0x9118('0xd4')]=0xc;_0x58a4f4[_0x9118('0xd5')]=_0x14871b['reason'];_0x207033=_0x1155b3['dialAgentRejectRetryFrequency'];_0x106858=_0x1155b3[_0x9118('0x1aa')];hopperUtils[_0x9118('0xcc')](_0x58a4f4)[_0x9118('0xa5')](loggerCatch(_0x9118('0x1c3')));if(_0x23d2d5[_0x9118('0x1b0')](_0x14871b[_0x9118('0xc7')],_0x42ca19,_0x1155b3)&&!_0xc1a18c){if(_0x58a4f4[_0x9118('0x121')]+_0x58a4f4[_0x9118('0x122')]+_0x58a4f4[_0x9118('0x123')]+_0x58a4f4[_0x9118('0x124')]+_0x58a4f4[_0x9118('0xdb')]+_0x58a4f4[_0x9118('0xec')]+_0x58a4f4[_0x9118('0x11c')]+_0x58a4f4[_0x9118('0x125')]>=_0x1155b3[_0x9118('0x126')]){_0x23d2d5[_0x9118('0x127')](_0x58a4f4,_0x31a0b2,_0x104321,_0x14871b[_0x9118('0xc7')]);}else{_0x23d2d5[_0x9118('0x129')](_0x58a4f4,_0x31a0b2,_0x104321,_0x14871b[_0x9118('0xc7')]);}}}})['then'](function(){if(_0xc1a18c){hopperUtils[_0x9118('0xe8')](_0x58a4f4,_0x207033,_0x106858)['then'](function(){return _0x31a0b2(0x1);});}});});};Dialer[_0x9118('0x1a')][_0x9118('0x127')]=function(_0x996ab4,_0x132a87,_0x2010aa,_0x1d321a){var _0x343eb6=new Final(_0x996ab4);_0x343eb6[_0x9118('0xd4')]=0xf;_0x343eb6[_0x9118('0xd5')]='Global';this['createStateFinal'](_0x343eb6,_0x132a87,_0x2010aa,_0x1d321a);};Dialer[_0x9118('0x1a')]['createStateFinal']=function(_0x3ec478,_0x3a17bb,_0x244d17,_0x497386){hopperUtils['moveContactManagedDialer'](_0x3ec478)['then'](function(){return _0x3a17bb(msgResponse('[callProgressDetecting]',_0x9118('0x109'),_0x497386));})[_0x9118('0xa5')](function(){return _0x244d17(msgResponse(_0x9118('0x1c4'),'Failure',_0x9118('0x1c5')));});};Dialer[_0x9118('0x1a')][_0x9118('0xa')]=function(_0x6b6e5d){var _0x565557=_0x6b6e5d[_0x9118('0x1c6')]/0x64;var _0x10dbac=_0x6b6e5d[_0x9118('0xd2')]/(_0x6b6e5d[_0x9118('0xd2')]+_0x6b6e5d[_0x9118('0xc6')]);var _0xa313c9=Math[_0x9118('0x1c7')](_0x6b6e5d['predictiveIntervalAvailable']*(_0x6b6e5d['predictiveIntervalMaxThreshold']/0x64));var _0x336229=Math[_0x9118('0x1c7')](_0x6b6e5d[_0x9118('0x1c8')]*(_0x6b6e5d['predictiveIntervalMinThreshold']/0x64));var _0x1e2079=_0x6b6e5d['available']+_0x6b6e5d['talking'];var _0x113986=Math[_0x9118('0x1c9')](_0x6b6e5d['erlangCalls']*_0x6b6e5d[_0x9118('0x60')]*_0x6b6e5d[_0x9118('0x1ca')]*_0x6b6e5d[_0x9118('0x1cb')]);if(_[_0x9118('0x55')](_0x6b6e5d['startProgressive'])){if(!_[_0x9118('0x55')](_0x6b6e5d[_0x9118('0x27')])){_0x6b6e5d[_0x9118('0x27')]=undefined;loggerPredictive[_0x9118('0x68')](_0x9118('0x1cc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x9118('0x55')](_0x6b6e5d['handlePredictive'])){loggerPredictive['error'](_0x9118('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x6b6e5d[_0x9118('0x66')]);_0x6b6e5d[_0x9118('0x66')]=undefined;}_0x6b6e5d['startProgressive']=moment()[_0x9118('0x7f')](_0x9118('0xc5'));loggerPredictive[_0x9118('0x4b')](_0x6b6e5d[_0x9118('0x48')],_0x9118('0x1cd'),_0x6b6e5d[_0x9118('0x63')]);this['handlePower'](_0x6b6e5d,0x1);}else if(ifInterval(_0x6b6e5d[_0x9118('0x1ce')],_0x6b6e5d[_0x9118('0x63')])){this['handlePower'](_0x6b6e5d,0x1);loggerPredictiveCalls['info'](_0x9118('0x1cf'),_0x6b6e5d[_0x9118('0x63')],_0x6b6e5d[_0x9118('0x48')]);_0x6b6e5d[_0x9118('0x5b')]=0x0;_0x6b6e5d[_0x9118('0xd3')]=0x0;}else if(_0x565557<_0x10dbac&&_0x6b6e5d['dialPredictiveOptimization']===_0x9118('0x1d0')){clearPredictiveAttributes(_0x6b6e5d);loggerPredictive[_0x9118('0x4b')](_0x9118('0x1d1'),_0x9118('0x1d2'),_0x10dbac,_0x9118('0x63'),_0x6b6e5d[_0x9118('0x48')]);}else if(_0x113986<_0x6b6e5d[_0x9118('0xd3')]&&_0x6b6e5d['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x6b6e5d);loggerPredictive[_0x9118('0x4b')](_0x9118('0x1d3'),_0x9118('0x1d4'),_0x113986,_0x9118('0x1d5'),_0x6b6e5d[_0x9118('0xd3')],_0x9118('0x63'),_0x6b6e5d['name']);}else if(!ifInterval(_0x6b6e5d['dialPredictiveInterval'],_0x6b6e5d[_0x9118('0x63')])&&_[_0x9118('0x55')](_0x6b6e5d[_0x9118('0x27')])&&!_[_0x9118('0x55')](_0x6b6e5d['startProgressive'])){_0x6b6e5d[_0x9118('0x27')]=moment()[_0x9118('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x6b6e5d[_0x9118('0x48')],_0x9118('0x1d6'),_0x6b6e5d[_0x9118('0x27')]);hopperUtils[_0x9118('0x1d7')](_0x6b6e5d['dialPredictiveInterval'])[_0x9118('0x40')](this[_0x9118('0x1d8')](_0x6b6e5d))[_0x9118('0x40')](mergeDataErlangB(_0x6b6e5d))[_0x9118('0x40')](this[_0x9118('0x1d9')](_0x6b6e5d))[_0x9118('0xa5')](loggerCatchPredictive(_0x9118('0x1da'),_0x6b6e5d));}else if(!ifInterval(_0x6b6e5d[_0x9118('0x1ce')],_0x6b6e5d[_0x9118('0x27')])){_0x6b6e5d['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x6b6e5d['startPredictive']=moment()[_0x9118('0x7f')](_0x9118('0xc5'));loggerPredictive[_0x9118('0x4b')](_0x6b6e5d[_0x9118('0x48')],'recalculate\x20predictive\x20at',_0x6b6e5d[_0x9118('0x27')]);clearInterval(_0x6b6e5d[_0x9118('0x66')]);_0x6b6e5d[_0x9118('0x66')]=undefined;hopperUtils[_0x9118('0x1d7')](_0x6b6e5d[_0x9118('0x1ce')])[_0x9118('0x40')](this['getDataPredictive'](_0x6b6e5d))[_0x9118('0x40')](mergeDataErlangB(_0x6b6e5d))[_0x9118('0x40')](this[_0x9118('0x1d9')](_0x6b6e5d))['catch'](loggerCatchPredictive(_0x9118('0x1db'),_0x6b6e5d));}else if(_0x6b6e5d['predictiveIntervalAvailable']&&_0x1e2079<_0x6b6e5d[_0x9118('0x1c8')]-_0x336229){clearPredictiveAttributes(_0x6b6e5d);loggerPredictive['info'](_0x6b6e5d['name'],_0x9118('0x1dc'),_0x1e2079,_0x9118('0x1dd'),_0x6b6e5d[_0x9118('0x1c8')],'-',_0x336229,'=',_0x6b6e5d[_0x9118('0x1c8')]-_0x336229,')');}else if(_0x6b6e5d[_0x9118('0x1c8')]&&_0x1e2079>_0x6b6e5d[_0x9118('0x1c8')]+_0xa313c9){clearPredictiveAttributes(_0x6b6e5d);loggerPredictive[_0x9118('0x4b')](_0x6b6e5d['name'],_0x9118('0x1dc'),_0x1e2079,_0x9118('0x1de'),_0x6b6e5d[_0x9118('0x1c8')],'+',_0xa313c9,'=',_0x6b6e5d[_0x9118('0x1c8')]+_0xa313c9,')');}};Dialer[_0x9118('0x1a')]['getDataPredictive']=function(_0x5a020b){var _0x30f5c5=this;return function(_0x33df98){return new Promise(function(_0x2faee9,_0x76b249){_[_0x9118('0x61')](_0x5a020b,_0x33df98[0x0]);if(checkGetDataPredictive(_0x33df98[0x0])){var _0x1bbd7e=_0x5a020b[_0x9118('0x1c8')]=_0x5a020b['talking']+_0x5a020b[_0x9118('0x140')];var _0x2063bd=_0x5a020b[_0x9118('0x1ce')]*0x3c;var _0x513050=_0x33df98[0x0][_0x9118('0x56')]+_0x33df98[0x0][_0x9118('0x52')];var _0x9e3c7c=(_0x33df98[0x0][_0x9118('0x4e')]+_0x33df98[0x0][_0x9118('0x50')]+_0x33df98[0x0][_0x9118('0x51')])/_0x33df98[0x0]['predictiveIntervalTotalCalls'];_0x5a020b[_0x9118('0x1ca')]=_0x9e3c7c>0x0?_0x9e3c7c:0x1;switch(_0x5a020b['dialPredictiveOptimization']){case _0x9118('0x1d0'):var _0x419bf6=_0x5a020b[_0x9118('0x1c6')]/0x64;return _0x30f5c5['abandonmentRate'](_0x1bbd7e,_0x2063bd,_0x513050,_0x9e3c7c,_0x419bf6)[_0x9118('0x40')](function(_0x210d02){return _0x2faee9(_0x210d02);});case _0x9118('0x1df'):var _0x366763=_0x5a020b[_0x9118('0x1c6')]/0x64;return _0x30f5c5[_0x9118('0x1e0')](_0x1bbd7e,_0x2063bd,_0x513050,_0x9e3c7c,_0x366763)[_0x9118('0x40')](function(_0x3a6ab6){return _0x2faee9(_0x3a6ab6);});default:return _0x76b249(msgResponse(_0x9118('0x1e1'),_0x9118('0x96'),_0x9118('0x1e2')));}}else{return _0x76b249(msgResponse(_0x9118('0x1e1'),_0x9118('0x96'),_0x9118('0x1e3')));}});};};Dialer[_0x9118('0x1a')][_0x9118('0x1e4')]=function(_0x3bef3b){var _0x1c9c66=this;return function(_0x438be4){return new Promise(function(_0x24d95d,_0x338a4b){_['merge'](_0x3bef3b,_0x438be4[0x0]);if(checkGetDataPredictive(_0x438be4[0x0])){loggerPredictive['info'](JSON[_0x9118('0x76')](_0x438be4[0x0]));if(_0x3bef3b[_0x9118('0x1e5')]===_0x9118('0x1d0')){return _0x1c9c66[_0x9118('0x15a')](_0x3bef3b['id'])[_0x9118('0x40')](function(_0x51d13a){var _0x25a9a9=_0x3bef3b[_0x9118('0x1e6')]-_0x51d13a[0x0]['outboundQueuePauses'];var _0x578490=_0x3bef3b['dialPredictiveInterval']*0x3c;var _0xa65d6a=_0x438be4[0x0][_0x9118('0x56')]+_0x438be4[0x0][_0x9118('0x52')];var _0x2c9fdc=(_0x438be4[0x0][_0x9118('0x4e')]+_0x438be4[0x0][_0x9118('0x50')]+_0x438be4[0x0][_0x9118('0x51')])/_0x438be4[0x0][_0x9118('0x4c')];var _0x5d22d6=_0x3bef3b[_0x9118('0x1c6')]/0x64;_0x3bef3b[_0x9118('0x1e7')]=_0x51d13a[0x0][_0x9118('0x1e8')]||0x0;_0x3bef3b[_0x9118('0x1ca')]=_0x2c9fdc>0x0?_0x2c9fdc:0x1;return _0x1c9c66[_0x9118('0x1e9')](_0x25a9a9,_0x578490,_0xa65d6a,_0x2c9fdc,_0x5d22d6);})['then'](function(_0x5c1e2c){return _0x24d95d(_0x5c1e2c);})[_0x9118('0xa5')](function(_0x8b3c4b){return _0x338a4b(msgResponse(_0x9118('0x1ea'),_0x9118('0x96'),JSON[_0x9118('0x76')](_0x8b3c4b)));});}if(_0x3bef3b[_0x9118('0x1e5')]==='agentBusyFactor'){return _0x1c9c66[_0x9118('0x15a')](_0x3bef3b['id'])[_0x9118('0x40')](function(_0x18ae61){var _0x56dc35=_0x3bef3b[_0x9118('0x1e6')]-_0x18ae61[0x0][_0x9118('0x1e8')];var _0x85d6c9=_0x3bef3b['dialPredictiveInterval']*0x3c;var _0x54fd64=_0x438be4[0x0][_0x9118('0x56')]+_0x438be4[0x0]['predictiveIntervalAvgHoldtime'];var _0x36d38d=(_0x438be4[0x0][_0x9118('0x4e')]+_0x438be4[0x0][_0x9118('0x50')]+_0x438be4[0x0][_0x9118('0x51')])/_0x438be4[0x0]['predictiveIntervalTotalCalls'];var _0x3a5fd6=_0x3bef3b[_0x9118('0x1c6')]/0x64;_0x3bef3b[_0x9118('0x1e7')]=_0x18ae61[0x0][_0x9118('0x1e8')]||0x0;_0x3bef3b[_0x9118('0x1ca')]=_0x36d38d>0x0?_0x36d38d:0x1;return _0x1c9c66['busyFactor'](_0x56dc35,_0x85d6c9,_0x54fd64,_0x36d38d,_0x3a5fd6);})[_0x9118('0x40')](function(_0x866e15){return _0x24d95d(_0x866e15);})[_0x9118('0xa5')](function(_0x522c49){return _0x338a4b(msgResponse(_0x9118('0x1ea'),_0x9118('0x96'),JSON[_0x9118('0x76')](_0x522c49)));});}}else{return _0x338a4b(msgResponse(_0x9118('0x1e1'),_0x9118('0x96'),_0x9118('0x1e3')));}});};};Dialer[_0x9118('0x1a')]['startMethodPredictive']=function(_0x3f5ddf){var _0x1db68f=this;return function(){var _0x18e7cf=0x0;var _0x2670a7=Math[_0x9118('0x1c9')](_0x3f5ddf[_0x9118('0x1eb')]*0x3e8);if(_0x2670a7>0x0){_0x2670a7=_0x2670a7<0x64?0x64:_0x2670a7;loggerPredictive['info'](_0x3f5ddf[_0x9118('0x48')],_0x9118('0x1ec'),_0x2670a7,_0x9118('0x1ed'));_0x3f5ddf[_0x9118('0x66')]=setInterval(function(){_0x1db68f[_0x9118('0x66')](_0x3f5ddf);loggerPredictiveCalls[_0x9118('0x4b')]('[handlePredictive]',_0x18e7cf+=0x1);},_0x2670a7);}else{loggerPredictive[_0x9118('0x4b')](_0x3f5ddf[_0x9118('0x48')],_0x9118('0x1ee'));}};};Dialer['prototype'][_0x9118('0x1ef')]=function(_0x3401dc,_0x31e5b8){var _0x2113ea=this;return function(_0x33b812){if(_[_0x9118('0x4a')](_0x33b812)){if(_[_0x9118('0xfb')](_0x31e5b8[_0x9118('0x15d')])||!_0x31e5b8['recallme']){if(_0x3401dc[_0x9118('0xb5')]===_0x9118('0xb8')){_0x3401dc[_0x9118('0x73')]=_[_0x9118('0x55')](_0x3401dc[_0x9118('0x73')])?!![]:_0x3401dc[_0x9118('0x73')];var _0x220855=uuid['v4']();_0x2113ea['actions'][_0x220855]=new Action(_0x3401dc,_0x31e5b8,_0x220855);loggerBooked[_0x9118('0x4b')](_0x9118('0x1f0'),_0x220855,_0x9118('0x1f1'),JSON[_0x9118('0x76')](_0x3401dc[_0x9118('0x73')]),'Queue:\x20',_0x3401dc[_0x9118('0x48')]);if(_0x3401dc[_0x9118('0x73')]){_0x3401dc[_0x9118('0x73')]=![];_0x2113ea['queueBooked'][_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xc0')]]=[];ami[_0x9118('0xa0')]({'actionid':_0x220855,'action':'queuestatus','queue':_0x3401dc['name']})[_0x9118('0xa5')](function(){utils[_0x9118('0xc3')](_0x3401dc,_0x9118('0x1f2'));hopperUtils[_0x9118('0xde')]({'active':![],'ContactId':_0x2113ea['actions'][_0x220855][_0x9118('0xe1')],'ListId':_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xe2')],'VoiceQueueId':_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xe3')]||undefined,'CampaignId':_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2113ea['actions'][_0x220855];});}else{loggerBooked[_0x9118('0x4b')](_0x9118('0x1f3'),JSON[_0x9118('0x76')](_0x3401dc[_0x9118('0x73')]),_0x9118('0x1f4'),_0x3401dc[_0x9118('0x48')]);utils['decrementOriginate'](_0x3401dc,_0x9118('0x1f2'));hopperUtils[_0x9118('0xde')]({'active':![],'ContactId':_0x2113ea[_0x9118('0x23')][_0x220855]['ContactId'],'ListId':_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xe2')],'VoiceQueueId':_0x2113ea['actions'][_0x220855][_0x9118('0xe3')]||undefined,'CampaignId':_0x2113ea[_0x9118('0x23')][_0x220855][_0x9118('0xe4')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2113ea[_0x9118('0x23')][_0x220855];}}else{return _0x2113ea[_0x9118('0x162')](_0x3401dc,_0x31e5b8);}}else{if(utils[_0x9118('0x62')](undefined,_0x31e5b8[_0x9118('0x1f5')])<_0x3401dc[_0x9118('0x1f6')]*0x3c){if(_0x31e5b8[_0x9118('0x14f')]&&!_0x31e5b8['Agent']['voicePause']){_0x2113ea['preview'][_0x9118('0xfc')](_0x31e5b8['id'])[_0x9118('0xfe')](function(){utils[_0x9118('0xc3')](_0x3401dc,_0x9118('0x1f2'));});}else{hopperUtils[_0x9118('0x1f7')]({'active':![]},_0x31e5b8['id'],0x1)['finally'](function(){utils[_0x9118('0xc3')](_0x3401dc,_0x9118('0x1f2'));});}}else{_0x3401dc[_0x9118('0x1f8')]+=0x1;utils[_0x9118('0xc3')](_0x3401dc,'[checkContactBlack]');if(_0x3401dc['dialRecallInQueue']){hopperUtils[_0x9118('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x31e5b8['ContactId'],'ListId':_0x31e5b8[_0x9118('0xe2')],'VoiceQueueId':_0x31e5b8[_0x9118('0xe3')]||undefined,'CampaignId':_0x31e5b8[_0x9118('0xe4')]||undefined})[_0x9118('0xa5')](loggerCatch(_0x9118('0x1f9')));hopperUtils[_0x9118('0xcc')](createObjHistory(_0x3401dc,_0x31e5b8,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x9118('0x1fa')))[_0x9118('0xa5')](loggerCatch(_0x9118('0x1fb')));}else{_0x2113ea[_0x9118('0x116')](createObjHistory(_0x3401dc,_0x31e5b8,utils[_0x9118('0x6b')][_0x9118('0x1fc')],0x16,_0x9118('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3401dc[_0x9118('0x1fe')]+=0x1;_0x2113ea[_0x9118('0x116')](createObjHistory(_0x3401dc,_0x31e5b8,utils[_0x9118('0x6b')][_0x9118('0x1ff')],0xd,_0x9118('0x200')),'[Originate][historyBlacklist]',_0x9118('0x201'));throw _0x9118('0x202');}};};Dialer[_0x9118('0x1a')][_0x9118('0x161')]=function(_0x4a7967){var _0x46992d=this;var _0x3f626e=_0x4a7967[_0x9118('0x203')]-_0x4a7967[_0x9118('0x83')];emitCampaignSummary(_0x4a7967);if(_0x3f626e>0x0&&_0x4a7967[_0x9118('0x204')]==0x0){if(_0x3f626e>this[_0x9118('0x22')]){_0x3f626e=this[_0x9118('0x22')];}_0x4a7967[_0x9118('0x204')]=0x1;hopperUtils[_0x9118('0x205')](_0x4a7967,_0x3f626e)[_0x9118('0x40')](function(_0x4b75c6){_0x4a7967[_0x9118('0x204')]=0x0;if(_0x4b75c6){if(!utils[_0x9118('0x206')](_0x4b75c6)){_0x4a7967[_0x9118('0x6e')]=utils[_0x9118('0x6b')][_0x9118('0x6f')];logger[_0x9118('0x4b')]('[getContactCampaign2][Empty]'+_0x4a7967[_0x9118('0x48')]);}else{_0x4a7967['originated']+=_0x4b75c6[_0x9118('0x9e')];_0x4a7967[_0x9118('0x6e')]=utils['CAMPAIGN_STATUS'][_0x9118('0x207')];for(var _0x2f90a1=0x0;_0x2f90a1<_0x4b75c6['length'];_0x2f90a1+=0x1){_0x4a7967[_0x9118('0x208')]+=0x1;if(_['isNil'](_0x4b75c6[_0x2f90a1])||_['isNil'](_0x4b75c6[_0x2f90a1][_0x9118('0x180')])||_[_0x9118('0xfb')](_0x4b75c6[_0x2f90a1][_0x9118('0x165')])){_0x46992d['emptyContact']('[actionOriginate]\x20',_0x4a7967,_0x4b75c6[_0x2f90a1]);}else{hopperUtils[_0x9118('0x209')](_[_0x9118('0x77')](_0x4b75c6[_0x2f90a1],[_0x9118('0xe4'),_0x9118('0x165')]))[_0x9118('0x40')](_0x46992d[_0x9118('0x1ef')](_0x4a7967,_0x4b75c6[_0x2f90a1]))['catch'](function(_0x29ffbf){logger['error'](_0x9118('0x20a'),_0x29ffbf);utils[_0x9118('0xc3')](_0x4a7967,_0x9118('0x20b'));});}}}}})[_0x9118('0xa5')](function(_0x323012){_0x4a7967['temp']=0x0;logger[_0x9118('0x68')](_0x9118('0x20c'),_0x323012);});}};Dialer['prototype'][_0x9118('0xb7')]=function(_0x3bf07f,_0x4a247b){var _0x53d21e=this;var _0x5a791a=[];if(_0x4a247b<0x1||_0x3bf07f[_0x9118('0xb5')]===_0x9118('0xb8')){_0x4a247b=0x1;}var _0x37629a=Math['floor'](_0x3bf07f[_0x9118('0x140')]*_0x4a247b)-_0x3bf07f[_0x9118('0x83')];if(_0x3bf07f[_0x9118('0x20d')]>0x0){var _0x2c9a54=_0x3bf07f[_0x9118('0x20d')]-_0x3bf07f[_0x9118('0x83')]-_0x3bf07f['talking']-_0x3bf07f[_0x9118('0x141')];if(_0x37629a>_0x2c9a54){_0x37629a=_0x2c9a54;}}if(_0x37629a>0x0&&_0x3bf07f[_0x9118('0x204')]==0x0){if(_0x3bf07f[_0x9118('0xb5')]===_0x9118('0xb8')){_0x37629a=0x1;}if(_0x37629a>this[_0x9118('0x22')]){_0x37629a=this['maxNumberOriginate'];}for(var _0x22afe1 in this['agents']){if(typeof this[_0x9118('0x20')][_0x22afe1]!==_0x9118('0xaf')){if(this[_0x9118('0x20')][_0x22afe1][_0x9118('0xd4')]===_0x9118('0x20e')&&this['agents'][_0x22afe1][_0x9118('0x8a')]==='reachable'){_0x5a791a[_0x9118('0x9f')](this['agents'][_0x22afe1]['id']);}}}_0x3bf07f['temp']=0x1;hopperUtils[_0x9118('0x20f')](_0x3bf07f,_0x5a791a,_0x37629a)[_0x9118('0x40')](function(_0x1e9e7d){_0x3bf07f[_0x9118('0x204')]=0x0;if(_0x1e9e7d){if(!utils[_0x9118('0x206')](_0x1e9e7d)){hopperUtils[_0x9118('0x210')](_0x3bf07f)[_0x9118('0x40')](sendMessageReschedule(_0x3bf07f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3bf07f['originated']+=_0x1e9e7d[_0x9118('0x9e')];_0x3bf07f['message']=_0x3bf07f['dialMethod']===_0x9118('0xb8')?utils[_0x9118('0x6b')]['ACTIVE']:utils[_0x9118('0x6b')]['RUNNING'];for(var _0x561c5d=0x0;_0x561c5d<_0x1e9e7d['length'];_0x561c5d+=0x1){if(_['isNil'](_0x1e9e7d[_0x561c5d])||_['isNil'](_0x1e9e7d[_0x561c5d][_0x9118('0x180')])||_['isNil'](_0x1e9e7d[_0x561c5d][_0x9118('0x165')])){_0x53d21e['emptyContact'](_0x9118('0x211'),_0x3bf07f,_0x1e9e7d[_0x561c5d]);}else{hopperUtils[_0x9118('0x212')](_[_0x9118('0x77')](_0x1e9e7d[_0x561c5d],[_0x9118('0xe3'),_0x9118('0x165')]))['then'](_0x53d21e['checkContactBlack'](_0x3bf07f,_0x1e9e7d[_0x561c5d]))[_0x9118('0xa5')](function(_0xa88bab){logger[_0x9118('0x68')]('[actionOriginate]',_0xa88bab);utils[_0x9118('0xc3')](_0x3bf07f,_0x9118('0x213'));});}}}}})['catch'](function(_0x4e4fe0){_0x3bf07f['temp']=0x0;logger['error'](_0x9118('0x20c'),_0x4e4fe0);});}};Dialer[_0x9118('0x1a')][_0x9118('0x66')]=function(_0x125256){if(_0x125256['dialLimitQueue']>0x0){var _0x2b9f1f=_0x125256[_0x9118('0x20d')]-_0x125256[_0x9118('0x83')]-_0x125256[_0x9118('0x214')];if(_0x2b9f1f>0x0&&_0x125256['temp']==0x0){this[_0x9118('0x215')](_0x125256);}else{loggerPredictiveCalls[_0x9118('0x4b')](_0x9118('0x216'));}}else{this[_0x9118('0x215')](_0x125256);}};Dialer[_0x9118('0x1a')][_0x9118('0x215')]=function(_0x20761e){var _0xe84a1a=this;var _0x48d1b8=[];_0x20761e[_0x9118('0x83')]+=0x1;for(var _0x29744a in this[_0x9118('0x20')]){if(typeof this[_0x9118('0x20')][_0x29744a]!==_0x9118('0xaf')){if(this[_0x9118('0x20')][_0x29744a][_0x9118('0xd4')]==='not_inuse'&&this[_0x9118('0x20')][_0x29744a][_0x9118('0x8a')]==='reachable'){_0x48d1b8['push'](this['agents'][_0x29744a]['id']);}}}_0x20761e[_0x9118('0x204')]=0x1;return this[_0x9118('0x20f')](_0x20761e['id'],_0x48d1b8,0x1,_0x20761e[_0x9118('0x217')],_0x20761e)[_0x9118('0x40')](function(_0x28ba89){_0x20761e['temp']=0x1;if(_0x28ba89){if(!utils[_0x9118('0x206')](_0x28ba89)){utils['checkContactLowerLimitOriginate'](_0x20761e,0x1,0x0);return hopperUtils[_0x9118('0x210')](_0x20761e)['then'](sendMessageReschedule(_0x20761e))[_0x9118('0xa5')](loggerCatch(_0x9118('0x218')));}else{_0x20761e[_0x9118('0x6e')]=utils[_0x9118('0x6b')]['RUNNING'];if(_[_0x9118('0xfb')](_0x28ba89[0x0])||_[_0x9118('0xfb')](_0x28ba89[0x0][_0x9118('0x180')])||_['isNil'](_0x28ba89[0x0][_0x9118('0x165')])){_0xe84a1a[_0x9118('0x15c')](_0x9118('0x211'),_0x20761e,_0x28ba89[0x0]);}else{return hopperUtils[_0x9118('0x212')](_[_0x9118('0x77')](_0x28ba89[0x0],[_0x9118('0xe3'),_0x9118('0x165')]))[_0x9118('0x40')](_0xe84a1a[_0x9118('0x1ef')](_0x20761e,_0x28ba89[0x0]))[_0x9118('0xa5')](function(_0x1f07de){logger[_0x9118('0x68')](_0x9118('0x219'),_0x1f07de);utils['decrementOriginate'](_0x20761e,'[actionOriginatePredictive]');});}}}})[_0x9118('0xa5')](function(_0xa17aa5){_0x20761e['temp']=0x0;logger['error'](_0x9118('0x20c'),_0xa17aa5);});};Dialer[_0x9118('0x1a')][_0x9118('0x1e9')]=function(_0x436850,_0xf0fe3d,_0x81618a,_0x1df3e9,_0x433d86,_0x73f7b5){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x9118('0x4b')](_0x9118('0x21a'),_0x436850);loggerPredictive['info'](_0x9118('0x21b'),_0xf0fe3d);loggerPredictive[_0x9118('0x4b')]('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',_0x81618a);loggerPredictive[_0x9118('0x4b')](_0x9118('0x21c'),_0x1df3e9);loggerPredictive[_0x9118('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x433d86);loggerPredictive[_0x9118('0x4b')](_0x9118('0x54'));return new Promise(function(_0x3a703f,_0x3aa61f){if(_0x436850<=0x0||isNaN(_0x436850)){return _0x3aa61f(msgResponse(_0x9118('0x21d'),_0x9118('0x87'),_0x9118('0x21e')+_0x436850));}if(_0x81618a<=0x0||isNaN(_0x81618a)){return _0x3aa61f(msgResponse(_0x9118('0x21d'),_0x9118('0x87'),_0x9118('0x21f')+_0x81618a));}if(_0x1df3e9<=0x0||isNaN(_0x1df3e9)){return _0x3aa61f(msgResponse(_0x9118('0x21d'),_0x9118('0x87'),_0x9118('0x220')+_0x1df3e9));}if(_0xf0fe3d<=0x0||isNaN(_0xf0fe3d)){return _0x3aa61f(msgResponse('[abandonmentRate]',_0x9118('0x87'),_0x9118('0x221')+_0xf0fe3d));}if(_0x433d86<=0x0||isNaN(_0x433d86)){return _0x3aa61f(msgResponse(_0x9118('0x21d'),_0x9118('0x87'),_0x9118('0x222')+_0x433d86));}_0x73f7b5=_0x73f7b5||0x0;var _0x54ad11=0x1/_0x81618a;var _0x2bface=0x0;var _0x39ae6b=0x0;var _0x506fb1=0x0;var _0x3eb471=0x0;for(var _0x1951c7=0x0;_0x506fb1<_0x433d86;_0x1951c7+=0x1){_0x39ae6b=_0x1951c7/_0xf0fe3d;_0x2bface=(_0x1df3e9*_0x39ae6b+_0x73f7b5)/_0x54ad11;_0x506fb1=utils[_0x9118('0x223')](_0x2bface,_0x436850);_0x3eb471=_0x2bface/_0x436850*(0x1-utils[_0x9118('0x223')](_0x2bface,_0x436850));}return _0x3a703f({'erlangCalls':_0x1951c7,'erlangCallToSecond':_0xf0fe3d/_0x1951c7,'erlangAbandonmentRate':_0x506fb1,'erlangBusyFactor':_0x3eb471});});};Dialer['prototype']['busyFactor']=function(_0x7b5344,_0x185eee,_0x11e17d,_0x45ee58,_0x2c973d,_0x3b5ced){loggerPredictive[_0x9118('0x4b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x9118('0x4b')](_0x9118('0x21a'),_0x7b5344);loggerPredictive['info'](_0x9118('0x21b'),_0x185eee);loggerPredictive[_0x9118('0x4b')](_0x9118('0x224'),_0x11e17d);loggerPredictive[_0x9118('0x4b')](_0x9118('0x21c'),_0x45ee58);loggerPredictive[_0x9118('0x4b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c973d);loggerPredictive[_0x9118('0x4b')](_0x9118('0x54'));return new Promise(function(_0x53ff91,_0x4d7028){if(_0x7b5344<=0x0||isNaN(_0x7b5344)){return _0x4d7028(msgResponse(_0x9118('0x225'),'Error',_0x9118('0x21e')+_0x7b5344));}if(_0x11e17d<=0x0||isNaN(_0x11e17d)){return _0x4d7028(msgResponse(_0x9118('0x225'),_0x9118('0x87'),_0x9118('0x21f')+_0x11e17d));}if(_0x45ee58<=0x0||isNaN(_0x45ee58)){return _0x4d7028(msgResponse(_0x9118('0x225'),_0x9118('0x87'),_0x9118('0x220')+_0x45ee58));}if(_0x185eee<=0x0||isNaN(_0x185eee)){return _0x4d7028(msgResponse(_0x9118('0x225'),'Error',_0x9118('0x221')+_0x185eee));}if(_0x2c973d<=0x0||isNaN(_0x2c973d)){return _0x4d7028(msgResponse('[busyFactor]',_0x9118('0x87'),_0x9118('0x226')+_0x2c973d));}_0x3b5ced=_0x3b5ced||0x0;var _0xbf4235=0x1/_0x11e17d;var _0x1ea80a=0x0;var _0x4b2153=0x0;var _0x1bc2a2=0x0;var _0x2f06e8=0x0;for(var _0x4934c6=0x0;_0x2f06e8<_0x2c973d;_0x4934c6+=0x1){_0x4b2153=_0x4934c6/_0x185eee;_0x1ea80a=(_0x45ee58*_0x4b2153+_0x3b5ced)/_0xbf4235;_0x1bc2a2=utils['erlangb'](_0x1ea80a,_0x7b5344);_0x2f06e8=_0x1ea80a/_0x7b5344*(0x1-utils['erlangb'](_0x1ea80a,_0x7b5344));}return _0x53ff91({'erlangCalls':_0x4934c6,'erlangCallToSecond':_0x185eee/_0x4934c6,'erlangAbandonmentRate':_0x1bc2a2,'erlangBusyFactor':_0x2f06e8});});};module[_0x9118('0x227')]=Dialer; \ No newline at end of file +var _0x0470=['XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialCutDigit','substring','dialPrefix','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','countcongestionretry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','talking','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','getContactDialer','[countReScheduled]\x20','checkIsBlackList','loggerHandler','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','m\x20=\x20','Ts\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','---------------------------','predictiveIntervalTotalCalls','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','checkContactLowerLimitOriginate','temp','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','INACTIVE','format','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','isTrunkReachable','active','SIP/%s','status','unmonitored','prototype','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','then','indexOf','catch','iftime\x20%s,%s','content','true','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','dialPowerLevel','booked','handlePower','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','[ifTime][Action]','Error','syncAgentConnect','uniqueId','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedMaxRetry','minutes','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory','queueBooked','merge','pick','idHopper','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','value','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','HANGUP','[syncHangupInAMDIvr][createHistory]','dialMachineMaxRetry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','Normal\x20Clearing','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence'];(function(_0x2fb7dd,_0xad78ec){var _0xc51ed9=function(_0x3a8410){while(--_0x3a8410){_0x2fb7dd['push'](_0x2fb7dd['shift']());}};_0xc51ed9(++_0xad78ec);}(_0x0470,0xae));var _0x0047=function(_0x8ef7c5,_0x400fed){_0x8ef7c5=_0x8ef7c5-0x0;var _0x5e3792=_0x0470[_0x8ef7c5];return _0x5e3792;};'use strict';var util=require(_0x0047('0x0'));var _=require(_0x0047('0x1'));var uuid=require(_0x0047('0x2'));var moment=require(_0x0047('0x3'));var rr=require('rr');var Redis=require(_0x0047('0x4'));var utils=require(_0x0047('0x5'));var hopperUtils=require(_0x0047('0x6'));var ut=require(_0x0047('0x7'));var config=require('../../../config/environment/');var logger=require(_0x0047('0x8'))(_0x0047('0x9'));var loggerBooked=require(_0x0047('0x8'))('booked');var loggerPredictive=require(_0x0047('0x8'))(_0x0047('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0047('0xb'));var loggerSyncQueueSummary=require(_0x0047('0x8'))(_0x0047('0xc'));var ami=require(_0x0047('0xd'));config[_0x0047('0xe')]=_['defaults'](config['redis'],{'host':_0x0047('0xf'),'port':0x18eb});var io=require(_0x0047('0x10'))(new Redis(config[_0x0047('0xe')]));var cmHopper=require(_0x0047('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x0047('0x12'));var Interval=require(_0x0047('0x13'));var Action=require(_0x0047('0x14'));var History=require(_0x0047('0x15'));var Final=require(_0x0047('0x16'));var AgentComplete=require(_0x0047('0x17'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x0047('0x18'));var ipAgi=process[_0x0047('0x19')][_0x0047('0x1a')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0047('0x1b')]=function(_0xd150){this[_0x0047('0x1c')]=this[_0x0047('0x1c')]?this['tail'][_0x0047('0x1d')](_0xd150):_0xd150();};function Dialer(_0x356231,_0x25bff4){this[_0x0047('0x1e')]=new Sequence();this[_0x0047('0x1f')]=_0x25bff4;this[_0x0047('0x20')]=_0x356231[_0x0047('0x20')];this['campaigns']=_0x356231[_0x0047('0x21')];this[_0x0047('0x22')]=_0x356231[_0x0047('0x22')];this[_0x0047('0x23')]=_0x356231[_0x0047('0x23')];this[_0x0047('0x24')]=config[_0x0047('0x24')]||0x2;this['channels']={};this[_0x0047('0x25')]={};this[_0x0047('0x26')]={};this['uniqueId']={};this[_0x0047('0x27')]={};this[_0x0047('0x28')]={};this[_0x0047('0x29')]={};this[_0x0047('0x2a')]={};this['queueBooked']={};this['queueBookedRR']={};this[_0x0047('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x0047('0x2c')](this));ami['on'](_0x0047('0x2d'),this[_0x0047('0x2e')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x2f'),this[_0x0047('0x30')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x31'),this[_0x0047('0x32')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x33'),this['syncQueueSummary'][_0x0047('0x2c')](this));ami['on'](_0x0047('0x34'),this[_0x0047('0x35')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x36'),this[_0x0047('0x37')][_0x0047('0x2c')](this));ami['on']('newexten',this[_0x0047('0x38')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0x0047('0x3a'),this[_0x0047('0x3b')][_0x0047('0x2c')](this));ami['on'](_0x0047('0x3c'),this['syncQueueStatusComplete'][_0x0047('0x2c')](this));this[_0x0047('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x0047('0x3e')]()['then'](function(_0xe22ae1){previewRecallmeReminderInterval=_0xe22ae1[_0x0047('0x3f')];});}function isNotNull(_0x425524){return _0x425524!==null&&!_[_0x0047('0x40')](_0x425524);}function msgResponse(_0x549c3d,_0x1ed46b,_0x5ec591){return{'action':_0x549c3d,'response':_0x1ed46b,'message':_0x5ec591,'stack':_0x5ec591};}function emit(_0x4ffc6,_0x13ba14,_0xe4e864){io['to'](_0x4ffc6)[_0x0047('0x41')](_0x13ba14,_0xe4e864);}function emitOutboundVoiceQueueSummary(_0x5ca025){if(_0x5ca025['type']===_0x0047('0x42')){logger[_0x0047('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x5ca025,{'showHidden':![],'depth':null}));emit(util['format'](_0x0047('0x44'),_0x5ca025[_0x0047('0x45')]),_0x0047('0x46'),_0x5ca025);}}function checkGetDataPredictive(_0xdea024){if(isNotNull(_0xdea024)&&!_['isEmpty'](_0xdea024)){loggerPredictive[_0x0047('0x47')](_0x0047('0x48'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdea024['predictiveIntervalTotalCalls']);loggerPredictive[_0x0047('0x47')](_0x0047('0x49'),_0xdea024[_0x0047('0x4a')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x4b'),_0xdea024[_0x0047('0x4c')]);loggerPredictive[_0x0047('0x47')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdea024[_0x0047('0x4d')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x4e'),_0xdea024[_0x0047('0x4f')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x50'),_0xdea024[_0x0047('0x51')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x52'));if(_0xdea024[_0x0047('0x53')]>0x0){if(!_['isUndefined'](_0xdea024[_0x0047('0x51')])&&_0xdea024[_0x0047('0x51')]>0x0){return!![];}loggerPredictive[_0x0047('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0047('0x40')](_0xdea024['predictiveIntervalAvgHoldtime'])&&_0xdea024[_0x0047('0x4f')]>0x0){return!![];}loggerPredictive[_0x0047('0x47')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x0047('0x54'));}}else{loggerPredictive[_0x0047('0x47')](_0x0047('0x55'));}return![];}function mergeDataErlangB(_0x350eb3){return function(_0x472120){loggerPredictive[_0x0047('0x47')](_0x0047('0x56'));loggerPredictive['info'](_0x0047('0x57'),_0x472120[_0x0047('0x58')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x59'),_0x472120[_0x0047('0x5a')]);loggerPredictive[_0x0047('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x472120['erlangAbandonmentRate']);loggerPredictive[_0x0047('0x47')](_0x0047('0x5b'),_0x472120[_0x0047('0x5c')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x5d'),_0x472120[_0x0047('0x5e')]);loggerPredictive[_0x0047('0x47')](_0x0047('0x52'));_['merge'](_0x350eb3,_0x472120);};}function ifInterval(_0x57e243,_0x4e5ebb){if(_[_0x0047('0x40')](_0x4e5ebb)){return![];}return utils['getSeconds'](undefined,_0x4e5ebb)<_0x57e243*0x3c;}function clearPredictiveAttributes(_0x23f4da){if(_0x23f4da[_0x0047('0x29')]){_0x23f4da[_0x0047('0x29')]=undefined;loggerPredictive[_0x0047('0x43')](_0x23f4da[_0x0047('0x45')],_0x0047('0x5f'));}if(_0x23f4da[_0x0047('0x28')]){_0x23f4da[_0x0047('0x28')]=undefined;loggerPredictive[_0x0047('0x43')](_0x23f4da[_0x0047('0x45')],_0x0047('0x60'));}if(_0x23f4da[_0x0047('0x61')]){clearInterval(_0x23f4da[_0x0047('0x61')]);_0x23f4da['handlePredictive']=undefined;loggerPredictive[_0x0047('0x43')](_0x23f4da[_0x0047('0x45')],_0x0047('0x62'));}}function loggerCatchPredictive(_0xbe3dd3,_0x54485c){return function(_0x467758){loggerPredictive['error'](_0x54485c[_0x0047('0x45')],_0xbe3dd3);loggerPredictive['error'](_0x467758[_0x0047('0x63')]);clearPredictiveAttributes(_0x54485c);};}function loggerCatch(_0x552672){return function(_0x4386e0){logger[_0x0047('0x64')](_0x552672,util['inspect'](_0x4386e0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x15b849,_0x1ac30a,_0x15438f){return function(_0x2d2180){utils[_0x0047('0x65')](_0x1ac30a,_0x15438f,0x0);_0x1ac30a[_0x0047('0x66')]=0x0;logger['error'](_0x15b849,util[_0x0047('0x67')](_0x2d2180,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x34ac39){return function(_0x1ed336){if(isNotNull(_0x1ed336)&&isNotNull(_0x1ed336[0x0])){if(_0x1ed336[0x0][_0x0047('0x68')]>0x0){_0x34ac39[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x6b')];logger[_0x0047('0x47')](_0x0047('0x6c')+_0x34ac39[_0x0047('0x45')],_0x1ed336[0x0][_0x0047('0x68')],_0x0047('0x6d'));}else{_0x34ac39[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x6e')];logger[_0x0047('0x47')](_0x0047('0x6f')+_0x34ac39[_0x0047('0x45')]);}}};}function createObjHistory(_0x1a5841,_0x34a6e2,_0x40c461,_0x51d217,_0x25e998){_0x1a5841[_0x0047('0x69')]=_0x40c461;var _0x3b0050=new Action(_0x1a5841,_0x34a6e2);var _0x16dd1d=new History(_0x3b0050);_0x16dd1d[_0x0047('0x70')]=_0x51d217;_0x16dd1d[_0x0047('0x71')]=_0x25e998;_0x16dd1d['endtime']=_0x3b0050['starttime'];return _0x16dd1d;}function unlockQueueStatus(_0x84b94,_0x26469e){setTimeout(function(){if(_[_0x0047('0x40')](_0x84b94[_0x0047('0x72')])){loggerBooked[_0x0047('0x64')](_0x0047('0x73'),_0x26469e);}_0x84b94['queueStatusComplete']=!![];loggerBooked[_0x0047('0x47')](_0x0047('0x74'),_0x26469e,JSON[_0x0047('0x75')](_['pick'](_0x84b94,['name',_0x0047('0x72')])));},0x1f3);}function checkInterval(_0x2dac9e){return function(){if(!isNotNull(_0x2dac9e[_0x0047('0x76')])){_0x2dac9e[_0x0047('0x69')]=utils['CAMPAIGN_STATUS'][_0x0047('0x77')];throw _0x2dac9e['name']+_0x0047('0x78');}if(!isNotNull(_0x2dac9e[_0x0047('0x76')][_0x0047('0x79')])){_0x2dac9e[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x77')];throw _0x2dac9e[_0x0047('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0047('0x7a')](_0x2dac9e[_0x0047('0x76')][_0x0047('0x79')]))){_0x2dac9e[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x77')];throw _0x2dac9e[_0x0047('0x45')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x2cc5a7){return function(){if(!utils[_0x0047('0x7b')](_0x2cc5a7)){_0x2cc5a7[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x7c')];throw _0x2cc5a7[_0x0047('0x45')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x2160a8){if(utils['isIVRCampaign'](_0x2160a8)){emit(util[_0x0047('0x7d')](_0x0047('0x7e'),_0x2160a8['name']),'campaign:save',_0x2160a8);}}function loggerCatchQueueSummary(_0x3c0fc3,_0x296bad){return function(_0x1fc8e5){clearPredictiveAttributes(_0x296bad);emitCampaignSummary(_0x296bad);loggerSyncQueueSummary[_0x0047('0x43')](_0x3c0fc3,util['inspect'](_0x1fc8e5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x22ef17){if(_0x22ef17[_0x0047('0x7f')]){if(_0x22ef17[_0x0047('0x80')]===0x0){_0x22ef17[_0x0047('0x7f')]=![];_0x22ef17[_0x0047('0x69')]=utils[_0x0047('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0x0047('0x43')](_0x0047('0x81'),_0x22ef17[_0x0047('0x45')],_0x0047('0x82'));}else{_0x22ef17['message']=utils[_0x0047('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0x0047('0x43')](_0x0047('0x81'),_0x22ef17[_0x0047('0x45')],_0x0047('0x83'));}emitCampaignSummary(_0x22ef17);}}function myreject(_0x4d0fa9){return function(_0x95cb68){return _0x4d0fa9(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x95cb68)));};}Dialer['prototype'][_0x0047('0x84')]=function(_0x54b3ba){return!_['isUndefined'](_0x54b3ba)&&_0x54b3ba&&!_['isUndefined'](_0x54b3ba[_0x0047('0x45')])&&!_[_0x0047('0x40')](_0x54b3ba[_0x0047('0x85')])&&_0x54b3ba[_0x0047('0x85')]&&(this[_0x0047('0x23')][util['format'](_0x0047('0x86'),_0x54b3ba[_0x0047('0x45')])]['status']==='reachable'||this[_0x0047('0x23')][util[_0x0047('0x7d')](_0x0047('0x86'),_0x54b3ba['name'])][_0x0047('0x87')]===_0x0047('0x88'));};Dialer[_0x0047('0x89')][_0x0047('0x8a')]=function(_0x3d1561){var _0x19de67=this;return function(){if(!_0x19de67[_0x0047('0x84')](_0x3d1561[_0x0047('0x8b')])){if(!_0x19de67[_0x0047('0x84')](_0x3d1561[_0x0047('0x8c')])){_0x3d1561[_0x0047('0x69')]=utils[_0x0047('0x6a')]['TRUNK_NOT_REACHABLE'];throw _0x3d1561[_0x0047('0x45')]+_0x0047('0x8d');}}};};Dialer[_0x0047('0x89')][_0x0047('0x8e')]=function(_0x35844e,_0x2bea43,_0x170318,_0x144818){var _0x511637=this;return function(){var _0x3475fe=!![];return _0x511637[_0x0047('0x8f')](_0x35844e,_0x2bea43,_0x170318,_0x144818,_0x3475fe);};};Dialer[_0x0047('0x89')][_0x0047('0x90')]=function(_0x38e8a4,_0x21208a,_0xf9a015,_0x16d445){var _0x19ea3a=this;return function(){var _0xd0e85d=![];return _0x19ea3a[_0x0047('0x8f')](_0x38e8a4[_0x0047('0x79')],_0x21208a,_0xf9a015,_0x16d445,_0xd0e85d);};};Dialer[_0x0047('0x89')]['ifTimeIvr']=function(_0x4eebcb,_0x5c8031,_0x554fb5,_0x58f32d,_0x11bf7d){var _0x3c73ac=[];return new Promise(function(_0x2b512b,_0x2460da){if(!isNotNull(_0x4eebcb)){_0x58f32d[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x77')];return _0x2460da(msgResponse(_0x0047('0x91'),_0x0047('0x92'),_0x554fb5+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x0047('0x7a')](_0x4eebcb)){_0x58f32d['message']=utils[_0x0047('0x6a')][_0x0047('0x93')];return _0x2460da(msgResponse('ifTime',_0x0047('0x92'),_0x554fb5+_0x0047('0x94')));}if(_0x5c8031&&_[_0x0047('0x40')](config[_0x0047('0x95')][_0x5c8031])){_0x58f32d['message']=utils[_0x0047('0x6a')][_0x0047('0x96')];return _0x2460da(msgResponse(_0x0047('0x91'),'Failure',_0x554fb5+_0x0047('0x97')+_0x5c8031));}if(_[_0x0047('0x98')](_0x4eebcb)){for(var _0x3ffa1a=0x0;_0x3ffa1a<_0x4eebcb[_0x0047('0x99')];_0x3ffa1a+=0x1){_0x3c73ac[_0x0047('0x9a')](ami[_0x0047('0x9b')]({'action':_0x0047('0x9c'),'command':util[_0x0047('0x7d')]('iftime\x20%s,%s',_0x4eebcb[_0x3ffa1a]['interval'],!_['isUndefined'](config[_0x0047('0x95')][_0x5c8031])?_0x5c8031:'')})[_0x0047('0x9d')](function(_0x25ab27){return _0x25ab27['content'][_0x0047('0x9e')]('true')>=0x0;})[_0x0047('0x9f')](myreject(_0x2460da)));}}else{_0x3c73ac[_0x0047('0x9a')](ami[_0x0047('0x9b')]({'action':'command','command':util[_0x0047('0x7d')](_0x0047('0xa0'),_0x4eebcb,!_[_0x0047('0x40')](config[_0x0047('0x95')][_0x5c8031])?_0x5c8031:'')})[_0x0047('0x9d')](function(_0x443c19){return _0x443c19[_0x0047('0xa1')]['indexOf'](_0x0047('0xa2'))>=0x0;})[_0x0047('0x9f')](myreject(_0x2460da)));}Promise[_0x0047('0xa3')](_0x3c73ac)[_0x0047('0x9d')](function(_0x29fafa){var _0x42f6ed=_['some'](_0x29fafa);if(_0x42f6ed){return _0x2b512b(_0x42f6ed);}else{_0x58f32d[_0x0047('0x69')]=_0x11bf7d?utils[_0x0047('0x6a')][_0x0047('0xa4')]:utils[_0x0047('0x6a')]['OVERTIME_INTERVAL'];return _0x2460da(msgResponse(_0x0047('0xa5'),'Failure',_0x0047('0xa6')+_0x11bf7d+'\x20'+_0x554fb5+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0047('0x67')](_0x4eebcb,{'showHidden':![],'depth':null})+_0x0047('0xa7')+_0x5c8031));}})[_0x0047('0x9f')](function(_0x51c07f){return _0x2460da(msgResponse('ifTime',_0x0047('0x92'),JSON[_0x0047('0x75')](_0x51c07f)));});});};Dialer[_0x0047('0x89')]['loopCampaigns']=function(){var _0x1f62c7=this;return cmHopper[_0x0047('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x0047('0x9d')](function(){setInterval(function(){_0x1f62c7[_0x0047('0xa9')]();},0x3e8);});};Dialer[_0x0047('0x89')][_0x0047('0xa9')]=function(){var _0x2375ec=this;var _0x38108e;for(var _0x315ec2 in this['campaigns']){if(typeof this[_0x0047('0x21')][_0x315ec2]!==_0x0047('0xaa')){_0x38108e=this[_0x0047('0x21')][_0x315ec2];if(utils['isIVRCampaign'](_0x38108e)&&utils[_0x0047('0x7b')](_0x38108e)){_0x38108e[_0x0047('0x7f')]=!![];Promise[_0x0047('0xab')]()[_0x0047('0x9d')](checkIsIVRCampaignActive(_0x38108e))[_0x0047('0x9d')](checkInterval(_0x38108e))[_0x0047('0x9d')](_0x2375ec['checkIsTrunkReachable'](_0x38108e))[_0x0047('0x9d')](_0x2375ec[_0x0047('0x8e')](_0x38108e[_0x0047('0xac')],_0x38108e[_0x0047('0xad')],_0x38108e['name'],_0x38108e))[_0x0047('0x9d')](_0x2375ec[_0x0047('0x90')](_0x38108e[_0x0047('0x76')],_0x38108e[_0x0047('0xad')],_0x38108e['name'],_0x38108e))[_0x0047('0x9d')](_0x2375ec[_0x0047('0xae')](_0x38108e))['catch'](loggerCatchQueueSummary(_0x0047('0xaf'),_0x38108e));}else{notSendMessagesCampaign(_0x38108e);}}}};Dialer[_0x0047('0x89')][_0x0047('0xb0')]=function(_0x1a9317){if(_0x1a9317[_0x0047('0xb1')]!==_0x0047('0xa')){clearPredictiveAttributes(_0x1a9317);}switch(_0x1a9317[_0x0047('0xb1')]){case _0x0047('0xb2'):this['handlePower'](_0x1a9317,0x1);break;case'power':this['handlePower'](_0x1a9317,_0x1a9317[_0x0047('0xb3')]);break;case _0x0047('0xa'):this['predictive'](_0x1a9317);break;case _0x0047('0xb4'):this[_0x0047('0xb5')](_0x1a9317,0x1);break;default:logger[_0x0047('0x64')](_0x0047('0xb6'),_0x1a9317[_0x0047('0x45')],_0x0047('0xb7'));}};Dialer[_0x0047('0x89')][_0x0047('0x91')]=function(_0x2fd9bd,_0x259e73){var _0x64f6c=_0x2fd9bd[_0x0047('0xad')];var _0x3a28cd=_0x259e73?_0x2fd9bd[_0x0047('0xac')]:_0x2fd9bd[_0x0047('0x76')][_0x0047('0x79')];logger[_0x0047('0xb8')](_0x0047('0xb9'),_0x3a28cd,_0x64f6c,_0x2fd9bd[_0x0047('0x45')],util[_0x0047('0x7d')](_0x0047('0xba'),_0x2fd9bd['name'],_0x2fd9bd['id']));var _0x375a8b=null;return Interval[_0x0047('0xbb')](_0x3a28cd,_0x64f6c)[_0x0047('0x9d')](function(_0x5407c1){if(_0x5407c1===!![]){return _0x5407c1;}else{_0x2fd9bd[_0x0047('0x69')]=_0x259e73?utils['CAMPAIGN_STATUS'][_0x0047('0xa4')]:utils['CAMPAIGN_STATUS'][_0x0047('0xbc')];_0x375a8b=msgResponse(_0x0047('0xa5'),_0x0047('0x92'),'Global:\x20'+_0x259e73+'\x20'+_0x2fd9bd[_0x0047('0x45')]+_0x0047('0xbd')+util[_0x0047('0x67')](_0x3a28cd,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x64f6c);}if(_0x375a8b!==null){logger[_0x0047('0xb8')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x375a8b);_0x375a8b[_0x0047('0xbe')]=_0x259e73;throw _0x375a8b;}})[_0x0047('0x9f')](function(_0x4e5d66){logger[_0x0047('0x64')](_0x0047('0xbf'),_0x4e5d66);throw msgResponse(_0x0047('0xc0'),_0x0047('0xc1'),util[_0x0047('0x67')](_0x4e5d66,{'showHidden':![],'depth':null}));});};Dialer[_0x0047('0x89')][_0x0047('0xc2')]=function(_0x269f60){if(this['voiceQueues'][_0x269f60['queue']]){if(this[_0x0047('0xc3')][_0x269f60[_0x0047('0xc4')]]&&this[_0x0047('0xc3')][_0x269f60[_0x0047('0xc4')]][_0x0047('0xc5')]!==_0x0047('0xc6')){this[_0x0047('0xc7')](this[_0x0047('0x20')][_0x269f60['queue']]);this['uniqueId'][_0x269f60[_0x0047('0xc4')]][_0x0047('0xc8')]=moment()[_0x0047('0x7d')](_0x0047('0xc9'));}}};Dialer[_0x0047('0x89')][_0x0047('0x32')]=function(_0x1de4b9){var _0x41575b=this[_0x0047('0xc3')][_0x1de4b9['uniqueid']];if(this[_0x0047('0x20')][_0x1de4b9[_0x0047('0xca')]]){if(_0x41575b&&_0x41575b[_0x0047('0xc5')]!==_0x0047('0xc6')){delete this[_0x0047('0xc3')][_0x1de4b9[_0x0047('0xc4')]];this[_0x0047('0x20')][_0x1de4b9['queue']][_0x0047('0xcb')]+=0x1;var _0x1ee32f=new AgentComplete(_0x41575b,_0x1de4b9);if(_0x1de4b9[_0x0047('0xcc')]===_0x0047('0xcd')){_0x1ee32f[_0x0047('0xce')]=this['voiceQueues'][_0x1de4b9[_0x0047('0xca')]]['dialQueueProject2']&&this[_0x0047('0x20')][_0x1de4b9[_0x0047('0xca')]]['dialAgiAfterHangupAgent']?moment()[_0x0047('0x7d')](_0x0047('0xc9')):undefined;}hopperUtils[_0x0047('0xcf')](_0x1ee32f)[_0x0047('0x9f')](loggerCatch(_0x0047('0xd0')));hopperUtils[_0x0047('0xd1')](_0x1ee32f)[_0x0047('0x9f')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0047('0x89')][_0x0047('0x2e')]=function(_0xf4e58d){var _0x2b42e3=this['uniqueId'][_0xf4e58d[_0x0047('0xc4')]];var _0x2e1e8f=this;var _0x410f46=![];var _0x4aa2f4;var _0x24ba89;if(this['voiceQueues'][_0xf4e58d['queue']]){if(_0x2b42e3&&_0x2b42e3[_0x0047('0xc5')]!==_0x0047('0xc6')){delete this[_0x0047('0xc3')][_0xf4e58d[_0x0047('0xc4')]];this[_0x0047('0xc7')](this[_0x0047('0x20')][_0xf4e58d['queue']]);_0x2b42e3['droptime']=moment()[_0x0047('0x7d')](_0x0047('0xc9'));var _0x4dedba=new QueueCallerAbandon(_0x2b42e3,_0xf4e58d);if(utils[_0x0047('0xd2')](_0x2b42e3['droptime'],_0x2b42e3[_0x0047('0xd3')])>=_0x2b42e3[_0x0047('0xd4')]){this['voiceQueues'][_0xf4e58d[_0x0047('0xca')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xd5')]+=0x1;this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xd6')]+=0x1;_0x4dedba['state']=0xa;_0x4dedba[_0x0047('0x71')]='Drop';_0x4dedba[_0x0047('0xd7')]=_0x0047('0xd8');_0x4dedba[_0x0047('0xce')]=this[_0x0047('0x20')][_0xf4e58d['queue']][_0x0047('0xd9')]?moment()['format'](_0x0047('0xc9')):undefined;_0x4dedba[_0x0047('0xda')]+=0x1;_0x4dedba['countglobal']+=0x1;_0x4aa2f4=this['voiceQueues'][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xdb')];_0x24ba89=this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xdc')];hopperUtils[_0x0047('0xdd')](_0x4dedba,_0x4dedba[_0x0047('0x70')],_0x2b42e3[_0x0047('0xde')])[_0x0047('0x9d')](function(_0x59844a){_0x410f46=_0x59844a[_0x0047('0xdf')]==0x1;if(_0x4dedba[_0x0047('0xda')]>=_0x2e1e8f[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xe0')]){_0x2e1e8f[_0x0047('0xe1')](_0x4dedba,_0x59844a['additional']);}else{hopperUtils[_0x0047('0xe2')]({'active':![],'countdropretry':_0x4dedba[_0x0047('0xda')],'scheduledat':moment()[_0x0047('0xe3')](_0x2e1e8f[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xdb')],'minutes')['format'](_0x0047('0xc9')),'ContactId':_0x2b42e3[_0x0047('0xe4')],'ListId':_0x2b42e3[_0x0047('0xe5')],'VoiceQueueId':_0x2b42e3[_0x0047('0xe6')]||undefined,'CampaignId':_0x2b42e3[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0xe8')));var _0x14dfe8=new History(_0x4dedba);_0x14dfe8['state']=0xa;_0x14dfe8[_0x0047('0x71')]=_0x0047('0xe9');_0x14dfe8[_0x0047('0xea')]=moment()[_0x0047('0x7d')](_0x0047('0xc9'));_0x14dfe8[_0x0047('0xeb')]=_0x14dfe8['starttime'];_0x14dfe8['calleridname']=_0x4dedba['calleridname'];_0x14dfe8[_0x0047('0xec')]=_0x4dedba[_0x0047('0xec')];hopperUtils['createHistory'](_0x14dfe8)[_0x0047('0x9f')](loggerCatch(_0x0047('0xed')));}})[_0x0047('0x9d')](function(){if(_0x410f46)hopperUtils[_0x0047('0xee')](_0x4dedba,_0x4aa2f4,_0x24ba89)[_0x0047('0x9d')](function(){return 0x1;});});}else{this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0x4d')]+=0x1;this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]]['outboundDropCallsDayCallersExit']+=0x1;_0x4dedba['state']=0xb;_0x4dedba[_0x0047('0x71')]=_0x0047('0xef');_0x4dedba[_0x0047('0xd7')]=_0x0047('0xf0');_0x4dedba[_0x0047('0xf1')]+=0x1;_0x4dedba[_0x0047('0xf2')]+=0x1;_0x4aa2f4=this[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]]['dialAbandonedRetryFrequency'];_0x24ba89=this['voiceQueues'][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xdc')];hopperUtils[_0x0047('0xdd')](_0x4dedba,_0x4dedba[_0x0047('0x70')],_0x2b42e3['voiceQueue'])[_0x0047('0x9d')](function(_0x188e39){if(_0x4dedba['countabandonedretry']>=_0x2e1e8f[_0x0047('0x20')][_0xf4e58d[_0x0047('0xca')]][_0x0047('0xf3')]){_0x2e1e8f[_0x0047('0xe1')](_0x4dedba,_0x188e39[_0x0047('0xdf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4dedba[_0x0047('0xf1')],'scheduledat':moment()[_0x0047('0xe3')](_0x2e1e8f['voiceQueues'][_0xf4e58d[_0x0047('0xca')]]['dialAbandonedRetryFrequency'],_0x0047('0xf4'))[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x2b42e3[_0x0047('0xe4')],'ListId':_0x2b42e3[_0x0047('0xe5')],'VoiceQueueId':_0x2b42e3[_0x0047('0xe6')]||undefined,'CampaignId':_0x2b42e3['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0xf5')));var _0x4de948=new History(_0x4dedba);_0x4de948[_0x0047('0x70')]=0xb;_0x4de948[_0x0047('0x71')]=_0x0047('0xef');_0x4de948['starttime']=moment()[_0x0047('0x7d')](_0x0047('0xc9'));_0x4de948[_0x0047('0xeb')]=_0x4de948[_0x0047('0xea')];_0x4de948[_0x0047('0xf6')]=_0x4dedba[_0x0047('0xf6')];_0x4de948[_0x0047('0xec')]=_0x4dedba[_0x0047('0xec')];hopperUtils[_0x0047('0xcf')](_0x4de948)['catch'](loggerCatch(_0x0047('0xf7')));}})[_0x0047('0x9d')](function(){if(_0x410f46)hopperUtils[_0x0047('0xee')](_0x4dedba,_0x4aa2f4,_0x24ba89)[_0x0047('0x9d')](function(){return 0x1;});});}}}};Dialer[_0x0047('0x89')][_0x0047('0x38')]=function(_0xd22ceb){if(this[_0x0047('0x25')][_0xd22ceb[_0x0047('0xc4')]]){this[_0x0047('0x25')][_0xd22ceb[_0x0047('0xc4')]][_0x0047('0xf8')]=_0xd22ceb[_0x0047('0xf8')];}if(this[_0x0047('0xc3')][_0xd22ceb[_0x0047('0xc4')]]){this['uniqueId'][_0xd22ceb[_0x0047('0xc4')]][_0x0047('0xf8')]=_0xd22ceb[_0x0047('0xf8')];}};Dialer[_0x0047('0x89')][_0x0047('0x3b')]=function(_0x517dfb){if(!this[_0x0047('0x25')][_0x517dfb['actionid']]){return;}var _0x246c2f=this[_0x0047('0x20')][this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xca')]][_0x0047('0xfa')]||'rrmemory';if(_0x246c2f===_0x0047('0xfb')){if(this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]]&&_[_0x0047('0xfc')](this['actions'][_0x517dfb['actionid']][_0x0047('0xfd')])&&_0x517dfb[_0x0047('0x87')]==='1'&&_0x517dfb['paused']==='0'){if(this['agents'][_0x517dfb[_0x0047('0xfe')]]){if(!this[_0x0047('0x22')][_0x517dfb['stateinterface']][_0x0047('0xfd')]){this[_0x0047('0x22')][_0x517dfb[_0x0047('0xfe')]][_0x0047('0xfd')]=!![];this['actions'][_0x517dfb['actionid']][_0x0047('0xfd')]=!![];this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xfe')]=_0x517dfb[_0x0047('0xfe')];}}}}else if(_0x246c2f===_0x0047('0xff')){if(this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]]){if(this[_0x0047('0x22')][_0x517dfb[_0x0047('0xfe')]]){this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xfe')]=_0x517dfb['stateinterface'];if(_[_0x0047('0xfc')](this[_0x0047('0x100')][this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xca')]])){this[_0x0047('0x100')][this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xca')]]=[];}this[_0x0047('0x100')][this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]][_0x0047('0xca')]]['push'](_[_0x0047('0x101')](_[_0x0047('0x102')](this[_0x0047('0x25')][_0x517dfb[_0x0047('0xf9')]],[_0x0047('0x103'),_0x0047('0xfe')]),{'status':_0x517dfb['status'],'paused':_0x517dfb['paused']}));}}}};Dialer['prototype'][_0x0047('0x104')]=function(_0x4e5430){if(!this['actions'][_0x4e5430[_0x0047('0xf9')]]){return;}var _0x968b86=this;var _0x3ecc68=this[_0x0047('0x20')][this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]];var _0xc8c940=_0x3ecc68[_0x0047('0xfa')]||_0x0047('0xff');if(_0xc8c940==='roundrobin'){if(this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]]&&this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xfe')]){this['preview'][_0x0047('0x105')](this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0x103')],this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xfe')])['catch'](function(_0x99c741){logger['error'](_0x0047('0x106'),util[_0x0047('0x67')](_0x99c741,{'showHidden':![],'depth':null}));})[_0x0047('0x1d')](function(){_0x968b86['updateOriginated'](_0x968b86['voiceQueues'][_0x968b86[_0x0047('0x25')][_0x4e5430['actionid']][_0x0047('0xca')]]);_0x968b86['agents'][_0x968b86[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xfe')]][_0x0047('0xfd')]=![];delete _0x968b86[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]];unlockQueueStatus(_0x3ecc68);});}else{this[_0x0047('0xc7')](this[_0x0047('0x20')][this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]]);hopperUtils[_0x0047('0xe2')]({'active':![],'ContactId':this['actions'][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xe4')],'ListId':this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xe5')],'VoiceQueueId':this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xe6')]||undefined,'CampaignId':this['actions'][_0x4e5430[_0x0047('0xf9')]]['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x107')));delete this[_0x0047('0x25')][_0x4e5430['actionid']];unlockQueueStatus(_0x3ecc68);}}else if(_0xc8c940===_0x0047('0xff')){var _0x25d695;if(this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]]&&!_[_0x0047('0x7a')](this['queueBooked'][this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]])){if(this[_0x0047('0x108')][_0x968b86['actions'][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]]){this[_0x0047('0x108')][_0x968b86[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]]=this[_0x0047('0x108')][this[_0x0047('0x25')][_0x4e5430['actionid']][_0x0047('0xca')]]?this['queueBookedRR'][this['actions'][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]]:this[_0x0047('0x100')][this['actions'][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]]?this[_0x0047('0x100')][this[_0x0047('0x25')][_0x4e5430[_0x0047('0xf9')]][_0x0047('0xca')]][_0x0047('0x109')]||0x0:0x0;}this[_0x0047('0x100')][this['actions'][_0x4e5430[_0x0047('0xf9')]]['queue']][_0x0047('0x109')]=this['queueBookedRR'][this['actions'][_0x4e5430['actionid']][_0x0047('0xca')]];for(var _0x2d42f5=0x0;_0x2d42f5=_0x13f1da[_0x0047('0x12b')]){_0x4daea8[_0x0047('0x12c')](_0x24941d,_0x506c22,_0x14ed1b,_0x0047('0x12d'));}else{if(_0x24941d[_0x0047('0x126')]>=_0x13f1da['dialMachineMaxRetry']){_0x4daea8[_0x0047('0x12e')](_0x24941d,_0x506c22,_0x14ed1b,_0x0047('0x12f'));}else{hopperUtils[_0x0047('0xe2')]({'active':![],'countmachineretry':_0x24941d[_0x0047('0x126')],'scheduledat':moment()['add'](_0x13f1da[_0x0047('0x130')],'minutes')[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x24941d[_0x0047('0xe4')],'ListId':_0x24941d[_0x0047('0xe5')],'VoiceQueueId':_0x24941d[_0x0047('0xe6')]||undefined,'CampaignId':_0x24941d[_0x0047('0xe7')]||undefined})['catch'](loggerCatch(_0x0047('0x131')));_0x506c22({'reschedule':0x1});}}});}if(_0x3becc2[_0x0047('0xc5')]===_0x0047('0xc6')&&this[_0x0047('0x21')][_0x3becc2[_0x0047('0xca')]][_0x0047('0x132')]&&_0x2af876[_0x0047('0x11b')]===_0x0047('0x133')){delete this[_0x0047('0xc3')][_0x2af876[_0x0047('0xc4')]];this[_0x0047('0xc7')](this[_0x0047('0x21')][_0x3becc2[_0x0047('0xca')]]);_0x267f9a=new Hangup(_0x3becc2,_0x2af876);_0x267f9a['state']=0x12;_0x267f9a[_0x0047('0x71')]='HangupInAMD';_0x267f9a['membername']=_0x0047('0x11e');ami[_0x0047('0x41')](_0x0047('0x11f'),ut[_0x0047('0x120')](_0x267f9a,_0x0047('0x121')));this['saveInDb'](_0x267f9a,_0x0047('0x134'),'[syncHangupInAMDIvr]');}if(_0x3becc2[_0x0047('0xc5')]===_0x0047('0xc6')&&this['campaigns'][_0x3becc2[_0x0047('0xca')]][_0x0047('0x132')]&&_0x2af876[_0x0047('0x11b')]==='MACHINE'){return new Promise(function(_0x3c17b6,_0x179d85){delete _0x4daea8[_0x0047('0xc3')][_0x2af876[_0x0047('0xc4')]];_0x4daea8['updateOriginated'](_0x4daea8[_0x0047('0x21')][_0x3becc2[_0x0047('0xca')]]);_0x4daea8[_0x0047('0x21')][_0x3becc2[_0x0047('0xca')]][_0x0047('0xcb')]+=0x1;_0x4daea8[_0x0047('0x21')][_0x3becc2[_0x0047('0xca')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x436d55=_0x4daea8['campaigns'][_0x3becc2[_0x0047('0xca')]];var _0x36d920=new Hangup(_0x3becc2,_0x2af876);_0x36d920[_0x0047('0x70')]=0x13;_0x36d920[_0x0047('0x71')]='Machine';_0x36d920['membername']=_0x0047('0x11e');_0x36d920[_0x0047('0x126')]+=0x1;_0x36d920['countglobal']+=0x1;_0x36d920[_0x0047('0x121')]=!![];ami[_0x0047('0x41')](_0x0047('0x11f'),ut[_0x0047('0x120')](_0x36d920,_0x0047('0x121')));hopperUtils['createHistory'](_0x36d920)[_0x0047('0x9f')](loggerCatch(_0x0047('0x127')));if(_0x36d920[_0x0047('0x128')]+_0x36d920['countcongestionretry']+_0x36d920['countnoanswerretry']+_0x36d920[_0x0047('0x129')]+_0x36d920['countdropretry']+_0x36d920[_0x0047('0xf1')]+_0x36d920[_0x0047('0x126')]+_0x36d920['countagentrejectretry']>=_0x436d55['dialGlobalMaxRetry']){_0x4daea8[_0x0047('0x12c')](_0x36d920,_0x3c17b6,_0x179d85,_0x0047('0x12d'));}else{if(_0x36d920[_0x0047('0x126')]>=_0x436d55[_0x0047('0x135')]){_0x4daea8['createStateFinal'](_0x36d920,_0x3c17b6,_0x179d85,_0x0047('0x12f'));}else{hopperUtils[_0x0047('0xe2')]({'active':![],'countmachineretry':_0x36d920['countmachineretry'],'scheduledat':moment()[_0x0047('0xe3')](_0x436d55[_0x0047('0x130')],_0x0047('0xf4'))[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x36d920[_0x0047('0xe4')],'ListId':_0x36d920[_0x0047('0xe5')],'VoiceQueueId':_0x36d920[_0x0047('0xe6')]||undefined,'CampaignId':_0x36d920[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x3c17b6({'reschedule':0x1});}}});}}};Dialer[_0x0047('0x89')][_0x0047('0x37')]=function(_0x5a9b1d){var _0x47d6ff=this[_0x0047('0xc3')][_0x5a9b1d['uniqueid']];var _0x1d9e29;if(_0x47d6ff&&_0x47d6ff['type']==='ivr'){delete this[_0x0047('0xc3')][_0x5a9b1d[_0x0047('0xc4')]];this[_0x0047('0xc7')](this[_0x0047('0x21')][_0x47d6ff[_0x0047('0xca')]]);this[_0x0047('0x21')][_0x47d6ff[_0x0047('0xca')]][_0x0047('0x136')]+=0x1;_0x1d9e29=new Hangup(_0x47d6ff,_0x5a9b1d);hopperUtils[_0x0047('0xcf')](_0x1d9e29)[_0x0047('0x9f')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0047('0xd1')](_0x1d9e29)[_0x0047('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0x47d6ff&&_0x47d6ff[_0x0047('0xc5')]!==_0x0047('0xc6')&&isNotNull(this[_0x0047('0x20')][_0x47d6ff['queue']][_0x0047('0x137')])){delete this['uniqueId'][_0x5a9b1d[_0x0047('0xc4')]];this[_0x0047('0xc7')](this['voiceQueues'][_0x47d6ff[_0x0047('0xca')]]);this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]][_0x0047('0xcb')]+=0x1;this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]][_0x0047('0x11c')]+=0x1;_0x1d9e29=new Hangup(_0x47d6ff,_0x5a9b1d);_0x1d9e29[_0x0047('0x70')]=0x10;_0x1d9e29['statedesc']=_0x0047('0x138');_0x1d9e29['membername']=_0x0047('0x139');hopperUtils['createHistory'](_0x1d9e29)['catch'](loggerCatch(_0x0047('0x13a')));hopperUtils[_0x0047('0xd1')](_0x1d9e29)[_0x0047('0x9f')](loggerCatch(_0x0047('0x13b')));}if(_0x47d6ff&&_0x47d6ff[_0x0047('0xc5')]!==_0x0047('0xc6')&&!isNotNull(this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]][_0x0047('0x137')])){if(_0x5a9b1d['cause-txt']===_0x0047('0x13c')){delete this[_0x0047('0xc3')][_0x5a9b1d[_0x0047('0xc4')]];this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]][_0x0047('0xcb')]+=0x1;const _0x2e9d0a=new AgentComplete(_0x47d6ff,_0x5a9b1d);_0x2e9d0a['CampaignId']=this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]]['id'];hopperUtils[_0x0047('0xcf')](_0x2e9d0a)[_0x0047('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0047('0xd1')](_0x2e9d0a)[_0x0047('0x9f')](loggerCatch('[syncAgentComplete]'));}else{delete this['uniqueId'][_0x5a9b1d[_0x0047('0xc4')]];this['updateOriginated'](this[_0x0047('0x20')][_0x47d6ff[_0x0047('0xca')]]);this['voiceQueues'][_0x47d6ff['queue']]['outboundUnknownCallsDay']+=0x1;_0x1d9e29=new Hangup(_0x47d6ff,_0x5a9b1d);_0x1d9e29[_0x0047('0x70')]=0xc;_0x1d9e29[_0x0047('0x71')]=_0x5a9b1d[_0x0047('0x13d')];_0x1d9e29[_0x0047('0x11d')]='Unknow';hopperUtils[_0x0047('0xcf')](_0x1d9e29)[_0x0047('0x9f')](loggerCatch(_0x0047('0x13a')));hopperUtils[_0x0047('0xd1')](_0x1d9e29)[_0x0047('0x9f')](loggerCatch('[syncHangupIvr]'));}}};Dialer['prototype'][_0x0047('0xc')]=function(_0x191aad){var _0x3cb69b=this;if(!_0x3cb69b['queuesSummary'][_0x191aad[_0x0047('0x45')]]){_0x3cb69b[_0x0047('0x2b')][_0x191aad[_0x0047('0x45')]]={'running':![]};}else if(_0x3cb69b['queuesSummary'][_0x191aad[_0x0047('0x45')]][_0x0047('0x13e')]===!![]){return;}else if(_0x3cb69b[_0x0047('0x2b')][_0x191aad[_0x0047('0x45')]]['running']===![]){_0x3cb69b[_0x0047('0x2b')][_0x191aad[_0x0047('0x45')]][_0x0047('0x13e')]=!![];}var _0x3ad3f2=_0x3cb69b['voiceQueues'][_0x191aad['name']];var _0x508f05=_0x3ad3f2[_0x0047('0x69')]!==utils[_0x0047('0x6a')][_0x0047('0x7c')];var _0x326828=utils[_0x0047('0x13f')](_0x3ad3f2);_0x3ad3f2[_0x0047('0x140')]=utils[_0x0047('0x141')](_0x3ad3f2,_0x3cb69b[_0x0047('0x23')]);Promise[_0x0047('0xab')]()['then'](function(){if(_0x3ad3f2[_0x0047('0x140')]===utils[_0x0047('0x6a')]['INACTIVE']){if(_0x508f05){clearPredictiveAttributes(_0x3ad3f2);_0x191aad[_0x0047('0x28')]=undefined;_0x191aad[_0x0047('0x29')]=undefined;}if(_0x3ad3f2[_0x0047('0x140')]===utils[_0x0047('0x6a')]['INACTIVE']){_0x191aad[_0x0047('0x142')]=0x0;_0x191aad[_0x0047('0x10a')]=0x0;_0x191aad[_0x0047('0x143')]=0x0;_0x191aad['talking']=0x0;_0x191aad[_0x0047('0x144')]=0x0;}}else if(_0x3ad3f2['statusMessage']===utils[_0x0047('0x6a')]['ACTIVE']&&!_0x326828){return _0x3cb69b['ifTime'](_0x3ad3f2,!![])[_0x0047('0x9d')](function(){return _0x3cb69b[_0x0047('0x91')](_0x3ad3f2,![]);})[_0x0047('0x9d')](function(){return _0x3cb69b[_0x0047('0xb0')](_0x3ad3f2);})[_0x0047('0x9f')](function(_0x2f2f12){loggerSyncQueueSummary[_0x0047('0x43')](_0x0047('0x145'),util[_0x0047('0x67')](_0x2f2f12,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3ad3f2);});}else{clearPredictiveAttributes(_0x3ad3f2);}})['then'](function(){var _0xa7279=_0x191aad['compareToOutboundQueue'](_0x3ad3f2);if(_0xa7279||_0x3ad3f2['queueSummaryCountersUpdated']){_0x3ad3f2[_0x0047('0x146')]=![];_0x191aad[_0x0047('0x147')](_0x3ad3f2);Object[_0x0047('0x148')](_0x3ad3f2,_0x191aad);emitOutboundVoiceQueueSummary(_0x191aad);}_0x3cb69b[_0x0047('0x2b')][_0x3ad3f2[_0x0047('0x45')]]['running']=![];})[_0x0047('0x9f')](function(_0x3cd54f){logger[_0x0047('0x64')](_0x0047('0x145'),util[_0x0047('0x67')](_0x3cd54f,{'showHidden':![],'depth':null}));_0x3cb69b[_0x0047('0x2b')][_0x3ad3f2[_0x0047('0x45')]]['running']=![];});};Dialer[_0x0047('0x89')][_0x0047('0x35')]=_['throttle'](function(){var _0x284558=_[_0x0047('0x149')](this['voiceQueues'],function(_0x547220){return _0x547220[_0x0047('0x14a')];});var _0xd4bc95=_[_0x0047('0x149')](this[_0x0047('0x22')],function(_0x1ded18){return _0x1ded18[_0x0047('0x14b')]&&_0x1ded18[_0x0047('0x87')]===_0x0047('0x14c');});if(_0x284558['length']>0x0&&_0xd4bc95[_0x0047('0x99')]>0x0){return Promise[_0x0047('0xab')]()[_0x0047('0x9d')](cmHopper[_0x0047('0x14d')](_['map'](_0x284558,'id'),previewRecallmeReminderInterval,_[_0x0047('0x14e')](_0xd4bc95,'id')))['then'](function(_0x417639){for(var _0x4e3a9a=0x0;_0x4e3a9a<_0x417639[_0x0047('0x99')];_0x4e3a9a++){var _0x1f1c65=_0x417639[_0x4e3a9a][_0x0047('0x14f')][_0x0047('0x45')];if(_0x1f1c65)io['to'](util['format'](_0x0047('0x150'),_0x1f1c65))['emit'](_0x0047('0x151'),{'hopper':_0x417639[_0x4e3a9a]});}})[_0x0047('0x9f')](function(_0x1df7b2){logger[_0x0047('0x64')](_0x0047('0x152'),_0x1df7b2);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0047('0x89')][_0x0047('0x153')]=function(){var _0x2d6c39=this;setInterval(function(){_0x2d6c39[_0x0047('0x154')](_0x2d6c39[_0x0047('0xc3')],'[uniqueid]');_0x2d6c39['clearZombieChannels'](_0x2d6c39[_0x0047('0x25')],_0x0047('0x155'));},0x32c8);};Dialer['prototype'][_0x0047('0x154')]=function(_0x9798f8,_0x4d3980){var _0x17c45b=this;for(var _0xbc0d36 in _0x9798f8){if(typeof _0x9798f8[_0xbc0d36]!==_0x0047('0xaa')){this[_0x0047('0x1e')][_0x0047('0x1b')](function(){if(!_[_0x0047('0xfc')](_0x9798f8[_0xbc0d36])){return ami['Action']({'action':_0x0047('0x87'),'channel':_0x9798f8[_0xbc0d36][_0x0047('0xf8')]})[_0x0047('0x9f')](function(_0x3cfd6a){if(_0x3cfd6a[_0x0047('0x69')]===_0x0047('0x156')){setTimeout(function(){if(_0x9798f8[_0xbc0d36]&&_0x9798f8[_0xbc0d36]['type']!==_0x0047('0xc6')){_0x17c45b[_0x0047('0xc7')](_0x17c45b['voiceQueues'][_0x9798f8[_0xbc0d36]['queue']]);logger['error'](_0x0047('0x157'),_0x4d3980,_0xbc0d36,_0x9798f8[_0xbc0d36][_0x0047('0xca')]);delete _0x9798f8[_0xbc0d36];}if(_0x9798f8[_0xbc0d36]&&_0x9798f8[_0xbc0d36]['type']==='ivr'){_0x17c45b[_0x0047('0xc7')](_0x17c45b[_0x0047('0x21')][_0x9798f8[_0xbc0d36][_0x0047('0xca')]]);logger[_0x0047('0x64')]('[Dialer][checkChannel][ivr]',_0x4d3980,_0xbc0d36,_0x9798f8[_0xbc0d36][_0x0047('0xca')]);delete _0x9798f8[_0xbc0d36];}},0x2328);}});}});}}};Dialer[_0x0047('0x89')][_0x0047('0x158')]=function(_0x24eed8){return Promise[_0x0047('0xab')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x24eed8))['catch'](loggerCatch(_0x0047('0x159')));};Dialer[_0x0047('0x89')]['updateOriginated']=function(_0x3aa8f3){if(!_['isUndefined'](_0x3aa8f3)&&_0x3aa8f3!==null){if(typeof _0x3aa8f3[_0x0047('0x80')]!==_0x0047('0xaa')){if(_0x3aa8f3[_0x0047('0x80')]>0x0){_0x3aa8f3[_0x0047('0x80')]-=0x1;}else{logger[_0x0047('0x64')](_0x0047('0x15a'));}}}else{logger['error'](_0x0047('0x15b'));}};Dialer['prototype']['loggerHandler']=function(_0x16fc10,_0x408809){var _0x35ed25=this;return function(_0x5440d4){_0x35ed25['updateOriginated'](_0x408809);logger[_0x0047('0x64')](_0x16fc10,util[_0x0047('0x67')](_0x5440d4,{'showHidden':![],'depth':null}));};};Dialer[_0x0047('0x89')][_0x0047('0x15c')]=function(_0xe19228,_0x3d12be,_0x1d5b9d){var _0x199958={'state':0x19,'statedesc':'notFound'};this[_0x0047('0xc7')](_0x3d12be);this[_0x0047('0x122')](_[_0x0047('0x101')](_0x199958,_['pick'](_0x1d5b9d,[_0x0047('0xe4'),_0x0047('0xe5'),_0x0047('0x15d'),_0x0047('0xe6'),_0x0047('0xe7')])),'[emptyContact][createHistory]',_0x0047('0x15e'));logger[_0x0047('0x64')](_0xe19228);};Dialer['prototype']['saveInDb']=function(_0x37c550,_0x3104d6,_0x36d770){hopperUtils['createHistory'](_0x37c550)['catch'](loggerCatch(_0x3104d6));hopperUtils[_0x0047('0xd1')](_0x37c550)[_0x0047('0x9f')](loggerCatch(_0x36d770));};Dialer['prototype'][_0x0047('0xe1')]=function(_0x3e6eb6,_0x917da6){hopperUtils['createHistory'](_0x3e6eb6)['catch'](loggerCatch(_0x0047('0xd0')));if(_0x917da6==0x0){hopperUtils[_0x0047('0xd1')](_0x3e6eb6)[_0x0047('0x9f')](loggerCatch(_0x0047('0x15f')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x4fe818){return Promise[_0x0047('0xab')]()[_0x0047('0x9d')](cmHopper[_0x0047('0x14d')](_0x4fe818['id'],previewRecallmeReminderInterval))[_0x0047('0x9d')](function(_0x141c73){for(var _0x2b4cd3=0x0;_0x2b4cd3<_0x141c73['length'];_0x2b4cd3++){var _0x33db83=_0x141c73[_0x2b4cd3][_0x0047('0x14f')][_0x0047('0x45')];if(_0x33db83)io['to'](util[_0x0047('0x7d')](_0x0047('0x150'),_0x33db83))[_0x0047('0x41')](_0x0047('0x151'),{'hopper':_0x141c73[_0x2b4cd3]});}})[_0x0047('0x9f')](function(){});};Dialer[_0x0047('0x89')]['launchHandleIvr']=function(_0xf794d6){var _0x1a47e7=this;return function(){_0x1a47e7[_0x0047('0x160')](_0xf794d6);};};Dialer[_0x0047('0x89')][_0x0047('0x161')]=function(_0x9141e5,_0x224c82){var _0x485ab2=this;var _0x4e608b=uuid['v4']();this[_0x0047('0x25')][_0x4e608b]=new Action(_0x9141e5,_0x224c82,_0x4e608b);return new Promise(function(_0x88042,_0x3d7af2){if(_[_0x0047('0x40')](_0x9141e5)&&typeof _0x9141e5!==_0x0047('0x162')){return _0x3d7af2(msgResponse(_0x0047('0x163'),'Failure',_0x0047('0x164')));}if(_[_0x0047('0x40')](_0x224c82[_0x0047('0x165')])||_0x224c82[_0x0047('0x165')]===null){return _0x3d7af2(msgResponse(_0x0047('0x163'),_0x0047('0x92'),_0x0047('0x166')));}var _0x139c5d={'XMD-CALLERID':_0x485ab2[_0x0047('0x25')][_0x4e608b]['getCaller'](),'XMD-AGI':_0x9141e5[_0x0047('0x137')]?util[_0x0047('0x7d')](_0x0047('0x167'),ipAgi,_0x9141e5[_0x0047('0x137')]):_0x0047('0x168'),'XMD-AGIAFTER':_0x9141e5[_0x0047('0xd9')]?util[_0x0047('0x7d')](_0x0047('0x167'),ipAgi,_0x9141e5[_0x0047('0xd9')]):'NONE','XMD-QUEUE':utils[_0x0047('0x169')](_0x9141e5)?util[_0x0047('0x7d')](_0x0047('0x16a'),_0x9141e5[_0x0047('0x45')],_0x9141e5[_0x0047('0x16b')]||'',_0x9141e5['dialAgiAfterHangupAgent']?'c':'',_0x9141e5[_0x0047('0xd4')]||0x3):_0x0047('0x168'),'XMD-CONTACTID':_0x224c82[_0x0047('0xe4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x485ab2[_0x0047('0x25')][_0x4e608b][_0x0047('0x16c')](),'XMD-AMD':_0x9141e5[_0x0047('0x132')]?'ACTIVE':_0x0047('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x9141e5[_0x0047('0x132')]){_0x139c5d[_0x0047('0x16d')]=_0x9141e5[_0x0047('0x16e')]||0x9c4;_0x139c5d[_0x0047('0x16f')]=_0x9141e5['dialAMDGreeting']||0x5dc;_0x139c5d[_0x0047('0x170')]=_0x9141e5[_0x0047('0x171')]||0x320;_0x139c5d[_0x0047('0x172')]=_0x9141e5['dialAMDTotalAnalysisTime']||0x1388;_0x139c5d[_0x0047('0x173')]=_0x9141e5[_0x0047('0x174')]||0x64;_0x139c5d[_0x0047('0x175')]=_0x9141e5['dialAMDBetweenWordsSilence']||0x32;_0x139c5d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x9141e5[_0x0047('0x176')]||0x3;_0x139c5d[_0x0047('0x177')]=_0x9141e5[_0x0047('0x178')]||0x100;_0x139c5d[_0x0047('0x179')]=_0x9141e5[_0x0047('0x17a')]||0x1388;}if(utils[_0x0047('0x169')](_0x9141e5)){_0x139c5d['XMD-VOICEQUEUEID']=_0x224c82['VoiceQueueId'];}else{_0x139c5d[_0x0047('0x17b')]=_0x224c82[_0x0047('0xe7')];}var _0x309f67=utils[_0x0047('0x17c')](_0x224c82['Contact']);Object[_0x0047('0x148')](_0x139c5d,_0x309f67);var _0x3de07=_0x485ab2['isTrunkReachable'](_0x9141e5[_0x0047('0x8b')])?utils[_0x0047('0x17d')](_0x9141e5[_0x0047('0x8b')]['callerid'],_0x9141e5[_0x0047('0x17e')],_0x9141e5['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x0047('0x17f')](_0x9141e5[_0x0047('0x180')],_0x9141e5[_0x0047('0x181')]):_0x9141e5[_0x0047('0x180')]):utils['getCallerId'](_[_0x0047('0xfc')](_0x9141e5[_0x0047('0x8c')])?_0x9141e5[_0x0047('0x8b')][_0x0047('0x182')]:_0x9141e5['TrunkBackup'][_0x0047('0x182')],_0x9141e5['dialOriginateCallerIdName'],_0x9141e5[_0x0047('0x181')]>0x0?utils[_0x0047('0x17f')](_0x9141e5['dialOriginateCallerIdNumber'],_0x9141e5[_0x0047('0x181')]):_0x9141e5[_0x0047('0x180')]);if(_0x3de07){_0x139c5d[_0x0047('0x183')]=_0x485ab2['actions'][_0x4e608b]['originatecalleridname']=utils[_0x0047('0x184')](_0x3de07);_0x139c5d[_0x0047('0x185')]=_0x224c82['phone'];}_0x9141e5[_0x0047('0x186')]=_0x139c5d;return ami[_0x0047('0x9b')]({'actionid':_0x4e608b,'action':'originate','channel':_0x485ab2[_0x0047('0x84')](_0x9141e5[_0x0047('0x8b')])?util[_0x0047('0x7d')](_0x0047('0x187'),_0x9141e5[_0x0047('0x8b')]['name'],isNotNull(_0x9141e5['dialPrefix'])?_0x9141e5['dialPrefix']['trim']()||'':'',_0x9141e5[_0x0047('0x188')]>0x0?_0x224c82[_0x0047('0x165')][_0x0047('0x189')](_0x9141e5[_0x0047('0x188')]):_0x224c82[_0x0047('0x165')]):util['format'](_0x0047('0x187'),_['isNil'](_0x9141e5[_0x0047('0x8c')])?_0x9141e5['Trunk'][_0x0047('0x45')]:_0x9141e5['TrunkBackup'][_0x0047('0x45')],isNotNull(_0x9141e5[_0x0047('0x18a')])?_0x9141e5['dialPrefix'][_0x0047('0x18b')]()||'':'',_0x9141e5[_0x0047('0x188')]>0x0?_0x224c82['phone'][_0x0047('0x189')](_0x9141e5['dialCutDigit']):_0x224c82[_0x0047('0x165')]),'callerid':_0x3de07,'Exten':_0x0047('0x11a'),'Context':'from-sip','Priority':'1','variable':_0x139c5d,'timeout':(_0x9141e5[_0x0047('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e608b})['then'](function(_0x3e0384){return _0x88042(_0x3e0384);})['catch'](function(_0x265ed4){_0x9141e5[_0x0047('0x18d')]+=0x1;var _0x255b08=new History(_0x485ab2[_0x0047('0x25')][_0x4e608b]);logger[_0x0047('0x64')](util[_0x0047('0x7d')](_0x0047('0x18e'),JSON[_0x0047('0x75')](_0x265ed4)));_0x255b08['state']=0xe;_0x255b08[_0x0047('0x71')]=_0x0047('0x18f');_0x255b08[_0x0047('0xea')]=moment()['format'](_0x0047('0xc9'));_0x255b08[_0x0047('0xeb')]=_0x255b08[_0x0047('0xea')];hopperUtils['createHistory'](_0x255b08)[_0x0047('0x9f')](loggerCatch(_0x0047('0x190')));_0x485ab2['moveContactManagedDialer'](_0x255b08)[_0x0047('0x9f')](loggerCatch('[originate][error]'))[_0x0047('0x1d')](function(){delete _0x485ab2['actions'][_0x4e608b];return _0x3d7af2(msgResponse(_0x0047('0x163'),_0x0047('0xc1'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x0047('0x191')]=function(_0x39043c,_0x47ffb9,_0x39b094){var _0x3b16e6=new History(_0x47ffb9);if(_0x3b16e6[_0x0047('0x128')]+_0x3b16e6['countcongestionretry']+_0x3b16e6[_0x0047('0x192')]+_0x3b16e6[_0x0047('0x129')]+_0x3b16e6['countdropretry']+_0x3b16e6[_0x0047('0xf1')]+_0x3b16e6['countmachineretry']+_0x3b16e6[_0x0047('0x12a')]>=_0x39b094[_0x0047('0x12b')]-0x1){return!![];}switch(_0x39043c){case 0x3:if(_0x3b16e6['countnoanswerretry']>=_0x39b094[_0x0047('0x193')]-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countnoanswerretry':_0x3b16e6[_0x0047('0x192')]+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094['dialNoAnswerRetryFrequency'],_0x0047('0xf4'))[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6[_0x0047('0xe4')],'ListId':_0x3b16e6['ListId'],'VoiceQueueId':_0x3b16e6['VoiceQueueId']||undefined,'CampaignId':_0x3b16e6[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3b16e6[_0x0047('0x128')]>=_0x39b094[_0x0047('0x194')]-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countbusyretry':_0x3b16e6['countbusyretry']+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094[_0x0047('0x195')],'minutes')[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6['ContactId'],'ListId':_0x3b16e6[_0x0047('0xe5')],'VoiceQueueId':_0x3b16e6['VoiceQueueId']||undefined,'CampaignId':_0x3b16e6['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x196')));break;case 0x8:if(_0x3b16e6['countcongestionretry']>=_0x39b094[_0x0047('0x197')]-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countcongestionretry':_0x3b16e6[_0x0047('0x198')]+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094['dialCongestionRetryFrequency'],_0x0047('0xf4'))[_0x0047('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b16e6['ContactId'],'ListId':_0x3b16e6['ListId'],'VoiceQueueId':_0x3b16e6[_0x0047('0xe6')]||undefined,'CampaignId':_0x3b16e6[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x199')));break;case 0x0:if(_0x3b16e6[_0x0047('0x129')]>=_0x39b094['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3b16e6[_0x0047('0x129')]+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094[_0x0047('0x19a')],_0x0047('0xf4'))[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6['ContactId'],'ListId':_0x3b16e6[_0x0047('0xe5')],'VoiceQueueId':_0x3b16e6[_0x0047('0xe6')]||undefined,'CampaignId':_0x3b16e6['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x19b')));}break;case 0xa:if(_0x3b16e6[_0x0047('0xda')]>=_0x39b094[_0x0047('0xe0')]-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countdropretry':_0x3b16e6['countdropretry']+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094['dialDropRetryFrequency'],_0x0047('0xf4'))[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6[_0x0047('0xe4')],'ListId':_0x3b16e6[_0x0047('0xe5')],'VoiceQueueId':_0x3b16e6['VoiceQueueId']||undefined,'CampaignId':_0x3b16e6[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3b16e6[_0x0047('0xf1')]>=_0x39b094['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countabandonedretry':_0x3b16e6[_0x0047('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x39b094[_0x0047('0x19c')],'minutes')[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6[_0x0047('0xe4')],'ListId':_0x3b16e6[_0x0047('0xe5')],'VoiceQueueId':_0x3b16e6[_0x0047('0xe6')]||undefined,'CampaignId':_0x3b16e6[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3b16e6['countmachineretry']>=_0x39b094[_0x0047('0x135')]-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countmachineretry':_0x3b16e6[_0x0047('0x126')]+=0x1,'scheduledat':moment()[_0x0047('0xe3')](_0x39b094[_0x0047('0x130')],'minutes')[_0x0047('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b16e6[_0x0047('0xe4')],'ListId':_0x3b16e6[_0x0047('0xe5')],'VoiceQueueId':_0x3b16e6[_0x0047('0xe6')]||undefined,'CampaignId':_0x3b16e6[_0x0047('0xe7')]||undefined})['catch'](loggerCatch(_0x0047('0x131')));break;case 0x14:if(_0x3b16e6[_0x0047('0x12a')]>=_0x39b094['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x0047('0xe2')]({'active':![],'countagentrejectretry':_0x3b16e6[_0x0047('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x39b094[_0x0047('0x19d')],'minutes')[_0x0047('0x7d')](_0x0047('0xc9')),'ContactId':_0x3b16e6[_0x0047('0xe4')],'ListId':_0x3b16e6['ListId'],'VoiceQueueId':_0x3b16e6[_0x0047('0xe6')]||undefined,'CampaignId':_0x3b16e6['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x19e')));break;default:return!![];}};Dialer[_0x0047('0x89')][_0x0047('0x19f')]=function(_0x507f64,_0x23920f,_0x25d478){var _0xae9f56=this;var _0xce8017=new History(_0x507f64);var _0x18da0f=![];var _0x43817e;var _0x47d996;return new Promise(function(_0x3b51f9,_0x4d95ac){if(_[_0x0047('0x40')](_0x23920f)&&typeof _0x23920f!==_0x0047('0x162')){return _0x4d95ac(msgResponse(_0x0047('0x1a0'),_0x0047('0x92'),'entity\x20is\x20undefine'));}if(_[_0x0047('0x40')](_0x25d478)&&typeof _0x25d478!=='object'){return _0x4d95ac(msgResponse(_0x0047('0x1a0'),_0x0047('0x92'),'evt\x20is\x20undefine'));}hopperUtils[_0x0047('0xdd')](_0xce8017,_0x25d478['reason'],_0x23920f)[_0x0047('0x9d')](function(_0x34b46e){if(_0x34b46e[_0x0047('0xdf')]==0x1)_0x18da0f=!![];switch(_0x25d478[_0x0047('0xcc')]){case'0':_0x23920f[_0x0047('0x1a1')]+=0x1;_0xce8017[_0x0047('0x70')]=0x0;_0xce8017[_0x0047('0x71')]=_0x0047('0x1a2');_0xce8017[_0x0047('0x129')]+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;ami[_0x0047('0x41')]('custom:agentnosuchnumber',ut[_0x0047('0x120')](_0x507f64,_0x0047('0x1a3')));_0x43817e=_0x23920f[_0x0047('0x19a')];_0x47d996=_0x23920f[_0x0047('0xdc')];hopperUtils[_0x0047('0xcf')](_0xce8017)[_0x0047('0x9f')](loggerCatch(_0x0047('0x127')));if(_0xae9f56[_0x0047('0x191')](0x0,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017[_0x0047('0x129')]>=_0x23920f[_0x0047('0x1a4')]){_0xae9f56['createStateFinal'](_0xce8017,_0x3b51f9,_0x4d95ac,'reason\x200\x20no\x20such\x20number....');}else{_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1a5'));}}break;case'3':_0x23920f['outboundNoAnswerCallsDay']+=0x1;_0xce8017[_0x0047('0x70')]=0x3;_0xce8017[_0x0047('0x71')]='NoAnswer';_0xce8017[_0x0047('0x192')]+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;var _0xcea262=ut[_0x0047('0x1a6')](_0x507f64,_0x23920f);ami[_0x0047('0x41')](_0x0047('0x1a7'),_0xcea262);_0x43817e=_0x23920f[_0x0047('0x1a8')];_0x47d996=_0x23920f[_0x0047('0xdc')];hopperUtils['createHistory'](_0xce8017)[_0x0047('0x9f')](loggerCatch(_0x0047('0x1a9')));if(_0xae9f56[_0x0047('0x191')](0x3,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017[_0x0047('0x192')]>=_0x23920f[_0x0047('0x193')]){_0xae9f56[_0x0047('0x12e')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1aa'));}else{_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x23920f['outboundBusyCallsDay']+=0x1;_0xce8017['state']=0x5;_0xce8017['statedesc']=_0x0047('0x1ab');_0xce8017[_0x0047('0x128')]+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;ami[_0x0047('0x41')](_0x0047('0x1ac'),ut[_0x0047('0x120')](_0x507f64,_0x0047('0x1ad')));_0x43817e=_0x23920f[_0x0047('0x195')];_0x47d996=_0x23920f[_0x0047('0xdc')];hopperUtils[_0x0047('0xcf')](_0xce8017)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xae9f56[_0x0047('0x191')](0x5,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017[_0x0047('0x128')]>=_0x23920f['dialBusyMaxRetry']){_0xae9f56[_0x0047('0x12e')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1ae'));}else{_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1ae'));}}break;case'8':_0x23920f[_0x0047('0x1af')]+=0x1;_0xce8017['state']=0x8;_0xce8017[_0x0047('0x71')]=_0x0047('0x1b0');_0xce8017[_0x0047('0x198')]+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;_0x43817e=_0x23920f[_0x0047('0x1b1')];_0x47d996=_0x23920f['callAdditionalPhoneAfterMin'];ami[_0x0047('0x41')]('custom:agentcongestion',ut[_0x0047('0x120')](_0x507f64,'congestion'));hopperUtils[_0x0047('0xcf')](_0xce8017)['catch'](loggerCatch(_0x0047('0x1b2')));if(_0xae9f56[_0x0047('0x191')](0x8,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017[_0x0047('0x198')]>=_0x23920f[_0x0047('0x197')]){_0xae9f56[_0x0047('0x12e')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1b3'));}else{_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,'reason\x208\x20congestion');}}break;case'11':_0x23920f['outboundAbandonedCallsDay']+=0x1;_0xce8017[_0x0047('0x70')]=0xb;_0xce8017['statedesc']=_0x0047('0xef');_0xce8017[_0x0047('0xf1')]+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;_0x43817e=_0x23920f[_0x0047('0x19c')];_0x47d996=_0x23920f[_0x0047('0xdc')];hopperUtils['createHistory'](_0xce8017)['catch'](loggerCatch(_0x0047('0xf7')));if(_0xae9f56[_0x0047('0x191')](0xb,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017['countabandonedretry']>=_0x23920f['dialAbandonedMaxRetry']){_0xae9f56['createStateFinal'](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1b4'));}else{_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,'reason\x2011\x20abandoned');}}break;case'20':_0x23920f[_0x0047('0x1b5')]+=0x1;_0xce8017[_0x0047('0x70')]=0x14;_0xce8017['statedesc']=_0x0047('0x1b6');_0xce8017['countagentrejectretry']+=0x1;_0xce8017[_0x0047('0xf2')]+=0x1;_0x43817e=_0x23920f['dialAgentRejectRetryFrequency'];_0x47d996=_0x23920f['callAdditionalPhoneAfterMin'];ami[_0x0047('0x41')](_0x0047('0x1b7'),ut[_0x0047('0x120')](_0x507f64,_0x0047('0x1b8')));hopperUtils['createHistory'](_0xce8017)[_0x0047('0x9f')](loggerCatch(_0x0047('0x1b9')));if(_0xae9f56[_0x0047('0x191')](0x14,_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017['countagentrejectretry']>=_0x23920f['dialAgentRejectMaxRetry']){_0xae9f56['createStateFinal'](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1ba'));}else{_0xae9f56['stateGlobal'](_0xce8017,_0x3b51f9,_0x4d95ac,_0x0047('0x1ba'));}}break;default:_0x23920f[_0x0047('0x1bb')]+=0x1;_0xce8017[_0x0047('0x70')]=0xc;_0xce8017[_0x0047('0x71')]=_0x25d478[_0x0047('0xcc')];_0x43817e=_0x23920f['dialAgentRejectRetryFrequency'];_0x47d996=_0x23920f[_0x0047('0xdc')];hopperUtils[_0x0047('0xcf')](_0xce8017)[_0x0047('0x9f')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0xae9f56[_0x0047('0x191')](_0x25d478[_0x0047('0xcc')],_0x507f64,_0x23920f)&&!_0x18da0f){if(_0xce8017[_0x0047('0x128')]+_0xce8017[_0x0047('0x198')]+_0xce8017['countnoanswerretry']+_0xce8017[_0x0047('0x129')]+_0xce8017[_0x0047('0xda')]+_0xce8017[_0x0047('0xf1')]+_0xce8017[_0x0047('0x126')]+_0xce8017[_0x0047('0x12a')]>=_0x23920f[_0x0047('0x12b')]){_0xae9f56[_0x0047('0x12c')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x25d478[_0x0047('0xcc')]);}else{_0xae9f56[_0x0047('0x12e')](_0xce8017,_0x3b51f9,_0x4d95ac,_0x25d478[_0x0047('0xcc')]);}}}})[_0x0047('0x9d')](function(){if(_0x18da0f){hopperUtils[_0x0047('0xee')](_0xce8017,_0x43817e,_0x47d996)[_0x0047('0x9d')](function(){return _0x3b51f9(0x1);});}});});};Dialer[_0x0047('0x89')][_0x0047('0x12c')]=function(_0x311f15,_0x12952f,_0x43b43a,_0x2f2f0d){var _0x32c857=new Final(_0x311f15);_0x32c857[_0x0047('0x70')]=0xf;_0x32c857[_0x0047('0x71')]=_0x0047('0x1bc');this[_0x0047('0x12e')](_0x32c857,_0x12952f,_0x43b43a,_0x2f2f0d);};Dialer[_0x0047('0x89')]['createStateFinal']=function(_0x3e97c8,_0x2ff0a5,_0x54c5aa,_0x1dcc7e){hopperUtils['moveContactManagedDialer'](_0x3e97c8)['then'](function(){return _0x2ff0a5(msgResponse(_0x0047('0x1a0'),_0x0047('0x115'),_0x1dcc7e));})[_0x0047('0x9f')](function(){return _0x54c5aa(msgResponse(_0x0047('0x1bd'),_0x0047('0x92'),_0x0047('0x1be')));});};Dialer[_0x0047('0x89')][_0x0047('0xa')]=function(_0x33e0ad){var _0x4194f9=_0x33e0ad['dialPredictiveOptimizationPercentage']/0x64;var _0x591ccb=_0x33e0ad['outboundDropCallsDayTimeout']/(_0x33e0ad[_0x0047('0xd5')]+_0x33e0ad[_0x0047('0xcb')]);var _0x21daf1=Math['round'](_0x33e0ad[_0x0047('0x1bf')]*(_0x33e0ad['predictiveIntervalMaxThreshold']/0x64));var _0x43b9e5=Math[_0x0047('0x1c0')](_0x33e0ad[_0x0047('0x1bf')]*(_0x33e0ad[_0x0047('0x1c1')]/0x64));var _0x5ed339=_0x33e0ad[_0x0047('0x142')]+_0x33e0ad[_0x0047('0x1c2')];var _0x52d831=Math['floor'](_0x33e0ad['erlangCalls']*_0x33e0ad[_0x0047('0x5e')]*_0x33e0ad[_0x0047('0x1c3')]*_0x33e0ad['predictiveIntervalMultiplicativeFactor']);if(_[_0x0047('0x40')](_0x33e0ad['startProgressive'])){if(!_['isUndefined'](_0x33e0ad[_0x0047('0x28')])){_0x33e0ad[_0x0047('0x28')]=undefined;loggerPredictive[_0x0047('0x64')](_0x0047('0x1c4'),_0x0047('0x1c5'));}if(!_[_0x0047('0x40')](_0x33e0ad[_0x0047('0x61')])){loggerPredictive[_0x0047('0x64')](_0x0047('0x1c4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x33e0ad['handlePredictive']);_0x33e0ad[_0x0047('0x61')]=undefined;}_0x33e0ad[_0x0047('0x29')]=moment()[_0x0047('0x7d')](_0x0047('0xc9'));loggerPredictive[_0x0047('0x47')](_0x33e0ad[_0x0047('0x45')],_0x0047('0x1c6'),_0x33e0ad[_0x0047('0x29')]);this[_0x0047('0xb5')](_0x33e0ad,0x1);}else if(ifInterval(_0x33e0ad[_0x0047('0x1c7')],_0x33e0ad['startProgressive'])){this[_0x0047('0xb5')](_0x33e0ad,0x1);loggerPredictiveCalls[_0x0047('0x47')](_0x0047('0x1c8'),_0x33e0ad[_0x0047('0x29')],_0x33e0ad[_0x0047('0x45')]);_0x33e0ad[_0x0047('0x58')]=0x0;_0x33e0ad[_0x0047('0xd6')]=0x0;}else if(_0x4194f9<_0x591ccb&&_0x33e0ad[_0x0047('0x1c9')]===_0x0047('0x1ca')){clearPredictiveAttributes(_0x33e0ad);loggerPredictive[_0x0047('0x47')](_0x0047('0x1cb'),'Dropped\x20calls\x20day',_0x591ccb,_0x0047('0x29'),_0x33e0ad[_0x0047('0x45')]);}else if(_0x52d831<_0x33e0ad[_0x0047('0xd6')]&&_0x33e0ad['dialPredictiveOptimization']===_0x0047('0x1ca')){clearPredictiveAttributes(_0x33e0ad);loggerPredictive['info'](_0x0047('0x1cc'),_0x0047('0x1cd'),_0x52d831,_0x0047('0x1ce'),_0x33e0ad[_0x0047('0xd6')],'startProgressive',_0x33e0ad[_0x0047('0x45')]);}else if(!ifInterval(_0x33e0ad[_0x0047('0x1c7')],_0x33e0ad[_0x0047('0x29')])&&_[_0x0047('0x40')](_0x33e0ad['startPredictive'])&&!_['isUndefined'](_0x33e0ad[_0x0047('0x29')])){_0x33e0ad[_0x0047('0x28')]=moment()[_0x0047('0x7d')](_0x0047('0xc9'));loggerPredictive[_0x0047('0x47')](_0x33e0ad[_0x0047('0x45')],_0x0047('0x1cf'),_0x33e0ad[_0x0047('0x28')]);hopperUtils[_0x0047('0x1d0')](_0x33e0ad['dialPredictiveInterval'])['then'](this[_0x0047('0x1d1')](_0x33e0ad))[_0x0047('0x9d')](mergeDataErlangB(_0x33e0ad))[_0x0047('0x9d')](this['startMethodPredictive'](_0x33e0ad))[_0x0047('0x9f')](loggerCatchPredictive(_0x0047('0x1d2'),_0x33e0ad));}else if(!ifInterval(_0x33e0ad[_0x0047('0x1c7')],_0x33e0ad[_0x0047('0x28')])){_0x33e0ad[_0x0047('0xd6')]=0x0;_0x33e0ad[_0x0047('0x28')]=moment()[_0x0047('0x7d')](_0x0047('0xc9'));loggerPredictive['info'](_0x33e0ad[_0x0047('0x45')],_0x0047('0x1d3'),_0x33e0ad[_0x0047('0x28')]);clearInterval(_0x33e0ad[_0x0047('0x61')]);_0x33e0ad['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x33e0ad[_0x0047('0x1c7')])[_0x0047('0x9d')](this['getDataPredictive'](_0x33e0ad))['then'](mergeDataErlangB(_0x33e0ad))['then'](this[_0x0047('0x1d4')](_0x33e0ad))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x33e0ad));}else if(_0x33e0ad['predictiveIntervalAvailable']&&_0x5ed339<_0x33e0ad[_0x0047('0x1bf')]-_0x43b9e5){clearPredictiveAttributes(_0x33e0ad);loggerPredictive[_0x0047('0x47')](_0x33e0ad[_0x0047('0x45')],_0x0047('0x1d5'),_0x5ed339,_0x0047('0x1d6'),_0x33e0ad[_0x0047('0x1bf')],'-',_0x43b9e5,'=',_0x33e0ad[_0x0047('0x1bf')]-_0x43b9e5,')');}else if(_0x33e0ad[_0x0047('0x1bf')]&&_0x5ed339>_0x33e0ad['predictiveIntervalAvailable']+_0x21daf1){clearPredictiveAttributes(_0x33e0ad);loggerPredictive['info'](_0x33e0ad['name'],_0x0047('0x1d5'),_0x5ed339,_0x0047('0x1d7'),_0x33e0ad[_0x0047('0x1bf')],'+',_0x21daf1,'=',_0x33e0ad[_0x0047('0x1bf')]+_0x21daf1,')');}};Dialer[_0x0047('0x89')][_0x0047('0x1d1')]=function(_0x57849d){var _0x1ea447=this;return function(_0x3b0578){return new Promise(function(_0x3c1fcf,_0x4f2540){_[_0x0047('0x101')](_0x57849d,_0x3b0578[0x0]);if(checkGetDataPredictive(_0x3b0578[0x0])){var _0x4eb2eb=_0x57849d['predictiveIntervalAvailable']=_0x57849d[_0x0047('0x1c2')]+_0x57849d['available'];var _0x284025=_0x57849d['dialPredictiveInterval']*0x3c;var _0x19e44d=_0x3b0578[0x0][_0x0047('0x51')]+_0x3b0578[0x0][_0x0047('0x4f')];var _0x16246a=(_0x3b0578[0x0][_0x0047('0x4a')]+_0x3b0578[0x0][_0x0047('0x4c')]+_0x3b0578[0x0][_0x0047('0x4d')])/_0x3b0578[0x0]['predictiveIntervalTotalCalls'];_0x57849d['predictiveIntervalHitRate']=_0x16246a>0x0?_0x16246a:0x1;switch(_0x57849d[_0x0047('0x1c9')]){case _0x0047('0x1ca'):var _0x13e40f=_0x57849d[_0x0047('0x1d8')]/0x64;return _0x1ea447[_0x0047('0x1d9')](_0x4eb2eb,_0x284025,_0x19e44d,_0x16246a,_0x13e40f)[_0x0047('0x9d')](function(_0x3a4046){return _0x3c1fcf(_0x3a4046);});case _0x0047('0x1da'):var _0x194005=_0x57849d[_0x0047('0x1d8')]/0x64;return _0x1ea447[_0x0047('0x1db')](_0x4eb2eb,_0x284025,_0x19e44d,_0x16246a,_0x194005)[_0x0047('0x9d')](function(_0x4ba8f0){return _0x3c1fcf(_0x4ba8f0);});default:return _0x4f2540(msgResponse(_0x0047('0x1dc'),'Failure','Unknown\x20Predictive'));}}else{return _0x4f2540(msgResponse(_0x0047('0x1dc'),_0x0047('0x92'),_0x0047('0x1dd')));}});};};Dialer[_0x0047('0x89')][_0x0047('0x1de')]=function(_0x15672b){var _0x4cb688=this;return function(_0x109993){return new Promise(function(_0x59dff5,_0x112069){_[_0x0047('0x101')](_0x15672b,_0x109993[0x0]);if(checkGetDataPredictive(_0x109993[0x0])){loggerPredictive[_0x0047('0x47')](JSON[_0x0047('0x75')](_0x109993[0x0]));if(_0x15672b['dialPredictiveOptimization']===_0x0047('0x1ca')){return _0x4cb688['getVoiceQueueRtPauses'](_0x15672b['id'])[_0x0047('0x9d')](function(_0x56a30a){var _0x30ae5f=_0x15672b[_0x0047('0x1df')]-_0x56a30a[0x0][_0x0047('0x1e0')];var _0x1da80f=_0x15672b[_0x0047('0x1c7')]*0x3c;var _0x504643=_0x109993[0x0][_0x0047('0x51')]+_0x109993[0x0][_0x0047('0x4f')];var _0xf12b63=(_0x109993[0x0][_0x0047('0x4a')]+_0x109993[0x0][_0x0047('0x4c')]+_0x109993[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x109993[0x0][_0x0047('0x53')];var _0x586364=_0x15672b[_0x0047('0x1d8')]/0x64;_0x15672b[_0x0047('0x1e1')]=_0x56a30a[0x0][_0x0047('0x1e0')]||0x0;_0x15672b[_0x0047('0x1c3')]=_0xf12b63>0x0?_0xf12b63:0x1;return _0x4cb688[_0x0047('0x1d9')](_0x30ae5f,_0x1da80f,_0x504643,_0xf12b63,_0x586364);})[_0x0047('0x9d')](function(_0x2f76e9){return _0x59dff5(_0x2f76e9);})[_0x0047('0x9f')](function(_0x45326f){return _0x112069(msgResponse(_0x0047('0x1e2'),_0x0047('0x92'),JSON['stringify'](_0x45326f)));});}if(_0x15672b['dialPredictiveOptimization']==='agentBusyFactor'){return _0x4cb688[_0x0047('0x158')](_0x15672b['id'])['then'](function(_0x56856f){var _0x330fb0=_0x15672b[_0x0047('0x1df')]-_0x56856f[0x0]['outboundQueuePauses'];var _0x483bf1=_0x15672b[_0x0047('0x1c7')]*0x3c;var _0x2091da=_0x109993[0x0]['predictiveIntervalAvgTalktime']+_0x109993[0x0][_0x0047('0x4f')];var _0x4bc204=(_0x109993[0x0][_0x0047('0x4a')]+_0x109993[0x0][_0x0047('0x4c')]+_0x109993[0x0][_0x0047('0x4d')])/_0x109993[0x0][_0x0047('0x53')];var _0x4516c6=_0x15672b[_0x0047('0x1d8')]/0x64;_0x15672b['predictiveIntervalPauses']=_0x56856f[0x0][_0x0047('0x1e0')]||0x0;_0x15672b[_0x0047('0x1c3')]=_0x4bc204>0x0?_0x4bc204:0x1;return _0x4cb688[_0x0047('0x1db')](_0x330fb0,_0x483bf1,_0x2091da,_0x4bc204,_0x4516c6);})[_0x0047('0x9d')](function(_0x154fe7){return _0x59dff5(_0x154fe7);})[_0x0047('0x9f')](function(_0x55ee1f){return _0x112069(msgResponse('[CatchErlangB]',_0x0047('0x92'),JSON[_0x0047('0x75')](_0x55ee1f)));});}}else{return _0x112069(msgResponse('[getDataPredictive]','Failure',_0x0047('0x1dd')));}});};};Dialer['prototype'][_0x0047('0x1d4')]=function(_0x51d817){var _0x453e34=this;return function(){var _0x381201=0x0;var _0x13e04b=Math[_0x0047('0x1e3')](_0x51d817[_0x0047('0x5a')]*0x3e8);if(_0x13e04b>0x0){_0x13e04b=_0x13e04b<0x64?0x64:_0x13e04b;loggerPredictive[_0x0047('0x47')](_0x51d817[_0x0047('0x45')],'one\x20call\x20every:',_0x13e04b,_0x0047('0x1e4'));_0x51d817[_0x0047('0x61')]=setInterval(function(){_0x453e34['handlePredictive'](_0x51d817);loggerPredictiveCalls[_0x0047('0x47')](_0x0047('0x1e5'),_0x381201+=0x1);},_0x13e04b);}else{loggerPredictive[_0x0047('0x47')](_0x51d817[_0x0047('0x45')],_0x0047('0x1e6'));}};};Dialer[_0x0047('0x89')]['checkContactBlack']=function(_0x3c1fae,_0x5f451c){var _0xdc6b53=this;return function(_0x1c2d66){if(_[_0x0047('0x7a')](_0x1c2d66)){if(_[_0x0047('0xfc')](_0x5f451c[_0x0047('0x15d')])||!_0x5f451c[_0x0047('0x1e7')]){if(_0x3c1fae[_0x0047('0xb1')]===_0x0047('0xb4')){_0x3c1fae[_0x0047('0x72')]=_[_0x0047('0x40')](_0x3c1fae[_0x0047('0x72')])?!![]:_0x3c1fae[_0x0047('0x72')];var _0xc09003=uuid['v4']();_0xdc6b53['actions'][_0xc09003]=new Action(_0x3c1fae,_0x5f451c,_0xc09003);loggerBooked[_0x0047('0x47')](_0x0047('0x1e8'),_0xc09003,_0x0047('0x1e9'),JSON['stringify'](_0x3c1fae['queueStatusComplete']),'Queue:\x20',_0x3c1fae[_0x0047('0x45')]);if(_0x3c1fae['queueStatusComplete']){_0x3c1fae['queueStatusComplete']=![];_0xdc6b53[_0x0047('0x100')][_0xdc6b53['actions'][_0xc09003][_0x0047('0xca')]]=[];ami[_0x0047('0x9b')]({'actionid':_0xc09003,'action':_0x0047('0x1ea'),'queue':_0x3c1fae[_0x0047('0x45')]})[_0x0047('0x9f')](function(){_0xdc6b53['updateOriginated'](_0x3c1fae);hopperUtils[_0x0047('0xe2')]({'active':![],'ContactId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe4')],'ListId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe5')],'VoiceQueueId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe6')]||undefined,'CampaignId':_0xdc6b53[_0x0047('0x25')][_0xc09003]['CampaignId']||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x1eb')));delete _0xdc6b53[_0x0047('0x25')][_0xc09003];});}else{loggerBooked[_0x0047('0x47')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x3c1fae[_0x0047('0x72')]),_0x0047('0x1ec'),_0x3c1fae[_0x0047('0x45')]);_0xdc6b53[_0x0047('0xc7')](_0x3c1fae);hopperUtils[_0x0047('0xe2')]({'active':![],'ContactId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe4')],'ListId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe5')],'VoiceQueueId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe6')]||undefined,'CampaignId':_0xdc6b53[_0x0047('0x25')][_0xc09003][_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch(_0x0047('0x1eb')));delete _0xdc6b53[_0x0047('0x25')][_0xc09003];}}else{return _0xdc6b53[_0x0047('0x161')](_0x3c1fae,_0x5f451c);}}else{if(utils[_0x0047('0xd2')](undefined,_0x5f451c[_0x0047('0x1ed')])<_0x3c1fae[_0x0047('0x1ee')]*0x3c){if(_0x5f451c[_0x0047('0x14f')]&&!_0x5f451c[_0x0047('0x14f')][_0x0047('0x1ef')]){_0xdc6b53[_0x0047('0x1f')][_0x0047('0x105')](_0x5f451c['id'])['finally'](function(){_0xdc6b53['updateOriginated'](_0x3c1fae);});}else{hopperUtils[_0x0047('0x1f0')]({'active':![]},_0x5f451c['id'],0x1)['finally'](function(){_0xdc6b53['updateOriginated'](_0x3c1fae);});}}else{_0x3c1fae[_0x0047('0x1f1')]+=0x1;_0xdc6b53['updateOriginated'](_0x3c1fae);if(_0x3c1fae['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5f451c['ContactId'],'ListId':_0x5f451c['ListId'],'VoiceQueueId':_0x5f451c[_0x0047('0xe6')]||undefined,'CampaignId':_0x5f451c[_0x0047('0xe7')]||undefined})[_0x0047('0x9f')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x0047('0xcf')](createObjHistory(_0x3c1fae,_0x5f451c,utils[_0x0047('0x6a')][_0x0047('0x1f2')],0x17,_0x0047('0x1f3')))[_0x0047('0x9f')](loggerCatch(_0x0047('0x1f4')));}else{_0xdc6b53[_0x0047('0x122')](createObjHistory(_0x3c1fae,_0x5f451c,utils[_0x0047('0x6a')]['RECALL_TIMEOUT'],0x16,_0x0047('0x1f5')),'[Originate][HistoryRecallClose][historyCatch]',_0x0047('0x1f6'));}}}}else{_0x3c1fae['outboundBlacklistCallsDay']+=0x1;_0xdc6b53['saveInDb'](createObjHistory(_0x3c1fae,_0x5f451c,utils['CAMPAIGN_STATUS'][_0x0047('0x1f7')],0xd,_0x0047('0x1f8')),_0x0047('0x1f9'),_0x0047('0x1fa'));throw _0x0047('0x1fb');}};};Dialer[_0x0047('0x89')]['handleIvr']=function(_0x5e7d79){var _0x1511d8=this;var _0x36ab3f=_0x5e7d79[_0x0047('0x1fc')]-_0x5e7d79[_0x0047('0x80')];emitCampaignSummary(_0x5e7d79);if(_0x36ab3f>0x0&&_0x5e7d79[_0x0047('0x66')]==0x0){if(_0x36ab3f>this[_0x0047('0x24')]){_0x36ab3f=this[_0x0047('0x24')];}_0x5e7d79[_0x0047('0x66')]=0x1;hopperUtils[_0x0047('0x1fd')](_0x5e7d79,_0x36ab3f)[_0x0047('0x9d')](function(_0x45c9b9){_0x5e7d79[_0x0047('0x66')]=0x0;if(_0x45c9b9){if(!utils[_0x0047('0x1fe')](_0x45c9b9)){_0x5e7d79[_0x0047('0x69')]=utils[_0x0047('0x6a')]['NO_AVAILABLE_CONTACTS'];logger[_0x0047('0x47')]('[getContactCampaign2][Empty]'+_0x5e7d79[_0x0047('0x45')]);}else{_0x5e7d79[_0x0047('0x80')]+=_0x45c9b9[_0x0047('0x99')];_0x5e7d79[_0x0047('0x69')]=utils[_0x0047('0x6a')][_0x0047('0x1ff')];for(var _0x508abb=0x0;_0x508abb<_0x45c9b9[_0x0047('0x99')];_0x508abb+=0x1){_0x5e7d79[_0x0047('0x200')]+=0x1;if(_[_0x0047('0xfc')](_0x45c9b9[_0x508abb])||_[_0x0047('0xfc')](_0x45c9b9[_0x508abb][_0x0047('0x201')])||_['isNil'](_0x45c9b9[_0x508abb][_0x0047('0x165')])){_0x1511d8[_0x0047('0x15c')](_0x0047('0x202'),_0x5e7d79,_0x45c9b9[_0x508abb]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x45c9b9[_0x508abb],['CampaignId',_0x0047('0x165')]))[_0x0047('0x9d')](_0x1511d8[_0x0047('0x203')](_0x5e7d79,_0x45c9b9[_0x508abb]))[_0x0047('0x9f')](_0x1511d8['loggerHandler'](_0x0047('0x204'),_0x5e7d79));}}}}})[_0x0047('0x9f')](loggerGetContactDialer(_0x0047('0x205'),_0x5e7d79,_0x36ab3f));}};Dialer[_0x0047('0x89')][_0x0047('0xb5')]=function(_0x21612e,_0x40448f){var _0x3ceadb=this;var _0x2221ba=[];if(_0x40448f<0x1||_0x21612e[_0x0047('0xb1')]==='booked'){_0x40448f=0x1;}var _0x9d6f5e=Math['floor'](_0x21612e[_0x0047('0x142')]*_0x40448f)-_0x21612e[_0x0047('0x80')];if(_0x21612e['dialLimitQueue']>0x0){var _0x1aab98=_0x21612e['dialLimitQueue']-_0x21612e[_0x0047('0x80')]-_0x21612e['talking']-_0x21612e[_0x0047('0x144')];if(_0x9d6f5e>_0x1aab98){_0x9d6f5e=_0x1aab98;}}if(_0x9d6f5e>0x0&&_0x21612e[_0x0047('0x66')]==0x0){if(_0x21612e['dialMethod']===_0x0047('0xb4')){_0x9d6f5e=0x1;}if(_0x9d6f5e>this[_0x0047('0x24')]){_0x9d6f5e=this['maxNumberOriginate'];}for(var _0x26e7fd in this['agents']){if(typeof this['agents'][_0x26e7fd]!=='undefined'){if(this[_0x0047('0x22')][_0x26e7fd][_0x0047('0x70')]==='not_inuse'&&this[_0x0047('0x22')][_0x26e7fd][_0x0047('0x87')]===_0x0047('0x14c')){_0x2221ba['push'](this[_0x0047('0x22')][_0x26e7fd]['id']);}}}_0x21612e[_0x0047('0x66')]=0x1;hopperUtils[_0x0047('0x206')](_0x21612e,_0x2221ba,_0x9d6f5e)[_0x0047('0x9d')](function(_0x12d574){_0x21612e['temp']=0x0;if(_0x12d574){if(!utils[_0x0047('0x1fe')](_0x12d574)){hopperUtils['countReScheduled'](_0x21612e)[_0x0047('0x9d')](sendMessageReschedule(_0x21612e))['catch'](loggerCatch(_0x0047('0x207')));}else{_0x21612e[_0x0047('0x80')]+=_0x12d574['length'];_0x21612e[_0x0047('0x69')]=_0x21612e['dialMethod']===_0x0047('0xb4')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x0047('0x6a')][_0x0047('0x1ff')];for(var _0x2906e3=0x0;_0x2906e3<_0x12d574[_0x0047('0x99')];_0x2906e3+=0x1){if(_[_0x0047('0xfc')](_0x12d574[_0x2906e3])||_[_0x0047('0xfc')](_0x12d574[_0x2906e3][_0x0047('0x201')])||_[_0x0047('0xfc')](_0x12d574[_0x2906e3][_0x0047('0x165')])){_0x3ceadb[_0x0047('0x15c')](_0x0047('0x202'),_0x21612e,_0x12d574[_0x2906e3]);}else{hopperUtils[_0x0047('0x208')](_[_0x0047('0x102')](_0x12d574[_0x2906e3],['VoiceQueueId','phone']))[_0x0047('0x9d')](_0x3ceadb[_0x0047('0x203')](_0x21612e,_0x12d574[_0x2906e3]))[_0x0047('0x9f')](_0x3ceadb[_0x0047('0x209')](_0x0047('0x202'),_0x21612e));}}}}})[_0x0047('0x9f')](loggerGetContactDialer(_0x0047('0x20a'),_0x21612e,_0x9d6f5e));}};Dialer[_0x0047('0x89')]['handlePredictive']=function(_0x450a68){if(_0x450a68[_0x0047('0x20b')]>0x0){var _0x1faa06=_0x450a68[_0x0047('0x20b')]-_0x450a68[_0x0047('0x80')]-_0x450a68[_0x0047('0x1c2')];if(_0x1faa06>0x0&&_0x450a68[_0x0047('0x66')]==0x0){this[_0x0047('0x20c')](_0x450a68);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x0047('0x20c')](_0x450a68);}};Dialer[_0x0047('0x89')]['tryOriginatePredictive']=function(_0x369101){var _0x2a540e=this;var _0x1759f2=[];_0x369101[_0x0047('0x80')]+=0x1;for(var _0x3cb2ff in this['agents']){if(typeof this['agents'][_0x3cb2ff]!==_0x0047('0xaa')){if(this[_0x0047('0x22')][_0x3cb2ff][_0x0047('0x70')]===_0x0047('0x20d')&&this[_0x0047('0x22')][_0x3cb2ff][_0x0047('0x87')]==='reachable'){_0x1759f2[_0x0047('0x9a')](this['agents'][_0x3cb2ff]['id']);}}}_0x369101['temp']=0x1;return this[_0x0047('0x206')](_0x369101['id'],_0x1759f2,0x1,_0x369101[_0x0047('0x20e')],_0x369101)[_0x0047('0x9d')](function(_0x2390eb){_0x369101[_0x0047('0x66')]=0x1;if(_0x2390eb){if(!utils[_0x0047('0x1fe')](_0x2390eb)){utils['checkContactLowerLimitOriginate'](_0x369101,0x1,0x0);return hopperUtils['countReScheduled'](_0x369101)[_0x0047('0x9d')](sendMessageReschedule(_0x369101))[_0x0047('0x9f')](loggerCatch(_0x0047('0x207')));}else{_0x369101['message']=utils[_0x0047('0x6a')][_0x0047('0x1ff')];if(_[_0x0047('0xfc')](_0x2390eb[0x0])||_[_0x0047('0xfc')](_0x2390eb[0x0][_0x0047('0x201')])||_[_0x0047('0xfc')](_0x2390eb[0x0][_0x0047('0x165')])){_0x2a540e[_0x0047('0x15c')]('[actionOriginate]\x20',_0x369101,_0x2390eb[0x0]);}else{return hopperUtils[_0x0047('0x208')](_[_0x0047('0x102')](_0x2390eb[0x0],[_0x0047('0xe6'),_0x0047('0x165')]))[_0x0047('0x9d')](_0x2a540e[_0x0047('0x203')](_0x369101,_0x2390eb[0x0]))['catch'](_0x2a540e['loggerHandler'](_0x0047('0x20f'),_0x369101));}}}})['catch'](loggerGetContactDialer(_0x0047('0x210'),_0x369101,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x40b42d,_0x54403a,_0x7ce9d7,_0x65ccf8,_0xe2915f,_0x488e84){loggerPredictive[_0x0047('0x47')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0047('0x47')](_0x0047('0x211'),_0x40b42d);loggerPredictive[_0x0047('0x47')](_0x0047('0x212'),_0x54403a);loggerPredictive['info'](_0x0047('0x213'),_0x7ce9d7);loggerPredictive['info'](_0x0047('0x214'),_0x65ccf8);loggerPredictive[_0x0047('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe2915f);loggerPredictive[_0x0047('0x47')]('---------------------------');return new Promise(function(_0x1611ec,_0x5ed2c0){if(_0x40b42d<=0x0||isNaN(_0x40b42d)){return _0x5ed2c0(msgResponse(_0x0047('0x215'),_0x0047('0xc1'),_0x0047('0x216')+_0x40b42d));}if(_0x7ce9d7<=0x0||isNaN(_0x7ce9d7)){return _0x5ed2c0(msgResponse(_0x0047('0x215'),_0x0047('0xc1'),_0x0047('0x217')+_0x7ce9d7));}if(_0x65ccf8<=0x0||isNaN(_0x65ccf8)){return _0x5ed2c0(msgResponse('[abandonmentRate]',_0x0047('0xc1'),'p\x20=\x20'+_0x65ccf8));}if(_0x54403a<=0x0||isNaN(_0x54403a)){return _0x5ed2c0(msgResponse(_0x0047('0x215'),_0x0047('0xc1'),'interval\x20=\x20'+_0x54403a));}if(_0xe2915f<=0x0||isNaN(_0xe2915f)){return _0x5ed2c0(msgResponse(_0x0047('0x215'),_0x0047('0xc1'),'Amax\x20=\x20'+_0xe2915f));}_0x488e84=_0x488e84||0x0;var _0x42f577=0x1/_0x7ce9d7;var _0x455df8=0x0;var _0x41fd98=0x0;var _0x4755ab=0x0;var _0x52104d=0x0;for(var _0xdea594=0x0;_0x4755ab<_0xe2915f;_0xdea594+=0x1){_0x41fd98=_0xdea594/_0x54403a;_0x455df8=(_0x65ccf8*_0x41fd98+_0x488e84)/_0x42f577;_0x4755ab=utils[_0x0047('0x218')](_0x455df8,_0x40b42d);_0x52104d=_0x455df8/_0x40b42d*(0x1-utils['erlangb'](_0x455df8,_0x40b42d));}return _0x1611ec({'erlangCalls':_0xdea594,'erlangCallToSecond':_0x54403a/_0xdea594,'erlangAbandonmentRate':_0x4755ab,'erlangBusyFactor':_0x52104d});});};Dialer[_0x0047('0x89')][_0x0047('0x1db')]=function(_0x313b79,_0x51ac00,_0x14fb15,_0x30365e,_0x3392bf,_0x5b055f){loggerPredictive[_0x0047('0x47')](_0x0047('0x219'));loggerPredictive['info'](_0x0047('0x211'),_0x313b79);loggerPredictive[_0x0047('0x47')](_0x0047('0x212'),_0x51ac00);loggerPredictive[_0x0047('0x47')]('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',_0x14fb15);loggerPredictive[_0x0047('0x47')](_0x0047('0x214'),_0x30365e);loggerPredictive[_0x0047('0x47')](_0x0047('0x21a'),_0x3392bf);loggerPredictive[_0x0047('0x47')](_0x0047('0x52'));return new Promise(function(_0xecbb1,_0x526b08){if(_0x313b79<=0x0||isNaN(_0x313b79)){return _0x526b08(msgResponse('[busyFactor]','Error',_0x0047('0x216')+_0x313b79));}if(_0x14fb15<=0x0||isNaN(_0x14fb15)){return _0x526b08(msgResponse(_0x0047('0x21b'),'Error','Ts\x20=\x20'+_0x14fb15));}if(_0x30365e<=0x0||isNaN(_0x30365e)){return _0x526b08(msgResponse(_0x0047('0x21b'),_0x0047('0xc1'),_0x0047('0x21c')+_0x30365e));}if(_0x51ac00<=0x0||isNaN(_0x51ac00)){return _0x526b08(msgResponse(_0x0047('0x21b'),'Error',_0x0047('0x21d')+_0x51ac00));}if(_0x3392bf<=0x0||isNaN(_0x3392bf)){return _0x526b08(msgResponse(_0x0047('0x21b'),_0x0047('0xc1'),_0x0047('0x21e')+_0x3392bf));}_0x5b055f=_0x5b055f||0x0;var _0xe3f852=0x1/_0x14fb15;var _0xa2d208=0x0;var _0x1e4eac=0x0;var _0x17194a=0x0;var _0x38f136=0x0;for(var _0x3bba70=0x0;_0x38f136<_0x3392bf;_0x3bba70+=0x1){_0x1e4eac=_0x3bba70/_0x51ac00;_0xa2d208=(_0x30365e*_0x1e4eac+_0x5b055f)/_0xe3f852;_0x17194a=utils['erlangb'](_0xa2d208,_0x313b79);_0x38f136=_0xa2d208/_0x313b79*(0x1-utils['erlangb'](_0xa2d208,_0x313b79));}return _0xecbb1({'erlangCalls':_0x3bba70,'erlangCallToSecond':_0x51ac00/_0x3bba70,'erlangAbandonmentRate':_0x17194a,'erlangBusyFactor':_0x38f136});});};module[_0x0047('0x21f')]=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 09a93b9..2ee9e50 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 _0xf20f=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','name','voiceQueue','dialCutDigit','getQueue','queue','util','lodash','moment','isNil','string','uniqueid','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x357640,_0x532b5d){var _0x640d79=function(_0xd5a6eb){while(--_0xd5a6eb){_0x357640['push'](_0x357640['shift']());}};_0x640d79(++_0x532b5d);}(_0xf20f,0x14e));var _0xff20=function(_0x195f89,_0x549c51){_0x195f89=_0x195f89-0x0;var _0xacc141=_0xf20f[_0x195f89];return _0xacc141;};'use strict';var util=require(_0xff20('0x0'));var _=require(_0xff20('0x1'));var moment=require(_0xff20('0x2'));function checkNameSurname(_0x402897,_0x1e654e,_0x6c9031){var _0x3c7c5e='';if(!_[_0xff20('0x3')](_0x1e654e)&&_0xff20('0x4')===typeof _0x1e654e){_0x3c7c5e+=_0x1e654e;}if(!_[_0xff20('0x3')](_0x6c9031)&&_0xff20('0x4')===typeof _0x6c9031){_0x3c7c5e+='\x20'+_0x6c9031;}if(_0x3c7c5e!==''){return _0x3c7c5e;}return _0x402897;}function Action(_0x218b0f,_0x37ed24,_0x1c15cd){this['voiceQueue']=_0x218b0f;this[_0xff20('0x5')]=_0x1c15cd||undefined;this['name']=checkNameSurname(_0x37ed24[_0xff20('0x6')]['phone'],_0x37ed24[_0xff20('0x6')][_0xff20('0x7')],_0x37ed24[_0xff20('0x6')][_0xff20('0x8')]);this[_0xff20('0x9')]=_0x37ed24[_0xff20('0xa')];this['queue']=_0x218b0f['name'];this[_0xff20('0xb')]=_0x37ed24['active']||![];this['type']=_0x218b0f[_0xff20('0xc')];this[_0xff20('0xd')]=_0x218b0f[_0xff20('0xd')]||0x3;this[_0xff20('0xe')]=_0x37ed24[_0xff20('0xe')];this['countbusyretry']=_0x37ed24[_0xff20('0xf')];this[_0xff20('0x10')]=_0x37ed24[_0xff20('0x10')];this[_0xff20('0x11')]=_0x37ed24['countnoanswerretry'];this['countnosuchnumberretry']=_0x37ed24[_0xff20('0x12')];this[_0xff20('0x13')]=_0x37ed24[_0xff20('0x13')];this['countabandonedretry']=_0x37ed24[_0xff20('0x14')];this[_0xff20('0x15')]=_0x37ed24[_0xff20('0x15')];this['countagentrejectretry']=_0x37ed24[_0xff20('0x16')];this[_0xff20('0x17')]=_0x37ed24[_0xff20('0x17')];this[_0xff20('0x18')]=_0x37ed24['ListId'];this[_0xff20('0x19')]=_0x37ed24[_0xff20('0x19')];this['VoiceQueueId']=_0x37ed24[_0xff20('0x1a')];this[_0xff20('0x1b')]=_0x37ed24[_0xff20('0x1b')];this[_0xff20('0x1c')]=_0x37ed24['id'];this[_0xff20('0x1d')]=_0x37ed24[_0xff20('0x6')][_0xff20('0x7')]||'';this[_0xff20('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x37ed24[_0xff20('0x1f')];this[_0xff20('0x20')]=_0x37ed24[_0xff20('0x20')];this[_0xff20('0x21')]=_0x37ed24[_0xff20('0x21')];this[_0xff20('0x22')]=_0x37ed24[_0xff20('0x22')];this['originatecalleridnum']='';this[_0xff20('0x23')]='';}Action['prototype'][_0xff20('0x24')]=function(){return util[_0xff20('0x25')](_0xff20('0x26'),this[_0xff20('0x27')],this[_0xff20('0x28')][_0xff20('0x29')]>0x0?this[_0xff20('0x9')]['substring'](this['voiceQueue'][_0xff20('0x29')]):this[_0xff20('0x9')]);};Action['prototype'][_0xff20('0x2a')]=function(){return this[_0xff20('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0xadeb=['idHopper','ContactFirstName','callback','callbackuniqueid','callbackat','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3ab5cb,_0x5b9e3d){var _0x46facb=function(_0x1000fc){while(--_0x1000fc){_0x3ab5cb['push'](_0x3ab5cb['shift']());}};_0x46facb(++_0x5b9e3d);}(_0xadeb,0x13b));var _0xbade=function(_0x2e5add,_0x386877){_0x2e5add=_0x2e5add-0x0;var _0xa95e33=_0xadeb[_0x2e5add];return _0xa95e33;};'use strict';var util=require(_0xbade('0x0'));var _=require(_0xbade('0x1'));var moment=require(_0xbade('0x2'));function checkNameSurname(_0x3f3c99,_0x237c61,_0x5628b5){var _0x2d1417='';if(!_[_0xbade('0x3')](_0x237c61)&&_0xbade('0x4')===typeof _0x237c61){_0x2d1417+=_0x237c61;}if(!_[_0xbade('0x3')](_0x5628b5)&&_0xbade('0x4')===typeof _0x5628b5){_0x2d1417+='\x20'+_0x5628b5;}if(_0x2d1417!==''){return _0x2d1417;}return _0x3f3c99;}function Action(_0x7eea11,_0x2c6fd3,_0x27d4ed){this[_0xbade('0x5')]=_0x7eea11;this[_0xbade('0x6')]=_0x27d4ed||undefined;this[_0xbade('0x7')]=checkNameSurname(_0x2c6fd3[_0xbade('0x8')][_0xbade('0x9')],_0x2c6fd3[_0xbade('0x8')][_0xbade('0xa')],_0x2c6fd3[_0xbade('0x8')][_0xbade('0xb')]);this[_0xbade('0xc')]=_0x2c6fd3[_0xbade('0x9')];this[_0xbade('0xd')]=_0x7eea11[_0xbade('0x7')];this[_0xbade('0xe')]=_0x2c6fd3[_0xbade('0xe')]||![];this[_0xbade('0xf')]=_0x7eea11[_0xbade('0xf')];this['dialQueueTimeout']=_0x7eea11[_0xbade('0x10')]||0x3;this['scheduledat']=_0x2c6fd3['scheduledat'];this[_0xbade('0x11')]=_0x2c6fd3[_0xbade('0x11')];this['countcongestionretry']=_0x2c6fd3[_0xbade('0x12')];this['countnoanswerretry']=_0x2c6fd3[_0xbade('0x13')];this[_0xbade('0x14')]=_0x2c6fd3[_0xbade('0x14')];this[_0xbade('0x15')]=_0x2c6fd3[_0xbade('0x15')];this[_0xbade('0x16')]=_0x2c6fd3[_0xbade('0x16')];this['countmachineretry']=_0x2c6fd3['countmachineretry'];this[_0xbade('0x17')]=_0x2c6fd3[_0xbade('0x17')];this[_0xbade('0x18')]=_0x2c6fd3[_0xbade('0x18')];this['ListId']=_0x2c6fd3[_0xbade('0x19')];this[_0xbade('0x1a')]=_0x2c6fd3[_0xbade('0x1a')];this[_0xbade('0x1b')]=_0x2c6fd3['VoiceQueueId'];this['CampaignId']=_0x2c6fd3[_0xbade('0x1c')];this[_0xbade('0x1d')]=_0x2c6fd3['id'];this[_0xbade('0x1e')]=_0x2c6fd3[_0xbade('0x8')][_0xbade('0xa')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2c6fd3[_0xbade('0x1f')];this[_0xbade('0x20')]=_0x2c6fd3['callbackuniqueid'];this[_0xbade('0x21')]=_0x2c6fd3[_0xbade('0x21')];this['recallme']=_0x2c6fd3['recallme'];this['originatecalleridnum']='';this[_0xbade('0x22')]='';}Action['prototype'][_0xbade('0x23')]=function(){return util[_0xbade('0x24')](_0xbade('0x25'),this[_0xbade('0x7')],this[_0xbade('0x5')]['dialCutDigit']>0x0?this['number'][_0xbade('0x26')](this['voiceQueue'][_0xbade('0x27')]):this[_0xbade('0xc')]);};Action[_0xbade('0x28')][_0xbade('0x29')]=function(){return this['queue'];};module[_0xbade('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 576ecd6..816376e 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 _0xb1eb=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xb1eb,0x12a));var _0xbb1e=function(_0x3ffac4,_0x4b49c6){_0x3ffac4=_0x3ffac4-0x0;var _0x35685a=_0xb1eb[_0x3ffac4];return _0x35685a;};'use strict';var moment=require(_0xbb1e('0x0'));var utils=require('../utils');function AgentComplete(_0xed3513,_0x5e91db){this[_0xbb1e('0x1')]=0x4;this[_0xbb1e('0x2')]=_0xbb1e('0x3');this[_0xbb1e('0x4')]=_0xed3513[_0xbb1e('0x4')];this[_0xbb1e('0x5')]=_0xed3513['type'];this[_0xbb1e('0x6')]=_0xed3513['type']==='outbound'?_0xbb1e('0x7'):_0xed3513['type'];this[_0xbb1e('0x8')]=_0xed3513[_0xbb1e('0x8')];this[_0xbb1e('0x9')]=_0xed3513['countcongestionretry'];this[_0xbb1e('0xa')]=_0xed3513[_0xbb1e('0xa')];this['countglobal']=_0xed3513[_0xbb1e('0x8')]+_0xed3513['countcongestionretry']+_0xed3513[_0xbb1e('0xa')]+_0xed3513[_0xbb1e('0xb')]+_0xed3513['countdropretry']+_0xed3513['countabandonedretry']+_0xed3513[_0xbb1e('0xc')]+_0xed3513[_0xbb1e('0xd')];this['countnosuchnumberretry']=_0xed3513[_0xbb1e('0xb')];this['countdropretry']=_0xed3513['countdropretry'];this[_0xbb1e('0xe')]=_0xed3513[_0xbb1e('0xe')];this[_0xbb1e('0xc')]=_0xed3513['countmachineretry'];this[_0xbb1e('0xd')]=_0xed3513[_0xbb1e('0xd')];this[_0xbb1e('0xf')]=_0x5e91db[_0xbb1e('0xf')];this[_0xbb1e('0x10')]=_0xed3513['name'];this['calleridnum']=_0xed3513[_0xbb1e('0x11')];this[_0xbb1e('0x12')]=_0xed3513['starttime'];this[_0xbb1e('0x13')]=_0xed3513[_0xbb1e('0x13')];this['answertime']=_0xed3513[_0xbb1e('0x14')];this[_0xbb1e('0x15')]=moment()[_0xbb1e('0x16')](_0xbb1e('0x17'));this['ringtime']=utils[_0xbb1e('0x18')](_0xed3513[_0xbb1e('0x13')],_0xed3513['starttime']);this[_0xbb1e('0x19')]=utils['getSeconds'](_0xed3513[_0xbb1e('0x14')],_0xed3513['responsetime']);this[_0xbb1e('0x1a')]=utils[_0xbb1e('0x18')](this['endtime'],_0xed3513[_0xbb1e('0x14')]);this[_0xbb1e('0x7')]=_0x5e91db[_0xbb1e('0x7')];this[_0xbb1e('0x1b')]=_0x5e91db['membername'];this['reason']=_0x5e91db['reason'];this['callback']=_0xed3513[_0xbb1e('0x1c')];this[_0xbb1e('0x1d')]=_0xed3513['callbackuniqueid'];this[_0xbb1e('0x1e')]=_0xed3513[_0xbb1e('0x1e')];this[_0xbb1e('0x1f')]=_0xed3513[_0xbb1e('0x1f')];this['ContactId']=_0xed3513[_0xbb1e('0x20')];this[_0xbb1e('0x21')]=_0xed3513[_0xbb1e('0x21')];this[_0xbb1e('0x22')]=_0xed3513['UserId'];this[_0xbb1e('0x23')]=_0xed3513[_0xbb1e('0x23')];this[_0xbb1e('0x24')]=_0xed3513[_0xbb1e('0x24')];this[_0xbb1e('0x25')]=_0xed3513['originatecalleridnum']||'';this[_0xbb1e('0x26')]=_0xed3513['originatecalleridname']||'';this[_0xbb1e('0x27')]=_0xed3513['agiafterat'];}module[_0xbb1e('0x28')]=AgentComplete; \ No newline at end of file +var _0xc12b=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xc12b,0x128));var _0xbc12=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc12b[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var utils=require(_0xbc12('0x0'));function AgentComplete(_0x4f8c2f,_0x6a822b){this[_0xbc12('0x1')]=0x4;this[_0xbc12('0x2')]='Answer';this[_0xbc12('0x3')]=_0x4f8c2f[_0xbc12('0x3')];this[_0xbc12('0x4')]=_0x4f8c2f[_0xbc12('0x4')];this[_0xbc12('0x5')]=_0x4f8c2f[_0xbc12('0x4')]===_0xbc12('0x6')?_0xbc12('0x7'):_0x4f8c2f[_0xbc12('0x4')];this['countbusyretry']=_0x4f8c2f[_0xbc12('0x8')];this[_0xbc12('0x9')]=_0x4f8c2f['countcongestionretry'];this[_0xbc12('0xa')]=_0x4f8c2f[_0xbc12('0xa')];this[_0xbc12('0xb')]=_0x4f8c2f[_0xbc12('0x8')]+_0x4f8c2f[_0xbc12('0x9')]+_0x4f8c2f[_0xbc12('0xa')]+_0x4f8c2f['countnosuchnumberretry']+_0x4f8c2f[_0xbc12('0xc')]+_0x4f8c2f['countabandonedretry']+_0x4f8c2f[_0xbc12('0xd')]+_0x4f8c2f[_0xbc12('0xe')];this['countnosuchnumberretry']=_0x4f8c2f[_0xbc12('0xf')];this[_0xbc12('0xc')]=_0x4f8c2f[_0xbc12('0xc')];this[_0xbc12('0x10')]=_0x4f8c2f[_0xbc12('0x10')];this[_0xbc12('0xd')]=_0x4f8c2f[_0xbc12('0xd')];this[_0xbc12('0xe')]=_0x4f8c2f[_0xbc12('0xe')];this[_0xbc12('0x11')]=_0x6a822b['uniqueid'];this['calleridname']=_0x4f8c2f[_0xbc12('0x12')];this[_0xbc12('0x13')]=_0x4f8c2f[_0xbc12('0x14')];this[_0xbc12('0x15')]=_0x4f8c2f[_0xbc12('0x15')];this[_0xbc12('0x16')]=_0x4f8c2f['responsetime'];this[_0xbc12('0x17')]=_0x4f8c2f[_0xbc12('0x17')];this['endtime']=moment()[_0xbc12('0x18')](_0xbc12('0x19'));this['ringtime']=utils[_0xbc12('0x1a')](_0x4f8c2f['responsetime'],_0x4f8c2f[_0xbc12('0x15')]);this[_0xbc12('0x1b')]=utils['getSeconds'](_0x4f8c2f[_0xbc12('0x17')],_0x4f8c2f[_0xbc12('0x16')]);this[_0xbc12('0x1c')]=utils[_0xbc12('0x1a')](this['endtime'],_0x4f8c2f[_0xbc12('0x17')]);this[_0xbc12('0x7')]=_0x6a822b['queue'];this['membername']=_0x6a822b[_0xbc12('0x1d')];this[_0xbc12('0x1e')]=_0x6a822b[_0xbc12('0x1e')];this['callback']=_0x4f8c2f[_0xbc12('0x1f')];this[_0xbc12('0x20')]=_0x4f8c2f[_0xbc12('0x20')];this['callbackat']=_0x4f8c2f[_0xbc12('0x21')];this[_0xbc12('0x22')]=_0x4f8c2f['recallme'];this['ContactId']=_0x4f8c2f[_0xbc12('0x23')];this['ListId']=_0x4f8c2f['ListId'];this['UserId']=_0x4f8c2f[_0xbc12('0x24')];this[_0xbc12('0x25')]=_0x4f8c2f[_0xbc12('0x25')];this[_0xbc12('0x26')]=_0x4f8c2f[_0xbc12('0x26')];this[_0xbc12('0x27')]=_0x4f8c2f[_0xbc12('0x27')]||'';this[_0xbc12('0x28')]=_0x4f8c2f['originatecalleridname']||'';this[_0xbc12('0x29')]=_0x4f8c2f['agiafterat'];}module[_0xbc12('0x2a')]=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 35b6fa0..a407129 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 _0x1d52=['originatecalleridname','state','statedesc','exports','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x37cd8c,_0x425de5){var _0x213168=function(_0x4aed59){while(--_0x4aed59){_0x37cd8c['push'](_0x37cd8c['shift']());}};_0x213168(++_0x425de5);}(_0x1d52,0x11c));var _0x21d5=function(_0x41c105,_0x5bb3c4){_0x41c105=_0x41c105-0x0;var _0x16d846=_0x1d52[_0x41c105];return _0x16d846;};'use strict';function Final(_0x379f5f){this[_0x21d5('0x0')]=_0x379f5f[_0x21d5('0x0')];this['scheduledat']=_0x379f5f['scheduledat'];this[_0x21d5('0x1')]=_0x379f5f[_0x21d5('0x1')];this[_0x21d5('0x2')]=_0x379f5f[_0x21d5('0x1')]===_0x21d5('0x3')?'queue':_0x379f5f[_0x21d5('0x1')];this[_0x21d5('0x4')]=_0x379f5f['countbusyretry'];this['countcongestionretry']=_0x379f5f[_0x21d5('0x5')];this['countnoanswerretry']=_0x379f5f[_0x21d5('0x6')];this[_0x21d5('0x7')]=_0x379f5f['countbusyretry']+_0x379f5f['countcongestionretry']+_0x379f5f[_0x21d5('0x6')]+_0x379f5f['countnosuchnumberretry']+_0x379f5f[_0x21d5('0x8')]+_0x379f5f['countabandonedretry']+_0x379f5f['countmachineretry']+_0x379f5f[_0x21d5('0x9')];this[_0x21d5('0xa')]=_0x379f5f[_0x21d5('0xa')];this[_0x21d5('0x8')]=_0x379f5f['countdropretry'];this[_0x21d5('0xb')]=_0x379f5f[_0x21d5('0xb')];this[_0x21d5('0xc')]=_0x379f5f[_0x21d5('0xc')];this[_0x21d5('0x9')]=_0x379f5f[_0x21d5('0x9')];this['queue']=_0x379f5f[_0x21d5('0xd')];this[_0x21d5('0xe')]=_0x379f5f[_0x21d5('0xe')];this[_0x21d5('0xf')]=_0x379f5f[_0x21d5('0xf')];this[_0x21d5('0x10')]=_0x379f5f['starttime'];this['responsetime']=_0x379f5f[_0x21d5('0x11')];this['endtime']=_0x379f5f[_0x21d5('0x11')];this[_0x21d5('0x12')]=_0x379f5f[_0x21d5('0x12')]||0x0;this['holdtime']=_0x379f5f[_0x21d5('0x13')]||0x0;this[_0x21d5('0x14')]=_0x379f5f[_0x21d5('0x14')]||0x0;this[_0x21d5('0x15')]=_0x379f5f[_0x21d5('0x15')];this[_0x21d5('0x16')]=_0x379f5f['callbackuniqueid'];this[_0x21d5('0x17')]=_0x379f5f['callbackat'];this[_0x21d5('0x18')]=_0x379f5f['recallme'];this[_0x21d5('0x19')]=_0x379f5f[_0x21d5('0x19')];this[_0x21d5('0x1a')]=_0x379f5f[_0x21d5('0x1a')];this[_0x21d5('0x1b')]=_0x379f5f[_0x21d5('0x1b')];this[_0x21d5('0x1c')]=_0x379f5f[_0x21d5('0x1c')];this[_0x21d5('0x1d')]=_0x379f5f[_0x21d5('0x1d')];this[_0x21d5('0x1e')]=_0x379f5f['originatecalleridnum']||'';this[_0x21d5('0x1f')]=_0x379f5f[_0x21d5('0x1f')]||'';this[_0x21d5('0x20')]=_0x379f5f[_0x21d5('0x20')];this[_0x21d5('0x21')]=_0x379f5f[_0x21d5('0x21')];}module[_0x21d5('0x22')]=Final; \ No newline at end of file +var _0x3cb6=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x4bf0be,_0x498260){var _0x422324=function(_0x419b93){while(--_0x419b93){_0x4bf0be['push'](_0x4bf0be['shift']());}};_0x422324(++_0x498260);}(_0x3cb6,0x1b5));var _0x63cb=function(_0x15fab7,_0x1eb124){_0x15fab7=_0x15fab7-0x0;var _0x23f693=_0x3cb6[_0x15fab7];return _0x23f693;};'use strict';function Final(_0xff84df){this[_0x63cb('0x0')]=_0xff84df[_0x63cb('0x0')];this[_0x63cb('0x1')]=_0xff84df[_0x63cb('0x1')];this[_0x63cb('0x2')]=_0xff84df[_0x63cb('0x2')];this[_0x63cb('0x3')]=_0xff84df[_0x63cb('0x2')]==='outbound'?_0x63cb('0x4'):_0xff84df[_0x63cb('0x2')];this[_0x63cb('0x5')]=_0xff84df['countbusyretry'];this['countcongestionretry']=_0xff84df[_0x63cb('0x6')];this['countnoanswerretry']=_0xff84df[_0x63cb('0x7')];this[_0x63cb('0x8')]=_0xff84df[_0x63cb('0x5')]+_0xff84df[_0x63cb('0x6')]+_0xff84df[_0x63cb('0x7')]+_0xff84df[_0x63cb('0x9')]+_0xff84df[_0x63cb('0xa')]+_0xff84df['countabandonedretry']+_0xff84df[_0x63cb('0xb')]+_0xff84df[_0x63cb('0xc')];this[_0x63cb('0x9')]=_0xff84df[_0x63cb('0x9')];this['countdropretry']=_0xff84df[_0x63cb('0xa')];this[_0x63cb('0xd')]=_0xff84df['countabandonedretry'];this['countmachineretry']=_0xff84df[_0x63cb('0xb')];this[_0x63cb('0xc')]=_0xff84df[_0x63cb('0xc')];this[_0x63cb('0x4')]=_0xff84df[_0x63cb('0x4')];this[_0x63cb('0xe')]=_0xff84df['calleridname'];this[_0x63cb('0xf')]=_0xff84df['calleridnum'];this['starttime']=_0xff84df[_0x63cb('0x10')];this['responsetime']=_0xff84df[_0x63cb('0x11')];this['endtime']=_0xff84df[_0x63cb('0x11')];this[_0x63cb('0x12')]=_0xff84df[_0x63cb('0x12')]||0x0;this[_0x63cb('0x13')]=_0xff84df[_0x63cb('0x13')]||0x0;this[_0x63cb('0x14')]=_0xff84df[_0x63cb('0x14')]||0x0;this[_0x63cb('0x15')]=_0xff84df[_0x63cb('0x15')];this[_0x63cb('0x16')]=_0xff84df['callbackuniqueid'];this[_0x63cb('0x17')]=_0xff84df[_0x63cb('0x17')];this[_0x63cb('0x18')]=_0xff84df[_0x63cb('0x18')];this[_0x63cb('0x19')]=_0xff84df['ContactId'];this[_0x63cb('0x1a')]=_0xff84df[_0x63cb('0x1a')];this[_0x63cb('0x1b')]=_0xff84df['UserId'];this[_0x63cb('0x1c')]=_0xff84df[_0x63cb('0x1c')];this[_0x63cb('0x1d')]=_0xff84df[_0x63cb('0x1d')];this[_0x63cb('0x1e')]=_0xff84df[_0x63cb('0x1e')]||'';this[_0x63cb('0x1f')]=_0xff84df['originatecalleridname']||'';this['state']=_0xff84df[_0x63cb('0x20')];this['statedesc']=_0xff84df[_0x63cb('0x21')];}module[_0x63cb('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 d690fc5..2694d24 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 _0x738b=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x738b,0x1ee));var _0xb738=function(_0x24c7fc,_0x5ef17d){_0x24c7fc=_0x24c7fc-0x0;var _0x36e2bc=_0x738b[_0x24c7fc];return _0x36e2bc;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x2348dc,_0x1d7d52){this[_0xb738('0x0')]=0x4;this[_0xb738('0x1')]=_0xb738('0x2');this[_0xb738('0x3')]=_0x2348dc[_0xb738('0x3')];this[_0xb738('0x4')]=_0x2348dc[_0xb738('0x4')];this['campaigntype']=_0x2348dc[_0xb738('0x4')]===_0xb738('0x5')?_0xb738('0x6'):_0x2348dc[_0xb738('0x4')];this['amd']=_0x2348dc[_0xb738('0x7')]||![];this['countbusyretry']=_0x2348dc[_0xb738('0x8')];this['countcongestionretry']=_0x2348dc[_0xb738('0x9')];this['countnoanswerretry']=_0x2348dc[_0xb738('0xa')];this[_0xb738('0xb')]=_0x2348dc[_0xb738('0x8')]+_0x2348dc[_0xb738('0x9')]+_0x2348dc[_0xb738('0xa')]+_0x2348dc[_0xb738('0xc')]+_0x2348dc[_0xb738('0xd')]+_0x2348dc['countabandonedretry']+_0x2348dc[_0xb738('0xe')]+_0x2348dc['countagentrejectretry'];this[_0xb738('0xc')]=_0x2348dc[_0xb738('0xc')];this[_0xb738('0xd')]=_0x2348dc[_0xb738('0xd')];this[_0xb738('0xf')]=_0x2348dc[_0xb738('0xf')];this[_0xb738('0xe')]=_0x2348dc[_0xb738('0xe')];this[_0xb738('0x10')]=_0x2348dc['countagentrejectretry'];this[_0xb738('0x11')]=_0x1d7d52['uniqueid'];this[_0xb738('0x12')]=_0x2348dc[_0xb738('0x13')];this['calleridnum']=_0x2348dc[_0xb738('0x14')];this[_0xb738('0x15')]=_0x2348dc['starttime'];this[_0xb738('0x16')]=_0x2348dc['responsetime'];this[_0xb738('0x17')]=moment()[_0xb738('0x18')](_0xb738('0x19'));this[_0xb738('0x1a')]=utils[_0xb738('0x1b')](_0x2348dc[_0xb738('0x16')],_0x2348dc[_0xb738('0x15')]);this['holdtime']=0x0;this[_0xb738('0x1c')]=utils[_0xb738('0x1b')](this[_0xb738('0x17')],_0x2348dc[_0xb738('0x16')]);this['queue']=_0x2348dc['queue'];this[_0xb738('0x1d')]='IVR';this[_0xb738('0x1e')]=_0x1d7d52[_0xb738('0x1f')];this['callback']=_0x2348dc[_0xb738('0x20')];this[_0xb738('0x21')]=_0x2348dc[_0xb738('0x21')];this[_0xb738('0x22')]=_0x2348dc['callbackat'];this[_0xb738('0x23')]=_0x2348dc[_0xb738('0x23')];this[_0xb738('0x24')]=_0x2348dc[_0xb738('0x24')];this[_0xb738('0x25')]=_0x2348dc[_0xb738('0x25')];this[_0xb738('0x26')]=_0x2348dc[_0xb738('0x26')];this[_0xb738('0x27')]=_0x2348dc[_0xb738('0x27')];this[_0xb738('0x28')]=_0x2348dc[_0xb738('0x28')];}module[_0xb738('0x29')]=Hangup; \ No newline at end of file +var _0xd2df=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xd2df,0xc9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfd2d('0x0'));var utils=require(_0xfd2d('0x1'));function Hangup(_0xec919a,_0x29eaee){this[_0xfd2d('0x2')]=0x4;this[_0xfd2d('0x3')]=_0xfd2d('0x4');this['scheduledat']=_0xec919a[_0xfd2d('0x5')];this['type']=_0xec919a[_0xfd2d('0x6')];this[_0xfd2d('0x7')]=_0xec919a['type']===_0xfd2d('0x8')?_0xfd2d('0x9'):_0xec919a['type'];this['amd']=_0xec919a[_0xfd2d('0xa')]||![];this[_0xfd2d('0xb')]=_0xec919a[_0xfd2d('0xb')];this[_0xfd2d('0xc')]=_0xec919a[_0xfd2d('0xc')];this['countnoanswerretry']=_0xec919a[_0xfd2d('0xd')];this['countglobal']=_0xec919a[_0xfd2d('0xb')]+_0xec919a[_0xfd2d('0xc')]+_0xec919a[_0xfd2d('0xd')]+_0xec919a[_0xfd2d('0xe')]+_0xec919a['countdropretry']+_0xec919a[_0xfd2d('0xf')]+_0xec919a[_0xfd2d('0x10')]+_0xec919a[_0xfd2d('0x11')];this[_0xfd2d('0xe')]=_0xec919a[_0xfd2d('0xe')];this[_0xfd2d('0x12')]=_0xec919a[_0xfd2d('0x12')];this['countabandonedretry']=_0xec919a['countabandonedretry'];this[_0xfd2d('0x10')]=_0xec919a[_0xfd2d('0x10')];this[_0xfd2d('0x11')]=_0xec919a[_0xfd2d('0x11')];this[_0xfd2d('0x13')]=_0x29eaee['uniqueid'];this[_0xfd2d('0x14')]=_0xec919a[_0xfd2d('0x15')];this['calleridnum']=_0xec919a[_0xfd2d('0x16')];this['starttime']=_0xec919a[_0xfd2d('0x17')];this[_0xfd2d('0x18')]=_0xec919a['responsetime'];this[_0xfd2d('0x19')]=moment()[_0xfd2d('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2d('0x1b')]=utils[_0xfd2d('0x1c')](_0xec919a[_0xfd2d('0x18')],_0xec919a[_0xfd2d('0x17')]);this[_0xfd2d('0x1d')]=0x0;this[_0xfd2d('0x1e')]=utils[_0xfd2d('0x1c')](this[_0xfd2d('0x19')],_0xec919a[_0xfd2d('0x18')]);this['queue']=_0xec919a[_0xfd2d('0x9')];this[_0xfd2d('0x1f')]=_0xfd2d('0x20');this['reason']=_0x29eaee[_0xfd2d('0x21')];this[_0xfd2d('0x22')]=_0xec919a[_0xfd2d('0x22')];this['callbackuniqueid']=_0xec919a[_0xfd2d('0x23')];this[_0xfd2d('0x24')]=_0xec919a[_0xfd2d('0x24')];this[_0xfd2d('0x25')]=_0xec919a[_0xfd2d('0x25')];this[_0xfd2d('0x26')]=_0xec919a[_0xfd2d('0x26')];this[_0xfd2d('0x27')]=_0xec919a['ListId'];this[_0xfd2d('0x28')]=_0xec919a[_0xfd2d('0x28')];this['VoiceQueueId']=_0xec919a[_0xfd2d('0x29')];this['CampaignId']=_0xec919a[_0xfd2d('0x2a')];}module['exports']=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 1ee44b5..6e13c74 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 _0x2cc6=['countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','type','outbound','queue','countbusyretry'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2cc6,0x170));var _0x62cc=function(_0x284885,_0x34b143){_0x284885=_0x284885-0x0;var _0x3a9710=_0x2cc6[_0x284885];return _0x3a9710;};'use strict';var utils=require(_0x62cc('0x0'));function History(_0x192309){this[_0x62cc('0x1')]=_0x192309[_0x62cc('0x1')];this['scheduledat']=_0x192309['scheduledat']||undefined;this['type']=_0x192309[_0x62cc('0x2')];this['campaigntype']=_0x192309[_0x62cc('0x2')]===_0x62cc('0x3')?_0x62cc('0x4'):_0x192309[_0x62cc('0x2')];this[_0x62cc('0x5')]=_0x192309[_0x62cc('0x5')];this['countcongestionretry']=_0x192309[_0x62cc('0x6')];this['countnoanswerretry']=_0x192309[_0x62cc('0x7')];this[_0x62cc('0x8')]=_0x192309[_0x62cc('0x5')]+_0x192309[_0x62cc('0x6')]+_0x192309[_0x62cc('0x7')]+_0x192309['countnosuchnumberretry']+_0x192309['countdropretry']+_0x192309[_0x62cc('0x9')]+_0x192309[_0x62cc('0xa')]+_0x192309[_0x62cc('0xb')];this['countnosuchnumberretry']=_0x192309[_0x62cc('0xc')];this[_0x62cc('0xd')]=_0x192309[_0x62cc('0xd')];this[_0x62cc('0x9')]=_0x192309[_0x62cc('0x9')];this['countmachineretry']=_0x192309['countmachineretry'];this[_0x62cc('0xb')]=_0x192309[_0x62cc('0xb')];this[_0x62cc('0x4')]=_0x192309[_0x62cc('0x4')];this['calleridname']=_0x192309['name'];this['calleridnum']=_0x192309[_0x62cc('0xe')];this['starttime']=_0x192309[_0x62cc('0xf')];this[_0x62cc('0x10')]=_0x192309[_0x62cc('0x10')];this[_0x62cc('0x11')]=_0x192309[_0x62cc('0x10')];this[_0x62cc('0x12')]=utils[_0x62cc('0x13')](_0x192309[_0x62cc('0x10')],_0x192309[_0x62cc('0xf')]);this['holdtime']=0x0;this[_0x62cc('0x14')]=0x0;this['callback']=_0x192309[_0x62cc('0x15')];this[_0x62cc('0x16')]=_0x192309[_0x62cc('0x16')];this[_0x62cc('0x17')]=_0x192309[_0x62cc('0x17')];this[_0x62cc('0x18')]=_0x192309[_0x62cc('0x18')];this[_0x62cc('0x19')]=_0x192309[_0x62cc('0x19')];this['ListId']=_0x192309['ListId'];this[_0x62cc('0x1a')]=_0x192309[_0x62cc('0x1a')];this[_0x62cc('0x1b')]=_0x192309[_0x62cc('0x1b')];this['CampaignId']=_0x192309[_0x62cc('0x1c')];this['originatecalleridnum']=_0x192309[_0x62cc('0x1d')]||'';this[_0x62cc('0x1e')]=_0x192309[_0x62cc('0x1e')]||'';this[_0x62cc('0x1f')]=_0x192309[_0x62cc('0x1f')];this[_0x62cc('0x20')]=_0x192309[_0x62cc('0x20')];}module[_0x62cc('0x21')]=History; \ No newline at end of file +var _0xd82a=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd82a,0x9c));var _0xad82=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xd82a[_0x231e16];return _0x570a7c;};'use strict';var utils=require(_0xad82('0x0'));function History(_0x2410e8){this['uniqueid']=_0x2410e8[_0xad82('0x1')];this[_0xad82('0x2')]=_0x2410e8[_0xad82('0x2')]||undefined;this[_0xad82('0x3')]=_0x2410e8[_0xad82('0x3')];this[_0xad82('0x4')]=_0x2410e8[_0xad82('0x3')]===_0xad82('0x5')?_0xad82('0x6'):_0x2410e8['type'];this[_0xad82('0x7')]=_0x2410e8[_0xad82('0x7')];this[_0xad82('0x8')]=_0x2410e8['countcongestionretry'];this['countnoanswerretry']=_0x2410e8['countnoanswerretry'];this[_0xad82('0x9')]=_0x2410e8[_0xad82('0x7')]+_0x2410e8[_0xad82('0x8')]+_0x2410e8[_0xad82('0xa')]+_0x2410e8[_0xad82('0xb')]+_0x2410e8['countdropretry']+_0x2410e8['countabandonedretry']+_0x2410e8['countmachineretry']+_0x2410e8[_0xad82('0xc')];this[_0xad82('0xb')]=_0x2410e8[_0xad82('0xb')];this[_0xad82('0xd')]=_0x2410e8['countdropretry'];this['countabandonedretry']=_0x2410e8[_0xad82('0xe')];this[_0xad82('0xf')]=_0x2410e8[_0xad82('0xf')];this['countagentrejectretry']=_0x2410e8[_0xad82('0xc')];this[_0xad82('0x6')]=_0x2410e8[_0xad82('0x6')];this[_0xad82('0x10')]=_0x2410e8[_0xad82('0x11')];this['calleridnum']=_0x2410e8[_0xad82('0x12')];this[_0xad82('0x13')]=_0x2410e8[_0xad82('0x13')];this[_0xad82('0x14')]=_0x2410e8[_0xad82('0x14')];this[_0xad82('0x15')]=_0x2410e8[_0xad82('0x14')];this[_0xad82('0x16')]=utils[_0xad82('0x17')](_0x2410e8['responsetime'],_0x2410e8['starttime']);this[_0xad82('0x18')]=0x0;this[_0xad82('0x19')]=0x0;this[_0xad82('0x1a')]=_0x2410e8[_0xad82('0x1a')];this[_0xad82('0x1b')]=_0x2410e8[_0xad82('0x1b')];this[_0xad82('0x1c')]=_0x2410e8[_0xad82('0x1c')];this[_0xad82('0x1d')]=_0x2410e8[_0xad82('0x1d')];this[_0xad82('0x1e')]=_0x2410e8['ContactId'];this[_0xad82('0x1f')]=_0x2410e8[_0xad82('0x1f')];this[_0xad82('0x20')]=_0x2410e8[_0xad82('0x20')];this['VoiceQueueId']=_0x2410e8[_0xad82('0x21')];this['CampaignId']=_0x2410e8[_0xad82('0x22')];this['originatecalleridnum']=_0x2410e8[_0xad82('0x23')]||'';this[_0xad82('0x24')]=_0x2410e8[_0xad82('0x24')]||'';this[_0xad82('0x25')]=_0x2410e8[_0xad82('0x25')];this[_0xad82('0x26')]=_0x2410e8[_0xad82('0x26')];}module[_0xad82('0x27')]=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 1495a94..27cbea2 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 _0xf2d0=['starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number'];(function(_0x2c93e5,_0x1c20c3){var _0x1f4fea=function(_0x33b7d6){while(--_0x33b7d6){_0x2c93e5['push'](_0x2c93e5['shift']());}};_0x1f4fea(++_0x1c20c3);}(_0xf2d0,0x137));var _0x0f2d=function(_0x211d64,_0x1cbbe3){_0x211d64=_0x211d64-0x0;var _0x56d5cd=_0xf2d0[_0x211d64];return _0x56d5cd;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x118153,_0x28a869){this[_0x0f2d('0x0')]=_0x118153[_0x0f2d('0x0')];this[_0x0f2d('0x1')]=_0x118153[_0x0f2d('0x1')];this[_0x0f2d('0x2')]=_0x118153[_0x0f2d('0x1')]===_0x0f2d('0x3')?'queue':_0x118153[_0x0f2d('0x1')];this[_0x0f2d('0x4')]=_0x118153[_0x0f2d('0x4')];this[_0x0f2d('0x5')]=_0x118153[_0x0f2d('0x5')];this[_0x0f2d('0x6')]=_0x118153[_0x0f2d('0x6')];this[_0x0f2d('0x7')]=_0x118153[_0x0f2d('0x4')]+_0x118153['countcongestionretry']+_0x118153[_0x0f2d('0x6')]+_0x118153[_0x0f2d('0x8')]+_0x118153[_0x0f2d('0x9')]+_0x118153['countabandonedretry']+_0x118153['countmachineretry']+_0x118153['countagentrejectretry'];this[_0x0f2d('0x8')]=_0x118153[_0x0f2d('0x8')];this[_0x0f2d('0x9')]=_0x118153[_0x0f2d('0x9')];this[_0x0f2d('0xa')]=_0x118153[_0x0f2d('0xa')];this[_0x0f2d('0xb')]=_0x118153[_0x0f2d('0xb')];this[_0x0f2d('0xc')]=_0x118153[_0x0f2d('0xc')];this[_0x0f2d('0xd')]=_0x28a869[_0x0f2d('0xd')];this[_0x0f2d('0xe')]=_0x118153['name'];this[_0x0f2d('0xf')]=_0x118153[_0x0f2d('0x10')];this[_0x0f2d('0x11')]=_0x118153[_0x0f2d('0x11')];this['responsetime']=_0x118153[_0x0f2d('0x12')];this[_0x0f2d('0x13')]=_0x118153[_0x0f2d('0x13')];this['dropreason']=_0x118153[_0x0f2d('0x14')];this['endtime']=this[_0x0f2d('0x13')];this[_0x0f2d('0x15')]=utils[_0x0f2d('0x16')](_0x118153[_0x0f2d('0x12')],_0x118153[_0x0f2d('0x11')]);this[_0x0f2d('0x17')]=utils[_0x0f2d('0x16')](this['droptime'],_0x118153[_0x0f2d('0x12')]);this[_0x0f2d('0x18')]=0x0;this[_0x0f2d('0x19')]=_0x28a869['queue'];this[_0x0f2d('0x1a')]=_0x28a869[_0x0f2d('0x1b')];this['reason']=_0x28a869[_0x0f2d('0x1c')];this[_0x0f2d('0x1d')]=_0x118153[_0x0f2d('0x1d')];this[_0x0f2d('0x1e')]=_0x118153[_0x0f2d('0x1e')];this[_0x0f2d('0x1f')]=_0x118153['callbackat'];this['recallme']=_0x118153[_0x0f2d('0x20')];this[_0x0f2d('0x21')]=_0x118153[_0x0f2d('0x21')];this['ListId']=_0x118153[_0x0f2d('0x22')];this['UserId']=_0x118153['UserId'];this[_0x0f2d('0x23')]=_0x118153['VoiceQueueId'];this[_0x0f2d('0x24')]=_0x118153[_0x0f2d('0x24')];this[_0x0f2d('0x25')]=_0x118153['originatecalleridnum']||'';this['originatecalleridname']=_0x118153['originatecalleridname']||'';this[_0x0f2d('0x26')]=_0x118153['agiafterat'];this[_0x0f2d('0x27')]=_0x118153[_0x0f2d('0x27')];this[_0x0f2d('0x28')]=_0x118153['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x4ea4=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2b9c4f,_0x429085){var _0x19968c=function(_0x45a33e){while(--_0x45a33e){_0x2b9c4f['push'](_0x2b9c4f['shift']());}};_0x19968c(++_0x429085);}(_0x4ea4,0xb4));var _0x44ea=function(_0x2f07c6,_0x5c6b20){_0x2f07c6=_0x2f07c6-0x0;var _0x29db6b=_0x4ea4[_0x2f07c6];return _0x29db6b;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1dabb5,_0x411ae7){this[_0x44ea('0x0')]=_0x1dabb5[_0x44ea('0x0')];this[_0x44ea('0x1')]=_0x1dabb5[_0x44ea('0x1')];this[_0x44ea('0x2')]=_0x1dabb5['type']===_0x44ea('0x3')?_0x44ea('0x4'):_0x1dabb5['type'];this[_0x44ea('0x5')]=_0x1dabb5['countbusyretry'];this[_0x44ea('0x6')]=_0x1dabb5[_0x44ea('0x6')];this[_0x44ea('0x7')]=_0x1dabb5[_0x44ea('0x7')];this[_0x44ea('0x8')]=_0x1dabb5['countbusyretry']+_0x1dabb5[_0x44ea('0x6')]+_0x1dabb5[_0x44ea('0x7')]+_0x1dabb5['countnosuchnumberretry']+_0x1dabb5[_0x44ea('0x9')]+_0x1dabb5['countabandonedretry']+_0x1dabb5['countmachineretry']+_0x1dabb5[_0x44ea('0xa')];this[_0x44ea('0xb')]=_0x1dabb5['countnosuchnumberretry'];this[_0x44ea('0x9')]=_0x1dabb5[_0x44ea('0x9')];this[_0x44ea('0xc')]=_0x1dabb5[_0x44ea('0xc')];this[_0x44ea('0xd')]=_0x1dabb5[_0x44ea('0xd')];this[_0x44ea('0xa')]=_0x1dabb5[_0x44ea('0xa')];this['uniqueid']=_0x411ae7['uniqueid'];this[_0x44ea('0xe')]=_0x1dabb5[_0x44ea('0xf')];this[_0x44ea('0x10')]=_0x1dabb5['number'];this[_0x44ea('0x11')]=_0x1dabb5[_0x44ea('0x11')];this[_0x44ea('0x12')]=_0x1dabb5[_0x44ea('0x12')];this[_0x44ea('0x13')]=_0x1dabb5['droptime'];this['dropreason']=_0x1dabb5[_0x44ea('0x14')];this[_0x44ea('0x15')]=this[_0x44ea('0x13')];this[_0x44ea('0x16')]=utils[_0x44ea('0x17')](_0x1dabb5[_0x44ea('0x12')],_0x1dabb5[_0x44ea('0x11')]);this[_0x44ea('0x18')]=utils[_0x44ea('0x17')](this[_0x44ea('0x13')],_0x1dabb5[_0x44ea('0x12')]);this[_0x44ea('0x19')]=0x0;this[_0x44ea('0x4')]=_0x411ae7[_0x44ea('0x4')];this[_0x44ea('0x1a')]=_0x411ae7[_0x44ea('0x1b')];this[_0x44ea('0x1c')]=_0x411ae7[_0x44ea('0x1c')];this[_0x44ea('0x1d')]=_0x1dabb5[_0x44ea('0x1d')];this[_0x44ea('0x1e')]=_0x1dabb5[_0x44ea('0x1e')];this[_0x44ea('0x1f')]=_0x1dabb5[_0x44ea('0x1f')];this[_0x44ea('0x20')]=_0x1dabb5['recallme'];this[_0x44ea('0x21')]=_0x1dabb5[_0x44ea('0x21')];this[_0x44ea('0x22')]=_0x1dabb5[_0x44ea('0x22')];this[_0x44ea('0x23')]=_0x1dabb5['UserId'];this[_0x44ea('0x24')]=_0x1dabb5[_0x44ea('0x24')];this[_0x44ea('0x25')]=_0x1dabb5[_0x44ea('0x25')];this[_0x44ea('0x26')]=_0x1dabb5['originatecalleridnum']||'';this[_0x44ea('0x27')]=_0x1dabb5[_0x44ea('0x27')]||'';this[_0x44ea('0x28')]=_0x1dabb5['agiafterat'];this[_0x44ea('0x29')]=_0x1dabb5[_0x44ea('0x29')];this[_0x44ea('0x2a')]=_0x1dabb5[_0x44ea('0x2a')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 0f2a4cc..daadc7a 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 _0x7b84=['swapAdditionalPhones','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b84,0x17c));var _0x47b8=function(_0x126f02,_0x83a49a){_0x126f02=_0x126f02-0x0;var _0x1199a9=_0x7b84[_0x126f02];return _0x1199a9;};'use strict';var util=require(_0x47b8('0x0'));var logger=require(_0x47b8('0x1'))(_0x47b8('0x2'));var cmHopper=require(_0x47b8('0x3'));var cmHopperAdditionalPhone=require(_0x47b8('0x4'));var cmHopperBlack=require(_0x47b8('0x5'));var cmHopperHistory=require(_0x47b8('0x6'));function inspectError(_0x5c7cda){return util[_0x47b8('0x7')](_0x5c7cda,{'showHidden':![],'depth':null});}function getContactDialer(_0x1fa41a,_0x2279ea,_0x7013d7){return cmHopper[_0x47b8('0x8')](_0x1fa41a['id'],_0x2279ea,_0x7013d7,_0x1fa41a[_0x47b8('0x9')])['catch'](function(_0x3867ca){_0x1fa41a[_0x47b8('0xa')]=0x0;logger[_0x47b8('0xb')](_0x47b8('0xc'),inspectError(_0x3867ca));});}exports[_0x47b8('0x8')]=getContactDialer;function getContactDialerIvr(_0x1af17f,_0x24d240){return cmHopper[_0x47b8('0xd')](_0x1af17f['id'],_0x24d240,_0x1af17f[_0x47b8('0x9')])[_0x47b8('0xe')](function(_0x289f98){_0x1af17f[_0x47b8('0xa')]=0x0;logger[_0x47b8('0xb')](_0x47b8('0xf'),inspectError(_0x289f98));});}exports[_0x47b8('0xd')]=getContactDialerIvr;function countReScheduled(_0x2a1af3){return cmHopper[_0x47b8('0x10')](_0x2a1af3)[_0x47b8('0xe')](function(_0x25a224){logger[_0x47b8('0xb')](_0x47b8('0x11'),inspectError(_0x25a224));});}exports[_0x47b8('0x10')]=countReScheduled;function rescheduleContact(_0x2d1aaf){return cmHopper[_0x47b8('0x12')](_0x2d1aaf)[_0x47b8('0xe')](function(_0x223121){logger[_0x47b8('0xb')]('[rescheduleContact]',inspectError(_0x223121));});}exports[_0x47b8('0x12')]=rescheduleContact;function unlockContact(_0x340da0,_0x3e760a,_0x1217a4){return cmHopper[_0x47b8('0x13')](_0x340da0,_0x3e760a,_0x1217a4)[_0x47b8('0xe')](function(_0x4765ad){logger['error'](_0x47b8('0x14'),inspectError(_0x4765ad));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x525fd6){return cmHopper['moveContactManagedDialer'](_0x525fd6)[_0x47b8('0xe')](function(_0x36faf1){logger[_0x47b8('0xb')]('[moveContactManagedDialer]',inspectError(_0x36faf1));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f6716){return cmHopperBlack[_0x47b8('0x15')](_0x4f6716)['catch'](function(_0x2a4fa7){logger[_0x47b8('0xb')](_0x47b8('0x16'),inspectError(_0x2a4fa7));});}exports[_0x47b8('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4eba33){return cmHopperBlack[_0x47b8('0x17')](_0x4eba33)[_0x47b8('0xe')](function(_0x2840c3){logger[_0x47b8('0xb')](_0x47b8('0x18'),inspectError(_0x2840c3));});}exports[_0x47b8('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x54f6bc,_0x31555d,_0x2a22e3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x54f6bc,_0x31555d,_0x2a22e3)[_0x47b8('0xe')](function(_0x247429){logger[_0x47b8('0xb')](_0x47b8('0x19'),inspectError(_0x247429));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x35b327,_0x332c23,_0x319d17){return cmHopperAdditionalPhone[_0x47b8('0x1a')](_0x35b327,_0x332c23,_0x319d17)[_0x47b8('0xe')](function(_0xbf5ce9){logger[_0x47b8('0xb')]('[swapAdditionalPhone]',inspectError(_0xbf5ce9));});}exports[_0x47b8('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1f719a){return cmHopperHistory['avgHandleTime'](_0x1f719a)[_0x47b8('0xe')](function(_0x6d517a){logger[_0x47b8('0xb')](_0x47b8('0x1b'),inspectError(_0x6d517a));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x162d96){return cmHopperHistory['createHistory'](_0x162d96)[_0x47b8('0xe')](function(_0x2255ab){logger[_0x47b8('0xb')](_0x47b8('0x1c'),inspectError(_0x2255ab));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xaa3f=['countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]'];(function(_0x555a56,_0x27872f){var _0x5ee4d8=function(_0x3e4833){while(--_0x3e4833){_0x555a56['push'](_0x555a56['shift']());}};_0x5ee4d8(++_0x27872f);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5374c9,_0x5239e8){_0x5374c9=_0x5374c9-0x0;var _0x1f4e5e=_0xaa3f[_0x5374c9];return _0x1f4e5e;};'use strict';var util=require(_0xfaa3('0x0'));var logger=require(_0xfaa3('0x1'))(_0xfaa3('0x2'));var cmHopper=require(_0xfaa3('0x3'));var cmHopperAdditionalPhone=require(_0xfaa3('0x4'));var cmHopperBlack=require(_0xfaa3('0x5'));var cmHopperHistory=require(_0xfaa3('0x6'));function inspectError(_0x2b1aaf){return util[_0xfaa3('0x7')](_0x2b1aaf,{'showHidden':![],'depth':null});}function getContactDialer(_0x5123a3,_0x513eea,_0x2ac57f){return cmHopper['getContactDialer'](_0x5123a3['id'],_0x513eea,_0x2ac57f,_0x5123a3[_0xfaa3('0x8')])[_0xfaa3('0x9')](function(_0x352958){_0x5123a3[_0xfaa3('0xa')]=0x0;logger[_0xfaa3('0xb')](_0xfaa3('0xc'),inspectError(_0x352958));});}exports[_0xfaa3('0xd')]=getContactDialer;function getContactDialerIvr(_0x54fb06,_0x37bcd5){return cmHopper[_0xfaa3('0xe')](_0x54fb06['id'],_0x37bcd5,_0x54fb06['dialOrderByScheduledAt'])['catch'](function(_0x44d88e){_0x54fb06[_0xfaa3('0xa')]=0x0;logger[_0xfaa3('0xb')](_0xfaa3('0xf'),inspectError(_0x44d88e));});}exports[_0xfaa3('0xe')]=getContactDialerIvr;function countReScheduled(_0x32866b){return cmHopper['countReScheduled'](_0x32866b)[_0xfaa3('0x9')](function(_0x5be067){logger[_0xfaa3('0xb')](_0xfaa3('0x10'),inspectError(_0x5be067));});}exports[_0xfaa3('0x11')]=countReScheduled;function rescheduleContact(_0x58f71b){return cmHopper[_0xfaa3('0x12')](_0x58f71b)['catch'](function(_0xdf7551){logger[_0xfaa3('0xb')](_0xfaa3('0x13'),inspectError(_0xdf7551));});}exports[_0xfaa3('0x12')]=rescheduleContact;function unlockContact(_0x1243ed,_0x40831f,_0x4da250){return cmHopper['unlockContact'](_0x1243ed,_0x40831f,_0x4da250)[_0xfaa3('0x9')](function(_0xe1a082){logger[_0xfaa3('0xb')](_0xfaa3('0x14'),inspectError(_0xe1a082));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x5dd38c){return cmHopper['moveContactManagedDialer'](_0x5dd38c)['catch'](function(_0x499148){logger[_0xfaa3('0xb')]('[moveContactManagedDialer]',inspectError(_0x499148));});}exports[_0xfaa3('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x42846e){return cmHopperBlack[_0xfaa3('0x16')](_0x42846e)[_0xfaa3('0x9')](function(_0x1c32dd){logger[_0xfaa3('0xb')](_0xfaa3('0x17'),inspectError(_0x1c32dd));});}exports[_0xfaa3('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x220c9e){return cmHopperBlack[_0xfaa3('0x18')](_0x220c9e)['catch'](function(_0x434c8b){logger[_0xfaa3('0xb')](_0xfaa3('0x19'),inspectError(_0x434c8b));});}exports[_0xfaa3('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x50dc4a,_0x1f7324,_0x2d4087){return cmHopperAdditionalPhone[_0xfaa3('0x1a')](_0x50dc4a,_0x1f7324,_0x2d4087)[_0xfaa3('0x9')](function(_0x16a3e3){logger[_0xfaa3('0xb')](_0xfaa3('0x1b'),inspectError(_0x16a3e3));});}exports[_0xfaa3('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5d6cdd,_0xe075fc,_0x2a1ace){return cmHopperAdditionalPhone[_0xfaa3('0x1c')](_0x5d6cdd,_0xe075fc,_0x2a1ace)[_0xfaa3('0x9')](function(_0x31c5cd){logger[_0xfaa3('0xb')](_0xfaa3('0x1d'),inspectError(_0x31c5cd));});}exports[_0xfaa3('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0xd67c17){return cmHopperHistory[_0xfaa3('0x1e')](_0xd67c17)[_0xfaa3('0x9')](function(_0x7df1f3){logger[_0xfaa3('0xb')](_0xfaa3('0x1f'),inspectError(_0x7df1f3));});}exports[_0xfaa3('0x1e')]=avgHandleTime;function createHistory(_0x5b84cd){return cmHopperHistory[_0xfaa3('0x20')](_0x5b84cd)[_0xfaa3('0x9')](function(_0xc2e71){logger['error'](_0xfaa3('0x21'),inspectError(_0xc2e71));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index c1b5749..395288a 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 _0x893b=['milliseconds','diff','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','undefined','length','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x893b,0x190));var _0xb893=function(_0x30fd6d,_0x3e9d38){_0x30fd6d=_0x30fd6d-0x0;var _0x30e51d=_0x893b[_0x30fd6d];return _0x30e51d;};'use strict';var _=require(_0xb893('0x0'));var moment=require(_0xb893('0x1'));var util=require(_0xb893('0x2'));var logger=require('../../../../config/logger')(_0xb893('0x3'));var timezones=require(_0xb893('0x4'))[_0xb893('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xb893('0x6'),'BLACKLIST':_0xb893('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb893('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb893('0x9'),'INACTIVE':_0xb893('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xb893('0xb'),'OVERTIME_INTERVAL':_0xb893('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xb893('0xd'),'QUEUE_RECALL':_0xb893('0xe'),'RECALL_TIMEOUT':_0xb893('0xf'),'RUNNING':_0xb893('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xb893('0x11')};exports[_0xb893('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1ce2a4){return _0x1ce2a4[_0xb893('0x13')]===_0xb893('0x14');}exports[_0xb893('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x4976ef){return _0x4976ef[_0xb893('0x16')]===_0xb893('0x17');}exports[_0xb893('0x18')]=isIVRCampaign;function isOutboundQueue(_0x146975){return _0x146975[_0xb893('0x16')]===_0xb893('0x19');}exports[_0xb893('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x5ae199){return _0x5ae199[_0xb893('0x1b')];}exports[_0xb893('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4875cb){return _0x4875cb[_0xb893('0x1d')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x5ed8c1,_0x615d17){var _0x530188=moment(_0x5ed8c1)[_0xb893('0x1e')](0x0);var _0x471e9a=moment(_0x615d17)[_0xb893('0x1e')](0x0);return _0x530188[_0xb893('0x1f')](_0x471e9a,_0xb893('0x20'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x184ebc,_0x324deb){var _0x1a0be3=![];var _0x2cb14e=_0x184ebc[_0xb893('0x13')]!==_0x324deb['dialMethod']||_0x184ebc['dialActive']!==_0x324deb[_0xb893('0x1b')]||_0x184ebc[_0xb893('0x21')]!==_0x324deb[_0xb893('0x21')];var _0x597204=_0x184ebc[_0xb893('0x22')]!==_0x324deb[_0xb893('0x22')]||_0x184ebc[_0xb893('0x23')]!==_0x324deb[_0xb893('0x23')]||_0x184ebc[_0xb893('0x24')]!==_0x324deb[_0xb893('0x24')]||_0x184ebc[_0xb893('0x25')]!==_0x324deb['paused']||_0x184ebc[_0xb893('0x26')]!==_0x324deb['talking']||_0x184ebc['pTalking']!==_0x324deb[_0xb893('0x27')]||_0x184ebc[_0xb893('0x28')]!==_0x324deb['waiting']||_0x184ebc[_0xb893('0x29')]!==_0x324deb['inUse']||_0x184ebc[_0xb893('0x2a')]!==_0x324deb[_0xb893('0x2a')];if(_0x184ebc[_0xb893('0x2b')]&&_0x324deb[_0xb893('0x2b')]){_0x1a0be3=_0x184ebc[_0xb893('0x2b')][_0xb893('0x2c')]!==_0x324deb[_0xb893('0x2b')][_0xb893('0x2c')]||_0x184ebc['Trunk'][_0xb893('0x1d')]!==_0x324deb[_0xb893('0x2b')][_0xb893('0x1d')];}return _0x2cb14e||_0x597204||_0x1a0be3;}exports[_0xb893('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5a0a9a){var _0x22078d=null;var _0x1d8a11=_0x5a0a9a[_0xb893('0x2e')];if(_[_0xb893('0x2f')](_0x5a0a9a['dialGlobalInterval'])||_[_0xb893('0x2f')](_0x5a0a9a[_0xb893('0x30')])||_[_0xb893('0x2f')](_0x5a0a9a[_0xb893('0x30')]['Intervals'])){_0x22078d=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xb893('0x31')](_0x5a0a9a[_0xb893('0x32')])||_['isEmpty'](_0x5a0a9a['Interval']['Intervals'])){_0x22078d=CAMPAIGN_STATUS[_0xb893('0x33')];}else if(_0x1d8a11&&!timezones[_0x1d8a11]){_0x22078d=CAMPAIGN_STATUS[_0xb893('0x34')];}return _0x22078d;}function checkAnyValidTrunk(_0x497d8b,_0x47f8b2){var _0x23199f=null;var _0x4dd818=_0xb893('0x35');var _0x153440=['reachable',_0xb893('0x36')];var _0x1bb9eb=!![];if(_0x497d8b[_0xb893('0x2b')]&&_0x497d8b[_0xb893('0x2b')][_0xb893('0x1d')]){_0x4dd818+=_0x497d8b['Trunk'][_0xb893('0x2c')];_0x23199f=_0x47f8b2[_0x4dd818];_0x1bb9eb=_0x153440[_0xb893('0x37')](_0x23199f[_0xb893('0x38')]);}else if(_0x497d8b[_0xb893('0x39')]&&_0x497d8b['TrunkBackup'][_0xb893('0x1d')]){_0x4dd818+=_0x497d8b[_0xb893('0x39')][_0xb893('0x2c')];_0x23199f=_0x47f8b2[_0x4dd818];_0x1bb9eb=_0x153440[_0xb893('0x37')](_0x23199f['status']);}return _0x1bb9eb;}function getQueueCampaignStatusMessage(_0x3663ad,_0x2a33d3){var _0x410ae6=CAMPAIGN_STATUS['ACTIVE'];var _0x12ffaa=isPreviewCampaign(_0x3663ad);if(!isQueueCampaignActive(_0x3663ad)){if(_0x12ffaa){_0x410ae6=CAMPAIGN_STATUS[_0xb893('0x3a')];}else{if(_0x3663ad[_0xb893('0x2a')]===0x0&&_0x3663ad[_0xb893('0x26')]===0x0&&_0x3663ad[_0xb893('0x28')]===0x0&&(_0x3663ad[_0xb893('0x27')]||0x0)===0x0){_0x410ae6=CAMPAIGN_STATUS['INACTIVE'];}else{_0x410ae6=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x3663ad['loggedIn']===0x0){_0x410ae6=CAMPAIGN_STATUS[_0xb893('0x3b')];}else if(!checkAnyValidTrunk(_0x3663ad,_0x2a33d3)){_0x410ae6=CAMPAIGN_STATUS[_0xb893('0x3c')];}else if(!isPreviewCampaign(_0x3663ad)){var _0x2bd72d=checkAnyValidQueueCampaignInterval(_0x3663ad);if(_0x2bd72d){_0x410ae6=_0x2bd72d;}}return _0x410ae6;}exports[_0xb893('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x54d713){var _0x2a94c7=CAMPAIGN_STATUS['DISACTIVED'];if(_0x54d713['originated']===0x0&&_0x54d713[_0xb893('0x26')]===0x0&&_0x54d713[_0xb893('0x28')]===0x0&&(_0x54d713[_0xb893('0x27')]||0x0)===0x0){_0x2a94c7=CAMPAIGN_STATUS[_0xb893('0x3a')];}return _0x2a94c7;}exports[_0xb893('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5f4aa4){var _0x223395=_0x5f4aa4[_0xb893('0x3f')](/"(.*?)"/);return _0x223395?_0x223395[0x1]:_0x5f4aa4;}exports[_0xb893('0x40')]=extractCalleridName;function getCallerId(_0x431681,_0x4eea98,_0x280c37){if(!_[_0xb893('0x41')](_0x280c37)&&typeof _0x280c37===_0xb893('0x42')&&!_[_0xb893('0x31')](_0x280c37)){if(!_[_0xb893('0x41')](_0x4eea98)&&typeof _0x4eea98===_0xb893('0x42')&&!_[_0xb893('0x31')](_0x4eea98)){return util[_0xb893('0x43')](_0xb893('0x44'),_0x4eea98,_0x280c37);}return util[_0xb893('0x43')](_0xb893('0x44'),_0x280c37,_0x280c37);}if(!_[_0xb893('0x41')](_0x431681)&&typeof _0x431681===_0xb893('0x42')&&!_[_0xb893('0x31')](_0x431681)){return _0x431681;}return'\x22\x22\x20<>';}exports[_0xb893('0x45')]=getCallerId;function getCallerIdRandom(_0x9a9add,_0x1a0537){var _0x57c64a;var _0x49c998;var _0x429862;if(_0x1a0537<=0x0){_0x1a0537=0x1;}_0x57c64a=new RegExp('\x5cw{0,'+_0x1a0537+'}$');_0x49c998=Math['pow'](0xa,_0x1a0537-0x1);_0x429862=Math[_0xb893('0x46')](0xa,_0x1a0537)-0x1;return util['format']('%s',_[_0xb893('0x47')](_0x9a9add,_0x57c64a,_[_0xb893('0x48')](_0x49c998,_0x429862)[_0xb893('0x49')]()));}exports[_0xb893('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x36b273,_0x3ebd37){if(_0x36b273[_0xb893('0x2a')]&&_0x36b273[_0xb893('0x2a')]>0x0){_0x36b273[_0xb893('0x2a')]-=0x1;}else{logger[_0xb893('0x4b')](_0xb893('0x4c'),_0x3ebd37);}}exports[_0xb893('0x4d')]=decrementOriginate;function checkContactEmpty(_0x44e0fa){return _0x44e0fa&&_0x44e0fa['length']>0x0;}exports[_0xb893('0x4e')]=checkContactEmpty;function erlangb(_0x32383e,_0x2ccca5){if(_0x2ccca5===0x0){return 0x0;}var _0x6d3d38=0x1;for(var _0x323d85=0x1;_0x323d85<=_0x2ccca5;_0x323d85+=0x1){_0x6d3d38=0x1+_0x6d3d38*_0x323d85/_0x32383e;}return 0x1/_0x6d3d38;}exports[_0xb893('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x467c23,_0x54bd41,_0x3fb3b7){if(_0x54bd41>_0x3fb3b7){for(var _0x3eab5c=0x0;_0x3eab5c<_0x54bd41-_0x3fb3b7;_0x3eab5c+=0x1){decrementOriginate(_0x467c23,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0xb893('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xb15da6){var _0x1c402f={};var _0x80704d=['id','createdAt','tags','updatedAt'];const _0x5d80c1=0xfa;if(_0xb15da6){for(var _0x1a0b39 in _0xb15da6){if(typeof _0xb15da6[_0x1a0b39]!==_0xb893('0x51')){if(!_[_0xb893('0x2f')](_0xb15da6[_0x1a0b39])&&!_0x80704d['includes'](_0x1a0b39)){if(_0x1a0b39==='description'&&_0xb15da6[_0x1a0b39][_0xb893('0x52')]>_0x5d80c1){_0x1c402f[_0xb893('0x53')+_0x1a0b39[_0xb893('0x54')]()]=_0xb15da6[_0x1a0b39][_0xb893('0x49')]()['substring'](0x0,_0x5d80c1);}else{_0x1c402f[_0xb893('0x53')+_0x1a0b39[_0xb893('0x54')]()]=_0xb15da6[_0x1a0b39];}}}}}return _0x1c402f;}exports[_0xb893('0x55')]=setXMDContactVariables; \ No newline at end of file +var _0xb759=['dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','getQueueCampaignStatusMessage','DISACTIVED','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name'];(function(_0x1e3b99,_0x54ea39){var _0x416130=function(_0x2a48fc){while(--_0x2a48fc){_0x1e3b99['push'](_0x1e3b99['shift']());}};_0x416130(++_0x54ea39);}(_0xb759,0x1d5));var _0x9b75=function(_0x216b6a,_0xef50ef){_0x216b6a=_0x216b6a-0x0;var _0x1bb15e=_0xb759[_0x216b6a];return _0x1bb15e;};'use strict';var _=require(_0x9b75('0x0'));var moment=require(_0x9b75('0x1'));var util=require(_0x9b75('0x2'));var logger=require(_0x9b75('0x3'))(_0x9b75('0x4'));var timezones=require(_0x9b75('0x5'))[_0x9b75('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x9b75('0x7'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x9b75('0x8'),'DEACTIVATED':_0x9b75('0x9'),'DISACTIVED':_0x9b75('0xa'),'EMPTY_INTERVAL':_0x9b75('0xb'),'INACTIVE':_0x9b75('0xc'),'NO_AGENTS_LOGGED':_0x9b75('0xd'),'NO_AVAILABLE_CONTACTS':_0x9b75('0xe'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x9b75('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x9b75('0x10'),'QUEUE_RECALL':_0x9b75('0x11'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x9b75('0x12'),'UNKNOWN_TIMEZONE':_0x9b75('0x13'),'UNREACHABLE_TRUNK':_0x9b75('0x14')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1528bd){return _0x1528bd[_0x9b75('0x15')]==='preview';}exports[_0x9b75('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x23624c){return _0x23624c[_0x9b75('0x17')]==='ivr';}exports[_0x9b75('0x18')]=isIVRCampaign;function isOutboundQueue(_0x9214d7){return _0x9214d7[_0x9b75('0x17')]===_0x9b75('0x19');}exports[_0x9b75('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0xed4a7e){return _0xed4a7e['dialActive'];}exports[_0x9b75('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4853ac){return _0x4853ac[_0x9b75('0x1c')];}exports[_0x9b75('0x1d')]=isIVRCampaignActive;function getSeconds(_0x1f10f1,_0x2ab9bd){var _0x172360=moment(_0x1f10f1)['milliseconds'](0x0);var _0xb0d902=moment(_0x2ab9bd)[_0x9b75('0x1e')](0x0);return _0x172360[_0x9b75('0x1f')](_0xb0d902,_0x9b75('0x20'));}exports[_0x9b75('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x56178,_0x268dd8){var _0x165c09=![];var _0x332717=_0x56178[_0x9b75('0x15')]!==_0x268dd8[_0x9b75('0x15')]||_0x56178['dialActive']!==_0x268dd8[_0x9b75('0x22')]||_0x56178[_0x9b75('0x23')]!==_0x268dd8[_0x9b75('0x23')];var _0x213f47=_0x56178[_0x9b75('0x24')]!==_0x268dd8[_0x9b75('0x24')]||_0x56178[_0x9b75('0x25')]!==_0x268dd8[_0x9b75('0x25')]||_0x56178[_0x9b75('0x26')]!==_0x268dd8[_0x9b75('0x26')]||_0x56178[_0x9b75('0x27')]!==_0x268dd8[_0x9b75('0x27')]||_0x56178[_0x9b75('0x28')]!==_0x268dd8['talking']||_0x56178[_0x9b75('0x29')]!==_0x268dd8[_0x9b75('0x29')]||_0x56178[_0x9b75('0x2a')]!==_0x268dd8['waiting']||_0x56178[_0x9b75('0x2b')]!==_0x268dd8['inUse']||_0x56178[_0x9b75('0x2c')]!==_0x268dd8['originated'];if(_0x56178['Trunk']&&_0x268dd8[_0x9b75('0x2d')]){_0x165c09=_0x56178[_0x9b75('0x2d')][_0x9b75('0x2e')]!==_0x268dd8[_0x9b75('0x2d')][_0x9b75('0x2e')]||_0x56178[_0x9b75('0x2d')][_0x9b75('0x1c')]!==_0x268dd8[_0x9b75('0x2d')]['active'];}return _0x332717||_0x213f47||_0x165c09;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1d715d){var _0x1d6f14=null;var _0x598c1a=_0x1d715d[_0x9b75('0x2f')];if(_['isNil'](_0x1d715d[_0x9b75('0x30')])||_[_0x9b75('0x31')](_0x1d715d['Interval'])||_[_0x9b75('0x31')](_0x1d715d[_0x9b75('0x32')][_0x9b75('0x33')])){_0x1d6f14=CAMPAIGN_STATUS[_0x9b75('0x34')];}else if(_[_0x9b75('0x35')](_0x1d715d[_0x9b75('0x30')])||_[_0x9b75('0x35')](_0x1d715d[_0x9b75('0x32')][_0x9b75('0x33')])){_0x1d6f14=CAMPAIGN_STATUS[_0x9b75('0x36')];}else if(_0x598c1a&&!timezones[_0x598c1a]){_0x1d6f14=CAMPAIGN_STATUS[_0x9b75('0x37')];}return _0x1d6f14;}function checkAnyValidTrunk(_0x1abbf0,_0x474f13){var _0x11c77d=null;var _0x59c36a='SIP/';var _0x4a1dc0=[_0x9b75('0x38'),_0x9b75('0x39')];var _0x4486c0=!![];if(_0x1abbf0[_0x9b75('0x2d')]&&_0x1abbf0[_0x9b75('0x2d')]['active']){_0x59c36a+=_0x1abbf0[_0x9b75('0x2d')][_0x9b75('0x2e')];_0x11c77d=_0x474f13[_0x59c36a];_0x4486c0=_0x4a1dc0[_0x9b75('0x3a')](_0x11c77d[_0x9b75('0x3b')]);}else if(_0x1abbf0[_0x9b75('0x3c')]&&_0x1abbf0['TrunkBackup'][_0x9b75('0x1c')]){_0x59c36a+=_0x1abbf0['TrunkBackup'][_0x9b75('0x2e')];_0x11c77d=_0x474f13[_0x59c36a];_0x4486c0=_0x4a1dc0[_0x9b75('0x3a')](_0x11c77d[_0x9b75('0x3b')]);}return _0x4486c0;}function getQueueCampaignStatusMessage(_0x32a3e6,_0x1a09a7){var _0xa2e167=CAMPAIGN_STATUS['ACTIVE'];var _0x34cd71=isPreviewCampaign(_0x32a3e6);if(!isQueueCampaignActive(_0x32a3e6)){if(_0x34cd71){_0xa2e167=CAMPAIGN_STATUS[_0x9b75('0x3d')];}else{if(_0x32a3e6['originated']===0x0&&_0x32a3e6[_0x9b75('0x28')]===0x0&&_0x32a3e6[_0x9b75('0x2a')]===0x0&&(_0x32a3e6['pTalking']||0x0)===0x0){_0xa2e167=CAMPAIGN_STATUS['INACTIVE'];}else{_0xa2e167=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x32a3e6[_0x9b75('0x25')]===0x0){_0xa2e167=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x32a3e6,_0x1a09a7)){_0xa2e167=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x32a3e6)){var _0x23c6f8=checkAnyValidQueueCampaignInterval(_0x32a3e6);if(_0x23c6f8){_0xa2e167=_0x23c6f8;}}return _0xa2e167;}exports[_0x9b75('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x27982b){var _0x5e4788=CAMPAIGN_STATUS[_0x9b75('0x3f')];if(_0x27982b['originated']===0x0&&_0x27982b[_0x9b75('0x28')]===0x0&&_0x27982b[_0x9b75('0x2a')]===0x0&&(_0x27982b[_0x9b75('0x29')]||0x0)===0x0){_0x5e4788=CAMPAIGN_STATUS['INACTIVE'];}return _0x5e4788;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x45d08d){var _0xf1eed9=_0x45d08d[_0x9b75('0x40')](/"(.*?)"/);return _0xf1eed9?_0xf1eed9[0x1]:_0x45d08d;}exports[_0x9b75('0x41')]=extractCalleridName;function getCallerId(_0x351fc0,_0x2086a8,_0x4d4af4){if(!_[_0x9b75('0x42')](_0x4d4af4)&&typeof _0x4d4af4===_0x9b75('0x43')&&!_[_0x9b75('0x35')](_0x4d4af4)){if(!_[_0x9b75('0x42')](_0x2086a8)&&typeof _0x2086a8===_0x9b75('0x43')&&!_[_0x9b75('0x35')](_0x2086a8)){return util[_0x9b75('0x44')](_0x9b75('0x45'),_0x2086a8,_0x4d4af4);}return util[_0x9b75('0x44')](_0x9b75('0x45'),_0x4d4af4,_0x4d4af4);}if(!_[_0x9b75('0x42')](_0x351fc0)&&typeof _0x351fc0==='string'&&!_[_0x9b75('0x35')](_0x351fc0)){return _0x351fc0;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x59df8a,_0x15bc08){var _0x100e04;var _0x363288;var _0x24882b;if(_0x15bc08<=0x0){_0x15bc08=0x1;}_0x100e04=new RegExp(_0x9b75('0x46')+_0x15bc08+'}$');_0x363288=Math[_0x9b75('0x47')](0xa,_0x15bc08-0x1);_0x24882b=Math['pow'](0xa,_0x15bc08)-0x1;return util[_0x9b75('0x44')]('%s',_['replace'](_0x59df8a,_0x100e04,_[_0x9b75('0x48')](_0x363288,_0x24882b)[_0x9b75('0x49')]()));}exports[_0x9b75('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x16497c){if(_0x16497c['originated']&&_0x16497c['originated']>0x0){_0x16497c[_0x9b75('0x2c')]-=0x1;}else{logger[_0x9b75('0x4b')](_0x9b75('0x4c'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x91ca75){return _0x91ca75&&_0x91ca75[_0x9b75('0x4d')]>0x0;}exports[_0x9b75('0x4e')]=checkContactEmpty;function erlangb(_0x4c6d17,_0x55dfa8){if(_0x55dfa8===0x0){return 0x0;}var _0x58f679=0x1;for(var _0x348187=0x1;_0x348187<=_0x55dfa8;_0x348187+=0x1){_0x58f679=0x1+_0x58f679*_0x348187/_0x4c6d17;}return 0x1/_0x58f679;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x198fea,_0x497620,_0x3e3132){if(_0x497620>_0x3e3132){for(var _0x4e02bc=0x0;_0x4e02bc<_0x497620-_0x3e3132;_0x4e02bc+=0x1){decrementOriginate(_0x198fea);}}}exports[_0x9b75('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x420d7f){var _0x5a2ba4={};var _0x72acf3=['id',_0x9b75('0x50'),_0x9b75('0x51'),'updatedAt'];const _0x3de67d=0xfa;if(_0x420d7f){for(var _0x14852b in _0x420d7f){if(typeof _0x420d7f[_0x14852b]!=='undefined'){if(!_[_0x9b75('0x31')](_0x420d7f[_0x14852b])&&!_0x72acf3[_0x9b75('0x3a')](_0x14852b)){if(_0x14852b==='description'&&_0x420d7f[_0x14852b][_0x9b75('0x4d')]>_0x3de67d){_0x5a2ba4[_0x9b75('0x52')+_0x14852b[_0x9b75('0x53')]()]=_0x420d7f[_0x14852b][_0x9b75('0x49')]()[_0x9b75('0x54')](0x0,_0x3de67d);}else{_0x5a2ba4[_0x9b75('0x52')+_0x14852b[_0x9b75('0x53')]()]=_0x420d7f[_0x14852b];}}}}}return _0x5a2ba4;}exports[_0x9b75('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 91e8d0f..068467f 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(_0x1359c3,_0x55326c){var _0x2a1cbe=function(_0x37735f){while(--_0x37735f){_0x1359c3['push'](_0x1359c3['shift']());}};_0x2a1cbe(++_0x55326c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x129a24,_0x59b512){var _0x1d8f7f=function(_0xe78443){while(--_0xe78443){_0x129a24['push'](_0x129a24['shift']());}};_0x1d8f7f(++_0x59b512);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 13593ca..d1d00a6 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 _0x92ed=['Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','newstate','syncNewState','newexten','syncNewExten','bind','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','name','\x20syncNewchannel\x20','info','channelstate','channelstatedesc','variable','value','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path'];(function(_0x4532cd,_0x3c59b6){var _0x4f761=function(_0x3359f0){while(--_0x3359f0){_0x4532cd['push'](_0x4532cd['shift']());}};_0x4f761(++_0x3c59b6);}(_0x92ed,0xf2));var _0xd92e=function(_0xb479b4,_0x11eb3b){_0xb479b4=_0xb479b4-0x0;var _0x170c1d=_0x92ed[_0xb479b4];return _0x170c1d;};'use strict';var util=require(_0xd92e('0x0'));var _=require(_0xd92e('0x1'));var BPromise=require(_0xd92e('0x2'));var uuid=require(_0xd92e('0x3'));var moment=require(_0xd92e('0x4'));var path=require(_0xd92e('0x5'));var tiff2pdf=require(_0xd92e('0x6'));var gs=require(_0xd92e('0x7'));var logger=require('../../../config/logger')('fax');var ami=require(_0xd92e('0x8'));var rpcDb=require(_0xd92e('0x9'));var Channel=require('./channel');var ut=require(_0xd92e('0xa'));var Action=require(_0xd92e('0xb'));var faxAccount=require(_0xd92e('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xd92e('0xd'));function Fax(_0x57e195){this[_0xd92e('0xe')]={};this[_0xd92e('0xf')]=_0x57e195[_0xd92e('0xf')];this[_0xd92e('0x10')]=_0x57e195[_0xd92e('0x10')];this[_0xd92e('0x11')]={};ami['on'](_0xd92e('0x12'),this[_0xd92e('0x13')]['bind'](this));ami['on'](_0xd92e('0x14'),this['syncVarSet']['bind'](this));ami['on'](_0xd92e('0x15'),this[_0xd92e('0x16')]['bind'](this));ami['on'](_0xd92e('0x17'),this[_0xd92e('0x18')][_0xd92e('0x19')](this));ami['on']('faxstatus',this[_0xd92e('0x1a')][_0xd92e('0x19')](this));ami['on'](_0xd92e('0x1b'),this[_0xd92e('0x1c')][_0xd92e('0x19')](this));ami['on'](_0xd92e('0x1d'),this['syncHangup'][_0xd92e('0x19')](this));ami['on'](_0xd92e('0x1e'),this[_0xd92e('0x1f')][_0xd92e('0x19')](this));}Fax[_0xd92e('0x20')][_0xd92e('0x13')]=function(_0x55c42e){if(_0x55c42e[_0xd92e('0x21')]===_0xd92e('0x22')){for(var _0x2e8371 in this['faxAccounts']){if(this[_0xd92e('0xf')][_0xd92e('0x23')](_0x2e8371)){if(_0x55c42e[_0xd92e('0x24')]===this['faxAccounts'][_0x2e8371][_0xd92e('0x25')]){this[_0xd92e('0xe')][_0x55c42e['uniqueid']]={};this['channels'][_0x55c42e['uniqueid']][_0xd92e('0x26')]=_0x55c42e[_0xd92e('0x26')];this[_0xd92e('0xe')][_0x55c42e[_0xd92e('0x27')]]['id']=this[_0xd92e('0xf')][_0x2e8371]['id'];this['channels'][_0x55c42e[_0xd92e('0x27')]][_0xd92e('0x28')]=this['faxAccounts'][_0x2e8371][_0xd92e('0x28')];logger['info'](_0x55c42e['uniqueid'],_0xd92e('0x29'));}}}}if(this['actions'][_0x55c42e['uniqueid']]){this[_0xd92e('0xe')][_0x55c42e[_0xd92e('0x27')]]={};this['channels'][_0x55c42e[_0xd92e('0x27')]]['channel']=_0x55c42e[_0xd92e('0x26')];logger[_0xd92e('0x2a')](_0x55c42e[_0xd92e('0x27')],_0xd92e('0x29'));}};Fax['prototype']['syncVarSet']=function(_0x468098){if(this[_0xd92e('0xe')][_0x468098[_0xd92e('0x27')]]){for(var _0x4cbdfa in _0x468098['variable']){if(_0x468098['variable'][_0xd92e('0x23')](_0x4cbdfa)){this['channels'][_0x468098[_0xd92e('0x27')]][_0x4cbdfa]=_0x468098['value'];}}}};Fax[_0xd92e('0x20')][_0xd92e('0x16')]=function(_0x55880e){if(this[_0xd92e('0xe')][_0x55880e[_0xd92e('0x27')]]){this[_0xd92e('0xe')][_0x55880e[_0xd92e('0x27')]][_0xd92e('0x2b')]=_0x55880e[_0xd92e('0x2b')];this[_0xd92e('0xe')][_0x55880e['uniqueid']][_0xd92e('0x2c')]=_0x55880e[_0xd92e('0x2c')];}};Fax['prototype'][_0xd92e('0x18')]=function(_0xdb1de3){if(this[_0xd92e('0xe')][_0xdb1de3[_0xd92e('0x27')]]){for(var _0x5e8389 in _0xdb1de3[_0xd92e('0x2d')]){if(_0xdb1de3['variable']['hasOwnProperty'](_0x5e8389)){this[_0xd92e('0xe')][_0xdb1de3[_0xd92e('0x27')]][_0x5e8389]=_0xdb1de3[_0xd92e('0x2e')];}}}};Fax[_0xd92e('0x20')]['syncFaxStatus']=function(_0x2d084b){if(this[_0xd92e('0xe')][_0x2d084b[_0xd92e('0x27')]]){this['channels'][_0x2d084b['uniqueid']][_0xd92e('0x2f')]=_0x2d084b[_0xd92e('0x2f')];this[_0xd92e('0xe')][_0x2d084b[_0xd92e('0x27')]]['status']=_0x2d084b[_0xd92e('0x30')];this[_0xd92e('0xe')][_0x2d084b['uniqueid']]['localstationid']=_0x2d084b[_0xd92e('0x25')];this[_0xd92e('0xe')][_0x2d084b['uniqueid']][_0xd92e('0x31')]=_0x2d084b[_0xd92e('0x31')];logger['info'](_0x2d084b[_0xd92e('0x27')],_0xd92e('0x32'));}};Fax[_0xd92e('0x20')][_0xd92e('0x1c')]=function(_0x332822){var _0x5d3389=this;if(this[_0xd92e('0xe')][_0x332822[_0xd92e('0x27')]]){var _0x989d9d=this[_0xd92e('0xe')][_0x332822[_0xd92e('0x27')]]['id'];this[_0xd92e('0xe')][_0x332822[_0xd92e('0x27')]]['remotestationid']=_0x332822['remotestationid'];this[_0xd92e('0xe')][_0x332822[_0xd92e('0x27')]][_0xd92e('0x33')]=_0x332822[_0xd92e('0x33')];this[_0xd92e('0xe')][_0x332822['uniqueid']][_0xd92e('0x25')]=_0x332822['localstationid'];this[_0xd92e('0xe')][_0x332822['uniqueid']]['resolution']=_0x332822[_0xd92e('0x34')];this['channels'][_0x332822['uniqueid']][_0xd92e('0x35')]=_0x332822[_0xd92e('0x35')];this['channels'][_0x332822[_0xd92e('0x27')]]['filename']=_0x332822[_0xd92e('0x31')];this[_0xd92e('0xe')][_0x332822[_0xd92e('0x27')]][_0xd92e('0x36')]=_0x332822['calleridnum'];if(this['channels'][_0x332822[_0xd92e('0x27')]][_0xd92e('0x33')]>0x0){tiff2pdf(_0x332822[_0xd92e('0x31')],_0xd92e('0x37'),function(_0x534923){logger[_0xd92e('0x2a')](_0x332822[_0xd92e('0x27')],_0xd92e('0x38'),_0x534923[_0xd92e('0x39')]);attachment[_0xd92e('0x3a')]({'name':path[_0xd92e('0x3b')](_0x332822['filename'])[_0xd92e('0x28')],'basename':path[_0xd92e('0x3b')](_0x332822['filename'])[_0xd92e('0x28')]+_0xd92e('0x3c'),'type':_0xd92e('0x3d')})[_0xd92e('0x3e')](function(_0x193874){faxAccount[_0xd92e('0x3f')](_0x989d9d,{'from':_0x332822[_0xd92e('0x36')],'mapKey':_0xd92e('0x40'),'body':path[_0xd92e('0x3b')](_0x332822['filename'])[_0xd92e('0x28')]+_0xd92e('0x3c'),'AttachmentId':_0x193874['id']})[_0xd92e('0x41')](function(_0x130820){logger[_0xd92e('0x42')](_0x332822[_0xd92e('0x27')],'\x20notify\x20',JSON['stringify'](_0x130820));});})[_0xd92e('0x41')](function(_0x2bbdf6){logger[_0xd92e('0x42')](_0x332822[_0xd92e('0x27')],_0xd92e('0x43'),JSON[_0xd92e('0x44')](_0x2bbdf6));});});}logger[_0xd92e('0x2a')](_0x332822[_0xd92e('0x27')],_0xd92e('0x43'));}};Fax[_0xd92e('0x20')][_0xd92e('0x1f')]=function(_0xde2b4f){if(this[_0xd92e('0x11')][_0xde2b4f['uniqueid']]){_[_0xd92e('0x45')](this[_0xd92e('0xe')][_0xde2b4f[_0xd92e('0x27')]],_[_0xd92e('0x46')](_0xde2b4f,[_0xd92e('0x47'),_0xd92e('0x48')]));}};function updateStatus(_0x2226c7){if(_0x2226c7[_0xd92e('0x49')]){faxMessage[_0xd92e('0x4a')](_0x2226c7[_0xd92e('0x49')],{'failMessage':_0xd92e('0x4b')})['then'](function(_0x587da0){ut['logger'](_0xd92e('0x4c'),_0x587da0);})[_0xd92e('0x41')](function(_0x5e0bd5){ut[_0xd92e('0x4d')](_0xd92e('0x4e'),_0x5e0bd5);});}else{ut[_0xd92e('0x4d')](_0xd92e('0x4f'));}}Fax[_0xd92e('0x20')][_0xd92e('0x50')]=function(_0x491a44,_0x2bde6f,_0x5d481e){var _0x2d05d2=this;var _0x142075={};if(_0x2bde6f){_0x142075={'read':_0x2bde6f};}else{_0x142075={'failMessage':_0x5d481e};}if(this[_0xd92e('0x11')][_0x491a44]['AttachmentId']){faxMessage[_0xd92e('0x4a')](this[_0xd92e('0x11')][_0x491a44][_0xd92e('0x49')],_0x142075)['then'](function(_0xdc4a01){ut[_0xd92e('0x4d')](_0xd92e('0x51'),_0xdc4a01);})[_0xd92e('0x41')](function(_0xe9798c){ut[_0xd92e('0x4d')](_0xd92e('0x52'),_0xe9798c);})[_0xd92e('0x53')](function(){delete _0x2d05d2[_0xd92e('0xe')][_0x491a44];delete _0x2d05d2['actions'][_0x491a44];});}else{ut[_0xd92e('0x4d')](_0xd92e('0x54'));delete this[_0xd92e('0xe')][_0x491a44];delete this[_0xd92e('0x11')][_0x491a44];}};Fax[_0xd92e('0x20')]['syncHangup']=function(_0x234131){var _0x2cf6f3=this;if(this['channels'][_0x234131[_0xd92e('0x27')]]){if(this[_0xd92e('0x11')][_0x234131['uniqueid']]){this[_0xd92e('0xe')][_0x234131[_0xd92e('0x27')]]['id']=this[_0xd92e('0x11')][_0x234131[_0xd92e('0x27')]]['id'];this[_0xd92e('0xe')][_0x234131[_0xd92e('0x27')]][_0xd92e('0x28')]=this[_0xd92e('0x11')][_0x234131['uniqueid']][_0xd92e('0x28')];}logger[_0xd92e('0x2a')](_0x234131[_0xd92e('0x27')],this[_0xd92e('0x11')][_0x234131['uniqueid']]?_0xd92e('0x55'):_0xd92e('0x56'),JSON[_0xd92e('0x44')](this['channels'][_0x234131['uniqueid']]));if(this[_0xd92e('0x11')][_0x234131['uniqueid']]){if(this[_0xd92e('0xe')][_0x234131[_0xd92e('0x27')]][_0xd92e('0x57')]>0x0&&this[_0xd92e('0xe')][_0x234131[_0xd92e('0x27')]]['faxstatus']==='SUCCESS'){this[_0xd92e('0x50')](_0x234131[_0xd92e('0x27')],!![]);}else{this['updateStatus'](_0x234131[_0xd92e('0x27')],![],this[_0xd92e('0xe')][_0x234131['uniqueid']][_0xd92e('0x58')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x234131[_0xd92e('0x27')]]['faxstatusstring']:_0xd92e('0x59'));}}}};Fax[_0xd92e('0x20')][_0xd92e('0x5a')]=function(_0x426b69){var _0x1fb440=this;return new BPromise(function(_0x347f7c,_0x196470){_0x1fb440[_0xd92e('0x5b')](_0x426b69,_0x1fb440[_0xd92e('0xf')][_0x426b69[_0xd92e('0x5c')]])[_0xd92e('0x3e')](function(_0x2d13c9){ut[_0xd92e('0x4d')](_0xd92e('0x5d'),_0x2d13c9);_0x347f7c(ut[_0xd92e('0x39')]('Fax\x20received'));})['catch'](function(_0xf2e1c6){ut['logger'](_0xd92e('0x5e'),_0xf2e1c6);updateStatus(_0x426b69);_0x196470(ut[_0xd92e('0x39')](_0xd92e('0x5f')));});});};Fax[_0xd92e('0x20')]['checkAfterSend']=function(_0x2303db){var _0x3cddde=this;return new BPromise(function(_0x880812,_0x2dfe6d){var _0x9bb3c8=_0x3cddde[_0xd92e('0x60')](_0x3cddde[_0xd92e('0xf')][_0x2303db[_0xd92e('0x5c')]][_0xd92e('0x61')],_0x2303db);if(_0x9bb3c8[_0xd92e('0x62')]){_0x880812(ut[_0xd92e('0x39')](_0xd92e('0x63')));}else{_0x2dfe6d(ut[_0xd92e('0x39')](_0x9bb3c8[_0xd92e('0x39')]));}});};function originate(_0x4a62e7,_0x42b67d,_0x2a03bc){return new BPromise(function(_0xc752ee,_0x3e4d6a){if(_0x2a03bc){var _0x571311=util['format'](_0xd92e('0x64'),path[_0xd92e('0x3b')](_0x4a62e7[_0xd92e('0x5')])[_0xd92e('0x28')],_0x4a62e7[_0xd92e('0x5')]);gs[_0xd92e('0x65')](_0x571311)[_0xd92e('0x3e')](function(){_0x4a62e7[_0xd92e('0x5')]=util[_0xd92e('0x66')]('%s/%s.tif',path[_0xd92e('0x3b')](_0x4a62e7[_0xd92e('0x5')])[_0xd92e('0x67')],path[_0xd92e('0x3b')](_0x4a62e7[_0xd92e('0x5')])[_0xd92e('0x28')]);_0x42b67d[_0xd92e('0x68')]=_0x4a62e7['path'];ut[_0xd92e('0x4d')](_0xd92e('0x69'),'');ami[_0xd92e('0x6a')](ut[_0xd92e('0x6b')](_0x4a62e7,_0x42b67d))[_0xd92e('0x3e')](function(_0x375c2e){_0xc752ee(_0x375c2e);})[_0xd92e('0x41')](function(_0x3ee427){_0x3e4d6a(_0x3ee427);});})[_0xd92e('0x41')](function(_0x558a9c){_0x3e4d6a(_0x558a9c);});}else{ami[_0xd92e('0x6a')](ut['variablesAction'](_0x4a62e7,_0x42b67d))[_0xd92e('0x3e')](function(_0x38bb8f){_0xc752ee(_0x38bb8f);})[_0xd92e('0x41')](function(_0x3f7dac){_0x3e4d6a(_0x3f7dac);});}});}Fax['prototype'][_0xd92e('0x5b')]=function(_0x3f38bb,_0x481de2){var _0x308fb9=this;return new BPromise(function(_0x4d33ab,_0x3d9709){var _0x1e2b88=uuid['v4']();var _0x3458e3=ut[_0xd92e('0x6c')](_0x3f38bb,_0x481de2);_0x308fb9['actions'][_0x1e2b88]=new Action(_0x1e2b88,_0x481de2,_0x3f38bb);var _0x398b62=_0x308fb9['actions'][_0x1e2b88];if(path['parse'](_0x3f38bb[_0xd92e('0x5')])['ext']===_0xd92e('0x3c')){originate(_0x398b62,_0x3458e3,!![])[_0xd92e('0x3e')](function(_0x274b5e){_0x4d33ab(_0x274b5e);})[_0xd92e('0x41')](function(_0x3091d3){_0x3d9709(_0x3091d3);});}else{originate(_0x398b62,_0x3458e3,![])[_0xd92e('0x3e')](function(_0x47acc9){_0x4d33ab(_0x47acc9);})[_0xd92e('0x41')](function(_0x1db979){_0x3d9709(_0x1db979);});}});};Fax[_0xd92e('0x20')][_0xd92e('0x6d')]=function(_0x5850d7){return!_[_0xd92e('0x6e')](_0x5850d7)&&!_['isNil'](_0x5850d7[_0xd92e('0x28')])&&!_[_0xd92e('0x6e')](_0x5850d7['active'])&&_0x5850d7[_0xd92e('0x6f')]&&!_[_0xd92e('0x6e')](this[_0xd92e('0x10')][util[_0xd92e('0x66')](_0xd92e('0x70'),_0x5850d7[_0xd92e('0x28')])])&&!_['isNil'](this['trunks'][util['format'](_0xd92e('0x70'),_0x5850d7[_0xd92e('0x28')])][_0xd92e('0x30')])&&(this[_0xd92e('0x10')][util[_0xd92e('0x66')](_0xd92e('0x70'),_0x5850d7[_0xd92e('0x28')])][_0xd92e('0x30')]===_0xd92e('0x71')||this['trunks'][util[_0xd92e('0x66')](_0xd92e('0x70'),_0x5850d7[_0xd92e('0x28')])][_0xd92e('0x30')]==='unmonitored');};Fax['prototype'][_0xd92e('0x60')]=function(_0x483cec,_0x773826){if(!this[_0xd92e('0x6d')](_0x483cec)){ut[_0xd92e('0x4d')](_0xd92e('0x72'),_[_0xd92e('0x6e')](_0x483cec)?'':_0x483cec[_0xd92e('0x28')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xd92e('0x6e')](_0x773826['fax'])){ut[_0xd92e('0x4d')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x773826));return{'isValid':![],'message':_0xd92e('0x73')};}if(_[_0xd92e('0x6e')](_0x773826[_0xd92e('0x5')])){ut['logger'](_0xd92e('0x74'),JSON[_0xd92e('0x44')](_0x773826));return{'isValid':![],'message':_0xd92e('0x75')};}return{'isValid':!![],'message':_0xd92e('0x76')};};module[_0xd92e('0x77')]=Fax; \ No newline at end of file +var _0x92b8=['calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','syncOriginateResponse','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate'];(function(_0x507283,_0x3ee3bd){var _0x12a10d=function(_0x5bcb5f){while(--_0x5bcb5f){_0x507283['push'](_0x507283['shift']());}};_0x12a10d(++_0x3ee3bd);}(_0x92b8,0x12f));var _0x892b=function(_0x1dc088,_0x51ec10){_0x1dc088=_0x1dc088-0x0;var _0x259dd1=_0x92b8[_0x1dc088];return _0x259dd1;};'use strict';var util=require('util');var _=require(_0x892b('0x0'));var BPromise=require(_0x892b('0x1'));var uuid=require(_0x892b('0x2'));var moment=require('moment');var path=require(_0x892b('0x3'));var tiff2pdf=require(_0x892b('0x4'));var gs=require(_0x892b('0x5'));var logger=require('../../../config/logger')(_0x892b('0x6'));var ami=require('../ami');var rpcDb=require(_0x892b('0x7'));var Channel=require(_0x892b('0x8'));var ut=require(_0x892b('0x9'));var Action=require('./action');var faxAccount=require(_0x892b('0xa'));var attachment=require(_0x892b('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3a4bb2){this['channels']={};this[_0x892b('0xc')]=_0x3a4bb2[_0x892b('0xc')];this['trunks']=_0x3a4bb2[_0x892b('0xd')];this[_0x892b('0xe')]={};ami['on'](_0x892b('0xf'),this[_0x892b('0x10')][_0x892b('0x11')](this));ami['on'](_0x892b('0x12'),this[_0x892b('0x13')][_0x892b('0x11')](this));ami['on'](_0x892b('0x14'),this['syncNewState'][_0x892b('0x11')](this));ami['on'](_0x892b('0x15'),this[_0x892b('0x16')][_0x892b('0x11')](this));ami['on'](_0x892b('0x17'),this[_0x892b('0x18')][_0x892b('0x11')](this));ami['on'](_0x892b('0x19'),this['syncReceiveFax'][_0x892b('0x11')](this));ami['on']('hangup',this[_0x892b('0x1a')][_0x892b('0x11')](this));ami['on'](_0x892b('0x1b'),this['syncOriginateResponse']['bind'](this));}Fax[_0x892b('0x1c')][_0x892b('0x10')]=function(_0x454941){if(_0x454941[_0x892b('0x1d')]===_0x892b('0x1e')){for(var _0x338ab6 in this[_0x892b('0xc')]){if(this[_0x892b('0xc')][_0x892b('0x1f')](_0x338ab6)){if(_0x454941[_0x892b('0x20')]===this[_0x892b('0xc')][_0x338ab6][_0x892b('0x21')]){this[_0x892b('0x22')][_0x454941[_0x892b('0x23')]]={};this[_0x892b('0x22')][_0x454941['uniqueid']]['channel']=_0x454941['channel'];this['channels'][_0x454941[_0x892b('0x23')]]['id']=this[_0x892b('0xc')][_0x338ab6]['id'];this[_0x892b('0x22')][_0x454941[_0x892b('0x23')]][_0x892b('0x24')]=this[_0x892b('0xc')][_0x338ab6][_0x892b('0x24')];logger[_0x892b('0x25')](_0x454941[_0x892b('0x23')],_0x892b('0x26'));}}}}if(this[_0x892b('0xe')][_0x454941['uniqueid']]){this[_0x892b('0x22')][_0x454941[_0x892b('0x23')]]={};this['channels'][_0x454941[_0x892b('0x23')]][_0x892b('0x27')]=_0x454941[_0x892b('0x27')];logger[_0x892b('0x25')](_0x454941[_0x892b('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x892b('0x1c')][_0x892b('0x13')]=function(_0xb5c5d4){if(this[_0x892b('0x22')][_0xb5c5d4[_0x892b('0x23')]]){for(var _0x47b668 in _0xb5c5d4[_0x892b('0x28')]){if(_0xb5c5d4[_0x892b('0x28')][_0x892b('0x1f')](_0x47b668)){this['channels'][_0xb5c5d4[_0x892b('0x23')]][_0x47b668]=_0xb5c5d4[_0x892b('0x29')];}}}};Fax[_0x892b('0x1c')][_0x892b('0x2a')]=function(_0x20c9af){if(this['channels'][_0x20c9af[_0x892b('0x23')]]){this[_0x892b('0x22')][_0x20c9af[_0x892b('0x23')]][_0x892b('0x2b')]=_0x20c9af[_0x892b('0x2b')];this[_0x892b('0x22')][_0x20c9af[_0x892b('0x23')]][_0x892b('0x2c')]=_0x20c9af[_0x892b('0x2c')];}};Fax[_0x892b('0x1c')][_0x892b('0x16')]=function(_0x4042c3){if(this[_0x892b('0x22')][_0x4042c3['uniqueid']]){for(var _0x56a4a6 in _0x4042c3['variable']){if(_0x4042c3[_0x892b('0x28')][_0x892b('0x1f')](_0x56a4a6)){this[_0x892b('0x22')][_0x4042c3[_0x892b('0x23')]][_0x56a4a6]=_0x4042c3[_0x892b('0x29')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x2d0d56){if(this[_0x892b('0x22')][_0x2d0d56['uniqueid']]){this['channels'][_0x2d0d56[_0x892b('0x23')]][_0x892b('0x2d')]=_0x2d0d56['operation'];this[_0x892b('0x22')][_0x2d0d56['uniqueid']][_0x892b('0x2e')]=_0x2d0d56['status'];this[_0x892b('0x22')][_0x2d0d56['uniqueid']][_0x892b('0x21')]=_0x2d0d56['localstationid'];this[_0x892b('0x22')][_0x2d0d56[_0x892b('0x23')]]['filename']=_0x2d0d56[_0x892b('0x2f')];logger['info'](_0x2d0d56['uniqueid'],_0x892b('0x30'));}};Fax[_0x892b('0x1c')][_0x892b('0x31')]=function(_0x286708){var _0x1ffdd7=this;if(this['channels'][_0x286708[_0x892b('0x23')]]){var _0x47d974=this['channels'][_0x286708[_0x892b('0x23')]]['id'];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x32')]=_0x286708[_0x892b('0x32')];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x33')]=_0x286708[_0x892b('0x33')];this['channels'][_0x286708[_0x892b('0x23')]]['localstationid']=_0x286708[_0x892b('0x21')];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x34')]=_0x286708[_0x892b('0x34')];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x35')]=_0x286708[_0x892b('0x35')];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x2f')]=_0x286708['filename'];this[_0x892b('0x22')][_0x286708[_0x892b('0x23')]][_0x892b('0x36')]=_0x286708[_0x892b('0x36')];if(this['channels'][_0x286708[_0x892b('0x23')]][_0x892b('0x33')]>0x0){tiff2pdf(_0x286708[_0x892b('0x2f')],_0x892b('0x37'),function(_0x1ca845){logger['info'](_0x286708['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x1ca845[_0x892b('0x38')]);attachment[_0x892b('0x39')]({'name':path[_0x892b('0x3a')](_0x286708[_0x892b('0x2f')])['name'],'basename':path[_0x892b('0x3a')](_0x286708[_0x892b('0x2f')])['name']+_0x892b('0x3b'),'type':_0x892b('0x3c')})[_0x892b('0x3d')](function(_0xa80d85){faxAccount[_0x892b('0x3e')](_0x47d974,{'from':_0x286708[_0x892b('0x36')],'mapKey':'fax','body':path[_0x892b('0x3a')](_0x286708['filename'])[_0x892b('0x24')]+_0x892b('0x3b'),'AttachmentId':_0xa80d85['id']})[_0x892b('0x3f')](function(_0xdb981e){logger['error'](_0x286708[_0x892b('0x23')],_0x892b('0x40'),JSON['stringify'](_0xdb981e));});})['catch'](function(_0x47b942){logger[_0x892b('0x41')](_0x286708[_0x892b('0x23')],_0x892b('0x42'),JSON[_0x892b('0x43')](_0x47b942));});});}logger[_0x892b('0x25')](_0x286708['uniqueid'],_0x892b('0x42'));}};Fax[_0x892b('0x1c')][_0x892b('0x44')]=function(_0xbb2b2){if(this['actions'][_0xbb2b2['uniqueid']]){_['merge'](this[_0x892b('0x22')][_0xbb2b2[_0x892b('0x23')]],_['pick'](_0xbb2b2,[_0x892b('0x45'),_0x892b('0x46')]));}};function updateStatus(_0x8f75eb){if(_0x8f75eb[_0x892b('0x47')]){faxMessage[_0x892b('0x48')](_0x8f75eb['AttachmentId'],{'failMessage':_0x892b('0x49')})['then'](function(_0x56b297){ut[_0x892b('0x4a')](_0x892b('0x4b'),_0x56b297);})[_0x892b('0x3f')](function(_0x3e599f){ut['logger'](_0x892b('0x4c'),_0x3e599f);});}else{ut[_0x892b('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype']['updateStatus']=function(_0xa865ce,_0x3c42c9,_0x25d366){var _0x50abce=this;var _0x12a9cf={};if(_0x3c42c9){_0x12a9cf={'read':_0x3c42c9};}else{_0x12a9cf={'failMessage':_0x25d366};}if(this[_0x892b('0xe')][_0xa865ce]['AttachmentId']){faxMessage[_0x892b('0x48')](this[_0x892b('0xe')][_0xa865ce]['AttachmentId'],_0x12a9cf)[_0x892b('0x3d')](function(_0x2879f3){ut['logger'](_0x892b('0x4d'),_0x2879f3);})[_0x892b('0x3f')](function(_0x4c3324){ut[_0x892b('0x4a')]('[Fax][Message][NoUpdate1]',_0x4c3324);})[_0x892b('0x4e')](function(){delete _0x50abce[_0x892b('0x22')][_0xa865ce];delete _0x50abce['actions'][_0xa865ce];});}else{ut['logger'](_0x892b('0x4f'));delete this[_0x892b('0x22')][_0xa865ce];delete this[_0x892b('0xe')][_0xa865ce];}};Fax[_0x892b('0x1c')][_0x892b('0x1a')]=function(_0x59e724){var _0x5dac68=this;if(this['channels'][_0x59e724['uniqueid']]){if(this[_0x892b('0xe')][_0x59e724[_0x892b('0x23')]]){this[_0x892b('0x22')][_0x59e724['uniqueid']]['id']=this[_0x892b('0xe')][_0x59e724['uniqueid']]['id'];this[_0x892b('0x22')][_0x59e724[_0x892b('0x23')]]['name']=this['actions'][_0x59e724['uniqueid']][_0x892b('0x24')];}logger['info'](_0x59e724[_0x892b('0x23')],this[_0x892b('0xe')][_0x59e724[_0x892b('0x23')]]?_0x892b('0x50'):_0x892b('0x51'),JSON[_0x892b('0x43')](this['channels'][_0x59e724[_0x892b('0x23')]]));if(this[_0x892b('0xe')][_0x59e724[_0x892b('0x23')]]){if(this[_0x892b('0x22')][_0x59e724[_0x892b('0x23')]][_0x892b('0x52')]>0x0&&this['channels'][_0x59e724[_0x892b('0x23')]][_0x892b('0x17')]===_0x892b('0x53')){this['updateStatus'](_0x59e724['uniqueid'],!![]);}else{this['updateStatus'](_0x59e724[_0x892b('0x23')],![],this[_0x892b('0x22')][_0x59e724[_0x892b('0x23')]]['faxstatusstring']?_0x892b('0x54')+this['channels'][_0x59e724[_0x892b('0x23')]][_0x892b('0x55')]:_0x892b('0x56'));}}}};Fax['prototype']['send']=function(_0x389811){var _0x1329b3=this;return new BPromise(function(_0x534db0,_0x483fdd){_0x1329b3[_0x892b('0x57')](_0x389811,_0x1329b3[_0x892b('0xc')][_0x389811[_0x892b('0x58')]])[_0x892b('0x3d')](function(_0x274215){ut['logger'](_0x892b('0x59'),_0x274215);_0x534db0(ut[_0x892b('0x38')](_0x892b('0x5a')));})[_0x892b('0x3f')](function(_0x184c52){ut[_0x892b('0x4a')](_0x892b('0x5b'),_0x184c52);updateStatus(_0x389811);_0x483fdd(ut[_0x892b('0x38')](_0x892b('0x5c')));});});};Fax[_0x892b('0x1c')][_0x892b('0x5d')]=function(_0x1df09a){var _0x4c50a7=this;return new BPromise(function(_0x204e45,_0x2dcc7f){var _0x140f0e=_0x4c50a7['checkTrunk'](_0x4c50a7[_0x892b('0xc')][_0x1df09a[_0x892b('0x58')]][_0x892b('0x5e')],_0x1df09a);if(_0x140f0e[_0x892b('0x5f')]){_0x204e45(ut[_0x892b('0x38')](_0x892b('0x60')));}else{_0x2dcc7f(ut[_0x892b('0x38')](_0x140f0e[_0x892b('0x38')]));}});};function originate(_0x3f9154,_0x23df30,_0x391ae8){return new BPromise(function(_0x5a6afa,_0x57da64){if(_0x391ae8){var _0x20c3eb=util[_0x892b('0x61')](_0x892b('0x62'),path[_0x892b('0x3a')](_0x3f9154[_0x892b('0x3')])['name'],_0x3f9154[_0x892b('0x3')]);gs[_0x892b('0x63')](_0x20c3eb)[_0x892b('0x3d')](function(){_0x3f9154[_0x892b('0x3')]=util[_0x892b('0x61')]('%s/%s.tif',path['parse'](_0x3f9154[_0x892b('0x3')])[_0x892b('0x64')],path[_0x892b('0x3a')](_0x3f9154[_0x892b('0x3')])[_0x892b('0x24')]);_0x23df30[_0x892b('0x65')]=_0x3f9154[_0x892b('0x3')];ut['logger'](_0x892b('0x66'),'');ami[_0x892b('0x67')](ut[_0x892b('0x68')](_0x3f9154,_0x23df30))[_0x892b('0x3d')](function(_0x338b70){_0x5a6afa(_0x338b70);})['catch'](function(_0x4a5376){_0x57da64(_0x4a5376);});})[_0x892b('0x3f')](function(_0x399428){_0x57da64(_0x399428);});}else{ami['Action'](ut['variablesAction'](_0x3f9154,_0x23df30))['then'](function(_0x19e69c){_0x5a6afa(_0x19e69c);})['catch'](function(_0x5775d6){_0x57da64(_0x5775d6);});}});}Fax['prototype'][_0x892b('0x57')]=function(_0xf5e321,_0xeb282){var _0x39697b=this;return new BPromise(function(_0x4c1049,_0x8b3e92){var _0x48adb8=uuid['v4']();var _0x4b93ae=ut[_0x892b('0x69')](_0xf5e321,_0xeb282);_0x39697b[_0x892b('0xe')][_0x48adb8]=new Action(_0x48adb8,_0xeb282,_0xf5e321);var _0x2d3569=_0x39697b['actions'][_0x48adb8];if(path['parse'](_0xf5e321['path'])[_0x892b('0x6a')]==='.pdf'){originate(_0x2d3569,_0x4b93ae,!![])[_0x892b('0x3d')](function(_0x831f8e){_0x4c1049(_0x831f8e);})['catch'](function(_0x1edb2c){_0x8b3e92(_0x1edb2c);});}else{originate(_0x2d3569,_0x4b93ae,![])['then'](function(_0x5f26d2){_0x4c1049(_0x5f26d2);})[_0x892b('0x3f')](function(_0x3ba22c){_0x8b3e92(_0x3ba22c);});}});};Fax[_0x892b('0x1c')]['isTrunkReachable']=function(_0x4960ff){return!_['isNil'](_0x4960ff)&&!_[_0x892b('0x6b')](_0x4960ff[_0x892b('0x24')])&&!_['isNil'](_0x4960ff[_0x892b('0x6c')])&&_0x4960ff['active']&&!_[_0x892b('0x6b')](this['trunks'][util['format'](_0x892b('0x6d'),_0x4960ff['name'])])&&!_[_0x892b('0x6b')](this[_0x892b('0xd')][util['format'](_0x892b('0x6d'),_0x4960ff['name'])][_0x892b('0x2e')])&&(this[_0x892b('0xd')][util[_0x892b('0x61')](_0x892b('0x6d'),_0x4960ff[_0x892b('0x24')])][_0x892b('0x2e')]===_0x892b('0x6e')||this['trunks'][util[_0x892b('0x61')](_0x892b('0x6d'),_0x4960ff[_0x892b('0x24')])]['status']===_0x892b('0x6f'));};Fax[_0x892b('0x1c')][_0x892b('0x70')]=function(_0x4d41,_0x11663e){if(!this['isTrunkReachable'](_0x4d41)){ut[_0x892b('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x892b('0x6b')](_0x4d41)?'':_0x4d41[_0x892b('0x24')]+_0x892b('0x71'));return{'isValid':![],'message':_0x892b('0x72')};}if(_[_0x892b('0x6b')](_0x11663e['fax'])){ut[_0x892b('0x4a')](_0x892b('0x73'),JSON[_0x892b('0x43')](_0x11663e));return{'isValid':![],'message':_0x892b('0x74')};}if(_[_0x892b('0x6b')](_0x11663e[_0x892b('0x3')])){ut[_0x892b('0x4a')](_0x892b('0x75'),JSON[_0x892b('0x43')](_0x11663e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x892b('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f2e7d92..8c0d57a 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 _0x1fd8=['../rpc/faxAccount','error','notify','resolve','then','catch','preview','lodash'];(function(_0x2cddb1,_0x523c57){var _0x3f0ca7=function(_0x32968a){while(--_0x32968a){_0x2cddb1['push'](_0x2cddb1['shift']());}};_0x3f0ca7(++_0x523c57);}(_0x1fd8,0x13e));var _0x81fd=function(_0x57307a,_0x9de85c){_0x57307a=_0x57307a-0x0;var _0xbce01a=_0x1fd8[_0x57307a];return _0xbce01a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x81fd('0x0'));var _=require(_0x81fd('0x1'));var faxAccount=require(_0x81fd('0x2'));function loggerCatch(_0x844a92){return function(_0x2717d9){logger[_0x81fd('0x3')](_0x844a92,util['inspect'](_0x2717d9,{'showHidden':![],'depth':null}));};}exports[_0x81fd('0x4')]=function(_0x5731d8,_0x1c6e74){return BPromise[_0x81fd('0x5')]()[_0x81fd('0x6')](faxAccount['notify'](_0x5731d8,_0x1c6e74))[_0x81fd('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xb03a=['preview','lodash','../rpc/faxAccount','inspect','notify','resolve','[Notify]\x20','../../../config/logger'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0xb03a,0x167));var _0xab03=function(_0x48885b,_0x179607){_0x48885b=_0x48885b-0x0;var _0x4e5405=_0xb03a[_0x48885b];return _0x4e5405;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xab03('0x0'))(_0xab03('0x1'));var _=require(_0xab03('0x2'));var faxAccount=require(_0xab03('0x3'));function loggerCatch(_0x5c45df){return function(_0x5a8e03){logger['error'](_0x5c45df,util[_0xab03('0x4')](_0x5a8e03,{'showHidden':![],'depth':null}));};}exports[_0xab03('0x5')]=function(_0x21c99b,_0xa103ab){return BPromise[_0xab03('0x6')]()['then'](faxAccount[_0xab03('0x5')](_0x21c99b,_0xa103ab))['catch'](loggerCatch(_0xab03('0x7')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c21f582..fc92fa7 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 _0x5916=['info','Exec\x20gs','inspect','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x4105b2,_0x268009){var _0x5051e3=function(_0x45c491){while(--_0x45c491){_0x4105b2['push'](_0x4105b2['shift']());}};_0x5051e3(++_0x268009);}(_0x5916,0x1b3));var _0x6591=function(_0x240733,_0x48ca63){_0x240733=_0x240733-0x0;var _0x122cb9=_0x5916[_0x240733];return _0x122cb9;};'use strict';var util=require('util');var logger=require(_0x6591('0x0'))(_0x6591('0x1'));var BPromise=require(_0x6591('0x2'));var exec=require(_0x6591('0x3'))[_0x6591('0x4')];exports[_0x6591('0x5')]=function(_0x1fc3f8){return new BPromise(function(_0x5eef1e,_0x18d1b6){exec(_0x1fc3f8,function(_0x272bd6,_0x543c7f,_0x107af0){logger[_0x6591('0x6')](_0x6591('0x7'),_0x543c7f);if(_0x272bd6){logger[_0x6591('0x6')]('Exec\x20gs','\x20Error\x20:',util[_0x6591('0x8')](_0x272bd6,{'showHidden':![],'depth':null}),_0x543c7f,_0x107af0);_0x18d1b6(_0x272bd6);}_0x5eef1e(_0x543c7f);});});}; \ No newline at end of file +var _0x1692=['bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0x1692,0xf7));var _0x2169=function(_0x58f6d0,_0x1ce528){_0x58f6d0=_0x58f6d0-0x0;var _0x120ffa=_0x1692[_0x58f6d0];return _0x120ffa;};'use strict';var util=require(_0x2169('0x0'));var logger=require(_0x2169('0x1'))(_0x2169('0x2'));var BPromise=require(_0x2169('0x3'));var exec=require(_0x2169('0x4'))['exec'];exports[_0x2169('0x5')]=function(_0x28a6de){return new BPromise(function(_0x291cf3,_0x5b432c){exec(_0x28a6de,function(_0x2fdc1d,_0x136f29,_0x258f34){logger[_0x2169('0x6')]('Exec\x20gs',_0x136f29);if(_0x2fdc1d){logger['info'](_0x2169('0x7'),_0x2169('0x8'),util[_0x2169('0x9')](_0x2fdc1d,{'showHidden':![],'depth':null}),_0x136f29,_0x258f34);_0x5b432c(_0x2fdc1d);}_0x291cf3(_0x136f29);});});}; \ 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 37720fd..9bfc3bd 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 _0x541d=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message','logger','info'];(function(_0x51aa7b,_0x248830){var _0x37d2fc=function(_0x435f12){while(--_0x435f12){_0x51aa7b['push'](_0x51aa7b['shift']());}};_0x37d2fc(++_0x248830);}(_0x541d,0x1cd));var _0xd541=function(_0x228d65,_0x379f6f){_0x228d65=_0x228d65-0x0;var _0x39b130=_0x541d[_0x228d65];return _0x39b130;};'use strict';var util=require(_0xd541('0x0'));var _=require(_0xd541('0x1'));var moment=require('moment');var logger=require(_0xd541('0x2'))(_0xd541('0x3'));exports[_0xd541('0x4')]=function(_0x227561){return{'message':_0x227561};};exports[_0xd541('0x5')]=function(_0x12c20c,_0x484de1){logger[_0xd541('0x6')](_0x12c20c,util[_0xd541('0x7')](_0x484de1,{'showHidden':![],'depth':null}));};exports[_0xd541('0x8')]=function(_0x567633,_0x15e4fa){var _0x5c6f5f={'XMF-ECM':_0x15e4fa[_0xd541('0x9')],'XMF-HEADERINFO':_0x15e4fa[_0xd541('0xa')],'XMF-MINRATE':_0x15e4fa[_0xd541('0xb')],'XMF-MAXRATE':_0x15e4fa[_0xd541('0xc')],'XMF-MODEM':util[_0xd541('0xd')](_0xd541('0xe'),_0x15e4fa[_0xd541('0xf')]),'XMF-GATEWAY':_0x15e4fa[_0xd541('0x10')],'XMF-FAXDETECT':_0x15e4fa[_0xd541('0x11')],'XMF-T38TIMEOUT':_0x15e4fa[_0xd541('0x12')],'XMF-LOCALSTATIONID':_0x15e4fa[_0xd541('0x13')],'XMF-PATH':_0x567633[_0xd541('0x14')]};return _0x5c6f5f;};exports['variablesAction']=function(_0xd98610,_0x2241df){return{'actionid':_0xd98610[_0xd541('0x15')],'action':_0xd541('0x16'),'channel':_0xd98610[_0xd541('0x17')],'Exten':_0xd541('0x18'),'Context':'from-sip','Priority':'1','callerid':util[_0xd541('0xd')](_0xd541('0x19'),_0xd98610[_0xd541('0xa')]?_0xd98610[_0xd541('0xa')]:'',_0xd98610[_0xd541('0x13')]),'variable':_0x2241df,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xd98610['uniqueid']};}; \ No newline at end of file +var _0x2997=['ecm','headerinfo','minrate','format','\x22%s\x22','gateway','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','message','logger','inspect','addVariables'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x2997,0x1db));var _0x7299=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x2997[_0x3b3210];return _0x5b5484;};'use strict';var util=require(_0x7299('0x0'));var _=require(_0x7299('0x1'));var moment=require(_0x7299('0x2'));var logger=require(_0x7299('0x3'))('fax');exports[_0x7299('0x4')]=function(_0x30d0c1){return{'message':_0x30d0c1};};exports[_0x7299('0x5')]=function(_0x55fa47,_0x2a7f1c){logger['info'](_0x55fa47,util[_0x7299('0x6')](_0x2a7f1c,{'showHidden':![],'depth':null}));};exports[_0x7299('0x7')]=function(_0x45fa94,_0x51cb18){var _0x259b6f={'XMF-ECM':_0x51cb18[_0x7299('0x8')],'XMF-HEADERINFO':_0x51cb18[_0x7299('0x9')],'XMF-MINRATE':_0x51cb18[_0x7299('0xa')],'XMF-MAXRATE':_0x51cb18['maxrate'],'XMF-MODEM':util[_0x7299('0xb')](_0x7299('0xc'),_0x51cb18['modem']),'XMF-GATEWAY':_0x51cb18[_0x7299('0xd')],'XMF-FAXDETECT':_0x51cb18['faxdetect'],'XMF-T38TIMEOUT':_0x51cb18[_0x7299('0xe')],'XMF-LOCALSTATIONID':_0x51cb18[_0x7299('0xf')],'XMF-PATH':_0x45fa94[_0x7299('0x10')]};return _0x259b6f;};exports['variablesAction']=function(_0x1965f3,_0x1a934c){return{'actionid':_0x1965f3['uniqueid'],'action':_0x7299('0x11'),'channel':_0x1965f3[_0x7299('0x12')],'Exten':_0x7299('0x13'),'Context':_0x7299('0x14'),'Priority':'1','callerid':util[_0x7299('0xb')](_0x7299('0x15'),_0x1965f3['headerinfo']?_0x1965f3[_0x7299('0x9')]:'',_0x1965f3[_0x7299('0xf')]),'variable':_0x1a934c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1965f3[_0x7299('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bd9ec35..d3e9042 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 _0xbb7b=['initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','sync','catch','[index.js][main]','util','moment','./realtime','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns'];(function(_0x38075c,_0x37aa05){var _0xbac926=function(_0xd108ef){while(--_0xd108ef){_0x38075c['push'](_0x38075c['shift']());}};_0xbac926(++_0x37aa05);}(_0xbb7b,0x17f));var _0xbbb7=function(_0x5c115c,_0x1f1c23){_0x5c115c=_0x5c115c-0x0;var _0x4fd5f5=_0xbb7b[_0x5c115c];return _0x4fd5f5;};'use strict';var util=require(_0xbbb7('0x0'));var moment=require(_0xbbb7('0x1'));var server=require('./server');var Realtime=require(_0xbbb7('0x2'));var Report=require('./report');var Acw=require(_0xbbb7('0x3'));var Trigger=require(_0xbbb7('0x4'));var Dialer=require(_0xbbb7('0x5'));var Preview=require('./preview');var Fax=require(_0xbbb7('0x6'));var user=require(_0xbbb7('0x7'));var voiceQueue=require(_0xbbb7('0x8'));var voiceQueueReport=require(_0xbbb7('0x9'));var voiceCallReport=require(_0xbbb7('0xa'));var trunk=require(_0xbbb7('0xb'));var trigger=require(_0xbbb7('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0xbbb7('0xd'));var campaign=require(_0xbbb7('0xe'));var voiceExtension=require(_0xbbb7('0xf'));var faxAccount=require(_0xbbb7('0x10'));var zendesk=require(_0xbbb7('0x11'));var salesforce=require(_0xbbb7('0x12'));var sugarcrm=require(_0xbbb7('0x13'));var freshdesk=require(_0xbbb7('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xbbb7('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xbbb7('0x16'));var servicenow=require('./rpc/integrations/servicenow');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(_0xbbb7('0x17'))(_0xbbb7('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbbb7('0x19')](_0xbbb7('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbbb7('0x19')](_0xbbb7('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xbbb7('0x1b')](user[_0xbbb7('0x1c')]())['then'](realtime[_0xbbb7('0x1d')]())[_0xbbb7('0x1b')](user['getTelephones']())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x1e')]())[_0xbbb7('0x1b')](trunk['getTrunks']())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x1f')]())[_0xbbb7('0x1b')](voiceQueue[_0xbbb7('0x20')]())['then'](realtime[_0xbbb7('0x21')]())[_0xbbb7('0x1b')](trigger[_0xbbb7('0x22')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x23')]())[_0xbbb7('0x1b')](template[_0xbbb7('0x24')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x25')]())['then'](zendesk[_0xbbb7('0x26')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x27')]())[_0xbbb7('0x1b')](salesforce['getSalesforceAccounts']())[_0xbbb7('0x1b')](realtime['initSalesforceAccounts']())[_0xbbb7('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x28')]())[_0xbbb7('0x1b')](freshdesk[_0xbbb7('0x29')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x2a')]())['then'](desk[_0xbbb7('0x2b')]())['then'](realtime[_0xbbb7('0x2c')]())[_0xbbb7('0x1b')](zoho['getZohoAccounts']())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x2d')]())[_0xbbb7('0x1b')](vtiger[_0xbbb7('0x2e')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x2f')]())[_0xbbb7('0x1b')](freshsales[_0xbbb7('0x30')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x31')]())[_0xbbb7('0x1b')](servicenow[_0xbbb7('0x32')]())['then'](realtime[_0xbbb7('0x33')]())[_0xbbb7('0x1b')](dynamics365[_0xbbb7('0x34')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x35')]())[_0xbbb7('0x1b')](campaign[_0xbbb7('0x36')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x37')]())['then'](voiceExtension[_0xbbb7('0x38')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x39')]())[_0xbbb7('0x1b')](faxAccount[_0xbbb7('0x3a')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x3b')]())[_0xbbb7('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0xbbb7('0x3c')]()[_0xbbb7('0x1b')](voiceQueueReport[_0xbbb7('0x3d')]())[_0xbbb7('0x1b')](realtime['initVoiceQueueReports']())[_0xbbb7('0x1b')](cmHopperHistory[_0xbbb7('0x3e')]())[_0xbbb7('0x1b')](realtime['initVoiceQueueHopperHistory']())[_0xbbb7('0x1b')](cmHopperHistory[_0xbbb7('0x3f')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x40')]())['then'](voiceCallReport[_0xbbb7('0x41')]())[_0xbbb7('0x1b')](realtime[_0xbbb7('0x42')]())['catch'](function(_0x3aa68e){logger[_0xbbb7('0x43')](_0xbbb7('0x44'),util[_0xbbb7('0x45')](_0x3aa68e,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xbbb7('0x1b')](function(){return initRealtime();})[_0xbbb7('0x1b')](function(){return initParams();})[_0xbbb7('0x1b')](function(){report[_0xbbb7('0x46')]();setInterval(initRealtime,0x1388);})[_0xbbb7('0x47')](function(_0x4553d5){logger[_0xbbb7('0x43')](_0xbbb7('0x48'),util[_0xbbb7('0x45')](_0x4553d5,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0be5=['initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x4cd5c7,_0x346407){var _0x48a61d=function(_0x4466d0){while(--_0x4466d0){_0x4cd5c7['push'](_0x4cd5c7['shift']());}};_0x48a61d(++_0x346407);}(_0x0be5,0x15e));var _0x50be=function(_0x376579,_0x4a6a93){_0x376579=_0x376579-0x0;var _0x522be4=_0x0be5[_0x376579];return _0x522be4;};'use strict';var util=require(_0x50be('0x0'));var moment=require(_0x50be('0x1'));var server=require(_0x50be('0x2'));var Realtime=require(_0x50be('0x3'));var Report=require(_0x50be('0x4'));var Acw=require(_0x50be('0x5'));var Trigger=require(_0x50be('0x6'));var Dialer=require('./dialer');var Preview=require(_0x50be('0x7'));var Fax=require(_0x50be('0x8'));var user=require(_0x50be('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x50be('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x50be('0xb'));var template=require(_0x50be('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x50be('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x50be('0xe'));var salesforce=require(_0x50be('0xf'));var sugarcrm=require(_0x50be('0x10'));var freshdesk=require(_0x50be('0x11'));var desk=require(_0x50be('0x12'));var zoho=require(_0x50be('0x13'));var vtiger=require(_0x50be('0x14'));var freshsales=require(_0x50be('0x15'));var servicenow=require(_0x50be('0x16'));var dynamics365=require(_0x50be('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x50be('0x18'))(_0x50be('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x50be('0x1a')](_0x50be('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x50be('0x1a')](_0x50be('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x50be('0x1c')]()[_0x50be('0x1d')](user['getAgents']())[_0x50be('0x1d')](realtime[_0x50be('0x1e')]())[_0x50be('0x1d')](user[_0x50be('0x1f')]())[_0x50be('0x1d')](realtime[_0x50be('0x20')]())[_0x50be('0x1d')](trunk['getTrunks']())[_0x50be('0x1d')](realtime[_0x50be('0x21')]())[_0x50be('0x1d')](voiceQueue['getVoiceQueues']())[_0x50be('0x1d')](realtime['initVoiceQueues']())[_0x50be('0x1d')](trigger[_0x50be('0x22')]())[_0x50be('0x1d')](realtime['initTriggers']())[_0x50be('0x1d')](template[_0x50be('0x23')]())[_0x50be('0x1d')](realtime[_0x50be('0x24')]())[_0x50be('0x1d')](zendesk['getZendeskAccounts']())[_0x50be('0x1d')](realtime[_0x50be('0x25')]())[_0x50be('0x1d')](salesforce[_0x50be('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0x50be('0x1d')](sugarcrm[_0x50be('0x27')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk['getFreshdeskAccounts']())[_0x50be('0x1d')](realtime[_0x50be('0x28')]())[_0x50be('0x1d')](desk[_0x50be('0x29')]())[_0x50be('0x1d')](realtime[_0x50be('0x2a')]())[_0x50be('0x1d')](zoho[_0x50be('0x2b')]())[_0x50be('0x1d')](realtime[_0x50be('0x2c')]())['then'](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0x50be('0x2d')]())[_0x50be('0x1d')](realtime[_0x50be('0x2e')]())['then'](servicenow[_0x50be('0x2f')]())[_0x50be('0x1d')](realtime[_0x50be('0x30')]())['then'](dynamics365[_0x50be('0x31')]())[_0x50be('0x1d')](realtime[_0x50be('0x32')]())['then'](campaign['getCampaigns']())[_0x50be('0x1d')](realtime[_0x50be('0x33')]())[_0x50be('0x1d')](voiceExtension[_0x50be('0x34')]())[_0x50be('0x1d')](realtime[_0x50be('0x35')]())[_0x50be('0x1d')](faxAccount[_0x50be('0x36')]())[_0x50be('0x1d')](realtime[_0x50be('0x37')]())[_0x50be('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x50be('0x1c')]()[_0x50be('0x1d')](voiceQueueReport[_0x50be('0x38')]())[_0x50be('0x1d')](realtime[_0x50be('0x39')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x50be('0x1d')](realtime[_0x50be('0x3a')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x50be('0x1d')](realtime[_0x50be('0x3b')]())['then'](voiceCallReport[_0x50be('0x3c')]())[_0x50be('0x1d')](realtime[_0x50be('0x3d')]())[_0x50be('0x3e')](function(_0x7168db){logger[_0x50be('0x3f')](_0x50be('0x40'),util[_0x50be('0x41')](_0x7168db,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x50be('0x1d')](function(){return initParams();})[_0x50be('0x1d')](function(){report[_0x50be('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x5c0eb3){logger['error'](_0x50be('0x43'),util['inspect'](_0x5c0eb3,{'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 9d0e89f..4fe1cbe 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 _0x0afd=['toNumber','format','interface','onhold','stringify','user:%s','name','emit','user:ami:update','omit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','email','accountcode','fullname','state','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','statePause'];(function(_0x19ad7b,_0x2ae8fa){var _0x8a0f00=function(_0x56781d){while(--_0x56781d){_0x19ad7b['push'](_0x19ad7b['shift']());}};_0x8a0f00(++_0x2ae8fa);}(_0x0afd,0x138));var _0xd0af=function(_0x2e3df2,_0x583635){_0x2e3df2=_0x2e3df2-0x0;var _0x34c8c9=_0x0afd[_0x2e3df2];return _0x34c8c9;};'use strict';var _=require(_0xd0af('0x0'));var util=require(_0xd0af('0x1'));var moment=require(_0xd0af('0x2'));var md5=require('md5');var Redis=require(_0xd0af('0x3'));var config=require(_0xd0af('0x4'));config[_0xd0af('0x5')]=_[_0xd0af('0x6')](config['redis'],{'host':_0xd0af('0x7'),'port':0x18eb});var io=require(_0xd0af('0x8'))(new Redis(config['redis']));function Agent(_0x461be2){this['id']=_0x461be2['id']||0x0;this['name']=_0x461be2['name']||'';this[_0xd0af('0x9')]=_0x461be2[_0xd0af('0x9')]||'';this[_0xd0af('0xa')]=_0x461be2[_0xd0af('0xa')]||'';this[_0xd0af('0xb')]=_0x461be2['fullname']||'';this[_0xd0af('0xc')]=_0xd0af('0xd');this['stateTime']=0x0;this[_0xd0af('0xe')]=_0xd0af('0xd');this[_0xd0af('0xf')]='';this[_0xd0af('0x10')]='';this[_0xd0af('0x11')]='';this['interface']='';this[_0xd0af('0x12')]=_0x461be2[_0xd0af('0x12')]||![];this[_0xd0af('0x13')]=_0xd0af('0xd');this[_0xd0af('0x14')]=0x0;this[_0xd0af('0x15')]='';this[_0xd0af('0x16')]='';this['onhold']=![];this[_0xd0af('0x17')]=![];this[_0xd0af('0x18')]='';}Agent[_0xd0af('0x19')][_0xd0af('0x1a')]=function(_0x15ff91){var _0x1ee14a;if(_0x15ff91&&_0x15ff91['state']){_0x1ee14a=_0x15ff91['state']['toLowerCase']();switch(_0x1ee14a){case _0xd0af('0x1b'):_0x1ee14a=_0xd0af('0x1c');break;case _0xd0af('0x1d'):_0x1ee14a=_0xd0af('0x1e');break;}}if(_0x1ee14a&&this['voiceStatus']!==_0x1ee14a||_0x15ff91[_0xd0af('0x1f')]){this[_0xd0af('0x14')]=_[_0xd0af('0x20')](moment()[_0xd0af('0x21')]('x'));}if(_0x1ee14a){this[_0xd0af('0x13')]=_0x1ee14a;}var _0x2cefa6={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xd0af('0xa')],'fullname':this[_0xd0af('0xb')],'state':this[_0xd0af('0xc')],'stateTime':this['stateTime'],'status':this[_0xd0af('0xe')],'address':this[_0xd0af('0xf')],'online':this['online'],'voiceStatus':this[_0xd0af('0x13')],'voiceStatusTime':this[_0xd0af('0x14')],'voiceStatusCallerIdNumber':this[_0xd0af('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd0af('0x22')],'onhold':this[_0xd0af('0x23')]};var _0x1a7c0a=md5(JSON[_0xd0af('0x24')](_0x2cefa6));if(this['md5']!==_0x1a7c0a){this[_0xd0af('0x18')]=_0x1a7c0a;io['to'](util[_0xd0af('0x21')](_0xd0af('0x25'),_0x2cefa6[_0xd0af('0x26')]))[_0xd0af('0x27')](_0xd0af('0x28'),_[_0xd0af('0x29')](_0x2cefa6,[_0xd0af('0x12')]));io[_0xd0af('0x27')](_0xd0af('0x2a'),_0x2cefa6);}};module['exports']=Agent; \ No newline at end of file +var _0x628d=['../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','stateTime','voiceStatusQueue','interface','format','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5','ioredis'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x628d,0x12b));var _0xd628=function(_0x315ba1,_0x576143){_0x315ba1=_0x315ba1-0x0;var _0x1b64f6=_0x628d[_0x315ba1];return _0x1b64f6;};'use strict';var _=require(_0xd628('0x0'));var util=require(_0xd628('0x1'));var moment=require(_0xd628('0x2'));var md5=require(_0xd628('0x3'));var Redis=require(_0xd628('0x4'));var config=require(_0xd628('0x5'));config[_0xd628('0x6')]=_[_0xd628('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd628('0x6')]));function Agent(_0x4b8c64){this['id']=_0x4b8c64['id']||0x0;this[_0xd628('0x8')]=_0x4b8c64[_0xd628('0x8')]||'';this['email']=_0x4b8c64[_0xd628('0x9')]||'';this[_0xd628('0xa')]=_0x4b8c64['accountcode']||'';this[_0xd628('0xb')]=_0x4b8c64[_0xd628('0xb')]||'';this[_0xd628('0xc')]=_0xd628('0xd');this['stateTime']=0x0;this[_0xd628('0xe')]='unknown';this[_0xd628('0xf')]='';this[_0xd628('0x10')]='';this[_0xd628('0x11')]='';this['interface']='';this['online']=_0x4b8c64[_0xd628('0x12')]||![];this['voiceStatus']=_0xd628('0xd');this[_0xd628('0x13')]=0x0;this[_0xd628('0x14')]='';this['voiceStatusQueue']='';this[_0xd628('0x15')]=![];this[_0xd628('0x16')]=![];this['md5']='';}Agent[_0xd628('0x17')][_0xd628('0x18')]=function(_0x1ae8d6){var _0x4b9080;if(_0x1ae8d6&&_0x1ae8d6[_0xd628('0xc')]){_0x4b9080=_0x1ae8d6[_0xd628('0xc')][_0xd628('0x19')]();switch(_0x4b9080){case _0xd628('0x1a'):_0x4b9080='idle';break;case _0xd628('0x1b'):_0x4b9080=_0xd628('0x1c');break;}}if(_0x4b9080&&this[_0xd628('0x1d')]!==_0x4b9080||_0x1ae8d6['statePause']){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x4b9080){this[_0xd628('0x1d')]=_0x4b9080;}var _0x3e48b3={'id':this['id'],'name':this[_0xd628('0x8')],'email':this[_0xd628('0x9')],'accountcode':this[_0xd628('0xa')],'fullname':this[_0xd628('0xb')],'state':this[_0xd628('0xc')],'stateTime':this[_0xd628('0x1e')],'status':this[_0xd628('0xe')],'address':this[_0xd628('0xf')],'online':this['online'],'voiceStatus':this[_0xd628('0x1d')],'voiceStatusTime':this[_0xd628('0x13')],'voiceStatusCallerIdNumber':this[_0xd628('0x14')],'voiceStatusQueue':this[_0xd628('0x1f')],'interface':this[_0xd628('0x20')],'onhold':this[_0xd628('0x15')]};var _0x3e3628=md5(JSON['stringify'](_0x3e48b3));if(this[_0xd628('0x3')]!==_0x3e3628){this[_0xd628('0x3')]=_0x3e3628;io['to'](util[_0xd628('0x21')]('user:%s',_0x3e48b3[_0xd628('0x8')]))[_0xd628('0x22')](_0xd628('0x23'),_['omit'](_0x3e48b3,[_0xd628('0x12')]));io[_0xd628('0x22')](_0xd628('0x24'),_0x3e48b3);}};module[_0xd628('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7a932b8..048ee93 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 _0x21e5=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x468e71,_0x171468){var _0x2c9045=function(_0x3607c1){while(--_0x3607c1){_0x468e71['push'](_0x468e71['shift']());}};_0x2c9045(++_0x171468);}(_0x21e5,0x11f));var _0x521e=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x21e5[_0xf168d3];return _0x17fb54;};'use strict';function Campaign(_0x4ab677){this['id']=_0x4ab677['id']||0x0;this['name']=_0x4ab677[_0x521e('0x0')]||'';this[_0x521e('0x1')]=_0x4ab677[_0x521e('0x1')]||_0x521e('0x2');this[_0x521e('0x3')]=0x0;this[_0x521e('0x4')]=0x0;this[_0x521e('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x521e('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x521e('0x7')]=_0x4ab677[_0x521e('0x7')];this[_0x521e('0x8')]=_0x4ab677[_0x521e('0x8')];this[_0x521e('0x9')]=_0x4ab677[_0x521e('0x9')]||null;this[_0x521e('0xa')]=_0x4ab677['dialGlobalInterval']?_0x4ab677[_0x521e('0xa')]:null;this[_0x521e('0xb')]=_0x4ab677[_0x521e('0xb')];this['dialOriginateCallerIdNumber']=_0x4ab677[_0x521e('0xc')];this[_0x521e('0xd')]=_0x4ab677['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x4ab677[_0x521e('0xe')];this[_0x521e('0xf')]=_0x4ab677['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x4ab677[_0x521e('0x10')];this['dialBusyRetryFrequency']=_0x4ab677[_0x521e('0x11')];this[_0x521e('0x12')]=_0x4ab677[_0x521e('0x12')];this[_0x521e('0x13')]=_0x4ab677[_0x521e('0x13')];this[_0x521e('0x14')]=_0x4ab677[_0x521e('0x14')];this[_0x521e('0x15')]=_0x4ab677[_0x521e('0x15')]||0x3;this[_0x521e('0x16')]=_0x4ab677[_0x521e('0x16')]||0x96;this[_0x521e('0x17')]=_0x4ab677[_0x521e('0x17')]||0x3;this[_0x521e('0x18')]=_0x4ab677[_0x521e('0x18')]||0x96;this[_0x521e('0x19')]=_0x4ab677[_0x521e('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x4ab677[_0x521e('0x1a')]||0x96;this[_0x521e('0x1b')]=_0x4ab677[_0x521e('0x1b')]||0x3;this[_0x521e('0x1c')]=_0x4ab677[_0x521e('0x1c')]||0x96;this[_0x521e('0x1d')]=_0x4ab677[_0x521e('0x1d')]||0x3;this[_0x521e('0x1e')]=_0x4ab677[_0x521e('0x1e')]||0x96;this[_0x521e('0x1f')]=_0x4ab677['dialOrderByScheduledAt']||_0x521e('0x20');this['dialPrefix']=_0x4ab677['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4ab677[_0x521e('0x21')]||undefined;this[_0x521e('0x22')]=_0x4ab677[_0x521e('0x22')]||undefined;this[_0x521e('0x23')]=_0x4ab677[_0x521e('0x23')]?_0x4ab677[_0x521e('0x23')]:undefined;this[_0x521e('0x24')]=_0x4ab677[_0x521e('0x24')]?_0x4ab677[_0x521e('0x24')]:undefined;this[_0x521e('0x25')]=_0x4ab677[_0x521e('0x25')]?_0x4ab677[_0x521e('0x25')]:undefined;this['SquareProject']=_0x4ab677[_0x521e('0x26')]?_0x4ab677[_0x521e('0x26')]:undefined;this[_0x521e('0x27')]=_0x4ab677[_0x521e('0x26')]?_0x4ab677[_0x521e('0x26')][_0x521e('0x0')]:undefined;this[_0x521e('0x28')]=_0x4ab677[_0x521e('0x28')]||![];this[_0x521e('0x29')]=_0x4ab677[_0x521e('0x29')];this['dialAMDGreeting']=_0x4ab677[_0x521e('0x2a')];this[_0x521e('0x2b')]=_0x4ab677[_0x521e('0x2b')];this[_0x521e('0x2c')]=_0x4ab677['dialAMDTotalAnalysisTime'];this[_0x521e('0x2d')]=_0x4ab677[_0x521e('0x2d')];this[_0x521e('0x2e')]=_0x4ab677['dialAMDBetweenWordsSilence'];this[_0x521e('0x2f')]=_0x4ab677[_0x521e('0x2f')];this[_0x521e('0x30')]=_0x4ab677['dialAMDSilenceThreshold'];this[_0x521e('0x31')]=_0x4ab677[_0x521e('0x31')];}module[_0x521e('0x32')]=Campaign; \ No newline at end of file +var _0x3437=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x31d7be,_0x59b13c){var _0x3066d4=function(_0xf10e7c){while(--_0xf10e7c){_0x31d7be['push'](_0x31d7be['shift']());}};_0x3066d4(++_0x59b13c);}(_0x3437,0x1db));var _0x7343=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3437[_0xa464c9];return _0x3d73c4;};'use strict';function Campaign(_0x2b71a4){this['id']=_0x2b71a4['id']||0x0;this[_0x7343('0x0')]=_0x2b71a4[_0x7343('0x0')]||'';this[_0x7343('0x1')]=_0x2b71a4[_0x7343('0x1')]||_0x7343('0x2');this['originated']=0x0;this[_0x7343('0x3')]=0x0;this[_0x7343('0x4')]=0x0;this[_0x7343('0x5')]=0x0;this['message']='';this[_0x7343('0x6')]=!![];this[_0x7343('0x7')]=_0x2b71a4[_0x7343('0x7')];this['limitCalls']=_0x2b71a4[_0x7343('0x8')];this[_0x7343('0x9')]=_0x2b71a4[_0x7343('0x9')]||null;this[_0x7343('0xa')]=_0x2b71a4[_0x7343('0xa')]?_0x2b71a4[_0x7343('0xa')]:null;this[_0x7343('0xb')]=_0x2b71a4[_0x7343('0xb')];this[_0x7343('0xc')]=_0x2b71a4[_0x7343('0xc')];this['dialOriginateTimeout']=_0x2b71a4[_0x7343('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x2b71a4[_0x7343('0xe')];this['dialCongestionRetryFrequency']=_0x2b71a4['dialCongestionRetryFrequency'];this[_0x7343('0xf')]=_0x2b71a4[_0x7343('0xf')];this[_0x7343('0x10')]=_0x2b71a4['dialBusyRetryFrequency'];this[_0x7343('0x11')]=_0x2b71a4[_0x7343('0x11')];this[_0x7343('0x12')]=_0x2b71a4[_0x7343('0x12')];this[_0x7343('0x13')]=_0x2b71a4[_0x7343('0x13')];this[_0x7343('0x14')]=_0x2b71a4[_0x7343('0x14')]||0x3;this[_0x7343('0x15')]=_0x2b71a4[_0x7343('0x15')]||0x96;this[_0x7343('0x16')]=_0x2b71a4['dialDropMaxRetry']||0x3;this[_0x7343('0x17')]=_0x2b71a4[_0x7343('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x2b71a4['dialAbandonedMaxRetry']||0x3;this[_0x7343('0x18')]=_0x2b71a4[_0x7343('0x18')]||0x96;this[_0x7343('0x19')]=_0x2b71a4['dialMachineMaxRetry']||0x3;this[_0x7343('0x1a')]=_0x2b71a4[_0x7343('0x1a')]||0x96;this[_0x7343('0x1b')]=_0x2b71a4['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x2b71a4['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x2b71a4[_0x7343('0x1c')]||_0x7343('0x1d');this[_0x7343('0x1e')]=_0x2b71a4[_0x7343('0x1e')]||undefined;this[_0x7343('0x1f')]=_0x2b71a4[_0x7343('0x1f')]||undefined;this[_0x7343('0x20')]=_0x2b71a4[_0x7343('0x20')]||undefined;this['TrunkBackup']=_0x2b71a4['TrunkBackup']?_0x2b71a4[_0x7343('0x21')]:undefined;this[_0x7343('0x22')]=_0x2b71a4[_0x7343('0x22')]?_0x2b71a4['Trunk']:undefined;this[_0x7343('0x23')]=_0x2b71a4[_0x7343('0x23')]?_0x2b71a4[_0x7343('0x23')]:undefined;this[_0x7343('0x24')]=_0x2b71a4[_0x7343('0x24')]?_0x2b71a4[_0x7343('0x24')]:undefined;this[_0x7343('0x25')]=_0x2b71a4[_0x7343('0x24')]?_0x2b71a4[_0x7343('0x24')][_0x7343('0x0')]:undefined;this[_0x7343('0x26')]=_0x2b71a4[_0x7343('0x26')]||![];this[_0x7343('0x27')]=_0x2b71a4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2b71a4[_0x7343('0x28')];this[_0x7343('0x29')]=_0x2b71a4[_0x7343('0x29')];this[_0x7343('0x2a')]=_0x2b71a4[_0x7343('0x2a')];this[_0x7343('0x2b')]=_0x2b71a4[_0x7343('0x2b')];this[_0x7343('0x2c')]=_0x2b71a4[_0x7343('0x2c')];this[_0x7343('0x2d')]=_0x2b71a4[_0x7343('0x2d')];this[_0x7343('0x2e')]=_0x2b71a4[_0x7343('0x2e')];this[_0x7343('0x2f')]=_0x2b71a4[_0x7343('0x2f')];}module[_0x7343('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a5b18b3..174046c 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 _0x66ee=['transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','lastapplication','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x66ee,0x85));var _0xe66e=function(_0x112dcd,_0x3aa609){_0x112dcd=_0x112dcd-0x0;var _0x598464=_0x66ee[_0x112dcd];return _0x598464;};'use strict';function Channel(){this[_0xe66e('0x0')]=null;this[_0xe66e('0x1')]='';this[_0xe66e('0x2')]='';this[_0xe66e('0x3')]=0x0;this[_0xe66e('0x4')]='';this['connectedlinenum']=undefined;this[_0xe66e('0x5')]=undefined;this[_0xe66e('0x6')]=0x0;this[_0xe66e('0x7')]='';this[_0xe66e('0x8')]=0x0;this['linkedid']=0x0;this[_0xe66e('0x9')]=0x0;this[_0xe66e('0xa')]=![];this[_0xe66e('0xb')]=null;this[_0xe66e('0xc')]=null;this[_0xe66e('0xd')]=![];this['abandoned']=![];this[_0xe66e('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0xe66e('0xf')]=0x0;this['holdtime']=0x0;this[_0xe66e('0x10')]=null;this['tag']=null;this[_0xe66e('0x11')]=null;this[_0xe66e('0x12')]=![];this[_0xe66e('0x13')]=null;this[_0xe66e('0x14')]=null;this[_0xe66e('0x15')]=[];this[_0xe66e('0x16')]=undefined;this[_0xe66e('0x17')]=undefined;this['transferType']=undefined;this[_0xe66e('0x18')]=0x0;}module[_0xe66e('0x19')]=Channel; \ No newline at end of file +var _0xa693=['exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x2a6f78,_0x57aee6){var _0x37f15e=function(_0x154ef8){while(--_0x154ef8){_0x2a6f78['push'](_0x2a6f78['shift']());}};_0x37f15e(++_0x57aee6);}(_0xa693,0xf1));var _0x3a69=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0xa693[_0x336376];return _0x1d2a8e;};'use strict';function Channel(){this[_0x3a69('0x0')]=null;this[_0x3a69('0x1')]='';this[_0x3a69('0x2')]='';this[_0x3a69('0x3')]=0x0;this[_0x3a69('0x4')]='';this[_0x3a69('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3a69('0x6')]=0x0;this[_0x3a69('0x7')]=0x0;this[_0x3a69('0x8')]=0x0;this[_0x3a69('0x9')]=![];this[_0x3a69('0xa')]=null;this[_0x3a69('0xb')]=null;this[_0x3a69('0xc')]=![];this['abandoned']=![];this[_0x3a69('0xd')]='';this[_0x3a69('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3a69('0xf')]=null;this['tag']=null;this[_0x3a69('0x10')]=null;this[_0x3a69('0x11')]=![];this[_0x3a69('0x12')]=null;this[_0x3a69('0x13')]=null;this[_0x3a69('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x3a69('0x15')]=undefined;this[_0x3a69('0x16')]=undefined;this['mohtime']=0x0;}module[_0x3a69('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5acc2cf..357c920 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 _0x61aa=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x61aa,0xed));var _0xa61a=function(_0x21e45c,_0x89818){_0x21e45c=_0x21e45c-0x0;var _0x48c323=_0x61aa[_0x21e45c];return _0x48c323;};'use strict';function DeskAccount(_0x302dad){this['id']=_0x302dad['id']||0x0;this[_0xa61a('0x0')]=_0x302dad[_0xa61a('0x0')]||'';this[_0xa61a('0x1')]=_0x302dad[_0xa61a('0x1')]||'';this[_0xa61a('0x2')]=_0x302dad[_0xa61a('0x2')]||'';this['authType']=_0x302dad[_0xa61a('0x3')]||'';this[_0xa61a('0x4')]=_0x302dad['password']||'';this['consumerKey']=_0x302dad[_0xa61a('0x5')]||'';this[_0xa61a('0x6')]=_0x302dad[_0xa61a('0x6')]||'';this[_0xa61a('0x7')]=_0x302dad[_0xa61a('0x7')]||'';this[_0xa61a('0x8')]=_0x302dad['tokenSecret']||'';this[_0xa61a('0x9')]=_0x302dad[_0xa61a('0x9')]||'';this[_0xa61a('0xa')]=_0x302dad[_0xa61a('0xa')]||'';this['Configurations']=_0x302dad[_0xa61a('0xb')]||{};}module[_0xa61a('0xc')]=DeskAccount; \ No newline at end of file +var _0x9e3d=['tokenSecret','type','serverUrl','Configurations','exports','name','username','authType','password','consumerKey','consumerSecret','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e3d,0x7d));var _0xd9e3=function(_0x40097f,_0x5da702){_0x40097f=_0x40097f-0x0;var _0x28c017=_0x9e3d[_0x40097f];return _0x28c017;};'use strict';function DeskAccount(_0x213115){this['id']=_0x213115['id']||0x0;this[_0xd9e3('0x0')]=_0x213115['name']||'';this[_0xd9e3('0x1')]=_0x213115[_0xd9e3('0x1')]||'';this['remoteUri']=_0x213115['remoteUri']||'';this[_0xd9e3('0x2')]=_0x213115[_0xd9e3('0x2')]||'';this[_0xd9e3('0x3')]=_0x213115['password']||'';this['consumerKey']=_0x213115[_0xd9e3('0x4')]||'';this[_0xd9e3('0x5')]=_0x213115[_0xd9e3('0x5')]||'';this[_0xd9e3('0x6')]=_0x213115['token']||'';this[_0xd9e3('0x7')]=_0x213115[_0xd9e3('0x7')]||'';this[_0xd9e3('0x8')]=_0x213115[_0xd9e3('0x8')]||'';this[_0xd9e3('0x9')]=_0x213115[_0xd9e3('0x9')]||'';this[_0xd9e3('0xa')]=_0x213115[_0xd9e3('0xa')]||{};}module[_0xd9e3('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e70f8b9..b1bc4ec 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 _0x0acd=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username'];(function(_0x4bd150,_0x1c279c){var _0x43bdd5=function(_0x167213){while(--_0x167213){_0x4bd150['push'](_0x4bd150['shift']());}};_0x43bdd5(++_0x1c279c);}(_0x0acd,0xe5));var _0xd0ac=function(_0xc377fc,_0x343f4e){_0xc377fc=_0xc377fc-0x0;var _0x217831=_0x0acd[_0xc377fc];return _0x217831;};'use strict';function Dynamics365Account(_0x190ecf){this['id']=_0x190ecf['id']||0x0;this[_0xd0ac('0x0')]=_0x190ecf[_0xd0ac('0x0')]||'';this[_0xd0ac('0x1')]=_0x190ecf[_0xd0ac('0x1')]||'';this[_0xd0ac('0x2')]=_0x190ecf[_0xd0ac('0x2')]||'';this[_0xd0ac('0x3')]=_0x190ecf[_0xd0ac('0x3')]||'';this[_0xd0ac('0x4')]=_0x190ecf['tenantId']||'';this[_0xd0ac('0x5')]=_0x190ecf[_0xd0ac('0x5')]||'';this[_0xd0ac('0x6')]=_0x190ecf[_0xd0ac('0x6')]||{};this[_0xd0ac('0x7')]=_0x190ecf[_0xd0ac('0x7')]||'';this[_0xd0ac('0x8')]=_0x190ecf[_0xd0ac('0x8')]||![];this['Configurations']=_0x190ecf[_0xd0ac('0x9')]||{};this['CloudProvider']=_0x190ecf['CloudProvider']||{};}module[_0xd0ac('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x4690=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x4690,0x67));var _0x0469=function(_0x5523d2,_0x590f8b){_0x5523d2=_0x5523d2-0x0;var _0x1cbe69=_0x4690[_0x5523d2];return _0x1cbe69;};'use strict';function Dynamics365Account(_0x55e947){this['id']=_0x55e947['id']||0x0;this[_0x0469('0x0')]=_0x55e947['name']||'';this[_0x0469('0x1')]=_0x55e947[_0x0469('0x1')]||'';this[_0x0469('0x2')]=_0x55e947[_0x0469('0x2')]||'';this[_0x0469('0x3')]=_0x55e947[_0x0469('0x3')]||'';this[_0x0469('0x4')]=_0x55e947['tenantId']||'';this['clientId']=_0x55e947[_0x0469('0x5')]||'';this['clientSecret']=_0x55e947[_0x0469('0x6')]||{};this[_0x0469('0x7')]=_0x55e947[_0x0469('0x7')]||'';this[_0x0469('0x8')]=_0x55e947[_0x0469('0x8')]||![];this['Configurations']=_0x55e947[_0x0469('0x9')]||{};this[_0x0469('0xa')]=_0x55e947[_0x0469('0xa')]||{};}module[_0x0469('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 ce50fd5..0c4e393 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 _0x8eed=['tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8eed,0x114));var _0xd8ee=function(_0x1f0ed0,_0x337fd7){_0x1f0ed0=_0x1f0ed0-0x0;var _0x199aa1=_0x8eed[_0x1f0ed0];return _0x199aa1;};'use strict';function FaxAccount(_0x332195){this['id']=_0x332195['id']||0x0;this[_0xd8ee('0x0')]=_0x332195['name']||'';this[_0xd8ee('0x1')]=_0x332195[_0xd8ee('0x1')];this[_0xd8ee('0x2')]=_0x332195[_0xd8ee('0x2')];this['headerinfo']=_0x332195[_0xd8ee('0x3')];this[_0xd8ee('0x4')]=_0x332195[_0xd8ee('0x4')];this[_0xd8ee('0x5')]=_0x332195[_0xd8ee('0x5')]||0x960;this[_0xd8ee('0x6')]=_0x332195[_0xd8ee('0x6')]||0x3840;this['modem']=_0x332195[_0xd8ee('0x7')]||_0xd8ee('0x8');this['gateway']=_0x332195[_0xd8ee('0x9')]||'no';this[_0xd8ee('0xa')]=_0x332195[_0xd8ee('0xa')]||'no';this[_0xd8ee('0xb')]=_0x332195[_0xd8ee('0xb')]||0x1388;this['tech']=_0x332195[_0xd8ee('0xc')]||'SIP';this[_0xd8ee('0xd')]=_0x332195[_0xd8ee('0xd')]?_0x332195[_0xd8ee('0xd')]:undefined;this[_0xd8ee('0xe')]=_0x332195['ListId'];this['key']=_0x332195[_0xd8ee('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1137=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x1137,0x13b));var _0x7113=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x1137[_0x28f32c];return _0x355402;};'use strict';function FaxAccount(_0x4c1e65){this['id']=_0x4c1e65['id']||0x0;this['name']=_0x4c1e65['name']||'';this['description']=_0x4c1e65[_0x7113('0x0')];this[_0x7113('0x1')]=_0x4c1e65[_0x7113('0x1')];this[_0x7113('0x2')]=_0x4c1e65[_0x7113('0x2')];this[_0x7113('0x3')]=_0x4c1e65['localstationid'];this['minrate']=_0x4c1e65[_0x7113('0x4')]||0x960;this[_0x7113('0x5')]=_0x4c1e65[_0x7113('0x5')]||0x3840;this[_0x7113('0x6')]=_0x4c1e65[_0x7113('0x6')]||_0x7113('0x7');this['gateway']=_0x4c1e65[_0x7113('0x8')]||'no';this[_0x7113('0x9')]=_0x4c1e65[_0x7113('0x9')]||'no';this[_0x7113('0xa')]=_0x4c1e65[_0x7113('0xa')]||0x1388;this[_0x7113('0xb')]=_0x4c1e65[_0x7113('0xb')]||'SIP';this['Trunk']=_0x4c1e65[_0x7113('0xc')]?_0x4c1e65[_0x7113('0xc')]:undefined;this[_0x7113('0xd')]=_0x4c1e65[_0x7113('0xd')];this[_0x7113('0xe')]=_0x4c1e65['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3451e92..e763f21 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 _0x55c6=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x2b0405,_0x54553e){var _0x30abc5=function(_0x4497bd){while(--_0x4497bd){_0x2b0405['push'](_0x2b0405['shift']());}};_0x30abc5(++_0x54553e);}(_0x55c6,0x1ba));var _0x655c=function(_0x947df5,_0x536393){_0x947df5=_0x947df5-0x0;var _0x467000=_0x55c6[_0x947df5];return _0x467000;};'use strict';function FreshdeskAccount(_0x493bd0){this['id']=_0x493bd0['id']||0x0;this[_0x655c('0x0')]=_0x493bd0['name']||'';this[_0x655c('0x1')]=_0x493bd0[_0x655c('0x1')]||'';this['apiKey']=_0x493bd0[_0x655c('0x2')]||'';this[_0x655c('0x3')]=_0x493bd0[_0x655c('0x3')]||'';this['serverUrl']=_0x493bd0[_0x655c('0x4')]||'';this[_0x655c('0x5')]=_0x493bd0['Configurations']||{};}module[_0x655c('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x40ca=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x5efb36,_0x31b334){var _0xc9a938=function(_0x28db3c){while(--_0x28db3c){_0x5efb36['push'](_0x5efb36['shift']());}};_0xc9a938(++_0x31b334);}(_0x40ca,0x140));var _0xa40c=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x40ca[_0x5447fd];return _0x15b28a;};'use strict';function FreshdeskAccount(_0x5e2cf5){this['id']=_0x5e2cf5['id']||0x0;this[_0xa40c('0x0')]=_0x5e2cf5['name']||'';this[_0xa40c('0x1')]=_0x5e2cf5[_0xa40c('0x1')]||'';this[_0xa40c('0x2')]=_0x5e2cf5[_0xa40c('0x3')]||'';this[_0xa40c('0x4')]=_0x5e2cf5['remoteUri']||'';this['serverUrl']=_0x5e2cf5[_0xa40c('0x5')]||'';this['Configurations']=_0x5e2cf5[_0xa40c('0x6')]||{};}module[_0xa40c('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 ed6199f..5d1f934 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 _0xa63f=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa63f,0x1b6));var _0xfa63=function(_0x250f95,_0x5a5728){_0x250f95=_0x250f95-0x0;var _0x4ada97=_0xa63f[_0x250f95];return _0x4ada97;};'use strict';function FreshsalesAccount(_0xa59e5){this['id']=_0xa59e5['id']||0x0;this[_0xfa63('0x0')]=_0xa59e5[_0xfa63('0x0')]||'';this[_0xfa63('0x1')]=_0xa59e5[_0xfa63('0x1')]||'';this[_0xfa63('0x2')]=_0xa59e5[_0xfa63('0x3')]||'';this[_0xfa63('0x4')]=_0xa59e5[_0xfa63('0x4')]||'';this[_0xfa63('0x5')]=_0xa59e5['serverUrl']||'';this['Configurations']=_0xa59e5[_0xfa63('0x6')]||{};}module[_0xfa63('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xe314=['apiKey','token','remoteUri','serverUrl','exports','name','username'];(function(_0xb57d87,_0x4bf879){var _0x577487=function(_0x2288cd){while(--_0x2288cd){_0xb57d87['push'](_0xb57d87['shift']());}};_0x577487(++_0x4bf879);}(_0xe314,0x7c));var _0x4e31=function(_0x195291,_0x3d5084){_0x195291=_0x195291-0x0;var _0x2da2d6=_0xe314[_0x195291];return _0x2da2d6;};'use strict';function FreshsalesAccount(_0x5f1d9f){this['id']=_0x5f1d9f['id']||0x0;this[_0x4e31('0x0')]=_0x5f1d9f[_0x4e31('0x0')]||'';this[_0x4e31('0x1')]=_0x5f1d9f[_0x4e31('0x1')]||'';this[_0x4e31('0x2')]=_0x5f1d9f[_0x4e31('0x3')]||'';this[_0x4e31('0x4')]=_0x5f1d9f[_0x4e31('0x4')]||'';this[_0x4e31('0x5')]=_0x5f1d9f[_0x4e31('0x5')]||'';this['Configurations']=_0x5f1d9f['Configurations']||{};}module[_0x4e31('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c69acff..48550c9 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 _0x81fa=['mohtime','variables','type','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','routealias'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x81fa,0x152));var _0xa81f=function(_0x3722d2,_0x206336){_0x3722d2=_0x3722d2-0x0;var _0x15ae66=_0x81fa[_0x3722d2];return _0x15ae66;};'use strict';function QueueReport(){this[_0xa81f('0x0')]='inbound';this[_0xa81f('0x1')]='';this['calleridnum']='';this[_0xa81f('0x2')]='';this['queue']='';this[_0xa81f('0x3')]=null;this[_0xa81f('0x4')]=null;this[_0xa81f('0x5')]=0x1;this[_0xa81f('0x6')]=0x1;this[_0xa81f('0x7')]=![];this[_0xa81f('0x8')]=null;this[_0xa81f('0x9')]=![];this[_0xa81f('0xa')]=null;this[_0xa81f('0xb')]=![];this['queuecallerexitAt']=null;this[_0xa81f('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xa81f('0xd')]='';this[_0xa81f('0xe')]='';this[_0xa81f('0xf')]='';this[_0xa81f('0x10')]='';this['holdtime']=0x0;this[_0xa81f('0x11')]=![];this[_0xa81f('0x12')]='';this[_0xa81f('0x13')]=_0xa81f('0x14');this[_0xa81f('0x15')]=null;this[_0xa81f('0x16')]=0x0;this[_0xa81f('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x3816=['queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt'];(function(_0x3abe45,_0x4bac00){var _0x53a771=function(_0x3e1553){while(--_0x3e1553){_0x3abe45['push'](_0x3abe45['shift']());}};_0x53a771(++_0x4bac00);}(_0x3816,0x115));var _0x6381=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0x3816[_0x51b169];return _0x12605a;};'use strict';function QueueReport(){this[_0x6381('0x0')]='inbound';this[_0x6381('0x1')]='';this[_0x6381('0x2')]='';this[_0x6381('0x3')]='';this[_0x6381('0x4')]='';this[_0x6381('0x5')]=null;this[_0x6381('0x6')]=null;this['position']=0x1;this[_0x6381('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x6381('0x8')]=null;this[_0x6381('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x6381('0xa')]=![];this[_0x6381('0xb')]=null;this[_0x6381('0xc')]=0x1;this[_0x6381('0xd')]='';this['connectedlinenum']='';this[_0x6381('0xe')]='';this[_0x6381('0xf')]='';this['context']='';this[_0x6381('0x10')]='';this[_0x6381('0x11')]='';this[_0x6381('0x12')]=0x0;this[_0x6381('0x13')]=![];this[_0x6381('0x14')]='';this[_0x6381('0x15')]='voice';this[_0x6381('0x16')]=null;this[_0x6381('0x17')]=0x0;this[_0x6381('0x18')]={};}module[_0x6381('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 004399d..81cc277 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 _0x8fab=['username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x594983,_0x463fbb){var _0x32623e=function(_0x39073f){while(--_0x39073f){_0x594983['push'](_0x594983['shift']());}};_0x32623e(++_0x463fbb);}(_0x8fab,0x149));var _0xb8fa=function(_0x5366c1,_0x97591d){_0x5366c1=_0x5366c1-0x0;var _0x5df17e=_0x8fab[_0x5366c1];return _0x5df17e;};'use strict';function SalesforceAccount(_0x43caa5){this['id']=_0x43caa5['id']||0x0;this[_0xb8fa('0x0')]=_0x43caa5[_0xb8fa('0x0')]||'';this[_0xb8fa('0x1')]=_0x43caa5[_0xb8fa('0x1')]||'';this[_0xb8fa('0x2')]=_0x43caa5[_0xb8fa('0x2')]||'';this[_0xb8fa('0x3')]=_0x43caa5[_0xb8fa('0x3')]||'';this[_0xb8fa('0x4')]=_0x43caa5['clientId']||'';this['clientSecret']=_0x43caa5['clientSecret']||'';this[_0xb8fa('0x5')]=_0x43caa5[_0xb8fa('0x5')]||'';this[_0xb8fa('0x6')]=_0x43caa5[_0xb8fa('0x6')]||_0xb8fa('0x7');this[_0xb8fa('0x8')]=_0x43caa5[_0xb8fa('0x8')]||'';this[_0xb8fa('0x9')]=_0x43caa5[_0xb8fa('0x9')]||{};}module[_0xb8fa('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x10bf=['name','remoteUri','password','clientId','clientSecret','type','serverUrl','Configurations','exports'];(function(_0x3382a7,_0x244e88){var _0x4eb81f=function(_0x4c47b8){while(--_0x4c47b8){_0x3382a7['push'](_0x3382a7['shift']());}};_0x4eb81f(++_0x244e88);}(_0x10bf,0xf3));var _0xf10b=function(_0x27a1a0,_0x32380c){_0x27a1a0=_0x27a1a0-0x0;var _0x38cf5c=_0x10bf[_0x27a1a0];return _0x38cf5c;};'use strict';function SalesforceAccount(_0x4bd341){this['id']=_0x4bd341['id']||0x0;this[_0xf10b('0x0')]=_0x4bd341[_0xf10b('0x0')]||'';this['username']=_0x4bd341['username']||'';this[_0xf10b('0x1')]=_0x4bd341[_0xf10b('0x1')]||'';this[_0xf10b('0x2')]=_0x4bd341['password']||'';this[_0xf10b('0x3')]=_0x4bd341[_0xf10b('0x3')]||'';this['clientSecret']=_0x4bd341[_0xf10b('0x4')]||'';this['securityToken']=_0x4bd341['securityToken']||'';this[_0xf10b('0x5')]=_0x4bd341[_0xf10b('0x5')]||'integrationTab';this[_0xf10b('0x6')]=_0x4bd341[_0xf10b('0x6')]||'';this[_0xf10b('0x7')]=_0x4bd341[_0xf10b('0x7')]||{};}module[_0xf10b('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b133778..da53c44 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 _0x218e=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4070a0,_0x22c275){var _0x4c33fe=function(_0x1d54e3){while(--_0x1d54e3){_0x4070a0['push'](_0x4070a0['shift']());}};_0x4c33fe(++_0x22c275);}(_0x218e,0x18a));var _0xe218=function(_0x37b64c,_0xa76e64){_0x37b64c=_0x37b64c-0x0;var _0xebb3ba=_0x218e[_0x37b64c];return _0xebb3ba;};'use strict';function ServicenowAccount(_0x2e9bb4){this['id']=_0x2e9bb4['id']||0x0;this[_0xe218('0x0')]=_0x2e9bb4[_0xe218('0x0')]||'';this[_0xe218('0x1')]=_0x2e9bb4[_0xe218('0x1')]||'';this[_0xe218('0x2')]=_0x2e9bb4[_0xe218('0x2')]||'';this['remoteUri']=_0x2e9bb4[_0xe218('0x3')]||'';this[_0xe218('0x4')]=_0x2e9bb4[_0xe218('0x4')]||'';this['Configurations']=_0x2e9bb4[_0xe218('0x5')]||{};}module[_0xe218('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0b0c=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x44bb01,_0x5757f4){var _0x30a1ad=function(_0x3815ac){while(--_0x3815ac){_0x44bb01['push'](_0x44bb01['shift']());}};_0x30a1ad(++_0x5757f4);}(_0x0b0c,0xce));var _0xc0b0=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x0b0c[_0x1fcf1b];return _0x5d2952;};'use strict';function ServicenowAccount(_0xe69b2b){this['id']=_0xe69b2b['id']||0x0;this[_0xc0b0('0x0')]=_0xe69b2b['name']||'';this[_0xc0b0('0x1')]=_0xe69b2b[_0xc0b0('0x1')]||'';this[_0xc0b0('0x2')]=_0xe69b2b[_0xc0b0('0x2')]||'';this[_0xc0b0('0x3')]=_0xe69b2b[_0xc0b0('0x3')]||'';this[_0xc0b0('0x4')]=_0xe69b2b[_0xc0b0('0x4')]||'';this[_0xc0b0('0x5')]=_0xe69b2b[_0xc0b0('0x5')]||{};}module[_0xc0b0('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 4fe5da3..7f0c1ab 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 _0x318e=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4c3cbf,_0x1aed3e){var _0x296c96=function(_0x2c909a){while(--_0x2c909a){_0x4c3cbf['push'](_0x4c3cbf['shift']());}};_0x296c96(++_0x1aed3e);}(_0x318e,0x1bc));var _0xe318=function(_0x497c07,_0x8a0726){_0x497c07=_0x497c07-0x0;var _0x396dc0=_0x318e[_0x497c07];return _0x396dc0;};'use strict';function SugarcrmAccount(_0x1ca7f3){this['id']=_0x1ca7f3['id']||0x0;this[_0xe318('0x0')]=_0x1ca7f3[_0xe318('0x0')]||'';this['username']=_0x1ca7f3['username']||'';this[_0xe318('0x1')]=_0x1ca7f3[_0xe318('0x1')]||'';this['remoteUri']=_0x1ca7f3[_0xe318('0x2')]||'';this[_0xe318('0x3')]=_0x1ca7f3[_0xe318('0x3')]||'';this[_0xe318('0x4')]=_0x1ca7f3['Configurations']||{};}module[_0xe318('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x4b02=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3ab99a,_0x3ce898){var _0x454822=function(_0x11e3ef){while(--_0x11e3ef){_0x3ab99a['push'](_0x3ab99a['shift']());}};_0x454822(++_0x3ce898);}(_0x4b02,0x120));var _0x24b0=function(_0x101bd2,_0x4a1132){_0x101bd2=_0x101bd2-0x0;var _0x40d8fc=_0x4b02[_0x101bd2];return _0x40d8fc;};'use strict';function SugarcrmAccount(_0x11ec67){this['id']=_0x11ec67['id']||0x0;this['name']=_0x11ec67[_0x24b0('0x0')]||'';this[_0x24b0('0x1')]=_0x11ec67[_0x24b0('0x1')]||'';this[_0x24b0('0x2')]=_0x11ec67[_0x24b0('0x2')]||'';this[_0x24b0('0x3')]=_0x11ec67[_0x24b0('0x3')]||'';this['serverUrl']=_0x11ec67[_0x24b0('0x4')]||'';this[_0x24b0('0x5')]=_0x11ec67[_0x24b0('0x5')]||{};}module[_0x24b0('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 88dc633..c75db44 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 _0x0db9=['stateTime','unknown','address','accountcode','state'];(function(_0x1fa331,_0x4232eb){var _0x3b8983=function(_0x4c8bc9){while(--_0x4c8bc9){_0x1fa331['push'](_0x1fa331['shift']());}};_0x3b8983(++_0x4232eb);}(_0x0db9,0xa3));var _0x90db=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x0db9[_0xcf5436];return _0xc4f5c8;};'use strict';function Telephone(_0x3be2aa){this['id']=_0x3be2aa['id']||0x0;this['name']=_0x3be2aa['name']||'';this['accountcode']=_0x3be2aa[_0x90db('0x0')]||'';this[_0x90db('0x1')]='unknown';this[_0x90db('0x2')]=0x0;this['status']=_0x90db('0x3');this[_0x90db('0x4')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xfd39=['state','unknown','stateTime','status','address','name','accountcode'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xfd39,0xec));var _0x9fd3=function(_0x26ce09,_0x495d74){_0x26ce09=_0x26ce09-0x0;var _0x482a5a=_0xfd39[_0x26ce09];return _0x482a5a;};'use strict';function Telephone(_0x994b77){this['id']=_0x994b77['id']||0x0;this[_0x9fd3('0x0')]=_0x994b77[_0x9fd3('0x0')]||'';this['accountcode']=_0x994b77[_0x9fd3('0x1')]||'';this[_0x9fd3('0x2')]=_0x9fd3('0x3');this[_0x9fd3('0x4')]=0x0;this[_0x9fd3('0x5')]=_0x9fd3('0x3');this[_0x9fd3('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fa10f81..c1cad88 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(_0x111422,_0x4a7c91){var _0x2ef864=function(_0x2e7391){while(--_0x2e7391){_0x111422['push'](_0x111422['shift']());}};_0x2ef864(++_0x4a7c91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x2ba437,_0x154f40){var _0x943ee8=function(_0x51c59b){while(--_0x51c59b){_0x2ba437['push'](_0x2ba437['shift']());}};_0x943ee8(++_0x154f40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 cb70d23..ffff066 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x8c721d,_0x590780){var _0xb1e52e=function(_0x490869){while(--_0x490869){_0x8c721d['push'](_0x8c721d['shift']());}};_0xb1e52e(++_0x590780);}(_0x757a,0xde));var _0xa757=function(_0x3408bd,_0x543682){_0x3408bd=_0x3408bd-0x0;var _0x3d0363=_0x757a[_0x3408bd];return _0x3d0363;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0xc240b,_0x4b5fec){var _0x48a0dd=function(_0x2005e1){while(--_0x2005e1){_0xc240b['push'](_0xc240b['shift']());}};_0x48a0dd(++_0x4b5fec);}(_0x14a0,0x8e));var _0x014a=function(_0x3fa2d3,_0x15fdfc){_0x3fa2d3=_0x3fa2d3-0x0;var _0x10c4d5=_0x14a0[_0x3fa2d3];return _0x10c4d5;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 3890a56..57b436f 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 _0xfaf8=['name','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active'];(function(_0x16054d,_0x21d92a){var _0x1192b1=function(_0x259f53){while(--_0x259f53){_0x16054d['push'](_0x16054d['shift']());}};_0x1192b1(++_0x21d92a);}(_0xfaf8,0x14f));var _0x8faf=function(_0x214129,_0x1bcd7d){_0x214129=_0x214129-0x0;var _0xf7ae2b=_0xfaf8[_0x214129];return _0xf7ae2b;};'use strict';function Trunk(_0x48b8cd){this['id']=_0x48b8cd['id']||0x0;this[_0x8faf('0x0')]=_0x48b8cd[_0x8faf('0x0')]||![];this[_0x8faf('0x1')]=_0x48b8cd[_0x8faf('0x1')]||'';this['state']=_0x8faf('0x2');this[_0x8faf('0x3')]=0x0;this[_0x8faf('0x4')]=_0x8faf('0x2');this[_0x8faf('0x5')]=_0x48b8cd['registry']&&_0x48b8cd[_0x8faf('0x5')][_0x8faf('0x6')](':')?_0x48b8cd[_0x8faf('0x5')][_0x8faf('0x7')](':')[0x0]:'';this[_0x8faf('0x8')]='';this[_0x8faf('0x9')]='';this['domain']='';this[_0x8faf('0xa')]='';this[_0x8faf('0xb')]='';this[_0x8faf('0xc')]=_0x8faf('0x2');this[_0x8faf('0xd')]='';this['address']='';this[_0x8faf('0xe')]=_0x48b8cd[_0x8faf('0xe')]||'';}module[_0x8faf('0xf')]=Trunk; \ No newline at end of file +var _0xf028=['registry','indexOf','host','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status'];(function(_0x309a7d,_0x1b1770){var _0x1ae843=function(_0x4d5e4b){while(--_0x4d5e4b){_0x309a7d['push'](_0x309a7d['shift']());}};_0x1ae843(++_0x1b1770);}(_0xf028,0x1da));var _0x8f02=function(_0x27399b,_0x333ca9){_0x27399b=_0x27399b-0x0;var _0x3fb5f9=_0xf028[_0x27399b];return _0x3fb5f9;};'use strict';function Trunk(_0x3355a5){this['id']=_0x3355a5['id']||0x0;this[_0x8f02('0x0')]=_0x3355a5[_0x8f02('0x0')]||![];this['name']=_0x3355a5[_0x8f02('0x1')]||'';this[_0x8f02('0x2')]=_0x8f02('0x3');this[_0x8f02('0x4')]=0x0;this[_0x8f02('0x5')]=_0x8f02('0x3');this[_0x8f02('0x6')]=_0x3355a5[_0x8f02('0x6')]&&_0x3355a5[_0x8f02('0x6')][_0x8f02('0x7')](':')?_0x3355a5[_0x8f02('0x6')]['split'](':')[0x0]:'';this[_0x8f02('0x8')]='';this['port']='';this['domain']='';this[_0x8f02('0x9')]='';this[_0x8f02('0xa')]='';this[_0x8f02('0xb')]=_0x8f02('0x3');this[_0x8f02('0xc')]='';this[_0x8f02('0xd')]='';this[_0x8f02('0xe')]=_0x3355a5[_0x8f02('0xe')]||'';}module[_0x8f02('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index da575f5..a501d84 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 _0xd8d4=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x42ab20,_0x36965d){var _0x582956=function(_0x55e29f){while(--_0x55e29f){_0x42ab20['push'](_0x42ab20['shift']());}};_0x582956(++_0x36965d);}(_0xd8d4,0x13e));var _0x4d8d=function(_0xcfe2aa,_0x3804e7){_0xcfe2aa=_0xcfe2aa-0x0;var _0x5324cf=_0xd8d4[_0xcfe2aa];return _0x5324cf;};'use strict';function voiceExtension(_0x1a73cb){this['id']=_0x1a73cb['id']||0x0;this['exten']=_0x1a73cb[_0x4d8d('0x0')]||'';this[_0x4d8d('0x1')]=_0x1a73cb[_0x4d8d('0x1')]||_0x4d8d('0x2');this[_0x4d8d('0x3')]=_0x1a73cb[_0x4d8d('0x3')]||![];}module[_0x4d8d('0x4')]=voiceExtension; \ No newline at end of file +var _0xeee9=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2712e4,_0x7203ec){var _0x19476a=function(_0x46a435){while(--_0x46a435){_0x2712e4['push'](_0x2712e4['shift']());}};_0x19476a(++_0x7203ec);}(_0xeee9,0x9d));var _0x9eee=function(_0x3d118b,_0x48e458){_0x3d118b=_0x3d118b-0x0;var _0x18b5e9=_0xeee9[_0x3d118b];return _0x18b5e9;};'use strict';function voiceExtension(_0x2c60f8){this['id']=_0x2c60f8['id']||0x0;this['exten']=_0x2c60f8[_0x9eee('0x0')]||'';this['recordingFormat']=_0x2c60f8[_0x9eee('0x1')]||_0x9eee('0x2');this[_0x9eee('0x3')]=_0x2c60f8[_0x9eee('0x3')]||![];}module[_0x9eee('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 8e4ede0..220665d 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 _0x423b=['callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','fewestcalls','linear','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringInUse','unavailable','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0x423b,0x12b));var _0xb423=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x423b[_0x9c2427];return _0x51984f;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xb423('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0xb423('0x1'),'leastrecent':'leastrecent','linear':_0xb423('0x2'),'random':'random','ringall':'ringall','rr':'roundrobin','rrmemory':_0xb423('0x3'),'rrordered':_0xb423('0x4'),'wrandom':'wrandom'};function VoiceQueue(_0x1be92e){this['id']=_0x1be92e['id']||0x0;this[_0xb423('0x5')]=_0x1be92e[_0xb423('0x5')]||'';this[_0xb423('0x6')]=_0x1be92e['monitor_format']||'';this[_0xb423('0x7')]=_0x1be92e[_0xb423('0x7')]||_0xb423('0x8');this[_0xb423('0x9')]=0x0;this[_0xb423('0xa')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xb423('0xb')]=0x0;this[_0xb423('0xc')]=0x0;this[_0xb423('0xd')]=0x0;this[_0xb423('0xe')]=0x0;this[_0xb423('0xf')]=0x0;this['busy']=0x0;this[_0xb423('0x10')]=0x0;this[_0xb423('0x11')]=0x0;this['loggedIn']=0x0;this[_0xb423('0x12')]=0x0;this[_0xb423('0x13')]=0x0;this[_0xb423('0x14')]=0x0;this['ringing']=0x0;this[_0xb423('0x15')]=0x0;this['talking']=0x0;this[_0xb423('0x16')]=0x0;this['unknown']=0x0;this['acw']=_0x1be92e['acw']||![];this[_0xb423('0x17')]=_0x1be92e[_0xb423('0x17')]||0xa;this[_0xb423('0x18')]=_0x1be92e['autopause']||'no';this[_0xb423('0x19')]=!![];this[_0xb423('0x1a')]='';this[_0xb423('0x1b')]='';this[_0xb423('0x1c')]=0x0;this['temp']=0x0;this[_0xb423('0x1d')]=_0x1be92e[_0xb423('0x1d')]||null;this['dialGlobalInterval']=_0x1be92e['dialGlobalInterval']?_0x1be92e[_0xb423('0x1e')]:null;this['dialActive']=_0x1be92e[_0xb423('0x1f')];this[_0xb423('0x20')]=_0x1be92e[_0xb423('0x20')]||_0xb423('0x21');this[_0xb423('0x22')]=_0x1be92e[_0xb423('0x22')]||0x0;this[_0xb423('0x23')]=_0x1be92e[_0xb423('0x23')]||0x0;this['dialPowerLevel']=_0x1be92e[_0xb423('0x24')]||0x1;this[_0xb423('0x25')]=_0x1be92e[_0xb423('0x25')]||'dropRate';this[_0xb423('0x26')]=_0x1be92e[_0xb423('0x26')]||0.03;this['dialPredictiveInterval']=_0x1be92e[_0xb423('0x27')]||0x258;this[_0xb423('0x28')]=_0x1be92e[_0xb423('0x28')]||'anonymous';this[_0xb423('0x29')]=_0x1be92e['dialOriginateCallerIdNumber']||_0xb423('0x2a');this['dialOriginateTimeout']=_0x1be92e[_0xb423('0x2b')]||0x1e;this[_0xb423('0x2c')]=_0x1be92e['dialQueueOptions']||_0xb423('0x2d');this[_0xb423('0x2e')]=_0x1be92e[_0xb423('0x2e')]||0x3;this['dialQueueProject']=_0x1be92e['dialQueueProject']||undefined;this[_0xb423('0x2f')]=_0x1be92e['dialCongestionMaxRetry']||0x3;this[_0xb423('0x30')]=_0x1be92e['dialCongestionRetryFrequency']||0x96;this[_0xb423('0x31')]=_0x1be92e[_0xb423('0x31')]||0x3;this[_0xb423('0x32')]=_0x1be92e[_0xb423('0x32')]||0x96;this[_0xb423('0x33')]=_0x1be92e['dialNoAnswerMaxRetry']||0x3;this[_0xb423('0x34')]=_0x1be92e['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x1be92e['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1be92e[_0xb423('0x35')]||0x96;this[_0xb423('0x36')]=_0x1be92e[_0xb423('0x36')]||0x3;this['dialDropRetryFrequency']=_0x1be92e['dialDropRetryFrequency']||0x96;this[_0xb423('0x37')]=_0x1be92e[_0xb423('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x1be92e[_0xb423('0x38')]||0x96;this[_0xb423('0x39')]=_0x1be92e[_0xb423('0x39')]||0x3;this[_0xb423('0x3a')]=_0x1be92e[_0xb423('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x1be92e[_0xb423('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1be92e[_0xb423('0x3c')]||0x96;this[_0xb423('0x3d')]=_0x1be92e[_0xb423('0x3d')]||0x3;this[_0xb423('0x3e')]=_0x1be92e[_0xb423('0x3e')]||0x4;this[_0xb423('0x3f')]=_0x1be92e['Trunk']?_0x1be92e[_0xb423('0x3f')]:undefined;this[_0xb423('0x40')]=_0x1be92e['TrunkBackup']?_0x1be92e[_0xb423('0x40')]:undefined;this['dialPrefix']=_0x1be92e[_0xb423('0x41')]||undefined;this[_0xb423('0x42')]=_0x1be92e['Interval']?_0x1be92e[_0xb423('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x1be92e[_0xb423('0x43')]||_0xb423('0x44');this[_0xb423('0x45')]=_0x1be92e[_0xb423('0x45')]||undefined;this[_0xb423('0x46')]=_0x1be92e['dialCutDigit']||undefined;this['strategy']=strategy[_0x1be92e[_0xb423('0x47')]];this[_0xb423('0x48')]=!![];this['dialAMDActive']=_0x1be92e[_0xb423('0x49')]||![];this[_0xb423('0x4a')]=_0x1be92e['dialAMDInitialSilence'];this[_0xb423('0x4b')]=_0x1be92e[_0xb423('0x4b')];this[_0xb423('0x4c')]=_0x1be92e[_0xb423('0x4c')];this[_0xb423('0x4d')]=_0x1be92e[_0xb423('0x4d')];this[_0xb423('0x4e')]=_0x1be92e[_0xb423('0x4e')];this[_0xb423('0x4f')]=_0x1be92e[_0xb423('0x4f')];this[_0xb423('0x50')]=_0x1be92e[_0xb423('0x50')];this[_0xb423('0x51')]=_0x1be92e[_0xb423('0x51')];this['dialAMDMaximumWordLength']=_0x1be92e[_0xb423('0x52')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x1be92e['timeout'];this[_0xb423('0x53')]=0x0;this[_0xb423('0x54')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb423('0x55')]=0x0;this[_0xb423('0x56')]=0x0;this[_0xb423('0x57')]=0x0;this[_0xb423('0x58')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xb423('0x59')]=0x0;this[_0xb423('0x5a')]=0x0;this[_0xb423('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb423('0x5c')]=0x0;this[_0xb423('0x5d')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xb423('0x5e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb423('0x5f')]=0x0;this[_0xb423('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xb423('0x61')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xb423('0x62')]=0x0;this[_0xb423('0x63')]=0x0;this[_0xb423('0x64')]=0x0;this[_0xb423('0x65')]=_0x1be92e[_0xb423('0x66')]||0x14;this[_0xb423('0x67')]=_0x1be92e[_0xb423('0x66')]||0xa;this[_0xb423('0x68')]=0x0;this[_0xb423('0x69')]=0x0;this[_0xb423('0x6a')]=0x1;this[_0xb423('0x6b')]=0x0;this[_0xb423('0x6c')]=0x0;this[_0xb423('0x6d')]=0x0;this[_0xb423('0x6e')]=0x0;this[_0xb423('0x6f')]=_0x1be92e[_0xb423('0x6f')]||0x1e;this[_0xb423('0x70')]=_0x1be92e[_0xb423('0x70')]||![];this[_0xb423('0x71')]=!!_0x1be92e['dialPreviewAutoRecallMe']||![];this[_0xb423('0x72')]=!!_0x1be92e[_0xb423('0x72')]||![];this[_0xb423('0x73')]=_0x1be92e[_0xb423('0x73')]||undefined;this[_0xb423('0x74')]=_0x1be92e[_0xb423('0x74')]||![];this['dialAgiAfterHangupAgent']=_0x1be92e['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1be92e[_0xb423('0x6')]]?monitorFormat[_0x1be92e[_0xb423('0x6')]]:undefined;this[_0xb423('0x75')]=_0x1be92e[_0xb423('0x75')]||![];this[_0xb423('0x76')]=_0x1be92e['mandatoryDispositionPause']?_0x1be92e['mandatoryDispositionPause']:undefined;this[_0xb423('0x77')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe14a=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','linear','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit'];(function(_0x3e4a0c,_0x49faa6){var _0x5dbebf=function(_0x53b41f){while(--_0x53b41f){_0x3e4a0c['push'](_0x3e4a0c['shift']());}};_0x5dbebf(++_0x49faa6);}(_0xe14a,0x94));var _0xae14=function(_0x48911f,_0x406b18){_0x48911f=_0x48911f-0x0;var _0x16fa36=_0xe14a[_0x48911f];return _0x16fa36;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0xae14('0x0'),'random':_0xae14('0x1'),'ringall':'ringall','rr':_0xae14('0x2'),'rrmemory':_0xae14('0x3'),'rrordered':_0xae14('0x4'),'wrandom':_0xae14('0x5')};function VoiceQueue(_0x2b5138){this['id']=_0x2b5138['id']||0x0;this[_0xae14('0x6')]=_0x2b5138[_0xae14('0x6')]||'';this[_0xae14('0x7')]=_0x2b5138[_0xae14('0x7')]||'';this[_0xae14('0x8')]=_0x2b5138[_0xae14('0x8')]||_0xae14('0x9');this[_0xae14('0xa')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xae14('0xb')]=0x0;this[_0xae14('0xc')]=0x0;this[_0xae14('0xd')]=0x0;this[_0xae14('0xe')]=0x0;this[_0xae14('0xf')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0xae14('0x10')]=0x0;this[_0xae14('0x11')]=0x0;this[_0xae14('0x12')]=0x0;this[_0xae14('0x13')]=0x0;this[_0xae14('0x14')]=0x0;this[_0xae14('0x15')]=0x0;this[_0xae14('0x16')]=0x0;this[_0xae14('0x17')]=0x0;this[_0xae14('0x18')]=0x0;this[_0xae14('0x19')]=0x0;this['unknown']=0x0;this[_0xae14('0x1a')]=_0x2b5138[_0xae14('0x1a')]||![];this['acwTimeout']=_0x2b5138[_0xae14('0x1b')]||0xa;this[_0xae14('0x1c')]=_0x2b5138[_0xae14('0x1c')]||'no';this[_0xae14('0x1d')]=!![];this[_0xae14('0x1e')]='';this['statusMessage']='';this['originated']=0x0;this[_0xae14('0x1f')]=0x0;this[_0xae14('0x20')]=_0x2b5138[_0xae14('0x20')]||null;this[_0xae14('0x21')]=_0x2b5138['dialGlobalInterval']?_0x2b5138[_0xae14('0x21')]:null;this[_0xae14('0x22')]=_0x2b5138[_0xae14('0x22')];this[_0xae14('0x23')]=_0x2b5138[_0xae14('0x23')]||_0xae14('0x24');this[_0xae14('0x25')]=_0x2b5138[_0xae14('0x25')]||0x0;this['dialLimitQueue']=_0x2b5138[_0xae14('0x26')]||0x0;this[_0xae14('0x27')]=_0x2b5138[_0xae14('0x27')]||0x1;this[_0xae14('0x28')]=_0x2b5138[_0xae14('0x28')]||_0xae14('0x29');this[_0xae14('0x2a')]=_0x2b5138['dialPredictiveOptimizationPercentage']||0.03;this[_0xae14('0x2b')]=_0x2b5138[_0xae14('0x2b')]||0x258;this[_0xae14('0x2c')]=_0x2b5138[_0xae14('0x2c')]||_0xae14('0x2d');this[_0xae14('0x2e')]=_0x2b5138['dialOriginateCallerIdNumber']||'anonymous';this['dialOriginateTimeout']=_0x2b5138[_0xae14('0x2f')]||0x1e;this[_0xae14('0x30')]=_0x2b5138[_0xae14('0x30')]||_0xae14('0x31');this[_0xae14('0x32')]=_0x2b5138[_0xae14('0x32')]||0x3;this[_0xae14('0x33')]=_0x2b5138[_0xae14('0x33')]||undefined;this[_0xae14('0x34')]=_0x2b5138[_0xae14('0x34')]||0x3;this[_0xae14('0x35')]=_0x2b5138[_0xae14('0x35')]||0x96;this['dialBusyMaxRetry']=_0x2b5138[_0xae14('0x36')]||0x3;this[_0xae14('0x37')]=_0x2b5138[_0xae14('0x37')]||0x96;this[_0xae14('0x38')]=_0x2b5138[_0xae14('0x38')]||0x3;this[_0xae14('0x39')]=_0x2b5138[_0xae14('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2b5138[_0xae14('0x3a')]||0x3;this[_0xae14('0x3b')]=_0x2b5138[_0xae14('0x3b')]||0x96;this['dialDropMaxRetry']=_0x2b5138['dialDropMaxRetry']||0x3;this[_0xae14('0x3c')]=_0x2b5138[_0xae14('0x3c')]||0x96;this[_0xae14('0x3d')]=_0x2b5138[_0xae14('0x3d')]||0x3;this['dialAbandonedRetryFrequency']=_0x2b5138[_0xae14('0x3e')]||0x96;this[_0xae14('0x3f')]=_0x2b5138[_0xae14('0x3f')]||0x3;this['dialMachineRetryFrequency']=_0x2b5138['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2b5138[_0xae14('0x40')]||0x3;this[_0xae14('0x41')]=_0x2b5138[_0xae14('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2b5138[_0xae14('0x42')]||0x3;this[_0xae14('0x43')]=_0x2b5138[_0xae14('0x43')]||0x4;this['Trunk']=_0x2b5138[_0xae14('0x44')]?_0x2b5138[_0xae14('0x44')]:undefined;this['TrunkBackup']=_0x2b5138[_0xae14('0x45')]?_0x2b5138[_0xae14('0x45')]:undefined;this[_0xae14('0x46')]=_0x2b5138[_0xae14('0x46')]||undefined;this['Interval']=_0x2b5138[_0xae14('0x47')]?_0x2b5138[_0xae14('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x2b5138[_0xae14('0x48')]||_0xae14('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x2b5138['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xae14('0x4a')]=_0x2b5138['dialCutDigit']||undefined;this[_0xae14('0x4b')]=strategy[_0x2b5138[_0xae14('0x4b')]];this[_0xae14('0x4c')]=!![];this['dialAMDActive']=_0x2b5138[_0xae14('0x4d')]||![];this[_0xae14('0x4e')]=_0x2b5138[_0xae14('0x4e')];this[_0xae14('0x4f')]=_0x2b5138[_0xae14('0x4f')];this[_0xae14('0x50')]=_0x2b5138[_0xae14('0x50')];this['dialAMDTotalAnalysisTime']=_0x2b5138[_0xae14('0x51')];this[_0xae14('0x52')]=_0x2b5138[_0xae14('0x52')];this[_0xae14('0x53')]=_0x2b5138[_0xae14('0x53')];this[_0xae14('0x54')]=_0x2b5138[_0xae14('0x54')];this[_0xae14('0x55')]=_0x2b5138[_0xae14('0x55')];this[_0xae14('0x56')]=_0x2b5138[_0xae14('0x56')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xae14('0x57')]=_0x2b5138['timeout'];this[_0xae14('0x58')]=0x0;this[_0xae14('0x59')]=0x0;this[_0xae14('0x5a')]=0x0;this[_0xae14('0x5b')]=0x0;this[_0xae14('0x5c')]=0x0;this[_0xae14('0x5d')]=0x0;this[_0xae14('0x5e')]=0x0;this[_0xae14('0x5f')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xae14('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xae14('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0xae14('0x62')]=0x0;this[_0xae14('0x63')]=undefined;this[_0xae14('0x64')]=undefined;this['handlePredictive']=undefined;this[_0xae14('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xae14('0x66')]=0x0;this[_0xae14('0x67')]=0x0;this[_0xae14('0x68')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xae14('0x69')]=0x0;this[_0xae14('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x2b5138['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xae14('0x6b')]=_0x2b5138[_0xae14('0x6c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xae14('0x6d')]=0x0;this[_0xae14('0x6e')]=0x1;this[_0xae14('0x6f')]=0x0;this[_0xae14('0x70')]=0x0;this[_0xae14('0x71')]=0x0;this[_0xae14('0x72')]=0x0;this['dialRecallMeTimeout']=_0x2b5138[_0xae14('0x73')]||0x1e;this[_0xae14('0x74')]=_0x2b5138['dialRecallInQueue']||![];this[_0xae14('0x75')]=!!_0x2b5138[_0xae14('0x75')]||![];this[_0xae14('0x76')]=!!_0x2b5138['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x2b5138[_0xae14('0x77')]||undefined;this[_0xae14('0x78')]=_0x2b5138[_0xae14('0x78')]||![];this[_0xae14('0x79')]=_0x2b5138[_0xae14('0x79')]||![];this[_0xae14('0x7')]=monitorFormat[_0x2b5138['monitor_format']]?monitorFormat[_0x2b5138[_0xae14('0x7')]]:undefined;this[_0xae14('0x7a')]=_0x2b5138['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2b5138[_0xae14('0x7b')]?_0x2b5138['mandatoryDispositionPause']:undefined;this[_0xae14('0x7c')]=![];}module[_0xae14('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5c2f88b..7b4ba0d 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 _0x0bde=['some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','available','loggedInDb','paused','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringing','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','keys','exten','xcally-motion-preview','compareToInboundQueue'];(function(_0x5410e4,_0x1f5c7e){var _0x41121f=function(_0x38aec2){while(--_0x38aec2){_0x5410e4['push'](_0x5410e4['shift']());}};_0x41121f(++_0x1f5c7e);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var INBOUND_COUNTERS=[_0xe0bd('0x0'),'loggedIn',_0xe0bd('0x1'),_0xe0bd('0x2'),'ringing',_0xe0bd('0x3'),_0xe0bd('0x4')];var OUTBOUND_COUNTERS=[_0xe0bd('0x0'),'answered',_0xe0bd('0x5'),_0xe0bd('0x6'),_0xe0bd('0x1'),_0xe0bd('0x7'),_0xe0bd('0x8'),_0xe0bd('0x9'),_0xe0bd('0xa'),_0xe0bd('0xb'),_0xe0bd('0xc'),_0xe0bd('0xd'),_0xe0bd('0xe'),_0xe0bd('0xf'),_0xe0bd('0x10'),'outboundUnknownCallsDay',_0xe0bd('0x2'),_0xe0bd('0x11'),'talking',_0xe0bd('0x12'),'sumDuration',_0xe0bd('0x13'),_0xe0bd('0x4')];function VoiceQueueSummary(_0x3cc36c){this['id']=_0x3cc36c['id'];this[_0xe0bd('0x14')]=_0x3cc36c[_0xe0bd('0x14')];this[_0xe0bd('0x15')]=_0x3cc36c[_0xe0bd('0x15')];this['abandoned']=_0x3cc36c[_0xe0bd('0x16')]||0x0;this[_0xe0bd('0x17')]=_0x3cc36c[_0xe0bd('0x17')]||0x0;this['available']=_0x3cc36c[_0xe0bd('0x0')]||0x0;this['busy']=_0x3cc36c[_0xe0bd('0x18')]||0x0;this[_0xe0bd('0x5')]=_0x3cc36c[_0xe0bd('0x5')]||0x0;this[_0xe0bd('0x19')]=_0x3cc36c[_0xe0bd('0x19')]||0x0;this[_0xe0bd('0x6')]=_0x3cc36c[_0xe0bd('0x6')]||0x0;this[_0xe0bd('0x1')]=_0x3cc36c['loggedInDb']||0x0;this['onHold']=_0x3cc36c[_0xe0bd('0x1a')]||0x0;this[_0xe0bd('0x1b')]=_0x3cc36c[_0xe0bd('0x1b')]||0x0;this[_0xe0bd('0x2')]=_0x3cc36c[_0xe0bd('0x2')]||0x0;this[_0xe0bd('0x1c')]=_0x3cc36c['ringing']||0x0;this['ringInUse']=_0x3cc36c[_0xe0bd('0x1d')];this[_0xe0bd('0x12')]=_0x3cc36c[_0xe0bd('0x12')];this[_0xe0bd('0x1e')]=_0x3cc36c[_0xe0bd('0x1e')];this[_0xe0bd('0x1f')]=_0x3cc36c[_0xe0bd('0x1f')]||0x0;this['talking']=_0x3cc36c['talking']||0x0;this[_0xe0bd('0x13')]=_0x3cc36c[_0xe0bd('0x13')]||0x0;this[_0xe0bd('0x20')]=_0x3cc36c[_0xe0bd('0x20')];this[_0xe0bd('0x21')]=_0x3cc36c['unavailable']||0x0;this[_0xe0bd('0x22')]=_0x3cc36c['unknown']||0x0;this[_0xe0bd('0x23')]=_0x3cc36c[_0xe0bd('0x23')]||0x0;this[_0xe0bd('0x4')]=_0x3cc36c['waiting']||0x0;if(_0x3cc36c[_0xe0bd('0x20')]===_0xe0bd('0x24')){this['pTalking']=_0x3cc36c[_0xe0bd('0x11')]||0x0;this['dialActive']=_0x3cc36c[_0xe0bd('0x25')];this['dialMethod']=_0x3cc36c[_0xe0bd('0x26')];this[_0xe0bd('0x27')]=_0x3cc36c[_0xe0bd('0x27')];this['dialOriginateCallerIdNumber']=_0x3cc36c[_0xe0bd('0x28')];this['dialOriginateTimeout']=_0x3cc36c[_0xe0bd('0x29')];this[_0xe0bd('0x2a')]=_0x3cc36c['dialPrefix'];this['temp']=_0x3cc36c[_0xe0bd('0x2b')];this[_0xe0bd('0x2c')]=_0x3cc36c[_0xe0bd('0x2c')];this[_0xe0bd('0x9')]=_0x3cc36c[_0xe0bd('0x9')];this[_0xe0bd('0xa')]=_0x3cc36c[_0xe0bd('0xa')];this['outboundBusyCallsDay']=_0x3cc36c[_0xe0bd('0xb')];this[_0xe0bd('0xc')]=_0x3cc36c[_0xe0bd('0xc')];this[_0xe0bd('0x2d')]=_0x3cc36c[_0xe0bd('0x2d')];this[_0xe0bd('0x2e')]=_0x3cc36c['outboundDropCallsDayCallersExit'];this[_0xe0bd('0x2f')]=_0x3cc36c[_0xe0bd('0x2f')];this[_0xe0bd('0xd')]=_0x3cc36c[_0xe0bd('0xd')];this[_0xe0bd('0xe')]=_0x3cc36c[_0xe0bd('0xe')];this[_0xe0bd('0x30')]=_0x3cc36c[_0xe0bd('0x30')];this['outboundReCallsDay']=_0x3cc36c['outboundReCallsDay'];this[_0xe0bd('0x10')]=_0x3cc36c[_0xe0bd('0x10')];this[_0xe0bd('0x31')]=_0x3cc36c[_0xe0bd('0x31')];this[_0xe0bd('0x32')]=_0x3cc36c['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x3cc36c['predictiveIntervalAvgHoldtime'];this[_0xe0bd('0x33')]=_0x3cc36c[_0xe0bd('0x33')];this[_0xe0bd('0x34')]=_0x3cc36c[_0xe0bd('0x34')];this[_0xe0bd('0x35')]=_0x3cc36c[_0xe0bd('0x35')];this['predictiveIntervalErlangCalls']=_0x3cc36c[_0xe0bd('0x36')];this[_0xe0bd('0x37')]=_0x3cc36c[_0xe0bd('0x37')];this['predictiveIntervalHitRate']=_0x3cc36c[_0xe0bd('0x38')];this[_0xe0bd('0x39')]=_0x3cc36c['predictiveIntervalMultiplicativeFactor'];this[_0xe0bd('0x3a')]=_0x3cc36c[_0xe0bd('0x3a')];this[_0xe0bd('0x3b')]=_0x3cc36c['predictiveIntervalAvailable'];this[_0xe0bd('0x3c')]=_0x3cc36c['predictiveIntervalTotalCalls'];this[_0xe0bd('0x7')]=_0x3cc36c[_0xe0bd('0x7')];this[_0xe0bd('0x3d')]=_0x3cc36c[_0xe0bd('0x3d')];this['erlangCallToSecond']=_0x3cc36c[_0xe0bd('0x3e')];this[_0xe0bd('0x3f')]=_0x3cc36c[_0xe0bd('0x3f')];this['erlangBusyFactor']=_0x3cc36c['erlangBusyFactor'];this[_0xe0bd('0x40')]=_0x3cc36c[_0xe0bd('0x40')];this[_0xe0bd('0x41')]=_0x3cc36c['startProgressive'];this['message']=_0x3cc36c[_0xe0bd('0x42')];this[_0xe0bd('0x43')]=_0x3cc36c[_0xe0bd('0x43')];}if(_0x3cc36c[_0xe0bd('0x44')]){this['Trunk']={'id':_0x3cc36c[_0xe0bd('0x44')]['id'],'name':_0x3cc36c[_0xe0bd('0x44')][_0xe0bd('0x14')],'active':_0x3cc36c['Trunk']['active'],'callerid':_0x3cc36c[_0xe0bd('0x44')][_0xe0bd('0x45')]};}}VoiceQueueSummary[_0xe0bd('0x46')][_0xe0bd('0x47')]=function(_0x5ada76,_0x7a2547,_0x41597a,_0x1f6e20){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xe0bd('0x2')]=0x0;this['unknown']=0x0;this[_0xe0bd('0x1b')]=0x0;this[_0xe0bd('0x5')]=0x0;this['busy']=0x0;this[_0xe0bd('0x19')]=0x0;this[_0xe0bd('0x21')]=0x0;this[_0xe0bd('0x1c')]=0x0;this['ringInUse']=0x0;this[_0xe0bd('0x1a')]=0x0;if(_0x41597a){if(_0x41597a[_0xe0bd('0x0')]){this[_0xe0bd('0x0')]=Number(_0x41597a[_0xe0bd('0x0')]);}if(_0x41597a[_0xe0bd('0x48')]){this[_0xe0bd('0x6')]=Number(_0x41597a[_0xe0bd('0x48')]);}if(_0x41597a[_0xe0bd('0x49')]){this['waiting']=Number(_0x41597a[_0xe0bd('0x49')]);}}for(var _0x7a6831=0x0;_0x7a6831<_0x5ada76[_0xe0bd('0x4a')];_0x7a6831++){var _0x381ee7=_0x7a2547[_0xe0bd('0x4b')+_0x5ada76[_0x7a6831][_0xe0bd('0x14')]];if(_0x381ee7&&_0x381ee7[_0xe0bd('0x4c')]){this[_0xe0bd('0x1')]+=0x1;}if(_0x5ada76[_0x7a6831]['incall']==='1'){this[_0xe0bd('0x3')]+=0x1;}if(_0x5ada76[_0x7a6831][_0xe0bd('0x2')]==='1'&&!['2','7','8'][_0xe0bd('0x4d')](_0x5ada76[_0x7a6831][_0xe0bd('0x4e')])){this[_0xe0bd('0x2')]+=0x1;}switch(_0x5ada76[_0x7a6831]['status']){case'0':this[_0xe0bd('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xe0bd('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xe0bd('0x1d')]+=0x1;break;case'8':this[_0xe0bd('0x1a')]+=0x1;break;}}if(this[_0xe0bd('0x26')]===_0xe0bd('0x4f')){var _0x17ed8c=Object[_0xe0bd('0x50')](_0x1f6e20);for(var _0xe2b989=0x0;_0xe2b989<_0x17ed8c[_0xe0bd('0x4a')];_0xe2b989++){var _0x137bed=_0x17ed8c[_0xe2b989];var _0x252013=_0x1f6e20[_0x137bed];if(_0x252013['queue']===this[_0xe0bd('0x14')]&&_0x252013['type']==='dialer'&&_0x252013[_0xe0bd('0x51')]===_0xe0bd('0x52')){this[_0xe0bd('0x3')]+=0x1;}}if(this['talking']>this[_0xe0bd('0x5')]){this[_0xe0bd('0x3')]=this[_0xe0bd('0x5')];}this[_0xe0bd('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xe0bd('0x46')][_0xe0bd('0x53')]=function(_0x2144cb){var _0x443c80=![];if(_0x2144cb){_0x443c80=INBOUND_COUNTERS[_0xe0bd('0x54')](function(_0x1f85ef){return this[_0x1f85ef]!==_0x2144cb[_0x1f85ef];},this);}return _0x443c80;};VoiceQueueSummary[_0xe0bd('0x46')][_0xe0bd('0x55')]=function(_0x544195){var _0x1a62ce=![];var _0xa761ae=![];var _0x530338=![];if(_0x544195){_0x1a62ce=this['dialMethod']!==_0x544195['dialMethod']||this[_0xe0bd('0x25')]!==_0x544195['dialActive']||this['message']!==_0x544195['message']||this[_0xe0bd('0x43')]!==_0x544195[_0xe0bd('0x43')];_0xa761ae=OUTBOUND_COUNTERS[_0xe0bd('0x54')](function(_0x50dd77){return this[_0x50dd77]!==_0x544195[_0x50dd77];},this);if(this['Trunk']&&_0x544195[_0xe0bd('0x44')]){_0x530338=this['Trunk'][_0xe0bd('0x14')]!==_0x544195[_0xe0bd('0x44')][_0xe0bd('0x14')]||this[_0xe0bd('0x44')][_0xe0bd('0x56')]!==_0x544195[_0xe0bd('0x44')][_0xe0bd('0x56')];}}return _0x1a62ce||_0xa761ae||_0x530338;};VoiceQueueSummary[_0xe0bd('0x46')][_0xe0bd('0x57')]=function(_0x332bfd){this[_0xe0bd('0x17')]=_0x332bfd[_0xe0bd('0x17')];this[_0xe0bd('0x42')]=_0x332bfd['message'];this[_0xe0bd('0x43')]=_0x332bfd['statusMessage'];this[_0xe0bd('0x7')]=_0x332bfd[_0xe0bd('0x7')];this[_0xe0bd('0x8')]=_0x332bfd[_0xe0bd('0x8')];this[_0xe0bd('0x9')]=_0x332bfd[_0xe0bd('0x9')];this[_0xe0bd('0xa')]=_0x332bfd[_0xe0bd('0xa')];this[_0xe0bd('0xb')]=_0x332bfd['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x332bfd['outboundCongestionCallsDay'];this[_0xe0bd('0xd')]=_0x332bfd[_0xe0bd('0xd')];this[_0xe0bd('0xe')]=_0x332bfd[_0xe0bd('0xe')];this[_0xe0bd('0xf')]=_0x332bfd[_0xe0bd('0xf')];this[_0xe0bd('0x10')]=_0x332bfd[_0xe0bd('0x10')];this[_0xe0bd('0x31')]=_0x332bfd['outboundUnknownCallsDay'];this[_0xe0bd('0x12')]=_0x332bfd['sumBillable'];this['sumDuration']=_0x332bfd[_0xe0bd('0x1e')];this[_0xe0bd('0x13')]=_0x332bfd[_0xe0bd('0x13')];if(this[_0xe0bd('0x26')]===_0xe0bd('0x58')){this[_0xe0bd('0x11')]=_0x332bfd[_0xe0bd('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x9829=['active','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','prototype','compareToInboundQueue','some','compareToOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk'];(function(_0x52bb1e,_0x47c818){var _0x15d57d=function(_0x551cd3){while(--_0x551cd3){_0x52bb1e['push'](_0x52bb1e['shift']());}};_0x15d57d(++_0x47c818);}(_0x9829,0xc4));var _0x9982=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9829[_0x160c73];return _0xd9302;};'use strict';var INBOUND_COUNTERS=[_0x9982('0x0'),_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3'),_0x9982('0x4'),'talking',_0x9982('0x5')];var OUTBOUND_COUNTERS=[_0x9982('0x0'),_0x9982('0x6'),'inUse',_0x9982('0x1'),_0x9982('0x2'),'originated','outboundAbandonedCallsDay',_0x9982('0x7'),_0x9982('0x8'),'outboundBusyCallsDay',_0x9982('0x9'),_0x9982('0xa'),_0x9982('0xb'),_0x9982('0xc'),_0x9982('0xd'),_0x9982('0xe'),_0x9982('0x3'),_0x9982('0xf'),_0x9982('0x10'),_0x9982('0x11'),_0x9982('0x12'),_0x9982('0x13'),_0x9982('0x5')];function VoiceQueueSummary(_0x31b3d8){this['id']=_0x31b3d8['id'];this[_0x9982('0x14')]=_0x31b3d8[_0x9982('0x14')];this[_0x9982('0x15')]=_0x31b3d8[_0x9982('0x15')];this['abandoned']=_0x31b3d8[_0x9982('0x16')]||0x0;this[_0x9982('0x6')]=_0x31b3d8['answered']||0x0;this[_0x9982('0x0')]=_0x31b3d8['available']||0x0;this[_0x9982('0x17')]=_0x31b3d8[_0x9982('0x17')]||0x0;this[_0x9982('0x18')]=_0x31b3d8[_0x9982('0x18')]||0x0;this[_0x9982('0x19')]=_0x31b3d8[_0x9982('0x19')]||0x0;this[_0x9982('0x1')]=_0x31b3d8[_0x9982('0x1')]||0x0;this[_0x9982('0x2')]=_0x31b3d8['loggedInDb']||0x0;this[_0x9982('0x1a')]=_0x31b3d8['onHold']||0x0;this[_0x9982('0x1b')]=_0x31b3d8[_0x9982('0x1b')]||0x0;this['paused']=_0x31b3d8[_0x9982('0x3')]||0x0;this[_0x9982('0x4')]=_0x31b3d8[_0x9982('0x4')]||0x0;this[_0x9982('0x1c')]=_0x31b3d8[_0x9982('0x1c')];this[_0x9982('0x11')]=_0x31b3d8['sumBillable'];this[_0x9982('0x12')]=_0x31b3d8[_0x9982('0x12')];this['sumHoldTime']=_0x31b3d8[_0x9982('0x1d')]||0x0;this[_0x9982('0x10')]=_0x31b3d8[_0x9982('0x10')]||0x0;this[_0x9982('0x13')]=_0x31b3d8[_0x9982('0x13')]||0x0;this[_0x9982('0x1e')]=_0x31b3d8[_0x9982('0x1e')];this[_0x9982('0x1f')]=_0x31b3d8[_0x9982('0x1f')]||0x0;this[_0x9982('0x20')]=_0x31b3d8[_0x9982('0x20')]||0x0;this[_0x9982('0x21')]=_0x31b3d8[_0x9982('0x21')]||0x0;this['waiting']=_0x31b3d8[_0x9982('0x5')]||0x0;if(_0x31b3d8[_0x9982('0x1e')]===_0x9982('0x22')){this[_0x9982('0xf')]=_0x31b3d8[_0x9982('0xf')]||0x0;this[_0x9982('0x23')]=_0x31b3d8[_0x9982('0x23')];this[_0x9982('0x24')]=_0x31b3d8[_0x9982('0x24')];this[_0x9982('0x25')]=_0x31b3d8[_0x9982('0x25')];this[_0x9982('0x26')]=_0x31b3d8[_0x9982('0x26')];this[_0x9982('0x27')]=_0x31b3d8[_0x9982('0x27')];this[_0x9982('0x28')]=_0x31b3d8[_0x9982('0x28')];this[_0x9982('0x29')]=_0x31b3d8['temp'];this['outboundAnswerAgiCallsDay']=_0x31b3d8[_0x9982('0x2a')];this[_0x9982('0x7')]=_0x31b3d8[_0x9982('0x7')];this[_0x9982('0x8')]=_0x31b3d8[_0x9982('0x8')];this[_0x9982('0x2b')]=_0x31b3d8[_0x9982('0x2b')];this[_0x9982('0x9')]=_0x31b3d8[_0x9982('0x9')];this[_0x9982('0x2c')]=_0x31b3d8[_0x9982('0x2c')];this[_0x9982('0x2d')]=_0x31b3d8['outboundDropCallsDayCallersExit'];this[_0x9982('0x2e')]=_0x31b3d8[_0x9982('0x2e')];this[_0x9982('0xa')]=_0x31b3d8[_0x9982('0xa')];this[_0x9982('0xb')]=_0x31b3d8[_0x9982('0xb')];this['outboundOriginateFailureCallsDay']=_0x31b3d8[_0x9982('0x2f')];this['outboundReCallsDay']=_0x31b3d8[_0x9982('0xc')];this[_0x9982('0xd')]=_0x31b3d8[_0x9982('0xd')];this[_0x9982('0xe')]=_0x31b3d8[_0x9982('0xe')];this[_0x9982('0x30')]=_0x31b3d8[_0x9982('0x30')];this['predictiveIntervalAvgHoldtime']=_0x31b3d8[_0x9982('0x31')];this[_0x9982('0x32')]=_0x31b3d8[_0x9982('0x32')];this[_0x9982('0x33')]=_0x31b3d8[_0x9982('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x31b3d8[_0x9982('0x34')];this['predictiveIntervalErlangCalls']=_0x31b3d8['predictiveIntervalErlangCalls'];this[_0x9982('0x35')]=_0x31b3d8[_0x9982('0x35')];this['predictiveIntervalHitRate']=_0x31b3d8[_0x9982('0x36')];this[_0x9982('0x37')]=_0x31b3d8[_0x9982('0x37')];this[_0x9982('0x38')]=_0x31b3d8[_0x9982('0x38')];this[_0x9982('0x39')]=_0x31b3d8[_0x9982('0x39')];this[_0x9982('0x3a')]=_0x31b3d8[_0x9982('0x3a')];this[_0x9982('0x3b')]=_0x31b3d8[_0x9982('0x3b')];this[_0x9982('0x3c')]=_0x31b3d8['erlangCalls'];this[_0x9982('0x3d')]=_0x31b3d8[_0x9982('0x3d')];this[_0x9982('0x3e')]=_0x31b3d8[_0x9982('0x3e')];this[_0x9982('0x3f')]=_0x31b3d8['erlangBusyFactor'];this['startPredictive']=_0x31b3d8['startPredictive'];this[_0x9982('0x40')]=_0x31b3d8[_0x9982('0x40')];this['message']=_0x31b3d8[_0x9982('0x41')];this[_0x9982('0x42')]=_0x31b3d8[_0x9982('0x42')];}if(_0x31b3d8[_0x9982('0x43')]){this['Trunk']={'id':_0x31b3d8[_0x9982('0x43')]['id'],'name':_0x31b3d8[_0x9982('0x43')][_0x9982('0x14')],'active':_0x31b3d8[_0x9982('0x43')][_0x9982('0x44')],'callerid':_0x31b3d8[_0x9982('0x43')]['callerid']};}}VoiceQueueSummary['prototype'][_0x9982('0x45')]=function(_0x3b0f1a,_0x326a0a,_0x50c23e,_0xec35bf){this[_0x9982('0x2')]=0x0;this[_0x9982('0x10')]=0x0;this['paused']=0x0;this['unknown']=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x9982('0x19')]=0x0;this['unavailable']=0x0;this[_0x9982('0x4')]=0x0;this[_0x9982('0x1c')]=0x0;this['onHold']=0x0;if(_0x50c23e){if(_0x50c23e[_0x9982('0x0')]){this[_0x9982('0x0')]=Number(_0x50c23e[_0x9982('0x0')]);}if(_0x50c23e[_0x9982('0x46')]){this[_0x9982('0x1')]=Number(_0x50c23e['loggedin']);}if(_0x50c23e[_0x9982('0x47')]){this[_0x9982('0x5')]=Number(_0x50c23e[_0x9982('0x47')]);}}for(var _0x22181b=0x0;_0x22181b<_0x3b0f1a[_0x9982('0x48')];_0x22181b++){var _0x3657a9=_0x326a0a[_0x9982('0x49')+_0x3b0f1a[_0x22181b][_0x9982('0x14')]];if(_0x3657a9&&_0x3657a9[_0x9982('0x4a')]){this['loggedInDb']+=0x1;}if(_0x3b0f1a[_0x22181b][_0x9982('0x4b')]==='1'){this['talking']+=0x1;}if(_0x3b0f1a[_0x22181b]['paused']==='1'&&!['2','7','8'][_0x9982('0x4c')](_0x3b0f1a[_0x22181b][_0x9982('0x4d')])){this['paused']+=0x1;}switch(_0x3b0f1a[_0x22181b][_0x9982('0x4d')]){case'0':this[_0x9982('0x20')]+=0x1;break;case'1':this[_0x9982('0x1b')]+=0x1;break;case'2':this[_0x9982('0x18')]+=0x1;break;case'3':this[_0x9982('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x9982('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x9982('0x1c')]+=0x1;break;case'8':this[_0x9982('0x1a')]+=0x1;break;}}if(this['dialMethod']===_0x9982('0x4e')){var _0x11d331=Object[_0x9982('0x4f')](_0xec35bf);for(var _0x46cac4=0x0;_0x46cac4<_0x11d331[_0x9982('0x48')];_0x46cac4++){var _0x53ab9b=_0x11d331[_0x46cac4];var _0x2cd2b4=_0xec35bf[_0x53ab9b];if(_0x2cd2b4[_0x9982('0x50')]===this[_0x9982('0x14')]&&_0x2cd2b4['type']==='dialer'&&_0x2cd2b4['exten']==='xcally-motion-preview'){this[_0x9982('0x10')]+=0x1;}}if(this['talking']>this[_0x9982('0x18')]){this[_0x9982('0x10')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x9982('0x51')][_0x9982('0x52')]=function(_0x219648){var _0x12ad29=![];if(_0x219648){_0x12ad29=INBOUND_COUNTERS[_0x9982('0x53')](function(_0x1aa150){return this[_0x1aa150]!==_0x219648[_0x1aa150];},this);}return _0x12ad29;};VoiceQueueSummary['prototype'][_0x9982('0x54')]=function(_0x8b9f39){var _0x4e8993=![];var _0x11d424=![];var _0x4b114e=![];if(_0x8b9f39){_0x4e8993=this[_0x9982('0x24')]!==_0x8b9f39[_0x9982('0x24')]||this['dialActive']!==_0x8b9f39[_0x9982('0x23')]||this[_0x9982('0x41')]!==_0x8b9f39[_0x9982('0x41')]||this[_0x9982('0x42')]!==_0x8b9f39[_0x9982('0x42')];_0x11d424=OUTBOUND_COUNTERS[_0x9982('0x53')](function(_0x1cc96a){return this[_0x1cc96a]!==_0x8b9f39[_0x1cc96a];},this);if(this[_0x9982('0x43')]&&_0x8b9f39[_0x9982('0x43')]){_0x4b114e=this[_0x9982('0x43')][_0x9982('0x14')]!==_0x8b9f39[_0x9982('0x43')][_0x9982('0x14')]||this[_0x9982('0x43')]['active']!==_0x8b9f39[_0x9982('0x43')][_0x9982('0x44')];}}return _0x4e8993||_0x11d424||_0x4b114e;};VoiceQueueSummary[_0x9982('0x51')]['updateReportFromOutboundQueue']=function(_0x53fcdc){this['answered']=_0x53fcdc[_0x9982('0x6')];this[_0x9982('0x41')]=_0x53fcdc[_0x9982('0x41')];this['statusMessage']=_0x53fcdc[_0x9982('0x42')];this[_0x9982('0x3b')]=_0x53fcdc['originated'];this[_0x9982('0x55')]=_0x53fcdc[_0x9982('0x55')];this[_0x9982('0x7')]=_0x53fcdc[_0x9982('0x7')];this['outboundBlacklistCallsDay']=_0x53fcdc[_0x9982('0x8')];this[_0x9982('0x2b')]=_0x53fcdc[_0x9982('0x2b')];this[_0x9982('0x9')]=_0x53fcdc['outboundCongestionCallsDay'];this[_0x9982('0xa')]=_0x53fcdc[_0x9982('0xa')];this[_0x9982('0xb')]=_0x53fcdc[_0x9982('0xb')];this[_0x9982('0xc')]=_0x53fcdc[_0x9982('0xc')];this[_0x9982('0xd')]=_0x53fcdc['outboundRejectCallsDay'];this[_0x9982('0xe')]=_0x53fcdc['outboundUnknownCallsDay'];this['sumBillable']=_0x53fcdc[_0x9982('0x11')];this[_0x9982('0x12')]=_0x53fcdc[_0x9982('0x12')];this[_0x9982('0x13')]=_0x53fcdc[_0x9982('0x13')];if(this[_0x9982('0x24')]===_0x9982('0x56')){this[_0x9982('0xf')]=_0x53fcdc[_0x9982('0xf')];}};module[_0x9982('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7d658a5..70c49bf 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 _0x366c=['name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x349751,_0x45ea3e){var _0x2c32d2=function(_0x21b920){while(--_0x21b920){_0x349751['push'](_0x349751['shift']());}};_0x2c32d2(++_0x45ea3e);}(_0x366c,0x82));var _0xc366=function(_0x16d250,_0x12f9ff){_0x16d250=_0x16d250-0x0;var _0x3c3d21=_0x366c[_0x16d250];return _0x3c3d21;};'use strict';function VtigerAccount(_0x585ac8){this['id']=_0x585ac8['id']||0x0;this[_0xc366('0x0')]=_0x585ac8[_0xc366('0x0')]||'';this['username']=_0x585ac8['username']||'';this[_0xc366('0x1')]=_0x585ac8[_0xc366('0x1')]||'';this[_0xc366('0x2')]=_0x585ac8[_0xc366('0x2')]||'';this[_0xc366('0x3')]=_0x585ac8[_0xc366('0x3')]||'';this[_0xc366('0x4')]=_0x585ac8[_0xc366('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0999=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0999,0x11f));var _0x9099=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x0999[_0x4a0e68];return _0x4fb274;};'use strict';function VtigerAccount(_0xe29fda){this['id']=_0xe29fda['id']||0x0;this[_0x9099('0x0')]=_0xe29fda['name']||'';this[_0x9099('0x1')]=_0xe29fda[_0x9099('0x1')]||'';this['accessKey']=_0xe29fda[_0x9099('0x2')]||'';this[_0x9099('0x3')]=_0xe29fda[_0x9099('0x3')]||'';this[_0x9099('0x4')]=_0xe29fda['serverUrl']||'';this[_0x9099('0x5')]=_0xe29fda[_0x9099('0x5')]||{};}module[_0x9099('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 327f8ee..533d71f 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 _0x5579=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x574aed,_0xedb8cc){var _0x2d6bd8=function(_0x999d05){while(--_0x999d05){_0x574aed['push'](_0x574aed['shift']());}};_0x2d6bd8(++_0xedb8cc);}(_0x5579,0xa4));var _0x9557=function(_0x22dd24,_0x25e4df){_0x22dd24=_0x22dd24-0x0;var _0x113a54=_0x5579[_0x22dd24];return _0x113a54;};'use strict';function ZendeskAccount(_0x11887d){this['id']=_0x11887d['id']||0x0;this[_0x9557('0x0')]=_0x11887d['name']||'';this[_0x9557('0x1')]=_0x11887d[_0x9557('0x1')]||'';this['password']=_0x11887d[_0x9557('0x2')]||'';this[_0x9557('0x3')]=_0x11887d[_0x9557('0x3')]||'';this[_0x9557('0x4')]=_0x11887d[_0x9557('0x4')]||'';this['authType']=_0x11887d[_0x9557('0x5')]||'';this[_0x9557('0x6')]=_0x11887d[_0x9557('0x6')]||_0x9557('0x7');this[_0x9557('0x8')]=_0x11887d[_0x9557('0x8')]||'';this['Configurations']=_0x11887d[_0x9557('0x9')]||{};}module[_0x9557('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x6357=['Configurations','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x5242f4,_0x1e278a){var _0x551975=function(_0x8691d5){while(--_0x8691d5){_0x5242f4['push'](_0x5242f4['shift']());}};_0x551975(++_0x1e278a);}(_0x6357,0xeb));var _0x7635=function(_0x585970,_0x197dd2){_0x585970=_0x585970-0x0;var _0xa99602=_0x6357[_0x585970];return _0xa99602;};'use strict';function ZendeskAccount(_0x181e0f){this['id']=_0x181e0f['id']||0x0;this['name']=_0x181e0f['name']||'';this['username']=_0x181e0f[_0x7635('0x0')]||'';this[_0x7635('0x1')]=_0x181e0f[_0x7635('0x1')]||'';this['token']=_0x181e0f[_0x7635('0x2')]||'';this['remoteUri']=_0x181e0f[_0x7635('0x3')]||'';this[_0x7635('0x4')]=_0x181e0f['authType']||'';this[_0x7635('0x5')]=_0x181e0f['type']||_0x7635('0x6');this[_0x7635('0x7')]=_0x181e0f[_0x7635('0x7')]||'';this[_0x7635('0x8')]=_0x181e0f[_0x7635('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 450e512..e62780b 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 _0xb17e=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x1cc190,_0x2da462){var _0x1a0778=function(_0x2370ec){while(--_0x2370ec){_0x1cc190['push'](_0x1cc190['shift']());}};_0x1a0778(++_0x2da462);}(_0xb17e,0x14b));var _0xeb17=function(_0x1533c8,_0x288d76){_0x1533c8=_0x1533c8-0x0;var _0x8bcfb1=_0xb17e[_0x1533c8];return _0x8bcfb1;};'use strict';function ZohoAccount(_0x16e905){this['id']=_0x16e905['id']||0x0;this['name']=_0x16e905[_0xeb17('0x0')]||'';this[_0xeb17('0x1')]=_0x16e905[_0xeb17('0x1')]||'';this[_0xeb17('0x2')]=_0x16e905[_0xeb17('0x2')]||'';this['zone']=_0x16e905[_0xeb17('0x3')]||'';this[_0xeb17('0x4')]=_0x16e905[_0xeb17('0x4')]||'';this[_0xeb17('0x5')]=_0x16e905[_0xeb17('0x5')]||'';this['serverUrl']=_0x16e905[_0xeb17('0x6')]||'';this[_0xeb17('0x7')]=_0x16e905[_0xeb17('0x7')]||'';this[_0xeb17('0x8')]=_0x16e905[_0xeb17('0x8')]||'';this[_0xeb17('0x9')]=_0x16e905['Configurations']||{};}module[_0xeb17('0xa')]=ZohoAccount; \ No newline at end of file +var _0x9789=['Configurations','exports','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0xf7b612,_0x1b1f82){var _0x291cd7=function(_0x353add){while(--_0x353add){_0xf7b612['push'](_0xf7b612['shift']());}};_0x291cd7(++_0x1b1f82);}(_0x9789,0xad));var _0x9978=function(_0x41e968,_0x11e59f){_0x41e968=_0x41e968-0x0;var _0x930614=_0x9789[_0x41e968];return _0x930614;};'use strict';function ZohoAccount(_0x1db27a){this['id']=_0x1db27a['id']||0x0;this['name']=_0x1db27a['name']||'';this['description']=_0x1db27a['description']||'';this[_0x9978('0x0')]=_0x1db27a[_0x9978('0x0')]||'';this[_0x9978('0x1')]=_0x1db27a[_0x9978('0x1')]||'';this[_0x9978('0x2')]=_0x1db27a[_0x9978('0x2')]||'';this['clientSecret']=_0x1db27a[_0x9978('0x3')]||'';this[_0x9978('0x4')]=_0x1db27a['serverUrl']||'';this[_0x9978('0x5')]=_0x1db27a[_0x9978('0x5')]||'';this[_0x9978('0x6')]=_0x1db27a[_0x9978('0x6')]||'';this['Configurations']=_0x1db27a[_0x9978('0x7')]||{};}module[_0x9978('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c9f35cb..7fd7f3f 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 _0x0abf=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback'];(function(_0x2b6d5d,_0xe6a33f){var _0x4d7a0d=function(_0x1dc02f){while(--_0x1dc02f){_0x2b6d5d['push'](_0x2b6d5d['shift']());}};_0x4d7a0d(++_0xe6a33f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xf0ab('0x0'));var _=require('lodash');var moment=require(_0xf0ab('0x1'));function checkNameSurname(_0x27c8c9,_0x528ef7,_0x598001){var _0x313b14='';if(!_['isNil'](_0x528ef7)&&_0xf0ab('0x2')===typeof _0x528ef7){_0x313b14+=_0x528ef7;}if(!_[_0xf0ab('0x3')](_0x598001)&&_0xf0ab('0x2')===typeof _0x598001){_0x313b14+='\x20'+_0x598001;}if(_0x313b14!==''){return _0x313b14;}return _0x27c8c9;}function Action(_0xbb1f91,_0x2ab7d6,_0x4d2ea8,_0x233afe,_0x57ff3b){this[_0xf0ab('0x4')]=_0x4d2ea8||undefined;this[_0xf0ab('0x5')]=_0xbb1f91['id'];this[_0xf0ab('0x6')]=_0x2ab7d6[_0xf0ab('0x7')];this['type']=_0x2ab7d6[_0xf0ab('0x8')];this[_0xf0ab('0x9')]=_0xf0ab('0x6');this['dialAnswer']=![];this['membername']=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?undefined:_0xbb1f91[_0xf0ab('0xa')][_0xf0ab('0x7')];this[_0xf0ab('0xb')]=this[_0xf0ab('0xc')]?util[_0xf0ab('0xd')](_0xf0ab('0xe'),this[_0xf0ab('0xc')]):_0x233afe||undefined;this['calleridname']=checkNameSurname(_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x10')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x11')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x12')]);this[_0xf0ab('0x13')]=_0xbb1f91[_0xf0ab('0x13')]||![];this[_0xf0ab('0x14')]=_0xbb1f91[_0xf0ab('0x10')];this[_0xf0ab('0x15')]=_0xbb1f91[_0xf0ab('0x15')];this[_0xf0ab('0x16')]=_0xbb1f91[_0xf0ab('0x16')]||0x0;this[_0xf0ab('0x17')]=_0xbb1f91['countcongestionretry']||0x0;this[_0xf0ab('0x18')]=_0xbb1f91[_0xf0ab('0x18')]||0x0;this[_0xf0ab('0x19')]=(_0xbb1f91[_0xf0ab('0x16')]||0x0)+(_0xbb1f91[_0xf0ab('0x17')]||0x0)+(_0xbb1f91[_0xf0ab('0x18')]||0x0)+(_0xbb1f91[_0xf0ab('0x1a')]||0x0)+(_0xbb1f91[_0xf0ab('0x1b')]||0x0)+(_0xbb1f91[_0xf0ab('0x1c')]||0x0)+(_0xbb1f91[_0xf0ab('0x1d')]||0x0)+(_0xbb1f91[_0xf0ab('0x1e')]||0x0);this[_0xf0ab('0x1a')]=_0xbb1f91[_0xf0ab('0x1a')]||0x0;this[_0xf0ab('0x1b')]=_0xbb1f91[_0xf0ab('0x1b')]||0x0;this[_0xf0ab('0x1c')]=_0xbb1f91['countabandonedretry']||0x0;this[_0xf0ab('0x1d')]=_0xbb1f91[_0xf0ab('0x1d')]||0x0;this[_0xf0ab('0x1e')]=_0xbb1f91[_0xf0ab('0x1e')]||0x0;this[_0xf0ab('0x1f')]=_0xbb1f91[_0xf0ab('0x1f')];this[_0xf0ab('0x20')]=_0xbb1f91[_0xf0ab('0x20')];this[_0xf0ab('0x21')]=_0xbb1f91[_0xf0ab('0x21')];this[_0xf0ab('0x22')]=_0xbb1f91['recallme'];this['ContactId']=_0xbb1f91['ContactId'];this[_0xf0ab('0x23')]=_0xbb1f91['ListId'];this[_0xf0ab('0x24')]=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?_0xbb1f91[_0xf0ab('0x24')]:_0xbb1f91[_0xf0ab('0xa')]['id'];this[_0xf0ab('0x25')]=_0xbb1f91[_0xf0ab('0x25')];this[_0xf0ab('0x26')]='';this['originatecalleridname']='';}Action[_0xf0ab('0x27')]['getCaller']=function(){return util['format'](_0xf0ab('0x28'),this[_0xf0ab('0x29')],this[_0xf0ab('0x2a')]);};module[_0xf0ab('0x2b')]=Action; \ No newline at end of file +var _0xa30a=['Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0x22e1c4,_0x8c4fd9){var _0x4436dc=function(_0x2c76cd){while(--_0x2c76cd){_0x22e1c4['push'](_0x22e1c4['shift']());}};_0x4436dc(++_0x8c4fd9);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xaa30('0x0'));var _=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));function checkNameSurname(_0x4dfa7e,_0x49b545,_0x1ebf61){var _0x36f517='';if(!_[_0xaa30('0x3')](_0x49b545)&&_0xaa30('0x4')===typeof _0x49b545){_0x36f517+=_0x49b545;}if(!_[_0xaa30('0x3')](_0x1ebf61)&&_0xaa30('0x4')===typeof _0x1ebf61){_0x36f517+='\x20'+_0x1ebf61;}if(_0x36f517!==''){return _0x36f517;}return _0x4dfa7e;}function Action(_0x555947,_0x347cd5,_0x4efe89,_0x8af448,_0x14fe09){this[_0xaa30('0x5')]=_0x4efe89||undefined;this['idContact']=_0x555947['id'];this[_0xaa30('0x6')]=_0x347cd5[_0xaa30('0x7')];this[_0xaa30('0x8')]=_0x347cd5[_0xaa30('0x8')];this[_0xaa30('0x9')]=_0xaa30('0x6');this['dialAnswer']=![];this['membername']=_[_0xaa30('0x3')](_0x555947['Agent'])?undefined:_0x555947[_0xaa30('0xa')][_0xaa30('0x7')];this[_0xaa30('0xb')]=this[_0xaa30('0xc')]?util['format'](_0xaa30('0xd'),this[_0xaa30('0xc')]):_0x8af448||undefined;this[_0xaa30('0xe')]=checkNameSurname(_0x555947['Contact'][_0xaa30('0xf')],_0x555947[_0xaa30('0x10')][_0xaa30('0x11')],_0x555947[_0xaa30('0x10')][_0xaa30('0x12')]);this[_0xaa30('0x13')]=_0x555947[_0xaa30('0x13')]||![];this[_0xaa30('0x14')]=_0x555947[_0xaa30('0xf')];this[_0xaa30('0x15')]=_0x555947['scheduledat'];this[_0xaa30('0x16')]=_0x555947['countbusyretry']||0x0;this['countcongestionretry']=_0x555947[_0xaa30('0x17')]||0x0;this[_0xaa30('0x18')]=_0x555947[_0xaa30('0x18')]||0x0;this['countglobal']=(_0x555947['countbusyretry']||0x0)+(_0x555947['countcongestionretry']||0x0)+(_0x555947[_0xaa30('0x18')]||0x0)+(_0x555947['countnosuchnumberretry']||0x0)+(_0x555947[_0xaa30('0x19')]||0x0)+(_0x555947[_0xaa30('0x1a')]||0x0)+(_0x555947['countmachineretry']||0x0)+(_0x555947['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x555947[_0xaa30('0x1b')]||0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=_0x555947[_0xaa30('0x1a')]||0x0;this['countmachineretry']=_0x555947[_0xaa30('0x1c')]||0x0;this[_0xaa30('0x1d')]=_0x555947[_0xaa30('0x1d')]||0x0;this[_0xaa30('0x1e')]=_0x555947[_0xaa30('0x1e')];this['callbackuniqueid']=_0x555947[_0xaa30('0x1f')];this[_0xaa30('0x20')]=_0x555947[_0xaa30('0x20')];this[_0xaa30('0x21')]=_0x555947['recallme'];this[_0xaa30('0x22')]=_0x555947[_0xaa30('0x22')];this[_0xaa30('0x23')]=_0x555947[_0xaa30('0x23')];this[_0xaa30('0x24')]=_[_0xaa30('0x3')](_0x555947['Agent'])?_0x555947[_0xaa30('0x24')]:_0x555947[_0xaa30('0xa')]['id'];this['VoiceQueueId']=_0x555947[_0xaa30('0x25')];this['originatecalleridnum']='';this[_0xaa30('0x26')]='';}Action[_0xaa30('0x27')][_0xaa30('0x28')]=function(){return util[_0xaa30('0x29')](_0xaa30('0x2a'),this[_0xaa30('0xe')],this[_0xaa30('0x2b')]);};module[_0xaa30('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a2edb27..c3ea1f6 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 _0x562f=['[callProgressDetectingCustomer][logNoAnswer]','cloneAction','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','decrementOriginate','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','phone','VoiceQueueId','agents','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','called','logger','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','Contact','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','transfer','[syncHangup][talking][transfer]','variables','filterKey','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','ioredis','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','CAMPAIGN_STATUS','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','preview','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','message','NO_AGENTS_LOGGED','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','buildObj','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','info','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','decrementTalking','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','countglobal','Busy','custom:agentbusy','busy','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency'];(function(_0xc10c59,_0x2a3cad){var _0x122809=function(_0x3e8e30){while(--_0x3e8e30){_0xc10c59['push'](_0xc10c59['shift']());}};_0x122809(++_0x2a3cad);}(_0x562f,0x1b8));var _0xf562=function(_0x5d0eb8,_0x40c598){_0x5d0eb8=_0x5d0eb8-0x0;var _0x32d89b=_0x562f[_0x5d0eb8];return _0x32d89b;};'use strict';var util=require(_0xf562('0x0'));var _=require(_0xf562('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0xf562('0x2'));var config=require('../../../config/environment');var logger=require(_0xf562('0x3'))('preview');var loggerAction=require(_0xf562('0x3'))(_0xf562('0x4'));var ami=require('../ami');var rpcDb=require(_0xf562('0x5'));var cmHopperAdditionalPhone=require(_0xf562('0x6'));var Action=require(_0xf562('0x7'));var ut=require(_0xf562('0x8'));var utils=require('../dialer/utils');config[_0xf562('0x9')]=_[_0xf562('0xa')](config[_0xf562('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf562('0x9')]));var Sequence=function(){};Sequence['prototype'][_0xf562('0xb')]=function(_0x50616d){this[_0xf562('0xc')]=this['tail']?this[_0xf562('0xc')]['finally'](_0x50616d):_0x50616d();};function Preview(_0x12fe1b){this[_0xf562('0xd')]=new Sequence();this[_0xf562('0xe')]=_0x12fe1b[_0xf562('0xf')];this[_0xf562('0x10')]=_0x12fe1b['trunks'];this[_0xf562('0x11')]={};this['agents']=_0x12fe1b['agents'];this[_0xf562('0x12')]=0x0;ami['on'](_0xf562('0x13'),this['syncOriginateResponse'][_0xf562('0x14')](this));ami['on'](_0xf562('0x15'),this[_0xf562('0x16')]['bind'](this));ami['on'](_0xf562('0x17'),this[_0xf562('0x18')]['bind'](this));ami['on'](_0xf562('0x19'),this[_0xf562('0x1a')][_0xf562('0x14')](this));ami['on'](_0xf562('0x1b'),this[_0xf562('0x1c')][_0xf562('0x14')](this));ami['on'](_0xf562('0x1d'),this['syncVarSet'][_0xf562('0x14')](this));ami['on'](_0xf562('0x1e'),this[_0xf562('0x1f')]['bind'](this));ami['on']('blindtransfer',this[_0xf562('0x20')]['bind'](this));this[_0xf562('0x21')](this['campaignsPreview']);}function emit(_0x379df5,_0x4747a1,_0x5bfcac){io['to'](_0x379df5)[_0xf562('0x22')](_0x4747a1,_0x5bfcac);}function emitVoiceQueueChannelRemove(_0x5c8553){logger['info'](_0xf562('0x23'),JSON[_0xf562('0x24')](_0x5c8553));emit(util[_0xf562('0x25')](_0xf562('0x26'),_0x5c8553[_0xf562('0x27')]),_0xf562('0x28'),_0x5c8553);io[_0xf562('0x22')](_0xf562('0x29'),_0x5c8553);}function notSendMessagesQueue(_0x18b7dd){if(_0x18b7dd['sendMessageOneNotActive']){if(_0x18b7dd[_0xf562('0x2a')]===0x0&&_0x18b7dd[_0xf562('0x2b')]===0x0){_0x18b7dd[_0xf562('0x2c')]=![];_0x18b7dd['available']=0x0;_0x18b7dd['paused']=0x0;_0x18b7dd['message']=utils[_0xf562('0x2d')]['INACTIVE'];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x18b7dd[_0xf562('0x27')]+_0xf562('0x2e'));}else{_0x18b7dd['message']=utils['CAMPAIGN_STATUS'][_0xf562('0x2f')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x18b7dd[_0xf562('0x27')]+_0xf562('0x30'));}}}Preview[_0xf562('0x31')]['loopCampaigns']=function(){var _0x4aa6e3=this;setInterval(function(){_0x4aa6e3['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xf562('0x32')]=function(){var _0x361520=this[_0xf562('0xe')];this[_0xf562('0x12')]+=0x1;for(var _0x86b16d in _0x361520){if(_0x361520['hasOwnProperty'](_0x86b16d)&&(_0x361520[_0x86b16d][_0xf562('0x33')]===_0xf562('0x34')||_0x361520[_0x86b16d][_0xf562('0x33')]===_0xf562('0x35'))&&_0x361520[_0x86b16d][_0xf562('0x36')]===_0xf562('0x37')){if(this[_0xf562('0x12')]>0x7){this[_0xf562('0x12')]=0x0;this[_0xf562('0x38')]();}}if(_0x361520[_0xf562('0x39')](_0x86b16d)&&_0x361520[_0x86b16d][_0xf562('0x33')]==='preview'&&_0x361520[_0x86b16d]['type']===_0xf562('0x37')){if(_0x361520[_0x86b16d][_0xf562('0x3a')]){this['setMessage'](_0x361520[_0x86b16d]);if(_0x361520[_0x86b16d][_0xf562('0x3b')])this[_0xf562('0x3c')](_0x361520[_0x86b16d]);}else{notSendMessagesQueue(_0x361520[_0x86b16d]);}}}};Preview['prototype'][_0xf562('0x3d')]=function(_0x4860a6){var _0x28000e=this;this['sequence'][_0xf562('0xb')](function(){if(!_[_0xf562('0x3e')](_0x28000e['actions'][_0x4860a6])){loggerAction['info'](_0xf562('0x3f'),_0x4860a6,_0xf562('0x40'),_0x28000e[_0xf562('0x11')][_0x4860a6][_0xf562('0x41')],_0xf562('0x42'),JSON[_0xf562('0x24')](_0x28000e[_0xf562('0xe')][_0x28000e[_0xf562('0x11')][_0x4860a6][_0xf562('0x41')]]['originated']),_0xf562('0x43'),JSON[_0xf562('0x24')](_0x28000e['campaignsPreview'][_0x28000e['actions'][_0x4860a6][_0xf562('0x41')]][_0xf562('0x2b')]),JSON[_0xf562('0x24')](_0x28000e[_0xf562('0x11')][_0x4860a6][_0xf562('0x44')]),JSON[_0xf562('0x24')](_[_0xf562('0x45')](_0x28000e['actions'][_0x4860a6],[_0xf562('0x46'),_0xf562('0x47'),'VoiceQueueId',_0xf562('0x48')])));return ami[_0xf562('0x49')]({'action':_0xf562('0x4a'),'channel':_0x28000e['actions'][_0x4860a6][_0xf562('0x4b')]})[_0xf562('0x4c')](function(_0xed0e33){if(_0xed0e33['message']===_0xf562('0x4d')){setTimeout(function(){if(_0x28000e[_0xf562('0x11')][_0x4860a6]){utils['decrementOriginate'](_0x28000e[_0xf562('0xe')][_0x28000e['actions'][_0x4860a6]['queue']],_0xf562('0x4e'));if(_0x28000e[_0xf562('0x11')][_0x4860a6][_0xf562('0x44')]===!![]){ut['decrementTalking'](_0x28000e[_0xf562('0xe')][_0x28000e[_0xf562('0x11')][_0x4860a6]['queue']],_0xf562('0x4e'));ut[_0xf562('0x4f')](_0xf562('0x50')+_0x4860a6,_0x28000e[_0xf562('0x11')][_0x4860a6]['queue']);}ut[_0xf562('0x4f')]('[Dialer][checkChannel][Preview]'+_0x4860a6,_0x28000e[_0xf562('0x11')][_0x4860a6][_0xf562('0x41')]);delete _0x28000e[_0xf562('0x11')][_0x4860a6];}},0x2328);}});}});};Preview[_0xf562('0x31')][_0xf562('0x38')]=function(){var _0x177a76=this;loggerAction['info'](_0xf562('0x51'),_[_0xf562('0x52')](this[_0xf562('0x11')]));for(var _0x90f57c in this[_0xf562('0x11')]){if(_0x177a76[_0xf562('0x11')][_0xf562('0x39')](_0x90f57c)){_0x177a76[_0xf562('0x3d')](_0x90f57c);}}};Preview[_0xf562('0x31')][_0xf562('0x3c')]=function(_0x5d3212){var _0xf6b52=this;rpcDb['getContactRecallMe'](_0x5d3212['id'],ut[_0xf562('0x53')](this['agents']))[_0xf562('0x54')](function(_0x3e78a2){if(!_[_0xf562('0x3e')](_0x3e78a2)){for(var _0x5ce168=0x0;_0x5ce168<_0x3e78a2['length'];_0x5ce168+=0x1){if(ut[_0xf562('0x55')](_0x3e78a2[_0x5ce168][_0xf562('0x56')])<_0x5d3212[_0xf562('0x57')]*0x3c){if(_0x3e78a2[_0x5ce168][_0xf562('0x58')]&&!_0x3e78a2[_0x5ce168][_0xf562('0x58')][_0xf562('0x59')]){_0xf6b52[_0xf562('0x5a')](_0x3e78a2[_0x5ce168]['id'])[_0xf562('0x54')](ut['logger2'](_0xf562('0x5b')))[_0xf562('0x4c')](ut[_0xf562('0x5c')](_0xf562('0x5b')));}else{rpcDb[_0xf562('0x5d')](_0x3e78a2[_0x5ce168]['id']);}}else{var _0x5d3cd3=new Action(_0x3e78a2[_0x5ce168],_0x5d3212);_0x5d3cd3[_0xf562('0x5e')]=moment()[_0xf562('0x25')](_0xf562('0x5f'));_0x5d3212[_0xf562('0x60')]+=0x1;ut[_0xf562('0x61')](_0x5d3cd3,0x17,_0xf562('0x62'));if(_0x5d3212[_0xf562('0x63')]){rpcDb['rescheduleContactInQueue'](ut[_0xf562('0x64')](_0x3e78a2[_0x5ce168]));rpcDb[_0xf562('0x65')](_0x5d3cd3,_0xf562('0x66'));}else{ut[_0xf562('0x61')](_0x5d3cd3,0x16,_0xf562('0x67'));rpcDb[_0xf562('0x65')](_0x5d3cd3,'[HistoryRecallClose]');rpcDb[_0xf562('0x68')](_0x5d3cd3,_0xf562('0x69'));}}}}})[_0xf562('0x4c')](ut['logger2'](_0xf562('0x6a')));};Preview[_0xf562('0x31')]['setMessage']=function(_0x1239f8){_0x1239f8['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x1239f8['loggedIn'])){_0x1239f8[_0xf562('0x6b')]=utils[_0xf562('0x2d')][_0xf562('0x6c')];}else if(!ut[_0xf562('0x6d')](_0x1239f8[_0xf562('0x3a')])){_0x1239f8[_0xf562('0x6b')]=utils['CAMPAIGN_STATUS'][_0xf562('0x6e')];}else if(!this[_0xf562('0x6f')](_0x1239f8[_0xf562('0x70')])){if(!this[_0xf562('0x6f')](_0x1239f8[_0xf562('0x71')])){_0x1239f8[_0xf562('0x6b')]=utils[_0xf562('0x2d')]['UNREACHABLE_TRUNK'];}else{_0x1239f8['message']=utils[_0xf562('0x2d')]['ACTIVE'];}}else{_0x1239f8[_0xf562('0x6b')]=utils[_0xf562('0x2d')][_0xf562('0x72')];}};Preview['prototype'][_0xf562('0x73')]=function(_0x540c79,_0x1014a3,_0x250894){var _0x216bdd=this;var _0x326af0=this[_0xf562('0x11')][_0x1014a3];var _0x12927d=this['campaignsPreview'][_0x326af0[_0xf562('0x41')]];var _0x525977;var _0x54d3f2=![];var _0x219362=0x2;var _0x139731=0x3;if(_0x12927d){switch(_0x250894){case'1':_0x12927d['outboundNoSuchCallsDay']+=0x1;_0x326af0[_0xf562('0x74')]+=0x1;_0x326af0['countglobal']=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x0,_0xf562('0x76'));ami['emit']('custom:agentnosuchnumber',ut[_0xf562('0x77')](_0x326af0,'nosuchnumber'));rpcDb[_0xf562('0x65')](_0x326af0,'[callProgressDetectingCustomer][logNoSuch]');_0x216bdd[_0xf562('0x78')](_0x326af0,'0',_0x12927d)[_0xf562('0x54')](function(_0x342d6b){_0x54d3f2=_0x342d6b['additional']==0x1;_0x219362=_0x12927d[_0xf562('0x79')];_0x139731=_0x12927d[_0xf562('0x7a')];if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut['cloneAction'](_0x326af0,0xf,_0xf562('0x7c'));rpcDb['createCustomerFinal'](_0x525977,_0xf562('0x7d'));}else{if(_0x326af0['countnosuchnumberretry']>=_0x12927d[_0xf562('0x7e')]){rpcDb[_0xf562('0x68')](_0x326af0,_0xf562('0x7d'));}else{rpcDb[_0xf562('0x7f')](ut[_0xf562('0x80')](_0x326af0,'countnosuchnumberretry',_0x12927d[_0xf562('0x79')]),_0x326af0[_0xf562('0x81')],_0x326af0[_0xf562('0x82')]);}}delete this[_0xf562('0x11')][_0x540c79[_0xf562('0x83')]];}else{_0x326af0[_0xf562('0x74')]++;logger[_0xf562('0x84')](_0xf562('0x85'),_0x326af0[_0xf562('0x74')]);logger['info']('id',_0x326af0[_0xf562('0x86')]);_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnosuchnumberretry':_0x326af0[_0xf562('0x74')]}})[_0xf562('0x54')](function(){_0x216bdd['swapAdditionalPhones'](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});break;case _0xf562('0x88'):var _0x302265=moment()[_0xf562('0x25')](_0xf562('0x5f'));_0x326af0[_0xf562('0x89')]=_0x302265;_0x326af0['answertime']=_0x302265;_0x326af0[_0xf562('0x44')]=!![];_0x12927d[_0xf562('0x2b')]+=0x1;logger[_0xf562('0x84')](_0xf562('0x8a'),_0x326af0[_0xf562('0x8b')],'\x20Queue',_0x12927d['name'],'pTalking:\x20',_0x12927d['pTalking']);ami[_0xf562('0x22')](_0xf562('0x8c'),ut['buildObj'](_0x326af0,_0xf562('0x8d'),this['campaignsPreview'][_0x326af0[_0xf562('0x41')]]));if(_0x12927d[_0xf562('0x8e')]||_0x12927d['mandatoryDisposition']){ami[_0xf562('0x22')]('custom:agentConnectPreview',{'queue':_0x326af0[_0xf562('0x41')],'interface':_0x326af0[_0xf562('0x8f')],'uniqueid':_0x326af0['uniqueid']});}break;case'16':ami[_0xf562('0x22')](_0xf562('0x90'),ut['buildObj'](_0x326af0,_0xf562('0x91'),this[_0xf562('0xe')][_0x326af0[_0xf562('0x41')]]));emitVoiceQueueChannelRemove(ut[_0xf562('0x77')](_0x326af0,'complete'));_0x12927d[_0xf562('0x92')]+=0x1;_0x12927d[_0xf562('0x93')]+=0x1;_0x12927d['answered']+=0x1;ut[_0xf562('0x94')](_0x12927d,_0xf562('0x95'));_0x326af0['countglobal']=ut['totalGlobal'](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x4,'Answer');rpcDb[_0xf562('0x65')](_0x326af0,_0xf562('0x96'));rpcDb[_0xf562('0x68')](_0x326af0,_0xf562('0x97'));rpcDb[_0xf562('0x98')](_0x326af0);_0x12927d[_0xf562('0x99')]+=_0x326af0[_0xf562('0x9a')];_0x12927d[_0xf562('0x9b')]+=_0x326af0[_0xf562('0x9a')];logger[_0xf562('0x84')](_0xf562('0x9c'),_0x326af0[_0xf562('0x8b')],_0xf562('0x9d'),_0x12927d[_0xf562('0x27')],'pTalking:\x20',_0x12927d[_0xf562('0x2b')]);delete this['actions'][_0x540c79[_0xf562('0x83')]];break;case'BUSY':_0x12927d[_0xf562('0x9e')]+=0x1;_0x326af0[_0xf562('0x9f')]+=0x1;_0x326af0[_0xf562('0xa0')]=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x5,_0xf562('0xa1'));_0x219362=_0x12927d['dialBusyRetryFrequency'];_0x139731=_0x12927d['callAdditionalPhoneAfterMin'];ami['emit'](_0xf562('0xa2'),ut['buildObj'](_0x326af0,_0xf562('0xa3')));rpcDb[_0xf562('0x65')](_0x326af0,'[callProgressDetectingCustomer][logBusy]');_0x216bdd[_0xf562('0x78')](_0x326af0,'5',_0x12927d)[_0xf562('0x54')](function(_0x26bc65){_0x54d3f2=_0x26bc65[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut['totalGlobal'](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut['cloneAction'](_0x326af0,0xf,_0xf562('0x7c'));rpcDb['createCustomerFinal'](_0x525977,_0xf562('0xa5'));}else{if(_0x326af0[_0xf562('0x9f')]>=_0x12927d[_0xf562('0xa6')]){rpcDb['createCustomerFinal'](_0x326af0,_0xf562('0xa7'));}else{rpcDb[_0xf562('0x7f')](ut[_0xf562('0x80')](_0x326af0,'countbusyretry',_0x12927d[_0xf562('0xa8')]),_0x326af0[_0xf562('0x81')],_0x326af0['activeContact']);}}}else{_0x326af0[_0xf562('0x9f')]++;_0x216bdd['incrementPreviewCounters']({'id':_0x326af0[_0xf562('0x86')],'field':{'countbusyretry':_0x326af0[_0xf562('0x9f')]}})[_0xf562('0x54')](function(){_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});break;case _0xf562('0xaa'):_0x12927d[_0xf562('0xab')]+=0x1;_0x326af0['countnoanswerretry']+=0x1;_0x326af0[_0xf562('0xa0')]=ut['totalGlobal'](_0x326af0);ut['logCustomer'](_0x326af0,0x3,_0xf562('0xac'));_0x219362=_0x12927d[_0xf562('0xad')];_0x139731=_0x12927d[_0xf562('0x7a')];var _0x1e40f6=ut['buildNoAnswerEventPayload'](_0x326af0,_0x12927d);ami[_0xf562('0x22')]('custom:agentnoanswer',_0x1e40f6);rpcDb['createCustomerHistory'](_0x326af0,_0xf562('0xae'));_0x216bdd[_0xf562('0x78')](_0x326af0,'3',_0x12927d)[_0xf562('0x54')](function(_0x39de1b){_0x54d3f2=_0x39de1b[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut[_0xf562('0xaf')](_0x326af0,0xf,_0xf562('0x7c'));rpcDb[_0xf562('0x68')](_0x525977,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x326af0[_0xf562('0xb0')]>=_0x12927d[_0xf562('0xb1')]){rpcDb['createCustomerFinal'](_0x326af0,_0xf562('0xae'));}else{rpcDb[_0xf562('0x7f')](ut[_0xf562('0x80')](_0x326af0,_0xf562('0xb0'),_0x12927d[_0xf562('0xad')]),_0x326af0[_0xf562('0x81')],_0x326af0['activeContact']);}}}else{_0x326af0[_0xf562('0xb0')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnoanswerretry':_0x326af0['countnoanswerretry']}})[_0xf562('0x54')](function(){_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});break;case _0xf562('0xb2'):_0x12927d['outboundCongestionCallsDay']+=0x1;_0x326af0[_0xf562('0xb3')]+=0x1;_0x326af0[_0xf562('0xa0')]=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x8,_0xf562('0xb4'));_0x219362=_0x12927d[_0xf562('0xb5')];_0x139731=_0x12927d['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0xf562('0x77')](_0x326af0,_0xf562('0xb6')));rpcDb['createCustomerHistory'](_0x326af0,_0xf562('0xb7'));_0x216bdd[_0xf562('0x78')](_0x326af0,'8',_0x12927d)[_0xf562('0x54')](function(_0x263f70){_0x54d3f2=_0x263f70[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut['cloneAction'](_0x326af0,0xf,_0xf562('0x7c'));rpcDb['createCustomerFinal'](_0x525977,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x326af0[_0xf562('0xb3')]>=_0x12927d['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x326af0,_0xf562('0xb7'));}else{rpcDb['rescheduleContact'](ut[_0xf562('0x80')](_0x326af0,_0xf562('0xb3'),_0x12927d[_0xf562('0xa8')]),_0x326af0[_0xf562('0x81')],_0x326af0['activeContact']);}}}else{_0x326af0[_0xf562('0xb3')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0['idContact'],'field':{'countcongestionretry':_0x326af0[_0xf562('0xb3')]}})[_0xf562('0x54')](function(){_0x216bdd['swapAdditionalPhones'](_0x326af0,_0x219362,_0x139731)['then'](function(){});});}});break;case'CANCEL':_0x12927d[_0xf562('0xb8')]+=0x1;_0x326af0[_0xf562('0xb9')]+=0x1;_0x326af0[_0xf562('0xa0')]=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x14,_0xf562('0xba'));_0x219362=_0x12927d['dialAgentRejectRetryFrequency'];_0x139731=_0x12927d[_0xf562('0x7a')];ami[_0xf562('0x22')](_0xf562('0xbb'),ut['buildObj'](_0x326af0,_0xf562('0xbc')));rpcDb['createCustomerHistory'](_0x326af0,_0xf562('0xbd'));_0x216bdd['verifyAdditionalPhones'](_0x326af0,'20',_0x12927d)[_0xf562('0x54')](function(_0x4590a3){_0x54d3f2=_0x4590a3[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut[_0xf562('0xaf')](_0x326af0,0x14,_0xf562('0xba'));rpcDb[_0xf562('0x68')](_0x525977,_0xf562('0xbe'));}else{if(_0x326af0[_0xf562('0xb9')]>=_0x12927d['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x326af0,_0xf562('0xbe'));}else{rpcDb[_0xf562('0x7f')](ut['scheduledAt'](_0x326af0,_0xf562('0xb9'),_0x12927d[_0xf562('0xbf')]),_0x326af0[_0xf562('0x81')],_0x326af0[_0xf562('0x82')]);}}}else{_0x326af0[_0xf562('0xb0')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnoanswerretry':_0x326af0[_0xf562('0xb0')]}})[_0xf562('0x54')](function(){_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});break;case _0xf562('0xc0'):_0x12927d['outboundAbandonedCallsDay']+=0x1;_0x326af0[_0xf562('0xc1')]+=0x1;_0x326af0[_0xf562('0xa0')]=ut['totalGlobal'](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0xb,_0xf562('0xc2'));rpcDb[_0xf562('0x65')](_0x326af0,_0xf562('0xc3'));_0x216bdd['verifyAdditionalPhones'](_0x326af0,'11',_0x12927d)['then'](function(_0x4d8e4c){_0x54d3f2=_0x4d8e4c[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d['dialGlobalMaxRetry']){_0x525977=ut['cloneAction'](_0x326af0,0xf,_0xf562('0x7c'));rpcDb[_0xf562('0x68')](_0x525977,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x326af0['countabandonedetry']>=_0x12927d['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x326af0,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xf562('0x7f')](ut['scheduledAt'](_0x326af0,_0xf562('0xc1'),_0x12927d[_0xf562('0xc4')]),_0x326af0[_0xf562('0x81')],_0x326af0[_0xf562('0x82')]);}}}else{_0x326af0[_0xf562('0xb0')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnoanswerretry':_0x326af0['countnoanswerretry']}})[_0xf562('0x54')](function(){_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});break;case'18':_0x12927d[_0xf562('0xc5')]+=0x1;_0x326af0['countmachineretry']+=0x1;_0x326af0['countglobal']=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x12,_0x540c79[_0xf562('0xc6')]||_0x540c79[_0xf562('0xc7')]);ami[_0xf562('0x22')]('custom:amd',ut['buildObj'](_0x326af0,_0xf562('0xc8')));rpcDb['createCustomerHistory'](_0x326af0,_0xf562('0xc9'));_0x216bdd['verifyAdditionalPhones'](_0x326af0,'18',_0x12927d)[_0xf562('0x54')](function(_0x23c40f){_0x54d3f2=_0x23c40f[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut[_0xf562('0xaf')](_0x326af0,0x12,'Global');rpcDb[_0xf562('0x68')](_0x525977,_0xf562('0xc9'));}else{rpcDb[_0xf562('0x68')](_0x326af0,_0xf562('0xc9'));}}else{_0x326af0[_0xf562('0xb0')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnoanswerretry':_0x326af0[_0xf562('0xb0')]}})[_0xf562('0x54')](function(){_0x216bdd['swapAdditionalPhones'](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});delete this[_0xf562('0x11')][_0x540c79[_0xf562('0x83')]];break;case'19':_0x12927d[_0xf562('0xc5')]+=0x1;_0x326af0[_0xf562('0xa0')]=ut['totalGlobal'](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0x13,_0x540c79['cause-txt']||_0x540c79[_0xf562('0xc7')]);ami[_0xf562('0x22')](_0xf562('0xca'),ut[_0xf562('0x77')](_0x326af0,_0xf562('0xc8')));rpcDb[_0xf562('0x65')](_0x326af0,_0xf562('0xcb'));_0x216bdd['verifyAdditionalPhones'](_0x326af0,'18',_0x12927d)[_0xf562('0x54')](function(_0x5794a3){_0x54d3f2=_0x5794a3[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut[_0xf562('0xaf')](_0x326af0,0xf,_0xf562('0x7c'));rpcDb[_0xf562('0x68')](_0x525977,_0xf562('0xcb'));}else{rpcDb['createCustomerFinal'](_0x326af0,_0xf562('0xcb'));}}else{_0x326af0[_0xf562('0xb0')]++;_0x216bdd[_0xf562('0x87')]({'id':_0x326af0[_0xf562('0x86')],'field':{'countnoanswerretry':_0x326af0['countnoanswerretry']}})['then'](function(){_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});});}});delete this[_0xf562('0x11')][_0x540c79[_0xf562('0x83')]];break;default:if(_0x326af0['dialAnswer']){ut['decrementTalking'](_0x12927d,_0xf562('0xcc'));ut[_0xf562('0x4f')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x12927d[_0xf562('0x27')],_0x540c79);}_0x12927d['outboundUnknownCallsDay']+=0x1;_0x326af0[_0xf562('0xa0')]=ut[_0xf562('0x75')](_0x326af0);ut[_0xf562('0x61')](_0x326af0,0xc,_0x540c79[_0xf562('0xc6')]||_0x540c79['dialstatus']);_0x219362=_0x12927d[_0xf562('0xbf')];_0x139731=_0x12927d[_0xf562('0x7a')];rpcDb[_0xf562('0x65')](_0x326af0,'[callProgressDetectingCustomer][logUnknown]');_0x216bdd[_0xf562('0x78')](_0x326af0,'20',_0x12927d)[_0xf562('0x54')](function(_0xaf6625){_0x54d3f2=_0xaf6625[_0xf562('0xa4')]==0x1;if(!_0x54d3f2){if(ut[_0xf562('0x75')](_0x326af0)>=_0x12927d[_0xf562('0x7b')]){_0x525977=ut[_0xf562('0xaf')](_0x326af0,0xf,_0xf562('0x7c'));rpcDb[_0xf562('0x68')](_0x525977,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf562('0x68')](_0x326af0,_0xf562('0xcd'));}delete this[_0xf562('0x11')][_0x540c79['linkedid']];}else{_0x216bdd[_0xf562('0xa9')](_0x326af0,_0x219362,_0x139731)[_0xf562('0x54')](function(){});}});}if(!(_0x326af0[_0xf562('0x44')]&&_0x250894==='16')){utils['decrementOriginate'](_0x12927d,'[callProgressDetectingCustomer]');logger[_0xf562('0x84')]('[originated][decrement][callProgressDetectingCustomer]',_0x326af0[_0xf562('0x8b')],'\x20Queue',_0x12927d[_0xf562('0x27')],_0xf562('0x42'),_0x12927d[_0xf562('0x2a')]);}if(_0x250894!==_0xf562('0x88')){delete this['actions'][_0x540c79['linkedid']];delete this[_0xf562('0x11')][_0x540c79[_0xf562('0xce')]];}_0x12927d['queueSummaryCountersUpdated']=!![];}};Preview[_0xf562('0x31')][_0xf562('0xcf')]=function(_0x5317c1,_0x341611,_0x545487){if(_['isUndefined'](_0x341611)&&_0xf562('0xd0')!==typeof _0x341611){return;}if(_[_0xf562('0xd1')](_0x545487)&&'object'!==typeof _0x545487){return;}switch(_0x545487['reason']){case'0':ut[_0xf562('0xd2')](_0x5317c1,0x0,_0xf562('0x76'));rpcDb[_0xf562('0xd3')](_0x5317c1,_0xf562('0xd4'));break;case'3':ut[_0xf562('0xd2')](_0x5317c1,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x5317c1,_0xf562('0xd5'));break;case'5':ut['logAgent'](_0x5317c1,0x5,'Busy');rpcDb[_0xf562('0xd3')](_0x5317c1,_0xf562('0xd6'));break;case'8':ut[_0xf562('0xd2')](_0x5317c1,0x8,_0xf562('0xb4'));rpcDb['createAgentHistory'](_0x5317c1,_0xf562('0xd7'));break;case'22':ut[_0xf562('0xd2')](_0x5317c1,0x16,_0xf562('0xd8'));rpcDb[_0xf562('0xd3')](_0x5317c1,_0xf562('0xd9'));break;default:ut[_0xf562('0xd2')](_0x5317c1,0xc,_0x545487[_0xf562('0xda')]);rpcDb['createAgentHistory'](_0x5317c1,_0xf562('0xd7'));}utils[_0xf562('0xdb')](_0x341611,_0xf562('0xdc'));logger[_0xf562('0x84')]('[originated][decrement][callProgressDetectingAgent]',_0x5317c1[_0xf562('0x8b')],_0xf562('0x9d'),_0x341611['name'],'originated:\x20',_0x341611['originated']);delete this[_0xf562('0x11')][_0x5317c1[_0xf562('0x8b')]];};Preview[_0xf562('0x31')][_0xf562('0x78')]=function(_0x5d1057,_0x52add3,_0x1885be){return cmHopperAdditionalPhone[_0xf562('0x78')](_0x5d1057,_0x52add3,_0x1885be)[_0xf562('0x4c')](logger[_0xf562('0x84')](_0xf562('0xdd')));};Preview['prototype']['swapAdditionalPhones']=function(_0x20d062,_0x527a91,_0x418790){return cmHopperAdditionalPhone[_0xf562('0xa9')](_0x20d062,_0x527a91,_0x418790)['catch'](logger[_0xf562('0x84')](_0xf562('0xde')));};Preview[_0xf562('0x31')][_0xf562('0x87')]=function(_0x1eb76e){return Promise[_0xf562('0xdf')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1eb76e))[_0xf562('0x4c')](logger[_0xf562('0x84')]('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0xf562('0xe0')]=function(_0x32de67,_0x6cfcc9,_0x3ad388,_0x402372,_0x5ce445){var _0x3eba86=this;return new Promise(function(_0x410e77,_0x3d327f){if(_[_0xf562('0x3e')](_0x6cfcc9)||_[_0xf562('0x3e')](_0x6cfcc9['Contact'])||_[_0xf562('0x3e')](_0x6cfcc9[_0xf562('0xe1')])||_[_0xf562('0x3e')](_0x6cfcc9[_0xf562('0xe2')])){_0x3d327f(ut[_0xf562('0x6b')]('Contact\x20is\x20undefined',_0x402372,_0x5ce445));return;}var _0xd3fcc5=uuid['v4']();var _0x4b3979=_0x3eba86[_0xf562('0xe')][_0x6cfcc9['Queue'][_0xf562('0x27')]];var _0x194190=_0x3ad388?_0x3eba86[_0xf562('0xe3')][_0x3ad388]['id']:undefined;_0x3eba86[_0xf562('0x11')][_0xd3fcc5]=new Action(_0x6cfcc9,_0x4b3979,_0xd3fcc5,_0x3ad388,_0x194190);var _0x1f3380=_0x3eba86[_0xf562('0x11')][_0xd3fcc5];_0x1f3380[_0xf562('0x81')]=_0x402372;_0x1f3380[_0xf562('0x82')]=_0x5ce445;_0x1f3380[_0xf562('0xe4')]=_0x3ad388;if(_['isEmpty'](_0x32de67)){_0x3eba86[_0xf562('0xe5')](_0x1f3380,_0x4b3979,_0x6cfcc9,_0x3ad388)[_0xf562('0x54')](function(_0x57348b){logger['info'](_0xf562('0xe6'),_0xf562('0xe7')+_0x1f3380[_0xf562('0x41')]+'\x20IdHopper:\x20'+_0x1f3380[_0xf562('0x86')],JSON['stringify'](_0x57348b));ami['emit']('custom:agentcalled',ut[_0xf562('0x77')](_0x1f3380,_0xf562('0xe8'),_0x3eba86['campaignsPreview'][_0x1f3380[_0xf562('0x41')]]));_0x410e77(ut[_0xf562('0x6b')]('Calling'));})[_0xf562('0x4c')](function(_0x3a4422){ut[_0xf562('0xe9')]('[Preview][execCall][failure]',_0x3a4422);_0x3d327f(ut[_0xf562('0x6b')](_0xf562('0xea'),_0x402372,_0x5ce445));});}else{_0x4b3979[_0xf562('0xeb')]+=0x1;ut['logBlacklist'](_0x1f3380);rpcDb[_0xf562('0xec')](_0x1f3380,_0xf562('0xed'));delete _0x3eba86[_0xf562('0x11')][_0xd3fcc5];_0x3d327f(ut[_0xf562('0x6b')](_0xf562('0xee'),_0x402372,_0x5ce445));}});};Preview['prototype'][_0xf562('0x6f')]=function(_0x23bcdc){return!_[_0xf562('0x3e')](_0x23bcdc)&&!_[_0xf562('0x3e')](_0x23bcdc['name'])&&!_[_0xf562('0x3e')](_0x23bcdc[_0xf562('0xef')])&&_0x23bcdc[_0xf562('0xef')]&&!_[_0xf562('0x3e')](this[_0xf562('0x10')][util[_0xf562('0x25')](_0xf562('0xf0'),_0x23bcdc['name'])])&&!_[_0xf562('0x3e')](this[_0xf562('0x10')][util[_0xf562('0x25')]('SIP/%s',_0x23bcdc[_0xf562('0x27')])][_0xf562('0x4a')])&&(this['trunks'][util[_0xf562('0x25')]('SIP/%s',_0x23bcdc[_0xf562('0x27')])][_0xf562('0x4a')]==='reachable'||this[_0xf562('0x10')][util[_0xf562('0x25')](_0xf562('0xf0'),_0x23bcdc[_0xf562('0x27')])]['status']===_0xf562('0xf1'));};Preview['prototype']['run']=function(_0x44fed1,_0xa38317){return this[_0xf562('0xf2')](_0x44fed1,_0xa38317)[_0xf562('0x54')](function(_0x23745d){return _['pick'](_0x23745d,['message']);})[_0xf562('0x4c')](function(_0x127f96){if(_0x127f96[_0xf562('0xf3')]){rpcDb[_0xf562('0xf4')](_0x44fed1);}if(_0x127f96[_0xf562('0xef')]){rpcDb[_0xf562('0x5d')](_0x44fed1);}throw _['pick'](_0x127f96,[_0xf562('0x6b')]);});};Preview['prototype'][_0xf562('0xf2')]=function(_0x3f5d45,_0x5d6de6){var _0x1cc7f2=this;var _0x543e8f,_0x3bce3d;return rpcDb[_0xf562('0xf5')](_0x3f5d45)[_0xf562('0x54')](function(_0x52525c){if(!_[_0xf562('0x3e')](_0x52525c[0x0])){_0x3bce3d=_0x52525c[0x0][_0xf562('0xf6')]?![]:!![];_0x543e8f=_0x52525c[0x0][_0xf562('0xf6')]?!![]:![];_0x543e8f=_0x5d6de6?!![]:_0x543e8f;}var _0x2acb5b=_0x1cc7f2[_0xf562('0xf7')](_0x52525c);if(_0x2acb5b[_0xf562('0xf8')]){rpcDb[_0xf562('0xf9')](_['pick'](_0x52525c[0x0],['VoiceQueueId',_0xf562('0xe1')]))['then'](function(_0x1d3af2){_0x1cc7f2[_0xf562('0xe0')](_0x1d3af2,_0x52525c[0x0],_0x5d6de6,_0x3bce3d,_0x543e8f)[_0xf562('0x54')](function(_0x389c1c){return _0x389c1c;})[_0xf562('0x4c')](function(_0x399b80){throw _0x399b80;});})[_0xf562('0x4c')](function(_0x58126f){ut[_0xf562('0xe9')]('[Preview][checkIsBlackList]',_0x58126f);throw ut['message'](_0xf562('0xfa'),_0x3bce3d,_0x543e8f);});}else{throw ut[_0xf562('0x6b')](_0x2acb5b[_0xf562('0x6b')],_0x3bce3d,_0x543e8f);}})['catch'](function(_0x4f3701){ut[_0xf562('0xe9')](_0xf562('0xfb'),_0x4f3701);throw ut[_0xf562('0x6b')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0xf562('0xf7')]=function(_0xd10d66){if(_[_0xf562('0x3e')](_0xd10d66)||_[_0xf562('0xfc')](_0xd10d66)||!_['isNil'](_0xd10d66[0x0][_0xf562('0x58')])&&_[_0xf562('0x3e')](_0xd10d66[0x0][_0xf562('0x58')]['name'])){ut[_0xf562('0xe9')](_0xf562('0xfd'),_0xd10d66);return{'isValid':![],'message':_0xf562('0xfe')};}var _0x4cb3bd=this[_0xf562('0xe')][_0xd10d66[0x0][_0xf562('0x40')]['name']];_0x4cb3bd['message']=utils['CAMPAIGN_STATUS'][_0xf562('0x72')];if(_[_0xf562('0x3e')](_0x4cb3bd)){ut[_0xf562('0xe9')](_0xf562('0xff'),_0x4cb3bd);return{'isValid':![],'message':_0xf562('0x100')};}if(!this[_0xf562('0x6f')](_0x4cb3bd['Trunk'])){ut[_0xf562('0xe9')](_0xf562('0x101'),_0xf562('0x102')+_0x4cb3bd[_0xf562('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x4cb3bd[_0xf562('0x71')])){ut[_0xf562('0xe9')](_0xf562('0x101'),_0x4cb3bd[_0xf562('0x27')]+_0xf562('0x103'));return{'isValid':![],'message':_0xf562('0x104')};}}if(!ut['isActive'](_0x4cb3bd[_0xf562('0x3a')])){ut['logger'](_0xf562('0x105'),_0x4cb3bd[_0xf562('0x27')]+_0xf562('0x106'));return{'isValid':![],'message':_0xf562('0x102')+_0x4cb3bd[_0xf562('0x27')]+_0xf562('0x106')};}return{'isValid':!![],'message':_0xf562('0x107')};};Preview['prototype'][_0xf562('0xe5')]=function(_0x26a767,_0x32e30f,_0x3b3846,_0x35174f){var _0x1a1cff=this;return new Promise(function(_0x4ab92c,_0x4b2510){var _0x10b813=_0x26a767['uniqueid'];var _0x3af995=_0x1a1cff[_0xf562('0x6f')](_0x32e30f[_0xf562('0x70')])?util[_0xf562('0x25')](_0xf562('0x108'),_0x32e30f[_0xf562('0x70')][_0xf562('0x27')],_[_0xf562('0x3e')](_0x32e30f['dialPrefix'])?'':_0x32e30f[_0xf562('0x109')][_0xf562('0x10a')]()||'',_0x32e30f[_0xf562('0x10b')]>0x0?_0x3b3846[_0xf562('0xe1')]['substring'](_0x32e30f[_0xf562('0x10b')]):_0x3b3846['phone']):util[_0xf562('0x25')](_0xf562('0x108'),_[_0xf562('0x3e')](_0x32e30f[_0xf562('0x71')])?_0x32e30f[_0xf562('0x70')][_0xf562('0x27')]:_0x32e30f[_0xf562('0x71')]['name'],_[_0xf562('0x3e')](_0x32e30f[_0xf562('0x109')])?'':_0x32e30f[_0xf562('0x109')][_0xf562('0x10a')]()||'',_0x32e30f[_0xf562('0x10b')]>0x0?_0x3b3846[_0xf562('0xe1')][_0xf562('0x10c')](_0x32e30f[_0xf562('0x10b')]):_0x3b3846[_0xf562('0xe1')]);var _0x4e9707=_0x1a1cff['isTrunkReachable'](_0x32e30f[_0xf562('0x70')])?ut[_0xf562('0x10d')](_0x32e30f[_0xf562('0x70')]['callerid'],_0x32e30f[_0xf562('0x10e')],_0x32e30f[_0xf562('0x10f')]>0x0?ut['getCallerIdRandom'](_0x32e30f['dialOriginateCallerIdNumber'],_0x32e30f[_0xf562('0x10f')]):_0x32e30f[_0xf562('0x110')]):ut[_0xf562('0x10d')](_['isNil'](_0x32e30f[_0xf562('0x71')])?_0x32e30f[_0xf562('0x70')][_0xf562('0x111')]:_0x32e30f[_0xf562('0x71')][_0xf562('0x111')],_0x32e30f['dialOriginateCallerIdName'],_0x32e30f[_0xf562('0x10f')]>0x0?ut['getCallerIdRandom'](_0x32e30f[_0xf562('0x110')],_0x32e30f[_0xf562('0x10f')]):_0x32e30f[_0xf562('0x110')]);if(_0x4e9707){_0x26a767['originatecalleridname']=ut['extractCalleridName'](_0x4e9707);_0x26a767[_0xf562('0x112')]=ut[_0xf562('0x113')](_0x4e9707);}var _0x4a4fea=ut['addVariables'](_0x32e30f,_0x3b3846,_0x3af995,_0x4e9707,_0x10b813,_0x26a767);var _0x15ce8a=utils[_0xf562('0x114')](_0x3b3846[_0xf562('0x115')]);Object['assign'](_0x4a4fea,_0x15ce8a);_[_0xf562('0x116')](_0x26a767,ut[_0xf562('0x117')](_0x4a4fea));_0x26a767[_0xf562('0x5e')]=moment()[_0xf562('0x25')]('YYYY-MM-DD\x20HH:mm:ss');_0x32e30f['variables']=_0x4a4fea;var _0x25686c=ut[_0xf562('0x118')](_0x26a767,_0x32e30f,_0x4a4fea,_0x26a767['activeContact'],_0x35174f);return ami['Action'](_0x25686c)[_0xf562('0x54')](function(_0x1e7b9d){_0x32e30f['originated']+=0x1;logger[_0xf562('0x84')](_0xf562('0x119'),_0x10b813,_0xf562('0x9d'),_0x32e30f[_0xf562('0x27')],'originated:\x20',_0x32e30f[_0xf562('0x2a')]);_0x4ab92c(_0x1e7b9d);})[_0xf562('0x4c')](function(_0x3be999){ut[_0xf562('0xd2')](_0x26a767,0xe,_0xf562('0x11a'));rpcDb[_0xf562('0xd3')](_0x26a767,'[originateFailure][logOriginateFailure]');_0x4b2510(_0x3be999);});});};Preview['prototype'][_0xf562('0x1c')]=function(_0x62d792){if(this[_0xf562('0x11')][_0x62d792[_0xf562('0x83')]]){this[_0xf562('0x11')][_0x62d792[_0xf562('0x83')]][_0xf562('0x4b')]=_0x62d792[_0xf562('0x4b')];}};Preview[_0xf562('0x31')][_0xf562('0x11b')]=function(_0x596e9c){var _0x561697=this;var _0x2ccfcb=this[_0xf562('0x11')][_0x596e9c[_0xf562('0x11c')]];if(_0x2ccfcb){if(_0x2ccfcb[_0xf562('0xe4')]&&this[_0xf562('0xe3')][_0x2ccfcb[_0xf562('0xe4')]]){ut[_0xf562('0x11d')](_0x2ccfcb,this[_0xf562('0xe3')][_0x2ccfcb[_0xf562('0xe4')]][_0xf562('0x27')],this['agents'][_0x2ccfcb['lookAgent']]['id']);}var _0x364a17=_[_0xf562('0x11e')](_0x2ccfcb);_0x364a17[_0xf562('0x89')]=moment()[_0xf562('0x25')](_0xf562('0x5f'));var _0x1e0d3c=_0x561697[_0xf562('0xe')][_0x2ccfcb[_0xf562('0x41')]];if(ut[_0xf562('0x11f')](_0x596e9c[_0xf562('0x120')])){if(_0x2ccfcb[_0xf562('0x81')]){rpcDb[_0xf562('0xf4')](_0x2ccfcb['idContact']);}if(_0x2ccfcb[_0xf562('0x82')]){rpcDb['disableContact'](_0x2ccfcb['idContact']);}ami[_0xf562('0x22')](_0xf562('0x121'),ut[_0xf562('0x77')](_0x2ccfcb,_0xf562('0x122'),this['campaignsPreview'][_0x2ccfcb[_0xf562('0x41')]]));this[_0xf562('0xcf')](_0x364a17,_0x1e0d3c,_0x596e9c);}else{_0x2ccfcb[_0xf562('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x364a17,0x4,'Answer');rpcDb[_0xf562('0xd3')](_0x364a17,_0xf562('0x123'));}}};Preview['prototype'][_0xf562('0x16')]=function(_0x35edae){var _0x3de159=this[_0xf562('0x11')][_0x35edae[_0xf562('0x83')]];var _0x58ab52;if(_0x3de159){_0x58ab52=this[_0xf562('0xe')][_0x3de159[_0xf562('0x41')]];logger[_0xf562('0x84')](_0xf562('0x124'),_0x35edae[_0xf562('0x83')],_0xf562('0x9d'),_0x58ab52[_0xf562('0x27')],'pTalking:\x20',_0x58ab52['pTalking']);}if(this[_0xf562('0x11')][_0x35edae[_0xf562('0x83')]]&&_0x35edae[_0xf562('0x83')]!==_0x35edae['uniqueid']){if(_0x35edae[_0xf562('0x125')]==='16'&&this[_0xf562('0x11')][_0x35edae['linkedid']]['dialAnswer']){this[_0xf562('0x73')](_0x35edae,_0x35edae['linkedid'],_0x35edae['cause']);}else if(this[_0xf562('0x11')][_0x35edae[_0xf562('0x83')]][_0xf562('0x44')]){logger['info'](_0xf562('0x126'),_0x35edae[_0xf562('0x83')],_0x35edae['cause'],_0xf562('0x9d'),_0x58ab52[_0xf562('0x27')],_0xf562('0x43'),_0x58ab52[_0xf562('0x2b')]);this[_0xf562('0x73')](_0x35edae,_0x35edae['linkedid'],_0x35edae['cause']);}}else if(_0x3de159&&_[_0xf562('0x3e')](_0x3de159[_0xf562('0x127')])&&_0x58ab52['dialQueueProject']&&_0x35edae[_0xf562('0x83')]===_0x35edae[_0xf562('0x8b')]&&_[_0xf562('0x3e')](_0x35edae[_0xf562('0xda')])&&_0x35edae[_0xf562('0x125')]==='16'&&_0x35edae['channelstate']==='6'&&_[_0xf562('0xd1')](_0x3de159[_0xf562('0x128')])){if(_0x3de159[_0xf562('0x81')]){rpcDb[_0xf562('0xf4')](_0x3de159['idContact']);}if(_0x3de159[_0xf562('0x82')]){rpcDb[_0xf562('0x5d')](_0x3de159[_0xf562('0x86')]);}_0x35edae[_0xf562('0xda')]='22';this[_0xf562('0xcf')](_0x3de159,_0x58ab52,_0x35edae);}else if(_0x3de159&&_0x3de159['transfer']){if(_0x35edae[_0xf562('0x125')]==='16'&&this['actions'][_0x35edae[_0xf562('0x83')]][_0xf562('0x44')]){logger[_0xf562('0x84')](_0xf562('0x129'),_0x35edae[_0xf562('0x83')],_0x35edae['cause'],'\x20Queue',_0x58ab52['name'],'pTalking:\x20',_0x58ab52[_0xf562('0x2b')]);this[_0xf562('0x73')](_0x35edae,_0x35edae[_0xf562('0x83')],_0x35edae['cause']);}else if(this[_0xf562('0x11')][_0x35edae[_0xf562('0x83')]][_0xf562('0x44')]){logger['info'](_0xf562('0x126'),_0x35edae[_0xf562('0x83')],_0x35edae[_0xf562('0x125')],_0xf562('0x9d'),_0x58ab52[_0xf562('0x27')],'pTalking:\x20',_0x58ab52[_0xf562('0x2b')]);this[_0xf562('0x73')](_0x35edae,_0x35edae['linkedid'],_0x35edae['cause']);}}};Preview['prototype'][_0xf562('0x1a')]=function(_0x12ae25){if(this[_0xf562('0x11')][_0x12ae25['destlinkedid']]&&_0x12ae25[_0xf562('0xce')]!==_0x12ae25['destuniqueid']){this[_0xf562('0x73')](_0x12ae25,_0x12ae25[_0xf562('0xce')],_0x12ae25[_0xf562('0xc7')]);}};Preview[_0xf562('0x31')][_0xf562('0x18')]=function(_0x247577){if(this[_0xf562('0x11')][_0x247577[_0xf562('0x83')]]&&_0x247577[_0xf562('0x83')]!==_0x247577[_0xf562('0x8b')]&&!this[_0xf562('0x11')][_0x247577[_0xf562('0x83')]]['dialAnswer']){if(_0x247577[_0xf562('0x125')]==='1'){this[_0xf562('0x73')](_0x247577,_0x247577[_0xf562('0x83')],_0x247577['cause']);}}};Preview[_0xf562('0x31')]['addVariable']=function(_0x134702,_0x6d9790,_0x4bf9fd){if(this[_0xf562('0x11')][_0x134702]){if(_['isNil'](this[_0xf562('0x11')][_0x134702][_0xf562('0x12a')])){this[_0xf562('0x11')][_0x134702]['variables']={};}this[_0xf562('0x11')][_0x134702][_0xf562('0x12a')][_0x6d9790]=_0x4bf9fd;}};Preview[_0xf562('0x31')]['syncVarSet']=function(_0x4c5b48){try{if(!_[_0xf562('0x3e')](_0x4c5b48)){if(ut[_0xf562('0x12b')](_[_0xf562('0x12c')](_0x4c5b48[_0xf562('0x12d')])[0x0])){this['addVariable'](_0x4c5b48[_0xf562('0x8b')],_[_0xf562('0x12c')](_0x4c5b48[_0xf562('0x12d')])[0x0],_0x4c5b48[_0xf562('0x12e')]);}}}catch(_0x51fbb4){logger['error']('[syncVarSet][Preview]',util[_0xf562('0x12f')](_0x51fbb4,{'showHidden':![],'depth':null}));}};Preview[_0xf562('0x31')]['syncAttendedTransfer']=function(_0x176e57){if(_0x176e57){if(this[_0xf562('0x11')][_0x176e57[_0xf562('0x130')]]){this['actions'][_0x176e57[_0xf562('0x130')]][_0xf562('0x128')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xe51c6){if(_0xe51c6){if(this[_0xf562('0x11')][_0xe51c6['transfererlinkedid']]){this[_0xf562('0x11')][_0xe51c6[_0xf562('0x131')]][_0xf562('0x128')]=!![];}}};module[_0xf562('0x132')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x2e097c,_0x21b36a){var _0x4538b4=function(_0x4c9dac){while(--_0x4c9dac){_0x2e097c['push'](_0x2e097c['shift']());}};_0x4538b4(++_0x21b36a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2f0e37e..8673d5e 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 _0xcebe=['createAgentHistory','createCustomerHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then'];(function(_0x6e0910,_0x2a2ad3){var _0xf23606=function(_0x2db370){while(--_0x2db370){_0x6e0910['push'](_0x6e0910['shift']());}};_0xf23606(++_0x2a2ad3);}(_0xcebe,0x155));var _0xeceb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcebe[_0x2d7f0e];return _0x110b07;};'use strict';var util=require(_0xeceb('0x0'));var BPromise=require(_0xeceb('0x1'));var logger=require('../../../config/logger')(_0xeceb('0x2'));var cmHopper=require(_0xeceb('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xeceb('0x4'));var voiceQueueReport=require(_0xeceb('0x5'));function loggerCatch(_0x518366){return function(_0x50142a){logger[_0xeceb('0x6')](_0x518366,util[_0xeceb('0x7')](_0x50142a,{'showHidden':![],'depth':null}));};}function create(_0x468bec){return cmHopperHistory[_0xeceb('0x8')](_0x468bec)[_0xeceb('0x9')](loggerCatch(_0xeceb('0xa')));}function createAgent(_0x1257b7){return BPromise[_0xeceb('0xb')]()['then'](agentReportPreview['createHistory'](_0x1257b7))[_0xeceb('0x9')](loggerCatch(_0xeceb('0xa')));}function moveContact(_0x4dcbf5){return cmHopper['moveContactManagedDialer'](_0x4dcbf5,!![])[_0xeceb('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xeceb('0xc')]=function(_0x47dfe8){return cmHopperBlack[_0xeceb('0xc')](_0x47dfe8)[_0xeceb('0x9')](loggerCatch(_0xeceb('0xd')));};exports[_0xeceb('0xe')]=function(_0x1f1621){return BPromise[_0xeceb('0xb')]()[_0xeceb('0xf')](cmHopper['getContactPreview'](_0x1f1621))[_0xeceb('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0xeceb('0x8')]=function(_0x1b740f,_0x1e163d){create(_0x1b740f)[_0xeceb('0x9')](loggerCatch(_0x1e163d));moveContact(_0x1b740f)[_0xeceb('0x9')](loggerCatch(_0x1e163d));};exports[_0xeceb('0x10')]=function(_0x590b46,_0x43ffa9){createAgent(_0x590b46)[_0xeceb('0x9')](loggerCatch(_0x43ffa9));};exports[_0xeceb('0x11')]=function(_0xcd51e9,_0x55fe1d){create(_0xcd51e9)[_0xeceb('0x9')](loggerCatch(_0x55fe1d));};exports['createCustomerFinal']=function(_0x128af9,_0x1224e4){moveContact(_0x128af9)['catch'](loggerCatch(_0x1224e4));};exports['rescheduleContact']=function(_0x18544e,_0x1c1e46,_0x3cce0d){if(_0x1c1e46){_0x18544e[_0xeceb('0x12')]=null;}if(_0x3cce0d){_0x18544e['active']=![];}return cmHopper[_0xeceb('0x13')](_0x18544e)[_0xeceb('0x9')](loggerCatch(_0xeceb('0x14')));};exports[_0xeceb('0x15')]=function(_0x36abec){return cmHopper['countReScheduled'](_0x36abec)[_0xeceb('0x9')](loggerCatch(_0xeceb('0x16')));};exports['unlockContact']=function(_0x63b49){return cmHopper[_0xeceb('0x17')]({'UserId':null},_0x63b49,0x1)[_0xeceb('0x9')](loggerCatch(_0xeceb('0x18')));};exports['disableContact']=function(_0x3ec934){return cmHopper['unlockContact']({'active':![]},_0x3ec934,0x1)['catch'](loggerCatch(_0xeceb('0x19')));};exports[_0xeceb('0x1a')]=function(_0x5de01f){var _0x3c2322={};_0x3c2322[_0xeceb('0x1b')]=_0x5de01f['type'];_0x3c2322[_0xeceb('0x1c')]=_0x5de01f[_0xeceb('0x1c')];_0x3c2322[_0xeceb('0x1d')]=_0x5de01f[_0xeceb('0x1d')];_0x3c2322[_0xeceb('0x1e')]=_0x5de01f[_0xeceb('0x1e')];_0x3c2322[_0xeceb('0x1f')]=_0x5de01f['queue'];_0x3c2322['queuecallerjoinAt']=_0x5de01f[_0xeceb('0x20')];_0x3c2322['queuecallerleaveAt']=_0x5de01f[_0xeceb('0x20')];_0x3c2322[_0xeceb('0x21')]=0x1;_0x3c2322[_0xeceb('0x22')]=_0x5de01f[_0xeceb('0x23')];_0x3c2322[_0xeceb('0x24')]=_0x5de01f[_0xeceb('0x25')];_0x3c2322[_0xeceb('0x26')]=_0xeceb('0x27');_0x3c2322[_0xeceb('0x28')]=_0xeceb('0x29');_0x3c2322['holdtime']=0x0;_0x3c2322[_0xeceb('0x2a')]=0x1;_0x3c2322[_0xeceb('0x2b')]=_0x5de01f[_0xeceb('0x25')];_0x3c2322[_0xeceb('0x2c')]=_0xeceb('0x2d');return BPromise[_0xeceb('0xb')]()[_0xeceb('0xf')](voiceQueueReport[_0xeceb('0x2e')](_0x3c2322))[_0xeceb('0x9')](loggerCatch(_0xeceb('0x2f')));};exports[_0xeceb('0x30')]=function(_0x5d6058,_0x9fe82){return BPromise[_0xeceb('0xb')]()[_0xeceb('0xf')](cmHopper[_0xeceb('0x30')](_0x5d6058,_0x9fe82))[_0xeceb('0x9')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xeceb('0x31')]=function(_0x1e6cdd){return cmHopper[_0xeceb('0x13')](_0x1e6cdd,!![],!![])[_0xeceb('0x9')](loggerCatch(_0xeceb('0x32')));}; \ No newline at end of file +var _0xeef9=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','type','calleridname','queue','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','then','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','countReScheduled'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xeef9,0x16a));var _0x9eef=function(_0x4f0057,_0x23c77a){_0x4f0057=_0x4f0057-0x0;var _0x45e03a=_0xeef9[_0x4f0057];return _0x45e03a;};'use strict';var util=require(_0x9eef('0x0'));var BPromise=require(_0x9eef('0x1'));var logger=require('../../../config/logger')(_0x9eef('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x9eef('0x3'));var cmHopperBlack=require(_0x9eef('0x4'));var agentReportPreview=require(_0x9eef('0x5'));var voiceQueueReport=require(_0x9eef('0x6'));function loggerCatch(_0x5032a8){return function(_0x2a86e9){logger['error'](_0x5032a8,util[_0x9eef('0x7')](_0x2a86e9,{'showHidden':![],'depth':null}));};}function create(_0x25b90f){return cmHopperHistory[_0x9eef('0x8')](_0x25b90f)[_0x9eef('0x9')](loggerCatch(_0x9eef('0xa')));}function createAgent(_0x47954a){return BPromise[_0x9eef('0xb')]()['then'](agentReportPreview[_0x9eef('0x8')](_0x47954a))[_0x9eef('0x9')](loggerCatch(_0x9eef('0xa')));}function moveContact(_0x17d095){return cmHopper['moveContactManagedDialer'](_0x17d095,!![])['catch'](loggerCatch(_0x9eef('0xc')));}exports['checkIsBlackList']=function(_0x5d7a16){return cmHopperBlack[_0x9eef('0xd')](_0x5d7a16)['catch'](loggerCatch(_0x9eef('0xe')));};exports[_0x9eef('0xf')]=function(_0x596a50){return BPromise[_0x9eef('0xb')]()['then'](cmHopper[_0x9eef('0xf')](_0x596a50))[_0x9eef('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9eef('0x8')]=function(_0x30b85e,_0x2d0256){create(_0x30b85e)[_0x9eef('0x9')](loggerCatch(_0x2d0256));moveContact(_0x30b85e)[_0x9eef('0x9')](loggerCatch(_0x2d0256));};exports[_0x9eef('0x10')]=function(_0x524975,_0x5751f2){createAgent(_0x524975)['catch'](loggerCatch(_0x5751f2));};exports[_0x9eef('0x11')]=function(_0x222a6c,_0x5f4a36){create(_0x222a6c)[_0x9eef('0x9')](loggerCatch(_0x5f4a36));};exports[_0x9eef('0x12')]=function(_0x15941c,_0x5a683b){moveContact(_0x15941c)['catch'](loggerCatch(_0x5a683b));};exports[_0x9eef('0x13')]=function(_0x2afb1d,_0x2eeaa0,_0x3994d9){if(_0x2eeaa0){_0x2afb1d[_0x9eef('0x14')]=null;}if(_0x3994d9){_0x2afb1d['active']=![];}return cmHopper[_0x9eef('0x13')](_0x2afb1d)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9eef('0x15')]=function(_0x434e09){return cmHopper['countReScheduled'](_0x434e09)[_0x9eef('0x9')](loggerCatch(_0x9eef('0x16')));};exports[_0x9eef('0x17')]=function(_0x303b43){return cmHopper['unlockContact']({'UserId':null},_0x303b43,0x1)[_0x9eef('0x9')](loggerCatch(_0x9eef('0x18')));};exports['disableContact']=function(_0x1c48aa){return cmHopper[_0x9eef('0x17')]({'active':![]},_0x1c48aa,0x1)[_0x9eef('0x9')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x343dfb){var _0x4a12dc={};_0x4a12dc[_0x9eef('0x19')]=_0x343dfb['type'];_0x4a12dc['uniqueid']=_0x343dfb['uniqueid'];_0x4a12dc['calleridnum']=_0x343dfb['calleridnum'];_0x4a12dc[_0x9eef('0x1a')]=_0x343dfb[_0x9eef('0x1a')];_0x4a12dc['queue']=_0x343dfb[_0x9eef('0x1b')];_0x4a12dc['queuecallerjoinAt']=_0x343dfb['answertime'];_0x4a12dc['queuecallerleaveAt']=_0x343dfb[_0x9eef('0x1c')];_0x4a12dc[_0x9eef('0x1d')]=0x1;_0x4a12dc['queuecallercompleteAt']=_0x343dfb[_0x9eef('0x1e')];_0x4a12dc[_0x9eef('0x1f')]=_0x343dfb[_0x9eef('0x20')];_0x4a12dc[_0x9eef('0x21')]=_0x9eef('0x22');_0x4a12dc[_0x9eef('0x23')]=_0x9eef('0x24');_0x4a12dc[_0x9eef('0x25')]=0x0;_0x4a12dc['assigned']=0x1;_0x4a12dc[_0x9eef('0x26')]=_0x343dfb['membername'];_0x4a12dc[_0x9eef('0x27')]=_0x9eef('0x28');return BPromise[_0x9eef('0xb')]()[_0x9eef('0x29')](voiceQueueReport[_0x9eef('0x2a')](_0x4a12dc))['catch'](loggerCatch(_0x9eef('0x2b')));};exports['getContactRecallMe']=function(_0x1ea10b,_0x321feb){return BPromise[_0x9eef('0xb')]()['then'](cmHopper[_0x9eef('0x2c')](_0x1ea10b,_0x321feb))[_0x9eef('0x9')](loggerCatch(_0x9eef('0x2d')));};exports[_0x9eef('0x2e')]=function(_0x15c3f0){return cmHopper[_0x9eef('0x13')](_0x15c3f0,!![],!![])[_0x9eef('0x9')](loggerCatch(_0x9eef('0x2f')));}; \ 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 01e7692..d5cf15b 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 _0x1e01=['logger','info','loggerError','inspect','message','isUndefined','string','format','isEmpty','isActive','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','state','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','YYYY-MM-DD\x20HH:mm:ss','statedesc','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','mandatoryDisposition','buildObj','agentReadyId','isNil','not_inuse','status','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','queue','type','campaigntype','dialAnswer','channelAgent','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','127.0.0.1','../../dialer/utils','loggerCatch','error'];(function(_0x133305,_0x19a973){var _0x57fe64=function(_0x4f4ad0){while(--_0x4f4ad0){_0x133305['push'](_0x133305['shift']());}};_0x57fe64(++_0x19a973);}(_0x1e01,0x19b));var _0x11e0=function(_0xa29c69,_0x1b2df1){_0xa29c69=_0xa29c69-0x0;var _0x35ae9f=_0x1e01[_0xa29c69];return _0x35ae9f;};'use strict';var util=require(_0x11e0('0x0'));var _=require(_0x11e0('0x1'));var moment=require(_0x11e0('0x2'));var logger=require(_0x11e0('0x3'))(_0x11e0('0x4'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x11e0('0x5');var utils=require(_0x11e0('0x6'));exports[_0x11e0('0x7')]=function(_0x5be19a){return function(_0x4c1289){logger[_0x11e0('0x8')](_0x5be19a,util['inspect'](_0x4c1289,{'showHidden':![],'depth':null}));};};exports[_0x11e0('0x9')]=function(_0x45ee7d,_0x1fe83e){logger[_0x11e0('0xa')](_0x45ee7d,util['inspect'](_0x1fe83e,{'showHidden':![],'depth':null}));};exports[_0x11e0('0xb')]=function(_0x2b4ccb,_0x1b5c81){logger[_0x11e0('0x8')](_0x2b4ccb,util[_0x11e0('0xc')](_0x1b5c81,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x17c510){return function(_0xb53423){logger[_0x11e0('0xa')](_0x17c510,util['inspect'](_0xb53423,{'showHidden':![],'depth':null}));};};exports[_0x11e0('0xd')]=function(_0x381a9c,_0x2bd095,_0x5a60c1){return{'message':_0x381a9c,'unlock':_0x2bd095,'active':_0x5a60c1};};exports['getCallerId']=function(_0x333165,_0x514eb0,_0x548cbf){if(!_[_0x11e0('0xe')](_0x548cbf)&&'string'===typeof _0x548cbf&&!_['isEmpty'](_0x548cbf)){if(!_[_0x11e0('0xe')](_0x514eb0)&&_0x11e0('0xf')===typeof _0x514eb0&&!_['isEmpty'](_0x514eb0)){return util[_0x11e0('0x10')]('\x22%s\x22\x20<%s>',_0x514eb0,_0x548cbf);}return util[_0x11e0('0x10')]('\x22%s\x22\x20<%s>',_0x548cbf,_0x548cbf);}if(!_[_0x11e0('0xe')](_0x333165)&&_0x11e0('0xf')===typeof _0x333165&&!_[_0x11e0('0x11')](_0x333165)){return _0x333165;}return'\x22\x22\x20<>';};exports[_0x11e0('0x12')]=function(_0x55a6d2){if(_['isNil'](_0x55a6d2)){return![];}return _0x55a6d2;};exports['addVariables']=function(_0x1ff2b7,_0x337b7f,_0x2f9ac2,_0x266a96,_0x4309c1,_0x2fa764){var _0x272c6c={'XMD-QUEUE':_0x337b7f[_0x11e0('0x13')]?_0x337b7f[_0x11e0('0x13')][_0x11e0('0x14')]:'','XMD-CALLERID':_0x266a96,'XMD-CALLERID-PREVIEW':_0x2fa764?util[_0x11e0('0x10')](_0x11e0('0x15'),_0x2fa764[_0x11e0('0x16')],_0x2fa764[_0x11e0('0x17')]):_0x266a96,'XMD-DIALID':_0x4309c1,'XMD-CONTACTID':_0x337b7f['ContactId'],'XMD-CDRTYPE':_0x11e0('0x18'),'CALLERID(all)':_0x266a96,'XMD-VOICEQUEUEID':_0x337b7f[_0x11e0('0x19')],'XMD-DIALCHANNEL':_0x2f9ac2,'XMD-DIALTIMEOUT':_0x1ff2b7['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x11e0('0x10')](_0x11e0('0x1a'),_0x1ff2b7[_0x11e0('0x1b')]?'g':'',_[_0x11e0('0x11')](_0x1ff2b7[_0x11e0('0x1c')])?'':_0x11e0('0x1d')),'XMD-DIALURL':_0x1ff2b7['dialPreviewUrl']||'','XMD-AGI':_0x1ff2b7['dialQueueProject']?util[_0x11e0('0x10')](_0x11e0('0x1e'),ipAgi,_0x1ff2b7['dialQueueProject']):_0x11e0('0x1f'),'XMD-AGIAFTER':_0x1ff2b7['dialQueueProject2']?util[_0x11e0('0x10')](_0x11e0('0x1e'),ipAgi,_0x1ff2b7[_0x11e0('0x1b')]):_0x11e0('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x2fa764?_0x2fa764[_0x11e0('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x2fa764?_0x2fa764[_0x11e0('0x21')]:'','XMD-DESTINATION':_0x11e0('0x22'),'SIPADDHEADER':_0x11e0('0x23')};if(!_[_0x11e0('0x11')](_0x1ff2b7[_0x11e0('0x1c')])){_0x272c6c[util[_0x11e0('0x10')]('%s',_0x11e0('0x24'))]=_0x1ff2b7[_0x11e0('0x1c')];_0x272c6c[util[_0x11e0('0x10')]('%s',_0x11e0('0x25'))]=_0x4309c1;}return _0x272c6c;};exports[_0x11e0('0x26')]=function(_0x3ace96){var _0x3a3066={};for(var _0x1d754a in _0x3ace96){if(_0x3ace96[_0x11e0('0x27')](_0x1d754a)){_0x3a3066[util[_0x11e0('0x10')]('%s',_[_0x11e0('0x28')](_0x1d754a))]=_0x3ace96[_0x1d754a];}}return{'variables':_0x3a3066};};exports[_0x11e0('0x29')]=function(_0x2425ea){var _0x37efe3=moment()[_0x11e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2425ea[_0x11e0('0x2a')]=0xd;_0x2425ea['statedesc']='Blacklist';_0x2425ea[_0x11e0('0x2b')]=_0x37efe3;_0x2425ea[_0x11e0('0x2c')]=_0x37efe3;_0x2425ea[_0x11e0('0x2d')]=_0x37efe3;};exports[_0x11e0('0x2e')]=function(_0x12a41b,_0x269af5,_0x1d34b9){var _0x47c7b6=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12a41b[_0x11e0('0x2a')]=_0x269af5;_0x12a41b['statedesc']=_0x1d34b9;_0x12a41b['responsetime']=_0x47c7b6;_0x12a41b['ringtime']=utils['getSeconds'](_0x12a41b[_0x11e0('0x2c')],_0x12a41b[_0x11e0('0x2b')]);};exports[_0x11e0('0x2f')]=function(_0x5da3b8,_0x4630b9,_0x13a61b){_0x5da3b8[_0x11e0('0x30')]=_0x4630b9;_0x5da3b8[_0x11e0('0x31')]=_0x13a61b;};exports['logCustomer']=function(_0x555bd1,_0x4adf49,_0x42dfc8){var _0x1e8a69=moment()['format'](_0x11e0('0x32'));_0x555bd1['state']=_0x4adf49;_0x555bd1[_0x11e0('0x33')]=_0x42dfc8;_0x555bd1[_0x11e0('0x2c')]=_0x555bd1[_0x11e0('0x2c')]?_0x555bd1[_0x11e0('0x2c')]:_0x1e8a69;_0x555bd1[_0x11e0('0x2d')]=_0x555bd1['endtime']?_0x555bd1[_0x11e0('0x2d')]:_0x1e8a69;_0x555bd1['ringtime']=utils[_0x11e0('0x34')](_0x555bd1[_0x11e0('0x2c')]||0x0,_0x555bd1[_0x11e0('0x2b')]||0x0);_0x555bd1[_0x11e0('0x35')]=_0x555bd1['answertime']?utils['getSeconds'](_0x555bd1['endtime'],_0x555bd1[_0x11e0('0x36')]):0x0;};exports[_0x11e0('0x37')]=function(_0x12ee44){return _0x12ee44===_0x11e0('0x38');};exports[_0x11e0('0x39')]=function(_0x407f6d,_0x4a61ac,_0x33440c,_0x35b455,_0x4f1fe5){var _0x429556=_0x35b455?_0x11e0('0x3a'):_0x407f6d[_0x11e0('0x16')];_0x429556=_0x4f1fe5?_0x11e0('0x3b'):_0x429556;return{'actionid':_0x407f6d[_0x11e0('0x3c')],'action':_0x11e0('0x3d'),'channel':_0x407f6d['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x429556,_0x407f6d[_0x11e0('0x17')]),'Exten':_0x11e0('0x22'),'Context':_0x11e0('0x3e'),'Priority':'1','variable':_0x33440c,'timeout':(_0x4a61ac[_0x11e0('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x407f6d[_0x11e0('0x3c')]};};exports['totalGlobal']=function(_0xb96608){return _0xb96608[_0x11e0('0x40')]+_0xb96608[_0x11e0('0x41')]+_0xb96608['countnoanswerretry']+_0xb96608[_0x11e0('0x42')]+_0xb96608[_0x11e0('0x43')];};exports[_0x11e0('0x44')]=function(_0x2fae57){var _0x385a7b=_[_0x11e0('0x45')](_0x2fae57);_0x385a7b['state']=0xf;_0x385a7b[_0x11e0('0x33')]=_0x11e0('0x46');return _0x385a7b;};exports[_0x11e0('0x47')]=function(_0x4f547c,_0x1fd9d5,_0x18e7f3){var _0x139c0f={};_0x139c0f[_0x1fd9d5]=_0x4f547c[_0x1fd9d5];_0x139c0f[_0x11e0('0x48')]=![];_0x139c0f[_0x11e0('0x49')]=moment()[_0x11e0('0x4a')](_0x18e7f3,_0x11e0('0x4b'))[_0x11e0('0x10')](_0x11e0('0x32'));_0x139c0f[_0x11e0('0x4c')]=_0x4f547c['ContactId'];_0x139c0f[_0x11e0('0x4d')]=_0x4f547c[_0x11e0('0x4d')];_0x139c0f[_0x11e0('0x19')]=_0x4f547c['VoiceQueueId']||undefined;return _0x139c0f;};exports[_0x11e0('0x4e')]=function(_0x1c53fb,_0x3eb2d3){if(!_['isNil'](_0x1c53fb)){if(_0x1c53fb['pTalking']>0x0){_0x1c53fb[_0x11e0('0x4f')]-=0x1;}else{logger[_0x11e0('0xa')](_0x3eb2d3,_0x11e0('0x50'));}}else{logger[_0x11e0('0x8')](_0x3eb2d3,_0x11e0('0x51'));}};exports[_0x11e0('0x52')]=function(_0x4ba975){if(_0x4ba975<=0x0){return!![];}return![];};function buildObj(_0x24cf6f,_0x2fb904,_0xeecbef){_0x24cf6f['lastevent']=_0x2fb904;_0x24cf6f['name']=_0x24cf6f['queue'];_0x24cf6f[_0x11e0('0x53')]=_0x24cf6f['channelAgent'];_0x24cf6f['motionChannel']='voice';if(_0xeecbef){_0x24cf6f[_0x11e0('0x54')]=_0xeecbef[_0x11e0('0x54')];}return _0x24cf6f;}exports[_0x11e0('0x55')]=buildObj;exports[_0x11e0('0x56')]=function(_0x2a349d){var _0x62ea5f=[];for(var _0x1b28a2 in _0x2a349d){if(_0x2a349d[_0x11e0('0x27')](_0x1b28a2)){if(!_[_0x11e0('0x57')](_0x2a349d[_0x1b28a2])&&_0x2a349d[_0x1b28a2]['state']===_0x11e0('0x58')&&_0x2a349d[_0x1b28a2][_0x11e0('0x59')]==='reachable'){_0x62ea5f[_0x11e0('0x5a')](_0x2a349d[_0x1b28a2]['id']);}}}return _0x62ea5f;};exports[_0x11e0('0x5b')]=function(_0x48ff15){var _0x512163=moment()[_0x11e0('0x5c')](0x0);var _0x8fca4e=moment(_0x48ff15)['milliseconds'](0x0);return _0x512163[_0x11e0('0x5d')](_0x8fca4e,_0x11e0('0x5e'));};exports[_0x11e0('0x5f')]=function(_0x3b4e72){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b4e72[_0x11e0('0x4c')],'ListId':_0x3b4e72['ListId'],'VoiceQueueId':_0x3b4e72['VoiceQueueId']||undefined,'CampaignId':_0x3b4e72['CampaignId']||undefined};};exports[_0x11e0('0x60')]=function(_0x997663){if(_0x997663===_0x11e0('0x3c')||_0x997663===_0x11e0('0x61')||_0x997663===_0x11e0('0x62')||_0x997663===_0x11e0('0x63')||_0x997663===_0x11e0('0x64')||_0x997663===_0x11e0('0x65')||_0x997663===_0x11e0('0x30')||_0x997663===_0x11e0('0x66')||_0x997663===_0x11e0('0x16')||_0x997663===_0x11e0('0x48')||_0x997663===_0x11e0('0x17')||_0x997663==='scheduledat'||_0x997663===_0x11e0('0x40')||_0x997663===_0x11e0('0x41')||_0x997663===_0x11e0('0x67')||_0x997663===_0x11e0('0x68')||_0x997663===_0x11e0('0x69')||_0x997663===_0x11e0('0x6a')||_0x997663===_0x11e0('0x6b')||_0x997663==='recallme'||_0x997663===_0x11e0('0x4c')||_0x997663===_0x11e0('0x4d')||_0x997663===_0x11e0('0x31')||_0x997663===_0x11e0('0x19')||_0x997663===_0x11e0('0x6c')||_0x997663===_0x11e0('0x6d')||_0x997663===_0x11e0('0x6e')||_0x997663===_0x11e0('0x6f')||_0x997663==='xmd-listid'||_0x997663===_0x11e0('0x70')||_0x997663==='xmd-dialtimeout'||_0x997663==='xmd-dialoptions'||_0x997663===_0x11e0('0x71')||_0x997663===_0x11e0('0x72')||_0x997663===_0x11e0('0x73')||_0x997663===_0x11e0('0x74')||_0x997663===_0x11e0('0x75')||_0x997663===_0x11e0('0x76')||_0x997663===_0x11e0('0x77')||_0x997663===_0x11e0('0x78')||_0x997663==='rtpaudioqosbridged'||_0x997663===_0x11e0('0x79')||_0x997663===_0x11e0('0x7a')||_0x997663===_0x11e0('0x7b')||_0x997663==='rtpaudioqoslossbridged'||_0x997663==='rtpaudioqosrtt'||_0x997663===_0x11e0('0x7c')||_0x997663==='rtpaudioqos'||_0x997663===_0x11e0('0x7d')||_0x997663===_0x11e0('0x79')||_0x997663===_0x11e0('0x7a')||_0x997663===_0x11e0('0x7b')||_0x997663===_0x11e0('0x7e')||_0x997663===_0x11e0('0x7f')||_0x997663==='rtpaudioqosrttbridged'||_0x997663==='bridgepeer'||_0x997663==='bridgepvtcallid'||_0x997663===_0x11e0('0x2a')||_0x997663===_0x11e0('0x33')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4b4983,_0x3e3cee){var _0x2ddce5,_0x45140e,_0x32d956;if(_0x3e3cee<=0x0){_0x3e3cee=0x1;}_0x2ddce5=new RegExp(_0x11e0('0x80')+_0x3e3cee+'}$');_0x45140e=Math[_0x11e0('0x81')](0xa,_0x3e3cee-0x1);_0x32d956=Math['pow'](0xa,_0x3e3cee)-0x1;return util[_0x11e0('0x10')]('%s',_[_0x11e0('0x82')](_0x4b4983,_0x2ddce5,_[_0x11e0('0x83')](_0x45140e,_0x32d956)));};exports[_0x11e0('0x84')]=function(_0x25a4aa){var _0x167764=_0x25a4aa['match'](/"(.*?)"/);return _0x167764?_0x167764[0x1]:_0x25a4aa;};exports[_0x11e0('0x85')]=function(_0x2f4a9e){var _0x173a60=_0x2f4a9e[_0x11e0('0x86')](/<(.*?)>/);return _0x173a60?_0x173a60[0x1]:_0x2f4a9e;};function buildNoAnswerEventPayload(_0x2141a3,_0xefa9a0){var _0x2d16ff=buildObj(_0x2141a3,'noanswer');if(!_['isEmpty'](_0xefa9a0[_0x11e0('0x87')])){Object[_0x11e0('0x88')](_0xefa9a0[_0x11e0('0x87')])[_0x11e0('0x89')](function(_0x385c97){_0x2d16ff[_0x385c97[_0x11e0('0x8a')]()]=_0xefa9a0[_0x11e0('0x87')][_0x385c97];});}return _0x2d16ff;}exports[_0x11e0('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x6789=['xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','pow','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','buildNoAnswerEventPayload','lodash','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridnum','ContactId','dialer','dialOriginateTimeout','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','getSeconds','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','queue','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','CampaignId','idContact','type','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid'];(function(_0x31e9a6,_0x393af){var _0x259997=function(_0xbc1eb2){while(--_0xbc1eb2){_0x31e9a6['push'](_0x31e9a6['shift']());}};_0x259997(++_0x393af);}(_0x6789,0x122));var _0x9678=function(_0x56f8dd,_0x10c00e){_0x56f8dd=_0x56f8dd-0x0;var _0x27880b=_0x6789[_0x56f8dd];return _0x27880b;};'use strict';var util=require('util');var _=require(_0x9678('0x0'));var moment=require(_0x9678('0x1'));var logger=require('../../../../config/logger')(_0x9678('0x2'));var ipAgi=process[_0x9678('0x3')][_0x9678('0x4')]||'127.0.0.1';var utils=require(_0x9678('0x5'));exports[_0x9678('0x6')]=function(_0x1da031){return function(_0x1da5e1){logger[_0x9678('0x7')](_0x1da031,util[_0x9678('0x8')](_0x1da5e1,{'showHidden':![],'depth':null}));};};exports[_0x9678('0x9')]=function(_0xe2b03c,_0x349402){logger[_0x9678('0xa')](_0xe2b03c,util[_0x9678('0x8')](_0x349402,{'showHidden':![],'depth':null}));};exports[_0x9678('0xb')]=function(_0x387505,_0x51dd9c){logger[_0x9678('0x7')](_0x387505,util[_0x9678('0x8')](_0x51dd9c,{'showHidden':![],'depth':null}));};exports[_0x9678('0xc')]=function(_0x2b7e13){return function(_0x2100fa){logger['info'](_0x2b7e13,util[_0x9678('0x8')](_0x2100fa,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x17b73f,_0x4c2533,_0x56fee3){return{'message':_0x17b73f,'unlock':_0x4c2533,'active':_0x56fee3};};exports[_0x9678('0xd')]=function(_0x3215ba,_0x5d23aa,_0x1cc4a1){if(!_[_0x9678('0xe')](_0x1cc4a1)&&_0x9678('0xf')===typeof _0x1cc4a1&&!_[_0x9678('0x10')](_0x1cc4a1)){if(!_[_0x9678('0xe')](_0x5d23aa)&&_0x9678('0xf')===typeof _0x5d23aa&&!_['isEmpty'](_0x5d23aa)){return util[_0x9678('0x11')]('\x22%s\x22\x20<%s>',_0x5d23aa,_0x1cc4a1);}return util[_0x9678('0x11')](_0x9678('0x12'),_0x1cc4a1,_0x1cc4a1);}if(!_[_0x9678('0xe')](_0x3215ba)&&'string'===typeof _0x3215ba&&!_[_0x9678('0x10')](_0x3215ba)){return _0x3215ba;}return _0x9678('0x13');};exports[_0x9678('0x14')]=function(_0x2f3874){if(_[_0x9678('0x15')](_0x2f3874)){return![];}return _0x2f3874;};exports[_0x9678('0x16')]=function(_0xa441a8,_0x5c2fa7,_0x147d5e,_0xf4f827,_0x420999,_0x1d9ffe){var _0x30cbef={'XMD-QUEUE':_0x5c2fa7[_0x9678('0x17')]?_0x5c2fa7[_0x9678('0x17')]['name']:'','XMD-CALLERID':_0xf4f827,'XMD-CALLERID-PREVIEW':_0x1d9ffe?util['format'](_0x9678('0x12'),_0x1d9ffe['calleridname'],_0x1d9ffe[_0x9678('0x18')]):_0xf4f827,'XMD-DIALID':_0x420999,'XMD-CONTACTID':_0x5c2fa7[_0x9678('0x19')],'XMD-CDRTYPE':_0x9678('0x1a'),'CALLERID(all)':_0xf4f827,'XMD-VOICEQUEUEID':_0x5c2fa7['VoiceQueueId'],'XMD-DIALCHANNEL':_0x147d5e,'XMD-DIALTIMEOUT':_0xa441a8[_0x9678('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x9678('0x11')]('\x22rtTxX%s%s\x22',_0xa441a8['dialQueueProject2']?'g':'',_[_0x9678('0x10')](_0xa441a8[_0x9678('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xa441a8[_0x9678('0x1d')]||'','XMD-AGI':_0xa441a8['dialQueueProject']?util[_0x9678('0x11')](_0x9678('0x1e'),ipAgi,_0xa441a8[_0x9678('0x1f')]):_0x9678('0x20'),'XMD-AGIAFTER':_0xa441a8[_0x9678('0x21')]?util[_0x9678('0x11')](_0x9678('0x1e'),ipAgi,_0xa441a8['dialQueueProject2']):_0x9678('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x1d9ffe?_0x1d9ffe[_0x9678('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1d9ffe?_0x1d9ffe[_0x9678('0x23')]:'','XMD-DESTINATION':_0x9678('0x24'),'SIPADDHEADER':_0x9678('0x25')};if(!_[_0x9678('0x10')](_0xa441a8['monitor_format'])){_0x30cbef[util['format']('%s',_0x9678('0x26'))]=_0xa441a8[_0x9678('0x1c')];_0x30cbef[util[_0x9678('0x11')]('%s',_0x9678('0x27'))]=_0x420999;}return _0x30cbef;};exports[_0x9678('0x28')]=function(_0x199419){var _0x420109={};for(var _0xd22e0a in _0x199419){if(_0x199419['hasOwnProperty'](_0xd22e0a)){_0x420109[util[_0x9678('0x11')]('%s',_['toLower'](_0xd22e0a))]=_0x199419[_0xd22e0a];}}return{'variables':_0x420109};};exports[_0x9678('0x29')]=function(_0x2f2feb,_0x4953c5){if(!_['isNil'](_0x2f2feb)){if(_0x2f2feb[_0x9678('0x2a')]('originated')){if(_0x2f2feb[_0x9678('0x2b')]>0x0){_0x2f2feb['originated']-=0x1;}else{logger['error'](_0x9678('0x2c'),_0x4953c5);}}}else{logger[_0x9678('0x7')](_0x9678('0x2d'),_0x4953c5);}};exports['logBlacklist']=function(_0x5cb938){var _0x17c237=moment()[_0x9678('0x11')](_0x9678('0x2e'));_0x5cb938['state']=0xd;_0x5cb938[_0x9678('0x2f')]=_0x9678('0x30');_0x5cb938[_0x9678('0x31')]=_0x17c237;_0x5cb938[_0x9678('0x32')]=_0x17c237;_0x5cb938['endtime']=_0x17c237;};exports[_0x9678('0x33')]=function(_0x3c5af5,_0x5ab047,_0x4e78b2){var _0x2b17fa=moment()[_0x9678('0x11')](_0x9678('0x2e'));_0x3c5af5[_0x9678('0x34')]=_0x5ab047;_0x3c5af5[_0x9678('0x2f')]=_0x4e78b2;_0x3c5af5[_0x9678('0x32')]=_0x2b17fa;_0x3c5af5[_0x9678('0x35')]=utils[_0x9678('0x36')](_0x3c5af5['responsetime'],_0x3c5af5[_0x9678('0x31')]);};exports['logLookAgent']=function(_0x2a9be0,_0x93947f,_0x4ea214){_0x2a9be0[_0x9678('0x37')]=_0x93947f;_0x2a9be0[_0x9678('0x38')]=_0x4ea214;};exports[_0x9678('0x39')]=function(_0x5bf1ac,_0x4a4409,_0x43ee0f){var _0x1143b9=moment()[_0x9678('0x11')](_0x9678('0x2e'));_0x5bf1ac[_0x9678('0x34')]=_0x4a4409;_0x5bf1ac[_0x9678('0x2f')]=_0x43ee0f;_0x5bf1ac[_0x9678('0x32')]=_0x5bf1ac[_0x9678('0x32')]?_0x5bf1ac[_0x9678('0x32')]:_0x1143b9;_0x5bf1ac[_0x9678('0x3a')]=_0x5bf1ac['endtime']?_0x5bf1ac[_0x9678('0x3a')]:_0x1143b9;_0x5bf1ac[_0x9678('0x35')]=utils[_0x9678('0x36')](_0x5bf1ac[_0x9678('0x32')]||0x0,_0x5bf1ac[_0x9678('0x31')]||0x0);_0x5bf1ac[_0x9678('0x3b')]=_0x5bf1ac[_0x9678('0x3c')]?utils[_0x9678('0x36')](_0x5bf1ac[_0x9678('0x3a')],_0x5bf1ac[_0x9678('0x3c')]):0x0;};exports[_0x9678('0x3d')]=function(_0x2e62de){return _0x2e62de===_0x9678('0x3e');};exports[_0x9678('0x3f')]=function(_0x437fc7,_0x1b5d36,_0x15fd82,_0x16f290,_0xc4b2d7){var _0x53586d=_0x16f290?'RECALL':_0x437fc7[_0x9678('0x40')];_0x53586d=_0xc4b2d7?_0x9678('0x41'):_0x53586d;return{'actionid':_0x437fc7['uniqueid'],'action':_0x9678('0x42'),'channel':_0x437fc7[_0x9678('0x43')],'callerid':util[_0x9678('0x11')](_0x9678('0x12'),_0x53586d,_0x437fc7['calleridnum']),'Exten':_0x9678('0x24'),'Context':_0x9678('0x44'),'Priority':'1','variable':_0x15fd82,'timeout':(_0x1b5d36[_0x9678('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x437fc7[_0x9678('0x46')]};};exports[_0x9678('0x47')]=function(_0x381994){return _0x381994[_0x9678('0x48')]+_0x381994[_0x9678('0x49')]+_0x381994[_0x9678('0x4a')]+_0x381994[_0x9678('0x4b')]+_0x381994['countnosuchnumberretry'];};exports['cloneAction']=function(_0x4c94cb){var _0x373317=_['clone'](_0x4c94cb);_0x373317[_0x9678('0x34')]=0xf;_0x373317[_0x9678('0x2f')]='Global';return _0x373317;};exports[_0x9678('0x4c')]=function(_0xad22a0,_0x5222ea,_0x55e05a){var _0x4f6f00={};_0x4f6f00[_0x5222ea]=_0xad22a0[_0x5222ea];_0x4f6f00['active']=![];_0x4f6f00[_0x9678('0x4d')]=moment()[_0x9678('0x4e')](_0x55e05a,_0x9678('0x4f'))[_0x9678('0x11')](_0x9678('0x2e'));_0x4f6f00[_0x9678('0x19')]=_0xad22a0[_0x9678('0x19')];_0x4f6f00[_0x9678('0x50')]=_0xad22a0[_0x9678('0x50')];_0x4f6f00[_0x9678('0x51')]=_0xad22a0[_0x9678('0x51')]||undefined;return _0x4f6f00;};exports[_0x9678('0x52')]=function(_0xed72ca,_0x266940){if(!_[_0x9678('0x15')](_0xed72ca)){if(_0xed72ca['pTalking']>0x0){_0xed72ca[_0x9678('0x53')]-=0x1;}else{logger[_0x9678('0x7')](_0x266940,_0x9678('0x54'));}}else{logger[_0x9678('0x7')](_0x266940,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1aaee3){if(_0x1aaee3<=0x0){return!![];}return![];};function buildObj(_0x2adf40,_0x57ada2,_0x43b12d){_0x2adf40[_0x9678('0x55')]=_0x57ada2;_0x2adf40['name']=_0x2adf40[_0x9678('0x56')];_0x2adf40['interface']=_0x2adf40[_0x9678('0x43')];_0x2adf40[_0x9678('0x57')]='voice';if(_0x43b12d){_0x2adf40[_0x9678('0x58')]=_0x43b12d['mandatoryDisposition'];}return _0x2adf40;}exports[_0x9678('0x59')]=buildObj;exports[_0x9678('0x5a')]=function(_0x3d6772){var _0x2064b8=[];for(var _0x57c0b8 in _0x3d6772){if(_0x3d6772[_0x9678('0x2a')](_0x57c0b8)){if(!_[_0x9678('0x15')](_0x3d6772[_0x57c0b8])&&_0x3d6772[_0x57c0b8][_0x9678('0x34')]===_0x9678('0x5b')&&_0x3d6772[_0x57c0b8][_0x9678('0x5c')]===_0x9678('0x5d')){_0x2064b8[_0x9678('0x5e')](_0x3d6772[_0x57c0b8]['id']);}}}return _0x2064b8;};exports['getDiff']=function(_0x58d11a){var _0x2f4d04=moment()[_0x9678('0x5f')](0x0);var _0x63bcec=moment(_0x58d11a)['milliseconds'](0x0);return _0x2f4d04[_0x9678('0x60')](_0x63bcec,'seconds');};exports['createBody']=function(_0x10b702){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x10b702[_0x9678('0x19')],'ListId':_0x10b702[_0x9678('0x50')],'VoiceQueueId':_0x10b702[_0x9678('0x51')]||undefined,'CampaignId':_0x10b702[_0x9678('0x61')]||undefined};};exports['filterKey']=function(_0x3b5262){if(_0x3b5262===_0x9678('0x46')||_0x3b5262===_0x9678('0x62')||_0x3b5262===_0x9678('0x56')||_0x3b5262===_0x9678('0x63')||_0x3b5262===_0x9678('0x64')||_0x3b5262===_0x9678('0x65')||_0x3b5262===_0x9678('0x37')||_0x3b5262===_0x9678('0x43')||_0x3b5262===_0x9678('0x40')||_0x3b5262===_0x9678('0x66')||_0x3b5262==='calleridnum'||_0x3b5262===_0x9678('0x4d')||_0x3b5262===_0x9678('0x48')||_0x3b5262===_0x9678('0x49')||_0x3b5262===_0x9678('0x4a')||_0x3b5262===_0x9678('0x67')||_0x3b5262===_0x9678('0x68')||_0x3b5262===_0x9678('0x69')||_0x3b5262===_0x9678('0x6a')||_0x3b5262==='recallme'||_0x3b5262===_0x9678('0x19')||_0x3b5262===_0x9678('0x50')||_0x3b5262===_0x9678('0x38')||_0x3b5262===_0x9678('0x51')||_0x3b5262===_0x9678('0x6b')||_0x3b5262==='xmd-voicequeueid'||_0x3b5262==='xmd-queue'||_0x3b5262==='xmd-phone'||_0x3b5262===_0x9678('0x6c')||_0x3b5262===_0x9678('0x6d')||_0x3b5262==='xmd-dialtimeout'||_0x3b5262===_0x9678('0x6e')||_0x3b5262===_0x9678('0x6f')||_0x3b5262===_0x9678('0x70')||_0x3b5262==='xmd-contactid'||_0x3b5262===_0x9678('0x71')||_0x3b5262===_0x9678('0x72')||_0x3b5262===_0x9678('0x73')||_0x3b5262===_0x9678('0x74')||_0x3b5262===_0x9678('0x75')||_0x3b5262===_0x9678('0x76')||_0x3b5262===_0x9678('0x77')||_0x3b5262==='rtpaudioqosjitterbridged'||_0x3b5262==='rtpaudioqosloss'||_0x3b5262===_0x9678('0x78')||_0x3b5262===_0x9678('0x79')||_0x3b5262==='rtpaudioqosrttbridged'||_0x3b5262===_0x9678('0x75')||_0x3b5262===_0x9678('0x76')||_0x3b5262===_0x9678('0x77')||_0x3b5262===_0x9678('0x7a')||_0x3b5262===_0x9678('0x7b')||_0x3b5262===_0x9678('0x78')||_0x3b5262===_0x9678('0x79')||_0x3b5262===_0x9678('0x7c')||_0x3b5262===_0x9678('0x7d')||_0x3b5262===_0x9678('0x7e')||_0x3b5262===_0x9678('0x34')||_0x3b5262===_0x9678('0x2f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x32539a,_0x1ad9e8){var _0x211261,_0x50ef18,_0x433f87;if(_0x1ad9e8<=0x0){_0x1ad9e8=0x1;}_0x211261=new RegExp('\x5cw{0,'+_0x1ad9e8+'}$');_0x50ef18=Math[_0x9678('0x7f')](0xa,_0x1ad9e8-0x1);_0x433f87=Math[_0x9678('0x7f')](0xa,_0x1ad9e8)-0x1;return util[_0x9678('0x11')]('%s',_['replace'](_0x32539a,_0x211261,_['random'](_0x50ef18,_0x433f87)));};exports[_0x9678('0x80')]=function(_0xb40505){var _0xf9cc88=_0xb40505[_0x9678('0x81')](/"(.*?)"/);return _0xf9cc88?_0xf9cc88[0x1]:_0xb40505;};exports[_0x9678('0x82')]=function(_0x585f71){var _0x1a78ee=_0x585f71[_0x9678('0x81')](/<(.*?)>/);return _0x1a78ee?_0x1a78ee[0x1]:_0x585f71;};function buildNoAnswerEventPayload(_0x5c7d8f,_0x113fe7){var _0x4553f7=buildObj(_0x5c7d8f,_0x9678('0x83'));if(!_['isEmpty'](_0x113fe7[_0x9678('0x84')])){Object[_0x9678('0x85')](_0x113fe7[_0x9678('0x84')])['forEach'](function(_0x30f7f5){_0x4553f7[_0x30f7f5['toLowerCase']()]=_0x113fe7['variables'][_0x30f7f5];});}return _0x4553f7;}exports[_0x9678('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 01a1025..2ee196d 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 _0x7d20=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','queuepause','voicequeuechannel','voicechannel'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0x7d20,0xe9));var _0x07d2=function(_0x219e05,_0x36e7b1){_0x219e05=_0x219e05-0x0;var _0x58d3de=_0x7d20[_0x219e05];return _0x58d3de;};'use strict';exports[_0x07d2('0x0')]={'queue':{'type':_0x07d2('0x1'),'required':!![]},'interface':{'type':_0x07d2('0x1'),'required':!![]},'membername':{'type':_0x07d2('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x07d2('0x1'),'required':!![]},'interface':{'type':_0x07d2('0x1'),'required':!![]}};exports[_0x07d2('0x2')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x07d2('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x07d2('0x1'),'required':![]}};exports[_0x07d2('0x3')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x07d2('0x4')]={'uniqueid':{'type':_0x07d2('0x1'),'required':!![]},'filename':{'type':_0x07d2('0x1')},'format':{'type':_0x07d2('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x07d2('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x07d2('0x6')]={'uniqueid':{'type':_0x07d2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x07d2('0x1')}}; \ No newline at end of file +var _0x8382=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','voicequeuechannel','voicechannel'];(function(_0x6b7dd0,_0x2eebf2){var _0x2356cc=function(_0x18c8d8){while(--_0x18c8d8){_0x6b7dd0['push'](_0x6b7dd0['shift']());}};_0x2356cc(++_0x2eebf2);}(_0x8382,0x1ec));var _0x2838=function(_0x1d6968,_0x46ccfe){_0x1d6968=_0x1d6968-0x0;var _0x302baa=_0x8382[_0x1d6968];return _0x302baa;};'use strict';exports[_0x2838('0x0')]={'queue':{'type':_0x2838('0x1'),'required':!![]},'interface':{'type':_0x2838('0x1'),'required':!![]},'membername':{'type':_0x2838('0x1'),'required':!![]},'penalty':{'type':_0x2838('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2838('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x2838('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x2838('0x1'),'required':![]}};exports[_0x2838('0x3')]={'uniqueid':{'type':_0x2838('0x1'),'required':!![]}};exports[_0x2838('0x4')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2838('0x1')},'format':{'type':_0x2838('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x2838('0x5')]={'uniqueid':{'type':_0x2838('0x1'),'required':!![]}};exports[_0x2838('0x6')]={'uniqueid':{'type':_0x2838('0x1'),'required':!![]},'exten':{'type':_0x2838('0x1'),'required':!![]},'context':{'type':_0x2838('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b7878f7..2b03927 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x50a35b,_0x161341){_0x50a35b=_0x50a35b-0x0;var _0x479ad1=_0x2032[_0x50a35b];return _0x479ad1;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0e,0x187));var _0xe0b0=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x0b0e[_0x296144];return _0x5329b1;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index b07faf0..1dffc33 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 _0x6302=['hasOwnProperty'];(function(_0x44e918,_0x4ef1d7){var _0x56dc25=function(_0x5c8c00){while(--_0x5c8c00){_0x44e918['push'](_0x44e918['shift']());}};_0x56dc25(++_0x4ef1d7);}(_0x6302,0x1df));var _0x2630=function(_0x515d27,_0x5ecc30){_0x515d27=_0x515d27-0x0;var _0x432d58=_0x6302[_0x515d27];return _0x432d58;};'use strict';function mergeDBDataToRealtime(_0x2c9d17,_0x51d64){var _0x1d72e9=Object['assign']({},_0x2c9d17);for(var _0x46532a in _0x51d64){if(_0x1d72e9[_0x2630('0x0')](_0x46532a)){_0x1d72e9[_0x46532a]=_0x51d64[_0x46532a];}}return _0x1d72e9;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xc9a9=['assign'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xc9a9,0xbb));var _0x9c9a=function(_0x48ba8b,_0x34ab24){_0x48ba8b=_0x48ba8b-0x0;var _0x4842c3=_0xc9a9[_0x48ba8b];return _0x4842c3;};'use strict';function mergeDBDataToRealtime(_0x475894,_0x5301c3){var _0x5e7782=Object[_0x9c9a('0x0')]({},_0x475894);for(var _0x4b2f48 in _0x5301c3){if(_0x5e7782['hasOwnProperty'](_0x4b2f48)){_0x5e7782[_0x4b2f48]=_0x5301c3[_0x4b2f48];}}return _0x5e7782;}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 9e9574a..7f7a0ad 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 _0x695c=['destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','forEach','startsWith','Local','substring','indexOf','mobile','membername','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','SIP/%s','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','calleridnum','internal','type','dialer','lastapplication','queue','lastdata','destination','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','channel'];(function(_0x425b19,_0x2dcf14){var _0x15ecab=function(_0x317d46){while(--_0x317d46){_0x425b19['push'](_0x425b19['shift']());}};_0x15ecab(++_0x2dcf14);}(_0x695c,0x174));var _0xc695=function(_0x55a5c5,_0x421935){_0x55a5c5=_0x55a5c5-0x0;var _0x55f93a=_0x695c[_0x55a5c5];return _0x55f93a;};'use strict';var _=require(_0xc695('0x0'));var moment=require(_0xc695('0x1'));var util=require(_0xc695('0x2'));var config=require(_0xc695('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xc695('0x4'));var RpcVoiceCallReport=require(_0xc695('0x5'));var RpcVoiceDialReport=require(_0xc695('0x6'));var RpcMemberReport=require(_0xc695('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xc695('0x8'));var VoiceAgentReport=require(_0xc695('0x9'));var VoiceDialReport=require(_0xc695('0xa'));var UserReport=require(_0xc695('0xb'));function Report(_0x32cf6a){this[_0xc695('0xc')]=_0x32cf6a;this[_0xc695('0xd')]=_0x32cf6a[_0xc695('0xd')];this[_0xc695('0xe')]=_0x32cf6a['telephones'];}Report[_0xc695('0xf')][_0xc695('0x10')]=function(_0xa5fcd2){var _0x5e6ab5=new VoiceQueueReport(this[_0xc695('0xc')]);var _0x5ad3a3=new VoiceAgentReport(this[_0xc695('0xc')]);var _0x2a4617=new VoiceDialReport(this[_0xc695('0xc')]);var _0x2c16d6=new VoiceCallReport(this[_0xc695('0xc')]);var _0x3ba8ac=new UserReport(this['realtime']);if(config[_0xc695('0x11')]&&config[_0xc695('0x11')][_0xc695('0x12')]){ami['on'](_0xc695('0x13'),this[_0xc695('0x14')]['bind'](this));ami['on'](_0xc695('0x15'),this[_0xc695('0x16')][_0xc695('0x17')](this));ami['on'](_0xc695('0x18'),this[_0xc695('0x19')][_0xc695('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xc695('0x1a')][_0xc695('0x17')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xc695('0x17')](this));ami['on'](_0xc695('0x1b'),this['attendedTransfer'][_0xc695('0x17')](this));}};Report[_0xc695('0xf')][_0xc695('0x1c')]=function(_0x14395c){var _0x8d3c40;_0x8d3c40=_['find'](this[_0xc695('0xd')],function(_0xac6586){return _0xac6586[_0xc695('0x1d')]==_0x14395c||_0xac6586[_0xc695('0x1e')]==_0x14395c;});if(_[_0xc695('0x1f')](_0x8d3c40)){var _0x3ef924=_[_0xc695('0x20')](this['telephones'],function(_0xa31a8){return _0xa31a8[_0xc695('0x1d')]==_0x14395c||_0xa31a8['name']==_0x14395c;});if(_0x3ef924){_0x8d3c40=_['find'](this[_0xc695('0xd')],function(_0x4d08e6){return _0x4d08e6[_0xc695('0x21')]==util['format'](_0xc695('0x22'),_0x3ef924[_0xc695('0x1e')]);});}}return _0x8d3c40;};Report['prototype'][_0xc695('0x14')]=function(_0x1b4433){for(var _0x406779=0x0;_0x406779<_0x1b4433[_0xc695('0x23')];_0x406779+=0x1){var _0x10cbf7=this[_0xc695('0x1c')](_0x1b4433[_0x406779][_0xc695('0x24')]);if(_0x10cbf7){_0x1b4433[_0x406779][_0xc695('0x1d')]=_0x10cbf7[_0xc695('0x1d')];_0x1b4433[_0x406779][_0xc695('0x25')]=!![];_0x1b4433[_0x406779]['lastAssignedTo']=_0x10cbf7[_0xc695('0x1e')];_0x1b4433[_0x406779][_0xc695('0x21')]=_[_0xc695('0x1f')](_0x10cbf7[_0xc695('0x21')])?util[_0xc695('0x26')]('SIP/%s',_0x10cbf7[_0xc695('0x1e')]):_0x10cbf7[_0xc695('0x21')];if(_0x1b4433[_0x406779][_0xc695('0x27')]){_0x1b4433[_0x406779][_0xc695('0x28')]=moment()[_0xc695('0x26')](_0xc695('0x29'));}if(_0x1b4433[_0x406779]['queuecallerexit']){_0x1b4433[_0x406779][_0xc695('0x2a')]=moment()[_0xc695('0x26')](_0xc695('0x29'));}RpcMemberReport[_0xc695('0x14')](_0x1b4433[_0x406779]);}RpcVoiceQueueReport[_0xc695('0x2b')](_0x1b4433[_0x406779]);}};function extractCalleridNumber(_0x2872f5){var _0x5f4afc=_0x2872f5[_0xc695('0x2c')](/<(.*?)>/);return _0x5f4afc?_0x5f4afc[0x1]:_0x2872f5;}Report['prototype'][_0xc695('0x2d')]=function(_0x280a55){for(var _0x1f0d64=0x0;_0x1f0d64',_0x145cc1[_0xc695('0x42')],_0x145cc1['calleridnum']);}if(RpcVoiceTransferReport[_0xc695('0x43')][_0x145cc1['linkedid']]){var _0x1ec98d=RpcVoiceTransferReport[_0xc695('0x43')][_0x145cc1[_0xc695('0x44')]];_0x1ec98d[_0xc695('0x45')]=_0x145cc1[_0xc695('0x46')];RpcVoiceTransferReport[_0xc695('0x47')](_0x1ec98d);delete RpcVoiceTransferReport['transfers'][_0x145cc1['linkedid']];}if(_['isNil'](_0x145cc1[_0xc695('0x32')])){_0x145cc1['type']=this[_0xc695('0x2f')](_0x145cc1);}if(_['isNil'](_0x145cc1['UserId'])){var _0x5355b7=_0x145cc1[_0xc695('0x3e')]['split']('-')[0x0];var _0x5cb649=this[_0xc695('0xd')][_0x5355b7];if(!_0x5cb649)_0x5cb649=this['getAgentByInternal'](_0x145cc1[_0xc695('0x1d')]);if(_0x5cb649){_0x145cc1['UserId']=_0x5cb649['id'];_0x145cc1['membername']=_0x5cb649[_0xc695('0x1e')];}}RpcVoiceCallReport[_0xc695('0x2b')](_0x145cc1);if(_0x145cc1[_0xc695('0x48')]){for(var _0x1af5b1=0x0;_0x1af5b1<_0x145cc1[_0xc695('0x49')][_0xc695('0x23')];_0x1af5b1+=0x1){_0x145cc1[_0xc695('0x4a')]=_0x145cc1[_0xc695('0x49')][_0x1af5b1]['filename'];_0x145cc1[_0xc695('0x4b')]=_0x145cc1['monitors'][_0x1af5b1][_0xc695('0x4b')];if(_0x145cc1[_0xc695('0x4c')]=='xcally-motion-preview'){_0x145cc1['calleridnum']=_0x145cc1[_0xc695('0x24')];_0x145cc1['calleridname']=_0x145cc1[_0xc695('0x4d')];_0x145cc1[_0xc695('0x24')]=_0x145cc1[_0xc695('0x1d')];_0x145cc1[_0xc695('0x4d')]=_0x145cc1['membername'];_0x145cc1[_0xc695('0x4c')]=_0x145cc1[_0xc695('0x3d')];}else if(_0x145cc1[_0xc695('0x4c')]=='xcally-motion-dialer'){_0x145cc1[_0xc695('0x30')]=_0x145cc1[_0xc695('0x37')];_0x145cc1['exten']=_0x145cc1[_0xc695('0x3d')];}RpcVoiceRecording['create'](_0x145cc1);}}};Report[_0xc695('0xf')][_0xc695('0x19')]=function(_0x345535){if(_['isArray'](_0x345535)){_0x345535[_0xc695('0x4e')](function(_0x3a0363){RpcVoiceAgentReport[_0xc695('0x2b')](_0x3a0363);});}else{RpcVoiceAgentReport['create'](_0x345535);}};Report[_0xc695('0xf')][_0xc695('0x1a')]=function(_0x2a08c7){RpcVoiceDialReport[_0xc695('0x2b')](_0x2a08c7);var _0x21a6d4;var _0x2d2175;var _0x1fcdae=_0x2a08c7[_0xc695('0x3e')];if(_[_0xc695('0x4f')](_0x1fcdae,_0xc695('0x50'))){_0x2d2175=_0x1fcdae[_0xc695('0x51')](_0x1fcdae[_0xc695('0x52')]('/')+0x1,_0x1fcdae[_0xc695('0x52')]('@'));_0x21a6d4=_[_0xc695('0x20')](this[_0xc695('0xd')],function(_0x3710f7){return _0x3710f7[_0xc695('0x53')]==_0x2d2175||_0x3710f7['phone']==_0x2d2175||_0x3710f7[_0xc695('0x1d')]==_0x2d2175;});}else{_0x2d2175=_0x1fcdae['substring'](_0x1fcdae['indexOf']('/')+0x1,_0x1fcdae['lastIndexOf']('-'));_0x21a6d4=this[_0xc695('0x1c')](_0x2d2175);}if(_0x21a6d4){_0x2a08c7['interface']=_[_0xc695('0x1f')](_0x21a6d4[_0xc695('0x21')])?util[_0xc695('0x26')](_0xc695('0x22'),_0x21a6d4[_0xc695('0x1e')]):_0x21a6d4['interface'];_0x2a08c7[_0xc695('0x54')]=_0x21a6d4[_0xc695('0x1e')];_0x2a08c7[_0xc695('0x1d')]=_0x21a6d4[_0xc695('0x1d')];RpcMemberReport['voiceDialReport'](_0x2a08c7);}};Report[_0xc695('0xf')][_0xc695('0x47')]=function(_0x2fa36e){RpcVoiceTransferReport[_0xc695('0x43')][_0x2fa36e[_0xc695('0x55')]]=_0x2fa36e;};Report[_0xc695('0xf')][_0xc695('0x56')]=function(_0x294b2e){RpcVoiceTransferReport['attendedTransfer'](_0x294b2e);};module['exports']=Report; \ No newline at end of file +var _0x81a3=['createdAt','exten','xcally-motion-dialer','create','isArray','startsWith','Local','substring','indexOf','phone','SIP/%s','membername','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','length','connectedlinenum','lastAssignedTo','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','voiceCallReport','dialer','lastapplication','queue','lastdata','destination','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','type','UserId','monitor','monitors','monitorFilename'];(function(_0x743141,_0x43b3d8){var _0x812e79=function(_0x3354f4){while(--_0x3354f4){_0x743141['push'](_0x743141['shift']());}};_0x812e79(++_0x43b3d8);}(_0x81a3,0xc2));var _0x381a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x81a3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x381a('0x0'));var moment=require('moment');var util=require(_0x381a('0x1'));var config=require(_0x381a('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x381a('0x3'));var RpcVoiceCallReport=require(_0x381a('0x4'));var RpcVoiceDialReport=require(_0x381a('0x5'));var RpcMemberReport=require(_0x381a('0x6'));var RpcVoiceQueueReport=require(_0x381a('0x7'));var RpcVoiceRecording=require(_0x381a('0x8'));var RpcVoiceTransferReport=require(_0x381a('0x9'));var VoiceQueueReport=require(_0x381a('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x381a('0xb'));var VoiceDialReport=require(_0x381a('0xc'));var UserReport=require(_0x381a('0xd'));function Report(_0x1eaf9c){this[_0x381a('0xe')]=_0x1eaf9c;this[_0x381a('0xf')]=_0x1eaf9c[_0x381a('0xf')];this[_0x381a('0x10')]=_0x1eaf9c[_0x381a('0x10')];}Report[_0x381a('0x11')]['sync']=function(_0x6aab2b){var _0x45f076=new VoiceQueueReport(this[_0x381a('0xe')]);var _0x36d0db=new VoiceAgentReport(this['realtime']);var _0xcd3ad0=new VoiceDialReport(this[_0x381a('0xe')]);var _0x26c345=new VoiceCallReport(this['realtime']);var _0x57d28f=new UserReport(this[_0x381a('0xe')]);if(config['xdr']&&config[_0x381a('0x12')][_0x381a('0x13')]){ami['on'](_0x381a('0x14'),this[_0x381a('0x15')]['bind'](this));ami['on'](_0x381a('0x16'),this['voiceCallReport'][_0x381a('0x17')](this));ami['on'](_0x381a('0x18'),this[_0x381a('0x19')][_0x381a('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x381a('0x1a')][_0x381a('0x17')](this));ami['on'](_0x381a('0x1b'),this[_0x381a('0x1c')][_0x381a('0x17')](this));ami['on'](_0x381a('0x1d'),this[_0x381a('0x1e')][_0x381a('0x17')](this));}};Report[_0x381a('0x11')][_0x381a('0x1f')]=function(_0x8426fe){var _0x436fcc;_0x436fcc=_['find'](this[_0x381a('0xf')],function(_0x56bcd4){return _0x56bcd4[_0x381a('0x20')]==_0x8426fe||_0x56bcd4[_0x381a('0x21')]==_0x8426fe;});if(_[_0x381a('0x22')](_0x436fcc)){var _0xaee59e=_[_0x381a('0x23')](this[_0x381a('0x10')],function(_0x2f9235){return _0x2f9235['accountcode']==_0x8426fe||_0x2f9235[_0x381a('0x21')]==_0x8426fe;});if(_0xaee59e){_0x436fcc=_[_0x381a('0x23')](this[_0x381a('0xf')],function(_0x25adcf){return _0x25adcf['interface']==util['format']('SIP/%s',_0xaee59e[_0x381a('0x21')]);});}}return _0x436fcc;};Report[_0x381a('0x11')][_0x381a('0x15')]=function(_0x36dd31){for(var _0x2622cf=0x0;_0x2622cf<_0x36dd31[_0x381a('0x24')];_0x2622cf+=0x1){var _0x52ed17=this['findAgent'](_0x36dd31[_0x2622cf][_0x381a('0x25')]);if(_0x52ed17){_0x36dd31[_0x2622cf]['accountcode']=_0x52ed17[_0x381a('0x20')];_0x36dd31[_0x2622cf]['assigned']=!![];_0x36dd31[_0x2622cf][_0x381a('0x26')]=_0x52ed17['name'];_0x36dd31[_0x2622cf][_0x381a('0x27')]=_[_0x381a('0x22')](_0x52ed17[_0x381a('0x27')])?util[_0x381a('0x28')]('SIP/%s',_0x52ed17[_0x381a('0x21')]):_0x52ed17[_0x381a('0x27')];if(_0x36dd31[_0x2622cf][_0x381a('0x29')]){_0x36dd31[_0x2622cf][_0x381a('0x2a')]=moment()[_0x381a('0x28')](_0x381a('0x2b'));}if(_0x36dd31[_0x2622cf]['queuecallerexit']){_0x36dd31[_0x2622cf][_0x381a('0x2c')]=moment()[_0x381a('0x28')](_0x381a('0x2b'));}RpcMemberReport[_0x381a('0x15')](_0x36dd31[_0x2622cf]);}RpcVoiceQueueReport['create'](_0x36dd31[_0x2622cf]);}};function extractCalleridNumber(_0x186670){var _0x2dbab5=_0x186670['match'](/<(.*?)>/);return _0x2dbab5?_0x2dbab5[0x1]:_0x186670;}Report[_0x381a('0x11')][_0x381a('0x2d')]=function(_0x2934cb){for(var _0x12c55d=0x0;_0x12c55d',_0x289e49[_0x381a('0x43')],_0x289e49[_0x381a('0x32')]);}if(RpcVoiceTransferReport[_0x381a('0x44')][_0x289e49[_0x381a('0x45')]]){var _0x33f598=RpcVoiceTransferReport[_0x381a('0x44')][_0x289e49[_0x381a('0x45')]];_0x33f598[_0x381a('0x46')]=_0x289e49['uniqueid'];RpcVoiceTransferReport[_0x381a('0x1c')](_0x33f598);delete RpcVoiceTransferReport[_0x381a('0x44')][_0x289e49[_0x381a('0x45')]];}if(_[_0x381a('0x22')](_0x289e49['type'])){_0x289e49[_0x381a('0x47')]=this[_0x381a('0x2f')](_0x289e49);}if(_['isNil'](_0x289e49[_0x381a('0x48')])){var _0x3140e2=_0x289e49[_0x381a('0x30')][_0x381a('0x31')]('-')[0x0];var _0x482dbf=this[_0x381a('0xf')][_0x3140e2];if(!_0x482dbf)_0x482dbf=this[_0x381a('0x2d')](_0x289e49[_0x381a('0x20')]);if(_0x482dbf){_0x289e49[_0x381a('0x48')]=_0x482dbf['id'];_0x289e49['membername']=_0x482dbf[_0x381a('0x21')];}}RpcVoiceCallReport['create'](_0x289e49);if(_0x289e49[_0x381a('0x49')]){for(var _0xfbc7cf=0x0;_0xfbc7cf<_0x289e49[_0x381a('0x4a')]['length'];_0xfbc7cf+=0x1){_0x289e49[_0x381a('0x4b')]=_0x289e49['monitors'][_0xfbc7cf]['filename'];_0x289e49[_0x381a('0x4c')]=_0x289e49[_0x381a('0x4a')][_0xfbc7cf]['createdAt'];if(_0x289e49[_0x381a('0x4d')]==_0x381a('0x3e')){_0x289e49[_0x381a('0x32')]=_0x289e49[_0x381a('0x25')];_0x289e49[_0x381a('0x43')]=_0x289e49['connectedlinename'];_0x289e49[_0x381a('0x25')]=_0x289e49[_0x381a('0x20')];_0x289e49['connectedlinename']=_0x289e49['membername'];_0x289e49[_0x381a('0x4d')]=_0x289e49[_0x381a('0x40')];}else if(_0x289e49['exten']==_0x381a('0x4e')){_0x289e49[_0x381a('0x32')]=_0x289e49[_0x381a('0x3a')];_0x289e49[_0x381a('0x4d')]=_0x289e49[_0x381a('0x40')];}RpcVoiceRecording[_0x381a('0x4f')](_0x289e49);}}};Report[_0x381a('0x11')][_0x381a('0x19')]=function(_0x2fc99d){if(_[_0x381a('0x50')](_0x2fc99d)){_0x2fc99d['forEach'](function(_0x4bcc98){RpcVoiceAgentReport['create'](_0x4bcc98);});}else{RpcVoiceAgentReport['create'](_0x2fc99d);}};Report['prototype'][_0x381a('0x1a')]=function(_0x55ad3c){RpcVoiceDialReport[_0x381a('0x4f')](_0x55ad3c);var _0x43eaa9;var _0x12a75a;var _0x3be378=_0x55ad3c['channel'];if(_[_0x381a('0x51')](_0x3be378,_0x381a('0x52'))){_0x12a75a=_0x3be378[_0x381a('0x53')](_0x3be378[_0x381a('0x54')]('/')+0x1,_0x3be378[_0x381a('0x54')]('@'));_0x43eaa9=_[_0x381a('0x23')](this[_0x381a('0xf')],function(_0x26d35d){return _0x26d35d['mobile']==_0x12a75a||_0x26d35d[_0x381a('0x55')]==_0x12a75a||_0x26d35d[_0x381a('0x20')]==_0x12a75a;});}else{_0x12a75a=_0x3be378['substring'](_0x3be378[_0x381a('0x54')]('/')+0x1,_0x3be378['lastIndexOf']('-'));_0x43eaa9=this[_0x381a('0x1f')](_0x12a75a);}if(_0x43eaa9){_0x55ad3c[_0x381a('0x27')]=_[_0x381a('0x22')](_0x43eaa9['interface'])?util[_0x381a('0x28')](_0x381a('0x56'),_0x43eaa9[_0x381a('0x21')]):_0x43eaa9[_0x381a('0x27')];_0x55ad3c[_0x381a('0x57')]=_0x43eaa9[_0x381a('0x21')];_0x55ad3c['accountcode']=_0x43eaa9['accountcode'];RpcMemberReport[_0x381a('0x1a')](_0x55ad3c);}};Report[_0x381a('0x11')]['blindTransfer']=function(_0x1f7f7b){RpcVoiceTransferReport['transfers'][_0x1f7f7b[_0x381a('0x58')]]=_0x1f7f7b;};Report[_0x381a('0x11')][_0x381a('0x1e')]=function(_0x2037a4){RpcVoiceTransferReport[_0x381a('0x1e')](_0x2037a4);};module[_0x381a('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f46f357..db6db8d 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fd5=['telephone:%s','telephone:save','trunk:save','startsWith','substring','indexOf','find','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','stateRegistry','merge','omit','event','format','trunk:%s','name','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0x0fd5,0x1e6));var _0x50fd=function(_0x15eeab,_0x1192ba){_0x15eeab=_0x15eeab-0x0;var _0x58b610=_0x0fd5[_0x15eeab];return _0x58b610;};'use strict';var _=require(_0x50fd('0x0'));var moment=require(_0x50fd('0x1'));var util=require(_0x50fd('0x2'));var Redis=require(_0x50fd('0x3'));var BPromise=require(_0x50fd('0x4'));var config=require(_0x50fd('0x5'));var logger=require(_0x50fd('0x6'))('ami');var ami=require(_0x50fd('0x7'));config[_0x50fd('0x8')]=_[_0x50fd('0x9')](config[_0x50fd('0x8')],{'host':_0x50fd('0xa'),'port':0x18eb});var io=require(_0x50fd('0xb'))(new Redis(config[_0x50fd('0x8')]));function UserReport(_0x496ec1){this[_0x50fd('0xc')]=_0x496ec1[_0x50fd('0xc')];this[_0x50fd('0xd')]=_0x496ec1[_0x50fd('0xd')];this[_0x50fd('0xe')]=_0x496ec1[_0x50fd('0xe')];ami['on'](_0x50fd('0xf'),this[_0x50fd('0x10')]['bind'](this));ami['on']('registry',this[_0x50fd('0x10')][_0x50fd('0x11')](this));ami['on'](_0x50fd('0x12'),this[_0x50fd('0x13')][_0x50fd('0x11')](this));ami['on'](_0x50fd('0x14'),this[_0x50fd('0x15')][_0x50fd('0x11')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x50fd('0x16')]()[_0x50fd('0x17')](ami[_0x50fd('0x18')]())[_0x50fd('0x19')](function(_0x5b7d7b){logger['error']('[userReport][sipshowregistry]',util[_0x50fd('0x1a')](_0x5b7d7b,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x50fd('0x16')]()[_0x50fd('0x17')](ami[_0x50fd('0x1b')]())[_0x50fd('0x19')](function(_0x5b55af){logger[_0x50fd('0x1c')](_0x50fd('0x1d'),util['inspect'](_0x5b55af,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x50fd('0x16')]()[_0x50fd('0x17')](ami[_0x50fd('0x1e')]())['catch'](function(_0x1bab8b){logger['error'](_0x50fd('0x1f'),util[_0x50fd('0x1a')](_0x1bab8b,{'showHidden':![],'depth':null}));});}UserReport[_0x50fd('0x20')][_0x50fd('0x21')]=function(){setInterval(function(){BPromise[_0x50fd('0x16')]()['then'](showSipRegistrations())[_0x50fd('0x17')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x50fd('0x20')][_0x50fd('0x22')]=function(_0x12e166){return _0x12e166!==null&&!_[_0x50fd('0x23')](_0x12e166);};UserReport[_0x50fd('0x20')][_0x50fd('0x24')]=function(_0x8d28de,_0x331298,_0x20f626){io['to'](_0x8d28de)[_0x50fd('0x24')](_0x331298,_0x20f626);};UserReport['prototype'][_0x50fd('0x10')]=function(_0x1726f2){try{if(this[_0x50fd('0x22')](_0x1726f2)){logger['info'](_0x50fd('0x25'),_0x1726f2[_0x50fd('0x26')],_0x1726f2[_0x50fd('0x27')]);logger[_0x50fd('0x28')](_0x50fd('0x29'),util['inspect'](_0x1726f2,{'showHidden':![],'depth':null}));var _0x31f271=_['find'](this[_0x50fd('0xc')],{'defaultuser':_0x1726f2[_0x50fd('0x26')]});if(_0x31f271){_0x1726f2[_0x50fd('0x2a')]=_0x1726f2[_0x50fd('0x27')];_[_0x50fd('0x2b')](_0x31f271,_[_0x50fd('0x2c')](_0x1726f2,[_0x50fd('0x2d'),'actionid','username',_0x50fd('0x27')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x50fd('0x1a')](_0x31f271,{'showHidden':![],'depth':null}));this['emit'](util[_0x50fd('0x2e')](_0x50fd('0x2f'),_0x31f271[_0x50fd('0x30')]),'trunk:save',_0x31f271);}}}catch(_0x2e9a34){logger['error'](_0x50fd('0x29'),util[_0x50fd('0x1a')](_0x2e9a34,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x50fd('0x13')]=function(_0x190f6d){try{if(this[_0x50fd('0x22')](_0x190f6d)){logger[_0x50fd('0x31')](_0x50fd('0x32'),_0x190f6d[_0x50fd('0x33')],_0x190f6d[_0x50fd('0x27')]);logger[_0x50fd('0x28')](_0x50fd('0x34'),util[_0x50fd('0x1a')](_0x190f6d,{'showHidden':![],'depth':null}));if(this[_0x50fd('0xd')][_0x190f6d[_0x50fd('0x33')]]){if(!this[_0x50fd('0xd')][_0x190f6d[_0x50fd('0x33')]]['local']||_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]()==_0x50fd('0x36')){this[_0x50fd('0xd')][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x37')]=![];if(this[_0x50fd('0xd')][_0x190f6d['device']][_0x50fd('0x27')]!==_0x190f6d[_0x50fd('0x27')]['toLowerCase']()){this[_0x50fd('0xd')][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x38')]=_['toNumber'](moment()['format']('x'));}this[_0x50fd('0xd')][_0x190f6d['device']][_0x50fd('0x27')]=_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]();this['agents'][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x39')](_0x190f6d);}}else if(this[_0x50fd('0xe')][_0x190f6d['device']]){if(this[_0x50fd('0xe')][_0x190f6d['device']][_0x50fd('0x27')]!==_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]()){this['telephones'][_0x190f6d['device']][_0x50fd('0x38')]=_[_0x50fd('0x3a')](moment()['format']('x'));}this[_0x50fd('0xe')][_0x190f6d[_0x50fd('0x33')]]['state']=_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]();logger['debug'](_0x50fd('0x3b'),util[_0x50fd('0x1a')](this[_0x50fd('0xe')][_0x190f6d[_0x50fd('0x33')]],{'showHidden':![],'depth':null}));this[_0x50fd('0x24')](util[_0x50fd('0x2e')](_0x50fd('0x3c'),this['telephones'][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x30')]),_0x50fd('0x3d'),this['telephones'][_0x190f6d[_0x50fd('0x33')]]);}else if(this[_0x50fd('0xc')][_0x190f6d[_0x50fd('0x33')]]){if(this[_0x50fd('0xc')][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x27')]!==_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]()){this['trunks'][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x38')]=_[_0x50fd('0x3a')](moment()[_0x50fd('0x2e')]('x'));}this[_0x50fd('0xc')][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x27')]=_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]();logger[_0x50fd('0x28')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x50fd('0x1a')](this[_0x50fd('0xc')][_0x190f6d[_0x50fd('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x50fd('0x2f'),this['trunks'][_0x190f6d[_0x50fd('0x33')]][_0x50fd('0x30')]),_0x50fd('0x3e'),this['trunks'][_0x190f6d[_0x50fd('0x33')]]);}else if(_[_0x50fd('0x3f')](_0x190f6d[_0x50fd('0x33')],'Local')){var _0x57606a=_0x190f6d['device'];var _0x57ddb9=_0x57606a[_0x50fd('0x40')](_0x57606a[_0x50fd('0x41')]('/')+0x1,_0x57606a[_0x50fd('0x41')]('@'));var _0x3c3399=_[_0x50fd('0x42')](this[_0x50fd('0xd')],function(_0x1ca821){return _0x1ca821[_0x50fd('0x43')]==_0x57ddb9||_0x1ca821[_0x50fd('0x44')]==_0x57ddb9||_0x1ca821[_0x50fd('0x45')]==_0x57ddb9;});if(_0x3c3399){if(_0x3c3399[_0x50fd('0x27')]!==_0x190f6d[_0x50fd('0x27')][_0x50fd('0x35')]()){_0x3c3399['stateTime']=_[_0x50fd('0x3a')](moment()[_0x50fd('0x2e')]('x'));}_0x3c3399[_0x50fd('0x27')]=_0x190f6d[_0x50fd('0x27')]['toLowerCase']();_0x3c3399[_0x50fd('0x37')]=!![];_0x3c3399['updateStatusRealtime'](_0x190f6d);}}}}catch(_0x219960){logger['error']('[userReport][devicestatechange]',util[_0x50fd('0x1a')](_0x219960,{'showHidden':![],'depth':null}));}};UserReport[_0x50fd('0x20')][_0x50fd('0x15')]=function(_0x43145b){try{if(this[_0x50fd('0x22')](_0x43145b)&&this[_0x50fd('0x22')](_0x43145b['peerstatus'])){logger[_0x50fd('0x31')](_0x50fd('0x46'),_0x43145b[_0x50fd('0x47')],_0x43145b[_0x50fd('0x48')],_0x43145b[_0x50fd('0x14')]);logger['debug'](_0x50fd('0x49'),util[_0x50fd('0x1a')](_0x43145b,{'showHidden':![],'depth':null}));if(this[_0x50fd('0xd')][_0x43145b[_0x50fd('0x47')]]){if(!this[_0x50fd('0xd')][_0x43145b[_0x50fd('0x47')]][_0x50fd('0x37')]||_0x43145b[_0x50fd('0x14')]['toLowerCase']()=='registered'){this[_0x50fd('0xd')][_0x43145b[_0x50fd('0x47')]]['local']=![];this['agents'][_0x43145b['peer']][_0x50fd('0x4a')]=_0x43145b[_0x50fd('0x14')][_0x50fd('0x35')]();this[_0x50fd('0xd')][_0x43145b['peer']]['address']=_0x43145b[_0x50fd('0x48')];this['agents'][_0x43145b['peer']][_0x50fd('0x39')](_0x43145b);}}else if(this['telephones'][_0x43145b[_0x50fd('0x47')]]){this['telephones'][_0x43145b[_0x50fd('0x47')]][_0x50fd('0x4a')]=_0x43145b[_0x50fd('0x14')][_0x50fd('0x35')]();this[_0x50fd('0xe')][_0x43145b['peer']][_0x50fd('0x48')]=_0x43145b[_0x50fd('0x48')];logger['debug'](_0x50fd('0x4b'),util[_0x50fd('0x1a')](this[_0x50fd('0xe')][_0x43145b[_0x50fd('0x47')]],{'showHidden':![],'depth':null}));this[_0x50fd('0x24')](util[_0x50fd('0x2e')](_0x50fd('0x3c'),this[_0x50fd('0xe')][_0x43145b[_0x50fd('0x47')]][_0x50fd('0x30')]),_0x50fd('0x3d'),this[_0x50fd('0xe')][_0x43145b[_0x50fd('0x47')]]);}else if(this[_0x50fd('0xc')][_0x43145b[_0x50fd('0x47')]]){this['trunks'][_0x43145b[_0x50fd('0x47')]][_0x50fd('0x4a')]=_0x43145b[_0x50fd('0x14')][_0x50fd('0x35')]();this[_0x50fd('0xc')][_0x43145b['peer']][_0x50fd('0x48')]=_0x43145b[_0x50fd('0x48')];logger[_0x50fd('0x28')](_0x50fd('0x4c'),util[_0x50fd('0x1a')](this['trunks'][_0x43145b[_0x50fd('0x47')]],{'showHidden':![],'depth':null}));this[_0x50fd('0x24')](util['format']('trunk:%s',this[_0x50fd('0xc')][_0x43145b[_0x50fd('0x47')]][_0x50fd('0x30')]),_0x50fd('0x3e'),this[_0x50fd('0xc')][_0x43145b[_0x50fd('0x47')]]);}}}catch(_0x360620){logger['error'](_0x50fd('0x49'),util['inspect'](_0x360620,{'showHidden':![],'depth':null}));}};module[_0x50fd('0x4d')]=UserReport; \ No newline at end of file +var _0xee82=['toLowerCase','inuse','local','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','emit','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','info','username','[userReport][registry]','find','state','merge','omit','event','actionid','debug','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]'];(function(_0xfa260b,_0xd2d0d){var _0x48fb84=function(_0x111f00){while(--_0x111f00){_0xfa260b['push'](_0xfa260b['shift']());}};_0x48fb84(++_0xd2d0d);}(_0xee82,0x18b));var _0x2ee8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xee82[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var moment=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var Redis=require(_0x2ee8('0x2'));var BPromise=require(_0x2ee8('0x3'));var config=require(_0x2ee8('0x4'));var logger=require(_0x2ee8('0x5'))('ami');var ami=require(_0x2ee8('0x6'));config['redis']=_['defaults'](config[_0x2ee8('0x7')],{'host':_0x2ee8('0x8'),'port':0x18eb});var io=require(_0x2ee8('0x9'))(new Redis(config[_0x2ee8('0x7')]));function UserReport(_0x158393){this['trunks']=_0x158393[_0x2ee8('0xa')];this['agents']=_0x158393[_0x2ee8('0xb')];this[_0x2ee8('0xc')]=_0x158393[_0x2ee8('0xc')];ami['on'](_0x2ee8('0xd'),this[_0x2ee8('0xe')]['bind'](this));ami['on'](_0x2ee8('0xf'),this[_0x2ee8('0xe')][_0x2ee8('0x10')](this));ami['on']('devicestatechange',this[_0x2ee8('0x11')][_0x2ee8('0x10')](this));ami['on'](_0x2ee8('0x12'),this['syncPeerStatus']['bind'](this));return this[_0x2ee8('0x13')]();}function showSipRegistrations(){Promise[_0x2ee8('0x14')]()[_0x2ee8('0x15')](ami[_0x2ee8('0x16')]())[_0x2ee8('0x17')](function(_0x1cd0dd){logger['error'](_0x2ee8('0x18'),util[_0x2ee8('0x19')](_0x1cd0dd,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x2ee8('0x14')]()[_0x2ee8('0x15')](ami[_0x2ee8('0x1a')]())[_0x2ee8('0x17')](function(_0x350926){logger[_0x2ee8('0x1b')]('[userReport][devicestatelist]',util['inspect'](_0x350926,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x2ee8('0x15')](ami[_0x2ee8('0x1c')]())['catch'](function(_0x1ef694){logger[_0x2ee8('0x1b')](_0x2ee8('0x1d'),util[_0x2ee8('0x19')](_0x1ef694,{'showHidden':![],'depth':null}));});}UserReport[_0x2ee8('0x1e')][_0x2ee8('0x13')]=function(){setInterval(function(){BPromise[_0x2ee8('0x14')]()[_0x2ee8('0x15')](showSipRegistrations())[_0x2ee8('0x15')](listDeviceStates())[_0x2ee8('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x2ee8('0x1e')][_0x2ee8('0x1f')]=function(_0x197180){return _0x197180!==null&&!_[_0x2ee8('0x20')](_0x197180);};UserReport[_0x2ee8('0x1e')]['emit']=function(_0x1ef8d1,_0x59884c,_0x1ede4c){io['to'](_0x1ef8d1)['emit'](_0x59884c,_0x1ede4c);};UserReport[_0x2ee8('0x1e')][_0x2ee8('0xe')]=function(_0x1bfbc9){try{if(this[_0x2ee8('0x1f')](_0x1bfbc9)){logger[_0x2ee8('0x21')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x1bfbc9[_0x2ee8('0x22')],_0x1bfbc9['state']);logger['debug'](_0x2ee8('0x23'),util['inspect'](_0x1bfbc9,{'showHidden':![],'depth':null}));var _0x386de8=_[_0x2ee8('0x24')](this[_0x2ee8('0xa')],{'defaultuser':_0x1bfbc9[_0x2ee8('0x22')]});if(_0x386de8){_0x1bfbc9['stateRegistry']=_0x1bfbc9[_0x2ee8('0x25')];_[_0x2ee8('0x26')](_0x386de8,_[_0x2ee8('0x27')](_0x1bfbc9,[_0x2ee8('0x28'),_0x2ee8('0x29'),'username',_0x2ee8('0x25')]));logger[_0x2ee8('0x2a')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x2ee8('0x19')](_0x386de8,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x2ee8('0x2b'),_0x386de8[_0x2ee8('0x2c')]),_0x2ee8('0x2d'),_0x386de8);}}}catch(_0x5b314c){logger[_0x2ee8('0x1b')](_0x2ee8('0x23'),util[_0x2ee8('0x19')](_0x5b314c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2ee8('0x11')]=function(_0x2402e7){try{if(this[_0x2ee8('0x1f')](_0x2402e7)){logger[_0x2ee8('0x21')](_0x2ee8('0x2e'),_0x2402e7[_0x2ee8('0x2f')],_0x2402e7[_0x2ee8('0x25')]);logger[_0x2ee8('0x2a')](_0x2ee8('0x30'),util[_0x2ee8('0x19')](_0x2402e7,{'showHidden':![],'depth':null}));if(this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]]){if(!this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]]['local']||_0x2402e7[_0x2ee8('0x25')][_0x2ee8('0x31')]()==_0x2ee8('0x32')){this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x33')]=![];if(this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x25')]!==_0x2402e7[_0x2ee8('0x25')]['toLowerCase']()){this[_0x2ee8('0xb')][_0x2402e7['device']]['stateTime']=_[_0x2ee8('0x34')](moment()[_0x2ee8('0x35')]('x'));}this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]]['state']=_0x2402e7['state']['toLowerCase']();this[_0x2ee8('0xb')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x36')](_0x2402e7);}}else if(this[_0x2ee8('0xc')][_0x2402e7[_0x2ee8('0x2f')]]){if(this[_0x2ee8('0xc')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x25')]!==_0x2402e7['state'][_0x2ee8('0x31')]()){this[_0x2ee8('0xc')][_0x2402e7['device']][_0x2ee8('0x37')]=_['toNumber'](moment()['format']('x'));}this[_0x2ee8('0xc')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x25')]=_0x2402e7[_0x2ee8('0x25')]['toLowerCase']();logger[_0x2ee8('0x2a')](_0x2ee8('0x38'),util['inspect'](this[_0x2ee8('0xc')][_0x2402e7[_0x2ee8('0x2f')]],{'showHidden':![],'depth':null}));this[_0x2ee8('0x39')](util[_0x2ee8('0x35')](_0x2ee8('0x3a'),this[_0x2ee8('0xc')][_0x2402e7['device']]['name']),_0x2ee8('0x3b'),this[_0x2ee8('0xc')][_0x2402e7[_0x2ee8('0x2f')]]);}else if(this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]]){if(this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]]['state']!==_0x2402e7['state'][_0x2ee8('0x31')]()){this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x37')]=_[_0x2ee8('0x34')](moment()[_0x2ee8('0x35')]('x'));}this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]][_0x2ee8('0x25')]=_0x2402e7[_0x2ee8('0x25')][_0x2ee8('0x31')]();logger['debug'](_0x2ee8('0x3c'),util['inspect'](this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]],{'showHidden':![],'depth':null}));this[_0x2ee8('0x39')](util[_0x2ee8('0x35')](_0x2ee8('0x2b'),this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]]['name']),_0x2ee8('0x2d'),this[_0x2ee8('0xa')][_0x2402e7[_0x2ee8('0x2f')]]);}else if(_['startsWith'](_0x2402e7[_0x2ee8('0x2f')],'Local')){var _0x643ac2=_0x2402e7[_0x2ee8('0x2f')];var _0x537256=_0x643ac2[_0x2ee8('0x3d')](_0x643ac2['indexOf']('/')+0x1,_0x643ac2[_0x2ee8('0x3e')]('@'));var _0x3c6886=_[_0x2ee8('0x24')](this['agents'],function(_0x2c39af){return _0x2c39af[_0x2ee8('0x3f')]==_0x537256||_0x2c39af[_0x2ee8('0x40')]==_0x537256||_0x2c39af[_0x2ee8('0x41')]==_0x537256;});if(_0x3c6886){if(_0x3c6886[_0x2ee8('0x25')]!==_0x2402e7[_0x2ee8('0x25')][_0x2ee8('0x31')]()){_0x3c6886['stateTime']=_[_0x2ee8('0x34')](moment()[_0x2ee8('0x35')]('x'));}_0x3c6886[_0x2ee8('0x25')]=_0x2402e7[_0x2ee8('0x25')][_0x2ee8('0x31')]();_0x3c6886[_0x2ee8('0x33')]=!![];_0x3c6886['updateStatusRealtime'](_0x2402e7);}}}}catch(_0x48478a){logger[_0x2ee8('0x1b')](_0x2ee8('0x30'),util[_0x2ee8('0x19')](_0x48478a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2ee8('0x42')]=function(_0x43c51e){try{if(this[_0x2ee8('0x1f')](_0x43c51e)&&this[_0x2ee8('0x1f')](_0x43c51e[_0x2ee8('0x12')])){logger[_0x2ee8('0x21')](_0x2ee8('0x43'),_0x43c51e[_0x2ee8('0x44')],_0x43c51e[_0x2ee8('0x45')],_0x43c51e[_0x2ee8('0x12')]);logger[_0x2ee8('0x2a')]('[userReport][peerstatus]',util[_0x2ee8('0x19')](_0x43c51e,{'showHidden':![],'depth':null}));if(this[_0x2ee8('0xb')][_0x43c51e[_0x2ee8('0x44')]]){if(!this[_0x2ee8('0xb')][_0x43c51e['peer']]['local']||_0x43c51e[_0x2ee8('0x12')][_0x2ee8('0x31')]()=='registered'){this[_0x2ee8('0xb')][_0x43c51e['peer']][_0x2ee8('0x33')]=![];this[_0x2ee8('0xb')][_0x43c51e[_0x2ee8('0x44')]]['status']=_0x43c51e['peerstatus']['toLowerCase']();this['agents'][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x45')]=_0x43c51e[_0x2ee8('0x45')];this[_0x2ee8('0xb')][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x36')](_0x43c51e);}}else if(this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]]){this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x46')]=_0x43c51e['peerstatus'][_0x2ee8('0x31')]();this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x45')]=_0x43c51e[_0x2ee8('0x45')];logger[_0x2ee8('0x2a')](_0x2ee8('0x47'),util['inspect'](this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]],{'showHidden':![],'depth':null}));this[_0x2ee8('0x39')](util[_0x2ee8('0x35')](_0x2ee8('0x3a'),this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x2c')]),_0x2ee8('0x3b'),this[_0x2ee8('0xc')][_0x43c51e[_0x2ee8('0x44')]]);}else if(this[_0x2ee8('0xa')][_0x43c51e[_0x2ee8('0x44')]]){this[_0x2ee8('0xa')][_0x43c51e['peer']][_0x2ee8('0x46')]=_0x43c51e['peerstatus']['toLowerCase']();this[_0x2ee8('0xa')][_0x43c51e[_0x2ee8('0x44')]]['address']=_0x43c51e[_0x2ee8('0x45')];logger[_0x2ee8('0x2a')](_0x2ee8('0x48'),util[_0x2ee8('0x19')](this['trunks'][_0x43c51e[_0x2ee8('0x44')]],{'showHidden':![],'depth':null}));this[_0x2ee8('0x39')](util[_0x2ee8('0x35')]('trunk:%s',this['trunks'][_0x43c51e[_0x2ee8('0x44')]][_0x2ee8('0x2c')]),_0x2ee8('0x2d'),this['trunks'][_0x43c51e['peer']]);}}}catch(_0x233a20){logger['error']('[userReport][peerstatus]',util[_0x2ee8('0x19')](_0x233a20,{'showHidden':![],'depth':null}));}};module[_0x2ee8('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index df679e6..3b407bf 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x930b=['syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','agents','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','pick','destconnectedlinenum','interface','accountcode','custom:agentconnect','user:agentconnect','agentringnoanswer','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','name','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','agentconnectAt','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x930b,0x89));var _0xb930=function(_0x428bfd,_0x13418d){_0x428bfd=_0x428bfd-0x0;var _0x385e66=_0x930b[_0x428bfd];return _0x385e66;};'use strict';var _=require(_0xb930('0x0'));var moment=require('moment');var util=require(_0xb930('0x1'));var Redis=require('ioredis');var config=require(_0xb930('0x2'));var logger=require(_0xb930('0x3'))(_0xb930('0x4'));var ami=require(_0xb930('0x5'));config['redis']=_[_0xb930('0x6')](config[_0xb930('0x7')],{'host':_0xb930('0x8'),'port':0x18eb});var io=require(_0xb930('0x9'))(new Redis(config[_0xb930('0x7')]));function VoiceAgentReport(_0x3db993){this[_0xb930('0xa')]={};this[_0xb930('0xb')]=_0x3db993[_0xb930('0xa')];this[_0xb930('0xc')]=_0x3db993[_0xb930('0xc')];this['agents']=_0x3db993['agents'];this[_0xb930('0xd')]={};ami['on'](_0xb930('0xe'),this[_0xb930('0xf')][_0xb930('0x10')](this));ami['on']('agentconnect',this[_0xb930('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0xb930('0x12')]['bind'](this));ami['on'](_0xb930('0x13'),this[_0xb930('0x14')][_0xb930('0x10')](this));ami['on']('agentcomplete',this[_0xb930('0x15')]['bind'](this));ami['on'](_0xb930('0x16'),this[_0xb930('0x17')][_0xb930('0x10')](this));ami['on'](_0xb930('0x18'),this[_0xb930('0x19')][_0xb930('0x10')](this));ami['on'](_0xb930('0x1a'),this['syncMusicOnHoldStart'][_0xb930('0x10')](this));ami['on'](_0xb930('0x1b'),this[_0xb930('0x1c')][_0xb930('0x10')](this));ami['on'](_0xb930('0x1d'),this['syncAttendedTransfer'][_0xb930('0x10')](this));ami['on']('blindtransfer',this[_0xb930('0x1e')][_0xb930('0x10')](this));}VoiceAgentReport['prototype'][_0xb930('0x1f')]=function(_0x1c75cf,_0x2dcbda,_0x3080af){io['to'](_0x1c75cf)[_0xb930('0x1f')](_0x2dcbda,_0x3080af);};VoiceAgentReport[_0xb930('0x20')][_0xb930('0x21')]=function(_0x2ac87a){return _0x2ac87a!==null&&!_[_0xb930('0x22')](_0x2ac87a);};VoiceAgentReport[_0xb930('0x20')][_0xb930('0xf')]=function(_0x572c0e){try{if(this[_0xb930('0x21')](_0x572c0e)){logger['info'](_0xb930('0x23'),_0x572c0e[_0xb930('0x24')],_0x572c0e[_0xb930('0x25')],_0x572c0e[_0xb930('0x26')]);logger[_0xb930('0x27')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x572c0e['uniqueid'],util['inspect'](_0x572c0e,{'showHidden':![],'depth':null}));if(_[_0xb930('0x22')](this[_0xb930('0xa')][_0x572c0e[_0xb930('0x24')]])){this[_0xb930('0xa')][_0x572c0e[_0xb930('0x24')]]={};}var _0x25d5a3=this[_0xb930('0x28')][_0x572c0e['interface']];var _0x4b2887=this[_0xb930('0xa')][_0x572c0e[_0xb930('0x24')]][_0x572c0e[_0xb930('0x26')]];var _0xe46bad=this[_0xb930('0xc')][_0x572c0e[_0xb930('0x29')]];var _0x207b6a=this[_0xb930('0xd')][_0x572c0e[_0xb930('0x24')]];if(_[_0xb930('0x22')](_0x4b2887)){_0x4b2887={'agentcalledAt':moment()[_0xb930('0x2a')](_0xb930('0x2b')),'lastevent':_0xb930('0x2c'),'mandatoryDisposition':_0xe46bad&&_0xe46bad[_0xb930('0x2d')]?_0xe46bad[_0xb930('0x2d')]:![],'type':_0xe46bad&&_0xe46bad[_0xb930('0x2e')]?_0xe46bad['type']:_0xb930('0x2f'),'variables':_0x207b6a,'motionChannel':_0xb930('0x30')};}Object[_0xb930('0x31')](_0x4b2887,_[_0xb930('0x32')](_0x572c0e,['event',_0xb930('0x33')]));this[_0xb930('0xa')][_0x572c0e[_0xb930('0x24')]][_0x572c0e['destuniqueid']]=_0x4b2887;logger['debug'](_0xb930('0x34'),_0x572c0e[_0xb930('0x24')],util[_0xb930('0x35')](_0x4b2887,{'showHidden':![],'depth':null}));ami[_0xb930('0x1f')](_0xb930('0x36'),_0x4b2887);var _0x86958f={'id':_0x25d5a3['id'],'calleridnum':_0x4b2887[_0xb930('0x37')],'queue':_0x4b2887[_0xb930('0x29')],'variables':_0x4b2887[_0xb930('0xd')],'uniqueid':_0x572c0e[_0xb930('0x24')]};logger[_0xb930('0x27')](_0xb930('0x38'),_0x572c0e[_0xb930('0x24')],util[_0xb930('0x35')](_0x86958f,{'showHidden':![],'depth':null}));this[_0xb930('0x1f')](util[_0xb930('0x2a')](_0xb930('0x39'),_0x572c0e[_0xb930('0x25')]),_0xb930('0x3a'),_0x86958f);}}catch(_0x5dadc3){logger['error'](_0xb930('0x3b'),_0x572c0e['uniqueid'],util[_0xb930('0x35')](_0x5dadc3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')][_0xb930('0x11')]=function(_0x18adcc){try{if(this[_0xb930('0x21')](_0x18adcc)){if(this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]]){for(var _0x4a0f2b in this[_0xb930('0xa')][_0x18adcc['uniqueid']]){if(this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0xb930('0x3c')](_0x4a0f2b)){if(_0x18adcc[_0xb930('0x26')]===_0x4a0f2b){logger[_0xb930('0x3d')](_0xb930('0x3e'),_0x18adcc[_0xb930('0x24')],_0x18adcc[_0xb930('0x25')],_0x18adcc['destuniqueid']);this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b]['agentconnectAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x3f')]=_0x18adcc['connectedlinename'];this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b][_0xb930('0x40')]=_0x18adcc[_0xb930('0x40')];this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x41')]=_0x18adcc[_0xb930('0x41')];this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x42')]=_0x18adcc[_0xb930('0x42')];this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b]['holdtime']=_0x18adcc[_0xb930('0x43')];this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x44')]='connect';if(this['voiceChannels'][this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b]['uniqueid']]){var _0x53c881=this[_0xb930('0xb')][this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x24')]][_0xb930('0x45')];this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b][_0xb930('0x45')]=_0x53c881;_0x18adcc[_0xb930('0x45')]=_0x53c881;}_['merge'](this[_0xb930('0x28')][_0x18adcc['interface']],_[_0xb930('0x46')](_0x18adcc,[_0xb930('0x29'),_0xb930('0x47'),_0xb930('0x45')]));var _0x47d190=this[_0xb930('0x28')][_0x18adcc[_0xb930('0x48')]];var _0x3d545e={'id':_0x47d190['id'],'name':_0x47d190['name'],'agentconnected':!![],'destaccountcode':_0x47d190[_0xb930('0x49')],'destconnectedlinenum':this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x18adcc['destuniqueid']]['exten'],'queue':this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x18adcc[_0xb930('0x26')]][_0xb930('0x29')],'routealias':this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x18adcc['destuniqueid']][_0xb930('0x45')],'uniqueid':this['channels'][_0x18adcc[_0xb930('0x24')]][_0x18adcc[_0xb930('0x26')]][_0xb930('0x24')]};ami[_0xb930('0x1f')](_0xb930('0x4a'),this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x18adcc['destuniqueid']]);this[_0xb930('0x1f')](util[_0xb930('0x2a')](_0xb930('0x39'),_0x18adcc[_0xb930('0x25')]),_0xb930('0x4b'),_0x3d545e);}else if(!this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b][_0xb930('0x4c')]&&!this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x4d')]){logger['info'](_0xb930('0x4e'),_0x18adcc[_0xb930('0x24')],this['channels'][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x25')],_0x4a0f2b);this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b][_0xb930('0x4c')]=!![];this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b]['agentringnoanswerAt']=moment()[_0xb930('0x2a')](_0xb930('0x2b'));this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x4f')]=_0x18adcc['destuniqueid'];this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b]['answeredelsewheremembername']=_0x18adcc[_0xb930('0x25')];this['channels'][_0x18adcc['uniqueid']][_0x4a0f2b][_0xb930('0x44')]=_0xb930('0x50');this[_0xb930('0xa')][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b][_0xb930('0x51')]='answered_elsewhere';logger[_0xb930('0x27')](_0xb930('0x52'),_0x18adcc[_0xb930('0x24')],util[_0xb930('0x35')](this[_0xb930('0xa')][_0x18adcc['uniqueid']][_0x4a0f2b],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this['channels'][_0x18adcc[_0xb930('0x24')]][_0x4a0f2b]);}else{logger[_0xb930('0x27')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x18adcc[_0xb930('0x24')]);}}}}}}catch(_0x4e88d8){logger[_0xb930('0x53')](_0xb930('0x54'),_0x18adcc['uniqueid'],util[_0xb930('0x35')](_0x4e88d8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')][_0xb930('0x12')]=function(_0xf4ce73){try{if(this[_0xb930('0x21')](_0xf4ce73)){logger[_0xb930('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0xf4ce73[_0xb930('0x24')],util[_0xb930('0x35')](_0xf4ce73,{'showHidden':![],'depth':null}));if(this[_0xb930('0xa')][_0xf4ce73[_0xb930('0x24')]]&&this[_0xb930('0xa')][_0xf4ce73[_0xb930('0x24')]][_0xf4ce73['destuniqueid']]){logger['info'](_0xb930('0x55'),_0xf4ce73[_0xb930('0x24')],_0xf4ce73[_0xb930('0x25')],_0xf4ce73[_0xb930('0x26')]);var _0x722b04=this['agents'][_0xf4ce73[_0xb930('0x48')]];var _0x21de69=this['channels'][_0xf4ce73[_0xb930('0x24')]][_0xf4ce73[_0xb930('0x26')]];_0x21de69[_0xb930('0x4c')]=!![];_0x21de69[_0xb930('0x56')]=moment()[_0xb930('0x2a')](_0xb930('0x2b'));_0x21de69[_0xb930('0x44')]=_0xb930('0x57');_0x21de69[_0xb930('0x51')]=_0xb930('0x57');var _0x12dd2c={'id':_0x722b04['id'],'name':_0x722b04[_0xb930('0x58')],'queue':_0x21de69[_0xb930('0x29')],'uniqueid':_0x21de69[_0xb930('0x24')]};logger[_0xb930('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xf4ce73[_0xb930('0x24')],util['inspect'](_0x12dd2c,{'showHidden':![],'depth':null}));this[_0xb930('0x1f')](util[_0xb930('0x2a')](_0xb930('0x39'),_0x722b04['name']),_0xb930('0x59'),_0x12dd2c);ami[_0xb930('0x1f')](_0xb930('0x5a'),_0x21de69);this[_0xb930('0xa')][_0xf4ce73['uniqueid']][_0xf4ce73['destuniqueid']]=Object[_0xb930('0x31')]({},_0x21de69);}}}catch(_0x1762e2){logger[_0xb930('0x53')](_0xb930('0x5b'),_0xf4ce73[_0xb930('0x24')],util[_0xb930('0x35')](_0x1762e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')][_0xb930('0x14')]=function(_0x1f04e0){try{if(this[_0xb930('0x21')](_0x1f04e0)){logger[_0xb930('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1f04e0[_0xb930('0x24')],util[_0xb930('0x35')](_0x1f04e0,{'showHidden':![],'depth':null}));if(this[_0xb930('0xa')][_0x1f04e0[_0xb930('0x24')]]){for(var _0x208d39 in this['channels'][_0x1f04e0['uniqueid']]){if(this['channels'][_0x1f04e0[_0xb930('0x24')]][_0xb930('0x3c')](_0x208d39)&&!this[_0xb930('0xa')][_0x1f04e0[_0xb930('0x24')]][_0x208d39]['agentringnoanswer']&&!this[_0xb930('0xa')][_0x1f04e0['uniqueid']][_0x208d39][_0xb930('0x4d')]){logger[_0xb930('0x3d')](_0xb930('0x5c'),_0x1f04e0['uniqueid'],this[_0xb930('0xa')][_0x1f04e0['uniqueid']][_0x208d39][_0xb930('0x25')],_0x208d39);this['channels'][_0x1f04e0[_0xb930('0x24')]][_0x208d39][_0xb930('0x4c')]=!![];this[_0xb930('0xa')][_0x1f04e0['uniqueid']][_0x208d39][_0xb930('0x56')]=moment()['format'](_0xb930('0x2b'));this[_0xb930('0xa')][_0x1f04e0[_0xb930('0x24')]][_0x208d39][_0xb930('0x44')]='abandoned';this['channels'][_0x1f04e0[_0xb930('0x24')]][_0x208d39][_0xb930('0x51')]=_0xb930('0x5d');logger['debug'](_0xb930('0x5e'),_0x1f04e0[_0xb930('0x24')],util[_0xb930('0x35')](this[_0xb930('0xa')][_0x1f04e0[_0xb930('0x24')]][_0x208d39],{'showHidden':![],'depth':null}));ami[_0xb930('0x1f')](_0xb930('0x5f'),this['channels'][_0x1f04e0[_0xb930('0x24')]][_0x208d39]);}}}}}catch(_0xfa4141){logger[_0xb930('0x53')]('[%s][voiceAgentReport][queuecallerabandon]',_0x1f04e0['uniqueid'],util[_0xb930('0x35')](_0xfa4141,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')]['syncAgentComplete']=function(_0x471cbd){try{if(this[_0xb930('0x21')](_0x471cbd)){logger[_0xb930('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x471cbd[_0xb930('0x24')],util['inspect'](_0x471cbd,{'showHidden':![],'depth':null}));if(this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]]){for(var _0x13ecab in this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]]){if(this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0xb930('0x3c')](_0x13ecab)){if(this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab]['agentconnectAt']&&!this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab]['agentcomplete']){logger[_0xb930('0x3d')](_0xb930('0x60'),_0x471cbd[_0xb930('0x24')],this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab][_0xb930('0x25')],_0x13ecab);this[_0xb930('0xa')][_0x471cbd['uniqueid']][_0x13ecab][_0xb930('0x4d')]=!![];this['channels'][_0x471cbd[_0xb930('0x24')]][_0x13ecab][_0xb930('0x61')]=moment()[_0xb930('0x2a')](_0xb930('0x2b'));this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab]['lastevent']='complete';this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab]['reason']=_0x471cbd['reason']==_0xb930('0x62')?_0xb930('0x63'):_0x471cbd[_0xb930('0x51')];this[_0xb930('0xa')][_0x471cbd['uniqueid']][_0x13ecab][_0xb930('0x64')]=_0x471cbd[_0xb930('0x64')];if(this['voiceQueues'][_0x471cbd[_0xb930('0x29')]]&&this['voiceQueues'][_0x471cbd['queue']][_0xb930('0x65')]){this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab][_0xb930('0x66')]=this[_0xb930('0xc')][_0x471cbd[_0xb930('0x29')]][_0xb930('0x67')];this[_0xb930('0xa')][_0x471cbd[_0xb930('0x24')]][_0x13ecab][_0xb930('0x68')]=!![];}this[_0xb930('0x28')][_0x471cbd[_0xb930('0x48')]]=_[_0xb930('0x32')](this[_0xb930('0x28')][_0x471cbd['interface']],['queue',_0xb930('0x47')]);logger[_0xb930('0x27')](_0xb930('0x69'),_0x471cbd['uniqueid'],util['inspect'](this['channels'][_0x471cbd[_0xb930('0x24')]][_0x13ecab],{'showHidden':![],'depth':null}));ami[_0xb930('0x1f')]('custom:agentcomplete',this[_0xb930('0xa')][_0x471cbd['uniqueid']][_0x13ecab]);logger[_0xb930('0x27')](_0xb930('0x6a'),_0x471cbd['uniqueid'],util['inspect']({'id':this['agents'][_0x471cbd[_0xb930('0x48')]]['id'],'destaccountcode':_0x471cbd[_0xb930('0x6b')]},{'showHidden':![],'depth':null}));this[_0xb930('0x1f')](util[_0xb930('0x2a')](_0xb930('0x39'),_0x471cbd[_0xb930('0x25')]),_0xb930('0x6c'),{'id':this[_0xb930('0x28')][_0x471cbd[_0xb930('0x48')]]['id'],'destaccountcode':Number(_0x471cbd[_0xb930('0x6b')])});}}}}}}catch(_0x25e536){logger['error'](_0xb930('0x6d'),_0x471cbd['uniqueid'],util[_0xb930('0x35')](_0x25e536,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')]['syncVarSet']=function(_0xd8bafe){try{if(this[_0xb930('0x21')](_0xd8bafe)){logger[_0xb930('0x27')]('[%s][voiceAgentReport][varset]\x20event:',_0xd8bafe[_0xb930('0x24')],util['inspect'](_0xd8bafe,{'showHidden':![],'depth':null}));this['addVariable'](_0xd8bafe[_0xb930('0x24')],_[_0xb930('0x6e')](_0xd8bafe[_0xb930('0x6f')])[0x0],_0xd8bafe[_0xb930('0x70')]);if(this[_0xb930('0xa')][_0xd8bafe['uniqueid']]){for(var _0x3880ab in this[_0xb930('0xa')][_0xd8bafe[_0xb930('0x24')]]){if(this[_0xb930('0xa')][_0xd8bafe[_0xb930('0x24')]]['hasOwnProperty'](_0x3880ab)){logger['info'](_0xb930('0x71'),_0xd8bafe[_0xb930('0x24')],_0x3880ab,_[_0xb930('0x6e')](_0xd8bafe[_0xb930('0x6f')])[0x0],_0xd8bafe[_0xb930('0x70')]);if(_[_0xb930('0x22')](this['channels'][_0xd8bafe['uniqueid']][_0x3880ab][_0xb930('0xd')])){this[_0xb930('0xa')][_0xd8bafe[_0xb930('0x24')]][_0x3880ab][_0xb930('0xd')]={};}this[_0xb930('0xa')][_0xd8bafe['uniqueid']][_0x3880ab][_0xb930('0xd')]=this[_0xb930('0xd')][_0xd8bafe[_0xb930('0x24')]];}}}}}catch(_0x12287d){logger[_0xb930('0x53')]('[%s][voiceAgentReport][varset]',_0xd8bafe['uniqueid'],util[_0xb930('0x35')](_0x12287d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb930('0x72')]=function(_0x9f3c11,_0x508404,_0x14f0e8){var _0x3d15c0=[_0xb930('0x73'),_0xb930('0x74'),_0xb930('0x75'),'rtpaudioqosjitterbridged',_0xb930('0x76'),_0xb930('0x77'),_0xb930('0x78'),'rtpaudioqosrttbridged',_0xb930('0x79'),_0xb930('0x7a'),_0xb930('0x7b'),_0xb930('0x7c'),'membercalls',_0xb930('0x7d'),_0xb930('0x7e'),_0xb930('0x7f'),_0xb930('0x25'),_0xb930('0x80'),'memberrealtime'];if(!_[_0xb930('0x81')](_0x508404)&&!_[_0xb930('0x82')](_0x3d15c0,_0x508404)){if(_[_0xb930('0x22')](this[_0xb930('0xd')][_0x9f3c11])){this['variables'][_0x9f3c11]={};}this['variables'][_0x9f3c11][_0x508404]=_0x14f0e8;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x1ca804){try{if(this[_0xb930('0x21')](_0x1ca804)){logger[_0xb930('0x27')](_0xb930('0x83'),_0x1ca804[_0xb930('0x24')],util[_0xb930('0x35')](_0x1ca804,{'showHidden':![],'depth':null}));if(this['channels'][_0x1ca804[_0xb930('0x24')]]){for(var _0x4077f8 in this[_0xb930('0xa')][_0x1ca804['uniqueid']]){if(this[_0xb930('0xa')][_0x1ca804[_0xb930('0x24')]]['hasOwnProperty'](_0x4077f8)){if(this[_0xb930('0xa')][_0x1ca804[_0xb930('0x24')]][_0x4077f8][_0xb930('0x51')]==_0xb930('0x62')&&this[_0xb930('0xa')][_0x1ca804[_0xb930('0x24')]][_0x4077f8]['agentcomplete']){logger[_0xb930('0x3d')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x1ca804['uniqueid'],_0x4077f8);this[_0xb930('0xa')][_0x1ca804[_0xb930('0x24')]][_0x4077f8][_0xb930('0x61')]=moment()[_0xb930('0x2a')](_0xb930('0x2b'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x1ca804[_0xb930('0x24')],util['inspect'](_[_0xb930('0x84')](this['channels'][_0x1ca804[_0xb930('0x24')]]),{'showHidden':![],'depth':null}));ami[_0xb930('0x1f')](_0xb930('0x85'),_[_0xb930('0x84')](this[_0xb930('0xa')][_0x1ca804[_0xb930('0x24')]]));delete this[_0xb930('0xa')][_0x1ca804['uniqueid']];}if(this[_0xb930('0xd')][_0x1ca804[_0xb930('0x24')]]){delete this[_0xb930('0xd')][_0x1ca804[_0xb930('0x24')]];}}}catch(_0x31fae0){logger['error'](_0xb930('0x86'),_0x1ca804[_0xb930('0x24')],util['inspect'](_0x31fae0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')]['syncAttendedTransfer']=function(_0x1c9f64){try{if(this[_0xb930('0x21')](_0x1c9f64)){logger[_0xb930('0x27')](_0xb930('0x87'),_0x1c9f64['uniqueid'],util[_0xb930('0x35')](_0x1c9f64,{'showHidden':![],'depth':null}));if(this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]]){for(var _0x384692 in this[_0xb930('0xa')][_0x1c9f64['transfereeuniqueid']]){if(this[_0xb930('0xa')][_0x1c9f64['transfereeuniqueid']][_0xb930('0x3c')](_0x384692)){if(_0x1c9f64[_0xb930('0x89')]===_0x384692){logger['info'](_0xb930('0x8a'),_0x1c9f64['uniqueid'],this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692][_0xb930('0x25')],_0x384692);var _0x2209dc=moment();this['channels'][_0x1c9f64[_0xb930('0x88')]][_0x384692]['agentcomplete']=!![];this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692][_0xb930('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692][_0xb930('0x44')]=_0xb930('0x8b');this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692]['reason']=_0xb930('0x62');this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692][_0xb930('0x64')]=_0x2209dc[_0xb930('0x8c')](this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]][_0x384692][_0xb930('0x8d')],_0xb930('0x8e'));}}}}if(this['channels'][_0x1c9f64['secondtransfereruniqueid']]){var _0x515e4c=this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x8f')]];this[_0xb930('0xa')][_0x1c9f64['secondtransfereruniqueid']]=this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]];this[_0xb930('0xa')][_0x1c9f64[_0xb930('0x88')]]=_0x515e4c;}}}catch(_0x3c7b31){logger['error'](_0xb930('0x90'),_0x1c9f64[_0xb930('0x24')],util['inspect'](_0x3c7b31,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb930('0x1e')]=function(_0x15a459){try{if(this[_0xb930('0x21')](_0x15a459)){logger[_0xb930('0x27')](_0xb930('0x91'),_0x15a459[_0xb930('0x24')],util[_0xb930('0x35')](_0x15a459,{'showHidden':![],'depth':null}));if(this[_0xb930('0xa')][_0x15a459[_0xb930('0x88')]]){for(var _0x451f11 in this['channels'][_0x15a459[_0xb930('0x88')]]){if(this[_0xb930('0xa')][_0x15a459['transfereeuniqueid']]['hasOwnProperty'](_0x451f11)){if(_0x15a459[_0xb930('0x92')]===_0x451f11){logger[_0xb930('0x3d')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x15a459[_0xb930('0x24')],this[_0xb930('0xa')][_0x15a459[_0xb930('0x88')]][_0x451f11][_0xb930('0x25')],_0x451f11);var _0x26e709=moment();this[_0xb930('0xa')][_0x15a459[_0xb930('0x88')]][_0x451f11][_0xb930('0x4d')]=!![];this[_0xb930('0xa')][_0x15a459['transfereeuniqueid']][_0x451f11][_0xb930('0x61')]=_0x26e709;this['channels'][_0x15a459[_0xb930('0x88')]][_0x451f11][_0xb930('0x44')]=_0xb930('0x8b');this[_0xb930('0xa')][_0x15a459[_0xb930('0x88')]][_0x451f11][_0xb930('0x51')]=_0xb930('0x62');this[_0xb930('0xa')][_0x15a459[_0xb930('0x88')]][_0x451f11][_0xb930('0x64')]=_0x26e709[_0xb930('0x8c')](this[_0xb930('0xa')][_0x15a459['transfereeuniqueid']][_0x451f11][_0xb930('0x8d')],_0xb930('0x8e'));}}}}}}catch(_0x4f4dc5){logger[_0xb930('0x53')](_0xb930('0x93'),_0x15a459[_0xb930('0x24')],util[_0xb930('0x35')](_0x4f4dc5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')]['syncMusicOnHoldStart']=function(_0x11497d){var _0x11c4ae='';try{if(this[_0xb930('0x21')](_0x11497d)){logger[_0xb930('0x27')](_0xb930('0x94'),_0x11497d[_0xb930('0x24')],util[_0xb930('0x35')](_0x11497d,{'showHidden':![],'depth':null}));if(_0x11497d[_0xb930('0x95')]){_0x11c4ae=_0x11497d[_0xb930('0x95')][_0xb930('0x96')](0x0,_0x11497d[_0xb930('0x95')][_0xb930('0x97')]('-'));if(this[_0xb930('0x28')][_0x11c4ae]){logger[_0xb930('0x3d')](_0xb930('0x98'),_0x11497d[_0xb930('0x24')],_0x11c4ae);this['agents'][_0x11c4ae][_0xb930('0x99')]=!![];}}}}catch(_0x362d13){logger[_0xb930('0x53')]('[%s][voiceAgentReport][musiconholdstart]',_0x11497d['uniqueid'],util[_0xb930('0x35')](_0x362d13,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb930('0x20')][_0xb930('0x1c')]=function(_0x1d0521){var _0x2f1040='';try{if(this[_0xb930('0x21')](_0x1d0521)){logger[_0xb930('0x27')](_0xb930('0x9a'),_0x1d0521[_0xb930('0x24')],util['inspect'](_0x1d0521,{'showHidden':![],'depth':null}));if(_0x1d0521['channel']){_0x2f1040=_0x1d0521['channel'][_0xb930('0x96')](0x0,_0x1d0521['channel'][_0xb930('0x97')]('-'));if(this['agents'][_0x2f1040]){logger['info'](_0xb930('0x9b'),_0x1d0521[_0xb930('0x24')],_0x2f1040);this['agents'][_0x2f1040][_0xb930('0x99')]=![];}}}}catch(_0x492f2f){logger[_0xb930('0x53')](_0xb930('0x9c'),_0x1d0521['uniqueid'],util[_0xb930('0x35')](_0x492f2f,{'showHidden':![],'depth':null}));}};module[_0xb930('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0x76d2=['syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','isUndefined','destuniqueid','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','holdtime','routealias','merge','pick','interface','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agent','talktime','acw','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x76d2,0x85));var _0x276d=function(_0x1eaa74,_0xcbbafc){_0x1eaa74=_0x1eaa74-0x0;var _0x2fd0e0=_0x76d2[_0x1eaa74];return _0x2fd0e0;};'use strict';var _=require(_0x276d('0x0'));var moment=require(_0x276d('0x1'));var util=require(_0x276d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x276d('0x3'))(_0x276d('0x4'));var ami=require('../ami');config['redis']=_[_0x276d('0x5')](config[_0x276d('0x6')],{'host':_0x276d('0x7'),'port':0x18eb});var io=require(_0x276d('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x27e318){this[_0x276d('0x9')]={};this[_0x276d('0xa')]=_0x27e318['channels'];this[_0x276d('0xb')]=_0x27e318[_0x276d('0xb')];this[_0x276d('0xc')]=_0x27e318[_0x276d('0xc')];this[_0x276d('0xd')]={};ami['on'](_0x276d('0xe'),this['syncAgentCalled'][_0x276d('0xf')](this));ami['on'](_0x276d('0x10'),this[_0x276d('0x11')][_0x276d('0xf')](this));ami['on'](_0x276d('0x12'),this[_0x276d('0x13')]['bind'](this));ami['on'](_0x276d('0x14'),this[_0x276d('0x15')][_0x276d('0xf')](this));ami['on'](_0x276d('0x16'),this[_0x276d('0x17')]['bind'](this));ami['on']('varset',this[_0x276d('0x18')]['bind'](this));ami['on'](_0x276d('0x19'),this['syncHangup'][_0x276d('0xf')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x276d('0xf')](this));ami['on']('musiconholdstop',this[_0x276d('0x1a')]['bind'](this));ami['on'](_0x276d('0x1b'),this[_0x276d('0x1c')][_0x276d('0xf')](this));ami['on'](_0x276d('0x1d'),this['syncBlindTransfer'][_0x276d('0xf')](this));}VoiceAgentReport[_0x276d('0x1e')][_0x276d('0x1f')]=function(_0x29f72b,_0x5af0de,_0x5f3cc9){io['to'](_0x29f72b)[_0x276d('0x1f')](_0x5af0de,_0x5f3cc9);};VoiceAgentReport[_0x276d('0x1e')]['isNotNull']=function(_0x303941){return _0x303941!==null&&!_['isUndefined'](_0x303941);};VoiceAgentReport[_0x276d('0x1e')]['syncAgentCalled']=function(_0x1b298f){try{if(this[_0x276d('0x20')](_0x1b298f)){logger['info'](_0x276d('0x21'),_0x1b298f['uniqueid'],_0x1b298f['membername'],_0x1b298f['destuniqueid']);logger[_0x276d('0x22')](_0x276d('0x23'),_0x1b298f[_0x276d('0x24')],util[_0x276d('0x25')](_0x1b298f,{'showHidden':![],'depth':null}));if(_[_0x276d('0x26')](this['channels'][_0x1b298f[_0x276d('0x24')]])){this[_0x276d('0x9')][_0x1b298f['uniqueid']]={};}var _0x2f29ae=this[_0x276d('0xc')][_0x1b298f['interface']];var _0x585d1e=this[_0x276d('0x9')][_0x1b298f[_0x276d('0x24')]][_0x1b298f[_0x276d('0x27')]];var _0x5096e8=this[_0x276d('0xb')][_0x1b298f[_0x276d('0x28')]];var _0x454855=this[_0x276d('0xd')][_0x1b298f[_0x276d('0x24')]];if(_[_0x276d('0x26')](_0x585d1e)){_0x585d1e={'agentcalledAt':moment()[_0x276d('0x29')](_0x276d('0x2a')),'lastevent':_0x276d('0x2b'),'mandatoryDisposition':_0x5096e8&&_0x5096e8[_0x276d('0x2c')]?_0x5096e8['mandatoryDisposition']:![],'type':_0x5096e8&&_0x5096e8['type']?_0x5096e8[_0x276d('0x2d')]:_0x276d('0x2e'),'variables':_0x454855,'motionChannel':_0x276d('0x2f')};}Object[_0x276d('0x30')](_0x585d1e,_[_0x276d('0x31')](_0x1b298f,[_0x276d('0x32'),_0x276d('0x33')]));this[_0x276d('0x9')][_0x1b298f[_0x276d('0x24')]][_0x1b298f['destuniqueid']]=_0x585d1e;logger[_0x276d('0x22')](_0x276d('0x34'),_0x1b298f[_0x276d('0x24')],util[_0x276d('0x25')](_0x585d1e,{'showHidden':![],'depth':null}));ami[_0x276d('0x1f')](_0x276d('0x35'),_0x585d1e);var _0x2db631={'id':_0x2f29ae['id'],'calleridnum':_0x585d1e[_0x276d('0x36')],'queue':_0x585d1e[_0x276d('0x28')],'variables':_0x585d1e[_0x276d('0xd')],'uniqueid':_0x1b298f[_0x276d('0x24')]};logger[_0x276d('0x22')](_0x276d('0x37'),_0x1b298f[_0x276d('0x24')],util[_0x276d('0x25')](_0x2db631,{'showHidden':![],'depth':null}));this['emit'](util[_0x276d('0x29')](_0x276d('0x38'),_0x1b298f[_0x276d('0x39')]),_0x276d('0x3a'),_0x2db631);}}catch(_0x248c94){logger[_0x276d('0x3b')](_0x276d('0x3c'),_0x1b298f[_0x276d('0x24')],util[_0x276d('0x25')](_0x248c94,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')]['syncAgentConnect']=function(_0x4a44ae){try{if(this[_0x276d('0x20')](_0x4a44ae)){if(this['channels'][_0x4a44ae[_0x276d('0x24')]]){for(var _0x1effd6 in this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]]){if(this['channels'][_0x4a44ae[_0x276d('0x24')]][_0x276d('0x3d')](_0x1effd6)){if(_0x4a44ae['destuniqueid']===_0x1effd6){logger[_0x276d('0x3e')](_0x276d('0x3f'),_0x4a44ae['uniqueid'],_0x4a44ae[_0x276d('0x39')],_0x4a44ae[_0x276d('0x27')]);this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x40')]=moment()[_0x276d('0x29')](_0x276d('0x2a'));this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x41')]=_0x4a44ae[_0x276d('0x41')];this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6][_0x276d('0x42')]=_0x4a44ae[_0x276d('0x42')];this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6][_0x276d('0x43')]=_0x4a44ae[_0x276d('0x43')];this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6]['destchannelstatedesc']=_0x4a44ae['destchannelstatedesc'];this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6][_0x276d('0x44')]=_0x4a44ae['holdtime'];this['channels'][_0x4a44ae['uniqueid']][_0x1effd6]['lastevent']='connect';if(this[_0x276d('0xa')][this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x24')]]){var _0x263a92=this[_0x276d('0xa')][this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x24')]]['routealias'];this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x45')]=_0x263a92;_0x4a44ae['routealias']=_0x263a92;}_[_0x276d('0x46')](this[_0x276d('0xc')][_0x4a44ae['interface']],_[_0x276d('0x47')](_0x4a44ae,['queue','destconnectedlinenum',_0x276d('0x45')]));var _0x34c369=this[_0x276d('0xc')][_0x4a44ae[_0x276d('0x48')]];var _0x44a123={'id':_0x34c369['id'],'name':_0x34c369[_0x276d('0x49')],'agentconnected':!![],'destaccountcode':_0x34c369[_0x276d('0x4a')],'destconnectedlinenum':this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x4a44ae['destuniqueid']][_0x276d('0x4b')],'queue':this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x4a44ae[_0x276d('0x27')]][_0x276d('0x28')],'routealias':this['channels'][_0x4a44ae[_0x276d('0x24')]][_0x4a44ae[_0x276d('0x27')]]['routealias'],'uniqueid':this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x4a44ae[_0x276d('0x27')]][_0x276d('0x24')]};ami['emit'](_0x276d('0x4c'),this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x4a44ae['destuniqueid']]);this[_0x276d('0x1f')](util[_0x276d('0x29')](_0x276d('0x38'),_0x4a44ae[_0x276d('0x39')]),_0x276d('0x4d'),_0x44a123);}else if(!this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x12')]&&!this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6][_0x276d('0x16')]){logger[_0x276d('0x3e')](_0x276d('0x4e'),_0x4a44ae[_0x276d('0x24')],this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x39')],_0x1effd6);this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6][_0x276d('0x12')]=!![];this['channels'][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x4f')]=moment()['format'](_0x276d('0x2a'));this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x50')]=_0x4a44ae[_0x276d('0x27')];this['channels'][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x51')]=_0x4a44ae['membername'];this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x52')]=_0x276d('0x53');this['channels'][_0x4a44ae[_0x276d('0x24')]][_0x1effd6][_0x276d('0x54')]=_0x276d('0x53');logger['debug'](_0x276d('0x55'),_0x4a44ae[_0x276d('0x24')],util['inspect'](this[_0x276d('0x9')][_0x4a44ae[_0x276d('0x24')]][_0x1effd6],{'showHidden':![],'depth':null}));ami[_0x276d('0x1f')](_0x276d('0x56'),this[_0x276d('0x9')][_0x4a44ae['uniqueid']][_0x1effd6]);}else{logger[_0x276d('0x22')](_0x276d('0x57'),_0x4a44ae[_0x276d('0x24')]);}}}}}}catch(_0xea6695){logger[_0x276d('0x3b')](_0x276d('0x58'),_0x4a44ae['uniqueid'],util[_0x276d('0x25')](_0xea6695,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')]['syncAgentRingNoAnswer']=function(_0x4fa340){try{if(this[_0x276d('0x20')](_0x4fa340)){logger[_0x276d('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x4fa340['uniqueid'],util[_0x276d('0x25')](_0x4fa340,{'showHidden':![],'depth':null}));if(this[_0x276d('0x9')][_0x4fa340[_0x276d('0x24')]]&&this[_0x276d('0x9')][_0x4fa340['uniqueid']][_0x4fa340[_0x276d('0x27')]]){logger[_0x276d('0x3e')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x4fa340['uniqueid'],_0x4fa340[_0x276d('0x39')],_0x4fa340[_0x276d('0x27')]);var _0x44252e=this[_0x276d('0xc')][_0x4fa340[_0x276d('0x48')]];var _0x4972c1=this[_0x276d('0x9')][_0x4fa340[_0x276d('0x24')]][_0x4fa340['destuniqueid']];_0x4972c1['agentringnoanswer']=!![];_0x4972c1['agentringnoanswerAt']=moment()[_0x276d('0x29')](_0x276d('0x2a'));_0x4972c1['lastevent']=_0x276d('0x59');_0x4972c1[_0x276d('0x54')]=_0x276d('0x59');var _0x48adad={'id':_0x44252e['id'],'name':_0x44252e[_0x276d('0x49')],'queue':_0x4972c1[_0x276d('0x28')],'uniqueid':_0x4972c1[_0x276d('0x24')]};logger['debug'](_0x276d('0x5a'),_0x4fa340[_0x276d('0x24')],util[_0x276d('0x25')](_0x48adad,{'showHidden':![],'depth':null}));this[_0x276d('0x1f')](util[_0x276d('0x29')](_0x276d('0x38'),_0x44252e[_0x276d('0x49')]),_0x276d('0x5b'),_0x48adad);ami[_0x276d('0x1f')](_0x276d('0x5c'),_0x4972c1);this[_0x276d('0x9')][_0x4fa340[_0x276d('0x24')]][_0x4fa340['destuniqueid']]=Object[_0x276d('0x30')]({},_0x4972c1);}}}catch(_0x356b2d){logger[_0x276d('0x3b')](_0x276d('0x5d'),_0x4fa340[_0x276d('0x24')],util[_0x276d('0x25')](_0x356b2d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')][_0x276d('0x15')]=function(_0x39948f){try{if(this[_0x276d('0x20')](_0x39948f)){logger[_0x276d('0x22')](_0x276d('0x5e'),_0x39948f[_0x276d('0x24')],util[_0x276d('0x25')](_0x39948f,{'showHidden':![],'depth':null}));if(this['channels'][_0x39948f[_0x276d('0x24')]]){for(var _0x23427a in this[_0x276d('0x9')][_0x39948f['uniqueid']]){if(this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x276d('0x3d')](_0x23427a)&&!this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x23427a][_0x276d('0x12')]&&!this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x23427a][_0x276d('0x16')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x39948f[_0x276d('0x24')],this['channels'][_0x39948f['uniqueid']][_0x23427a]['membername'],_0x23427a);this[_0x276d('0x9')][_0x39948f['uniqueid']][_0x23427a][_0x276d('0x12')]=!![];this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x23427a][_0x276d('0x4f')]=moment()[_0x276d('0x29')](_0x276d('0x2a'));this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x23427a][_0x276d('0x52')]=_0x276d('0x5f');this[_0x276d('0x9')][_0x39948f[_0x276d('0x24')]][_0x23427a]['reason']=_0x276d('0x5f');logger[_0x276d('0x22')](_0x276d('0x60'),_0x39948f['uniqueid'],util[_0x276d('0x25')](this['channels'][_0x39948f[_0x276d('0x24')]][_0x23427a],{'showHidden':![],'depth':null}));ami[_0x276d('0x1f')]('custom:agentqueuecallerabandon',this['channels'][_0x39948f[_0x276d('0x24')]][_0x23427a]);}}}}}catch(_0x230326){logger[_0x276d('0x3b')]('[%s][voiceAgentReport][queuecallerabandon]',_0x39948f[_0x276d('0x24')],util[_0x276d('0x25')](_0x230326,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')][_0x276d('0x17')]=function(_0x4d7a24){try{if(this['isNotNull'](_0x4d7a24)){logger[_0x276d('0x22')](_0x276d('0x61'),_0x4d7a24[_0x276d('0x24')],util['inspect'](_0x4d7a24,{'showHidden':![],'depth':null}));if(this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]]){for(var _0x4e25e3 in this[_0x276d('0x9')][_0x4d7a24['uniqueid']]){if(this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]]['hasOwnProperty'](_0x4e25e3)){if(this['channels'][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3]['agentconnectAt']&&!this['channels'][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3][_0x276d('0x16')]){logger[_0x276d('0x3e')](_0x276d('0x62'),_0x4d7a24[_0x276d('0x24')],this['channels'][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3][_0x276d('0x39')],_0x4e25e3);this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3]['agentcomplete']=!![];this['channels'][_0x4d7a24['uniqueid']][_0x4e25e3][_0x276d('0x63')]=moment()[_0x276d('0x29')](_0x276d('0x2a'));this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3][_0x276d('0x52')]='complete';this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3][_0x276d('0x54')]=_0x4d7a24[_0x276d('0x54')]=='transfer'?_0x276d('0x64'):_0x4d7a24[_0x276d('0x54')];this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3][_0x276d('0x65')]=_0x4d7a24[_0x276d('0x65')];if(this[_0x276d('0xb')][_0x4d7a24[_0x276d('0x28')]]&&this[_0x276d('0xb')][_0x4d7a24[_0x276d('0x28')]][_0x276d('0x66')]){this[_0x276d('0x9')][_0x4d7a24['uniqueid']][_0x4e25e3]['acwtime']=this[_0x276d('0xb')][_0x4d7a24[_0x276d('0x28')]][_0x276d('0x67')];this[_0x276d('0x9')][_0x4d7a24['uniqueid']][_0x4e25e3][_0x276d('0x68')]=!![];}this['agents'][_0x4d7a24[_0x276d('0x48')]]=_[_0x276d('0x31')](this[_0x276d('0xc')][_0x4d7a24['interface']],[_0x276d('0x28'),_0x276d('0x69')]);logger[_0x276d('0x22')](_0x276d('0x6a'),_0x4d7a24[_0x276d('0x24')],util[_0x276d('0x25')](this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3],{'showHidden':![],'depth':null}));ami[_0x276d('0x1f')]('custom:agentcomplete',this[_0x276d('0x9')][_0x4d7a24[_0x276d('0x24')]][_0x4e25e3]);logger['debug'](_0x276d('0x6b'),_0x4d7a24[_0x276d('0x24')],util[_0x276d('0x25')]({'id':this['agents'][_0x4d7a24[_0x276d('0x48')]]['id'],'destaccountcode':_0x4d7a24[_0x276d('0x6c')]},{'showHidden':![],'depth':null}));this[_0x276d('0x1f')](util[_0x276d('0x29')](_0x276d('0x38'),_0x4d7a24[_0x276d('0x39')]),'user:agentcomplete',{'id':this[_0x276d('0xc')][_0x4d7a24['interface']]['id'],'destaccountcode':Number(_0x4d7a24[_0x276d('0x6c')])});}}}}}}catch(_0x189333){logger[_0x276d('0x3b')](_0x276d('0x6d'),_0x4d7a24['uniqueid'],util[_0x276d('0x25')](_0x189333,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x276d('0x18')]=function(_0x3d3c8b){try{if(this[_0x276d('0x20')](_0x3d3c8b)){logger[_0x276d('0x22')](_0x276d('0x6e'),_0x3d3c8b['uniqueid'],util[_0x276d('0x25')](_0x3d3c8b,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d3c8b['uniqueid'],_[_0x276d('0x6f')](_0x3d3c8b[_0x276d('0x70')])[0x0],_0x3d3c8b[_0x276d('0x71')]);if(this[_0x276d('0x9')][_0x3d3c8b['uniqueid']]){for(var _0x3e82d9 in this[_0x276d('0x9')][_0x3d3c8b['uniqueid']]){if(this[_0x276d('0x9')][_0x3d3c8b[_0x276d('0x24')]][_0x276d('0x3d')](_0x3e82d9)){logger[_0x276d('0x3e')](_0x276d('0x72'),_0x3d3c8b[_0x276d('0x24')],_0x3e82d9,_['keys'](_0x3d3c8b[_0x276d('0x70')])[0x0],_0x3d3c8b[_0x276d('0x71')]);if(_['isUndefined'](this[_0x276d('0x9')][_0x3d3c8b[_0x276d('0x24')]][_0x3e82d9][_0x276d('0xd')])){this[_0x276d('0x9')][_0x3d3c8b[_0x276d('0x24')]][_0x3e82d9][_0x276d('0xd')]={};}this['channels'][_0x3d3c8b[_0x276d('0x24')]][_0x3e82d9][_0x276d('0xd')]=this[_0x276d('0xd')][_0x3d3c8b[_0x276d('0x24')]];}}}}}catch(_0x186768){logger['error']('[%s][voiceAgentReport][varset]',_0x3d3c8b[_0x276d('0x24')],util[_0x276d('0x25')](_0x186768,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0xcd99f6,_0x4d0532,_0xee21f3){var _0x448256=[_0x276d('0x73'),_0x276d('0x74'),_0x276d('0x75'),_0x276d('0x76'),'rtpaudioqosloss',_0x276d('0x77'),'rtpaudioqosrtt',_0x276d('0x78'),_0x276d('0x79'),'sipuri',_0x276d('0x7a'),_0x276d('0x7b'),'membercalls',_0x276d('0x7c'),_0x276d('0x7d'),_0x276d('0x7e'),_0x276d('0x39'),_0x276d('0x7f'),'memberrealtime'];if(!_['isNil'](_0x4d0532)&&!_[_0x276d('0x80')](_0x448256,_0x4d0532)){if(_[_0x276d('0x26')](this['variables'][_0xcd99f6])){this[_0x276d('0xd')][_0xcd99f6]={};}this[_0x276d('0xd')][_0xcd99f6][_0x4d0532]=_0xee21f3;}};VoiceAgentReport[_0x276d('0x1e')][_0x276d('0x81')]=function(_0x369b7c){try{if(this[_0x276d('0x20')](_0x369b7c)){logger[_0x276d('0x22')]('[%s][voiceAgentReport][hangup]\x20event:',_0x369b7c[_0x276d('0x24')],util[_0x276d('0x25')](_0x369b7c,{'showHidden':![],'depth':null}));if(this[_0x276d('0x9')][_0x369b7c['uniqueid']]){for(var _0x2f049c in this[_0x276d('0x9')][_0x369b7c['uniqueid']]){if(this[_0x276d('0x9')][_0x369b7c[_0x276d('0x24')]][_0x276d('0x3d')](_0x2f049c)){if(this['channels'][_0x369b7c['uniqueid']][_0x2f049c]['reason']=='transfer'&&this[_0x276d('0x9')][_0x369b7c[_0x276d('0x24')]][_0x2f049c][_0x276d('0x16')]){logger[_0x276d('0x3e')](_0x276d('0x82'),_0x369b7c[_0x276d('0x24')],_0x2f049c);this[_0x276d('0x9')][_0x369b7c['uniqueid']][_0x2f049c][_0x276d('0x63')]=moment()['format'](_0x276d('0x2a'));}}}logger[_0x276d('0x22')](_0x276d('0x83'),_0x369b7c[_0x276d('0x24')],util[_0x276d('0x25')](_[_0x276d('0x84')](this[_0x276d('0x9')][_0x369b7c['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x276d('0x1f')](_0x276d('0x85'),_['values'](this[_0x276d('0x9')][_0x369b7c['uniqueid']]));delete this['channels'][_0x369b7c[_0x276d('0x24')]];}if(this[_0x276d('0xd')][_0x369b7c[_0x276d('0x24')]]){delete this[_0x276d('0xd')][_0x369b7c[_0x276d('0x24')]];}}}catch(_0x38e0e0){logger[_0x276d('0x3b')](_0x276d('0x86'),_0x369b7c[_0x276d('0x24')],util[_0x276d('0x25')](_0x38e0e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')][_0x276d('0x1c')]=function(_0x3d19c3){try{if(this[_0x276d('0x20')](_0x3d19c3)){logger[_0x276d('0x22')](_0x276d('0x87'),_0x3d19c3[_0x276d('0x24')],util[_0x276d('0x25')](_0x3d19c3,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d19c3[_0x276d('0x88')]]){for(var _0x12e70c in this['channels'][_0x3d19c3[_0x276d('0x88')]]){if(this[_0x276d('0x9')][_0x3d19c3[_0x276d('0x88')]]['hasOwnProperty'](_0x12e70c)){if(_0x3d19c3[_0x276d('0x89')]===_0x12e70c){logger[_0x276d('0x3e')](_0x276d('0x8a'),_0x3d19c3['uniqueid'],this['channels'][_0x3d19c3[_0x276d('0x88')]][_0x12e70c][_0x276d('0x39')],_0x12e70c);var _0x4d0178=moment();this['channels'][_0x3d19c3[_0x276d('0x88')]][_0x12e70c][_0x276d('0x16')]=!![];this['channels'][_0x3d19c3[_0x276d('0x88')]][_0x12e70c]['agentcompleteAt']=moment()[_0x276d('0x29')](_0x276d('0x2a'));this[_0x276d('0x9')][_0x3d19c3['transfereeuniqueid']][_0x12e70c][_0x276d('0x52')]='complete';this[_0x276d('0x9')][_0x3d19c3[_0x276d('0x88')]][_0x12e70c][_0x276d('0x54')]=_0x276d('0x8b');this[_0x276d('0x9')][_0x3d19c3[_0x276d('0x88')]][_0x12e70c][_0x276d('0x65')]=_0x4d0178[_0x276d('0x8c')](this[_0x276d('0x9')][_0x3d19c3[_0x276d('0x88')]][_0x12e70c][_0x276d('0x40')],_0x276d('0x8d'));}}}}if(this[_0x276d('0x9')][_0x3d19c3[_0x276d('0x8e')]]){var _0x258b37=this[_0x276d('0x9')][_0x3d19c3['secondtransfereruniqueid']];this[_0x276d('0x9')][_0x3d19c3['secondtransfereruniqueid']]=this[_0x276d('0x9')][_0x3d19c3['transfereeuniqueid']];this['channels'][_0x3d19c3[_0x276d('0x88')]]=_0x258b37;}}}catch(_0xd439e0){logger[_0x276d('0x3b')](_0x276d('0x8f'),_0x3d19c3[_0x276d('0x24')],util[_0x276d('0x25')](_0xd439e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x276d('0x1e')]['syncBlindTransfer']=function(_0x573b5d){try{if(this[_0x276d('0x20')](_0x573b5d)){logger[_0x276d('0x22')](_0x276d('0x90'),_0x573b5d[_0x276d('0x24')],util[_0x276d('0x25')](_0x573b5d,{'showHidden':![],'depth':null}));if(this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]]){for(var _0x1c28ef in this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]]){if(this['channels'][_0x573b5d[_0x276d('0x88')]][_0x276d('0x3d')](_0x1c28ef)){if(_0x573b5d[_0x276d('0x91')]===_0x1c28ef){logger['info'](_0x276d('0x92'),_0x573b5d['uniqueid'],this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]][_0x1c28ef][_0x276d('0x39')],_0x1c28ef);var _0x3acceb=moment();this[_0x276d('0x9')][_0x573b5d['transfereeuniqueid']][_0x1c28ef][_0x276d('0x16')]=!![];this['channels'][_0x573b5d['transfereeuniqueid']][_0x1c28ef][_0x276d('0x63')]=_0x3acceb;this[_0x276d('0x9')][_0x573b5d['transfereeuniqueid']][_0x1c28ef][_0x276d('0x52')]=_0x276d('0x93');this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]][_0x1c28ef]['reason']='transfer';this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]][_0x1c28ef][_0x276d('0x65')]=_0x3acceb[_0x276d('0x8c')](this[_0x276d('0x9')][_0x573b5d[_0x276d('0x88')]][_0x1c28ef][_0x276d('0x40')],_0x276d('0x8d'));}}}}}}catch(_0x3fe623){logger[_0x276d('0x3b')](_0x276d('0x94'),_0x573b5d[_0x276d('0x24')],util[_0x276d('0x25')](_0x3fe623,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x276d('0x95')]=function(_0x570fb0){var _0x402fdb='';try{if(this[_0x276d('0x20')](_0x570fb0)){logger['debug'](_0x276d('0x96'),_0x570fb0[_0x276d('0x24')],util[_0x276d('0x25')](_0x570fb0,{'showHidden':![],'depth':null}));if(_0x570fb0[_0x276d('0x97')]){_0x402fdb=_0x570fb0['channel'][_0x276d('0x98')](0x0,_0x570fb0[_0x276d('0x97')][_0x276d('0x99')]('-'));if(this['agents'][_0x402fdb]){logger[_0x276d('0x3e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x570fb0[_0x276d('0x24')],_0x402fdb);this[_0x276d('0xc')][_0x402fdb][_0x276d('0x9a')]=!![];}}}}catch(_0x584738){logger[_0x276d('0x3b')](_0x276d('0x9b'),_0x570fb0[_0x276d('0x24')],util[_0x276d('0x25')](_0x584738,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x276d('0x1a')]=function(_0x1b004d){var _0xfdd097='';try{if(this[_0x276d('0x20')](_0x1b004d)){logger[_0x276d('0x22')](_0x276d('0x9c'),_0x1b004d['uniqueid'],util[_0x276d('0x25')](_0x1b004d,{'showHidden':![],'depth':null}));if(_0x1b004d[_0x276d('0x97')]){_0xfdd097=_0x1b004d['channel']['substring'](0x0,_0x1b004d['channel'][_0x276d('0x99')]('-'));if(this[_0x276d('0xc')][_0xfdd097]){logger[_0x276d('0x3e')](_0x276d('0x9d'),_0x1b004d[_0x276d('0x24')],_0xfdd097);this[_0x276d('0xc')][_0xfdd097][_0x276d('0x9a')]=![];}}}}catch(_0x291dfc){logger[_0x276d('0x3b')]('[%s][voiceAgentReport][musiconholdstop]',_0x1b004d[_0x276d('0x24')],util['inspect'](_0x291dfc,{'showHidden':![],'depth':null}));}};module[_0x276d('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 7704215..17856c3 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa53=['[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','replace','.wav49','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','endtime','billableseconds','user:agentcomplete','length','transferType','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','catch','StopMixMonitor','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','disposition','toNumber','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','debug','OutgoingSpoolFailed','application','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','toLowerCase','cdr(','match','type','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','destinationchannel','UserId','membername','connectedlinename','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:'];(function(_0x23d42c,_0x274123){var _0x4054d9=function(_0x25ac18){while(--_0x25ac18){_0x23d42c['push'](_0x23d42c['shift']());}};_0x4054d9(++_0x274123);}(_0xfa53,0x122));var _0x3fa5=function(_0x22f46c,_0x54763d){_0x22f46c=_0x22f46c-0x0;var _0x45ab04=_0xfa53[_0x22f46c];return _0x45ab04;};'use strict';var _=require(_0x3fa5('0x0'));var moment=require(_0x3fa5('0x1'));var util=require(_0x3fa5('0x2'));var path=require(_0x3fa5('0x3'));var Redis=require(_0x3fa5('0x4'));var config=require(_0x3fa5('0x5'));var logger=require(_0x3fa5('0x6'))(_0x3fa5('0x7'));var ami=require(_0x3fa5('0x8'));var Channel=require(_0x3fa5('0x9'));var RpcSetting=require(_0x3fa5('0xa'));var applications=[_0x3fa5('0xb'),_0x3fa5('0xc'),_0x3fa5('0xd'),_0x3fa5('0xe'),_0x3fa5('0xf'),_0x3fa5('0x10')];var dispositions=[_0x3fa5('0x11'),_0x3fa5('0x12'),'FAILED',_0x3fa5('0x11'),_0x3fa5('0x11'),_0x3fa5('0x11'),'ANSWERED','BUSY',_0x3fa5('0x12'),'FAILED',_0x3fa5('0x12')];config['redis']=_[_0x3fa5('0x13')](config['redis'],{'host':_0x3fa5('0x14'),'port':0x18eb});var io=require(_0x3fa5('0x15'))(new Redis(config['redis']));function VoiceCallReport(_0x55f082){this['channels']=_0x55f082[_0x3fa5('0x16')];this[_0x3fa5('0x17')]=_0x55f082['agents'];this[_0x3fa5('0x18')]={};ami['on'](_0x3fa5('0x19'),this[_0x3fa5('0x1a')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x1c'),this['syncNewExten'][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x1d'),this[_0x3fa5('0x1e')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x1f'),this[_0x3fa5('0x20')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x21'),this[_0x3fa5('0x22')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x23'),this[_0x3fa5('0x24')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x25'),this['syncNewCallerId'][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x26'),this[_0x3fa5('0x27')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x28'),this['syncBlindTransfer'][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x29'),this[_0x3fa5('0x2a')][_0x3fa5('0x1b')](this));ami['on'](_0x3fa5('0x2b'),this[_0x3fa5('0x2c')][_0x3fa5('0x1b')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x549d5a){logger[_0x3fa5('0x2d')](_0x3fa5('0x2e'),util[_0x3fa5('0x2f')](_0x549d5a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x31')]=function(_0x3f2749){return _0x3f2749!==null&&!_['isUndefined'](_0x3f2749);};VoiceCallReport['prototype'][_0x3fa5('0x32')]=function(_0x5db895,_0xcc5820,_0x1bf763){io['to'](_0x5db895)[_0x3fa5('0x32')](_0xcc5820,_0x1bf763);};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x33')]=function(_0x5d185c){try{if(this['isNotNull'](_0x5d185c)){logger[_0x3fa5('0x34')](_0x3fa5('0x35'),_0x5d185c[_0x3fa5('0x36')],_0x5d185c[_0x3fa5('0x37')],_0x5d185c[_0x3fa5('0x38')]);logger['debug'](_0x3fa5('0x39'),_0x5d185c[_0x3fa5('0x36')],util['inspect'](_0x5d185c,{'showHidden':![],'depth':null}));if(_0x5d185c[_0x3fa5('0x36')]===_0x5d185c[_0x3fa5('0x3a')]){if(!_[_0x3fa5('0x3b')](this[_0x3fa5('0x16')][_0x5d185c[_0x3fa5('0x36')]])){_[_0x3fa5('0x3c')](this[_0x3fa5('0x16')][_0x5d185c[_0x3fa5('0x36')]],_[_0x3fa5('0x3d')](_0x5d185c,_[_0x3fa5('0x3e')](this[_0x3fa5('0x16')][_0x5d185c[_0x3fa5('0x36')]])));}}if(_0x5d185c[_0x3fa5('0x3f')]===_0x3fa5('0x40')){var _0x286123=this[_0x3fa5('0x17')][_0x5d185c[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]];if(_0x286123){if(_0x5d185c[_0x3fa5('0x43')]==_0x3fa5('0x44')){_0x286123[_0x3fa5('0x45')]=_0x5d185c[_0x3fa5('0x46')];this[_0x3fa5('0x32')](util[_0x3fa5('0x47')](_0x3fa5('0x48'),_0x286123[_0x3fa5('0x49')]),_0x3fa5('0x4a'),{'id':_0x286123['id'],'destaccountcode':_0x286123['accountcode'],'destconnectedlinenum':_0x5d185c[_0x3fa5('0x46')]});}}}}}catch(_0x5a4dff){logger[_0x3fa5('0x2d')](_0x3fa5('0x4b'),_0x5d185c[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x5a4dff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x1e')]=function(_0x4005ad){try{if(this[_0x3fa5('0x31')](_0x4005ad)){logger['debug'](_0x3fa5('0x4c'),_0x4005ad[_0x3fa5('0x36')],util['inspect'](_0x4005ad,{'showHidden':![],'depth':null}));if(this['channels'][_0x4005ad['uniqueid']]){return;}if(_0x4005ad[_0x3fa5('0x41')]==='OutgoingSpoolFailed'){return;}if(_0x4005ad[_0x3fa5('0x36')]!==_0x4005ad[_0x3fa5('0x3a')]&&!this[_0x3fa5('0x18')][_0x4005ad[_0x3fa5('0x3a')]]){return;}logger[_0x3fa5('0x34')](_0x3fa5('0x4d'),_0x4005ad['uniqueid'],_0x4005ad[_0x3fa5('0x3f')],_0x4005ad[_0x3fa5('0x43')]);this[_0x3fa5('0x16')][_0x4005ad[_0x3fa5('0x36')]]=new Channel();this[_0x3fa5('0x16')][_0x4005ad[_0x3fa5('0x36')]]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fa5('0x16')][_0x4005ad[_0x3fa5('0x36')]][_0x3fa5('0x4e')]=dispositions[_[_0x3fa5('0x4f')](_0x4005ad['channelstate'])];_[_0x3fa5('0x3c')](this['channels'][_0x4005ad[_0x3fa5('0x36')]],_['pick'](_0x4005ad,_['keys'](this[_0x3fa5('0x16')][_0x4005ad[_0x3fa5('0x36')]])));if(_0x4005ad[_0x3fa5('0x3f')]===_0x3fa5('0x40')){var _0x67f3f0=this[_0x3fa5('0x17')][_0x4005ad[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]];if(_0x67f3f0&&typeof _0x67f3f0[_0x3fa5('0x45')]===_0x3fa5('0x50')){_0x67f3f0['destconnectedlinenum']=_0x4005ad['exten'];logger['debug'](_0x3fa5('0x51'),_0x4005ad[_0x3fa5('0x36')],util['inspect']({'id':_0x67f3f0['id'],'destaccountcode':_0x67f3f0[_0x3fa5('0x52')],'destconnectedlinenum':_0x4005ad[_0x3fa5('0x43')]},{'showHidden':![],'depth':null}));this[_0x3fa5('0x32')](util[_0x3fa5('0x47')](_0x3fa5('0x48'),_0x67f3f0['name']),_0x3fa5('0x4a'),{'id':_0x67f3f0['id'],'destaccountcode':_0x67f3f0[_0x3fa5('0x52')],'destconnectedlinenum':_0x4005ad[_0x3fa5('0x43')]});}}}}catch(_0x3325ad){logger[_0x3fa5('0x2d')]('[%s][voiceCallReport][newchannel]',_0x4005ad[_0x3fa5('0x36')],util['inspect'](_0x3325ad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x1a')]=function(_0x475b16){try{if(this[_0x3fa5('0x31')](_0x475b16)){logger[_0x3fa5('0x53')]('[%s][voiceCallReport][newexten]\x20event:',_0x475b16[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x475b16,{'showHidden':![],'depth':null}));if(_0x475b16[_0x3fa5('0x41')]===_0x3fa5('0x54')||_0x475b16['exten']==='h')return;if(_0x475b16[_0x3fa5('0x36')]===_0x475b16['linkedid']||this[_0x3fa5('0x18')][_0x475b16[_0x3fa5('0x3a')]]){_0x475b16[_0x3fa5('0x55')]=_0x475b16[_0x3fa5('0x55')]?_0x475b16[_0x3fa5('0x55')]['toLowerCase']():undefined;_0x475b16[_0x3fa5('0x56')]=_0x475b16[_0x3fa5('0x57')]||_0x475b16['applicationdata'];if(_0x475b16[_0x3fa5('0x57')]&&!_0x475b16['appdata']['startsWith']('CDR(routeAlias)')&&_0x475b16['application']!==_0x3fa5('0xc')){_0x475b16[_0x3fa5('0x56')]=_0x475b16[_0x3fa5('0x56')]['toLowerCase']();}logger[_0x3fa5('0x34')](_0x3fa5('0x58'),_0x475b16[_0x3fa5('0x36')],_0x475b16['application'],_0x475b16[_0x3fa5('0x56')]);if(_[_0x3fa5('0x3b')](this[_0x3fa5('0x16')][_0x475b16['uniqueid']])){this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]]=new Channel();this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]][_0x3fa5('0x59')]=_0x475b16[_0x3fa5('0x5a')]?moment()[_0x3fa5('0x5b')](moment[_0x3fa5('0x5a')](_0x475b16[_0x3fa5('0x5a')])[_0x3fa5('0x5c')](),_0x3fa5('0x5c'))['format'](_0x3fa5('0x5d')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]][_0x3fa5('0x4e')]=_0x3fa5('0x11');}_[_0x3fa5('0x3c')](this['channels'][_0x475b16[_0x3fa5('0x36')]],_[_0x3fa5('0x3d')](_0x475b16,_['keys'](this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]])));if(_[_0x3fa5('0x5e')](applications,_0x475b16[_0x3fa5('0x55')])){this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]][_0x3fa5('0x5f')]=_0x475b16['application'];this[_0x3fa5('0x16')][_0x475b16['uniqueid']][_0x3fa5('0x60')]=_0x475b16[_0x3fa5('0x56')];if(_0x475b16[_0x3fa5('0x55')]===_0x3fa5('0xb')&&_[_0x3fa5('0x61')](_0x475b16[_0x3fa5('0x56')][_0x3fa5('0x62')](),_0x3fa5('0x63'))){var _0x2a1b64=_0x475b16[_0x3fa5('0x56')][_0x3fa5('0x42')]('=');var _0x54e742=_0x2a1b64[0x0][_0x3fa5('0x62')]()[_0x3fa5('0x64')](/cdr\((.*)\)/);if(_0x54e742){if(_0x54e742[0x1]===_0x3fa5('0x65')&&!_[_0x3fa5('0x66')](this[_0x3fa5('0x16')][_0x475b16['uniqueid']][_0x54e742[0x1]]))return;this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]][_0x54e742[0x1]]=_0x2a1b64[0x1];}}else if(_0x475b16['application']===_0x3fa5('0xc')){this[_0x3fa5('0x16')][_0x475b16[_0x3fa5('0x36')]][_0x3fa5('0xc')]=_0x475b16[_0x3fa5('0x56')][_0x3fa5('0x42')](',')[0x0];}}}}}catch(_0x3c0262){logger[_0x3fa5('0x2d')]('[%s][voiceCallReport][newexten]',_0x475b16[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x3c0262,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x20')]=function(_0x1a9ad7){try{if(this[_0x3fa5('0x31')](_0x1a9ad7)){logger['info'](_0x3fa5('0x67'),_0x1a9ad7['uniqueid'],_0x1a9ad7[_0x3fa5('0x3a')],_0x1a9ad7[_0x3fa5('0x37')],_0x1a9ad7[_0x3fa5('0x38')]);logger[_0x3fa5('0x53')](_0x3fa5('0x68'),_0x1a9ad7['uniqueid'],util[_0x3fa5('0x2f')](_0x1a9ad7,{'showHidden':![],'depth':null}));if(_0x1a9ad7[_0x3fa5('0x69')]!=='6')return;var _0x862447=this[_0x3fa5('0x17')][_0x1a9ad7['channel'][_0x3fa5('0x42')]('-')[0x0]];if(_0x1a9ad7[_0x3fa5('0x36')]!==_0x1a9ad7[_0x3fa5('0x3a')]){var _0x45f917=moment();if(this['channels'][_0x1a9ad7[_0x3fa5('0x3a')]]){if(!this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x6a')]){this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x6a')]=!![];this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x6b')]=_0x45f917[_0x3fa5('0x47')](_0x3fa5('0x5d'));if(this[_0x3fa5('0x16')][_0x1a9ad7['linkedid']][_0x3fa5('0x59')]){this['channels'][_0x1a9ad7['linkedid']][_0x3fa5('0x6c')]=_0x45f917[_0x3fa5('0x6d')](this['channels'][_0x1a9ad7[_0x3fa5('0x3a')]]['starttime'],_0x3fa5('0x5c'));}}this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x3a')]=_0x1a9ad7[_0x3fa5('0x36')];if(_0x1a9ad7[_0x3fa5('0x38')]!==_0x3fa5('0x44')){this['channels'][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x46')]=_0x1a9ad7[_0x3fa5('0x38')];}this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]]['connectedlinename']=_0x1a9ad7[_0x3fa5('0x37')];this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x6e')]=_0x1a9ad7[_0x3fa5('0x41')];this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x4e')]=dispositions[_[_0x3fa5('0x4f')](_0x1a9ad7['channelstate'])];if(_0x862447){this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x6f')]=_0x862447['id'];this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x70')]=_0x862447['name'];}}if(this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]]){if(!this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]]['answered']){this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x6a')]=!![];this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x6b')]=_0x45f917[_0x3fa5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]]['starttime']){this['channels'][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x6c')]=_0x45f917[_0x3fa5('0x6d')](this['channels'][_0x1a9ad7['uniqueid']][_0x3fa5('0x59')],_0x3fa5('0x5c'));}}if(_0x1a9ad7['calleridnum']!==_0x3fa5('0x44')){this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x46')]=_0x1a9ad7[_0x3fa5('0x38')];}this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x71')]=_0x1a9ad7[_0x3fa5('0x37')];this['channels'][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x6e')]=_0x1a9ad7[_0x3fa5('0x41')];this['channels'][_0x1a9ad7[_0x3fa5('0x36')]]['disposition']=dispositions[_[_0x3fa5('0x4f')](_0x1a9ad7['channelstate'])];}}else{if(this[_0x3fa5('0x16')][_0x1a9ad7['uniqueid']]){if(_0x862447){this['channels'][_0x1a9ad7[_0x3fa5('0x36')]]['UserId']=_0x862447['id'];this[_0x3fa5('0x16')][_0x1a9ad7['uniqueid']]['membername']=_0x862447[_0x3fa5('0x49')];}}}if(_0x1a9ad7[_0x3fa5('0x3f')]===_0x3fa5('0x40')){if(_0x862447){_0x862447[_0x3fa5('0x45')]=_0x1a9ad7[_0x3fa5('0x43')];var _0x4ae550,_0x377737;if(this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]]){_0x4ae550=this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0x72')];_0x377737=this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x36')]][_0x3fa5('0xc')];}else if(this['channels'][_0x1a9ad7[_0x3fa5('0x3a')]]){_0x4ae550=this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0x72')];_0x377737=this[_0x3fa5('0x16')][_0x1a9ad7[_0x3fa5('0x3a')]][_0x3fa5('0xc')];}_0x862447[_0x3fa5('0xc')]=_0x377737;_0x862447[_0x3fa5('0x72')]=_0x4ae550;var _0x3fd970={'id':_0x862447['id'],'name':_0x862447[_0x3fa5('0x49')],'agentconnected':!![],'destaccountcode':_0x862447['accountcode'],'destconnectedlinenum':_0x1a9ad7[_0x3fa5('0x43')],'queue':_0x377737||undefined,'routealias':_0x4ae550,'uniqueid':_0x1a9ad7[_0x3fa5('0x3a')]};logger['debug'](_0x3fa5('0x73'),_0x1a9ad7[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x3fd970,{'showHidden':![],'depth':null}));this[_0x3fa5('0x32')](util[_0x3fa5('0x47')]('user:%s',_0x862447['name']),_0x3fa5('0x4a'),_0x3fd970);}}}}catch(_0x14f3ab){logger['error'](_0x3fa5('0x74'),_0x1a9ad7[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x14f3ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x75')]=function(_0x17d6f3,_0x775070){try{if(this['channels'][_0x17d6f3]){logger[_0x3fa5('0x34')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x17d6f3,_0x775070);this[_0x3fa5('0x16')][_0x17d6f3][_0x3fa5('0x76')]=!![];if(_['endsWith'](_0x775070,'.wav49')){_0x775070=_0x775070[_0x3fa5('0x77')](_0x3fa5('0x78'),_0x3fa5('0x79'));}this[_0x3fa5('0x16')][_0x17d6f3]['monitorFilename']=_0x775070;var _0x51771a=_[_0x3fa5('0x7a')](this[_0x3fa5('0x16')][_0x17d6f3][_0x3fa5('0x7b')],{'filename':_0x775070});if(_[_0x3fa5('0x66')](_0x51771a)){this[_0x3fa5('0x16')][_0x17d6f3][_0x3fa5('0x7b')][_0x3fa5('0x7c')]({'filename':_0x775070,'createdAt':moment()[_0x3fa5('0x47')](_0x3fa5('0x5d')),'mixmonitorid':'','status':_0x3fa5('0x7d')});}}}catch(_0x42c488){logger[_0x3fa5('0x2d')](_0x3fa5('0x7e'),_0x17d6f3,util[_0x3fa5('0x2f')](_0x42c488,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x22')]=function(_0x29ff81){try{if(this[_0x3fa5('0x31')](_0x29ff81)){logger[_0x3fa5('0x53')](_0x3fa5('0x7f'),_0x29ff81[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x29ff81,{'showHidden':![],'depth':null}));if(this[_0x3fa5('0x16')][_0x29ff81['uniqueid']]&&_0x29ff81['channel']!=_0x3fa5('0x54')){if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')])){if(this[_0x3fa5('0x31')](_0x29ff81['variable'][_0x3fa5('0x81')])){logger[_0x3fa5('0x34')](_0x3fa5('0x82'),_0x29ff81[_0x3fa5('0x36')],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x75')](_0x29ff81[_0x3fa5('0x36')],_0x29ff81[_0x3fa5('0x83')]);}else if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x84')])){logger[_0x3fa5('0x34')](_0x3fa5('0x85'),_0x29ff81['uniqueid'],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81['uniqueid']][_0x3fa5('0x38')]=_0x29ff81[_0x3fa5('0x83')];}else if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x86')])){logger[_0x3fa5('0x34')](_0x3fa5('0x87'),_0x29ff81['uniqueid'],_0x29ff81[_0x3fa5('0x83')]);this['channels'][_0x29ff81[_0x3fa5('0x36')]][_0x3fa5('0x88')]=_0x29ff81[_0x3fa5('0x83')];}else if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x89')])){logger[_0x3fa5('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x29ff81[_0x3fa5('0x36')],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x36')]][_0x3fa5('0x65')]=_0x29ff81[_0x3fa5('0x83')];}else if(this[_0x3fa5('0x31')](_0x29ff81['variable'][_0x3fa5('0x8a')])){logger[_0x3fa5('0x34')](_0x3fa5('0x8b'),_0x29ff81[_0x3fa5('0x36')],_0x29ff81['value'][_0x3fa5('0x42')](',')[0x0]);this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x36')]][_0x3fa5('0xc')]=_0x29ff81['value'][_0x3fa5('0x42')](',')[0x0];}else if(this[_0x3fa5('0x31')](_0x29ff81['variable'][_0x3fa5('0x8c')])){logger['info'](_0x3fa5('0x8d'),_0x29ff81[_0x3fa5('0x36')],_0x29ff81[_0x3fa5('0x83')]);this['channels'][_0x29ff81[_0x3fa5('0x36')]]['originatecalleridnum']=_0x29ff81['value'];}else if(this[_0x3fa5('0x31')](_0x29ff81['variable'][_0x3fa5('0x8e')])){logger[_0x3fa5('0x34')](_0x3fa5('0x8f'),_0x29ff81['uniqueid'],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x36')]][_0x3fa5('0x90')]=_0x29ff81[_0x3fa5('0x83')];}else if(this[_0x3fa5('0x31')](_0x29ff81['variable'][_0x3fa5('0x91')])){logger[_0x3fa5('0x34')](_0x3fa5('0x92'),_0x29ff81['uniqueid'],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x36')]]['calleridpreview']=_0x29ff81[_0x3fa5('0x83')];}else if(this['isNotNull'](_0x29ff81['variable'][_0x3fa5('0x93')])){logger[_0x3fa5('0x34')](_0x3fa5('0x94'),_0x29ff81[_0x3fa5('0x36')],_0x29ff81['value']);this[_0x3fa5('0x16')][_0x29ff81['uniqueid']][_0x3fa5('0xc')]=_0x29ff81[_0x3fa5('0x83')];}else if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x95')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x29ff81['uniqueid'],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81['uniqueid']]['sipcalluniqueid']=_0x29ff81[_0x3fa5('0x83')];}}}else if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x81')])){if(_0x29ff81[_0x3fa5('0x83')]){var _0x1fe804=path[_0x3fa5('0x96')](_0x29ff81[_0x3fa5('0x83')])['name'];logger[_0x3fa5('0x34')](_0x3fa5('0x82'),_0x1fe804,_0x29ff81['value']);this[_0x3fa5('0x75')](_0x1fe804,_0x29ff81[_0x3fa5('0x83')]);}}else if(this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x3a')]]){if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')])){if(this[_0x3fa5('0x31')](_0x29ff81[_0x3fa5('0x80')][_0x3fa5('0x95')])){logger[_0x3fa5('0x34')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x29ff81[_0x3fa5('0x3a')],_0x29ff81[_0x3fa5('0x83')]);this[_0x3fa5('0x16')][_0x29ff81[_0x3fa5('0x3a')]][_0x3fa5('0x97')]=_0x29ff81[_0x3fa5('0x83')];}}}}}catch(_0x408023){logger[_0x3fa5('0x2d')](_0x3fa5('0x98'),_0x29ff81[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x408023,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fa5('0x30')][_0x3fa5('0x24')]=function(_0x55dc44){try{if(this[_0x3fa5('0x31')](_0x55dc44)){logger[_0x3fa5('0x53')](_0x3fa5('0x99'),_0x55dc44[_0x3fa5('0x36')],util[_0x3fa5('0x2f')](_0x55dc44,{'showHidden':![],'depth':null}));if(this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]]){if(this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x3a')]]){this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]]['linkedid']][_0x3fa5('0x36')]=_0x55dc44['uniqueid'];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x3a')]]['answered']=this[_0x3fa5('0x16')][_0x55dc44['uniqueid']]['answered'];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x3a')]][_0x3fa5('0x6b')]=this['channels'][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x6b')];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x3a')]][_0x3fa5('0x6e')]=this['channels'][this[_0x3fa5('0x18')][_0x55dc44['linkedid']][_0x3fa5('0x3a')]][_0x3fa5('0x41')];this['channels'][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]]['linkedid']][_0x3fa5('0x4e')]=this['channels'][_0x55dc44['uniqueid']][_0x3fa5('0x4e')];this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]=this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44['linkedid']]['linkedid']];delete this['channels'][this['blindTransfers'][_0x55dc44['linkedid']][_0x3fa5('0x3a')]];}else if(this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]]['uniqueid']]){this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44['linkedid']][_0x3fa5('0x36')]][_0x3fa5('0x36')]=[this['channels'][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]][_0x3fa5('0x3a')],this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]][_0x3fa5('0x3a')]=this['channels'][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]]['uniqueid']][0x0];this['channels'][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]][_0x3fa5('0x6a')]=this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x6a')];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]]['answertime']=this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x6b')];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]][_0x3fa5('0x6e')]=this[_0x3fa5('0x16')][this['blindTransfers'][_0x55dc44['linkedid']][_0x3fa5('0x36')]]['channel'];this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]][_0x3fa5('0x4e')]=this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]['disposition'];this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]=this['channels'][this['blindTransfers'][_0x55dc44[_0x3fa5('0x3a')]]['uniqueid']];delete this[_0x3fa5('0x16')][this[_0x3fa5('0x18')][_0x55dc44[_0x3fa5('0x3a')]][_0x3fa5('0x36')]];}}if(this[_0x3fa5('0x16')][_0x55dc44['uniqueid']]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x55dc44[_0x3fa5('0x36')],_0x55dc44['cause-txt']);var _0x4480e6=moment();this['channels'][_0x55dc44['uniqueid']][_0x3fa5('0x9a')]=_0x4480e6[_0x3fa5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x5a')]=_0x4480e6[_0x3fa5('0x6d')](this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]['starttime'],_0x3fa5('0x5c'));if(this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]['answered']){this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x9b')]=_0x4480e6[_0x3fa5('0x6d')](this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]]['answertime'],'seconds');this[_0x3fa5('0x16')][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x6c')]=this['channels'][_0x55dc44['uniqueid']][_0x3fa5('0x5a')]-this['channels'][_0x55dc44[_0x3fa5('0x36')]][_0x3fa5('0x9b')];}if(_0x55dc44['context']==='from-sip'){if(this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]]){this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')]['split']('-')[0x0]]=_['omit'](this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]],[_0x3fa5('0x45')]);logger[_0x3fa5('0x53')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x55dc44[_0x3fa5('0x36')],util[_0x3fa5('0x2f')]({'id':this['agents'][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]][_0x3fa5('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x3fa5('0x47')](_0x3fa5('0x48'),this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]][_0x3fa5('0x49')]),_0x3fa5('0x9c'),{'id':this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')][_0x3fa5('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x3fa5('0x17')][_0x55dc44[_0x3fa5('0x41')]['split']('-')[0x0]][_0x3fa5('0x52')]});for(var _0x3731bf=0x0;_0x3731bf0x0?!![]:![];if(!_0x21565a){return this[_0xde5f('0x19')](this[_0xde5f('0x4b')][_0xde5f('0x6f')]);}};VoiceQueueReport[_0xde5f('0xb')]['syncQueueMember']=function(_0x610a83){var _0x5bb0ea=this['summary']['id'];if(this[_0xde5f('0x4b')]['queuestatus'][_0x5bb0ea]&&this['summary'][_0xde5f('0x6b')][_0x5bb0ea][_0x610a83['actionid']]){this['summary'][_0xde5f('0x6b')][_0x5bb0ea][_0x610a83['actionid']][_0xde5f('0x10')]['push'](_0x610a83);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x4182c1){var _0x25020c=this;try{if(this[_0xde5f('0x70')](_0x4182c1)&&this[_0xde5f('0x70')](_0x4182c1[_0xde5f('0x54')])){logger[_0xde5f('0x4f')](_0xde5f('0x71'),util[_0xde5f('0x47')](_0x4182c1,{'showHidden':![],'depth':null}));var _0x9d4fd7=this['voiceQueues'][_0x4182c1['queue']];if(_0x9d4fd7){logger['debug'](_0xde5f('0x72'),_0x9d4fd7[_0xde5f('0x66')]);this[_0xde5f('0x4b')][_0xde5f('0x60')][_0x9d4fd7[_0xde5f('0x66')]]={'summaryEvent':_0x4182c1};this[_0xde5f('0x4b')][_0xde5f('0x6e')]+=0x1;return ami[_0xde5f('0x40')]({'action':_0xde5f('0x6b'),'queue':_0x9d4fd7[_0xde5f('0x66')]})[_0xde5f('0x63')](function(_0x57febd){if(!_0x25020c[_0xde5f('0x4b')][_0xde5f('0x6b')][_0x4182c1[_0xde5f('0x64')]]){_0x25020c[_0xde5f('0x4b')]['queuestatus'][_0x4182c1[_0xde5f('0x64')]]={};}_0x25020c[_0xde5f('0x4b')][_0xde5f('0x6b')][_0x4182c1[_0xde5f('0x64')]][_0x57febd[_0xde5f('0x64')]]={'queue':_0x9d4fd7[_0xde5f('0x66')],'agents':[]};})[_0xde5f('0x43')](function(_0x52ede5){throw _0x52ede5;});}}}catch(_0x409e32){logger[_0xde5f('0x45')](_0xde5f('0x65'),util[_0xde5f('0x47')](_0x409e32,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')][_0xde5f('0x19')]=function(_0x39c07d){if(this[_0xde5f('0x4b')][_0xde5f('0x6e')]>0x0){this['summary']['completeEvent']=_0x39c07d;return;}logger[_0xde5f('0x4f')](_0xde5f('0x73'),util[_0xde5f('0x47')](_0x39c07d,{'showHidden':![],'depth':null}));this[_0xde5f('0x4b')]=initializeSummary();ami[_0xde5f('0x4e')](_0xde5f('0x74'),{});};VoiceQueueReport[_0xde5f('0xb')]['syncQueueCallerJoin']=function(_0x408110){try{if(this[_0xde5f('0x70')](_0x408110)){logger[_0xde5f('0x4f')](_0xde5f('0x75'),_0x408110[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x408110,{'showHidden':![],'depth':null}));if(_[_0xde5f('0x76')](this['queueReports'][_0x408110[_0xde5f('0x51')]])){this[_0xde5f('0xe')][_0x408110[_0xde5f('0x51')]]=[];}if(_['isUndefined'](this[_0xde5f('0x3c')][_0x408110[_0xde5f('0x51')]])){this[_0xde5f('0x3c')][_0x408110[_0xde5f('0x51')]]={};}var _0x5f385d=new QueueReport();_0x5f385d[_0xde5f('0x54')]=_0x408110['queue'];_0x5f385d[_0xde5f('0x5d')]=this[_0xde5f('0x12')][_0x5f385d[_0xde5f('0x54')]]&&this[_0xde5f('0x12')][_0x5f385d[_0xde5f('0x54')]][_0xde5f('0x5d')]?this[_0xde5f('0x12')][_0x5f385d[_0xde5f('0x54')]][_0xde5f('0x5d')]||_0xde5f('0x5e'):_0xde5f('0x5e');_0x5f385d['queuecallerjoinAt']=moment()[_0xde5f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f385d[_0xde5f('0x77')]=_0x408110['position'];_0x5f385d[_0xde5f('0x78')]=_0x408110[_0xde5f('0x78')];_0x5f385d['uniqueid']=_0x408110[_0xde5f('0x51')];_0x5f385d[_0xde5f('0x79')]=this[_0xde5f('0x3c')][_0x408110[_0xde5f('0x51')]][_0xde5f('0x79')];logger[_0xde5f('0x7a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x5f385d['queue'],_0x5f385d[_0xde5f('0x5d')]);Object[_0xde5f('0x6a')](_0x5f385d,_[_0xde5f('0x7b')](_0x408110,_[_0xde5f('0x7c')](_0x5f385d)));this['queueReports'][_0x408110[_0xde5f('0x51')]]['push'](_0x5f385d);this[_0xde5f('0x3c')][_0x408110[_0xde5f('0x51')]]=_0x5f385d;this[_0xde5f('0x7d')](_0x5f385d,_0xde5f('0x1d'));}}catch(_0x63017a){logger[_0xde5f('0x45')](_0xde5f('0x75'),_0x408110[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x63017a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')]['syncQueueCallerAbandon']=function(_0x4be8e7){try{if(this[_0xde5f('0x70')](_0x4be8e7)){logger['debug'](_0xde5f('0x7e'),_0x4be8e7[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x4be8e7,{'showHidden':![],'depth':null}));if(this[_0xde5f('0xe')][_0x4be8e7[_0xde5f('0x51')]]){var _0x5d1a5e=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x4be8e7[_0xde5f('0x51')]]);_0x5d1a5e[_0xde5f('0x80')]=![];_0x5d1a5e['queuecallercompleteAt']=null;_0x5d1a5e[_0xde5f('0x81')]=_0x4be8e7[_0xde5f('0x81')];_0x5d1a5e[_0xde5f('0x82')]=_0x4be8e7[_0xde5f('0x82')];_0x5d1a5e[_0xde5f('0x1f')]=!![];_0x5d1a5e[_0xde5f('0x83')]=moment()[_0xde5f('0x52')](_0xde5f('0x84'));_0x5d1a5e['queuecallerexitreason']=_0xde5f('0x85');_0x5d1a5e['lastAssignedTo']=null;logger[_0xde5f('0x7a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5d1a5e[_0xde5f('0x54')],_0x5d1a5e['type']);this['channels'][_0x4be8e7['uniqueid']]=_0x5d1a5e;this['emitVoiceQueueChannelRemove'](_0x5d1a5e,_0xde5f('0x1f'));}}}catch(_0x403bcc){logger[_0xde5f('0x45')](_0xde5f('0x7e'),_0x4be8e7[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x403bcc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')][_0xde5f('0x22')]=function(_0x200c21){try{if(this[_0xde5f('0x70')](_0x200c21)){logger['debug'](_0xde5f('0x86'),_0x200c21[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x200c21,{'showHidden':![],'depth':null}));if(this[_0xde5f('0xe')][_0x200c21['uniqueid']]){var _0x49f188=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x200c21[_0xde5f('0x51')]]);_0x49f188['queuecallerleaveAt']=moment()[_0xde5f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x49f188[_0xde5f('0x87')]=_0x200c21[_0xde5f('0x87')];_0x49f188[_0xde5f('0x88')]=_0x200c21['connectedlinename'];logger[_0xde5f('0x7a')](_0xde5f('0x89'),_0x49f188[_0xde5f('0x54')],_0x49f188[_0xde5f('0x5d')],_0x200c21[_0xde5f('0x87')],_0x200c21[_0xde5f('0x88')]);this[_0xde5f('0x3c')][_0x200c21[_0xde5f('0x51')]]=_0x49f188;this[_0xde5f('0x7d')](_0x49f188,'queuecallerleave');}}}catch(_0x53468c){logger[_0xde5f('0x45')](_0xde5f('0x86'),_0x200c21[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x53468c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xde5f('0x25')]=function(_0x30c97f){try{if(this['isNotNull'](_0x30c97f)){logger[_0xde5f('0x4f')](_0xde5f('0x8a'),_0x30c97f[_0xde5f('0x51')],util['inspect'](_0x30c97f,{'showHidden':![],'depth':null}));if(this[_0xde5f('0xe')][_0x30c97f[_0xde5f('0x51')]]){var _0x159135=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x30c97f['uniqueid']]);_0x159135['queuecallercomplete']=!![];_0x159135[_0xde5f('0x59')]=_0xde5f('0x8b');logger[_0xde5f('0x7a')](_0xde5f('0x8c'),_0x159135['queue'],_0x159135['type']);}}}catch(_0x57ce1b){logger[_0xde5f('0x45')](_0xde5f('0x8a'),_0x30c97f[_0xde5f('0x51')],util['inspect'](_0x57ce1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')][_0xde5f('0x23')]=function(_0x53e3a6){try{if(this[_0xde5f('0x70')](_0x53e3a6)){logger[_0xde5f('0x4f')]('[%s][voiceQueueReport][agentcomplete]',_0x53e3a6[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x53e3a6,{'showHidden':![],'depth':null}));if(this[_0xde5f('0xe')][_0x53e3a6['uniqueid']]){var _0x5a68c6=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x53e3a6[_0xde5f('0x51')]]);_0x5a68c6[_0xde5f('0x1f')]=![];_0x5a68c6[_0xde5f('0x83')]=null;_0x5a68c6['assigned']=!![];_0x5a68c6[_0xde5f('0x8d')]=_0x53e3a6[_0xde5f('0x8e')];_0x5a68c6['holdtime']=_0x53e3a6[_0xde5f('0x81')];_0x5a68c6['queuecallercomplete']=!![];_0x5a68c6[_0xde5f('0x3a')]=![];_0x5a68c6[_0xde5f('0x8f')]=null;if(!_0x5a68c6[_0xde5f('0x90')]){if(_0x53e3a6[_0xde5f('0x91')]==_0xde5f('0x90')){_0x5a68c6['queuecallerexitreason']=_0xde5f('0x92');logger[_0xde5f('0x7a')](_0xde5f('0x93'),_0x5a68c6[_0xde5f('0x54')],_0x5a68c6['type']);}else{if(_['startsWith'](_0x53e3a6[_0xde5f('0x42')][_0xde5f('0x94')](),_0xde5f('0x95'))){if(this[_0xde5f('0xe')][_0x53e3a6['linkedid']]){var _0x14c872=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x53e3a6[_0xde5f('0x96')]]);_0x14c872['queuecallercomplete']=![];_0x14c872['queuecallerexit']=!![];_0x14c872['queuecallerexitAt']=moment(_0x5a68c6[_0xde5f('0x97')])[_0xde5f('0x98')](_0x53e3a6[_0xde5f('0x81')],_0xde5f('0x99'))[_0xde5f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x14c872[_0xde5f('0x59')]=_0xde5f('0x9a');_0x14c872[_0xde5f('0x90')]=!![];_0x14c872['transfertype']=_0xde5f('0x9b');_0x14c872['transferexten']=_0x53e3a6[_0xde5f('0x9c')];_0x14c872[_0xde5f('0x9d')]=_0x53e3a6[_0xde5f('0x51')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x14c872[_0xde5f('0x54')],_0x14c872[_0xde5f('0x5d')]);var _0x5a5bf8=this[_0xde5f('0xe')][_0x53e3a6[_0xde5f('0x96')]];this['queueReports'][_0x53e3a6['linkedid']]=this[_0xde5f('0xe')][_0x53e3a6[_0xde5f('0x51')]];this[_0xde5f('0xe')][_0x53e3a6['uniqueid']]=_0x5a5bf8;}}else{_0x5a68c6[_0xde5f('0x59')]=_0xde5f('0x9e')+_0x53e3a6[_0xde5f('0x91')][_0xde5f('0x9f')]();logger[_0xde5f('0x7a')](_0xde5f('0xa0'),_0x5a68c6[_0xde5f('0x54')],_0x5a68c6['type'],_0x5a68c6[_0xde5f('0x59')]);}}}this[_0xde5f('0x3c')][_0x53e3a6[_0xde5f('0x51')]]=_0x5a68c6;}}}catch(_0x1a4303){logger[_0xde5f('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x53e3a6[_0xde5f('0x51')],util['inspect'](_0x1a4303,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')][_0xde5f('0x27')]=function(_0x2d80d7){try{if(this[_0xde5f('0x70')](_0x2d80d7)){logger[_0xde5f('0x4f')](_0xde5f('0xa1'),_0x2d80d7[_0xde5f('0x51')],util['inspect'](_0x2d80d7,{'showHidden':![],'depth':null}));this[_0xde5f('0xa2')](_0x2d80d7[_0xde5f('0x51')],_[_0xde5f('0x7c')](_0x2d80d7[_0xde5f('0xa3')])[0x0],_0x2d80d7['value']);if(this[_0xde5f('0xe')][_0x2d80d7[_0xde5f('0x51')]]){var _0x51df6d=_[_0xde5f('0x7f')](this[_0xde5f('0xe')][_0x2d80d7['uniqueid']]);if(_0x51df6d){if(this['isNotNull'](_0x2d80d7[_0xde5f('0xa3')])&&this[_0xde5f('0x70')](_0x2d80d7[_0xde5f('0xa3')]['queuestatus'])){switch(_0x2d80d7[_0xde5f('0xa4')]){case _0xde5f('0xa5'):_0x51df6d[_0xde5f('0x3a')]=![];_0x51df6d[_0xde5f('0x8f')]=null;break;case _0xde5f('0xa6'):_0x51df6d['lastevent']=_0xde5f('0xa7');_0x51df6d[_0xde5f('0x3a')]=!![];_0x51df6d[_0xde5f('0x8f')]=moment()[_0xde5f('0x52')](_0xde5f('0x84'));_0x51df6d['queuecallerleaveAt']=moment()[_0xde5f('0x52')](_0xde5f('0x84'));logger[_0xde5f('0x4f')](_0xde5f('0xa8'),_0x2d80d7[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x51df6d,{'showHidden':![],'depth':null}));ami['emit'](_0xde5f('0xa9'),_0x51df6d);break;default:_0x51df6d['queuecallerexit']=!![];_0x51df6d['queuecallerexitAt']=moment()['format'](_0xde5f('0x84'));_0x51df6d[_0xde5f('0xaa')]=moment()[_0xde5f('0x52')](_0xde5f('0x84'));}_0x51df6d[_0xde5f('0x1f')]=![];_0x51df6d['queuecallerabandonAt']=null;_0x51df6d[_0xde5f('0x59')]=_0x2d80d7[_0xde5f('0xa4')];this[_0xde5f('0x3c')][_0x2d80d7[_0xde5f('0x51')]]=_0x51df6d;this[_0xde5f('0x4c')](_0x51df6d,_0xde5f('0x26'));}else if(this[_0xde5f('0x70')](_0x2d80d7[_0xde5f('0xa3')])&&this[_0xde5f('0x70')](_0x2d80d7['variable'][_0xde5f('0xab')])){if(!_0x51df6d[_0xde5f('0x1f')]){_0x51df6d[_0xde5f('0x3a')]=!![];_0x51df6d[_0xde5f('0x8f')]=moment()[_0xde5f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x51df6d[_0xde5f('0x59')]=_0xde5f('0xac');_0x51df6d[_0xde5f('0xaa')]=moment()[_0xde5f('0x52')](_0xde5f('0x84'));this[_0xde5f('0x3c')][_0x2d80d7['uniqueid']]=_0x51df6d;}}logger[_0xde5f('0x7a')](_0xde5f('0xad'),_0x2d80d7['uniqueid'],_0x51df6d[_0xde5f('0x54')],_0x51df6d[_0xde5f('0x5d')],_[_0xde5f('0x7c')](_0x2d80d7[_0xde5f('0xa3')])[0x0],_0x2d80d7[_0xde5f('0xa4')]);_0x51df6d[_0xde5f('0x14')]=this[_0xde5f('0x14')][_0x2d80d7['uniqueid']];}}}}catch(_0x26e6c3){logger[_0xde5f('0x45')](_0xde5f('0xa1'),_0x2d80d7[_0xde5f('0x51')],util[_0xde5f('0x47')](_0x26e6c3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde5f('0xb')][_0xde5f('0xa2')]=function(_0x3f9822,_0x26d579,_0xa1fc34){var _0xe0e1cd=[_0xde5f('0xae'),_0xde5f('0xaf'),_0xde5f('0xb0'),_0xde5f('0xb1'),'rtpaudioqosloss',_0xde5f('0xb2'),_0xde5f('0xb3'),'rtpaudioqosrttbridged',_0xde5f('0xb4'),_0xde5f('0xb5'),'bridgepeer',_0xde5f('0xb6'),_0xde5f('0xb7'),'memberdynamic','memberinterface',_0xde5f('0xb8'),'membername',_0xde5f('0xb9'),'memberrealtime'];if(!_[_0xde5f('0x3f')](_0x26d579)&&!_[_0xde5f('0xba')](_0xe0e1cd,_0x26d579)){if(_[_0xde5f('0x76')](this['variables'][_0x3f9822])){this[_0xde5f('0x14')][_0x3f9822]={};}this['variables'][_0x3f9822][_0x26d579]=_0xa1fc34;}};VoiceQueueReport['prototype'][_0xde5f('0xbb')]=function(_0x54bbc7,_0x3444b9,_0x3f18da){try{var _0x480d31={};if(this[_0xde5f('0xe')][_0x54bbc7]){for(var _0x15af61=0x0;_0x15af610x0?!![]:![];if(!_0x3ef125){return this[_0xb4d6('0x1b')](this[_0xb4d6('0x17')]['completeEvent']);}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x1d')]=function(_0x1dd822){var _0x32b328=this[_0xb4d6('0x17')]['id'];if(this[_0xb4d6('0x17')][_0xb4d6('0x65')][_0x32b328]&&this[_0xb4d6('0x17')][_0xb4d6('0x65')][_0x32b328][_0x1dd822[_0xb4d6('0x63')]]){this[_0xb4d6('0x17')]['queuestatus'][_0x32b328][_0x1dd822[_0xb4d6('0x63')]]['agents']['push'](_0x1dd822);}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x19')]=function(_0x4ba3c6){var _0x536306=this;try{if(this[_0xb4d6('0x5e')](_0x4ba3c6)&&this[_0xb4d6('0x5e')](_0x4ba3c6['queue'])){logger[_0xb4d6('0x4c')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x4ba3c6,{'showHidden':![],'depth':null}));var _0x14d494=this[_0xb4d6('0x15')][_0x4ba3c6[_0xb4d6('0x51')]];if(_0x14d494){logger[_0xb4d6('0x4c')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x14d494[_0xb4d6('0x5c')]);this[_0xb4d6('0x17')][_0xb4d6('0x60')][_0x14d494[_0xb4d6('0x5c')]]={'summaryEvent':_0x4ba3c6};this[_0xb4d6('0x17')][_0xb4d6('0x6d')]+=0x1;return ami[_0xb4d6('0x3a')]({'action':_0xb4d6('0x65'),'queue':_0x14d494[_0xb4d6('0x5c')]})[_0xb4d6('0x6e')](function(_0x2a15a9){if(!_0x536306[_0xb4d6('0x17')][_0xb4d6('0x65')][_0x4ba3c6[_0xb4d6('0x63')]]){_0x536306[_0xb4d6('0x17')]['queuestatus'][_0x4ba3c6['actionid']]={};}_0x536306[_0xb4d6('0x17')][_0xb4d6('0x65')][_0x4ba3c6[_0xb4d6('0x63')]][_0x2a15a9[_0xb4d6('0x63')]]={'queue':_0x14d494[_0xb4d6('0x5c')],'agents':[]};})[_0xb4d6('0x3d')](function(_0x145c74){throw _0x145c74;});}}}catch(_0x1d776b){logger['error'](_0xb4d6('0x66'),util[_0xb4d6('0x42')](_0x1d776b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')]['syncQueueSummaryComplete']=function(_0xce7cde){if(this[_0xb4d6('0x17')][_0xb4d6('0x6d')]>0x0){this[_0xb4d6('0x17')]['completeEvent']=_0xce7cde;return;}logger['debug'](_0xb4d6('0x6f'),util[_0xb4d6('0x42')](_0xce7cde,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xb4d6('0x4a')](_0xb4d6('0x70'),{});};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x20')]=function(_0x55415c){try{if(this[_0xb4d6('0x5e')](_0x55415c)){logger['debug'](_0xb4d6('0x71'),_0x55415c[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x55415c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb4d6('0x43')][_0x55415c[_0xb4d6('0x4e')]])){this[_0xb4d6('0x43')][_0x55415c[_0xb4d6('0x4e')]]=[];}if(_[_0xb4d6('0x5f')](this[_0xb4d6('0x37')][_0x55415c[_0xb4d6('0x4e')]])){this[_0xb4d6('0x37')][_0x55415c[_0xb4d6('0x4e')]]={};}var _0x594ffc=new QueueReport();_0x594ffc['queue']=_0x55415c['queue'];_0x594ffc[_0xb4d6('0x59')]=this[_0xb4d6('0x15')][_0x594ffc['queue']]&&this[_0xb4d6('0x15')][_0x594ffc[_0xb4d6('0x51')]][_0xb4d6('0x59')]?this[_0xb4d6('0x15')][_0x594ffc[_0xb4d6('0x51')]]['type']||_0xb4d6('0x5a'):_0xb4d6('0x5a');_0x594ffc[_0xb4d6('0x72')]=moment()['format'](_0xb4d6('0x73'));_0x594ffc[_0xb4d6('0x74')]=_0x55415c[_0xb4d6('0x74')];_0x594ffc['count']=_0x55415c[_0xb4d6('0x75')];_0x594ffc['uniqueid']=_0x55415c[_0xb4d6('0x4e')];_0x594ffc[_0xb4d6('0x76')]=this[_0xb4d6('0x37')][_0x55415c[_0xb4d6('0x4e')]]['routealias'];logger[_0xb4d6('0x77')](_0xb4d6('0x78'),_0x594ffc[_0xb4d6('0x51')],_0x594ffc['type']);Object[_0xb4d6('0x69')](_0x594ffc,_['pick'](_0x55415c,_[_0xb4d6('0x79')](_0x594ffc)));this['queueReports'][_0x55415c[_0xb4d6('0x4e')]][_0xb4d6('0x7a')](_0x594ffc);this[_0xb4d6('0x37')][_0x55415c[_0xb4d6('0x4e')]]=_0x594ffc;this[_0xb4d6('0x4b')](_0x594ffc,_0xb4d6('0x1f'));}}catch(_0x298dc3){logger[_0xb4d6('0x40')](_0xb4d6('0x71'),_0x55415c['uniqueid'],util[_0xb4d6('0x42')](_0x298dc3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x7b')]=function(_0x558ca5){try{if(this[_0xb4d6('0x5e')](_0x558ca5)){logger[_0xb4d6('0x4c')](_0xb4d6('0x7c'),_0x558ca5[_0xb4d6('0x4e')],util['inspect'](_0x558ca5,{'showHidden':![],'depth':null}));if(this[_0xb4d6('0x43')][_0x558ca5['uniqueid']]){var _0x5469d6=_[_0xb4d6('0x7d')](this[_0xb4d6('0x43')][_0x558ca5[_0xb4d6('0x4e')]]);_0x5469d6['queuecallercomplete']=![];_0x5469d6[_0xb4d6('0x7e')]=null;_0x5469d6[_0xb4d6('0x7f')]=_0x558ca5['holdtime'];_0x5469d6[_0xb4d6('0x80')]=_0x558ca5[_0xb4d6('0x80')];_0x5469d6[_0xb4d6('0x35')]=!![];_0x5469d6[_0xb4d6('0x81')]=moment()[_0xb4d6('0x4f')](_0xb4d6('0x73'));_0x5469d6[_0xb4d6('0x55')]='ABANDONED';_0x5469d6[_0xb4d6('0x82')]=null;logger[_0xb4d6('0x77')](_0xb4d6('0x83'),_0x5469d6['queue'],_0x5469d6[_0xb4d6('0x59')]);this[_0xb4d6('0x37')][_0x558ca5['uniqueid']]=_0x5469d6;this[_0xb4d6('0x48')](_0x5469d6,'queuecallerabandon');}}}catch(_0x31027e){logger[_0xb4d6('0x40')](_0xb4d6('0x7c'),_0x558ca5[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x31027e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb4d6('0x22')]=function(_0x94c2fb){try{if(this[_0xb4d6('0x5e')](_0x94c2fb)){logger['debug'](_0xb4d6('0x84'),_0x94c2fb['uniqueid'],util['inspect'](_0x94c2fb,{'showHidden':![],'depth':null}));if(this[_0xb4d6('0x43')][_0x94c2fb[_0xb4d6('0x4e')]]){var _0x5b64bb=_[_0xb4d6('0x7d')](this[_0xb4d6('0x43')][_0x94c2fb['uniqueid']]);_0x5b64bb[_0xb4d6('0x85')]=moment()[_0xb4d6('0x4f')](_0xb4d6('0x73'));_0x5b64bb[_0xb4d6('0x86')]=_0x94c2fb['connectedlinenum'];_0x5b64bb[_0xb4d6('0x87')]=_0x94c2fb['connectedlinename'];logger[_0xb4d6('0x77')](_0xb4d6('0x88'),_0x5b64bb[_0xb4d6('0x51')],_0x5b64bb[_0xb4d6('0x59')],_0x94c2fb[_0xb4d6('0x86')],_0x94c2fb[_0xb4d6('0x87')]);this[_0xb4d6('0x37')][_0x94c2fb[_0xb4d6('0x4e')]]=_0x5b64bb;this[_0xb4d6('0x4b')](_0x5b64bb,_0xb4d6('0x21'));}}}catch(_0x256757){logger[_0xb4d6('0x40')](_0xb4d6('0x84'),_0x94c2fb['uniqueid'],util[_0xb4d6('0x42')](_0x256757,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x25')]=function(_0x1495c6){try{if(this[_0xb4d6('0x5e')](_0x1495c6)){logger[_0xb4d6('0x4c')](_0xb4d6('0x89'),_0x1495c6[_0xb4d6('0x4e')],util['inspect'](_0x1495c6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1495c6[_0xb4d6('0x4e')]]){var _0x5b09c1=_[_0xb4d6('0x7d')](this[_0xb4d6('0x43')][_0x1495c6[_0xb4d6('0x4e')]]);_0x5b09c1[_0xb4d6('0x8a')]=!![];_0x5b09c1[_0xb4d6('0x55')]='COMPLETEDBYAGENT';logger[_0xb4d6('0x77')](_0xb4d6('0x8b'),_0x5b09c1['queue'],_0x5b09c1[_0xb4d6('0x59')]);}}}catch(_0x3bcb31){logger['error'](_0xb4d6('0x89'),_0x1495c6[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x3bcb31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0x8c')]=function(_0x12a8ab){try{if(this[_0xb4d6('0x5e')](_0x12a8ab)){logger[_0xb4d6('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x12a8ab['uniqueid'],util[_0xb4d6('0x42')](_0x12a8ab,{'showHidden':![],'depth':null}));if(this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x4e')]]){var _0x3d302e=_[_0xb4d6('0x7d')](this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x4e')]]);_0x3d302e[_0xb4d6('0x35')]=![];_0x3d302e[_0xb4d6('0x81')]=null;_0x3d302e[_0xb4d6('0x8d')]=!![];_0x3d302e[_0xb4d6('0x82')]=_0x12a8ab[_0xb4d6('0x8e')];_0x3d302e['holdtime']=_0x12a8ab['holdtime'];_0x3d302e[_0xb4d6('0x8a')]=!![];_0x3d302e[_0xb4d6('0x34')]=![];_0x3d302e[_0xb4d6('0x8f')]=null;if(!_0x3d302e[_0xb4d6('0x90')]){if(_0x12a8ab[_0xb4d6('0x91')]==_0xb4d6('0x90')){_0x3d302e[_0xb4d6('0x55')]=_0xb4d6('0x92');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3d302e['queue'],_0x3d302e[_0xb4d6('0x59')]);}else{if(_[_0xb4d6('0x93')](_0x12a8ab['channel']['toLowerCase'](),_0xb4d6('0x94'))){if(this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x95')]]){var _0x48b16a=_[_0xb4d6('0x7d')](this['queueReports'][_0x12a8ab[_0xb4d6('0x95')]]);_0x48b16a[_0xb4d6('0x8a')]=![];_0x48b16a[_0xb4d6('0x34')]=!![];_0x48b16a['queuecallerexitAt']=moment(_0x3d302e[_0xb4d6('0x72')])[_0xb4d6('0x96')](_0x12a8ab[_0xb4d6('0x7f')],_0xb4d6('0x97'))[_0xb4d6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x48b16a[_0xb4d6('0x55')]=_0xb4d6('0x98');_0x48b16a[_0xb4d6('0x90')]=!![];_0x48b16a['transfertype']=_0xb4d6('0x99');_0x48b16a['transferexten']=_0x12a8ab[_0xb4d6('0x9a')];_0x48b16a[_0xb4d6('0x9b')]=_0x12a8ab['uniqueid'];logger[_0xb4d6('0x77')](_0xb4d6('0x9c'),_0x48b16a['queue'],_0x48b16a[_0xb4d6('0x59')]);var _0x196ae9=this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x95')]];this['queueReports'][_0x12a8ab[_0xb4d6('0x95')]]=this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x4e')]];this[_0xb4d6('0x43')][_0x12a8ab[_0xb4d6('0x4e')]]=_0x196ae9;}}else{_0x3d302e['queuecallerexitreason']=_0xb4d6('0x9d')+_0x12a8ab[_0xb4d6('0x91')][_0xb4d6('0x9e')]();logger[_0xb4d6('0x77')](_0xb4d6('0x9f'),_0x3d302e[_0xb4d6('0x51')],_0x3d302e[_0xb4d6('0x59')],_0x3d302e[_0xb4d6('0x55')]);}}}this[_0xb4d6('0x37')][_0x12a8ab[_0xb4d6('0x4e')]]=_0x3d302e;}}}catch(_0x180220){logger['error'](_0xb4d6('0xa0'),_0x12a8ab[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x180220,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0xa1')]=function(_0x363349){try{if(this[_0xb4d6('0x5e')](_0x363349)){logger[_0xb4d6('0x4c')](_0xb4d6('0xa2'),_0x363349[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x363349,{'showHidden':![],'depth':null}));this[_0xb4d6('0xa3')](_0x363349[_0xb4d6('0x4e')],_[_0xb4d6('0x79')](_0x363349[_0xb4d6('0xa4')])[0x0],_0x363349['value']);if(this[_0xb4d6('0x43')][_0x363349[_0xb4d6('0x4e')]]){var _0x2845fa=_[_0xb4d6('0x7d')](this[_0xb4d6('0x43')][_0x363349['uniqueid']]);if(_0x2845fa){if(this[_0xb4d6('0x5e')](_0x363349[_0xb4d6('0xa4')])&&this[_0xb4d6('0x5e')](_0x363349[_0xb4d6('0xa4')][_0xb4d6('0x65')])){switch(_0x363349['value']){case'CONTINUE':_0x2845fa[_0xb4d6('0x34')]=![];_0x2845fa['queuecallerexitAt']=null;break;case _0xb4d6('0xa5'):_0x2845fa[_0xb4d6('0xa6')]='timeout';_0x2845fa[_0xb4d6('0x34')]=!![];_0x2845fa[_0xb4d6('0x8f')]=moment()[_0xb4d6('0x4f')](_0xb4d6('0x73'));_0x2845fa[_0xb4d6('0x85')]=moment()['format'](_0xb4d6('0x73'));logger[_0xb4d6('0x4c')](_0xb4d6('0xa7'),_0x363349[_0xb4d6('0x4e')],util[_0xb4d6('0x42')](_0x2845fa,{'showHidden':![],'depth':null}));ami[_0xb4d6('0x4a')](_0xb4d6('0xa8'),_0x2845fa);break;default:_0x2845fa[_0xb4d6('0x34')]=!![];_0x2845fa[_0xb4d6('0x8f')]=moment()[_0xb4d6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2845fa[_0xb4d6('0x85')]=moment()[_0xb4d6('0x4f')](_0xb4d6('0x73'));}_0x2845fa['queuecallerabandon']=![];_0x2845fa[_0xb4d6('0x81')]=null;_0x2845fa[_0xb4d6('0x55')]=_0x363349['value'];this['channels'][_0x363349['uniqueid']]=_0x2845fa;this[_0xb4d6('0x48')](_0x2845fa,_0xb4d6('0x26'));}else if(this['isNotNull'](_0x363349[_0xb4d6('0xa4')])&&this[_0xb4d6('0x5e')](_0x363349[_0xb4d6('0xa4')]['queueposition'])){if(!_0x2845fa[_0xb4d6('0x35')]){_0x2845fa[_0xb4d6('0x34')]=!![];_0x2845fa['queuecallerexitAt']=moment()[_0xb4d6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2845fa[_0xb4d6('0x55')]=_0xb4d6('0xa9');_0x2845fa['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb4d6('0x37')][_0x363349[_0xb4d6('0x4e')]]=_0x2845fa;}}logger[_0xb4d6('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x363349[_0xb4d6('0x4e')],_0x2845fa[_0xb4d6('0x51')],_0x2845fa[_0xb4d6('0x59')],_[_0xb4d6('0x79')](_0x363349[_0xb4d6('0xa4')])[0x0],_0x363349[_0xb4d6('0xaa')]);_0x2845fa[_0xb4d6('0x44')]=this['variables'][_0x363349['uniqueid']];}}}}catch(_0x57ffa7){logger['error'](_0xb4d6('0xa2'),_0x363349[_0xb4d6('0x4e')],util['inspect'](_0x57ffa7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb4d6('0xd')][_0xb4d6('0xa3')]=function(_0x506662,_0x5ee6e5,_0xb739cc){var _0x472e65=[_0xb4d6('0xab'),_0xb4d6('0xac'),_0xb4d6('0xad'),_0xb4d6('0xae'),'rtpaudioqosloss',_0xb4d6('0xaf'),'rtpaudioqosrtt',_0xb4d6('0xb0'),_0xb4d6('0xb1'),_0xb4d6('0xb2'),_0xb4d6('0xb3'),_0xb4d6('0xb4'),'membercalls',_0xb4d6('0xb5'),_0xb4d6('0xb6'),_0xb4d6('0xb7'),_0xb4d6('0x8e'),_0xb4d6('0xb8'),_0xb4d6('0xb9')];if(!_[_0xb4d6('0x39')](_0x5ee6e5)&&!_[_0xb4d6('0xba')](_0x472e65,_0x5ee6e5)){if(_[_0xb4d6('0x5f')](this['variables'][_0x506662])){this[_0xb4d6('0x44')][_0x506662]={};}this['variables'][_0x506662][_0x5ee6e5]=_0xb739cc;}};VoiceQueueReport[_0xb4d6('0xd')]['handleHangup']=function(_0x1e15aa,_0x5392df,_0x204cfe){try{var _0x488d7c={};if(this[_0xb4d6('0x43')][_0x1e15aa]){for(var _0x122097=0x0;_0x122097=0x0?moment(_0x497397[_0x9d34('0x17')])[_0x9d34('0x19')](_0x497397['starttime'],_0x9d34('0x18')):null,'data1':_0x9d34('0x1a'),'data2':_0x497397[_0x9d34('0x12')],'data3':_0x497397['exten'],'data4':_0x497397['dialstring']||null,'role':_0x9d34('0x11'),'internal':_0x497397['accountcode']?_[_0x9d34('0x13')](_0x497397[_0x9d34('0x12')]):undefined,'uniqueid':_0x497397[_0x9d34('0x1b')]},'log':_0x9d34('0x7')});}; \ No newline at end of file +var _0x4774=['queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','seconds','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','dialstring','moment','util','../client','voiceQueueReport'];(function(_0x4011dd,_0x518454){var _0x1a7ce6=function(_0x3c24db){while(--_0x3c24db){_0x4011dd['push'](_0x4011dd['shift']());}};_0x1a7ce6(++_0x518454);}(_0x4774,0xd4));var _0x4477=function(_0x32393a,_0x2587ce){_0x32393a=_0x32393a-0x0;var _0x365000=_0x4774[_0x32393a];return _0x365000;};'use strict';var moment=require(_0x4477('0x0'));var _=require('lodash');var util=require(_0x4477('0x1'));var client=require(_0x4477('0x2'));exports[_0x4477('0x3')]=function(_0x48f5f2){var _0xe75707=_0x48f5f2[_0x4477('0x4')]||_0x48f5f2['queuecallerexitAt'];return client[_0x4477('0x5')](_0x4477('0x6'),{'body':{'channel':'voice','membername':_0x48f5f2[_0x4477('0x7')],'interface':_[_0x4477('0x8')](_0x48f5f2[_0x4477('0x9')])?util[_0x4477('0xa')](_0x4477('0xb'),_0x48f5f2[_0x4477('0x7')]):_0x48f5f2[_0x4477('0x9')],'type':'TALKING','enterAt':_0x48f5f2[_0x4477('0xc')],'exitAt':_0xe75707,'duration':moment(_0xe75707)[_0x4477('0xd')](_0x48f5f2[_0x4477('0xc')],_0x4477('0xe')),'data1':'inbound','data2':_0x48f5f2[_0x4477('0xf')],'data3':_0x48f5f2[_0x4477('0x10')],'data4':null,'data5':_0x48f5f2['queue'],'role':_0x4477('0x11'),'internal':_0x48f5f2[_0x4477('0x12')]?_[_0x4477('0x13')](_0x48f5f2[_0x4477('0x12')]):undefined,'uniqueid':_0x48f5f2[_0x4477('0x14')]},'log':_0x4477('0x6')});};exports[_0x4477('0x15')]=function(_0x532876){return client['Request'](_0x4477('0x6'),{'body':{'channel':'voice','membername':_0x532876[_0x4477('0x16')],'interface':_0x532876[_0x4477('0x9')],'type':_0x4477('0x17'),'enterAt':_0x532876[_0x4477('0x18')],'exitAt':_0x532876[_0x4477('0x19')],'duration':moment(_0x532876['endtime'])[_0x4477('0xd')](_0x532876['starttime'],_0x4477('0xe'))>=0x0?moment(_0x532876['endtime'])[_0x4477('0xd')](_0x532876[_0x4477('0x18')],'seconds'):null,'data1':'outbound','data2':_0x532876[_0x4477('0x12')],'data3':_0x532876[_0x4477('0x10')],'data4':_0x532876[_0x4477('0x1a')]||null,'role':_0x4477('0x11'),'internal':_0x532876[_0x4477('0x12')]?_[_0x4477('0x13')](_0x532876[_0x4477('0x12')]):undefined,'uniqueid':_0x532876[_0x4477('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 9746ac0..7735d3e 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 _0x180d=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','getSettings'];(function(_0x3ee0d8,_0x1e34e0){var _0x4203d8=function(_0x4e4194){while(--_0x4e4194){_0x3ee0d8['push'](_0x3ee0d8['shift']());}};_0x4203d8(++_0x1e34e0);}(_0x180d,0xf9));var _0xd180=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x180d[_0x1d24eb];return _0x1dc576;};'use strict';var client=require('../client');exports[_0xd180('0x0')]=function(){return client[_0xd180('0x1')](_0xd180('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd180('0x3'),_0xd180('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xea85=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xea85,0x1cd));var _0x5ea8=function(_0x78ea2d,_0x158cb0){_0x78ea2d=_0x78ea2d-0x0;var _0x39305b=_0xea85[_0x78ea2d];return _0x39305b;};'use strict';var client=require(_0x5ea8('0x0'));exports['getSettings']=function(){return client[_0x5ea8('0x1')](_0x5ea8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5ea8('0x3'),_0x5ea8('0x4')]},'log':_0x5ea8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 99ac409..ba9e6ec 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 _0xcb10=['../client','getTemplates','Request','name','GetTemplate'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0xcb10,0x104));var _0x0cb1=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xcb10[_0x29d915];return _0x160f86;};'use strict';var client=require(_0x0cb1('0x0'));exports[_0x0cb1('0x1')]=function(_0x568ead){return function(_0x8e770b){return client[_0x0cb1('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x0cb1('0x3'),'html']},'log':_0x0cb1('0x4')});};}; \ No newline at end of file +var _0x8fae=['getTemplates','Request','GetTemplate','html','../client'];(function(_0xa7c05d,_0x312374){var _0x47b002=function(_0x44aa2f){while(--_0x44aa2f){_0xa7c05d['push'](_0xa7c05d['shift']());}};_0x47b002(++_0x312374);}(_0x8fae,0x10d));var _0xe8fa=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0x8fae[_0x18ea99];return _0x4e1a63;};'use strict';var client=require(_0xe8fa('0x0'));exports[_0xe8fa('0x1')]=function(_0xc28cda){return function(_0x3d048e){return client[_0xe8fa('0x2')](_0xe8fa('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xe8fa('0x4')]},'log':_0xe8fa('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ca10451..360f547 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 _0x3250=['value','Action','data1','data2','data4','data5','data7','GetTrigger','../client','getTriggers','Request','name','status','Condition','AllConditions','field','operator'];(function(_0x25e9ff,_0x3f0c8b){var _0x1cc069=function(_0x5e29b1){while(--_0x5e29b1){_0x25e9ff['push'](_0x25e9ff['shift']());}};_0x1cc069(++_0x3f0c8b);}(_0x3250,0x18f));var _0x0325=function(_0x3a5dee,_0x434e05){_0x3a5dee=_0x3a5dee-0x0;var _0x1c4f75=_0x3250[_0x3a5dee];return _0x1c4f75;};'use strict';var client=require(_0x0325('0x0'));exports[_0x0325('0x1')]=function(_0x11c37c){return function(_0x58d9d){return client[_0x0325('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0325('0x3'),'channel',_0x0325('0x4')],'include':[{'model':_0x0325('0x5'),'as':_0x0325('0x6'),'attributes':['id',_0x0325('0x7'),_0x0325('0x8'),_0x0325('0x9')]},{'model':_0x0325('0x5'),'as':'AnyConditions','attributes':['id','field','operator',_0x0325('0x9')]},{'model':_0x0325('0xa'),'as':'Actions','attributes':['id','action',_0x0325('0xb'),_0x0325('0xc'),'data3',_0x0325('0xd'),_0x0325('0xe'),'data6',_0x0325('0xf')]}]},'log':_0x0325('0x10')});};}; \ No newline at end of file +var _0xaf06=['AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data4','data5','data7','GetTrigger','getTriggers','name','channel','status','Condition'];(function(_0xc999d1,_0x25f2fa){var _0x473e6a=function(_0x452974){while(--_0x452974){_0xc999d1['push'](_0xc999d1['shift']());}};_0x473e6a(++_0x25f2fa);}(_0xaf06,0x1f3));var _0x6af0=function(_0x48d48d,_0x5d5e87){_0x48d48d=_0x48d48d-0x0;var _0x215caf=_0xaf06[_0x48d48d];return _0x215caf;};'use strict';var client=require('../client');exports[_0x6af0('0x0')]=function(_0x3291ae){return function(_0x40b210){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x6af0('0x1'),_0x6af0('0x2'),_0x6af0('0x3')],'include':[{'model':_0x6af0('0x4'),'as':_0x6af0('0x5'),'attributes':['id','field',_0x6af0('0x6'),_0x6af0('0x7')]},{'model':_0x6af0('0x4'),'as':_0x6af0('0x8'),'attributes':['id',_0x6af0('0x9'),_0x6af0('0x6'),_0x6af0('0x7')]},{'model':_0x6af0('0xa'),'as':_0x6af0('0xb'),'attributes':['id',_0x6af0('0xc'),_0x6af0('0xd'),'data2','data3',_0x6af0('0xe'),_0x6af0('0xf'),'data6',_0x6af0('0x10')]}]},'log':_0x6af0('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 063095f..31cb1a4 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 _0xd8eb=['name','registry','defaultuser','GetTrunk','../client','getTrunks','Request'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0xd8eb,0x66));var _0xbd8e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd8eb[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0xbd8e('0x0'));exports[_0xbd8e('0x1')]=function(_0x56d701){return function(_0x23449b){return client[_0xbd8e('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbd8e('0x3'),_0xbd8e('0x4'),_0xbd8e('0x5')]},'log':_0xbd8e('0x6')});};}; \ No newline at end of file +var _0xf53f=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xf53f,0x8d));var _0xff53=function(_0x22274e,_0x1cd6ee){_0x22274e=_0x22274e-0x0;var _0x5c0b8b=_0xf53f[_0x22274e];return _0x5c0b8b;};'use strict';var client=require(_0xff53('0x0'));exports[_0xff53('0x1')]=function(_0x25c590){return function(_0x28461e){return client[_0xff53('0x2')](_0xff53('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xff53('0x4'),_0xff53('0x5'),_0xff53('0x6')]},'log':_0xff53('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6a3d140..5f73a79 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe706,0xa3));var _0x6e70=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xe706[_0x146a97];return _0x259d5c;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 25ebee0..3d056e2 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 _0xbc4c=['Request','CreateVoiceAgentReport','update','../client','create'];(function(_0x31b950,_0x48a4e9){var _0x415d87=function(_0x42cb07){while(--_0x42cb07){_0x31b950['push'](_0x31b950['shift']());}};_0x415d87(++_0x48a4e9);}(_0xbc4c,0x198));var _0xcbc4=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0xbc4c[_0x4fa291];return _0x506d9b;};'use strict';var client=require(_0xcbc4('0x0'));exports[_0xcbc4('0x1')]=function(_0x41a7a8){return client[_0xcbc4('0x2')](_0xcbc4('0x3'),{'body':_0x41a7a8,'log':_0xcbc4('0x3')});};exports[_0xcbc4('0x4')]=function(_0x124b38,_0x3664d4,_0x5bc6f5){return client[_0xcbc4('0x2')]('UpdateVoiceAgentReport',{'body':_0x124b38,'options':{'where':{'uniqueid':_0x3664d4,'interface':_0x5bc6f5,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x0042=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0042,0x139));var _0x2004=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x0042[_0xce93c];return _0x230720;};'use strict';var client=require(_0x2004('0x0'));exports[_0x2004('0x1')]=function(_0x2b9bd7){return client[_0x2004('0x2')]('CreateVoiceAgentReport',{'body':_0x2b9bd7,'log':_0x2004('0x3')});};exports[_0x2004('0x4')]=function(_0x488724,_0x225bbb,_0x2b42ce){return client['Request'](_0x2004('0x5'),{'body':_0x488724,'options':{'where':{'uniqueid':_0x225bbb,'interface':_0x2b42ce,'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 bcf71d4..d55336d 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 _0xbe83=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','Request','merge','calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0xbe83,0x129));var _0x3be8=function(_0x4f2505,_0x4b730c){_0x4f2505=_0x4f2505-0x0;var _0x3e20fc=_0xbe83[_0x4f2505];return _0x3e20fc;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require('../client');exports['create']=function(_0x110475){return client[_0x3be8('0x0')]('CreateVoiceCallReport',{'body':_[_0x3be8('0x1')](_0x110475,{'source':_0x110475[_0x3be8('0x2')],'destinationcontext':_0x110475['context'],'callerid':_0x110475[_0x3be8('0x3')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x3be8('0x4')]=function(){return function(){return client[_0x3be8('0x0')](_0x3be8('0x5'),{'options':{'where':{'type':[_0x3be8('0x6')],'createdAt':{'$between':[moment()[_0x3be8('0x7')](_0x3be8('0x8'))[_0x3be8('0x9')](_0x3be8('0xa')),moment()['endOf'](_0x3be8('0x8'))['format'](_0x3be8('0xa'))]}},'attributes':[_0x3be8('0xb'),_0x3be8('0xc'),_0x3be8('0xd'),_0x3be8('0xe')]},'log':_0x3be8('0xf')});};}; \ No newline at end of file +var _0x5f96=['context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','day','endOf','type','disposition','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x8bc41d,_0x222006){var _0x4a145c=function(_0x29dae0){while(--_0x29dae0){_0x8bc41d['push'](_0x8bc41d['shift']());}};_0x4a145c(++_0x222006);}(_0x5f96,0x16f));var _0x65f9=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5f96[_0x2dadb9];return _0x2f0097;};'use strict';var moment=require(_0x65f9('0x0'));var util=require('util');var _=require(_0x65f9('0x1'));var client=require(_0x65f9('0x2'));exports[_0x65f9('0x3')]=function(_0x18151f){return client[_0x65f9('0x4')](_0x65f9('0x5'),{'body':_[_0x65f9('0x6')](_0x18151f,{'source':_0x18151f['calleridnum'],'destinationcontext':_0x18151f[_0x65f9('0x7')],'callerid':_0x18151f[_0x65f9('0x8')],'amaflags':_0x65f9('0x9')}),'log':_0x65f9('0x5')});};exports[_0x65f9('0xa')]=function(){return function(){return client['Request'](_0x65f9('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x65f9('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x65f9('0xd')](_0x65f9('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x65f9('0xe'),_0x65f9('0xf'),'duration',_0x65f9('0x10')]},'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 4077ac9..463caf9 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 _0x39d9=['create','Request','CreateVoiceDialReport','../client'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x39d9,0x1eb));var _0x939d=function(_0xae9689,_0x4df061){_0xae9689=_0xae9689-0x0;var _0x16ee93=_0x39d9[_0xae9689];return _0x16ee93;};'use strict';var client=require(_0x939d('0x0'));exports[_0x939d('0x1')]=function(_0x98668a){return client[_0x939d('0x2')](_0x939d('0x3'),{'body':_0x98668a,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2469=['create','CreateVoiceDialReport','../client'];(function(_0x3c86c0,_0x1d3aed){var _0x601ffa=function(_0x40be9e){while(--_0x40be9e){_0x3c86c0['push'](_0x3c86c0['shift']());}};_0x601ffa(++_0x1d3aed);}(_0x2469,0x1ee));var _0x9246=function(_0x3dd7ae,_0x381f79){_0x3dd7ae=_0x3dd7ae-0x0;var _0x521f82=_0x2469[_0x3dd7ae];return _0x521f82;};'use strict';var client=require(_0x9246('0x0'));exports[_0x9246('0x1')]=function(_0x5ba920){return client['Request'](_0x9246('0x2'),{'body':_0x5ba920,'log':_0x9246('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e451015..e2f3429 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 _0xee11=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x21390e,_0x1d5444){var _0x17defd=function(_0xe0964){while(--_0xe0964){_0x21390e['push'](_0x21390e['shift']());}};_0x17defd(++_0x1d5444);}(_0xee11,0x146));var _0x1ee1=function(_0x23629f,_0x4b37fa){_0x23629f=_0x23629f-0x0;var _0x4d810a=_0xee11[_0x23629f];return _0x4d810a;};'use strict';var client=require(_0x1ee1('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x1ee1('0x1'),{'options':{'raw':!![],'attributes':['id',_0x1ee1('0x2'),_0x1ee1('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1ee1('0x4')});};}; \ No newline at end of file +var _0x559a=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x28fc66,_0x70566b){var _0x3862f4=function(_0x3064e5){while(--_0x3064e5){_0x28fc66['push'](_0x28fc66['shift']());}};_0x3862f4(++_0x70566b);}(_0x559a,0xb3));var _0xa559=function(_0x3e30cc,_0x3d68cb){_0x3e30cc=_0x3e30cc-0x0;var _0x150973=_0x559a[_0x3e30cc];return _0x150973;};'use strict';var client=require(_0xa559('0x0'));exports[_0xa559('0x1')]=function(){return function(){return client['Request'](_0xa559('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa559('0x3'),_0xa559('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa559('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 48fcfb9..08f1bb7 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 _0xe8b7=['dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Trunk','TrunkBackup','Interval','Intervals','getVoiceQueues','../client','name','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe8b7,0x65));var _0x7e8b=function(_0x147e1b,_0x184638){_0x147e1b=_0x147e1b-0x0;var _0x2fba00=_0xe8b7[_0x147e1b];return _0x2fba00;};'use strict';var client=require(_0x7e8b('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7e8b('0x1'),'acw',_0x7e8b('0x2'),'autopause',_0x7e8b('0x3'),'type',_0x7e8b('0x4'),_0x7e8b('0x5'),_0x7e8b('0x6'),_0x7e8b('0x7'),_0x7e8b('0x8'),'dialPredictiveOptimization',_0x7e8b('0x9'),_0x7e8b('0xa'),_0x7e8b('0xb'),'dialOriginateCallerIdNumber',_0x7e8b('0xc'),_0x7e8b('0xd'),_0x7e8b('0xe'),_0x7e8b('0xf'),_0x7e8b('0x10'),'dialCongestionRetryFrequency',_0x7e8b('0x11'),_0x7e8b('0x12'),_0x7e8b('0x13'),_0x7e8b('0x14'),_0x7e8b('0x15'),'dialTimezone',_0x7e8b('0x16'),_0x7e8b('0x17'),_0x7e8b('0x18'),_0x7e8b('0x19'),_0x7e8b('0x1a'),'dialAMDGreeting',_0x7e8b('0x1b'),_0x7e8b('0x1c'),_0x7e8b('0x1d'),_0x7e8b('0x1e'),_0x7e8b('0x1f'),_0x7e8b('0x20'),_0x7e8b('0x21'),_0x7e8b('0x22'),_0x7e8b('0x23'),_0x7e8b('0x24'),_0x7e8b('0x25'),_0x7e8b('0x26'),_0x7e8b('0x27'),'dialQueueProject2',_0x7e8b('0x3'),_0x7e8b('0x28'),_0x7e8b('0x29'),_0x7e8b('0x2a'),_0x7e8b('0x2b'),_0x7e8b('0x2c'),_0x7e8b('0x2d'),_0x7e8b('0x2e'),_0x7e8b('0x2f'),_0x7e8b('0x30'),'dialMachineMaxRetry',_0x7e8b('0x31'),_0x7e8b('0x32'),'dialAgentRejectRetryFrequency',_0x7e8b('0x33'),_0x7e8b('0x34'),_0x7e8b('0x35'),_0x7e8b('0x36'),_0x7e8b('0x37')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x7e8b('0x1'),_0x7e8b('0x38'),_0x7e8b('0x39')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x7e8b('0x1')]},{'model':_0x7e8b('0x3a'),'as':_0x7e8b('0x3b'),'attributes':['id',_0x7e8b('0x1'),_0x7e8b('0x38'),'active']},{'model':_0x7e8b('0x3c'),'as':_0x7e8b('0x3c'),'attributes':['id',_0x7e8b('0x1')],'include':[{'model':_0x7e8b('0x3c'),'as':_0x7e8b('0x3d'),'attributes':['id',_0x7e8b('0x1'),'interval']}]}]},'log':_0x7e8b('0x3e')});};}; \ No newline at end of file +var _0x7cfc=['getVoiceQueues','Request','GetVoiceQueue','acw','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','active','Interval','Intervals','interval'];(function(_0x2f844d,_0x354326){var _0x205d0f=function(_0x1fa550){while(--_0x1fa550){_0x2f844d['push'](_0x2f844d['shift']());}};_0x205d0f(++_0x354326);}(_0x7cfc,0x1a0));var _0xc7cf=function(_0x3dd3de,_0x54508f){_0x3dd3de=_0x3dd3de-0x0;var _0x30c8da=_0x7cfc[_0x3dd3de];return _0x30c8da;};'use strict';var client=require('../client');exports[_0xc7cf('0x0')]=function(){return function(){return client[_0xc7cf('0x1')](_0xc7cf('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xc7cf('0x3'),'acwTimeout','autopause',_0xc7cf('0x4'),_0xc7cf('0x5'),'dialActive',_0xc7cf('0x6'),_0xc7cf('0x7'),_0xc7cf('0x8'),_0xc7cf('0x9'),_0xc7cf('0xa'),'dialPredictiveOptimizationPercentage',_0xc7cf('0xb'),_0xc7cf('0xc'),_0xc7cf('0xd'),'dialOriginateTimeout','dialQueueOptions',_0xc7cf('0xe'),_0xc7cf('0xf'),_0xc7cf('0x10'),_0xc7cf('0x11'),'dialBusyMaxRetry',_0xc7cf('0x12'),_0xc7cf('0x13'),'dialNoAnswerRetryFrequency',_0xc7cf('0x14'),'dialTimezone',_0xc7cf('0x15'),_0xc7cf('0x16'),_0xc7cf('0x17'),_0xc7cf('0x18'),_0xc7cf('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0xc7cf('0x1a'),_0xc7cf('0x1b'),'dialAMDMaximumWordLength','timeout',_0xc7cf('0x1c'),_0xc7cf('0x1d'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xc7cf('0x1e'),_0xc7cf('0x1f'),_0xc7cf('0x4'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry',_0xc7cf('0x20'),'dialDropMaxRetry',_0xc7cf('0x21'),_0xc7cf('0x22'),_0xc7cf('0x23'),_0xc7cf('0x24'),_0xc7cf('0x25'),_0xc7cf('0x26'),_0xc7cf('0x27'),_0xc7cf('0x28'),'dialPredictiveIntervalMaxThreshold',_0xc7cf('0x29'),_0xc7cf('0x2a'),_0xc7cf('0x2b')],'include':[{'model':_0xc7cf('0x2c'),'as':'Trunk','attributes':['id',_0xc7cf('0x2d'),_0xc7cf('0x2e'),'active']},{'model':_0xc7cf('0x2f'),'as':'mandatoryDispositionPause','attributes':['id',_0xc7cf('0x2d')]},{'model':_0xc7cf('0x2c'),'as':'TrunkBackup','attributes':['id',_0xc7cf('0x2d'),'callerid',_0xc7cf('0x30')]},{'model':_0xc7cf('0x31'),'as':_0xc7cf('0x31'),'attributes':['id',_0xc7cf('0x2d')],'include':[{'model':_0xc7cf('0x31'),'as':_0xc7cf('0x32'),'attributes':['id','name',_0xc7cf('0x33')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ad72eb2..049b383 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(_0x3bd9e9,_0x3df6ae){var _0x52ffae=function(_0x5e55ee){while(--_0x5e55ee){_0x3bd9e9['push'](_0x3bd9e9['shift']());}};_0x52ffae(++_0x3df6ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x45f929,_0x5bae36){var _0x50c157=function(_0x5aa2de){while(--_0x5aa2de){_0x45f929['push'](_0x45f929['shift']());}};_0x50c157(++_0x5bae36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 769de93..e91af8b 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 _0xa270=['../client','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x130933,_0x29c0d7){var _0xcf661=function(_0x42267d){while(--_0x42267d){_0x130933['push'](_0x130933['shift']());}};_0xcf661(++_0x29c0d7);}(_0xa270,0x1b9));var _0x0a27=function(_0x5f1027,_0x17f3da){_0x5f1027=_0x5f1027-0x0;var _0x19ba16=_0xa270[_0x5f1027];return _0x19ba16;};'use strict';var client=require(_0x0a27('0x0'));exports['getVoiceQueueRtPauses']=function(_0x422deb){return function(){return client['Request'](_0x0a27('0x1'),{'options':{'where':{'VoiceQueueId':_0x422deb,'paused':!![]},'raw':!![]},'log':_0x0a27('0x2')});};}; \ No newline at end of file +var _0x18f2=['../client','getVoiceQueueRtPauses'];(function(_0x4532fb,_0x3638bb){var _0x272594=function(_0x317fbd){while(--_0x317fbd){_0x4532fb['push'](_0x4532fb['shift']());}};_0x272594(++_0x3638bb);}(_0x18f2,0x13e));var _0x218f=function(_0x33eef8,_0x4b1b9a){_0x33eef8=_0x33eef8-0x0;var _0x978cbd=_0x18f2[_0x33eef8];return _0x978cbd;};'use strict';var client=require(_0x218f('0x0'));exports[_0x218f('0x1')]=function(_0x40d8db){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x40d8db,'paused':!![]},'raw':!![]},'log':_0x218f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f84d0a0..bfb2f44 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x42f34c,_0xa168a1){var _0x5343cd=function(_0x5e04ae){while(--_0x5e04ae){_0x42f34c['push'](_0x42f34c['shift']());}};_0x5343cd(++_0xa168a1);}(_0x7a54,0x106));var _0x47a5=function(_0x10c468,_0x17f72a){_0x10c468=_0x10c468-0x0;var _0x7ed762=_0x7a54[_0x10c468];return _0x7ed762;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4cabd7,_0xe18b2b){var _0x296da0=function(_0xb40bf7){while(--_0xb40bf7){_0x4cabd7['push'](_0x4cabd7['shift']());}};_0x296da0(++_0xe18b2b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 807c068..7bc57e9 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 _0x602d=['result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x4d5ca7,_0x2f12e9){var _0x3d3a80=function(_0x3da673){while(--_0x3da673){_0x4d5ca7['push'](_0x4d5ca7['shift']());}};_0x3d3a80(++_0x2f12e9);}(_0x602d,0x178));var _0xd602=function(_0x1f6a39,_0x211be6){_0x1f6a39=_0x1f6a39-0x0;var _0x769d6b=_0x602d[_0x1f6a39];return _0x769d6b;};'use strict';var client=require('../client');exports[_0xd602('0x0')]={};exports[_0xd602('0x1')]=function(_0x34115a){return client[_0xd602('0x2')](_0xd602('0x3'),{'body':{'result':_0x34115a[_0xd602('0x4')],'transfererchannel':_0x34115a[_0xd602('0x5')],'transferercalleridnum':_0x34115a['transferercalleridnum'],'transferercalleridname':_0x34115a['transferercalleridname'],'transfererconnectedlinenum':_0x34115a[_0xd602('0x6')],'transfererconnectedlinename':_0x34115a[_0xd602('0x7')],'transfereraccountcode':_0x34115a['transfereraccountcode'],'transferercontext':_0x34115a[_0xd602('0x8')],'transfererexten':_0x34115a[_0xd602('0x9')],'transfererlinkedid':_0x34115a[_0xd602('0xa')],'transfereechannel':_0x34115a[_0xd602('0xb')],'transfereecalleridnum':_0x34115a[_0xd602('0xc')],'transfereecalleridname':_0x34115a['transfereecalleridname'],'transfereeconnectedlinenum':_0x34115a[_0xd602('0xd')],'transfereeconnectedlinename':_0x34115a[_0xd602('0xe')],'transfereeaccountcode':_0x34115a[_0xd602('0xf')],'transfereecontext':_0x34115a['transfereecontext'],'transfereeexten':_0x34115a[_0xd602('0x10')],'transfereelinkedid':_0x34115a[_0xd602('0x11')],'isexternal':_0x34115a[_0xd602('0x12')],'context':_0x34115a[_0xd602('0x13')],'extension':_0x34115a[_0xd602('0x14')],'type':_0xd602('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0xd602('0x16')]=function(_0x5ebf9b){return client[_0xd602('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x5ebf9b[_0xd602('0x4')],'transfererchannel':_0x5ebf9b[_0xd602('0x17')],'transferercalleridnum':_0x5ebf9b['origtransferercalleridnum'],'transferercalleridname':_0x5ebf9b[_0xd602('0x18')],'transfererconnectedlinenum':_0x5ebf9b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5ebf9b[_0xd602('0x19')],'transfereraccountcode':_0x5ebf9b[_0xd602('0x1a')],'transferercontext':_0x5ebf9b[_0xd602('0x1b')],'transfererexten':_0x5ebf9b[_0xd602('0x1c')],'transfererlinkedid':_0x5ebf9b['origtransfererlinkedid'],'transfereechannel':_0x5ebf9b['transfertargetchannel'],'transfereecalleridnum':_0x5ebf9b['transfertargetcalleridnum'],'transfereecalleridname':_0x5ebf9b[_0xd602('0x1d')],'transfereeconnectedlinenum':_0x5ebf9b[_0xd602('0x1e')],'transfereeconnectedlinename':_0x5ebf9b[_0xd602('0x1f')],'transfereeaccountcode':_0x5ebf9b[_0xd602('0x20')],'transfereecontext':_0x5ebf9b['transfertargetcontext'],'transfereeexten':_0x5ebf9b[_0xd602('0x21')],'transfereelinkedid':_0x5ebf9b[_0xd602('0x22')],'isexternal':_0x5ebf9b[_0xd602('0x12')],'context':_0x5ebf9b[_0xd602('0x23')],'extension':_0x5ebf9b[_0xd602('0x24')],'type':_0xd602('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xeedb=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransfererexten'];(function(_0x43df04,_0x5bdb30){var _0x13708e=function(_0x3803a5){while(--_0x3803a5){_0x43df04['push'](_0x43df04['shift']());}};_0x13708e(++_0x5bdb30);}(_0xeedb,0x7c));var _0xbeed=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xeedb[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0xbeed('0x0'));exports['transfers']={};exports[_0xbeed('0x1')]=function(_0x14398a){return client[_0xbeed('0x2')](_0xbeed('0x3'),{'body':{'result':_0x14398a['result'],'transfererchannel':_0x14398a[_0xbeed('0x4')],'transferercalleridnum':_0x14398a['transferercalleridnum'],'transferercalleridname':_0x14398a[_0xbeed('0x5')],'transfererconnectedlinenum':_0x14398a[_0xbeed('0x6')],'transfererconnectedlinename':_0x14398a[_0xbeed('0x7')],'transfereraccountcode':_0x14398a['transfereraccountcode'],'transferercontext':_0x14398a[_0xbeed('0x8')],'transfererexten':_0x14398a[_0xbeed('0x9')],'transfererlinkedid':_0x14398a[_0xbeed('0xa')],'transfereechannel':_0x14398a[_0xbeed('0xb')],'transfereecalleridnum':_0x14398a[_0xbeed('0xc')],'transfereecalleridname':_0x14398a[_0xbeed('0xd')],'transfereeconnectedlinenum':_0x14398a[_0xbeed('0xe')],'transfereeconnectedlinename':_0x14398a[_0xbeed('0xf')],'transfereeaccountcode':_0x14398a['transfereeaccountcode'],'transfereecontext':_0x14398a[_0xbeed('0x10')],'transfereeexten':_0x14398a[_0xbeed('0x11')],'transfereelinkedid':_0x14398a[_0xbeed('0x12')],'isexternal':_0x14398a['isexternal'],'context':_0x14398a[_0xbeed('0x13')],'extension':_0x14398a['extension'],'type':'blind'},'log':_0xbeed('0x3')});};exports[_0xbeed('0x14')]=function(_0x1fae19){return client[_0xbeed('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x1fae19[_0xbeed('0x15')],'transfererchannel':_0x1fae19[_0xbeed('0x16')],'transferercalleridnum':_0x1fae19[_0xbeed('0x17')],'transferercalleridname':_0x1fae19[_0xbeed('0x18')],'transfererconnectedlinenum':_0x1fae19[_0xbeed('0x19')],'transfererconnectedlinename':_0x1fae19[_0xbeed('0x1a')],'transfereraccountcode':_0x1fae19[_0xbeed('0x1b')],'transferercontext':_0x1fae19['secondtransferercontext'],'transfererexten':_0x1fae19[_0xbeed('0x1c')],'transfererlinkedid':_0x1fae19[_0xbeed('0x1d')],'transfereechannel':_0x1fae19[_0xbeed('0x1e')],'transfereecalleridnum':_0x1fae19[_0xbeed('0x1f')],'transfereecalleridname':_0x1fae19[_0xbeed('0x20')],'transfereeconnectedlinenum':_0x1fae19[_0xbeed('0x21')],'transfereeconnectedlinename':_0x1fae19[_0xbeed('0x22')],'transfereeaccountcode':_0x1fae19[_0xbeed('0x23')],'transfereecontext':_0x1fae19[_0xbeed('0x24')],'transfereeexten':_0x1fae19[_0xbeed('0x25')],'transfereelinkedid':_0x1fae19['transfertargetlinkedid'],'isexternal':_0x1fae19[_0xbeed('0x26')],'context':_0x1fae19['origtransferercontext'],'extension':_0x1fae19[_0xbeed('0x27')],'type':_0xbeed('0x28')},'log':_0xbeed('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5108d6d..b4f53cf 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x493eb0,_0x408801){var _0x96b589=function(_0x432fc6){while(--_0x432fc6){_0x493eb0['push'](_0x493eb0['shift']());}};_0x96b589(++_0x408801);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fa8ee,_0x3b350d){_0x3fa8ee=_0x3fa8ee-0x0;var _0x36a857=_0xb10b[_0x3fa8ee];return _0x36a857;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x16baf9,_0x113fc3){var _0x5b157f=function(_0x18d2b8){while(--_0x18d2b8){_0x16baf9['push'](_0x16baf9['shift']());}};_0x5b157f(++_0x113fc3);}(_0x7a54,0x106));var _0x47a5=function(_0x401507,_0x58a2d0){_0x401507=_0x401507-0x0;var _0x871dd7=_0x7a54[_0x401507];return _0x871dd7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 82289e0..b2ee2d5 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 _0x3989=['data2','isNil','data5','ListId','data3','split','phone','destcalleridnum','calleridnum','routeId','firstName','lastName','createdAt','scheduledAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','emit','data1'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3989,0x85));var _0x9398=function(_0x1b7d9a,_0x1dd4f4){_0x1b7d9a=_0x1b7d9a-0x0;var _0x247195=_0x3989[_0x1b7d9a];return _0x247195;};'use strict';var _=require(_0x9398('0x0'));var BPromise=require(_0x9398('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x9398('0x2'));var logger=require(_0x9398('0x3'))(_0x9398('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x9398('0x5')]=_[_0x9398('0x6')](config[_0x9398('0x5')],{'host':_0x9398('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9398('0x5')]));function emit(_0xcf471,_0x5586dd,_0x28f27f,_0xd12639,_0x281e97){logger[_0x9398('0x8')]('[CM][%s][%s]',_0xcf471,_0x5586dd['id'],_0x28f27f,_0xd12639,JSON['stringify'](_0x281e97));io['to'](_0x28f27f)[_0x9398('0x9')](_0xd12639,_0x281e97);}exports['exec']=function(_0x5ed325,_0x452c78,_0x3dce87,_0x519e17){var _0x4303fc,_0x53a450;var _0x2926ed={};var _0x160d71;var _0x6646db=Number(_0x3dce87[_0x9398('0xa')]);var _0x2c4da9=_0x3dce87[_0x9398('0xb')]?Boolean(Number(_0x3dce87['data2'])):![];var _0xeb1697;var _0x53049a=![];if(!_[_0x9398('0xc')](_0x3dce87['data5'])){if(_0x3dce87[_0x9398('0xd')]=='1')_0x53049a=!![];}if(!_0x53049a){if(_0x519e17['xmd-contactid']){_0x2926ed['id']=_0x519e17['xmd-contactid'];}}if(!_0x2926ed['id']){_0x2926ed[_0x9398('0xe')]=_0x6646db;_0xeb1697=_0x3dce87[_0x9398('0xf')]&&_0x3dce87['data3']!=='0'?_0x3dce87[_0x9398('0xf')][_0x9398('0x10')](','):[_0x9398('0x11')];_0x2926ed['$or']=_['map'](_0xeb1697,function(_0x192320){var _0x305f54={};_0x305f54[_0x192320]=_0x519e17['routeId']?_0x519e17[_0x9398('0x12')]:_0x519e17[_0x9398('0x13')];return _0x305f54;});_0x160d71=_0x519e17[_0x9398('0x14')]?_0x519e17[_0x9398('0x12')]:_0x519e17[_0x9398('0x13')];}var _0xe5fc35=['id',_0x9398('0x15'),_0x9398('0x16'),_0x9398('0x11'),'mobile','fax',_0x9398('0xe'),_0x9398('0x17'),_0x9398('0x18'),'updatedAt'];var _0xe0823c=_[_0x9398('0x19')](_0xe5fc35,_0xeb1697);BPromise[_0x9398('0x1a')]()[_0x9398('0x1b')](cmContactRpc[_0x9398('0x1c')]({'attributes':_0xe0823c,'where':_0x2926ed,'phone':_0x160d71}))[_0x9398('0x1b')](function(_0x5d24dc){_0x53a450=_0x5d24dc;if(!_['isEmpty'](_0x53a450)){if(_0x53a450[_0x9398('0x1d')]===0x1){_0x4303fc=_0x53a450[0x0];logger['info'](_0x9398('0x1e'),_0x519e17[_0x9398('0x1f')],_0x452c78['id'],_0x4303fc['id']);}else{logger[_0x9398('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x519e17[_0x9398('0x1f')],_0x452c78['id'],_[_0x9398('0x20')](_0x53a450,'id')[_0x9398('0x21')](','));}return;}else{logger[_0x9398('0x8')](_0x9398('0x22'),_0x519e17[_0x9398('0x1f')],_0x452c78['id']);var _0x55233d={'ListId':_0x6646db};var _0x45c8db=_0x3dce87[_0x9398('0x23')]&&_0x3dce87[_0x9398('0x23')]!=='0'?_0x3dce87[_0x9398('0x23')]:_0x9398('0x11');if(_0x2c4da9){logger[_0x9398('0x8')](_0x9398('0x24'),_0x519e17[_0x9398('0x1f')],_0x452c78['id']);_0x55233d[_0x45c8db]=_[_0x9398('0xc')](_0x519e17['routeId'])?_0x519e17[_0x9398('0x13')]:_0x519e17[_0x9398('0x12')];if(_[_0x9398('0xc')](_0x519e17[_0x9398('0x14')])){_0x55233d['firstName']=_0x519e17[_0x9398('0x25')]&&_0x519e17[_0x9398('0x25')]!==''?_0x519e17[_0x9398('0x25')]:_0x9398('0x26');}else{_0x55233d[_0x9398('0x15')]=_0x519e17[_0x9398('0x27')]&&_0x519e17[_0x9398('0x27')]!==''?_0x519e17[_0x9398('0x27')]:'Unknown';}return BPromise[_0x9398('0x1a')]()[_0x9398('0x1b')](cmContactRpc[_0x9398('0x28')](_0x55233d))[_0x9398('0x1b')](function(_0x50f8be){_0x4303fc=_0x50f8be;_0x53a450['push'](_0x50f8be);if(_0x4303fc){logger['info'](_0x9398('0x29'),_0x519e17[_0x9398('0x1f')],_0x452c78['id'],_0x4303fc['id']);}return;});}else{logger[_0x9398('0x8')](_0x9398('0x2a'),_0x519e17[_0x9398('0x1f')],_0x452c78['id']);_0x55233d[_0x45c8db]=_[_0x9398('0xc')](_0x519e17['routeId'])?_0x519e17[_0x9398('0x13')]:_0x519e17['destcalleridnum'];if(_[_0x9398('0xc')](_0x519e17['routeId'])){_0x55233d[_0x9398('0x15')]=_0x519e17[_0x9398('0x25')]&&_0x519e17['calleridname']!==_0x9398('0x2b')?_0x519e17[_0x9398('0x25')]:'Unknown';}else{_0x55233d[_0x9398('0x15')]=_0x519e17[_0x9398('0x27')]&&_0x519e17['destcalleridname']!==_0x9398('0x2b')?_0x519e17[_0x9398('0x27')]:_0x9398('0x26');}_0x4303fc=_0x55233d;_0x53a450['push'](_0x55233d);return;}}})[_0x9398('0x1b')](function(){if(_0x5ed325){emit(_0x519e17[_0x9398('0x1f')],_0x452c78,util[_0x9398('0x2c')](_0x9398('0x2d'),_0x5ed325[_0x9398('0x2e')]),util['format'](_0x9398('0x2f'),_0x3dce87['action']['toLowerCase']()),{'evt':_['merge'](_0x519e17,{'autoCreate':_0x2c4da9}),'contact':_0x4303fc===undefined?{}:_0x4303fc,'contacts':_0x53a450['length']===0x0?undefined:_0x53a450});}});}; \ No newline at end of file +var _0x3eaf=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','data3','split','$or','map','destcalleridnum','calleridnum','routeId','lastName','phone','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0x2f4f25,_0x592d31){var _0x6a112a=function(_0x112d68){while(--_0x112d68){_0x2f4f25['push'](_0x2f4f25['shift']());}};_0x6a112a(++_0x592d31);}(_0x3eaf,0x190));var _0xf3ea=function(_0x26377f,_0xc9e1e){_0x26377f=_0x26377f-0x0;var _0x3874a4=_0x3eaf[_0x26377f];return _0x3874a4;};'use strict';var _=require(_0xf3ea('0x0'));var BPromise=require(_0xf3ea('0x1'));var Redis=require(_0xf3ea('0x2'));var util=require(_0xf3ea('0x3'));var config=require(_0xf3ea('0x4'));var logger=require(_0xf3ea('0x5'))('trigger');var cmContactRpc=require(_0xf3ea('0x6'));config[_0xf3ea('0x7')]=_[_0xf3ea('0x8')](config['redis'],{'host':_0xf3ea('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf3ea('0x7')]));function emit(_0x1ac6bd,_0x1708c3,_0x526b29,_0x1819bc,_0x5517ad){logger[_0xf3ea('0xa')](_0xf3ea('0xb'),_0x1ac6bd,_0x1708c3['id'],_0x526b29,_0x1819bc,JSON['stringify'](_0x5517ad));io['to'](_0x526b29)[_0xf3ea('0xc')](_0x1819bc,_0x5517ad);}exports['exec']=function(_0x21a505,_0x1f2825,_0x585092,_0x53e151){var _0x224f16,_0x446f7c;var _0x139bec={};var _0x4c349b;var _0xf9e80c=Number(_0x585092[_0xf3ea('0xd')]);var _0x146c8a=_0x585092['data2']?Boolean(Number(_0x585092[_0xf3ea('0xe')])):![];var _0xeca727;var _0x35d3a8=![];if(!_[_0xf3ea('0xf')](_0x585092[_0xf3ea('0x10')])){if(_0x585092[_0xf3ea('0x10')]=='1')_0x35d3a8=!![];}if(!_0x35d3a8){if(_0x53e151[_0xf3ea('0x11')]){_0x139bec['id']=_0x53e151[_0xf3ea('0x11')];}}if(!_0x139bec['id']){_0x139bec['ListId']=_0xf9e80c;_0xeca727=_0x585092[_0xf3ea('0x12')]&&_0x585092['data3']!=='0'?_0x585092[_0xf3ea('0x12')][_0xf3ea('0x13')](','):['phone'];_0x139bec[_0xf3ea('0x14')]=_[_0xf3ea('0x15')](_0xeca727,function(_0x24f0ac){var _0x1a4da4={};_0x1a4da4[_0x24f0ac]=_0x53e151['routeId']?_0x53e151[_0xf3ea('0x16')]:_0x53e151[_0xf3ea('0x17')];return _0x1a4da4;});_0x4c349b=_0x53e151[_0xf3ea('0x18')]?_0x53e151[_0xf3ea('0x16')]:_0x53e151[_0xf3ea('0x17')];}var _0x4fb6c0=['id','firstName',_0xf3ea('0x19'),_0xf3ea('0x1a'),'mobile',_0xf3ea('0x1b'),_0xf3ea('0x1c'),_0xf3ea('0x1d'),_0xf3ea('0x1e'),_0xf3ea('0x1f')];var _0xa52ae=_[_0xf3ea('0x20')](_0x4fb6c0,_0xeca727);BPromise[_0xf3ea('0x21')]()[_0xf3ea('0x22')](cmContactRpc[_0xf3ea('0x23')]({'attributes':_0xa52ae,'where':_0x139bec,'phone':_0x4c349b}))[_0xf3ea('0x22')](function(_0x591fca){_0x446f7c=_0x591fca;if(!_[_0xf3ea('0x24')](_0x446f7c)){if(_0x446f7c[_0xf3ea('0x25')]===0x1){_0x224f16=_0x446f7c[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x53e151['uniqueid'],_0x1f2825['id'],_0x224f16['id']);}else{logger[_0xf3ea('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x53e151[_0xf3ea('0x26')],_0x1f2825['id'],_[_0xf3ea('0x15')](_0x446f7c,'id')['join'](','));}return;}else{logger[_0xf3ea('0xa')](_0xf3ea('0x27'),_0x53e151[_0xf3ea('0x26')],_0x1f2825['id']);var _0x4c29cc={'ListId':_0xf9e80c};var _0x146e33=_0x585092['data4']&&_0x585092['data4']!=='0'?_0x585092['data4']:'phone';if(_0x146c8a){logger[_0xf3ea('0xa')](_0xf3ea('0x28'),_0x53e151[_0xf3ea('0x26')],_0x1f2825['id']);_0x4c29cc[_0x146e33]=_[_0xf3ea('0xf')](_0x53e151[_0xf3ea('0x18')])?_0x53e151[_0xf3ea('0x17')]:_0x53e151[_0xf3ea('0x16')];if(_[_0xf3ea('0xf')](_0x53e151['routeId'])){_0x4c29cc[_0xf3ea('0x29')]=_0x53e151[_0xf3ea('0x2a')]&&_0x53e151[_0xf3ea('0x2a')]!==_0xf3ea('0x2b')?_0x53e151[_0xf3ea('0x2a')]:_0xf3ea('0x2c');}else{_0x4c29cc[_0xf3ea('0x29')]=_0x53e151[_0xf3ea('0x2d')]&&_0x53e151[_0xf3ea('0x2d')]!==_0xf3ea('0x2b')?_0x53e151['destcalleridname']:'Unknown';}return BPromise[_0xf3ea('0x21')]()[_0xf3ea('0x22')](cmContactRpc[_0xf3ea('0x2e')](_0x4c29cc))[_0xf3ea('0x22')](function(_0x3c4b20){_0x224f16=_0x3c4b20;_0x446f7c[_0xf3ea('0x2f')](_0x3c4b20);if(_0x224f16){logger[_0xf3ea('0xa')](_0xf3ea('0x30'),_0x53e151[_0xf3ea('0x26')],_0x1f2825['id'],_0x224f16['id']);}return;});}else{logger['info'](_0xf3ea('0x31'),_0x53e151[_0xf3ea('0x26')],_0x1f2825['id']);_0x4c29cc[_0x146e33]=_[_0xf3ea('0xf')](_0x53e151[_0xf3ea('0x18')])?_0x53e151[_0xf3ea('0x17')]:_0x53e151[_0xf3ea('0x16')];if(_[_0xf3ea('0xf')](_0x53e151[_0xf3ea('0x18')])){_0x4c29cc[_0xf3ea('0x29')]=_0x53e151[_0xf3ea('0x2a')]&&_0x53e151[_0xf3ea('0x2a')]!==_0xf3ea('0x2b')?_0x53e151[_0xf3ea('0x2a')]:_0xf3ea('0x2c');}else{_0x4c29cc[_0xf3ea('0x29')]=_0x53e151['destcalleridname']&&_0x53e151['destcalleridname']!==_0xf3ea('0x2b')?_0x53e151[_0xf3ea('0x2d')]:_0xf3ea('0x2c');}_0x224f16=_0x4c29cc;_0x446f7c['push'](_0x4c29cc);return;}}})[_0xf3ea('0x22')](function(){if(_0x21a505){emit(_0x53e151['uniqueid'],_0x1f2825,util[_0xf3ea('0x32')]('user:%s',_0x21a505[_0xf3ea('0x33')]),util['format'](_0xf3ea('0x34'),_0x585092[_0xf3ea('0x35')][_0xf3ea('0x36')]()),{'evt':_[_0xf3ea('0x37')](_0x53e151,{'autoCreate':_0x146c8a}),'contact':_0x224f16===undefined?{}:_0x224f16,'contacts':_0x446f7c[_0xf3ea('0x25')]===0x0?undefined:_0x446f7c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 38e7a0a..7387593 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 _0xa72d=['uri','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','600','data6','winapp','winArguments','format','user:%s','trigger:%s:%s','name','trigger:%s','action','exec','integration','queue','routeId','urlforward','script','parse','search','AllConditions','length','every','checkConditions','AnyConditions','some','channel','debug','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','util','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','render'];(function(_0x5f5b26,_0x580d94){var _0x25fcb4=function(_0xcec2ae){while(--_0xcec2ae){_0x5f5b26['push'](_0x5f5b26['shift']());}};_0x25fcb4(++_0x580d94);}(_0xa72d,0x1bf));var _0xda72=function(_0x4c152d,_0x5386de){_0x4c152d=_0x4c152d-0x0;var _0x4e6ee7=_0xa72d[_0x4c152d];return _0x4e6ee7;};'use strict';var util=require(_0xda72('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0xda72('0x1'));var Redis=require(_0xda72('0x2'));var urlforward=require(_0xda72('0x3'));var integration=require(_0xda72('0x4'));var cmContact=require(_0xda72('0x5'));var script=require(_0xda72('0x6'));var config=require(_0xda72('0x7'));var logger=require(_0xda72('0x8'))('trigger');var ami=require(_0xda72('0x9'));config[_0xda72('0xa')]=_[_0xda72('0xb')](config['redis'],{'host':_0xda72('0xc'),'port':0x18eb});var io=require(_0xda72('0xd'))(new Redis(config[_0xda72('0xa')]));var operators={'equals':function(_0x3aa316,_0x3c893d){return _0x3aa316==_0x3c893d;},'not_equals':function(_0x40e9eb,_0x261f98){return _0x40e9eb!=_0x261f98;}};var barAndWebActions=[_0xda72('0xe'),_0xda72('0xf'),'winapp'];function Trigger(_0x531bd2){this[_0xda72('0x10')]=_0x531bd2['triggers'];this['agents']=_0x531bd2[_0xda72('0x11')];this[_0xda72('0x12')]=_0x531bd2['voiceQueues'];this[_0xda72('0x13')]=_0x531bd2[_0xda72('0x13')];this[_0xda72('0x14')]=_0x531bd2[_0xda72('0x14')];this[_0xda72('0x15')]=_0x531bd2['zendeskAccounts'];this[_0xda72('0x16')]=_0x531bd2[_0xda72('0x16')];this[_0xda72('0x17')]=_0x531bd2[_0xda72('0x17')];this[_0xda72('0x18')]=_0x531bd2[_0xda72('0x18')];this[_0xda72('0x19')]=_0x531bd2[_0xda72('0x19')];this['deskAccounts']=_0x531bd2['deskAccounts'];this[_0xda72('0x1a')]=_0x531bd2[_0xda72('0x1a')];this[_0xda72('0x1b')]=_0x531bd2[_0xda72('0x1b')];this[_0xda72('0x1c')]=_0x531bd2[_0xda72('0x1c')];this['freshsalesAccounts']=_0x531bd2[_0xda72('0x1d')];this[_0xda72('0x1e')]={'zendesk':this[_0xda72('0x15')],'salesforce':this[_0xda72('0x17')],'freshdesk':this[_0xda72('0x16')],'sugarcrm':this[_0xda72('0x18')],'zoho':this[_0xda72('0x19')],'desk':this['deskAccounts'],'vtiger':this[_0xda72('0x1a')],'dynamics365':this[_0xda72('0x1c')],'freshsales':this[_0xda72('0x1d')],'servicenow':this[_0xda72('0x1b')]};ami['on']('custom:agentcalled',this[_0xda72('0x1f')]['bind'](this));ami['on'](_0xda72('0x20'),this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on'](_0xda72('0x22'),this[_0xda72('0x1f')]['bind'](this));ami['on'](_0xda72('0x23'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on'](_0xda72('0x24'),this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on'](_0xda72('0x25'),this['syncCustomEvent'][_0xda72('0x21')](this));ami['on'](_0xda72('0x26'),this['syncCustomEvent'][_0xda72('0x21')](this));ami['on'](_0xda72('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xda72('0x28'),this[_0xda72('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xda72('0x21')](this));ami['on'](_0xda72('0x29'),this[_0xda72('0x2a')][_0xda72('0x21')](this));ami['on'](_0xda72('0x2b'),this['syncAgentDial'][_0xda72('0x21')](this));ami['on'](_0xda72('0x2c'),this[_0xda72('0x2a')][_0xda72('0x21')](this));ami['on'](_0xda72('0x2d'),this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on']('custom:closedinteraction',this[_0xda72('0x1f')]['bind'](this));ami['on']('custom:substatus',this[_0xda72('0x1f')]['bind'](this));ami['on'](_0xda72('0x2e'),this['syncCustomEvent'][_0xda72('0x21')](this));ami['on']('custom:outgoingmessage',this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on'](_0xda72('0x2f'),this[_0xda72('0x1f')][_0xda72('0x21')](this));ami['on'](_0xda72('0x30'),this['syncCustomEvent'][_0xda72('0x21')](this));ami['on']('custom:offlineMessage',this[_0xda72('0x1f')][_0xda72('0x21')](this));}Trigger[_0xda72('0x31')]['emit']=function(_0x1ee1da,_0xed479a,_0x2ccbb5){logger[_0xda72('0x32')](_0x1ee1da,_0xed479a,JSON[_0xda72('0x33')](_0x2ccbb5));io['to'](_0x1ee1da)[_0xda72('0x34')](_0xed479a,_0x2ccbb5);};Trigger[_0xda72('0x31')][_0xda72('0x1f')]=function(_0x529139){var _0x4d3aee=_[_0xda72('0x35')](_0x529139);if(typeof _0x4d3aee[_0xda72('0x36')]===_0xda72('0x37')){_0x4d3aee[_0xda72('0x36')]=_0xda72('0x38');}logger['debug']('syncCustomEvent',util[_0xda72('0x39')](_0x4d3aee,{'showHidden':!![],'depth':null}));this[_0xda72('0x3a')](_0x4d3aee);};Trigger[_0xda72('0x31')][_0xda72('0x2a')]=function(_0x422b76){if(this[_0xda72('0x11')][_0x422b76[_0xda72('0x3b')]]){this[_0xda72('0x1f')](_0x422b76);}};Trigger[_0xda72('0x31')]['checkTriggers']=function(_0x525d59){var _0x5a12b2;for(var _0x2a4dea in this[_0xda72('0x10')]){if(this[_0xda72('0x10')][_0xda72('0x3c')](_0x2a4dea)){if(this['triggers'][_0x2a4dea]['status']){_0x5a12b2=this[_0xda72('0x3d')](this[_0xda72('0x10')][_0x2a4dea],_0x525d59);if(_0x5a12b2){_[_0xda72('0x3e')](_0x525d59,_0x525d59[_0xda72('0x3f')]);for(var _0x4e59f6=0x0,_0x20c995,_0x4990c4,_0xcb2e2f;_0x4e59f60x0){_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(_0xa39de9,_0x26eee4){_0xa39de9=_0xa39de9-0x0;var _0x2421fe=_0xe14b[_0xa39de9];return _0x2421fe;};'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 a6c5a09..fc66eb6 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 _0x3486=['nameField','indexOf','content','ticketType','incident','assign','getString','Subjects','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','Descriptions','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','contacts','userId','Bearer\x20','body','substring','lastIndexOf','calleridnum','\x20eq\x20\x27','%2b','value','contactid','nothing',']\x20Enduser\x20created!','enduserId','forEach','includes','string','picklist'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3486,0x1e5));var _0x6348=function(_0x5253c3,_0x3e4a0a){_0x5253c3=_0x5253c3-0x0;var _0x3c3917=_0x3486[_0x5253c3];return _0x3c3917;};'use strict';var _=require(_0x6348('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x6348('0x1'));var md5=require(_0x6348('0x2'));var Redis=require(_0x6348('0x3'));var logger=require(_0x6348('0x4'))(_0x6348('0x5'));var config=require(_0x6348('0x6'));config[_0x6348('0x7')]=_[_0x6348('0x8')](config['redis'],{'host':_0x6348('0x9'),'port':0x18eb});var io=require(_0x6348('0xa'))(new Redis(config[_0x6348('0x7')]));function getAuthToken(_0x1152c0,_0x5d74b2,_0xddab37){if(_0x1152c0[_0x6348('0xb')]){_0x1152c0[_0x6348('0xc')]=_0x1152c0[_0x6348('0xd')][_0x6348('0xe')];_0x1152c0[_0x6348('0xf')]=_0x1152c0[_0x6348('0xd')][_0x6348('0x10')];return Promise[_0x6348('0x11')](_0x1152c0[_0x6348('0xd')][_0x6348('0x12')]);}var _0x5ae381={'method':_0x6348('0x13'),'uri':_0x5d74b2,'form':{'client_id':_0x1152c0[_0x6348('0x14')],'resource':_0x1152c0[_0x6348('0xc')],'username':_0x1152c0[_0x6348('0x15')],'password':_0x1152c0['password'],'grant_type':_0x6348('0x16'),'client_secret':_0x1152c0[_0x6348('0x17')]},'json':!![]};return rp(_0x5ae381)[_0x6348('0x18')](function(_0x5a36c3){return _0x5a36c3['access_token'];})[_0x6348('0x19')](function(_0x597e0d){logger[_0x6348('0x1a')]('['+[_0xddab37[_0x6348('0x1b')]()]+_0x6348('0x1c'));return _0x597e0d[_0x6348('0x1d')];});}function getUser(_0x25f303,_0x40ceed,_0x556ecb,_0x32248b,_0x47fc8e,_0x3a91cc){return new Promise(function(_0x488222,_0x3042ab){return getAuthToken(_0x40ceed,_0x32248b,_0x3a91cc)[_0x6348('0x18')](function(_0x29f9ac){var _0x2cc3e0={'method':_0x6348('0x1e'),'uri':_0x47fc8e+_0x6348('0x1f'),'headers':{'Authorization':'Bearer\x20'+_0x29f9ac,'OData-Version':_0x6348('0x20')},'json':!![]};return rp(_0x2cc3e0);})[_0x6348('0x18')](function(_0x196116){var _0xc9b449=_0x196116['value'];var _0x4b9bb1=![];var _0x3d4b0c=null;if(!_[_0x6348('0x21')](_0x556ecb)){if(intUtil[_0x6348('0x22')](_0x556ecb['email'])){_0x25f303[_0x6348('0x23')]=_0x556ecb[_0x6348('0x24')];for(_0x3d4b0c=0x0;_0x3d4b0c<_0xc9b449[_0x6348('0x25')];_0x3d4b0c++){if(_0xc9b449[_0x3d4b0c][_0x6348('0x26')]===_0x556ecb[_0x6348('0x24')]&&!_0xc9b449[_0x3d4b0c][_0x6348('0x27')]){_0x4b9bb1=!![];logger[_0x6348('0x28')]('['+[_0x3a91cc['toUpperCase']()]+_0x6348('0x29')+_0xc9b449[_0x3d4b0c][_0x6348('0x2a')]+'!');_0x25f303['userId']=_0xc9b449[_0x3d4b0c][_0x6348('0x2a')];}}}}if(!_0x4b9bb1){logger[_0x6348('0x28')]('['+[_0x3a91cc[_0x6348('0x1b')]()]+_0x6348('0x2b'));_0x25f303['userEmail']=_0x40ceed['username'];for(_0x3d4b0c=0x0;_0x3d4b0c<_0xc9b449['length'];_0x3d4b0c++){if(_0xc9b449[_0x3d4b0c][_0x6348('0x26')]===_0x40ceed['username']){_0x25f303['userId']=_0xc9b449[_0x3d4b0c][_0x6348('0x2a')];}}}_0x488222(_0x25f303);})[_0x6348('0x19')](function(_0x4d2280){_0x3042ab(_0x4d2280[_0x6348('0x1d')]);});});}function createEndUser(_0x2a4ef4,_0x2f1c77,_0xf653a4,_0x3325fa,_0x37d005,_0x591d82,_0x2e4e86){return new Promise(function(_0x94cc02,_0x4f0de2){return getAuthToken(_0x2f1c77,_0xf653a4,_0x591d82)[_0x6348('0x18')](function(_0x473010){var _0x13af7e=_0x591d82[_0x6348('0x2c')]()===_0x6348('0x2d')?_0x37d005[_0x6348('0x2e')]:_0x37d005['calleridnum'];var _0x2ea586={'method':'POST','uri':_0x3325fa+_0x6348('0x2f'),'body':{'fullname':_0x13af7e,'firstname':_0x13af7e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2a4ef4[_0x6348('0x30')]+')'},'headers':{'Authorization':_0x6348('0x31')+_0x473010,'OData-Version':_0x6348('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x2ea586[_0x6348('0x32')][_0x2e4e86]=_0x13af7e;return rp(_0x2ea586);})[_0x6348('0x18')](function(_0x119765){var _0x357e11=_0x119765['headers']['odata-entityid'];var _0x3aa857=_0x357e11[_0x6348('0x33')](_0x357e11[_0x6348('0x34')]('(')+0x1,_0x357e11[_0x6348('0x34')](')'));_0x2a4ef4['enduserId']=_0x3aa857;_0x94cc02(_0x2a4ef4);})['catch'](function(_0x431e7e){_0x4f0de2(_0x431e7e[_0x6348('0x1d')]);});});}function getEndUser(_0x1d96cb,_0x4ffc2f,_0x57d72c,_0x5cdaa6,_0x394b0a,_0x1bc09c,_0x279cd0,_0x39de0e){var _0x103014=_0x1bc09c['toLowerCase']()===_0x6348('0x2d')?_0x394b0a[_0x6348('0x2e')]:_0x394b0a[_0x6348('0x35')];return getAuthToken(_0x4ffc2f,_0x57d72c,_0x1bc09c)[_0x6348('0x18')](function(_0x36efc9){_0x39de0e=_0x39de0e?_0x39de0e:'telephone1';var _0xd411c0={'method':'GET','uri':_0x5cdaa6+'contacts?$select='+_0x39de0e+'&$filter='+_0x39de0e+_0x6348('0x36')+_0x103014['replace']('+',_0x6348('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x36efc9,'If-None-Match':null,'OData-Version':_0x6348('0x20')},'json':!![]};return rp(_0xd411c0);})[_0x6348('0x18')](function(_0x1a48eb){var _0x47988a=![];if(!_0x1a48eb)return _0x47988a;var _0x54015c=_0x1a48eb[_0x6348('0x38')];for(var _0x2ace94=0x0;_0x2ace94<_0x54015c[_0x6348('0x25')];_0x2ace94++){if(_0x54015c[_0x2ace94][_0x39de0e]===_0x103014){_0x47988a=!![];_0x1d96cb['enduserId']=_0x54015c[_0x2ace94][_0x6348('0x39')];}}return _0x47988a;})[_0x6348('0x18')](function(_0x29a9cb){if(_0x29a9cb)return _0x1d96cb;if(_0x279cd0===_0x6348('0x3a')){logger[_0x6348('0x28')]('['+[_0x1bc09c[_0x6348('0x1b')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1d96cb;}return createEndUser(_0x1d96cb,_0x4ffc2f,_0x57d72c,_0x5cdaa6,_0x394b0a,_0x1bc09c,_0x39de0e)['then'](function(_0x174e83){logger[_0x6348('0x28')]('['+[_0x1bc09c[_0x6348('0x1b')]()]+_0x6348('0x3b'),_0x174e83[_0x6348('0x3c')]);return _0x174e83;});});}function getCustomFields(_0xe999a5,_0x98005e,_0x3587bc){var _0x59ef3e={};if(_0xe999a5[_0x6348('0x25')]>0x0){_[_0x6348('0x3d')](_0xe999a5,function(_0x32b800){if(_[_0x6348('0x3e')]([_0x6348('0x3f'),_0x6348('0x40')],_0x32b800['type'])&&_0x32b800[_0x6348('0x41')]&&!_0x32b800['customField']){var _0x54db78=_0x32b800['idField']['toLowerCase']();var _0x39c026=_0x54db78[_0x6348('0x33')](0x0,_0x54db78[_0x6348('0x42')]('_'));var _0x1f92fd=_0x54db78[_0x6348('0x33')](_0x54db78[_0x6348('0x42')]('_')+0x1);if(_0x39c026===_0x3587bc){_0x59ef3e[_0x1f92fd]=_0x32b800[_0x6348('0x43')];}}});}return _0x59ef3e;}function getTicket(_0x5bcae6,_0x2a53e3,_0x4f4bf1,_0x5277ef,_0x3f2dd2,_0x13e4be,_0x29ba9a){return new Promise(function(_0x26dc4b,_0x12e3c2){var _0x5560f3;return getAuthToken(_0x2a53e3,_0x4f4bf1,_0x29ba9a)[_0x6348('0x18')](function(_0x7e2573){if(_0x13e4be[_0x6348('0x44')]===_0x6348('0x45')){_0x5560f3={'method':_0x6348('0x13'),'uri':_0x5277ef+'incidents','body':Object[_0x6348('0x46')]({},{'title':intUtil[_0x6348('0x47')](_0x13e4be[_0x6348('0x48')],_0x3f2dd2,'\x20'),'description':intUtil['getString'](_0x13e4be['Descriptions'],_0x3f2dd2,'\x0a'),'customerid_contact@odata.bind':_0x5bcae6[_0x6348('0x3c')]?_0x6348('0x49')+_0x5bcae6[_0x6348('0x3c')]+')':undefined,'ownerid@odata.bind':_0x6348('0x4a')+_0x5bcae6[_0x6348('0x30')]+')','caseorigincode':'1'},getCustomFields(_0x13e4be[_0x6348('0x4b')],_0x3f2dd2,_0x13e4be[_0x6348('0x44')])),'headers':{'Authorization':_0x6348('0x31')+_0x7e2573,'OData-Version':_0x6348('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x13e4be[_0x6348('0x44')]===_0x6348('0x4c')){var _0x4050e3=_0x5bcae6[_0x6348('0x3c')]?[{'partyid_systemuser@odata.bind':_0x6348('0x4a')+_0x5bcae6[_0x6348('0x30')]+')','participationtypemask':_0x5bcae6[_0x6348('0x4d')]===_0x6348('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x6348('0x49')+_0x5bcae6['enduserId']+')','participationtypemask':_0x5bcae6['callDirection']===_0x6348('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6348('0x4a')+_0x5bcae6['userId']+')','participationtypemask':_0x5bcae6[_0x6348('0x4d')]===_0x6348('0x4e')?0x2:0x1}];_0x5560f3={'method':_0x6348('0x13'),'uri':_0x5277ef+'phonecalls','body':Object[_0x6348('0x46')]({},{'subject':intUtil[_0x6348('0x47')](_0x13e4be[_0x6348('0x48')],_0x3f2dd2,'\x20'),'phonenumber':String(_0x3f2dd2[_0x6348('0x35')]),'description':intUtil[_0x6348('0x47')](_0x13e4be[_0x6348('0x4f')],_0x3f2dd2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5bcae6['enduserId']?'/contacts('+_0x5bcae6['enduserId']+')':undefined,'ownerid@odata.bind':_0x6348('0x4a')+_0x5bcae6['userId']+')','directioncode':_0x5bcae6[_0x6348('0x4d')]===_0x6348('0x4e')?![]:!![],'phonecall_activity_parties':_0x4050e3},getCustomFields(_0x13e4be[_0x6348('0x4b')],_0x3f2dd2,_0x13e4be[_0x6348('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x7e2573,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5560f3);})[_0x6348('0x18')](function(_0x35b01c){var _0x30d30f=_0x35b01c[_0x6348('0x50')][_0x6348('0x51')];var _0x37fc56=_0x30d30f[_0x6348('0x33')](_0x30d30f[_0x6348('0x34')]('(')+0x1,_0x30d30f['lastIndexOf'](')'));_0x5bcae6[_0x6348('0x52')]=_0x37fc56;_0x26dc4b(_0x5bcae6);})[_0x6348('0x19')](function(_0x585bab){_0x12e3c2(_0x585bab[_0x6348('0x1d')]);});});}function emit(_0x4fe778,_0x3fdd45,_0x131d55,_0x4dc1b8){var _0x1ba040={'uri':util[_0x6348('0x53')](_0x6348('0x54'),_0x4fe778,_0x131d55,_0x4dc1b8)};io['to'](util[_0x6348('0x53')]('user:%s',_0x3fdd45))[_0x6348('0x55')](_0x6348('0x56'),_0x1ba040);}exports['cs']=function(_0x519ff0,_0x93c110,_0xde37b5,_0x585459,_0x58e223,_0x1ad152,_0x5265ff,_0x208367){var _0x12249b={};_0x1ad152[_0x6348('0xc')]=_0x1ad152[_0x6348('0xb')]?intUtil[_0x6348('0x57')](_0x1ad152[_0x6348('0xd')][_0x6348('0xe')]):intUtil['stripTrailingSlash'](_0x1ad152[_0x6348('0xc')]);_0x1ad152['serverUrl']=intUtil['stripTrailingSlash'](_0x1ad152[_0x6348('0x58')]);_0x12249b['callDirection']=_0x208367===_0x6348('0x4e')||_0x208367==='unmanaged'?_0x6348('0x4e'):_0x6348('0x2d');var _0x4eee2b=_0x1ad152['modernAuthentication']?util['format'](_0x6348('0x59'),_0x1ad152[_0x6348('0xd')]['data7']):util[_0x6348('0x53')](_0x6348('0x59'),_0x1ad152[_0x6348('0xc')]);var _0x4e13f4=util[_0x6348('0x53')](_0x6348('0x5a'),_0x1ad152[_0x6348('0xf')]);var _0xf8597d=util[_0x6348('0x53')](_0x6348('0x5b'),_0x1ad152[_0x6348('0x58')],_0x93c110[_0x6348('0x5c')],md5(_0x93c110[_0x6348('0x5c')]));if(_0x58e223&&_0x58e223[_0x6348('0x5d')]){logger['info'](_0x6348('0x5e'),_0x6348('0x5f'));_0x93c110[_0x6348('0x60')]=_0xf8597d;}else if(_0x5265ff&&_0x5265ff[_0x6348('0x61')]&&_0x5265ff[_0x6348('0x61')]!==_0x6348('0x62')){logger[_0x6348('0x28')](_0x6348('0x63'),_0x6348('0x5f'));_0x93c110['recordingURL']=_0xf8597d;}else{_0x93c110[_0x6348('0x60')]='';}return getUser(_0x12249b,_0x1ad152,_0x585459,_0x4e13f4,_0x4eee2b,_0x208367)[_0x6348('0x18')](function(_0x3a9bf3){logger[_0x6348('0x28')]('['+_0x208367['toUpperCase']()+_0x6348('0x64'),_0x3a9bf3['userId']);logger[_0x6348('0x28')]('['+_0x208367[_0x6348('0x1b')]()+']\x20The\x20User\x20email\x20is:',_0x3a9bf3[_0x6348('0x23')]);return getEndUser(_0x3a9bf3,_0x1ad152,_0x4e13f4,_0x4eee2b,_0x93c110,_0x208367,_0xde37b5[_0x6348('0x65')],_0xde37b5['additionalSearchContact']);})[_0x6348('0x18')](function(_0x14bc6c){logger['info']('['+_0x208367['toUpperCase']()+_0x6348('0x66'),_0x14bc6c['enduserId']);logger[_0x6348('0x28')]('['+_0x208367[_0x6348('0x1b')]()+_0x6348('0x67'),_0x93c110[_0x6348('0x35')]);return getTicket(_0x14bc6c,_0x1ad152,_0x4e13f4,_0x4eee2b,_0x93c110,_0xde37b5,_0x208367);})['then'](function(_0x1fe35d){logger[_0x6348('0x28')](util[_0x6348('0x53')]('['+_0x208367['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xde37b5['ticketType'],_0x1fe35d[_0x6348('0x52')]));logger[_0x6348('0x28')](util[_0x6348('0x53')]('['+_0x208367[_0x6348('0x1b')]()+_0x6348('0x68'),_0x208367));if(_0x208367!=='unmanaged'&&_0xde37b5[_0x6348('0x69')]){logger['info']('['+_0x208367[_0x6348('0x1b')]()+']',_0x6348('0x6a'));emit(_0x1ad152[_0x6348('0xc')],_0x585459[_0x6348('0x6b')],_0xde37b5[_0x6348('0x44')],_0x1fe35d[_0x6348('0x52')]);}})[_0x6348('0x19')](function(_0x12dc6f){logger[_0x6348('0x1a')]('['+_0x208367[_0x6348('0x1b')]()+_0x6348('0x6c'),_0x12dc6f['message']);console[_0x6348('0x1a')](_0x6348('0x6d'),_0x12dc6f);});}; \ No newline at end of file +var _0x2d1f=[']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','userId','body','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','type','idField','indexOf','ticketType','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','Subjects','callDirection','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled'];(function(_0x4dafe5,_0x11d065){var _0x3906b7=function(_0x12148d){while(--_0x12148d){_0x4dafe5['push'](_0x4dafe5['shift']());}};_0x3906b7(++_0x11d065);}(_0x2d1f,0x195));var _0xf2d1=function(_0x1a4950,_0x53b0f7){_0x1a4950=_0x1a4950-0x0;var _0x4787d5=_0x2d1f[_0x1a4950];return _0x4787d5;};'use strict';var _=require(_0xf2d1('0x0'));var rp=require(_0xf2d1('0x1'));var util=require('util');var intUtil=require(_0xf2d1('0x2'));var md5=require(_0xf2d1('0x3'));var Redis=require(_0xf2d1('0x4'));var logger=require(_0xf2d1('0x5'))(_0xf2d1('0x6'));var config=require(_0xf2d1('0x7'));config['redis']=_[_0xf2d1('0x8')](config[_0xf2d1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf2d1('0xa'))(new Redis(config[_0xf2d1('0x9')]));function getAuthToken(_0x327a2a,_0x58d110,_0x26cbaa){if(_0x327a2a['modernAuthentication']){_0x327a2a[_0xf2d1('0xb')]=_0x327a2a['CloudProvider'][_0xf2d1('0xc')];_0x327a2a[_0xf2d1('0xd')]=_0x327a2a[_0xf2d1('0xe')][_0xf2d1('0xf')];return Promise[_0xf2d1('0x10')](_0x327a2a['CloudProvider'][_0xf2d1('0x11')]);}var _0x165e5d={'method':_0xf2d1('0x12'),'uri':_0x58d110,'form':{'client_id':_0x327a2a[_0xf2d1('0x13')],'resource':_0x327a2a['remoteUri'],'username':_0x327a2a['username'],'password':_0x327a2a[_0xf2d1('0x14')],'grant_type':'password','client_secret':_0x327a2a[_0xf2d1('0x15')]},'json':!![]};return rp(_0x165e5d)['then'](function(_0x4566d9){return _0x4566d9[_0xf2d1('0x16')];})[_0xf2d1('0x17')](function(_0x53b4c5){logger[_0xf2d1('0x18')]('['+[_0x26cbaa[_0xf2d1('0x19')]()]+_0xf2d1('0x1a'));return _0x53b4c5[_0xf2d1('0x1b')];});}function getUser(_0x3180dd,_0x56cbc0,_0x7651ba,_0x4e9a96,_0x379918,_0x5c26b3){return new Promise(function(_0x4779c7,_0x4226d5){return getAuthToken(_0x56cbc0,_0x4e9a96,_0x5c26b3)[_0xf2d1('0x1c')](function(_0xae4837){var _0x4ac99f={'method':'GET','uri':_0x379918+_0xf2d1('0x1d'),'headers':{'Authorization':_0xf2d1('0x1e')+_0xae4837,'OData-Version':_0xf2d1('0x1f')},'json':!![]};return rp(_0x4ac99f);})[_0xf2d1('0x1c')](function(_0x47f1aa){var _0x2c5b31=_0x47f1aa[_0xf2d1('0x20')];var _0x46fe60=![];var _0x50c1e0=null;if(!_['isNil'](_0x7651ba)){if(intUtil[_0xf2d1('0x21')](_0x7651ba[_0xf2d1('0x22')])){_0x3180dd[_0xf2d1('0x23')]=_0x7651ba[_0xf2d1('0x22')];for(_0x50c1e0=0x0;_0x50c1e0<_0x2c5b31[_0xf2d1('0x24')];_0x50c1e0++){if(_0x2c5b31[_0x50c1e0][_0xf2d1('0x25')]===_0x7651ba[_0xf2d1('0x22')]&&!_0x2c5b31[_0x50c1e0][_0xf2d1('0x26')]){_0x46fe60=!![];logger['info']('['+[_0x5c26b3['toUpperCase']()]+_0xf2d1('0x27')+_0x2c5b31[_0x50c1e0]['systemuserid']+'!');_0x3180dd['userId']=_0x2c5b31[_0x50c1e0][_0xf2d1('0x28')];}}}}if(!_0x46fe60){logger[_0xf2d1('0x29')]('['+[_0x5c26b3[_0xf2d1('0x19')]()]+_0xf2d1('0x2a'));_0x3180dd[_0xf2d1('0x23')]=_0x56cbc0[_0xf2d1('0x2b')];for(_0x50c1e0=0x0;_0x50c1e0<_0x2c5b31['length'];_0x50c1e0++){if(_0x2c5b31[_0x50c1e0]['internalemailaddress']===_0x56cbc0[_0xf2d1('0x2b')]){_0x3180dd['userId']=_0x2c5b31[_0x50c1e0]['systemuserid'];}}}_0x4779c7(_0x3180dd);})[_0xf2d1('0x17')](function(_0x5ad706){_0x4226d5(_0x5ad706[_0xf2d1('0x1b')]);});});}function createEndUser(_0x7a2d3b,_0x1ede79,_0x247a02,_0x2b80e5,_0x5adecd,_0x1b12a1,_0x17c489){return new Promise(function(_0x29052d,_0x22bb46){return getAuthToken(_0x1ede79,_0x247a02,_0x1b12a1)['then'](function(_0x3cd474){var _0xe5d15d=_0x1b12a1[_0xf2d1('0x2c')]()==='outbound'?_0x5adecd[_0xf2d1('0x2d')]:_0x5adecd[_0xf2d1('0x2e')];var _0x29b888={'method':'POST','uri':_0x2b80e5+_0xf2d1('0x2f'),'body':{'fullname':_0xe5d15d,'firstname':_0xe5d15d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf2d1('0x30')+_0x7a2d3b[_0xf2d1('0x31')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3cd474,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x29b888[_0xf2d1('0x32')][_0x17c489]=_0xe5d15d;return rp(_0x29b888);})['then'](function(_0x5217b4){var _0xaf0916=_0x5217b4['headers'][_0xf2d1('0x33')];var _0x27f7b8=_0xaf0916[_0xf2d1('0x34')](_0xaf0916[_0xf2d1('0x35')]('(')+0x1,_0xaf0916[_0xf2d1('0x35')](')'));_0x7a2d3b[_0xf2d1('0x36')]=_0x27f7b8;_0x29052d(_0x7a2d3b);})['catch'](function(_0x1a8896){_0x22bb46(_0x1a8896[_0xf2d1('0x1b')]);});});}function getEndUser(_0x5397e9,_0x1f4d6c,_0x74b6a6,_0x3fcc84,_0x45c23a,_0x2ef669,_0x747fb8,_0x2ea02d){var _0x31f1cd=_0x2ef669['toLowerCase']()===_0xf2d1('0x37')?_0x45c23a[_0xf2d1('0x2d')]:_0x45c23a[_0xf2d1('0x2e')];return getAuthToken(_0x1f4d6c,_0x74b6a6,_0x2ef669)[_0xf2d1('0x1c')](function(_0x218909){_0x2ea02d=_0x2ea02d?_0x2ea02d:_0xf2d1('0x38');var _0x36ab98={'method':_0xf2d1('0x39'),'uri':_0x3fcc84+_0xf2d1('0x3a')+_0x2ea02d+_0xf2d1('0x3b')+_0x2ea02d+_0xf2d1('0x3c')+_0x31f1cd[_0xf2d1('0x3d')]('+','%2b')+'\x27','headers':{'Authorization':_0xf2d1('0x1e')+_0x218909,'If-None-Match':null,'OData-Version':_0xf2d1('0x1f')},'json':!![]};return rp(_0x36ab98);})[_0xf2d1('0x1c')](function(_0x4b0e0c){var _0x31e228=![];if(!_0x4b0e0c)return _0x31e228;var _0xba7d8b=_0x4b0e0c['value'];for(var _0x59d080=0x0;_0x59d080<_0xba7d8b[_0xf2d1('0x24')];_0x59d080++){if(_0xba7d8b[_0x59d080][_0x2ea02d]===_0x31f1cd){_0x31e228=!![];_0x5397e9[_0xf2d1('0x36')]=_0xba7d8b[_0x59d080]['contactid'];}}return _0x31e228;})[_0xf2d1('0x1c')](function(_0x368d95){if(_0x368d95)return _0x5397e9;if(_0x747fb8===_0xf2d1('0x3e')){logger[_0xf2d1('0x29')]('['+[_0x2ef669[_0xf2d1('0x19')]()]+_0xf2d1('0x3f'));return _0x5397e9;}return createEndUser(_0x5397e9,_0x1f4d6c,_0x74b6a6,_0x3fcc84,_0x45c23a,_0x2ef669,_0x2ea02d)[_0xf2d1('0x1c')](function(_0x36da51){logger['info']('['+[_0x2ef669[_0xf2d1('0x19')]()]+']\x20Enduser\x20created!',_0x36da51[_0xf2d1('0x36')]);return _0x36da51;});});}function getCustomFields(_0x2ba4cb,_0x1081ab,_0x1f635b){var _0x44e1e5={};if(_0x2ba4cb[_0xf2d1('0x24')]>0x0){_['forEach'](_0x2ba4cb,function(_0x346934){if(_[_0xf2d1('0x40')]([_0xf2d1('0x41'),_0xf2d1('0x42')],_0x346934[_0xf2d1('0x43')])&&_0x346934['nameField']&&!_0x346934['customField']){var _0x5aed7a=_0x346934[_0xf2d1('0x44')]['toLowerCase']();var _0x3e9efb=_0x5aed7a[_0xf2d1('0x34')](0x0,_0x5aed7a[_0xf2d1('0x45')]('_'));var _0xb6353c=_0x5aed7a[_0xf2d1('0x34')](_0x5aed7a[_0xf2d1('0x45')]('_')+0x1);if(_0x3e9efb===_0x1f635b){_0x44e1e5[_0xb6353c]=_0x346934['content'];}}});}return _0x44e1e5;}function getTicket(_0x867475,_0x297f44,_0x19a4f9,_0x10d24d,_0x404828,_0x993508,_0x4a21d3){return new Promise(function(_0x136ab4,_0x19c14c){var _0x1e2c10;return getAuthToken(_0x297f44,_0x19a4f9,_0x4a21d3)[_0xf2d1('0x1c')](function(_0x17bd86){if(_0x993508[_0xf2d1('0x46')]==='incident'){_0x1e2c10={'method':_0xf2d1('0x12'),'uri':_0x10d24d+_0xf2d1('0x47'),'body':Object[_0xf2d1('0x48')]({},{'title':intUtil['getString'](_0x993508['Subjects'],_0x404828,'\x20'),'description':intUtil[_0xf2d1('0x49')](_0x993508[_0xf2d1('0x4a')],_0x404828,'\x0a'),'customerid_contact@odata.bind':_0x867475[_0xf2d1('0x36')]?_0xf2d1('0x4b')+_0x867475[_0xf2d1('0x36')]+')':undefined,'ownerid@odata.bind':_0xf2d1('0x30')+_0x867475[_0xf2d1('0x31')]+')','caseorigincode':'1'},getCustomFields(_0x993508[_0xf2d1('0x4c')],_0x404828,_0x993508[_0xf2d1('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x17bd86,'OData-Version':_0xf2d1('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x993508[_0xf2d1('0x46')]===_0xf2d1('0x4d')){var _0x4c735e=_0x867475['enduserId']?[{'partyid_systemuser@odata.bind':_0xf2d1('0x30')+_0x867475[_0xf2d1('0x31')]+')','participationtypemask':_0x867475['callDirection']===_0xf2d1('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x867475[_0xf2d1('0x36')]+')','participationtypemask':_0x867475['callDirection']===_0xf2d1('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf2d1('0x30')+_0x867475['userId']+')','participationtypemask':_0x867475['callDirection']===_0xf2d1('0x4e')?0x2:0x1}];_0x1e2c10={'method':'POST','uri':_0x10d24d+'phonecalls','body':Object[_0xf2d1('0x48')]({},{'subject':intUtil['getString'](_0x993508[_0xf2d1('0x4f')],_0x404828,'\x20'),'phonenumber':String(_0x404828['calleridnum']),'description':intUtil[_0xf2d1('0x49')](_0x993508[_0xf2d1('0x4a')],_0x404828,'\x0a'),'regardingobjectid_contact@odata.bind':_0x867475[_0xf2d1('0x36')]?'/contacts('+_0x867475[_0xf2d1('0x36')]+')':undefined,'ownerid@odata.bind':_0xf2d1('0x30')+_0x867475[_0xf2d1('0x31')]+')','directioncode':_0x867475[_0xf2d1('0x50')]===_0xf2d1('0x4e')?![]:!![],'phonecall_activity_parties':_0x4c735e},getCustomFields(_0x993508[_0xf2d1('0x4c')],_0x404828,_0x993508['ticketType'])),'headers':{'Authorization':_0xf2d1('0x1e')+_0x17bd86,'OData-Version':_0xf2d1('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e2c10);})[_0xf2d1('0x1c')](function(_0x2f317d){var _0x18f316=_0x2f317d[_0xf2d1('0x51')][_0xf2d1('0x33')];var _0x5efaf7=_0x18f316[_0xf2d1('0x34')](_0x18f316['lastIndexOf']('(')+0x1,_0x18f316['lastIndexOf'](')'));_0x867475[_0xf2d1('0x52')]=_0x5efaf7;_0x136ab4(_0x867475);})[_0xf2d1('0x17')](function(_0x3d2439){_0x19c14c(_0x3d2439[_0xf2d1('0x1b')]);});});}function emit(_0xad25b4,_0x56821c,_0x407b83,_0xec089f){var _0x169074={'uri':util[_0xf2d1('0x53')](_0xf2d1('0x54'),_0xad25b4,_0x407b83,_0xec089f)};io['to'](util[_0xf2d1('0x53')]('user:%s',_0x56821c))[_0xf2d1('0x55')](_0xf2d1('0x56'),_0x169074);}exports['cs']=function(_0x3d46cc,_0x28d830,_0x392305,_0x3093a8,_0x4a13ff,_0x14f671,_0x2e57e9,_0x30d8db){var _0x338d51={};_0x14f671[_0xf2d1('0xb')]=_0x14f671[_0xf2d1('0x57')]?intUtil[_0xf2d1('0x58')](_0x14f671[_0xf2d1('0xe')]['data7']):intUtil['stripTrailingSlash'](_0x14f671[_0xf2d1('0xb')]);_0x14f671[_0xf2d1('0x59')]=intUtil[_0xf2d1('0x58')](_0x14f671[_0xf2d1('0x59')]);_0x338d51[_0xf2d1('0x50')]=_0x30d8db==='queue'||_0x30d8db===_0xf2d1('0x5a')?_0xf2d1('0x4e'):_0xf2d1('0x37');var _0x182a2e=_0x14f671[_0xf2d1('0x57')]?util[_0xf2d1('0x53')]('%s/api/data/v9.0/',_0x14f671[_0xf2d1('0xe')][_0xf2d1('0xc')]):util[_0xf2d1('0x53')](_0xf2d1('0x5b'),_0x14f671[_0xf2d1('0xb')]);var _0x24d5a2=util[_0xf2d1('0x53')](_0xf2d1('0x5c'),_0x14f671[_0xf2d1('0xd')]);var _0x171e35=util[_0xf2d1('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14f671[_0xf2d1('0x59')],_0x28d830[_0xf2d1('0x5d')],md5(_0x28d830[_0xf2d1('0x5d')]));if(_0x4a13ff&&_0x4a13ff['monitor_format']){logger[_0xf2d1('0x29')](_0xf2d1('0x5e'),_0xf2d1('0x5f'));_0x28d830['recordingURL']=_0x171e35;}else if(_0x2e57e9&&_0x2e57e9['recordingFormat']&&_0x2e57e9[_0xf2d1('0x60')]!==_0xf2d1('0x61')){logger['info'](_0xf2d1('0x62'),'Recording\x20is\x20enabled!');_0x28d830['recordingURL']=_0x171e35;}else{_0x28d830['recordingURL']='';}return getUser(_0x338d51,_0x14f671,_0x3093a8,_0x24d5a2,_0x182a2e,_0x30d8db)[_0xf2d1('0x1c')](function(_0x298290){logger[_0xf2d1('0x29')]('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x63'),_0x298290[_0xf2d1('0x31')]);logger[_0xf2d1('0x29')]('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x64'),_0x298290[_0xf2d1('0x23')]);return getEndUser(_0x298290,_0x14f671,_0x24d5a2,_0x182a2e,_0x28d830,_0x30d8db,_0x392305[_0xf2d1('0x65')],_0x392305[_0xf2d1('0x66')]);})[_0xf2d1('0x1c')](function(_0x1a3dd8){logger[_0xf2d1('0x29')]('['+_0x30d8db['toUpperCase']()+_0xf2d1('0x67'),_0x1a3dd8[_0xf2d1('0x36')]);logger[_0xf2d1('0x29')]('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x68'),_0x28d830[_0xf2d1('0x2e')]);return getTicket(_0x1a3dd8,_0x14f671,_0x24d5a2,_0x182a2e,_0x28d830,_0x392305,_0x30d8db);})[_0xf2d1('0x1c')](function(_0x492d65){logger[_0xf2d1('0x29')](util[_0xf2d1('0x53')]('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x69'),_0x392305['ticketType'],_0x492d65[_0xf2d1('0x52')]));logger['info'](util['format']('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x6a'),_0x30d8db));if(_0x30d8db!=='unmanaged'&&_0x392305[_0xf2d1('0x6b')]){logger['info']('['+_0x30d8db['toUpperCase']()+']',_0xf2d1('0x6c'));emit(_0x14f671[_0xf2d1('0xb')],_0x3093a8[_0xf2d1('0x6d')],_0x392305['ticketType'],_0x492d65[_0xf2d1('0x52')]);}})[_0xf2d1('0x17')](function(_0x1f9f33){logger['error']('['+_0x30d8db[_0xf2d1('0x19')]()+_0xf2d1('0x6e'),_0x1f9f33[_0xf2d1('0x1b')]);console[_0xf2d1('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x1f9f33);});}; \ 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 7c14869..9804947 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 _0x6108=['calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','forEach','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','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','recordingFormat','none','[OUTBOUND]','destcalleridnum','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6108,0xa9));var _0x8610=function(_0x265976,_0x49e1dc){_0x265976=_0x265976-0x0;var _0x407c33=_0x6108[_0x265976];return _0x407c33;};'use strict';var _=require(_0x8610('0x0'));var rp=require(_0x8610('0x1'));var md5=require(_0x8610('0x2'));var util=require(_0x8610('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8610('0x4'));var logger=require(_0x8610('0x5'))(_0x8610('0x6'));config['redis']=_[_0x8610('0x7')](config[_0x8610('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8610('0x8')]));var headers={'Content-Type':_0x8610('0x9'),'Accept':_0x8610('0x9')};function emit(_0x2486a9,_0x3d20dd,_0x2bab6a){io['to'](_0x2486a9)[_0x8610('0xa')](_0x3d20dd,_0x2bab6a);}function getTicket(_0x57bee9,_0x26f0d3,_0x24eefc,_0x18ff59,_0x440322){logger['info'](_0x8610('0xb'));var _0x172d9f=_[_0x8610('0xc')]({'responder_id':_0x26f0d3['id'],'requester_id':_0x24eefc['id'],'name':util[_0x8610('0xd')](_0x8610('0xe'),_0x440322[_0x8610('0xf')]),'phone':_0x440322['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8610('0x10')](_0x18ff59[_0x8610('0x11')],_0x440322,'\x20'),'description':intUtil['getString'](_0x18ff59[_0x8610('0x12')],_0x440322,_0x8610('0x13')),'tags':getTags(_0x18ff59[_0x8610('0x14')],_0x8610('0x15'))},getCustomFields(_0x18ff59[_0x8610('0x16')],_0x440322));_0x172d9f[_0x8610('0x17')]=_[_0x8610('0x18')](_[_0x8610('0x19')](_0x172d9f['custom_fields'],'id'),'value');return request({'uri':util['format'](_0x8610('0x1a'),_0x57bee9['remoteUri']),'method':'POST','body':_0x172d9f})['then'](function(_0x40a753){logger[_0x8610('0x1b')](_0x8610('0x1c'));return _0x40a753;});}function getUser(_0x3753b9,_0x5bdac9){if(intUtil[_0x8610('0x1d')](_0x5bdac9)){return request({'uri':util[_0x8610('0xd')](_0x8610('0x1e'),_0x3753b9[_0x8610('0x1f')]),'qs':{'email':_0x5bdac9}})[_0x8610('0x20')](function(_0x483387){if(_0x483387[_0x8610('0x21')]){logger[_0x8610('0x1b')](_0x8610('0x22'));return _['find'](_0x483387,function(_0x3e0419){return _0x3e0419[_0x8610('0x23')]['email']===_0x5bdac9;});}else{logger[_0x8610('0x1b')](_0x8610('0x24'));return request({'uri':util[_0x8610('0xd')](_0x8610('0x25'),_0x3753b9[_0x8610('0x1f')])})['then'](function(_0x509b3b){logger['info'](_0x8610('0x26'));return _0x509b3b;});}});}else{logger[_0x8610('0x1b')](_0x8610('0x27'));return request({'uri':util['format'](_0x8610('0x25'),_0x3753b9[_0x8610('0x1f')])})[_0x8610('0x20')](function(_0x123c16){logger[_0x8610('0x1b')]('Admin\x20account\x20selected.');return _0x123c16;});}}function getEndUser(_0x145f0b,_0x2b0bea,_0x6cf175){logger[_0x8610('0x1b')](_0x8610('0x28'),_0x6cf175);return request({'uri':util[_0x8610('0xd')]('%s/api/v2/contacts',_0x145f0b[_0x8610('0x1f')]),'qs':{'phone':_0x6cf175}})[_0x8610('0x20')](function(_0x254695){if(_0x254695[_0x8610('0x21')]){logger['info']('Enduser\x20found!');return _['find'](_0x254695,{'phone':_0x6cf175});}else{logger[_0x8610('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8610('0xd')]('%s/api/v2/contacts',_0x145f0b[_0x8610('0x1f')]),'method':_0x8610('0x29'),'body':{'name':_0x2b0bea,'phone':_0x6cf175}})['then'](function(_0x101690){logger[_0x8610('0x1b')](_0x8610('0x2a'));return _0x101690;});}});}function getAuth(_0x40fe94){return util[_0x8610('0xd')](_0x8610('0x2b'),new Buffer(_0x40fe94[_0x8610('0x2c')]+':X')[_0x8610('0x2d')]('base64'));}function request(_0x4ba387){logger[_0x8610('0x2e')](_0x8610('0x2f'),JSON[_0x8610('0x30')](_0x4ba387));return rp(_[_0x8610('0x7')](_0x4ba387,{'method':_0x8610('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x14ecee,_0x1db284){var _0x2a9ad1=[];if(_0x14ecee&&_0x14ecee[_0x8610('0x21')]>0x0){_0x2a9ad1=_['map'](_0x14ecee,_0x1db284);}return _0x2a9ad1;}function getCustomFields(_0xbf088a,_0x2225bc){var _0x3e201d=[];var _0x3c05cb={'custom_fields':[]};if(_0xbf088a['length']>0x0){_[_0x8610('0x32')](_0xbf088a,function(_0x24625a){if(_['includes']([_0x8610('0x33'),'picklist'],_0x24625a[_0x8610('0x34')])&&_0x24625a[_0x8610('0x35')]&&!_0x24625a[_0x8610('0x36')]){_0x3c05cb[_0x24625a[_0x8610('0x35')][_0x8610('0x37')]()]=_0x24625a[_0x8610('0x38')][_0x8610('0x2d')]();}else if(_['includes']([_0x8610('0x33'),_0x8610('0x39')],_0x24625a['type'])&&_0x24625a[_0x8610('0x3a')]&&_0x24625a[_0x8610('0x36')]){_0x3c05cb[_0x8610('0x17')][_0x8610('0x3b')]({'id':_0x24625a['idField'],'value':_0x24625a[_0x8610('0x38')][_0x8610('0x2d')]()});}else if(_0x24625a[_0x8610('0x34')]===_0x8610('0x3c')&&_0x24625a['variableName']&&_0x24625a['idField']&&_0x24625a['customField']){_0x2225bc[_0x24625a[_0x8610('0x3d')]]&&_0x3c05cb[_0x8610('0x17')]['push']({'id':_0x24625a[_0x8610('0x3a')],'value':_0x2225bc[_0x24625a[_0x8610('0x3d')]][_0x8610('0x2d')]()});}else if(_0x24625a[_0x8610('0x34')]===_0x8610('0x3e')&&_0x24625a[_0x8610('0x3f')]&&_0x24625a[_0x8610('0x3f')][_0x8610('0x15')]&&_0x24625a[_0x8610('0x3a')]&&_0x24625a['customField']){_0x2225bc[_0x24625a['Variable'][_0x8610('0x15')]['toLowerCase']()]&&_0x3c05cb['custom_fields'][_0x8610('0x3b')]({'id':_0x24625a[_0x8610('0x3a')],'value':_0x2225bc[_0x24625a[_0x8610('0x3f')][_0x8610('0x15')][_0x8610('0x37')]()][_0x8610('0x2d')]()});}});}return _0x3c05cb;}exports[_0x8610('0x40')]=function(_0x457db9,_0x51e36e,_0x26fa10,_0x2b73e3,_0x56e614,_0x350645){var _0x44cf19,_0x424190;_0x350645['remoteUri']=intUtil[_0x8610('0x41')](_0x350645['remoteUri']);_0x350645[_0x8610('0x42')]=intUtil[_0x8610('0x41')](_0x350645['serverUrl']);if(_0x56e614&&_0x56e614[_0x8610('0x43')]){logger[_0x8610('0x1b')](_0x8610('0x44'),_0x8610('0x45'));_0x51e36e[_0x8610('0x46')]=util[_0x8610('0xd')](_0x8610('0x47'),_0x350645[_0x8610('0x42')],_0x51e36e[_0x8610('0x48')],md5(_0x51e36e[_0x8610('0x48')]));}else{_0x51e36e[_0x8610('0x46')]='';}headers[_0x8610('0x49')]=getAuth(_0x350645);return getUser(_0x350645,_0x2b73e3[_0x8610('0x4a')])[_0x8610('0x20')](function(_0x433fc5){_0x44cf19=_0x433fc5;logger[_0x8610('0x1b')](_0x8610('0x4b'),_0x44cf19['id']);return getEndUser(_0x350645,_0x51e36e[_0x8610('0xf')],_0x51e36e[_0x8610('0x4c')]);})[_0x8610('0x20')](function(_0x58deab){_0x424190=_0x58deab;logger[_0x8610('0x1b')](_0x8610('0x4d'),_0x424190['id']);return getTicket(_0x350645,_0x44cf19,_0x424190,_0x26fa10,_0x51e36e);})['then'](function(_0x35d73f){if(_0x35d73f&&_0x35d73f['id']){logger[_0x8610('0x1b')](_0x8610('0x1c'));logger[_0x8610('0x1b')](_0x8610('0x4e'),_0x35d73f['id']);logger[_0x8610('0x1b')](_0x8610('0x44'),_0x8610('0x4f'));emit(util['format'](_0x8610('0x50'),_0x2b73e3[_0x8610('0x15')]),_0x8610('0x51'),{'uri':util[_0x8610('0xd')](_0x8610('0x52'),_0x350645[_0x8610('0x1f')],_0x35d73f['id'])});}})[_0x8610('0x53')](function(_0x4689c5){logger[_0x8610('0x54')](_0x8610('0x44'),JSON[_0x8610('0x30')](_0x4689c5));});};exports['outbound']=function(_0x250a84,_0x50b284,_0x49563b,_0x962ed7,_0x185a70,_0x1a7c38,_0x68562a){var _0x3fbb1b,_0x444bc8;_0x1a7c38['remoteUri']=intUtil['stripTrailingSlash'](_0x1a7c38['remoteUri']);_0x1a7c38[_0x8610('0x42')]=intUtil[_0x8610('0x41')](_0x1a7c38['serverUrl']);if(_0x68562a&&_0x68562a[_0x8610('0x55')]&&_0x68562a[_0x8610('0x55')]!==_0x8610('0x56')){logger[_0x8610('0x1b')](_0x8610('0x57'),_0x8610('0x45'));_0x50b284['recordingURL']=util[_0x8610('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a7c38['serverUrl'],_0x50b284[_0x8610('0x48')],md5(_0x50b284[_0x8610('0x48')]));}headers[_0x8610('0x49')]=getAuth(_0x1a7c38);return getUser(_0x1a7c38,_0x962ed7[_0x8610('0x4a')])[_0x8610('0x20')](function(_0x19fcac){_0x3fbb1b=_0x19fcac;logger[_0x8610('0x1b')](_0x8610('0x4b'),_0x3fbb1b['id']);return getEndUser(_0x1a7c38,_0x50b284['destcalleridname'],_0x50b284[_0x8610('0x58')]);})[_0x8610('0x20')](function(_0x125660){_0x444bc8=_0x125660;logger[_0x8610('0x1b')](_0x8610('0x4d'),_0x444bc8['id']);return getTicket(_0x1a7c38,_0x3fbb1b,_0x444bc8,_0x49563b,_0x50b284);})[_0x8610('0x20')](function(_0x177e5c){if(_0x177e5c&&_0x177e5c['id']){logger[_0x8610('0x1b')]('Ticket\x20created!');logger[_0x8610('0x1b')](_0x8610('0x4e'),_0x177e5c['id']);logger[_0x8610('0x1b')]('[OUTBOUND]',_0x8610('0x4f'));emit(util[_0x8610('0xd')]('user:%s',_0x962ed7[_0x8610('0x15')]),_0x8610('0x51'),{'uri':util['format'](_0x8610('0x52'),_0x1a7c38[_0x8610('0x1f')],_0x177e5c['id'])});}})['catch'](function(_0x3e86eb){logger[_0x8610('0x54')](_0x8610('0x57'),JSON[_0x8610('0x30')](_0x3e86eb));});};exports[_0x8610('0x59')]=function(_0x40ba58,_0x274672,_0x56b45f,_0x353903,_0x49a6b4,_0x3461ed){var _0x1d785f,_0x387ccd;_0x3461ed[_0x8610('0x1f')]=intUtil['stripTrailingSlash'](_0x3461ed[_0x8610('0x1f')]);_0x3461ed[_0x8610('0x42')]=intUtil[_0x8610('0x41')](_0x3461ed[_0x8610('0x42')]);if(_0x49a6b4&&_0x49a6b4['monitor_format']){logger['info']('['+_0x274672[_0x8610('0x5a')][_0x8610('0x5b')]()+']',_0x8610('0x45'));_0x274672[_0x8610('0x46')]=util[_0x8610('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3461ed[_0x8610('0x42')],_0x274672[_0x8610('0x48')],md5(_0x274672[_0x8610('0x48')]));}else{_0x274672[_0x8610('0x46')]='';}headers['Authorization']=getAuth(_0x3461ed);return getUser(_0x3461ed,'')['then'](function(_0x349050){_0x1d785f=_0x349050;logger[_0x8610('0x1b')]('The\x20User\x20ID\x20is:',_0x1d785f['id']);return getEndUser(_0x3461ed,_0x274672[_0x8610('0xf')],_0x274672[_0x8610('0x4c')]);})[_0x8610('0x20')](function(_0x3569e2){_0x387ccd=_0x3569e2;logger[_0x8610('0x1b')](_0x8610('0x4d'),_0x387ccd['id']);return getTicket(_0x3461ed,_0x1d785f,_0x387ccd,_0x56b45f,_0x274672);})[_0x8610('0x20')](function(_0x2d5891){if(_0x2d5891){logger[_0x8610('0x1b')](_0x8610('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2d5891['id']);}})[_0x8610('0x53')](function(_0x2e683d){logger[_0x8610('0x54')]('['+_0x274672['lastevent'][_0x8610('0x5b')]()+']',JSON[_0x8610('0x30')](_0x2e683d));});}; \ No newline at end of file +var _0xb6fa=['customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','recordingFormat','none','destcalleridnum','[OUTBOUND]','trigger:browser:url','error','stringify','monitor_format','lastevent','toUpperCase','lodash','md5','util','../../../../config/environment','redis','localhost','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','then','validateEmail','remoteUri','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','defaults','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName'];(function(_0x1ba1f6,_0x1e62d4){var _0x1a8707=function(_0x40e2ed){while(--_0x40e2ed){_0x1ba1f6['push'](_0x1ba1f6['shift']());}};_0x1a8707(++_0x1e62d4);}(_0xb6fa,0x74));var _0xab6f=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xb6fa[_0x39cf70];return _0x580424;};'use strict';var _=require(_0xab6f('0x0'));var rp=require('request-promise');var md5=require(_0xab6f('0x1'));var util=require(_0xab6f('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xab6f('0x3'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_['defaults'](config[_0xab6f('0x4')],{'host':_0xab6f('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xab6f('0x6'),'Accept':_0xab6f('0x6')};function emit(_0x378cb8,_0x5c3ecb,_0x1a6e18){io['to'](_0x378cb8)['emit'](_0x5c3ecb,_0x1a6e18);}function getTicket(_0x55bf03,_0x34d4d9,_0x32d255,_0x364db0,_0x3e3832){logger[_0xab6f('0x7')](_0xab6f('0x8'));var _0xfc2380=_[_0xab6f('0x9')]({'responder_id':_0x34d4d9['id'],'requester_id':_0x32d255['id'],'name':util['format'](_0xab6f('0xa'),_0x3e3832[_0xab6f('0xb')]),'phone':_0x3e3832[_0xab6f('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xab6f('0xd')](_0x364db0[_0xab6f('0xe')],_0x3e3832,'\x20'),'description':intUtil['getString'](_0x364db0[_0xab6f('0xf')],_0x3e3832,_0xab6f('0x10')),'tags':getTags(_0x364db0['Tags'],_0xab6f('0x11'))},getCustomFields(_0x364db0[_0xab6f('0x12')],_0x3e3832));_0xfc2380[_0xab6f('0x13')]=_[_0xab6f('0x14')](_[_0xab6f('0x15')](_0xfc2380[_0xab6f('0x13')],'id'),'value');return request({'uri':util[_0xab6f('0x16')](_0xab6f('0x17'),_0x55bf03['remoteUri']),'method':'POST','body':_0xfc2380})[_0xab6f('0x18')](function(_0x1d48d3){logger['info']('Ticket\x20created!');return _0x1d48d3;});}function getUser(_0x42f4e2,_0x19ea2f){if(intUtil[_0xab6f('0x19')](_0x19ea2f)){return request({'uri':util[_0xab6f('0x16')]('%s/api/v2/agents',_0x42f4e2[_0xab6f('0x1a')]),'qs':{'email':_0x19ea2f}})[_0xab6f('0x18')](function(_0x53f917){if(_0x53f917[_0xab6f('0x1b')]){logger[_0xab6f('0x7')]('Agent\x20found!');return _[_0xab6f('0x1c')](_0x53f917,function(_0x536c1e){return _0x536c1e[_0xab6f('0x1d')][_0xab6f('0x1e')]===_0x19ea2f;});}else{logger[_0xab6f('0x7')](_0xab6f('0x1f'));return request({'uri':util[_0xab6f('0x16')](_0xab6f('0x20'),_0x42f4e2[_0xab6f('0x1a')])})[_0xab6f('0x18')](function(_0x594702){logger[_0xab6f('0x7')](_0xab6f('0x21'));return _0x594702;});}});}else{logger[_0xab6f('0x7')](_0xab6f('0x22'));return request({'uri':util[_0xab6f('0x16')](_0xab6f('0x20'),_0x42f4e2[_0xab6f('0x1a')])})[_0xab6f('0x18')](function(_0x30cfc9){logger[_0xab6f('0x7')](_0xab6f('0x21'));return _0x30cfc9;});}}function getEndUser(_0x2b0683,_0x216e40,_0x287458){logger['info'](_0xab6f('0x23'),_0x287458);return request({'uri':util[_0xab6f('0x16')](_0xab6f('0x24'),_0x2b0683[_0xab6f('0x1a')]),'qs':{'phone':_0x287458}})[_0xab6f('0x18')](function(_0x268ba4){if(_0x268ba4['length']){logger[_0xab6f('0x7')](_0xab6f('0x25'));return _[_0xab6f('0x1c')](_0x268ba4,{'phone':_0x287458});}else{logger[_0xab6f('0x7')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xab6f('0x16')](_0xab6f('0x24'),_0x2b0683[_0xab6f('0x1a')]),'method':'POST','body':{'name':_0x216e40,'phone':_0x287458}})[_0xab6f('0x18')](function(_0x26237a){logger[_0xab6f('0x7')](_0xab6f('0x26'));return _0x26237a;});}});}function getAuth(_0x445d99){return util[_0xab6f('0x16')](_0xab6f('0x27'),new Buffer(_0x445d99[_0xab6f('0x28')]+':X')[_0xab6f('0x29')]('base64'));}function request(_0x10e47d){logger[_0xab6f('0x2a')]('[HTTP]',JSON['stringify'](_0x10e47d));return rp(_[_0xab6f('0x2b')](_0x10e47d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x13881f,_0x2024de){var _0x3c6c0f=[];if(_0x13881f&&_0x13881f[_0xab6f('0x1b')]>0x0){_0x3c6c0f=_[_0xab6f('0x2c')](_0x13881f,_0x2024de);}return _0x3c6c0f;}function getCustomFields(_0x1151b8,_0x1a9943){var _0x1a3ccc=[];var _0x2bbb74={'custom_fields':[]};if(_0x1151b8['length']>0x0){_[_0xab6f('0x2d')](_0x1151b8,function(_0x4cb5b3){if(_[_0xab6f('0x2e')]([_0xab6f('0x2f'),_0xab6f('0x30')],_0x4cb5b3[_0xab6f('0x31')])&&_0x4cb5b3[_0xab6f('0x32')]&&!_0x4cb5b3['customField']){_0x2bbb74[_0x4cb5b3[_0xab6f('0x32')][_0xab6f('0x33')]()]=_0x4cb5b3[_0xab6f('0x34')][_0xab6f('0x29')]();}else if(_['includes']([_0xab6f('0x2f'),_0xab6f('0x30')],_0x4cb5b3[_0xab6f('0x31')])&&_0x4cb5b3[_0xab6f('0x35')]&&_0x4cb5b3[_0xab6f('0x36')]){_0x2bbb74[_0xab6f('0x13')][_0xab6f('0x37')]({'id':_0x4cb5b3[_0xab6f('0x35')],'value':_0x4cb5b3[_0xab6f('0x34')]['toString']()});}else if(_0x4cb5b3[_0xab6f('0x31')]===_0xab6f('0x38')&&_0x4cb5b3['variableName']&&_0x4cb5b3[_0xab6f('0x35')]&&_0x4cb5b3[_0xab6f('0x36')]){_0x1a9943[_0x4cb5b3[_0xab6f('0x39')]]&&_0x2bbb74[_0xab6f('0x13')]['push']({'id':_0x4cb5b3['idField'],'value':_0x1a9943[_0x4cb5b3['variableName']]['toString']()});}else if(_0x4cb5b3[_0xab6f('0x31')]===_0xab6f('0x3a')&&_0x4cb5b3[_0xab6f('0x3b')]&&_0x4cb5b3['Variable'][_0xab6f('0x11')]&&_0x4cb5b3['idField']&&_0x4cb5b3[_0xab6f('0x36')]){_0x1a9943[_0x4cb5b3[_0xab6f('0x3b')][_0xab6f('0x11')][_0xab6f('0x33')]()]&&_0x2bbb74['custom_fields'][_0xab6f('0x37')]({'id':_0x4cb5b3['idField'],'value':_0x1a9943[_0x4cb5b3['Variable'][_0xab6f('0x11')][_0xab6f('0x33')]()][_0xab6f('0x29')]()});}});}return _0x2bbb74;}exports[_0xab6f('0x3c')]=function(_0x336bc5,_0xee2e03,_0x4691a8,_0xaa49cc,_0x178860,_0x53b33a){var _0x5f1e34,_0x5e57d5;_0x53b33a['remoteUri']=intUtil[_0xab6f('0x3d')](_0x53b33a[_0xab6f('0x1a')]);_0x53b33a[_0xab6f('0x3e')]=intUtil[_0xab6f('0x3d')](_0x53b33a[_0xab6f('0x3e')]);if(_0x178860&&_0x178860['monitor_format']){logger[_0xab6f('0x7')](_0xab6f('0x3f'),_0xab6f('0x40'));_0xee2e03[_0xab6f('0x41')]=util[_0xab6f('0x16')](_0xab6f('0x42'),_0x53b33a['serverUrl'],_0xee2e03['uniqueid'],md5(_0xee2e03[_0xab6f('0x43')]));}else{_0xee2e03['recordingURL']='';}headers[_0xab6f('0x44')]=getAuth(_0x53b33a);return getUser(_0x53b33a,_0xaa49cc[_0xab6f('0x1e')])[_0xab6f('0x18')](function(_0x57ec12){_0x5f1e34=_0x57ec12;logger[_0xab6f('0x7')](_0xab6f('0x45'),_0x5f1e34['id']);return getEndUser(_0x53b33a,_0xee2e03[_0xab6f('0xb')],_0xee2e03[_0xab6f('0xc')]);})['then'](function(_0x334fe3){_0x5e57d5=_0x334fe3;logger[_0xab6f('0x7')](_0xab6f('0x46'),_0x5e57d5['id']);return getTicket(_0x53b33a,_0x5f1e34,_0x5e57d5,_0x4691a8,_0xee2e03);})[_0xab6f('0x18')](function(_0x8f6401){if(_0x8f6401&&_0x8f6401['id']){logger[_0xab6f('0x7')](_0xab6f('0x47'));logger[_0xab6f('0x7')](_0xab6f('0x48'),_0x8f6401['id']);logger[_0xab6f('0x7')](_0xab6f('0x3f'),_0xab6f('0x49'));emit(util[_0xab6f('0x16')](_0xab6f('0x4a'),_0xaa49cc['name']),'trigger:browser:url',{'uri':util[_0xab6f('0x16')](_0xab6f('0x4b'),_0x53b33a['remoteUri'],_0x8f6401['id'])});}})[_0xab6f('0x4c')](function(_0x38ce51){logger['error']('[QUEUE]',JSON['stringify'](_0x38ce51));});};exports['outbound']=function(_0x51cbda,_0x279441,_0x110087,_0x96ef46,_0xf38fd9,_0x5db423,_0x4ef955){var _0x10d00a,_0x5cdfb6;_0x5db423[_0xab6f('0x1a')]=intUtil[_0xab6f('0x3d')](_0x5db423[_0xab6f('0x1a')]);_0x5db423[_0xab6f('0x3e')]=intUtil[_0xab6f('0x3d')](_0x5db423[_0xab6f('0x3e')]);if(_0x4ef955&&_0x4ef955[_0xab6f('0x4d')]&&_0x4ef955[_0xab6f('0x4d')]!==_0xab6f('0x4e')){logger[_0xab6f('0x7')]('[OUTBOUND]',_0xab6f('0x40'));_0x279441[_0xab6f('0x41')]=util['format'](_0xab6f('0x42'),_0x5db423[_0xab6f('0x3e')],_0x279441[_0xab6f('0x43')],md5(_0x279441[_0xab6f('0x43')]));}headers['Authorization']=getAuth(_0x5db423);return getUser(_0x5db423,_0x96ef46[_0xab6f('0x1e')])['then'](function(_0x5adb91){_0x10d00a=_0x5adb91;logger['info']('The\x20User\x20ID\x20is:',_0x10d00a['id']);return getEndUser(_0x5db423,_0x279441['destcalleridname'],_0x279441[_0xab6f('0x4f')]);})[_0xab6f('0x18')](function(_0x3942be){_0x5cdfb6=_0x3942be;logger['info'](_0xab6f('0x46'),_0x5cdfb6['id']);return getTicket(_0x5db423,_0x10d00a,_0x5cdfb6,_0x110087,_0x279441);})[_0xab6f('0x18')](function(_0x2853b9){if(_0x2853b9&&_0x2853b9['id']){logger[_0xab6f('0x7')](_0xab6f('0x47'));logger[_0xab6f('0x7')](_0xab6f('0x48'),_0x2853b9['id']);logger[_0xab6f('0x7')](_0xab6f('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xab6f('0x16')]('user:%s',_0x96ef46[_0xab6f('0x11')]),_0xab6f('0x51'),{'uri':util[_0xab6f('0x16')](_0xab6f('0x4b'),_0x5db423[_0xab6f('0x1a')],_0x2853b9['id'])});}})[_0xab6f('0x4c')](function(_0x51366c){logger[_0xab6f('0x52')]('[OUTBOUND]',JSON[_0xab6f('0x53')](_0x51366c));});};exports['unmanaged']=function(_0x1c3df8,_0x54bfb7,_0x34438e,_0x194122,_0x360a55,_0x2c52e2){var _0x156ac1,_0xa43ab9;_0x2c52e2[_0xab6f('0x1a')]=intUtil[_0xab6f('0x3d')](_0x2c52e2[_0xab6f('0x1a')]);_0x2c52e2[_0xab6f('0x3e')]=intUtil[_0xab6f('0x3d')](_0x2c52e2[_0xab6f('0x3e')]);if(_0x360a55&&_0x360a55[_0xab6f('0x54')]){logger['info']('['+_0x54bfb7[_0xab6f('0x55')][_0xab6f('0x56')]()+']',_0xab6f('0x40'));_0x54bfb7[_0xab6f('0x41')]=util[_0xab6f('0x16')](_0xab6f('0x42'),_0x2c52e2['serverUrl'],_0x54bfb7[_0xab6f('0x43')],md5(_0x54bfb7[_0xab6f('0x43')]));}else{_0x54bfb7[_0xab6f('0x41')]='';}headers['Authorization']=getAuth(_0x2c52e2);return getUser(_0x2c52e2,'')['then'](function(_0x52b514){_0x156ac1=_0x52b514;logger[_0xab6f('0x7')](_0xab6f('0x45'),_0x156ac1['id']);return getEndUser(_0x2c52e2,_0x54bfb7[_0xab6f('0xb')],_0x54bfb7[_0xab6f('0xc')]);})['then'](function(_0x45db4c){_0xa43ab9=_0x45db4c;logger[_0xab6f('0x7')]('The\x20Enduser\x20ID\x20is:',_0xa43ab9['id']);return getTicket(_0x2c52e2,_0x156ac1,_0xa43ab9,_0x34438e,_0x54bfb7);})[_0xab6f('0x18')](function(_0x4d06c9){if(_0x4d06c9){logger[_0xab6f('0x7')](_0xab6f('0x47'));logger[_0xab6f('0x7')](_0xab6f('0x48'),_0x4d06c9['id']);}})[_0xab6f('0x4c')](function(_0x2a6c13){logger[_0xab6f('0x52')]('['+_0x54bfb7[_0xab6f('0x55')][_0xab6f('0x56')]()+']',JSON[_0xab6f('0x53')](_0x2a6c13));});}; \ 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 2a4f0ae..819df92 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 _0xe7e6=['User\x20found:','Admin\x20selected','adminEmail','message','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20created:','catch','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Descriptions','Contact','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/selector/owners','Getting\x20user\x20with\x20email','agentEmail','userId'];(function(_0x3ced90,_0xf1aad1){var _0x5b9d75=function(_0x287333){while(--_0x287333){_0x3ced90['push'](_0x3ced90['shift']());}};_0x5b9d75(++_0xf1aad1);}(_0xe7e6,0x81));var _0x6e7e=function(_0x401b79,_0x37b296){_0x401b79=_0x401b79-0x0;var _0x49d46e=_0xe7e6[_0x401b79];return _0x49d46e;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6e7e('0x0'));var util=require(_0x6e7e('0x1'));var moment=require(_0x6e7e('0x2'));var Promise=require(_0x6e7e('0x3'));var Redis=require(_0x6e7e('0x4'));var intUtil=require('./util');var config=require(_0x6e7e('0x5'));var logger=require(_0x6e7e('0x6'))(_0x6e7e('0x7'));config[_0x6e7e('0x8')]=_[_0x6e7e('0x9')](config[_0x6e7e('0x8')],{'host':_0x6e7e('0xa'),'port':0x18eb});var io=require(_0x6e7e('0xb'))(new Redis(config[_0x6e7e('0x8')]));function getAdminId(_0x2b18b4,_0xe9a01c,_0x2cf062,_0x1517f0){return new Promise(function(_0x380196,_0x54a2de){var _0x4c96d7=![];var _0x538e96={'method':_0x6e7e('0xc'),'uri':_0x1517f0+'/api/selector/owners','json':!![]};_0x538e96[_0x6e7e('0xd')]=_0x2cf062;logger[_0x6e7e('0xe')](_0x6e7e('0xf'));return rp(_0x538e96)[_0x6e7e('0x10')](function(_0x43ca42){if(_0x43ca42){var _0x15f3ba=_0x43ca42[_0x6e7e('0x11')];var _0x3c823f=null;for(_0x3c823f=0x0;_0x3c823f<_0x15f3ba[_0x6e7e('0x12')];_0x3c823f++){if(_0x15f3ba[_0x3c823f][_0x6e7e('0x13')]===_0x2b18b4['adminEmail']){_0x2b18b4[_0x6e7e('0x14')]=_0x15f3ba[_0x3c823f]['id'];_0x4c96d7=!![];}}if(_0x4c96d7){logger[_0x6e7e('0xe')](_0x6e7e('0x15'),_0x2b18b4[_0x6e7e('0x14')]);_0x380196(_0x2b18b4);}else{_0x54a2de({'statusCode':0x194,'message':_0x6e7e('0x16')});}}else{_0x54a2de({'statusCode':0x194,'message':_0x6e7e('0x16')});}})['catch'](function(_0x2c2c8c){logger[_0x6e7e('0x17')]('['+[_0xe9a01c[_0x6e7e('0x18')]()]+']',_0x2c2c8c['message']);_0x54a2de(_0x2c2c8c);});});}function getUser(_0x2d5b77,_0x615aa5,_0x2e5c4d){return function(_0xf0f998){return new Promise(function(_0x441631,_0x3fc94e){var _0x337fa0={'method':_0x6e7e('0xc'),'uri':_0x2e5c4d+_0x6e7e('0x19'),'json':!![]};_0x337fa0['headers']=_0x615aa5;logger[_0x6e7e('0xe')]('Getting\x20user\x20list');return rp(_0x337fa0)[_0x6e7e('0x10')](function(_0x5a6ed0){if(_0x5a6ed0){var _0x2aa022=_0x5a6ed0[_0x6e7e('0x11')];var _0x417121=![];var _0x4823c1=null;if(_0xf0f998['agentEmail']!==null){logger[_0x6e7e('0xe')](_0x6e7e('0x1a'),_0xf0f998[_0x6e7e('0x1b')]);_0xf0f998['userEmail']=_0xf0f998[_0x6e7e('0x1b')];for(_0x4823c1=0x0;_0x4823c1<_0x2aa022[_0x6e7e('0x12')];_0x4823c1++){if(_0x2aa022[_0x4823c1][_0x6e7e('0x13')]===_0xf0f998[_0x6e7e('0x1b')]){_0x417121=!![];_0xf0f998[_0x6e7e('0x1c')]=_0x2aa022[_0x4823c1]['id'];logger['info'](_0x6e7e('0x1d'),_0xf0f998[_0x6e7e('0x1c')]);}}}if(!_0x417121){logger['info'](_0x6e7e('0x1e'));_0xf0f998['userEmail']=_0xf0f998[_0x6e7e('0x1f')];_0xf0f998[_0x6e7e('0x1c')]=_0xf0f998[_0x6e7e('0x14')];_0x417121=!![];}if(_0x417121){_0x441631(_0xf0f998);}else{_0x3fc94e({'statusCode':0x194,'message':_0x6e7e('0x16')});}}else{_0x3fc94e({'statusCode':0x194,'message':_0x6e7e('0x16')});}})['catch'](function(_0x3c1967){logger['error']('['+[_0x2d5b77['toUpperCase']()]+']',_0x3c1967[_0x6e7e('0x20')]);_0x3fc94e(_0x3c1967);});});};}function searchContact(_0x30b6eb,_0x250b85,_0x61975,_0x4cfa9e){return new Promise(function(_0x9a4cfe,_0x4f51ca){var _0x4df4a9={'method':'GET','headers':_0x250b85,'uri':_0x30b6eb+_0x6e7e('0x21')+_0x4cfa9e+'&f='+_0x61975+'&entities=contact','json':!![]};rp(_0x4df4a9)[_0x6e7e('0x10')](function(_0x11310b){var _0x509a4d=_[_0x6e7e('0x22')](_0x11310b[_0x6e7e('0x23')][_0x6e7e('0x23')],[_0x61975,_0x4cfa9e]);_0x9a4cfe(_0x509a4d);})['catch'](function(_0x31fe93){_0x4f51ca(_0x31fe93);});});}function getEndUser(_0x2f3a92,_0x2cdd38,_0xaaa1b){return function(_0xea91a1){return new Promise(function(_0x3d1729,_0x1fd66f){logger[_0x6e7e('0xe')](util[_0x6e7e('0x24')](_0x6e7e('0x25'),_0xea91a1[_0x6e7e('0x26')]));searchContact(_0xaaa1b,_0x2cdd38,'mobile_number',_0xea91a1[_0x6e7e('0x26')])[_0x6e7e('0x10')](function(_0x434b2a){if(_0x434b2a){_0xea91a1['endUserId']=_0x434b2a['id'];logger[_0x6e7e('0xe')](_0x6e7e('0x27'),_0xea91a1[_0x6e7e('0x28')]);return _0x3d1729(_0xea91a1);}searchContact(_0xaaa1b,_0x2cdd38,'work_number',_0xea91a1['contactNumber'])['then'](function(_0x228ae9){if(_0x228ae9){_0xea91a1[_0x6e7e('0x28')]=_0x228ae9['id'];logger[_0x6e7e('0xe')]('Contact\x20found\x20work_number:',_0xea91a1[_0x6e7e('0x28')]);return _0x3d1729(_0xea91a1);}createEndUser(_0xea91a1,_0x2f3a92,_0x2cdd38,_0xaaa1b)[_0x6e7e('0x10')](function(_0x55ddc2){logger['info'](_0x6e7e('0x29'),_0x55ddc2[_0x6e7e('0x28')]);return _0x3d1729(_0x55ddc2);});});})[_0x6e7e('0x2a')](function(_0x5b142f){_0x1fd66f(_0x5b142f);});});};}function createEndUser(_0x13d557,_0x86ae8e,_0x1bd2fd,_0x2135be){return new Promise(function(_0x20a79e,_0x37b1c8){var _0x5d3229=moment();var _0x248b09={'method':_0x6e7e('0x2b'),'uri':_0x2135be+_0x6e7e('0x2c'),'body':{'contact':{'last_name':_0x13d557['contactNumber'],'work_number':_0x13d557[_0x6e7e('0x26')],'mobile_number':_0x13d557[_0x6e7e('0x26')],'owner_id':_0x13d557[_0x6e7e('0x1c')],'created_at':_0x5d3229[_0x6e7e('0x24')](_0x6e7e('0x2d'))}},'json':!![]};_0x248b09[_0x6e7e('0xd')]=_0x1bd2fd;logger[_0x6e7e('0xe')](_0x6e7e('0x2e'));return rp(_0x248b09)[_0x6e7e('0x10')](function(_0x2da3e3){_0x13d557['endUserId']=_0x2da3e3[_0x6e7e('0x2f')]['id'];_0x20a79e(_0x13d557);})[_0x6e7e('0x2a')](function(_0x106bf1){logger[_0x6e7e('0x17')]('['+[_0x86ae8e[_0x6e7e('0x18')]()]+']',_0x106bf1[_0x6e7e('0x20')]);_0x37b1c8(_0x106bf1[_0x6e7e('0x20')]);});});}function getTicket(_0x42ab55,_0x19c33b,_0x57b9e9,_0x399a10,_0x301c79){return function(_0xef957d){logger[_0x6e7e('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x24a156,_0x5de4c0){var _0x2bb915=moment();var _0x1ce07f={'method':_0x6e7e('0x2b'),'uri':_0x57b9e9+_0x6e7e('0x30'),'body':{'title':intUtil[_0x6e7e('0x31')](_0x399a10['Subjects'],_0x301c79,'\x20'),'description':intUtil[_0x6e7e('0x31')](_0x399a10[_0x6e7e('0x32')],_0x301c79,'\x0a'),'owner_id':_0xef957d[_0x6e7e('0x1c')],'creater_id':_0xef957d[_0x6e7e('0x14')],'targetable_id':_0xef957d['endUserId'],'targetable_type':_0x6e7e('0x33'),'created_at':_0x2bb915['format'](_0x6e7e('0x2d')),'due_date':_0x2bb915[_0x6e7e('0x34')](0x1e,'m')[_0x6e7e('0x24')](_0x6e7e('0x2d'))},'json':!![]};_0x1ce07f['headers']=_0x19c33b;return rp(_0x1ce07f)[_0x6e7e('0x10')](function(_0xf2d356){_0xef957d[_0x6e7e('0x35')]=_0xf2d356['task']['id'];logger[_0x6e7e('0xe')]('Task\x20created:',_0xef957d[_0x6e7e('0x35')]);_0x24a156(_0xef957d);})[_0x6e7e('0x2a')](function(_0x53ff6b){logger[_0x6e7e('0x17')]('['+[_0x42ab55[_0x6e7e('0x18')]()]+']',_0x53ff6b[_0x6e7e('0x20')]);_0x5de4c0(_0x53ff6b['message']);});});};}function emit(_0xd970d1,_0xf3e22e,_0x21b5ce){var _0x29aaf6={'uri':_0xd970d1+_0x6e7e('0x36')+_0x21b5ce};io['to'](util[_0x6e7e('0x24')](_0x6e7e('0x37'),_0xf3e22e))[_0x6e7e('0x38')](_0x6e7e('0x39'),_0x29aaf6);}exports['cs']=function(_0x26ed33,_0x59474e,_0x323118,_0x47598c,_0x189296,_0x2fb45c,_0x1ffddc,_0x52df0a){var _0x29c60b={};var _0x5ccdd8={'Authorization':_0x6e7e('0x3a')+_0x2fb45c['apiKey']};_0x2fb45c[_0x6e7e('0x3b')]=intUtil[_0x6e7e('0x3c')](_0x2fb45c[_0x6e7e('0x3b')]);_0x2fb45c[_0x6e7e('0x3d')]=intUtil[_0x6e7e('0x3c')](_0x2fb45c['serverUrl']);var _0x3e5db8=_0x2fb45c[_0x6e7e('0x3b')];_0x29c60b[_0x6e7e('0x1f')]=_0x2fb45c[_0x6e7e('0x3e')];_0x29c60b[_0x6e7e('0x26')]=_0x52df0a[_0x6e7e('0x3f')]()===_0x6e7e('0x40')?_0x59474e[_0x6e7e('0x41')]:_0x59474e['calleridnum'];_0x29c60b['callDirection']=_0x52df0a===_0x6e7e('0x42')||_0x52df0a===_0x6e7e('0x43')?_0x6e7e('0x42'):_0x6e7e('0x40');if(_0x47598c){_0x29c60b[_0x6e7e('0x1b')]=_0x47598c['email'];}var _0x514d50=util[_0x6e7e('0x24')](_0x6e7e('0x44'),_0x2fb45c[_0x6e7e('0x3d')],_0x59474e[_0x6e7e('0x45')],md5(_0x59474e[_0x6e7e('0x45')]));if(_0x189296&&_0x189296[_0x6e7e('0x46')]){logger['info']('[QUEUE]',_0x6e7e('0x47'));_0x59474e[_0x6e7e('0x48')]=_0x514d50;}else if(_0x1ffddc&&_0x1ffddc[_0x6e7e('0x49')]&&_0x1ffddc[_0x6e7e('0x49')]!==_0x6e7e('0x4a')){logger[_0x6e7e('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x59474e[_0x6e7e('0x48')]=_0x514d50;}else{_0x59474e[_0x6e7e('0x48')]='';}return getAdminId(_0x29c60b,_0x52df0a,_0x5ccdd8,_0x3e5db8)[_0x6e7e('0x10')](getUser(_0x52df0a,_0x5ccdd8,_0x3e5db8))[_0x6e7e('0x10')](getEndUser(_0x52df0a,_0x5ccdd8,_0x3e5db8))[_0x6e7e('0x10')](getTicket(_0x52df0a,_0x5ccdd8,_0x3e5db8,_0x323118,_0x59474e))['then'](function(_0x1b9df4){logger['info'](util[_0x6e7e('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1b9df4[_0x6e7e('0x35')]));if(_0x52df0a!==_0x6e7e('0x43')){logger[_0x6e7e('0xe')]('['+[_0x52df0a[_0x6e7e('0x18')]()]+']',_0x6e7e('0x4b'));emit(_0x3e5db8,_0x47598c[_0x6e7e('0x4c')],_0x1b9df4[_0x6e7e('0x28')]);}})['catch'](function(_0x295593){logger[_0x6e7e('0x17')]('['+[_0x52df0a['toUpperCase']()]+_0x6e7e('0x4d'),util[_0x6e7e('0x4e')](_0x295593,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x01de=['GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','agentEmail','length','userId','User\x20found:','Admin\x20selected','error','toUpperCase','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','md5','util','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01de,0x99));var _0xe01d=function(_0x130517,_0x51c065){_0x130517=_0x130517-0x0;var _0x110095=_0x01de[_0x130517];return _0x110095;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xe01d('0x0'));var util=require(_0xe01d('0x1'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xe01d('0x2'));var intUtil=require(_0xe01d('0x3'));var config=require('../../../../config/environment');var logger=require(_0xe01d('0x4'))(_0xe01d('0x5'));config[_0xe01d('0x6')]=_[_0xe01d('0x7')](config[_0xe01d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe01d('0x8'))(new Redis(config[_0xe01d('0x6')]));function getAdminId(_0x3df68d,_0x5b3813,_0x57219e,_0x4ffea9){return new Promise(function(_0x6506e3,_0x32bf10){var _0x35999b=![];var _0x1e61df={'method':_0xe01d('0x9'),'uri':_0x4ffea9+_0xe01d('0xa'),'json':!![]};_0x1e61df[_0xe01d('0xb')]=_0x57219e;logger['info'](_0xe01d('0xc'));return rp(_0x1e61df)[_0xe01d('0xd')](function(_0x2b6fdf){if(_0x2b6fdf){var _0x5e5798=_0x2b6fdf[_0xe01d('0xe')];var _0x151aff=null;for(_0x151aff=0x0;_0x151aff<_0x5e5798['length'];_0x151aff++){if(_0x5e5798[_0x151aff][_0xe01d('0xf')]===_0x3df68d[_0xe01d('0x10')]){_0x3df68d[_0xe01d('0x11')]=_0x5e5798[_0x151aff]['id'];_0x35999b=!![];}}if(_0x35999b){logger[_0xe01d('0x12')]('Admin\x20found:',_0x3df68d['adminId']);_0x6506e3(_0x3df68d);}else{_0x32bf10({'statusCode':0x194,'message':_0xe01d('0x13')});}}else{_0x32bf10({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe01d('0x14')](function(_0x336206){logger['error']('['+[_0x5b3813['toUpperCase']()]+']',_0x336206[_0xe01d('0x15')]);_0x32bf10(_0x336206);});});}function getUser(_0x3aa821,_0x222d4d,_0x9572ee){return function(_0x278652){return new Promise(function(_0x3de4cb,_0x27a953){var _0x361eda={'method':_0xe01d('0x9'),'uri':_0x9572ee+_0xe01d('0xa'),'json':!![]};_0x361eda[_0xe01d('0xb')]=_0x222d4d;logger[_0xe01d('0x12')](_0xe01d('0x16'));return rp(_0x361eda)[_0xe01d('0xd')](function(_0x345b7d){if(_0x345b7d){var _0x4a62ff=_0x345b7d['users'];var _0x26f0e6=![];var _0x47644a=null;if(_0x278652['agentEmail']!==null){logger[_0xe01d('0x12')]('Getting\x20user\x20with\x20email',_0x278652[_0xe01d('0x17')]);_0x278652['userEmail']=_0x278652['agentEmail'];for(_0x47644a=0x0;_0x47644a<_0x4a62ff[_0xe01d('0x18')];_0x47644a++){if(_0x4a62ff[_0x47644a][_0xe01d('0xf')]===_0x278652['agentEmail']){_0x26f0e6=!![];_0x278652[_0xe01d('0x19')]=_0x4a62ff[_0x47644a]['id'];logger['info'](_0xe01d('0x1a'),_0x278652[_0xe01d('0x19')]);}}}if(!_0x26f0e6){logger[_0xe01d('0x12')](_0xe01d('0x1b'));_0x278652['userEmail']=_0x278652['adminEmail'];_0x278652[_0xe01d('0x19')]=_0x278652[_0xe01d('0x11')];_0x26f0e6=!![];}if(_0x26f0e6){_0x3de4cb(_0x278652);}else{_0x27a953({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x27a953({'statusCode':0x194,'message':_0xe01d('0x13')});}})['catch'](function(_0x1c2285){logger[_0xe01d('0x1c')]('['+[_0x3aa821[_0xe01d('0x1d')]()]+']',_0x1c2285['message']);_0x27a953(_0x1c2285);});});};}function searchContact(_0x5a9979,_0x4215d6,_0x2aa5e5,_0x5c864c){return new Promise(function(_0x2bd8fc,_0x389e5c){var _0x28b7d6={'method':_0xe01d('0x9'),'headers':_0x4215d6,'uri':_0x5a9979+'/api/lookup?q='+_0x5c864c+_0xe01d('0x1e')+_0x2aa5e5+_0xe01d('0x1f'),'json':!![]};rp(_0x28b7d6)[_0xe01d('0xd')](function(_0x306aa9){var _0x22d8a5=_['find'](_0x306aa9[_0xe01d('0x20')][_0xe01d('0x20')],[_0x2aa5e5,_0x5c864c]);_0x2bd8fc(_0x22d8a5);})['catch'](function(_0x477be7){_0x389e5c(_0x477be7);});});}function getEndUser(_0x5e0a19,_0x521ac0,_0x38791c){return function(_0x1a018f){return new Promise(function(_0x1619a9,_0x2642eb){logger[_0xe01d('0x12')](util[_0xe01d('0x21')](_0xe01d('0x22'),_0x1a018f[_0xe01d('0x23')]));searchContact(_0x38791c,_0x521ac0,_0xe01d('0x24'),_0x1a018f[_0xe01d('0x23')])['then'](function(_0x12d7c4){if(_0x12d7c4){_0x1a018f[_0xe01d('0x25')]=_0x12d7c4['id'];logger['info'](_0xe01d('0x26'),_0x1a018f['endUserId']);return _0x1619a9(_0x1a018f);}searchContact(_0x38791c,_0x521ac0,_0xe01d('0x27'),_0x1a018f[_0xe01d('0x23')])[_0xe01d('0xd')](function(_0x2bba2e){if(_0x2bba2e){_0x1a018f[_0xe01d('0x25')]=_0x2bba2e['id'];logger['info'](_0xe01d('0x28'),_0x1a018f[_0xe01d('0x25')]);return _0x1619a9(_0x1a018f);}createEndUser(_0x1a018f,_0x5e0a19,_0x521ac0,_0x38791c)[_0xe01d('0xd')](function(_0x45a506){logger[_0xe01d('0x12')](_0xe01d('0x29'),_0x45a506[_0xe01d('0x25')]);return _0x1619a9(_0x45a506);});});})[_0xe01d('0x14')](function(_0x4715b2){_0x2642eb(_0x4715b2);});});};}function createEndUser(_0x1956e6,_0x4f4e8f,_0x36bf07,_0x3c4cd7){return new Promise(function(_0x5af837,_0x5b8982){var _0x6979d=moment();var _0x598fbf={'method':'POST','uri':_0x3c4cd7+'/api/contacts','body':{'contact':{'last_name':_0x1956e6[_0xe01d('0x23')],'work_number':_0x1956e6['contactNumber'],'mobile_number':_0x1956e6[_0xe01d('0x23')],'owner_id':_0x1956e6[_0xe01d('0x19')],'created_at':_0x6979d[_0xe01d('0x21')](_0xe01d('0x2a'))}},'json':!![]};_0x598fbf[_0xe01d('0xb')]=_0x36bf07;logger[_0xe01d('0x12')](_0xe01d('0x2b'));return rp(_0x598fbf)[_0xe01d('0xd')](function(_0x1aa6ab){_0x1956e6[_0xe01d('0x25')]=_0x1aa6ab[_0xe01d('0x2c')]['id'];_0x5af837(_0x1956e6);})[_0xe01d('0x14')](function(_0x1f652c){logger[_0xe01d('0x1c')]('['+[_0x4f4e8f[_0xe01d('0x1d')]()]+']',_0x1f652c['message']);_0x5b8982(_0x1f652c['message']);});});}function getTicket(_0x123223,_0x4b793e,_0xe485b7,_0x18838b,_0x50943b){return function(_0x1af399){logger[_0xe01d('0x12')](_0xe01d('0x2d'));return new Promise(function(_0x1c0cd8,_0x2ab3fc){var _0x5c0fc4=moment();var _0x161d72={'method':_0xe01d('0x2e'),'uri':_0xe485b7+_0xe01d('0x2f'),'body':{'title':intUtil[_0xe01d('0x30')](_0x18838b[_0xe01d('0x31')],_0x50943b,'\x20'),'description':intUtil[_0xe01d('0x30')](_0x18838b['Descriptions'],_0x50943b,'\x0a'),'owner_id':_0x1af399[_0xe01d('0x19')],'creater_id':_0x1af399['adminId'],'targetable_id':_0x1af399[_0xe01d('0x25')],'targetable_type':'Contact','created_at':_0x5c0fc4[_0xe01d('0x21')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5c0fc4[_0xe01d('0x32')](0x1e,'m')[_0xe01d('0x21')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x161d72[_0xe01d('0xb')]=_0x4b793e;return rp(_0x161d72)[_0xe01d('0xd')](function(_0x546f85){_0x1af399[_0xe01d('0x33')]=_0x546f85[_0xe01d('0x34')]['id'];logger['info']('Task\x20created:',_0x1af399[_0xe01d('0x33')]);_0x1c0cd8(_0x1af399);})['catch'](function(_0x4443c3){logger[_0xe01d('0x1c')]('['+[_0x123223[_0xe01d('0x1d')]()]+']',_0x4443c3[_0xe01d('0x15')]);_0x2ab3fc(_0x4443c3['message']);});});};}function emit(_0x198499,_0x2d3789,_0x2c3bde){var _0x355815={'uri':_0x198499+_0xe01d('0x35')+_0x2c3bde};io['to'](util[_0xe01d('0x21')](_0xe01d('0x36'),_0x2d3789))[_0xe01d('0x37')](_0xe01d('0x38'),_0x355815);}exports['cs']=function(_0x42717c,_0x43f70f,_0x583aea,_0x512b4a,_0x11915b,_0x459a42,_0x8ad682,_0xfbed74){var _0x119ac7={};var _0x4527a9={'Authorization':_0xe01d('0x39')+_0x459a42[_0xe01d('0x3a')]};_0x459a42[_0xe01d('0x3b')]=intUtil[_0xe01d('0x3c')](_0x459a42['remoteUri']);_0x459a42['serverUrl']=intUtil[_0xe01d('0x3c')](_0x459a42[_0xe01d('0x3d')]);var _0x2999f7=_0x459a42[_0xe01d('0x3b')];_0x119ac7[_0xe01d('0x10')]=_0x459a42[_0xe01d('0x3e')];_0x119ac7[_0xe01d('0x23')]=_0xfbed74['toLowerCase']()===_0xe01d('0x3f')?_0x43f70f[_0xe01d('0x40')]:_0x43f70f[_0xe01d('0x41')];_0x119ac7['callDirection']=_0xfbed74===_0xe01d('0x42')||_0xfbed74===_0xe01d('0x43')?_0xe01d('0x42'):'outbound';if(_0x512b4a){_0x119ac7[_0xe01d('0x17')]=_0x512b4a['email'];}var _0x1951cc=util[_0xe01d('0x21')](_0xe01d('0x44'),_0x459a42[_0xe01d('0x3d')],_0x43f70f['uniqueid'],md5(_0x43f70f[_0xe01d('0x45')]));if(_0x11915b&&_0x11915b[_0xe01d('0x46')]){logger[_0xe01d('0x12')](_0xe01d('0x47'),_0xe01d('0x48'));_0x43f70f[_0xe01d('0x49')]=_0x1951cc;}else if(_0x8ad682&&_0x8ad682[_0xe01d('0x4a')]&&_0x8ad682['recordingFormat']!==_0xe01d('0x4b')){logger[_0xe01d('0x12')](_0xe01d('0x4c'),_0xe01d('0x48'));_0x43f70f[_0xe01d('0x49')]=_0x1951cc;}else{_0x43f70f[_0xe01d('0x49')]='';}return getAdminId(_0x119ac7,_0xfbed74,_0x4527a9,_0x2999f7)[_0xe01d('0xd')](getUser(_0xfbed74,_0x4527a9,_0x2999f7))[_0xe01d('0xd')](getEndUser(_0xfbed74,_0x4527a9,_0x2999f7))[_0xe01d('0xd')](getTicket(_0xfbed74,_0x4527a9,_0x2999f7,_0x583aea,_0x43f70f))[_0xe01d('0xd')](function(_0x15c194){logger['info'](util[_0xe01d('0x21')](_0xe01d('0x4d'),_0x15c194[_0xe01d('0x33')]));if(_0xfbed74!==_0xe01d('0x43')){logger['info']('['+[_0xfbed74[_0xe01d('0x1d')]()]+']',_0xe01d('0x4e'));emit(_0x2999f7,_0x512b4a[_0xe01d('0x4f')],_0x15c194['endUserId']);}})['catch'](function(_0x2e37d9){logger[_0xe01d('0x1c')]('['+[_0xfbed74[_0xe01d('0x1d')]()]+_0xe01d('0x50'),util['inspect'](_0x2e37d9,{'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 f37861f..fbdacb8 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 _0x3fa8=['EVENT\x20UNKNOWN','vtiger','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','servicenow','exec','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','log'];(function(_0x576a53,_0x5c66bc){var _0x20e957=function(_0xd0f00f){while(--_0xd0f00f){_0x576a53['push'](_0x576a53['shift']());}};_0x20e957(++_0x5c66bc);}(_0x3fa8,0x145));var _0x83fa=function(_0x347f98,_0x23b964){_0x347f98=_0x347f98-0x0;var _0x5c8bfc=_0x3fa8[_0x347f98];return _0x5c8bfc;};'use strict';var _=require('lodash');var util=require(_0x83fa('0x0'));var zendesk=require(_0x83fa('0x1'));var salesforce=require(_0x83fa('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x83fa('0x3'));var zoho=require(_0x83fa('0x4'));var desk=require(_0x83fa('0x5'));var vtiger=require(_0x83fa('0x6'));var servicenow=require(_0x83fa('0x7'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x83fa('0x8'),_0x83fa('0x9'),_0x83fa('0xa'),_0x83fa('0xb'),_0x83fa('0xc'),_0x83fa('0xd'),'vtiger',_0x83fa('0xe'),'freshsales',_0x83fa('0xf')];exports[_0x83fa('0x10')]=function(_0x49feed,_0x1d9a9e,_0x488d3a,_0x46a7b8,_0x21d4a0,_0x1f73b6){if(_0x488d3a){if(_['includes'](integrations,_0x49feed[_0x83fa('0x11')]['toLowerCase']())){try{var _0x3316bc=null;var _0x4a668f='';var _0x1cb2c1=_0x488d3a[_0x49feed[_0x83fa('0x11')][_0x83fa('0x12')]()];if(_0x1cb2c1){var _0x2d3120=_0x1cb2c1[_0x49feed['data2']];if(_0x2d3120){var _0x420371=_['find'](_0x2d3120[_0x83fa('0x13')],{'id':parseInt(_0x49feed[_0x83fa('0x14')],0xa)});if(_0x420371){if(_0x46a7b8){if(_0x21d4a0&&_0x1d9a9e[_0x83fa('0x15')]){_0x4a668f=_0x83fa('0x15');}else if(_0x1d9a9e[_0x83fa('0x16')]){_0x4a668f=_0x83fa('0x17');}else{console[_0x83fa('0x18')](_0x83fa('0x19'),_0x1d9a9e);}}else{_0x4a668f='unmanaged';}switch(_0x49feed[_0x83fa('0x11')][_0x83fa('0x12')]()){case _0x83fa('0x8'):zendesk[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case'salesforce':salesforce[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0xa'):sugarcrm[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0xb'):freshdesk[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0xc'):zoho[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0xd'):desk[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0x1a'):vtiger[_0x4a668f](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6);break;case _0x83fa('0x1b'):freshsales['cs'](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6,_0x4a668f);break;case'servicenow':servicenow['cs'](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6,_0x4a668f);break;case'dynamics365':dynamics365['cs'](_0x49feed,_0x1d9a9e,_0x420371,_0x46a7b8,_0x21d4a0,_0x2d3120,_0x1f73b6,_0x4a668f);break;default:console[_0x83fa('0x18')](_0x83fa('0x1c'));}}else{_0x3316bc=require(_0x83fa('0x1d'))(_0x49feed[_0x83fa('0x11')][_0x83fa('0x12')]());_0x3316bc[_0x83fa('0x1e')](_0x83fa('0x1f'),util[_0x83fa('0x20')](_0x83fa('0x21'),_0x49feed[_0x83fa('0x11')][_0x83fa('0x12')](),_0x49feed[_0x83fa('0x14')]));}}else{_0x3316bc=require('../../../../config/logger')(_0x49feed[_0x83fa('0x11')][_0x83fa('0x12')]());_0x3316bc[_0x83fa('0x1e')](_0x83fa('0x1f'),util[_0x83fa('0x20')](_0x83fa('0x22'),_0x49feed[_0x83fa('0x11')]['toLowerCase'](),_0x49feed['data2']));}}else{}}catch(_0x1a344d){console[_0x83fa('0x1e')](_0x1a344d);}}}}; \ No newline at end of file +var _0x7efa=['./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7efa,0xb3));var _0xa7ef=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x7efa[_0x3042c5];return _0x7cd140;};'use strict';var _=require('lodash');var util=require(_0xa7ef('0x0'));var zendesk=require(_0xa7ef('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xa7ef('0x2'));var freshdesk=require(_0xa7ef('0x3'));var zoho=require(_0xa7ef('0x4'));var desk=require(_0xa7ef('0x5'));var vtiger=require(_0xa7ef('0x6'));var servicenow=require(_0xa7ef('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xa7ef('0x8'));var integrations=[_0xa7ef('0x9'),_0xa7ef('0xa'),_0xa7ef('0xb'),_0xa7ef('0xc'),'zoho',_0xa7ef('0xd'),_0xa7ef('0xe'),_0xa7ef('0xf'),_0xa7ef('0x10'),_0xa7ef('0x11')];exports[_0xa7ef('0x12')]=function(_0x1b13a6,_0x182a06,_0xe3321,_0x3b996c,_0x13ea34,_0x544c39){if(_0xe3321){if(_['includes'](integrations,_0x1b13a6[_0xa7ef('0x13')][_0xa7ef('0x14')]())){try{var _0x1cb17=null;var _0x307c85='';var _0xf2b891=_0xe3321[_0x1b13a6[_0xa7ef('0x13')][_0xa7ef('0x14')]()];if(_0xf2b891){var _0x4823f7=_0xf2b891[_0x1b13a6['data2']];if(_0x4823f7){var _0x4a5c87=_['find'](_0x4823f7[_0xa7ef('0x15')],{'id':parseInt(_0x1b13a6['data3'],0xa)});if(_0x4a5c87){if(_0x3b996c){if(_0x13ea34&&_0x182a06[_0xa7ef('0x16')]){_0x307c85='queue';}else if(_0x182a06['routeId']){_0x307c85=_0xa7ef('0x17');}else{console[_0xa7ef('0x18')](_0xa7ef('0x19'),_0x182a06);}}else{_0x307c85=_0xa7ef('0x1a');}switch(_0x1b13a6[_0xa7ef('0x13')][_0xa7ef('0x14')]()){case'zendesk':zendesk[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0xa'):salesforce[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0xb'):sugarcrm[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0xc'):freshdesk[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0x1b'):zoho[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case'desk':desk[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0xe'):vtiger[_0x307c85](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39);break;case _0xa7ef('0x10'):freshsales['cs'](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39,_0x307c85);break;case _0xa7ef('0x11'):servicenow['cs'](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39,_0x307c85);break;case _0xa7ef('0xf'):dynamics365['cs'](_0x1b13a6,_0x182a06,_0x4a5c87,_0x3b996c,_0x13ea34,_0x4823f7,_0x544c39,_0x307c85);break;default:console['log'](_0xa7ef('0x1c'));}}else{_0x1cb17=require(_0xa7ef('0x1d'))(_0x1b13a6['data1'][_0xa7ef('0x14')]());_0x1cb17[_0xa7ef('0x1e')](_0xa7ef('0x1f'),util[_0xa7ef('0x20')](_0xa7ef('0x21'),_0x1b13a6[_0xa7ef('0x13')][_0xa7ef('0x14')](),_0x1b13a6[_0xa7ef('0x22')]));}}else{_0x1cb17=require(_0xa7ef('0x1d'))(_0x1b13a6['data1'][_0xa7ef('0x14')]());_0x1cb17['error'](_0xa7ef('0x1f'),util[_0xa7ef('0x20')](_0xa7ef('0x23'),_0x1b13a6['data1'][_0xa7ef('0x14')](),_0x1b13a6['data2']));}}else{}}catch(_0x4a2803){console['error'](_0x4a2803);}}}}; \ 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 b33ba1c..39b1fe9 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 _0x5557=['IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','$or','Contact','cloneDeep','additionalSearchLead','sobject','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','upperFirst','forEach','includes','type','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','[OUTBOUND]','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent','lodash','request-promise','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','localhost','socket.io-emitter','redis','emit','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet'];(function(_0xd57022,_0x1342d6){var _0x541170=function(_0xb1fba7){while(--_0xb1fba7){_0xd57022['push'](_0xd57022['shift']());}};_0x541170(++_0x1342d6);}(_0x5557,0x69));var _0x7555=function(_0x40df1e,_0x1377f1){_0x40df1e=_0x40df1e-0x0;var _0x3e3672=_0x5557[_0x40df1e];return _0x3e3672;};'use strict';var _=require(_0x7555('0x0'));var rp=require(_0x7555('0x1'));var moment=require('moment');var BPromise=require(_0x7555('0x2'));var md5=require('md5');var jsforce=require(_0x7555('0x3'));var util=require(_0x7555('0x4'));var Redis=require('ioredis');var intUtil=require(_0x7555('0x5'));var config=require(_0x7555('0x6'));var logger=require(_0x7555('0x7'))(_0x7555('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x7555('0x9'),'port':0x18eb});var io=require(_0x7555('0xa'))(new Redis(config[_0x7555('0xb')]));function emit(_0x4228cb,_0x49f5d1,_0x542dce){io['to'](_0x4228cb)[_0x7555('0xc')](_0x49f5d1,_0x542dce);}function getTicket(_0x51813b,_0x3adcfc,_0x54b8a7,_0x2ddb76,_0x23d0cd,_0x356d50,_0x2ceaf2,_0x3ca93e){var _0x59ee95=Object['assign']({},{'OwnerId':_0x3adcfc['id'],'Subject':intUtil[_0x7555('0xd')](_0x2ddb76['Subjects'],_0x23d0cd,'\x20'),'Description':intUtil[_0x7555('0xd')](_0x2ddb76[_0x7555('0xe')],_0x23d0cd,'\x0a')},getCustomFields(_0x356d50,_0x23d0cd));if(_0x54b8a7){if(_0x2ddb76[_0x7555('0xf')]==='Task'){_0x59ee95[_0x7555('0x10')]=moment[_0x7555('0x11')]();_0x59ee95[_0x7555('0x12')]=![];_0x59ee95[_0x7555('0x13')]=![];if(_0x54b8a7[_0x7555('0x14')]===_0x7555('0x15')||_0x54b8a7[_0x7555('0x14')]===_0x7555('0x16')){_0x59ee95[_0x7555('0x17')]=_0x54b8a7['id'];}else if(_0x54b8a7[_0x7555('0x14')]===_0x7555('0x18')){_0x59ee95[_0x7555('0x19')]=_0x54b8a7['id'];}}else if(_0x2ddb76[_0x7555('0xf')]===_0x7555('0x1a')){if(_0x54b8a7[_0x7555('0x14')]===_0x7555('0x15')){_0x59ee95[_0x7555('0x1b')]=_0x54b8a7['id'];}else if(_0x54b8a7['endUserType']===_0x7555('0x18')){_0x59ee95[_0x7555('0x1c')]=_0x54b8a7['id'];}else if(_0x54b8a7[_0x7555('0x14')]===_0x7555('0x16')&&_0x2ddb76[_0x7555('0x1d')]){_0x59ee95[_0x2ddb76[_0x7555('0x1d')]]=_0x54b8a7['id'];}else{logger[_0x7555('0x1e')](_0x7555('0x1f'));}}}return _0x2ceaf2['sobject'](_0x2ddb76[_0x7555('0xf')])[_0x7555('0x20')](_0x59ee95);}function getUser(_0xd46516,_0x3230b2,_0x259737){if(!_[_0x7555('0x21')](_0x3230b2)&&intUtil['validateEmail'](_0x3230b2)){var _0x2d5459={'Email':_0x3230b2};var _0x852f65={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x259737['sobject'](_0x7555('0x22'))['find'](_0x2d5459,_0x852f65)[_0x7555('0x23')]()[_0x7555('0x24')](function(_0x4cf07b){if(_0x4cf07b[_0x7555('0x25')]){var _0x502808=_[_0x7555('0x26')](_0x4cf07b,function(_0x3789b3){return _0x3789b3[_0x7555('0x27')]===_0x3230b2;});if(_0x502808){logger['info'](_0x7555('0x28'),_0x3230b2);return BPromise[_0x7555('0x29')]({'id':_0x502808['Id'],'name':_0x502808[_0x7555('0x2a')]});}}else{logger['info'](_0x7555('0x2b'),_0x3230b2);return _0x259737['identity']()[_0x7555('0x24')](function(_0x442f39){return BPromise[_0x7555('0x29')]({'id':_0x442f39[_0x7555('0x2c')],'name':_0x442f39[_0x7555('0x2d')]});});}});}else{logger[_0x7555('0x1e')](_0x7555('0x2b'),_0x3230b2);return _0x259737['identity']()['then'](function(_0x3eafcd){return BPromise[_0x7555('0x29')]({'id':_0x3eafcd[_0x7555('0x2c')],'name':_0x3eafcd[_0x7555('0x2d')]});});}}function getEndUser(_0x345da3,_0x24a81f,_0x2283ef,_0x19a479,_0x29dfcb){var _0x5218e9={'$or':{'Phone':_0x19a479}};var _0x219167={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7555('0x29')]()['then'](function(){logger[_0x7555('0x1e')](_0x7555('0x2e'),_0x19a479,_0x24a81f[_0x7555('0x2f')]);switch(_0x24a81f[_0x7555('0x2f')]){case _0x7555('0x30'):var _0x4619df=_['cloneDeep'](_0x5218e9);if(_0x24a81f['additionalSearchContact']){var _0x59f92f={};_0x59f92f[_0x24a81f['additionalSearchContact']]=_0x19a479;_[_0x7555('0x31')](_0x4619df[_0x7555('0x32')],_0x59f92f);}return _0x29dfcb['sobject'](_0x7555('0x33'))[_0x7555('0x26')](_0x4619df,_0x219167)[_0x7555('0x23')]()[_0x7555('0x24')](function(_0x2be38d){if(_0x2be38d&&_0x2be38d[_0x7555('0x25')]){return _0x2be38d;}else{var _0x3ac4a9=_[_0x7555('0x34')](_0x5218e9);if(_0x24a81f[_0x7555('0x35')]){var _0xe774e2={};_0xe774e2[_0x24a81f[_0x7555('0x35')]]=_0x19a479;_[_0x7555('0x31')](_0x3ac4a9[_0x7555('0x32')],_0xe774e2);}return _0x29dfcb[_0x7555('0x36')](_0x7555('0x37'))[_0x7555('0x26')](_0x3ac4a9,_0x219167);}});case _0x7555('0x38'):var _0x1bf010=_['cloneDeep'](_0x5218e9);if(_0x24a81f[_0x7555('0x39')]){var _0x59f92f={};_0x59f92f[_0x24a81f[_0x7555('0x39')]]=_0x19a479;_['merge'](_0x1bf010[_0x7555('0x32')],_0x59f92f);}return _0x29dfcb['sobject'](_0x7555('0x3a'))[_0x7555('0x26')](_0x1bf010,_0x219167)[_0x7555('0x23')]()[_0x7555('0x24')](function(_0x2cd10d){if(_0x2cd10d&&_0x2cd10d[_0x7555('0x25')]){return _0x2cd10d;}else{var _0x278310=_[_0x7555('0x34')](_0x5218e9);if(_0x24a81f[_0x7555('0x3b')]){var _0x4d3d4d={};_0x4d3d4d[_0x24a81f[_0x7555('0x3b')]]=_0x19a479;_[_0x7555('0x31')](_0x278310[_0x7555('0x32')],_0x4d3d4d);}return _0x29dfcb[_0x7555('0x36')]('Contact')['find'](_0x278310,_0x219167)[_0x7555('0x24')](function(_0x45086d){if(_0x45086d&&_0x45086d['length']){return _0x45086d;}else{var _0x463ef1=_['cloneDeep'](_0x5218e9);if(_0x24a81f['additionalSearchLead']){var _0x1cf7e9={};_0x1cf7e9[_0x24a81f['additionalSearchLead']]=_0x19a479;_[_0x7555('0x31')](_0x463ef1[_0x7555('0x32')],_0x1cf7e9);}return _0x29dfcb[_0x7555('0x36')](_0x7555('0x37'))[_0x7555('0x26')](_0x463ef1,_0x219167);}});}});case _0x7555('0x15'):var _0x4619df=_[_0x7555('0x34')](_0x5218e9);if(_0x24a81f[_0x7555('0x3b')]){var _0x59f92f={};_0x59f92f[_0x24a81f[_0x7555('0x3b')]]=_0x19a479;_['merge'](_0x4619df[_0x7555('0x32')],_0x59f92f);}return _0x29dfcb[_0x7555('0x36')]('Contact')[_0x7555('0x26')](_0x4619df,_0x219167)[_0x7555('0x23')]();case _0x7555('0x16'):var _0x260d05=_[_0x7555('0x34')](_0x5218e9);if(_0x24a81f[_0x7555('0x35')]){var _0x59f92f={};_0x59f92f[_0x24a81f[_0x7555('0x35')]]=_0x19a479;_[_0x7555('0x31')](_0x260d05[_0x7555('0x32')],_0x59f92f);}return _0x29dfcb[_0x7555('0x36')]('Lead')['find'](_0x260d05,_0x219167);case'account':var _0x1bf010=_[_0x7555('0x34')](_0x5218e9);if(_0x24a81f['additionalSearchAccount']){var _0x59f92f={};_0x59f92f[_0x24a81f[_0x7555('0x39')]]=_0x19a479;_['merge'](_0x1bf010[_0x7555('0x32')],_0x59f92f);}return _0x29dfcb[_0x7555('0x36')](_0x7555('0x3a'))[_0x7555('0x26')](_0x1bf010,_0x219167);default:return null;}})[_0x7555('0x24')](function(_0x2d7a84){if(_0x2d7a84&&_0x2d7a84[_0x7555('0x25')]){var _0x461d9c=_['first'](_0x2d7a84);if(_0x461d9c){return BPromise[_0x7555('0x29')]({'id':_0x461d9c['Id'],'name':_0x461d9c[_0x7555('0x2a')],'phone':_0x461d9c['Phone'],'endUserType':_0x461d9c[_0x7555('0x3c')]['type'][_0x7555('0x3d')]()});}}})[_0x7555('0x24')](function(_0x111387){if(_0x111387){logger[_0x7555('0x1e')](_0x7555('0x3e'),_0x111387['endUserType'],_0x19a479);return BPromise[_0x7555('0x29')](_0x111387);}else{logger[_0x7555('0x1e')](_0x7555('0x3f'),_0x19a479);var _0x49c1f0={'Phone':_0x19a479};if(_0x24a81f['moduleCreate']){if(_0x24a81f[_0x7555('0x40')]===_0x7555('0x15')){logger[_0x7555('0x1e')](_0x7555('0x41'),_0x19a479,_0x24a81f['moduleCreate']);_0x49c1f0['LastName']=_0x2283ef!==_0x7555('0x42')?_0x2283ef:util[_0x7555('0x43')](_0x7555('0x44'),_0x19a479);}else if(_0x24a81f[_0x7555('0x40')]===_0x7555('0x16')){logger[_0x7555('0x1e')](_0x7555('0x41'),_0x19a479,_0x24a81f[_0x7555('0x40')]);_0x49c1f0[_0x7555('0x45')]=_0x2283ef!==_0x7555('0x42')?_0x2283ef:util[_0x7555('0x43')](_0x7555('0x44'),_0x19a479);_0x49c1f0[_0x7555('0x46')]='No\x20Company';}else if(_0x24a81f[_0x7555('0x40')]===_0x7555('0x18')){logger[_0x7555('0x1e')](_0x7555('0x41'),_0x19a479,_0x24a81f[_0x7555('0x40')]);_0x49c1f0[_0x7555('0x2a')]=_0x2283ef!==_0x7555('0x42')?_0x2283ef:util[_0x7555('0x43')](_0x7555('0x44'),_0x19a479);}else{return null;}}return _0x29dfcb['sobject'](_[_0x7555('0x47')](_0x24a81f['moduleCreate']))[_0x7555('0x20')](_0x49c1f0)[_0x7555('0x24')](function(_0x456918){return BPromise['resolve']({'id':_0x456918['id'],'endUserType':_0x24a81f[_0x7555('0x40')]});});}});}function getCustomFields(_0x3adddb,_0x9afe8e){var _0x269af9={};if(_0x3adddb['length']>0x0){_[_0x7555('0x48')](_0x3adddb,function(_0x4e52b2){if(_[_0x7555('0x49')](['string','picklist'],_0x4e52b2[_0x7555('0x4a')])&&_0x4e52b2[_0x7555('0x4b')]){_0x269af9[_0x4e52b2[_0x7555('0x4b')]]=_0x4e52b2[_0x7555('0x4c')][_0x7555('0x4d')]();}else if(_0x4e52b2[_0x7555('0x4a')]==='variable'&&_0x4e52b2['variableName']&&_0x4e52b2[_0x7555('0x4b')]){_0x9afe8e[_0x4e52b2['variableName']]&&(_0x269af9[_0x4e52b2[_0x7555('0x4b')]]=_0x9afe8e[_0x4e52b2[_0x7555('0x4e')]]['toString']());}else if(_0x4e52b2[_0x7555('0x4a')]===_0x7555('0x4f')&&_0x4e52b2[_0x7555('0x50')]&&_0x4e52b2['Variable'][_0x7555('0x51')]&&_0x4e52b2['idField']){_0x9afe8e[_0x4e52b2[_0x7555('0x50')][_0x7555('0x51')][_0x7555('0x3d')]()]&&(_0x269af9[_0x4e52b2['idField']]=_0x9afe8e[_0x4e52b2['Variable'][_0x7555('0x51')][_0x7555('0x3d')]()][_0x7555('0x4d')]());}});}return _0x269af9;}function getConnection(_0x5ef430){var _0x30c50b=_0x5ef430[_0x7555('0x52')][_0x7555('0x53')](_0x5ef430[_0x7555('0x54')]);var _0x410d4d=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5ef430[_0x7555('0x55')]||_0x7555('0x56'),'clientId':_0x5ef430[_0x7555('0x57')],'clientSecret':_0x5ef430[_0x7555('0x58')]}});return _0x410d4d[_0x7555('0x59')](_0x5ef430['username'],_0x30c50b)[_0x7555('0x24')](function(){logger[_0x7555('0x1e')](_0x7555('0x5a'));return _0x410d4d;});}exports[_0x7555('0x5b')]=function(_0x14519f,_0x20e339,_0x5bb6e0,_0x55b096,_0x5c05c3,_0x53a172){var _0x317172,_0x5663db,_0x53ee4c,_0x15e139;_0x53a172[_0x7555('0x5c')]=intUtil[_0x7555('0x5d')](_0x53a172[_0x7555('0x5c')]);_0x53a172[_0x7555('0x55')]=intUtil['stripTrailingSlash'](_0x53a172[_0x7555('0x55')]);if(_0x5c05c3&&_0x5c05c3[_0x7555('0x5e')]){logger[_0x7555('0x1e')](_0x7555('0x5f'),'Recording\x20is\x20enabled!');_0x20e339[_0x7555('0x60')]=util[_0x7555('0x43')](_0x7555('0x61'),_0x53a172[_0x7555('0x5c')],_0x20e339[_0x7555('0x62')],md5(_0x20e339['uniqueid']));}else{_0x20e339[_0x7555('0x60')]='';}return getConnection(_0x53a172)[_0x7555('0x24')](function(_0x4dcd86){_0x15e139=_0x4dcd86;return getUser(_0x53a172,_0x55b096[_0x7555('0x63')],_0x15e139);})[_0x7555('0x24')](function(_0x5e1c67){_0x317172=_0x5e1c67;return getEndUser(_0x53a172,_0x5bb6e0,_0x20e339[_0x7555('0x64')],_0x20e339[_0x7555('0x65')],_0x15e139);})[_0x7555('0x24')](function(_0x44c54d){_0x5663db=_0x44c54d;return getTicket(_0x53a172,_0x317172,_0x5663db,_0x5bb6e0,_0x20e339,_0x5bb6e0[_0x7555('0x66')],_0x15e139,_0x7555('0x5b'));})[_0x7555('0x24')](function(_0x1387e8){_0x53ee4c=_0x1387e8;logger['info'](_0x7555('0x67'),_0x53ee4c['id']);logger['info'](_0x7555('0x68'),_0x53ee4c['id'],_0x55b096[_0x7555('0x51')],_0x53a172[_0x7555('0x4a')]);switch(_0x53a172['type']){case'integrationTab':emit(util[_0x7555('0x43')]('user:%s',_0x55b096[_0x7555('0x51')]),_0x7555('0x69'),{'recordId':_0x53ee4c['id']});break;case _0x7555('0x6a'):emit(util[_0x7555('0x43')]('user:%s',_0x55b096['name']),_0x7555('0x6b'),{'uri':util[_0x7555('0x43')](_0x7555('0x6c'),_0x15e139['instanceUrl'],_0x53ee4c['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7555('0x6d')](function(_0x1c03dc){logger[_0x7555('0x6e')](_0x7555('0x5f'),_0x1c03dc);});};exports[_0x7555('0x6f')]=function(_0x3c3f12,_0x375acd,_0x45560e,_0x173f9e,_0x57a0b6,_0xd2b4,_0x14e835){var _0x467cd7,_0x18f1ee,_0x58dbfe,_0x48bd7f;_0xd2b4['serverUrl']=intUtil[_0x7555('0x5d')](_0xd2b4[_0x7555('0x5c')]);_0xd2b4[_0x7555('0x55')]=intUtil[_0x7555('0x5d')](_0xd2b4[_0x7555('0x55')]);if(_0x14e835&&_0x14e835[_0x7555('0x70')]&&_0x14e835[_0x7555('0x70')]!==_0x7555('0x71')){logger['info']('[OUTBOUND]',_0x7555('0x72'));_0x375acd[_0x7555('0x60')]=util[_0x7555('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd2b4['serverUrl'],_0x375acd[_0x7555('0x62')],md5(_0x375acd[_0x7555('0x62')]));}return getConnection(_0xd2b4)[_0x7555('0x24')](function(_0x4f7bd8){_0x48bd7f=_0x4f7bd8;return getUser(_0xd2b4,_0x173f9e[_0x7555('0x63')],_0x48bd7f);})[_0x7555('0x24')](function(_0x131df3){_0x467cd7=_0x131df3;return getEndUser(_0xd2b4,_0x45560e,_0x375acd[_0x7555('0x73')],_0x375acd[_0x7555('0x74')],_0x48bd7f);})[_0x7555('0x24')](function(_0xf44e62){_0x18f1ee=_0xf44e62;return getTicket(_0xd2b4,_0x467cd7,_0x18f1ee,_0x45560e,_0x375acd,_0x45560e[_0x7555('0x66')],_0x48bd7f,_0x7555('0x6f'));})[_0x7555('0x24')](function(_0x57ef02){_0x58dbfe=_0x57ef02;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x58dbfe['id']);logger[_0x7555('0x1e')](_0x7555('0x75'),_0x58dbfe['id'],_0x173f9e['name'],_0xd2b4[_0x7555('0x4a')]);switch(_0xd2b4[_0x7555('0x4a')]){case _0x7555('0x76'):emit(util['format'](_0x7555('0x77'),_0x173f9e[_0x7555('0x51')]),_0x7555('0x69'),{'recordId':_0x58dbfe['id']});break;case _0x7555('0x6a'):emit(util[_0x7555('0x43')]('user:%s',_0x173f9e['name']),_0x7555('0x6b'),{'uri':util[_0x7555('0x43')](_0x7555('0x6c'),_0x48bd7f['instanceUrl'],_0x58dbfe['id'])});break;default:logger['error'](_0x7555('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7555('0x6d')](function(_0x58217e){logger[_0x7555('0x6e')](_0x7555('0x78'),_0x58217e);});};exports['unmanaged']=function(_0x1c6a6f,_0x3e307b,_0x2491e1,_0xd91dd,_0x4b9437,_0x3cc41a){var _0x159950,_0x529540,_0x4c3652,_0x3a3b1f;_0x3cc41a[_0x7555('0x5c')]=intUtil['stripTrailingSlash'](_0x3cc41a[_0x7555('0x5c')]);_0x3cc41a['remoteUri']=intUtil[_0x7555('0x5d')](_0x3cc41a[_0x7555('0x55')]);if(_0x4b9437&&_0x4b9437[_0x7555('0x5e')]){logger[_0x7555('0x1e')]('['+_0x3e307b['lastevent'][_0x7555('0x79')]()+']',_0x7555('0x72'));_0x3e307b[_0x7555('0x60')]=util[_0x7555('0x43')](_0x7555('0x61'),_0x3cc41a[_0x7555('0x5c')],_0x3e307b[_0x7555('0x62')],md5(_0x3e307b[_0x7555('0x62')]));}else{_0x3e307b['recordingURL']='';}return getConnection(_0x3cc41a)['then'](function(_0x2999d1){_0x3a3b1f=_0x2999d1;if(!_[_0x7555('0x21')](_0xd91dd)){return getUser(_0x3cc41a,_0xd91dd[_0x7555('0x51')],_0x3a3b1f);}else{return getUser(_0x3cc41a,null,_0x3a3b1f);}})[_0x7555('0x24')](function(_0x360cb0){_0x159950=_0x360cb0;return getEndUser(_0x3cc41a,_0x2491e1,_0x3e307b[_0x7555('0x64')],_0x3e307b[_0x7555('0x65')],_0x3a3b1f);})['then'](function(_0x48ed03){_0x529540=_0x48ed03;return getTicket(_0x3cc41a,_0x159950,_0x529540,_0x2491e1,_0x3e307b,_0x2491e1[_0x7555('0x66')],_0x3a3b1f);})['then'](function(_0x203fab){_0x4c3652=_0x203fab;logger[_0x7555('0x1e')]('['+_0x3e307b['lastevent']['toUpperCase']()+_0x7555('0x7a'),_0x4c3652['id']);logger['info']('['+_0x3e307b[_0x7555('0x7b')][_0x7555('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3cc41a[_0x7555('0x4a')]);})[_0x7555('0x6d')](function(_0x25948c){logger[_0x7555('0x6e')]('['+_0x3e307b['lastevent'][_0x7555('0x79')]()+']',_0x25948c);});}; \ No newline at end of file +var _0xb14b=['md5','jsforce','util','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit','assign','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','find','execute','Email','resolve','Name','identity','then','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','length','cloneDeep','additionalSearchAccount','Account','additionalSearchLead','Lead','first','Phone','attributes','type','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','create','forEach','includes','idField','toString','variableName','Variable','toLowerCase','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','request-promise','moment','bluebird'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xb14b,0xf3));var _0xbb14=function(_0x3c78c0,_0x3fdb5e){_0x3c78c0=_0x3c78c0-0x0;var _0x4642cf=_0xb14b[_0x3c78c0];return _0x4642cf;};'use strict';var _=require('lodash');var rp=require(_0xbb14('0x0'));var moment=require(_0xbb14('0x1'));var BPromise=require(_0xbb14('0x2'));var md5=require(_0xbb14('0x3'));var jsforce=require(_0xbb14('0x4'));var util=require(_0xbb14('0x5'));var Redis=require('ioredis');var intUtil=require(_0xbb14('0x6'));var config=require(_0xbb14('0x7'));var logger=require('../../../../config/logger')(_0xbb14('0x8'));config[_0xbb14('0x9')]=_[_0xbb14('0xa')](config['redis'],{'host':_0xbb14('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x553000,_0x42eaca,_0x45e8ca){io['to'](_0x553000)[_0xbb14('0xc')](_0x42eaca,_0x45e8ca);}function getTicket(_0x30716b,_0x5b0450,_0x198394,_0x98effd,_0x47a319,_0x11a90a,_0x1301c9,_0x4aac45){var _0x26516c=Object[_0xbb14('0xd')]({},{'OwnerId':_0x5b0450['id'],'Subject':intUtil[_0xbb14('0xe')](_0x98effd['Subjects'],_0x47a319,'\x20'),'Description':intUtil[_0xbb14('0xe')](_0x98effd['Descriptions'],_0x47a319,'\x0a')},getCustomFields(_0x11a90a,_0x47a319));if(_0x198394){if(_0x98effd[_0xbb14('0xf')]===_0xbb14('0x10')){_0x26516c[_0xbb14('0x11')]=moment[_0xbb14('0x12')]();_0x26516c[_0xbb14('0x13')]=![];_0x26516c[_0xbb14('0x14')]=![];if(_0x198394[_0xbb14('0x15')]===_0xbb14('0x16')||_0x198394['endUserType']===_0xbb14('0x17')){_0x26516c[_0xbb14('0x18')]=_0x198394['id'];}else if(_0x198394[_0xbb14('0x15')]===_0xbb14('0x19')){_0x26516c[_0xbb14('0x1a')]=_0x198394['id'];}}else if(_0x98effd[_0xbb14('0xf')]==='Case'){if(_0x198394[_0xbb14('0x15')]===_0xbb14('0x16')){_0x26516c['ContactId']=_0x198394['id'];}else if(_0x198394['endUserType']==='account'){_0x26516c[_0xbb14('0x1b')]=_0x198394['id'];}else if(_0x198394[_0xbb14('0x15')]===_0xbb14('0x17')&&_0x98effd[_0xbb14('0x1c')]){_0x26516c[_0x98effd['leadId']]=_0x198394['id'];}else{logger[_0xbb14('0x1d')](_0xbb14('0x1e'));}}}return _0x1301c9[_0xbb14('0x1f')](_0x98effd[_0xbb14('0xf')])['create'](_0x26516c);}function getUser(_0x28ab4a,_0x647557,_0x1d755a){if(!_[_0xbb14('0x20')](_0x647557)&&intUtil['validateEmail'](_0x647557)){var _0x5ee93c={'Email':_0x647557};var _0x3f2a48={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1d755a[_0xbb14('0x1f')](_0xbb14('0x21'))[_0xbb14('0x22')](_0x5ee93c,_0x3f2a48)[_0xbb14('0x23')]()['then'](function(_0x33f5d1){if(_0x33f5d1['length']){var _0x5893d1=_[_0xbb14('0x22')](_0x33f5d1,function(_0x22570f){return _0x22570f[_0xbb14('0x24')]===_0x647557;});if(_0x5893d1){logger[_0xbb14('0x1d')]('Agent\x20%s\x20found.',_0x647557);return BPromise[_0xbb14('0x25')]({'id':_0x5893d1['Id'],'name':_0x5893d1[_0xbb14('0x26')]});}}else{logger[_0xbb14('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x647557);return _0x1d755a[_0xbb14('0x27')]()[_0xbb14('0x28')](function(_0x6994f9){return BPromise[_0xbb14('0x25')]({'id':_0x6994f9[_0xbb14('0x29')],'name':_0x6994f9['display_name']});});}});}else{logger[_0xbb14('0x1d')](_0xbb14('0x2a'),_0x647557);return _0x1d755a['identity']()[_0xbb14('0x28')](function(_0x32c999){return BPromise['resolve']({'id':_0x32c999['user_id'],'name':_0x32c999[_0xbb14('0x2b')]});});}}function getEndUser(_0xfe2ae5,_0x2d9ebd,_0x2d0a87,_0x3240b1,_0x1f6c11){var _0x2d9086={'$or':{'Phone':_0x3240b1}};var _0x407bbc={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbb14('0x25')]()['then'](function(){logger[_0xbb14('0x1d')](_0xbb14('0x2c'),_0x3240b1,_0x2d9ebd[_0xbb14('0x2d')]);switch(_0x2d9ebd[_0xbb14('0x2d')]){case _0xbb14('0x2e'):var _0x24fa23=_['cloneDeep'](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x2f')]){var _0x5d6fd1={};_0x5d6fd1[_0x2d9ebd['additionalSearchContact']]=_0x3240b1;_[_0xbb14('0x30')](_0x24fa23[_0xbb14('0x31')],_0x5d6fd1);}return _0x1f6c11[_0xbb14('0x1f')](_0xbb14('0x32'))[_0xbb14('0x22')](_0x24fa23,_0x407bbc)['execute']()[_0xbb14('0x28')](function(_0x281dd9){if(_0x281dd9&&_0x281dd9[_0xbb14('0x33')]){return _0x281dd9;}else{var _0x59ac67=_[_0xbb14('0x34')](_0x2d9086);if(_0x2d9ebd['additionalSearchLead']){var _0x20cdd4={};_0x20cdd4[_0x2d9ebd['additionalSearchLead']]=_0x3240b1;_[_0xbb14('0x30')](_0x59ac67[_0xbb14('0x31')],_0x20cdd4);}return _0x1f6c11[_0xbb14('0x1f')]('Lead')[_0xbb14('0x22')](_0x59ac67,_0x407bbc);}});case'account_contact_lead':var _0x11434f=_['cloneDeep'](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x35')]){var _0x5d6fd1={};_0x5d6fd1[_0x2d9ebd[_0xbb14('0x35')]]=_0x3240b1;_[_0xbb14('0x30')](_0x11434f[_0xbb14('0x31')],_0x5d6fd1);}return _0x1f6c11[_0xbb14('0x1f')](_0xbb14('0x36'))['find'](_0x11434f,_0x407bbc)['execute']()[_0xbb14('0x28')](function(_0x5de3c1){if(_0x5de3c1&&_0x5de3c1[_0xbb14('0x33')]){return _0x5de3c1;}else{var _0x26ea17=_[_0xbb14('0x34')](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x2f')]){var _0x54f2b0={};_0x54f2b0[_0x2d9ebd['additionalSearchContact']]=_0x3240b1;_[_0xbb14('0x30')](_0x26ea17[_0xbb14('0x31')],_0x54f2b0);}return _0x1f6c11[_0xbb14('0x1f')](_0xbb14('0x32'))[_0xbb14('0x22')](_0x26ea17,_0x407bbc)[_0xbb14('0x28')](function(_0x4bc4ca){if(_0x4bc4ca&&_0x4bc4ca['length']){return _0x4bc4ca;}else{var _0x590d24=_[_0xbb14('0x34')](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x37')]){var _0x12e77d={};_0x12e77d[_0x2d9ebd['additionalSearchLead']]=_0x3240b1;_[_0xbb14('0x30')](_0x590d24[_0xbb14('0x31')],_0x12e77d);}return _0x1f6c11['sobject'](_0xbb14('0x38'))[_0xbb14('0x22')](_0x590d24,_0x407bbc);}});}});case'contact':var _0x24fa23=_['cloneDeep'](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x2f')]){var _0x5d6fd1={};_0x5d6fd1[_0x2d9ebd[_0xbb14('0x2f')]]=_0x3240b1;_['merge'](_0x24fa23[_0xbb14('0x31')],_0x5d6fd1);}return _0x1f6c11['sobject'](_0xbb14('0x32'))[_0xbb14('0x22')](_0x24fa23,_0x407bbc)[_0xbb14('0x23')]();case _0xbb14('0x17'):var _0x581d29=_['cloneDeep'](_0x2d9086);if(_0x2d9ebd[_0xbb14('0x37')]){var _0x5d6fd1={};_0x5d6fd1[_0x2d9ebd[_0xbb14('0x37')]]=_0x3240b1;_[_0xbb14('0x30')](_0x581d29[_0xbb14('0x31')],_0x5d6fd1);}return _0x1f6c11[_0xbb14('0x1f')](_0xbb14('0x38'))[_0xbb14('0x22')](_0x581d29,_0x407bbc);case _0xbb14('0x19'):var _0x11434f=_['cloneDeep'](_0x2d9086);if(_0x2d9ebd['additionalSearchAccount']){var _0x5d6fd1={};_0x5d6fd1[_0x2d9ebd[_0xbb14('0x35')]]=_0x3240b1;_['merge'](_0x11434f[_0xbb14('0x31')],_0x5d6fd1);}return _0x1f6c11[_0xbb14('0x1f')]('Account')['find'](_0x11434f,_0x407bbc);default:return null;}})[_0xbb14('0x28')](function(_0x443849){if(_0x443849&&_0x443849[_0xbb14('0x33')]){var _0x38943c=_[_0xbb14('0x39')](_0x443849);if(_0x38943c){return BPromise[_0xbb14('0x25')]({'id':_0x38943c['Id'],'name':_0x38943c[_0xbb14('0x26')],'phone':_0x38943c[_0xbb14('0x3a')],'endUserType':_0x38943c[_0xbb14('0x3b')][_0xbb14('0x3c')]['toLowerCase']()});}}})['then'](function(_0x5c9092){if(_0x5c9092){logger[_0xbb14('0x1d')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5c9092[_0xbb14('0x15')],_0x3240b1);return BPromise[_0xbb14('0x25')](_0x5c9092);}else{logger['info'](_0xbb14('0x3d'),_0x3240b1);var _0x5e9a19={'Phone':_0x3240b1};if(_0x2d9ebd['moduleCreate']){if(_0x2d9ebd[_0xbb14('0x3e')]===_0xbb14('0x16')){logger['info'](_0xbb14('0x3f'),_0x3240b1,_0x2d9ebd[_0xbb14('0x3e')]);_0x5e9a19[_0xbb14('0x40')]=_0x2d0a87!==_0xbb14('0x41')?_0x2d0a87:util['format'](_0xbb14('0x42'),_0x3240b1);}else if(_0x2d9ebd['moduleCreate']===_0xbb14('0x17')){logger[_0xbb14('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3240b1,_0x2d9ebd[_0xbb14('0x3e')]);_0x5e9a19[_0xbb14('0x40')]=_0x2d0a87!==_0xbb14('0x41')?_0x2d0a87:util[_0xbb14('0x43')]('Caller\x20-\x20%s',_0x3240b1);_0x5e9a19[_0xbb14('0x44')]=_0xbb14('0x45');}else if(_0x2d9ebd[_0xbb14('0x3e')]==='account'){logger[_0xbb14('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3240b1,_0x2d9ebd[_0xbb14('0x3e')]);_0x5e9a19[_0xbb14('0x26')]=_0x2d0a87!==_0xbb14('0x41')?_0x2d0a87:util['format'](_0xbb14('0x42'),_0x3240b1);}else{return null;}}return _0x1f6c11[_0xbb14('0x1f')](_[_0xbb14('0x46')](_0x2d9ebd[_0xbb14('0x3e')]))[_0xbb14('0x47')](_0x5e9a19)['then'](function(_0x75395a){return BPromise[_0xbb14('0x25')]({'id':_0x75395a['id'],'endUserType':_0x2d9ebd['moduleCreate']});});}});}function getCustomFields(_0x1d6f2d,_0x5b8c1d){var _0x3d2e6e={};if(_0x1d6f2d[_0xbb14('0x33')]>0x0){_[_0xbb14('0x48')](_0x1d6f2d,function(_0x361c31){if(_[_0xbb14('0x49')](['string','picklist'],_0x361c31[_0xbb14('0x3c')])&&_0x361c31['idField']){_0x3d2e6e[_0x361c31[_0xbb14('0x4a')]]=_0x361c31['content'][_0xbb14('0x4b')]();}else if(_0x361c31[_0xbb14('0x3c')]==='variable'&&_0x361c31[_0xbb14('0x4c')]&&_0x361c31['idField']){_0x5b8c1d[_0x361c31['variableName']]&&(_0x3d2e6e[_0x361c31[_0xbb14('0x4a')]]=_0x5b8c1d[_0x361c31['variableName']][_0xbb14('0x4b')]());}else if(_0x361c31['type']==='customVariable'&&_0x361c31[_0xbb14('0x4d')]&&_0x361c31[_0xbb14('0x4d')]['name']&&_0x361c31[_0xbb14('0x4a')]){_0x5b8c1d[_0x361c31[_0xbb14('0x4d')]['name'][_0xbb14('0x4e')]()]&&(_0x3d2e6e[_0x361c31[_0xbb14('0x4a')]]=_0x5b8c1d[_0x361c31['Variable'][_0xbb14('0x4f')][_0xbb14('0x4e')]()][_0xbb14('0x4b')]());}});}return _0x3d2e6e;}function getConnection(_0x39c91e){var _0x334059=_0x39c91e[_0xbb14('0x50')]['concat'](_0x39c91e[_0xbb14('0x51')]);var _0x55220b=new jsforce[(_0xbb14('0x52'))]({'oauth2':{'loginUrl':_0x39c91e['remoteUri']||_0xbb14('0x53'),'clientId':_0x39c91e[_0xbb14('0x54')],'clientSecret':_0x39c91e[_0xbb14('0x55')]}});return _0x55220b['login'](_0x39c91e['username'],_0x334059)[_0xbb14('0x28')](function(){logger[_0xbb14('0x1d')](_0xbb14('0x56'));return _0x55220b;});}exports[_0xbb14('0x57')]=function(_0x328bbd,_0x1e4fd0,_0x9454a7,_0x640b67,_0x2da66e,_0x327999){var _0x386278,_0x2542ac,_0x5aeb70,_0x1e1ce6;_0x327999[_0xbb14('0x58')]=intUtil['stripTrailingSlash'](_0x327999[_0xbb14('0x58')]);_0x327999[_0xbb14('0x59')]=intUtil[_0xbb14('0x5a')](_0x327999[_0xbb14('0x59')]);if(_0x2da66e&&_0x2da66e[_0xbb14('0x5b')]){logger[_0xbb14('0x1d')](_0xbb14('0x5c'),_0xbb14('0x5d'));_0x1e4fd0[_0xbb14('0x5e')]=util['format'](_0xbb14('0x5f'),_0x327999[_0xbb14('0x58')],_0x1e4fd0[_0xbb14('0x60')],md5(_0x1e4fd0[_0xbb14('0x60')]));}else{_0x1e4fd0[_0xbb14('0x5e')]='';}return getConnection(_0x327999)[_0xbb14('0x28')](function(_0x34c979){_0x1e1ce6=_0x34c979;return getUser(_0x327999,_0x640b67[_0xbb14('0x61')],_0x1e1ce6);})[_0xbb14('0x28')](function(_0x4fcea2){_0x386278=_0x4fcea2;return getEndUser(_0x327999,_0x9454a7,_0x1e4fd0[_0xbb14('0x62')],_0x1e4fd0[_0xbb14('0x63')],_0x1e1ce6);})[_0xbb14('0x28')](function(_0x1b99ee){_0x2542ac=_0x1b99ee;return getTicket(_0x327999,_0x386278,_0x2542ac,_0x9454a7,_0x1e4fd0,_0x9454a7[_0xbb14('0x64')],_0x1e1ce6,'queue');})['then'](function(_0x50601f){_0x5aeb70=_0x50601f;logger[_0xbb14('0x1d')](_0xbb14('0x65'),_0x5aeb70['id']);logger[_0xbb14('0x1d')](_0xbb14('0x66'),_0x5aeb70['id'],_0x640b67[_0xbb14('0x4f')],_0x327999['type']);switch(_0x327999[_0xbb14('0x3c')]){case _0xbb14('0x67'):emit(util[_0xbb14('0x43')]('user:%s',_0x640b67[_0xbb14('0x4f')]),_0xbb14('0x68'),{'recordId':_0x5aeb70['id']});break;case'newTab':emit(util[_0xbb14('0x43')](_0xbb14('0x69'),_0x640b67[_0xbb14('0x4f')]),_0xbb14('0x6a'),{'uri':util[_0xbb14('0x43')](_0xbb14('0x6b'),_0x1e1ce6[_0xbb14('0x6c')],_0x5aeb70['id'])});break;default:logger[_0xbb14('0x6d')](_0xbb14('0x6e'));}})[_0xbb14('0x6f')](function(_0x41617c){logger[_0xbb14('0x6d')](_0xbb14('0x5c'),_0x41617c);});};exports['outbound']=function(_0x2926bd,_0x133f2c,_0x129057,_0x4b8ec1,_0x59b130,_0x29d77a,_0x4e3d5e){var _0x422588,_0x2b5136,_0x5ded4a,_0x102a85;_0x29d77a[_0xbb14('0x58')]=intUtil['stripTrailingSlash'](_0x29d77a[_0xbb14('0x58')]);_0x29d77a['remoteUri']=intUtil[_0xbb14('0x5a')](_0x29d77a[_0xbb14('0x59')]);if(_0x4e3d5e&&_0x4e3d5e['recordingFormat']&&_0x4e3d5e[_0xbb14('0x70')]!==_0xbb14('0x71')){logger[_0xbb14('0x1d')](_0xbb14('0x72'),_0xbb14('0x5d'));_0x133f2c[_0xbb14('0x5e')]=util[_0xbb14('0x43')](_0xbb14('0x5f'),_0x29d77a[_0xbb14('0x58')],_0x133f2c['uniqueid'],md5(_0x133f2c[_0xbb14('0x60')]));}return getConnection(_0x29d77a)[_0xbb14('0x28')](function(_0x382f0e){_0x102a85=_0x382f0e;return getUser(_0x29d77a,_0x4b8ec1[_0xbb14('0x61')],_0x102a85);})[_0xbb14('0x28')](function(_0x575e54){_0x422588=_0x575e54;return getEndUser(_0x29d77a,_0x129057,_0x133f2c['destcalleridname'],_0x133f2c['destcalleridnum'],_0x102a85);})[_0xbb14('0x28')](function(_0x374d09){_0x2b5136=_0x374d09;return getTicket(_0x29d77a,_0x422588,_0x2b5136,_0x129057,_0x133f2c,_0x129057[_0xbb14('0x64')],_0x102a85,_0xbb14('0x73'));})[_0xbb14('0x28')](function(_0x1d6ab2){_0x5ded4a=_0x1d6ab2;logger[_0xbb14('0x1d')](_0xbb14('0x74'),_0x5ded4a['id']);logger[_0xbb14('0x1d')](_0xbb14('0x75'),_0x5ded4a['id'],_0x4b8ec1[_0xbb14('0x4f')],_0x29d77a[_0xbb14('0x3c')]);switch(_0x29d77a[_0xbb14('0x3c')]){case'integrationTab':emit(util[_0xbb14('0x43')](_0xbb14('0x69'),_0x4b8ec1['name']),'trigger:salesforce:display',{'recordId':_0x5ded4a['id']});break;case _0xbb14('0x76'):emit(util[_0xbb14('0x43')](_0xbb14('0x69'),_0x4b8ec1['name']),_0xbb14('0x6a'),{'uri':util['format'](_0xbb14('0x6b'),_0x102a85['instanceUrl'],_0x5ded4a['id'])});break;default:logger[_0xbb14('0x6d')](_0xbb14('0x72'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x3e6f3a){logger[_0xbb14('0x6d')]('[OUTBOUND]',_0x3e6f3a);});};exports[_0xbb14('0x77')]=function(_0x3078b0,_0x4938f2,_0x9fa243,_0x3dbf0c,_0x15d718,_0x3bdd6f){var _0x428f06,_0x591eb8,_0x38e3a8,_0x3e462e;_0x3bdd6f['serverUrl']=intUtil[_0xbb14('0x5a')](_0x3bdd6f[_0xbb14('0x58')]);_0x3bdd6f[_0xbb14('0x59')]=intUtil['stripTrailingSlash'](_0x3bdd6f[_0xbb14('0x59')]);if(_0x15d718&&_0x15d718[_0xbb14('0x5b')]){logger[_0xbb14('0x1d')]('['+_0x4938f2[_0xbb14('0x78')]['toUpperCase']()+']',_0xbb14('0x5d'));_0x4938f2['recordingURL']=util[_0xbb14('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3bdd6f[_0xbb14('0x58')],_0x4938f2['uniqueid'],md5(_0x4938f2[_0xbb14('0x60')]));}else{_0x4938f2[_0xbb14('0x5e')]='';}return getConnection(_0x3bdd6f)[_0xbb14('0x28')](function(_0x70efcb){_0x3e462e=_0x70efcb;if(!_['isNil'](_0x3dbf0c)){return getUser(_0x3bdd6f,_0x3dbf0c[_0xbb14('0x4f')],_0x3e462e);}else{return getUser(_0x3bdd6f,null,_0x3e462e);}})['then'](function(_0x78747f){_0x428f06=_0x78747f;return getEndUser(_0x3bdd6f,_0x9fa243,_0x4938f2[_0xbb14('0x62')],_0x4938f2[_0xbb14('0x63')],_0x3e462e);})[_0xbb14('0x28')](function(_0x3cabf2){_0x591eb8=_0x3cabf2;return getTicket(_0x3bdd6f,_0x428f06,_0x591eb8,_0x9fa243,_0x4938f2,_0x9fa243[_0xbb14('0x64')],_0x3e462e);})[_0xbb14('0x28')](function(_0x4d3e93){_0x38e3a8=_0x4d3e93;logger[_0xbb14('0x1d')]('['+_0x4938f2[_0xbb14('0x78')][_0xbb14('0x79')]()+_0xbb14('0x7a'),_0x38e3a8['id']);logger[_0xbb14('0x1d')]('['+_0x4938f2[_0xbb14('0x78')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x3bdd6f[_0xbb14('0x3c')]);})['catch'](function(_0x250279){logger['error']('['+_0x4938f2[_0xbb14('0x78')]['toUpperCase']()+']',_0x250279);});}; \ 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 f26256f..21f4eda 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 _0x4891=['recordingFormat','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','result','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','true','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','then','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','customField','nameField','toLowerCase','content','includes','type','idField','variableName','customVariable','Variable','name','toString',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL'];(function(_0x5de258,_0x3e1cce){var _0x5d0563=function(_0x2d5b59){while(--_0x2d5b59){_0x5de258['push'](_0x5de258['shift']());}};_0x5d0563(++_0x3e1cce);}(_0x4891,0x19a));var _0x1489=function(_0x12adca,_0x2d6e25){_0x12adca=_0x12adca-0x0;var _0x32aa2f=_0x4891[_0x12adca];return _0x32aa2f;};'use strict';var _=require('lodash');var Promise=require(_0x1489('0x0'));var rp=require('request-promise');var util=require(_0x1489('0x1'));var md5=require('md5');var Redis=require(_0x1489('0x2'));var intUtil=require(_0x1489('0x3'));var config=require(_0x1489('0x4'));var logger=require(_0x1489('0x5'))('servicenow');config[_0x1489('0x6')]=_['defaults'](config[_0x1489('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1489('0x7'))(new Redis(config[_0x1489('0x6')]));function getAdminUser(_0x7c5e2d,_0x386b7e,_0xe6d719,_0x4839b9,_0x432fc6,_0x1f4b4e){return new Promise(function(_0x3e2b0e,_0x9f3572){var _0x16b89a={'method':_0x1489('0x8'),'uri':_0x4839b9+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x432fc6+'&'+_0x1f4b4e,'auth':_0x386b7e,'json':!![]};return rp(_0x16b89a)['then'](function(_0x404a91){if(_0x404a91[_0x1489('0x9')]['length']>0x0){_0xe6d719['adminId']=_0x404a91[_0x1489('0x9')][0x0]['sys_id'];}logger[_0x1489('0xa')]('['+[_0x7c5e2d[_0x1489('0xb')]()]+'],\x20getAdminUser\x20crm',_0xe6d719);_0x3e2b0e(_0xe6d719);})[_0x1489('0xc')](function(_0x5ea99e){logger[_0x1489('0xd')]('['+[_0x7c5e2d[_0x1489('0xb')]()]+']',_0x5ea99e[_0x1489('0xe')]);_0x9f3572(_0x5ea99e[_0x1489('0xe')]);});});}function getUser(_0x15e83b,_0x3f3348,_0x1afecb,_0x4ad572,_0x4dfd0b){return function(_0xe10c34){logger[_0x1489('0xa')]('['+[_0x15e83b[_0x1489('0xb')]()]+_0x1489('0xf'),_0xe10c34);return new Promise(function(_0x17383b,_0x42b1b6){if(intUtil[_0x1489('0x10')](_0xe10c34[_0x1489('0x11')])){var _0x5687ea={'method':'GET','uri':_0x1afecb+_0x1489('0x12')+_0xe10c34['userEmail']+'&'+_0x4ad572+'&'+_0x4dfd0b,'auth':_0x3f3348,'json':!![]};logger[_0x1489('0xa')]('['+[_0x15e83b[_0x1489('0xb')]()]+_0x1489('0x13'),_0x5687ea);return rp(_0x5687ea)['then'](function(_0x42c52f){logger[_0x1489('0xa')]('['+[_0x15e83b['toUpperCase']()]+'],\x20getUser\x20entity',_0x42c52f);if(_0x42c52f['result'][_0x1489('0x14')]>0x0&&String(_0x42c52f[_0x1489('0x9')][0x0][_0x1489('0x15')])===_0x1489('0x16')){_0xe10c34[_0x1489('0x17')]=_0x42c52f[_0x1489('0x9')][0x0][_0x1489('0x18')];}else{_0xe10c34['userId']=_0xe10c34[_0x1489('0x19')];_0xe10c34[_0x1489('0x11')]=_0xe10c34[_0x1489('0x1a')];}logger[_0x1489('0xa')]('['+[_0x15e83b[_0x1489('0xb')]()]+_0x1489('0x1b'),_0xe10c34);_0x17383b(_0xe10c34);})['catch'](function(_0x20cbe7){logger[_0x1489('0xd')]('['+[_0x15e83b[_0x1489('0xb')]()]+']',_0x20cbe7[_0x1489('0xe')]);_0x42b1b6(_0x20cbe7[_0x1489('0xe')]);});}else{logger[_0x1489('0xa')]('['+[_0x15e83b['toUpperCase']()]+_0x1489('0x1c'));_0xe10c34[_0x1489('0x17')]=_0xe10c34[_0x1489('0x19')];_0xe10c34[_0x1489('0x11')]=_0xe10c34[_0x1489('0x1a')];_0x17383b(_0xe10c34);}});};}function createEndUser(_0x199478,_0x43eff2,_0x15e7bf,_0x1238cf,_0x26a4d8){logger[_0x1489('0xa')]('['+[_0x199478[_0x1489('0xb')]()]+_0x1489('0x1d'),_0x15e7bf);return new Promise(function(_0x3b3e62,_0x2cccf5){var _0x227b1c={'method':_0x1489('0x1e'),'uri':_0x1238cf+_0x1489('0x1f')+_0x26a4d8,'body':{'user_name':_0x15e7bf[_0x1489('0x20')],'roles':_0x1489('0x21'),'first_name':_0x15e7bf[_0x1489('0x20')],'active':'true','date_format':'System','phone':_0x15e7bf['endUserNumber']},'auth':_0x43eff2,'json':!![]};return rp(_0x227b1c)[_0x1489('0x22')](function(_0x3c3f9e){logger[_0x1489('0xa')]('['+[_0x199478[_0x1489('0xb')]()]+'],\x20EndUser\x20schema',_0x3c3f9e[_0x1489('0x9')]);_0x15e7bf[_0x1489('0x23')]=_0x3c3f9e[_0x1489('0x9')][_0x1489('0x18')];_0x3b3e62(_0x15e7bf);})[_0x1489('0xc')](function(_0x2869c5){logger[_0x1489('0xd')]('['+[_0x199478['toUpperCase']()]+']',_0x2869c5[_0x1489('0xe')]);_0x2cccf5(_0x2869c5[_0x1489('0xe')]);});});}function getEndUser(_0x548c09,_0x1a10c7,_0x33c53c,_0x238ebf,_0x231f78){return function(_0x31763e){logger[_0x1489('0xa')]('['+[_0x548c09[_0x1489('0xb')]()]+'],\x20getEndUser\x20input\x20crm',_0x31763e);return new Promise(function(_0x5e2657,_0x5c37dd){var _0x2ec7eb={'method':_0x1489('0x8'),'uri':_0x33c53c+'sys_user?sysparm_query=phone%3D'+_0x31763e[_0x1489('0x20')]+'&'+_0x238ebf+'&'+_0x231f78,'auth':_0x1a10c7,'json':!![]};return rp(_0x2ec7eb)[_0x1489('0x22')](function(_0x492c13){if(_0x492c13[_0x1489('0x9')][_0x1489('0x14')]>0x0){_0x31763e[_0x1489('0x23')]=_0x492c13[_0x1489('0x9')][0x0][_0x1489('0x18')];logger['info']('['+[_0x548c09[_0x1489('0xb')]()]+_0x1489('0x24'),_0x31763e);_0x5e2657(_0x31763e);}else{return createEndUser(_0x548c09,_0x1a10c7,_0x31763e,_0x33c53c,_0x238ebf)['then'](function(_0x559c8c){logger[_0x1489('0xa')]('['+[_0x548c09[_0x1489('0xb')]()]+_0x1489('0x25'),_0x559c8c);_0x5e2657(_0x559c8c);});}})[_0x1489('0xc')](function(_0x3cd353){logger[_0x1489('0xd')]('['+[_0x548c09[_0x1489('0xb')]()]+']',_0x3cd353[_0x1489('0xe')]);_0x5c37dd(_0x3cd353[_0x1489('0xe')]);});});};}function getCustomFields(_0x3081b8,_0x2ff577){var _0x954a30={};if(_0x3081b8[_0x1489('0x14')]>0x0){_['forEach'](_0x3081b8,function(_0x12a23d){if(_['includes']([_0x1489('0x26'),_0x1489('0x27')],_0x12a23d['type'])&&_0x12a23d['nameField']&&!_0x12a23d[_0x1489('0x28')]){_0x954a30[_0x12a23d[_0x1489('0x29')][_0x1489('0x2a')]()]=_0x12a23d[_0x1489('0x2b')]['toString']();}else if(_[_0x1489('0x2c')]([_0x1489('0x26'),_0x1489('0x27')],_0x12a23d[_0x1489('0x2d')])&&_0x12a23d[_0x1489('0x2e')]&&_0x12a23d['customField']){_0x954a30[_0x12a23d[_0x1489('0x2e')][_0x1489('0x2a')]()]=_0x12a23d[_0x1489('0x2b')]['toString']();}else if(_0x12a23d[_0x1489('0x2d')]==='variable'&&_0x12a23d[_0x1489('0x2f')]&&_0x12a23d[_0x1489('0x2e')]&&_0x12a23d[_0x1489('0x28')]){_0x954a30[_0x12a23d['idField'][_0x1489('0x2a')]()]=_0x2ff577[_0x12a23d['variableName']]['toString']();}else if(_0x12a23d[_0x1489('0x2d')]===_0x1489('0x30')&&_0x12a23d[_0x1489('0x31')]&&_0x12a23d[_0x1489('0x31')][_0x1489('0x32')]&&_0x12a23d['idField']&&_0x12a23d[_0x1489('0x28')]){_0x954a30[_0x12a23d[_0x1489('0x2e')][_0x1489('0x2a')]()]=_0x2ff577[_0x12a23d[_0x1489('0x31')][_0x1489('0x32')][_0x1489('0x2a')]()][_0x1489('0x33')]();}});}return _0x954a30;}function getTicket(_0x429443,_0x2020a0,_0xa3a99e,_0x24ef38,_0x39c4e2,_0x451ebb){return function(_0x1d2e88){logger['info']('['+[_0x429443['toUpperCase']()]+_0x1489('0x34'),_0x1d2e88);return new Promise(function(_0x1943c5,_0x28331a){var _0x4658a4=_0x429443['toLowerCase']()==='outbound'?_0x1d2e88[_0x1489('0x17')]:_0x1d2e88['endUserId'];var _0x5452ca={'method':'POST','uri':_0xa3a99e+_0x1489('0x35')+'?'+_0x451ebb,'body':Object[_0x1489('0x36')]({},{'active':'true','caller_id':_0x4658a4,'assigned_to':_0x1d2e88[_0x1489('0x17')],'short_description':intUtil[_0x1489('0x37')](_0x24ef38[_0x1489('0x38')],_0x39c4e2,'\x20'),'description':intUtil[_0x1489('0x37')](_0x24ef38[_0x1489('0x39')],_0x39c4e2,'\x0a')},getCustomFields(_0x24ef38['Fields'],_0x39c4e2)),'auth':_0x2020a0,'json':!![]};return rp(_0x5452ca)['then'](function(_0x3415e1){logger[_0x1489('0xa')]('['+[_0x429443[_0x1489('0xb')]()]+_0x1489('0x3a'),_0x3415e1['result']);_0x1d2e88[_0x1489('0x3b')]=_0x3415e1['result'][_0x1489('0x18')];_0x1d2e88[_0x1489('0x3c')]=_0x3415e1[_0x1489('0x9')][_0x1489('0x3d')];logger[_0x1489('0xa')]('['+[_0x429443[_0x1489('0xb')]()]+']\x20getTicket\x20crm',_0x1d2e88);_0x1943c5(_0x1d2e88);})[_0x1489('0xc')](function(_0x4039f2){logger[_0x1489('0xd')]('['+[_0x429443['toUpperCase']()]+']',_0x4039f2[_0x1489('0xe')]);_0x28331a(_0x4039f2['message']);});});};}function createRemoteTag(_0x9aa3d4,_0x1f4d56,_0x26bb7f,_0x2589e1){return new Promise(function(_0x17269f,_0x2afe73){var _0x2e02b1={'method':_0x1489('0x1e'),'uri':_0x26bb7f+_0x1489('0x3e')+'?'+_0x2589e1,'body':{'short_description':_0x9aa3d4,'global':!![],'active':!![],'name':_0x9aa3d4},'auth':_0x1f4d56,'json':!![]};return rp(_0x2e02b1)[_0x1489('0x22')](function(_0x1f6257){var _0x56f452=_0x1f6257['result'][_0x1489('0x18')];_0x17269f(_0x56f452);});});}function getRemoteTag(_0x1e3879,_0x1c2296,_0x26c524,_0x52d5ad,_0x2d9e36){return new Promise(function(_0x5ea784,_0x411c6f){var _0x1e3645={'method':_0x1489('0x8'),'uri':_0x26c524+_0x1489('0x3e')+_0x1489('0x3f')+_0x1e3879+'&'+_0x52d5ad,'auth':_0x1c2296,'json':!![]};return rp(_0x1e3645)[_0x1489('0x22')](function(_0x4ee78b){if(_0x4ee78b[_0x1489('0x9')][_0x1489('0x14')]>0x0){var _0x361dc5=_0x4ee78b['result'][0x0][_0x1489('0x18')];_0x5ea784(_0x361dc5);}else{return createRemoteTag(_0x1e3879,_0x1c2296,_0x26c524,_0x52d5ad)[_0x1489('0x22')](function(_0x149a82){_0x5ea784(_0x149a82);});}});});}function assignTagToIncident(_0x35cadb,_0x541812,_0x1d442d,_0x282cef,_0x5e4dab){return new Promise(function(_0x798489,_0x4e319c){var _0x4785e8={'method':'POST','uri':_0x1d442d+'label_entry'+'?'+_0x5e4dab,'body':{'label':_0x35cadb,'table':_0x1489('0x35'),'id_type':_0x1489('0x40'),'table_key':_0x282cef[_0x1489('0x3b')],'title':_0x1489('0x41')+_0x282cef[_0x1489('0x3c')],'id_display':_0x282cef[_0x1489('0x3c')]},'auth':_0x541812,'json':!![]};return rp(_0x4785e8)[_0x1489('0x22')](function(_0x5e7351){_0x798489();})[_0x1489('0xc')](function(){_0x798489();});});}function manageTags(_0x377c1d,_0x5861d0,_0x49cb2d,_0x47ab32,_0x55d2a6,_0x3b0543,_0x5954d1){return new Promise(function(_0x5163cc,_0xfee195){var _0x35e2e7=[];_0x5861d0[_0x1489('0x42')](function(_0x4c4f92){_0x35e2e7[_0x1489('0x43')](getRemoteTag(_0x4c4f92,_0x49cb2d,_0x47ab32,_0x3b0543,_0x5954d1));});return Promise[_0x1489('0x44')](_0x35e2e7)[_0x1489('0x22')](function(_0x49eff6){if(_0x49eff6[_0x1489('0x14')]){logger[_0x1489('0xa')]('['+[_0x377c1d[_0x1489('0xb')]()]+_0x1489('0x45'),_0x49eff6);var _0x5acba8=[];_0x49eff6[_0x1489('0x42')](function(_0x391e8a){_0x5acba8[_0x1489('0x43')](assignTagToIncident(_0x391e8a,_0x49cb2d,_0x47ab32,_0x55d2a6,_0x3b0543));});return Promise[_0x1489('0x44')](_0x5acba8)[_0x1489('0x22')](function(){_0x5163cc();})['catch'](function(){_0x5163cc();});}else{_0x5163cc();}});});}function getTags(_0x2880db,_0x1b524d,_0x2cc238,_0x3d3bc1,_0x4991ad,_0x49f0c4){return function(_0x121210){return new Promise(function(_0x41a19a,_0x777be0){var _0x4b51da=[];var _0x56dc5f=_0x3d3bc1[_0x1489('0x46')];if(_0x56dc5f&&_0x56dc5f[_0x1489('0x14')]>0x0){_0x4b51da=_[_0x1489('0x47')](_0x56dc5f,_0x1489('0x32'));}if(_0x4b51da['length']>0x0){return manageTags(_0x2880db,_0x4b51da,_0x1b524d,_0x2cc238,_0x121210,_0x4991ad,_0x49f0c4)[_0x1489('0x22')](function(){_0x41a19a(_0x121210);});}else{_0x41a19a(_0x121210);}});};}function emit(_0x190bdb,_0x5af42c,_0x47b596){var _0x369171='%26sysparm_record_target%3Dincident'+_0x1489('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x48ae4d={'uri':_0x190bdb+_0x1489('0x49')+_0x47b596+_0x369171};io['to'](util['format']('user:%s',_0x5af42c))[_0x1489('0x4a')](_0x1489('0x4b'),_0x48ae4d);}exports['cs']=function(_0x16aff4,_0x9accb5,_0x41e192,_0x255265,_0x25b324,_0xcb704b,_0x4d30b1,_0x457a61){var _0x4d1ff7={};var _0x2c25d5={'user':_0xcb704b['username'],'pass':_0xcb704b['password']};var _0x34c4fa=_0x1489('0x4c');var _0x4d7f93=_0x1489('0x4d');_0xcb704b[_0x1489('0x4e')]=intUtil[_0x1489('0x4f')](_0xcb704b[_0x1489('0x4e')]);_0xcb704b[_0x1489('0x50')]=intUtil['stripTrailingSlash'](_0xcb704b['serverUrl']);var _0x10caf6=util[_0x1489('0x51')](_0x1489('0x52'),_0xcb704b[_0x1489('0x4e')]);_0x4d1ff7[_0x1489('0x11')]=!_['isNil'](_0x255265)?_0x255265['email']:null;_0x4d1ff7[_0x1489('0x1a')]=_0xcb704b[_0x1489('0x53')];_0x4d1ff7[_0x1489('0x20')]=_0x457a61[_0x1489('0x2a')]()==='outbound'?_0x9accb5[_0x1489('0x54')]:_0x9accb5[_0x1489('0x55')];_0x4d1ff7[_0x1489('0x56')]=_0x457a61===_0x1489('0x57')||_0x457a61===_0x1489('0x58')?'queue':_0x1489('0x59');var _0x414f89=util[_0x1489('0x51')](_0x1489('0x5a'),_0xcb704b[_0x1489('0x50')],_0x9accb5[_0x1489('0x5b')],md5(_0x9accb5[_0x1489('0x5b')]));if(_0x25b324&&_0x25b324[_0x1489('0x5c')]){logger[_0x1489('0xa')](_0x1489('0x5d'),'Recording\x20is\x20enabled!');_0x9accb5[_0x1489('0x5e')]=_0x414f89;}else if(_0x4d30b1&&_0x4d30b1[_0x1489('0x5f')]&&_0x4d30b1['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x1489('0x60'));_0x9accb5[_0x1489('0x5e')]=_0x414f89;}else{_0x9accb5[_0x1489('0x5e')]='';}return getAdminUser(_0x457a61,_0x2c25d5,_0x4d1ff7,_0x10caf6,_0x4d7f93,_0x34c4fa)[_0x1489('0x22')](getUser(_0x457a61,_0x2c25d5,_0x10caf6,_0x4d7f93,_0x34c4fa))[_0x1489('0x22')](getEndUser(_0x457a61,_0x2c25d5,_0x10caf6,_0x4d7f93,_0x34c4fa))['then'](getTicket(_0x457a61,_0x2c25d5,_0x10caf6,_0x41e192,_0x9accb5,_0x4d7f93))['then'](function(_0xac78be){logger[_0x1489('0xa')](util[_0x1489('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0xac78be[_0x1489('0x3b')]));logger[_0x1489('0xa')](util[_0x1489('0x51')](_0x1489('0x61'),_0x457a61));if(_0x457a61!==_0x1489('0x58')){logger[_0x1489('0xa')]('['+[_0x457a61[_0x1489('0xb')]()]+']',_0x1489('0x62'));emit(_0xcb704b[_0x1489('0x4e')],_0x255265[_0x1489('0x32')],_0xac78be['ticketId']);}})[_0x1489('0xc')](function(_0x5c5d9c){logger[_0x1489('0xd')]('['+[_0x457a61[_0x1489('0xb')]()]+_0x1489('0x63'),util[_0x1489('0x64')](_0x5c5d9c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x98b1=['inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','userId','sys_id','adminId','],\x20getUser\x20crm','POST','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','true','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','forEach','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','adminEmail','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s'];(function(_0x530bb8,_0x504b57){var _0x140fca=function(_0x16e565){while(--_0x16e565){_0x530bb8['push'](_0x530bb8['shift']());}};_0x140fca(++_0x504b57);}(_0x98b1,0x1b5));var _0x198b=function(_0x23b241,_0xb064ec){_0x23b241=_0x23b241-0x0;var _0x15668b=_0x98b1[_0x23b241];return _0x15668b;};'use strict';var _=require(_0x198b('0x0'));var Promise=require(_0x198b('0x1'));var rp=require(_0x198b('0x2'));var util=require(_0x198b('0x3'));var md5=require(_0x198b('0x4'));var Redis=require(_0x198b('0x5'));var intUtil=require(_0x198b('0x6'));var config=require(_0x198b('0x7'));var logger=require(_0x198b('0x8'))(_0x198b('0x9'));config[_0x198b('0xa')]=_[_0x198b('0xb')](config[_0x198b('0xa')],{'host':_0x198b('0xc'),'port':0x18eb});var io=require(_0x198b('0xd'))(new Redis(config[_0x198b('0xa')]));function getAdminUser(_0x4505de,_0x48e499,_0x526766,_0xacb247,_0xff0809,_0x488b0c){return new Promise(function(_0x53923d,_0x5b6726){var _0x24409a={'method':_0x198b('0xe'),'uri':_0xacb247+_0x198b('0xf')+'&'+_0xff0809+'&'+_0x488b0c,'auth':_0x48e499,'json':!![]};return rp(_0x24409a)[_0x198b('0x10')](function(_0x48e4a0){if(_0x48e4a0[_0x198b('0x11')][_0x198b('0x12')]>0x0){_0x526766['adminId']=_0x48e4a0[_0x198b('0x11')][0x0]['sys_id'];}logger[_0x198b('0x13')]('['+[_0x4505de['toUpperCase']()]+_0x198b('0x14'),_0x526766);_0x53923d(_0x526766);})[_0x198b('0x15')](function(_0x3f67c7){logger[_0x198b('0x16')]('['+[_0x4505de['toUpperCase']()]+']',_0x3f67c7[_0x198b('0x17')]);_0x5b6726(_0x3f67c7[_0x198b('0x17')]);});});}function getUser(_0x411811,_0x16f2ad,_0x344b36,_0x48de02,_0x41b1af){return function(_0x5a3d47){logger['info']('['+[_0x411811[_0x198b('0x18')]()]+_0x198b('0x19'),_0x5a3d47);return new Promise(function(_0x153cd9,_0xfef721){if(intUtil[_0x198b('0x1a')](_0x5a3d47[_0x198b('0x1b')])){var _0x543fec={'method':_0x198b('0xe'),'uri':_0x344b36+_0x198b('0x1c')+_0x5a3d47[_0x198b('0x1b')]+'&'+_0x48de02+'&'+_0x41b1af,'auth':_0x16f2ad,'json':!![]};logger['info']('['+[_0x411811[_0x198b('0x18')]()]+'],\x20getUser\x20rp\x20obj',_0x543fec);return rp(_0x543fec)['then'](function(_0x4bfb0c){logger[_0x198b('0x13')]('['+[_0x411811['toUpperCase']()]+_0x198b('0x1d'),_0x4bfb0c);if(_0x4bfb0c[_0x198b('0x11')]['length']>0x0&&String(_0x4bfb0c[_0x198b('0x11')][0x0]['active'])==='true'){_0x5a3d47[_0x198b('0x1e')]=_0x4bfb0c[_0x198b('0x11')][0x0][_0x198b('0x1f')];}else{_0x5a3d47[_0x198b('0x1e')]=_0x5a3d47[_0x198b('0x20')];_0x5a3d47[_0x198b('0x1b')]=_0x5a3d47['adminEmail'];}logger[_0x198b('0x13')]('['+[_0x411811[_0x198b('0x18')]()]+_0x198b('0x21'),_0x5a3d47);_0x153cd9(_0x5a3d47);})['catch'](function(_0x1e2426){logger['error']('['+[_0x411811['toUpperCase']()]+']',_0x1e2426[_0x198b('0x17')]);_0xfef721(_0x1e2426[_0x198b('0x17')]);});}else{logger[_0x198b('0x13')]('['+[_0x411811['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x5a3d47[_0x198b('0x1e')]=_0x5a3d47[_0x198b('0x20')];_0x5a3d47['userEmail']=_0x5a3d47['adminEmail'];_0x153cd9(_0x5a3d47);}});};}function createEndUser(_0x27180b,_0x3c8b3f,_0x317369,_0x3c01ac,_0x22537f){logger[_0x198b('0x13')]('['+[_0x27180b['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x317369);return new Promise(function(_0x4bc5f6,_0x31f4e8){var _0x17802c={'method':_0x198b('0x22'),'uri':_0x3c01ac+'sys_user?'+_0x22537f,'body':{'user_name':_0x317369[_0x198b('0x23')],'roles':'user','first_name':_0x317369[_0x198b('0x23')],'active':'true','date_format':_0x198b('0x24'),'phone':_0x317369[_0x198b('0x23')]},'auth':_0x3c8b3f,'json':!![]};return rp(_0x17802c)[_0x198b('0x10')](function(_0x5161a4){logger[_0x198b('0x13')]('['+[_0x27180b[_0x198b('0x18')]()]+'],\x20EndUser\x20schema',_0x5161a4[_0x198b('0x11')]);_0x317369[_0x198b('0x25')]=_0x5161a4[_0x198b('0x11')][_0x198b('0x1f')];_0x4bc5f6(_0x317369);})['catch'](function(_0x3e8cdf){logger[_0x198b('0x16')]('['+[_0x27180b[_0x198b('0x18')]()]+']',_0x3e8cdf['message']);_0x31f4e8(_0x3e8cdf['message']);});});}function getEndUser(_0x4bf22a,_0x5ec9da,_0x2c32b1,_0x429a73,_0x496ce4){return function(_0x49343a){logger['info']('['+[_0x4bf22a[_0x198b('0x18')]()]+'],\x20getEndUser\x20input\x20crm',_0x49343a);return new Promise(function(_0x47abcf,_0x2738e9){var _0x17cbd2={'method':'GET','uri':_0x2c32b1+_0x198b('0x26')+_0x49343a[_0x198b('0x23')]+'&'+_0x429a73+'&'+_0x496ce4,'auth':_0x5ec9da,'json':!![]};return rp(_0x17cbd2)[_0x198b('0x10')](function(_0x249b94){if(_0x249b94['result']['length']>0x0){_0x49343a[_0x198b('0x25')]=_0x249b94[_0x198b('0x11')][0x0][_0x198b('0x1f')];logger[_0x198b('0x13')]('['+[_0x4bf22a['toUpperCase']()]+_0x198b('0x27'),_0x49343a);_0x47abcf(_0x49343a);}else{return createEndUser(_0x4bf22a,_0x5ec9da,_0x49343a,_0x2c32b1,_0x429a73)[_0x198b('0x10')](function(_0x561412){logger[_0x198b('0x13')]('['+[_0x4bf22a[_0x198b('0x18')]()]+_0x198b('0x28'),_0x561412);_0x47abcf(_0x561412);});}})[_0x198b('0x15')](function(_0x24a8d4){logger[_0x198b('0x16')]('['+[_0x4bf22a['toUpperCase']()]+']',_0x24a8d4[_0x198b('0x17')]);_0x2738e9(_0x24a8d4[_0x198b('0x17')]);});});};}function getCustomFields(_0x3a7c78,_0x3e4c40){var _0x153848={};if(_0x3a7c78[_0x198b('0x12')]>0x0){_['forEach'](_0x3a7c78,function(_0x1ea5cc){if(_[_0x198b('0x29')]([_0x198b('0x2a'),_0x198b('0x2b')],_0x1ea5cc[_0x198b('0x2c')])&&_0x1ea5cc[_0x198b('0x2d')]&&!_0x1ea5cc[_0x198b('0x2e')]){_0x153848[_0x1ea5cc[_0x198b('0x2d')][_0x198b('0x2f')]()]=_0x1ea5cc[_0x198b('0x30')][_0x198b('0x31')]();}else if(_[_0x198b('0x29')]([_0x198b('0x2a'),_0x198b('0x2b')],_0x1ea5cc[_0x198b('0x2c')])&&_0x1ea5cc['idField']&&_0x1ea5cc[_0x198b('0x2e')]){_0x153848[_0x1ea5cc[_0x198b('0x32')]['toLowerCase']()]=_0x1ea5cc[_0x198b('0x30')][_0x198b('0x31')]();}else if(_0x1ea5cc[_0x198b('0x2c')]===_0x198b('0x33')&&_0x1ea5cc[_0x198b('0x34')]&&_0x1ea5cc[_0x198b('0x32')]&&_0x1ea5cc[_0x198b('0x2e')]){_0x153848[_0x1ea5cc[_0x198b('0x32')]['toLowerCase']()]=_0x3e4c40[_0x1ea5cc[_0x198b('0x34')]][_0x198b('0x31')]();}else if(_0x1ea5cc['type']===_0x198b('0x35')&&_0x1ea5cc[_0x198b('0x36')]&&_0x1ea5cc[_0x198b('0x36')][_0x198b('0x37')]&&_0x1ea5cc['idField']&&_0x1ea5cc[_0x198b('0x2e')]){_0x153848[_0x1ea5cc[_0x198b('0x32')][_0x198b('0x2f')]()]=_0x3e4c40[_0x1ea5cc[_0x198b('0x36')]['name']['toLowerCase']()][_0x198b('0x31')]();}});}return _0x153848;}function getTicket(_0x51ddc0,_0x79de52,_0x25321a,_0x7a4f0b,_0x371be7,_0x14b271){return function(_0x568809){logger[_0x198b('0x13')]('['+[_0x51ddc0[_0x198b('0x18')]()]+_0x198b('0x38'),_0x568809);return new Promise(function(_0x5a855e,_0x340728){var _0x35551d=_0x51ddc0[_0x198b('0x2f')]()==='outbound'?_0x568809['userId']:_0x568809[_0x198b('0x25')];var _0x14ec85={'method':_0x198b('0x22'),'uri':_0x25321a+'incident'+'?'+_0x14b271,'body':Object[_0x198b('0x39')]({},{'active':_0x198b('0x3a'),'caller_id':_0x35551d,'assigned_to':_0x568809[_0x198b('0x1e')],'short_description':intUtil[_0x198b('0x3b')](_0x7a4f0b[_0x198b('0x3c')],_0x371be7,'\x20'),'description':intUtil[_0x198b('0x3b')](_0x7a4f0b[_0x198b('0x3d')],_0x371be7,'\x0a')},getCustomFields(_0x7a4f0b['Fields'],_0x371be7)),'auth':_0x79de52,'json':!![]};return rp(_0x14ec85)['then'](function(_0x17d1d5){logger[_0x198b('0x13')]('['+[_0x51ddc0[_0x198b('0x18')]()]+_0x198b('0x3e'),_0x17d1d5[_0x198b('0x11')]);_0x568809[_0x198b('0x3f')]=_0x17d1d5[_0x198b('0x11')][_0x198b('0x1f')];_0x568809[_0x198b('0x40')]=_0x17d1d5[_0x198b('0x11')][_0x198b('0x41')];logger[_0x198b('0x13')]('['+[_0x51ddc0[_0x198b('0x18')]()]+_0x198b('0x42'),_0x568809);_0x5a855e(_0x568809);})[_0x198b('0x15')](function(_0xe15c2a){logger[_0x198b('0x16')]('['+[_0x51ddc0[_0x198b('0x18')]()]+']',_0xe15c2a[_0x198b('0x17')]);_0x340728(_0xe15c2a[_0x198b('0x17')]);});});};}function createRemoteTag(_0x54b6c8,_0x4cdf5b,_0x1f5ae6,_0x33ab6e){return new Promise(function(_0x1cc3fe,_0x4037ea){var _0x5a6a9a={'method':_0x198b('0x22'),'uri':_0x1f5ae6+_0x198b('0x43')+'?'+_0x33ab6e,'body':{'short_description':_0x54b6c8,'global':!![],'active':!![],'name':_0x54b6c8},'auth':_0x4cdf5b,'json':!![]};return rp(_0x5a6a9a)[_0x198b('0x10')](function(_0x2b417a){var _0x2169b2=_0x2b417a[_0x198b('0x11')][_0x198b('0x1f')];_0x1cc3fe(_0x2169b2);});});}function getRemoteTag(_0x16d3f3,_0x485d6c,_0x11a3de,_0x5bc6c1,_0x58554e){return new Promise(function(_0xa39166,_0x21d590){var _0x5474a4={'method':_0x198b('0xe'),'uri':_0x11a3de+_0x198b('0x43')+_0x198b('0x44')+_0x16d3f3+'&'+_0x5bc6c1,'auth':_0x485d6c,'json':!![]};return rp(_0x5474a4)['then'](function(_0x2735aa){if(_0x2735aa[_0x198b('0x11')][_0x198b('0x12')]>0x0){var _0x5b6a9d=_0x2735aa[_0x198b('0x11')][0x0][_0x198b('0x1f')];_0xa39166(_0x5b6a9d);}else{return createRemoteTag(_0x16d3f3,_0x485d6c,_0x11a3de,_0x5bc6c1)[_0x198b('0x10')](function(_0x1a6004){_0xa39166(_0x1a6004);});}});});}function assignTagToIncident(_0x13259a,_0x4664e8,_0x3b4aa8,_0x154c4e,_0x3757e5){return new Promise(function(_0x651432,_0x5c299a){var _0x38b8ab={'method':'POST','uri':_0x3b4aa8+_0x198b('0x45')+'?'+_0x3757e5,'body':{'label':_0x13259a,'table':_0x198b('0x46'),'id_type':_0x198b('0x47'),'table_key':_0x154c4e[_0x198b('0x3f')],'title':_0x198b('0x48')+_0x154c4e[_0x198b('0x40')],'id_display':_0x154c4e[_0x198b('0x40')]},'auth':_0x4664e8,'json':!![]};return rp(_0x38b8ab)[_0x198b('0x10')](function(_0x5aa623){_0x651432();})[_0x198b('0x15')](function(){_0x651432();});});}function manageTags(_0x4cfa56,_0x47291c,_0x51cc2a,_0x25ad92,_0x3d37a2,_0x230113,_0x230168){return new Promise(function(_0x417db5,_0x437c89){var _0x5a726f=[];_0x47291c[_0x198b('0x49')](function(_0x14b548){_0x5a726f[_0x198b('0x4a')](getRemoteTag(_0x14b548,_0x51cc2a,_0x25ad92,_0x230113,_0x230168));});return Promise[_0x198b('0x4b')](_0x5a726f)[_0x198b('0x10')](function(_0x5e6408){if(_0x5e6408[_0x198b('0x12')]){logger[_0x198b('0x13')]('['+[_0x4cfa56[_0x198b('0x18')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5e6408);var _0x4db918=[];_0x5e6408[_0x198b('0x49')](function(_0x36ded6){_0x4db918[_0x198b('0x4a')](assignTagToIncident(_0x36ded6,_0x51cc2a,_0x25ad92,_0x3d37a2,_0x230113));});return Promise[_0x198b('0x4b')](_0x4db918)[_0x198b('0x10')](function(){_0x417db5();})['catch'](function(){_0x417db5();});}else{_0x417db5();}});});}function getTags(_0x50e76a,_0x41d35f,_0x33f498,_0x5c9fc9,_0x41da82,_0xf91229){return function(_0x3521de){return new Promise(function(_0x3b90a9,_0x4d6c2e){var _0x56f828=[];var _0xa256f9=_0x5c9fc9['Tags'];if(_0xa256f9&&_0xa256f9[_0x198b('0x12')]>0x0){_0x56f828=_[_0x198b('0x4c')](_0xa256f9,'name');}if(_0x56f828['length']>0x0){return manageTags(_0x50e76a,_0x56f828,_0x41d35f,_0x33f498,_0x3521de,_0x41da82,_0xf91229)[_0x198b('0x10')](function(){_0x3b90a9(_0x3521de);});}else{_0x3b90a9(_0x3521de);}});};}function emit(_0x4d2798,_0xf14805,_0x4b3035){var _0x91ced9=_0x198b('0x4d')+_0x198b('0x4e')+_0x198b('0x4f')+'%255EORDERBYDESCnumber';var _0x2cf4ba={'uri':_0x4d2798+_0x198b('0x50')+_0x4b3035+_0x91ced9};io['to'](util[_0x198b('0x51')](_0x198b('0x52'),_0xf14805))[_0x198b('0x53')]('trigger:browser:url',_0x2cf4ba);}exports['cs']=function(_0x5624a0,_0x2664c4,_0x498b5b,_0x28f9d6,_0x5ce2fc,_0x2e7a2e,_0x3cdd18,_0x39e91b){var _0x422d44={};var _0x1a6112={'user':_0x2e7a2e[_0x198b('0x54')],'pass':_0x2e7a2e[_0x198b('0x55')]};var _0x58e177='sysparm_limit=1';var _0x51920d=_0x198b('0x56');_0x2e7a2e['remoteUri']=intUtil[_0x198b('0x57')](_0x2e7a2e['remoteUri']);_0x2e7a2e[_0x198b('0x58')]=intUtil[_0x198b('0x57')](_0x2e7a2e[_0x198b('0x58')]);var _0x78249d=util['format'](_0x198b('0x59'),_0x2e7a2e[_0x198b('0x5a')]);_0x422d44[_0x198b('0x1b')]=!_[_0x198b('0x5b')](_0x28f9d6)?_0x28f9d6[_0x198b('0x5c')]:null;_0x422d44[_0x198b('0x5d')]=_0x2e7a2e[_0x198b('0x5c')];_0x422d44[_0x198b('0x23')]=_0x39e91b[_0x198b('0x2f')]()===_0x198b('0x5e')?_0x2664c4[_0x198b('0x5f')]:_0x2664c4[_0x198b('0x60')];_0x422d44[_0x198b('0x61')]=_0x39e91b===_0x198b('0x62')||_0x39e91b===_0x198b('0x63')?_0x198b('0x62'):'outbound';var _0x2b740b=util[_0x198b('0x51')](_0x198b('0x64'),_0x2e7a2e[_0x198b('0x58')],_0x2664c4[_0x198b('0x65')],md5(_0x2664c4[_0x198b('0x65')]));if(_0x5ce2fc&&_0x5ce2fc[_0x198b('0x66')]){logger[_0x198b('0x13')]('[QUEUE]',_0x198b('0x67'));_0x2664c4[_0x198b('0x68')]=_0x2b740b;}else if(_0x3cdd18&&_0x3cdd18[_0x198b('0x69')]&&_0x3cdd18['recordingFormat']!=='none'){logger[_0x198b('0x13')](_0x198b('0x6a'),_0x198b('0x67'));_0x2664c4[_0x198b('0x68')]=_0x2b740b;}else{_0x2664c4[_0x198b('0x68')]='';}return getAdminUser(_0x39e91b,_0x1a6112,_0x422d44,_0x78249d,_0x51920d,_0x58e177)[_0x198b('0x10')](getUser(_0x39e91b,_0x1a6112,_0x78249d,_0x51920d,_0x58e177))[_0x198b('0x10')](getEndUser(_0x39e91b,_0x1a6112,_0x78249d,_0x51920d,_0x58e177))['then'](getTicket(_0x39e91b,_0x1a6112,_0x78249d,_0x498b5b,_0x2664c4,_0x51920d))['then'](function(_0x3c5906){logger[_0x198b('0x13')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3c5906[_0x198b('0x3f')]));logger[_0x198b('0x13')](util['format'](_0x198b('0x6b'),_0x39e91b));if(_0x39e91b!==_0x198b('0x63')){logger[_0x198b('0x13')]('['+[_0x39e91b[_0x198b('0x18')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2e7a2e[_0x198b('0x5a')],_0x28f9d6[_0x198b('0x37')],_0x3c5906[_0x198b('0x3f')]);}})[_0x198b('0x15')](function(_0xbb06f5){logger[_0x198b('0x16')]('['+[_0x39e91b[_0x198b('0x18')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x198b('0x6c')](_0xbb06f5,{'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 3f08fbb..04e9a7d 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 _0x4d29=['%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','error','unmanaged','uri','lastevent','toUpperCase','request-promise','bluebird','util','ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','getString','Subjects','created_by','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','push','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','forEach','string','nameField','customField','content','custom_fields','type','variableName','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%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!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch'];(function(_0xbac4ac,_0x11ea3c){var _0x4e0402=function(_0xf7a49e){while(--_0xf7a49e){_0xbac4ac['push'](_0xbac4ac['shift']());}};_0x4e0402(++_0x11ea3c);}(_0x4d29,0x16e));var _0x94d2=function(_0x387532,_0x87443a){_0x387532=_0x387532-0x0;var _0x52923f=_0x4d29[_0x387532];return _0x52923f;};'use strict';var _=require('lodash');var rp=require(_0x94d2('0x0'));var BPromise=require(_0x94d2('0x1'));var md5=require('md5');var util=require(_0x94d2('0x2'));var Redis=require(_0x94d2('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x94d2('0x4'))(_0x94d2('0x5'));config[_0x94d2('0x6')]=_[_0x94d2('0x7')](config['redis'],{'host':_0x94d2('0x8'),'port':0x18eb});var io=require(_0x94d2('0x9'))(new Redis(config[_0x94d2('0x6')]));var def={'method':_0x94d2('0xa'),'json':!![]};function emit(_0x1ed99a,_0x7370fc,_0x204c83){io['to'](_0x1ed99a)['emit'](_0x7370fc,_0x204c83);}function getTicket(_0xd36e9d,_0x32833c,_0x18f089,_0x6d6ba2,_0x5251b5,_0x35c32e,_0x98493e,_0x158a3c){logger[_0x94d2('0xb')](_0x94d2('0xc'));var _0xab8aea=new Date();var _0x22e02a=[{'name':'name','value':intUtil[_0x94d2('0xd')](_0x6d6ba2[_0x94d2('0xe')],_0x5251b5,'\x20')},{'name':'assigned_user_id','value':_0x32833c['id']},{'name':_0x94d2('0xf'),'value':_0x32833c['id']},{'name':'description','value':intUtil[_0x94d2('0xd')](_0x6d6ba2['Descriptions'],_0x5251b5,'\x0a')},{'name':_0x94d2('0x10'),'value':_0xab8aea[_0x94d2('0x11')]()[_0x94d2('0x12')](0x0,0x13)[_0x94d2('0x13')]('T','\x20')},{'name':_0x94d2('0x14'),'value':'0'},{'name':_0x94d2('0x15'),'value':'15'},{'name':_0x94d2('0x16'),'value':_0x18f089['id']},{'name':_0x94d2('0x17'),'value':_0x94d2('0x18')},{'name':_0x94d2('0x19'),'value':_0x18f089[_0x94d2('0x1a')]},{'name':_0x94d2('0x1b'),'value':_0x158a3c}];if(_0x35c32e[_0x94d2('0x1c')]){_['forEach'](_0x35c32e,function(_0x211a1c){if(_0x5251b5[_0x211a1c['variableName']]){_0x22e02a[_0x94d2('0x1d')]({'name':_0x211a1c[_0x94d2('0x1e')],'value':_0x5251b5[_0x211a1c['variableName']]});}});}return request({'form':{'method':_0x94d2('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x94d2('0x20')]({'session':_0x98493e['id'],'module_name':_0x94d2('0x21'),'name_value_list':_0x22e02a})}});}function getAuth(_0x1204b7){return util[_0x94d2('0x22')](_0x94d2('0x23'),new Buffer(_0x1204b7[_0x94d2('0x24')]+':X')[_0x94d2('0x25')](_0x94d2('0x26')));}function getServerInfo(_0x4c6591){return request({'form':{'method':_0x94d2('0x27'),'input_type':_0x94d2('0x28'),'response_type':_0x94d2('0x28'),'rest_data':JSON['stringify']({'session':_0x4c6591['id']})}});}function getUser(_0x19eafb,_0x7593b2,_0x2d6f4a){if(!_[_0x94d2('0x29')](_0x7593b2)){logger['info']('Getting\x20agent\x20with\x20name',_0x7593b2);return request({'form':{'method':_0x94d2('0x2a'),'input_type':_0x94d2('0x28'),'response_type':_0x94d2('0x28'),'rest_data':JSON[_0x94d2('0x20')]({'session':_0x2d6f4a['id'],'module_name':_0x94d2('0x2b'),'query':util['format'](_0x94d2('0x2c'),_0x7593b2),'order_by':'','offset':'0','select_fields':['id',_0x94d2('0x1a'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x94d2('0x2d')](function(_0x3a7c92){if(_0x3a7c92[_0x94d2('0x2e')][_0x94d2('0x1c')]){var _0x571b50=_['find'](_0x3a7c92[_0x94d2('0x2e')],function(_0x3d0236){return _0x3d0236[_0x94d2('0x2f')][_0x94d2('0x30')][_0x94d2('0x31')]===_0x7593b2;});if(_0x571b50){logger[_0x94d2('0xb')]('Agent\x20found!');return BPromise[_0x94d2('0x32')]({'id':_0x571b50[_0x94d2('0x2f')]['id'][_0x94d2('0x31')],'name':_0x571b50[_0x94d2('0x2f')][_0x94d2('0x1a')][_0x94d2('0x31')]});}}logger[_0x94d2('0xb')](_0x94d2('0x33'));return BPromise[_0x94d2('0x32')]({'id':_0x2d6f4a['name_value_list'][_0x94d2('0x34')][_0x94d2('0x31')],'name':_0x2d6f4a[_0x94d2('0x2f')][_0x94d2('0x30')][_0x94d2('0x31')]});});}else{logger[_0x94d2('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2d6f4a[_0x94d2('0x2f')][_0x94d2('0x34')][_0x94d2('0x31')],'name':_0x2d6f4a['name_value_list']['user_name']['value']});}}function getEndUser(_0x38942c,_0x11e795,_0x43cff3,_0x8c12a5){logger[_0x94d2('0xb')]('Searching\x20enduser\x20with\x20phone',_0x43cff3);return request({'form':{'method':_0x94d2('0x2a'),'input_type':_0x94d2('0x28'),'response_type':_0x94d2('0x28'),'rest_data':JSON[_0x94d2('0x20')]({'session':_0x8c12a5['id'],'module_name':_0x94d2('0x18'),'query':util['format'](_0x94d2('0x35'),_0x43cff3),'order_by':'','offset':'0','select_fields':['id',_0x94d2('0x1a'),_0x94d2('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1e8f13){if(_0x1e8f13[_0x94d2('0x2e')][_0x94d2('0x1c')]){var _0x5c88c4=_['find'](_0x1e8f13[_0x94d2('0x2e')],function(_0x24bee0){return _0x24bee0[_0x94d2('0x2f')]['phone_home'][_0x94d2('0x31')]===_0x43cff3;});if(_0x5c88c4){logger[_0x94d2('0xb')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x5c88c4[_0x94d2('0x2f')]['id'][_0x94d2('0x31')],'name':_0x5c88c4['name_value_list'][_0x94d2('0x1a')][_0x94d2('0x31')],'phone':_0x5c88c4[_0x94d2('0x2f')][_0x94d2('0x36')][_0x94d2('0x31')]});}}else{logger[_0x94d2('0xb')](_0x94d2('0x37'));return request({'form':{'method':_0x94d2('0x1f'),'input_type':_0x94d2('0x28'),'response_type':_0x94d2('0x28'),'rest_data':JSON[_0x94d2('0x20')]({'session':_0x8c12a5['id'],'module_name':_0x94d2('0x18'),'name_value_list':[{'name':_0x94d2('0x38'),'value':_0x11e795!==_0x94d2('0x39')?_0x11e795:util[_0x94d2('0x22')](_0x94d2('0x3a'),_0x43cff3)},{'name':_0x94d2('0x36'),'value':_0x43cff3}]})}})[_0x94d2('0x2d')](function(_0x3e3e2c){logger[_0x94d2('0xb')]('Enduser\x20created.');return BPromise[_0x94d2('0x32')]({'id':_0x3e3e2c['id'],'name':_0x3e3e2c[_0x94d2('0x2e')][_0x94d2('0x38')][_0x94d2('0x31')],'phone':_0x3e3e2c[_0x94d2('0x2e')]['phone_home'][_0x94d2('0x31')]});});}});}function request(_0x4c51a7){logger[_0x94d2('0x3b')](_0x94d2('0x3c'),JSON[_0x94d2('0x20')](_0x4c51a7));return rp(_['merge'](def,_0x4c51a7));}function getTags(_0x292b81,_0x208e52){var _0x9ae325=[];if(_0x292b81&&_0x292b81['length']>0x0){_0x9ae325=_[_0x94d2('0x3d')](_0x292b81,_0x208e52);}return _0x9ae325;}function getCustomFields(_0x447638,_0x5ba7e5){var _0x4fe1fe=[];var _0x5962d5={'custom_fields':[]};if(_0x447638[_0x94d2('0x1c')]>0x0){_[_0x94d2('0x3e')](_0x447638,function(_0x3c7c57){if(_0x3c7c57['type']===_0x94d2('0x3f')&&_0x3c7c57[_0x94d2('0x40')]&&!_0x3c7c57[_0x94d2('0x41')]){_0x5962d5[_0x3c7c57[_0x94d2('0x40')]['toLowerCase']()]=_0x3c7c57[_0x94d2('0x42')]['toString']();}else if(_0x3c7c57['type']===_0x94d2('0x3f')&&_0x3c7c57[_0x94d2('0x1e')]&&_0x3c7c57[_0x94d2('0x41')]){_0x5962d5[_0x94d2('0x43')][_0x94d2('0x1d')]({'id':_0x3c7c57['idField'],'value':_0x3c7c57['content']['toString']()});}else if(_0x3c7c57[_0x94d2('0x44')]==='variable'&&_0x3c7c57[_0x94d2('0x45')]&&_0x3c7c57[_0x94d2('0x1e')]&&_0x3c7c57['customField']){_0x5ba7e5[_0x3c7c57[_0x94d2('0x45')]]&&_0x5962d5[_0x94d2('0x43')]['push']({'id':_0x3c7c57[_0x94d2('0x1e')],'value':_0x5ba7e5[_0x3c7c57[_0x94d2('0x45')]][_0x94d2('0x25')]()});}else if(_0x3c7c57[_0x94d2('0x44')]==='customVariable'&&_0x3c7c57[_0x94d2('0x46')]&&_0x3c7c57['Variable'][_0x94d2('0x1a')]&&_0x3c7c57['idField']&&_0x3c7c57[_0x94d2('0x41')]){_0x5ba7e5[_0x3c7c57['Variable']['name']['toLowerCase']()]&&_0x5962d5[_0x94d2('0x43')][_0x94d2('0x1d')]({'id':_0x3c7c57[_0x94d2('0x1e')],'value':_0x5ba7e5[_0x3c7c57[_0x94d2('0x46')][_0x94d2('0x1a')][_0x94d2('0x47')]()]['toString']()});}});}return _0x5962d5;}function getConnection(_0x18a9cb){return request({'method':_0x94d2('0xa'),'form':{'method':_0x94d2('0x48'),'input_type':_0x94d2('0x28'),'response_type':_0x94d2('0x28'),'rest_data':JSON[_0x94d2('0x20')]({'user_auth':{'user_name':_0x18a9cb[_0x94d2('0x49')],'password':_0x18a9cb[_0x94d2('0x4a')],'encryption':_0x94d2('0x4b')},'application':_0x94d2('0x4c')})}})['then'](function(_0x594863){var _0x5024f6=_0x594863;if(_0x5024f6['id']){def['sessionID']=_0x5024f6['id'];return BPromise[_0x94d2('0x32')](_0x5024f6);}else{throw new Error(util[_0x94d2('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x18a9cb['id']));}});}function setRelationship(_0x134027,_0x590a3a,_0x44587b,_0x3a2b15){return request({'form':{'method':_0x94d2('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x94d2('0x20')]({'session':_0x134027['id'],'module_name':_0x94d2('0x21'),'module_id':_0x44587b['id'],'link_field_name':_0x3a2b15,'related_ids':[_0x590a3a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x94d2('0x4e')]=function(_0x1341ec,_0x522988,_0x20ac58,_0x2a6eb0,_0x4f32de,_0x489de1){var _0x1bb3d7,_0x2539af,_0x3386f7,_0x24fd59;_0x489de1[_0x94d2('0x4f')]=intUtil[_0x94d2('0x50')](_0x489de1['remoteUri']);_0x489de1['serverUrl']=intUtil[_0x94d2('0x50')](_0x489de1[_0x94d2('0x51')]);def['uri']=util[_0x94d2('0x22')]('%s/service/v4_1/rest.php',_0x489de1[_0x94d2('0x4f')]);if(_0x4f32de&&_0x4f32de[_0x94d2('0x52')]){logger[_0x94d2('0xb')](_0x94d2('0x53'),'Recording\x20is\x20enabled!');_0x522988[_0x94d2('0x54')]=util['format'](_0x94d2('0x55'),_0x489de1[_0x94d2('0x51')],_0x522988[_0x94d2('0x56')],md5(_0x522988[_0x94d2('0x56')]));}else{_0x522988[_0x94d2('0x54')]='';}return getConnection(_0x489de1)['then'](function(_0x5147e3){_0x24fd59=_0x5147e3;return getUser(_0x489de1,_0x2a6eb0['name'],_0x24fd59);})[_0x94d2('0x2d')](function(_0x11314d){_0x1bb3d7=_0x11314d;logger[_0x94d2('0xb')](_0x94d2('0x57'),_0x1bb3d7['id']);return getEndUser(_0x489de1,_0x522988[_0x94d2('0x58')],_0x522988[_0x94d2('0x59')],_0x24fd59);})[_0x94d2('0x2d')](function(_0x4408c8){_0x2539af=_0x4408c8;logger[_0x94d2('0xb')](_0x94d2('0x5a'),_0x2539af['id']);return getTicket(_0x489de1,_0x1bb3d7,_0x2539af,_0x20ac58,_0x522988,_0x20ac58[_0x94d2('0x5b')],_0x24fd59,_0x94d2('0x5c'));})['then'](function(_0x32c8bb){_0x3386f7=_0x32c8bb;logger[_0x94d2('0xb')](_0x94d2('0x5d'));logger[_0x94d2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3386f7['id']);return setRelationship(_0x24fd59,_0x1bb3d7,_0x3386f7,'users');})[_0x94d2('0x2d')](function(){return setRelationship(_0x24fd59,_0x2539af,_0x3386f7,_0x94d2('0x5e'));})[_0x94d2('0x2d')](function(){return getServerInfo(_0x24fd59);})[_0x94d2('0x2d')](function(_0x5d0852){var _0x1f9439=parseInt(_0x5d0852[_0x94d2('0x5f')][_0x94d2('0x60')](0x0));var _0x2d31e3=util[_0x94d2('0x22')](_0x94d2('0x61'),_0x489de1['remoteUri'],_0x3386f7['id']);if(_0x1f9439>0x6){_0x2d31e3=util[_0x94d2('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x489de1['remoteUri'],_0x3386f7['id']);}logger[_0x94d2('0xb')]('[QUEUE]',_0x94d2('0x62'));emit(util[_0x94d2('0x22')](_0x94d2('0x63'),_0x2a6eb0['name']),_0x94d2('0x64'),{'uri':_0x2d31e3});})[_0x94d2('0x65')](function(_0x65b953){logger['error'](_0x94d2('0x53'),JSON['stringify'](_0x65b953));});};exports['outbound']=function(_0x119621,_0x30cde9,_0x1b27c0,_0x3ab50f,_0x437eff,_0x167d18,_0x15b258){var _0x1194b5,_0x349645,_0x48bd50,_0x1ea9f6;_0x167d18[_0x94d2('0x4f')]=intUtil[_0x94d2('0x50')](_0x167d18[_0x94d2('0x4f')]);_0x167d18['serverUrl']=intUtil[_0x94d2('0x50')](_0x167d18['serverUrl']);def['uri']=util[_0x94d2('0x22')](_0x94d2('0x66'),_0x167d18[_0x94d2('0x4f')]);if(_0x15b258&&_0x15b258[_0x94d2('0x67')]&&_0x15b258[_0x94d2('0x67')]!==_0x94d2('0x68')){logger[_0x94d2('0xb')](_0x94d2('0x69'),_0x94d2('0x6a'));_0x30cde9['recordingURL']=util[_0x94d2('0x22')](_0x94d2('0x55'),_0x167d18[_0x94d2('0x51')],_0x30cde9['uniqueid'],md5(_0x30cde9['uniqueid']));}return getConnection(_0x167d18)['then'](function(_0x105757){_0x1ea9f6=_0x105757;return getUser(_0x167d18,_0x3ab50f[_0x94d2('0x1a')],_0x1ea9f6);})['then'](function(_0x2b2c6c){_0x1194b5=_0x2b2c6c;logger['info'](_0x94d2('0x57'),_0x1194b5['id']);return getEndUser(_0x167d18,_0x30cde9[_0x94d2('0x6b')],_0x30cde9[_0x94d2('0x6c')],_0x1ea9f6);})[_0x94d2('0x2d')](function(_0x205ddf){_0x349645=_0x205ddf;logger[_0x94d2('0xb')](_0x94d2('0x5a'),_0x349645['id']);return getTicket(_0x167d18,_0x1194b5,_0x349645,_0x1b27c0,_0x30cde9,_0x1b27c0[_0x94d2('0x5b')],_0x1ea9f6,'Outbound');})['then'](function(_0x409a08){_0x48bd50=_0x409a08;logger['info'](_0x94d2('0x5d'));logger['info'](_0x94d2('0x6d'),_0x48bd50['id']);return setRelationship(_0x1ea9f6,_0x1194b5,_0x48bd50,_0x94d2('0x6e'));})[_0x94d2('0x2d')](function(){return setRelationship(_0x1ea9f6,_0x349645,_0x48bd50,_0x94d2('0x5e'));})[_0x94d2('0x2d')](function(){return getServerInfo(_0x1ea9f6);})[_0x94d2('0x2d')](function(_0x267940){var _0x34b7ee=parseInt(_0x267940[_0x94d2('0x5f')]['charAt'](0x0));var _0x4d8607=util[_0x94d2('0x22')](_0x94d2('0x61'),_0x167d18['remoteUri'],_0x48bd50['id']);if(_0x34b7ee>0x6){_0x4d8607=util[_0x94d2('0x22')](_0x94d2('0x6f'),_0x167d18[_0x94d2('0x4f')],_0x48bd50['id']);}logger[_0x94d2('0xb')](_0x94d2('0x69'),_0x94d2('0x62'));emit(util['format'](_0x94d2('0x63'),_0x3ab50f['name']),_0x94d2('0x64'),{'uri':_0x4d8607});})['catch'](function(_0x1e91bb){logger[_0x94d2('0x70')](_0x94d2('0x69'),JSON[_0x94d2('0x20')](_0x1e91bb));});};exports[_0x94d2('0x71')]=function(_0x31e65a,_0x2213bb,_0x1c45fa,_0x3461a9,_0x5cab72,_0x14202d){var _0x5e719a,_0x53d490,_0x12d2d6,_0xbdabae;_0x14202d[_0x94d2('0x4f')]=intUtil['stripTrailingSlash'](_0x14202d[_0x94d2('0x4f')]);_0x14202d['serverUrl']=intUtil['stripTrailingSlash'](_0x14202d[_0x94d2('0x51')]);def[_0x94d2('0x72')]=util[_0x94d2('0x22')](_0x94d2('0x66'),_0x14202d[_0x94d2('0x4f')]);if(_0x5cab72&&_0x5cab72[_0x94d2('0x52')]){logger[_0x94d2('0xb')]('['+_0x2213bb[_0x94d2('0x73')][_0x94d2('0x74')]()+']','Recording\x20is\x20enabled!');_0x2213bb[_0x94d2('0x54')]=util['format'](_0x94d2('0x55'),_0x14202d[_0x94d2('0x51')],_0x2213bb['uniqueid'],md5(_0x2213bb['uniqueid']));}else{_0x2213bb['recordingURL']='';}return getConnection(_0x14202d)[_0x94d2('0x2d')](function(_0x3319a3){_0xbdabae=_0x3319a3;if(!_['isNil'](_0x3461a9)){return getUser(_0x14202d,_0x3461a9['name'],_0xbdabae);}else{return getUser(_0x14202d,null,_0xbdabae);}})['then'](function(_0x9689ce){_0x5e719a=_0x9689ce;logger[_0x94d2('0xb')](_0x94d2('0x57'),_0x5e719a['id']);return getEndUser(_0x14202d,_0x2213bb['calleridname'],_0x2213bb[_0x94d2('0x59')],_0xbdabae);})[_0x94d2('0x2d')](function(_0x4b920e){_0x53d490=_0x4b920e;logger[_0x94d2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x53d490['id']);return getTicket(_0x14202d,_0x5e719a,_0x53d490,_0x1c45fa,_0x2213bb,_0x1c45fa[_0x94d2('0x5b')],_0xbdabae,'Inbound');})[_0x94d2('0x2d')](function(_0x9cf9d3){_0x12d2d6=_0x9cf9d3;logger[_0x94d2('0xb')](_0x94d2('0x5d'));logger[_0x94d2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x12d2d6['id']);return setRelationship(_0xbdabae,_0x5e719a,_0x12d2d6,_0x94d2('0x6e'));})['then'](function(){return setRelationship(_0xbdabae,_0x53d490,_0x12d2d6,_0x94d2('0x5e'));})[_0x94d2('0x2d')](function(){return getServerInfo(_0xbdabae);})['catch'](function(_0x236381){logger[_0x94d2('0x70')]('['+_0x2213bb[_0x94d2('0x73')][_0x94d2('0x74')]()+']',JSON[_0x94d2('0x20')](_0x236381));});}; \ No newline at end of file +var _0x37da=['replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','find','entry_list','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','toLowerCase','customField','custom_fields','push','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','Outbound','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','[OUTBOUND]','user:%s','error','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice'];(function(_0xae2add,_0x1c1106){var _0x1a512a=function(_0x1e739e){while(--_0x1e739e){_0xae2add['push'](_0xae2add['shift']());}};_0x1a512a(++_0x1c1106);}(_0x37da,0xe0));var _0xa37d=function(_0x21b763,_0x574d9e){_0x21b763=_0x21b763-0x0;var _0x4ef8fd=_0x37da[_0x21b763];return _0x4ef8fd;};'use strict';var _=require(_0xa37d('0x0'));var rp=require(_0xa37d('0x1'));var BPromise=require(_0xa37d('0x2'));var md5=require('md5');var util=require(_0xa37d('0x3'));var Redis=require(_0xa37d('0x4'));var intUtil=require(_0xa37d('0x5'));var config=require(_0xa37d('0x6'));var logger=require(_0xa37d('0x7'))(_0xa37d('0x8'));config[_0xa37d('0x9')]=_[_0xa37d('0xa')](config[_0xa37d('0x9')],{'host':_0xa37d('0xb'),'port':0x18eb});var io=require(_0xa37d('0xc'))(new Redis(config[_0xa37d('0x9')]));var def={'method':_0xa37d('0xd'),'json':!![]};function emit(_0x5b214d,_0x25b063,_0x457341){io['to'](_0x5b214d)[_0xa37d('0xe')](_0x25b063,_0x457341);}function getTicket(_0xcee48,_0x56ec6b,_0x5db5e1,_0x396810,_0x1b89ec,_0x184a32,_0x85ffe5,_0x1404e2){logger[_0xa37d('0xf')](_0xa37d('0x10'));var _0x51d323=new Date();var _0x236339=[{'name':'name','value':intUtil[_0xa37d('0x11')](_0x396810[_0xa37d('0x12')],_0x1b89ec,'\x20')},{'name':_0xa37d('0x13'),'value':_0x56ec6b['id']},{'name':_0xa37d('0x14'),'value':_0x56ec6b['id']},{'name':_0xa37d('0x15'),'value':intUtil[_0xa37d('0x11')](_0x396810[_0xa37d('0x16')],_0x1b89ec,'\x0a')},{'name':_0xa37d('0x17'),'value':_0x51d323[_0xa37d('0x18')]()[_0xa37d('0x19')](0x0,0x13)[_0xa37d('0x1a')]('T','\x20')},{'name':_0xa37d('0x1b'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xa37d('0x1c'),'value':_0x5db5e1['id']},{'name':_0xa37d('0x1d'),'value':_0xa37d('0x1e')},{'name':_0xa37d('0x1f'),'value':_0x5db5e1[_0xa37d('0x20')]},{'name':_0xa37d('0x21'),'value':_0x1404e2}];if(_0x184a32[_0xa37d('0x22')]){_[_0xa37d('0x23')](_0x184a32,function(_0x5e9fb7){if(_0x1b89ec[_0x5e9fb7[_0xa37d('0x24')]]){_0x236339['push']({'name':_0x5e9fb7[_0xa37d('0x25')],'value':_0x1b89ec[_0x5e9fb7[_0xa37d('0x24')]]});}});}return request({'form':{'method':_0xa37d('0x26'),'input_type':'JSON','response_type':_0xa37d('0x27'),'rest_data':JSON[_0xa37d('0x28')]({'session':_0x85ffe5['id'],'module_name':_0xa37d('0x29'),'name_value_list':_0x236339})}});}function getAuth(_0x159cdd){return util[_0xa37d('0x2a')](_0xa37d('0x2b'),new Buffer(_0x159cdd[_0xa37d('0x2c')]+':X')[_0xa37d('0x2d')]('base64'));}function getServerInfo(_0x2aa4fd){return request({'form':{'method':_0xa37d('0x2e'),'input_type':_0xa37d('0x27'),'response_type':'JSON','rest_data':JSON[_0xa37d('0x28')]({'session':_0x2aa4fd['id']})}});}function getUser(_0x11ff45,_0x5569f1,_0x42ab66){if(!_[_0xa37d('0x2f')](_0x5569f1)){logger[_0xa37d('0xf')](_0xa37d('0x30'),_0x5569f1);return request({'form':{'method':_0xa37d('0x31'),'input_type':_0xa37d('0x27'),'response_type':'JSON','rest_data':JSON[_0xa37d('0x28')]({'session':_0x42ab66['id'],'module_name':_0xa37d('0x32'),'query':util[_0xa37d('0x2a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5569f1),'order_by':'','offset':'0','select_fields':['id',_0xa37d('0x20'),_0xa37d('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa37d('0x34')](function(_0x2dbbba){if(_0x2dbbba['entry_list'][_0xa37d('0x22')]){var _0xf0d5c0=_[_0xa37d('0x35')](_0x2dbbba[_0xa37d('0x36')],function(_0x4e8a6f){return _0x4e8a6f[_0xa37d('0x37')][_0xa37d('0x33')]['value']===_0x5569f1;});if(_0xf0d5c0){logger[_0xa37d('0xf')]('Agent\x20found!');return BPromise[_0xa37d('0x38')]({'id':_0xf0d5c0[_0xa37d('0x37')]['id'][_0xa37d('0x39')],'name':_0xf0d5c0[_0xa37d('0x37')][_0xa37d('0x20')][_0xa37d('0x39')]});}}logger[_0xa37d('0xf')](_0xa37d('0x3a'));return BPromise[_0xa37d('0x38')]({'id':_0x42ab66[_0xa37d('0x37')][_0xa37d('0x3b')][_0xa37d('0x39')],'name':_0x42ab66[_0xa37d('0x37')][_0xa37d('0x33')]['value']});});}else{logger[_0xa37d('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x42ab66[_0xa37d('0x37')][_0xa37d('0x3b')][_0xa37d('0x39')],'name':_0x42ab66['name_value_list'][_0xa37d('0x33')]['value']});}}function getEndUser(_0x64ae09,_0x1e1c0c,_0x18afaa,_0x3fea93){logger['info'](_0xa37d('0x3c'),_0x18afaa);return request({'form':{'method':_0xa37d('0x31'),'input_type':_0xa37d('0x27'),'response_type':_0xa37d('0x27'),'rest_data':JSON[_0xa37d('0x28')]({'session':_0x3fea93['id'],'module_name':'Contacts','query':util[_0xa37d('0x2a')](_0xa37d('0x3d'),_0x18afaa),'order_by':'','offset':'0','select_fields':['id','name',_0xa37d('0x3e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa37d('0x34')](function(_0x4d71ec){if(_0x4d71ec[_0xa37d('0x36')][_0xa37d('0x22')]){var _0x117b42=_[_0xa37d('0x35')](_0x4d71ec[_0xa37d('0x36')],function(_0x10d832){return _0x10d832[_0xa37d('0x37')][_0xa37d('0x3e')][_0xa37d('0x39')]===_0x18afaa;});if(_0x117b42){logger[_0xa37d('0xf')](_0xa37d('0x3f'));return BPromise['resolve']({'id':_0x117b42['name_value_list']['id'][_0xa37d('0x39')],'name':_0x117b42[_0xa37d('0x37')][_0xa37d('0x20')][_0xa37d('0x39')],'phone':_0x117b42[_0xa37d('0x37')]['phone_home'][_0xa37d('0x39')]});}}else{logger[_0xa37d('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xa37d('0x26'),'input_type':_0xa37d('0x27'),'response_type':'JSON','rest_data':JSON[_0xa37d('0x28')]({'session':_0x3fea93['id'],'module_name':_0xa37d('0x1e'),'name_value_list':[{'name':_0xa37d('0x40'),'value':_0x1e1c0c!==''?_0x1e1c0c:util[_0xa37d('0x2a')](_0xa37d('0x41'),_0x18afaa)},{'name':'phone_home','value':_0x18afaa}]})}})['then'](function(_0x39fccf){logger[_0xa37d('0xf')]('Enduser\x20created.');return BPromise[_0xa37d('0x38')]({'id':_0x39fccf['id'],'name':_0x39fccf[_0xa37d('0x36')]['first_name']['value'],'phone':_0x39fccf['entry_list'][_0xa37d('0x3e')]['value']});});}});}function request(_0x20d99d){logger[_0xa37d('0x42')](_0xa37d('0x43'),JSON['stringify'](_0x20d99d));return rp(_['merge'](def,_0x20d99d));}function getTags(_0x31885c,_0x3498d3){var _0x388402=[];if(_0x31885c&&_0x31885c[_0xa37d('0x22')]>0x0){_0x388402=_[_0xa37d('0x44')](_0x31885c,_0x3498d3);}return _0x388402;}function getCustomFields(_0x35f7a3,_0x2cabfc){var _0x28edff=[];var _0x24c6b2={'custom_fields':[]};if(_0x35f7a3[_0xa37d('0x22')]>0x0){_[_0xa37d('0x23')](_0x35f7a3,function(_0x50dd2a){if(_0x50dd2a[_0xa37d('0x45')]===_0xa37d('0x46')&&_0x50dd2a[_0xa37d('0x47')]&&!_0x50dd2a['customField']){_0x24c6b2[_0x50dd2a['nameField'][_0xa37d('0x48')]()]=_0x50dd2a['content'][_0xa37d('0x2d')]();}else if(_0x50dd2a[_0xa37d('0x45')]===_0xa37d('0x46')&&_0x50dd2a['idField']&&_0x50dd2a[_0xa37d('0x49')]){_0x24c6b2[_0xa37d('0x4a')][_0xa37d('0x4b')]({'id':_0x50dd2a['idField'],'value':_0x50dd2a['content'][_0xa37d('0x2d')]()});}else if(_0x50dd2a['type']===_0xa37d('0x4c')&&_0x50dd2a[_0xa37d('0x24')]&&_0x50dd2a[_0xa37d('0x25')]&&_0x50dd2a[_0xa37d('0x49')]){_0x2cabfc[_0x50dd2a[_0xa37d('0x24')]]&&_0x24c6b2['custom_fields'][_0xa37d('0x4b')]({'id':_0x50dd2a[_0xa37d('0x25')],'value':_0x2cabfc[_0x50dd2a[_0xa37d('0x24')]]['toString']()});}else if(_0x50dd2a[_0xa37d('0x45')]===_0xa37d('0x4d')&&_0x50dd2a[_0xa37d('0x4e')]&&_0x50dd2a[_0xa37d('0x4e')]['name']&&_0x50dd2a[_0xa37d('0x25')]&&_0x50dd2a[_0xa37d('0x49')]){_0x2cabfc[_0x50dd2a[_0xa37d('0x4e')][_0xa37d('0x20')]['toLowerCase']()]&&_0x24c6b2[_0xa37d('0x4a')]['push']({'id':_0x50dd2a[_0xa37d('0x25')],'value':_0x2cabfc[_0x50dd2a[_0xa37d('0x4e')][_0xa37d('0x20')]['toLowerCase']()][_0xa37d('0x2d')]()});}});}return _0x24c6b2;}function getConnection(_0x1b3ef0){return request({'method':_0xa37d('0xd'),'form':{'method':'login','input_type':'JSON','response_type':_0xa37d('0x27'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1b3ef0[_0xa37d('0x4f')],'password':_0x1b3ef0['password'],'encryption':_0xa37d('0x50')},'application':_0xa37d('0x51')})}})['then'](function(_0x150068){var _0x598922=_0x150068;if(_0x598922['id']){def['sessionID']=_0x598922['id'];return BPromise[_0xa37d('0x38')](_0x598922);}else{throw new Error(util['format'](_0xa37d('0x52'),_0x1b3ef0['id']));}});}function setRelationship(_0x35e8ca,_0x5dbd13,_0x365275,_0x572654){return request({'form':{'method':_0xa37d('0x53'),'input_type':_0xa37d('0x27'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x35e8ca['id'],'module_name':'Calls','module_id':_0x365275['id'],'link_field_name':_0x572654,'related_ids':[_0x5dbd13['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa37d('0x54')]=function(_0x22bf86,_0x2f25ca,_0x58c587,_0x43fe57,_0xaeae85,_0x460339){var _0x209919,_0x22b003,_0x45cd64,_0x3064f8;_0x460339[_0xa37d('0x55')]=intUtil[_0xa37d('0x56')](_0x460339[_0xa37d('0x55')]);_0x460339[_0xa37d('0x57')]=intUtil[_0xa37d('0x56')](_0x460339[_0xa37d('0x57')]);def[_0xa37d('0x58')]=util[_0xa37d('0x2a')]('%s/service/v4_1/rest.php',_0x460339[_0xa37d('0x55')]);if(_0xaeae85&&_0xaeae85[_0xa37d('0x59')]){logger['info'](_0xa37d('0x5a'),_0xa37d('0x5b'));_0x2f25ca['recordingURL']=util[_0xa37d('0x2a')](_0xa37d('0x5c'),_0x460339[_0xa37d('0x57')],_0x2f25ca[_0xa37d('0x5d')],md5(_0x2f25ca[_0xa37d('0x5d')]));}else{_0x2f25ca['recordingURL']='';}return getConnection(_0x460339)[_0xa37d('0x34')](function(_0x5b762){_0x3064f8=_0x5b762;return getUser(_0x460339,_0x43fe57[_0xa37d('0x20')],_0x3064f8);})['then'](function(_0xe063fb){_0x209919=_0xe063fb;logger['info'](_0xa37d('0x5e'),_0x209919['id']);return getEndUser(_0x460339,_0x2f25ca['calleridname'],_0x2f25ca['calleridnum'],_0x3064f8);})[_0xa37d('0x34')](function(_0x4b0a38){_0x22b003=_0x4b0a38;logger['info'](_0xa37d('0x5f'),_0x22b003['id']);return getTicket(_0x460339,_0x209919,_0x22b003,_0x58c587,_0x2f25ca,_0x58c587[_0xa37d('0x60')],_0x3064f8,_0xa37d('0x61'));})[_0xa37d('0x34')](function(_0x44357a){_0x45cd64=_0x44357a;logger[_0xa37d('0xf')](_0xa37d('0x62'));logger[_0xa37d('0xf')](_0xa37d('0x63'),_0x45cd64['id']);return setRelationship(_0x3064f8,_0x209919,_0x45cd64,'users');})[_0xa37d('0x34')](function(){return setRelationship(_0x3064f8,_0x22b003,_0x45cd64,'contacts');})[_0xa37d('0x34')](function(){return getServerInfo(_0x3064f8);})[_0xa37d('0x34')](function(_0x15ac9b){var _0x27986a=parseInt(_0x15ac9b['version'][_0xa37d('0x64')](0x0));var _0x562c01=util[_0xa37d('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x460339[_0xa37d('0x55')],_0x45cd64['id']);if(_0x27986a>0x6){_0x562c01=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x460339[_0xa37d('0x55')],_0x45cd64['id']);}logger['info'](_0xa37d('0x5a'),_0xa37d('0x65'));emit(util[_0xa37d('0x2a')]('user:%s',_0x43fe57[_0xa37d('0x20')]),_0xa37d('0x66'),{'uri':_0x562c01});})[_0xa37d('0x67')](function(_0x257bec){logger['error'](_0xa37d('0x5a'),JSON[_0xa37d('0x28')](_0x257bec));});};exports[_0xa37d('0x68')]=function(_0x792f4b,_0x439a32,_0xc7f030,_0x2a3bbd,_0x46f5e5,_0x156ee4,_0x489686){var _0x5e3e2b,_0x3c7b6b,_0x32ebab,_0x58eb66;_0x156ee4[_0xa37d('0x55')]=intUtil[_0xa37d('0x56')](_0x156ee4[_0xa37d('0x55')]);_0x156ee4[_0xa37d('0x57')]=intUtil['stripTrailingSlash'](_0x156ee4[_0xa37d('0x57')]);def['uri']=util[_0xa37d('0x2a')](_0xa37d('0x69'),_0x156ee4[_0xa37d('0x55')]);if(_0x489686&&_0x489686[_0xa37d('0x6a')]&&_0x489686['recordingFormat']!==_0xa37d('0x6b')){logger[_0xa37d('0xf')]('[OUTBOUND]',_0xa37d('0x5b'));_0x439a32[_0xa37d('0x6c')]=util[_0xa37d('0x2a')](_0xa37d('0x5c'),_0x156ee4['serverUrl'],_0x439a32['uniqueid'],md5(_0x439a32[_0xa37d('0x5d')]));}return getConnection(_0x156ee4)[_0xa37d('0x34')](function(_0x4a39d3){_0x58eb66=_0x4a39d3;return getUser(_0x156ee4,_0x2a3bbd['name'],_0x58eb66);})[_0xa37d('0x34')](function(_0x528c72){_0x5e3e2b=_0x528c72;logger['info'](_0xa37d('0x5e'),_0x5e3e2b['id']);return getEndUser(_0x156ee4,_0x439a32[_0xa37d('0x6d')],_0x439a32[_0xa37d('0x6e')],_0x58eb66);})[_0xa37d('0x34')](function(_0x19c6ea){_0x3c7b6b=_0x19c6ea;logger[_0xa37d('0xf')]('The\x20Enduser\x20ID\x20is:',_0x3c7b6b['id']);return getTicket(_0x156ee4,_0x5e3e2b,_0x3c7b6b,_0xc7f030,_0x439a32,_0xc7f030[_0xa37d('0x60')],_0x58eb66,_0xa37d('0x6f'));})['then'](function(_0x3ff937){_0x32ebab=_0x3ff937;logger[_0xa37d('0xf')](_0xa37d('0x62'));logger[_0xa37d('0xf')](_0xa37d('0x63'),_0x32ebab['id']);return setRelationship(_0x58eb66,_0x5e3e2b,_0x32ebab,_0xa37d('0x70'));})['then'](function(){return setRelationship(_0x58eb66,_0x3c7b6b,_0x32ebab,_0xa37d('0x71'));})['then'](function(){return getServerInfo(_0x58eb66);})['then'](function(_0xa4f6ff){var _0x50e0b0=parseInt(_0xa4f6ff[_0xa37d('0x72')][_0xa37d('0x64')](0x0));var _0x129d51=util[_0xa37d('0x2a')](_0xa37d('0x73'),_0x156ee4[_0xa37d('0x55')],_0x32ebab['id']);if(_0x50e0b0>0x6){_0x129d51=util[_0xa37d('0x2a')](_0xa37d('0x74'),_0x156ee4['remoteUri'],_0x32ebab['id']);}logger[_0xa37d('0xf')](_0xa37d('0x75'),_0xa37d('0x65'));emit(util[_0xa37d('0x2a')](_0xa37d('0x76'),_0x2a3bbd[_0xa37d('0x20')]),_0xa37d('0x66'),{'uri':_0x129d51});})[_0xa37d('0x67')](function(_0x62f746){logger[_0xa37d('0x77')](_0xa37d('0x75'),JSON[_0xa37d('0x28')](_0x62f746));});};exports[_0xa37d('0x78')]=function(_0x1a27ce,_0xfe7966,_0x286306,_0xd93b4d,_0x29bdb8,_0x1c94a8){var _0x358259,_0x4e6c00,_0x1f048d,_0x45b2c0;_0x1c94a8[_0xa37d('0x55')]=intUtil[_0xa37d('0x56')](_0x1c94a8['remoteUri']);_0x1c94a8[_0xa37d('0x57')]=intUtil[_0xa37d('0x56')](_0x1c94a8['serverUrl']);def[_0xa37d('0x58')]=util[_0xa37d('0x2a')](_0xa37d('0x69'),_0x1c94a8['remoteUri']);if(_0x29bdb8&&_0x29bdb8[_0xa37d('0x59')]){logger['info']('['+_0xfe7966[_0xa37d('0x79')][_0xa37d('0x7a')]()+']',_0xa37d('0x5b'));_0xfe7966[_0xa37d('0x6c')]=util[_0xa37d('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c94a8[_0xa37d('0x57')],_0xfe7966[_0xa37d('0x5d')],md5(_0xfe7966[_0xa37d('0x5d')]));}else{_0xfe7966[_0xa37d('0x6c')]='';}return getConnection(_0x1c94a8)['then'](function(_0x3f9e86){_0x45b2c0=_0x3f9e86;if(!_[_0xa37d('0x2f')](_0xd93b4d)){return getUser(_0x1c94a8,_0xd93b4d['name'],_0x45b2c0);}else{return getUser(_0x1c94a8,null,_0x45b2c0);}})[_0xa37d('0x34')](function(_0xbf624d){_0x358259=_0xbf624d;logger[_0xa37d('0xf')](_0xa37d('0x5e'),_0x358259['id']);return getEndUser(_0x1c94a8,_0xfe7966[_0xa37d('0x7b')],_0xfe7966[_0xa37d('0x7c')],_0x45b2c0);})['then'](function(_0x3013bf){_0x4e6c00=_0x3013bf;logger['info'](_0xa37d('0x5f'),_0x4e6c00['id']);return getTicket(_0x1c94a8,_0x358259,_0x4e6c00,_0x286306,_0xfe7966,_0x286306['Fields'],_0x45b2c0,_0xa37d('0x61'));})[_0xa37d('0x34')](function(_0x214c68){_0x1f048d=_0x214c68;logger[_0xa37d('0xf')](_0xa37d('0x62'));logger[_0xa37d('0xf')](_0xa37d('0x63'),_0x1f048d['id']);return setRelationship(_0x45b2c0,_0x358259,_0x1f048d,_0xa37d('0x70'));})[_0xa37d('0x34')](function(){return setRelationship(_0x45b2c0,_0x4e6c00,_0x1f048d,_0xa37d('0x71'));})[_0xa37d('0x34')](function(){return getServerInfo(_0x45b2c0);})[_0xa37d('0x67')](function(_0x2b1d5c){logger[_0xa37d('0x77')]('['+_0xfe7966[_0xa37d('0x79')][_0xa37d('0x7a')]()+']',JSON[_0xa37d('0x28')](_0x2b1d5c));});}; \ 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 451ba2d..0e99cda 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 _0xb5f0=['validateEmail','isNil','test','lodash','util','getString','sortBy','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','stripTrailingSlash','substring','lastIndexOf'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xb5f0,0xff));var _0x0b5f=function(_0x2a9094,_0x5f0ef8){_0x2a9094=_0x2a9094-0x0;var _0xd5e865=_0xb5f0[_0x2a9094];return _0xd5e865;};'use strict';var _=require(_0x0b5f('0x0'));var util=require(_0x0b5f('0x1'));exports[_0x0b5f('0x2')]=function(_0x2b95c7,_0x1dc424,_0x5b9743){var _0x2d4567=[];if(_0x2b95c7['length']>0x0){var _0x44f612=_[_0x0b5f('0x3')](_0x2b95c7,['id']);for(var _0x72afc7=0x0;_0x72afc7<_0x44f612[_0x0b5f('0x4')];_0x72afc7++){var _0x54d08e=_0x44f612[_0x72afc7];if(_0x54d08e[_0x0b5f('0x5')]===_0x0b5f('0x6')){_0x2d4567['push'](_0x54d08e[_0x0b5f('0x7')]);}else if(_0x54d08e[_0x0b5f('0x5')]===_0x0b5f('0x8')&&_0x54d08e[_0x0b5f('0x9')]){_0x1dc424[_0x54d08e[_0x0b5f('0x9')]]&&_0x2d4567[_0x0b5f('0xa')](_0x1dc424[_0x54d08e[_0x0b5f('0x9')]][_0x0b5f('0xb')]());}else if(_0x54d08e['type']===_0x0b5f('0xc')&&_0x54d08e[_0x0b5f('0xd')]&&_0x54d08e[_0x0b5f('0xd')][_0x0b5f('0xe')]){_0x1dc424[_0x54d08e[_0x0b5f('0xd')][_0x0b5f('0xe')]['toLowerCase']()]&&_0x2d4567['push'](_0x1dc424[_0x54d08e[_0x0b5f('0xd')][_0x0b5f('0xe')][_0x0b5f('0xf')]()][_0x0b5f('0xb')]());}else if(_0x54d08e[_0x0b5f('0x5')]===_0x0b5f('0x10')){if(_0x54d08e[_0x0b5f('0x11')]===_0x0b5f('0x6')&&_0x54d08e['key']){_0x2d4567[_0x0b5f('0xa')](util[_0x0b5f('0x12')](_0x0b5f('0x13'),_0x54d08e[_0x0b5f('0x14')],_0x54d08e[_0x0b5f('0x15')]));}else if(_0x54d08e['keyType']===_0x0b5f('0x8')&&_0x54d08e[_0x0b5f('0x9')]&&_0x54d08e[_0x0b5f('0x14')]){_0x1dc424[_0x54d08e[_0x0b5f('0x9')]]&&_0x2d4567[_0x0b5f('0xa')](util['format'](_0x0b5f('0x13'),_0x54d08e[_0x0b5f('0x14')],_0x1dc424[_0x54d08e[_0x0b5f('0x9')]]));}else if(_0x54d08e[_0x0b5f('0x11')]===_0x0b5f('0xc')&&_0x54d08e[_0x0b5f('0xd')]&&_0x54d08e['Variable']['name']&&_0x54d08e[_0x0b5f('0x14')]){_0x1dc424[_0x54d08e[_0x0b5f('0xd')][_0x0b5f('0xe')][_0x0b5f('0xf')]()]&&_0x2d4567['push'](util[_0x0b5f('0x12')](_0x0b5f('0x13'),_0x54d08e[_0x0b5f('0x14')],_0x1dc424[_0x54d08e['Variable'][_0x0b5f('0xe')]['toLowerCase']()]));}}}}return _0x2d4567['join'](_0x5b9743);};exports[_0x0b5f('0x16')]=function(_0x11288d){var _0x52db63=_0x11288d['slice'](-0x1);if(_0x52db63==='/'){_0x11288d=_0x11288d[_0x0b5f('0x17')](0x0,_0x11288d[_0x0b5f('0x18')](_0x52db63));}return _0x11288d;};exports[_0x0b5f('0x19')]=function(_0x37bf1c){if(!_[_0x0b5f('0x1a')](_0x37bf1c)&&_0x37bf1c!==''){var _0x2f1171=/^(([^<>()\[\]\\.,;:\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 _0x2f1171[_0x0b5f('0x1b')](String(_0x37bf1c)[_0x0b5f('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xd79a=['push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','type'];(function(_0x2b3441,_0x4f5b20){var _0x8dba7e=function(_0x4e76d8){while(--_0x4e76d8){_0x2b3441['push'](_0x2b3441['shift']());}};_0x8dba7e(++_0x4f5b20);}(_0xd79a,0xc6));var _0xad79=function(_0x39eede,_0x419600){_0x39eede=_0x39eede-0x0;var _0x20f0d6=_0xd79a[_0x39eede];return _0x20f0d6;};'use strict';var _=require(_0xad79('0x0'));var util=require(_0xad79('0x1'));exports[_0xad79('0x2')]=function(_0x11991f,_0x52318b,_0x183645){var _0xcc57e3=[];if(_0x11991f['length']>0x0){var _0x3c7a97=_[_0xad79('0x3')](_0x11991f,['id']);for(var _0x37811e=0x0;_0x37811e<_0x3c7a97['length'];_0x37811e++){var _0x5806ee=_0x3c7a97[_0x37811e];if(_0x5806ee[_0xad79('0x4')]==='string'){_0xcc57e3[_0xad79('0x5')](_0x5806ee[_0xad79('0x6')]);}else if(_0x5806ee['type']==='variable'&&_0x5806ee['variableName']){_0x52318b[_0x5806ee[_0xad79('0x7')]]&&_0xcc57e3['push'](_0x52318b[_0x5806ee['variableName']][_0xad79('0x8')]());}else if(_0x5806ee['type']===_0xad79('0x9')&&_0x5806ee[_0xad79('0xa')]&&_0x5806ee[_0xad79('0xa')][_0xad79('0xb')]){_0x52318b[_0x5806ee[_0xad79('0xa')][_0xad79('0xb')][_0xad79('0xc')]()]&&_0xcc57e3[_0xad79('0x5')](_0x52318b[_0x5806ee[_0xad79('0xa')][_0xad79('0xb')]['toLowerCase']()][_0xad79('0x8')]());}else if(_0x5806ee[_0xad79('0x4')]===_0xad79('0xd')){if(_0x5806ee[_0xad79('0xe')]===_0xad79('0xf')&&_0x5806ee[_0xad79('0x10')]){_0xcc57e3[_0xad79('0x5')](util[_0xad79('0x11')](_0xad79('0x12'),_0x5806ee[_0xad79('0x10')],_0x5806ee[_0xad79('0x13')]));}else if(_0x5806ee[_0xad79('0xe')]===_0xad79('0x14')&&_0x5806ee[_0xad79('0x7')]&&_0x5806ee['key']){_0x52318b[_0x5806ee[_0xad79('0x7')]]&&_0xcc57e3[_0xad79('0x5')](util['format']('%s:\x20%s',_0x5806ee[_0xad79('0x10')],_0x52318b[_0x5806ee['variableName']]));}else if(_0x5806ee[_0xad79('0xe')]===_0xad79('0x9')&&_0x5806ee['Variable']&&_0x5806ee[_0xad79('0xa')]['name']&&_0x5806ee[_0xad79('0x10')]){_0x52318b[_0x5806ee[_0xad79('0xa')][_0xad79('0xb')]['toLowerCase']()]&&_0xcc57e3[_0xad79('0x5')](util[_0xad79('0x11')](_0xad79('0x12'),_0x5806ee[_0xad79('0x10')],_0x52318b[_0x5806ee[_0xad79('0xa')][_0xad79('0xb')][_0xad79('0xc')]()]));}}}}return _0xcc57e3[_0xad79('0x15')](_0x183645);};exports[_0xad79('0x16')]=function(_0x5f11a8){var _0x19c76c=_0x5f11a8[_0xad79('0x17')](-0x1);if(_0x19c76c==='/'){_0x5f11a8=_0x5f11a8[_0xad79('0x18')](0x0,_0x5f11a8[_0xad79('0x19')](_0x19c76c));}return _0x5f11a8;};exports[_0xad79('0x1a')]=function(_0x52833c){if(!_[_0xad79('0x1b')](_0x52833c)&&_0x52833c!==''){var _0x406a6b=/^(([^<>()\[\]\\.,;:\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 _0x406a6b[_0xad79('0x1c')](String(_0x52833c)['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 c084968..46b75d5 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(_0x43eeb3,_0x44876d){var _0x53abd2=function(_0x5dfa8e){while(--_0x5dfa8e){_0x43eeb3['push'](_0x43eeb3['shift']());}};_0x53abd2(++_0x44876d);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 79e4a93..6169b49 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 _0xd52f=['defaults','redis','emit','application/json','format','%s/tickets.json','POST','merge','getString','Descriptions','Fields','then','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','picklist','customField','nameField','toLowerCase','content','string','type','idField','custom_fields','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','catch','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','/api/v2','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52f,0x64));var _0xfd52=function(_0x7cfbdb,_0x1597d9){_0x7cfbdb=_0x7cfbdb-0x0;var _0x5112a7=_0xd52f[_0x7cfbdb];return _0x5112a7;};'use strict';var _=require(_0xfd52('0x0'));var rp=require(_0xfd52('0x1'));var md5=require(_0xfd52('0x2'));var util=require(_0xfd52('0x3'));var Redis=require(_0xfd52('0x4'));var intUtil=require('./util');var config=require(_0xfd52('0x5'));var logger=require(_0xfd52('0x6'))('zendesk');config['redis']=_[_0xfd52('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd52('0x8')]));function emit(_0x4d567b,_0x1ddd0e,_0x1eb627){io['to'](_0x4d567b)[_0xfd52('0x9')](_0x1ddd0e,_0x1eb627);}var headers={'Content-Type':_0xfd52('0xa'),'Accept':_0xfd52('0xa')};function getTicket(_0x4fd201,_0x82c8da,_0xad52d9,_0x57f333,_0x1e3db7){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xfd52('0xb')](_0xfd52('0xc'),_0x4fd201['remoteUri']),'method':_0xfd52('0xd'),'body':{'ticket':_[_0xfd52('0xe')]({'requester_id':_0xad52d9['id'],'submitter_id':_0x82c8da?_0x82c8da['id']:undefined,'assignee_id':_0x82c8da?_0x82c8da['id']:undefined,'tags':getTags(_0x57f333['Tags'],'name'),'subject':intUtil[_0xfd52('0xf')](_0x57f333['Subjects'],_0x1e3db7,'\x20'),'description':intUtil['getString'](_0x57f333[_0xfd52('0x10')],_0x1e3db7,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x57f333[_0xfd52('0x10')],_0x1e3db7,'\x0a')}},getCustomFields(_0x57f333[_0xfd52('0x11')],_0x1e3db7))}})[_0xfd52('0x12')](function(_0x2f4d8c){logger[_0xfd52('0x13')](_0xfd52('0x14'));return _0x2f4d8c['ticket'];});}function getUser(_0x4e9706,_0x4024e1){if(intUtil['validateEmail'](_0x4024e1)){logger[_0xfd52('0x13')](_0xfd52('0x15'),_0x4024e1);return request({'uri':util['format'](_0xfd52('0x16'),_0x4e9706[_0xfd52('0x17')]),'qs':{'query':util[_0xfd52('0xb')]('type:user\x20role:agent\x20email:%s',_0x4024e1)}})[_0xfd52('0x12')](function(_0x2c7703){if(_0x2c7703[_0xfd52('0x18')]){logger[_0xfd52('0x13')](_0xfd52('0x19'));return _[_0xfd52('0x1a')](_0x2c7703[_0xfd52('0x1b')],{'email':_0x4024e1,'role':'agent'});}else{logger[_0xfd52('0x13')](_0xfd52('0x1c'));return request({'uri':util['format']('%s/users/me.json',_0x4e9706[_0xfd52('0x17')])})['then'](function(_0xe3c5e0){logger[_0xfd52('0x13')](_0xfd52('0x1d'));return _0xe3c5e0['user'];});}});}else{logger[_0xfd52('0x13')](_0xfd52('0x1c'));return request({'uri':util[_0xfd52('0xb')](_0xfd52('0x1e'),_0x4e9706['remoteUri'])})['then'](function(_0x4df8f0){logger['info'](_0xfd52('0x1d'));return _0x4df8f0[_0xfd52('0x1f')];});}}function getEndUser(_0x2d8e84,_0x32516a,_0x39c7ca){logger[_0xfd52('0x13')](_0xfd52('0x20'),_0x39c7ca);return request({'uri':util[_0xfd52('0xb')](_0xfd52('0x16'),_0x2d8e84['remoteUri']),'qs':{'query':util[_0xfd52('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x39c7ca)}})[_0xfd52('0x12')](function(_0x118c7c){var _0x4d1510;if(_0x118c7c[_0xfd52('0x1b')][_0xfd52('0x21')]){_0x118c7c[_0xfd52('0x1b')]=_[_0xfd52('0x22')](_0x118c7c[_0xfd52('0x1b')],{'suspended':![],'role':_0xfd52('0x23')});if(_0x118c7c[_0xfd52('0x1b')][_0xfd52('0x21')]){_0x4d1510=_['first'](_0x118c7c[_0xfd52('0x1b')]);}}if(_0x4d1510){logger[_0xfd52('0x13')](_0xfd52('0x24'));return _0x4d1510;}else{logger[_0xfd52('0x13')](_0xfd52('0x25'));return request({'uri':util['format'](_0xfd52('0x26'),_0x2d8e84[_0xfd52('0x17')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0xfd52('0x27'),_0x32516a||_0x39c7ca),'phone':_0x39c7ca}}})[_0xfd52('0x12')](function(_0xe287fb){logger[_0xfd52('0x13')](_0xfd52('0x28'));return _0xe287fb['user'];});}});}function getAuth(_0x12fc0c){var _0x479fdc;if(_0x12fc0c[_0xfd52('0x29')]===_0xfd52('0x2a')){_0x479fdc=util[_0xfd52('0xb')](_0xfd52('0x2b'),_0x12fc0c[_0xfd52('0x2c')],_0x12fc0c['password']);}else if(_0x12fc0c[_0xfd52('0x29')]===_0xfd52('0x2d')){_0x479fdc=util[_0xfd52('0xb')](_0xfd52('0x2e'),_0x12fc0c['username'],_0x12fc0c[_0xfd52('0x2d')]);}return util['format'](_0xfd52('0x2f'),new Buffer(_0x479fdc)[_0xfd52('0x30')](_0xfd52('0x31')));}function request(_0x5b5820){logger[_0xfd52('0x32')](_0xfd52('0x33'),JSON[_0xfd52('0x34')](_0x5b5820));return rp(_[_0xfd52('0x7')](_0x5b5820,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x41689a,_0x556074){var _0x413d42=[];if(_0x41689a&&_0x41689a['length']>0x0){_0x413d42=_[_0xfd52('0x35')](_0x41689a,_0x556074);}return _0x413d42;}function getCustomFields(_0x33e46e,_0x488f00){var _0xe90a4e=[];var _0xc13453={'custom_fields':[]};if(_0x33e46e[_0xfd52('0x21')]>0x0){_[_0xfd52('0x36')](_0x33e46e,function(_0x3d32c0){if(_[_0xfd52('0x37')](['string',_0xfd52('0x38')],_0x3d32c0['type'])&&_0x3d32c0['nameField']&&!_0x3d32c0[_0xfd52('0x39')]){_0xc13453[_0x3d32c0[_0xfd52('0x3a')][_0xfd52('0x3b')]()]=_0x3d32c0[_0xfd52('0x3c')][_0xfd52('0x30')]();}else if(_['includes']([_0xfd52('0x3d'),_0xfd52('0x38')],_0x3d32c0[_0xfd52('0x3e')])&&_0x3d32c0[_0xfd52('0x3f')]&&_0x3d32c0[_0xfd52('0x39')]){_0xc13453[_0xfd52('0x40')][_0xfd52('0x41')]({'id':_0x3d32c0[_0xfd52('0x3f')],'value':_0x3d32c0[_0xfd52('0x3c')][_0xfd52('0x30')]()});}else if(_0x3d32c0[_0xfd52('0x3e')]==='variable'&&_0x3d32c0['variableName']&&_0x3d32c0[_0xfd52('0x3f')]&&_0x3d32c0[_0xfd52('0x39')]){_0x488f00[_0x3d32c0['variableName']]&&_0xc13453[_0xfd52('0x40')][_0xfd52('0x41')]({'id':_0x3d32c0[_0xfd52('0x3f')],'value':_0x488f00[_0x3d32c0[_0xfd52('0x42')]][_0xfd52('0x30')]()});}else if(_0x3d32c0[_0xfd52('0x3e')]===_0xfd52('0x43')&&_0x3d32c0[_0xfd52('0x44')]&&_0x3d32c0['Variable']['name']&&_0x3d32c0[_0xfd52('0x3f')]&&_0x3d32c0['customField']){_0x488f00[_0x3d32c0['Variable'][_0xfd52('0x45')][_0xfd52('0x3b')]()]&&_0xc13453[_0xfd52('0x40')]['push']({'id':_0x3d32c0[_0xfd52('0x3f')],'value':_0x488f00[_0x3d32c0['Variable'][_0xfd52('0x45')][_0xfd52('0x3b')]()][_0xfd52('0x30')]()});}});}return _0xc13453;}exports[_0xfd52('0x46')]=function(_0x2e5a21,_0x4acf93,_0x250881,_0x58d799,_0x2b53c2,_0xdc2b19){var _0x2b0724,_0x1a7e11;_0xdc2b19['remoteUri']=intUtil[_0xfd52('0x47')](_0xdc2b19[_0xfd52('0x17')]);_0xdc2b19[_0xfd52('0x48')]=intUtil[_0xfd52('0x47')](_0xdc2b19[_0xfd52('0x48')]);if(_0x2b53c2&&_0x2b53c2[_0xfd52('0x49')]){logger['info'](_0xfd52('0x4a'),_0xfd52('0x4b'));_0x4acf93[_0xfd52('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdc2b19[_0xfd52('0x48')],_0x4acf93[_0xfd52('0x4d')],md5(_0x4acf93[_0xfd52('0x4d')]));}else{_0x4acf93[_0xfd52('0x4c')]='';}headers['Authorization']=getAuth(_0xdc2b19);return getUser(_0xdc2b19,_0x58d799[_0xfd52('0x4e')])[_0xfd52('0x12')](function(_0x9af2b5){_0x2b0724=_0x9af2b5;logger['info'](_0xfd52('0x4f'),_0x2b0724['id']);return getEndUser(_0xdc2b19,_0x4acf93[_0xfd52('0x50')],_0x4acf93[_0xfd52('0x51')]);})[_0xfd52('0x12')](function(_0x1835ae){_0x1a7e11=_0x1835ae;logger[_0xfd52('0x13')](_0xfd52('0x52'),_0x1a7e11['id']);return getTicket(_0xdc2b19,_0x2b0724,_0x1a7e11,_0x250881,_0x4acf93);})[_0xfd52('0x12')](function(_0x108a6a){if(_0x108a6a){logger['info'](_0xfd52('0x53'),_0x108a6a['id']);switch(_0xdc2b19[_0xfd52('0x3e')]){case _0xfd52('0x54'):logger[_0xfd52('0x13')](_0xfd52('0x4a'),_0xfd52('0x55'));return request({'uri':util[_0xfd52('0xb')](_0xfd52('0x56'),_0xdc2b19['remoteUri'],_0x2b0724['id'],_0x108a6a['id']),'method':_0xfd52('0xd')});case _0xfd52('0x57'):logger[_0xfd52('0x13')](_0xfd52('0x4a'),_0xfd52('0x58'));emit(util['format'](_0xfd52('0x59'),_0x58d799[_0xfd52('0x45')]),_0xfd52('0x5a'),{'uri':util[_0xfd52('0xb')](_0xfd52('0x5b'),_0xdc2b19[_0xfd52('0x17')][_0xfd52('0x5c')]('/api/v2',''),_0x108a6a['id'])});break;default:logger[_0xfd52('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xfd52('0x5e')](function(_0x29dc6e){logger[_0xfd52('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfd52('0x5f')](_0x29dc6e,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x55bdb3,_0x186503,_0xe95ead,_0x2453ff,_0xc1763f,_0x2f8bc1,_0x5de92d){var _0x628691,_0x315641;_0x2f8bc1[_0xfd52('0x17')]=intUtil['stripTrailingSlash'](_0x2f8bc1[_0xfd52('0x17')]);_0x2f8bc1[_0xfd52('0x48')]=intUtil[_0xfd52('0x47')](_0x2f8bc1[_0xfd52('0x48')]);if(_0x5de92d&&_0x5de92d[_0xfd52('0x60')]&&_0x5de92d['recordingFormat']!==_0xfd52('0x61')){logger[_0xfd52('0x13')](_0xfd52('0x62'),_0xfd52('0x4b'));_0x186503[_0xfd52('0x4c')]=util['format'](_0xfd52('0x63'),_0x2f8bc1[_0xfd52('0x48')],_0x186503['uniqueid'],md5(_0x186503[_0xfd52('0x4d')]));}headers[_0xfd52('0x64')]=getAuth(_0x2f8bc1);return getUser(_0x2f8bc1,_0x2453ff[_0xfd52('0x4e')])[_0xfd52('0x12')](function(_0x5a206b){_0x628691=_0x5a206b;logger['info'](_0xfd52('0x4f'),_0x628691['id']);return getEndUser(_0x2f8bc1,_0x186503[_0xfd52('0x65')],_0x186503[_0xfd52('0x66')]);})[_0xfd52('0x12')](function(_0x24cb85){_0x315641=_0x24cb85;logger['info'](_0xfd52('0x52'),_0x315641['id']);return getTicket(_0x2f8bc1,_0x628691,_0x315641,_0xe95ead,_0x186503);})[_0xfd52('0x12')](function(_0x514a01){if(_0x514a01){logger[_0xfd52('0x13')](_0xfd52('0x53'),_0x514a01['id']);switch(_0x2f8bc1[_0xfd52('0x3e')]){case'integrationTab':logger[_0xfd52('0x13')](_0xfd52('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfd52('0xb')](_0xfd52('0x56'),_0x2f8bc1[_0xfd52('0x17')],_0x628691['id'],_0x514a01['id']),'method':_0xfd52('0xd')});case _0xfd52('0x57'):logger[_0xfd52('0x13')](_0xfd52('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfd52('0xb')]('user:%s',_0x2453ff[_0xfd52('0x45')]),_0xfd52('0x5a'),{'uri':util[_0xfd52('0xb')](_0xfd52('0x5b'),_0x2f8bc1[_0xfd52('0x17')]['replace'](_0xfd52('0x67'),''),_0x514a01['id'])});break;default:logger[_0xfd52('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xfd52('0x5e')](function(_0xbc17c0){logger[_0xfd52('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfd52('0x5f')](_0xbc17c0,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xaaae3,_0xdbe4b4,_0x4b43d2,_0xc45cf1,_0x15358c,_0x415416){var _0x20a871,_0x4e0087;_0x415416[_0xfd52('0x17')]=intUtil[_0xfd52('0x47')](_0x415416[_0xfd52('0x17')]);_0x415416['serverUrl']=intUtil[_0xfd52('0x47')](_0x415416[_0xfd52('0x48')]);if(_0x15358c&&_0x15358c['monitor_format']){logger[_0xfd52('0x13')]('['+_0xdbe4b4[_0xfd52('0x68')][_0xfd52('0x69')]()+']',_0xfd52('0x4b'));_0xdbe4b4[_0xfd52('0x4c')]=util['format'](_0xfd52('0x63'),_0x415416['serverUrl'],_0xdbe4b4[_0xfd52('0x4d')],md5(_0xdbe4b4[_0xfd52('0x4d')]));}else{_0xdbe4b4['recordingURL']='';}headers['Authorization']=getAuth(_0x415416);return getUser(_0x415416)['then'](function(_0x3ed199){_0x20a871=_0x3ed199;logger[_0xfd52('0x13')]('The\x20User\x20ID\x20is:',_0x20a871['id']);return getEndUser(_0x415416,_0xdbe4b4[_0xfd52('0x50')],_0xdbe4b4['calleridnum']);})[_0xfd52('0x12')](function(_0x29d43b){_0x4e0087=_0x29d43b;logger[_0xfd52('0x13')]('The\x20Enduser\x20ID\x20is:',_0x4e0087['id']);return getTicket(_0x415416,_0x20a871,_0x4e0087,_0x4b43d2,_0xdbe4b4);})['then'](function(_0x39e647){if(_0x39e647){logger[_0xfd52('0x13')]('The\x20Ticket\x20ID\x20is:',_0x39e647['id']);}})[_0xfd52('0x5e')](function(_0x48a63f){logger[_0xfd52('0x5d')]('['+_0xdbe4b4[_0xfd52('0x68')][_0xfd52('0x69')]()+']'+_0xfd52('0x6a'),util['inspect'](_0x48a63f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xabb1=['type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','username','authType','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','forEach','includes','string','type','nameField','customField','toLowerCase','picklist','idField','push','content','variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','integrationTab','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','getString','Subjects','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xabb1,0xc4));var _0x1abb=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xabb1[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x1abb('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x1abb('0x1'));var Redis=require('ioredis');var intUtil=require(_0x1abb('0x2'));var config=require('../../../../config/environment');var logger=require(_0x1abb('0x3'))(_0x1abb('0x4'));config[_0x1abb('0x5')]=_[_0x1abb('0x6')](config[_0x1abb('0x5')],{'host':_0x1abb('0x7'),'port':0x18eb});var io=require(_0x1abb('0x8'))(new Redis(config['redis']));function emit(_0x4f5c56,_0x31b01b,_0x409d3f){io['to'](_0x4f5c56)[_0x1abb('0x9')](_0x31b01b,_0x409d3f);}var headers={'Content-Type':_0x1abb('0xa'),'Accept':'application/json'};function getTicket(_0x12974d,_0x30d1dc,_0x3988da,_0x152373,_0x299f5e){logger[_0x1abb('0xb')](_0x1abb('0xc'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0xe'),_0x12974d[_0x1abb('0xf')]),'method':_0x1abb('0x10'),'body':{'ticket':_[_0x1abb('0x11')]({'requester_id':_0x3988da['id'],'submitter_id':_0x30d1dc?_0x30d1dc['id']:undefined,'assignee_id':_0x30d1dc?_0x30d1dc['id']:undefined,'tags':getTags(_0x152373['Tags'],'name'),'subject':intUtil[_0x1abb('0x12')](_0x152373[_0x1abb('0x13')],_0x299f5e,'\x20'),'description':intUtil[_0x1abb('0x12')](_0x152373['Descriptions'],_0x299f5e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1abb('0x12')](_0x152373['Descriptions'],_0x299f5e,'\x0a')}},getCustomFields(_0x152373[_0x1abb('0x14')],_0x299f5e))}})[_0x1abb('0x15')](function(_0x3c3fec){logger[_0x1abb('0xb')](_0x1abb('0x16'));return _0x3c3fec[_0x1abb('0x17')];});}function getUser(_0x86d0dc,_0x4d9f2c){if(intUtil[_0x1abb('0x18')](_0x4d9f2c)){logger['info'](_0x1abb('0x19'),_0x4d9f2c);return request({'uri':util[_0x1abb('0xd')]('%s/search.json',_0x86d0dc['remoteUri']),'qs':{'query':util[_0x1abb('0xd')](_0x1abb('0x1a'),_0x4d9f2c)}})['then'](function(_0x2682b7){if(_0x2682b7[_0x1abb('0x1b')]){logger[_0x1abb('0xb')](_0x1abb('0x1c'));return _[_0x1abb('0x1d')](_0x2682b7[_0x1abb('0x1e')],{'email':_0x4d9f2c,'role':_0x1abb('0x1f')});}else{logger[_0x1abb('0xb')](_0x1abb('0x20'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0x21'),_0x86d0dc[_0x1abb('0xf')])})['then'](function(_0x1b3376){logger['info'](_0x1abb('0x22'));return _0x1b3376[_0x1abb('0x23')];});}});}else{logger[_0x1abb('0xb')](_0x1abb('0x20'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0x21'),_0x86d0dc[_0x1abb('0xf')])})[_0x1abb('0x15')](function(_0x29c33e){logger[_0x1abb('0xb')]('Admin\x20account\x20selected.');return _0x29c33e[_0x1abb('0x23')];});}}function getEndUser(_0x165705,_0x2382a7,_0x1380ab){logger[_0x1abb('0xb')](_0x1abb('0x24'),_0x1380ab);return request({'uri':util['format'](_0x1abb('0x25'),_0x165705['remoteUri']),'qs':{'query':util['format'](_0x1abb('0x26'),_0x1380ab)}})[_0x1abb('0x15')](function(_0x2d9367){var _0x1b6907;if(_0x2d9367[_0x1abb('0x1e')][_0x1abb('0x27')]){_0x2d9367[_0x1abb('0x1e')]=_[_0x1abb('0x28')](_0x2d9367[_0x1abb('0x1e')],{'suspended':![],'role':_0x1abb('0x29')});if(_0x2d9367['results'][_0x1abb('0x27')]){_0x1b6907=_[_0x1abb('0x2a')](_0x2d9367[_0x1abb('0x1e')]);}}if(_0x1b6907){logger[_0x1abb('0xb')](_0x1abb('0x2b'));return _0x1b6907;}else{logger[_0x1abb('0xb')](_0x1abb('0x2c'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0x2d'),_0x165705['remoteUri']),'method':_0x1abb('0x10'),'body':{'user':{'role':_0x1abb('0x29'),'name':util[_0x1abb('0xd')](_0x1abb('0x2e'),_0x2382a7||_0x1380ab),'phone':_0x1380ab}}})[_0x1abb('0x15')](function(_0x43bb07){logger[_0x1abb('0xb')](_0x1abb('0x2f'));return _0x43bb07[_0x1abb('0x23')];});}});}function getAuth(_0x2fa133){var _0x47fa0f;if(_0x2fa133['authType']===_0x1abb('0x30')){_0x47fa0f=util[_0x1abb('0xd')]('%s:%s',_0x2fa133[_0x1abb('0x31')],_0x2fa133[_0x1abb('0x30')]);}else if(_0x2fa133[_0x1abb('0x32')]===_0x1abb('0x33')){_0x47fa0f=util[_0x1abb('0xd')]('%s/token:%s',_0x2fa133['username'],_0x2fa133[_0x1abb('0x33')]);}return util[_0x1abb('0xd')](_0x1abb('0x34'),new Buffer(_0x47fa0f)[_0x1abb('0x35')](_0x1abb('0x36')));}function request(_0x2c6cc6){logger[_0x1abb('0x37')](_0x1abb('0x38'),JSON['stringify'](_0x2c6cc6));return rp(_['defaults'](_0x2c6cc6,{'method':_0x1abb('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x460b84,_0xf9bdd){var _0x32b8b0=[];if(_0x460b84&&_0x460b84[_0x1abb('0x27')]>0x0){_0x32b8b0=_['map'](_0x460b84,_0xf9bdd);}return _0x32b8b0;}function getCustomFields(_0x290c67,_0x32d601){var _0x151bfb=[];var _0x4d366a={'custom_fields':[]};if(_0x290c67[_0x1abb('0x27')]>0x0){_[_0x1abb('0x3a')](_0x290c67,function(_0x2e445b){if(_[_0x1abb('0x3b')]([_0x1abb('0x3c'),'picklist'],_0x2e445b[_0x1abb('0x3d')])&&_0x2e445b[_0x1abb('0x3e')]&&!_0x2e445b[_0x1abb('0x3f')]){_0x4d366a[_0x2e445b[_0x1abb('0x3e')][_0x1abb('0x40')]()]=_0x2e445b['content'][_0x1abb('0x35')]();}else if(_['includes']([_0x1abb('0x3c'),_0x1abb('0x41')],_0x2e445b['type'])&&_0x2e445b[_0x1abb('0x42')]&&_0x2e445b[_0x1abb('0x3f')]){_0x4d366a['custom_fields'][_0x1abb('0x43')]({'id':_0x2e445b[_0x1abb('0x42')],'value':_0x2e445b[_0x1abb('0x44')]['toString']()});}else if(_0x2e445b[_0x1abb('0x3d')]==='variable'&&_0x2e445b[_0x1abb('0x45')]&&_0x2e445b['idField']&&_0x2e445b[_0x1abb('0x3f')]){_0x32d601[_0x2e445b[_0x1abb('0x45')]]&&_0x4d366a['custom_fields'][_0x1abb('0x43')]({'id':_0x2e445b[_0x1abb('0x42')],'value':_0x32d601[_0x2e445b[_0x1abb('0x45')]][_0x1abb('0x35')]()});}else if(_0x2e445b[_0x1abb('0x3d')]===_0x1abb('0x46')&&_0x2e445b['Variable']&&_0x2e445b['Variable'][_0x1abb('0x47')]&&_0x2e445b['idField']&&_0x2e445b[_0x1abb('0x3f')]){_0x32d601[_0x2e445b[_0x1abb('0x48')][_0x1abb('0x47')][_0x1abb('0x40')]()]&&_0x4d366a['custom_fields'][_0x1abb('0x43')]({'id':_0x2e445b[_0x1abb('0x42')],'value':_0x32d601[_0x2e445b[_0x1abb('0x48')][_0x1abb('0x47')][_0x1abb('0x40')]()][_0x1abb('0x35')]()});}});}return _0x4d366a;}exports[_0x1abb('0x49')]=function(_0x2fdf4d,_0xe8bb1c,_0x190dcc,_0x2020a2,_0x3177d3,_0x355e39){var _0x28079a,_0x33e19a;_0x355e39[_0x1abb('0xf')]=intUtil[_0x1abb('0x4a')](_0x355e39[_0x1abb('0xf')]);_0x355e39[_0x1abb('0x4b')]=intUtil[_0x1abb('0x4a')](_0x355e39[_0x1abb('0x4b')]);if(_0x3177d3&&_0x3177d3[_0x1abb('0x4c')]){logger[_0x1abb('0xb')](_0x1abb('0x4d'),'Recording\x20is\x20enabled!');_0xe8bb1c[_0x1abb('0x4e')]=util[_0x1abb('0xd')](_0x1abb('0x4f'),_0x355e39[_0x1abb('0x4b')],_0xe8bb1c[_0x1abb('0x50')],md5(_0xe8bb1c['uniqueid']));}else{_0xe8bb1c['recordingURL']='';}headers[_0x1abb('0x51')]=getAuth(_0x355e39);return getUser(_0x355e39,_0x2020a2[_0x1abb('0x52')])['then'](function(_0x1399d7){_0x28079a=_0x1399d7;logger[_0x1abb('0xb')](_0x1abb('0x53'),_0x28079a['id']);return getEndUser(_0x355e39,_0xe8bb1c[_0x1abb('0x54')],_0xe8bb1c[_0x1abb('0x55')]);})['then'](function(_0x7be78c){_0x33e19a=_0x7be78c;logger[_0x1abb('0xb')](_0x1abb('0x56'),_0x33e19a['id']);return getTicket(_0x355e39,_0x28079a,_0x33e19a,_0x190dcc,_0xe8bb1c);})[_0x1abb('0x15')](function(_0x447390){if(_0x447390){logger[_0x1abb('0xb')](_0x1abb('0x57'),_0x447390['id']);switch(_0x355e39['type']){case'integrationTab':logger[_0x1abb('0xb')]('[QUEUE]',_0x1abb('0x58'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0x59'),_0x355e39['remoteUri'],_0x28079a['id'],_0x447390['id']),'method':'POST'});case'newTab':logger[_0x1abb('0xb')](_0x1abb('0x4d'),_0x1abb('0x5a'));emit(util[_0x1abb('0xd')](_0x1abb('0x5b'),_0x2020a2[_0x1abb('0x47')]),_0x1abb('0x5c'),{'uri':util[_0x1abb('0xd')](_0x1abb('0x5d'),_0x355e39[_0x1abb('0xf')][_0x1abb('0x5e')](_0x1abb('0x5f'),''),_0x447390['id'])});break;default:logger[_0x1abb('0x60')](_0x1abb('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x26a46a){logger[_0x1abb('0x60')](_0x1abb('0x61'),util[_0x1abb('0x62')](_0x26a46a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4d0c4a,_0x10dfa6,_0x2de085,_0x11b17d,_0x2217f6,_0xdd2f6e,_0x801986){var _0x23ff5e,_0x48fec4;_0xdd2f6e['remoteUri']=intUtil[_0x1abb('0x4a')](_0xdd2f6e[_0x1abb('0xf')]);_0xdd2f6e[_0x1abb('0x4b')]=intUtil['stripTrailingSlash'](_0xdd2f6e[_0x1abb('0x4b')]);if(_0x801986&&_0x801986[_0x1abb('0x63')]&&_0x801986[_0x1abb('0x63')]!==_0x1abb('0x64')){logger[_0x1abb('0xb')]('[OUTBOUND]',_0x1abb('0x65'));_0x10dfa6[_0x1abb('0x4e')]=util[_0x1abb('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdd2f6e[_0x1abb('0x4b')],_0x10dfa6[_0x1abb('0x50')],md5(_0x10dfa6[_0x1abb('0x50')]));}headers[_0x1abb('0x51')]=getAuth(_0xdd2f6e);return getUser(_0xdd2f6e,_0x11b17d['email'])[_0x1abb('0x15')](function(_0x369e61){_0x23ff5e=_0x369e61;logger[_0x1abb('0xb')](_0x1abb('0x53'),_0x23ff5e['id']);return getEndUser(_0xdd2f6e,_0x10dfa6['destcalleridname'],_0x10dfa6[_0x1abb('0x66')]);})[_0x1abb('0x15')](function(_0x216ca0){_0x48fec4=_0x216ca0;logger['info'](_0x1abb('0x56'),_0x48fec4['id']);return getTicket(_0xdd2f6e,_0x23ff5e,_0x48fec4,_0x2de085,_0x10dfa6);})['then'](function(_0x18cddc){if(_0x18cddc){logger[_0x1abb('0xb')](_0x1abb('0x57'),_0x18cddc['id']);switch(_0xdd2f6e[_0x1abb('0x3d')]){case _0x1abb('0x67'):logger[_0x1abb('0xb')](_0x1abb('0x68'),_0x1abb('0x58'));return request({'uri':util[_0x1abb('0xd')](_0x1abb('0x59'),_0xdd2f6e[_0x1abb('0xf')],_0x23ff5e['id'],_0x18cddc['id']),'method':_0x1abb('0x10')});case'newTab':logger['info'](_0x1abb('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1abb('0x5b'),_0x11b17d[_0x1abb('0x47')]),_0x1abb('0x5c'),{'uri':util[_0x1abb('0xd')]('%s/agent/tickets/%s',_0xdd2f6e[_0x1abb('0xf')][_0x1abb('0x5e')](_0x1abb('0x5f'),''),_0x18cddc['id'])});break;default:logger[_0x1abb('0x60')](_0x1abb('0x68'),_0x1abb('0x69'));}}})[_0x1abb('0x6a')](function(_0xb543ae){logger[_0x1abb('0x60')](_0x1abb('0x6b'),util[_0x1abb('0x62')](_0xb543ae,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4dc136,_0x47102c,_0x11fd89,_0x1021d6,_0x16a267,_0x45c3dd){var _0x5a2541,_0x177f1e;_0x45c3dd[_0x1abb('0xf')]=intUtil[_0x1abb('0x4a')](_0x45c3dd[_0x1abb('0xf')]);_0x45c3dd[_0x1abb('0x4b')]=intUtil[_0x1abb('0x4a')](_0x45c3dd[_0x1abb('0x4b')]);if(_0x16a267&&_0x16a267[_0x1abb('0x4c')]){logger['info']('['+_0x47102c['lastevent'][_0x1abb('0x6c')]()+']',_0x1abb('0x65'));_0x47102c[_0x1abb('0x4e')]=util[_0x1abb('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45c3dd[_0x1abb('0x4b')],_0x47102c[_0x1abb('0x50')],md5(_0x47102c['uniqueid']));}else{_0x47102c['recordingURL']='';}headers[_0x1abb('0x51')]=getAuth(_0x45c3dd);return getUser(_0x45c3dd)['then'](function(_0x87e87f){_0x5a2541=_0x87e87f;logger['info'](_0x1abb('0x53'),_0x5a2541['id']);return getEndUser(_0x45c3dd,_0x47102c['calleridname'],_0x47102c[_0x1abb('0x55')]);})['then'](function(_0x1332c2){_0x177f1e=_0x1332c2;logger[_0x1abb('0xb')]('The\x20Enduser\x20ID\x20is:',_0x177f1e['id']);return getTicket(_0x45c3dd,_0x5a2541,_0x177f1e,_0x11fd89,_0x47102c);})['then'](function(_0xe50ed5){if(_0xe50ed5){logger[_0x1abb('0xb')](_0x1abb('0x57'),_0xe50ed5['id']);}})['catch'](function(_0x5690bc){logger['error']('['+_0x47102c[_0x1abb('0x6d')][_0x1abb('0x6c')]()+']'+_0x1abb('0x6e'),util[_0x1abb('0x62')](_0x5690bc,{'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 38c0ff0..0a6cc60 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 _0x69e5=['[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','/downloads?type=uniqueid&token=','com','lastevent','lodash','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','length','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','contact_lead','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Owner','Subject','getString','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','details','err','queue','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:'];(function(_0x3bed47,_0x590122){var _0x34d557=function(_0x115186){while(--_0x115186){_0x3bed47['push'](_0x3bed47['shift']());}};_0x34d557(++_0x590122);}(_0x69e5,0xaa));var _0x569e=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x69e5[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0x569e('0x0'));var rp=require(_0x569e('0x1'));var md5=require('md5');var util=require(_0x569e('0x2'));var intUtil=require(_0x569e('0x3'));var moment=require(_0x569e('0x4'));var Redis=require(_0x569e('0x5'));var BPromise=require('bluebird');var config=require(_0x569e('0x6'));var logger=require(_0x569e('0x7'))(_0x569e('0x8'));config[_0x569e('0x9')]=_[_0x569e('0xa')](config[_0x569e('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x569e('0x9')]));function emit(_0x12fa5b,_0x2bffee,_0x3d58da){io['to'](_0x12fa5b)[_0x569e('0xb')](_0x2bffee,_0x3d58da);}function request(_0x1b87b2){logger[_0x569e('0xc')](_0x569e('0xd'),JSON['stringify'](_0x1b87b2));return rp(_0x1b87b2);}function getCustomFields(_0x41a188,_0x12ca32){var _0xe0ac5d={};if(_0x41a188[_0x569e('0xe')]>0x0){_['forEach'](_0x41a188,function(_0x12eb72){if(_[_0x569e('0xf')]([_0x569e('0x10'),_0x569e('0x11')],_0x12eb72[_0x569e('0x12')])&&_0x12eb72[_0x569e('0x13')]){_0xe0ac5d[_0x12eb72['idField']]=_0x12eb72['content'][_0x569e('0x14')]();}else if(_0x12eb72[_0x569e('0x12')]===_0x569e('0x15')&&_0x12eb72[_0x569e('0x16')]&&_0x12eb72['idField']&&_0x12ca32[_0x12eb72[_0x569e('0x16')]]){_0xe0ac5d[_0x12eb72['idField']]=_0x12ca32[_0x12eb72['variableName']][_0x569e('0x14')]();}else if(_0x12eb72['type']===_0x569e('0x17')&&_0x12eb72[_0x569e('0x18')]&&_0x12eb72[_0x569e('0x18')]['name']&&_0x12eb72[_0x569e('0x13')]&&_0x12ca32[_0x12eb72[_0x569e('0x18')][_0x569e('0x19')]['toLowerCase']()]){_0xe0ac5d[_0x12eb72[_0x569e('0x13')]]=_0x12ca32[_0x12eb72['Variable'][_0x569e('0x19')][_0x569e('0x1a')]()][_0x569e('0x14')]();}});}return _0xe0ac5d;}function getName(_0x5c640d){if(_0x5c640d['indexOf']('\x20')>0x0){var _0x3b93ea=_0x5c640d[_0x569e('0x1b')](/ (.+)/);if(_0x3b93ea[0x1]){return _0x3b93ea;}}return[_0x5c640d,_0x5c640d];}var accountsTokens={};function getAccessToken(_0x4301b2){return new Promise(function(_0x746bd,_0x49709a){if(!_[_0x569e('0x1c')](accountsTokens[_0x4301b2['id']])&&!_[_0x569e('0x1c')](accountsTokens[_0x4301b2['id']]['access_token'])){if(moment()[_0x569e('0x1d')](accountsTokens[_0x4301b2['id']][_0x569e('0x1e')])){_0x746bd(accountsTokens[_0x4301b2['id']][_0x569e('0x1f')]);}}var _0x57d56b;switch(_0x4301b2[_0x569e('0x20')]){case'US':_0x57d56b=_0x569e('0x21');break;case'AU':_0x57d56b=_0x569e('0x22');break;case'EU':_0x57d56b=_0x569e('0x23');break;case'IN':_0x57d56b=_0x569e('0x24');break;case'CN':_0x57d56b=_0x569e('0x25');break;default:_0x57d56b='https://accounts.zoho.eu';break;}var _0xdb649d={'method':_0x569e('0x26'),'uri':_0x57d56b+_0x569e('0x27'),'qs':{'refresh_token':_0x4301b2[_0x569e('0x28')],'client_id':_0x4301b2[_0x569e('0x29')],'client_secret':_0x4301b2[_0x569e('0x2a')],'grant_type':_0x569e('0x2b')},'json':!![]};return rp(_0xdb649d)[_0x569e('0x2c')](function(_0x242fbf){accountsTokens[_0x4301b2['id']]={'access_token':_0x242fbf[_0x569e('0x1f')],'expires_in':moment()[_0x569e('0x2d')](_0x242fbf['expires_in'],_0x569e('0x2e'))};_0x746bd(_0x242fbf[_0x569e('0x1f')]);})[_0x569e('0x2f')](function(_0x17d28a){logger['error'](_0x569e('0x30'),_0x17d28a[_0x569e('0x31')]);_0x49709a(_0x17d28a);});});}function getUser(_0x5c073e,_0x118a70,_0x521023,_0x2fec55){logger[_0x569e('0x32')]('Search\x20user');return request({'method':_0x569e('0x33'),'uri':util[_0x569e('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x118a70),'qs':{'type':_0x569e('0x35')},'headers':{'Authorization':_0x569e('0x36')+_0x5c073e},'json':!![]})[_0x569e('0x2c')](function(_0x466f91){if(_0x466f91[_0x569e('0x37')]){var _0x4d97d9=-0x1;if(_[_0x569e('0x38')](_0x466f91[_0x569e('0x37')])){if(!_[_0x569e('0x1c')](_0x2fec55)){_0x4d97d9=_[_0x569e('0x39')](_0x466f91[_0x569e('0x37')],function(_0x31e8ac){return _0x31e8ac[_0x569e('0x3a')]===_0x2fec55;});}if(_0x4d97d9>=0x0){logger[_0x569e('0x32')](_0x569e('0x3b'));}else{logger[_0x569e('0x32')](_0x569e('0x3c'));_0x4d97d9=_['findIndex'](_0x466f91['users'],function(_0xb3ef01){return _0xb3ef01[_0x569e('0x3d')][_0x569e('0x19')]===_0x569e('0x3e');});}return _0x466f91[_0x569e('0x37')][_0x4d97d9];}else{if(_0x466f91['user'][_0x569e('0x3d')]['name']===_0x569e('0x3e')){logger['info'](_0x569e('0x3c'));user=_0x466f91[_0x569e('0x3f')];return user;}else{logger[_0x569e('0x40')](_0x569e('0x41'),JSON[_0x569e('0x42')](_0x466f91));throw new Error(_0x569e('0x43')+JSON[_0x569e('0x42')](_0x466f91));}}}else{logger[_0x569e('0x40')](_0x569e('0x41'),JSON['stringify'](_0x466f91));throw new Error(_0x569e('0x43')+JSON[_0x569e('0x42')](_0x466f91));}})[_0x569e('0x2f')](function(_0x5a347e){console[_0x569e('0x40')](_0x5a347e);});}function getZohoUser(_0x146bf1,_0x103dca){return new BPromise(function(_0x227d56,_0xed0d3b){request(_0x146bf1)['then'](function(_0x445832){var _0x7c9db9=null;if(_0x445832){_0x7c9db9=_0x445832[_0x569e('0x44')][0x0];_0x7c9db9['enduserType']=_0x103dca;}_0x227d56(_0x7c9db9);})[_0x569e('0x2f')](function(_0x5e8535){_0xed0d3b(_0x5e8535);});});}function createEndUser(_0x3eac41,_0x486a06,_0x1ea047,_0xcd8d17,_0x25bd94,_0x212ea3){var _0x1ea047=getName(_0x1ea047);return request({'method':_0x569e('0x26'),'uri':_0x569e('0x45')+_0x486a06+_0x569e('0x46')+_[_0x569e('0x47')](_0x212ea3[_0x569e('0x48')])+'s','body':{'data':[{'Last_Name':_0x1ea047[0x1],'First_Name':_0x1ea047[0x0],'Phone':_0xcd8d17,'Owner':{'name':!_[_0x569e('0x1c')](_0x25bd94[_0x569e('0x49')][_0x569e('0x19')])?_0x25bd94['role']['name']:!_['isNil'](_0x25bd94[_0x569e('0x4a')])?_0x25bd94['first_name']+'\x20'+_0x25bd94[_0x569e('0x4b')]:_0x25bd94[_0x569e('0x4b')],'id':_0x25bd94['id']}}]},'headers':{'Authorization':_0x569e('0x36')+_0x3eac41},'json':!![]})['then'](function(_0xbcc71a){if(_0xbcc71a&&_0xbcc71a[_0x569e('0x44')][0x0][_0x569e('0x4c')]===_0x569e('0x4d')){var _0x2b40a3=_0xbcc71a[_0x569e('0x44')][0x0]['details'];_0x2b40a3['enduserType']=_['startCase'](_0x212ea3['moduleCreate'])+'s';return _0x2b40a3;}logger['error'](_0x569e('0x41'),JSON[_0x569e('0x42')](data));throw new Error(_0x569e('0x4e')+JSON[_0x569e('0x42')](data));})[_0x569e('0x2f')](function(_0x2700e9){console[_0x569e('0x4f')](_0x569e('0x50'),_0x2700e9);});}function getEndUser(_0x4d9abb,_0xfac975,_0x39ef35,_0x2c284c,_0x4491f3,_0x4c175b,_0x4a92ac){var _0x442e33={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4d9abb},'json':!![]};switch(_0x4a92ac['moduleSearch']){case _0x569e('0x51'):_0x442e33['uri']='https://www.zohoapis.'+_0xfac975+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4491f3+'))';return getZohoUser(_0x442e33,_0x569e('0x52'))['then'](function(_0xa24d7c){if(_0xa24d7c)return _0xa24d7c;_0x442e33[_0x569e('0x53')]='https://www.zohoapis.'+_0xfac975+_0x569e('0x54')+_0x4491f3+'))';return getZohoUser(_0x442e33,_0x569e('0x55'))[_0x569e('0x2c')](function(_0x30f6ee){if(_0x30f6ee)return _0x30f6ee;if(_0x4a92ac[_0x569e('0x48')]!=_0x569e('0x56')){return createEndUser(_0x4d9abb,_0xfac975,_0x2c284c,_0x4491f3,_0x4c175b,_0x4a92ac);}else{return{};}});});break;case'contact':_0x442e33['uri']='https://www.zohoapis.'+_0xfac975+_0x569e('0x57')+_0x4491f3+'))';return getZohoUser(_0x442e33,'Contacts')[_0x569e('0x2c')](function(_0x11515d){if(_0x11515d)return _0x11515d;if(_0x4a92ac[_0x569e('0x48')]!=_0x569e('0x56')){return createEndUser(_0x4d9abb,_0xfac975,_0x2c284c,_0x4491f3,_0x4c175b,_0x4a92ac);}else{return{};}});break;case _0x569e('0x58'):_0x442e33[_0x569e('0x53')]=_0x569e('0x45')+_0xfac975+_0x569e('0x54')+_0x4491f3+'))';return getZohoUser(_0x442e33,_0x569e('0x55'))[_0x569e('0x2c')](function(_0x4d9af7){if(_0x4d9af7)return _0x4d9af7;if(_0x4a92ac[_0x569e('0x48')]!=_0x569e('0x56')){return createEndUser(_0x4d9abb,_0xfac975,_0x2c284c,_0x4491f3,_0x4c175b,_0x4a92ac);}else{return{};}});break;}}function getCall(_0x4d1c75,_0x2ae1d4,_0x24e089,_0x33bb44,_0x3bfd92,_0x3a0964,_0x3eb46a,_0x20d63a){logger[_0x569e('0x32')]('Creating\x20new\x20call...');var _0x291f20={};_0x291f20[_0x569e('0x59')]={'name':!_[_0x569e('0x1c')](_0x33bb44[_0x569e('0x49')]['name'])&&!_[_0x569e('0x1c')](_0x33bb44[_0x569e('0x3d')]['name'])&&_0x33bb44[_0x569e('0x3d')][_0x569e('0x19')]==='administrator'?_0x33bb44['role'][_0x569e('0x19')]:!_[_0x569e('0x1c')](_0x33bb44[_0x569e('0x4a')])?_0x33bb44[_0x569e('0x4a')]+'\x20'+_0x33bb44[_0x569e('0x4b')]:_0x33bb44['last_name'],'id':_0x33bb44['id']};_0x291f20[_0x569e('0x5a')]=intUtil['getString'](_0x3a0964['Subjects'],_0x3eb46a,'\x20');_0x291f20['Description']=intUtil[_0x569e('0x5b')](_0x3a0964[_0x569e('0x5c')],_0x3eb46a,'\x0a');if(_0x3bfd92[_0x569e('0x5d')]===_0x569e('0x52')){_0x291f20[_0x569e('0x5e')]={'name':!_[_0x569e('0x1c')](_0x3bfd92[_0x569e('0x5f')])?_0x3bfd92['Full_Name']:!_[_0x569e('0x1c')](_0x3bfd92[_0x569e('0x60')])?_0x3bfd92['First_Name']+'\x20'+_0x3bfd92[_0x569e('0x61')]:_0x3bfd92[_0x569e('0x61')],'id':_0x3bfd92['id']};}if(_0x3bfd92[_0x569e('0x5d')]===_0x569e('0x55')){_0x291f20['What_Id']={'name':!_[_0x569e('0x1c')](_0x3bfd92['Full_Name'])?_0x3bfd92[_0x569e('0x5f')]:!_[_0x569e('0x1c')](_0x3bfd92[_0x569e('0x60')])?_0x3bfd92[_0x569e('0x60')]+'\x20'+_0x3bfd92[_0x569e('0x61')]:_0x3bfd92[_0x569e('0x61')],'id':_0x3bfd92['id']};_0x291f20[_0x569e('0x62')]=_[_0x569e('0x47')](_0x3bfd92['enduserType']);}if(_0x3eb46a[_0x569e('0x63')]){_0x291f20[_0x569e('0x64')]=moment[_0x569e('0x65')](parseInt(_0x3eb46a[_0x569e('0x63')])*0x3e8)[_0x569e('0x34')](_0x569e('0x66'));}else if(_0x3eb46a[_0x569e('0x67')]&&_0x3eb46a[_0x569e('0x68')]){_0x291f20['Call_Duration']=moment[_0x569e('0x65')](moment(_0x3eb46a[_0x569e('0x68')],_0x569e('0x69'))[_0x569e('0x6a')](moment(_0x3eb46a[_0x569e('0x6b')],_0x569e('0x69'))))['format']('mm:ss');}switch(_0x3eb46a['lastevent']){case'called':_0x291f20[_0x569e('0x6c')]=_0x569e('0x6d');break;case _0x569e('0x6e'):case _0x569e('0x6f'):_0x291f20[_0x569e('0x6c')]=_0x569e('0x70');break;case'rejected':_0x291f20[_0x569e('0x6c')]=_0x569e('0x71');break;case _0x569e('0x72'):_0x291f20[_0x569e('0x6c')]=_0x569e('0x73');break;case _0x569e('0x74'):_0x291f20[_0x569e('0x6c')]='Timeout';default:}_0x291f20[_0x569e('0x75')]=(_0x20d63a===_0x569e('0x76')?moment(_0x3eb46a[_0x569e('0x6b')])[_0x569e('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3eb46a[_0x569e('0x77')])[_0x569e('0x34')](_0x569e('0x69')))||moment()[_0x569e('0x34')](_0x569e('0x69'));_0x291f20['Call_Type']=_0x20d63a||_0x569e('0x78');_0x291f20=_[_0x569e('0x79')](_0x291f20,getCustomFields(_0x3a0964[_0x569e('0x7a')],_0x3eb46a));return request({'method':_0x569e('0x26'),'uri':'https://www.zohoapis.'+_0x2ae1d4+_0x569e('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4d1c75},'body':{'data':[_0x291f20]},'json':!![]})[_0x569e('0x2c')](function(_0x4e96e4){if(_0x4e96e4&&_0x4e96e4[_0x569e('0x44')][0x0]['code']==='SUCCESS'){logger[_0x569e('0x32')]('Call\x20created!');return{'id':_0x4e96e4[_0x569e('0x44')][0x0][_0x569e('0x7c')]['id']};}})[_0x569e('0x2f')](function(_0x5699ae){logger[_0x569e('0x32')](_0x569e('0x7d'),_0x5699ae[_0x569e('0x31')]);console[_0x569e('0x4f')]('err',_0x5699ae);});}exports[_0x569e('0x7e')]=function(_0x384dba,_0xfb44e3,_0x39911a,_0xb711a0,_0x3ec4ec,_0x363e39){var _0xcbe66a,_0x4c8aa9,_0x4a2326;_0x363e39[_0x569e('0x7f')]=intUtil['stripTrailingSlash'](_0x363e39[_0x569e('0x7f')]);_0x363e39['serverUrl']=intUtil['stripTrailingSlash'](_0x363e39[_0x569e('0x80')]);if(_0x3ec4ec&&_0x3ec4ec[_0x569e('0x81')]){logger[_0x569e('0x32')]('[QUEUE]',_0x569e('0x82'));_0xfb44e3['recordingURL']=_0x363e39['serverUrl']+'/api/voice/recordings/'+_0xfb44e3[_0x569e('0x83')]+'/downloads?type=uniqueid&token='+md5(_0xfb44e3[_0x569e('0x83')]);}else{_0xfb44e3[_0x569e('0x84')]='';}var _0x2c9462=_0x363e39[_0x569e('0x7f')]===_0x569e('0x85')?'eu':'com';return getAccessToken(_0x363e39)[_0x569e('0x2c')](function(_0x3154c2){_0x4a2326=_0x3154c2;return getUser(_0x4a2326,_0x2c9462,_0x363e39,_0xb711a0[_0x569e('0x3a')]);})['then'](function(_0x8a0258){_0xcbe66a=_0x8a0258;logger[_0x569e('0x32')](_0x569e('0x86'),_0xcbe66a['id']);return getEndUser(_0x4a2326,_0x2c9462,_0x363e39,_0xfb44e3[_0x569e('0x87')],_0xfb44e3[_0x569e('0x88')],_0xcbe66a,_0x39911a);})[_0x569e('0x2c')](function(_0x2a8d60){_0x4c8aa9=_0x2a8d60;return getCall(_0x4a2326,_0x2c9462,_0x363e39,_0xcbe66a,_0x4c8aa9,_0x39911a,_0xfb44e3,_0x569e('0x78'));})['then'](function(_0x516746){if(_0x516746){logger[_0x569e('0x32')](_0x569e('0x89'),_0x516746['id']);logger[_0x569e('0x32')](_0x569e('0x8a'),_0x569e('0x8b'));emit(util[_0x569e('0x34')](_0x569e('0x8c'),_0xb711a0[_0x569e('0x19')]),_0x569e('0x8d'),{'uri':_0x569e('0x8e')+_0x363e39[_0x569e('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x516746['id']});}})[_0x569e('0x2f')](function(_0x256894){logger[_0x569e('0x40')](_0x569e('0x8a'),JSON[_0x569e('0x42')](_0x256894));});};exports['outbound']=function(_0xeacbcc,_0x1e9e24,_0x2cc63a,_0x23a1d0,_0x15f123,_0x23caff,_0x3a87c8){var _0x219c43,_0x48d4c0,_0x33fd87;_0x23caff['host']=intUtil['stripTrailingSlash'](_0x23caff[_0x569e('0x7f')]);_0x23caff['serverUrl']=intUtil[_0x569e('0x8f')](_0x23caff[_0x569e('0x80')]);if(_0x3a87c8&&_0x3a87c8[_0x569e('0x90')]&&_0x3a87c8[_0x569e('0x90')]!==_0x569e('0x91')){logger[_0x569e('0x32')](_0x569e('0x92'),_0x569e('0x82'));_0x1e9e24[_0x569e('0x84')]=_0x23caff[_0x569e('0x80')]+_0x569e('0x93')+_0x1e9e24[_0x569e('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1e9e24['uniqueid']);}var _0x38dd91=_0x23caff[_0x569e('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x23caff)[_0x569e('0x2c')](function(_0x48e090){_0x33fd87=_0x48e090;return getUser(_0x33fd87,_0x38dd91,_0x23caff,_0x23a1d0['email']);})['then'](function(_0x58e0c6){_0x219c43=_0x58e0c6;logger['info'](_0x569e('0x86'),_0x219c43['id']);return getEndUser(_0x33fd87,_0x38dd91,_0x23caff,_0x1e9e24['destcalleridname'],_0x1e9e24['destcalleridnum'],_0x219c43,_0x2cc63a);})[_0x569e('0x2c')](function(_0x197bd2){_0x48d4c0=_0x197bd2;return getCall(_0x33fd87,_0x38dd91,_0x23caff,_0x219c43,_0x48d4c0,_0x2cc63a,_0x1e9e24,_0x569e('0x94'));})[_0x569e('0x2c')](function(_0x143210){if(_0x143210){logger[_0x569e('0x32')](_0x569e('0x89'),_0x143210['id']);logger[_0x569e('0x32')](_0x569e('0x92'),_0x569e('0x8b'));emit(util['format'](_0x569e('0x8c'),_0x23a1d0[_0x569e('0x19')]),_0x569e('0x8d'),{'uri':_0x569e('0x8e')+_0x23caff['host']+_0x569e('0x95')+_0x143210['id']});}})[_0x569e('0x2f')](function(_0x1d01cf){logger[_0x569e('0x40')](_0x569e('0x92'),JSON[_0x569e('0x42')](_0x1d01cf));});};exports[_0x569e('0x96')]=function(_0x19efb2,_0x512fc7,_0x5c5d3e,_0x3d5fd9,_0x58fc9f,_0x515711){var _0x1decec,_0x54f186,_0x58cbbc;_0x515711[_0x569e('0x7f')]=intUtil[_0x569e('0x8f')](_0x515711[_0x569e('0x7f')]);_0x515711['serverUrl']=intUtil[_0x569e('0x8f')](_0x515711[_0x569e('0x80')]);if(_0x58fc9f&&_0x58fc9f[_0x569e('0x81')]){logger['info']('['+_0x512fc7['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x512fc7[_0x569e('0x84')]=_0x515711[_0x569e('0x80')]+'/api/voice/recordings/'+_0x512fc7[_0x569e('0x83')]+_0x569e('0x97')+md5(_0x512fc7[_0x569e('0x83')]);}else{_0x512fc7[_0x569e('0x84')]='';}var _0x2928cb=_0x515711[_0x569e('0x7f')]===_0x569e('0x85')?'eu':_0x569e('0x98');return getAccessToken(_0x515711)[_0x569e('0x2c')](function(_0x2b1d6c){_0x58cbbc=_0x2b1d6c;return getUser(_0x58cbbc,_0x2928cb,_0x515711);})[_0x569e('0x2c')](function(_0x3f6ea8){_0x1decec=_0x3f6ea8;logger['info'](_0x569e('0x86'),_0x1decec['id']);return getEndUser(_0x58cbbc,_0x2928cb,_0x515711,_0x512fc7[_0x569e('0x87')],_0x512fc7[_0x569e('0x88')],_0x1decec,_0x5c5d3e);})['then'](function(_0x5c186b){_0x54f186=_0x5c186b;return getCall(_0x58cbbc,_0x2928cb,_0x515711,_0x1decec,_0x54f186,_0x5c5d3e,_0x512fc7,_0x569e('0x78'));})[_0x569e('0x2c')](function(_0x42c562){if(_0x42c562){logger[_0x569e('0x32')](_0x569e('0x89'),_0x42c562['id']);}})[_0x569e('0x2f')](function(_0x4fac91){logger[_0x569e('0x40')]('['+_0x512fc7[_0x569e('0x99')]['toUpperCase']()+']',JSON[_0x569e('0x42')](_0x4fac91));});}; \ No newline at end of file +var _0x2116=['GET','format','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','email','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subjects','Description','getString','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','startCase','Call_Duration','talktime','mm:ss','endtime','utc','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','zoho.eu','calleridnum','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x2116,0x67));var _0x6211=function(_0x5144e6,_0x561398){_0x5144e6=_0x5144e6-0x0;var _0x5c1472=_0x2116[_0x5144e6];return _0x5c1472;};'use strict';var _=require('lodash');var rp=require(_0x6211('0x0'));var md5=require('md5');var util=require(_0x6211('0x1'));var intUtil=require(_0x6211('0x2'));var moment=require(_0x6211('0x3'));var Redis=require(_0x6211('0x4'));var BPromise=require('bluebird');var config=require(_0x6211('0x5'));var logger=require(_0x6211('0x6'))(_0x6211('0x7'));config[_0x6211('0x8')]=_['defaults'](config[_0x6211('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6211('0x9'))(new Redis(config[_0x6211('0x8')]));function emit(_0x365e65,_0x31914a,_0x837b82){io['to'](_0x365e65)[_0x6211('0xa')](_0x31914a,_0x837b82);}function request(_0x10bb82){logger['debug'](_0x6211('0xb'),JSON[_0x6211('0xc')](_0x10bb82));return rp(_0x10bb82);}function getCustomFields(_0x245e56,_0x1e0634){var _0x45e2ca={};if(_0x245e56[_0x6211('0xd')]>0x0){_[_0x6211('0xe')](_0x245e56,function(_0x5da26e){if(_[_0x6211('0xf')](['string',_0x6211('0x10')],_0x5da26e[_0x6211('0x11')])&&_0x5da26e[_0x6211('0x12')]){_0x45e2ca[_0x5da26e['idField']]=_0x5da26e[_0x6211('0x13')][_0x6211('0x14')]();}else if(_0x5da26e[_0x6211('0x11')]==='variable'&&_0x5da26e['variableName']&&_0x5da26e[_0x6211('0x12')]&&_0x1e0634[_0x5da26e[_0x6211('0x15')]]){_0x45e2ca[_0x5da26e[_0x6211('0x12')]]=_0x1e0634[_0x5da26e[_0x6211('0x15')]][_0x6211('0x14')]();}else if(_0x5da26e[_0x6211('0x11')]===_0x6211('0x16')&&_0x5da26e[_0x6211('0x17')]&&_0x5da26e['Variable'][_0x6211('0x18')]&&_0x5da26e[_0x6211('0x12')]&&_0x1e0634[_0x5da26e[_0x6211('0x17')][_0x6211('0x18')][_0x6211('0x19')]()]){_0x45e2ca[_0x5da26e[_0x6211('0x12')]]=_0x1e0634[_0x5da26e[_0x6211('0x17')]['name'][_0x6211('0x19')]()][_0x6211('0x14')]();}});}return _0x45e2ca;}function getName(_0x5af096){if(_0x5af096[_0x6211('0x1a')]('\x20')>0x0){var _0x43532c=_0x5af096[_0x6211('0x1b')](/ (.+)/);if(_0x43532c[0x1]){return _0x43532c;}}return[_0x5af096,_0x5af096];}var accountsTokens={};function getAccessToken(_0x30d6a5){return new Promise(function(_0x4d99bc,_0x51a389){if(!_[_0x6211('0x1c')](accountsTokens[_0x30d6a5['id']])&&!_[_0x6211('0x1c')](accountsTokens[_0x30d6a5['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x30d6a5['id']][_0x6211('0x1d')])){_0x4d99bc(accountsTokens[_0x30d6a5['id']][_0x6211('0x1e')]);}}var _0x3a39fb;switch(_0x30d6a5[_0x6211('0x1f')]){case'US':_0x3a39fb='https://accounts.zoho.com';break;case'AU':_0x3a39fb=_0x6211('0x20');break;case'EU':_0x3a39fb=_0x6211('0x21');break;case'IN':_0x3a39fb=_0x6211('0x22');break;case'CN':_0x3a39fb='https://accounts.zoho.com.cn';break;default:_0x3a39fb=_0x6211('0x21');break;}var _0x279069={'method':_0x6211('0x23'),'uri':_0x3a39fb+'/oauth/v2/token','qs':{'refresh_token':_0x30d6a5['refreshToken'],'client_id':_0x30d6a5['clientId'],'client_secret':_0x30d6a5['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x279069)[_0x6211('0x24')](function(_0x2badd2){accountsTokens[_0x30d6a5['id']]={'access_token':_0x2badd2[_0x6211('0x1e')],'expires_in':moment()[_0x6211('0x25')](_0x2badd2[_0x6211('0x1d')],_0x6211('0x26'))};_0x4d99bc(_0x2badd2[_0x6211('0x1e')]);})[_0x6211('0x27')](function(_0x148740){logger[_0x6211('0x28')](_0x6211('0x29'),_0x148740[_0x6211('0x2a')]);_0x51a389(_0x148740);});});}function getUser(_0x3564f2,_0x26a8cc,_0x20e576,_0x424ce3){logger[_0x6211('0x2b')]('Search\x20user');return request({'method':_0x6211('0x2c'),'uri':util[_0x6211('0x2d')](_0x6211('0x2e'),_0x26a8cc),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3564f2},'json':!![]})[_0x6211('0x24')](function(_0x5e3817){if(_0x5e3817[_0x6211('0x2f')]){var _0x253bb3=-0x1;if(_[_0x6211('0x30')](_0x5e3817['users'])){if(!_[_0x6211('0x1c')](_0x424ce3)){_0x253bb3=_[_0x6211('0x31')](_0x5e3817[_0x6211('0x2f')],function(_0x3be255){return _0x3be255[_0x6211('0x32')]===_0x424ce3;});}if(_0x253bb3>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x6211('0x2b')]('Using\x20the\x20admin\x20account!');_0x253bb3=_['findIndex'](_0x5e3817['users'],function(_0x39d314){return _0x39d314[_0x6211('0x33')][_0x6211('0x18')]==='Administrator';});}return _0x5e3817[_0x6211('0x2f')][_0x253bb3];}else{if(_0x5e3817['user'][_0x6211('0x33')][_0x6211('0x18')]===_0x6211('0x34')){logger['info'](_0x6211('0x35'));user=_0x5e3817[_0x6211('0x36')];return user;}else{logger[_0x6211('0x28')](_0x6211('0x37'),JSON[_0x6211('0xc')](_0x5e3817));throw new Error(_0x6211('0x38')+JSON[_0x6211('0xc')](_0x5e3817));}}}else{logger[_0x6211('0x28')]('The\x20failing\x20result\x20is',JSON[_0x6211('0xc')](_0x5e3817));throw new Error(_0x6211('0x38')+JSON[_0x6211('0xc')](_0x5e3817));}})[_0x6211('0x27')](function(_0xcd4c36){console['error'](_0xcd4c36);});}function getZohoUser(_0x1d42e2,_0x28aee5){return new BPromise(function(_0x2afdf7,_0x8bc27d){request(_0x1d42e2)['then'](function(_0x457ff9){var _0x40fdeb=null;if(_0x457ff9){_0x40fdeb=_0x457ff9[_0x6211('0x39')][0x0];_0x40fdeb[_0x6211('0x3a')]=_0x28aee5;}_0x2afdf7(_0x40fdeb);})[_0x6211('0x27')](function(_0x17d517){_0x8bc27d(_0x17d517);});});}function createEndUser(_0x29a044,_0x4fb7e8,_0x5e324e,_0x4ed0c5,_0x5013f0,_0xe40847){var _0x5e324e=getName(_0x5e324e);return request({'method':_0x6211('0x23'),'uri':_0x6211('0x3b')+_0x4fb7e8+'/crm/v2/'+_['startCase'](_0xe40847['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5e324e[0x1],'First_Name':_0x5e324e[0x0],'Phone':_0x4ed0c5,'Owner':{'name':!_[_0x6211('0x1c')](_0x5013f0[_0x6211('0x3c')][_0x6211('0x18')])?_0x5013f0['role'][_0x6211('0x18')]:!_[_0x6211('0x1c')](_0x5013f0[_0x6211('0x3d')])?_0x5013f0[_0x6211('0x3d')]+'\x20'+_0x5013f0[_0x6211('0x3e')]:_0x5013f0[_0x6211('0x3e')],'id':_0x5013f0['id']}}]},'headers':{'Authorization':_0x6211('0x3f')+_0x29a044},'json':!![]})[_0x6211('0x24')](function(_0x4e2c14){if(_0x4e2c14&&_0x4e2c14['data'][0x0][_0x6211('0x40')]===_0x6211('0x41')){var _0x2400f1=_0x4e2c14[_0x6211('0x39')][0x0][_0x6211('0x42')];_0x2400f1[_0x6211('0x3a')]=_['startCase'](_0xe40847[_0x6211('0x43')])+'s';return _0x2400f1;}logger[_0x6211('0x28')](_0x6211('0x37'),JSON[_0x6211('0xc')](data));throw new Error(_0x6211('0x44')+JSON['stringify'](data));})[_0x6211('0x27')](function(_0x54a667){console[_0x6211('0x45')]('CREATE\x20ERROR',_0x54a667);});}function getEndUser(_0x424893,_0x34d41d,_0x5770b0,_0x225f5f,_0x150f41,_0x311532,_0x4ab8e3){var _0x26bc90={'method':'GET','uri':'','headers':{'Authorization':_0x6211('0x3f')+_0x424893},'json':!![]};switch(_0x4ab8e3['moduleSearch']){case _0x6211('0x46'):_0x26bc90['uri']=_0x6211('0x3b')+_0x34d41d+_0x6211('0x47')+_0x150f41+'))';return getZohoUser(_0x26bc90,_0x6211('0x48'))[_0x6211('0x24')](function(_0x27eae4){if(_0x27eae4)return _0x27eae4;_0x26bc90[_0x6211('0x49')]=_0x6211('0x3b')+_0x34d41d+_0x6211('0x4a')+_0x150f41+'))';return getZohoUser(_0x26bc90,_0x6211('0x4b'))[_0x6211('0x24')](function(_0x501c6d){if(_0x501c6d)return _0x501c6d;if(_0x4ab8e3[_0x6211('0x43')]!=_0x6211('0x4c')){return createEndUser(_0x424893,_0x34d41d,_0x225f5f,_0x150f41,_0x311532,_0x4ab8e3);}else{return{};}});});break;case _0x6211('0x4d'):_0x26bc90[_0x6211('0x49')]='https://www.zohoapis.'+_0x34d41d+_0x6211('0x47')+_0x150f41+'))';return getZohoUser(_0x26bc90,_0x6211('0x48'))['then'](function(_0x3537f2){if(_0x3537f2)return _0x3537f2;if(_0x4ab8e3['moduleCreate']!='nothing'){return createEndUser(_0x424893,_0x34d41d,_0x225f5f,_0x150f41,_0x311532,_0x4ab8e3);}else{return{};}});break;case _0x6211('0x4e'):_0x26bc90[_0x6211('0x49')]='https://www.zohoapis.'+_0x34d41d+_0x6211('0x4a')+_0x150f41+'))';return getZohoUser(_0x26bc90,_0x6211('0x4b'))[_0x6211('0x24')](function(_0x42bf11){if(_0x42bf11)return _0x42bf11;if(_0x4ab8e3[_0x6211('0x43')]!='nothing'){return createEndUser(_0x424893,_0x34d41d,_0x225f5f,_0x150f41,_0x311532,_0x4ab8e3);}else{return{};}});break;}}function getCall(_0x92aa60,_0x8a364a,_0x1901d7,_0x4d0acd,_0x1b264a,_0x588ab7,_0x21e5e2,_0x4a15b0){logger['info'](_0x6211('0x4f'));var _0x3917d5={};_0x3917d5['Owner']={'name':!_[_0x6211('0x1c')](_0x4d0acd[_0x6211('0x3c')][_0x6211('0x18')])&&!_[_0x6211('0x1c')](_0x4d0acd['profile'][_0x6211('0x18')])&&_0x4d0acd[_0x6211('0x33')][_0x6211('0x18')]===_0x6211('0x50')?_0x4d0acd[_0x6211('0x3c')][_0x6211('0x18')]:!_[_0x6211('0x1c')](_0x4d0acd[_0x6211('0x3d')])?_0x4d0acd['first_name']+'\x20'+_0x4d0acd[_0x6211('0x3e')]:_0x4d0acd[_0x6211('0x3e')],'id':_0x4d0acd['id']};_0x3917d5['Subject']=intUtil['getString'](_0x588ab7[_0x6211('0x51')],_0x21e5e2,'\x20');_0x3917d5[_0x6211('0x52')]=intUtil[_0x6211('0x53')](_0x588ab7['Descriptions'],_0x21e5e2,'\x0a');if(_0x1b264a[_0x6211('0x3a')]==='Contacts'){_0x3917d5[_0x6211('0x54')]={'name':!_[_0x6211('0x1c')](_0x1b264a['Full_Name'])?_0x1b264a['Full_Name']:!_[_0x6211('0x1c')](_0x1b264a[_0x6211('0x55')])?_0x1b264a[_0x6211('0x55')]+'\x20'+_0x1b264a[_0x6211('0x56')]:_0x1b264a[_0x6211('0x56')],'id':_0x1b264a['id']};}if(_0x1b264a['enduserType']===_0x6211('0x4b')){_0x3917d5[_0x6211('0x57')]={'name':!_['isNil'](_0x1b264a[_0x6211('0x58')])?_0x1b264a[_0x6211('0x58')]:!_[_0x6211('0x1c')](_0x1b264a[_0x6211('0x55')])?_0x1b264a[_0x6211('0x55')]+'\x20'+_0x1b264a['Last_Name']:_0x1b264a[_0x6211('0x56')],'id':_0x1b264a['id']};_0x3917d5[_0x6211('0x59')]=_[_0x6211('0x5a')](_0x1b264a[_0x6211('0x3a')]);}if(_0x21e5e2['talktime']){_0x3917d5[_0x6211('0x5b')]=moment['utc'](parseInt(_0x21e5e2[_0x6211('0x5c')])*0x3e8)[_0x6211('0x2d')](_0x6211('0x5d'));}else if(_0x21e5e2['answertime']&&_0x21e5e2[_0x6211('0x5e')]){_0x3917d5['Call_Duration']=moment[_0x6211('0x5f')](moment(_0x21e5e2[_0x6211('0x5e')],'YYYY-MM-DDTHH:mm:ss')[_0x6211('0x60')](moment(_0x21e5e2['starttime'],_0x6211('0x61'))))[_0x6211('0x2d')](_0x6211('0x5d'));}switch(_0x21e5e2[_0x6211('0x62')]){case'called':_0x3917d5[_0x6211('0x63')]=_0x6211('0x64');break;case _0x6211('0x65'):case _0x6211('0x66'):_0x3917d5['Call_Result']=_0x6211('0x67');break;case _0x6211('0x68'):_0x3917d5['Call_Result']=_0x6211('0x69');break;case _0x6211('0x6a'):_0x3917d5[_0x6211('0x63')]=_0x6211('0x6b');break;case _0x6211('0x6c'):_0x3917d5[_0x6211('0x63')]=_0x6211('0x6d');default:}_0x3917d5[_0x6211('0x6e')]=(_0x4a15b0==='outbound'?moment(_0x21e5e2[_0x6211('0x6f')])[_0x6211('0x2d')](_0x6211('0x61')):moment(_0x21e5e2[_0x6211('0x70')])[_0x6211('0x2d')](_0x6211('0x61')))||moment()[_0x6211('0x2d')](_0x6211('0x61'));_0x3917d5[_0x6211('0x71')]=_0x4a15b0||_0x6211('0x72');_0x3917d5=_['merge'](_0x3917d5,getCustomFields(_0x588ab7['Fields'],_0x21e5e2));return request({'method':'POST','uri':_0x6211('0x3b')+_0x8a364a+'/crm/v2/Calls','headers':{'Authorization':_0x6211('0x3f')+_0x92aa60},'body':{'data':[_0x3917d5]},'json':!![]})['then'](function(_0x1ef11e){if(_0x1ef11e&&_0x1ef11e[_0x6211('0x39')][0x0][_0x6211('0x40')]==='SUCCESS'){logger[_0x6211('0x2b')](_0x6211('0x73'));return{'id':_0x1ef11e[_0x6211('0x39')][0x0][_0x6211('0x42')]['id']};}})[_0x6211('0x27')](function(_0x2fc630){logger['info'](_0x6211('0x74'),_0x2fc630['stack']);console[_0x6211('0x45')]('err',_0x2fc630);});}exports[_0x6211('0x75')]=function(_0x370016,_0x3aa00a,_0x58e51d,_0x31c2c0,_0x2148f6,_0x337732){var _0x127c9e,_0x2604e5,_0x15dc53;_0x337732[_0x6211('0x76')]=intUtil[_0x6211('0x77')](_0x337732['host']);_0x337732[_0x6211('0x78')]=intUtil[_0x6211('0x77')](_0x337732['serverUrl']);if(_0x2148f6&&_0x2148f6[_0x6211('0x79')]){logger[_0x6211('0x2b')](_0x6211('0x7a'),_0x6211('0x7b'));_0x3aa00a[_0x6211('0x7c')]=_0x337732[_0x6211('0x78')]+_0x6211('0x7d')+_0x3aa00a[_0x6211('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x3aa00a[_0x6211('0x7e')]);}else{_0x3aa00a[_0x6211('0x7c')]='';}var _0x1e8695=_0x337732['host']==='zoho.eu'?'eu':_0x6211('0x7f');return getAccessToken(_0x337732)[_0x6211('0x24')](function(_0x159a3a){_0x15dc53=_0x159a3a;return getUser(_0x15dc53,_0x1e8695,_0x337732,_0x31c2c0['email']);})[_0x6211('0x24')](function(_0x27f0cd){_0x127c9e=_0x27f0cd;logger[_0x6211('0x2b')](_0x6211('0x80'),_0x127c9e['id']);return getEndUser(_0x15dc53,_0x1e8695,_0x337732,_0x3aa00a[_0x6211('0x81')],_0x3aa00a['calleridnum'],_0x127c9e,_0x58e51d);})[_0x6211('0x24')](function(_0x13c006){_0x2604e5=_0x13c006;return getCall(_0x15dc53,_0x1e8695,_0x337732,_0x127c9e,_0x2604e5,_0x58e51d,_0x3aa00a,'Inbound');})[_0x6211('0x24')](function(_0x526645){if(_0x526645){logger[_0x6211('0x2b')]('The\x20Call\x20ID\x20is:',_0x526645['id']);logger[_0x6211('0x2b')](_0x6211('0x7a'),_0x6211('0x82'));emit(util[_0x6211('0x2d')](_0x6211('0x83'),_0x31c2c0['name']),_0x6211('0x84'),{'uri':_0x6211('0x85')+_0x337732['host']+_0x6211('0x86')+_0x526645['id']});}})[_0x6211('0x27')](function(_0x141305){logger[_0x6211('0x28')](_0x6211('0x7a'),JSON[_0x6211('0xc')](_0x141305));});};exports[_0x6211('0x87')]=function(_0x4fec8e,_0x1b4e0b,_0x2612aa,_0x41311a,_0x11211c,_0x5ee285,_0x86ae7c){var _0x3edc74,_0x4e82d2,_0x375393;_0x5ee285[_0x6211('0x76')]=intUtil['stripTrailingSlash'](_0x5ee285['host']);_0x5ee285[_0x6211('0x78')]=intUtil['stripTrailingSlash'](_0x5ee285[_0x6211('0x78')]);if(_0x86ae7c&&_0x86ae7c[_0x6211('0x88')]&&_0x86ae7c[_0x6211('0x88')]!==_0x6211('0x89')){logger['info'](_0x6211('0x8a'),_0x6211('0x7b'));_0x1b4e0b['recordingURL']=_0x5ee285['serverUrl']+_0x6211('0x7d')+_0x1b4e0b[_0x6211('0x7e')]+_0x6211('0x8b')+md5(_0x1b4e0b['uniqueid']);}var _0x5ecbbd=_0x5ee285[_0x6211('0x76')]==='zoho.eu'?'eu':_0x6211('0x7f');return getAccessToken(_0x5ee285)[_0x6211('0x24')](function(_0x428cdc){_0x375393=_0x428cdc;return getUser(_0x375393,_0x5ecbbd,_0x5ee285,_0x41311a[_0x6211('0x32')]);})[_0x6211('0x24')](function(_0x3387dc){_0x3edc74=_0x3387dc;logger[_0x6211('0x2b')]('The\x20User\x20ID\x20is:',_0x3edc74['id']);return getEndUser(_0x375393,_0x5ecbbd,_0x5ee285,_0x1b4e0b[_0x6211('0x8c')],_0x1b4e0b['destcalleridnum'],_0x3edc74,_0x2612aa);})[_0x6211('0x24')](function(_0x296d46){_0x4e82d2=_0x296d46;return getCall(_0x375393,_0x5ecbbd,_0x5ee285,_0x3edc74,_0x4e82d2,_0x2612aa,_0x1b4e0b,_0x6211('0x8d'));})[_0x6211('0x24')](function(_0x3f686e){if(_0x3f686e){logger[_0x6211('0x2b')](_0x6211('0x8e'),_0x3f686e['id']);logger[_0x6211('0x2b')](_0x6211('0x8a'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6211('0x2d')](_0x6211('0x83'),_0x41311a[_0x6211('0x18')]),_0x6211('0x84'),{'uri':_0x6211('0x85')+_0x5ee285['host']+_0x6211('0x86')+_0x3f686e['id']});}})[_0x6211('0x27')](function(_0x1d6436){logger[_0x6211('0x28')](_0x6211('0x8a'),JSON['stringify'](_0x1d6436));});};exports[_0x6211('0x8f')]=function(_0x2ded0d,_0x117bd0,_0x12f8a6,_0x6d9c17,_0x2f02f8,_0x532991){var _0x50890f,_0x1621ab,_0x19a26d;_0x532991[_0x6211('0x76')]=intUtil[_0x6211('0x77')](_0x532991[_0x6211('0x76')]);_0x532991[_0x6211('0x78')]=intUtil[_0x6211('0x77')](_0x532991['serverUrl']);if(_0x2f02f8&&_0x2f02f8['monitor_format']){logger[_0x6211('0x2b')]('['+_0x117bd0['lastevent'][_0x6211('0x90')]()+']',_0x6211('0x7b'));_0x117bd0['recordingURL']=_0x532991['serverUrl']+'/api/voice/recordings/'+_0x117bd0[_0x6211('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x117bd0['uniqueid']);}else{_0x117bd0[_0x6211('0x7c')]='';}var _0x4672d7=_0x532991[_0x6211('0x76')]===_0x6211('0x91')?'eu':'com';return getAccessToken(_0x532991)[_0x6211('0x24')](function(_0x3b3665){_0x19a26d=_0x3b3665;return getUser(_0x19a26d,_0x4672d7,_0x532991);})[_0x6211('0x24')](function(_0xbbf13f){_0x50890f=_0xbbf13f;logger[_0x6211('0x2b')](_0x6211('0x80'),_0x50890f['id']);return getEndUser(_0x19a26d,_0x4672d7,_0x532991,_0x117bd0[_0x6211('0x81')],_0x117bd0[_0x6211('0x92')],_0x50890f,_0x12f8a6);})[_0x6211('0x24')](function(_0x52615b){_0x1621ab=_0x52615b;return getCall(_0x19a26d,_0x4672d7,_0x532991,_0x50890f,_0x1621ab,_0x12f8a6,_0x117bd0,_0x6211('0x72'));})[_0x6211('0x24')](function(_0x227d5f){if(_0x227d5f){logger['info']('The\x20Call\x20ID\x20is:',_0x227d5f['id']);}})[_0x6211('0x27')](function(_0x1bab5d){logger[_0x6211('0x28')]('['+_0x117bd0[_0x6211('0x62')][_0x6211('0x90')]()+']',JSON['stringify'](_0x1bab5d));});}; \ 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 bbb7b42..20ff1ec 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 _0xc4b8=['Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data2'];(function(_0xc08f00,_0x28067f){var _0x8649f7=function(_0x25f9a2){while(--_0x25f9a2){_0xc08f00['push'](_0xc08f00['shift']());}};_0x8649f7(++_0x28067f);}(_0xc4b8,0x94));var _0x8c4b=function(_0x595902,_0x46dac9){_0x595902=_0x595902-0x0;var _0x24ed4f=_0xc4b8[_0x595902];return _0x24ed4f;};'use strict';var util=require(_0x8c4b('0x0'));var sh=require(_0x8c4b('0x1'));var Mustache=require(_0x8c4b('0x2'));var logger=require(_0x8c4b('0x3'))(_0x8c4b('0x4'));exports['exec']=function(_0x4ebf4a,_0x4db572){var _0x4b5a35=_0x4ebf4a[_0x8c4b('0x5')]?_0x4ebf4a[_0x8c4b('0x5')]:_0x8c4b('0x6');var _0x4ab7f8=_0x4ebf4a[_0x8c4b('0x7')]?Mustache[_0x8c4b('0x8')](_0x4ebf4a[_0x8c4b('0x7')],_0x4db572):_0x4db572;sh['exec'](_0x4ab7f8,function(_0x5ab737,_0x84aaa,_0x3688f7){if(_0x5ab737!==0x0){logger[_0x8c4b('0x9')](util['format'](_0x8c4b('0xa'),_0x4b5a35,_0x4ab7f8,_0x5ab737,_0x3688f7));}else{logger[_0x8c4b('0xb')](util[_0x8c4b('0xc')](_0x8c4b('0xd'),_0x4b5a35,_0x4ab7f8,_0x84aaa));}});}; \ No newline at end of file +var _0xba23=['data2','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','exec'];(function(_0x42cd07,_0x2b1753){var _0x5cf99f=function(_0xbb9edf){while(--_0xbb9edf){_0x42cd07['push'](_0x42cd07['shift']());}};_0x5cf99f(++_0x2b1753);}(_0xba23,0x193));var _0x3ba2=function(_0x552a09,_0xf40614){_0x552a09=_0x552a09-0x0;var _0x3680f2=_0xba23[_0x552a09];return _0x3680f2;};'use strict';var util=require('util');var sh=require(_0x3ba2('0x0'));var Mustache=require(_0x3ba2('0x1'));var logger=require(_0x3ba2('0x2'))('trigger');exports[_0x3ba2('0x3')]=function(_0x122d6f,_0x4aa09e){var _0x5ac1f3=_0x122d6f[_0x3ba2('0x4')]?_0x122d6f['data2']:'Script';var _0x8d6982=_0x122d6f[_0x3ba2('0x5')]?Mustache[_0x3ba2('0x6')](_0x122d6f['data3'],_0x4aa09e):_0x4aa09e;sh[_0x3ba2('0x3')](_0x8d6982,function(_0x1636b4,_0x425562,_0x2fb4fd){if(_0x1636b4!==0x0){logger['error'](util[_0x3ba2('0x7')](_0x3ba2('0x8'),_0x5ac1f3,_0x8d6982,_0x1636b4,_0x2fb4fd));}else{logger[_0x3ba2('0x9')](util[_0x3ba2('0x7')](_0x3ba2('0xa'),_0x5ac1f3,_0x8d6982,_0x425562));}});}; \ 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 29b7b1f..dc03a02 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 _0xa5fb=['util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','data2','data5','number','headers','data6','parse','render','error','data1','GET','DELETE','POST','PUT','data7','body','stack','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0xa5fb,0x197));var _0xba5f=function(_0x1048c7,_0x1963e9){_0x1048c7=_0x1048c7-0x0;var _0x584b47=_0xa5fb[_0x1048c7];return _0x584b47;};'use strict';var rp=require(_0xba5f('0x0'));var util=require(_0xba5f('0x1'));var _=require(_0xba5f('0x2'));var Mustache=require(_0xba5f('0x3'));var logger=require(_0xba5f('0x4'))(_0xba5f('0x5'));exports[_0xba5f('0x6')]=function(_0x3dabfe,_0x2dfbd2){var _0x226bdf,_0x11e4e0;var _0x45c7d3={'method':_0x3dabfe['data1'][_0xba5f('0x7')](),'uri':Mustache['render'](_0x3dabfe[_0xba5f('0x8')],_0x2dfbd2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dabfe[_0xba5f('0x9')])===_0xba5f('0xa')&&parseInt(_0x3dabfe[_0xba5f('0x9')])>=0x1&&parseInt(_0x3dabfe[_0xba5f('0x9')])<=0xa?parseInt(_0x3dabfe[_0xba5f('0x9')])*0x3e8:0x5*0x3e8};try{_0x45c7d3[_0xba5f('0xb')]=_0x3dabfe[_0xba5f('0xc')]?JSON[_0xba5f('0xd')](Mustache[_0xba5f('0xe')](_0x3dabfe[_0xba5f('0xc')],_0x2dfbd2)):{};}catch(_0x3f3d8a){logger[_0xba5f('0xf')](_0x3f3d8a['stack']);}switch(_0x3dabfe[_0xba5f('0x10')]['toUpperCase']()){case _0xba5f('0x11'):case _0xba5f('0x12'):_0x226bdf=null;_0x45c7d3['qs']=_0x2dfbd2;break;case _0xba5f('0x13'):case _0xba5f('0x14'):if(_0x3dabfe[_0xba5f('0x15')]){try{_0x226bdf=JSON[_0xba5f('0xd')](Mustache[_0xba5f('0xe')](_0x3dabfe[_0xba5f('0x15')],_0x2dfbd2));_0x45c7d3[_0xba5f('0x16')]=_0x226bdf;}catch(_0x8b03b0){logger['error'](_0x8b03b0[_0xba5f('0x17')]);logger[_0xba5f('0xf')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x226bdf=_0x2dfbd2;_0x45c7d3[_0xba5f('0x16')]=_0x226bdf;}break;}logger[_0xba5f('0x18')](util['format'](_0xba5f('0x19'),_0x3dabfe[_0xba5f('0x10')],_0x3dabfe['data2'],JSON[_0xba5f('0x1a')](_0x45c7d3)));rp(_0x45c7d3)[_0xba5f('0x1b')](function(_0x3bb1e9){_0x226bdf=!_['isNil'](_0x226bdf)?_0xba5f('0x1c')+_0x226bdf:'';_0x11e4e0=typeof _0x3bb1e9[_0xba5f('0x16')]===_0xba5f('0x1d')?JSON[_0xba5f('0x1a')](_0x3bb1e9[_0xba5f('0x16')]):_0x3bb1e9[_0xba5f('0x16')];logger[_0xba5f('0x18')](util['format'](_0xba5f('0x1e'),_0x3dabfe[_0xba5f('0x10')],_0x3dabfe[_0xba5f('0x8')],_0x3bb1e9[_0xba5f('0x1f')],_0x11e4e0));})[_0xba5f('0x20')](function(_0x3ca7bb){logger[_0xba5f('0xf')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3dabfe['data1'],_0x3dabfe[_0xba5f('0x8')],_0x3ca7bb[_0xba5f('0x1f')],_0x3ca7bb[_0xba5f('0x21')],_0x3ca7bb['message']));});}; \ No newline at end of file +var _0xae58=['PUT','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','request-promise','lodash','../../../../config/logger','exec','data1','render','data2','data5','number','headers','parse','data6','toUpperCase','GET','DELETE','POST'];(function(_0x558849,_0x113740){var _0x4149cd=function(_0x4779e6){while(--_0x4779e6){_0x558849['push'](_0x558849['shift']());}};_0x4149cd(++_0x113740);}(_0xae58,0x1b0));var _0x8ae5=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xae58[_0x44b7d6];return _0x5346f0;};'use strict';var rp=require(_0x8ae5('0x0'));var util=require('util');var _=require(_0x8ae5('0x1'));var Mustache=require('mustache');var logger=require(_0x8ae5('0x2'))('trigger');exports[_0x8ae5('0x3')]=function(_0x3b1f8d,_0x2cc1e1){var _0x5dfd44,_0x500aa1;var _0x5ee2c2={'method':_0x3b1f8d[_0x8ae5('0x4')]['toUpperCase'](),'uri':Mustache[_0x8ae5('0x5')](_0x3b1f8d[_0x8ae5('0x6')],_0x2cc1e1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3b1f8d[_0x8ae5('0x7')])===_0x8ae5('0x8')&&parseInt(_0x3b1f8d[_0x8ae5('0x7')])>=0x1&&parseInt(_0x3b1f8d[_0x8ae5('0x7')])<=0xa?parseInt(_0x3b1f8d['data5'])*0x3e8:0x5*0x3e8};try{_0x5ee2c2[_0x8ae5('0x9')]=_0x3b1f8d['data6']?JSON[_0x8ae5('0xa')](Mustache[_0x8ae5('0x5')](_0x3b1f8d[_0x8ae5('0xb')],_0x2cc1e1)):{};}catch(_0x445468){logger['error'](_0x445468['stack']);}switch(_0x3b1f8d[_0x8ae5('0x4')][_0x8ae5('0xc')]()){case _0x8ae5('0xd'):case _0x8ae5('0xe'):_0x5dfd44=null;_0x5ee2c2['qs']=_0x2cc1e1;break;case _0x8ae5('0xf'):case _0x8ae5('0x10'):if(_0x3b1f8d['data7']){try{_0x5dfd44=JSON[_0x8ae5('0xa')](Mustache[_0x8ae5('0x5')](_0x3b1f8d[_0x8ae5('0x11')],_0x2cc1e1));_0x5ee2c2[_0x8ae5('0x12')]=_0x5dfd44;}catch(_0xf6b387){logger[_0x8ae5('0x13')](_0xf6b387[_0x8ae5('0x14')]);logger[_0x8ae5('0x13')](_0x8ae5('0x15'));}}else{_0x5dfd44=_0x2cc1e1;_0x5ee2c2[_0x8ae5('0x12')]=_0x5dfd44;}break;}logger[_0x8ae5('0x16')](util[_0x8ae5('0x17')](_0x8ae5('0x18'),_0x3b1f8d[_0x8ae5('0x4')],_0x3b1f8d['data2'],JSON[_0x8ae5('0x19')](_0x5ee2c2)));rp(_0x5ee2c2)[_0x8ae5('0x1a')](function(_0x3ffb1e){_0x5dfd44=!_['isNil'](_0x5dfd44)?_0x8ae5('0x1b')+_0x5dfd44:'';_0x500aa1=typeof _0x3ffb1e[_0x8ae5('0x12')]===_0x8ae5('0x1c')?JSON[_0x8ae5('0x19')](_0x3ffb1e[_0x8ae5('0x12')]):_0x3ffb1e[_0x8ae5('0x12')];logger[_0x8ae5('0x16')](util[_0x8ae5('0x17')](_0x8ae5('0x1d'),_0x3b1f8d[_0x8ae5('0x4')],_0x3b1f8d[_0x8ae5('0x6')],_0x3ffb1e[_0x8ae5('0x1e')],_0x500aa1));})[_0x8ae5('0x1f')](function(_0x5dc448){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3b1f8d[_0x8ae5('0x4')],_0x3b1f8d[_0x8ae5('0x6')],_0x5dc448[_0x8ae5('0x1e')],_0x5dc448['name'],_0x5dc448['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9db9ae2..86efd38 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 _0x0b72=['message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','debug','rpc','error'];(function(_0x39b02d,_0x16bf39){var _0xcd84d1=function(_0x33ea1c){while(--_0x33ea1c){_0x39b02d['push'](_0x39b02d['shift']());}};_0xcd84d1(++_0x16bf39);}(_0x0b72,0x1d7));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x20b7('0x0'));var BPromise=require(_0x20b7('0x1'));var logger=require(_0x20b7('0x2'))(_0x20b7('0x3'));var client=jayson[_0x20b7('0x4')][_0x20b7('0x5')]({'port':0x2329});client[_0x20b7('0x6')]=function(_0x4caf9d,_0x555d7c){return new BPromise(function(_0x2faa08,_0x26f1e7){return client['request'](_0x4caf9d,_0x555d7c)['then'](function(_0x4c35f6){logger[_0x20b7('0x7')](_0x20b7('0x8'),_0x20b7('0x3'),_0x4caf9d,_0x555d7c,_0x4c35f6);if(_0x4c35f6[_0x20b7('0x9')]){logger[_0x20b7('0x9')](_0x20b7('0x8'),'routing',_0x4caf9d,_0x4c35f6[_0x20b7('0x9')]['message'],_0x555d7c);return _0x26f1e7(_0x4c35f6[_0x20b7('0x9')][_0x20b7('0xa')]);}else{return _0x2faa08(_0x4c35f6[_0x20b7('0xb')]);}})[_0x20b7('0xc')](function(_0x380beb){logger[_0x20b7('0x9')](_0x20b7('0x8'),_0x20b7('0x3'),_0x4caf9d,_0x380beb,_0x555d7c);return _0x26f1e7(_0x380beb);});});};module['exports']=client; \ No newline at end of file +var _0x4863=['error','routing','message','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','rpc'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x4863,0x171));var _0x3486=function(_0x5af94c,_0x441490){_0x5af94c=_0x5af94c-0x0;var _0x11ab77=_0x4863[_0x5af94c];return _0x11ab77;};'use strict';var jayson=require(_0x3486('0x0'));var BPromise=require(_0x3486('0x1'));var logger=require(_0x3486('0x2'))('routing');var client=jayson[_0x3486('0x3')][_0x3486('0x4')]({'port':0x2329});client[_0x3486('0x5')]=function(_0x184207,_0x5e6fa3){return new BPromise(function(_0x1363fa,_0x3bad49){return client[_0x3486('0x6')](_0x184207,_0x5e6fa3)[_0x3486('0x7')](function(_0x3ea1a3){logger['debug'](_0x3486('0x8'),'routing',_0x184207,_0x5e6fa3,_0x3ea1a3);if(_0x3ea1a3[_0x3486('0x9')]){logger[_0x3486('0x9')](_0x3486('0x8'),_0x3486('0xa'),_0x184207,_0x3ea1a3[_0x3486('0x9')][_0x3486('0xb')],_0x5e6fa3);return _0x3bad49(_0x3ea1a3[_0x3486('0x9')][_0x3486('0xb')]);}else{return _0x1363fa(_0x3ea1a3['result']);}})[_0x3486('0xc')](function(_0x119b52){logger[_0x3486('0x9')](_0x3486('0x8'),_0x3486('0xa'),_0x184207,_0x119b52,_0x5e6fa3);return _0x3bad49(_0x119b52);});});};module[_0x3486('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 630c4e0..0674f1e 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 _0x3e00=['./rpc/mailAccount','./rpc/setting','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x47445f,_0x16412a){var _0x2f4e6a=function(_0x5b7ee9){while(--_0x5b7ee9){_0x47445f['push'](_0x47445f['shift']());}};_0x2f4e6a(++_0x16412a);}(_0x3e00,0x13d));var _0x03e0=function(_0x58742e,_0x117309){_0x58742e=_0x58742e-0x0;var _0x568619=_0x3e00[_0x58742e];return _0x568619;};'use strict';var server=require(_0x03e0('0x0'));var Realtime=require(_0x03e0('0x1'));var EmailChannel=require(_0x03e0('0x2'));var mailAccount=require(_0x03e0('0x3'));var setting=require(_0x03e0('0x4'));var logger=require('../../config/logger')(_0x03e0('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x03e0('0x6')](mailAccount[_0x03e0('0x7')]())[_0x03e0('0x6')](realtime[_0x03e0('0x8')]())[_0x03e0('0x6')](function(){email[_0x03e0('0x9')](realtime[_0x03e0('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x03e0('0x6')](function(){return initRealtime();})[_0x03e0('0x6')](function(){return setting[_0x03e0('0xb')]();})[_0x03e0('0x6')](function(_0x17a2a8){return setInterval(initRealtime,_0x17a2a8[_0x03e0('0xc')]*0x3e8);})[_0x03e0('0xd')](function(_0x517d07){logger[_0x03e0('0xe')](_0x03e0('0xf'),_0x517d07);});}main(); \ No newline at end of file +var _0xa548=['listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','refresh','mailAccounts'];(function(_0x2d824e,_0x184405){var _0x28c426=function(_0x34a99e){while(--_0x34a99e){_0x2d824e['push'](_0x2d824e['shift']());}};_0x28c426(++_0x184405);}(_0xa548,0x163));var _0x8a54=function(_0x3b8228,_0x13579c){_0x3b8228=_0x3b8228-0x0;var _0x167e55=_0xa548[_0x3b8228];return _0x167e55;};'use strict';var server=require('./server');var Realtime=require(_0x8a54('0x0'));var EmailChannel=require(_0x8a54('0x1'));var mailAccount=require(_0x8a54('0x2'));var setting=require(_0x8a54('0x3'));var logger=require(_0x8a54('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8a54('0x5')]()[_0x8a54('0x6')](mailAccount['getMailAccounts']())[_0x8a54('0x6')](realtime['initMailAccounts']())[_0x8a54('0x6')](function(){email[_0x8a54('0x7')](realtime[_0x8a54('0x8')]);return realtime;});}function main(){return server[_0x8a54('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x8a54('0x6')](function(){return setting[_0x8a54('0xa')]();})[_0x8a54('0x6')](function(_0x1d30cf){return setInterval(initRealtime,_0x1d30cf[_0x8a54('0xb')]*0x3e8);})[_0x8a54('0xc')](function(_0x40179d){logger['error'](_0x8a54('0xd'),_0x40179d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c01f525..2886d6e 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 _0x9a71=['active','Imap','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','imapAccounts','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','messageStatus','status','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','moment','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit'];(function(_0x48cc2c,_0x4d56cb){var _0x39adce=function(_0x166e63){while(--_0x166e63){_0x48cc2c['push'](_0x48cc2c['shift']());}};_0x39adce(++_0x4d56cb);}(_0x9a71,0x18c));var _0x19a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x19a7('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x19a7('0x1'));var config=require(_0x19a7('0x2'));var logger=require(_0x19a7('0x3'))(_0x19a7('0x4'));config['redis']=_[_0x19a7('0x5')](config[_0x19a7('0x6')],{'host':_0x19a7('0x7'),'port':0x18eb});var io=require(_0x19a7('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x19a7('0x9'));var EmailSmtp=require(_0x19a7('0xa'));var mailAccount=require(_0x19a7('0xb'));var md5Accounts={};function EmailChannel(_0x5e7bc4){logger[_0x19a7('0xc')]('start\x20email\x20channel');this[_0x19a7('0xd')]=_0x5e7bc4[_0x19a7('0xd')];this['imapAccounts']={};this[_0x19a7('0xe')]=new EmailSmtp();}EmailChannel[_0x19a7('0xf')][_0x19a7('0x10')]=function(_0xe94dbd){var _0x2c476e=this['mailAccounts'][_0xe94dbd];var _0x4fadf5={'id':_0x2c476e['id'],'name':_0x2c476e['name'],'key':_0x2c476e['key'],'active':_0x2c476e[_0x19a7('0x11')],'Imap':{'status':_0x2c476e[_0x19a7('0x12')]['status'],'messageStatus':_0x2c476e[_0x19a7('0x12')]['messageStatus'],'total':_0x2c476e[_0x19a7('0x12')][_0x19a7('0x13')]}};if(_[_0x19a7('0x14')](md5Accounts[_0xe94dbd])){md5Accounts[_0xe94dbd]={};}var _0xa7b9a5=md5(JSON[_0x19a7('0x15')](_0x4fadf5));if(md5Accounts[_0xe94dbd][_0x19a7('0x16')]!==_0xa7b9a5){md5Accounts[_0xe94dbd][_0x19a7('0x16')]=_0xa7b9a5;io[_0x19a7('0x10')](_0x19a7('0x17'),_0x4fadf5);}};EmailChannel['prototype'][_0x19a7('0x18')]=function(_0x4b8db3){for(var _0x58db3f in _0x4b8db3){if(_0x4b8db3[_0x19a7('0x19')](_0x58db3f)){if(_0x4b8db3[_0x58db3f][_0x19a7('0x12')]&&_0x4b8db3[_0x58db3f][_0x19a7('0x11')]){var _0xa2a066=_0x4b8db3[_0x58db3f]['Imap'];if(!_0xa2a066[_0x19a7('0x1a')]&&_0x4b8db3[_0x58db3f]['provider']!==_0x19a7('0x1b'))_0xa2a066[_0x19a7('0x1a')]=_0x4b8db3[_0x58db3f][_0x19a7('0x1c')];if(!this[_0x19a7('0x1d')]['hasOwnProperty'](_0xa2a066['id'])){this[_0x19a7('0x1d')][_0xa2a066['id']]=new EmailImap(_0xa2a066,_0x4b8db3[_0x58db3f][_0x19a7('0x4')]);this[_0x19a7('0x1d')][_0xa2a066['id']]['on'](_0x19a7('0x1e'),this[_0x19a7('0x1f')]['bind'](this,_0x58db3f));this[_0x19a7('0x1d')][_0xa2a066['id']]['on'](_0x19a7('0x4'),this[_0x19a7('0x20')]['bind'](this,_0x58db3f));this[_0x19a7('0x1d')][_0xa2a066['id']]['on'](_0x19a7('0x21'),this[_0x19a7('0x22')][_0x19a7('0x23')](this,_0x58db3f));this[_0x19a7('0x1d')][_0xa2a066['id']]['on'](_0x19a7('0x24'),this[_0x19a7('0x25')][_0x19a7('0x23')](this,_0x58db3f));}}else{if(_['isNil'](this[_0x19a7('0xd')][_0x58db3f]['Imap'])){this[_0x19a7('0xd')][_0x58db3f]['Imap']={};}this[_0x19a7('0xd')][_0x58db3f]['Imap']['status']=_0x19a7('0x26');this[_0x19a7('0xd')][_0x58db3f][_0x19a7('0x12')][_0x19a7('0x27')]='';this[_0x19a7('0x10')](_0x58db3f);}}}};EmailChannel['prototype'][_0x19a7('0x1f')]=function(_0x5932ba,_0x554d25){if(this[_0x19a7('0xd')][_0x5932ba]){this[_0x19a7('0xd')][_0x5932ba]['Imap'][_0x19a7('0x28')]=_0x19a7('0x29');this[_0x19a7('0xd')][_0x5932ba][_0x19a7('0x12')][_0x19a7('0x27')]=_0x554d25[_0x19a7('0x2a')];if(_0x554d25[_0x19a7('0x2b')]){this['mailAccounts'][_0x5932ba][_0x19a7('0x12')][_0x19a7('0x13')]=_0x554d25[_0x19a7('0x2b')][_0x19a7('0x13')];}return this['emit'](_0x5932ba);}};EmailChannel['prototype'][_0x19a7('0x20')]=function(_0x3bc6ea,_0x2638bd){logger['info'](_0x19a7('0x2c'),_0x2638bd['firstName'],_0x2638bd[_0x19a7('0x2d')],_0x2638bd[_0x19a7('0x2e')],_0x3bc6ea);if(this[_0x19a7('0xd')][_0x3bc6ea]){return mailAccount[_0x19a7('0x2f')](_0x3bc6ea,_0x2638bd)[_0x19a7('0x30')](function(_0x3eb5f9){if(_0x3eb5f9){logger[_0x19a7('0xc')](_0x19a7('0x31'));}})[_0x19a7('0x32')](function(_0x297231){logger[_0x19a7('0x24')](_0x19a7('0x33'),JSON[_0x19a7('0x15')](_0x297231));});}};EmailChannel[_0x19a7('0xf')][_0x19a7('0x22')]=function(_0x20036c){if(this[_0x19a7('0xd')][_0x20036c]&&this[_0x19a7('0xd')][_0x20036c][_0x19a7('0x12')]){if(this[_0x19a7('0x1d')][this['mailAccounts'][_0x20036c]['Imap']['id']]){delete this[_0x19a7('0x1d')][this[_0x19a7('0xd')][_0x20036c][_0x19a7('0x12')]['id']];}this['mailAccounts'][_0x20036c]['Imap'][_0x19a7('0x34')]=moment();this[_0x19a7('0x10')](_0x20036c);}};EmailChannel[_0x19a7('0xf')][_0x19a7('0x25')]=function(_0x2910cc,_0x467da3){if(this['mailAccounts'][_0x2910cc]){this[_0x19a7('0xd')][_0x2910cc]['Imap'][_0x19a7('0x28')]='error';this[_0x19a7('0xd')][_0x2910cc][_0x19a7('0x12')][_0x19a7('0x27')]=_0x467da3;return this[_0x19a7('0x10')](_0x2910cc);}};EmailChannel['prototype'][_0x19a7('0x35')]=function(_0x118172,_0x4f992b){return this[_0x19a7('0xe')][_0x19a7('0x36')](_0x118172,_0x4f992b);};EmailChannel[_0x19a7('0xf')][_0x19a7('0x37')]=function(_0x3aac90){var _0x3c84e9=this;if(this['mailAccounts'][_0x3aac90['id']]){if(_[_0x19a7('0x14')](this[_0x19a7('0xd')][_0x3aac90['id']][_0x19a7('0x38')])){this[_0x19a7('0xd')][_0x3aac90['id']][_0x19a7('0x38')]={};}this[_0x19a7('0xd')][_0x3aac90['id']]['Smtp'][_0x19a7('0x34')]=moment();return new BPromise(function(_0x44b03d,_0x2dc942){return _0x3c84e9[_0x19a7('0xe')][_0x19a7('0x39')](_0x3aac90)[_0x19a7('0x30')](function(_0x97d48f){_0x3c84e9[_0x19a7('0xd')][_0x3aac90['id']]['Smtp'][_0x19a7('0x28')]='verified';_0x3c84e9['mailAccounts'][_0x3aac90['id']]['Smtp'][_0x19a7('0x27')]='';_0x3c84e9[_0x19a7('0x10')](_0x3aac90['id']);_0x44b03d(_0x97d48f);})['catch'](function(_0x436569){_0x3c84e9[_0x19a7('0xd')][_0x3aac90['id']][_0x19a7('0x38')][_0x19a7('0x28')]=_0x19a7('0x24');_0x3c84e9[_0x19a7('0xd')][_0x3aac90['id']][_0x19a7('0x38')]['messageStatus']=_0x436569;_0x3c84e9[_0x19a7('0x10')](_0x3aac90['id']);_0x2dc942(_0x436569);});});}return this['smtp']['verify'](_0x3aac90);};module[_0x19a7('0x3a')]=EmailChannel; \ No newline at end of file +var _0x70a9=['mailAccounts','imapAccounts','smtp','prototype','name','key','active','status','Imap','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','emit','messages','info','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','verifySmtp','Smtp','verified','verify','exports','lodash','bluebird','ioredis','../../../config/environment','email','redis','localhost','./imap'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x70a9,0x1cc));var _0x970a=function(_0x43ab8c,_0x5cc0dc){_0x43ab8c=_0x43ab8c-0x0;var _0x1cf3bf=_0x70a9[_0x43ab8c];return _0x1cf3bf;};'use strict';var _=require(_0x970a('0x0'));var moment=require('moment');var BPromise=require(_0x970a('0x1'));var md5=require('md5');var Redis=require(_0x970a('0x2'));var config=require(_0x970a('0x3'));var logger=require('../../../config/logger')(_0x970a('0x4'));config[_0x970a('0x5')]=_['defaults'](config[_0x970a('0x5')],{'host':_0x970a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x970a('0x5')]));var EmailImap=require(_0x970a('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xfc81db){logger['info']('start\x20email\x20channel');this[_0x970a('0x8')]=_0xfc81db[_0x970a('0x8')];this[_0x970a('0x9')]={};this[_0x970a('0xa')]=new EmailSmtp();}EmailChannel[_0x970a('0xb')]['emit']=function(_0x25e77c){var _0x54afb6=this['mailAccounts'][_0x25e77c];var _0x3d2811={'id':_0x54afb6['id'],'name':_0x54afb6[_0x970a('0xc')],'key':_0x54afb6[_0x970a('0xd')],'active':_0x54afb6[_0x970a('0xe')],'Imap':{'status':_0x54afb6['Imap'][_0x970a('0xf')],'messageStatus':_0x54afb6[_0x970a('0x10')][_0x970a('0x11')],'total':_0x54afb6['Imap'][_0x970a('0x12')]}};if(_[_0x970a('0x13')](md5Accounts[_0x25e77c])){md5Accounts[_0x25e77c]={};}var _0x4e9c63=md5(JSON['stringify'](_0x3d2811));if(md5Accounts[_0x25e77c]['md5']!==_0x4e9c63){md5Accounts[_0x25e77c][_0x970a('0x14')]=_0x4e9c63;io['emit'](_0x970a('0x15'),_0x3d2811);}};EmailChannel[_0x970a('0xb')][_0x970a('0x16')]=function(_0x29b24a){for(var _0x1b1bf9 in _0x29b24a){if(_0x29b24a[_0x970a('0x17')](_0x1b1bf9)){if(_0x29b24a[_0x1b1bf9][_0x970a('0x10')]&&_0x29b24a[_0x1b1bf9]['active']){var _0x127fef=_0x29b24a[_0x1b1bf9][_0x970a('0x10')];if(!_0x127fef['service']&&_0x29b24a[_0x1b1bf9][_0x970a('0x18')]!==_0x970a('0x19'))_0x127fef[_0x970a('0x1a')]=_0x29b24a[_0x1b1bf9][_0x970a('0x18')];if(!this[_0x970a('0x9')]['hasOwnProperty'](_0x127fef['id'])){this[_0x970a('0x9')][_0x127fef['id']]=new EmailImap(_0x127fef,_0x29b24a[_0x1b1bf9][_0x970a('0x4')]);this['imapAccounts'][_0x127fef['id']]['on'](_0x970a('0x1b'),this[_0x970a('0x1c')]['bind'](this,_0x1b1bf9));this[_0x970a('0x9')][_0x127fef['id']]['on'](_0x970a('0x4'),this[_0x970a('0x1d')][_0x970a('0x1e')](this,_0x1b1bf9));this[_0x970a('0x9')][_0x127fef['id']]['on'](_0x970a('0x1f'),this[_0x970a('0x20')][_0x970a('0x1e')](this,_0x1b1bf9));this[_0x970a('0x9')][_0x127fef['id']]['on'](_0x970a('0x21'),this['handleImapError']['bind'](this,_0x1b1bf9));}}else{if(_[_0x970a('0x13')](this[_0x970a('0x8')][_0x1b1bf9][_0x970a('0x10')])){this['mailAccounts'][_0x1b1bf9]['Imap']={};}this[_0x970a('0x8')][_0x1b1bf9][_0x970a('0x10')][_0x970a('0xf')]='disabled';this[_0x970a('0x8')][_0x1b1bf9]['Imap'][_0x970a('0x11')]='';this[_0x970a('0x22')](_0x1b1bf9);}}}};EmailChannel[_0x970a('0xb')][_0x970a('0x1c')]=function(_0x38594a,_0xbc80b7){if(this['mailAccounts'][_0x38594a]){this[_0x970a('0x8')][_0x38594a]['Imap'][_0x970a('0xf')]='connected';this[_0x970a('0x8')][_0x38594a]['Imap'][_0x970a('0x11')]=_0xbc80b7[_0x970a('0xc')];if(_0xbc80b7['messages']){this[_0x970a('0x8')][_0x38594a]['Imap'][_0x970a('0x12')]=_0xbc80b7[_0x970a('0x23')][_0x970a('0x12')];}return this[_0x970a('0x22')](_0x38594a);}};EmailChannel[_0x970a('0xb')][_0x970a('0x1d')]=function(_0x4577d0,_0x5840f2){logger[_0x970a('0x24')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5840f2[_0x970a('0x25')],_0x5840f2['lastName'],_0x5840f2[_0x970a('0x26')],_0x4577d0);if(this[_0x970a('0x8')][_0x4577d0]){return mailAccount[_0x970a('0x27')](_0x4577d0,_0x5840f2)[_0x970a('0x28')](function(_0x3e470c){if(_0x3e470c){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x970a('0x29')](function(_0x5ec7d0){logger['error'](_0x970a('0x2a'),JSON[_0x970a('0x2b')](_0x5ec7d0));});}};EmailChannel[_0x970a('0xb')][_0x970a('0x20')]=function(_0x44fa21){if(this['mailAccounts'][_0x44fa21]&&this['mailAccounts'][_0x44fa21][_0x970a('0x10')]){if(this[_0x970a('0x9')][this[_0x970a('0x8')][_0x44fa21][_0x970a('0x10')]['id']]){delete this[_0x970a('0x9')][this[_0x970a('0x8')][_0x44fa21][_0x970a('0x10')]['id']];}this['mailAccounts'][_0x44fa21]['Imap'][_0x970a('0x2c')]=moment();this[_0x970a('0x22')](_0x44fa21);}};EmailChannel[_0x970a('0xb')][_0x970a('0x2d')]=function(_0xf51234,_0x1c64eb){if(this[_0x970a('0x8')][_0xf51234]){this[_0x970a('0x8')][_0xf51234][_0x970a('0x10')][_0x970a('0xf')]=_0x970a('0x21');this[_0x970a('0x8')][_0xf51234]['Imap'][_0x970a('0x11')]=_0x1c64eb;return this['emit'](_0xf51234);}};EmailChannel[_0x970a('0xb')][_0x970a('0x2e')]=function(_0x11987e,_0x94838a){return this['smtp']['send'](_0x11987e,_0x94838a);};EmailChannel['prototype'][_0x970a('0x2f')]=function(_0x5801db){var _0x4a8dcb=this;if(this['mailAccounts'][_0x5801db['id']]){if(_[_0x970a('0x13')](this[_0x970a('0x8')][_0x5801db['id']][_0x970a('0x30')])){this['mailAccounts'][_0x5801db['id']][_0x970a('0x30')]={};}this['mailAccounts'][_0x5801db['id']][_0x970a('0x30')]['lastSync']=moment();return new BPromise(function(_0x2f2cef,_0x26c532){return _0x4a8dcb['smtp']['verify'](_0x5801db)[_0x970a('0x28')](function(_0x5605e4){_0x4a8dcb[_0x970a('0x8')][_0x5801db['id']][_0x970a('0x30')][_0x970a('0xf')]=_0x970a('0x31');_0x4a8dcb[_0x970a('0x8')][_0x5801db['id']][_0x970a('0x30')][_0x970a('0x11')]='';_0x4a8dcb['emit'](_0x5801db['id']);_0x2f2cef(_0x5605e4);})[_0x970a('0x29')](function(_0x4b0535){_0x4a8dcb['mailAccounts'][_0x5801db['id']]['Smtp'][_0x970a('0xf')]=_0x970a('0x21');_0x4a8dcb['mailAccounts'][_0x5801db['id']]['Smtp']['messageStatus']=_0x4b0535;_0x4a8dcb['emit'](_0x5801db['id']);_0x26c532(_0x4b0535);});});}return this[_0x970a('0xa')][_0x970a('0x32')](_0x5801db);};module[_0x970a('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1d2b549..96f78a9 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 _0xd66f=['textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','account','ready','handleReady','bind','end','error','connect','inherits','prototype','connTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleError','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','once','handleFetchEnd','closeBox','body','handleMessageBody','handleSimpleParser','handleMessageAttributes','handleMessageEnd','handleEnd','stringify'];(function(_0x37905e,_0x297eb8){var _0x36ed9c=function(_0x38fef2){while(--_0x38fef2){_0x37905e['push'](_0x37905e['shift']());}};_0x36ed9c(++_0x297eb8);}(_0xd66f,0xc1));var _0xfd66=function(_0xffeebf,_0x2d6582){_0xffeebf=_0xffeebf-0x0;var _0xec5ce4=_0xd66f[_0xffeebf];return _0xec5ce4;};'use strict';var _=require(_0xfd66('0x0'));var util=require('util');var Imap=require(_0xfd66('0x1'));var simpleParser=require(_0xfd66('0x2'))['simpleParser'];var Iconv=require(_0xfd66('0x3'))[_0xfd66('0x4')];var EventEmitter=require(_0xfd66('0x5'))[_0xfd66('0x6')];var utils=require(_0xfd66('0x7'));var logger=require(_0xfd66('0x8'))(_0xfd66('0x9'));function EmailImap(_0x375a88,_0x1b0f0b){this['mailbox']=_0x375a88[_0xfd66('0xa')];this['account']=this[_0xfd66('0xb')](_0x375a88,_0x1b0f0b);this[_0xfd66('0x1')]=new Imap(this[_0xfd66('0xc')]);this['imap']['once'](_0xfd66('0xd'),this[_0xfd66('0xe')][_0xfd66('0xf')](this));this[_0xfd66('0x1')]['once'](_0xfd66('0x10'),this['handleEnd'][_0xfd66('0xf')](this));this[_0xfd66('0x1')]['on'](_0xfd66('0x11'),this['handleError'][_0xfd66('0xf')](this));this[_0xfd66('0x1')][_0xfd66('0x12')]();}util[_0xfd66('0x13')](EmailImap,EventEmitter);EmailImap[_0xfd66('0x14')][_0xfd66('0xb')]=function(_0x4cc443,_0x2d7704){var _0x462cba={'connTimeout':_0x4cc443[_0xfd66('0x15')]?_0x4cc443[_0xfd66('0x15')]*0x3e8:0x2710,'authTimeout':_0x4cc443['authTimeout']?_0x4cc443['authTimeout']*0x3e8:0x1388};if(_0x4cc443[_0xfd66('0x16')]){_0x462cba['user']=_0x4cc443[_0xfd66('0x17')];if(_0x4cc443['modernAuthentication']){_0x462cba[_0xfd66('0x18')]=utils[_0xfd66('0x19')](_0x4cc443[_0xfd66('0x1a')][_0xfd66('0x1b')],_0x4cc443[_0xfd66('0x17')]);}else{_0x462cba[_0xfd66('0x1c')]=_0x4cc443[_0xfd66('0x1c')];}}else{if(_0x4cc443[_0xfd66('0x1d')]){_0x462cba[_0xfd66('0x17')]=_0x4cc443[_0xfd66('0x17')];_0x462cba['password']=_0x4cc443[_0xfd66('0x1c')];}}_0x462cba[_0xfd66('0x9')]=_0x2d7704||_0x4cc443['user']||_0xfd66('0x1e');_0x462cba[_0xfd66('0x1f')]=_0x4cc443[_0xfd66('0x1f')];_0x462cba[_0xfd66('0x20')]=_0x4cc443['port']||0x3e1;if(_0x4cc443[_0xfd66('0x21')]){_0x462cba[_0xfd66('0x21')]=!![];}else{_0x462cba[_0xfd66('0x21')]=![];_0x462cba[_0xfd66('0x22')]='required';}return _0x462cba;};EmailImap['prototype'][_0xfd66('0xe')]=function(){this['imap'][_0xfd66('0x23')](this[_0xfd66('0xa')],![],this[_0xfd66('0x24')][_0xfd66('0xf')](this));};EmailImap[_0xfd66('0x14')][_0xfd66('0x24')]=function(_0x3ef28e,_0x253838){if(_0x3ef28e){this['handleError'](_0x3ef28e,!![]);}else{this[_0xfd66('0x25')](_0xfd66('0x26'),_0x253838);this[_0xfd66('0x27')]();}};EmailImap[_0xfd66('0x14')][_0xfd66('0x28')]=function(_0x537195){if(_0x537195){this[_0xfd66('0x29')](_0x537195,!![]);}else{this['imap'][_0xfd66('0x10')]();}};EmailImap['prototype'][_0xfd66('0x27')]=function(){this['imap'][_0xfd66('0x2a')](['UNSEEN'],this[_0xfd66('0x2b')][_0xfd66('0xf')](this));};EmailImap['prototype'][_0xfd66('0x2b')]=function(_0x51a0be,_0x38e7d7){if(_0x51a0be){this[_0xfd66('0x29')](_0x51a0be,!![]);}else{if(_0x38e7d7[_0xfd66('0x2c')]){try{var _0x48e4b1=this[_0xfd66('0x1')][_0xfd66('0x2d')](_0x38e7d7,{'bodies':'','markSeen':!![]});_0x48e4b1['on'](_0xfd66('0x2e'),this[_0xfd66('0x2f')][_0xfd66('0xf')](this));_0x48e4b1['once'](_0xfd66('0x11'),this[_0xfd66('0x30')][_0xfd66('0xf')](this));_0x48e4b1[_0xfd66('0x31')]('end',this[_0xfd66('0x32')]['bind'](this));}catch(_0x10b361){logger[_0xfd66('0x11')](_0x10b361);}}else{this[_0xfd66('0x1')][_0xfd66('0x33')](!![],this[_0xfd66('0x28')][_0xfd66('0xf')](this));}}};EmailImap[_0xfd66('0x14')][_0xfd66('0x2f')]=function(_0x1d1241){_0x1d1241['on'](_0xfd66('0x34'),this['handleMessageBody'][_0xfd66('0xf')](this));_0x1d1241['once']('attributes',this['handleMessageAttributes']['bind'](this));_0x1d1241[_0xfd66('0x31')](_0xfd66('0x10'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xfd66('0x14')][_0xfd66('0x35')]=function(_0x95137f){simpleParser(_0x95137f,{'Iconv':Iconv},this[_0xfd66('0x36')][_0xfd66('0xf')](this));};EmailImap['prototype'][_0xfd66('0x37')]=function(){};EmailImap[_0xfd66('0x14')][_0xfd66('0x38')]=function(){};EmailImap[_0xfd66('0x14')][_0xfd66('0x36')]=function(_0x480265,_0x1e3e4d){if(_0x480265){logger[_0xfd66('0x11')](_0x480265);}else{var _0x5733e8=this;utils['parser'](this[_0xfd66('0xc')],_0x1e3e4d,function(_0x35ee54){_0x5733e8[_0xfd66('0x25')](_0xfd66('0x9'),_0x35ee54);});}};EmailImap[_0xfd66('0x14')][_0xfd66('0x32')]=function(){this[_0xfd66('0x1')][_0xfd66('0x33')](!![],this['handleCloseBox'][_0xfd66('0xf')](this));};EmailImap[_0xfd66('0x14')][_0xfd66('0x30')]=function(_0x234541){this['handleError'](_0x234541);this[_0xfd66('0x1')][_0xfd66('0x33')](!![],this[_0xfd66('0x28')][_0xfd66('0xf')](this));};EmailImap['prototype'][_0xfd66('0x39')]=function(){this[_0xfd66('0x25')]('end');};EmailImap[_0xfd66('0x14')][_0xfd66('0x29')]=function(_0xc9f809,_0x3dc6a5){logger[_0xfd66('0x11')]('handleError',this[_0xfd66('0xc')][_0xfd66('0x9')],JSON[_0xfd66('0x3a')](_0xc9f809));var _0x25c54c='';if(_0xc9f809){if(_0xc9f809[_0xfd66('0x3b')]){_0x25c54c=_0xc9f809['textCode'];}else{for(var _0x1aadaa in _0xc9f809){if(_0xc9f809[_0xfd66('0x3c')](_0x1aadaa)){_0x25c54c+=_[_0xfd66('0x3d')](_0x1aadaa)+':\x20'+_0xc9f809[_0x1aadaa]+'\x0a';}}}}if(_0x3dc6a5){this[_0xfd66('0x1')][_0xfd66('0x10')]();}else{this[_0xfd66('0x25')](_0xfd66('0x11'),_0x25c54c);this[_0xfd66('0x25')]('end');}};module[_0xfd66('0x3e')]=EmailImap; \ No newline at end of file +var _0x5dff=['UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','emit','handleEnd','textCode','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','once','handleReady','bind','end','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search'];(function(_0x20d93f,_0x231a43){var _0x31869a=function(_0x15cf6c){while(--_0x15cf6c){_0x20d93f['push'](_0x20d93f['shift']());}};_0x31869a(++_0x231a43);}(_0x5dff,0x14b));var _0xf5df=function(_0x235186,_0xf3fdc2){_0x235186=_0x235186-0x0;var _0x103007=_0x5dff[_0x235186];return _0x103007;};'use strict';var _=require(_0xf5df('0x0'));var util=require(_0xf5df('0x1'));var Imap=require(_0xf5df('0x2'));var simpleParser=require('mailparser')[_0xf5df('0x3')];var Iconv=require(_0xf5df('0x4'))[_0xf5df('0x5')];var EventEmitter=require(_0xf5df('0x6'))['EventEmitter'];var utils=require(_0xf5df('0x7'));var logger=require(_0xf5df('0x8'))(_0xf5df('0x9'));function EmailImap(_0x33ff63,_0x21206e){this['mailbox']=_0x33ff63[_0xf5df('0xa')];this[_0xf5df('0xb')]=this['getAccount'](_0x33ff63,_0x21206e);this[_0xf5df('0x2')]=new Imap(this['account']);this[_0xf5df('0x2')][_0xf5df('0xc')]('ready',this[_0xf5df('0xd')][_0xf5df('0xe')](this));this[_0xf5df('0x2')][_0xf5df('0xc')](_0xf5df('0xf'),this['handleEnd'][_0xf5df('0xe')](this));this[_0xf5df('0x2')]['on']('error',this[_0xf5df('0x10')][_0xf5df('0xe')](this));this[_0xf5df('0x2')][_0xf5df('0x11')]();}util[_0xf5df('0x12')](EmailImap,EventEmitter);EmailImap[_0xf5df('0x13')][_0xf5df('0x14')]=function(_0x12ccca,_0x79df52){var _0x18c07c={'connTimeout':_0x12ccca[_0xf5df('0x15')]?_0x12ccca['connTimeout']*0x3e8:0x2710,'authTimeout':_0x12ccca[_0xf5df('0x16')]?_0x12ccca[_0xf5df('0x16')]*0x3e8:0x1388};if(_0x12ccca['service']){_0x18c07c[_0xf5df('0x17')]=_0x12ccca[_0xf5df('0x17')];if(_0x12ccca[_0xf5df('0x18')]){_0x18c07c[_0xf5df('0x19')]=utils['generateXOAuth2Token'](_0x12ccca[_0xf5df('0x1a')][_0xf5df('0x1b')],_0x12ccca[_0xf5df('0x17')]);}else{_0x18c07c[_0xf5df('0x1c')]=_0x12ccca[_0xf5df('0x1c')];}}else{if(_0x12ccca['authentication']){_0x18c07c[_0xf5df('0x17')]=_0x12ccca[_0xf5df('0x17')];_0x18c07c[_0xf5df('0x1c')]=_0x12ccca['password'];}}_0x18c07c[_0xf5df('0x9')]=_0x79df52||_0x12ccca[_0xf5df('0x17')]||_0xf5df('0x1d');_0x18c07c[_0xf5df('0x1e')]=_0x12ccca[_0xf5df('0x1e')];_0x18c07c[_0xf5df('0x1f')]=_0x12ccca[_0xf5df('0x1f')]||0x3e1;if(_0x12ccca[_0xf5df('0x20')]){_0x18c07c['tls']=!![];}else{_0x18c07c['tls']=![];_0x18c07c[_0xf5df('0x21')]=_0xf5df('0x22');}return _0x18c07c;};EmailImap[_0xf5df('0x13')][_0xf5df('0xd')]=function(){this['imap'][_0xf5df('0x23')](this[_0xf5df('0xa')],![],this[_0xf5df('0x24')]['bind'](this));};EmailImap[_0xf5df('0x13')][_0xf5df('0x24')]=function(_0x307b66,_0x25ab94){if(_0x307b66){this[_0xf5df('0x10')](_0x307b66,!![]);}else{this['emit'](_0xf5df('0x25'),_0x25ab94);this[_0xf5df('0x26')]();}};EmailImap[_0xf5df('0x13')][_0xf5df('0x27')]=function(_0x6a54bb){if(_0x6a54bb){this[_0xf5df('0x10')](_0x6a54bb,!![]);}else{this['imap'][_0xf5df('0xf')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xf5df('0x2')][_0xf5df('0x28')]([_0xf5df('0x29')],this[_0xf5df('0x2a')][_0xf5df('0xe')](this));};EmailImap['prototype'][_0xf5df('0x2a')]=function(_0x1fb281,_0x29e81a){if(_0x1fb281){this[_0xf5df('0x10')](_0x1fb281,!![]);}else{if(_0x29e81a[_0xf5df('0x2b')]){try{var _0x5e2d74=this['imap'][_0xf5df('0x2c')](_0x29e81a,{'bodies':'','markSeen':!![]});_0x5e2d74['on'](_0xf5df('0x2d'),this[_0xf5df('0x2e')]['bind'](this));_0x5e2d74[_0xf5df('0xc')](_0xf5df('0x2f'),this[_0xf5df('0x30')]['bind'](this));_0x5e2d74[_0xf5df('0xc')](_0xf5df('0xf'),this[_0xf5df('0x31')][_0xf5df('0xe')](this));}catch(_0x1357dc){logger[_0xf5df('0x2f')](_0x1357dc);}}else{this[_0xf5df('0x2')][_0xf5df('0x32')](!![],this[_0xf5df('0x27')][_0xf5df('0xe')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x1e08c3){_0x1e08c3['on']('body',this['handleMessageBody'][_0xf5df('0xe')](this));_0x1e08c3['once'](_0xf5df('0x33'),this[_0xf5df('0x34')]['bind'](this));_0x1e08c3[_0xf5df('0xc')](_0xf5df('0xf'),this['handleMessageEnd'][_0xf5df('0xe')](this));};EmailImap[_0xf5df('0x13')][_0xf5df('0x35')]=function(_0x5e2efd){simpleParser(_0x5e2efd,{'Iconv':Iconv},this[_0xf5df('0x36')]['bind'](this));};EmailImap[_0xf5df('0x13')][_0xf5df('0x34')]=function(){};EmailImap['prototype'][_0xf5df('0x37')]=function(){};EmailImap[_0xf5df('0x13')][_0xf5df('0x36')]=function(_0x8dc442,_0x16a20e){if(_0x8dc442){logger[_0xf5df('0x2f')](_0x8dc442);}else{var _0x5a30cf=this;utils[_0xf5df('0x38')](this[_0xf5df('0xb')],_0x16a20e,function(_0x38c5d3){_0x5a30cf[_0xf5df('0x39')](_0xf5df('0x9'),_0x38c5d3);});}};EmailImap['prototype'][_0xf5df('0x31')]=function(){this[_0xf5df('0x2')][_0xf5df('0x32')](!![],this[_0xf5df('0x27')]['bind'](this));};EmailImap[_0xf5df('0x13')][_0xf5df('0x30')]=function(_0x2dd5af){this[_0xf5df('0x10')](_0x2dd5af);this[_0xf5df('0x2')]['closeBox'](!![],this[_0xf5df('0x27')][_0xf5df('0xe')](this));};EmailImap[_0xf5df('0x13')][_0xf5df('0x3a')]=function(){this['emit']('end');};EmailImap['prototype'][_0xf5df('0x10')]=function(_0x4972a0,_0x373d93){logger['error'](_0xf5df('0x10'),this[_0xf5df('0xb')][_0xf5df('0x9')],JSON['stringify'](_0x4972a0));var _0x3b8ac8='';if(_0x4972a0){if(_0x4972a0[_0xf5df('0x3b')]){_0x3b8ac8=_0x4972a0[_0xf5df('0x3b')];}else{for(var _0x4b968d in _0x4972a0){if(_0x4972a0[_0xf5df('0x3c')](_0x4b968d)){_0x3b8ac8+=_[_0xf5df('0x3d')](_0x4b968d)+':\x20'+_0x4972a0[_0x4b968d]+'\x0a';}}}}if(_0x373d93){this['imap'][_0xf5df('0xf')]();}else{this[_0xf5df('0x39')](_0xf5df('0x2f'),_0x3b8ac8);this[_0xf5df('0x39')](_0xf5df('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 45d44cf..53b20cc 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 _0xd4e6=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x3fca45,_0x3e990b){var _0x45f609=function(_0x25416a){while(--_0x25416a){_0x3fca45['push'](_0x3fca45['shift']());}};_0x45f609(++_0x3e990b);}(_0xd4e6,0x181));var _0x6d4e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd4e6[_0x28947d];return _0x12d2ee;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6d4e('0x0'));function EmailSmtp(){}EmailSmtp[_0x6d4e('0x1')][_0x6d4e('0x2')]=function(_0x3f26da,_0x3dc0a7){return new Promise(function(_0x4f122f,_0x5cff60){var _0x1f4e00=nodemailer[_0x6d4e('0x3')](_0x3f26da);_0x1f4e00[_0x6d4e('0x4')]('compile',inlineBase64());_0x1f4e00[_0x6d4e('0x5')](_0x3dc0a7,function(_0x12ec43,_0x118c25){if(_0x12ec43){_0x5cff60(_0x12ec43[_0x6d4e('0x6')]());}else{_0x4f122f(_0x118c25);}});});};EmailSmtp[_0x6d4e('0x1')][_0x6d4e('0x7')]=function(_0x1fb518){return new Promise(function(_0x2e8b18,_0x266688){var _0x4e9402=nodemailer[_0x6d4e('0x3')](_0x1fb518);_0x4e9402[_0x6d4e('0x7')](function(_0x100a95,_0x1b03b1){if(_0x100a95){_0x266688(_0x100a95[_0x6d4e('0x6')]());}else{if(_0x1b03b1){_0x2e8b18(_0x1b03b1);}else{_0x266688(_0x6d4e('0x8'));}}});});};module[_0x6d4e('0x9')]=EmailSmtp; \ No newline at end of file +var _0x60b7=['send','createTransport','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x60b7,0xd6));var _0x760b=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0x60b7[_0x1a422a];return _0x4dcab4;};'use strict';var nodemailer=require(_0x760b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x760b('0x1')][_0x760b('0x2')]=function(_0x2571ba,_0xff454f){return new Promise(function(_0x4e62d5,_0x55b97e){var _0xed5697=nodemailer[_0x760b('0x3')](_0x2571ba);_0xed5697['use']('compile',inlineBase64());_0xed5697[_0x760b('0x4')](_0xff454f,function(_0x3bd104,_0x3ac98e){if(_0x3bd104){_0x55b97e(_0x3bd104[_0x760b('0x5')]());}else{_0x4e62d5(_0x3ac98e);}});});};EmailSmtp[_0x760b('0x1')][_0x760b('0x6')]=function(_0xdfb4ef){return new Promise(function(_0x401fd0,_0x5a3604){var _0xc84063=nodemailer[_0x760b('0x3')](_0xdfb4ef);_0xc84063[_0x760b('0x6')](function(_0x3d67e1,_0x22a553){if(_0x3d67e1){_0x5a3604(_0x3d67e1[_0x760b('0x5')]());}else{if(_0x22a553){_0x401fd0(_0x22a553);}else{_0x5a3604(_0x760b('0x7'));}}});});};module[_0x760b('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a8cdf32..3872c0c 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 _0xdd38=['indexOf','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring'];(function(_0x58d580,_0x4c8f86){var _0x3c096c=function(_0x1385cf){while(--_0x1385cf){_0x58d580['push'](_0x58d580['shift']());}};_0x3c096c(++_0x4c8f86);}(_0xdd38,0x1c4));var _0x8dd3=function(_0x1ff329,_0x33e086){_0x1ff329=_0x1ff329-0x0;var _0x28501d=_0xdd38[_0x1ff329];return _0x28501d;};'use strict';var _=require(_0x8dd3('0x0'));var moment=require(_0x8dd3('0x1'));var random=require(_0x8dd3('0x2'));var fs=require('fs');var path=require(_0x8dd3('0x3'));var util=require(_0x8dd3('0x4'));var tnef=require(_0x8dd3('0x5'));var logger=require(_0x8dd3('0x6'))('email');var config=require(_0x8dd3('0x7'));function getAddress(_0x551dd0){var _0x17440f=_[_0x8dd3('0x8')](_0x551dd0[_0x8dd3('0x9')]);return _0x17440f&&_0x17440f[_0x8dd3('0xa')]?_0x17440f[_0x8dd3('0xa')]:_0x8dd3('0xb')+random[_0x8dd3('0xc')](0x6)+_0x8dd3('0xd');}function getFirstName(_0x4a9352){var _0x47ee25=_[_0x8dd3('0x8')](_0x4a9352[_0x8dd3('0x9')]);if(_0x47ee25&&_0x47ee25[_0x8dd3('0xe')]){if(_0x47ee25[_0x8dd3('0xe')]==_0x47ee25[_0x8dd3('0xa')]){return _0x47ee25[_0x8dd3('0xe')][_0x8dd3('0xf')](0x0,_0x47ee25[_0x8dd3('0xe')][_0x8dd3('0x10')]('@'));}var _0x60d675=_0x47ee25[_0x8dd3('0xe')]['split'](/\s+/);return _0x60d675[_0x8dd3('0x11')]>0x1?_0x60d675[_0x8dd3('0x12')](0x0,-0x1)[_0x8dd3('0x13')]('\x20'):_0x47ee25[_0x8dd3('0xe')];}return _0x8dd3('0x14');}function getLastName(_0x559ebf){var _0x186654=_[_0x8dd3('0x8')](_0x559ebf['value']);if(_0x186654&&_0x186654[_0x8dd3('0xe')]){var _0xb211d=_0x186654[_0x8dd3('0xe')]['split'](/\s+/);return _0xb211d[_0x8dd3('0x11')]>0x1?_0xb211d[_0x8dd3('0x15')]():'';}return'';}function getMails(_0x2a979d,_0x15f239){var _0x3449af='';for(var _0x20045f=0x0;_0x20045f<_0x15f239[_0x8dd3('0x9')][_0x8dd3('0x11')];_0x20045f+=0x1){if(_0x15f239['value'][_0x20045f]['address']!==_0x2a979d){if(!_[_0x8dd3('0x16')](_0x3449af)){_0x3449af+=',';}_0x3449af+=_0x15f239[_0x8dd3('0x9')][_0x20045f][_0x8dd3('0xe')]||_0x15f239['value'][_0x20045f]['address']||'';_0x3449af+='\x20<';_0x3449af+=_0x15f239[_0x8dd3('0x9')][_0x20045f][_0x8dd3('0xa')]?_0x15f239[_0x8dd3('0x9')][_0x20045f]['address']:_0x8dd3('0xb')+random[_0x8dd3('0xc')](0x6)+_0x8dd3('0xd');_0x3449af+='>';}}return _0x3449af;}function parseEmail(_0x3724c1,_0x1e6b05,_0x430b65){if(_0x1e6b05[_0x8dd3('0x17')]){var _0x4813c5=/)<[^<]*)*<\/script>/gi;while(_0x4813c5[_0x8dd3('0x18')](_0x1e6b05[_0x8dd3('0x17')])){_0x1e6b05['html']=_0x1e6b05['html'][_0x8dd3('0x19')](_0x4813c5,'');}if(_0x1e6b05[_0x8dd3('0x17')]['includes'](_0x8dd3('0x1a'))){var _0x49b706=[];_0x1e6b05[_0x8dd3('0x1b')][_0x8dd3('0x1c')](_0x31da1e=>{_0x49b706[_0x8dd3('0x1d')](_0x31da1e[_0x8dd3('0x1e')]);});var _0x1d2403=/]+>/g;var _0x54e2ef=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x17b852=_0x1e6b05[_0x8dd3('0x17')][_0x8dd3('0x19')](_0x54e2ef,_0x8dd3('0x1f'));var _0x47a366=_0x17b852[_0x8dd3('0x19')](_0x1d2403,_0x8dd3('0x20'));for(let _0x135743=0x0;_0x135743<_0x49b706[_0x8dd3('0x11')];_0x135743++){var _0x35d803=_0x47a366[_0x8dd3('0x19')]('_IMG',_0x8dd3('0x21')+_0x49b706[_0x135743]+_0x8dd3('0x22'));_0x47a366=_0x35d803;}_0x1e6b05[_0x8dd3('0x17')]=_0x47a366;}_0x430b65['body']=_0x1e6b05[_0x8dd3('0x17')];}else{_0x430b65[_0x8dd3('0x23')]=_0x1e6b05[_0x8dd3('0x24')];}if(_0x430b65[_0x8dd3('0x23')]){_0x430b65['body']=_0x430b65[_0x8dd3('0x23')][_0x8dd3('0x19')](/0x0){var _0x2680a1=['Auto-Submitted:\x20auto-replied',_0x8dd3('0x35'),_0x8dd3('0x36')];for(var _0x2b95bf=0x0;_0x2b95bf<_0x1e6b05[_0x8dd3('0x37')][_0x8dd3('0x11')];_0x2b95bf++){var _0x529033=_['indexOf'](_0x2680a1,_0x1e6b05[_0x8dd3('0x37')][_0x2b95bf][_0x8dd3('0x38')]);if(_0x529033>=0x0){_0x430b65[_0x8dd3('0x39')]=!![];}}}return _0x430b65;}exports[_0x8dd3('0x3a')]=function(_0x517db7,_0x3de1dc,_0x5dd311){var _0x3e10a6={'from':getAddress(_0x3de1dc[_0x8dd3('0x3b')]),'firstName':getFirstName(_0x3de1dc[_0x8dd3('0x3b')]),'lastName':getLastName(_0x3de1dc[_0x8dd3('0x3b')]),'mapKey':_0x8dd3('0x28'),'message':{'from':getMails(_0x517db7[_0x8dd3('0x28')],_0x3de1dc[_0x8dd3('0x3b')]),'to':_0x517db7['email'],'cc':'','subject':_0x3de1dc[_0x8dd3('0x3c')]||'','messageId':_0x3de1dc[_0x8dd3('0x3d')],'inReplyTo':_0x3de1dc[_0x8dd3('0x3e')],'sentAt':moment(_0x3de1dc[_0x8dd3('0x3f')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3de1dc[_0x8dd3('0x17')]&&!_0x3de1dc[_0x8dd3('0x24')]){var _0x190e7f=_[_0x8dd3('0x40')](_0x3de1dc['attachments'],{'contentType':'application/ms-tnef'});if(_0x190e7f['length']){logger[_0x8dd3('0x41')](util[_0x8dd3('0x2e')](_0x8dd3('0x42'),_0x3de1dc[_0x8dd3('0x3d')]));tnef[_0x8dd3('0x43')](_[_0x8dd3('0x44')](_0x190e7f)[_0x8dd3('0x45')],function(_0x59f4a2,_0x3fdd90){if(_0x3fdd90){_0x3de1dc['html']=_0x3fdd90[_0x8dd3('0x46')]||_0x8dd3('0x47');if(_0x3fdd90[_0x8dd3('0x48')]){for(var _0x5ae2ca=0x0;_0x5ae2ca<_0x3fdd90[_0x8dd3('0x48')][_0x8dd3('0x11')];_0x5ae2ca++){var _0x3e9fd4=_0x3fdd90[_0x8dd3('0x48')][_0x5ae2ca];_0x3e10a6[_0x8dd3('0x26')][_0x8dd3('0x1b')][_0x8dd3('0x1d')]({'filename':_0x3e9fd4[_0x8dd3('0x49')],'content':Buffer[_0x8dd3('0x3b')](_0x3e9fd4[_0x8dd3('0x4a')])});}}}_0x5dd311(parseEmail(_0x517db7,_0x3de1dc,_0x3e10a6));});}else{_0x3de1dc[_0x8dd3('0x17')]='

Empty\x20message

';_0x5dd311(parseEmail(_0x517db7,_0x3de1dc,_0x3e10a6));}}else{_0x5dd311(parseEmail(_0x517db7,_0x3de1dc,_0x3e10a6));}};exports[_0x8dd3('0x4b')]=function(_0xd57647,_0x46b327){var _0x457309=[_0x8dd3('0x4c')+(_0x46b327||''),_0x8dd3('0x4d')+_0xd57647,'',''];return Buffer[_0x8dd3('0x3b')](_0x457309['join'](''),'utf-8')['toString']('base64');}; \ No newline at end of file +var _0x45cd=['../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','message','originTo','email','isEmpty','originCc','bcc','attachments','attach','type','attachment-','%s-%s','now','join','server/files/attachments/','writeFileSync','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','lodash','moment','path','util','../../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x45cd,0x113));var _0xd45c=function(_0x137c7c,_0x3ad113){_0x137c7c=_0x137c7c-0x0;var _0xdfe7d5=_0x45cd[_0x137c7c];return _0xdfe7d5;};'use strict';var _=require(_0xd45c('0x0'));var moment=require(_0xd45c('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xd45c('0x2'));var util=require(_0xd45c('0x3'));var tnef=require('node-tnef');var logger=require(_0xd45c('0x4'))('email');var config=require(_0xd45c('0x5'));function getAddress(_0x34da63){var _0x375926=_[_0xd45c('0x6')](_0x34da63[_0xd45c('0x7')]);return _0x375926&&_0x375926['address']?_0x375926[_0xd45c('0x8')]:_0xd45c('0x9')+random[_0xd45c('0xa')](0x6)+_0xd45c('0xb');}function getFirstName(_0x4972fa){var _0x468170=_['head'](_0x4972fa[_0xd45c('0x7')]);if(_0x468170&&_0x468170[_0xd45c('0xc')]){if(_0x468170[_0xd45c('0xc')]==_0x468170['address']){return _0x468170[_0xd45c('0xc')][_0xd45c('0xd')](0x0,_0x468170[_0xd45c('0xc')][_0xd45c('0xe')]('@'));}var _0xd15acf=_0x468170['name'][_0xd45c('0xf')](/\s+/);return _0xd15acf[_0xd45c('0x10')]>0x1?_0xd15acf[_0xd45c('0x11')](0x0,-0x1)['join']('\x20'):_0x468170[_0xd45c('0xc')];}return _0xd45c('0x12');}function getLastName(_0x5ac23b){var _0x4963a4=_['head'](_0x5ac23b[_0xd45c('0x7')]);if(_0x4963a4&&_0x4963a4[_0xd45c('0xc')]){var _0x4c46f5=_0x4963a4[_0xd45c('0xc')][_0xd45c('0xf')](/\s+/);return _0x4c46f5[_0xd45c('0x10')]>0x1?_0x4c46f5[_0xd45c('0x13')]():'';}return'';}function getMails(_0xf47bb8,_0x4701fe){var _0x2393b4='';for(var _0x3a80bf=0x0;_0x3a80bf<_0x4701fe[_0xd45c('0x7')]['length'];_0x3a80bf+=0x1){if(_0x4701fe['value'][_0x3a80bf][_0xd45c('0x8')]!==_0xf47bb8){if(!_['isEmpty'](_0x2393b4)){_0x2393b4+=',';}_0x2393b4+=_0x4701fe[_0xd45c('0x7')][_0x3a80bf][_0xd45c('0xc')]||_0x4701fe['value'][_0x3a80bf]['address']||'';_0x2393b4+='\x20<';_0x2393b4+=_0x4701fe[_0xd45c('0x7')][_0x3a80bf][_0xd45c('0x8')]?_0x4701fe[_0xd45c('0x7')][_0x3a80bf][_0xd45c('0x8')]:'anonymous'+random[_0xd45c('0xa')](0x6)+_0xd45c('0xb');_0x2393b4+='>';}}return _0x2393b4;}function parseEmail(_0x212df,_0x1d86a7,_0x157050){if(_0x1d86a7['html']){var _0x235f9f=/)<[^<]*)*<\/script>/gi;while(_0x235f9f[_0xd45c('0x14')](_0x1d86a7[_0xd45c('0x15')])){_0x1d86a7['html']=_0x1d86a7['html'][_0xd45c('0x16')](_0x235f9f,'');}if(_0x1d86a7[_0xd45c('0x15')][_0xd45c('0x17')](_0xd45c('0x18'))){var _0x2a7016=[];_0x1d86a7['attachments'][_0xd45c('0x19')](_0x147058=>{_0x2a7016['push'](_0x147058[_0xd45c('0x1a')]);});var _0x209663=/]+>/g;var _0x3d869b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x226f16=_0x1d86a7[_0xd45c('0x15')][_0xd45c('0x16')](_0x3d869b,_0xd45c('0x1b'));var _0x29258b=_0x226f16['replace'](_0x209663,_0xd45c('0x1c'));for(let _0x538d79=0x0;_0x538d79<_0x2a7016[_0xd45c('0x10')];_0x538d79++){var _0x4c5fb9=_0x29258b[_0xd45c('0x16')](_0xd45c('0x1c'),_0xd45c('0x1d')+_0x2a7016[_0x538d79]+_0xd45c('0x1e'));_0x29258b=_0x4c5fb9;}_0x1d86a7[_0xd45c('0x15')]=_0x29258b;}_0x157050[_0xd45c('0x1f')]=_0x1d86a7[_0xd45c('0x15')];}else{_0x157050[_0xd45c('0x1f')]=_0x1d86a7['textAsHtml'];}if(_0x157050[_0xd45c('0x1f')]){_0x157050[_0xd45c('0x1f')]=_0x157050['body'][_0xd45c('0x16')](/0x0){var _0x3fca27=[_0xd45c('0x32'),_0xd45c('0x33'),_0xd45c('0x34')];for(var _0xe97430=0x0;_0xe97430<_0x1d86a7[_0xd45c('0x31')][_0xd45c('0x10')];_0xe97430++){var _0x24b6ba=_[_0xd45c('0xe')](_0x3fca27,_0x1d86a7['headerLines'][_0xe97430][_0xd45c('0x35')]);if(_0x24b6ba>=0x0){_0x157050[_0xd45c('0x36')]=!![];}}}return _0x157050;}exports[_0xd45c('0x37')]=function(_0x41ea61,_0x2155e1,_0xcd3283){var _0x44e536={'from':getAddress(_0x2155e1['from']),'firstName':getFirstName(_0x2155e1[_0xd45c('0x38')]),'lastName':getLastName(_0x2155e1[_0xd45c('0x38')]),'mapKey':_0xd45c('0x22'),'message':{'from':getMails(_0x41ea61[_0xd45c('0x22')],_0x2155e1['from']),'to':_0x41ea61[_0xd45c('0x22')],'cc':'','subject':_0x2155e1[_0xd45c('0x39')]||'','messageId':_0x2155e1[_0xd45c('0x3a')],'inReplyTo':_0x2155e1['inReplyTo'],'sentAt':moment(_0x2155e1['date'])[_0xd45c('0x3b')](_0xd45c('0x3c')),'attach':![],'attachments':[]}};if(!_0x2155e1[_0xd45c('0x15')]&&!_0x2155e1[_0xd45c('0x3d')]){var _0x237803=_[_0xd45c('0x3e')](_0x2155e1['attachments'],{'contentType':'application/ms-tnef'});if(_0x237803[_0xd45c('0x10')]){logger['info'](util[_0xd45c('0x3b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2155e1[_0xd45c('0x3a')]));tnef[_0xd45c('0x3f')](_['first'](_0x237803)['content'],function(_0x2b4d59,_0x484c9c){if(_0x484c9c){_0x2155e1[_0xd45c('0x15')]=_0x484c9c[_0xd45c('0x40')]||_0xd45c('0x41');if(_0x484c9c[_0xd45c('0x42')]){for(var _0x1de545=0x0;_0x1de545<_0x484c9c[_0xd45c('0x42')][_0xd45c('0x10')];_0x1de545++){var _0x30b7a4=_0x484c9c[_0xd45c('0x42')][_0x1de545];_0x44e536[_0xd45c('0x20')][_0xd45c('0x26')]['push']({'filename':_0x30b7a4['Title'],'content':Buffer[_0xd45c('0x38')](_0x30b7a4[_0xd45c('0x43')])});}}}_0xcd3283(parseEmail(_0x41ea61,_0x2155e1,_0x44e536));});}else{_0x2155e1['html']=_0xd45c('0x41');_0xcd3283(parseEmail(_0x41ea61,_0x2155e1,_0x44e536));}}else{_0xcd3283(parseEmail(_0x41ea61,_0x2155e1,_0x44e536));}};exports[_0xd45c('0x44')]=function(_0x327b2a,_0x473341){var _0x2ce32d=[_0xd45c('0x45')+(_0x473341||''),'auth=Bearer\x20'+_0x327b2a,'',''];return Buffer[_0xd45c('0x38')](_0x2ce32d['join'](''),'utf-8')['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7a98827..47ac00f 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 _0x3650=['SERV','active','Imap','Smtp','exports','name','key'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3650,0x1a2));var _0x0365=function(_0xbd0232,_0x3ceacc){_0xbd0232=_0xbd0232-0x0;var _0x62262f=_0x3650[_0xbd0232];return _0x62262f;};'use strict';var _=require('lodash');function MailAccount(_0x1ee929){this['id']=_0x1ee929['id']||0x0;this['name']=_0x1ee929[_0x0365('0x0')]||'Service';this[_0x0365('0x1')]=_0x1ee929[_0x0365('0x1')]||_0x0365('0x2');this[_0x0365('0x3')]=_0x1ee929['active']||![];this[_0x0365('0x4')]=_0x1ee929[_0x0365('0x4')]||[];this[_0x0365('0x5')]=_0x1ee929['Smtp']||[];}module[_0x0365('0x6')]=MailAccount; \ No newline at end of file +var _0x4be2=['SERV','active','Imap','Smtp','exports','name'];(function(_0x48027e,_0x683fd5){var _0x95938a=function(_0x1618e3){while(--_0x1618e3){_0x48027e['push'](_0x48027e['shift']());}};_0x95938a(++_0x683fd5);}(_0x4be2,0x16d));var _0x24be=function(_0x506db2,_0x1ab1f3){_0x506db2=_0x506db2-0x0;var _0x2a2ad3=_0x4be2[_0x506db2];return _0x2a2ad3;};'use strict';var _=require('lodash');function MailAccount(_0x1e810d){this['id']=_0x1e810d['id']||0x0;this[_0x24be('0x0')]=_0x1e810d['name']||'Service';this['key']=_0x1e810d['key']||_0x24be('0x1');this[_0x24be('0x2')]=_0x1e810d['active']||![];this[_0x24be('0x3')]=_0x1e810d[_0x24be('0x3')]||[];this[_0x24be('0x4')]=_0x1e810d[_0x24be('0x4')]||[];}module[_0x24be('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9e25eed..738041a 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 _0xe529=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x83b5aa,_0x983f80){var _0x393ef8=function(_0x54191d){while(--_0x54191d){_0x83b5aa['push'](_0x83b5aa['shift']());}};_0x393ef8(++_0x983f80);}(_0xe529,0x147));var _0x9e52=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xe529[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x9e52('0x0'));var MailAccount=require(_0x9e52('0x1'));var Realtime=function(){this[_0x9e52('0x2')]={};};function freeIsNotKey(_0x2489b6,_0x40900c,_0x4d0bbf){var _0x10f0e4=_[_0x9e52('0x3')](_0x2489b6,function(_0x13fe8b,_0x43743e){return _0x13fe8b[_0x4d0bbf];});for(var _0x1051ba in _0x40900c){if(_0x40900c[_0x9e52('0x4')](_0x1051ba)){if(!_0x10f0e4[_0x1051ba]){delete _0x40900c[_0x1051ba];}}}}Realtime[_0x9e52('0x5')][_0x9e52('0x6')]=function(_0x22d7fe,_0x149985){for(var _0x529c0c in _0x149985){if(_0x22d7fe[_0x9e52('0x4')](_0x529c0c)){_0x22d7fe[_0x529c0c]=_0x149985[_0x529c0c];}}};Realtime[_0x9e52('0x5')]['initMailAccounts']=function(){var _0x126728=this;return function(_0x30064c){if(_0x30064c){freeIsNotKey(_0x30064c,_0x126728[_0x9e52('0x2')],'id');for(var _0x217ef1=0x0,_0x1e1648={},_0x2f9402={};_0x217ef1<_0x30064c[_0x9e52('0x7')];_0x217ef1+=0x1){_0x1e1648=_0x30064c[_0x217ef1];if(_['isUndefined'](_0x126728[_0x9e52('0x2')][_0x1e1648['id']])){_0x126728[_0x9e52('0x2')][_0x1e1648['id']]=new MailAccount(_0x1e1648);}else{_[_0x9e52('0x8')](_0x126728[_0x9e52('0x2')][_0x1e1648['id']],_0x1e1648);}}}return _0x126728[_0x9e52('0x2')];};};module[_0x9e52('0x9')]=Realtime; \ No newline at end of file +var _0x7bb9=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','isUndefined','merge','lodash'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x7bb9,0x12f));var _0x97bb=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7bb9[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x97bb('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x97bb('0x1')]={};};function freeIsNotKey(_0x5139bc,_0x5b7c57,_0x5e8fdf){var _0x46e3f6=_[_0x97bb('0x2')](_0x5139bc,function(_0x36967f,_0x147ab2){return _0x36967f[_0x5e8fdf];});for(var _0x227aa1 in _0x5b7c57){if(_0x5b7c57[_0x97bb('0x3')](_0x227aa1)){if(!_0x46e3f6[_0x227aa1]){delete _0x5b7c57[_0x227aa1];}}}}Realtime[_0x97bb('0x4')][_0x97bb('0x5')]=function(_0x2bab1e,_0xd3889b){for(var _0x32b37f in _0xd3889b){if(_0x2bab1e[_0x97bb('0x3')](_0x32b37f)){_0x2bab1e[_0x32b37f]=_0xd3889b[_0x32b37f];}}};Realtime[_0x97bb('0x4')]['initMailAccounts']=function(){var _0xfa44aa=this;return function(_0x19c246){if(_0x19c246){freeIsNotKey(_0x19c246,_0xfa44aa[_0x97bb('0x1')],'id');for(var _0x11805d=0x0,_0x155a8c={},_0x8d1ef5={};_0x11805d<_0x19c246['length'];_0x11805d+=0x1){_0x155a8c=_0x19c246[_0x11805d];if(_[_0x97bb('0x6')](_0xfa44aa[_0x97bb('0x1')][_0x155a8c['id']])){_0xfa44aa[_0x97bb('0x1')][_0x155a8c['id']]=new MailAccount(_0x155a8c);}else{_[_0x97bb('0x7')](_0xfa44aa['mailAccounts'][_0x155a8c['id']],_0x155a8c);}}}return _0xfa44aa['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index dc6a34f..0415f51 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 _0xe6e9=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','service','email','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type'];(function(_0x4beb56,_0x1939b6){var _0x2f30a9=function(_0xbf50cf){while(--_0xbf50cf){_0x4beb56['push'](_0x4beb56['shift']());}};_0x2f30a9(++_0x1939b6);}(_0xe6e9,0x182));var _0x9e6e=function(_0x1b3ecb,_0x5ab078){_0x1b3ecb=_0x1b3ecb-0x0;var _0x529680=_0xe6e9[_0x1b3ecb];return _0x529680;};'use strict';var client=require(_0x9e6e('0x0'));exports[_0x9e6e('0x1')]=function(){return function(){return client[_0x9e6e('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x9e6e('0x3'),_0x9e6e('0x4'),_0x9e6e('0x5'),_0x9e6e('0x6'),_0x9e6e('0x7'),'key',_0x9e6e('0x8'),_0x9e6e('0x9')],'raw':![],'include':[{'model':_0x9e6e('0xa'),'as':_0x9e6e('0xb'),'include':[{'model':_0x9e6e('0xc'),'attributes':['id','name',_0x9e6e('0x5'),_0x9e6e('0xd'),_0x9e6e('0xe')],'as':_0x9e6e('0xc')}]},{'model':_0x9e6e('0xf'),'as':_0x9e6e('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x9e6e('0x3'),_0x9e6e('0x5'),_0x9e6e('0xd'),_0x9e6e('0xe')],'as':'CloudProvider'}]}]},'log':_0x9e6e('0x11')});};};exports[_0x9e6e('0x12')]=function(_0x51bc20,_0x18d23c){return client[_0x9e6e('0x2')](_0x9e6e('0x13'),{'account':{'id':_0x51bc20},'body':_0x18d23c,'log':_0x9e6e('0x13')});}; \ No newline at end of file +var _0xc17b=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','TemplateId','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount'];(function(_0x2b3a3c,_0x1f7792){var _0xac6e2a=function(_0x379724){while(--_0x379724){_0x2b3a3c['push'](_0x2b3a3c['shift']());}};_0xac6e2a(++_0x1f7792);}(_0xc17b,0xa2));var _0xbc17=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xc17b[_0x24061a];return _0x82054e;};'use strict';var client=require(_0xbc17('0x0'));exports[_0xbc17('0x1')]=function(){return function(){return client[_0xbc17('0x2')](_0xbc17('0x3'),{'options':{'attributes':['id',_0xbc17('0x4'),_0xbc17('0x5'),_0xbc17('0x6'),_0xbc17('0x7'),_0xbc17('0x8'),'key',_0xbc17('0x9'),_0xbc17('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':_0xbc17('0xb'),'include':[{'model':_0xbc17('0xc'),'attributes':['id','name','service','type',_0xbc17('0xd')],'as':_0xbc17('0xc')}]},{'model':_0xbc17('0xe'),'as':_0xbc17('0xf'),'include':[{'model':_0xbc17('0xc'),'attributes':['id',_0xbc17('0x4'),_0xbc17('0x6'),_0xbc17('0x10'),_0xbc17('0xd')],'as':_0xbc17('0xc')}]}]},'log':_0xbc17('0x11')});};};exports[_0xbc17('0x12')]=function(_0x4f83ef,_0x3c1f05){return client[_0xbc17('0x2')](_0xbc17('0x13'),{'account':{'id':_0x4f83ef},'body':_0x3c1f05,'log':_0xbc17('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 23581a6..f33725f 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 _0x01dc=['ShowSetting','loginMailFrequency','GetSettings','../client','Request'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x01dc,0x9e));var _0xc01d=function(_0x302f88,_0x1f9b28){_0x302f88=_0x302f88-0x0;var _0x29ef30=_0x01dc[_0x302f88];return _0x29ef30;};'use strict';var client=require(_0xc01d('0x0'));exports['getSettings']=function(){return client[_0xc01d('0x1')](_0xc01d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc01d('0x3')]},'log':_0xc01d('0x4')});}; \ No newline at end of file +var _0xba0d=['ShowSetting','GetSettings','../client','getSettings'];(function(_0x1a11bc,_0x4358ec){var _0x2de5f7=function(_0x4ea866){while(--_0x4ea866){_0x1a11bc['push'](_0x1a11bc['shift']());}};_0x2de5f7(++_0x4358ec);}(_0xba0d,0x13a));var _0xdba0=function(_0x35e54e,_0x5d4195){_0x35e54e=_0x35e54e-0x0;var _0x2ab9a7=_0xba0d[_0x35e54e];return _0x2ab9a7;};'use strict';var client=require(_0xdba0('0x0'));exports[_0xdba0('0x1')]=function(){return client['Request'](_0xdba0('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xdba0('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 5e4ad8f..ceb9261 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(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 a1896ff..c5f41bb 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 _0x0e5d=['../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis'];(function(_0x32c798,_0xd2fe15){var _0x429dbf=function(_0x26c7ea){while(--_0x26c7ea){_0x32c798['push'](_0x32c798['shift']());}};_0x429dbf(++_0xd2fe15);}(_0x0e5d,0xbe));var _0xd0e5=function(_0x2cade1,_0x2631ab){_0x2cade1=_0x2cade1-0x0;var _0x5a8215=_0x0e5d[_0x2cade1];return _0x5a8215;};'use strict';var _=require(_0xd0e5('0x0'));var http=require(_0xd0e5('0x1'));var express=require(_0xd0e5('0x2'));var sticky=require(_0xd0e5('0x3'));var Redis=require(_0xd0e5('0x4'));var config=require(_0xd0e5('0x5'));var app=express();var server=http[_0xd0e5('0x6')](app);server[_0xd0e5('0x7')]=0xdbba0;if(sticky[_0xd0e5('0x8')](server,config[_0xd0e5('0x9')])){var socketio=require(_0xd0e5('0xa'))(server,{'transports':[_0xd0e5('0xb'),_0xd0e5('0xc')]});config[_0xd0e5('0xd')]=_[_0xd0e5('0xe')](config[_0xd0e5('0xd')],{'host':_0xd0e5('0xf'),'port':0x18eb});socketio[_0xd0e5('0x10')](require(_0xd0e5('0x11'))({'pubClient':new Redis(config[_0xd0e5('0xd')]),'subClient':new Redis(config[_0xd0e5('0xd')])}));require(_0xd0e5('0x12'))[_0xd0e5('0x13')]();require(_0xd0e5('0x14'))['default'](socketio);require(_0xd0e5('0x15'))['default'](app);require(_0xd0e5('0x16'))['default'](app);}else{server[_0xd0e5('0x17')](_0xd0e5('0x18'),function(){console['log'](_0xd0e5('0x19'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x8fa8=['localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis'];(function(_0x59a159,_0x10e263){var _0x4ada34=function(_0x8d729d){while(--_0x8d729d){_0x59a159['push'](_0x59a159['shift']());}};_0x4ada34(++_0x10e263);}(_0x8fa8,0x1c1));var _0x88fa=function(_0x482d42,_0x17681a){_0x482d42=_0x482d42-0x0;var _0x293866=_0x8fa8[_0x482d42];return _0x293866;};'use strict';var _=require(_0x88fa('0x0'));var http=require(_0x88fa('0x1'));var express=require(_0x88fa('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x88fa('0x3'));var app=express();var server=http[_0x88fa('0x4')](app);server[_0x88fa('0x5')]=0xdbba0;if(sticky[_0x88fa('0x6')](server,config[_0x88fa('0x7')])){var socketio=require(_0x88fa('0x8'))(server,{'transports':['websocket',_0x88fa('0x9')]});config['redis']=_['defaults'](config[_0x88fa('0xa')],{'host':_0x88fa('0xb'),'port':0x18eb});socketio['adapter'](require(_0x88fa('0xc'))({'pubClient':new Redis(config[_0x88fa('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x88fa('0xd'))[_0x88fa('0xe')]();require(_0x88fa('0xf'))[_0x88fa('0xe')](socketio);require(_0x88fa('0x10'))['default'](app);require('../../routes')[_0x88fa('0xe')](app);}else{server[_0x88fa('0x11')]('listening',function(){console[_0x88fa('0x12')](_0x88fa('0x13'),config[_0x88fa('0x7')]);});}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 632f431..3dd25ff 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 _0x9540=['rpc','jayson/promise','../../config/logger','http','Request','request','then','debug','routing','message','error','catch'];(function(_0x1366e3,_0x226913){var _0x1e1420=function(_0x10eeba){while(--_0x10eeba){_0x1366e3['push'](_0x1366e3['shift']());}};_0x1e1420(++_0x226913);}(_0x9540,0xb5));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x0954('0x0'));var BPromise=require('bluebird');var logger=require(_0x0954('0x1'))('routing');var client=jayson['client'][_0x0954('0x2')]({'port':0x2329});client[_0x0954('0x3')]=function(_0x1da823,_0x5219f9){return new BPromise(function(_0x56aebc,_0x56772d){return client[_0x0954('0x4')](_0x1da823,_0x5219f9)[_0x0954('0x5')](function(_0x4ae427){logger[_0x0954('0x6')]('rpc',_0x0954('0x7'),_0x1da823,_0x5219f9,_0x4ae427);if(_0x4ae427['error']){logger['error']('rpc',_0x0954('0x7'),_0x1da823,_0x4ae427['error'][_0x0954('0x8')],_0x5219f9);return _0x56772d(_0x4ae427[_0x0954('0x9')][_0x0954('0x8')]);}else{return _0x56aebc(_0x4ae427['result']);}})[_0x0954('0xa')](function(_0x5b97cd){logger[_0x0954('0x9')](_0x0954('0xb'),'routing',_0x1da823,_0x5b97cd,_0x5219f9);return _0x56772d(_0x5b97cd);});});};module['exports']=client; \ No newline at end of file +var _0x316e=['Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','routing','client','http'];(function(_0x4ea800,_0x41664d){var _0x1516f6=function(_0x1a09e6){while(--_0x1a09e6){_0x4ea800['push'](_0x4ea800['shift']());}};_0x1516f6(++_0x41664d);}(_0x316e,0x176));var _0xe316=function(_0x114b54,_0x3ed9bb){_0x114b54=_0x114b54-0x0;var _0x21c37f=_0x316e[_0x114b54];return _0x21c37f;};'use strict';var jayson=require(_0xe316('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xe316('0x1'));var client=jayson[_0xe316('0x2')][_0xe316('0x3')]({'port':0x2329});client[_0xe316('0x4')]=function(_0x2694a7,_0x125089){return new BPromise(function(_0x3b6330,_0x1327ba){return client[_0xe316('0x5')](_0x2694a7,_0x125089)[_0xe316('0x6')](function(_0x59b228){logger[_0xe316('0x7')](_0xe316('0x8'),'routing',_0x2694a7,_0x125089,_0x59b228);if(_0x59b228[_0xe316('0x9')]){logger[_0xe316('0x9')]('rpc',_0xe316('0x1'),_0x2694a7,_0x59b228[_0xe316('0x9')][_0xe316('0xa')],_0x125089);return _0x1327ba(_0x59b228[_0xe316('0x9')][_0xe316('0xa')]);}else{return _0x3b6330(_0x59b228[_0xe316('0xb')]);}})[_0xe316('0xc')](function(_0x19735d){logger['error']('rpc',_0xe316('0x1'),_0x2694a7,_0x19735d,_0x125089);return _0x1327ba(_0x19735d);});});};module[_0xe316('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7071cda..13cbefa 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 _0xd20d=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initIntervals','getOpenchannelQueues'];(function(_0x5e8933,_0x5922d1){var _0x535c89=function(_0x554961){while(--_0x554961){_0x5e8933['push'](_0x5e8933['shift']());}};_0x535c89(++_0x5922d1);}(_0xd20d,0xb2));var _0xdd20=function(_0x11b0db,_0x3e2bc0){_0x11b0db=_0x11b0db-0x0;var _0x35c857=_0xd20d[_0x11b0db];return _0x35c857;};'use strict';var BPromise=require(_0xdd20('0x0'));var server=require('./server');var Realtime=require(_0xdd20('0x1'));var user=require(_0xdd20('0x2'));var interval=require(_0xdd20('0x3'));var openchannelQueue=require(_0xdd20('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xdd20('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xdd20('0x6'));var whatsappQueue=require(_0xdd20('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xdd20('0x8')](user['getAgents']())['then'](realtime['initAgents']())['then'](interval['getIntervals']())[_0xdd20('0x8')](realtime[_0xdd20('0x9')]())[_0xdd20('0x8')](openchannelQueue[_0xdd20('0xa')]())[_0xdd20('0x8')](realtime['initOpenchannelQueues']())[_0xdd20('0x8')](chatQueue[_0xdd20('0xb')]())['then'](realtime[_0xdd20('0xc')]())[_0xdd20('0x8')](smsQueue[_0xdd20('0xd')]())['then'](realtime[_0xdd20('0xe')]())[_0xdd20('0x8')](mailQueue[_0xdd20('0xf')]())[_0xdd20('0x8')](realtime[_0xdd20('0x10')]())[_0xdd20('0x8')](faxQueue['getFaxQueues']())[_0xdd20('0x8')](realtime[_0xdd20('0x11')]())[_0xdd20('0x8')](whatsappQueue['getWhatsappQueues']())[_0xdd20('0x8')](realtime[_0xdd20('0x12')]())[_0xdd20('0x8')](function(){return realtime;});}function main(){return server[_0xdd20('0x13')](realtime)['then'](function(_0x275361){return initRealtime();})[_0xdd20('0x8')](function(_0x514e16){return setInterval(initRealtime,0x1388);})['catch'](function(_0x382428){console[_0xdd20('0x14')](_0x382428);});}main(); \ No newline at end of file +var _0x2c75=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x1958a8,_0x105c54){var _0x4620fe=function(_0x477885){while(--_0x477885){_0x1958a8['push'](_0x1958a8['shift']());}};_0x4620fe(++_0x105c54);}(_0x2c75,0x159));var _0x52c7=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x2c75[_0xd7b0a4];return _0x184e9e;};'use strict';var BPromise=require('bluebird');var server=require(_0x52c7('0x0'));var Realtime=require(_0x52c7('0x1'));var user=require('./rpc/user');var interval=require(_0x52c7('0x2'));var openchannelQueue=require(_0x52c7('0x3'));var chatQueue=require(_0x52c7('0x4'));var smsQueue=require(_0x52c7('0x5'));var mailQueue=require(_0x52c7('0x6'));var faxQueue=require(_0x52c7('0x7'));var whatsappQueue=require(_0x52c7('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x52c7('0x9')]()[_0x52c7('0xa')](user[_0x52c7('0xb')]())[_0x52c7('0xa')](realtime[_0x52c7('0xc')]())['then'](interval[_0x52c7('0xd')]())[_0x52c7('0xa')](realtime[_0x52c7('0xe')]())[_0x52c7('0xa')](openchannelQueue[_0x52c7('0xf')]())[_0x52c7('0xa')](realtime['initOpenchannelQueues']())[_0x52c7('0xa')](chatQueue['getChatQueues']())[_0x52c7('0xa')](realtime[_0x52c7('0x10')]())[_0x52c7('0xa')](smsQueue[_0x52c7('0x11')]())['then'](realtime[_0x52c7('0x12')]())['then'](mailQueue[_0x52c7('0x13')]())[_0x52c7('0xa')](realtime[_0x52c7('0x14')]())[_0x52c7('0xa')](faxQueue[_0x52c7('0x15')]())['then'](realtime[_0x52c7('0x16')]())['then'](whatsappQueue[_0x52c7('0x17')]())[_0x52c7('0xa')](realtime['initWhatsappQueues']())[_0x52c7('0xa')](function(){return realtime;});}function main(){return server[_0x52c7('0x18')](realtime)[_0x52c7('0xa')](function(_0x1e25c1){return initRealtime();})['then'](function(_0x3bd7e7){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2d9ef6){console[_0x52c7('0x19')](_0x2d9ef6);});}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 a607c09..d41c3d4 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x1261[_0x134192];return _0x3cd080;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x326f,0xd1));var _0xf326=function(_0x1d6064,_0x3ac4f8){_0x1d6064=_0x1d6064-0x0;var _0x548b8b=_0x326f[_0x1d6064];return _0x548b8b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 32a4edf..7ea7f74 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 _0xf904=['jayson/promise','client','request','then','error','message','result','catch','bluebird'];(function(_0x165a94,_0x3c7fc7){var _0x4fde96=function(_0x505319){while(--_0x505319){_0x165a94['push'](_0x165a94['shift']());}};_0x4fde96(++_0x3c7fc7);}(_0xf904,0x155));var _0x4f90=function(_0x13c1ec,_0x31fe45){_0x13c1ec=_0x13c1ec-0x0;var _0x3df630=_0xf904[_0x13c1ec];return _0x3df630;};'use strict';var BPromise=require(_0x4f90('0x0'));var jayson=require(_0x4f90('0x1'));var client=jayson[_0x4f90('0x2')]['http']({'port':0x232b});function request(_0x2523a7,_0x23751f){return new BPromise(function(_0x491d87,_0x1c113f){return client[_0x4f90('0x3')](_0x2523a7,_0x23751f)[_0x4f90('0x4')](function(_0x46fb2d){if(_0x46fb2d[_0x4f90('0x5')]){return _0x1c113f(_0x46fb2d[_0x4f90('0x5')][_0x4f90('0x6')]);}else{return _0x491d87(_0x46fb2d[_0x4f90('0x7')]);}})[_0x4f90('0x8')](function(_0x1bc20d){return _0x1c113f(_0x1bc20d);});});}exports['sendMailMessage']=function(_0x56d4fb,_0x52de39){return request('SendMail',{'account':_0x56d4fb,'message':_0x52de39});}; \ No newline at end of file +var _0x045d=['error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x4026d1,_0x53f826){var _0x4f978e=function(_0x1dd9f){while(--_0x1dd9f){_0x4026d1['push'](_0x4026d1['shift']());}};_0x4f978e(++_0x53f826);}(_0x045d,0x145));var _0xd045=function(_0x564393,_0x277b91){_0x564393=_0x564393-0x0;var _0x3c8e60=_0x045d[_0x564393];return _0x3c8e60;};'use strict';var BPromise=require(_0xd045('0x0'));var jayson=require(_0xd045('0x1'));var client=jayson[_0xd045('0x2')][_0xd045('0x3')]({'port':0x232b});function request(_0x3e23a3,_0x39b281){return new BPromise(function(_0x4b246c,_0x457775){return client[_0xd045('0x4')](_0x3e23a3,_0x39b281)['then'](function(_0x120ea7){if(_0x120ea7[_0xd045('0x5')]){return _0x457775(_0x120ea7[_0xd045('0x5')][_0xd045('0x6')]);}else{return _0x4b246c(_0x120ea7[_0xd045('0x7')]);}})[_0xd045('0x8')](function(_0x2ea39e){return _0x457775(_0x2ea39e);});});}exports[_0xd045('0x9')]=function(_0x2067ed,_0x15822e){return request(_0xd045('0xa'),{'account':_0x2067ed,'message':_0x15822e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a1d99c5..588025e 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 _0x5204=['working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','format','Status','faxStatusTime','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity'];(function(_0x231edb,_0x1367a2){var _0x487fb0=function(_0x5444de){while(--_0x5444de){_0x231edb['push'](_0x231edb['shift']());}};_0x487fb0(++_0x1367a2);}(_0x5204,0xdf));var _0x4520=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x5204[_0x330723];return _0x60c546;};'use strict';var _=require(_0x4520('0x0'));var md5=require(_0x4520('0x1'));var moment=require('moment');var Redis=require(_0x4520('0x2'));var config=require(_0x4520('0x3'));config[_0x4520('0x4')]=_[_0x4520('0x5')](config[_0x4520('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4520('0x6'))(new Redis(config['redis']));function Agent(_0x180174){this['id']=_0x180174['id']||0x0;this[_0x4520('0x7')]=_0x180174[_0x4520('0x7')]||'';this[_0x4520('0x8')]=_0x180174[_0x4520('0x8')]||!![];this[_0x4520('0x9')]=_0x180174[_0x4520('0x9')]||![];this['chatPause']=_0x180174[_0x4520('0xa')]||![];this['mailPause']=_0x180174[_0x4520('0xb')]||![];this[_0x4520('0xc')]=_0x180174[_0x4520('0xc')]||![];this[_0x4520('0xd')]=_0x180174[_0x4520('0xd')]||![];this[_0x4520('0xe')]=_0x180174[_0x4520('0xe')]||![];this[_0x4520('0xf')]=_0x4520('0x10');this[_0x4520('0x11')]=0x0;this[_0x4520('0x12')]=_0x180174[_0x4520('0x12')]||0x0;this[_0x4520('0x13')]=0x0;this[_0x4520('0x14')]=_0x4520('0x10');this[_0x4520('0x15')]=0x0;this[_0x4520('0x16')]=_0x180174[_0x4520('0x16')]||0x0;this[_0x4520('0x17')]=0x0;this[_0x4520('0x18')]=_0x4520('0x10');this['faxStatusTime']=0x0;this[_0x4520('0x19')]=_0x180174[_0x4520('0x19')]||0x0;this[_0x4520('0x1a')]=0x0;this[_0x4520('0x1b')]=_0x4520('0x10');this['smsStatusTime']=0x0;this[_0x4520('0x1c')]=_0x180174[_0x4520('0x1c')]||0x0;this[_0x4520('0x1d')]=0x0;this[_0x4520('0x1e')]=_0x4520('0x10');this[_0x4520('0x1f')]=0x0;this[_0x4520('0x20')]=_0x180174[_0x4520('0x20')]||0x0;this[_0x4520('0x21')]=0x0;this[_0x4520('0x22')]=_0x4520('0x10');this[_0x4520('0x23')]=0x0;this['openchannelCapacity']=_0x180174[_0x4520('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x4520('0x1')]='';this['chatWaitingInteractions']={};this[_0x4520('0x25')]={};this[_0x4520('0x26')]={};this[_0x4520('0x27')]={};this['smsWaitingInteractions']={};this[_0x4520('0x28')]={};this[_0x4520('0x29')]();}Agent[_0x4520('0x2a')]['getChannelStatus']=function(_0x198c34){if(this[_0x198c34+_0x4520('0x2b')]>0x0){if(this[_0x198c34+_0x4520('0x2c')]>0x0&&this[_0x198c34+_0x4520('0x2b')]>=this[_0x198c34+_0x4520('0x2c')]){return'maxcapacity';}else{return _0x4520('0x2d');}}else{return _0x4520('0x2e');}};Agent[_0x4520('0x2a')][_0x4520('0x29')]=function(){var _0x57306b=[_0x4520('0x2f'),_0x4520('0x30'),_0x4520('0x31'),_0x4520('0x32'),_0x4520('0x33'),_0x4520('0x34')];for(var _0x2d6902=0x0;_0x2d6902<_0x57306b[_0x4520('0x35')];_0x2d6902+=0x1){var _0x180c44=this[_0x4520('0x36')](_0x57306b[_0x2d6902]);if(this[_0x57306b[_0x2d6902]+'Status']!==_0x180c44){this[_0x57306b[_0x2d6902]+_0x4520('0x37')]=_['toNumber'](moment()[_0x4520('0x38')]('x'));}this[_0x57306b[_0x2d6902]+_0x4520('0x39')]=_0x180c44;}var _0x43b4a2={'id':this['id'],'name':this[_0x4520('0x7')],'online':this[_0x4520('0x8')],'voicePause':this[_0x4520('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x4520('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x4520('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4520('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4520('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4520('0x15')],'mailCapacity':this[_0x4520('0x16')],'mailCurrentCapacity':this[_0x4520('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4520('0x3a')],'faxCapacity':this[_0x4520('0x19')],'faxCurrentCapacity':this[_0x4520('0x1a')],'smsStatus':this[_0x4520('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4520('0x1d')],'whatsappStatus':this[_0x4520('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4520('0x20')],'whatsappCurrentCapacity':this[_0x4520('0x21')],'openchannelStatus':this[_0x4520('0x22')],'openchannelStatusTime':this[_0x4520('0x23')],'openchannelCapacity':this[_0x4520('0x24')],'openchannelCurrentCapacity':this[_0x4520('0x3b')],'busy':this['busy'],'busyQueue':this[_0x4520('0x3c')],'chatWaitingInteractions':this[_0x4520('0x3d')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x4520('0x26')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x4520('0x3e')],'whatsappWaitingInteractions':this[_0x4520('0x28')]};var _0x4f2dc4=md5(JSON['stringify'](_0x43b4a2));if(this['md5']!==_0x4f2dc4){this[_0x4520('0x1')]=_0x4f2dc4;io[_0x4520('0x3f')](_0x4520('0x40'),_[_0x4520('0x41')](_0x43b4a2,[_0x4520('0x8')]));}};module[_0x4520('0x42')]=Agent; \ No newline at end of file +var _0x25e7=['exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','chat','openchannel','sms','whatsapp','length','Status','toNumber','chatStatus','chatCapacity','mailCurrentCapacity','smsStatus','whatsappCurrentCapacity','busy','stringify','emit','user:routing:update','omit'];(function(_0x2c3898,_0x53388c){var _0x5222ac=function(_0x5c8bbd){while(--_0x5c8bbd){_0x2c3898['push'](_0x2c3898['shift']());}};_0x5222ac(++_0x53388c);}(_0x25e7,0x1d6));var _0x725e=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0x25e7[_0x32986];return _0x355ebb;};'use strict';var _=require(_0x725e('0x0'));var md5=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var Redis=require(_0x725e('0x3'));var config=require(_0x725e('0x4'));config[_0x725e('0x5')]=_[_0x725e('0x6')](config[_0x725e('0x5')],{'host':_0x725e('0x7'),'port':0x18eb});var io=require(_0x725e('0x8'))(new Redis(config['redis']));function Agent(_0x5e17a9){this['id']=_0x5e17a9['id']||0x0;this[_0x725e('0x9')]=_0x5e17a9['name']||'';this['online']=_0x5e17a9[_0x725e('0xa')]||!![];this[_0x725e('0xb')]=_0x5e17a9[_0x725e('0xb')]||![];this[_0x725e('0xc')]=_0x5e17a9[_0x725e('0xc')]||![];this[_0x725e('0xd')]=_0x5e17a9[_0x725e('0xd')]||![];this[_0x725e('0xe')]=_0x5e17a9[_0x725e('0xe')]||![];this[_0x725e('0xf')]=_0x5e17a9[_0x725e('0xf')]||![];this[_0x725e('0x10')]=_0x5e17a9['openchannelPause']||![];this['chatStatus']=_0x725e('0x11');this[_0x725e('0x12')]=0x0;this['chatCapacity']=_0x5e17a9['chatCapacity']||0x0;this[_0x725e('0x13')]=0x0;this[_0x725e('0x14')]='unknown';this[_0x725e('0x15')]=0x0;this[_0x725e('0x16')]=_0x5e17a9[_0x725e('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x725e('0x17')]=_0x725e('0x11');this[_0x725e('0x18')]=0x0;this[_0x725e('0x19')]=_0x5e17a9[_0x725e('0x19')]||0x0;this[_0x725e('0x1a')]=0x0;this['smsStatus']=_0x725e('0x11');this[_0x725e('0x1b')]=0x0;this[_0x725e('0x1c')]=_0x5e17a9['smsCapacity']||0x0;this[_0x725e('0x1d')]=0x0;this[_0x725e('0x1e')]=_0x725e('0x11');this[_0x725e('0x1f')]=0x0;this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x725e('0x21')]=_0x725e('0x11');this[_0x725e('0x22')]=0x0;this[_0x725e('0x23')]=_0x5e17a9[_0x725e('0x23')]||0x0;this[_0x725e('0x24')]=0x0;this['busy']=![];this[_0x725e('0x25')]=undefined;this[_0x725e('0x1')]='';this[_0x725e('0x26')]={};this[_0x725e('0x27')]={};this[_0x725e('0x28')]={};this[_0x725e('0x29')]={};this[_0x725e('0x2a')]={};this[_0x725e('0x2b')]={};this[_0x725e('0x2c')]();}Agent['prototype'][_0x725e('0x2d')]=function(_0x36cbab){if(this[_0x36cbab+_0x725e('0x2e')]>0x0){if(this[_0x36cbab+_0x725e('0x2f')]>0x0&&this[_0x36cbab+'CurrentCapacity']>=this[_0x36cbab+_0x725e('0x2f')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x725e('0x30')][_0x725e('0x2c')]=function(){var _0x2d3c55=['mail',_0x725e('0x31'),_0x725e('0x32'),'fax',_0x725e('0x33'),_0x725e('0x34')];for(var _0x4b0d0c=0x0;_0x4b0d0c<_0x2d3c55[_0x725e('0x35')];_0x4b0d0c+=0x1){var _0x5daa2d=this['getChannelStatus'](_0x2d3c55[_0x4b0d0c]);if(this[_0x2d3c55[_0x4b0d0c]+_0x725e('0x36')]!==_0x5daa2d){this[_0x2d3c55[_0x4b0d0c]+'StatusTime']=_[_0x725e('0x37')](moment()['format']('x'));}this[_0x2d3c55[_0x4b0d0c]+'Status']=_0x5daa2d;}var _0x9b5b7f={'id':this['id'],'name':this[_0x725e('0x9')],'online':this[_0x725e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x725e('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x725e('0xf')],'faxPause':this[_0x725e('0xe')],'openchannelPause':this[_0x725e('0x10')],'chatStatus':this[_0x725e('0x38')],'chatStatusTime':this[_0x725e('0x12')],'chatCapacity':this[_0x725e('0x39')],'chatCurrentCapacity':this[_0x725e('0x13')],'mailStatus':this[_0x725e('0x14')],'mailStatusTime':this[_0x725e('0x15')],'mailCapacity':this[_0x725e('0x16')],'mailCurrentCapacity':this[_0x725e('0x3a')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x725e('0x18')],'faxCapacity':this[_0x725e('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x725e('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x725e('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x725e('0x1e')],'whatsappStatusTime':this[_0x725e('0x1f')],'whatsappCapacity':this[_0x725e('0x20')],'whatsappCurrentCapacity':this[_0x725e('0x3c')],'openchannelStatus':this[_0x725e('0x21')],'openchannelStatusTime':this[_0x725e('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x725e('0x3d')],'busyQueue':this[_0x725e('0x25')],'chatWaitingInteractions':this[_0x725e('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x725e('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x725e('0x2a')],'whatsappWaitingInteractions':this[_0x725e('0x2b')]};var _0x386636=md5(JSON[_0x725e('0x3e')](_0x9b5b7f));if(this['md5']!==_0x386636){this['md5']=_0x386636;io[_0x725e('0x3f')](_0x725e('0x40'),_[_0x725e('0x41')](_0x9b5b7f,['online']));}};module[_0x725e('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a2ef8ca..a4853bc 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 _0x5ce5=['stringify','format','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','paused','length','loggedIn','available'];(function(_0x19294e,_0x3eb1d2){var _0x42ccc4=function(_0x5533e6){while(--_0x5533e6){_0x19294e['push'](_0x19294e['shift']());}};_0x42ccc4(++_0x3eb1d2);}(_0x5ce5,0x199));var _0x55ce=function(_0x507b9f,_0x47e9d4){_0x507b9f=_0x507b9f-0x0;var _0x526049=_0x5ce5[_0x507b9f];return _0x526049;};'use strict';var _=require(_0x55ce('0x0'));var md5=require(_0x55ce('0x1'));var util=require(_0x55ce('0x2'));var Redis=require('ioredis');var config=require(_0x55ce('0x3'));config['redis']=_[_0x55ce('0x4')](config[_0x55ce('0x5')],{'host':_0x55ce('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x55ce('0x5')]));function ChatQueue(_0x3625a1){this['id']=_0x3625a1['id']||0x0;this[_0x55ce('0x7')]=_0x3625a1[_0x55ce('0x7')]||'';this[_0x55ce('0x8')]=_0x3625a1['timeout']||0xa;this[_0x55ce('0x9')]=_0x3625a1[_0x55ce('0x9')]||_0x55ce('0xa');this['Agents']=_0x3625a1[_0x55ce('0xb')];this[_0x55ce('0xc')]={};this[_0x55ce('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue['prototype'][_0x55ce('0xe')]=function(){var _0x8bea63=this[_0x55ce('0xc')][_0x55ce('0xf')];this[_0x55ce('0xc')]=_[_0x55ce('0x10')](this[_0x55ce('0xb')],'id');this[_0x55ce('0xc')][_0x55ce('0xf')]=_0x8bea63;};ChatQueue[_0x55ce('0x11')][_0x55ce('0x12')]=function(){this['loggedIn']=0x0;this[_0x55ce('0x13')]=0x0;for(var _0x26697f=0x0;_0x26697f=0x0?this[_0x55ce('0x16')]:0x0;var _0x18f732={'id':this['id'],'available':this[_0x55ce('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x55ce('0x7')],'paused':this[_0x55ce('0x13')],'waiting':this[_0x55ce('0xd')]};var _0x4c3dd0=md5(JSON[_0x55ce('0x17')](_0x18f732));if(this[_0x55ce('0x1')]!==_0x4c3dd0){this[_0x55ce('0x1')]=_0x4c3dd0;io['to'](util[_0x55ce('0x18')]('chat:queue:%s',_0x18f732[_0x55ce('0x7')]))[_0x55ce('0x19')]('chat_queue:save',_0x18f732);}};module[_0x55ce('0x1a')]=ChatQueue; \ No newline at end of file +var _0x2bfa=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util'];(function(_0x8c78,_0x3b91c2){var _0x384510=function(_0x92d7a2){while(--_0x92d7a2){_0x8c78['push'](_0x8c78['shift']());}};_0x384510(++_0x3b91c2);}(_0x2bfa,0x1be));var _0xa2bf=function(_0x370204,_0x4d9e56){_0x370204=_0x370204-0x0;var _0x11b59c=_0x2bfa[_0x370204];return _0x11b59c;};'use strict';var _=require(_0xa2bf('0x0'));var md5=require('md5');var util=require(_0xa2bf('0x1'));var Redis=require(_0xa2bf('0x2'));var config=require(_0xa2bf('0x3'));config[_0xa2bf('0x4')]=_[_0xa2bf('0x5')](config[_0xa2bf('0x4')],{'host':_0xa2bf('0x6'),'port':0x18eb});var io=require(_0xa2bf('0x7'))(new Redis(config[_0xa2bf('0x4')]));function ChatQueue(_0x3c987d){this['id']=_0x3c987d['id']||0x0;this[_0xa2bf('0x8')]=_0x3c987d['name']||'';this[_0xa2bf('0x9')]=_0x3c987d[_0xa2bf('0x9')]||0xa;this[_0xa2bf('0xa')]=_0x3c987d[_0xa2bf('0xa')]||_0xa2bf('0xb');this[_0xa2bf('0xc')]=_0x3c987d[_0xa2bf('0xc')];this[_0xa2bf('0xd')]={};this[_0xa2bf('0xe')]=0x0;this['md5']='';this[_0xa2bf('0xf')]();this['updateRealtime']();}ChatQueue[_0xa2bf('0x10')]['updateRouting']=function(){var _0x110cb0=this[_0xa2bf('0xd')]['_rr'];this['mapAgentsId']=_[_0xa2bf('0x11')](this[_0xa2bf('0xc')],'id');this[_0xa2bf('0xd')][_0xa2bf('0x12')]=_0x110cb0;};ChatQueue[_0xa2bf('0x10')]['updateRealtime']=function(){this[_0xa2bf('0x13')]=0x0;this[_0xa2bf('0x14')]=0x0;for(var _0x21ff8a=0x0;_0x21ff8a=0x0?this[_0xa2bf('0x18')]:0x0;var _0x1ac46d={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa2bf('0x8')],'paused':this[_0xa2bf('0x14')],'waiting':this[_0xa2bf('0xe')]};var _0x49a52e=md5(JSON[_0xa2bf('0x19')](_0x1ac46d));if(this[_0xa2bf('0x1a')]!==_0x49a52e){this['md5']=_0x49a52e;io['to'](util[_0xa2bf('0x1b')](_0xa2bf('0x1c'),_0x1ac46d[_0xa2bf('0x8')]))[_0xa2bf('0x1d')](_0xa2bf('0x1e'),_0x1ac46d);}};module[_0xa2bf('0x1f')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fc925c4..84eee32 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 _0xc6f9=['faxPause','paused','available','waiting','stringify','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online'];(function(_0x8262e5,_0x272c5f){var _0x7ba3ef=function(_0x3b7fd1){while(--_0x3b7fd1){_0x8262e5['push'](_0x8262e5['shift']());}};_0x7ba3ef(++_0x272c5f);}(_0xc6f9,0x1bb));var _0x9c6f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc6f9[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9c6f('0x0'));var md5=require(_0x9c6f('0x1'));var util=require(_0x9c6f('0x2'));var Redis=require(_0x9c6f('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x9c6f('0x4')](config[_0x9c6f('0x5')],{'host':_0x9c6f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c6f('0x5')]));function FaxQueue(_0x323171){this['id']=_0x323171['id']||0x0;this[_0x9c6f('0x7')]=_0x323171[_0x9c6f('0x7')]||'';this[_0x9c6f('0x8')]=_0x323171[_0x9c6f('0x8')]||0xa;this[_0x9c6f('0x9')]=_0x323171[_0x9c6f('0x9')]||_0x9c6f('0xa');this[_0x9c6f('0xb')]=_0x323171['Agents'];this[_0x9c6f('0xc')]={};this['waiting']=0x0;this[_0x9c6f('0x1')]='';this[_0x9c6f('0xd')]();this[_0x9c6f('0xe')]();}FaxQueue[_0x9c6f('0xf')][_0x9c6f('0xd')]=function(){var _0x4c8028=this['mapAgentsId'][_0x9c6f('0x10')];this[_0x9c6f('0xc')]=_[_0x9c6f('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x4c8028;};FaxQueue[_0x9c6f('0xf')][_0x9c6f('0xe')]=function(){this[_0x9c6f('0x12')]=0x0;this['paused']=0x0;for(var _0x525527=0x0;_0x525527=0x0?this[_0x9c6f('0x17')]:0x0;var _0x403f5e={'id':this['id'],'available':this[_0x9c6f('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x9c6f('0x7')],'paused':this['paused'],'waiting':this[_0x9c6f('0x18')]};var _0xa4d2c9=md5(JSON[_0x9c6f('0x19')](_0x403f5e));if(this[_0x9c6f('0x1')]!==_0xa4d2c9){this[_0x9c6f('0x1')]=_0xa4d2c9;io['to'](util['format'](_0x9c6f('0x1a'),_0x403f5e[_0x9c6f('0x7')]))['emit'](_0x9c6f('0x1b'),_0x403f5e);}};module[_0x9c6f('0x1c')]=FaxQueue; \ No newline at end of file +var _0x5161=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','ioredis','redis','defaults','localhost','name','timeout'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5161,0xa6));var _0x1516=function(_0x1cc3c8,_0x32cafb){_0x1cc3c8=_0x1cc3c8-0x0;var _0x8a57d=_0x5161[_0x1cc3c8];return _0x8a57d;};'use strict';var _=require(_0x1516('0x0'));var md5=require(_0x1516('0x1'));var util=require('util');var Redis=require(_0x1516('0x2'));var config=require('../../../config/environment');config[_0x1516('0x3')]=_[_0x1516('0x4')](config['redis'],{'host':_0x1516('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1516('0x3')]));function FaxQueue(_0x4180c0){this['id']=_0x4180c0['id']||0x0;this[_0x1516('0x6')]=_0x4180c0[_0x1516('0x6')]||'';this['timeout']=_0x4180c0[_0x1516('0x7')]||0xa;this['strategy']=_0x4180c0[_0x1516('0x8')]||_0x1516('0x9');this[_0x1516('0xa')]=_0x4180c0[_0x1516('0xa')];this[_0x1516('0xb')]={};this[_0x1516('0xc')]=0x0;this[_0x1516('0x1')]='';this[_0x1516('0xd')]();this['updateRealtime']();}FaxQueue[_0x1516('0xe')][_0x1516('0xd')]=function(){var _0x3d049e=this['mapAgentsId'][_0x1516('0xf')];this[_0x1516('0xb')]=_[_0x1516('0x10')](this[_0x1516('0xa')],'id');this[_0x1516('0xb')]['_rr']=_0x3d049e;};FaxQueue[_0x1516('0xe')][_0x1516('0x11')]=function(){this[_0x1516('0x12')]=0x0;this['paused']=0x0;for(var _0x422a41=0x0;_0x422a41=0x0?this[_0x1516('0x17')]:0x0;var _0x1d19dd={'id':this['id'],'available':this[_0x1516('0x17')],'loggedIn':this[_0x1516('0x12')],'name':this[_0x1516('0x6')],'paused':this[_0x1516('0x16')],'waiting':this[_0x1516('0xc')]};var _0x4cbd39=md5(JSON[_0x1516('0x18')](_0x1d19dd));if(this[_0x1516('0x1')]!==_0x4cbd39){this[_0x1516('0x1')]=_0x4cbd39;io['to'](util[_0x1516('0x19')](_0x1516('0x1a'),_0x1d19dd[_0x1516('0x6')]))[_0x1516('0x1b')](_0x1516('0x1c'),_0x1d19dd);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b8fd3b9..6969ba1 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 _0x146f=['exports','name','Intervals'];(function(_0x4c7edb,_0x15a38b){var _0x3bd0cd=function(_0x1ba08e){while(--_0x1ba08e){_0x4c7edb['push'](_0x4c7edb['shift']());}};_0x3bd0cd(++_0x15a38b);}(_0x146f,0x1d5));var _0xf146=function(_0x446d10,_0x4a9444){_0x446d10=_0x446d10-0x0;var _0x2d6c4a=_0x146f[_0x446d10];return _0x2d6c4a;};'use strict';function Interval(_0x4552ba){this['id']=_0x4552ba['id']||0x0;this[_0xf146('0x0')]=_0x4552ba['name']||'';this[_0xf146('0x1')]=_0x4552ba[_0xf146('0x1')]||{};}module[_0xf146('0x2')]=Interval; \ No newline at end of file +var _0x0c55=['exports','name','Intervals'];(function(_0x572a97,_0xaa733e){var _0x8b7566=function(_0x2b8a3e){while(--_0x2b8a3e){_0x572a97['push'](_0x572a97['shift']());}};_0x8b7566(++_0xaa733e);}(_0x0c55,0x142));var _0x50c5=function(_0x23a3ce,_0xa2a9b4){_0x23a3ce=_0x23a3ce-0x0;var _0x4f759d=_0x0c55[_0x23a3ce];return _0x4f759d;};'use strict';function Interval(_0x3d270a){this['id']=_0x3d270a['id']||0x0;this['name']=_0x3d270a[_0x50c5('0x0')]||'';this[_0x50c5('0x1')]=_0x3d270a['Intervals']||{};}module[_0x50c5('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 63e4984..32636b8 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 _0x234c=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','map','Agents','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save'];(function(_0x4444dd,_0x1a6371){var _0xf67028=function(_0x102091){while(--_0x102091){_0x4444dd['push'](_0x4444dd['shift']());}};_0xf67028(++_0x1a6371);}(_0x234c,0x1e1));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc234('0x0'));var md5=require(_0xc234('0x1'));var util=require(_0xc234('0x2'));var Redis=require(_0xc234('0x3'));var config=require(_0xc234('0x4'));config[_0xc234('0x5')]=_[_0xc234('0x6')](config['redis'],{'host':_0xc234('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc234('0x5')]));function MailQueue(_0x3a11ce){this['id']=_0x3a11ce['id']||0x0;this[_0xc234('0x8')]=_0x3a11ce[_0xc234('0x8')]||'';this[_0xc234('0x9')]=_0x3a11ce['timeout']||0xa;this[_0xc234('0xa')]=_0x3a11ce[_0xc234('0xa')]||_0xc234('0xb');this['Agents']=_0x3a11ce['Agents'];this[_0xc234('0xc')]={};this[_0xc234('0xd')]=0x0;this[_0xc234('0x1')]='';this[_0xc234('0xe')]();this['updateRealtime']();}MailQueue[_0xc234('0xf')][_0xc234('0xe')]=function(){var _0x27486f=this[_0xc234('0xc')]['_rr'];this['mapAgentsId']=_[_0xc234('0x10')](this[_0xc234('0x11')],'id');this[_0xc234('0xc')]['_rr']=_0x27486f;};MailQueue[_0xc234('0xf')]['updateRealtime']=function(){this[_0xc234('0x12')]=0x0;this[_0xc234('0x13')]=0x0;for(var _0x191139=0x0;_0x191139=0x0?this[_0xc234('0x17')]:0x0;var _0x3398f6={'id':this['id'],'available':this[_0xc234('0x17')],'loggedIn':this[_0xc234('0x12')],'name':this[_0xc234('0x8')],'paused':this['paused'],'waiting':this[_0xc234('0xd')]};var _0x4a6ab1=md5(JSON[_0xc234('0x18')](_0x3398f6));if(this['md5']!==_0x4a6ab1){this[_0xc234('0x1')]=_0x4a6ab1;io['to'](util[_0xc234('0x19')](_0xc234('0x1a'),_0x3398f6['name']))[_0xc234('0x1b')](_0xc234('0x1c'),_0x3398f6);}};module[_0xc234('0x1d')]=MailQueue; \ No newline at end of file +var _0x499a=['md5','format','mail:queue:%s','emit','mail_queue:save','exports','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available'];(function(_0x1b6b1d,_0x43c612){var _0x561b90=function(_0xc393f8){while(--_0xc393f8){_0x1b6b1d['push'](_0x1b6b1d['shift']());}};_0x561b90(++_0x43c612);}(_0x499a,0xb4));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xa499('0x0'));var Redis=require(_0xa499('0x1'));var config=require('../../../config/environment');config[_0xa499('0x2')]=_[_0xa499('0x3')](config[_0xa499('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xa499('0x4'))(new Redis(config[_0xa499('0x2')]));function MailQueue(_0x4d140f){this['id']=_0x4d140f['id']||0x0;this['name']=_0x4d140f[_0xa499('0x5')]||'';this[_0xa499('0x6')]=_0x4d140f[_0xa499('0x6')]||0xa;this[_0xa499('0x7')]=_0x4d140f[_0xa499('0x7')]||_0xa499('0x8');this[_0xa499('0x9')]=_0x4d140f[_0xa499('0x9')];this[_0xa499('0xa')]={};this[_0xa499('0xb')]=0x0;this['md5']='';this[_0xa499('0xc')]();this[_0xa499('0xd')]();}MailQueue[_0xa499('0xe')]['updateRouting']=function(){var _0x5bbaed=this[_0xa499('0xa')][_0xa499('0xf')];this['mapAgentsId']=_[_0xa499('0x10')](this['Agents'],'id');this[_0xa499('0xa')][_0xa499('0xf')]=_0x5bbaed;};MailQueue[_0xa499('0xe')][_0xa499('0xd')]=function(){this[_0xa499('0x11')]=0x0;this[_0xa499('0x12')]=0x0;for(var _0x340b6f=0x0;_0x340b6f=0x0?this[_0xa499('0x16')]:0x0;var _0xf57e5={'id':this['id'],'available':this[_0xa499('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xa499('0x12')],'waiting':this[_0xa499('0xb')]};var _0x123f2c=md5(JSON['stringify'](_0xf57e5));if(this[_0xa499('0x17')]!==_0x123f2c){this['md5']=_0x123f2c;io['to'](util[_0xa499('0x18')](_0xa499('0x19'),_0xf57e5[_0xa499('0x5')]))[_0xa499('0x1a')](_0xa499('0x1b'),_0xf57e5);}};module[_0xa499('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1ac0357..de983df 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7a54,0x106));var _0x47a5=function(_0x303820,_0x563a0b){_0x303820=_0x303820-0x0;var _0x4a57e4=_0x7a54[_0x303820];return _0x4a57e4;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x5fc3,0xa8));var _0x35fc=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x5fc3[_0x402c8f];return _0x11e809;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5c73b1a..79243ec 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 _0xb717=['updateRouting','updateRealtime','map','_rr','paused','length','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0xb717,0x1b4));var _0x7b71=function(_0x22d8dd,_0x26990b){_0x22d8dd=_0x22d8dd-0x0;var _0x35fd45=_0xb717[_0x22d8dd];return _0x35fd45;};'use strict';var _=require(_0x7b71('0x0'));var md5=require('md5');var util=require(_0x7b71('0x1'));var Redis=require('ioredis');var config=require(_0x7b71('0x2'));config[_0x7b71('0x3')]=_[_0x7b71('0x4')](config['redis'],{'host':_0x7b71('0x5'),'port':0x18eb});var io=require(_0x7b71('0x6'))(new Redis(config[_0x7b71('0x3')]));function SmsQueue(_0x26044f){this['id']=_0x26044f['id']||0x0;this[_0x7b71('0x7')]=_0x26044f['name']||'';this[_0x7b71('0x8')]=_0x26044f[_0x7b71('0x8')]||0xa;this[_0x7b71('0x9')]=_0x26044f[_0x7b71('0x9')]||_0x7b71('0xa');this['Agents']=_0x26044f[_0x7b71('0xb')];this[_0x7b71('0xc')]={};this['waiting']=0x0;this[_0x7b71('0xd')]='';this[_0x7b71('0xe')]();this[_0x7b71('0xf')]();}SmsQueue['prototype'][_0x7b71('0xe')]=function(){var _0x4a39d4=this[_0x7b71('0xc')]['_rr'];this[_0x7b71('0xc')]=_[_0x7b71('0x10')](this[_0x7b71('0xb')],'id');this[_0x7b71('0xc')][_0x7b71('0x11')]=_0x4a39d4;};SmsQueue['prototype'][_0x7b71('0xf')]=function(){this['loggedIn']=0x0;this[_0x7b71('0x12')]=0x0;for(var _0x22114a=0x0;_0x22114a=0x0?this['available']:0x0;var _0x1fd67d={'id':this['id'],'available':this[_0x7b71('0x16')],'loggedIn':this[_0x7b71('0x17')],'name':this[_0x7b71('0x7')],'paused':this[_0x7b71('0x12')],'waiting':this['waiting']};var _0xa1ba78=md5(JSON[_0x7b71('0x18')](_0x1fd67d));if(this[_0x7b71('0xd')]!==_0xa1ba78){this[_0x7b71('0xd')]=_0xa1ba78;io['to'](util[_0x7b71('0x19')](_0x7b71('0x1a'),_0x1fd67d['name']))[_0x7b71('0x1b')](_0x7b71('0x1c'),_0x1fd67d);}};module[_0x7b71('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe107=['format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','stringify'];(function(_0x6f853b,_0x28b266){var _0x34edd7=function(_0x112b62){while(--_0x112b62){_0x6f853b['push'](_0x6f853b['shift']());}};_0x34edd7(++_0x28b266);}(_0xe107,0xb3));var _0x7e10=function(_0x13fc7d,_0x339240){_0x13fc7d=_0x13fc7d-0x0;var _0x381c24=_0xe107[_0x13fc7d];return _0x381c24;};'use strict';var _=require(_0x7e10('0x0'));var md5=require('md5');var util=require(_0x7e10('0x1'));var Redis=require(_0x7e10('0x2'));var config=require(_0x7e10('0x3'));config['redis']=_[_0x7e10('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e10('0x5'))(new Redis(config[_0x7e10('0x6')]));function SmsQueue(_0x841f6d){this['id']=_0x841f6d['id']||0x0;this['name']=_0x841f6d['name']||'';this[_0x7e10('0x7')]=_0x841f6d[_0x7e10('0x7')]||0xa;this[_0x7e10('0x8')]=_0x841f6d[_0x7e10('0x8')]||'beepall';this['Agents']=_0x841f6d[_0x7e10('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7e10('0xa')]='';this[_0x7e10('0xb')]();this[_0x7e10('0xc')]();}SmsQueue[_0x7e10('0xd')][_0x7e10('0xb')]=function(){var _0x52ba74=this[_0x7e10('0xe')]['_rr'];this[_0x7e10('0xe')]=_[_0x7e10('0xf')](this[_0x7e10('0x9')],'id');this['mapAgentsId'][_0x7e10('0x10')]=_0x52ba74;};SmsQueue[_0x7e10('0xd')][_0x7e10('0xc')]=function(){this[_0x7e10('0x11')]=0x0;this[_0x7e10('0x12')]=0x0;for(var _0x1b4d9d=0x0;_0x1b4d9d=0x0?this['available']:0x0;var _0x3208c6={'id':this['id'],'available':this[_0x7e10('0x15')],'loggedIn':this[_0x7e10('0x11')],'name':this['name'],'paused':this[_0x7e10('0x12')],'waiting':this[_0x7e10('0x16')]};var _0x157b22=md5(JSON[_0x7e10('0x17')](_0x3208c6));if(this[_0x7e10('0xa')]!==_0x157b22){this['md5']=_0x157b22;io['to'](util[_0x7e10('0x18')](_0x7e10('0x19'),_0x3208c6['name']))[_0x7e10('0x1a')](_0x7e10('0x1b'),_0x3208c6);}};module[_0x7e10('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index d05cd38..7259e4c 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 _0x2774=['updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x397256,_0x6514b1){var _0x4249ad=function(_0x1c44ef){while(--_0x1c44ef){_0x397256['push'](_0x397256['shift']());}};_0x4249ad(++_0x6514b1);}(_0x2774,0x15f));var _0x4277=function(_0x474c6e,_0x450d5c){_0x474c6e=_0x474c6e-0x0;var _0x35b496=_0x2774[_0x474c6e];return _0x35b496;};'use strict';var _=require(_0x4277('0x0'));var md5=require(_0x4277('0x1'));var util=require(_0x4277('0x2'));var Redis=require(_0x4277('0x3'));var config=require(_0x4277('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x4277('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x2bb266){this['id']=_0x2bb266['id']||0x0;this[_0x4277('0x6')]=_0x2bb266[_0x4277('0x6')]||'';this[_0x4277('0x7')]=_0x2bb266['timeout']||0xa;this['strategy']=_0x2bb266[_0x4277('0x8')]||_0x4277('0x9');this[_0x4277('0xa')]=_0x2bb266['Agents'];this[_0x4277('0xb')]={};this[_0x4277('0xc')]=0x0;this[_0x4277('0x1')]='';this[_0x4277('0xd')]();this[_0x4277('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x293923=this['mapAgentsId'][_0x4277('0xf')];this[_0x4277('0xb')]=_[_0x4277('0x10')](this[_0x4277('0xa')],'id');this[_0x4277('0xb')][_0x4277('0xf')]=_0x293923;};WhatsappQueue['prototype'][_0x4277('0xe')]=function(){this[_0x4277('0x11')]=0x0;this[_0x4277('0x12')]=0x0;for(var _0x3143f2=0x0;_0x3143f2=0x0?this[_0x4277('0x15')]:0x0;var _0x366470={'id':this['id'],'available':this[_0x4277('0x15')],'loggedIn':this[_0x4277('0x11')],'name':this[_0x4277('0x6')],'paused':this['paused'],'waiting':this[_0x4277('0xc')]};var _0x26170f=md5(JSON[_0x4277('0x16')](_0x366470));if(this[_0x4277('0x1')]!==_0x26170f){this['md5']=_0x26170f;io['to'](util[_0x4277('0x17')](_0x4277('0x18'),_0x366470['name']))[_0x4277('0x19')](_0x4277('0x1a'),_0x366470);}};module[_0x4277('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x9862=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp_queue:save'];(function(_0x183dbd,_0x235565){var _0x5b0ca5=function(_0x320368){while(--_0x320368){_0x183dbd['push'](_0x183dbd['shift']());}};_0x5b0ca5(++_0x235565);}(_0x9862,0x123));var _0x2986=function(_0x451aa7,_0x192266){_0x451aa7=_0x451aa7-0x0;var _0x1f03c8=_0x9862[_0x451aa7];return _0x1f03c8;};'use strict';var _=require(_0x2986('0x0'));var md5=require(_0x2986('0x1'));var util=require(_0x2986('0x2'));var Redis=require(_0x2986('0x3'));var config=require(_0x2986('0x4'));config[_0x2986('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2986('0x6'))(new Redis(config[_0x2986('0x5')]));function WhatsappQueue(_0x2d3431){this['id']=_0x2d3431['id']||0x0;this[_0x2986('0x7')]=_0x2d3431[_0x2986('0x7')]||'';this['timeout']=_0x2d3431[_0x2986('0x8')]||0xa;this[_0x2986('0x9')]=_0x2d3431[_0x2986('0x9')]||_0x2986('0xa');this[_0x2986('0xb')]=_0x2d3431[_0x2986('0xb')];this[_0x2986('0xc')]={};this[_0x2986('0xd')]=0x0;this[_0x2986('0x1')]='';this[_0x2986('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x2986('0xe')]=function(){var _0x577c3d=this[_0x2986('0xc')][_0x2986('0xf')];this[_0x2986('0xc')]=_[_0x2986('0x10')](this['Agents'],'id');this[_0x2986('0xc')][_0x2986('0xf')]=_0x577c3d;};WhatsappQueue[_0x2986('0x11')][_0x2986('0x12')]=function(){this[_0x2986('0x13')]=0x0;this['paused']=0x0;for(var _0x4bc88e=0x0;_0x4bc88e=0x0?this[_0x2986('0x18')]:0x0;var _0x310074={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2986('0x13')],'name':this[_0x2986('0x7')],'paused':this[_0x2986('0x17')],'waiting':this[_0x2986('0xd')]};var _0x5f2506=md5(JSON[_0x2986('0x19')](_0x310074));if(this[_0x2986('0x1')]!==_0x5f2506){this[_0x2986('0x1')]=_0x5f2506;io['to'](util[_0x2986('0x1a')]('whatsapp:queue:%s',_0x310074[_0x2986('0x7')]))['emit'](_0x2986('0x1b'),_0x310074);}};module[_0x2986('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 21c082a..11d69b2 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 2bd0351..71f71cc 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 _0x819a=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x819a,0x139));var _0xa819=function(_0xf1ceb4,_0x3443e6){_0xf1ceb4=_0xf1ceb4-0x0;var _0x42ed45=_0x819a[_0xf1ceb4];return _0x42ed45;};'use strict';var client=require(_0xa819('0x0'));exports[_0xa819('0x1')]=function(_0x3b32e6,_0x5bb452){return client['Request'](_0xa819('0x2'),{'body':_0x5bb452,'options':{'where':{'id':_0x3b32e6}},'log':_0xa819('0x3')});};exports[_0xa819('0x4')]=function(_0x201ab2,_0x3fe5c7){return client[_0xa819('0x5')](_0xa819('0x6'),{'body':_0x3fe5c7,'options':{'where':{'id':_0x201ab2}},'log':_0xa819('0x7')});}; \ No newline at end of file +var _0xb4b3=['Request','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','update'];(function(_0x40aa1,_0x1c52aa){var _0x2b9a93=function(_0x1181d5){while(--_0x1181d5){_0x40aa1['push'](_0x40aa1['shift']());}};_0x2b9a93(++_0x1c52aa);}(_0xb4b3,0x68));var _0x3b4b=function(_0x5b3ae2,_0x179eab){_0x5b3ae2=_0x5b3ae2-0x0;var _0x266d15=_0xb4b3[_0x5b3ae2];return _0x266d15;};'use strict';var client=require('../client');exports[_0x3b4b('0x0')]=function(_0x362823,_0x498465){return client[_0x3b4b('0x1')](_0x3b4b('0x2'),{'body':_0x498465,'options':{'where':{'id':_0x362823}},'log':_0x3b4b('0x3')});};exports['addTags']=function(_0x11985a,_0x34238d){return client[_0x3b4b('0x1')]('AddTagsToChatInteraction',{'body':_0x34238d,'options':{'where':{'id':_0x11985a}},'log':_0x3b4b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f432dcf..985454c 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 _0x1880=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1880,0xe7));var _0x0188=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x1880[_0x381379];return _0x3e1063;};'use strict';var client=require(_0x0188('0x0'));exports[_0x0188('0x1')]=function(_0x3d32d9){return client[_0x0188('0x2')](_0x0188('0x3'),{'body':_0x3d32d9,'log':_0x0188('0x4')});}; \ No newline at end of file +var _0x1842=['create','Request'];(function(_0x24b1ea,_0x642a66){var _0x1eb3b0=function(_0x57c90b){while(--_0x57c90b){_0x24b1ea['push'](_0x24b1ea['shift']());}};_0x1eb3b0(++_0x642a66);}(_0x1842,0x16a));var _0x2184=function(_0x4be4c3,_0x39878a){_0x4be4c3=_0x4be4c3-0x0;var _0x4969c8=_0x1842[_0x4be4c3];return _0x4969c8;};'use strict';var client=require('../client');exports[_0x2184('0x0')]=function(_0x536e86){return client[_0x2184('0x1')]('CreateChatMessage',{'body':_0x536e86,'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 6381afd..be312da 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 _0x770d=['../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','Agents','online','chatPause'];(function(_0x41bc46,_0x5079c0){var _0x2c55f0=function(_0x169d3b){while(--_0x169d3b){_0x41bc46['push'](_0x41bc46['shift']());}};_0x2c55f0(++_0x5079c0);}(_0x770d,0x122));var _0xd770=function(_0x2185e1,_0x5dd29c){_0x2185e1=_0x2185e1-0x0;var _0x3b5c4c=_0x770d[_0x2185e1];return _0x3b5c4c;};'use strict';var client=require(_0xd770('0x0'));exports[_0xd770('0x1')]=function(){return function(){return client[_0xd770('0x2')](_0xd770('0x3'),{'options':{'raw':![],'attributes':['id',_0xd770('0x4'),_0xd770('0x5'),_0xd770('0x6')],'include':[{'model':'User','as':_0xd770('0x7'),'attributes':['id',_0xd770('0x4'),_0xd770('0x8'),_0xd770('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x0fcd=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','Agents','online','chatPause'];(function(_0x580a6b,_0x51b7ad){var _0x40942c=function(_0x5b7a58){while(--_0x5b7a58){_0x580a6b['push'](_0x580a6b['shift']());}};_0x40942c(++_0x51b7ad);}(_0x0fcd,0x129));var _0xd0fc=function(_0x14f33d,_0x22315a){_0x14f33d=_0x14f33d-0x0;var _0x52ea7a=_0x0fcd[_0x14f33d];return _0x52ea7a;};'use strict';var client=require('../client');exports[_0xd0fc('0x0')]=function(){return function(){return client[_0xd0fc('0x1')](_0xd0fc('0x2'),{'options':{'raw':![],'attributes':['id',_0xd0fc('0x3'),_0xd0fc('0x4'),_0xd0fc('0x5')],'include':[{'model':'User','as':_0xd0fc('0x6'),'attributes':['id',_0xd0fc('0x3'),_0xd0fc('0x7'),_0xd0fc('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7f6c783..cfc54e6 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 _0x8fcf=['DESC','../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport'];(function(_0x57aa9d,_0x40382c){var _0x43fd79=function(_0x4cfd97){while(--_0x4cfd97){_0x57aa9d['push'](_0x57aa9d['shift']());}};_0x43fd79(++_0x40382c);}(_0x8fcf,0x1db));var _0xf8fc=function(_0x3e156b,_0x3a22e8){_0x3e156b=_0x3e156b-0x0;var _0xea621=_0x8fcf[_0x3e156b];return _0xea621;};'use strict';var client=require(_0xf8fc('0x0'));exports[_0xf8fc('0x1')]=function(_0x32229e){return client['Request'](_0xf8fc('0x2'),{'body':_0x32229e,'log':'CreateChatQueueReport'});};exports['update']=function(_0x5a5263,_0x33afd1){return client[_0xf8fc('0x3')](_0xf8fc('0x4'),{'body':_0x33afd1,'options':{'where':{'uniqueid':_0x5a5263},'order':[['id',_0xf8fc('0x5')]],'limit':0x1},'log':_0xf8fc('0x4')});}; \ No newline at end of file +var _0x7e16=['UpdateChatQueueReport','../client','create','Request','update','DESC'];(function(_0x27d900,_0x3bced4){var _0x2b3807=function(_0x252970){while(--_0x252970){_0x27d900['push'](_0x27d900['shift']());}};_0x2b3807(++_0x3bced4);}(_0x7e16,0x16f));var _0x67e1=function(_0x34c348,_0x349faa){_0x34c348=_0x34c348-0x0;var _0xb2b644=_0x7e16[_0x34c348];return _0xb2b644;};'use strict';var client=require(_0x67e1('0x0'));exports[_0x67e1('0x1')]=function(_0x14f1a6){return client[_0x67e1('0x2')]('CreateChatQueueReport',{'body':_0x14f1a6,'log':'CreateChatQueueReport'});};exports[_0x67e1('0x3')]=function(_0x53bbdf,_0x268f07){return client[_0x67e1('0x2')]('UpdateChatQueueReport',{'body':_0x268f07,'options':{'where':{'uniqueid':_0x53bbdf},'order':[['id',_0x67e1('0x4')]],'limit':0x1},'log':_0x67e1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ab4e99e..6fe9e61 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x7a54,0x106));var _0x47a5=function(_0xb5046,_0x4d3293){_0xb5046=_0xb5046-0x0;var _0xddd5a=_0x7a54[_0xb5046];return _0xddd5a;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x57ed15,_0x2c4588){var _0x18be3c=function(_0x556b6f){while(--_0x556b6f){_0x57ed15['push'](_0x57ed15['shift']());}};_0x18be3c(++_0x2c4588);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9060e62..630d67a 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 _0x279c=['../client','create','Request','createFaxMessage'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x279c,0x100));var _0xc279=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x279c[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0xc279('0x0'));exports[_0xc279('0x1')]=function(_0x53323c){return client[_0xc279('0x2')]('CreateFaxMessage',{'body':_0x53323c,'log':_0xc279('0x3')});}; \ No newline at end of file +var _0xb803=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x31406c,_0x3be6fe){var _0x3c72ff=function(_0x16f301){while(--_0x16f301){_0x31406c['push'](_0x31406c['shift']());}};_0x3c72ff(++_0x3be6fe);}(_0xb803,0x9c));var _0x3b80=function(_0x340032,_0x132bca){_0x340032=_0x340032-0x0;var _0xb89bac=_0xb803[_0x340032];return _0xb89bac;};'use strict';var client=require(_0x3b80('0x0'));exports[_0x3b80('0x1')]=function(_0x2ef9e3){return client['Request'](_0x3b80('0x2'),{'body':_0x2ef9e3,'log':_0x3b80('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 335e336..b4a3a50 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 _0x4edb=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents','online'];(function(_0x37c120,_0x40349b){var _0x7313f2=function(_0x4f28f0){while(--_0x4f28f0){_0x37c120['push'](_0x37c120['shift']());}};_0x7313f2(++_0x40349b);}(_0x4edb,0x130));var _0xb4ed=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0x4edb[_0x121350];return _0x2e21c7;};'use strict';var client=require('../client');exports[_0xb4ed('0x0')]=function(){return function(){return client[_0xb4ed('0x1')](_0xb4ed('0x2'),{'options':{'raw':![],'attributes':['id',_0xb4ed('0x3'),_0xb4ed('0x4'),_0xb4ed('0x5')],'include':[{'model':'User','as':_0xb4ed('0x6'),'attributes':['id',_0xb4ed('0x3'),_0xb4ed('0x7'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x133e=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x28afbe,_0x4d655b){var _0x16a494=function(_0x1efdc5){while(--_0x1efdc5){_0x28afbe['push'](_0x28afbe['shift']());}};_0x16a494(++_0x4d655b);}(_0x133e,0x136));var _0xe133=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x133e[_0x4cfc1d];return _0x1c01a0;};'use strict';var client=require(_0xe133('0x0'));exports[_0xe133('0x1')]=function(){return function(){return client[_0xe133('0x2')](_0xe133('0x3'),{'options':{'raw':![],'attributes':['id',_0xe133('0x4'),_0xe133('0x5'),_0xe133('0x6')],'include':[{'model':_0xe133('0x7'),'as':_0xe133('0x8'),'attributes':['id','name',_0xe133('0x9'),_0xe133('0xa')]}]},'log':_0xe133('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8b38429..e2f5807 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 _0xa7a9=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa7a9,0x10e));var _0x9a7a=function(_0x165b3c,_0x20078e){_0x165b3c=_0x165b3c-0x0;var _0x54dc24=_0xa7a9[_0x165b3c];return _0x54dc24;};'use strict';var client=require(_0x9a7a('0x0'));exports[_0x9a7a('0x1')]=function(_0x10daee){return client[_0x9a7a('0x2')](_0x9a7a('0x3'),{'body':_0x10daee,'log':_0x9a7a('0x3')});};exports[_0x9a7a('0x4')]=function(_0x3e912c,_0x527359){return client[_0x9a7a('0x2')](_0x9a7a('0x5'),{'body':_0x527359,'options':{'where':{'uniqueid':_0x3e912c},'order':[['id',_0x9a7a('0x6')]],'limit':0x1},'log':_0x9a7a('0x5')});}; \ No newline at end of file +var _0x775f=['../client','Request','CreateFaxQueueReport','DESC','UpdateFaxQueueReport'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x775f,0x17c));var _0xf775=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x775f[_0xee3051];return _0x139e81;};'use strict';var client=require(_0xf775('0x0'));exports['create']=function(_0x39b831){return client[_0xf775('0x1')](_0xf775('0x2'),{'body':_0x39b831,'log':_0xf775('0x2')});};exports['update']=function(_0x2b2dad,_0x39d43e){return client[_0xf775('0x1')]('UpdateFaxQueueReport',{'body':_0x39d43e,'options':{'where':{'uniqueid':_0x2b2dad},'order':[['id',_0xf775('0x3')]],'limit':0x1},'log':_0xf775('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 688a5b6..17c9321 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 _0x2e8c=['Request','name','Intervals','interval','../client','getIntervals'];(function(_0x47c9b1,_0x119667){var _0x314445=function(_0x547906){while(--_0x547906){_0x47c9b1['push'](_0x47c9b1['shift']());}};_0x314445(++_0x119667);}(_0x2e8c,0x178));var _0xc2e8=function(_0x32915b,_0x4819e5){_0x32915b=_0x32915b-0x0;var _0x1479ed=_0x2e8c[_0x32915b];return _0x1479ed;};'use strict';var client=require(_0xc2e8('0x0'));exports[_0xc2e8('0x1')]=function(){return function(){return client[_0xc2e8('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc2e8('0x3')],'include':[{'model':'Interval','as':_0xc2e8('0x4'),'attributes':['id',_0xc2e8('0x3'),_0xc2e8('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x90ab=['GetInterval','name','Interval','getIntervals','Request'];(function(_0x336647,_0x15e4e7){var _0x3ac992=function(_0x27a9e3){while(--_0x27a9e3){_0x336647['push'](_0x336647['shift']());}};_0x3ac992(++_0x15e4e7);}(_0x90ab,0x1e9));var _0xb90a=function(_0x1c05c0,_0x38e872){_0x1c05c0=_0x1c05c0-0x0;var _0x4b8d87=_0x90ab[_0x1c05c0];return _0x4b8d87;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xb90a('0x0')](_0xb90a('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb90a('0x2')],'include':[{'model':_0xb90a('0x3'),'as':'Intervals','attributes':['id',_0xb90a('0x2'),'interval']}]},'log':_0xb90a('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 09fcf71..2499a91 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 _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x33af,0xec));var _0xf33a=function(_0x4e7af4,_0x758572){_0x4e7af4=_0x4e7af4-0x0;var _0x2548f1=_0x33af[_0x4e7af4];return _0x2548f1;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x896e=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x896e,0x1e9));var _0xe896=function(_0x466c0e,_0x502550){_0x466c0e=_0x466c0e-0x0;var _0x4eaceb=_0x896e[_0x466c0e];return _0x4eaceb;};'use strict';var client=require(_0xe896('0x0'));exports[_0xe896('0x1')]=function(_0x3feebe,_0x229b59){return client[_0xe896('0x2')](_0xe896('0x3'),{'body':_0x229b59,'options':{'where':{'id':_0x3feebe}},'log':_0xe896('0x4')});};exports[_0xe896('0x5')]=function(_0x3f85e5,_0x2d3521){return client[_0xe896('0x2')](_0xe896('0x6'),{'body':_0x2d3521,'options':{'where':{'id':_0x3f85e5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 681e6db..ed5dd80 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 _0xab1f=['Request','CreateMailMessage','../client'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xab1f,0x17f));var _0xfab1=function(_0x39b912,_0x35df5e){_0x39b912=_0x39b912-0x0;var _0x12e279=_0xab1f[_0x39b912];return _0x12e279;};'use strict';var client=require(_0xfab1('0x0'));exports['create']=function(_0x48deef){return client[_0xfab1('0x1')](_0xfab1('0x2'),{'body':_0x48deef,'log':'createMailMessage'});}; \ No newline at end of file +var _0x24c5=['Request','createMailMessage','../client'];(function(_0x94aedf,_0x12859a){var _0x47bdf8=function(_0x208ce4){while(--_0x208ce4){_0x94aedf['push'](_0x94aedf['shift']());}};_0x47bdf8(++_0x12859a);}(_0x24c5,0x1b8));var _0x524c=function(_0x3fdda6,_0x318be1){_0x3fdda6=_0x3fdda6-0x0;var _0x3f6e87=_0x24c5[_0x3fdda6];return _0x3f6e87;};'use strict';var client=require(_0x524c('0x0'));exports['create']=function(_0x30e789){return client[_0x524c('0x1')]('CreateMailMessage',{'body':_0x30e789,'log':_0x524c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c664b94..2eba0dd 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 _0xe5ee=['getMailQueues','Request','name','timeout','strategy','online','mailPause','../client'];(function(_0x5adb49,_0x20d550){var _0x593ef7=function(_0x36545d){while(--_0x36545d){_0x5adb49['push'](_0x5adb49['shift']());}};_0x593ef7(++_0x20d550);}(_0xe5ee,0x8f));var _0xee5e=function(_0x2aa890,_0x1b595d){_0x2aa890=_0x2aa890-0x0;var _0x550247=_0xe5ee[_0x2aa890];return _0x550247;};'use strict';var client=require(_0xee5e('0x0'));exports[_0xee5e('0x1')]=function(){return function(){return client[_0xee5e('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xee5e('0x3'),_0xee5e('0x4'),_0xee5e('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xee5e('0x3'),_0xee5e('0x6'),_0xee5e('0x7')]}]},'log':_0xee5e('0x1')});};}; \ No newline at end of file +var _0xc16d=['timeout','strategy','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x4015c2,_0x39d586){var _0x2ceaa1=function(_0x1cc31c){while(--_0x1cc31c){_0x4015c2['push'](_0x4015c2['shift']());}};_0x2ceaa1(++_0x39d586);}(_0xc16d,0x145));var _0xdc16=function(_0x456940,_0x1c50e0){_0x456940=_0x456940-0x0;var _0x2fe650=_0xc16d[_0x456940];return _0x2fe650;};'use strict';var client=require(_0xdc16('0x0'));exports[_0xdc16('0x1')]=function(){return function(){return client[_0xdc16('0x2')](_0xdc16('0x3'),{'options':{'raw':![],'attributes':['id',_0xdc16('0x4'),_0xdc16('0x5'),_0xdc16('0x6')],'include':[{'model':'User','as':_0xdc16('0x7'),'attributes':['id',_0xdc16('0x4'),_0xdc16('0x8'),_0xdc16('0x9')]}]},'log':_0xdc16('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6b426f6..f14ea08 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 _0xad0b=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x320aec,_0x500c4e){var _0x4e0690=function(_0x4da050){while(--_0x4da050){_0x320aec['push'](_0x320aec['shift']());}};_0x4e0690(++_0x500c4e);}(_0xad0b,0xcd));var _0xbad0=function(_0x4038d3,_0x505d2f){_0x4038d3=_0x4038d3-0x0;var _0x263009=_0xad0b[_0x4038d3];return _0x263009;};'use strict';var client=require(_0xbad0('0x0'));exports[_0xbad0('0x1')]=function(_0x1b506f){return client[_0xbad0('0x2')](_0xbad0('0x3'),{'body':_0x1b506f,'log':'CreateMailQueueReport'});};exports[_0xbad0('0x4')]=function(_0x2109c5,_0x1476a3){return client[_0xbad0('0x2')](_0xbad0('0x5'),{'body':_0x1476a3,'options':{'where':{'uniqueid':_0x2109c5},'order':[['id',_0xbad0('0x6')]],'limit':0x1},'log':_0xbad0('0x5')});}; \ No newline at end of file +var _0x5ba0=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x2d607b,_0x455193){var _0x5be31d=function(_0xd56691){while(--_0xd56691){_0x2d607b['push'](_0x2d607b['shift']());}};_0x5be31d(++_0x455193);}(_0x5ba0,0x16a));var _0x05ba=function(_0x457f4a,_0x57e8a2){_0x457f4a=_0x457f4a-0x0;var _0x54ab21=_0x5ba0[_0x457f4a];return _0x54ab21;};'use strict';var client=require(_0x05ba('0x0'));exports[_0x05ba('0x1')]=function(_0x2546c2){return client[_0x05ba('0x2')](_0x05ba('0x3'),{'body':_0x2546c2,'log':_0x05ba('0x3')});};exports['update']=function(_0x45f0ac,_0x26daa5){return client[_0x05ba('0x2')](_0x05ba('0x4'),{'body':_0x26daa5,'options':{'where':{'uniqueid':_0x45f0ac},'order':[['id',_0x05ba('0x5')]],'limit':0x1},'log':_0x05ba('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 73e2eb4..d7ca8c5 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 _0x601c=['Request','AddTagsToOpenchannelInteraction','UpdateOpenchannelInteraction','addTags'];(function(_0x82636,_0x23ed5d){var _0x2ff161=function(_0x10adb4){while(--_0x10adb4){_0x82636['push'](_0x82636['shift']());}};_0x2ff161(++_0x23ed5d);}(_0x601c,0x92));var _0xc601=function(_0x3d5949,_0x1e152){_0x3d5949=_0x3d5949-0x0;var _0x4fe99a=_0x601c[_0x3d5949];return _0x4fe99a;};'use strict';var client=require('../client');exports['update']=function(_0x49da23,_0x2651d6){return client['Request'](_0xc601('0x0'),{'body':_0x2651d6,'options':{'where':{'id':_0x49da23}},'log':'updateOpenchannelInteraction'});};exports[_0xc601('0x1')]=function(_0x158d1b,_0x189a48){return client[_0xc601('0x2')](_0xc601('0x3'),{'body':_0x189a48,'options':{'where':{'id':_0x158d1b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9b48=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x58718d,_0x148e02){var _0xd117d9=function(_0x2e28a5){while(--_0x2e28a5){_0x58718d['push'](_0x58718d['shift']());}};_0xd117d9(++_0x148e02);}(_0x9b48,0x8a));var _0x89b4=function(_0x3febb5,_0x247278){_0x3febb5=_0x3febb5-0x0;var _0x54a914=_0x9b48[_0x3febb5];return _0x54a914;};'use strict';var client=require(_0x89b4('0x0'));exports[_0x89b4('0x1')]=function(_0x48ab28,_0x808926){return client[_0x89b4('0x2')](_0x89b4('0x3'),{'body':_0x808926,'options':{'where':{'id':_0x48ab28}},'log':_0x89b4('0x4')});};exports[_0x89b4('0x5')]=function(_0x5a67d5,_0x1e1b41){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x1e1b41,'options':{'where':{'id':_0x5a67d5}},'log':_0x89b4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fe4d76d..f6dc700 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 _0xeeb4=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0xeeb4,0x18c));var _0x4eeb=function(_0x310d80,_0x350219){_0x310d80=_0x310d80-0x0;var _0x211642=_0xeeb4[_0x310d80];return _0x211642;};'use strict';var client=require(_0x4eeb('0x0'));exports[_0x4eeb('0x1')]=function(_0x5952d4){return client[_0x4eeb('0x2')](_0x4eeb('0x3'),{'body':_0x5952d4,'log':_0x4eeb('0x4')});}; \ No newline at end of file +var _0x03b7=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x10108d,_0x24737e){var _0x5c47af=function(_0x159618){while(--_0x159618){_0x10108d['push'](_0x10108d['shift']());}};_0x5c47af(++_0x24737e);}(_0x03b7,0x16c));var _0x703b=function(_0xa99136,_0x4942f){_0xa99136=_0xa99136-0x0;var _0x37fccc=_0x03b7[_0xa99136];return _0x37fccc;};'use strict';var client=require(_0x703b('0x0'));exports[_0x703b('0x1')]=function(_0x14f44f){return client[_0x703b('0x2')](_0x703b('0x3'),{'body':_0x14f44f,'log':_0x703b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1c402e8..989e6f1 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 _0x8e99=['getOpenchannelQueues','Request','name','timeout','strategy','Agents','online','openchannelPause','../client'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x8e99,0x167));var _0x98e9=function(_0x44627f,_0x4da892){_0x44627f=_0x44627f-0x0;var _0x1661d4=_0x8e99[_0x44627f];return _0x1661d4;};'use strict';var client=require(_0x98e9('0x0'));exports[_0x98e9('0x1')]=function(){return function(){return client[_0x98e9('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x98e9('0x3'),_0x98e9('0x4'),_0x98e9('0x5')],'include':[{'model':'User','as':_0x98e9('0x6'),'attributes':['id',_0x98e9('0x3'),_0x98e9('0x7'),_0x98e9('0x8')]}]},'log':_0x98e9('0x1')});};}; \ No newline at end of file +var _0xd5d2=['User','Agents','name','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy'];(function(_0x94992e,_0x523bef){var _0x3c8df5=function(_0x5af876){while(--_0x5af876){_0x94992e['push'](_0x94992e['shift']());}};_0x3c8df5(++_0x523bef);}(_0xd5d2,0x19b));var _0x2d5d=function(_0x220a41,_0x17f87d){_0x220a41=_0x220a41-0x0;var _0x3a797e=_0xd5d2[_0x220a41];return _0x3a797e;};'use strict';var client=require(_0x2d5d('0x0'));exports[_0x2d5d('0x1')]=function(){return function(){return client[_0x2d5d('0x2')](_0x2d5d('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x2d5d('0x4')],'include':[{'model':_0x2d5d('0x5'),'as':_0x2d5d('0x6'),'attributes':['id',_0x2d5d('0x7'),'online','openchannelPause']}]},'log':_0x2d5d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a3579c8..8631555 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 _0x03da=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x12aa66,_0x2d35c1){var _0x53dfe9=function(_0x2ab011){while(--_0x2ab011){_0x12aa66['push'](_0x12aa66['shift']());}};_0x53dfe9(++_0x2d35c1);}(_0x03da,0xec));var _0xa03d=function(_0x5e9e5f,_0x19aeeb){_0x5e9e5f=_0x5e9e5f-0x0;var _0x4944f5=_0x03da[_0x5e9e5f];return _0x4944f5;};'use strict';var client=require(_0xa03d('0x0'));exports[_0xa03d('0x1')]=function(_0x4be390){return client['Request'](_0xa03d('0x2'),{'body':_0x4be390,'log':_0xa03d('0x2')});};exports[_0xa03d('0x3')]=function(_0x58f520,_0x3b555c){return client[_0xa03d('0x4')](_0xa03d('0x5'),{'body':_0x3b555c,'options':{'where':{'uniqueid':_0x58f520},'order':[['id',_0xa03d('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x548b=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x1d0180,_0x4e7534){var _0x3c4d97=function(_0x293081){while(--_0x293081){_0x1d0180['push'](_0x1d0180['shift']());}};_0x3c4d97(++_0x4e7534);}(_0x548b,0x1b6));var _0xb548=function(_0x4f6500,_0x46908b){_0x4f6500=_0x4f6500-0x0;var _0x31ae0c=_0x548b[_0x4f6500];return _0x31ae0c;};'use strict';var client=require(_0xb548('0x0'));exports['create']=function(_0xccfbbf){return client[_0xb548('0x1')](_0xb548('0x2'),{'body':_0xccfbbf,'log':_0xb548('0x2')});};exports[_0xb548('0x3')]=function(_0x1595e2,_0x15e402){return client[_0xb548('0x1')](_0xb548('0x4'),{'body':_0x15e402,'options':{'where':{'uniqueid':_0x1595e2},'order':[['id',_0xb548('0x5')]],'limit':0x1},'log':_0xb548('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 10bc9ff..6622ce8 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 _0xee14=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','Request'];(function(_0xbb69cc,_0x5214e9){var _0x5b9f04=function(_0x9a02a8){while(--_0x9a02a8){_0xbb69cc['push'](_0xbb69cc['shift']());}};_0x5b9f04(++_0x5214e9);}(_0xee14,0x13a));var _0x4ee1=function(_0x502223,_0x31f8ef){_0x502223=_0x502223-0x0;var _0x4ffb87=_0xee14[_0x502223];return _0x4ffb87;};'use strict';var client=require('../client');exports['update']=function(_0x3eb7cf,_0x674696){return client[_0x4ee1('0x0')](_0x4ee1('0x1'),{'body':_0x674696,'options':{'where':{'id':_0x3eb7cf}},'log':_0x4ee1('0x2')});};exports[_0x4ee1('0x3')]=function(_0x34a0ae,_0x1e5fb6){return client[_0x4ee1('0x0')]('AddTagsToSmsInteraction',{'body':_0x1e5fb6,'options':{'where':{'id':_0x34a0ae}},'log':_0x4ee1('0x4')});}; \ No newline at end of file +var _0x165d=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0xed2948,_0x45d6fb){var _0x55ae66=function(_0x52b362){while(--_0x52b362){_0xed2948['push'](_0xed2948['shift']());}};_0x55ae66(++_0x45d6fb);}(_0x165d,0x14a));var _0xd165=function(_0x1e20b2,_0x2346bd){_0x1e20b2=_0x1e20b2-0x0;var _0x358a41=_0x165d[_0x1e20b2];return _0x358a41;};'use strict';var client=require(_0xd165('0x0'));exports[_0xd165('0x1')]=function(_0x341388,_0x21861f){return client[_0xd165('0x2')](_0xd165('0x3'),{'body':_0x21861f,'options':{'where':{'id':_0x341388}},'log':_0xd165('0x4')});};exports['addTags']=function(_0x405ee0,_0x27993b){return client['Request']('AddTagsToSmsInteraction',{'body':_0x27993b,'options':{'where':{'id':_0x405ee0}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b0c8769..9008b34 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 _0xf213=['CreateSmsMessage','../client','create','Request'];(function(_0x2ca2b2,_0x48ea2e){var _0x583856=function(_0x39492a){while(--_0x39492a){_0x2ca2b2['push'](_0x2ca2b2['shift']());}};_0x583856(++_0x48ea2e);}(_0xf213,0x191));var _0x3f21=function(_0x3f920a,_0x2f3451){_0x3f920a=_0x3f920a-0x0;var _0x2c482b=_0xf213[_0x3f920a];return _0x2c482b;};'use strict';var client=require(_0x3f21('0x0'));exports[_0x3f21('0x1')]=function(_0x1fa932){return client[_0x3f21('0x2')](_0x3f21('0x3'),{'body':_0x1fa932,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x171d=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x1742b5,_0x38a03d){var _0xf0e62c=function(_0x2016d7){while(--_0x2016d7){_0x1742b5['push'](_0x1742b5['shift']());}};_0xf0e62c(++_0x38a03d);}(_0x171d,0x18d));var _0xd171=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x171d[_0x3b3cc6];return _0x1161e4;};'use strict';var client=require(_0xd171('0x0'));exports[_0xd171('0x1')]=function(_0x5593b4){return client[_0xd171('0x2')](_0xd171('0x3'),{'body':_0x5593b4,'log':_0xd171('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5d06bb1..9d5a8e0 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x1dc608,_0x317979){var _0x2ef0ee=function(_0x40a8e8){while(--_0x40a8e8){_0x1dc608['push'](_0x1dc608['shift']());}};_0x2ef0ee(++_0x317979);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xcb91[_0x163040];return _0x364667;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x1196e0,_0x59427c){var _0x435595=function(_0x8c57f0){while(--_0x8c57f0){_0x1196e0['push'](_0x1196e0['shift']());}};_0x435595(++_0x59427c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xcb91[_0x20aadb];return _0x520018;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6deae48..08fd7a8 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1fb001,_0x58daaa){var _0x1650b3=function(_0x5e8582){while(--_0x5e8582){_0x1fb001['push'](_0x1fb001['shift']());}};_0x1650b3(++_0x58daaa);}(_0x34e8,0x12c));var _0x834e=function(_0x2f99b5,_0x2f8fc7){_0x2f99b5=_0x2f99b5-0x0;var _0x2e0d52=_0x34e8[_0x2f99b5];return _0x2e0d52;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x505c7b,_0x4f1462){var _0x3ea630=function(_0x4d84cf){while(--_0x4d84cf){_0x505c7b['push'](_0x505c7b['shift']());}};_0x3ea630(++_0x4f1462);}(_0x34e8,0x12c));var _0x834e=function(_0x45aec0,_0x44e370){_0x45aec0=_0x45aec0-0x0;var _0x4729b9=_0x34e8[_0x45aec0];return _0x4729b9;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4f95141..77a53e8 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(_0x30ef55,_0x21d831){var _0x157cb6=function(_0x582e3d){while(--_0x582e3d){_0x30ef55['push'](_0x30ef55['shift']());}};_0x157cb6(++_0x21d831);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x76a637,_0x19912b){var _0x51bba4=function(_0x503298){while(--_0x503298){_0x76a637['push'](_0x76a637['shift']());}};_0x51bba4(++_0x19912b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 45bb6e2..e4688a2 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 _0x4815=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x35f4f3,_0x5061f1){var _0x581075=function(_0x59681d){while(--_0x59681d){_0x35f4f3['push'](_0x35f4f3['shift']());}};_0x581075(++_0x5061f1);}(_0x4815,0xff));var _0x5481=function(_0x24a999,_0x252834){_0x24a999=_0x24a999-0x0;var _0x43d4aa=_0x4815[_0x24a999];return _0x43d4aa;};'use strict';var client=require(_0x5481('0x0'));exports[_0x5481('0x1')]=function(_0x325314,_0x3ac100){return client[_0x5481('0x2')](_0x5481('0x3'),{'body':_0x3ac100,'options':{'where':{'id':_0x325314}},'log':_0x5481('0x4')});};exports['addTags']=function(_0x4a7db7,_0x2e5eec){return client[_0x5481('0x2')](_0x5481('0x5'),{'body':_0x2e5eec,'options':{'where':{'id':_0x4a7db7}},'log':_0x5481('0x6')});}; \ No newline at end of file +var _0xea1c=['UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','Request'];(function(_0x37a1e6,_0x536b85){var _0x115a59=function(_0x4173a7){while(--_0x4173a7){_0x37a1e6['push'](_0x37a1e6['shift']());}};_0x115a59(++_0x536b85);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['update']=function(_0x3276ed,_0x29dde1){return client[_0xcea1('0x0')](_0xcea1('0x1'),{'body':_0x29dde1,'options':{'where':{'id':_0x3276ed}},'log':'updateWhatsappInteraction'});};exports[_0xcea1('0x2')]=function(_0x377ab8,_0xb835ce){return client[_0xcea1('0x0')](_0xcea1('0x3'),{'body':_0xb835ce,'options':{'where':{'id':_0x377ab8}},'log':_0xcea1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c1330d9..a1dda3d 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 _0x348c=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x187e82,_0x5254eb){var _0x58625e=function(_0x59d14d){while(--_0x59d14d){_0x187e82['push'](_0x187e82['shift']());}};_0x58625e(++_0x5254eb);}(_0x348c,0x132));var _0xc348=function(_0x10dcf6,_0x1a5c62){_0x10dcf6=_0x10dcf6-0x0;var _0x4ab7fe=_0x348c[_0x10dcf6];return _0x4ab7fe;};'use strict';var client=require(_0xc348('0x0'));exports[_0xc348('0x1')]=function(_0x12aa6f){return client[_0xc348('0x2')](_0xc348('0x3'),{'body':_0x12aa6f,'log':_0xc348('0x4')});}; \ No newline at end of file +var _0x38ea=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x38ea,0x81));var _0xa38e=function(_0x2a2d01,_0x5c59e1){_0x2a2d01=_0x2a2d01-0x0;var _0x2c0aff=_0x38ea[_0x2a2d01];return _0x2c0aff;};'use strict';var client=require(_0xa38e('0x0'));exports[_0xa38e('0x1')]=function(_0x329104){return client[_0xa38e('0x2')](_0xa38e('0x3'),{'body':_0x329104,'log':_0xa38e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2ff5ac7..bd36e0d 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 _0x617a=['GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x33c4e9,_0x3da670){var _0x485a66=function(_0x203806){while(--_0x203806){_0x33c4e9['push'](_0x33c4e9['shift']());}};_0x485a66(++_0x3da670);}(_0x617a,0x1de));var _0xa617=function(_0x14c4f2,_0x4df4b1){_0x14c4f2=_0x14c4f2-0x0;var _0x255998=_0x617a[_0x14c4f2];return _0x255998;};'use strict';var client=require(_0xa617('0x0'));exports[_0xa617('0x1')]=function(){return function(){return client['Request'](_0xa617('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xa617('0x3'),_0xa617('0x4')],'include':[{'model':_0xa617('0x5'),'as':_0xa617('0x6'),'attributes':['id',_0xa617('0x7'),_0xa617('0x8'),_0xa617('0x9')]}]},'log':_0xa617('0x1')});};}; \ No newline at end of file +var _0x6622=['Agents','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0xe219e7,_0x31bd0e){var _0x19ea41=function(_0x41ae95){while(--_0x41ae95){_0xe219e7['push'](_0xe219e7['shift']());}};_0x19ea41(++_0x31bd0e);}(_0x6622,0x19b));var _0x2662=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x6622[_0x292f93];return _0x5a94b1;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x2662('0x0'),{'options':{'raw':![],'attributes':['id',_0x2662('0x1'),_0x2662('0x2'),_0x2662('0x3')],'include':[{'model':_0x2662('0x4'),'as':_0x2662('0x5'),'attributes':['id',_0x2662('0x1'),'online',_0x2662('0x6')]}]},'log':_0x2662('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4aa9ae1..65ae835 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 _0xd1a9=['../client','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0x21fb32,_0x149cc9){var _0x426acc=function(_0x1089c4){while(--_0x1089c4){_0x21fb32['push'](_0x21fb32['shift']());}};_0x426acc(++_0x149cc9);}(_0xd1a9,0x13e));var _0x9d1a=function(_0x511fad,_0x26cf29){_0x511fad=_0x511fad-0x0;var _0x4b61bd=_0xd1a9[_0x511fad];return _0x4b61bd;};'use strict';var client=require(_0x9d1a('0x0'));exports['create']=function(_0x21d563){return client[_0x9d1a('0x1')](_0x9d1a('0x2'),{'body':_0x21d563,'log':'CreateWhatsappQueueReport'});};exports[_0x9d1a('0x3')]=function(_0x206799,_0x2e0a4b){return client[_0x9d1a('0x1')]('UpdateWhatsappQueueReport',{'body':_0x2e0a4b,'options':{'where':{'uniqueid':_0x206799},'order':[['id',_0x9d1a('0x4')]],'limit':0x1},'log':_0x9d1a('0x5')});}; \ No newline at end of file +var _0x8f81=['../client','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x5a76cb,_0x450caf){var _0x572cb4=function(_0x577e99){while(--_0x577e99){_0x5a76cb['push'](_0x5a76cb['shift']());}};_0x572cb4(++_0x450caf);}(_0x8f81,0x1f4));var _0x18f8=function(_0x1e7fd3,_0x2f26ae){_0x1e7fd3=_0x1e7fd3-0x0;var _0x23605c=_0x8f81[_0x1e7fd3];return _0x23605c;};'use strict';var client=require(_0x18f8('0x0'));exports['create']=function(_0x170103){return client['Request']('CreateWhatsappQueueReport',{'body':_0x170103,'log':_0x18f8('0x1')});};exports[_0x18f8('0x2')]=function(_0x47bf1d,_0x258ae4){return client[_0x18f8('0x3')](_0x18f8('0x4'),{'body':_0x258ae4,'options':{'where':{'uniqueid':_0x47bf1d},'order':[['id','DESC']],'limit':0x1},'log':_0x18f8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b57f4b4..fe3bb85 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 _0x666c=['number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x26ac27,_0x574b86){var _0x44a599=function(_0x130e2c){while(--_0x130e2c){_0x26ac27['push'](_0x26ac27['shift']());}};_0x44a599(++_0x574b86);}(_0x666c,0x1f0));var _0xc666=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x666c[_0x231e16];return _0x570a7c;};'use strict';var schema=require(_0xc666('0x0'));var _=require(_0xc666('0x1'));var util=require(_0xc666('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xc666('0x3'))(_0xc666('0x4'));var strategy=require(_0xc666('0x5'));var queue=schema({'name':{'type':_0xc666('0x6'),'required':!![],'message':_0xc666('0x7')},'timeout':{'type':_0xc666('0x8'),'message':_0xc666('0x9')}});function writeLog(_0x12f820,_0x5b8cfe,_0x142da8){return logger[_0xc666('0xa')](util['format'](_0xc666('0xb'),_0x12f820,_0x5b8cfe[_0xc666('0xc')],_0x142da8));}function handleFindAgent(_0x5d4d44){return function(_0x58a76d){return _0x58a76d[_0xc666('0xc')][_0xc666('0xd')]()===_0x5d4d44[_0xc666('0xd')]();};}exports['consequence']=function(_0x49d789,_0x5bad47,_0x34d747,_0x1e96e4){return function(_0x21e176){try{var _0x27e325={'name':_0x5bad47[0x0],'timeout':_0x5bad47[0x1]};var _0x74e99c=queue[_0xc666('0x0')](_0x27e325,{'typecast':!![]});if(_0x74e99c[_0xc666('0xe')]){logger[_0xc666('0xf')](_0xc666('0x10'),_0x49d789,_[_0xc666('0x11')](_0x74e99c,'message')[_0xc666('0x12')](',\x20'));_0x21e176[_0xc666('0x13')]();}else{var _0x34ec62=_['find'](_0x34d747[_0xc666('0x14')],handleFindAgent(_0x27e325['name']));if(_0x34ec62){var _0x64bb42=(_0x27e325[_0xc666('0x15')]||0xa)*0x3e8;var _0x44cfa9,_0x5acd26;var _0x1b969f=seqqueue[_0xc666('0x16')](_0x64bb42);_0x1b969f['id']=_0x49d789;_0x1b969f[_0xc666('0x17')]=_0x64bb42;_0x1b969f['channel']=_0x1e96e4[_0xc666('0x18')];writeLog(_0x49d789,_0x34ec62,util['format'](_0xc666('0x19'),_0x64bb42));_0x34d747[_0xc666('0x1a')][_0x49d789]['on'](_0xc666('0x1b'),function(){logger[_0xc666('0xa')](_0xc666('0x1c'),_0x49d789);clearTimeout(_0x5acd26);_0x5acd26=undefined;_0x1b969f[_0xc666('0x1d')]();if(_0x34d747[_0xc666('0x1a')][_0x49d789]){delete _0x34d747['rules'][_0x49d789];}_0x21e176['stop']();});_0x34d747[_0xc666('0x1a')][_0x49d789]['on'](_0xc666('0x1e'),function(){if(_0x34d747['rules'][_0x49d789]){delete _0x34d747[_0xc666('0x1a')][_0x49d789];}});_0x5acd26=setTimeout(function(){logger['info'](_0xc666('0x1f'),_0x49d789);clearTimeout(_0x5acd26);_0x1b969f[_0xc666('0x1d')]();_0x21e176['next']();},_0x64bb42);strategy[_0xc666('0x20')](_0x1b969f,_0x34ec62,_0x34d747,_0x1e96e4);}else{logger['error'](_0xc666('0x21'),_0x49d789,_0x27e325[_0xc666('0xc')]);_0x21e176[_0xc666('0x13')]();}}}catch(_0x46f7a7){console[_0xc666('0x22')](_0x46f7a7);logger[_0xc666('0xf')]('[%s][QUEUE]\x20%s',_0x49d789,_0x46f7a7[_0xc666('0x23')]);_0x21e176[_0xc666('0x13')]();}};}; \ No newline at end of file +var _0x5934=['find','agents','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','util','../../../../config/logger','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message'];(function(_0x4b22d8,_0x7d1697){var _0x1882c5=function(_0x1c72d2){while(--_0x1c72d2){_0x4b22d8['push'](_0x4b22d8['shift']());}};_0x1882c5(++_0x7d1697);}(_0x5934,0xb5));var _0x4593=function(_0x2e15ca,_0x3c97e8){_0x2e15ca=_0x2e15ca-0x0;var _0x5e6b57=_0x5934[_0x2e15ca];return _0x5e6b57;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x4593('0x0'));var seqqueue=require('seq-queue');var logger=require(_0x4593('0x1'))('routing');var strategy=require(_0x4593('0x2'));var queue=schema({'name':{'type':_0x4593('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x4593('0x4'),'message':_0x4593('0x5')}});function writeLog(_0x52013e,_0x1dd2ff,_0x506b87){return logger[_0x4593('0x6')](util[_0x4593('0x7')](_0x4593('0x8'),_0x52013e,_0x1dd2ff[_0x4593('0x9')],_0x506b87));}function handleFindAgent(_0xc4fc5d){return function(_0x3f82f5){return _0x3f82f5[_0x4593('0x9')][_0x4593('0xa')]()===_0xc4fc5d[_0x4593('0xa')]();};}exports[_0x4593('0xb')]=function(_0x3958a9,_0x2b2160,_0x3c165d,_0x15b523){return function(_0x40fe88){try{var _0x3ec23d={'name':_0x2b2160[0x0],'timeout':_0x2b2160[0x1]};var _0x173ceb=queue[_0x4593('0xc')](_0x3ec23d,{'typecast':!![]});if(_0x173ceb[_0x4593('0xd')]){logger['error'](_0x4593('0xe'),_0x3958a9,_[_0x4593('0xf')](_0x173ceb,_0x4593('0x10'))['join'](',\x20'));_0x40fe88['stop']();}else{var _0x44637b=_[_0x4593('0x11')](_0x3c165d[_0x4593('0x12')],handleFindAgent(_0x3ec23d[_0x4593('0x9')]));if(_0x44637b){var _0x1da009=(_0x3ec23d['timeout']||0xa)*0x3e8;var _0xf0e291,_0xe76e3e;var _0x520fa3=seqqueue[_0x4593('0x13')](_0x1da009);_0x520fa3['id']=_0x3958a9;_0x520fa3['atimeout']=_0x1da009;_0x520fa3[_0x4593('0x14')]=_0x15b523[_0x4593('0x14')];writeLog(_0x3958a9,_0x44637b,util[_0x4593('0x7')]('START:%s',_0x1da009));_0x3c165d[_0x4593('0x15')][_0x3958a9]['on'](_0x4593('0x16'),function(){logger[_0x4593('0x6')](_0x4593('0x17'),_0x3958a9);clearTimeout(_0xe76e3e);_0xe76e3e=undefined;_0x520fa3[_0x4593('0x18')]();if(_0x3c165d['rules'][_0x3958a9]){delete _0x3c165d[_0x4593('0x15')][_0x3958a9];}_0x40fe88[_0x4593('0x19')]();});_0x3c165d[_0x4593('0x15')][_0x3958a9]['on'](_0x4593('0x1a'),function(){if(_0x3c165d[_0x4593('0x15')][_0x3958a9]){delete _0x3c165d['rules'][_0x3958a9];}});_0xe76e3e=setTimeout(function(){logger[_0x4593('0x6')](_0x4593('0x1b'),_0x3958a9);clearTimeout(_0xe76e3e);_0x520fa3['close']();_0x40fe88[_0x4593('0x1c')]();},_0x1da009);strategy['agent'](_0x520fa3,_0x44637b,_0x3c165d,_0x15b523);}else{logger[_0x4593('0x1d')](_0x4593('0x1e'),_0x3958a9,_0x3ec23d[_0x4593('0x9')]);_0x40fe88[_0x4593('0x19')]();}}}catch(_0x1abcce){console[_0x4593('0x1f')](_0x1abcce);logger[_0x4593('0x1d')](_0x4593('0x20'),_0x3958a9,_0x1abcce['stack']);_0x40fe88[_0x4593('0x19')]();}};}; \ 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 635c3d3..5785fd0 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 _0xa3af=['aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','account','created','isEmpty','body','Message','create','then','catch','error','stringify','finally','info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex','providerName','providerResponse','dialogState','lodash','moment'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa3af,0x1ae));var _0xfa3a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa3af[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xfa3a('0x0'));var moment=require(_0xfa3a('0x1'));var AWS=require(_0xfa3a('0x2'));var utils=require(_0xfa3a('0x3'));var logger=require(_0xfa3a('0x4'))(_0xfa3a('0x5'));var rpc={'chatMessage':require(_0xfa3a('0x6')),'openchannelMessage':require(_0xfa3a('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfa3a('0x8')),'faxMessage':require(_0xfa3a('0x9')),'whatsappMessage':require(_0xfa3a('0xa'))};exports[_0xfa3a('0xb')]=function(_0x28ae9a,_0x292555){return function(_0x124ff0){try{if(!_['isNil'](this[_0xfa3a('0xc')][_0xfa3a('0xd')])){logger['info'](_0xfa3a('0xe'),_0x28ae9a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x124ff0[_0xfa3a('0xf')]();}var _0x20cebb={'ContactId':this[_0xfa3a('0x10')]['id'],'sentAt':moment()[_0xfa3a('0x11')](_0xfa3a('0x12')),'direction':_0xfa3a('0x13')};if(this[_0xfa3a('0x14')]===_0xfa3a('0x15')||this['channel']==='whatsapp'){_0x20cebb[_0xfa3a('0x16')]=this[_0xfa3a('0xc')][_0xfa3a('0x16')];}var _0x41f0eb=this[_0xfa3a('0x14')];if(_0x41f0eb===_0xfa3a('0x17')){_0x20cebb[_0xfa3a('0x18')]=this['account']['id'];}else{_0x20cebb[_[_0xfa3a('0x19')](_0x41f0eb)+'AccountId']=this[_0xfa3a('0x1a')]['id'];}_0x20cebb[_['upperFirst'](_0x41f0eb)+'InteractionId']=this['interaction']['id'];if(this[_0xfa3a('0xc')][_0xfa3a('0x1b')]){var _0x23a3a7=_0x292555[0x4];if(!_[_0xfa3a('0x1c')](_0x23a3a7)){_0x20cebb[_0xfa3a('0x1d')]=utils['getMustacheRender'](_0x23a3a7,this);return rpc[_0x41f0eb+_0xfa3a('0x1e')][_0xfa3a('0x1f')](_0x20cebb)[_0xfa3a('0x20')](function(_0x2085d8){logger['info'](_0xfa3a('0xe'),_0x28ae9a,_0x20cebb['body']);})[_0xfa3a('0x21')](function(_0x12ac4e){logger[_0xfa3a('0x22')](_0xfa3a('0xe'),_0x28ae9a,JSON[_0xfa3a('0x23')](_0x12ac4e));})[_0xfa3a('0x24')](function(){logger[_0xfa3a('0x25')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28ae9a);_0x124ff0[_0xfa3a('0x26')]();});}else{logger['info'](_0xfa3a('0x27'),_0x28ae9a);_0x124ff0[_0xfa3a('0x26')]();}}else{var _0x172c12=this;var _0x4c0883=new AWS[(_0xfa3a('0x28'))]({'accessKeyId':_0x292555[0x0],'secretAccessKey':_0x292555[0x1],'region':_0x292555[0x2]});var _0x4c0f62={'botAlias':_0xfa3a('0x29'),'botName':_0x292555[0x3],'inputText':this[_0xfa3a('0x2a')][_0xfa3a('0x1d')],'userId':this[_0xfa3a('0x14')]+':'+this[_0xfa3a('0xc')]['id']['toString']()};_0x4c0883[_0xfa3a('0x2b')](_0x4c0f62,function(_0x22afd1,_0x5c8d39){if(_0x22afd1){logger[_0xfa3a('0x22')](_0xfa3a('0xe'),_0x28ae9a,_0x22afd1['message']);_0x124ff0[_0xfa3a('0xf')]();}else if(_0x5c8d39&&_0x5c8d39[_0xfa3a('0x2a')]){_0x172c12[_0xfa3a('0x1d')][_0xfa3a('0x2c')]=_0x5c8d39;_0x20cebb[_0xfa3a('0x1d')]=_0x5c8d39['message'];_0x20cebb[_0xfa3a('0x2d')]=_0xfa3a('0x2c');_0x20cebb[_0xfa3a('0x2e')]=JSON[_0xfa3a('0x23')](_0x5c8d39);return rpc[_0x41f0eb+_0xfa3a('0x1e')][_0xfa3a('0x1f')](_0x20cebb)[_0xfa3a('0x20')](function(_0x8824d3){logger[_0xfa3a('0x25')](_0xfa3a('0xe'),_0x28ae9a,_0x20cebb[_0xfa3a('0x1d')]);if(_0x5c8d39[_0xfa3a('0x2f')]=='Failed'){_0x124ff0[_0xfa3a('0xf')]();}else{_0x124ff0[_0xfa3a('0x26')]();}})[_0xfa3a('0x21')](function(_0x443de7){logger[_0xfa3a('0x22')]('[%s][AMAZONLEX]\x20%s',_0x28ae9a,JSON['stringify'](_0x443de7));_0x124ff0[_0xfa3a('0xf')]();});}else{_0x124ff0['next']();}});}}catch(_0xc61c70){logger[_0xfa3a('0x22')](_0xfa3a('0xe'),_0x28ae9a,JSON['stringify'](_0xc61c70));_0x124ff0[_0xfa3a('0x26')]();}};}; \ No newline at end of file +var _0x0419=['providerResponse','then','dialogState','Failed','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','whatsapp','phone','ChatWebsiteId','upperFirst','account','isEmpty','getMustacheRender','create','info','body','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','toString','postText','message','amazonlex','providerName'];(function(_0x3bc6dd,_0x1a2105){var _0x3c6b22=function(_0xf7ce24){while(--_0xf7ce24){_0x3bc6dd['push'](_0x3bc6dd['shift']());}};_0x3c6b22(++_0x1a2105);}(_0x0419,0x88));var _0x9041=function(_0x549443,_0x2e04c8){_0x549443=_0x549443-0x0;var _0x372ed3=_0x0419[_0x549443];return _0x372ed3;};'use strict';var _=require(_0x9041('0x0'));var moment=require('moment');var AWS=require(_0x9041('0x1'));var utils=require('./utils');var logger=require(_0x9041('0x2'))(_0x9041('0x3'));var rpc={'chatMessage':require(_0x9041('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9041('0x5')),'whatsappMessage':require(_0x9041('0x6'))};exports['consequence']=function(_0x12bc09,_0x3b343d){return function(_0x32b90f){try{if(!_[_0x9041('0x7')](this[_0x9041('0x8')][_0x9041('0x9')])){logger['info'](_0x9041('0xa'),_0x12bc09,_0x9041('0xb'));return _0x32b90f[_0x9041('0xc')]();}var _0x13455c={'ContactId':this[_0x9041('0xd')]['id'],'sentAt':moment()[_0x9041('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='sms'||this[_0x9041('0xf')]===_0x9041('0x10')){_0x13455c['phone']=this[_0x9041('0x8')][_0x9041('0x11')];}var _0x41fa75=this['channel'];if(_0x41fa75==='chat'){_0x13455c[_0x9041('0x12')]=this['account']['id'];}else{_0x13455c[_[_0x9041('0x13')](_0x41fa75)+'AccountId']=this[_0x9041('0x14')]['id'];}_0x13455c[_[_0x9041('0x13')](_0x41fa75)+'InteractionId']=this[_0x9041('0x8')]['id'];if(this[_0x9041('0x8')]['created']){var _0x49b298=_0x3b343d[0x4];if(!_[_0x9041('0x15')](_0x49b298)){_0x13455c['body']=utils[_0x9041('0x16')](_0x49b298,this);return rpc[_0x41fa75+'Message'][_0x9041('0x17')](_0x13455c)['then'](function(_0x1473a9){logger[_0x9041('0x18')](_0x9041('0xa'),_0x12bc09,_0x13455c[_0x9041('0x19')]);})[_0x9041('0x1a')](function(_0x45522b){logger[_0x9041('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x12bc09,JSON[_0x9041('0x1c')](_0x45522b));})[_0x9041('0x1d')](function(){logger[_0x9041('0x18')](_0x9041('0x1e'),_0x12bc09);_0x32b90f[_0x9041('0x1f')]();});}else{logger['info'](_0x9041('0x20'),_0x12bc09);_0x32b90f['stop']();}}else{var _0x859362=this;var _0x5614ff=new AWS[(_0x9041('0x21'))]({'accessKeyId':_0x3b343d[0x0],'secretAccessKey':_0x3b343d[0x1],'region':_0x3b343d[0x2]});var _0x4a67fa={'botAlias':_0x9041('0x22'),'botName':_0x3b343d[0x3],'inputText':this['message'][_0x9041('0x19')],'userId':this['channel']+':'+this[_0x9041('0x8')]['id'][_0x9041('0x23')]()};_0x5614ff[_0x9041('0x24')](_0x4a67fa,function(_0x54a300,_0x2b55cd){if(_0x54a300){logger[_0x9041('0x1b')](_0x9041('0xa'),_0x12bc09,_0x54a300[_0x9041('0x25')]);_0x32b90f['next']();}else if(_0x2b55cd&&_0x2b55cd[_0x9041('0x25')]){_0x859362[_0x9041('0x19')][_0x9041('0x26')]=_0x2b55cd;_0x13455c[_0x9041('0x19')]=_0x2b55cd[_0x9041('0x25')];_0x13455c[_0x9041('0x27')]=_0x9041('0x26');_0x13455c[_0x9041('0x28')]=JSON[_0x9041('0x1c')](_0x2b55cd);return rpc[_0x41fa75+'Message'][_0x9041('0x17')](_0x13455c)[_0x9041('0x29')](function(_0xfbdff3){logger['info'](_0x9041('0xa'),_0x12bc09,_0x13455c['body']);if(_0x2b55cd[_0x9041('0x2a')]==_0x9041('0x2b')){_0x32b90f[_0x9041('0xc')]();}else{_0x32b90f['stop']();}})[_0x9041('0x1a')](function(_0x23395d){logger[_0x9041('0x1b')](_0x9041('0xa'),_0x12bc09,JSON[_0x9041('0x1c')](_0x23395d));_0x32b90f[_0x9041('0xc')]();});}else{_0x32b90f[_0x9041('0xc')]();}});}}catch(_0x2f6e19){logger[_0x9041('0x1b')](_0x9041('0xa'),_0x12bc09,JSON['stringify'](_0x2f6e19));_0x32b90f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index d837c69..7b0c484 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 _0x7b77=['InteractionId','Message','inReplyTo','html','','';_0x4efae4[_0x77b7('0x34')]={'Auto-Submitted':_0x77b7('0x35'),'X-Auto-Response-Suppress':'All','Precedence':_0x77b7('0x36')};return mailRpc[_0x77b7('0x37')](this[_0x77b7('0x38')]['smtpOptions'],_0x4efae4)[_0x77b7('0x39')](function(_0x438aa7){logger['info'](_0x77b7('0x3a'),_0x2fc5d1);_0x4efae4[_0x77b7('0x3b')]=_0x438aa7['message'][_0x77b7('0x3b')];return rpc[_0x200276+'Message'][_0x77b7('0x3c')](_0x4efae4);})[_0x77b7('0x39')](function(_0x706bdf){logger['info'](_0x77b7('0x1a'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x706bdf));})[_0x77b7('0x3e')](function(_0x5ebb1a){logger[_0x77b7('0x3f')](_0x77b7('0x40'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x5ebb1a));})[_0x77b7('0x41')](function(){Promise[_0x77b7('0x42')]()[_0x77b7('0x39')](function(){if(_0x59bba7[0x0]!=='2'||_0x7e4e3e['autoreplyExecuted'])return;return rpc[_0x200276+'Interaction'][_0x77b7('0x43')](_0x7e4e3e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x68b92c){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x68b92c));})[_0x77b7('0x3e')](function(_0x631691){logger[_0x77b7('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x631691));});})[_0x77b7('0x39')](function(){_0x3a7118['next']();});});}else{return rpc[this[_0x77b7('0x11')]+_0x77b7('0x2f')][_0x77b7('0x3c')](_0x4efae4)['then'](function(){logger[_0x77b7('0x15')](_0x77b7('0x1a'),_0x2fc5d1,_0x4efae4['body']);})[_0x77b7('0x3e')](function(_0x370ecc){logger[_0x77b7('0x3f')](_0x77b7('0x1a'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x370ecc));})[_0x77b7('0x41')](function(){Promise['resolve']()[_0x77b7('0x39')](function(){if(_0x59bba7[0x0]!=='2'||_0x7e4e3e[_0x77b7('0x1d')])return;return rpc[_0x200276+_0x77b7('0x44')][_0x77b7('0x43')](_0x7e4e3e['id'],{'autoreplyExecuted':!![]})[_0x77b7('0x39')](function(_0xa00c52){logger['info'](_0x77b7('0x1e'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0xa00c52));})[_0x77b7('0x3e')](function(_0x21c5c9){logger[_0x77b7('0x3f')](_0x77b7('0x45'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x21c5c9));});})[_0x77b7('0x39')](function(){_0x3a7118[_0x77b7('0x1c')]();});});}}}catch(_0x59227b){logger['error'](_0x77b7('0x1a'),_0x2fc5d1,JSON[_0x77b7('0x3d')](_0x59227b));_0x3a7118[_0x77b7('0x46')]();}};}; \ No newline at end of file +var _0x546a=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','body','message','from','phone','subject','startsWith','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','sendMailMessage','smtpOptions'];(function(_0x25eec0,_0x2c2f2f){var _0x2e4be3=function(_0x585e61){while(--_0x585e61){_0x25eec0['push'](_0x25eec0['shift']());}};_0x2e4be3(++_0x2c2f2f);}(_0x546a,0x11a));var _0xa546=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x546a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xa546('0x0'));var utils=require(_0xa546('0x1'));var logger=require(_0xa546('0x2'))(_0xa546('0x3'));var rpc={'chatMessage':require(_0xa546('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa546('0x5')),'smsMessage':require(_0xa546('0x6')),'faxMessage':require(_0xa546('0x7')),'whatsappMessage':require(_0xa546('0x8')),'chatInteraction':require(_0xa546('0x9')),'openchannelInteraction':require(_0xa546('0xa')),'mailInteraction':require(_0xa546('0xb')),'smsInteraction':require(_0xa546('0xc')),'faxInteraction':require(_0xa546('0xd')),'whatsappInteraction':require(_0xa546('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x409618,_0xd8d507,_0x2d29db,_0x4e6e0e){return function(_0x564a05){try{var _0x5378ed=this['channel'];if(_0x5378ed===_0xa546('0xf')&&_0x4e6e0e['body'][_0xa546('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x409618,_0xa546('0x11'));return _0x564a05[_0xa546('0x12')]();}if(_0xd8d507[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this[_0xa546('0x13')][_0xa546('0x14')])){logger[_0xa546('0x15')](_0xa546('0x16'),_0x409618,_0xa546('0x17'));return _0x564a05[_0xa546('0x12')]();}if(_0xd8d507[0x0]==='2'&&this[_0xa546('0x13')]['autoreplyExecuted']){logger[_0xa546('0x15')](_0xa546('0x18'),_0x409618,'One\x20Time\x20already\x20sent');return _0x564a05[_0xa546('0x12')]();}var _0x48db8e={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xa546('0x19')),'direction':_0xa546('0x1a')};if(this[_0xa546('0x1b')]===_0xa546('0xf')){_0x48db8e['body']=utils[_0xa546('0x1c')](_0xd8d507[0x2],this);}else{_0x48db8e[_0xa546('0x1d')]=utils[_0xa546('0x1c')](_0xd8d507[0x1],this);}if(this['message']){_0x48db8e['to']=this[_0xa546('0x1e')][_0xa546('0x1f')]||'';if(this[_0xa546('0x1b')]===_0xa546('0xf')&&_0xd8d507[0x1]==='1'){_0x48db8e['cc']=this[_0xa546('0x1e')]['cc']||'';}_0x48db8e['from']=this['message']['to']||'';_0x48db8e[_0xa546('0x20')]=this[_0xa546('0x1e')]['phone']||'';_0x48db8e['read']=!![];if(this[_0xa546('0x1e')][_0xa546('0x21')]){_0x48db8e[_0xa546('0x21')]='';_0x48db8e[_0xa546('0x21')]+=_[_0xa546('0x22')](this[_0xa546('0x1e')][_0xa546('0x21')],'Re:')?'':_0xa546('0x23');_0x48db8e['subject']+=this['message']['subject'];}}if(this['channel']===_0xa546('0x24')){_0x48db8e['ChatWebsiteId']=this[_0xa546('0x25')]['id'];}else{_0x48db8e[_[_0xa546('0x26')](this[_0xa546('0x1b')])+_0xa546('0x27')]=this[_0xa546('0x25')]['id'];}_0x48db8e[_['upperFirst'](this[_0xa546('0x1b')])+_0xa546('0x28')]=this[_0xa546('0x13')]['id'];var _0x3958a2=this[_0xa546('0x13')];if(rpc[this[_0xa546('0x1b')]+_0xa546('0x29')]){if(this['channel']==='mail'){_0x48db8e[_0xa546('0x2a')]=this[_0xa546('0x1e')][_0xa546('0x2b')];_0x48db8e[_0xa546('0x2c')]=_0xa546('0x2d')+_[_0xa546('0x2e')](_0x48db8e[_0xa546('0x1d')],']+(>|$)/g,''),'priorityTrue':_0x5941bd[0x1],'priorityFalse':_0x5941bd[0x2]};var _0x5f3bc9=gotoif[_0x3ffd('0x0')](_0x1f5cb6,{'typecast':!![]});if(_0x5f3bc9[_0x3ffd('0xc')]){logger[_0x3ffd('0xd')](_0x3ffd('0xe'),_0x4c2b11,_['map'](_0x5f3bc9,_0x3ffd('0xf'))['join'](',\x20'));_0x11571c[_0x3ffd('0x10')]();}else{try{var _0x270ceb=eval('('+_0x1f5cb6[_0x3ffd('0x11')]+')');var _0x441b13=_0x270ceb?_0x1f5cb6[_0x3ffd('0x12')]:_0x1f5cb6[_0x3ffd('0x13')];logger[_0x3ffd('0x14')](_0x3ffd('0x15'),_0x4c2b11,_0x1f5cb6[_0x3ffd('0x11')],_0x270ceb,_0x441b13||_0x3ffd('0x16'));if(_0x441b13){var _0x113bed=_['findIndex'](_0x11571c['rules'](),{'p':_0x441b13});if(_0x113bed>=0x0){logger[_0x3ffd('0x14')](_0x3ffd('0x17'),_0x4c2b11,_0x441b13||_0x3ffd('0x16'),_0x113bed);_0x11571c[_0x3ffd('0x16')](_0x113bed);}else{logger['info'](_0x3ffd('0x18'),_0x4c2b11,_0x441b13||_0x3ffd('0x16'));_0x11571c['stop']();}}else{_0x11571c['next']();}}catch(_0x1887c9){logger['error'](_0x3ffd('0x19'),_0x4c2b11,_0x1887c9[_0x3ffd('0xf')]);_0x11571c[_0x3ffd('0x10')]();}}}catch(_0x4853cf){logger[_0x3ffd('0xd')]('[%s][GOTOIF]\x20%s',_0x4c2b11,JSON[_0x3ffd('0x1a')](_0x4853cf));_0x11571c[_0x3ffd('0x10')]();}};}; \ No newline at end of file +var _0x01eb=['getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x01eb,0x130));var _0xb01e=function(_0x368abc,_0x8bbc6f){_0x368abc=_0x368abc-0x0;var _0x2fd9f0=_0x01eb[_0x368abc];return _0x2fd9f0;};'use strict';var schema=require(_0xb01e('0x0'));var _=require('lodash');var htmlToText=require(_0xb01e('0x1'));var utils=require('./utils');var logger=require(_0xb01e('0x2'))(_0xb01e('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xb01e('0x4'),'message':_0xb01e('0x5')},'priorityFalse':{'type':_0xb01e('0x4'),'message':_0xb01e('0x6')}});exports[_0xb01e('0x7')]=function(_0x2f2ae9,_0x1a81b7){return function(_0x31a3c6){try{var _0x9316ab={'condition':htmlToText['fromString'](utils[_0xb01e('0x8')](_0x1a81b7[0x0],this),{'wordwrap':![]})[_0xb01e('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1a81b7[0x1],'priorityFalse':_0x1a81b7[0x2]};var _0x2820a6=gotoif[_0xb01e('0x0')](_0x9316ab,{'typecast':!![]});if(_0x2820a6['length']){logger[_0xb01e('0xa')](_0xb01e('0xb'),_0x2f2ae9,_[_0xb01e('0xc')](_0x2820a6,_0xb01e('0xd'))[_0xb01e('0xe')](',\x20'));_0x31a3c6[_0xb01e('0xf')]();}else{try{var _0x461597=eval('('+_0x9316ab[_0xb01e('0x10')]+')');var _0x107b1f=_0x461597?_0x9316ab[_0xb01e('0x11')]:_0x9316ab[_0xb01e('0x12')];logger[_0xb01e('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2f2ae9,_0x9316ab[_0xb01e('0x10')],_0x461597,_0x107b1f||_0xb01e('0x14'));if(_0x107b1f){var _0x5b36c8=_['findIndex'](_0x31a3c6[_0xb01e('0x15')](),{'p':_0x107b1f});if(_0x5b36c8>=0x0){logger[_0xb01e('0x13')](_0xb01e('0x16'),_0x2f2ae9,_0x107b1f||_0xb01e('0x14'),_0x5b36c8);_0x31a3c6[_0xb01e('0x14')](_0x5b36c8);}else{logger['info'](_0xb01e('0x17'),_0x2f2ae9,_0x107b1f||_0xb01e('0x14'));_0x31a3c6[_0xb01e('0xf')]();}}else{_0x31a3c6[_0xb01e('0x14')]();}}catch(_0x959dec){logger[_0xb01e('0xa')](_0xb01e('0x18'),_0x2f2ae9,_0x959dec[_0xb01e('0xd')]);_0x31a3c6[_0xb01e('0xf')]();}}}catch(_0x2fe2ca){logger[_0xb01e('0xa')](_0xb01e('0xb'),_0x2f2ae9,JSON[_0xb01e('0x19')](_0x2fe2ca));_0x31a3c6[_0xb01e('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 9efe369..84324f9 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 _0xa139=['length','error','[%s][GOTOP]\x20%s','join','stop','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xa139,0x198));var _0x9a13=function(_0x4e7c09,_0x445033){_0x4e7c09=_0x4e7c09-0x0;var _0x5c3983=_0xa139[_0x4e7c09];return _0x5c3983;};'use strict';var schema=require(_0x9a13('0x0'));var _=require('lodash');var logger=require(_0x9a13('0x1'))(_0x9a13('0x2'));var gotop=schema({'priority':{'type':_0x9a13('0x3'),'required':!![],'message':_0x9a13('0x4')}});exports[_0x9a13('0x5')]=function(_0x28a005,_0x147c55){return function(_0x2c0198){try{var _0x29e0c8={'priority':_0x147c55[0x0]};var _0x254c09=gotop[_0x9a13('0x0')](_0x29e0c8,{'typecast':!![]});if(_0x254c09[_0x9a13('0x6')]){logger[_0x9a13('0x7')](_0x9a13('0x8'),_0x28a005,_['map'](_0x254c09,'message')[_0x9a13('0x9')](',\x20'));_0x2c0198[_0x9a13('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x28a005,_0x29e0c8[_0x9a13('0xb')]);if(_0x29e0c8[_0x9a13('0xb')]){var _0x1dd442=_[_0x9a13('0xc')](_0x2c0198[_0x9a13('0xd')](),{'p':_0x29e0c8['priority']});if(_0x1dd442>=0x0){logger['info'](_0x9a13('0xe'),_0x28a005,_0x29e0c8[_0x9a13('0xb')]||'next',_0x1dd442);_0x2c0198['next'](_0x1dd442);}else{logger[_0x9a13('0xf')](_0x9a13('0x10'),_0x28a005,_0x29e0c8['priority']||_0x9a13('0x11'));_0x2c0198[_0x9a13('0xa')]();}}else{_0x2c0198[_0x9a13('0x11')]();}}}catch(_0x3d6e38){logger['error'](_0x9a13('0x8'),_0x28a005,JSON['stringify'](_0x3d6e38));_0x2c0198[_0x9a13('0xa')]();}};}; \ No newline at end of file +var _0x793d=['join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x793d,0x128));var _0xd793=function(_0x584734,_0x20f982){_0x584734=_0x584734-0x0;var _0x1994d6=_0x793d[_0x584734];return _0x1994d6;};'use strict';var schema=require(_0xd793('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xd793('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd793('0x2')}});exports[_0xd793('0x3')]=function(_0x4a8f7c,_0x4fdbac){return function(_0x2e68b0){try{var _0x2ee2e5={'priority':_0x4fdbac[0x0]};var _0x524a9d=gotop[_0xd793('0x0')](_0x2ee2e5,{'typecast':!![]});if(_0x524a9d[_0xd793('0x4')]){logger[_0xd793('0x5')](_0xd793('0x6'),_0x4a8f7c,_['map'](_0x524a9d,_0xd793('0x7'))[_0xd793('0x8')](',\x20'));_0x2e68b0['stop']();}else{logger[_0xd793('0x9')](_0xd793('0xa'),_0x4a8f7c,_0x2ee2e5['priority']);if(_0x2ee2e5[_0xd793('0xb')]){var _0x3a4326=_[_0xd793('0xc')](_0x2e68b0[_0xd793('0xd')](),{'p':_0x2ee2e5[_0xd793('0xb')]});if(_0x3a4326>=0x0){logger[_0xd793('0x9')](_0xd793('0xe'),_0x4a8f7c,_0x2ee2e5[_0xd793('0xb')]||'next',_0x3a4326);_0x2e68b0[_0xd793('0xf')](_0x3a4326);}else{logger[_0xd793('0x9')](_0xd793('0x10'),_0x4a8f7c,_0x2ee2e5[_0xd793('0xb')]||'next');_0x2e68b0[_0xd793('0x11')]();}}else{_0x2e68b0[_0xd793('0xf')]();}}}catch(_0x103d97){logger[_0xd793('0x5')](_0xd793('0x6'),_0x4a8f7c,JSON[_0xd793('0x12')](_0x103d97));_0x2e68b0[_0xd793('0x11')]();}};}; \ 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 d2386f1..60704f8 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 _0xaf5c=['stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','upperFirst','channel','AccountId','InteractionId','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xaf5c,0x161));var _0xcaf5=function(_0xdace6b,_0x48cccb){_0xdace6b=_0xdace6b-0x0;var _0x43f4e6=_0xaf5c[_0xdace6b];return _0x43f4e6;};'use strict';var _=require('lodash');var utils=require(_0xcaf5('0x0'));var logger=require(_0xcaf5('0x1'))(_0xcaf5('0x2'));var rpc={'chatMessage':require(_0xcaf5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcaf5('0x4')),'smsMessage':require(_0xcaf5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcaf5('0x6'))};exports['consequence']=function(_0x1fd2d7,_0x118558){return function(_0x3695d5){try{var _0x17c418={'body':utils[_0xcaf5('0x7')](_0x118558[0x0],this),'ContactId':this[_0xcaf5('0x8')]['id']};if(this['channel']==='chat'){_0x17c418['ChatWebsiteId']=this['account']['id'];}else{_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xb')]=this['account']['id'];}_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xc')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xcaf5('0xa')]+_0xcaf5('0xd')]['create'](_0x17c418)[_0xcaf5('0xe')](function(_0x121296){logger[_0xcaf5('0xf')]('[%s][MESSAGE]\x20%s',_0x1fd2d7,_0x17c418[_0xcaf5('0x10')]);_0x3695d5['next']();})[_0xcaf5('0x11')](function(_0x44df7e){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x44df7e));_0x3695d5[_0xcaf5('0x15')]();});}}catch(_0x124a58){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x124a58));_0x3695d5[_0xcaf5('0x15')]();}};}; \ No newline at end of file +var _0xd452=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','routing','../../rpc/chatMessage'];(function(_0x40bb37,_0x2f4adf){var _0x29eca8=function(_0x3c1845){while(--_0x3c1845){_0x40bb37['push'](_0x40bb37['shift']());}};_0x29eca8(++_0x2f4adf);}(_0xd452,0x98));var _0x2d45=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xd452[_0x1f5887];return _0x21774b;};'use strict';var _=require(_0x2d45('0x0'));var utils=require(_0x2d45('0x1'));var logger=require('../../../../config/logger')(_0x2d45('0x2'));var rpc={'chatMessage':require(_0x2d45('0x3')),'openchannelMessage':require(_0x2d45('0x4')),'mailMessage':require(_0x2d45('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2d45('0x6'))};exports[_0x2d45('0x7')]=function(_0x36d9db,_0x13c884){return function(_0x18150d){try{var _0x344ee2={'body':utils['getMustacheRender'](_0x13c884[0x0],this),'ContactId':this[_0x2d45('0x8')]['id']};if(this[_0x2d45('0x9')]===_0x2d45('0xa')){_0x344ee2['ChatWebsiteId']=this[_0x2d45('0xb')]['id'];}else{_0x344ee2[_[_0x2d45('0xc')](this[_0x2d45('0x9')])+'AccountId']=this[_0x2d45('0xb')]['id'];}_0x344ee2[_[_0x2d45('0xc')](this[_0x2d45('0x9')])+_0x2d45('0xd')]=this[_0x2d45('0xe')]['id'];if(rpc[this['channel']+_0x2d45('0xf')]){return rpc[this['channel']+_0x2d45('0xf')][_0x2d45('0x10')](_0x344ee2)[_0x2d45('0x11')](function(_0x39e68f){logger[_0x2d45('0x12')]('[%s][MESSAGE]\x20%s',_0x36d9db,_0x344ee2[_0x2d45('0x13')]);_0x18150d[_0x2d45('0x14')]();})[_0x2d45('0x15')](function(_0x481c0e){logger[_0x2d45('0x16')](_0x2d45('0x17'),_0x36d9db,JSON['stringify'](_0x481c0e));_0x18150d[_0x2d45('0x18')]();});}}catch(_0x149894){logger[_0x2d45('0x16')](_0x2d45('0x17'),_0x36d9db,JSON[_0x2d45('0x19')](_0x149894));_0x18150d['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 c11d230..a5e786b 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 _0x6bf9=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils','../../../../config/logger','routing'];(function(_0x58613f,_0x24c9ae){var _0x2a0ac6=function(_0x4d181e){while(--_0x4d181e){_0x58613f['push'](_0x58613f['shift']());}};_0x2a0ac6(++_0x24c9ae);}(_0x6bf9,0x96));var _0x96bf=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x6bf9[_0x21c2c8];return _0x4dd745;};'use strict';var utils=require(_0x96bf('0x0'));var logger=require(_0x96bf('0x1'))(_0x96bf('0x2'));exports[_0x96bf('0x3')]=function(_0x2106ec,_0x36bb0e){return function(_0x3baf8c){try{logger[_0x96bf('0x4')](_0x96bf('0x5'),_0x2106ec,utils[_0x96bf('0x6')](_0x36bb0e[0x0],this));_0x3baf8c['next']();}catch(_0x123120){logger[_0x96bf('0x7')](_0x96bf('0x5'),_0x2106ec,JSON[_0x96bf('0x8')](_0x123120));_0x3baf8c['stop']();}};}; \ No newline at end of file +var _0x6e69=['stringify','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','error'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6e69,0x12e));var _0x96e6=function(_0x5976e1,_0x45af16){_0x5976e1=_0x5976e1-0x0;var _0x406f46=_0x6e69[_0x5976e1];return _0x406f46;};'use strict';var utils=require(_0x96e6('0x0'));var logger=require(_0x96e6('0x1'))(_0x96e6('0x2'));exports[_0x96e6('0x3')]=function(_0xd20cf1,_0x3b80e0){return function(_0x4bfdaa){try{logger['info'](_0x96e6('0x4'),_0xd20cf1,utils['getMustacheRender'](_0x3b80e0[0x0],this));_0x4bfdaa['next']();}catch(_0x35b2a8){logger[_0x96e6('0x5')]('[%s][NOOP]\x20%s',_0xd20cf1,JSON[_0x96e6('0x6')](_0x35b2a8));_0x4bfdaa['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 3e0df7e..881ca7a 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 _0x7eb5=['localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','channel','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','close','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','redis'];(function(_0x16bc1b,_0x33a54e){var _0x5cd224=function(_0x310b7f){while(--_0x310b7f){_0x16bc1b['push'](_0x16bc1b['shift']());}};_0x5cd224(++_0x33a54e);}(_0x7eb5,0x14d));var _0x57eb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7eb5[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x57eb('0x0'));var _=require(_0x57eb('0x1'));var util=require(_0x57eb('0x2'));var seqqueue=require(_0x57eb('0x3'));var moment=require(_0x57eb('0x4'));var Redis=require(_0x57eb('0x5'));var config=require(_0x57eb('0x6'));var logger=require(_0x57eb('0x7'))(_0x57eb('0x8'));var strategy=require('./strategy');config['redis']=_[_0x57eb('0x9')](config[_0x57eb('0xa')],{'host':_0x57eb('0xb'),'port':0x18eb});var io=require(_0x57eb('0xc'))(new Redis(config[_0x57eb('0xa')]));var attributes=['id',_0x57eb('0xd'),_0x57eb('0xe'),_0x57eb('0xf'),_0x57eb('0x10'),_0x57eb('0x11')];function emit(_0x1ab527,_0xa098ac,_0x10bb41){io['to'](_0x1ab527)[_0x57eb('0x12')](_0xa098ac,_0x10bb41);}function emitChannelQueueInteraction(_0x4ee3fe,_0x573d9c,_0x137e1b,_0x75296,_0x2b2beb,_0x1ac09d,_0x5e3f8d,_0x32921c){var _0x403445=_[_0x57eb('0x13')](_0x137e1b);_0x403445['queue_id']=_0x32921c;_0x403445[_0x57eb('0xf')]=_0x573d9c;_0x403445[_0x57eb('0xe')]=_0x75296;_0x403445['id']=_0x2b2beb;if(_0x1ac09d){attributes[_0x57eb('0x14')](_['capitalize'](_0x4ee3fe)+'InteractionId');_0x5e3f8d[util[_0x57eb('0x15')](_0x57eb('0x16'),_0x4ee3fe)][_0x2b2beb]=_['pick'](_0x403445,attributes);}else{delete _0x5e3f8d[util[_0x57eb('0x15')]('%sQueuesWaitingInteractions',_0x4ee3fe)][_0x2b2beb];}emit(util[_0x57eb('0x15')]('%s:queue:%s',_0x4ee3fe,_0x573d9c),util['format'](_0x57eb('0x17'),_0x4ee3fe,_0x1ac09d?_0x57eb('0x18'):_0x57eb('0x19')),_[_0x57eb('0x1a')](_0x403445,attributes));}var rpc={'openchannelQueueReport':require(_0x57eb('0x1b')),'mailQueueReport':require(_0x57eb('0x1c')),'chatQueueReport':require(_0x57eb('0x1d')),'smsQueueReport':require(_0x57eb('0x1e')),'faxQueueReport':require(_0x57eb('0x1f')),'whatsappQueueReport':require(_0x57eb('0x20')),'chatInteraction':require(_0x57eb('0x21')),'faxInteraction':require(_0x57eb('0x22')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x57eb('0x23')),'smsInteraction':require(_0x57eb('0x24')),'whatsappInteraction':require(_0x57eb('0x25'))};var queue=schema({'name':{'type':_0x57eb('0x26'),'required':!![],'message':_0x57eb('0x27')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x510aa8,_0x4f7c01,_0x2beefa,_0xf5ae37){if(_0x510aa8&&_0x4f7c01&&_0x2beefa){_0x4f7c01[_0x57eb('0x28')]+=0x1;var _0x4da8f7={'uniqueid':_0x510aa8,'from':_0x2beefa['body']?_0x2beefa[_0x57eb('0x29')][_0x57eb('0x10')]:'','joinAt':moment()[_0x57eb('0x15')](_0x57eb('0x2a')),'ContactId':_0x2beefa['contact']?_0x2beefa[_0x57eb('0x2b')]['id']:null,'ListId':_0x2beefa[_0x57eb('0x2c')]?_0x2beefa[_0x57eb('0x2c')]['id']:null};_0x4da8f7[_['upperFirst'](_0x2beefa['channel'])+_0x57eb('0x2d')]=_0x4f7c01['id']||null;_0x4da8f7[_[_0x57eb('0x2e')](_0x2beefa[_0x57eb('0x2f')])+'InteractionId']=_0x2beefa[_0x57eb('0x30')]?_0x2beefa[_0x57eb('0x30')]['id']:null;_0x4da8f7[_[_0x57eb('0x2e')](_0x2beefa[_0x57eb('0x2f')])+'MessageId']=_0x2beefa[_0x57eb('0x31')]?_0x2beefa[_0x57eb('0x31')]['id']:null;_0x4da8f7[_[_0x57eb('0x2e')](_0x2beefa[_0x57eb('0x2f')])+(_0x2beefa[_0x57eb('0x2f')]!==_0x57eb('0x32')?'AccountId':_0x57eb('0x33'))]=_0x2beefa[_0x57eb('0xe')]?_0x2beefa[_0x57eb('0xe')]['id']:null;logger[_0x57eb('0x34')](util['format'](_0x57eb('0x35'),_0x510aa8,_0x4f7c01[_0x57eb('0x36')]));emitChannelQueueInteraction(_0x2beefa[_0x57eb('0x2f')],_0x4f7c01['name'],_0x4da8f7,_0x2beefa[_0x57eb('0xe')]['name'],_0x2beefa[_0x57eb('0x31')]['id'],!![],_0xf5ae37,_0x4f7c01['id']);if(rpc[_0x2beefa[_0x57eb('0x2f')]+_0x57eb('0x37')]){return rpc[_0x2beefa[_0x57eb('0x2f')]+_0x57eb('0x37')][_0x57eb('0x38')](_0x4da8f7)[_0x57eb('0x39')](function(_0x17ef71){logger[_0x57eb('0x3a')](_0x57eb('0x3b'),_0x17ef71);});}}}function stopRouting(_0x3b1422,_0x211af1,_0x1e3543,_0x9e2bd9){if(_0x3b1422&&_0x211af1){_0x211af1[_0x57eb('0x28')]-=0x1;var _0x154b52={'leaveAt':moment()['format'](_0x57eb('0x2a')),'acceptAt':moment()[_0x57eb('0x15')](_0x57eb('0x2a')),'reason':_0x57eb('0x3c')};logger[_0x57eb('0x34')](util[_0x57eb('0x15')](_0x57eb('0x3d'),_0x3b1422,_0x211af1[_0x57eb('0x36')]));emitChannelQueueInteraction(_0x1e3543[_0x57eb('0x2f')],_0x211af1['name'],_0x1e3543['body'],_0x1e3543[_0x57eb('0xe')]['name'],_0x1e3543['message']['id'],![],_0x9e2bd9,_0x211af1['id']);return rpc[_0x1e3543['channel']+_0x57eb('0x3e')][_0x57eb('0x3f')](_0x1e3543[_0x57eb('0x30')]['id'],{'queueId':_0x211af1['id']})[_0x57eb('0x40')](function(){if(rpc[_0x1e3543[_0x57eb('0x2f')]+_0x57eb('0x37')]){return rpc[_0x1e3543[_0x57eb('0x2f')]+_0x57eb('0x37')]['update'](_0x3b1422,_0x154b52)[_0x57eb('0x39')](function(_0x53d913){logger[_0x57eb('0x3a')]('update\x20queue\x20report',_0x53d913);});}});}}function endRouting(_0xeef180,_0x2321bc,_0x4a864c,_0x315c74){if(_0xeef180&&_0x2321bc){_0x2321bc['waiting']-=0x1;var _0x47a6c5={'leaveAt':moment()[_0x57eb('0x15')](_0x57eb('0x2a')),'exitAt':moment()[_0x57eb('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x57eb('0x41')};logger[_0x57eb('0x34')](util[_0x57eb('0x15')](_0x57eb('0x42'),_0xeef180,_0x2321bc[_0x57eb('0x36')]));emitChannelQueueInteraction(_0x4a864c[_0x57eb('0x2f')],_0x2321bc[_0x57eb('0x36')],_0x4a864c[_0x57eb('0x29')],_0x4a864c[_0x57eb('0xe')][_0x57eb('0x36')],_0x4a864c[_0x57eb('0x31')]['id'],![],_0x315c74);if(rpc[_0x4a864c[_0x57eb('0x2f')]+_0x57eb('0x37')]){return rpc[_0x4a864c[_0x57eb('0x2f')]+_0x57eb('0x37')][_0x57eb('0x3f')](_0xeef180,_0x47a6c5)['catch'](function(_0x5118c3){logger['error'](_0x57eb('0x43'),_0x5118c3);});}}}function handleFindQueue(_0x41cb80){return function(_0x20590b){return _0x20590b[_0x57eb('0x36')][_0x57eb('0x44')]()===_0x41cb80[_0x57eb('0x44')]();};}exports[_0x57eb('0x45')]=function(_0x4d9462,_0x5d9f7b,_0x565531,_0x172e3f){return function(_0x3d1169){try{var _0x1b01c4={'name':_0x5d9f7b[0x0],'timeout':_0x5d9f7b[0x1]};var _0x5d2b9c=queue['validate'](_0x1b01c4,{'typecast':!![]});if(_0x5d2b9c['length']){logger['error']('[%s][QUEUE]\x20%s',_0x4d9462,_[_0x57eb('0x46')](_0x5d2b9c,_0x57eb('0x31'))['join'](',\x20'));_0x3d1169[_0x57eb('0x47')]();}else{var _0x1260dd=_['find'](_0x565531[_0x172e3f[_0x57eb('0x2f')]+_0x57eb('0x48')],handleFindQueue(_0x1b01c4[_0x57eb('0x36')]));if(_0x1260dd){startRouting(_0x4d9462,_0x1260dd,_0x172e3f,_0x565531);var _0x33d7fd=(_0x1260dd[_0x57eb('0x41')]||0xa)*0x3e8;var _0x45e929=(_0x1b01c4[_0x57eb('0x41')]||0x14)*0x3e8;var _0x220d76;if(_0x33d7fd>_0x45e929){_0x45e929=_0x33d7fd;}var _0x4f7652=seqqueue[_0x57eb('0x49')](_0x33d7fd);_0x4f7652['id']=_0x4d9462;_0x4f7652[_0x57eb('0x4a')]=_0x33d7fd;_0x4f7652[_0x57eb('0x4b')]=_0x45e929;_0x4f7652[_0x57eb('0x2f')]=_0x172e3f['channel'];_0x565531[_0x57eb('0x4c')][_0x4d9462]['on'](_0x57eb('0x4d'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4d9462);stopRouting(_0x4d9462,_0x1260dd,_0x172e3f,_0x565531);clearTimeout(_0x220d76);_0x220d76=undefined;_0x4f7652[_0x57eb('0x4e')](!![]);if(_0x565531[_0x57eb('0x4c')][_0x4d9462]){delete _0x565531['rules'][_0x4d9462];}_0x3d1169['stop']();});_0x565531[_0x57eb('0x4c')][_0x4d9462]['on'](_0x57eb('0x4f'),function(){if(_0x565531[_0x57eb('0x4c')][_0x4d9462]){delete _0x565531[_0x57eb('0x4c')][_0x4d9462];}});_0x220d76=setTimeout(function(){logger[_0x57eb('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4d9462);endRouting(_0x4d9462,_0x1260dd,_0x172e3f,_0x565531);clearTimeout(_0x220d76);_0x4f7652['close'](!![]);_0x3d1169['next']();},_0x45e929);switch(_0x1260dd[_0x57eb('0x50')]){case'rrmemory':strategy[_0x57eb('0x51')](_0x4f7652,_0x1260dd,_0x565531,_0x172e3f);break;default:strategy[_0x57eb('0x52')](_0x4f7652,_0x1260dd,_0x565531,_0x172e3f);}}else{logger[_0x57eb('0x3a')](_0x57eb('0x53'),_0x4d9462,_0x1b01c4[_0x57eb('0x36')]);_0x3d1169[_0x57eb('0x47')]();}}}catch(_0x3db68c){logger['error'](_0x57eb('0x54'),_0x4d9462,_0x3db68c[_0x57eb('0x55')]);_0x3d1169[_0x57eb('0x47')]();}};}; \ No newline at end of file +var _0x76de=['%sQueuesWaitingInteractions','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','chat','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','error','create\x20queue\x20report','accepted','Interaction','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','emit','clone','queue','push','capitalize','InteractionId','format'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x76de,0x19a));var _0xe76d=function(_0x2ed7d9,_0x3e0125){_0x2ed7d9=_0x2ed7d9-0x0;var _0x473fa5=_0x76de[_0x2ed7d9];return _0x473fa5;};'use strict';var schema=require(_0xe76d('0x0'));var _=require(_0xe76d('0x1'));var util=require(_0xe76d('0x2'));var seqqueue=require(_0xe76d('0x3'));var moment=require('moment');var Redis=require(_0xe76d('0x4'));var config=require(_0xe76d('0x5'));var logger=require(_0xe76d('0x6'))('routing');var strategy=require(_0xe76d('0x7'));config[_0xe76d('0x8')]=_[_0xe76d('0x9')](config[_0xe76d('0x8')],{'host':_0xe76d('0xa'),'port':0x18eb});var io=require(_0xe76d('0xb'))(new Redis(config[_0xe76d('0x8')]));var attributes=['id',_0xe76d('0xc'),'account','queue','from','joinAt'];function emit(_0x5178cd,_0x351fc3,_0x1e2419){io['to'](_0x5178cd)[_0xe76d('0xd')](_0x351fc3,_0x1e2419);}function emitChannelQueueInteraction(_0x4e4970,_0x3d4b25,_0x4d3a8b,_0x19c29a,_0x517d51,_0x1b10ca,_0x348c5a,_0x33f20c){var _0x35254f=_[_0xe76d('0xe')](_0x4d3a8b);_0x35254f['queue_id']=_0x33f20c;_0x35254f[_0xe76d('0xf')]=_0x3d4b25;_0x35254f['account']=_0x19c29a;_0x35254f['id']=_0x517d51;if(_0x1b10ca){attributes[_0xe76d('0x10')](_[_0xe76d('0x11')](_0x4e4970)+_0xe76d('0x12'));_0x348c5a[util[_0xe76d('0x13')](_0xe76d('0x14'),_0x4e4970)][_0x517d51]=_['pick'](_0x35254f,attributes);}else{delete _0x348c5a[util[_0xe76d('0x13')](_0xe76d('0x14'),_0x4e4970)][_0x517d51];}emit(util[_0xe76d('0x13')]('%s:queue:%s',_0x4e4970,_0x3d4b25),util[_0xe76d('0x13')]('%s_queue_waiting_interaction:%s',_0x4e4970,_0x1b10ca?_0xe76d('0x15'):_0xe76d('0x16')),_[_0xe76d('0x17')](_0x35254f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe76d('0x18')),'chatQueueReport':require(_0xe76d('0x19')),'smsQueueReport':require(_0xe76d('0x1a')),'faxQueueReport':require(_0xe76d('0x1b')),'whatsappQueueReport':require(_0xe76d('0x1c')),'chatInteraction':require(_0xe76d('0x1d')),'faxInteraction':require(_0xe76d('0x1e')),'mailInteraction':require(_0xe76d('0x1f')),'openchannelInteraction':require(_0xe76d('0x20')),'smsInteraction':require(_0xe76d('0x21')),'whatsappInteraction':require(_0xe76d('0x22'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xe76d('0x23')},'timeout':{'type':'number','message':_0xe76d('0x24')}});function startRouting(_0x4e8f84,_0x12fb68,_0x58c122,_0x2cfba4){if(_0x4e8f84&&_0x12fb68&&_0x58c122){_0x12fb68[_0xe76d('0x25')]+=0x1;var _0x4ba1f6={'uniqueid':_0x4e8f84,'from':_0x58c122[_0xe76d('0x26')]?_0x58c122['body'][_0xe76d('0x27')]:'','joinAt':moment()['format'](_0xe76d('0x28')),'ContactId':_0x58c122[_0xe76d('0x29')]?_0x58c122[_0xe76d('0x29')]['id']:null,'ListId':_0x58c122['list']?_0x58c122[_0xe76d('0x2a')]['id']:null};_0x4ba1f6[_['upperFirst'](_0x58c122[_0xe76d('0x2b')])+_0xe76d('0x2c')]=_0x12fb68['id']||null;_0x4ba1f6[_[_0xe76d('0x2d')](_0x58c122[_0xe76d('0x2b')])+_0xe76d('0x12')]=_0x58c122['interaction']?_0x58c122[_0xe76d('0x2e')]['id']:null;_0x4ba1f6[_[_0xe76d('0x2d')](_0x58c122[_0xe76d('0x2b')])+_0xe76d('0x2f')]=_0x58c122['message']?_0x58c122['message']['id']:null;_0x4ba1f6[_[_0xe76d('0x2d')](_0x58c122[_0xe76d('0x2b')])+(_0x58c122[_0xe76d('0x2b')]!==_0xe76d('0x30')?_0xe76d('0x31'):_0xe76d('0x32'))]=_0x58c122[_0xe76d('0x33')]?_0x58c122[_0xe76d('0x33')]['id']:null;logger[_0xe76d('0x34')](util[_0xe76d('0x13')](_0xe76d('0x35'),_0x4e8f84,_0x12fb68['name']));emitChannelQueueInteraction(_0x58c122[_0xe76d('0x2b')],_0x12fb68[_0xe76d('0x36')],_0x4ba1f6,_0x58c122[_0xe76d('0x33')][_0xe76d('0x36')],_0x58c122[_0xe76d('0x37')]['id'],!![],_0x2cfba4,_0x12fb68['id']);if(rpc[_0x58c122['channel']+_0xe76d('0x38')]){return rpc[_0x58c122['channel']+'QueueReport'][_0xe76d('0x39')](_0x4ba1f6)[_0xe76d('0x3a')](function(_0x2f2852){logger[_0xe76d('0x3b')](_0xe76d('0x3c'),_0x2f2852);});}}}function stopRouting(_0xdc4a78,_0xf5d95d,_0x59a580,_0x1dc753){if(_0xdc4a78&&_0xf5d95d){_0xf5d95d[_0xe76d('0x25')]-=0x1;var _0xda46a2={'leaveAt':moment()[_0xe76d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xe76d('0x13')](_0xe76d('0x28')),'reason':_0xe76d('0x3d')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0xdc4a78,_0xf5d95d[_0xe76d('0x36')]));emitChannelQueueInteraction(_0x59a580[_0xe76d('0x2b')],_0xf5d95d[_0xe76d('0x36')],_0x59a580[_0xe76d('0x26')],_0x59a580[_0xe76d('0x33')]['name'],_0x59a580[_0xe76d('0x37')]['id'],![],_0x1dc753,_0xf5d95d['id']);return rpc[_0x59a580['channel']+_0xe76d('0x3e')][_0xe76d('0x3f')](_0x59a580['interaction']['id'],{'queueId':_0xf5d95d['id']})['then'](function(){if(rpc[_0x59a580[_0xe76d('0x2b')]+_0xe76d('0x38')]){return rpc[_0x59a580[_0xe76d('0x2b')]+_0xe76d('0x38')][_0xe76d('0x3f')](_0xdc4a78,_0xda46a2)[_0xe76d('0x3a')](function(_0xbbf684){logger[_0xe76d('0x3b')](_0xe76d('0x40'),_0xbbf684);});}});}}function endRouting(_0x1e5cff,_0x32077e,_0x5c2287,_0xd518d2){if(_0x1e5cff&&_0x32077e){_0x32077e[_0xe76d('0x25')]-=0x1;var _0x527f9f={'leaveAt':moment()[_0xe76d('0x13')](_0xe76d('0x28')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xe76d('0x34')](util[_0xe76d('0x13')](_0xe76d('0x41'),_0x1e5cff,_0x32077e[_0xe76d('0x36')]));emitChannelQueueInteraction(_0x5c2287[_0xe76d('0x2b')],_0x32077e[_0xe76d('0x36')],_0x5c2287[_0xe76d('0x26')],_0x5c2287['account'][_0xe76d('0x36')],_0x5c2287[_0xe76d('0x37')]['id'],![],_0xd518d2);if(rpc[_0x5c2287[_0xe76d('0x2b')]+_0xe76d('0x38')]){return rpc[_0x5c2287[_0xe76d('0x2b')]+_0xe76d('0x38')][_0xe76d('0x3f')](_0x1e5cff,_0x527f9f)[_0xe76d('0x3a')](function(_0x4b529a){logger[_0xe76d('0x3b')]('update\x20queue\x20report',_0x4b529a);});}}}function handleFindQueue(_0x3c30bb){return function(_0x81b041){return _0x81b041[_0xe76d('0x36')][_0xe76d('0x42')]()===_0x3c30bb[_0xe76d('0x42')]();};}exports[_0xe76d('0x43')]=function(_0x451a80,_0x3efd83,_0x1e32d0,_0x2cab86){return function(_0x4a2c99){try{var _0x17c3f9={'name':_0x3efd83[0x0],'timeout':_0x3efd83[0x1]};var _0x13d222=queue[_0xe76d('0x0')](_0x17c3f9,{'typecast':!![]});if(_0x13d222['length']){logger['error'](_0xe76d('0x44'),_0x451a80,_[_0xe76d('0x45')](_0x13d222,_0xe76d('0x37'))[_0xe76d('0x46')](',\x20'));_0x4a2c99[_0xe76d('0x47')]();}else{var _0x4f08c3=_['find'](_0x1e32d0[_0x2cab86['channel']+'Queues'],handleFindQueue(_0x17c3f9['name']));if(_0x4f08c3){startRouting(_0x451a80,_0x4f08c3,_0x2cab86,_0x1e32d0);var _0x4664aa=(_0x4f08c3[_0xe76d('0x48')]||0xa)*0x3e8;var _0x3c791b=(_0x17c3f9[_0xe76d('0x48')]||0x14)*0x3e8;var _0x1d3eb7;if(_0x4664aa>_0x3c791b){_0x3c791b=_0x4664aa;}var _0x1572b7=seqqueue[_0xe76d('0x49')](_0x4664aa);_0x1572b7['id']=_0x451a80;_0x1572b7[_0xe76d('0x4a')]=_0x4664aa;_0x1572b7[_0xe76d('0x4b')]=_0x3c791b;_0x1572b7['channel']=_0x2cab86[_0xe76d('0x2b')];_0x1e32d0[_0xe76d('0x4c')][_0x451a80]['on'](_0xe76d('0x4d'),function(){logger[_0xe76d('0x34')](_0xe76d('0x4e'),_0x451a80);stopRouting(_0x451a80,_0x4f08c3,_0x2cab86,_0x1e32d0);clearTimeout(_0x1d3eb7);_0x1d3eb7=undefined;_0x1572b7[_0xe76d('0x4f')](!![]);if(_0x1e32d0[_0xe76d('0x4c')][_0x451a80]){delete _0x1e32d0['rules'][_0x451a80];}_0x4a2c99['stop']();});_0x1e32d0[_0xe76d('0x4c')][_0x451a80]['on'](_0xe76d('0x50'),function(){if(_0x1e32d0[_0xe76d('0x4c')][_0x451a80]){delete _0x1e32d0[_0xe76d('0x4c')][_0x451a80];}});_0x1d3eb7=setTimeout(function(){logger[_0xe76d('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x451a80);endRouting(_0x451a80,_0x4f08c3,_0x2cab86,_0x1e32d0);clearTimeout(_0x1d3eb7);_0x1572b7[_0xe76d('0x4f')](!![]);_0x4a2c99[_0xe76d('0x51')]();},_0x3c791b);switch(_0x4f08c3['strategy']){case _0xe76d('0x52'):strategy[_0xe76d('0x52')](_0x1572b7,_0x4f08c3,_0x1e32d0,_0x2cab86);break;default:strategy[_0xe76d('0x53')](_0x1572b7,_0x4f08c3,_0x1e32d0,_0x2cab86);}}else{logger[_0xe76d('0x3b')](_0xe76d('0x54'),_0x451a80,_0x17c3f9['name']);_0x4a2c99[_0xe76d('0x47')]();}}}catch(_0x3d2896){logger['error'](_0xe76d('0x44'),_0x451a80,_0x3d2896[_0xe76d('0x55')]);_0x4a2c99[_0xe76d('0x47')]();}};}; \ 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 0303a6b..af2e639 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 _0xf3cd=['notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xf3cd[_0x32d457];return _0x338386;};'use strict';var _=require(_0xdf3c('0x0'));var uuid=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var logger=require(_0xdf3c('0x3'))(_0xdf3c('0x4'));var Agent=function(_0x433a7f,_0x54db05,_0x401518,_0x71b446){this[_0xdf3c('0x5')]=uuid['v4']();this['squeue']=_0x433a7f;this[_0xdf3c('0x6')]=_0x54db05;this[_0xdf3c('0x7')]=_0x401518;this[_0xdf3c('0x4')]=_0x71b446;this[_0xdf3c('0x8')][_0xdf3c('0x9')](this[_0xdf3c('0xa')]['bind'](this),this[_0xdf3c('0xb')]['bind'](this));this['squeue']['on'](_0xdf3c('0xc'),this[_0xdf3c('0xb')]['bind'](this));this[_0xdf3c('0x8')]['on'](_0xdf3c('0xd'),this[_0xdf3c('0xe')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')][_0xdf3c('0x9')]=function(){this[_0xdf3c('0x8')][_0xdf3c('0x9')](this['handleRun'][_0xdf3c('0xf')](this),this[_0xdf3c('0xb')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')]['handleDrained']=function(){this[_0xdf3c('0xb')](!![]);};Agent[_0xdf3c('0x10')][_0xdf3c('0xa')]=function(){logger['debug'](_0xdf3c('0x11'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);if(_[_0xdf3c('0x12')](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']])){logger[_0xdf3c('0x14')](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this[_0xdf3c('0x9')][_0xdf3c('0xf')](this),0x3e8);}else{if(this[_0xdf3c('0x4')][_0xdf3c('0x16')]||util[_0xdf3c('0x17')](this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],this[_0xdf3c('0x8')][_0xdf3c('0x18')],![])){this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']]['busy']=!![];this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']][_0xdf3c('0x19')]=undefined;util[_0xdf3c('0x1a')](this[_0xdf3c('0x7')],this[_0xdf3c('0x4')],this[_0xdf3c('0x6')],this['squeue'][_0xdf3c('0x18')]);util[_0xdf3c('0x1b')](this[_0xdf3c('0x5')],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);util[_0xdf3c('0x1c')](this[_0xdf3c('0x8')]['id'],this['realtime'][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],'RINGING'+(this[_0xdf3c('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xdf3c('0x1d'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdf3c('0xf')](this),0x3e8);}}};Agent[_0xdf3c('0x10')][_0xdf3c('0xb')]=function(_0x1ccdd4){if(_['isNil'](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']])){return logger['debug'](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);}else{logger['debug'](_0xdf3c('0x1e'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);util[_0xdf3c('0x1f')](this['notificationId'],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']][_0xdf3c('0x20')]=![];this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']]['busyQueue']=undefined;util[_0xdf3c('0x21')](this[_0xdf3c('0x7')],this['routing'],this['agent'],this[_0xdf3c('0x8')]['channel']);util[_0xdf3c('0x1c')](this['squeue']['id'],this['realtime']['agents'][this[_0xdf3c('0x6')]['id']],_0x1ccdd4?_0xdf3c('0x22'):_0xdf3c('0x23'));}if(!_0x1ccdd4){setTimeout(this[_0xdf3c('0x9')]['bind'](this),0x3e8);}};function agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f){return new Agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f);}module[_0xdf3c('0x24')]=agent; \ No newline at end of file +var _0xa37e=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','agent','bind','handleTimeout','prototype','push','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','realtime','channel','busy','busyQueue','writeLog','RINGING','debug'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa37e,0x97));var _0xea37=function(_0x4ef58d,_0x5bbdd6){_0x4ef58d=_0x4ef58d-0x0;var _0x55486e=_0xa37e[_0x4ef58d];return _0x55486e;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var Agent=function(_0x475c71,_0x5430aa,_0x3cabb8,_0x537c5a){this[_0xea37('0x3')]=uuid['v4']();this[_0xea37('0x4')]=_0x475c71;this[_0xea37('0x5')]=_0x5430aa;this['realtime']=_0x3cabb8;this['routing']=_0x537c5a;this[_0xea37('0x4')]['push'](this['handleRun'][_0xea37('0x6')](this),this[_0xea37('0x7')][_0xea37('0x6')](this));this[_0xea37('0x4')]['on']('timeout',this[_0xea37('0x7')][_0xea37('0x6')](this));this[_0xea37('0x4')]['on']('drained',this['handleDrained'][_0xea37('0x6')](this));};Agent[_0xea37('0x8')][_0xea37('0x9')]=function(){this['squeue'][_0xea37('0x9')](this[_0xea37('0xa')][_0xea37('0x6')](this),this['handleTimeout'][_0xea37('0x6')](this));};Agent[_0xea37('0x8')]['handleDrained']=function(){this[_0xea37('0x7')](!![]);};Agent['prototype'][_0xea37('0xa')]=function(){logger['debug'](_0xea37('0xb'),this[_0xea37('0x4')]['id'],this[_0xea37('0x5')]['id']);if(_[_0xea37('0xc')](this['realtime'][_0xea37('0xd')][this['agent']['id']])){logger['debug'](_0xea37('0xe'),this['squeue']['id'],this[_0xea37('0x5')]['id']);setTimeout(this[_0xea37('0x9')]['bind'](this),0x3e8);}else{if(this[_0xea37('0x2')][_0xea37('0xf')]||util['isAgentAvailable'](this[_0xea37('0x4')]['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],this[_0xea37('0x4')][_0xea37('0x11')],![])){this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x12')]=!![];this['realtime'][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x13')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0xea37('0x2')],this[_0xea37('0x5')],this[_0xea37('0x4')][_0xea37('0x11')]);util['showNotification'](this[_0xea37('0x3')],this['squeue']['id'],this['realtime']['agents'][this[_0xea37('0x5')]['id']],null,this['routing']);util[_0xea37('0x14')](this[_0xea37('0x4')]['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],_0xea37('0x15')+(this['routing'][_0xea37('0xf')]?':FORCED':''));}else{logger[_0xea37('0x16')](_0xea37('0x17'),this['squeue']['id'],this[_0xea37('0x5')]['id']);setTimeout(this[_0xea37('0x9')][_0xea37('0x6')](this),0x3e8);}}};Agent['prototype'][_0xea37('0x7')]=function(_0x366acb){if(_[_0xea37('0xc')](this[_0xea37('0x10')]['agents'][this[_0xea37('0x5')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea37('0x4')]['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xea37('0x4')]['id'],this[_0xea37('0x5')]['id']);util[_0xea37('0x18')](this[_0xea37('0x3')],this[_0xea37('0x4')]['id'],this[_0xea37('0x10')]['agents'][this[_0xea37('0x5')]['id']],null,this[_0xea37('0x2')]);this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x12')]=![];this['realtime'][_0xea37('0xd')][this['agent']['id']][_0xea37('0x13')]=undefined;util[_0xea37('0x19')](this[_0xea37('0x10')],this[_0xea37('0x2')],this[_0xea37('0x5')],this[_0xea37('0x4')][_0xea37('0x11')]);util[_0xea37('0x14')](this['squeue']['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],_0x366acb?_0xea37('0x1a'):_0xea37('0x1b'));}if(!_0x366acb){setTimeout(this[_0xea37('0x9')]['bind'](this),0x3e8);}};function agent(_0x499388,_0x4feaf1,_0x1877eb,_0x5453da){return new Agent(_0x499388,_0x4feaf1,_0x1877eb,_0x5453da);}module[_0xea37('0x1c')]=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 355a42a..b7187e5 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 _0x3b33=['showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name','saveWaitingNotification'];(function(_0x146d9d,_0x43f122){var _0x1f29ac=function(_0x1e10e2){while(--_0x1e10e2){_0x146d9d['push'](_0x146d9d['shift']());}};_0x1f29ac(++_0x43f122);}(_0x3b33,0x163));var _0x33b3=function(_0x3b6af6,_0x1fe214){_0x3b6af6=_0x3b6af6-0x0;var _0x39fe7b=_0x3b33[_0x3b6af6];return _0x39fe7b;};'use strict';var _=require(_0x33b3('0x0'));var uuid=require(_0x33b3('0x1'));var util=require(_0x33b3('0x2'));var logger=require(_0x33b3('0x3'))(_0x33b3('0x4'));var Beepall=function(_0x2116b9,_0x2e23f8,_0x3c6c9b,_0x4e6e3d){this[_0x33b3('0x5')]=uuid['v4']();this[_0x33b3('0x6')]=_0x2116b9;this[_0x33b3('0x7')]=_0x2e23f8;this['realtime']=_0x3c6c9b;this[_0x33b3('0x4')]=_0x4e6e3d;this[_0x33b3('0x6')][_0x33b3('0x8')](this[_0x33b3('0x9')][_0x33b3('0xa')](this),this[_0x33b3('0xb')][_0x33b3('0xa')](this));this[_0x33b3('0x6')]['on'](_0x33b3('0xc'),this['handleTimeout']['bind'](this));this[_0x33b3('0x6')]['on'](_0x33b3('0xd'),this[_0x33b3('0xe')][_0x33b3('0xa')](this));};Beepall[_0x33b3('0xf')][_0x33b3('0x8')]=function(){this[_0x33b3('0x6')]['push'](this[_0x33b3('0x9')]['bind'](this),this[_0x33b3('0xb')]['bind'](this));};Beepall[_0x33b3('0xf')][_0x33b3('0xe')]=function(){this[_0x33b3('0xb')](!![]);};Beepall[_0x33b3('0xf')][_0x33b3('0x9')]=function(){var _0x981947=!![];if(!_[_0x33b3('0x10')](this['queue'])&&!_[_0x33b3('0x10')](this[_0x33b3('0x7')][_0x33b3('0x11')])&&this['queue'][_0x33b3('0x11')]['length']>0x0){for(var _0x47e2ba=0x0,_0xb5e62;_0x47e2ba0x0){for(var _0x478581=0x0,_0x519f7b;_0x4785810x0&&_0x1c7dc8[_0x512a52+'CurrentCapacity']>=_0x1c7dc8[_0x512a52+_0xe832('0x21')]){writeLog(_0x185368,_0x1c7dc8,_0x512a52['toUpperCase']()+_0xe832('0x23'));return![];}}return!![];};exports[_0xe832('0x24')]=function(_0x329ffd,_0x15df2c,_0x13420a,_0x528087,_0x50cd29){return sendNotification(!![],_0x329ffd,_0x15df2c,_0x13420a,_0x528087,_0x50cd29);};exports[_0xe832('0x25')]=function(_0x165195,_0x45eedf,_0x2fb116,_0x1c9b9f,_0x53d622){return sendNotification(![],_0x165195,_0x45eedf,_0x2fb116,_0x1c9b9f,_0x53d622);};exports['checkWaitingNotifications']=function(_0x55c508,_0x38b147,_0x2c2737){var _0x54497e=_0x38b147['interaction']['UserId'];if(!_0x54497e&&_0x2c2737){_0x54497e=_0x2c2737['id'];}var _0x3b4c60=_['some'](_0x55c508[_0x38b147[_0xe832('0x26')]+'QueuesWaitingInteractions'],function(_0x33152e){var _0x25d71f=_['capitalize'](_0x38b147[_0xe832('0x26')])+_0xe832('0x27');return _0x33152e[_0x25d71f]===_0x38b147['interaction']['id'];});if(!_0x3b4c60&&_0x54497e&&_0x55c508[_0xe832('0x28')][_0x54497e]){_0x3b4c60=_[_0xe832('0x29')](_0x55c508['agents'][_0x54497e][_0x38b147['channel']+_0xe832('0x2a')],function(_0x4c162c){return _0x4c162c['id']===_0x38b147[_0xe832('0x2b')]['id'];});}return _0x3b4c60;};exports[_0xe832('0x2c')]=function(_0x30d88a,_0x5cd1df,_0x3bb2a8,_0x174cb9){if(_0x3bb2a8&&_0x3bb2a8['id']&&_0x30d88a[_0xe832('0x28')]&&_0x30d88a[_0xe832('0x28')][_0x3bb2a8['id']]){_0x30d88a[_0xe832('0x28')][_0x3bb2a8['id']][_0x174cb9+_0xe832('0x2a')][_0x5cd1df[_0xe832('0x15')]['id']]={'id':_0x5cd1df[_0xe832('0x2b')]['id']};}};exports[_0xe832('0x2d')]=function(_0x580881,_0x19cc73,_0x576994,_0x581ea9){if(_0x576994&&_0x576994['id']&&_0x580881[_0xe832('0x28')]&&_0x580881[_0xe832('0x28')][_0x576994['id']]){delete _0x580881[_0xe832('0x28')][_0x576994['id']][_0x581ea9+_0xe832('0x2a')][_0x19cc73[_0xe832('0x15')]['id']];}};exports[_0xe832('0x2e')]=writeLog; \ No newline at end of file +var _0x0abf=['OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','showNotification','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','../utils','ioredis','routing','defaults','redis','localhost','socket.io-emitter','split','\x20interaction','notificationSound','notificationShake','body','queue','msg','getMustacheRender','account','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','name','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var utils=require(_0xf0ab('0x1'));var Redis=require(_0xf0ab('0x2'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0xf0ab('0x3'));config['redis']=_[_0xf0ab('0x4')](config[_0xf0ab('0x5')],{'host':_0xf0ab('0x6'),'port':0x18eb});var io=require(_0xf0ab('0x7'))(new Redis(config[_0xf0ab('0x5')]));function sendNotification(_0x4d2ea8,_0x233afe,_0x57ff3b,_0x2c4628,_0x3f7e2b,_0x3ca099){var _0x236b07=_0x3ca099||{};var _0x480f49=_0x57ff3b[_0xf0ab('0x8')]('.');var _0x4688d8={'uniqueid':_0x233afe,'channel':_0x480f49[0x0],'id':_0x480f49[0x1],'title':_0x480f49[0x0]+_0xf0ab('0x9'),'interactionId':_0x480f49[0x2],'queue':_0x3f7e2b?_0x3f7e2b['name']:null,'sound':_0x236b07['account'][_0xf0ab('0xa')],'shake':_0x236b07['account'][_0xf0ab('0xb')]};try{if(!_0x236b07[_0xf0ab('0xc')]){_0x236b07[_0xf0ab('0xc')]={};}if(_0x3f7e2b){_0x236b07[_0xf0ab('0xc')][_0xf0ab('0xd')]=_0x3f7e2b;}else if(_0x236b07[_0xf0ab('0xc')][_0xf0ab('0xd')]){delete _0x236b07['body'][_0xf0ab('0xd')];}_0x4688d8[_0xf0ab('0xe')]=utils[_0xf0ab('0xf')](_0x236b07[_0xf0ab('0x10')][_0xf0ab('0x11')],_0x236b07);}catch(_0x36cabe){_0x4688d8[_0xf0ab('0xe')]=_0xf0ab('0x12');logger[_0xf0ab('0x13')](util[_0xf0ab('0x14')](_0xf0ab('0x15'),_0x233afe,_0x36cabe[_0xf0ab('0x16')]));}io['to'](util[_0xf0ab('0x14')](_0xf0ab('0x17'),_0x2c4628[_0xf0ab('0x18')]))['emit'](util[_0xf0ab('0x14')](_0xf0ab('0x19'),_0x4d2ea8?_0xf0ab('0x1a'):_0xf0ab('0x1b')),_0x4688d8);}function writeLog(_0x776619,_0xb9a33,_0x3a0edf){return logger[_0xf0ab('0x1c')](util[_0xf0ab('0x14')](_0xf0ab('0x1d'),_0x776619,_0xb9a33[_0xf0ab('0x18')],_0x3a0edf));}exports[_0xf0ab('0x1e')]=function(_0xf43bc4,_0x22a205,_0x2cd961,_0x45c1c9){if(_0x22a205['busy']){writeLog(_0xf43bc4,_0x22a205,_0xf0ab('0x1f'));return![];}if(!_0x22a205[_0xf0ab('0x20')]){writeLog(_0xf43bc4,_0x22a205,_0xf0ab('0x21'));return![];}if(_0x22a205[_0x2cd961+_0xf0ab('0x22')]){writeLog(_0xf43bc4,_0x22a205,_0xf0ab('0x23'));return![];}if(_0x45c1c9&&_0x22a205[_0xf0ab('0x24')](_0x2cd961+_0xf0ab('0x25'))&&_0x22a205[_0xf0ab('0x24')](_0x2cd961+_0xf0ab('0x26'))){if(_0x22a205[_0x2cd961+_0xf0ab('0x25')]>0x0&&_0x22a205[_0x2cd961+_0xf0ab('0x26')]>=_0x22a205[_0x2cd961+'Capacity']){writeLog(_0xf43bc4,_0x22a205,_0x2cd961['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf0ab('0x27')]=function(_0x4f0caf,_0x3eca32,_0x16b979,_0x51ac90,_0x163078){return sendNotification(!![],_0x4f0caf,_0x3eca32,_0x16b979,_0x51ac90,_0x163078);};exports[_0xf0ab('0x28')]=function(_0x10bf5f,_0x38fb71,_0x7d4ff9,_0x502921,_0x2d0da7){return sendNotification(![],_0x10bf5f,_0x38fb71,_0x7d4ff9,_0x502921,_0x2d0da7);};exports['checkWaitingNotifications']=function(_0x55d799,_0x1dcd2e,_0x4306c6){var _0x1b223d=_0x1dcd2e[_0xf0ab('0x29')][_0xf0ab('0x2a')];if(!_0x1b223d&&_0x4306c6){_0x1b223d=_0x4306c6['id'];}var _0x174052=_[_0xf0ab('0x2b')](_0x55d799[_0x1dcd2e[_0xf0ab('0x2c')]+_0xf0ab('0x2d')],function(_0x2f0fcd){var _0x21e8ac=_[_0xf0ab('0x2e')](_0x1dcd2e['channel'])+_0xf0ab('0x2f');return _0x2f0fcd[_0x21e8ac]===_0x1dcd2e[_0xf0ab('0x29')]['id'];});if(!_0x174052&&_0x1b223d&&_0x55d799['agents'][_0x1b223d]){_0x174052=_['some'](_0x55d799[_0xf0ab('0x30')][_0x1b223d][_0x1dcd2e[_0xf0ab('0x2c')]+_0xf0ab('0x31')],function(_0x4dd5b7){return _0x4dd5b7['id']===_0x1dcd2e['interaction']['id'];});}return _0x174052;};exports[_0xf0ab('0x32')]=function(_0x58fa03,_0x1cfd52,_0x51c459,_0x3f66fa){if(_0x51c459&&_0x51c459['id']&&_0x58fa03[_0xf0ab('0x30')]&&_0x58fa03['agents'][_0x51c459['id']]){_0x58fa03['agents'][_0x51c459['id']][_0x3f66fa+_0xf0ab('0x31')][_0x1cfd52[_0xf0ab('0x16')]['id']]={'id':_0x1cfd52[_0xf0ab('0x29')]['id']};}};exports[_0xf0ab('0x33')]=function(_0x2519c7,_0x36195d,_0x17f3b3,_0xf8f0f4){if(_0x17f3b3&&_0x17f3b3['id']&&_0x2519c7[_0xf0ab('0x30')]&&_0x2519c7[_0xf0ab('0x30')][_0x17f3b3['id']]){delete _0x2519c7[_0xf0ab('0x30')][_0x17f3b3['id']][_0xf8f0f4+_0xf0ab('0x31')][_0x36195d[_0xf0ab('0x16')]['id']];}};exports[_0xf0ab('0x34')]=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 be56982..f3ce3ca 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 _0x8128=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','validate','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s'];(function(_0x1e9393,_0x301a65){var _0x4ef265=function(_0x1c45db){while(--_0x1c45db){_0x1e9393['push'](_0x1e9393['shift']());}};_0x4ef265(++_0x301a65);}(_0x8128,0x1b1));var _0x8812=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8128[_0x33032e];return _0x13316b;};'use strict';var schema=require(_0x8812('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x8812('0x1'));var logger=require(_0x8812('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x8812('0x3')}});exports[_0x8812('0x4')]=function(_0x21b1d5,_0x4a8add){return function(_0x33f9f6){try{var _0x2f4af9={'command':_0x4a8add[0x0]};var _0x2b43c6=system[_0x8812('0x0')](_0x2f4af9,{'typecast':!![]});if(_0x2b43c6['length']){logger[_0x8812('0x5')](_0x8812('0x6'),_0x21b1d5,_['map'](_0x2b43c6,'message')['join'](',\x20'));logger[_0x8812('0x7')](_0x8812('0x8'),_0x21b1d5);_0x33f9f6[_0x8812('0x9')]();}else{var _0x3845e8=this;var _0x8ddb12=utils[_0x8812('0xa')](_0x4a8add[0x0],this);logger[_0x8812('0x7')](_0x8812('0xb'),_0x21b1d5,_0x8ddb12);sh[_0x8812('0xc')](_['trim'](_0x8ddb12),function(_0x15f3bb,_0x13bb0e){logger[_0x8812('0x7')](_0x8812('0xd'),_0x21b1d5,_0x15f3bb);if(_0x15f3bb==0x0){var _0x30ab14=_0x13bb0e[_0x8812('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4a8add[0x1])||_[_0x8812('0xf')](_0x4a8add[0x1])){logger[_0x8812('0x7')](_0x8812('0x10'),_0x21b1d5);_0x3845e8['body'][_0x4a8add[0x1]]=_0x30ab14;}else{logger['info'](_0x8812('0x11'),_0x21b1d5,_0x4a8add[0x1],_0x30ab14);_0x3845e8[_0x8812('0x12')][_0x4a8add[0x1]]=_0x30ab14;}}_0x33f9f6['next']();});}}catch(_0x50f04c){logger['error']('[%s][SYSTEM]\x20%s',_0x21b1d5,_['isObject'](_0x50f04c)?JSON[_0x8812('0x13')](_0x50f04c):_0x50f04c);logger['info'](_0x8812('0x8'),_0x21b1d5);_0x33f9f6['next']();}};}; \ No newline at end of file +var _0xf120=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x3d686e,_0x2d1c24){var _0x27cad7=function(_0x35e2f5){while(--_0x35e2f5){_0x3d686e['push'](_0x3d686e['shift']());}};_0x27cad7(++_0x2d1c24);}(_0xf120,0x179));var _0x0f12=function(_0xce32b7,_0x12ea4d){_0xce32b7=_0xce32b7-0x0;var _0xe02ca5=_0xf120[_0xce32b7];return _0xe02ca5;};'use strict';var schema=require('validate');var sh=require(_0x0f12('0x0'));var _=require(_0x0f12('0x1'));var utils=require(_0x0f12('0x2'));var logger=require('../../../../config/logger')(_0x0f12('0x3'));var system=schema({'command':{'type':_0x0f12('0x4'),'required':!![],'message':_0x0f12('0x5')}});exports['consequence']=function(_0x1a4043,_0x294e21){return function(_0x2dbf82){try{var _0x308941={'command':_0x294e21[0x0]};var _0x21f951=system[_0x0f12('0x6')](_0x308941,{'typecast':!![]});if(_0x21f951[_0x0f12('0x7')]){logger[_0x0f12('0x8')]('[%s][SYSTEM]\x20%s',_0x1a4043,_[_0x0f12('0x9')](_0x21f951,'message')[_0x0f12('0xa')](',\x20'));logger[_0x0f12('0xb')](_0x0f12('0xc'),_0x1a4043);_0x2dbf82['next']();}else{var _0x5f158a=this;var _0x23f708=utils[_0x0f12('0xd')](_0x294e21[0x0],this);logger[_0x0f12('0xb')](_0x0f12('0xe'),_0x1a4043,_0x23f708);sh[_0x0f12('0xf')](_[_0x0f12('0x10')](_0x23f708),function(_0x2d974a,_0x4f0eda){logger[_0x0f12('0xb')](_0x0f12('0x11'),_0x1a4043,_0x2d974a);if(_0x2d974a==0x0){var _0xb80905=_0x4f0eda[_0x0f12('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x0f12('0x13')](_0x294e21[0x1])||_[_0x0f12('0x14')](_0x294e21[0x1])){logger[_0x0f12('0xb')](_0x0f12('0x15'),_0x1a4043);_0x5f158a[_0x0f12('0x16')][_0x294e21[0x1]]=_0xb80905;}else{logger[_0x0f12('0xb')](_0x0f12('0x17'),_0x1a4043,_0x294e21[0x1],_0xb80905);_0x5f158a[_0x0f12('0x16')][_0x294e21[0x1]]=_0xb80905;}}_0x2dbf82[_0x0f12('0x18')]();});}}catch(_0x27addc){logger[_0x0f12('0x8')]('[%s][SYSTEM]\x20%s',_0x1a4043,_[_0x0f12('0x19')](_0x27addc)?JSON['stringify'](_0x27addc):_0x27addc);logger[_0x0f12('0xb')](_0x0f12('0xc'),_0x1a4043);_0x2dbf82[_0x0f12('0x18')]();}};}; \ 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 7766c4b..6e60101 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 _0x2f87=['addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','info','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel'];(function(_0x321064,_0x2e5008){var _0x42c2a7=function(_0x3f4957){while(--_0x3f4957){_0x321064['push'](_0x321064['shift']());}};_0x42c2a7(++_0x2e5008);}(_0x2f87,0x1ee));var _0x72f8=function(_0x344d47,_0x4d9673){_0x344d47=_0x344d47-0x0;var _0x2364e2=_0x2f87[_0x344d47];return _0x2364e2;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x72f8('0x0')),'openchannelInteraction':require(_0x72f8('0x1')),'smsInteraction':require(_0x72f8('0x2')),'mailInteraction':require(_0x72f8('0x3')),'faxInteraction':require(_0x72f8('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x72f8('0x5'))(_0x72f8('0x6'));var tag=schema({'tag':{'type':_0x72f8('0x7'),'required':!![],'message':_0x72f8('0x8')}});exports['consequence']=function(_0x440e14,_0x339bdb,_0xc8cb77,_0x3b526a){return function(_0x261bcd){try{var _0x3215d8={'tag':_0x339bdb[0x0]};var _0x3649b9=tag[_0x72f8('0x9')](_0x3215d8,{'typecast':!![]});if(_0x3649b9['length']){logger[_0x72f8('0xa')](_0x72f8('0xb'),_0x440e14,_[_0x72f8('0xc')](_0x3649b9,_0x72f8('0xd'))[_0x72f8('0xe')](',\x20'));logger['info'](_0x72f8('0xf'),_0x440e14);_0x261bcd[_0x72f8('0x10')]();}else{var _0xdaf1ab={'ids':[_0x339bdb[0x0]]};if(rpc[_0x3b526a['channel']+_0x72f8('0x11')]){rpc[_0x3b526a[_0x72f8('0x12')]+_0x72f8('0x11')][_0x72f8('0x13')](_0x3b526a[_0x72f8('0x14')]['id'],_0xdaf1ab)['then'](function(_0x26d460){logger['info'](_0x72f8('0x15'),_0x440e14,_0x339bdb[0x1],_0x3b526a[_0x72f8('0x12')],_0x3b526a['interaction']['id']);})[_0x72f8('0x16')](function(_0x3e47d4){logger[_0x72f8('0xa')](_0x72f8('0xb'),_0x440e14,JSON[_0x72f8('0x17')](_0x3e47d4));logger[_0x72f8('0x18')](_0x72f8('0xf'),_0x440e14);})[_0x72f8('0x19')](function(){_0x261bcd[_0x72f8('0x10')]();});}}}catch(_0x1e14d0){logger[_0x72f8('0xa')]('[%s][TAG]\x20%s',_0x440e14,_[_0x72f8('0x1a')](_0x1e14d0)?JSON[_0x72f8('0x17')](_0x1e14d0):_0x1e14d0);logger[_0x72f8('0x18')](_0x72f8('0xf'),_0x440e14);_0x261bcd[_0x72f8('0x10')]();}};}; \ No newline at end of file +var _0xe10e=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x3e586f,_0x552e7a){var _0x201c29=function(_0x272c09){while(--_0x272c09){_0x3e586f['push'](_0x3e586f['shift']());}};_0x201c29(++_0x552e7a);}(_0xe10e,0xfe));var _0xee10=function(_0x1877e2,_0x2b76d4){_0x1877e2=_0x1877e2-0x0;var _0x44e96a=_0xe10e[_0x1877e2];return _0x44e96a;};'use strict';var schema=require(_0xee10('0x0'));var _=require(_0xee10('0x1'));var rpc={'chatInteraction':require(_0xee10('0x2')),'openchannelInteraction':require(_0xee10('0x3')),'smsInteraction':require(_0xee10('0x4')),'mailInteraction':require(_0xee10('0x5')),'faxInteraction':require(_0xee10('0x6')),'whatsappInteraction':require(_0xee10('0x7'))};var logger=require(_0xee10('0x8'))(_0xee10('0x9'));var tag=schema({'tag':{'type':_0xee10('0xa'),'required':!![],'message':_0xee10('0xb')}});exports[_0xee10('0xc')]=function(_0x3b20b2,_0x2f7dfb,_0x4d1e65,_0x81bcd2){return function(_0x5e736d){try{var _0x1ad082={'tag':_0x2f7dfb[0x0]};var _0x3329aa=tag['validate'](_0x1ad082,{'typecast':!![]});if(_0x3329aa[_0xee10('0xd')]){logger['error'](_0xee10('0xe'),_0x3b20b2,_[_0xee10('0xf')](_0x3329aa,_0xee10('0x10'))[_0xee10('0x11')](',\x20'));logger[_0xee10('0x12')](_0xee10('0x13'),_0x3b20b2);_0x5e736d[_0xee10('0x14')]();}else{var _0x2a9bc3={'ids':[_0x2f7dfb[0x0]]};if(rpc[_0x81bcd2[_0xee10('0x15')]+_0xee10('0x16')]){rpc[_0x81bcd2[_0xee10('0x15')]+'Interaction'][_0xee10('0x17')](_0x81bcd2[_0xee10('0x18')]['id'],_0x2a9bc3)[_0xee10('0x19')](function(_0x2af8de){logger[_0xee10('0x12')](_0xee10('0x1a'),_0x3b20b2,_0x2f7dfb[0x1],_0x81bcd2['channel'],_0x81bcd2['interaction']['id']);})['catch'](function(_0x4f33a4){logger[_0xee10('0x1b')]('[%s][TAG]\x20%s',_0x3b20b2,JSON['stringify'](_0x4f33a4));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b20b2);})['finally'](function(){_0x5e736d[_0xee10('0x14')]();});}}}catch(_0x1b0cc3){logger['error']('[%s][TAG]\x20%s',_0x3b20b2,_[_0xee10('0x1c')](_0x1b0cc3)?JSON['stringify'](_0x1b0cc3):_0x1b0cc3);logger[_0xee10('0x12')](_0xee10('0x13'),_0x3b20b2);_0x5e736d[_0xee10('0x14')]();}};}; \ 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 ce119f5..f589327 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 _0x6f75=['POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f75,0xb0));var _0x56f7=function(_0x5816ce,_0x394540){_0x5816ce=_0x5816ce-0x0;var _0x16d787=_0x6f75[_0x5816ce];return _0x16d787;};'use strict';var rp=require(_0x56f7('0x0'));var logger=require(_0x56f7('0x1'))(_0x56f7('0x2'));var _=require(_0x56f7('0x3'));var arr=[];exports[_0x56f7('0x4')]=function(_0x18b9f1,_0xdc2002){return function(_0x12c76a){var _0x49b97e=_0xdc2002[0xa];var _0x244e55=_0xdc2002[0xb];var _0x19b219=_0xdc2002[0xc];var _0x46a543=_0xdc2002[0xd];var _0x5e2d0a=_0xdc2002[0xe];var _0x4aab7e=_0xdc2002[0xf][_0x56f7('0x5')](/\n/g,_0x56f7('0x6'));var _0x3633cb=_0xdc2002[0x10][_0x56f7('0x5')](/\n/g,'\x20');if(!arr[_0x56f7('0x7')](_0x244e55)){arr[_0x56f7('0x8')](_0x244e55);var _0x38444d=_0xdc2002[0x3];var _0x4309da=_0xdc2002[0x4];var _0x38b583=_0xdc2002[0x1];var _0x64c4fe=_0xdc2002[0x0];var _0x3c625e={};_0x3c625e[_0x56f7('0x9')]=_0xdc2002[0x8]+'?params='+_0x19b219+'|'+_0x49b97e+'|'+_0x46a543+'|'+_0x244e55+'|'+_0x5e2d0a;_0x3c625e['urlOnRing']=_0xdc2002[0x7]+_0x56f7('0xa')+_0x19b219+'|'+_0x49b97e+'|'+_0x46a543+'|'+_0x244e55+'|'+_0x5e2d0a+'|'+_0x4aab7e+'|'+_0x3633cb;_0x3c625e[_0x56f7('0xb')]=_0xdc2002[0x9];var _0x44f6ca={};_0x44f6ca[_0x56f7('0xc')]=_0x56f7('0xd');_0x44f6ca[_0x56f7('0xe')]=_0x56f7('0xf');var _0x4289b1=[];_0x4289b1[_0x56f7('0x8')](_0xdc2002[0x2]);_0x4289b1['push'](_0xdc2002[0x5]);_0x4289b1[_0x56f7('0x8')](_0xdc2002[0x6]);_0x44f6ca[_0x56f7('0x10')]=_0x4289b1;_0x44f6ca['id']=0x1;var _0x532155=JSON[_0x56f7('0x11')](_0x44f6ca);var _0x1f8334={'encoding':_0x56f7('0x12'),'method':_0x56f7('0x13'),'timeout':0x2710,'url':_0x38444d,'headers':{'Content-Type':_0x56f7('0x14')},'body':_0x532155};return rp(_0x1f8334)[_0x56f7('0x15')](function(_0x280760){const _0x4df332=JSON[_0x56f7('0x16')](_0x280760);if(!_0x4df332[_0x56f7('0x17')][_0x56f7('0x18')]){throw new Error(_0x56f7('0x19'));}var _0x5727af=_0x244e55;var _0x5a3913=_0x56f7('0x1a')+_0x38b583+_0x56f7('0x1b')+_0x64c4fe+_0x56f7('0x1c')+_0x5727af+_0x56f7('0x1d')+JSON['stringify'](_0x3c625e);var _0x4feb4b=_0x4309da+'?'+_0x5a3913;return rp(_0x4feb4b);})[_0x56f7('0x15')](function(_0x208f92){logger[_0x56f7('0x1e')](_0x56f7('0x1f'),_0x18b9f1,_0x208f92);_0x12c76a[_0x56f7('0x20')]();})[_0x56f7('0x21')](function(_0x7032e4){logger[_0x56f7('0x22')](_0x56f7('0x23'),_0x18b9f1,_[_0x56f7('0x24')](_0x7032e4)?JSON[_0x56f7('0x11')](_0x7032e4):_0x7032e4);_0x12c76a[_0x56f7('0x20')]();});}else{logger[_0x56f7('0x1e')](_0x56f7('0x25'),_0x18b9f1);_0x12c76a[_0x56f7('0x26')]();}};}; \ No newline at end of file +var _0x0abd=['?params=','urlOnRing','title','jsonrpc','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x0abd,0xec));var _0xd0ab=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x0abd[_0x457b64];return _0x437111;};'use strict';var rp=require(_0xd0ab('0x0'));var logger=require(_0xd0ab('0x1'))(_0xd0ab('0x2'));var _=require(_0xd0ab('0x3'));var arr=[];exports[_0xd0ab('0x4')]=function(_0x55fbbd,_0x1aabcb){return function(_0x43856c){var _0x182922=_0x1aabcb[0xa];var _0x39a8ad=_0x1aabcb[0xb];var _0x1f55a1=_0x1aabcb[0xc];var _0x5a3602=_0x1aabcb[0xd];var _0x7da1b1=_0x1aabcb[0xe];var _0x52f1b1=_0x1aabcb[0xf]['replace'](/\n/g,_0xd0ab('0x5'));var _0x93fc3=_0x1aabcb[0x10][_0xd0ab('0x6')](/\n/g,'\x20');if(!arr[_0xd0ab('0x7')](_0x39a8ad)){arr[_0xd0ab('0x8')](_0x39a8ad);var _0x495b97=_0x1aabcb[0x3];var _0x5d261d=_0x1aabcb[0x4];var _0x3f5b3e=_0x1aabcb[0x1];var _0xc659de=_0x1aabcb[0x0];var _0x4efaa6={};_0x4efaa6['urlOnAnswer']=_0x1aabcb[0x8]+_0xd0ab('0x9')+_0x1f55a1+'|'+_0x182922+'|'+_0x5a3602+'|'+_0x39a8ad+'|'+_0x7da1b1;_0x4efaa6[_0xd0ab('0xa')]=_0x1aabcb[0x7]+_0xd0ab('0x9')+_0x1f55a1+'|'+_0x182922+'|'+_0x5a3602+'|'+_0x39a8ad+'|'+_0x7da1b1+'|'+_0x52f1b1+'|'+_0x93fc3;_0x4efaa6[_0xd0ab('0xb')]=_0x1aabcb[0x9];var _0x41f751={};_0x41f751[_0xd0ab('0xc')]='2.0';_0x41f751[_0xd0ab('0xd')]=_0xd0ab('0xe');var _0x1b7f06=[];_0x1b7f06[_0xd0ab('0x8')](_0x1aabcb[0x2]);_0x1b7f06[_0xd0ab('0x8')](_0x1aabcb[0x5]);_0x1b7f06[_0xd0ab('0x8')](_0x1aabcb[0x6]);_0x41f751[_0xd0ab('0xf')]=_0x1b7f06;_0x41f751['id']=0x1;var _0x321974=JSON[_0xd0ab('0x10')](_0x41f751);var _0x74b799={'encoding':_0xd0ab('0x11'),'method':_0xd0ab('0x12'),'timeout':0x2710,'url':_0x495b97,'headers':{'Content-Type':_0xd0ab('0x13')},'body':_0x321974};return rp(_0x74b799)[_0xd0ab('0x14')](function(_0x242570){const _0x2feb76=JSON[_0xd0ab('0x15')](_0x242570);if(!_0x2feb76['result'][_0xd0ab('0x16')]){throw new Error(_0xd0ab('0x17'));}var _0x169b75=_0x39a8ad;var _0x1cccbf=_0xd0ab('0x18')+_0x3f5b3e+'&serviceId='+_0xc659de+_0xd0ab('0x19')+_0x169b75+'&data='+JSON['stringify'](_0x4efaa6);var _0x4150cb=_0x5d261d+'?'+_0x1cccbf;return rp(_0x4150cb);})[_0xd0ab('0x14')](function(_0x3567b9){logger[_0xd0ab('0x1a')](_0xd0ab('0x1b'),_0x55fbbd,_0x3567b9);_0x43856c[_0xd0ab('0x1c')]();})[_0xd0ab('0x1d')](function(_0x299cbf){logger[_0xd0ab('0x1e')](_0xd0ab('0x1f'),_0x55fbbd,_[_0xd0ab('0x20')](_0x299cbf)?JSON[_0xd0ab('0x10')](_0x299cbf):_0x299cbf);_0x43856c['stop']();});}else{logger[_0xd0ab('0x1a')](_0xd0ab('0x21'),_0x55fbbd);_0x43856c[_0xd0ab('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 72e6ede..59d8356 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x59d739,_0x387145){var _0x6adce0=function(_0x51dbc2){while(--_0x51dbc2){_0x59d739['push'](_0x59d739['shift']());}};_0x6adce0(++_0x387145);}(_0xe706,0xa3));var _0x6e70=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0xe706[_0x27125a];return _0x391f7a;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1e6a66,_0x539293){var _0x311fdb=function(_0x2fed09){while(--_0x2fed09){_0x1e6a66['push'](_0x1e6a66['shift']());}};_0x311fdb(++_0x539293);}(_0xe706,0xa3));var _0x6e70=function(_0x185deb,_0x20e36f){_0x185deb=_0x185deb-0x0;var _0x37436e=_0xe706[_0x185deb];return _0x37436e;};'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 07b3ae2..2e711d0 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 _0xc953=['QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','.js','toLowerCase','appdata','split','mail','push','slice','join','dialogflow','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','app','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busy','busyQueue','end'];(function(_0x54f9be,_0x57b6d5){var _0x4e3a78=function(_0x597009){while(--_0x597009){_0x54f9be['push'](_0x54f9be['shift']());}};_0x4e3a78(++_0x57b6d5);}(_0xc953,0x84));var _0x3c95=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xc953[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var path=require(_0x3c95('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x3c95('0x3'));var sUtils=require(_0x3c95('0x4'));var logger=require(_0x3c95('0x5'))(_0x3c95('0x6'));var rpc={'openchannelQueueReport':require(_0x3c95('0x7')),'mailQueueReport':require(_0x3c95('0x8')),'chatQueueReport':require(_0x3c95('0x9')),'smsQueueReport':require(_0x3c95('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x3c95('0xb'));function getId(_0x300783,_0x476ee8,_0x17d4ab){return util[_0x3c95('0xc')](_0x3c95('0xd'),_0x300783,_0x476ee8||0x0,_0x17d4ab||0x0);}function getIntervals(_0x51d5c2,_0x58b6ee){var _0x161cc6=[];if(!_[_0x3c95('0xe')](_0x58b6ee[_0x3c95('0xf')])&&!_[_0x3c95('0xe')](_0x51d5c2[_0x58b6ee[_0x3c95('0xf')]])&&!_[_0x3c95('0xe')](_0x51d5c2[_0x58b6ee[_0x3c95('0xf')]]['Intervals'])){_0x161cc6=_[_0x3c95('0x10')](_0x51d5c2[_0x58b6ee['IntervalId']][_0x3c95('0x11')],_0x3c95('0x12'));}else if(!_[_0x3c95('0xe')](_0x58b6ee[_0x3c95('0x12')])){_0x161cc6=[_0x58b6ee['interval']];}return _0x161cc6;}exports[_0x3c95('0x13')]=function(_0x1a80c6){_0x1a80c6[_0x3c95('0x14')]={};return new BPromise(function(_0x2d5937,_0x36bb37){var _0x5a982e={'Start':function(_0x204d4d){var _0x1cbe31=this;return new Promise(function(_0xf59068,_0x1ff558){if(_0x204d4d){try{var _0x5e7f30=[];var _0x33be41=getId(_0x204d4d[_0x3c95('0x15')],_0x204d4d[_0x3c95('0x16')]?_0x204d4d[_0x3c95('0x16')]['id']:0x0,_0x204d4d['interaction']?_0x204d4d[_0x3c95('0x17')]['id']:0x0);var _0x1af909=sUtils[_0x3c95('0x18')](_0x1a80c6,_0x204d4d);if(_0x204d4d[_0x3c95('0x19')]||!_0x1af909&&_0x204d4d[_0x3c95('0x1a')]&&_['isArray'](_0x204d4d['applications'])&&_0x204d4d['applications'][_0x3c95('0x1b')]){for(var _0xd8e550=0x0;_0xd8e550<_0x204d4d[_0x3c95('0x1a')][_0x3c95('0x1b')];_0xd8e550+=0x1){var _0x316c55=_0x204d4d[_0x3c95('0x1a')][_0xd8e550];if(fs['existsSync'](path['join'](__dirname,'applications',_0x316c55['app']+_0x3c95('0x1c')))){var _0x2d74fd=[];switch(_0x316c55['app'][_0x3c95('0x1d')]()){case'autoreply':var _0x4516e1=_0x316c55[_0x3c95('0x1e')][_0x3c95('0x1f')](',');if(_0x204d4d[_0x3c95('0x15')]===_0x3c95('0x20')){_0x2d74fd[_0x3c95('0x21')](_0x4516e1[0x0]);_0x2d74fd[_0x3c95('0x21')](_0x4516e1[0x1]);_0x2d74fd['push'](_0x4516e1[_0x3c95('0x22')](0x2,_0x4516e1['length'])[_0x3c95('0x23')](','));}else{_0x2d74fd['push'](_0x4516e1[0x0]);_0x2d74fd[_0x3c95('0x21')](_0x4516e1[_0x3c95('0x22')](0x1,_0x4516e1[_0x3c95('0x1b')])[_0x3c95('0x23')](','));}break;case _0x3c95('0x24'):var _0x96216f=_0x316c55[_0x3c95('0x1e')]['split'](',');_0x2d74fd[_0x3c95('0x21')](_0x96216f[0x0]);_0x2d74fd['push'](_0x96216f[0x1]);_0x2d74fd[_0x3c95('0x21')](_0x96216f['slice'](0x2,_0x96216f[_0x3c95('0x1b')])[_0x3c95('0x23')](','));break;case'dialogflowv2':var _0x3098f1=_0x316c55[_0x3c95('0x1e')][_0x3c95('0x1f')](',');_0x2d74fd[_0x3c95('0x21')](_0x3098f1[0x0]);_0x2d74fd[_0x3c95('0x21')](_0x3098f1[0x1]);_0x2d74fd[_0x3c95('0x21')](_0x3098f1[0x2]);_0x2d74fd[_0x3c95('0x21')](_0x3098f1[0x3]);_0x2d74fd[_0x3c95('0x21')](_0x3098f1[_0x3c95('0x22')](0x4,_0x3098f1[_0x3c95('0x1b')])[_0x3c95('0x23')](','));break;case'amazonlex':var _0x582538=_0x316c55['appdata'][_0x3c95('0x1f')](',');_0x2d74fd[_0x3c95('0x21')](_0x582538[0x0]);_0x2d74fd[_0x3c95('0x21')](_0x582538[0x1]);_0x2d74fd[_0x3c95('0x21')](_0x582538[0x2]);_0x2d74fd[_0x3c95('0x21')](_0x582538[0x3]);_0x2d74fd['push'](_0x582538[_0x3c95('0x22')](0x4,_0x582538[_0x3c95('0x1b')])[_0x3c95('0x23')](','));break;case _0x3c95('0x16'):_0x2d74fd[_0x3c95('0x21')](_0x316c55[_0x3c95('0x1e')]);break;case'tag':_0x2d74fd['push'](_0x316c55[_0x3c95('0x25')]);_0x2d74fd[_0x3c95('0x21')](_0x316c55['appdata']);break;case _0x3c95('0x26'):var _0x4785a0=utils[_0x3c95('0x27')](_0x204d4d[_0x3c95('0x28')][_0x3c95('0x29')],_0x204d4d);var _0x293d0a=_0x316c55[_0x3c95('0x1e')]['split'](',');_0x2d74fd['push'](_0x293d0a[0x0]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x1]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x2]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x3]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x4]);_0x2d74fd['push'](_0x293d0a[0x5]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x6]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x7]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0x8]);_0x2d74fd['push'](_0x293d0a[0x9]);_0x2d74fd[_0x3c95('0x21')](_0x293d0a[0xa]);_0x2d74fd[_0x3c95('0x21')](_0x204d4d['interaction']['id']);_0x2d74fd[_0x3c95('0x21')](_0x204d4d[_0x3c95('0x16')]['id']);_0x2d74fd[_0x3c95('0x21')](_0x316c55[_0x3c95('0x2a')]);_0x2d74fd[_0x3c95('0x21')](_0x204d4d[_0x3c95('0x17')][_0x3c95('0x2b')]);_0x2d74fd[_0x3c95('0x21')](_0x204d4d[_0x3c95('0x2c')]['body']);_0x2d74fd[_0x3c95('0x21')](_0x4785a0);break;default:_0x2d74fd=_[_0x3c95('0xe')](_0x316c55[_0x3c95('0x1e')])?[]:_0x316c55[_0x3c95('0x1e')]['split'](',');}var _0x20efa0={'id':util[_0x3c95('0xc')]('%s:%s:%s',_0x33be41,_0x316c55['id'],_0x316c55[_0x3c95('0x2d')]),'condition':require(_0x3c95('0x2e'))[_0x3c95('0x2f')](_0x33be41,getIntervals(_0x1a80c6[_0x3c95('0x30')],_0x316c55),_0x1a80c6),'consequence':require(_0x3c95('0x31')+_0x316c55[_0x3c95('0x2d')])[_0x3c95('0x32')](_0x33be41,_0x2d74fd,_0x1a80c6,_0x204d4d),'p':_0x316c55[_0x3c95('0x33')]||0x0};logger[_0x3c95('0x34')](_0x3c95('0x35'),_0x20efa0['id'],_0x3c95('0x36'),getIntervals(_0x1a80c6['intervals'],_0x316c55)[_0x3c95('0x23')]('\x20|\x20'));_0x5e7f30[_0x3c95('0x21')](_0x20efa0);}else{logger[_0x3c95('0x37')](_0x3c95('0x38'),path['join'](__dirname,_0x3c95('0x1a'),_0x316c55[_0x3c95('0x2d')]+'.js'));}}_0x1a80c6[_0x3c95('0x14')][_0x33be41]=new RuleEngine(_0x5e7f30);_0x1a80c6[_0x3c95('0x14')][_0x33be41][_0x3c95('0x39')](_0x204d4d,function(_0x548e96){logger[_0x3c95('0x34')](_0x3c95('0x3a'),JSON[_0x3c95('0x3b')](_0x548e96[_0x3c95('0x3c')]));if(_0x1a80c6[_0x3c95('0x14')][_0x33be41]){_0x1a80c6[_0x3c95('0x14')][_0x33be41][_0x3c95('0x3d')](_0x3c95('0x3e'));}});return _0xf59068({'code':0xc8,'message':_0x204d4d});}else{if(_0x1af909){logger['info'](util[_0x3c95('0xc')](_0x3c95('0x3f'),_0x33be41));}else{logger[_0x3c95('0x34')]('No\x20applications\x20to\x20execute');}return _0xf59068({'code':0xc8,'message':_0x204d4d});}}catch(_0x4717da){logger[_0x3c95('0x37')](_0x4717da[_0x3c95('0x40')]);return _0x1ff558(_0x1cbe31[_0x3c95('0x37')](0x1f4,_0x4717da));}}return _0x1ff558('routing\x20is\x20empty');});},'AcceptMessage':function(_0x39be5c){var _0x425fc5=this;return new Promise(function(_0x1d4546,_0x49d3a2){if(_0x39be5c[_0x3c95('0x41')]&&_0x39be5c[_0x3c95('0x41')]['id']){if(_0x1a80c6[_0x3c95('0x42')][_0x39be5c[_0x3c95('0x41')]['id']]){_0x1a80c6[_0x3c95('0x42')][_0x39be5c[_0x3c95('0x41')]['id']][_0x3c95('0x43')]=![];_0x1a80c6['agents'][_0x39be5c['agent']['id']][_0x3c95('0x44')]=undefined;}}if(_0x39be5c[_0x3c95('0x16')]&&_0x39be5c['message']['id']){try{var _0x4be3a8=getId(_0x39be5c['channel'],_0x39be5c[_0x3c95('0x16')]?_0x39be5c[_0x3c95('0x16')]['id']:0x0,_0x39be5c[_0x3c95('0x17')]?_0x39be5c[_0x3c95('0x17')]['id']:0x0);if(_0x1a80c6['rules'][_0x4be3a8]){_0x1a80c6['rules'][_0x4be3a8][_0x3c95('0x3d')](_0x3c95('0x45'));if(rpc[_0x39be5c['channel']+_0x3c95('0x46')]){rpc[_0x39be5c['channel']+_0x3c95('0x46')][_0x3c95('0x47')](_0x4be3a8,{'UserId':_0x39be5c[_0x3c95('0x16')][_0x3c95('0x48')]})[_0x3c95('0x49')](function(){logger[_0x3c95('0x37')](_0x3c95('0x4a'));});}}return _0x1d4546({'code':0xc8,'message':_0x39be5c});}catch(_0x5dea20){logger[_0x3c95('0x37')](_0x5dea20['stack']);return _0x49d3a2(_0x425fc5[_0x3c95('0x37')](0x1f4,_0x5dea20));}}logger[_0x3c95('0x37')](_0x3c95('0x4b'));return _0x49d3a2(_0x425fc5['error'](0x1f4,_0x3c95('0x4b')));});},'RejectMessage':function(_0x3c1b80){var _0x26d8dc=this;return new Promise(function(_0x3e044b,_0x30062e){if(_0x3c1b80[_0x3c95('0x41')]&&_0x3c1b80[_0x3c95('0x41')]['id']){try{if(_0x1a80c6[_0x3c95('0x42')][_0x3c1b80[_0x3c95('0x41')]['id']]){_0x1a80c6[_0x3c95('0x42')][_0x3c1b80[_0x3c95('0x41')]['id']]['busy']=![];_0x1a80c6[_0x3c95('0x42')][_0x3c1b80[_0x3c95('0x41')]['id']][_0x3c95('0x44')]=undefined;}return _0x3e044b({'code':0xc8,'message':_0x3c1b80});}catch(_0x2c512e){logger['error'](_0x2c512e[_0x3c95('0x40')]);return _0x30062e(_0x26d8dc[_0x3c95('0x37')](0x1f4,_0x2c512e));}}logger[_0x3c95('0x37')](_0x3c95('0x4b'));return _0x30062e(_0x26d8dc[_0x3c95('0x37')](0x1f4,_0x3c95('0x4b')));});},'AbandonInteraction':function(_0x53c90f){var _0x58b600=this;return new Promise(function(_0x4bfbfd,_0x55acdf){if(_0x53c90f[_0x3c95('0x15')]&&_0x53c90f['interaction']&&_0x53c90f[_0x3c95('0x17')]['id']){try{var _0x374a06=getId(_0x53c90f[_0x3c95('0x15')],_0x53c90f[_0x3c95('0x16')]?_0x53c90f['message']['id']:0x0,_0x53c90f[_0x3c95('0x17')]?_0x53c90f['interaction']['id']:0x0);if(_0x1a80c6[_0x3c95('0x14')][_0x374a06]){_0x1a80c6['rules'][_0x374a06]['emit']('end');}return _0x4bfbfd({'code':0xc8,'message':_0x53c90f});}catch(_0x2370cd){logger[_0x3c95('0x37')](_0x2370cd[_0x3c95('0x40')]);return _0x55acdf(_0x58b600['error'](0x1f4,_0x2370cd));}}logger[_0x3c95('0x37')](_0x3c95('0x4b'));return _0x55acdf(_0x58b600[_0x3c95('0x37')](0x1f4,_0x3c95('0x4b')));});},'AgentCapacity':function(_0x5f49e0){var _0x34241a=this;return new Promise(function(_0x36840f,_0x1e525e){if(_0x1a80c6[_0x3c95('0x42')]['hasOwnProperty'](_0x5f49e0['id'])){for(var _0xbde9ec in _0x5f49e0[_0x3c95('0x4c')]){if(_0x5f49e0[_0x3c95('0x4c')]['hasOwnProperty'](_0xbde9ec)){if(_0x1a80c6[_0x3c95('0x42')][_0x5f49e0['id']][_0x3c95('0x4d')](_0xbde9ec+_0x3c95('0x4e'))){_0x1a80c6['agents'][_0x5f49e0['id']][_0xbde9ec+_0x3c95('0x4e')]=parseInt(_0x5f49e0['capacity'][_0xbde9ec],0xa);}}}_0x1a80c6[_0x3c95('0x42')][_0x5f49e0['id']]['updateRealtime']();return _0x36840f({'code':0xc8,'message':_0x1a80c6[_0x3c95('0x42')][_0x5f49e0['id']]});}else{return _0x1e525e(_0x34241a['error'](0x1f4,_0x3c95('0x4f')));}});},'Agents':function(_0x2831d0){return new Promise(function(_0x290e3){var _0x2b9a15=_[_0x3c95('0x50')](_0x1a80c6['agents']);if(_0x2831d0&&_0x2831d0['id']){var _0x865137=_[_0x3c95('0x51')](_0x2b9a15,function(_0x1145a7){return _0x1145a7['id']===_0x2831d0['id'];});_0x290e3(_0x865137);}else{_0x290e3({'count':_0x2b9a15[_0x3c95('0x1b')],'rows':_0x2b9a15});}});},'ChatQueues':function(){return new Promise(function(_0x127557){var _0x42757c=[];for(var _0x3395ea in _0x1a80c6[_0x3c95('0x52')]){if(_0x1a80c6['chatQueues'][_0x3c95('0x4d')](_0x3395ea)){var _0x5463d7=_0x1a80c6[_0x3c95('0x52')][_0x3395ea];var _0x1403c0={'id':_0x5463d7['id'],'available':_0x5463d7['available'],'loggedIn':_0x5463d7[_0x3c95('0x53')],'name':_0x5463d7[_0x3c95('0x54')],'paused':_0x5463d7[_0x3c95('0x55')],'waiting':_0x5463d7[_0x3c95('0x56')]};_0x42757c['push'](_0x1403c0);}}_0x127557({'count':_0x42757c[_0x3c95('0x1b')],'rows':_0x42757c});});},'MailQueues':function(){return new Promise(function(_0xad9dd1){var _0x53fe52=[];for(var _0x39e4bc in _0x1a80c6['mailQueues']){if(_0x1a80c6[_0x3c95('0x57')][_0x3c95('0x4d')](_0x39e4bc)){var _0x340b00=_0x1a80c6[_0x3c95('0x57')][_0x39e4bc];var _0x744731={'id':_0x340b00['id'],'available':_0x340b00[_0x3c95('0x58')],'loggedIn':_0x340b00[_0x3c95('0x53')],'name':_0x340b00['name'],'paused':_0x340b00[_0x3c95('0x55')],'waiting':_0x340b00['waiting']};_0x53fe52['push'](_0x744731);}}_0xad9dd1({'count':_0x53fe52[_0x3c95('0x1b')],'rows':_0x53fe52});});},'OpenchannelQueues':function(){return new Promise(function(_0xf8ad0a){var _0x4b113d=[];for(var _0x1e533a in _0x1a80c6[_0x3c95('0x59')]){if(_0x1a80c6['openchannelQueues']['hasOwnProperty'](_0x1e533a)){var _0x41ea79=_0x1a80c6[_0x3c95('0x59')][_0x1e533a];var _0x23b97b={'id':_0x41ea79['id'],'available':_0x41ea79[_0x3c95('0x58')],'loggedIn':_0x41ea79[_0x3c95('0x53')],'name':_0x41ea79[_0x3c95('0x54')],'paused':_0x41ea79[_0x3c95('0x55')],'waiting':_0x41ea79[_0x3c95('0x56')]};_0x4b113d[_0x3c95('0x21')](_0x23b97b);}}_0xf8ad0a({'count':_0x4b113d[_0x3c95('0x1b')],'rows':_0x4b113d});});},'SmsQueues':function(){return new Promise(function(_0x41ab2e){var _0x137600=[];for(var _0x176347 in _0x1a80c6[_0x3c95('0x5a')]){if(_0x1a80c6['smsQueues'][_0x3c95('0x4d')](_0x176347)){var _0x263802=_0x1a80c6[_0x3c95('0x5a')][_0x176347];var _0x433d46={'id':_0x263802['id'],'available':_0x263802[_0x3c95('0x58')],'loggedIn':_0x263802[_0x3c95('0x53')],'name':_0x263802[_0x3c95('0x54')],'paused':_0x263802[_0x3c95('0x55')],'waiting':_0x263802['waiting']};_0x137600[_0x3c95('0x21')](_0x433d46);}}_0x41ab2e({'count':_0x137600[_0x3c95('0x1b')],'rows':_0x137600});});},'FaxQueues':function(){return new Promise(function(_0x2ac893){var _0x3a6f9e=[];for(var _0x4384b1 in _0x1a80c6[_0x3c95('0x5b')]){if(_0x1a80c6[_0x3c95('0x5b')][_0x3c95('0x4d')](_0x4384b1)){var _0x47be8b=_0x1a80c6[_0x3c95('0x5b')][_0x4384b1];var _0x28e21e={'id':_0x47be8b['id'],'available':_0x47be8b[_0x3c95('0x58')],'loggedIn':_0x47be8b['loggedIn'],'name':_0x47be8b[_0x3c95('0x54')],'paused':_0x47be8b[_0x3c95('0x55')],'waiting':_0x47be8b[_0x3c95('0x56')]};_0x3a6f9e[_0x3c95('0x21')](_0x28e21e);}}_0x2ac893({'count':_0x3a6f9e[_0x3c95('0x1b')],'rows':_0x3a6f9e});});},'WhatsappQueues':function(){return new Promise(function(_0x48e11e){var _0x2f81a0=[];for(var _0x5e4662 in _0x1a80c6['whatsappQueues']){if(_0x1a80c6[_0x3c95('0x5c')][_0x3c95('0x4d')](_0x5e4662)){var _0x5ae34b=_0x1a80c6[_0x3c95('0x5c')][_0x5e4662];var _0x31e5d2={'id':_0x5ae34b['id'],'available':_0x5ae34b['available'],'loggedIn':_0x5ae34b[_0x3c95('0x53')],'name':_0x5ae34b[_0x3c95('0x54')],'paused':_0x5ae34b[_0x3c95('0x55')],'waiting':_0x5ae34b['waiting']};_0x2f81a0[_0x3c95('0x21')](_0x31e5d2);}}_0x48e11e({'count':_0x2f81a0[_0x3c95('0x1b')],'rows':_0x2f81a0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5debbc){var _0x34d116=_[_0x3c95('0x50')](_0x1a80c6['chatQueuesWaitingInteractions']);_0x5debbc({'count':_0x34d116[_0x3c95('0x1b')],'rows':_0x34d116});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x352682){var _0x4d856b=_[_0x3c95('0x50')](_0x1a80c6[_0x3c95('0x5d')]);_0x352682({'count':_0x4d856b[_0x3c95('0x1b')],'rows':_0x4d856b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1d40d2){var _0x3c6734=_[_0x3c95('0x50')](_0x1a80c6['openchannelQueuesWaitingInteractions']);_0x1d40d2({'count':_0x3c6734[_0x3c95('0x1b')],'rows':_0x3c6734});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3830b8){var _0x2ce737=_[_0x3c95('0x50')](_0x1a80c6[_0x3c95('0x5e')]);_0x3830b8({'count':_0x2ce737['length'],'rows':_0x2ce737});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3c54af){var _0x21c180=_[_0x3c95('0x50')](_0x1a80c6[_0x3c95('0x5f')]);_0x3c54af({'count':_0x21c180[_0x3c95('0x1b')],'rows':_0x21c180});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x10c02f){var _0x2d15df=_['values'](_0x1a80c6['whatsappQueuesWaitingInteractions']);_0x10c02f({'count':_0x2d15df[_0x3c95('0x1b')],'rows':_0x2d15df});});}};var _0x55f20e=jayson[_0x3c95('0x60')](_0x5a982e)[_0x3c95('0x61')]();_0x55f20e['on'](_0x3c95('0x37'),function(_0x13e602){logger[_0x3c95('0x37')](JSON[_0x3c95('0x3b')](_0x13e602));return _0x36bb37(_0x13e602);});_0x55f20e[_0x3c95('0x13')](0x232c,_0x3c95('0x62'),function(){console[_0x3c95('0x63')](_0x3c95('0x64'),0x232c);return _0x2d5937('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x672a=['applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','transfer'];(function(_0x32414b,_0xfad5a8){var _0x5187e3=function(_0x23e73c){while(--_0x23e73c){_0x32414b['push'](_0x32414b['shift']());}};_0x5187e3(++_0xfad5a8);}(_0x672a,0x122));var _0xa672=function(_0x760ad4,_0x50e4a7){_0x760ad4=_0x760ad4-0x0;var _0x650dd1=_0x672a[_0x760ad4];return _0x650dd1;};'use strict';var _=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var fs=require('fs');var jayson=require(_0xa672('0x3'));var BPromise=require(_0xa672('0x4'));var utils=require(_0xa672('0x5'));var sUtils=require(_0xa672('0x6'));var logger=require(_0xa672('0x7'))(_0xa672('0x8'));var rpc={'openchannelQueueReport':require(_0xa672('0x9')),'mailQueueReport':require(_0xa672('0xa')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xa672('0xb')),'faxQueueReport':require(_0xa672('0xc')),'whatsappQueueReport':require(_0xa672('0xd'))};var RuleEngine=require(_0xa672('0xe'));function getId(_0x13402c,_0x3f18d8,_0x338516){return util[_0xa672('0xf')](_0xa672('0x10'),_0x13402c,_0x3f18d8||0x0,_0x338516||0x0);}function getIntervals(_0x370f20,_0x215c43){var _0x2f2b63=[];if(!_[_0xa672('0x11')](_0x215c43[_0xa672('0x12')])&&!_['isNil'](_0x370f20[_0x215c43[_0xa672('0x12')]])&&!_[_0xa672('0x11')](_0x370f20[_0x215c43['IntervalId']][_0xa672('0x13')])){_0x2f2b63=_[_0xa672('0x14')](_0x370f20[_0x215c43[_0xa672('0x12')]][_0xa672('0x13')],_0xa672('0x15'));}else if(!_[_0xa672('0x11')](_0x215c43[_0xa672('0x15')])){_0x2f2b63=[_0x215c43[_0xa672('0x15')]];}return _0x2f2b63;}exports[_0xa672('0x16')]=function(_0x540a20){_0x540a20[_0xa672('0x17')]={};return new BPromise(function(_0x3e1855,_0x587ecd){var _0x58948a={'Start':function(_0x43eab2){var _0x5bc33f=this;return new Promise(function(_0x54950e,_0x598ebd){if(_0x43eab2){try{var _0x844fb9=[];var _0x582a75=getId(_0x43eab2['channel'],_0x43eab2[_0xa672('0x18')]?_0x43eab2[_0xa672('0x18')]['id']:0x0,_0x43eab2[_0xa672('0x19')]?_0x43eab2[_0xa672('0x19')]['id']:0x0);var _0x929a34=sUtils[_0xa672('0x1a')](_0x540a20,_0x43eab2);if(_0x43eab2[_0xa672('0x1b')]||!_0x929a34&&_0x43eab2[_0xa672('0x1c')]&&_[_0xa672('0x1d')](_0x43eab2[_0xa672('0x1c')])&&_0x43eab2['applications'][_0xa672('0x1e')]){for(var _0x2efb78=0x0;_0x2efb78<_0x43eab2[_0xa672('0x1c')][_0xa672('0x1e')];_0x2efb78+=0x1){var _0x39acfb=_0x43eab2[_0xa672('0x1c')][_0x2efb78];if(fs['existsSync'](path[_0xa672('0x1f')](__dirname,_0xa672('0x1c'),_0x39acfb[_0xa672('0x20')]+_0xa672('0x21')))){var _0x394e54=[];switch(_0x39acfb['app'][_0xa672('0x22')]()){case _0xa672('0x23'):var _0x2bc5db=_0x39acfb[_0xa672('0x24')]['split'](',');if(_0x43eab2['channel']===_0xa672('0x25')){_0x394e54['push'](_0x2bc5db[0x0]);_0x394e54[_0xa672('0x26')](_0x2bc5db[0x1]);_0x394e54[_0xa672('0x26')](_0x2bc5db[_0xa672('0x27')](0x2,_0x2bc5db[_0xa672('0x1e')])[_0xa672('0x1f')](','));}else{_0x394e54[_0xa672('0x26')](_0x2bc5db[0x0]);_0x394e54['push'](_0x2bc5db['slice'](0x1,_0x2bc5db[_0xa672('0x1e')])[_0xa672('0x1f')](','));}break;case _0xa672('0x28'):var _0x5d3d6a=_0x39acfb[_0xa672('0x24')][_0xa672('0x29')](',');_0x394e54['push'](_0x5d3d6a[0x0]);_0x394e54[_0xa672('0x26')](_0x5d3d6a[0x1]);_0x394e54[_0xa672('0x26')](_0x5d3d6a['slice'](0x2,_0x5d3d6a[_0xa672('0x1e')])[_0xa672('0x1f')](','));break;case _0xa672('0x2a'):var _0x2478e4=_0x39acfb[_0xa672('0x24')][_0xa672('0x29')](',');_0x394e54[_0xa672('0x26')](_0x2478e4[0x0]);_0x394e54[_0xa672('0x26')](_0x2478e4[0x1]);_0x394e54['push'](_0x2478e4[0x2]);_0x394e54[_0xa672('0x26')](_0x2478e4[0x3]);_0x394e54[_0xa672('0x26')](_0x2478e4[_0xa672('0x27')](0x4,_0x2478e4[_0xa672('0x1e')])[_0xa672('0x1f')](','));break;case _0xa672('0x2b'):var _0x5192ae=_0x39acfb[_0xa672('0x24')]['split'](',');_0x394e54[_0xa672('0x26')](_0x5192ae[0x0]);_0x394e54[_0xa672('0x26')](_0x5192ae[0x1]);_0x394e54[_0xa672('0x26')](_0x5192ae[0x2]);_0x394e54[_0xa672('0x26')](_0x5192ae[0x3]);_0x394e54[_0xa672('0x26')](_0x5192ae['slice'](0x4,_0x5192ae['length'])['join'](','));break;case _0xa672('0x18'):_0x394e54['push'](_0x39acfb[_0xa672('0x24')]);break;case _0xa672('0x2c'):_0x394e54[_0xa672('0x26')](_0x39acfb[_0xa672('0x2d')]);_0x394e54['push'](_0x39acfb[_0xa672('0x24')]);break;case _0xa672('0x2e'):var _0xa9f106=utils[_0xa672('0x2f')](_0x43eab2['account']['notificationTemplate'],_0x43eab2);var _0x1e64cc=_0x39acfb[_0xa672('0x24')][_0xa672('0x29')](',');_0x394e54[_0xa672('0x26')](_0x1e64cc[0x0]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x1]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x2]);_0x394e54['push'](_0x1e64cc[0x3]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x4]);_0x394e54['push'](_0x1e64cc[0x5]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x6]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x7]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x8]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0x9]);_0x394e54[_0xa672('0x26')](_0x1e64cc[0xa]);_0x394e54[_0xa672('0x26')](_0x43eab2['interaction']['id']);_0x394e54['push'](_0x43eab2[_0xa672('0x18')]['id']);_0x394e54[_0xa672('0x26')](_0x39acfb[_0xa672('0x30')]);_0x394e54[_0xa672('0x26')](_0x43eab2[_0xa672('0x19')][_0xa672('0x31')]);_0x394e54[_0xa672('0x26')](_0x43eab2[_0xa672('0x32')][_0xa672('0x32')]);_0x394e54[_0xa672('0x26')](_0xa9f106);break;default:_0x394e54=_[_0xa672('0x11')](_0x39acfb[_0xa672('0x24')])?[]:_0x39acfb[_0xa672('0x24')]['split'](',');}var _0x270dc2={'id':util['format'](_0xa672('0x33'),_0x582a75,_0x39acfb['id'],_0x39acfb[_0xa672('0x20')]),'condition':require(_0xa672('0x34'))['condition'](_0x582a75,getIntervals(_0x540a20[_0xa672('0x35')],_0x39acfb),_0x540a20),'consequence':require('./applications/'+_0x39acfb[_0xa672('0x20')])[_0xa672('0x36')](_0x582a75,_0x394e54,_0x540a20,_0x43eab2),'p':_0x39acfb[_0xa672('0x37')]||0x0};logger[_0xa672('0x38')](_0xa672('0x39'),_0x270dc2['id'],_0xa672('0x3a'),getIntervals(_0x540a20[_0xa672('0x35')],_0x39acfb)['join'](_0xa672('0x3b')));_0x844fb9[_0xa672('0x26')](_0x270dc2);}else{logger[_0xa672('0x3c')](_0xa672('0x3d'),path[_0xa672('0x1f')](__dirname,_0xa672('0x1c'),_0x39acfb[_0xa672('0x20')]+_0xa672('0x21')));}}_0x540a20['rules'][_0x582a75]=new RuleEngine(_0x844fb9);_0x540a20[_0xa672('0x17')][_0x582a75][_0xa672('0x3e')](_0x43eab2,function(_0x4d5eb0){logger[_0xa672('0x38')](_0xa672('0x3f'),JSON['stringify'](_0x4d5eb0[_0xa672('0x40')]));if(_0x540a20[_0xa672('0x17')][_0x582a75]){_0x540a20['rules'][_0x582a75][_0xa672('0x41')]('complete');}});return _0x54950e({'code':0xc8,'message':_0x43eab2});}else{if(_0x929a34){logger[_0xa672('0x38')](util['format'](_0xa672('0x42'),_0x582a75));}else{logger[_0xa672('0x38')](_0xa672('0x43'));}return _0x54950e({'code':0xc8,'message':_0x43eab2});}}catch(_0xf8a33){logger['error'](_0xf8a33['stack']);return _0x598ebd(_0x5bc33f[_0xa672('0x3c')](0x1f4,_0xf8a33));}}return _0x598ebd(_0xa672('0x44'));});},'AcceptMessage':function(_0xae3087){var _0x268db6=this;return new Promise(function(_0x4f9311,_0x36fa7d){if(_0xae3087[_0xa672('0x45')]&&_0xae3087['agent']['id']){if(_0x540a20['agents'][_0xae3087['agent']['id']]){_0x540a20[_0xa672('0x46')][_0xae3087[_0xa672('0x45')]['id']][_0xa672('0x47')]=![];_0x540a20['agents'][_0xae3087[_0xa672('0x45')]['id']][_0xa672('0x48')]=undefined;}}if(_0xae3087['message']&&_0xae3087[_0xa672('0x18')]['id']){try{var _0x5612a0=getId(_0xae3087['channel'],_0xae3087[_0xa672('0x18')]?_0xae3087[_0xa672('0x18')]['id']:0x0,_0xae3087[_0xa672('0x19')]?_0xae3087[_0xa672('0x19')]['id']:0x0);if(_0x540a20[_0xa672('0x17')][_0x5612a0]){_0x540a20[_0xa672('0x17')][_0x5612a0][_0xa672('0x41')](_0xa672('0x49'));if(rpc[_0xae3087['channel']+_0xa672('0x4a')]){rpc[_0xae3087['channel']+'QueueReport'][_0xa672('0x4b')](_0x5612a0,{'UserId':_0xae3087[_0xa672('0x18')][_0xa672('0x4c')]})[_0xa672('0x4d')](function(){logger[_0xa672('0x3c')](_0xa672('0x4e'));});}}return _0x4f9311({'code':0xc8,'message':_0xae3087});}catch(_0x4f58c3){logger['error'](_0x4f58c3[_0xa672('0x4f')]);return _0x36fa7d(_0x268db6[_0xa672('0x3c')](0x1f4,_0x4f58c3));}}logger[_0xa672('0x3c')](_0xa672('0x50'));return _0x36fa7d(_0x268db6[_0xa672('0x3c')](0x1f4,_0xa672('0x50')));});},'RejectMessage':function(_0x5a07f3){var _0x1d1f23=this;return new Promise(function(_0x1b2c6,_0xc5ec6d){if(_0x5a07f3[_0xa672('0x45')]&&_0x5a07f3[_0xa672('0x45')]['id']){try{if(_0x540a20[_0xa672('0x46')][_0x5a07f3[_0xa672('0x45')]['id']]){_0x540a20[_0xa672('0x46')][_0x5a07f3[_0xa672('0x45')]['id']][_0xa672('0x47')]=![];_0x540a20[_0xa672('0x46')][_0x5a07f3[_0xa672('0x45')]['id']][_0xa672('0x48')]=undefined;}return _0x1b2c6({'code':0xc8,'message':_0x5a07f3});}catch(_0x48c963){logger[_0xa672('0x3c')](_0x48c963['stack']);return _0xc5ec6d(_0x1d1f23['error'](0x1f4,_0x48c963));}}logger[_0xa672('0x3c')](_0xa672('0x50'));return _0xc5ec6d(_0x1d1f23['error'](0x1f4,_0xa672('0x50')));});},'AbandonInteraction':function(_0x533ccd){var _0x339525=this;return new Promise(function(_0x2a7b3a,_0x5e6783){if(_0x533ccd['channel']&&_0x533ccd[_0xa672('0x19')]&&_0x533ccd['interaction']['id']){try{var _0x471595=getId(_0x533ccd['channel'],_0x533ccd[_0xa672('0x18')]?_0x533ccd[_0xa672('0x18')]['id']:0x0,_0x533ccd['interaction']?_0x533ccd[_0xa672('0x19')]['id']:0x0);if(_0x540a20[_0xa672('0x17')][_0x471595]){_0x540a20[_0xa672('0x17')][_0x471595][_0xa672('0x41')](_0xa672('0x49'));}return _0x2a7b3a({'code':0xc8,'message':_0x533ccd});}catch(_0x4e07da){logger[_0xa672('0x3c')](_0x4e07da[_0xa672('0x4f')]);return _0x5e6783(_0x339525[_0xa672('0x3c')](0x1f4,_0x4e07da));}}logger['error'](_0xa672('0x50'));return _0x5e6783(_0x339525[_0xa672('0x3c')](0x1f4,_0xa672('0x50')));});},'AgentCapacity':function(_0x5770ee){var _0x520e27=this;return new Promise(function(_0x27bac0,_0xe2f16d){if(_0x540a20['agents'][_0xa672('0x51')](_0x5770ee['id'])){for(var _0x354bda in _0x5770ee[_0xa672('0x52')]){if(_0x5770ee[_0xa672('0x52')][_0xa672('0x51')](_0x354bda)){if(_0x540a20['agents'][_0x5770ee['id']][_0xa672('0x51')](_0x354bda+'CurrentCapacity')){_0x540a20['agents'][_0x5770ee['id']][_0x354bda+_0xa672('0x53')]=parseInt(_0x5770ee[_0xa672('0x52')][_0x354bda],0xa);}}}_0x540a20[_0xa672('0x46')][_0x5770ee['id']][_0xa672('0x54')]();return _0x27bac0({'code':0xc8,'message':_0x540a20[_0xa672('0x46')][_0x5770ee['id']]});}else{return _0xe2f16d(_0x520e27[_0xa672('0x3c')](0x1f4,_0xa672('0x55')));}});},'Agents':function(_0x48007a){return new Promise(function(_0x33d06b){var _0x17dd15=_[_0xa672('0x56')](_0x540a20[_0xa672('0x46')]);if(_0x48007a&&_0x48007a['id']){var _0x360fa5=_['find'](_0x17dd15,function(_0x52b9a4){return _0x52b9a4['id']===_0x48007a['id'];});_0x33d06b(_0x360fa5);}else{_0x33d06b({'count':_0x17dd15[_0xa672('0x1e')],'rows':_0x17dd15});}});},'ChatQueues':function(){return new Promise(function(_0x217357){var _0x55cce6=[];for(var _0x1596d1 in _0x540a20[_0xa672('0x57')]){if(_0x540a20[_0xa672('0x57')]['hasOwnProperty'](_0x1596d1)){var _0x2602b3=_0x540a20['chatQueues'][_0x1596d1];var _0x187841={'id':_0x2602b3['id'],'available':_0x2602b3[_0xa672('0x58')],'loggedIn':_0x2602b3[_0xa672('0x59')],'name':_0x2602b3[_0xa672('0x5a')],'paused':_0x2602b3['paused'],'waiting':_0x2602b3['waiting']};_0x55cce6[_0xa672('0x26')](_0x187841);}}_0x217357({'count':_0x55cce6[_0xa672('0x1e')],'rows':_0x55cce6});});},'MailQueues':function(){return new Promise(function(_0xb843db){var _0x206d64=[];for(var _0x15c50b in _0x540a20['mailQueues']){if(_0x540a20['mailQueues'][_0xa672('0x51')](_0x15c50b)){var _0x581086=_0x540a20[_0xa672('0x5b')][_0x15c50b];var _0x318257={'id':_0x581086['id'],'available':_0x581086[_0xa672('0x58')],'loggedIn':_0x581086[_0xa672('0x59')],'name':_0x581086[_0xa672('0x5a')],'paused':_0x581086[_0xa672('0x5c')],'waiting':_0x581086[_0xa672('0x5d')]};_0x206d64['push'](_0x318257);}}_0xb843db({'count':_0x206d64[_0xa672('0x1e')],'rows':_0x206d64});});},'OpenchannelQueues':function(){return new Promise(function(_0x426291){var _0x31a894=[];for(var _0x40ac08 in _0x540a20['openchannelQueues']){if(_0x540a20[_0xa672('0x5e')][_0xa672('0x51')](_0x40ac08)){var _0x4bf268=_0x540a20[_0xa672('0x5e')][_0x40ac08];var _0x5837b7={'id':_0x4bf268['id'],'available':_0x4bf268[_0xa672('0x58')],'loggedIn':_0x4bf268[_0xa672('0x59')],'name':_0x4bf268['name'],'paused':_0x4bf268['paused'],'waiting':_0x4bf268[_0xa672('0x5d')]};_0x31a894[_0xa672('0x26')](_0x5837b7);}}_0x426291({'count':_0x31a894[_0xa672('0x1e')],'rows':_0x31a894});});},'SmsQueues':function(){return new Promise(function(_0x29447f){var _0x160bfd=[];for(var _0x55414e in _0x540a20[_0xa672('0x5f')]){if(_0x540a20['smsQueues'][_0xa672('0x51')](_0x55414e)){var _0x4302a3=_0x540a20[_0xa672('0x5f')][_0x55414e];var _0x318d91={'id':_0x4302a3['id'],'available':_0x4302a3[_0xa672('0x58')],'loggedIn':_0x4302a3['loggedIn'],'name':_0x4302a3[_0xa672('0x5a')],'paused':_0x4302a3[_0xa672('0x5c')],'waiting':_0x4302a3[_0xa672('0x5d')]};_0x160bfd['push'](_0x318d91);}}_0x29447f({'count':_0x160bfd[_0xa672('0x1e')],'rows':_0x160bfd});});},'FaxQueues':function(){return new Promise(function(_0x90b9d2){var _0x495b04=[];for(var _0x3300c6 in _0x540a20['faxQueues']){if(_0x540a20[_0xa672('0x60')][_0xa672('0x51')](_0x3300c6)){var _0x1cc498=_0x540a20[_0xa672('0x60')][_0x3300c6];var _0x5d3a60={'id':_0x1cc498['id'],'available':_0x1cc498[_0xa672('0x58')],'loggedIn':_0x1cc498['loggedIn'],'name':_0x1cc498[_0xa672('0x5a')],'paused':_0x1cc498['paused'],'waiting':_0x1cc498[_0xa672('0x5d')]};_0x495b04['push'](_0x5d3a60);}}_0x90b9d2({'count':_0x495b04[_0xa672('0x1e')],'rows':_0x495b04});});},'WhatsappQueues':function(){return new Promise(function(_0x2d2a5a){var _0xe00635=[];for(var _0x457a42 in _0x540a20[_0xa672('0x61')]){if(_0x540a20['whatsappQueues'][_0xa672('0x51')](_0x457a42)){var _0x3e9961=_0x540a20[_0xa672('0x61')][_0x457a42];var _0x3737d0={'id':_0x3e9961['id'],'available':_0x3e9961[_0xa672('0x58')],'loggedIn':_0x3e9961[_0xa672('0x59')],'name':_0x3e9961[_0xa672('0x5a')],'paused':_0x3e9961['paused'],'waiting':_0x3e9961[_0xa672('0x5d')]};_0xe00635['push'](_0x3737d0);}}_0x2d2a5a({'count':_0xe00635[_0xa672('0x1e')],'rows':_0xe00635});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2c176){var _0x3817d3=_[_0xa672('0x56')](_0x540a20['chatQueuesWaitingInteractions']);_0x2c176({'count':_0x3817d3[_0xa672('0x1e')],'rows':_0x3817d3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xca16f){var _0x2ce8c5=_['values'](_0x540a20[_0xa672('0x62')]);_0xca16f({'count':_0x2ce8c5['length'],'rows':_0x2ce8c5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x48e0e6){var _0x15f7cb=_[_0xa672('0x56')](_0x540a20[_0xa672('0x63')]);_0x48e0e6({'count':_0x15f7cb[_0xa672('0x1e')],'rows':_0x15f7cb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x53ad38){var _0x567390=_[_0xa672('0x56')](_0x540a20['smsQueuesWaitingInteractions']);_0x53ad38({'count':_0x567390['length'],'rows':_0x567390});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3cddae){var _0x45e64f=_[_0xa672('0x56')](_0x540a20[_0xa672('0x64')]);_0x3cddae({'count':_0x45e64f[_0xa672('0x1e')],'rows':_0x45e64f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x15a6a4){var _0x2bc39f=_['values'](_0x540a20[_0xa672('0x65')]);_0x15a6a4({'count':_0x2bc39f['length'],'rows':_0x2bc39f});});}};var _0xe9e6f4=jayson['server'](_0x58948a)['http']();_0xe9e6f4['on']('error',function(_0x2f0f97){logger[_0xa672('0x3c')](JSON['stringify'](_0x2f0f97));return _0x587ecd(_0x2f0f97);});_0xe9e6f4[_0xa672('0x16')](0x232c,_0xa672('0x66'),function(){console[_0xa672('0x67')](_0xa672('0x68'),0x232c);return _0x3e1855(_0xa672('0x69')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2bf8c3f..88b6114 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 _0x3ad3=['length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','stop','util','bluebird','lodash','routing','client','http','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ad3,0x15b));var _0x33ad=function(_0x19861d,_0x5cd2f0){_0x19861d=_0x19861d-0x0;var _0xf697bc=_0x3ad3[_0x19861d];return _0xf697bc;};'use strict';var util=require(_0x33ad('0x0'));var BPromise=require(_0x33ad('0x1'));var jayson=require('jayson/promise');var _=require(_0x33ad('0x2'));var logger=require('../../../config/logger')(_0x33ad('0x3'));var client=jayson[_0x33ad('0x4')][_0x33ad('0x5')]({'port':0x232a});function request(_0x23545f,_0x2b6cd9){return new BPromise(function(_0x4a8906,_0x798482){return client['request'](_0x23545f,_0x2b6cd9)[_0x33ad('0x6')](function(_0xf3f809){if(_0xf3f809[_0x33ad('0x7')]){return _0x798482(_0xf3f809[_0x33ad('0x7')]['message']);}else{return _0x4a8906(_0xf3f809[_0x33ad('0x8')]);}})[_0x33ad('0x9')](function(_0x3ef400){return _0x798482(_0x3ef400);});});}exports[_0x33ad('0xa')]=function(_0x439122,_0x4a56a6,_0x550717){return function(_0x2327bb){if(_0x550717[_0x33ad('0xb')]&&!_0x550717[_0x33ad('0xb')][_0x439122]){logger['info'](_0x33ad('0xc'),_0x439122);return _0x2327bb['stop']();}var _0x201ff4=[];for(var _0x9837d8=0x0;_0x9837d8<_0x4a56a6[_0x33ad('0xd')];_0x9837d8+=0x1){_0x201ff4[_0x33ad('0xe')](request(_0x33ad('0xf'),{'command':util[_0x33ad('0x10')](_0x33ad('0x11'),_0x4a56a6[_0x9837d8])})[_0x33ad('0x6')](function(_0x21185f){return _0x21185f&&_0x21185f[_0x33ad('0x12')]&&_0x21185f[_0x33ad('0x12')][_0x33ad('0x13')](_0x33ad('0x14'))>=0x0?!![]:![];})[_0x33ad('0x9')](function(){logger[_0x33ad('0x7')](_0x33ad('0x15'),_0x439122,_0x4a56a6[_0x9837d8]);}));}BPromise[_0x33ad('0x16')](_0x201ff4)['then'](function(_0x46f52f){var _0x516eb6=_[_0x33ad('0x17')](_0x46f52f);logger[_0x33ad('0x18')](_0x33ad('0x19'),_0x439122,_0x4a56a6[_0x33ad('0x1a')](_0x33ad('0x1b')),_0x516eb6);_0x2327bb['when'](_0x516eb6);})[_0x33ad('0x9')](function(_0x4999ba){logger['error'](_0x33ad('0x19'),_0x439122,_0x4a56a6[_0x33ad('0x1a')](_0x33ad('0x1b')),_0x4999ba[_0x33ad('0x1c')]);_0x2327bb[_0x33ad('0x1d')]();});};}; \ No newline at end of file +var _0x4568=['result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','util','lodash','routing','request','then','error','message'];(function(_0x1e2a39,_0x50bbab){var _0x2b47fa=function(_0x53324e){while(--_0x53324e){_0x1e2a39['push'](_0x1e2a39['shift']());}};_0x2b47fa(++_0x50bbab);}(_0x4568,0x191));var _0x8456=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4568[_0x2d34d6];return _0x1d3d12;};'use strict';var util=require(_0x8456('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x8456('0x1'));var logger=require('../../../config/logger')(_0x8456('0x2'));var client=jayson['client']['http']({'port':0x232a});function request(_0x4a88bd,_0x4ed0e7){return new BPromise(function(_0x1ca654,_0x23c8d7){return client[_0x8456('0x3')](_0x4a88bd,_0x4ed0e7)[_0x8456('0x4')](function(_0x3daf07){if(_0x3daf07[_0x8456('0x5')]){return _0x23c8d7(_0x3daf07[_0x8456('0x5')][_0x8456('0x6')]);}else{return _0x1ca654(_0x3daf07[_0x8456('0x7')]);}})[_0x8456('0x8')](function(_0x2403aa){return _0x23c8d7(_0x2403aa);});});}exports[_0x8456('0x9')]=function(_0x1a22d3,_0x227555,_0x43cbd7){return function(_0x390faa){if(_0x43cbd7['rules']&&!_0x43cbd7[_0x8456('0xa')][_0x1a22d3]){logger[_0x8456('0xb')](_0x8456('0xc'),_0x1a22d3);return _0x390faa[_0x8456('0xd')]();}var _0x10f47d=[];for(var _0x1cf3b7=0x0;_0x1cf3b7<_0x227555['length'];_0x1cf3b7+=0x1){_0x10f47d[_0x8456('0xe')](request(_0x8456('0xf'),{'command':util[_0x8456('0x10')](_0x8456('0x11'),_0x227555[_0x1cf3b7])})[_0x8456('0x4')](function(_0x2c4088){return _0x2c4088&&_0x2c4088[_0x8456('0x6')]&&_0x2c4088[_0x8456('0x6')][_0x8456('0x12')](_0x8456('0x13'))>=0x0?!![]:![];})[_0x8456('0x8')](function(){logger[_0x8456('0x5')](_0x8456('0x14'),_0x1a22d3,_0x227555[_0x1cf3b7]);}));}BPromise['all'](_0x10f47d)[_0x8456('0x4')](function(_0x5e6bed){var _0x263617=_[_0x8456('0x15')](_0x5e6bed);logger['info'](_0x8456('0x16'),_0x1a22d3,_0x227555['join']('\x20|\x20'),_0x263617);_0x390faa['when'](_0x263617);})[_0x8456('0x8')](function(_0xe058f){logger[_0x8456('0x5')](_0x8456('0x16'),_0x1a22d3,_0x227555[_0x8456('0x17')]('\x20|\x20'),_0xe058f['stack']);_0x390faa['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index acb304c..a8cab55 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 _0x702d=['error','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','info'];(function(_0x450ab5,_0x523aea){var _0x5f49df=function(_0x45aef8){while(--_0x45aef8){_0x450ab5['push'](_0x450ab5['shift']());}};_0x5f49df(++_0x523aea);}(_0x702d,0x147));var _0xd702=function(_0x4ef06c,_0x5ebe49){_0x4ef06c=_0x4ef06c-0x0;var _0x22a643=_0x702d[_0x4ef06c];return _0x22a643;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var utils=require(_0xd702('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33e7c5,_0x37ed5c){utils['info'](util[_0xd702('0x3')](_0xd702('0x4'),_0x33e7c5[_0xd702('0x5')],_0x33e7c5[_0xd702('0x6')],_0x33e7c5['queue'],_0x33e7c5[_0xd702('0x7')],_0x33e7c5['interface'],_0x33e7c5[_0xd702('0x8')],_0x33e7c5[_0xd702('0x9')],_0x33e7c5[_0xd702('0xa')]));if(_0x33e7c5['queue']){utils[_0xd702('0xb')](_0x33e7c5['queue'])[_0xd702('0xc')](function(_0x25423f){if(_0x25423f){_0x33e7c5[_0xd702('0xd')]=_0x25423f[_0xd702('0xd')];_0x33e7c5[_0xd702('0xe')]=_0x33e7c5[_0xd702('0xf')]?_0x25423f[_0xd702('0x10')]:![];_0x33e7c5[_0xd702('0x11')]=_0x33e7c5[_0xd702('0xe')]?_0x25423f[_0xd702('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x33e7c5);});}else{utils[_0xd702('0x13')](_0xd702('0x14'),_0x33e7c5);}if(_0x37ed5c){delete transfers[_0x33e7c5[_0xd702('0x5')]];}else{delete agents[_0x33e7c5['destuniqueid']];}}exports[_0xd702('0x15')]=function(_0x128add){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x128add);agents[_0x128add['destuniqueid']]=_0x128add;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x19')]=utils['now']();agents[_0x128add[_0xd702('0x18')]]['lastevent']=_0xd702('0x1a');agents[_0x128add[_0xd702('0x18')]]['connectedlinenum']=null;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x1b')]=null;utils[_0xd702('0x1c')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x128add[_0xd702('0x5')],agents[_0x128add['destuniqueid']][_0xd702('0x7')],_0x128add[_0xd702('0x18')]));}catch(_0x37267c){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x37267c);}};exports['agentringnoanswer']=function(_0x4be140){try{if(!_['isNil'](agents[_0x4be140[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x4be140);utils[_0xd702('0x1c')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4be140['uniqueid'],agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x7')],_0x4be140[_0xd702('0x18')]));agents[_0x4be140['destuniqueid']][_0xd702('0x1f')]=!![];agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x20')]=utils[_0xd702('0x21')]();agents[_0x4be140[_0xd702('0x18')]][_0xd702('0xa')]=_0xd702('0x22');agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x23')]='timeout';agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x24')]=_0x4be140[_0xd702('0x25')]?parseInt(_0x4be140[_0xd702('0x25')])/0x3e8:0x0;agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x26')]=0x0;unanswered[_0xd702('0x27')](_0x4be140[_0xd702('0x18')]);}}catch(_0x5f1084){utils['error'](util[_0xd702('0x3')](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x5f1084);}};exports[_0xd702('0x28')]=function(_0xee8bf1){try{_[_0xd702('0x29')](agents,function(_0x2946ae,_0x56e9cd){if(_0x2946ae[_0xd702('0x5')]==_0xee8bf1[_0xd702('0x5')]&&!_[_0xd702('0x2a')](unanswered,_0x2946ae[_0xd702('0x18')])){utils[_0xd702('0x16')](util['format'](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xee8bf1);utils[_0xd702('0x1c')](util['format'](_0xd702('0x2c'),_0xee8bf1['uniqueid'],_0x2946ae['membername'],_0x2946ae[_0xd702('0x18')]));_0x2946ae[_0xd702('0x1f')]=!![];_0x2946ae[_0xd702('0x20')]=utils['now']();_0x2946ae[_0xd702('0xa')]=_0xd702('0x2d');_0x2946ae['reason']=_0xd702('0x2d');_0x2946ae[_0xd702('0x24')]=_0xee8bf1[_0xd702('0x24')];_0x2946ae[_0xd702('0x26')]=0x0;writeDB(_0x2946ae);}});}catch(_0xa6b40a){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xa6b40a);}};exports[_0xd702('0x2e')]=function(_0x9f458b){try{if(agents[_0x9f458b[_0xd702('0x18')]]){utils[_0xd702('0x16')](util['format'](_0xd702('0x2f'),_0x9f458b[_0xd702('0x5')]),_0x9f458b);utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x30'),_0x9f458b[_0xd702('0x5')],agents[_0x9f458b[_0xd702('0x18')]]['membername'],_0x9f458b['destuniqueid']));agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0x31')]=utils['now']();agents[_0x9f458b['destuniqueid']][_0xd702('0x9')]=_0x9f458b[_0xd702('0x9')];agents[_0x9f458b['destuniqueid']][_0xd702('0x1b')]=_0x9f458b[_0xd702('0x1b')];agents[_0x9f458b[_0xd702('0x18')]]['holdtime']=_0x9f458b[_0xd702('0x25')];agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0xa')]='connect';_[_0xd702('0x29')](agents,function(_0x512854,_0x359bbd){if(_0x512854[_0xd702('0x18')]!=_0x9f458b[_0xd702('0x18')]&&_0x512854[_0xd702('0x5')]==_0x9f458b[_0xd702('0x5')]){_0x512854[_0xd702('0x26')]=0x0;_0x512854[_0xd702('0x24')]=_0x9f458b[_0xd702('0x25')];_0x512854['agentringnoanswer']=!![];_0x512854[_0xd702('0x20')]=utils[_0xd702('0x21')]();_0x512854[_0xd702('0xa')]=_0xd702('0x32');_0x512854[_0xd702('0x23')]='answered_elsewhere';_0x512854[_0xd702('0x33')]=_0x9f458b[_0xd702('0x18')];_0x512854[_0xd702('0x34')]=_0x9f458b['membername'];writeDB(_0x512854);}});}}catch(_0xd48ad0){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2f'),_0x9f458b['uniqueid']),_0xd48ad0);}};exports[_0xd702('0xf')]=function(_0xfa5e9){try{if(!_[_0xd702('0x35')](agents[_0xfa5e9[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x36'),_0xfa5e9[_0xd702('0x5')]),_0xfa5e9);utils['info'](util['format'](_0xd702('0x37'),_0xfa5e9[_0xd702('0x5')],agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x7')],_0xfa5e9[_0xd702('0x18')]));agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0xf')]=!![];agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x38')]=utils['now']();agents[_0xfa5e9['destuniqueid']][_0xd702('0x26')]=utils['diffTime'](agents[_0xfa5e9[_0xd702('0x18')]]['agentcompleteAt'],agents[_0xfa5e9[_0xd702('0x18')]]['agentconnectAt']);agents[_0xfa5e9[_0xd702('0x18')]]['reason']=_0xfa5e9[_0xd702('0x23')];agents[_0xfa5e9[_0xd702('0x18')]]['lastevent']=_0xd702('0x39');writeDB(agents[_0xfa5e9[_0xd702('0x18')]]);}}catch(_0x2c0528){utils[_0xd702('0x1d')](util[_0xd702('0x3')]('[%s][agents][agentcomplete]',_0xfa5e9[_0xd702('0x5')]),_0x2c0528);}};exports[_0xd702('0x3a')]=function(_0x2d09be){try{if(!_['isNil'](agents[_0x2d09be[_0xd702('0x3b')]])){utils['debug'](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x2d09be);utils['info'](util['format'](_0xd702('0x3d'),_0x2d09be[_0xd702('0x5')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x7')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x5')]));agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3e')]=!![];agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3f')]='blind';agents[_0x2d09be['transfereruniqueid']][_0xd702('0x40')]=_0x2d09be[_0xd702('0x41')];agents[_0x2d09be[_0xd702('0x3b')]]['transferuniqueid']=agents[_0x2d09be['transfereruniqueid']][_0xd702('0x5')];}}catch(_0x54c7e2){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x54c7e2);}};exports[_0xd702('0x42')]=function(_0x3cd4c1){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1['origtransfereruniqueid']),_0x3cd4c1);if(_0x3cd4c1[_0xd702('0x44')]==_0x3cd4c1[_0xd702('0x45')]){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x46')]])){utils['info'](util[_0xd702('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1['secondtransfereruniqueid']]['membername']));agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3e')]=!![];agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1[_0xd702('0x46')]]['transferexten']=_0x3cd4c1[_0xd702('0x48')];agents[_0x3cd4c1[_0xd702('0x46')]]['transferuniqueid']=_0x3cd4c1[_0xd702('0x44')];}if(_0x3cd4c1[_0xd702('0x49')]&&agents[_0x3cd4c1[_0xd702('0x49')]]){agents[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1[_0xd702('0x49')]]=_['clone'](agents[_0x3cd4c1[_0xd702('0x49')]]);transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x8')];transfers[_0x3cd4c1['transfereeuniqueid']]['calleridname']=agents[_0x3cd4c1[_0xd702('0x46')]]['calleridname'];transfers[_0x3cd4c1['transfereeuniqueid']][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x31')]=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x49')]]['holdtime']=0x0;transfers[_0x3cd4c1[_0xd702('0x49')]]['agententerreason']=0x2;}}else if(_0x3cd4c1[_0xd702('0x46')]==_0x3cd4c1['secondtransfererlinkedid']){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x44')]])){utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x4b'),_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1[_0xd702('0x44')]]['membername']));agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3e')]=!![];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x40')]=_0x3cd4c1[_0xd702('0x4c')];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x4d')]=_0x3cd4c1['secondtransfereruniqueid'];}if(_0x3cd4c1[_0xd702('0x4e')]&&agents[_0x3cd4c1[_0xd702('0x4e')]]){agents[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1['transfertargetuniqueid']]=_[_0xd702('0x4f')](agents[_0x3cd4c1[_0xd702('0x4e')]]);transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x44')]]['calleridnum'];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x50')]=agents[_0x3cd4c1[_0xd702('0x44')]][_0xd702('0x50')];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x4e')]]['agentconnectAt']=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x24')]=0x0;transfers[_0x3cd4c1[_0xd702('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e99ff){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1[_0xd702('0x44')]),_0x3e99ff);}};exports['hangup']=function(_0x5bc3dd){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x5bc3dd);if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]===_0xd702('0x22')){if(_0x5bc3dd[_0xd702('0x52')]==='21'){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x53');agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]=_0xd702('0x53');}utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd['uniqueid']][_0xd702('0x7')],agents[_0x5bc3dd['uniqueid']][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);var _0x472e5a=unanswered[_0xd702('0x55')](_0x5bc3dd[_0xd702('0x5')]);if(_0x472e5a>-0x1){unanswered[_0xd702('0x56')](_0x472e5a,0x1);}}if(transfers[_0x5bc3dd[_0xd702('0x5')]]){transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x26')]=utils[_0xd702('0x57')](transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0x31')]);transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x58');transfers[_0x5bc3dd[_0xd702('0x5')]]['lastevent']=_0xd702('0x39');utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd[_0xd702('0x5')],transfers[_0x5bc3dd[_0xd702('0x5')]]['membername'],transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0xa')]));writeDB(transfers[_0x5bc3dd[_0xd702('0x5')]],!![]);}if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();agents[_0x5bc3dd[_0xd702('0x5')]]['talktime']=utils[_0xd702('0x57')](agents[_0x5bc3dd[_0xd702('0x5')]]['agentcompleteAt'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]);agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=agents[_0x5bc3dd[_0xd702('0x5')]]['transfer']?'transfer':_0xd702('0x58');agents[_0x5bc3dd['uniqueid']][_0xd702('0xa')]=_0xd702('0x39');utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd[_0xd702('0x5')]]['membername'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);}}catch(_0x1ea077){utils['error'](util['format'](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x1ea077);}}; \ No newline at end of file +var _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x54827c,_0x1803aa){var _0x2b64ec=function(_0x4e1995){while(--_0x4e1995){_0x54827c['push'](_0x54827c['shift']());}};_0x2b64ec(++_0x1803aa);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index dec7c05..4bb8c5c 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 _0xa969=['toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','hangup','noop','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','info','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','channelstate','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x576df0,_0x3cf751){var _0x2ff311=function(_0x48afa8){while(--_0x48afa8){_0x576df0['push'](_0x576df0['shift']());}};_0x2ff311(++_0x3cf751);}(_0xa969,0x7a));var _0x9a96=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa969[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x9a96('0x0'));var util=require(_0x9a96('0x1'));var utils=require('./utils');var dispositions=[_0x9a96('0x2'),_0x9a96('0x3'),'FAILED',_0x9a96('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x9a96('0x4'),'BUSY','FAILED',_0x9a96('0x3'),_0x9a96('0x3')];var channels={};function writeDB(_0x1d1ceb){utils[_0x9a96('0x5')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1d1ceb[_0x9a96('0x6')],_0x1d1ceb[_0x9a96('0x7')],_0x1d1ceb[_0x9a96('0x8')],_0x1d1ceb[_0x9a96('0x9')],_0x1d1ceb['interface'],_0x1d1ceb[_0x9a96('0xa')],_0x1d1ceb[_0x9a96('0xb')],_0x1d1ceb['lastevent']));if(_0x1d1ceb[_0x9a96('0xc')]){utils[_0x9a96('0xd')](_0x1d1ceb[_0x9a96('0xc')])[_0x9a96('0xe')](function(_0x2e2fda){if(_0x2e2fda){_0x1d1ceb[_0x9a96('0xf')]=_0x2e2fda['id'];}utils[_0x9a96('0x10')](_0x9a96('0x11'),_0x1d1ceb);});}else{utils['request'](_0x9a96('0x11'),_0x1d1ceb);}if(channels[_0x1d1ceb['uniqueid']]){delete channels[_0x1d1ceb[_0x9a96('0x6')]];}}exports[_0x9a96('0x12')]=function(_0x156e42){try{utils[_0x9a96('0x13')](util[_0x9a96('0x14')](_0x9a96('0x15'),_0x156e42[_0x9a96('0x6')]),_0x156e42);if(_0x156e42[_0x9a96('0x6')]==_0x156e42[_0x9a96('0x16')]&&_0x156e42[_0x9a96('0x7')]!=_0x9a96('0x17')){utils['info'](util[_0x9a96('0x14')](_0x9a96('0x18'),_0x156e42[_0x9a96('0x6')],_0x156e42[_0x9a96('0x19')],_0x156e42[_0x9a96('0x1a')]));channels[_0x156e42[_0x9a96('0x6')]]={'uniqueid':_0x156e42['uniqueid'],'accountcode':_0x156e42[_0x9a96('0xc')],'source':_0x156e42[_0x9a96('0xa')],'destination':_0x156e42[_0x9a96('0x1a')],'destinationcontext':_0x156e42[_0x9a96('0x19')],'channel':_0x156e42[_0x9a96('0x7')],'starttime':utils[_0x9a96('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9a96('0x2'),'amaflags':_0x9a96('0x1c')};}}catch(_0x34895a){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')](_0x9a96('0x15'),_0x156e42[_0x9a96('0x6')]),_0x34895a);}};exports[_0x9a96('0x1e')]=function(_0x25fae6){try{utils[_0x9a96('0x13')](util[_0x9a96('0x14')](_0x9a96('0x1f'),_0x25fae6[_0x9a96('0x6')]),_0x25fae6);if(!_['isNil'](channels[_0x25fae6['uniqueid']])&&_0x25fae6['channelstate']==0x6){utils[_0x9a96('0x5')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x25fae6[_0x9a96('0x6')],_0x25fae6['context'],_0x25fae6[_0x9a96('0x7')]));if(_[_0x9a96('0x20')](channels[_0x25fae6[_0x9a96('0x6')]][_0x9a96('0x21')])){channels[_0x25fae6[_0x9a96('0x6')]][_0x9a96('0x21')]=utils[_0x9a96('0x1b')]();}}else if(!_[_0x9a96('0x20')](channels[_0x25fae6['linkedid']])&&_0x25fae6['channelstate']==0x6&&_0x25fae6['context']!='transfer'){utils[_0x9a96('0x5')](util[_0x9a96('0x14')](_0x9a96('0x22'),_0x25fae6[_0x9a96('0x6')],_0x25fae6[_0x9a96('0x16')],_0x25fae6['context'],_0x25fae6[_0x9a96('0x7')]));channels[_0x25fae6[_0x9a96('0x16')]]['accountcode']=_0x25fae6[_0x9a96('0xc')];channels[_0x25fae6[_0x9a96('0x16')]]['destinationchannel']=_0x25fae6[_0x9a96('0x7')];if(_[_0x9a96('0x20')](channels[_0x25fae6[_0x9a96('0x16')]][_0x9a96('0x23')])){channels[_0x25fae6[_0x9a96('0x16')]][_0x9a96('0x23')]=utils['now']();}channels[_0x25fae6['linkedid']][_0x9a96('0x24')]=dispositions[_[_0x9a96('0x25')](_0x25fae6[_0x9a96('0x26')])]||_0x9a96('0x4');}}catch(_0x18d0bc){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')](_0x9a96('0x1f'),_0x25fae6[_0x9a96('0x6')]),_0x18d0bc);}};exports['hangup']=function(_0x2efd40){try{if(!_['isNil'](channels[_0x2efd40['uniqueid']])){utils[_0x9a96('0x13')](util['format']('[%s][calls][hangup]',_0x2efd40['uniqueid']),_0x2efd40);if(_[_0x9a96('0x20')](channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x27')])){channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x27')]=_0x2efd40[_0x9a96('0x28')]+'\x20<'+_0x2efd40[_0x9a96('0xa')]+'>';}utils['info'](util['format'](_0x9a96('0x29'),_0x2efd40[_0x9a96('0x6')],channels[_0x2efd40[_0x9a96('0x6')]]['callerid'],_0x2efd40['cause-txt']));channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2a')]=utils['now']();channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2b')]=utils[_0x9a96('0x2c')](channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2a')],channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2d')]);channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2e')]=channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x23')]?utils[_0x9a96('0x2c')](channels[_0x2efd40[_0x9a96('0x6')]][_0x9a96('0x2a')],channels[_0x2efd40['uniqueid']][_0x9a96('0x23')]):0x0;writeDB(channels[_0x2efd40[_0x9a96('0x6')]]);}}catch(_0x155513){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')](_0x9a96('0x2f'),_0x2efd40[_0x9a96('0x6')]),_0x155513);}};exports[_0x9a96('0x30')]=function(_0x421652){try{if(!_[_0x9a96('0x20')](channels[_0x421652[_0x9a96('0x31')]])){utils[_0x9a96('0x13')](util[_0x9a96('0x14')](_0x9a96('0x32'),_0x421652[_0x9a96('0x33')]),_0x421652);if(channels[_0x421652[_0x9a96('0x31')]][_0x9a96('0x7')]==_0x421652[_0x9a96('0x34')]){utils[_0x9a96('0x5')](util['format'](_0x9a96('0x35'),_0x421652[_0x9a96('0x33')],_0x421652[_0x9a96('0x31')],_0x421652['secondtransfererchannel']));channels[_0x421652['localtwolinkedid']][_0x9a96('0x36')]=_0x421652[_0x9a96('0x37')];channels[_0x421652[_0x9a96('0x31')]][_0x9a96('0x38')]=_0x9a96('0x39');}else if(channels[_0x421652[_0x9a96('0x31')]]['channel']=_0x421652[_0x9a96('0x3a')]){utils[_0x9a96('0x5')](util[_0x9a96('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x421652[_0x9a96('0x33')],_0x421652['localtwolinkedid'],_0x421652[_0x9a96('0x3b')]));channels[_0x421652[_0x9a96('0x31')]][_0x9a96('0x36')]=_0x421652[_0x9a96('0x3b')];channels[_0x421652[_0x9a96('0x31')]][_0x9a96('0x38')]='_attended';}}}catch(_0x4cde63){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')](_0x9a96('0x32'),_0x421652['origtransfereruniqueid']),_0x4cde63);}};exports[_0x9a96('0x3c')]=function(_0x43a3cc){try{if(!_[_0x9a96('0x20')](channels[_0x43a3cc[_0x9a96('0x6')]])){utils[_0x9a96('0x13')](util[_0x9a96('0x14')](_0x9a96('0x3d'),_0x43a3cc[_0x9a96('0x6')]),_0x43a3cc);channels[_0x43a3cc['uniqueid']][_0x9a96('0x3e')]=utils[_0x9a96('0x1b')]();utils['info'](util[_0x9a96('0x14')](_0x9a96('0x3f'),_0x43a3cc[_0x9a96('0x6')],channels[_0x43a3cc[_0x9a96('0x6')]][_0x9a96('0x3e')]));}}catch(_0x20dd7c){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')]('[%s][calls][musiconholdstart]',_0x43a3cc[_0x9a96('0x6')]),_0x20dd7c);}};exports[_0x9a96('0x40')]=function(_0x202477){try{if(!_[_0x9a96('0x20')](channels[_0x202477[_0x9a96('0x6')]])){utils[_0x9a96('0x13')](util['format'](_0x9a96('0x41'),_0x202477[_0x9a96('0x6')]),_0x202477);if(!_['isNil'](channels[_0x202477[_0x9a96('0x6')]]['musiconholdstartAt'])){channels[_0x202477[_0x9a96('0x6')]][_0x9a96('0x42')]+=utils[_0x9a96('0x2c')](utils[_0x9a96('0x1b')](),channels[_0x202477['uniqueid']][_0x9a96('0x3e')]);utils[_0x9a96('0x5')](util['format'](_0x9a96('0x43'),_0x202477[_0x9a96('0x6')],channels[_0x202477[_0x9a96('0x6')]][_0x9a96('0x42')]));delete channels[_0x202477[_0x9a96('0x6')]]['musiconholdstartAt'];}}}catch(_0x7169e){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')]('[%s][calls][musiconholdstop]',_0x202477[_0x9a96('0x6')]),_0x7169e);}};exports[_0x9a96('0x44')]=function(_0x1a1368){try{if(!_[_0x9a96('0x20')](channels[_0x1a1368[_0x9a96('0x6')]])){utils[_0x9a96('0x13')](util['format'](_0x9a96('0x45'),_0x1a1368[_0x9a96('0x6')]),_0x1a1368);if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')]['xmd-originatecalleridnum'])){utils[_0x9a96('0x5')](util[_0x9a96('0x14')](_0x9a96('0x47'),_0x1a1368['uniqueid'],_0x1a1368[_0x9a96('0x48')]));channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x49')]=_0x1a1368[_0x9a96('0x48')];}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')]['xmd-phone'])){utils[_0x9a96('0x5')](util[_0x9a96('0x14')](_0x9a96('0x4a'),_0x1a1368['uniqueid'],_0x1a1368['value']));channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x4b')]=_0x1a1368['value'];channels[_0x1a1368['uniqueid']][_0x9a96('0x27')]='\x22'+_0x1a1368[_0x9a96('0x48')]+_0x9a96('0x4c')+_0x1a1368[_0x9a96('0x48')]+'>';}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')]['xmd-callerid-preview'])||!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x4d')])){utils[_0x9a96('0x5')](util['format'](_0x9a96('0x4e'),_0x1a1368['uniqueid'],!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')]['xmd-callerid-preview'])?_0x9a96('0x4f'):_0x9a96('0x4d'),_0x1a1368['value']));channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x27')]=_0x1a1368[_0x9a96('0x48')];}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x50')])||!_['isNil'](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x51')])){utils[_0x9a96('0x5')](util[_0x9a96('0x14')](_0x9a96('0x4e'),_0x1a1368[_0x9a96('0x6')],!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x50')])?_0x9a96('0x50'):_0x9a96('0x51'),_0x1a1368[_0x9a96('0x48')]));channels[_0x1a1368['uniqueid']][_0x9a96('0x52')]=_0x9a96('0x53');channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x54')]=_0x1a1368[_0x9a96('0x48')];channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x8')]=!![];}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x55')])){utils[_0x9a96('0x5')](util['format'](_0x9a96('0x56'),_0x1a1368[_0x9a96('0x6')],_0x1a1368['value']));channels[_0x1a1368[_0x9a96('0x6')]]['ContactId']=_0x1a1368[_0x9a96('0x48')];}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')][_0x9a96('0x57')])){utils[_0x9a96('0x5')](util[_0x9a96('0x14')](_0x9a96('0x58'),_0x1a1368[_0x9a96('0x6')],_0x1a1368['value']));channels[_0x1a1368['uniqueid']][_0x9a96('0x59')]=_0x1a1368[_0x9a96('0x48')];}if(!_[_0x9a96('0x20')](_0x1a1368[_0x9a96('0x46')]['outboundrouteid'])){utils[_0x9a96('0x5')](util['format'](_0x9a96('0x5a'),_0x1a1368['uniqueid'],_0x1a1368['value']));channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x5b')]=_0x1a1368[_0x9a96('0x48')];}if(!_['isNil'](_0x1a1368['variable']['sipcallid'])){utils[_0x9a96('0x5')](util[_0x9a96('0x14')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1a1368[_0x9a96('0x6')],_0x1a1368[_0x9a96('0x48')]));channels[_0x1a1368[_0x9a96('0x6')]][_0x9a96('0x5c')]=_0x1a1368[_0x9a96('0x48')];}}}catch(_0x38d3f9){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')]('[%s][calls][varset]',_0x1a1368['uniqueid']),_0x38d3f9);}};exports[_0x9a96('0x5d')]=function(_0x18fcc8){try{if(!_[_0x9a96('0x20')](channels[_0x18fcc8[_0x9a96('0x6')]])){utils[_0x9a96('0x13')](util[_0x9a96('0x14')]('[%s][calls][newexten]',_0x18fcc8[_0x9a96('0x6')]),_0x18fcc8);utils['info'](util[_0x9a96('0x14')](_0x9a96('0x5e'),_0x18fcc8[_0x9a96('0x6')],_0x18fcc8[_0x9a96('0x5f')],_0x18fcc8['appdata']));if(_0x18fcc8[_0x9a96('0x5f')][_0x9a96('0x60')]()==_0x9a96('0x61')&&_[_0x9a96('0x62')](_0x18fcc8['appdata'][_0x9a96('0x60')](),_0x9a96('0x63'))){var _0x49d682=_0x18fcc8[_0x9a96('0x64')][_0x9a96('0x65')]('=');var _0x2bd7fb=_0x49d682[0x0][_0x9a96('0x66')](_0x49d682[0x0][_0x9a96('0x67')]('(')+0x1,_0x49d682[0x0][_0x9a96('0x67')](')'));var _0x11ff35=_0x49d682[0x1];channels[_0x18fcc8[_0x9a96('0x6')]][_0x2bd7fb]=_0x11ff35;}if(!_[_0x9a96('0x68')]([_0x9a96('0x69'),_0x9a96('0x6a'),'execif',_0x9a96('0x61'),_0x9a96('0x6b')],_0x18fcc8[_0x9a96('0x5f')][_0x9a96('0x60')]())){channels[_0x18fcc8[_0x9a96('0x6')]][_0x9a96('0x52')]=_0x18fcc8[_0x9a96('0x5f')];channels[_0x18fcc8[_0x9a96('0x6')]]['lastdata']=_0x18fcc8[_0x9a96('0x64')];}}}catch(_0x26a2cb){utils[_0x9a96('0x1d')](util[_0x9a96('0x14')](_0x9a96('0x6c'),_0x18fcc8[_0x9a96('0x6')]),_0x26a2cb);}}; \ No newline at end of file +var _0x482f=['[%s][calls][attendedtransfer]','origtransfereruniqueid','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','newchannel','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x482f,0x17a));var _0xf482=function(_0x424dbf,_0x3ec33d){_0x424dbf=_0x424dbf-0x0;var _0x1b0112=_0x482f[_0x424dbf];return _0x1b0112;};'use strict';var _=require(_0xf482('0x0'));var util=require(_0xf482('0x1'));var utils=require('./utils');var dispositions=[_0xf482('0x2'),_0xf482('0x3'),'FAILED',_0xf482('0x2'),'NO\x20ANSWER',_0xf482('0x2'),_0xf482('0x4'),_0xf482('0x5'),_0xf482('0x3'),_0xf482('0x3'),'FAILED'];var channels={};function writeDB(_0x4afcaf){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x8'),_0x4afcaf[_0xf482('0x9')],_0x4afcaf[_0xf482('0xa')],_0x4afcaf[_0xf482('0xb')],_0x4afcaf[_0xf482('0xc')],_0x4afcaf[_0xf482('0xd')],_0x4afcaf[_0xf482('0xe')],_0x4afcaf[_0xf482('0xf')],_0x4afcaf[_0xf482('0x10')]));if(_0x4afcaf['accountcode']){utils[_0xf482('0x11')](_0x4afcaf[_0xf482('0x12')])[_0xf482('0x13')](function(_0x318098){if(_0x318098){_0x4afcaf[_0xf482('0x14')]=_0x318098['id'];}utils['request'](_0xf482('0x15'),_0x4afcaf);});}else{utils['request']('CreateVoiceCallReport',_0x4afcaf);}if(channels[_0x4afcaf[_0xf482('0x9')]]){delete channels[_0x4afcaf[_0xf482('0x9')]];}}exports[_0xf482('0x16')]=function(_0x4fe390){try{utils[_0xf482('0x17')](util[_0xf482('0x7')]('[%s][calls][newchannel]',_0x4fe390['uniqueid']),_0x4fe390);if(_0x4fe390[_0xf482('0x9')]==_0x4fe390['linkedid']&&_0x4fe390[_0xf482('0xa')]!=_0xf482('0x18')){utils['info'](util[_0xf482('0x7')](_0xf482('0x19'),_0x4fe390[_0xf482('0x9')],_0x4fe390[_0xf482('0x1a')],_0x4fe390[_0xf482('0x1b')]));channels[_0x4fe390['uniqueid']]={'uniqueid':_0x4fe390[_0xf482('0x9')],'accountcode':_0x4fe390['accountcode'],'source':_0x4fe390['calleridnum'],'destination':_0x4fe390[_0xf482('0x1b')],'destinationcontext':_0x4fe390[_0xf482('0x1a')],'channel':_0x4fe390['channel'],'starttime':utils[_0xf482('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf482('0x2'),'amaflags':_0xf482('0x1d')};}}catch(_0x2ecac2){utils[_0xf482('0x1e')](util['format']('[%s][calls][newchannel]',_0x4fe390[_0xf482('0x9')]),_0x2ecac2);}};exports[_0xf482('0x1f')]=function(_0x3dde66){try{utils[_0xf482('0x17')](util[_0xf482('0x7')](_0xf482('0x20'),_0x3dde66[_0xf482('0x9')]),_0x3dde66);if(!_[_0xf482('0x21')](channels[_0x3dde66[_0xf482('0x9')]])&&_0x3dde66[_0xf482('0x22')]==0x6){utils[_0xf482('0x6')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3dde66[_0xf482('0x9')],_0x3dde66[_0xf482('0x1a')],_0x3dde66[_0xf482('0xa')]));if(_[_0xf482('0x21')](channels[_0x3dde66['uniqueid']][_0xf482('0x23')])){channels[_0x3dde66[_0xf482('0x9')]][_0xf482('0x23')]=utils[_0xf482('0x1c')]();}}else if(!_[_0xf482('0x21')](channels[_0x3dde66[_0xf482('0x24')]])&&_0x3dde66[_0xf482('0x22')]==0x6&&_0x3dde66['context']!=_0xf482('0x25')){utils[_0xf482('0x6')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3dde66[_0xf482('0x9')],_0x3dde66[_0xf482('0x24')],_0x3dde66[_0xf482('0x1a')],_0x3dde66[_0xf482('0xa')]));channels[_0x3dde66[_0xf482('0x24')]][_0xf482('0x12')]=_0x3dde66[_0xf482('0x12')];channels[_0x3dde66[_0xf482('0x24')]][_0xf482('0x26')]=_0x3dde66[_0xf482('0xa')];if(_[_0xf482('0x21')](channels[_0x3dde66[_0xf482('0x24')]]['answertime'])){channels[_0x3dde66[_0xf482('0x24')]][_0xf482('0x27')]=utils[_0xf482('0x1c')]();}channels[_0x3dde66[_0xf482('0x24')]][_0xf482('0x28')]=dispositions[_['toNumber'](_0x3dde66['channelstate'])]||_0xf482('0x4');}}catch(_0x51b00d){utils['error'](util['format'](_0xf482('0x20'),_0x3dde66[_0xf482('0x9')]),_0x51b00d);}};exports[_0xf482('0x29')]=function(_0x2fd385){try{if(!_[_0xf482('0x21')](channels[_0x2fd385[_0xf482('0x9')]])){utils[_0xf482('0x17')](util[_0xf482('0x7')](_0xf482('0x2a'),_0x2fd385[_0xf482('0x9')]),_0x2fd385);if(_[_0xf482('0x21')](channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x2b')])){channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x2b')]=_0x2fd385[_0xf482('0x2c')]+'\x20<'+_0x2fd385[_0xf482('0xe')]+'>';}utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x2d'),_0x2fd385[_0xf482('0x9')],channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x2b')],_0x2fd385['cause-txt']));channels[_0x2fd385['uniqueid']][_0xf482('0x2e')]=utils[_0xf482('0x1c')]();channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x2f')]=utils[_0xf482('0x30')](channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x2e')],channels[_0x2fd385[_0xf482('0x9')]]['starttime']);channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x31')]=channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x27')]?utils[_0xf482('0x30')](channels[_0x2fd385[_0xf482('0x9')]]['endtime'],channels[_0x2fd385[_0xf482('0x9')]][_0xf482('0x27')]):0x0;writeDB(channels[_0x2fd385['uniqueid']]);}}catch(_0xd07f66){utils['error'](util[_0xf482('0x7')]('[%s][calls][hangup]',_0x2fd385[_0xf482('0x9')]),_0xd07f66);}};exports[_0xf482('0x32')]=function(_0x1139f7){try{if(!_[_0xf482('0x21')](channels[_0x1139f7[_0xf482('0x33')]])){utils[_0xf482('0x17')](util[_0xf482('0x7')]('[%s][calls][attendedtransfer]',_0x1139f7['origtransfereruniqueid']),_0x1139f7);if(channels[_0x1139f7[_0xf482('0x33')]][_0xf482('0xa')]==_0x1139f7[_0xf482('0x34')]){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x35'),_0x1139f7['origtransfereruniqueid'],_0x1139f7[_0xf482('0x33')],_0x1139f7[_0xf482('0x36')]));channels[_0x1139f7[_0xf482('0x33')]][_0xf482('0x26')]=_0x1139f7[_0xf482('0x36')];channels[_0x1139f7[_0xf482('0x33')]][_0xf482('0x37')]='_attended';}else if(channels[_0x1139f7[_0xf482('0x33')]][_0xf482('0xa')]=_0x1139f7[_0xf482('0x38')]){utils[_0xf482('0x6')](util['format'](_0xf482('0x35'),_0x1139f7['origtransfereruniqueid'],_0x1139f7[_0xf482('0x33')],_0x1139f7['origtransfererchannel']));channels[_0x1139f7['localtwolinkedid']][_0xf482('0x26')]=_0x1139f7[_0xf482('0x39')];channels[_0x1139f7['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x43c304){utils['error'](util[_0xf482('0x7')](_0xf482('0x3a'),_0x1139f7[_0xf482('0x3b')]),_0x43c304);}};exports[_0xf482('0x3c')]=function(_0x86db74){try{if(!_[_0xf482('0x21')](channels[_0x86db74[_0xf482('0x9')]])){utils[_0xf482('0x17')](util[_0xf482('0x7')](_0xf482('0x3d'),_0x86db74['uniqueid']),_0x86db74);channels[_0x86db74['uniqueid']][_0xf482('0x3e')]=utils[_0xf482('0x1c')]();utils['info'](util['format'](_0xf482('0x3f'),_0x86db74['uniqueid'],channels[_0x86db74[_0xf482('0x9')]]['musiconholdstartAt']));}}catch(_0x144e8a){utils[_0xf482('0x1e')](util['format'](_0xf482('0x3d'),_0x86db74[_0xf482('0x9')]),_0x144e8a);}};exports[_0xf482('0x40')]=function(_0x242c84){try{if(!_[_0xf482('0x21')](channels[_0x242c84['uniqueid']])){utils[_0xf482('0x17')](util['format'](_0xf482('0x41'),_0x242c84['uniqueid']),_0x242c84);if(!_[_0xf482('0x21')](channels[_0x242c84[_0xf482('0x9')]][_0xf482('0x3e')])){channels[_0x242c84['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x242c84[_0xf482('0x9')]][_0xf482('0x3e')]);utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x42'),_0x242c84['uniqueid'],channels[_0x242c84[_0xf482('0x9')]][_0xf482('0x43')]));delete channels[_0x242c84[_0xf482('0x9')]]['musiconholdstartAt'];}}}catch(_0x2183ca){utils[_0xf482('0x1e')](util[_0xf482('0x7')]('[%s][calls][musiconholdstop]',_0x242c84[_0xf482('0x9')]),_0x2183ca);}};exports['varset']=function(_0x2c5bea){try{if(!_[_0xf482('0x21')](channels[_0x2c5bea[_0xf482('0x9')]])){utils[_0xf482('0x17')](util[_0xf482('0x7')](_0xf482('0x44'),_0x2c5bea[_0xf482('0x9')]),_0x2c5bea);if(!_['isNil'](_0x2c5bea[_0xf482('0x45')]['xmd-originatecalleridnum'])){utils['info'](util[_0xf482('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2c5bea[_0xf482('0x9')],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea['uniqueid']][_0xf482('0x47')]=_0x2c5bea[_0xf482('0x46')];}if(!_[_0xf482('0x21')](_0x2c5bea[_0xf482('0x45')][_0xf482('0x48')])){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x49'),_0x2c5bea[_0xf482('0x9')],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea[_0xf482('0x9')]][_0xf482('0x4a')]=_0x2c5bea[_0xf482('0x46')];channels[_0x2c5bea[_0xf482('0x9')]]['callerid']='\x22'+_0x2c5bea[_0xf482('0x46')]+_0xf482('0x4b')+_0x2c5bea[_0xf482('0x46')]+'>';}if(!_[_0xf482('0x21')](_0x2c5bea[_0xf482('0x45')][_0xf482('0x4c')])||!_[_0xf482('0x21')](_0x2c5bea['variable'][_0xf482('0x4d')])){utils[_0xf482('0x6')](util[_0xf482('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2c5bea[_0xf482('0x9')],!_[_0xf482('0x21')](_0x2c5bea['variable'][_0xf482('0x4c')])?'xmd-callerid-preview':_0xf482('0x4d'),_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea['uniqueid']][_0xf482('0x2b')]=_0x2c5bea[_0xf482('0x46')];}if(!_['isNil'](_0x2c5bea[_0xf482('0x45')][_0xf482('0x4e')])||!_[_0xf482('0x21')](_0x2c5bea[_0xf482('0x45')][_0xf482('0x4f')])){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x50'),_0x2c5bea[_0xf482('0x9')],!_[_0xf482('0x21')](_0x2c5bea[_0xf482('0x45')][_0xf482('0x4e')])?'xmd-queue':_0xf482('0x4f'),_0x2c5bea['value']));channels[_0x2c5bea['uniqueid']][_0xf482('0x51')]=_0xf482('0x52');channels[_0x2c5bea[_0xf482('0x9')]][_0xf482('0x53')]=_0x2c5bea[_0xf482('0x46')];channels[_0x2c5bea[_0xf482('0x9')]][_0xf482('0xb')]=!![];}if(!_[_0xf482('0x21')](_0x2c5bea[_0xf482('0x45')][_0xf482('0x54')])){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x55'),_0x2c5bea[_0xf482('0x9')],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea['uniqueid']][_0xf482('0x56')]=_0x2c5bea[_0xf482('0x46')];}if(!_[_0xf482('0x21')](_0x2c5bea['variable'][_0xf482('0x57')])){utils['info'](util[_0xf482('0x7')](_0xf482('0x58'),_0x2c5bea[_0xf482('0x9')],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea[_0xf482('0x9')]][_0xf482('0x59')]=_0x2c5bea[_0xf482('0x46')];}if(!_['isNil'](_0x2c5bea[_0xf482('0x45')][_0xf482('0x5a')])){utils['info'](util['format'](_0xf482('0x5b'),_0x2c5bea['uniqueid'],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea['uniqueid']][_0xf482('0x5c')]=_0x2c5bea[_0xf482('0x46')];}if(!_['isNil'](_0x2c5bea[_0xf482('0x45')][_0xf482('0x5d')])){utils[_0xf482('0x6')](util[_0xf482('0x7')](_0xf482('0x5e'),_0x2c5bea[_0xf482('0x9')],_0x2c5bea[_0xf482('0x46')]));channels[_0x2c5bea[_0xf482('0x9')]]['sipcallid']=_0x2c5bea[_0xf482('0x46')];}}}catch(_0xd476fa){utils[_0xf482('0x1e')](util[_0xf482('0x7')](_0xf482('0x44'),_0x2c5bea['uniqueid']),_0xd476fa);}};exports['newexten']=function(_0x523835){try{if(!_[_0xf482('0x21')](channels[_0x523835[_0xf482('0x9')]])){utils[_0xf482('0x17')](util[_0xf482('0x7')](_0xf482('0x5f'),_0x523835['uniqueid']),_0x523835);utils[_0xf482('0x6')](util[_0xf482('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x523835['uniqueid'],_0x523835[_0xf482('0x60')],_0x523835[_0xf482('0x61')]));if(_0x523835[_0xf482('0x60')][_0xf482('0x62')]()==_0xf482('0x63')&&_[_0xf482('0x64')](_0x523835[_0xf482('0x61')][_0xf482('0x62')](),_0xf482('0x65'))){var _0x1716c0=_0x523835['appdata'][_0xf482('0x66')]('=');var _0x3fb903=_0x1716c0[0x0][_0xf482('0x67')](_0x1716c0[0x0][_0xf482('0x68')]('(')+0x1,_0x1716c0[0x0]['lastIndexOf'](')'));var _0x3044a2=_0x1716c0[0x1];channels[_0x523835[_0xf482('0x9')]][_0x3fb903]=_0x3044a2;}if(!_[_0xf482('0x69')]([_0xf482('0x29'),_0xf482('0x6a'),_0xf482('0x6b'),_0xf482('0x63'),_0xf482('0x6c')],_0x523835[_0xf482('0x60')][_0xf482('0x62')]())){channels[_0x523835[_0xf482('0x9')]]['lastapplication']=_0x523835['application'];channels[_0x523835[_0xf482('0x9')]][_0xf482('0x53')]=_0x523835[_0xf482('0x61')];}}}catch(_0x127f81){utils[_0xf482('0x1e')](util[_0xf482('0x7')](_0xf482('0x5f'),_0x523835['uniqueid']),_0x127f81);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 87e46ce..d9eee07 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 _0xb5fc=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xb5fc,0x165));var _0xcb5f=function(_0x5a5476,_0xeaf81f){_0x5a5476=_0x5a5476-0x0;var _0x3e0eeb=_0xb5fc[_0x5a5476];return _0x3e0eeb;};'use strict';var utils=require(_0xcb5f('0x0'));exports[_0xcb5f('0x1')]=function(){utils['info'](_0xcb5f('0x2'));};exports[_0xcb5f('0x3')]=function(){utils['info'](_0xcb5f('0x4'));};exports[_0xcb5f('0x5')]=function(){utils['info'](_0xcb5f('0x6'));};exports[_0xcb5f('0x7')]=function(_0x694355){utils[_0xcb5f('0x7')](_0xcb5f('0x8'),_0x694355);};exports[_0xcb5f('0x9')]=function(){utils['info'](_0xcb5f('0xa'));};exports[_0xcb5f('0xb')]=function(_0x2cf1de){}; \ No newline at end of file +var _0x617f=['[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x271ccf,_0x56886c){var _0x396a32=function(_0x13dc25){while(--_0x13dc25){_0x271ccf['push'](_0x271ccf['shift']());}};_0x396a32(++_0x56886c);}(_0x617f,0xce));var _0xf617=function(_0x10f5f3,_0x47dead){_0x10f5f3=_0x10f5f3-0x0;var _0x3874e5=_0x617f[_0x10f5f3];return _0x3874e5;};'use strict';var utils=require(_0xf617('0x0'));exports[_0xf617('0x1')]=function(){utils[_0xf617('0x2')](_0xf617('0x3'));};exports['shutdown']=function(){utils[_0xf617('0x2')](_0xf617('0x4'));};exports[_0xf617('0x5')]=function(){utils[_0xf617('0x2')](_0xf617('0x6'));};exports[_0xf617('0x7')]=function(_0x27494a){utils[_0xf617('0x7')]('[core]\x20error',_0x27494a);};exports[_0xf617('0x8')]=function(){utils[_0xf617('0x2')](_0xf617('0x9'));};exports[_0xf617('0xa')]=function(_0x46015){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0e3181e..5d6986d 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 _0x7c5d=['dialstatus','request','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','ANSWER','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum'];(function(_0x3ebb17,_0x121235){var _0xb0ce71=function(_0xa0d643){while(--_0xa0d643){_0x3ebb17['push'](_0x3ebb17['shift']());}};_0xb0ce71(++_0x121235);}(_0x7c5d,0x1af));var _0xd7c5=function(_0xb67d37,_0x4f00a5){_0xb67d37=_0xb67d37-0x0;var _0x1d0fc4=_0x7c5d[_0xb67d37];return _0x1d0fc4;};'use strict';var _=require(_0xd7c5('0x0'));var util=require(_0xd7c5('0x1'));var utils=require(_0xd7c5('0x2'));var dials={};function writeDB(_0x51f303){utils['info'](util[_0xd7c5('0x3')](_0xd7c5('0x4'),_0x51f303[_0xd7c5('0x5')],_0x51f303[_0xd7c5('0x6')],_0x51f303[_0xd7c5('0x7')],_0x51f303[_0xd7c5('0x8')],_0x51f303['connectedlinenum'],_0x51f303[_0xd7c5('0x9')]));utils[_0xd7c5('0xa')](_0xd7c5('0xb'),_0x51f303);delete dials[_0x51f303[_0xd7c5('0x5')]];}exports[_0xd7c5('0xc')]=function(_0x402ab4){try{utils[_0xd7c5('0xd')](util['format']('[%s][dials][newexten]',_0x402ab4[_0xd7c5('0x5')]),_0x402ab4);utils[_0xd7c5('0xe')](util[_0xd7c5('0x3')](_0xd7c5('0xf'),_0x402ab4[_0xd7c5('0x5')],_0x402ab4['application'],_0x402ab4['appdata']));if(_0x402ab4[_0xd7c5('0x10')]['toLowerCase']()==_0xd7c5('0x11')&&_[_0xd7c5('0x12')](_0x402ab4[_0xd7c5('0x13')][_0xd7c5('0x14')](),_0xd7c5('0x15'))){var _0x22ca0d=_0x402ab4[_0xd7c5('0x13')][_0xd7c5('0x16')]('=');dials[_0x402ab4[_0xd7c5('0x5')]]={'routeId':_0x22ca0d[0x1]};}}catch(_0x13fde6){utils[_0xd7c5('0x17')](util[_0xd7c5('0x3')](_0xd7c5('0x18'),_0x402ab4[_0xd7c5('0x5')]),_0x13fde6);}};exports[_0xd7c5('0x19')]=function(_0x5d75b4){try{utils[_0xd7c5('0xd')](util['format']('[%s][dials][varset]',_0x5d75b4[_0xd7c5('0x5')]),_0x5d75b4);if(!_[_0xd7c5('0x1a')](_0x5d75b4['variable'][_0xd7c5('0x1b')])){utils[_0xd7c5('0xe')](util[_0xd7c5('0x3')](_0xd7c5('0x1c'),_0x5d75b4[_0xd7c5('0x5')],_0x5d75b4[_0xd7c5('0x1d')]));dials[_0x5d75b4[_0xd7c5('0x5')]]={'routeId':_0x5d75b4[_0xd7c5('0x1d')]};}}catch(_0x21386f){utils[_0xd7c5('0x17')](util[_0xd7c5('0x3')](_0xd7c5('0x1e'),_0x5d75b4[_0xd7c5('0x5')]),_0x21386f);}};exports['dialbegin']=function(_0x4b7f18){try{if(!_['isNil'](dials[_0x4b7f18[_0xd7c5('0x5')]])){utils[_0xd7c5('0xd')](util['format'](_0xd7c5('0x1f'),_0x4b7f18[_0xd7c5('0x5')]),_0x4b7f18);dials[_0x4b7f18[_0xd7c5('0x5')]]=_[_0xd7c5('0x20')](dials[_0x4b7f18[_0xd7c5('0x5')]],_0x4b7f18);dials[_0x4b7f18[_0xd7c5('0x5')]]['starttime']=utils['now']();dials[_0x4b7f18[_0xd7c5('0x5')]][_0xd7c5('0x21')]=_0xd7c5('0x22');utils[_0xd7c5('0xe')](util['format'](_0xd7c5('0x23'),_0x4b7f18['uniqueid'],dials[_0x4b7f18[_0xd7c5('0x5')]][_0xd7c5('0x24')]));}}catch(_0x1d9035){utils[_0xd7c5('0x17')](util[_0xd7c5('0x3')](_0xd7c5('0x1f'),_0x4b7f18[_0xd7c5('0x5')]),_0x1d9035);}};exports['dialend']=function(_0x398d58){try{if(!_[_0xd7c5('0x1a')](dials[_0x398d58[_0xd7c5('0x5')]])){utils[_0xd7c5('0xd')](util[_0xd7c5('0x3')]('[%s][dials][dialend]',_0x398d58[_0xd7c5('0x5')]),_0x398d58);dials[_0x398d58[_0xd7c5('0x5')]][_0xd7c5('0x9')]=_0x398d58[_0xd7c5('0x9')];if(_0x398d58[_0xd7c5('0x9')]==_0xd7c5('0x25')){dials[_0x398d58[_0xd7c5('0x5')]]=_['assign'](dials[_0x398d58[_0xd7c5('0x5')]],_0x398d58);dials[_0x398d58['uniqueid']]['answertime']=utils[_0xd7c5('0x26')]();dials[_0x398d58['uniqueid']][_0xd7c5('0x21')]=_0xd7c5('0x27');utils[_0xd7c5('0xe')](util['format'](_0xd7c5('0x28'),_0x398d58[_0xd7c5('0x5')],_0x398d58['dialstatus'],dials[_0x398d58[_0xd7c5('0x5')]][_0xd7c5('0x29')]));}else{utils[_0xd7c5('0xe')](util[_0xd7c5('0x3')](_0xd7c5('0x2a'),_0x398d58['uniqueid'],_0x398d58['dialstatus']));}}}catch(_0x546512){utils[_0xd7c5('0x17')](util[_0xd7c5('0x3')](_0xd7c5('0x2b'),_0x398d58[_0xd7c5('0x5')]),_0x546512);}};exports[_0xd7c5('0x2c')]=function(_0x17ce85){try{if(!_['isNil'](dials[_0x17ce85[_0xd7c5('0x5')]])){utils[_0xd7c5('0xd')](util[_0xd7c5('0x3')]('[%s][dials][hangup]',_0x17ce85[_0xd7c5('0x5')]),_0x17ce85);utils[_0xd7c5('0xe')](util['format'](_0xd7c5('0x2d'),_0x17ce85[_0xd7c5('0x5')],_0x17ce85['calleridnum'],_0x17ce85[_0xd7c5('0x2e')],_0x17ce85[_0xd7c5('0x2f')]));dials[_0x17ce85[_0xd7c5('0x5')]]=_[_0xd7c5('0x20')](dials[_0x17ce85[_0xd7c5('0x5')]],{'endtime':utils['now'](),'lastevent':_0xd7c5('0x30')});dials[_0x17ce85['uniqueid']][_0xd7c5('0x31')]=utils[_0xd7c5('0x32')](dials[_0x17ce85['uniqueid']][_0xd7c5('0x33')],dials[_0x17ce85['uniqueid']]['starttime']);dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x34')]=utils[_0xd7c5('0x32')](dials[_0x17ce85['uniqueid']]['answertime']||dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x33')],dials[_0x17ce85['uniqueid']]['starttime']);dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x35')]=dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x29')]?utils[_0xd7c5('0x32')](dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x33')],dials[_0x17ce85[_0xd7c5('0x5')]][_0xd7c5('0x29')]):0x0;writeDB(dials[_0x17ce85[_0xd7c5('0x5')]]);}}catch(_0x201a56){utils[_0xd7c5('0x17')](util[_0xd7c5('0x3')](_0xd7c5('0x36'),_0x17ce85[_0xd7c5('0x5')]),_0x201a56);}}; \ No newline at end of file +var _0x5e4a=['[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','isNil','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','billableseconds','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset'];(function(_0x4bee59,_0x48f132){var _0x3ed6bb=function(_0x2b6c48){while(--_0x2b6c48){_0x4bee59['push'](_0x4bee59['shift']());}};_0x3ed6bb(++_0x48f132);}(_0x5e4a,0xac));var _0xa5e4=function(_0x520971,_0x509a17){_0x520971=_0x520971-0x0;var _0x234ac1=_0x5e4a[_0x520971];return _0x234ac1;};'use strict';var _=require(_0xa5e4('0x0'));var util=require(_0xa5e4('0x1'));var utils=require(_0xa5e4('0x2'));var dials={};function writeDB(_0x261ec9){utils[_0xa5e4('0x3')](util[_0xa5e4('0x4')](_0xa5e4('0x5'),_0x261ec9[_0xa5e4('0x6')],_0x261ec9[_0xa5e4('0x7')],_0x261ec9[_0xa5e4('0x8')],_0x261ec9[_0xa5e4('0x9')],_0x261ec9[_0xa5e4('0xa')],_0x261ec9[_0xa5e4('0xb')]));utils[_0xa5e4('0xc')](_0xa5e4('0xd'),_0x261ec9);delete dials[_0x261ec9['uniqueid']];}exports['newexten']=function(_0x592948){try{utils[_0xa5e4('0xe')](util[_0xa5e4('0x4')](_0xa5e4('0xf'),_0x592948['uniqueid']),_0x592948);utils['info'](util[_0xa5e4('0x4')](_0xa5e4('0x10'),_0x592948['uniqueid'],_0x592948['application'],_0x592948[_0xa5e4('0x11')]));if(_0x592948['application'][_0xa5e4('0x12')]()==_0xa5e4('0x13')&&_[_0xa5e4('0x14')](_0x592948[_0xa5e4('0x11')]['toLowerCase'](),_0xa5e4('0x15'))){var _0x4e68b1=_0x592948[_0xa5e4('0x11')]['split']('=');dials[_0x592948[_0xa5e4('0x6')]]={'routeId':_0x4e68b1[0x1]};}}catch(_0x5bb0c4){utils[_0xa5e4('0x16')](util[_0xa5e4('0x4')](_0xa5e4('0xf'),_0x592948[_0xa5e4('0x6')]),_0x5bb0c4);}};exports[_0xa5e4('0x17')]=function(_0x4cc9a7){try{utils[_0xa5e4('0xe')](util[_0xa5e4('0x4')](_0xa5e4('0x18'),_0x4cc9a7['uniqueid']),_0x4cc9a7);if(!_['isNil'](_0x4cc9a7['variable'][_0xa5e4('0x19')])){utils[_0xa5e4('0x3')](util[_0xa5e4('0x4')](_0xa5e4('0x1a'),_0x4cc9a7[_0xa5e4('0x6')],_0x4cc9a7['value']));dials[_0x4cc9a7[_0xa5e4('0x6')]]={'routeId':_0x4cc9a7['value']};}}catch(_0x53e1b0){utils[_0xa5e4('0x16')](util[_0xa5e4('0x4')](_0xa5e4('0x18'),_0x4cc9a7[_0xa5e4('0x6')]),_0x53e1b0);}};exports[_0xa5e4('0x1b')]=function(_0x85f040){try{if(!_[_0xa5e4('0x1c')](dials[_0x85f040[_0xa5e4('0x6')]])){utils['debug'](util[_0xa5e4('0x4')]('[%s][dials][dialbegin]',_0x85f040[_0xa5e4('0x6')]),_0x85f040);dials[_0x85f040[_0xa5e4('0x6')]]=_[_0xa5e4('0x1d')](dials[_0x85f040['uniqueid']],_0x85f040);dials[_0x85f040[_0xa5e4('0x6')]]['starttime']=utils[_0xa5e4('0x1e')]();dials[_0x85f040[_0xa5e4('0x6')]][_0xa5e4('0x1f')]=_0xa5e4('0x20');utils['info'](util[_0xa5e4('0x4')](_0xa5e4('0x21'),_0x85f040[_0xa5e4('0x6')],dials[_0x85f040[_0xa5e4('0x6')]][_0xa5e4('0x22')]));}}catch(_0x186fa2){utils[_0xa5e4('0x16')](util[_0xa5e4('0x4')]('[%s][dials][dialbegin]',_0x85f040[_0xa5e4('0x6')]),_0x186fa2);}};exports[_0xa5e4('0x23')]=function(_0x1bcae9){try{if(!_['isNil'](dials[_0x1bcae9['uniqueid']])){utils['debug'](util['format'](_0xa5e4('0x24'),_0x1bcae9['uniqueid']),_0x1bcae9);dials[_0x1bcae9['uniqueid']][_0xa5e4('0xb')]=_0x1bcae9['dialstatus'];if(_0x1bcae9['dialstatus']==_0xa5e4('0x25')){dials[_0x1bcae9[_0xa5e4('0x6')]]=_[_0xa5e4('0x1d')](dials[_0x1bcae9[_0xa5e4('0x6')]],_0x1bcae9);dials[_0x1bcae9[_0xa5e4('0x6')]]['answertime']=utils[_0xa5e4('0x1e')]();dials[_0x1bcae9[_0xa5e4('0x6')]][_0xa5e4('0x1f')]=_0xa5e4('0x26');utils[_0xa5e4('0x3')](util[_0xa5e4('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1bcae9['uniqueid'],_0x1bcae9['dialstatus'],dials[_0x1bcae9['uniqueid']][_0xa5e4('0x27')]));}else{utils['info'](util[_0xa5e4('0x4')](_0xa5e4('0x28'),_0x1bcae9['uniqueid'],_0x1bcae9[_0xa5e4('0xb')]));}}}catch(_0xfaa748){utils['error'](util['format']('[%s][dials][dialend]',_0x1bcae9['uniqueid']),_0xfaa748);}};exports[_0xa5e4('0x29')]=function(_0x885f16){try{if(!_[_0xa5e4('0x1c')](dials[_0x885f16['uniqueid']])){utils[_0xa5e4('0xe')](util[_0xa5e4('0x4')](_0xa5e4('0x2a'),_0x885f16[_0xa5e4('0x6')]),_0x885f16);utils[_0xa5e4('0x3')](util[_0xa5e4('0x4')](_0xa5e4('0x2b'),_0x885f16['uniqueid'],_0x885f16[_0xa5e4('0x9')],_0x885f16['calleridname'],_0x885f16['cause-txt']));dials[_0x885f16[_0xa5e4('0x6')]]=_[_0xa5e4('0x1d')](dials[_0x885f16[_0xa5e4('0x6')]],{'endtime':utils[_0xa5e4('0x1e')](),'lastevent':_0xa5e4('0x2c')});dials[_0x885f16[_0xa5e4('0x6')]][_0xa5e4('0x2d')]=utils[_0xa5e4('0x2e')](dials[_0x885f16[_0xa5e4('0x6')]]['endtime'],dials[_0x885f16[_0xa5e4('0x6')]][_0xa5e4('0x22')]);dials[_0x885f16['uniqueid']]['holdtime']=utils[_0xa5e4('0x2e')](dials[_0x885f16[_0xa5e4('0x6')]][_0xa5e4('0x27')]||dials[_0x885f16[_0xa5e4('0x6')]]['endtime'],dials[_0x885f16[_0xa5e4('0x6')]]['starttime']);dials[_0x885f16['uniqueid']][_0xa5e4('0x2f')]=dials[_0x885f16[_0xa5e4('0x6')]]['answertime']?utils[_0xa5e4('0x2e')](dials[_0x885f16[_0xa5e4('0x6')]][_0xa5e4('0x30')],dials[_0x885f16[_0xa5e4('0x6')]][_0xa5e4('0x27')]):0x0;writeDB(dials[_0x885f16['uniqueid']]);}}catch(_0x5f1351){utils[_0xa5e4('0x16')](util[_0xa5e4('0x4')]('[%s][dials][hangup]',_0x885f16['uniqueid']),_0x5f1351);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5d98228..45f7fc4 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 _0x0c2d=['newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','local','asterisk','port','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]'];(function(_0x249154,_0x242056){var _0x26458e=function(_0x54838f){while(--_0x54838f){_0x249154['push'](_0x249154['shift']());}};_0x26458e(++_0x242056);}(_0x0c2d,0x19b));var _0xd0c2=function(_0x460fd4,_0x1059ce){_0x460fd4=_0x460fd4-0x0;var _0x1c4150=_0x0c2d[_0x460fd4];return _0x1c4150;};var AsteriskManager=require(_0xd0c2('0x0'));var config=require(_0xd0c2('0x1'));var utils=require(_0xd0c2('0x2'));var util=require('util');var isXDREnabled=config[_0xd0c2('0x3')]&&config['xdr'][_0xd0c2('0x4')]?!config[_0xd0c2('0x3')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0xd0c2('0x3')]&&config[_0xd0c2('0x3')][_0xd0c2('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xd0c2('0x6')][_0xd0c2('0x7')],config[_0xd0c2('0x6')]['ip'],config[_0xd0c2('0x6')]['username'],config['asterisk']['password'],!![]);ami[_0xd0c2('0x8')]();if(!isXDREnabled){utils['info'](_0xd0c2('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd0c2('0xa')](_0xd0c2('0xb'));}else{var agents=require(_0xd0c2('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xd0c2('0xd'));var dials=require(_0xd0c2('0xe'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xd0c2('0xf'),core[_0xd0c2('0xf')]);ami['on'](_0xd0c2('0x10'),core[_0xd0c2('0x10')]);ami['on'](_0xd0c2('0x11'),core['fullybooted']);ami['on'](_0xd0c2('0x12'),core[_0xd0c2('0x12')]);ami['on'](_0xd0c2('0x13'),core[_0xd0c2('0x13')]);ami['on'](_0xd0c2('0x14'),core[_0xd0c2('0x14')]);ami['on'](_0xd0c2('0x15'),function(_0x298460){try{utils['debug'](util['format']('[%s][index][devicestatechange]',_0x298460[_0xd0c2('0x16')]),_0x298460);members['devicestatechange'](_0x298460);}catch(_0x39215a){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x18'),_0x298460['device']),_0x39215a);}});ami['on'](_0xd0c2('0x19'),function(_0x5897a1){try{utils['debug'](util[_0xd0c2('0x17')](_0xd0c2('0x1a'),_0x5897a1[_0xd0c2('0x1b')]),_0x5897a1);agents['agentcalled'](_0x5897a1);}catch(_0x38ba64){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x1a'),_0x5897a1['uniqueid']),_0x38ba64);}});ami['on'](_0xd0c2('0x1c'),function(_0x3b42d1){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x1e'),_0x3b42d1[_0xd0c2('0x1b')]),_0x3b42d1);agents[_0xd0c2('0x1c')](_0x3b42d1);}catch(_0x13fd64){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x1e'),_0x3b42d1[_0xd0c2('0x1b')]),_0x13fd64);}});ami['on'](_0xd0c2('0x1f'),function(_0x5cc6b8){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x20'),_0x5cc6b8['uniqueid']),_0x5cc6b8);agents[_0xd0c2('0x1f')](_0x5cc6b8);queues['agentconnect'](_0x5cc6b8);}catch(_0x216516){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x20'),_0x5cc6b8[_0xd0c2('0x1b')]),_0x216516);}});ami['on'](_0xd0c2('0x21'),function(_0x333552){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x22'),_0x333552[_0xd0c2('0x1b')]),_0x333552);agents['agentcomplete'](_0x333552);queues[_0xd0c2('0x21')](_0x333552);members[_0xd0c2('0x21')](_0x333552);}catch(_0x2b2446){utils['error'](util['format'](_0xd0c2('0x22'),_0x333552[_0xd0c2('0x1b')]),_0x2b2446);}});ami['on']('queuecallerabandon',function(_0x51b5cc){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x23'),_0x51b5cc[_0xd0c2('0x1b')]),_0x51b5cc);agents[_0xd0c2('0x24')](_0x51b5cc);queues['queuecallerabandon'](_0x51b5cc);}catch(_0x14c120){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')]('[%s][index][queuecallerabandon]',_0x51b5cc['uniqueid']),_0x14c120);}});ami['on'](_0xd0c2('0x25'),function(_0x18752d){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x26'),_0x18752d['uniqueid']),_0x18752d);queues[_0xd0c2('0x25')](_0x18752d);recordings['queuecallerjoin'](_0x18752d);}catch(_0x220ad3){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x26'),_0x18752d['uniqueid']),_0x220ad3);}});ami['on'](_0xd0c2('0x27'),function(_0x557be5){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x28'),_0x557be5['uniqueid']),_0x557be5);queues[_0xd0c2('0x27')](_0x557be5);}catch(_0x41fdbf){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x28'),_0x557be5[_0xd0c2('0x1b')]),_0x41fdbf);}});ami['on']('musiconholdstart',function(_0x4d96b5){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x29'),_0x4d96b5[_0xd0c2('0x1b')]),_0x4d96b5);queues[_0xd0c2('0x2a')](_0x4d96b5);calls[_0xd0c2('0x2a')](_0x4d96b5);}catch(_0x3b8e54){utils['error'](util['format'](_0xd0c2('0x29'),_0x4d96b5[_0xd0c2('0x1b')]),_0x3b8e54);}});ami['on']('musiconholdstop',function(_0x8553d0){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')]('[%s][index][musiconholdstop]',_0x8553d0[_0xd0c2('0x1b')]),_0x8553d0);queues[_0xd0c2('0x2b')](_0x8553d0);calls['musiconholdstop'](_0x8553d0);}catch(_0x5cf357){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x2c'),_0x8553d0['uniqueid']),_0x5cf357);}});ami['on']('newstate',function(_0x3dc008){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x2d'),_0x3dc008[_0xd0c2('0x1b')]),_0x3dc008);calls['newstate'](_0x3dc008);recordings[_0xd0c2('0x2e')](_0x3dc008);}catch(_0x44eb62){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x2d'),_0x3dc008[_0xd0c2('0x1b')]),_0x44eb62);}});ami['on'](_0xd0c2('0x2f'),function(_0x38b4f7){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x30'),_0x38b4f7[_0xd0c2('0x1b')]),_0x38b4f7);calls[_0xd0c2('0x2f')](_0x38b4f7);recordings['hangup'](_0x38b4f7);dials['hangup'](_0x38b4f7);agents['hangup'](_0x38b4f7);queues['hangup'](_0x38b4f7);}catch(_0xf40e2f){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x30'),_0x38b4f7[_0xd0c2('0x1b')]),_0xf40e2f);}});ami['on'](_0xd0c2('0x31'),function(_0x560942){try{utils['debug'](util['format'](_0xd0c2('0x32'),_0x560942['uniqueid']),_0x560942);members[_0xd0c2('0x31')](_0x560942);}catch(_0x3fb95){utils[_0xd0c2('0x12')](util['format'](_0xd0c2('0x32'),_0x560942['uniqueid']),_0x3fb95);}});ami['on'](_0xd0c2('0x33'),function(_0x5d0a67){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x34'),_0x5d0a67[_0xd0c2('0x1b')]),_0x5d0a67);queues[_0xd0c2('0x33')](_0x5d0a67);agents[_0xd0c2('0x33')](_0x5d0a67);transfers['blindtransfer'](_0x5d0a67);}catch(_0x377d98){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x34'),_0x5d0a67['uniqueid']),_0x377d98);}});ami['on'](_0xd0c2('0x35'),function(_0x580e68){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x36'),_0x580e68[_0xd0c2('0x37')]),_0x580e68);queues[_0xd0c2('0x35')](_0x580e68);transfers['attendedtransfer'](_0x580e68);agents[_0xd0c2('0x35')](_0x580e68);calls[_0xd0c2('0x35')](_0x580e68);}catch(_0x7d3c38){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x36'),_0x580e68[_0xd0c2('0x37')]),_0x7d3c38);}});ami['on'](_0xd0c2('0x38'),function(_0x137e3a){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x39'),_0x137e3a['uniqueid']),_0x137e3a);queues[_0xd0c2('0x38')](_0x137e3a);recordings[_0xd0c2('0x38')](_0x137e3a);calls[_0xd0c2('0x38')](_0x137e3a);dials[_0xd0c2('0x38')](_0x137e3a);}catch(_0x121365){utils[_0xd0c2('0x12')](util['format'](_0xd0c2('0x39'),_0x137e3a['uniqueid']),_0x121365);}});ami['on'](_0xd0c2('0x3a'),function(_0x151b9d){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x3b'),_0x151b9d['uniqueid']),_0x151b9d);calls[_0xd0c2('0x3a')](_0x151b9d);recordings[_0xd0c2('0x3a')](_0x151b9d);dials[_0xd0c2('0x3a')](_0x151b9d);}catch(_0x212fe5){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x3b'),_0x151b9d[_0xd0c2('0x1b')]),_0x212fe5);}});ami['on'](_0xd0c2('0x3c'),function(_0x48660f){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x3d'),_0x48660f[_0xd0c2('0x1b')]),_0x48660f);calls[_0xd0c2('0x3c')](_0x48660f);recordings[_0xd0c2('0x3c')](_0x48660f);}catch(_0x38dff8){utils['error'](util[_0xd0c2('0x17')](_0xd0c2('0x3d'),_0x48660f[_0xd0c2('0x1b')]),_0x38dff8);}});ami['on'](_0xd0c2('0x3e'),function(_0x49c65c){try{utils[_0xd0c2('0x1d')](util['format'](_0xd0c2('0x3f'),_0x49c65c[_0xd0c2('0x1b')]),_0x49c65c);dials['dialbegin'](_0x49c65c);}catch(_0x6ff4a6){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')](_0xd0c2('0x40'),_0x49c65c[_0xd0c2('0x1b')]),_0x6ff4a6);}});ami['on'](_0xd0c2('0x41'),function(_0x33fe0e){try{utils[_0xd0c2('0x1d')](util[_0xd0c2('0x17')](_0xd0c2('0x42'),_0x33fe0e['uniqueid']),_0x33fe0e);dials[_0xd0c2('0x41')](_0x33fe0e);}catch(_0x1bbc8d){utils[_0xd0c2('0x12')](util[_0xd0c2('0x17')]('[%s][index][dialend]',_0x33fe0e[_0xd0c2('0x1b')]),_0x1bbc8d);}});} \ No newline at end of file +var _0xbf1a=['Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','env','local','asterisk','username','password','info','XDR\x20DISABLED'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xbf1a,0x158));var _0xabf1=function(_0x202a8e,_0x2b6047){_0x202a8e=_0x202a8e-0x0;var _0x33ffba=_0xbf1a[_0x202a8e];return _0x33ffba;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var isXDREnabled=config[_0xabf1('0x2')]&&config['xdr'][_0xabf1('0x3')]?!config[_0xabf1('0x2')]['disabled']:!![];var isProduction=config[_0xabf1('0x4')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0xabf1('0x2')][_0xabf1('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xabf1('0x6')]['port'],config[_0xabf1('0x6')]['ip'],config[_0xabf1('0x6')][_0xabf1('0x7')],config[_0xabf1('0x6')][_0xabf1('0x8')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xabf1('0x9')](_0xabf1('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xabf1('0xb'));}else{var agents=require(_0xabf1('0xc'));var calls=require(_0xabf1('0xd'));var queues=require(_0xabf1('0xe'));var recordings=require(_0xabf1('0xf'));var members=require(_0xabf1('0x10'));var dials=require(_0xabf1('0x11'));var transfers=require(_0xabf1('0x12'));var core=require(_0xabf1('0x13'));ami['on'](_0xabf1('0x14'),core[_0xabf1('0x14')]);ami['on']('shutdown',core[_0xabf1('0x15')]);ami['on'](_0xabf1('0x16'),core[_0xabf1('0x16')]);ami['on'](_0xabf1('0x17'),core[_0xabf1('0x17')]);ami['on'](_0xabf1('0x18'),core[_0xabf1('0x18')]);ami['on'](_0xabf1('0x19'),core[_0xabf1('0x19')]);ami['on'](_0xabf1('0x1a'),function(_0x598f7d){try{utils['debug'](util[_0xabf1('0x1b')](_0xabf1('0x1c'),_0x598f7d['device']),_0x598f7d);members['devicestatechange'](_0x598f7d);}catch(_0x556d00){utils['error'](util['format'](_0xabf1('0x1c'),_0x598f7d[_0xabf1('0x1d')]),_0x556d00);}});ami['on'](_0xabf1('0x1e'),function(_0x3af31a){try{utils['debug'](util[_0xabf1('0x1b')](_0xabf1('0x1f'),_0x3af31a[_0xabf1('0x20')]),_0x3af31a);agents[_0xabf1('0x1e')](_0x3af31a);}catch(_0x366cc8){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')]('[%s][index][agentcalled]',_0x3af31a[_0xabf1('0x20')]),_0x366cc8);}});ami['on']('agentringnoanswer',function(_0x4bc381){try{utils['debug'](util[_0xabf1('0x1b')](_0xabf1('0x21'),_0x4bc381[_0xabf1('0x20')]),_0x4bc381);agents[_0xabf1('0x22')](_0x4bc381);}catch(_0x39be6e){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x21'),_0x4bc381['uniqueid']),_0x39be6e);}});ami['on'](_0xabf1('0x23'),function(_0x4eaf2e){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x25'),_0x4eaf2e[_0xabf1('0x20')]),_0x4eaf2e);agents['agentconnect'](_0x4eaf2e);queues[_0xabf1('0x23')](_0x4eaf2e);}catch(_0x1daff2){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x25'),_0x4eaf2e['uniqueid']),_0x1daff2);}});ami['on'](_0xabf1('0x26'),function(_0x2bc995){try{utils[_0xabf1('0x24')](util['format'](_0xabf1('0x27'),_0x2bc995[_0xabf1('0x20')]),_0x2bc995);agents['agentcomplete'](_0x2bc995);queues['agentcomplete'](_0x2bc995);members['agentcomplete'](_0x2bc995);}catch(_0x125331){utils['error'](util[_0xabf1('0x1b')]('[%s][index][agentcomplete]',_0x2bc995['uniqueid']),_0x125331);}});ami['on'](_0xabf1('0x28'),function(_0x5289da){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x29'),_0x5289da[_0xabf1('0x20')]),_0x5289da);agents[_0xabf1('0x28')](_0x5289da);queues[_0xabf1('0x28')](_0x5289da);}catch(_0x4bc7f6){utils['error'](util[_0xabf1('0x1b')](_0xabf1('0x29'),_0x5289da[_0xabf1('0x20')]),_0x4bc7f6);}});ami['on'](_0xabf1('0x2a'),function(_0x487a96){try{utils[_0xabf1('0x24')](util['format'](_0xabf1('0x2b'),_0x487a96['uniqueid']),_0x487a96);queues[_0xabf1('0x2a')](_0x487a96);recordings[_0xabf1('0x2a')](_0x487a96);}catch(_0x1eb89a){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')]('[%s][index][queuecallerjoin]',_0x487a96[_0xabf1('0x20')]),_0x1eb89a);}});ami['on'](_0xabf1('0x2c'),function(_0x19fdc1){try{utils[_0xabf1('0x24')](util['format']('[%s][index][queuecallerleave]',_0x19fdc1[_0xabf1('0x20')]),_0x19fdc1);queues['queuecallerleave'](_0x19fdc1);}catch(_0x4cf5ab){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x2d'),_0x19fdc1[_0xabf1('0x20')]),_0x4cf5ab);}});ami['on']('musiconholdstart',function(_0x53fa2d){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')]('[%s][index][musiconholdstart]',_0x53fa2d[_0xabf1('0x20')]),_0x53fa2d);queues[_0xabf1('0x2e')](_0x53fa2d);calls[_0xabf1('0x2e')](_0x53fa2d);}catch(_0x3e7fe7){utils[_0xabf1('0x17')](util['format'](_0xabf1('0x2f'),_0x53fa2d[_0xabf1('0x20')]),_0x3e7fe7);}});ami['on'](_0xabf1('0x30'),function(_0x1dda23){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x31'),_0x1dda23[_0xabf1('0x20')]),_0x1dda23);queues['musiconholdstop'](_0x1dda23);calls['musiconholdstop'](_0x1dda23);}catch(_0x48a3e1){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x31'),_0x1dda23[_0xabf1('0x20')]),_0x48a3e1);}});ami['on']('newstate',function(_0xd3830){try{utils['debug'](util[_0xabf1('0x1b')](_0xabf1('0x32'),_0xd3830[_0xabf1('0x20')]),_0xd3830);calls[_0xabf1('0x33')](_0xd3830);recordings[_0xabf1('0x33')](_0xd3830);}catch(_0xfa1d9b){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')]('[%s][index][newstate]',_0xd3830['uniqueid']),_0xfa1d9b);}});ami['on'](_0xabf1('0x34'),function(_0x24f5a4){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x35'),_0x24f5a4[_0xabf1('0x20')]),_0x24f5a4);calls['hangup'](_0x24f5a4);recordings['hangup'](_0x24f5a4);dials[_0xabf1('0x34')](_0x24f5a4);agents[_0xabf1('0x34')](_0x24f5a4);queues[_0xabf1('0x34')](_0x24f5a4);}catch(_0x17f62f){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')]('[%s][index][hangup]',_0x24f5a4['uniqueid']),_0x17f62f);}});ami['on'](_0xabf1('0x36'),function(_0x1d053f){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x37'),_0x1d053f['uniqueid']),_0x1d053f);members[_0xabf1('0x36')](_0x1d053f);}catch(_0x4ea2eb){utils[_0xabf1('0x17')](util['format'](_0xabf1('0x37'),_0x1d053f[_0xabf1('0x20')]),_0x4ea2eb);}});ami['on'](_0xabf1('0x38'),function(_0x1d468a){try{utils['debug'](util[_0xabf1('0x1b')](_0xabf1('0x39'),_0x1d468a['uniqueid']),_0x1d468a);queues['blindtransfer'](_0x1d468a);agents[_0xabf1('0x38')](_0x1d468a);transfers[_0xabf1('0x38')](_0x1d468a);}catch(_0x292e8a){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x39'),_0x1d468a['uniqueid']),_0x292e8a);}});ami['on'](_0xabf1('0x3a'),function(_0x512fc9){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x3b'),_0x512fc9['origtransfereruniqueid']),_0x512fc9);queues[_0xabf1('0x3a')](_0x512fc9);transfers[_0xabf1('0x3a')](_0x512fc9);agents[_0xabf1('0x3a')](_0x512fc9);calls[_0xabf1('0x3a')](_0x512fc9);}catch(_0x1353a9){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x3b'),_0x512fc9['origtransfereruniqueid']),_0x1353a9);}});ami['on']('varset',function(_0x129e9a){try{utils[_0xabf1('0x24')](util['format'](_0xabf1('0x3c'),_0x129e9a[_0xabf1('0x20')]),_0x129e9a);queues[_0xabf1('0x3d')](_0x129e9a);recordings[_0xabf1('0x3d')](_0x129e9a);calls[_0xabf1('0x3d')](_0x129e9a);dials[_0xabf1('0x3d')](_0x129e9a);}catch(_0x1c9447){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x3c'),_0x129e9a[_0xabf1('0x20')]),_0x1c9447);}});ami['on'](_0xabf1('0x3e'),function(_0x180708){try{utils[_0xabf1('0x24')](util[_0xabf1('0x1b')](_0xabf1('0x3f'),_0x180708[_0xabf1('0x20')]),_0x180708);calls[_0xabf1('0x3e')](_0x180708);recordings[_0xabf1('0x3e')](_0x180708);dials[_0xabf1('0x3e')](_0x180708);}catch(_0x30e0b2){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')]('[%s][index][newexten]',_0x180708[_0xabf1('0x20')]),_0x30e0b2);}});ami['on'](_0xabf1('0x40'),function(_0x58597a){try{utils['debug'](util['format'](_0xabf1('0x41'),_0x58597a[_0xabf1('0x20')]),_0x58597a);calls[_0xabf1('0x40')](_0x58597a);recordings[_0xabf1('0x40')](_0x58597a);}catch(_0x5ccca6){utils['error'](util[_0xabf1('0x1b')]('[%s][index][newchannel]',_0x58597a[_0xabf1('0x20')]),_0x5ccca6);}});ami['on']('dialbegin',function(_0x123ad6){try{utils[_0xabf1('0x24')](util['format'](_0xabf1('0x42'),_0x123ad6[_0xabf1('0x20')]),_0x123ad6);dials[_0xabf1('0x43')](_0x123ad6);}catch(_0x426170){utils[_0xabf1('0x17')](util[_0xabf1('0x1b')](_0xabf1('0x44'),_0x123ad6[_0xabf1('0x20')]),_0x426170);}});ami['on'](_0xabf1('0x45'),function(_0xb4437b){try{utils['debug'](util['format']('[%s][index][dialend]',_0xb4437b[_0xabf1('0x20')]),_0xb4437b);dials[_0xabf1('0x45')](_0xb4437b);}catch(_0x59180a){utils[_0xabf1('0x17')](util['format'](_0xabf1('0x46'),_0xb4437b['uniqueid']),_0x59180a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index af3f65f..4dc34bf 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 _0x5c73=['internal','request','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','debug','[%s][members][cdr]','assign','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','getUserByInterface','then','name'];(function(_0xeb9886,_0xf26fd5){var _0x50a707=function(_0x19c34f){while(--_0x19c34f){_0xeb9886['push'](_0xeb9886['shift']());}};_0x50a707(++_0xf26fd5);}(_0x5c73,0x135));var _0x35c7=function(_0x2c90e3,_0x3487e9){_0x2c90e3=_0x2c90e3-0x0;var _0x41fe19=_0x5c73[_0x2c90e3];return _0x41fe19;};'use strict';var _=require(_0x35c7('0x0'));var util=require('util');var utils=require(_0x35c7('0x1'));var members={};var exclude=[_0x35c7('0x2'),_0x35c7('0x3')];function writeDB(_0x1e7e7e){utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x6'),_0x1e7e7e['uniqueid'],_0x1e7e7e['interface'],_0x1e7e7e[_0x35c7('0x7')],_0x1e7e7e[_0x35c7('0x8')],_0x1e7e7e[_0x35c7('0x9')],_0x1e7e7e[_0x35c7('0xa')]));if(_0x1e7e7e[_0x35c7('0xb')]){utils[_0x35c7('0xc')](_0x1e7e7e['interface'])[_0x35c7('0xd')](function(_0x1ac275){if(_0x1ac275){_0x1e7e7e[_0x35c7('0x9')]=_0x1ac275[_0x35c7('0xe')];_0x1e7e7e[_0x35c7('0xf')]=_0x1ac275[_0x35c7('0xf')];utils[_0x35c7('0x10')]('CreateMemberReport',_0x1e7e7e);}else{utils['getUserByName'](_0x1e7e7e['interface'][_0x35c7('0x11')]('/')[0x1])[_0x35c7('0xd')](function(_0x58debe){if(_0x58debe){_0x1e7e7e[_0x35c7('0x9')]=_0x58debe[_0x35c7('0xe')];_0x1e7e7e[_0x35c7('0xf')]=_0x58debe[_0x35c7('0xf')];utils[_0x35c7('0x10')](_0x35c7('0x12'),_0x1e7e7e);}});}})['catch'](function(_0x68280d){utils[_0x35c7('0x13')](util[_0x35c7('0x5')](_0x35c7('0x14'),_0x1e7e7e[_0x35c7('0x15')]),_0x68280d);});}delete members[_0x1e7e7e[_0x35c7('0xb')]];}function startsWith(_0x1cbd8f,_0x33e088){return _[_0x35c7('0x16')](_0x1cbd8f,function(_0x1daf31){return _[_0x35c7('0x17')](_0x33e088,_0x1daf31);});}exports[_0x35c7('0x18')]=function(_0x5b086b){try{utils['debug'](util[_0x35c7('0x5')](_0x35c7('0x19'),members[_0x5b086b['device']]?members[_0x5b086b[_0x35c7('0x1a')]]['uniqueid']:_0x5b086b['device']),_0x5b086b);utils[_0x35c7('0x4')](util['format'](_0x35c7('0x1b'),members[_0x5b086b[_0x35c7('0x1a')]]?members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]:_0x5b086b['device'],_0x5b086b[_0x35c7('0x1c')],_0x5b086b['device']));switch(_0x5b086b['state']){case _0x35c7('0x1d'):case _0x35c7('0x1e'):if(!startsWith(exclude,_0x5b086b['device'])){members[_0x5b086b[_0x35c7('0x1a')]]={'channel':_0x35c7('0x1f'),'interface':_0x5b086b[_0x35c7('0x1a')],'type':_0x35c7('0x20'),'enterAt':utils['now'](),'role':_0x35c7('0x21')};}break;case _0x35c7('0x22'):if(!_['isNil'](members[_0x5b086b[_0x35c7('0x1a')]])){members[_0x5b086b['device']][_0x35c7('0x23')]=utils['now']();members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x24')]=utils[_0x35c7('0x25')](members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x23')],members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x26')]);if(members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]){writeDB(members[_0x5b086b[_0x35c7('0x1a')]]);}}break;default:break;}}catch(_0x449194){utils['error'](util[_0x35c7('0x5')](_0x35c7('0x19'),members[_0x5b086b[_0x35c7('0x1a')]]?members[_0x5b086b[_0x35c7('0x1a')]][_0x35c7('0x15')]:_0x5b086b['device']),_0x449194);}};exports[_0x35c7('0x27')]=function(_0x3179ad){try{if(!_[_0x35c7('0x28')](members[_0x3179ad[_0x35c7('0xb')]])){utils['debug'](util[_0x35c7('0x5')](_0x35c7('0x29'),_0x3179ad['uniqueid']),_0x3179ad);utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x2a'),_0x3179ad['uniqueid'],_0x3179ad[_0x35c7('0xb')],_0x3179ad[_0x35c7('0x2b')]));members[_0x3179ad[_0x35c7('0xb')]]=_['assign'](members[_0x3179ad['interface']],{'data4':_0x3179ad[_0x35c7('0x2b')],'uniqueid':_0x3179ad[_0x35c7('0x15')]});}}catch(_0x16ef65){utils[_0x35c7('0x13')](util[_0x35c7('0x5')]('[%s][members][agentcomplete]',_0x3179ad['uniqueid']),_0x16ef65);}};exports[_0x35c7('0x2c')]=function(_0x4e96c5){try{utils[_0x35c7('0x2d')](util[_0x35c7('0x5')](_0x35c7('0x2e'),_0x4e96c5[_0x35c7('0x15')]),_0x4e96c5);if(_0x4e96c5[_0x35c7('0x7')]){var _0x5ede31=_0x4e96c5[_0x35c7('0x7')][_0x35c7('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5ede31])){members[_0x5ede31]=_[_0x35c7('0x2f')](members[_0x5ede31],{'data1':members[_0x5ede31][_0x35c7('0x30')]||_0x4e96c5['type'],'data2':members[_0x5ede31]['data2']||_0x4e96c5['source'],'data3':members[_0x5ede31][_0x35c7('0x31')]||_0x4e96c5[_0x35c7('0x32')],'uniqueid':members[_0x5ede31][_0x35c7('0x15')]||_0x4e96c5[_0x35c7('0x15')]});utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x33'),_0x4e96c5[_0x35c7('0x15')],members[_0x5ede31][_0x35c7('0x30')],members[_0x5ede31][_0x35c7('0x8')],members[_0x5ede31]['data3']));if(members[_0x5ede31]['exitAt']){writeDB(members[_0x5ede31]);}}}if(_0x4e96c5[_0x35c7('0x34')]){var _0x38afdc=_0x4e96c5['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x38afdc])){members[_0x38afdc]=_[_0x35c7('0x2f')](members[_0x38afdc],{'data1':members[_0x38afdc][_0x35c7('0x30')]||_0x4e96c5[_0x35c7('0xa')],'data2':members[_0x38afdc][_0x35c7('0x8')]||_0x4e96c5[_0x35c7('0x35')],'data3':members[_0x38afdc][_0x35c7('0x31')]||_0x4e96c5[_0x35c7('0x32')],'uniqueid':members[_0x38afdc][_0x35c7('0x15')]||_0x4e96c5[_0x35c7('0x15')]});utils[_0x35c7('0x4')](util[_0x35c7('0x5')](_0x35c7('0x33'),_0x4e96c5[_0x35c7('0x15')],members[_0x38afdc][_0x35c7('0x30')],members[_0x38afdc][_0x35c7('0x8')],members[_0x38afdc][_0x35c7('0x31')]));if(members[_0x38afdc][_0x35c7('0x23')]){writeDB(members[_0x38afdc]);}}}}catch(_0x17556b){utils[_0x35c7('0x13')](util[_0x35c7('0x5')]('[%s][members][cdr]',_0x4e96c5[_0x35c7('0x15')]),_0x17556b);}}; \ No newline at end of file +var _0x043d=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','type','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','assign','data1','lodash','util','./utils','Local/_attended@transfer','Queue:','info'];(function(_0x385708,_0x56269d){var _0x1d7d4c=function(_0x264aa1){while(--_0x264aa1){_0x385708['push'](_0x385708['shift']());}};_0x1d7d4c(++_0x56269d);}(_0x043d,0x1ba));var _0xd043=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0x043d[_0x47f7ec];return _0x415101;};'use strict';var _=require(_0xd043('0x0'));var util=require(_0xd043('0x1'));var utils=require(_0xd043('0x2'));var members={};var exclude=[_0xd043('0x3'),_0xd043('0x4')];function writeDB(_0x3c29b7){utils[_0xd043('0x5')](util[_0xd043('0x6')](_0xd043('0x7'),_0x3c29b7[_0xd043('0x8')],_0x3c29b7[_0xd043('0x9')],_0x3c29b7[_0xd043('0xa')],_0x3c29b7[_0xd043('0xb')],_0x3c29b7[_0xd043('0xc')],_0x3c29b7['type']));if(_0x3c29b7[_0xd043('0x9')]){utils[_0xd043('0xd')](_0x3c29b7['interface'])[_0xd043('0xe')](function(_0x4d5003){if(_0x4d5003){_0x3c29b7[_0xd043('0xc')]=_0x4d5003[_0xd043('0xf')];_0x3c29b7[_0xd043('0x10')]=_0x4d5003['internal'];utils[_0xd043('0x11')](_0xd043('0x12'),_0x3c29b7);}else{utils[_0xd043('0x13')](_0x3c29b7[_0xd043('0x9')][_0xd043('0x14')]('/')[0x1])[_0xd043('0xe')](function(_0x559029){if(_0x559029){_0x3c29b7['membername']=_0x559029[_0xd043('0xf')];_0x3c29b7['internal']=_0x559029[_0xd043('0x10')];utils[_0xd043('0x11')](_0xd043('0x12'),_0x3c29b7);}});}})[_0xd043('0x15')](function(_0x36e1a7){utils[_0xd043('0x16')](util[_0xd043('0x6')](_0xd043('0x17'),_0x3c29b7[_0xd043('0x8')]),_0x36e1a7);});}delete members[_0x3c29b7[_0xd043('0x9')]];}function startsWith(_0x42f883,_0x291e83){return _[_0xd043('0x18')](_0x42f883,function(_0x263067){return _[_0xd043('0x19')](_0x291e83,_0x263067);});}exports[_0xd043('0x1a')]=function(_0xb87c1c){try{utils[_0xd043('0x1b')](util['format'](_0xd043('0x1c'),members[_0xb87c1c[_0xd043('0x1d')]]?members[_0xb87c1c[_0xd043('0x1d')]][_0xd043('0x8')]:_0xb87c1c['device']),_0xb87c1c);utils[_0xd043('0x5')](util[_0xd043('0x6')](_0xd043('0x1e'),members[_0xb87c1c[_0xd043('0x1d')]]?members[_0xb87c1c['device']][_0xd043('0x8')]:_0xb87c1c[_0xd043('0x1d')],_0xb87c1c[_0xd043('0x1f')],_0xb87c1c[_0xd043('0x1d')]));switch(_0xb87c1c[_0xd043('0x1f')]){case'INUSE':case _0xd043('0x20'):if(!startsWith(exclude,_0xb87c1c[_0xd043('0x1d')])){members[_0xb87c1c[_0xd043('0x1d')]]={'channel':'voice','interface':_0xb87c1c['device'],'type':_0xd043('0x21'),'enterAt':utils[_0xd043('0x22')](),'role':_0xd043('0x23')};}break;case _0xd043('0x24'):if(!_[_0xd043('0x25')](members[_0xb87c1c[_0xd043('0x1d')]])){members[_0xb87c1c[_0xd043('0x1d')]][_0xd043('0x26')]=utils[_0xd043('0x22')]();members[_0xb87c1c['device']][_0xd043('0x27')]=utils[_0xd043('0x28')](members[_0xb87c1c['device']][_0xd043('0x26')],members[_0xb87c1c[_0xd043('0x1d')]][_0xd043('0x29')]);if(members[_0xb87c1c[_0xd043('0x1d')]][_0xd043('0x8')]){writeDB(members[_0xb87c1c['device']]);}}break;default:break;}}catch(_0x4a862){utils[_0xd043('0x16')](util['format']('[%s][members][devicestatechange]',members[_0xb87c1c['device']]?members[_0xb87c1c[_0xd043('0x1d')]][_0xd043('0x8')]:_0xb87c1c[_0xd043('0x1d')]),_0x4a862);}};exports[_0xd043('0x2a')]=function(_0x583d5c){try{if(!_[_0xd043('0x25')](members[_0x583d5c[_0xd043('0x9')]])){utils[_0xd043('0x1b')](util[_0xd043('0x6')](_0xd043('0x2b'),_0x583d5c[_0xd043('0x8')]),_0x583d5c);utils['info'](util[_0xd043('0x6')](_0xd043('0x2c'),_0x583d5c[_0xd043('0x8')],_0x583d5c[_0xd043('0x9')],_0x583d5c['queue']));members[_0x583d5c[_0xd043('0x9')]]=_['assign'](members[_0x583d5c[_0xd043('0x9')]],{'data4':_0x583d5c[_0xd043('0x2d')],'uniqueid':_0x583d5c[_0xd043('0x8')]});}}catch(_0x4ea1b1){utils[_0xd043('0x16')](util[_0xd043('0x6')]('[%s][members][agentcomplete]',_0x583d5c[_0xd043('0x8')]),_0x4ea1b1);}};exports[_0xd043('0x2e')]=function(_0x35119a){try{utils[_0xd043('0x1b')](util['format'](_0xd043('0x2f'),_0x35119a[_0xd043('0x8')]),_0x35119a);if(_0x35119a[_0xd043('0xa')]){var _0x36d0c7=_0x35119a['channel'][_0xd043('0x14')]('-')[0x0];if(!_[_0xd043('0x25')](members[_0x36d0c7])){members[_0x36d0c7]=_['assign'](members[_0x36d0c7],{'data1':members[_0x36d0c7]['data1']||_0x35119a[_0xd043('0x30')],'data2':members[_0x36d0c7]['data2']||_0x35119a[_0xd043('0x31')],'data3':members[_0x36d0c7]['data3']||_0x35119a[_0xd043('0x32')],'uniqueid':members[_0x36d0c7]['uniqueid']||_0x35119a[_0xd043('0x8')]});utils[_0xd043('0x5')](util[_0xd043('0x6')](_0xd043('0x33'),_0x35119a[_0xd043('0x8')],members[_0x36d0c7]['data1'],members[_0x36d0c7][_0xd043('0xb')],members[_0x36d0c7][_0xd043('0x34')]));if(members[_0x36d0c7]['exitAt']){writeDB(members[_0x36d0c7]);}}}if(_0x35119a[_0xd043('0x35')]){var _0x1a610f=_0x35119a[_0xd043('0x35')][_0xd043('0x14')]('-')[0x0];if(!_[_0xd043('0x25')](members[_0x1a610f])){members[_0x1a610f]=_[_0xd043('0x36')](members[_0x1a610f],{'data1':members[_0x1a610f][_0xd043('0x37')]||_0x35119a[_0xd043('0x30')],'data2':members[_0x1a610f][_0xd043('0xb')]||_0x35119a[_0xd043('0x31')],'data3':members[_0x1a610f][_0xd043('0x34')]||_0x35119a[_0xd043('0x32')],'uniqueid':members[_0x1a610f][_0xd043('0x8')]||_0x35119a[_0xd043('0x8')]});utils['info'](util['format'](_0xd043('0x33'),_0x35119a[_0xd043('0x8')],members[_0x1a610f]['data1'],members[_0x1a610f]['data2'],members[_0x1a610f][_0xd043('0x34')]));if(members[_0x1a610f][_0xd043('0x26')]){writeDB(members[_0x1a610f]);}}}}catch(_0x671b04){utils['error'](util[_0xd043('0x6')]('[%s][members][cdr]',_0x35119a[_0xd043('0x8')]),_0x671b04);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ec8cf6f..67f55f5 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 _0x31d0=['toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','assign','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','isNil','variable','queuestatus','CONTINUE','queuecallerexitAt','value'];(function(_0x396ab6,_0xc7723){var _0x140307=function(_0x36288c){while(--_0x36288c){_0x396ab6['push'](_0x396ab6['shift']());}};_0x140307(++_0xc7723);}(_0x31d0,0x1d5));var _0x031d=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x31d0[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0x031d('0x0'));var util=require(_0x031d('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x519271){utils[_0x031d('0x2')](util[_0x031d('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x519271[_0x031d('0x4')],_0x519271['channel'],_0x519271['queue'],_0x519271[_0x031d('0x5')],_0x519271[_0x031d('0x6')],_0x519271[_0x031d('0x7')],_0x519271[_0x031d('0x8')]));if(_0x519271['queue']){utils[_0x031d('0x9')](_0x519271[_0x031d('0xa')])['then'](function(_0x4ac856){if(_0x4ac856){_0x519271[_0x031d('0xb')]=_0x4ac856[_0x031d('0xb')];}utils[_0x031d('0xc')]('CreateVoiceQueueReport',_0x519271);});}else{utils[_0x031d('0xc')](_0x031d('0xd'),_0x519271);}if(_0x519271[_0x031d('0xe')]){delete queues[_0x519271[_0x031d('0xe')]];}else{delete queues[_0x519271[_0x031d('0x4')]];}}exports[_0x031d('0xf')]=function(_0x22bd43){try{utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x11'),_0x22bd43[_0x031d('0x4')]),_0x22bd43);utils[_0x031d('0x2')](util[_0x031d('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x22bd43['uniqueid'],_0x22bd43[_0x031d('0xa')],_0x22bd43['position']));queues[_0x22bd43['uniqueid']]=_[_0x031d('0x12')](_0x22bd43,{'originalposition':_0x22bd43['position'],'queuecallerjoinAt':utils[_0x031d('0x13')](),'mohtime':0x0});}catch(_0x43a76c){utils[_0x031d('0x14')](util[_0x031d('0x3')](_0x031d('0x11'),_0x22bd43[_0x031d('0x4')]),_0x43a76c);}};exports['hangup']=function(_0x7f553){try{if(!_['isNil'](queues[_0x7f553['uniqueid']])){utils[_0x031d('0x10')](util['format'](_0x031d('0x15'),_0x7f553['uniqueid']),_0x7f553);if(queues[_0x7f553['uniqueid']][_0x031d('0x16')]){if(!queues[_0x7f553[_0x031d('0x4')]][_0x031d('0x17')]&&!queues[_0x7f553['uniqueid']][_0x031d('0x18')]){queues[_0x7f553[_0x031d('0x4')]]['queuecallercomplete']=!![];queues[_0x7f553[_0x031d('0x4')]][_0x031d('0x19')]=utils['now']();queues[_0x7f553['uniqueid']][_0x031d('0x8')]='COMPLETEDBYAGENT';}utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x1a'),_0x7f553[_0x031d('0x4')],queues[_0x7f553[_0x031d('0x4')]][_0x031d('0x1b')],queues[_0x7f553['uniqueid']][_0x031d('0x8')]));writeDB(queues[_0x7f553[_0x031d('0x4')]]);}else if(queues[_0x7f553[_0x031d('0x4')]][_0x031d('0xe')]){utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x1c'),_0x7f553[_0x031d('0x4')],queues[_0x7f553['uniqueid']]['name'],queues[_0x7f553[_0x031d('0x4')]][_0x031d('0xe')]));queues[queues[_0x7f553['uniqueid']][_0x031d('0xe')]]=queues[_0x7f553[_0x031d('0x4')]];queues[queues[_0x7f553[_0x031d('0x4')]][_0x031d('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x7f553['uniqueid']];}}}catch(_0x13bf65){utils[_0x031d('0x14')](util[_0x031d('0x3')](_0x031d('0x15'),_0x7f553[_0x031d('0x4')]),_0x13bf65);}};exports[_0x031d('0x1d')]=function(_0x1e45a4){try{utils[_0x031d('0x10')](util[_0x031d('0x3')]('[%s][queues][varset]',_0x1e45a4['uniqueid']),_0x1e45a4);if(!_[_0x031d('0x1e')](_0x1e45a4[_0x031d('0x1f')][_0x031d('0x20')])&&_0x1e45a4['value']['toUpperCase']()!==_0x031d('0x21')){if(!_['isNil'](queues[_0x1e45a4[_0x031d('0x4')]])){queues[_0x1e45a4[_0x031d('0x4')]]['queuecallerabandon']=![];queues[_0x1e45a4[_0x031d('0x4')]]['queuecallerabandonAt']=null;queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x18')]=!![];queues[_0x1e45a4['uniqueid']][_0x031d('0x22')]=utils[_0x031d('0x13')]();queues[_0x1e45a4[_0x031d('0x4')]]['queuecallerexitreason']=_0x1e45a4[_0x031d('0x23')][_0x031d('0x24')]();utils['info'](util[_0x031d('0x3')](_0x031d('0x25'),_0x1e45a4[_0x031d('0x4')],queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x1b')],_0x1e45a4[_0x031d('0x23')],queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x8')]));writeDB(queues[_0x1e45a4[_0x031d('0x4')]]);}}else if(!_[_0x031d('0x1e')](_0x1e45a4[_0x031d('0x1f')][_0x031d('0x26')])){if(!_['isNil'](queues[_0x1e45a4['uniqueid']])&&!queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x17')]){queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x17')]=![];queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x27')]=null;queues[_0x1e45a4[_0x031d('0x4')]]['queuecallerexit']=!![];queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x22')]=utils['now']();queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x8')]=_0x031d('0x28');utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x29'),_0x1e45a4[_0x031d('0x4')],queues[_0x1e45a4[_0x031d('0x4')]]['name'],_0x1e45a4[_0x031d('0x23')],queues[_0x1e45a4[_0x031d('0x4')]][_0x031d('0x8')]));}}}catch(_0x2c9005){utils[_0x031d('0x14')](util[_0x031d('0x3')](_0x031d('0x2a'),_0x1e45a4['uniqueid']),_0x2c9005);}};exports[_0x031d('0x17')]=function(_0x17e889){try{if(!_['isNil'](queues[_0x17e889[_0x031d('0x4')]])){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x2b'),_0x17e889[_0x031d('0x4')]),_0x17e889);queues[_0x17e889[_0x031d('0x4')]][_0x031d('0x18')]=![];queues[_0x17e889[_0x031d('0x4')]][_0x031d('0x22')]=null;queues[_0x17e889[_0x031d('0x4')]][_0x031d('0x17')]=!![];queues[_0x17e889['uniqueid']][_0x031d('0x27')]=utils[_0x031d('0x13')]();queues[_0x17e889[_0x031d('0x4')]][_0x031d('0x8')]=_0x031d('0x2c');utils['info'](util[_0x031d('0x3')](_0x031d('0x2d'),_0x17e889[_0x031d('0x4')],queues[_0x17e889['uniqueid']][_0x031d('0x1b')],queues[_0x17e889[_0x031d('0x4')]][_0x031d('0x8')]));}}catch(_0x1e6a49){utils[_0x031d('0x14')](util['format'](_0x031d('0x2b'),_0x17e889[_0x031d('0x4')]),_0x1e6a49);}};exports['queuecallerleave']=function(_0x4c7260){try{if(!_[_0x031d('0x1e')](queues[_0x4c7260[_0x031d('0x4')]])){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x2e'),_0x4c7260[_0x031d('0x4')]),_0x4c7260);utils['info'](util[_0x031d('0x3')](_0x031d('0x2f'),_0x4c7260[_0x031d('0x4')],queues[_0x4c7260[_0x031d('0x4')]][_0x031d('0x1b')],_0x4c7260['connectedlinenum'],_0x4c7260['connectedlinename']));queues[_0x4c7260['uniqueid']][_0x031d('0x30')]=!![];queues[_0x4c7260[_0x031d('0x4')]]['queuecallerleaveAt']=utils['now']();queues[_0x4c7260[_0x031d('0x4')]][_0x031d('0x31')]=utils[_0x031d('0x32')](queues[_0x4c7260[_0x031d('0x4')]][_0x031d('0x16')],queues[_0x4c7260['uniqueid']][_0x031d('0x33')]);queues[_0x4c7260['uniqueid']][_0x031d('0x34')]=_0x4c7260[_0x031d('0x34')];queues[_0x4c7260[_0x031d('0x4')]]['count']=_0x4c7260[_0x031d('0x35')];queues[_0x4c7260[_0x031d('0x4')]][_0x031d('0x36')]=_0x4c7260[_0x031d('0x36')];queues[_0x4c7260[_0x031d('0x4')]]['connectedlinename']=_0x4c7260[_0x031d('0x37')];}}catch(_0x139f18){utils['error'](util['format'](_0x031d('0x2e'),_0x4c7260[_0x031d('0x4')]),_0x139f18);}};exports[_0x031d('0x38')]=function(_0x3c3d73){try{if(!_['isNil'](queues[_0x3c3d73['uniqueid']])){utils['debug'](util[_0x031d('0x3')](_0x031d('0x39'),_0x3c3d73[_0x031d('0x4')]),_0x3c3d73);utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x3a'),_0x3c3d73['uniqueid'],queues[_0x3c3d73[_0x031d('0x4')]]['name'],_0x3c3d73[_0x031d('0x3b')],_0x3c3d73[_0x031d('0x3c')]));queues[_0x3c3d73[_0x031d('0x4')]]['queuecallerabandon']=![];queues[_0x3c3d73[_0x031d('0x4')]]['queuecallerabandon']=![];queues[_0x3c3d73[_0x031d('0x4')]][_0x031d('0x27')]=null;queues[_0x3c3d73[_0x031d('0x4')]]['queuecallerexit']=![];queues[_0x3c3d73[_0x031d('0x4')]]['queuecallerexitreason']=null;queues[_0x3c3d73[_0x031d('0x4')]][_0x031d('0x22')]=null;queues[_0x3c3d73[_0x031d('0x4')]][_0x031d('0x3d')]=!![];queues[_0x3c3d73['uniqueid']][_0x031d('0x7')]=_0x3c3d73[_0x031d('0x3c')];queues[_0x3c3d73[_0x031d('0x4')]][_0x031d('0x5')]=_0x3c3d73[_0x031d('0x3b')];}}catch(_0x3708e7){utils[_0x031d('0x14')](util[_0x031d('0x3')](_0x031d('0x39'),_0x3c3d73[_0x031d('0x4')]),_0x3708e7);}};exports[_0x031d('0x3e')]=function(_0x47c742){try{if(!_[_0x031d('0x1e')](queues[_0x47c742[_0x031d('0x4')]])){if(queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x16')]){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x3f'),_0x47c742['uniqueid']),_0x47c742);queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x17')]=![];queues[_0x47c742[_0x031d('0x4')]]['queuecallerabandon']=![];queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x27')]=null;queues[_0x47c742['uniqueid']]['queuecallerexit']=![];queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x22')]=null;queues[_0x47c742[_0x031d('0x4')]]['assigned']=!![];queues[_0x47c742['uniqueid']][_0x031d('0x5')]=_0x47c742[_0x031d('0x3b')];queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x40')]=!![];queues[_0x47c742[_0x031d('0x4')]]['queuecallercompleteAt']=utils[_0x031d('0x13')]();if(_0x47c742[_0x031d('0x41')]==_0x031d('0x42')){if(!queues[_0x47c742['uniqueid']]['transfer']){queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x8')]='TRANSFER';}}else{queues[_0x47c742[_0x031d('0x4')]][_0x031d('0x8')]='COMPLETEDBY'+_0x47c742['reason'][_0x031d('0x24')]();}utils[_0x031d('0x2')](util['format'](_0x031d('0x43'),_0x47c742[_0x031d('0x4')],queues[_0x47c742['uniqueid']]['name'],_0x47c742[_0x031d('0x3b')],queues[_0x47c742[_0x031d('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x47c742[_0x031d('0x4')]]);}}}catch(_0x1b490c){utils['error'](util[_0x031d('0x3')](_0x031d('0x3f'),_0x47c742[_0x031d('0x4')]),_0x1b490c);}};exports['blindtransfer']=function(_0x28833d){try{if(!_[_0x031d('0x1e')](queues[_0x28833d['transfereeuniqueid']])){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x44'),_0x28833d[_0x031d('0x4')]),_0x28833d);queues[_0x28833d['transfereeuniqueid']][_0x031d('0x42')]=!![];queues[_0x28833d[_0x031d('0x45')]][_0x031d('0x46')]=_0x031d('0x47');queues[_0x28833d[_0x031d('0x45')]][_0x031d('0x48')]=_0x28833d[_0x031d('0x49')];queues[_0x28833d[_0x031d('0x45')]][_0x031d('0x4a')]=_0x28833d['transfereeuniqueid'];queues[_0x28833d[_0x031d('0x45')]][_0x031d('0x8')]='BLINDTRANSFER';utils[_0x031d('0x2')](util[_0x031d('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x28833d['uniqueid'],queues[_0x28833d[_0x031d('0x45')]][_0x031d('0x1b')],_0x28833d[_0x031d('0x45')],_0x28833d[_0x031d('0x49')]));}}catch(_0x1311ca){utils['error'](util[_0x031d('0x3')](_0x031d('0x44'),_0x28833d['uniqueid']),_0x1311ca);}};exports['attendedtransfer']=function(_0x503eaf){try{utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x4b'),_0x503eaf[_0x031d('0x4c')]),_0x503eaf);if(_0x503eaf[_0x031d('0x4c')]==_0x503eaf[_0x031d('0x4d')]){if(!_[_0x031d('0x1e')](queues[_0x503eaf[_0x031d('0x4e')]])){utils[_0x031d('0x2')](util['format'](_0x031d('0x4f'),_0x503eaf[_0x031d('0x4c')],queues[_0x503eaf['secondtransfererlinkedid']]['name'],_0x503eaf[_0x031d('0x50')]));queues[_0x503eaf[_0x031d('0x4e')]]['transfer']=!![];queues[_0x503eaf[_0x031d('0x4e')]][_0x031d('0x46')]='ATTENDED';queues[_0x503eaf[_0x031d('0x4e')]][_0x031d('0x48')]=_0x503eaf[_0x031d('0x50')];queues[_0x503eaf['secondtransfererlinkedid']][_0x031d('0x4a')]=_0x503eaf[_0x031d('0x4c')];queues[_0x503eaf['secondtransfererlinkedid']][_0x031d('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x031d('0x1e')](queues[_0x503eaf['origtransfererlinkedid']])){if(_0x503eaf[_0x031d('0x51')]&&queues[_0x503eaf[_0x031d('0x51')]]){queues[_0x503eaf['transfereelinkedid']][_0x031d('0x52')]=0x1;queues[_0x503eaf[_0x031d('0x45')]]=_[_0x031d('0x53')](queues[_0x503eaf[_0x031d('0x51')]]);queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0xe')]=_0x503eaf[_0x031d('0x54')];queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0x52')]=0x2;queues[_0x503eaf['transfereeuniqueid']][_0x031d('0x6')]=queues[_0x503eaf['secondtransfererlinkedid']][_0x031d('0x6')];queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0x55')]=queues[_0x503eaf['secondtransfererlinkedid']][_0x031d('0x55')];queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0x33')]=utils[_0x031d('0x13')]();queues[_0x503eaf['transfereeuniqueid']][_0x031d('0x16')]=utils['now']();queues[_0x503eaf['transfereeuniqueid']][_0x031d('0x31')]=0x0;queues[_0x503eaf['transfereeuniqueid']][_0x031d('0x56')]=0x0;utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x57'),_0x503eaf['origtransfereruniqueid'],queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0x1b')],queues[_0x503eaf[_0x031d('0x45')]]['calleridnum'],queues[_0x503eaf[_0x031d('0x45')]][_0x031d('0x55')]));}else{utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x58'),_0x503eaf[_0x031d('0x4c')],queues[_0x503eaf[_0x031d('0x4d')]]['name'],_0x503eaf[_0x031d('0x4e')]));queues[_0x503eaf['origtransfererlinkedid']][_0x031d('0xe')]=_0x503eaf['secondtransfererlinkedid'];}}}else if(_0x503eaf[_0x031d('0x59')]==_0x503eaf[_0x031d('0x4e')]){if(!_[_0x031d('0x1e')](queues[_0x503eaf[_0x031d('0x4d')]])){utils[_0x031d('0x2')](util[_0x031d('0x3')](_0x031d('0x5a'),_0x503eaf[_0x031d('0x4c')],queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x1b')],_0x503eaf[_0x031d('0x59')],_0x503eaf[_0x031d('0x5b')]));queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x42')]=!![];queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x46')]='ATTENDED';queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x48')]=_0x503eaf[_0x031d('0x5b')];queues[_0x503eaf['origtransfererlinkedid']][_0x031d('0x4a')]=_0x503eaf[_0x031d('0x59')];queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x8')]=_0x031d('0x5c');}if(!_[_0x031d('0x1e')](queues[_0x503eaf[_0x031d('0x4e')]])){if(_0x503eaf['transfertargetlinkedid']&&queues[_0x503eaf[_0x031d('0x5d')]]){queues[_0x503eaf['transfertargetlinkedid']][_0x031d('0x52')]=0x1;queues[_0x503eaf[_0x031d('0x54')]]=_[_0x031d('0x53')](queues[_0x503eaf[_0x031d('0x5d')]]);queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0xe')]=_0x503eaf[_0x031d('0x54')];queues[_0x503eaf[_0x031d('0x54')]]['queuecallerenterreason']=0x2;queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x6')]=queues[_0x503eaf[_0x031d('0x4d')]]['calleridnum'];queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x55')]=queues[_0x503eaf[_0x031d('0x4d')]][_0x031d('0x55')];queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x33')]=utils['now']();queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x16')]=utils[_0x031d('0x13')]();queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x31')]=0x0;queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x56')]=0x0;utils[_0x031d('0x2')](util['format'](_0x031d('0x5e'),_0x503eaf[_0x031d('0x4c')],queues[_0x503eaf[_0x031d('0x54')]][_0x031d('0x1b')],queues[_0x503eaf[_0x031d('0x54')]]['transfereduniqueid'],queues[_0x503eaf[_0x031d('0x54')]]['calleridnum'],queues[_0x503eaf['transfertargetuniqueid']][_0x031d('0x55')]));}else{utils['info'](util['format'](_0x031d('0x58'),_0x503eaf[_0x031d('0x4c')],queues[_0x503eaf[_0x031d('0x4e')]][_0x031d('0x1b')],_0x503eaf[_0x031d('0x4d')]));queues[_0x503eaf[_0x031d('0x4e')]][_0x031d('0xe')]=_0x503eaf['origtransfererlinkedid'];}}}}catch(_0x6baada){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x503eaf[_0x031d('0x4c')]),_0x6baada);}};exports[_0x031d('0x5f')]=function(_0x198289){try{if(!_[_0x031d('0x1e')](queues[_0x198289['uniqueid']])){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x60'),_0x198289['uniqueid']),_0x198289);queues[_0x198289[_0x031d('0x4')]][_0x031d('0x61')]=utils['now']();utils[_0x031d('0x2')](util[_0x031d('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x198289[_0x031d('0x4')],queues[_0x198289['uniqueid']]['name'],queues[_0x198289[_0x031d('0x4')]][_0x031d('0x61')]));}}catch(_0xdbab3d){utils[_0x031d('0x14')](util[_0x031d('0x3')](_0x031d('0x60'),_0x198289[_0x031d('0x4')]),_0xdbab3d);}};exports[_0x031d('0x62')]=function(_0x4ff293){try{if(!_['isNil'](queues[_0x4ff293['uniqueid']])){if(!_[_0x031d('0x1e')](queues[_0x4ff293['uniqueid']]['musiconholdstartAt'])){utils[_0x031d('0x10')](util[_0x031d('0x3')](_0x031d('0x63'),_0x4ff293['uniqueid']),_0x4ff293);queues[_0x4ff293[_0x031d('0x4')]][_0x031d('0x56')]+=utils[_0x031d('0x32')](utils[_0x031d('0x13')](),queues[_0x4ff293[_0x031d('0x4')]][_0x031d('0x61')]);utils['info'](util[_0x031d('0x3')](_0x031d('0x64'),_0x4ff293['uniqueid'],queues[_0x4ff293[_0x031d('0x4')]][_0x031d('0x1b')],queues[_0x4ff293[_0x031d('0x4')]][_0x031d('0x56')]));delete queues[_0x4ff293['uniqueid']]['musiconholdstartAt'];}}}catch(_0x1c1187){utils[_0x031d('0x14')](util[_0x031d('0x3')]('[%s][queues][musiconholdstop]',_0x4ff293[_0x031d('0x4')]),_0x1c1187);}}; \ No newline at end of file +var _0x1baa=['queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','queuestatus','toUpperCase','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','value','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerabandonAt','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode'];(function(_0x16ba77,_0x26f2f6){var _0x1f5b92=function(_0x4c91c6){while(--_0x4c91c6){_0x16ba77['push'](_0x16ba77['shift']());}};_0x1f5b92(++_0x26f2f6);}(_0x1baa,0x1dc));var _0xa1ba=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1baa[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xa1ba('0x0'));var util=require('util');var utils=require(_0xa1ba('0x1'));var queues={};function writeDB(_0x42022f){utils['info'](util[_0xa1ba('0x2')](_0xa1ba('0x3'),_0x42022f[_0xa1ba('0x4')],_0x42022f[_0xa1ba('0x5')],_0x42022f[_0xa1ba('0x6')],_0x42022f['lastAssignedTo'],_0x42022f[_0xa1ba('0x7')],_0x42022f[_0xa1ba('0x8')],_0x42022f[_0xa1ba('0x9')]));if(_0x42022f[_0xa1ba('0x6')]){utils[_0xa1ba('0xa')](_0x42022f['queue'])['then'](function(_0x4c6bc9){if(_0x4c6bc9){_0x42022f['type']=_0x4c6bc9[_0xa1ba('0xb')];}utils[_0xa1ba('0xc')](_0xa1ba('0xd'),_0x42022f);});}else{utils[_0xa1ba('0xc')](_0xa1ba('0xd'),_0x42022f);}if(_0x42022f[_0xa1ba('0xe')]){delete queues[_0x42022f['transfereduniqueid']];}else{delete queues[_0x42022f[_0xa1ba('0x4')]];}}exports['queuecallerjoin']=function(_0x2e8c89){try{utils[_0xa1ba('0xf')](util[_0xa1ba('0x2')]('[%s][queues][queuecallerjoin]',_0x2e8c89[_0xa1ba('0x4')]),_0x2e8c89);utils[_0xa1ba('0x10')](util['format'](_0xa1ba('0x11'),_0x2e8c89['uniqueid'],_0x2e8c89[_0xa1ba('0x6')],_0x2e8c89[_0xa1ba('0x12')]));queues[_0x2e8c89[_0xa1ba('0x4')]]=_[_0xa1ba('0x13')](_0x2e8c89,{'originalposition':_0x2e8c89[_0xa1ba('0x12')],'queuecallerjoinAt':utils[_0xa1ba('0x14')](),'mohtime':0x0});}catch(_0x13d91d){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')](_0xa1ba('0x16'),_0x2e8c89['uniqueid']),_0x13d91d);}};exports[_0xa1ba('0x17')]=function(_0x5d04fe){try{if(!_[_0xa1ba('0x18')](queues[_0x5d04fe[_0xa1ba('0x4')]])){utils['debug'](util[_0xa1ba('0x2')]('[%s][queues][hangup]',_0x5d04fe[_0xa1ba('0x4')]),_0x5d04fe);if(queues[_0x5d04fe['uniqueid']][_0xa1ba('0x19')]){if(!queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0x1a')]&&!queues[_0x5d04fe['uniqueid']][_0xa1ba('0x1b')]){queues[_0x5d04fe[_0xa1ba('0x4')]]['queuecallercomplete']=!![];queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0x1c')]=utils[_0xa1ba('0x14')]();queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0x9')]=_0xa1ba('0x1d');}utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5d04fe[_0xa1ba('0x4')],queues[_0x5d04fe[_0xa1ba('0x4')]]['name'],queues[_0x5d04fe[_0xa1ba('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5d04fe[_0xa1ba('0x4')]]);}else if(queues[_0x5d04fe[_0xa1ba('0x4')]]['transfereduniqueid']){utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')](_0xa1ba('0x1e'),_0x5d04fe[_0xa1ba('0x4')],queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0x1f')],queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0xe')]));queues[queues[_0x5d04fe[_0xa1ba('0x4')]]['transfereduniqueid']]=queues[_0x5d04fe[_0xa1ba('0x4')]];queues[queues[_0x5d04fe[_0xa1ba('0x4')]][_0xa1ba('0xe')]][_0xa1ba('0x20')]=0x2;delete queues[_0x5d04fe[_0xa1ba('0x4')]];}}}catch(_0x14e4f0){utils['error'](util[_0xa1ba('0x2')](_0xa1ba('0x21'),_0x5d04fe[_0xa1ba('0x4')]),_0x14e4f0);}};exports['varset']=function(_0x41a632){try{utils['debug'](util[_0xa1ba('0x2')](_0xa1ba('0x22'),_0x41a632['uniqueid']),_0x41a632);if(!_[_0xa1ba('0x18')](_0x41a632[_0xa1ba('0x23')][_0xa1ba('0x24')])&&_0x41a632['value'][_0xa1ba('0x25')]()!=='CONTINUE'){if(!_[_0xa1ba('0x18')](queues[_0x41a632[_0xa1ba('0x4')]])){queues[_0x41a632[_0xa1ba('0x4')]]['queuecallerabandon']=![];queues[_0x41a632[_0xa1ba('0x4')]]['queuecallerabandonAt']=null;queues[_0x41a632[_0xa1ba('0x4')]]['queuecallerexit']=!![];queues[_0x41a632[_0xa1ba('0x4')]]['queuecallerexitAt']=utils[_0xa1ba('0x14')]();queues[_0x41a632['uniqueid']][_0xa1ba('0x9')]=_0x41a632['value']['toUpperCase']();utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x41a632['uniqueid'],queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x1f')],_0x41a632['value'],queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x9')]));writeDB(queues[_0x41a632['uniqueid']]);}}else if(!_[_0xa1ba('0x18')](_0x41a632[_0xa1ba('0x23')][_0xa1ba('0x26')])){if(!_['isNil'](queues[_0x41a632['uniqueid']])&&!queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x1a')]){queues[_0x41a632['uniqueid']][_0xa1ba('0x1a')]=![];queues[_0x41a632['uniqueid']]['queuecallerabandonAt']=null;queues[_0x41a632[_0xa1ba('0x4')]]['queuecallerexit']=!![];queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x27')]=utils[_0xa1ba('0x14')]();queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x9')]=_0xa1ba('0x28');utils[_0xa1ba('0x10')](util['format'](_0xa1ba('0x29'),_0x41a632['uniqueid'],queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x1f')],_0x41a632[_0xa1ba('0x2a')],queues[_0x41a632[_0xa1ba('0x4')]][_0xa1ba('0x9')]));}}}catch(_0x4110ac){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')](_0xa1ba('0x22'),_0x41a632[_0xa1ba('0x4')]),_0x4110ac);}};exports[_0xa1ba('0x1a')]=function(_0x5eb25d){try{if(!_[_0xa1ba('0x18')](queues[_0x5eb25d['uniqueid']])){utils['debug'](util[_0xa1ba('0x2')]('[%s][queues][queuecallerabandon]',_0x5eb25d[_0xa1ba('0x4')]),_0x5eb25d);queues[_0x5eb25d[_0xa1ba('0x4')]][_0xa1ba('0x1b')]=![];queues[_0x5eb25d[_0xa1ba('0x4')]][_0xa1ba('0x27')]=null;queues[_0x5eb25d[_0xa1ba('0x4')]]['queuecallerabandon']=!![];queues[_0x5eb25d[_0xa1ba('0x4')]]['queuecallerabandonAt']=utils[_0xa1ba('0x14')]();queues[_0x5eb25d['uniqueid']][_0xa1ba('0x9')]=_0xa1ba('0x2b');utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')](_0xa1ba('0x2c'),_0x5eb25d[_0xa1ba('0x4')],queues[_0x5eb25d[_0xa1ba('0x4')]]['name'],queues[_0x5eb25d[_0xa1ba('0x4')]][_0xa1ba('0x9')]));}}catch(_0x37c2af){utils['error'](util['format']('[%s][queues][queuecallerabandon]',_0x5eb25d[_0xa1ba('0x4')]),_0x37c2af);}};exports[_0xa1ba('0x2d')]=function(_0x17e68b){try{if(!_[_0xa1ba('0x18')](queues[_0x17e68b['uniqueid']])){utils['debug'](util[_0xa1ba('0x2')](_0xa1ba('0x2e'),_0x17e68b[_0xa1ba('0x4')]),_0x17e68b);utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x17e68b[_0xa1ba('0x4')],queues[_0x17e68b['uniqueid']][_0xa1ba('0x1f')],_0x17e68b[_0xa1ba('0x2f')],_0x17e68b['connectedlinename']));queues[_0x17e68b[_0xa1ba('0x4')]]['queuecallerleave']=!![];queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x19')]=utils['now']();queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x30')]=utils[_0xa1ba('0x31')](queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x19')],queues[_0x17e68b['uniqueid']][_0xa1ba('0x32')]);queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x12')]=_0x17e68b[_0xa1ba('0x12')];queues[_0x17e68b['uniqueid']][_0xa1ba('0x33')]=_0x17e68b['count'];queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x2f')]=_0x17e68b[_0xa1ba('0x2f')];queues[_0x17e68b[_0xa1ba('0x4')]][_0xa1ba('0x34')]=_0x17e68b[_0xa1ba('0x34')];}}catch(_0x4eebca){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')](_0xa1ba('0x2e'),_0x17e68b['uniqueid']),_0x4eebca);}};exports[_0xa1ba('0x35')]=function(_0x57f850){try{if(!_['isNil'](queues[_0x57f850[_0xa1ba('0x4')]])){utils[_0xa1ba('0xf')](util[_0xa1ba('0x2')]('[%s][queues][agentconnect]',_0x57f850['uniqueid']),_0x57f850);utils['info'](util[_0xa1ba('0x2')](_0xa1ba('0x36'),_0x57f850[_0xa1ba('0x4')],queues[_0x57f850[_0xa1ba('0x4')]]['name'],_0x57f850[_0xa1ba('0x37')],_0x57f850[_0xa1ba('0x38')]));queues[_0x57f850['uniqueid']][_0xa1ba('0x1a')]=![];queues[_0x57f850[_0xa1ba('0x4')]][_0xa1ba('0x1a')]=![];queues[_0x57f850[_0xa1ba('0x4')]][_0xa1ba('0x39')]=null;queues[_0x57f850[_0xa1ba('0x4')]]['queuecallerexit']=![];queues[_0x57f850[_0xa1ba('0x4')]][_0xa1ba('0x9')]=null;queues[_0x57f850[_0xa1ba('0x4')]][_0xa1ba('0x27')]=null;queues[_0x57f850['uniqueid']][_0xa1ba('0x3a')]=!![];queues[_0x57f850['uniqueid']][_0xa1ba('0x8')]=_0x57f850['destaccountcode'];queues[_0x57f850['uniqueid']][_0xa1ba('0x3b')]=_0x57f850['membername'];}}catch(_0x4b1c7b){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')](_0xa1ba('0x3c'),_0x57f850[_0xa1ba('0x4')]),_0x4b1c7b);}};exports[_0xa1ba('0x3d')]=function(_0x214e75){try{if(!_[_0xa1ba('0x18')](queues[_0x214e75[_0xa1ba('0x4')]])){if(queues[_0x214e75['uniqueid']][_0xa1ba('0x19')]){utils[_0xa1ba('0xf')](util[_0xa1ba('0x2')]('[%s][queues][agentcomplete]',_0x214e75[_0xa1ba('0x4')]),_0x214e75);queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x1a')]=![];queues[_0x214e75[_0xa1ba('0x4')]]['queuecallerabandon']=![];queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x39')]=null;queues[_0x214e75[_0xa1ba('0x4')]]['queuecallerexit']=![];queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x27')]=null;queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x3a')]=!![];queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x3b')]=_0x214e75['membername'];queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x3e')]=!![];queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x1c')]=utils[_0xa1ba('0x14')]();if(_0x214e75[_0xa1ba('0x3f')]==_0xa1ba('0x40')){if(!queues[_0x214e75[_0xa1ba('0x4')]]['transfer']){queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x9')]=_0xa1ba('0x41');}}else{queues[_0x214e75[_0xa1ba('0x4')]]['queuecallerexitreason']='COMPLETEDBY'+_0x214e75[_0xa1ba('0x3f')][_0xa1ba('0x25')]();}utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x214e75[_0xa1ba('0x4')],queues[_0x214e75['uniqueid']][_0xa1ba('0x1f')],_0x214e75[_0xa1ba('0x37')],queues[_0x214e75[_0xa1ba('0x4')]][_0xa1ba('0x9')]));writeDB(queues[_0x214e75[_0xa1ba('0x4')]]);}}}catch(_0xc9472f){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')]('[%s][queues][agentcomplete]',_0x214e75[_0xa1ba('0x4')]),_0xc9472f);}};exports[_0xa1ba('0x42')]=function(_0x1c178b){try{if(!_['isNil'](queues[_0x1c178b[_0xa1ba('0x43')]])){utils['debug'](util[_0xa1ba('0x2')]('[%s][queues][blindtransfer]',_0x1c178b[_0xa1ba('0x4')]),_0x1c178b);queues[_0x1c178b[_0xa1ba('0x43')]][_0xa1ba('0x40')]=!![];queues[_0x1c178b[_0xa1ba('0x43')]][_0xa1ba('0x44')]='BLIND';queues[_0x1c178b[_0xa1ba('0x43')]]['transferexten']=_0x1c178b[_0xa1ba('0x45')];queues[_0x1c178b[_0xa1ba('0x43')]][_0xa1ba('0x46')]=_0x1c178b[_0xa1ba('0x43')];queues[_0x1c178b[_0xa1ba('0x43')]][_0xa1ba('0x9')]='BLINDTRANSFER';utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1c178b[_0xa1ba('0x4')],queues[_0x1c178b[_0xa1ba('0x43')]][_0xa1ba('0x1f')],_0x1c178b[_0xa1ba('0x43')],_0x1c178b[_0xa1ba('0x45')]));}}catch(_0x59eae1){utils['error'](util['format'](_0xa1ba('0x47'),_0x1c178b[_0xa1ba('0x4')]),_0x59eae1);}};exports[_0xa1ba('0x48')]=function(_0x30c46d){try{utils['debug'](util[_0xa1ba('0x2')]('[%s][queues][attendedtransfer]',_0x30c46d[_0xa1ba('0x49')]),_0x30c46d);if(_0x30c46d[_0xa1ba('0x49')]==_0x30c46d[_0xa1ba('0x4a')]){if(!_[_0xa1ba('0x18')](queues[_0x30c46d['secondtransfererlinkedid']])){utils[_0xa1ba('0x10')](util['format'](_0xa1ba('0x4b'),_0x30c46d[_0xa1ba('0x49')],queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0x1f')],_0x30c46d[_0xa1ba('0x4d')]));queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0x40')]=!![];queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0x44')]='ATTENDED';queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0x4e')]=_0x30c46d['origtransfererexten'];queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0x46')]=_0x30c46d[_0xa1ba('0x49')];queues[_0x30c46d[_0xa1ba('0x4c')]]['queuecallerexitreason']=_0xa1ba('0x4f');}if(!_[_0xa1ba('0x18')](queues[_0x30c46d[_0xa1ba('0x4a')]])){if(_0x30c46d[_0xa1ba('0x50')]&&queues[_0x30c46d[_0xa1ba('0x50')]]){queues[_0x30c46d[_0xa1ba('0x50')]][_0xa1ba('0x20')]=0x1;queues[_0x30c46d[_0xa1ba('0x43')]]=_[_0xa1ba('0x51')](queues[_0x30c46d['transfereelinkedid']]);queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0xe')]=_0x30c46d[_0xa1ba('0x52')];queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x20')]=0x2;queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x7')]=queues[_0x30c46d[_0xa1ba('0x4c')]]['calleridnum'];queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x53')]=queues[_0x30c46d['secondtransfererlinkedid']]['calleridname'];queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x32')]=utils['now']();queues[_0x30c46d['transfereeuniqueid']][_0xa1ba('0x19')]=utils[_0xa1ba('0x14')]();queues[_0x30c46d[_0xa1ba('0x43')]]['holdtime']=0x0;queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x54')]=0x0;utils[_0xa1ba('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x30c46d['origtransfereruniqueid'],queues[_0x30c46d['transfereeuniqueid']][_0xa1ba('0x1f')],queues[_0x30c46d[_0xa1ba('0x43')]][_0xa1ba('0x7')],queues[_0x30c46d['transfereeuniqueid']][_0xa1ba('0x53')]));}else{utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')](_0xa1ba('0x55'),_0x30c46d['origtransfereruniqueid'],queues[_0x30c46d['origtransfererlinkedid']]['name'],_0x30c46d[_0xa1ba('0x4c')]));queues[_0x30c46d[_0xa1ba('0x4a')]]['transfereduniqueid']=_0x30c46d[_0xa1ba('0x4c')];}}}else if(_0x30c46d[_0xa1ba('0x56')]==_0x30c46d[_0xa1ba('0x4c')]){if(!_['isNil'](queues[_0x30c46d[_0xa1ba('0x4a')]])){utils['info'](util[_0xa1ba('0x2')](_0xa1ba('0x57'),_0x30c46d[_0xa1ba('0x49')],queues[_0x30c46d[_0xa1ba('0x4a')]][_0xa1ba('0x1f')],_0x30c46d['secondtransfereruniqueid'],_0x30c46d['secondtransfererexten']));queues[_0x30c46d[_0xa1ba('0x4a')]]['transfer']=!![];queues[_0x30c46d[_0xa1ba('0x4a')]][_0xa1ba('0x44')]='ATTENDED';queues[_0x30c46d['origtransfererlinkedid']][_0xa1ba('0x4e')]=_0x30c46d[_0xa1ba('0x58')];queues[_0x30c46d['origtransfererlinkedid']][_0xa1ba('0x46')]=_0x30c46d[_0xa1ba('0x56')];queues[_0x30c46d[_0xa1ba('0x4a')]][_0xa1ba('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x30c46d[_0xa1ba('0x4c')]])){if(_0x30c46d[_0xa1ba('0x59')]&&queues[_0x30c46d[_0xa1ba('0x59')]]){queues[_0x30c46d[_0xa1ba('0x59')]][_0xa1ba('0x20')]=0x1;queues[_0x30c46d[_0xa1ba('0x52')]]=_[_0xa1ba('0x51')](queues[_0x30c46d[_0xa1ba('0x59')]]);queues[_0x30c46d[_0xa1ba('0x52')]]['transfereduniqueid']=_0x30c46d[_0xa1ba('0x52')];queues[_0x30c46d['transfertargetuniqueid']][_0xa1ba('0x20')]=0x2;queues[_0x30c46d[_0xa1ba('0x52')]]['calleridnum']=queues[_0x30c46d[_0xa1ba('0x4a')]][_0xa1ba('0x7')];queues[_0x30c46d[_0xa1ba('0x52')]][_0xa1ba('0x53')]=queues[_0x30c46d[_0xa1ba('0x4a')]][_0xa1ba('0x53')];queues[_0x30c46d[_0xa1ba('0x52')]][_0xa1ba('0x32')]=utils[_0xa1ba('0x14')]();queues[_0x30c46d[_0xa1ba('0x52')]]['queuecallerleaveAt']=utils[_0xa1ba('0x14')]();queues[_0x30c46d[_0xa1ba('0x52')]][_0xa1ba('0x30')]=0x0;queues[_0x30c46d[_0xa1ba('0x52')]][_0xa1ba('0x54')]=0x0;utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')](_0xa1ba('0x5a'),_0x30c46d[_0xa1ba('0x49')],queues[_0x30c46d[_0xa1ba('0x52')]][_0xa1ba('0x1f')],queues[_0x30c46d['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x30c46d['transfertargetuniqueid']][_0xa1ba('0x7')],queues[_0x30c46d[_0xa1ba('0x52')]]['calleridname']));}else{utils[_0xa1ba('0x10')](util[_0xa1ba('0x2')](_0xa1ba('0x55'),_0x30c46d['origtransfereruniqueid'],queues[_0x30c46d['secondtransfererlinkedid']][_0xa1ba('0x1f')],_0x30c46d[_0xa1ba('0x4a')]));queues[_0x30c46d[_0xa1ba('0x4c')]][_0xa1ba('0xe')]=_0x30c46d[_0xa1ba('0x4a')];}}}}catch(_0x10fa02){utils[_0xa1ba('0x15')](util[_0xa1ba('0x2')](_0xa1ba('0x5b'),_0x30c46d[_0xa1ba('0x49')]),_0x10fa02);}};exports[_0xa1ba('0x5c')]=function(_0x95ca9){try{if(!_[_0xa1ba('0x18')](queues[_0x95ca9['uniqueid']])){utils[_0xa1ba('0xf')](util[_0xa1ba('0x2')](_0xa1ba('0x5d'),_0x95ca9[_0xa1ba('0x4')]),_0x95ca9);queues[_0x95ca9[_0xa1ba('0x4')]][_0xa1ba('0x5e')]=utils['now']();utils['info'](util[_0xa1ba('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x95ca9[_0xa1ba('0x4')],queues[_0x95ca9['uniqueid']]['name'],queues[_0x95ca9[_0xa1ba('0x4')]]['musiconholdstartAt']));}}catch(_0x5ec0e8){utils['error'](util['format'](_0xa1ba('0x5d'),_0x95ca9[_0xa1ba('0x4')]),_0x5ec0e8);}};exports[_0xa1ba('0x5f')]=function(_0x251b02){try{if(!_[_0xa1ba('0x18')](queues[_0x251b02[_0xa1ba('0x4')]])){if(!_['isNil'](queues[_0x251b02[_0xa1ba('0x4')]][_0xa1ba('0x5e')])){utils[_0xa1ba('0xf')](util[_0xa1ba('0x2')]('[%s][queues][musiconholdstop]',_0x251b02[_0xa1ba('0x4')]),_0x251b02);queues[_0x251b02[_0xa1ba('0x4')]][_0xa1ba('0x54')]+=utils[_0xa1ba('0x31')](utils[_0xa1ba('0x14')](),queues[_0x251b02['uniqueid']][_0xa1ba('0x5e')]);utils[_0xa1ba('0x10')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x251b02[_0xa1ba('0x4')],queues[_0x251b02[_0xa1ba('0x4')]]['name'],queues[_0x251b02['uniqueid']][_0xa1ba('0x54')]));delete queues[_0x251b02[_0xa1ba('0x4')]][_0xa1ba('0x5e')];}}}catch(_0x5e9054){utils[_0xa1ba('0x15')](util['format'](_0xa1ba('0x60'),_0x251b02[_0xa1ba('0x4')]),_0x5e9054);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 59812fb..5f43126 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 _0x41ff=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','info','[%s][recordings][writeDB]','getUserByInternal','accountcode','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]'];(function(_0x1aaa57,_0x3b0b60){var _0x1e33ec=function(_0x450b84){while(--_0x450b84){_0x1aaa57['push'](_0x1aaa57['shift']());}};_0x1e33ec(++_0x3b0b60);}(_0x41ff,0xa1));var _0xf41f=function(_0x401ef9,_0x58ef15){_0x401ef9=_0x401ef9-0x0;var _0x4e20c3=_0x41ff[_0x401ef9];return _0x4e20c3;};'use strict';var _=require(_0xf41f('0x0'));var util=require(_0xf41f('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x33cd3d){utils[_0xf41f('0x2')](util['format'](_0xf41f('0x3'),_0x33cd3d['uniqueid']));if(_0x33cd3d['accountcode']){utils[_0xf41f('0x4')](_0x33cd3d[_0xf41f('0x5')])['then'](function(_0x5bec4b){if(_0x5bec4b){_0x33cd3d['membername']=_0x5bec4b[_0xf41f('0x6')];_0x33cd3d[_0xf41f('0x7')]=_0x5bec4b['id'];}utils['request'](_0xf41f('0x8'),_0x33cd3d);});}else{utils[_0xf41f('0x9')](_0xf41f('0x8'),_0x33cd3d);}}exports[_0xf41f('0xa')]=function(_0x3d795d){try{utils[_0xf41f('0xb')](util['format'](_0xf41f('0xc'),_0x3d795d[_0xf41f('0xd')]),_0x3d795d);if(_0x3d795d[_0xf41f('0xd')]==_0x3d795d[_0xf41f('0xe')]){utils[_0xf41f('0x2')](util[_0xf41f('0xf')](_0xf41f('0x10'),_0x3d795d[_0xf41f('0xd')],_0x3d795d[_0xf41f('0x11')],_0x3d795d[_0xf41f('0x12')]));recordings[_0x3d795d[_0xf41f('0xd')]]={'uniqueid':_0x3d795d['uniqueid'],'accountcode':_0x3d795d[_0xf41f('0x5')],'exten':_0x3d795d['exten'],'context':_0x3d795d[_0xf41f('0x11')],'channel':_0x3d795d[_0xf41f('0x13')],'monitors':[]};}}catch(_0x2be555){utils[_0xf41f('0x14')](util[_0xf41f('0xf')](_0xf41f('0xc'),_0x3d795d[_0xf41f('0xd')]),_0x2be555);}};exports['newstate']=function(_0x4e620e){try{utils['debug'](util[_0xf41f('0xf')](_0xf41f('0x15'),_0x4e620e['uniqueid']),_0x4e620e);if(!_['isNil'](recordings[_0x4e620e[_0xf41f('0xd')]])&&_0x4e620e[_0xf41f('0x16')]==0x6){utils[_0xf41f('0x2')](util[_0xf41f('0xf')](_0xf41f('0x17'),_0x4e620e[_0xf41f('0xd')],_0x4e620e[_0xf41f('0x11')],_0x4e620e[_0xf41f('0x13')]));}else if(!_[_0xf41f('0x18')](recordings[_0x4e620e[_0xf41f('0xe')]])&&_0x4e620e['channelstate']==0x6&&_0x4e620e[_0xf41f('0x11')]!=_0xf41f('0x19')){utils[_0xf41f('0x2')](util[_0xf41f('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4e620e[_0xf41f('0xd')],_0x4e620e[_0xf41f('0xe')],_0x4e620e[_0xf41f('0x11')],_0x4e620e[_0xf41f('0x13')]));recordings[_0x4e620e[_0xf41f('0xe')]]['accountcode']=_0x4e620e[_0xf41f('0x5')];}}catch(_0x3f4af9){utils['error'](util[_0xf41f('0xf')](_0xf41f('0x15'),_0x4e620e[_0xf41f('0xd')]),_0x3f4af9);}};exports[_0xf41f('0x1a')]=function(_0x50cfa){try{if(!_[_0xf41f('0x18')](_0x50cfa[_0xf41f('0x1b')])&&!_[_0xf41f('0x18')](_0x50cfa[_0xf41f('0x1b')][_0xf41f('0x1c')])){utils[_0xf41f('0xb')](util[_0xf41f('0xf')](_0xf41f('0x1d'),_0x50cfa[_0xf41f('0xd')]),_0x50cfa);utils[_0xf41f('0x2')](util['format'](_0xf41f('0x1e'),_0x50cfa[_0xf41f('0xd')],_0x50cfa[_0xf41f('0x1b')],_0x50cfa[_0xf41f('0x1f')]));if(_[_0xf41f('0x20')](_0x50cfa[_0xf41f('0x1f')],_0xf41f('0x21'))){_0x50cfa[_0xf41f('0x1f')]=_0x50cfa['value'][_0xf41f('0x22')](_0xf41f('0x21'),_0xf41f('0x23'));}if(recordings[_0x50cfa[_0xf41f('0xe')]]){var _0x175063=_[_0xf41f('0x24')](recordings[_0x50cfa[_0xf41f('0xe')]][_0xf41f('0x25')],{'value':_0x50cfa[_0xf41f('0x1f')]});if(_[_0xf41f('0x18')](_0x175063)){recordings[_0x50cfa[_0xf41f('0xe')]]['monitors'][_0xf41f('0x26')]({'value':_0x50cfa[_0xf41f('0x1f')]});}}}}catch(_0x230833){utils[_0xf41f('0x14')](util[_0xf41f('0xf')]('[%s][recordings][varset]',_0x50cfa[_0xf41f('0xd')]),_0x230833);}};exports[_0xf41f('0x27')]=function(_0x4933b8){try{if(!_[_0xf41f('0x18')](recordings[_0x4933b8[_0xf41f('0xd')]])){utils[_0xf41f('0xb')](util[_0xf41f('0xf')](_0xf41f('0x28'),_0x4933b8[_0xf41f('0xd')]),_0x4933b8);utils[_0xf41f('0x2')](util[_0xf41f('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4933b8[_0xf41f('0xd')],_0x4933b8[_0xf41f('0x29')],_0x4933b8[_0xf41f('0x2a')],_0x4933b8['cause-txt']));recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x29')]=_0x4933b8[_0xf41f('0x29')];recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2a')]=_0x4933b8[_0xf41f('0x2a')];recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2b')]=_0x4933b8[_0xf41f('0x2b')];recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2c')]=_0x4933b8[_0xf41f('0x2c')];if(recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2d')]=='outbound'&&recordings[_0x4933b8['uniqueid']][_0xf41f('0x5')]){recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2b')]=recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x5')];recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x2c')]='';}recordings[_0x4933b8[_0xf41f('0xd')]][_0xf41f('0x25')][_0xf41f('0x2e')](function(_0x250181){var _0x401eb4=_[_0xf41f('0x2f')](recordings[_0x4933b8['uniqueid']]);_0x401eb4[_0xf41f('0x1f')]=_0x250181[_0xf41f('0x1f')];writeDB(_0x401eb4);});delete recordings[_0x4933b8['uniqueid']];}}catch(_0x2dddcc){utils[_0xf41f('0x14')](util[_0xf41f('0xf')]('[%s][recordings][hangup]',_0x4933b8[_0xf41f('0xd')]),_0x2dddcc);}};exports['newexten']=function(_0x195e9b){try{if(!_['isNil'](recordings[_0x195e9b['uniqueid']])){utils[_0xf41f('0xb')](util[_0xf41f('0xf')](_0xf41f('0x30'),_0x195e9b[_0xf41f('0xd')]),_0x195e9b);utils[_0xf41f('0x2')](util[_0xf41f('0xf')](_0xf41f('0x31'),_0x195e9b[_0xf41f('0xd')],_0x195e9b['application'],_0x195e9b['appdata']));if(_0x195e9b[_0xf41f('0x32')][_0xf41f('0x33')]()==_0xf41f('0x34')&&_[_0xf41f('0x35')](_0x195e9b[_0xf41f('0x36')][_0xf41f('0x33')](),'cdr')){var _0x478d2d=_0x195e9b[_0xf41f('0x36')][_0xf41f('0x37')]('=');var _0x8d88f0=_0x478d2d[0x0][_0xf41f('0x38')](_0x478d2d[0x0][_0xf41f('0x39')]('(')+0x1,_0x478d2d[0x0][_0xf41f('0x39')](')'));var _0x1e68a8=_0x478d2d[0x1];recordings[_0x195e9b[_0xf41f('0xd')]][_0x8d88f0]=_0x1e68a8;}}}catch(_0x199c5c){utils['error'](util['format'](_0xf41f('0x30'),_0x195e9b[_0xf41f('0xd')]),_0x199c5c);}};exports[_0xf41f('0x3a')]=function(_0x15c417){try{if(!_['isNil'](recordings[_0x15c417[_0xf41f('0xd')]])){utils['debug'](util['format'](_0xf41f('0x3b'),_0x15c417[_0xf41f('0xd')]),_0x15c417);utils[_0xf41f('0x2')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x15c417['uniqueid'],_0x15c417['queue']));recordings[_0x15c417[_0xf41f('0xd')]]['queue']=_0x15c417[_0xf41f('0x3c')];}}catch(_0x18edd9){utils[_0xf41f('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x15c417[_0xf41f('0xd')]),_0x18edd9);}}; \ No newline at end of file +var _0xa205=['hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','push'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa205,0x1df));var _0x5a20=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xa205[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x5a20('0x0'));var util=require(_0x5a20('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x233c78){utils[_0x5a20('0x2')](util[_0x5a20('0x3')](_0x5a20('0x4'),_0x233c78[_0x5a20('0x5')]));if(_0x233c78[_0x5a20('0x6')]){utils[_0x5a20('0x7')](_0x233c78['accountcode'])[_0x5a20('0x8')](function(_0x2b50c4){if(_0x2b50c4){_0x233c78[_0x5a20('0x9')]=_0x2b50c4[_0x5a20('0xa')];_0x233c78[_0x5a20('0xb')]=_0x2b50c4['id'];}utils[_0x5a20('0xc')](_0x5a20('0xd'),_0x233c78);});}else{utils['request'](_0x5a20('0xd'),_0x233c78);}}exports[_0x5a20('0xe')]=function(_0x5c0161){try{utils[_0x5a20('0xf')](util[_0x5a20('0x3')](_0x5a20('0x10'),_0x5c0161[_0x5a20('0x5')]),_0x5c0161);if(_0x5c0161[_0x5a20('0x5')]==_0x5c0161[_0x5a20('0x11')]){utils[_0x5a20('0x2')](util[_0x5a20('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5c0161[_0x5a20('0x5')],_0x5c0161[_0x5a20('0x12')],_0x5c0161[_0x5a20('0x13')]));recordings[_0x5c0161[_0x5a20('0x5')]]={'uniqueid':_0x5c0161[_0x5a20('0x5')],'accountcode':_0x5c0161[_0x5a20('0x6')],'exten':_0x5c0161[_0x5a20('0x13')],'context':_0x5c0161['context'],'channel':_0x5c0161[_0x5a20('0x14')],'monitors':[]};}}catch(_0x3df3ea){utils['error'](util[_0x5a20('0x3')](_0x5a20('0x10'),_0x5c0161['uniqueid']),_0x3df3ea);}};exports[_0x5a20('0x15')]=function(_0x44758e){try{utils[_0x5a20('0xf')](util[_0x5a20('0x3')](_0x5a20('0x16'),_0x44758e['uniqueid']),_0x44758e);if(!_[_0x5a20('0x17')](recordings[_0x44758e[_0x5a20('0x5')]])&&_0x44758e[_0x5a20('0x18')]==0x6){utils[_0x5a20('0x2')](util[_0x5a20('0x3')](_0x5a20('0x19'),_0x44758e[_0x5a20('0x5')],_0x44758e[_0x5a20('0x12')],_0x44758e[_0x5a20('0x14')]));}else if(!_[_0x5a20('0x17')](recordings[_0x44758e[_0x5a20('0x11')]])&&_0x44758e[_0x5a20('0x18')]==0x6&&_0x44758e[_0x5a20('0x12')]!=_0x5a20('0x1a')){utils[_0x5a20('0x2')](util['format'](_0x5a20('0x1b'),_0x44758e[_0x5a20('0x5')],_0x44758e['linkedid'],_0x44758e[_0x5a20('0x12')],_0x44758e[_0x5a20('0x14')]));recordings[_0x44758e['linkedid']][_0x5a20('0x6')]=_0x44758e[_0x5a20('0x6')];}}catch(_0x185494){utils[_0x5a20('0x1c')](util[_0x5a20('0x3')]('[%s][recordings][newstate]',_0x44758e[_0x5a20('0x5')]),_0x185494);}};exports[_0x5a20('0x1d')]=function(_0x466645){try{if(!_[_0x5a20('0x17')](_0x466645[_0x5a20('0x1e')])&&!_['isNil'](_0x466645[_0x5a20('0x1e')][_0x5a20('0x1f')])){utils['debug'](util[_0x5a20('0x3')](_0x5a20('0x20'),_0x466645['uniqueid']),_0x466645);utils[_0x5a20('0x2')](util['format'](_0x5a20('0x21'),_0x466645[_0x5a20('0x5')],_0x466645['variable'],_0x466645[_0x5a20('0x22')]));if(_[_0x5a20('0x23')](_0x466645[_0x5a20('0x22')],'.wav49')){_0x466645[_0x5a20('0x22')]=_0x466645[_0x5a20('0x22')][_0x5a20('0x24')](_0x5a20('0x25'),_0x5a20('0x26'));}if(recordings[_0x466645[_0x5a20('0x11')]]){var _0x5199f7=_['find'](recordings[_0x466645['linkedid']]['monitors'],{'value':_0x466645[_0x5a20('0x22')]});if(_['isNil'](_0x5199f7)){recordings[_0x466645[_0x5a20('0x11')]][_0x5a20('0x27')][_0x5a20('0x28')]({'value':_0x466645[_0x5a20('0x22')]});}}}}catch(_0x598c67){utils['error'](util[_0x5a20('0x3')](_0x5a20('0x20'),_0x466645[_0x5a20('0x5')]),_0x598c67);}};exports[_0x5a20('0x29')]=function(_0x1feca4){try{if(!_[_0x5a20('0x17')](recordings[_0x1feca4[_0x5a20('0x5')]])){utils[_0x5a20('0xf')](util[_0x5a20('0x3')]('[%s][recordings][hangup]',_0x1feca4[_0x5a20('0x5')]),_0x1feca4);utils[_0x5a20('0x2')](util['format'](_0x5a20('0x2a'),_0x1feca4[_0x5a20('0x5')],_0x1feca4[_0x5a20('0x2b')],_0x1feca4[_0x5a20('0x2c')],_0x1feca4[_0x5a20('0x2d')]));recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x2b')]=_0x1feca4[_0x5a20('0x2b')];recordings[_0x1feca4[_0x5a20('0x5')]]['calleridname']=_0x1feca4[_0x5a20('0x2c')];recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x2e')]=_0x1feca4[_0x5a20('0x2e')];recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x2f')]=_0x1feca4['connectedlinename'];if(recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x30')]=='outbound'&&recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x6')]){recordings[_0x1feca4['uniqueid']][_0x5a20('0x2e')]=recordings[_0x1feca4['uniqueid']][_0x5a20('0x6')];recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x2f')]='';}recordings[_0x1feca4[_0x5a20('0x5')]][_0x5a20('0x27')][_0x5a20('0x31')](function(_0x259fd5){var _0x6bc8f4=_[_0x5a20('0x32')](recordings[_0x1feca4[_0x5a20('0x5')]]);_0x6bc8f4['value']=_0x259fd5[_0x5a20('0x22')];writeDB(_0x6bc8f4);});delete recordings[_0x1feca4[_0x5a20('0x5')]];}}catch(_0x3556fe){utils['error'](util[_0x5a20('0x3')]('[%s][recordings][hangup]',_0x1feca4[_0x5a20('0x5')]),_0x3556fe);}};exports[_0x5a20('0x33')]=function(_0x2abbe9){try{if(!_[_0x5a20('0x17')](recordings[_0x2abbe9[_0x5a20('0x5')]])){utils[_0x5a20('0xf')](util[_0x5a20('0x3')](_0x5a20('0x34'),_0x2abbe9[_0x5a20('0x5')]),_0x2abbe9);utils[_0x5a20('0x2')](util[_0x5a20('0x3')](_0x5a20('0x35'),_0x2abbe9['uniqueid'],_0x2abbe9['application'],_0x2abbe9['appdata']));if(_0x2abbe9[_0x5a20('0x36')][_0x5a20('0x37')]()==_0x5a20('0x38')&&_[_0x5a20('0x39')](_0x2abbe9['appdata'][_0x5a20('0x37')](),'cdr')){var _0x1b4c32=_0x2abbe9[_0x5a20('0x3a')][_0x5a20('0x3b')]('=');var _0x2abbf5=_0x1b4c32[0x0]['substring'](_0x1b4c32[0x0][_0x5a20('0x3c')]('(')+0x1,_0x1b4c32[0x0]['lastIndexOf'](')'));var _0x4c4313=_0x1b4c32[0x1];recordings[_0x2abbe9['uniqueid']][_0x2abbf5]=_0x4c4313;}}}catch(_0x5be57d){utils['error'](util['format']('[%s][recordings][newexten]',_0x2abbe9[_0x5a20('0x5')]),_0x5be57d);}};exports[_0x5a20('0x3d')]=function(_0x406527){try{if(!_[_0x5a20('0x17')](recordings[_0x406527['uniqueid']])){utils[_0x5a20('0xf')](util['format'](_0x5a20('0x3e'),_0x406527[_0x5a20('0x5')]),_0x406527);utils[_0x5a20('0x2')](util[_0x5a20('0x3')](_0x5a20('0x3f'),_0x406527['uniqueid'],_0x406527[_0x5a20('0x40')]));recordings[_0x406527[_0x5a20('0x5')]]['queue']=_0x406527[_0x5a20('0x40')];}}catch(_0x51c2a5){utils[_0x5a20('0x1c')](util[_0x5a20('0x3')](_0x5a20('0x3e'),_0x406527['uniqueid']),_0x51c2a5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 11299f8..8f51aa1 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 _0xe5aa=['transfereecalleridnum','transfereecalleridname','blind','error','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transferercalleridname'];(function(_0x3e0d09,_0x575da7){var _0x1c129e=function(_0x3accf7){while(--_0x3accf7){_0x3e0d09['push'](_0x3e0d09['shift']());}};_0x1c129e(++_0x575da7);}(_0xe5aa,0x1d2));var _0xae5a=function(_0x3fb709,_0x53e721){_0x3fb709=_0x3fb709-0x0;var _0x29a0ee=_0xe5aa[_0x3fb709];return _0x29a0ee;};'use strict';var _=require(_0xae5a('0x0'));var util=require(_0xae5a('0x1'));var utils=require(_0xae5a('0x2'));function writeDB(_0x37d13f){utils['info'](util[_0xae5a('0x3')](_0xae5a('0x4'),_0x37d13f[_0xae5a('0x5')]==='attended'?_0x37d13f[_0xae5a('0x6')]:_0x37d13f['uniqueid'],_0x37d13f['type']));utils[_0xae5a('0x7')]('CreateVoiceTransferReport',_0x37d13f);}exports[_0xae5a('0x8')]=function(_0x1e4fd8){try{utils[_0xae5a('0x9')](util[_0xae5a('0x3')](_0xae5a('0xa'),_0x1e4fd8[_0xae5a('0xb')]),_0x1e4fd8);utils['info'](util[_0xae5a('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1e4fd8[_0xae5a('0xb')],_0x1e4fd8[_0xae5a('0xc')],_0x1e4fd8[_0xae5a('0xd')],_0x1e4fd8[_0xae5a('0xe')],_0x1e4fd8[_0xae5a('0xf')]));_0x1e4fd8[_0xae5a('0x5')]=_0xae5a('0x10');writeDB(_0x1e4fd8);}catch(_0x198e4b){utils[_0xae5a('0x11')](util[_0xae5a('0x3')](_0xae5a('0xa'),_0x1e4fd8[_0xae5a('0xb')]),_0x198e4b);}};exports['attendedtransfer']=function(_0x3a254b){try{utils[_0xae5a('0x9')](util[_0xae5a('0x3')]('[%s][transfers][attendedtransfer]',_0x3a254b['origtransfereruniqueid']),_0x3a254b);utils[_0xae5a('0x12')](util[_0xae5a('0x3')](_0xae5a('0x13'),_0x3a254b[_0xae5a('0x6')],_0x3a254b[_0xae5a('0x14')],_0x3a254b[_0xae5a('0x15')],_0x3a254b[_0xae5a('0x16')],_0x3a254b[_0xae5a('0x17')]));_0x3a254b=_[_0xae5a('0x18')](_0x3a254b,{'transfererchannel':_0x3a254b[_0xae5a('0x19')],'transferercalleridnum':_0x3a254b[_0xae5a('0x14')],'transferercalleridname':_0x3a254b[_0xae5a('0x15')],'transfererconnectedlinenum':_0x3a254b[_0xae5a('0x1a')],'transfererconnectedlinename':_0x3a254b[_0xae5a('0x1b')],'transfereraccountcode':_0x3a254b['origtransfereraccountcode'],'transferercontext':_0x3a254b[_0xae5a('0x1c')],'transfererexten':_0x3a254b[_0xae5a('0x1d')],'transfererlinkedid':_0x3a254b[_0xae5a('0x1e')],'context':_0x3a254b[_0xae5a('0x1f')],'extension':_0x3a254b['origtransfererexten'],'type':'attended'});if(_[_0xae5a('0x20')](_0x3a254b[_0xae5a('0x21')])){_0x3a254b=_[_0xae5a('0x18')](_0x3a254b,{'transfereechannel':_0x3a254b[_0xae5a('0x22')],'transfereecalleridnum':_0x3a254b[_0xae5a('0x16')],'transfereecalleridname':_0x3a254b[_0xae5a('0x17')],'transfereeconnectedlinenum':_0x3a254b['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3a254b[_0xae5a('0x23')],'transfereeaccountcode':_0x3a254b[_0xae5a('0x24')],'transfereecontext':_0x3a254b[_0xae5a('0x25')],'transfereeexten':_0x3a254b[_0xae5a('0x26')],'transfereelinkedid':_0x3a254b[_0xae5a('0x27')]});}writeDB(_0x3a254b);}catch(_0x4c5964){utils[_0xae5a('0x11')](util[_0xae5a('0x3')]('[%s][transfers][attendedtransfer]',_0x3a254b[_0xae5a('0x6')]),_0x4c5964);}}; \ No newline at end of file +var _0x4801=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','error','attendedtransfer'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x4801,0x95));var _0x1480=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x4801[_0x1b2422];return _0x376573;};'use strict';var _=require(_0x1480('0x0'));var util=require(_0x1480('0x1'));var utils=require('./utils');function writeDB(_0xcb7e7c){utils[_0x1480('0x2')](util[_0x1480('0x3')](_0x1480('0x4'),_0xcb7e7c[_0x1480('0x5')]===_0x1480('0x6')?_0xcb7e7c[_0x1480('0x7')]:_0xcb7e7c[_0x1480('0x8')],_0xcb7e7c[_0x1480('0x5')]));utils[_0x1480('0x9')](_0x1480('0xa'),_0xcb7e7c);}exports['blindtransfer']=function(_0x28fd6a){try{utils[_0x1480('0xb')](util[_0x1480('0x3')](_0x1480('0xc'),_0x28fd6a[_0x1480('0x8')]),_0x28fd6a);utils[_0x1480('0x2')](util['format'](_0x1480('0xd'),_0x28fd6a[_0x1480('0x8')],_0x28fd6a['transferercalleridnum'],_0x28fd6a[_0x1480('0xe')],_0x28fd6a['transfereecalleridnum'],_0x28fd6a[_0x1480('0xf')]));_0x28fd6a[_0x1480('0x5')]=_0x1480('0x10');writeDB(_0x28fd6a);}catch(_0x5d3756){utils[_0x1480('0x11')](util[_0x1480('0x3')](_0x1480('0xc'),_0x28fd6a[_0x1480('0x8')]),_0x5d3756);}};exports[_0x1480('0x12')]=function(_0x5ea73a){try{utils[_0x1480('0xb')](util[_0x1480('0x3')](_0x1480('0x13'),_0x5ea73a[_0x1480('0x7')]),_0x5ea73a);utils[_0x1480('0x2')](util['format'](_0x1480('0x14'),_0x5ea73a['origtransfereruniqueid'],_0x5ea73a[_0x1480('0x15')],_0x5ea73a['origtransferercalleridname'],_0x5ea73a[_0x1480('0x16')],_0x5ea73a[_0x1480('0x17')]));_0x5ea73a=_[_0x1480('0x18')](_0x5ea73a,{'transfererchannel':_0x5ea73a[_0x1480('0x19')],'transferercalleridnum':_0x5ea73a[_0x1480('0x15')],'transferercalleridname':_0x5ea73a[_0x1480('0x1a')],'transfererconnectedlinenum':_0x5ea73a[_0x1480('0x1b')],'transfererconnectedlinename':_0x5ea73a[_0x1480('0x1c')],'transfereraccountcode':_0x5ea73a[_0x1480('0x1d')],'transferercontext':_0x5ea73a[_0x1480('0x1e')],'transfererexten':_0x5ea73a[_0x1480('0x1f')],'transfererlinkedid':_0x5ea73a['origtransfererlinkedid'],'context':_0x5ea73a[_0x1480('0x20')],'extension':_0x5ea73a[_0x1480('0x21')],'type':_0x1480('0x6')});if(_[_0x1480('0x22')](_0x5ea73a[_0x1480('0x23')])){_0x5ea73a=_[_0x1480('0x18')](_0x5ea73a,{'transfereechannel':_0x5ea73a[_0x1480('0x24')],'transfereecalleridnum':_0x5ea73a[_0x1480('0x16')],'transfereecalleridname':_0x5ea73a[_0x1480('0x17')],'transfereeconnectedlinenum':_0x5ea73a[_0x1480('0x25')],'transfereeconnectedlinename':_0x5ea73a['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5ea73a[_0x1480('0x26')],'transfereecontext':_0x5ea73a[_0x1480('0x27')],'transfereeexten':_0x5ea73a[_0x1480('0x28')],'transfereelinkedid':_0x5ea73a[_0x1480('0x29')]});}writeDB(_0x5ea73a);}catch(_0x48b46b){utils[_0x1480('0x11')](util[_0x1480('0x3')]('[%s][transfers][attendedtransfer]',_0x5ea73a[_0x1480('0x7')]),_0x48b46b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b05dc76..30cda15 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 _0xbd03=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[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','GetVoiceQueue','type'];(function(_0x25721f,_0x51b494){var _0xfec92c=function(_0x9e07d8){while(--_0x9e07d8){_0x25721f['push'](_0x25721f['shift']());}};_0xfec92c(++_0x51b494);}(_0xbd03,0xcf));var _0x3bd0=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xbd03[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0x3bd0('0x0'));var jayson=require(_0x3bd0('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x3bd0('0x2')][_0x3bd0('0x3')]({'port':0x2329});var logger=require(_0x3bd0('0x4'))('xdr');exports[_0x3bd0('0x5')]=function(_0x45ce0b,_0x4e6d90){logger[_0x3bd0('0x5')](_0x45ce0b,_0x4e6d90?util[_0x3bd0('0x6')](_0x4e6d90,{'showHidden':![],'depth':null}):'');};exports[_0x3bd0('0x7')]=function(_0x4816c,_0x354b3e){logger['debug'](_0x4816c,_0x354b3e?util['inspect'](_0x354b3e,{'showHidden':![],'depth':null}):'');};exports[_0x3bd0('0x8')]=function(_0xd605e9,_0x3916c4){logger[_0x3bd0('0x8')](_0xd605e9,_0x3916c4?util[_0x3bd0('0x6')](_0x3916c4,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3965d1,_0x1634c){return client[_0x3bd0('0x9')](_0x3965d1,{'body':_0x1634c})[_0x3bd0('0xa')](function(_0x4e370e){logger[_0x3bd0('0x7')](_0x3bd0('0xb'),_0x3965d1,_0x4e370e?util[_0x3bd0('0x6')](_0x4e370e,{'showHidden':![],'depth':null}):'');})[_0x3bd0('0xc')](function(_0x2f22bf){logger[_0x3bd0('0x8')](_0x3bd0('0xb'),_0x3965d1,_0x2f22bf?util['inspect'](_0x2f22bf,{'showHidden':![],'depth':null}):'');});};function getUser(_0x32a299){return client[_0x3bd0('0x9')](_0x3bd0('0xd'),{'options':{'raw':!![],'attributes':['id',_0x3bd0('0xe'),_0x3bd0('0xf'),_0x3bd0('0x10')],'where':_0x32a299,'limit':0x1}})[_0x3bd0('0xa')](function(_0x53e24c){logger[_0x3bd0('0x7')](_0x3bd0('0x11'),JSON['stringify'](_0x32a299),_0x53e24c?util[_0x3bd0('0x6')](_0x53e24c,{'showHidden':![],'depth':null}):'');return _0x53e24c[_0x3bd0('0x12')][_0x3bd0('0x13')]?_0x53e24c[_0x3bd0('0x12')][0x0]:null;});}exports[_0x3bd0('0x14')]=function(_0x51bee5){return new BPromise(function(_0x32a42c,_0xe2a47d){if(_0x51bee5){return getUser({'internal':_0x51bee5})[_0x3bd0('0xa')](function(_0x25343e){logger[_0x3bd0('0x5')](_0x3bd0('0x15'),_0x51bee5,_0x25343e?_0x3bd0('0x16'):_0x3bd0('0x17'));return _0x32a42c(_0x25343e);})[_0x3bd0('0xc')](function(_0xb74267){logger[_0x3bd0('0x8')](_0x3bd0('0x18'),_0xb74267?util[_0x3bd0('0x6')](_0xb74267,{'showHidden':![],'depth':null}):'');return _0x32a42c(null);});}return _0x32a42c(null);});};exports['getUserByInterface']=function(_0x223585){return new BPromise(function(_0x52ec7d,_0x362614){if(_0x223585){return getUser({'interface':_0x223585})[_0x3bd0('0xa')](function(_0x2d2109){logger[_0x3bd0('0x5')](_0x3bd0('0x19'),_0x223585,_0x2d2109?_0x3bd0('0x16'):_0x3bd0('0x17'));return _0x52ec7d(_0x2d2109);})[_0x3bd0('0xc')](function(_0x3151d9){logger[_0x3bd0('0x8')](_0x3bd0('0x1a'),_0x3151d9?util[_0x3bd0('0x6')](_0x3151d9,{'showHidden':![],'depth':null}):'');return _0x52ec7d(null);});}return _0x52ec7d(null);});};exports[_0x3bd0('0x1b')]=function(_0x22933e){return new BPromise(function(_0x2ac56c,_0x1c935b){if(_0x22933e){return getUser({'name':_0x22933e})['then'](function(_0x183430){logger[_0x3bd0('0x5')](_0x3bd0('0x1c'),_0x22933e,_0x183430?_0x3bd0('0x16'):_0x3bd0('0x17'));return _0x2ac56c(_0x183430);})['catch'](function(_0x2c4c77){logger[_0x3bd0('0x8')](_0x3bd0('0x1d'),_0x2c4c77?util[_0x3bd0('0x6')](_0x2c4c77,{'showHidden':![],'depth':null}):'');return _0x2ac56c(null);});}return _0x2ac56c(null);});};exports[_0x3bd0('0x1e')]=function(_0x35960a){return new BPromise(function(_0x1b504d,_0x1d0086){if(_0x35960a){return client[_0x3bd0('0x9')](_0x3bd0('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x3bd0('0xf'),_0x3bd0('0x20'),'acw',_0x3bd0('0x21')],'where':{'name':_0x35960a},'limit':0x1}})[_0x3bd0('0xa')](function(_0x2e6486){logger[_0x3bd0('0x7')](_0x3bd0('0x22'),_0x35960a,_0x2e6486?util[_0x3bd0('0x6')](_0x2e6486,{'showHidden':![],'depth':null}):'');logger['info'](_0x3bd0('0x23'),_0x35960a,_0x2e6486?_0x3bd0('0x16'):_0x3bd0('0x17'));return _0x1b504d(_0x2e6486[_0x3bd0('0x12')][_0x3bd0('0x13')]?_0x2e6486[_0x3bd0('0x12')][0x0]:null);})['catch'](function(_0x5321da){logger[_0x3bd0('0x8')](_0x3bd0('0x24'),_0x5321da?util['inspect'](_0x5321da,{'showHidden':![],'depth':null}):'');return _0x1b504d(null);});}return _0x1b504d(null);});};exports[_0x3bd0('0x25')]=function(_0x55d7d9,_0x21cb43){return moment(_0x55d7d9)['add'](_0x21cb43,_0x3bd0('0x26'))[_0x3bd0('0x27')](_0x3bd0('0x28'));};exports[_0x3bd0('0x29')]=function(_0x10a417,_0x3d6394){return moment(_0x10a417)[_0x3bd0('0x2a')](_0x3d6394,'seconds')['format'](_0x3bd0('0x28'));};exports['diffTime']=function(_0x23388f,_0x4c792e){return moment(_0x23388f)[_0x3bd0('0x2b')](moment(_0x4c792e),_0x3bd0('0x26'));};exports[_0x3bd0('0x2c')]=function(_0x1316c0,_0x56ffb0){return parseInt(_0x1316c0,0xa)+parseInt(_0x56ffb0,0xa);};exports[_0x3bd0('0x2d')]=function(){return moment()[_0x3bd0('0x27')](_0x3bd0('0x28'));};exports[_0x3bd0('0x2e')]=function(_0x3d4a52,_0x91eb19){if(_0x91eb19){return moment(_0x3d4a52)['isAfter'](_0x91eb19);}return!![];};exports[_0x3bd0('0x2f')]=function(_0x17171b,_0x5a9f9b){if(_0x5a9f9b){return moment(_0x17171b)[_0x3bd0('0x2f')](_0x5a9f9b);}else if(_0x17171b){return!![];}return![];}; \ No newline at end of file +var _0x252c=['found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','internal','interface','stringify','result','length','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s'];(function(_0x4f761e,_0x17eb67){var _0xb4a90b=function(_0x527171){while(--_0x527171){_0x4f761e['push'](_0x4f761e['shift']());}};_0xb4a90b(++_0x17eb67);}(_0x252c,0x18e));var _0xc252=function(_0x112665,_0x1d5082){_0x112665=_0x112665-0x0;var _0x4640be=_0x252c[_0x112665];return _0x4640be;};'use strict';var BPromise=require(_0xc252('0x0'));var jayson=require(_0xc252('0x1'));var moment=require(_0xc252('0x2'));var util=require(_0xc252('0x3'));var client=jayson['client'][_0xc252('0x4')]({'port':0x2329});var logger=require(_0xc252('0x5'))(_0xc252('0x6'));exports[_0xc252('0x7')]=function(_0x5071b8,_0x1a9f87){logger[_0xc252('0x7')](_0x5071b8,_0x1a9f87?util[_0xc252('0x8')](_0x1a9f87,{'showHidden':![],'depth':null}):'');};exports[_0xc252('0x9')]=function(_0x1219bf,_0x313f02){logger[_0xc252('0x9')](_0x1219bf,_0x313f02?util[_0xc252('0x8')](_0x313f02,{'showHidden':![],'depth':null}):'');};exports[_0xc252('0xa')]=function(_0x28732a,_0x566de8){logger[_0xc252('0xa')](_0x28732a,_0x566de8?util[_0xc252('0x8')](_0x566de8,{'showHidden':![],'depth':null}):'');};exports[_0xc252('0xb')]=function(_0x2c68bf,_0x2bfb19){return client[_0xc252('0xb')](_0x2c68bf,{'body':_0x2bfb19})['then'](function(_0x27653a){logger['debug'](_0xc252('0xc'),_0x2c68bf,_0x27653a?util[_0xc252('0x8')](_0x27653a,{'showHidden':![],'depth':null}):'');})[_0xc252('0xd')](function(_0x5222e9){logger[_0xc252('0xa')](_0xc252('0xc'),_0x2c68bf,_0x5222e9?util['inspect'](_0x5222e9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x391cb5){return client[_0xc252('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xc252('0xe'),'name',_0xc252('0xf')],'where':_0x391cb5,'limit':0x1}})['then'](function(_0x45f160){logger[_0xc252('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xc252('0x10')](_0x391cb5),_0x45f160?util[_0xc252('0x8')](_0x45f160,{'showHidden':![],'depth':null}):'');return _0x45f160[_0xc252('0x11')][_0xc252('0x12')]?_0x45f160['result'][0x0]:null;});}exports[_0xc252('0x13')]=function(_0x2313ed){return new BPromise(function(_0x2c4ac8,_0x3d3b77){if(_0x2313ed){return getUser({'internal':_0x2313ed})[_0xc252('0x14')](function(_0x29ef5a){logger[_0xc252('0x7')](_0xc252('0x15'),_0x2313ed,_0x29ef5a?'found':_0xc252('0x16'));return _0x2c4ac8(_0x29ef5a);})[_0xc252('0xd')](function(_0x4f16f8){logger['error']('[utils][getUserByInternal]',_0x4f16f8?util['inspect'](_0x4f16f8,{'showHidden':![],'depth':null}):'');return _0x2c4ac8(null);});}return _0x2c4ac8(null);});};exports[_0xc252('0x17')]=function(_0x5bae56){return new BPromise(function(_0x56a877,_0x4e4d46){if(_0x5bae56){return getUser({'interface':_0x5bae56})[_0xc252('0x14')](function(_0x5c4168){logger[_0xc252('0x7')](_0xc252('0x18'),_0x5bae56,_0x5c4168?_0xc252('0x19'):_0xc252('0x16'));return _0x56a877(_0x5c4168);})[_0xc252('0xd')](function(_0x19b2cd){logger[_0xc252('0xa')](_0xc252('0x1a'),_0x19b2cd?util[_0xc252('0x8')](_0x19b2cd,{'showHidden':![],'depth':null}):'');return _0x56a877(null);});}return _0x56a877(null);});};exports[_0xc252('0x1b')]=function(_0xa5f747){return new BPromise(function(_0x1b829f,_0x1aa277){if(_0xa5f747){return getUser({'name':_0xa5f747})[_0xc252('0x14')](function(_0x550320){logger[_0xc252('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0xa5f747,_0x550320?_0xc252('0x19'):_0xc252('0x16'));return _0x1b829f(_0x550320);})[_0xc252('0xd')](function(_0x6b0f7b){logger[_0xc252('0xa')](_0xc252('0x1c'),_0x6b0f7b?util[_0xc252('0x8')](_0x6b0f7b,{'showHidden':![],'depth':null}):'');return _0x1b829f(null);});}return _0x1b829f(null);});};exports[_0xc252('0x1d')]=function(_0x2b8be1){return new BPromise(function(_0x29cae2,_0x52c047){if(_0x2b8be1){return client[_0xc252('0xb')](_0xc252('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xc252('0x1f'),'type',_0xc252('0x20'),_0xc252('0x21')],'where':{'name':_0x2b8be1},'limit':0x1}})[_0xc252('0x14')](function(_0x4c2739){logger[_0xc252('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x2b8be1,_0x4c2739?util[_0xc252('0x8')](_0x4c2739,{'showHidden':![],'depth':null}):'');logger[_0xc252('0x7')](_0xc252('0x22'),_0x2b8be1,_0x4c2739?_0xc252('0x19'):_0xc252('0x16'));return _0x29cae2(_0x4c2739[_0xc252('0x11')]['length']?_0x4c2739[_0xc252('0x11')][0x0]:null);})[_0xc252('0xd')](function(_0x2acda6){logger[_0xc252('0xa')]('[utils][getVoiceQueueByName]',_0x2acda6?util[_0xc252('0x8')](_0x2acda6,{'showHidden':![],'depth':null}):'');return _0x29cae2(null);});}return _0x29cae2(null);});};exports[_0xc252('0x23')]=function(_0x29d6b1,_0x666acf){return moment(_0x29d6b1)[_0xc252('0x24')](_0x666acf,_0xc252('0x25'))[_0xc252('0x26')](_0xc252('0x27'));};exports[_0xc252('0x28')]=function(_0x7f1973,_0x2ff011){return moment(_0x7f1973)[_0xc252('0x29')](_0x2ff011,_0xc252('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc252('0x2a')]=function(_0x1cade1,_0x2d0d37){return moment(_0x1cade1)['diff'](moment(_0x2d0d37),_0xc252('0x25'));};exports[_0xc252('0x2b')]=function(_0xd86b1b,_0x2c7a59){return parseInt(_0xd86b1b,0xa)+parseInt(_0x2c7a59,0xa);};exports[_0xc252('0x2c')]=function(){return moment()['format'](_0xc252('0x27'));};exports[_0xc252('0x2d')]=function(_0x17b954,_0x2f6ef3){if(_0x2f6ef3){return moment(_0x17b954)[_0xc252('0x2d')](_0x2f6ef3);}return!![];};exports[_0xc252('0x2e')]=function(_0xf0b27b,_0x355bcc){if(_0x355bcc){return moment(_0xf0b27b)[_0xc252('0x2e')](_0x355bcc);}else if(_0xf0b27b){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 26ddc99..9deaa2c 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 _0x5e40=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','client','role','ensureDir','catch','then','no-user','timestamp','error','api','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect'];(function(_0x546f1d,_0x3d129b){var _0x5b4368=function(_0x42b973){while(--_0x42b973){_0x546f1d['push'](_0x546f1d['shift']());}};_0x5b4368(++_0x3d129b);}(_0x5e40,0x1ca));var _0x05e4=function(_0x1348c0,_0x7a9608){_0x1348c0=_0x1348c0-0x0;var _0x8a6441=_0x5e40[_0x1348c0];return _0x8a6441;};var fs=require(_0x05e4('0x0'));var _=require(_0x05e4('0x1'));var ewinston=require(_0x05e4('0x2'));var path=require(_0x05e4('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x05e4('0x4')];var safeTemplate=require(_0x05e4('0x5'))[_0x05e4('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x05e4('0x7')];function ClientSideLogger(){function _0x2f0883(_0x35025d){var _0x322a24=path[_0x05e4('0x8')](_0x05e4('0x9'),_0x05e4('0xa'),'xcally');var _0x2babf2=path[_0x05e4('0x8')](_0x05e4('0xb'),_0x35025d[_0x05e4('0xc')]+'-'+_0x35025d['name']);return fs[_0x05e4('0xd')](path['join'](_0x322a24,_0x2babf2))['then'](function(){var _0x4746e1=fileLogger(_0x05e4('0xb'),path[_0x05e4('0x8')](_0x322a24,_0x2babf2));return _0x4746e1;})[_0x05e4('0xe')](function(_0x300639){throw _0x300639;});}this['log']=function(_0x529a82,_0x484d75,_0xce537b,_0x442782){return _0x2f0883(_0x529a82['user'])[_0x05e4('0xf')](function(_0x2eae06){var _0x5ecd45=_0x2eae06[_0x484d75];return _0x5ecd45;})[_0x05e4('0xf')](function(_0xc71f63){var _0x371fc3=_0x529a82['user']?_0x529a82['user']['id']:_0x05e4('0x10');var _0x1544ff=_0x442782['data'];var _0x3ce69b=_0x442782[_0x05e4('0x11')];var _0x4b1950=new Date(Number(_0x3ce69b));return _0xc71f63(_0x371fc3,_0x4b1950,_0xce537b,_0x1544ff);})[_0x05e4('0xe')](function(_0x50b83a){fileLogger(_0x05e4('0xb'))[_0x05e4('0x12')](_0x50b83a);});};}function setupLoggers(_0x3b7348){return new Promise(function(_0x304733){var _0x1236ac=new ClientSideLogger();var _0x50520d=fileLogger(_0x05e4('0x13'));var _0x524cb8=fileLogger('auth');_0x3b7348['set'](_0x05e4('0x14'),_0x1236ac);_0x3b7348[_0x05e4('0x15')](ewinston[_0x05e4('0x16')]({'winstonInstance':_0x50520d,'meta':![],'statusLevels':!![],'msg':function(_0x163621,_0x135391){var _0x10614f=_0x05e4('0x17');if(!_['isEmpty'](_0x163621[_0x05e4('0x18')])){_0x10614f+='\x20body=%s';var _0x3a9985=_0x163621['body'];maskSensitiveData(_0x3a9985);}return safeTemplate(util[_0x05e4('0x19')](_0x10614f,_0x163621[_0x05e4('0x1a')],_0x163621[_0x05e4('0x1b')][_0x05e4('0x1c')]?_0x163621[_0x05e4('0x1b')][_0x05e4('0x1c')]:_0x163621[_0x05e4('0x1d')][_0x05e4('0x1e')]||_0x163621['ip'],_0x163621[_0x05e4('0x1f')],_0x135391[_0x05e4('0x20')],_0x135391[_0x05e4('0x21')],_0x163621[_0x05e4('0x22')]?_0x163621['user']['id']:null,_0x163621[_0x05e4('0x22')]?_0x163621[_0x05e4('0x22')][_0x05e4('0x23')]:null,_0x163621[_0x05e4('0x22')]?_0x163621[_0x05e4('0x22')][_0x05e4('0xc')]:null,_0x3a9985?util[_0x05e4('0x24')](_0x3a9985,![],null):''));}}));_0x3b7348[_0x05e4('0x15')](ewinston['logger']({'winstonInstance':_0x524cb8,'meta':![],'statusLevels':!![],'msg':function(_0x4c7105,_0x36f51a){var _0x1872bb=_0x05e4('0x25');if(_0x4c7105['body']&&_0x4c7105[_0x05e4('0x18')][_0x05e4('0x26')]&&_0x4c7105[_0x05e4('0x18')][_0x05e4('0x27')]){_0x1872bb=_0x05e4('0x28');}return util[_0x05e4('0x19')](_0x1872bb,_0x4c7105[_0x05e4('0x1a')],_0x4c7105[_0x05e4('0x1b')]['x-forwarded-for']?_0x4c7105[_0x05e4('0x1b')][_0x05e4('0x1c')]:_0x4c7105['connection'][_0x05e4('0x1e')]||_0x4c7105['ip'],_0x4c7105[_0x05e4('0x1f')],_0x36f51a['statusCode'],_0x36f51a[_0x05e4('0x21')],_0x4c7105[_0x05e4('0x22')]?_0x4c7105[_0x05e4('0x22')]['id']:null,_0x4c7105['user']?_0x4c7105[_0x05e4('0x22')][_0x05e4('0x23')]:null,_0x4c7105[_0x05e4('0x22')]?_0x4c7105['user'][_0x05e4('0xc')]:null,_0x4c7105[_0x05e4('0x18')]&&_0x4c7105[_0x05e4('0x18')][_0x05e4('0x26')]?_0x4c7105[_0x05e4('0x18')]['device']:_0x05e4('0x29'),_0x4c7105[_0x05e4('0x18')]&&_0x4c7105[_0x05e4('0x18')][_0x05e4('0x27')]?_0x4c7105[_0x05e4('0x18')]['agent_id']:'',_0x4c7105[_0x05e4('0x18')]&&_0x4c7105['body'][_0x05e4('0x2a')]?_0x4c7105['body'][_0x05e4('0x2a')]:'');},'ignoreRoute':function(_0x5eb320){var _0x31d670=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x31d670[_0x05e4('0x2b')](_0x5eb320[_0x05e4('0x1f')]);}}));return _0x304733();});}exports[_0x05e4('0x2c')]=setupLoggers; \ No newline at end of file +var _0xcfbd=['method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','role','other','agent_name','test','setupLoggers','lodash','util','./loggers','fileLogger','./safe-template','safeTemplate','join','/var','log','xcally','client','catch','user','then','no-user','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s'];(function(_0x12f55d,_0x1022e6){var _0x4eb1c3=function(_0x1deb1a){while(--_0x1deb1a){_0x12f55d['push'](_0x12f55d['shift']());}};_0x4eb1c3(++_0x1022e6);}(_0xcfbd,0xf3));var _0xdcfb=function(_0x92830d,_0x2cfbec){_0x92830d=_0x92830d-0x0;var _0x1846e4=_0xcfbd[_0x92830d];return _0x1846e4;};var fs=require('fs-extra');var _=require(_0xdcfb('0x0'));var ewinston=require('express-winston');var path=require('path');var util=require(_0xdcfb('0x1'));var fileLogger=require(_0xdcfb('0x2'))[_0xdcfb('0x3')];var safeTemplate=require(_0xdcfb('0x4'))[_0xdcfb('0x5')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x5b0284(_0xa51068){var _0x542b05=path[_0xdcfb('0x6')](_0xdcfb('0x7'),_0xdcfb('0x8'),_0xdcfb('0x9'));var _0x39ead2=path['join'](_0xdcfb('0xa'),_0xa51068['role']+'-'+_0xa51068['name']);return fs['ensureDir'](path[_0xdcfb('0x6')](_0x542b05,_0x39ead2))['then'](function(){var _0x3c8416=fileLogger('client',path[_0xdcfb('0x6')](_0x542b05,_0x39ead2));return _0x3c8416;})[_0xdcfb('0xb')](function(_0x5f4eb2){throw _0x5f4eb2;});}this[_0xdcfb('0x8')]=function(_0x43423a,_0x1ce76f,_0x14618a,_0x38c750){return _0x5b0284(_0x43423a[_0xdcfb('0xc')])[_0xdcfb('0xd')](function(_0x5b16d8){var _0x437c75=_0x5b16d8[_0x1ce76f];return _0x437c75;})[_0xdcfb('0xd')](function(_0x5a757f){var _0x4b6d82=_0x43423a['user']?_0x43423a['user']['id']:_0xdcfb('0xe');var _0x5b34d7=_0x38c750['data'];var _0x46b81f=_0x38c750[_0xdcfb('0xf')];var _0x5e661b=new Date(Number(_0x46b81f));return _0x5a757f(_0x4b6d82,_0x5e661b,_0x14618a,_0x5b34d7);})[_0xdcfb('0xb')](function(_0x1a8b41){fileLogger(_0xdcfb('0xa'))[_0xdcfb('0x10')](_0x1a8b41);});};}function setupLoggers(_0x48c7a3){return new Promise(function(_0x6a79af){var _0x575d30=new ClientSideLogger();var _0x5b3976=fileLogger(_0xdcfb('0x11'));var _0x3a4bbd=fileLogger(_0xdcfb('0x12'));_0x48c7a3[_0xdcfb('0x13')](_0xdcfb('0x14'),_0x575d30);_0x48c7a3[_0xdcfb('0x15')](ewinston[_0xdcfb('0x16')]({'winstonInstance':_0x5b3976,'meta':![],'statusLevels':!![],'msg':function(_0x28f744,_0x4d1329){var _0x658c85=_0xdcfb('0x17');if(!_[_0xdcfb('0x18')](_0x28f744[_0xdcfb('0x19')])){_0x658c85+=_0xdcfb('0x1a');var _0x569afc=_0x28f744[_0xdcfb('0x19')];maskSensitiveData(_0x569afc);}return safeTemplate(util['format'](_0x658c85,_0x28f744[_0xdcfb('0x1b')],_0x28f744['headers'][_0xdcfb('0x1c')]?_0x28f744[_0xdcfb('0x1d')]['x-forwarded-for']:_0x28f744['connection'][_0xdcfb('0x1e')]||_0x28f744['ip'],_0x28f744[_0xdcfb('0x1f')],_0x4d1329[_0xdcfb('0x20')],_0x4d1329[_0xdcfb('0x21')],_0x28f744[_0xdcfb('0xc')]?_0x28f744[_0xdcfb('0xc')]['id']:null,_0x28f744[_0xdcfb('0xc')]?_0x28f744[_0xdcfb('0xc')][_0xdcfb('0x22')]:null,_0x28f744[_0xdcfb('0xc')]?_0x28f744[_0xdcfb('0xc')]['role']:null,_0x569afc?util[_0xdcfb('0x23')](_0x569afc,![],null):''));}}));_0x48c7a3[_0xdcfb('0x15')](ewinston[_0xdcfb('0x16')]({'winstonInstance':_0x3a4bbd,'meta':![],'statusLevels':!![],'msg':function(_0x2b60da,_0x5341dc){var _0x45bca8=_0xdcfb('0x24');if(_0x2b60da[_0xdcfb('0x19')]&&_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x25')]&&_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x26')]){_0x45bca8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xdcfb('0x27')](_0x45bca8,_0x2b60da[_0xdcfb('0x1b')],_0x2b60da[_0xdcfb('0x1d')][_0xdcfb('0x1c')]?_0x2b60da[_0xdcfb('0x1d')][_0xdcfb('0x1c')]:_0x2b60da['connection']['remoteAddress']||_0x2b60da['ip'],_0x2b60da[_0xdcfb('0x1f')],_0x5341dc['statusCode'],_0x5341dc[_0xdcfb('0x21')],_0x2b60da[_0xdcfb('0xc')]?_0x2b60da[_0xdcfb('0xc')]['id']:null,_0x2b60da[_0xdcfb('0xc')]?_0x2b60da[_0xdcfb('0xc')]['name']:null,_0x2b60da[_0xdcfb('0xc')]?_0x2b60da[_0xdcfb('0xc')][_0xdcfb('0x28')]:null,_0x2b60da['body']&&_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x25')]?_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x25')]:_0xdcfb('0x29'),_0x2b60da[_0xdcfb('0x19')]&&_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x26')]?_0x2b60da['body'][_0xdcfb('0x26')]:'',_0x2b60da[_0xdcfb('0x19')]&&_0x2b60da[_0xdcfb('0x19')][_0xdcfb('0x2a')]?_0x2b60da['body'][_0xdcfb('0x2a')]:'');},'ignoreRoute':function(_0x1a1def){var _0x3d8394=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3d8394[_0xdcfb('0x2b')](_0x1a1def['url']);}}));return _0x6a79af();});}exports[_0xdcfb('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 9f707e7..bf87e1a 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7edb=['daysInMonth','max','min','monthCompare','isMoment','split','padStart','length','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','toLowerCase','indexOf','slice','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','date'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7edb,0x98));var _0xb7ed=function(_0x59a40d,_0x556ddd){_0x59a40d=_0x59a40d-0x0;var _0x17a902=_0x7edb[_0x59a40d];return _0x17a902;};var _=require(_0xb7ed('0x0'));var moment=require(_0xb7ed('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]['map'](function(_0x172293){return _0x172293[_0xb7ed('0x2')];})[_0xb7ed('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb7ed('0x4');var EINVALID_DATE=_0xb7ed('0x5');function throwIfDateNotValid(_0x53da4d){if(!_0x53da4d[_0xb7ed('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1e022d){var _0x49b769=_0x1e022d['split'](':')[_0xb7ed('0x7')](function(_0x1d352d){return parseInt(_0x1d352d,0xa);});var _0xe77532=_0x49b769[0x0];var _0x252e97=_0x49b769[0x1];if(_0xe77532<0x0||_0xe77532>0x17||_0x252e97<0x0||_0x252e97>0x3b){throw new Error(EINVALID_DATE);}return[_0xe77532,_0x252e97];}function circularDoWInterval(_0x5e160e,_0x5bd376){if(_0x5e160e===_0x5bd376){return[_0x5e160e];}else{var _0x5566b0=moment[_0xb7ed('0x8')]();moment[_0xb7ed('0x8')]('en');var _0x3bf182=moment['weekdaysShort']()[_0xb7ed('0x7')](function(_0x80810f){return _0x80810f[_0xb7ed('0x9')]();});moment[_0xb7ed('0x8')](_0x5566b0);var _0xec9641=_0x3bf182[_0xb7ed('0xa')](_0x5e160e);var _0x36f1bb=_0x3bf182[_0xb7ed('0xa')](_0x5bd376);if(_0x36f1bb>_0xec9641){return _0x3bf182[_0xb7ed('0xb')](_0xec9641,_0x36f1bb+0x1);}else{var _0x4bf6a7=_0x3bf182[_0xb7ed('0xb')](0x0,_0x36f1bb+0x1);var _0x209cbc=_0x3bf182['slice'](_0xec9641);return _0x209cbc[_0xb7ed('0xc')](_0x4bf6a7);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x240541,_0x59f679){if(_0x240541===_0x59f679){return[_0x240541];}else{var _0x3c3fe1=moment[_0xb7ed('0x8')]();moment['locale']('en');var _0x370e87=moment['monthsShort']()[_0xb7ed('0x7')](function(_0x382314){return _0x382314[_0xb7ed('0x9')]();});moment[_0xb7ed('0x8')](_0x3c3fe1);var _0x1956f6=_0x370e87[_0xb7ed('0xa')](_0x240541);var _0x3468b1=_0x370e87[_0xb7ed('0xa')](_0x59f679);if(_0x3468b1>_0x1956f6){return _0x370e87[_0xb7ed('0xb')](_0x1956f6,_0x3468b1+0x1);}else{var _0x408646=_0x370e87['slice'](0x0,_0x3468b1+0x1);var _0x26cad4=_0x370e87[_0xb7ed('0xb')](_0x1956f6);return _0x26cad4['concat'](_0x408646);}}}module[_0xb7ed('0xd')][_0xb7ed('0xe')]=circularMonthInterval;function parseDom(_0x5e39f8){var _0x54de28=parseInt(_0x5e39f8,0xa);if(_0x54de28<0x1||_0x54de28>0x1f){throw new Error(EINVALID_DATE);}return _0x54de28;}function timeCompare(_0x144f9c,_0x53d73a,_0x38e68c){var _0x74942b=_0x144f9c[_0xb7ed('0xf')]();var _0xb496af=extractTime(_0x53d73a);var _0x371638=_0xb496af[0x0];var _0x2ae73e=_0xb496af[0x1];var _0xa8b148=_0x144f9c[_0xb7ed('0xf')]()[_0xb7ed('0x10')](_0x371638)[_0xb7ed('0x11')](_0x2ae73e);throwIfDateNotValid(_0xa8b148);var _0x3d3bff=extractTime(_0x38e68c);var _0x20f445=_0x3d3bff[0x0];var _0x5df865=_0x3d3bff[0x1];var _0x1f3caa=_0x144f9c[_0xb7ed('0xf')]()['hours'](_0x20f445)[_0xb7ed('0x11')](_0x5df865);throwIfDateNotValid(_0x1f3caa);if(_0x1f3caa[_0xb7ed('0x12')](_0xa8b148)){var _0xd4b1ee=_0x74942b[_0xb7ed('0xf')]()[_0xb7ed('0x13')](_0xb7ed('0x14'));var _0x22c08e=_0x74942b[_0xb7ed('0xf')]()[_0xb7ed('0x15')](_0xb7ed('0x14'));return _0x74942b['isBetween'](_0xa8b148,_0x22c08e,undefined,'[]')||_0x74942b[_0xb7ed('0x16')](_0xd4b1ee,_0x1f3caa,undefined,'[]');}else{return _0x74942b[_0xb7ed('0x16')](_0xa8b148,_0x1f3caa,undefined,'[]');}}module['exports'][_0xb7ed('0x17')]=timeCompare;function dowCompare(_0x2e2760,_0x345ac6,_0x4c1bc6){var _0x21bc6a=_0x2e2760[_0xb7ed('0x8')]('en')[_0xb7ed('0x18')]('ddd')[_0xb7ed('0x9')]();return circularDoWInterval(_0x345ac6,_0x4c1bc6)[_0xb7ed('0x19')](_0x21bc6a);}module[_0xb7ed('0xd')][_0xb7ed('0x1a')]=dowCompare;function domCompare(_0x568470,_0x588844,_0x4575d8){var _0x17a734=_0x568470[_0xb7ed('0x1b')]();if(_0x588844===_0x4575d8){return _0x17a734===_0x588844;}else{var _0x50b975=_0x568470[_0xb7ed('0x1c')]();var _0x511a4d=_0x588844<_0x4575d8;let _0x1e3aaa=![];var _0x75a052=0x0;var _0x5d72fb=0x0;if(_0x511a4d){_0x75a052=Math[_0xb7ed('0x1d')](0x1,_0x588844);_0x5d72fb=Math[_0xb7ed('0x1e')](_0x4575d8,_0x50b975);_0x1e3aaa=_0x17a734>=_0x75a052&&_0x17a734<=_0x5d72fb;}else{_0x75a052=Math['min'](_0x588844,_0x50b975);_0x5d72fb=Math['max'](0x1,_0x4575d8);_0x1e3aaa=_0x17a734>=_0x75a052||_0x17a734<=_0x5d72fb;}return _0x1e3aaa;}}module[_0xb7ed('0xd')]['domCompare']=domCompare;function monthCompare(_0x4da1cc,_0x2e9dee,_0x184d14){var _0x486ba4=_0x4da1cc[_0xb7ed('0x8')]('en')[_0xb7ed('0x18')]('MMM')[_0xb7ed('0x9')]();return circularMonthInterval(_0x2e9dee,_0x184d14)['includes'](_0x486ba4);}module['exports'][_0xb7ed('0x1f')]=monthCompare;function iftime(_0x2510e5,_0x2140ad=moment['tz']['guess'](),_0x138da7=moment()){if(!validateRx['test'](_0x2510e5)){throw new Error(EINVALID_STRING);}else{var _0x1e83a4=(moment[_0xb7ed('0x20')](_0x138da7)?_0x138da7[_0xb7ed('0xf')]():moment(_0x138da7))['tz'](_0x2140ad)[_0xb7ed('0x8')]('en');throwIfDateNotValid(_0x1e83a4);var _0x1c2c0c=_0x2510e5['split'](',');var _0x5251c3=_0x1c2c0c[0x0];var _0x52a759=_0x1c2c0c[0x1];var _0x7fe8b4=_0x1c2c0c[0x2];var _0x5c3222=_0x1c2c0c[0x3];let _0x183bc3=!![];if(_0x5251c3!=='*'){var _0x53136f=_0x5251c3[_0xb7ed('0x21')]('-');var _0x25710f=_[_0xb7ed('0x22')](_0x53136f[0x0],0x5,'0');var _0x23286b=_0x53136f[_0xb7ed('0x23')]===0x2?_[_0xb7ed('0x22')](_0x53136f[0x1],0x5,'0'):_0x25710f;_0x183bc3=timeCompare(_0x1e83a4,_0x25710f,_0x23286b);}let _0x5d9f20=!![];if(_0x52a759!=='*'){var _0x5c7255=_0x52a759[_0xb7ed('0x21')]('-');var _0x409501=_0x5c7255[0x0];var _0x726590=_0x5c7255[_0xb7ed('0x23')]===0x2?_0x5c7255[0x1]:_0x409501;_0x5d9f20=dowCompare(_0x1e83a4,_0x409501,_0x726590);}let _0x44d95d=!![];if(_0x7fe8b4!=='*'){var _0x3cebcf=_0x7fe8b4[_0xb7ed('0x21')]('-');var _0x53eb76=parseDom(_0x3cebcf[0x0]);var _0x226caf=_0x3cebcf['length']===0x2?parseDom(_0x3cebcf[0x1]):_0x53eb76;_0x44d95d=domCompare(_0x1e83a4,_0x53eb76,_0x226caf);}let _0x4861f6=!![];if(_0x5c3222!=='*'){var _0xb700b8=_0x5c3222['split']('-');var _0x376573=_0xb700b8[0x0];var _0x2e5db0=_0xb700b8[_0xb7ed('0x23')]===0x2?_0xb700b8[0x1]:_0xb700b8[0x0];_0x4861f6=monthCompare(_0x1e83a4,_0x376573,_0x2e5db0);}return _0x183bc3&&_0x5d9f20&&_0x44d95d&&_0x4861f6;}}module[_0xb7ed('0xd')]['iftime']=iftime; \ No newline at end of file +var _0x8778=['exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat'];(function(_0x4d69a0,_0x4558f0){var _0xf8e50d=function(_0x565436){while(--_0x565436){_0x4d69a0['push'](_0x4d69a0['shift']());}};_0xf8e50d(++_0x4558f0);}(_0x8778,0x6e));var _0x8877=function(_0x40ce86,_0xdcc0b2){_0x40ce86=_0x40ce86-0x0;var _0x5d4286=_0x8778[_0x40ce86];return _0x5d4286;};var _=require(_0x8877('0x0'));var moment=require(_0x8877('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][_0x8877('0x2')](function(_0x358e89){return _0x358e89['source'];})[_0x8877('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x8877('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x1a10ed){if(!_0x1a10ed[_0x8877('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x49cf19){var _0x546aa3=_0x49cf19[_0x8877('0x6')](':')[_0x8877('0x2')](function(_0x4b0305){return parseInt(_0x4b0305,0xa);});var _0x52c429=_0x546aa3[0x0];var _0x68ea11=_0x546aa3[0x1];if(_0x52c429<0x0||_0x52c429>0x17||_0x68ea11<0x0||_0x68ea11>0x3b){throw new Error(EINVALID_DATE);}return[_0x52c429,_0x68ea11];}function circularDoWInterval(_0x45a5d8,_0x39aac2){if(_0x45a5d8===_0x39aac2){return[_0x45a5d8];}else{var _0x2d1f4c=moment[_0x8877('0x7')]();moment[_0x8877('0x7')]('en');var _0x4f67bc=moment[_0x8877('0x8')]()[_0x8877('0x2')](function(_0x5d4844){return _0x5d4844[_0x8877('0x9')]();});moment[_0x8877('0x7')](_0x2d1f4c);var _0x2530ff=_0x4f67bc[_0x8877('0xa')](_0x45a5d8);var _0x152bd3=_0x4f67bc[_0x8877('0xa')](_0x39aac2);if(_0x152bd3>_0x2530ff){return _0x4f67bc[_0x8877('0xb')](_0x2530ff,_0x152bd3+0x1);}else{var _0x3befd=_0x4f67bc[_0x8877('0xb')](0x0,_0x152bd3+0x1);var _0x416bf7=_0x4f67bc[_0x8877('0xb')](_0x2530ff);return _0x416bf7[_0x8877('0xc')](_0x3befd);}}}module[_0x8877('0xd')][_0x8877('0xe')]=circularDoWInterval;function circularMonthInterval(_0x748857,_0x463383){if(_0x748857===_0x463383){return[_0x748857];}else{var _0x5465a9=moment[_0x8877('0x7')]();moment[_0x8877('0x7')]('en');var _0x5cb766=moment[_0x8877('0xf')]()[_0x8877('0x2')](function(_0xdd40dd){return _0xdd40dd[_0x8877('0x9')]();});moment[_0x8877('0x7')](_0x5465a9);var _0x3d2e15=_0x5cb766['indexOf'](_0x748857);var _0x5c9ac6=_0x5cb766[_0x8877('0xa')](_0x463383);if(_0x5c9ac6>_0x3d2e15){return _0x5cb766[_0x8877('0xb')](_0x3d2e15,_0x5c9ac6+0x1);}else{var _0x324c47=_0x5cb766['slice'](0x0,_0x5c9ac6+0x1);var _0xc705f6=_0x5cb766[_0x8877('0xb')](_0x3d2e15);return _0xc705f6['concat'](_0x324c47);}}}module[_0x8877('0xd')][_0x8877('0x10')]=circularMonthInterval;function parseDom(_0x347372){var _0x7b82ac=parseInt(_0x347372,0xa);if(_0x7b82ac<0x1||_0x7b82ac>0x1f){throw new Error(EINVALID_DATE);}return _0x7b82ac;}function timeCompare(_0x3a79ef,_0x240e0c,_0x188c60){var _0x3d4bdd=_0x3a79ef[_0x8877('0x11')]();var _0x978865=extractTime(_0x240e0c);var _0x23d886=_0x978865[0x0];var _0x5b4fba=_0x978865[0x1];var _0x263603=_0x3a79ef[_0x8877('0x11')]()[_0x8877('0x12')](_0x23d886)[_0x8877('0x13')](_0x5b4fba);throwIfDateNotValid(_0x263603);var _0x54f20b=extractTime(_0x188c60);var _0x3a49b1=_0x54f20b[0x0];var _0x490d60=_0x54f20b[0x1];var _0x3f2818=_0x3a79ef[_0x8877('0x11')]()[_0x8877('0x12')](_0x3a49b1)['minutes'](_0x490d60);throwIfDateNotValid(_0x3f2818);if(_0x3f2818[_0x8877('0x14')](_0x263603)){var _0x4defcd=_0x3d4bdd[_0x8877('0x11')]()[_0x8877('0x15')](_0x8877('0x16'));var _0x254c7a=_0x3d4bdd[_0x8877('0x11')]()[_0x8877('0x17')]('day');return _0x3d4bdd[_0x8877('0x18')](_0x263603,_0x254c7a,undefined,'[]')||_0x3d4bdd['isBetween'](_0x4defcd,_0x3f2818,undefined,'[]');}else{return _0x3d4bdd[_0x8877('0x18')](_0x263603,_0x3f2818,undefined,'[]');}}module[_0x8877('0xd')][_0x8877('0x19')]=timeCompare;function dowCompare(_0x337b87,_0x5672cb,_0x2f644a){var _0x41b3b7=_0x337b87[_0x8877('0x7')]('en')[_0x8877('0x1a')]('ddd')[_0x8877('0x9')]();return circularDoWInterval(_0x5672cb,_0x2f644a)[_0x8877('0x1b')](_0x41b3b7);}module[_0x8877('0xd')][_0x8877('0x1c')]=dowCompare;function domCompare(_0x5a3e68,_0x3c9f42,_0x2db69d){var _0x28cac6=_0x5a3e68[_0x8877('0x1d')]();if(_0x3c9f42===_0x2db69d){return _0x28cac6===_0x3c9f42;}else{var _0x4dfd8a=_0x5a3e68[_0x8877('0x1e')]();var _0x5303a2=_0x3c9f42<_0x2db69d;let _0x43560d=![];var _0xcc970=0x0;var _0x179710=0x0;if(_0x5303a2){_0xcc970=Math[_0x8877('0x1f')](0x1,_0x3c9f42);_0x179710=Math[_0x8877('0x20')](_0x2db69d,_0x4dfd8a);_0x43560d=_0x28cac6>=_0xcc970&&_0x28cac6<=_0x179710;}else{_0xcc970=Math[_0x8877('0x20')](_0x3c9f42,_0x4dfd8a);_0x179710=Math[_0x8877('0x1f')](0x1,_0x2db69d);_0x43560d=_0x28cac6>=_0xcc970||_0x28cac6<=_0x179710;}return _0x43560d;}}module[_0x8877('0xd')][_0x8877('0x21')]=domCompare;function monthCompare(_0x2d3420,_0x2327c8,_0x257471){var _0x1b736d=_0x2d3420[_0x8877('0x7')]('en')[_0x8877('0x1a')]('MMM')[_0x8877('0x9')]();return circularMonthInterval(_0x2327c8,_0x257471)[_0x8877('0x1b')](_0x1b736d);}module[_0x8877('0xd')][_0x8877('0x22')]=monthCompare;function iftime(_0x305672,_0x298592=moment['tz'][_0x8877('0x23')](),_0x125c01=moment()){if(!validateRx[_0x8877('0x24')](_0x305672)){throw new Error(EINVALID_STRING);}else{var _0x414a2a=(moment[_0x8877('0x25')](_0x125c01)?_0x125c01[_0x8877('0x11')]():moment(_0x125c01))['tz'](_0x298592)['locale']('en');throwIfDateNotValid(_0x414a2a);var _0x335fe3=_0x305672[_0x8877('0x6')](',');var _0x5eb52a=_0x335fe3[0x0];var _0x4de6c8=_0x335fe3[0x1];var _0x1b447d=_0x335fe3[0x2];var _0x25671f=_0x335fe3[0x3];let _0x469294=!![];if(_0x5eb52a!=='*'){var _0x3c722b=_0x5eb52a[_0x8877('0x6')]('-');var _0x4141a4=_[_0x8877('0x26')](_0x3c722b[0x0],0x5,'0');var _0x268877=_0x3c722b[_0x8877('0x27')]===0x2?_[_0x8877('0x26')](_0x3c722b[0x1],0x5,'0'):_0x4141a4;_0x469294=timeCompare(_0x414a2a,_0x4141a4,_0x268877);}let _0xee8a0b=!![];if(_0x4de6c8!=='*'){var _0x82ee98=_0x4de6c8['split']('-');var _0x11d137=_0x82ee98[0x0];var _0x5e7bc0=_0x82ee98[_0x8877('0x27')]===0x2?_0x82ee98[0x1]:_0x11d137;_0xee8a0b=dowCompare(_0x414a2a,_0x11d137,_0x5e7bc0);}let _0x1b9d4a=!![];if(_0x1b447d!=='*'){var _0x557c71=_0x1b447d[_0x8877('0x6')]('-');var _0x41d49d=parseDom(_0x557c71[0x0]);var _0x49631f=_0x557c71[_0x8877('0x27')]===0x2?parseDom(_0x557c71[0x1]):_0x41d49d;_0x1b9d4a=domCompare(_0x414a2a,_0x41d49d,_0x49631f);}let _0x2f173d=!![];if(_0x25671f!=='*'){var _0x59a9d5=_0x25671f[_0x8877('0x6')]('-');var _0x465e9d=_0x59a9d5[0x0];var _0xb762db=_0x59a9d5['length']===0x2?_0x59a9d5[0x1]:_0x59a9d5[0x0];_0x2f173d=monthCompare(_0x414a2a,_0x465e9d,_0xb762db);}return _0x469294&&_0xee8a0b&&_0x1b9d4a&&_0x2f173d;}}module[_0x8877('0xd')][_0x8877('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 07c2eb7..30b8783 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebf5=['bold\x20white','bold\x20green','gray','bold\x20blue','addColors','/var/log/xcally','join','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','Logger','%s-%s','error','File','warn','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white'];(function(_0x4fcd34,_0x419eb4){var _0x34f026=function(_0x17726b){while(--_0x17726b){_0x4fcd34['push'](_0x4fcd34['shift']());}};_0x34f026(++_0x419eb4);}(_0xebf5,0x95));var _0x5ebf=function(_0x1158d5,_0x4e7ee8){_0x1158d5=_0x1158d5-0x0;var _0x3e9d61=_0xebf5[_0x1158d5];return _0x3e9d61;};'use strict';var path=require(_0x5ebf('0x0'));var util=require(_0x5ebf('0x1'));var moment=require(_0x5ebf('0x2'));var winston=require(_0x5ebf('0x3'));var config=require('../config/environment');var debugLevel=config[_0x5ebf('0x4')]?config[_0x5ebf('0x4')][_0x5ebf('0x5')]():_0x5ebf('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':_0x5ebf('0x7'),'error':_0x5ebf('0x8'),'warn':_0x5ebf('0x9'),'info':_0x5ebf('0xa'),'print':_0x5ebf('0xb'),'success':_0x5ebf('0xc'),'http':_0x5ebf('0xd'),'verbose':'bold\x20magenta','debug':_0x5ebf('0xe'),'silly':'bold\x20cyan'};winston[_0x5ebf('0xf')](XC_LOG_COLORS);function getLogFileName(_0x207569,_0x566c98,_0x28eac7){var _0x4d4cac=_0x207569||_0x5ebf('0x10');return path[_0x5ebf('0x11')](_0x4d4cac,util['format']('%s-%s.log',_0x566c98,_0x28eac7));}function formatter(_0x564170,_0xac1e94){_0xac1e94[_0x5ebf('0x12')]=_0xac1e94[_0x5ebf('0x12')][_0x5ebf('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x5ebf('0x14'))[_0x5ebf('0x13')](/@{/g,'{{')[_0x5ebf('0x13')](/}@/g,'}}');return util[_0x5ebf('0x15')](_0x5ebf('0x16'),moment()['format'](_0x5ebf('0x17')),_0xac1e94[_0x5ebf('0x18')][_0x5ebf('0x19')](),_0x564170,_0xac1e94[_0x5ebf('0x12')]);}function fileFormat(_0x1eb475,_0xd8091d){_0xd8091d[_0x5ebf('0x12')]=_0xd8091d[_0x5ebf('0x12')][_0x5ebf('0x13')](/@@{/g,'{{{')[_0x5ebf('0x13')](/}@@/g,'}}}')[_0x5ebf('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x356358=_0xd8091d[_0x5ebf('0x1a')]&&Object[_0x5ebf('0x1b')](_0xd8091d[_0x5ebf('0x1a')])[_0x5ebf('0x1c')]?'\x0a\x09'+JSON[_0x5ebf('0x1d')](_0xd8091d[_0x5ebf('0x1a')]):'';return util['format'](_0x5ebf('0x1e'),moment()[_0x5ebf('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),_0xd8091d['level'][_0x5ebf('0x19')](),_0x1eb475,_0xd8091d[_0x5ebf('0x12')],_0x356358);}function consoleLogger(){var _0x1634dd=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ebf('0x1f'))][(_0x5ebf('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3955c9){return formatter('',_0x3955c9);}})]});return _0x1634dd;}function fileLogger(_0x400ddd,_0x4eab3c){var _0x108548=new winston[(_0x5ebf('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5ebf('0x1f'))]['File']({'name':util['format'](_0x5ebf('0x22'),_0x400ddd,_0x5ebf('0x23')),'filename':getLogFileName(_0x4eab3c,_0x400ddd,_0x5ebf('0x23')),'level':_0x5ebf('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5543ba){return fileFormat(_0x400ddd,_0x5543ba);}}),new winston['transports'][(_0x5ebf('0x24'))]({'name':util['format'](_0x5ebf('0x22'),_0x400ddd,debugLevel),'filename':getLogFileName(_0x4eab3c,_0x400ddd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5005bf){return fileFormat(_0x400ddd,_0x5005bf);}}),new winston[(_0x5ebf('0x1f'))]['Console']({'level':_0x5ebf('0x25'),'json':![],'formatter':function(_0x61fa40){return fileFormat(_0x400ddd,_0x61fa40);}})]});return _0x108548;}exports[_0x5ebf('0x26')]=consoleLogger;exports[_0x5ebf('0x27')]=fileLogger; \ No newline at end of file +var _0x05c8=['bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','File','%s-%s','error','transports','warn','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','red','bold\x20yellow','white'];(function(_0x5ac821,_0x54cd3e){var _0x9e410a=function(_0x1757a9){while(--_0x1757a9){_0x5ac821['push'](_0x5ac821['shift']());}};_0x9e410a(++_0x54cd3e);}(_0x05c8,0x1ae));var _0x805c=function(_0x4412d,_0x5aab56){_0x4412d=_0x4412d-0x0;var _0x527974=_0x05c8[_0x4412d];return _0x527974;};'use strict';var path=require(_0x805c('0x0'));var util=require(_0x805c('0x1'));var moment=require(_0x805c('0x2'));var winston=require(_0x805c('0x3'));var config=require('../config/environment');var debugLevel=config[_0x805c('0x4')]?config[_0x805c('0x4')][_0x805c('0x5')]():_0x805c('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':_0x805c('0x7'),'warn':_0x805c('0x8'),'info':_0x805c('0x9'),'print':_0x805c('0xa'),'success':_0x805c('0xb'),'http':_0x805c('0xc'),'verbose':_0x805c('0xd'),'debug':_0x805c('0xe'),'silly':'bold\x20cyan'};winston[_0x805c('0xf')](XC_LOG_COLORS);function getLogFileName(_0x21af49,_0x1be868,_0x49c16b){var _0x8178ee=_0x21af49||_0x805c('0x10');return path[_0x805c('0x11')](_0x8178ee,util[_0x805c('0x12')](_0x805c('0x13'),_0x1be868,_0x49c16b));}function formatter(_0x422e98,_0x46d4f2){_0x46d4f2[_0x805c('0x14')]=_0x46d4f2[_0x805c('0x14')][_0x805c('0x15')](/@@{/g,_0x805c('0x16'))['replace'](/}@@/g,'}}}')[_0x805c('0x15')](/@{/g,'{{')[_0x805c('0x15')](/}@/g,'}}');return util[_0x805c('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x805c('0x12')](_0x805c('0x17')),_0x46d4f2[_0x805c('0x18')][_0x805c('0x19')](),_0x422e98,_0x46d4f2[_0x805c('0x14')]);}function fileFormat(_0x183506,_0x372fab){_0x372fab[_0x805c('0x14')]=_0x372fab[_0x805c('0x14')][_0x805c('0x15')](/@@{/g,'{{{')[_0x805c('0x15')](/}@@/g,_0x805c('0x1a'))[_0x805c('0x15')](/@{/g,'{{')[_0x805c('0x15')](/}@/g,'}}');var _0x1fb9e1=_0x372fab[_0x805c('0x1b')]&&Object[_0x805c('0x1c')](_0x372fab['meta'])['length']?'\x0a\x09'+JSON[_0x805c('0x1d')](_0x372fab[_0x805c('0x1b')]):'';return util[_0x805c('0x12')](_0x805c('0x1e'),moment()[_0x805c('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x372fab['level'][_0x805c('0x19')](),_0x183506,_0x372fab[_0x805c('0x14')],_0x1fb9e1);}function consoleLogger(){var _0x1f158c=new winston[(_0x805c('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x805c('0x20'))]({'level':'warn','json':![],'formatter':function(_0x2c2eca){return formatter('',_0x2c2eca);}})]});return _0x1f158c;}function fileLogger(_0x132256,_0x3d6a45){var _0x393711=new winston[(_0x805c('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x805c('0x21'))]({'name':util['format'](_0x805c('0x22'),_0x132256,_0x805c('0x23')),'filename':getLogFileName(_0x3d6a45,_0x132256,'error'),'level':_0x805c('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1cb663){return fileFormat(_0x132256,_0x1cb663);}}),new winston[(_0x805c('0x24'))]['File']({'name':util[_0x805c('0x12')](_0x805c('0x22'),_0x132256,debugLevel),'filename':getLogFileName(_0x3d6a45,_0x132256,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x102d8e){return fileFormat(_0x132256,_0x102d8e);}}),new winston[(_0x805c('0x24'))][(_0x805c('0x20'))]({'level':_0x805c('0x25'),'json':![],'formatter':function(_0x12bac7){return fileFormat(_0x132256,_0x12bac7);}})]});return _0x393711;}exports[_0x805c('0x26')]=consoleLogger;exports[_0x805c('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ab77ca3..9805159 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x13f6c5,_0x5945c6){var _0x305269=function(_0x3b6ea9){while(--_0x3b6ea9){_0x13f6c5['push'](_0x13f6c5['shift']());}};_0x305269(++_0x5945c6);}(_0xadb5,0xad));var _0x5adb=function(_0x114282,_0x431bf4){_0x114282=_0x114282-0x0;var _0x484632=_0xadb5[_0x114282];return _0x484632;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x0295,0x1f0));var _0x5029=function(_0x4c4d6d,_0x10ac62){_0x4c4d6d=_0x4c4d6d-0x0;var _0x4eacef=_0x0295[_0x4c4d6d];return _0x4eacef;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 2d3c981..b2020a1 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','replace','\x5c$&'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x5fab,0x177));var _0xb5fa=function(_0x345ed1,_0x37c0b){_0x345ed1=_0x345ed1-0x0;var _0x5d5f7a=_0x5fab[_0x345ed1];return _0x5d5f7a;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file +var _0x66fa=['exports','replace','\x5c$&'];(function(_0xe9a967,_0x4e6bdd){var _0xe948a5=function(_0x5e2677){while(--_0x5e2677){_0xe9a967['push'](_0xe9a967['shift']());}};_0xe948a5(++_0x4e6bdd);}(_0x66fa,0x117));var _0xa66f=function(_0x16898b,_0x12f863){_0x16898b=_0x16898b-0x0;var _0x201cfc=_0x66fa[_0x16898b];return _0x201cfc;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 4e17b1b..d598c26 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 _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file +var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2032,0xd9));var _0x2203=function(_0xd393bd,_0x43fa2e){_0xd393bd=_0xd393bd-0x0;var _0x585870=_0x2032[_0xd393bd];return _0x585870;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 460e21f..0b5585c 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 _0x143c=['findIndex','name','NODE_PATH','string','env','pathExists','then','readJSON','info','Updating\x20app.json','exports','fs-extra','../config/environment','root','server/app.json','resolve','isArray','apps'];(function(_0x49740c,_0x75ef59){var _0x203875=function(_0x3896a9){while(--_0x3896a9){_0x49740c['push'](_0x49740c['shift']());}};_0x203875(++_0x75ef59);}(_0x143c,0xd1));var _0xc143=function(_0x25ad30,_0x4d9cb8){_0x25ad30=_0x25ad30-0x0;var _0x97c45e=_0x143c[_0x25ad30];return _0x97c45e;};var fs=require(_0xc143('0x0'));var path=require('path');var config=require(_0xc143('0x1'));var root=config[_0xc143('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xc143('0x3'));var NODEPATH=path[_0xc143('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0xbed4e8){let _0x416f59=![];if(Array[_0xc143('0x5')](_0xbed4e8[_0xc143('0x6')])){var _0x46e6f3=_0xbed4e8[_0xc143('0x6')][_0xc143('0x7')](function(_0x79341f){return _0x79341f[_0xc143('0x8')]==='motion2';});if(_0x46e6f3>-0x1){var _0x55e0d3=_0xbed4e8[_0xc143('0x6')][_0x46e6f3];if(typeof _0x55e0d3['env'][_0xc143('0x9')]!==_0xc143('0xa')){_0x55e0d3[_0xc143('0xb')][_0xc143('0x9')]=NODEPATH;_0x416f59=!![];}}return{'appConfig':_0xbed4e8,'updated':_0x416f59};}}function updateAppConfig(_0x439b5c){return fs[_0xc143('0xc')](APP_JSON_PATH)[_0xc143('0xd')](function(_0x1775dd){if(_0x1775dd){return fs[_0xc143('0xe')](APP_JSON_PATH)[_0xc143('0xd')](function(_0x2181e4){var _0x13982a=setLegacyLibsNodeEnvPath(_0x2181e4);if(_0x13982a['updated']){_0x439b5c[_0xc143('0xf')](_0xc143('0x10'));return fs['writeJSON'](APP_JSON_PATH,_0x2181e4,{'spaces':0x2});}else{return Promise[_0xc143('0x4')]();}});}else{return Promise[_0xc143('0x4')]();}});}module[_0xc143('0x11')]=updateAppConfig; \ No newline at end of file +var _0xc793=['../config/environment','resolve','server/app.json','isArray','apps','findIndex','name','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path'];(function(_0x705c31,_0x4cbf05){var _0x23a61d=function(_0x38bf0f){while(--_0x38bf0f){_0x705c31['push'](_0x705c31['shift']());}};_0x23a61d(++_0x4cbf05);}(_0xc793,0xa0));var _0x3c79=function(_0x1ce092,_0x119fce){_0x1ce092=_0x1ce092-0x0;var _0x4cfd7b=_0xc793[_0x1ce092];return _0x4cfd7b;};var fs=require(_0x3c79('0x0'));var path=require(_0x3c79('0x1'));var config=require(_0x3c79('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x3c79('0x3')](root,_0x3c79('0x4'));var NODEPATH=path[_0x3c79('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x1c3a33){let _0x338e48=![];if(Array[_0x3c79('0x5')](_0x1c3a33['apps'])){var _0x3a7469=_0x1c3a33[_0x3c79('0x6')][_0x3c79('0x7')](function(_0x2e40db){return _0x2e40db[_0x3c79('0x8')]==='motion2';});if(_0x3a7469>-0x1){var _0x348d03=_0x1c3a33[_0x3c79('0x6')][_0x3a7469];if(typeof _0x348d03['env'][_0x3c79('0x9')]!=='string'){_0x348d03['env']['NODE_PATH']=NODEPATH;_0x338e48=!![];}}return{'appConfig':_0x1c3a33,'updated':_0x338e48};}}function updateAppConfig(_0x63b9c){return fs[_0x3c79('0xa')](APP_JSON_PATH)[_0x3c79('0xb')](function(_0x118156){if(_0x118156){return fs[_0x3c79('0xc')](APP_JSON_PATH)[_0x3c79('0xb')](function(_0x26ea85){var _0x437687=setLegacyLibsNodeEnvPath(_0x26ea85);if(_0x437687[_0x3c79('0xd')]){_0x63b9c[_0x3c79('0xe')](_0x3c79('0xf'));return fs[_0x3c79('0x10')](APP_JSON_PATH,_0x26ea85,{'spaces':0x2});}else{return Promise[_0x3c79('0x3')]();}});}else{return Promise[_0x3c79('0x3')]();}});}module[_0x3c79('0x11')]=updateAppConfig; \ No newline at end of file